From: Cris Di Sclafani Date: Fri, 30 Oct 2020 15:06:05 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=1e9a5f2dab199140d9cab53ffaf30741d649ffce;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c5a46d5..1f831af 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-30T14:01:16.097Z", "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-30T14:57:31.448Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9dbfdd4..08dea75 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-30T14:01:16.097Z", "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-30T14:57:31.448Z", "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 666b416..6a8ae40 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 _0x4499=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','action','STRING','motionbar','jscripty','urlForward','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x4686ef,_0x4ee3f2){var _0x23a1ff=function(_0x49e4c5){while(--_0x49e4c5){_0x4686ef['push'](_0x4686ef['shift']());}};_0x23a1ff(++_0x4ee3f2);}(_0x4499,0xf3));var _0x9449=function(_0x4be730,_0x341fe4){_0x4be730=_0x4be730-0x0;var _0x54bbe5=_0x4499[_0x4be730];return _0x54bbe5;};'use strict';var Sequelize=require(_0x9449('0x0'));module['exports']={'name':{'type':Sequelize[_0x9449('0x1')],'get':function(_0x22ecd4){return this['getDataValue'](_0x9449('0x2'));}},'action':{'type':Sequelize[_0x9449('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x9449('0x4'),_0x9449('0x5'),_0x9449('0x6'),'browser','bot','script']],'msg':_0x9449('0x7')}},'comment':_0x9449('0x7')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x9449('0x8')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x9449('0x9')},'data3':{'type':Sequelize[_0x9449('0x3')](0x1000),'comment':_0x9449('0xa')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x9449('0x3')](0x1000)},'data6':{'type':Sequelize[_0x9449('0x3')]},'data7':{'type':Sequelize[_0x9449('0xb')]}}; \ No newline at end of file +var _0x43f3=['exports','VIRTUAL','action','integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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]','TEXT','sequelize'];(function(_0x22bfa0,_0xa20f92){var _0x388c6a=function(_0x498ec1){while(--_0x498ec1){_0x22bfa0['push'](_0x22bfa0['shift']());}};_0x388c6a(++_0xa20f92);}(_0x43f3,0x1df));var _0x343f=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x43f3[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x343f('0x0'));module[_0x343f('0x1')]={'name':{'type':Sequelize[_0x343f('0x2')],'get':function(_0x4c77b4){return this['getDataValue'](_0x343f('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x343f('0x4'),_0x343f('0x5'),_0x343f('0x6'),'urlForward',_0x343f('0x7'),'bot',_0x343f('0x8')]],'msg':_0x343f('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x343f('0xa')](0x1000),'comment':_0x343f('0xb')},'data2':{'type':Sequelize[_0x343f('0xa')](0x1000),'comment':_0x343f('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x343f('0xd')},'data4':{'type':Sequelize[_0x343f('0xa')](0x1000)},'data5':{'type':Sequelize[_0x343f('0xa')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x343f('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a2eca85..c620a76 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 _0x338c=['fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x52fc49,_0x5d7d1c){var _0x496e80=function(_0x2f59d3){while(--_0x2f59d3){_0x52fc49['push'](_0x52fc49['shift']());}};_0x496e80(++_0x5d7d1c);}(_0x338c,0x1a3));var _0xc338=function(_0x1f5c9a,_0x2133a9){_0x1f5c9a=_0x1f5c9a-0x0;var _0x1764c9=_0x338c[_0x1f5c9a];return _0x1764c9;};'use strict';var pdf=require(_0xc338('0x0'));var emlformat=require(_0xc338('0x1'));var rimraf=require(_0xc338('0x2'));var zipdir=require(_0xc338('0x3'));var jsonpatch=require(_0xc338('0x4'));var rp=require(_0xc338('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc338('0x6'));var util=require(_0xc338('0x7'));var path=require(_0xc338('0x8'));var sox=require('sox');var csv=require(_0xc338('0x9'));var ejs=require(_0xc338('0xa'));var fs=require('fs');var _=require(_0xc338('0xb'));var squel=require(_0xc338('0xc'));var crypto=require(_0xc338('0xd'));var jsforce=require(_0xc338('0xe'));var deskjs=require(_0xc338('0xf'));var toCsv=require(_0xc338('0x9'));var querystring=require(_0xc338('0x10'));var Papa=require('papaparse');var Redis=require(_0xc338('0x11'));var authService=require(_0xc338('0x12'));var qs=require(_0xc338('0x13'));var as=require(_0xc338('0x14'));var hardwareService=require(_0xc338('0x15'));var logger=require(_0xc338('0x16'))(_0xc338('0x17'));var utils=require(_0xc338('0x18'));var config=require('../../config/environment');var db=require(_0xc338('0x19'))['db'];function respondWithStatusCode(_0x232fbf,_0x42020d){_0x42020d=_0x42020d||0xcc;return function(_0x1ae7ad){if(_0x1ae7ad){return _0x232fbf[_0xc338('0x1a')](_0x42020d);}return _0x232fbf[_0xc338('0x1b')](_0x42020d)['end']();};}function respondWithResult(_0x8af183,_0xc6a89){_0xc6a89=_0xc6a89||0xc8;return function(_0xe0a359){if(_0xe0a359){return _0x8af183[_0xc338('0x1b')](_0xc6a89)[_0xc338('0x1c')](_0xe0a359);}};}function respondWithFilteredResult(_0x28b510,_0x1bf6d5){return function(_0x21ebf3){if(_0x21ebf3){var _0x4033d8=_0x21ebf3[_0xc338('0x1d')],_0xf8cad8=_0x1bf6d5[_0xc338('0x1e')],_0x264566=_0x1bf6d5['offset']+_0x1bf6d5[_0xc338('0x1f')],_0x56c3aa;if(_0x264566>=_0x4033d8){_0x264566=_0x4033d8;_0x56c3aa=0xc8;}else{_0x56c3aa=0xce;}_0x28b510[_0xc338('0x1b')](_0x56c3aa);return _0x28b510[_0xc338('0x20')](_0xc338('0x21'),_0xf8cad8+'-'+_0x264566+'/'+_0x4033d8)[_0xc338('0x1c')](_0x21ebf3);}return null;};}function patchUpdates(_0x285f27){return function(_0xe88ff5){try{jsonpatch[_0xc338('0x22')](_0xe88ff5,_0x285f27,!![]);}catch(_0x30e68c){return BPromise['reject'](_0x30e68c);}return _0xe88ff5[_0xc338('0x23')]();};}function saveUpdates(_0x4ef35a,_0x1a2f1a){return function(_0x54a386){if(_0x54a386){return _0x54a386[_0xc338('0x24')](_0x4ef35a)[_0xc338('0x25')](function(_0x4f6e93){return _0x4f6e93;});}return null;};}function removeEntity(_0x1b7dc4,_0x1d9684){return function(_0x21e732){if(_0x21e732){return _0x21e732[_0xc338('0x26')]()[_0xc338('0x25')](function(){_0x1b7dc4[_0xc338('0x1b')](0xcc)[_0xc338('0x27')]();});}};}function handleEntityNotFound(_0x3cb69d,_0x5efaf3){return function(_0x4acb9f){if(!_0x4acb9f){_0x3cb69d['sendStatus'](0x194);}return _0x4acb9f;};}function handleError(_0x4a48c7,_0x5e6ebc){_0x5e6ebc=_0x5e6ebc||0x1f4;return function(_0x3ec46f){logger['error'](_0x3ec46f[_0xc338('0x28')]);if(_0x3ec46f[_0xc338('0x29')]){delete _0x3ec46f[_0xc338('0x29')];}_0x4a48c7['status'](_0x5e6ebc)['send'](_0x3ec46f);};}exports[_0xc338('0x24')]=function(_0x2a4e73,_0x33eb12){if(_0x2a4e73['body']['id']){delete _0x2a4e73[_0xc338('0x2a')]['id'];}return db[_0xc338('0x2b')][_0xc338('0x2c')]({'where':{'id':_0x2a4e73[_0xc338('0x2d')]['id']}})[_0xc338('0x25')](handleEntityNotFound(_0x33eb12,null))[_0xc338('0x25')](saveUpdates(_0x2a4e73[_0xc338('0x2a')],null))['then'](respondWithResult(_0x33eb12,null))[_0xc338('0x2e')](handleError(_0x33eb12,null));};exports[_0xc338('0x26')]=function(_0x154f86,_0x17d7b8){return db[_0xc338('0x2b')][_0xc338('0x2c')]({'where':{'id':_0x154f86[_0xc338('0x2d')]['id']}})[_0xc338('0x25')](handleEntityNotFound(_0x17d7b8,null))['then'](removeEntity(_0x17d7b8,null))[_0xc338('0x2e')](handleError(_0x17d7b8,null));}; \ No newline at end of file +var _0x8b67=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','body','Action','find','params','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x475d67,_0x875fdb){var _0x4df2f1=function(_0x17a44c){while(--_0x17a44c){_0x475d67['push'](_0x475d67['shift']());}};_0x4df2f1(++_0x875fdb);}(_0x8b67,0x178));var _0x78b6=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x8b67[_0x11a55c];return _0x26c390;};'use strict';var pdf=require(_0x78b6('0x0'));var emlformat=require(_0x78b6('0x1'));var rimraf=require(_0x78b6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x78b6('0x3'));var moment=require(_0x78b6('0x4'));var BPromise=require(_0x78b6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x78b6('0x6'));var sox=require('sox');var csv=require(_0x78b6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x78b6('0x8'));var squel=require(_0x78b6('0x9'));var crypto=require(_0x78b6('0xa'));var jsforce=require(_0x78b6('0xb'));var deskjs=require(_0x78b6('0xc'));var toCsv=require(_0x78b6('0x7'));var querystring=require(_0x78b6('0xd'));var Papa=require(_0x78b6('0xe'));var Redis=require(_0x78b6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x78b6('0x10'));var hardwareService=require(_0x78b6('0x11'));var logger=require(_0x78b6('0x12'))(_0x78b6('0x13'));var utils=require(_0x78b6('0x14'));var config=require(_0x78b6('0x15'));var db=require(_0x78b6('0x16'))['db'];function respondWithStatusCode(_0x2a5c59,_0x14c673){_0x14c673=_0x14c673||0xcc;return function(_0x25a1b4){if(_0x25a1b4){return _0x2a5c59[_0x78b6('0x17')](_0x14c673);}return _0x2a5c59[_0x78b6('0x18')](_0x14c673)[_0x78b6('0x19')]();};}function respondWithResult(_0x6c1a7,_0x39fa47){_0x39fa47=_0x39fa47||0xc8;return function(_0x33d752){if(_0x33d752){return _0x6c1a7[_0x78b6('0x18')](_0x39fa47)[_0x78b6('0x1a')](_0x33d752);}};}function respondWithFilteredResult(_0x15486a,_0x3c1a11){return function(_0x343109){if(_0x343109){var _0x33117b=_0x343109[_0x78b6('0x1b')],_0x2bd5a6=_0x3c1a11[_0x78b6('0x1c')],_0x531fa6=_0x3c1a11[_0x78b6('0x1c')]+_0x3c1a11[_0x78b6('0x1d')],_0x10a6bd;if(_0x531fa6>=_0x33117b){_0x531fa6=_0x33117b;_0x10a6bd=0xc8;}else{_0x10a6bd=0xce;}_0x15486a[_0x78b6('0x18')](_0x10a6bd);return _0x15486a['set'](_0x78b6('0x1e'),_0x2bd5a6+'-'+_0x531fa6+'/'+_0x33117b)[_0x78b6('0x1a')](_0x343109);}return null;};}function patchUpdates(_0x380416){return function(_0x407823){try{jsonpatch[_0x78b6('0x1f')](_0x407823,_0x380416,!![]);}catch(_0x597270){return BPromise['reject'](_0x597270);}return _0x407823[_0x78b6('0x20')]();};}function saveUpdates(_0x4b246e,_0x340942){return function(_0x297943){if(_0x297943){return _0x297943[_0x78b6('0x21')](_0x4b246e)[_0x78b6('0x22')](function(_0x48b72a){return _0x48b72a;});}return null;};}function removeEntity(_0x3863a5,_0x46f38c){return function(_0x3160d5){if(_0x3160d5){return _0x3160d5[_0x78b6('0x23')]()[_0x78b6('0x22')](function(){_0x3863a5[_0x78b6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb71996,_0x15eeee){return function(_0xc27580){if(!_0xc27580){_0xb71996[_0x78b6('0x17')](0x194);}return _0xc27580;};}function handleError(_0x39e5b4,_0x469f58){_0x469f58=_0x469f58||0x1f4;return function(_0x4776b0){logger['error'](_0x4776b0[_0x78b6('0x24')]);if(_0x4776b0[_0x78b6('0x25')]){delete _0x4776b0[_0x78b6('0x25')];}_0x39e5b4['status'](_0x469f58)[_0x78b6('0x26')](_0x4776b0);};}exports['update']=function(_0x19f13b,_0x258d51){if(_0x19f13b[_0x78b6('0x27')]['id']){delete _0x19f13b[_0x78b6('0x27')]['id'];}return db[_0x78b6('0x28')][_0x78b6('0x29')]({'where':{'id':_0x19f13b[_0x78b6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x258d51,null))['then'](saveUpdates(_0x19f13b['body'],null))[_0x78b6('0x22')](respondWithResult(_0x258d51,null))[_0x78b6('0x2b')](handleError(_0x258d51,null));};exports['destroy']=function(_0x47278e,_0xd57d64){return db[_0x78b6('0x28')]['find']({'where':{'id':_0x47278e[_0x78b6('0x2a')]['id']}})['then'](handleEntityNotFound(_0xd57d64,null))[_0x78b6('0x22')](removeEntity(_0xd57d64,null))['catch'](handleError(_0xd57d64,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 237bc02..0410f5c 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 _0x6dfe=['request-promise','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31e3d5,_0x3fa1cd){var _0x4da910=function(_0x5dc244){while(--_0x5dc244){_0x31e3d5['push'](_0x31e3d5['shift']());}};_0x4da910(++_0x3fa1cd);}(_0x6dfe,0xd7));var _0xe6df=function(_0x2b03cd,_0x565af3){_0x2b03cd=_0x2b03cd-0x0;var _0x3395d9=_0x6dfe[_0x2b03cd];return _0x3395d9;};'use strict';var _=require(_0xe6df('0x0'));var util=require(_0xe6df('0x1'));var logger=require(_0xe6df('0x2'))(_0xe6df('0x3'));var moment=require(_0xe6df('0x4'));var BPromise=require(_0xe6df('0x5'));var rp=require(_0xe6df('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe6df('0x7'));var attributes=require(_0xe6df('0x8'));module[_0xe6df('0x9')]=function(_0x22c78c,_0x9613d0){return _0x22c78c[_0xe6df('0xa')](_0xe6df('0xb'),attributes,{'tableName':_0xe6df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e61=['exports','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./action.attributes'];(function(_0x183aa3,_0x2388a1){var _0x5489dd=function(_0x1d88d0){while(--_0x1d88d0){_0x183aa3['push'](_0x183aa3['shift']());}};_0x5489dd(++_0x2388a1);}(_0x6e61,0x7b));var _0x16e6=function(_0x3ac151,_0x290a5f){_0x3ac151=_0x3ac151-0x0;var _0x2c2844=_0x6e61[_0x3ac151];return _0x2c2844;};'use strict';var _=require(_0x16e6('0x0'));var util=require(_0x16e6('0x1'));var logger=require(_0x16e6('0x2'))(_0x16e6('0x3'));var moment=require('moment');var BPromise=require(_0x16e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16e6('0x5'));var rimraf=require(_0x16e6('0x6'));var config=require(_0x16e6('0x7'));var attributes=require(_0x16e6('0x8'));module[_0x16e6('0x9')]=function(_0x311af8,_0x5461b8){return _0x311af8['define'](_0x16e6('0xa'),attributes,{'tableName':_0x16e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index b80fa59..8dcb756 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 _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6763260..c52da65 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 _0x4f30=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','multer'];(function(_0x10bfc9,_0x42f69c){var _0x3b4dbe=function(_0x35ea02){while(--_0x35ea02){_0x10bfc9['push'](_0x10bfc9['shift']());}};_0x3b4dbe(++_0x42f69c);}(_0x4f30,0xbd));var _0x04f3=function(_0x5e8498,_0x393ad9){_0x5e8498=_0x5e8498-0x0;var _0x3a5500=_0x4f30[_0x5e8498];return _0x3a5500;};'use strict';var multer=require(_0x04f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x04f3('0x1'));var express=require(_0x04f3('0x2'));var router=express[_0x04f3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x04f3('0x4'));var config=require(_0x04f3('0x5'));var controller=require(_0x04f3('0x6'));router['put']('/:id',auth[_0x04f3('0x7')](),controller[_0x04f3('0x8')]);router[_0x04f3('0x9')]('/:id',auth[_0x04f3('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x440b=['isAuthenticated','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id'];(function(_0x58b3fc,_0x25274a){var _0x3dab63=function(_0x4c1128){while(--_0x4c1128){_0x58b3fc['push'](_0x58b3fc['shift']());}};_0x3dab63(++_0x25274a);}(_0x440b,0x149));var _0xb440=function(_0x5f12c9,_0x999e31){_0x5f12c9=_0x5f12c9-0x0;var _0x53cbaf=_0x440b[_0x5f12c9];return _0x53cbaf;};'use strict';var multer=require(_0xb440('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb440('0x1'));var express=require(_0xb440('0x2'));var router=express[_0xb440('0x3')]();var auth=require(_0xb440('0x4'));var interaction=require(_0xb440('0x5'));var config=require(_0xb440('0x6'));var controller=require('./action.controller');router[_0xb440('0x7')](_0xb440('0x8'),auth[_0xb440('0x9')](),controller['update']);router[_0xb440('0xa')]('/:id',auth[_0xb440('0x9')](),controller[_0xb440('0xb')]);module[_0xb440('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index cd8e40a..3e00290 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 _0xd9cf=['exports','STRING','TEXT','sequelize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd9cf,0x163));var _0xfd9c=function(_0xe69ad2,_0x2ff48e){_0xe69ad2=_0xe69ad2-0x0;var _0x10b22b=_0xd9cf[_0xe69ad2];return _0x10b22b;};'use strict';var Sequelize=require(_0xfd9c('0x0'));module[_0xfd9c('0x1')]={'name':{'type':Sequelize[_0xfd9c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xfd9c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xfd9c('0x3')]},'joins':{'type':Sequelize[_0xfd9c('0x3')]}}; \ No newline at end of file +var _0x998c=['sequelize','exports','STRING','TEXT'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x998c,0x1dc));var _0xc998=function(_0x435b2f,_0x4c44da){_0x435b2f=_0x435b2f-0x0;var _0x181648=_0x998c[_0x435b2f];return _0x181648;};'use strict';var Sequelize=require(_0xc998('0x0'));module[_0xc998('0x1')]={'name':{'type':Sequelize[_0xc998('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc998('0x2')]},'parent':{'type':Sequelize[_0xc998('0x2')]},'table':{'type':Sequelize[_0xc998('0x2')]},'conditions':{'type':Sequelize[_0xc998('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 6cb68ba..b9386b2 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 _0x18a9=['fork','../../files/reports','countTable','QueryTypes','run','runReport','IS\x20NOT\x20EMPTY','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','then','get','CustomReports','UserProfileResource','destroy','stack','name','send','index','map','AnalyticCustomReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId','field','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','SELECT','join','left_join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','IS\x20NOT\x20NULL','AnalyticMetric','from','table','metric','groupBy','No\x20available\x20data','output','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process'];(function(_0x5d1691,_0x4a936a){var _0x2d522a=function(_0x249a9e){while(--_0x249a9e){_0x5d1691['push'](_0x5d1691['shift']());}};_0x2d522a(++_0x4a936a);}(_0x18a9,0x15b));var _0x918a=function(_0x518f4f,_0xc2f4c1){_0x518f4f=_0x518f4f-0x0;var _0x993397=_0x18a9[_0x518f4f];return _0x993397;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x918a('0x0'));var zipdir=require(_0x918a('0x1'));var jsonpatch=require(_0x918a('0x2'));var rp=require(_0x918a('0x3'));var moment=require(_0x918a('0x4'));var BPromise=require(_0x918a('0x5'));var Mustache=require(_0x918a('0x6'));var util=require(_0x918a('0x7'));var path=require(_0x918a('0x8'));var sox=require(_0x918a('0x9'));var csv=require(_0x918a('0xa'));var ejs=require(_0x918a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x918a('0xc'));var crypto=require(_0x918a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x918a('0xe'));var toCsv=require(_0x918a('0xa'));var querystring=require(_0x918a('0xf'));var Papa=require(_0x918a('0x10'));var Redis=require(_0x918a('0x11'));var authService=require(_0x918a('0x12'));var qs=require(_0x918a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x918a('0x14'));var logger=require(_0x918a('0x15'))(_0x918a('0x16'));var utils=require(_0x918a('0x17'));var config=require('../../config/environment');var db=require(_0x918a('0x18'))['db'];var dbH=require(_0x918a('0x18'))['dbH'];function respondWithStatusCode(_0x36f4aa,_0x3e4490){_0x3e4490=_0x3e4490||0xcc;return function(_0x1ff70a){if(_0x1ff70a){return _0x36f4aa[_0x918a('0x19')](_0x3e4490);}return _0x36f4aa['status'](_0x3e4490)[_0x918a('0x1a')]();};}function respondWithResult(_0x55c90e,_0x19583e){_0x19583e=_0x19583e||0xc8;return function(_0x595920){if(_0x595920){return _0x55c90e['status'](_0x19583e)[_0x918a('0x1b')](_0x595920);}};}function respondWithFilteredResult(_0x22bd74,_0x47ce2d){return function(_0x355174){if(_0x355174){var _0x5786e2=_0x355174['count'],_0x1c5eb9=_0x47ce2d[_0x918a('0x1c')],_0x17f988=_0x47ce2d['offset']+_0x47ce2d[_0x918a('0x1d')],_0x3decc8;if(_0x17f988>=_0x5786e2){_0x17f988=_0x5786e2;_0x3decc8=0xc8;}else{_0x3decc8=0xce;}_0x22bd74[_0x918a('0x1e')](_0x3decc8);return _0x22bd74[_0x918a('0x1f')](_0x918a('0x20'),_0x1c5eb9+'-'+_0x17f988+'/'+_0x5786e2)['json'](_0x355174);}return null;};}function patchUpdates(_0x21a4a3){return function(_0x200737){try{jsonpatch[_0x918a('0x21')](_0x200737,_0x21a4a3,!![]);}catch(_0x45e84d){return BPromise[_0x918a('0x22')](_0x45e84d);}return _0x200737[_0x918a('0x23')]();};}function saveUpdates(_0x2cf02b,_0x4fa3c4){return function(_0x17acb7){if(_0x17acb7){return _0x17acb7['update'](_0x2cf02b)[_0x918a('0x24')](function(_0x4961fb){return _0x4961fb;});}return null;};}function removeEntity(_0x4c5993,_0x4c7675){return function(_0x10d172){if(_0x10d172){return _0x10d172['destroy']()[_0x918a('0x24')](function(){var _0xd40a6c=_0x10d172[_0x918a('0x25')]({'plain':!![]});var _0x2d8077=_0x918a('0x26');return db[_0x918a('0x27')][_0x918a('0x28')]({'where':{'type':_0x2d8077,'resourceId':_0xd40a6c['id']}})[_0x918a('0x24')](function(){return _0x10d172;});})[_0x918a('0x24')](function(){_0x4c5993[_0x918a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a4106,_0x1bdb27){return function(_0x262d5c){if(!_0x262d5c){_0x1a4106['sendStatus'](0x194);}return _0x262d5c;};}function handleError(_0x22653a,_0x36f103){_0x36f103=_0x36f103||0x1f4;return function(_0x2728f2){logger['error'](_0x2728f2[_0x918a('0x29')]);if(_0x2728f2[_0x918a('0x2a')]){delete _0x2728f2[_0x918a('0x2a')];}_0x22653a[_0x918a('0x1e')](_0x36f103)[_0x918a('0x2b')](_0x2728f2);};}exports[_0x918a('0x2c')]=function(_0x51361c,_0x57b6a7){var _0x5ac4b4={},_0x89260f={},_0x2514ae={'count':0x0,'rows':[]};var _0x5e09fd=_[_0x918a('0x2d')](db[_0x918a('0x2e')]['rawAttributes'],function(_0x5c7d95){return{'name':_0x5c7d95[_0x918a('0x2f')],'type':_0x5c7d95['type'][_0x918a('0x30')]};});_0x89260f[_0x918a('0x31')]=_[_0x918a('0x2d')](_0x5e09fd,_0x918a('0x2a'));_0x89260f[_0x918a('0x32')]=_[_0x918a('0x33')](_0x51361c['query']);_0x89260f[_0x918a('0x34')]=_[_0x918a('0x35')](_0x89260f[_0x918a('0x31')],_0x89260f[_0x918a('0x32')]);_0x5ac4b4[_0x918a('0x36')]=_[_0x918a('0x35')](_0x89260f['model'],qs[_0x918a('0x37')](_0x51361c[_0x918a('0x32')][_0x918a('0x37')]));_0x5ac4b4['attributes']=_0x5ac4b4[_0x918a('0x36')]['length']?_0x5ac4b4[_0x918a('0x36')]:_0x89260f['model'];if(!_0x51361c[_0x918a('0x32')][_0x918a('0x38')](_0x918a('0x39'))){_0x5ac4b4[_0x918a('0x1d')]=qs[_0x918a('0x1d')](_0x51361c['query']['limit']);_0x5ac4b4[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0x51361c['query'][_0x918a('0x1c')]);}_0x5ac4b4[_0x918a('0x3a')]=qs[_0x918a('0x3b')](_0x51361c[_0x918a('0x32')][_0x918a('0x3b')]);_0x5ac4b4[_0x918a('0x3c')]=qs[_0x918a('0x34')](_['pick'](_0x51361c[_0x918a('0x32')],_0x89260f['filters']),_0x5e09fd);if(_0x51361c['query'][_0x918a('0x3d')]){_0x5ac4b4[_0x918a('0x3c')]=_[_0x918a('0x3e')](_0x5ac4b4[_0x918a('0x3c')],{'$or':_['map'](_0x5e09fd,function(_0xa86b9d){if(_0xa86b9d[_0x918a('0x3f')]!==_0x918a('0x40')){var _0x29461c={};_0x29461c[_0xa86b9d[_0x918a('0x2a')]]={'$like':'%'+_0x51361c['query'][_0x918a('0x3d')]+'%'};return _0x29461c;}})});}_0x5ac4b4=_[_0x918a('0x3e')]({},_0x5ac4b4,_0x51361c[_0x918a('0x41')]);var _0x11ef8e={'where':_0x5ac4b4[_0x918a('0x3c')]};return db[_0x918a('0x2e')][_0x918a('0x42')](_0x11ef8e)[_0x918a('0x24')](function(_0x2b14de){_0x2514ae['count']=_0x2b14de;if(_0x51361c[_0x918a('0x32')][_0x918a('0x43')]){_0x5ac4b4[_0x918a('0x44')]=[{'all':!![]}];}return db[_0x918a('0x2e')][_0x918a('0x45')](_0x5ac4b4);})[_0x918a('0x24')](function(_0xcc20a0){_0x2514ae['rows']=_0xcc20a0;return _0x2514ae;})[_0x918a('0x24')](respondWithFilteredResult(_0x57b6a7,_0x5ac4b4))[_0x918a('0x46')](handleError(_0x57b6a7,null));};exports[_0x918a('0x47')]=function(_0x44c419,_0x5e76d0){var _0x6140e8={'raw':![],'where':{'id':_0x44c419[_0x918a('0x48')]['id']}},_0x55107d={};_0x55107d[_0x918a('0x31')]=_['keys'](db['AnalyticCustomReport'][_0x918a('0x49')]);_0x55107d[_0x918a('0x32')]=_[_0x918a('0x33')](_0x44c419[_0x918a('0x32')]);_0x55107d['filters']=_['intersection'](_0x55107d[_0x918a('0x31')],_0x55107d[_0x918a('0x32')]);_0x6140e8[_0x918a('0x36')]=_[_0x918a('0x35')](_0x55107d['model'],qs['fields'](_0x44c419[_0x918a('0x32')]['fields']));_0x6140e8[_0x918a('0x36')]=_0x6140e8[_0x918a('0x36')][_0x918a('0x4a')]?_0x6140e8[_0x918a('0x36')]:_0x55107d[_0x918a('0x31')];if(_0x44c419[_0x918a('0x32')][_0x918a('0x43')]){_0x6140e8[_0x918a('0x44')]=[{'all':!![]}];}_0x6140e8=_[_0x918a('0x3e')]({},_0x6140e8,_0x44c419[_0x918a('0x41')]);return db[_0x918a('0x2e')][_0x918a('0x4b')](_0x6140e8)[_0x918a('0x24')](handleEntityNotFound(_0x5e76d0,null))[_0x918a('0x24')](respondWithResult(_0x5e76d0,null))['catch'](handleError(_0x5e76d0,null));};exports[_0x918a('0x4c')]=function(_0x4d3a00,_0x56af76){return db[_0x918a('0x2e')]['create'](_0x4d3a00[_0x918a('0x4d')],{})[_0x918a('0x24')](function(_0x5e1a6a){var _0x4e4c83=_0x4d3a00[_0x918a('0x4e')]['get']({'plain':!![]});if(!_0x4e4c83)throw new Error(_0x918a('0x4f'));if(_0x4e4c83[_0x918a('0x50')]===_0x918a('0x4e')){var _0x365ede=_0x5e1a6a[_0x918a('0x25')]({'plain':!![]});var _0x509241=_0x918a('0x51');return db[_0x918a('0x52')][_0x918a('0x4b')]({'where':{'name':_0x509241,'userProfileId':_0x4e4c83['userProfileId']},'raw':!![]})[_0x918a('0x24')](function(_0x4be894){if(_0x4be894&&_0x4be894[_0x918a('0x53')]===0x0){return db[_0x918a('0x27')][_0x918a('0x4c')]({'name':_0x365ede[_0x918a('0x2a')],'resourceId':_0x365ede['id'],'type':'CustomReports','sectionId':_0x4be894['id']},{})[_0x918a('0x24')](function(){return _0x5e1a6a;});}else{return _0x5e1a6a;}})[_0x918a('0x46')](function(_0x46170e){logger[_0x918a('0x54')](_0x918a('0x55'),_0x46170e);throw _0x46170e;});}return _0x5e1a6a;})['then'](respondWithResult(_0x56af76,0xc9))[_0x918a('0x46')](handleError(_0x56af76,null));};exports[_0x918a('0x56')]=function(_0x3f1632,_0x116148){if(_0x3f1632['body']['id']){delete _0x3f1632[_0x918a('0x4d')]['id'];}return db[_0x918a('0x2e')]['find']({'where':{'id':_0x3f1632[_0x918a('0x48')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x116148,null))[_0x918a('0x24')](saveUpdates(_0x3f1632[_0x918a('0x4d')],null))['then'](respondWithResult(_0x116148,null))[_0x918a('0x46')](handleError(_0x116148,null));};exports[_0x918a('0x28')]=function(_0x1a2159,_0x449554){return db[_0x918a('0x2e')][_0x918a('0x4b')]({'where':{'id':_0x1a2159[_0x918a('0x48')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x449554,null))[_0x918a('0x24')](removeEntity(_0x449554,null))[_0x918a('0x46')](handleError(_0x449554,null));};exports[_0x918a('0x57')]=function(_0x29c89c,_0x45f308){var _0x241937=0xa;var _0x109fea=['join','left_join',_0x918a('0x58'),_0x918a('0x59')];var _0x2eed85={'SUM':_0x918a('0x5a'),'COUNT':_0x918a('0x5b'),'COUNT DISTINCT':_0x918a('0x5c'),'MAX':_0x918a('0x5d'),'MIN':_0x918a('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x918a('0x5f'),'GROUP_CONCAT ASC':_0x918a('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x215e37={'SEC_TO_TIME':_0x918a('0x61'),'DATE':_0x918a('0x62'),'HOUR':_0x918a('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x918a('0x64')};var _0x27909c=function(_0x4d54bf){return!_[_0x918a('0x65')]([_0x918a('0x66'),'IS\x20NOT\x20NULL',_0x918a('0x67'),'IS\x20NOT\x20EMPTY'],_0x4d54bf);};var _0x217118=function(_0x17a61c){if(!_0x17a61c||!_0x17a61c[_0x918a('0x68')][_0x918a('0x4a')]){return'';}for(var _0x4d4d91='(',_0x37ab58=0x0;_0x37ab58<_0x17a61c[_0x918a('0x68')][_0x918a('0x4a')];_0x37ab58+=0x1){_0x37ab58>0x0&&(_0x4d4d91+='\x20'+_0x17a61c[_0x918a('0x69')]+'\x20');_0x4d4d91+=_0x17a61c[_0x918a('0x68')][_0x37ab58][_0x918a('0x6a')]?_0x217118(_0x17a61c[_0x918a('0x68')][_0x37ab58][_0x918a('0x6a')]):_0x17a61c[_0x918a('0x68')][_0x37ab58]['field']+'\x20'+_0x17a61c[_0x918a('0x68')][_0x37ab58][_0x918a('0x6b')]+(_0x27909c(_0x17a61c[_0x918a('0x68')][_0x37ab58]['condition'])?'\x20'+_0x17a61c['rules'][_0x37ab58][_0x918a('0x6c')]:'');}return _0x4d4d91+')';};var _0x465f9c={'where':{'id':_0x29c89c[_0x918a('0x48')]['id']}},_0x157ffd,_0x1c88a3,_0x262ec3,_0x4dbd13,_0x49b3fe;_0x465f9c=_[_0x918a('0x3e')]({},_0x465f9c,_0x29c89c[_0x918a('0x41')]);return db[_0x918a('0x2e')][_0x918a('0x4b')](_0x465f9c)[_0x918a('0x24')](function(_0x28117e){if(_0x28117e){_0x157ffd=_0x28117e;return _0x28117e[_0x918a('0x6d')]();}return null;})['then'](function(_0x1ce227){if(_0x1ce227){if(!_0x1ce227[_0x918a('0x4a')]){throw new db[(_0x918a('0x6e'))][(_0x918a('0x6f'))](_0x918a('0x70'),0x193);}_0x1c88a3=_0x1ce227;return db['AnalyticMetric'][_0x918a('0x45')]({'raw':!![]});}return null;})[_0x918a('0x24')](function(_0x418d25){if(_0x418d25){_0x262ec3=_[_0x918a('0x71')](_0x418d25,'id');var _0x5db7c3;var _0x236760=squel[_0x918a('0x72')]();_0x236760['from'](_0x157ffd['table']);for(var _0x411e02=0x0;_0x411e02<_0x1c88a3[_0x918a('0x4a')];_0x411e02+=0x1){_0x5db7c3=_0x1c88a3[_0x411e02][_0x918a('0x73')]?_0x262ec3[_0x1c88a3[_0x411e02]['MetricId']]['metric']:_0x1c88a3[_0x411e02][_0x918a('0x74')];_0x5db7c3=_0x1c88a3[_0x411e02][_0x918a('0x75')]?_[_0x918a('0x76')](_0x2eed85[_0x1c88a3[_0x411e02][_0x918a('0x75')]],'%s',_0x5db7c3):_0x5db7c3;_0x5db7c3=_0x1c88a3[_0x411e02][_0x918a('0x77')]?_['replace'](_0x215e37[_0x1c88a3[_0x411e02][_0x918a('0x77')]],'%s',_0x5db7c3):_0x5db7c3;if(_0x1c88a3[_0x411e02]['groupBy']){_0x236760['group'](_0x5db7c3);}_0x1c88a3[_0x411e02]['orderBy']&&_0x236760['order'](_0x5db7c3,_0x1c88a3[_0x411e02][_0x918a('0x78')]===_0x918a('0x79')?![]:!![]);_0x236760[_0x918a('0x74')](_0x5db7c3,_0x1c88a3[_0x411e02][_0x918a('0x7a')]||_0x5db7c3);}if(_0x157ffd[_0x918a('0x7b')]){_0x157ffd[_0x918a('0x7b')]=JSON['parse'](_0x157ffd['joins']);for(var _0x215d4d=0x0;_0x215d4d<_0x157ffd[_0x918a('0x7b')][_0x918a('0x4a')];_0x215d4d+=0x1){if(_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x3f')]&&_[_0x918a('0x65')](_0x109fea,_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x3f')])&&_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7c')]&&_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7d')]&&_0x157ffd['joins'][_0x215d4d][_0x918a('0x7e')]){_0x236760[_0x157ffd[_0x918a('0x7b')][_0x215d4d]['type']](_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7d')],null,util[_0x918a('0x77')](_0x918a('0x7f'),_0x157ffd['table'],_0x157ffd['joins'][_0x215d4d][_0x918a('0x7c')],_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7d')],_0x157ffd[_0x918a('0x7b')][_0x215d4d][_0x918a('0x7e')]));}}}if(_0x157ffd['conditions']){_0x157ffd[_0x918a('0x80')]=JSON[_0x918a('0x81')](_0x157ffd[_0x918a('0x80')]);_0x236760['where'](_0x217118(_0x157ffd[_0x918a('0x80')]['group']));}_0x49b3fe=_0x236760[_0x918a('0x82')]();_0x236760[_0x918a('0x1d')](_0x241937);_0x236760[_0x918a('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x236760[_0x918a('0x83')]());return db[_0x918a('0x84')]['query'](_0x236760[_0x918a('0x83')](),{'type':db[_0x918a('0x84')]['QueryTypes'][_0x918a('0x85')]});}})[_0x918a('0x24')](respondWithResult(_0x45f308,null))[_0x918a('0x46')](handleError(_0x45f308,null));};function runReport(_0x3257f1,_0x11c3f1,_0x457124){var _0x150067=_0x11c3f1[_0x918a('0x2a')];var _0x1270ed=0xa;var _0x57c50d=[_0x918a('0x86'),_0x918a('0x87'),_0x918a('0x58'),_0x918a('0x59')];var _0x120609={'SUM':'SUM(%s)','COUNT':_0x918a('0x5b'),'COUNT DISTINCT':_0x918a('0x5c'),'MAX':_0x918a('0x5d'),'MIN':'MIN(%s)','AVG':_0x918a('0x88'),'GROUP_CONCAT':_0x918a('0x5f'),'GROUP_CONCAT ASC':_0x918a('0x60'),'GROUP_CONCAT DESC':_0x918a('0x89')};var _0x22029d={'SEC_TO_TIME':_0x918a('0x61'),'DATE':_0x918a('0x62'),'HOUR':_0x918a('0x63'),'ROUND':_0x918a('0x8a'),'UNIX_TIMESTAMP':_0x918a('0x64')};var _0x549004=function(_0x45c13b){return!_[_0x918a('0x65')]([_0x918a('0x66'),_0x918a('0x8b'),_0x918a('0x67'),'IS\x20NOT\x20EMPTY'],_0x45c13b);};var _0x3b499d=function(_0x32327f){if(!_0x32327f||!_0x32327f[_0x918a('0x68')]['length']){return'';}for(var _0x2b896f='(',_0x4e840b=0x0;_0x4e840b<_0x32327f['rules'][_0x918a('0x4a')];_0x4e840b+=0x1){_0x4e840b>0x0&&(_0x2b896f+='\x20'+_0x32327f['operator']+'\x20');_0x2b896f+=_0x32327f[_0x918a('0x68')][_0x4e840b][_0x918a('0x6a')]?_0x3b499d(_0x32327f[_0x918a('0x68')][_0x4e840b][_0x918a('0x6a')]):_0x32327f[_0x918a('0x68')][_0x4e840b][_0x918a('0x74')]+'\x20'+_0x32327f[_0x918a('0x68')][_0x4e840b][_0x918a('0x6b')]+(_0x549004(_0x32327f['rules'][_0x4e840b]['condition'])?'\x20'+_0x32327f['rules'][_0x4e840b][_0x918a('0x6c')]:'');}return _0x2b896f+')';};var _0x584ff7={'where':{'id':_0x3257f1['id']}},_0x436177,_0x4db9f3,_0x23e559,_0x55a6ca,_0x5b0f68;_0x584ff7=_[_0x918a('0x3e')]({},_0x584ff7,_0x457124);return db[_0x918a('0x2e')]['find'](_0x584ff7)[_0x918a('0x24')](function(_0xa6c8df){if(_0xa6c8df){_0x436177=_0xa6c8df;return _0xa6c8df[_0x918a('0x6d')]();}return null;})[_0x918a('0x24')](function(_0x5c873c){if(_0x5c873c){if(!_0x5c873c[_0x918a('0x4a')]){throw new db[(_0x918a('0x6e'))][(_0x918a('0x6f'))](_0x918a('0x70'),0x193);}_0x4db9f3=_0x5c873c;return db[_0x918a('0x8c')][_0x918a('0x45')]({'raw':!![]});}return null;})['then'](function(_0x494a06){if(_0x494a06){_0x23e559=_[_0x918a('0x71')](_0x494a06,'id');var _0x3069a7;var _0x18ca71=squel[_0x918a('0x72')]();_0x18ca71[_0x918a('0x8d')](_0x436177[_0x918a('0x8e')]);for(var _0x346b6d=0x0;_0x346b6d<_0x4db9f3['length'];_0x346b6d+=0x1){_0x3069a7=_0x4db9f3[_0x346b6d][_0x918a('0x73')]?_0x23e559[_0x4db9f3[_0x346b6d]['MetricId']][_0x918a('0x8f')]:_0x4db9f3[_0x346b6d][_0x918a('0x74')];_0x3069a7=_0x4db9f3[_0x346b6d][_0x918a('0x75')]?_[_0x918a('0x76')](_0x120609[_0x4db9f3[_0x346b6d][_0x918a('0x75')]],'%s',_0x3069a7):_0x3069a7;_0x3069a7=_0x4db9f3[_0x346b6d][_0x918a('0x77')]?_[_0x918a('0x76')](_0x22029d[_0x4db9f3[_0x346b6d][_0x918a('0x77')]],'%s',_0x3069a7):_0x3069a7;if(_0x4db9f3[_0x346b6d][_0x918a('0x90')]){_0x18ca71[_0x918a('0x6a')](_0x3069a7);}_0x4db9f3[_0x346b6d]['orderBy']&&_0x18ca71[_0x918a('0x3a')](_0x3069a7,_0x4db9f3[_0x346b6d][_0x918a('0x78')]===_0x918a('0x79')?![]:!![]);_0x18ca71['field'](_0x3069a7,_0x4db9f3[_0x346b6d][_0x918a('0x7a')]||_0x3069a7);}if(_0x436177['joins']){_0x436177['joins']=JSON[_0x918a('0x81')](_0x436177['joins']);for(var _0x352e0f=0x0;_0x352e0f<_0x436177[_0x918a('0x7b')]['length'];_0x352e0f+=0x1){if(_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x3f')]&&_[_0x918a('0x65')](_0x57c50d,_0x436177['joins'][_0x352e0f][_0x918a('0x3f')])&&_0x436177[_0x918a('0x7b')][_0x352e0f]['parentKey']&&_0x436177['joins'][_0x352e0f][_0x918a('0x7d')]&&_0x436177[_0x918a('0x7b')][_0x352e0f]['foreignKey']){_0x18ca71[_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x3f')]](_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x7d')],null,util[_0x918a('0x77')](_0x918a('0x7f'),_0x436177['table'],_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x7c')],_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x7d')],_0x436177[_0x918a('0x7b')][_0x352e0f][_0x918a('0x7e')]));}}}if(_0x436177[_0x918a('0x80')]){_0x436177[_0x918a('0x80')]=JSON['parse'](_0x436177['conditions']);_0x18ca71['where'](_0x3b499d(_0x436177[_0x918a('0x80')][_0x918a('0x6a')]));}_0x5b0f68=_0x18ca71[_0x918a('0x82')]();_0x18ca71['limit'](_0x1270ed);_0x18ca71[_0x918a('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x18ca71[_0x918a('0x83')]());return db['sequelize'][_0x918a('0x32')](_0x18ca71[_0x918a('0x83')](),{'type':db[_0x918a('0x84')]['QueryTypes'][_0x918a('0x85')]});}})['then'](function(_0x899d02){if(!_0x899d02['length']){throw new db[(_0x918a('0x6e'))][(_0x918a('0x6f'))](_0x918a('0x91'),0xcc);}if(_0x11c3f1[_0x918a('0x92')]==='web'){return null;}var _0x573226=_[_0x918a('0x3e')](_0x11c3f1,{'name':_0x11c3f1['fullPath']||_0x11c3f1[_0x918a('0x2a')]||_0x436177[_0x918a('0x2a')],'basename':_0x150067,'savename':util[_0x918a('0x77')](_0x918a('0x93'),_0x11c3f1['name']||_0x436177[_0x918a('0x2a')],require(_0x918a('0x94'))[_0x918a('0x95')](0x4),_0x11c3f1[_0x918a('0x92')]||_0x918a('0x96')),'reportId':_0x436177['id'],'reportType':_0x918a('0x97')});return db[_0x918a('0x98')][_0x918a('0x4c')](_0x573226,{'raw':!![]});})[_0x918a('0x24')](function(_0x109fe4){if(_0x436177['table']==='cdr'){_0x5b0f68['where'](_0x436177[_0x918a('0x8e')]+_0x918a('0x99'),_0x11c3f1[_0x918a('0x9a')],_0x11c3f1[_0x918a('0x9b')]);}else{_0x5b0f68[_0x918a('0x3c')](_0x436177[_0x918a('0x8e')]+_0x918a('0x9c'),_0x11c3f1[_0x918a('0x9a')],_0x11c3f1[_0x918a('0x9b')]);}if(_0x109fe4){logger[_0x918a('0x9d')](_0x918a('0x9e'),_0x5b0f68['toString']());require(_0x918a('0x9f'))[_0x918a('0xa0')](path[_0x918a('0x86')](__dirname,'../../components/export/',_0x109fe4[_0x918a('0x92')]),[_0x109fe4['id'],_0x5b0f68[_0x918a('0x83')](),path[_0x918a('0x86')](__dirname,_0x918a('0xa1'),_0x109fe4['savename']),_0x150067]);return _0x109fe4;}else{var _0x1a2270=squel[_0x918a('0x72')]();_0x1a2270[_0x918a('0x8d')]('('+_0x5b0f68[_0x918a('0x83')]()+')',_0x918a('0xa2'));_0x1a2270[_0x918a('0x74')]('COUNT(*)',_0x918a('0x42'));_0x5b0f68[_0x918a('0x1d')](_0x11c3f1['limit']||_0x1270ed);_0x5b0f68['offset'](_0x11c3f1['offset']||0x0);return dbH[_0x918a('0x84')][_0x918a('0x32')](_0x1a2270[_0x918a('0x83')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x3e9580){if(!_0x3e9580[_0x918a('0x4a')]){_0x55a6ca=0x0;}else{_0x55a6ca=_0x3e9580[0x0][_0x918a('0x42')]||0x0;}return dbH[_0x918a('0x84')][_0x918a('0x32')](_0x5b0f68['toString'](),{'type':dbH[_0x918a('0x84')][_0x918a('0xa3')][_0x918a('0x85')]});})[_0x918a('0x24')](function(_0x4bd771){return{'rows':_0x4bd771||[],'count':_0x55a6ca};});}});}exports[_0x918a('0xa4')]=function(_0x38d247,_0x592726){return runReport(_0x38d247[_0x918a('0x48')],_0x38d247['query'],_0x38d247['options'])[_0x918a('0x24')](respondWithResult(_0x592726,null))[_0x918a('0x46')](handleError(_0x592726,null));};exports[_0x918a('0xa5')]=runReport;exports[_0x918a('0x32')]=function(_0x19562c,_0x2b695d){var _0x573e9a=0xa;var _0x58af2b=[_0x918a('0x86'),_0x918a('0x87'),'right_join',_0x918a('0x59')];var _0x10edc7={'SUM':_0x918a('0x5a'),'COUNT':_0x918a('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x918a('0x5d'),'MIN':'MIN(%s)','AVG':_0x918a('0x88'),'GROUP_CONCAT':_0x918a('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x918a('0x89')};var _0x8aba00={'SEC_TO_TIME':_0x918a('0x61'),'DATE':_0x918a('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x918a('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x20a0a5=function(_0x46996a){return!_[_0x918a('0x65')]([_0x918a('0x66'),_0x918a('0x8b'),'IS\x20EMPTY',_0x918a('0xa6')],_0x46996a);};var _0x17b1e7=function(_0x15b680){if(!_0x15b680||!_0x15b680[_0x918a('0x68')]['length']){return'';}for(var _0x28a9e1='(',_0x15469b=0x0;_0x15469b<_0x15b680[_0x918a('0x68')][_0x918a('0x4a')];_0x15469b+=0x1){_0x15469b>0x0&&(_0x28a9e1+='\x20'+_0x15b680[_0x918a('0x69')]+'\x20');_0x28a9e1+=_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6a')]?_0x17b1e7(_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6a')]):_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x74')]+'\x20'+_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6b')]+(_0x20a0a5(_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6b')])?'\x20'+_0x15b680[_0x918a('0x68')][_0x15469b][_0x918a('0x6c')]:'');}return _0x28a9e1+')';};var _0x2f4033={'where':{'id':_0x19562c[_0x918a('0x48')]['id']}},_0x4564b9,_0x12302a,_0x559f5b,_0x22f364,_0x573cd6;_0x2f4033=_[_0x918a('0x3e')]({},_0x2f4033,_0x19562c['options']);return db[_0x918a('0x2e')][_0x918a('0x4b')](_0x2f4033)[_0x918a('0x24')](function(_0x2d759c){if(_0x2d759c){_0x4564b9=_0x2d759c;return _0x2d759c[_0x918a('0x6d')]();}return null;})[_0x918a('0x24')](function(_0x4fcf78){if(_0x4fcf78){if(!_0x4fcf78['length']){throw new db[(_0x918a('0x6e'))][(_0x918a('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x12302a=_0x4fcf78;return db['AnalyticMetric'][_0x918a('0x45')]({'raw':!![]});}return null;})['then'](function(_0x156f05){if(_0x156f05){_0x559f5b=_[_0x918a('0x71')](_0x156f05,'id');var _0x656c83;var _0x4242f7=squel[_0x918a('0x72')]();_0x4242f7[_0x918a('0x8d')](_0x4564b9[_0x918a('0x8e')]);for(var _0x2cdd9d=0x0;_0x2cdd9d<_0x12302a[_0x918a('0x4a')];_0x2cdd9d+=0x1){_0x656c83=_0x12302a[_0x2cdd9d][_0x918a('0x73')]?_0x559f5b[_0x12302a[_0x2cdd9d][_0x918a('0x73')]][_0x918a('0x8f')]:_0x12302a[_0x2cdd9d][_0x918a('0x74')];_0x656c83=_0x12302a[_0x2cdd9d][_0x918a('0x75')]?_['replace'](_0x10edc7[_0x12302a[_0x2cdd9d][_0x918a('0x75')]],'%s',_0x656c83):_0x656c83;_0x656c83=_0x12302a[_0x2cdd9d][_0x918a('0x77')]?_[_0x918a('0x76')](_0x8aba00[_0x12302a[_0x2cdd9d][_0x918a('0x77')]],'%s',_0x656c83):_0x656c83;if(_0x12302a[_0x2cdd9d][_0x918a('0x90')]){_0x4242f7[_0x918a('0x6a')](_0x656c83);}_0x12302a[_0x2cdd9d][_0x918a('0x78')]&&_0x4242f7[_0x918a('0x3a')](_0x656c83,_0x12302a[_0x2cdd9d]['orderBy']===_0x918a('0x79')?![]:!![]);_0x4242f7[_0x918a('0x74')](_0x656c83,_0x12302a[_0x2cdd9d]['alias']||_0x656c83);}if(_0x4564b9[_0x918a('0x7b')]){_0x4564b9[_0x918a('0x7b')]=JSON[_0x918a('0x81')](_0x4564b9[_0x918a('0x7b')]);for(var _0x2c5c92=0x0;_0x2c5c92<_0x4564b9[_0x918a('0x7b')]['length'];_0x2c5c92+=0x1){if(_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x3f')]&&_[_0x918a('0x65')](_0x58af2b,_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x3f')])&&_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x7c')]&&_0x4564b9[_0x918a('0x7b')][_0x2c5c92]['foreignTable']&&_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x7e')]){_0x4242f7[_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x3f')]](_0x4564b9['joins'][_0x2c5c92][_0x918a('0x7d')],null,util[_0x918a('0x77')](_0x918a('0x7f'),_0x4564b9['table'],_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x7c')],_0x4564b9[_0x918a('0x7b')][_0x2c5c92][_0x918a('0x7d')],_0x4564b9['joins'][_0x2c5c92][_0x918a('0x7e')]));}}}if(_0x4564b9[_0x918a('0x80')]){_0x4564b9[_0x918a('0x80')]=JSON[_0x918a('0x81')](_0x4564b9['conditions']);_0x4242f7[_0x918a('0x3c')](_0x17b1e7(_0x4564b9[_0x918a('0x80')][_0x918a('0x6a')]));}_0x573cd6=_0x4242f7[_0x918a('0x82')]();_0x4242f7[_0x918a('0x1d')](_0x573e9a);_0x4242f7[_0x918a('0x1c')](0x0);logger[_0x918a('0xa7')](_0x918a('0xa8'),_0x4242f7[_0x918a('0x83')]());return db[_0x918a('0x84')][_0x918a('0x32')](_0x4242f7[_0x918a('0x83')](),{'type':db[_0x918a('0x84')]['QueryTypes'][_0x918a('0x85')]});}})[_0x918a('0x24')](function(){return{'sql':_0x573cd6['toString']()};})[_0x918a('0x24')](respondWithResult(_0x2b695d,null))['catch'](handleError(_0x2b695d,null));}; \ No newline at end of file +var _0xa7dc=['CustomReports','UserProfileResource','sendStatus','stack','name','map','AnalyticCustomReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','count','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','condition','options','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','MetricId','function','replace','format','groupBy','alias','parse','joins','includes','foreignTable','foreignKey','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','IS\x20NULL','IS\x20EMPTY','value','select','metric','order','orderBy','DESC','table','No\x20available\x20data','fullPath','randomstring','generate','output','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','run','runReport','AVG(%s)','HOUR(%s)','%s.%s\x20=\x20%s.%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','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/environment','../../mysqldb','dbH','end','status','json','offset','limit','set','apply','save','update','then','destroy','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa7dc,0x11d));var _0xca7d=function(_0x2ff8ac,_0x34734f){_0x2ff8ac=_0x2ff8ac-0x0;var _0x37ebef=_0xa7dc[_0x2ff8ac];return _0x37ebef;};'use strict';var pdf=require(_0xca7d('0x0'));var emlformat=require(_0xca7d('0x1'));var rimraf=require(_0xca7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca7d('0x3'));var rp=require('request-promise');var moment=require(_0xca7d('0x4'));var BPromise=require(_0xca7d('0x5'));var Mustache=require(_0xca7d('0x6'));var util=require(_0xca7d('0x7'));var path=require(_0xca7d('0x8'));var sox=require(_0xca7d('0x9'));var csv=require(_0xca7d('0xa'));var ejs=require(_0xca7d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xca7d('0xc'));var crypto=require(_0xca7d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xca7d('0xe'));var toCsv=require(_0xca7d('0xa'));var querystring=require(_0xca7d('0xf'));var Papa=require('papaparse');var Redis=require(_0xca7d('0x10'));var authService=require(_0xca7d('0x11'));var qs=require(_0xca7d('0x12'));var as=require(_0xca7d('0x13'));var hardwareService=require(_0xca7d('0x14'));var logger=require('../../config/logger')(_0xca7d('0x15'));var utils=require('../../config/utils');var config=require(_0xca7d('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xca7d('0x17'))[_0xca7d('0x18')];function respondWithStatusCode(_0x3b8467,_0x2c3730){_0x2c3730=_0x2c3730||0xcc;return function(_0x4c1618){if(_0x4c1618){return _0x3b8467['sendStatus'](_0x2c3730);}return _0x3b8467['status'](_0x2c3730)[_0xca7d('0x19')]();};}function respondWithResult(_0x36f922,_0x3d8e7b){_0x3d8e7b=_0x3d8e7b||0xc8;return function(_0x39caec){if(_0x39caec){return _0x36f922[_0xca7d('0x1a')](_0x3d8e7b)[_0xca7d('0x1b')](_0x39caec);}};}function respondWithFilteredResult(_0x369923,_0x37bae3){return function(_0x254305){if(_0x254305){var _0x1a6cb7=_0x254305['count'],_0x2f6e8a=_0x37bae3[_0xca7d('0x1c')],_0x245c7c=_0x37bae3[_0xca7d('0x1c')]+_0x37bae3[_0xca7d('0x1d')],_0x51a6d0;if(_0x245c7c>=_0x1a6cb7){_0x245c7c=_0x1a6cb7;_0x51a6d0=0xc8;}else{_0x51a6d0=0xce;}_0x369923[_0xca7d('0x1a')](_0x51a6d0);return _0x369923[_0xca7d('0x1e')]('Content-Range',_0x2f6e8a+'-'+_0x245c7c+'/'+_0x1a6cb7)['json'](_0x254305);}return null;};}function patchUpdates(_0xcb2e83){return function(_0x4cb0d8){try{jsonpatch[_0xca7d('0x1f')](_0x4cb0d8,_0xcb2e83,!![]);}catch(_0x6a89a8){return BPromise['reject'](_0x6a89a8);}return _0x4cb0d8[_0xca7d('0x20')]();};}function saveUpdates(_0x5c106e,_0x583a24){return function(_0x408b07){if(_0x408b07){return _0x408b07[_0xca7d('0x21')](_0x5c106e)[_0xca7d('0x22')](function(_0x2fcf0b){return _0x2fcf0b;});}return null;};}function removeEntity(_0x5d049b,_0x4121ce){return function(_0x1cca8a){if(_0x1cca8a){return _0x1cca8a[_0xca7d('0x23')]()[_0xca7d('0x22')](function(){var _0x79fc7d=_0x1cca8a[_0xca7d('0x24')]({'plain':!![]});var _0xf4b873=_0xca7d('0x25');return db[_0xca7d('0x26')][_0xca7d('0x23')]({'where':{'type':_0xf4b873,'resourceId':_0x79fc7d['id']}})['then'](function(){return _0x1cca8a;});})[_0xca7d('0x22')](function(){_0x5d049b[_0xca7d('0x1a')](0xcc)[_0xca7d('0x19')]();});}};}function handleEntityNotFound(_0x59449f,_0x24cc8d){return function(_0xc2048d){if(!_0xc2048d){_0x59449f[_0xca7d('0x27')](0x194);}return _0xc2048d;};}function handleError(_0x162bf8,_0xb08cfd){_0xb08cfd=_0xb08cfd||0x1f4;return function(_0x254235){logger['error'](_0x254235[_0xca7d('0x28')]);if(_0x254235[_0xca7d('0x29')]){delete _0x254235['name'];}_0x162bf8[_0xca7d('0x1a')](_0xb08cfd)['send'](_0x254235);};}exports['index']=function(_0x13c1df,_0x5dfe5f){var _0x37c8a6={},_0x1c4e7d={},_0x53dc48={'count':0x0,'rows':[]};var _0x3071e5=_[_0xca7d('0x2a')](db[_0xca7d('0x2b')]['rawAttributes'],function(_0x86cfac){return{'name':_0x86cfac[_0xca7d('0x2c')],'type':_0x86cfac[_0xca7d('0x2d')]['key']};});_0x1c4e7d[_0xca7d('0x2e')]=_[_0xca7d('0x2a')](_0x3071e5,_0xca7d('0x29'));_0x1c4e7d[_0xca7d('0x2f')]=_[_0xca7d('0x30')](_0x13c1df[_0xca7d('0x2f')]);_0x1c4e7d[_0xca7d('0x31')]=_[_0xca7d('0x32')](_0x1c4e7d['model'],_0x1c4e7d['query']);_0x37c8a6[_0xca7d('0x33')]=_[_0xca7d('0x32')](_0x1c4e7d[_0xca7d('0x2e')],qs[_0xca7d('0x34')](_0x13c1df['query']['fields']));_0x37c8a6[_0xca7d('0x33')]=_0x37c8a6['attributes']['length']?_0x37c8a6['attributes']:_0x1c4e7d[_0xca7d('0x2e')];if(!_0x13c1df['query'][_0xca7d('0x35')](_0xca7d('0x36'))){_0x37c8a6[_0xca7d('0x1d')]=qs['limit'](_0x13c1df[_0xca7d('0x2f')][_0xca7d('0x1d')]);_0x37c8a6[_0xca7d('0x1c')]=qs['offset'](_0x13c1df[_0xca7d('0x2f')][_0xca7d('0x1c')]);}_0x37c8a6['order']=qs[_0xca7d('0x37')](_0x13c1df['query'][_0xca7d('0x37')]);_0x37c8a6['where']=qs['filters'](_[_0xca7d('0x38')](_0x13c1df[_0xca7d('0x2f')],_0x1c4e7d[_0xca7d('0x31')]),_0x3071e5);if(_0x13c1df['query'][_0xca7d('0x39')]){_0x37c8a6[_0xca7d('0x3a')]=_[_0xca7d('0x3b')](_0x37c8a6[_0xca7d('0x3a')],{'$or':_[_0xca7d('0x2a')](_0x3071e5,function(_0x1025bd){if(_0x1025bd[_0xca7d('0x2d')]!=='VIRTUAL'){var _0x5ee41d={};_0x5ee41d[_0x1025bd['name']]={'$like':'%'+_0x13c1df[_0xca7d('0x2f')]['filter']+'%'};return _0x5ee41d;}})});}_0x37c8a6=_[_0xca7d('0x3b')]({},_0x37c8a6,_0x13c1df['options']);var _0x33d7bf={'where':_0x37c8a6['where']};return db[_0xca7d('0x2b')]['count'](_0x33d7bf)[_0xca7d('0x22')](function(_0x164b57){_0x53dc48[_0xca7d('0x3c')]=_0x164b57;if(_0x13c1df[_0xca7d('0x2f')]['includeAll']){_0x37c8a6['include']=[{'all':!![]}];}return db[_0xca7d('0x2b')]['findAll'](_0x37c8a6);})[_0xca7d('0x22')](function(_0x3cb377){_0x53dc48[_0xca7d('0x3d')]=_0x3cb377;return _0x53dc48;})[_0xca7d('0x22')](respondWithFilteredResult(_0x5dfe5f,_0x37c8a6))[_0xca7d('0x3e')](handleError(_0x5dfe5f,null));};exports[_0xca7d('0x3f')]=function(_0x2f19a0,_0x4c9a38){var _0x31ec86={'raw':![],'where':{'id':_0x2f19a0[_0xca7d('0x40')]['id']}},_0x4b36dd={};_0x4b36dd['model']=_[_0xca7d('0x30')](db['AnalyticCustomReport'][_0xca7d('0x41')]);_0x4b36dd['query']=_['keys'](_0x2f19a0[_0xca7d('0x2f')]);_0x4b36dd['filters']=_[_0xca7d('0x32')](_0x4b36dd['model'],_0x4b36dd[_0xca7d('0x2f')]);_0x31ec86['attributes']=_['intersection'](_0x4b36dd[_0xca7d('0x2e')],qs[_0xca7d('0x34')](_0x2f19a0['query']['fields']));_0x31ec86[_0xca7d('0x33')]=_0x31ec86[_0xca7d('0x33')]['length']?_0x31ec86['attributes']:_0x4b36dd['model'];if(_0x2f19a0[_0xca7d('0x2f')][_0xca7d('0x42')]){_0x31ec86[_0xca7d('0x43')]=[{'all':!![]}];}_0x31ec86=_[_0xca7d('0x3b')]({},_0x31ec86,_0x2f19a0['options']);return db[_0xca7d('0x2b')][_0xca7d('0x44')](_0x31ec86)[_0xca7d('0x22')](handleEntityNotFound(_0x4c9a38,null))['then'](respondWithResult(_0x4c9a38,null))[_0xca7d('0x3e')](handleError(_0x4c9a38,null));};exports[_0xca7d('0x45')]=function(_0x3150ee,_0x163c09){return db[_0xca7d('0x2b')][_0xca7d('0x45')](_0x3150ee[_0xca7d('0x46')],{})[_0xca7d('0x22')](function(_0xc19132){var _0x263b1c=_0x3150ee[_0xca7d('0x47')]['get']({'plain':!![]});if(!_0x263b1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x263b1c[_0xca7d('0x48')]===_0xca7d('0x47')){var _0x5f1b0a=_0xc19132[_0xca7d('0x24')]({'plain':!![]});var _0x3445fc='Reports';return db[_0xca7d('0x49')][_0xca7d('0x44')]({'where':{'name':_0x3445fc,'userProfileId':_0x263b1c['userProfileId']},'raw':!![]})[_0xca7d('0x22')](function(_0x5e640c){if(_0x5e640c&&_0x5e640c['autoAssociation']===0x0){return db[_0xca7d('0x26')][_0xca7d('0x45')]({'name':_0x5f1b0a['name'],'resourceId':_0x5f1b0a['id'],'type':_0xca7d('0x25'),'sectionId':_0x5e640c['id']},{})['then'](function(){return _0xc19132;});}else{return _0xc19132;}})['catch'](function(_0x1e8bdd){logger[_0xca7d('0x4a')](_0xca7d('0x4b'),_0x1e8bdd);throw _0x1e8bdd;});}return _0xc19132;})[_0xca7d('0x22')](respondWithResult(_0x163c09,0xc9))[_0xca7d('0x3e')](handleError(_0x163c09,null));};exports[_0xca7d('0x21')]=function(_0x3d32b5,_0x3fb1c7){if(_0x3d32b5[_0xca7d('0x46')]['id']){delete _0x3d32b5['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x3d32b5['params']['id']}})[_0xca7d('0x22')](handleEntityNotFound(_0x3fb1c7,null))[_0xca7d('0x22')](saveUpdates(_0x3d32b5[_0xca7d('0x46')],null))[_0xca7d('0x22')](respondWithResult(_0x3fb1c7,null))['catch'](handleError(_0x3fb1c7,null));};exports[_0xca7d('0x23')]=function(_0x3d06b5,_0x264815){return db[_0xca7d('0x2b')][_0xca7d('0x44')]({'where':{'id':_0x3d06b5[_0xca7d('0x40')]['id']}})['then'](handleEntityNotFound(_0x264815,null))[_0xca7d('0x22')](removeEntity(_0x264815,null))['catch'](handleError(_0x264815,null));};exports['preview']=function(_0x2e7224,_0x2691c1){var _0x495683=0xa;var _0x5f244d=[_0xca7d('0x4c'),_0xca7d('0x4d'),'right_join',_0xca7d('0x4e')];var _0x2e23ca={'SUM':_0xca7d('0x4f'),'COUNT':_0xca7d('0x50'),'COUNT DISTINCT':_0xca7d('0x51'),'MAX':'MAX(%s)','MIN':_0xca7d('0x52'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xca7d('0x53'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52a671={'SEC_TO_TIME':_0xca7d('0x54'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xca7d('0x55')};var _0x56e4d5=function(_0x167c93){return!_['includes'](['IS\x20NULL',_0xca7d('0x56'),'IS\x20EMPTY',_0xca7d('0x57')],_0x167c93);};var _0x305a09=function(_0x569a11){if(!_0x569a11||!_0x569a11[_0xca7d('0x58')][_0xca7d('0x59')]){return'';}for(var _0x56e768='(',_0x33d240=0x0;_0x33d240<_0x569a11[_0xca7d('0x58')][_0xca7d('0x59')];_0x33d240+=0x1){_0x33d240>0x0&&(_0x56e768+='\x20'+_0x569a11[_0xca7d('0x5a')]+'\x20');_0x56e768+=_0x569a11[_0xca7d('0x58')][_0x33d240][_0xca7d('0x5b')]?_0x305a09(_0x569a11[_0xca7d('0x58')][_0x33d240][_0xca7d('0x5b')]):_0x569a11['rules'][_0x33d240][_0xca7d('0x5c')]+'\x20'+_0x569a11[_0xca7d('0x58')][_0x33d240][_0xca7d('0x5d')]+(_0x56e4d5(_0x569a11['rules'][_0x33d240][_0xca7d('0x5d')])?'\x20'+_0x569a11[_0xca7d('0x58')][_0x33d240]['value']:'');}return _0x56e768+')';};var _0x86392e={'where':{'id':_0x2e7224['params']['id']}},_0x46aa04,_0x55c938,_0x3d3ac4,_0x1ead8f,_0x313077;_0x86392e=_[_0xca7d('0x3b')]({},_0x86392e,_0x2e7224[_0xca7d('0x5e')]);return db[_0xca7d('0x2b')][_0xca7d('0x44')](_0x86392e)[_0xca7d('0x22')](function(_0xb11790){if(_0xb11790){_0x46aa04=_0xb11790;return _0xb11790[_0xca7d('0x5f')]();}return null;})[_0xca7d('0x22')](function(_0x594e6d){if(_0x594e6d){if(!_0x594e6d[_0xca7d('0x59')]){throw new db[(_0xca7d('0x60'))][(_0xca7d('0x61'))](_0xca7d('0x62'),0x193);}_0x55c938=_0x594e6d;return db[_0xca7d('0x63')][_0xca7d('0x64')]({'raw':!![]});}return null;})['then'](function(_0x4b7229){if(_0x4b7229){_0x3d3ac4=_[_0xca7d('0x65')](_0x4b7229,'id');var _0xa7aa9;var _0x42ab65=squel['select']();_0x42ab65[_0xca7d('0x66')](_0x46aa04['table']);for(var _0x4e7851=0x0;_0x4e7851<_0x55c938[_0xca7d('0x59')];_0x4e7851+=0x1){_0xa7aa9=_0x55c938[_0x4e7851][_0xca7d('0x67')]?_0x3d3ac4[_0x55c938[_0x4e7851]['MetricId']]['metric']:_0x55c938[_0x4e7851]['field'];_0xa7aa9=_0x55c938[_0x4e7851][_0xca7d('0x68')]?_[_0xca7d('0x69')](_0x2e23ca[_0x55c938[_0x4e7851][_0xca7d('0x68')]],'%s',_0xa7aa9):_0xa7aa9;_0xa7aa9=_0x55c938[_0x4e7851][_0xca7d('0x6a')]?_[_0xca7d('0x69')](_0x52a671[_0x55c938[_0x4e7851][_0xca7d('0x6a')]],'%s',_0xa7aa9):_0xa7aa9;if(_0x55c938[_0x4e7851][_0xca7d('0x6b')]){_0x42ab65['group'](_0xa7aa9);}_0x55c938[_0x4e7851]['orderBy']&&_0x42ab65['order'](_0xa7aa9,_0x55c938[_0x4e7851]['orderBy']==='DESC'?![]:!![]);_0x42ab65[_0xca7d('0x5c')](_0xa7aa9,_0x55c938[_0x4e7851][_0xca7d('0x6c')]||_0xa7aa9);}if(_0x46aa04['joins']){_0x46aa04['joins']=JSON[_0xca7d('0x6d')](_0x46aa04[_0xca7d('0x6e')]);for(var _0x4f656a=0x0;_0x4f656a<_0x46aa04[_0xca7d('0x6e')]['length'];_0x4f656a+=0x1){if(_0x46aa04[_0xca7d('0x6e')][_0x4f656a]['type']&&_[_0xca7d('0x6f')](_0x5f244d,_0x46aa04[_0xca7d('0x6e')][_0x4f656a][_0xca7d('0x2d')])&&_0x46aa04['joins'][_0x4f656a]['parentKey']&&_0x46aa04[_0xca7d('0x6e')][_0x4f656a][_0xca7d('0x70')]&&_0x46aa04[_0xca7d('0x6e')][_0x4f656a][_0xca7d('0x71')]){_0x42ab65[_0x46aa04['joins'][_0x4f656a][_0xca7d('0x2d')]](_0x46aa04['joins'][_0x4f656a]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x46aa04['table'],_0x46aa04['joins'][_0x4f656a][_0xca7d('0x72')],_0x46aa04['joins'][_0x4f656a][_0xca7d('0x70')],_0x46aa04[_0xca7d('0x6e')][_0x4f656a][_0xca7d('0x71')]));}}}if(_0x46aa04[_0xca7d('0x73')]){_0x46aa04[_0xca7d('0x73')]=JSON[_0xca7d('0x6d')](_0x46aa04[_0xca7d('0x73')]);_0x42ab65['where'](_0x305a09(_0x46aa04['conditions'][_0xca7d('0x5b')]));}_0x313077=_0x42ab65[_0xca7d('0x74')]();_0x42ab65[_0xca7d('0x1d')](_0x495683);_0x42ab65[_0xca7d('0x1c')](0x0);logger[_0xca7d('0x75')](_0xca7d('0x76'),_0x42ab65[_0xca7d('0x77')]());return db[_0xca7d('0x78')]['query'](_0x42ab65[_0xca7d('0x77')](),{'type':db[_0xca7d('0x78')][_0xca7d('0x79')][_0xca7d('0x7a')]});}})[_0xca7d('0x22')](respondWithResult(_0x2691c1,null))['catch'](handleError(_0x2691c1,null));};function runReport(_0x3fe1bd,_0x1b3cb5,_0x110b66){var _0x5d5af2=_0x1b3cb5[_0xca7d('0x29')];var _0x7a223=0xa;var _0x348a05=['join',_0xca7d('0x4d'),_0xca7d('0x7b'),_0xca7d('0x4e')];var _0x528c42={'SUM':_0xca7d('0x4f'),'COUNT':_0xca7d('0x50'),'COUNT DISTINCT':_0xca7d('0x51'),'MAX':_0xca7d('0x7c'),'MIN':_0xca7d('0x52'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xca7d('0x7d'),'GROUP_CONCAT ASC':_0xca7d('0x53'),'GROUP_CONCAT DESC':_0xca7d('0x7e')};var _0x1debb6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xca7d('0x7f'),'HOUR':'HOUR(%s)','ROUND':_0xca7d('0x80'),'UNIX_TIMESTAMP':_0xca7d('0x55')};var _0x5a5dfa=function(_0x445a74){return!_[_0xca7d('0x6f')]([_0xca7d('0x81'),_0xca7d('0x56'),_0xca7d('0x82'),_0xca7d('0x57')],_0x445a74);};var _0x566a13=function(_0x1e00a4){if(!_0x1e00a4||!_0x1e00a4[_0xca7d('0x58')]['length']){return'';}for(var _0x33b6ab='(',_0x5106f0=0x0;_0x5106f0<_0x1e00a4['rules']['length'];_0x5106f0+=0x1){_0x5106f0>0x0&&(_0x33b6ab+='\x20'+_0x1e00a4['operator']+'\x20');_0x33b6ab+=_0x1e00a4[_0xca7d('0x58')][_0x5106f0][_0xca7d('0x5b')]?_0x566a13(_0x1e00a4['rules'][_0x5106f0]['group']):_0x1e00a4['rules'][_0x5106f0]['field']+'\x20'+_0x1e00a4[_0xca7d('0x58')][_0x5106f0][_0xca7d('0x5d')]+(_0x5a5dfa(_0x1e00a4[_0xca7d('0x58')][_0x5106f0][_0xca7d('0x5d')])?'\x20'+_0x1e00a4[_0xca7d('0x58')][_0x5106f0][_0xca7d('0x83')]:'');}return _0x33b6ab+')';};var _0x608759={'where':{'id':_0x3fe1bd['id']}},_0xbbf5ca,_0x3ac6c5,_0x254391,_0x5c80e4,_0x4f013c;_0x608759=_['merge']({},_0x608759,_0x110b66);return db['AnalyticCustomReport'][_0xca7d('0x44')](_0x608759)[_0xca7d('0x22')](function(_0xd3f7f1){if(_0xd3f7f1){_0xbbf5ca=_0xd3f7f1;return _0xd3f7f1[_0xca7d('0x5f')]();}return null;})[_0xca7d('0x22')](function(_0x316901){if(_0x316901){if(!_0x316901[_0xca7d('0x59')]){throw new db['Sequelize'][(_0xca7d('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3ac6c5=_0x316901;return db[_0xca7d('0x63')][_0xca7d('0x64')]({'raw':!![]});}return null;})[_0xca7d('0x22')](function(_0x1f6cd0){if(_0x1f6cd0){_0x254391=_[_0xca7d('0x65')](_0x1f6cd0,'id');var _0x270393;var _0xf45e6f=squel[_0xca7d('0x84')]();_0xf45e6f[_0xca7d('0x66')](_0xbbf5ca['table']);for(var _0xaef01f=0x0;_0xaef01f<_0x3ac6c5[_0xca7d('0x59')];_0xaef01f+=0x1){_0x270393=_0x3ac6c5[_0xaef01f][_0xca7d('0x67')]?_0x254391[_0x3ac6c5[_0xaef01f]['MetricId']][_0xca7d('0x85')]:_0x3ac6c5[_0xaef01f][_0xca7d('0x5c')];_0x270393=_0x3ac6c5[_0xaef01f]['function']?_[_0xca7d('0x69')](_0x528c42[_0x3ac6c5[_0xaef01f][_0xca7d('0x68')]],'%s',_0x270393):_0x270393;_0x270393=_0x3ac6c5[_0xaef01f][_0xca7d('0x6a')]?_['replace'](_0x1debb6[_0x3ac6c5[_0xaef01f]['format']],'%s',_0x270393):_0x270393;if(_0x3ac6c5[_0xaef01f][_0xca7d('0x6b')]){_0xf45e6f[_0xca7d('0x5b')](_0x270393);}_0x3ac6c5[_0xaef01f]['orderBy']&&_0xf45e6f[_0xca7d('0x86')](_0x270393,_0x3ac6c5[_0xaef01f][_0xca7d('0x87')]===_0xca7d('0x88')?![]:!![]);_0xf45e6f[_0xca7d('0x5c')](_0x270393,_0x3ac6c5[_0xaef01f][_0xca7d('0x6c')]||_0x270393);}if(_0xbbf5ca[_0xca7d('0x6e')]){_0xbbf5ca[_0xca7d('0x6e')]=JSON[_0xca7d('0x6d')](_0xbbf5ca[_0xca7d('0x6e')]);for(var _0x47c4e8=0x0;_0x47c4e8<_0xbbf5ca[_0xca7d('0x6e')][_0xca7d('0x59')];_0x47c4e8+=0x1){if(_0xbbf5ca[_0xca7d('0x6e')][_0x47c4e8][_0xca7d('0x2d')]&&_[_0xca7d('0x6f')](_0x348a05,_0xbbf5ca[_0xca7d('0x6e')][_0x47c4e8][_0xca7d('0x2d')])&&_0xbbf5ca['joins'][_0x47c4e8][_0xca7d('0x72')]&&_0xbbf5ca[_0xca7d('0x6e')][_0x47c4e8]['foreignTable']&&_0xbbf5ca[_0xca7d('0x6e')][_0x47c4e8]['foreignKey']){_0xf45e6f[_0xbbf5ca['joins'][_0x47c4e8][_0xca7d('0x2d')]](_0xbbf5ca['joins'][_0x47c4e8][_0xca7d('0x70')],null,util[_0xca7d('0x6a')]('%s.%s\x20=\x20%s.%s',_0xbbf5ca[_0xca7d('0x89')],_0xbbf5ca[_0xca7d('0x6e')][_0x47c4e8][_0xca7d('0x72')],_0xbbf5ca[_0xca7d('0x6e')][_0x47c4e8][_0xca7d('0x70')],_0xbbf5ca['joins'][_0x47c4e8]['foreignKey']));}}}if(_0xbbf5ca['conditions']){_0xbbf5ca[_0xca7d('0x73')]=JSON['parse'](_0xbbf5ca[_0xca7d('0x73')]);_0xf45e6f[_0xca7d('0x3a')](_0x566a13(_0xbbf5ca[_0xca7d('0x73')]['group']));}_0x4f013c=_0xf45e6f[_0xca7d('0x74')]();_0xf45e6f[_0xca7d('0x1d')](_0x7a223);_0xf45e6f[_0xca7d('0x1c')](0x0);logger[_0xca7d('0x75')]('Limited\x20Query:',_0xf45e6f['toString']());return db[_0xca7d('0x78')][_0xca7d('0x2f')](_0xf45e6f[_0xca7d('0x77')](),{'type':db[_0xca7d('0x78')]['QueryTypes'][_0xca7d('0x7a')]});}})[_0xca7d('0x22')](function(_0x3f6a20){if(!_0x3f6a20[_0xca7d('0x59')]){throw new db[(_0xca7d('0x60'))]['ValidationErrorItem'](_0xca7d('0x8a'),0xcc);}if(_0x1b3cb5['output']==='web'){return null;}var _0x5f5518=_[_0xca7d('0x3b')](_0x1b3cb5,{'name':_0x1b3cb5[_0xca7d('0x8b')]||_0x1b3cb5[_0xca7d('0x29')]||_0xbbf5ca[_0xca7d('0x29')],'basename':_0x5d5af2,'savename':util[_0xca7d('0x6a')]('%s-%s.%s',_0x1b3cb5[_0xca7d('0x29')]||_0xbbf5ca['name'],require(_0xca7d('0x8c'))[_0xca7d('0x8d')](0x4),_0x1b3cb5[_0xca7d('0x8e')]||'csv'),'reportId':_0xbbf5ca['id'],'reportType':_0xca7d('0x8f')});return db[_0xca7d('0x90')]['create'](_0x5f5518,{'raw':!![]});})[_0xca7d('0x22')](function(_0x554472){if(_0xbbf5ca[_0xca7d('0x89')]===_0xca7d('0x91')){_0x4f013c['where'](_0xbbf5ca[_0xca7d('0x89')]+_0xca7d('0x92'),_0x1b3cb5[_0xca7d('0x93')],_0x1b3cb5[_0xca7d('0x94')]);}else{_0x4f013c[_0xca7d('0x3a')](_0xbbf5ca[_0xca7d('0x89')]+_0xca7d('0x95'),_0x1b3cb5[_0xca7d('0x93')],_0x1b3cb5[_0xca7d('0x94')]);}if(_0x554472){logger['info'](_0xca7d('0x96'),_0x4f013c[_0xca7d('0x77')]());require(_0xca7d('0x97'))[_0xca7d('0x98')](path[_0xca7d('0x4c')](__dirname,_0xca7d('0x99'),_0x554472[_0xca7d('0x8e')]),[_0x554472['id'],_0x4f013c['toString'](),path[_0xca7d('0x4c')](__dirname,_0xca7d('0x9a'),_0x554472['savename']),_0x5d5af2]);return _0x554472;}else{var _0x549b56=squel['select']();_0x549b56['from']('('+_0x4f013c[_0xca7d('0x77')]()+')',_0xca7d('0x9b'));_0x549b56[_0xca7d('0x5c')]('COUNT(*)',_0xca7d('0x3c'));_0x4f013c[_0xca7d('0x1d')](_0x1b3cb5[_0xca7d('0x1d')]||_0x7a223);_0x4f013c[_0xca7d('0x1c')](_0x1b3cb5['offset']||0x0);return dbH[_0xca7d('0x78')][_0xca7d('0x2f')](_0x549b56[_0xca7d('0x77')](),{'type':dbH['sequelize'][_0xca7d('0x79')][_0xca7d('0x7a')]})[_0xca7d('0x22')](function(_0x18bca6){if(!_0x18bca6[_0xca7d('0x59')]){_0x5c80e4=0x0;}else{_0x5c80e4=_0x18bca6[0x0][_0xca7d('0x3c')]||0x0;}return dbH[_0xca7d('0x78')][_0xca7d('0x2f')](_0x4f013c[_0xca7d('0x77')](),{'type':dbH[_0xca7d('0x78')][_0xca7d('0x79')][_0xca7d('0x7a')]});})[_0xca7d('0x22')](function(_0x73bda){return{'rows':_0x73bda||[],'count':_0x5c80e4};});}});}exports[_0xca7d('0x9c')]=function(_0x85bbe7,_0x259740){return runReport(_0x85bbe7[_0xca7d('0x40')],_0x85bbe7['query'],_0x85bbe7[_0xca7d('0x5e')])[_0xca7d('0x22')](respondWithResult(_0x259740,null))[_0xca7d('0x3e')](handleError(_0x259740,null));};exports[_0xca7d('0x9d')]=runReport;exports[_0xca7d('0x2f')]=function(_0x3fb016,_0x23281f){var _0x400a88=0xa;var _0xbf4ea7=[_0xca7d('0x4c'),_0xca7d('0x4d'),'right_join','cross_join'];var _0x25dd65={'SUM':_0xca7d('0x4f'),'COUNT':_0xca7d('0x50'),'COUNT DISTINCT':_0xca7d('0x51'),'MAX':'MAX(%s)','MIN':_0xca7d('0x52'),'AVG':_0xca7d('0x9e'),'GROUP_CONCAT':_0xca7d('0x7d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3ed75a={'SEC_TO_TIME':_0xca7d('0x54'),'DATE':_0xca7d('0x7f'),'HOUR':_0xca7d('0x9f'),'ROUND':_0xca7d('0x80'),'UNIX_TIMESTAMP':_0xca7d('0x55')};var _0x3d418b=function(_0x342e2d){return!_['includes'](['IS\x20NULL',_0xca7d('0x56'),'IS\x20EMPTY',_0xca7d('0x57')],_0x342e2d);};var _0x378523=function(_0x1da843){if(!_0x1da843||!_0x1da843[_0xca7d('0x58')]['length']){return'';}for(var _0x157c56='(',_0x2c2c2d=0x0;_0x2c2c2d<_0x1da843[_0xca7d('0x58')][_0xca7d('0x59')];_0x2c2c2d+=0x1){_0x2c2c2d>0x0&&(_0x157c56+='\x20'+_0x1da843[_0xca7d('0x5a')]+'\x20');_0x157c56+=_0x1da843[_0xca7d('0x58')][_0x2c2c2d][_0xca7d('0x5b')]?_0x378523(_0x1da843[_0xca7d('0x58')][_0x2c2c2d]['group']):_0x1da843['rules'][_0x2c2c2d][_0xca7d('0x5c')]+'\x20'+_0x1da843[_0xca7d('0x58')][_0x2c2c2d]['condition']+(_0x3d418b(_0x1da843[_0xca7d('0x58')][_0x2c2c2d]['condition'])?'\x20'+_0x1da843[_0xca7d('0x58')][_0x2c2c2d][_0xca7d('0x83')]:'');}return _0x157c56+')';};var _0x398ed7={'where':{'id':_0x3fb016['params']['id']}},_0x408c9f,_0x5de5fe,_0x3bf5a8,_0x60ae8c,_0x54302d;_0x398ed7=_[_0xca7d('0x3b')]({},_0x398ed7,_0x3fb016[_0xca7d('0x5e')]);return db[_0xca7d('0x2b')][_0xca7d('0x44')](_0x398ed7)[_0xca7d('0x22')](function(_0x3cf3c1){if(_0x3cf3c1){_0x408c9f=_0x3cf3c1;return _0x3cf3c1[_0xca7d('0x5f')]();}return null;})[_0xca7d('0x22')](function(_0x3f077d){if(_0x3f077d){if(!_0x3f077d[_0xca7d('0x59')]){throw new db[(_0xca7d('0x60'))][(_0xca7d('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5de5fe=_0x3f077d;return db[_0xca7d('0x63')][_0xca7d('0x64')]({'raw':!![]});}return null;})[_0xca7d('0x22')](function(_0x2086f9){if(_0x2086f9){_0x3bf5a8=_[_0xca7d('0x65')](_0x2086f9,'id');var _0x2ddf22;var _0x380f3e=squel['select']();_0x380f3e['from'](_0x408c9f[_0xca7d('0x89')]);for(var _0x2ed532=0x0;_0x2ed532<_0x5de5fe[_0xca7d('0x59')];_0x2ed532+=0x1){_0x2ddf22=_0x5de5fe[_0x2ed532][_0xca7d('0x67')]?_0x3bf5a8[_0x5de5fe[_0x2ed532][_0xca7d('0x67')]]['metric']:_0x5de5fe[_0x2ed532]['field'];_0x2ddf22=_0x5de5fe[_0x2ed532]['function']?_['replace'](_0x25dd65[_0x5de5fe[_0x2ed532][_0xca7d('0x68')]],'%s',_0x2ddf22):_0x2ddf22;_0x2ddf22=_0x5de5fe[_0x2ed532][_0xca7d('0x6a')]?_[_0xca7d('0x69')](_0x3ed75a[_0x5de5fe[_0x2ed532][_0xca7d('0x6a')]],'%s',_0x2ddf22):_0x2ddf22;if(_0x5de5fe[_0x2ed532]['groupBy']){_0x380f3e[_0xca7d('0x5b')](_0x2ddf22);}_0x5de5fe[_0x2ed532][_0xca7d('0x87')]&&_0x380f3e['order'](_0x2ddf22,_0x5de5fe[_0x2ed532][_0xca7d('0x87')]==='DESC'?![]:!![]);_0x380f3e[_0xca7d('0x5c')](_0x2ddf22,_0x5de5fe[_0x2ed532][_0xca7d('0x6c')]||_0x2ddf22);}if(_0x408c9f['joins']){_0x408c9f[_0xca7d('0x6e')]=JSON[_0xca7d('0x6d')](_0x408c9f['joins']);for(var _0x16507d=0x0;_0x16507d<_0x408c9f[_0xca7d('0x6e')]['length'];_0x16507d+=0x1){if(_0x408c9f[_0xca7d('0x6e')][_0x16507d][_0xca7d('0x2d')]&&_[_0xca7d('0x6f')](_0xbf4ea7,_0x408c9f[_0xca7d('0x6e')][_0x16507d]['type'])&&_0x408c9f[_0xca7d('0x6e')][_0x16507d][_0xca7d('0x72')]&&_0x408c9f[_0xca7d('0x6e')][_0x16507d]['foreignTable']&&_0x408c9f[_0xca7d('0x6e')][_0x16507d][_0xca7d('0x71')]){_0x380f3e[_0x408c9f[_0xca7d('0x6e')][_0x16507d]['type']](_0x408c9f[_0xca7d('0x6e')][_0x16507d][_0xca7d('0x70')],null,util[_0xca7d('0x6a')](_0xca7d('0xa0'),_0x408c9f[_0xca7d('0x89')],_0x408c9f[_0xca7d('0x6e')][_0x16507d]['parentKey'],_0x408c9f[_0xca7d('0x6e')][_0x16507d][_0xca7d('0x70')],_0x408c9f[_0xca7d('0x6e')][_0x16507d]['foreignKey']));}}}if(_0x408c9f['conditions']){_0x408c9f[_0xca7d('0x73')]=JSON[_0xca7d('0x6d')](_0x408c9f['conditions']);_0x380f3e[_0xca7d('0x3a')](_0x378523(_0x408c9f[_0xca7d('0x73')][_0xca7d('0x5b')]));}_0x54302d=_0x380f3e['clone']();_0x380f3e[_0xca7d('0x1d')](_0x400a88);_0x380f3e[_0xca7d('0x1c')](0x0);logger[_0xca7d('0x75')]('Limited\x20Query:',_0x380f3e[_0xca7d('0x77')]());return db[_0xca7d('0x78')][_0xca7d('0x2f')](_0x380f3e[_0xca7d('0x77')](),{'type':db['sequelize'][_0xca7d('0x79')][_0xca7d('0x7a')]});}})[_0xca7d('0x22')](function(){return{'sql':_0x54302d[_0xca7d('0x77')]()};})[_0xca7d('0x22')](respondWithResult(_0x23281f,null))[_0xca7d('0x3e')](handleError(_0x23281f,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 059b09e..436047a 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 _0x77aa=['api','request-promise','rimraf','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x24b81a,_0x14e995){var _0x2f99e7=function(_0x565ff2){while(--_0x565ff2){_0x24b81a['push'](_0x24b81a['shift']());}};_0x2f99e7(++_0x14e995);}(_0x77aa,0x1f1));var _0xa77a=function(_0x33b7e2,_0x5e51f2){_0x33b7e2=_0x33b7e2-0x0;var _0x43ed14=_0x77aa[_0x33b7e2];return _0x43ed14;};'use strict';var _=require(_0xa77a('0x0'));var util=require(_0xa77a('0x1'));var logger=require(_0xa77a('0x2'))(_0xa77a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa77a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa77a('0x5'));var config=require('../../config/environment');var attributes=require(_0xa77a('0x6'));module[_0xa77a('0x7')]=function(_0x5e23f5,_0x56f15d){return _0x5e23f5[_0xa77a('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xa77a('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd29f=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xd29f,0xc6));var _0xfd29=function(_0x40a0a4,_0x4269e1){_0x40a0a4=_0x40a0a4-0x0;var _0x115c37=_0xd29f[_0x40a0a4];return _0x115c37;};'use strict';var _=require(_0xfd29('0x0'));var util=require(_0xfd29('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfd29('0x2'));var BPromise=require(_0xfd29('0x3'));var rp=require(_0xfd29('0x4'));var fs=require('fs');var path=require(_0xfd29('0x5'));var rimraf=require(_0xfd29('0x6'));var config=require(_0xfd29('0x7'));var attributes=require(_0xfd29('0x8'));module['exports']=function(_0x5aba23,_0x144ee3){return _0x5aba23[_0xfd29('0x9')](_0xfd29('0xa'),attributes,{'tableName':'analytics_custom_reports','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 059f262..def6704 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 _0xa62b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','error','AnalyticCustomReport,\x20%s,\x20%s','message','util','moment','bluebird','randomstring'];(function(_0x3b139d,_0x4c32c0){var _0x4ff043=function(_0x5c50c9){while(--_0x5c50c9){_0x3b139d['push'](_0x3b139d['shift']());}};_0x4ff043(++_0x4c32c0);}(_0xa62b,0x152));var _0xba62=function(_0x4573ac,_0xeb05ed){_0x4573ac=_0x4573ac-0x0;var _0xc1a36b=_0xa62b[_0x4573ac];return _0xc1a36b;};'use strict';var _=require('lodash');var util=require(_0xba62('0x0'));var moment=require(_0xba62('0x1'));var BPromise=require(_0xba62('0x2'));var rs=require(_0xba62('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba62('0x4'))['db'];var utils=require(_0xba62('0x5'));var logger=require(_0xba62('0x6'))(_0xba62('0x7'));var config=require(_0xba62('0x8'));var jayson=require(_0xba62('0x9'));var client=jayson[_0xba62('0xa')][_0xba62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf286,_0x1920c5,_0x4c14b1){return new BPromise(function(_0x271560,_0x4647d5){return client[_0xba62('0xc')](_0x1bf286,_0x4c14b1)[_0xba62('0xd')](function(_0x18c78f){logger[_0xba62('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1920c5,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1920c5,'request\x20sent',JSON['stringify'](_0x18c78f));if(_0x18c78f[_0xba62('0xf')]){if(_0x18c78f[_0xba62('0xf')]['code']===0x1f4){logger['error'](_0xba62('0x10'),_0x1920c5,_0x18c78f[_0xba62('0xf')][_0xba62('0x11')]);return _0x4647d5(_0x18c78f[_0xba62('0xf')][_0xba62('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1920c5,_0x18c78f[_0xba62('0xf')][_0xba62('0x11')]);return _0x271560(_0x18c78f[_0xba62('0xf')]['message']);}else{logger[_0xba62('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1920c5,'request\x20sent');_0x271560(_0x18c78f['result'][_0xba62('0x11')]);}})['catch'](function(_0x15ee4c){logger[_0xba62('0xf')](_0xba62('0x10'),_0x1920c5,_0x15ee4c);_0x4647d5(_0x15ee4c);});});} \ No newline at end of file +var _0xceff=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x1fda44,_0x214d9b){var _0x1a9c87=function(_0xead71b){while(--_0xead71b){_0x1fda44['push'](_0x1fda44['shift']());}};_0x1a9c87(++_0x214d9b);}(_0xceff,0x11d));var _0xfcef=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xceff[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xfcef('0x0'));var util=require(_0xfcef('0x1'));var moment=require(_0xfcef('0x2'));var BPromise=require(_0xfcef('0x3'));var rs=require(_0xfcef('0x4'));var fs=require('fs');var Redis=require(_0xfcef('0x5'));var db=require(_0xfcef('0x6'))['db'];var utils=require(_0xfcef('0x7'));var logger=require(_0xfcef('0x8'))(_0xfcef('0x9'));var config=require('../../config/environment');var jayson=require(_0xfcef('0xa'));var client=jayson['client'][_0xfcef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2567b4,_0x2f5fa6,_0x39a316){return new BPromise(function(_0x3fbd2c,_0x116a5c){return client['request'](_0x2567b4,_0x39a316)[_0xfcef('0xc')](function(_0x33b5e1){logger[_0xfcef('0xd')](_0xfcef('0xe'),_0x2f5fa6,_0xfcef('0xf'));logger[_0xfcef('0x10')](_0xfcef('0x11'),_0x2f5fa6,_0xfcef('0xf'),JSON[_0xfcef('0x12')](_0x33b5e1));if(_0x33b5e1['error']){if(_0x33b5e1['error'][_0xfcef('0x13')]===0x1f4){logger[_0xfcef('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2f5fa6,_0x33b5e1['error'][_0xfcef('0x15')]);return _0x116a5c(_0x33b5e1[_0xfcef('0x14')][_0xfcef('0x15')]);}logger[_0xfcef('0x14')](_0xfcef('0xe'),_0x2f5fa6,_0x33b5e1[_0xfcef('0x14')][_0xfcef('0x15')]);return _0x3fbd2c(_0x33b5e1[_0xfcef('0x14')][_0xfcef('0x15')]);}else{logger[_0xfcef('0xd')](_0xfcef('0xe'),_0x2f5fa6,_0xfcef('0xf'));_0x3fbd2c(_0x33b5e1[_0xfcef('0x16')][_0xfcef('0x15')]);}})[_0xfcef('0x17')](function(_0x4dd2e3){logger[_0xfcef('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2f5fa6,_0x4dd2e3);_0x116a5c(_0x4dd2e3);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b389035..7c6446e 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 _0x79d9=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','query','create','put','/:id','delete'];(function(_0x2c4f75,_0x5b883d){var _0x59bf34=function(_0x1cb5c1){while(--_0x1cb5c1){_0x2c4f75['push'](_0x2c4f75['shift']());}};_0x59bf34(++_0x5b883d);}(_0x79d9,0xe9));var _0x979d=function(_0x4132c2,_0x29b8be){_0x4132c2=_0x4132c2-0x0;var _0x159cf6=_0x79d9[_0x4132c2];return _0x159cf6;};'use strict';var multer=require(_0x979d('0x0'));var util=require('util');var path=require(_0x979d('0x1'));var timeout=require(_0x979d('0x2'));var express=require(_0x979d('0x3'));var router=express[_0x979d('0x4')]();var auth=require(_0x979d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x979d('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x979d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x979d('0x7')]('/:id',auth[_0x979d('0x8')](),controller[_0x979d('0x9')]);router[_0x979d('0x7')](_0x979d('0xa'),auth[_0x979d('0x8')](),controller['preview']);router['get'](_0x979d('0xb'),auth['isAuthenticated'](),controller[_0x979d('0xc')]);router[_0x979d('0x7')](_0x979d('0xd'),auth[_0x979d('0x8')](),controller[_0x979d('0xe')]);router['post']('/',auth[_0x979d('0x8')](),controller[_0x979d('0xf')]);router[_0x979d('0x10')](_0x979d('0x11'),auth[_0x979d('0x8')](),controller['update']);router[_0x979d('0x12')]('/:id',auth[_0x979d('0x8')](),controller[_0x979d('0x13')]);module[_0x979d('0x14')]=router; \ No newline at end of file +var _0xd4b1=['/:id/run','run','query','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview'];(function(_0x403ca6,_0x24e284){var _0x4e0e05=function(_0x3a76ba){while(--_0x3a76ba){_0x403ca6['push'](_0x403ca6['shift']());}};_0x4e0e05(++_0x24e284);}(_0xd4b1,0x134));var _0x1d4b=function(_0x1ddbef,_0x699b15){_0x1ddbef=_0x1ddbef-0x0;var _0x59d6f7=_0xd4b1[_0x1ddbef];return _0x59d6f7;};'use strict';var multer=require(_0x1d4b('0x0'));var util=require(_0x1d4b('0x1'));var path=require('path');var timeout=require(_0x1d4b('0x2'));var express=require('express');var router=express[_0x1d4b('0x3')]();var auth=require(_0x1d4b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1d4b('0x5'));router[_0x1d4b('0x6')]('/',auth[_0x1d4b('0x7')](),controller['index']);router[_0x1d4b('0x6')](_0x1d4b('0x8'),auth[_0x1d4b('0x7')](),controller[_0x1d4b('0x9')]);router[_0x1d4b('0x6')](_0x1d4b('0xa'),auth[_0x1d4b('0x7')](),controller[_0x1d4b('0xb')]);router[_0x1d4b('0x6')](_0x1d4b('0xc'),auth['isAuthenticated'](),controller[_0x1d4b('0xd')]);router['get']('/:id/query',auth[_0x1d4b('0x7')](),controller[_0x1d4b('0xe')]);router['post']('/',auth[_0x1d4b('0x7')](),controller[_0x1d4b('0xf')]);router[_0x1d4b('0x10')](_0x1d4b('0x8'),auth[_0x1d4b('0x7')](),controller['update']);router[_0x1d4b('0x11')](_0x1d4b('0x8'),auth[_0x1d4b('0x7')](),controller[_0x1d4b('0x12')]);module[_0x1d4b('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 0ffa393..ead1b0f 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 _0xb216=['STRING','TEXT','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb216,0x12e));var _0x6b21=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xb216[_0x100e36];return _0x1df0c9;};'use strict';var Sequelize=require(_0x6b21('0x0'));module[_0x6b21('0x1')]={'name':{'type':Sequelize[_0x6b21('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6b21('0x2')]},'parent':{'type':Sequelize[_0x6b21('0x2')]},'table':{'type':Sequelize[_0x6b21('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x6b21('0x3')]}}; \ No newline at end of file +var _0x84bc=['TEXT','exports','STRING'];(function(_0x4c44be,_0x254527){var _0x45eb31=function(_0x16ddb8){while(--_0x16ddb8){_0x4c44be['push'](_0x4c44be['shift']());}};_0x45eb31(++_0x254527);}(_0x84bc,0x1d8));var _0xc84b=function(_0x1f819c,_0x269444){_0x1f819c=_0x1f819c-0x0;var _0x27c542=_0x84bc[_0x1f819c];return _0x27c542;};'use strict';var Sequelize=require('sequelize');module[_0xc84b('0x0')]={'name':{'type':Sequelize[_0xc84b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc84b('0x1')]},'parent':{'type':Sequelize[_0xc84b('0x1')]},'table':{'type':Sequelize[_0xc84b('0x1')]},'conditions':{'type':Sequelize[_0xc84b('0x2')]},'joins':{'type':Sequelize[_0xc84b('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 3ee4de2..fd467a7 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 _0x44e6=['hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','include','findAll','rows','show','params','includeAll','catch','create','body','get','role','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','parse','joins','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','MAX(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','ValidationErrorItem','output','web','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','SUM(%s)','html-pdf','eml-format','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','DefaultReports','stack','name','send','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length'];(function(_0x204f90,_0x1af167){var _0x10794b=function(_0x1c66d4){while(--_0x1c66d4){_0x204f90['push'](_0x204f90['shift']());}};_0x10794b(++_0x1af167);}(_0x44e6,0x113));var _0x644e=function(_0x14daef,_0x5ad345){_0x14daef=_0x14daef-0x0;var _0x38d2aa=_0x44e6[_0x14daef];return _0x38d2aa;};'use strict';var pdf=require(_0x644e('0x0'));var emlformat=require(_0x644e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x644e('0x2'));var BPromise=require(_0x644e('0x3'));var Mustache=require(_0x644e('0x4'));var util=require(_0x644e('0x5'));var path=require(_0x644e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x644e('0x7'));var fs=require('fs');var _=require(_0x644e('0x8'));var squel=require(_0x644e('0x9'));var crypto=require(_0x644e('0xa'));var jsforce=require(_0x644e('0xb'));var deskjs=require(_0x644e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x644e('0xd'));var Papa=require(_0x644e('0xe'));var Redis=require('ioredis');var authService=require(_0x644e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x644e('0x10'));var hardwareService=require(_0x644e('0x11'));var logger=require(_0x644e('0x12'))('api');var utils=require(_0x644e('0x13'));var config=require('../../config/environment');var db=require(_0x644e('0x14'))['db'];var dbH=require(_0x644e('0x14'))['dbH'];function respondWithStatusCode(_0x27cb49,_0x2cea44){_0x2cea44=_0x2cea44||0xcc;return function(_0xfee823){if(_0xfee823){return _0x27cb49[_0x644e('0x15')](_0x2cea44);}return _0x27cb49[_0x644e('0x16')](_0x2cea44)[_0x644e('0x17')]();};}function respondWithResult(_0x272100,_0x5d19d8){_0x5d19d8=_0x5d19d8||0xc8;return function(_0x3d8682){if(_0x3d8682){return _0x272100[_0x644e('0x16')](_0x5d19d8)[_0x644e('0x18')](_0x3d8682);}};}function respondWithFilteredResult(_0x5dddda,_0x34bd92){return function(_0x291bbf){if(_0x291bbf){var _0x1c9aec=_0x291bbf[_0x644e('0x19')],_0x1dd54a=_0x34bd92[_0x644e('0x1a')],_0x3f79bb=_0x34bd92[_0x644e('0x1a')]+_0x34bd92[_0x644e('0x1b')],_0x1df3c1;if(_0x3f79bb>=_0x1c9aec){_0x3f79bb=_0x1c9aec;_0x1df3c1=0xc8;}else{_0x1df3c1=0xce;}_0x5dddda[_0x644e('0x16')](_0x1df3c1);return _0x5dddda[_0x644e('0x1c')](_0x644e('0x1d'),_0x1dd54a+'-'+_0x3f79bb+'/'+_0x1c9aec)[_0x644e('0x18')](_0x291bbf);}return null;};}function patchUpdates(_0x5e8618){return function(_0x39d2b1){try{jsonpatch[_0x644e('0x1e')](_0x39d2b1,_0x5e8618,!![]);}catch(_0x223f22){return BPromise[_0x644e('0x1f')](_0x223f22);}return _0x39d2b1[_0x644e('0x20')]();};}function saveUpdates(_0x435a2b,_0x1a6fa1){return function(_0x1121fe){if(_0x1121fe){return _0x1121fe['update'](_0x435a2b)[_0x644e('0x21')](function(_0x522023){return _0x522023;});}return null;};}function removeEntity(_0x5201ee,_0x23960c){return function(_0x3237a4){if(_0x3237a4){return _0x3237a4[_0x644e('0x22')]()['then'](function(){var _0xd4948b=_0x3237a4['get']({'plain':!![]});var _0x5656ce=_0x644e('0x23');return db['UserProfileResource'][_0x644e('0x22')]({'where':{'type':_0x5656ce,'resourceId':_0xd4948b['id']}})['then'](function(){return _0x3237a4;});})['then'](function(){_0x5201ee[_0x644e('0x16')](0xcc)[_0x644e('0x17')]();});}};}function handleEntityNotFound(_0x1b0f6b,_0x585af4){return function(_0x528254){if(!_0x528254){_0x1b0f6b[_0x644e('0x15')](0x194);}return _0x528254;};}function handleError(_0x478237,_0x28c748){_0x28c748=_0x28c748||0x1f4;return function(_0x3c0599){logger['error'](_0x3c0599[_0x644e('0x24')]);if(_0x3c0599[_0x644e('0x25')]){delete _0x3c0599[_0x644e('0x25')];}_0x478237[_0x644e('0x16')](_0x28c748)[_0x644e('0x26')](_0x3c0599);};}exports['index']=function(_0x59c3e3,_0x26af4f){var _0x555edf={},_0x510195={},_0x378a85={'count':0x0,'rows':[]};var _0xd9fd40=_['map'](db[_0x644e('0x27')][_0x644e('0x28')],function(_0x47d6c8){return{'name':_0x47d6c8[_0x644e('0x29')],'type':_0x47d6c8[_0x644e('0x2a')]['key']};});_0x510195[_0x644e('0x2b')]=_['map'](_0xd9fd40,_0x644e('0x25'));_0x510195['query']=_[_0x644e('0x2c')](_0x59c3e3[_0x644e('0x2d')]);_0x510195[_0x644e('0x2e')]=_['intersection'](_0x510195[_0x644e('0x2b')],_0x510195['query']);_0x555edf[_0x644e('0x2f')]=_[_0x644e('0x30')](_0x510195[_0x644e('0x2b')],qs[_0x644e('0x31')](_0x59c3e3[_0x644e('0x2d')][_0x644e('0x31')]));_0x555edf[_0x644e('0x2f')]=_0x555edf['attributes'][_0x644e('0x32')]?_0x555edf[_0x644e('0x2f')]:_0x510195[_0x644e('0x2b')];if(!_0x59c3e3['query'][_0x644e('0x33')](_0x644e('0x34'))){_0x555edf['limit']=qs['limit'](_0x59c3e3['query'][_0x644e('0x1b')]);_0x555edf['offset']=qs[_0x644e('0x1a')](_0x59c3e3[_0x644e('0x2d')][_0x644e('0x1a')]);}_0x555edf[_0x644e('0x35')]=qs[_0x644e('0x36')](_0x59c3e3[_0x644e('0x2d')][_0x644e('0x36')]);_0x555edf[_0x644e('0x37')]=qs[_0x644e('0x2e')](_[_0x644e('0x38')](_0x59c3e3[_0x644e('0x2d')],_0x510195['filters']),_0xd9fd40);if(_0x59c3e3['query']['filter']){_0x555edf['where']=_[_0x644e('0x39')](_0x555edf['where'],{'$or':_[_0x644e('0x3a')](_0xd9fd40,function(_0x1b00aa){if(_0x1b00aa[_0x644e('0x2a')]!=='VIRTUAL'){var _0x1a78ae={};_0x1a78ae[_0x1b00aa['name']]={'$like':'%'+_0x59c3e3['query'][_0x644e('0x3b')]+'%'};return _0x1a78ae;}})});}_0x555edf=_[_0x644e('0x39')]({},_0x555edf,_0x59c3e3[_0x644e('0x3c')]);var _0x13dcd2={'where':_0x555edf[_0x644e('0x37')]};return db['AnalyticDefaultReport'][_0x644e('0x19')](_0x13dcd2)[_0x644e('0x21')](function(_0x38414e){_0x378a85[_0x644e('0x19')]=_0x38414e;if(_0x59c3e3[_0x644e('0x2d')]['includeAll']){_0x555edf[_0x644e('0x3d')]=[{'all':!![]}];}return db[_0x644e('0x27')][_0x644e('0x3e')](_0x555edf);})[_0x644e('0x21')](function(_0x3c5324){_0x378a85[_0x644e('0x3f')]=_0x3c5324;return _0x378a85;})[_0x644e('0x21')](respondWithFilteredResult(_0x26af4f,_0x555edf))['catch'](handleError(_0x26af4f,null));};exports[_0x644e('0x40')]=function(_0x4f040b,_0x5adaa7){var _0x4319c2={'raw':!![],'where':{'id':_0x4f040b[_0x644e('0x41')]['id']}},_0xaa73fb={};_0xaa73fb[_0x644e('0x2b')]=_[_0x644e('0x2c')](db['AnalyticDefaultReport'][_0x644e('0x28')]);_0xaa73fb[_0x644e('0x2d')]=_['keys'](_0x4f040b[_0x644e('0x2d')]);_0xaa73fb[_0x644e('0x2e')]=_['intersection'](_0xaa73fb[_0x644e('0x2b')],_0xaa73fb['query']);_0x4319c2[_0x644e('0x2f')]=_[_0x644e('0x30')](_0xaa73fb[_0x644e('0x2b')],qs[_0x644e('0x31')](_0x4f040b[_0x644e('0x2d')]['fields']));_0x4319c2[_0x644e('0x2f')]=_0x4319c2[_0x644e('0x2f')][_0x644e('0x32')]?_0x4319c2[_0x644e('0x2f')]:_0xaa73fb[_0x644e('0x2b')];if(_0x4f040b[_0x644e('0x2d')][_0x644e('0x42')]){_0x4319c2['include']=[{'all':!![]}];}_0x4319c2=_[_0x644e('0x39')]({},_0x4319c2,_0x4f040b['options']);return db['AnalyticDefaultReport']['find'](_0x4319c2)[_0x644e('0x21')](handleEntityNotFound(_0x5adaa7,null))[_0x644e('0x21')](respondWithResult(_0x5adaa7,null))[_0x644e('0x43')](handleError(_0x5adaa7,null));};exports[_0x644e('0x44')]=function(_0x3e0e87,_0xa29fdc){return db[_0x644e('0x27')][_0x644e('0x44')](_0x3e0e87[_0x644e('0x45')],{})[_0x644e('0x21')](function(_0x1743bc){var _0x3af7e1=_0x3e0e87['user'][_0x644e('0x46')]({'plain':!![]});if(!_0x3af7e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3af7e1[_0x644e('0x47')]===_0x644e('0x48')){var _0x19acdf=_0x1743bc[_0x644e('0x46')]({'plain':!![]});var _0x5a34c9=_0x644e('0x49');return db[_0x644e('0x4a')][_0x644e('0x4b')]({'where':{'name':_0x5a34c9,'userProfileId':_0x3af7e1[_0x644e('0x4c')]},'raw':!![]})[_0x644e('0x21')](function(_0x3fc1d6){if(_0x3fc1d6&&_0x3fc1d6[_0x644e('0x4d')]===0x0){return db['UserProfileResource'][_0x644e('0x44')]({'name':_0x19acdf[_0x644e('0x25')],'resourceId':_0x19acdf['id'],'type':'DefaultReports','sectionId':_0x3fc1d6['id']},{})['then'](function(){return _0x1743bc;});}else{return _0x1743bc;}})[_0x644e('0x43')](function(_0x1db0d8){logger[_0x644e('0x4e')](_0x644e('0x4f'),_0x1db0d8);throw _0x1db0d8;});}return _0x1743bc;})[_0x644e('0x21')](respondWithResult(_0xa29fdc,0xc9))[_0x644e('0x43')](handleError(_0xa29fdc,null));};exports[_0x644e('0x50')]=function(_0x15e872,_0x1e6fca){if(_0x15e872[_0x644e('0x45')]['id']){delete _0x15e872[_0x644e('0x45')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x15e872[_0x644e('0x41')]['id']}})[_0x644e('0x21')](handleEntityNotFound(_0x1e6fca,null))[_0x644e('0x21')](saveUpdates(_0x15e872[_0x644e('0x45')],null))[_0x644e('0x21')](respondWithResult(_0x1e6fca,null))[_0x644e('0x43')](handleError(_0x1e6fca,null));};exports[_0x644e('0x22')]=function(_0x54fd88,_0x77389d){return db[_0x644e('0x27')][_0x644e('0x4b')]({'where':{'id':_0x54fd88[_0x644e('0x41')]['id']}})[_0x644e('0x21')](handleEntityNotFound(_0x77389d,null))[_0x644e('0x21')](removeEntity(_0x77389d,null))[_0x644e('0x43')](handleError(_0x77389d,null));};exports['preview']=function(_0x378c7f,_0x186da2){var _0x5c8ad6=0xa;var _0x47a1b4=['join','left_join',_0x644e('0x51'),_0x644e('0x52')];var _0x1ecbc6={'SUM':'SUM(%s)','COUNT':_0x644e('0x53'),'COUNT DISTINCT':_0x644e('0x54'),'MAX':'MAX(%s)','MIN':_0x644e('0x55'),'AVG':_0x644e('0x56'),'GROUP_CONCAT':_0x644e('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x644e('0x58')};var _0x4ac088={'SEC_TO_TIME':_0x644e('0x59'),'DATE':'DATE(%s)','HOUR':_0x644e('0x5a'),'ROUND':_0x644e('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd7602a=function(_0x4ad34c){return!_[_0x644e('0x5c')]([_0x644e('0x5d'),_0x644e('0x5e'),_0x644e('0x5f'),_0x644e('0x60')],_0x4ad34c);};var _0x4990fa=function(_0x372690){if(!_0x372690||!_0x372690[_0x644e('0x61')][_0x644e('0x32')]){return'';}for(var _0x4859b9='(',_0x155df7=0x0;_0x155df7<_0x372690[_0x644e('0x61')][_0x644e('0x32')];_0x155df7+=0x1){_0x155df7>0x0&&(_0x4859b9+='\x20'+_0x372690[_0x644e('0x62')]+'\x20');_0x4859b9+=_0x372690[_0x644e('0x61')][_0x155df7][_0x644e('0x63')]?_0x4990fa(_0x372690['rules'][_0x155df7]['group']):_0x372690[_0x644e('0x61')][_0x155df7][_0x644e('0x64')]+'\x20'+_0x372690['rules'][_0x155df7][_0x644e('0x65')]+(_0xd7602a(_0x372690[_0x644e('0x61')][_0x155df7][_0x644e('0x65')])?'\x20'+_0x372690[_0x644e('0x61')][_0x155df7][_0x644e('0x66')]:'');}return _0x4859b9+')';};var _0x3a6914={'where':{'id':_0x378c7f[_0x644e('0x41')]['id']}},_0x3c4e06,_0x4e3e0e,_0x1ec446,_0x561f60,_0x33992e;_0x3a6914=_[_0x644e('0x39')]({},_0x3a6914,_0x378c7f['options']);return db['AnalyticDefaultReport'][_0x644e('0x4b')](_0x3a6914)['then'](function(_0x227477){if(_0x227477){_0x3c4e06=_0x227477;return _0x227477[_0x644e('0x67')]();}return null;})[_0x644e('0x21')](function(_0x57af50){if(_0x57af50){if(!_0x57af50['length']){throw new db[(_0x644e('0x68'))]['ValidationErrorItem'](_0x644e('0x69'),0x193);}_0x4e3e0e=_0x57af50;return db[_0x644e('0x6a')][_0x644e('0x3e')]({'raw':!![]});}return null;})[_0x644e('0x21')](function(_0x3fff26){if(_0x3fff26){_0x1ec446=_[_0x644e('0x6b')](_0x3fff26,'id');var _0x24ad7e;var _0x39133e=squel[_0x644e('0x6c')]();_0x39133e[_0x644e('0x6d')](_0x3c4e06[_0x644e('0x6e')]);for(var _0x1d7006=0x0;_0x1d7006<_0x4e3e0e['length'];_0x1d7006+=0x1){_0x24ad7e=_0x4e3e0e[_0x1d7006][_0x644e('0x6f')]?_0x1ec446[_0x4e3e0e[_0x1d7006]['MetricId']][_0x644e('0x70')]:_0x4e3e0e[_0x1d7006][_0x644e('0x64')];_0x24ad7e=_0x4e3e0e[_0x1d7006]['function']?_[_0x644e('0x71')](_0x1ecbc6[_0x4e3e0e[_0x1d7006][_0x644e('0x72')]],'%s',_0x24ad7e):_0x24ad7e;_0x24ad7e=_0x4e3e0e[_0x1d7006][_0x644e('0x73')]?_['replace'](_0x4ac088[_0x4e3e0e[_0x1d7006][_0x644e('0x73')]],'%s',_0x24ad7e):_0x24ad7e;if(_0x4e3e0e[_0x1d7006][_0x644e('0x74')]){_0x39133e['group'](_0x24ad7e);}_0x4e3e0e[_0x1d7006][_0x644e('0x75')]&&_0x39133e['order'](_0x24ad7e,_0x4e3e0e[_0x1d7006][_0x644e('0x75')]===_0x644e('0x76')?![]:!![]);_0x39133e['field'](_0x24ad7e,_0x4e3e0e[_0x1d7006][_0x644e('0x77')]||_0x24ad7e);}if(_0x3c4e06['joins']){_0x3c4e06['joins']=JSON[_0x644e('0x78')](_0x3c4e06[_0x644e('0x79')]);for(var _0x3a6a55=0x0;_0x3a6a55<_0x3c4e06[_0x644e('0x79')][_0x644e('0x32')];_0x3a6a55+=0x1){if(_0x3c4e06[_0x644e('0x79')][_0x3a6a55]['type']&&_[_0x644e('0x5c')](_0x47a1b4,_0x3c4e06[_0x644e('0x79')][_0x3a6a55]['type'])&&_0x3c4e06['joins'][_0x3a6a55][_0x644e('0x7a')]&&_0x3c4e06['joins'][_0x3a6a55][_0x644e('0x7b')]&&_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x7c')]){_0x39133e[_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x2a')]](_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3c4e06['table'],_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x7a')],_0x3c4e06['joins'][_0x3a6a55]['foreignTable'],_0x3c4e06[_0x644e('0x79')][_0x3a6a55][_0x644e('0x7c')]));}}}if(_0x3c4e06[_0x644e('0x7d')]){_0x3c4e06['conditions']=JSON['parse'](_0x3c4e06[_0x644e('0x7d')]);_0x39133e['where'](_0x4990fa(_0x3c4e06[_0x644e('0x7d')][_0x644e('0x63')]));}_0x33992e=_0x39133e[_0x644e('0x7e')]();_0x39133e[_0x644e('0x1b')](_0x5c8ad6);_0x39133e[_0x644e('0x1a')](0x0);logger[_0x644e('0x7f')](_0x644e('0x80'),_0x39133e[_0x644e('0x81')]());return db['sequelize']['query'](_0x39133e[_0x644e('0x81')](),{'type':db[_0x644e('0x82')][_0x644e('0x83')][_0x644e('0x84')]});}})['then'](respondWithResult(_0x186da2,null))[_0x644e('0x43')](handleError(_0x186da2,null));};function runReport(_0x2b0ee6,_0xbf8201,_0xc55e32){var _0x417018=_0xbf8201[_0x644e('0x25')];var _0x3eb4db=0xa;var _0x2447e5=[_0x644e('0x85'),_0x644e('0x86'),_0x644e('0x51'),'cross_join'];var _0x5aa37c={'SUM':'SUM(%s)','COUNT':_0x644e('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x644e('0x87'),'MIN':_0x644e('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x644e('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x644e('0x58')};var _0x4f9498={'SEC_TO_TIME':_0x644e('0x59'),'DATE':_0x644e('0x88'),'HOUR':_0x644e('0x5a'),'ROUND':_0x644e('0x5b'),'UNIX_TIMESTAMP':_0x644e('0x89')};var _0x3039a8=function(_0x43f0b7){return!_[_0x644e('0x5c')]([_0x644e('0x5d'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x43f0b7);};var _0x2f3b0e=function(_0x34ba73){if(!_0x34ba73||!_0x34ba73['rules'][_0x644e('0x32')]){return'';}for(var _0x5d20da='(',_0x2fdcf2=0x0;_0x2fdcf2<_0x34ba73[_0x644e('0x61')][_0x644e('0x32')];_0x2fdcf2+=0x1){_0x2fdcf2>0x0&&(_0x5d20da+='\x20'+_0x34ba73[_0x644e('0x62')]+'\x20');_0x5d20da+=_0x34ba73['rules'][_0x2fdcf2][_0x644e('0x63')]?_0x2f3b0e(_0x34ba73[_0x644e('0x61')][_0x2fdcf2][_0x644e('0x63')]):_0x34ba73[_0x644e('0x61')][_0x2fdcf2][_0x644e('0x64')]+'\x20'+_0x34ba73[_0x644e('0x61')][_0x2fdcf2][_0x644e('0x65')]+(_0x3039a8(_0x34ba73['rules'][_0x2fdcf2]['condition'])?'\x20'+_0x34ba73[_0x644e('0x61')][_0x2fdcf2][_0x644e('0x66')]:'');}return _0x5d20da+')';};var _0x24e369={'where':{'id':_0x2b0ee6['id']}},_0x6eb15b,_0x2b742c,_0x541014,_0xfdeff0,_0x4b872f;_0x24e369=_[_0x644e('0x39')]({},_0x24e369,_0xc55e32);return db[_0x644e('0x27')][_0x644e('0x4b')](_0x24e369)[_0x644e('0x21')](function(_0x81c948){if(_0x81c948){_0x6eb15b=_0x81c948;return _0x81c948[_0x644e('0x67')]();}return null;})[_0x644e('0x21')](function(_0x13b87f){if(_0x13b87f){if(!_0x13b87f[_0x644e('0x32')]){throw new db[(_0x644e('0x68'))][(_0x644e('0x8a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2b742c=_0x13b87f;return db[_0x644e('0x6a')][_0x644e('0x3e')]({'raw':!![]});}return null;})[_0x644e('0x21')](function(_0x1dd3f2){if(_0x1dd3f2){_0x541014=_[_0x644e('0x6b')](_0x1dd3f2,'id');var _0x2cb986;var _0x26d2d6=squel[_0x644e('0x6c')]();_0x26d2d6['from'](_0x6eb15b[_0x644e('0x6e')]);for(var _0x47a41c=0x0;_0x47a41c<_0x2b742c['length'];_0x47a41c+=0x1){_0x2cb986=_0x2b742c[_0x47a41c][_0x644e('0x6f')]?_0x541014[_0x2b742c[_0x47a41c][_0x644e('0x6f')]][_0x644e('0x70')]:_0x2b742c[_0x47a41c]['field'];_0x2cb986=_0x2b742c[_0x47a41c][_0x644e('0x72')]?_[_0x644e('0x71')](_0x5aa37c[_0x2b742c[_0x47a41c][_0x644e('0x72')]],'%s',_0x2cb986):_0x2cb986;_0x2cb986=_0x2b742c[_0x47a41c][_0x644e('0x73')]?_[_0x644e('0x71')](_0x4f9498[_0x2b742c[_0x47a41c][_0x644e('0x73')]],'%s',_0x2cb986):_0x2cb986;if(_0x2b742c[_0x47a41c][_0x644e('0x74')]){_0x26d2d6[_0x644e('0x63')](_0x2cb986);}_0x2b742c[_0x47a41c]['orderBy']&&_0x26d2d6['order'](_0x2cb986,_0x2b742c[_0x47a41c][_0x644e('0x75')]==='DESC'?![]:!![]);_0x26d2d6['field'](_0x2cb986,_0x2b742c[_0x47a41c]['alias']||_0x2cb986);}if(_0x6eb15b[_0x644e('0x79')]){_0x6eb15b[_0x644e('0x79')]=JSON[_0x644e('0x78')](_0x6eb15b[_0x644e('0x79')]);for(var _0x4cbbdd=0x0;_0x4cbbdd<_0x6eb15b[_0x644e('0x79')][_0x644e('0x32')];_0x4cbbdd+=0x1){if(_0x6eb15b[_0x644e('0x79')][_0x4cbbdd][_0x644e('0x2a')]&&_[_0x644e('0x5c')](_0x2447e5,_0x6eb15b['joins'][_0x4cbbdd][_0x644e('0x2a')])&&_0x6eb15b['joins'][_0x4cbbdd][_0x644e('0x7a')]&&_0x6eb15b[_0x644e('0x79')][_0x4cbbdd][_0x644e('0x7b')]&&_0x6eb15b[_0x644e('0x79')][_0x4cbbdd][_0x644e('0x7c')]){_0x26d2d6[_0x6eb15b['joins'][_0x4cbbdd][_0x644e('0x2a')]](_0x6eb15b[_0x644e('0x79')][_0x4cbbdd]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x6eb15b[_0x644e('0x6e')],_0x6eb15b[_0x644e('0x79')][_0x4cbbdd][_0x644e('0x7a')],_0x6eb15b['joins'][_0x4cbbdd]['foreignTable'],_0x6eb15b['joins'][_0x4cbbdd]['foreignKey']));}}}if(_0x6eb15b[_0x644e('0x7d')]){_0x6eb15b[_0x644e('0x7d')]=JSON[_0x644e('0x78')](_0x6eb15b['conditions']);_0x26d2d6[_0x644e('0x37')](_0x2f3b0e(_0x6eb15b['conditions'][_0x644e('0x63')]));}_0x4b872f=_0x26d2d6['clone']();_0x26d2d6['limit'](_0x3eb4db);_0x26d2d6['offset'](0x0);logger[_0x644e('0x7f')](_0x644e('0x80'),_0x26d2d6[_0x644e('0x81')]());return db[_0x644e('0x82')][_0x644e('0x2d')](_0x26d2d6['toString'](),{'type':db[_0x644e('0x82')][_0x644e('0x83')][_0x644e('0x84')]});}})[_0x644e('0x21')](function(_0x3e3b2b){if(!_0x3e3b2b[_0x644e('0x32')]){throw new db[(_0x644e('0x68'))][(_0x644e('0x8a'))]('No\x20available\x20data',0xcc);}if(_0xbf8201[_0x644e('0x8b')]===_0x644e('0x8c')){return null;}var _0x54cad3=_['merge'](_0xbf8201,{'name':_0xbf8201[_0x644e('0x8d')]||_0xbf8201['name']||_0x6eb15b[_0x644e('0x25')],'basename':_0x417018,'savename':util[_0x644e('0x73')](_0x644e('0x8e'),_0xbf8201[_0x644e('0x25')]||_0x6eb15b[_0x644e('0x25')],require(_0x644e('0x8f'))['generate'](0x4),_0xbf8201[_0x644e('0x8b')]||_0x644e('0x90')),'reportId':_0x6eb15b['id'],'reportType':_0x644e('0x91')});return db[_0x644e('0x92')][_0x644e('0x44')](_0x54cad3,{'raw':!![]});})[_0x644e('0x21')](function(_0x42dec7){if(_0x6eb15b[_0x644e('0x6e')]===_0x644e('0x93')){_0x4b872f['where'](_0x6eb15b[_0x644e('0x6e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xbf8201[_0x644e('0x94')],_0xbf8201[_0x644e('0x95')]);}else{_0x4b872f[_0x644e('0x37')](_0x6eb15b[_0x644e('0x6e')]+_0x644e('0x96'),_0xbf8201['startDate'],_0xbf8201[_0x644e('0x95')]);}if(_0x42dec7){logger[_0x644e('0x97')](_0x644e('0x98'),_0x4b872f[_0x644e('0x81')]());require(_0x644e('0x99'))[_0x644e('0x9a')](path[_0x644e('0x85')](__dirname,_0x644e('0x9b'),_0x42dec7['output']),[_0x42dec7['id'],_0x4b872f[_0x644e('0x81')](),path[_0x644e('0x85')](__dirname,_0x644e('0x9c'),_0x42dec7[_0x644e('0x9d')]),_0x417018]);return _0x42dec7;}else{var _0x5c111b=squel[_0x644e('0x6c')]();_0x5c111b[_0x644e('0x6d')]('('+_0x4b872f[_0x644e('0x81')]()+')',_0x644e('0x9e'));_0x5c111b[_0x644e('0x64')](_0x644e('0x9f'),_0x644e('0x19'));_0x4b872f['limit'](_0xbf8201['limit']||_0x3eb4db);_0x4b872f['offset'](_0xbf8201['offset']||0x0);return dbH[_0x644e('0x82')][_0x644e('0x2d')](_0x5c111b[_0x644e('0x81')](),{'type':dbH['sequelize']['QueryTypes'][_0x644e('0x84')]})[_0x644e('0x21')](function(_0x1e83cf){if(!_0x1e83cf['length']){_0xfdeff0=0x0;}else{_0xfdeff0=_0x1e83cf[0x0][_0x644e('0x19')]||0x0;}return dbH['sequelize']['query'](_0x4b872f[_0x644e('0x81')](),{'type':dbH['sequelize'][_0x644e('0x83')][_0x644e('0x84')]});})[_0x644e('0x21')](function(_0x270f27){return{'rows':_0x270f27||[],'count':_0xfdeff0};});}});}exports[_0x644e('0xa0')]=function(_0x28bc9a,_0x147d8c){return runReport(_0x28bc9a[_0x644e('0x41')],_0x28bc9a[_0x644e('0x2d')],_0x28bc9a['options'])[_0x644e('0x21')](respondWithResult(_0x147d8c,null))[_0x644e('0x43')](handleError(_0x147d8c,null));};exports[_0x644e('0xa1')]=runReport;exports[_0x644e('0x2d')]=function(_0x4ec182,_0x1262b0){var _0x28aa34=0xa;var _0x2c5904=[_0x644e('0x85'),_0x644e('0x86'),_0x644e('0x51'),_0x644e('0x52')];var _0x4911b9={'SUM':_0x644e('0xa2'),'COUNT':_0x644e('0x53'),'COUNT DISTINCT':_0x644e('0x54'),'MAX':_0x644e('0x87'),'MIN':_0x644e('0x55'),'AVG':_0x644e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x644e('0x58')};var _0x2b952b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x644e('0x88'),'HOUR':_0x644e('0x5a'),'ROUND':_0x644e('0x5b'),'UNIX_TIMESTAMP':_0x644e('0x89')};var _0x2d11ea=function(_0xd0c3bd){return!_[_0x644e('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x644e('0x60')],_0xd0c3bd);};var _0x44d441=function(_0x2a4426){if(!_0x2a4426||!_0x2a4426['rules'][_0x644e('0x32')]){return'';}for(var _0x1f1fe4='(',_0x2dafc6=0x0;_0x2dafc6<_0x2a4426[_0x644e('0x61')][_0x644e('0x32')];_0x2dafc6+=0x1){_0x2dafc6>0x0&&(_0x1f1fe4+='\x20'+_0x2a4426[_0x644e('0x62')]+'\x20');_0x1f1fe4+=_0x2a4426[_0x644e('0x61')][_0x2dafc6][_0x644e('0x63')]?_0x44d441(_0x2a4426[_0x644e('0x61')][_0x2dafc6][_0x644e('0x63')]):_0x2a4426[_0x644e('0x61')][_0x2dafc6][_0x644e('0x64')]+'\x20'+_0x2a4426[_0x644e('0x61')][_0x2dafc6]['condition']+(_0x2d11ea(_0x2a4426[_0x644e('0x61')][_0x2dafc6][_0x644e('0x65')])?'\x20'+_0x2a4426['rules'][_0x2dafc6][_0x644e('0x66')]:'');}return _0x1f1fe4+')';};var _0x57d94f={'where':{'id':_0x4ec182[_0x644e('0x41')]['id']}},_0x4bc6b7,_0x406bab,_0x523914,_0x24b48f,_0x29e865;_0x57d94f=_['merge']({},_0x57d94f,_0x4ec182['options']);return db[_0x644e('0x27')]['find'](_0x57d94f)['then'](function(_0x304a8b){if(_0x304a8b){_0x4bc6b7=_0x304a8b;return _0x304a8b[_0x644e('0x67')]();}return null;})['then'](function(_0x4eee4a){if(_0x4eee4a){if(!_0x4eee4a['length']){throw new db['Sequelize'][(_0x644e('0x8a'))](_0x644e('0x69'),0x193);}_0x406bab=_0x4eee4a;return db['AnalyticMetric'][_0x644e('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x74d429){if(_0x74d429){_0x523914=_['keyBy'](_0x74d429,'id');var _0xfe93e7;var _0xd05551=squel[_0x644e('0x6c')]();_0xd05551[_0x644e('0x6d')](_0x4bc6b7[_0x644e('0x6e')]);for(var _0x5f2f5d=0x0;_0x5f2f5d<_0x406bab[_0x644e('0x32')];_0x5f2f5d+=0x1){_0xfe93e7=_0x406bab[_0x5f2f5d][_0x644e('0x6f')]?_0x523914[_0x406bab[_0x5f2f5d][_0x644e('0x6f')]][_0x644e('0x70')]:_0x406bab[_0x5f2f5d][_0x644e('0x64')];_0xfe93e7=_0x406bab[_0x5f2f5d][_0x644e('0x72')]?_[_0x644e('0x71')](_0x4911b9[_0x406bab[_0x5f2f5d][_0x644e('0x72')]],'%s',_0xfe93e7):_0xfe93e7;_0xfe93e7=_0x406bab[_0x5f2f5d][_0x644e('0x73')]?_['replace'](_0x2b952b[_0x406bab[_0x5f2f5d][_0x644e('0x73')]],'%s',_0xfe93e7):_0xfe93e7;if(_0x406bab[_0x5f2f5d][_0x644e('0x74')]){_0xd05551['group'](_0xfe93e7);}_0x406bab[_0x5f2f5d][_0x644e('0x75')]&&_0xd05551[_0x644e('0x35')](_0xfe93e7,_0x406bab[_0x5f2f5d][_0x644e('0x75')]==='DESC'?![]:!![]);_0xd05551['field'](_0xfe93e7,_0x406bab[_0x5f2f5d][_0x644e('0x77')]||_0xfe93e7);}if(_0x4bc6b7[_0x644e('0x79')]){_0x4bc6b7[_0x644e('0x79')]=JSON['parse'](_0x4bc6b7[_0x644e('0x79')]);for(var _0x255ffc=0x0;_0x255ffc<_0x4bc6b7[_0x644e('0x79')]['length'];_0x255ffc+=0x1){if(_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x2a')]&&_['includes'](_0x2c5904,_0x4bc6b7[_0x644e('0x79')][_0x255ffc]['type'])&&_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x7a')]&&_0x4bc6b7[_0x644e('0x79')][_0x255ffc]['foreignTable']&&_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x7c')]){_0xd05551[_0x4bc6b7['joins'][_0x255ffc][_0x644e('0x2a')]](_0x4bc6b7[_0x644e('0x79')][_0x255ffc]['foreignTable'],null,util[_0x644e('0x73')]('%s.%s\x20=\x20%s.%s',_0x4bc6b7[_0x644e('0x6e')],_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x7a')],_0x4bc6b7[_0x644e('0x79')][_0x255ffc][_0x644e('0x7b')],_0x4bc6b7[_0x644e('0x79')][_0x255ffc]['foreignKey']));}}}if(_0x4bc6b7[_0x644e('0x7d')]){_0x4bc6b7[_0x644e('0x7d')]=JSON[_0x644e('0x78')](_0x4bc6b7['conditions']);_0xd05551[_0x644e('0x37')](_0x44d441(_0x4bc6b7['conditions'][_0x644e('0x63')]));}_0x29e865=_0xd05551[_0x644e('0x7e')]();_0xd05551[_0x644e('0x1b')](_0x28aa34);_0xd05551[_0x644e('0x1a')](0x0);logger[_0x644e('0x7f')](_0x644e('0x80'),_0xd05551[_0x644e('0x81')]());return db[_0x644e('0x82')]['query'](_0xd05551[_0x644e('0x81')](),{'type':db[_0x644e('0x82')][_0x644e('0x83')][_0x644e('0x84')]});}})['then'](function(){return{'sql':_0x29e865[_0x644e('0x81')]()};})[_0x644e('0x21')](respondWithResult(_0x1262b0,null))[_0x644e('0x43')](handleError(_0x1262b0,null));}; \ No newline at end of file +var _0xe8a2=['Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','right_join','cross_join','GROUP_CONCAT(%s)','DATE(%s)','IS\x20NOT\x20NULL','function','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','join','../../files/reports','countTable','run','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','DefaultReports','UserProfileResource','end','sendStatus','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug'];(function(_0x5dda62,_0x493273){var _0x311c30=function(_0x3a718e){while(--_0x3a718e){_0x5dda62['push'](_0x5dda62['shift']());}};_0x311c30(++_0x493273);}(_0xe8a2,0x15f));var _0x2e8a=function(_0x400667,_0x5e4a0c){_0x400667=_0x400667-0x0;var _0x2a2ac1=_0xe8a2[_0x400667];return _0x2a2ac1;};'use strict';var pdf=require(_0x2e8a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2e8a('0x1'));var zipdir=require(_0x2e8a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e8a('0x3'));var moment=require(_0x2e8a('0x4'));var BPromise=require(_0x2e8a('0x5'));var Mustache=require(_0x2e8a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2e8a('0x7'));var csv=require(_0x2e8a('0x8'));var ejs=require(_0x2e8a('0x9'));var fs=require('fs');var _=require(_0x2e8a('0xa'));var squel=require('squel');var crypto=require(_0x2e8a('0xb'));var jsforce=require(_0x2e8a('0xc'));var deskjs=require(_0x2e8a('0xd'));var toCsv=require(_0x2e8a('0x8'));var querystring=require(_0x2e8a('0xe'));var Papa=require('papaparse');var Redis=require(_0x2e8a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2e8a('0x10'));var as=require(_0x2e8a('0x11'));var hardwareService=require(_0x2e8a('0x12'));var logger=require(_0x2e8a('0x13'))('api');var utils=require(_0x2e8a('0x14'));var config=require('../../config/environment');var db=require(_0x2e8a('0x15'))['db'];var dbH=require(_0x2e8a('0x15'))['dbH'];function respondWithStatusCode(_0x394bfd,_0x48b3e4){_0x48b3e4=_0x48b3e4||0xcc;return function(_0x56d8af){if(_0x56d8af){return _0x394bfd['sendStatus'](_0x48b3e4);}return _0x394bfd[_0x2e8a('0x16')](_0x48b3e4)['end']();};}function respondWithResult(_0x13d5d9,_0x1b8f82){_0x1b8f82=_0x1b8f82||0xc8;return function(_0x2d2e72){if(_0x2d2e72){return _0x13d5d9[_0x2e8a('0x16')](_0x1b8f82)[_0x2e8a('0x17')](_0x2d2e72);}};}function respondWithFilteredResult(_0x40ae6a,_0x46e809){return function(_0xc98a34){if(_0xc98a34){var _0x2db346=_0xc98a34[_0x2e8a('0x18')],_0xf47300=_0x46e809[_0x2e8a('0x19')],_0x1b0ee4=_0x46e809[_0x2e8a('0x19')]+_0x46e809[_0x2e8a('0x1a')],_0x451f48;if(_0x1b0ee4>=_0x2db346){_0x1b0ee4=_0x2db346;_0x451f48=0xc8;}else{_0x451f48=0xce;}_0x40ae6a[_0x2e8a('0x16')](_0x451f48);return _0x40ae6a['set'](_0x2e8a('0x1b'),_0xf47300+'-'+_0x1b0ee4+'/'+_0x2db346)[_0x2e8a('0x17')](_0xc98a34);}return null;};}function patchUpdates(_0x5d2127){return function(_0x53666a){try{jsonpatch[_0x2e8a('0x1c')](_0x53666a,_0x5d2127,!![]);}catch(_0xc4878e){return BPromise[_0x2e8a('0x1d')](_0xc4878e);}return _0x53666a[_0x2e8a('0x1e')]();};}function saveUpdates(_0x3dc421,_0x32f5ce){return function(_0x3d1e2d){if(_0x3d1e2d){return _0x3d1e2d['update'](_0x3dc421)[_0x2e8a('0x1f')](function(_0x4acb96){return _0x4acb96;});}return null;};}function removeEntity(_0x3c68a7,_0x4c6379){return function(_0xa4f415){if(_0xa4f415){return _0xa4f415[_0x2e8a('0x20')]()[_0x2e8a('0x1f')](function(){var _0x31d86d=_0xa4f415['get']({'plain':!![]});var _0x14178a=_0x2e8a('0x21');return db[_0x2e8a('0x22')]['destroy']({'where':{'type':_0x14178a,'resourceId':_0x31d86d['id']}})[_0x2e8a('0x1f')](function(){return _0xa4f415;});})['then'](function(){_0x3c68a7[_0x2e8a('0x16')](0xcc)[_0x2e8a('0x23')]();});}};}function handleEntityNotFound(_0x240584,_0xc2d7af){return function(_0x4838d9){if(!_0x4838d9){_0x240584[_0x2e8a('0x24')](0x194);}return _0x4838d9;};}function handleError(_0x2680f7,_0x3d8baa){_0x3d8baa=_0x3d8baa||0x1f4;return function(_0x2a145e){logger['error'](_0x2a145e['stack']);if(_0x2a145e[_0x2e8a('0x25')]){delete _0x2a145e[_0x2e8a('0x25')];}_0x2680f7['status'](_0x3d8baa)[_0x2e8a('0x26')](_0x2a145e);};}exports[_0x2e8a('0x27')]=function(_0x3a6ee3,_0x2e6cdf){var _0x3b1840={},_0x2cdba1={},_0x2c5ffe={'count':0x0,'rows':[]};var _0x25c984=_[_0x2e8a('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x2c18ce){return{'name':_0x2c18ce[_0x2e8a('0x29')],'type':_0x2c18ce[_0x2e8a('0x2a')][_0x2e8a('0x2b')]};});_0x2cdba1[_0x2e8a('0x2c')]=_[_0x2e8a('0x28')](_0x25c984,_0x2e8a('0x25'));_0x2cdba1[_0x2e8a('0x2d')]=_[_0x2e8a('0x2e')](_0x3a6ee3[_0x2e8a('0x2d')]);_0x2cdba1[_0x2e8a('0x2f')]=_[_0x2e8a('0x30')](_0x2cdba1['model'],_0x2cdba1['query']);_0x3b1840[_0x2e8a('0x31')]=_[_0x2e8a('0x30')](_0x2cdba1[_0x2e8a('0x2c')],qs[_0x2e8a('0x32')](_0x3a6ee3['query'][_0x2e8a('0x32')]));_0x3b1840[_0x2e8a('0x31')]=_0x3b1840[_0x2e8a('0x31')]['length']?_0x3b1840[_0x2e8a('0x31')]:_0x2cdba1[_0x2e8a('0x2c')];if(!_0x3a6ee3[_0x2e8a('0x2d')][_0x2e8a('0x33')](_0x2e8a('0x34'))){_0x3b1840[_0x2e8a('0x1a')]=qs[_0x2e8a('0x1a')](_0x3a6ee3['query'][_0x2e8a('0x1a')]);_0x3b1840[_0x2e8a('0x19')]=qs[_0x2e8a('0x19')](_0x3a6ee3[_0x2e8a('0x2d')][_0x2e8a('0x19')]);}_0x3b1840[_0x2e8a('0x35')]=qs[_0x2e8a('0x36')](_0x3a6ee3[_0x2e8a('0x2d')]['sort']);_0x3b1840['where']=qs['filters'](_['pick'](_0x3a6ee3[_0x2e8a('0x2d')],_0x2cdba1[_0x2e8a('0x2f')]),_0x25c984);if(_0x3a6ee3['query'][_0x2e8a('0x37')]){_0x3b1840[_0x2e8a('0x38')]=_['merge'](_0x3b1840[_0x2e8a('0x38')],{'$or':_[_0x2e8a('0x28')](_0x25c984,function(_0x3ce39f){if(_0x3ce39f[_0x2e8a('0x2a')]!=='VIRTUAL'){var _0x3fff3b={};_0x3fff3b[_0x3ce39f[_0x2e8a('0x25')]]={'$like':'%'+_0x3a6ee3[_0x2e8a('0x2d')][_0x2e8a('0x37')]+'%'};return _0x3fff3b;}})});}_0x3b1840=_[_0x2e8a('0x39')]({},_0x3b1840,_0x3a6ee3['options']);var _0x2e67e6={'where':_0x3b1840['where']};return db[_0x2e8a('0x3a')][_0x2e8a('0x18')](_0x2e67e6)[_0x2e8a('0x1f')](function(_0x1181e7){_0x2c5ffe[_0x2e8a('0x18')]=_0x1181e7;if(_0x3a6ee3[_0x2e8a('0x2d')][_0x2e8a('0x3b')]){_0x3b1840[_0x2e8a('0x3c')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x2e8a('0x3d')](_0x3b1840);})[_0x2e8a('0x1f')](function(_0x403c99){_0x2c5ffe[_0x2e8a('0x3e')]=_0x403c99;return _0x2c5ffe;})[_0x2e8a('0x1f')](respondWithFilteredResult(_0x2e6cdf,_0x3b1840))['catch'](handleError(_0x2e6cdf,null));};exports[_0x2e8a('0x3f')]=function(_0x3c161a,_0x365273){var _0x4d39c4={'raw':!![],'where':{'id':_0x3c161a[_0x2e8a('0x40')]['id']}},_0x2672bb={};_0x2672bb[_0x2e8a('0x2c')]=_[_0x2e8a('0x2e')](db['AnalyticDefaultReport']['rawAttributes']);_0x2672bb[_0x2e8a('0x2d')]=_['keys'](_0x3c161a[_0x2e8a('0x2d')]);_0x2672bb[_0x2e8a('0x2f')]=_[_0x2e8a('0x30')](_0x2672bb[_0x2e8a('0x2c')],_0x2672bb[_0x2e8a('0x2d')]);_0x4d39c4[_0x2e8a('0x31')]=_[_0x2e8a('0x30')](_0x2672bb[_0x2e8a('0x2c')],qs['fields'](_0x3c161a[_0x2e8a('0x2d')][_0x2e8a('0x32')]));_0x4d39c4[_0x2e8a('0x31')]=_0x4d39c4[_0x2e8a('0x31')]['length']?_0x4d39c4[_0x2e8a('0x31')]:_0x2672bb[_0x2e8a('0x2c')];if(_0x3c161a[_0x2e8a('0x2d')]['includeAll']){_0x4d39c4[_0x2e8a('0x3c')]=[{'all':!![]}];}_0x4d39c4=_['merge']({},_0x4d39c4,_0x3c161a[_0x2e8a('0x41')]);return db['AnalyticDefaultReport'][_0x2e8a('0x42')](_0x4d39c4)[_0x2e8a('0x1f')](handleEntityNotFound(_0x365273,null))[_0x2e8a('0x1f')](respondWithResult(_0x365273,null))['catch'](handleError(_0x365273,null));};exports[_0x2e8a('0x43')]=function(_0x439e89,_0x5831cc){return db[_0x2e8a('0x3a')][_0x2e8a('0x43')](_0x439e89['body'],{})['then'](function(_0x24e79f){var _0x39bcaf=_0x439e89['user'][_0x2e8a('0x44')]({'plain':!![]});if(!_0x39bcaf)throw new Error(_0x2e8a('0x45'));if(_0x39bcaf[_0x2e8a('0x46')]===_0x2e8a('0x47')){var _0xd9f0eb=_0x24e79f[_0x2e8a('0x44')]({'plain':!![]});var _0x3fc2f1=_0x2e8a('0x48');return db['UserProfileSection'][_0x2e8a('0x42')]({'where':{'name':_0x3fc2f1,'userProfileId':_0x39bcaf['userProfileId']},'raw':!![]})['then'](function(_0xfa33d2){if(_0xfa33d2&&_0xfa33d2[_0x2e8a('0x49')]===0x0){return db[_0x2e8a('0x22')][_0x2e8a('0x43')]({'name':_0xd9f0eb[_0x2e8a('0x25')],'resourceId':_0xd9f0eb['id'],'type':_0x2e8a('0x21'),'sectionId':_0xfa33d2['id']},{})[_0x2e8a('0x1f')](function(){return _0x24e79f;});}else{return _0x24e79f;}})[_0x2e8a('0x4a')](function(_0x8d7c2){logger[_0x2e8a('0x4b')](_0x2e8a('0x4c'),_0x8d7c2);throw _0x8d7c2;});}return _0x24e79f;})[_0x2e8a('0x1f')](respondWithResult(_0x5831cc,0xc9))[_0x2e8a('0x4a')](handleError(_0x5831cc,null));};exports[_0x2e8a('0x4d')]=function(_0x293eee,_0x2718ed){if(_0x293eee[_0x2e8a('0x4e')]['id']){delete _0x293eee[_0x2e8a('0x4e')]['id'];}return db[_0x2e8a('0x3a')][_0x2e8a('0x42')]({'where':{'id':_0x293eee[_0x2e8a('0x40')]['id']}})['then'](handleEntityNotFound(_0x2718ed,null))[_0x2e8a('0x1f')](saveUpdates(_0x293eee[_0x2e8a('0x4e')],null))[_0x2e8a('0x1f')](respondWithResult(_0x2718ed,null))[_0x2e8a('0x4a')](handleError(_0x2718ed,null));};exports[_0x2e8a('0x20')]=function(_0x4e41ea,_0x1c6a3b){return db[_0x2e8a('0x3a')][_0x2e8a('0x42')]({'where':{'id':_0x4e41ea[_0x2e8a('0x40')]['id']}})[_0x2e8a('0x1f')](handleEntityNotFound(_0x1c6a3b,null))[_0x2e8a('0x1f')](removeEntity(_0x1c6a3b,null))[_0x2e8a('0x4a')](handleError(_0x1c6a3b,null));};exports[_0x2e8a('0x4f')]=function(_0x485bc4,_0x5a6217){var _0xa957ac=0xa;var _0xdf32e4=['join','left_join','right_join','cross_join'];var _0x4957ae={'SUM':_0x2e8a('0x50'),'COUNT':_0x2e8a('0x51'),'COUNT DISTINCT':_0x2e8a('0x52'),'MAX':_0x2e8a('0x53'),'MIN':_0x2e8a('0x54'),'AVG':_0x2e8a('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2e8a('0x56'),'GROUP_CONCAT DESC':_0x2e8a('0x57')};var _0x54f9d4={'SEC_TO_TIME':_0x2e8a('0x58'),'DATE':'DATE(%s)','HOUR':_0x2e8a('0x59'),'ROUND':_0x2e8a('0x5a'),'UNIX_TIMESTAMP':_0x2e8a('0x5b')};var _0x318e37=function(_0x4c423a){return!_[_0x2e8a('0x5c')]([_0x2e8a('0x5d'),'IS\x20NOT\x20NULL',_0x2e8a('0x5e'),_0x2e8a('0x5f')],_0x4c423a);};var _0x52d509=function(_0xb64a8){if(!_0xb64a8||!_0xb64a8[_0x2e8a('0x60')][_0x2e8a('0x61')]){return'';}for(var _0xe355a8='(',_0x16272b=0x0;_0x16272b<_0xb64a8[_0x2e8a('0x60')][_0x2e8a('0x61')];_0x16272b+=0x1){_0x16272b>0x0&&(_0xe355a8+='\x20'+_0xb64a8[_0x2e8a('0x62')]+'\x20');_0xe355a8+=_0xb64a8[_0x2e8a('0x60')][_0x16272b]['group']?_0x52d509(_0xb64a8[_0x2e8a('0x60')][_0x16272b]['group']):_0xb64a8[_0x2e8a('0x60')][_0x16272b]['field']+'\x20'+_0xb64a8[_0x2e8a('0x60')][_0x16272b]['condition']+(_0x318e37(_0xb64a8[_0x2e8a('0x60')][_0x16272b][_0x2e8a('0x63')])?'\x20'+_0xb64a8[_0x2e8a('0x60')][_0x16272b][_0x2e8a('0x64')]:'');}return _0xe355a8+')';};var _0x4b2d85={'where':{'id':_0x485bc4[_0x2e8a('0x40')]['id']}},_0x10ba64,_0x4462e0,_0x153a48,_0x53906b,_0x1abd7f;_0x4b2d85=_[_0x2e8a('0x39')]({},_0x4b2d85,_0x485bc4['options']);return db[_0x2e8a('0x3a')]['find'](_0x4b2d85)[_0x2e8a('0x1f')](function(_0x347bb1){if(_0x347bb1){_0x10ba64=_0x347bb1;return _0x347bb1[_0x2e8a('0x65')]();}return null;})['then'](function(_0x1d58e0){if(_0x1d58e0){if(!_0x1d58e0[_0x2e8a('0x61')]){throw new db[(_0x2e8a('0x66'))][(_0x2e8a('0x67'))](_0x2e8a('0x68'),0x193);}_0x4462e0=_0x1d58e0;return db[_0x2e8a('0x69')][_0x2e8a('0x3d')]({'raw':!![]});}return null;})[_0x2e8a('0x1f')](function(_0x4fe27a){if(_0x4fe27a){_0x153a48=_[_0x2e8a('0x6a')](_0x4fe27a,'id');var _0x153b48;var _0x177970=squel[_0x2e8a('0x6b')]();_0x177970[_0x2e8a('0x6c')](_0x10ba64[_0x2e8a('0x6d')]);for(var _0x304f2d=0x0;_0x304f2d<_0x4462e0[_0x2e8a('0x61')];_0x304f2d+=0x1){_0x153b48=_0x4462e0[_0x304f2d][_0x2e8a('0x6e')]?_0x153a48[_0x4462e0[_0x304f2d][_0x2e8a('0x6e')]][_0x2e8a('0x6f')]:_0x4462e0[_0x304f2d][_0x2e8a('0x70')];_0x153b48=_0x4462e0[_0x304f2d]['function']?_[_0x2e8a('0x71')](_0x4957ae[_0x4462e0[_0x304f2d]['function']],'%s',_0x153b48):_0x153b48;_0x153b48=_0x4462e0[_0x304f2d][_0x2e8a('0x72')]?_[_0x2e8a('0x71')](_0x54f9d4[_0x4462e0[_0x304f2d][_0x2e8a('0x72')]],'%s',_0x153b48):_0x153b48;if(_0x4462e0[_0x304f2d][_0x2e8a('0x73')]){_0x177970['group'](_0x153b48);}_0x4462e0[_0x304f2d]['orderBy']&&_0x177970[_0x2e8a('0x35')](_0x153b48,_0x4462e0[_0x304f2d][_0x2e8a('0x74')]===_0x2e8a('0x75')?![]:!![]);_0x177970['field'](_0x153b48,_0x4462e0[_0x304f2d][_0x2e8a('0x76')]||_0x153b48);}if(_0x10ba64[_0x2e8a('0x77')]){_0x10ba64[_0x2e8a('0x77')]=JSON[_0x2e8a('0x78')](_0x10ba64[_0x2e8a('0x77')]);for(var _0x4c2434=0x0;_0x4c2434<_0x10ba64[_0x2e8a('0x77')][_0x2e8a('0x61')];_0x4c2434+=0x1){if(_0x10ba64['joins'][_0x4c2434][_0x2e8a('0x2a')]&&_[_0x2e8a('0x5c')](_0xdf32e4,_0x10ba64[_0x2e8a('0x77')][_0x4c2434]['type'])&&_0x10ba64['joins'][_0x4c2434][_0x2e8a('0x79')]&&_0x10ba64[_0x2e8a('0x77')][_0x4c2434][_0x2e8a('0x7a')]&&_0x10ba64[_0x2e8a('0x77')][_0x4c2434][_0x2e8a('0x7b')]){_0x177970[_0x10ba64[_0x2e8a('0x77')][_0x4c2434][_0x2e8a('0x2a')]](_0x10ba64[_0x2e8a('0x77')][_0x4c2434][_0x2e8a('0x7a')],null,util[_0x2e8a('0x72')](_0x2e8a('0x7c'),_0x10ba64[_0x2e8a('0x6d')],_0x10ba64[_0x2e8a('0x77')][_0x4c2434]['parentKey'],_0x10ba64[_0x2e8a('0x77')][_0x4c2434]['foreignTable'],_0x10ba64[_0x2e8a('0x77')][_0x4c2434][_0x2e8a('0x7b')]));}}}if(_0x10ba64['conditions']){_0x10ba64[_0x2e8a('0x7d')]=JSON[_0x2e8a('0x78')](_0x10ba64[_0x2e8a('0x7d')]);_0x177970[_0x2e8a('0x38')](_0x52d509(_0x10ba64[_0x2e8a('0x7d')][_0x2e8a('0x7e')]));}_0x1abd7f=_0x177970[_0x2e8a('0x7f')]();_0x177970['limit'](_0xa957ac);_0x177970['offset'](0x0);logger[_0x2e8a('0x80')](_0x2e8a('0x81'),_0x177970['toString']());return db[_0x2e8a('0x82')]['query'](_0x177970[_0x2e8a('0x83')](),{'type':db[_0x2e8a('0x82')][_0x2e8a('0x84')][_0x2e8a('0x85')]});}})['then'](respondWithResult(_0x5a6217,null))[_0x2e8a('0x4a')](handleError(_0x5a6217,null));};function runReport(_0x2e93e4,_0x48b07f,_0x1db186){var _0x20c08f=_0x48b07f[_0x2e8a('0x25')];var _0x3ed7d4=0xa;var _0x28babd=['join',_0x2e8a('0x86'),_0x2e8a('0x87'),_0x2e8a('0x88')];var _0xd4ab9d={'SUM':_0x2e8a('0x50'),'COUNT':_0x2e8a('0x51'),'COUNT DISTINCT':_0x2e8a('0x52'),'MAX':_0x2e8a('0x53'),'MIN':_0x2e8a('0x54'),'AVG':_0x2e8a('0x55'),'GROUP_CONCAT':_0x2e8a('0x89'),'GROUP_CONCAT ASC':_0x2e8a('0x56'),'GROUP_CONCAT DESC':_0x2e8a('0x57')};var _0x2caf3f={'SEC_TO_TIME':_0x2e8a('0x58'),'DATE':_0x2e8a('0x8a'),'HOUR':_0x2e8a('0x59'),'ROUND':_0x2e8a('0x5a'),'UNIX_TIMESTAMP':_0x2e8a('0x5b')};var _0x548243=function(_0x49d93b){return!_[_0x2e8a('0x5c')]([_0x2e8a('0x5d'),_0x2e8a('0x8b'),_0x2e8a('0x5e'),_0x2e8a('0x5f')],_0x49d93b);};var _0x427378=function(_0x493002){if(!_0x493002||!_0x493002[_0x2e8a('0x60')]['length']){return'';}for(var _0x3255ee='(',_0x571177=0x0;_0x571177<_0x493002[_0x2e8a('0x60')][_0x2e8a('0x61')];_0x571177+=0x1){_0x571177>0x0&&(_0x3255ee+='\x20'+_0x493002[_0x2e8a('0x62')]+'\x20');_0x3255ee+=_0x493002['rules'][_0x571177][_0x2e8a('0x7e')]?_0x427378(_0x493002[_0x2e8a('0x60')][_0x571177][_0x2e8a('0x7e')]):_0x493002['rules'][_0x571177]['field']+'\x20'+_0x493002['rules'][_0x571177][_0x2e8a('0x63')]+(_0x548243(_0x493002[_0x2e8a('0x60')][_0x571177][_0x2e8a('0x63')])?'\x20'+_0x493002[_0x2e8a('0x60')][_0x571177][_0x2e8a('0x64')]:'');}return _0x3255ee+')';};var _0x34b195={'where':{'id':_0x2e93e4['id']}},_0x35a7ef,_0x4ea780,_0x9dd562,_0x2c4a9d,_0x533fc4;_0x34b195=_[_0x2e8a('0x39')]({},_0x34b195,_0x1db186);return db['AnalyticDefaultReport']['find'](_0x34b195)[_0x2e8a('0x1f')](function(_0x1b1513){if(_0x1b1513){_0x35a7ef=_0x1b1513;return _0x1b1513['getFields']();}return null;})[_0x2e8a('0x1f')](function(_0x48cf8a){if(_0x48cf8a){if(!_0x48cf8a[_0x2e8a('0x61')]){throw new db[(_0x2e8a('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ea780=_0x48cf8a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x2e8a('0x1f')](function(_0x1de3c9){if(_0x1de3c9){_0x9dd562=_[_0x2e8a('0x6a')](_0x1de3c9,'id');var _0x1ccc74;var _0x100835=squel[_0x2e8a('0x6b')]();_0x100835[_0x2e8a('0x6c')](_0x35a7ef[_0x2e8a('0x6d')]);for(var _0x3da5a2=0x0;_0x3da5a2<_0x4ea780[_0x2e8a('0x61')];_0x3da5a2+=0x1){_0x1ccc74=_0x4ea780[_0x3da5a2][_0x2e8a('0x6e')]?_0x9dd562[_0x4ea780[_0x3da5a2]['MetricId']][_0x2e8a('0x6f')]:_0x4ea780[_0x3da5a2][_0x2e8a('0x70')];_0x1ccc74=_0x4ea780[_0x3da5a2][_0x2e8a('0x8c')]?_[_0x2e8a('0x71')](_0xd4ab9d[_0x4ea780[_0x3da5a2][_0x2e8a('0x8c')]],'%s',_0x1ccc74):_0x1ccc74;_0x1ccc74=_0x4ea780[_0x3da5a2][_0x2e8a('0x72')]?_['replace'](_0x2caf3f[_0x4ea780[_0x3da5a2][_0x2e8a('0x72')]],'%s',_0x1ccc74):_0x1ccc74;if(_0x4ea780[_0x3da5a2][_0x2e8a('0x73')]){_0x100835[_0x2e8a('0x7e')](_0x1ccc74);}_0x4ea780[_0x3da5a2][_0x2e8a('0x74')]&&_0x100835[_0x2e8a('0x35')](_0x1ccc74,_0x4ea780[_0x3da5a2][_0x2e8a('0x74')]==='DESC'?![]:!![]);_0x100835[_0x2e8a('0x70')](_0x1ccc74,_0x4ea780[_0x3da5a2][_0x2e8a('0x76')]||_0x1ccc74);}if(_0x35a7ef[_0x2e8a('0x77')]){_0x35a7ef['joins']=JSON[_0x2e8a('0x78')](_0x35a7ef['joins']);for(var _0x3288fe=0x0;_0x3288fe<_0x35a7ef[_0x2e8a('0x77')][_0x2e8a('0x61')];_0x3288fe+=0x1){if(_0x35a7ef[_0x2e8a('0x77')][_0x3288fe]['type']&&_[_0x2e8a('0x5c')](_0x28babd,_0x35a7ef[_0x2e8a('0x77')][_0x3288fe]['type'])&&_0x35a7ef[_0x2e8a('0x77')][_0x3288fe]['parentKey']&&_0x35a7ef[_0x2e8a('0x77')][_0x3288fe][_0x2e8a('0x7a')]&&_0x35a7ef[_0x2e8a('0x77')][_0x3288fe]['foreignKey']){_0x100835[_0x35a7ef[_0x2e8a('0x77')][_0x3288fe]['type']](_0x35a7ef[_0x2e8a('0x77')][_0x3288fe][_0x2e8a('0x7a')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x35a7ef[_0x2e8a('0x6d')],_0x35a7ef[_0x2e8a('0x77')][_0x3288fe][_0x2e8a('0x79')],_0x35a7ef[_0x2e8a('0x77')][_0x3288fe][_0x2e8a('0x7a')],_0x35a7ef[_0x2e8a('0x77')][_0x3288fe][_0x2e8a('0x7b')]));}}}if(_0x35a7ef[_0x2e8a('0x7d')]){_0x35a7ef[_0x2e8a('0x7d')]=JSON[_0x2e8a('0x78')](_0x35a7ef[_0x2e8a('0x7d')]);_0x100835['where'](_0x427378(_0x35a7ef['conditions'][_0x2e8a('0x7e')]));}_0x533fc4=_0x100835[_0x2e8a('0x7f')]();_0x100835[_0x2e8a('0x1a')](_0x3ed7d4);_0x100835[_0x2e8a('0x19')](0x0);logger['debug'](_0x2e8a('0x81'),_0x100835[_0x2e8a('0x83')]());return db[_0x2e8a('0x82')]['query'](_0x100835['toString'](),{'type':db[_0x2e8a('0x82')][_0x2e8a('0x84')]['SELECT']});}})[_0x2e8a('0x1f')](function(_0x163d94){if(!_0x163d94[_0x2e8a('0x61')]){throw new db['Sequelize']['ValidationErrorItem'](_0x2e8a('0x8d'),0xcc);}if(_0x48b07f[_0x2e8a('0x8e')]===_0x2e8a('0x8f')){return null;}var _0x5ccec8=_[_0x2e8a('0x39')](_0x48b07f,{'name':_0x48b07f[_0x2e8a('0x90')]||_0x48b07f['name']||_0x35a7ef[_0x2e8a('0x25')],'basename':_0x20c08f,'savename':util['format'](_0x2e8a('0x91'),_0x48b07f['name']||_0x35a7ef['name'],require(_0x2e8a('0x92'))[_0x2e8a('0x93')](0x4),_0x48b07f[_0x2e8a('0x8e')]||_0x2e8a('0x94')),'reportId':_0x35a7ef['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x2e8a('0x43')](_0x5ccec8,{'raw':!![]});})[_0x2e8a('0x1f')](function(_0x59a01){if(_0x35a7ef[_0x2e8a('0x6d')]===_0x2e8a('0x95')){_0x533fc4[_0x2e8a('0x38')](_0x35a7ef[_0x2e8a('0x6d')]+_0x2e8a('0x96'),_0x48b07f[_0x2e8a('0x97')],_0x48b07f['endDate']);}else{_0x533fc4[_0x2e8a('0x38')](_0x35a7ef[_0x2e8a('0x6d')]+_0x2e8a('0x98'),_0x48b07f['startDate'],_0x48b07f['endDate']);}if(_0x59a01){logger['info'](_0x2e8a('0x99'),_0x533fc4[_0x2e8a('0x83')]());require(_0x2e8a('0x9a'))[_0x2e8a('0x9b')](path[_0x2e8a('0x9c')](__dirname,'../../components/export/',_0x59a01[_0x2e8a('0x8e')]),[_0x59a01['id'],_0x533fc4[_0x2e8a('0x83')](),path['join'](__dirname,_0x2e8a('0x9d'),_0x59a01['savename']),_0x20c08f]);return _0x59a01;}else{var _0x13708f=squel['select']();_0x13708f[_0x2e8a('0x6c')]('('+_0x533fc4[_0x2e8a('0x83')]()+')',_0x2e8a('0x9e'));_0x13708f[_0x2e8a('0x70')]('COUNT(*)',_0x2e8a('0x18'));_0x533fc4[_0x2e8a('0x1a')](_0x48b07f['limit']||_0x3ed7d4);_0x533fc4[_0x2e8a('0x19')](_0x48b07f['offset']||0x0);return dbH[_0x2e8a('0x82')][_0x2e8a('0x2d')](_0x13708f[_0x2e8a('0x83')](),{'type':dbH[_0x2e8a('0x82')]['QueryTypes'][_0x2e8a('0x85')]})[_0x2e8a('0x1f')](function(_0x746773){if(!_0x746773[_0x2e8a('0x61')]){_0x2c4a9d=0x0;}else{_0x2c4a9d=_0x746773[0x0][_0x2e8a('0x18')]||0x0;}return dbH['sequelize'][_0x2e8a('0x2d')](_0x533fc4[_0x2e8a('0x83')](),{'type':dbH['sequelize']['QueryTypes'][_0x2e8a('0x85')]});})['then'](function(_0x596060){return{'rows':_0x596060||[],'count':_0x2c4a9d};});}});}exports[_0x2e8a('0x9f')]=function(_0xbbfd57,_0x2e2825){return runReport(_0xbbfd57['params'],_0xbbfd57[_0x2e8a('0x2d')],_0xbbfd57[_0x2e8a('0x41')])[_0x2e8a('0x1f')](respondWithResult(_0x2e2825,null))[_0x2e8a('0x4a')](handleError(_0x2e2825,null));};exports['runReport']=runReport;exports['query']=function(_0x50b759,_0x350601){var _0x40d625=0xa;var _0x19fe47=[_0x2e8a('0x9c'),'left_join',_0x2e8a('0x87'),'cross_join'];var _0x2d0288={'SUM':_0x2e8a('0x50'),'COUNT':_0x2e8a('0x51'),'COUNT DISTINCT':_0x2e8a('0x52'),'MAX':'MAX(%s)','MIN':_0x2e8a('0x54'),'AVG':_0x2e8a('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2e8a('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1a1a89={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2e8a('0x8a'),'HOUR':_0x2e8a('0x59'),'ROUND':_0x2e8a('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x330a91=function(_0xbe5633){return!_[_0x2e8a('0x5c')]([_0x2e8a('0x5d'),_0x2e8a('0x8b'),_0x2e8a('0x5e'),_0x2e8a('0x5f')],_0xbe5633);};var _0x19e738=function(_0xf45b1){if(!_0xf45b1||!_0xf45b1['rules'][_0x2e8a('0x61')]){return'';}for(var _0x5dec13='(',_0x514010=0x0;_0x514010<_0xf45b1['rules']['length'];_0x514010+=0x1){_0x514010>0x0&&(_0x5dec13+='\x20'+_0xf45b1[_0x2e8a('0x62')]+'\x20');_0x5dec13+=_0xf45b1[_0x2e8a('0x60')][_0x514010]['group']?_0x19e738(_0xf45b1[_0x2e8a('0x60')][_0x514010]['group']):_0xf45b1['rules'][_0x514010][_0x2e8a('0x70')]+'\x20'+_0xf45b1[_0x2e8a('0x60')][_0x514010]['condition']+(_0x330a91(_0xf45b1[_0x2e8a('0x60')][_0x514010][_0x2e8a('0x63')])?'\x20'+_0xf45b1[_0x2e8a('0x60')][_0x514010][_0x2e8a('0x64')]:'');}return _0x5dec13+')';};var _0x2a176a={'where':{'id':_0x50b759['params']['id']}},_0x22bcd3,_0x227f18,_0x12e2f0,_0x2354f7,_0x141a9d;_0x2a176a=_[_0x2e8a('0x39')]({},_0x2a176a,_0x50b759['options']);return db[_0x2e8a('0x3a')][_0x2e8a('0x42')](_0x2a176a)[_0x2e8a('0x1f')](function(_0x3069cd){if(_0x3069cd){_0x22bcd3=_0x3069cd;return _0x3069cd[_0x2e8a('0x65')]();}return null;})[_0x2e8a('0x1f')](function(_0x450b57){if(_0x450b57){if(!_0x450b57[_0x2e8a('0x61')]){throw new db[(_0x2e8a('0x66'))][(_0x2e8a('0x67'))](_0x2e8a('0x68'),0x193);}_0x227f18=_0x450b57;return db[_0x2e8a('0x69')][_0x2e8a('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x50bed9){if(_0x50bed9){_0x12e2f0=_[_0x2e8a('0x6a')](_0x50bed9,'id');var _0x1864a9;var _0x1ce9c7=squel[_0x2e8a('0x6b')]();_0x1ce9c7[_0x2e8a('0x6c')](_0x22bcd3['table']);for(var _0x60289f=0x0;_0x60289f<_0x227f18[_0x2e8a('0x61')];_0x60289f+=0x1){_0x1864a9=_0x227f18[_0x60289f][_0x2e8a('0x6e')]?_0x12e2f0[_0x227f18[_0x60289f][_0x2e8a('0x6e')]][_0x2e8a('0x6f')]:_0x227f18[_0x60289f][_0x2e8a('0x70')];_0x1864a9=_0x227f18[_0x60289f]['function']?_['replace'](_0x2d0288[_0x227f18[_0x60289f][_0x2e8a('0x8c')]],'%s',_0x1864a9):_0x1864a9;_0x1864a9=_0x227f18[_0x60289f]['format']?_['replace'](_0x1a1a89[_0x227f18[_0x60289f]['format']],'%s',_0x1864a9):_0x1864a9;if(_0x227f18[_0x60289f][_0x2e8a('0x73')]){_0x1ce9c7[_0x2e8a('0x7e')](_0x1864a9);}_0x227f18[_0x60289f][_0x2e8a('0x74')]&&_0x1ce9c7['order'](_0x1864a9,_0x227f18[_0x60289f][_0x2e8a('0x74')]===_0x2e8a('0x75')?![]:!![]);_0x1ce9c7[_0x2e8a('0x70')](_0x1864a9,_0x227f18[_0x60289f]['alias']||_0x1864a9);}if(_0x22bcd3[_0x2e8a('0x77')]){_0x22bcd3[_0x2e8a('0x77')]=JSON['parse'](_0x22bcd3[_0x2e8a('0x77')]);for(var _0x345ed0=0x0;_0x345ed0<_0x22bcd3[_0x2e8a('0x77')][_0x2e8a('0x61')];_0x345ed0+=0x1){if(_0x22bcd3['joins'][_0x345ed0][_0x2e8a('0x2a')]&&_['includes'](_0x19fe47,_0x22bcd3[_0x2e8a('0x77')][_0x345ed0]['type'])&&_0x22bcd3['joins'][_0x345ed0][_0x2e8a('0x79')]&&_0x22bcd3['joins'][_0x345ed0]['foreignTable']&&_0x22bcd3[_0x2e8a('0x77')][_0x345ed0][_0x2e8a('0x7b')]){_0x1ce9c7[_0x22bcd3[_0x2e8a('0x77')][_0x345ed0][_0x2e8a('0x2a')]](_0x22bcd3[_0x2e8a('0x77')][_0x345ed0][_0x2e8a('0x7a')],null,util[_0x2e8a('0x72')](_0x2e8a('0x7c'),_0x22bcd3[_0x2e8a('0x6d')],_0x22bcd3[_0x2e8a('0x77')][_0x345ed0]['parentKey'],_0x22bcd3[_0x2e8a('0x77')][_0x345ed0]['foreignTable'],_0x22bcd3['joins'][_0x345ed0][_0x2e8a('0x7b')]));}}}if(_0x22bcd3[_0x2e8a('0x7d')]){_0x22bcd3[_0x2e8a('0x7d')]=JSON[_0x2e8a('0x78')](_0x22bcd3[_0x2e8a('0x7d')]);_0x1ce9c7[_0x2e8a('0x38')](_0x19e738(_0x22bcd3[_0x2e8a('0x7d')]['group']));}_0x141a9d=_0x1ce9c7['clone']();_0x1ce9c7['limit'](_0x40d625);_0x1ce9c7[_0x2e8a('0x19')](0x0);logger['debug'](_0x2e8a('0x81'),_0x1ce9c7['toString']());return db['sequelize'][_0x2e8a('0x2d')](_0x1ce9c7[_0x2e8a('0x83')](),{'type':db['sequelize'][_0x2e8a('0x84')][_0x2e8a('0x85')]});}})['then'](function(){return{'sql':_0x141a9d[_0x2e8a('0x83')]()};})[_0x2e8a('0x1f')](respondWithResult(_0x350601,null))[_0x2e8a('0x4a')](handleError(_0x350601,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index bd98dca..5fd3376 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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','util','api','moment'];(function(_0x3c9c71,_0x4c4f84){var _0x5e6c84=function(_0x12015f){while(--_0x12015f){_0x3c9c71['push'](_0x3c9c71['shift']());}};_0x5e6c84(++_0x4c4f84);}(_0xadb5,0xad));var _0x5adb=function(_0x27ea6b,_0x5516a6){_0x27ea6b=_0x27ea6b-0x0;var _0x25306b=_0xadb5[_0x27ea6b];return _0x25306b;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x4fccb1,_0x1cff52){var _0x47ef93=function(_0x33c90a){while(--_0x33c90a){_0x4fccb1['push'](_0x4fccb1['shift']());}};_0x47ef93(++_0x1cff52);}(_0x0295,0x1f0));var _0x5029=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x0295[_0x595bd1];return _0xd0344f;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 4de9431..9ac40aa 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 _0x9090=['jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x9090,0x17f));var _0x0909=function(_0x390a7a,_0x4c8d69){_0x390a7a=_0x390a7a-0x0;var _0x599bef=_0x9090[_0x390a7a];return _0x599bef;};'use strict';var _=require(_0x0909('0x0'));var util=require(_0x0909('0x1'));var moment=require(_0x0909('0x2'));var BPromise=require(_0x0909('0x3'));var rs=require(_0x0909('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0909('0x5'));var logger=require(_0x0909('0x6'))(_0x0909('0x7'));var config=require('../../config/environment');var jayson=require(_0x0909('0x8'));var client=jayson[_0x0909('0x9')][_0x0909('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d8fc,_0x26dfbe,_0x32bf48){return new BPromise(function(_0x1755ee,_0x571b3c){return client[_0x0909('0xb')](_0x41d8fc,_0x32bf48)[_0x0909('0xc')](function(_0x4f961d){logger[_0x0909('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x26dfbe,_0x0909('0xe'));logger[_0x0909('0xf')](_0x0909('0x10'),_0x26dfbe,_0x0909('0xe'),JSON['stringify'](_0x4f961d));if(_0x4f961d[_0x0909('0x11')]){if(_0x4f961d[_0x0909('0x11')][_0x0909('0x12')]===0x1f4){logger[_0x0909('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x26dfbe,_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);return _0x571b3c(_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);}logger[_0x0909('0x11')](_0x0909('0x14'),_0x26dfbe,_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);return _0x1755ee(_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);}else{logger['info'](_0x0909('0x14'),_0x26dfbe,_0x0909('0xe'));_0x1755ee(_0x4f961d[_0x0909('0x15')][_0x0909('0x13')]);}})[_0x0909('0x16')](function(_0x1d68cd){logger[_0x0909('0x11')](_0x0909('0x14'),_0x26dfbe,_0x1d68cd);_0x571b3c(_0x1d68cd);});});} \ No newline at end of file +var _0x7427=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','AnalyticDefaultReport,\x20%s,\x20%s','lodash','util','moment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7427,0x111));var _0x7742=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x7427[_0x5da0d9];return _0x4b6d2f;};'use strict';var _=require(_0x7742('0x0'));var util=require(_0x7742('0x1'));var moment=require(_0x7742('0x2'));var BPromise=require(_0x7742('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7742('0x4'));var db=require(_0x7742('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7742('0x6'))(_0x7742('0x7'));var config=require(_0x7742('0x8'));var jayson=require(_0x7742('0x9'));var client=jayson[_0x7742('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe55f,_0x2634d5,_0xd21f94){return new BPromise(function(_0x3c6ceb,_0x1da94f){return client[_0x7742('0xb')](_0x4fe55f,_0xd21f94)[_0x7742('0xc')](function(_0x46696e){logger[_0x7742('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2634d5,'request\x20sent');logger[_0x7742('0xe')](_0x7742('0xf'),_0x2634d5,'request\x20sent',JSON[_0x7742('0x10')](_0x46696e));if(_0x46696e['error']){if(_0x46696e['error'][_0x7742('0x11')]===0x1f4){logger[_0x7742('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2634d5,_0x46696e[_0x7742('0x12')][_0x7742('0x13')]);return _0x1da94f(_0x46696e['error']['message']);}logger[_0x7742('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2634d5,_0x46696e['error']['message']);return _0x3c6ceb(_0x46696e['error'][_0x7742('0x13')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2634d5,_0x7742('0x14'));_0x3c6ceb(_0x46696e['result'][_0x7742('0x13')]);}})[_0x7742('0x15')](function(_0x1f3ffc){logger[_0x7742('0x12')](_0x7742('0x16'),_0x2634d5,_0x1f3ffc);_0x1da94f(_0x1f3ffc);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 86b3ea6..048ee6b 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 _0xd787=['/:id','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','update','delete'];(function(_0x40a78d,_0xffca17){var _0x1505c7=function(_0x5b37d8){while(--_0x5b37d8){_0x40a78d['push'](_0x40a78d['shift']());}};_0x1505c7(++_0xffca17);}(_0xd787,0x1e4));var _0x7d78=function(_0x57c1fa,_0x2e53d8){_0x57c1fa=_0x57c1fa-0x0;var _0x12c2bf=_0xd787[_0x57c1fa];return _0x12c2bf;};'use strict';var multer=require(_0x7d78('0x0'));var util=require('util');var path=require(_0x7d78('0x1'));var timeout=require(_0x7d78('0x2'));var express=require(_0x7d78('0x3'));var router=express[_0x7d78('0x4')]();var auth=require(_0x7d78('0x5'));var interaction=require(_0x7d78('0x6'));var config=require(_0x7d78('0x7'));var controller=require(_0x7d78('0x8'));router[_0x7d78('0x9')]('/',auth[_0x7d78('0xa')](),controller[_0x7d78('0xb')]);router[_0x7d78('0x9')]('/:id',auth[_0x7d78('0xa')](),controller[_0x7d78('0xc')]);router[_0x7d78('0x9')](_0x7d78('0xd'),auth[_0x7d78('0xa')](),controller[_0x7d78('0xe')]);router['get'](_0x7d78('0xf'),auth[_0x7d78('0xa')](),controller[_0x7d78('0x10')]);router['get'](_0x7d78('0x11'),auth[_0x7d78('0xa')](),controller[_0x7d78('0x12')]);router[_0x7d78('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x7d78('0xa')](),controller[_0x7d78('0x14')]);router[_0x7d78('0x15')](_0x7d78('0x16'),auth[_0x7d78('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xab72=['multer','util','path','connect-timeout','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','post','put','update','delete','destroy','exports'];(function(_0x4fef7a,_0x3cf474){var _0x21a36d=function(_0x162384){while(--_0x162384){_0x4fef7a['push'](_0x4fef7a['shift']());}};_0x21a36d(++_0x3cf474);}(_0xab72,0x6e));var _0x2ab7=function(_0x2e46df,_0x5b044b){_0x2e46df=_0x2e46df-0x0;var _0x1ef04d=_0xab72[_0x2e46df];return _0x1ef04d;};'use strict';var multer=require(_0x2ab7('0x0'));var util=require(_0x2ab7('0x1'));var path=require(_0x2ab7('0x2'));var timeout=require(_0x2ab7('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2ab7('0x4'));var controller=require(_0x2ab7('0x5'));router[_0x2ab7('0x6')]('/',auth['isAuthenticated'](),controller[_0x2ab7('0x7')]);router['get'](_0x2ab7('0x8'),auth['isAuthenticated'](),controller[_0x2ab7('0x9')]);router[_0x2ab7('0x6')](_0x2ab7('0xa'),auth[_0x2ab7('0xb')](),controller[_0x2ab7('0xc')]);router[_0x2ab7('0x6')](_0x2ab7('0xd'),auth[_0x2ab7('0xb')](),controller[_0x2ab7('0xe')]);router[_0x2ab7('0x6')](_0x2ab7('0xf'),auth[_0x2ab7('0xb')](),controller['query']);router[_0x2ab7('0x10')]('/',auth[_0x2ab7('0xb')](),controller['create']);router[_0x2ab7('0x11')](_0x2ab7('0x8'),auth[_0x2ab7('0xb')](),controller[_0x2ab7('0x12')]);router[_0x2ab7('0x13')](_0x2ab7('0x8'),auth[_0x2ab7('0xb')](),controller[_0x2ab7('0x14')]);module[_0x2ab7('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 72daa84..aaa9604 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 _0xce53=['xlsx','DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','csv'];(function(_0xedc6d8,_0x4f8ceb){var _0x2cba41=function(_0xd94423){while(--_0xd94423){_0xedc6d8['push'](_0xedc6d8['shift']());}};_0x2cba41(++_0x4f8ceb);}(_0xce53,0x158));var _0x3ce5=function(_0x12aa6e,_0x1643ee){_0x12aa6e=_0x12aa6e-0x0;var _0x3a1b87=_0xce53[_0x12aa6e];return _0x3a1b87;};'use strict';var Sequelize=require(_0x3ce5('0x0'));var moment=require(_0x3ce5('0x1'));module['exports']={'name':{'type':Sequelize[_0x3ce5('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x3ce5('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x3ce5('0x3'),'pdf',_0x3ce5('0x4')),'allowNull':![],'defaultValue':_0x3ce5('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x3ce5('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x3ce5('0x2')],'defaultValue':_0x3ce5('0x6')},'type':{'type':Sequelize[_0x3ce5('0x7')](_0x3ce5('0x8'),_0x3ce5('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x3ce5('0xa')](0xb)[_0x3ce5('0xb')]},'reportType':{'type':Sequelize[_0x3ce5('0x2')]}}; \ No newline at end of file +var _0x3cb3=['sequelize','exports','STRING','ENUM','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED'];(function(_0x1b3686,_0x479d23){var _0x13b5f9=function(_0x1a133c){while(--_0x1a133c){_0x1b3686['push'](_0x1b3686['shift']());}};_0x13b5f9(++_0x479d23);}(_0x3cb3,0x104));var _0x33cb=function(_0x4f34c3,_0x329318){_0x4f34c3=_0x4f34c3-0x0;var _0x125a00=_0x3cb3[_0x4f34c3];return _0x125a00;};'use strict';var Sequelize=require(_0x33cb('0x0'));var moment=require('moment');module[_0x33cb('0x1')]={'name':{'type':Sequelize[_0x33cb('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x33cb('0x3')]('csv','pdf',_0x33cb('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x33cb('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x33cb('0x5')]},'endDate':{'type':Sequelize[_0x33cb('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x33cb('0x6')},'type':{'type':Sequelize[_0x33cb('0x3')](_0x33cb('0x7'),'scheduled'),'allowNull':![],'defaultValue':_0x33cb('0x7')},'reportId':{'type':Sequelize[_0x33cb('0x8')](0xb)[_0x33cb('0x9')]},'reportType':{'type':Sequelize[_0x33cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 11e444c..70a50d4 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 _0x4f4d=['options','include','findAll','rows','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','params','basename','output','existsSync','join','root','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','download','format','%s.%s','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','end','status','count','offset','set','Content-Range','json','apply','reject','save','then','get','ExtractedReports','destroy','error','stack','name','send','AnalyticExtractedReport','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge'];(function(_0x2b0169,_0x3acffe){var _0x4dc92f=function(_0x369fec){while(--_0x369fec){_0x2b0169['push'](_0x2b0169['shift']());}};_0x4dc92f(++_0x3acffe);}(_0x4f4d,0x1da));var _0xd4f4=function(_0x3a4a66,_0x5afde4){_0x3a4a66=_0x3a4a66-0x0;var _0x2bd136=_0x4f4d[_0x3a4a66];return _0x2bd136;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd4f4('0x0'));var zipdir=require(_0xd4f4('0x1'));var jsonpatch=require(_0xd4f4('0x2'));var rp=require('request-promise');var moment=require(_0xd4f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd4f4('0x4'));var util=require(_0xd4f4('0x5'));var path=require(_0xd4f4('0x6'));var sox=require(_0xd4f4('0x7'));var csv=require(_0xd4f4('0x8'));var ejs=require(_0xd4f4('0x9'));var fs=require('fs');var _=require(_0xd4f4('0xa'));var squel=require('squel');var crypto=require(_0xd4f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd4f4('0xc'));var toCsv=require(_0xd4f4('0x8'));var querystring=require('querystring');var Papa=require(_0xd4f4('0xd'));var Redis=require(_0xd4f4('0xe'));var authService=require(_0xd4f4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd4f4('0x10'));var hardwareService=require(_0xd4f4('0x11'));var logger=require(_0xd4f4('0x12'))('api');var utils=require(_0xd4f4('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165a97,_0x5b54ab){_0x5b54ab=_0x5b54ab||0xcc;return function(_0x93c1cf){if(_0x93c1cf){return _0x165a97['sendStatus'](_0x5b54ab);}return _0x165a97['status'](_0x5b54ab)[_0xd4f4('0x14')]();};}function respondWithResult(_0x405b1a,_0x1486fd){_0x1486fd=_0x1486fd||0xc8;return function(_0x347f99){if(_0x347f99){return _0x405b1a[_0xd4f4('0x15')](_0x1486fd)['json'](_0x347f99);}};}function respondWithFilteredResult(_0x29041c,_0x255ddb){return function(_0x57bc0f){if(_0x57bc0f){var _0x8cf2a4=_0x57bc0f[_0xd4f4('0x16')],_0x57f251=_0x255ddb[_0xd4f4('0x17')],_0x10f08d=_0x255ddb[_0xd4f4('0x17')]+_0x255ddb['limit'],_0x528083;if(_0x10f08d>=_0x8cf2a4){_0x10f08d=_0x8cf2a4;_0x528083=0xc8;}else{_0x528083=0xce;}_0x29041c[_0xd4f4('0x15')](_0x528083);return _0x29041c[_0xd4f4('0x18')](_0xd4f4('0x19'),_0x57f251+'-'+_0x10f08d+'/'+_0x8cf2a4)[_0xd4f4('0x1a')](_0x57bc0f);}return null;};}function patchUpdates(_0x18a179){return function(_0x232aff){try{jsonpatch[_0xd4f4('0x1b')](_0x232aff,_0x18a179,!![]);}catch(_0x1c58c3){return BPromise[_0xd4f4('0x1c')](_0x1c58c3);}return _0x232aff[_0xd4f4('0x1d')]();};}function saveUpdates(_0x327e0e,_0x360161){return function(_0x1e2293){if(_0x1e2293){return _0x1e2293['update'](_0x327e0e)[_0xd4f4('0x1e')](function(_0x5f3f43){return _0x5f3f43;});}return null;};}function removeEntity(_0x14549e,_0x3c3d47){return function(_0x3a5de6){if(_0x3a5de6){return _0x3a5de6['destroy']()[_0xd4f4('0x1e')](function(){var _0x5a26e9=_0x3a5de6[_0xd4f4('0x1f')]({'plain':!![]});var _0x57cc57=_0xd4f4('0x20');return db['UserProfileResource'][_0xd4f4('0x21')]({'where':{'type':_0x57cc57,'resourceId':_0x5a26e9['id']}})[_0xd4f4('0x1e')](function(){return _0x3a5de6;});})[_0xd4f4('0x1e')](function(){_0x14549e[_0xd4f4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54d344,_0x20e992){return function(_0x11bc64){if(!_0x11bc64){_0x54d344['sendStatus'](0x194);}return _0x11bc64;};}function handleError(_0x30cb0b,_0x4f7d66){_0x4f7d66=_0x4f7d66||0x1f4;return function(_0x523f94){logger[_0xd4f4('0x22')](_0x523f94[_0xd4f4('0x23')]);if(_0x523f94[_0xd4f4('0x24')]){delete _0x523f94[_0xd4f4('0x24')];}_0x30cb0b[_0xd4f4('0x15')](_0x4f7d66)[_0xd4f4('0x25')](_0x523f94);};}exports['index']=function(_0x4b6db0,_0xa76947){var _0x924a01={},_0x5710ec={},_0x42c5fe={'count':0x0,'rows':[]};var _0x3fcf6a=_['map'](db[_0xd4f4('0x26')]['rawAttributes'],function(_0x22e0f5){return{'name':_0x22e0f5[_0xd4f4('0x27')],'type':_0x22e0f5[_0xd4f4('0x28')]['key']};});_0x5710ec[_0xd4f4('0x29')]=_[_0xd4f4('0x2a')](_0x3fcf6a,_0xd4f4('0x24'));_0x5710ec[_0xd4f4('0x2b')]=_[_0xd4f4('0x2c')](_0x4b6db0[_0xd4f4('0x2b')]);_0x5710ec[_0xd4f4('0x2d')]=_[_0xd4f4('0x2e')](_0x5710ec[_0xd4f4('0x29')],_0x5710ec[_0xd4f4('0x2b')]);_0x924a01['attributes']=_[_0xd4f4('0x2e')](_0x5710ec['model'],qs[_0xd4f4('0x2f')](_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x2f')]));_0x924a01[_0xd4f4('0x30')]=_0x924a01[_0xd4f4('0x30')][_0xd4f4('0x31')]?_0x924a01['attributes']:_0x5710ec[_0xd4f4('0x29')];if(!_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x32')](_0xd4f4('0x33'))){_0x924a01[_0xd4f4('0x34')]=qs[_0xd4f4('0x34')](_0x4b6db0['query'][_0xd4f4('0x34')]);_0x924a01[_0xd4f4('0x17')]=qs[_0xd4f4('0x17')](_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x17')]);}_0x924a01[_0xd4f4('0x35')]=qs[_0xd4f4('0x36')](_0x4b6db0['query'][_0xd4f4('0x36')]);_0x924a01['where']=qs[_0xd4f4('0x2d')](_[_0xd4f4('0x37')](_0x4b6db0[_0xd4f4('0x2b')],_0x5710ec['filters']),_0x3fcf6a);if(_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x38')]){_0x924a01[_0xd4f4('0x39')]=_['merge'](_0x924a01[_0xd4f4('0x39')],{'$or':_[_0xd4f4('0x2a')](_0x3fcf6a,function(_0xbf98e5){if(_0xbf98e5[_0xd4f4('0x28')]!==_0xd4f4('0x3a')){var _0x5f0b55={};_0x5f0b55[_0xbf98e5['name']]={'$like':'%'+_0x4b6db0[_0xd4f4('0x2b')][_0xd4f4('0x38')]+'%'};return _0x5f0b55;}})});}_0x924a01=_[_0xd4f4('0x3b')]({},_0x924a01,_0x4b6db0[_0xd4f4('0x3c')]);var _0x87ba3f={'where':_0x924a01['where']};return db[_0xd4f4('0x26')][_0xd4f4('0x16')](_0x87ba3f)['then'](function(_0x4a5f04){_0x42c5fe[_0xd4f4('0x16')]=_0x4a5f04;if(_0x4b6db0[_0xd4f4('0x2b')]['includeAll']){_0x924a01[_0xd4f4('0x3d')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xd4f4('0x3e')](_0x924a01);})['then'](function(_0x4ec679){_0x42c5fe[_0xd4f4('0x3f')]=_0x4ec679;return _0x42c5fe;})[_0xd4f4('0x1e')](respondWithFilteredResult(_0xa76947,_0x924a01))['catch'](handleError(_0xa76947,null));};exports['show']=function(_0x25d8c0,_0x6ad8f1){var _0x26b693={'raw':!![],'where':{'id':_0x25d8c0['params']['id']}},_0x27973a={};_0x27973a['model']=_['keys'](db[_0xd4f4('0x26')]['rawAttributes']);_0x27973a[_0xd4f4('0x2b')]=_[_0xd4f4('0x2c')](_0x25d8c0[_0xd4f4('0x2b')]);_0x27973a['filters']=_['intersection'](_0x27973a[_0xd4f4('0x29')],_0x27973a[_0xd4f4('0x2b')]);_0x26b693[_0xd4f4('0x30')]=_[_0xd4f4('0x2e')](_0x27973a['model'],qs[_0xd4f4('0x2f')](_0x25d8c0['query'][_0xd4f4('0x2f')]));_0x26b693[_0xd4f4('0x30')]=_0x26b693[_0xd4f4('0x30')][_0xd4f4('0x31')]?_0x26b693[_0xd4f4('0x30')]:_0x27973a[_0xd4f4('0x29')];if(_0x25d8c0['query']['includeAll']){_0x26b693[_0xd4f4('0x3d')]=[{'all':!![]}];}_0x26b693=_[_0xd4f4('0x3b')]({},_0x26b693,_0x25d8c0[_0xd4f4('0x3c')]);return db[_0xd4f4('0x26')][_0xd4f4('0x40')](_0x26b693)['then'](handleEntityNotFound(_0x6ad8f1,null))['then'](respondWithResult(_0x6ad8f1,null))[_0xd4f4('0x41')](handleError(_0x6ad8f1,null));};exports[_0xd4f4('0x42')]=function(_0x3cdd98,_0x1a1baf){return db['AnalyticExtractedReport'][_0xd4f4('0x42')](_0x3cdd98[_0xd4f4('0x43')],{})[_0xd4f4('0x1e')](function(_0x275f52){var _0x2e3f0c=_0x3cdd98[_0xd4f4('0x44')][_0xd4f4('0x1f')]({'plain':!![]});if(!_0x2e3f0c)throw new Error(_0xd4f4('0x45'));if(_0x2e3f0c[_0xd4f4('0x46')]===_0xd4f4('0x44')){var _0x48153c=_0x275f52[_0xd4f4('0x1f')]({'plain':!![]});var _0x5d356c=_0xd4f4('0x20');return db[_0xd4f4('0x47')][_0xd4f4('0x40')]({'where':{'name':_0x5d356c,'userProfileId':_0x2e3f0c[_0xd4f4('0x48')]},'raw':!![]})[_0xd4f4('0x1e')](function(_0x3854ab){if(_0x3854ab&&_0x3854ab[_0xd4f4('0x49')]===0x0){return db['UserProfileResource'][_0xd4f4('0x42')]({'name':_0x48153c[_0xd4f4('0x24')],'resourceId':_0x48153c['id'],'type':_0x3854ab['name'],'sectionId':_0x3854ab['id']},{})[_0xd4f4('0x1e')](function(){return _0x275f52;});}else{return _0x275f52;}})[_0xd4f4('0x41')](function(_0x470c80){logger[_0xd4f4('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x470c80);throw _0x470c80;});}return _0x275f52;})[_0xd4f4('0x1e')](respondWithResult(_0x1a1baf,0xc9))[_0xd4f4('0x41')](handleError(_0x1a1baf,null));};exports[_0xd4f4('0x4a')]=function(_0x4f5433,_0x4dcb52){if(_0x4f5433[_0xd4f4('0x43')]['id']){delete _0x4f5433[_0xd4f4('0x43')]['id'];}return db[_0xd4f4('0x26')]['find']({'where':{'id':_0x4f5433[_0xd4f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4dcb52,null))[_0xd4f4('0x1e')](saveUpdates(_0x4f5433[_0xd4f4('0x43')],null))[_0xd4f4('0x1e')](respondWithResult(_0x4dcb52,null))[_0xd4f4('0x41')](handleError(_0x4dcb52,null));};exports[_0xd4f4('0x21')]=function(_0x27ab4c,_0x550a6c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x27ab4c[_0xd4f4('0x4b')]['id']}})[_0xd4f4('0x1e')](handleEntityNotFound(_0x550a6c,null))['then'](removeEntity(_0x550a6c,null))[_0xd4f4('0x41')](handleError(_0x550a6c,null));};exports['download']=function(_0x34ba13,_0xae7008,_0x59ddb3){return db[_0xd4f4('0x26')][_0xd4f4('0x40')]({'where':{'id':_0x34ba13[_0xd4f4('0x4b')]['id']},'attributes':[_0xd4f4('0x24'),_0xd4f4('0x4c'),'savename',_0xd4f4('0x4d')],'raw':!![]})[_0xd4f4('0x1e')](handleEntityNotFound(_0xae7008,null))['then'](function(_0x4e35eb){if(_0x4e35eb){if(!fs[_0xd4f4('0x4e')](path[_0xd4f4('0x4f')](config[_0xd4f4('0x50')],'server/files/reports',_0x4e35eb[_0xd4f4('0x51')]))){throw new db[(_0xd4f4('0x52'))]['ValidationError'](_0xd4f4('0x53'));}if(_0x34ba13[_0xd4f4('0x2b')][_0xd4f4('0x54')]){return _0xae7008[_0xd4f4('0x55')](0xc8);}return _0xae7008[_0xd4f4('0x56')](path[_0xd4f4('0x4f')](config[_0xd4f4('0x50')],'server/files/reports',_0x4e35eb['savename']),util[_0xd4f4('0x57')](_0xd4f4('0x58'),_0x4e35eb[_0xd4f4('0x4c')]||_0x4e35eb[_0xd4f4('0x24')],_0x4e35eb[_0xd4f4('0x4d')]['toLowerCase']()));}})[_0xd4f4('0x41')](handleError(_0xae7008,null));}; \ No newline at end of file +var _0x1c43=['reject','save','then','get','destroy','stack','name','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','output','join','root','server/files/reports','Sequelize','ValidationError','exists','sendStatus','savename','format','%s.%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','set','apply'];(function(_0x3082a4,_0x1a0e46){var _0x42cc2d=function(_0x1ef9d8){while(--_0x1ef9d8){_0x3082a4['push'](_0x3082a4['shift']());}};_0x42cc2d(++_0x1a0e46);}(_0x1c43,0x9c));var _0x31c4=function(_0x1f338f,_0x508d46){_0x1f338f=_0x1f338f-0x0;var _0x875ab5=_0x1c43[_0x1f338f];return _0x875ab5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x31c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31c4('0x2'));var moment=require(_0x31c4('0x3'));var BPromise=require(_0x31c4('0x4'));var Mustache=require(_0x31c4('0x5'));var util=require(_0x31c4('0x6'));var path=require(_0x31c4('0x7'));var sox=require('sox');var csv=require(_0x31c4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x31c4('0x9'));var squel=require('squel');var crypto=require(_0x31c4('0xa'));var jsforce=require(_0x31c4('0xb'));var deskjs=require(_0x31c4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x31c4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x31c4('0xe'));var qs=require(_0x31c4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31c4('0x10'));var logger=require(_0x31c4('0x11'))(_0x31c4('0x12'));var utils=require(_0x31c4('0x13'));var config=require(_0x31c4('0x14'));var db=require(_0x31c4('0x15'))['db'];function respondWithStatusCode(_0x18d59f,_0x4baea2){_0x4baea2=_0x4baea2||0xcc;return function(_0x506cfd){if(_0x506cfd){return _0x18d59f['sendStatus'](_0x4baea2);}return _0x18d59f[_0x31c4('0x16')](_0x4baea2)[_0x31c4('0x17')]();};}function respondWithResult(_0x5d5bae,_0xb99119){_0xb99119=_0xb99119||0xc8;return function(_0x17c9eb){if(_0x17c9eb){return _0x5d5bae['status'](_0xb99119)[_0x31c4('0x18')](_0x17c9eb);}};}function respondWithFilteredResult(_0x571775,_0x29b084){return function(_0x141507){if(_0x141507){var _0x5a9d04=_0x141507[_0x31c4('0x19')],_0x41b2ad=_0x29b084['offset'],_0x159a2b=_0x29b084['offset']+_0x29b084['limit'],_0x1494c0;if(_0x159a2b>=_0x5a9d04){_0x159a2b=_0x5a9d04;_0x1494c0=0xc8;}else{_0x1494c0=0xce;}_0x571775[_0x31c4('0x16')](_0x1494c0);return _0x571775[_0x31c4('0x1a')]('Content-Range',_0x41b2ad+'-'+_0x159a2b+'/'+_0x5a9d04)[_0x31c4('0x18')](_0x141507);}return null;};}function patchUpdates(_0x4abc95){return function(_0x4498b2){try{jsonpatch[_0x31c4('0x1b')](_0x4498b2,_0x4abc95,!![]);}catch(_0x3bc06f){return BPromise[_0x31c4('0x1c')](_0x3bc06f);}return _0x4498b2[_0x31c4('0x1d')]();};}function saveUpdates(_0x280a7e,_0x55ca57){return function(_0x1e1ed5){if(_0x1e1ed5){return _0x1e1ed5['update'](_0x280a7e)['then'](function(_0x41a166){return _0x41a166;});}return null;};}function removeEntity(_0x2cb54e,_0x407135){return function(_0x20ab17){if(_0x20ab17){return _0x20ab17['destroy']()[_0x31c4('0x1e')](function(){var _0x58980d=_0x20ab17[_0x31c4('0x1f')]({'plain':!![]});var _0x31915b='ExtractedReports';return db['UserProfileResource'][_0x31c4('0x20')]({'where':{'type':_0x31915b,'resourceId':_0x58980d['id']}})[_0x31c4('0x1e')](function(){return _0x20ab17;});})[_0x31c4('0x1e')](function(){_0x2cb54e[_0x31c4('0x16')](0xcc)[_0x31c4('0x17')]();});}};}function handleEntityNotFound(_0x419d41,_0x213023){return function(_0x55966f){if(!_0x55966f){_0x419d41['sendStatus'](0x194);}return _0x55966f;};}function handleError(_0x22f91c,_0xb7b58a){_0xb7b58a=_0xb7b58a||0x1f4;return function(_0x1aa9f6){logger['error'](_0x1aa9f6[_0x31c4('0x21')]);if(_0x1aa9f6[_0x31c4('0x22')]){delete _0x1aa9f6['name'];}_0x22f91c[_0x31c4('0x16')](_0xb7b58a)['send'](_0x1aa9f6);};}exports['index']=function(_0x115394,_0x20a14a){var _0x208af9={},_0x1a9dcb={},_0x438751={'count':0x0,'rows':[]};var _0x22b071=_[_0x31c4('0x23')](db[_0x31c4('0x24')][_0x31c4('0x25')],function(_0x18bdbd){return{'name':_0x18bdbd[_0x31c4('0x26')],'type':_0x18bdbd[_0x31c4('0x27')]['key']};});_0x1a9dcb[_0x31c4('0x28')]=_[_0x31c4('0x23')](_0x22b071,_0x31c4('0x22'));_0x1a9dcb['query']=_[_0x31c4('0x29')](_0x115394['query']);_0x1a9dcb[_0x31c4('0x2a')]=_[_0x31c4('0x2b')](_0x1a9dcb['model'],_0x1a9dcb[_0x31c4('0x2c')]);_0x208af9['attributes']=_[_0x31c4('0x2b')](_0x1a9dcb[_0x31c4('0x28')],qs[_0x31c4('0x2d')](_0x115394[_0x31c4('0x2c')][_0x31c4('0x2d')]));_0x208af9[_0x31c4('0x2e')]=_0x208af9['attributes'][_0x31c4('0x2f')]?_0x208af9[_0x31c4('0x2e')]:_0x1a9dcb[_0x31c4('0x28')];if(!_0x115394[_0x31c4('0x2c')][_0x31c4('0x30')](_0x31c4('0x31'))){_0x208af9[_0x31c4('0x32')]=qs[_0x31c4('0x32')](_0x115394[_0x31c4('0x2c')][_0x31c4('0x32')]);_0x208af9[_0x31c4('0x33')]=qs['offset'](_0x115394['query'][_0x31c4('0x33')]);}_0x208af9[_0x31c4('0x34')]=qs['sort'](_0x115394[_0x31c4('0x2c')]['sort']);_0x208af9['where']=qs[_0x31c4('0x2a')](_['pick'](_0x115394[_0x31c4('0x2c')],_0x1a9dcb[_0x31c4('0x2a')]),_0x22b071);if(_0x115394[_0x31c4('0x2c')][_0x31c4('0x35')]){_0x208af9['where']=_[_0x31c4('0x36')](_0x208af9[_0x31c4('0x37')],{'$or':_[_0x31c4('0x23')](_0x22b071,function(_0x2a534f){if(_0x2a534f[_0x31c4('0x27')]!==_0x31c4('0x38')){var _0x167d54={};_0x167d54[_0x2a534f[_0x31c4('0x22')]]={'$like':'%'+_0x115394[_0x31c4('0x2c')][_0x31c4('0x35')]+'%'};return _0x167d54;}})});}_0x208af9=_['merge']({},_0x208af9,_0x115394[_0x31c4('0x39')]);var _0x1e84e7={'where':_0x208af9['where']};return db[_0x31c4('0x24')]['count'](_0x1e84e7)[_0x31c4('0x1e')](function(_0x250077){_0x438751[_0x31c4('0x19')]=_0x250077;if(_0x115394['query'][_0x31c4('0x3a')]){_0x208af9['include']=[{'all':!![]}];}return db[_0x31c4('0x24')][_0x31c4('0x3b')](_0x208af9);})[_0x31c4('0x1e')](function(_0x11f1b1){_0x438751[_0x31c4('0x3c')]=_0x11f1b1;return _0x438751;})[_0x31c4('0x1e')](respondWithFilteredResult(_0x20a14a,_0x208af9))[_0x31c4('0x3d')](handleError(_0x20a14a,null));};exports[_0x31c4('0x3e')]=function(_0x1e4e5a,_0x256591){var _0x2b6999={'raw':!![],'where':{'id':_0x1e4e5a[_0x31c4('0x3f')]['id']}},_0x4839e5={};_0x4839e5[_0x31c4('0x28')]=_[_0x31c4('0x29')](db[_0x31c4('0x24')][_0x31c4('0x25')]);_0x4839e5[_0x31c4('0x2c')]=_[_0x31c4('0x29')](_0x1e4e5a[_0x31c4('0x2c')]);_0x4839e5['filters']=_[_0x31c4('0x2b')](_0x4839e5['model'],_0x4839e5[_0x31c4('0x2c')]);_0x2b6999['attributes']=_[_0x31c4('0x2b')](_0x4839e5['model'],qs[_0x31c4('0x2d')](_0x1e4e5a[_0x31c4('0x2c')][_0x31c4('0x2d')]));_0x2b6999['attributes']=_0x2b6999[_0x31c4('0x2e')][_0x31c4('0x2f')]?_0x2b6999[_0x31c4('0x2e')]:_0x4839e5[_0x31c4('0x28')];if(_0x1e4e5a['query']['includeAll']){_0x2b6999[_0x31c4('0x40')]=[{'all':!![]}];}_0x2b6999=_[_0x31c4('0x36')]({},_0x2b6999,_0x1e4e5a[_0x31c4('0x39')]);return db['AnalyticExtractedReport']['find'](_0x2b6999)[_0x31c4('0x1e')](handleEntityNotFound(_0x256591,null))[_0x31c4('0x1e')](respondWithResult(_0x256591,null))[_0x31c4('0x3d')](handleError(_0x256591,null));};exports[_0x31c4('0x41')]=function(_0x3ef341,_0x1b4319){return db['AnalyticExtractedReport']['create'](_0x3ef341[_0x31c4('0x42')],{})['then'](function(_0x1e1e09){var _0x10662a=_0x3ef341[_0x31c4('0x43')][_0x31c4('0x1f')]({'plain':!![]});if(!_0x10662a)throw new Error(_0x31c4('0x44'));if(_0x10662a[_0x31c4('0x45')]==='user'){var _0x177a5f=_0x1e1e09[_0x31c4('0x1f')]({'plain':!![]});var _0x27d90f=_0x31c4('0x46');return db[_0x31c4('0x47')][_0x31c4('0x48')]({'where':{'name':_0x27d90f,'userProfileId':_0x10662a[_0x31c4('0x49')]},'raw':!![]})[_0x31c4('0x1e')](function(_0x38c4d0){if(_0x38c4d0&&_0x38c4d0[_0x31c4('0x4a')]===0x0){return db[_0x31c4('0x4b')]['create']({'name':_0x177a5f['name'],'resourceId':_0x177a5f['id'],'type':_0x38c4d0[_0x31c4('0x22')],'sectionId':_0x38c4d0['id']},{})['then'](function(){return _0x1e1e09;});}else{return _0x1e1e09;}})[_0x31c4('0x3d')](function(_0x295daa){logger[_0x31c4('0x4c')](_0x31c4('0x4d'),_0x295daa);throw _0x295daa;});}return _0x1e1e09;})['then'](respondWithResult(_0x1b4319,0xc9))['catch'](handleError(_0x1b4319,null));};exports[_0x31c4('0x4e')]=function(_0x58f578,_0x53898f){if(_0x58f578[_0x31c4('0x42')]['id']){delete _0x58f578['body']['id'];}return db['AnalyticExtractedReport'][_0x31c4('0x48')]({'where':{'id':_0x58f578[_0x31c4('0x3f')]['id']}})[_0x31c4('0x1e')](handleEntityNotFound(_0x53898f,null))[_0x31c4('0x1e')](saveUpdates(_0x58f578[_0x31c4('0x42')],null))['then'](respondWithResult(_0x53898f,null))[_0x31c4('0x3d')](handleError(_0x53898f,null));};exports[_0x31c4('0x20')]=function(_0x58bbfa,_0x2360b1){return db[_0x31c4('0x24')][_0x31c4('0x48')]({'where':{'id':_0x58bbfa[_0x31c4('0x3f')]['id']}})[_0x31c4('0x1e')](handleEntityNotFound(_0x2360b1,null))[_0x31c4('0x1e')](removeEntity(_0x2360b1,null))['catch'](handleError(_0x2360b1,null));};exports[_0x31c4('0x4f')]=function(_0x100742,_0x2f792e,_0x4ab4b5){return db[_0x31c4('0x24')]['find']({'where':{'id':_0x100742['params']['id']},'attributes':[_0x31c4('0x22'),_0x31c4('0x50'),'savename',_0x31c4('0x51')],'raw':!![]})[_0x31c4('0x1e')](handleEntityNotFound(_0x2f792e,null))[_0x31c4('0x1e')](function(_0x25ad2c){if(_0x25ad2c){if(!fs['existsSync'](path[_0x31c4('0x52')](config[_0x31c4('0x53')],_0x31c4('0x54'),_0x25ad2c['savename']))){throw new db[(_0x31c4('0x55'))][(_0x31c4('0x56'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x100742[_0x31c4('0x2c')][_0x31c4('0x57')]){return _0x2f792e[_0x31c4('0x58')](0xc8);}return _0x2f792e[_0x31c4('0x4f')](path[_0x31c4('0x52')](config[_0x31c4('0x53')],_0x31c4('0x54'),_0x25ad2c[_0x31c4('0x59')]),util[_0x31c4('0x5a')](_0x31c4('0x5b'),_0x25ad2c['basename']||_0x25ad2c[_0x31c4('0x22')],_0x25ad2c[_0x31c4('0x51')]['toLowerCase']()));}})['catch'](handleError(_0x2f792e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 2cc9c4f..906f421 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 _0xcb3c=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x10d341,_0x57ff35){var _0xddc36d=function(_0x1c24f0){while(--_0x1c24f0){_0x10d341['push'](_0x10d341['shift']());}};_0xddc36d(++_0x57ff35);}(_0xcb3c,0x150));var _0xccb3=function(_0x5e0d12,_0x1a9647){_0x5e0d12=_0x5e0d12-0x0;var _0x9d1d92=_0xcb3c[_0x5e0d12];return _0x9d1d92;};'use strict';var _=require(_0xccb3('0x0'));var util=require(_0xccb3('0x1'));var logger=require(_0xccb3('0x2'))(_0xccb3('0x3'));var moment=require('moment');var BPromise=require(_0xccb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xccb3('0x5'));var rimraf=require('rimraf');var config=require(_0xccb3('0x6'));var attributes=require(_0xccb3('0x7'));module[_0xccb3('0x8')]=function(_0x3c02f3,_0x56eec1){return _0x3c02f3[_0xccb3('0x9')](_0xccb3('0xa'),attributes,{'tableName':_0xccb3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab8=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1ab8,0x173));var _0x81ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1ab8[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x81ab('0x0'));var util=require(_0x81ab('0x1'));var logger=require(_0x81ab('0x2'))('api');var moment=require('moment');var BPromise=require(_0x81ab('0x3'));var rp=require(_0x81ab('0x4'));var fs=require('fs');var path=require(_0x81ab('0x5'));var rimraf=require(_0x81ab('0x6'));var config=require(_0x81ab('0x7'));var attributes=require(_0x81ab('0x8'));module[_0x81ab('0x9')]=function(_0x260d68,_0x5e96ab){return _0x260d68[_0x81ab('0xa')](_0x81ab('0xb'),attributes,{'tableName':_0x81ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 119972b..2260ac1 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 _0x5fa9=['lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0x5fa9,0x6e));var _0x95fa=function(_0x5eb442,_0xe2ae2e){_0x5eb442=_0x5eb442-0x0;var _0x53aad0=_0x5fa9[_0x5eb442];return _0x53aad0;};'use strict';var _=require(_0x95fa('0x0'));var util=require('util');var moment=require(_0x95fa('0x1'));var BPromise=require(_0x95fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95fa('0x3'))['db'];var utils=require(_0x95fa('0x4'));var logger=require(_0x95fa('0x5'))('rpc');var config=require(_0x95fa('0x6'));var jayson=require(_0x95fa('0x7'));var client=jayson[_0x95fa('0x8')][_0x95fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a2e54,_0x42dcb9,_0x3d023d){return new BPromise(function(_0x256ecc,_0x583eb1){return client[_0x95fa('0xa')](_0x3a2e54,_0x3d023d)[_0x95fa('0xb')](function(_0x2ca882){logger['info'](_0x95fa('0xc'),_0x42dcb9,_0x95fa('0xd'));logger[_0x95fa('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x42dcb9,_0x95fa('0xd'),JSON[_0x95fa('0xf')](_0x2ca882));if(_0x2ca882[_0x95fa('0x10')]){if(_0x2ca882['error'][_0x95fa('0x11')]===0x1f4){logger[_0x95fa('0x10')](_0x95fa('0xc'),_0x42dcb9,_0x2ca882[_0x95fa('0x10')]['message']);return _0x583eb1(_0x2ca882[_0x95fa('0x10')][_0x95fa('0x12')]);}logger[_0x95fa('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x42dcb9,_0x2ca882[_0x95fa('0x10')][_0x95fa('0x12')]);return _0x256ecc(_0x2ca882[_0x95fa('0x10')][_0x95fa('0x12')]);}else{logger[_0x95fa('0x13')](_0x95fa('0xc'),_0x42dcb9,_0x95fa('0xd'));_0x256ecc(_0x2ca882[_0x95fa('0x14')][_0x95fa('0x12')]);}})[_0x95fa('0x15')](function(_0xc57748){logger[_0x95fa('0x10')](_0x95fa('0xc'),_0x42dcb9,_0xc57748);_0x583eb1(_0xc57748);});});} \ No newline at end of file +var _0xe288=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x428800,_0x4ae1b5){var _0x2c614c=function(_0x324212){while(--_0x324212){_0x428800['push'](_0x428800['shift']());}};_0x2c614c(++_0x4ae1b5);}(_0xe288,0x1e9));var _0x8e28=function(_0x49b59f,_0x1f3a28){_0x49b59f=_0x49b59f-0x0;var _0x46f0de=_0xe288[_0x49b59f];return _0x46f0de;};'use strict';var _=require(_0x8e28('0x0'));var util=require(_0x8e28('0x1'));var moment=require(_0x8e28('0x2'));var BPromise=require(_0x8e28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e28('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e28('0x5'));var logger=require(_0x8e28('0x6'))('rpc');var config=require(_0x8e28('0x7'));var jayson=require(_0x8e28('0x8'));var client=jayson[_0x8e28('0x9')][_0x8e28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5061d1,_0x65ec69,_0x2451fb){return new BPromise(function(_0xdb8bdf,_0x2c9a77){return client[_0x8e28('0xb')](_0x5061d1,_0x2451fb)[_0x8e28('0xc')](function(_0x10861f){logger[_0x8e28('0xd')](_0x8e28('0xe'),_0x65ec69,'request\x20sent');logger[_0x8e28('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x65ec69,_0x8e28('0x10'),JSON[_0x8e28('0x11')](_0x10861f));if(_0x10861f[_0x8e28('0x12')]){if(_0x10861f['error'][_0x8e28('0x13')]===0x1f4){logger[_0x8e28('0x12')](_0x8e28('0xe'),_0x65ec69,_0x10861f[_0x8e28('0x12')][_0x8e28('0x14')]);return _0x2c9a77(_0x10861f['error'][_0x8e28('0x14')]);}logger['error'](_0x8e28('0xe'),_0x65ec69,_0x10861f[_0x8e28('0x12')]['message']);return _0xdb8bdf(_0x10861f[_0x8e28('0x12')]['message']);}else{logger[_0x8e28('0xd')](_0x8e28('0xe'),_0x65ec69,_0x8e28('0x10'));_0xdb8bdf(_0x10861f[_0x8e28('0x15')][_0x8e28('0x14')]);}})[_0x8e28('0x16')](function(_0x1a7f75){logger[_0x8e28('0x12')](_0x8e28('0xe'),_0x65ec69,_0x1a7f75);_0x2c9a77(_0x1a7f75);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d35e572..a60666b 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 _0x2821=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','post','create','put'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2821,0x87));var _0x1282=function(_0x16de8c,_0x14386c){_0x16de8c=_0x16de8c-0x0;var _0xe111df=_0x2821[_0x16de8c];return _0xe111df;};'use strict';var multer=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var path=require(_0x1282('0x2'));var timeout=require(_0x1282('0x3'));var express=require(_0x1282('0x4'));var router=express[_0x1282('0x5')]();var auth=require(_0x1282('0x6'));var interaction=require(_0x1282('0x7'));var config=require(_0x1282('0x8'));var controller=require(_0x1282('0x9'));router[_0x1282('0xa')]('/',auth['isAuthenticated'](),controller[_0x1282('0xb')]);router[_0x1282('0xa')](_0x1282('0xc'),auth[_0x1282('0xd')](),controller[_0x1282('0xe')]);router[_0x1282('0xa')](_0x1282('0xf'),auth[_0x1282('0xd')](),controller['download']);router[_0x1282('0x10')]('/',auth[_0x1282('0xd')](),controller[_0x1282('0x11')]);router[_0x1282('0x12')](_0x1282('0xc'),auth['isAuthenticated'](),controller[_0x1282('0x13')]);router[_0x1282('0x14')]('/:id',auth[_0x1282('0xd')](),controller[_0x1282('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7235=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x7235,0x77));var _0x5723=function(_0x272b72,_0x263a86){_0x272b72=_0x272b72-0x0;var _0xdfda4d=_0x7235[_0x272b72];return _0xdfda4d;};'use strict';var multer=require(_0x5723('0x0'));var util=require(_0x5723('0x1'));var path=require(_0x5723('0x2'));var timeout=require(_0x5723('0x3'));var express=require('express');var router=express[_0x5723('0x4')]();var auth=require(_0x5723('0x5'));var interaction=require(_0x5723('0x6'));var config=require(_0x5723('0x7'));var controller=require(_0x5723('0x8'));router[_0x5723('0x9')]('/',auth[_0x5723('0xa')](),controller[_0x5723('0xb')]);router[_0x5723('0x9')](_0x5723('0xc'),auth[_0x5723('0xa')](),controller[_0x5723('0xd')]);router[_0x5723('0x9')](_0x5723('0xe'),auth[_0x5723('0xa')](),controller[_0x5723('0xf')]);router[_0x5723('0x10')]('/',auth['isAuthenticated'](),controller[_0x5723('0x11')]);router[_0x5723('0x12')](_0x5723('0xc'),auth['isAuthenticated'](),controller[_0x5723('0x13')]);router[_0x5723('0x14')](_0x5723('0xc'),auth[_0x5723('0xa')](),controller[_0x5723('0x15')]);module[_0x5723('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c4c2139..6378bef 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x189de6,_0x225aae){var _0x612ae3=function(_0x1d6a2e){while(--_0x1d6a2e){_0x189de6['push'](_0x189de6['shift']());}};_0x612ae3(++_0x225aae);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x161fd2,_0x130510){var _0x164182=function(_0x505a92){while(--_0x505a92){_0x161fd2['push'](_0x161fd2['shift']());}};_0x164182(++_0x130510);}(_0x7a54,0x106));var _0x47a5=function(_0x31101e,_0x4368c3){_0x31101e=_0x31101e-0x0;var _0x20afa0=_0x7a54[_0x31101e];return _0x20afa0;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7755e43..1d84b2e 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 _0x0773=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','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','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','include','find','catch','create','bulkCreate','body','bulkDestroy','addFields','findOne','sequelize','transaction','CustomReportId','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0773,0xa1));var _0x3077=function(_0x1dcea9,_0x16e207){_0x1dcea9=_0x1dcea9-0x0;var _0x8d4f0b=_0x0773[_0x1dcea9];return _0x8d4f0b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3077('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3077('0x1'));var jsonpatch=require(_0x3077('0x2'));var rp=require('request-promise');var moment=require(_0x3077('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3077('0x4'));var util=require(_0x3077('0x5'));var path=require(_0x3077('0x6'));var sox=require(_0x3077('0x7'));var csv=require(_0x3077('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3077('0x9'));var squel=require(_0x3077('0xa'));var crypto=require(_0x3077('0xb'));var jsforce=require(_0x3077('0xc'));var deskjs=require(_0x3077('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3077('0xe'));var Papa=require(_0x3077('0xf'));var Redis=require('ioredis');var authService=require(_0x3077('0x10'));var qs=require(_0x3077('0x11'));var as=require(_0x3077('0x12'));var hardwareService=require(_0x3077('0x13'));var logger=require(_0x3077('0x14'))(_0x3077('0x15'));var utils=require(_0x3077('0x16'));var config=require(_0x3077('0x17'));var db=require(_0x3077('0x18'))['db'];function respondWithStatusCode(_0x468a31,_0x157267){_0x157267=_0x157267||0xcc;return function(_0x3280f0){if(_0x3280f0){return _0x468a31[_0x3077('0x19')](_0x157267);}return _0x468a31[_0x3077('0x1a')](_0x157267)['end']();};}function respondWithResult(_0x39a275,_0x83a5f5){_0x83a5f5=_0x83a5f5||0xc8;return function(_0xfb0580){if(_0xfb0580){return _0x39a275['status'](_0x83a5f5)[_0x3077('0x1b')](_0xfb0580);}};}function respondWithFilteredResult(_0x24cad1,_0xb9caea){return function(_0x46583d){if(_0x46583d){var _0x59e8aa=_0x46583d[_0x3077('0x1c')],_0x2a039b=_0xb9caea[_0x3077('0x1d')],_0x46c3ea=_0xb9caea[_0x3077('0x1d')]+_0xb9caea[_0x3077('0x1e')],_0x549ed2;if(_0x46c3ea>=_0x59e8aa){_0x46c3ea=_0x59e8aa;_0x549ed2=0xc8;}else{_0x549ed2=0xce;}_0x24cad1[_0x3077('0x1a')](_0x549ed2);return _0x24cad1['set'](_0x3077('0x1f'),_0x2a039b+'-'+_0x46c3ea+'/'+_0x59e8aa)[_0x3077('0x1b')](_0x46583d);}return null;};}function patchUpdates(_0xffacee){return function(_0x1ee9a6){try{jsonpatch[_0x3077('0x20')](_0x1ee9a6,_0xffacee,!![]);}catch(_0x44390b){return BPromise[_0x3077('0x21')](_0x44390b);}return _0x1ee9a6[_0x3077('0x22')]();};}function saveUpdates(_0x5c3b6d,_0x2df1fb){return function(_0xac516d){if(_0xac516d){return _0xac516d[_0x3077('0x23')](_0x5c3b6d)[_0x3077('0x24')](function(_0x573666){return _0x573666;});}return null;};}function removeEntity(_0x4f66dd,_0x17fc77){return function(_0x143993){if(_0x143993){return _0x143993[_0x3077('0x25')]()[_0x3077('0x24')](function(){_0x4f66dd[_0x3077('0x1a')](0xcc)[_0x3077('0x26')]();});}};}function handleEntityNotFound(_0x4982aa,_0x31e581){return function(_0x9292f7){if(!_0x9292f7){_0x4982aa['sendStatus'](0x194);}return _0x9292f7;};}function handleError(_0x4e99a6,_0x5ce7db){_0x5ce7db=_0x5ce7db||0x1f4;return function(_0x3bf388){logger[_0x3077('0x27')](_0x3bf388[_0x3077('0x28')]);if(_0x3bf388['name']){delete _0x3bf388[_0x3077('0x29')];}_0x4e99a6['status'](_0x5ce7db)[_0x3077('0x2a')](_0x3bf388);};}exports[_0x3077('0x2b')]=function(_0x5ee2fa,_0x1e1d8b){var _0x54c0d4={},_0x4adbc8={},_0x11283b={'count':0x0,'rows':[]};var _0x218e16=_[_0x3077('0x2c')](db[_0x3077('0x2d')][_0x3077('0x2e')],function(_0x28a343){return{'name':_0x28a343['fieldName'],'type':_0x28a343[_0x3077('0x2f')]['key']};});_0x4adbc8[_0x3077('0x30')]=_[_0x3077('0x2c')](_0x218e16,'name');_0x4adbc8[_0x3077('0x31')]=_['keys'](_0x5ee2fa[_0x3077('0x31')]);_0x4adbc8['filters']=_[_0x3077('0x32')](_0x4adbc8[_0x3077('0x30')],_0x4adbc8[_0x3077('0x31')]);_0x54c0d4[_0x3077('0x33')]=_['intersection'](_0x4adbc8[_0x3077('0x30')],qs[_0x3077('0x34')](_0x5ee2fa[_0x3077('0x31')][_0x3077('0x34')]));_0x54c0d4[_0x3077('0x33')]=_0x54c0d4[_0x3077('0x33')][_0x3077('0x35')]?_0x54c0d4[_0x3077('0x33')]:_0x4adbc8['model'];if(!_0x5ee2fa[_0x3077('0x31')][_0x3077('0x36')](_0x3077('0x37'))){_0x54c0d4[_0x3077('0x1e')]=qs['limit'](_0x5ee2fa['query'][_0x3077('0x1e')]);_0x54c0d4[_0x3077('0x1d')]=qs['offset'](_0x5ee2fa['query'][_0x3077('0x1d')]);}_0x54c0d4['order']=qs[_0x3077('0x38')](_0x5ee2fa[_0x3077('0x31')][_0x3077('0x38')]);_0x54c0d4[_0x3077('0x39')]=qs[_0x3077('0x3a')](_[_0x3077('0x3b')](_0x5ee2fa[_0x3077('0x31')],_0x4adbc8['filters']),_0x218e16);if(_0x5ee2fa[_0x3077('0x31')][_0x3077('0x3c')]){_0x54c0d4['where']=_[_0x3077('0x3d')](_0x54c0d4[_0x3077('0x39')],{'$or':_[_0x3077('0x2c')](_0x218e16,function(_0x388274){if(_0x388274[_0x3077('0x2f')]!==_0x3077('0x3e')){var _0x507913={};_0x507913[_0x388274['name']]={'$like':'%'+_0x5ee2fa['query']['filter']+'%'};return _0x507913;}})});}_0x54c0d4=_[_0x3077('0x3d')]({},_0x54c0d4,_0x5ee2fa[_0x3077('0x3f')]);var _0x5eff83={'where':_0x54c0d4[_0x3077('0x39')]};return db[_0x3077('0x2d')][_0x3077('0x1c')](_0x5eff83)[_0x3077('0x24')](function(_0x2af8fa){_0x11283b[_0x3077('0x1c')]=_0x2af8fa;if(_0x5ee2fa['query']['includeAll']){_0x54c0d4['include']=[{'all':!![]}];}return db[_0x3077('0x2d')][_0x3077('0x40')](_0x54c0d4);})[_0x3077('0x24')](function(_0x24ea09){_0x11283b[_0x3077('0x41')]=_0x24ea09;return _0x11283b;})[_0x3077('0x24')](respondWithFilteredResult(_0x1e1d8b,_0x54c0d4))['catch'](handleError(_0x1e1d8b,null));};exports[_0x3077('0x42')]=function(_0x4b4232,_0x2c2eaf){var _0x147650={'raw':![],'where':{'id':_0x4b4232[_0x3077('0x43')]['id']}},_0x41ab7c={};_0x41ab7c[_0x3077('0x30')]=_['keys'](db[_0x3077('0x2d')][_0x3077('0x2e')]);_0x41ab7c[_0x3077('0x31')]=_[_0x3077('0x44')](_0x4b4232[_0x3077('0x31')]);_0x41ab7c[_0x3077('0x3a')]=_[_0x3077('0x32')](_0x41ab7c['model'],_0x41ab7c[_0x3077('0x31')]);_0x147650[_0x3077('0x33')]=_[_0x3077('0x32')](_0x41ab7c['model'],qs[_0x3077('0x34')](_0x4b4232[_0x3077('0x31')][_0x3077('0x34')]));_0x147650[_0x3077('0x33')]=_0x147650[_0x3077('0x33')][_0x3077('0x35')]?_0x147650[_0x3077('0x33')]:_0x41ab7c['model'];if(_0x4b4232[_0x3077('0x31')]['includeAll']){_0x147650[_0x3077('0x45')]=[{'all':!![]}];}_0x147650=_[_0x3077('0x3d')]({},_0x147650,_0x4b4232[_0x3077('0x3f')]);return db[_0x3077('0x2d')][_0x3077('0x46')](_0x147650)[_0x3077('0x24')](handleEntityNotFound(_0x2c2eaf,null))[_0x3077('0x24')](respondWithResult(_0x2c2eaf,null))[_0x3077('0x47')](handleError(_0x2c2eaf,null));};exports['create']=function(_0x247b5f,_0x4a88f6){return db['AnalyticFieldReport'][_0x3077('0x48')](_0x247b5f['body'],{})[_0x3077('0x24')](respondWithResult(_0x4a88f6,0xc9))['catch'](handleError(_0x4a88f6,null));};exports[_0x3077('0x49')]=function(_0x57b236,_0x504398){return db[_0x3077('0x2d')]['bulkCreate'](_0x57b236[_0x3077('0x4a')],{'raw':![],'individualHooks':!![]})[_0x3077('0x24')](respondWithResult(_0x504398,0xc9))[_0x3077('0x47')](handleError(_0x504398,null));};exports['update']=function(_0x3f9cc9,_0x353251){if(_0x3f9cc9['body']['id']){delete _0x3f9cc9['body']['id'];}return db[_0x3077('0x2d')][_0x3077('0x46')]({'where':{'id':_0x3f9cc9[_0x3077('0x43')]['id']}})['then'](handleEntityNotFound(_0x353251,null))[_0x3077('0x24')](saveUpdates(_0x3f9cc9['body'],null))['then'](respondWithResult(_0x353251,null))[_0x3077('0x47')](handleError(_0x353251,null));};exports[_0x3077('0x25')]=function(_0x390869,_0x5dd783){return db[_0x3077('0x2d')][_0x3077('0x46')]({'where':{'id':_0x390869[_0x3077('0x43')]['id']}})['then'](handleEntityNotFound(_0x5dd783,null))['then'](removeEntity(_0x5dd783,null))[_0x3077('0x47')](handleError(_0x5dd783,null));};exports[_0x3077('0x4b')]=function(_0x699dde,_0x3d41b8){return db[_0x3077('0x2d')]['destroy']({'where':{'id':_0x699dde['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x3077('0x24')](respondWithResult(_0x3d41b8,0xcc))['catch'](handleError(_0x3d41b8,null));};exports[_0x3077('0x4c')]=function(_0x10b699,_0x749575,_0x1287c4){return db['AnalyticCustomReport'][_0x3077('0x4d')]({'where':{'id':_0x10b699[_0x3077('0x43')]['id']}})[_0x3077('0x24')](handleEntityNotFound(_0x749575,null))[_0x3077('0x24')](function(_0x3471ae){if(_0x3471ae){return db[_0x3077('0x4e')][_0x3077('0x4f')](function(_0x57be9a){return db[_0x3077('0x2d')]['destroy']({'where':{'CustomReportId':_0x10b699[_0x3077('0x43')]['id']},'transaction':_0x57be9a})[_0x3077('0x24')](function(_0x599b32){var _0x485e6a=_[_0x3077('0x2c')](_0x10b699[_0x3077('0x4a')],function(_0x3fb6b6){delete _0x3fb6b6['id'];_0x3fb6b6[_0x3077('0x50')]=_0x10b699[_0x3077('0x43')]['id'];return _0x3fb6b6;});return db[_0x3077('0x2d')][_0x3077('0x49')](_0x485e6a,{'transaction':_0x57be9a});});})[_0x3077('0x24')](function(){return db['AnalyticFieldReport'][_0x3077('0x40')]({'where':{'CustomReportId':_0x10b699['params']['id']}});});}})['then'](respondWithResult(_0x749575,null))[_0x3077('0x47')](handleError(_0x749575,null));}; \ No newline at end of file +var _0x5db6=['../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','AnalyticFieldReport','includeAll','rows','catch','show','fields','include','find','create','bulkCreate','body','update','params','destroy','bulkDestroy','findOne','sequelize','transaction','CustomReportId','findAll','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x4b7fdc,_0x3e29ce){var _0x32a791=function(_0x387c32){while(--_0x387c32){_0x4b7fdc['push'](_0x4b7fdc['shift']());}};_0x32a791(++_0x3e29ce);}(_0x5db6,0x88));var _0x65db=function(_0xcf807,_0x4c736b){_0xcf807=_0xcf807-0x0;var _0x2ef9e9=_0x5db6[_0xcf807];return _0x2ef9e9;};'use strict';var pdf=require(_0x65db('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65db('0x1'));var moment=require(_0x65db('0x2'));var BPromise=require(_0x65db('0x3'));var Mustache=require(_0x65db('0x4'));var util=require(_0x65db('0x5'));var path=require(_0x65db('0x6'));var sox=require(_0x65db('0x7'));var csv=require(_0x65db('0x8'));var ejs=require(_0x65db('0x9'));var fs=require('fs');var _=require(_0x65db('0xa'));var squel=require(_0x65db('0xb'));var crypto=require(_0x65db('0xc'));var jsforce=require(_0x65db('0xd'));var deskjs=require(_0x65db('0xe'));var toCsv=require(_0x65db('0x8'));var querystring=require(_0x65db('0xf'));var Papa=require(_0x65db('0x10'));var Redis=require(_0x65db('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x65db('0x12'));var as=require(_0x65db('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x65db('0x14'));var utils=require(_0x65db('0x15'));var config=require(_0x65db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37a6f7,_0x3e994a){_0x3e994a=_0x3e994a||0xcc;return function(_0x17c929){if(_0x17c929){return _0x37a6f7['sendStatus'](_0x3e994a);}return _0x37a6f7[_0x65db('0x17')](_0x3e994a)['end']();};}function respondWithResult(_0x2ffc30,_0x419602){_0x419602=_0x419602||0xc8;return function(_0x488cf0){if(_0x488cf0){return _0x2ffc30[_0x65db('0x17')](_0x419602)[_0x65db('0x18')](_0x488cf0);}};}function respondWithFilteredResult(_0x472e28,_0x32c985){return function(_0x2c6c3f){if(_0x2c6c3f){var _0x424af1=_0x2c6c3f[_0x65db('0x19')],_0x22ab95=_0x32c985['offset'],_0x30fcf8=_0x32c985[_0x65db('0x1a')]+_0x32c985[_0x65db('0x1b')],_0x374f4d;if(_0x30fcf8>=_0x424af1){_0x30fcf8=_0x424af1;_0x374f4d=0xc8;}else{_0x374f4d=0xce;}_0x472e28[_0x65db('0x17')](_0x374f4d);return _0x472e28[_0x65db('0x1c')](_0x65db('0x1d'),_0x22ab95+'-'+_0x30fcf8+'/'+_0x424af1)[_0x65db('0x18')](_0x2c6c3f);}return null;};}function patchUpdates(_0x83c0d){return function(_0x2c4137){try{jsonpatch[_0x65db('0x1e')](_0x2c4137,_0x83c0d,!![]);}catch(_0x39fe17){return BPromise[_0x65db('0x1f')](_0x39fe17);}return _0x2c4137[_0x65db('0x20')]();};}function saveUpdates(_0x21142c,_0x16a635){return function(_0x4fb336){if(_0x4fb336){return _0x4fb336['update'](_0x21142c)[_0x65db('0x21')](function(_0x59cc7f){return _0x59cc7f;});}return null;};}function removeEntity(_0x35c0c4,_0x976d53){return function(_0x97ce7e){if(_0x97ce7e){return _0x97ce7e['destroy']()[_0x65db('0x21')](function(){_0x35c0c4[_0x65db('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x175733,_0x175da5){return function(_0x2d0dcb){if(!_0x2d0dcb){_0x175733[_0x65db('0x22')](0x194);}return _0x2d0dcb;};}function handleError(_0x19aff2,_0x2e2d1d){_0x2e2d1d=_0x2e2d1d||0x1f4;return function(_0x18a79b){logger['error'](_0x18a79b[_0x65db('0x23')]);if(_0x18a79b[_0x65db('0x24')]){delete _0x18a79b['name'];}_0x19aff2[_0x65db('0x17')](_0x2e2d1d)[_0x65db('0x25')](_0x18a79b);};}exports[_0x65db('0x26')]=function(_0x144268,_0x4416ef){var _0x4be47f={},_0x733e08={},_0x5a8277={'count':0x0,'rows':[]};var _0x5f34f2=_['map'](db['AnalyticFieldReport'][_0x65db('0x27')],function(_0x17482c){return{'name':_0x17482c[_0x65db('0x28')],'type':_0x17482c['type']['key']};});_0x733e08[_0x65db('0x29')]=_[_0x65db('0x2a')](_0x5f34f2,_0x65db('0x24'));_0x733e08[_0x65db('0x2b')]=_[_0x65db('0x2c')](_0x144268[_0x65db('0x2b')]);_0x733e08[_0x65db('0x2d')]=_[_0x65db('0x2e')](_0x733e08[_0x65db('0x29')],_0x733e08['query']);_0x4be47f['attributes']=_['intersection'](_0x733e08[_0x65db('0x29')],qs['fields'](_0x144268['query']['fields']));_0x4be47f['attributes']=_0x4be47f[_0x65db('0x2f')][_0x65db('0x30')]?_0x4be47f[_0x65db('0x2f')]:_0x733e08[_0x65db('0x29')];if(!_0x144268['query'][_0x65db('0x31')](_0x65db('0x32'))){_0x4be47f['limit']=qs[_0x65db('0x1b')](_0x144268[_0x65db('0x2b')][_0x65db('0x1b')]);_0x4be47f[_0x65db('0x1a')]=qs['offset'](_0x144268[_0x65db('0x2b')][_0x65db('0x1a')]);}_0x4be47f[_0x65db('0x33')]=qs[_0x65db('0x34')](_0x144268[_0x65db('0x2b')]['sort']);_0x4be47f[_0x65db('0x35')]=qs[_0x65db('0x2d')](_[_0x65db('0x36')](_0x144268[_0x65db('0x2b')],_0x733e08[_0x65db('0x2d')]),_0x5f34f2);if(_0x144268['query'][_0x65db('0x37')]){_0x4be47f[_0x65db('0x35')]=_['merge'](_0x4be47f[_0x65db('0x35')],{'$or':_['map'](_0x5f34f2,function(_0x110729){if(_0x110729[_0x65db('0x38')]!=='VIRTUAL'){var _0xfe7519={};_0xfe7519[_0x110729[_0x65db('0x24')]]={'$like':'%'+_0x144268[_0x65db('0x2b')][_0x65db('0x37')]+'%'};return _0xfe7519;}})});}_0x4be47f=_[_0x65db('0x39')]({},_0x4be47f,_0x144268[_0x65db('0x3a')]);var _0x5ee82f={'where':_0x4be47f[_0x65db('0x35')]};return db[_0x65db('0x3b')][_0x65db('0x19')](_0x5ee82f)[_0x65db('0x21')](function(_0x1ab691){_0x5a8277[_0x65db('0x19')]=_0x1ab691;if(_0x144268[_0x65db('0x2b')][_0x65db('0x3c')]){_0x4be47f['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x4be47f);})[_0x65db('0x21')](function(_0x368077){_0x5a8277[_0x65db('0x3d')]=_0x368077;return _0x5a8277;})[_0x65db('0x21')](respondWithFilteredResult(_0x4416ef,_0x4be47f))[_0x65db('0x3e')](handleError(_0x4416ef,null));};exports[_0x65db('0x3f')]=function(_0x386b07,_0x564591){var _0x5d9b25={'raw':![],'where':{'id':_0x386b07['params']['id']}},_0x2c8326={};_0x2c8326['model']=_[_0x65db('0x2c')](db[_0x65db('0x3b')][_0x65db('0x27')]);_0x2c8326[_0x65db('0x2b')]=_['keys'](_0x386b07['query']);_0x2c8326['filters']=_[_0x65db('0x2e')](_0x2c8326['model'],_0x2c8326[_0x65db('0x2b')]);_0x5d9b25[_0x65db('0x2f')]=_[_0x65db('0x2e')](_0x2c8326[_0x65db('0x29')],qs['fields'](_0x386b07['query'][_0x65db('0x40')]));_0x5d9b25['attributes']=_0x5d9b25[_0x65db('0x2f')][_0x65db('0x30')]?_0x5d9b25['attributes']:_0x2c8326[_0x65db('0x29')];if(_0x386b07['query'][_0x65db('0x3c')]){_0x5d9b25[_0x65db('0x41')]=[{'all':!![]}];}_0x5d9b25=_[_0x65db('0x39')]({},_0x5d9b25,_0x386b07['options']);return db[_0x65db('0x3b')][_0x65db('0x42')](_0x5d9b25)[_0x65db('0x21')](handleEntityNotFound(_0x564591,null))['then'](respondWithResult(_0x564591,null))['catch'](handleError(_0x564591,null));};exports['create']=function(_0x4a6e28,_0xa90472){return db['AnalyticFieldReport'][_0x65db('0x43')](_0x4a6e28['body'],{})[_0x65db('0x21')](respondWithResult(_0xa90472,0xc9))[_0x65db('0x3e')](handleError(_0xa90472,null));};exports[_0x65db('0x44')]=function(_0x74fd96,_0x3dedad){return db[_0x65db('0x3b')]['bulkCreate'](_0x74fd96[_0x65db('0x45')],{'raw':![],'individualHooks':!![]})[_0x65db('0x21')](respondWithResult(_0x3dedad,0xc9))[_0x65db('0x3e')](handleError(_0x3dedad,null));};exports[_0x65db('0x46')]=function(_0x5a27ec,_0x5a9608){if(_0x5a27ec[_0x65db('0x45')]['id']){delete _0x5a27ec[_0x65db('0x45')]['id'];}return db[_0x65db('0x3b')][_0x65db('0x42')]({'where':{'id':_0x5a27ec[_0x65db('0x47')]['id']}})[_0x65db('0x21')](handleEntityNotFound(_0x5a9608,null))[_0x65db('0x21')](saveUpdates(_0x5a27ec[_0x65db('0x45')],null))[_0x65db('0x21')](respondWithResult(_0x5a9608,null))[_0x65db('0x3e')](handleError(_0x5a9608,null));};exports[_0x65db('0x48')]=function(_0x19fb1d,_0x5813ce){return db[_0x65db('0x3b')]['find']({'where':{'id':_0x19fb1d[_0x65db('0x47')]['id']}})['then'](handleEntityNotFound(_0x5813ce,null))[_0x65db('0x21')](removeEntity(_0x5813ce,null))[_0x65db('0x3e')](handleError(_0x5813ce,null));};exports[_0x65db('0x49')]=function(_0x4c060d,_0x3f1c30){return db[_0x65db('0x3b')][_0x65db('0x48')]({'where':{'id':_0x4c060d[_0x65db('0x2b')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x65db('0x21')](respondWithResult(_0x3f1c30,0xcc))[_0x65db('0x3e')](handleError(_0x3f1c30,null));};exports['addFields']=function(_0x250226,_0x405d5a,_0x5be339){return db['AnalyticCustomReport'][_0x65db('0x4a')]({'where':{'id':_0x250226['params']['id']}})['then'](handleEntityNotFound(_0x405d5a,null))[_0x65db('0x21')](function(_0x5bd2f1){if(_0x5bd2f1){return db[_0x65db('0x4b')][_0x65db('0x4c')](function(_0x342ad6){return db[_0x65db('0x3b')][_0x65db('0x48')]({'where':{'CustomReportId':_0x250226[_0x65db('0x47')]['id']},'transaction':_0x342ad6})[_0x65db('0x21')](function(_0x3bff7f){var _0x145467=_[_0x65db('0x2a')](_0x250226[_0x65db('0x45')],function(_0x1d756d){delete _0x1d756d['id'];_0x1d756d[_0x65db('0x4d')]=_0x250226[_0x65db('0x47')]['id'];return _0x1d756d;});return db[_0x65db('0x3b')][_0x65db('0x44')](_0x145467,{'transaction':_0x342ad6});});})[_0x65db('0x21')](function(){return db[_0x65db('0x3b')][_0x65db('0x4e')]({'where':{'CustomReportId':_0x250226['params']['id']}});});}})[_0x65db('0x21')](respondWithResult(_0x405d5a,null))[_0x65db('0x3e')](handleError(_0x405d5a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6c5b6c0..d4114eb 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 _0x3176=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','analytics_report_fields','lodash','util'];(function(_0x5e987a,_0x1970a0){var _0x16d654=function(_0x2562ae){while(--_0x2562ae){_0x5e987a['push'](_0x5e987a['shift']());}};_0x16d654(++_0x1970a0);}(_0x3176,0x152));var _0x6317=function(_0x535f29,_0x3e9437){_0x535f29=_0x535f29-0x0;var _0x3e77ed=_0x3176[_0x535f29];return _0x3e77ed;};'use strict';var _=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6317('0x2'));var rp=require(_0x6317('0x3'));var fs=require('fs');var path=require(_0x6317('0x4'));var rimraf=require(_0x6317('0x5'));var config=require(_0x6317('0x6'));var attributes=require(_0x6317('0x7'));module[_0x6317('0x8')]=function(_0x4fe3d0,_0x30f82d){return _0x4fe3d0['define']('AnalyticFieldReport',attributes,{'tableName':_0x6317('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c67=['analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','AnalyticFieldReport'];(function(_0x133cb5,_0x606cc2){var _0x415d1a=function(_0x1227d0){while(--_0x1227d0){_0x133cb5['push'](_0x133cb5['shift']());}};_0x415d1a(++_0x606cc2);}(_0x7c67,0x1b1));var _0x77c6=function(_0x2e3ebf,_0x1dbfff){_0x2e3ebf=_0x2e3ebf-0x0;var _0x529402=_0x7c67[_0x2e3ebf];return _0x529402;};'use strict';var _=require(_0x77c6('0x0'));var util=require(_0x77c6('0x1'));var logger=require(_0x77c6('0x2'))(_0x77c6('0x3'));var moment=require('moment');var BPromise=require(_0x77c6('0x4'));var rp=require(_0x77c6('0x5'));var fs=require('fs');var path=require(_0x77c6('0x6'));var rimraf=require(_0x77c6('0x7'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x77c6('0x8')]=function(_0x55917c,_0x21bdb9){return _0x55917c[_0x77c6('0x9')](_0x77c6('0xa'),attributes,{'tableName':_0x77c6('0xb'),'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 e3c2b51..33e0aa4 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 _0x7037=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x7037,0x1eb));var _0x7703=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7037[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x7703('0x0'));var util=require(_0x7703('0x1'));var moment=require(_0x7703('0x2'));var BPromise=require(_0x7703('0x3'));var rs=require(_0x7703('0x4'));var fs=require('fs');var Redis=require(_0x7703('0x5'));var db=require(_0x7703('0x6'))['db'];var utils=require(_0x7703('0x7'));var logger=require(_0x7703('0x8'))(_0x7703('0x9'));var config=require(_0x7703('0xa'));var jayson=require(_0x7703('0xb'));var client=jayson[_0x7703('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c85f,_0x14bf29,_0x2bc8b3){return new BPromise(function(_0x588dcf,_0x2cbd16){return client[_0x7703('0xd')](_0x42c85f,_0x2bc8b3)[_0x7703('0xe')](function(_0x379abd){logger[_0x7703('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x14bf29,_0x7703('0x10'));logger[_0x7703('0x11')](_0x7703('0x12'),_0x14bf29,_0x7703('0x10'),JSON[_0x7703('0x13')](_0x379abd));if(_0x379abd[_0x7703('0x14')]){if(_0x379abd[_0x7703('0x14')][_0x7703('0x15')]===0x1f4){logger[_0x7703('0x14')](_0x7703('0x16'),_0x14bf29,_0x379abd[_0x7703('0x14')]['message']);return _0x2cbd16(_0x379abd[_0x7703('0x14')][_0x7703('0x17')]);}logger[_0x7703('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x14bf29,_0x379abd[_0x7703('0x14')][_0x7703('0x17')]);return _0x588dcf(_0x379abd['error'][_0x7703('0x17')]);}else{logger[_0x7703('0xf')](_0x7703('0x16'),_0x14bf29,'request\x20sent');_0x588dcf(_0x379abd['result'][_0x7703('0x17')]);}})[_0x7703('0x18')](function(_0x328e21){logger[_0x7703('0x14')](_0x7703('0x16'),_0x14bf29,_0x328e21);_0x2cbd16(_0x328e21);});});} \ No newline at end of file +var _0x97ce=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x97ce,0x1b1));var _0xe97c=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x97ce[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0xe97c('0x0'));var moment=require('moment');var BPromise=require(_0xe97c('0x1'));var rs=require(_0xe97c('0x2'));var fs=require('fs');var Redis=require(_0xe97c('0x3'));var db=require(_0xe97c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe97c('0x5'))(_0xe97c('0x6'));var config=require(_0xe97c('0x7'));var jayson=require(_0xe97c('0x8'));var client=jayson[_0xe97c('0x9')][_0xe97c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f803e,_0x1e8e2a,_0x57e7c6){return new BPromise(function(_0x309406,_0x55f6ff){return client[_0xe97c('0xb')](_0x3f803e,_0x57e7c6)[_0xe97c('0xc')](function(_0x1b0fb6){logger[_0xe97c('0xd')](_0xe97c('0xe'),_0x1e8e2a,_0xe97c('0xf'));logger[_0xe97c('0x10')](_0xe97c('0x11'),_0x1e8e2a,_0xe97c('0xf'),JSON[_0xe97c('0x12')](_0x1b0fb6));if(_0x1b0fb6[_0xe97c('0x13')]){if(_0x1b0fb6[_0xe97c('0x13')]['code']===0x1f4){logger[_0xe97c('0x13')](_0xe97c('0xe'),_0x1e8e2a,_0x1b0fb6[_0xe97c('0x13')][_0xe97c('0x14')]);return _0x55f6ff(_0x1b0fb6[_0xe97c('0x13')][_0xe97c('0x14')]);}logger[_0xe97c('0x13')](_0xe97c('0xe'),_0x1e8e2a,_0x1b0fb6[_0xe97c('0x13')]['message']);return _0x309406(_0x1b0fb6[_0xe97c('0x13')][_0xe97c('0x14')]);}else{logger[_0xe97c('0xd')](_0xe97c('0xe'),_0x1e8e2a,_0xe97c('0xf'));_0x309406(_0x1b0fb6[_0xe97c('0x15')][_0xe97c('0x14')]);}})[_0xe97c('0x16')](function(_0x52076d){logger[_0xe97c('0x13')](_0xe97c('0xe'),_0x1e8e2a,_0x52076d);_0x55f6ff(_0x52076d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3cf906c..bad524b 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 _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x7f6bc8,_0x98c3bf){var _0xb899c7=function(_0x334535){while(--_0x334535){_0x7f6bc8['push'](_0x7f6bc8['shift']());}};_0xb899c7(++_0x98c3bf);}(_0x3e74,0x175));var _0x43e7=function(_0x3b2992,_0x3e38e8){_0x3b2992=_0x3b2992-0x0;var _0x5f0713=_0x3e74[_0x3b2992];return _0x5f0713;};'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('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index a44174e..3d5f48a 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 _0x1cf3=['TEXT','sequelize','exports','STRING','name'];(function(_0x34366a,_0x557e46){var _0x48acc7=function(_0x5413a3){while(--_0x5413a3){_0x34366a['push'](_0x34366a['shift']());}};_0x48acc7(++_0x557e46);}(_0x1cf3,0x1be));var _0x31cf=function(_0x49c073,_0x38f995){_0x49c073=_0x49c073-0x0;var _0x165908=_0x1cf3[_0x49c073];return _0x165908;};'use strict';var Sequelize=require(_0x31cf('0x0'));module[_0x31cf('0x1')]={'name':{'type':Sequelize[_0x31cf('0x2')],'allowNull':![],'unique':_0x31cf('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x31cf('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56fe=['sequelize','exports','STRING','TEXT'];(function(_0xe36641,_0x3fc318){var _0x1a5724=function(_0x3c7b8c){while(--_0x3c7b8c){_0xe36641['push'](_0xe36641['shift']());}};_0x1a5724(++_0x3fc318);}(_0x56fe,0xe4));var _0xe56f=function(_0x5a26d5,_0x317a00){_0x5a26d5=_0x5a26d5-0x0;var _0x1e6190=_0x56fe[_0x5a26d5];return _0x1e6190;};'use strict';var Sequelize=require(_0xe56f('0x0'));module[_0xe56f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xe56f('0x2')]},'metric':{'type':Sequelize[_0xe56f('0x3')]},'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 14be35c..ea7f88f 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 _0x94df=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','index','map','rawAttributes','type','model','keys','query','intersection','attributes','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','AnalyticMetric','count','includeAll','rows','catch','show','params','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Metrics','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf'];(function(_0x239cee,_0xf7018){var _0x5dbf2e=function(_0x1cfe0f){while(--_0x1cfe0f){_0x239cee['push'](_0x239cee['shift']());}};_0x5dbf2e(++_0xf7018);}(_0x94df,0xa3));var _0xf94d=function(_0x5dd868,_0x2c93a9){_0x5dd868=_0x5dd868-0x0;var _0x3c9566=_0x94df[_0x5dd868];return _0x3c9566;};'use strict';var pdf=require(_0xf94d('0x0'));var emlformat=require(_0xf94d('0x1'));var rimraf=require(_0xf94d('0x2'));var zipdir=require(_0xf94d('0x3'));var jsonpatch=require(_0xf94d('0x4'));var rp=require(_0xf94d('0x5'));var moment=require('moment');var BPromise=require(_0xf94d('0x6'));var Mustache=require(_0xf94d('0x7'));var util=require(_0xf94d('0x8'));var path=require(_0xf94d('0x9'));var sox=require(_0xf94d('0xa'));var csv=require(_0xf94d('0xb'));var ejs=require(_0xf94d('0xc'));var fs=require('fs');var _=require(_0xf94d('0xd'));var squel=require(_0xf94d('0xe'));var crypto=require(_0xf94d('0xf'));var jsforce=require(_0xf94d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf94d('0xb'));var querystring=require(_0xf94d('0x11'));var Papa=require(_0xf94d('0x12'));var Redis=require(_0xf94d('0x13'));var authService=require(_0xf94d('0x14'));var qs=require(_0xf94d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf94d('0x16'));var logger=require(_0xf94d('0x17'))(_0xf94d('0x18'));var utils=require(_0xf94d('0x19'));var config=require(_0xf94d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x580644,_0x194023){_0x194023=_0x194023||0xcc;return function(_0x3e6c70){if(_0x3e6c70){return _0x580644[_0xf94d('0x1b')](_0x194023);}return _0x580644[_0xf94d('0x1c')](_0x194023)[_0xf94d('0x1d')]();};}function respondWithResult(_0x381a5f,_0x509c69){_0x509c69=_0x509c69||0xc8;return function(_0x596da8){if(_0x596da8){return _0x381a5f[_0xf94d('0x1c')](_0x509c69)[_0xf94d('0x1e')](_0x596da8);}};}function respondWithFilteredResult(_0x305c5f,_0xcc1a3a){return function(_0x451065){if(_0x451065){var _0x14020b=_0x451065['count'],_0x2c557b=_0xcc1a3a[_0xf94d('0x1f')],_0x4fa8bf=_0xcc1a3a['offset']+_0xcc1a3a[_0xf94d('0x20')],_0x431b19;if(_0x4fa8bf>=_0x14020b){_0x4fa8bf=_0x14020b;_0x431b19=0xc8;}else{_0x431b19=0xce;}_0x305c5f['status'](_0x431b19);return _0x305c5f[_0xf94d('0x21')](_0xf94d('0x22'),_0x2c557b+'-'+_0x4fa8bf+'/'+_0x14020b)[_0xf94d('0x1e')](_0x451065);}return null;};}function patchUpdates(_0x349de5){return function(_0x55e869){try{jsonpatch[_0xf94d('0x23')](_0x55e869,_0x349de5,!![]);}catch(_0x5e0133){return BPromise[_0xf94d('0x24')](_0x5e0133);}return _0x55e869[_0xf94d('0x25')]();};}function saveUpdates(_0x45adeb,_0x2ede5b){return function(_0x5f261c){if(_0x5f261c){return _0x5f261c[_0xf94d('0x26')](_0x45adeb)['then'](function(_0x39f75d){return _0x39f75d;});}return null;};}function removeEntity(_0x1fa6bf,_0x418f99){return function(_0x56e5f5){if(_0x56e5f5){return _0x56e5f5[_0xf94d('0x27')]()[_0xf94d('0x28')](function(){var _0x2142a1=_0x56e5f5[_0xf94d('0x29')]({'plain':!![]});var _0x47470d='Metrics';return db[_0xf94d('0x2a')]['destroy']({'where':{'type':_0x47470d,'resourceId':_0x2142a1['id']}})[_0xf94d('0x28')](function(){return _0x56e5f5;});})[_0xf94d('0x28')](function(){_0x1fa6bf[_0xf94d('0x1c')](0xcc)[_0xf94d('0x1d')]();});}};}function handleEntityNotFound(_0x997b6c,_0x1c4bdf){return function(_0x2804dc){if(!_0x2804dc){_0x997b6c[_0xf94d('0x1b')](0x194);}return _0x2804dc;};}function handleError(_0x3c9fe3,_0x13c229){_0x13c229=_0x13c229||0x1f4;return function(_0x18ccd7){logger[_0xf94d('0x2b')](_0x18ccd7[_0xf94d('0x2c')]);if(_0x18ccd7['name']){delete _0x18ccd7['name'];}_0x3c9fe3['status'](_0x13c229)['send'](_0x18ccd7);};}exports[_0xf94d('0x2d')]=function(_0x1e8242,_0x56ab8c){var _0x167585={},_0x1c123b={},_0x229ff7={'count':0x0,'rows':[]};var _0x59c273=_[_0xf94d('0x2e')](db['AnalyticMetric'][_0xf94d('0x2f')],function(_0x1d15c5){return{'name':_0x1d15c5['fieldName'],'type':_0x1d15c5[_0xf94d('0x30')]['key']};});_0x1c123b[_0xf94d('0x31')]=_['map'](_0x59c273,'name');_0x1c123b['query']=_[_0xf94d('0x32')](_0x1e8242[_0xf94d('0x33')]);_0x1c123b['filters']=_[_0xf94d('0x34')](_0x1c123b['model'],_0x1c123b[_0xf94d('0x33')]);_0x167585[_0xf94d('0x35')]=_['intersection'](_0x1c123b[_0xf94d('0x31')],qs['fields'](_0x1e8242[_0xf94d('0x33')]['fields']));_0x167585[_0xf94d('0x35')]=_0x167585['attributes'][_0xf94d('0x36')]?_0x167585[_0xf94d('0x35')]:_0x1c123b[_0xf94d('0x31')];if(!_0x1e8242[_0xf94d('0x33')]['hasOwnProperty']('nolimit')){_0x167585['limit']=qs[_0xf94d('0x20')](_0x1e8242[_0xf94d('0x33')][_0xf94d('0x20')]);_0x167585[_0xf94d('0x1f')]=qs['offset'](_0x1e8242['query']['offset']);}_0x167585[_0xf94d('0x37')]=qs[_0xf94d('0x38')](_0x1e8242[_0xf94d('0x33')][_0xf94d('0x38')]);_0x167585['where']=qs[_0xf94d('0x39')](_[_0xf94d('0x3a')](_0x1e8242[_0xf94d('0x33')],_0x1c123b[_0xf94d('0x39')]),_0x59c273);if(_0x1e8242['query'][_0xf94d('0x3b')]){_0x167585[_0xf94d('0x3c')]=_[_0xf94d('0x3d')](_0x167585[_0xf94d('0x3c')],{'$or':_[_0xf94d('0x2e')](_0x59c273,function(_0x288262){if(_0x288262[_0xf94d('0x30')]!==_0xf94d('0x3e')){var _0xe9510e={};_0xe9510e[_0x288262[_0xf94d('0x3f')]]={'$like':'%'+_0x1e8242['query']['filter']+'%'};return _0xe9510e;}})});}_0x167585=_[_0xf94d('0x3d')]({},_0x167585,_0x1e8242['options']);var _0x1938f8={'where':_0x167585['where']};return db[_0xf94d('0x40')][_0xf94d('0x41')](_0x1938f8)[_0xf94d('0x28')](function(_0x183f9f){_0x229ff7[_0xf94d('0x41')]=_0x183f9f;if(_0x1e8242['query'][_0xf94d('0x42')]){_0x167585['include']=[{'all':!![]}];}return db[_0xf94d('0x40')]['findAll'](_0x167585);})[_0xf94d('0x28')](function(_0x40af20){_0x229ff7[_0xf94d('0x43')]=_0x40af20;return _0x229ff7;})[_0xf94d('0x28')](respondWithFilteredResult(_0x56ab8c,_0x167585))[_0xf94d('0x44')](handleError(_0x56ab8c,null));};exports[_0xf94d('0x45')]=function(_0x3a5703,_0x598e2b){var _0x36ac14={'raw':!![],'where':{'id':_0x3a5703[_0xf94d('0x46')]['id']}},_0x2df442={};_0x2df442['model']=_[_0xf94d('0x32')](db[_0xf94d('0x40')][_0xf94d('0x2f')]);_0x2df442[_0xf94d('0x33')]=_[_0xf94d('0x32')](_0x3a5703[_0xf94d('0x33')]);_0x2df442[_0xf94d('0x39')]=_['intersection'](_0x2df442[_0xf94d('0x31')],_0x2df442[_0xf94d('0x33')]);_0x36ac14[_0xf94d('0x35')]=_[_0xf94d('0x34')](_0x2df442[_0xf94d('0x31')],qs[_0xf94d('0x47')](_0x3a5703['query']['fields']));_0x36ac14[_0xf94d('0x35')]=_0x36ac14[_0xf94d('0x35')][_0xf94d('0x36')]?_0x36ac14[_0xf94d('0x35')]:_0x2df442[_0xf94d('0x31')];if(_0x3a5703['query'][_0xf94d('0x42')]){_0x36ac14['include']=[{'all':!![]}];}_0x36ac14=_[_0xf94d('0x3d')]({},_0x36ac14,_0x3a5703[_0xf94d('0x48')]);return db[_0xf94d('0x40')][_0xf94d('0x49')](_0x36ac14)[_0xf94d('0x28')](handleEntityNotFound(_0x598e2b,null))['then'](respondWithResult(_0x598e2b,null))[_0xf94d('0x44')](handleError(_0x598e2b,null));};exports[_0xf94d('0x4a')]=function(_0x676410,_0x3d0df2){return db['AnalyticMetric'][_0xf94d('0x4a')](_0x676410['body'],{})['then'](function(_0x2c3e83){var _0x3ee368=_0x676410[_0xf94d('0x4b')]['get']({'plain':!![]});if(!_0x3ee368)throw new Error(_0xf94d('0x4c'));if(_0x3ee368['role']===_0xf94d('0x4b')){var _0xb1b984=_0x2c3e83[_0xf94d('0x29')]({'plain':!![]});var _0x42ec76=_0xf94d('0x4d');return db[_0xf94d('0x4e')]['find']({'where':{'name':_0x42ec76,'userProfileId':_0x3ee368[_0xf94d('0x4f')]},'raw':!![]})[_0xf94d('0x28')](function(_0x3b63da){if(_0x3b63da&&_0x3b63da[_0xf94d('0x50')]===0x0){return db['UserProfileResource'][_0xf94d('0x4a')]({'name':_0xb1b984['name'],'resourceId':_0xb1b984['id'],'type':_0x3b63da[_0xf94d('0x3f')],'sectionId':_0x3b63da['id']},{})['then'](function(){return _0x2c3e83;});}else{return _0x2c3e83;}})[_0xf94d('0x44')](function(_0xdcee74){logger[_0xf94d('0x2b')](_0xf94d('0x51'),_0xdcee74);throw _0xdcee74;});}return _0x2c3e83;})[_0xf94d('0x28')](respondWithResult(_0x3d0df2,0xc9))['catch'](handleError(_0x3d0df2,null));};exports['update']=function(_0x218e25,_0x3155a4){if(_0x218e25[_0xf94d('0x52')]['id']){delete _0x218e25[_0xf94d('0x52')]['id'];}return db[_0xf94d('0x40')][_0xf94d('0x49')]({'where':{'id':_0x218e25['params']['id']}})[_0xf94d('0x28')](handleEntityNotFound(_0x3155a4,null))[_0xf94d('0x28')](saveUpdates(_0x218e25[_0xf94d('0x52')],null))[_0xf94d('0x28')](respondWithResult(_0x3155a4,null))['catch'](handleError(_0x3155a4,null));};exports['destroy']=function(_0x24daaa,_0x404b06){return db[_0xf94d('0x40')]['find']({'where':{'id':_0x24daaa[_0xf94d('0x46')]['id']}})[_0xf94d('0x28')](handleEntityNotFound(_0x404b06,null))[_0xf94d('0x28')](removeEntity(_0x404b06,null))[_0xf94d('0x44')](handleError(_0x404b06,null));}; \ No newline at end of file +var _0xb03e=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','Metrics','destroy','error','stack','index','rawAttributes','map','name','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','AnalyticMetric','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash'];(function(_0x2be3b1,_0x58685a){var _0x54dc5b=function(_0x56e6f2){while(--_0x56e6f2){_0x2be3b1['push'](_0x2be3b1['shift']());}};_0x54dc5b(++_0x58685a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x343d89,_0x15a898){_0x343d89=_0x343d89-0x0;var _0x2b8089=_0xb03e[_0x343d89];return _0x2b8089;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb03('0x0'));var rimraf=require(_0xeb03('0x1'));var zipdir=require(_0xeb03('0x2'));var jsonpatch=require(_0xeb03('0x3'));var rp=require(_0xeb03('0x4'));var moment=require(_0xeb03('0x5'));var BPromise=require(_0xeb03('0x6'));var Mustache=require(_0xeb03('0x7'));var util=require(_0xeb03('0x8'));var path=require(_0xeb03('0x9'));var sox=require(_0xeb03('0xa'));var csv=require(_0xeb03('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xb'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var db=require(_0xeb03('0x19'))['db'];function respondWithStatusCode(_0x45481b,_0x367d36){_0x367d36=_0x367d36||0xcc;return function(_0x384cbe){if(_0x384cbe){return _0x45481b[_0xeb03('0x1a')](_0x367d36);}return _0x45481b[_0xeb03('0x1b')](_0x367d36)[_0xeb03('0x1c')]();};}function respondWithResult(_0x3bebc6,_0x4d9c8e){_0x4d9c8e=_0x4d9c8e||0xc8;return function(_0x212082){if(_0x212082){return _0x3bebc6[_0xeb03('0x1b')](_0x4d9c8e)[_0xeb03('0x1d')](_0x212082);}};}function respondWithFilteredResult(_0x33f9ba,_0x52be5b){return function(_0x15f4fe){if(_0x15f4fe){var _0x36f5d8=_0x15f4fe[_0xeb03('0x1e')],_0x3f26ef=_0x52be5b[_0xeb03('0x1f')],_0x478989=_0x52be5b[_0xeb03('0x1f')]+_0x52be5b[_0xeb03('0x20')],_0x7ce874;if(_0x478989>=_0x36f5d8){_0x478989=_0x36f5d8;_0x7ce874=0xc8;}else{_0x7ce874=0xce;}_0x33f9ba[_0xeb03('0x1b')](_0x7ce874);return _0x33f9ba[_0xeb03('0x21')](_0xeb03('0x22'),_0x3f26ef+'-'+_0x478989+'/'+_0x36f5d8)[_0xeb03('0x1d')](_0x15f4fe);}return null;};}function patchUpdates(_0x469d25){return function(_0x456fb3){try{jsonpatch[_0xeb03('0x23')](_0x456fb3,_0x469d25,!![]);}catch(_0x2443d9){return BPromise[_0xeb03('0x24')](_0x2443d9);}return _0x456fb3['save']();};}function saveUpdates(_0x1bea3f,_0x3855dd){return function(_0x413d3e){if(_0x413d3e){return _0x413d3e[_0xeb03('0x25')](_0x1bea3f)[_0xeb03('0x26')](function(_0x31e406){return _0x31e406;});}return null;};}function removeEntity(_0xb98dc1,_0x2c795b){return function(_0x3c3d09){if(_0x3c3d09){return _0x3c3d09['destroy']()[_0xeb03('0x26')](function(){var _0x1707ec=_0x3c3d09[_0xeb03('0x27')]({'plain':!![]});var _0x300dc0=_0xeb03('0x28');return db['UserProfileResource'][_0xeb03('0x29')]({'where':{'type':_0x300dc0,'resourceId':_0x1707ec['id']}})[_0xeb03('0x26')](function(){return _0x3c3d09;});})[_0xeb03('0x26')](function(){_0xb98dc1[_0xeb03('0x1b')](0xcc)[_0xeb03('0x1c')]();});}};}function handleEntityNotFound(_0x119697,_0xb04f34){return function(_0x3f68f3){if(!_0x3f68f3){_0x119697[_0xeb03('0x1a')](0x194);}return _0x3f68f3;};}function handleError(_0x4984f6,_0x832372){_0x832372=_0x832372||0x1f4;return function(_0x1b2c7b){logger[_0xeb03('0x2a')](_0x1b2c7b[_0xeb03('0x2b')]);if(_0x1b2c7b['name']){delete _0x1b2c7b['name'];}_0x4984f6[_0xeb03('0x1b')](_0x832372)['send'](_0x1b2c7b);};}exports[_0xeb03('0x2c')]=function(_0x8bd544,_0x160a37){var _0x5db8bb={},_0xd4c8ec={},_0x5de53a={'count':0x0,'rows':[]};var _0x5cb729=_['map'](db['AnalyticMetric'][_0xeb03('0x2d')],function(_0x433ce8){return{'name':_0x433ce8['fieldName'],'type':_0x433ce8['type']['key']};});_0xd4c8ec['model']=_[_0xeb03('0x2e')](_0x5cb729,_0xeb03('0x2f'));_0xd4c8ec[_0xeb03('0x30')]=_[_0xeb03('0x31')](_0x8bd544[_0xeb03('0x30')]);_0xd4c8ec['filters']=_[_0xeb03('0x32')](_0xd4c8ec['model'],_0xd4c8ec[_0xeb03('0x30')]);_0x5db8bb[_0xeb03('0x33')]=_[_0xeb03('0x32')](_0xd4c8ec[_0xeb03('0x34')],qs[_0xeb03('0x35')](_0x8bd544[_0xeb03('0x30')][_0xeb03('0x35')]));_0x5db8bb[_0xeb03('0x33')]=_0x5db8bb['attributes'][_0xeb03('0x36')]?_0x5db8bb['attributes']:_0xd4c8ec[_0xeb03('0x34')];if(!_0x8bd544[_0xeb03('0x30')][_0xeb03('0x37')](_0xeb03('0x38'))){_0x5db8bb[_0xeb03('0x20')]=qs[_0xeb03('0x20')](_0x8bd544['query'][_0xeb03('0x20')]);_0x5db8bb['offset']=qs['offset'](_0x8bd544['query'][_0xeb03('0x1f')]);}_0x5db8bb[_0xeb03('0x39')]=qs[_0xeb03('0x3a')](_0x8bd544[_0xeb03('0x30')][_0xeb03('0x3a')]);_0x5db8bb['where']=qs[_0xeb03('0x3b')](_[_0xeb03('0x3c')](_0x8bd544[_0xeb03('0x30')],_0xd4c8ec['filters']),_0x5cb729);if(_0x8bd544['query'][_0xeb03('0x3d')]){_0x5db8bb[_0xeb03('0x3e')]=_[_0xeb03('0x3f')](_0x5db8bb['where'],{'$or':_[_0xeb03('0x2e')](_0x5cb729,function(_0x392729){if(_0x392729['type']!=='VIRTUAL'){var _0x4621da={};_0x4621da[_0x392729[_0xeb03('0x2f')]]={'$like':'%'+_0x8bd544['query'][_0xeb03('0x3d')]+'%'};return _0x4621da;}})});}_0x5db8bb=_[_0xeb03('0x3f')]({},_0x5db8bb,_0x8bd544[_0xeb03('0x40')]);var _0x1d28ec={'where':_0x5db8bb[_0xeb03('0x3e')]};return db[_0xeb03('0x41')][_0xeb03('0x1e')](_0x1d28ec)[_0xeb03('0x26')](function(_0x20ebe8){_0x5de53a[_0xeb03('0x1e')]=_0x20ebe8;if(_0x8bd544[_0xeb03('0x30')][_0xeb03('0x42')]){_0x5db8bb[_0xeb03('0x43')]=[{'all':!![]}];}return db[_0xeb03('0x41')][_0xeb03('0x44')](_0x5db8bb);})[_0xeb03('0x26')](function(_0x407f0b){_0x5de53a[_0xeb03('0x45')]=_0x407f0b;return _0x5de53a;})[_0xeb03('0x26')](respondWithFilteredResult(_0x160a37,_0x5db8bb))[_0xeb03('0x46')](handleError(_0x160a37,null));};exports[_0xeb03('0x47')]=function(_0x2f83c3,_0x2879b0){var _0x5bb7d9={'raw':!![],'where':{'id':_0x2f83c3[_0xeb03('0x48')]['id']}},_0x53c406={};_0x53c406[_0xeb03('0x34')]=_[_0xeb03('0x31')](db[_0xeb03('0x41')][_0xeb03('0x2d')]);_0x53c406[_0xeb03('0x30')]=_[_0xeb03('0x31')](_0x2f83c3[_0xeb03('0x30')]);_0x53c406['filters']=_[_0xeb03('0x32')](_0x53c406[_0xeb03('0x34')],_0x53c406[_0xeb03('0x30')]);_0x5bb7d9[_0xeb03('0x33')]=_[_0xeb03('0x32')](_0x53c406['model'],qs['fields'](_0x2f83c3[_0xeb03('0x30')]['fields']));_0x5bb7d9['attributes']=_0x5bb7d9['attributes'][_0xeb03('0x36')]?_0x5bb7d9[_0xeb03('0x33')]:_0x53c406[_0xeb03('0x34')];if(_0x2f83c3[_0xeb03('0x30')][_0xeb03('0x42')]){_0x5bb7d9[_0xeb03('0x43')]=[{'all':!![]}];}_0x5bb7d9=_['merge']({},_0x5bb7d9,_0x2f83c3[_0xeb03('0x40')]);return db['AnalyticMetric']['find'](_0x5bb7d9)[_0xeb03('0x26')](handleEntityNotFound(_0x2879b0,null))[_0xeb03('0x26')](respondWithResult(_0x2879b0,null))[_0xeb03('0x46')](handleError(_0x2879b0,null));};exports['create']=function(_0x404191,_0x9c8073){return db[_0xeb03('0x41')][_0xeb03('0x49')](_0x404191[_0xeb03('0x4a')],{})['then'](function(_0x21a121){var _0x4dc1f6=_0x404191[_0xeb03('0x4b')][_0xeb03('0x27')]({'plain':!![]});if(!_0x4dc1f6)throw new Error(_0xeb03('0x4c'));if(_0x4dc1f6[_0xeb03('0x4d')]===_0xeb03('0x4b')){var _0x46f4a7=_0x21a121[_0xeb03('0x27')]({'plain':!![]});var _0x292319=_0xeb03('0x28');return db[_0xeb03('0x4e')][_0xeb03('0x4f')]({'where':{'name':_0x292319,'userProfileId':_0x4dc1f6[_0xeb03('0x50')]},'raw':!![]})[_0xeb03('0x26')](function(_0x345a98){if(_0x345a98&&_0x345a98[_0xeb03('0x51')]===0x0){return db[_0xeb03('0x52')][_0xeb03('0x49')]({'name':_0x46f4a7[_0xeb03('0x2f')],'resourceId':_0x46f4a7['id'],'type':_0x345a98[_0xeb03('0x2f')],'sectionId':_0x345a98['id']},{})[_0xeb03('0x26')](function(){return _0x21a121;});}else{return _0x21a121;}})[_0xeb03('0x46')](function(_0x333fba){logger[_0xeb03('0x2a')](_0xeb03('0x53'),_0x333fba);throw _0x333fba;});}return _0x21a121;})['then'](respondWithResult(_0x9c8073,0xc9))[_0xeb03('0x46')](handleError(_0x9c8073,null));};exports[_0xeb03('0x25')]=function(_0x415c18,_0x5405b4){if(_0x415c18[_0xeb03('0x4a')]['id']){delete _0x415c18[_0xeb03('0x4a')]['id'];}return db[_0xeb03('0x41')][_0xeb03('0x4f')]({'where':{'id':_0x415c18[_0xeb03('0x48')]['id']}})[_0xeb03('0x26')](handleEntityNotFound(_0x5405b4,null))[_0xeb03('0x26')](saveUpdates(_0x415c18[_0xeb03('0x4a')],null))[_0xeb03('0x26')](respondWithResult(_0x5405b4,null))[_0xeb03('0x46')](handleError(_0x5405b4,null));};exports[_0xeb03('0x29')]=function(_0x25de1f,_0xf9beaf){return db[_0xeb03('0x41')]['find']({'where':{'id':_0x25de1f[_0xeb03('0x48')]['id']}})[_0xeb03('0x26')](handleEntityNotFound(_0xf9beaf,null))[_0xeb03('0x26')](removeEntity(_0xf9beaf,null))[_0xeb03('0x46')](handleError(_0xf9beaf,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index aaa757f..617bcba 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 _0xb705=['bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','moment'];(function(_0x37a4a1,_0x356362){var _0x3c396b=function(_0xd5ec8c){while(--_0xd5ec8c){_0x37a4a1['push'](_0x37a4a1['shift']());}};_0x3c396b(++_0x356362);}(_0xb705,0x182));var _0x5b70=function(_0x459a0c,_0x6288a9){_0x459a0c=_0x459a0c-0x0;var _0x4b1bf3=_0xb705[_0x459a0c];return _0x4b1bf3;};'use strict';var _=require('lodash');var util=require(_0x5b70('0x0'));var logger=require(_0x5b70('0x1'))(_0x5b70('0x2'));var moment=require(_0x5b70('0x3'));var BPromise=require(_0x5b70('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b70('0x5'));var rimraf=require(_0x5b70('0x6'));var config=require(_0x5b70('0x7'));var attributes=require(_0x5b70('0x8'));module[_0x5b70('0x9')]=function(_0x1bbd63,_0xde5863){return _0x1bbd63[_0x5b70('0xa')](_0x5b70('0xb'),attributes,{'tableName':_0x5b70('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fcd=['exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x57fd6c,_0x5d048e){var _0x489f14=function(_0x5aba91){while(--_0x5aba91){_0x57fd6c['push'](_0x57fd6c['shift']());}};_0x489f14(++_0x5d048e);}(_0x5fcd,0x121));var _0xd5fc=function(_0x541adb,_0x258def){_0x541adb=_0x541adb-0x0;var _0x2ca2e4=_0x5fcd[_0x541adb];return _0x2ca2e4;};'use strict';var _=require(_0xd5fc('0x0'));var util=require(_0xd5fc('0x1'));var logger=require(_0xd5fc('0x2'))(_0xd5fc('0x3'));var moment=require(_0xd5fc('0x4'));var BPromise=require(_0xd5fc('0x5'));var rp=require(_0xd5fc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd5fc('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xd5fc('0x8')]=function(_0x359793,_0x354940){return _0x359793[_0xd5fc('0x9')]('AnalyticMetric',attributes,{'tableName':_0xd5fc('0xa'),'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 44085fc..e228a43 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 _0x7ee5=['rpc','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x326701,_0x24bb20){var _0x38fd65=function(_0x5729dc){while(--_0x5729dc){_0x326701['push'](_0x326701['shift']());}};_0x38fd65(++_0x24bb20);}(_0x7ee5,0x126));var _0x57ee=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0x7ee5[_0x57a9e5];return _0x36d39e;};'use strict';var _=require(_0x57ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x57ee('0x1'));var fs=require('fs');var Redis=require(_0x57ee('0x2'));var db=require(_0x57ee('0x3'))['db'];var utils=require(_0x57ee('0x4'));var logger=require(_0x57ee('0x5'))(_0x57ee('0x6'));var config=require('../../config/environment');var jayson=require(_0x57ee('0x7'));var client=jayson[_0x57ee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b367b,_0x49d51d,_0x2e068a){return new BPromise(function(_0xb7fddf,_0x1cac03){return client[_0x57ee('0x9')](_0x3b367b,_0x2e068a)[_0x57ee('0xa')](function(_0x1fc33e){logger['info'](_0x57ee('0xb'),_0x49d51d,_0x57ee('0xc'));logger[_0x57ee('0xd')](_0x57ee('0xe'),_0x49d51d,_0x57ee('0xc'),JSON['stringify'](_0x1fc33e));if(_0x1fc33e[_0x57ee('0xf')]){if(_0x1fc33e[_0x57ee('0xf')][_0x57ee('0x10')]===0x1f4){logger[_0x57ee('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x49d51d,_0x1fc33e[_0x57ee('0xf')][_0x57ee('0x11')]);return _0x1cac03(_0x1fc33e['error'][_0x57ee('0x11')]);}logger['error'](_0x57ee('0xb'),_0x49d51d,_0x1fc33e[_0x57ee('0xf')]['message']);return _0xb7fddf(_0x1fc33e[_0x57ee('0xf')][_0x57ee('0x11')]);}else{logger['info'](_0x57ee('0xb'),_0x49d51d,_0x57ee('0xc'));_0xb7fddf(_0x1fc33e[_0x57ee('0x12')][_0x57ee('0x11')]);}})[_0x57ee('0x13')](function(_0x3648d7){logger['error'](_0x57ee('0xb'),_0x49d51d,_0x3648d7);_0x1cac03(_0x3648d7);});});} \ No newline at end of file +var _0x7686=['http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x186085,_0x47dc06){var _0x158839=function(_0x11ce50){while(--_0x11ce50){_0x186085['push'](_0x186085['shift']());}};_0x158839(++_0x47dc06);}(_0x7686,0xcc));var _0x6768=function(_0x4ccc6e,_0x5664d2){_0x4ccc6e=_0x4ccc6e-0x0;var _0x234c7f=_0x7686[_0x4ccc6e];return _0x234c7f;};'use strict';var _=require(_0x6768('0x0'));var util=require(_0x6768('0x1'));var moment=require(_0x6768('0x2'));var BPromise=require(_0x6768('0x3'));var rs=require(_0x6768('0x4'));var fs=require('fs');var Redis=require(_0x6768('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6768('0x6'));var logger=require(_0x6768('0x7'))(_0x6768('0x8'));var config=require(_0x6768('0x9'));var jayson=require(_0x6768('0xa'));var client=jayson[_0x6768('0xb')][_0x6768('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f414e,_0x2e0fa1,_0x3dc360){return new BPromise(function(_0x296eea,_0x311169){return client[_0x6768('0xd')](_0x2f414e,_0x3dc360)[_0x6768('0xe')](function(_0x41f679){logger[_0x6768('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2e0fa1,_0x6768('0x10'));logger[_0x6768('0x11')](_0x6768('0x12'),_0x2e0fa1,_0x6768('0x10'),JSON[_0x6768('0x13')](_0x41f679));if(_0x41f679[_0x6768('0x14')]){if(_0x41f679[_0x6768('0x14')]['code']===0x1f4){logger[_0x6768('0x14')](_0x6768('0x15'),_0x2e0fa1,_0x41f679[_0x6768('0x14')][_0x6768('0x16')]);return _0x311169(_0x41f679[_0x6768('0x14')]['message']);}logger[_0x6768('0x14')](_0x6768('0x15'),_0x2e0fa1,_0x41f679['error'][_0x6768('0x16')]);return _0x296eea(_0x41f679['error'][_0x6768('0x16')]);}else{logger['info'](_0x6768('0x15'),_0x2e0fa1,'request\x20sent');_0x296eea(_0x41f679[_0x6768('0x17')][_0x6768('0x16')]);}})['catch'](function(_0x12fbfc){logger['error'](_0x6768('0x15'),_0x2e0fa1,_0x12fbfc);_0x311169(_0x12fbfc);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 428d165..fda345f 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 _0xba34=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','./analyticMetric.controller'];(function(_0x18095f,_0x43bec3){var _0x451c33=function(_0x1f1e98){while(--_0x1f1e98){_0x18095f['push'](_0x18095f['shift']());}};_0x451c33(++_0x43bec3);}(_0xba34,0x119));var _0x4ba3=function(_0x18a756,_0x42f552){_0x18a756=_0x18a756-0x0;var _0x67fbe2=_0xba34[_0x18a756];return _0x67fbe2;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0xc')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['destroy']);module[_0x4ba3('0x11')]=router; \ No newline at end of file +var _0xadb5=['destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x593ed1,_0x4855c2){var _0x3ca30c=function(_0xc3714b){while(--_0xc3714b){_0x593ed1['push'](_0x593ed1['shift']());}};_0x3ca30c(++_0x4855c2);}(_0xadb5,0xad));var _0x5adb=function(_0x23d049,_0x4ad7a3){_0x23d049=_0x23d049-0x0;var _0x4de619=_0xadb5[_0x23d049];return _0x4de619;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0xc')]('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router[_0x5adb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5adb('0x11')]);module[_0x5adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 46fba45..0df8c63 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 _0xfd9c=['TEXT','sequelize','exports'];(function(_0x1ef7a0,_0x5406c1){var _0x39fb62=function(_0x1c623c){while(--_0x1c623c){_0x1ef7a0['push'](_0x1ef7a0['shift']());}};_0x39fb62(++_0x5406c1);}(_0xfd9c,0x11b));var _0xcfd9=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0xfd9c[_0x5d6c3e];return _0x44ecb7;};'use strict';var Sequelize=require(_0xcfd9('0x0'));module[_0xcfd9('0x1')]={'tree':{'type':Sequelize[_0xcfd9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdf4f=['sequelize','exports','TEXT'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xdf4f,0xde));var _0xfdf4=function(_0x45f4ed,_0x3b65ac){_0x45f4ed=_0x45f4ed-0x0;var _0x3279e6=_0xdf4f[_0x45f4ed];return _0x3279e6;};'use strict';var Sequelize=require(_0xfdf4('0x0'));module[_0xfdf4('0x1')]={'tree':{'type':Sequelize[_0xfdf4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 8928ea9..6f83972 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 _0x0596=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','zip-dir','moment','mustache','path','sox','to-csv','ejs','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x58420f,_0x50be10){var _0x47505e=function(_0x52ad95){while(--_0x52ad95){_0x58420f['push'](_0x58420f['shift']());}};_0x47505e(++_0x50be10);}(_0x0596,0x92));var _0x6059=function(_0x161e90,_0x447193){_0x161e90=_0x161e90-0x0;var _0x1da972=_0x0596[_0x161e90];return _0x1da972;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6059('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6059('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6059('0x2'));var util=require('util');var path=require(_0x6059('0x3'));var sox=require(_0x6059('0x4'));var csv=require(_0x6059('0x5'));var ejs=require(_0x6059('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6059('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6059('0x8'));var Redis=require(_0x6059('0x9'));var authService=require(_0x6059('0xa'));var qs=require(_0x6059('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6059('0xc'));var logger=require(_0x6059('0xd'))(_0x6059('0xe'));var utils=require(_0x6059('0xf'));var config=require(_0x6059('0x10'));var db=require(_0x6059('0x11'))['db'];function respondWithStatusCode(_0x3aaef,_0x581380){_0x581380=_0x581380||0xcc;return function(_0x16c5d2){if(_0x16c5d2){return _0x3aaef[_0x6059('0x12')](_0x581380);}return _0x3aaef[_0x6059('0x13')](_0x581380)[_0x6059('0x14')]();};}function respondWithResult(_0x4e9b85,_0x4b3a36){_0x4b3a36=_0x4b3a36||0xc8;return function(_0x2c20a9){if(_0x2c20a9){return _0x4e9b85[_0x6059('0x13')](_0x4b3a36)['json'](_0x2c20a9);}};}function respondWithFilteredResult(_0x225b8d,_0x3f87a6){return function(_0x204cc4){if(_0x204cc4){var _0x3e5373=_0x204cc4[_0x6059('0x15')],_0x2dec8f=_0x3f87a6[_0x6059('0x16')],_0x177300=_0x3f87a6['offset']+_0x3f87a6['limit'],_0x382eb1;if(_0x177300>=_0x3e5373){_0x177300=_0x3e5373;_0x382eb1=0xc8;}else{_0x382eb1=0xce;}_0x225b8d[_0x6059('0x13')](_0x382eb1);return _0x225b8d[_0x6059('0x17')](_0x6059('0x18'),_0x2dec8f+'-'+_0x177300+'/'+_0x3e5373)[_0x6059('0x19')](_0x204cc4);}return null;};}function patchUpdates(_0x47d507){return function(_0x51e47c){try{jsonpatch[_0x6059('0x1a')](_0x51e47c,_0x47d507,!![]);}catch(_0x40f60a){return BPromise['reject'](_0x40f60a);}return _0x51e47c[_0x6059('0x1b')]();};}function saveUpdates(_0xa93623,_0x5c841b){return function(_0x36ae1f){if(_0x36ae1f){return _0x36ae1f[_0x6059('0x1c')](_0xa93623)[_0x6059('0x1d')](function(_0x5cd634){return _0x5cd634;});}return null;};}function removeEntity(_0x2882bb,_0x3da474){return function(_0x3e6da4){if(_0x3e6da4){return _0x3e6da4[_0x6059('0x1e')]()[_0x6059('0x1d')](function(){_0x2882bb[_0x6059('0x13')](0xcc)[_0x6059('0x14')]();});}};}function handleEntityNotFound(_0x422945,_0x28043e){return function(_0x27cb66){if(!_0x27cb66){_0x422945['sendStatus'](0x194);}return _0x27cb66;};}function handleError(_0x4ea322,_0x5c5b83){_0x5c5b83=_0x5c5b83||0x1f4;return function(_0x128644){logger[_0x6059('0x1f')](_0x128644['stack']);if(_0x128644[_0x6059('0x20')]){delete _0x128644[_0x6059('0x20')];}_0x4ea322['status'](_0x5c5b83)[_0x6059('0x21')](_0x128644);};}exports['index']=function(_0x2c1f15,_0x469f5b){var _0x1e4b04={},_0x5b66dc={},_0x311bd4={'count':0x0,'rows':[]};var _0x12d219=_['map'](db[_0x6059('0x22')][_0x6059('0x23')],function(_0x29c064){return{'name':_0x29c064[_0x6059('0x24')],'type':_0x29c064['type'][_0x6059('0x25')]};});_0x5b66dc[_0x6059('0x26')]=_['map'](_0x12d219,_0x6059('0x20'));_0x5b66dc[_0x6059('0x27')]=_[_0x6059('0x28')](_0x2c1f15['query']);_0x5b66dc[_0x6059('0x29')]=_[_0x6059('0x2a')](_0x5b66dc[_0x6059('0x26')],_0x5b66dc[_0x6059('0x27')]);_0x1e4b04['attributes']=_[_0x6059('0x2a')](_0x5b66dc[_0x6059('0x26')],qs[_0x6059('0x2b')](_0x2c1f15['query']['fields']));_0x1e4b04['attributes']=_0x1e4b04[_0x6059('0x2c')][_0x6059('0x2d')]?_0x1e4b04[_0x6059('0x2c')]:_0x5b66dc[_0x6059('0x26')];if(!_0x2c1f15['query'][_0x6059('0x2e')](_0x6059('0x2f'))){_0x1e4b04[_0x6059('0x30')]=qs[_0x6059('0x30')](_0x2c1f15[_0x6059('0x27')][_0x6059('0x30')]);_0x1e4b04[_0x6059('0x16')]=qs['offset'](_0x2c1f15[_0x6059('0x27')][_0x6059('0x16')]);}_0x1e4b04['order']=qs['sort'](_0x2c1f15[_0x6059('0x27')][_0x6059('0x31')]);_0x1e4b04[_0x6059('0x32')]=qs[_0x6059('0x29')](_[_0x6059('0x33')](_0x2c1f15[_0x6059('0x27')],_0x5b66dc['filters']),_0x12d219);if(_0x2c1f15['query'][_0x6059('0x34')]){_0x1e4b04[_0x6059('0x32')]=_[_0x6059('0x35')](_0x1e4b04['where'],{'$or':_['map'](_0x12d219,function(_0x114156){if(_0x114156[_0x6059('0x36')]!==_0x6059('0x37')){var _0x1bb930={};_0x1bb930[_0x114156['name']]={'$like':'%'+_0x2c1f15['query'][_0x6059('0x34')]+'%'};return _0x1bb930;}})});}_0x1e4b04=_['merge']({},_0x1e4b04,_0x2c1f15[_0x6059('0x38')]);var _0x17f4fa={'where':_0x1e4b04[_0x6059('0x32')]};return db['AnalyticTreeReport'][_0x6059('0x15')](_0x17f4fa)['then'](function(_0x180041){_0x311bd4[_0x6059('0x15')]=_0x180041;if(_0x2c1f15[_0x6059('0x27')][_0x6059('0x39')]){_0x1e4b04[_0x6059('0x3a')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x6059('0x3b')](_0x1e4b04);})[_0x6059('0x1d')](function(_0x4a2f54){_0x311bd4['rows']=_0x4a2f54;return _0x311bd4;})[_0x6059('0x1d')](respondWithFilteredResult(_0x469f5b,_0x1e4b04))[_0x6059('0x3c')](handleError(_0x469f5b,null));};exports[_0x6059('0x3d')]=function(_0x1bfb6a,_0x254667){var _0x4c4de9={'raw':!![],'where':{'id':_0x1bfb6a[_0x6059('0x3e')]['id']}},_0x519c4e={};_0x519c4e[_0x6059('0x26')]=_[_0x6059('0x28')](db[_0x6059('0x22')][_0x6059('0x23')]);_0x519c4e[_0x6059('0x27')]=_['keys'](_0x1bfb6a[_0x6059('0x27')]);_0x519c4e[_0x6059('0x29')]=_[_0x6059('0x2a')](_0x519c4e['model'],_0x519c4e[_0x6059('0x27')]);_0x4c4de9[_0x6059('0x2c')]=_[_0x6059('0x2a')](_0x519c4e['model'],qs[_0x6059('0x2b')](_0x1bfb6a[_0x6059('0x27')][_0x6059('0x2b')]));_0x4c4de9[_0x6059('0x2c')]=_0x4c4de9[_0x6059('0x2c')][_0x6059('0x2d')]?_0x4c4de9[_0x6059('0x2c')]:_0x519c4e[_0x6059('0x26')];if(_0x1bfb6a[_0x6059('0x27')][_0x6059('0x39')]){_0x4c4de9['include']=[{'all':!![]}];}_0x4c4de9=_[_0x6059('0x35')]({},_0x4c4de9,_0x1bfb6a[_0x6059('0x38')]);return db[_0x6059('0x22')]['find'](_0x4c4de9)[_0x6059('0x1d')](handleEntityNotFound(_0x254667,null))['then'](respondWithResult(_0x254667,null))['catch'](handleError(_0x254667,null));};exports[_0x6059('0x3f')]=function(_0x17ba95,_0x42a8e4){return db[_0x6059('0x22')]['create'](_0x17ba95['body'],{})[_0x6059('0x1d')](respondWithResult(_0x42a8e4,0xc9))['catch'](handleError(_0x42a8e4,null));};exports[_0x6059('0x1c')]=function(_0x33ab52,_0x32f375){if(_0x33ab52[_0x6059('0x40')]['id']){delete _0x33ab52[_0x6059('0x40')]['id'];}return db[_0x6059('0x22')][_0x6059('0x41')]({'where':{'id':_0x33ab52[_0x6059('0x3e')]['id']}})[_0x6059('0x1d')](handleEntityNotFound(_0x32f375,null))[_0x6059('0x1d')](saveUpdates(_0x33ab52[_0x6059('0x40')],null))[_0x6059('0x1d')](respondWithResult(_0x32f375,null))[_0x6059('0x3c')](handleError(_0x32f375,null));};exports[_0x6059('0x1e')]=function(_0x364b66,_0x2f4580){return db[_0x6059('0x22')][_0x6059('0x41')]({'where':{'id':_0x364b66[_0x6059('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2f4580,null))['then'](removeEntity(_0x2f4580,null))[_0x6059('0x3c')](handleError(_0x2f4580,null));}; \ No newline at end of file +var _0x7954=['order','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2490b7,_0x1e042e){var _0x2ec8ad=function(_0x45e310){while(--_0x45e310){_0x2490b7['push'](_0x2490b7['shift']());}};_0x2ec8ad(++_0x1e042e);}(_0x7954,0xed));var _0x4795=function(_0x18239b,_0x1623a3){_0x18239b=_0x18239b-0x0;var _0xcfd404=_0x7954[_0x18239b];return _0xcfd404;};'use strict';var pdf=require(_0x4795('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4795('0x1'));var jsonpatch=require(_0x4795('0x2'));var rp=require(_0x4795('0x3'));var moment=require('moment');var BPromise=require(_0x4795('0x4'));var Mustache=require(_0x4795('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4795('0x6'));var csv=require(_0x4795('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4795('0x8'));var squel=require(_0x4795('0x9'));var crypto=require('crypto');var jsforce=require(_0x4795('0xa'));var deskjs=require(_0x4795('0xb'));var toCsv=require(_0x4795('0x7'));var querystring=require('querystring');var Papa=require(_0x4795('0xc'));var Redis=require(_0x4795('0xd'));var authService=require(_0x4795('0xe'));var qs=require(_0x4795('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4795('0x10'));var logger=require(_0x4795('0x11'))(_0x4795('0x12'));var utils=require(_0x4795('0x13'));var config=require(_0x4795('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42ffd2,_0x174c8d){_0x174c8d=_0x174c8d||0xcc;return function(_0x55e414){if(_0x55e414){return _0x42ffd2[_0x4795('0x15')](_0x174c8d);}return _0x42ffd2['status'](_0x174c8d)[_0x4795('0x16')]();};}function respondWithResult(_0x4f26ef,_0x567f64){_0x567f64=_0x567f64||0xc8;return function(_0xef38c6){if(_0xef38c6){return _0x4f26ef[_0x4795('0x17')](_0x567f64)[_0x4795('0x18')](_0xef38c6);}};}function respondWithFilteredResult(_0x2c1d2e,_0x12ba6b){return function(_0xb4ddc5){if(_0xb4ddc5){var _0x244a59=_0xb4ddc5[_0x4795('0x19')],_0x20ae72=_0x12ba6b[_0x4795('0x1a')],_0x395efb=_0x12ba6b['offset']+_0x12ba6b[_0x4795('0x1b')],_0x5da27f;if(_0x395efb>=_0x244a59){_0x395efb=_0x244a59;_0x5da27f=0xc8;}else{_0x5da27f=0xce;}_0x2c1d2e[_0x4795('0x17')](_0x5da27f);return _0x2c1d2e[_0x4795('0x1c')](_0x4795('0x1d'),_0x20ae72+'-'+_0x395efb+'/'+_0x244a59)[_0x4795('0x18')](_0xb4ddc5);}return null;};}function patchUpdates(_0x6ac79d){return function(_0x329c32){try{jsonpatch['apply'](_0x329c32,_0x6ac79d,!![]);}catch(_0x2b3e0c){return BPromise[_0x4795('0x1e')](_0x2b3e0c);}return _0x329c32[_0x4795('0x1f')]();};}function saveUpdates(_0x4d456c,_0x41f915){return function(_0x571c61){if(_0x571c61){return _0x571c61['update'](_0x4d456c)['then'](function(_0x33b183){return _0x33b183;});}return null;};}function removeEntity(_0x9320fb,_0x5eee6e){return function(_0x58ff27){if(_0x58ff27){return _0x58ff27[_0x4795('0x20')]()[_0x4795('0x21')](function(){_0x9320fb[_0x4795('0x17')](0xcc)[_0x4795('0x16')]();});}};}function handleEntityNotFound(_0x44a1b2,_0x8f678a){return function(_0x428a38){if(!_0x428a38){_0x44a1b2['sendStatus'](0x194);}return _0x428a38;};}function handleError(_0x1f1263,_0x221ff1){_0x221ff1=_0x221ff1||0x1f4;return function(_0x8c6cec){logger['error'](_0x8c6cec[_0x4795('0x22')]);if(_0x8c6cec[_0x4795('0x23')]){delete _0x8c6cec[_0x4795('0x23')];}_0x1f1263['status'](_0x221ff1)[_0x4795('0x24')](_0x8c6cec);};}exports[_0x4795('0x25')]=function(_0x2385d3,_0x5bdba0){var _0x503460={},_0x1dda70={},_0x338704={'count':0x0,'rows':[]};var _0x5bb789=_[_0x4795('0x26')](db['AnalyticTreeReport'][_0x4795('0x27')],function(_0x3cb899){return{'name':_0x3cb899[_0x4795('0x28')],'type':_0x3cb899[_0x4795('0x29')]['key']};});_0x1dda70[_0x4795('0x2a')]=_[_0x4795('0x26')](_0x5bb789,_0x4795('0x23'));_0x1dda70['query']=_[_0x4795('0x2b')](_0x2385d3[_0x4795('0x2c')]);_0x1dda70[_0x4795('0x2d')]=_[_0x4795('0x2e')](_0x1dda70[_0x4795('0x2a')],_0x1dda70[_0x4795('0x2c')]);_0x503460[_0x4795('0x2f')]=_['intersection'](_0x1dda70[_0x4795('0x2a')],qs[_0x4795('0x30')](_0x2385d3[_0x4795('0x2c')][_0x4795('0x30')]));_0x503460[_0x4795('0x2f')]=_0x503460['attributes']['length']?_0x503460['attributes']:_0x1dda70[_0x4795('0x2a')];if(!_0x2385d3[_0x4795('0x2c')][_0x4795('0x31')](_0x4795('0x32'))){_0x503460[_0x4795('0x1b')]=qs[_0x4795('0x1b')](_0x2385d3[_0x4795('0x2c')][_0x4795('0x1b')]);_0x503460[_0x4795('0x1a')]=qs['offset'](_0x2385d3[_0x4795('0x2c')]['offset']);}_0x503460[_0x4795('0x33')]=qs[_0x4795('0x34')](_0x2385d3['query'][_0x4795('0x34')]);_0x503460['where']=qs[_0x4795('0x2d')](_[_0x4795('0x35')](_0x2385d3[_0x4795('0x2c')],_0x1dda70[_0x4795('0x2d')]),_0x5bb789);if(_0x2385d3[_0x4795('0x2c')][_0x4795('0x36')]){_0x503460[_0x4795('0x37')]=_[_0x4795('0x38')](_0x503460[_0x4795('0x37')],{'$or':_[_0x4795('0x26')](_0x5bb789,function(_0x37c337){if(_0x37c337[_0x4795('0x29')]!==_0x4795('0x39')){var _0xb2287={};_0xb2287[_0x37c337[_0x4795('0x23')]]={'$like':'%'+_0x2385d3['query']['filter']+'%'};return _0xb2287;}})});}_0x503460=_['merge']({},_0x503460,_0x2385d3[_0x4795('0x3a')]);var _0x1590e1={'where':_0x503460[_0x4795('0x37')]};return db[_0x4795('0x3b')][_0x4795('0x19')](_0x1590e1)[_0x4795('0x21')](function(_0x4dd833){_0x338704['count']=_0x4dd833;if(_0x2385d3[_0x4795('0x2c')][_0x4795('0x3c')]){_0x503460[_0x4795('0x3d')]=[{'all':!![]}];}return db[_0x4795('0x3b')][_0x4795('0x3e')](_0x503460);})['then'](function(_0x34daaa){_0x338704[_0x4795('0x3f')]=_0x34daaa;return _0x338704;})[_0x4795('0x21')](respondWithFilteredResult(_0x5bdba0,_0x503460))[_0x4795('0x40')](handleError(_0x5bdba0,null));};exports[_0x4795('0x41')]=function(_0x2f1c3a,_0x1f2d98){var _0x4e3e0a={'raw':!![],'where':{'id':_0x2f1c3a[_0x4795('0x42')]['id']}},_0x1b2785={};_0x1b2785[_0x4795('0x2a')]=_['keys'](db['AnalyticTreeReport'][_0x4795('0x27')]);_0x1b2785[_0x4795('0x2c')]=_['keys'](_0x2f1c3a[_0x4795('0x2c')]);_0x1b2785[_0x4795('0x2d')]=_['intersection'](_0x1b2785[_0x4795('0x2a')],_0x1b2785[_0x4795('0x2c')]);_0x4e3e0a[_0x4795('0x2f')]=_['intersection'](_0x1b2785[_0x4795('0x2a')],qs[_0x4795('0x30')](_0x2f1c3a[_0x4795('0x2c')]['fields']));_0x4e3e0a['attributes']=_0x4e3e0a['attributes'][_0x4795('0x43')]?_0x4e3e0a[_0x4795('0x2f')]:_0x1b2785[_0x4795('0x2a')];if(_0x2f1c3a[_0x4795('0x2c')][_0x4795('0x3c')]){_0x4e3e0a[_0x4795('0x3d')]=[{'all':!![]}];}_0x4e3e0a=_['merge']({},_0x4e3e0a,_0x2f1c3a['options']);return db['AnalyticTreeReport'][_0x4795('0x44')](_0x4e3e0a)['then'](handleEntityNotFound(_0x1f2d98,null))[_0x4795('0x21')](respondWithResult(_0x1f2d98,null))['catch'](handleError(_0x1f2d98,null));};exports[_0x4795('0x45')]=function(_0x5736e6,_0x1dd11a){return db['AnalyticTreeReport'][_0x4795('0x45')](_0x5736e6[_0x4795('0x46')],{})[_0x4795('0x21')](respondWithResult(_0x1dd11a,0xc9))[_0x4795('0x40')](handleError(_0x1dd11a,null));};exports[_0x4795('0x47')]=function(_0x31bc4f,_0x2dd289){if(_0x31bc4f[_0x4795('0x46')]['id']){delete _0x31bc4f[_0x4795('0x46')]['id'];}return db[_0x4795('0x3b')][_0x4795('0x44')]({'where':{'id':_0x31bc4f['params']['id']}})[_0x4795('0x21')](handleEntityNotFound(_0x2dd289,null))[_0x4795('0x21')](saveUpdates(_0x31bc4f[_0x4795('0x46')],null))[_0x4795('0x21')](respondWithResult(_0x2dd289,null))[_0x4795('0x40')](handleError(_0x2dd289,null));};exports[_0x4795('0x20')]=function(_0x33732c,_0x3d597b){return db[_0x4795('0x3b')][_0x4795('0x44')]({'where':{'id':_0x33732c[_0x4795('0x42')]['id']}})[_0x4795('0x21')](handleEntityNotFound(_0x3d597b,null))[_0x4795('0x21')](removeEntity(_0x3d597b,null))['catch'](handleError(_0x3d597b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 104b49c..233acd9 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 _0xb44a=['request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa18483,_0x837744){var _0x42e34d=function(_0x3d3cef){while(--_0x3d3cef){_0xa18483['push'](_0xa18483['shift']());}};_0x42e34d(++_0x837744);}(_0xb44a,0x11a));var _0xab44=function(_0xee37f1,_0x189f43){_0xee37f1=_0xee37f1-0x0;var _0x37fd54=_0xb44a[_0xee37f1];return _0x37fd54;};'use strict';var _=require(_0xab44('0x0'));var util=require(_0xab44('0x1'));var logger=require(_0xab44('0x2'))(_0xab44('0x3'));var moment=require(_0xab44('0x4'));var BPromise=require(_0xab44('0x5'));var rp=require(_0xab44('0x6'));var fs=require('fs');var path=require(_0xab44('0x7'));var rimraf=require('rimraf');var config=require(_0xab44('0x8'));var attributes=require(_0xab44('0x9'));module[_0xab44('0xa')]=function(_0xbafb86,_0x1f5fbe){return _0xbafb86['define']('AnalyticTreeReport',attributes,{'tableName':_0xab44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c28=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x7c28,0x65));var _0x87c2=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x7c28[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x87c2('0x0'));var util=require(_0x87c2('0x1'));var logger=require(_0x87c2('0x2'))(_0x87c2('0x3'));var moment=require(_0x87c2('0x4'));var BPromise=require(_0x87c2('0x5'));var rp=require(_0x87c2('0x6'));var fs=require('fs');var path=require(_0x87c2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x36f031,_0x30a10e){return _0x36f031[_0x87c2('0x8')](_0x87c2('0x9'),attributes,{'tableName':_0x87c2('0xa'),'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 6ee7da2..abb96f4 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 _0x39aa=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x252c77,_0x48ca00){var _0x68d7a3=function(_0x36b4d2){while(--_0x36b4d2){_0x252c77['push'](_0x252c77['shift']());}};_0x68d7a3(++_0x48ca00);}(_0x39aa,0x12e));var _0xa39a=function(_0x61fd3a,_0x15a094){_0x61fd3a=_0x61fd3a-0x0;var _0x546d6b=_0x39aa[_0x61fd3a];return _0x546d6b;};'use strict';var _=require(_0xa39a('0x0'));var util=require(_0xa39a('0x1'));var moment=require(_0xa39a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa39a('0x3'));var db=require(_0xa39a('0x4'))['db'];var utils=require(_0xa39a('0x5'));var logger=require(_0xa39a('0x6'))(_0xa39a('0x7'));var config=require(_0xa39a('0x8'));var jayson=require(_0xa39a('0x9'));var client=jayson[_0xa39a('0xa')][_0xa39a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39b47c,_0x4bb74c,_0x21fffb){return new BPromise(function(_0x32e882,_0x3d91ef){return client['request'](_0x39b47c,_0x21fffb)['then'](function(_0x253b99){logger[_0xa39a('0xc')](_0xa39a('0xd'),_0x4bb74c,_0xa39a('0xe'));logger['debug'](_0xa39a('0xf'),_0x4bb74c,_0xa39a('0xe'),JSON[_0xa39a('0x10')](_0x253b99));if(_0x253b99[_0xa39a('0x11')]){if(_0x253b99[_0xa39a('0x11')][_0xa39a('0x12')]===0x1f4){logger['error'](_0xa39a('0xd'),_0x4bb74c,_0x253b99[_0xa39a('0x11')][_0xa39a('0x13')]);return _0x3d91ef(_0x253b99[_0xa39a('0x11')][_0xa39a('0x13')]);}logger['error'](_0xa39a('0xd'),_0x4bb74c,_0x253b99['error'][_0xa39a('0x13')]);return _0x32e882(_0x253b99[_0xa39a('0x11')][_0xa39a('0x13')]);}else{logger[_0xa39a('0xc')](_0xa39a('0xd'),_0x4bb74c,_0xa39a('0xe'));_0x32e882(_0x253b99[_0xa39a('0x14')][_0xa39a('0x13')]);}})[_0xa39a('0x15')](function(_0x3292cd){logger[_0xa39a('0x11')](_0xa39a('0xd'),_0x4bb74c,_0x3292cd);_0x3d91ef(_0x3292cd);});});} \ No newline at end of file +var _0x09d3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x159fb5,_0x580031){var _0xccb8d1=function(_0x41418b){while(--_0x41418b){_0x159fb5['push'](_0x159fb5['shift']());}};_0xccb8d1(++_0x580031);}(_0x09d3,0xf9));var _0x309d=function(_0x2844dc,_0xc5df39){_0x2844dc=_0x2844dc-0x0;var _0x4cc6d4=_0x09d3[_0x2844dc];return _0x4cc6d4;};'use strict';var _=require('lodash');var util=require(_0x309d('0x0'));var moment=require(_0x309d('0x1'));var BPromise=require(_0x309d('0x2'));var rs=require(_0x309d('0x3'));var fs=require('fs');var Redis=require(_0x309d('0x4'));var db=require(_0x309d('0x5'))['db'];var utils=require(_0x309d('0x6'));var logger=require(_0x309d('0x7'))(_0x309d('0x8'));var config=require('../../config/environment');var jayson=require(_0x309d('0x9'));var client=jayson[_0x309d('0xa')][_0x309d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46c6a8,_0x572ab6,_0x25c0a9){return new BPromise(function(_0x2f5ef9,_0x480d05){return client[_0x309d('0xc')](_0x46c6a8,_0x25c0a9)[_0x309d('0xd')](function(_0x34f3d0){logger[_0x309d('0xe')](_0x309d('0xf'),_0x572ab6,_0x309d('0x10'));logger[_0x309d('0x11')](_0x309d('0x12'),_0x572ab6,_0x309d('0x10'),JSON[_0x309d('0x13')](_0x34f3d0));if(_0x34f3d0['error']){if(_0x34f3d0[_0x309d('0x14')][_0x309d('0x15')]===0x1f4){logger[_0x309d('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x572ab6,_0x34f3d0[_0x309d('0x14')][_0x309d('0x16')]);return _0x480d05(_0x34f3d0[_0x309d('0x14')][_0x309d('0x16')]);}logger[_0x309d('0x14')](_0x309d('0xf'),_0x572ab6,_0x34f3d0[_0x309d('0x14')]['message']);return _0x2f5ef9(_0x34f3d0[_0x309d('0x14')]['message']);}else{logger[_0x309d('0xe')](_0x309d('0xf'),_0x572ab6,_0x309d('0x10'));_0x2f5ef9(_0x34f3d0[_0x309d('0x17')][_0x309d('0x16')]);}})[_0x309d('0x18')](function(_0x474db7){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x572ab6,_0x474db7);_0x480d05(_0x474db7);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3c967eb..dad0a9a 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 _0xf7ea=['isAuthenticated','/:id','show','create','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7ea,0xaa));var _0xaf7e=function(_0x336a3b,_0x1d422c){_0x336a3b=_0x336a3b-0x0;var _0x1f505a=_0xf7ea[_0x336a3b];return _0x1f505a;};'use strict';var multer=require(_0xaf7e('0x0'));var util=require(_0xaf7e('0x1'));var path=require(_0xaf7e('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf7e('0x3'));var router=express[_0xaf7e('0x4')]();var auth=require(_0xaf7e('0x5'));var interaction=require(_0xaf7e('0x6'));var config=require(_0xaf7e('0x7'));var controller=require(_0xaf7e('0x8'));router[_0xaf7e('0x9')]('/',auth[_0xaf7e('0xa')](),controller['index']);router[_0xaf7e('0x9')](_0xaf7e('0xb'),auth['isAuthenticated'](),controller[_0xaf7e('0xc')]);router['post']('/',auth[_0xaf7e('0xa')](),controller[_0xaf7e('0xd')]);router['put']('/:id',auth[_0xaf7e('0xa')](),controller['update']);router['delete'](_0xaf7e('0xb'),auth[_0xaf7e('0xa')](),controller['destroy']);module[_0xaf7e('0xe')]=router; \ No newline at end of file +var _0x6c6f=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x264cba,_0x490da5){var _0x1ee7b7=function(_0x5b2b3f){while(--_0x5b2b3f){_0x264cba['push'](_0x264cba['shift']());}};_0x1ee7b7(++_0x490da5);}(_0x6c6f,0xc0));var _0xf6c6=function(_0x1d90dc,_0xf7344d){_0x1d90dc=_0x1d90dc-0x0;var _0x34a86f=_0x6c6f[_0x1d90dc];return _0x34a86f;};'use strict';var multer=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var path=require(_0xf6c6('0x2'));var timeout=require(_0xf6c6('0x3'));var express=require(_0xf6c6('0x4'));var router=express[_0xf6c6('0x5')]();var auth=require(_0xf6c6('0x6'));var interaction=require(_0xf6c6('0x7'));var config=require(_0xf6c6('0x8'));var controller=require(_0xf6c6('0x9'));router[_0xf6c6('0xa')]('/',auth[_0xf6c6('0xb')](),controller['index']);router[_0xf6c6('0xa')](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0xd')]);router[_0xf6c6('0xe')]('/',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0xf')]);router[_0xf6c6('0x10')](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller['update']);router[_0xf6c6('0x11')](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x12')]);module[_0xf6c6('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9c6ae35..3b42a57 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 _0x395c=['sequelize','STRING'];(function(_0x37544b,_0x239ad2){var _0x1a56b4=function(_0x946e2e){while(--_0x946e2e){_0x37544b['push'](_0x37544b['shift']());}};_0x1a56b4(++_0x239ad2);}(_0x395c,0x146));var _0xc395=function(_0x46bdeb,_0x3834da){_0x46bdeb=_0x46bdeb-0x0;var _0xa8c210=_0x395c[_0x46bdeb];return _0xa8c210;};'use strict';var Sequelize=require(_0xc395('0x0'));module['exports']={'name':{'type':Sequelize[_0xc395('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc395('0x1')]}}; \ No newline at end of file +var _0x7a61=['exports','STRING','sequelize'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0x7a61,0x92));var _0x17a6=function(_0x5859a4,_0x15df60){_0x5859a4=_0x5859a4-0x0;var _0x53d3ad=_0x7a61[_0x5859a4];return _0x53d3ad;};'use strict';var Sequelize=require(_0x17a6('0x0'));module[_0x17a6('0x1')]={'name':{'type':Sequelize[_0x17a6('0x2')]},'basename':{'type':Sequelize[_0x17a6('0x2')]},'type':{'type':Sequelize[_0x17a6('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d136e81..5bae312 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 _0xe74e=['find','clone','options','get','createdAt','body','omit','create','update','originalname','basename','file','mimetype','findOne','download','join','root','server/files/attachments/','eml-format','request-promise','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','end','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','show','params','length'];(function(_0x47e3de,_0x386d59){var _0x38f904=function(_0x126db9){while(--_0x126db9){_0x47e3de['push'](_0x47e3de['shift']());}};_0x38f904(++_0x386d59);}(_0xe74e,0x102));var _0xee74=function(_0x1f29fb,_0x5ccfd4){_0x1f29fb=_0x1f29fb-0x0;var _0x3d47aa=_0xe74e[_0x1f29fb];return _0x3d47aa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xee74('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee74('0x1'));var moment=require('moment');var BPromise=require(_0xee74('0x2'));var Mustache=require('mustache');var util=require(_0xee74('0x3'));var path=require(_0xee74('0x4'));var sox=require('sox');var csv=require(_0xee74('0x5'));var ejs=require(_0xee74('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xee74('0x7'));var crypto=require('crypto');var jsforce=require(_0xee74('0x8'));var deskjs=require(_0xee74('0x9'));var toCsv=require('to-csv');var querystring=require(_0xee74('0xa'));var Papa=require(_0xee74('0xb'));var Redis=require('ioredis');var authService=require(_0xee74('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xee74('0xd'));var hardwareService=require(_0xee74('0xe'));var logger=require(_0xee74('0xf'))('api');var utils=require(_0xee74('0x10'));var config=require(_0xee74('0x11'));var db=require(_0xee74('0x12'))['db'];function respondWithStatusCode(_0x51ef86,_0x1b8149){_0x1b8149=_0x1b8149||0xcc;return function(_0x480fe3){if(_0x480fe3){return _0x51ef86[_0xee74('0x13')](_0x1b8149);}return _0x51ef86[_0xee74('0x14')](_0x1b8149)['end']();};}function respondWithResult(_0xaab6e9,_0x457244){_0x457244=_0x457244||0xc8;return function(_0xe1b122){if(_0xe1b122){return _0xaab6e9['status'](_0x457244)[_0xee74('0x15')](_0xe1b122);}};}function respondWithFilteredResult(_0x106efd,_0x1bbe3b){return function(_0x54d9b3){if(_0x54d9b3){var _0x5da224=_0x54d9b3['count'],_0x4b9dca=_0x1bbe3b[_0xee74('0x16')],_0x471724=_0x1bbe3b['offset']+_0x1bbe3b[_0xee74('0x17')],_0x2261cc;if(_0x471724>=_0x5da224){_0x471724=_0x5da224;_0x2261cc=0xc8;}else{_0x2261cc=0xce;}_0x106efd[_0xee74('0x14')](_0x2261cc);return _0x106efd[_0xee74('0x18')](_0xee74('0x19'),_0x4b9dca+'-'+_0x471724+'/'+_0x5da224)[_0xee74('0x15')](_0x54d9b3);}return null;};}function patchUpdates(_0x18dae8){return function(_0x22ab7a){try{jsonpatch[_0xee74('0x1a')](_0x22ab7a,_0x18dae8,!![]);}catch(_0x12d402){return BPromise[_0xee74('0x1b')](_0x12d402);}return _0x22ab7a['save']();};}function saveUpdates(_0x2ab1ec,_0x23aad8){return function(_0xb02d26){if(_0xb02d26){return _0xb02d26['update'](_0x2ab1ec)[_0xee74('0x1c')](function(_0x53d576){return _0x53d576;});}return null;};}function removeEntity(_0x43cd72,_0x8c700){return function(_0x3b9e13){if(_0x3b9e13){return _0x3b9e13[_0xee74('0x1d')]()[_0xee74('0x1c')](function(){_0x43cd72[_0xee74('0x14')](0xcc)[_0xee74('0x1e')]();});}};}function handleEntityNotFound(_0x486b33,_0x441818){return function(_0x13c530){if(!_0x13c530){_0x486b33[_0xee74('0x13')](0x194);}return _0x13c530;};}function handleError(_0x75e256,_0x358d4e){_0x358d4e=_0x358d4e||0x1f4;return function(_0x14be50){logger['error'](_0x14be50['stack']);if(_0x14be50['name']){delete _0x14be50[_0xee74('0x1f')];}_0x75e256['status'](_0x358d4e)['send'](_0x14be50);};}exports[_0xee74('0x20')]=function(_0x47e34f,_0x30add2){var _0x5b97f3={},_0x43474f={},_0x7425b9={'count':0x0,'rows':[]};var _0x4f4b73=_[_0xee74('0x21')](db[_0xee74('0x22')][_0xee74('0x23')],function(_0x540acb){return{'name':_0x540acb[_0xee74('0x24')],'type':_0x540acb[_0xee74('0x25')][_0xee74('0x26')]};});_0x43474f[_0xee74('0x27')]=_[_0xee74('0x21')](_0x4f4b73,_0xee74('0x1f'));_0x43474f[_0xee74('0x28')]=_[_0xee74('0x29')](_0x47e34f[_0xee74('0x28')]);_0x43474f[_0xee74('0x2a')]=_[_0xee74('0x2b')](_0x43474f['model'],_0x43474f[_0xee74('0x28')]);_0x5b97f3['attributes']=_[_0xee74('0x2b')](_0x43474f[_0xee74('0x27')],qs[_0xee74('0x2c')](_0x47e34f[_0xee74('0x28')][_0xee74('0x2c')]));_0x5b97f3[_0xee74('0x2d')]=_0x5b97f3['attributes']['length']?_0x5b97f3[_0xee74('0x2d')]:_0x43474f[_0xee74('0x27')];if(!_0x47e34f[_0xee74('0x28')][_0xee74('0x2e')](_0xee74('0x2f'))){_0x5b97f3[_0xee74('0x17')]=qs[_0xee74('0x17')](_0x47e34f[_0xee74('0x28')][_0xee74('0x17')]);_0x5b97f3['offset']=qs[_0xee74('0x16')](_0x47e34f[_0xee74('0x28')][_0xee74('0x16')]);}_0x5b97f3['order']=qs[_0xee74('0x30')](_0x47e34f[_0xee74('0x28')][_0xee74('0x30')]);_0x5b97f3[_0xee74('0x31')]=qs[_0xee74('0x2a')](_[_0xee74('0x32')](_0x47e34f[_0xee74('0x28')],_0x43474f['filters']),_0x4f4b73);if(_0x47e34f[_0xee74('0x28')]['filter']){_0x5b97f3[_0xee74('0x31')]=_[_0xee74('0x33')](_0x5b97f3[_0xee74('0x31')],{'$or':_[_0xee74('0x21')](_0x4f4b73,function(_0x56b49c){if(_0x56b49c[_0xee74('0x25')]!==_0xee74('0x34')){var _0x5a69f8={};_0x5a69f8[_0x56b49c['name']]={'$like':'%'+_0x47e34f['query'][_0xee74('0x35')]+'%'};return _0x5a69f8;}})});}_0x5b97f3=_[_0xee74('0x33')]({},_0x5b97f3,_0x47e34f['options']);var _0x6cb2b8={'where':_0x5b97f3[_0xee74('0x31')]};return db[_0xee74('0x22')][_0xee74('0x36')](_0x6cb2b8)[_0xee74('0x1c')](function(_0x324c0d){_0x7425b9[_0xee74('0x36')]=_0x324c0d;if(_0x47e34f['query'][_0xee74('0x37')]){_0x5b97f3[_0xee74('0x38')]=[{'all':!![]}];}return db[_0xee74('0x22')][_0xee74('0x39')](_0x5b97f3);})[_0xee74('0x1c')](function(_0x44c4ed){_0x7425b9['rows']=_0x44c4ed;return _0x7425b9;})[_0xee74('0x1c')](respondWithFilteredResult(_0x30add2,_0x5b97f3))[_0xee74('0x3a')](handleError(_0x30add2,null));};exports[_0xee74('0x3b')]=function(_0x4c3882,_0x37b28d){var _0x5bc192={'raw':!![],'where':{'id':_0x4c3882[_0xee74('0x3c')]['id']}},_0x266beb={};_0x266beb['model']=_[_0xee74('0x29')](db[_0xee74('0x22')][_0xee74('0x23')]);_0x266beb[_0xee74('0x28')]=_[_0xee74('0x29')](_0x4c3882[_0xee74('0x28')]);_0x266beb['filters']=_[_0xee74('0x2b')](_0x266beb[_0xee74('0x27')],_0x266beb['query']);_0x5bc192[_0xee74('0x2d')]=_['intersection'](_0x266beb[_0xee74('0x27')],qs['fields'](_0x4c3882[_0xee74('0x28')][_0xee74('0x2c')]));_0x5bc192[_0xee74('0x2d')]=_0x5bc192[_0xee74('0x2d')][_0xee74('0x3d')]?_0x5bc192['attributes']:_0x266beb[_0xee74('0x27')];if(_0x4c3882[_0xee74('0x28')][_0xee74('0x37')]){_0x5bc192['include']=[{'all':!![]}];}_0x5bc192=_[_0xee74('0x33')]({},_0x5bc192,_0x4c3882['options']);return db[_0xee74('0x22')][_0xee74('0x3e')](_0x5bc192)['then'](handleEntityNotFound(_0x37b28d,null))[_0xee74('0x1c')](respondWithResult(_0x37b28d,null))[_0xee74('0x3a')](handleError(_0x37b28d,null));};exports[_0xee74('0x3f')]=function(_0x4c6424,_0x5656b3){var _0x130b38={'where':{'id':_0x4c6424['params']['id']}},_0x508c8f={};_0x508c8f[_0xee74('0x27')]=_[_0xee74('0x29')](db['Attachment'][_0xee74('0x23')]);_0x130b38[_0xee74('0x2d')]=_[_0xee74('0x2b')](_0x508c8f[_0xee74('0x27')],qs[_0xee74('0x2c')](_0x4c6424['query'][_0xee74('0x2c')]));_0x130b38[_0xee74('0x2d')]=_0x130b38[_0xee74('0x2d')][_0xee74('0x3d')]?_0x130b38['attributes']:_0x508c8f[_0xee74('0x27')];if(_0x4c6424['query']['includeAll']){_0x130b38['include']=[{'all':!![]}];}_0x130b38=_[_0xee74('0x33')]({},_0x130b38,_0x4c6424[_0xee74('0x40')]);return db[_0xee74('0x22')]['find'](_0x130b38)[_0xee74('0x1c')](handleEntityNotFound(_0x5656b3,null))[_0xee74('0x1c')](function(_0x2147ac){if(_0x2147ac){var _0x5c816b=_0x2147ac[_0xee74('0x41')]({'plain':!![]});_0x5c816b=qs['omit'](_0x5c816b,['id',_0xee74('0x42'),'updatedAt']);_0x4c6424[_0xee74('0x43')]=_[_0xee74('0x44')](_0x4c6424['body'],['id','createdAt','updatedAt']);return db[_0xee74('0x22')][_0xee74('0x45')](_[_0xee74('0x33')](_0x5c816b,_0x4c6424[_0xee74('0x43')]),{'include':_0x4c6424[_0xee74('0x28')][_0xee74('0x37')]?[{'all':!![]}]:undefined});}})[_0xee74('0x1c')](respondWithResult(_0x5656b3,0xc9))['catch'](handleError(_0x5656b3,null));};exports[_0xee74('0x46')]=function(_0x5db829,_0x3fd938){if(_0x5db829[_0xee74('0x43')]['id']){delete _0x5db829[_0xee74('0x43')]['id'];}return db[_0xee74('0x22')][_0xee74('0x3e')]({'where':{'id':_0x5db829[_0xee74('0x3c')]['id']}})[_0xee74('0x1c')](handleEntityNotFound(_0x3fd938,null))[_0xee74('0x1c')](saveUpdates(_0x5db829[_0xee74('0x43')],null))[_0xee74('0x1c')](respondWithResult(_0x3fd938,null))[_0xee74('0x3a')](handleError(_0x3fd938,null));};exports['destroy']=function(_0x52e280,_0x11cbba){return db[_0xee74('0x22')][_0xee74('0x3e')]({'where':{'id':_0x52e280[_0xee74('0x3c')]['id']}})[_0xee74('0x1c')](handleEntityNotFound(_0x11cbba,null))[_0xee74('0x1c')](removeEntity(_0x11cbba,null))['catch'](handleError(_0x11cbba,null));};exports[_0xee74('0x45')]=function(_0x509817,_0x391ab4,_0x438a15){_0x509817['body'][_0xee74('0x1f')]=_0x509817['file'][_0xee74('0x47')];_0x509817[_0xee74('0x43')][_0xee74('0x48')]=_0x509817[_0xee74('0x49')]['filename'];_0x509817[_0xee74('0x43')][_0xee74('0x25')]=_0x509817[_0xee74('0x49')][_0xee74('0x4a')];return db[_0xee74('0x22')][_0xee74('0x45')](_0x509817['body'])['then'](respondWithResult(_0x391ab4,0xc9))[_0xee74('0x3a')](handleError(_0x391ab4,null));};exports['download']=function(_0x6745d4,_0xb50b1c,_0x46ae26){return db[_0xee74('0x22')][_0xee74('0x4b')]({'where':{'id':_0x6745d4['params']['id']},'raw':!![]})[_0xee74('0x1c')](handleEntityNotFound(_0xb50b1c,null))[_0xee74('0x1c')](function(_0x2c2f4f){if(_0x2c2f4f){return _0xb50b1c[_0xee74('0x4c')](path[_0xee74('0x4d')](config[_0xee74('0x4e')],_0xee74('0x4f'),_0x2c2f4f['basename']));}})[_0xee74('0x3a')](handleError(_0xb50b1c,null));}; \ No newline at end of file +var _0x4f1f=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','fields','find','clone','params','get','createdAt','body','updatedAt','create','update','file','originalname','filename','type','mimetype','download','findOne','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x4f1f,0x1d2));var _0xf4f1=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x4f1f[_0x24061a];return _0x82054e;};'use strict';var pdf=require(_0xf4f1('0x0'));var emlformat=require(_0xf4f1('0x1'));var rimraf=require(_0xf4f1('0x2'));var zipdir=require(_0xf4f1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4f1('0x4'));var moment=require(_0xf4f1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf4f1('0x6'));var path=require('path');var sox=require(_0xf4f1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf4f1('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf4f1('0x9'));var deskjs=require(_0xf4f1('0xa'));var toCsv=require(_0xf4f1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf4f1('0xc'));var authService=require(_0xf4f1('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf4f1('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4f1('0xf'))(_0xf4f1('0x10'));var utils=require(_0xf4f1('0x11'));var config=require(_0xf4f1('0x12'));var db=require(_0xf4f1('0x13'))['db'];function respondWithStatusCode(_0x1439dd,_0x230ad5){_0x230ad5=_0x230ad5||0xcc;return function(_0x490934){if(_0x490934){return _0x1439dd[_0xf4f1('0x14')](_0x230ad5);}return _0x1439dd[_0xf4f1('0x15')](_0x230ad5)['end']();};}function respondWithResult(_0x4effbb,_0x34b097){_0x34b097=_0x34b097||0xc8;return function(_0x2e16be){if(_0x2e16be){return _0x4effbb[_0xf4f1('0x15')](_0x34b097)[_0xf4f1('0x16')](_0x2e16be);}};}function respondWithFilteredResult(_0x1cf98f,_0x1eec51){return function(_0x19b283){if(_0x19b283){var _0x2cf5da=_0x19b283[_0xf4f1('0x17')],_0x1bde42=_0x1eec51[_0xf4f1('0x18')],_0x3357da=_0x1eec51[_0xf4f1('0x18')]+_0x1eec51[_0xf4f1('0x19')],_0x5f33b9;if(_0x3357da>=_0x2cf5da){_0x3357da=_0x2cf5da;_0x5f33b9=0xc8;}else{_0x5f33b9=0xce;}_0x1cf98f[_0xf4f1('0x15')](_0x5f33b9);return _0x1cf98f[_0xf4f1('0x1a')](_0xf4f1('0x1b'),_0x1bde42+'-'+_0x3357da+'/'+_0x2cf5da)[_0xf4f1('0x16')](_0x19b283);}return null;};}function patchUpdates(_0xfd27d0){return function(_0x3c135f){try{jsonpatch[_0xf4f1('0x1c')](_0x3c135f,_0xfd27d0,!![]);}catch(_0x3d9d93){return BPromise['reject'](_0x3d9d93);}return _0x3c135f[_0xf4f1('0x1d')]();};}function saveUpdates(_0x188e03,_0x5ec45a){return function(_0x7ec027){if(_0x7ec027){return _0x7ec027['update'](_0x188e03)[_0xf4f1('0x1e')](function(_0x53a813){return _0x53a813;});}return null;};}function removeEntity(_0x3e46cd,_0x1f63f4){return function(_0x36165c){if(_0x36165c){return _0x36165c[_0xf4f1('0x1f')]()[_0xf4f1('0x1e')](function(){_0x3e46cd[_0xf4f1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b3ca,_0x5b5ae3){return function(_0x144f49){if(!_0x144f49){_0x19b3ca[_0xf4f1('0x14')](0x194);}return _0x144f49;};}function handleError(_0x15a14a,_0x5b5896){_0x5b5896=_0x5b5896||0x1f4;return function(_0x15b718){logger[_0xf4f1('0x20')](_0x15b718[_0xf4f1('0x21')]);if(_0x15b718['name']){delete _0x15b718[_0xf4f1('0x22')];}_0x15a14a[_0xf4f1('0x15')](_0x5b5896)['send'](_0x15b718);};}exports[_0xf4f1('0x23')]=function(_0x5e14b0,_0x56e2c3){var _0x119f3b={},_0x2889f3={},_0xfe6a97={'count':0x0,'rows':[]};var _0x243572=_[_0xf4f1('0x24')](db[_0xf4f1('0x25')][_0xf4f1('0x26')],function(_0x126366){return{'name':_0x126366[_0xf4f1('0x27')],'type':_0x126366['type']['key']};});_0x2889f3[_0xf4f1('0x28')]=_[_0xf4f1('0x24')](_0x243572,_0xf4f1('0x22'));_0x2889f3['query']=_[_0xf4f1('0x29')](_0x5e14b0[_0xf4f1('0x2a')]);_0x2889f3[_0xf4f1('0x2b')]=_[_0xf4f1('0x2c')](_0x2889f3[_0xf4f1('0x28')],_0x2889f3['query']);_0x119f3b[_0xf4f1('0x2d')]=_[_0xf4f1('0x2c')](_0x2889f3[_0xf4f1('0x28')],qs['fields'](_0x5e14b0[_0xf4f1('0x2a')]['fields']));_0x119f3b[_0xf4f1('0x2d')]=_0x119f3b[_0xf4f1('0x2d')][_0xf4f1('0x2e')]?_0x119f3b[_0xf4f1('0x2d')]:_0x2889f3[_0xf4f1('0x28')];if(!_0x5e14b0[_0xf4f1('0x2a')][_0xf4f1('0x2f')]('nolimit')){_0x119f3b[_0xf4f1('0x19')]=qs[_0xf4f1('0x19')](_0x5e14b0[_0xf4f1('0x2a')][_0xf4f1('0x19')]);_0x119f3b[_0xf4f1('0x18')]=qs[_0xf4f1('0x18')](_0x5e14b0['query'][_0xf4f1('0x18')]);}_0x119f3b[_0xf4f1('0x30')]=qs[_0xf4f1('0x31')](_0x5e14b0[_0xf4f1('0x2a')][_0xf4f1('0x31')]);_0x119f3b[_0xf4f1('0x32')]=qs[_0xf4f1('0x2b')](_[_0xf4f1('0x33')](_0x5e14b0[_0xf4f1('0x2a')],_0x2889f3[_0xf4f1('0x2b')]),_0x243572);if(_0x5e14b0['query'][_0xf4f1('0x34')]){_0x119f3b[_0xf4f1('0x32')]=_[_0xf4f1('0x35')](_0x119f3b[_0xf4f1('0x32')],{'$or':_[_0xf4f1('0x24')](_0x243572,function(_0x2e77d5){if(_0x2e77d5['type']!==_0xf4f1('0x36')){var _0x460849={};_0x460849[_0x2e77d5[_0xf4f1('0x22')]]={'$like':'%'+_0x5e14b0['query'][_0xf4f1('0x34')]+'%'};return _0x460849;}})});}_0x119f3b=_[_0xf4f1('0x35')]({},_0x119f3b,_0x5e14b0[_0xf4f1('0x37')]);var _0xc03e1f={'where':_0x119f3b[_0xf4f1('0x32')]};return db[_0xf4f1('0x25')][_0xf4f1('0x17')](_0xc03e1f)[_0xf4f1('0x1e')](function(_0x51602e){_0xfe6a97[_0xf4f1('0x17')]=_0x51602e;if(_0x5e14b0[_0xf4f1('0x2a')][_0xf4f1('0x38')]){_0x119f3b[_0xf4f1('0x39')]=[{'all':!![]}];}return db[_0xf4f1('0x25')][_0xf4f1('0x3a')](_0x119f3b);})[_0xf4f1('0x1e')](function(_0x22fcf5){_0xfe6a97['rows']=_0x22fcf5;return _0xfe6a97;})[_0xf4f1('0x1e')](respondWithFilteredResult(_0x56e2c3,_0x119f3b))[_0xf4f1('0x3b')](handleError(_0x56e2c3,null));};exports[_0xf4f1('0x3c')]=function(_0x3c1efc,_0x27e51b){var _0x21ff89={'raw':!![],'where':{'id':_0x3c1efc['params']['id']}},_0x52c0bd={};_0x52c0bd[_0xf4f1('0x28')]=_[_0xf4f1('0x29')](db['Attachment']['rawAttributes']);_0x52c0bd[_0xf4f1('0x2a')]=_[_0xf4f1('0x29')](_0x3c1efc['query']);_0x52c0bd[_0xf4f1('0x2b')]=_[_0xf4f1('0x2c')](_0x52c0bd[_0xf4f1('0x28')],_0x52c0bd[_0xf4f1('0x2a')]);_0x21ff89['attributes']=_[_0xf4f1('0x2c')](_0x52c0bd[_0xf4f1('0x28')],qs[_0xf4f1('0x3d')](_0x3c1efc['query']['fields']));_0x21ff89[_0xf4f1('0x2d')]=_0x21ff89[_0xf4f1('0x2d')][_0xf4f1('0x2e')]?_0x21ff89[_0xf4f1('0x2d')]:_0x52c0bd[_0xf4f1('0x28')];if(_0x3c1efc[_0xf4f1('0x2a')][_0xf4f1('0x38')]){_0x21ff89[_0xf4f1('0x39')]=[{'all':!![]}];}_0x21ff89=_[_0xf4f1('0x35')]({},_0x21ff89,_0x3c1efc[_0xf4f1('0x37')]);return db[_0xf4f1('0x25')][_0xf4f1('0x3e')](_0x21ff89)[_0xf4f1('0x1e')](handleEntityNotFound(_0x27e51b,null))[_0xf4f1('0x1e')](respondWithResult(_0x27e51b,null))['catch'](handleError(_0x27e51b,null));};exports[_0xf4f1('0x3f')]=function(_0x17cbca,_0x3a58c9){var _0x1e65b3={'where':{'id':_0x17cbca[_0xf4f1('0x40')]['id']}},_0x29cf8d={};_0x29cf8d['model']=_['keys'](db['Attachment'][_0xf4f1('0x26')]);_0x1e65b3[_0xf4f1('0x2d')]=_[_0xf4f1('0x2c')](_0x29cf8d[_0xf4f1('0x28')],qs[_0xf4f1('0x3d')](_0x17cbca['query'][_0xf4f1('0x3d')]));_0x1e65b3[_0xf4f1('0x2d')]=_0x1e65b3[_0xf4f1('0x2d')]['length']?_0x1e65b3['attributes']:_0x29cf8d['model'];if(_0x17cbca[_0xf4f1('0x2a')][_0xf4f1('0x38')]){_0x1e65b3[_0xf4f1('0x39')]=[{'all':!![]}];}_0x1e65b3=_[_0xf4f1('0x35')]({},_0x1e65b3,_0x17cbca[_0xf4f1('0x37')]);return db[_0xf4f1('0x25')][_0xf4f1('0x3e')](_0x1e65b3)['then'](handleEntityNotFound(_0x3a58c9,null))[_0xf4f1('0x1e')](function(_0x45f41d){if(_0x45f41d){var _0x143aeb=_0x45f41d[_0xf4f1('0x41')]({'plain':!![]});_0x143aeb=qs['omit'](_0x143aeb,['id',_0xf4f1('0x42'),'updatedAt']);_0x17cbca[_0xf4f1('0x43')]=_['omit'](_0x17cbca[_0xf4f1('0x43')],['id',_0xf4f1('0x42'),_0xf4f1('0x44')]);return db[_0xf4f1('0x25')][_0xf4f1('0x45')](_[_0xf4f1('0x35')](_0x143aeb,_0x17cbca[_0xf4f1('0x43')]),{'include':_0x17cbca['query'][_0xf4f1('0x38')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3a58c9,0xc9))[_0xf4f1('0x3b')](handleError(_0x3a58c9,null));};exports[_0xf4f1('0x46')]=function(_0x5047e1,_0x32a07b){if(_0x5047e1[_0xf4f1('0x43')]['id']){delete _0x5047e1[_0xf4f1('0x43')]['id'];}return db[_0xf4f1('0x25')][_0xf4f1('0x3e')]({'where':{'id':_0x5047e1[_0xf4f1('0x40')]['id']}})[_0xf4f1('0x1e')](handleEntityNotFound(_0x32a07b,null))[_0xf4f1('0x1e')](saveUpdates(_0x5047e1[_0xf4f1('0x43')],null))[_0xf4f1('0x1e')](respondWithResult(_0x32a07b,null))[_0xf4f1('0x3b')](handleError(_0x32a07b,null));};exports[_0xf4f1('0x1f')]=function(_0x3eac22,_0x4c37df){return db[_0xf4f1('0x25')]['find']({'where':{'id':_0x3eac22[_0xf4f1('0x40')]['id']}})[_0xf4f1('0x1e')](handleEntityNotFound(_0x4c37df,null))['then'](removeEntity(_0x4c37df,null))[_0xf4f1('0x3b')](handleError(_0x4c37df,null));};exports[_0xf4f1('0x45')]=function(_0x10936c,_0x5459ff,_0x2d1376){_0x10936c[_0xf4f1('0x43')][_0xf4f1('0x22')]=_0x10936c[_0xf4f1('0x47')][_0xf4f1('0x48')];_0x10936c[_0xf4f1('0x43')]['basename']=_0x10936c[_0xf4f1('0x47')][_0xf4f1('0x49')];_0x10936c[_0xf4f1('0x43')][_0xf4f1('0x4a')]=_0x10936c['file'][_0xf4f1('0x4b')];return db[_0xf4f1('0x25')][_0xf4f1('0x45')](_0x10936c[_0xf4f1('0x43')])[_0xf4f1('0x1e')](respondWithResult(_0x5459ff,0xc9))['catch'](handleError(_0x5459ff,null));};exports[_0xf4f1('0x4c')]=function(_0x557ada,_0x77500a,_0x339074){return db[_0xf4f1('0x25')][_0xf4f1('0x4d')]({'where':{'id':_0x557ada[_0xf4f1('0x40')]['id']},'raw':!![]})[_0xf4f1('0x1e')](handleEntityNotFound(_0x77500a,null))[_0xf4f1('0x1e')](function(_0x168dcb){if(_0x168dcb){return _0x77500a[_0xf4f1('0x4c')](path['join'](config[_0xf4f1('0x4e')],_0xf4f1('0x4f'),_0x168dcb['basename']));}})[_0xf4f1('0x3b')](handleError(_0x77500a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7643cdc..0babc27 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 _0x6f0d=['./attachment.attributes','define','Attachment','attachments','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1dfb23,_0x244353){_0x1dfb23=_0x1dfb23-0x0;var _0x176e75=_0x6f0d[_0x1dfb23];return _0x176e75;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7af2=['../../config/environment','./attachment.attributes','exports','define','attachments','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x104dca,_0x35f409){var _0x3f864e=function(_0x151646){while(--_0x151646){_0x104dca['push'](_0x104dca['shift']());}};_0x3f864e(++_0x35f409);}(_0x7af2,0x119));var _0x27af=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x7af2[_0x20cb20];return _0x2fcf4b;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var logger=require(_0x27af('0x1'))(_0x27af('0x2'));var moment=require(_0x27af('0x3'));var BPromise=require('bluebird');var rp=require(_0x27af('0x4'));var fs=require('fs');var path=require(_0x27af('0x5'));var rimraf=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var attributes=require(_0x27af('0x8'));module[_0x27af('0x9')]=function(_0x350532,_0x184630){return _0x350532[_0x27af('0xa')]('Attachment',attributes,{'tableName':_0x27af('0xb'),'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 412634a..2319323 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 _0x9613=['stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','Attachment','create','options','CreateAttachment','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug'];(function(_0x423b21,_0x2f8eb6){var _0x10a897=function(_0x36722b){while(--_0x36722b){_0x423b21['push'](_0x423b21['shift']());}};_0x10a897(++_0x2f8eb6);}(_0x9613,0x8d));var _0x3961=function(_0x416eb6,_0xfe7e4){_0x416eb6=_0x416eb6-0x0;var _0x104505=_0x9613[_0x416eb6];return _0x104505;};'use strict';var _=require(_0x3961('0x0'));var util=require(_0x3961('0x1'));var moment=require(_0x3961('0x2'));var BPromise=require('bluebird');var rs=require(_0x3961('0x3'));var fs=require('fs');var Redis=require(_0x3961('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3961('0x5'));var logger=require(_0x3961('0x6'))(_0x3961('0x7'));var config=require(_0x3961('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3961('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2d40,_0x76f798,_0x21ca30){return new BPromise(function(_0x1fab20,_0x2ea5b7){return client[_0x3961('0xa')](_0x1b2d40,_0x21ca30)[_0x3961('0xb')](function(_0x550967){logger[_0x3961('0xc')]('Attachment,\x20%s,\x20%s',_0x76f798,_0x3961('0xd'));logger[_0x3961('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x76f798,_0x3961('0xd'),JSON[_0x3961('0xf')](_0x550967));if(_0x550967['error']){if(_0x550967[_0x3961('0x10')][_0x3961('0x11')]===0x1f4){logger['error'](_0x3961('0x12'),_0x76f798,_0x550967[_0x3961('0x10')][_0x3961('0x13')]);return _0x2ea5b7(_0x550967[_0x3961('0x10')][_0x3961('0x13')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x76f798,_0x550967[_0x3961('0x10')]['message']);return _0x1fab20(_0x550967['error'][_0x3961('0x13')]);}else{logger[_0x3961('0xc')](_0x3961('0x12'),_0x76f798,_0x3961('0xd'));_0x1fab20(_0x550967[_0x3961('0x14')][_0x3961('0x13')]);}})[_0x3961('0x15')](function(_0xf9de28){logger[_0x3961('0x10')](_0x3961('0x12'),_0x76f798,_0xf9de28);_0x2ea5b7(_0xf9de28);});});}exports['CreateAttachment']=function(_0x3ef458){var _0x26dc97=this;return new Promise(function(_0x2d9305,_0x2863cf){return db[_0x3961('0x16')][_0x3961('0x17')](_0x3ef458['body'],{'raw':_0x3ef458[_0x3961('0x18')]?_0x3ef458[_0x3961('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3961('0xb')](function(_0x2f3df9){logger['info'](_0x3961('0x19'),_0x3ef458);logger[_0x3961('0xe')](_0x3961('0x19'),_0x3ef458,JSON['stringify'](_0x2f3df9));_0x2d9305(_0x2f3df9);})[_0x3961('0x15')](function(_0x287ae2){logger[_0x3961('0x10')](_0x3961('0x19'),_0x287ae2['message'],_0x3ef458);_0x2863cf(_0x26dc97[_0x3961('0x10')](0x1f4,_0x287ae2[_0x3961('0x13')]));});});}; \ No newline at end of file +var _0x6d10=['Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info'];(function(_0x37e11d,_0x262020){var _0xace894=function(_0x2774ac){while(--_0x2774ac){_0x37e11d['push'](_0x37e11d['shift']());}};_0xace894(++_0x262020);}(_0x6d10,0x1e2));var _0x06d1=function(_0x5c6ce2,_0x295913){_0x5c6ce2=_0x5c6ce2-0x0;var _0xf38ee5=_0x6d10[_0x5c6ce2];return _0xf38ee5;};'use strict';var _=require(_0x06d1('0x0'));var util=require(_0x06d1('0x1'));var moment=require(_0x06d1('0x2'));var BPromise=require(_0x06d1('0x3'));var rs=require(_0x06d1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06d1('0x5'))['db'];var utils=require(_0x06d1('0x6'));var logger=require(_0x06d1('0x7'))('rpc');var config=require(_0x06d1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06d1('0x9')][_0x06d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53f37c,_0x2a9f8b,_0x5bbb65){return new BPromise(function(_0x536d7f,_0x205dd4){return client['request'](_0x53f37c,_0x5bbb65)['then'](function(_0x21deca){logger[_0x06d1('0xb')](_0x06d1('0xc'),_0x2a9f8b,_0x06d1('0xd'));logger[_0x06d1('0xe')](_0x06d1('0xf'),_0x2a9f8b,_0x06d1('0xd'),JSON['stringify'](_0x21deca));if(_0x21deca[_0x06d1('0x10')]){if(_0x21deca['error'][_0x06d1('0x11')]===0x1f4){logger['error'](_0x06d1('0xc'),_0x2a9f8b,_0x21deca[_0x06d1('0x10')][_0x06d1('0x12')]);return _0x205dd4(_0x21deca['error'][_0x06d1('0x12')]);}logger[_0x06d1('0x10')](_0x06d1('0xc'),_0x2a9f8b,_0x21deca[_0x06d1('0x10')][_0x06d1('0x12')]);return _0x536d7f(_0x21deca[_0x06d1('0x10')][_0x06d1('0x12')]);}else{logger[_0x06d1('0xb')](_0x06d1('0xc'),_0x2a9f8b,'request\x20sent');_0x536d7f(_0x21deca[_0x06d1('0x13')][_0x06d1('0x12')]);}})[_0x06d1('0x14')](function(_0x50673b){logger[_0x06d1('0x10')](_0x06d1('0xc'),_0x2a9f8b,_0x50673b);_0x205dd4(_0x50673b);});});}exports[_0x06d1('0x15')]=function(_0x44ee34){var _0x105597=this;return new Promise(function(_0x5d3925,_0x1a6822){return db['Attachment'][_0x06d1('0x16')](_0x44ee34[_0x06d1('0x17')],{'raw':_0x44ee34['options']?_0x44ee34[_0x06d1('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x12ebc0){logger[_0x06d1('0xb')](_0x06d1('0x15'),_0x44ee34);logger[_0x06d1('0xe')](_0x06d1('0x15'),_0x44ee34,JSON[_0x06d1('0x19')](_0x12ebc0));_0x5d3925(_0x12ebc0);})[_0x06d1('0x14')](function(_0xef3b7b){logger['error']('CreateAttachment',_0xef3b7b['message'],_0x44ee34);_0x1a6822(_0x105597[_0x06d1('0x10')](0x1f4,_0xef3b7b[_0x06d1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 51b4c60..2d6333a 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(_0x2d01be,_0xa27d64){var _0x2e4ec9=function(_0x2aca94){while(--_0x2aca94){_0x2d01be['push'](_0x2d01be['shift']());}};_0x2e4ec9(++_0xa27d64);}(_0xfef9,0xd3));var _0x9fef=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0xfef9[_0x24b477];return _0x4041a6;};'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 _0xfa4d=['/:id/download','download','post','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4ac6f7,_0x3508c9){var _0x32cf5a=function(_0x658ab7){while(--_0x658ab7){_0x4ac6f7['push'](_0x4ac6f7['shift']());}};_0x32cf5a(++_0x3508c9);}(_0xfa4d,0x90));var _0xdfa4=function(_0x12a36b,_0xe759ad){_0x12a36b=_0x12a36b-0x0;var _0x405d87=_0xfa4d[_0x12a36b];return _0x405d87;};'use strict';var multer=require(_0xdfa4('0x0'));var util=require(_0xdfa4('0x1'));var path=require('path');var timeout=require(_0xdfa4('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdfa4('0x3'));var config=require(_0xdfa4('0x4'));var controller=require(_0xdfa4('0x5'));router[_0xdfa4('0x6')]('/',auth[_0xdfa4('0x7')](),controller[_0xdfa4('0x8')]);router[_0xdfa4('0x6')](_0xdfa4('0x9'),auth[_0xdfa4('0x7')](),controller[_0xdfa4('0xa')]);router[_0xdfa4('0x6')](_0xdfa4('0xb'),auth[_0xdfa4('0x7')](),controller[_0xdfa4('0xc')]);router[_0xdfa4('0xd')]('/:id/clone',auth['isAuthenticated'](),controller[_0xdfa4('0xe')]);var upload=multer({'storage':multer[_0xdfa4('0xf')]({'destination':function(_0x5c76a4,_0x13dc49,_0x48a3ef){_0x48a3ef(null,path[_0xdfa4('0x10')](config[_0xdfa4('0x11')],_0xdfa4('0x12')));},'filename':function(_0xfa1d4b,_0x1f45d6,_0x2c56ff){_0x2c56ff(null,util[_0xdfa4('0x13')](_0xdfa4('0x14'),Date[_0xdfa4('0x15')](),_0x1f45d6[_0xdfa4('0x16')][_0xdfa4('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdfa4('0xd')]('/',upload[_0xdfa4('0x18')]('file'),controller[_0xdfa4('0x19')]);router[_0xdfa4('0x1a')](_0xdfa4('0x9'),auth['isAuthenticated'](),controller[_0xdfa4('0x1b')]);router[_0xdfa4('0x1c')]('/:id',auth[_0xdfa4('0x7')](),controller[_0xdfa4('0x1d')]);module[_0xdfa4('0x1e')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 40133b7..7ad41c6 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 _0x8d4f=['use','clientID','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','find','emails','value','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x8d4f,0x102));var _0xf8d4=function(_0x3da1c5,_0x53f43f){_0x3da1c5=_0x3da1c5-0x0;var _0x20d262=_0x8d4f[_0x3da1c5];return _0x20d262;};'use strict';var _=require(_0xf8d4('0x0'));var passport=require(_0xf8d4('0x1'));var GoogleStrategy=require(_0xf8d4('0x2'))['Strategy'];var moment=require(_0xf8d4('0x3'));var db=require(_0xf8d4('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xf8d4('0x5'))[_0xf8d4('0x6')];var utils=require(_0xf8d4('0x7'));exports[_0xf8d4('0x8')]=passport[_0xf8d4('0x9')](_0xf8d4('0xa'),{'failureRedirect':_0xf8d4('0xb'),'scope':[_0xf8d4('0xc'),_0xf8d4('0xd')],'session':![]});exports['callback']=passport[_0xf8d4('0x9')](_0xf8d4('0xa'),{'failureRedirect':_0xf8d4('0xb'),'session':![]});passport[_0xf8d4('0xe')](new GoogleStrategy({'clientID':config[_0xf8d4('0xa')]?config[_0xf8d4('0xa')][_0xf8d4('0xf')]:'id','clientSecret':config['google']?config[_0xf8d4('0xa')]['clientSecret']:_0xf8d4('0x10'),'callbackURL':config[_0xf8d4('0xa')]?config['google'][_0xf8d4('0x11')]:''},function(_0x4f2d8c,_0x5542c1,_0x17675f,_0x148a53){var _0x2a7d9d,_0x261fef;return db['Setting'][_0xf8d4('0x12')]({'where':{'id':0x1},'attributes':[_0xf8d4('0x13'),_0xf8d4('0x14')],'raw':!![]})[_0xf8d4('0x15')](function(_0x3e316c){_0x2a7d9d=_0x3e316c;return db['User'][_0xf8d4('0x16')]({'where':{'email':_['map'](_0x17675f[_0xf8d4('0x17')],_0xf8d4('0x18')),'role':{'$or':['admin',_0xf8d4('0x19'),_0xf8d4('0x1a')]}}});})['then'](function(_0x1f5567){_0x261fef=_0x1f5567;if(_0x261fef){if(_0x261fef[_0xf8d4('0x1b')]){return _0x148a53(_0xf8d4('0x1c'));}else if(_0x2a7d9d[_0xf8d4('0x14')]>0x0){if(_0x261fef['blocked']){if(moment(_0x261fef[_0xf8d4('0x1d')])[_0xf8d4('0x1e')](_0x2a7d9d[_0xf8d4('0x14')],_0xf8d4('0x1f'))>moment()){return _0x148a53('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xf8d4('0x20')](_0x261fef,0x0,![],null)[_0xf8d4('0x15')](function(){return utils[_0xf8d4('0x21')](_0x261fef);})[_0xf8d4('0x15')](function(){return _0x148a53(null,_0x261fef);});}}else{return utils[_0xf8d4('0x21')](_0x261fef)[_0xf8d4('0x15')](function(){return _0x148a53(null,_0x261fef);});}}else{return utils[_0xf8d4('0x21')](_0x261fef)['then'](function(){return _0x148a53(null,_0x261fef);});}}return _0x148a53(_0xf8d4('0x1c'));})['catch'](function(_0x17615c){_0x148a53(_0x17615c);});})); \ No newline at end of file +var _0xd2b7=['passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','admin','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','getLicense','lodash','passport'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd2b7,0x1ae));var _0x7d2b=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0xd2b7[_0x2b9e8a];return _0x520e67;};'use strict';var _=require(_0x7d2b('0x0'));var passport=require(_0x7d2b('0x1'));var GoogleStrategy=require(_0x7d2b('0x2'))['Strategy'];var moment=require(_0x7d2b('0x3'));var db=require(_0x7d2b('0x4'))['db'];var config=require(_0x7d2b('0x5'));var signToken=require(_0x7d2b('0x6'))[_0x7d2b('0x7')];var utils=require(_0x7d2b('0x8'));exports['login']=passport[_0x7d2b('0x9')](_0x7d2b('0xa'),{'failureRedirect':_0x7d2b('0xb'),'scope':[_0x7d2b('0xc'),_0x7d2b('0xd')],'session':![]});exports[_0x7d2b('0xe')]=passport[_0x7d2b('0x9')](_0x7d2b('0xa'),{'failureRedirect':_0x7d2b('0xb'),'session':![]});passport[_0x7d2b('0xf')](new GoogleStrategy({'clientID':config[_0x7d2b('0xa')]?config['google'][_0x7d2b('0x10')]:'id','clientSecret':config[_0x7d2b('0xa')]?config[_0x7d2b('0xa')][_0x7d2b('0x11')]:'secret','callbackURL':config[_0x7d2b('0xa')]?config[_0x7d2b('0xa')][_0x7d2b('0x12')]:''},function(_0x96ce84,_0x45d853,_0x46705d,_0x3f9411){var _0x3a277f,_0xd5c985;return db[_0x7d2b('0x13')][_0x7d2b('0x14')]({'where':{'id':0x1},'attributes':[_0x7d2b('0x15'),_0x7d2b('0x16')],'raw':!![]})[_0x7d2b('0x17')](function(_0x2e771f){_0x3a277f=_0x2e771f;return db[_0x7d2b('0x18')][_0x7d2b('0x19')]({'where':{'email':_[_0x7d2b('0x1a')](_0x46705d[_0x7d2b('0x1b')],_0x7d2b('0x1c')),'role':{'$or':[_0x7d2b('0x1d'),_0x7d2b('0x1e'),'agent']}}});})[_0x7d2b('0x17')](function(_0x2d3ed6){_0xd5c985=_0x2d3ed6;if(_0xd5c985){if(_0xd5c985[_0x7d2b('0x1f')]){return _0x3f9411(_0x7d2b('0x20'));}else if(_0x3a277f[_0x7d2b('0x16')]>0x0){if(_0xd5c985['blocked']){if(moment(_0xd5c985[_0x7d2b('0x21')])[_0x7d2b('0x22')](_0x3a277f[_0x7d2b('0x16')],'minutes')>moment()){return _0x3f9411(_0x7d2b('0x20'));}else{return utils['clearBlockUser'](_0xd5c985,0x0,![],null)[_0x7d2b('0x17')](function(){return utils[_0x7d2b('0x23')](_0xd5c985);})[_0x7d2b('0x17')](function(){return _0x3f9411(null,_0xd5c985);});}}else{return utils['getLicense'](_0xd5c985)['then'](function(){return _0x3f9411(null,_0xd5c985);});}}else{return utils[_0x7d2b('0x23')](_0xd5c985)[_0x7d2b('0x17')](function(){return _0x3f9411(null,_0xd5c985);});}}return _0x3f9411(_0x7d2b('0x20'));})['catch'](function(_0x59fdec){_0x3f9411(_0x59fdec);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index d8ce2dc..7ed7ccf 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 _0x3eec=['login','/callback','callback','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x3d54d1,_0x1f2489){_0x3d54d1=_0x3d54d1-0x0;var _0x127321=_0x3eec[_0x3d54d1];return _0x127321;};'use strict';var express=require(_0xc3ee('0x0'));var passport=require(_0xc3ee('0x1'));var router=express[_0xc3ee('0x2')]();var controller=require(_0xc3ee('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xc3ee('0x4'));router[_0xc3ee('0x5')]('/',controller[_0xc3ee('0x6')]);router[_0xc3ee('0x5')](_0xc3ee('0x7'),controller[_0xc3ee('0x8')],authService['isMiddleware'],userController[_0xc3ee('0x6')],authService[_0xc3ee('0x9')]);module[_0xc3ee('0xa')]=router; \ No newline at end of file +var _0x9b87=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0x421d92,_0x1b8c8f){var _0x9c0b2b=function(_0x4b5ff1){while(--_0x4b5ff1){_0x421d92['push'](_0x421d92['shift']());}};_0x9c0b2b(++_0x1b8c8f);}(_0x9b87,0x8e));var _0x79b8=function(_0x5aee44,_0x444042){_0x5aee44=_0x5aee44-0x0;var _0x216686=_0x9b87[_0x5aee44];return _0x216686;};'use strict';var express=require(_0x79b8('0x0'));var passport=require(_0x79b8('0x1'));var router=express[_0x79b8('0x2')]();var controller=require(_0x79b8('0x3'));var userController=require(_0x79b8('0x4'));var authService=require(_0x79b8('0x5'));router[_0x79b8('0x6')]('/',controller[_0x79b8('0x7')]);router[_0x79b8('0x6')](_0x79b8('0x8'),controller[_0x79b8('0x9')],authService[_0x79b8('0xa')],userController[_0x79b8('0x7')],authService[_0x79b8('0xb')]);module[_0x79b8('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 3fd8d0c..4267ab9 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 _0xe9a6=['randomstring','../../mysqldb','../../config/utils','http','Setting','findOne','blockDuration','name','password','salt','role','disabled','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','allowedLoginAttempts','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','stringify','status','test','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','email','Email\x20parameter\x20is\x20missing','generate','trim','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash'];(function(_0x39fc4f,_0x1280f4){var _0x4759cc=function(_0x252d65){while(--_0x252d65){_0x39fc4f['push'](_0x39fc4f['shift']());}};_0x4759cc(++_0x1280f4);}(_0xe9a6,0xe1));var _0x6e9a=function(_0x42614c,_0x5b4cb9){_0x42614c=_0x42614c-0x0;var _0x25c2c3=_0xe9a6[_0x42614c];return _0x25c2c3;};'use strict';var util=require(_0x6e9a('0x0'));var passport=require(_0x6e9a('0x1'));var LocalStrategy=require(_0x6e9a('0x2'))[_0x6e9a('0x3')];var jayson=require(_0x6e9a('0x4'));var _=require(_0x6e9a('0x5'));var rs=require(_0x6e9a('0x6'));var moment=require('moment');var db=require(_0x6e9a('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x6e9a('0x8'));var client=jayson['client'][_0x6e9a('0x9')]({'port':0x232b});function localAuthenticate(_0x46e007,_0x63796a,_0x19f34c,_0x46c39c){var _0x463228,_0x10c573;return db[_0x6e9a('0xa')][_0x6e9a('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6e9a('0xc')],'raw':!![]})['then'](function(_0x3d841e){_0x463228=_0x3d841e;return _0x46e007[_0x6e9a('0xb')]({'attributes':['id',_0x6e9a('0xd'),_0x6e9a('0xe'),_0x6e9a('0xf'),_0x6e9a('0x10'),_0x6e9a('0x11'),'blocked',_0x6e9a('0x12'),_0x6e9a('0x13')],'where':{'name':_0x63796a,'role':{'$or':['admin',_0x6e9a('0x14'),_0x6e9a('0x15')]}}});})['then'](function(_0x40859c){if(!_0x40859c||_0x40859c&&_0x40859c[_0x6e9a('0xd')]!==_0x63796a){throw new Error(_0x6e9a('0x16'));}else{_0x10c573=_0x40859c;return _0x10c573;}})[_0x6e9a('0x17')](function(){_0x10c573['authenticate'](_0x19f34c,function(_0x13f084,_0x26e04c){var _0x4e0dcd=_0x10c573[_0x6e9a('0x13')]+0x1;if(_0x13f084){return _0x46c39c(_0x13f084);}else if(!_0x26e04c){if(_0x10c573[_0x6e9a('0x11')]){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}else if(_0x463228[_0x6e9a('0x18')]>0x0){if(_0x10c573[_0x6e9a('0x19')]){if(_0x463228['blockDuration']>0x0){if(moment(_0x10c573[_0x6e9a('0x12')])[_0x6e9a('0x1a')](_0x463228[_0x6e9a('0xc')],_0x6e9a('0x1b'))>moment()){return _0x46c39c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x6e9a('0x1c')](_0x10c573,_0x4e0dcd,![],null)['then'](function(){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});});}}else{return _0x46c39c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4e0dcd>=_0x463228[_0x6e9a('0x18')]){return utils['clearBlockUser'](_0x10c573,0x0,!![],moment())[_0x6e9a('0x17')](function(){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});});}else{return utils[_0x6e9a('0x1c')](_0x10c573,_0x4e0dcd,![],null)[_0x6e9a('0x17')](function(){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});});}}}else{return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}}else{if(_0x10c573['disabled']){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}else if(_0x463228[_0x6e9a('0x18')]>0x0){if(_0x10c573['blocked']){if(_0x463228['blockDuration']>0x0){if(moment(_0x10c573['blockedAt'])[_0x6e9a('0x1a')](_0x463228[_0x6e9a('0xc')],_0x6e9a('0x1b'))>moment()){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}else{return utils[_0x6e9a('0x1c')](_0x10c573,0x0,![],null)[_0x6e9a('0x17')](function(){return utils[_0x6e9a('0x1d')](_0x10c573);})[_0x6e9a('0x17')](function(){return _0x46c39c(null,_0x10c573);});}}else{return _0x46c39c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x6e9a('0x1c')](_0x10c573,0x0,![],null)[_0x6e9a('0x17')](function(){return utils[_0x6e9a('0x1d')](_0x10c573);})['then'](function(){return _0x46c39c(null,_0x10c573);})[_0x6e9a('0x1e')](function(_0x38abdc){return _0x46c39c(null,![],_0x38abdc);});}}else{if(_0x10c573[_0x6e9a('0x19')]){return _0x46c39c(null,![],{'message':_0x6e9a('0x16')});}else{return utils[_0x6e9a('0x1d')](_0x10c573)[_0x6e9a('0x17')](function(){return _0x46c39c(null,_0x10c573);});}}}});})[_0x6e9a('0x1e')](function(_0x42a592){return _0x46c39c(null,![],_0x42a592);});}function sendServiceMail(_0x5b5db2){return db[_0x6e9a('0x1f')][_0x6e9a('0x20')]({'where':{'service':!![]},'attributes':['id',_0x6e9a('0xd'),'email'],'include':[{'model':db[_0x6e9a('0x21')],'as':'Smtp'}]})[_0x6e9a('0x17')](function(_0x124fa5){if(!_0x124fa5){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x49002e={'tls':{'rejectUnauthorized':![]}};if(_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x23')]){_0x49002e[_0x6e9a('0x23')]=_0x124fa5['Smtp'][_0x6e9a('0x23')];}else{_0x49002e[_0x6e9a('0x24')]=_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x24')];_0x49002e[_0x6e9a('0x25')]=_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x25')];_0x49002e[_0x6e9a('0x26')]=_0x124fa5['Smtp'][_0x6e9a('0x26')];}if(_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x27')]){_0x49002e[_0x6e9a('0x28')]={'user':_0x124fa5[_0x6e9a('0x22')]['user'],'pass':_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x29')]};}var _0x4d7760={'account':_0x49002e,'message':_[_0x6e9a('0x2a')]({'from':util[_0x6e9a('0x2b')](_0x6e9a('0x2c'),_0x124fa5[_0x6e9a('0xd')],_0x124fa5['email']||_0x124fa5[_0x6e9a('0x22')][_0x6e9a('0x14')])},_0x5b5db2)};return client[_0x6e9a('0x2d')](_0x6e9a('0x2e'),_0x4d7760);})[_0x6e9a('0x17')](function(_0x9e9bf){if(_0x9e9bf[_0x6e9a('0x2f')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x9e9bf[_0x6e9a('0x2f')]['message']||JSON[_0x6e9a('0x30')](_0x9e9bf['error'])));}return!![];});}function handleError(_0x59611a,_0x32f516,_0x5180c7){return _0x59611a[_0x6e9a('0x31')](_0x32f516||0x1f4)['send']({'message':_0x5180c7?_0x5180c7['message']||_0x5180c7:''});}function checkPasswordPattern(_0x5bcffe,_0x385684,_0x31a0cc){if(_0x31a0cc){var _0x1a48f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a48f6[_0x6e9a('0x32')](_0x385684)){return _0x5bcffe;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5bcffe;}}exports[_0x6e9a('0x33')]=function(_0x3120a0,_0x578a9c,_0xceb8e6){passport[_0x6e9a('0x34')](_0x6e9a('0x35'),function(_0x1d2138,_0x3d2954,_0xe6af73){var _0x203694=_0x1d2138||_0xe6af73;if(_0x203694){return handleError(_0x578a9c,0x191,_0x203694);}if(!_0x3d2954){return handleError(_0x578a9c,0x194,{'message':_0x6e9a('0x36')});}else{var _0x5aa85b={'payload':{'id':_0x3d2954['id'],'role':_0x3d2954['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5aa85b)[_0x6e9a('0x17')](function(_0x2f0548){_0x578a9c[_0x6e9a('0x37')]({'id':_0x3d2954['id'],'token':_0x2f0548,'statusCall':'','isAlreadyLogged':_0x3d2954[_0x6e9a('0x38')]});});}})(_0x3120a0,_0x578a9c,_0xceb8e6);};exports['forgot']=function(_0x8588a1,_0x4497bd,_0x2c7274){if(!_0x8588a1[_0x6e9a('0x39')][_0x6e9a('0x3a')]){return handleError(_0x4497bd,0x1f4,{'message':_0x6e9a('0x3b')});}var _0x2c41cd=rs[_0x6e9a('0x3c')]();_0x8588a1[_0x6e9a('0x39')][_0x6e9a('0x3a')]=_0x8588a1['body'][_0x6e9a('0x3a')][_0x6e9a('0x3d')]()['toLowerCase']();var _0x3f9f92;return db['Setting'][_0x6e9a('0xb')]({'where':{'id':0x1},'attributes':[_0x6e9a('0x18'),_0x6e9a('0xc')],'raw':!![]})['then'](function(_0x2e09a9){_0x3f9f92=_0x2e09a9;return db['User']['find']({'where':{'email':_0x8588a1[_0x6e9a('0x39')][_0x6e9a('0x3a')]}});})[_0x6e9a('0x17')](function(_0x982a7a){if(!_0x982a7a){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x982a7a[_0x6e9a('0x11')]){throw new Error(_0x6e9a('0x3e'));}if(_0x982a7a['blocked']){if(moment(_0x982a7a['blockedAt'])['add'](_0x3f9f92[_0x6e9a('0xc')],_0x6e9a('0x1b'))>moment()){throw new Error(_0x6e9a('0x3f'));}else{_0x982a7a[_0x6e9a('0x19')]=![];_0x982a7a['blockedAt']=null;}}_0x982a7a[_0x6e9a('0x40')]=_0x2c41cd;_0x982a7a['resetPasswordExpires']=Date[_0x6e9a('0x41')]()+0x36ee80;return _0x982a7a[_0x6e9a('0x42')]();})[_0x6e9a('0x17')](function(){return sendServiceMail({'to':_0x8588a1['body']['email'],'subject':_0x6e9a('0x43'),'text':_0x6e9a('0x44')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'http://'+_0x8588a1['headers'][_0x6e9a('0x24')]+'/reset/'+_0x2c41cd+'\x0a\x0a'+_0x6e9a('0x45')});})[_0x6e9a('0x17')](function(){_0x4497bd[_0x6e9a('0x31')](0xc8)[_0x6e9a('0x46')]({'message':'Reset\x20Email\x20sent!'});})[_0x6e9a('0x1e')](function(_0x5e4823){return handleError(_0x4497bd,0x1f4,_0x5e4823);});};exports[_0x6e9a('0x47')]=function(_0x20ec57,_0x3f9f07,_0x598400){var _0x2c80ae;return db['User']['find']({'where':{'resetPasswordToken':_0x20ec57['params'][_0x6e9a('0x48')],'resetPasswordExpires':{'$gt':Date[_0x6e9a('0x41')]()}}})[_0x6e9a('0x17')](function(_0x36746c){_0x2c80ae=_0x36746c;if(!_0x2c80ae){throw new Error(_0x6e9a('0x49'));}return db[_0x6e9a('0xa')][_0x6e9a('0xb')]({'attributes':['id',_0x6e9a('0x4a')]});})[_0x6e9a('0x17')](function(_0x17a9a6){return checkPasswordPattern(_0x17a9a6,_0x20ec57[_0x6e9a('0x39')][_0x6e9a('0xe')],_0x17a9a6[_0x6e9a('0x4a')]);})[_0x6e9a('0x17')](function(){_0x2c80ae[_0x6e9a('0xe')]=_0x20ec57['body'][_0x6e9a('0xe')];_0x2c80ae[_0x6e9a('0x40')]=null;_0x2c80ae['resetPasswordExpires']=null;return _0x2c80ae[_0x6e9a('0x42')]();})[_0x6e9a('0x17')](function(){_0x3f9f07[_0x6e9a('0x31')](0xc8)[_0x6e9a('0x46')]({'message':_0x6e9a('0x4b')});})[_0x6e9a('0x1e')](function(_0x415e4d){return handleError(_0x3f9f07,0x1f4,_0x415e4d);});};passport[_0x6e9a('0x4c')](new LocalStrategy({'usernameField':_0x6e9a('0xd'),'passwordField':_0x6e9a('0xe')},function(_0x49bccb,_0x1a2de6,_0x34f69f){return localAuthenticate(db['User'],_0x49bccb,_0x1a2de6,_0x34f69f);})); \ No newline at end of file +var _0x5e91=['email','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','find','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','password','Password\x20reset!','use','util','passport','passport-local','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','minutes','getLicense','catch','MailAccount'];(function(_0x4e287d,_0x5cf55d){var _0x258870=function(_0x53b6b2){while(--_0x53b6b2){_0x4e287d['push'](_0x4e287d['shift']());}};_0x258870(++_0x5cf55d);}(_0x5e91,0x1d4));var _0x15e9=function(_0x10ec0f,_0x5ece09){_0x10ec0f=_0x10ec0f-0x0;var _0x1587ee=_0x5e91[_0x10ec0f];return _0x1587ee;};'use strict';var util=require(_0x15e9('0x0'));var passport=require(_0x15e9('0x1'));var LocalStrategy=require(_0x15e9('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x15e9('0x3'));var rs=require(_0x15e9('0x4'));var moment=require(_0x15e9('0x5'));var db=require(_0x15e9('0x6'))['db'];var authService=require(_0x15e9('0x7'));var utils=require('../../config/utils');var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x1e4695,_0x2eed98,_0x221cd2,_0x4c8d3a){var _0x2e1280,_0xdb571d;return db['Setting'][_0x15e9('0x8')]({'where':{'id':0x1},'attributes':[_0x15e9('0x9'),_0x15e9('0xa')],'raw':!![]})[_0x15e9('0xb')](function(_0xba9822){_0x2e1280=_0xba9822;return _0x1e4695[_0x15e9('0x8')]({'attributes':['id',_0x15e9('0xc'),'password',_0x15e9('0xd'),_0x15e9('0xe'),_0x15e9('0xf'),_0x15e9('0x10'),_0x15e9('0x11'),_0x15e9('0x12')],'where':{'name':_0x2eed98,'role':{'$or':[_0x15e9('0x13'),_0x15e9('0x14'),_0x15e9('0x15')]}}});})['then'](function(_0xb80070){if(!_0xb80070||_0xb80070&&_0xb80070[_0x15e9('0xc')]!==_0x2eed98){throw new Error(_0x15e9('0x16'));}else{_0xdb571d=_0xb80070;return _0xdb571d;}})[_0x15e9('0xb')](function(){_0xdb571d[_0x15e9('0x17')](_0x221cd2,function(_0x49c50c,_0x3c2174){var _0x51c09e=_0xdb571d[_0x15e9('0x12')]+0x1;if(_0x49c50c){return _0x4c8d3a(_0x49c50c);}else if(!_0x3c2174){if(_0xdb571d[_0x15e9('0xf')]){return _0x4c8d3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2e1280['allowedLoginAttempts']>0x0){if(_0xdb571d[_0x15e9('0x10')]){if(_0x2e1280[_0x15e9('0xa')]>0x0){if(moment(_0xdb571d[_0x15e9('0x11')])[_0x15e9('0x18')](_0x2e1280[_0x15e9('0xa')],'minutes')>moment()){return _0x4c8d3a(null,![],{'message':_0x15e9('0x16')});}else{return utils[_0x15e9('0x19')](_0xdb571d,_0x51c09e,![],null)['then'](function(){return _0x4c8d3a(null,![],{'message':_0x15e9('0x16')});});}}else{return _0x4c8d3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x51c09e>=_0x2e1280['allowedLoginAttempts']){return utils[_0x15e9('0x19')](_0xdb571d,0x0,!![],moment())[_0x15e9('0xb')](function(){return _0x4c8d3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x15e9('0x19')](_0xdb571d,_0x51c09e,![],null)['then'](function(){return _0x4c8d3a(null,![],{'message':_0x15e9('0x16')});});}}}else{return _0x4c8d3a(null,![],{'message':_0x15e9('0x16')});}}else{if(_0xdb571d[_0x15e9('0xf')]){return _0x4c8d3a(null,![],{'message':_0x15e9('0x16')});}else if(_0x2e1280[_0x15e9('0x9')]>0x0){if(_0xdb571d[_0x15e9('0x10')]){if(_0x2e1280[_0x15e9('0xa')]>0x0){if(moment(_0xdb571d[_0x15e9('0x11')])[_0x15e9('0x18')](_0x2e1280[_0x15e9('0xa')],_0x15e9('0x1a'))>moment()){return _0x4c8d3a(null,![],{'message':_0x15e9('0x16')});}else{return utils[_0x15e9('0x19')](_0xdb571d,0x0,![],null)[_0x15e9('0xb')](function(){return utils[_0x15e9('0x1b')](_0xdb571d);})[_0x15e9('0xb')](function(){return _0x4c8d3a(null,_0xdb571d);});}}else{return _0x4c8d3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x15e9('0x19')](_0xdb571d,0x0,![],null)[_0x15e9('0xb')](function(){return utils[_0x15e9('0x1b')](_0xdb571d);})[_0x15e9('0xb')](function(){return _0x4c8d3a(null,_0xdb571d);})[_0x15e9('0x1c')](function(_0x1a8d5b){return _0x4c8d3a(null,![],_0x1a8d5b);});}}else{if(_0xdb571d[_0x15e9('0x10')]){return _0x4c8d3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x15e9('0x1b')](_0xdb571d)[_0x15e9('0xb')](function(){return _0x4c8d3a(null,_0xdb571d);});}}}});})[_0x15e9('0x1c')](function(_0x3c920d){return _0x4c8d3a(null,![],_0x3c920d);});}function sendServiceMail(_0x533807){return db[_0x15e9('0x1d')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x15e9('0x1e')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x15e9('0xb')](function(_0x1e9e57){if(!_0x1e9e57){throw new Error(_0x15e9('0x1f'));}var _0x3c4844={'tls':{'rejectUnauthorized':![]}};if(_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x21')]){_0x3c4844[_0x15e9('0x21')]=_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x21')];}else{_0x3c4844[_0x15e9('0x22')]=_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x22')];_0x3c4844[_0x15e9('0x23')]=_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x23')];_0x3c4844[_0x15e9('0x24')]=_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x24')];}if(_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x25')]){_0x3c4844[_0x15e9('0x26')]={'user':_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x14')],'pass':_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x27')]};}var _0x1a5c29={'account':_0x3c4844,'message':_[_0x15e9('0x28')]({'from':util[_0x15e9('0x29')]('\x22%s\x22\x20<%s>',_0x1e9e57['name'],_0x1e9e57['email']||_0x1e9e57[_0x15e9('0x20')][_0x15e9('0x14')])},_0x533807)};return client['request'](_0x15e9('0x2a'),_0x1a5c29);})['then'](function(_0x1bed4c){if(_0x1bed4c[_0x15e9('0x2b')]){throw new Error(util['format'](_0x15e9('0x2c'),_0x1bed4c[_0x15e9('0x2b')]['message']||JSON[_0x15e9('0x2d')](_0x1bed4c['error'])));}return!![];});}function handleError(_0x114248,_0x110b07,_0x2d3d73){return _0x114248[_0x15e9('0x2e')](_0x110b07||0x1f4)[_0x15e9('0x2f')]({'message':_0x2d3d73?_0x2d3d73[_0x15e9('0x30')]||_0x2d3d73:''});}function checkPasswordPattern(_0x2d6587,_0x42575a,_0x3d1389){if(_0x3d1389){var _0x5d7471=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d7471[_0x15e9('0x31')](_0x42575a)){return _0x2d6587;}else{throw new Error(_0x15e9('0x32'));}}else{return _0x2d6587;}}exports['login']=function(_0x58bd97,_0x15bc8a,_0x41c751){passport[_0x15e9('0x17')](_0x15e9('0x33'),function(_0x52e6ac,_0x155fd7,_0x1ebd2e){var _0x20fc03=_0x52e6ac||_0x1ebd2e;if(_0x20fc03){return handleError(_0x15bc8a,0x191,_0x20fc03);}if(!_0x155fd7){return handleError(_0x15bc8a,0x194,{'message':_0x15e9('0x34')});}else{var _0x17d2f0={'payload':{'id':_0x155fd7['id'],'role':_0x155fd7[_0x15e9('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x15e9('0x35')](_0x17d2f0)[_0x15e9('0xb')](function(_0x86f7da){_0x15bc8a[_0x15e9('0x36')]({'id':_0x155fd7['id'],'token':_0x86f7da,'statusCall':'','isAlreadyLogged':_0x155fd7[_0x15e9('0x37')]});});}})(_0x58bd97,_0x15bc8a,_0x41c751);};exports[_0x15e9('0x38')]=function(_0x22c8bd,_0x12320a,_0x4a277e){if(!_0x22c8bd[_0x15e9('0x39')][_0x15e9('0x1e')]){return handleError(_0x12320a,0x1f4,{'message':_0x15e9('0x3a')});}var _0x3cc919=rs[_0x15e9('0x3b')]();_0x22c8bd[_0x15e9('0x39')][_0x15e9('0x1e')]=_0x22c8bd['body']['email'][_0x15e9('0x3c')]()[_0x15e9('0x3d')]();var _0x569e25;return db[_0x15e9('0x3e')][_0x15e9('0x8')]({'where':{'id':0x1},'attributes':[_0x15e9('0x9'),_0x15e9('0xa')],'raw':!![]})[_0x15e9('0xb')](function(_0xc30c5){_0x569e25=_0xc30c5;return db['User'][_0x15e9('0x3f')]({'where':{'email':_0x22c8bd[_0x15e9('0x39')][_0x15e9('0x1e')]}});})[_0x15e9('0xb')](function(_0x19a741){if(!_0x19a741){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x19a741['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x19a741[_0x15e9('0x10')]){if(moment(_0x19a741['blockedAt'])['add'](_0x569e25[_0x15e9('0xa')],_0x15e9('0x1a'))>moment()){throw new Error(_0x15e9('0x40'));}else{_0x19a741[_0x15e9('0x10')]=![];_0x19a741['blockedAt']=null;}}_0x19a741[_0x15e9('0x41')]=_0x3cc919;_0x19a741[_0x15e9('0x42')]=Date['now']()+0x36ee80;return _0x19a741[_0x15e9('0x43')]();})[_0x15e9('0xb')](function(){return sendServiceMail({'to':_0x22c8bd[_0x15e9('0x39')][_0x15e9('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x15e9('0x44')+_0x15e9('0x45')+_0x15e9('0x46')+_0x22c8bd['headers'][_0x15e9('0x22')]+'/reset/'+_0x3cc919+'\x0a\x0a'+_0x15e9('0x47')});})[_0x15e9('0xb')](function(){_0x12320a[_0x15e9('0x2e')](0xc8)[_0x15e9('0x2f')]({'message':_0x15e9('0x48')});})[_0x15e9('0x1c')](function(_0x68e394){return handleError(_0x12320a,0x1f4,_0x68e394);});};exports[_0x15e9('0x49')]=function(_0x1f5c0f,_0x32cb55,_0x34b9b9){var _0x5b2a4f;return db[_0x15e9('0x4a')]['find']({'where':{'resetPasswordToken':_0x1f5c0f[_0x15e9('0x4b')][_0x15e9('0x4c')],'resetPasswordExpires':{'$gt':Date[_0x15e9('0x4d')]()}}})['then'](function(_0x8840a7){_0x5b2a4f=_0x8840a7;if(!_0x5b2a4f){throw new Error(_0x15e9('0x4e'));}return db['Setting'][_0x15e9('0x8')]({'attributes':['id',_0x15e9('0x4f')]});})[_0x15e9('0xb')](function(_0x1ed78e){return checkPasswordPattern(_0x1ed78e,_0x1f5c0f[_0x15e9('0x39')][_0x15e9('0x50')],_0x1ed78e[_0x15e9('0x4f')]);})[_0x15e9('0xb')](function(){_0x5b2a4f[_0x15e9('0x50')]=_0x1f5c0f['body'][_0x15e9('0x50')];_0x5b2a4f['resetPasswordToken']=null;_0x5b2a4f[_0x15e9('0x42')]=null;return _0x5b2a4f[_0x15e9('0x43')]();})[_0x15e9('0xb')](function(){_0x32cb55[_0x15e9('0x2e')](0xc8)[_0x15e9('0x2f')]({'message':_0x15e9('0x51')});})[_0x15e9('0x1c')](function(_0x1056cd){return handleError(_0x32cb55,0x1f4,_0x1056cd);});};passport[_0x15e9('0x52')](new LocalStrategy({'usernameField':_0x15e9('0xc'),'passwordField':'password'},function(_0x401300,_0x2fc7d2,_0x306c91){return localAuthenticate(db[_0x15e9('0x4a')],_0x401300,_0x2fc7d2,_0x306c91);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8aaa6d9..976bd90 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 _0x2cdd=['/reset/:token','reset','express','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x48912a,_0x36913b){var _0x49d3a2=function(_0x49e005){while(--_0x49e005){_0x48912a['push'](_0x48912a['shift']());}};_0x49d3a2(++_0x36913b);}(_0x2cdd,0xe3));var _0xd2cd=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x2cdd[_0x565ed7];return _0x183ad7;};'use strict';var express=require(_0xd2cd('0x0'));var router=express[_0xd2cd('0x1')]();var controller=require(_0xd2cd('0x2'));router[_0xd2cd('0x3')]('/',controller[_0xd2cd('0x4')]);router[_0xd2cd('0x3')](_0xd2cd('0x5'),controller[_0xd2cd('0x6')]);router['post'](_0xd2cd('0x7'),controller[_0xd2cd('0x8')]);module['exports']=router; \ No newline at end of file +var _0x05f3=['./authLocal.controller','login','post','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x46f5dc,_0x8a99a9){var _0x441478=function(_0x5bea47){while(--_0x5bea47){_0x46f5dc['push'](_0x46f5dc['shift']());}};_0x441478(++_0x8a99a9);}(_0x05f3,0x18e));var _0x305f=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x05f3[_0x256d6a];return _0x460058;};'use strict';var express=require(_0x305f('0x0'));var router=express[_0x305f('0x1')]();var controller=require(_0x305f('0x2'));router['post']('/',controller[_0x305f('0x3')]);router[_0x305f('0x4')](_0x305f('0x5'),controller[_0x305f('0x6')]);router['post'](_0x305f('0x7'),controller[_0x305f('0x8')]);module[_0x305f('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 958520e..aebed72 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 _0xb2e4=['sequelize','STRING','INTEGER'];(function(_0x4157cf,_0x3ff907){var _0x3dacbe=function(_0x503dc3){while(--_0x503dc3){_0x4157cf['push'](_0x4157cf['shift']());}};_0x3dacbe(++_0x3ff907);}(_0xb2e4,0x8d));var _0x4b2e=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xb2e4[_0x52e0ee];return _0x32534c;};'use strict';var Sequelize=require(_0x4b2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b2e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x4b2e('0x1')]},'description':{'type':Sequelize[_0x4b2e('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4b2e('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x6499=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x5dfd07,_0x11f42e){var _0x10cd46=function(_0x16b929){while(--_0x16b929){_0x5dfd07['push'](_0x5dfd07['shift']());}};_0x10cd46(++_0x11f42e);}(_0x6499,0x64));var _0x9649=function(_0x28e998,_0xa9c9ca){_0x28e998=_0x28e998-0x0;var _0x133738=_0x6499[_0x28e998];return _0x133738;};'use strict';var Sequelize=require('sequelize');module[_0x9649('0x0')]={'name':{'type':Sequelize[_0x9649('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9649('0x1')]},'status':{'type':Sequelize[_0x9649('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9649('0x3')],'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 c9202de..0538097 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 _0xc8fa=['error','name','send','index','map','Automation','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','count','offset','apply','reject','save','then','destroy'];(function(_0x1ca6a4,_0x2a7743){var _0x105953=function(_0x38431f){while(--_0x38431f){_0x1ca6a4['push'](_0x1ca6a4['shift']());}};_0x105953(++_0x2a7743);}(_0xc8fa,0xcb));var _0xac8f=function(_0x5681b8,_0x4caf5d){_0x5681b8=_0x5681b8-0x0;var _0x2205db=_0xc8fa[_0x5681b8];return _0x2205db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xac8f('0x0'));var rimraf=require(_0xac8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac8f('0x2'));var rp=require(_0xac8f('0x3'));var moment=require('moment');var BPromise=require(_0xac8f('0x4'));var Mustache=require(_0xac8f('0x5'));var util=require(_0xac8f('0x6'));var path=require(_0xac8f('0x7'));var sox=require('sox');var csv=require(_0xac8f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xac8f('0x9'));var crypto=require(_0xac8f('0xa'));var jsforce=require(_0xac8f('0xb'));var deskjs=require(_0xac8f('0xc'));var toCsv=require(_0xac8f('0x8'));var querystring=require(_0xac8f('0xd'));var Papa=require(_0xac8f('0xe'));var Redis=require(_0xac8f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xac8f('0x10'));var hardwareService=require(_0xac8f('0x11'));var logger=require('../../config/logger')(_0xac8f('0x12'));var utils=require('../../config/utils');var config=require(_0xac8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x340bb1,_0x41daaa){_0x41daaa=_0x41daaa||0xcc;return function(_0x5a97ff){if(_0x5a97ff){return _0x340bb1[_0xac8f('0x14')](_0x41daaa);}return _0x340bb1[_0xac8f('0x15')](_0x41daaa)[_0xac8f('0x16')]();};}function respondWithResult(_0x36f318,_0x173b0e){_0x173b0e=_0x173b0e||0xc8;return function(_0xd18f5d){if(_0xd18f5d){return _0x36f318[_0xac8f('0x15')](_0x173b0e)[_0xac8f('0x17')](_0xd18f5d);}};}function respondWithFilteredResult(_0x4a7935,_0x12bbe1){return function(_0x327c58){if(_0x327c58){var _0x4ae553=_0x327c58[_0xac8f('0x18')],_0x19b4c0=_0x12bbe1['offset'],_0x27cf23=_0x12bbe1[_0xac8f('0x19')]+_0x12bbe1['limit'],_0x4dd3eb;if(_0x27cf23>=_0x4ae553){_0x27cf23=_0x4ae553;_0x4dd3eb=0xc8;}else{_0x4dd3eb=0xce;}_0x4a7935[_0xac8f('0x15')](_0x4dd3eb);return _0x4a7935['set']('Content-Range',_0x19b4c0+'-'+_0x27cf23+'/'+_0x4ae553)[_0xac8f('0x17')](_0x327c58);}return null;};}function patchUpdates(_0x15f0c3){return function(_0x257be2){try{jsonpatch[_0xac8f('0x1a')](_0x257be2,_0x15f0c3,!![]);}catch(_0x1013b8){return BPromise[_0xac8f('0x1b')](_0x1013b8);}return _0x257be2[_0xac8f('0x1c')]();};}function saveUpdates(_0x59d9c1,_0x5aa13e){return function(_0x2c0354){if(_0x2c0354){return _0x2c0354['update'](_0x59d9c1)[_0xac8f('0x1d')](function(_0x20692e){return _0x20692e;});}return null;};}function removeEntity(_0xd6243a,_0x46e6a3){return function(_0x7c64d9){if(_0x7c64d9){return _0x7c64d9[_0xac8f('0x1e')]()[_0xac8f('0x1d')](function(){_0xd6243a[_0xac8f('0x15')](0xcc)[_0xac8f('0x16')]();});}};}function handleEntityNotFound(_0x3790b5,_0x29f4c7){return function(_0x4e7769){if(!_0x4e7769){_0x3790b5[_0xac8f('0x14')](0x194);}return _0x4e7769;};}function handleError(_0x39e13a,_0x5a4f8e){_0x5a4f8e=_0x5a4f8e||0x1f4;return function(_0x4803e9){logger[_0xac8f('0x1f')](_0x4803e9['stack']);if(_0x4803e9['name']){delete _0x4803e9[_0xac8f('0x20')];}_0x39e13a[_0xac8f('0x15')](_0x5a4f8e)[_0xac8f('0x21')](_0x4803e9);};}exports[_0xac8f('0x22')]=function(_0x216521,_0x4463ab){var _0x3edfe7={},_0x1102a9={},_0x34fc19={'count':0x0,'rows':[]};var _0xea5cb5=_[_0xac8f('0x23')](db[_0xac8f('0x24')][_0xac8f('0x25')],function(_0x3fdc13){return{'name':_0x3fdc13['fieldName'],'type':_0x3fdc13[_0xac8f('0x26')][_0xac8f('0x27')]};});_0x1102a9[_0xac8f('0x28')]=_[_0xac8f('0x23')](_0xea5cb5,_0xac8f('0x20'));_0x1102a9[_0xac8f('0x29')]=_[_0xac8f('0x2a')](_0x216521[_0xac8f('0x29')]);_0x1102a9[_0xac8f('0x2b')]=_['intersection'](_0x1102a9['model'],_0x1102a9[_0xac8f('0x29')]);_0x3edfe7[_0xac8f('0x2c')]=_[_0xac8f('0x2d')](_0x1102a9[_0xac8f('0x28')],qs[_0xac8f('0x2e')](_0x216521[_0xac8f('0x29')][_0xac8f('0x2e')]));_0x3edfe7[_0xac8f('0x2c')]=_0x3edfe7[_0xac8f('0x2c')][_0xac8f('0x2f')]?_0x3edfe7['attributes']:_0x1102a9[_0xac8f('0x28')];if(!_0x216521['query'][_0xac8f('0x30')](_0xac8f('0x31'))){_0x3edfe7['limit']=qs[_0xac8f('0x32')](_0x216521['query'][_0xac8f('0x32')]);_0x3edfe7['offset']=qs[_0xac8f('0x19')](_0x216521['query'][_0xac8f('0x19')]);}_0x3edfe7[_0xac8f('0x33')]=qs[_0xac8f('0x34')](_0x216521['query'][_0xac8f('0x34')]);_0x3edfe7[_0xac8f('0x35')]=qs[_0xac8f('0x2b')](_['pick'](_0x216521['query'],_0x1102a9[_0xac8f('0x2b')]),_0xea5cb5);if(_0x216521[_0xac8f('0x29')]['filter']){_0x3edfe7['where']=_[_0xac8f('0x36')](_0x3edfe7['where'],{'$or':_[_0xac8f('0x23')](_0xea5cb5,function(_0x1d7f95){if(_0x1d7f95[_0xac8f('0x26')]!==_0xac8f('0x37')){var _0x4e44b3={};_0x4e44b3[_0x1d7f95[_0xac8f('0x20')]]={'$like':'%'+_0x216521[_0xac8f('0x29')][_0xac8f('0x38')]+'%'};return _0x4e44b3;}})});}_0x3edfe7=_[_0xac8f('0x36')]({},_0x3edfe7,_0x216521[_0xac8f('0x39')]);var _0x19f243={'where':_0x3edfe7[_0xac8f('0x35')]};return db[_0xac8f('0x24')][_0xac8f('0x18')](_0x19f243)[_0xac8f('0x1d')](function(_0x2c798c){_0x34fc19[_0xac8f('0x18')]=_0x2c798c;if(_0x216521[_0xac8f('0x29')][_0xac8f('0x3a')]){_0x3edfe7[_0xac8f('0x3b')]=[{'all':!![]}];}return db[_0xac8f('0x24')][_0xac8f('0x3c')](_0x3edfe7);})['then'](function(_0xc16c30){_0x34fc19[_0xac8f('0x3d')]=_0xc16c30;return _0x34fc19;})['then'](respondWithFilteredResult(_0x4463ab,_0x3edfe7))[_0xac8f('0x3e')](handleError(_0x4463ab,null));};exports['show']=function(_0x2cfa93,_0x1ae117){var _0x9c0450={'raw':![],'where':{'id':_0x2cfa93[_0xac8f('0x3f')]['id']}},_0x577ccd={};_0x577ccd[_0xac8f('0x28')]=_[_0xac8f('0x2a')](db[_0xac8f('0x24')][_0xac8f('0x25')]);_0x577ccd[_0xac8f('0x29')]=_[_0xac8f('0x2a')](_0x2cfa93[_0xac8f('0x29')]);_0x577ccd['filters']=_[_0xac8f('0x2d')](_0x577ccd[_0xac8f('0x28')],_0x577ccd[_0xac8f('0x29')]);_0x9c0450[_0xac8f('0x2c')]=_[_0xac8f('0x2d')](_0x577ccd[_0xac8f('0x28')],qs[_0xac8f('0x2e')](_0x2cfa93[_0xac8f('0x29')]['fields']));_0x9c0450[_0xac8f('0x2c')]=_0x9c0450[_0xac8f('0x2c')][_0xac8f('0x2f')]?_0x9c0450[_0xac8f('0x2c')]:_0x577ccd[_0xac8f('0x28')];if(_0x2cfa93[_0xac8f('0x29')][_0xac8f('0x3a')]){_0x9c0450['include']=[{'all':!![]}];}_0x9c0450=_[_0xac8f('0x36')]({},_0x9c0450,_0x2cfa93[_0xac8f('0x39')]);return db[_0xac8f('0x24')][_0xac8f('0x40')](_0x9c0450)[_0xac8f('0x1d')](handleEntityNotFound(_0x1ae117,null))[_0xac8f('0x1d')](respondWithResult(_0x1ae117,null))['catch'](handleError(_0x1ae117,null));};exports['create']=function(_0x1b61bf,_0x10112a){return db[_0xac8f('0x24')][_0xac8f('0x41')](_0x1b61bf[_0xac8f('0x42')],{})[_0xac8f('0x1d')](respondWithResult(_0x10112a,0xc9))[_0xac8f('0x3e')](handleError(_0x10112a,null));};exports[_0xac8f('0x43')]=function(_0x5e9264,_0x4edfdd){if(_0x5e9264['body']['id']){delete _0x5e9264[_0xac8f('0x42')]['id'];}return db['Automation'][_0xac8f('0x40')]({'where':{'id':_0x5e9264[_0xac8f('0x3f')]['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x4edfdd,null))[_0xac8f('0x1d')](saveUpdates(_0x5e9264['body'],null))['then'](respondWithResult(_0x4edfdd,null))['catch'](handleError(_0x4edfdd,null));};exports[_0xac8f('0x1e')]=function(_0x177e5c,_0x940284){return db[_0xac8f('0x24')][_0xac8f('0x40')]({'where':{'id':_0x177e5c[_0xac8f('0x3f')]['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x940284,null))[_0xac8f('0x1d')](removeEntity(_0x940284,null))[_0xac8f('0x3e')](handleError(_0x940284,null));};exports[_0xac8f('0x44')]=function(_0x50850a,_0x472ef9,_0x301518){return db[_0xac8f('0x45')][_0xac8f('0x40')]({'where':{'id':_0x50850a[_0xac8f('0x3f')]['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x472ef9,null))[_0xac8f('0x1d')](function(_0x2e55d1){if(_0x2e55d1){return _0x2e55d1[_0xac8f('0x44')](_0x50850a[_0xac8f('0x42')][_0xac8f('0x46')],_['omit'](_0x50850a[_0xac8f('0x42')],[_0xac8f('0x46'),'id'])||{});}})[_0xac8f('0x1d')](respondWithResult(_0x472ef9,null))[_0xac8f('0x3e')](handleError(_0x472ef9,null));};exports['getConditions']=function(_0x1dab37,_0x1f0157,_0x218f67){var _0x15bc73={};var _0x1fdf19={};var _0x44c330;var _0x727916;return db[_0xac8f('0x24')][_0xac8f('0x47')]({'where':{'id':_0x1dab37[_0xac8f('0x3f')]['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x1f0157,null))['then'](function(_0x6fafc4){if(_0x6fafc4){_0x44c330=_0x6fafc4;_0x1fdf19[_0xac8f('0x28')]=_[_0xac8f('0x2a')](db[_0xac8f('0x45')][_0xac8f('0x25')]);_0x1fdf19[_0xac8f('0x29')]=_['keys'](_0x1dab37[_0xac8f('0x29')]);_0x1fdf19[_0xac8f('0x2b')]=_['intersection'](_0x1fdf19[_0xac8f('0x28')],_0x1fdf19[_0xac8f('0x29')]);_0x15bc73[_0xac8f('0x2c')]=_['intersection'](_0x1fdf19[_0xac8f('0x28')],qs[_0xac8f('0x2e')](_0x1dab37['query'][_0xac8f('0x2e')]));_0x15bc73[_0xac8f('0x2c')]=_0x15bc73[_0xac8f('0x2c')][_0xac8f('0x2f')]?_0x15bc73[_0xac8f('0x2c')]:_0x1fdf19[_0xac8f('0x28')];_0x15bc73['order']=qs[_0xac8f('0x34')](_0x1dab37[_0xac8f('0x29')]['sort']);_0x15bc73[_0xac8f('0x35')]=qs[_0xac8f('0x2b')](_[_0xac8f('0x48')](_0x1dab37[_0xac8f('0x29')],_0x1fdf19['filters']));if(_0x1dab37[_0xac8f('0x29')]['filter']){_0x15bc73[_0xac8f('0x35')]=_[_0xac8f('0x36')](_0x15bc73[_0xac8f('0x35')],{'$or':_[_0xac8f('0x23')](_0x15bc73[_0xac8f('0x2c')],function(_0x55bdd9){var _0x3f21cd={};_0x3f21cd[_0x55bdd9]={'$like':'%'+_0x1dab37[_0xac8f('0x29')]['filter']+'%'};return _0x3f21cd;})});}_0x15bc73=_['merge']({},_0x15bc73,_0x1dab37['options']);return _0x44c330[_0xac8f('0x49')](_0x15bc73);}})[_0xac8f('0x1d')](function(_0x2847c9){if(_0x2847c9){_0x727916=_0x2847c9[_0xac8f('0x2f')];if(!_0x1dab37['query']['hasOwnProperty']('nolimit')){_0x15bc73[_0xac8f('0x32')]=qs[_0xac8f('0x32')](_0x1dab37[_0xac8f('0x29')][_0xac8f('0x32')]);_0x15bc73[_0xac8f('0x19')]=qs['offset'](_0x1dab37[_0xac8f('0x29')][_0xac8f('0x19')]);}return _0x44c330[_0xac8f('0x49')](_0x15bc73);}})[_0xac8f('0x1d')](function(_0x64f442){if(_0x64f442){return _0x64f442?{'count':_0x727916,'rows':_0x64f442}:null;}})[_0xac8f('0x1d')](respondWithResult(_0x1f0157,null))[_0xac8f('0x3e')](handleError(_0x1f0157,null));};exports[_0xac8f('0x4a')]=function(_0x285164,_0x14958a,_0x3aac1a){return db[_0xac8f('0x4b')][_0xac8f('0x40')]({'where':{'id':_0x285164[_0xac8f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x14958a,null))[_0xac8f('0x1d')](function(_0x5aaa2d){if(_0x5aaa2d){return _0x5aaa2d[_0xac8f('0x4a')](_0x285164['body'][_0xac8f('0x46')],_[_0xac8f('0x4c')](_0x285164[_0xac8f('0x42')],[_0xac8f('0x46'),'id'])||{});}})[_0xac8f('0x1d')](respondWithResult(_0x14958a,null))[_0xac8f('0x3e')](handleError(_0x14958a,null));};exports[_0xac8f('0x4d')]=function(_0x30c9f3,_0x21a5e0,_0x580178){var _0x1a233d={};var _0x140ac4={};var _0x32351f;var _0x12aa37;return db[_0xac8f('0x24')][_0xac8f('0x47')]({'where':{'id':_0x30c9f3['params']['id']}})[_0xac8f('0x1d')](handleEntityNotFound(_0x21a5e0,null))[_0xac8f('0x1d')](function(_0x341c4e){if(_0x341c4e){_0x32351f=_0x341c4e;_0x140ac4[_0xac8f('0x28')]=_[_0xac8f('0x2a')](db[_0xac8f('0x4b')][_0xac8f('0x25')]);_0x140ac4[_0xac8f('0x29')]=_[_0xac8f('0x2a')](_0x30c9f3[_0xac8f('0x29')]);_0x140ac4[_0xac8f('0x2b')]=_[_0xac8f('0x2d')](_0x140ac4[_0xac8f('0x28')],_0x140ac4[_0xac8f('0x29')]);_0x1a233d[_0xac8f('0x2c')]=_[_0xac8f('0x2d')](_0x140ac4[_0xac8f('0x28')],qs['fields'](_0x30c9f3['query'][_0xac8f('0x2e')]));_0x1a233d[_0xac8f('0x2c')]=_0x1a233d[_0xac8f('0x2c')]['length']?_0x1a233d[_0xac8f('0x2c')]:_0x140ac4['model'];_0x1a233d[_0xac8f('0x33')]=qs[_0xac8f('0x34')](_0x30c9f3[_0xac8f('0x29')]['sort']);_0x1a233d[_0xac8f('0x35')]=qs['filters'](_['pick'](_0x30c9f3['query'],_0x140ac4[_0xac8f('0x2b')]));if(_0x30c9f3[_0xac8f('0x29')][_0xac8f('0x38')]){_0x1a233d['where']=_[_0xac8f('0x36')](_0x1a233d[_0xac8f('0x35')],{'$or':_[_0xac8f('0x23')](_0x1a233d[_0xac8f('0x2c')],function(_0x108487){var _0x1fd9ad={};_0x1fd9ad[_0x108487]={'$like':'%'+_0x30c9f3['query'][_0xac8f('0x38')]+'%'};return _0x1fd9ad;})});}_0x1a233d=_[_0xac8f('0x36')]({},_0x1a233d,_0x30c9f3[_0xac8f('0x39')]);return _0x32351f[_0xac8f('0x4d')](_0x1a233d);}})[_0xac8f('0x1d')](function(_0x9f162a){if(_0x9f162a){_0x12aa37=_0x9f162a[_0xac8f('0x2f')];if(!_0x30c9f3['query'][_0xac8f('0x30')](_0xac8f('0x31'))){_0x1a233d[_0xac8f('0x32')]=qs[_0xac8f('0x32')](_0x30c9f3[_0xac8f('0x29')]['limit']);_0x1a233d[_0xac8f('0x19')]=qs['offset'](_0x30c9f3[_0xac8f('0x29')][_0xac8f('0x19')]);}return _0x32351f[_0xac8f('0x4d')](_0x1a233d);}})['then'](function(_0x1fe22a){if(_0x1fe22a){return _0x1fe22a?{'count':_0x12aa37,'rows':_0x1fe22a}:null;}})['then'](respondWithResult(_0x21a5e0,null))[_0xac8f('0x3e')](handleError(_0x21a5e0,null));}; \ No newline at end of file +var _0x4ca8=['find','addConditions','Condition','ids','omit','getConditions','findOne','length','order','sort','addActions','Action','pick','getActions','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','offset','limit','Content-Range','json','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','where','merge','VIRTUAL','filter','options','Automation','count','includeAll','include','findAll','rows','catch','params','create','body'];(function(_0x597bf3,_0x3a2bd8){var _0x4db0db=function(_0x4d5983){while(--_0x4d5983){_0x597bf3['push'](_0x597bf3['shift']());}};_0x4db0db(++_0x3a2bd8);}(_0x4ca8,0xa8));var _0x84ca=function(_0x14a48a,_0x45d4da){_0x14a48a=_0x14a48a-0x0;var _0x439ed9=_0x4ca8[_0x14a48a];return _0x439ed9;};'use strict';var pdf=require(_0x84ca('0x0'));var emlformat=require(_0x84ca('0x1'));var rimraf=require(_0x84ca('0x2'));var zipdir=require(_0x84ca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x84ca('0x4'));var BPromise=require(_0x84ca('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x84ca('0x6'));var sox=require(_0x84ca('0x7'));var csv=require(_0x84ca('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x84ca('0x9'));var squel=require(_0x84ca('0xa'));var crypto=require('crypto');var jsforce=require(_0x84ca('0xb'));var deskjs=require(_0x84ca('0xc'));var toCsv=require(_0x84ca('0x8'));var querystring=require(_0x84ca('0xd'));var Papa=require(_0x84ca('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x84ca('0xf'));var hardwareService=require(_0x84ca('0x10'));var logger=require('../../config/logger')(_0x84ca('0x11'));var utils=require('../../config/utils');var config=require(_0x84ca('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2505a7,_0xe59910){_0xe59910=_0xe59910||0xcc;return function(_0x49d7bb){if(_0x49d7bb){return _0x2505a7[_0x84ca('0x13')](_0xe59910);}return _0x2505a7[_0x84ca('0x14')](_0xe59910)[_0x84ca('0x15')]();};}function respondWithResult(_0xcc635d,_0x5be88f){_0x5be88f=_0x5be88f||0xc8;return function(_0x12c2c8){if(_0x12c2c8){return _0xcc635d[_0x84ca('0x14')](_0x5be88f)['json'](_0x12c2c8);}};}function respondWithFilteredResult(_0x2efd5d,_0x5e00fd){return function(_0x92535b){if(_0x92535b){var _0x5dee34=_0x92535b['count'],_0x4b331b=_0x5e00fd['offset'],_0x2db82e=_0x5e00fd[_0x84ca('0x16')]+_0x5e00fd[_0x84ca('0x17')],_0x17b567;if(_0x2db82e>=_0x5dee34){_0x2db82e=_0x5dee34;_0x17b567=0xc8;}else{_0x17b567=0xce;}_0x2efd5d[_0x84ca('0x14')](_0x17b567);return _0x2efd5d['set'](_0x84ca('0x18'),_0x4b331b+'-'+_0x2db82e+'/'+_0x5dee34)[_0x84ca('0x19')](_0x92535b);}return null;};}function patchUpdates(_0x5e9203){return function(_0x36fee7){try{jsonpatch['apply'](_0x36fee7,_0x5e9203,!![]);}catch(_0x180a6c){return BPromise[_0x84ca('0x1a')](_0x180a6c);}return _0x36fee7['save']();};}function saveUpdates(_0xa07c73,_0x366dea){return function(_0xc9c707){if(_0xc9c707){return _0xc9c707[_0x84ca('0x1b')](_0xa07c73)[_0x84ca('0x1c')](function(_0xf61bc0){return _0xf61bc0;});}return null;};}function removeEntity(_0x5aa69f,_0x55224e){return function(_0x45701a){if(_0x45701a){return _0x45701a[_0x84ca('0x1d')]()[_0x84ca('0x1c')](function(){_0x5aa69f[_0x84ca('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x590192,_0x43731e){return function(_0x306dde){if(!_0x306dde){_0x590192[_0x84ca('0x13')](0x194);}return _0x306dde;};}function handleError(_0x1ac5c6,_0x3e9baf){_0x3e9baf=_0x3e9baf||0x1f4;return function(_0x14346a){logger[_0x84ca('0x1e')](_0x14346a['stack']);if(_0x14346a['name']){delete _0x14346a[_0x84ca('0x1f')];}_0x1ac5c6[_0x84ca('0x14')](_0x3e9baf)[_0x84ca('0x20')](_0x14346a);};}exports[_0x84ca('0x21')]=function(_0x23131c,_0x502a7a){var _0x4060c6={},_0x9ccc7b={},_0x2d1411={'count':0x0,'rows':[]};var _0x4a8fcf=_[_0x84ca('0x22')](db['Automation'][_0x84ca('0x23')],function(_0x4b1a32){return{'name':_0x4b1a32[_0x84ca('0x24')],'type':_0x4b1a32[_0x84ca('0x25')][_0x84ca('0x26')]};});_0x9ccc7b['model']=_[_0x84ca('0x22')](_0x4a8fcf,'name');_0x9ccc7b[_0x84ca('0x27')]=_[_0x84ca('0x28')](_0x23131c[_0x84ca('0x27')]);_0x9ccc7b[_0x84ca('0x29')]=_['intersection'](_0x9ccc7b[_0x84ca('0x2a')],_0x9ccc7b[_0x84ca('0x27')]);_0x4060c6[_0x84ca('0x2b')]=_[_0x84ca('0x2c')](_0x9ccc7b[_0x84ca('0x2a')],qs[_0x84ca('0x2d')](_0x23131c['query'][_0x84ca('0x2d')]));_0x4060c6[_0x84ca('0x2b')]=_0x4060c6[_0x84ca('0x2b')]['length']?_0x4060c6[_0x84ca('0x2b')]:_0x9ccc7b['model'];if(!_0x23131c[_0x84ca('0x27')][_0x84ca('0x2e')](_0x84ca('0x2f'))){_0x4060c6[_0x84ca('0x17')]=qs['limit'](_0x23131c[_0x84ca('0x27')][_0x84ca('0x17')]);_0x4060c6['offset']=qs['offset'](_0x23131c[_0x84ca('0x27')][_0x84ca('0x16')]);}_0x4060c6['order']=qs['sort'](_0x23131c['query']['sort']);_0x4060c6['where']=qs[_0x84ca('0x29')](_['pick'](_0x23131c[_0x84ca('0x27')],_0x9ccc7b[_0x84ca('0x29')]),_0x4a8fcf);if(_0x23131c[_0x84ca('0x27')]['filter']){_0x4060c6[_0x84ca('0x30')]=_[_0x84ca('0x31')](_0x4060c6['where'],{'$or':_['map'](_0x4a8fcf,function(_0x1c7ed2){if(_0x1c7ed2['type']!==_0x84ca('0x32')){var _0x5220b2={};_0x5220b2[_0x1c7ed2[_0x84ca('0x1f')]]={'$like':'%'+_0x23131c[_0x84ca('0x27')][_0x84ca('0x33')]+'%'};return _0x5220b2;}})});}_0x4060c6=_[_0x84ca('0x31')]({},_0x4060c6,_0x23131c[_0x84ca('0x34')]);var _0x1e5613={'where':_0x4060c6['where']};return db[_0x84ca('0x35')]['count'](_0x1e5613)[_0x84ca('0x1c')](function(_0x27580b){_0x2d1411[_0x84ca('0x36')]=_0x27580b;if(_0x23131c[_0x84ca('0x27')][_0x84ca('0x37')]){_0x4060c6[_0x84ca('0x38')]=[{'all':!![]}];}return db[_0x84ca('0x35')][_0x84ca('0x39')](_0x4060c6);})['then'](function(_0x35f2ac){_0x2d1411[_0x84ca('0x3a')]=_0x35f2ac;return _0x2d1411;})[_0x84ca('0x1c')](respondWithFilteredResult(_0x502a7a,_0x4060c6))[_0x84ca('0x3b')](handleError(_0x502a7a,null));};exports['show']=function(_0x1c440b,_0x1c07ed){var _0x4ed196={'raw':![],'where':{'id':_0x1c440b[_0x84ca('0x3c')]['id']}},_0x1d0bdd={};_0x1d0bdd['model']=_[_0x84ca('0x28')](db[_0x84ca('0x35')][_0x84ca('0x23')]);_0x1d0bdd[_0x84ca('0x27')]=_[_0x84ca('0x28')](_0x1c440b[_0x84ca('0x27')]);_0x1d0bdd[_0x84ca('0x29')]=_[_0x84ca('0x2c')](_0x1d0bdd[_0x84ca('0x2a')],_0x1d0bdd[_0x84ca('0x27')]);_0x4ed196[_0x84ca('0x2b')]=_[_0x84ca('0x2c')](_0x1d0bdd[_0x84ca('0x2a')],qs['fields'](_0x1c440b[_0x84ca('0x27')][_0x84ca('0x2d')]));_0x4ed196['attributes']=_0x4ed196['attributes']['length']?_0x4ed196[_0x84ca('0x2b')]:_0x1d0bdd[_0x84ca('0x2a')];if(_0x1c440b[_0x84ca('0x27')][_0x84ca('0x37')]){_0x4ed196[_0x84ca('0x38')]=[{'all':!![]}];}_0x4ed196=_[_0x84ca('0x31')]({},_0x4ed196,_0x1c440b[_0x84ca('0x34')]);return db[_0x84ca('0x35')]['find'](_0x4ed196)[_0x84ca('0x1c')](handleEntityNotFound(_0x1c07ed,null))['then'](respondWithResult(_0x1c07ed,null))[_0x84ca('0x3b')](handleError(_0x1c07ed,null));};exports[_0x84ca('0x3d')]=function(_0x2b1693,_0x2ab3bc){return db[_0x84ca('0x35')][_0x84ca('0x3d')](_0x2b1693[_0x84ca('0x3e')],{})[_0x84ca('0x1c')](respondWithResult(_0x2ab3bc,0xc9))['catch'](handleError(_0x2ab3bc,null));};exports[_0x84ca('0x1b')]=function(_0x1b8f49,_0x2888e1){if(_0x1b8f49[_0x84ca('0x3e')]['id']){delete _0x1b8f49[_0x84ca('0x3e')]['id'];}return db[_0x84ca('0x35')][_0x84ca('0x3f')]({'where':{'id':_0x1b8f49[_0x84ca('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2888e1,null))['then'](saveUpdates(_0x1b8f49[_0x84ca('0x3e')],null))['then'](respondWithResult(_0x2888e1,null))[_0x84ca('0x3b')](handleError(_0x2888e1,null));};exports[_0x84ca('0x1d')]=function(_0x569736,_0x40d498){return db[_0x84ca('0x35')]['find']({'where':{'id':_0x569736[_0x84ca('0x3c')]['id']}})[_0x84ca('0x1c')](handleEntityNotFound(_0x40d498,null))['then'](removeEntity(_0x40d498,null))[_0x84ca('0x3b')](handleError(_0x40d498,null));};exports[_0x84ca('0x40')]=function(_0x2f7b9b,_0x1f53b4,_0x8c6af1){return db[_0x84ca('0x41')]['find']({'where':{'id':_0x2f7b9b[_0x84ca('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1f53b4,null))['then'](function(_0x40e306){if(_0x40e306){return _0x40e306['addConditions'](_0x2f7b9b[_0x84ca('0x3e')][_0x84ca('0x42')],_[_0x84ca('0x43')](_0x2f7b9b[_0x84ca('0x3e')],['ids','id'])||{});}})['then'](respondWithResult(_0x1f53b4,null))[_0x84ca('0x3b')](handleError(_0x1f53b4,null));};exports[_0x84ca('0x44')]=function(_0x18713a,_0x17b2ba,_0x4dd71d){var _0x573337={};var _0x348e06={};var _0x330cbe;var _0x1211cd;return db[_0x84ca('0x35')][_0x84ca('0x45')]({'where':{'id':_0x18713a[_0x84ca('0x3c')]['id']}})[_0x84ca('0x1c')](handleEntityNotFound(_0x17b2ba,null))['then'](function(_0x4328e9){if(_0x4328e9){_0x330cbe=_0x4328e9;_0x348e06[_0x84ca('0x2a')]=_[_0x84ca('0x28')](db[_0x84ca('0x41')][_0x84ca('0x23')]);_0x348e06[_0x84ca('0x27')]=_[_0x84ca('0x28')](_0x18713a['query']);_0x348e06[_0x84ca('0x29')]=_['intersection'](_0x348e06[_0x84ca('0x2a')],_0x348e06[_0x84ca('0x27')]);_0x573337[_0x84ca('0x2b')]=_[_0x84ca('0x2c')](_0x348e06['model'],qs[_0x84ca('0x2d')](_0x18713a['query'][_0x84ca('0x2d')]));_0x573337[_0x84ca('0x2b')]=_0x573337['attributes'][_0x84ca('0x46')]?_0x573337[_0x84ca('0x2b')]:_0x348e06[_0x84ca('0x2a')];_0x573337[_0x84ca('0x47')]=qs[_0x84ca('0x48')](_0x18713a['query'][_0x84ca('0x48')]);_0x573337[_0x84ca('0x30')]=qs[_0x84ca('0x29')](_['pick'](_0x18713a[_0x84ca('0x27')],_0x348e06[_0x84ca('0x29')]));if(_0x18713a['query'][_0x84ca('0x33')]){_0x573337[_0x84ca('0x30')]=_[_0x84ca('0x31')](_0x573337[_0x84ca('0x30')],{'$or':_[_0x84ca('0x22')](_0x573337['attributes'],function(_0x1a89a9){var _0x5c2428={};_0x5c2428[_0x1a89a9]={'$like':'%'+_0x18713a[_0x84ca('0x27')]['filter']+'%'};return _0x5c2428;})});}_0x573337=_[_0x84ca('0x31')]({},_0x573337,_0x18713a[_0x84ca('0x34')]);return _0x330cbe[_0x84ca('0x44')](_0x573337);}})[_0x84ca('0x1c')](function(_0x4d946f){if(_0x4d946f){_0x1211cd=_0x4d946f[_0x84ca('0x46')];if(!_0x18713a['query'][_0x84ca('0x2e')](_0x84ca('0x2f'))){_0x573337['limit']=qs[_0x84ca('0x17')](_0x18713a[_0x84ca('0x27')]['limit']);_0x573337[_0x84ca('0x16')]=qs[_0x84ca('0x16')](_0x18713a['query'][_0x84ca('0x16')]);}return _0x330cbe['getConditions'](_0x573337);}})[_0x84ca('0x1c')](function(_0x44799a){if(_0x44799a){return _0x44799a?{'count':_0x1211cd,'rows':_0x44799a}:null;}})['then'](respondWithResult(_0x17b2ba,null))[_0x84ca('0x3b')](handleError(_0x17b2ba,null));};exports[_0x84ca('0x49')]=function(_0x222f59,_0x5a77b8,_0x9140c8){return db[_0x84ca('0x4a')]['find']({'where':{'id':_0x222f59[_0x84ca('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5a77b8,null))[_0x84ca('0x1c')](function(_0x308e92){if(_0x308e92){return _0x308e92[_0x84ca('0x49')](_0x222f59['body']['ids'],_[_0x84ca('0x43')](_0x222f59[_0x84ca('0x3e')],['ids','id'])||{});}})[_0x84ca('0x1c')](respondWithResult(_0x5a77b8,null))[_0x84ca('0x3b')](handleError(_0x5a77b8,null));};exports['getActions']=function(_0x5e147f,_0x39330a,_0x43a884){var _0x51075a={};var _0x13b09f={};var _0x371526;var _0x12da30;return db[_0x84ca('0x35')][_0x84ca('0x45')]({'where':{'id':_0x5e147f[_0x84ca('0x3c')]['id']}})[_0x84ca('0x1c')](handleEntityNotFound(_0x39330a,null))['then'](function(_0x40e2c9){if(_0x40e2c9){_0x371526=_0x40e2c9;_0x13b09f[_0x84ca('0x2a')]=_['keys'](db[_0x84ca('0x4a')][_0x84ca('0x23')]);_0x13b09f[_0x84ca('0x27')]=_[_0x84ca('0x28')](_0x5e147f[_0x84ca('0x27')]);_0x13b09f['filters']=_[_0x84ca('0x2c')](_0x13b09f[_0x84ca('0x2a')],_0x13b09f['query']);_0x51075a[_0x84ca('0x2b')]=_['intersection'](_0x13b09f[_0x84ca('0x2a')],qs[_0x84ca('0x2d')](_0x5e147f['query'][_0x84ca('0x2d')]));_0x51075a[_0x84ca('0x2b')]=_0x51075a[_0x84ca('0x2b')][_0x84ca('0x46')]?_0x51075a[_0x84ca('0x2b')]:_0x13b09f[_0x84ca('0x2a')];_0x51075a[_0x84ca('0x47')]=qs[_0x84ca('0x48')](_0x5e147f['query'][_0x84ca('0x48')]);_0x51075a[_0x84ca('0x30')]=qs[_0x84ca('0x29')](_[_0x84ca('0x4b')](_0x5e147f[_0x84ca('0x27')],_0x13b09f[_0x84ca('0x29')]));if(_0x5e147f[_0x84ca('0x27')][_0x84ca('0x33')]){_0x51075a[_0x84ca('0x30')]=_['merge'](_0x51075a['where'],{'$or':_[_0x84ca('0x22')](_0x51075a[_0x84ca('0x2b')],function(_0x4a1237){var _0x3365b7={};_0x3365b7[_0x4a1237]={'$like':'%'+_0x5e147f[_0x84ca('0x27')][_0x84ca('0x33')]+'%'};return _0x3365b7;})});}_0x51075a=_[_0x84ca('0x31')]({},_0x51075a,_0x5e147f[_0x84ca('0x34')]);return _0x371526[_0x84ca('0x4c')](_0x51075a);}})[_0x84ca('0x1c')](function(_0x4f80f2){if(_0x4f80f2){_0x12da30=_0x4f80f2[_0x84ca('0x46')];if(!_0x5e147f[_0x84ca('0x27')][_0x84ca('0x2e')](_0x84ca('0x2f'))){_0x51075a[_0x84ca('0x17')]=qs[_0x84ca('0x17')](_0x5e147f[_0x84ca('0x27')]['limit']);_0x51075a[_0x84ca('0x16')]=qs[_0x84ca('0x16')](_0x5e147f['query'][_0x84ca('0x16')]);}return _0x371526[_0x84ca('0x4c')](_0x51075a);}})[_0x84ca('0x1c')](function(_0x1816cf){if(_0x1816cf){return _0x1816cf?{'count':_0x12da30,'rows':_0x1816cf}:null;}})[_0x84ca('0x1c')](respondWithResult(_0x39330a,null))[_0x84ca('0x3b')](handleError(_0x39330a,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 25968be..7e58a64 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5075,0x73));var _0x5507=function(_0x4f5ef9,_0x2eaea0){_0x4f5ef9=_0x4f5ef9-0x0;var _0x4e43c1=_0x5075[_0x4f5ef9];return _0x4e43c1;};'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 _0x24ca=['Automation','tools_automations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x53a529,_0x2c6481){var _0x3fe0bc=function(_0x384780){while(--_0x384780){_0x53a529['push'](_0x53a529['shift']());}};_0x3fe0bc(++_0x2c6481);}(_0x24ca,0x1bc));var _0xa24c=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x24ca[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 0405cef..2962475 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 _0xc11f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x560f7d,_0x4b8cf1){var _0x14721a=function(_0x320588){while(--_0x320588){_0x560f7d['push'](_0x560f7d['shift']());}};_0x14721a(++_0x4b8cf1);}(_0xc11f,0x1b5));var _0xfc11=function(_0x1241ad,_0x9e332a){_0x1241ad=_0x1241ad-0x0;var _0x49b9e1=_0xc11f[_0x1241ad];return _0x49b9e1;};'use strict';var _=require(_0xfc11('0x0'));var util=require('util');var moment=require(_0xfc11('0x1'));var BPromise=require(_0xfc11('0x2'));var rs=require(_0xfc11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc11('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc11('0x5'))(_0xfc11('0x6'));var config=require(_0xfc11('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc11('0x8')][_0xfc11('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcabf9f,_0x1aa1a2,_0x2d7f15){return new BPromise(function(_0x57a481,_0x151f5f){return client[_0xfc11('0xa')](_0xcabf9f,_0x2d7f15)['then'](function(_0x60f1ed){logger['info']('Automation,\x20%s,\x20%s',_0x1aa1a2,_0xfc11('0xb'));logger[_0xfc11('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x1aa1a2,'request\x20sent',JSON[_0xfc11('0xd')](_0x60f1ed));if(_0x60f1ed[_0xfc11('0xe')]){if(_0x60f1ed[_0xfc11('0xe')][_0xfc11('0xf')]===0x1f4){logger['error'](_0xfc11('0x10'),_0x1aa1a2,_0x60f1ed['error'][_0xfc11('0x11')]);return _0x151f5f(_0x60f1ed[_0xfc11('0xe')][_0xfc11('0x11')]);}logger[_0xfc11('0xe')](_0xfc11('0x10'),_0x1aa1a2,_0x60f1ed[_0xfc11('0xe')][_0xfc11('0x11')]);return _0x57a481(_0x60f1ed[_0xfc11('0xe')]['message']);}else{logger['info'](_0xfc11('0x10'),_0x1aa1a2,_0xfc11('0xb'));_0x57a481(_0x60f1ed[_0xfc11('0x12')][_0xfc11('0x11')]);}})[_0xfc11('0x13')](function(_0x26623e){logger[_0xfc11('0xe')]('Automation,\x20%s,\x20%s',_0x1aa1a2,_0x26623e);_0x151f5f(_0x26623e);});});} \ No newline at end of file +var _0xa6d1=['http','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1767ae,_0x34b692){var _0x445227=function(_0x2f51ce){while(--_0x2f51ce){_0x1767ae['push'](_0x1767ae['shift']());}};_0x445227(++_0x34b692);}(_0xa6d1,0x1ae));var _0x1a6d=function(_0x27a6a2,_0x20a8a4){_0x27a6a2=_0x27a6a2-0x0;var _0x1b10dc=_0xa6d1[_0x27a6a2];return _0x1b10dc;};'use strict';var _=require(_0x1a6d('0x0'));var util=require(_0x1a6d('0x1'));var moment=require('moment');var BPromise=require(_0x1a6d('0x2'));var rs=require(_0x1a6d('0x3'));var fs=require('fs');var Redis=require(_0x1a6d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a6d('0x5'));var logger=require('../../config/logger')(_0x1a6d('0x6'));var config=require(_0x1a6d('0x7'));var jayson=require(_0x1a6d('0x8'));var client=jayson[_0x1a6d('0x9')][_0x1a6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e41c,_0x875f08,_0x8d5080){return new BPromise(function(_0x37a9d2,_0x14d1ff){return client['request'](_0x27e41c,_0x8d5080)[_0x1a6d('0xb')](function(_0x4dd616){logger['info']('Automation,\x20%s,\x20%s',_0x875f08,_0x1a6d('0xc'));logger[_0x1a6d('0xd')](_0x1a6d('0xe'),_0x875f08,_0x1a6d('0xc'),JSON[_0x1a6d('0xf')](_0x4dd616));if(_0x4dd616['error']){if(_0x4dd616[_0x1a6d('0x10')][_0x1a6d('0x11')]===0x1f4){logger[_0x1a6d('0x10')](_0x1a6d('0x12'),_0x875f08,_0x4dd616['error']['message']);return _0x14d1ff(_0x4dd616[_0x1a6d('0x10')][_0x1a6d('0x13')]);}logger[_0x1a6d('0x10')](_0x1a6d('0x12'),_0x875f08,_0x4dd616[_0x1a6d('0x10')]['message']);return _0x37a9d2(_0x4dd616[_0x1a6d('0x10')][_0x1a6d('0x13')]);}else{logger[_0x1a6d('0x14')]('Automation,\x20%s,\x20%s',_0x875f08,_0x1a6d('0xc'));_0x37a9d2(_0x4dd616['result'][_0x1a6d('0x13')]);}})[_0x1a6d('0x15')](function(_0x4f7b6b){logger[_0x1a6d('0x10')](_0x1a6d('0x12'),_0x875f08,_0x4f7b6b);_0x14d1ff(_0x4f7b6b);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f620ff6..7577c58 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 _0x8757=['getConditions','getActions','post','create','/:id/actions','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x8757,0x157));var _0x7875=function(_0x183335,_0x20f357){_0x183335=_0x183335-0x0;var _0x23a95c=_0x8757[_0x183335];return _0x23a95c;};'use strict';var multer=require(_0x7875('0x0'));var util=require('util');var path=require(_0x7875('0x1'));var timeout=require(_0x7875('0x2'));var express=require(_0x7875('0x3'));var router=express[_0x7875('0x4')]();var auth=require(_0x7875('0x5'));var interaction=require(_0x7875('0x6'));var config=require(_0x7875('0x7'));var controller=require('./automation.controller');router[_0x7875('0x8')]('/',auth[_0x7875('0x9')](),controller[_0x7875('0xa')]);router[_0x7875('0x8')](_0x7875('0xb'),auth[_0x7875('0x9')](),controller[_0x7875('0xc')]);router[_0x7875('0x8')](_0x7875('0xd'),auth[_0x7875('0x9')](),controller[_0x7875('0xe')]);router[_0x7875('0x8')]('/:id/actions',auth[_0x7875('0x9')](),controller[_0x7875('0xf')]);router[_0x7875('0x10')]('/',auth['isAuthenticated'](),controller[_0x7875('0x11')]);router[_0x7875('0x10')]('/:id/conditions',auth[_0x7875('0x9')](),controller['addConditions']);router[_0x7875('0x10')](_0x7875('0x12'),auth[_0x7875('0x9')](),controller['addActions']);router['put'](_0x7875('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7875('0x13')](_0x7875('0xb'),auth['isAuthenticated'](),controller[_0x7875('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7b84=['/:id','show','getConditions','/:id/actions','getActions','create','post','/:id/conditions','addConditions','addActions','update','delete','exports','multer','util','path','express','Router','../../config/environment','./automation.controller','get','isAuthenticated','index'];(function(_0x1587cd,_0x4f8b40){var _0x5c74da=function(_0x1ade27){while(--_0x1ade27){_0x1587cd['push'](_0x1587cd['shift']());}};_0x5c74da(++_0x4f8b40);}(_0x7b84,0x80));var _0x47b8=function(_0x2bb742,_0x530b7a){_0x2bb742=_0x2bb742-0x0;var _0x80d16c=_0x7b84[_0x2bb742];return _0x80d16c;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x47b8('0x3'));var router=express[_0x47b8('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x47b8('0x5'));var controller=require(_0x47b8('0x6'));router[_0x47b8('0x7')]('/',auth[_0x47b8('0x8')](),controller[_0x47b8('0x9')]);router[_0x47b8('0x7')](_0x47b8('0xa'),auth[_0x47b8('0x8')](),controller[_0x47b8('0xb')]);router[_0x47b8('0x7')]('/:id/conditions',auth[_0x47b8('0x8')](),controller[_0x47b8('0xc')]);router[_0x47b8('0x7')](_0x47b8('0xd'),auth['isAuthenticated'](),controller[_0x47b8('0xe')]);router['post']('/',auth[_0x47b8('0x8')](),controller[_0x47b8('0xf')]);router[_0x47b8('0x10')](_0x47b8('0x11'),auth[_0x47b8('0x8')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x10')](_0x47b8('0xd'),auth[_0x47b8('0x8')](),controller[_0x47b8('0x13')]);router['put'](_0x47b8('0xa'),auth[_0x47b8('0x8')](),controller[_0x47b8('0x14')]);router[_0x47b8('0x15')]('/:id',auth[_0x47b8('0x8')](),controller['destroy']);module[_0x47b8('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index d7b423f..d66d24a 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 _0x709d=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x4333c0,_0x1b8b7d){var _0x1ea60b=function(_0x36a1ea){while(--_0x36a1ea){_0x4333c0['push'](_0x4333c0['shift']());}};_0x1ea60b(++_0x1b8b7d);}(_0x709d,0x6d));var _0xd709=function(_0x3205cf,_0x14725b){_0x3205cf=_0x3205cf-0x0;var _0x2dd813=_0x709d[_0x3205cf];return _0x2dd813;};'use strict';var Sequelize=require(_0xd709('0x0'));module[_0xd709('0x1')]={'name':{'type':Sequelize[_0xd709('0x2')],'unique':_0xd709('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd709('0x4')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd709('0x2')]},'active':{'type':Sequelize[_0xd709('0x5')],'defaultValue':0x0,'comment':_0xd709('0x6')},'limitCalls':{'type':Sequelize[_0xd709('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd709('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd709('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd709('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xd709('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd709('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd709('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd709('0x2')],'defaultValue':_0xd709('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xd709('0x4')]('always',_0xd709('0xe'),_0xd709('0xf')),'defaultValue':_0xd709('0x10')},'dialAMDActive':{'type':Sequelize[_0xd709('0x5')],'defaultValue':0x0,'comment':_0xd709('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd709('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd709('0x7')](0x9)[_0xd709('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd709('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd709('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd709('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd709('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd709('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd709('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd709('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd709('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd709('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd709('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd709('0x4')](_0xd709('0x18'),_0xd709('0x19')),'defaultValue':_0xd709('0x18')},'dialPrefix':{'type':Sequelize[_0xd709('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd709('0x1a')},'dialCutDigit':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd709('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd709('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd709('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)[_0xd709('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd709('0x7')](0x3)[_0xd709('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd709('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd709('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd709('0x22')}}; \ No newline at end of file +var _0x8315=['never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\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)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\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)','07:00-22:00,*,*,*'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x8315,0x1d2));var _0x5831=function(_0x186415,_0x54fc1f){_0x186415=_0x186415-0x0;var _0x4da132=_0x8315[_0x186415];return _0x4da132;};'use strict';var Sequelize=require('sequelize');module[_0x5831('0x0')]={'name':{'type':Sequelize[_0x5831('0x1')],'unique':_0x5831('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5831('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x5831('0x4')},'description':{'type':Sequelize[_0x5831('0x1')]},'active':{'type':Sequelize[_0x5831('0x5')],'defaultValue':0x0,'comment':_0x5831('0x6')},'limitCalls':{'type':Sequelize[_0x5831('0x7')](0x4)[_0x5831('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5831('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5831('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5831('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x5831('0x7')](0x3)[_0x5831('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5831('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5831('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5831('0x7')](0x3)[_0x5831('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5831('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5831('0x7')](0x3)[_0x5831('0x8')],'defaultValue':0x3,'comment':_0x5831('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5831('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5831('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5831('0x7')](0x3)[_0x5831('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5831('0xd')},'dialTimezone':{'type':Sequelize[_0x5831('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5831('0x1')],'defaultValue':_0x5831('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x5831('0x3')]('always',_0x5831('0xf'),'onlyIfOpen'),'defaultValue':_0x5831('0x10')},'dialAMDActive':{'type':Sequelize[_0x5831('0x5')],'defaultValue':0x0,'comment':_0x5831('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x5831('0x7')](0x9)[_0x5831('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5831('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x5831('0x7')](0x9)[_0x5831('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5831('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5831('0x7')](0x9)[_0x5831('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5831('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5831('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5831('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5831('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5831('0x7')](0x9)[_0x5831('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5831('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5831('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5831('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5831('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5831('0x3')]('DESC',_0x5831('0x19')),'defaultValue':_0x5831('0x1a')},'dialPrefix':{'type':Sequelize[_0x5831('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5831('0x7')](0x3)[_0x5831('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x5831('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5831('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5831('0x7')](0x3)[_0x5831('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5831('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5831('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5831('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x5831('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5831('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x5831('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5831('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5831('0x7')](0x3)[_0x5831('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5831('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5831('0x7')](0x5)[_0x5831('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5831('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x5831('0x7')](0x3)[_0x5831('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5831('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5831('0x7')](0x5)[_0x5831('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5831('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5831('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5831('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5831('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 788c06c..59dfa72 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 _0x9279=['fieldName','type','key','model','name','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','limit','order','where','filters','filter','merge','count','include','findAll','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','clone','params','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','sort','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','push','sequelize','all','removeLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','Campaign','rawAttributes'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x9279,0x1f3));var _0x9927=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x9279[_0x2601b4];return _0x3e3661;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9927('0x0'));var zipdir=require(_0x9927('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9927('0x2'));var moment=require(_0x9927('0x3'));var BPromise=require(_0x9927('0x4'));var Mustache=require(_0x9927('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9927('0x6'));var csv=require(_0x9927('0x7'));var ejs=require(_0x9927('0x8'));var fs=require('fs');var _=require(_0x9927('0x9'));var squel=require(_0x9927('0xa'));var crypto=require(_0x9927('0xb'));var jsforce=require(_0x9927('0xc'));var deskjs=require(_0x9927('0xd'));var toCsv=require(_0x9927('0x7'));var querystring=require(_0x9927('0xe'));var Papa=require('papaparse');var Redis=require(_0x9927('0xf'));var authService=require(_0x9927('0x10'));var qs=require(_0x9927('0x11'));var as=require(_0x9927('0x12'));var hardwareService=require(_0x9927('0x13'));var logger=require(_0x9927('0x14'))(_0x9927('0x15'));var utils=require(_0x9927('0x16'));var config=require(_0x9927('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59b6ca,_0xc3c0fb){_0xc3c0fb=_0xc3c0fb||0xcc;return function(_0x14be31){if(_0x14be31){return _0x59b6ca[_0x9927('0x18')](_0xc3c0fb);}return _0x59b6ca[_0x9927('0x19')](_0xc3c0fb)[_0x9927('0x1a')]();};}function respondWithResult(_0x114a7d,_0x3b801a){_0x3b801a=_0x3b801a||0xc8;return function(_0x3a636b){if(_0x3a636b){return _0x114a7d['status'](_0x3b801a)[_0x9927('0x1b')](_0x3a636b);}};}function respondWithFilteredResult(_0x267bee,_0x4b42e2){return function(_0x554cf8){if(_0x554cf8){var _0x155815=_0x554cf8['count'],_0x21fd8a=_0x4b42e2[_0x9927('0x1c')],_0x4ef1a3=_0x4b42e2[_0x9927('0x1c')]+_0x4b42e2['limit'],_0x4ea8e1;if(_0x4ef1a3>=_0x155815){_0x4ef1a3=_0x155815;_0x4ea8e1=0xc8;}else{_0x4ea8e1=0xce;}_0x267bee['status'](_0x4ea8e1);return _0x267bee[_0x9927('0x1d')](_0x9927('0x1e'),_0x21fd8a+'-'+_0x4ef1a3+'/'+_0x155815)['json'](_0x554cf8);}return null;};}function patchUpdates(_0x2c8920){return function(_0x228e4b){try{jsonpatch['apply'](_0x228e4b,_0x2c8920,!![]);}catch(_0x4c1c20){return BPromise[_0x9927('0x1f')](_0x4c1c20);}return _0x228e4b[_0x9927('0x20')]();};}function saveUpdates(_0x2957eb,_0x523ca9){return function(_0x36d393){if(_0x36d393){return _0x36d393[_0x9927('0x21')](_0x2957eb)[_0x9927('0x22')](function(_0x449d4e){return _0x449d4e;});}return null;};}function removeEntity(_0xd3e57c,_0x26ce98){return function(_0x290e02){if(_0x290e02){return _0x290e02[_0x9927('0x23')]()[_0x9927('0x22')](function(){var _0x396ca6=_0x290e02[_0x9927('0x24')]({'plain':!![]});var _0x129316='IvrCampaigns';return db[_0x9927('0x25')][_0x9927('0x23')]({'where':{'type':_0x129316,'resourceId':_0x396ca6['id']}})[_0x9927('0x22')](function(){return _0x290e02;});})[_0x9927('0x22')](function(){_0xd3e57c[_0x9927('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x451b56,_0x39d210){return function(_0x5da278){if(!_0x5da278){_0x451b56[_0x9927('0x18')](0x194);}return _0x5da278;};}function handleError(_0x3a5a70,_0x3db2ef){_0x3db2ef=_0x3db2ef||0x1f4;return function(_0x548aa3){logger[_0x9927('0x26')](_0x548aa3[_0x9927('0x27')]);if(_0x548aa3['name']){delete _0x548aa3['name'];}_0x3a5a70[_0x9927('0x19')](_0x3db2ef)[_0x9927('0x28')](_0x548aa3);};}exports[_0x9927('0x29')]=function(_0x4f1533,_0x28e0c2){var _0x567a90={},_0x150493={},_0x163b0b={'count':0x0,'rows':[]};var _0x41a54a=_[_0x9927('0x2a')](db[_0x9927('0x2b')][_0x9927('0x2c')],function(_0x3acb61){return{'name':_0x3acb61[_0x9927('0x2d')],'type':_0x3acb61[_0x9927('0x2e')][_0x9927('0x2f')]};});_0x150493[_0x9927('0x30')]=_['map'](_0x41a54a,_0x9927('0x31'));_0x150493['query']=_[_0x9927('0x32')](_0x4f1533['query']);_0x150493['filters']=_[_0x9927('0x33')](_0x150493['model'],_0x150493['query']);_0x567a90[_0x9927('0x34')]=_[_0x9927('0x33')](_0x150493[_0x9927('0x30')],qs[_0x9927('0x35')](_0x4f1533[_0x9927('0x36')]['fields']));_0x567a90[_0x9927('0x34')]=_0x567a90['attributes'][_0x9927('0x37')]?_0x567a90[_0x9927('0x34')]:_0x150493[_0x9927('0x30')];if(!_0x4f1533['query'][_0x9927('0x38')](_0x9927('0x39'))){_0x567a90[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x4f1533[_0x9927('0x36')][_0x9927('0x3a')]);_0x567a90[_0x9927('0x1c')]=qs[_0x9927('0x1c')](_0x4f1533[_0x9927('0x36')][_0x9927('0x1c')]);}_0x567a90[_0x9927('0x3b')]=qs['sort'](_0x4f1533[_0x9927('0x36')]['sort']);_0x567a90[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_['pick'](_0x4f1533[_0x9927('0x36')],_0x150493[_0x9927('0x3d')]),_0x41a54a);if(_0x4f1533['query'][_0x9927('0x3e')]){_0x567a90[_0x9927('0x3c')]=_[_0x9927('0x3f')](_0x567a90[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x41a54a,function(_0x12ceb1){if(_0x12ceb1['type']!=='VIRTUAL'){var _0xf0bbee={};_0xf0bbee[_0x12ceb1['name']]={'$like':'%'+_0x4f1533[_0x9927('0x36')][_0x9927('0x3e')]+'%'};return _0xf0bbee;}})});}_0x567a90=_[_0x9927('0x3f')]({},_0x567a90,_0x4f1533['options']);var _0x591469={'where':_0x567a90['where']};return db[_0x9927('0x2b')][_0x9927('0x40')](_0x591469)['then'](function(_0x3a0846){_0x163b0b[_0x9927('0x40')]=_0x3a0846;if(_0x4f1533['query']['includeAll']){_0x567a90[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x2b')][_0x9927('0x42')](_0x567a90);})[_0x9927('0x22')](function(_0x36668a){_0x163b0b['rows']=_0x36668a;return _0x163b0b;})[_0x9927('0x22')](respondWithFilteredResult(_0x28e0c2,_0x567a90))[_0x9927('0x43')](handleError(_0x28e0c2,null));};exports[_0x9927('0x44')]=function(_0x57a893,_0x4c7f5f){var _0x296254={'raw':![],'where':{'id':_0x57a893['params']['id']}},_0x3d4ff6={};_0x3d4ff6[_0x9927('0x30')]=_[_0x9927('0x32')](db[_0x9927('0x2b')][_0x9927('0x2c')]);_0x3d4ff6['query']=_[_0x9927('0x32')](_0x57a893[_0x9927('0x36')]);_0x3d4ff6[_0x9927('0x3d')]=_[_0x9927('0x33')](_0x3d4ff6[_0x9927('0x30')],_0x3d4ff6[_0x9927('0x36')]);_0x296254['attributes']=_[_0x9927('0x33')](_0x3d4ff6[_0x9927('0x30')],qs[_0x9927('0x35')](_0x57a893[_0x9927('0x36')]['fields']));_0x296254[_0x9927('0x34')]=_0x296254[_0x9927('0x34')][_0x9927('0x37')]?_0x296254['attributes']:_0x3d4ff6['model'];if(_0x57a893[_0x9927('0x36')][_0x9927('0x45')]){_0x296254[_0x9927('0x41')]=[{'all':!![]}];}_0x296254=_[_0x9927('0x3f')]({},_0x296254,_0x57a893[_0x9927('0x46')]);return db[_0x9927('0x2b')][_0x9927('0x47')](_0x296254)[_0x9927('0x22')](handleEntityNotFound(_0x4c7f5f,null))[_0x9927('0x22')](respondWithResult(_0x4c7f5f,null))['catch'](handleError(_0x4c7f5f,null));};exports[_0x9927('0x48')]=function(_0x38906f,_0x3f75bd){return db[_0x9927('0x2b')][_0x9927('0x48')](_0x38906f[_0x9927('0x49')],{})[_0x9927('0x22')](function(_0x20b0ea){var _0x39f2cc=_0x38906f[_0x9927('0x4a')][_0x9927('0x24')]({'plain':!![]});if(!_0x39f2cc)throw new Error(_0x9927('0x4b'));if(_0x39f2cc[_0x9927('0x4c')]===_0x9927('0x4a')){var _0x378593=_0x20b0ea['get']({'plain':!![]});var _0x192f9a=_0x9927('0x4d');return db[_0x9927('0x4e')][_0x9927('0x47')]({'where':{'name':_0x192f9a,'userProfileId':_0x39f2cc[_0x9927('0x4f')]},'raw':!![]})[_0x9927('0x22')](function(_0x11035b){if(_0x11035b&&_0x11035b[_0x9927('0x50')]===0x0){return db['UserProfileResource'][_0x9927('0x48')]({'name':_0x378593[_0x9927('0x31')],'resourceId':_0x378593['id'],'type':_0x11035b[_0x9927('0x31')],'sectionId':_0x11035b['id']},{})[_0x9927('0x22')](function(){return _0x20b0ea;});}else{return _0x20b0ea;}})['catch'](function(_0x25eaf3){logger[_0x9927('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25eaf3);throw _0x25eaf3;});}return _0x20b0ea;})[_0x9927('0x22')](respondWithResult(_0x3f75bd,0xc9))[_0x9927('0x43')](handleError(_0x3f75bd,null));};exports[_0x9927('0x51')]=function(_0x31230b,_0x39f6df){var _0x49dfc4={'where':{'id':_0x31230b[_0x9927('0x52')]['id']}},_0x4a760d={};_0x4a760d[_0x9927('0x30')]=_[_0x9927('0x32')](db[_0x9927('0x2b')][_0x9927('0x2c')]);_0x49dfc4['attributes']=_[_0x9927('0x33')](_0x4a760d['model'],qs['fields'](_0x31230b['query'][_0x9927('0x35')]));_0x49dfc4[_0x9927('0x34')]=_0x49dfc4[_0x9927('0x34')]['length']?_0x49dfc4[_0x9927('0x34')]:_0x4a760d[_0x9927('0x30')];if(_0x31230b[_0x9927('0x36')][_0x9927('0x45')]){_0x49dfc4['include']=[{'all':!![]}];}_0x49dfc4=_[_0x9927('0x3f')]({},_0x49dfc4,_0x31230b[_0x9927('0x46')]);return db[_0x9927('0x2b')][_0x9927('0x47')](_0x49dfc4)['then'](handleEntityNotFound(_0x39f6df,null))['then'](function(_0x336f48){if(_0x336f48){var _0x2fa372=_0x336f48['get']({'plain':!![]});_0x2fa372=qs[_0x9927('0x53')](_0x2fa372,['id','createdAt',_0x9927('0x54')]);_0x31230b['body']=_[_0x9927('0x53')](_0x31230b['body'],['id',_0x9927('0x55'),_0x9927('0x54')]);return db[_0x9927('0x2b')][_0x9927('0x48')](_[_0x9927('0x3f')](_0x2fa372,_0x31230b['body']),{'include':_0x31230b[_0x9927('0x36')][_0x9927('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x29c97f){var _0x200fa2=_0x31230b[_0x9927('0x4a')][_0x9927('0x24')]({'plain':!![]});if(!_0x200fa2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200fa2[_0x9927('0x4c')]===_0x9927('0x4a')){var _0x5bf7e7=_0x29c97f[_0x9927('0x24')]({'plain':!![]});var _0x9be662=_0x9927('0x4d');return db[_0x9927('0x4e')][_0x9927('0x47')]({'where':{'name':_0x9be662,'userProfileId':_0x200fa2['userProfileId']},'raw':!![]})['then'](function(_0x4dfac6){if(_0x4dfac6&&_0x4dfac6[_0x9927('0x50')]===0x0){return db[_0x9927('0x25')]['create']({'name':_0x5bf7e7['name'],'resourceId':_0x5bf7e7['id'],'type':_0x4dfac6[_0x9927('0x31')],'sectionId':_0x4dfac6['id']},{})['then'](function(){return _0x29c97f;});}else{return _0x29c97f;}})['catch'](function(_0x5eeeba){logger[_0x9927('0x26')](_0x9927('0x56'),_0x5eeeba);throw _0x5eeeba;});}return _0x29c97f;});}})['then'](respondWithResult(_0x39f6df,0xc9))[_0x9927('0x43')](handleError(_0x39f6df,null));};exports[_0x9927('0x21')]=function(_0xfe10e1,_0x2ebfcf){if(_0xfe10e1['body']['id']){delete _0xfe10e1[_0x9927('0x49')]['id'];}return db[_0x9927('0x2b')][_0x9927('0x47')]({'where':{'id':_0xfe10e1[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x2ebfcf,null))[_0x9927('0x22')](saveUpdates(_0xfe10e1[_0x9927('0x49')],null))[_0x9927('0x22')](respondWithResult(_0x2ebfcf,null))[_0x9927('0x43')](handleError(_0x2ebfcf,null));};exports['destroy']=function(_0x3cff2b,_0x436722){return db[_0x9927('0x2b')]['find']({'where':{'id':_0x3cff2b[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x436722,null))[_0x9927('0x22')](removeEntity(_0x436722,null))[_0x9927('0x43')](handleError(_0x436722,null));};exports[_0x9927('0x57')]=function(_0x4b2eff,_0x241357,_0x11be2d){var _0x4c68bf={'raw':!![],'where':{}};var _0x539f95={};var _0x386a61={'count':0x0,'rows':[]};return db[_0x9927('0x2b')][_0x9927('0x58')]({'where':{'id':_0x4b2eff[_0x9927('0x52')]['id']}})['then'](handleEntityNotFound(_0x241357,null))[_0x9927('0x22')](function(_0x1dc407){if(_0x1dc407){_0x539f95[_0x9927('0x30')]=_[_0x9927('0x32')](db[_0x9927('0x59')][_0x9927('0x2c')]);_0x539f95[_0x9927('0x36')]=_[_0x9927('0x32')](_0x4b2eff[_0x9927('0x36')]);_0x539f95['filters']=_['intersection'](_0x539f95[_0x9927('0x30')],_0x539f95['query']);_0x4c68bf['attributes']=_[_0x9927('0x33')](_0x539f95['model'],qs['fields'](_0x4b2eff[_0x9927('0x36')][_0x9927('0x35')]));_0x4c68bf[_0x9927('0x34')]=_0x4c68bf[_0x9927('0x34')]['length']?_0x4c68bf[_0x9927('0x34')]:_0x539f95[_0x9927('0x30')];if(!_0x4b2eff[_0x9927('0x36')][_0x9927('0x38')](_0x9927('0x39'))){_0x4c68bf[_0x9927('0x3a')]=qs['limit'](_0x4b2eff['query'][_0x9927('0x3a')]);_0x4c68bf['offset']=qs[_0x9927('0x1c')](_0x4b2eff[_0x9927('0x36')]['offset']);}_0x4c68bf[_0x9927('0x3b')]=qs[_0x9927('0x5a')](_0x4b2eff[_0x9927('0x36')][_0x9927('0x5a')]);_0x4c68bf['where']=qs[_0x9927('0x3d')](_[_0x9927('0x5b')](_0x4b2eff[_0x9927('0x36')],_0x539f95['filters']));_0x4c68bf[_0x9927('0x3c')][_0x9927('0x5c')]=_0x1dc407['id'];if(_0x4b2eff[_0x9927('0x36')][_0x9927('0x3e')]){_0x4c68bf[_0x9927('0x3c')]=_['merge'](_0x4c68bf[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x4c68bf[_0x9927('0x34')],function(_0x1840f5){var _0x5ac238={};_0x5ac238[_0x1840f5]={'$like':'%'+_0x4b2eff['query'][_0x9927('0x3e')]+'%'};return _0x5ac238;})});}_0x4c68bf=_[_0x9927('0x3f')]({},_0x4c68bf,_0x4b2eff[_0x9927('0x46')]);return db['CmHopper']['count']({'where':_0x4c68bf[_0x9927('0x3c')]})['then'](function(_0x44ad88){_0x386a61['count']=_0x44ad88;if(_0x4b2eff[_0x9927('0x36')][_0x9927('0x45')]){_0x4c68bf[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x59')][_0x9927('0x42')](_0x4c68bf);})[_0x9927('0x22')](function(_0x5cbf99){_0x386a61[_0x9927('0x5d')]=_0x5cbf99;return _0x386a61;});}})['then'](respondWithFilteredResult(_0x241357,_0x4c68bf))[_0x9927('0x43')](handleError(_0x241357,null));};exports[_0x9927('0x5e')]=function(_0x1b12d3,_0x101dde,_0x56959a){var _0x354fdc={'raw':!![],'where':{}};var _0x4c0ef0={};var _0x3725c4={'count':0x0,'rows':[]};return db[_0x9927('0x2b')][_0x9927('0x58')]({'where':{'id':_0x1b12d3[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x101dde,null))['then'](function(_0x420580){if(_0x420580){_0x4c0ef0['model']=_['keys'](db['CmHopperHistory'][_0x9927('0x2c')]);_0x4c0ef0[_0x9927('0x36')]=_[_0x9927('0x32')](_0x1b12d3[_0x9927('0x36')]);_0x4c0ef0['filters']=_[_0x9927('0x33')](_0x4c0ef0[_0x9927('0x30')],_0x4c0ef0[_0x9927('0x36')]);_0x354fdc[_0x9927('0x34')]=_['intersection'](_0x4c0ef0[_0x9927('0x30')],qs[_0x9927('0x35')](_0x1b12d3[_0x9927('0x36')][_0x9927('0x35')]));_0x354fdc['attributes']=_0x354fdc[_0x9927('0x34')][_0x9927('0x37')]?_0x354fdc[_0x9927('0x34')]:_0x4c0ef0[_0x9927('0x30')];if(!_0x1b12d3[_0x9927('0x36')][_0x9927('0x38')](_0x9927('0x39'))){_0x354fdc[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x1b12d3[_0x9927('0x36')]['limit']);_0x354fdc[_0x9927('0x1c')]=qs[_0x9927('0x1c')](_0x1b12d3[_0x9927('0x36')][_0x9927('0x1c')]);}_0x354fdc[_0x9927('0x3b')]=qs[_0x9927('0x5a')](_0x1b12d3[_0x9927('0x36')][_0x9927('0x5a')]);_0x354fdc[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_[_0x9927('0x5b')](_0x1b12d3[_0x9927('0x36')],_0x4c0ef0[_0x9927('0x3d')]));_0x354fdc[_0x9927('0x3c')][_0x9927('0x5c')]=_0x420580['id'];if(_0x1b12d3['query'][_0x9927('0x3e')]){_0x354fdc[_0x9927('0x3c')]=_[_0x9927('0x3f')](_0x354fdc['where'],{'$or':_[_0x9927('0x2a')](_0x354fdc[_0x9927('0x34')],function(_0x1e6635){var _0x1ebd85={};_0x1ebd85[_0x1e6635]={'$like':'%'+_0x1b12d3[_0x9927('0x36')][_0x9927('0x3e')]+'%'};return _0x1ebd85;})});}_0x354fdc=_[_0x9927('0x3f')]({},_0x354fdc,_0x1b12d3['options']);return db['CmHopperHistory']['count']({'where':_0x354fdc['where']})['then'](function(_0x3c27bb){_0x3725c4[_0x9927('0x40')]=_0x3c27bb;if(_0x1b12d3['query'][_0x9927('0x45')]){_0x354fdc[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x5f')][_0x9927('0x42')](_0x354fdc);})['then'](function(_0x1c27ce){_0x3725c4[_0x9927('0x5d')]=_0x1c27ce;return _0x3725c4;});}})[_0x9927('0x22')](respondWithFilteredResult(_0x101dde,_0x354fdc))['catch'](handleError(_0x101dde,null));};exports[_0x9927('0x60')]=function(_0x47f118,_0x5278ae,_0x3af814){var _0x4f4f59={'raw':!![],'where':{}};var _0x1084e4={};var _0x1a50c={'count':0x0,'rows':[]};return db[_0x9927('0x2b')][_0x9927('0x58')]({'where':{'id':_0x47f118[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x5278ae,null))['then'](function(_0x35bc26){if(_0x35bc26){_0x1084e4['model']=_[_0x9927('0x32')](db['CmHopperFinal'][_0x9927('0x2c')]);_0x1084e4[_0x9927('0x36')]=_[_0x9927('0x32')](_0x47f118[_0x9927('0x36')]);_0x1084e4['filters']=_[_0x9927('0x33')](_0x1084e4[_0x9927('0x30')],_0x1084e4[_0x9927('0x36')]);_0x4f4f59[_0x9927('0x34')]=_['intersection'](_0x1084e4[_0x9927('0x30')],qs['fields'](_0x47f118[_0x9927('0x36')]['fields']));_0x4f4f59[_0x9927('0x34')]=_0x4f4f59[_0x9927('0x34')][_0x9927('0x37')]?_0x4f4f59[_0x9927('0x34')]:_0x1084e4[_0x9927('0x30')];if(!_0x47f118['query'][_0x9927('0x38')](_0x9927('0x39'))){_0x4f4f59[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x47f118[_0x9927('0x36')][_0x9927('0x3a')]);_0x4f4f59[_0x9927('0x1c')]=qs[_0x9927('0x1c')](_0x47f118['query'][_0x9927('0x1c')]);}_0x4f4f59[_0x9927('0x3b')]=qs['sort'](_0x47f118[_0x9927('0x36')]['sort']);_0x4f4f59[_0x9927('0x3c')]=qs['filters'](_[_0x9927('0x5b')](_0x47f118[_0x9927('0x36')],_0x1084e4['filters']));_0x4f4f59[_0x9927('0x3c')][_0x9927('0x5c')]=_0x35bc26['id'];if(_0x47f118[_0x9927('0x36')]['filter']){_0x4f4f59[_0x9927('0x3c')]=_['merge'](_0x4f4f59[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x4f4f59[_0x9927('0x34')],function(_0x1a1144){var _0x599eeb={};_0x599eeb[_0x1a1144]={'$like':'%'+_0x47f118[_0x9927('0x36')][_0x9927('0x3e')]+'%'};return _0x599eeb;})});}_0x4f4f59=_[_0x9927('0x3f')]({},_0x4f4f59,_0x47f118[_0x9927('0x46')]);return db[_0x9927('0x61')][_0x9927('0x40')]({'where':_0x4f4f59[_0x9927('0x3c')]})[_0x9927('0x22')](function(_0x13e70a){_0x1a50c[_0x9927('0x40')]=_0x13e70a;if(_0x47f118[_0x9927('0x36')][_0x9927('0x45')]){_0x4f4f59[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x61')][_0x9927('0x42')](_0x4f4f59);})[_0x9927('0x22')](function(_0x518fe7){_0x1a50c['rows']=_0x518fe7;return _0x1a50c;});}})['then'](respondWithFilteredResult(_0x5278ae,_0x4f4f59))[_0x9927('0x43')](handleError(_0x5278ae,null));};exports[_0x9927('0x62')]=function(_0x4ed7e5,_0x2b16eb,_0x1cc27){var _0x4149f2={'raw':!![],'where':{}};var _0xefffde={};var _0x32d360={'count':0x0,'rows':[]};return db[_0x9927('0x2b')][_0x9927('0x58')]({'where':{'id':_0x4ed7e5['params']['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x2b16eb,null))[_0x9927('0x22')](function(_0x89b5f5){if(_0x89b5f5){_0xefffde[_0x9927('0x30')]=_['keys'](db[_0x9927('0x63')][_0x9927('0x2c')]);_0xefffde['query']=_['keys'](_0x4ed7e5[_0x9927('0x36')]);_0xefffde[_0x9927('0x3d')]=_[_0x9927('0x33')](_0xefffde['model'],_0xefffde[_0x9927('0x36')]);_0x4149f2[_0x9927('0x34')]=_[_0x9927('0x33')](_0xefffde[_0x9927('0x30')],qs[_0x9927('0x35')](_0x4ed7e5[_0x9927('0x36')][_0x9927('0x35')]));_0x4149f2[_0x9927('0x34')]=_0x4149f2[_0x9927('0x34')][_0x9927('0x37')]?_0x4149f2[_0x9927('0x34')]:_0xefffde[_0x9927('0x30')];if(!_0x4ed7e5[_0x9927('0x36')][_0x9927('0x38')]('nolimit')){_0x4149f2[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x4ed7e5[_0x9927('0x36')]['limit']);_0x4149f2['offset']=qs['offset'](_0x4ed7e5[_0x9927('0x36')][_0x9927('0x1c')]);}_0x4149f2['order']=qs['sort'](_0x4ed7e5[_0x9927('0x36')][_0x9927('0x5a')]);_0x4149f2[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_[_0x9927('0x5b')](_0x4ed7e5[_0x9927('0x36')],_0xefffde[_0x9927('0x3d')]));_0x4149f2[_0x9927('0x3c')]['CampaignId']=_0x89b5f5['id'];if(_0x4ed7e5[_0x9927('0x36')]['filter']){_0x4149f2[_0x9927('0x3c')]=_[_0x9927('0x3f')](_0x4149f2[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x4149f2[_0x9927('0x34')],function(_0x431f8e){var _0x536895={};_0x536895[_0x431f8e]={'$like':'%'+_0x4ed7e5[_0x9927('0x36')]['filter']+'%'};return _0x536895;})});}_0x4149f2=_['merge']({},_0x4149f2,_0x4ed7e5[_0x9927('0x46')]);return db[_0x9927('0x63')]['count']({'where':_0x4149f2[_0x9927('0x3c')]})[_0x9927('0x22')](function(_0x3e79eb){_0x32d360[_0x9927('0x40')]=_0x3e79eb;if(_0x4ed7e5['query'][_0x9927('0x45')]){_0x4149f2[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x63')]['findAll'](_0x4149f2);})[_0x9927('0x22')](function(_0xb3f98){_0x32d360['rows']=_0xb3f98;return _0x32d360;});}})[_0x9927('0x22')](respondWithFilteredResult(_0x2b16eb,_0x4149f2))[_0x9927('0x43')](handleError(_0x2b16eb,null));};exports['getLists']=function(_0x1e9ba5,_0x15065e,_0x1deca6){var _0x53c16a={};var _0x52f37b={};var _0x48fa8b;var _0x51a924;return db[_0x9927('0x2b')]['findOne']({'where':{'id':_0x1e9ba5[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x15065e,null))[_0x9927('0x22')](function(_0x3361de){if(_0x3361de){_0x48fa8b=_0x3361de;_0x52f37b[_0x9927('0x30')]=_[_0x9927('0x32')](db[_0x9927('0x64')][_0x9927('0x2c')]);_0x52f37b[_0x9927('0x36')]=_['keys'](_0x1e9ba5[_0x9927('0x36')]);_0x52f37b['filters']=_[_0x9927('0x33')](_0x52f37b[_0x9927('0x30')],_0x52f37b['query']);_0x53c16a['attributes']=_[_0x9927('0x33')](_0x52f37b[_0x9927('0x30')],qs[_0x9927('0x35')](_0x1e9ba5[_0x9927('0x36')][_0x9927('0x35')]));_0x53c16a[_0x9927('0x34')]=_0x53c16a[_0x9927('0x34')][_0x9927('0x37')]?_0x53c16a[_0x9927('0x34')]:_0x52f37b[_0x9927('0x30')];_0x53c16a[_0x9927('0x3b')]=qs['sort'](_0x1e9ba5[_0x9927('0x36')][_0x9927('0x5a')]);_0x53c16a[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_[_0x9927('0x5b')](_0x1e9ba5[_0x9927('0x36')],_0x52f37b['filters']));if(_0x1e9ba5['query'][_0x9927('0x3e')]){_0x53c16a[_0x9927('0x3c')]=_['merge'](_0x53c16a[_0x9927('0x3c')],{'$or':_['map'](_0x53c16a[_0x9927('0x34')],function(_0xffe09e){var _0x46c2dc={};_0x46c2dc[_0xffe09e]={'$like':'%'+_0x1e9ba5[_0x9927('0x36')]['filter']+'%'};return _0x46c2dc;})});}_0x53c16a=_[_0x9927('0x3f')]({},_0x53c16a,_0x1e9ba5[_0x9927('0x46')]);return _0x48fa8b[_0x9927('0x65')](_0x53c16a);}})[_0x9927('0x22')](function(_0x31c4e8){if(_0x31c4e8){_0x51a924=_0x31c4e8[_0x9927('0x37')];if(!_0x1e9ba5[_0x9927('0x36')]['hasOwnProperty'](_0x9927('0x39'))){_0x53c16a['limit']=qs[_0x9927('0x3a')](_0x1e9ba5[_0x9927('0x36')][_0x9927('0x3a')]);_0x53c16a['offset']=qs[_0x9927('0x1c')](_0x1e9ba5[_0x9927('0x36')][_0x9927('0x1c')]);}return _0x48fa8b[_0x9927('0x65')](_0x53c16a);}})[_0x9927('0x22')](function(_0x7871a8){if(_0x7871a8){return _0x7871a8?{'count':_0x51a924,'rows':_0x7871a8}:null;}})['then'](respondWithResult(_0x15065e,null))[_0x9927('0x43')](handleError(_0x15065e,null));};exports[_0x9927('0x66')]=function(_0x46db2e,_0xec684f,_0x27f457){var _0x358742,_0x249c17;return db[_0x9927('0x2b')][_0x9927('0x47')]({'where':{'id':_0x46db2e[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0xec684f,null))[_0x9927('0x22')](function(_0x198680){if(_0x198680){_0x249c17=_0x198680;return _0x198680[_0x9927('0x66')](_0x46db2e[_0x9927('0x49')][_0x9927('0x67')],_[_0x9927('0x53')](_0x46db2e[_0x9927('0x49')],['ids','id'])||{});}return null;})[_0x9927('0x68')](function(_0xad7f60){var _0xe7df12;_0x358742=_0xad7f60||[];var _0x4ccb9d=[];if(_0xad7f60){for(var _0xea8c3d=0x0;_0xea8c3d<_0xad7f60[_0x9927('0x37')];_0xea8c3d+=0x1){var _0xe7eec=_0xad7f60[_0xea8c3d][_0x9927('0x24')]({'plain':!![]});_0x249c17[_0x9927('0x69')]=_0x46db2e[_0x9927('0x49')][_0x9927('0x69')]?_0x46db2e['body'][_0x9927('0x69')]:_0x249c17[_0x9927('0x69')];switch(_0x249c17[_0x9927('0x69')]){case'always':_0xe7df12=squel[_0x9927('0x6a')]()[_0x9927('0x6b')]('cm_hopper')[_0x9927('0x6c')]([_0x9927('0x6d'),_0x9927('0x6e'),_0x9927('0x6f'),_0x9927('0x70'),_0x9927('0x5c'),_0x9927('0x55'),'updatedAt'],squel['select']()[_0x9927('0x71')]('phone','phone')['field']('NOW()',_0x9927('0x6e'))[_0x9927('0x71')]('id',_0x9927('0x6f'))['field'](_0xe7eec[_0x9927('0x72')]['toString'](),_0x9927('0x70'))['field'](_0x46db2e['params']['id'][_0x9927('0x73')](),'CampaignId')[_0x9927('0x71')]('NOW()','createdAt')['field'](_0x9927('0x74'),_0x9927('0x54'))[_0x9927('0x75')](_0x9927('0x76'))[_0x9927('0x3c')](_0x9927('0x77'))['where'](_0x9927('0x78'),_0xe7eec[_0x9927('0x72')]['toString']())[_0x9927('0x3c')](_0x9927('0x79'))[_0x9927('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x9927('0x71')](_0x9927('0x7a'))[_0x9927('0x75')](_0x9927('0x7b'))[_0x9927('0x3c')](_0x9927('0x7c'),_0x46db2e[_0x9927('0x52')]['id'][_0x9927('0x73')]()))['where'](_0x9927('0x7d'),squel[_0x9927('0x7e')]()[_0x9927('0x71')](_0x9927('0x7f'))[_0x9927('0x75')](_0x9927('0x80'))['where'](_0x9927('0x7c'),_0x46db2e[_0x9927('0x52')]['id'][_0x9927('0x73')]())))[_0x9927('0x73')]();break;case _0x9927('0x81'):_0xe7df12=squel[_0x9927('0x6a')]()['into'](_0x9927('0x80'))['fromQuery']([_0x9927('0x6d'),_0x9927('0x6e'),_0x9927('0x6f'),_0x9927('0x70'),_0x9927('0x5c'),_0x9927('0x55'),_0x9927('0x54')],squel['select']()[_0x9927('0x71')](_0x9927('0x6d'),'phone')[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x6e'))[_0x9927('0x71')]('id',_0x9927('0x6f'))[_0x9927('0x71')](_0xe7eec[_0x9927('0x72')][_0x9927('0x73')](),_0x9927('0x70'))['field'](_0x46db2e[_0x9927('0x52')]['id']['toString'](),_0x9927('0x5c'))['field'](_0x9927('0x74'),_0x9927('0x55'))['field'](_0x9927('0x74'),_0x9927('0x54'))['from'](_0x9927('0x76'))[_0x9927('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0x9927('0x78'),_0xe7eec['CmListId'][_0x9927('0x73')]())[_0x9927('0x3c')](_0x9927('0x79'))[_0x9927('0x3c')](_0x9927('0x7d'),squel[_0x9927('0x7e')]()['field'](_0x9927('0x7f'))[_0x9927('0x75')](_0x9927('0x80'))['where'](_0x9927('0x7c'),_0x46db2e[_0x9927('0x52')]['id'][_0x9927('0x73')]())))[_0x9927('0x73')]();break;default:_0xe7df12=squel[_0x9927('0x6a')]()[_0x9927('0x6b')](_0x9927('0x80'))[_0x9927('0x6c')]([_0x9927('0x6d'),_0x9927('0x6e'),_0x9927('0x6f'),_0x9927('0x70'),_0x9927('0x5c'),_0x9927('0x55'),'updatedAt'],squel[_0x9927('0x7e')]()['field'](_0x9927('0x6d'),'phone')[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x6e'))[_0x9927('0x71')]('id','ContactId')[_0x9927('0x71')](_0xe7eec[_0x9927('0x72')][_0x9927('0x73')](),'ListId')['field'](_0x46db2e[_0x9927('0x52')]['id'][_0x9927('0x73')](),_0x9927('0x5c'))[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x55'))[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x54'))['from']('cm_contacts')[_0x9927('0x3c')]('deletedAt\x20IS\x20NULL')[_0x9927('0x3c')](_0x9927('0x78'),_0xe7eec[_0x9927('0x72')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x9927('0x73')]();}_0x4ccb9d[_0x9927('0x82')](db[_0x9927('0x83')]['query'](_0xe7df12));}return BPromise[_0x9927('0x84')](_0x4ccb9d);}})[_0x9927('0x22')](function(){return _0x358742;})['then'](respondWithResult(_0xec684f,null))[_0x9927('0x43')](handleError(_0xec684f,null));};exports[_0x9927('0x85')]=function(_0x584892,_0x53b365,_0x24dedb){return db[_0x9927('0x2b')][_0x9927('0x47')]({'where':{'id':_0x584892['params']['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x53b365,null))[_0x9927('0x22')](function(_0x323e19){if(_0x323e19){return _0x323e19[_0x9927('0x85')](_0x584892[_0x9927('0x36')][_0x9927('0x67')]);}})[_0x9927('0x22')](function(_0x5f0724){if(_0x5f0724){return db[_0x9927('0x59')][_0x9927('0x23')]({'where':{'ListId':_0x584892[_0x9927('0x36')][_0x9927('0x67')],'CampaignId':_0x584892[_0x9927('0x52')]['id']}})[_0x9927('0x22')](function(){return _0x5f0724;});}})[_0x9927('0x22')](respondWithStatusCode(_0x53b365,null))[_0x9927('0x43')](handleError(_0x53b365,null));};exports['getBlackLists']=function(_0x572fc4,_0xd6c541,_0x31522c){var _0x252956={'raw':!![],'where':{}};var _0x2882c0={};var _0x509563={'count':0x0,'rows':[]};return db[_0x9927('0x2b')]['findOne']({'where':{'id':_0x572fc4[_0x9927('0x52')]['id']}})['then'](handleEntityNotFound(_0xd6c541,null))['then'](function(_0x4eb9c4){if(_0x4eb9c4){_0x2882c0['model']=_[_0x9927('0x32')](db[_0x9927('0x64')]['rawAttributes']);_0x2882c0['query']=_[_0x9927('0x32')](_0x572fc4['query']);_0x2882c0[_0x9927('0x3d')]=_['intersection'](_0x2882c0[_0x9927('0x30')],_0x2882c0[_0x9927('0x36')]);_0x252956[_0x9927('0x34')]=_[_0x9927('0x33')](_0x2882c0[_0x9927('0x30')],qs['fields'](_0x572fc4[_0x9927('0x36')][_0x9927('0x35')]));_0x252956[_0x9927('0x34')]=_0x252956['attributes']['length']?_0x252956[_0x9927('0x34')]:_0x2882c0[_0x9927('0x30')];if(!_0x572fc4[_0x9927('0x36')][_0x9927('0x38')](_0x9927('0x39'))){_0x252956[_0x9927('0x3a')]=qs[_0x9927('0x3a')](_0x572fc4[_0x9927('0x36')]['limit']);_0x252956['offset']=qs[_0x9927('0x1c')](_0x572fc4[_0x9927('0x36')]['offset']);}_0x252956[_0x9927('0x3b')]=qs[_0x9927('0x5a')](_0x572fc4['query'][_0x9927('0x5a')]);_0x252956[_0x9927('0x3c')]=qs[_0x9927('0x3d')](_['pick'](_0x572fc4[_0x9927('0x36')],_0x2882c0[_0x9927('0x3d')]));_0x252956[_0x9927('0x3c')][_0x9927('0x5c')]=_0x4eb9c4['id'];if(_0x572fc4[_0x9927('0x36')][_0x9927('0x3e')]){_0x252956[_0x9927('0x3c')]=_['merge'](_0x252956[_0x9927('0x3c')],{'$or':_[_0x9927('0x2a')](_0x252956['attributes'],function(_0x2c3b4b){var _0xa7c3ae={};_0xa7c3ae[_0x2c3b4b]={'$like':'%'+_0x572fc4[_0x9927('0x36')][_0x9927('0x3e')]+'%'};return _0xa7c3ae;})});}_0x252956=_[_0x9927('0x3f')]({},_0x252956,_0x572fc4[_0x9927('0x46')]);return db['CmList'][_0x9927('0x40')]({'where':_0x252956['where']})[_0x9927('0x22')](function(_0x2db054){_0x509563['count']=_0x2db054;if(_0x572fc4[_0x9927('0x36')][_0x9927('0x45')]){_0x252956[_0x9927('0x41')]=[{'all':!![]}];}return db[_0x9927('0x64')][_0x9927('0x42')](_0x252956);})['then'](function(_0x2d8a52){_0x509563[_0x9927('0x5d')]=_0x2d8a52;return _0x509563;});}})[_0x9927('0x22')](respondWithFilteredResult(_0xd6c541,_0x252956))[_0x9927('0x43')](handleError(_0xd6c541,null));};exports['addBlackLists']=function(_0x32853b,_0x3a5bb8,_0x51ad93){var _0x556440,_0x3967f7;return db[_0x9927('0x2b')][_0x9927('0x47')]({'where':{'id':_0x32853b[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x3a5bb8,null))[_0x9927('0x22')](function(_0x2e7ed5){if(_0x2e7ed5){_0x3967f7=_0x2e7ed5;return _0x2e7ed5['addBlackLists'](_0x32853b['body']['ids'],_[_0x9927('0x53')](_0x32853b[_0x9927('0x49')],[_0x9927('0x67'),'id'])||{});}return null;})[_0x9927('0x68')](function(_0x7245e1){var _0x4a8bec;_0x556440=_0x7245e1||[];var _0x4c9742=[];if(_0x7245e1){for(var _0x45b542=0x0;_0x45b542<_0x7245e1[_0x9927('0x37')];_0x45b542+=0x1){var _0x5c2325=_0x7245e1[_0x45b542][_0x9927('0x24')]({'plain':!![]});_0x4a8bec=squel[_0x9927('0x6a')]()[_0x9927('0x6b')](_0x9927('0x86'))[_0x9927('0x6c')]([_0x9927('0x6d'),_0x9927('0x6f'),'ListId',_0x9927('0x5c'),_0x9927('0x55'),_0x9927('0x54')],squel[_0x9927('0x7e')]()[_0x9927('0x71')](_0x9927('0x6d'),_0x9927('0x6d'))['field']('id',_0x9927('0x6f'))[_0x9927('0x71')](_0x5c2325[_0x9927('0x72')][_0x9927('0x73')](),_0x9927('0x70'))[_0x9927('0x71')](_0x32853b[_0x9927('0x52')]['id']['toString'](),_0x9927('0x5c'))[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x55'))[_0x9927('0x71')](_0x9927('0x74'),_0x9927('0x54'))[_0x9927('0x75')]('cm_contacts')[_0x9927('0x3c')](_0x9927('0x77'))['where']('ListId\x20=\x20?',_0x5c2325[_0x9927('0x72')]['toString']())['where'](_0x9927('0x79')))['toString']();_0x4c9742['push'](db[_0x9927('0x83')]['query'](_0x4a8bec));}return BPromise['all'](_0x4c9742);}})[_0x9927('0x22')](function(){return _0x556440;})[_0x9927('0x22')](respondWithResult(_0x3a5bb8,null))[_0x9927('0x43')](handleError(_0x3a5bb8,null));};exports[_0x9927('0x87')]=function(_0x3ab60b,_0x1b601c,_0x2c5b21){return db['Campaign'][_0x9927('0x47')]({'where':{'id':_0x3ab60b[_0x9927('0x52')]['id']}})[_0x9927('0x22')](handleEntityNotFound(_0x1b601c,null))['then'](function(_0x2b1d7b){if(_0x2b1d7b){return _0x2b1d7b[_0x9927('0x87')](_0x3ab60b[_0x9927('0x36')]['ids']);}})[_0x9927('0x22')](function(_0x467a9a){if(_0x467a9a){return db[_0x9927('0x63')][_0x9927('0x23')]({'where':{'ListId':_0x3ab60b[_0x9927('0x36')][_0x9927('0x67')],'CampaignId':_0x3ab60b[_0x9927('0x52')]['id']}})[_0x9927('0x22')](function(){return _0x467a9a;});}})[_0x9927('0x22')](respondWithStatusCode(_0x1b601c,null))[_0x9927('0x43')](handleError(_0x1b601c,null));}; \ No newline at end of file +var _0x936c=['sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','includeAll','include','Campaign','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','omit','updatedAt','createdAt','role','UserProfileSection','update','getHoppers','findOne','CmHopper','pick','CampaignId','getHopperHistories','nolimit','getHopperFinals','CmHopperBlack','hasOwnProperty','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','scheduledAt','ContactId','ListId','select','field','phone','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','push','sequelize','removeLists','getBlackLists','addBlackLists','all','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x33f1cb,_0x36f40a){var _0x1cbe6d=function(_0x48560d){while(--_0x48560d){_0x33f1cb['push'](_0x33f1cb['shift']());}};_0x1cbe6d(++_0x36f40a);}(_0x936c,0x176));var _0xc936=function(_0x3723fa,_0x46357e){_0x3723fa=_0x3723fa-0x0;var _0x8e2a49=_0x936c[_0x3723fa];return _0x8e2a49;};'use strict';var pdf=require(_0xc936('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc936('0x1'));var zipdir=require(_0xc936('0x2'));var jsonpatch=require(_0xc936('0x3'));var rp=require(_0xc936('0x4'));var moment=require(_0xc936('0x5'));var BPromise=require(_0xc936('0x6'));var Mustache=require(_0xc936('0x7'));var util=require(_0xc936('0x8'));var path=require(_0xc936('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc936('0xa'));var fs=require('fs');var _=require(_0xc936('0xb'));var squel=require('squel');var crypto=require(_0xc936('0xc'));var jsforce=require(_0xc936('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc936('0xe'));var querystring=require('querystring');var Papa=require(_0xc936('0xf'));var Redis=require(_0xc936('0x10'));var authService=require(_0xc936('0x11'));var qs=require(_0xc936('0x12'));var as=require(_0xc936('0x13'));var hardwareService=require(_0xc936('0x14'));var logger=require('../../config/logger')(_0xc936('0x15'));var utils=require(_0xc936('0x16'));var config=require(_0xc936('0x17'));var db=require(_0xc936('0x18'))['db'];function respondWithStatusCode(_0x4c3266,_0x1e293e){_0x1e293e=_0x1e293e||0xcc;return function(_0x5ef1a8){if(_0x5ef1a8){return _0x4c3266[_0xc936('0x19')](_0x1e293e);}return _0x4c3266['status'](_0x1e293e)[_0xc936('0x1a')]();};}function respondWithResult(_0x34aa6d,_0x422d01){_0x422d01=_0x422d01||0xc8;return function(_0x152b9e){if(_0x152b9e){return _0x34aa6d['status'](_0x422d01)[_0xc936('0x1b')](_0x152b9e);}};}function respondWithFilteredResult(_0x1ce3f9,_0x45250e){return function(_0x4b71be){if(_0x4b71be){var _0x3e6cd5=_0x4b71be[_0xc936('0x1c')],_0x449c81=_0x45250e[_0xc936('0x1d')],_0x379414=_0x45250e['offset']+_0x45250e[_0xc936('0x1e')],_0x22b7e0;if(_0x379414>=_0x3e6cd5){_0x379414=_0x3e6cd5;_0x22b7e0=0xc8;}else{_0x22b7e0=0xce;}_0x1ce3f9[_0xc936('0x1f')](_0x22b7e0);return _0x1ce3f9[_0xc936('0x20')](_0xc936('0x21'),_0x449c81+'-'+_0x379414+'/'+_0x3e6cd5)['json'](_0x4b71be);}return null;};}function patchUpdates(_0x29ca45){return function(_0x33ae15){try{jsonpatch['apply'](_0x33ae15,_0x29ca45,!![]);}catch(_0x1b8442){return BPromise[_0xc936('0x22')](_0x1b8442);}return _0x33ae15[_0xc936('0x23')]();};}function saveUpdates(_0x2ce50a,_0x4c8391){return function(_0x3811ad){if(_0x3811ad){return _0x3811ad['update'](_0x2ce50a)[_0xc936('0x24')](function(_0x49d3cc){return _0x49d3cc;});}return null;};}function removeEntity(_0x33468b,_0x6386a){return function(_0x30ebc8){if(_0x30ebc8){return _0x30ebc8[_0xc936('0x25')]()[_0xc936('0x24')](function(){var _0x1aac08=_0x30ebc8[_0xc936('0x26')]({'plain':!![]});var _0x19a0e1=_0xc936('0x27');return db[_0xc936('0x28')][_0xc936('0x25')]({'where':{'type':_0x19a0e1,'resourceId':_0x1aac08['id']}})[_0xc936('0x24')](function(){return _0x30ebc8;});})[_0xc936('0x24')](function(){_0x33468b[_0xc936('0x1f')](0xcc)[_0xc936('0x1a')]();});}};}function handleEntityNotFound(_0x51e28d,_0x40a4c4){return function(_0x253a0a){if(!_0x253a0a){_0x51e28d[_0xc936('0x19')](0x194);}return _0x253a0a;};}function handleError(_0x55153c,_0x25734e){_0x25734e=_0x25734e||0x1f4;return function(_0x2d0116){logger['error'](_0x2d0116[_0xc936('0x29')]);if(_0x2d0116[_0xc936('0x2a')]){delete _0x2d0116[_0xc936('0x2a')];}_0x55153c[_0xc936('0x1f')](_0x25734e)[_0xc936('0x2b')](_0x2d0116);};}exports['index']=function(_0x3f8c1a,_0x34092c){var _0x3b27d9={},_0x1e8a0f={},_0x312f61={'count':0x0,'rows':[]};var _0xf924e=_[_0xc936('0x2c')](db['Campaign'][_0xc936('0x2d')],function(_0x211ded){return{'name':_0x211ded['fieldName'],'type':_0x211ded[_0xc936('0x2e')][_0xc936('0x2f')]};});_0x1e8a0f['model']=_[_0xc936('0x2c')](_0xf924e,'name');_0x1e8a0f[_0xc936('0x30')]=_[_0xc936('0x31')](_0x3f8c1a['query']);_0x1e8a0f[_0xc936('0x32')]=_[_0xc936('0x33')](_0x1e8a0f[_0xc936('0x34')],_0x1e8a0f['query']);_0x3b27d9[_0xc936('0x35')]=_[_0xc936('0x33')](_0x1e8a0f[_0xc936('0x34')],qs['fields'](_0x3f8c1a[_0xc936('0x30')][_0xc936('0x36')]));_0x3b27d9[_0xc936('0x35')]=_0x3b27d9[_0xc936('0x35')][_0xc936('0x37')]?_0x3b27d9[_0xc936('0x35')]:_0x1e8a0f['model'];if(!_0x3f8c1a[_0xc936('0x30')]['hasOwnProperty']('nolimit')){_0x3b27d9[_0xc936('0x1e')]=qs[_0xc936('0x1e')](_0x3f8c1a['query'][_0xc936('0x1e')]);_0x3b27d9[_0xc936('0x1d')]=qs[_0xc936('0x1d')](_0x3f8c1a['query'][_0xc936('0x1d')]);}_0x3b27d9[_0xc936('0x38')]=qs[_0xc936('0x39')](_0x3f8c1a[_0xc936('0x30')][_0xc936('0x39')]);_0x3b27d9[_0xc936('0x3a')]=qs[_0xc936('0x32')](_['pick'](_0x3f8c1a[_0xc936('0x30')],_0x1e8a0f[_0xc936('0x32')]),_0xf924e);if(_0x3f8c1a[_0xc936('0x30')]['filter']){_0x3b27d9[_0xc936('0x3a')]=_[_0xc936('0x3b')](_0x3b27d9[_0xc936('0x3a')],{'$or':_['map'](_0xf924e,function(_0x5aabca){if(_0x5aabca['type']!==_0xc936('0x3c')){var _0x1e98fb={};_0x1e98fb[_0x5aabca[_0xc936('0x2a')]]={'$like':'%'+_0x3f8c1a[_0xc936('0x30')][_0xc936('0x3d')]+'%'};return _0x1e98fb;}})});}_0x3b27d9=_[_0xc936('0x3b')]({},_0x3b27d9,_0x3f8c1a['options']);var _0x311503={'where':_0x3b27d9[_0xc936('0x3a')]};return db['Campaign'][_0xc936('0x1c')](_0x311503)[_0xc936('0x24')](function(_0x249b90){_0x312f61[_0xc936('0x1c')]=_0x249b90;if(_0x3f8c1a[_0xc936('0x30')][_0xc936('0x3e')]){_0x3b27d9[_0xc936('0x3f')]=[{'all':!![]}];}return db[_0xc936('0x40')][_0xc936('0x41')](_0x3b27d9);})[_0xc936('0x24')](function(_0x18271c){_0x312f61[_0xc936('0x42')]=_0x18271c;return _0x312f61;})[_0xc936('0x24')](respondWithFilteredResult(_0x34092c,_0x3b27d9))[_0xc936('0x43')](handleError(_0x34092c,null));};exports[_0xc936('0x44')]=function(_0x56a654,_0x22aa3f){var _0x4a4ec0={'raw':![],'where':{'id':_0x56a654[_0xc936('0x45')]['id']}},_0x17eabf={};_0x17eabf[_0xc936('0x34')]=_['keys'](db['Campaign'][_0xc936('0x2d')]);_0x17eabf[_0xc936('0x30')]=_[_0xc936('0x31')](_0x56a654[_0xc936('0x30')]);_0x17eabf[_0xc936('0x32')]=_['intersection'](_0x17eabf['model'],_0x17eabf[_0xc936('0x30')]);_0x4a4ec0['attributes']=_['intersection'](_0x17eabf[_0xc936('0x34')],qs['fields'](_0x56a654[_0xc936('0x30')][_0xc936('0x36')]));_0x4a4ec0[_0xc936('0x35')]=_0x4a4ec0[_0xc936('0x35')][_0xc936('0x37')]?_0x4a4ec0[_0xc936('0x35')]:_0x17eabf[_0xc936('0x34')];if(_0x56a654[_0xc936('0x30')][_0xc936('0x3e')]){_0x4a4ec0[_0xc936('0x3f')]=[{'all':!![]}];}_0x4a4ec0=_[_0xc936('0x3b')]({},_0x4a4ec0,_0x56a654[_0xc936('0x46')]);return db['Campaign'][_0xc936('0x47')](_0x4a4ec0)[_0xc936('0x24')](handleEntityNotFound(_0x22aa3f,null))[_0xc936('0x24')](respondWithResult(_0x22aa3f,null))['catch'](handleError(_0x22aa3f,null));};exports['create']=function(_0x31555e,_0x1fc76f){return db[_0xc936('0x40')][_0xc936('0x48')](_0x31555e[_0xc936('0x49')],{})['then'](function(_0x2a9f8b){var _0x253e87=_0x31555e[_0xc936('0x4a')]['get']({'plain':!![]});if(!_0x253e87)throw new Error(_0xc936('0x4b'));if(_0x253e87['role']==='user'){var _0x150f30=_0x2a9f8b[_0xc936('0x26')]({'plain':!![]});var _0xdb7c0='IvrCampaigns';return db['UserProfileSection'][_0xc936('0x47')]({'where':{'name':_0xdb7c0,'userProfileId':_0x253e87[_0xc936('0x4c')]},'raw':!![]})[_0xc936('0x24')](function(_0x18f3da){if(_0x18f3da&&_0x18f3da[_0xc936('0x4d')]===0x0){return db[_0xc936('0x28')][_0xc936('0x48')]({'name':_0x150f30[_0xc936('0x2a')],'resourceId':_0x150f30['id'],'type':_0x18f3da[_0xc936('0x2a')],'sectionId':_0x18f3da['id']},{})[_0xc936('0x24')](function(){return _0x2a9f8b;});}else{return _0x2a9f8b;}})[_0xc936('0x43')](function(_0x5ed5a1){logger[_0xc936('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ed5a1);throw _0x5ed5a1;});}return _0x2a9f8b;})[_0xc936('0x24')](respondWithResult(_0x1fc76f,0xc9))[_0xc936('0x43')](handleError(_0x1fc76f,null));};exports['clone']=function(_0x1fb433,_0x1b7ce7){var _0x13e642={'where':{'id':_0x1fb433['params']['id']}},_0x2eb5e1={};_0x2eb5e1[_0xc936('0x34')]=_[_0xc936('0x31')](db[_0xc936('0x40')]['rawAttributes']);_0x13e642[_0xc936('0x35')]=_[_0xc936('0x33')](_0x2eb5e1[_0xc936('0x34')],qs[_0xc936('0x36')](_0x1fb433[_0xc936('0x30')][_0xc936('0x36')]));_0x13e642[_0xc936('0x35')]=_0x13e642[_0xc936('0x35')][_0xc936('0x37')]?_0x13e642[_0xc936('0x35')]:_0x2eb5e1['model'];if(_0x1fb433[_0xc936('0x30')]['includeAll']){_0x13e642[_0xc936('0x3f')]=[{'all':!![]}];}_0x13e642=_[_0xc936('0x3b')]({},_0x13e642,_0x1fb433[_0xc936('0x46')]);return db[_0xc936('0x40')]['find'](_0x13e642)['then'](handleEntityNotFound(_0x1b7ce7,null))[_0xc936('0x24')](function(_0x1f9c68){if(_0x1f9c68){var _0x53e42c=_0x1f9c68[_0xc936('0x26')]({'plain':!![]});_0x53e42c=qs[_0xc936('0x4f')](_0x53e42c,['id','createdAt',_0xc936('0x50')]);_0x1fb433[_0xc936('0x49')]=_[_0xc936('0x4f')](_0x1fb433[_0xc936('0x49')],['id',_0xc936('0x51'),'updatedAt']);return db[_0xc936('0x40')]['create'](_[_0xc936('0x3b')](_0x53e42c,_0x1fb433['body']),{'include':_0x1fb433[_0xc936('0x30')][_0xc936('0x3e')]?[{'all':!![]}]:undefined})[_0xc936('0x24')](function(_0x35c3f3){var _0x25a652=_0x1fb433[_0xc936('0x4a')][_0xc936('0x26')]({'plain':!![]});if(!_0x25a652)throw new Error(_0xc936('0x4b'));if(_0x25a652[_0xc936('0x52')]==='user'){var _0x1455df=_0x35c3f3[_0xc936('0x26')]({'plain':!![]});var _0x2bc4f1='IvrCampaigns';return db[_0xc936('0x53')][_0xc936('0x47')]({'where':{'name':_0x2bc4f1,'userProfileId':_0x25a652['userProfileId']},'raw':!![]})[_0xc936('0x24')](function(_0x3a29cd){if(_0x3a29cd&&_0x3a29cd[_0xc936('0x4d')]===0x0){return db[_0xc936('0x28')][_0xc936('0x48')]({'name':_0x1455df['name'],'resourceId':_0x1455df['id'],'type':_0x3a29cd[_0xc936('0x2a')],'sectionId':_0x3a29cd['id']},{})[_0xc936('0x24')](function(){return _0x35c3f3;});}else{return _0x35c3f3;}})[_0xc936('0x43')](function(_0x5ae667){logger[_0xc936('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ae667);throw _0x5ae667;});}return _0x35c3f3;});}})[_0xc936('0x24')](respondWithResult(_0x1b7ce7,0xc9))[_0xc936('0x43')](handleError(_0x1b7ce7,null));};exports[_0xc936('0x54')]=function(_0x474c36,_0x46700d){if(_0x474c36[_0xc936('0x49')]['id']){delete _0x474c36[_0xc936('0x49')]['id'];}return db[_0xc936('0x40')]['find']({'where':{'id':_0x474c36[_0xc936('0x45')]['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x46700d,null))[_0xc936('0x24')](saveUpdates(_0x474c36[_0xc936('0x49')],null))['then'](respondWithResult(_0x46700d,null))['catch'](handleError(_0x46700d,null));};exports['destroy']=function(_0xf5fc7a,_0x23f153){return db[_0xc936('0x40')][_0xc936('0x47')]({'where':{'id':_0xf5fc7a[_0xc936('0x45')]['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x23f153,null))[_0xc936('0x24')](removeEntity(_0x23f153,null))['catch'](handleError(_0x23f153,null));};exports[_0xc936('0x55')]=function(_0x335b1f,_0x3078ec,_0x14bdb4){var _0x2d85c8={'raw':!![],'where':{}};var _0x322e94={};var _0x188c35={'count':0x0,'rows':[]};return db[_0xc936('0x40')][_0xc936('0x56')]({'where':{'id':_0x335b1f['params']['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x3078ec,null))[_0xc936('0x24')](function(_0x4b9b4c){if(_0x4b9b4c){_0x322e94[_0xc936('0x34')]=_[_0xc936('0x31')](db[_0xc936('0x57')]['rawAttributes']);_0x322e94['query']=_['keys'](_0x335b1f[_0xc936('0x30')]);_0x322e94[_0xc936('0x32')]=_[_0xc936('0x33')](_0x322e94[_0xc936('0x34')],_0x322e94[_0xc936('0x30')]);_0x2d85c8[_0xc936('0x35')]=_['intersection'](_0x322e94[_0xc936('0x34')],qs['fields'](_0x335b1f[_0xc936('0x30')][_0xc936('0x36')]));_0x2d85c8['attributes']=_0x2d85c8[_0xc936('0x35')][_0xc936('0x37')]?_0x2d85c8['attributes']:_0x322e94[_0xc936('0x34')];if(!_0x335b1f[_0xc936('0x30')]['hasOwnProperty']('nolimit')){_0x2d85c8[_0xc936('0x1e')]=qs[_0xc936('0x1e')](_0x335b1f[_0xc936('0x30')]['limit']);_0x2d85c8[_0xc936('0x1d')]=qs['offset'](_0x335b1f[_0xc936('0x30')][_0xc936('0x1d')]);}_0x2d85c8[_0xc936('0x38')]=qs[_0xc936('0x39')](_0x335b1f[_0xc936('0x30')][_0xc936('0x39')]);_0x2d85c8[_0xc936('0x3a')]=qs['filters'](_[_0xc936('0x58')](_0x335b1f['query'],_0x322e94[_0xc936('0x32')]));_0x2d85c8['where'][_0xc936('0x59')]=_0x4b9b4c['id'];if(_0x335b1f['query']['filter']){_0x2d85c8[_0xc936('0x3a')]=_['merge'](_0x2d85c8[_0xc936('0x3a')],{'$or':_[_0xc936('0x2c')](_0x2d85c8[_0xc936('0x35')],function(_0x534ed5){var _0x3ae7ae={};_0x3ae7ae[_0x534ed5]={'$like':'%'+_0x335b1f[_0xc936('0x30')][_0xc936('0x3d')]+'%'};return _0x3ae7ae;})});}_0x2d85c8=_['merge']({},_0x2d85c8,_0x335b1f[_0xc936('0x46')]);return db[_0xc936('0x57')][_0xc936('0x1c')]({'where':_0x2d85c8[_0xc936('0x3a')]})[_0xc936('0x24')](function(_0x4010b6){_0x188c35[_0xc936('0x1c')]=_0x4010b6;if(_0x335b1f[_0xc936('0x30')][_0xc936('0x3e')]){_0x2d85c8[_0xc936('0x3f')]=[{'all':!![]}];}return db[_0xc936('0x57')][_0xc936('0x41')](_0x2d85c8);})[_0xc936('0x24')](function(_0x1492a9){_0x188c35[_0xc936('0x42')]=_0x1492a9;return _0x188c35;});}})[_0xc936('0x24')](respondWithFilteredResult(_0x3078ec,_0x2d85c8))[_0xc936('0x43')](handleError(_0x3078ec,null));};exports[_0xc936('0x5a')]=function(_0x5f2c7a,_0x4f3163,_0x1b52fe){var _0x23f32f={'raw':!![],'where':{}};var _0x223f75={};var _0x3146e2={'count':0x0,'rows':[]};return db[_0xc936('0x40')][_0xc936('0x56')]({'where':{'id':_0x5f2c7a[_0xc936('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f3163,null))['then'](function(_0x114d97){if(_0x114d97){_0x223f75[_0xc936('0x34')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x223f75[_0xc936('0x30')]=_[_0xc936('0x31')](_0x5f2c7a['query']);_0x223f75[_0xc936('0x32')]=_[_0xc936('0x33')](_0x223f75[_0xc936('0x34')],_0x223f75[_0xc936('0x30')]);_0x23f32f[_0xc936('0x35')]=_[_0xc936('0x33')](_0x223f75['model'],qs[_0xc936('0x36')](_0x5f2c7a['query'][_0xc936('0x36')]));_0x23f32f[_0xc936('0x35')]=_0x23f32f[_0xc936('0x35')][_0xc936('0x37')]?_0x23f32f[_0xc936('0x35')]:_0x223f75[_0xc936('0x34')];if(!_0x5f2c7a['query']['hasOwnProperty'](_0xc936('0x5b'))){_0x23f32f[_0xc936('0x1e')]=qs[_0xc936('0x1e')](_0x5f2c7a[_0xc936('0x30')][_0xc936('0x1e')]);_0x23f32f['offset']=qs['offset'](_0x5f2c7a[_0xc936('0x30')][_0xc936('0x1d')]);}_0x23f32f[_0xc936('0x38')]=qs[_0xc936('0x39')](_0x5f2c7a[_0xc936('0x30')]['sort']);_0x23f32f['where']=qs['filters'](_[_0xc936('0x58')](_0x5f2c7a[_0xc936('0x30')],_0x223f75[_0xc936('0x32')]));_0x23f32f[_0xc936('0x3a')]['CampaignId']=_0x114d97['id'];if(_0x5f2c7a[_0xc936('0x30')][_0xc936('0x3d')]){_0x23f32f[_0xc936('0x3a')]=_[_0xc936('0x3b')](_0x23f32f[_0xc936('0x3a')],{'$or':_[_0xc936('0x2c')](_0x23f32f[_0xc936('0x35')],function(_0x460c12){var _0x7e3a7f={};_0x7e3a7f[_0x460c12]={'$like':'%'+_0x5f2c7a['query'][_0xc936('0x3d')]+'%'};return _0x7e3a7f;})});}_0x23f32f=_[_0xc936('0x3b')]({},_0x23f32f,_0x5f2c7a[_0xc936('0x46')]);return db['CmHopperHistory']['count']({'where':_0x23f32f[_0xc936('0x3a')]})['then'](function(_0x5bae87){_0x3146e2[_0xc936('0x1c')]=_0x5bae87;if(_0x5f2c7a[_0xc936('0x30')]['includeAll']){_0x23f32f['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xc936('0x41')](_0x23f32f);})[_0xc936('0x24')](function(_0xae43c3){_0x3146e2['rows']=_0xae43c3;return _0x3146e2;});}})['then'](respondWithFilteredResult(_0x4f3163,_0x23f32f))[_0xc936('0x43')](handleError(_0x4f3163,null));};exports[_0xc936('0x5c')]=function(_0x3a9dcd,_0x572512,_0x231fdc){var _0x5b1ce1={'raw':!![],'where':{}};var _0x39d1eb={};var _0x55b919={'count':0x0,'rows':[]};return db[_0xc936('0x40')]['findOne']({'where':{'id':_0x3a9dcd[_0xc936('0x45')]['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x572512,null))[_0xc936('0x24')](function(_0x21df81){if(_0x21df81){_0x39d1eb[_0xc936('0x34')]=_[_0xc936('0x31')](db['CmHopperFinal']['rawAttributes']);_0x39d1eb[_0xc936('0x30')]=_[_0xc936('0x31')](_0x3a9dcd[_0xc936('0x30')]);_0x39d1eb[_0xc936('0x32')]=_['intersection'](_0x39d1eb['model'],_0x39d1eb[_0xc936('0x30')]);_0x5b1ce1[_0xc936('0x35')]=_[_0xc936('0x33')](_0x39d1eb['model'],qs[_0xc936('0x36')](_0x3a9dcd['query'][_0xc936('0x36')]));_0x5b1ce1[_0xc936('0x35')]=_0x5b1ce1[_0xc936('0x35')][_0xc936('0x37')]?_0x5b1ce1[_0xc936('0x35')]:_0x39d1eb[_0xc936('0x34')];if(!_0x3a9dcd['query']['hasOwnProperty'](_0xc936('0x5b'))){_0x5b1ce1['limit']=qs['limit'](_0x3a9dcd['query'][_0xc936('0x1e')]);_0x5b1ce1[_0xc936('0x1d')]=qs['offset'](_0x3a9dcd['query']['offset']);}_0x5b1ce1[_0xc936('0x38')]=qs[_0xc936('0x39')](_0x3a9dcd['query'][_0xc936('0x39')]);_0x5b1ce1[_0xc936('0x3a')]=qs[_0xc936('0x32')](_['pick'](_0x3a9dcd[_0xc936('0x30')],_0x39d1eb['filters']));_0x5b1ce1[_0xc936('0x3a')][_0xc936('0x59')]=_0x21df81['id'];if(_0x3a9dcd[_0xc936('0x30')][_0xc936('0x3d')]){_0x5b1ce1[_0xc936('0x3a')]=_[_0xc936('0x3b')](_0x5b1ce1[_0xc936('0x3a')],{'$or':_[_0xc936('0x2c')](_0x5b1ce1[_0xc936('0x35')],function(_0x3e0ee4){var _0x11df14={};_0x11df14[_0x3e0ee4]={'$like':'%'+_0x3a9dcd[_0xc936('0x30')][_0xc936('0x3d')]+'%'};return _0x11df14;})});}_0x5b1ce1=_[_0xc936('0x3b')]({},_0x5b1ce1,_0x3a9dcd['options']);return db['CmHopperFinal'][_0xc936('0x1c')]({'where':_0x5b1ce1[_0xc936('0x3a')]})[_0xc936('0x24')](function(_0x816697){_0x55b919['count']=_0x816697;if(_0x3a9dcd['query']['includeAll']){_0x5b1ce1['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xc936('0x41')](_0x5b1ce1);})[_0xc936('0x24')](function(_0x590240){_0x55b919[_0xc936('0x42')]=_0x590240;return _0x55b919;});}})['then'](respondWithFilteredResult(_0x572512,_0x5b1ce1))[_0xc936('0x43')](handleError(_0x572512,null));};exports['getHopperBlacks']=function(_0x3920e7,_0x1a2f7b,_0x3c2984){var _0x3d4663={'raw':!![],'where':{}};var _0xf57a38={};var _0x378298={'count':0x0,'rows':[]};return db[_0xc936('0x40')][_0xc936('0x56')]({'where':{'id':_0x3920e7[_0xc936('0x45')]['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x1a2f7b,null))['then'](function(_0x5ace74){if(_0x5ace74){_0xf57a38[_0xc936('0x34')]=_[_0xc936('0x31')](db[_0xc936('0x5d')][_0xc936('0x2d')]);_0xf57a38[_0xc936('0x30')]=_[_0xc936('0x31')](_0x3920e7[_0xc936('0x30')]);_0xf57a38[_0xc936('0x32')]=_['intersection'](_0xf57a38[_0xc936('0x34')],_0xf57a38[_0xc936('0x30')]);_0x3d4663[_0xc936('0x35')]=_[_0xc936('0x33')](_0xf57a38[_0xc936('0x34')],qs[_0xc936('0x36')](_0x3920e7[_0xc936('0x30')][_0xc936('0x36')]));_0x3d4663[_0xc936('0x35')]=_0x3d4663[_0xc936('0x35')][_0xc936('0x37')]?_0x3d4663[_0xc936('0x35')]:_0xf57a38['model'];if(!_0x3920e7[_0xc936('0x30')][_0xc936('0x5e')](_0xc936('0x5b'))){_0x3d4663[_0xc936('0x1e')]=qs['limit'](_0x3920e7[_0xc936('0x30')][_0xc936('0x1e')]);_0x3d4663[_0xc936('0x1d')]=qs[_0xc936('0x1d')](_0x3920e7[_0xc936('0x30')][_0xc936('0x1d')]);}_0x3d4663[_0xc936('0x38')]=qs[_0xc936('0x39')](_0x3920e7['query'][_0xc936('0x39')]);_0x3d4663[_0xc936('0x3a')]=qs[_0xc936('0x32')](_[_0xc936('0x58')](_0x3920e7[_0xc936('0x30')],_0xf57a38[_0xc936('0x32')]));_0x3d4663['where'][_0xc936('0x59')]=_0x5ace74['id'];if(_0x3920e7[_0xc936('0x30')][_0xc936('0x3d')]){_0x3d4663['where']=_[_0xc936('0x3b')](_0x3d4663[_0xc936('0x3a')],{'$or':_['map'](_0x3d4663[_0xc936('0x35')],function(_0x42527c){var _0x162d61={};_0x162d61[_0x42527c]={'$like':'%'+_0x3920e7[_0xc936('0x30')]['filter']+'%'};return _0x162d61;})});}_0x3d4663=_['merge']({},_0x3d4663,_0x3920e7[_0xc936('0x46')]);return db[_0xc936('0x5d')]['count']({'where':_0x3d4663[_0xc936('0x3a')]})[_0xc936('0x24')](function(_0x41e659){_0x378298[_0xc936('0x1c')]=_0x41e659;if(_0x3920e7[_0xc936('0x30')][_0xc936('0x3e')]){_0x3d4663[_0xc936('0x3f')]=[{'all':!![]}];}return db[_0xc936('0x5d')][_0xc936('0x41')](_0x3d4663);})['then'](function(_0x4a4db6){_0x378298[_0xc936('0x42')]=_0x4a4db6;return _0x378298;});}})[_0xc936('0x24')](respondWithFilteredResult(_0x1a2f7b,_0x3d4663))['catch'](handleError(_0x1a2f7b,null));};exports[_0xc936('0x5f')]=function(_0x29f662,_0x1eeb42,_0x1eb26e){var _0x391d31={};var _0x937e5c={};var _0x25e34f;var _0x3ba1ce;return db[_0xc936('0x40')]['findOne']({'where':{'id':_0x29f662[_0xc936('0x45')]['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x1eeb42,null))[_0xc936('0x24')](function(_0x3ab550){if(_0x3ab550){_0x25e34f=_0x3ab550;_0x937e5c[_0xc936('0x34')]=_[_0xc936('0x31')](db[_0xc936('0x60')][_0xc936('0x2d')]);_0x937e5c['query']=_[_0xc936('0x31')](_0x29f662[_0xc936('0x30')]);_0x937e5c['filters']=_[_0xc936('0x33')](_0x937e5c[_0xc936('0x34')],_0x937e5c[_0xc936('0x30')]);_0x391d31[_0xc936('0x35')]=_[_0xc936('0x33')](_0x937e5c['model'],qs['fields'](_0x29f662[_0xc936('0x30')][_0xc936('0x36')]));_0x391d31['attributes']=_0x391d31[_0xc936('0x35')][_0xc936('0x37')]?_0x391d31[_0xc936('0x35')]:_0x937e5c['model'];_0x391d31[_0xc936('0x38')]=qs[_0xc936('0x39')](_0x29f662[_0xc936('0x30')][_0xc936('0x39')]);_0x391d31[_0xc936('0x3a')]=qs[_0xc936('0x32')](_[_0xc936('0x58')](_0x29f662[_0xc936('0x30')],_0x937e5c[_0xc936('0x32')]));if(_0x29f662[_0xc936('0x30')][_0xc936('0x3d')]){_0x391d31[_0xc936('0x3a')]=_['merge'](_0x391d31[_0xc936('0x3a')],{'$or':_[_0xc936('0x2c')](_0x391d31[_0xc936('0x35')],function(_0x4deb6f){var _0x412c72={};_0x412c72[_0x4deb6f]={'$like':'%'+_0x29f662[_0xc936('0x30')][_0xc936('0x3d')]+'%'};return _0x412c72;})});}_0x391d31=_['merge']({},_0x391d31,_0x29f662['options']);return _0x25e34f[_0xc936('0x5f')](_0x391d31);}})[_0xc936('0x24')](function(_0xe8d194){if(_0xe8d194){_0x3ba1ce=_0xe8d194['length'];if(!_0x29f662[_0xc936('0x30')][_0xc936('0x5e')](_0xc936('0x5b'))){_0x391d31[_0xc936('0x1e')]=qs[_0xc936('0x1e')](_0x29f662['query']['limit']);_0x391d31['offset']=qs[_0xc936('0x1d')](_0x29f662[_0xc936('0x30')]['offset']);}return _0x25e34f[_0xc936('0x5f')](_0x391d31);}})['then'](function(_0x3d322b){if(_0x3d322b){return _0x3d322b?{'count':_0x3ba1ce,'rows':_0x3d322b}:null;}})['then'](respondWithResult(_0x1eeb42,null))[_0xc936('0x43')](handleError(_0x1eeb42,null));};exports['addLists']=function(_0x2c038f,_0x5c2eb1,_0x136720){var _0x59986b,_0x48aaaa;return db[_0xc936('0x40')][_0xc936('0x47')]({'where':{'id':_0x2c038f[_0xc936('0x45')]['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x5c2eb1,null))[_0xc936('0x24')](function(_0x541a88){if(_0x541a88){_0x48aaaa=_0x541a88;return _0x541a88[_0xc936('0x61')](_0x2c038f[_0xc936('0x49')]['ids'],_[_0xc936('0x4f')](_0x2c038f[_0xc936('0x49')],[_0xc936('0x62'),'id'])||{});}return null;})[_0xc936('0x63')](function(_0x55f7c4){var _0x222fda;_0x59986b=_0x55f7c4||[];var _0x5f1938=[];if(_0x55f7c4){for(var _0x1233f6=0x0;_0x1233f6<_0x55f7c4[_0xc936('0x37')];_0x1233f6+=0x1){var _0x2fb058=_0x55f7c4[_0x1233f6]['get']({'plain':!![]});_0x48aaaa['dialCheckDuplicateType']=_0x2c038f['body']['dialCheckDuplicateType']?_0x2c038f[_0xc936('0x49')][_0xc936('0x64')]:_0x48aaaa[_0xc936('0x64')];switch(_0x48aaaa[_0xc936('0x64')]){case _0xc936('0x65'):_0x222fda=squel[_0xc936('0x66')]()['into'](_0xc936('0x67'))['fromQuery'](['phone',_0xc936('0x68'),_0xc936('0x69'),_0xc936('0x6a'),_0xc936('0x59'),_0xc936('0x51'),_0xc936('0x50')],squel[_0xc936('0x6b')]()[_0xc936('0x6c')](_0xc936('0x6d'),_0xc936('0x6d'))['field']('NOW()','scheduledAt')[_0xc936('0x6c')]('id',_0xc936('0x69'))[_0xc936('0x6c')](_0x2fb058['CmListId'][_0xc936('0x6e')](),'ListId')[_0xc936('0x6c')](_0x2c038f[_0xc936('0x45')]['id'][_0xc936('0x6e')](),_0xc936('0x59'))[_0xc936('0x6c')](_0xc936('0x6f'),'createdAt')[_0xc936('0x6c')](_0xc936('0x6f'),_0xc936('0x50'))[_0xc936('0x70')](_0xc936('0x71'))[_0xc936('0x3a')](_0xc936('0x72'))[_0xc936('0x3a')]('ListId\x20=\x20?',_0x2fb058[_0xc936('0x73')][_0xc936('0x6e')]())[_0xc936('0x3a')](_0xc936('0x74'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xc936('0x6b')]()[_0xc936('0x6c')](_0xc936('0x75'))[_0xc936('0x70')](_0xc936('0x76'))[_0xc936('0x3a')](_0xc936('0x77'),_0x2c038f[_0xc936('0x45')]['id'][_0xc936('0x6e')]()))[_0xc936('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc936('0x6b')]()[_0xc936('0x6c')](_0xc936('0x78'))[_0xc936('0x70')](_0xc936('0x67'))[_0xc936('0x3a')](_0xc936('0x77'),_0x2c038f[_0xc936('0x45')]['id'][_0xc936('0x6e')]())))[_0xc936('0x6e')]();break;case _0xc936('0x79'):_0x222fda=squel[_0xc936('0x66')]()[_0xc936('0x7a')]('cm_hopper')[_0xc936('0x7b')](['phone','scheduledAt',_0xc936('0x69'),_0xc936('0x6a'),_0xc936('0x59'),_0xc936('0x51'),_0xc936('0x50')],squel[_0xc936('0x6b')]()[_0xc936('0x6c')](_0xc936('0x6d'),_0xc936('0x6d'))[_0xc936('0x6c')](_0xc936('0x6f'),_0xc936('0x68'))[_0xc936('0x6c')]('id',_0xc936('0x69'))[_0xc936('0x6c')](_0x2fb058[_0xc936('0x73')]['toString'](),_0xc936('0x6a'))[_0xc936('0x6c')](_0x2c038f['params']['id'][_0xc936('0x6e')](),_0xc936('0x59'))[_0xc936('0x6c')](_0xc936('0x6f'),_0xc936('0x51'))[_0xc936('0x6c')](_0xc936('0x6f'),'updatedAt')['from'](_0xc936('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0xc936('0x3a')](_0xc936('0x7c'),_0x2fb058[_0xc936('0x73')][_0xc936('0x6e')]())[_0xc936('0x3a')](_0xc936('0x74'))[_0xc936('0x3a')](_0xc936('0x7d'),squel[_0xc936('0x6b')]()[_0xc936('0x6c')](_0xc936('0x78'))['from'](_0xc936('0x67'))['where'](_0xc936('0x77'),_0x2c038f[_0xc936('0x45')]['id']['toString']())))[_0xc936('0x6e')]();break;default:_0x222fda=squel['insert']()[_0xc936('0x7a')](_0xc936('0x67'))[_0xc936('0x7b')](['phone',_0xc936('0x68'),'ContactId',_0xc936('0x6a'),_0xc936('0x59'),'createdAt',_0xc936('0x50')],squel['select']()[_0xc936('0x6c')](_0xc936('0x6d'),_0xc936('0x6d'))['field'](_0xc936('0x6f'),_0xc936('0x68'))[_0xc936('0x6c')]('id','ContactId')[_0xc936('0x6c')](_0x2fb058['CmListId'][_0xc936('0x6e')](),_0xc936('0x6a'))['field'](_0x2c038f[_0xc936('0x45')]['id'][_0xc936('0x6e')](),_0xc936('0x59'))[_0xc936('0x6c')](_0xc936('0x6f'),_0xc936('0x51'))[_0xc936('0x6c')](_0xc936('0x6f'),_0xc936('0x50'))[_0xc936('0x70')](_0xc936('0x71'))[_0xc936('0x3a')](_0xc936('0x72'))[_0xc936('0x3a')](_0xc936('0x7c'),_0x2fb058[_0xc936('0x73')]['toString']())[_0xc936('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0xc936('0x6e')]();}_0x5f1938[_0xc936('0x7e')](db[_0xc936('0x7f')][_0xc936('0x30')](_0x222fda));}return BPromise['all'](_0x5f1938);}})['then'](function(){return _0x59986b;})[_0xc936('0x24')](respondWithResult(_0x5c2eb1,null))[_0xc936('0x43')](handleError(_0x5c2eb1,null));};exports[_0xc936('0x80')]=function(_0x296784,_0x592060,_0x1b3a27){return db[_0xc936('0x40')][_0xc936('0x47')]({'where':{'id':_0x296784[_0xc936('0x45')]['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x592060,null))[_0xc936('0x24')](function(_0x35b48a){if(_0x35b48a){return _0x35b48a[_0xc936('0x80')](_0x296784[_0xc936('0x30')]['ids']);}})[_0xc936('0x24')](function(_0x51176d){if(_0x51176d){return db[_0xc936('0x57')]['destroy']({'where':{'ListId':_0x296784[_0xc936('0x30')][_0xc936('0x62')],'CampaignId':_0x296784['params']['id']}})[_0xc936('0x24')](function(){return _0x51176d;});}})[_0xc936('0x24')](respondWithStatusCode(_0x592060,null))[_0xc936('0x43')](handleError(_0x592060,null));};exports[_0xc936('0x81')]=function(_0x170f3a,_0x1fa5fe,_0x386f47){var _0x537f77={'raw':!![],'where':{}};var _0x272bd2={};var _0xeabb4b={'count':0x0,'rows':[]};return db['Campaign'][_0xc936('0x56')]({'where':{'id':_0x170f3a['params']['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x1fa5fe,null))[_0xc936('0x24')](function(_0x4ccd64){if(_0x4ccd64){_0x272bd2[_0xc936('0x34')]=_['keys'](db['CmList']['rawAttributes']);_0x272bd2[_0xc936('0x30')]=_[_0xc936('0x31')](_0x170f3a['query']);_0x272bd2[_0xc936('0x32')]=_[_0xc936('0x33')](_0x272bd2[_0xc936('0x34')],_0x272bd2[_0xc936('0x30')]);_0x537f77['attributes']=_[_0xc936('0x33')](_0x272bd2[_0xc936('0x34')],qs[_0xc936('0x36')](_0x170f3a[_0xc936('0x30')][_0xc936('0x36')]));_0x537f77[_0xc936('0x35')]=_0x537f77[_0xc936('0x35')][_0xc936('0x37')]?_0x537f77['attributes']:_0x272bd2['model'];if(!_0x170f3a[_0xc936('0x30')][_0xc936('0x5e')](_0xc936('0x5b'))){_0x537f77[_0xc936('0x1e')]=qs[_0xc936('0x1e')](_0x170f3a[_0xc936('0x30')][_0xc936('0x1e')]);_0x537f77[_0xc936('0x1d')]=qs[_0xc936('0x1d')](_0x170f3a[_0xc936('0x30')]['offset']);}_0x537f77['order']=qs['sort'](_0x170f3a['query'][_0xc936('0x39')]);_0x537f77[_0xc936('0x3a')]=qs[_0xc936('0x32')](_[_0xc936('0x58')](_0x170f3a['query'],_0x272bd2[_0xc936('0x32')]));_0x537f77[_0xc936('0x3a')][_0xc936('0x59')]=_0x4ccd64['id'];if(_0x170f3a['query']['filter']){_0x537f77[_0xc936('0x3a')]=_['merge'](_0x537f77[_0xc936('0x3a')],{'$or':_[_0xc936('0x2c')](_0x537f77[_0xc936('0x35')],function(_0x15e907){var _0x33c872={};_0x33c872[_0x15e907]={'$like':'%'+_0x170f3a['query'][_0xc936('0x3d')]+'%'};return _0x33c872;})});}_0x537f77=_[_0xc936('0x3b')]({},_0x537f77,_0x170f3a[_0xc936('0x46')]);return db[_0xc936('0x60')][_0xc936('0x1c')]({'where':_0x537f77[_0xc936('0x3a')]})['then'](function(_0x7e1498){_0xeabb4b[_0xc936('0x1c')]=_0x7e1498;if(_0x170f3a['query'][_0xc936('0x3e')]){_0x537f77['include']=[{'all':!![]}];}return db[_0xc936('0x60')][_0xc936('0x41')](_0x537f77);})[_0xc936('0x24')](function(_0x48e161){_0xeabb4b[_0xc936('0x42')]=_0x48e161;return _0xeabb4b;});}})[_0xc936('0x24')](respondWithFilteredResult(_0x1fa5fe,_0x537f77))[_0xc936('0x43')](handleError(_0x1fa5fe,null));};exports['addBlackLists']=function(_0x35833c,_0x463065,_0x454ee2){var _0x6bb508,_0x165b22;return db[_0xc936('0x40')][_0xc936('0x47')]({'where':{'id':_0x35833c[_0xc936('0x45')]['id']}})['then'](handleEntityNotFound(_0x463065,null))[_0xc936('0x24')](function(_0x15a146){if(_0x15a146){_0x165b22=_0x15a146;return _0x15a146[_0xc936('0x82')](_0x35833c[_0xc936('0x49')][_0xc936('0x62')],_[_0xc936('0x4f')](_0x35833c[_0xc936('0x49')],[_0xc936('0x62'),'id'])||{});}return null;})[_0xc936('0x63')](function(_0x2184e8){var _0x1cfc06;_0x6bb508=_0x2184e8||[];var _0x504fd6=[];if(_0x2184e8){for(var _0x484f8a=0x0;_0x484f8a<_0x2184e8['length'];_0x484f8a+=0x1){var _0x799eda=_0x2184e8[_0x484f8a]['get']({'plain':!![]});_0x1cfc06=squel[_0xc936('0x66')]()['into']('cm_hopper_black')['fromQuery']([_0xc936('0x6d'),_0xc936('0x69'),_0xc936('0x6a'),'CampaignId',_0xc936('0x51'),_0xc936('0x50')],squel[_0xc936('0x6b')]()[_0xc936('0x6c')]('phone','phone')[_0xc936('0x6c')]('id',_0xc936('0x69'))[_0xc936('0x6c')](_0x799eda['CmListId'][_0xc936('0x6e')](),_0xc936('0x6a'))[_0xc936('0x6c')](_0x35833c[_0xc936('0x45')]['id'][_0xc936('0x6e')](),'CampaignId')[_0xc936('0x6c')](_0xc936('0x6f'),_0xc936('0x51'))['field'](_0xc936('0x6f'),'updatedAt')['from']('cm_contacts')[_0xc936('0x3a')]('deletedAt\x20IS\x20NULL')[_0xc936('0x3a')](_0xc936('0x7c'),_0x799eda[_0xc936('0x73')][_0xc936('0x6e')]())['where'](_0xc936('0x74')))[_0xc936('0x6e')]();_0x504fd6[_0xc936('0x7e')](db[_0xc936('0x7f')][_0xc936('0x30')](_0x1cfc06));}return BPromise[_0xc936('0x83')](_0x504fd6);}})[_0xc936('0x24')](function(){return _0x6bb508;})[_0xc936('0x24')](respondWithResult(_0x463065,null))[_0xc936('0x43')](handleError(_0x463065,null));};exports[_0xc936('0x84')]=function(_0x5a87e0,_0x452d8b,_0x24871f){return db[_0xc936('0x40')][_0xc936('0x47')]({'where':{'id':_0x5a87e0[_0xc936('0x45')]['id']}})[_0xc936('0x24')](handleEntityNotFound(_0x452d8b,null))[_0xc936('0x24')](function(_0x3bf63e){if(_0x3bf63e){return _0x3bf63e['removeBlackLists'](_0x5a87e0[_0xc936('0x30')][_0xc936('0x62')]);}})[_0xc936('0x24')](function(_0x13fb9c){if(_0x13fb9c){return db[_0xc936('0x5d')][_0xc936('0x25')]({'where':{'ListId':_0x5a87e0[_0xc936('0x30')][_0xc936('0x62')],'CampaignId':_0x5a87e0[_0xc936('0x45')]['id']}})[_0xc936('0x24')](function(){return _0x13fb9c;});}})[_0xc936('0x24')](respondWithStatusCode(_0x452d8b,null))['catch'](handleError(_0x452d8b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 83289a5..4bf0e94 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 _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xb83688,_0x10bce4){var _0x2ffa2b=function(_0x10a21f){while(--_0x10a21f){_0xb83688['push'](_0xb83688['shift']());}};_0x2ffa2b(++_0x10bce4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x167309,_0x41d03f){var _0x56b59f=function(_0x1aa868){while(--_0x1aa868){_0x167309['push'](_0x167309['shift']());}};_0x56b59f(++_0x41d03f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 20727dc..c7d7be1 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(_0x17cb67,_0x1c6143){var _0x6ad9f9=function(_0x197e6e){while(--_0x197e6e){_0x17cb67['push'](_0x17cb67['shift']());}};_0x6ad9f9(++_0x1c6143);}(_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);});});}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 _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(_0x941115,_0x2954e9){var _0x80a241=function(_0x3a8655){while(--_0x3a8655){_0x941115['push'](_0x941115['shift']());}};_0x80a241(++_0x2954e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 1539852..f00f144 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 _0x6595=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','/:id/blacklists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','/:id','isAuthenticated','/:id/hoppers','getHopperHistories'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x6595,0x198));var _0x5659=function(_0x1e9bae,_0x5dae36){_0x1e9bae=_0x1e9bae-0x0;var _0x923834=_0x6595[_0x1e9bae];return _0x923834;};'use strict';var multer=require(_0x5659('0x0'));var util=require(_0x5659('0x1'));var path=require('path');var timeout=require(_0x5659('0x2'));var express=require('express');var router=express[_0x5659('0x3')]();var auth=require(_0x5659('0x4'));var interaction=require(_0x5659('0x5'));var config=require('../../config/environment');var controller=require(_0x5659('0x6'));router[_0x5659('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5659('0x7')](_0x5659('0x8'),auth[_0x5659('0x9')](),controller['show']);router[_0x5659('0x7')](_0x5659('0xa'),auth[_0x5659('0x9')](),controller['getHoppers']);router[_0x5659('0x7')]('/:id/hopper_histories',auth[_0x5659('0x9')](),controller[_0x5659('0xb')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x5659('0xc')]);router[_0x5659('0x7')](_0x5659('0xd'),auth['isAuthenticated'](),controller[_0x5659('0xe')]);router[_0x5659('0x7')](_0x5659('0xf'),auth[_0x5659('0x9')](),controller[_0x5659('0x10')]);router[_0x5659('0x7')]('/:id/blacklists',auth[_0x5659('0x9')](),controller[_0x5659('0x11')]);router['post']('/',auth[_0x5659('0x9')](),controller[_0x5659('0x12')]);router[_0x5659('0x13')](_0x5659('0x14'),auth['isAuthenticated'](),controller[_0x5659('0x15')]);router[_0x5659('0x13')]('/:id/lists',auth[_0x5659('0x9')](),controller['addLists']);router[_0x5659('0x13')](_0x5659('0x16'),auth['isAuthenticated'](),controller[_0x5659('0x17')]);router['put'](_0x5659('0x8'),auth['isAuthenticated'](),controller[_0x5659('0x18')]);router[_0x5659('0x19')](_0x5659('0x8'),auth[_0x5659('0x9')](),controller[_0x5659('0x1a')]);router['delete'](_0x5659('0xf'),auth[_0x5659('0x9')](),controller[_0x5659('0x1b')]);router[_0x5659('0x19')](_0x5659('0x16'),auth['isAuthenticated'](),controller[_0x5659('0x1c')]);module[_0x5659('0x1d')]=router; \ No newline at end of file +var _0xc779=['/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','update','destroy','delete','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x455e82,_0x522f6f){var _0x2d0520=function(_0x11556e){while(--_0x11556e){_0x455e82['push'](_0x455e82['shift']());}};_0x2d0520(++_0x522f6f);}(_0xc779,0x1b5));var _0x9c77=function(_0x59ff7c,_0x1a5263){_0x59ff7c=_0x59ff7c-0x0;var _0x23a3b7=_0xc779[_0x59ff7c];return _0x23a3b7;};'use strict';var multer=require('multer');var util=require(_0x9c77('0x0'));var path=require(_0x9c77('0x1'));var timeout=require(_0x9c77('0x2'));var express=require(_0x9c77('0x3'));var router=express[_0x9c77('0x4')]();var auth=require(_0x9c77('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9c77('0x6'));var controller=require(_0x9c77('0x7'));router['get']('/',auth[_0x9c77('0x8')](),controller['index']);router[_0x9c77('0x9')](_0x9c77('0xa'),auth['isAuthenticated'](),controller[_0x9c77('0xb')]);router[_0x9c77('0x9')](_0x9c77('0xc'),auth[_0x9c77('0x8')](),controller[_0x9c77('0xd')]);router[_0x9c77('0x9')](_0x9c77('0xe'),auth['isAuthenticated'](),controller[_0x9c77('0xf')]);router[_0x9c77('0x9')](_0x9c77('0x10'),auth['isAuthenticated'](),controller[_0x9c77('0x11')]);router[_0x9c77('0x9')](_0x9c77('0x12'),auth[_0x9c77('0x8')](),controller[_0x9c77('0x13')]);router['get']('/:id/lists',auth[_0x9c77('0x8')](),controller[_0x9c77('0x14')]);router[_0x9c77('0x9')](_0x9c77('0x15'),auth[_0x9c77('0x8')](),controller['getBlackLists']);router[_0x9c77('0x16')]('/',auth[_0x9c77('0x8')](),controller[_0x9c77('0x17')]);router[_0x9c77('0x16')](_0x9c77('0x18'),auth[_0x9c77('0x8')](),controller[_0x9c77('0x19')]);router[_0x9c77('0x16')](_0x9c77('0x1a'),auth[_0x9c77('0x8')](),controller[_0x9c77('0x1b')]);router['post'](_0x9c77('0x15'),auth[_0x9c77('0x8')](),controller[_0x9c77('0x1c')]);router['put'](_0x9c77('0xa'),auth[_0x9c77('0x8')](),controller[_0x9c77('0x1d')]);router['delete'](_0x9c77('0xa'),auth[_0x9c77('0x8')](),controller[_0x9c77('0x1e')]);router[_0x9c77('0x1f')](_0x9c77('0x1a'),auth[_0x9c77('0x8')](),controller[_0x9c77('0x20')]);router['delete'](_0x9c77('0x15'),auth[_0x9c77('0x8')](),controller[_0x9c77('0x21')]);module[_0x9c77('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index bb45e0d..ff3f415 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 _0x8eac=['exports','STRING','TEXT','VIRTUAL'];(function(_0x43b22b,_0xea722c){var _0xd4e124=function(_0x271814){while(--_0x271814){_0x43b22b['push'](_0x43b22b['shift']());}};_0xd4e124(++_0xea722c);}(_0x8eac,0x1bc));var _0xc8ea=function(_0x326c48,_0x31eee6){_0x326c48=_0x326c48-0x0;var _0xf71bc5=_0x8eac[_0x326c48];return _0xf71bc5;};'use strict';var Sequelize=require('sequelize');module[_0xc8ea('0x0')]={'key':{'type':Sequelize[_0xc8ea('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xc8ea('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc8ea('0x1')]},'name':{'type':Sequelize[_0xc8ea('0x3')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x4664=['STRING','TEXT','VIRTUAL','key','exports'];(function(_0x21993f,_0xa34a1b){var _0x3cb4f0=function(_0x47138f){while(--_0x47138f){_0x21993f['push'](_0x21993f['shift']());}};_0x3cb4f0(++_0xa34a1b);}(_0x4664,0x77));var _0x4466=function(_0x4dac30,_0x3b1e61){_0x4dac30=_0x4dac30-0x0;var _0x4ae741=_0x4664[_0x4dac30];return _0x4ae741;};'use strict';var Sequelize=require('sequelize');module[_0x4466('0x0')]={'key':{'type':Sequelize[_0x4466('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x4466('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4466('0x1')]},'name':{'type':Sequelize[_0x4466('0x3')],'get':function(){return this['getDataValue'](_0x4466('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d7e6479..d41d863 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 _0xea2e=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0xea2e,0x19f));var _0xeea2=function(_0xe55531,_0x53ea94){_0xe55531=_0xe55531-0x0;var _0x289834=_0xea2e[_0xe55531];return _0x289834;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeea2('0x0'));var rimraf=require(_0xeea2('0x1'));var zipdir=require(_0xeea2('0x2'));var jsonpatch=require(_0xeea2('0x3'));var rp=require(_0xeea2('0x4'));var moment=require('moment');var BPromise=require(_0xeea2('0x5'));var Mustache=require(_0xeea2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeea2('0x7'));var fs=require('fs');var _=require(_0xeea2('0x8'));var squel=require('squel');var crypto=require(_0xeea2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xeea2('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeea2('0xb'));var Papa=require(_0xeea2('0xc'));var Redis=require(_0xeea2('0xd'));var authService=require(_0xeea2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xeea2('0xf'));var hardwareService=require(_0xeea2('0x10'));var logger=require('../../config/logger')(_0xeea2('0x11'));var utils=require(_0xeea2('0x12'));var config=require(_0xeea2('0x13'));var db=require(_0xeea2('0x14'))['db'];function respondWithStatusCode(_0x5b5667,_0x4d2fca){_0x4d2fca=_0x4d2fca||0xcc;return function(_0x271263){if(_0x271263){return _0x5b5667[_0xeea2('0x15')](_0x4d2fca);}return _0x5b5667[_0xeea2('0x16')](_0x4d2fca)['end']();};}function respondWithResult(_0x547968,_0x470ffc){_0x470ffc=_0x470ffc||0xc8;return function(_0x9e7f0c){if(_0x9e7f0c){return _0x547968['status'](_0x470ffc)[_0xeea2('0x17')](_0x9e7f0c);}};}function respondWithFilteredResult(_0x13d2b7,_0x1a8bab){return function(_0x5f4ef3){if(_0x5f4ef3){var _0x2e3467=_0x5f4ef3[_0xeea2('0x18')],_0x23972a=_0x1a8bab[_0xeea2('0x19')],_0x514d67=_0x1a8bab[_0xeea2('0x19')]+_0x1a8bab[_0xeea2('0x1a')],_0x2d8bc5;if(_0x514d67>=_0x2e3467){_0x514d67=_0x2e3467;_0x2d8bc5=0xc8;}else{_0x2d8bc5=0xce;}_0x13d2b7[_0xeea2('0x16')](_0x2d8bc5);return _0x13d2b7[_0xeea2('0x1b')](_0xeea2('0x1c'),_0x23972a+'-'+_0x514d67+'/'+_0x2e3467)[_0xeea2('0x17')](_0x5f4ef3);}return null;};}function patchUpdates(_0x5aa96c){return function(_0x596399){try{jsonpatch[_0xeea2('0x1d')](_0x596399,_0x5aa96c,!![]);}catch(_0x598ad6){return BPromise['reject'](_0x598ad6);}return _0x596399[_0xeea2('0x1e')]();};}function saveUpdates(_0x320fa8,_0x19fbbb){return function(_0x27622b){if(_0x27622b){return _0x27622b[_0xeea2('0x1f')](_0x320fa8)[_0xeea2('0x20')](function(_0x11e63e){return _0x11e63e;});}return null;};}function removeEntity(_0x2d9482,_0x13ba7d){return function(_0x122d8b){if(_0x122d8b){return _0x122d8b[_0xeea2('0x21')]()['then'](function(){var _0x151e6d=_0x122d8b[_0xeea2('0x22')]({'plain':!![]});var _0x479e23=_0xeea2('0x23');return db[_0xeea2('0x24')][_0xeea2('0x21')]({'where':{'type':_0x479e23,'resourceId':_0x151e6d['id']}})[_0xeea2('0x20')](function(){return _0x122d8b;});})[_0xeea2('0x20')](function(){_0x2d9482[_0xeea2('0x16')](0xcc)[_0xeea2('0x25')]();});}};}function handleEntityNotFound(_0x153602,_0x190331){return function(_0x123f96){if(!_0x123f96){_0x153602[_0xeea2('0x15')](0x194);}return _0x123f96;};}function handleError(_0x3dddbd,_0x546b4f){_0x546b4f=_0x546b4f||0x1f4;return function(_0x534cc2){logger[_0xeea2('0x26')](_0x534cc2['stack']);if(_0x534cc2[_0xeea2('0x27')]){delete _0x534cc2[_0xeea2('0x27')];}_0x3dddbd[_0xeea2('0x16')](_0x546b4f)[_0xeea2('0x28')](_0x534cc2);};}exports[_0xeea2('0x29')]=function(_0x3aa541,_0x176f27){var _0x110568={},_0x2d182d={},_0x522d07={'count':0x0,'rows':[]};var _0x50eda5=_['map'](db[_0xeea2('0x2a')][_0xeea2('0x2b')],function(_0x29d7c9){return{'name':_0x29d7c9[_0xeea2('0x2c')],'type':_0x29d7c9[_0xeea2('0x2d')][_0xeea2('0x2e')]};});_0x2d182d[_0xeea2('0x2f')]=_[_0xeea2('0x30')](_0x50eda5,'name');_0x2d182d[_0xeea2('0x31')]=_[_0xeea2('0x32')](_0x3aa541[_0xeea2('0x31')]);_0x2d182d[_0xeea2('0x33')]=_['intersection'](_0x2d182d[_0xeea2('0x2f')],_0x2d182d['query']);_0x110568[_0xeea2('0x34')]=_[_0xeea2('0x35')](_0x2d182d[_0xeea2('0x2f')],qs[_0xeea2('0x36')](_0x3aa541[_0xeea2('0x31')][_0xeea2('0x36')]));_0x110568['attributes']=_0x110568[_0xeea2('0x34')][_0xeea2('0x37')]?_0x110568['attributes']:_0x2d182d[_0xeea2('0x2f')];if(!_0x3aa541['query'][_0xeea2('0x38')](_0xeea2('0x39'))){_0x110568[_0xeea2('0x1a')]=qs['limit'](_0x3aa541[_0xeea2('0x31')][_0xeea2('0x1a')]);_0x110568[_0xeea2('0x19')]=qs[_0xeea2('0x19')](_0x3aa541[_0xeea2('0x31')][_0xeea2('0x19')]);}_0x110568[_0xeea2('0x3a')]=qs['sort'](_0x3aa541['query'][_0xeea2('0x3b')]);_0x110568[_0xeea2('0x3c')]=qs['filters'](_[_0xeea2('0x3d')](_0x3aa541[_0xeea2('0x31')],_0x2d182d[_0xeea2('0x33')]),_0x50eda5);if(_0x3aa541[_0xeea2('0x31')][_0xeea2('0x3e')]){_0x110568[_0xeea2('0x3c')]=_[_0xeea2('0x3f')](_0x110568[_0xeea2('0x3c')],{'$or':_['map'](_0x50eda5,function(_0x2bdbac){if(_0x2bdbac['type']!==_0xeea2('0x40')){var _0x81a7e3={};_0x81a7e3[_0x2bdbac[_0xeea2('0x27')]]={'$like':'%'+_0x3aa541[_0xeea2('0x31')]['filter']+'%'};return _0x81a7e3;}})});}_0x110568=_['merge']({},_0x110568,_0x3aa541[_0xeea2('0x41')]);var _0x5d0a31={'where':_0x110568['where']};return db[_0xeea2('0x2a')][_0xeea2('0x18')](_0x5d0a31)[_0xeea2('0x20')](function(_0x460008){_0x522d07['count']=_0x460008;if(_0x3aa541[_0xeea2('0x31')][_0xeea2('0x42')]){_0x110568[_0xeea2('0x43')]=[{'all':!![]}];}return db[_0xeea2('0x2a')][_0xeea2('0x44')](_0x110568);})['then'](function(_0x30a246){_0x522d07[_0xeea2('0x45')]=_0x30a246;return _0x522d07;})[_0xeea2('0x20')](respondWithFilteredResult(_0x176f27,_0x110568))[_0xeea2('0x46')](handleError(_0x176f27,null));};exports[_0xeea2('0x47')]=function(_0x311d90,_0x85eec2){var _0x15e782={'raw':!![],'where':{'id':_0x311d90[_0xeea2('0x48')]['id']}},_0x2881a6={};_0x2881a6[_0xeea2('0x2f')]=_[_0xeea2('0x32')](db[_0xeea2('0x2a')][_0xeea2('0x2b')]);_0x2881a6[_0xeea2('0x31')]=_[_0xeea2('0x32')](_0x311d90[_0xeea2('0x31')]);_0x2881a6[_0xeea2('0x33')]=_['intersection'](_0x2881a6[_0xeea2('0x2f')],_0x2881a6['query']);_0x15e782[_0xeea2('0x34')]=_[_0xeea2('0x35')](_0x2881a6['model'],qs[_0xeea2('0x36')](_0x311d90[_0xeea2('0x31')][_0xeea2('0x36')]));_0x15e782[_0xeea2('0x34')]=_0x15e782[_0xeea2('0x34')][_0xeea2('0x37')]?_0x15e782['attributes']:_0x2881a6['model'];if(_0x311d90[_0xeea2('0x31')][_0xeea2('0x42')]){_0x15e782[_0xeea2('0x43')]=[{'all':!![]}];}_0x15e782=_[_0xeea2('0x3f')]({},_0x15e782,_0x311d90[_0xeea2('0x41')]);return db[_0xeea2('0x2a')]['find'](_0x15e782)[_0xeea2('0x20')](handleEntityNotFound(_0x85eec2,null))['then'](respondWithResult(_0x85eec2,null))[_0xeea2('0x46')](handleError(_0x85eec2,null));};exports[_0xeea2('0x1f')]=function(_0x46fc0e,_0x45d2bc){if(_0x46fc0e['body']['id']){delete _0x46fc0e[_0xeea2('0x49')]['id'];}return db[_0xeea2('0x2a')][_0xeea2('0x4a')]({'where':{'id':_0x46fc0e[_0xeea2('0x48')]['id']}})['then'](handleEntityNotFound(_0x45d2bc,null))[_0xeea2('0x20')](saveUpdates(_0x46fc0e[_0xeea2('0x49')],null))[_0xeea2('0x20')](respondWithResult(_0x45d2bc,null))[_0xeea2('0x46')](handleError(_0x45d2bc,null));};exports[_0xeea2('0x21')]=function(_0x2aace5,_0x2c650b){return db[_0xeea2('0x2a')][_0xeea2('0x4a')]({'where':{'id':_0x2aace5[_0xeea2('0x48')]['id']}})[_0xeea2('0x20')](handleEntityNotFound(_0x2c650b,null))['then'](removeEntity(_0x2c650b,null))[_0xeea2('0x46')](handleError(_0x2c650b,null));};exports[_0xeea2('0x4b')]=function(_0x17dc61,_0xdc8ff){var _0x201952={'key':_0x17dc61['body'][_0xeea2('0x2e')]};if(_0x17dc61[_0xeea2('0x49')]['MailAccountId']){_0x201952[_0xeea2('0x4c')]=_0x17dc61[_0xeea2('0x49')][_0xeea2('0x4c')];}else if(_0x17dc61['body'][_0xeea2('0x4d')]){_0x201952[_0xeea2('0x4d')]=_0x17dc61[_0xeea2('0x49')]['SmsAccountId'];}else if(_0x17dc61[_0xeea2('0x49')][_0xeea2('0x4e')]){_0x201952[_0xeea2('0x4e')]=_0x17dc61[_0xeea2('0x49')][_0xeea2('0x4e')];}else if(_0x17dc61[_0xeea2('0x49')][_0xeea2('0x4f')]){_0x201952[_0xeea2('0x4f')]=_0x17dc61['body'][_0xeea2('0x4f')];}return db[_0xeea2('0x2a')][_0xeea2('0x4a')]({'where':_0x201952})[_0xeea2('0x20')](function(_0x149a23){if(_0x149a23){throw new db[(_0xeea2('0x50'))][(_0xeea2('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xeea2('0x4b')](_0x17dc61[_0xeea2('0x49')]);})[_0xeea2('0x20')](function(_0x5e461c){var _0xb091c9=_0x17dc61[_0xeea2('0x52')][_0xeea2('0x22')]({'plain':!![]});if(!_0xb091c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb091c9['role']===_0xeea2('0x52')){var _0x2bdd47=_0x5e461c[_0xeea2('0x22')]({'plain':!![]});return db[_0xeea2('0x53')]['find']({'where':{'name':_0xeea2('0x23'),'userProfileId':_0xb091c9[_0xeea2('0x54')]},'raw':!![]})[_0xeea2('0x20')](function(_0x5ad334){if(_0x5ad334&&_0x5ad334[_0xeea2('0x55')]===0x0){return db[_0xeea2('0x24')][_0xeea2('0x4b')]({'name':_0x2bdd47[_0xeea2('0x27')],'resourceId':_0x2bdd47['id'],'type':_0x5ad334['name'],'sectionId':_0x5ad334['id']},{})[_0xeea2('0x20')](function(){return _0x5e461c;});}else{return _0x5e461c;}})['catch'](function(_0x3db394){logger['error'](_0xeea2('0x56'),_0x3db394);throw _0x3db394;});}return _0x5e461c;})[_0xeea2('0x20')](respondWithResult(_0xdc8ff,0xc9))[_0xeea2('0x46')](handleError(_0xdc8ff,null));}; \ No newline at end of file +var _0x2cc5=['keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','intersection','options','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','get','CannedAnswers','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','model','query'];(function(_0x129bdf,_0x185544){var _0xe2deed=function(_0x1fb556){while(--_0x1fb556){_0x129bdf['push'](_0x129bdf['shift']());}};_0xe2deed(++_0x185544);}(_0x2cc5,0x132));var _0x52cc=function(_0x261a74,_0x4a9a78){_0x261a74=_0x261a74-0x0;var _0x3f15a4=_0x2cc5[_0x261a74];return _0x3f15a4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x52cc('0x0'));var rimraf=require(_0x52cc('0x1'));var zipdir=require(_0x52cc('0x2'));var jsonpatch=require(_0x52cc('0x3'));var rp=require(_0x52cc('0x4'));var moment=require(_0x52cc('0x5'));var BPromise=require(_0x52cc('0x6'));var Mustache=require(_0x52cc('0x7'));var util=require(_0x52cc('0x8'));var path=require(_0x52cc('0x9'));var sox=require(_0x52cc('0xa'));var csv=require(_0x52cc('0xb'));var ejs=require(_0x52cc('0xc'));var fs=require('fs');var _=require(_0x52cc('0xd'));var squel=require(_0x52cc('0xe'));var crypto=require(_0x52cc('0xf'));var jsforce=require(_0x52cc('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x52cc('0xb'));var querystring=require('querystring');var Papa=require(_0x52cc('0x11'));var Redis=require(_0x52cc('0x12'));var authService=require(_0x52cc('0x13'));var qs=require(_0x52cc('0x14'));var as=require(_0x52cc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52cc('0x16'))(_0x52cc('0x17'));var utils=require(_0x52cc('0x18'));var config=require(_0x52cc('0x19'));var db=require(_0x52cc('0x1a'))['db'];function respondWithStatusCode(_0x341fae,_0x203673){_0x203673=_0x203673||0xcc;return function(_0xa84d56){if(_0xa84d56){return _0x341fae[_0x52cc('0x1b')](_0x203673);}return _0x341fae[_0x52cc('0x1c')](_0x203673)[_0x52cc('0x1d')]();};}function respondWithResult(_0x5bf83e,_0x2f2ce1){_0x2f2ce1=_0x2f2ce1||0xc8;return function(_0x54b313){if(_0x54b313){return _0x5bf83e[_0x52cc('0x1c')](_0x2f2ce1)[_0x52cc('0x1e')](_0x54b313);}};}function respondWithFilteredResult(_0x297304,_0x124465){return function(_0x5a224f){if(_0x5a224f){var _0x20017e=_0x5a224f[_0x52cc('0x1f')],_0xe30617=_0x124465['offset'],_0x4fcb65=_0x124465[_0x52cc('0x20')]+_0x124465[_0x52cc('0x21')],_0x54be29;if(_0x4fcb65>=_0x20017e){_0x4fcb65=_0x20017e;_0x54be29=0xc8;}else{_0x54be29=0xce;}_0x297304[_0x52cc('0x1c')](_0x54be29);return _0x297304['set'](_0x52cc('0x22'),_0xe30617+'-'+_0x4fcb65+'/'+_0x20017e)['json'](_0x5a224f);}return null;};}function patchUpdates(_0x1c3917){return function(_0x2cdfde){try{jsonpatch[_0x52cc('0x23')](_0x2cdfde,_0x1c3917,!![]);}catch(_0x534f74){return BPromise['reject'](_0x534f74);}return _0x2cdfde['save']();};}function saveUpdates(_0xe773b7,_0x3d8894){return function(_0x598fb3){if(_0x598fb3){return _0x598fb3[_0x52cc('0x24')](_0xe773b7)[_0x52cc('0x25')](function(_0x2a9bef){return _0x2a9bef;});}return null;};}function removeEntity(_0x20333c,_0x33a95e){return function(_0x16bf2a){if(_0x16bf2a){return _0x16bf2a[_0x52cc('0x26')]()[_0x52cc('0x25')](function(){var _0x1689cc=_0x16bf2a[_0x52cc('0x27')]({'plain':!![]});var _0x591f42=_0x52cc('0x28');return db['UserProfileResource'][_0x52cc('0x26')]({'where':{'type':_0x591f42,'resourceId':_0x1689cc['id']}})[_0x52cc('0x25')](function(){return _0x16bf2a;});})[_0x52cc('0x25')](function(){_0x20333c[_0x52cc('0x1c')](0xcc)[_0x52cc('0x1d')]();});}};}function handleEntityNotFound(_0x28a78d,_0x47a5b2){return function(_0x2fed2e){if(!_0x2fed2e){_0x28a78d[_0x52cc('0x1b')](0x194);}return _0x2fed2e;};}function handleError(_0x4dcbd1,_0x58b44a){_0x58b44a=_0x58b44a||0x1f4;return function(_0x5fe733){logger['error'](_0x5fe733[_0x52cc('0x29')]);if(_0x5fe733[_0x52cc('0x2a')]){delete _0x5fe733[_0x52cc('0x2a')];}_0x4dcbd1[_0x52cc('0x1c')](_0x58b44a)['send'](_0x5fe733);};}exports['index']=function(_0x4114dc,_0x15d094){var _0x83a06f={},_0x3ed187={},_0x22a3b0={'count':0x0,'rows':[]};var _0x2c0387=_[_0x52cc('0x2b')](db[_0x52cc('0x2c')][_0x52cc('0x2d')],function(_0x391b49){return{'name':_0x391b49[_0x52cc('0x2e')],'type':_0x391b49[_0x52cc('0x2f')]['key']};});_0x3ed187[_0x52cc('0x30')]=_[_0x52cc('0x2b')](_0x2c0387,_0x52cc('0x2a'));_0x3ed187[_0x52cc('0x31')]=_[_0x52cc('0x32')](_0x4114dc['query']);_0x3ed187[_0x52cc('0x33')]=_['intersection'](_0x3ed187[_0x52cc('0x30')],_0x3ed187[_0x52cc('0x31')]);_0x83a06f[_0x52cc('0x34')]=_['intersection'](_0x3ed187['model'],qs['fields'](_0x4114dc[_0x52cc('0x31')][_0x52cc('0x35')]));_0x83a06f['attributes']=_0x83a06f['attributes'][_0x52cc('0x36')]?_0x83a06f[_0x52cc('0x34')]:_0x3ed187[_0x52cc('0x30')];if(!_0x4114dc[_0x52cc('0x31')][_0x52cc('0x37')]('nolimit')){_0x83a06f[_0x52cc('0x21')]=qs[_0x52cc('0x21')](_0x4114dc[_0x52cc('0x31')][_0x52cc('0x21')]);_0x83a06f[_0x52cc('0x20')]=qs[_0x52cc('0x20')](_0x4114dc['query'][_0x52cc('0x20')]);}_0x83a06f[_0x52cc('0x38')]=qs['sort'](_0x4114dc['query'][_0x52cc('0x39')]);_0x83a06f[_0x52cc('0x3a')]=qs[_0x52cc('0x33')](_['pick'](_0x4114dc['query'],_0x3ed187[_0x52cc('0x33')]),_0x2c0387);if(_0x4114dc[_0x52cc('0x31')][_0x52cc('0x3b')]){_0x83a06f[_0x52cc('0x3a')]=_[_0x52cc('0x3c')](_0x83a06f[_0x52cc('0x3a')],{'$or':_[_0x52cc('0x2b')](_0x2c0387,function(_0x331834){if(_0x331834[_0x52cc('0x2f')]!==_0x52cc('0x3d')){var _0x117914={};_0x117914[_0x331834[_0x52cc('0x2a')]]={'$like':'%'+_0x4114dc[_0x52cc('0x31')][_0x52cc('0x3b')]+'%'};return _0x117914;}})});}_0x83a06f=_[_0x52cc('0x3c')]({},_0x83a06f,_0x4114dc['options']);var _0x4163d5={'where':_0x83a06f['where']};return db['CannedAnswer'][_0x52cc('0x1f')](_0x4163d5)['then'](function(_0x5afd65){_0x22a3b0[_0x52cc('0x1f')]=_0x5afd65;if(_0x4114dc[_0x52cc('0x31')][_0x52cc('0x3e')]){_0x83a06f[_0x52cc('0x3f')]=[{'all':!![]}];}return db[_0x52cc('0x2c')][_0x52cc('0x40')](_0x83a06f);})[_0x52cc('0x25')](function(_0x30400f){_0x22a3b0[_0x52cc('0x41')]=_0x30400f;return _0x22a3b0;})[_0x52cc('0x25')](respondWithFilteredResult(_0x15d094,_0x83a06f))[_0x52cc('0x42')](handleError(_0x15d094,null));};exports[_0x52cc('0x43')]=function(_0x403006,_0x3ead48){var _0x2bb113={'raw':!![],'where':{'id':_0x403006['params']['id']}},_0x5f87c7={};_0x5f87c7['model']=_[_0x52cc('0x32')](db[_0x52cc('0x2c')]['rawAttributes']);_0x5f87c7[_0x52cc('0x31')]=_['keys'](_0x403006[_0x52cc('0x31')]);_0x5f87c7[_0x52cc('0x33')]=_[_0x52cc('0x44')](_0x5f87c7[_0x52cc('0x30')],_0x5f87c7[_0x52cc('0x31')]);_0x2bb113[_0x52cc('0x34')]=_['intersection'](_0x5f87c7[_0x52cc('0x30')],qs[_0x52cc('0x35')](_0x403006[_0x52cc('0x31')]['fields']));_0x2bb113['attributes']=_0x2bb113[_0x52cc('0x34')][_0x52cc('0x36')]?_0x2bb113[_0x52cc('0x34')]:_0x5f87c7[_0x52cc('0x30')];if(_0x403006[_0x52cc('0x31')][_0x52cc('0x3e')]){_0x2bb113[_0x52cc('0x3f')]=[{'all':!![]}];}_0x2bb113=_[_0x52cc('0x3c')]({},_0x2bb113,_0x403006[_0x52cc('0x45')]);return db[_0x52cc('0x2c')][_0x52cc('0x46')](_0x2bb113)[_0x52cc('0x25')](handleEntityNotFound(_0x3ead48,null))[_0x52cc('0x25')](respondWithResult(_0x3ead48,null))[_0x52cc('0x42')](handleError(_0x3ead48,null));};exports['update']=function(_0x14a859,_0x15ecad){if(_0x14a859[_0x52cc('0x47')]['id']){delete _0x14a859[_0x52cc('0x47')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x14a859[_0x52cc('0x48')]['id']}})[_0x52cc('0x25')](handleEntityNotFound(_0x15ecad,null))['then'](saveUpdates(_0x14a859[_0x52cc('0x47')],null))['then'](respondWithResult(_0x15ecad,null))[_0x52cc('0x42')](handleError(_0x15ecad,null));};exports['destroy']=function(_0xb99bde,_0x6f9508){return db[_0x52cc('0x2c')][_0x52cc('0x46')]({'where':{'id':_0xb99bde['params']['id']}})[_0x52cc('0x25')](handleEntityNotFound(_0x6f9508,null))['then'](removeEntity(_0x6f9508,null))['catch'](handleError(_0x6f9508,null));};exports[_0x52cc('0x49')]=function(_0x262c38,_0x21f434){var _0x5e232e={'key':_0x262c38[_0x52cc('0x47')]['key']};if(_0x262c38[_0x52cc('0x47')][_0x52cc('0x4a')]){_0x5e232e[_0x52cc('0x4a')]=_0x262c38[_0x52cc('0x47')][_0x52cc('0x4a')];}else if(_0x262c38[_0x52cc('0x47')][_0x52cc('0x4b')]){_0x5e232e[_0x52cc('0x4b')]=_0x262c38[_0x52cc('0x47')][_0x52cc('0x4b')];}else if(_0x262c38[_0x52cc('0x47')]['OpenchannelAccountId']){_0x5e232e[_0x52cc('0x4c')]=_0x262c38[_0x52cc('0x47')][_0x52cc('0x4c')];}else if(_0x262c38[_0x52cc('0x47')][_0x52cc('0x4d')]){_0x5e232e[_0x52cc('0x4d')]=_0x262c38[_0x52cc('0x47')]['ChatWebsiteId'];}return db[_0x52cc('0x2c')][_0x52cc('0x46')]({'where':_0x5e232e})[_0x52cc('0x25')](function(_0x1f7ac4){if(_0x1f7ac4){throw new db[(_0x52cc('0x4e'))]['ValidationError'](_0x52cc('0x4f'));}return db['CannedAnswer'][_0x52cc('0x49')](_0x262c38[_0x52cc('0x47')]);})['then'](function(_0x257346){var _0xf6c382=_0x262c38[_0x52cc('0x50')]['get']({'plain':!![]});if(!_0xf6c382)throw new Error(_0x52cc('0x51'));if(_0xf6c382[_0x52cc('0x52')]===_0x52cc('0x50')){var _0x5bc465=_0x257346[_0x52cc('0x27')]({'plain':!![]});return db[_0x52cc('0x53')]['find']({'where':{'name':_0x52cc('0x28'),'userProfileId':_0xf6c382[_0x52cc('0x54')]},'raw':!![]})[_0x52cc('0x25')](function(_0x5c6034){if(_0x5c6034&&_0x5c6034[_0x52cc('0x55')]===0x0){return db[_0x52cc('0x56')][_0x52cc('0x49')]({'name':_0x5bc465[_0x52cc('0x2a')],'resourceId':_0x5bc465['id'],'type':_0x5c6034[_0x52cc('0x2a')],'sectionId':_0x5c6034['id']},{})[_0x52cc('0x25')](function(){return _0x257346;});}else{return _0x257346;}})[_0x52cc('0x42')](function(_0x2aefbd){logger[_0x52cc('0x57')](_0x52cc('0x58'),_0x2aefbd);throw _0x2aefbd;});}return _0x257346;})['then'](respondWithResult(_0x21f434,0xc9))[_0x52cc('0x42')](handleError(_0x21f434,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 4e1659c..2b8bda6 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 _0x5ed2=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x11889a,_0x3c7152){var _0x4165d2=function(_0xcf4f1a){while(--_0xcf4f1a){_0x11889a['push'](_0x11889a['shift']());}};_0x4165d2(++_0x3c7152);}(_0x5ed2,0x114));var _0x25ed=function(_0x45862f,_0xf5f0a6){_0x45862f=_0x45862f-0x0;var _0x35b20b=_0x5ed2[_0x45862f];return _0x35b20b;};'use strict';var _=require(_0x25ed('0x0'));var util=require('util');var logger=require(_0x25ed('0x1'))(_0x25ed('0x2'));var moment=require('moment');var BPromise=require(_0x25ed('0x3'));var rp=require(_0x25ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25ed('0x5'));var config=require(_0x25ed('0x6'));var attributes=require(_0x25ed('0x7'));module[_0x25ed('0x8')]=function(_0x509ca3,_0x3650fd){return _0x509ca3[_0x25ed('0x9')](_0x25ed('0xa'),attributes,{'tableName':_0x25ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x16cc=['path','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2472b8,_0x5522fc){var _0x25c946=function(_0x374909){while(--_0x374909){_0x2472b8['push'](_0x2472b8['shift']());}};_0x25c946(++_0x5522fc);}(_0x16cc,0x120));var _0xc16c=function(_0x113e87,_0x4a543f){_0x113e87=_0x113e87-0x0;var _0x257a68=_0x16cc[_0x113e87];return _0x257a68;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var logger=require(_0xc16c('0x1'))(_0xc16c('0x2'));var moment=require(_0xc16c('0x3'));var BPromise=require(_0xc16c('0x4'));var rp=require(_0xc16c('0x5'));var fs=require('fs');var path=require(_0xc16c('0x6'));var rimraf=require('rimraf');var config=require(_0xc16c('0x7'));var attributes=require(_0xc16c('0x8'));module[_0xc16c('0x9')]=function(_0x1019ec,_0x5ea82b){return _0x1019ec[_0xc16c('0xa')]('CannedAnswer',attributes,{'tableName':_0xc16c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc16c('0xc'),'collate':_0xc16c('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index d0099dc..fb19b07 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 _0x7464=['debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x7464,0x9d));var _0x4746=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7464[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4746('0x0'));var util=require(_0x4746('0x1'));var moment=require(_0x4746('0x2'));var BPromise=require(_0x4746('0x3'));var rs=require(_0x4746('0x4'));var fs=require('fs');var Redis=require(_0x4746('0x5'));var db=require(_0x4746('0x6'))['db'];var utils=require(_0x4746('0x7'));var logger=require(_0x4746('0x8'))(_0x4746('0x9'));var config=require(_0x4746('0xa'));var jayson=require(_0x4746('0xb'));var client=jayson[_0x4746('0xc')][_0x4746('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4cbde5,_0x3826f2,_0x5dfd98){return new BPromise(function(_0x47db25,_0x240f65){return client['request'](_0x4cbde5,_0x5dfd98)[_0x4746('0xe')](function(_0x5d1e74){logger[_0x4746('0xf')](_0x4746('0x10'),_0x3826f2,_0x4746('0x11'));logger[_0x4746('0x12')](_0x4746('0x13'),_0x3826f2,_0x4746('0x11'),JSON[_0x4746('0x14')](_0x5d1e74));if(_0x5d1e74[_0x4746('0x15')]){if(_0x5d1e74[_0x4746('0x15')][_0x4746('0x16')]===0x1f4){logger[_0x4746('0x15')]('CannedAnswer,\x20%s,\x20%s',_0x3826f2,_0x5d1e74['error'][_0x4746('0x17')]);return _0x240f65(_0x5d1e74['error'][_0x4746('0x17')]);}logger[_0x4746('0x15')](_0x4746('0x10'),_0x3826f2,_0x5d1e74[_0x4746('0x15')][_0x4746('0x17')]);return _0x47db25(_0x5d1e74[_0x4746('0x15')][_0x4746('0x17')]);}else{logger[_0x4746('0xf')](_0x4746('0x10'),_0x3826f2,_0x4746('0x11'));_0x47db25(_0x5d1e74[_0x4746('0x18')][_0x4746('0x17')]);}})['catch'](function(_0xe67c10){logger[_0x4746('0x15')](_0x4746('0x10'),_0x3826f2,_0xe67c10);_0x240f65(_0xe67c10);});});} \ No newline at end of file +var _0x8aae=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0xe421be,_0x5a1386){var _0x100c6a=function(_0x2055ee){while(--_0x2055ee){_0xe421be['push'](_0xe421be['shift']());}};_0x100c6a(++_0x5a1386);}(_0x8aae,0xdb));var _0xe8aa=function(_0x5b3115,_0x4a989c){_0x5b3115=_0x5b3115-0x0;var _0x2f6cfc=_0x8aae[_0x5b3115];return _0x2f6cfc;};'use strict';var _=require(_0xe8aa('0x0'));var util=require(_0xe8aa('0x1'));var moment=require(_0xe8aa('0x2'));var BPromise=require(_0xe8aa('0x3'));var rs=require(_0xe8aa('0x4'));var fs=require('fs');var Redis=require(_0xe8aa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8aa('0x6'));var logger=require('../../config/logger')(_0xe8aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe8aa('0x8')][_0xe8aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5417bc,_0x36cd24,_0x555560){return new BPromise(function(_0x37092a,_0x3a6f22){return client['request'](_0x5417bc,_0x555560)[_0xe8aa('0xa')](function(_0x544f00){logger[_0xe8aa('0xb')](_0xe8aa('0xc'),_0x36cd24,_0xe8aa('0xd'));logger[_0xe8aa('0xe')](_0xe8aa('0xf'),_0x36cd24,_0xe8aa('0xd'),JSON['stringify'](_0x544f00));if(_0x544f00[_0xe8aa('0x10')]){if(_0x544f00[_0xe8aa('0x10')]['code']===0x1f4){logger[_0xe8aa('0x10')](_0xe8aa('0xc'),_0x36cd24,_0x544f00[_0xe8aa('0x10')]['message']);return _0x3a6f22(_0x544f00[_0xe8aa('0x10')]['message']);}logger[_0xe8aa('0x10')](_0xe8aa('0xc'),_0x36cd24,_0x544f00[_0xe8aa('0x10')][_0xe8aa('0x11')]);return _0x37092a(_0x544f00['error']['message']);}else{logger[_0xe8aa('0xb')]('CannedAnswer,\x20%s,\x20%s',_0x36cd24,'request\x20sent');_0x37092a(_0x544f00[_0xe8aa('0x12')][_0xe8aa('0x11')]);}})[_0xe8aa('0x13')](function(_0x24aeb8){logger[_0xe8aa('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x36cd24,_0x24aeb8);_0x3a6f22(_0x24aeb8);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 03fb931..089a3d5 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 _0x936b=['path','connect-timeout','Router','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports','multer'];(function(_0x146d44,_0x45d093){var _0x4ba452=function(_0x1fae62){while(--_0x1fae62){_0x146d44['push'](_0x146d44['shift']());}};_0x4ba452(++_0x45d093);}(_0x936b,0x179));var _0xb936=function(_0x165fb2,_0x21bb4a){_0x165fb2=_0x165fb2-0x0;var _0x11a1b0=_0x936b[_0x165fb2];return _0x11a1b0;};'use strict';var multer=require(_0xb936('0x0'));var util=require('util');var path=require(_0xb936('0x1'));var timeout=require(_0xb936('0x2'));var express=require('express');var router=express[_0xb936('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb936('0x4'));router[_0xb936('0x5')]('/',auth[_0xb936('0x6')](),controller[_0xb936('0x7')]);router['get'](_0xb936('0x8'),auth[_0xb936('0x6')](),controller[_0xb936('0x9')]);router['post']('/',auth[_0xb936('0x6')](),controller[_0xb936('0xa')]);router['put'](_0xb936('0x8'),auth[_0xb936('0x6')](),controller[_0xb936('0xb')]);router[_0xb936('0xc')]('/:id',auth[_0xb936('0x6')](),controller['destroy']);module[_0xb936('0xd')]=router; \ No newline at end of file +var _0x3981=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy'];(function(_0x36023f,_0x3463c5){var _0x2c2e24=function(_0x3672b8){while(--_0x3672b8){_0x36023f['push'](_0x36023f['shift']());}};_0x2c2e24(++_0x3463c5);}(_0x3981,0x144));var _0x1398=function(_0x2f3e77,_0xa2d68c){_0x2f3e77=_0x2f3e77-0x0;var _0xe6d7bd=_0x3981[_0x2f3e77];return _0xe6d7bd;};'use strict';var multer=require(_0x1398('0x0'));var util=require('util');var path=require(_0x1398('0x1'));var timeout=require(_0x1398('0x2'));var express=require(_0x1398('0x3'));var router=express[_0x1398('0x4')]();var auth=require(_0x1398('0x5'));var interaction=require(_0x1398('0x6'));var config=require(_0x1398('0x7'));var controller=require(_0x1398('0x8'));router[_0x1398('0x9')]('/',auth[_0x1398('0xa')](),controller[_0x1398('0xb')]);router['get'](_0x1398('0xc'),auth[_0x1398('0xa')](),controller[_0x1398('0xd')]);router['post']('/',auth[_0x1398('0xa')](),controller[_0x1398('0xe')]);router[_0x1398('0xf')](_0x1398('0xc'),auth[_0x1398('0xa')](),controller[_0x1398('0x10')]);router['delete'](_0x1398('0xc'),auth[_0x1398('0xa')](),controller[_0x1398('0x11')]);module[_0x1398('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 292ab52..63e3875 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 _0x0363=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x301225,_0x5de13e){var _0x70e768=function(_0x512fe9){while(--_0x512fe9){_0x301225['push'](_0x301225['shift']());}};_0x70e768(++_0x5de13e);}(_0x0363,0x180));var _0x3036=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0x0363[_0x1d83db];return _0x2dc1d1;};'use strict';var Sequelize=require(_0x3036('0x0'));module[_0x3036('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x3036('0x2')},'clid':{'type':Sequelize[_0x3036('0x3')]},'src':{'type':Sequelize[_0x3036('0x3')]},'dst':{'type':Sequelize[_0x3036('0x3')]},'dcontext':{'type':Sequelize[_0x3036('0x3')]},'channel':{'type':Sequelize[_0x3036('0x3')]},'dstchannel':{'type':Sequelize[_0x3036('0x3')]},'lastapp':{'type':Sequelize[_0x3036('0x3')]},'lastdata':{'type':Sequelize[_0x3036('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3036('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3036('0x3')]},'amaflags':{'type':Sequelize[_0x3036('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3036('0x3')]},'userfield':{'type':Sequelize[_0x3036('0x3')]},'uniqueid':{'type':Sequelize[_0x3036('0x3')]},'linkedid':{'type':Sequelize[_0x3036('0x3')]},'sequence':{'type':Sequelize[_0x3036('0x3')]},'peeraccount':{'type':Sequelize[_0x3036('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x3036('0x3')]}}; \ No newline at end of file +var _0x1383=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x229132,_0x3115c9){var _0x272ab1=function(_0x387a51){while(--_0x387a51){_0x229132['push'](_0x229132['shift']());}};_0x272ab1(++_0x3115c9);}(_0x1383,0xef));var _0x3138=function(_0x33a880,_0x153ebf){_0x33a880=_0x33a880-0x0;var _0x35174c=_0x1383[_0x33a880];return _0x35174c;};'use strict';var Sequelize=require(_0x3138('0x0'));module[_0x3138('0x1')]={'calldate':{'type':Sequelize[_0x3138('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x3138('0x3')]},'src':{'type':Sequelize[_0x3138('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x3138('0x3')]},'channel':{'type':Sequelize[_0x3138('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x3138('0x3')]},'lastdata':{'type':Sequelize[_0x3138('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3138('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3138('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x3138('0x3')]},'uniqueid':{'type':Sequelize[_0x3138('0x3')]},'linkedid':{'type':Sequelize[_0x3138('0x3')]},'sequence':{'type':Sequelize[_0x3138('0x3')]},'peeraccount':{'type':Sequelize[_0x3138('0x3')]},'type':{'type':Sequelize[_0x3138('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 32ea3a1..825d4be 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 _0x9569=['end','json','offset','limit','apply','reject','update','then','destroy','sendStatus','error','name','send','map','Cdr','type','key','model','keys','filters','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x31d459,_0x2bd5b4){var _0x5d3f67=function(_0x218669){while(--_0x218669){_0x31d459['push'](_0x31d459['shift']());}};_0x5d3f67(++_0x2bd5b4);}(_0x9569,0x74));var _0x9956=function(_0x4c5085,_0x9bf283){_0x4c5085=_0x4c5085-0x0;var _0x21b22d=_0x9569[_0x4c5085];return _0x21b22d;};'use strict';var pdf=require(_0x9956('0x0'));var emlformat=require(_0x9956('0x1'));var rimraf=require(_0x9956('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9956('0x3'));var rp=require('request-promise');var moment=require(_0x9956('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9956('0x5'));var util=require(_0x9956('0x6'));var path=require(_0x9956('0x7'));var sox=require(_0x9956('0x8'));var csv=require(_0x9956('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9956('0xa'));var squel=require('squel');var crypto=require(_0x9956('0xb'));var jsforce=require(_0x9956('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9956('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9956('0xd'));var authService=require(_0x9956('0xe'));var qs=require(_0x9956('0xf'));var as=require(_0x9956('0x10'));var hardwareService=require(_0x9956('0x11'));var logger=require(_0x9956('0x12'))(_0x9956('0x13'));var utils=require(_0x9956('0x14'));var config=require(_0x9956('0x15'));var db=require(_0x9956('0x16'))['db'];function respondWithStatusCode(_0x4e60c2,_0x3d5791){_0x3d5791=_0x3d5791||0xcc;return function(_0x14a2f1){if(_0x14a2f1){return _0x4e60c2['sendStatus'](_0x3d5791);}return _0x4e60c2[_0x9956('0x17')](_0x3d5791)[_0x9956('0x18')]();};}function respondWithResult(_0x5ee6b8,_0x305eb8){_0x305eb8=_0x305eb8||0xc8;return function(_0x55119f){if(_0x55119f){return _0x5ee6b8[_0x9956('0x17')](_0x305eb8)[_0x9956('0x19')](_0x55119f);}};}function respondWithFilteredResult(_0x2c761d,_0x185f16){return function(_0x38eb64){if(_0x38eb64){var _0x3955d7=_0x38eb64['count'],_0x226670=_0x185f16['offset'],_0x416a23=_0x185f16[_0x9956('0x1a')]+_0x185f16[_0x9956('0x1b')],_0x38d201;if(_0x416a23>=_0x3955d7){_0x416a23=_0x3955d7;_0x38d201=0xc8;}else{_0x38d201=0xce;}_0x2c761d[_0x9956('0x17')](_0x38d201);return _0x2c761d['set']('Content-Range',_0x226670+'-'+_0x416a23+'/'+_0x3955d7)[_0x9956('0x19')](_0x38eb64);}return null;};}function patchUpdates(_0x380a0c){return function(_0x4005d3){try{jsonpatch[_0x9956('0x1c')](_0x4005d3,_0x380a0c,!![]);}catch(_0x17d7d0){return BPromise[_0x9956('0x1d')](_0x17d7d0);}return _0x4005d3['save']();};}function saveUpdates(_0x320c4f,_0x12ad2c){return function(_0x59ea1e){if(_0x59ea1e){return _0x59ea1e[_0x9956('0x1e')](_0x320c4f)[_0x9956('0x1f')](function(_0x44b718){return _0x44b718;});}return null;};}function removeEntity(_0x1c3e16,_0xacc0b1){return function(_0x37f395){if(_0x37f395){return _0x37f395[_0x9956('0x20')]()['then'](function(){_0x1c3e16[_0x9956('0x17')](0xcc)[_0x9956('0x18')]();});}};}function handleEntityNotFound(_0x1e54a6,_0x3c310e){return function(_0x4398f1){if(!_0x4398f1){_0x1e54a6[_0x9956('0x21')](0x194);}return _0x4398f1;};}function handleError(_0x48ff27,_0x42ed75){_0x42ed75=_0x42ed75||0x1f4;return function(_0x533350){logger[_0x9956('0x22')](_0x533350['stack']);if(_0x533350[_0x9956('0x23')]){delete _0x533350[_0x9956('0x23')];}_0x48ff27[_0x9956('0x17')](_0x42ed75)[_0x9956('0x24')](_0x533350);};}exports['index']=function(_0x33ce69,_0x316244){var _0x3455f6={},_0x5ce70c={},_0x50694f={'count':0x0,'rows':[]};var _0x1e05e1=_[_0x9956('0x25')](db[_0x9956('0x26')]['rawAttributes'],function(_0x79ea7){return{'name':_0x79ea7['fieldName'],'type':_0x79ea7[_0x9956('0x27')][_0x9956('0x28')]};});_0x5ce70c[_0x9956('0x29')]=_[_0x9956('0x25')](_0x1e05e1,_0x9956('0x23'));_0x5ce70c['query']=_[_0x9956('0x2a')](_0x33ce69['query']);_0x5ce70c[_0x9956('0x2b')]=_['intersection'](_0x5ce70c[_0x9956('0x29')],_0x5ce70c[_0x9956('0x2c')]);_0x3455f6[_0x9956('0x2d')]=_['intersection'](_0x5ce70c['model'],qs[_0x9956('0x2e')](_0x33ce69[_0x9956('0x2c')][_0x9956('0x2e')]));_0x3455f6[_0x9956('0x2d')]=_0x3455f6[_0x9956('0x2d')]['length']?_0x3455f6[_0x9956('0x2d')]:_0x5ce70c['model'];if(!_0x33ce69[_0x9956('0x2c')][_0x9956('0x2f')]('nolimit')){_0x3455f6[_0x9956('0x1b')]=qs[_0x9956('0x1b')](_0x33ce69[_0x9956('0x2c')][_0x9956('0x1b')]);_0x3455f6[_0x9956('0x1a')]=qs[_0x9956('0x1a')](_0x33ce69[_0x9956('0x2c')][_0x9956('0x1a')]);}_0x3455f6[_0x9956('0x30')]=qs['sort'](_0x33ce69[_0x9956('0x2c')][_0x9956('0x31')]);_0x3455f6[_0x9956('0x32')]=qs[_0x9956('0x2b')](_[_0x9956('0x33')](_0x33ce69[_0x9956('0x2c')],_0x5ce70c[_0x9956('0x2b')]),_0x1e05e1);if(_0x33ce69[_0x9956('0x2c')][_0x9956('0x34')]){_0x3455f6[_0x9956('0x32')]=_[_0x9956('0x35')](_0x3455f6[_0x9956('0x32')],{'$or':_[_0x9956('0x25')](_0x1e05e1,function(_0x285e6b){if(_0x285e6b[_0x9956('0x27')]!=='VIRTUAL'){var _0x1b6a92={};_0x1b6a92[_0x285e6b[_0x9956('0x23')]]={'$like':'%'+_0x33ce69[_0x9956('0x2c')][_0x9956('0x34')]+'%'};return _0x1b6a92;}})});}_0x3455f6=_[_0x9956('0x35')]({},_0x3455f6,_0x33ce69[_0x9956('0x36')]);var _0x472859={'where':_0x3455f6['where']};return db[_0x9956('0x26')][_0x9956('0x37')](_0x472859)[_0x9956('0x1f')](function(_0x16084f){_0x50694f[_0x9956('0x37')]=_0x16084f;if(_0x33ce69['query'][_0x9956('0x38')]){_0x3455f6[_0x9956('0x39')]=[{'all':!![]}];}return db['Cdr'][_0x9956('0x3a')](_0x3455f6);})[_0x9956('0x1f')](function(_0x42eeec){_0x50694f[_0x9956('0x3b')]=_0x42eeec;return _0x50694f;})[_0x9956('0x1f')](respondWithFilteredResult(_0x316244,_0x3455f6))[_0x9956('0x3c')](handleError(_0x316244,null));};exports[_0x9956('0x3d')]=function(_0x16cab7,_0x2e82cb){var _0xf54eb0={'raw':!![],'where':{'id':_0x16cab7[_0x9956('0x3e')]['id']}},_0x41b69d={};_0x41b69d[_0x9956('0x29')]=_[_0x9956('0x2a')](db[_0x9956('0x26')][_0x9956('0x3f')]);_0x41b69d['query']=_['keys'](_0x16cab7['query']);_0x41b69d['filters']=_['intersection'](_0x41b69d[_0x9956('0x29')],_0x41b69d['query']);_0xf54eb0[_0x9956('0x2d')]=_[_0x9956('0x40')](_0x41b69d[_0x9956('0x29')],qs[_0x9956('0x2e')](_0x16cab7[_0x9956('0x2c')]['fields']));_0xf54eb0[_0x9956('0x2d')]=_0xf54eb0[_0x9956('0x2d')][_0x9956('0x41')]?_0xf54eb0[_0x9956('0x2d')]:_0x41b69d['model'];if(_0x16cab7[_0x9956('0x2c')][_0x9956('0x38')]){_0xf54eb0[_0x9956('0x39')]=[{'all':!![]}];}_0xf54eb0=_[_0x9956('0x35')]({},_0xf54eb0,_0x16cab7['options']);return db[_0x9956('0x26')]['find'](_0xf54eb0)[_0x9956('0x1f')](handleEntityNotFound(_0x2e82cb,null))['then'](respondWithResult(_0x2e82cb,null))[_0x9956('0x3c')](handleError(_0x2e82cb,null));};exports[_0x9956('0x42')]=function(_0x4e099e,_0x1391b1){return db[_0x9956('0x26')][_0x9956('0x42')](_0x4e099e['body'],{})[_0x9956('0x1f')](respondWithResult(_0x1391b1,0xc9))[_0x9956('0x3c')](handleError(_0x1391b1,null));};exports['update']=function(_0x3cc8b4,_0x5070ee){if(_0x3cc8b4['body']['id']){delete _0x3cc8b4[_0x9956('0x43')]['id'];}return db[_0x9956('0x26')]['find']({'where':{'id':_0x3cc8b4['params']['id']}})[_0x9956('0x1f')](handleEntityNotFound(_0x5070ee,null))['then'](saveUpdates(_0x3cc8b4[_0x9956('0x43')],null))[_0x9956('0x1f')](respondWithResult(_0x5070ee,null))[_0x9956('0x3c')](handleError(_0x5070ee,null));};exports[_0x9956('0x20')]=function(_0x581800,_0xed45d3){return db['Cdr'][_0x9956('0x44')]({'where':{'id':_0x581800[_0x9956('0x3e')]['id']}})['then'](handleEntityNotFound(_0xed45d3,null))[_0x9956('0x1f')](removeEntity(_0xed45d3,null))['catch'](handleError(_0xed45d3,null));};exports[_0x9956('0x45')]=function(_0x7547eb,_0x3eec39){return db[_0x9956('0x26')]['describe']()[_0x9956('0x1f')](respondWithResult(_0x3eec39,null))['catch'](handleError(_0x3eec39,null));}; \ No newline at end of file +var _0x8764=['set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','Cdr','fieldName','type','query','keys','filters','intersection','model','fields','attributes','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset'];(function(_0x15ecaa,_0x391114){var _0x3ea750=function(_0x394cc6){while(--_0x394cc6){_0x15ecaa['push'](_0x15ecaa['shift']());}};_0x3ea750(++_0x391114);}(_0x8764,0x76));var _0x4876=function(_0x4f296d,_0x8e9ec8){_0x4f296d=_0x4f296d-0x0;var _0x11b339=_0x8764[_0x4f296d];return _0x11b339;};'use strict';var pdf=require(_0x4876('0x0'));var emlformat=require(_0x4876('0x1'));var rimraf=require(_0x4876('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4876('0x3'));var rp=require(_0x4876('0x4'));var moment=require(_0x4876('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4876('0x6'));var path=require(_0x4876('0x7'));var sox=require(_0x4876('0x8'));var csv=require('to-csv');var ejs=require(_0x4876('0x9'));var fs=require('fs');var _=require(_0x4876('0xa'));var squel=require('squel');var crypto=require(_0x4876('0xb'));var jsforce=require(_0x4876('0xc'));var deskjs=require(_0x4876('0xd'));var toCsv=require(_0x4876('0xe'));var querystring=require(_0x4876('0xf'));var Papa=require(_0x4876('0x10'));var Redis=require(_0x4876('0x11'));var authService=require(_0x4876('0x12'));var qs=require(_0x4876('0x13'));var as=require(_0x4876('0x14'));var hardwareService=require(_0x4876('0x15'));var logger=require(_0x4876('0x16'))(_0x4876('0x17'));var utils=require(_0x4876('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c378d,_0x13f2b6){_0x13f2b6=_0x13f2b6||0xcc;return function(_0xca4591){if(_0xca4591){return _0x3c378d[_0x4876('0x19')](_0x13f2b6);}return _0x3c378d[_0x4876('0x1a')](_0x13f2b6)[_0x4876('0x1b')]();};}function respondWithResult(_0x27bb9b,_0x9dc509){_0x9dc509=_0x9dc509||0xc8;return function(_0x4be279){if(_0x4be279){return _0x27bb9b[_0x4876('0x1a')](_0x9dc509)['json'](_0x4be279);}};}function respondWithFilteredResult(_0x56e2e9,_0x458c14){return function(_0x2ad8e8){if(_0x2ad8e8){var _0x22353f=_0x2ad8e8[_0x4876('0x1c')],_0x27810f=_0x458c14[_0x4876('0x1d')],_0x37218b=_0x458c14[_0x4876('0x1d')]+_0x458c14['limit'],_0x48e65a;if(_0x37218b>=_0x22353f){_0x37218b=_0x22353f;_0x48e65a=0xc8;}else{_0x48e65a=0xce;}_0x56e2e9[_0x4876('0x1a')](_0x48e65a);return _0x56e2e9[_0x4876('0x1e')](_0x4876('0x1f'),_0x27810f+'-'+_0x37218b+'/'+_0x22353f)[_0x4876('0x20')](_0x2ad8e8);}return null;};}function patchUpdates(_0x5d9bb2){return function(_0x413cb0){try{jsonpatch['apply'](_0x413cb0,_0x5d9bb2,!![]);}catch(_0x25de41){return BPromise[_0x4876('0x21')](_0x25de41);}return _0x413cb0[_0x4876('0x22')]();};}function saveUpdates(_0x113903,_0x3e9fb2){return function(_0x5570c3){if(_0x5570c3){return _0x5570c3[_0x4876('0x23')](_0x113903)[_0x4876('0x24')](function(_0x1dbc5a){return _0x1dbc5a;});}return null;};}function removeEntity(_0x201202,_0x4d5089){return function(_0x520109){if(_0x520109){return _0x520109[_0x4876('0x25')]()[_0x4876('0x24')](function(){_0x201202[_0x4876('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6ec8,_0x3b3741){return function(_0x39e02e){if(!_0x39e02e){_0x2d6ec8[_0x4876('0x19')](0x194);}return _0x39e02e;};}function handleError(_0x3c6242,_0x4f2c46){_0x4f2c46=_0x4f2c46||0x1f4;return function(_0x59d865){logger[_0x4876('0x26')](_0x59d865[_0x4876('0x27')]);if(_0x59d865[_0x4876('0x28')]){delete _0x59d865['name'];}_0x3c6242[_0x4876('0x1a')](_0x4f2c46)['send'](_0x59d865);};}exports[_0x4876('0x29')]=function(_0x47c706,_0x4694e7){var _0x533c16={},_0x24c216={},_0x1737f8={'count':0x0,'rows':[]};var _0x2d8781=_[_0x4876('0x2a')](db[_0x4876('0x2b')]['rawAttributes'],function(_0x275fa1){return{'name':_0x275fa1[_0x4876('0x2c')],'type':_0x275fa1[_0x4876('0x2d')]['key']};});_0x24c216['model']=_[_0x4876('0x2a')](_0x2d8781,_0x4876('0x28'));_0x24c216[_0x4876('0x2e')]=_[_0x4876('0x2f')](_0x47c706[_0x4876('0x2e')]);_0x24c216[_0x4876('0x30')]=_[_0x4876('0x31')](_0x24c216[_0x4876('0x32')],_0x24c216[_0x4876('0x2e')]);_0x533c16['attributes']=_[_0x4876('0x31')](_0x24c216[_0x4876('0x32')],qs[_0x4876('0x33')](_0x47c706['query'][_0x4876('0x33')]));_0x533c16['attributes']=_0x533c16[_0x4876('0x34')]['length']?_0x533c16[_0x4876('0x34')]:_0x24c216['model'];if(!_0x47c706[_0x4876('0x2e')]['hasOwnProperty']('nolimit')){_0x533c16[_0x4876('0x35')]=qs[_0x4876('0x35')](_0x47c706[_0x4876('0x2e')][_0x4876('0x35')]);_0x533c16[_0x4876('0x1d')]=qs['offset'](_0x47c706[_0x4876('0x2e')]['offset']);}_0x533c16[_0x4876('0x36')]=qs[_0x4876('0x37')](_0x47c706[_0x4876('0x2e')]['sort']);_0x533c16[_0x4876('0x38')]=qs['filters'](_[_0x4876('0x39')](_0x47c706[_0x4876('0x2e')],_0x24c216[_0x4876('0x30')]),_0x2d8781);if(_0x47c706[_0x4876('0x2e')][_0x4876('0x3a')]){_0x533c16[_0x4876('0x38')]=_[_0x4876('0x3b')](_0x533c16[_0x4876('0x38')],{'$or':_[_0x4876('0x2a')](_0x2d8781,function(_0x503366){if(_0x503366['type']!=='VIRTUAL'){var _0x1bf40c={};_0x1bf40c[_0x503366[_0x4876('0x28')]]={'$like':'%'+_0x47c706['query']['filter']+'%'};return _0x1bf40c;}})});}_0x533c16=_[_0x4876('0x3b')]({},_0x533c16,_0x47c706['options']);var _0x132df6={'where':_0x533c16['where']};return db[_0x4876('0x2b')]['count'](_0x132df6)[_0x4876('0x24')](function(_0x385de9){_0x1737f8['count']=_0x385de9;if(_0x47c706[_0x4876('0x2e')][_0x4876('0x3c')]){_0x533c16[_0x4876('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x4876('0x3e')](_0x533c16);})[_0x4876('0x24')](function(_0x1d6056){_0x1737f8[_0x4876('0x3f')]=_0x1d6056;return _0x1737f8;})[_0x4876('0x24')](respondWithFilteredResult(_0x4694e7,_0x533c16))[_0x4876('0x40')](handleError(_0x4694e7,null));};exports[_0x4876('0x41')]=function(_0x44af88,_0x91f2e4){var _0x389fdd={'raw':!![],'where':{'id':_0x44af88[_0x4876('0x42')]['id']}},_0x2fb995={};_0x2fb995[_0x4876('0x32')]=_[_0x4876('0x2f')](db['Cdr'][_0x4876('0x43')]);_0x2fb995['query']=_[_0x4876('0x2f')](_0x44af88[_0x4876('0x2e')]);_0x2fb995[_0x4876('0x30')]=_[_0x4876('0x31')](_0x2fb995[_0x4876('0x32')],_0x2fb995['query']);_0x389fdd['attributes']=_[_0x4876('0x31')](_0x2fb995['model'],qs[_0x4876('0x33')](_0x44af88[_0x4876('0x2e')][_0x4876('0x33')]));_0x389fdd[_0x4876('0x34')]=_0x389fdd[_0x4876('0x34')][_0x4876('0x44')]?_0x389fdd['attributes']:_0x2fb995[_0x4876('0x32')];if(_0x44af88[_0x4876('0x2e')][_0x4876('0x3c')]){_0x389fdd[_0x4876('0x3d')]=[{'all':!![]}];}_0x389fdd=_['merge']({},_0x389fdd,_0x44af88[_0x4876('0x45')]);return db[_0x4876('0x2b')][_0x4876('0x46')](_0x389fdd)[_0x4876('0x24')](handleEntityNotFound(_0x91f2e4,null))[_0x4876('0x24')](respondWithResult(_0x91f2e4,null))[_0x4876('0x40')](handleError(_0x91f2e4,null));};exports[_0x4876('0x47')]=function(_0x19fd1b,_0x2f53a9){return db['Cdr']['create'](_0x19fd1b[_0x4876('0x48')],{})['then'](respondWithResult(_0x2f53a9,0xc9))[_0x4876('0x40')](handleError(_0x2f53a9,null));};exports[_0x4876('0x23')]=function(_0x4424ec,_0x4e8f56){if(_0x4424ec[_0x4876('0x48')]['id']){delete _0x4424ec[_0x4876('0x48')]['id'];}return db[_0x4876('0x2b')][_0x4876('0x46')]({'where':{'id':_0x4424ec[_0x4876('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e8f56,null))[_0x4876('0x24')](saveUpdates(_0x4424ec[_0x4876('0x48')],null))[_0x4876('0x24')](respondWithResult(_0x4e8f56,null))[_0x4876('0x40')](handleError(_0x4e8f56,null));};exports[_0x4876('0x25')]=function(_0x4242d9,_0x331c98){return db[_0x4876('0x2b')][_0x4876('0x46')]({'where':{'id':_0x4242d9['params']['id']}})[_0x4876('0x24')](handleEntityNotFound(_0x331c98,null))[_0x4876('0x24')](removeEntity(_0x331c98,null))['catch'](handleError(_0x331c98,null));};exports['describe']=function(_0x1a8e15,_0x464a5d){return db['Cdr'][_0x4876('0x49')]()[_0x4876('0x24')](respondWithResult(_0x464a5d,null))[_0x4876('0x40')](handleError(_0x464a5d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index bea1b2a..7140b53 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 _0x655f=['accountcode','calldate','disposition','dst','src','uniqueid','lodash','api','bluebird','request-promise','path','../../config/environment','./cdr.attributes','define','Cdr'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x655f,0x150));var _0xf655=function(_0x5173c3,_0x51e0a0){_0x5173c3=_0x5173c3-0x0;var _0x3ab67a=_0x655f[_0x5173c3];return _0x3ab67a;};'use strict';var _=require(_0xf655('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf655('0x1'));var moment=require('moment');var BPromise=require(_0xf655('0x2'));var rp=require(_0xf655('0x3'));var fs=require('fs');var path=require(_0xf655('0x4'));var rimraf=require('rimraf');var config=require(_0xf655('0x5'));var attributes=require(_0xf655('0x6'));module['exports']=function(_0x80e301,_0x444770){return _0x80e301[_0xf655('0x7')](_0xf655('0x8'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xf655('0x9'),'fields':[_0xf655('0x9')]},{'name':'calldate','fields':[_0xf655('0xa')]},{'name':'disposition','fields':[_0xf655('0xb')]},{'name':_0xf655('0xc'),'fields':[_0xf655('0xc')]},{'name':'src','fields':[_0xf655('0xd')]},{'name':_0xf655('0xe'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0xc2d8=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','Cdr','cdr','accountcode','calldate','dst','src','uniqueid'];(function(_0x346d53,_0x477cbe){var _0x110a72=function(_0x3f6693){while(--_0x3f6693){_0x346d53['push'](_0x346d53['shift']());}};_0x110a72(++_0x477cbe);}(_0xc2d8,0x1ef));var _0x8c2d=function(_0x524ba7,_0x1856f){_0x524ba7=_0x524ba7-0x0;var _0xd6b359=_0xc2d8[_0x524ba7];return _0xd6b359;};'use strict';var _=require('lodash');var util=require(_0x8c2d('0x0'));var logger=require('../../config/logger')(_0x8c2d('0x1'));var moment=require(_0x8c2d('0x2'));var BPromise=require(_0x8c2d('0x3'));var rp=require(_0x8c2d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c2d('0x5'));var config=require(_0x8c2d('0x6'));var attributes=require('./cdr.attributes');module[_0x8c2d('0x7')]=function(_0x134ac8,_0x20f0d3){return _0x134ac8['define'](_0x8c2d('0x8'),attributes,{'tableName':_0x8c2d('0x9'),'paranoid':![],'indexes':[{'name':_0x8c2d('0xa'),'fields':['accountcode']},{'name':_0x8c2d('0xb'),'fields':[_0x8c2d('0xb')]},{'name':'disposition','fields':['disposition']},{'name':_0x8c2d('0xc'),'fields':[_0x8c2d('0xc')]},{'name':_0x8c2d('0xd'),'fields':[_0x8c2d('0xd')]},{'name':_0x8c2d('0xe'),'fields':[_0x8c2d('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index de2c995..7a2b935 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 _0xd295=['../../config/environment','jayson/promise','client','request','info','Cdr,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x42214d,_0x2c6a22){var _0x263211=function(_0x517e35){while(--_0x517e35){_0x42214d['push'](_0x42214d['shift']());}};_0x263211(++_0x2c6a22);}(_0xd295,0x1db));var _0x5d29=function(_0x5d75fe,_0x38dac2){_0x5d75fe=_0x5d75fe-0x0;var _0x559e21=_0xd295[_0x5d75fe];return _0x559e21;};'use strict';var _=require(_0x5d29('0x0'));var util=require('util');var moment=require(_0x5d29('0x1'));var BPromise=require(_0x5d29('0x2'));var rs=require(_0x5d29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d29('0x4'))['db'];var utils=require(_0x5d29('0x5'));var logger=require(_0x5d29('0x6'))(_0x5d29('0x7'));var config=require(_0x5d29('0x8'));var jayson=require(_0x5d29('0x9'));var client=jayson[_0x5d29('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24f095,_0x3f324b,_0x166b39){return new BPromise(function(_0x5b5bf4,_0x2f8386){return client[_0x5d29('0xb')](_0x24f095,_0x166b39)['then'](function(_0x1a0815){logger[_0x5d29('0xc')](_0x5d29('0xd'),_0x3f324b,'request\x20sent');logger[_0x5d29('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3f324b,'request\x20sent',JSON[_0x5d29('0xf')](_0x1a0815));if(_0x1a0815['error']){if(_0x1a0815[_0x5d29('0x10')][_0x5d29('0x11')]===0x1f4){logger['error'](_0x5d29('0xd'),_0x3f324b,_0x1a0815[_0x5d29('0x10')][_0x5d29('0x12')]);return _0x2f8386(_0x1a0815['error'][_0x5d29('0x12')]);}logger[_0x5d29('0x10')](_0x5d29('0xd'),_0x3f324b,_0x1a0815[_0x5d29('0x10')][_0x5d29('0x12')]);return _0x5b5bf4(_0x1a0815[_0x5d29('0x10')]['message']);}else{logger[_0x5d29('0xc')](_0x5d29('0xd'),_0x3f324b,_0x5d29('0x13'));_0x5b5bf4(_0x1a0815[_0x5d29('0x14')][_0x5d29('0x12')]);}})['catch'](function(_0x2c33cc){logger[_0x5d29('0x10')](_0x5d29('0xd'),_0x3f324b,_0x2c33cc);_0x2f8386(_0x2c33cc);});});} \ No newline at end of file +var _0x8a7e=['../../config/logger','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8a7e,0x177));var _0xe8a7=function(_0x5aaa74,_0xaacac7){_0x5aaa74=_0x5aaa74-0x0;var _0x2a5d16=_0x8a7e[_0x5aaa74];return _0x2a5d16;};'use strict';var _=require(_0xe8a7('0x0'));var util=require(_0xe8a7('0x1'));var moment=require(_0xe8a7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8a7('0x3'))['db'];var utils=require(_0xe8a7('0x4'));var logger=require(_0xe8a7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe8a7('0x6'));var client=jayson[_0xe8a7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59bc5e,_0x405f2e,_0x48f922){return new BPromise(function(_0x2d8d52,_0x2c056b){return client[_0xe8a7('0x8')](_0x59bc5e,_0x48f922)[_0xe8a7('0x9')](function(_0xc2f2b4){logger['info'](_0xe8a7('0xa'),_0x405f2e,_0xe8a7('0xb'));logger[_0xe8a7('0xc')](_0xe8a7('0xd'),_0x405f2e,_0xe8a7('0xb'),JSON[_0xe8a7('0xe')](_0xc2f2b4));if(_0xc2f2b4[_0xe8a7('0xf')]){if(_0xc2f2b4['error']['code']===0x1f4){logger[_0xe8a7('0xf')](_0xe8a7('0xa'),_0x405f2e,_0xc2f2b4[_0xe8a7('0xf')][_0xe8a7('0x10')]);return _0x2c056b(_0xc2f2b4[_0xe8a7('0xf')][_0xe8a7('0x10')]);}logger[_0xe8a7('0xf')]('Cdr,\x20%s,\x20%s',_0x405f2e,_0xc2f2b4[_0xe8a7('0xf')]['message']);return _0x2d8d52(_0xc2f2b4['error']['message']);}else{logger[_0xe8a7('0x11')](_0xe8a7('0xa'),_0x405f2e,_0xe8a7('0xb'));_0x2d8d52(_0xc2f2b4[_0xe8a7('0x12')]['message']);}})[_0xe8a7('0x13')](function(_0x4e3d16){logger[_0xe8a7('0xf')]('Cdr,\x20%s,\x20%s',_0x405f2e,_0x4e3d16);_0x2c056b(_0x4e3d16);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index daee2a1..0408755 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 _0xd9c4=['isAuthenticated','index','/describe','describe','/:id','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./cdr.controller','get'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0xd9c4,0x119));var _0x4d9c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xd9c4[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x4d9c('0x0'));var util=require(_0x4d9c('0x1'));var path=require(_0x4d9c('0x2'));var timeout=require(_0x4d9c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4d9c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4d9c('0x5'));var controller=require(_0x4d9c('0x6'));router[_0x4d9c('0x7')]('/',auth[_0x4d9c('0x8')](),controller[_0x4d9c('0x9')]);router['get'](_0x4d9c('0xa'),auth[_0x4d9c('0x8')](),controller[_0x4d9c('0xb')]);router[_0x4d9c('0x7')](_0x4d9c('0xc'),auth[_0x4d9c('0x8')](),controller['show']);router['post']('/',auth[_0x4d9c('0x8')](),controller[_0x4d9c('0xd')]);router['put']('/:id',auth[_0x4d9c('0x8')](),controller['update']);router[_0x4d9c('0xe')](_0x4d9c('0xc'),auth[_0x4d9c('0x8')](),controller[_0x4d9c('0xf')]);module[_0x4d9c('0x10')]=router; \ No newline at end of file +var _0xf8b1=['create','put','update','delete','destroy','exports','multer','path','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x175ca4,_0x3a74c4){var _0x8c846d=function(_0x21d0e7){while(--_0x21d0e7){_0x175ca4['push'](_0x175ca4['shift']());}};_0x8c846d(++_0x3a74c4);}(_0xf8b1,0x1e2));var _0x1f8b=function(_0x332864,_0x27c971){_0x332864=_0x332864-0x0;var _0x6ebf8b=_0xf8b1[_0x332864];return _0x6ebf8b;};'use strict';var multer=require(_0x1f8b('0x0'));var util=require('util');var path=require(_0x1f8b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1f8b('0x2'));var config=require(_0x1f8b('0x3'));var controller=require(_0x1f8b('0x4'));router[_0x1f8b('0x5')]('/',auth[_0x1f8b('0x6')](),controller['index']);router[_0x1f8b('0x5')]('/describe',auth[_0x1f8b('0x6')](),controller[_0x1f8b('0x7')]);router[_0x1f8b('0x5')](_0x1f8b('0x8'),auth[_0x1f8b('0x6')](),controller[_0x1f8b('0x9')]);router[_0x1f8b('0xa')]('/',auth[_0x1f8b('0x6')](),controller[_0x1f8b('0xb')]);router[_0x1f8b('0xc')](_0x1f8b('0x8'),auth[_0x1f8b('0x6')](),controller[_0x1f8b('0xd')]);router[_0x1f8b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1f8b('0xf')]);module[_0x1f8b('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index aedf54b..2c1dbba 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 _0xaf34=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xaf34,0x186));var _0x4af3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xaf34[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');module[_0x4af3('0x0')]={'priority':{'type':Sequelize[_0x4af3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4af3('0x2')],'allowNull':![],'defaultValue':_0x4af3('0x3')},'appdata':{'type':Sequelize[_0x4af3('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4af3('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2198=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x46a3ee,_0x1ae0e0){var _0x46e610=function(_0x4adcfc){while(--_0x4adcfc){_0x46a3ee['push'](_0x46a3ee['shift']());}};_0x46e610(++_0x1ae0e0);}(_0x2198,0x188));var _0x8219=function(_0xb0fd83,_0x2e8db2){_0xb0fd83=_0xb0fd83-0x0;var _0x1a38a4=_0x2198[_0xb0fd83];return _0x1a38a4;};'use strict';var Sequelize=require(_0x8219('0x0'));module[_0x8219('0x1')]={'priority':{'type':Sequelize[_0x8219('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8219('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8219('0x4')]()},'description':{'type':Sequelize[_0x8219('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8219('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 6a6b7a5..dfb96ed 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 _0x60e9=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','save','destroy','end','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','then','catch','update','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','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'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0x60e9,0x187));var _0x960e=function(_0x3d320d,_0x3938f9){_0x3d320d=_0x3d320d-0x0;var _0x4214af=_0x60e9[_0x3d320d];return _0x4214af;};'use strict';var pdf=require(_0x960e('0x0'));var emlformat=require(_0x960e('0x1'));var rimraf=require(_0x960e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x960e('0x3'));var rp=require(_0x960e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x960e('0x5'));var sox=require(_0x960e('0x6'));var csv=require(_0x960e('0x7'));var ejs=require(_0x960e('0x8'));var fs=require('fs');var _=require(_0x960e('0x9'));var squel=require(_0x960e('0xa'));var crypto=require(_0x960e('0xb'));var jsforce=require(_0x960e('0xc'));var deskjs=require(_0x960e('0xd'));var toCsv=require(_0x960e('0x7'));var querystring=require(_0x960e('0xe'));var Papa=require(_0x960e('0xf'));var Redis=require(_0x960e('0x10'));var authService=require(_0x960e('0x11'));var qs=require(_0x960e('0x12'));var as=require(_0x960e('0x13'));var hardwareService=require(_0x960e('0x14'));var logger=require(_0x960e('0x15'))('api');var utils=require(_0x960e('0x16'));var config=require(_0x960e('0x17'));var db=require(_0x960e('0x18'))['db'];function respondWithStatusCode(_0x20a9c9,_0x3da2d2){_0x3da2d2=_0x3da2d2||0xcc;return function(_0x4a16f6){if(_0x4a16f6){return _0x20a9c9[_0x960e('0x19')](_0x3da2d2);}return _0x20a9c9[_0x960e('0x1a')](_0x3da2d2)['end']();};}function respondWithResult(_0x45a9b5,_0x18daac){_0x18daac=_0x18daac||0xc8;return function(_0x1df158){if(_0x1df158){return _0x45a9b5[_0x960e('0x1a')](_0x18daac)[_0x960e('0x1b')](_0x1df158);}};}function respondWithFilteredResult(_0x5010e4,_0x588102){return function(_0x216eba){if(_0x216eba){var _0x4d4035=_0x216eba['count'],_0x4b2f65=_0x588102[_0x960e('0x1c')],_0x376685=_0x588102[_0x960e('0x1c')]+_0x588102[_0x960e('0x1d')],_0xbd986;if(_0x376685>=_0x4d4035){_0x376685=_0x4d4035;_0xbd986=0xc8;}else{_0xbd986=0xce;}_0x5010e4[_0x960e('0x1a')](_0xbd986);return _0x5010e4['set']('Content-Range',_0x4b2f65+'-'+_0x376685+'/'+_0x4d4035)[_0x960e('0x1b')](_0x216eba);}return null;};}function patchUpdates(_0x2d369c){return function(_0x1ea8a2){try{jsonpatch[_0x960e('0x1e')](_0x1ea8a2,_0x2d369c,!![]);}catch(_0x21f1ed){return BPromise[_0x960e('0x1f')](_0x21f1ed);}return _0x1ea8a2[_0x960e('0x20')]();};}function saveUpdates(_0x38f6d3,_0x9835da){return function(_0x4fc22b){if(_0x4fc22b){return _0x4fc22b['update'](_0x38f6d3)['then'](function(_0xb02675){return _0xb02675;});}return null;};}function removeEntity(_0x2d2f7b,_0x1bc2aa){return function(_0x19b237){if(_0x19b237){return _0x19b237[_0x960e('0x21')]()['then'](function(){_0x2d2f7b[_0x960e('0x1a')](0xcc)[_0x960e('0x22')]();});}};}function handleEntityNotFound(_0xcab87a,_0x5aadd4){return function(_0x36a6ab){if(!_0x36a6ab){_0xcab87a[_0x960e('0x19')](0x194);}return _0x36a6ab;};}function handleError(_0x4a6c2d,_0x463f49){_0x463f49=_0x463f49||0x1f4;return function(_0x8c1425){logger['error'](_0x8c1425[_0x960e('0x23')]);if(_0x8c1425[_0x960e('0x24')]){delete _0x8c1425[_0x960e('0x24')];}_0x4a6c2d[_0x960e('0x1a')](_0x463f49)[_0x960e('0x25')](_0x8c1425);};}exports[_0x960e('0x26')]=function(_0x513a1c,_0xb0d110){var _0x56f27c={'raw':!![],'where':{'id':_0x513a1c[_0x960e('0x27')]['id']}},_0x1716f5={};_0x1716f5['model']=_[_0x960e('0x28')](db[_0x960e('0x29')][_0x960e('0x2a')]);_0x1716f5[_0x960e('0x2b')]=_[_0x960e('0x28')](_0x513a1c[_0x960e('0x2b')]);_0x1716f5[_0x960e('0x2c')]=_[_0x960e('0x2d')](_0x1716f5['model'],_0x1716f5[_0x960e('0x2b')]);_0x56f27c['attributes']=_[_0x960e('0x2d')](_0x1716f5[_0x960e('0x2e')],qs[_0x960e('0x2f')](_0x513a1c[_0x960e('0x2b')][_0x960e('0x2f')]));_0x56f27c[_0x960e('0x30')]=_0x56f27c['attributes'][_0x960e('0x31')]?_0x56f27c[_0x960e('0x30')]:_0x1716f5[_0x960e('0x2e')];if(_0x513a1c[_0x960e('0x2b')][_0x960e('0x32')]){_0x56f27c[_0x960e('0x33')]=[{'all':!![]}];}_0x56f27c=_[_0x960e('0x34')]({},_0x56f27c,_0x513a1c[_0x960e('0x35')]);return db[_0x960e('0x29')]['find'](_0x56f27c)['then'](handleEntityNotFound(_0xb0d110,null))[_0x960e('0x36')](respondWithResult(_0xb0d110,null))[_0x960e('0x37')](handleError(_0xb0d110,null));};exports[_0x960e('0x38')]=function(_0x9275f4,_0x34e7fb){if(_0x9275f4[_0x960e('0x39')]['id']){delete _0x9275f4['body']['id'];}return db[_0x960e('0x29')][_0x960e('0x3a')]({'where':{'id':_0x9275f4['params']['id']}})['then'](handleEntityNotFound(_0x34e7fb,null))['then'](saveUpdates(_0x9275f4[_0x960e('0x39')],null))[_0x960e('0x36')](respondWithResult(_0x34e7fb,null))[_0x960e('0x37')](handleError(_0x34e7fb,null));};exports[_0x960e('0x21')]=function(_0x19eb61,_0x2c2512){return db[_0x960e('0x29')]['find']({'where':{'id':_0x19eb61[_0x960e('0x27')]['id']}})['then'](handleEntityNotFound(_0x2c2512,null))['then'](removeEntity(_0x2c2512,null))[_0x960e('0x37')](handleError(_0x2c2512,null));}; \ No newline at end of file +var _0xad67=['body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xad67,0x147));var _0x7ad6=function(_0x1793e7,_0x4cba8a){_0x1793e7=_0x1793e7-0x0;var _0x3b5854=_0xad67[_0x1793e7];return _0x3b5854;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ad6('0x0'));var rimraf=require(_0x7ad6('0x1'));var zipdir=require(_0x7ad6('0x2'));var jsonpatch=require(_0x7ad6('0x3'));var rp=require(_0x7ad6('0x4'));var moment=require(_0x7ad6('0x5'));var BPromise=require(_0x7ad6('0x6'));var Mustache=require('mustache');var util=require(_0x7ad6('0x7'));var path=require('path');var sox=require(_0x7ad6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ad6('0x9'));var squel=require(_0x7ad6('0xa'));var crypto=require(_0x7ad6('0xb'));var jsforce=require(_0x7ad6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7ad6('0xd'));var Papa=require(_0x7ad6('0xe'));var Redis=require(_0x7ad6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7ad6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad6('0x11'));var logger=require('../../config/logger')(_0x7ad6('0x12'));var utils=require(_0x7ad6('0x13'));var config=require(_0x7ad6('0x14'));var db=require(_0x7ad6('0x15'))['db'];function respondWithStatusCode(_0x2961de,_0x42aeb6){_0x42aeb6=_0x42aeb6||0xcc;return function(_0x57a3ea){if(_0x57a3ea){return _0x2961de[_0x7ad6('0x16')](_0x42aeb6);}return _0x2961de[_0x7ad6('0x17')](_0x42aeb6)['end']();};}function respondWithResult(_0x1e9c93,_0x169714){_0x169714=_0x169714||0xc8;return function(_0x48f1c5){if(_0x48f1c5){return _0x1e9c93[_0x7ad6('0x17')](_0x169714)[_0x7ad6('0x18')](_0x48f1c5);}};}function respondWithFilteredResult(_0x2721ce,_0x3db9bc){return function(_0x5e3c1a){if(_0x5e3c1a){var _0x32073a=_0x5e3c1a[_0x7ad6('0x19')],_0x588753=_0x3db9bc['offset'],_0x127b41=_0x3db9bc['offset']+_0x3db9bc[_0x7ad6('0x1a')],_0x2f2c6c;if(_0x127b41>=_0x32073a){_0x127b41=_0x32073a;_0x2f2c6c=0xc8;}else{_0x2f2c6c=0xce;}_0x2721ce[_0x7ad6('0x17')](_0x2f2c6c);return _0x2721ce[_0x7ad6('0x1b')](_0x7ad6('0x1c'),_0x588753+'-'+_0x127b41+'/'+_0x32073a)[_0x7ad6('0x18')](_0x5e3c1a);}return null;};}function patchUpdates(_0x10d6ee){return function(_0x34ad6d){try{jsonpatch[_0x7ad6('0x1d')](_0x34ad6d,_0x10d6ee,!![]);}catch(_0x2c3a65){return BPromise['reject'](_0x2c3a65);}return _0x34ad6d[_0x7ad6('0x1e')]();};}function saveUpdates(_0x237614,_0x5c7fc2){return function(_0x1e0e7b){if(_0x1e0e7b){return _0x1e0e7b[_0x7ad6('0x1f')](_0x237614)[_0x7ad6('0x20')](function(_0x4870f0){return _0x4870f0;});}return null;};}function removeEntity(_0x3a6b4b,_0x3705a7){return function(_0x20f90d){if(_0x20f90d){return _0x20f90d[_0x7ad6('0x21')]()[_0x7ad6('0x20')](function(){_0x3a6b4b[_0x7ad6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f7601,_0x5d116d){return function(_0x3491a4){if(!_0x3491a4){_0x3f7601[_0x7ad6('0x16')](0x194);}return _0x3491a4;};}function handleError(_0x31bb62,_0xb4ab5b){_0xb4ab5b=_0xb4ab5b||0x1f4;return function(_0x2f7496){logger[_0x7ad6('0x22')](_0x2f7496[_0x7ad6('0x23')]);if(_0x2f7496[_0x7ad6('0x24')]){delete _0x2f7496['name'];}_0x31bb62[_0x7ad6('0x17')](_0xb4ab5b)[_0x7ad6('0x25')](_0x2f7496);};}exports[_0x7ad6('0x26')]=function(_0x4bc147,_0x266b0f){var _0x1d50c7={'raw':!![],'where':{'id':_0x4bc147['params']['id']}},_0x57bf96={};_0x57bf96[_0x7ad6('0x27')]=_[_0x7ad6('0x28')](db[_0x7ad6('0x29')]['rawAttributes']);_0x57bf96[_0x7ad6('0x2a')]=_[_0x7ad6('0x28')](_0x4bc147[_0x7ad6('0x2a')]);_0x57bf96[_0x7ad6('0x2b')]=_[_0x7ad6('0x2c')](_0x57bf96[_0x7ad6('0x27')],_0x57bf96[_0x7ad6('0x2a')]);_0x1d50c7[_0x7ad6('0x2d')]=_[_0x7ad6('0x2c')](_0x57bf96[_0x7ad6('0x27')],qs[_0x7ad6('0x2e')](_0x4bc147[_0x7ad6('0x2a')]['fields']));_0x1d50c7[_0x7ad6('0x2d')]=_0x1d50c7[_0x7ad6('0x2d')][_0x7ad6('0x2f')]?_0x1d50c7[_0x7ad6('0x2d')]:_0x57bf96[_0x7ad6('0x27')];if(_0x4bc147[_0x7ad6('0x2a')][_0x7ad6('0x30')]){_0x1d50c7[_0x7ad6('0x31')]=[{'all':!![]}];}_0x1d50c7=_[_0x7ad6('0x32')]({},_0x1d50c7,_0x4bc147['options']);return db[_0x7ad6('0x29')]['find'](_0x1d50c7)[_0x7ad6('0x20')](handleEntityNotFound(_0x266b0f,null))[_0x7ad6('0x20')](respondWithResult(_0x266b0f,null))['catch'](handleError(_0x266b0f,null));};exports[_0x7ad6('0x1f')]=function(_0x34def2,_0x1d933f){if(_0x34def2[_0x7ad6('0x33')]['id']){delete _0x34def2[_0x7ad6('0x33')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x34def2['params']['id']}})['then'](handleEntityNotFound(_0x1d933f,null))[_0x7ad6('0x20')](saveUpdates(_0x34def2[_0x7ad6('0x33')],null))[_0x7ad6('0x20')](respondWithResult(_0x1d933f,null))['catch'](handleError(_0x1d933f,null));};exports[_0x7ad6('0x21')]=function(_0x33bcdb,_0x374b46){return db['ChatApplication'][_0x7ad6('0x34')]({'where':{'id':_0x33bcdb['params']['id']}})['then'](handleEntityNotFound(_0x374b46,null))['then'](removeEntity(_0x374b46,null))[_0x7ad6('0x35')](handleError(_0x374b46,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8fb9a46..5de0f04 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 _0xfd1f=['ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x395475,_0x5bf249){var _0x56e73d=function(_0x13add8){while(--_0x13add8){_0x395475['push'](_0x395475['shift']());}};_0x56e73d(++_0x5bf249);}(_0xfd1f,0x128));var _0xffd1=function(_0x14bcbe,_0x52c886){_0x14bcbe=_0x14bcbe-0x0;var _0x4b5ad0=_0xfd1f[_0x14bcbe];return _0x4b5ad0;};'use strict';var _=require(_0xffd1('0x0'));var util=require(_0xffd1('0x1'));var logger=require(_0xffd1('0x2'))(_0xffd1('0x3'));var moment=require(_0xffd1('0x4'));var BPromise=require(_0xffd1('0x5'));var rp=require(_0xffd1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffd1('0x7'));var config=require(_0xffd1('0x8'));var attributes=require(_0xffd1('0x9'));module[_0xffd1('0xa')]=function(_0x5545b6,_0x1a0298){return _0x5545b6[_0xffd1('0xb')](_0xffd1('0xc'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xffd1('0xd')});}; \ No newline at end of file +var _0xbdd0=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatApplication.attributes','exports','chat_applications'];(function(_0x53e8c1,_0x1a6586){var _0x416748=function(_0x37e018){while(--_0x37e018){_0x53e8c1['push'](_0x53e8c1['shift']());}};_0x416748(++_0x1a6586);}(_0xbdd0,0x1a6));var _0x0bdd=function(_0x1e8071,_0x54cb69){_0x1e8071=_0x1e8071-0x0;var _0x191472=_0xbdd0[_0x1e8071];return _0x191472;};'use strict';var _=require(_0x0bdd('0x0'));var util=require(_0x0bdd('0x1'));var logger=require(_0x0bdd('0x2'))('api');var moment=require(_0x0bdd('0x3'));var BPromise=require(_0x0bdd('0x4'));var rp=require(_0x0bdd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0bdd('0x6'));var attributes=require(_0x0bdd('0x7'));module[_0x0bdd('0x8')]=function(_0x4ff739,_0x16bffb){return _0x4ff739['define']('ChatApplication',attributes,{'tableName':_0x0bdd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0bdd('0xa'),'collate':_0x0bdd('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 274efba..e4380c7 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 _0xe763=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x253c14,_0x490bcd){var _0x19f8b2=function(_0x3f9393){while(--_0x3f9393){_0x253c14['push'](_0x253c14['shift']());}};_0x19f8b2(++_0x490bcd);}(_0xe763,0x1ba));var _0x3e76=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0xe763[_0x1e8c4e];return _0x19088a;};'use strict';var _=require(_0x3e76('0x0'));var util=require(_0x3e76('0x1'));var moment=require(_0x3e76('0x2'));var BPromise=require(_0x3e76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e76('0x4'));var db=require(_0x3e76('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e76('0x6'));var config=require(_0x3e76('0x7'));var jayson=require(_0x3e76('0x8'));var client=jayson[_0x3e76('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae27e,_0x10fa39,_0x5561cc){return new BPromise(function(_0x67179b,_0x3ef688){return client['request'](_0x3ae27e,_0x5561cc)[_0x3e76('0xa')](function(_0x423c8c){logger[_0x3e76('0xb')](_0x3e76('0xc'),_0x10fa39,_0x3e76('0xd'));logger[_0x3e76('0xe')](_0x3e76('0xf'),_0x10fa39,_0x3e76('0xd'),JSON[_0x3e76('0x10')](_0x423c8c));if(_0x423c8c[_0x3e76('0x11')]){if(_0x423c8c['error'][_0x3e76('0x12')]===0x1f4){logger['error'](_0x3e76('0xc'),_0x10fa39,_0x423c8c[_0x3e76('0x11')][_0x3e76('0x13')]);return _0x3ef688(_0x423c8c[_0x3e76('0x11')][_0x3e76('0x13')]);}logger[_0x3e76('0x11')](_0x3e76('0xc'),_0x10fa39,_0x423c8c[_0x3e76('0x11')][_0x3e76('0x13')]);return _0x67179b(_0x423c8c[_0x3e76('0x11')][_0x3e76('0x13')]);}else{logger[_0x3e76('0xb')](_0x3e76('0xc'),_0x10fa39,_0x3e76('0xd'));_0x67179b(_0x423c8c[_0x3e76('0x14')]['message']);}})[_0x3e76('0x15')](function(_0x194c92){logger[_0x3e76('0x11')](_0x3e76('0xc'),_0x10fa39,_0x194c92);_0x3ef688(_0x194c92);});});} \ No newline at end of file +var _0x0197=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2f7aee,_0x3f5ecb){var _0x872ff8=function(_0x500efe){while(--_0x500efe){_0x2f7aee['push'](_0x2f7aee['shift']());}};_0x872ff8(++_0x3f5ecb);}(_0x0197,0x1a9));var _0x7019=function(_0x132eb1,_0x468eec){_0x132eb1=_0x132eb1-0x0;var _0x7ca294=_0x0197[_0x132eb1];return _0x7ca294;};'use strict';var _=require(_0x7019('0x0'));var util=require(_0x7019('0x1'));var moment=require('moment');var BPromise=require(_0x7019('0x2'));var rs=require(_0x7019('0x3'));var fs=require('fs');var Redis=require(_0x7019('0x4'));var db=require(_0x7019('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7019('0x6'));var config=require(_0x7019('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7019('0x8')][_0x7019('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3643c0,_0x457100,_0x56c27d){return new BPromise(function(_0x1ed834,_0x6b65c5){return client[_0x7019('0xa')](_0x3643c0,_0x56c27d)['then'](function(_0x23350f){logger[_0x7019('0xb')](_0x7019('0xc'),_0x457100,_0x7019('0xd'));logger[_0x7019('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x457100,'request\x20sent',JSON[_0x7019('0xf')](_0x23350f));if(_0x23350f[_0x7019('0x10')]){if(_0x23350f[_0x7019('0x10')][_0x7019('0x11')]===0x1f4){logger['error'](_0x7019('0xc'),_0x457100,_0x23350f[_0x7019('0x10')][_0x7019('0x12')]);return _0x6b65c5(_0x23350f[_0x7019('0x10')][_0x7019('0x12')]);}logger[_0x7019('0x10')](_0x7019('0xc'),_0x457100,_0x23350f[_0x7019('0x10')]['message']);return _0x1ed834(_0x23350f[_0x7019('0x10')][_0x7019('0x12')]);}else{logger[_0x7019('0xb')](_0x7019('0xc'),_0x457100,'request\x20sent');_0x1ed834(_0x23350f[_0x7019('0x13')]['message']);}})[_0x7019('0x14')](function(_0x3fbdc){logger[_0x7019('0x10')](_0x7019('0xc'),_0x457100,_0x3fbdc);_0x6b65c5(_0x3fbdc);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b2b1e63..9ea7eec 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 _0x96ef=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','show','put','/:id','isAuthenticated','delete','destroy','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x96ef,0xa0));var _0xf96e=function(_0x1b5e32,_0x15e315){_0x1b5e32=_0x1b5e32-0x0;var _0x4edc58=_0x96ef[_0x1b5e32];return _0x4edc58;};'use strict';var multer=require(_0xf96e('0x0'));var util=require(_0xf96e('0x1'));var path=require(_0xf96e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf96e('0x3'));var router=express[_0xf96e('0x4')]();var auth=require(_0xf96e('0x5'));var interaction=require(_0xf96e('0x6'));var config=require('../../config/environment');var controller=require(_0xf96e('0x7'));router[_0xf96e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf96e('0x9')]);router[_0xf96e('0xa')](_0xf96e('0xb'),auth[_0xf96e('0xc')](),controller['update']);router[_0xf96e('0xd')](_0xf96e('0xb'),auth[_0xf96e('0xc')](),controller[_0xf96e('0xe')]);module[_0xf96e('0xf')]=router; \ No newline at end of file +var _0x9b13=['exports','multer','util','connect-timeout','express','Router','./chatApplication.controller','get','/:id','isAuthenticated','update','delete','destroy'];(function(_0x25da2d,_0x24d542){var _0x2ca8cc=function(_0x2839b0){while(--_0x2839b0){_0x25da2d['push'](_0x25da2d['shift']());}};_0x2ca8cc(++_0x24d542);}(_0x9b13,0x187));var _0x39b1=function(_0x53c982,_0x22655d){_0x53c982=_0x53c982-0x0;var _0x1cb3c0=_0x9b13[_0x53c982];return _0x1cb3c0;};'use strict';var multer=require(_0x39b1('0x0'));var util=require(_0x39b1('0x1'));var path=require('path');var timeout=require(_0x39b1('0x2'));var express=require(_0x39b1('0x3'));var router=express[_0x39b1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39b1('0x5'));router[_0x39b1('0x6')](_0x39b1('0x7'),auth[_0x39b1('0x8')](),controller['show']);router['put'](_0x39b1('0x7'),auth[_0x39b1('0x8')](),controller[_0x39b1('0x9')]);router[_0x39b1('0xa')](_0x39b1('0x7'),auth[_0x39b1('0x8')](),controller[_0x39b1('0xb')]);module[_0x39b1('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 67b1a0b..2bd82f1 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 _0xecf4=['exports','STRING','BOOLEAN','sequelize'];(function(_0x72f80e,_0x5ed6fc){var _0x35a36b=function(_0x40b6c0){while(--_0x40b6c0){_0x72f80e['push'](_0x72f80e['shift']());}};_0x35a36b(++_0x5ed6fc);}(_0xecf4,0xbf));var _0x4ecf=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0xecf4[_0x695b76];return _0x1dc21f;};'use strict';var Sequelize=require(_0x4ecf('0x0'));module[_0x4ecf('0x1')]={'name':{'type':Sequelize[_0x4ecf('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4ecf('0x2')]},'write':{'type':Sequelize[_0x4ecf('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xce28=['sequelize','exports','STRING','BOOLEAN'];(function(_0x583c99,_0x30f9c3){var _0x43f572=function(_0x5804a7){while(--_0x5804a7){_0x583c99['push'](_0x583c99['shift']());}};_0x43f572(++_0x30f9c3);}(_0xce28,0x148));var _0x8ce2=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xce28[_0x26f702];return _0x11417d;};'use strict';var Sequelize=require(_0x8ce2('0x0'));module[_0x8ce2('0x1')]={'name':{'type':Sequelize[_0x8ce2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ce2('0x2')]},'write':{'type':Sequelize[_0x8ce2('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 8aad81d..04d3426 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 _0x5d57=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','destroy','end','stack','name','send','index','map','ChatGroup','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','options','removeMembers','addMessage','getMessages','pick','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x1f7420,_0x46922d){var _0x5574ac=function(_0x48f0e4){while(--_0x48f0e4){_0x1f7420['push'](_0x1f7420['shift']());}};_0x5574ac(++_0x46922d);}(_0x5d57,0x1b4));var _0x75d5=function(_0x2d110d,_0x163b61){_0x2d110d=_0x2d110d-0x0;var _0x643c91=_0x5d57[_0x2d110d];return _0x643c91;};'use strict';var pdf=require(_0x75d5('0x0'));var emlformat=require(_0x75d5('0x1'));var rimraf=require(_0x75d5('0x2'));var zipdir=require(_0x75d5('0x3'));var jsonpatch=require(_0x75d5('0x4'));var rp=require('request-promise');var moment=require(_0x75d5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75d5('0x6'));var util=require(_0x75d5('0x7'));var path=require(_0x75d5('0x8'));var sox=require(_0x75d5('0x9'));var csv=require(_0x75d5('0xa'));var ejs=require(_0x75d5('0xb'));var fs=require('fs');var _=require(_0x75d5('0xc'));var squel=require(_0x75d5('0xd'));var crypto=require(_0x75d5('0xe'));var jsforce=require(_0x75d5('0xf'));var deskjs=require(_0x75d5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x75d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x75d5('0x12'));var authService=require(_0x75d5('0x13'));var qs=require(_0x75d5('0x14'));var as=require(_0x75d5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x75d5('0x16'));var utils=require(_0x75d5('0x17'));var config=require(_0x75d5('0x18'));var db=require(_0x75d5('0x19'))['db'];config[_0x75d5('0x1a')]=_[_0x75d5('0x1b')](config[_0x75d5('0x1a')],{'host':_0x75d5('0x1c'),'port':0x18eb});var socket=require(_0x75d5('0x1d'))(new Redis(config[_0x75d5('0x1a')]));require(_0x75d5('0x1e'))[_0x75d5('0x1f')](socket);var jayson=require(_0x75d5('0x20'));var client=jayson[_0x75d5('0x21')][_0x75d5('0x22')]({'port':0x232a});function checkPasswordPattern(_0x5511e9,_0xcc513d,_0x52007c){if(_0x52007c){var _0x10fa48=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10fa48['test'](_0xcc513d)){return _0x5511e9;}else{throw new db['Sequelize'][(_0x75d5('0x23'))](_0x75d5('0x24'));}}else{return _0x5511e9;}}function respondWithRpcPromise(_0x2eb867,_0x2bed4f,_0x496628,_0xbba0dc){return new BPromise(function(_0x277aae,_0x236a23){var _0x4f4a23=_0xbba0dc||client;return _0x4f4a23[_0x75d5('0x25')](_0x2eb867,_0x496628)[_0x75d5('0x26')](function(_0x242e74){logger[_0x75d5('0x27')](_0x75d5('0x28'),_0x2bed4f,_0x75d5('0x29'));logger[_0x75d5('0x2a')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2bed4f,_0x75d5('0x29'),JSON[_0x75d5('0x2b')](_0x242e74));if(_0x242e74[_0x75d5('0x2c')]){if(_0x242e74[_0x75d5('0x2c')][_0x75d5('0x2d')]===0x1f4){logger[_0x75d5('0x2c')](_0x75d5('0x28'),_0x2bed4f,_0x242e74[_0x75d5('0x2c')][_0x75d5('0x2e')]);return _0x236a23(_0x242e74[_0x75d5('0x2c')][_0x75d5('0x2e')]);}logger[_0x75d5('0x2c')](_0x75d5('0x28'),_0x2bed4f,_0x242e74[_0x75d5('0x2c')][_0x75d5('0x2e')]);return _0x277aae(_0x242e74[_0x75d5('0x2c')]['message']);}else{logger['info'](_0x75d5('0x28'),_0x2bed4f,_0x75d5('0x29'));_0x277aae(_0x242e74['result'][_0x75d5('0x2e')]);}})[_0x75d5('0x2f')](function(_0x40ee0b){logger['error'](_0x75d5('0x28'),_0x2bed4f,_0x40ee0b);_0x236a23(_0x40ee0b);});});}function respondWithStatusCode(_0x1f7665,_0xed456c){_0xed456c=_0xed456c||0xcc;return function(_0x108a1b){if(_0x108a1b){return _0x1f7665[_0x75d5('0x30')](_0xed456c);}return _0x1f7665[_0x75d5('0x31')](_0xed456c)['end']();};}function respondWithResult(_0x6ae8fa,_0x36085b){_0x36085b=_0x36085b||0xc8;return function(_0x49d7de){if(_0x49d7de){return _0x6ae8fa[_0x75d5('0x31')](_0x36085b)[_0x75d5('0x32')](_0x49d7de);}};}function respondWithFilteredResult(_0xe336ef,_0x51131a){return function(_0x3a949d){if(_0x3a949d){var _0x22a7d9=_0x3a949d[_0x75d5('0x33')],_0x30d6be=_0x51131a[_0x75d5('0x34')],_0x1ced01=_0x51131a[_0x75d5('0x34')]+_0x51131a[_0x75d5('0x35')],_0x58b447;if(_0x1ced01>=_0x22a7d9){_0x1ced01=_0x22a7d9;_0x58b447=0xc8;}else{_0x58b447=0xce;}_0xe336ef['status'](_0x58b447);return _0xe336ef[_0x75d5('0x36')]('Content-Range',_0x30d6be+'-'+_0x1ced01+'/'+_0x22a7d9)[_0x75d5('0x32')](_0x3a949d);}return null;};}function patchUpdates(_0xa9640c){return function(_0x56f1ba){try{jsonpatch[_0x75d5('0x37')](_0x56f1ba,_0xa9640c,!![]);}catch(_0x4e8076){return BPromise[_0x75d5('0x38')](_0x4e8076);}return _0x56f1ba[_0x75d5('0x39')]();};}function saveUpdates(_0x354390,_0x1ab555){return function(_0x13554d){if(_0x13554d){return _0x13554d['update'](_0x354390)['then'](function(_0x4894c8){return _0x4894c8;});}return null;};}function removeEntity(_0x409405,_0x398044){return function(_0x4c4816){if(_0x4c4816){return _0x4c4816[_0x75d5('0x3a')]()[_0x75d5('0x26')](function(){_0x409405['status'](0xcc)[_0x75d5('0x3b')]();});}};}function handleEntityNotFound(_0x3441b9,_0x26ca22){return function(_0x11465c){if(!_0x11465c){_0x3441b9[_0x75d5('0x30')](0x194);}return _0x11465c;};}function handleError(_0x514357,_0x19d360){_0x19d360=_0x19d360||0x1f4;return function(_0x43799b){logger[_0x75d5('0x2c')](_0x43799b[_0x75d5('0x3c')]);if(_0x43799b[_0x75d5('0x3d')]){delete _0x43799b[_0x75d5('0x3d')];}_0x514357[_0x75d5('0x31')](_0x19d360)[_0x75d5('0x3e')](_0x43799b);};}exports[_0x75d5('0x3f')]=function(_0x2bd9b4,_0x1fa85d){var _0x53832e={},_0x145c6e={},_0x3b0f15={'count':0x0,'rows':[]};var _0x1c3770=_[_0x75d5('0x40')](db[_0x75d5('0x41')][_0x75d5('0x42')],function(_0x1ffe67){return{'name':_0x1ffe67['fieldName'],'type':_0x1ffe67['type'][_0x75d5('0x43')]};});_0x145c6e[_0x75d5('0x44')]=_[_0x75d5('0x40')](_0x1c3770,_0x75d5('0x3d'));_0x145c6e[_0x75d5('0x45')]=_[_0x75d5('0x46')](_0x2bd9b4[_0x75d5('0x45')]);_0x145c6e[_0x75d5('0x47')]=_['intersection'](_0x145c6e[_0x75d5('0x44')],_0x145c6e[_0x75d5('0x45')]);_0x53832e[_0x75d5('0x48')]=_[_0x75d5('0x49')](_0x145c6e['model'],qs['fields'](_0x2bd9b4[_0x75d5('0x45')][_0x75d5('0x4a')]));_0x53832e['attributes']=_0x53832e[_0x75d5('0x48')][_0x75d5('0x4b')]?_0x53832e[_0x75d5('0x48')]:_0x145c6e[_0x75d5('0x44')];if(!_0x2bd9b4[_0x75d5('0x45')][_0x75d5('0x4c')](_0x75d5('0x4d'))){_0x53832e['limit']=qs[_0x75d5('0x35')](_0x2bd9b4['query']['limit']);_0x53832e[_0x75d5('0x34')]=qs[_0x75d5('0x34')](_0x2bd9b4[_0x75d5('0x45')]['offset']);}_0x53832e['order']=qs[_0x75d5('0x4e')](_0x2bd9b4[_0x75d5('0x45')]['sort']);_0x53832e[_0x75d5('0x4f')]=qs[_0x75d5('0x47')](_['pick'](_0x2bd9b4['query'],_0x145c6e['filters']),_0x1c3770);if(_0x2bd9b4[_0x75d5('0x45')][_0x75d5('0x50')]){_0x53832e['where']=_[_0x75d5('0x51')](_0x53832e[_0x75d5('0x4f')],{'$or':_[_0x75d5('0x40')](_0x1c3770,function(_0x3c862d){if(_0x3c862d[_0x75d5('0x52')]!==_0x75d5('0x53')){var _0x1087a6={};_0x1087a6[_0x3c862d[_0x75d5('0x3d')]]={'$like':'%'+_0x2bd9b4[_0x75d5('0x45')]['filter']+'%'};return _0x1087a6;}})});}_0x53832e=_[_0x75d5('0x51')]({},_0x53832e,_0x2bd9b4['options']);var _0x44c9fb={'where':_0x53832e['where']};return db[_0x75d5('0x41')][_0x75d5('0x33')](_0x44c9fb)[_0x75d5('0x26')](function(_0x5b58ce){_0x3b0f15[_0x75d5('0x33')]=_0x5b58ce;if(_0x2bd9b4['query'][_0x75d5('0x54')]){_0x53832e[_0x75d5('0x55')]=[{'all':!![]}];}return db[_0x75d5('0x41')][_0x75d5('0x56')](_0x53832e);})[_0x75d5('0x26')](function(_0x5ed754){_0x3b0f15[_0x75d5('0x57')]=_0x5ed754;return _0x3b0f15;})['then'](respondWithFilteredResult(_0x1fa85d,_0x53832e))[_0x75d5('0x2f')](handleError(_0x1fa85d,null));};exports[_0x75d5('0x58')]=function(_0x372cfb,_0x22765e){var _0x3787d4={'raw':!![],'where':{'id':_0x372cfb[_0x75d5('0x59')]['id']}},_0x358613={};_0x358613[_0x75d5('0x44')]=_[_0x75d5('0x46')](db[_0x75d5('0x41')][_0x75d5('0x42')]);_0x358613[_0x75d5('0x45')]=_[_0x75d5('0x46')](_0x372cfb[_0x75d5('0x45')]);_0x358613['filters']=_[_0x75d5('0x49')](_0x358613[_0x75d5('0x44')],_0x358613[_0x75d5('0x45')]);_0x3787d4['attributes']=_[_0x75d5('0x49')](_0x358613['model'],qs[_0x75d5('0x4a')](_0x372cfb[_0x75d5('0x45')][_0x75d5('0x4a')]));_0x3787d4['attributes']=_0x3787d4[_0x75d5('0x48')][_0x75d5('0x4b')]?_0x3787d4[_0x75d5('0x48')]:_0x358613['model'];if(_0x372cfb['query'][_0x75d5('0x54')]){_0x3787d4[_0x75d5('0x55')]=[{'all':!![]}];}_0x3787d4=_[_0x75d5('0x51')]({},_0x3787d4,_0x372cfb['options']);return db[_0x75d5('0x41')]['find'](_0x3787d4)[_0x75d5('0x26')](handleEntityNotFound(_0x22765e,null))[_0x75d5('0x26')](respondWithResult(_0x22765e,null))['catch'](handleError(_0x22765e,null));};exports[_0x75d5('0x5a')]=function(_0xe45544,_0x387852){return db[_0x75d5('0x41')][_0x75d5('0x5a')](_0xe45544[_0x75d5('0x5b')],{})[_0x75d5('0x26')](respondWithResult(_0x387852,0xc9))['catch'](handleError(_0x387852,null));};exports['update']=function(_0x4046e6,_0x52a811){if(_0x4046e6[_0x75d5('0x5b')]['id']){delete _0x4046e6[_0x75d5('0x5b')]['id'];}return db['ChatGroup'][_0x75d5('0x5c')]({'where':{'id':_0x4046e6['params']['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x52a811,null))['then'](saveUpdates(_0x4046e6[_0x75d5('0x5b')],null))['then'](respondWithResult(_0x52a811,null))[_0x75d5('0x2f')](handleError(_0x52a811,null));};exports[_0x75d5('0x3a')]=function(_0x4728ac,_0x5d454b){return db['ChatGroup'][_0x75d5('0x5c')]({'where':{'id':_0x4728ac[_0x75d5('0x59')]['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x5d454b,null))['then'](removeEntity(_0x5d454b,null))[_0x75d5('0x2f')](handleError(_0x5d454b,null));};exports['describe']=function(_0x17a9d1,_0x3883fc){return db[_0x75d5('0x41')][_0x75d5('0x5d')]()['then'](respondWithResult(_0x3883fc,null))['catch'](handleError(_0x3883fc,null));};exports[_0x75d5('0x5e')]=function(_0x1e6c79,_0x29f993,_0x4e2410){return db[_0x75d5('0x5f')]['count']({'where':{'ChatGroupId':_0x1e6c79['params']['id'],'ToId':_0x1e6c79[_0x75d5('0x60')]['id'],'read':![]}})[_0x75d5('0x26')](function(_0x36bf76){return{'id':_[_0x75d5('0x61')](_0x1e6c79[_0x75d5('0x59')]['id']),'count':_0x36bf76};})[_0x75d5('0x26')](respondWithResult(_0x29f993,null))[_0x75d5('0x2f')](handleError(_0x29f993,null));};exports[_0x75d5('0x62')]=function(_0x1daaf5,_0x45aa6e,_0x50f5f4){return db['ChatGroup'][_0x75d5('0x5c')]({'where':{'id':_0x1daaf5[_0x75d5('0x59')]['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x45aa6e,null))['then'](function(_0x4970c2){if(_0x4970c2){return _0x4970c2[_0x75d5('0x62')](_0x1daaf5['body']['ids'],_['omit'](_0x1daaf5[_0x75d5('0x5b')],[_0x75d5('0x63'),'id'])||{});}})[_0x75d5('0x26')](respondWithResult(_0x45aa6e,null))['catch'](handleError(_0x45aa6e,null));};exports[_0x75d5('0x64')]=function(_0x342812,_0x2aa55d,_0x1d8dce){var _0x30a6dd={};var _0x21573d={};var _0x4e7357;var _0x36fc26;return db[_0x75d5('0x41')][_0x75d5('0x65')]({'where':{'id':_0x342812[_0x75d5('0x59')]['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x2aa55d,null))['then'](function(_0x5e93dc){if(_0x5e93dc){_0x4e7357=_0x5e93dc;_0x21573d[_0x75d5('0x44')]=_[_0x75d5('0x46')](db[_0x75d5('0x66')]['rawAttributes']);_0x21573d['query']=_[_0x75d5('0x46')](_0x342812['query']);_0x21573d['filters']=_[_0x75d5('0x49')](_0x21573d[_0x75d5('0x44')],_0x21573d['query']);_0x30a6dd['attributes']=_[_0x75d5('0x49')](_0x21573d[_0x75d5('0x44')],qs[_0x75d5('0x4a')](_0x342812[_0x75d5('0x45')][_0x75d5('0x4a')]));_0x30a6dd['attributes']=_0x30a6dd[_0x75d5('0x48')]['length']?_0x30a6dd[_0x75d5('0x48')]:_0x21573d[_0x75d5('0x44')];_0x30a6dd['order']=qs[_0x75d5('0x4e')](_0x342812[_0x75d5('0x45')][_0x75d5('0x4e')]);_0x30a6dd['where']=qs[_0x75d5('0x47')](_['pick'](_0x342812['query'],_0x21573d[_0x75d5('0x47')]));if(_0x342812['query'][_0x75d5('0x50')]){_0x30a6dd['where']=_[_0x75d5('0x51')](_0x30a6dd[_0x75d5('0x4f')],{'$or':_[_0x75d5('0x40')](_0x30a6dd[_0x75d5('0x48')],function(_0x2416c3){var _0x3e2e99={};_0x3e2e99[_0x2416c3]={'$like':'%'+_0x342812[_0x75d5('0x45')][_0x75d5('0x50')]+'%'};return _0x3e2e99;})});}_0x30a6dd=_[_0x75d5('0x51')]({},_0x30a6dd,_0x342812[_0x75d5('0x67')]);return _0x4e7357[_0x75d5('0x64')](_0x30a6dd);}})[_0x75d5('0x26')](function(_0x414614){if(_0x414614){_0x36fc26=_0x414614[_0x75d5('0x4b')];if(!_0x342812[_0x75d5('0x45')]['hasOwnProperty'](_0x75d5('0x4d'))){_0x30a6dd[_0x75d5('0x35')]=qs[_0x75d5('0x35')](_0x342812[_0x75d5('0x45')][_0x75d5('0x35')]);_0x30a6dd['offset']=qs[_0x75d5('0x34')](_0x342812[_0x75d5('0x45')][_0x75d5('0x34')]);}return _0x4e7357['getMembers'](_0x30a6dd);}})[_0x75d5('0x26')](function(_0x45e0a6){if(_0x45e0a6){return _0x45e0a6?{'count':_0x36fc26,'rows':_0x45e0a6}:null;}})['then'](respondWithResult(_0x2aa55d,null))[_0x75d5('0x2f')](handleError(_0x2aa55d,null));};exports[_0x75d5('0x68')]=function(_0x91648,_0x415ba3,_0x4b6ac3){return db['ChatGroup'][_0x75d5('0x5c')]({'where':{'id':_0x91648[_0x75d5('0x59')]['id']}})['then'](handleEntityNotFound(_0x415ba3,null))['then'](function(_0x3f0878){if(_0x3f0878){return _0x3f0878[_0x75d5('0x68')](_0x91648['query'][_0x75d5('0x63')]);}})[_0x75d5('0x26')](respondWithStatusCode(_0x415ba3,null))['catch'](handleError(_0x415ba3,null));};exports[_0x75d5('0x69')]=function(_0x1ce99a,_0x3abf6b,_0xd71e2d){if(_0x1ce99a['body']['id']){delete _0x1ce99a[_0x75d5('0x5b')]['id'];}return db[_0x75d5('0x41')][_0x75d5('0x5c')]({'where':{'id':_0x1ce99a[_0x75d5('0x59')]['id']}})['then'](handleEntityNotFound(_0x3abf6b,null))[_0x75d5('0x26')](function(_0x2c6f7c){if(_0x2c6f7c){_0x1ce99a['body']['ChatGroupId']=_0x2c6f7c['id'];return db[_0x75d5('0x5f')]['create'](_0x1ce99a[_0x75d5('0x5b')]);}})[_0x75d5('0x26')](respondWithResult(_0x3abf6b,null))['catch'](handleError(_0x3abf6b,null));};exports[_0x75d5('0x6a')]=function(_0x51f99d,_0x42893f,_0x99252b){var _0x55c105={};var _0x19dfa9={};var _0x3505f3;var _0x5c7c63;return db[_0x75d5('0x41')][_0x75d5('0x65')]({'where':{'id':_0x51f99d[_0x75d5('0x59')]['id']}})[_0x75d5('0x26')](handleEntityNotFound(_0x42893f,null))[_0x75d5('0x26')](function(_0xdc8f82){if(_0xdc8f82){_0x3505f3=_0xdc8f82;_0x19dfa9[_0x75d5('0x44')]=_['keys'](db[_0x75d5('0x5f')]['rawAttributes']);_0x19dfa9['query']=_[_0x75d5('0x46')](_0x51f99d[_0x75d5('0x45')]);_0x19dfa9[_0x75d5('0x47')]=_['intersection'](_0x19dfa9['model'],_0x19dfa9['query']);_0x55c105['attributes']=_[_0x75d5('0x49')](_0x19dfa9[_0x75d5('0x44')],qs[_0x75d5('0x4a')](_0x51f99d[_0x75d5('0x45')][_0x75d5('0x4a')]));_0x55c105[_0x75d5('0x48')]=_0x55c105[_0x75d5('0x48')][_0x75d5('0x4b')]?_0x55c105['attributes']:_0x19dfa9[_0x75d5('0x44')];_0x55c105['order']=qs[_0x75d5('0x4e')](_0x51f99d[_0x75d5('0x45')][_0x75d5('0x4e')]);_0x55c105['where']=qs['filters'](_[_0x75d5('0x6b')](_0x51f99d[_0x75d5('0x45')],_0x19dfa9[_0x75d5('0x47')]));if(_0x51f99d[_0x75d5('0x45')]['filter']){_0x55c105[_0x75d5('0x4f')]=_['merge'](_0x55c105[_0x75d5('0x4f')],{'$or':_['map'](_0x55c105[_0x75d5('0x48')],function(_0x2d842f){var _0x50c831={};_0x50c831[_0x2d842f]={'$like':'%'+_0x51f99d[_0x75d5('0x45')][_0x75d5('0x50')]+'%'};return _0x50c831;})});}if(_0x51f99d[_0x75d5('0x45')]['$gte']){var _0x4f70b2=_0x51f99d[_0x75d5('0x45')]['$gte'][_0x75d5('0x6c')](',');var _0x584187={};_0x584187[_0x4f70b2[0x0]]={'$gte':moment(_0x4f70b2[0x1])[_0x75d5('0x6d')](_0x75d5('0x6e'))};_0x55c105[_0x75d5('0x4f')]=_['merge'](_0x55c105[_0x75d5('0x4f')],_0x584187);}_0x55c105=_[_0x75d5('0x51')]({},_0x55c105,_0x51f99d[_0x75d5('0x67')]);return _0x3505f3['getMessages'](_0x55c105);}})[_0x75d5('0x26')](function(_0x45c676){if(_0x45c676){_0x5c7c63=_0x45c676['length'];if(!_0x51f99d[_0x75d5('0x45')][_0x75d5('0x4c')](_0x75d5('0x4d'))){_0x55c105[_0x75d5('0x35')]=qs[_0x75d5('0x35')](_0x51f99d[_0x75d5('0x45')][_0x75d5('0x35')]);_0x55c105[_0x75d5('0x34')]=qs[_0x75d5('0x34')](_0x51f99d[_0x75d5('0x45')][_0x75d5('0x34')]);}return _0x3505f3[_0x75d5('0x6a')](_0x55c105);}})['then'](function(_0x5e3f97){if(_0x5e3f97){return _0x5e3f97?{'count':_0x5c7c63,'rows':_0x5e3f97}:null;}})[_0x75d5('0x26')](respondWithResult(_0x42893f,null))[_0x75d5('0x2f')](handleError(_0x42893f,null));}; \ No newline at end of file +var _0x9f52=['ejs','lodash','squel','crypto','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','redis','localhost','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','removeMembers','ChatGroupId','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox'];(function(_0x45ce4e,_0x3a367c){var _0x4a105a=function(_0x52f8bb){while(--_0x52f8bb){_0x45ce4e['push'](_0x45ce4e['shift']());}};_0x4a105a(++_0x3a367c);}(_0x9f52,0xd2));var _0x29f5=function(_0x37c46b,_0x211aee){_0x37c46b=_0x37c46b-0x0;var _0x1ae8f7=_0x9f52[_0x37c46b];return _0x1ae8f7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29f5('0x2'));var moment=require(_0x29f5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x29f5('0x4'));var util=require(_0x29f5('0x5'));var path=require(_0x29f5('0x6'));var sox=require(_0x29f5('0x7'));var csv=require('to-csv');var ejs=require(_0x29f5('0x8'));var fs=require('fs');var _=require(_0x29f5('0x9'));var squel=require(_0x29f5('0xa'));var crypto=require(_0x29f5('0xb'));var jsforce=require(_0x29f5('0xc'));var deskjs=require(_0x29f5('0xd'));var toCsv=require(_0x29f5('0xe'));var querystring=require(_0x29f5('0xf'));var Papa=require(_0x29f5('0x10'));var Redis=require(_0x29f5('0x11'));var authService=require(_0x29f5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x29f5('0x13'));var hardwareService=require(_0x29f5('0x14'));var logger=require(_0x29f5('0x15'))(_0x29f5('0x16'));var utils=require(_0x29f5('0x17'));var config=require(_0x29f5('0x18'));var db=require(_0x29f5('0x19'))['db'];config[_0x29f5('0x1a')]=_['defaults'](config[_0x29f5('0x1a')],{'host':_0x29f5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29f5('0x1a')]));require('./chatGroup.socket')[_0x29f5('0x1c')](socket);var jayson=require(_0x29f5('0x1d'));var client=jayson[_0x29f5('0x1e')][_0x29f5('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x3804ad,_0x5d38a8,_0xfcf267){if(_0xfcf267){var _0x5768f2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5768f2[_0x29f5('0x20')](_0x5d38a8)){return _0x3804ad;}else{throw new db[(_0x29f5('0x21'))][(_0x29f5('0x22'))](_0x29f5('0x23'));}}else{return _0x3804ad;}}function respondWithRpcPromise(_0xa2f536,_0x2effab,_0x41d1dc,_0x4096f4){return new BPromise(function(_0x149279,_0x459b3c){var _0x19ad07=_0x4096f4||client;return _0x19ad07[_0x29f5('0x24')](_0xa2f536,_0x41d1dc)[_0x29f5('0x25')](function(_0x2e59d3){logger['info'](_0x29f5('0x26'),_0x2effab,_0x29f5('0x27'));logger[_0x29f5('0x28')](_0x29f5('0x29'),_0x2effab,_0x29f5('0x27'),JSON[_0x29f5('0x2a')](_0x2e59d3));if(_0x2e59d3[_0x29f5('0x2b')]){if(_0x2e59d3['error'][_0x29f5('0x2c')]===0x1f4){logger[_0x29f5('0x2b')](_0x29f5('0x26'),_0x2effab,_0x2e59d3['error'][_0x29f5('0x2d')]);return _0x459b3c(_0x2e59d3['error']['message']);}logger[_0x29f5('0x2b')](_0x29f5('0x26'),_0x2effab,_0x2e59d3[_0x29f5('0x2b')][_0x29f5('0x2d')]);return _0x149279(_0x2e59d3[_0x29f5('0x2b')][_0x29f5('0x2d')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x2effab,'request\x20sent');_0x149279(_0x2e59d3['result'][_0x29f5('0x2d')]);}})[_0x29f5('0x2e')](function(_0x229236){logger[_0x29f5('0x2b')](_0x29f5('0x26'),_0x2effab,_0x229236);_0x459b3c(_0x229236);});});}function respondWithStatusCode(_0x30bc6a,_0x405b9a){_0x405b9a=_0x405b9a||0xcc;return function(_0x5a8b75){if(_0x5a8b75){return _0x30bc6a['sendStatus'](_0x405b9a);}return _0x30bc6a[_0x29f5('0x2f')](_0x405b9a)['end']();};}function respondWithResult(_0x5ad4ab,_0xd7d216){_0xd7d216=_0xd7d216||0xc8;return function(_0x5d6f37){if(_0x5d6f37){return _0x5ad4ab[_0x29f5('0x2f')](_0xd7d216)['json'](_0x5d6f37);}};}function respondWithFilteredResult(_0x3e241c,_0x3b25f2){return function(_0x34d46d){if(_0x34d46d){var _0x218c20=_0x34d46d[_0x29f5('0x30')],_0x35548c=_0x3b25f2[_0x29f5('0x31')],_0x32a655=_0x3b25f2[_0x29f5('0x31')]+_0x3b25f2['limit'],_0x254444;if(_0x32a655>=_0x218c20){_0x32a655=_0x218c20;_0x254444=0xc8;}else{_0x254444=0xce;}_0x3e241c[_0x29f5('0x2f')](_0x254444);return _0x3e241c[_0x29f5('0x32')](_0x29f5('0x33'),_0x35548c+'-'+_0x32a655+'/'+_0x218c20)[_0x29f5('0x34')](_0x34d46d);}return null;};}function patchUpdates(_0x5b67ea){return function(_0x5800fb){try{jsonpatch[_0x29f5('0x35')](_0x5800fb,_0x5b67ea,!![]);}catch(_0x394069){return BPromise[_0x29f5('0x36')](_0x394069);}return _0x5800fb[_0x29f5('0x37')]();};}function saveUpdates(_0x566746,_0xc193ef){return function(_0x3cfb46){if(_0x3cfb46){return _0x3cfb46[_0x29f5('0x38')](_0x566746)[_0x29f5('0x25')](function(_0x1451a7){return _0x1451a7;});}return null;};}function removeEntity(_0x557e6e,_0x2d3f33){return function(_0x2f5d62){if(_0x2f5d62){return _0x2f5d62[_0x29f5('0x39')]()[_0x29f5('0x25')](function(){_0x557e6e[_0x29f5('0x2f')](0xcc)[_0x29f5('0x3a')]();});}};}function handleEntityNotFound(_0x174905,_0x3ea822){return function(_0xc3e4a7){if(!_0xc3e4a7){_0x174905['sendStatus'](0x194);}return _0xc3e4a7;};}function handleError(_0x3db514,_0x3d066a){_0x3d066a=_0x3d066a||0x1f4;return function(_0x2f5c7b){logger[_0x29f5('0x2b')](_0x2f5c7b[_0x29f5('0x3b')]);if(_0x2f5c7b['name']){delete _0x2f5c7b[_0x29f5('0x3c')];}_0x3db514[_0x29f5('0x2f')](_0x3d066a)[_0x29f5('0x3d')](_0x2f5c7b);};}exports[_0x29f5('0x3e')]=function(_0xc6939b,_0x17d77f){var _0x303e3c={},_0x30cb26={},_0x13956f={'count':0x0,'rows':[]};var _0x1d7d58=_[_0x29f5('0x3f')](db[_0x29f5('0x40')][_0x29f5('0x41')],function(_0x42a790){return{'name':_0x42a790['fieldName'],'type':_0x42a790[_0x29f5('0x42')][_0x29f5('0x43')]};});_0x30cb26[_0x29f5('0x44')]=_[_0x29f5('0x3f')](_0x1d7d58,'name');_0x30cb26[_0x29f5('0x45')]=_[_0x29f5('0x46')](_0xc6939b[_0x29f5('0x45')]);_0x30cb26['filters']=_[_0x29f5('0x47')](_0x30cb26[_0x29f5('0x44')],_0x30cb26['query']);_0x303e3c['attributes']=_[_0x29f5('0x47')](_0x30cb26['model'],qs[_0x29f5('0x48')](_0xc6939b[_0x29f5('0x45')][_0x29f5('0x48')]));_0x303e3c[_0x29f5('0x49')]=_0x303e3c[_0x29f5('0x49')][_0x29f5('0x4a')]?_0x303e3c[_0x29f5('0x49')]:_0x30cb26[_0x29f5('0x44')];if(!_0xc6939b['query'][_0x29f5('0x4b')](_0x29f5('0x4c'))){_0x303e3c[_0x29f5('0x4d')]=qs['limit'](_0xc6939b['query'][_0x29f5('0x4d')]);_0x303e3c['offset']=qs[_0x29f5('0x31')](_0xc6939b['query'][_0x29f5('0x31')]);}_0x303e3c[_0x29f5('0x4e')]=qs[_0x29f5('0x4f')](_0xc6939b[_0x29f5('0x45')][_0x29f5('0x4f')]);_0x303e3c[_0x29f5('0x50')]=qs[_0x29f5('0x51')](_['pick'](_0xc6939b[_0x29f5('0x45')],_0x30cb26[_0x29f5('0x51')]),_0x1d7d58);if(_0xc6939b[_0x29f5('0x45')][_0x29f5('0x52')]){_0x303e3c[_0x29f5('0x50')]=_[_0x29f5('0x53')](_0x303e3c['where'],{'$or':_[_0x29f5('0x3f')](_0x1d7d58,function(_0x554fad){if(_0x554fad[_0x29f5('0x42')]!==_0x29f5('0x54')){var _0x2c4717={};_0x2c4717[_0x554fad['name']]={'$like':'%'+_0xc6939b[_0x29f5('0x45')][_0x29f5('0x52')]+'%'};return _0x2c4717;}})});}_0x303e3c=_[_0x29f5('0x53')]({},_0x303e3c,_0xc6939b[_0x29f5('0x55')]);var _0x427023={'where':_0x303e3c[_0x29f5('0x50')]};return db[_0x29f5('0x40')][_0x29f5('0x30')](_0x427023)[_0x29f5('0x25')](function(_0x5ad2ca){_0x13956f['count']=_0x5ad2ca;if(_0xc6939b['query'][_0x29f5('0x56')]){_0x303e3c['include']=[{'all':!![]}];}return db[_0x29f5('0x40')][_0x29f5('0x57')](_0x303e3c);})[_0x29f5('0x25')](function(_0x4e0139){_0x13956f[_0x29f5('0x58')]=_0x4e0139;return _0x13956f;})[_0x29f5('0x25')](respondWithFilteredResult(_0x17d77f,_0x303e3c))[_0x29f5('0x2e')](handleError(_0x17d77f,null));};exports['show']=function(_0x3457cd,_0x43bb6a){var _0xd4108b={'raw':!![],'where':{'id':_0x3457cd[_0x29f5('0x59')]['id']}},_0x4b50af={};_0x4b50af[_0x29f5('0x44')]=_['keys'](db[_0x29f5('0x40')][_0x29f5('0x41')]);_0x4b50af[_0x29f5('0x45')]=_[_0x29f5('0x46')](_0x3457cd['query']);_0x4b50af[_0x29f5('0x51')]=_[_0x29f5('0x47')](_0x4b50af[_0x29f5('0x44')],_0x4b50af[_0x29f5('0x45')]);_0xd4108b['attributes']=_[_0x29f5('0x47')](_0x4b50af[_0x29f5('0x44')],qs[_0x29f5('0x48')](_0x3457cd[_0x29f5('0x45')][_0x29f5('0x48')]));_0xd4108b['attributes']=_0xd4108b[_0x29f5('0x49')][_0x29f5('0x4a')]?_0xd4108b[_0x29f5('0x49')]:_0x4b50af[_0x29f5('0x44')];if(_0x3457cd[_0x29f5('0x45')]['includeAll']){_0xd4108b[_0x29f5('0x5a')]=[{'all':!![]}];}_0xd4108b=_[_0x29f5('0x53')]({},_0xd4108b,_0x3457cd[_0x29f5('0x55')]);return db[_0x29f5('0x40')][_0x29f5('0x5b')](_0xd4108b)[_0x29f5('0x25')](handleEntityNotFound(_0x43bb6a,null))[_0x29f5('0x25')](respondWithResult(_0x43bb6a,null))[_0x29f5('0x2e')](handleError(_0x43bb6a,null));};exports[_0x29f5('0x5c')]=function(_0x54547e,_0x57b36b){return db[_0x29f5('0x40')][_0x29f5('0x5c')](_0x54547e[_0x29f5('0x5d')],{})[_0x29f5('0x25')](respondWithResult(_0x57b36b,0xc9))[_0x29f5('0x2e')](handleError(_0x57b36b,null));};exports[_0x29f5('0x38')]=function(_0x51c3ef,_0x559a42){if(_0x51c3ef[_0x29f5('0x5d')]['id']){delete _0x51c3ef[_0x29f5('0x5d')]['id'];}return db['ChatGroup'][_0x29f5('0x5b')]({'where':{'id':_0x51c3ef['params']['id']}})[_0x29f5('0x25')](handleEntityNotFound(_0x559a42,null))['then'](saveUpdates(_0x51c3ef[_0x29f5('0x5d')],null))[_0x29f5('0x25')](respondWithResult(_0x559a42,null))[_0x29f5('0x2e')](handleError(_0x559a42,null));};exports[_0x29f5('0x39')]=function(_0x1ce41a,_0x861c22){return db['ChatGroup'][_0x29f5('0x5b')]({'where':{'id':_0x1ce41a[_0x29f5('0x59')]['id']}})['then'](handleEntityNotFound(_0x861c22,null))[_0x29f5('0x25')](removeEntity(_0x861c22,null))[_0x29f5('0x2e')](handleError(_0x861c22,null));};exports[_0x29f5('0x5e')]=function(_0x4a2a23,_0x2b5830){return db[_0x29f5('0x40')][_0x29f5('0x5e')]()[_0x29f5('0x25')](respondWithResult(_0x2b5830,null))[_0x29f5('0x2e')](handleError(_0x2b5830,null));};exports[_0x29f5('0x5f')]=function(_0x38da23,_0x4c2edc,_0x5c51ce){return db[_0x29f5('0x60')][_0x29f5('0x30')]({'where':{'ChatGroupId':_0x38da23['params']['id'],'ToId':_0x38da23[_0x29f5('0x61')]['id'],'read':![]}})[_0x29f5('0x25')](function(_0x4eaaa9){return{'id':_[_0x29f5('0x62')](_0x38da23[_0x29f5('0x59')]['id']),'count':_0x4eaaa9};})['then'](respondWithResult(_0x4c2edc,null))[_0x29f5('0x2e')](handleError(_0x4c2edc,null));};exports[_0x29f5('0x63')]=function(_0x7a42b8,_0x150b1d,_0x26827c){return db[_0x29f5('0x40')][_0x29f5('0x5b')]({'where':{'id':_0x7a42b8[_0x29f5('0x59')]['id']}})[_0x29f5('0x25')](handleEntityNotFound(_0x150b1d,null))['then'](function(_0x413e0b){if(_0x413e0b){return _0x413e0b[_0x29f5('0x63')](_0x7a42b8[_0x29f5('0x5d')][_0x29f5('0x64')],_['omit'](_0x7a42b8[_0x29f5('0x5d')],['ids','id'])||{});}})['then'](respondWithResult(_0x150b1d,null))[_0x29f5('0x2e')](handleError(_0x150b1d,null));};exports[_0x29f5('0x65')]=function(_0x7cc38c,_0x334e32,_0x533c91){var _0x5cac14={};var _0x1aab30={};var _0x10cb12;var _0x4ad750;return db[_0x29f5('0x40')][_0x29f5('0x66')]({'where':{'id':_0x7cc38c[_0x29f5('0x59')]['id']}})[_0x29f5('0x25')](handleEntityNotFound(_0x334e32,null))[_0x29f5('0x25')](function(_0x26231c){if(_0x26231c){_0x10cb12=_0x26231c;_0x1aab30[_0x29f5('0x44')]=_['keys'](db['User']['rawAttributes']);_0x1aab30[_0x29f5('0x45')]=_['keys'](_0x7cc38c[_0x29f5('0x45')]);_0x1aab30[_0x29f5('0x51')]=_[_0x29f5('0x47')](_0x1aab30[_0x29f5('0x44')],_0x1aab30[_0x29f5('0x45')]);_0x5cac14[_0x29f5('0x49')]=_[_0x29f5('0x47')](_0x1aab30[_0x29f5('0x44')],qs[_0x29f5('0x48')](_0x7cc38c[_0x29f5('0x45')]['fields']));_0x5cac14[_0x29f5('0x49')]=_0x5cac14[_0x29f5('0x49')][_0x29f5('0x4a')]?_0x5cac14[_0x29f5('0x49')]:_0x1aab30[_0x29f5('0x44')];_0x5cac14[_0x29f5('0x4e')]=qs[_0x29f5('0x4f')](_0x7cc38c[_0x29f5('0x45')][_0x29f5('0x4f')]);_0x5cac14[_0x29f5('0x50')]=qs[_0x29f5('0x51')](_['pick'](_0x7cc38c[_0x29f5('0x45')],_0x1aab30[_0x29f5('0x51')]));if(_0x7cc38c[_0x29f5('0x45')][_0x29f5('0x52')]){_0x5cac14['where']=_[_0x29f5('0x53')](_0x5cac14['where'],{'$or':_[_0x29f5('0x3f')](_0x5cac14['attributes'],function(_0x2b3103){var _0x411642={};_0x411642[_0x2b3103]={'$like':'%'+_0x7cc38c[_0x29f5('0x45')][_0x29f5('0x52')]+'%'};return _0x411642;})});}_0x5cac14=_[_0x29f5('0x53')]({},_0x5cac14,_0x7cc38c[_0x29f5('0x55')]);return _0x10cb12[_0x29f5('0x65')](_0x5cac14);}})['then'](function(_0x19fd6b){if(_0x19fd6b){_0x4ad750=_0x19fd6b[_0x29f5('0x4a')];if(!_0x7cc38c[_0x29f5('0x45')][_0x29f5('0x4b')](_0x29f5('0x4c'))){_0x5cac14[_0x29f5('0x4d')]=qs[_0x29f5('0x4d')](_0x7cc38c[_0x29f5('0x45')]['limit']);_0x5cac14[_0x29f5('0x31')]=qs[_0x29f5('0x31')](_0x7cc38c[_0x29f5('0x45')]['offset']);}return _0x10cb12[_0x29f5('0x65')](_0x5cac14);}})[_0x29f5('0x25')](function(_0x3ebd60){if(_0x3ebd60){return _0x3ebd60?{'count':_0x4ad750,'rows':_0x3ebd60}:null;}})[_0x29f5('0x25')](respondWithResult(_0x334e32,null))[_0x29f5('0x2e')](handleError(_0x334e32,null));};exports['removeMembers']=function(_0x4270b1,_0x50eaee,_0x3e9eec){return db[_0x29f5('0x40')][_0x29f5('0x5b')]({'where':{'id':_0x4270b1[_0x29f5('0x59')]['id']}})[_0x29f5('0x25')](handleEntityNotFound(_0x50eaee,null))[_0x29f5('0x25')](function(_0x57f68d){if(_0x57f68d){return _0x57f68d[_0x29f5('0x67')](_0x4270b1['query'][_0x29f5('0x64')]);}})['then'](respondWithStatusCode(_0x50eaee,null))[_0x29f5('0x2e')](handleError(_0x50eaee,null));};exports['addMessage']=function(_0x7c05e9,_0x5853c8,_0x25d013){if(_0x7c05e9[_0x29f5('0x5d')]['id']){delete _0x7c05e9[_0x29f5('0x5d')]['id'];}return db[_0x29f5('0x40')]['find']({'where':{'id':_0x7c05e9[_0x29f5('0x59')]['id']}})[_0x29f5('0x25')](handleEntityNotFound(_0x5853c8,null))[_0x29f5('0x25')](function(_0x4a6916){if(_0x4a6916){_0x7c05e9[_0x29f5('0x5d')][_0x29f5('0x68')]=_0x4a6916['id'];return db[_0x29f5('0x60')][_0x29f5('0x5c')](_0x7c05e9['body']);}})['then'](respondWithResult(_0x5853c8,null))[_0x29f5('0x2e')](handleError(_0x5853c8,null));};exports[_0x29f5('0x69')]=function(_0x519a52,_0x28c58e,_0x21de2a){var _0x25c630={};var _0x25a890={};var _0x358446;var _0x5d7dce;return db[_0x29f5('0x40')][_0x29f5('0x66')]({'where':{'id':_0x519a52['params']['id']}})['then'](handleEntityNotFound(_0x28c58e,null))[_0x29f5('0x25')](function(_0x228994){if(_0x228994){_0x358446=_0x228994;_0x25a890[_0x29f5('0x44')]=_['keys'](db[_0x29f5('0x60')][_0x29f5('0x41')]);_0x25a890[_0x29f5('0x45')]=_[_0x29f5('0x46')](_0x519a52['query']);_0x25a890[_0x29f5('0x51')]=_['intersection'](_0x25a890[_0x29f5('0x44')],_0x25a890[_0x29f5('0x45')]);_0x25c630['attributes']=_[_0x29f5('0x47')](_0x25a890['model'],qs['fields'](_0x519a52[_0x29f5('0x45')][_0x29f5('0x48')]));_0x25c630[_0x29f5('0x49')]=_0x25c630[_0x29f5('0x49')]['length']?_0x25c630[_0x29f5('0x49')]:_0x25a890[_0x29f5('0x44')];_0x25c630[_0x29f5('0x4e')]=qs[_0x29f5('0x4f')](_0x519a52[_0x29f5('0x45')][_0x29f5('0x4f')]);_0x25c630[_0x29f5('0x50')]=qs['filters'](_[_0x29f5('0x6a')](_0x519a52[_0x29f5('0x45')],_0x25a890[_0x29f5('0x51')]));if(_0x519a52['query'][_0x29f5('0x52')]){_0x25c630[_0x29f5('0x50')]=_['merge'](_0x25c630[_0x29f5('0x50')],{'$or':_['map'](_0x25c630[_0x29f5('0x49')],function(_0x441293){var _0x408a8a={};_0x408a8a[_0x441293]={'$like':'%'+_0x519a52['query'][_0x29f5('0x52')]+'%'};return _0x408a8a;})});}if(_0x519a52[_0x29f5('0x45')]['$gte']){var _0x5b82b5=_0x519a52['query'][_0x29f5('0x6b')]['split'](',');var _0x2ccf63={};_0x2ccf63[_0x5b82b5[0x0]]={'$gte':moment(_0x5b82b5[0x1])['format'](_0x29f5('0x6c'))};_0x25c630[_0x29f5('0x50')]=_[_0x29f5('0x53')](_0x25c630[_0x29f5('0x50')],_0x2ccf63);}_0x25c630=_['merge']({},_0x25c630,_0x519a52[_0x29f5('0x55')]);return _0x358446['getMessages'](_0x25c630);}})[_0x29f5('0x25')](function(_0x45eb62){if(_0x45eb62){_0x5d7dce=_0x45eb62['length'];if(!_0x519a52[_0x29f5('0x45')][_0x29f5('0x4b')](_0x29f5('0x4c'))){_0x25c630[_0x29f5('0x4d')]=qs['limit'](_0x519a52['query'][_0x29f5('0x4d')]);_0x25c630[_0x29f5('0x31')]=qs['offset'](_0x519a52[_0x29f5('0x45')][_0x29f5('0x31')]);}return _0x358446['getMessages'](_0x25c630);}})[_0x29f5('0x25')](function(_0x49f18e){if(_0x49f18e){return _0x49f18e?{'count':_0x5d7dce,'rows':_0x49f18e}:null;}})[_0x29f5('0x25')](respondWithResult(_0x28c58e,null))[_0x29f5('0x2e')](handleError(_0x28c58e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fe5cd40..b31c41b 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0xadb5,0xad));var _0x5adb=function(_0x5b1760,_0x3f8f30){_0x5b1760=_0x5b1760-0x0;var _0x591c5d=_0xadb5[_0x5b1760];return _0x591c5d;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0x43c4ed,_0x68e4ef){var _0x86b993=function(_0xf143e4){while(--_0xf143e4){_0x43c4ed['push'](_0x43c4ed['shift']());}};_0x86b993(++_0x68e4ef);}(_0xb10b,0x12a));var _0xbb10=function(_0x312b2b,_0x2174f3){_0x312b2b=_0x312b2b-0x0;var _0x1d6a18=_0xb10b[_0x312b2b];return _0x1d6a18;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 8957f6a..ca9d487 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 _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x9a5a,0x194));var _0xa9a5=function(_0x547691,_0x4b57ca){_0x547691=_0x547691-0x0;var _0x3bc0c1=_0x9a5a[_0x547691];return _0x3bc0c1;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb46f=['request-promise','path','../../config/environment','exports','define','ChatGroup','lodash','util','api','moment','bluebird'];(function(_0x2881b0,_0x29b363){var _0x4203be=function(_0x3ba891){while(--_0x3ba891){_0x2881b0['push'](_0x2881b0['shift']());}};_0x4203be(++_0x29b363);}(_0xb46f,0xb6));var _0xfb46=function(_0x4f655b,_0x26c859){_0x4f655b=_0x4f655b-0x0;var _0x30ef13=_0xb46f[_0x4f655b];return _0x30ef13;};'use strict';var _=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var logger=require('../../config/logger')(_0xfb46('0x2'));var moment=require(_0xfb46('0x3'));var BPromise=require(_0xfb46('0x4'));var rp=require(_0xfb46('0x5'));var fs=require('fs');var path=require(_0xfb46('0x6'));var rimraf=require('rimraf');var config=require(_0xfb46('0x7'));var attributes=require('./chatGroup.attributes');module[_0xfb46('0x8')]=function(_0x3a5255,_0x186da6){return _0x3a5255[_0xfb46('0x9')](_0xfb46('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 8190113..e8d9296 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 _0x5b10=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5b10,0x13f));var _0x05b1=function(_0x2c89f3,_0x2a10eb){_0x2c89f3=_0x2c89f3-0x0;var _0x7a1343=_0x5b10[_0x2c89f3];return _0x7a1343;};'use strict';var _=require(_0x05b1('0x0'));var util=require(_0x05b1('0x1'));var moment=require(_0x05b1('0x2'));var BPromise=require(_0x05b1('0x3'));var rs=require(_0x05b1('0x4'));var fs=require('fs');var Redis=require(_0x05b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x05b1('0x6'));var logger=require('../../config/logger')(_0x05b1('0x7'));var config=require(_0x05b1('0x8'));var jayson=require(_0x05b1('0x9'));var client=jayson['client'][_0x05b1('0xa')]({'port':0x232a});config[_0x05b1('0xb')]=_[_0x05b1('0xc')](config[_0x05b1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x05b1('0xd'))(new Redis(config[_0x05b1('0xb')]));require(_0x05b1('0xe'))['register'](socket);function respondWithRpcPromise(_0xa8f464,_0x36f63b,_0x375427){return new BPromise(function(_0x5df9e0,_0x2ae864){return client[_0x05b1('0xf')](_0xa8f464,_0x375427)['then'](function(_0x27c4b6){logger[_0x05b1('0x10')](_0x05b1('0x11'),_0x36f63b,_0x05b1('0x12'));logger[_0x05b1('0x13')](_0x05b1('0x14'),_0x36f63b,'request\x20sent',JSON['stringify'](_0x27c4b6));if(_0x27c4b6[_0x05b1('0x15')]){if(_0x27c4b6['error'][_0x05b1('0x16')]===0x1f4){logger[_0x05b1('0x15')](_0x05b1('0x11'),_0x36f63b,_0x27c4b6[_0x05b1('0x15')][_0x05b1('0x17')]);return _0x2ae864(_0x27c4b6['error']['message']);}logger[_0x05b1('0x15')](_0x05b1('0x11'),_0x36f63b,_0x27c4b6[_0x05b1('0x15')][_0x05b1('0x17')]);return _0x5df9e0(_0x27c4b6[_0x05b1('0x15')][_0x05b1('0x17')]);}else{logger['info'](_0x05b1('0x11'),_0x36f63b,'request\x20sent');_0x5df9e0(_0x27c4b6['result']['message']);}})[_0x05b1('0x18')](function(_0x323fc6){logger[_0x05b1('0x15')](_0x05b1('0x11'),_0x36f63b,_0x323fc6);_0x2ae864(_0x323fc6);});});} \ No newline at end of file +var _0xf025=['../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','redis','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1a6f23,_0x160f21){var _0x407a1d=function(_0x147587){while(--_0x147587){_0x1a6f23['push'](_0x1a6f23['shift']());}};_0x407a1d(++_0x160f21);}(_0xf025,0x1ba));var _0x5f02=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xf025[_0x5f4cd7];return _0x47c93f;};'use strict';var _=require(_0x5f02('0x0'));var util=require(_0x5f02('0x1'));var moment=require(_0x5f02('0x2'));var BPromise=require(_0x5f02('0x3'));var rs=require(_0x5f02('0x4'));var fs=require('fs');var Redis=require(_0x5f02('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f02('0x6'));var logger=require('../../config/logger')(_0x5f02('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f02('0x8'));var client=jayson[_0x5f02('0x9')][_0x5f02('0xa')]({'port':0x232a});config['redis']=_[_0x5f02('0xb')](config['redis'],{'host':_0x5f02('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f02('0xd')]));require(_0x5f02('0xe'))[_0x5f02('0xf')](socket);function respondWithRpcPromise(_0x661047,_0x2541cc,_0xc2e2e0){return new BPromise(function(_0x1f4e41,_0x5581c6){return client[_0x5f02('0x10')](_0x661047,_0xc2e2e0)[_0x5f02('0x11')](function(_0x328e9c){logger[_0x5f02('0x12')](_0x5f02('0x13'),_0x2541cc,_0x5f02('0x14'));logger[_0x5f02('0x15')](_0x5f02('0x16'),_0x2541cc,_0x5f02('0x14'),JSON[_0x5f02('0x17')](_0x328e9c));if(_0x328e9c[_0x5f02('0x18')]){if(_0x328e9c[_0x5f02('0x18')]['code']===0x1f4){logger['error'](_0x5f02('0x13'),_0x2541cc,_0x328e9c['error']['message']);return _0x5581c6(_0x328e9c[_0x5f02('0x18')][_0x5f02('0x19')]);}logger['error'](_0x5f02('0x13'),_0x2541cc,_0x328e9c[_0x5f02('0x18')]['message']);return _0x1f4e41(_0x328e9c[_0x5f02('0x18')][_0x5f02('0x19')]);}else{logger[_0x5f02('0x12')](_0x5f02('0x13'),_0x2541cc,_0x5f02('0x14'));_0x1f4e41(_0x328e9c[_0x5f02('0x1a')][_0x5f02('0x19')]);}})[_0x5f02('0x1b')](function(_0x3d6efd){logger['error']('ChatGroup,\x20%s,\x20%s',_0x2541cc,_0x3d6efd);_0x5581c6(_0x3d6efd);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index f0c1332..7606fed 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 _0xca02=['removeListener','register','length','chatGroup:','save','update','emit'];(function(_0x8e599a,_0x13f7ab){var _0xce4bbc=function(_0x53dad2){while(--_0x53dad2){_0x8e599a['push'](_0x8e599a['shift']());}};_0xce4bbc(++_0x13f7ab);}(_0xca02,0x138));var _0x2ca0=function(_0x103ede,_0x452a57){_0x103ede=_0x103ede-0x0;var _0x1f0ded=_0xca02[_0x103ede];return _0x1f0ded;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x2ca0('0x0'),'remove',_0x2ca0('0x1')];function createListener(_0x5d0e2f,_0x5b098d){return function(_0x4b3102){_0x5b098d[_0x2ca0('0x2')](_0x5d0e2f,_0x4b3102);};}function removeListener(_0x22d133,_0x1e1a22){return function(){ChatGroupEvents[_0x2ca0('0x3')](_0x22d133,_0x1e1a22);};}exports[_0x2ca0('0x4')]=function(_0x23719){for(var _0x90047e=0x0,_0x474531=events[_0x2ca0('0x5')];_0x90047e<_0x474531;_0x90047e++){var _0x4168c5=events[_0x90047e];var _0x1efd69=createListener(_0x2ca0('0x6')+_0x4168c5,_0x23719);ChatGroupEvents['on'](_0x4168c5,_0x1efd69);}}; \ No newline at end of file +var _0x1032=['./chatGroup.events','save','remove','update','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1032,0xf6));var _0x2103=function(_0x57dd61,_0x5af549){_0x57dd61=_0x57dd61-0x0;var _0x402ca8=_0x1032[_0x57dd61];return _0x402ca8;};'use strict';var ChatGroupEvents=require(_0x2103('0x0'));var events=[_0x2103('0x1'),_0x2103('0x2'),_0x2103('0x3')];function createListener(_0x579cc1,_0x17742d){return function(_0x206971){_0x17742d['emit'](_0x579cc1,_0x206971);};}function removeListener(_0x1a7bd8,_0x464ae8){return function(){ChatGroupEvents[_0x2103('0x4')](_0x1a7bd8,_0x464ae8);};}exports[_0x2103('0x5')]=function(_0x156995){for(var _0x60f36c=0x0,_0x541bd7=events['length'];_0x60f36c<_0x541bd7;_0x60f36c++){var _0x3dcfe9=events[_0x60f36c];var _0x7c4d3a=createListener('chatGroup:'+_0x3dcfe9,_0x156995);ChatGroupEvents['on'](_0x3dcfe9,_0x7c4d3a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 94664ce..f8bc431 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 _0xd2ee=['create','addMembers','addMessage','put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./chatGroup.controller','isAuthenticated','index','describe','/:id','get','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd2ee,0x9d));var _0xed2e=function(_0x1ad21d,_0x3e2a2f){_0x1ad21d=_0x1ad21d-0x0;var _0x40e017=_0xd2ee[_0x1ad21d];return _0x40e017;};'use strict';var multer=require('multer');var util=require(_0xed2e('0x0'));var path=require(_0xed2e('0x1'));var timeout=require(_0xed2e('0x2'));var express=require(_0xed2e('0x3'));var router=express[_0xed2e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed2e('0x5'));var controller=require(_0xed2e('0x6'));router['get']('/',auth[_0xed2e('0x7')](),controller[_0xed2e('0x8')]);router['get']('/describe',auth[_0xed2e('0x7')](),controller[_0xed2e('0x9')]);router['get'](_0xed2e('0xa'),auth[_0xed2e('0x7')](),controller['show']);router[_0xed2e('0xb')](_0xed2e('0xc'),auth[_0xed2e('0x7')](),controller[_0xed2e('0xd')]);router[_0xed2e('0xb')](_0xed2e('0xe'),auth[_0xed2e('0x7')](),controller[_0xed2e('0xf')]);router[_0xed2e('0xb')](_0xed2e('0x10'),auth[_0xed2e('0x7')](),controller['getMessages']);router[_0xed2e('0x11')]('/',auth[_0xed2e('0x7')](),controller[_0xed2e('0x12')]);router[_0xed2e('0x11')](_0xed2e('0xe'),auth['isAuthenticated'](),controller[_0xed2e('0x13')]);router[_0xed2e('0x11')](_0xed2e('0x10'),auth[_0xed2e('0x7')](),controller[_0xed2e('0x14')]);router[_0xed2e('0x15')](_0xed2e('0xa'),auth[_0xed2e('0x7')](),controller[_0xed2e('0x16')]);router['delete'](_0xed2e('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xed2e('0x17')](_0xed2e('0xe'),auth[_0xed2e('0x7')](),controller['removeMembers']);module[_0xed2e('0x18')]=router; \ No newline at end of file +var _0xa51a=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','getMessages','post','create','addMembers','/:id/messages','addMessage','put'];(function(_0x56f213,_0x1f1e98){var _0x4da0f0=function(_0xe78e1){while(--_0xe78e1){_0x56f213['push'](_0x56f213['shift']());}};_0x4da0f0(++_0x1f1e98);}(_0xa51a,0x162));var _0xaa51=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xa51a[_0x45f951];return _0x24756c;};'use strict';var multer=require(_0xaa51('0x0'));var util=require(_0xaa51('0x1'));var path=require(_0xaa51('0x2'));var timeout=require(_0xaa51('0x3'));var express=require('express');var router=express[_0xaa51('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaa51('0x5'));var config=require('../../config/environment');var controller=require(_0xaa51('0x6'));router[_0xaa51('0x7')]('/',auth[_0xaa51('0x8')](),controller[_0xaa51('0x9')]);router['get'](_0xaa51('0xa'),auth[_0xaa51('0x8')](),controller['describe']);router['get'](_0xaa51('0xb'),auth[_0xaa51('0x8')](),controller['show']);router[_0xaa51('0x7')]('/:id/unread',auth[_0xaa51('0x8')](),controller['getUnread']);router[_0xaa51('0x7')](_0xaa51('0xc'),auth[_0xaa51('0x8')](),controller[_0xaa51('0xd')]);router[_0xaa51('0x7')]('/:id/messages',auth[_0xaa51('0x8')](),controller[_0xaa51('0xe')]);router[_0xaa51('0xf')]('/',auth['isAuthenticated'](),controller[_0xaa51('0x10')]);router['post'](_0xaa51('0xc'),auth[_0xaa51('0x8')](),controller[_0xaa51('0x11')]);router['post'](_0xaa51('0x12'),auth[_0xaa51('0x8')](),controller[_0xaa51('0x13')]);router[_0xaa51('0x14')](_0xaa51('0xb'),auth[_0xaa51('0x8')](),controller[_0xaa51('0x15')]);router[_0xaa51('0x16')](_0xaa51('0xb'),auth[_0xaa51('0x8')](),controller[_0xaa51('0x17')]);router[_0xaa51('0x16')](_0xaa51('0xc'),auth['isAuthenticated'](),controller['removeMembers']);module[_0xaa51('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index bf0d762..7283654 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 _0x2aa7=['TEXT','STRING','long','DATE','ENUM','out','exports','INTEGER','thumb'];(function(_0x5e8b46,_0x21eb4a){var _0x252814=function(_0x327288){while(--_0x327288){_0x5e8b46['push'](_0x5e8b46['shift']());}};_0x252814(++_0x21eb4a);}(_0x2aa7,0x1a4));var _0x72aa=function(_0x4307e0,_0x57a10f){_0x4307e0=_0x4307e0-0x0;var _0x114911=_0x2aa7[_0x4307e0];return _0x114911;};'use strict';var Sequelize=require('sequelize');module[_0x72aa('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x72aa('0x1')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x72aa('0x2')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x72aa('0x3')]},'pathTranscript':{'type':Sequelize[_0x72aa('0x3')]},'mailTranscript':{'type':Sequelize[_0x72aa('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x72aa('0x4')]},'note':{'type':Sequelize[_0x72aa('0x4')]},'browserName':{'type':Sequelize[_0x72aa('0x4')]},'browserVersion':{'type':Sequelize[_0x72aa('0x4')]},'osName':{'type':Sequelize[_0x72aa('0x4')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x72aa('0x4')]},'deviceVendor':{'type':Sequelize[_0x72aa('0x4')]},'deviceType':{'type':Sequelize[_0x72aa('0x4')]},'referer':{'type':Sequelize[_0x72aa('0x3')]},'customerIp':{'type':Sequelize[_0x72aa('0x4')]},'formData':{'type':Sequelize[_0x72aa('0x3')](_0x72aa('0x5'))},'read1stAt':{'type':Sequelize[_0x72aa('0x6')]},'lastMsgAt':{'type':Sequelize[_0x72aa('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x72aa('0x7')]('in',_0x72aa('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x72aa('0x4')]},'customerPort':{'type':Sequelize[_0x72aa('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x72aa('0x3')]}}; \ No newline at end of file +var _0x6ba3=['out','sequelize','exports','BOOLEAN','thumb','star','TEXT','STRING','DATE','ENUM'];(function(_0x398147,_0x2484aa){var _0x38014a=function(_0x1f6826){while(--_0x1f6826){_0x398147['push'](_0x398147['shift']());}};_0x38014a(++_0x2484aa);}(_0x6ba3,0x10f));var _0x36ba=function(_0x47c53e,_0x4e03ba){_0x47c53e=_0x47c53e-0x0;var _0x30cc26=_0x6ba3[_0x47c53e];return _0x30cc26;};'use strict';var Sequelize=require(_0x36ba('0x0'));module[_0x36ba('0x1')]={'closed':{'type':Sequelize[_0x36ba('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star',_0x36ba('0x3')),'defaultValue':_0x36ba('0x4')},'ratingMessage':{'type':Sequelize[_0x36ba('0x5')]},'pathTranscript':{'type':Sequelize[_0x36ba('0x5')]},'mailTranscript':{'type':Sequelize[_0x36ba('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x36ba('0x7')]},'disposition':{'type':Sequelize[_0x36ba('0x6')]},'note':{'type':Sequelize[_0x36ba('0x6')]},'browserName':{'type':Sequelize[_0x36ba('0x6')]},'browserVersion':{'type':Sequelize[_0x36ba('0x6')]},'osName':{'type':Sequelize[_0x36ba('0x6')]},'osVersion':{'type':Sequelize[_0x36ba('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x36ba('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x36ba('0x5')]},'customerIp':{'type':Sequelize[_0x36ba('0x6')]},'formData':{'type':Sequelize[_0x36ba('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x36ba('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x36ba('0x8')]('in',_0x36ba('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x36ba('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x36ba('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 74461b0..d0f71af 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 _0xc4aa=['rows','show','params','includeAll','include','options','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','filename','Attachment','Unauthorized','attachId','download','root','server/files/attachments/','basename','close','join','format','transcript-%s.txt','now','pathTranscript','CmContact','Messages','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','addTags','omit','spread','emit','removeTags','unix','tmp','files','attachments','Contact','firstName','lastName','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','server','views','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.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','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','name','Users','map','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','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)','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','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','concat','$gte','parse','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','sequelize','groupBy','ChatInteractionId','all'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);var jayson=require(_0xac4a('0x1c'));var client=jayson[_0xac4a('0x1d')][_0xac4a('0x1e')]({'port':0x232b});var client9004=jayson[_0xac4a('0x1d')][_0xac4a('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x11e101,_0x26dbb8,_0x4a2119){if(_0x4a2119){var _0x402fff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x402fff[_0xac4a('0x1f')](_0x26dbb8)){return _0x11e101;}else{throw new db[(_0xac4a('0x20'))][(_0xac4a('0x21'))](_0xac4a('0x22'));}}else{return _0x11e101;}}function respondWithRpcPromise(_0x387a54,_0x28e304,_0x44ec59,_0x546c5d){return new BPromise(function(_0x5ac21e,_0x21a729){var _0x13c8eb=_0x546c5d||client;return _0x13c8eb[_0xac4a('0x23')](_0x387a54,_0x44ec59)['then'](function(_0x39e83e){logger[_0xac4a('0x24')](_0xac4a('0x25'),_0x28e304,_0xac4a('0x26'));logger[_0xac4a('0x27')](_0xac4a('0x28'),_0x28e304,_0xac4a('0x26'),JSON[_0xac4a('0x29')](_0x39e83e));if(_0x39e83e['error']){if(_0x39e83e[_0xac4a('0x2a')][_0xac4a('0x2b')]===0x1f4){logger['error'](_0xac4a('0x25'),_0x28e304,_0x39e83e[_0xac4a('0x2a')][_0xac4a('0x2c')]);return _0x21a729(_0x39e83e[_0xac4a('0x2a')]['message']);}logger[_0xac4a('0x2a')](_0xac4a('0x25'),_0x28e304,_0x39e83e[_0xac4a('0x2a')][_0xac4a('0x2c')]);return _0x5ac21e(_0x39e83e[_0xac4a('0x2a')][_0xac4a('0x2c')]);}else{logger[_0xac4a('0x24')](_0xac4a('0x25'),_0x28e304,_0xac4a('0x26'));_0x5ac21e(_0x39e83e[_0xac4a('0x2d')][_0xac4a('0x2c')]);}})[_0xac4a('0x2e')](function(_0x14832b){logger[_0xac4a('0x2a')](_0xac4a('0x25'),_0x28e304,_0x14832b);_0x21a729(_0x14832b);});});}function respondWithStatusCode(_0x20202c,_0x4e17ce){_0x4e17ce=_0x4e17ce||0xcc;return function(_0x23b061){if(_0x23b061){return _0x20202c[_0xac4a('0x2f')](_0x4e17ce);}return _0x20202c[_0xac4a('0x30')](_0x4e17ce)[_0xac4a('0x31')]();};}function respondWithResult(_0x116700,_0x4a5a9e){_0x4a5a9e=_0x4a5a9e||0xc8;return function(_0x47f49c){if(_0x47f49c){return _0x116700[_0xac4a('0x30')](_0x4a5a9e)[_0xac4a('0x32')](_0x47f49c);}};}function respondWithFilteredResult(_0x1f12d5,_0x546b65){return function(_0x4bda1f){if(_0x4bda1f){var _0x355755=_0x4bda1f[_0xac4a('0x33')],_0x2896bc=_0x546b65['offset'],_0x228629=_0x546b65[_0xac4a('0x34')]+_0x546b65['limit'],_0x432066;if(_0x228629>=_0x355755){_0x228629=_0x355755;_0x432066=0xc8;}else{_0x432066=0xce;}_0x1f12d5[_0xac4a('0x30')](_0x432066);return _0x1f12d5['set'](_0xac4a('0x35'),_0x2896bc+'-'+_0x228629+'/'+_0x355755)[_0xac4a('0x32')](_0x4bda1f);}return null;};}function patchUpdates(_0x31501b){return function(_0x228aa7){try{jsonpatch[_0xac4a('0x36')](_0x228aa7,_0x31501b,!![]);}catch(_0x61e552){return BPromise[_0xac4a('0x37')](_0x61e552);}return _0x228aa7[_0xac4a('0x38')]();};}function saveUpdates(_0x29fb3b,_0xfd7c16){return function(_0x36ab49){if(_0x36ab49){return _0x36ab49[_0xac4a('0x39')](_0x29fb3b)[_0xac4a('0x3a')](function(_0x1a9d4e){return _0x1a9d4e;});}return null;};}function removeEntity(_0x5634e2,_0x30442d){return function(_0x1c41fb){if(_0x1c41fb){return _0x1c41fb['destroy']()[_0xac4a('0x3a')](function(){_0x5634e2[_0xac4a('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58804b,_0x11f0be){return function(_0x1ba096){if(!_0x1ba096){_0x58804b[_0xac4a('0x2f')](0x194);}return _0x1ba096;};}function handleError(_0x3de9e2,_0x4f5986){_0x4f5986=_0x4f5986||0x1f4;return function(_0x453d02){logger[_0xac4a('0x2a')](_0x453d02['stack']);if(_0x453d02[_0xac4a('0x3b')]){delete _0x453d02[_0xac4a('0x3b')];}_0x3de9e2[_0xac4a('0x30')](_0x4f5986)['send'](_0x453d02);};}function getInteractionUsers(_0x121328,_0x357f06){return new BPromise(function(_0x1b5427,_0x4e0445){try{if(_0x357f06[_0x121328['id']]){_0x121328[_0xac4a('0x3c')]=_[_0xac4a('0x3d')](_0x357f06[_0x121328['id']],function(_0x4b9faf){return{'id':_0x4b9faf['id'],'fullname':_0x4b9faf['fullname']};});}}catch(_0x4319a1){_0x4e0445(_0x4319a1);}_0x1b5427(_0x121328);});}function getInteractionTags(_0x5e0926,_0x50e03e){return new BPromise(function(_0x5f0af0,_0x4fee3a){try{if(_0x5e0926[_0xac4a('0x3e')]){_0x5e0926[_0xac4a('0x3f')]=[];_0x5e0926[_0xac4a('0x3e')][_0xac4a('0x40')](',')[_0xac4a('0x41')](function(_0x415f31){_0x5e0926[_0xac4a('0x3f')][_0xac4a('0x42')](_0x50e03e[_0x415f31]);});}delete _0x5e0926[_0xac4a('0x3e')];}catch(_0x1f7721){_0x4fee3a(_0x1f7721);}_0x5f0af0(_0x5e0926);});}function updateChatInteraction(_0x14f7d5,_0x1c2a87,_0x4e4994){return new BPromise(function(_0x5086ff,_0x5cd24f){return getInteractionUsers(_0x14f7d5,_0x4e4994)[_0xac4a('0x3a')](function(_0x5c46a){return getInteractionTags(_0x5c46a,_0x1c2a87);})[_0xac4a('0x3a')](function(_0x118be0){_0x5086ff(_0x118be0);})[_0xac4a('0x2e')](function(_0x411543){_0x5cd24f(_0x411543);});});}exports[_0xac4a('0x43')]=function(_0x3441f2,_0x3e9973){var _0x3edb19={},_0x561cb7={},_0x3f31d1={'count':0x0,'rows':[]};var _0x31bfaf=_[_0xac4a('0x3d')](db[_0xac4a('0x44')][_0xac4a('0x45')],function(_0x57b879){return{'name':_0x57b879[_0xac4a('0x46')],'type':_0x57b879[_0xac4a('0x47')]['key']};});_0x561cb7[_0xac4a('0x48')]=_['map'](_0x31bfaf,_0xac4a('0x3b'));_0x561cb7[_0xac4a('0x49')]=_[_0xac4a('0x4a')](_0x3441f2[_0xac4a('0x49')]);_0x561cb7[_0xac4a('0x4b')]=_[_0xac4a('0x4c')](_0x561cb7[_0xac4a('0x48')],_0x561cb7[_0xac4a('0x49')]);_0x3edb19[_0xac4a('0x4d')]=_[_0xac4a('0x4c')](_0x561cb7[_0xac4a('0x48')],qs[_0xac4a('0x4e')](_0x3441f2['query'][_0xac4a('0x4e')]));_0x3edb19[_0xac4a('0x4d')]=_0x3edb19[_0xac4a('0x4d')]['length']?_0x3edb19[_0xac4a('0x4d')]:_0x561cb7[_0xac4a('0x48')];if(!_0x3441f2['query'][_0xac4a('0x4f')]('nolimit')){_0x3edb19[_0xac4a('0x50')]=qs[_0xac4a('0x50')](_0x3441f2[_0xac4a('0x49')]['limit']);_0x3edb19['offset']=qs[_0xac4a('0x34')](_0x3441f2['query'][_0xac4a('0x34')]);}_0x3edb19['order']=qs[_0xac4a('0x51')](_0x3441f2['query'][_0xac4a('0x51')]);_0x3edb19[_0xac4a('0x52')]=qs[_0xac4a('0x4b')](_[_0xac4a('0x53')](_0x3441f2['query'],_0x561cb7[_0xac4a('0x4b')]),_0x31bfaf);var _0x2af87f=[];var _0x25bf3c=squel[_0xac4a('0x54')]()[_0xac4a('0x55')]('id')[_0xac4a('0x55')](_0xac4a('0x3b'))['field'](_0xac4a('0x56'))[_0xac4a('0x57')]('tools_tags');var _0x16afbe=squel[_0xac4a('0x54')]()[_0xac4a('0x55')](_0xac4a('0x58'))['field'](_0xac4a('0x59'))[_0xac4a('0x55')](_0xac4a('0x5a'))[_0xac4a('0x57')](_0xac4a('0x5b'),'ui')['left_join'](_0xac4a('0x5c'),'u','u.id\x20=\x20ui.UserId');var _0x307441=squel[_0xac4a('0x54')]()['from']('chat_interactions','i')[_0xac4a('0x5d')](_0xac4a('0x5e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xac4a('0x5d')](_0xac4a('0x5c'),'o',_0xac4a('0x5f'))[_0xac4a('0x5d')]('chat_websites','a',_0xac4a('0x60'))[_0xac4a('0x5d')](_0xac4a('0x61'),'me',_0xac4a('0x62'))[_0xac4a('0x5d')](_0xac4a('0x63'),'it',_0xac4a('0x64'))['left_join'](_0xac4a('0x65'),'t',_0xac4a('0x66'));var _0xe870ba=squel[_0xac4a('0x67')]();var _0x1b7231=[];var _0x2ac1e9=squel[_0xac4a('0x67')]();var _0x236f57;if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x68')]){_0x236f57=as[_0xac4a('0x69')](_0x3441f2[_0xac4a('0x49')][_0xac4a('0x68')]);var _0x2fe7df=_0x236f57[_0xac4a('0x6a')];for(var _0x11c753=0x0;_0x11c753<_0x236f57['conditions'][_0xac4a('0x6b')];_0x11c753++){var _0x479ebc=_0x236f57[_0xac4a('0x6c')][_0x11c753];var _0x4b7f79='i';var _0x2a30e8=_['find'](_0x31bfaf,[_0xac4a('0x3b'),_0x479ebc['field']]);if(!_0x2a30e8){switch(_0x479ebc['field']){case _0xac4a('0x6d'):if(_0x479ebc[_0xac4a('0x6e')]==0x1){_0x307441[_0xac4a('0x6f')]('`'+_0x479ebc[_0xac4a('0x55')]+_0xac4a('0x70'));}else{_0x307441[_0xac4a('0x6f')]('`'+_0x479ebc['field']+_0xac4a('0x71'));}break;case'Contact':if(_0x479ebc[_0xac4a('0x72')]==='$substring'){if(_0x479ebc[_0xac4a('0x6e')][_0xac4a('0x40')]('\x20')[_0xac4a('0x6b')]>0x1){_0xe870ba[_0x2fe7df](_0xac4a('0x73'),qs[_0xac4a('0x74')](_0x479ebc[_0xac4a('0x6e')]),null);}else{var _0x3abd57='%'+_0x479ebc[_0xac4a('0x6e')]+'%';_0xe870ba[_0x2fe7df](_0xac4a('0x75'),_0x3abd57,_0x3abd57,_0x3abd57);}}else{_0x2a30e8=_[_0xac4a('0x76')](_0x31bfaf,[_0xac4a('0x3b'),_0xac4a('0x77')]);_0x479ebc[_0xac4a('0x55')]=_0xac4a('0x77');_0xc74ce8=as[_0xac4a('0x78')](_0x4b7f79,_0x2a30e8[_0xac4a('0x47')],_0x479ebc);_0xe870ba[_0x2fe7df](_0xc74ce8[_0xac4a('0x79')],_0xc74ce8['value'][_0xac4a('0x7a')],_0xc74ce8[_0xac4a('0x6e')]['end']);}break;case _0xac4a('0x7b'):var _0x34bd1c=_0x479ebc[_0xac4a('0x6e')][_0xac4a('0x40')](',')[_0xac4a('0x3d')](function(_0x4d1440){return Number(_0x4d1440);});_0x34bd1c['forEach'](function(_0x45f3c3){_0x2ac1e9['or'](_0xac4a('0x7c'),'%,'+_0x45f3c3+',%');});_0x1b7231=_[_0xac4a('0x7d')](_0x1b7231,_0x34bd1c);break;case _0xac4a('0x7e'):if(_0x479ebc[_0xac4a('0x72')]===_0xac4a('0x7f')){_0xe870ba[_0x2fe7df](_0xac4a('0x80'),'%'+_0x479ebc[_0xac4a('0x6e')]+'%',null);}else{_0x2a30e8=_[_0xac4a('0x76')](_0x31bfaf,[_0xac4a('0x3b'),_0xac4a('0x81')]);_0x479ebc['field']='UserId';_0xc74ce8=as[_0xac4a('0x78')](_0x4b7f79,_0x2a30e8[_0xac4a('0x47')],_0x479ebc);_0xe870ba[_0x2fe7df](_0xc74ce8[_0xac4a('0x79')],_0xc74ce8[_0xac4a('0x6e')][_0xac4a('0x7a')],_0xc74ce8[_0xac4a('0x6e')][_0xac4a('0x31')]);}break;case _0xac4a('0x82'):_0xc74ce8=as[_0xac4a('0x78')]('me',null,_0x479ebc);_0xe870ba[_0x2fe7df](_0xc74ce8[_0xac4a('0x79')],_0xc74ce8[_0xac4a('0x6e')][_0xac4a('0x7a')],_0xc74ce8['value'][_0xac4a('0x31')]);break;}}else{var _0xc74ce8=as[_0xac4a('0x78')](_0x4b7f79,_0x2a30e8[_0xac4a('0x47')],_0x479ebc);_0xe870ba[_0x2fe7df](_0xc74ce8['text'],_0xc74ce8[_0xac4a('0x6e')]['start'],_0xc74ce8[_0xac4a('0x6e')][_0xac4a('0x31')]);}}}else{var _0x499abc=_(_0x3441f2['query'])[_0xac4a('0x4a')]()[_0xac4a('0x3d')](function(_0x13097f){return _['some'](_0x31bfaf,[_0xac4a('0x3b'),_0x13097f])?_0x13097f:undefined;})['compact']()[_0xac4a('0x6e')]();if(!_['isEmpty'](_0x499abc)){_0x499abc['forEach'](function(_0x118c03){if(_0x118c03==='ChatWebsiteId'){_0x307441[_0xac4a('0x52')]('i.ChatWebsiteId\x20IN\x20?',[][_0xac4a('0x83')](_0x3441f2[_0xac4a('0x49')][_0x118c03]));}else if(_0x118c03==='createdAt'){var _0x3980ae=JSON['parse'](_0x3441f2[_0xac4a('0x49')][_0x118c03])[_0xac4a('0x84')];var _0x522949=JSON[_0xac4a('0x85')](_0x3441f2['query'][_0x118c03])['$lte'];_0x307441[_0xac4a('0x52')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3980ae,_0x522949);}else{if(_0x3441f2[_0xac4a('0x49')][_0x118c03]==='null'){_0x307441['where']('i.'+_0x118c03+_0xac4a('0x86'));}else{_0x307441[_0xac4a('0x52')]('i.'+_0x118c03+_0xac4a('0x87'),_0x3441f2['query'][_0x118c03]);}}});}if(_0x3441f2['query'][_0xac4a('0x88')]){if(_0x3441f2[_0xac4a('0x49')]['read']==0x1){_0x307441['having'](_0xac4a('0x89'));}else{_0x307441[_0xac4a('0x6f')](_0xac4a('0x8a'));}}if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x8b')]){_0x1b7231=_[_0xac4a('0x8c')](_0x3441f2[_0xac4a('0x49')][_0xac4a('0x8b')])?_0x3441f2[_0xac4a('0x49')]['tag']:new Array(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x8b')]);_0x1b7231[_0xac4a('0x41')](function(_0x582e1e){_0x2ac1e9['or'](_0xac4a('0x7c'),'%,'+_0x582e1e+',%');});}if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x8d')]){var _0x391c35=_0x3441f2[_0xac4a('0x49')]['filter'][_0xac4a('0x8e')]('\x5c','\x5c\x5c')[_0xac4a('0x8e')]('\x27\x27',_0xac4a('0x8f'));if(qs[_0xac4a('0x90')](_0x391c35)){_0xe870ba['or'](_0xac4a('0x91'),_0x391c35+'%');}else{_0xe870ba['or'](_0xac4a('0x92'),qs[_0xac4a('0x74')](_0x391c35))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x391c35+'%');}}}_0x307441[_0xac4a('0x52')](_0xe870ba);_0x307441[_0xac4a('0x93')](_0xac4a('0x94'));var _0x35a97c={'type':db[_0xac4a('0x20')][_0xac4a('0x95')]['SELECT'],'raw':!![]};var _0x318bee=_0x307441[_0xac4a('0x96')]();_0x318bee[_0xac4a('0x55')](_0xac4a('0x94'));_0x318bee['field'](_0xac4a('0x97'),'unreadMessages');if(_0x3edb19[_0xac4a('0x98')]){_0x3edb19[_0xac4a('0x98')]['forEach'](function(_0x5b95ab){_0x307441[_0xac4a('0x98')]('i.'+_0x5b95ab[0x0],_0x5b95ab[0x1]===_0xac4a('0x99')?![]:!![]);});}if(!_[_0xac4a('0x9a')](_0x1b7231)){_0x307441['having'](_0x2ac1e9);_0x318bee[_0xac4a('0x52')]('t.id\x20IN\x20?',_0x1b7231);}BPromise[_0xac4a('0x9b')]()[_0xac4a('0x3a')](function(){if(!_0x236f57){if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x9c')]||_0x3441f2[_0xac4a('0x49')]['journey'])return;_0x318bee['where'](_0xac4a('0x9d'));_0x307441[_0xac4a('0x52')](_0xac4a('0x9d'));return;}return _0x3441f2[_0xac4a('0x9e')][_0xac4a('0x9f')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x3a')](function(_0x1b203c){if(_[_0xac4a('0x9a')](_0x1b203c)){_0x318bee['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x307441[_0xac4a('0x52')](_0xac4a('0xa0'));}else{_0x318bee[_0xac4a('0x52')](_0xac4a('0xa1'),_[_0xac4a('0x3d')](_0x1b203c,'id'));_0x307441[_0xac4a('0x52')](_0xac4a('0xa1'),_[_0xac4a('0x3d')](_0x1b203c,'id'));}});})['then'](function(){db['sequelize'][_0xac4a('0x49')](_0x318bee[_0xac4a('0xa2')](),_0x35a97c)[_0xac4a('0x3a')](function(_0x371e06){_0x3f31d1[_0xac4a('0x33')]=_0x371e06[_0xac4a('0x6b')];if(_0x3f31d1[_0xac4a('0x33')]===0x0)return[];return db['sequelize'][_0xac4a('0x49')](_0x25bf3c[_0xac4a('0xa2')](),_0x35a97c)[_0xac4a('0x3a')](function(_0x5f323d){_0x2af87f=_[_0xac4a('0xa3')](_0x5f323d,'id');_0x35a97c=_[_0xac4a('0xa4')](_0x35a97c,{'model':db[_0xac4a('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3441f2[_0xac4a('0x49')][_0xac4a('0x4e')]){_0x3edb19[_0xac4a('0x4d')][_0xac4a('0x41')](function(_0x2ef42a){_0x307441[_0xac4a('0x55')]('i.'+_0x2ef42a);});}else{_0x307441['field'](_0xac4a('0x97'),'unreadMessages');_0x307441[_0xac4a('0x55')](_0xac4a('0xa5'),_0xac4a('0xa6'));_0x307441[_0xac4a('0x55')](_0xac4a('0xa7'),_0xac4a('0xa8'));_0x307441[_0xac4a('0x55')]('i.*');_0x307441[_0xac4a('0x55')](_0xac4a('0xa9'),_0xac4a('0xaa'));_0x307441[_0xac4a('0x55')](_0xac4a('0xab'),'Contact.lastName');_0x307441[_0xac4a('0x55')](_0xac4a('0xac'),'Contact.email');_0x307441['field'](_0xac4a('0xad'),_0xac4a('0xae'));_0x307441['field'](_0xac4a('0xaf'),_0xac4a('0xb0'));_0x307441[_0xac4a('0x55')](_0xac4a('0xb1'),_0xac4a('0xb2'));_0x307441[_0xac4a('0x55')]('o.fullname',_0xac4a('0xb3'));_0x307441[_0xac4a('0x55')](_0xac4a('0xb4'),'Owner.internal');_0x307441[_0xac4a('0x55')](_0xac4a('0xb5'),_0xac4a('0x3e'));}if(_0x3edb19[_0xac4a('0x50')])_0x307441[_0xac4a('0x50')](_0x3edb19[_0xac4a('0x50')]);if(_0x3edb19['offset'])_0x307441[_0xac4a('0x34')](_0x3edb19[_0xac4a('0x34')]);return db['sequelize'][_0xac4a('0x49')](_0x307441['toString'](),_0x35a97c);})[_0xac4a('0x3a')](function(_0x388ed7){_0x16afbe['where'](_0xac4a('0xb6'),_['map'](_0x388ed7,'id'));return db[_0xac4a('0xb7')]['query'](_0x16afbe[_0xac4a('0xa2')](),_0x35a97c)[_0xac4a('0x3a')](function(_0x24f464){var _0xfe8977=_[_0xac4a('0xb8')](_0x24f464,_0xac4a('0xb9'));var _0x7e403a=[];_0x388ed7[_0xac4a('0x41')](function(_0x15431a){_0x7e403a[_0xac4a('0x42')](updateChatInteraction(_0x15431a,_0x2af87f,_0xfe8977));});return BPromise[_0xac4a('0xba')](_0x7e403a);});});})[_0xac4a('0x3a')](function(_0x47a834){_0x3f31d1[_0xac4a('0xbb')]=_0x47a834;return _0x3f31d1;})['then'](respondWithFilteredResult(_0x3e9973,_0x3edb19));})[_0xac4a('0x2e')](handleError(_0x3e9973,null));};exports[_0xac4a('0xbc')]=function(_0x54a02e,_0x3cd213){var _0x31d190={'raw':![],'where':{'id':_0x54a02e[_0xac4a('0xbd')]['id']}},_0x1b10ad={};_0x1b10ad[_0xac4a('0x48')]=_['keys'](db[_0xac4a('0x44')]['rawAttributes']);_0x1b10ad[_0xac4a('0x49')]=_[_0xac4a('0x4a')](_0x54a02e[_0xac4a('0x49')]);_0x1b10ad[_0xac4a('0x4b')]=_['intersection'](_0x1b10ad[_0xac4a('0x48')],_0x1b10ad['query']);_0x31d190[_0xac4a('0x4d')]=_[_0xac4a('0x4c')](_0x1b10ad[_0xac4a('0x48')],qs['fields'](_0x54a02e[_0xac4a('0x49')][_0xac4a('0x4e')]));_0x31d190[_0xac4a('0x4d')]=_0x31d190['attributes'][_0xac4a('0x6b')]?_0x31d190[_0xac4a('0x4d')]:_0x1b10ad[_0xac4a('0x48')];if(_0x54a02e[_0xac4a('0x49')][_0xac4a('0xbe')]){_0x31d190[_0xac4a('0xbf')]=[{'all':!![]}];}_0x31d190=_[_0xac4a('0xa4')]({},_0x31d190,_0x54a02e[_0xac4a('0xc0')]);return db['ChatInteraction'][_0xac4a('0x76')](_0x31d190)['then'](handleEntityNotFound(_0x3cd213,null))['then'](respondWithResult(_0x3cd213,null))['catch'](handleError(_0x3cd213,null));};exports['create']=function(_0x502275,_0x261e4c){return db[_0xac4a('0x44')][_0xac4a('0xc1')](_0x502275[_0xac4a('0x82')],{})[_0xac4a('0x3a')](respondWithResult(_0x261e4c,0xc9))['catch'](handleError(_0x261e4c,null));};exports[_0xac4a('0x39')]=function(_0xc7f914,_0x332a69){if(_0xc7f914[_0xac4a('0x82')]['id']){delete _0xc7f914[_0xac4a('0x82')]['id'];}return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0xc7f914[_0xac4a('0xbd')]['id']}})['then'](handleEntityNotFound(_0x332a69,null))[_0xac4a('0x3a')](saveUpdates(_0xc7f914[_0xac4a('0x82')],null))[_0xac4a('0x3a')](respondWithResult(_0x332a69,null))[_0xac4a('0x2e')](handleError(_0x332a69,null));};exports[_0xac4a('0xc2')]=function(_0x154fa2,_0x13360e){return db['ChatInteraction']['find']({'where':{'id':_0x154fa2[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x13360e,null))['then'](removeEntity(_0x13360e,null))[_0xac4a('0x2e')](handleError(_0x13360e,null));};exports[_0xac4a('0xc3')]=function(_0x503880,_0x5bd013){return db[_0xac4a('0x44')][_0xac4a('0xc3')]()[_0xac4a('0x3a')](respondWithResult(_0x5bd013,null))[_0xac4a('0x2e')](handleError(_0x5bd013,null));};exports[_0xac4a('0xc4')]=function(_0x4ab840,_0x19e340){var _0x5e9cb2=_0x4ab840['params']['id'];var _0x538cfd;var _0x63c30;var _0x4301c3;return db[_0xac4a('0x44')][_0xac4a('0xc5')]({'where':{'id':_0x5e9cb2}})[_0xac4a('0x3a')](function(_0x24cb52){_0x538cfd=_0x24cb52;return db[_0xac4a('0xc6')][_0xac4a('0xc5')]({'where':{'id':_0x24cb52['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation'],'raw':!![]});})[_0xac4a('0x3a')](function(_0x279852){if(_0x279852&&_0x279852[_0xac4a('0xc7')]&&_0x279852[_0xac4a('0xc8')]){_0x63c30=_0x279852;var _0x214d74={'rejectUnauthorized':![],'method':_0xac4a('0xc9'),'uri':_0xac4a('0xca'),'headers':{'X-APIKEY':_0x279852[_0xac4a('0xc7')]},'body':{'name':_0xac4a('0xcb')+_0x5e9cb2},'redirect':_0xac4a('0xcc'),'json':!![]};return rp(_0x214d74);}else{throw new db[(_0xac4a('0x20'))][(_0xac4a('0x21'))](_0xac4a('0xcd'));}})[_0xac4a('0x3a')](function(_0x356a6b){_0x4301c3=_0x356a6b;if(_0x4301c3['id']){var _0x34b93c={'body':_0x4301c3[_0xac4a('0xce')],'ChatWebsiteId':_0x63c30['id'],'ChatInteractionId':_0x538cfd['id'],'direction':_0xac4a('0xcf'),'UserId':_0x4ab840[_0xac4a('0x9e')]['id']};return db[_0xac4a('0xd0')][_0xac4a('0xc1')](_0x34b93c,{});}else{throw new db[(_0xac4a('0x20'))][(_0xac4a('0x21'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xac4a('0x3a')](function(){return _0x538cfd[_0xac4a('0xd1')]({'vidaooSessionId':_0x4301c3['id']});})[_0xac4a('0x3a')](respondWithResult(_0x19e340,null))[_0xac4a('0x2e')](handleError(_0x19e340,null));};exports[_0xac4a('0xd2')]=function(_0x31afd2,_0x2652f5){if(_0x31afd2[_0xac4a('0x82')]['id']){delete _0x31afd2['body']['id'];}return db['ChatInteraction'][_0xac4a('0x76')]({'where':{'id':_0x31afd2[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x2652f5,null))['then'](saveUpdates(_0x31afd2['body'],null))['then'](respondWithResult(_0x2652f5,null))[_0xac4a('0x2e')](handleError(_0x2652f5,null));};exports['abandon']=function(_0x59e82c,_0x216055,_0x52963c){if(_0x59e82c[_0xac4a('0x82')]['id']){delete _0x59e82c['body']['id'];}return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x59e82c[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](function(_0x403a16){if(!_0x403a16){logger[_0xac4a('0x2a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xac4a('0xd3'),0x194,_0xac4a('0xd4'));_0x216055[_0xac4a('0x2f')](0x194);}else{if(_0x403a16['UserId']){throw new db[(_0xac4a('0x20'))][(_0xac4a('0x21'))](_0xac4a('0xd5'));}}return _0x403a16;})[_0xac4a('0x3a')](function(_0x5bb911){if(_0x5bb911){return _0x5bb911[_0xac4a('0x39')]({'closed':_0x59e82c[_0xac4a('0x82')][_0xac4a('0xd6')],'disposition':_0x59e82c[_0xac4a('0x82')][_0xac4a('0xd7')]})[_0xac4a('0x3a')](function(_0x4a0cd9){return _0x4a0cd9;});}})['then'](function(_0x175f73){return respondWithRpcPromise(_0xac4a('0xd8'),_0xac4a('0xd3'),_0x59e82c[_0xac4a('0x82')],client9004);})[_0xac4a('0x3a')](respondWithResult(_0x216055,null))[_0xac4a('0x2e')](handleError(_0x216055,null));};exports['attachmentUpload']=function(_0x21a6f6,_0x580c9b,_0xe4165d){_0x21a6f6['body'][_0xac4a('0x3b')]=_0x21a6f6[_0xac4a('0xd9')][_0xac4a('0xda')];_0x21a6f6[_0xac4a('0x82')]['basename']=_0x21a6f6[_0xac4a('0xd9')][_0xac4a('0xdb')];_0x21a6f6[_0xac4a('0x82')][_0xac4a('0x47')]=_0x21a6f6[_0xac4a('0xd9')]['mimetype'];return db[_0xac4a('0xdc')][_0xac4a('0xc1')](_0x21a6f6[_0xac4a('0x82')])[_0xac4a('0x3a')](respondWithResult(_0x580c9b,0xc9))[_0xac4a('0x2e')](handleError(_0x580c9b,null));};exports['attachmentDownload']=function(_0x40f41a,_0x4f8908,_0xc2798f){return db[_0xac4a('0x44')][_0xac4a('0xc5')]({'where':{'id':_0x40f41a['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4f8908,null))['then'](function(_0x50d438){if(_0x50d438){if(_0x50d438[_0xac4a('0xd6')]){return _0x4f8908[_0xac4a('0x30')](0x193)[_0xac4a('0x32')]({'status':0x193,'message':_0xac4a('0xdd')});}return db[_0xac4a('0xdc')]['findOne']({'where':{'id':_0x40f41a[_0xac4a('0x49')][_0xac4a('0xde')]},'raw':!![]})['then'](handleEntityNotFound(_0x4f8908,null));}})[_0xac4a('0x3a')](function(_0x14b425){if(_0x14b425){return _0x4f8908[_0xac4a('0xdf')](path['join'](config[_0xac4a('0xe0')],_0xac4a('0xe1'),_0x14b425[_0xac4a('0xe2')]));}})[_0xac4a('0x2e')](handleError(_0x4f8908,null));};exports[_0xac4a('0xe3')]=function(_0x28a2dc,_0x3f9277){var _0x4351ad=null;var _0x4163f0=null;var _0x5ea1e4=null;var _0xb2b3ca=null;if(_0x28a2dc[_0xac4a('0x82')]['id']){delete _0x28a2dc['body']['id'];}if(_0x28a2dc[_0xac4a('0x82')]['mailTranscript']){_0xb2b3ca=path[_0xac4a('0xe4')](config[_0xac4a('0xe0')],'server/files/chat/upload/',util[_0xac4a('0xe5')](_0xac4a('0xe6'),Date[_0xac4a('0xe7')]()));_0x28a2dc[_0xac4a('0x82')][_0xac4a('0xe8')]=_0xb2b3ca;}return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x28a2dc[_0xac4a('0xbd')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xac4a('0x7e')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x3f9277,null))[_0xac4a('0x3a')](saveUpdates(_0x28a2dc[_0xac4a('0x82')],null))[_0xac4a('0x3a')](function(_0x516225){if(_0x516225){_0x4351ad=_0x516225;return db[_0xac4a('0xc6')][_0xac4a('0x76')]({'where':{'id':_0x4351ad['ChatWebsiteId']}});}})['then'](function(_0x2e63f9){if(_0x2e63f9){_0x5ea1e4=_0x2e63f9;return db[_0xac4a('0xe9')][_0xac4a('0x76')]({'where':{'id':_0x4351ad[_0xac4a('0x77')]}});}})['then'](function(_0x421c27){if(_0x421c27){_0x4163f0=_0x421c27;if(_0xb2b3ca){var _0x4653f5=null;for(var _0x3a188e=0x1;_0x3a188e<_0x4351ad['Messages'][_0xac4a('0x6b')];++_0x3a188e){_0x4653f5=_0x4351ad[_0xac4a('0xea')][_0x3a188e];var _0x15b97a=_0x4653f5[_0xac4a('0x81')]?util[_0xac4a('0xe5')]('%s%d',_0x5ea1e4['agentAlias'],_0x4653f5[_0xac4a('0x81')]):_0xac4a('0xeb');var _0x1774e5=_0x28a2dc[_0xac4a('0x82')][_0xac4a('0xec')]||util[_0xac4a('0xe5')](_0xac4a('0xed'),_0xac4a('0xee'),_0x4653f5[_0xac4a('0x77')]);switch(_0x5ea1e4[_0xac4a('0xef')]){case _0xac4a('0xf0'):_0x15b97a=_0x4653f5[_0xac4a('0x81')]?util[_0xac4a('0xe5')]('%s%d',_0x5ea1e4[_0xac4a('0xf1')],_0x4653f5['UserId']):'System';break;case _0xac4a('0xf2'):_0x15b97a=_0x4653f5[_0xac4a('0x81')]?_0x4653f5[_0xac4a('0x7e')][_0xac4a('0xf3')]||_0x4653f5[_0xac4a('0x7e')][_0xac4a('0xf4')]:_0xac4a('0xeb');break;case _0xac4a('0xf5'):_0x15b97a=_0x4653f5[_0xac4a('0x81')]?_0x4653f5['User'][_0xac4a('0xf4')]:_0xac4a('0xeb');break;default:_0x15b97a=_0x4653f5[_0xac4a('0x81')]?util[_0xac4a('0xe5')]('%s%d',_0x5ea1e4['agentAlias'],_0x4653f5[_0xac4a('0x81')]):_0xac4a('0xeb');}var _0x20da5e=util[_0xac4a('0xe5')](_0xac4a('0xf6'),moment(_0x4653f5[_0xac4a('0xf7')])[_0xac4a('0xe5')](_0xac4a('0xf8')),_0x4653f5[_0xac4a('0xf9')]==='in'?_0x1774e5:_0x15b97a,_0x4653f5['body']);if(!_0x4653f5[_0xac4a('0xfa')]){fs[_0xac4a('0xfb')](_0xb2b3ca,_0x20da5e);}}return db[_0xac4a('0xfc')][_0xac4a('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0xac4a('0xfd')],'as':_0xac4a('0xfe'),'raw':!![]}]});}}})['then'](function(_0x4a1133){if(_0x4a1133&&_0x4a1133['Smtp']&&_0x28a2dc[_0xac4a('0x82')]){var _0x321072={'tls':{'rejectUnauthorized':![]}};if(_0x4a1133['Smtp']['service']){_0x321072[_0xac4a('0xff')]=_0x4a1133['Smtp'][_0xac4a('0xff')];}else{_0x321072['host']=_0x4a1133[_0xac4a('0xfe')][_0xac4a('0x100')];_0x321072[_0xac4a('0x101')]=_0x4a1133['Smtp'][_0xac4a('0x101')];_0x321072[_0xac4a('0x102')]=_0x4a1133['Smtp'][_0xac4a('0x102')];}if(_0x4a1133[_0xac4a('0xfe')]['authentication']){_0x321072['auth']={'user':_0x4a1133[_0xac4a('0xfe')][_0xac4a('0x9e')],'pass':_0x4a1133[_0xac4a('0xfe')][_0xac4a('0x103')]};}return respondWithRpcPromise(_0xac4a('0x104'),_0xac4a('0x105'),{'account':_0x321072,'message':{'from':util[_0xac4a('0xe5')](_0xac4a('0x106'),_0x4a1133[_0xac4a('0x3b')],_0x4a1133[_0xac4a('0x107')]||_0x4a1133[_0xac4a('0xfe')][_0xac4a('0x9e')]),'to':_0x28a2dc[_0xac4a('0x82')][_0xac4a('0x108')],'subject':_0xac4a('0x109'),'text':util[_0xac4a('0xe5')](_0xac4a('0x10a'),_0x28a2dc['body'][_0xac4a('0x108')]),'attachments':[{'path':_0xb2b3ca}]}})['then'](function(){return _0x4351ad;})[_0xac4a('0x2e')](function(_0x901233){console[_0xac4a('0x2a')](_0x901233);});}else{return _0x4351ad;}})[_0xac4a('0x3a')](respondWithStatusCode(_0x3f9277,0xc8))[_0xac4a('0x2e')](handleError(_0x3f9277,null));};exports[_0xac4a('0x10b')]=function(_0x8281c9,_0x5c7b5f,_0x368eae){return db['ChatMessage'][_0xac4a('0x76')]({'where':{'id':_0x8281c9[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x5c7b5f,null))[_0xac4a('0x3a')](function(_0x1a06be){if(_0x1a06be){return _0x1a06be[_0xac4a('0x10b')](_0x8281c9[_0xac4a('0x82')][_0xac4a('0x10c')],_['omit'](_0x8281c9[_0xac4a('0x82')],[_0xac4a('0x10c'),'id'])||{});}})[_0xac4a('0x3a')](respondWithResult(_0x5c7b5f,null))[_0xac4a('0x2e')](handleError(_0x5c7b5f,null));};exports['getMessages']=function(_0x24c40c,_0x21ddef,_0x38ecd8){var _0x53ce1f={'raw':![],'where':{}};var _0x55ea84={};var _0x40c49b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xac4a('0xc5')]({'where':{'id':_0x24c40c['params']['id']}})['then'](handleEntityNotFound(_0x21ddef,null))[_0xac4a('0x3a')](function(_0x1b952a){if(_0x1b952a){_0x55ea84[_0xac4a('0x48')]=_['keys'](db[_0xac4a('0xd0')][_0xac4a('0x45')]);_0x55ea84['query']=_[_0xac4a('0x4a')](_0x24c40c[_0xac4a('0x49')]);_0x55ea84['filters']=_[_0xac4a('0x4c')](_0x55ea84[_0xac4a('0x48')],_0x55ea84[_0xac4a('0x49')]);_0x53ce1f[_0xac4a('0x4d')]=_[_0xac4a('0x4c')](_0x55ea84[_0xac4a('0x48')],qs[_0xac4a('0x4e')](_0x24c40c[_0xac4a('0x49')]['fields']));_0x53ce1f[_0xac4a('0x4d')]=_0x53ce1f['attributes'][_0xac4a('0x6b')]?_0x53ce1f[_0xac4a('0x4d')]:_0x55ea84[_0xac4a('0x48')];if(!_0x24c40c[_0xac4a('0x49')][_0xac4a('0x4f')](_0xac4a('0x10d'))){_0x53ce1f['limit']=qs[_0xac4a('0x50')](_0x24c40c[_0xac4a('0x49')][_0xac4a('0x50')]);_0x53ce1f[_0xac4a('0x34')]=qs[_0xac4a('0x34')](_0x24c40c[_0xac4a('0x49')][_0xac4a('0x34')]);}_0x53ce1f[_0xac4a('0x98')]=qs['sort'](_0x24c40c[_0xac4a('0x49')]['sort']);_0x53ce1f[_0xac4a('0x52')]=qs[_0xac4a('0x4b')](_[_0xac4a('0x53')](_0x24c40c[_0xac4a('0x49')],_0x55ea84['filters']));_0x53ce1f['where'][_0xac4a('0xb9')]=_0x1b952a['id'];if(_0x24c40c[_0xac4a('0x49')][_0xac4a('0x8d')]){_0x53ce1f[_0xac4a('0x52')]=_[_0xac4a('0xa4')](_0x53ce1f[_0xac4a('0x52')],{'$or':_['map'](_0x53ce1f[_0xac4a('0x4d')],function(_0x301d17){var _0x2bf090={};_0x2bf090[_0x301d17]={'$like':'%'+_0x24c40c['query'][_0xac4a('0x8d')]+'%'};return _0x2bf090;})});}if(_0x24c40c[_0xac4a('0x49')][_0xac4a('0x84')]){var _0x59ee77=_0x24c40c['query'][_0xac4a('0x84')][_0xac4a('0x40')](',');var _0x66f911={};_0x66f911[_0x59ee77[0x0]]={'$gte':moment(_0x59ee77[0x1])[_0xac4a('0xe5')](_0xac4a('0x10e'))};_0x53ce1f[_0xac4a('0x52')]=_[_0xac4a('0xa4')](_0x53ce1f[_0xac4a('0x52')],_0x66f911);}_0x53ce1f=_[_0xac4a('0xa4')]({},_0x53ce1f,_0x24c40c['options']);return db['ChatMessage'][_0xac4a('0x33')]({'where':_0x53ce1f[_0xac4a('0x52')]})[_0xac4a('0x3a')](function(_0x547ddc){_0x40c49b[_0xac4a('0x33')]=_0x547ddc;if(_0x24c40c[_0xac4a('0x49')][_0xac4a('0xbe')]){_0x53ce1f['include']=[{'all':!![]}];}return db['ChatMessage'][_0xac4a('0x10f')](_0x53ce1f);})['then'](function(_0x12b470){_0x40c49b[_0xac4a('0xbb')]=_0x12b470;return _0x40c49b;});}})['then'](respondWithFilteredResult(_0x21ddef,_0x53ce1f))[_0xac4a('0x2e')](handleError(_0x21ddef,null));};exports[_0xac4a('0x110')]=function(_0x4cc6b7,_0xb7cbe2,_0x139121){var _0x1f49f4={'where':{}},_0x304f70={},_0x45af61={'count':0x0,'rows':[]};return db[_0xac4a('0x44')][_0xac4a('0xc5')]({'where':{'id':_0x4cc6b7[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0xb7cbe2,null))['then'](function(_0x3c6316){if(_0x3c6316){_0x304f70[_0xac4a('0x48')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x304f70[_0xac4a('0x49')]=_[_0xac4a('0x4a')](_0x4cc6b7[_0xac4a('0x49')]);_0x304f70[_0xac4a('0x4b')]=_[_0xac4a('0x4c')](_0x304f70[_0xac4a('0x48')],_0x304f70[_0xac4a('0x49')]);_0x1f49f4[_0xac4a('0x4d')]=_['intersection'](_0x304f70['model'],qs['fields'](_0x4cc6b7[_0xac4a('0x49')]['fields']));_0x1f49f4['attributes']=_0x1f49f4[_0xac4a('0x4d')]['length']?_0x1f49f4['attributes']:_0x304f70['model'];if(!_0x4cc6b7[_0xac4a('0x49')][_0xac4a('0x4f')](_0xac4a('0x10d'))){_0x1f49f4[_0xac4a('0x50')]=qs[_0xac4a('0x50')](_0x4cc6b7[_0xac4a('0x49')][_0xac4a('0x50')]);_0x1f49f4[_0xac4a('0x34')]=qs[_0xac4a('0x34')](_0x4cc6b7[_0xac4a('0x49')][_0xac4a('0x34')]);}_0x1f49f4[_0xac4a('0x98')]=qs[_0xac4a('0x51')](_0x4cc6b7['query'][_0xac4a('0x51')]);_0x1f49f4['where']=qs[_0xac4a('0x4b')](_[_0xac4a('0x53')](_0x4cc6b7[_0xac4a('0x49')],_0x304f70[_0xac4a('0x4b')]));_0x1f49f4[_0xac4a('0x52')][_0xac4a('0xb9')]=_0x3c6316['id'];if(_0x4cc6b7['query'][_0xac4a('0x8d')]){_0x1f49f4[_0xac4a('0x52')]=_[_0xac4a('0xa4')](_0x1f49f4['where'],{'$or':_[_0xac4a('0x3d')](_0x1f49f4['attributes'],function(_0x2174e6){var _0xac96a8={};_0xac96a8[_0x2174e6]={'$like':'%'+_0x4cc6b7[_0xac4a('0x49')]['filter']+'%'};return _0xac96a8;})});}_0x1f49f4[_0xac4a('0x52')][_0xac4a('0xfa')]=![];if(_0x4cc6b7['query']['id']){_0x1f49f4[_0xac4a('0x52')]['id']={'$gt':_0x4cc6b7[_0xac4a('0x49')]['id']};}_0x1f49f4=_['merge']({},_0x1f49f4,_0x4cc6b7[_0xac4a('0xc0')]);return db['ChatMessage'][_0xac4a('0x33')]({'where':_0x1f49f4[_0xac4a('0x52')]})['then'](function(_0x4df536){_0x45af61['count']=_0x4df536;_0x1f49f4['include']=[];if(_0x4cc6b7[_0xac4a('0x49')]['includeAgent']){_0x1f49f4[_0xac4a('0xbf')][_0xac4a('0x42')]({'model':db[_0xac4a('0x7e')],'as':'User','attributes':['id',_0xac4a('0xf4'),_0xac4a('0xf3')]});}if(_0x4cc6b7[_0xac4a('0x49')]['includeAll']){_0x1f49f4[_0xac4a('0xbf')]=[{'all':!![]}];}return db['ChatMessage'][_0xac4a('0x10f')](_0x1f49f4);})[_0xac4a('0x3a')](function(_0x542774){_0x45af61[_0xac4a('0xbb')]=_0x542774;return _0x45af61;});}})[_0xac4a('0x3a')](respondWithFilteredResult(_0xb7cbe2,_0x1f49f4))[_0xac4a('0x2e')](handleError(_0xb7cbe2,null));};exports[_0xac4a('0x111')]=function(_0x4f6540,_0x405b6f,_0x291f03){return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x4f6540[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x405b6f,null))[_0xac4a('0x3a')](function(_0x4ecf72){if(_0x4ecf72){return _0x4ecf72['setTags'](_0x4f6540['body'][_0xac4a('0x10c')],_[_0xac4a('0x112')](_0x4f6540['body'],[_0xac4a('0x10c'),'id'])||{})[_0xac4a('0x113')](function(){return db[_0xac4a('0x7b')][_0xac4a('0x10f')]({'attributes':['id','name',_0xac4a('0x56')],'where':{'id':_0x4f6540['body'][_0xac4a('0x10c')]}});})[_0xac4a('0x3a')](function(_0x570a1b){socket[_0xac4a('0x114')]('chatInteractionTags:save',{'id':Number(_0x4f6540['params']['id']),'tags':_0x570a1b||[]});return{'id':Number(_0x4f6540['params']['id']),'tags':_0x570a1b||[]};});}})[_0xac4a('0x3a')](respondWithResult(_0x405b6f,null))[_0xac4a('0x2e')](handleError(_0x405b6f,null));};exports['removeTags']=function(_0x19cda4,_0x39e89d,_0x5cdbfd){return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x19cda4[_0xac4a('0xbd')]['id']}})[_0xac4a('0x3a')](handleEntityNotFound(_0x39e89d,null))[_0xac4a('0x3a')](function(_0x3f2d5f){if(_0x3f2d5f){return _0x3f2d5f[_0xac4a('0x115')](_0x19cda4[_0xac4a('0x49')][_0xac4a('0x10c')]);}})['then'](respondWithStatusCode(_0x39e89d,null))['catch'](handleError(_0x39e89d,null));};exports[_0xac4a('0xdf')]=function(_0x1f29a4,_0x18abfe){var _0x164b1b=moment()[_0xac4a('0x116')]()['toString']();var _0x74964b=path['join'](config['root'],'server','files',_0xac4a('0x117'));var _0x19cb07=path['join'](config[_0xac4a('0xe0')],'server',_0xac4a('0x118'),_0xac4a('0x119'));var _0x25c15c=path['join'](_0x74964b,_0x164b1b);var _0x3a49fb=util[_0xac4a('0xe5')]('transcript-%d-%s.zip',_0x1f29a4[_0xac4a('0xbd')]['id'],_0x164b1b);var _0xa6ba37=path['join'](_0x74964b,_0x3a49fb);var _0x333d3a=[];_0x333d3a[_0xac4a('0x42')]({'model':db[_0xac4a('0x7e')],'as':_0xac4a('0x7e'),'attributes':['id',_0xac4a('0xf4')],'raw':!![]});_0x333d3a[_0xac4a('0x42')]({'model':db['CmContact'],'as':_0xac4a('0x11a'),'attributes':['id',_0xac4a('0x11b'),_0xac4a('0x11c')],'raw':!![]});if(_0x1f29a4[_0xac4a('0x49')]['attachments']){_0x333d3a[_0xac4a('0x42')]({'model':db['Attachment'],'as':_0xac4a('0xdc'),'raw':!![]});}var _0x1182ed=[{'model':db[_0xac4a('0xd0')],'as':_0xac4a('0xea'),'attributes':['id',_0xac4a('0x82'),_0xac4a('0xf7'),_0xac4a('0xf9'),_0xac4a('0xfa'),'read'],'include':_0x333d3a}];_0x1182ed['push']({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x11d'),'attributes':['id',_0xac4a('0x3b')]});_0x1182ed[_0xac4a('0x42')]({'model':db['User'],'as':_0xac4a('0x11e'),'attributes':['id',_0xac4a('0xf4')]});return db[_0xac4a('0x44')][_0xac4a('0x76')]({'where':{'id':_0x1f29a4[_0xac4a('0xbd')]['id']},'include':_0x1182ed})[_0xac4a('0x3a')](handleEntityNotFound(_0x18abfe,null))[_0xac4a('0x3a')](function(_0x201a1d){if(_0x201a1d){var _0x445733=_0x201a1d['get']({'plain':!![]});fs[_0xac4a('0x11f')](_0x25c15c);var _0x5b61f1={'format':'A4','border':_0xac4a('0x120'),'header':{'height':_0xac4a('0x121'),'contents':{'first':_0xac4a('0x122')}},'footer':{'height':_0xac4a('0x123'),'contents':{'default':util[_0xac4a('0xe5')](_0xac4a('0x124'),util[_0xac4a('0xe5')]('%s\x20#%d',_0xac4a('0x125'),_0x445733['id']),moment()[_0xac4a('0xe5')]('YYYY-MM-DD')[_0xac4a('0xa2')]())}}};var _0x41c5f9={'channel':_0xac4a('0x125'),'account':_0x445733[_0xac4a('0x11d')][_0xac4a('0x3b')],'agent':_0x445733['Owner']?_0x445733[_0xac4a('0x11e')][_0xac4a('0xf4')]:_0xac4a('0x126'),'createdAt':moment(_0x445733[_0xac4a('0xf7')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xac4a('0xa2')](),'closedAt':_0x445733['closed']?moment(_0x445733[_0xac4a('0x127')])[_0xac4a('0xe5')](_0xac4a('0x10e'))[_0xac4a('0xa2')]():'','disposition':_0x445733[_0xac4a('0xd7')],'chatInfo':{'browser':_0x445733[_0xac4a('0x128')],'os':_0x445733[_0xac4a('0x129')],'referer':_0x445733[_0xac4a('0x12a')],'customerIp':_0x445733[_0xac4a('0x12b')],'customerPort':_0x445733[_0xac4a('0x12c')]?_0x445733[_0xac4a('0x12c')]:'N.A.'},'messages':_(_0x445733['Messages'])[_0xac4a('0x12d')]()[_0xac4a('0x8d')]({'secret':![]})[_0xac4a('0x3d')](function(_0x482c0e){if(_0x482c0e['Attachment']){var _0x1430aa=path[_0xac4a('0xe4')](_0x19cb07,_0x482c0e['Attachment'][_0xac4a('0xe2')]);if(fs[_0xac4a('0x12e')](_0x1430aa)){fs['createReadStream'](_0x1430aa)[_0xac4a('0x12f')](fs[_0xac4a('0x130')](path['join'](_0x25c15c,_0x482c0e[_0xac4a('0xdc')]['basename'])));}}return{'date':moment(_0x482c0e[_0xac4a('0xf7')])[_0xac4a('0xe5')](_0xac4a('0x10e'))['toString'](),'sender':_0x482c0e[_0xac4a('0xf9')]===_0xac4a('0xcf')?_0x482c0e['User']?_0x482c0e['User'][_0xac4a('0xf4')]:_0xac4a('0xeb'):_0x482c0e[_0xac4a('0x11a')]['firstName']+(_0x482c0e[_0xac4a('0x11a')][_0xac4a('0x11c')]?'\x20'+_0x482c0e[_0xac4a('0x11a')][_0xac4a('0x11c')]:''),'body':_0x482c0e[_0xac4a('0xdc')]?_0x482c0e[_0xac4a('0xdc')][_0xac4a('0xe2')]:_0x482c0e[_0xac4a('0x82')],'direction':_0x482c0e[_0xac4a('0xf9')]===_0xac4a('0xcf')?'A':'C','secret':_0x482c0e[_0xac4a('0xfa')],'read':_0x482c0e['read'],'attachment':_0x482c0e['Attachment']};})['value']()};return ejs[_0xac4a('0x131')](path[_0xac4a('0xe4')](config[_0xac4a('0xe0')],_0xac4a('0x132'),_0xac4a('0x133'),'downloadInteraction.html'),{'interaction':_0x41c5f9})[_0xac4a('0x3a')](function(_0x4e6941){return new BPromise(function(_0x6d09cb,_0x2f1740){pdf['create'](_0x4e6941,_0x5b61f1)[_0xac4a('0x134')](path['join'](_0x25c15c,_0xac4a('0x135')+_0x445733['id']+'-'+_0x164b1b+_0xac4a('0x136')),function(_0x1bac90,_0x3fd4a1){if(_0x1bac90)return _0x2f1740(_0x1bac90);_0x6d09cb(_0x3fd4a1);});});})['then'](function(){return new BPromise(function(_0x22e964,_0x3223e0){zipdir(_0x25c15c,{'saveTo':_0xa6ba37},function(_0x5ab5c9,_0xdd2709){if(_0x5ab5c9)return _0x3223e0(_0x5ab5c9);return _0x22e964(_0xdd2709);});})['then'](function(){return new BPromise(function(_0x111744,_0x982cd2){rimraf(_0x25c15c,function(_0x3c9a66){if(_0x3c9a66)_0x982cd2(_0x3c9a66);return _0x111744();});});})['then'](function(){return _0x18abfe[_0xac4a('0xdf')](_0xa6ba37,_0x3a49fb,function(_0x386700){if(_0x386700){console[_0xac4a('0x137')]('err',_0x386700);}else{fs[_0xac4a('0x138')](_0xa6ba37);}});});});}else{return _0x18abfe['sendStatus'](0xc8);}})[_0xac4a('0x2e')](handleError(_0x18abfe,null));}; \ No newline at end of file +var _0x90b1=['c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','keys','includeAll','include','create','body','describe','findOne','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','vidaooApiKey','Error\x20in\x20Vidaoo\x20configuration','join_url','out','user','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','file','originalname','filename','mimetype','Attachment','attachmentDownload','attachId','download','join','root','server/files/attachments/','basename','server/files/chat/upload/','now','pathTranscript','Messages','ChatWebsite','CmContact','format','%s%d','customer','Visitor','agentIdentifier','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','Smtp','service','host','port','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','pick','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','secret','options','includeAgent','findAll','addTags','spread','emit','chatInteractionTags:save','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Account','Owner','N.A.','browserName','osName','referer','customerIp','existsSync','createReadStream','pipe','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','ejs','lodash','squel','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','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','test','ValidationError','request','then','info','request\x20sent','debug','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','end','name','send','Users','fullname','Tags','split','forEach','push','TagIds','ChatInteraction','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','text','some','compact','isEmpty','ChatWebsiteId','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x90b1,0x1bb));var _0x190b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x90b1[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0x190b('0x0'));var emlformat=require(_0x190b('0x1'));var rimraf=require(_0x190b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x190b('0x3'));var moment=require(_0x190b('0x4'));var BPromise=require(_0x190b('0x5'));var Mustache=require(_0x190b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x190b('0x7'));var fs=require('fs');var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var db=require(_0x190b('0x17'))['db'];config['redis']=_[_0x190b('0x18')](config[_0x190b('0x19')],{'host':_0x190b('0x1a'),'port':0x18eb});var socket=require(_0x190b('0x1b'))(new Redis(config[_0x190b('0x19')]));require(_0x190b('0x1c'))[_0x190b('0x1d')](socket);var jayson=require(_0x190b('0x1e'));var client=jayson[_0x190b('0x1f')][_0x190b('0x20')]({'port':0x232b});var client9004=jayson[_0x190b('0x1f')][_0x190b('0x20')]({'port':0x232c});function checkPasswordPattern(_0xab346,_0x3e8781,_0x3fbfc3){if(_0x3fbfc3){var _0x121867=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x121867[_0x190b('0x21')](_0x3e8781)){return _0xab346;}else{throw new db['Sequelize'][(_0x190b('0x22'))]('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 _0xab346;}}function respondWithRpcPromise(_0x2a9323,_0x21e458,_0x56d07a,_0x16c009){return new BPromise(function(_0x50a3c4,_0x298343){var _0x22d946=_0x16c009||client;return _0x22d946[_0x190b('0x23')](_0x2a9323,_0x56d07a)[_0x190b('0x24')](function(_0x1b5427){logger[_0x190b('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x21e458,_0x190b('0x26'));logger[_0x190b('0x27')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x21e458,_0x190b('0x26'),JSON['stringify'](_0x1b5427));if(_0x1b5427['error']){if(_0x1b5427[_0x190b('0x28')][_0x190b('0x29')]===0x1f4){logger[_0x190b('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x21e458,_0x1b5427[_0x190b('0x28')][_0x190b('0x2a')]);return _0x298343(_0x1b5427[_0x190b('0x28')][_0x190b('0x2a')]);}logger[_0x190b('0x28')](_0x190b('0x2b'),_0x21e458,_0x1b5427[_0x190b('0x28')]['message']);return _0x50a3c4(_0x1b5427['error'][_0x190b('0x2a')]);}else{logger[_0x190b('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x21e458,'request\x20sent');_0x50a3c4(_0x1b5427[_0x190b('0x2c')]['message']);}})[_0x190b('0x2d')](function(_0x3b6aaf){logger['error'](_0x190b('0x2b'),_0x21e458,_0x3b6aaf);_0x298343(_0x3b6aaf);});});}function respondWithStatusCode(_0x1deea6,_0x5c89ab){_0x5c89ab=_0x5c89ab||0xcc;return function(_0xa9d6f7){if(_0xa9d6f7){return _0x1deea6[_0x190b('0x2e')](_0x5c89ab);}return _0x1deea6[_0x190b('0x2f')](_0x5c89ab)['end']();};}function respondWithResult(_0x536d7b,_0x3730cc){_0x3730cc=_0x3730cc||0xc8;return function(_0x4d5f3f){if(_0x4d5f3f){return _0x536d7b[_0x190b('0x2f')](_0x3730cc)[_0x190b('0x30')](_0x4d5f3f);}};}function respondWithFilteredResult(_0x5b9cb6,_0x29775f){return function(_0x580b92){if(_0x580b92){var _0x40d060=_0x580b92[_0x190b('0x31')],_0x4ff5a6=_0x29775f[_0x190b('0x32')],_0x19600d=_0x29775f['offset']+_0x29775f[_0x190b('0x33')],_0x5650e1;if(_0x19600d>=_0x40d060){_0x19600d=_0x40d060;_0x5650e1=0xc8;}else{_0x5650e1=0xce;}_0x5b9cb6[_0x190b('0x2f')](_0x5650e1);return _0x5b9cb6[_0x190b('0x34')](_0x190b('0x35'),_0x4ff5a6+'-'+_0x19600d+'/'+_0x40d060)[_0x190b('0x30')](_0x580b92);}return null;};}function patchUpdates(_0x360d04){return function(_0x309065){try{jsonpatch[_0x190b('0x36')](_0x309065,_0x360d04,!![]);}catch(_0x599da4){return BPromise['reject'](_0x599da4);}return _0x309065[_0x190b('0x37')]();};}function saveUpdates(_0x2e44ed,_0x58113b){return function(_0x51dea7){if(_0x51dea7){return _0x51dea7[_0x190b('0x38')](_0x2e44ed)[_0x190b('0x24')](function(_0x3fbba1){return _0x3fbba1;});}return null;};}function removeEntity(_0x3b6f3f,_0x228c73){return function(_0x5bda80){if(_0x5bda80){return _0x5bda80['destroy']()['then'](function(){_0x3b6f3f[_0x190b('0x2f')](0xcc)[_0x190b('0x39')]();});}};}function handleEntityNotFound(_0x1a950d,_0x5e55ab){return function(_0x33e9db){if(!_0x33e9db){_0x1a950d[_0x190b('0x2e')](0x194);}return _0x33e9db;};}function handleError(_0x2e468b,_0x5a9669){_0x5a9669=_0x5a9669||0x1f4;return function(_0x2a8260){logger['error'](_0x2a8260['stack']);if(_0x2a8260[_0x190b('0x3a')]){delete _0x2a8260[_0x190b('0x3a')];}_0x2e468b['status'](_0x5a9669)[_0x190b('0x3b')](_0x2a8260);};}function getInteractionUsers(_0xfd0d62,_0x161756){return new BPromise(function(_0x5a9cba,_0xde2b0b){try{if(_0x161756[_0xfd0d62['id']]){_0xfd0d62[_0x190b('0x3c')]=_['map'](_0x161756[_0xfd0d62['id']],function(_0x5d006d){return{'id':_0x5d006d['id'],'fullname':_0x5d006d[_0x190b('0x3d')]};});}}catch(_0x4ab72d){_0xde2b0b(_0x4ab72d);}_0x5a9cba(_0xfd0d62);});}function getInteractionTags(_0x46bdba,_0x741e94){return new BPromise(function(_0x43f168,_0xad955a){try{if(_0x46bdba['TagIds']){_0x46bdba[_0x190b('0x3e')]=[];_0x46bdba['TagIds'][_0x190b('0x3f')](',')[_0x190b('0x40')](function(_0x47c488){_0x46bdba[_0x190b('0x3e')][_0x190b('0x41')](_0x741e94[_0x47c488]);});}delete _0x46bdba[_0x190b('0x42')];}catch(_0x5d9548){_0xad955a(_0x5d9548);}_0x43f168(_0x46bdba);});}function updateChatInteraction(_0x2c7c0e,_0x598a46,_0x550717){return new BPromise(function(_0x554486,_0x2cfff0){return getInteractionUsers(_0x2c7c0e,_0x550717)[_0x190b('0x24')](function(_0x411cb5){return getInteractionTags(_0x411cb5,_0x598a46);})[_0x190b('0x24')](function(_0x48b2fa){_0x554486(_0x48b2fa);})['catch'](function(_0x4045b7){_0x2cfff0(_0x4045b7);});});}exports['index']=function(_0x110891,_0x3d67f0){var _0x497c5e={},_0x2e25e3={},_0x36db47={'count':0x0,'rows':[]};var _0x457c14=_['map'](db[_0x190b('0x43')][_0x190b('0x44')],function(_0x49512e){return{'name':_0x49512e[_0x190b('0x45')],'type':_0x49512e['type'][_0x190b('0x46')]};});_0x2e25e3[_0x190b('0x47')]=_[_0x190b('0x48')](_0x457c14,'name');_0x2e25e3[_0x190b('0x49')]=_['keys'](_0x110891[_0x190b('0x49')]);_0x2e25e3[_0x190b('0x4a')]=_[_0x190b('0x4b')](_0x2e25e3[_0x190b('0x47')],_0x2e25e3[_0x190b('0x49')]);_0x497c5e[_0x190b('0x4c')]=_[_0x190b('0x4b')](_0x2e25e3['model'],qs[_0x190b('0x4d')](_0x110891[_0x190b('0x49')][_0x190b('0x4d')]));_0x497c5e['attributes']=_0x497c5e[_0x190b('0x4c')][_0x190b('0x4e')]?_0x497c5e[_0x190b('0x4c')]:_0x2e25e3[_0x190b('0x47')];if(!_0x110891[_0x190b('0x49')]['hasOwnProperty'](_0x190b('0x4f'))){_0x497c5e[_0x190b('0x33')]=qs[_0x190b('0x33')](_0x110891['query'][_0x190b('0x33')]);_0x497c5e[_0x190b('0x32')]=qs[_0x190b('0x32')](_0x110891['query']['offset']);}_0x497c5e[_0x190b('0x50')]=qs[_0x190b('0x51')](_0x110891[_0x190b('0x49')][_0x190b('0x51')]);_0x497c5e[_0x190b('0x52')]=qs[_0x190b('0x4a')](_['pick'](_0x110891[_0x190b('0x49')],_0x2e25e3[_0x190b('0x4a')]),_0x457c14);var _0x30b23b=[];var _0x5bb07a=squel[_0x190b('0x53')]()[_0x190b('0x54')]('id')[_0x190b('0x54')]('name')[_0x190b('0x54')](_0x190b('0x55'))[_0x190b('0x56')](_0x190b('0x57'));var _0x416533=squel[_0x190b('0x53')]()[_0x190b('0x54')](_0x190b('0x58'))[_0x190b('0x54')](_0x190b('0x59'))[_0x190b('0x54')]('ui.ChatInteractionId')[_0x190b('0x56')]('user_has_chat_interactions','ui')[_0x190b('0x5a')](_0x190b('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x2a5045=squel[_0x190b('0x53')]()[_0x190b('0x56')](_0x190b('0x5c'),'i')[_0x190b('0x5a')](_0x190b('0x5d'),'c',_0x190b('0x5e'))[_0x190b('0x5a')]('users','o',_0x190b('0x5f'))[_0x190b('0x5a')](_0x190b('0x60'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x190b('0x5a')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x190b('0x5a')](_0x190b('0x61'),'it',_0x190b('0x62'))[_0x190b('0x5a')](_0x190b('0x57'),'t',_0x190b('0x63'));var _0x1383e5=squel[_0x190b('0x64')]();var _0x3e9851=[];var _0x119ed7=squel[_0x190b('0x64')]();var _0x149902;if(_0x110891[_0x190b('0x49')][_0x190b('0x65')]){_0x149902=as['parseSearch'](_0x110891[_0x190b('0x49')][_0x190b('0x65')]);var _0x286355=_0x149902[_0x190b('0x66')];for(var _0x53d740=0x0;_0x53d740<_0x149902['conditions'][_0x190b('0x4e')];_0x53d740++){var _0x2083dc=_0x149902['conditions'][_0x53d740];var _0x1195f9='i';var _0x53cb6f=_[_0x190b('0x67')](_0x457c14,[_0x190b('0x3a'),_0x2083dc[_0x190b('0x54')]]);if(!_0x53cb6f){switch(_0x2083dc['field']){case _0x190b('0x68'):if(_0x2083dc[_0x190b('0x69')]==0x1){_0x2a5045[_0x190b('0x6a')]('`'+_0x2083dc[_0x190b('0x54')]+_0x190b('0x6b'));}else{_0x2a5045[_0x190b('0x6a')]('`'+_0x2083dc[_0x190b('0x54')]+_0x190b('0x6c'));}break;case _0x190b('0x6d'):if(_0x2083dc['operator']==='$substring'){if(_0x2083dc[_0x190b('0x69')][_0x190b('0x3f')]('\x20')[_0x190b('0x4e')]>0x1){_0x1383e5[_0x286355](_0x190b('0x6e'),qs['getFullTextValue'](_0x2083dc[_0x190b('0x69')]),null);}else{var _0x43003f='%'+_0x2083dc['value']+'%';_0x1383e5[_0x286355](_0x190b('0x6f'),_0x43003f,_0x43003f,_0x43003f);}}else{_0x53cb6f=_[_0x190b('0x67')](_0x457c14,[_0x190b('0x3a'),_0x190b('0x70')]);_0x2083dc[_0x190b('0x54')]=_0x190b('0x70');_0x5c2afd=as[_0x190b('0x71')](_0x1195f9,_0x53cb6f[_0x190b('0x72')],_0x2083dc);_0x1383e5[_0x286355](_0x5c2afd['text'],_0x5c2afd[_0x190b('0x69')]['start'],_0x5c2afd['value'][_0x190b('0x39')]);}break;case _0x190b('0x73'):var _0x2c4164=_0x2083dc['value']['split'](',')[_0x190b('0x48')](function(_0xdc7579){return Number(_0xdc7579);});_0x2c4164[_0x190b('0x40')](function(_0x126748){_0x119ed7['or'](_0x190b('0x74'),'%,'+_0x126748+',%');});_0x3e9851=_[_0x190b('0x75')](_0x3e9851,_0x2c4164);break;case _0x190b('0x76'):if(_0x2083dc[_0x190b('0x77')]==='$substring'){_0x1383e5[_0x286355](_0x190b('0x78'),'%'+_0x2083dc[_0x190b('0x69')]+'%',null);}else{_0x53cb6f=_[_0x190b('0x67')](_0x457c14,[_0x190b('0x3a'),_0x190b('0x79')]);_0x2083dc['field']=_0x190b('0x79');_0x5c2afd=as[_0x190b('0x71')](_0x1195f9,_0x53cb6f[_0x190b('0x72')],_0x2083dc);_0x1383e5[_0x286355](_0x5c2afd['text'],_0x5c2afd[_0x190b('0x69')][_0x190b('0x7a')],_0x5c2afd[_0x190b('0x69')][_0x190b('0x39')]);}break;case'body':_0x5c2afd=as[_0x190b('0x71')]('me',null,_0x2083dc);_0x1383e5[_0x286355](_0x5c2afd[_0x190b('0x7b')],_0x5c2afd[_0x190b('0x69')][_0x190b('0x7a')],_0x5c2afd['value'][_0x190b('0x39')]);break;}}else{var _0x5c2afd=as[_0x190b('0x71')](_0x1195f9,_0x53cb6f[_0x190b('0x72')],_0x2083dc);_0x1383e5[_0x286355](_0x5c2afd[_0x190b('0x7b')],_0x5c2afd[_0x190b('0x69')]['start'],_0x5c2afd[_0x190b('0x69')]['end']);}}}else{var _0x194eb5=_(_0x110891['query'])['keys']()[_0x190b('0x48')](function(_0x58bf93){return _[_0x190b('0x7c')](_0x457c14,[_0x190b('0x3a'),_0x58bf93])?_0x58bf93:undefined;})[_0x190b('0x7d')]()[_0x190b('0x69')]();if(!_[_0x190b('0x7e')](_0x194eb5)){_0x194eb5['forEach'](function(_0x2f9922){if(_0x2f9922===_0x190b('0x7f')){_0x2a5045[_0x190b('0x52')]('i.ChatWebsiteId\x20IN\x20?',[][_0x190b('0x80')](_0x110891[_0x190b('0x49')][_0x2f9922]));}else if(_0x2f9922==='createdAt'){var _0x3b1835=JSON[_0x190b('0x81')](_0x110891[_0x190b('0x49')][_0x2f9922])['$gte'];var _0x1446a4=JSON[_0x190b('0x81')](_0x110891[_0x190b('0x49')][_0x2f9922])[_0x190b('0x82')];_0x2a5045['where'](_0x190b('0x83'),_0x3b1835,_0x1446a4);}else{if(_0x110891[_0x190b('0x49')][_0x2f9922]===_0x190b('0x84')){_0x2a5045['where']('i.'+_0x2f9922+_0x190b('0x85'));}else{_0x2a5045[_0x190b('0x52')]('i.'+_0x2f9922+_0x190b('0x86'),_0x110891['query'][_0x2f9922]);}}});}if(_0x110891[_0x190b('0x49')][_0x190b('0x87')]){if(_0x110891[_0x190b('0x49')][_0x190b('0x87')]==0x1){_0x2a5045[_0x190b('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x2a5045['having'](_0x190b('0x88'));}}if(_0x110891[_0x190b('0x49')]['tag']){_0x3e9851=_[_0x190b('0x89')](_0x110891[_0x190b('0x49')]['tag'])?_0x110891['query'][_0x190b('0x8a')]:new Array(_0x110891[_0x190b('0x49')]['tag']);_0x3e9851['forEach'](function(_0x2d3811){_0x119ed7['or'](_0x190b('0x74'),'%,'+_0x2d3811+',%');});}if(_0x110891[_0x190b('0x49')][_0x190b('0x8b')]){var _0x172dbf=_0x110891['query']['filter'][_0x190b('0x8c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x190b('0x8d'));if(qs[_0x190b('0x8e')](_0x172dbf)){_0x1383e5['or'](_0x190b('0x8f'),_0x172dbf+'%');}else{_0x1383e5['or'](_0x190b('0x90'),qs[_0x190b('0x91')](_0x172dbf))['or'](_0x190b('0x92'),_0x172dbf+'%');}}}_0x2a5045[_0x190b('0x52')](_0x1383e5);_0x2a5045[_0x190b('0x93')](_0x190b('0x94'));var _0x1500a9={'type':db[_0x190b('0x95')]['QueryTypes'][_0x190b('0x96')],'raw':!![]};var _0x261cb2=_0x2a5045[_0x190b('0x97')]();_0x261cb2['field']('i.id');_0x261cb2[_0x190b('0x54')](_0x190b('0x98'),'unreadMessages');if(_0x497c5e[_0x190b('0x50')]){_0x497c5e[_0x190b('0x50')][_0x190b('0x40')](function(_0x591638){_0x2a5045[_0x190b('0x50')]('i.'+_0x591638[0x0],_0x591638[0x1]===_0x190b('0x99')?![]:!![]);});}if(!_['isEmpty'](_0x3e9851)){_0x2a5045[_0x190b('0x6a')](_0x119ed7);_0x261cb2[_0x190b('0x52')]('t.id\x20IN\x20?',_0x3e9851);}BPromise[_0x190b('0x9a')]()['then'](function(){if(!_0x149902){if(_0x110891['query']['ChatWebsiteId']||_0x110891['query'][_0x190b('0x9b')])return;_0x261cb2[_0x190b('0x52')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x2a5045[_0x190b('0x52')](_0x190b('0x9c'));return;}return _0x110891['user'][_0x190b('0x9d')]({'attributes':['id'],'raw':!![]})[_0x190b('0x24')](function(_0x3b55da){if(_[_0x190b('0x7e')](_0x3b55da)){_0x261cb2[_0x190b('0x52')](_0x190b('0x9e'));_0x2a5045[_0x190b('0x52')](_0x190b('0x9e'));}else{_0x261cb2[_0x190b('0x52')]('i.ChatWebsiteId\x20IN\x20?',_[_0x190b('0x48')](_0x3b55da,'id'));_0x2a5045['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x190b('0x48')](_0x3b55da,'id'));}});})[_0x190b('0x24')](function(){db[_0x190b('0x9f')][_0x190b('0x49')](_0x261cb2[_0x190b('0xa0')](),_0x1500a9)[_0x190b('0x24')](function(_0x3c5c11){_0x36db47[_0x190b('0x31')]=_0x3c5c11[_0x190b('0x4e')];if(_0x36db47[_0x190b('0x31')]===0x0)return[];return db[_0x190b('0x9f')][_0x190b('0x49')](_0x5bb07a['toString'](),_0x1500a9)[_0x190b('0x24')](function(_0x18ddf9){_0x30b23b=_[_0x190b('0xa1')](_0x18ddf9,'id');_0x1500a9=_[_0x190b('0xa2')](_0x1500a9,{'model':db[_0x190b('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x110891[_0x190b('0x49')][_0x190b('0x4d')]){_0x497c5e[_0x190b('0x4c')][_0x190b('0x40')](function(_0x4e35a4){_0x2a5045[_0x190b('0x54')]('i.'+_0x4e35a4);});}else{_0x2a5045[_0x190b('0x54')](_0x190b('0x98'),'unreadMessages');_0x2a5045[_0x190b('0x54')](_0x190b('0xa3'),'Account.key');_0x2a5045['field'](_0x190b('0xa4'),_0x190b('0xa5'));_0x2a5045[_0x190b('0x54')](_0x190b('0xa6'));_0x2a5045[_0x190b('0x54')](_0x190b('0xa7'),_0x190b('0xa8'));_0x2a5045[_0x190b('0x54')](_0x190b('0xa9'),_0x190b('0xaa'));_0x2a5045['field'](_0x190b('0xab'),_0x190b('0xac'));_0x2a5045[_0x190b('0x54')]('c.phone',_0x190b('0xad'));_0x2a5045[_0x190b('0x54')](_0x190b('0xae'),_0x190b('0xaf'));_0x2a5045[_0x190b('0x54')](_0x190b('0xb0'),'Contact.fax');_0x2a5045[_0x190b('0x54')](_0x190b('0xb1'),'Owner.fullname');_0x2a5045[_0x190b('0x54')](_0x190b('0xb2'),_0x190b('0xb3'));_0x2a5045[_0x190b('0x54')](_0x190b('0xb4'),_0x190b('0x42'));}if(_0x497c5e[_0x190b('0x33')])_0x2a5045[_0x190b('0x33')](_0x497c5e['limit']);if(_0x497c5e[_0x190b('0x32')])_0x2a5045[_0x190b('0x32')](_0x497c5e[_0x190b('0x32')]);return db[_0x190b('0x9f')]['query'](_0x2a5045[_0x190b('0xa0')](),_0x1500a9);})[_0x190b('0x24')](function(_0x5f3b98){_0x416533[_0x190b('0x52')](_0x190b('0xb5'),_[_0x190b('0x48')](_0x5f3b98,'id'));return db[_0x190b('0x9f')][_0x190b('0x49')](_0x416533[_0x190b('0xa0')](),_0x1500a9)[_0x190b('0x24')](function(_0x496c32){var _0x46f330=_[_0x190b('0xb6')](_0x496c32,_0x190b('0xb7'));var _0x4a320c=[];_0x5f3b98[_0x190b('0x40')](function(_0x48372b){_0x4a320c[_0x190b('0x41')](updateChatInteraction(_0x48372b,_0x30b23b,_0x46f330));});return BPromise[_0x190b('0xb8')](_0x4a320c);});});})[_0x190b('0x24')](function(_0x262bce){_0x36db47[_0x190b('0xb9')]=_0x262bce;return _0x36db47;})[_0x190b('0x24')](respondWithFilteredResult(_0x3d67f0,_0x497c5e));})[_0x190b('0x2d')](handleError(_0x3d67f0,null));};exports['show']=function(_0x231278,_0x4f54b9){var _0x56851d={'raw':![],'where':{'id':_0x231278[_0x190b('0xba')]['id']}},_0x5e9465={};_0x5e9465[_0x190b('0x47')]=_['keys'](db[_0x190b('0x43')][_0x190b('0x44')]);_0x5e9465[_0x190b('0x49')]=_[_0x190b('0xbb')](_0x231278[_0x190b('0x49')]);_0x5e9465['filters']=_['intersection'](_0x5e9465['model'],_0x5e9465[_0x190b('0x49')]);_0x56851d[_0x190b('0x4c')]=_[_0x190b('0x4b')](_0x5e9465['model'],qs[_0x190b('0x4d')](_0x231278[_0x190b('0x49')][_0x190b('0x4d')]));_0x56851d[_0x190b('0x4c')]=_0x56851d[_0x190b('0x4c')]['length']?_0x56851d[_0x190b('0x4c')]:_0x5e9465['model'];if(_0x231278[_0x190b('0x49')][_0x190b('0xbc')]){_0x56851d[_0x190b('0xbd')]=[{'all':!![]}];}_0x56851d=_['merge']({},_0x56851d,_0x231278['options']);return db[_0x190b('0x43')]['find'](_0x56851d)[_0x190b('0x24')](handleEntityNotFound(_0x4f54b9,null))[_0x190b('0x24')](respondWithResult(_0x4f54b9,null))[_0x190b('0x2d')](handleError(_0x4f54b9,null));};exports[_0x190b('0xbe')]=function(_0x14f086,_0x3b6792){return db[_0x190b('0x43')][_0x190b('0xbe')](_0x14f086[_0x190b('0xbf')],{})[_0x190b('0x24')](respondWithResult(_0x3b6792,0xc9))[_0x190b('0x2d')](handleError(_0x3b6792,null));};exports[_0x190b('0x38')]=function(_0x174ef1,_0x1fdf64){if(_0x174ef1[_0x190b('0xbf')]['id']){delete _0x174ef1[_0x190b('0xbf')]['id'];}return db['ChatInteraction'][_0x190b('0x67')]({'where':{'id':_0x174ef1[_0x190b('0xba')]['id']}})['then'](handleEntityNotFound(_0x1fdf64,null))[_0x190b('0x24')](saveUpdates(_0x174ef1[_0x190b('0xbf')],null))['then'](respondWithResult(_0x1fdf64,null))['catch'](handleError(_0x1fdf64,null));};exports['destroy']=function(_0x2f3ba9,_0x192765){return db[_0x190b('0x43')][_0x190b('0x67')]({'where':{'id':_0x2f3ba9['params']['id']}})[_0x190b('0x24')](handleEntityNotFound(_0x192765,null))[_0x190b('0x24')](removeEntity(_0x192765,null))[_0x190b('0x2d')](handleError(_0x192765,null));};exports[_0x190b('0xc0')]=function(_0x4b9292,_0xf22ff7){return db[_0x190b('0x43')][_0x190b('0xc0')]()[_0x190b('0x24')](respondWithResult(_0xf22ff7,null))['catch'](handleError(_0xf22ff7,null));};exports['createVidaooSession']=function(_0x1f9701,_0x3983b9){var _0x16d1eb=_0x1f9701[_0x190b('0xba')]['id'];var _0x741024;var _0x4b17fe;var _0x2f215c;return db[_0x190b('0x43')][_0x190b('0xc1')]({'where':{'id':_0x16d1eb}})[_0x190b('0x24')](function(_0x5b10e8){_0x741024=_0x5b10e8;return db['ChatWebsite']['findOne']({'where':{'id':_0x5b10e8[_0x190b('0x7f')]},'attributes':['id','vidaooApiKey',_0x190b('0xc2')],'raw':!![]});})[_0x190b('0x24')](function(_0x7fefcb){if(_0x7fefcb&&_0x7fefcb['vidaooApiKey']&&_0x7fefcb[_0x190b('0xc2')]){_0x4b17fe=_0x7fefcb;var _0x483cdd={'rejectUnauthorized':![],'method':_0x190b('0xc3'),'uri':_0x190b('0xc4'),'headers':{'X-APIKEY':_0x7fefcb[_0x190b('0xc5')]},'body':{'name':'MotionCWB:'+_0x16d1eb},'redirect':'follow','json':!![]};return rp(_0x483cdd);}else{throw new db[(_0x190b('0x95'))][(_0x190b('0x22'))](_0x190b('0xc6'));}})[_0x190b('0x24')](function(_0x529964){_0x2f215c=_0x529964;if(_0x2f215c['id']){var _0x16b937={'body':_0x2f215c[_0x190b('0xc7')],'ChatWebsiteId':_0x4b17fe['id'],'ChatInteractionId':_0x741024['id'],'direction':_0x190b('0xc8'),'UserId':_0x1f9701[_0x190b('0xc9')]['id']};return db[_0x190b('0xca')]['create'](_0x16b937,{});}else{throw new db['Sequelize'][(_0x190b('0x22'))](_0x190b('0xcb'));}})[_0x190b('0x24')](function(){return _0x741024[_0x190b('0xcc')]({'vidaooSessionId':_0x2f215c['id']});})[_0x190b('0x24')](respondWithResult(_0x3983b9,null))[_0x190b('0x2d')](handleError(_0x3983b9,null));};exports[_0x190b('0xcd')]=function(_0x4eeff4,_0x4df93d){if(_0x4eeff4[_0x190b('0xbf')]['id']){delete _0x4eeff4[_0x190b('0xbf')]['id'];}return db[_0x190b('0x43')][_0x190b('0x67')]({'where':{'id':_0x4eeff4[_0x190b('0xba')]['id']}})[_0x190b('0x24')](handleEntityNotFound(_0x4df93d,null))[_0x190b('0x24')](saveUpdates(_0x4eeff4[_0x190b('0xbf')],null))[_0x190b('0x24')](respondWithResult(_0x4df93d,null))[_0x190b('0x2d')](handleError(_0x4df93d,null));};exports[_0x190b('0xce')]=function(_0x34fec7,_0xd5faf2,_0x1f2a65){if(_0x34fec7['body']['id']){delete _0x34fec7['body']['id'];}return db[_0x190b('0x43')][_0x190b('0x67')]({'where':{'id':_0x34fec7[_0x190b('0xba')]['id']}})[_0x190b('0x24')](function(_0x1345a0){if(!_0x1345a0){logger[_0x190b('0x28')](_0x190b('0xcf'),_0x190b('0xce'),0x194,_0x190b('0xd0'));_0xd5faf2[_0x190b('0x2e')](0x194);}else{if(_0x1345a0['UserId']){throw new db[(_0x190b('0x95'))][(_0x190b('0x22'))]('Interaction\x20already\x20assigned');}}return _0x1345a0;})[_0x190b('0x24')](function(_0x5d10ec){if(_0x5d10ec){return _0x5d10ec['update']({'closed':_0x34fec7[_0x190b('0xbf')][_0x190b('0xd1')],'disposition':_0x34fec7[_0x190b('0xbf')][_0x190b('0xd2')]})[_0x190b('0x24')](function(_0x4c11d4){return _0x4c11d4;});}})[_0x190b('0x24')](function(_0x6e3a1a){return respondWithRpcPromise(_0x190b('0xd3'),'abandon',_0x34fec7[_0x190b('0xbf')],client9004);})[_0x190b('0x24')](respondWithResult(_0xd5faf2,null))[_0x190b('0x2d')](handleError(_0xd5faf2,null));};exports['attachmentUpload']=function(_0x3bfb08,_0x35a0c6,_0x3d6a24){_0x3bfb08[_0x190b('0xbf')][_0x190b('0x3a')]=_0x3bfb08[_0x190b('0xd4')][_0x190b('0xd5')];_0x3bfb08['body']['basename']=_0x3bfb08[_0x190b('0xd4')][_0x190b('0xd6')];_0x3bfb08[_0x190b('0xbf')][_0x190b('0x72')]=_0x3bfb08[_0x190b('0xd4')][_0x190b('0xd7')];return db[_0x190b('0xd8')][_0x190b('0xbe')](_0x3bfb08['body'])[_0x190b('0x24')](respondWithResult(_0x35a0c6,0xc9))[_0x190b('0x2d')](handleError(_0x35a0c6,null));};exports[_0x190b('0xd9')]=function(_0x355860,_0x6a8c46,_0x21cec1){return db['ChatInteraction']['findOne']({'where':{'id':_0x355860[_0x190b('0xba')]['id']},'raw':!![]})[_0x190b('0x24')](handleEntityNotFound(_0x6a8c46,null))[_0x190b('0x24')](function(_0x4a7f1a){if(_0x4a7f1a){if(_0x4a7f1a[_0x190b('0xd1')]){return _0x6a8c46[_0x190b('0x2f')](0x193)[_0x190b('0x30')]({'status':0x193,'message':'Unauthorized'});}return db[_0x190b('0xd8')][_0x190b('0xc1')]({'where':{'id':_0x355860['query'][_0x190b('0xda')]},'raw':!![]})[_0x190b('0x24')](handleEntityNotFound(_0x6a8c46,null));}})[_0x190b('0x24')](function(_0x338380){if(_0x338380){return _0x6a8c46[_0x190b('0xdb')](path[_0x190b('0xdc')](config[_0x190b('0xdd')],_0x190b('0xde'),_0x338380[_0x190b('0xdf')]));}})[_0x190b('0x2d')](handleError(_0x6a8c46,null));};exports['close']=function(_0x43a16b,_0x1f735d){var _0x38b864=null;var _0x30a546=null;var _0x39f7b9=null;var _0x22aa8f=null;if(_0x43a16b[_0x190b('0xbf')]['id']){delete _0x43a16b[_0x190b('0xbf')]['id'];}if(_0x43a16b[_0x190b('0xbf')]['mailTranscript']){_0x22aa8f=path['join'](config[_0x190b('0xdd')],_0x190b('0xe0'),util['format']('transcript-%s.txt',Date[_0x190b('0xe1')]()));_0x43a16b[_0x190b('0xbf')][_0x190b('0xe2')]=_0x22aa8f;}return db[_0x190b('0x43')][_0x190b('0x67')]({'where':{'id':_0x43a16b[_0x190b('0xba')]['id']},'include':[{'model':db[_0x190b('0xca')],'as':_0x190b('0xe3'),'include':[{'model':db[_0x190b('0x76')],'as':_0x190b('0x76')}]}]})[_0x190b('0x24')](handleEntityNotFound(_0x1f735d,null))['then'](saveUpdates(_0x43a16b['body'],null))[_0x190b('0x24')](function(_0x19503f){if(_0x19503f){_0x38b864=_0x19503f;return db[_0x190b('0xe4')]['find']({'where':{'id':_0x38b864[_0x190b('0x7f')]}});}})['then'](function(_0x184392){if(_0x184392){_0x39f7b9=_0x184392;return db[_0x190b('0xe5')][_0x190b('0x67')]({'where':{'id':_0x38b864[_0x190b('0x70')]}});}})['then'](function(_0x1daa73){if(_0x1daa73){_0x30a546=_0x1daa73;if(_0x22aa8f){var _0x547673=null;for(var _0x3c7c01=0x1;_0x3c7c01<_0x38b864['Messages'][_0x190b('0x4e')];++_0x3c7c01){_0x547673=_0x38b864[_0x190b('0xe3')][_0x3c7c01];var _0xf06bf1=_0x547673['UserId']?util[_0x190b('0xe6')](_0x190b('0xe7'),_0x39f7b9['agentAlias'],_0x547673[_0x190b('0x79')]):'System';var _0x377e7b=_0x43a16b[_0x190b('0xbf')][_0x190b('0xe8')]||util[_0x190b('0xe6')](_0x190b('0xe7'),_0x190b('0xe9'),_0x547673[_0x190b('0x70')]);switch(_0x39f7b9[_0x190b('0xea')]){case'website_alias':_0xf06bf1=_0x547673[_0x190b('0x79')]?util[_0x190b('0xe6')](_0x190b('0xe7'),_0x39f7b9[_0x190b('0xeb')],_0x547673[_0x190b('0x79')]):_0x190b('0xec');break;case _0x190b('0xed'):_0xf06bf1=_0x547673[_0x190b('0x79')]?_0x547673[_0x190b('0x76')][_0x190b('0xee')]||_0x547673[_0x190b('0x76')][_0x190b('0x3d')]:_0x190b('0xec');break;case _0x190b('0xef'):_0xf06bf1=_0x547673[_0x190b('0x79')]?_0x547673[_0x190b('0x76')][_0x190b('0x3d')]:_0x190b('0xec');break;default:_0xf06bf1=_0x547673[_0x190b('0x79')]?util[_0x190b('0xe6')](_0x190b('0xe7'),_0x39f7b9[_0x190b('0xeb')],_0x547673['UserId']):_0x190b('0xec');}var _0x5a898c=util[_0x190b('0xe6')](_0x190b('0xf0'),moment(_0x547673[_0x190b('0xf1')])[_0x190b('0xe6')](_0x190b('0xf2')),_0x547673[_0x190b('0xf3')]==='in'?_0x377e7b:_0xf06bf1,_0x547673[_0x190b('0xbf')]);if(!_0x547673['secret']){fs[_0x190b('0xf4')](_0x22aa8f,_0x5a898c);}}return db['MailAccount'][_0x190b('0xc1')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x190b('0xf5'),'raw':!![]}]});}}})[_0x190b('0x24')](function(_0x53757a){if(_0x53757a&&_0x53757a['Smtp']&&_0x43a16b[_0x190b('0xbf')]){var _0x460e5e={'tls':{'rejectUnauthorized':![]}};if(_0x53757a['Smtp'][_0x190b('0xf6')]){_0x460e5e[_0x190b('0xf6')]=_0x53757a[_0x190b('0xf5')]['service'];}else{_0x460e5e[_0x190b('0xf7')]=_0x53757a[_0x190b('0xf5')][_0x190b('0xf7')];_0x460e5e['port']=_0x53757a[_0x190b('0xf5')][_0x190b('0xf8')];_0x460e5e['secure']=_0x53757a[_0x190b('0xf5')]['secure'];}if(_0x53757a[_0x190b('0xf5')][_0x190b('0xf9')]){_0x460e5e['auth']={'user':_0x53757a['Smtp']['user'],'pass':_0x53757a['Smtp'][_0x190b('0xfa')]};}return respondWithRpcPromise(_0x190b('0xfb'),_0x190b('0xfc'),{'account':_0x460e5e,'message':{'from':util['format'](_0x190b('0xfd'),_0x53757a[_0x190b('0x3a')],_0x53757a[_0x190b('0xfe')]||_0x53757a[_0x190b('0xf5')]['user']),'to':_0x43a16b[_0x190b('0xbf')]['mailTranscript'],'subject':_0x190b('0xff'),'text':util['format'](_0x190b('0x100'),_0x43a16b['body']['mailTranscript']),'attachments':[{'path':_0x22aa8f}]}})['then'](function(){return _0x38b864;})[_0x190b('0x2d')](function(_0x5678d6){console[_0x190b('0x28')](_0x5678d6);});}else{return _0x38b864;}})[_0x190b('0x24')](respondWithStatusCode(_0x1f735d,0xc8))[_0x190b('0x2d')](handleError(_0x1f735d,null));};exports[_0x190b('0x101')]=function(_0x2c12ca,_0x14050e,_0xee7a47){return db[_0x190b('0xca')][_0x190b('0x67')]({'where':{'id':_0x2c12ca[_0x190b('0xba')]['id']}})['then'](handleEntityNotFound(_0x14050e,null))[_0x190b('0x24')](function(_0x31f9e5){if(_0x31f9e5){return _0x31f9e5[_0x190b('0x101')](_0x2c12ca['body'][_0x190b('0x102')],_[_0x190b('0x103')](_0x2c12ca[_0x190b('0xbf')],[_0x190b('0x102'),'id'])||{});}})[_0x190b('0x24')](respondWithResult(_0x14050e,null))[_0x190b('0x2d')](handleError(_0x14050e,null));};exports[_0x190b('0x104')]=function(_0x7d4b94,_0x5a0347,_0x203400){var _0x81d6a8={'raw':![],'where':{}};var _0x35f578={};var _0x4a48ee={'count':0x0,'rows':[]};return db[_0x190b('0x43')]['findOne']({'where':{'id':_0x7d4b94[_0x190b('0xba')]['id']}})[_0x190b('0x24')](handleEntityNotFound(_0x5a0347,null))[_0x190b('0x24')](function(_0x1a3369){if(_0x1a3369){_0x35f578[_0x190b('0x47')]=_[_0x190b('0xbb')](db[_0x190b('0xca')][_0x190b('0x44')]);_0x35f578[_0x190b('0x49')]=_['keys'](_0x7d4b94[_0x190b('0x49')]);_0x35f578[_0x190b('0x4a')]=_[_0x190b('0x4b')](_0x35f578['model'],_0x35f578[_0x190b('0x49')]);_0x81d6a8[_0x190b('0x4c')]=_[_0x190b('0x4b')](_0x35f578[_0x190b('0x47')],qs['fields'](_0x7d4b94[_0x190b('0x49')][_0x190b('0x4d')]));_0x81d6a8[_0x190b('0x4c')]=_0x81d6a8['attributes'][_0x190b('0x4e')]?_0x81d6a8[_0x190b('0x4c')]:_0x35f578[_0x190b('0x47')];if(!_0x7d4b94[_0x190b('0x49')][_0x190b('0x105')](_0x190b('0x4f'))){_0x81d6a8['limit']=qs[_0x190b('0x33')](_0x7d4b94[_0x190b('0x49')][_0x190b('0x33')]);_0x81d6a8[_0x190b('0x32')]=qs[_0x190b('0x32')](_0x7d4b94[_0x190b('0x49')][_0x190b('0x32')]);}_0x81d6a8[_0x190b('0x50')]=qs[_0x190b('0x51')](_0x7d4b94[_0x190b('0x49')][_0x190b('0x51')]);_0x81d6a8[_0x190b('0x52')]=qs[_0x190b('0x4a')](_[_0x190b('0x106')](_0x7d4b94[_0x190b('0x49')],_0x35f578['filters']));_0x81d6a8[_0x190b('0x52')][_0x190b('0xb7')]=_0x1a3369['id'];if(_0x7d4b94['query']['filter']){_0x81d6a8[_0x190b('0x52')]=_[_0x190b('0xa2')](_0x81d6a8[_0x190b('0x52')],{'$or':_[_0x190b('0x48')](_0x81d6a8[_0x190b('0x4c')],function(_0x4e7195){var _0x55b875={};_0x55b875[_0x4e7195]={'$like':'%'+_0x7d4b94[_0x190b('0x49')]['filter']+'%'};return _0x55b875;})});}if(_0x7d4b94[_0x190b('0x49')]['$gte']){var _0x39bfcf=_0x7d4b94[_0x190b('0x49')]['$gte'][_0x190b('0x3f')](',');var _0x2ccb0a={};_0x2ccb0a[_0x39bfcf[0x0]]={'$gte':moment(_0x39bfcf[0x1])[_0x190b('0xe6')](_0x190b('0x107'))};_0x81d6a8[_0x190b('0x52')]=_['merge'](_0x81d6a8[_0x190b('0x52')],_0x2ccb0a);}_0x81d6a8=_['merge']({},_0x81d6a8,_0x7d4b94['options']);return db['ChatMessage']['count']({'where':_0x81d6a8[_0x190b('0x52')]})[_0x190b('0x24')](function(_0x1ad936){_0x4a48ee[_0x190b('0x31')]=_0x1ad936;if(_0x7d4b94[_0x190b('0x49')]['includeAll']){_0x81d6a8[_0x190b('0xbd')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x81d6a8);})[_0x190b('0x24')](function(_0xce262c){_0x4a48ee[_0x190b('0xb9')]=_0xce262c;return _0x4a48ee;});}})[_0x190b('0x24')](respondWithFilteredResult(_0x5a0347,_0x81d6a8))[_0x190b('0x2d')](handleError(_0x5a0347,null));};exports[_0x190b('0x108')]=function(_0x30aff0,_0x3941a5,_0x1cbdd5){var _0x53b978={'where':{}},_0x4f7870={},_0x15368b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x190b('0xc1')]({'where':{'id':_0x30aff0['params']['id']}})[_0x190b('0x24')](handleEntityNotFound(_0x3941a5,null))[_0x190b('0x24')](function(_0x912e45){if(_0x912e45){_0x4f7870[_0x190b('0x47')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x4f7870['query']=_['keys'](_0x30aff0[_0x190b('0x49')]);_0x4f7870[_0x190b('0x4a')]=_[_0x190b('0x4b')](_0x4f7870['model'],_0x4f7870[_0x190b('0x49')]);_0x53b978[_0x190b('0x4c')]=_['intersection'](_0x4f7870[_0x190b('0x47')],qs[_0x190b('0x4d')](_0x30aff0[_0x190b('0x49')][_0x190b('0x4d')]));_0x53b978[_0x190b('0x4c')]=_0x53b978['attributes'][_0x190b('0x4e')]?_0x53b978[_0x190b('0x4c')]:_0x4f7870[_0x190b('0x47')];if(!_0x30aff0[_0x190b('0x49')][_0x190b('0x105')](_0x190b('0x4f'))){_0x53b978[_0x190b('0x33')]=qs[_0x190b('0x33')](_0x30aff0[_0x190b('0x49')][_0x190b('0x33')]);_0x53b978[_0x190b('0x32')]=qs['offset'](_0x30aff0[_0x190b('0x49')][_0x190b('0x32')]);}_0x53b978[_0x190b('0x50')]=qs[_0x190b('0x51')](_0x30aff0[_0x190b('0x49')][_0x190b('0x51')]);_0x53b978[_0x190b('0x52')]=qs[_0x190b('0x4a')](_[_0x190b('0x106')](_0x30aff0['query'],_0x4f7870[_0x190b('0x4a')]));_0x53b978['where'][_0x190b('0xb7')]=_0x912e45['id'];if(_0x30aff0['query'][_0x190b('0x8b')]){_0x53b978['where']=_['merge'](_0x53b978[_0x190b('0x52')],{'$or':_[_0x190b('0x48')](_0x53b978['attributes'],function(_0x273d08){var _0x50b27f={};_0x50b27f[_0x273d08]={'$like':'%'+_0x30aff0['query'][_0x190b('0x8b')]+'%'};return _0x50b27f;})});}_0x53b978[_0x190b('0x52')][_0x190b('0x109')]=![];if(_0x30aff0[_0x190b('0x49')]['id']){_0x53b978['where']['id']={'$gt':_0x30aff0[_0x190b('0x49')]['id']};}_0x53b978=_[_0x190b('0xa2')]({},_0x53b978,_0x30aff0[_0x190b('0x10a')]);return db[_0x190b('0xca')][_0x190b('0x31')]({'where':_0x53b978[_0x190b('0x52')]})[_0x190b('0x24')](function(_0x231741){_0x15368b[_0x190b('0x31')]=_0x231741;_0x53b978[_0x190b('0xbd')]=[];if(_0x30aff0[_0x190b('0x49')][_0x190b('0x10b')]){_0x53b978['include']['push']({'model':db['User'],'as':_0x190b('0x76'),'attributes':['id',_0x190b('0x3d'),_0x190b('0xee')]});}if(_0x30aff0[_0x190b('0x49')][_0x190b('0xbc')]){_0x53b978[_0x190b('0xbd')]=[{'all':!![]}];}return db[_0x190b('0xca')][_0x190b('0x10c')](_0x53b978);})[_0x190b('0x24')](function(_0x1ef815){_0x15368b[_0x190b('0xb9')]=_0x1ef815;return _0x15368b;});}})['then'](respondWithFilteredResult(_0x3941a5,_0x53b978))[_0x190b('0x2d')](handleError(_0x3941a5,null));};exports[_0x190b('0x10d')]=function(_0x2a0434,_0x6b4608,_0x2f6a03){return db[_0x190b('0x43')][_0x190b('0x67')]({'where':{'id':_0x2a0434[_0x190b('0xba')]['id']}})[_0x190b('0x24')](handleEntityNotFound(_0x6b4608,null))[_0x190b('0x24')](function(_0x5a210c){if(_0x5a210c){return _0x5a210c['setTags'](_0x2a0434['body'][_0x190b('0x102')],_[_0x190b('0x103')](_0x2a0434['body'],[_0x190b('0x102'),'id'])||{})[_0x190b('0x10e')](function(){return db[_0x190b('0x73')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x2a0434[_0x190b('0xbf')][_0x190b('0x102')]}});})['then'](function(_0xbaaa1c){socket[_0x190b('0x10f')](_0x190b('0x110'),{'id':Number(_0x2a0434[_0x190b('0xba')]['id']),'tags':_0xbaaa1c||[]});return{'id':Number(_0x2a0434[_0x190b('0xba')]['id']),'tags':_0xbaaa1c||[]};});}})[_0x190b('0x24')](respondWithResult(_0x6b4608,null))[_0x190b('0x2d')](handleError(_0x6b4608,null));};exports['removeTags']=function(_0x2a5541,_0x379828,_0xd919af){return db[_0x190b('0x43')][_0x190b('0x67')]({'where':{'id':_0x2a5541[_0x190b('0xba')]['id']}})[_0x190b('0x24')](handleEntityNotFound(_0x379828,null))['then'](function(_0x6ffaa8){if(_0x6ffaa8){return _0x6ffaa8['removeTags'](_0x2a5541['query']['ids']);}})[_0x190b('0x24')](respondWithStatusCode(_0x379828,null))[_0x190b('0x2d')](handleError(_0x379828,null));};exports[_0x190b('0xdb')]=function(_0x1a62d0,_0x2eb729){var _0x24e48f=moment()[_0x190b('0x111')]()['toString']();var _0x25fc8a=path[_0x190b('0xdc')](config[_0x190b('0xdd')],_0x190b('0x112'),_0x190b('0x113'),_0x190b('0x114'));var _0x29609a=path[_0x190b('0xdc')](config[_0x190b('0xdd')],_0x190b('0x112'),_0x190b('0x113'),_0x190b('0x115'));var _0x1453b1=path['join'](_0x25fc8a,_0x24e48f);var _0x417a42=util[_0x190b('0xe6')](_0x190b('0x116'),_0x1a62d0[_0x190b('0xba')]['id'],_0x24e48f);var _0x303049=path[_0x190b('0xdc')](_0x25fc8a,_0x417a42);var _0x79ce80=[];_0x79ce80[_0x190b('0x41')]({'model':db['User'],'as':_0x190b('0x76'),'attributes':['id',_0x190b('0x3d')],'raw':!![]});_0x79ce80[_0x190b('0x41')]({'model':db[_0x190b('0xe5')],'as':_0x190b('0x6d'),'attributes':['id',_0x190b('0x117'),_0x190b('0x118')],'raw':!![]});if(_0x1a62d0[_0x190b('0x49')][_0x190b('0x115')]){_0x79ce80[_0x190b('0x41')]({'model':db[_0x190b('0xd8')],'as':_0x190b('0xd8'),'raw':!![]});}var _0x4df287=[{'model':db[_0x190b('0xca')],'as':_0x190b('0xe3'),'attributes':['id',_0x190b('0xbf'),_0x190b('0xf1'),'direction',_0x190b('0x109'),'read'],'include':_0x79ce80}];_0x4df287['push']({'model':db[_0x190b('0xe4')],'as':'Account','attributes':['id','name']});_0x4df287['push']({'model':db[_0x190b('0x76')],'as':'Owner','attributes':['id',_0x190b('0x3d')]});return db[_0x190b('0x43')][_0x190b('0x67')]({'where':{'id':_0x1a62d0[_0x190b('0xba')]['id']},'include':_0x4df287})[_0x190b('0x24')](handleEntityNotFound(_0x2eb729,null))[_0x190b('0x24')](function(_0x1d9be4){if(_0x1d9be4){var _0x5c7890=_0x1d9be4[_0x190b('0x119')]({'plain':!![]});fs['mkdirSync'](_0x1453b1);var _0x29b2d1={'format':'A4','border':_0x190b('0x11a'),'header':{'height':_0x190b('0x11b'),'contents':{'first':_0x190b('0x11c')}},'footer':{'height':'30px','contents':{'default':util[_0x190b('0xe6')](_0x190b('0x11d'),util[_0x190b('0xe6')](_0x190b('0x11e'),_0x190b('0x11f'),_0x5c7890['id']),moment()[_0x190b('0xe6')](_0x190b('0x120'))[_0x190b('0xa0')]())}}};var _0x2d6db8={'channel':'Chat','account':_0x5c7890[_0x190b('0x121')]['name'],'agent':_0x5c7890[_0x190b('0x122')]?_0x5c7890[_0x190b('0x122')][_0x190b('0x3d')]:_0x190b('0x123'),'createdAt':moment(_0x5c7890[_0x190b('0xf1')])[_0x190b('0xe6')](_0x190b('0x107'))[_0x190b('0xa0')](),'closedAt':_0x5c7890[_0x190b('0xd1')]?moment(_0x5c7890['closedAt'])[_0x190b('0xe6')](_0x190b('0x107'))[_0x190b('0xa0')]():'','disposition':_0x5c7890['disposition'],'chatInfo':{'browser':_0x5c7890[_0x190b('0x124')],'os':_0x5c7890[_0x190b('0x125')],'referer':_0x5c7890[_0x190b('0x126')],'customerIp':_0x5c7890[_0x190b('0x127')],'customerPort':_0x5c7890['customerPort']?_0x5c7890['customerPort']:_0x190b('0x123')},'messages':_(_0x5c7890['Messages'])['tail']()[_0x190b('0x8b')]({'secret':![]})['map'](function(_0x569762){if(_0x569762[_0x190b('0xd8')]){var _0x1fdda7=path[_0x190b('0xdc')](_0x29609a,_0x569762[_0x190b('0xd8')][_0x190b('0xdf')]);if(fs[_0x190b('0x128')](_0x1fdda7)){fs[_0x190b('0x129')](_0x1fdda7)[_0x190b('0x12a')](fs['createWriteStream'](path[_0x190b('0xdc')](_0x1453b1,_0x569762[_0x190b('0xd8')][_0x190b('0xdf')])));}}return{'date':moment(_0x569762[_0x190b('0xf1')])[_0x190b('0xe6')](_0x190b('0x107'))[_0x190b('0xa0')](),'sender':_0x569762[_0x190b('0xf3')]==='out'?_0x569762[_0x190b('0x76')]?_0x569762[_0x190b('0x76')][_0x190b('0x3d')]:'System':_0x569762['Contact'][_0x190b('0x117')]+(_0x569762['Contact'][_0x190b('0x118')]?'\x20'+_0x569762[_0x190b('0x6d')][_0x190b('0x118')]:''),'body':_0x569762[_0x190b('0xd8')]?_0x569762[_0x190b('0xd8')][_0x190b('0xdf')]:_0x569762[_0x190b('0xbf')],'direction':_0x569762['direction']===_0x190b('0xc8')?'A':'C','secret':_0x569762[_0x190b('0x109')],'read':_0x569762[_0x190b('0x87')],'attachment':_0x569762['Attachment']};})[_0x190b('0x69')]()};return ejs[_0x190b('0x12b')](path['join'](config[_0x190b('0xdd')],_0x190b('0x112'),_0x190b('0x12c'),_0x190b('0x12d')),{'interaction':_0x2d6db8})[_0x190b('0x24')](function(_0x21724c){return new BPromise(function(_0x4a846d,_0x2b5c3a){pdf[_0x190b('0xbe')](_0x21724c,_0x29b2d1)[_0x190b('0x12e')](path['join'](_0x1453b1,_0x190b('0x12f')+_0x5c7890['id']+'-'+_0x24e48f+_0x190b('0x130')),function(_0x2b6794,_0x1e8422){if(_0x2b6794)return _0x2b5c3a(_0x2b6794);_0x4a846d(_0x1e8422);});});})['then'](function(){return new BPromise(function(_0x26e8c7,_0x558fdd){zipdir(_0x1453b1,{'saveTo':_0x303049},function(_0x3d5657,_0x7b6620){if(_0x3d5657)return _0x558fdd(_0x3d5657);return _0x26e8c7(_0x7b6620);});})[_0x190b('0x24')](function(){return new BPromise(function(_0x581951,_0x7f4ab5){rimraf(_0x1453b1,function(_0x515e01){if(_0x515e01)_0x7f4ab5(_0x515e01);return _0x581951();});});})[_0x190b('0x24')](function(){return _0x2eb729[_0x190b('0xdb')](_0x303049,_0x417a42,function(_0x5dd87f){if(_0x5dd87f){console['log'](_0x190b('0x131'),_0x5dd87f);}else{fs[_0x190b('0x132')](_0x303049);}});});});}else{return _0x2eb729[_0x190b('0x2e')](0xc8);}})[_0x190b('0x2d')](handleError(_0x2eb729,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 2e14ffb..ccd32f9 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 _0xa7c5=['map','findAll','unreadMessages','emit','hasOwnProperty','exports','events','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xa7c5,0x1e6));var _0x5a7c=function(_0x4fe55b,_0x54e455){_0x4fe55b=_0x4fe55b-0x0;var _0x122529=_0xa7c5[_0x4fe55b];return _0x122529;};'use strict';var EventEmitter=require(_0x5a7c('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x5a7c('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5a7c('0x2')](0x0);var events={'afterCreate':_0x5a7c('0x3'),'afterUpdate':_0x5a7c('0x4'),'afterDestroy':_0x5a7c('0x5')};function emitEvent(_0x2944cf){return function(_0x65a0cc,_0x21a63b,_0x5ea861){_0x65a0cc[_0x5a7c('0x6')]({'attributes':['id'],'raw':!![]})[_0x5a7c('0x7')](function(_0x5279f4){_0x65a0cc[_0x5a7c('0x8')](_0x5a7c('0x9'),_0x5279f4[_0x5a7c('0xa')](function(_0xecbb69){return{'id':_0xecbb69['id']};}));return ChatMessage[_0x5a7c('0xb')]({'where':{'ChatInteractionId':_0x65a0cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5a7c('0x7')](function(_0x627aff){_0x65a0cc[_0x5a7c('0x8')](_0x5a7c('0xc'),_0x627aff['length']);ChatInteractionEvents[_0x5a7c('0xd')](_0x2944cf+':'+_0x65a0cc['id'],_0x65a0cc);ChatInteractionEvents[_0x5a7c('0xd')](_0x2944cf,_0x65a0cc);_0x5ea861(null);})['catch'](_0x5ea861(null));};}for(var e in events){if(events[_0x5a7c('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x5a7c('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x2971=['then','Users','map','findAll','emit','catch','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2971,0x1db));var _0x1297=function(_0x4568b7,_0x2f8c0b){_0x4568b7=_0x4568b7-0x0;var _0x1fd2c8=_0x2971[_0x4568b7];return _0x1fd2c8;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x1297('0x0'))['db'][_0x1297('0x1')];var ChatMessage=require(_0x1297('0x0'))['db'][_0x1297('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1297('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1297('0x4'),'afterDestroy':'remove'};function emitEvent(_0x484fc5){return function(_0x53c847,_0x393041,_0x2c0c41){_0x53c847['getUsers']({'attributes':['id'],'raw':!![]})[_0x1297('0x5')](function(_0x41d3f8){_0x53c847['setDataValue'](_0x1297('0x6'),_0x41d3f8[_0x1297('0x7')](function(_0x51f591){return{'id':_0x51f591['id']};}));return ChatMessage[_0x1297('0x8')]({'where':{'ChatInteractionId':_0x53c847['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1297('0x5')](function(_0x21929f){_0x53c847['setDataValue']('unreadMessages',_0x21929f['length']);ChatInteractionEvents[_0x1297('0x9')](_0x484fc5+':'+_0x53c847['id'],_0x53c847);ChatInteractionEvents[_0x1297('0x9')](_0x484fc5,_0x53c847);_0x2c0c41(null);})[_0x1297('0xa')](_0x2c0c41(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x1297('0xb')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ad7eec7..19395df 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 _0xbeed=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','changed','format'];(function(_0x3b64c0,_0x1f1d6c){var _0x2a9896=function(_0xfe26e6){while(--_0xfe26e6){_0x3b64c0['push'](_0x3b64c0['shift']());}};_0x2a9896(++_0x1f1d6c);}(_0xbeed,0x163));var _0xdbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeed[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdbee('0x0'));var util=require('util');var logger=require(_0xdbee('0x1'))(_0xdbee('0x2'));var moment=require(_0xdbee('0x3'));var BPromise=require(_0xdbee('0x4'));var rp=require(_0xdbee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbee('0x6'));var config=require(_0xdbee('0x7'));var attributes=require(_0xdbee('0x8'));module[_0xdbee('0x9')]=function(_0x283e7f,_0x4fd7bd){return _0x283e7f['define'](_0xdbee('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x352108,_0x58a64e,_0x10c670){if(_0x352108[_0xdbee('0xb')]('closed')){_0x352108['closedAt']=moment()[_0xdbee('0xc')](_0xdbee('0xd'));}_0x10c670(null,_0x352108);}},'charset':_0xdbee('0xe'),'collate':_0xdbee('0xf')});}; \ No newline at end of file +var _0x77e2=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt'];(function(_0x1dd712,_0x5064a6){var _0x1af645=function(_0x1667ef){while(--_0x1667ef){_0x1dd712['push'](_0x1dd712['shift']());}};_0x1af645(++_0x5064a6);}(_0x77e2,0x1cf));var _0x277e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x277e('0x0'));var logger=require('../../config/logger')(_0x277e('0x1'));var moment=require('moment');var BPromise=require(_0x277e('0x2'));var rp=require(_0x277e('0x3'));var fs=require('fs');var path=require(_0x277e('0x4'));var rimraf=require(_0x277e('0x5'));var config=require('../../config/environment');var attributes=require(_0x277e('0x6'));module['exports']=function(_0x4c159b,_0x150694){return _0x4c159b[_0x277e('0x7')](_0x277e('0x8'),attributes,{'tableName':_0x277e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x160b8c,_0x4926b4,_0xe86a33){if(_0x160b8c[_0x277e('0xa')](_0x277e('0xb'))){_0x160b8c[_0x277e('0xc')]=moment()[_0x277e('0xd')](_0x277e('0xe'));}_0xe86a33(null,_0x160b8c);}},'charset':_0x277e('0xf'),'collate':_0x277e('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 8de3ee9..d344fb5 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 _0x626c=['attributes','AddTagsToChatInteraction','ChatInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','request\x20sent','catch','UpdateChatInteraction','update','body','options','where'];(function(_0x2d0bfd,_0x2ba336){var _0x4d806c=function(_0x47938d){while(--_0x47938d){_0x2d0bfd['push'](_0x2d0bfd['shift']());}};_0x4d806c(++_0x2ba336);}(_0x626c,0x1d1));var _0xc626=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x626c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc626('0x0'));var util=require(_0xc626('0x1'));var moment=require(_0xc626('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc626('0x3'));var db=require(_0xc626('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc626('0x5'))('rpc');var config=require(_0xc626('0x6'));var jayson=require(_0xc626('0x7'));var client=jayson[_0xc626('0x8')]['http']({'port':0x232a});config[_0xc626('0x9')]=_['defaults'](config[_0xc626('0x9')],{'host':_0xc626('0xa'),'port':0x18eb});var socket=require(_0xc626('0xb'))(new Redis(config[_0xc626('0x9')]));require(_0xc626('0xc'))['register'](socket);function respondWithRpcPromise(_0x2487dd,_0x440ed0,_0x1ac064){return new BPromise(function(_0x520fad,_0x553a12){return client[_0xc626('0xd')](_0x2487dd,_0x1ac064)[_0xc626('0xe')](function(_0x2306c4){logger[_0xc626('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x440ed0,'request\x20sent');logger[_0xc626('0x10')](_0xc626('0x11'),_0x440ed0,'request\x20sent',JSON[_0xc626('0x12')](_0x2306c4));if(_0x2306c4[_0xc626('0x13')]){if(_0x2306c4[_0xc626('0x13')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x440ed0,_0x2306c4[_0xc626('0x13')][_0xc626('0x14')]);return _0x553a12(_0x2306c4[_0xc626('0x13')][_0xc626('0x14')]);}logger['error'](_0xc626('0x15'),_0x440ed0,_0x2306c4[_0xc626('0x13')][_0xc626('0x14')]);return _0x520fad(_0x2306c4['error'][_0xc626('0x14')]);}else{logger[_0xc626('0xf')](_0xc626('0x15'),_0x440ed0,_0xc626('0x16'));_0x520fad(_0x2306c4['result'][_0xc626('0x14')]);}})[_0xc626('0x17')](function(_0x38aa6f){logger['error'](_0xc626('0x15'),_0x440ed0,_0x38aa6f);_0x553a12(_0x38aa6f);});});}exports[_0xc626('0x18')]=function(_0x52a0b5){var _0xfddfba=this;return new Promise(function(_0x17a378,_0x14a7af){return db['ChatInteraction'][_0xc626('0x19')](_0x52a0b5[_0xc626('0x1a')],{'raw':_0x52a0b5[_0xc626('0x1b')]?_0x52a0b5[_0xc626('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52a0b5[_0xc626('0x1b')]?_0x52a0b5['options'][_0xc626('0x1c')]||null:null,'attributes':_0x52a0b5['options']?_0x52a0b5[_0xc626('0x1b')][_0xc626('0x1d')]||null:null,'limit':_0x52a0b5[_0xc626('0x1b')]?_0x52a0b5['options']['limit']||null:null})[_0xc626('0xe')](function(_0x263935){logger[_0xc626('0xf')](_0xc626('0x18'),_0x52a0b5);logger[_0xc626('0x10')](_0xc626('0x18'),_0x52a0b5,JSON[_0xc626('0x12')](_0x263935));_0x17a378(_0x263935);})[_0xc626('0x17')](function(_0x54480d){logger[_0xc626('0x13')]('UpdateChatInteraction',_0x54480d[_0xc626('0x14')],_0x52a0b5);_0x14a7af(_0xfddfba['error'](0x1f4,_0x54480d[_0xc626('0x14')]));});});};exports[_0xc626('0x1e')]=function(_0x5e4eeb){return new Promise(function(_0xb739fa,_0x23f81c){return db[_0xc626('0x1f')][_0xc626('0x20')]({'where':_0x5e4eeb[_0xc626('0x1b')]?_0x5e4eeb[_0xc626('0x1b')][_0xc626('0x1c')]||null:null})[_0xc626('0xe')](function(_0x4e8287){if(_0x4e8287){return _0x4e8287[_0xc626('0x21')](_0x5e4eeb[_0xc626('0x1a')]['ids'],_[_0xc626('0x22')](_0x5e4eeb['body'],[_0xc626('0x23'),'id'])||{});}})[_0xc626('0x24')](function(_0x5594cc){logger['info'](_0xc626('0x25'),_0x5e4eeb);logger[_0xc626('0x10')](_0xc626('0x25'),_0x5e4eeb,JSON[_0xc626('0x12')](_0x5594cc));_0xb739fa(_0x5594cc);})[_0xc626('0x17')](function(_0x37cdba){logger[_0xc626('0x13')](_0xc626('0x25'),_0x37cdba[_0xc626('0x14')],_0x5e4eeb);_0x23f81c(_this[_0xc626('0x13')](0x1f4,_0x37cdba['message']));});});}; \ No newline at end of file +var _0xf492=['stringify','error','code','message','info','result','catch','ChatInteraction','update','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x1fbaad,_0x5a155a){var _0x3be85e=function(_0x2d7b17){while(--_0x2d7b17){_0x1fbaad['push'](_0x1fbaad['shift']());}};_0x3be85e(++_0x5a155a);}(_0xf492,0xbf));var _0x2f49=function(_0x275030,_0x2acc02){_0x275030=_0x275030-0x0;var _0xedf0ea=_0xf492[_0x275030];return _0xedf0ea;};'use strict';var _=require('lodash');var util=require(_0x2f49('0x0'));var moment=require(_0x2f49('0x1'));var BPromise=require(_0x2f49('0x2'));var rs=require(_0x2f49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f49('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f49('0x5'))('rpc');var config=require(_0x2f49('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2f49('0x7')][_0x2f49('0x8')]({'port':0x232a});config[_0x2f49('0x9')]=_['defaults'](config[_0x2f49('0x9')],{'host':_0x2f49('0xa'),'port':0x18eb});var socket=require(_0x2f49('0xb'))(new Redis(config[_0x2f49('0x9')]));require(_0x2f49('0xc'))['register'](socket);function respondWithRpcPromise(_0x34bcba,_0x851525,_0x7625e3){return new BPromise(function(_0x19ad1f,_0x152974){return client[_0x2f49('0xd')](_0x34bcba,_0x7625e3)[_0x2f49('0xe')](function(_0x1ee6f0){logger['info'](_0x2f49('0xf'),_0x851525,_0x2f49('0x10'));logger[_0x2f49('0x11')](_0x2f49('0x12'),_0x851525,_0x2f49('0x10'),JSON[_0x2f49('0x13')](_0x1ee6f0));if(_0x1ee6f0[_0x2f49('0x14')]){if(_0x1ee6f0[_0x2f49('0x14')][_0x2f49('0x15')]===0x1f4){logger[_0x2f49('0x14')](_0x2f49('0xf'),_0x851525,_0x1ee6f0[_0x2f49('0x14')][_0x2f49('0x16')]);return _0x152974(_0x1ee6f0[_0x2f49('0x14')]['message']);}logger[_0x2f49('0x14')](_0x2f49('0xf'),_0x851525,_0x1ee6f0[_0x2f49('0x14')][_0x2f49('0x16')]);return _0x19ad1f(_0x1ee6f0[_0x2f49('0x14')][_0x2f49('0x16')]);}else{logger[_0x2f49('0x17')](_0x2f49('0xf'),_0x851525,_0x2f49('0x10'));_0x19ad1f(_0x1ee6f0[_0x2f49('0x18')]['message']);}})[_0x2f49('0x19')](function(_0x1bee35){logger[_0x2f49('0x14')](_0x2f49('0xf'),_0x851525,_0x1bee35);_0x152974(_0x1bee35);});});}exports['UpdateChatInteraction']=function(_0x17c2f7){var _0x27673b=this;return new Promise(function(_0xcdb155,_0x79fa3){return db[_0x2f49('0x1a')][_0x2f49('0x1b')](_0x17c2f7['body'],{'raw':_0x17c2f7[_0x2f49('0x1c')]?_0x17c2f7[_0x2f49('0x1c')][_0x2f49('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17c2f7[_0x2f49('0x1c')]?_0x17c2f7[_0x2f49('0x1c')][_0x2f49('0x1e')]||null:null,'attributes':_0x17c2f7['options']?_0x17c2f7[_0x2f49('0x1c')][_0x2f49('0x1f')]||null:null,'limit':_0x17c2f7[_0x2f49('0x1c')]?_0x17c2f7[_0x2f49('0x1c')][_0x2f49('0x20')]||null:null})[_0x2f49('0xe')](function(_0x15baa4){logger['info'](_0x2f49('0x21'),_0x17c2f7);logger['debug']('UpdateChatInteraction',_0x17c2f7,JSON[_0x2f49('0x13')](_0x15baa4));_0xcdb155(_0x15baa4);})[_0x2f49('0x19')](function(_0x481b60){logger[_0x2f49('0x14')](_0x2f49('0x21'),_0x481b60[_0x2f49('0x16')],_0x17c2f7);_0x79fa3(_0x27673b[_0x2f49('0x14')](0x1f4,_0x481b60[_0x2f49('0x16')]));});});};exports[_0x2f49('0x22')]=function(_0x2cfb1d){return new Promise(function(_0x5ea7ec,_0x4bec74){return db[_0x2f49('0x1a')][_0x2f49('0x23')]({'where':_0x2cfb1d[_0x2f49('0x1c')]?_0x2cfb1d[_0x2f49('0x1c')][_0x2f49('0x1e')]||null:null})['then'](function(_0x591e54){if(_0x591e54){return _0x591e54[_0x2f49('0x24')](_0x2cfb1d[_0x2f49('0x25')][_0x2f49('0x26')],_[_0x2f49('0x27')](_0x2cfb1d[_0x2f49('0x25')],[_0x2f49('0x26'),'id'])||{});}})[_0x2f49('0x28')](function(_0x36aedc){logger[_0x2f49('0x17')](_0x2f49('0x29'),_0x2cfb1d);logger[_0x2f49('0x11')]('AddTags',_0x2cfb1d,JSON[_0x2f49('0x13')](_0x36aedc));_0x5ea7ec(_0x36aedc);})[_0x2f49('0x19')](function(_0x30e811){logger['error'](_0x2f49('0x29'),_0x30e811[_0x2f49('0x16')],_0x2cfb1d);_0x4bec74(_this[_0x2f49('0x14')](0x1f4,_0x30e811[_0x2f49('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8d4400f..56e6321 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 _0xf99d=['./chatInteraction.events','save','update','length','chatInteraction:'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0xf99d,0x186));var _0xdf99=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xf99d[_0x5f1391];return _0x50ebe3;};'use strict';var ChatInteractionEvents=require(_0xdf99('0x0'));var events=[_0xdf99('0x1'),'remove',_0xdf99('0x2')];function createListener(_0x2267aa,_0x580d4b){return function(_0x45e422){_0x580d4b['emit'](_0x2267aa,_0x45e422);};}function removeListener(_0x2e9ae0,_0xe84808){return function(){ChatInteractionEvents['removeListener'](_0x2e9ae0,_0xe84808);};}exports['register']=function(_0x67ee9e){for(var _0x55bfc6=0x0,_0x7dff4c=events[_0xdf99('0x3')];_0x55bfc6<_0x7dff4c;_0x55bfc6++){var _0x1176b6=events[_0x55bfc6];var _0xd325ef=createListener(_0xdf99('0x4')+_0x1176b6,_0x67ee9e);ChatInteractionEvents['on'](_0x1176b6,_0xd325ef);}}; \ No newline at end of file +var _0xb7c2=['./chatInteraction.events','remove','update','length','chatInteraction:'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xb7c2,0x1cc));var _0x2b7c=function(_0x3b6aee,_0x169464){_0x3b6aee=_0x3b6aee-0x0;var _0x24a607=_0xb7c2[_0x3b6aee];return _0x24a607;};'use strict';var ChatInteractionEvents=require(_0x2b7c('0x0'));var events=['save',_0x2b7c('0x1'),_0x2b7c('0x2')];function createListener(_0x2f4f65,_0xeb4db8){return function(_0x235830){_0xeb4db8['emit'](_0x2f4f65,_0x235830);};}function removeListener(_0x2469df,_0x509ad8){return function(){ChatInteractionEvents['removeListener'](_0x2469df,_0x509ad8);};}exports['register']=function(_0x322ce0){for(var _0x376dc5=0x0,_0x4ae558=events[_0x2b7c('0x3')];_0x376dc5<_0x4ae558;_0x376dc5++){var _0x1cf970=events[_0x376dc5];var _0x3450c6=createListener(_0x2b7c('0x4')+_0x1cf970,_0x322ce0);ChatInteractionEvents['on'](_0x1cf970,_0x3450c6);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index aad2e39..4a9b443 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 _0xc4e1=['single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','/:id','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','/describe','get','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','/:id/download','create','post','createVidaooSession','diskStorage','join','root','format','%s-%s','originalname','replace','/:id/attachment_upload'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0xc4e1,0x172));var _0x1c4e=function(_0x2f81b0,_0x324a11){_0x2f81b0=_0x2f81b0-0x0;var _0xc384f8=_0xc4e1[_0x2f81b0];return _0xc384f8;};'use strict';var multer=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var path=require(_0x1c4e('0x2'));var timeout=require(_0x1c4e('0x3'));var express=require('express');var router=express[_0x1c4e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1c4e('0x5'));var config=require('../../config/environment');var controller=require(_0x1c4e('0x6'));router['get']('/',auth[_0x1c4e('0x7')](),controller[_0x1c4e('0x8')]);router['get'](_0x1c4e('0x9'),auth[_0x1c4e('0x7')](),controller['describe']);router[_0x1c4e('0xa')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x1c4e('0xb')]);router['get'](_0x1c4e('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x1c4e('0xd')]);router['get'](_0x1c4e('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x1c4e('0xf'),auth[_0x1c4e('0x10')](),controller[_0x1c4e('0x11')]);router['get'](_0x1c4e('0x12'),auth[_0x1c4e('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x1c4e('0x13')]);router[_0x1c4e('0x14')]('/:id/vidaoo',auth[_0x1c4e('0x7')](),controller[_0x1c4e('0x15')]);var upload=multer({'storage':multer[_0x1c4e('0x16')]({'destination':function(_0x31708b,_0x2d55bb,_0x4b12b3){_0x4b12b3(null,path[_0x1c4e('0x17')](config[_0x1c4e('0x18')],'server/files/attachments/'));},'filename':function(_0x4a5786,_0x572737,_0x54ef20){_0x54ef20(null,util[_0x1c4e('0x19')](_0x1c4e('0x1a'),Date['now'](),_0x572737[_0x1c4e('0x1b')][_0x1c4e('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1c4e('0x14')](_0x1c4e('0x1d'),upload[_0x1c4e('0x1e')](_0x1c4e('0x1f')),controller[_0x1c4e('0x20')]);router[_0x1c4e('0x14')](_0x1c4e('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x1c4e('0x21')]);router['post'](_0x1c4e('0x22'),auth[_0x1c4e('0x7')](),interaction[_0x1c4e('0x23')](_0x1c4e('0x24'),_0x1c4e('0x25')),controller['addTags']);router[_0x1c4e('0x26')](_0x1c4e('0x27'),auth[_0x1c4e('0x7')](),interaction[_0x1c4e('0x23')](_0x1c4e('0x24'),_0x1c4e('0x28')),controller['update']);router[_0x1c4e('0x26')](_0x1c4e('0x29'),controller[_0x1c4e('0x2a')]);router[_0x1c4e('0x26')](_0x1c4e('0x2b'),auth[_0x1c4e('0x10')](),controller['abandon']);router[_0x1c4e('0x26')](_0x1c4e('0x2c'),controller['close']);router[_0x1c4e('0x2d')](_0x1c4e('0x27'),auth[_0x1c4e('0x7')](),interaction[_0x1c4e('0x23')]('chat',_0x1c4e('0x2e')),controller[_0x1c4e('0x2f')]);router[_0x1c4e('0x2d')]('/:id/tags',auth[_0x1c4e('0x7')](),controller[_0x1c4e('0x30')]);module[_0x1c4e('0x31')]=router; \ No newline at end of file +var _0x88c7=['customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','update'];(function(_0x3528d6,_0x282dda){var _0x478e89=function(_0x4490f2){while(--_0x4490f2){_0x3528d6['push'](_0x3528d6['shift']());}};_0x478e89(++_0x282dda);}(_0x88c7,0x6f));var _0x788c=function(_0x1d5e2f,_0x3fc31e){_0x1d5e2f=_0x1d5e2f-0x0;var _0x3c36e8=_0x88c7[_0x1d5e2f];return _0x3c36e8;};'use strict';var multer=require(_0x788c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x788c('0x1'));var express=require(_0x788c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x788c('0x3'));var config=require(_0x788c('0x4'));var controller=require('./chatInteraction.controller');router[_0x788c('0x5')]('/',auth[_0x788c('0x6')](),controller['index']);router[_0x788c('0x5')](_0x788c('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x788c('0x5')](_0x788c('0x8'),auth[_0x788c('0x9')](),controller[_0x788c('0xa')]);router[_0x788c('0x5')]('/:id/attachment_download',auth[_0x788c('0x9')](),controller[_0x788c('0xb')]);router[_0x788c('0x5')]('/:id/messages',auth[_0x788c('0x6')](),controller[_0x788c('0xc')]);router[_0x788c('0x5')](_0x788c('0xd'),auth[_0x788c('0x9')](),controller[_0x788c('0xe')]);router['get'](_0x788c('0xf'),auth['isAuthenticated'](),controller[_0x788c('0x10')]);router['post']('/',auth[_0x788c('0x6')](),controller[_0x788c('0x11')]);router[_0x788c('0x12')](_0x788c('0x13'),auth[_0x788c('0x6')](),controller[_0x788c('0x14')]);var upload=multer({'storage':multer[_0x788c('0x15')]({'destination':function(_0x3d837d,_0x2b6e32,_0x41d920){_0x41d920(null,path[_0x788c('0x16')](config[_0x788c('0x17')],_0x788c('0x18')));},'filename':function(_0x5c942e,_0x2f3b41,_0xe0fea5){_0xe0fea5(null,util[_0x788c('0x19')](_0x788c('0x1a'),Date[_0x788c('0x1b')](),_0x2f3b41[_0x788c('0x1c')][_0x788c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x788c('0x12')](_0x788c('0x1e'),upload[_0x788c('0x1f')]('file'),controller[_0x788c('0x20')]);router[_0x788c('0x12')](_0x788c('0x21'),auth[_0x788c('0x9')](),controller[_0x788c('0x22')]);router[_0x788c('0x12')](_0x788c('0x23'),auth[_0x788c('0x6')](),interaction['tracked'](_0x788c('0x24'),_0x788c('0x25')),controller[_0x788c('0x26')]);router[_0x788c('0x27')](_0x788c('0x8'),auth[_0x788c('0x6')](),interaction[_0x788c('0x28')](_0x788c('0x24'),'chatinteraction:update'),controller[_0x788c('0x29')]);router[_0x788c('0x27')]('/:id/custom_update',controller[_0x788c('0x2a')]);router[_0x788c('0x27')](_0x788c('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x788c('0x2c')]);router[_0x788c('0x27')](_0x788c('0x2d'),controller[_0x788c('0x2e')]);router[_0x788c('0x2f')](_0x788c('0x8'),auth[_0x788c('0x6')](),interaction[_0x788c('0x28')](_0x788c('0x24'),'chatinteraction:destroy'),controller[_0x788c('0x30')]);router[_0x788c('0x2f')](_0x788c('0x23'),auth[_0x788c('0x6')](),controller[_0x788c('0x31')]);module[_0x788c('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 f24405d..34120f2 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x3525c8,_0x3f5015){var _0x3a6039=function(_0x42d9b9){while(--_0x42d9b9){_0x3525c8['push'](_0x3525c8['shift']());}};_0x3a6039(++_0x3f5015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x3f5b8a,_0x1a04e4){var _0x29a549=function(_0xe05474){while(--_0xe05474){_0x3f5b8a['push'](_0x3f5b8a['shift']());}};_0x29a549(++_0x1a04e4);}(_0xdb28,0x106));var _0x8db2=function(_0x82ed59,_0x4151d2){_0x82ed59=_0x82ed59-0x0;var _0x1aa339=_0xdb28[_0x82ed59];return _0x1aa339;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a29f9e3..17eff35 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 _0x836a=['type','key','query','model','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','attributes','fields','options','find','create','body','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','user','fullname','role','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','isEmpty','resourceId','push','ToId','read','-createdAt','all','html-pdf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','json','count','offset','limit','status','reject','save','update','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes'];(function(_0x1eee3d,_0x5a84a5){var _0x376e04=function(_0x36a199){while(--_0x36a199){_0x1eee3d['push'](_0x1eee3d['shift']());}};_0x376e04(++_0x5a84a5);}(_0x836a,0xa1));var _0xa836=function(_0x3dfbc3,_0x41a601){_0x3dfbc3=_0x3dfbc3-0x0;var _0x53fc9e=_0x836a[_0x3dfbc3];return _0x53fc9e;};'use strict';var pdf=require(_0xa836('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa836('0x1'));var moment=require(_0xa836('0x2'));var BPromise=require(_0xa836('0x3'));var Mustache=require(_0xa836('0x4'));var util=require('util');var path=require(_0xa836('0x5'));var sox=require(_0xa836('0x6'));var csv=require(_0xa836('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa836('0x8'));var squel=require(_0xa836('0x9'));var crypto=require(_0xa836('0xa'));var jsforce=require(_0xa836('0xb'));var deskjs=require(_0xa836('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa836('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa836('0xe'));var as=require(_0xa836('0xf'));var hardwareService=require(_0xa836('0x10'));var logger=require(_0xa836('0x11'))(_0xa836('0x12'));var utils=require(_0xa836('0x13'));var config=require(_0xa836('0x14'));var db=require(_0xa836('0x15'))['db'];config[_0xa836('0x16')]=_['defaults'](config[_0xa836('0x16')],{'host':_0xa836('0x17'),'port':0x18eb});var socket=require(_0xa836('0x18'))(new Redis(config[_0xa836('0x16')]));require(_0xa836('0x19'))[_0xa836('0x1a')](socket);function respondWithStatusCode(_0x52da21,_0x3ae4a7){_0x3ae4a7=_0x3ae4a7||0xcc;return function(_0x4301d0){if(_0x4301d0){return _0x52da21[_0xa836('0x1b')](_0x3ae4a7);}return _0x52da21['status'](_0x3ae4a7)[_0xa836('0x1c')]();};}function respondWithResult(_0x1c1cf1,_0x417f90){_0x417f90=_0x417f90||0xc8;return function(_0x123a3e){if(_0x123a3e){return _0x1c1cf1['status'](_0x417f90)[_0xa836('0x1d')](_0x123a3e);}};}function respondWithFilteredResult(_0x2fd3b5,_0x4ea073){return function(_0x2f5e9a){if(_0x2f5e9a){var _0x2a607e=_0x2f5e9a[_0xa836('0x1e')],_0x568cc0=_0x4ea073[_0xa836('0x1f')],_0x3c1002=_0x4ea073['offset']+_0x4ea073[_0xa836('0x20')],_0x41b5fe;if(_0x3c1002>=_0x2a607e){_0x3c1002=_0x2a607e;_0x41b5fe=0xc8;}else{_0x41b5fe=0xce;}_0x2fd3b5[_0xa836('0x21')](_0x41b5fe);return _0x2fd3b5['set']('Content-Range',_0x568cc0+'-'+_0x3c1002+'/'+_0x2a607e)[_0xa836('0x1d')](_0x2f5e9a);}return null;};}function patchUpdates(_0xdc266c){return function(_0x4f3208){try{jsonpatch['apply'](_0x4f3208,_0xdc266c,!![]);}catch(_0x304797){return BPromise[_0xa836('0x22')](_0x304797);}return _0x4f3208[_0xa836('0x23')]();};}function saveUpdates(_0x577882,_0x38af18){return function(_0x38b192){if(_0x38b192){return _0x38b192[_0xa836('0x24')](_0x577882)[_0xa836('0x25')](function(_0xfd36c9){return _0xfd36c9;});}return null;};}function removeEntity(_0x5ee9ed,_0x424e56){return function(_0x4717d7){if(_0x4717d7){return _0x4717d7[_0xa836('0x26')]()['then'](function(){_0x5ee9ed['status'](0xcc)[_0xa836('0x1c')]();});}};}function handleEntityNotFound(_0x5bbe8d,_0x1198bb){return function(_0x4d41a7){if(!_0x4d41a7){_0x5bbe8d['sendStatus'](0x194);}return _0x4d41a7;};}function handleError(_0x542f02,_0x17a2ca){_0x17a2ca=_0x17a2ca||0x1f4;return function(_0x5eb29b){logger['error'](_0x5eb29b[_0xa836('0x27')]);if(_0x5eb29b[_0xa836('0x28')]){delete _0x5eb29b[_0xa836('0x28')];}_0x542f02['status'](_0x17a2ca)[_0xa836('0x29')](_0x5eb29b);};}exports['index']=function(_0x3a218d,_0x1c7bf6){var _0x19aca2={},_0x35792e={},_0x46531c={'count':0x0,'rows':[]};var _0x5e0470=_[_0xa836('0x2a')](db[_0xa836('0x2b')][_0xa836('0x2c')],function(_0x39b46e){return{'name':_0x39b46e['fieldName'],'type':_0x39b46e[_0xa836('0x2d')][_0xa836('0x2e')]};});_0x35792e['model']=_[_0xa836('0x2a')](_0x5e0470,_0xa836('0x28'));_0x35792e[_0xa836('0x2f')]=_['keys'](_0x3a218d['query']);_0x35792e['filters']=_['intersection'](_0x35792e[_0xa836('0x30')],_0x35792e[_0xa836('0x2f')]);_0x19aca2['attributes']=_[_0xa836('0x31')](_0x35792e[_0xa836('0x30')],qs['fields'](_0x3a218d[_0xa836('0x2f')]['fields']));_0x19aca2['attributes']=_0x19aca2['attributes'][_0xa836('0x32')]?_0x19aca2['attributes']:_0x35792e[_0xa836('0x30')];if(!_0x3a218d[_0xa836('0x2f')][_0xa836('0x33')](_0xa836('0x34'))){_0x19aca2[_0xa836('0x20')]=qs['limit'](_0x3a218d[_0xa836('0x2f')][_0xa836('0x20')]);_0x19aca2['offset']=qs[_0xa836('0x1f')](_0x3a218d['query'][_0xa836('0x1f')]);}_0x19aca2[_0xa836('0x35')]=qs[_0xa836('0x36')](_0x3a218d['query'][_0xa836('0x36')]);_0x19aca2[_0xa836('0x37')]=qs['filters'](_[_0xa836('0x38')](_0x3a218d['query'],_0x35792e[_0xa836('0x39')]),_0x5e0470);if(_0x3a218d[_0xa836('0x2f')][_0xa836('0x3a')]){_0x19aca2[_0xa836('0x37')]=_[_0xa836('0x3b')](_0x19aca2['where'],{'$or':_[_0xa836('0x2a')](_0x5e0470,function(_0xeafb1e){if(_0xeafb1e[_0xa836('0x2d')]!==_0xa836('0x3c')){var _0x5cc9c5={};_0x5cc9c5[_0xeafb1e[_0xa836('0x28')]]={'$like':'%'+_0x3a218d[_0xa836('0x2f')][_0xa836('0x3a')]+'%'};return _0x5cc9c5;}})});}_0x19aca2=_[_0xa836('0x3b')]({},_0x19aca2,_0x3a218d['options']);var _0x5437f4={'where':_0x19aca2[_0xa836('0x37')]};return db[_0xa836('0x2b')][_0xa836('0x1e')](_0x5437f4)[_0xa836('0x25')](function(_0x14c52d){_0x46531c[_0xa836('0x1e')]=_0x14c52d;if(_0x3a218d[_0xa836('0x2f')][_0xa836('0x3d')]){_0x19aca2[_0xa836('0x3e')]=[{'all':!![]}];}return db[_0xa836('0x2b')]['findAll'](_0x19aca2);})[_0xa836('0x25')](function(_0x40460a){_0x46531c['rows']=_0x40460a;return _0x46531c;})[_0xa836('0x25')](respondWithFilteredResult(_0x1c7bf6,_0x19aca2))[_0xa836('0x3f')](handleError(_0x1c7bf6,null));};exports[_0xa836('0x40')]=function(_0x20a06c,_0x25fce3){var _0x5573dd={'raw':!![],'where':{'id':_0x20a06c[_0xa836('0x41')]['id']}},_0x23c4af={};_0x23c4af[_0xa836('0x30')]=_[_0xa836('0x42')](db[_0xa836('0x2b')][_0xa836('0x2c')]);_0x23c4af[_0xa836('0x2f')]=_['keys'](_0x20a06c[_0xa836('0x2f')]);_0x23c4af[_0xa836('0x39')]=_['intersection'](_0x23c4af['model'],_0x23c4af[_0xa836('0x2f')]);_0x5573dd[_0xa836('0x43')]=_[_0xa836('0x31')](_0x23c4af[_0xa836('0x30')],qs[_0xa836('0x44')](_0x20a06c[_0xa836('0x2f')]['fields']));_0x5573dd[_0xa836('0x43')]=_0x5573dd[_0xa836('0x43')][_0xa836('0x32')]?_0x5573dd['attributes']:_0x23c4af[_0xa836('0x30')];if(_0x20a06c[_0xa836('0x2f')][_0xa836('0x3d')]){_0x5573dd[_0xa836('0x3e')]=[{'all':!![]}];}_0x5573dd=_['merge']({},_0x5573dd,_0x20a06c[_0xa836('0x45')]);return db['ChatInternalMessage'][_0xa836('0x46')](_0x5573dd)[_0xa836('0x25')](handleEntityNotFound(_0x25fce3,null))[_0xa836('0x25')](respondWithResult(_0x25fce3,null))[_0xa836('0x3f')](handleError(_0x25fce3,null));};exports['create']=function(_0xab3449,_0x279fd9){return db[_0xa836('0x2b')][_0xa836('0x47')](_0xab3449['body'],{})['then'](respondWithResult(_0x279fd9,0xc9))[_0xa836('0x3f')](handleError(_0x279fd9,null));};exports['update']=function(_0x41fe89,_0x2f4717){if(_0x41fe89['body']['id']){delete _0x41fe89[_0xa836('0x48')]['id'];}return db[_0xa836('0x2b')]['find']({'where':{'id':_0x41fe89[_0xa836('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f4717,null))[_0xa836('0x25')](saveUpdates(_0x41fe89[_0xa836('0x48')],null))['then'](respondWithResult(_0x2f4717,null))[_0xa836('0x3f')](handleError(_0x2f4717,null));};exports['destroy']=function(_0x4960e2,_0x77fb48){return db[_0xa836('0x2b')][_0xa836('0x46')]({'where':{'id':_0x4960e2['params']['id']}})[_0xa836('0x25')](handleEntityNotFound(_0x77fb48,null))[_0xa836('0x25')](removeEntity(_0x77fb48,null))[_0xa836('0x3f')](handleError(_0x77fb48,null));};exports['describe']=function(_0x4c3542,_0x3f138a){return db[_0xa836('0x2b')]['describe']()[_0xa836('0x25')](respondWithResult(_0x3f138a,null))['catch'](handleError(_0x3f138a,null));};function wrapUser(_0x430d19){return function(_0x17cd4c){var _0x45f5a9=_0x430d19[_0xa836('0x49')]({'plain':!![]});_0x45f5a9[_0xa836('0x4a')]=[];if(_0x17cd4c){_0x45f5a9['lastMessageAt']=_0x17cd4c[_0xa836('0x4b')];_0x45f5a9[_0xa836('0x4c')]=_0x17cd4c;}else{_0x45f5a9[_0xa836('0x4d')]=moment(0x0)[_0xa836('0x4e')](_0xa836('0x4f'));_0x45f5a9[_0xa836('0x4c')]={};}return _0x45f5a9;};}exports['getUsers']=function(_0x5e390a,_0x218ff8,_0x36adb1){var _0x5af3b0=[];return db[_0xa836('0x50')][_0xa836('0x51')]({'where':{'role':[_0xa836('0x52'),_0xa836('0x53'),_0xa836('0x54')]},'attributes':['id',_0xa836('0x55'),_0xa836('0x28'),_0xa836('0x56'),'userpic','internal','online',_0xa836('0x57'),'allowmessenger',_0xa836('0x58')],'order':qs['sort'](_0xa836('0x59')),'include':[{'model':db[_0xa836('0x5a')],'as':_0xa836('0x5b'),'attributes':['id','name',_0xa836('0x2d')],'through':{'attributes':[]}}]})[_0xa836('0x25')](function(_0x394592){if(_0x394592){var _0x178c41=_0x5e390a[_0xa836('0x54')][_0xa836('0x49')]({'plain':!![]});if(!_0x178c41)throw new Error(_0xa836('0x5c'));if(_0x178c41[_0xa836('0x56')]===_0xa836('0x54')){return db[_0xa836('0x5d')][_0xa836('0x46')]({'where':{'name':_0xa836('0x5e'),'userProfileId':_0x178c41[_0xa836('0x5f')]},'raw':!![]})[_0xa836('0x25')](function(_0x58baf4){if(_0x58baf4){if(_0x58baf4['autoAssociation']===0x0){return db['UserProfileResource'][_0xa836('0x51')]({'where':{'sectionId':_0x58baf4['id']},'raw':!![]})['then'](function(_0x573060){var _0x5db52a=[];if(_[_0xa836('0x60')](_0x573060)){_0x5db52a=_['filter'](_0x394592,function(_0xbde0e8){if(_0xbde0e8[_0xa836('0x56')]!=='agent'){return _0xbde0e8;}});return _0x5db52a;}else{for(var _0x21ab1d=0x0;_0x21ab1d<_0x394592[_0xa836('0x32')];_0x21ab1d++){var _0x38380e=_0x394592[_0x21ab1d];if(_0x38380e[_0xa836('0x56')]==='agent'){var _0x214b7f=_[_0xa836('0x46')](_0x573060,function(_0x58a8fe){return _0x58a8fe[_0xa836('0x61')]===_0x38380e['id'];});if(_0x214b7f)_0x5db52a['push'](_0x38380e);}else{_0x5db52a[_0xa836('0x62')](_0x38380e);}}return _0x5db52a;}});}else{return _0x394592;}}else{var _0x29c770=_[_0xa836('0x3a')](_0x394592,function(_0x194c54){if(_0x194c54[_0xa836('0x56')]!==_0xa836('0x52')){return _0x194c54;}});return _0x29c770;}});}else{return _0x394592;}}})['then'](function(_0x2cce2c){var _0xccf11b=[];if(_0x2cce2c){_0x5af3b0=_0x2cce2c;for(var _0x27b6db=0x0;_0x27b6db<_0x2cce2c[_0xa836('0x32')];_0x27b6db+=0x1){_0x5af3b0[_0x27b6db][_0xa836('0x4a')]=[];_0xccf11b[_0xa836('0x62')](db[_0xa836('0x2b')]['find']({'where':{'FromId':[_0x5e390a['user']['id'],_0x2cce2c[_0x27b6db]['id']],'ToId':[_0x5e390a['user']['id'],_0x2cce2c[_0x27b6db]['id']],'ChatGroupId':null},'attributes':['id',_0xa836('0x4b'),'FromId',_0xa836('0x63'),_0xa836('0x64'),_0xa836('0x48')],'order':qs['sort'](_0xa836('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2cce2c[_0x27b6db])));}return BPromise[_0xa836('0x66')](_0xccf11b);}return[];})['then'](function(_0xa6c1be){return{'rows':_0xa6c1be,'count':_0xa6c1be[_0xa836('0x32')]};})[_0xa836('0x25')](respondWithResult(_0x218ff8,null))[_0xa836('0x3f')](handleError(_0x218ff8,null));}; \ No newline at end of file +var _0xf3c0=['index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','find','create','body','destroy','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','agent','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','end','error','stack','name'];(function(_0x496158,_0x798a8){var _0x3ae809=function(_0x6fa2ad){while(--_0x6fa2ad){_0x496158['push'](_0x496158['shift']());}};_0x3ae809(++_0x798a8);}(_0xf3c0,0xb8));var _0x0f3c=function(_0x466f46,_0x53cb02){_0x466f46=_0x466f46-0x0;var _0x3fad5d=_0xf3c0[_0x466f46];return _0x3fad5d;};'use strict';var pdf=require(_0x0f3c('0x0'));var emlformat=require(_0x0f3c('0x1'));var rimraf=require(_0x0f3c('0x2'));var zipdir=require(_0x0f3c('0x3'));var jsonpatch=require(_0x0f3c('0x4'));var rp=require(_0x0f3c('0x5'));var moment=require(_0x0f3c('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0f3c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0f3c('0x8'));var ejs=require(_0x0f3c('0x9'));var fs=require('fs');var _=require(_0x0f3c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0f3c('0xb'));var deskjs=require(_0x0f3c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0f3c('0xd'));var Papa=require('papaparse');var Redis=require(_0x0f3c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0f3c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f3c('0x10'));var logger=require('../../config/logger')(_0x0f3c('0x11'));var utils=require(_0x0f3c('0x12'));var config=require(_0x0f3c('0x13'));var db=require(_0x0f3c('0x14'))['db'];config[_0x0f3c('0x15')]=_[_0x0f3c('0x16')](config[_0x0f3c('0x15')],{'host':_0x0f3c('0x17'),'port':0x18eb});var socket=require(_0x0f3c('0x18'))(new Redis(config[_0x0f3c('0x15')]));require(_0x0f3c('0x19'))[_0x0f3c('0x1a')](socket);function respondWithStatusCode(_0x3e6905,_0x234dc4){_0x234dc4=_0x234dc4||0xcc;return function(_0x1c29d2){if(_0x1c29d2){return _0x3e6905[_0x0f3c('0x1b')](_0x234dc4);}return _0x3e6905[_0x0f3c('0x1c')](_0x234dc4)['end']();};}function respondWithResult(_0x2d2c9f,_0x165c91){_0x165c91=_0x165c91||0xc8;return function(_0x4f3bd0){if(_0x4f3bd0){return _0x2d2c9f[_0x0f3c('0x1c')](_0x165c91)[_0x0f3c('0x1d')](_0x4f3bd0);}};}function respondWithFilteredResult(_0x5345e7,_0x6567cc){return function(_0x2e07ce){if(_0x2e07ce){var _0x24ca2e=_0x2e07ce[_0x0f3c('0x1e')],_0x3fdad9=_0x6567cc[_0x0f3c('0x1f')],_0x2b9b73=_0x6567cc[_0x0f3c('0x1f')]+_0x6567cc[_0x0f3c('0x20')],_0x2672bf;if(_0x2b9b73>=_0x24ca2e){_0x2b9b73=_0x24ca2e;_0x2672bf=0xc8;}else{_0x2672bf=0xce;}_0x5345e7['status'](_0x2672bf);return _0x5345e7['set'](_0x0f3c('0x21'),_0x3fdad9+'-'+_0x2b9b73+'/'+_0x24ca2e)[_0x0f3c('0x1d')](_0x2e07ce);}return null;};}function patchUpdates(_0x149ba7){return function(_0x2a8181){try{jsonpatch[_0x0f3c('0x22')](_0x2a8181,_0x149ba7,!![]);}catch(_0x265fa7){return BPromise[_0x0f3c('0x23')](_0x265fa7);}return _0x2a8181[_0x0f3c('0x24')]();};}function saveUpdates(_0x587610,_0x25c73f){return function(_0x599ba8){if(_0x599ba8){return _0x599ba8[_0x0f3c('0x25')](_0x587610)['then'](function(_0x2239a7){return _0x2239a7;});}return null;};}function removeEntity(_0x2f22b1,_0x513668){return function(_0x5c027e){if(_0x5c027e){return _0x5c027e['destroy']()['then'](function(){_0x2f22b1[_0x0f3c('0x1c')](0xcc)[_0x0f3c('0x26')]();});}};}function handleEntityNotFound(_0x502ba2,_0x1a3a68){return function(_0x502994){if(!_0x502994){_0x502ba2['sendStatus'](0x194);}return _0x502994;};}function handleError(_0x319f59,_0x38b23a){_0x38b23a=_0x38b23a||0x1f4;return function(_0x22fc80){logger[_0x0f3c('0x27')](_0x22fc80[_0x0f3c('0x28')]);if(_0x22fc80['name']){delete _0x22fc80[_0x0f3c('0x29')];}_0x319f59[_0x0f3c('0x1c')](_0x38b23a)['send'](_0x22fc80);};}exports[_0x0f3c('0x2a')]=function(_0x31ae61,_0x342901){var _0xade6cb={},_0x33998b={},_0xdb198b={'count':0x0,'rows':[]};var _0x31aee4=_[_0x0f3c('0x2b')](db[_0x0f3c('0x2c')][_0x0f3c('0x2d')],function(_0x2de340){return{'name':_0x2de340[_0x0f3c('0x2e')],'type':_0x2de340['type'][_0x0f3c('0x2f')]};});_0x33998b[_0x0f3c('0x30')]=_[_0x0f3c('0x2b')](_0x31aee4,_0x0f3c('0x29'));_0x33998b[_0x0f3c('0x31')]=_[_0x0f3c('0x32')](_0x31ae61['query']);_0x33998b[_0x0f3c('0x33')]=_[_0x0f3c('0x34')](_0x33998b['model'],_0x33998b[_0x0f3c('0x31')]);_0xade6cb[_0x0f3c('0x35')]=_[_0x0f3c('0x34')](_0x33998b[_0x0f3c('0x30')],qs[_0x0f3c('0x36')](_0x31ae61['query'][_0x0f3c('0x36')]));_0xade6cb['attributes']=_0xade6cb[_0x0f3c('0x35')][_0x0f3c('0x37')]?_0xade6cb[_0x0f3c('0x35')]:_0x33998b[_0x0f3c('0x30')];if(!_0x31ae61[_0x0f3c('0x31')][_0x0f3c('0x38')](_0x0f3c('0x39'))){_0xade6cb[_0x0f3c('0x20')]=qs[_0x0f3c('0x20')](_0x31ae61[_0x0f3c('0x31')]['limit']);_0xade6cb[_0x0f3c('0x1f')]=qs[_0x0f3c('0x1f')](_0x31ae61[_0x0f3c('0x31')]['offset']);}_0xade6cb[_0x0f3c('0x3a')]=qs[_0x0f3c('0x3b')](_0x31ae61[_0x0f3c('0x31')][_0x0f3c('0x3b')]);_0xade6cb[_0x0f3c('0x3c')]=qs[_0x0f3c('0x33')](_[_0x0f3c('0x3d')](_0x31ae61[_0x0f3c('0x31')],_0x33998b[_0x0f3c('0x33')]),_0x31aee4);if(_0x31ae61['query'][_0x0f3c('0x3e')]){_0xade6cb['where']=_[_0x0f3c('0x3f')](_0xade6cb[_0x0f3c('0x3c')],{'$or':_[_0x0f3c('0x2b')](_0x31aee4,function(_0x210b37){if(_0x210b37['type']!==_0x0f3c('0x40')){var _0x2b520c={};_0x2b520c[_0x210b37[_0x0f3c('0x29')]]={'$like':'%'+_0x31ae61[_0x0f3c('0x31')][_0x0f3c('0x3e')]+'%'};return _0x2b520c;}})});}_0xade6cb=_[_0x0f3c('0x3f')]({},_0xade6cb,_0x31ae61[_0x0f3c('0x41')]);var _0x1dffa7={'where':_0xade6cb[_0x0f3c('0x3c')]};return db['ChatInternalMessage'][_0x0f3c('0x1e')](_0x1dffa7)['then'](function(_0x420674){_0xdb198b[_0x0f3c('0x1e')]=_0x420674;if(_0x31ae61[_0x0f3c('0x31')][_0x0f3c('0x42')]){_0xade6cb[_0x0f3c('0x43')]=[{'all':!![]}];}return db[_0x0f3c('0x2c')][_0x0f3c('0x44')](_0xade6cb);})[_0x0f3c('0x45')](function(_0x1ba771){_0xdb198b['rows']=_0x1ba771;return _0xdb198b;})['then'](respondWithFilteredResult(_0x342901,_0xade6cb))[_0x0f3c('0x46')](handleError(_0x342901,null));};exports[_0x0f3c('0x47')]=function(_0x237915,_0x6e209c){var _0x457011={'raw':!![],'where':{'id':_0x237915[_0x0f3c('0x48')]['id']}},_0x1dac99={};_0x1dac99[_0x0f3c('0x30')]=_['keys'](db['ChatInternalMessage'][_0x0f3c('0x2d')]);_0x1dac99['query']=_['keys'](_0x237915[_0x0f3c('0x31')]);_0x1dac99['filters']=_['intersection'](_0x1dac99['model'],_0x1dac99['query']);_0x457011[_0x0f3c('0x35')]=_[_0x0f3c('0x34')](_0x1dac99['model'],qs['fields'](_0x237915[_0x0f3c('0x31')][_0x0f3c('0x36')]));_0x457011['attributes']=_0x457011[_0x0f3c('0x35')][_0x0f3c('0x37')]?_0x457011[_0x0f3c('0x35')]:_0x1dac99['model'];if(_0x237915[_0x0f3c('0x31')][_0x0f3c('0x42')]){_0x457011[_0x0f3c('0x43')]=[{'all':!![]}];}_0x457011=_[_0x0f3c('0x3f')]({},_0x457011,_0x237915[_0x0f3c('0x41')]);return db[_0x0f3c('0x2c')][_0x0f3c('0x49')](_0x457011)['then'](handleEntityNotFound(_0x6e209c,null))[_0x0f3c('0x45')](respondWithResult(_0x6e209c,null))[_0x0f3c('0x46')](handleError(_0x6e209c,null));};exports[_0x0f3c('0x4a')]=function(_0x1be961,_0x4002c2){return db['ChatInternalMessage'][_0x0f3c('0x4a')](_0x1be961[_0x0f3c('0x4b')],{})[_0x0f3c('0x45')](respondWithResult(_0x4002c2,0xc9))['catch'](handleError(_0x4002c2,null));};exports[_0x0f3c('0x25')]=function(_0x517a32,_0x1a6b2b){if(_0x517a32['body']['id']){delete _0x517a32['body']['id'];}return db['ChatInternalMessage'][_0x0f3c('0x49')]({'where':{'id':_0x517a32[_0x0f3c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a6b2b,null))[_0x0f3c('0x45')](saveUpdates(_0x517a32[_0x0f3c('0x4b')],null))['then'](respondWithResult(_0x1a6b2b,null))[_0x0f3c('0x46')](handleError(_0x1a6b2b,null));};exports[_0x0f3c('0x4c')]=function(_0x2009bb,_0x32bffc){return db[_0x0f3c('0x2c')][_0x0f3c('0x49')]({'where':{'id':_0x2009bb[_0x0f3c('0x48')]['id']}})['then'](handleEntityNotFound(_0x32bffc,null))['then'](removeEntity(_0x32bffc,null))[_0x0f3c('0x46')](handleError(_0x32bffc,null));};exports['describe']=function(_0x202d07,_0x1c07b6){return db[_0x0f3c('0x2c')][_0x0f3c('0x4d')]()[_0x0f3c('0x45')](respondWithResult(_0x1c07b6,null))[_0x0f3c('0x46')](handleError(_0x1c07b6,null));};function wrapUser(_0x330520){return function(_0x37c19c){var _0x539221=_0x330520[_0x0f3c('0x4e')]({'plain':!![]});_0x539221[_0x0f3c('0x4f')]=[];if(_0x37c19c){_0x539221[_0x0f3c('0x50')]=_0x37c19c['createdAt'];_0x539221['lastMessage']=_0x37c19c;}else{_0x539221[_0x0f3c('0x50')]=moment(0x0)[_0x0f3c('0x51')](_0x0f3c('0x52'));_0x539221['lastMessage']={};}return _0x539221;};}exports[_0x0f3c('0x53')]=function(_0x1698d8,_0x2d232e,_0x4e6e5f){var _0x5346bd=[];return db[_0x0f3c('0x54')][_0x0f3c('0x44')]({'where':{'role':['agent',_0x0f3c('0x55'),_0x0f3c('0x56')]},'attributes':['id',_0x0f3c('0x57'),_0x0f3c('0x29'),_0x0f3c('0x58'),_0x0f3c('0x59'),_0x0f3c('0x5a'),_0x0f3c('0x5b'),_0x0f3c('0x5c'),_0x0f3c('0x5d'),_0x0f3c('0x5e')],'order':qs['sort']('-online'),'include':[{'model':db[_0x0f3c('0x5f')],'as':_0x0f3c('0x60'),'attributes':['id',_0x0f3c('0x29'),_0x0f3c('0x61')],'through':{'attributes':[]}}]})[_0x0f3c('0x45')](function(_0x23eef1){if(_0x23eef1){var _0x14b79c=_0x1698d8[_0x0f3c('0x56')][_0x0f3c('0x4e')]({'plain':!![]});if(!_0x14b79c)throw new Error(_0x0f3c('0x62'));if(_0x14b79c[_0x0f3c('0x58')]==='user'){return db[_0x0f3c('0x63')][_0x0f3c('0x49')]({'where':{'name':_0x0f3c('0x64'),'userProfileId':_0x14b79c[_0x0f3c('0x65')]},'raw':!![]})[_0x0f3c('0x45')](function(_0x40bf8f){if(_0x40bf8f){if(_0x40bf8f[_0x0f3c('0x66')]===0x0){return db[_0x0f3c('0x67')][_0x0f3c('0x44')]({'where':{'sectionId':_0x40bf8f['id']},'raw':!![]})[_0x0f3c('0x45')](function(_0x39c0dc){var _0x45a88d=[];if(_['isEmpty'](_0x39c0dc)){_0x45a88d=_[_0x0f3c('0x3e')](_0x23eef1,function(_0x535f20){if(_0x535f20[_0x0f3c('0x58')]!=='agent'){return _0x535f20;}});return _0x45a88d;}else{for(var _0x56be33=0x0;_0x56be33<_0x23eef1[_0x0f3c('0x37')];_0x56be33++){var _0x281ac=_0x23eef1[_0x56be33];if(_0x281ac[_0x0f3c('0x58')]===_0x0f3c('0x68')){var _0x3c96dc=_['find'](_0x39c0dc,function(_0x1e90a3){return _0x1e90a3[_0x0f3c('0x69')]===_0x281ac['id'];});if(_0x3c96dc)_0x45a88d[_0x0f3c('0x6a')](_0x281ac);}else{_0x45a88d[_0x0f3c('0x6a')](_0x281ac);}}return _0x45a88d;}});}else{return _0x23eef1;}}else{var _0x48991c=_['filter'](_0x23eef1,function(_0x41a2e8){if(_0x41a2e8['role']!==_0x0f3c('0x68')){return _0x41a2e8;}});return _0x48991c;}});}else{return _0x23eef1;}}})[_0x0f3c('0x45')](function(_0x44c1ea){var _0x48a371=[];if(_0x44c1ea){_0x5346bd=_0x44c1ea;for(var _0x1b480c=0x0;_0x1b480c<_0x44c1ea[_0x0f3c('0x37')];_0x1b480c+=0x1){_0x5346bd[_0x1b480c][_0x0f3c('0x4f')]=[];_0x48a371[_0x0f3c('0x6a')](db[_0x0f3c('0x2c')][_0x0f3c('0x49')]({'where':{'FromId':[_0x1698d8[_0x0f3c('0x56')]['id'],_0x44c1ea[_0x1b480c]['id']],'ToId':[_0x1698d8['user']['id'],_0x44c1ea[_0x1b480c]['id']],'ChatGroupId':null},'attributes':['id',_0x0f3c('0x6b'),_0x0f3c('0x6c'),_0x0f3c('0x6d'),_0x0f3c('0x6e'),_0x0f3c('0x4b')],'order':qs['sort'](_0x0f3c('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0f3c('0x45')](wrapUser(_0x44c1ea[_0x1b480c])));}return BPromise[_0x0f3c('0x70')](_0x48a371);}return[];})[_0x0f3c('0x45')](function(_0x572e8e){return{'rows':_0x572e8e,'count':_0x572e8e[_0x0f3c('0x37')]};})[_0x0f3c('0x45')](respondWithResult(_0x2d232e,null))[_0x0f3c('0x46')](handleError(_0x2d232e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 639360e..6f3ec9e 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 _0xe186=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x5eb54c,_0x18e877){var _0x8c2e02=function(_0x348324){while(--_0x348324){_0x5eb54c['push'](_0x5eb54c['shift']());}};_0x8c2e02(++_0x18e877);}(_0xe186,0x146));var _0x6e18=function(_0x378a79,_0x2e0505){_0x378a79=_0x378a79-0x0;var _0x9cc7fe=_0xe186[_0x378a79];return _0x9cc7fe;};'use strict';var EventEmitter=require(_0x6e18('0x0'));var ChatInternalMessage=require(_0x6e18('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6e18('0x2')](0x0);var events={'afterCreate':_0x6e18('0x3'),'afterUpdate':_0x6e18('0x4'),'afterDestroy':_0x6e18('0x5')};function emitEvent(_0x2b6009){return function(_0x4b7198,_0x1d3480,_0x530594){ChatInternalMessageEvents[_0x6e18('0x6')](_0x2b6009+':'+_0x4b7198['id'],_0x4b7198);ChatInternalMessageEvents[_0x6e18('0x6')](_0x2b6009,_0x4b7198);_0x530594(null);};}for(var e in events){if(events[_0x6e18('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xc903=['emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','update'];(function(_0x4e4818,_0x4e6615){var _0x52d174=function(_0x1c08a9){while(--_0x1c08a9){_0x4e4818['push'](_0x4e4818['shift']());}};_0x52d174(++_0x4e6615);}(_0xc903,0x177));var _0x3c90=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0xc903[_0x149ca0];return _0x56b6b9;};'use strict';var EventEmitter=require(_0x3c90('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x3c90('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3c90('0x2'),'afterDestroy':'remove'};function emitEvent(_0x426091){return function(_0x54545a,_0x1e9e2b,_0x2ecb71){ChatInternalMessageEvents['emit'](_0x426091+':'+_0x54545a['id'],_0x54545a);ChatInternalMessageEvents[_0x3c90('0x3')](_0x426091,_0x54545a);_0x2ecb71(null);};}for(var e in events){if(events[_0x3c90('0x4')](e)){var event=events[e];ChatInternalMessage[_0x3c90('0x5')](e,emitEvent(event));}}module[_0x3c90('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index ad47105..4e50089 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 _0x0c2e=['ChatInternalMessage','chat_internal_messages','lodash','../../config/logger','api','path','rimraf','../../config/environment','exports'];(function(_0x277607,_0x345a06){var _0x15fe23=function(_0x336de7){while(--_0x336de7){_0x277607['push'](_0x277607['shift']());}};_0x15fe23(++_0x345a06);}(_0x0c2e,0x1b2));var _0xe0c2=function(_0x159b78,_0x1f1acc){_0x159b78=_0x159b78-0x0;var _0x51f35d=_0x0c2e[_0x159b78];return _0x51f35d;};'use strict';var _=require(_0xe0c2('0x0'));var util=require('util');var logger=require(_0xe0c2('0x1'))(_0xe0c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0c2('0x3'));var rimraf=require(_0xe0c2('0x4'));var config=require(_0xe0c2('0x5'));var attributes=require('./chatInternalMessage.attributes');module[_0xe0c2('0x6')]=function(_0x5ee7f6,_0x27a975){return _0x5ee7f6['define'](_0xe0c2('0x7'),attributes,{'tableName':_0xe0c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe617=['define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x2af79a,_0x5c5d1a){var _0x8df446=function(_0x2138fd){while(--_0x2138fd){_0x2af79a['push'](_0x2af79a['shift']());}};_0x8df446(++_0x5c5d1a);}(_0xe617,0x1c6));var _0x7e61=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe617[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7e61('0x0'));var util=require(_0x7e61('0x1'));var logger=require(_0x7e61('0x2'))(_0x7e61('0x3'));var moment=require(_0x7e61('0x4'));var BPromise=require(_0x7e61('0x5'));var rp=require(_0x7e61('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e61('0x7'));var config=require(_0x7e61('0x8'));var attributes=require(_0x7e61('0x9'));module[_0x7e61('0xa')]=function(_0xb60742,_0x45110b){return _0xb60742[_0x7e61('0xb')](_0x7e61('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e61('0xd'),'collate':_0x7e61('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index dbbcd71..a24b662 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 _0x8e1b=['../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0x8e1b,0xfc));var _0xb8e1=function(_0x198300,_0x45af06){_0x198300=_0x198300-0x0;var _0x2d254b=_0x8e1b[_0x198300];return _0x2d254b;};'use strict';var _=require(_0xb8e1('0x0'));var util=require(_0xb8e1('0x1'));var moment=require(_0xb8e1('0x2'));var BPromise=require(_0xb8e1('0x3'));var rs=require(_0xb8e1('0x4'));var fs=require('fs');var Redis=require(_0xb8e1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8e1('0x6'));var logger=require(_0xb8e1('0x7'))(_0xb8e1('0x8'));var config=require(_0xb8e1('0x9'));var jayson=require(_0xb8e1('0xa'));var client=jayson[_0xb8e1('0xb')]['http']({'port':0x232a});config['redis']=_[_0xb8e1('0xc')](config[_0xb8e1('0xd')],{'host':_0xb8e1('0xe'),'port':0x18eb});var socket=require(_0xb8e1('0xf'))(new Redis(config[_0xb8e1('0xd')]));require(_0xb8e1('0x10'))[_0xb8e1('0x11')](socket);function respondWithRpcPromise(_0x3e1787,_0x3e041c,_0x2e8c74){return new BPromise(function(_0x45bae4,_0x3f57b0){return client['request'](_0x3e1787,_0x2e8c74)[_0xb8e1('0x12')](function(_0x14d2cb){logger['info'](_0xb8e1('0x13'),_0x3e041c,_0xb8e1('0x14'));logger[_0xb8e1('0x15')](_0xb8e1('0x16'),_0x3e041c,_0xb8e1('0x14'),JSON[_0xb8e1('0x17')](_0x14d2cb));if(_0x14d2cb[_0xb8e1('0x18')]){if(_0x14d2cb[_0xb8e1('0x18')][_0xb8e1('0x19')]===0x1f4){logger['error'](_0xb8e1('0x13'),_0x3e041c,_0x14d2cb[_0xb8e1('0x18')]['message']);return _0x3f57b0(_0x14d2cb[_0xb8e1('0x18')]['message']);}logger[_0xb8e1('0x18')](_0xb8e1('0x13'),_0x3e041c,_0x14d2cb[_0xb8e1('0x18')][_0xb8e1('0x1a')]);return _0x45bae4(_0x14d2cb['error'][_0xb8e1('0x1a')]);}else{logger[_0xb8e1('0x1b')](_0xb8e1('0x13'),_0x3e041c,'request\x20sent');_0x45bae4(_0x14d2cb['result'][_0xb8e1('0x1a')]);}})[_0xb8e1('0x1c')](function(_0x10ddf1){logger[_0xb8e1('0x18')](_0xb8e1('0x13'),_0x3e041c,_0x10ddf1);_0x3f57b0(_0x10ddf1);});});} \ No newline at end of file +var _0x3023=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','ChatInternalMessage,\x20%s,\x20%s','message'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x3023,0x1c4));var _0x3302=function(_0x347c13,_0x5c4c6f){_0x347c13=_0x347c13-0x0;var _0x2011a5=_0x3023[_0x347c13];return _0x2011a5;};'use strict';var _=require(_0x3302('0x0'));var util=require(_0x3302('0x1'));var moment=require('moment');var BPromise=require(_0x3302('0x2'));var rs=require(_0x3302('0x3'));var fs=require('fs');var Redis=require(_0x3302('0x4'));var db=require(_0x3302('0x5'))['db'];var utils=require(_0x3302('0x6'));var logger=require(_0x3302('0x7'))(_0x3302('0x8'));var config=require(_0x3302('0x9'));var jayson=require(_0x3302('0xa'));var client=jayson[_0x3302('0xb')][_0x3302('0xc')]({'port':0x232a});config['redis']=_[_0x3302('0xd')](config[_0x3302('0xe')],{'host':_0x3302('0xf'),'port':0x18eb});var socket=require(_0x3302('0x10'))(new Redis(config['redis']));require(_0x3302('0x11'))[_0x3302('0x12')](socket);function respondWithRpcPromise(_0x11acc0,_0x32340d,_0x350eba){return new BPromise(function(_0x4793bc,_0x4fcb4a){return client[_0x3302('0x13')](_0x11acc0,_0x350eba)['then'](function(_0x318a41){logger[_0x3302('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x32340d,_0x3302('0x15'));logger[_0x3302('0x16')](_0x3302('0x17'),_0x32340d,'request\x20sent',JSON['stringify'](_0x318a41));if(_0x318a41[_0x3302('0x18')]){if(_0x318a41[_0x3302('0x18')][_0x3302('0x19')]===0x1f4){logger[_0x3302('0x18')](_0x3302('0x1a'),_0x32340d,_0x318a41['error'][_0x3302('0x1b')]);return _0x4fcb4a(_0x318a41[_0x3302('0x18')]['message']);}logger[_0x3302('0x18')](_0x3302('0x1a'),_0x32340d,_0x318a41[_0x3302('0x18')][_0x3302('0x1b')]);return _0x4793bc(_0x318a41['error'][_0x3302('0x1b')]);}else{logger[_0x3302('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x32340d,_0x3302('0x15'));_0x4793bc(_0x318a41[_0x3302('0x1c')][_0x3302('0x1b')]);}})[_0x3302('0x1d')](function(_0x67560a){logger[_0x3302('0x18')](_0x3302('0x1a'),_0x32340d,_0x67560a);_0x4fcb4a(_0x67560a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 21a4da0..b302a15 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 _0xb2b5=['chatInternalMessage:','removeListener','register'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xb2b5[_0x4fde08];return _0x12e725;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove','update'];function createListener(_0x4746e7,_0x1431f3){return function(_0x518fe7){_0x1431f3['emit'](_0x4746e7,_0x518fe7);};}function removeListener(_0x31784d,_0x11fae1){return function(){ChatInternalMessageEvents[_0x5b2b('0x0')](_0x31784d,_0x11fae1);};}exports[_0x5b2b('0x1')]=function(_0x49d9f6){for(var _0x30c3e2=0x0,_0x362524=events['length'];_0x30c3e2<_0x362524;_0x30c3e2++){var _0x54389e=events[_0x30c3e2];var _0x1e08e6=createListener(_0x5b2b('0x2')+_0x54389e,_0x49d9f6);ChatInternalMessageEvents['on'](_0x54389e,_0x1e08e6);}}; \ No newline at end of file +var _0x0506=['emit','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x469c01,_0x10c93c){var _0x534c6f=function(_0x7de94f){while(--_0x7de94f){_0x469c01['push'](_0x469c01['shift']());}};_0x534c6f(++_0x10c93c);}(_0x0506,0x1d1));var _0x6050=function(_0x10700e,_0x4c1777){_0x10700e=_0x10700e-0x0;var _0x317991=_0x0506[_0x10700e];return _0x317991;};'use strict';var ChatInternalMessageEvents=require(_0x6050('0x0'));var events=[_0x6050('0x1'),_0x6050('0x2'),'update'];function createListener(_0x52f82b,_0x5139c7){return function(_0x49a1ca){_0x5139c7[_0x6050('0x3')](_0x52f82b,_0x49a1ca);};}function removeListener(_0x58e2a9,_0x3cbb1f){return function(){ChatInternalMessageEvents['removeListener'](_0x58e2a9,_0x3cbb1f);};}exports['register']=function(_0xfd44cc){for(var _0x269be3=0x0,_0x2a3644=events[_0x6050('0x4')];_0x269be3<_0x2a3644;_0x269be3++){var _0x3512ba=events[_0x269be3];var _0xf64de5=createListener(_0x6050('0x5')+_0x3512ba,_0xfd44cc);ChatInternalMessageEvents['on'](_0x3512ba,_0xf64de5);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b92a829..78ba941 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(_0xdb262b,_0x27d28c){var _0x4e5b1e=function(_0x586740){while(--_0x586740){_0xdb262b['push'](_0xdb262b['shift']());}};_0x4e5b1e(++_0x27d28c);}(_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 _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x42fbcd,_0x4b1bb0){var _0x1dc2b7=function(_0x43b072){while(--_0x43b072){_0x42fbcd['push'](_0x42fbcd['shift']());}};_0x1dc2b7(++_0x4b1bb0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xcb91[_0x576266];return _0x18234f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 535caa2..37ca5ff 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 _0x00d6=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x44cfdd,_0x24d855){var _0x49b6b9=function(_0xe5ea5c){while(--_0xe5ea5c){_0x44cfdd['push'](_0x44cfdd['shift']());}};_0x49b6b9(++_0x24d855);}(_0x00d6,0x1e5));var _0x600d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x00d6[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x600d('0x0'));module[_0x600d('0x1')]={'body':{'type':Sequelize[_0x600d('0x2')](_0x600d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x600d('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x600d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x600d('0x5')]('in',_0x600d('0x6')),'defaultValue':_0x600d('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x600d('0x7')]}}; \ No newline at end of file +var _0xed03=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x51a81c,_0x52e60f){var _0x56827a=function(_0x1cf3d3){while(--_0x1cf3d3){_0x51a81c['push'](_0x51a81c['shift']());}};_0x56827a(++_0x52e60f);}(_0xed03,0xf0));var _0x3ed0=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xed03[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require(_0x3ed0('0x0'));module[_0x3ed0('0x1')]={'body':{'type':Sequelize[_0x3ed0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3ed0('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3ed0('0x4')]('in',_0x3ed0('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3ed0('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 80ea695..d64d03a 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 _0x0aba=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','destroy','name','send','index','ChatMessage','rawAttributes','fieldName','type','model','map','keys','attributes','query','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','fields','find','create','body','describe','chat-interactions','accept','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','interface','channel','event','EventManager','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SIP/%s','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse'];(function(_0x59026b,_0x12ace5){var _0x2c6152=function(_0x193dc2){while(--_0x193dc2){_0x59026b['push'](_0x59026b['shift']());}};_0x2c6152(++_0x12ace5);}(_0x0aba,0xdc));var _0xa0ab=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x0aba[_0x58dc25];return _0x21b0a7;};'use strict';var pdf=require(_0xa0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa0ab('0x1'));var zipdir=require(_0xa0ab('0x2'));var jsonpatch=require(_0xa0ab('0x3'));var rp=require(_0xa0ab('0x4'));var moment=require('moment');var BPromise=require(_0xa0ab('0x5'));var Mustache=require(_0xa0ab('0x6'));var util=require(_0xa0ab('0x7'));var path=require(_0xa0ab('0x8'));var sox=require('sox');var csv=require(_0xa0ab('0x9'));var ejs=require(_0xa0ab('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa0ab('0xb'));var crypto=require(_0xa0ab('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa0ab('0xd'));var toCsv=require(_0xa0ab('0x9'));var querystring=require(_0xa0ab('0xe'));var Papa=require(_0xa0ab('0xf'));var Redis=require(_0xa0ab('0x10'));var authService=require(_0xa0ab('0x11'));var qs=require(_0xa0ab('0x12'));var as=require(_0xa0ab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0ab('0x14'))('api');var utils=require(_0xa0ab('0x15'));var config=require('../../config/environment');var db=require(_0xa0ab('0x16'))['db'];config[_0xa0ab('0x17')]=_['defaults'](config[_0xa0ab('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0ab('0x18'))(new Redis(config[_0xa0ab('0x17')]));require(_0xa0ab('0x19'))[_0xa0ab('0x1a')](socket);var jayson=require(_0xa0ab('0x1b'));var client=jayson[_0xa0ab('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xa0ab('0x1c')][_0xa0ab('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2257d7,_0x448fcb,_0x4299d3){if(_0x4299d3){var _0x31441e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31441e[_0xa0ab('0x1e')](_0x448fcb)){return _0x2257d7;}else{throw new db['Sequelize']['ValidationError'](_0xa0ab('0x1f'));}}else{return _0x2257d7;}}function respondWithRpcPromise(_0x37a71f,_0x3eb7e6,_0x2933e8,_0x1136a9){return new BPromise(function(_0x2ad25a,_0x5c4e6b){var _0x5e5096=_0x1136a9||client;return _0x5e5096['request'](_0x37a71f,_0x2933e8)[_0xa0ab('0x20')](function(_0x1578f7){logger[_0xa0ab('0x21')](_0xa0ab('0x22'),_0x3eb7e6,_0xa0ab('0x23'));logger[_0xa0ab('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3eb7e6,_0xa0ab('0x23'),JSON[_0xa0ab('0x25')](_0x1578f7));if(_0x1578f7[_0xa0ab('0x26')]){if(_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x27')]===0x1f4){logger[_0xa0ab('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3eb7e6,_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x28')]);return _0x5c4e6b(_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x28')]);}logger[_0xa0ab('0x26')](_0xa0ab('0x22'),_0x3eb7e6,_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x28')]);return _0x2ad25a(_0x1578f7[_0xa0ab('0x26')][_0xa0ab('0x28')]);}else{logger[_0xa0ab('0x21')]('ChatMessage,\x20%s,\x20%s',_0x3eb7e6,'request\x20sent');_0x2ad25a(_0x1578f7[_0xa0ab('0x29')]['message']);}})[_0xa0ab('0x2a')](function(_0x3a7324){logger[_0xa0ab('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3eb7e6,_0x3a7324);_0x5c4e6b(_0x3a7324);});});}function respondWithStatusCode(_0x3ce374,_0x2fca2e){_0x2fca2e=_0x2fca2e||0xcc;return function(_0x4e11cb){if(_0x4e11cb){return _0x3ce374[_0xa0ab('0x2b')](_0x2fca2e);}return _0x3ce374['status'](_0x2fca2e)[_0xa0ab('0x2c')]();};}function respondWithResult(_0x420961,_0x2d758c){_0x2d758c=_0x2d758c||0xc8;return function(_0x2720d8){if(_0x2720d8){return _0x420961[_0xa0ab('0x2d')](_0x2d758c)['json'](_0x2720d8);}};}function respondWithFilteredResult(_0x4ff020,_0x49f9fd){return function(_0xd05742){if(_0xd05742){var _0x38e778=_0xd05742[_0xa0ab('0x2e')],_0x5ba64e=_0x49f9fd[_0xa0ab('0x2f')],_0x4c8d29=_0x49f9fd[_0xa0ab('0x2f')]+_0x49f9fd[_0xa0ab('0x30')],_0x60f069;if(_0x4c8d29>=_0x38e778){_0x4c8d29=_0x38e778;_0x60f069=0xc8;}else{_0x60f069=0xce;}_0x4ff020['status'](_0x60f069);return _0x4ff020[_0xa0ab('0x31')]('Content-Range',_0x5ba64e+'-'+_0x4c8d29+'/'+_0x38e778)[_0xa0ab('0x32')](_0xd05742);}return null;};}function patchUpdates(_0x5432fc){return function(_0x2271f8){try{jsonpatch[_0xa0ab('0x33')](_0x2271f8,_0x5432fc,!![]);}catch(_0xba23cd){return BPromise[_0xa0ab('0x34')](_0xba23cd);}return _0x2271f8[_0xa0ab('0x35')]();};}function saveUpdates(_0x40ec7c,_0x251e11){return function(_0x3318e3){if(_0x3318e3){return _0x3318e3[_0xa0ab('0x36')](_0x40ec7c)['then'](function(_0x20310d){return _0x20310d;});}return null;};}function removeEntity(_0x13d863,_0x504b8a){return function(_0x20233a){if(_0x20233a){return _0x20233a[_0xa0ab('0x37')]()[_0xa0ab('0x20')](function(){_0x13d863[_0xa0ab('0x2d')](0xcc)[_0xa0ab('0x2c')]();});}};}function handleEntityNotFound(_0xa94e3b,_0x549ba5){return function(_0x48fdf3){if(!_0x48fdf3){_0xa94e3b[_0xa0ab('0x2b')](0x194);}return _0x48fdf3;};}function handleError(_0x51b626,_0x5d4bc2){_0x5d4bc2=_0x5d4bc2||0x1f4;return function(_0x4450f2){logger[_0xa0ab('0x26')](_0x4450f2['stack']);if(_0x4450f2[_0xa0ab('0x38')]){delete _0x4450f2[_0xa0ab('0x38')];}_0x51b626[_0xa0ab('0x2d')](_0x5d4bc2)[_0xa0ab('0x39')](_0x4450f2);};}exports[_0xa0ab('0x3a')]=function(_0x5e6e4f,_0x3f037d){var _0x33160b={},_0x3777c6={},_0x1fa261={'count':0x0,'rows':[]};var _0x242466=_['map'](db[_0xa0ab('0x3b')][_0xa0ab('0x3c')],function(_0x1c9d56){return{'name':_0x1c9d56[_0xa0ab('0x3d')],'type':_0x1c9d56[_0xa0ab('0x3e')]['key']};});_0x3777c6[_0xa0ab('0x3f')]=_[_0xa0ab('0x40')](_0x242466,_0xa0ab('0x38'));_0x3777c6['query']=_[_0xa0ab('0x41')](_0x5e6e4f['query']);_0x3777c6['filters']=_['intersection'](_0x3777c6['model'],_0x3777c6['query']);_0x33160b[_0xa0ab('0x42')]=_['intersection'](_0x3777c6['model'],qs['fields'](_0x5e6e4f[_0xa0ab('0x43')]['fields']));_0x33160b[_0xa0ab('0x42')]=_0x33160b[_0xa0ab('0x42')]['length']?_0x33160b[_0xa0ab('0x42')]:_0x3777c6[_0xa0ab('0x3f')];if(!_0x5e6e4f[_0xa0ab('0x43')]['hasOwnProperty'](_0xa0ab('0x44'))){_0x33160b[_0xa0ab('0x30')]=qs['limit'](_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x30')]);_0x33160b[_0xa0ab('0x2f')]=qs[_0xa0ab('0x2f')](_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x2f')]);}_0x33160b[_0xa0ab('0x45')]=qs[_0xa0ab('0x46')](_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x46')]);_0x33160b[_0xa0ab('0x47')]=qs[_0xa0ab('0x48')](_[_0xa0ab('0x49')](_0x5e6e4f[_0xa0ab('0x43')],_0x3777c6['filters']),_0x242466);if(_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x4a')]){_0x33160b[_0xa0ab('0x47')]=_[_0xa0ab('0x4b')](_0x33160b['where'],{'$or':_[_0xa0ab('0x40')](_0x242466,function(_0x46eb08){if(_0x46eb08['type']!==_0xa0ab('0x4c')){var _0x336b4e={};_0x336b4e[_0x46eb08['name']]={'$like':'%'+_0x5e6e4f[_0xa0ab('0x43')][_0xa0ab('0x4a')]+'%'};return _0x336b4e;}})});}_0x33160b=_['merge']({},_0x33160b,_0x5e6e4f[_0xa0ab('0x4d')]);var _0x1fdae8={'where':_0x33160b['where']};return db['ChatMessage'][_0xa0ab('0x2e')](_0x1fdae8)[_0xa0ab('0x20')](function(_0x398234){_0x1fa261[_0xa0ab('0x2e')]=_0x398234;if(_0x5e6e4f['query'][_0xa0ab('0x4e')]){_0x33160b[_0xa0ab('0x4f')]=[{'all':!![]}];}return db[_0xa0ab('0x3b')][_0xa0ab('0x50')](_0x33160b);})[_0xa0ab('0x20')](function(_0x38d333){_0x1fa261['rows']=_0x38d333;return _0x1fa261;})[_0xa0ab('0x20')](respondWithFilteredResult(_0x3f037d,_0x33160b))[_0xa0ab('0x2a')](handleError(_0x3f037d,null));};exports[_0xa0ab('0x51')]=function(_0x415c09,_0x15c101){var _0x3ab469={'raw':!![],'where':{'id':_0x415c09[_0xa0ab('0x52')]['id']}},_0x40f381={};_0x40f381[_0xa0ab('0x3f')]=_['keys'](db['ChatMessage'][_0xa0ab('0x3c')]);_0x40f381['query']=_[_0xa0ab('0x41')](_0x415c09[_0xa0ab('0x43')]);_0x40f381[_0xa0ab('0x48')]=_[_0xa0ab('0x53')](_0x40f381[_0xa0ab('0x3f')],_0x40f381[_0xa0ab('0x43')]);_0x3ab469[_0xa0ab('0x42')]=_['intersection'](_0x40f381[_0xa0ab('0x3f')],qs[_0xa0ab('0x54')](_0x415c09['query']['fields']));_0x3ab469[_0xa0ab('0x42')]=_0x3ab469[_0xa0ab('0x42')]['length']?_0x3ab469['attributes']:_0x40f381[_0xa0ab('0x3f')];if(_0x415c09[_0xa0ab('0x43')][_0xa0ab('0x4e')]){_0x3ab469['include']=[{'all':!![]}];}_0x3ab469=_[_0xa0ab('0x4b')]({},_0x3ab469,_0x415c09[_0xa0ab('0x4d')]);return db[_0xa0ab('0x3b')][_0xa0ab('0x55')](_0x3ab469)['then'](handleEntityNotFound(_0x15c101,null))['then'](respondWithResult(_0x15c101,null))[_0xa0ab('0x2a')](handleError(_0x15c101,null));};exports[_0xa0ab('0x56')]=function(_0x5aaca6,_0x3f4d14){return db['ChatMessage'][_0xa0ab('0x56')](_0x5aaca6['body'],{})[_0xa0ab('0x20')](respondWithResult(_0x3f4d14,0xc9))['catch'](handleError(_0x3f4d14,null));};exports['update']=function(_0x49953f,_0x482176){if(_0x49953f['body']['id']){delete _0x49953f['body']['id'];}return db[_0xa0ab('0x3b')][_0xa0ab('0x55')]({'where':{'id':_0x49953f['params']['id']}})[_0xa0ab('0x20')](handleEntityNotFound(_0x482176,null))[_0xa0ab('0x20')](saveUpdates(_0x49953f[_0xa0ab('0x57')],null))[_0xa0ab('0x20')](respondWithResult(_0x482176,null))[_0xa0ab('0x2a')](handleError(_0x482176,null));};exports[_0xa0ab('0x37')]=function(_0x2c8451,_0xfe3143){return db[_0xa0ab('0x3b')][_0xa0ab('0x55')]({'where':{'id':_0x2c8451['params']['id']}})[_0xa0ab('0x20')](handleEntityNotFound(_0xfe3143,null))['then'](removeEntity(_0xfe3143,null))[_0xa0ab('0x2a')](handleError(_0xfe3143,null));};exports['describe']=function(_0xe3fc8,_0x57a28d){return db[_0xa0ab('0x3b')][_0xa0ab('0x58')]()[_0xa0ab('0x20')](respondWithResult(_0x57a28d,null))[_0xa0ab('0x2a')](handleError(_0x57a28d,null));};var interaction_log=require(_0xa0ab('0x14'))(_0xa0ab('0x59'));exports[_0xa0ab('0x5a')]=function(_0x5c942d,_0xc9def4,_0x36efb9){var _0x140dbb={'channel':_0xa0ab('0x5b')};if(_0x5c942d[_0xa0ab('0x57')]['id']){delete _0x5c942d['body']['id'];}_0x5c942d[_0xa0ab('0x57')]['read']=!![];_0x5c942d[_0xa0ab('0x57')][_0xa0ab('0x5c')]=moment()['format'](_0xa0ab('0x5d'));_0x5c942d['body'][_0xa0ab('0x5e')]=_0x5c942d['body'][_0xa0ab('0x5e')]||_0x5c942d['user']['id'];return db['ChatMessage'][_0xa0ab('0x55')]({'where':{'id':_0x5c942d[_0xa0ab('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xa0ab('0x5f')],'as':_0xa0ab('0x60')}]})[_0xa0ab('0x20')](handleEntityNotFound(_0xc9def4,null))[_0xa0ab('0x20')](saveUpdates(_0x5c942d['body'],null))[_0xa0ab('0x20')](function(_0x83e618){if(_0x83e618){_0x140dbb['message']=_0x83e618[_0xa0ab('0x61')]({'plain':!![]});return db[_0xa0ab('0x62')][_0xa0ab('0x55')]({'where':{'id':_0x83e618[_0xa0ab('0x63')]}});}return null;})[_0xa0ab('0x20')](handleEntityNotFound(_0xc9def4,null))[_0xa0ab('0x20')](function(_0x432914){if(_0x432914){return _0x432914[_0xa0ab('0x36')]({'UserId':_0x5c942d[_0xa0ab('0x57')][_0xa0ab('0x5e')],'read1stAt':_[_0xa0ab('0x64')](_0x432914['read1stAt'])?moment()[_0xa0ab('0x65')](_0xa0ab('0x5d')):undefined});}return null;})[_0xa0ab('0x20')](function(_0x11967b){if(_0x11967b){_0x140dbb[_0xa0ab('0x66')]=_0x11967b[_0xa0ab('0x61')]({'plain':!![]});interaction_log[_0xa0ab('0x21')](_0xa0ab('0x67'),_0x5c942d[_0xa0ab('0x68')]['id'],_0x5c942d[_0xa0ab('0x68')][_0xa0ab('0x38')],_0x5c942d['user']['role'],_0x140dbb['interaction']['id'],_0x5c942d[_0xa0ab('0x57')]?JSON[_0xa0ab('0x25')](_0x5c942d[_0xa0ab('0x57')]):_0xa0ab('0x69'));return respondWithRpcPromise('AcceptMessage',_0xa0ab('0x6a'),_0x140dbb);}return null;})[_0xa0ab('0x20')](function(_0x4c976d){if(_0x4c976d){if(_0x5c942d['body']['manual']){_0x140dbb[_0xa0ab('0x28')][_0xa0ab('0x6b')]=util[_0xa0ab('0x65')]('SIP/%s',_0x5c942d[_0xa0ab('0x68')][_0xa0ab('0x38')]);_0x140dbb[_0xa0ab('0x28')]['channel']=_0x140dbb[_0xa0ab('0x6c')];_0x140dbb[_0xa0ab('0x28')][_0xa0ab('0x6d')]=_0xa0ab('0x5a');return respondWithRpcPromise(_0xa0ab('0x6e'),_0xa0ab('0x6e'),{'event':'acceptmessage','message':_[_0xa0ab('0x4b')](_0x140dbb[_0xa0ab('0x28')],JSON['parse'](_0x140dbb['interaction'][_0xa0ab('0x6f')]))},client9002)[_0xa0ab('0x20')](function(){return _0x140dbb;});}return _0x140dbb;}return null;})[_0xa0ab('0x20')](respondWithResult(_0xc9def4,null))['catch'](handleError(_0xc9def4,null));};var interaction_log=require(_0xa0ab('0x14'))(_0xa0ab('0x59'));exports[_0xa0ab('0x34')]=function(_0x4c5dbb,_0x410bda,_0x1a338f){var _0x20efb3={'agent':{},'channel':_0xa0ab('0x5b')};if(_0x4c5dbb[_0xa0ab('0x57')]['id']){delete _0x4c5dbb[_0xa0ab('0x57')]['id'];}_0x4c5dbb[_0xa0ab('0x57')][_0xa0ab('0x5e')]=_0x4c5dbb[_0xa0ab('0x57')][_0xa0ab('0x5e')]||_0x4c5dbb[_0xa0ab('0x68')]['id'];_0x20efb3[_0xa0ab('0x70')]['id']=_0x4c5dbb[_0xa0ab('0x57')][_0xa0ab('0x5e')];return db[_0xa0ab('0x3b')][_0xa0ab('0x55')]({'where':{'id':_0x4c5dbb[_0xa0ab('0x52')]['id'],'UserId':null}})[_0xa0ab('0x20')](handleEntityNotFound(_0x410bda,null))[_0xa0ab('0x20')](function(_0x259c5c){if(_0x259c5c){_0x20efb3['message']=_0x259c5c[_0xa0ab('0x61')]({'plain':!![]});return db[_0xa0ab('0x62')]['find']({'where':{'id':_0x259c5c[_0xa0ab('0x63')]}});}return null;})[_0xa0ab('0x20')](handleEntityNotFound(_0x410bda,null))[_0xa0ab('0x20')](function(_0x377e67){if(_0x377e67){_0x20efb3[_0xa0ab('0x66')]=_0x377e67[_0xa0ab('0x61')]({'plain':!![]});interaction_log['info'](_0xa0ab('0x71'),_0x4c5dbb[_0xa0ab('0x68')]['id'],_0x4c5dbb[_0xa0ab('0x68')][_0xa0ab('0x38')],_0x4c5dbb[_0xa0ab('0x68')][_0xa0ab('0x72')],_0x20efb3['interaction']['id'],_0x4c5dbb[_0xa0ab('0x57')]?JSON[_0xa0ab('0x25')](_0x4c5dbb[_0xa0ab('0x57')]):_0xa0ab('0x69'));return respondWithRpcPromise('RejectMessage',_0xa0ab('0x73'),_0x20efb3);}return null;})['then'](function(_0x3067e9){if(_0x3067e9){_0x3067e9[_0xa0ab('0x28')][_0xa0ab('0x6b')]=util[_0xa0ab('0x65')](_0xa0ab('0x74'),_0x4c5dbb[_0xa0ab('0x68')][_0xa0ab('0x38')]);_0x3067e9['message'][_0xa0ab('0x6c')]=_0x20efb3[_0xa0ab('0x6c')];_0x3067e9[_0xa0ab('0x28')][_0xa0ab('0x6d')]=_0xa0ab('0x34');respondWithRpcPromise(_0xa0ab('0x6e'),'EventManager',{'event':_0xa0ab('0x75'),'message':_0x3067e9[_0xa0ab('0x28')]},client9002);return _0x20efb3;}return null;})[_0xa0ab('0x20')](respondWithResult(_0x410bda,null))[_0xa0ab('0x2a')](handleError(_0x410bda,null));}; \ No newline at end of file +var _0x6b26=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','catch','create','body','find','params','destroy','describe','chat-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','ChatInteraction','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','parse','chat','ChatInteractionId','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x776414,_0x10d2de){var _0x7ec5f6=function(_0x33e112){while(--_0x33e112){_0x776414['push'](_0x776414['shift']());}};_0x7ec5f6(++_0x10d2de);}(_0x6b26,0x159));var _0x66b2=function(_0x799a35,_0xca4f88){_0x799a35=_0x799a35-0x0;var _0xf492a6=_0x6b26[_0x799a35];return _0xf492a6;};'use strict';var pdf=require(_0x66b2('0x0'));var emlformat=require(_0x66b2('0x1'));var rimraf=require(_0x66b2('0x2'));var zipdir=require(_0x66b2('0x3'));var jsonpatch=require(_0x66b2('0x4'));var rp=require(_0x66b2('0x5'));var moment=require(_0x66b2('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x66b2('0x7'));var sox=require(_0x66b2('0x8'));var csv=require(_0x66b2('0x9'));var ejs=require(_0x66b2('0xa'));var fs=require('fs');var _=require(_0x66b2('0xb'));var squel=require(_0x66b2('0xc'));var crypto=require(_0x66b2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x66b2('0x9'));var querystring=require(_0x66b2('0xe'));var Papa=require('papaparse');var Redis=require(_0x66b2('0xf'));var authService=require(_0x66b2('0x10'));var qs=require(_0x66b2('0x11'));var as=require(_0x66b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66b2('0x13'))('api');var utils=require(_0x66b2('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x66b2('0x15')]=_['defaults'](config['redis'],{'host':_0x66b2('0x16'),'port':0x18eb});var socket=require(_0x66b2('0x17'))(new Redis(config[_0x66b2('0x15')]));require(_0x66b2('0x18'))['register'](socket);var jayson=require(_0x66b2('0x19'));var client=jayson[_0x66b2('0x1a')][_0x66b2('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x66b2('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3af61c,_0x2b831f,_0x5b8739){if(_0x5b8739){var _0x28800d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28800d['test'](_0x2b831f)){return _0x3af61c;}else{throw new db[(_0x66b2('0x1c'))][(_0x66b2('0x1d'))](_0x66b2('0x1e'));}}else{return _0x3af61c;}}function respondWithRpcPromise(_0x45b954,_0x5662ff,_0x25a85a,_0xf9357f){return new BPromise(function(_0x41fde3,_0x536601){var _0x456a4d=_0xf9357f||client;return _0x456a4d[_0x66b2('0x1f')](_0x45b954,_0x25a85a)[_0x66b2('0x20')](function(_0x3add5c){logger['info'](_0x66b2('0x21'),_0x5662ff,'request\x20sent');logger[_0x66b2('0x22')](_0x66b2('0x23'),_0x5662ff,_0x66b2('0x24'),JSON[_0x66b2('0x25')](_0x3add5c));if(_0x3add5c[_0x66b2('0x26')]){if(_0x3add5c['error'][_0x66b2('0x27')]===0x1f4){logger['error'](_0x66b2('0x21'),_0x5662ff,_0x3add5c[_0x66b2('0x26')]['message']);return _0x536601(_0x3add5c[_0x66b2('0x26')][_0x66b2('0x28')]);}logger[_0x66b2('0x26')](_0x66b2('0x21'),_0x5662ff,_0x3add5c[_0x66b2('0x26')][_0x66b2('0x28')]);return _0x41fde3(_0x3add5c[_0x66b2('0x26')][_0x66b2('0x28')]);}else{logger[_0x66b2('0x29')]('ChatMessage,\x20%s,\x20%s',_0x5662ff,_0x66b2('0x24'));_0x41fde3(_0x3add5c[_0x66b2('0x2a')][_0x66b2('0x28')]);}})['catch'](function(_0x13b087){logger[_0x66b2('0x26')](_0x66b2('0x21'),_0x5662ff,_0x13b087);_0x536601(_0x13b087);});});}function respondWithStatusCode(_0x19ce40,_0x29401e){_0x29401e=_0x29401e||0xcc;return function(_0x1209c6){if(_0x1209c6){return _0x19ce40[_0x66b2('0x2b')](_0x29401e);}return _0x19ce40['status'](_0x29401e)[_0x66b2('0x2c')]();};}function respondWithResult(_0x37a1cc,_0x823a32){_0x823a32=_0x823a32||0xc8;return function(_0x5ae1d7){if(_0x5ae1d7){return _0x37a1cc[_0x66b2('0x2d')](_0x823a32)[_0x66b2('0x2e')](_0x5ae1d7);}};}function respondWithFilteredResult(_0x37a5f5,_0x30331c){return function(_0x550704){if(_0x550704){var _0x102ee3=_0x550704[_0x66b2('0x2f')],_0x1e5fa2=_0x30331c[_0x66b2('0x30')],_0x317b12=_0x30331c['offset']+_0x30331c[_0x66b2('0x31')],_0xbde730;if(_0x317b12>=_0x102ee3){_0x317b12=_0x102ee3;_0xbde730=0xc8;}else{_0xbde730=0xce;}_0x37a5f5[_0x66b2('0x2d')](_0xbde730);return _0x37a5f5[_0x66b2('0x32')](_0x66b2('0x33'),_0x1e5fa2+'-'+_0x317b12+'/'+_0x102ee3)[_0x66b2('0x2e')](_0x550704);}return null;};}function patchUpdates(_0x58bf2c){return function(_0x4fc79b){try{jsonpatch[_0x66b2('0x34')](_0x4fc79b,_0x58bf2c,!![]);}catch(_0x393973){return BPromise[_0x66b2('0x35')](_0x393973);}return _0x4fc79b[_0x66b2('0x36')]();};}function saveUpdates(_0x4c2f64,_0x3acccd){return function(_0x3eb213){if(_0x3eb213){return _0x3eb213[_0x66b2('0x37')](_0x4c2f64)[_0x66b2('0x20')](function(_0x2b1f77){return _0x2b1f77;});}return null;};}function removeEntity(_0x3330c0,_0x39d11f){return function(_0x556cbb){if(_0x556cbb){return _0x556cbb['destroy']()[_0x66b2('0x20')](function(){_0x3330c0[_0x66b2('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19286d,_0x1f977b){return function(_0x29afc5){if(!_0x29afc5){_0x19286d['sendStatus'](0x194);}return _0x29afc5;};}function handleError(_0x22b398,_0x68cfce){_0x68cfce=_0x68cfce||0x1f4;return function(_0xfde2ed){logger[_0x66b2('0x26')](_0xfde2ed['stack']);if(_0xfde2ed[_0x66b2('0x38')]){delete _0xfde2ed[_0x66b2('0x38')];}_0x22b398[_0x66b2('0x2d')](_0x68cfce)[_0x66b2('0x39')](_0xfde2ed);};}exports[_0x66b2('0x3a')]=function(_0x191d59,_0x1e397b){var _0x54e7cf={},_0x9b3171={},_0x2c0a1d={'count':0x0,'rows':[]};var _0x2afd1f=_[_0x66b2('0x3b')](db[_0x66b2('0x3c')][_0x66b2('0x3d')],function(_0x39b434){return{'name':_0x39b434[_0x66b2('0x3e')],'type':_0x39b434[_0x66b2('0x3f')][_0x66b2('0x40')]};});_0x9b3171['model']=_[_0x66b2('0x3b')](_0x2afd1f,_0x66b2('0x38'));_0x9b3171[_0x66b2('0x41')]=_[_0x66b2('0x42')](_0x191d59[_0x66b2('0x41')]);_0x9b3171[_0x66b2('0x43')]=_[_0x66b2('0x44')](_0x9b3171[_0x66b2('0x45')],_0x9b3171[_0x66b2('0x41')]);_0x54e7cf['attributes']=_[_0x66b2('0x44')](_0x9b3171['model'],qs[_0x66b2('0x46')](_0x191d59[_0x66b2('0x41')][_0x66b2('0x46')]));_0x54e7cf[_0x66b2('0x47')]=_0x54e7cf[_0x66b2('0x47')][_0x66b2('0x48')]?_0x54e7cf[_0x66b2('0x47')]:_0x9b3171[_0x66b2('0x45')];if(!_0x191d59['query'][_0x66b2('0x49')](_0x66b2('0x4a'))){_0x54e7cf[_0x66b2('0x31')]=qs[_0x66b2('0x31')](_0x191d59['query'][_0x66b2('0x31')]);_0x54e7cf[_0x66b2('0x30')]=qs[_0x66b2('0x30')](_0x191d59['query'][_0x66b2('0x30')]);}_0x54e7cf[_0x66b2('0x4b')]=qs[_0x66b2('0x4c')](_0x191d59['query']['sort']);_0x54e7cf[_0x66b2('0x4d')]=qs['filters'](_['pick'](_0x191d59[_0x66b2('0x41')],_0x9b3171[_0x66b2('0x43')]),_0x2afd1f);if(_0x191d59[_0x66b2('0x41')]['filter']){_0x54e7cf['where']=_[_0x66b2('0x4e')](_0x54e7cf['where'],{'$or':_[_0x66b2('0x3b')](_0x2afd1f,function(_0x6b3720){if(_0x6b3720[_0x66b2('0x3f')]!==_0x66b2('0x4f')){var _0x4259e9={};_0x4259e9[_0x6b3720[_0x66b2('0x38')]]={'$like':'%'+_0x191d59[_0x66b2('0x41')][_0x66b2('0x50')]+'%'};return _0x4259e9;}})});}_0x54e7cf=_[_0x66b2('0x4e')]({},_0x54e7cf,_0x191d59['options']);var _0x302340={'where':_0x54e7cf['where']};return db[_0x66b2('0x3c')][_0x66b2('0x2f')](_0x302340)[_0x66b2('0x20')](function(_0x5cc3d1){_0x2c0a1d[_0x66b2('0x2f')]=_0x5cc3d1;if(_0x191d59[_0x66b2('0x41')][_0x66b2('0x51')]){_0x54e7cf[_0x66b2('0x52')]=[{'all':!![]}];}return db['ChatMessage'][_0x66b2('0x53')](_0x54e7cf);})['then'](function(_0x558865){_0x2c0a1d[_0x66b2('0x54')]=_0x558865;return _0x2c0a1d;})[_0x66b2('0x20')](respondWithFilteredResult(_0x1e397b,_0x54e7cf))['catch'](handleError(_0x1e397b,null));};exports[_0x66b2('0x55')]=function(_0x4fb4ac,_0x500dee){var _0x10cfc9={'raw':!![],'where':{'id':_0x4fb4ac['params']['id']}},_0x32126f={};_0x32126f['model']=_[_0x66b2('0x42')](db['ChatMessage'][_0x66b2('0x3d')]);_0x32126f['query']=_[_0x66b2('0x42')](_0x4fb4ac['query']);_0x32126f[_0x66b2('0x43')]=_['intersection'](_0x32126f[_0x66b2('0x45')],_0x32126f[_0x66b2('0x41')]);_0x10cfc9[_0x66b2('0x47')]=_['intersection'](_0x32126f['model'],qs['fields'](_0x4fb4ac[_0x66b2('0x41')][_0x66b2('0x46')]));_0x10cfc9['attributes']=_0x10cfc9[_0x66b2('0x47')][_0x66b2('0x48')]?_0x10cfc9['attributes']:_0x32126f['model'];if(_0x4fb4ac['query'][_0x66b2('0x51')]){_0x10cfc9[_0x66b2('0x52')]=[{'all':!![]}];}_0x10cfc9=_[_0x66b2('0x4e')]({},_0x10cfc9,_0x4fb4ac['options']);return db[_0x66b2('0x3c')]['find'](_0x10cfc9)[_0x66b2('0x20')](handleEntityNotFound(_0x500dee,null))[_0x66b2('0x20')](respondWithResult(_0x500dee,null))[_0x66b2('0x56')](handleError(_0x500dee,null));};exports[_0x66b2('0x57')]=function(_0x2e62d3,_0x28ea6f){return db[_0x66b2('0x3c')][_0x66b2('0x57')](_0x2e62d3[_0x66b2('0x58')],{})['then'](respondWithResult(_0x28ea6f,0xc9))[_0x66b2('0x56')](handleError(_0x28ea6f,null));};exports[_0x66b2('0x37')]=function(_0x33a75c,_0x1c81dd){if(_0x33a75c[_0x66b2('0x58')]['id']){delete _0x33a75c[_0x66b2('0x58')]['id'];}return db['ChatMessage'][_0x66b2('0x59')]({'where':{'id':_0x33a75c[_0x66b2('0x5a')]['id']}})[_0x66b2('0x20')](handleEntityNotFound(_0x1c81dd,null))[_0x66b2('0x20')](saveUpdates(_0x33a75c[_0x66b2('0x58')],null))[_0x66b2('0x20')](respondWithResult(_0x1c81dd,null))['catch'](handleError(_0x1c81dd,null));};exports[_0x66b2('0x5b')]=function(_0x18d5cf,_0x46af25){return db[_0x66b2('0x3c')]['find']({'where':{'id':_0x18d5cf[_0x66b2('0x5a')]['id']}})[_0x66b2('0x20')](handleEntityNotFound(_0x46af25,null))['then'](removeEntity(_0x46af25,null))[_0x66b2('0x56')](handleError(_0x46af25,null));};exports['describe']=function(_0xb27cc4,_0x31d807){return db[_0x66b2('0x3c')][_0x66b2('0x5c')]()[_0x66b2('0x20')](respondWithResult(_0x31d807,null))['catch'](handleError(_0x31d807,null));};var interaction_log=require('../../config/logger')(_0x66b2('0x5d'));exports[_0x66b2('0x5e')]=function(_0x415521,_0x19e359,_0x4399bc){var _0x20a85b={'channel':'chat'};if(_0x415521[_0x66b2('0x58')]['id']){delete _0x415521[_0x66b2('0x58')]['id'];}_0x415521[_0x66b2('0x58')]['read']=!![];_0x415521[_0x66b2('0x58')][_0x66b2('0x5f')]=moment()['format'](_0x66b2('0x60'));_0x415521['body'][_0x66b2('0x61')]=_0x415521[_0x66b2('0x58')][_0x66b2('0x61')]||_0x415521['user']['id'];return db[_0x66b2('0x3c')][_0x66b2('0x59')]({'where':{'id':_0x415521[_0x66b2('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x66b2('0x62')}]})[_0x66b2('0x20')](handleEntityNotFound(_0x19e359,null))[_0x66b2('0x20')](saveUpdates(_0x415521[_0x66b2('0x58')],null))[_0x66b2('0x20')](function(_0xb8c017){if(_0xb8c017){_0x20a85b[_0x66b2('0x28')]=_0xb8c017[_0x66b2('0x63')]({'plain':!![]});return db[_0x66b2('0x64')][_0x66b2('0x59')]({'where':{'id':_0xb8c017['ChatInteractionId']}});}return null;})[_0x66b2('0x20')](handleEntityNotFound(_0x19e359,null))[_0x66b2('0x20')](function(_0x4d0e36){if(_0x4d0e36){return _0x4d0e36['update']({'UserId':_0x415521[_0x66b2('0x58')]['UserId'],'read1stAt':_[_0x66b2('0x65')](_0x4d0e36[_0x66b2('0x66')])?moment()[_0x66b2('0x67')](_0x66b2('0x60')):undefined});}return null;})['then'](function(_0x277dc1){if(_0x277dc1){_0x20a85b[_0x66b2('0x68')]=_0x277dc1['get']({'plain':!![]});interaction_log[_0x66b2('0x29')](_0x66b2('0x69'),_0x415521[_0x66b2('0x6a')]['id'],_0x415521['user'][_0x66b2('0x38')],_0x415521[_0x66b2('0x6a')][_0x66b2('0x6b')],_0x20a85b[_0x66b2('0x68')]['id'],_0x415521[_0x66b2('0x58')]?JSON[_0x66b2('0x25')](_0x415521[_0x66b2('0x58')]):_0x66b2('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x66b2('0x6d'),_0x20a85b);}return null;})[_0x66b2('0x20')](function(_0x2d1928){if(_0x2d1928){if(_0x415521[_0x66b2('0x58')][_0x66b2('0x6e')]){_0x20a85b[_0x66b2('0x28')][_0x66b2('0x6f')]=util[_0x66b2('0x67')](_0x66b2('0x70'),_0x415521[_0x66b2('0x6a')][_0x66b2('0x38')]);_0x20a85b[_0x66b2('0x28')]['channel']=_0x20a85b[_0x66b2('0x71')];_0x20a85b['message']['event']=_0x66b2('0x5e');return respondWithRpcPromise(_0x66b2('0x72'),_0x66b2('0x72'),{'event':_0x66b2('0x73'),'message':_[_0x66b2('0x4e')](_0x20a85b['message'],JSON[_0x66b2('0x74')](_0x20a85b[_0x66b2('0x68')]['formData']))},client9002)[_0x66b2('0x20')](function(){return _0x20a85b;});}return _0x20a85b;}return null;})['then'](respondWithResult(_0x19e359,null))[_0x66b2('0x56')](handleError(_0x19e359,null));};var interaction_log=require(_0x66b2('0x13'))('chat-interactions');exports[_0x66b2('0x35')]=function(_0x53f86d,_0x3ae2b9,_0x5d380a){var _0x3c69b1={'agent':{},'channel':_0x66b2('0x75')};if(_0x53f86d['body']['id']){delete _0x53f86d[_0x66b2('0x58')]['id'];}_0x53f86d[_0x66b2('0x58')][_0x66b2('0x61')]=_0x53f86d['body'][_0x66b2('0x61')]||_0x53f86d[_0x66b2('0x6a')]['id'];_0x3c69b1['agent']['id']=_0x53f86d[_0x66b2('0x58')][_0x66b2('0x61')];return db[_0x66b2('0x3c')][_0x66b2('0x59')]({'where':{'id':_0x53f86d[_0x66b2('0x5a')]['id'],'UserId':null}})[_0x66b2('0x20')](handleEntityNotFound(_0x3ae2b9,null))[_0x66b2('0x20')](function(_0x41c6a7){if(_0x41c6a7){_0x3c69b1[_0x66b2('0x28')]=_0x41c6a7['get']({'plain':!![]});return db[_0x66b2('0x64')][_0x66b2('0x59')]({'where':{'id':_0x41c6a7[_0x66b2('0x76')]}});}return null;})['then'](handleEntityNotFound(_0x3ae2b9,null))[_0x66b2('0x20')](function(_0xf1027e){if(_0xf1027e){_0x3c69b1['interaction']=_0xf1027e[_0x66b2('0x63')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53f86d[_0x66b2('0x6a')]['id'],_0x53f86d[_0x66b2('0x6a')][_0x66b2('0x38')],_0x53f86d[_0x66b2('0x6a')]['role'],_0x3c69b1[_0x66b2('0x68')]['id'],_0x53f86d['body']?JSON[_0x66b2('0x25')](_0x53f86d[_0x66b2('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0x66b2('0x77'),_0x3c69b1);}return null;})[_0x66b2('0x20')](function(_0x5f0672){if(_0x5f0672){_0x5f0672['message'][_0x66b2('0x6f')]=util['format'](_0x66b2('0x70'),_0x53f86d[_0x66b2('0x6a')][_0x66b2('0x38')]);_0x5f0672['message'][_0x66b2('0x71')]=_0x3c69b1[_0x66b2('0x71')];_0x5f0672['message']['event']=_0x66b2('0x35');respondWithRpcPromise('EventManager',_0x66b2('0x72'),{'event':_0x66b2('0x78'),'message':_0x5f0672[_0x66b2('0x28')]},client9002);return _0x3c69b1;}return null;})[_0x66b2('0x20')](respondWithResult(_0x3ae2b9,null))[_0x66b2('0x56')](handleError(_0x3ae2b9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 04c3197..6232d76 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 _0x40c7=['hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit'];(function(_0x193d56,_0xcb8670){var _0x22c794=function(_0x5ce5d3){while(--_0x5ce5d3){_0x193d56['push'](_0x193d56['shift']());}};_0x22c794(++_0xcb8670);}(_0x40c7,0x1a9));var _0x740c=function(_0x296923,_0x4adaed){_0x296923=_0x296923-0x0;var _0x29af70=_0x40c7[_0x296923];return _0x29af70;};'use strict';var EventEmitter=require(_0x740c('0x0'));var ChatMessage=require(_0x740c('0x1'))['db'][_0x740c('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x740c('0x3')](0x0);var events={'afterCreate':_0x740c('0x4'),'afterUpdate':_0x740c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a1a40){return function(_0x5cedbf,_0x3feb2d,_0xfc0a9d){ChatMessageEvents['emit'](_0x4a1a40+':'+_0x5cedbf['id'],_0x5cedbf);ChatMessageEvents[_0x740c('0x6')](_0x4a1a40,_0x5cedbf);_0xfc0a9d(null);};}for(var e in events){if(events[_0x740c('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x740c('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xdd07=['../../mysqldb','ChatMessage','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x55a984,_0x385c27){var _0x1b40ca=function(_0x4a87e0){while(--_0x4a87e0){_0x55a984['push'](_0x55a984['shift']());}};_0x1b40ca(++_0x385c27);}(_0xdd07,0x194));var _0x7dd0=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xdd07[_0x11ce46];return _0x368a1e;};'use strict';var EventEmitter=require(_0x7dd0('0x0'));var ChatMessage=require(_0x7dd0('0x1'))['db'][_0x7dd0('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7dd0('0x3'),'afterUpdate':'update','afterDestroy':_0x7dd0('0x4')};function emitEvent(_0x1ed937){return function(_0x4450da,_0x39b2a6,_0x34ee2d){ChatMessageEvents[_0x7dd0('0x5')](_0x1ed937+':'+_0x4450da['id'],_0x4450da);ChatMessageEvents[_0x7dd0('0x5')](_0x1ed937,_0x4450da);_0x34ee2d(null);};}for(var e in events){if(events[_0x7dd0('0x6')](e)){var event=events[e];ChatMessage[_0x7dd0('0x7')](e,emitEvent(event));}}module[_0x7dd0('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1a670da..44199b4 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 _0x26b1=['ChatMessage','chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','path','./chatMessage.attributes','exports'];(function(_0x1140bf,_0x965cd5){var _0x2eeafa=function(_0x26def5){while(--_0x26def5){_0x1140bf['push'](_0x1140bf['shift']());}};_0x2eeafa(++_0x965cd5);}(_0x26b1,0x1b5));var _0x126b=function(_0x5036ab,_0xa0ebdd){_0x5036ab=_0x5036ab-0x0;var _0x425402=_0x26b1[_0x5036ab];return _0x425402;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x126b('0x0'));var moment=require(_0x126b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x126b('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x126b('0x3'));module[_0x126b('0x4')]=function(_0x28a73f,_0x33e98b){return _0x28a73f['define'](_0x126b('0x5'),attributes,{'tableName':_0x126b('0x6'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x126b('0x7')],'type':_0x126b('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x362999,_0x2910a0,_0x4cddef){var _0x47a391=_0x28a73f[_0x126b('0x9')];var _0xd2aac5=_0x362999[_0x126b('0xa')]({'plain':!![]});if(_0xd2aac5['direction'][_0x126b('0xb')]()==='in'||_0xd2aac5[_0x126b('0xc')][_0x126b('0xb')]()===_0x126b('0xd')&&!_0xd2aac5[_0x126b('0xe')]&&!_[_0x126b('0xf')](_0xd2aac5[_0x126b('0x10')])){_0x47a391[_0x126b('0x11')][_0x126b('0x12')]({'where':{'id':_0xd2aac5[_0x126b('0x13')]}})[_0x126b('0x14')](function(_0x252e1b){if(_0x252e1b){_0x252e1b[_0x126b('0x15')]({'lastMsgAt':_0xd2aac5['createdAt'],'lastMsgDirection':_0xd2aac5[_0x126b('0xc')][_0x126b('0xb')]()});}})[_0x126b('0x16')](function(_0x4827b1){console[_0x126b('0x17')](_0x4827b1);});}_0x4cddef();}},'charset':_0x126b('0x18'),'collate':_0x126b('0x19')});}; \ No newline at end of file +var _0x40c6=['utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','error','utf8mb4'];(function(_0x2cffb9,_0x349d16){var _0x35eb4f=function(_0x5daa96){while(--_0x5daa96){_0x2cffb9['push'](_0x2cffb9['shift']());}};_0x35eb4f(++_0x349d16);}(_0x40c6,0x135));var _0x640c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x40c6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x640c('0x0'))(_0x640c('0x1'));var moment=require(_0x640c('0x2'));var BPromise=require('bluebird');var rp=require(_0x640c('0x3'));var fs=require('fs');var path=require(_0x640c('0x4'));var rimraf=require(_0x640c('0x5'));var config=require(_0x640c('0x6'));var attributes=require(_0x640c('0x7'));module[_0x640c('0x8')]=function(_0x1cff57,_0x4d1e87){return _0x1cff57['define'](_0x640c('0x9'),attributes,{'tableName':_0x640c('0xa'),'paranoid':![],'indexes':[{'name':_0x640c('0xb'),'fields':[_0x640c('0xc')],'type':_0x640c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f70a8,_0x1689da,_0x5a7584){var _0x652dc8=_0x1cff57[_0x640c('0xe')];var _0x5eee37=_0x2f70a8[_0x640c('0xf')]({'plain':!![]});if(_0x5eee37[_0x640c('0x10')][_0x640c('0x11')]()==='in'||_0x5eee37['direction'][_0x640c('0x11')]()==='out'&&!_0x5eee37[_0x640c('0x12')]&&!_['isNil'](_0x5eee37[_0x640c('0x13')])){_0x652dc8[_0x640c('0x14')][_0x640c('0x15')]({'where':{'id':_0x5eee37[_0x640c('0x16')]}})[_0x640c('0x17')](function(_0x2963d8){if(_0x2963d8){_0x2963d8['update']({'lastMsgAt':_0x5eee37[_0x640c('0x18')],'lastMsgDirection':_0x5eee37['direction'][_0x640c('0x11')]()});}})['catch'](function(_0x3146d8){console[_0x640c('0x19')](_0x3146d8);});}_0x5a7584();}},'charset':_0x640c('0x1a'),'collate':_0x640c('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index bc112a0..4f10e4d 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 _0xee07=['request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','options','raw','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','redis','register'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xee07,0x6e));var _0x7ee0=function(_0x47c1e9,_0x5026c9){_0x47c1e9=_0x47c1e9-0x0;var _0x2227c0=_0xee07[_0x47c1e9];return _0x2227c0;};'use strict';var _=require('lodash');var util=require(_0x7ee0('0x0'));var moment=require(_0x7ee0('0x1'));var BPromise=require(_0x7ee0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ee0('0x3'));var db=require(_0x7ee0('0x4'))['db'];var utils=require(_0x7ee0('0x5'));var logger=require('../../config/logger')(_0x7ee0('0x6'));var config=require(_0x7ee0('0x7'));var jayson=require(_0x7ee0('0x8'));var client=jayson['client'][_0x7ee0('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7ee0('0xa'),'port':0x18eb});var socket=require(_0x7ee0('0xb'))(new Redis(config[_0x7ee0('0xc')]));require('./chatMessage.socket')[_0x7ee0('0xd')](socket);function respondWithRpcPromise(_0x589fdb,_0x557f6f,_0x1d3a85){return new BPromise(function(_0x441a40,_0xd8bba9){return client[_0x7ee0('0xe')](_0x589fdb,_0x1d3a85)['then'](function(_0x421b9b){logger[_0x7ee0('0xf')](_0x7ee0('0x10'),_0x557f6f,_0x7ee0('0x11'));logger[_0x7ee0('0x12')](_0x7ee0('0x13'),_0x557f6f,_0x7ee0('0x11'),JSON[_0x7ee0('0x14')](_0x421b9b));if(_0x421b9b[_0x7ee0('0x15')]){if(_0x421b9b[_0x7ee0('0x15')][_0x7ee0('0x16')]===0x1f4){logger[_0x7ee0('0x15')](_0x7ee0('0x10'),_0x557f6f,_0x421b9b[_0x7ee0('0x15')]['message']);return _0xd8bba9(_0x421b9b[_0x7ee0('0x15')][_0x7ee0('0x17')]);}logger[_0x7ee0('0x15')]('ChatMessage,\x20%s,\x20%s',_0x557f6f,_0x421b9b[_0x7ee0('0x15')][_0x7ee0('0x17')]);return _0x441a40(_0x421b9b[_0x7ee0('0x15')][_0x7ee0('0x17')]);}else{logger[_0x7ee0('0xf')](_0x7ee0('0x10'),_0x557f6f,_0x7ee0('0x11'));_0x441a40(_0x421b9b['result']['message']);}})[_0x7ee0('0x18')](function(_0x35d9a2){logger[_0x7ee0('0x15')](_0x7ee0('0x10'),_0x557f6f,_0x35d9a2);_0xd8bba9(_0x35d9a2);});});}exports[_0x7ee0('0x19')]=function(_0x473b9a){var _0x157f5d=this;return new Promise(function(_0x42aea0,_0x1eb6a7){return db[_0x7ee0('0x1a')][_0x7ee0('0x1b')](_0x473b9a['body'],{'raw':_0x473b9a[_0x7ee0('0x1c')]?_0x473b9a[_0x7ee0('0x1c')][_0x7ee0('0x1d')]===undefined?!![]:![]:!![]})[_0x7ee0('0x1e')](function(_0x36d70d){logger['info']('CreateChatMessage',_0x473b9a);logger['debug'](_0x7ee0('0x19'),_0x473b9a,JSON[_0x7ee0('0x14')](_0x36d70d));_0x42aea0(_0x36d70d);})[_0x7ee0('0x18')](function(_0x457fe7){logger[_0x7ee0('0x15')]('CreateChatMessage',_0x457fe7[_0x7ee0('0x17')],_0x473b9a);_0x1eb6a7(_0x157f5d[_0x7ee0('0x15')](0x1f4,_0x457fe7['message']));});});}; \ No newline at end of file +var _0x606c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','raw'];(function(_0x5954e2,_0x10ff8b){var _0x11542f=function(_0x10336f){while(--_0x10336f){_0x5954e2['push'](_0x5954e2['shift']());}};_0x11542f(++_0x10ff8b);}(_0x606c,0x1e1));var _0xc606=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x606c[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xc606('0x0'));var util=require(_0xc606('0x1'));var moment=require(_0xc606('0x2'));var BPromise=require(_0xc606('0x3'));var rs=require(_0xc606('0x4'));var fs=require('fs');var Redis=require(_0xc606('0x5'));var db=require(_0xc606('0x6'))['db'];var utils=require(_0xc606('0x7'));var logger=require(_0xc606('0x8'))(_0xc606('0x9'));var config=require(_0xc606('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc606('0xb')][_0xc606('0xc')]({'port':0x232a});config[_0xc606('0xd')]=_[_0xc606('0xe')](config[_0xc606('0xd')],{'host':_0xc606('0xf'),'port':0x18eb});var socket=require(_0xc606('0x10'))(new Redis(config[_0xc606('0xd')]));require(_0xc606('0x11'))[_0xc606('0x12')](socket);function respondWithRpcPromise(_0x3039b6,_0x42d325,_0x52c359){return new BPromise(function(_0x1be31c,_0x512135){return client[_0xc606('0x13')](_0x3039b6,_0x52c359)[_0xc606('0x14')](function(_0x53c101){logger[_0xc606('0x15')](_0xc606('0x16'),_0x42d325,_0xc606('0x17'));logger[_0xc606('0x18')](_0xc606('0x19'),_0x42d325,_0xc606('0x17'),JSON[_0xc606('0x1a')](_0x53c101));if(_0x53c101[_0xc606('0x1b')]){if(_0x53c101[_0xc606('0x1b')][_0xc606('0x1c')]===0x1f4){logger['error'](_0xc606('0x16'),_0x42d325,_0x53c101[_0xc606('0x1b')][_0xc606('0x1d')]);return _0x512135(_0x53c101[_0xc606('0x1b')][_0xc606('0x1d')]);}logger['error'](_0xc606('0x16'),_0x42d325,_0x53c101['error'][_0xc606('0x1d')]);return _0x1be31c(_0x53c101[_0xc606('0x1b')]['message']);}else{logger[_0xc606('0x15')]('ChatMessage,\x20%s,\x20%s',_0x42d325,'request\x20sent');_0x1be31c(_0x53c101[_0xc606('0x1e')][_0xc606('0x1d')]);}})[_0xc606('0x1f')](function(_0x1ef2e2){logger[_0xc606('0x1b')](_0xc606('0x16'),_0x42d325,_0x1ef2e2);_0x512135(_0x1ef2e2);});});}exports[_0xc606('0x20')]=function(_0x267592){var _0x47adff=this;return new Promise(function(_0x4accaf,_0x1b824e){return db[_0xc606('0x21')][_0xc606('0x22')](_0x267592[_0xc606('0x23')],{'raw':_0x267592['options']?_0x267592['options'][_0xc606('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x5269a3){logger[_0xc606('0x15')]('CreateChatMessage',_0x267592);logger[_0xc606('0x18')](_0xc606('0x20'),_0x267592,JSON[_0xc606('0x1a')](_0x5269a3));_0x4accaf(_0x5269a3);})[_0xc606('0x1f')](function(_0x3e0fe5){logger[_0xc606('0x1b')](_0xc606('0x20'),_0x3e0fe5[_0xc606('0x1d')],_0x267592);_0x1b824e(_0x47adff['error'](0x1f4,_0x3e0fe5[_0xc606('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 36b9c29..3573ab2 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 _0x9582=['update','emit','removeListener','register','length','./chatMessage.events','save','remove'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9582,0x95));var _0x2958=function(_0x2a053b,_0x3ad634){_0x2a053b=_0x2a053b-0x0;var _0x5968f4=_0x9582[_0x2a053b];return _0x5968f4;};'use strict';var ChatMessageEvents=require(_0x2958('0x0'));var events=[_0x2958('0x1'),_0x2958('0x2'),_0x2958('0x3')];function createListener(_0x42752c,_0x176287){return function(_0x559a01){_0x176287[_0x2958('0x4')](_0x42752c,_0x559a01);};}function removeListener(_0x3b907e,_0x136c77){return function(){ChatMessageEvents[_0x2958('0x5')](_0x3b907e,_0x136c77);};}exports[_0x2958('0x6')]=function(_0xbde128){for(var _0x88ffaa=0x0,_0x309525=events[_0x2958('0x7')];_0x88ffaa<_0x309525;_0x88ffaa++){var _0x2e571b=events[_0x88ffaa];var _0x56ca85=createListener('chatMessage:'+_0x2e571b,_0xbde128);ChatMessageEvents['on'](_0x2e571b,_0x56ca85);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','chatMessage:'];(function(_0x44fca,_0x18cff9){var _0x14c352=function(_0x551d5d){while(--_0x551d5d){_0x44fca['push'](_0x44fca['shift']());}};_0x14c352(++_0x18cff9);}(_0x1261,0x144));var _0x1126=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x1261[_0x154940];return _0x401409;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){ChatMessageEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);ChatMessageEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d4351b4..72766f9 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 _0x5d46=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','isAuthenticated','describe','/:id','show','tracked','chat','chatmessage:create','create','put'];(function(_0x2603b1,_0x3d9a8b){var _0x31d5d8=function(_0xf6df1c){while(--_0xf6df1c){_0x2603b1['push'](_0x2603b1['shift']());}};_0x31d5d8(++_0x3d9a8b);}(_0x5d46,0x13b));var _0x65d4=function(_0x161fc0,_0x7ebb3){_0x161fc0=_0x161fc0-0x0;var _0x49214d=_0x5d46[_0x161fc0];return _0x49214d;};'use strict';var multer=require(_0x65d4('0x0'));var util=require(_0x65d4('0x1'));var path=require(_0x65d4('0x2'));var timeout=require(_0x65d4('0x3'));var express=require(_0x65d4('0x4'));var router=express[_0x65d4('0x5')]();var auth=require(_0x65d4('0x6'));var interaction=require(_0x65d4('0x7'));var config=require(_0x65d4('0x8'));var controller=require(_0x65d4('0x9'));router[_0x65d4('0xa')]('/',auth['isAuthenticated'](),controller[_0x65d4('0xb')]);router[_0x65d4('0xa')]('/describe',auth[_0x65d4('0xc')](),controller[_0x65d4('0xd')]);router[_0x65d4('0xa')](_0x65d4('0xe'),auth['isAuthenticated'](),controller[_0x65d4('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x65d4('0x10')](_0x65d4('0x11'),_0x65d4('0x12')),controller[_0x65d4('0x13')]);router[_0x65d4('0x14')]('/:id',controller[_0x65d4('0x15')]);router['put'](_0x65d4('0x16'),auth[_0x65d4('0xc')](),controller[_0x65d4('0x17')]);router['put'](_0x65d4('0x18'),auth['isAuthenticated'](),controller[_0x65d4('0x19')]);router[_0x65d4('0x1a')](_0x65d4('0xe'),auth[_0x65d4('0xc')](),controller[_0x65d4('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x9b54=['chat','chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','tracked'];(function(_0x3ff091,_0x2b0f1c){var _0x141fd7=function(_0x4f8554){while(--_0x4f8554){_0x3ff091['push'](_0x3ff091['shift']());}};_0x141fd7(++_0x2b0f1c);}(_0x9b54,0x19b));var _0x49b5=function(_0x18f898,_0x448fc3){_0x18f898=_0x18f898-0x0;var _0x4ca3c0=_0x9b54[_0x18f898];return _0x4ca3c0;};'use strict';var multer=require(_0x49b5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x49b5('0x1'));var router=express[_0x49b5('0x2')]();var auth=require(_0x49b5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x49b5('0x4'));var controller=require(_0x49b5('0x5'));router['get']('/',auth[_0x49b5('0x6')](),controller[_0x49b5('0x7')]);router[_0x49b5('0x8')](_0x49b5('0x9'),auth[_0x49b5('0x6')](),controller[_0x49b5('0xa')]);router[_0x49b5('0x8')]('/:id',auth[_0x49b5('0x6')](),controller[_0x49b5('0xb')]);router[_0x49b5('0xc')]('/',auth[_0x49b5('0x6')](),interaction[_0x49b5('0xd')](_0x49b5('0xe'),_0x49b5('0xf')),controller[_0x49b5('0x10')]);router['put']('/:id',controller[_0x49b5('0x11')]);router[_0x49b5('0x12')](_0x49b5('0x13'),auth[_0x49b5('0x6')](),controller[_0x49b5('0x14')]);router[_0x49b5('0x12')](_0x49b5('0x15'),auth[_0x49b5('0x6')](),controller[_0x49b5('0x16')]);router[_0x49b5('0x17')]('/:id',auth[_0x49b5('0x6')](),controller[_0x49b5('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9458559..ef25353 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 _0xb9d2=['sequelize','exports','TEXT','medium'];(function(_0x28aa02,_0x2d3d80){var _0x43c6e9=function(_0xa58bbf){while(--_0xa58bbf){_0x28aa02['push'](_0x28aa02['shift']());}};_0x43c6e9(++_0x2d3d80);}(_0xb9d2,0x1ac));var _0x2b9d=function(_0x51b7c5,_0x218969){_0x51b7c5=_0x51b7c5-0x0;var _0x3355d7=_0xb9d2[_0x51b7c5];return _0x3355d7;};'use strict';var Sequelize=require(_0x2b9d('0x0'));module[_0x2b9d('0x1')]={'body':{'type':Sequelize[_0x2b9d('0x2')](_0x2b9d('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x3f67=['medium','sequelize','TEXT'];(function(_0x2b1012,_0x40dd79){var _0xf064b5=function(_0x20917a){while(--_0x20917a){_0x2b1012['push'](_0x2b1012['shift']());}};_0xf064b5(++_0x40dd79);}(_0x3f67,0x115));var _0x73f6=function(_0x1d30a3,_0x5f428c){_0x1d30a3=_0x1d30a3-0x0;var _0x32bba1=_0x3f67[_0x1d30a3];return _0x32bba1;};'use strict';var Sequelize=require(_0x73f6('0x0'));module['exports']={'body':{'type':Sequelize[_0x73f6('0x1')](_0x73f6('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 829a1a2..ca5bec5 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 _0xcd59=['show','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x2f0273,_0x4e8e1d){var _0x3bd665=function(_0x3aa89c){while(--_0x3aa89c){_0x2f0273['push'](_0x2f0273['shift']());}};_0x3bd665(++_0x4e8e1d);}(_0xcd59,0x14b));var _0x9cd5=function(_0x153c6c,_0x5aa22f){_0x153c6c=_0x153c6c-0x0;var _0x3c85d3=_0xcd59[_0x153c6c];return _0x3c85d3;};'use strict';var pdf=require(_0x9cd5('0x0'));var emlformat=require(_0x9cd5('0x1'));var rimraf=require(_0x9cd5('0x2'));var zipdir=require(_0x9cd5('0x3'));var jsonpatch=require(_0x9cd5('0x4'));var rp=require(_0x9cd5('0x5'));var moment=require('moment');var BPromise=require(_0x9cd5('0x6'));var Mustache=require(_0x9cd5('0x7'));var util=require(_0x9cd5('0x8'));var path=require(_0x9cd5('0x9'));var sox=require(_0x9cd5('0xa'));var csv=require(_0x9cd5('0xb'));var ejs=require(_0x9cd5('0xc'));var fs=require('fs');var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xb'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d6de,_0x2c9cf1){_0x2c9cf1=_0x2c9cf1||0xcc;return function(_0x172e29){if(_0x172e29){return _0x58d6de[_0x9cd5('0x1b')](_0x2c9cf1);}return _0x58d6de[_0x9cd5('0x1c')](_0x2c9cf1)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x2a1606,_0x52698b){_0x52698b=_0x52698b||0xc8;return function(_0x15b639){if(_0x15b639){return _0x2a1606[_0x9cd5('0x1c')](_0x52698b)[_0x9cd5('0x1e')](_0x15b639);}};}function respondWithFilteredResult(_0x4b9ac8,_0x541cb8){return function(_0x5c4f3d){if(_0x5c4f3d){var _0x258305=_0x5c4f3d[_0x9cd5('0x1f')],_0x1ea3f7=_0x541cb8[_0x9cd5('0x20')],_0x565db7=_0x541cb8['offset']+_0x541cb8[_0x9cd5('0x21')],_0x24c233;if(_0x565db7>=_0x258305){_0x565db7=_0x258305;_0x24c233=0xc8;}else{_0x24c233=0xce;}_0x4b9ac8[_0x9cd5('0x1c')](_0x24c233);return _0x4b9ac8[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x1ea3f7+'-'+_0x565db7+'/'+_0x258305)[_0x9cd5('0x1e')](_0x5c4f3d);}return null;};}function patchUpdates(_0x1ff788){return function(_0x5c1622){try{jsonpatch[_0x9cd5('0x24')](_0x5c1622,_0x1ff788,!![]);}catch(_0x18346f){return BPromise[_0x9cd5('0x25')](_0x18346f);}return _0x5c1622[_0x9cd5('0x26')]();};}function saveUpdates(_0x2e2b47,_0x4ed8b9){return function(_0x16c4e9){if(_0x16c4e9){return _0x16c4e9[_0x9cd5('0x27')](_0x2e2b47)[_0x9cd5('0x28')](function(_0x12e402){return _0x12e402;});}return null;};}function removeEntity(_0x2ce1ae,_0x1185d7){return function(_0x1cf603){if(_0x1cf603){return _0x1cf603[_0x9cd5('0x29')]()[_0x9cd5('0x28')](function(){_0x2ce1ae['status'](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0xba8ee9,_0x1a88e3){return function(_0x43f47d){if(!_0x43f47d){_0xba8ee9['sendStatus'](0x194);}return _0x43f47d;};}function handleError(_0x24ae67,_0x990c25){_0x990c25=_0x990c25||0x1f4;return function(_0x211576){logger[_0x9cd5('0x2a')](_0x211576[_0x9cd5('0x2b')]);if(_0x211576[_0x9cd5('0x2c')]){delete _0x211576[_0x9cd5('0x2c')];}_0x24ae67['status'](_0x990c25)[_0x9cd5('0x2d')](_0x211576);};}exports[_0x9cd5('0x2e')]=function(_0x2f1e4b,_0x4af6c8){var _0x5c33e9={},_0x2e45a3={},_0x502257={'count':0x0,'rows':[]};var _0x52ef5d=_[_0x9cd5('0x2f')](db[_0x9cd5('0x30')][_0x9cd5('0x31')],function(_0x5184b9){return{'name':_0x5184b9[_0x9cd5('0x32')],'type':_0x5184b9[_0x9cd5('0x33')][_0x9cd5('0x34')]};});_0x2e45a3[_0x9cd5('0x35')]=_[_0x9cd5('0x2f')](_0x52ef5d,_0x9cd5('0x2c'));_0x2e45a3[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x2f1e4b[_0x9cd5('0x36')]);_0x2e45a3[_0x9cd5('0x38')]=_[_0x9cd5('0x39')](_0x2e45a3[_0x9cd5('0x35')],_0x2e45a3[_0x9cd5('0x36')]);_0x5c33e9[_0x9cd5('0x3a')]=_['intersection'](_0x2e45a3[_0x9cd5('0x35')],qs[_0x9cd5('0x3b')](_0x2f1e4b['query']['fields']));_0x5c33e9[_0x9cd5('0x3a')]=_0x5c33e9[_0x9cd5('0x3a')]['length']?_0x5c33e9[_0x9cd5('0x3a')]:_0x2e45a3['model'];if(!_0x2f1e4b['query'][_0x9cd5('0x3c')](_0x9cd5('0x3d'))){_0x5c33e9[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x2f1e4b['query'][_0x9cd5('0x21')]);_0x5c33e9[_0x9cd5('0x20')]=qs[_0x9cd5('0x20')](_0x2f1e4b['query'][_0x9cd5('0x20')]);}_0x5c33e9[_0x9cd5('0x3e')]=qs[_0x9cd5('0x3f')](_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x3f')]);_0x5c33e9[_0x9cd5('0x40')]=qs[_0x9cd5('0x38')](_[_0x9cd5('0x41')](_0x2f1e4b[_0x9cd5('0x36')],_0x2e45a3[_0x9cd5('0x38')]),_0x52ef5d);if(_0x2f1e4b[_0x9cd5('0x36')]['filter']){_0x5c33e9[_0x9cd5('0x40')]=_['merge'](_0x5c33e9['where'],{'$or':_[_0x9cd5('0x2f')](_0x52ef5d,function(_0x3cf5e9){if(_0x3cf5e9[_0x9cd5('0x33')]!==_0x9cd5('0x42')){var _0x54bc49={};_0x54bc49[_0x3cf5e9[_0x9cd5('0x2c')]]={'$like':'%'+_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x43')]+'%'};return _0x54bc49;}})});}_0x5c33e9=_[_0x9cd5('0x44')]({},_0x5c33e9,_0x2f1e4b['options']);var _0x36e22c={'where':_0x5c33e9[_0x9cd5('0x40')]};return db[_0x9cd5('0x30')][_0x9cd5('0x1f')](_0x36e22c)[_0x9cd5('0x28')](function(_0x16e6b3){_0x502257['count']=_0x16e6b3;if(_0x2f1e4b[_0x9cd5('0x36')][_0x9cd5('0x45')]){_0x5c33e9[_0x9cd5('0x46')]=[{'all':!![]}];}return db[_0x9cd5('0x30')][_0x9cd5('0x47')](_0x5c33e9);})[_0x9cd5('0x28')](function(_0x12d604){_0x502257[_0x9cd5('0x48')]=_0x12d604;return _0x502257;})[_0x9cd5('0x28')](respondWithFilteredResult(_0x4af6c8,_0x5c33e9))[_0x9cd5('0x49')](handleError(_0x4af6c8,null));};exports[_0x9cd5('0x4a')]=function(_0x3ed405,_0x7ad8ec){var _0xa12319={'raw':!![],'where':{'id':_0x3ed405[_0x9cd5('0x4b')]['id']}},_0x3b316b={};_0x3b316b[_0x9cd5('0x35')]=_[_0x9cd5('0x37')](db['ChatOfflineMessage'][_0x9cd5('0x31')]);_0x3b316b['query']=_[_0x9cd5('0x37')](_0x3ed405[_0x9cd5('0x36')]);_0x3b316b[_0x9cd5('0x38')]=_[_0x9cd5('0x39')](_0x3b316b[_0x9cd5('0x35')],_0x3b316b['query']);_0xa12319[_0x9cd5('0x3a')]=_[_0x9cd5('0x39')](_0x3b316b[_0x9cd5('0x35')],qs['fields'](_0x3ed405[_0x9cd5('0x36')][_0x9cd5('0x3b')]));_0xa12319[_0x9cd5('0x3a')]=_0xa12319[_0x9cd5('0x3a')]['length']?_0xa12319[_0x9cd5('0x3a')]:_0x3b316b[_0x9cd5('0x35')];if(_0x3ed405[_0x9cd5('0x36')][_0x9cd5('0x45')]){_0xa12319[_0x9cd5('0x46')]=[{'all':!![]}];}_0xa12319=_[_0x9cd5('0x44')]({},_0xa12319,_0x3ed405[_0x9cd5('0x4c')]);return db[_0x9cd5('0x30')][_0x9cd5('0x4d')](_0xa12319)[_0x9cd5('0x28')](handleEntityNotFound(_0x7ad8ec,null))[_0x9cd5('0x28')](respondWithResult(_0x7ad8ec,null))[_0x9cd5('0x49')](handleError(_0x7ad8ec,null));};exports[_0x9cd5('0x4e')]=function(_0x1e1ba0,_0x245f9e){return db[_0x9cd5('0x30')][_0x9cd5('0x4e')](_0x1e1ba0[_0x9cd5('0x4f')],{})['then'](respondWithResult(_0x245f9e,0xc9))[_0x9cd5('0x49')](handleError(_0x245f9e,null));};exports[_0x9cd5('0x27')]=function(_0x3fead7,_0x2058a6){if(_0x3fead7['body']['id']){delete _0x3fead7[_0x9cd5('0x4f')]['id'];}return db[_0x9cd5('0x30')]['find']({'where':{'id':_0x3fead7[_0x9cd5('0x4b')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x2058a6,null))[_0x9cd5('0x28')](saveUpdates(_0x3fead7[_0x9cd5('0x4f')],null))[_0x9cd5('0x28')](respondWithResult(_0x2058a6,null))[_0x9cd5('0x49')](handleError(_0x2058a6,null));};exports[_0x9cd5('0x29')]=function(_0x14c585,_0x5b6c7d){return db['ChatOfflineMessage'][_0x9cd5('0x4d')]({'where':{'id':_0x14c585[_0x9cd5('0x4b')]['id']}})[_0x9cd5('0x28')](handleEntityNotFound(_0x5b6c7d,null))[_0x9cd5('0x28')](removeEntity(_0x5b6c7d,null))['catch'](handleError(_0x5b6c7d,null));};exports[_0x9cd5('0x50')]=function(_0x55ac13,_0x5d4463){return db[_0x9cd5('0x30')][_0x9cd5('0x50')]()[_0x9cd5('0x28')](respondWithResult(_0x5d4463,null))['catch'](handleError(_0x5d4463,null));}; \ No newline at end of file +var _0xf072=['order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','catch','show','create','body','update','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','stack','name','index','map','ChatOfflineMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1c626d,_0x16c040){var _0x321ad5=function(_0x4ea390){while(--_0x4ea390){_0x1c626d['push'](_0x1c626d['shift']());}};_0x321ad5(++_0x16c040);}(_0xf072,0x1cf));var _0x2f07=function(_0x4fcadb,_0x293a79){_0x4fcadb=_0x4fcadb-0x0;var _0x488e9e=_0xf072[_0x4fcadb];return _0x488e9e;};'use strict';var pdf=require(_0x2f07('0x0'));var emlformat=require(_0x2f07('0x1'));var rimraf=require(_0x2f07('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f07('0x3'));var rp=require('request-promise');var moment=require(_0x2f07('0x4'));var BPromise=require(_0x2f07('0x5'));var Mustache=require(_0x2f07('0x6'));var util=require('util');var path=require(_0x2f07('0x7'));var sox=require(_0x2f07('0x8'));var csv=require(_0x2f07('0x9'));var ejs=require(_0x2f07('0xa'));var fs=require('fs');var _=require(_0x2f07('0xb'));var squel=require(_0x2f07('0xc'));var crypto=require(_0x2f07('0xd'));var jsforce=require(_0x2f07('0xe'));var deskjs=require(_0x2f07('0xf'));var toCsv=require(_0x2f07('0x9'));var querystring=require(_0x2f07('0x10'));var Papa=require(_0x2f07('0x11'));var Redis=require(_0x2f07('0x12'));var authService=require(_0x2f07('0x13'));var qs=require(_0x2f07('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f07('0x15'));var logger=require(_0x2f07('0x16'))(_0x2f07('0x17'));var utils=require(_0x2f07('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dd0cf,_0x1e291d){_0x1e291d=_0x1e291d||0xcc;return function(_0x58549c){if(_0x58549c){return _0x3dd0cf[_0x2f07('0x19')](_0x1e291d);}return _0x3dd0cf[_0x2f07('0x1a')](_0x1e291d)[_0x2f07('0x1b')]();};}function respondWithResult(_0x4dceb1,_0x211514){_0x211514=_0x211514||0xc8;return function(_0x443fdc){if(_0x443fdc){return _0x4dceb1[_0x2f07('0x1a')](_0x211514)[_0x2f07('0x1c')](_0x443fdc);}};}function respondWithFilteredResult(_0x254dbb,_0x309908){return function(_0x5d32d6){if(_0x5d32d6){var _0x8475cf=_0x5d32d6[_0x2f07('0x1d')],_0x5a7b5c=_0x309908[_0x2f07('0x1e')],_0x2232a4=_0x309908[_0x2f07('0x1e')]+_0x309908[_0x2f07('0x1f')],_0xe8cf4d;if(_0x2232a4>=_0x8475cf){_0x2232a4=_0x8475cf;_0xe8cf4d=0xc8;}else{_0xe8cf4d=0xce;}_0x254dbb[_0x2f07('0x1a')](_0xe8cf4d);return _0x254dbb[_0x2f07('0x20')]('Content-Range',_0x5a7b5c+'-'+_0x2232a4+'/'+_0x8475cf)[_0x2f07('0x1c')](_0x5d32d6);}return null;};}function patchUpdates(_0x4e35fd){return function(_0x3cd3c0){try{jsonpatch[_0x2f07('0x21')](_0x3cd3c0,_0x4e35fd,!![]);}catch(_0x119b68){return BPromise[_0x2f07('0x22')](_0x119b68);}return _0x3cd3c0[_0x2f07('0x23')]();};}function saveUpdates(_0x5267e1,_0x45df73){return function(_0x5a0146){if(_0x5a0146){return _0x5a0146['update'](_0x5267e1)['then'](function(_0x1d93c2){return _0x1d93c2;});}return null;};}function removeEntity(_0x51c285,_0xb0c978){return function(_0x5e6ac6){if(_0x5e6ac6){return _0x5e6ac6[_0x2f07('0x24')]()[_0x2f07('0x25')](function(){_0x51c285[_0x2f07('0x1a')](0xcc)[_0x2f07('0x1b')]();});}};}function handleEntityNotFound(_0x49521b,_0x31be77){return function(_0x428d8c){if(!_0x428d8c){_0x49521b[_0x2f07('0x19')](0x194);}return _0x428d8c;};}function handleError(_0x5cfa32,_0x111376){_0x111376=_0x111376||0x1f4;return function(_0x113916){logger['error'](_0x113916[_0x2f07('0x26')]);if(_0x113916[_0x2f07('0x27')]){delete _0x113916['name'];}_0x5cfa32[_0x2f07('0x1a')](_0x111376)['send'](_0x113916);};}exports[_0x2f07('0x28')]=function(_0x17a43a,_0x27bd72){var _0x18f599={},_0x20e4f8={},_0x139ea8={'count':0x0,'rows':[]};var _0x787aad=_[_0x2f07('0x29')](db[_0x2f07('0x2a')][_0x2f07('0x2b')],function(_0x3b4e2f){return{'name':_0x3b4e2f[_0x2f07('0x2c')],'type':_0x3b4e2f['type'][_0x2f07('0x2d')]};});_0x20e4f8[_0x2f07('0x2e')]=_[_0x2f07('0x29')](_0x787aad,'name');_0x20e4f8[_0x2f07('0x2f')]=_[_0x2f07('0x30')](_0x17a43a[_0x2f07('0x2f')]);_0x20e4f8['filters']=_[_0x2f07('0x31')](_0x20e4f8[_0x2f07('0x2e')],_0x20e4f8[_0x2f07('0x2f')]);_0x18f599[_0x2f07('0x32')]=_[_0x2f07('0x31')](_0x20e4f8[_0x2f07('0x2e')],qs[_0x2f07('0x33')](_0x17a43a['query'][_0x2f07('0x33')]));_0x18f599['attributes']=_0x18f599[_0x2f07('0x32')][_0x2f07('0x34')]?_0x18f599[_0x2f07('0x32')]:_0x20e4f8[_0x2f07('0x2e')];if(!_0x17a43a[_0x2f07('0x2f')][_0x2f07('0x35')](_0x2f07('0x36'))){_0x18f599[_0x2f07('0x1f')]=qs[_0x2f07('0x1f')](_0x17a43a[_0x2f07('0x2f')][_0x2f07('0x1f')]);_0x18f599[_0x2f07('0x1e')]=qs[_0x2f07('0x1e')](_0x17a43a[_0x2f07('0x2f')][_0x2f07('0x1e')]);}_0x18f599[_0x2f07('0x37')]=qs['sort'](_0x17a43a['query'][_0x2f07('0x38')]);_0x18f599[_0x2f07('0x39')]=qs[_0x2f07('0x3a')](_['pick'](_0x17a43a['query'],_0x20e4f8[_0x2f07('0x3a')]),_0x787aad);if(_0x17a43a['query'][_0x2f07('0x3b')]){_0x18f599[_0x2f07('0x39')]=_[_0x2f07('0x3c')](_0x18f599[_0x2f07('0x39')],{'$or':_[_0x2f07('0x29')](_0x787aad,function(_0x52ead8){if(_0x52ead8[_0x2f07('0x3d')]!=='VIRTUAL'){var _0x3664eb={};_0x3664eb[_0x52ead8['name']]={'$like':'%'+_0x17a43a[_0x2f07('0x2f')]['filter']+'%'};return _0x3664eb;}})});}_0x18f599=_['merge']({},_0x18f599,_0x17a43a[_0x2f07('0x3e')]);var _0x256de1={'where':_0x18f599['where']};return db[_0x2f07('0x2a')][_0x2f07('0x1d')](_0x256de1)[_0x2f07('0x25')](function(_0x4e4997){_0x139ea8[_0x2f07('0x1d')]=_0x4e4997;if(_0x17a43a[_0x2f07('0x2f')][_0x2f07('0x3f')]){_0x18f599[_0x2f07('0x40')]=[{'all':!![]}];}return db[_0x2f07('0x2a')][_0x2f07('0x41')](_0x18f599);})[_0x2f07('0x25')](function(_0x1a9645){_0x139ea8['rows']=_0x1a9645;return _0x139ea8;})[_0x2f07('0x25')](respondWithFilteredResult(_0x27bd72,_0x18f599))[_0x2f07('0x42')](handleError(_0x27bd72,null));};exports[_0x2f07('0x43')]=function(_0x3f1b6b,_0x46c665){var _0x2ded2e={'raw':!![],'where':{'id':_0x3f1b6b['params']['id']}},_0x5129c={};_0x5129c[_0x2f07('0x2e')]=_[_0x2f07('0x30')](db[_0x2f07('0x2a')][_0x2f07('0x2b')]);_0x5129c[_0x2f07('0x2f')]=_[_0x2f07('0x30')](_0x3f1b6b['query']);_0x5129c[_0x2f07('0x3a')]=_[_0x2f07('0x31')](_0x5129c[_0x2f07('0x2e')],_0x5129c[_0x2f07('0x2f')]);_0x2ded2e['attributes']=_['intersection'](_0x5129c[_0x2f07('0x2e')],qs[_0x2f07('0x33')](_0x3f1b6b[_0x2f07('0x2f')][_0x2f07('0x33')]));_0x2ded2e['attributes']=_0x2ded2e[_0x2f07('0x32')][_0x2f07('0x34')]?_0x2ded2e[_0x2f07('0x32')]:_0x5129c[_0x2f07('0x2e')];if(_0x3f1b6b[_0x2f07('0x2f')][_0x2f07('0x3f')]){_0x2ded2e[_0x2f07('0x40')]=[{'all':!![]}];}_0x2ded2e=_[_0x2f07('0x3c')]({},_0x2ded2e,_0x3f1b6b[_0x2f07('0x3e')]);return db[_0x2f07('0x2a')]['find'](_0x2ded2e)['then'](handleEntityNotFound(_0x46c665,null))['then'](respondWithResult(_0x46c665,null))[_0x2f07('0x42')](handleError(_0x46c665,null));};exports[_0x2f07('0x44')]=function(_0x5a4963,_0x97c166){return db['ChatOfflineMessage'][_0x2f07('0x44')](_0x5a4963[_0x2f07('0x45')],{})[_0x2f07('0x25')](respondWithResult(_0x97c166,0xc9))['catch'](handleError(_0x97c166,null));};exports[_0x2f07('0x46')]=function(_0x350ace,_0x47b17f){if(_0x350ace['body']['id']){delete _0x350ace[_0x2f07('0x45')]['id'];}return db[_0x2f07('0x2a')][_0x2f07('0x47')]({'where':{'id':_0x350ace[_0x2f07('0x48')]['id']}})[_0x2f07('0x25')](handleEntityNotFound(_0x47b17f,null))[_0x2f07('0x25')](saveUpdates(_0x350ace[_0x2f07('0x45')],null))[_0x2f07('0x25')](respondWithResult(_0x47b17f,null))[_0x2f07('0x42')](handleError(_0x47b17f,null));};exports[_0x2f07('0x24')]=function(_0x31dea5,_0x9a94c8){return db[_0x2f07('0x2a')][_0x2f07('0x47')]({'where':{'id':_0x31dea5[_0x2f07('0x48')]['id']}})[_0x2f07('0x25')](handleEntityNotFound(_0x9a94c8,null))['then'](removeEntity(_0x9a94c8,null))[_0x2f07('0x42')](handleError(_0x9a94c8,null));};exports[_0x2f07('0x49')]=function(_0x38083a,_0x1aca39){return db[_0x2f07('0x2a')][_0x2f07('0x49')]()[_0x2f07('0x25')](respondWithResult(_0x1aca39,null))[_0x2f07('0x42')](handleError(_0x1aca39,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4a91d82..46cc547 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 _0xb240=['path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x233602,_0x24afe3){var _0x214483=function(_0x588886){while(--_0x588886){_0x233602['push'](_0x233602['shift']());}};_0x214483(++_0x24afe3);}(_0xb240,0x1d0));var _0x0b24=function(_0x4e38d0,_0x569d79){_0x4e38d0=_0x4e38d0-0x0;var _0x65c3db=_0xb240[_0x4e38d0];return _0x65c3db;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var logger=require('../../config/logger')(_0x0b24('0x2'));var moment=require(_0x0b24('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b24('0x4'));var rimraf=require(_0x0b24('0x5'));var config=require(_0x0b24('0x6'));var attributes=require(_0x0b24('0x7'));module[_0x0b24('0x8')]=function(_0x1af672,_0xdcdf9b){return _0x1af672[_0x0b24('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0x0b24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0b24('0xb'),'collate':_0x0b24('0xc')});}; \ No newline at end of file +var _0x7a77=['define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x16bea7,_0x4b8e74){var _0x185b0f=function(_0x216e7a){while(--_0x216e7a){_0x16bea7['push'](_0x16bea7['shift']());}};_0x185b0f(++_0x4b8e74);}(_0x7a77,0x1cb));var _0x77a7=function(_0xf3388b,_0x275401){_0xf3388b=_0xf3388b-0x0;var _0x14a9ee=_0x7a77[_0xf3388b];return _0x14a9ee;};'use strict';var _=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var logger=require(_0x77a7('0x2'))('api');var moment=require(_0x77a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x77a7('0x4'));var fs=require('fs');var path=require(_0x77a7('0x5'));var rimraf=require('rimraf');var config=require(_0x77a7('0x6'));var attributes=require(_0x77a7('0x7'));module[_0x77a7('0x8')]=function(_0x18bb23,_0x1228fe){return _0x18bb23[_0x77a7('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0x77a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x77a7('0xb'),'collate':_0x77a7('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8d7ede5..b2603c7 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 _0x19ba=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x19ba,0x84));var _0xa19b=function(_0x187454,_0x69cd05){_0x187454=_0x187454-0x0;var _0x4a203a=_0x19ba[_0x187454];return _0x4a203a;};'use strict';var _=require(_0xa19b('0x0'));var util=require(_0xa19b('0x1'));var moment=require('moment');var BPromise=require(_0xa19b('0x2'));var rs=require(_0xa19b('0x3'));var fs=require('fs');var Redis=require(_0xa19b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa19b('0x5'));var logger=require(_0xa19b('0x6'))(_0xa19b('0x7'));var config=require(_0xa19b('0x8'));var jayson=require(_0xa19b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaf46f8,_0x15a1ec,_0x1e1760){return new BPromise(function(_0x5b72bf,_0x2e0ce8){return client['request'](_0xaf46f8,_0x1e1760)['then'](function(_0x2962ff){logger['info'](_0xa19b('0xa'),_0x15a1ec,'request\x20sent');logger[_0xa19b('0xb')](_0xa19b('0xc'),_0x15a1ec,'request\x20sent',JSON['stringify'](_0x2962ff));if(_0x2962ff[_0xa19b('0xd')]){if(_0x2962ff[_0xa19b('0xd')][_0xa19b('0xe')]===0x1f4){logger[_0xa19b('0xd')](_0xa19b('0xa'),_0x15a1ec,_0x2962ff[_0xa19b('0xd')][_0xa19b('0xf')]);return _0x2e0ce8(_0x2962ff[_0xa19b('0xd')]['message']);}logger[_0xa19b('0xd')](_0xa19b('0xa'),_0x15a1ec,_0x2962ff[_0xa19b('0xd')][_0xa19b('0xf')]);return _0x5b72bf(_0x2962ff[_0xa19b('0xd')][_0xa19b('0xf')]);}else{logger[_0xa19b('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x15a1ec,_0xa19b('0x11'));_0x5b72bf(_0x2962ff[_0xa19b('0x12')][_0xa19b('0xf')]);}})['catch'](function(_0x48c499){logger[_0xa19b('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x15a1ec,_0x48c499);_0x2e0ce8(_0x48c499);});});} \ No newline at end of file +var _0xbe67=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment'];(function(_0x458edc,_0x9baf98){var _0x44af29=function(_0x41929c){while(--_0x41929c){_0x458edc['push'](_0x458edc['shift']());}};_0x44af29(++_0x9baf98);}(_0xbe67,0x82));var _0x7be6=function(_0x478de9,_0x26f592){_0x478de9=_0x478de9-0x0;var _0x35060b=_0xbe67[_0x478de9];return _0x35060b;};'use strict';var _=require(_0x7be6('0x0'));var util=require('util');var moment=require(_0x7be6('0x1'));var BPromise=require(_0x7be6('0x2'));var rs=require(_0x7be6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7be6('0x4'))['db'];var utils=require(_0x7be6('0x5'));var logger=require(_0x7be6('0x6'))(_0x7be6('0x7'));var config=require(_0x7be6('0x8'));var jayson=require(_0x7be6('0x9'));var client=jayson[_0x7be6('0xa')][_0x7be6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x101d0e,_0x66f5a8,_0x1f6244){return new BPromise(function(_0x5eda68,_0x29ce23){return client[_0x7be6('0xc')](_0x101d0e,_0x1f6244)[_0x7be6('0xd')](function(_0x52acfe){logger[_0x7be6('0xe')](_0x7be6('0xf'),_0x66f5a8,_0x7be6('0x10'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x66f5a8,_0x7be6('0x10'),JSON[_0x7be6('0x11')](_0x52acfe));if(_0x52acfe[_0x7be6('0x12')]){if(_0x52acfe[_0x7be6('0x12')][_0x7be6('0x13')]===0x1f4){logger['error'](_0x7be6('0xf'),_0x66f5a8,_0x52acfe[_0x7be6('0x12')]['message']);return _0x29ce23(_0x52acfe[_0x7be6('0x12')][_0x7be6('0x14')]);}logger[_0x7be6('0x12')](_0x7be6('0xf'),_0x66f5a8,_0x52acfe[_0x7be6('0x12')][_0x7be6('0x14')]);return _0x5eda68(_0x52acfe[_0x7be6('0x12')][_0x7be6('0x14')]);}else{logger[_0x7be6('0xe')](_0x7be6('0xf'),_0x66f5a8,'request\x20sent');_0x5eda68(_0x52acfe['result']['message']);}})[_0x7be6('0x15')](function(_0x921cf3){logger[_0x7be6('0x12')](_0x7be6('0xf'),_0x66f5a8,_0x921cf3);_0x29ce23(_0x921cf3);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6512a10..270df40 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 _0x844c=['/describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x118489,_0x3e8b9e){var _0x2459c7=function(_0x554693){while(--_0x554693){_0x118489['push'](_0x118489['shift']());}};_0x2459c7(++_0x3e8b9e);}(_0x844c,0x116));var _0xc844=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x844c[_0x3c51d4];return _0x53c45f;};'use strict';var multer=require(_0xc844('0x0'));var util=require(_0xc844('0x1'));var path=require(_0xc844('0x2'));var timeout=require(_0xc844('0x3'));var express=require(_0xc844('0x4'));var router=express[_0xc844('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc844('0x6'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xc844('0x7')]('/',auth[_0xc844('0x8')](),controller[_0xc844('0x9')]);router[_0xc844('0x7')](_0xc844('0xa'),auth[_0xc844('0x8')](),controller['describe']);router['get'](_0xc844('0xb'),auth[_0xc844('0x8')](),controller[_0xc844('0xc')]);router[_0xc844('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc844('0xe')](_0xc844('0xb'),auth[_0xc844('0x8')](),controller['update']);router[_0xc844('0xf')](_0xc844('0xb'),auth[_0xc844('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc765=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','/describe','get','show','post','put','/:id','delete'];(function(_0x20fc38,_0x131f62){var _0x162d06=function(_0x1c2794){while(--_0x1c2794){_0x20fc38['push'](_0x20fc38['shift']());}};_0x162d06(++_0x131f62);}(_0xc765,0xb5));var _0x5c76=function(_0x39f42f,_0x1866e4){_0x39f42f=_0x39f42f-0x0;var _0x36df42=_0xc765[_0x39f42f];return _0x36df42;};'use strict';var multer=require(_0x5c76('0x0'));var util=require(_0x5c76('0x1'));var path=require('path');var timeout=require(_0x5c76('0x2'));var express=require(_0x5c76('0x3'));var router=express[_0x5c76('0x4')]();var auth=require(_0x5c76('0x5'));var interaction=require(_0x5c76('0x6'));var config=require(_0x5c76('0x7'));var controller=require(_0x5c76('0x8'));router['get']('/',auth[_0x5c76('0x9')](),controller['index']);router['get'](_0x5c76('0xa'),auth[_0x5c76('0x9')](),controller['describe']);router[_0x5c76('0xb')]('/:id',auth[_0x5c76('0x9')](),controller[_0x5c76('0xc')]);router[_0x5c76('0xd')]('/',auth[_0x5c76('0x9')](),controller['create']);router[_0x5c76('0xe')](_0x5c76('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x5c76('0x10')](_0x5c76('0xf'),auth[_0x5c76('0x9')](),controller[_0x5c76('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 6c63455..059d283 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 _0x3b6f=['STRING','mouseOver','timeout','sequelize','exports'];(function(_0x40a746,_0x21edcb){var _0x541f4e=function(_0x315849){while(--_0x315849){_0x40a746['push'](_0x40a746['shift']());}};_0x541f4e(++_0x21edcb);}(_0x3b6f,0x67));var _0xf3b6=function(_0x59acb4,_0x436954){_0x59acb4=_0x59acb4-0x0;var _0x4cd0a6=_0x3b6f[_0x59acb4];return _0x4cd0a6;};'use strict';var Sequelize=require(_0xf3b6('0x0'));module[_0xf3b6('0x1')]={'name':{'type':Sequelize[_0xf3b6('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf3b6('0x3'),_0xf3b6('0x4')),'defaultValue':_0xf3b6('0x3')},'selector':{'type':Sequelize[_0xf3b6('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd8ed=['STRING','mouseOver','timeout','sequelize','exports'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xd8ed,0x19d));var _0xdd8e=function(_0x124e8f,_0x25c34a){_0x124e8f=_0x124e8f-0x0;var _0x3a7859=_0xd8ed[_0x124e8f];return _0x3a7859;};'use strict';var Sequelize=require(_0xdd8e('0x0'));module[_0xdd8e('0x1')]={'name':{'type':Sequelize[_0xdd8e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdd8e('0x3'),_0xdd8e('0x4')),'defaultValue':_0xdd8e('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index da1c1a5..ec89e76 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 _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x12b811,_0x23d90c){var _0x1bfa28=function(_0x303f67){while(--_0x303f67){_0x12b811['push'](_0x12b811['shift']());}};_0x1bfa28(++_0x23d90c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file +var _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x2ec43b,_0x3b2585){var _0x178e13=function(_0x386ec8){while(--_0x386ec8){_0x2ec43b['push'](_0x2ec43b['shift']());}};_0x178e13(++_0x3b2585);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 26c70a3..590cc0f 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 _0x80bd=['request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','../../config/logger','api','bluebird'];(function(_0x461f9d,_0x481fff){var _0x154289=function(_0x11ce33){while(--_0x11ce33){_0x461f9d['push'](_0x461f9d['shift']());}};_0x154289(++_0x481fff);}(_0x80bd,0x197));var _0xd80b=function(_0x1b5d36,_0x16c4ae){_0x1b5d36=_0x1b5d36-0x0;var _0x5693f3=_0x80bd[_0x1b5d36];return _0x5693f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd80b('0x0'))(_0xd80b('0x1'));var moment=require('moment');var BPromise=require(_0xd80b('0x2'));var rp=require(_0xd80b('0x3'));var fs=require('fs');var path=require(_0xd80b('0x4'));var rimraf=require(_0xd80b('0x5'));var config=require(_0xd80b('0x6'));var attributes=require(_0xd80b('0x7'));module[_0xd80b('0x8')]=function(_0x269677,_0x5a0fe3){return _0x269677['define'](_0xd80b('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc39f=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x451f22,_0xcf2393){var _0x3bd251=function(_0x5c7386){while(--_0x5c7386){_0x451f22['push'](_0x451f22['shift']());}};_0x3bd251(++_0xcf2393);}(_0xc39f,0x189));var _0xfc39=function(_0x52492e,_0x51ef14){_0x52492e=_0x52492e-0x0;var _0x470378=_0xc39f[_0x52492e];return _0x470378;};'use strict';var _=require(_0xfc39('0x0'));var util=require(_0xfc39('0x1'));var logger=require('../../config/logger')(_0xfc39('0x2'));var moment=require(_0xfc39('0x3'));var BPromise=require(_0xfc39('0x4'));var rp=require(_0xfc39('0x5'));var fs=require('fs');var path=require(_0xfc39('0x6'));var rimraf=require(_0xfc39('0x7'));var config=require(_0xfc39('0x8'));var attributes=require(_0xfc39('0x9'));module['exports']=function(_0x2a58eb,_0x250596){return _0x2a58eb[_0xfc39('0xa')](_0xfc39('0xb'),attributes,{'tableName':_0xfc39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 5b514fc..a749aef 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 _0xb7e0=['http','request','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5a43af,_0x4caf25){var _0x9c9788=function(_0x400e96){while(--_0x400e96){_0x5a43af['push'](_0x5a43af['shift']());}};_0x9c9788(++_0x4caf25);}(_0xb7e0,0x18e));var _0x0b7e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb7e0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0b7e('0x0'));var util=require(_0x0b7e('0x1'));var moment=require(_0x0b7e('0x2'));var BPromise=require(_0x0b7e('0x3'));var rs=require(_0x0b7e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b7e('0x5'));var logger=require(_0x0b7e('0x6'))(_0x0b7e('0x7'));var config=require(_0x0b7e('0x8'));var jayson=require(_0x0b7e('0x9'));var client=jayson['client'][_0x0b7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x200be9,_0x2abdfb,_0x528843){return new BPromise(function(_0x428537,_0xa62b74){return client[_0x0b7e('0xb')](_0x200be9,_0x528843)[_0x0b7e('0xc')](function(_0x1b3eb5){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2abdfb,_0x0b7e('0xd'));logger[_0x0b7e('0xe')](_0x0b7e('0xf'),_0x2abdfb,_0x0b7e('0xd'),JSON[_0x0b7e('0x10')](_0x1b3eb5));if(_0x1b3eb5[_0x0b7e('0x11')]){if(_0x1b3eb5[_0x0b7e('0x11')][_0x0b7e('0x12')]===0x1f4){logger[_0x0b7e('0x11')](_0x0b7e('0x13'),_0x2abdfb,_0x1b3eb5[_0x0b7e('0x11')]['message']);return _0xa62b74(_0x1b3eb5[_0x0b7e('0x11')][_0x0b7e('0x14')]);}logger['error'](_0x0b7e('0x13'),_0x2abdfb,_0x1b3eb5[_0x0b7e('0x11')]['message']);return _0x428537(_0x1b3eb5[_0x0b7e('0x11')][_0x0b7e('0x14')]);}else{logger[_0x0b7e('0x15')](_0x0b7e('0x13'),_0x2abdfb,'request\x20sent');_0x428537(_0x1b3eb5[_0x0b7e('0x16')]['message']);}})[_0x0b7e('0x17')](function(_0x18f879){logger[_0x0b7e('0x11')](_0x0b7e('0x13'),_0x2abdfb,_0x18f879);_0xa62b74(_0x18f879);});});} \ No newline at end of file +var _0x9146=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4d378e,_0x193221){var _0x1c34b8=function(_0x29317c){while(--_0x29317c){_0x4d378e['push'](_0x4d378e['shift']());}};_0x1c34b8(++_0x193221);}(_0x9146,0x170));var _0x6914=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x9146[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x6914('0x0'));var util=require(_0x6914('0x1'));var moment=require(_0x6914('0x2'));var BPromise=require(_0x6914('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6914('0x4'));var db=require(_0x6914('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6914('0x6'))(_0x6914('0x7'));var config=require(_0x6914('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6914('0x9')][_0x6914('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4db082,_0x37503d,_0x14b546){return new BPromise(function(_0x4c52f3,_0x431c93){return client[_0x6914('0xb')](_0x4db082,_0x14b546)[_0x6914('0xc')](function(_0x42a253){logger[_0x6914('0xd')](_0x6914('0xe'),_0x37503d,'request\x20sent');logger[_0x6914('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x37503d,_0x6914('0x10'),JSON[_0x6914('0x11')](_0x42a253));if(_0x42a253['error']){if(_0x42a253[_0x6914('0x12')][_0x6914('0x13')]===0x1f4){logger['error'](_0x6914('0xe'),_0x37503d,_0x42a253['error'][_0x6914('0x14')]);return _0x431c93(_0x42a253[_0x6914('0x12')][_0x6914('0x14')]);}logger[_0x6914('0x12')](_0x6914('0xe'),_0x37503d,_0x42a253[_0x6914('0x12')][_0x6914('0x14')]);return _0x4c52f3(_0x42a253[_0x6914('0x12')][_0x6914('0x14')]);}else{logger['info'](_0x6914('0xe'),_0x37503d,_0x6914('0x10'));_0x4c52f3(_0x42a253[_0x6914('0x15')][_0x6914('0x14')]);}})[_0x6914('0x16')](function(_0x16c5b1){logger[_0x6914('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x37503d,_0x16c5b1);_0x431c93(_0x16c5b1);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2aaaf77..e50986f 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 _0x4ab1=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4ab1,0x6d));var _0x14ab=function(_0x454faa,_0x3eb0c5){_0x454faa=_0x454faa-0x0;var _0x16afb6=_0x4ab1[_0x454faa];return _0x16afb6;};'use strict';var multer=require(_0x14ab('0x0'));var util=require(_0x14ab('0x1'));var path=require('path');var timeout=require(_0x14ab('0x2'));var express=require(_0x14ab('0x3'));var router=express['Router']();var auth=require(_0x14ab('0x4'));var interaction=require(_0x14ab('0x5'));var config=require(_0x14ab('0x6'));var controller=require(_0x14ab('0x7'));router[_0x14ab('0x8')](_0x14ab('0x9'),auth[_0x14ab('0xa')](),controller[_0x14ab('0xb')]);router[_0x14ab('0xc')]('/',auth[_0x14ab('0xa')](),controller['create']);router[_0x14ab('0xd')]('/:id',auth[_0x14ab('0xa')](),controller[_0x14ab('0xe')]);router[_0x14ab('0xf')](_0x14ab('0x9'),auth[_0x14ab('0xa')](),controller[_0x14ab('0x10')]);module[_0x14ab('0x11')]=router; \ No newline at end of file +var _0xd6bb=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x16ed87,_0x1be1a2){var _0xc1a1d8=function(_0x3c0fcf){while(--_0x3c0fcf){_0x16ed87['push'](_0x16ed87['shift']());}};_0xc1a1d8(++_0x1be1a2);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xd6bb[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0xbd6b('0x0'));var util=require('util');var path=require(_0xbd6b('0x1'));var timeout=require(_0xbd6b('0x2'));var express=require(_0xbd6b('0x3'));var router=express[_0xbd6b('0x4')]();var auth=require(_0xbd6b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd6b('0x6'));var controller=require(_0xbd6b('0x7'));router[_0xbd6b('0x8')]('/:id',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xa')]);router[_0xbd6b('0xb')]('/',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xc')]);router[_0xbd6b('0xd')](_0xbd6b('0xe'),auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xf')]);router[_0xbd6b('0x10')](_0xbd6b('0xe'),auth['isAuthenticated'](),controller[_0xbd6b('0x11')]);module[_0xbd6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 35cfc19..6b4c5e6 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 _0xcc36=['INTEGER','rrmemory','beepall','roundrobin','sequelize','name'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xcc36,0xdc));var _0x6cc3=function(_0x1db0d2,_0x2c0712){_0x1db0d2=_0x1db0d2-0x0;var _0x2a442b=_0xcc36[_0x1db0d2];return _0x2a442b;};'use strict';var Sequelize=require(_0x6cc3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6cc3('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6cc3('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6cc3('0x3'),_0x6cc3('0x4'),_0x6cc3('0x5'))}}; \ No newline at end of file +var _0x568e=['STRING','name','ENUM','beepall','roundrobin','exports'];(function(_0x179b68,_0x339d82){var _0x5e6d69=function(_0x69ff9){while(--_0x69ff9){_0x179b68['push'](_0x179b68['shift']());}};_0x5e6d69(++_0x339d82);}(_0x568e,0x161));var _0xe568=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x568e[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require('sequelize');module[_0xe568('0x0')]={'name':{'type':Sequelize[_0xe568('0x1')],'unique':_0xe568('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe568('0x3')]('rrmemory',_0xe568('0x4'),_0xe568('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b1287d8..c83c99a 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 _0xa1ca=['QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','http','Sequelize','ValidationError','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','options','findAll','show','include','find','create','body','user','get','role','userProfileId','autoAssociation','params','describe','getMembers','findOne','UserChatQueue','sort','merge','UserId','updatedAt','format','chatPause','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','sequelize','transaction','each','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push'];(function(_0x50cb1d,_0x23de00){var _0x27c8d5=function(_0xa77d2c){while(--_0xa77d2c){_0x50cb1d['push'](_0x50cb1d['shift']());}};_0x27c8d5(++_0x23de00);}(_0xa1ca,0x12d));var _0xaa1c=function(_0x267390,_0x1733f2){_0x267390=_0x267390-0x0;var _0x19c5a9=_0xa1ca[_0x267390];return _0x19c5a9;};'use strict';var pdf=require(_0xaa1c('0x0'));var emlformat=require(_0xaa1c('0x1'));var rimraf=require(_0xaa1c('0x2'));var zipdir=require(_0xaa1c('0x3'));var jsonpatch=require(_0xaa1c('0x4'));var rp=require(_0xaa1c('0x5'));var moment=require('moment');var BPromise=require(_0xaa1c('0x6'));var Mustache=require(_0xaa1c('0x7'));var util=require(_0xaa1c('0x8'));var path=require(_0xaa1c('0x9'));var sox=require(_0xaa1c('0xa'));var csv=require(_0xaa1c('0xb'));var ejs=require(_0xaa1c('0xc'));var fs=require('fs');var _=require(_0xaa1c('0xd'));var squel=require(_0xaa1c('0xe'));var crypto=require(_0xaa1c('0xf'));var jsforce=require(_0xaa1c('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa1c('0x11'));var Papa=require(_0xaa1c('0x12'));var Redis=require(_0xaa1c('0x13'));var authService=require(_0xaa1c('0x14'));var qs=require(_0xaa1c('0x15'));var as=require(_0xaa1c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa1c('0x17'));var utils=require(_0xaa1c('0x18'));var config=require(_0xaa1c('0x19'));var db=require(_0xaa1c('0x1a'))['db'];config[_0xaa1c('0x1b')]=_[_0xaa1c('0x1c')](config[_0xaa1c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa1c('0x1d'))(new Redis(config[_0xaa1c('0x1b')]));require('./chatQueue.socket')[_0xaa1c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xaa1c('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x214244,_0x5f0f8c,_0xea774a){if(_0xea774a){var _0x513a5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x513a5c['test'](_0x5f0f8c)){return _0x214244;}else{throw new db[(_0xaa1c('0x20'))][(_0xaa1c('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x214244;}}function respondWithRpcPromise(_0x26e360,_0x34b39f,_0x391b6e,_0x8f4250){return new BPromise(function(_0x489ec4,_0x4b86d5){var _0x4f6ce6=_0x8f4250||client;return _0x4f6ce6[_0xaa1c('0x22')](_0x26e360,_0x391b6e)[_0xaa1c('0x23')](function(_0x563280){logger[_0xaa1c('0x24')](_0xaa1c('0x25'),_0x34b39f,_0xaa1c('0x26'));logger[_0xaa1c('0x27')](_0xaa1c('0x28'),_0x34b39f,_0xaa1c('0x26'),JSON['stringify'](_0x563280));if(_0x563280[_0xaa1c('0x29')]){if(_0x563280[_0xaa1c('0x29')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x34b39f,_0x563280[_0xaa1c('0x29')][_0xaa1c('0x2a')]);return _0x4b86d5(_0x563280[_0xaa1c('0x29')][_0xaa1c('0x2a')]);}logger[_0xaa1c('0x29')](_0xaa1c('0x25'),_0x34b39f,_0x563280[_0xaa1c('0x29')]['message']);return _0x489ec4(_0x563280[_0xaa1c('0x29')][_0xaa1c('0x2a')]);}else{logger[_0xaa1c('0x24')]('ChatQueue,\x20%s,\x20%s',_0x34b39f,_0xaa1c('0x26'));_0x489ec4(_0x563280['result'][_0xaa1c('0x2a')]);}})[_0xaa1c('0x2b')](function(_0x42201a){logger[_0xaa1c('0x29')](_0xaa1c('0x25'),_0x34b39f,_0x42201a);_0x4b86d5(_0x42201a);});});}function respondWithStatusCode(_0x3a5759,_0x53e5cd){_0x53e5cd=_0x53e5cd||0xcc;return function(_0x1dd25c){if(_0x1dd25c){return _0x3a5759['sendStatus'](_0x53e5cd);}return _0x3a5759[_0xaa1c('0x2c')](_0x53e5cd)[_0xaa1c('0x2d')]();};}function respondWithResult(_0x5e9cbb,_0xdf86cf){_0xdf86cf=_0xdf86cf||0xc8;return function(_0x26ff3c){if(_0x26ff3c){return _0x5e9cbb[_0xaa1c('0x2c')](_0xdf86cf)[_0xaa1c('0x2e')](_0x26ff3c);}};}function respondWithFilteredResult(_0x1ead35,_0x3e9bb5){return function(_0x4a777e){if(_0x4a777e){var _0x598c7c=_0x4a777e[_0xaa1c('0x2f')],_0x1fbaac=_0x3e9bb5[_0xaa1c('0x30')],_0x87d051=_0x3e9bb5[_0xaa1c('0x30')]+_0x3e9bb5[_0xaa1c('0x31')],_0x358ed9;if(_0x87d051>=_0x598c7c){_0x87d051=_0x598c7c;_0x358ed9=0xc8;}else{_0x358ed9=0xce;}_0x1ead35['status'](_0x358ed9);return _0x1ead35[_0xaa1c('0x32')](_0xaa1c('0x33'),_0x1fbaac+'-'+_0x87d051+'/'+_0x598c7c)[_0xaa1c('0x2e')](_0x4a777e);}return null;};}function patchUpdates(_0x26d2f9){return function(_0x32b087){try{jsonpatch[_0xaa1c('0x34')](_0x32b087,_0x26d2f9,!![]);}catch(_0x10e605){return BPromise[_0xaa1c('0x35')](_0x10e605);}return _0x32b087['save']();};}function saveUpdates(_0x2a0102,_0x5f0097){return function(_0x586cd4){if(_0x586cd4){return _0x586cd4[_0xaa1c('0x36')](_0x2a0102)[_0xaa1c('0x23')](function(_0x3ffca3){return _0x3ffca3;});}return null;};}function removeEntity(_0x3b46dc,_0x1bc6d6){return function(_0x460063){if(_0x460063){return _0x460063[_0xaa1c('0x37')]()['then'](function(){var _0x425fb6=_0x460063['get']({'plain':!![]});var _0x95188f='ChatQueues';return db[_0xaa1c('0x38')][_0xaa1c('0x37')]({'where':{'type':_0x95188f,'resourceId':_0x425fb6['id']}})[_0xaa1c('0x23')](function(){return _0x460063;});})['then'](function(){_0x3b46dc[_0xaa1c('0x2c')](0xcc)[_0xaa1c('0x2d')]();});}};}function handleEntityNotFound(_0x37dd6b,_0x5c038e){return function(_0x487479){if(!_0x487479){_0x37dd6b[_0xaa1c('0x39')](0x194);}return _0x487479;};}function handleError(_0xa1820f,_0x281640){_0x281640=_0x281640||0x1f4;return function(_0x48c66c){logger['error'](_0x48c66c[_0xaa1c('0x3a')]);if(_0x48c66c[_0xaa1c('0x3b')]){delete _0x48c66c['name'];}_0xa1820f[_0xaa1c('0x2c')](_0x281640)[_0xaa1c('0x3c')](_0x48c66c);};}exports[_0xaa1c('0x3d')]=function(_0x279475,_0x347924){var _0x5bab09={},_0x3bdecf={},_0x2c5963={'count':0x0,'rows':[]};var _0xd068d6=_[_0xaa1c('0x3e')](db[_0xaa1c('0x3f')][_0xaa1c('0x40')],function(_0x5ac8c6){return{'name':_0x5ac8c6[_0xaa1c('0x41')],'type':_0x5ac8c6[_0xaa1c('0x42')]['key']};});_0x3bdecf[_0xaa1c('0x43')]=_['map'](_0xd068d6,_0xaa1c('0x3b'));_0x3bdecf['query']=_[_0xaa1c('0x44')](_0x279475['query']);_0x3bdecf[_0xaa1c('0x45')]=_[_0xaa1c('0x46')](_0x3bdecf[_0xaa1c('0x43')],_0x3bdecf[_0xaa1c('0x47')]);_0x5bab09[_0xaa1c('0x48')]=_[_0xaa1c('0x46')](_0x3bdecf['model'],qs[_0xaa1c('0x49')](_0x279475[_0xaa1c('0x47')]['fields']));_0x5bab09['attributes']=_0x5bab09[_0xaa1c('0x48')][_0xaa1c('0x4a')]?_0x5bab09[_0xaa1c('0x48')]:_0x3bdecf[_0xaa1c('0x43')];if(!_0x279475[_0xaa1c('0x47')][_0xaa1c('0x4b')](_0xaa1c('0x4c'))){_0x5bab09['limit']=qs[_0xaa1c('0x31')](_0x279475[_0xaa1c('0x47')]['limit']);_0x5bab09[_0xaa1c('0x30')]=qs[_0xaa1c('0x30')](_0x279475['query'][_0xaa1c('0x30')]);}_0x5bab09[_0xaa1c('0x4d')]=qs['sort'](_0x279475[_0xaa1c('0x47')]['sort']);_0x5bab09[_0xaa1c('0x4e')]=qs['filters'](_[_0xaa1c('0x4f')](_0x279475['query'],_0x3bdecf[_0xaa1c('0x45')]),_0xd068d6);if(_0x279475[_0xaa1c('0x47')]['filter']){_0x5bab09['where']=_['merge'](_0x5bab09['where'],{'$or':_[_0xaa1c('0x3e')](_0xd068d6,function(_0x27b919){if(_0x27b919[_0xaa1c('0x42')]!==_0xaa1c('0x50')){var _0xc9eaf5={};_0xc9eaf5[_0x27b919[_0xaa1c('0x3b')]]={'$like':'%'+_0x279475[_0xaa1c('0x47')][_0xaa1c('0x51')]+'%'};return _0xc9eaf5;}})});}_0x5bab09=_['merge']({},_0x5bab09,_0x279475[_0xaa1c('0x52')]);var _0x344d79={'where':_0x5bab09['where']};return db[_0xaa1c('0x3f')][_0xaa1c('0x2f')](_0x344d79)['then'](function(_0x5dec5a){_0x2c5963[_0xaa1c('0x2f')]=_0x5dec5a;if(_0x279475[_0xaa1c('0x47')]['includeAll']){_0x5bab09['include']=[{'all':!![]}];}return db[_0xaa1c('0x3f')][_0xaa1c('0x53')](_0x5bab09);})['then'](function(_0x1d7037){_0x2c5963['rows']=_0x1d7037;return _0x2c5963;})[_0xaa1c('0x23')](respondWithFilteredResult(_0x347924,_0x5bab09))[_0xaa1c('0x2b')](handleError(_0x347924,null));};exports[_0xaa1c('0x54')]=function(_0x433297,_0x4c0a3c){var _0x518330={'raw':!![],'where':{'id':_0x433297['params']['id']}},_0x541c18={};_0x541c18[_0xaa1c('0x43')]=_[_0xaa1c('0x44')](db['ChatQueue'][_0xaa1c('0x40')]);_0x541c18[_0xaa1c('0x47')]=_[_0xaa1c('0x44')](_0x433297[_0xaa1c('0x47')]);_0x541c18[_0xaa1c('0x45')]=_['intersection'](_0x541c18[_0xaa1c('0x43')],_0x541c18[_0xaa1c('0x47')]);_0x518330[_0xaa1c('0x48')]=_[_0xaa1c('0x46')](_0x541c18[_0xaa1c('0x43')],qs[_0xaa1c('0x49')](_0x433297[_0xaa1c('0x47')][_0xaa1c('0x49')]));_0x518330[_0xaa1c('0x48')]=_0x518330['attributes'][_0xaa1c('0x4a')]?_0x518330[_0xaa1c('0x48')]:_0x541c18[_0xaa1c('0x43')];if(_0x433297['query']['includeAll']){_0x518330[_0xaa1c('0x55')]=[{'all':!![]}];}_0x518330=_['merge']({},_0x518330,_0x433297[_0xaa1c('0x52')]);return db[_0xaa1c('0x3f')][_0xaa1c('0x56')](_0x518330)['then'](handleEntityNotFound(_0x4c0a3c,null))[_0xaa1c('0x23')](respondWithResult(_0x4c0a3c,null))['catch'](handleError(_0x4c0a3c,null));};exports[_0xaa1c('0x57')]=function(_0x5f20c3,_0x21d3fa){return db[_0xaa1c('0x3f')][_0xaa1c('0x57')](_0x5f20c3[_0xaa1c('0x58')],{})[_0xaa1c('0x23')](function(_0x4ea400){var _0x1e6d5b=_0x5f20c3[_0xaa1c('0x59')][_0xaa1c('0x5a')]({'plain':!![]});if(!_0x1e6d5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e6d5b[_0xaa1c('0x5b')]===_0xaa1c('0x59')){var _0x1d0a6d=_0x4ea400['get']({'plain':!![]});var _0x307719='ChatQueues';return db['UserProfileSection'][_0xaa1c('0x56')]({'where':{'name':_0x307719,'userProfileId':_0x1e6d5b[_0xaa1c('0x5c')]},'raw':!![]})[_0xaa1c('0x23')](function(_0x4bdf84){if(_0x4bdf84&&_0x4bdf84[_0xaa1c('0x5d')]===0x0){return db[_0xaa1c('0x38')]['create']({'name':_0x1d0a6d['name'],'resourceId':_0x1d0a6d['id'],'type':_0x4bdf84[_0xaa1c('0x3b')],'sectionId':_0x4bdf84['id']},{})[_0xaa1c('0x23')](function(){return _0x4ea400;});}else{return _0x4ea400;}})['catch'](function(_0x26f67c){logger[_0xaa1c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26f67c);throw _0x26f67c;});}return _0x4ea400;})[_0xaa1c('0x23')](respondWithResult(_0x21d3fa,0xc9))[_0xaa1c('0x2b')](handleError(_0x21d3fa,null));};exports['update']=function(_0x2d9ab9,_0x379496){if(_0x2d9ab9[_0xaa1c('0x58')]['id']){delete _0x2d9ab9[_0xaa1c('0x58')]['id'];}return db['ChatQueue'][_0xaa1c('0x56')]({'where':{'id':_0x2d9ab9['params']['id']}})['then'](handleEntityNotFound(_0x379496,null))[_0xaa1c('0x23')](saveUpdates(_0x2d9ab9[_0xaa1c('0x58')],null))[_0xaa1c('0x23')](respondWithResult(_0x379496,null))[_0xaa1c('0x2b')](handleError(_0x379496,null));};exports[_0xaa1c('0x37')]=function(_0x24421e,_0x1d55bc){return db[_0xaa1c('0x3f')]['find']({'where':{'id':_0x24421e[_0xaa1c('0x5e')]['id']}})[_0xaa1c('0x23')](handleEntityNotFound(_0x1d55bc,null))[_0xaa1c('0x23')](removeEntity(_0x1d55bc,null))['catch'](handleError(_0x1d55bc,null));};exports[_0xaa1c('0x5f')]=function(_0x1aff6f,_0x1e2394){return db[_0xaa1c('0x3f')][_0xaa1c('0x5f')]()[_0xaa1c('0x23')](respondWithResult(_0x1e2394,null))['catch'](handleError(_0x1e2394,null));};exports[_0xaa1c('0x60')]=function(_0x3f0301,_0x230b2d,_0x41bd2e){var _0x404d93={'raw':!![],'where':{}},_0xb1cbb6={},_0x1dbc38;return db[_0xaa1c('0x3f')][_0xaa1c('0x61')]({'where':{'id':_0x3f0301[_0xaa1c('0x5e')]['id']}})[_0xaa1c('0x23')](handleEntityNotFound(_0x230b2d,null))['then'](function(_0x53afaa){if(_0x53afaa){_0x1dbc38=_0x53afaa[_0xaa1c('0x5a')]({'plain':!![]});_0xb1cbb6['model']=_[_0xaa1c('0x44')](db[_0xaa1c('0x62')][_0xaa1c('0x40')]);_0xb1cbb6[_0xaa1c('0x47')]=_['keys'](_0x3f0301[_0xaa1c('0x47')]);_0xb1cbb6[_0xaa1c('0x45')]=_[_0xaa1c('0x46')](_0xb1cbb6[_0xaa1c('0x43')],_0xb1cbb6[_0xaa1c('0x47')]);_0x404d93[_0xaa1c('0x48')]=_['intersection'](_0xb1cbb6['model'],qs['fields'](_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x49')]));_0x404d93[_0xaa1c('0x48')]=_0x404d93[_0xaa1c('0x48')][_0xaa1c('0x4a')]?_0x404d93[_0xaa1c('0x48')]:_0xb1cbb6[_0xaa1c('0x43')];if(!_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x4b')](_0xaa1c('0x4c'))){_0x404d93['limit']=qs[_0xaa1c('0x31')](_0x3f0301['query'][_0xaa1c('0x31')]);_0x404d93[_0xaa1c('0x30')]=qs[_0xaa1c('0x30')](_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x30')]);}_0x404d93[_0xaa1c('0x4d')]=qs[_0xaa1c('0x63')](_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x63')]);_0x404d93[_0xaa1c('0x4e')]=qs['filters'](_[_0xaa1c('0x4f')](_0x3f0301['query'],_0xb1cbb6['filters']));_0x404d93[_0xaa1c('0x4e')]['ChatQueueId']=_0x53afaa['id'];if(_0x3f0301[_0xaa1c('0x47')][_0xaa1c('0x51')]){_0x404d93[_0xaa1c('0x4e')]=_[_0xaa1c('0x64')](_0x404d93[_0xaa1c('0x4e')],{'$or':_[_0xaa1c('0x3e')](_0x404d93[_0xaa1c('0x48')],function(_0x160a73){var _0x44f7d1={};_0x44f7d1[_0x160a73]={'$like':'%'+_0x3f0301['query'][_0xaa1c('0x51')]+'%'};return _0x44f7d1;})});}_0x404d93=_[_0xaa1c('0x64')]({},_0x404d93,_0x3f0301[_0xaa1c('0x52')]);return db['UserChatQueue'][_0xaa1c('0x53')](_0x404d93);}})[_0xaa1c('0x23')](function(_0x431fb0){if(_0x431fb0){return db['User']['findAndCountAll']({'where':{'id':_[_0xaa1c('0x3e')](_0x431fb0,_0xaa1c('0x65')),'role':'agent'},'attributes':['id',_0xaa1c('0x3b'),'chatPause',_0xaa1c('0x66'),'createdAt']});}})[_0xaa1c('0x23')](function(_0x21fae3){if(_0x21fae3){return{'count':_0x21fae3[_0xaa1c('0x2f')],'rows':_['map'](_0x21fae3['rows'],function(_0x4a9d38){return{'membername':_0x4a9d38['name'],'UserId':_0x4a9d38['id'],'queue_name':_0x1dbc38['name'],'ChatQueueId':_0x1dbc38['id'],'interface':util[_0xaa1c('0x67')]('%s/%s','SIP',_0x4a9d38['name']),'penalty':0x0,'paused':_0x4a9d38[_0xaa1c('0x68')],'createdAt':_0x4a9d38[_0xaa1c('0x69')],'updatedAt':_0x4a9d38[_0xaa1c('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa1c('0x23')](respondWithFilteredResult(_0x230b2d,_0x404d93))[_0xaa1c('0x2b')](handleError(_0x230b2d,null));};exports[_0xaa1c('0x6a')]=function(_0x509ea1,_0x9609f0,_0x8b032d){var _0x23a6d0={};var _0x10e498={};var _0x5806fd;var _0x69b07f;return db[_0xaa1c('0x3f')][_0xaa1c('0x61')]({'where':{'id':_0x509ea1[_0xaa1c('0x5e')]['id']}})[_0xaa1c('0x23')](handleEntityNotFound(_0x9609f0,null))['then'](function(_0x415d19){if(_0x415d19){_0x5806fd=_0x415d19;_0x10e498[_0xaa1c('0x43')]=_['keys'](db[_0xaa1c('0x6b')][_0xaa1c('0x40')]);_0x10e498[_0xaa1c('0x47')]=_['keys'](_0x509ea1['query']);_0x10e498[_0xaa1c('0x45')]=_['intersection'](_0x10e498[_0xaa1c('0x43')],_0x10e498['query']);_0x23a6d0[_0xaa1c('0x48')]=_[_0xaa1c('0x46')](_0x10e498[_0xaa1c('0x43')],qs['fields'](_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x49')]));_0x23a6d0[_0xaa1c('0x48')]=_0x23a6d0[_0xaa1c('0x48')][_0xaa1c('0x4a')]?_0x23a6d0[_0xaa1c('0x48')]:_0x10e498[_0xaa1c('0x43')];_0x23a6d0['order']=qs['sort'](_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x63')]);_0x23a6d0['where']=qs['filters'](_[_0xaa1c('0x4f')](_0x509ea1['query'],_0x10e498[_0xaa1c('0x45')]));if(_0x509ea1['query'][_0xaa1c('0x51')]){_0x23a6d0[_0xaa1c('0x4e')]=_[_0xaa1c('0x64')](_0x23a6d0[_0xaa1c('0x4e')],{'$or':_[_0xaa1c('0x3e')](_0x23a6d0[_0xaa1c('0x48')],function(_0x229449){var _0x54bab1={};_0x54bab1[_0x229449]={'$like':'%'+_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x51')]+'%'};return _0x54bab1;})});}_0x23a6d0=_['merge']({},_0x23a6d0,_0x509ea1[_0xaa1c('0x52')]);return _0x5806fd[_0xaa1c('0x6a')](_0x23a6d0);}})['then'](function(_0x1f927e){if(_0x1f927e){_0x69b07f=_0x1f927e[_0xaa1c('0x4a')];if(!_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x4b')]('nolimit')){_0x23a6d0[_0xaa1c('0x31')]=qs[_0xaa1c('0x31')](_0x509ea1[_0xaa1c('0x47')]['limit']);_0x23a6d0[_0xaa1c('0x30')]=qs[_0xaa1c('0x30')](_0x509ea1[_0xaa1c('0x47')][_0xaa1c('0x30')]);}return _0x5806fd[_0xaa1c('0x6a')](_0x23a6d0);}})[_0xaa1c('0x23')](function(_0x974dc6){if(_0x974dc6){return _0x974dc6?{'count':_0x69b07f,'rows':_0x974dc6}:null;}})['then'](respondWithResult(_0x9609f0,null))[_0xaa1c('0x2b')](handleError(_0x9609f0,null));};exports[_0xaa1c('0x6c')]=function(_0x2306b4,_0x466900,_0x3a7ef0){var _0x1d9710=_0x2306b4[_0xaa1c('0x58')][_0xaa1c('0x6d')];return db['Team'][_0xaa1c('0x53')]({'where':{'id':_0x1d9710},'attributes':['id'],'include':[{'model':db[_0xaa1c('0x6e')],'as':_0xaa1c('0x6f'),'attributes':['id',_0xaa1c('0x3b'),_0xaa1c('0x70'),_0xaa1c('0x71'),'interface'],'raw':!![]}]})[_0xaa1c('0x23')](function(_0x384ee3){if(_0x384ee3){var _0x2b6204=_['flatMap'](_0x384ee3,function(_0x5a30a7){var _0x116386=_0x5a30a7['get']({'plain':!![]});return _0x116386['Agents'];});return db[_0xaa1c('0x3f')]['find']({'where':{'id':_0x2306b4['params']['id']}})['then'](function(_0x3e59dc){return db[_0xaa1c('0x72')][_0xaa1c('0x73')](function(_0x1c549e){return _0x3e59dc[_0xaa1c('0x6c')](_0x1d9710,{'transaction':_0x1c549e})[_0xaa1c('0x23')](function(){return BPromise[_0xaa1c('0x74')](_0x2b6204,function(_0x2368b7){return db[_0xaa1c('0x62')]['findOrCreate']({'where':{'UserId':_0x2368b7['id'],'ChatQueueId':_0x2306b4[_0xaa1c('0x5e')]['id']},'transaction':_0x1c549e});});})[_0xaa1c('0x23')](function(){_0x2b6204['forEach'](function(_0x3258a9){socket[_0xaa1c('0x75')](_0xaa1c('0x76'),{'UserId':_0x3258a9['id'],'ChatQueueId':_0x3e59dc['id']});});});});});}})['then'](respondWithStatusCode(_0x466900,null))[_0xaa1c('0x2b')](handleError(_0x466900,null));};exports[_0xaa1c('0x77')]=function(_0x3cf4df,_0x1019a8,_0xc169b2){return db['Team'][_0xaa1c('0x53')]({'where':{'id':_0x3cf4df[_0xaa1c('0x47')][_0xaa1c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xaa1c('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xaa1c('0x23')](handleEntityNotFound(_0x1019a8,null))['then'](function(_0x12e9de){var _0x4fcde9=_[_0xaa1c('0x3e')](_0x12e9de,'id');var _0x416dc2=[];var _0x467c8e=[];var _0x5b27d7=squel[_0xaa1c('0x78')]();_0x5b27d7[_0xaa1c('0x79')](_0xaa1c('0x7a'))[_0xaa1c('0x7b')](_0xaa1c('0x7c'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xaa1c('0x7d'),_0x3cf4df[_0xaa1c('0x5e')]['id']);for(var _0x28e662=0x0;_0x28e662<_0x12e9de['length'];_0x28e662+=0x1){let _0x4bea77=_0x12e9de[_0x28e662];for(var _0x4fd139=0x0;_0x4fd139<_0x4bea77[_0xaa1c('0x6f')][_0xaa1c('0x4a')];_0x4fd139+=0x1){let _0x527001=_0x4bea77[_0xaa1c('0x6f')][_0x4fd139];var _0x474d05=_0x5b27d7['clone']();_0x474d05[_0xaa1c('0x4e')](_0xaa1c('0x7e'),_0x527001['id']);_0x467c8e[_0xaa1c('0x7f')](db[_0xaa1c('0x72')]['query'](_0x474d05['toString'](),{'type':db[_0xaa1c('0x72')][_0xaa1c('0x80')][_0xaa1c('0x81')]})[_0xaa1c('0x23')](function(_0x1e5398){if(_0x1e5398[_0xaa1c('0x4a')]===0x1){return _0x527001['id'];}else{var _0x45d09f=_[_0xaa1c('0x82')](_[_0xaa1c('0x3e')](_0x1e5398,'TeamId'),function(_0x43b1b3){return _[_0xaa1c('0x83')](_0x4fcde9,_0x43b1b3);});if(_0x45d09f){return _0x527001['id'];}}}));}}return BPromise[_0xaa1c('0x84')](_0x467c8e)[_0xaa1c('0x23')](function(_0x18b926){_0x416dc2=_(_0x416dc2)[_0xaa1c('0x85')](_0x18b926)['compact']()[_0xaa1c('0x86')]();return db[_0xaa1c('0x3f')][_0xaa1c('0x56')]({'where':{'id':_0x3cf4df['params']['id']}})[_0xaa1c('0x23')](function(_0x5cdb5b){return db['sequelize']['transaction'](function(_0x40856e){return _0x5cdb5b[_0xaa1c('0x77')](_0x3cf4df[_0xaa1c('0x47')][_0xaa1c('0x6d')],{'transaction':_0x40856e})['then'](function(){if(!_[_0xaa1c('0x87')](_0x416dc2)){return _0x5cdb5b[_0xaa1c('0x88')](_0x416dc2,{'transaction':_0x40856e});}})['then'](function(){_0x416dc2[_0xaa1c('0x89')](function(_0x4315e2){socket[_0xaa1c('0x75')](_0xaa1c('0x8a'),{'UserId':_0x4315e2,'ChatQueueId':_0x5cdb5b['id']});});});});});});})[_0xaa1c('0x23')](respondWithStatusCode(_0x1019a8,null))[_0xaa1c('0x2b')](handleError(_0x1019a8,null));};exports[_0xaa1c('0x8b')]=function(_0x25cec0,_0x133bc6,_0x1c0951){return db[_0xaa1c('0x3f')][_0xaa1c('0x56')]({'where':{'id':_0x25cec0[_0xaa1c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x133bc6,null))['then'](function(_0xc441e1){if(_0xc441e1){return _0xc441e1[_0xaa1c('0x8b')](_0x25cec0['body'][_0xaa1c('0x6d')],_[_0xaa1c('0x8c')](_0x25cec0[_0xaa1c('0x58')],[_0xaa1c('0x6d'),'id'])||{})[_0xaa1c('0x8d')](function(_0xb1c716){for(var _0x3caf65=0x0;_0x3caf65<_0x25cec0['body'][_0xaa1c('0x6d')][_0xaa1c('0x4a')];_0x3caf65+=0x1){socket[_0xaa1c('0x75')]('userChatQueue:save',{'UserId':_0x25cec0[_0xaa1c('0x58')][_0xaa1c('0x6d')][_0x3caf65],'ChatQueueId':_0x25cec0[_0xaa1c('0x5e')]['id']});}return _0xb1c716;});}})[_0xaa1c('0x23')](respondWithResult(_0x133bc6,null))['catch'](handleError(_0x133bc6,null));};exports['removeAgents']=function(_0xe91fda,_0x192f92,_0x359fd2){return db[_0xaa1c('0x3f')]['find']({'where':{'id':_0xe91fda['params']['id']}})['then'](handleEntityNotFound(_0x192f92,null))[_0xaa1c('0x23')](function(_0x4ab6cb){if(_0x4ab6cb){return _0x4ab6cb[_0xaa1c('0x88')](_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')])['then'](function(){if(_['isArray'](_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')])){for(var _0x88d667=0x0;_0x88d667<_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')][_0xaa1c('0x4a')];_0x88d667+=0x1){socket[_0xaa1c('0x75')]('userChatQueue:remove',{'UserId':Number(_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')][_0x88d667]),'ChatQueueId':Number(_0xe91fda[_0xaa1c('0x5e')]['id'])});}}else{socket[_0xaa1c('0x75')](_0xaa1c('0x8a'),{'UserId':Number(_0xe91fda[_0xaa1c('0x47')][_0xaa1c('0x6d')]),'ChatQueueId':Number(_0xe91fda[_0xaa1c('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x192f92,null))['catch'](handleError(_0x192f92,null));};exports['getAgents']=function(_0x211517,_0x51c5fd,_0x5f0471){var _0x3f6c47={};var _0x2ff664={};var _0x21eab8;var _0x3b76f;return db[_0xaa1c('0x3f')][_0xaa1c('0x61')]({'where':{'id':_0x211517['params']['id']}})[_0xaa1c('0x23')](handleEntityNotFound(_0x51c5fd,null))[_0xaa1c('0x23')](function(_0x5c3c01){if(_0x5c3c01){_0x21eab8=_0x5c3c01;_0x2ff664[_0xaa1c('0x43')]=_[_0xaa1c('0x44')](db[_0xaa1c('0x6e')][_0xaa1c('0x40')]);_0x2ff664[_0xaa1c('0x47')]=_[_0xaa1c('0x44')](_0x211517[_0xaa1c('0x47')]);_0x2ff664[_0xaa1c('0x45')]=_[_0xaa1c('0x46')](_0x2ff664[_0xaa1c('0x43')],_0x2ff664['query']);_0x3f6c47['attributes']=_['intersection'](_0x2ff664['model'],qs['fields'](_0x211517[_0xaa1c('0x47')][_0xaa1c('0x49')]));_0x3f6c47[_0xaa1c('0x48')]=_0x3f6c47[_0xaa1c('0x48')][_0xaa1c('0x4a')]?_0x3f6c47[_0xaa1c('0x48')]:_0x2ff664[_0xaa1c('0x43')];_0x3f6c47['order']=qs[_0xaa1c('0x63')](_0x211517[_0xaa1c('0x47')]['sort']);_0x3f6c47[_0xaa1c('0x4e')]=qs[_0xaa1c('0x45')](_['pick'](_0x211517[_0xaa1c('0x47')],_0x2ff664[_0xaa1c('0x45')]));if(_0x211517[_0xaa1c('0x47')][_0xaa1c('0x51')]){_0x3f6c47['where']=_[_0xaa1c('0x64')](_0x3f6c47[_0xaa1c('0x4e')],{'$or':_[_0xaa1c('0x3e')](_0x3f6c47[_0xaa1c('0x48')],function(_0x52da24){var _0x8a140e={};_0x8a140e[_0x52da24]={'$like':'%'+_0x211517[_0xaa1c('0x47')]['filter']+'%'};return _0x8a140e;})});}_0x3f6c47=_[_0xaa1c('0x64')]({},_0x3f6c47,_0x211517[_0xaa1c('0x52')]);return _0x21eab8[_0xaa1c('0x8e')](_0x3f6c47);}})[_0xaa1c('0x23')](function(_0xddd6d7){if(_0xddd6d7){_0x3b76f=_0xddd6d7['length'];if(!_0x211517[_0xaa1c('0x47')][_0xaa1c('0x4b')](_0xaa1c('0x4c'))){_0x3f6c47['limit']=qs[_0xaa1c('0x31')](_0x211517[_0xaa1c('0x47')]['limit']);_0x3f6c47[_0xaa1c('0x30')]=qs['offset'](_0x211517[_0xaa1c('0x47')][_0xaa1c('0x30')]);}return _0x21eab8[_0xaa1c('0x8e')](_0x3f6c47);}})[_0xaa1c('0x23')](function(_0x45f074){if(_0x45f074){return _0x45f074?{'count':_0x3b76f,'rows':_0x45f074}:null;}})[_0xaa1c('0x23')](respondWithResult(_0x51c5fd,null))[_0xaa1c('0x2b')](handleError(_0x51c5fd,null));}; \ No newline at end of file +var _0x9487=['getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','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','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','ChatQueues','destroy','stack','index','ChatQueue','rawAttributes','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','include','rows','show','params','keys','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','pick','findAll','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','Team','getTeams','ids','User','Agents','online','voicePause','flatMap','transaction','addTeams','each','UserChatQueue','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','all','union','compact','sequelize','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x9487,0x1bd));var _0x7948=function(_0x44d89e,_0x26dcdb){_0x44d89e=_0x44d89e-0x0;var _0x234ce4=_0x9487[_0x44d89e];return _0x234ce4;};'use strict';var pdf=require(_0x7948('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7948('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7948('0x2'));var rp=require(_0x7948('0x3'));var moment=require(_0x7948('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7948('0x5'));var util=require(_0x7948('0x6'));var path=require(_0x7948('0x7'));var sox=require(_0x7948('0x8'));var csv=require(_0x7948('0x9'));var ejs=require(_0x7948('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7948('0xb'));var crypto=require(_0x7948('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7948('0xd'));var toCsv=require(_0x7948('0x9'));var querystring=require('querystring');var Papa=require(_0x7948('0xe'));var Redis=require(_0x7948('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7948('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7948('0x11'));var logger=require(_0x7948('0x12'))('api');var utils=require(_0x7948('0x13'));var config=require('../../config/environment');var db=require(_0x7948('0x14'))['db'];config['redis']=_[_0x7948('0x15')](config[_0x7948('0x16')],{'host':_0x7948('0x17'),'port':0x18eb});var socket=require(_0x7948('0x18'))(new Redis(config[_0x7948('0x16')]));require('./chatQueue.socket')[_0x7948('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7948('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x181ca1,_0x31a57c,_0x32de42){if(_0x32de42){var _0x5907b4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5907b4[_0x7948('0x1b')](_0x31a57c)){return _0x181ca1;}else{throw new db['Sequelize'][(_0x7948('0x1c'))](_0x7948('0x1d'));}}else{return _0x181ca1;}}function respondWithRpcPromise(_0x3287e4,_0xe21f5a,_0x33a3ea,_0x282c5e){return new BPromise(function(_0x1d1dc2,_0x367e18){var _0x5a6b56=_0x282c5e||client;return _0x5a6b56[_0x7948('0x1e')](_0x3287e4,_0x33a3ea)[_0x7948('0x1f')](function(_0xb5a131){logger[_0x7948('0x20')](_0x7948('0x21'),_0xe21f5a,'request\x20sent');logger[_0x7948('0x22')](_0x7948('0x23'),_0xe21f5a,'request\x20sent',JSON[_0x7948('0x24')](_0xb5a131));if(_0xb5a131[_0x7948('0x25')]){if(_0xb5a131[_0x7948('0x25')][_0x7948('0x26')]===0x1f4){logger[_0x7948('0x25')](_0x7948('0x21'),_0xe21f5a,_0xb5a131['error'][_0x7948('0x27')]);return _0x367e18(_0xb5a131['error'][_0x7948('0x27')]);}logger[_0x7948('0x25')](_0x7948('0x21'),_0xe21f5a,_0xb5a131['error']['message']);return _0x1d1dc2(_0xb5a131[_0x7948('0x25')]['message']);}else{logger[_0x7948('0x20')]('ChatQueue,\x20%s,\x20%s',_0xe21f5a,_0x7948('0x28'));_0x1d1dc2(_0xb5a131[_0x7948('0x29')]['message']);}})[_0x7948('0x2a')](function(_0x4b48c6){logger[_0x7948('0x25')](_0x7948('0x21'),_0xe21f5a,_0x4b48c6);_0x367e18(_0x4b48c6);});});}function respondWithStatusCode(_0x4ef806,_0x2b4c20){_0x2b4c20=_0x2b4c20||0xcc;return function(_0x4a99de){if(_0x4a99de){return _0x4ef806[_0x7948('0x2b')](_0x2b4c20);}return _0x4ef806[_0x7948('0x2c')](_0x2b4c20)[_0x7948('0x2d')]();};}function respondWithResult(_0x1a3945,_0x5ba8e1){_0x5ba8e1=_0x5ba8e1||0xc8;return function(_0x990f07){if(_0x990f07){return _0x1a3945['status'](_0x5ba8e1)[_0x7948('0x2e')](_0x990f07);}};}function respondWithFilteredResult(_0xa31d36,_0x81155f){return function(_0x523377){if(_0x523377){var _0x3d5c53=_0x523377[_0x7948('0x2f')],_0x5c53d9=_0x81155f[_0x7948('0x30')],_0x21fd6b=_0x81155f[_0x7948('0x30')]+_0x81155f[_0x7948('0x31')],_0x179472;if(_0x21fd6b>=_0x3d5c53){_0x21fd6b=_0x3d5c53;_0x179472=0xc8;}else{_0x179472=0xce;}_0xa31d36[_0x7948('0x2c')](_0x179472);return _0xa31d36[_0x7948('0x32')](_0x7948('0x33'),_0x5c53d9+'-'+_0x21fd6b+'/'+_0x3d5c53)['json'](_0x523377);}return null;};}function patchUpdates(_0x40748a){return function(_0x5c89ad){try{jsonpatch[_0x7948('0x34')](_0x5c89ad,_0x40748a,!![]);}catch(_0x65f009){return BPromise[_0x7948('0x35')](_0x65f009);}return _0x5c89ad[_0x7948('0x36')]();};}function saveUpdates(_0x2e03ab,_0x2b96e5){return function(_0x259e17){if(_0x259e17){return _0x259e17[_0x7948('0x37')](_0x2e03ab)[_0x7948('0x1f')](function(_0x2d56fc){return _0x2d56fc;});}return null;};}function removeEntity(_0x5efdca,_0x411c26){return function(_0x1de33b){if(_0x1de33b){return _0x1de33b['destroy']()['then'](function(){var _0x4efe24=_0x1de33b[_0x7948('0x38')]({'plain':!![]});var _0x33ab6=_0x7948('0x39');return db['UserProfileResource'][_0x7948('0x3a')]({'where':{'type':_0x33ab6,'resourceId':_0x4efe24['id']}})[_0x7948('0x1f')](function(){return _0x1de33b;});})[_0x7948('0x1f')](function(){_0x5efdca[_0x7948('0x2c')](0xcc)[_0x7948('0x2d')]();});}};}function handleEntityNotFound(_0xc5b1e6,_0x5de339){return function(_0x53b696){if(!_0x53b696){_0xc5b1e6[_0x7948('0x2b')](0x194);}return _0x53b696;};}function handleError(_0x40884e,_0x4d1ad2){_0x4d1ad2=_0x4d1ad2||0x1f4;return function(_0x168507){logger[_0x7948('0x25')](_0x168507[_0x7948('0x3b')]);if(_0x168507['name']){delete _0x168507['name'];}_0x40884e[_0x7948('0x2c')](_0x4d1ad2)['send'](_0x168507);};}exports[_0x7948('0x3c')]=function(_0x3af957,_0x249408){var _0x48fb2a={},_0x310385={},_0x364f2e={'count':0x0,'rows':[]};var _0x18fca1=_['map'](db[_0x7948('0x3d')][_0x7948('0x3e')],function(_0x22f6d7){return{'name':_0x22f6d7['fieldName'],'type':_0x22f6d7[_0x7948('0x3f')][_0x7948('0x40')]};});_0x310385[_0x7948('0x41')]=_['map'](_0x18fca1,_0x7948('0x42'));_0x310385['query']=_['keys'](_0x3af957[_0x7948('0x43')]);_0x310385['filters']=_['intersection'](_0x310385[_0x7948('0x41')],_0x310385[_0x7948('0x43')]);_0x48fb2a['attributes']=_[_0x7948('0x44')](_0x310385[_0x7948('0x41')],qs[_0x7948('0x45')](_0x3af957[_0x7948('0x43')][_0x7948('0x45')]));_0x48fb2a[_0x7948('0x46')]=_0x48fb2a['attributes'][_0x7948('0x47')]?_0x48fb2a['attributes']:_0x310385[_0x7948('0x41')];if(!_0x3af957[_0x7948('0x43')][_0x7948('0x48')](_0x7948('0x49'))){_0x48fb2a['limit']=qs[_0x7948('0x31')](_0x3af957[_0x7948('0x43')][_0x7948('0x31')]);_0x48fb2a[_0x7948('0x30')]=qs[_0x7948('0x30')](_0x3af957[_0x7948('0x43')][_0x7948('0x30')]);}_0x48fb2a[_0x7948('0x4a')]=qs[_0x7948('0x4b')](_0x3af957[_0x7948('0x43')]['sort']);_0x48fb2a[_0x7948('0x4c')]=qs[_0x7948('0x4d')](_['pick'](_0x3af957[_0x7948('0x43')],_0x310385[_0x7948('0x4d')]),_0x18fca1);if(_0x3af957[_0x7948('0x43')][_0x7948('0x4e')]){_0x48fb2a['where']=_[_0x7948('0x4f')](_0x48fb2a[_0x7948('0x4c')],{'$or':_[_0x7948('0x50')](_0x18fca1,function(_0x3b29d1){if(_0x3b29d1[_0x7948('0x3f')]!==_0x7948('0x51')){var _0x1ec990={};_0x1ec990[_0x3b29d1[_0x7948('0x42')]]={'$like':'%'+_0x3af957[_0x7948('0x43')]['filter']+'%'};return _0x1ec990;}})});}_0x48fb2a=_[_0x7948('0x4f')]({},_0x48fb2a,_0x3af957[_0x7948('0x52')]);var _0x34d54c={'where':_0x48fb2a[_0x7948('0x4c')]};return db[_0x7948('0x3d')]['count'](_0x34d54c)['then'](function(_0x5c4c58){_0x364f2e['count']=_0x5c4c58;if(_0x3af957[_0x7948('0x43')]['includeAll']){_0x48fb2a[_0x7948('0x53')]=[{'all':!![]}];}return db[_0x7948('0x3d')]['findAll'](_0x48fb2a);})[_0x7948('0x1f')](function(_0x244d6e){_0x364f2e[_0x7948('0x54')]=_0x244d6e;return _0x364f2e;})['then'](respondWithFilteredResult(_0x249408,_0x48fb2a))['catch'](handleError(_0x249408,null));};exports[_0x7948('0x55')]=function(_0x5bb1be,_0x3e5230){var _0x3e9c36={'raw':!![],'where':{'id':_0x5bb1be[_0x7948('0x56')]['id']}},_0x5bc5f1={};_0x5bc5f1['model']=_[_0x7948('0x57')](db[_0x7948('0x3d')][_0x7948('0x3e')]);_0x5bc5f1[_0x7948('0x43')]=_[_0x7948('0x57')](_0x5bb1be[_0x7948('0x43')]);_0x5bc5f1['filters']=_[_0x7948('0x44')](_0x5bc5f1['model'],_0x5bc5f1[_0x7948('0x43')]);_0x3e9c36[_0x7948('0x46')]=_[_0x7948('0x44')](_0x5bc5f1['model'],qs[_0x7948('0x45')](_0x5bb1be[_0x7948('0x43')][_0x7948('0x45')]));_0x3e9c36['attributes']=_0x3e9c36[_0x7948('0x46')][_0x7948('0x47')]?_0x3e9c36['attributes']:_0x5bc5f1[_0x7948('0x41')];if(_0x5bb1be['query']['includeAll']){_0x3e9c36[_0x7948('0x53')]=[{'all':!![]}];}_0x3e9c36=_[_0x7948('0x4f')]({},_0x3e9c36,_0x5bb1be[_0x7948('0x52')]);return db[_0x7948('0x3d')][_0x7948('0x58')](_0x3e9c36)[_0x7948('0x1f')](handleEntityNotFound(_0x3e5230,null))[_0x7948('0x1f')](respondWithResult(_0x3e5230,null))[_0x7948('0x2a')](handleError(_0x3e5230,null));};exports[_0x7948('0x59')]=function(_0x2b9e4e,_0x3927b6){return db[_0x7948('0x3d')][_0x7948('0x59')](_0x2b9e4e[_0x7948('0x5a')],{})['then'](function(_0x34419f){var _0x1ed47f=_0x2b9e4e[_0x7948('0x5b')]['get']({'plain':!![]});if(!_0x1ed47f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ed47f[_0x7948('0x5c')]==='user'){var _0x1f3b3f=_0x34419f[_0x7948('0x38')]({'plain':!![]});var _0x67bbed=_0x7948('0x39');return db['UserProfileSection'][_0x7948('0x58')]({'where':{'name':_0x67bbed,'userProfileId':_0x1ed47f[_0x7948('0x5d')]},'raw':!![]})['then'](function(_0x332c5d){if(_0x332c5d&&_0x332c5d[_0x7948('0x5e')]===0x0){return db[_0x7948('0x5f')][_0x7948('0x59')]({'name':_0x1f3b3f[_0x7948('0x42')],'resourceId':_0x1f3b3f['id'],'type':_0x332c5d[_0x7948('0x42')],'sectionId':_0x332c5d['id']},{})[_0x7948('0x1f')](function(){return _0x34419f;});}else{return _0x34419f;}})['catch'](function(_0x3b7fdf){logger[_0x7948('0x25')](_0x7948('0x60'),_0x3b7fdf);throw _0x3b7fdf;});}return _0x34419f;})['then'](respondWithResult(_0x3927b6,0xc9))['catch'](handleError(_0x3927b6,null));};exports[_0x7948('0x37')]=function(_0x36faf5,_0x37eaa7){if(_0x36faf5[_0x7948('0x5a')]['id']){delete _0x36faf5[_0x7948('0x5a')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x36faf5[_0x7948('0x56')]['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x37eaa7,null))[_0x7948('0x1f')](saveUpdates(_0x36faf5[_0x7948('0x5a')],null))[_0x7948('0x1f')](respondWithResult(_0x37eaa7,null))[_0x7948('0x2a')](handleError(_0x37eaa7,null));};exports[_0x7948('0x3a')]=function(_0x576680,_0x267e6e){return db['ChatQueue'][_0x7948('0x58')]({'where':{'id':_0x576680['params']['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x267e6e,null))[_0x7948('0x1f')](removeEntity(_0x267e6e,null))['catch'](handleError(_0x267e6e,null));};exports[_0x7948('0x61')]=function(_0x59eb84,_0xea7d25){return db[_0x7948('0x3d')][_0x7948('0x61')]()[_0x7948('0x1f')](respondWithResult(_0xea7d25,null))[_0x7948('0x2a')](handleError(_0xea7d25,null));};exports['getMembers']=function(_0xaab1a0,_0x4b2d7d,_0x421103){var _0x47280b={'raw':!![],'where':{}},_0xe05a36={},_0x5b05ce;return db['ChatQueue'][_0x7948('0x62')]({'where':{'id':_0xaab1a0[_0x7948('0x56')]['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x4b2d7d,null))[_0x7948('0x1f')](function(_0x52f4e0){if(_0x52f4e0){_0x5b05ce=_0x52f4e0[_0x7948('0x38')]({'plain':!![]});_0xe05a36[_0x7948('0x41')]=_[_0x7948('0x57')](db['UserChatQueue'][_0x7948('0x3e')]);_0xe05a36[_0x7948('0x43')]=_[_0x7948('0x57')](_0xaab1a0[_0x7948('0x43')]);_0xe05a36[_0x7948('0x4d')]=_[_0x7948('0x44')](_0xe05a36[_0x7948('0x41')],_0xe05a36['query']);_0x47280b[_0x7948('0x46')]=_['intersection'](_0xe05a36[_0x7948('0x41')],qs[_0x7948('0x45')](_0xaab1a0[_0x7948('0x43')]['fields']));_0x47280b[_0x7948('0x46')]=_0x47280b['attributes'][_0x7948('0x47')]?_0x47280b[_0x7948('0x46')]:_0xe05a36[_0x7948('0x41')];if(!_0xaab1a0['query'][_0x7948('0x48')]('nolimit')){_0x47280b[_0x7948('0x31')]=qs[_0x7948('0x31')](_0xaab1a0[_0x7948('0x43')][_0x7948('0x31')]);_0x47280b[_0x7948('0x30')]=qs[_0x7948('0x30')](_0xaab1a0[_0x7948('0x43')][_0x7948('0x30')]);}_0x47280b[_0x7948('0x4a')]=qs[_0x7948('0x4b')](_0xaab1a0['query'][_0x7948('0x4b')]);_0x47280b[_0x7948('0x4c')]=qs[_0x7948('0x4d')](_[_0x7948('0x63')](_0xaab1a0['query'],_0xe05a36[_0x7948('0x4d')]));_0x47280b[_0x7948('0x4c')]['ChatQueueId']=_0x52f4e0['id'];if(_0xaab1a0['query'][_0x7948('0x4e')]){_0x47280b[_0x7948('0x4c')]=_[_0x7948('0x4f')](_0x47280b[_0x7948('0x4c')],{'$or':_[_0x7948('0x50')](_0x47280b[_0x7948('0x46')],function(_0x2daff8){var _0x1a253f={};_0x1a253f[_0x2daff8]={'$like':'%'+_0xaab1a0[_0x7948('0x43')][_0x7948('0x4e')]+'%'};return _0x1a253f;})});}_0x47280b=_[_0x7948('0x4f')]({},_0x47280b,_0xaab1a0['options']);return db['UserChatQueue'][_0x7948('0x64')](_0x47280b);}})[_0x7948('0x1f')](function(_0x262e1d){if(_0x262e1d){return db['User'][_0x7948('0x65')]({'where':{'id':_[_0x7948('0x50')](_0x262e1d,'UserId'),'role':_0x7948('0x66')},'attributes':['id',_0x7948('0x42'),_0x7948('0x67'),_0x7948('0x68'),_0x7948('0x69')]});}})['then'](function(_0x4135ab){if(_0x4135ab){return{'count':_0x4135ab[_0x7948('0x2f')],'rows':_[_0x7948('0x50')](_0x4135ab[_0x7948('0x54')],function(_0x280a0c){return{'membername':_0x280a0c[_0x7948('0x42')],'UserId':_0x280a0c['id'],'queue_name':_0x5b05ce['name'],'ChatQueueId':_0x5b05ce['id'],'interface':util[_0x7948('0x6a')]('%s/%s','SIP',_0x280a0c['name']),'penalty':0x0,'paused':_0x280a0c[_0x7948('0x67')],'createdAt':_0x280a0c['createdAt'],'updatedAt':_0x280a0c[_0x7948('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4b2d7d,_0x47280b))[_0x7948('0x2a')](handleError(_0x4b2d7d,null));};exports['getTeams']=function(_0x3b0af3,_0x1c2796,_0x293b6a){var _0x442e8e={};var _0x624e62={};var _0x3f8a49;var _0x1575db;return db[_0x7948('0x3d')][_0x7948('0x62')]({'where':{'id':_0x3b0af3[_0x7948('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c2796,null))[_0x7948('0x1f')](function(_0x2269ac){if(_0x2269ac){_0x3f8a49=_0x2269ac;_0x624e62[_0x7948('0x41')]=_[_0x7948('0x57')](db[_0x7948('0x6b')][_0x7948('0x3e')]);_0x624e62[_0x7948('0x43')]=_['keys'](_0x3b0af3[_0x7948('0x43')]);_0x624e62[_0x7948('0x4d')]=_[_0x7948('0x44')](_0x624e62[_0x7948('0x41')],_0x624e62[_0x7948('0x43')]);_0x442e8e[_0x7948('0x46')]=_[_0x7948('0x44')](_0x624e62[_0x7948('0x41')],qs['fields'](_0x3b0af3[_0x7948('0x43')][_0x7948('0x45')]));_0x442e8e['attributes']=_0x442e8e[_0x7948('0x46')][_0x7948('0x47')]?_0x442e8e['attributes']:_0x624e62['model'];_0x442e8e[_0x7948('0x4a')]=qs[_0x7948('0x4b')](_0x3b0af3['query'][_0x7948('0x4b')]);_0x442e8e[_0x7948('0x4c')]=qs[_0x7948('0x4d')](_[_0x7948('0x63')](_0x3b0af3[_0x7948('0x43')],_0x624e62[_0x7948('0x4d')]));if(_0x3b0af3['query'][_0x7948('0x4e')]){_0x442e8e[_0x7948('0x4c')]=_[_0x7948('0x4f')](_0x442e8e['where'],{'$or':_['map'](_0x442e8e[_0x7948('0x46')],function(_0x2828c1){var _0x1e9d1f={};_0x1e9d1f[_0x2828c1]={'$like':'%'+_0x3b0af3[_0x7948('0x43')][_0x7948('0x4e')]+'%'};return _0x1e9d1f;})});}_0x442e8e=_[_0x7948('0x4f')]({},_0x442e8e,_0x3b0af3[_0x7948('0x52')]);return _0x3f8a49[_0x7948('0x6c')](_0x442e8e);}})['then'](function(_0x4629f4){if(_0x4629f4){_0x1575db=_0x4629f4['length'];if(!_0x3b0af3[_0x7948('0x43')][_0x7948('0x48')](_0x7948('0x49'))){_0x442e8e['limit']=qs['limit'](_0x3b0af3[_0x7948('0x43')][_0x7948('0x31')]);_0x442e8e[_0x7948('0x30')]=qs[_0x7948('0x30')](_0x3b0af3[_0x7948('0x43')][_0x7948('0x30')]);}return _0x3f8a49['getTeams'](_0x442e8e);}})['then'](function(_0x83e940){if(_0x83e940){return _0x83e940?{'count':_0x1575db,'rows':_0x83e940}:null;}})[_0x7948('0x1f')](respondWithResult(_0x1c2796,null))[_0x7948('0x2a')](handleError(_0x1c2796,null));};exports['addTeams']=function(_0x4ad5d5,_0x3dc1e6,_0x40892c){var _0x3187de=_0x4ad5d5[_0x7948('0x5a')][_0x7948('0x6d')];return db[_0x7948('0x6b')][_0x7948('0x64')]({'where':{'id':_0x3187de},'attributes':['id'],'include':[{'model':db[_0x7948('0x6e')],'as':_0x7948('0x6f'),'attributes':['id','name',_0x7948('0x70'),_0x7948('0x71'),'interface'],'raw':!![]}]})[_0x7948('0x1f')](function(_0x126089){if(_0x126089){var _0x293a66=_[_0x7948('0x72')](_0x126089,function(_0x5c02ca){var _0x596828=_0x5c02ca['get']({'plain':!![]});return _0x596828[_0x7948('0x6f')];});return db[_0x7948('0x3d')][_0x7948('0x58')]({'where':{'id':_0x4ad5d5[_0x7948('0x56')]['id']}})[_0x7948('0x1f')](function(_0x1fa22f){return db['sequelize'][_0x7948('0x73')](function(_0x47f1ee){return _0x1fa22f[_0x7948('0x74')](_0x3187de,{'transaction':_0x47f1ee})[_0x7948('0x1f')](function(){return BPromise[_0x7948('0x75')](_0x293a66,function(_0xc76cd1){return db[_0x7948('0x76')][_0x7948('0x77')]({'where':{'UserId':_0xc76cd1['id'],'ChatQueueId':_0x4ad5d5[_0x7948('0x56')]['id']},'transaction':_0x47f1ee});});})['then'](function(){_0x293a66[_0x7948('0x78')](function(_0x3086af){socket[_0x7948('0x79')]('userChatQueue:save',{'UserId':_0x3086af['id'],'ChatQueueId':_0x1fa22f['id']});});});});});}})[_0x7948('0x1f')](respondWithStatusCode(_0x3dc1e6,null))[_0x7948('0x2a')](handleError(_0x3dc1e6,null));};exports[_0x7948('0x7a')]=function(_0x5cfd89,_0x3f4ff2,_0x3b0ed4){return db['Team'][_0x7948('0x64')]({'where':{'id':_0x5cfd89[_0x7948('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7948('0x6e')],'as':_0x7948('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x7948('0x1f')](handleEntityNotFound(_0x3f4ff2,null))['then'](function(_0x28ab13){var _0x484e02=_['map'](_0x28ab13,'id');var _0x43c66d=[];var _0x28fa22=[];var _0x52acdc=squel[_0x7948('0x7b')]();_0x52acdc[_0x7948('0x7c')](_0x7948('0x7d'))[_0x7948('0x7e')]('team_has_chat_queues','tq')[_0x7948('0x7f')](_0x7948('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7948('0x4c')](_0x7948('0x81'),_0x5cfd89[_0x7948('0x56')]['id']);for(var _0x4dac5f=0x0;_0x4dac5f<_0x28ab13[_0x7948('0x47')];_0x4dac5f+=0x1){let _0x537d28=_0x28ab13[_0x4dac5f];for(var _0xd0f61=0x0;_0xd0f61<_0x537d28[_0x7948('0x6f')][_0x7948('0x47')];_0xd0f61+=0x1){let _0x9326c4=_0x537d28[_0x7948('0x6f')][_0xd0f61];var _0x56f57a=_0x52acdc[_0x7948('0x82')]();_0x56f57a['where'](_0x7948('0x83'),_0x9326c4['id']);_0x28fa22[_0x7948('0x84')](db['sequelize']['query'](_0x56f57a[_0x7948('0x85')](),{'type':db['sequelize'][_0x7948('0x86')]['SELECT']})[_0x7948('0x1f')](function(_0x274acc){if(_0x274acc[_0x7948('0x47')]===0x1){return _0x9326c4['id'];}else{var _0x95f107=_['every'](_[_0x7948('0x50')](_0x274acc,'TeamId'),function(_0x57961d){return _[_0x7948('0x87')](_0x484e02,_0x57961d);});if(_0x95f107){return _0x9326c4['id'];}}}));}}return BPromise[_0x7948('0x88')](_0x28fa22)['then'](function(_0x5de866){_0x43c66d=_(_0x43c66d)[_0x7948('0x89')](_0x5de866)[_0x7948('0x8a')]()['value']();return db[_0x7948('0x3d')][_0x7948('0x58')]({'where':{'id':_0x5cfd89['params']['id']}})[_0x7948('0x1f')](function(_0x4a1f5b){return db[_0x7948('0x8b')][_0x7948('0x73')](function(_0x7d6230){return _0x4a1f5b[_0x7948('0x7a')](_0x5cfd89[_0x7948('0x43')]['ids'],{'transaction':_0x7d6230})[_0x7948('0x1f')](function(){if(!_[_0x7948('0x8c')](_0x43c66d)){return _0x4a1f5b[_0x7948('0x8d')](_0x43c66d,{'transaction':_0x7d6230});}})[_0x7948('0x1f')](function(){_0x43c66d[_0x7948('0x78')](function(_0xb64c12){socket[_0x7948('0x79')](_0x7948('0x8e'),{'UserId':_0xb64c12,'ChatQueueId':_0x4a1f5b['id']});});});});});});})[_0x7948('0x1f')](respondWithStatusCode(_0x3f4ff2,null))[_0x7948('0x2a')](handleError(_0x3f4ff2,null));};exports[_0x7948('0x8f')]=function(_0x2bdd16,_0x402cda,_0x1b1a2f){return db[_0x7948('0x3d')][_0x7948('0x58')]({'where':{'id':_0x2bdd16[_0x7948('0x56')]['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x402cda,null))[_0x7948('0x1f')](function(_0x5be970){if(_0x5be970){return _0x5be970[_0x7948('0x8f')](_0x2bdd16[_0x7948('0x5a')][_0x7948('0x6d')],_[_0x7948('0x90')](_0x2bdd16[_0x7948('0x5a')],[_0x7948('0x6d'),'id'])||{})[_0x7948('0x91')](function(_0x28b1c2){for(var _0x1821d0=0x0;_0x1821d0<_0x2bdd16[_0x7948('0x5a')][_0x7948('0x6d')][_0x7948('0x47')];_0x1821d0+=0x1){socket[_0x7948('0x79')]('userChatQueue:save',{'UserId':_0x2bdd16[_0x7948('0x5a')][_0x7948('0x6d')][_0x1821d0],'ChatQueueId':_0x2bdd16[_0x7948('0x56')]['id']});}return _0x28b1c2;});}})[_0x7948('0x1f')](respondWithResult(_0x402cda,null))[_0x7948('0x2a')](handleError(_0x402cda,null));};exports[_0x7948('0x8d')]=function(_0x13f862,_0x40f16b,_0x4fc92e){return db['ChatQueue'][_0x7948('0x58')]({'where':{'id':_0x13f862['params']['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x40f16b,null))[_0x7948('0x1f')](function(_0x1f1bf3){if(_0x1f1bf3){return _0x1f1bf3[_0x7948('0x8d')](_0x13f862[_0x7948('0x43')][_0x7948('0x6d')])[_0x7948('0x1f')](function(){if(_[_0x7948('0x92')](_0x13f862[_0x7948('0x43')][_0x7948('0x6d')])){for(var _0x46fab6=0x0;_0x46fab6<_0x13f862['query'][_0x7948('0x6d')]['length'];_0x46fab6+=0x1){socket[_0x7948('0x79')](_0x7948('0x8e'),{'UserId':Number(_0x13f862[_0x7948('0x43')][_0x7948('0x6d')][_0x46fab6]),'ChatQueueId':Number(_0x13f862[_0x7948('0x56')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x13f862[_0x7948('0x43')][_0x7948('0x6d')]),'ChatQueueId':Number(_0x13f862['params']['id'])});}});}})[_0x7948('0x1f')](respondWithStatusCode(_0x40f16b,null))[_0x7948('0x2a')](handleError(_0x40f16b,null));};exports[_0x7948('0x93')]=function(_0x156508,_0xde5617,_0x22f727){var _0xf63c13={};var _0x4bfcb3={};var _0x11ad23;var _0x927a65;return db[_0x7948('0x3d')][_0x7948('0x62')]({'where':{'id':_0x156508[_0x7948('0x56')]['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0xde5617,null))['then'](function(_0x1eb0a9){if(_0x1eb0a9){_0x11ad23=_0x1eb0a9;_0x4bfcb3[_0x7948('0x41')]=_[_0x7948('0x57')](db[_0x7948('0x6e')][_0x7948('0x3e')]);_0x4bfcb3[_0x7948('0x43')]=_[_0x7948('0x57')](_0x156508[_0x7948('0x43')]);_0x4bfcb3[_0x7948('0x4d')]=_[_0x7948('0x44')](_0x4bfcb3[_0x7948('0x41')],_0x4bfcb3[_0x7948('0x43')]);_0xf63c13['attributes']=_['intersection'](_0x4bfcb3[_0x7948('0x41')],qs[_0x7948('0x45')](_0x156508[_0x7948('0x43')][_0x7948('0x45')]));_0xf63c13['attributes']=_0xf63c13['attributes'][_0x7948('0x47')]?_0xf63c13['attributes']:_0x4bfcb3['model'];_0xf63c13[_0x7948('0x4a')]=qs['sort'](_0x156508[_0x7948('0x43')]['sort']);_0xf63c13[_0x7948('0x4c')]=qs[_0x7948('0x4d')](_[_0x7948('0x63')](_0x156508['query'],_0x4bfcb3[_0x7948('0x4d')]));if(_0x156508[_0x7948('0x43')][_0x7948('0x4e')]){_0xf63c13['where']=_[_0x7948('0x4f')](_0xf63c13[_0x7948('0x4c')],{'$or':_[_0x7948('0x50')](_0xf63c13[_0x7948('0x46')],function(_0x404795){var _0x40487f={};_0x40487f[_0x404795]={'$like':'%'+_0x156508['query'][_0x7948('0x4e')]+'%'};return _0x40487f;})});}_0xf63c13=_[_0x7948('0x4f')]({},_0xf63c13,_0x156508['options']);return _0x11ad23[_0x7948('0x93')](_0xf63c13);}})['then'](function(_0x1c07d6){if(_0x1c07d6){_0x927a65=_0x1c07d6[_0x7948('0x47')];if(!_0x156508[_0x7948('0x43')][_0x7948('0x48')](_0x7948('0x49'))){_0xf63c13['limit']=qs[_0x7948('0x31')](_0x156508['query'][_0x7948('0x31')]);_0xf63c13[_0x7948('0x30')]=qs[_0x7948('0x30')](_0x156508[_0x7948('0x43')][_0x7948('0x30')]);}return _0x11ad23[_0x7948('0x93')](_0xf63c13);}})[_0x7948('0x1f')](function(_0x442224){if(_0x442224){return _0x442224?{'count':_0x927a65,'rows':_0x442224}:null;}})[_0x7948('0x1f')](respondWithResult(_0xde5617,null))[_0x7948('0x2a')](handleError(_0xde5617,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a7de271..37bf59f 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x13cf88,_0x386a66){var _0x272677=function(_0x2b18f7){while(--_0x2b18f7){_0x13cf88['push'](_0x13cf88['shift']());}};_0x272677(++_0x386a66);}(_0x0b0e,0x187));var _0xe0b0=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0x0b0e[_0x446e61];return _0x4160a8;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x272db5,_0xb37c13){var _0x5417a1=function(_0x7f9ec1){while(--_0x7f9ec1){_0x272db5['push'](_0x272db5['shift']());}};_0x5417a1(++_0xb37c13);}(_0x5f2f,0x73));var _0xf5f2=function(_0x461c74,_0x1fd38e){_0x461c74=_0x461c74-0x0;var _0x58442b=_0x5f2f[_0x461c74];return _0x58442b;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 142673f..4871a7c 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 _0xe94e=['../../config/environment','exports','define','ChatQueue','chat_queues','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe94e,0xd6));var _0xee94=function(_0x3c9efe,_0xbaf050){_0x3c9efe=_0x3c9efe-0x0;var _0x5133f6=_0xe94e[_0x3c9efe];return _0x5133f6;};'use strict';var _=require('lodash');var util=require(_0xee94('0x0'));var logger=require(_0xee94('0x1'))('api');var moment=require(_0xee94('0x2'));var BPromise=require('bluebird');var rp=require(_0xee94('0x3'));var fs=require('fs');var path=require(_0xee94('0x4'));var rimraf=require(_0xee94('0x5'));var config=require(_0xee94('0x6'));var attributes=require('./chatQueue.attributes');module[_0xee94('0x7')]=function(_0x71a188,_0x231758){return _0x71a188[_0xee94('0x8')](_0xee94('0x9'),attributes,{'tableName':_0xee94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb77=['bluebird','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','util','../../config/logger','api','moment'];(function(_0x123626,_0x800505){var _0x1cc6c2=function(_0x3257f4){while(--_0x3257f4){_0x123626['push'](_0x123626['shift']());}};_0x1cc6c2(++_0x800505);}(_0xfb77,0x1ca));var _0x7fb7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfb77[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x7fb7('0x0'));var logger=require(_0x7fb7('0x1'))(_0x7fb7('0x2'));var moment=require(_0x7fb7('0x3'));var BPromise=require(_0x7fb7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7fb7('0x5'));var config=require(_0x7fb7('0x6'));var attributes=require(_0x7fb7('0x7'));module[_0x7fb7('0x8')]=function(_0x4252c2,_0x129a2f){return _0x4252c2['define'](_0x7fb7('0x9'),attributes,{'tableName':_0x7fb7('0xa'),'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 076bf47..4c6799c 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 _0xae59=['then','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','map','include','model','attributes','info','debug','stringify','catch','ShowChatQueue','find','where','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0xae59,0x8d));var _0x9ae5=function(_0x1dfbd8,_0x54e99a){_0x1dfbd8=_0x1dfbd8-0x0;var _0x285e63=_0xae59[_0x1dfbd8];return _0x285e63;};'use strict';var _=require(_0x9ae5('0x0'));var util=require('util');var moment=require(_0x9ae5('0x1'));var BPromise=require(_0x9ae5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ae5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ae5('0x4'));var logger=require('../../config/logger')(_0x9ae5('0x5'));var config=require(_0x9ae5('0x6'));var jayson=require(_0x9ae5('0x7'));var client=jayson[_0x9ae5('0x8')][_0x9ae5('0x9')]({'port':0x232a});config[_0x9ae5('0xa')]=_[_0x9ae5('0xb')](config[_0x9ae5('0xa')],{'host':_0x9ae5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x9ae5('0xd')](socket);function respondWithRpcPromise(_0x302d4c,_0x669c38,_0x44626a){return new BPromise(function(_0x2e0557,_0x27684b){return client[_0x9ae5('0xe')](_0x302d4c,_0x44626a)[_0x9ae5('0xf')](function(_0x30a7ca){logger['info'](_0x9ae5('0x10'),_0x669c38,'request\x20sent');logger['debug'](_0x9ae5('0x11'),_0x669c38,_0x9ae5('0x12'),JSON['stringify'](_0x30a7ca));if(_0x30a7ca[_0x9ae5('0x13')]){if(_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x14')]===0x1f4){logger[_0x9ae5('0x13')](_0x9ae5('0x10'),_0x669c38,_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x15')]);return _0x27684b(_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x15')]);}logger[_0x9ae5('0x13')](_0x9ae5('0x10'),_0x669c38,_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x15')]);return _0x2e0557(_0x30a7ca[_0x9ae5('0x13')][_0x9ae5('0x15')]);}else{logger['info'](_0x9ae5('0x10'),_0x669c38,_0x9ae5('0x12'));_0x2e0557(_0x30a7ca[_0x9ae5('0x16')][_0x9ae5('0x15')]);}})['catch'](function(_0x569931){logger[_0x9ae5('0x13')](_0x9ae5('0x10'),_0x669c38,_0x569931);_0x27684b(_0x569931);});});}exports[_0x9ae5('0x17')]=function(_0x483a27){var _0x1c42f2=this;return new Promise(function(_0xc086de,_0x69855d){return db[_0x9ae5('0x18')][_0x9ae5('0x19')]({'raw':_0x483a27['options']?_0x483a27[_0x9ae5('0x1a')][_0x9ae5('0x1b')]===undefined?!![]:![]:!![],'where':_0x483a27[_0x9ae5('0x1a')]?_0x483a27['options']['where']||null:null,'attributes':_0x483a27[_0x9ae5('0x1a')]?_0x483a27[_0x9ae5('0x1a')]['attributes']||null:null,'limit':_0x483a27[_0x9ae5('0x1a')]?_0x483a27['options']['limit']||null:null,'include':_0x483a27['options']?_0x483a27[_0x9ae5('0x1a')]['include']?_[_0x9ae5('0x1c')](_0x483a27[_0x9ae5('0x1a')][_0x9ae5('0x1d')],function(_0x29d330){return{'model':db[_0x29d330[_0x9ae5('0x1e')]],'as':_0x29d330['as'],'attributes':_0x29d330[_0x9ae5('0x1f')],'include':_0x29d330['include']?_['map'](_0x29d330[_0x9ae5('0x1d')],function(_0x276f2b){return{'model':db[_0x276f2b[_0x9ae5('0x1e')]],'as':_0x276f2b['as'],'attributes':_0x276f2b[_0x9ae5('0x1f')],'include':_0x276f2b[_0x9ae5('0x1d')]?_[_0x9ae5('0x1c')](_0x276f2b[_0x9ae5('0x1d')],function(_0x38919f){return{'model':db[_0x38919f[_0x9ae5('0x1e')]],'as':_0x38919f['as'],'attributes':_0x38919f['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ae5('0xf')](function(_0x8fbae0){logger[_0x9ae5('0x20')]('GetChatQueue',_0x483a27);logger[_0x9ae5('0x21')](_0x9ae5('0x17'),_0x483a27,JSON[_0x9ae5('0x22')](_0x8fbae0));_0xc086de(_0x8fbae0);})[_0x9ae5('0x23')](function(_0x3cb0c7){logger[_0x9ae5('0x13')]('GetChatQueue',_0x3cb0c7[_0x9ae5('0x15')],_0x483a27);_0x69855d(_0x1c42f2[_0x9ae5('0x13')](0x1f4,_0x3cb0c7[_0x9ae5('0x15')]));});});};exports[_0x9ae5('0x24')]=function(_0x15f31c){var _0x48389d=this;return new Promise(function(_0x5edb8d,_0x54bd77){return db['ChatQueue'][_0x9ae5('0x25')]({'raw':_0x15f31c['options']?_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x1b')]===undefined?!![]:![]:!![],'where':_0x15f31c[_0x9ae5('0x1a')]?_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x26')]||null:null,'attributes':_0x15f31c[_0x9ae5('0x1a')]?_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x1f')]||null:null,'include':_0x15f31c[_0x9ae5('0x1a')]?_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x1d')]?_['map'](_0x15f31c[_0x9ae5('0x1a')][_0x9ae5('0x1d')],function(_0xd2ee66){return{'model':db[_0xd2ee66['model']],'as':_0xd2ee66['as'],'attributes':_0xd2ee66['attributes'],'include':_0xd2ee66[_0x9ae5('0x1d')]?_[_0x9ae5('0x1c')](_0xd2ee66['include'],function(_0x4983e5){return{'model':db[_0x4983e5['model']],'as':_0x4983e5['as'],'attributes':_0x4983e5[_0x9ae5('0x1f')],'include':_0x4983e5[_0x9ae5('0x1d')]?_[_0x9ae5('0x1c')](_0x4983e5[_0x9ae5('0x1d')],function(_0x3b0725){return{'model':db[_0x3b0725[_0x9ae5('0x1e')]],'as':_0x3b0725['as'],'attributes':_0x3b0725['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ae5('0xf')](function(_0x591889){logger['info'](_0x9ae5('0x24'),_0x15f31c);logger['debug']('ShowChatQueue',_0x15f31c,JSON['stringify'](_0x591889));_0x5edb8d(_0x591889);})[_0x9ae5('0x23')](function(_0x462221){logger['error'](_0x9ae5('0x24'),_0x462221[_0x9ae5('0x15')],_0x15f31c);_0x54bd77(_0x48389d['error'](0x1f4,_0x462221[_0x9ae5('0x15')]));});});}; \ No newline at end of file +var _0xd7a4=['raw','limit','include','map','model','attributes','where','ShowChatQueue','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd7a4,0x7e));var _0x4d7a=function(_0x2f072f,_0x6ffa01){_0x2f072f=_0x2f072f-0x0;var _0x12dd28=_0xd7a4[_0x2f072f];return _0x12dd28;};'use strict';var _=require(_0x4d7a('0x0'));var util=require(_0x4d7a('0x1'));var moment=require('moment');var BPromise=require(_0x4d7a('0x2'));var rs=require(_0x4d7a('0x3'));var fs=require('fs');var Redis=require(_0x4d7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d7a('0x5'));var logger=require('../../config/logger')(_0x4d7a('0x6'));var config=require('../../config/environment');var jayson=require(_0x4d7a('0x7'));var client=jayson[_0x4d7a('0x8')][_0x4d7a('0x9')]({'port':0x232a});config[_0x4d7a('0xa')]=_[_0x4d7a('0xb')](config[_0x4d7a('0xa')],{'host':_0x4d7a('0xc'),'port':0x18eb});var socket=require(_0x4d7a('0xd'))(new Redis(config[_0x4d7a('0xa')]));require('./chatQueue.socket')[_0x4d7a('0xe')](socket);function respondWithRpcPromise(_0x55e6a1,_0xbfdbbf,_0xddb648){return new BPromise(function(_0x5badc5,_0x555c3a){return client['request'](_0x55e6a1,_0xddb648)[_0x4d7a('0xf')](function(_0x1e4684){logger[_0x4d7a('0x10')](_0x4d7a('0x11'),_0xbfdbbf,_0x4d7a('0x12'));logger[_0x4d7a('0x13')](_0x4d7a('0x14'),_0xbfdbbf,_0x4d7a('0x12'),JSON[_0x4d7a('0x15')](_0x1e4684));if(_0x1e4684[_0x4d7a('0x16')]){if(_0x1e4684[_0x4d7a('0x16')][_0x4d7a('0x17')]===0x1f4){logger[_0x4d7a('0x16')](_0x4d7a('0x11'),_0xbfdbbf,_0x1e4684[_0x4d7a('0x16')]['message']);return _0x555c3a(_0x1e4684[_0x4d7a('0x16')][_0x4d7a('0x18')]);}logger[_0x4d7a('0x16')]('ChatQueue,\x20%s,\x20%s',_0xbfdbbf,_0x1e4684[_0x4d7a('0x16')][_0x4d7a('0x18')]);return _0x5badc5(_0x1e4684[_0x4d7a('0x16')][_0x4d7a('0x18')]);}else{logger[_0x4d7a('0x10')](_0x4d7a('0x11'),_0xbfdbbf,_0x4d7a('0x12'));_0x5badc5(_0x1e4684[_0x4d7a('0x19')][_0x4d7a('0x18')]);}})['catch'](function(_0x12275a){logger['error'](_0x4d7a('0x11'),_0xbfdbbf,_0x12275a);_0x555c3a(_0x12275a);});});}exports[_0x4d7a('0x1a')]=function(_0x450f36){var _0x1a9ab8=this;return new Promise(function(_0x49db88,_0x369389){return db[_0x4d7a('0x1b')][_0x4d7a('0x1c')]({'raw':_0x450f36[_0x4d7a('0x1d')]?_0x450f36[_0x4d7a('0x1d')][_0x4d7a('0x1e')]===undefined?!![]:![]:!![],'where':_0x450f36[_0x4d7a('0x1d')]?_0x450f36[_0x4d7a('0x1d')]['where']||null:null,'attributes':_0x450f36[_0x4d7a('0x1d')]?_0x450f36['options']['attributes']||null:null,'limit':_0x450f36[_0x4d7a('0x1d')]?_0x450f36[_0x4d7a('0x1d')][_0x4d7a('0x1f')]||null:null,'include':_0x450f36[_0x4d7a('0x1d')]?_0x450f36[_0x4d7a('0x1d')][_0x4d7a('0x20')]?_[_0x4d7a('0x21')](_0x450f36[_0x4d7a('0x1d')][_0x4d7a('0x20')],function(_0x558813){return{'model':db[_0x558813[_0x4d7a('0x22')]],'as':_0x558813['as'],'attributes':_0x558813[_0x4d7a('0x23')],'include':_0x558813[_0x4d7a('0x20')]?_[_0x4d7a('0x21')](_0x558813[_0x4d7a('0x20')],function(_0x38c381){return{'model':db[_0x38c381[_0x4d7a('0x22')]],'as':_0x38c381['as'],'attributes':_0x38c381[_0x4d7a('0x23')],'include':_0x38c381[_0x4d7a('0x20')]?_[_0x4d7a('0x21')](_0x38c381[_0x4d7a('0x20')],function(_0x4cc274){return{'model':db[_0x4cc274[_0x4d7a('0x22')]],'as':_0x4cc274['as'],'attributes':_0x4cc274[_0x4d7a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x464595){logger[_0x4d7a('0x10')](_0x4d7a('0x1a'),_0x450f36);logger[_0x4d7a('0x13')]('GetChatQueue',_0x450f36,JSON[_0x4d7a('0x15')](_0x464595));_0x49db88(_0x464595);})['catch'](function(_0x4a4ac5){logger['error'](_0x4d7a('0x1a'),_0x4a4ac5[_0x4d7a('0x18')],_0x450f36);_0x369389(_0x1a9ab8['error'](0x1f4,_0x4a4ac5[_0x4d7a('0x18')]));});});};exports['ShowChatQueue']=function(_0xd1eb12){var _0xd2264f=this;return new Promise(function(_0x247dc1,_0x3e4f5f){return db[_0x4d7a('0x1b')]['find']({'raw':_0xd1eb12['options']?_0xd1eb12[_0x4d7a('0x1d')][_0x4d7a('0x1e')]===undefined?!![]:![]:!![],'where':_0xd1eb12[_0x4d7a('0x1d')]?_0xd1eb12[_0x4d7a('0x1d')][_0x4d7a('0x24')]||null:null,'attributes':_0xd1eb12[_0x4d7a('0x1d')]?_0xd1eb12[_0x4d7a('0x1d')]['attributes']||null:null,'include':_0xd1eb12[_0x4d7a('0x1d')]?_0xd1eb12['options'][_0x4d7a('0x20')]?_[_0x4d7a('0x21')](_0xd1eb12[_0x4d7a('0x1d')][_0x4d7a('0x20')],function(_0x144c34){return{'model':db[_0x144c34[_0x4d7a('0x22')]],'as':_0x144c34['as'],'attributes':_0x144c34['attributes'],'include':_0x144c34[_0x4d7a('0x20')]?_[_0x4d7a('0x21')](_0x144c34[_0x4d7a('0x20')],function(_0x54c64c){return{'model':db[_0x54c64c[_0x4d7a('0x22')]],'as':_0x54c64c['as'],'attributes':_0x54c64c[_0x4d7a('0x23')],'include':_0x54c64c[_0x4d7a('0x20')]?_[_0x4d7a('0x21')](_0x54c64c['include'],function(_0x1736cc){return{'model':db[_0x1736cc[_0x4d7a('0x22')]],'as':_0x1736cc['as'],'attributes':_0x1736cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d7a('0xf')](function(_0x46b3dd){logger[_0x4d7a('0x10')](_0x4d7a('0x25'),_0xd1eb12);logger[_0x4d7a('0x13')](_0x4d7a('0x25'),_0xd1eb12,JSON[_0x4d7a('0x15')](_0x46b3dd));_0x247dc1(_0x46b3dd);})[_0x4d7a('0x26')](function(_0x45dc23){logger['error'](_0x4d7a('0x25'),_0x45dc23[_0x4d7a('0x18')],_0xd1eb12);_0x3e4f5f(_0xd2264f[_0x4d7a('0x16')](0x1f4,_0x45dc23[_0x4d7a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 4f740b0..741417c 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x22d53d,_0x339808){var _0x40dd91=function(_0x1ea0a6){while(--_0x1ea0a6){_0x22d53d['push'](_0x22d53d['shift']());}};_0x40dd91(++_0x339808);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17f3c6,_0x8a2702){_0x17f3c6=_0x17f3c6-0x0;var _0x45db94=_0x5f2f[_0x17f3c6];return _0x45db94;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x459963,_0x5a366a){var _0xbe84e3=function(_0x358999){while(--_0x358999){_0x459963['push'](_0x459963['shift']());}};_0xbe84e3(++_0x5a366a);}(_0x5f2f,0x73));var _0xf5f2=function(_0xcf7834,_0x24a774){_0xcf7834=_0xcf7834-0x0;var _0x25aca0=_0x5f2f[_0xcf7834];return _0x25aca0;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0e2869b..42365ad 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 _0xbdd5=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','update','delete','destroy','removeTeams','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4005f4,_0x528f51){var _0x21b640=function(_0x53b223){while(--_0x53b223){_0x4005f4['push'](_0x4005f4['shift']());}};_0x21b640(++_0x528f51);}(_0xbdd5,0x1f3));var _0x5bdd=function(_0x2cbffe,_0xff4924){_0x2cbffe=_0x2cbffe-0x0;var _0x5d2a91=_0xbdd5[_0x2cbffe];return _0x5d2a91;};'use strict';var multer=require(_0x5bdd('0x0'));var util=require(_0x5bdd('0x1'));var path=require(_0x5bdd('0x2'));var timeout=require('connect-timeout');var express=require(_0x5bdd('0x3'));var router=express['Router']();var auth=require(_0x5bdd('0x4'));var interaction=require(_0x5bdd('0x5'));var config=require(_0x5bdd('0x6'));var controller=require(_0x5bdd('0x7'));router[_0x5bdd('0x8')]('/',auth[_0x5bdd('0x9')](),controller[_0x5bdd('0xa')]);router[_0x5bdd('0x8')](_0x5bdd('0xb'),auth['isAuthenticated'](),controller[_0x5bdd('0xc')]);router['get'](_0x5bdd('0xd'),auth['isAuthenticated'](),controller[_0x5bdd('0xe')]);router[_0x5bdd('0x8')](_0x5bdd('0xf'),auth[_0x5bdd('0x9')](),controller[_0x5bdd('0x10')]);router[_0x5bdd('0x8')](_0x5bdd('0x11'),auth['isAuthenticated'](),controller[_0x5bdd('0x12')]);router[_0x5bdd('0x8')](_0x5bdd('0x13'),auth[_0x5bdd('0x9')](),controller['getAgents']);router[_0x5bdd('0x14')]('/',auth[_0x5bdd('0x9')](),controller['create']);router[_0x5bdd('0x14')](_0x5bdd('0x11'),auth['isAuthenticated'](),controller[_0x5bdd('0x15')]);router[_0x5bdd('0x14')](_0x5bdd('0x13'),auth[_0x5bdd('0x9')](),controller[_0x5bdd('0x16')]);router['put']('/:id',auth[_0x5bdd('0x9')](),controller[_0x5bdd('0x17')]);router[_0x5bdd('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x5bdd('0x19')]);router[_0x5bdd('0x18')]('/:id/teams',auth[_0x5bdd('0x9')](),controller[_0x5bdd('0x1a')]);router[_0x5bdd('0x18')](_0x5bdd('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x08f0=['addAgents','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','index','/:id','show','/:id/members','isAuthenticated','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams'];(function(_0x119c85,_0x268175){var _0x41d288=function(_0x52c0b2){while(--_0x52c0b2){_0x119c85['push'](_0x119c85['shift']());}};_0x41d288(++_0x268175);}(_0x08f0,0x128));var _0x008f=function(_0x267362,_0x265812){_0x267362=_0x267362-0x0;var _0x5171f0=_0x08f0[_0x267362];return _0x5171f0;};'use strict';var multer=require(_0x008f('0x0'));var util=require('util');var path=require(_0x008f('0x1'));var timeout=require(_0x008f('0x2'));var express=require(_0x008f('0x3'));var router=express[_0x008f('0x4')]();var auth=require(_0x008f('0x5'));var interaction=require(_0x008f('0x6'));var config=require(_0x008f('0x7'));var controller=require(_0x008f('0x8'));router[_0x008f('0x9')]('/',auth['isAuthenticated'](),controller[_0x008f('0xa')]);router[_0x008f('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x008f('0x9')](_0x008f('0xb'),auth['isAuthenticated'](),controller[_0x008f('0xc')]);router['get'](_0x008f('0xd'),auth[_0x008f('0xe')](),controller[_0x008f('0xf')]);router['get']('/:id/teams',auth[_0x008f('0xe')](),controller[_0x008f('0x10')]);router['get'](_0x008f('0x11'),auth[_0x008f('0xe')](),controller[_0x008f('0x12')]);router[_0x008f('0x13')]('/',auth['isAuthenticated'](),controller[_0x008f('0x14')]);router[_0x008f('0x13')](_0x008f('0x15'),auth[_0x008f('0xe')](),controller[_0x008f('0x16')]);router[_0x008f('0x13')]('/:id/users',auth[_0x008f('0xe')](),controller[_0x008f('0x17')]);router['put'](_0x008f('0xb'),auth[_0x008f('0xe')](),controller[_0x008f('0x18')]);router[_0x008f('0x19')](_0x008f('0xb'),auth['isAuthenticated'](),controller[_0x008f('0x1a')]);router[_0x008f('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x008f('0x1b')]);router[_0x008f('0x19')](_0x008f('0x11'),auth[_0x008f('0xe')](),controller['removeAgents']);module[_0x008f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 22dd906..c7b70ab 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 _0x10ed=['moment','sequelize','exports','STRING','DATE'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x10ed,0x16d));var _0xd10e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x10ed[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0xd10e('0x0'));var Sequelize=require(_0xd10e('0x1'));module[_0xd10e('0x2')]={'uniqueid':{'type':Sequelize[_0xd10e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd10e('0x3')]},'joinAt':{'type':Sequelize[_0xd10e('0x4')]},'leaveAt':{'type':Sequelize[_0xd10e('0x4')]},'acceptAt':{'type':Sequelize[_0xd10e('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3281=['DATE','moment','sequelize','exports','STRING'];(function(_0x4db9cc,_0x4e178a){var _0x5018d9=function(_0x54983a){while(--_0x54983a){_0x4db9cc['push'](_0x4db9cc['shift']());}};_0x5018d9(++_0x4e178a);}(_0x3281,0x155));var _0x1328=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x3281[_0x5e36d1];return _0x950b9e;};'use strict';var moment=require(_0x1328('0x0'));var Sequelize=require(_0x1328('0x1'));module[_0x1328('0x2')]={'uniqueid':{'type':Sequelize[_0x1328('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1328('0x4')]},'leaveAt':{'type':Sequelize[_0x1328('0x4')]},'acceptAt':{'type':Sequelize[_0x1328('0x4')]},'exitAt':{'type':Sequelize[_0x1328('0x4')]},'reason':{'type':Sequelize[_0x1328('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 572ea4f..7a974f7 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 _0xb7e7=['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','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]),_0x57b9da);if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['ChatQueueReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));};exports[_0x7b7e('0x4a')]=function(_0x29024e,_0x46d4ee){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()[_0x7b7e('0x24')](respondWithResult(_0x46d4ee,null))[_0x7b7e('0x43')](handleError(_0x46d4ee,null));}; \ No newline at end of file +var _0xbaf0=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x135b0a,_0x446c26){var _0x34bd43=function(_0x3f7a88){while(--_0x3f7a88){_0x135b0a['push'](_0x135b0a['shift']());}};_0x34bd43(++_0x446c26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a53e2,_0x465dd7){_0x465dd7=_0x465dd7||0xcc;return function(_0xe4378c){if(_0xe4378c){return _0x5a53e2[_0x0baf('0x1b')](_0x465dd7);}return _0x5a53e2[_0x0baf('0x1c')](_0x465dd7)['end']();};}function respondWithResult(_0x2ab33e,_0x49e44b){_0x49e44b=_0x49e44b||0xc8;return function(_0x1c76a8){if(_0x1c76a8){return _0x2ab33e[_0x0baf('0x1c')](_0x49e44b)[_0x0baf('0x1d')](_0x1c76a8);}};}function respondWithFilteredResult(_0x2bc381,_0xb8339e){return function(_0x469599){if(_0x469599){var _0x4f80a8=_0x469599[_0x0baf('0x1e')],_0x4cd79d=_0xb8339e[_0x0baf('0x1f')],_0x2312c7=_0xb8339e[_0x0baf('0x1f')]+_0xb8339e[_0x0baf('0x20')],_0x38395b;if(_0x2312c7>=_0x4f80a8){_0x2312c7=_0x4f80a8;_0x38395b=0xc8;}else{_0x38395b=0xce;}_0x2bc381['status'](_0x38395b);return _0x2bc381[_0x0baf('0x21')](_0x0baf('0x22'),_0x4cd79d+'-'+_0x2312c7+'/'+_0x4f80a8)[_0x0baf('0x1d')](_0x469599);}return null;};}function patchUpdates(_0x3e9cb4){return function(_0x47070d){try{jsonpatch[_0x0baf('0x23')](_0x47070d,_0x3e9cb4,!![]);}catch(_0x4ff793){return BPromise['reject'](_0x4ff793);}return _0x47070d[_0x0baf('0x24')]();};}function saveUpdates(_0x154f48,_0x32e839){return function(_0x1848e8){if(_0x1848e8){return _0x1848e8[_0x0baf('0x25')](_0x154f48)[_0x0baf('0x26')](function(_0x210cd8){return _0x210cd8;});}return null;};}function removeEntity(_0x636a13,_0x2c42e2){return function(_0x15a2c3){if(_0x15a2c3){return _0x15a2c3['destroy']()[_0x0baf('0x26')](function(){_0x636a13['status'](0xcc)[_0x0baf('0x27')]();});}};}function handleEntityNotFound(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(!_0x2ef0aa){_0x5dbf00['sendStatus'](0x194);}return _0x2ef0aa;};}function handleError(_0x4be1b9,_0x47c4b){_0x47c4b=_0x47c4b||0x1f4;return function(_0x27b59c){logger[_0x0baf('0x28')](_0x27b59c[_0x0baf('0x29')]);if(_0x27b59c[_0x0baf('0x2a')]){delete _0x27b59c['name'];}_0x4be1b9[_0x0baf('0x1c')](_0x47c4b)[_0x0baf('0x2b')](_0x27b59c);};}exports[_0x0baf('0x2c')]=function(_0x366e71,_0x3843b8){var _0x3b9b31={},_0x453525={},_0x549fd0={'count':0x0,'rows':[]};var _0x1590b4=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0x55c715){return{'name':_0x55c715[_0x0baf('0x30')],'type':_0x55c715[_0x0baf('0x31')]['key']};});_0x453525[_0x0baf('0x32')]=_[_0x0baf('0x2d')](_0x1590b4,_0x0baf('0x2a'));_0x453525[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x366e71[_0x0baf('0x33')]);_0x453525[_0x0baf('0x35')]=_['intersection'](_0x453525[_0x0baf('0x32')],_0x453525[_0x0baf('0x33')]);_0x3b9b31[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x453525[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x38')]));_0x3b9b31[_0x0baf('0x36')]=_0x3b9b31[_0x0baf('0x36')][_0x0baf('0x39')]?_0x3b9b31[_0x0baf('0x36')]:_0x453525[_0x0baf('0x32')];if(!_0x366e71[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3a'))){_0x3b9b31['limit']=qs[_0x0baf('0x20')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x20')]);_0x3b9b31[_0x0baf('0x1f')]=qs['offset'](_0x366e71[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x3b9b31['order']=qs[_0x0baf('0x3b')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x3b')]);_0x3b9b31[_0x0baf('0x3c')]=qs[_0x0baf('0x35')](_[_0x0baf('0x3d')](_0x366e71[_0x0baf('0x33')],_0x453525[_0x0baf('0x35')]),_0x1590b4);if(_0x366e71['query'][_0x0baf('0x3e')]){_0x3b9b31[_0x0baf('0x3c')]=_['merge'](_0x3b9b31[_0x0baf('0x3c')],{'$or':_['map'](_0x1590b4,function(_0x5c545f){if(_0x5c545f[_0x0baf('0x31')]!==_0x0baf('0x3f')){var _0x5d3ad1={};_0x5d3ad1[_0x5c545f['name']]={'$like':'%'+_0x366e71[_0x0baf('0x33')][_0x0baf('0x3e')]+'%'};return _0x5d3ad1;}})});}_0x3b9b31=_[_0x0baf('0x40')]({},_0x3b9b31,_0x366e71[_0x0baf('0x41')]);var _0x15eb5c={'where':_0x3b9b31[_0x0baf('0x3c')]};return db[_0x0baf('0x2e')][_0x0baf('0x1e')](_0x15eb5c)[_0x0baf('0x26')](function(_0x36c6d2){_0x549fd0[_0x0baf('0x1e')]=_0x36c6d2;if(_0x366e71[_0x0baf('0x33')][_0x0baf('0x42')]){_0x3b9b31[_0x0baf('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0baf('0x44')](_0x3b9b31);})[_0x0baf('0x26')](function(_0x4f1de9){_0x549fd0[_0x0baf('0x45')]=_0x4f1de9;return _0x549fd0;})[_0x0baf('0x26')](respondWithFilteredResult(_0x3843b8,_0x3b9b31))[_0x0baf('0x46')](handleError(_0x3843b8,null));};exports[_0x0baf('0x47')]=function(_0x2e20c8,_0x456d0b){var _0x57b581={'raw':!![],'where':{'id':_0x2e20c8[_0x0baf('0x48')]['id']}},_0x23ad34={};_0x23ad34['model']=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x23ad34[_0x0baf('0x33')]=_['keys'](_0x2e20c8[_0x0baf('0x33')]);_0x23ad34[_0x0baf('0x35')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],_0x23ad34[_0x0baf('0x33')]);_0x57b581[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x2e20c8[_0x0baf('0x33')]['fields']));_0x57b581[_0x0baf('0x36')]=_0x57b581[_0x0baf('0x36')][_0x0baf('0x39')]?_0x57b581[_0x0baf('0x36')]:_0x23ad34[_0x0baf('0x32')];if(_0x2e20c8['query'][_0x0baf('0x42')]){_0x57b581[_0x0baf('0x43')]=[{'all':!![]}];}_0x57b581=_[_0x0baf('0x40')]({},_0x57b581,_0x2e20c8[_0x0baf('0x41')]);return db[_0x0baf('0x2e')]['find'](_0x57b581)[_0x0baf('0x26')](handleEntityNotFound(_0x456d0b,null))[_0x0baf('0x26')](respondWithResult(_0x456d0b,null))[_0x0baf('0x46')](handleError(_0x456d0b,null));};exports[_0x0baf('0x49')]=function(_0x41599f,_0x22d10f){return db[_0x0baf('0x2e')]['create'](_0x41599f[_0x0baf('0x4a')],{})[_0x0baf('0x26')](respondWithResult(_0x22d10f,0xc9))[_0x0baf('0x46')](handleError(_0x22d10f,null));};exports['update']=function(_0x3c9de3,_0x2222b6){if(_0x3c9de3[_0x0baf('0x4a')]['id']){delete _0x3c9de3[_0x0baf('0x4a')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x3c9de3[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2222b6,null))[_0x0baf('0x26')](saveUpdates(_0x3c9de3[_0x0baf('0x4a')],null))[_0x0baf('0x26')](respondWithResult(_0x2222b6,null))[_0x0baf('0x46')](handleError(_0x2222b6,null));};exports[_0x0baf('0x4c')]=function(_0xc427b2,_0x40d4a6){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0xc427b2[_0x0baf('0x48')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x40d4a6,null))['then'](removeEntity(_0x40d4a6,null))['catch'](handleError(_0x40d4a6,null));};exports[_0x0baf('0x4d')]=function(_0x3d6b19,_0x1cd114){return db[_0x0baf('0x2e')][_0x0baf('0x4d')]()[_0x0baf('0x26')](respondWithResult(_0x1cd114,null))[_0x0baf('0x46')](handleError(_0x1cd114,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 40fb253..9b097fa 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 _0x1dc6=['ChatQueueReport','report_chat_queue','uniqueid','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x124936,_0x30def0){var _0xdc59ce=function(_0x368966){while(--_0x368966){_0x124936['push'](_0x124936['shift']());}};_0xdc59ce(++_0x30def0);}(_0x1dc6,0x116));var _0x61dc=function(_0x1b2461,_0x439f2c){_0x1b2461=_0x1b2461-0x0;var _0x21fae1=_0x1dc6[_0x1b2461];return _0x21fae1;};'use strict';var _=require(_0x61dc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x61dc('0x1'));var rp=require(_0x61dc('0x2'));var fs=require('fs');var path=require(_0x61dc('0x3'));var rimraf=require(_0x61dc('0x4'));var config=require(_0x61dc('0x5'));var attributes=require(_0x61dc('0x6'));module[_0x61dc('0x7')]=function(_0x4f7e28,_0x153339){return _0x4f7e28['define'](_0x61dc('0x8'),attributes,{'tableName':_0x61dc('0x9'),'paranoid':![],'indexes':[{'name':_0x61dc('0xa'),'fields':[_0x61dc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39be=['../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x47fd45,_0x40dd67){var _0x363313=function(_0xb92163){while(--_0xb92163){_0x47fd45['push'](_0x47fd45['shift']());}};_0x363313(++_0x40dd67);}(_0x39be,0xbb));var _0xe39b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x39be[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe39b('0x0'));var util=require(_0xe39b('0x1'));var logger=require(_0xe39b('0x2'))(_0xe39b('0x3'));var moment=require(_0xe39b('0x4'));var BPromise=require(_0xe39b('0x5'));var rp=require(_0xe39b('0x6'));var fs=require('fs');var path=require(_0xe39b('0x7'));var rimraf=require('rimraf');var config=require(_0xe39b('0x8'));var attributes=require(_0xe39b('0x9'));module[_0xe39b('0xa')]=function(_0x4617b3,_0x4a09dc){return _0x4617b3[_0xe39b('0xb')](_0xe39b('0xc'),attributes,{'tableName':_0xe39b('0xd'),'paranoid':![],'indexes':[{'name':_0xe39b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index edcaf09..0dd479c 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 _0x6641=['body','options','raw','then','CreateChatQueueReport','stringify','UpdateChatQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','ChatQueueReport','create'];(function(_0x3faabe,_0x24b34a){var _0x24cd69=function(_0x4bba26){while(--_0x4bba26){_0x3faabe['push'](_0x3faabe['shift']());}};_0x24cd69(++_0x24b34a);}(_0x6641,0x113));var _0x1664=function(_0x3ca3ec,_0x82b7eb){_0x3ca3ec=_0x3ca3ec-0x0;var _0x4e3632=_0x6641[_0x3ca3ec];return _0x4e3632;};'use strict';var _=require(_0x1664('0x0'));var util=require('util');var moment=require(_0x1664('0x1'));var BPromise=require(_0x1664('0x2'));var rs=require(_0x1664('0x3'));var fs=require('fs');var Redis=require(_0x1664('0x4'));var db=require(_0x1664('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1664('0x6'))(_0x1664('0x7'));var config=require(_0x1664('0x8'));var jayson=require(_0x1664('0x9'));var client=jayson['client'][_0x1664('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e81c6,_0x555e11,_0x1ec63b){return new BPromise(function(_0x276a64,_0x487825){return client[_0x1664('0xb')](_0x5e81c6,_0x1ec63b)['then'](function(_0x4031ba){logger[_0x1664('0xc')](_0x1664('0xd'),_0x555e11,'request\x20sent');logger[_0x1664('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x555e11,_0x1664('0xf'),JSON['stringify'](_0x4031ba));if(_0x4031ba[_0x1664('0x10')]){if(_0x4031ba[_0x1664('0x10')][_0x1664('0x11')]===0x1f4){logger[_0x1664('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x555e11,_0x4031ba['error']['message']);return _0x487825(_0x4031ba[_0x1664('0x10')]['message']);}logger['error'](_0x1664('0xd'),_0x555e11,_0x4031ba[_0x1664('0x10')][_0x1664('0x12')]);return _0x276a64(_0x4031ba[_0x1664('0x10')][_0x1664('0x12')]);}else{logger[_0x1664('0xc')](_0x1664('0xd'),_0x555e11,_0x1664('0xf'));_0x276a64(_0x4031ba['result'][_0x1664('0x12')]);}})[_0x1664('0x13')](function(_0x5a1f35){logger[_0x1664('0x10')](_0x1664('0xd'),_0x555e11,_0x5a1f35);_0x487825(_0x5a1f35);});});}exports['CreateChatQueueReport']=function(_0x49c013){var _0xdc5db8=this;return new Promise(function(_0x2eb800,_0x30a429){return db[_0x1664('0x14')][_0x1664('0x15')](_0x49c013[_0x1664('0x16')],{'raw':_0x49c013[_0x1664('0x17')]?_0x49c013['options'][_0x1664('0x18')]===undefined?!![]:![]:!![]})[_0x1664('0x19')](function(_0x33f9a4){logger[_0x1664('0xc')](_0x1664('0x1a'),_0x49c013);logger['debug']('CreateChatQueueReport',_0x49c013,JSON[_0x1664('0x1b')](_0x33f9a4));_0x2eb800(_0x33f9a4);})[_0x1664('0x13')](function(_0x41b247){logger[_0x1664('0x10')](_0x1664('0x1a'),_0x41b247[_0x1664('0x12')],_0x49c013);_0x30a429(_0xdc5db8[_0x1664('0x10')](0x1f4,_0x41b247[_0x1664('0x12')]));});});};exports[_0x1664('0x1c')]=function(_0x3afc8d){var _0x134b9a=this;return new Promise(function(_0x4b3bb4,_0x3b60e7){return db[_0x1664('0x14')][_0x1664('0x1d')](_0x3afc8d[_0x1664('0x16')],{'raw':_0x3afc8d[_0x1664('0x17')]?_0x3afc8d[_0x1664('0x17')][_0x1664('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3afc8d[_0x1664('0x17')]?_0x3afc8d[_0x1664('0x17')][_0x1664('0x1e')]||null:null,'attributes':_0x3afc8d[_0x1664('0x17')]?_0x3afc8d[_0x1664('0x17')][_0x1664('0x1f')]||null:null,'limit':_0x3afc8d[_0x1664('0x17')]?_0x3afc8d['options'][_0x1664('0x20')]||null:null})[_0x1664('0x19')](function(_0x4a8357){logger[_0x1664('0xc')]('UpdateChatQueueReport',_0x3afc8d);logger[_0x1664('0xe')](_0x1664('0x1c'),_0x3afc8d,JSON[_0x1664('0x1b')](_0x4a8357));_0x4b3bb4(_0x4a8357);})['catch'](function(_0x342e17){logger[_0x1664('0x10')](_0x1664('0x1c'),_0x342e17[_0x1664('0x12')],_0x3afc8d);_0x3b60e7(_0x134b9a[_0x1664('0x10')](0x1f4,_0x342e17[_0x1664('0x12')]));});});}; \ No newline at end of file +var _0x2852=['info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateChatQueueReport','create','body','raw','then','catch','update','options','where','limit','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x2852,0x147));var _0x2285=function(_0xe40094,_0x21b55d){_0xe40094=_0xe40094-0x0;var _0x19b531=_0x2852[_0xe40094];return _0x19b531;};'use strict';var _=require(_0x2285('0x0'));var util=require('util');var moment=require(_0x2285('0x1'));var BPromise=require(_0x2285('0x2'));var rs=require(_0x2285('0x3'));var fs=require('fs');var Redis=require(_0x2285('0x4'));var db=require(_0x2285('0x5'))['db'];var utils=require(_0x2285('0x6'));var logger=require(_0x2285('0x7'))(_0x2285('0x8'));var config=require(_0x2285('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2285('0xa')][_0x2285('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d4759,_0x5f5129,_0x622730){return new BPromise(function(_0x44b8b2,_0x23fb30){return client[_0x2285('0xc')](_0x3d4759,_0x622730)['then'](function(_0x7da642){logger[_0x2285('0xd')](_0x2285('0xe'),_0x5f5129,'request\x20sent');logger[_0x2285('0xf')](_0x2285('0x10'),_0x5f5129,'request\x20sent',JSON[_0x2285('0x11')](_0x7da642));if(_0x7da642[_0x2285('0x12')]){if(_0x7da642[_0x2285('0x12')][_0x2285('0x13')]===0x1f4){logger['error'](_0x2285('0xe'),_0x5f5129,_0x7da642[_0x2285('0x12')]['message']);return _0x23fb30(_0x7da642['error'][_0x2285('0x14')]);}logger[_0x2285('0x12')](_0x2285('0xe'),_0x5f5129,_0x7da642['error'][_0x2285('0x14')]);return _0x44b8b2(_0x7da642[_0x2285('0x12')][_0x2285('0x14')]);}else{logger[_0x2285('0xd')](_0x2285('0xe'),_0x5f5129,_0x2285('0x15'));_0x44b8b2(_0x7da642[_0x2285('0x16')][_0x2285('0x14')]);}})['catch'](function(_0x1eb1c1){logger[_0x2285('0x12')](_0x2285('0xe'),_0x5f5129,_0x1eb1c1);_0x23fb30(_0x1eb1c1);});});}exports[_0x2285('0x17')]=function(_0x59b432){var _0x327269=this;return new Promise(function(_0x56c80a,_0x356833){return db['ChatQueueReport'][_0x2285('0x18')](_0x59b432[_0x2285('0x19')],{'raw':_0x59b432['options']?_0x59b432['options'][_0x2285('0x1a')]===undefined?!![]:![]:!![]})[_0x2285('0x1b')](function(_0x9bafec){logger[_0x2285('0xd')](_0x2285('0x17'),_0x59b432);logger[_0x2285('0xf')](_0x2285('0x17'),_0x59b432,JSON['stringify'](_0x9bafec));_0x56c80a(_0x9bafec);})[_0x2285('0x1c')](function(_0x4d6e02){logger['error']('CreateChatQueueReport',_0x4d6e02['message'],_0x59b432);_0x356833(_0x327269[_0x2285('0x12')](0x1f4,_0x4d6e02['message']));});});};exports['UpdateChatQueueReport']=function(_0x882963){var _0x380efc=this;return new Promise(function(_0x258229,_0x310bf8){return db['ChatQueueReport'][_0x2285('0x1d')](_0x882963[_0x2285('0x19')],{'raw':_0x882963['options']?_0x882963[_0x2285('0x1e')][_0x2285('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x882963[_0x2285('0x1e')]?_0x882963[_0x2285('0x1e')][_0x2285('0x1f')]||null:null,'attributes':_0x882963[_0x2285('0x1e')]?_0x882963[_0x2285('0x1e')]['attributes']||null:null,'limit':_0x882963[_0x2285('0x1e')]?_0x882963[_0x2285('0x1e')][_0x2285('0x20')]||null:null})[_0x2285('0x1b')](function(_0x2b0abc){logger[_0x2285('0xd')](_0x2285('0x21'),_0x882963);logger[_0x2285('0xf')](_0x2285('0x21'),_0x882963,JSON['stringify'](_0x2b0abc));_0x258229(_0x2b0abc);})[_0x2285('0x1c')](function(_0x4178c1){logger[_0x2285('0x12')](_0x2285('0x21'),_0x4178c1['message'],_0x882963);_0x310bf8(_0x380efc[_0x2285('0x12')](0x1f4,_0x4178c1[_0x2285('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2e97413..486f639 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 _0x6389=['get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x6389,0x171));var _0x9638=function(_0x44e976,_0x4ff40d){_0x44e976=_0x44e976-0x0;var _0x8a7861=_0x6389[_0x44e976];return _0x8a7861;};'use strict';var multer=require('multer');var util=require(_0x9638('0x0'));var path=require('path');var timeout=require(_0x9638('0x1'));var express=require(_0x9638('0x2'));var router=express[_0x9638('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9638('0x4'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x9638('0x5')]('/',auth[_0x9638('0x6')](),controller[_0x9638('0x7')]);router['get'](_0x9638('0x8'),auth[_0x9638('0x6')](),controller[_0x9638('0x9')]);router[_0x9638('0x5')]('/:id',auth[_0x9638('0x6')](),controller['show']);router[_0x9638('0xa')]('/',auth[_0x9638('0x6')](),controller[_0x9638('0xb')]);router[_0x9638('0xc')](_0x9638('0xd'),auth[_0x9638('0x6')](),controller[_0x9638('0xe')]);router[_0x9638('0xf')](_0x9638('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9638('0x10')]=router; \ No newline at end of file +var _0x1f6e=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','put','/:id','delete'];(function(_0x3bcf4c,_0x381452){var _0x16d05a=function(_0x265ff8){while(--_0x265ff8){_0x3bcf4c['push'](_0x3bcf4c['shift']());}};_0x16d05a(++_0x381452);}(_0x1f6e,0x1a0));var _0xe1f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f6e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe1f6('0x0'));var util=require(_0xe1f6('0x1'));var path=require('path');var timeout=require(_0xe1f6('0x2'));var express=require(_0xe1f6('0x3'));var router=express[_0xe1f6('0x4')]();var auth=require(_0xe1f6('0x5'));var interaction=require(_0xe1f6('0x6'));var config=require(_0xe1f6('0x7'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0xe1f6('0x8')](),controller[_0xe1f6('0x9')]);router[_0xe1f6('0xa')]('/describe',auth[_0xe1f6('0x8')](),controller[_0xe1f6('0xb')]);router[_0xe1f6('0xa')]('/:id',auth[_0xe1f6('0x8')](),controller[_0xe1f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe1f6('0xd')](_0xe1f6('0xe'),auth[_0xe1f6('0x8')](),controller['update']);router[_0xe1f6('0xf')](_0xe1f6('0xe'),auth[_0xe1f6('0x8')](),controller[_0xe1f6('0x10')]);module[_0xe1f6('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c3b92de..aae4b87 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 _0xe7c3=['NOW','sequelize','exports','account','agent','queue','DATE'];(function(_0x3c268b,_0x238b63){var _0x3ed33d=function(_0xfb6291){while(--_0xfb6291){_0x3c268b['push'](_0x3c268b['shift']());}};_0x3ed33d(++_0x238b63);}(_0xe7c3,0x1f2));var _0x3e7c=function(_0x404093,_0x4fd27c){_0x404093=_0x404093-0x0;var _0x1e56fc=_0xe7c3[_0x404093];return _0x1e56fc;};'use strict';var moment=require('moment');var Sequelize=require(_0x3e7c('0x0'));module[_0x3e7c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3e7c('0x2'),_0x3e7c('0x3'),_0x3e7c('0x4')),'allowNull':![],'defaultValue':_0x3e7c('0x4')},'transferredAt':{'type':Sequelize[_0x3e7c('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x3e7c('0x6')]}}; \ No newline at end of file +var _0x2b76=['queue','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2b76,0x19a));var _0x62b7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2b76[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0x62b7('0x0'));var Sequelize=require(_0x62b7('0x1'));module[_0x62b7('0x2')]={'uniqueid':{'type':Sequelize[_0x62b7('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x62b7('0x4'),_0x62b7('0x5'),_0x62b7('0x6')),'allowNull':![],'defaultValue':_0x62b7('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x62b7('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 9ab5b71..2867ddb 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 _0x4624=['params','rawAttributes','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','error','stack','name','index','map','ChatTransferReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show'];(function(_0x42aab6,_0x487448){var _0x253d30=function(_0x1ffbe3){while(--_0x1ffbe3){_0x42aab6['push'](_0x42aab6['shift']());}};_0x253d30(++_0x487448);}(_0x4624,0x133));var _0x4462=function(_0x253790,_0x329740){_0x253790=_0x253790-0x0;var _0x4d4788=_0x4624[_0x253790];return _0x4d4788;};'use strict';var pdf=require(_0x4462('0x0'));var emlformat=require(_0x4462('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4462('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4462('0x3'));var moment=require(_0x4462('0x4'));var BPromise=require(_0x4462('0x5'));var Mustache=require(_0x4462('0x6'));var util=require(_0x4462('0x7'));var path=require(_0x4462('0x8'));var sox=require(_0x4462('0x9'));var csv=require(_0x4462('0xa'));var ejs=require(_0x4462('0xb'));var fs=require('fs');var _=require(_0x4462('0xc'));var squel=require('squel');var crypto=require(_0x4462('0xd'));var jsforce=require(_0x4462('0xe'));var deskjs=require(_0x4462('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4462('0x10'));var Papa=require(_0x4462('0x11'));var Redis=require(_0x4462('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4462('0x13'));var hardwareService=require(_0x4462('0x14'));var logger=require('../../config/logger')(_0x4462('0x15'));var utils=require(_0x4462('0x16'));var config=require(_0x4462('0x17'));var db=require(_0x4462('0x18'))['db'];function respondWithStatusCode(_0x152e8c,_0xdad084){_0xdad084=_0xdad084||0xcc;return function(_0x49dc68){if(_0x49dc68){return _0x152e8c[_0x4462('0x19')](_0xdad084);}return _0x152e8c[_0x4462('0x1a')](_0xdad084)[_0x4462('0x1b')]();};}function respondWithResult(_0x41b86d,_0xefe2c){_0xefe2c=_0xefe2c||0xc8;return function(_0x5de103){if(_0x5de103){return _0x41b86d[_0x4462('0x1a')](_0xefe2c)[_0x4462('0x1c')](_0x5de103);}};}function respondWithFilteredResult(_0x1e7051,_0x2167fd){return function(_0x471413){if(_0x471413){var _0x1ea2b5=_0x471413[_0x4462('0x1d')],_0x20a6b2=_0x2167fd[_0x4462('0x1e')],_0x5f50da=_0x2167fd['offset']+_0x2167fd[_0x4462('0x1f')],_0x26e366;if(_0x5f50da>=_0x1ea2b5){_0x5f50da=_0x1ea2b5;_0x26e366=0xc8;}else{_0x26e366=0xce;}_0x1e7051[_0x4462('0x1a')](_0x26e366);return _0x1e7051[_0x4462('0x20')](_0x4462('0x21'),_0x20a6b2+'-'+_0x5f50da+'/'+_0x1ea2b5)[_0x4462('0x1c')](_0x471413);}return null;};}function patchUpdates(_0x19be23){return function(_0x591f30){try{jsonpatch['apply'](_0x591f30,_0x19be23,!![]);}catch(_0x13cacb){return BPromise[_0x4462('0x22')](_0x13cacb);}return _0x591f30['save']();};}function saveUpdates(_0x5811fd,_0x3af4be){return function(_0x533c05){if(_0x533c05){return _0x533c05[_0x4462('0x23')](_0x5811fd)[_0x4462('0x24')](function(_0x5dce0f){return _0x5dce0f;});}return null;};}function removeEntity(_0x217bb7,_0x14e1c0){return function(_0x294d8b){if(_0x294d8b){return _0x294d8b['destroy']()[_0x4462('0x24')](function(){_0x217bb7[_0x4462('0x1a')](0xcc)[_0x4462('0x1b')]();});}};}function handleEntityNotFound(_0x261e13,_0x25fea9){return function(_0x306575){if(!_0x306575){_0x261e13['sendStatus'](0x194);}return _0x306575;};}function handleError(_0x40b69c,_0x4a6f08){_0x4a6f08=_0x4a6f08||0x1f4;return function(_0x401339){logger[_0x4462('0x25')](_0x401339[_0x4462('0x26')]);if(_0x401339['name']){delete _0x401339[_0x4462('0x27')];}_0x40b69c[_0x4462('0x1a')](_0x4a6f08)['send'](_0x401339);};}exports[_0x4462('0x28')]=function(_0x2c329f,_0x10f088){var _0x20116a={},_0x2dd10d={},_0x36eac1={'count':0x0,'rows':[]};var _0x492b17=_[_0x4462('0x29')](db[_0x4462('0x2a')]['rawAttributes'],function(_0x4162b0){return{'name':_0x4162b0[_0x4462('0x2b')],'type':_0x4162b0[_0x4462('0x2c')][_0x4462('0x2d')]};});_0x2dd10d['model']=_[_0x4462('0x29')](_0x492b17,_0x4462('0x27'));_0x2dd10d[_0x4462('0x2e')]=_[_0x4462('0x2f')](_0x2c329f[_0x4462('0x2e')]);_0x2dd10d['filters']=_[_0x4462('0x30')](_0x2dd10d[_0x4462('0x31')],_0x2dd10d[_0x4462('0x2e')]);_0x20116a[_0x4462('0x32')]=_['intersection'](_0x2dd10d[_0x4462('0x31')],qs[_0x4462('0x33')](_0x2c329f[_0x4462('0x2e')]['fields']));_0x20116a[_0x4462('0x32')]=_0x20116a[_0x4462('0x32')][_0x4462('0x34')]?_0x20116a[_0x4462('0x32')]:_0x2dd10d['model'];if(!_0x2c329f[_0x4462('0x2e')][_0x4462('0x35')](_0x4462('0x36'))){_0x20116a['limit']=qs[_0x4462('0x1f')](_0x2c329f[_0x4462('0x2e')]['limit']);_0x20116a[_0x4462('0x1e')]=qs[_0x4462('0x1e')](_0x2c329f[_0x4462('0x2e')][_0x4462('0x1e')]);}_0x20116a[_0x4462('0x37')]=qs[_0x4462('0x38')](_0x2c329f[_0x4462('0x2e')]['sort']);_0x20116a[_0x4462('0x39')]=qs[_0x4462('0x3a')](_[_0x4462('0x3b')](_0x2c329f[_0x4462('0x2e')],_0x2dd10d[_0x4462('0x3a')]),_0x492b17);if(_0x2c329f[_0x4462('0x2e')][_0x4462('0x3c')]){_0x20116a[_0x4462('0x39')]=_['merge'](_0x20116a[_0x4462('0x39')],{'$or':_[_0x4462('0x29')](_0x492b17,function(_0x252cfb){if(_0x252cfb[_0x4462('0x2c')]!=='VIRTUAL'){var _0x1f9156={};_0x1f9156[_0x252cfb[_0x4462('0x27')]]={'$like':'%'+_0x2c329f[_0x4462('0x2e')][_0x4462('0x3c')]+'%'};return _0x1f9156;}})});}_0x20116a=_[_0x4462('0x3d')]({},_0x20116a,_0x2c329f[_0x4462('0x3e')]);var _0x28336b={'where':_0x20116a[_0x4462('0x39')]};return db[_0x4462('0x2a')]['count'](_0x28336b)[_0x4462('0x24')](function(_0x553bc9){_0x36eac1[_0x4462('0x1d')]=_0x553bc9;if(_0x2c329f[_0x4462('0x2e')][_0x4462('0x3f')]){_0x20116a[_0x4462('0x40')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x20116a);})[_0x4462('0x24')](function(_0x4ec375){_0x36eac1[_0x4462('0x41')]=_0x4ec375;return _0x36eac1;})[_0x4462('0x24')](respondWithFilteredResult(_0x10f088,_0x20116a))[_0x4462('0x42')](handleError(_0x10f088,null));};exports[_0x4462('0x43')]=function(_0x234fd0,_0x1bd42d){var _0xeb6534={'raw':!![],'where':{'id':_0x234fd0[_0x4462('0x44')]['id']}},_0x593292={};_0x593292[_0x4462('0x31')]=_['keys'](db[_0x4462('0x2a')][_0x4462('0x45')]);_0x593292[_0x4462('0x2e')]=_['keys'](_0x234fd0['query']);_0x593292[_0x4462('0x3a')]=_[_0x4462('0x30')](_0x593292[_0x4462('0x31')],_0x593292[_0x4462('0x2e')]);_0xeb6534[_0x4462('0x32')]=_[_0x4462('0x30')](_0x593292[_0x4462('0x31')],qs[_0x4462('0x33')](_0x234fd0[_0x4462('0x2e')]['fields']));_0xeb6534['attributes']=_0xeb6534[_0x4462('0x32')]['length']?_0xeb6534[_0x4462('0x32')]:_0x593292[_0x4462('0x31')];if(_0x234fd0[_0x4462('0x2e')][_0x4462('0x3f')]){_0xeb6534[_0x4462('0x40')]=[{'all':!![]}];}_0xeb6534=_[_0x4462('0x3d')]({},_0xeb6534,_0x234fd0[_0x4462('0x3e')]);return db[_0x4462('0x2a')][_0x4462('0x46')](_0xeb6534)['then'](handleEntityNotFound(_0x1bd42d,null))[_0x4462('0x24')](respondWithResult(_0x1bd42d,null))[_0x4462('0x42')](handleError(_0x1bd42d,null));};exports[_0x4462('0x47')]=function(_0x11437b,_0x433a62){return db[_0x4462('0x2a')][_0x4462('0x47')](_0x11437b[_0x4462('0x48')],{})[_0x4462('0x24')](respondWithResult(_0x433a62,0xc9))[_0x4462('0x42')](handleError(_0x433a62,null));};exports[_0x4462('0x23')]=function(_0x5cee39,_0x25f117){if(_0x5cee39[_0x4462('0x48')]['id']){delete _0x5cee39[_0x4462('0x48')]['id'];}return db[_0x4462('0x2a')][_0x4462('0x46')]({'where':{'id':_0x5cee39['params']['id']}})[_0x4462('0x24')](handleEntityNotFound(_0x25f117,null))[_0x4462('0x24')](saveUpdates(_0x5cee39[_0x4462('0x48')],null))[_0x4462('0x24')](respondWithResult(_0x25f117,null))[_0x4462('0x42')](handleError(_0x25f117,null));};exports[_0x4462('0x49')]=function(_0x33fb61,_0x453091){return db[_0x4462('0x2a')]['find']({'where':{'id':_0x33fb61[_0x4462('0x44')]['id']}})['then'](handleEntityNotFound(_0x453091,null))[_0x4462('0x24')](removeEntity(_0x453091,null))['catch'](handleError(_0x453091,null));};exports[_0x4462('0x4a')]=function(_0x2d8b54,_0x3e753a){return db['ChatTransferReport'][_0x4462('0x4a')]()[_0x4462('0x24')](respondWithResult(_0x3e753a,null))['catch'](handleError(_0x3e753a,null));}; \ No newline at end of file +var _0x28cc=['attributes','fields','length','query','nolimit','order','sort','filters','pick','filter','where','ChatTransferReport','includeAll','include','findAll','show','intersection','merge','options','catch','create','body','update','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','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','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','model','map','keys'];(function(_0x37d9b3,_0x370f99){var _0x435f66=function(_0x14c62b){while(--_0x14c62b){_0x37d9b3['push'](_0x37d9b3['shift']());}};_0x435f66(++_0x370f99);}(_0x28cc,0x17d));var _0xc28c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x28cc[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xc28c('0x0'));var emlformat=require(_0xc28c('0x1'));var rimraf=require(_0xc28c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc28c('0x3'));var rp=require(_0xc28c('0x4'));var moment=require('moment');var BPromise=require(_0xc28c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc28c('0x6'));var csv=require('to-csv');var ejs=require(_0xc28c('0x7'));var fs=require('fs');var _=require(_0xc28c('0x8'));var squel=require(_0xc28c('0x9'));var crypto=require(_0xc28c('0xa'));var jsforce=require(_0xc28c('0xb'));var deskjs=require(_0xc28c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc28c('0xd'));var Papa=require(_0xc28c('0xe'));var Redis=require(_0xc28c('0xf'));var authService=require(_0xc28c('0x10'));var qs=require(_0xc28c('0x11'));var as=require(_0xc28c('0x12'));var hardwareService=require(_0xc28c('0x13'));var logger=require('../../config/logger')(_0xc28c('0x14'));var utils=require(_0xc28c('0x15'));var config=require(_0xc28c('0x16'));var db=require(_0xc28c('0x17'))['db'];function respondWithStatusCode(_0x262cdd,_0x52faf7){_0x52faf7=_0x52faf7||0xcc;return function(_0x3ccb1c){if(_0x3ccb1c){return _0x262cdd[_0xc28c('0x18')](_0x52faf7);}return _0x262cdd['status'](_0x52faf7)[_0xc28c('0x19')]();};}function respondWithResult(_0x4f4820,_0x36389c){_0x36389c=_0x36389c||0xc8;return function(_0x4d9103){if(_0x4d9103){return _0x4f4820[_0xc28c('0x1a')](_0x36389c)[_0xc28c('0x1b')](_0x4d9103);}};}function respondWithFilteredResult(_0x293139,_0x24a4e2){return function(_0xacb8cb){if(_0xacb8cb){var _0x23bdbd=_0xacb8cb[_0xc28c('0x1c')],_0x1cbf31=_0x24a4e2[_0xc28c('0x1d')],_0x1a4d3c=_0x24a4e2[_0xc28c('0x1d')]+_0x24a4e2[_0xc28c('0x1e')],_0x3dd199;if(_0x1a4d3c>=_0x23bdbd){_0x1a4d3c=_0x23bdbd;_0x3dd199=0xc8;}else{_0x3dd199=0xce;}_0x293139[_0xc28c('0x1a')](_0x3dd199);return _0x293139[_0xc28c('0x1f')](_0xc28c('0x20'),_0x1cbf31+'-'+_0x1a4d3c+'/'+_0x23bdbd)[_0xc28c('0x1b')](_0xacb8cb);}return null;};}function patchUpdates(_0x4af4e0){return function(_0x5aa8d8){try{jsonpatch['apply'](_0x5aa8d8,_0x4af4e0,!![]);}catch(_0x151e02){return BPromise['reject'](_0x151e02);}return _0x5aa8d8['save']();};}function saveUpdates(_0x5ca826,_0x33f7e7){return function(_0x2b97c7){if(_0x2b97c7){return _0x2b97c7['update'](_0x5ca826)[_0xc28c('0x21')](function(_0x49b884){return _0x49b884;});}return null;};}function removeEntity(_0x12d48f,_0x2f33a6){return function(_0x4998af){if(_0x4998af){return _0x4998af[_0xc28c('0x22')]()[_0xc28c('0x21')](function(){_0x12d48f[_0xc28c('0x1a')](0xcc)[_0xc28c('0x19')]();});}};}function handleEntityNotFound(_0x3134d1,_0x15cc35){return function(_0x40ab0d){if(!_0x40ab0d){_0x3134d1[_0xc28c('0x18')](0x194);}return _0x40ab0d;};}function handleError(_0xec532b,_0x4f1793){_0x4f1793=_0x4f1793||0x1f4;return function(_0x142ebe){logger[_0xc28c('0x23')](_0x142ebe[_0xc28c('0x24')]);if(_0x142ebe[_0xc28c('0x25')]){delete _0x142ebe[_0xc28c('0x25')];}_0xec532b[_0xc28c('0x1a')](_0x4f1793)['send'](_0x142ebe);};}exports['index']=function(_0x4f749c,_0x4dbb81){var _0x1ba3d4={},_0x18e55c={},_0x27d6dd={'count':0x0,'rows':[]};var _0xd35539=_['map'](db['ChatTransferReport'][_0xc28c('0x26')],function(_0xa79607){return{'name':_0xa79607[_0xc28c('0x27')],'type':_0xa79607[_0xc28c('0x28')][_0xc28c('0x29')]};});_0x18e55c[_0xc28c('0x2a')]=_[_0xc28c('0x2b')](_0xd35539,_0xc28c('0x25'));_0x18e55c['query']=_[_0xc28c('0x2c')](_0x4f749c['query']);_0x18e55c['filters']=_['intersection'](_0x18e55c[_0xc28c('0x2a')],_0x18e55c['query']);_0x1ba3d4[_0xc28c('0x2d')]=_['intersection'](_0x18e55c[_0xc28c('0x2a')],qs[_0xc28c('0x2e')](_0x4f749c['query']['fields']));_0x1ba3d4[_0xc28c('0x2d')]=_0x1ba3d4['attributes'][_0xc28c('0x2f')]?_0x1ba3d4['attributes']:_0x18e55c[_0xc28c('0x2a')];if(!_0x4f749c[_0xc28c('0x30')]['hasOwnProperty'](_0xc28c('0x31'))){_0x1ba3d4['limit']=qs[_0xc28c('0x1e')](_0x4f749c[_0xc28c('0x30')][_0xc28c('0x1e')]);_0x1ba3d4[_0xc28c('0x1d')]=qs['offset'](_0x4f749c['query'][_0xc28c('0x1d')]);}_0x1ba3d4[_0xc28c('0x32')]=qs[_0xc28c('0x33')](_0x4f749c[_0xc28c('0x30')][_0xc28c('0x33')]);_0x1ba3d4['where']=qs[_0xc28c('0x34')](_[_0xc28c('0x35')](_0x4f749c[_0xc28c('0x30')],_0x18e55c[_0xc28c('0x34')]),_0xd35539);if(_0x4f749c[_0xc28c('0x30')][_0xc28c('0x36')]){_0x1ba3d4['where']=_['merge'](_0x1ba3d4[_0xc28c('0x37')],{'$or':_[_0xc28c('0x2b')](_0xd35539,function(_0x2beff1){if(_0x2beff1[_0xc28c('0x28')]!=='VIRTUAL'){var _0x3869be={};_0x3869be[_0x2beff1['name']]={'$like':'%'+_0x4f749c['query'][_0xc28c('0x36')]+'%'};return _0x3869be;}})});}_0x1ba3d4=_['merge']({},_0x1ba3d4,_0x4f749c['options']);var _0x3a00d8={'where':_0x1ba3d4[_0xc28c('0x37')]};return db[_0xc28c('0x38')]['count'](_0x3a00d8)[_0xc28c('0x21')](function(_0x418f33){_0x27d6dd[_0xc28c('0x1c')]=_0x418f33;if(_0x4f749c[_0xc28c('0x30')][_0xc28c('0x39')]){_0x1ba3d4[_0xc28c('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xc28c('0x3b')](_0x1ba3d4);})['then'](function(_0x34d928){_0x27d6dd['rows']=_0x34d928;return _0x27d6dd;})['then'](respondWithFilteredResult(_0x4dbb81,_0x1ba3d4))['catch'](handleError(_0x4dbb81,null));};exports[_0xc28c('0x3c')]=function(_0x3457e5,_0x19bfbb){var _0x28b007={'raw':!![],'where':{'id':_0x3457e5['params']['id']}},_0x52ce04={};_0x52ce04[_0xc28c('0x2a')]=_[_0xc28c('0x2c')](db[_0xc28c('0x38')][_0xc28c('0x26')]);_0x52ce04[_0xc28c('0x30')]=_[_0xc28c('0x2c')](_0x3457e5[_0xc28c('0x30')]);_0x52ce04[_0xc28c('0x34')]=_[_0xc28c('0x3d')](_0x52ce04[_0xc28c('0x2a')],_0x52ce04[_0xc28c('0x30')]);_0x28b007[_0xc28c('0x2d')]=_[_0xc28c('0x3d')](_0x52ce04[_0xc28c('0x2a')],qs[_0xc28c('0x2e')](_0x3457e5[_0xc28c('0x30')][_0xc28c('0x2e')]));_0x28b007['attributes']=_0x28b007[_0xc28c('0x2d')]['length']?_0x28b007['attributes']:_0x52ce04[_0xc28c('0x2a')];if(_0x3457e5['query'][_0xc28c('0x39')]){_0x28b007[_0xc28c('0x3a')]=[{'all':!![]}];}_0x28b007=_[_0xc28c('0x3e')]({},_0x28b007,_0x3457e5[_0xc28c('0x3f')]);return db[_0xc28c('0x38')]['find'](_0x28b007)[_0xc28c('0x21')](handleEntityNotFound(_0x19bfbb,null))[_0xc28c('0x21')](respondWithResult(_0x19bfbb,null))[_0xc28c('0x40')](handleError(_0x19bfbb,null));};exports[_0xc28c('0x41')]=function(_0x46c7c1,_0x2809af){return db['ChatTransferReport'][_0xc28c('0x41')](_0x46c7c1[_0xc28c('0x42')],{})[_0xc28c('0x21')](respondWithResult(_0x2809af,0xc9))[_0xc28c('0x40')](handleError(_0x2809af,null));};exports[_0xc28c('0x43')]=function(_0x3dd417,_0x21cb4c){if(_0x3dd417[_0xc28c('0x42')]['id']){delete _0x3dd417[_0xc28c('0x42')]['id'];}return db['ChatTransferReport'][_0xc28c('0x44')]({'where':{'id':_0x3dd417['params']['id']}})[_0xc28c('0x21')](handleEntityNotFound(_0x21cb4c,null))[_0xc28c('0x21')](saveUpdates(_0x3dd417['body'],null))[_0xc28c('0x21')](respondWithResult(_0x21cb4c,null))[_0xc28c('0x40')](handleError(_0x21cb4c,null));};exports[_0xc28c('0x22')]=function(_0x55aff2,_0x18b73b){return db[_0xc28c('0x38')]['find']({'where':{'id':_0x55aff2[_0xc28c('0x45')]['id']}})[_0xc28c('0x21')](handleEntityNotFound(_0x18b73b,null))[_0xc28c('0x21')](removeEntity(_0x18b73b,null))[_0xc28c('0x40')](handleError(_0x18b73b,null));};exports[_0xc28c('0x46')]=function(_0x17435d,_0x1cd510){return db[_0xc28c('0x38')][_0xc28c('0x46')]()[_0xc28c('0x21')](respondWithResult(_0x1cd510,null))[_0xc28c('0x40')](handleError(_0x1cd510,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index dd9d9df..bc814ff 100644 --- a/server/api/chatTransferReport/chatTransferReport.model.js +++ b/server/api/chatTransferReport/chatTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x413601,_0x59a43a){var _0x24229d=function(_0x17c706){while(--_0x17c706){_0x413601['push'](_0x413601['shift']());}};_0x24229d(++_0x59a43a);}(_0x54ef,0x112));var _0xf54e=function(_0x3508a2,_0x43618e){_0x3508a2=_0x3508a2-0x0;var _0x537259=_0x54ef[_0x3508a2];return _0x537259;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf54e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x34e8,0x12c));var _0x834e=function(_0x3fc056,_0x41564d){_0x3fc056=_0x3fc056-0x0;var _0x78310c=_0x34e8[_0x3fc056];return _0x78310c;};'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 3ed75be..a7d4996 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 _0x11cc=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x11cc,0x110));var _0xc11c=function(_0xbeab9,_0x37ec4a){_0xbeab9=_0xbeab9-0x0;var _0x27650c=_0x11cc[_0xbeab9];return _0x27650c;};'use strict';var _=require(_0xc11c('0x0'));var util=require(_0xc11c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc11c('0x2'));var fs=require('fs');var Redis=require(_0xc11c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc11c('0x4'));var logger=require(_0xc11c('0x5'))(_0xc11c('0x6'));var config=require(_0xc11c('0x7'));var jayson=require(_0xc11c('0x8'));var client=jayson[_0xc11c('0x9')][_0xc11c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fe3b2,_0x385cf0,_0x22a66c){return new BPromise(function(_0x2c4d35,_0x4ed95c){return client['request'](_0x3fe3b2,_0x22a66c)[_0xc11c('0xb')](function(_0x5bed64){logger[_0xc11c('0xc')](_0xc11c('0xd'),_0x385cf0,_0xc11c('0xe'));logger[_0xc11c('0xf')](_0xc11c('0x10'),_0x385cf0,_0xc11c('0xe'),JSON[_0xc11c('0x11')](_0x5bed64));if(_0x5bed64[_0xc11c('0x12')]){if(_0x5bed64[_0xc11c('0x12')][_0xc11c('0x13')]===0x1f4){logger[_0xc11c('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x385cf0,_0x5bed64['error'][_0xc11c('0x14')]);return _0x4ed95c(_0x5bed64[_0xc11c('0x12')][_0xc11c('0x14')]);}logger[_0xc11c('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x385cf0,_0x5bed64['error'][_0xc11c('0x14')]);return _0x2c4d35(_0x5bed64[_0xc11c('0x12')][_0xc11c('0x14')]);}else{logger[_0xc11c('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x385cf0,_0xc11c('0xe'));_0x2c4d35(_0x5bed64[_0xc11c('0x15')][_0xc11c('0x14')]);}})['catch'](function(_0x391a96){logger[_0xc11c('0x12')](_0xc11c('0xd'),_0x385cf0,_0x391a96);_0x4ed95c(_0x391a96);});});} \ No newline at end of file +var _0x2ec4=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x492397,_0xea5f96){var _0x4679f7=function(_0x5d44c0){while(--_0x5d44c0){_0x492397['push'](_0x492397['shift']());}};_0x4679f7(++_0xea5f96);}(_0x2ec4,0x1b1));var _0x42ec=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2ec4[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x42ec('0x0'));var util=require(_0x42ec('0x1'));var moment=require(_0x42ec('0x2'));var BPromise=require(_0x42ec('0x3'));var rs=require(_0x42ec('0x4'));var fs=require('fs');var Redis=require(_0x42ec('0x5'));var db=require(_0x42ec('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x42ec('0x7'))(_0x42ec('0x8'));var config=require(_0x42ec('0x9'));var jayson=require(_0x42ec('0xa'));var client=jayson['client'][_0x42ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56adac,_0x46ef07,_0x375600){return new BPromise(function(_0x4dfe48,_0x218d90){return client[_0x42ec('0xc')](_0x56adac,_0x375600)[_0x42ec('0xd')](function(_0x7746b4){logger['info'](_0x42ec('0xe'),_0x46ef07,_0x42ec('0xf'));logger[_0x42ec('0x10')](_0x42ec('0x11'),_0x46ef07,'request\x20sent',JSON[_0x42ec('0x12')](_0x7746b4));if(_0x7746b4[_0x42ec('0x13')]){if(_0x7746b4[_0x42ec('0x13')]['code']===0x1f4){logger[_0x42ec('0x13')](_0x42ec('0xe'),_0x46ef07,_0x7746b4['error']['message']);return _0x218d90(_0x7746b4['error']['message']);}logger[_0x42ec('0x13')](_0x42ec('0xe'),_0x46ef07,_0x7746b4['error'][_0x42ec('0x14')]);return _0x4dfe48(_0x7746b4[_0x42ec('0x13')][_0x42ec('0x14')]);}else{logger[_0x42ec('0x15')](_0x42ec('0xe'),_0x46ef07,_0x42ec('0xf'));_0x4dfe48(_0x7746b4['result'][_0x42ec('0x14')]);}})[_0x42ec('0x16')](function(_0x49d863){logger[_0x42ec('0x13')](_0x42ec('0xe'),_0x46ef07,_0x49d863);_0x218d90(_0x49d863);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0a6e301..258469e 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x906120,_0x258135){var _0x1a7555=function(_0x383830){while(--_0x383830){_0x906120['push'](_0x906120['shift']());}};_0x1a7555(++_0x258135);}(_0xb7e7,0x121));var _0x7b7e=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xb7e7[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file +var _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x123647,_0x4b16de){var _0x3af80d=function(_0x4b77b0){while(--_0x4b77b0){_0x123647['push'](_0x123647['shift']());}};_0x3af80d(++_0x4b16de);}(_0x0b0e,0x187));var _0xe0b0=function(_0x246115,_0x398123){_0x246115=_0x246115-0x0;var _0x385878=_0x0b0e[_0x246115];return _0x385878;};'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['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 569d560..2cd1479 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 _0xe93a=['sequelize','randomstring','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Thanks\x20you\x20for\x20your\x20time!','Feedback','ENUM','thumb','stringify','name','getDataValue','onlineForm','parse','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x3a2e9a,_0x52f198){var _0x511b2c=function(_0x55bd89){while(--_0x55bd89){_0x3a2e9a['push'](_0x3a2e9a['shift']());}};_0x511b2c(++_0x52f198);}(_0xe93a,0x1a7));var _0xae93=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xe93a[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xae93('0x0'));var rs=require(_0xae93('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xae93('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x3')},'mapKeyOffline':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xae93('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xae93('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xae93('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xae93('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xae93('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xae93('0x2')]},'animation':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xae93('0x8'),_0xae93('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0xa')},'start_chat_button':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0xb')},'download_transcript':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xae93('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0xf')},'closingMessageButton':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xae93('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x10')},'ratingType':{'type':Sequelize[_0xae93('0x11')]('star',_0xae93('0x12')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xae93('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xae93('0xd')],'defaultValue':function(){return JSON[_0xae93('0x13')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xae93('0x14'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xae93('0x3'),'type':_0xae93('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xae93('0x15')](_0xae93('0x16'))?JSON[_0xae93('0x17')](this['getDataValue'](_0xae93('0x16'))):{};},'set':function(_0x19f2fd){return this['setDataValue'](_0xae93('0x16'),JSON[_0xae93('0x13')](_0x19f2fd));}},'offlineForm':{'type':Sequelize[_0xae93('0xd')],'defaultValue':function(){return JSON[_0xae93('0x13')]({'items':[{'type':_0xae93('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xae93('0x3'),'type':_0xae93('0x3')},'variable':null},{'type':_0xae93('0x19'),'config':{'placeholder':_0xae93('0x1a')},'props':{'title':'Comments','helpText':_0xae93('0x1b')}}],'fromKey':0x0});},'get':function(){return this[_0xae93('0x15')](_0xae93('0x1c'))?JSON[_0xae93('0x17')](this['getDataValue'](_0xae93('0x1c'))):{};},'set':function(_0x32258d){return this[_0xae93('0x1d')](_0xae93('0x1c'),JSON['stringify'](_0x32258d));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xae93('0x1e')]();}},'autoclose':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xae93('0x2')]},'forwardOffline':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xae93('0x2')]},'waitingTitle':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x1f')},'waitingMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x20')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x21')},'offlineMessageBody':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x23')},'skipUnmanaged':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x24')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x25')},'enableCustomerAttachment':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xae93('0xd')],'defaultValue':function(){return _0xae93('0x26');}},'notificationSound':{'type':Sequelize[_0xae93('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0xae93('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xae93('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x28')},'defaultTitle':{'type':Sequelize[_0xae93('0x2')]},'customerAvatar':{'type':Sequelize[_0xae93('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xae93('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xae93('0x2')],'allowNull':![],'defaultValue':_0xae93('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae93('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xae93('0x2')],'defaultValue':_0xae93('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae93('0x6')],'comment':_0xae93('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![],'comment':_0xae93('0x2c'),'set':function(_0x2c4395){if(!_0x2c4395)this[_0xae93('0x1d')](_0xae93('0x2d'),null);this['setDataValue'](_0xae93('0x2e'),_0x2c4395);}},'vidaooEscalation':{'type':Sequelize[_0xae93('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xae93('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x49df=['Skip','BOOLEAN','Feedback','ENUM','star','thumb','name','text','onlineForm','getDataValue','setDataValue','stringify','input','textarea','Comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','address','email','Agent','#011F6A','rounded','squared','We\x20are\x20here!','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send'];(function(_0x5d0eb8,_0x40c598){var _0x32d89b=function(_0x31fdf8){while(--_0x31fdf8){_0x5d0eb8['push'](_0x5d0eb8['shift']());}};_0x32d89b(++_0x40c598);}(_0x49df,0xad));var _0xf49d=function(_0x49fffd,_0x534844){_0x49fffd=_0x49fffd-0x0;var _0x4c90ed=_0x49df[_0x49fffd];return _0x4c90ed;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xf49d('0x0')]={'name':{'type':Sequelize[_0xf49d('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xf49d('0x1')],'allowNull':![],'unique':_0xf49d('0x2')},'description':{'type':Sequelize[_0xf49d('0x1')]},'mapKey':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0x3')},'key':{'type':Sequelize[_0xf49d('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x4')},'customerAlias':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf49d('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf49d('0x1')],'allowNull':![],'defaultValue':_0xf49d('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf49d('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf49d('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf49d('0x6'),_0xf49d('0x7')),'defaultValue':_0xf49d('0x6')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0x8')},'start_chat_button':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0x9')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf49d('0xa')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0xb')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf49d('0xc')]},'closingQuestion':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0xd')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0xf')},'noteTitle':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x10')},'closingMessage':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x11')},'closingMessageButton':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x12')},'skipMessageButton':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x15')},'ratingType':{'type':Sequelize[_0xf49d('0x16')](_0xf49d('0x17'),_0xf49d('0x18')),'defaultValue':_0xf49d('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xf49d('0xa')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf49d('0xc')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xf49d('0x19'),'type':_0xf49d('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xf49d('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf49d('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xf49d('0x1b'))?JSON['parse'](this[_0xf49d('0x1c')](_0xf49d('0x1b'))):{};},'set':function(_0xb8dcf8){return this[_0xf49d('0x1d')]('onlineForm',JSON[_0xf49d('0x1e')](_0xb8dcf8));}},'offlineForm':{'type':Sequelize[_0xf49d('0xc')],'defaultValue':function(){return JSON[_0xf49d('0x1e')]({'items':[{'type':_0xf49d('0x1f'),'props':{'title':_0xf49d('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf49d('0x3'),'type':_0xf49d('0x3')},'variable':null},{'type':_0xf49d('0x20'),'config':{'placeholder':_0xf49d('0x21')},'props':{'title':_0xf49d('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xf49d('0x22'))?JSON[_0xf49d('0x23')](this[_0xf49d('0x1c')](_0xf49d('0x22'))):{};},'set':function(_0x43e868){return this[_0xf49d('0x1d')](_0xf49d('0x22'),JSON['stringify'](_0x43e868));}},'token':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':function(){return rs[_0xf49d('0x24')]();}},'autoclose':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf49d('0x1')]},'forwardOffline':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf49d('0x1')]},'waitingTitle':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x13')},'sendUnmanaged':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x12')},'enableCustomerAttachment':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf49d('0xc')]},'showAgentAvatar':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf49d('0xc')],'defaultValue':function(){return _0xf49d('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf49d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0x2a')},'verticalAlignment':{'type':Sequelize[_0xf49d('0xa')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf49d('0x1')],'defaultValue':_0xf49d('0x2b')},'defaultTitle':{'type':Sequelize[_0xf49d('0x1')]},'customerAvatar':{'type':Sequelize[_0xf49d('0xc')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf49d('0xa')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf49d('0x1')],'allowNull':![],'defaultValue':_0xf49d('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf49d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0x2d')},'systemAvatar':{'type':Sequelize[_0xf49d('0xc')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf49d('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':![],'comment':_0xf49d('0x2e'),'set':function(_0x5ebb01){if(!_0x5ebb01)this[_0xf49d('0x1d')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xf49d('0x2f'),_0x5ebb01);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e4866de..9a88631 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 _0x1af0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','save','UserProfileResource','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','VIRTUAL','merge','options','ChatWebsite','findAll','rows','show','Pause','mandatoryDispositionPause','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','find','userProfileId','update','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','includeAll','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','root','download','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','account','Applications','orderBy','applications','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','ListId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','chatLicenseExceeded','Intervals','remote','connection','remoteAddress','virtual','replace','render','alignment','textColor','addApplications','sequelize','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x587a8b,_0x1e62c9){var _0x5487a8=function(_0x6d3d79){while(--_0x6d3d79){_0x587a8b['push'](_0x587a8b['shift']());}};_0x5487a8(++_0x1e62c9);}(_0x1af0,0x10c));var _0x01af=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x1af0[_0x160c73];return _0xd9302;};'use strict';var pdf=require(_0x01af('0x0'));var emlformat=require(_0x01af('0x1'));var rimraf=require(_0x01af('0x2'));var zipdir=require(_0x01af('0x3'));var jsonpatch=require(_0x01af('0x4'));var rp=require(_0x01af('0x5'));var moment=require(_0x01af('0x6'));var BPromise=require(_0x01af('0x7'));var Mustache=require(_0x01af('0x8'));var util=require(_0x01af('0x9'));var path=require('path');var sox=require(_0x01af('0xa'));var csv=require(_0x01af('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x01af('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x01af('0xd'));var toCsv=require(_0x01af('0xb'));var querystring=require(_0x01af('0xe'));var Papa=require(_0x01af('0xf'));var Redis=require('ioredis');var authService=require(_0x01af('0x10'));var qs=require(_0x01af('0x11'));var as=require(_0x01af('0x12'));var hardwareService=require(_0x01af('0x13'));var logger=require(_0x01af('0x14'))(_0x01af('0x15'));var utils=require(_0x01af('0x16'));var config=require(_0x01af('0x17'));var db=require(_0x01af('0x18'))['db'];config['redis']=_[_0x01af('0x19')](config[_0x01af('0x1a')],{'host':_0x01af('0x1b'),'port':0x18eb});var socket=require(_0x01af('0x1c'))(new Redis(config[_0x01af('0x1a')]));require('./chatWebsite.socket')[_0x01af('0x1d')](socket);var jayson=require(_0x01af('0x1e'));var client=jayson['client'][_0x01af('0x1f')]({'port':0x232c});var client9002=jayson[_0x01af('0x20')][_0x01af('0x1f')]({'port':0x232a});var client9003=jayson['client'][_0x01af('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x33cb71,_0x59fad3,_0x292289){if(_0x292289){var _0x592c60=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x592c60[_0x01af('0x21')](_0x59fad3)){return _0x33cb71;}else{throw new db['Sequelize'][(_0x01af('0x22'))](_0x01af('0x23'));}}else{return _0x33cb71;}}function respondWithRpcPromise(_0x549c22,_0xc149f0,_0x3ea4b4,_0x5e4f93){return new BPromise(function(_0x25474b,_0x3b92fa){var _0x56aa57=_0x5e4f93||client;return _0x56aa57[_0x01af('0x24')](_0x549c22,_0x3ea4b4)[_0x01af('0x25')](function(_0x41d344){logger[_0x01af('0x26')]('ChatWebsite,\x20%s,\x20%s',_0xc149f0,_0x01af('0x27'));logger[_0x01af('0x28')](_0x01af('0x29'),_0xc149f0,_0x01af('0x27'),JSON[_0x01af('0x2a')](_0x41d344));if(_0x41d344[_0x01af('0x2b')]){if(_0x41d344[_0x01af('0x2b')][_0x01af('0x2c')]===0x1f4){logger[_0x01af('0x2b')](_0x01af('0x2d'),_0xc149f0,_0x41d344['error'][_0x01af('0x2e')]);return _0x3b92fa(_0x41d344[_0x01af('0x2b')]['message']);}logger[_0x01af('0x2b')](_0x01af('0x2d'),_0xc149f0,_0x41d344['error'][_0x01af('0x2e')]);return _0x25474b(_0x41d344['error']['message']);}else{logger[_0x01af('0x26')](_0x01af('0x2d'),_0xc149f0,_0x01af('0x27'));_0x25474b(_0x41d344[_0x01af('0x2f')][_0x01af('0x2e')]);}})[_0x01af('0x30')](function(_0x4cd0b3){logger[_0x01af('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0xc149f0,_0x4cd0b3);_0x3b92fa(_0x4cd0b3);});});}function respondWithStatusCode(_0x3b293f,_0x5b9758){_0x5b9758=_0x5b9758||0xcc;return function(_0x51a5e1){if(_0x51a5e1){return _0x3b293f['sendStatus'](_0x5b9758);}return _0x3b293f['status'](_0x5b9758)[_0x01af('0x31')]();};}function respondWithResult(_0x306853,_0x35b27b){_0x35b27b=_0x35b27b||0xc8;return function(_0x3f0fae){if(_0x3f0fae){return _0x306853[_0x01af('0x32')](_0x35b27b)[_0x01af('0x33')](_0x3f0fae);}};}function respondWithFilteredResult(_0x4ad2f6,_0x222603){return function(_0x1fe7ac){if(_0x1fe7ac){var _0x3f5e6d=_0x1fe7ac[_0x01af('0x34')],_0x463e8b=_0x222603[_0x01af('0x35')],_0x120880=_0x222603['offset']+_0x222603[_0x01af('0x36')],_0xce1d38;if(_0x120880>=_0x3f5e6d){_0x120880=_0x3f5e6d;_0xce1d38=0xc8;}else{_0xce1d38=0xce;}_0x4ad2f6[_0x01af('0x32')](_0xce1d38);return _0x4ad2f6[_0x01af('0x37')](_0x01af('0x38'),_0x463e8b+'-'+_0x120880+'/'+_0x3f5e6d)[_0x01af('0x33')](_0x1fe7ac);}return null;};}function patchUpdates(_0x50b442){return function(_0x3e570d){try{jsonpatch['apply'](_0x3e570d,_0x50b442,!![]);}catch(_0x22b2f2){return BPromise['reject'](_0x22b2f2);}return _0x3e570d[_0x01af('0x39')]();};}function saveUpdates(_0x433604,_0x1ec0ee){return function(_0x579c1d){if(_0x579c1d){return _0x579c1d['update'](_0x433604)[_0x01af('0x25')](function(_0x1bb96d){return _0x1bb96d;});}return null;};}function removeEntity(_0x4d2f55,_0x3d7e31){return function(_0x498588){if(_0x498588){return _0x498588['destroy']()[_0x01af('0x25')](function(){var _0x340dff=_0x498588['get']({'plain':!![]});var _0x55549b='ChatWebsites';return db[_0x01af('0x3a')][_0x01af('0x3b')]({'where':{'type':_0x55549b,'resourceId':_0x340dff['id']}})[_0x01af('0x25')](function(){return _0x498588;});})[_0x01af('0x25')](function(){_0x4d2f55['status'](0xcc)[_0x01af('0x31')]();});}};}function handleEntityNotFound(_0x522295,_0x43a7a5){return function(_0x190b8b){if(!_0x190b8b){_0x522295[_0x01af('0x3c')](0x194);}return _0x190b8b;};}function handleError(_0x3a4216,_0x4aeb31){_0x4aeb31=_0x4aeb31||0x1f4;return function(_0x517335){logger[_0x01af('0x2b')](_0x517335['stack']);if(_0x517335[_0x01af('0x3d')]){delete _0x517335[_0x01af('0x3d')];}_0x3a4216[_0x01af('0x32')](_0x4aeb31)[_0x01af('0x3e')](_0x517335);};}exports[_0x01af('0x3f')]=function(_0xcab845,_0x4822f0){var _0x18ab60={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x30a898={},_0x464662={'count':0x0,'rows':[]};var _0x2555b2=_[_0x01af('0x40')](db['ChatWebsite'][_0x01af('0x41')],function(_0x1c4669){return{'name':_0x1c4669[_0x01af('0x42')],'type':_0x1c4669[_0x01af('0x43')][_0x01af('0x44')]};});_0x30a898[_0x01af('0x45')]=_[_0x01af('0x40')](_0x2555b2,_0x01af('0x3d'));_0x30a898[_0x01af('0x46')]=_[_0x01af('0x47')](_0xcab845[_0x01af('0x46')]);_0x30a898[_0x01af('0x48')]=_['intersection'](_0x30a898['model'],_0x30a898[_0x01af('0x46')]);_0x18ab60['attributes']=_[_0x01af('0x49')](_0x30a898[_0x01af('0x45')],qs[_0x01af('0x4a')](_0xcab845[_0x01af('0x46')]['fields']));_0x18ab60['attributes']=_0x18ab60[_0x01af('0x4b')][_0x01af('0x4c')]?_0x18ab60['attributes']:_0x30a898[_0x01af('0x45')];if(!_0xcab845['query']['hasOwnProperty']('nolimit')){_0x18ab60[_0x01af('0x36')]=qs[_0x01af('0x36')](_0xcab845[_0x01af('0x46')][_0x01af('0x36')]);_0x18ab60[_0x01af('0x35')]=qs[_0x01af('0x35')](_0xcab845['query'][_0x01af('0x35')]);}_0x18ab60[_0x01af('0x4d')]=qs['sort'](_0xcab845[_0x01af('0x46')][_0x01af('0x4e')]);_0x18ab60['where']=qs['filters'](_[_0x01af('0x4f')](_0xcab845[_0x01af('0x46')],_0x30a898[_0x01af('0x48')]),_0x2555b2);if(_0xcab845[_0x01af('0x46')][_0x01af('0x50')]){_0x18ab60[_0x01af('0x51')]=_['merge'](_0x18ab60[_0x01af('0x51')],{'$or':_[_0x01af('0x40')](_0x2555b2,function(_0xb46cc9){if(_0xb46cc9['type']!==_0x01af('0x52')){var _0x2d46e6={};_0x2d46e6[_0xb46cc9['name']]={'$like':'%'+_0xcab845[_0x01af('0x46')][_0x01af('0x50')]+'%'};return _0x2d46e6;}})});}_0x18ab60=_[_0x01af('0x53')]({},_0x18ab60,_0xcab845[_0x01af('0x54')]);var _0x3f9e21={'where':_0x18ab60[_0x01af('0x51')]};return db[_0x01af('0x55')]['count'](_0x3f9e21)[_0x01af('0x25')](function(_0x5db3c2){_0x464662[_0x01af('0x34')]=_0x5db3c2;if(_0xcab845[_0x01af('0x46')]['includeAll']){_0x18ab60['include']=[{'all':!![]}];}return db[_0x01af('0x55')][_0x01af('0x56')](_0x18ab60);})['then'](function(_0x8411c2){_0x464662[_0x01af('0x57')]=_0x8411c2;return _0x464662;})[_0x01af('0x25')](respondWithFilteredResult(_0x4822f0,_0x18ab60))['catch'](handleError(_0x4822f0,null));};exports[_0x01af('0x58')]=function(_0x1edc22,_0x59c1bb){var _0x219f63={'raw':![],'where':{'id':_0x1edc22['params']['id']},'include':[{'model':db[_0x01af('0x59')],'as':_0x01af('0x5a')}]},_0x34a1fa={};_0x34a1fa['model']=_[_0x01af('0x47')](db['ChatWebsite'][_0x01af('0x41')]);_0x34a1fa[_0x01af('0x46')]=_[_0x01af('0x47')](_0x1edc22['query']);_0x34a1fa[_0x01af('0x48')]=_[_0x01af('0x49')](_0x34a1fa[_0x01af('0x45')],_0x34a1fa[_0x01af('0x46')]);_0x219f63[_0x01af('0x4b')]=_[_0x01af('0x49')](_0x34a1fa['model'],qs[_0x01af('0x4a')](_0x1edc22[_0x01af('0x46')][_0x01af('0x4a')]));_0x219f63[_0x01af('0x4b')]=_0x219f63[_0x01af('0x4b')][_0x01af('0x4c')]?_0x219f63['attributes']:_0x34a1fa[_0x01af('0x45')];if(_0x1edc22[_0x01af('0x46')]['includeAll']){_0x219f63['include']=[{'all':!![]}];}_0x219f63=_['merge']({},_0x219f63,_0x1edc22['options']);return db[_0x01af('0x55')]['find'](_0x219f63)[_0x01af('0x25')](handleEntityNotFound(_0x59c1bb,null))[_0x01af('0x25')](respondWithResult(_0x59c1bb,null))[_0x01af('0x30')](handleError(_0x59c1bb,null));};exports[_0x01af('0x5b')]=function(_0x59b22f,_0x282959){return db[_0x01af('0x55')]['create'](_0x59b22f[_0x01af('0x5c')],{})['then'](function(_0x46e01a){var _0x461394=_0x59b22f[_0x01af('0x5d')][_0x01af('0x5e')]({'plain':!![]});if(!_0x461394)throw new Error(_0x01af('0x5f'));if(_0x461394[_0x01af('0x60')]===_0x01af('0x5d')){var _0x179ed5=_0x46e01a['get']({'plain':!![]});var _0x51e748=_0x01af('0x61');return db['UserProfileSection'][_0x01af('0x62')]({'where':{'name':_0x51e748,'userProfileId':_0x461394[_0x01af('0x63')]},'raw':!![]})[_0x01af('0x25')](function(_0x2b8524){if(_0x2b8524&&_0x2b8524['autoAssociation']===0x0){return db[_0x01af('0x3a')]['create']({'name':_0x179ed5['name'],'resourceId':_0x179ed5['id'],'type':_0x2b8524[_0x01af('0x3d')],'sectionId':_0x2b8524['id']},{})[_0x01af('0x25')](function(){return _0x46e01a;});}else{return _0x46e01a;}})[_0x01af('0x30')](function(_0x1bc363){logger[_0x01af('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bc363);throw _0x1bc363;});}return _0x46e01a;})[_0x01af('0x25')](respondWithResult(_0x282959,0xc9))['catch'](handleError(_0x282959,null));};exports[_0x01af('0x64')]=function(_0x47ecf7,_0x5c0714){if(_0x47ecf7[_0x01af('0x5c')]['id']){delete _0x47ecf7[_0x01af('0x5c')]['id'];}return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x47ecf7[_0x01af('0x65')]['id']},'include':[{'model':db[_0x01af('0x59')],'as':_0x01af('0x5a')}]})[_0x01af('0x25')](handleEntityNotFound(_0x5c0714,null))[_0x01af('0x25')](saveUpdates(_0x47ecf7['body'],null))[_0x01af('0x25')](respondWithResult(_0x5c0714,null))[_0x01af('0x30')](handleError(_0x5c0714,null));};exports[_0x01af('0x3b')]=function(_0x215792,_0x319cd6){return db[_0x01af('0x55')]['find']({'where':{'id':_0x215792[_0x01af('0x65')]['id']}})['then'](handleEntityNotFound(_0x319cd6,null))['then'](removeEntity(_0x319cd6,null))[_0x01af('0x30')](handleError(_0x319cd6,null));};exports[_0x01af('0x66')]=function(_0x1082c8,_0x5c6062){return db[_0x01af('0x55')][_0x01af('0x66')]()[_0x01af('0x25')](respondWithResult(_0x5c6062,null))[_0x01af('0x30')](handleError(_0x5c6062,null));};exports[_0x01af('0x67')]=function(_0x282d5b,_0x4185c4,_0x2a3429){if(_0x282d5b[_0x01af('0x5c')]['id']){delete _0x282d5b['body']['id'];}return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x282d5b[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x4185c4,null))['then'](function(_0x4460ce){if(_0x4460ce){_0x282d5b[_0x01af('0x5c')][_0x01af('0x68')]=_0x4460ce['id'];return db[_0x01af('0x69')]['create'](_0x282d5b[_0x01af('0x5c')]);}})['then'](respondWithResult(_0x4185c4,null))[_0x01af('0x30')](handleError(_0x4185c4,null));};exports[_0x01af('0x6a')]=function(_0x194736,_0x363be8,_0x4cc691){var _0x17a977={'raw':![],'where':{}};var _0x2ae840={};var _0x63cc53={'count':0x0,'rows':[]};return db[_0x01af('0x55')]['findOne']({'where':{'id':_0x194736[_0x01af('0x65')]['id']}})['then'](handleEntityNotFound(_0x363be8,null))['then'](function(_0xb79fba){if(_0xb79fba){_0x2ae840[_0x01af('0x45')]=_[_0x01af('0x47')](db['Disposition'][_0x01af('0x41')]);_0x2ae840[_0x01af('0x46')]=_['keys'](_0x194736[_0x01af('0x46')]);_0x2ae840[_0x01af('0x48')]=_[_0x01af('0x49')](_0x2ae840['model'],_0x2ae840[_0x01af('0x46')]);_0x17a977[_0x01af('0x4b')]=_[_0x01af('0x49')](_0x2ae840[_0x01af('0x45')],qs['fields'](_0x194736[_0x01af('0x46')][_0x01af('0x4a')]));_0x17a977[_0x01af('0x4b')]=_0x17a977['attributes'][_0x01af('0x4c')]?_0x17a977[_0x01af('0x4b')]:_0x2ae840[_0x01af('0x45')];if(!_0x194736[_0x01af('0x46')][_0x01af('0x6b')]('nolimit')){_0x17a977[_0x01af('0x36')]=qs[_0x01af('0x36')](_0x194736[_0x01af('0x46')][_0x01af('0x36')]);_0x17a977['offset']=qs[_0x01af('0x35')](_0x194736['query'][_0x01af('0x35')]);}_0x17a977[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x194736[_0x01af('0x46')][_0x01af('0x4e')]);_0x17a977[_0x01af('0x51')]=qs[_0x01af('0x48')](_[_0x01af('0x4f')](_0x194736['query'],_0x2ae840['filters']));_0x17a977[_0x01af('0x51')][_0x01af('0x68')]=_0xb79fba['id'];if(_0x194736[_0x01af('0x46')][_0x01af('0x50')]){_0x17a977[_0x01af('0x51')]=_[_0x01af('0x53')](_0x17a977['where'],{'$or':_['map'](_0x17a977['attributes'],function(_0x2621d3){var _0x9f4cc2={};_0x9f4cc2[_0x2621d3]={'$like':'%'+_0x194736[_0x01af('0x46')]['filter']+'%'};return _0x9f4cc2;})});}_0x17a977=_[_0x01af('0x53')]({},_0x17a977,_0x194736['options']);return db[_0x01af('0x69')][_0x01af('0x34')]({'where':_0x17a977[_0x01af('0x51')]})['then'](function(_0x1588b8){_0x63cc53[_0x01af('0x34')]=_0x1588b8;if(_0x194736[_0x01af('0x46')][_0x01af('0x6c')]){_0x17a977[_0x01af('0x6d')]=[{'all':!![]}];}return db[_0x01af('0x69')][_0x01af('0x56')](_0x17a977);})[_0x01af('0x25')](function(_0x1c31a2){_0x63cc53[_0x01af('0x57')]=_0x1c31a2;return _0x63cc53;});}})[_0x01af('0x25')](respondWithFilteredResult(_0x363be8,_0x17a977))['catch'](handleError(_0x363be8,null));};exports[_0x01af('0x6e')]=function(_0x37c52f,_0x276faf,_0x110f36){return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x37c52f['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x276faf,null))['then'](function(_0xadc8a0){if(_0xadc8a0){return _0xadc8a0['removeDispositions'](_0x37c52f[_0x01af('0x46')][_0x01af('0x6f')]);}})['then'](respondWithStatusCode(_0x276faf,null))[_0x01af('0x30')](handleError(_0x276faf,null));};exports[_0x01af('0x70')]=function(_0x3192d6,_0x1fc21d,_0x4a88a7){if(_0x3192d6[_0x01af('0x5c')]['id']){delete _0x3192d6[_0x01af('0x5c')]['id'];}return db[_0x01af('0x55')]['find']({'where':{'id':_0x3192d6[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x1fc21d,null))[_0x01af('0x25')](function(_0x3b0e72){if(_0x3b0e72){_0x3192d6[_0x01af('0x5c')][_0x01af('0x68')]=_0x3b0e72['id'];return db[_0x01af('0x71')][_0x01af('0x5b')](_0x3192d6['body']);}})[_0x01af('0x25')](respondWithResult(_0x1fc21d,null))[_0x01af('0x30')](handleError(_0x1fc21d,null));};exports[_0x01af('0x72')]=function(_0x5c8890,_0x48c238,_0x58bbab){var _0x4546d5={'raw':![],'where':{}};var _0x14d9ad={};var _0x200aac={'count':0x0,'rows':[]};return db[_0x01af('0x55')][_0x01af('0x73')]({'where':{'id':_0x5c8890[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x48c238,null))['then'](function(_0x11a1eb){if(_0x11a1eb){_0x14d9ad[_0x01af('0x45')]=_[_0x01af('0x47')](db[_0x01af('0x71')][_0x01af('0x41')]);_0x14d9ad['query']=_[_0x01af('0x47')](_0x5c8890[_0x01af('0x46')]);_0x14d9ad['filters']=_['intersection'](_0x14d9ad[_0x01af('0x45')],_0x14d9ad[_0x01af('0x46')]);_0x4546d5[_0x01af('0x4b')]=_['intersection'](_0x14d9ad[_0x01af('0x45')],qs[_0x01af('0x4a')](_0x5c8890[_0x01af('0x46')][_0x01af('0x4a')]));_0x4546d5[_0x01af('0x4b')]=_0x4546d5['attributes'][_0x01af('0x4c')]?_0x4546d5[_0x01af('0x4b')]:_0x14d9ad[_0x01af('0x45')];if(!_0x5c8890[_0x01af('0x46')][_0x01af('0x6b')](_0x01af('0x74'))){_0x4546d5[_0x01af('0x36')]=qs['limit'](_0x5c8890[_0x01af('0x46')][_0x01af('0x36')]);_0x4546d5[_0x01af('0x35')]=qs[_0x01af('0x35')](_0x5c8890[_0x01af('0x46')][_0x01af('0x35')]);}_0x4546d5[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x5c8890[_0x01af('0x46')][_0x01af('0x4e')]);_0x4546d5[_0x01af('0x51')]=qs[_0x01af('0x48')](_['pick'](_0x5c8890[_0x01af('0x46')],_0x14d9ad[_0x01af('0x48')]));_0x4546d5['where']['ChatWebsiteId']=_0x11a1eb['id'];if(_0x5c8890['query'][_0x01af('0x50')]){_0x4546d5[_0x01af('0x51')]=_['merge'](_0x4546d5['where'],{'$or':_[_0x01af('0x40')](_0x4546d5[_0x01af('0x4b')],function(_0x3f5a07){var _0x3d0f3e={};_0x3d0f3e[_0x3f5a07]={'$like':'%'+_0x5c8890['query']['filter']+'%'};return _0x3d0f3e;})});}_0x4546d5=_[_0x01af('0x53')]({},_0x4546d5,_0x5c8890[_0x01af('0x54')]);return db[_0x01af('0x71')]['count']({'where':_0x4546d5[_0x01af('0x51')]})['then'](function(_0x1182a0){_0x200aac['count']=_0x1182a0;if(_0x5c8890[_0x01af('0x46')][_0x01af('0x6c')]){_0x4546d5[_0x01af('0x6d')]=[{'all':!![]}];}return db[_0x01af('0x71')]['findAll'](_0x4546d5);})['then'](function(_0x28470e){_0x200aac['rows']=_0x28470e;return _0x200aac;});}})['then'](respondWithFilteredResult(_0x48c238,_0x4546d5))[_0x01af('0x30')](handleError(_0x48c238,null));};exports['removeAnswers']=function(_0x17e137,_0x1dfff3,_0xc23a8b){return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x17e137[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x1dfff3,null))[_0x01af('0x25')](function(_0x2977f6){if(_0x2977f6){return _0x2977f6[_0x01af('0x75')](_0x17e137[_0x01af('0x46')]['ids']);}})[_0x01af('0x25')](respondWithStatusCode(_0x1dfff3,null))[_0x01af('0x30')](handleError(_0x1dfff3,null));};exports['addLogo']=function(_0x4c0432,_0x4d7179,_0x45169a){_0x4c0432['body'][_0x01af('0x76')]=_0x4c0432['file'][_0x01af('0x77')];return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x4c0432['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x4d7179,null))[_0x01af('0x25')](saveUpdates(_0x4c0432[_0x01af('0x5c')],null))[_0x01af('0x25')](respondWithResult(_0x4d7179,null))['catch'](handleError(_0x4d7179,null));};exports[_0x01af('0x78')]=function(_0x2da4bf,_0x4d9ac2,_0xcee7ac){_0x2da4bf[_0x01af('0x5c')]['agentAvatar']=_0x2da4bf[_0x01af('0x79')][_0x01af('0x77')];return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x2da4bf[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x4d9ac2,null))[_0x01af('0x25')](saveUpdates(_0x2da4bf['body'],null))['then'](respondWithResult(_0x4d9ac2,null))[_0x01af('0x30')](handleError(_0x4d9ac2,null));};exports[_0x01af('0x7a')]=function(_0x17fd0b,_0xc289e1,_0x5dc8aa){_0x17fd0b[_0x01af('0x5c')][_0x01af('0x7b')]=_0x17fd0b[_0x01af('0x79')][_0x01af('0x77')];return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x17fd0b[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0xc289e1,null))['then'](saveUpdates(_0x17fd0b[_0x01af('0x5c')],null))['then'](respondWithResult(_0xc289e1,null))['catch'](handleError(_0xc289e1,null));};exports['addSystemAvatar']=function(_0x50e5f4,_0x74df6a,_0x16bd61){_0x50e5f4['body'][_0x01af('0x7c')]=_0x50e5f4[_0x01af('0x79')]['filename'];return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x50e5f4[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x74df6a,null))[_0x01af('0x25')](saveUpdates(_0x50e5f4[_0x01af('0x5c')],null))[_0x01af('0x25')](respondWithResult(_0x74df6a,null))[_0x01af('0x30')](handleError(_0x74df6a,null));};exports['getLogo']=function(_0x1d3aeb,_0x289d53,_0x39933e){var _0x2150d1=path[_0x01af('0x7d')](config['root'],_0x01af('0x7e'));var _0x28ee61={'where':{'id':_0x1d3aeb[_0x01af('0x65')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x431226=![];return require(_0x01af('0x7f'))[_0x01af('0x80')]()[_0x01af('0x25')](function(_0x2bc5c4){if(_0x2bc5c4){_0x431226=_0x2bc5c4[_0x01af('0x81')];}})[_0x01af('0x25')](function(){return db[_0x01af('0x55')][_0x01af('0x62')](_0x28ee61);})[_0x01af('0x25')](handleEntityNotFound(_0x289d53,null))[_0x01af('0x25')](function(_0x31b412){if(_0x31b412){if(!_[_0x01af('0x82')](_0x31b412[_0x01af('0x76')])){if(fs[_0x01af('0x83')](path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/images/logos/',_0x31b412[_0x01af('0x76')]))&&_0x431226){_0x2150d1=path['join'](config[_0x01af('0x84')],'server/files/images/logos/',_0x31b412['sitepic']);}}return _0x289d53[_0x01af('0x85')](_0x2150d1);}})[_0x01af('0x30')](handleError(_0x289d53,null));};exports['getAvatar']=function(_0x353fdf,_0x2b1e2d,_0x4ba497){var _0x38caa0=path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/images/avatars/default_avatar.png');var _0x4fdaa2={'where':{'id':_0x353fdf[_0x01af('0x65')]['id']},'attributes':['id',_0x01af('0x86')],'raw':!![]};return db[_0x01af('0x55')][_0x01af('0x62')](_0x4fdaa2)[_0x01af('0x25')](handleEntityNotFound(_0x2b1e2d,null))[_0x01af('0x25')](function(_0x211d32){if(_0x211d32){if(!_[_0x01af('0x82')](_0x211d32[_0x01af('0x86')])){if(fs[_0x01af('0x83')](path[_0x01af('0x7d')](config[_0x01af('0x84')],_0x01af('0x87'),_0x211d32[_0x01af('0x86')]))){_0x38caa0=path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/images/avatars/',_0x211d32['agentAvatar']);}}return _0x2b1e2d[_0x01af('0x85')](_0x38caa0);}})['catch'](handleError(_0x2b1e2d,null));};exports[_0x01af('0x88')]=function(_0x34e901,_0x86629e,_0x589017){var _0x48c43d=path['join'](config['root'],_0x01af('0x89'));var _0x3b4424={'where':{'id':_0x34e901[_0x01af('0x65')]['id']},'attributes':['id','customerAvatar',_0x01af('0x8a')],'raw':!![]};return db[_0x01af('0x55')][_0x01af('0x62')](_0x3b4424)[_0x01af('0x25')](handleEntityNotFound(_0x86629e,null))[_0x01af('0x25')](function(_0xf97946){if(_0xf97946){if(!_[_0x01af('0x82')](_0xf97946[_0x01af('0x7b')])){if(fs[_0x01af('0x83')](path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/images/avatars/',_0xf97946['customerAvatar']))&&_0xf97946['showCustomerAvatar']){_0x48c43d=path[_0x01af('0x7d')](config[_0x01af('0x84')],_0x01af('0x87'),_0xf97946[_0x01af('0x7b')]);}}return _0x86629e[_0x01af('0x85')](_0x48c43d);}})[_0x01af('0x30')](handleError(_0x86629e,null));};exports['getSystemAvatar']=function(_0x2a27da,_0x198251,_0x1f7d1e){var _0x4d329f=path['join'](config[_0x01af('0x84')],_0x01af('0x8b'));var _0x279cde={'where':{'id':_0x2a27da['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x01af('0x55')][_0x01af('0x62')](_0x279cde)[_0x01af('0x25')](handleEntityNotFound(_0x198251,null))[_0x01af('0x25')](function(_0x5223f4){if(_0x5223f4){if(!_['isNil'](_0x5223f4[_0x01af('0x7c')])){if(fs[_0x01af('0x83')](path[_0x01af('0x7d')](config['root'],_0x01af('0x87'),_0x5223f4[_0x01af('0x7c')]))){_0x4d329f=path['join'](config['root'],_0x01af('0x87'),_0x5223f4[_0x01af('0x7c')]);}}return _0x198251[_0x01af('0x85')](_0x4d329f);}})['catch'](handleError(_0x198251,null));};exports[_0x01af('0x8c')]=function(_0x25ac55,_0x4ed4a6,_0x3031d9){var _0x40f7b8=require(_0x01af('0x8d'));var _0x237d0a=new _0x40f7b8();var _0x261012=_0x237d0a[_0x01af('0x8e')](_0x25ac55[_0x01af('0x8f')][_0x01af('0x90')])['getResult']();var _0x34fc23={'body':_0x25ac55[_0x01af('0x5c')],'channel':_0x01af('0x91')};var _0x53631f=[];var _0x5935e1=[];var _0x522860={};var _0x5376b6=![];return db[_0x01af('0x92')]['describe']()[_0x01af('0x25')](function(_0x2e8175){if(!_0x2e8175){throw new db['Sequelize'][(_0x01af('0x22'))](_0x01af('0x93'));}_0x53631f=_['difference'](_[_0x01af('0x47')](_0x2e8175),[_0x01af('0x94'),_0x01af('0x95')]);_0x5935e1=_[_0x01af('0x96')](_[_0x01af('0x47')](_0x2e8175),[_0x01af('0x94'),_0x01af('0x95'),_0x01af('0x97'),'ListId']);if(_0x25ac55[_0x01af('0x5c')]['id']){delete _0x25ac55[_0x01af('0x5c')]['id'];}if(_[_0x01af('0x82')](_0x25ac55['body'][_0x01af('0x98')])){throw new db[(_0x01af('0x99'))][(_0x01af('0x22'))]('from\x20is\x20mandatory');}if(_[_0x01af('0x82')](_0x25ac55['body'][_0x01af('0x5c')])||_0x25ac55['body']['body']===''){throw new db[(_0x01af('0x99'))]['ValidationError'](_0x01af('0x9a'));}if(_['isNil'](_0x25ac55['body']['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5935e1);}if(!_[_0x01af('0x9b')](_0x5935e1,_0x25ac55[_0x01af('0x5c')][_0x01af('0x9c')])){throw new db[(_0x01af('0x99'))][(_0x01af('0x22'))](_0x01af('0x9d')+_0x5935e1);}_0x522860[_0x25ac55[_0x01af('0x5c')][_0x01af('0x9c')]]=_0x25ac55[_0x01af('0x5c')]['from'];})[_0x01af('0x25')](function(){return db[_0x01af('0x55')][_0x01af('0x62')]({'where':{'id':_0x25ac55[_0x01af('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x01af('0x9e'),'include':[{'model':db['CmContact'],'as':_0x01af('0x9f'),'where':_0x522860,'limit':0x1,'order':[[_0x01af('0x95'),_0x01af('0xa0')]]}]},{'model':db[_0x01af('0xa1')],'as':'Applications'}]});})[_0x01af('0x25')](handleEntityNotFound(_0x4ed4a6,null))[_0x01af('0x25')](function(_0x539f35){if(_0x539f35&&_0x539f35[_0x01af('0x9e')]){_0x34fc23[_0x01af('0xa2')]=_0x539f35;_0x34fc23['applications']=_0x539f35[_0x01af('0xa3')];_0x34fc23['list']=_0x539f35[_0x01af('0x9e')];_0x34fc23['applications']=_[_0x01af('0xa4')](_0x34fc23[_0x01af('0xa5')],[_0x01af('0xa6')],[_0x01af('0xa7')]);if(_0x34fc23[_0x01af('0xa2')][_0x01af('0xa3')]){delete _0x34fc23[_0x01af('0xa2')][_0x01af('0xa3')];}if(_0x34fc23['account'][_0x01af('0x9e')]&&_0x34fc23[_0x01af('0xa2')]['List']['Contacts'][_0x01af('0x4c')]){return _0x34fc23[_0x01af('0xa2')][_0x01af('0x9e')][_0x01af('0x9f')][0x0];}var _0x2578b1=_[_0x01af('0x19')](_0x25ac55[_0x01af('0x5c')],{'firstName':_0x25ac55[_0x01af('0x5c')][_0x01af('0x98')],'ListId':_0x539f35['ListId']});_0x2578b1[_0x25ac55[_0x01af('0x5c')]['mapKey']]=_0x25ac55[_0x01af('0x5c')][_0x01af('0x98')];return db[_0x01af('0x92')][_0x01af('0x5b')](_0x2578b1,{'fields':_0x53631f,'raw':!![]});}})[_0x01af('0x25')](handleEntityNotFound(_0x4ed4a6,null))['then'](function(_0x824dc0){_0x34fc23[_0x01af('0xa8')]=_0x824dc0;var _0x2c9a5a=_0x25ac55['body'][_0x01af('0xa9')];if(_0x25ac55[_0x01af('0x8f')][_0x01af('0xaa')]){_0x2c9a5a=_0x25ac55[_0x01af('0x8f')][_0x01af('0xaa')];}else if(_0x25ac55[_0x01af('0x8f')][_0x01af('0xab')]){_0x2c9a5a=_['first'](_0x25ac55[_0x01af('0x8f')][_0x01af('0xab')][_0x01af('0xac')](','));}if(_0x824dc0){var _0x1b675d={'ContactId':_0x824dc0['id'],'ChatWebsiteId':_0x25ac55[_0x01af('0x65')]['id'],'from':(_0x824dc0['firstName']||'')+'\x20'+(_0x824dc0[_0x01af('0xad')]||''),'customerIp':_0x2c9a5a,'customerPort':_0x25ac55[_0x01af('0x8f')][_0x01af('0xae')]?_0x25ac55[_0x01af('0x8f')][_0x01af('0xae')]:null,'referer':_0x25ac55[_0x01af('0x5c')][_0x01af('0xaf')],'browserName':_0x261012[_0x01af('0xb0')][_0x01af('0x3d')]&&_0x261012[_0x01af('0xb0')][_0x01af('0xb1')]?util[_0x01af('0xb2')](_0x01af('0xb3'),_0x261012[_0x01af('0xb0')]['name'],_0x261012[_0x01af('0xb0')][_0x01af('0xb1')]):_0x01af('0xb4'),'browserVersion':_0x261012[_0x01af('0xb0')][_0x01af('0xb1')]||'unknown','osName':util[_0x01af('0xb2')](_0x01af('0xb3'),_0x261012['os'][_0x01af('0x3d')],_0x261012['os']['version']),'osVersion':_0x261012['os'][_0x01af('0xb1')],'deviceModel':_0x261012[_0x01af('0xb5')][_0x01af('0x45')]&&_0x261012[_0x01af('0xb5')][_0x01af('0xb6')]?util[_0x01af('0xb2')](_0x01af('0xb7'),_0x261012['device'][_0x01af('0x45')],_0x261012['device'][_0x01af('0xb6')],_0x261012[_0x01af('0xb5')]['type']):null,'deviceVendor':_0x261012[_0x01af('0xb5')][_0x01af('0xb6')],'deviceType':_0x261012[_0x01af('0xb5')][_0x01af('0x43')],'formData':JSON[_0x01af('0x2a')](_0x25ac55[_0x01af('0x5c')])};var _0x518530={'ChatWebsiteId':_0x25ac55['params']['id'],'closed':![]};if(_0x25ac55[_0x01af('0x5c')][_0x01af('0xb8')]){_0x518530[_0x01af('0xb8')]=_0x25ac55[_0x01af('0x5c')][_0x01af('0xb8')];return db[_0x01af('0xb9')]['find']({'where':_0x518530})[_0x01af('0x25')](function(_0x1eb582){if(_0x1eb582){return[_0x1eb582,![]];}_0x1b675d['threadId']=_0x25ac55[_0x01af('0x5c')]['threadId'];_0x1b675d[_0x01af('0xba')]=_0x25ac55['body'][_0x01af('0xba')];return db[_0x01af('0xb9')][_0x01af('0x5b')](_0x1b675d)['then'](function(_0x313bc5){return[_0x313bc5,!![]];});});}_0x518530[_0x01af('0xbb')]=_0x824dc0['id'];if(_0x25ac55[_0x01af('0x5c')][_0x01af('0xbc')]&&_0x25ac55[_0x01af('0x5c')][_0x01af('0xbc')]['id']){_0x518530['id']=_0x25ac55[_0x01af('0x5c')][_0x01af('0xbc')]['id'];return db[_0x01af('0xb9')]['find']({'where':_0x518530})[_0x01af('0x25')](function(_0x1f126a){if(_0x1f126a){return[_0x1f126a,![]];}return db[_0x01af('0xb9')]['create'](_0x1b675d)[_0x01af('0x25')](function(_0x443996){return[_0x443996,!![]];});});}return db['ChatInteraction'][_0x01af('0x5b')](_0x1b675d)[_0x01af('0x25')](function(_0x896c3e){return[_0x896c3e,!![]];});}})[_0x01af('0xbd')](function(_0x3040a6,_0x1090fd){if(_0x3040a6){_0x5376b6=_0x1090fd;if(!_0x1090fd){var _0x3861ad={'from':(_0x34fc23[_0x01af('0xa8')][_0x01af('0xbe')]||'')+'\x20'+(_0x34fc23[_0x01af('0xa8')][_0x01af('0xad')]||'')};if(_0x25ac55[_0x01af('0x5c')][_0x01af('0xb8')]&&_0x25ac55[_0x01af('0x5c')][_0x01af('0xbf')]&&_0x25ac55[_0x01af('0x5c')]['threadId']!=_0x25ac55[_0x01af('0x5c')][_0x01af('0xbf')]){_0x3861ad['threadId']=_0x25ac55[_0x01af('0x5c')][_0x01af('0xbf')];}return _0x3040a6[_0x01af('0x64')](_0x3861ad);}else{return _0x3040a6;}}})['then'](function(_0x28747a){_0x34fc23[_0x01af('0xbc')]=_0x28747a[_0x01af('0x5e')]({'plain':!![]});_0x34fc23[_0x01af('0xbc')][_0x01af('0xc0')]=_0x5376b6;if(_0x34fc23[_0x01af('0xbc')][_0x01af('0xc0')]){if(_0x34fc23[_0x01af('0xa2')][_0x01af('0xc1')]){_0x34fc23['applications'][_0x01af('0xc2')]({'id':0x0,'priority':_0x34fc23[_0x01af('0xa5')][_0x01af('0x4c')]+0x1,'app':_0x01af('0xc3'),'appdata':_0x01af('0xc4'),'interval':_0x01af('0xc5')});}}return db[_0x01af('0xc6')][_0x01af('0x5b')]({'body':_0x25ac55[_0x01af('0x5c')][_0x01af('0x5c')],'ChatWebsiteId':_0x25ac55[_0x01af('0x65')]['id'],'ChatInteractionId':_0x28747a['id'],'direction':'in','ContactId':_0x34fc23['contact']['id'],'AttachmentId':_0x25ac55['body'][_0x01af('0xc7')]});})[_0x01af('0x25')](function(_0x2d1895){_0x34fc23[_0x01af('0x2e')]=_0x2d1895;if(_0x34fc23['interaction'][_0x01af('0xc8')]){return db[_0x01af('0xc9')][_0x01af('0x62')]({'attributes':['id',_0x01af('0x3d')],'where':{'id':_0x34fc23['interaction'][_0x01af('0xc8')]}})[_0x01af('0x25')](function(_0x24abbf){if(_0x24abbf){_0x34fc23['applications'][_0x01af('0xca')]({'id':0x0,'priority':0x0,'app':_0x01af('0xcb'),'appdata':_0x24abbf[_0x01af('0x3d')]+','+(_0x34fc23[_0x01af('0xa2')][_0x01af('0xcc')]||0xa),'interval':'*,*,*,*'});_0x34fc23[_0x01af('0xcd')]=!![];}return respondWithRpcPromise(_0x01af('0xce'),_0x01af('0xcf'),_0x34fc23);});}return respondWithRpcPromise(_0x01af('0xce'),'startRouting',_0x34fc23);})['then'](function(_0x9df0e7){respondWithRpcPromise('EventManager',_0x01af('0xd0'),{'event':_0x01af('0x8c'),'message':_0x9df0e7},client9002);return _0x9df0e7;})[_0x01af('0x25')](respondWithResult(_0x4ed4a6,null))[_0x01af('0x30')](handleError(_0x4ed4a6,null));};exports[_0x01af('0xd1')]=function(_0x45632b,_0x4bbf8f,_0x2704d3){var _0x1a57bb,_0x1214ac,_0xe5648d;var _0x2c360a=[];var _0x5ca629=[];var _0x118c3b={};return db['CmContact'][_0x01af('0x66')]()[_0x01af('0x25')](function(_0x15d7b0){if(!_0x15d7b0){throw new db[(_0x01af('0x99'))][(_0x01af('0x22'))](_0x01af('0x93'));}_0x5ca629=_[_0x01af('0x96')](_['keys'](_0x15d7b0),[_0x01af('0x94'),_0x01af('0x95')]);_0x2c360a=_[_0x01af('0x96')](_[_0x01af('0x47')](_0x15d7b0),[_0x01af('0x94'),_0x01af('0x95'),_0x01af('0x97'),_0x01af('0xd2')]);if(_0x45632b['body']['id']){delete _0x45632b['body']['id'];}if(_[_0x01af('0x82')](_0x45632b[_0x01af('0x5c')]['from'])){throw _0x4bbf8f[_0x01af('0x32')](0x1f4)[_0x01af('0x3e')](new db['Sequelize']['ValidationError'](_0x01af('0xd3')));}if(_['isNil'](_0x45632b[_0x01af('0x5c')]['body'])||_0x45632b[_0x01af('0x5c')]['body']===''){throw _0x4bbf8f[_0x01af('0x32')](0x1f4)[_0x01af('0x3e')](new db[(_0x01af('0x99'))][(_0x01af('0x22'))](_0x01af('0x9a')));}if(_[_0x01af('0x82')](_0x45632b[_0x01af('0x5c')][_0x01af('0xd4')])){throw _0x4bbf8f[_0x01af('0x32')](0x1f4)[_0x01af('0x3e')](new db[(_0x01af('0x99'))]['ValidationError'](_0x01af('0xd5')+_0x2c360a));}if(!_[_0x01af('0x9b')](_0x2c360a,_0x45632b[_0x01af('0x5c')][_0x01af('0xd4')])){throw _0x4bbf8f[_0x01af('0x32')](0x1f4)[_0x01af('0x3e')](new db['Sequelize']['ValidationError'](_0x01af('0xd6')+_0x2c360a));}_0x118c3b[_0x45632b[_0x01af('0x5c')][_0x01af('0xd4')]]=_0x45632b[_0x01af('0x5c')]['from'];})[_0x01af('0x25')](function(){return db[_0x01af('0x55')]['find']({'where':{'id':_0x45632b['params']['id']},'include':[{'model':db[_0x01af('0xd7')],'as':_0x01af('0x9e')}]});})[_0x01af('0x25')](handleEntityNotFound(_0x4bbf8f,null))[_0x01af('0x25')](function(_0x37f949){if(_0x37f949&&_0x37f949[_0x01af('0x9e')]){_0x1214ac=_0x37f949;var _0x154df8=_[_0x01af('0x19')](_0x45632b[_0x01af('0x5c')],{'firstName':_0x45632b['body'][_0x01af('0x98')],'phone':_0x45632b[_0x01af('0x5c')][_0x01af('0x98')],'ListId':_0x37f949[_0x01af('0xd2')]});_0x154df8[_0x45632b['body'][_0x01af('0xd4')]]=_0x45632b['body'][_0x01af('0x98')];return db[_0x01af('0x92')][_0x01af('0xd8')]({'where':_0x118c3b,'defaults':_0x154df8});}})[_0x01af('0xbd')](function(_0x3f5e54){if(_0x3f5e54){_0xe5648d=_0x3f5e54;var _0x5dbc93=fs['readFileSync'](path[_0x01af('0x7d')](config['root'],_0x01af('0xd9')),_0x01af('0xda'));var _0x3a8ce6=ejs['render'](_0x5dbc93,{'body':_[_0x01af('0xdb')](_0x45632b[_0x01af('0x5c')]['body']),'bodyTitle':_0x1214ac[_0x01af('0xdc')]});return db[_0x01af('0xdd')][_0x01af('0x5b')]({'body':_0x3a8ce6,'ContactId':_0x3f5e54['id'],'ChatWebsiteId':_0x1214ac['id']});}})[_0x01af('0x25')](function(_0x46b683){if(_0x46b683){_0x1a57bb=_0x46b683;return db[_0x01af('0xde')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x01af('0xdf')],'as':_0x01af('0xe0'),'raw':!![]}]});}})[_0x01af('0x25')](function(_0x252f30){if(_0x252f30&&_0x252f30[_0x01af('0xe0')]&&_0x1214ac[_0x01af('0xe1')]){var _0x1f565b={'tls':{'rejectUnauthorized':![]}};if(_0x252f30[_0x01af('0xe0')][_0x01af('0xe2')]){_0x1f565b[_0x01af('0xe2')]=_0x252f30[_0x01af('0xe0')][_0x01af('0xe2')];}else{_0x1f565b['host']=_0x252f30[_0x01af('0xe0')][_0x01af('0xe3')];_0x1f565b[_0x01af('0xe4')]=_0x252f30['Smtp'][_0x01af('0xe4')];_0x1f565b[_0x01af('0xe5')]=_0x252f30[_0x01af('0xe0')]['secure'];}if(_0x252f30['Smtp']['authentication']){_0x1f565b[_0x01af('0xe6')]={'user':_0x252f30['Smtp'][_0x01af('0x5d')],'pass':_0x252f30[_0x01af('0xe0')]['pass']};}return respondWithRpcPromise('SendMail',_0x01af('0xe7'),{'account':_0x1f565b,'message':{'from':util['format'](_0x01af('0xe8'),_0x252f30['name'],_0x252f30[_0x01af('0xe9')]||_0x252f30[_0x01af('0xe0')][_0x01af('0x5d')]),'to':_0x1214ac[_0x01af('0xe1')],'subject':_0x1214ac['offlineMessageSubject'],'text':_0x1a57bb[_0x01af('0x5c')]}},client9003)[_0x01af('0x25')](function(){return _0x1a57bb;})[_0x01af('0x30')](function(_0x2643b8){console['error'](_0x2643b8);});}})[_0x01af('0x25')](function(){if(_0x1a57bb){return _0x1a57bb;}})[_0x01af('0x25')](respondWithResult(_0x4bbf8f,null))[_0x01af('0x30')](handleError(_0x4bbf8f,null));};exports['addInteraction']=function(_0x473c3f,_0x3b1cd0,_0x925092){return db[_0x01af('0xb9')][_0x01af('0x62')]({'where':{'id':_0x473c3f[_0x01af('0x65')]['id']}})['then'](handleEntityNotFound(_0x3b1cd0,null))[_0x01af('0x25')](function(_0x46b2e1){if(_0x46b2e1){return _0x46b2e1[_0x01af('0xea')](_0x473c3f[_0x01af('0x5c')][_0x01af('0x6f')],_[_0x01af('0xeb')](_0x473c3f['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3b1cd0,null))[_0x01af('0x30')](handleError(_0x3b1cd0,null));};exports[_0x01af('0xec')]=function(_0x42a7a3,_0x1b9e1f,_0x537c79){var _0x557130={'raw':![],'where':{}};var _0x3b330b={};var _0x2e0693={'count':0x0,'rows':[]};return db[_0x01af('0x55')][_0x01af('0x73')]({'where':{'id':_0x42a7a3[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x1b9e1f,null))[_0x01af('0x25')](function(_0x31f06d){if(_0x31f06d){_0x3b330b[_0x01af('0x45')]=_[_0x01af('0x47')](db[_0x01af('0xb9')]['rawAttributes']);_0x3b330b[_0x01af('0x46')]=_[_0x01af('0x47')](_0x42a7a3[_0x01af('0x46')]);_0x3b330b['filters']=_[_0x01af('0x49')](_0x3b330b[_0x01af('0x45')],_0x3b330b[_0x01af('0x46')]);_0x557130['attributes']=_['intersection'](_0x3b330b[_0x01af('0x45')],qs['fields'](_0x42a7a3[_0x01af('0x46')][_0x01af('0x4a')]));_0x557130['attributes']=_0x557130[_0x01af('0x4b')][_0x01af('0x4c')]?_0x557130[_0x01af('0x4b')]:_0x3b330b[_0x01af('0x45')];if(!_0x42a7a3['query'][_0x01af('0x6b')](_0x01af('0x74'))){_0x557130[_0x01af('0x36')]=qs['limit'](_0x42a7a3[_0x01af('0x46')]['limit']);_0x557130[_0x01af('0x35')]=qs[_0x01af('0x35')](_0x42a7a3['query'][_0x01af('0x35')]);}_0x557130[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x42a7a3[_0x01af('0x46')]['sort']);_0x557130['where']=qs['filters'](_['pick'](_0x42a7a3['query'],_0x3b330b[_0x01af('0x48')]));_0x557130[_0x01af('0x51')][_0x01af('0x68')]=_0x31f06d['id'];if(_0x42a7a3[_0x01af('0x46')][_0x01af('0x50')]){_0x557130['where']=_[_0x01af('0x53')](_0x557130[_0x01af('0x51')],{'$or':_['map'](_0x557130[_0x01af('0x4b')],function(_0x2748a9){var _0x5f302d={};_0x5f302d[_0x2748a9]={'$like':'%'+_0x42a7a3[_0x01af('0x46')][_0x01af('0x50')]+'%'};return _0x5f302d;})});}_0x557130=_[_0x01af('0x53')]({},_0x557130,_0x42a7a3[_0x01af('0x54')]);return db[_0x01af('0xb9')][_0x01af('0x34')]({'where':_0x557130['where']})[_0x01af('0x25')](function(_0x2192b6){_0x2e0693[_0x01af('0x34')]=_0x2192b6;if(_0x42a7a3[_0x01af('0x46')][_0x01af('0x6c')]){_0x557130[_0x01af('0x6d')]=[{'model':db[_0x01af('0x92')],'as':_0x01af('0xed'),'required':![]},{'model':db[_0x01af('0xc9')],'as':_0x01af('0xee'),'attributes':[_0x01af('0x3d'),_0x01af('0xef'),_0x01af('0xf0')],'required':![]},{'model':db[_0x01af('0xf1')],'as':'Tags','attributes':['id',_0x01af('0x3d'),_0x01af('0xf2')],'where':_0x42a7a3[_0x01af('0x46')][_0x01af('0xf3')]?{'id':_0x42a7a3['query']['tag']}:undefined,'required':_0x42a7a3[_0x01af('0x46')][_0x01af('0xf3')]?!![]:![]}];}return db['ChatInteraction'][_0x01af('0x56')](_0x557130);})[_0x01af('0x25')](function(_0x3ca09c){_0x2e0693[_0x01af('0x57')]=_0x3ca09c;return _0x2e0693;});}})[_0x01af('0x25')](respondWithFilteredResult(_0x1b9e1f,_0x557130))[_0x01af('0x30')](handleError(_0x1b9e1f,null));};function iftimePromise(_0x4b297f,_0x420cc8){return respondWithRpcPromise('Command',_0x01af('0xf4'),{'command':_0x420cc8[_0x01af('0xf5')]?util['format'](_0x01af('0xf6'),_0x4b297f[_0x01af('0xf7')],_0x420cc8['timezone']):util[_0x01af('0xb2')](_0x01af('0xf8'),_0x4b297f[_0x01af('0xf7')])},client9002)[_0x01af('0x25')](function(_0x1fb88c){var _0x36cd97=_0x1fb88c&&_0x1fb88c['indexOf'](_0x01af('0xf9'))>=0x0?!![]:![];logger[_0x01af('0x26')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x420cc8['id'],_0x4b297f['id'],_0x4b297f[_0x01af('0xf7')],_0x36cd97?'ONLINE':_0x01af('0xfa'),_0x420cc8['timezone']?_0x420cc8[_0x01af('0xf5')]:_0x01af('0xfb'));return _0x36cd97;})[_0x01af('0x30')](function(_0x232109){logger[_0x01af('0x2b')](_0x01af('0xfc'),_0x420cc8['id'],_0x4b297f['id'],_0x4b297f[_0x01af('0xf7')],util[_0x01af('0xfd')](_0x232109,{'showHidden':![],'depth':null}),_0x420cc8['timezone']?_0x420cc8[_0x01af('0xf5')]:_0x01af('0xfb'));return![];});}exports[_0x01af('0xf4')]=function(_0x853990,_0x3f0c28,_0x5d4aeb){var _0x2ecb66=0x0;var _0x1e67b9=0x0;var _0x48fbb9=![];var _0x19fec4;var _0x2468e4;return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x853990[_0x01af('0x65')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x01af('0xfe')],'as':'Intervals','attributes':['id',_0x01af('0xf7')],'raw':!![]}]}]})[_0x01af('0x25')](handleEntityNotFound(_0x3f0c28,null))[_0x01af('0x25')](function(_0x59274c){if(_0x59274c){_0x19fec4=_0x59274c;return _0x59274c['getProactiveActions']({'raw':!![]});}})[_0x01af('0x25')](function(_0x312012){if(_0x19fec4){if(_0x312012){_0x2468e4=_0x312012;}}return require(_0x01af('0x7f'))[_0x01af('0x80')]();})['then'](function(_0x3e7c74){if(_0x3e7c74){_0x1e67b9=_0x3e7c74['virtual'];_0x48fbb9=_0x3e7c74[_0x01af('0x81')];}})['then'](function(){return db[_0x01af('0xb9')][_0x01af('0x34')]({'where':{'closed':![]}});})[_0x01af('0x25')](function(_0x440f15){_0x2ecb66=_0x440f15;if(_0x1e67b9&&_0x440f15>_0x1e67b9){return db['License'][_0x01af('0x73')]({'where':{'id':0x1}})[_0x01af('0x25')](function(_0x2c308a){if(_0x2c308a){_0x2c308a['increment'](_0x01af('0xff'));}});}})[_0x01af('0x25')](function(){if(_0x19fec4[_0x01af('0xfe')]&&_0x19fec4['Interval'][_0x01af('0x100')]){var _0x147869=[];for(var _0x31ba1f=0x0;_0x31ba1f<_0x19fec4[_0x01af('0xfe')][_0x01af('0x100')]['length'];_0x31ba1f++){var _0x11c3af=_0x19fec4[_0x01af('0xfe')][_0x01af('0x100')][_0x31ba1f][_0x01af('0x5e')]({'plain':!![]});_0x147869['push'](iftimePromise(_0x11c3af,_0x19fec4));}return BPromise['all'](_0x147869)[_0x01af('0x25')](function(_0x377c51){return _['some'](_0x377c51);});}else{return!![];}})['then'](function(_0x3ef1f2){var _0x10d8ef=fs['readFileSync'](path[_0x01af('0x7d')](config[_0x01af('0x84')],'server/files/chat/iframe.js'),_0x01af('0xda'));var _0x307742={'remote':_0x19fec4[_0x01af('0x101')],'query':querystring[_0x01af('0x2a')](_[_0x01af('0x53')](_0x19fec4[_0x01af('0x5e')]({'plain':!![]}),{'customerIp':_0x853990[_0x01af('0x8f')][_0x01af('0xab')]||_0x853990['headers']['x-real-ip']||_0x853990[_0x01af('0x102')][_0x01af('0x103')]||_0x853990['ip'],'referer':_0x853990['headers']['referer'],'openedInteractions':_0x2ecb66,'maxInteractions':_0x1e67b9,'virtual':_0x48fbb9[_0x01af('0x104')],'online':_0x3ef1f2,'custom':_0x48fbb9}))[_0x01af('0x105')](/'/g,'\x5c\x27')};_0x3f0c28[_0x01af('0x3e')](ejs['render'](Mustache[_0x01af('0x106')](_0x10d8ef,_0x307742),{'proactiveActions':_0x2468e4,'alignment':_0x19fec4[_0x01af('0x107')],'verticalAlignment':_0x19fec4['verticalAlignment'],'div_color':_0x19fec4[_0x01af('0xf2')],'text_color':_0x19fec4[_0x01af('0x108')]}));})['catch'](handleError(_0x3f0c28,null));};exports[_0x01af('0x109')]=function(_0x34f311,_0x36ed1f,_0x32efd0){return db['ChatWebsite'][_0x01af('0x73')]({'where':{'id':_0x34f311['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x36ed1f,null))[_0x01af('0x25')](function(_0x256018){if(_0x256018){return db[_0x01af('0x10a')][_0x01af('0x10b')](function(_0x531b1f){return db[_0x01af('0xa1')][_0x01af('0x3b')]({'where':{'ChatWebsiteId':_0x34f311[_0x01af('0x65')]['id']},'transaction':_0x531b1f})[_0x01af('0x25')](function(_0x70d537){var _0x3cf03b=_[_0x01af('0x40')](_0x34f311[_0x01af('0x5c')],function(_0x345bd4){_0x345bd4[_0x01af('0x68')]=_0x34f311['params']['id'];return _0x345bd4;});return db[_0x01af('0xa1')]['bulkCreate'](_0x3cf03b,{'transaction':_0x531b1f});});})[_0x01af('0x25')](function(){return db[_0x01af('0xa1')][_0x01af('0x10c')]({'where':{'ChatWebsiteId':_0x34f311['params']['id']},'order':_0x01af('0xa6')});});}})['then'](respondWithResult(_0x36ed1f,null))['catch'](handleError(_0x36ed1f,null));};exports[_0x01af('0x10d')]=function(_0x45a515,_0x21f05b,_0x2b2314){var _0x42011e={};var _0x4947a2={};var _0x163ae7;var _0x4505d2;return db[_0x01af('0x55')]['findOne']({'where':{'id':_0x45a515[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x21f05b,null))['then'](function(_0x13179b){if(_0x13179b){_0x163ae7=_0x13179b;_0x4947a2[_0x01af('0x45')]=_[_0x01af('0x47')](db[_0x01af('0xa1')][_0x01af('0x41')]);_0x4947a2[_0x01af('0x46')]=_[_0x01af('0x47')](_0x45a515[_0x01af('0x46')]);_0x4947a2[_0x01af('0x48')]=_[_0x01af('0x49')](_0x4947a2[_0x01af('0x45')],_0x4947a2[_0x01af('0x46')]);_0x42011e[_0x01af('0x4b')]=_[_0x01af('0x49')](_0x4947a2['model'],qs['fields'](_0x45a515[_0x01af('0x46')][_0x01af('0x4a')]));_0x42011e[_0x01af('0x4b')]=_0x42011e[_0x01af('0x4b')][_0x01af('0x4c')]?_0x42011e['attributes']:_0x4947a2[_0x01af('0x45')];_0x42011e['order']=qs[_0x01af('0x4e')](_0x45a515['query']['sort']);_0x42011e[_0x01af('0x51')]=qs[_0x01af('0x48')](_['pick'](_0x45a515[_0x01af('0x46')],_0x4947a2[_0x01af('0x48')]));if(_0x45a515[_0x01af('0x46')][_0x01af('0x50')]){_0x42011e[_0x01af('0x51')]=_['merge'](_0x42011e[_0x01af('0x51')],{'$or':_[_0x01af('0x40')](_0x42011e[_0x01af('0x4b')],function(_0x5423d4){var _0x4ce26d={};_0x4ce26d[_0x5423d4]={'$like':'%'+_0x45a515[_0x01af('0x46')][_0x01af('0x50')]+'%'};return _0x4ce26d;})});}_0x42011e=_[_0x01af('0x53')]({},_0x42011e,_0x45a515[_0x01af('0x54')]);return _0x163ae7[_0x01af('0x10d')](_0x42011e);}})[_0x01af('0x25')](function(_0x9008b2){if(_0x9008b2){_0x4505d2=_0x9008b2['length'];if(!_0x45a515[_0x01af('0x46')]['hasOwnProperty'](_0x01af('0x74'))){_0x42011e[_0x01af('0x36')]=qs['limit'](_0x45a515[_0x01af('0x46')][_0x01af('0x36')]);_0x42011e[_0x01af('0x35')]=qs['offset'](_0x45a515[_0x01af('0x46')][_0x01af('0x35')]);}return _0x163ae7['getApplications'](_0x42011e);}})[_0x01af('0x25')](function(_0x1914e0){if(_0x1914e0){return _0x1914e0?{'count':_0x4505d2,'rows':_0x1914e0}:null;}})[_0x01af('0x25')](respondWithResult(_0x21f05b,null))['catch'](handleError(_0x21f05b,null));};exports[_0x01af('0x10e')]=function(_0x468e03,_0x5e4799,_0x3dfd57){return db[_0x01af('0x10f')][_0x01af('0x62')]({'where':{'id':_0x468e03['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x5e4799,null))[_0x01af('0x25')](function(_0x3c6149){if(_0x3c6149){return _0x3c6149[_0x01af('0x10e')](_0x468e03['body'][_0x01af('0x6f')],_['omit'](_0x468e03[_0x01af('0x5c')],[_0x01af('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x5e4799,null))['catch'](handleError(_0x5e4799,null));};exports[_0x01af('0x110')]=function(_0xa6c699,_0x2032db,_0x46b8fd){var _0x3b984a={};var _0x17468b={};var _0x278bac;var _0x27b808;return db[_0x01af('0x55')]['findOne']({'where':{'id':_0xa6c699[_0x01af('0x65')]['id']}})['then'](handleEntityNotFound(_0x2032db,null))[_0x01af('0x25')](function(_0x4f3434){if(_0x4f3434){_0x278bac=_0x4f3434;_0x17468b['model']=_[_0x01af('0x47')](db[_0x01af('0x111')][_0x01af('0x41')]);_0x17468b[_0x01af('0x46')]=_[_0x01af('0x47')](_0xa6c699['query']);_0x17468b[_0x01af('0x48')]=_[_0x01af('0x49')](_0x17468b[_0x01af('0x45')],_0x17468b[_0x01af('0x46')]);_0x3b984a['attributes']=_[_0x01af('0x49')](_0x17468b[_0x01af('0x45')],qs['fields'](_0xa6c699[_0x01af('0x46')][_0x01af('0x4a')]));_0x3b984a[_0x01af('0x4b')]=_0x3b984a[_0x01af('0x4b')][_0x01af('0x4c')]?_0x3b984a['attributes']:_0x17468b['model'];_0x3b984a['order']=qs[_0x01af('0x4e')](_0xa6c699['query']['sort']);_0x3b984a[_0x01af('0x51')]=qs[_0x01af('0x48')](_[_0x01af('0x4f')](_0xa6c699[_0x01af('0x46')],_0x17468b[_0x01af('0x48')]));if(_0xa6c699[_0x01af('0x46')]['filter']){_0x3b984a[_0x01af('0x51')]=_[_0x01af('0x53')](_0x3b984a[_0x01af('0x51')],{'$or':_['map'](_0x3b984a[_0x01af('0x4b')],function(_0x1d609a){var _0x24c8cb={};_0x24c8cb[_0x1d609a]={'$like':'%'+_0xa6c699['query'][_0x01af('0x50')]+'%'};return _0x24c8cb;})});}_0x3b984a=_[_0x01af('0x53')]({},_0x3b984a,_0xa6c699['options']);return _0x278bac[_0x01af('0x110')](_0x3b984a);}})['then'](function(_0x7bfc79){if(_0x7bfc79){_0x27b808=_0x7bfc79['length'];if(!_0xa6c699[_0x01af('0x46')][_0x01af('0x6b')]('nolimit')){_0x3b984a[_0x01af('0x36')]=qs[_0x01af('0x36')](_0xa6c699[_0x01af('0x46')]['limit']);_0x3b984a[_0x01af('0x35')]=qs[_0x01af('0x35')](_0xa6c699[_0x01af('0x46')][_0x01af('0x35')]);}return _0x278bac[_0x01af('0x110')](_0x3b984a);}})[_0x01af('0x25')](function(_0xe24f0b){if(_0xe24f0b){return _0xe24f0b?{'count':_0x27b808,'rows':_0xe24f0b}:null;}})['then'](respondWithResult(_0x2032db,null))['catch'](handleError(_0x2032db,null));};exports[_0x01af('0x112')]=function(_0x324701,_0x4ff0c1,_0x5588ac){var _0x120923=_0x324701[_0x01af('0x46')][_0x01af('0x113')]===_0x01af('0x114')?'offlineForm':'onlineForm';return db[_0x01af('0x55')][_0x01af('0x62')]({'attributes':['id',_0x120923],'where':{'id':_0x324701['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x4ff0c1,null))[_0x01af('0x25')](function(_0x1b9d74){if(_0x1b9d74){var _0x5a008c=_0x1b9d74[_0x120923];var _0x5281d5=_0x5a008c&&_0x5a008c[_0x01af('0x115')]?_0x5a008c[_0x01af('0x115')]:[];_0x4ff0c1[_0x01af('0x3e')]({'fromKey':_[_0x01af('0x82')](_0x5a008c[_0x01af('0x116')])?undefined:_0x5a008c[_0x01af('0x116')],'count':_0x5281d5['length'],'rows':_0x5281d5});}})[_0x01af('0x30')](handleError(_0x4ff0c1,null));};exports[_0x01af('0x117')]=function(_0x4e3533,_0x1adb31,_0x3fcc79){var _0x23fe80={'raw':![],'where':{}};var _0x4e45f1={};var _0x504276={'count':0x0,'rows':[]};return db[_0x01af('0x55')][_0x01af('0x73')]({'where':{'id':_0x4e3533['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x1adb31,null))['then'](function(_0x2d1305){if(_0x2d1305){_0x4e45f1[_0x01af('0x45')]=_['keys'](db[_0x01af('0xdd')][_0x01af('0x41')]);_0x4e45f1[_0x01af('0x46')]=_['keys'](_0x4e3533[_0x01af('0x46')]);_0x4e45f1[_0x01af('0x48')]=_[_0x01af('0x49')](_0x4e45f1['model'],_0x4e45f1[_0x01af('0x46')]);_0x23fe80[_0x01af('0x4b')]=_['intersection'](_0x4e45f1[_0x01af('0x45')],qs[_0x01af('0x4a')](_0x4e3533[_0x01af('0x46')][_0x01af('0x4a')]));_0x23fe80['attributes']=_0x23fe80[_0x01af('0x4b')][_0x01af('0x4c')]?_0x23fe80[_0x01af('0x4b')]:_0x4e45f1[_0x01af('0x45')];if(!_0x4e3533[_0x01af('0x46')][_0x01af('0x6b')](_0x01af('0x74'))){_0x23fe80[_0x01af('0x36')]=qs[_0x01af('0x36')](_0x4e3533[_0x01af('0x46')]['limit']);_0x23fe80[_0x01af('0x35')]=qs['offset'](_0x4e3533[_0x01af('0x46')][_0x01af('0x35')]);}_0x23fe80[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x4e3533['query'][_0x01af('0x4e')]);_0x23fe80[_0x01af('0x51')]=qs[_0x01af('0x48')](_[_0x01af('0x4f')](_0x4e3533['query'],_0x4e45f1[_0x01af('0x48')]));_0x23fe80[_0x01af('0x51')]['ChatWebsiteId']=_0x2d1305['id'];if(_0x4e3533[_0x01af('0x46')][_0x01af('0x50')]){_0x23fe80[_0x01af('0x51')]=_[_0x01af('0x53')](_0x23fe80[_0x01af('0x51')],{'$or':_[_0x01af('0x40')](_0x23fe80[_0x01af('0x4b')],function(_0x10c569){var _0x226ada={};_0x226ada[_0x10c569]={'$like':'%'+_0x4e3533['query'][_0x01af('0x50')]+'%'};return _0x226ada;})});}_0x23fe80=_['merge']({},_0x23fe80,_0x4e3533[_0x01af('0x54')]);return db[_0x01af('0xdd')]['count']({'where':_0x23fe80[_0x01af('0x51')]})[_0x01af('0x25')](function(_0x1da802){_0x504276['count']=_0x1da802;if(_0x4e3533[_0x01af('0x46')][_0x01af('0x6c')]){_0x23fe80[_0x01af('0x6d')]=[{'all':!![]}];}else{_0x23fe80[_0x01af('0x6d')]=[{'model':db[_0x01af('0x92')],'as':_0x01af('0xed'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x23fe80);})['then'](function(_0x282c4f){_0x504276[_0x01af('0x57')]=_0x282c4f;return _0x504276;});}})[_0x01af('0x25')](respondWithFilteredResult(_0x1adb31,_0x23fe80))[_0x01af('0x30')](handleError(_0x1adb31,null));};exports[_0x01af('0x118')]=function(_0x5bfc73,_0xc01e13,_0x3aef8e){return db[_0x01af('0x55')]['find']({'where':{'id':_0x5bfc73[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0xc01e13,null))['then'](function(_0x5b1ac6){if(_0x5b1ac6){return _0x5b1ac6[_0x01af('0x118')](_0x5bfc73['body'][_0x01af('0x6f')],_['omit'](_0x5bfc73[_0x01af('0x5c')],[_0x01af('0x6f'),'id'])||{})['spread'](function(_0x5b7ea0){for(var _0x400034=0x0;_0x400034<_0x5bfc73[_0x01af('0x5c')][_0x01af('0x6f')][_0x01af('0x4c')];_0x400034+=0x1){socket[_0x01af('0x119')]('userChatWebsite:save',{'UserId':_0x5bfc73[_0x01af('0x5c')][_0x01af('0x6f')][_0x400034],'ChatWebsiteId':_0x5bfc73['params']['id']});}return _0x5b7ea0;});}})[_0x01af('0x25')](respondWithResult(_0xc01e13,null))['catch'](handleError(_0xc01e13,null));};exports[_0x01af('0x11a')]=function(_0x108b45,_0x504d26,_0x225ca1){return db['ChatWebsite'][_0x01af('0x62')]({'where':{'id':_0x108b45[_0x01af('0x65')]['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x504d26,null))[_0x01af('0x25')](function(_0x35ccc4){if(_0x35ccc4){return _0x35ccc4[_0x01af('0x11a')](_0x108b45[_0x01af('0x46')]['ids'])['then'](function(){if(_['isArray'](_0x108b45[_0x01af('0x46')][_0x01af('0x6f')])){for(var _0x4f9c2b=0x0;_0x4f9c2b<_0x108b45[_0x01af('0x46')][_0x01af('0x6f')][_0x01af('0x4c')];_0x4f9c2b+=0x1){socket[_0x01af('0x119')](_0x01af('0x11b'),{'UserId':Number(_0x108b45[_0x01af('0x46')][_0x01af('0x6f')][_0x4f9c2b]),'ChatWebsiteId':Number(_0x108b45[_0x01af('0x65')]['id'])});}}else{socket[_0x01af('0x119')](_0x01af('0x11b'),{'UserId':Number(_0x108b45[_0x01af('0x46')][_0x01af('0x6f')]),'ChatWebsiteId':Number(_0x108b45['params']['id'])});}});}})[_0x01af('0x25')](respondWithStatusCode(_0x504d26,null))['catch'](handleError(_0x504d26,null));};exports[_0x01af('0x11c')]=function(_0x2ecd5c,_0x38f4c4,_0x3ce59a){var _0x260b32={};var _0x4f4580={};var _0x5814bc;var _0x3ba123;return db[_0x01af('0x55')][_0x01af('0x73')]({'where':{'id':_0x2ecd5c['params']['id']}})[_0x01af('0x25')](handleEntityNotFound(_0x38f4c4,null))[_0x01af('0x25')](function(_0x4d879b){if(_0x4d879b){_0x5814bc=_0x4d879b;_0x4f4580[_0x01af('0x45')]=_[_0x01af('0x47')](db[_0x01af('0xc9')][_0x01af('0x41')]);_0x4f4580[_0x01af('0x46')]=_['keys'](_0x2ecd5c[_0x01af('0x46')]);_0x4f4580[_0x01af('0x48')]=_['intersection'](_0x4f4580['model'],_0x4f4580[_0x01af('0x46')]);_0x260b32[_0x01af('0x4b')]=_[_0x01af('0x49')](_0x4f4580['model'],qs[_0x01af('0x4a')](_0x2ecd5c[_0x01af('0x46')]['fields']));_0x260b32[_0x01af('0x4b')]=_0x260b32[_0x01af('0x4b')][_0x01af('0x4c')]?_0x260b32[_0x01af('0x4b')]:_0x4f4580[_0x01af('0x45')];_0x260b32[_0x01af('0x4d')]=qs[_0x01af('0x4e')](_0x2ecd5c['query'][_0x01af('0x4e')]);_0x260b32[_0x01af('0x51')]=qs[_0x01af('0x48')](_[_0x01af('0x4f')](_0x2ecd5c[_0x01af('0x46')],_0x4f4580[_0x01af('0x48')]));if(_0x2ecd5c['query'][_0x01af('0x50')]){_0x260b32[_0x01af('0x51')]=_[_0x01af('0x53')](_0x260b32[_0x01af('0x51')],{'$or':_[_0x01af('0x40')](_0x260b32[_0x01af('0x4b')],function(_0xc2417a){var _0x2167b7={};_0x2167b7[_0xc2417a]={'$like':'%'+_0x2ecd5c[_0x01af('0x46')][_0x01af('0x50')]+'%'};return _0x2167b7;})});}_0x260b32=_[_0x01af('0x53')]({},_0x260b32,_0x2ecd5c['options']);return _0x5814bc[_0x01af('0x11c')](_0x260b32);}})['then'](function(_0x488881){if(_0x488881){_0x3ba123=_0x488881['length'];if(!_0x2ecd5c[_0x01af('0x46')][_0x01af('0x6b')](_0x01af('0x74'))){_0x260b32[_0x01af('0x36')]=qs[_0x01af('0x36')](_0x2ecd5c[_0x01af('0x46')][_0x01af('0x36')]);_0x260b32[_0x01af('0x35')]=qs[_0x01af('0x35')](_0x2ecd5c[_0x01af('0x46')][_0x01af('0x35')]);}return _0x5814bc[_0x01af('0x11c')](_0x260b32);}})[_0x01af('0x25')](function(_0x239874){if(_0x239874){return _0x239874?{'count':_0x3ba123,'rows':_0x239874}:null;}})['then'](respondWithResult(_0x38f4c4,null))[_0x01af('0x30')](handleError(_0x38f4c4,null));}; \ No newline at end of file +var _0xf7d5=['List','Contacts','DESC','Applications','account','applications','list','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','format','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','increment','chatLicenseExceeded','server/files/chat/iframe.js','remote','connection','replace','alignment','verticalAlignment','textColor','addApplications','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./chatWebsite.socket','register','http','client','Sequelize','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','json','count','offset','limit','set','apply','save','update','then','destroy','get','UserProfileResource','end','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','options','ChatWebsite','includeAll','include','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','rows','removeAnswers','addLogo','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','join','sitepic','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList'];(function(_0xe453c7,_0x44f45f){var _0x593204=function(_0x43ecfc){while(--_0x43ecfc){_0xe453c7['push'](_0xe453c7['shift']());}};_0x593204(++_0x44f45f);}(_0xf7d5,0x19b));var _0x5f7d=function(_0x2ea680,_0x99a563){_0x2ea680=_0x2ea680-0x0;var _0x317396=_0xf7d5[_0x2ea680];return _0x317396;};'use strict';var pdf=require(_0x5f7d('0x0'));var emlformat=require(_0x5f7d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f7d('0x2'));var jsonpatch=require(_0x5f7d('0x3'));var rp=require(_0x5f7d('0x4'));var moment=require(_0x5f7d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5f7d('0x6'));var util=require(_0x5f7d('0x7'));var path=require(_0x5f7d('0x8'));var sox=require(_0x5f7d('0x9'));var csv=require(_0x5f7d('0xa'));var ejs=require(_0x5f7d('0xb'));var fs=require('fs');var _=require(_0x5f7d('0xc'));var squel=require(_0x5f7d('0xd'));var crypto=require(_0x5f7d('0xe'));var jsforce=require(_0x5f7d('0xf'));var deskjs=require(_0x5f7d('0x10'));var toCsv=require(_0x5f7d('0xa'));var querystring=require(_0x5f7d('0x11'));var Papa=require(_0x5f7d('0x12'));var Redis=require(_0x5f7d('0x13'));var authService=require(_0x5f7d('0x14'));var qs=require(_0x5f7d('0x15'));var as=require(_0x5f7d('0x16'));var hardwareService=require(_0x5f7d('0x17'));var logger=require('../../config/logger')(_0x5f7d('0x18'));var utils=require(_0x5f7d('0x19'));var config=require(_0x5f7d('0x1a'));var db=require(_0x5f7d('0x1b'))['db'];config['redis']=_[_0x5f7d('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5f7d('0x1d'))(new Redis(config['redis']));require(_0x5f7d('0x1e'))[_0x5f7d('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5f7d('0x20')]({'port':0x232c});var client9002=jayson[_0x5f7d('0x21')][_0x5f7d('0x20')]({'port':0x232a});var client9003=jayson[_0x5f7d('0x21')]['http']({'port':0x232b});function checkPasswordPattern(_0xbf6ea4,_0x5353a5,_0x1907af){if(_0x1907af){var _0x4f1802=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f1802['test'](_0x5353a5)){return _0xbf6ea4;}else{throw new db[(_0x5f7d('0x22'))]['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 _0xbf6ea4;}}function respondWithRpcPromise(_0x4e80b9,_0x50da96,_0x25be6f,_0x2c7325){return new BPromise(function(_0x5e542a,_0x2f7629){var _0x25e863=_0x2c7325||client;return _0x25e863[_0x5f7d('0x23')](_0x4e80b9,_0x25be6f)['then'](function(_0x5c0bd6){logger[_0x5f7d('0x24')](_0x5f7d('0x25'),_0x50da96,_0x5f7d('0x26'));logger[_0x5f7d('0x27')](_0x5f7d('0x28'),_0x50da96,_0x5f7d('0x26'),JSON[_0x5f7d('0x29')](_0x5c0bd6));if(_0x5c0bd6[_0x5f7d('0x2a')]){if(_0x5c0bd6[_0x5f7d('0x2a')][_0x5f7d('0x2b')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x50da96,_0x5c0bd6[_0x5f7d('0x2a')][_0x5f7d('0x2c')]);return _0x2f7629(_0x5c0bd6[_0x5f7d('0x2a')]['message']);}logger[_0x5f7d('0x2a')](_0x5f7d('0x25'),_0x50da96,_0x5c0bd6[_0x5f7d('0x2a')]['message']);return _0x5e542a(_0x5c0bd6['error'][_0x5f7d('0x2c')]);}else{logger[_0x5f7d('0x24')](_0x5f7d('0x25'),_0x50da96,_0x5f7d('0x26'));_0x5e542a(_0x5c0bd6[_0x5f7d('0x2d')][_0x5f7d('0x2c')]);}})[_0x5f7d('0x2e')](function(_0xf79be0){logger[_0x5f7d('0x2a')](_0x5f7d('0x25'),_0x50da96,_0xf79be0);_0x2f7629(_0xf79be0);});});}function respondWithStatusCode(_0x2f07f2,_0x229d10){_0x229d10=_0x229d10||0xcc;return function(_0x970b22){if(_0x970b22){return _0x2f07f2[_0x5f7d('0x2f')](_0x229d10);}return _0x2f07f2[_0x5f7d('0x30')](_0x229d10)['end']();};}function respondWithResult(_0x33ef1f,_0x49f01e){_0x49f01e=_0x49f01e||0xc8;return function(_0x509a76){if(_0x509a76){return _0x33ef1f['status'](_0x49f01e)[_0x5f7d('0x31')](_0x509a76);}};}function respondWithFilteredResult(_0x3121c5,_0x3616e6){return function(_0x476e69){if(_0x476e69){var _0x7afee8=_0x476e69[_0x5f7d('0x32')],_0x5d4d57=_0x3616e6[_0x5f7d('0x33')],_0x1cc5f8=_0x3616e6['offset']+_0x3616e6[_0x5f7d('0x34')],_0x3bb840;if(_0x1cc5f8>=_0x7afee8){_0x1cc5f8=_0x7afee8;_0x3bb840=0xc8;}else{_0x3bb840=0xce;}_0x3121c5[_0x5f7d('0x30')](_0x3bb840);return _0x3121c5[_0x5f7d('0x35')]('Content-Range',_0x5d4d57+'-'+_0x1cc5f8+'/'+_0x7afee8)[_0x5f7d('0x31')](_0x476e69);}return null;};}function patchUpdates(_0x437dc2){return function(_0x34401c){try{jsonpatch[_0x5f7d('0x36')](_0x34401c,_0x437dc2,!![]);}catch(_0x59eaf4){return BPromise['reject'](_0x59eaf4);}return _0x34401c[_0x5f7d('0x37')]();};}function saveUpdates(_0x334b5f,_0x3b89d8){return function(_0x11476f){if(_0x11476f){return _0x11476f[_0x5f7d('0x38')](_0x334b5f)[_0x5f7d('0x39')](function(_0x1bb3c7){return _0x1bb3c7;});}return null;};}function removeEntity(_0x34276d,_0x3db2e9){return function(_0x5c3eed){if(_0x5c3eed){return _0x5c3eed[_0x5f7d('0x3a')]()['then'](function(){var _0x53fc6c=_0x5c3eed[_0x5f7d('0x3b')]({'plain':!![]});var _0x2ce96b='ChatWebsites';return db[_0x5f7d('0x3c')]['destroy']({'where':{'type':_0x2ce96b,'resourceId':_0x53fc6c['id']}})[_0x5f7d('0x39')](function(){return _0x5c3eed;});})[_0x5f7d('0x39')](function(){_0x34276d[_0x5f7d('0x30')](0xcc)[_0x5f7d('0x3d')]();});}};}function handleEntityNotFound(_0x5c6199,_0x58765b){return function(_0x245e4f){if(!_0x245e4f){_0x5c6199[_0x5f7d('0x2f')](0x194);}return _0x245e4f;};}function handleError(_0x483467,_0x450abb){_0x450abb=_0x450abb||0x1f4;return function(_0x124d35){logger[_0x5f7d('0x2a')](_0x124d35['stack']);if(_0x124d35[_0x5f7d('0x3e')]){delete _0x124d35[_0x5f7d('0x3e')];}_0x483467[_0x5f7d('0x30')](_0x450abb)[_0x5f7d('0x3f')](_0x124d35);};}exports[_0x5f7d('0x40')]=function(_0x5d8649,_0x529f7a){var _0x12e561={'include':[{'model':db['Pause'],'as':_0x5f7d('0x41')}]},_0x4344bc={},_0x10fd55={'count':0x0,'rows':[]};var _0x4bfa41=_['map'](db['ChatWebsite'][_0x5f7d('0x42')],function(_0x3f0a1d){return{'name':_0x3f0a1d[_0x5f7d('0x43')],'type':_0x3f0a1d[_0x5f7d('0x44')][_0x5f7d('0x45')]};});_0x4344bc[_0x5f7d('0x46')]=_['map'](_0x4bfa41,_0x5f7d('0x3e'));_0x4344bc[_0x5f7d('0x47')]=_[_0x5f7d('0x48')](_0x5d8649[_0x5f7d('0x47')]);_0x4344bc[_0x5f7d('0x49')]=_[_0x5f7d('0x4a')](_0x4344bc[_0x5f7d('0x46')],_0x4344bc[_0x5f7d('0x47')]);_0x12e561[_0x5f7d('0x4b')]=_[_0x5f7d('0x4a')](_0x4344bc[_0x5f7d('0x46')],qs[_0x5f7d('0x4c')](_0x5d8649[_0x5f7d('0x47')][_0x5f7d('0x4c')]));_0x12e561[_0x5f7d('0x4b')]=_0x12e561[_0x5f7d('0x4b')][_0x5f7d('0x4d')]?_0x12e561['attributes']:_0x4344bc['model'];if(!_0x5d8649['query'][_0x5f7d('0x4e')]('nolimit')){_0x12e561[_0x5f7d('0x34')]=qs['limit'](_0x5d8649[_0x5f7d('0x47')][_0x5f7d('0x34')]);_0x12e561['offset']=qs[_0x5f7d('0x33')](_0x5d8649[_0x5f7d('0x47')]['offset']);}_0x12e561[_0x5f7d('0x4f')]=qs[_0x5f7d('0x50')](_0x5d8649[_0x5f7d('0x47')][_0x5f7d('0x50')]);_0x12e561[_0x5f7d('0x51')]=qs[_0x5f7d('0x49')](_[_0x5f7d('0x52')](_0x5d8649['query'],_0x4344bc[_0x5f7d('0x49')]),_0x4bfa41);if(_0x5d8649[_0x5f7d('0x47')]['filter']){_0x12e561['where']=_[_0x5f7d('0x53')](_0x12e561[_0x5f7d('0x51')],{'$or':_[_0x5f7d('0x54')](_0x4bfa41,function(_0x286b4e){if(_0x286b4e['type']!==_0x5f7d('0x55')){var _0x584e0a={};_0x584e0a[_0x286b4e[_0x5f7d('0x3e')]]={'$like':'%'+_0x5d8649[_0x5f7d('0x47')][_0x5f7d('0x56')]+'%'};return _0x584e0a;}})});}_0x12e561=_[_0x5f7d('0x53')]({},_0x12e561,_0x5d8649[_0x5f7d('0x57')]);var _0x55151b={'where':_0x12e561[_0x5f7d('0x51')]};return db[_0x5f7d('0x58')][_0x5f7d('0x32')](_0x55151b)[_0x5f7d('0x39')](function(_0x14e83e){_0x10fd55[_0x5f7d('0x32')]=_0x14e83e;if(_0x5d8649[_0x5f7d('0x47')][_0x5f7d('0x59')]){_0x12e561[_0x5f7d('0x5a')]=[{'all':!![]}];}return db[_0x5f7d('0x58')]['findAll'](_0x12e561);})[_0x5f7d('0x39')](function(_0x40e3fb){_0x10fd55['rows']=_0x40e3fb;return _0x10fd55;})['then'](respondWithFilteredResult(_0x529f7a,_0x12e561))[_0x5f7d('0x2e')](handleError(_0x529f7a,null));};exports[_0x5f7d('0x5b')]=function(_0x3f2bab,_0x1dfc70){var _0x19130e={'raw':![],'where':{'id':_0x3f2bab[_0x5f7d('0x5c')]['id']},'include':[{'model':db[_0x5f7d('0x5d')],'as':_0x5f7d('0x41')}]},_0x1ba9ee={};_0x1ba9ee[_0x5f7d('0x46')]=_[_0x5f7d('0x48')](db['ChatWebsite'][_0x5f7d('0x42')]);_0x1ba9ee[_0x5f7d('0x47')]=_[_0x5f7d('0x48')](_0x3f2bab[_0x5f7d('0x47')]);_0x1ba9ee[_0x5f7d('0x49')]=_['intersection'](_0x1ba9ee[_0x5f7d('0x46')],_0x1ba9ee[_0x5f7d('0x47')]);_0x19130e[_0x5f7d('0x4b')]=_[_0x5f7d('0x4a')](_0x1ba9ee['model'],qs['fields'](_0x3f2bab[_0x5f7d('0x47')][_0x5f7d('0x4c')]));_0x19130e[_0x5f7d('0x4b')]=_0x19130e[_0x5f7d('0x4b')]['length']?_0x19130e[_0x5f7d('0x4b')]:_0x1ba9ee[_0x5f7d('0x46')];if(_0x3f2bab[_0x5f7d('0x47')][_0x5f7d('0x59')]){_0x19130e[_0x5f7d('0x5a')]=[{'all':!![]}];}_0x19130e=_['merge']({},_0x19130e,_0x3f2bab[_0x5f7d('0x57')]);return db[_0x5f7d('0x58')][_0x5f7d('0x5e')](_0x19130e)[_0x5f7d('0x39')](handleEntityNotFound(_0x1dfc70,null))[_0x5f7d('0x39')](respondWithResult(_0x1dfc70,null))['catch'](handleError(_0x1dfc70,null));};exports[_0x5f7d('0x5f')]=function(_0x3ca99f,_0x34c33f){return db[_0x5f7d('0x58')][_0x5f7d('0x5f')](_0x3ca99f[_0x5f7d('0x60')],{})[_0x5f7d('0x39')](function(_0x280195){var _0x1003cf=_0x3ca99f[_0x5f7d('0x61')][_0x5f7d('0x3b')]({'plain':!![]});if(!_0x1003cf)throw new Error(_0x5f7d('0x62'));if(_0x1003cf[_0x5f7d('0x63')]===_0x5f7d('0x61')){var _0x3c93c6=_0x280195[_0x5f7d('0x3b')]({'plain':!![]});var _0x59bb93=_0x5f7d('0x64');return db[_0x5f7d('0x65')]['find']({'where':{'name':_0x59bb93,'userProfileId':_0x1003cf[_0x5f7d('0x66')]},'raw':!![]})['then'](function(_0x5455cb){if(_0x5455cb&&_0x5455cb['autoAssociation']===0x0){return db[_0x5f7d('0x3c')][_0x5f7d('0x5f')]({'name':_0x3c93c6[_0x5f7d('0x3e')],'resourceId':_0x3c93c6['id'],'type':_0x5455cb[_0x5f7d('0x3e')],'sectionId':_0x5455cb['id']},{})[_0x5f7d('0x39')](function(){return _0x280195;});}else{return _0x280195;}})[_0x5f7d('0x2e')](function(_0x4b2dfd){logger[_0x5f7d('0x2a')](_0x5f7d('0x67'),_0x4b2dfd);throw _0x4b2dfd;});}return _0x280195;})[_0x5f7d('0x39')](respondWithResult(_0x34c33f,0xc9))[_0x5f7d('0x2e')](handleError(_0x34c33f,null));};exports[_0x5f7d('0x38')]=function(_0x518927,_0x25bc1e){if(_0x518927[_0x5f7d('0x60')]['id']){delete _0x518927[_0x5f7d('0x60')]['id'];}return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x518927[_0x5f7d('0x5c')]['id']},'include':[{'model':db[_0x5f7d('0x5d')],'as':_0x5f7d('0x41')}]})[_0x5f7d('0x39')](handleEntityNotFound(_0x25bc1e,null))['then'](saveUpdates(_0x518927['body'],null))[_0x5f7d('0x39')](respondWithResult(_0x25bc1e,null))['catch'](handleError(_0x25bc1e,null));};exports[_0x5f7d('0x3a')]=function(_0x27f7fa,_0x3c97ca){return db[_0x5f7d('0x58')]['find']({'where':{'id':_0x27f7fa[_0x5f7d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3c97ca,null))[_0x5f7d('0x39')](removeEntity(_0x3c97ca,null))['catch'](handleError(_0x3c97ca,null));};exports[_0x5f7d('0x68')]=function(_0x4b6113,_0x2651e6){return db[_0x5f7d('0x58')][_0x5f7d('0x68')]()[_0x5f7d('0x39')](respondWithResult(_0x2651e6,null))['catch'](handleError(_0x2651e6,null));};exports[_0x5f7d('0x69')]=function(_0x10dad2,_0x92cd25,_0x33eee9){if(_0x10dad2[_0x5f7d('0x60')]['id']){delete _0x10dad2['body']['id'];}return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x10dad2[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x92cd25,null))['then'](function(_0x6f56e5){if(_0x6f56e5){_0x10dad2[_0x5f7d('0x60')]['ChatWebsiteId']=_0x6f56e5['id'];return db[_0x5f7d('0x6a')][_0x5f7d('0x5f')](_0x10dad2[_0x5f7d('0x60')]);}})[_0x5f7d('0x39')](respondWithResult(_0x92cd25,null))['catch'](handleError(_0x92cd25,null));};exports[_0x5f7d('0x6b')]=function(_0xedf58,_0x4d7c46,_0x2c3d78){var _0x4a321a={'raw':![],'where':{}};var _0x390764={};var _0x452801={'count':0x0,'rows':[]};return db[_0x5f7d('0x58')][_0x5f7d('0x6c')]({'where':{'id':_0xedf58[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x4d7c46,null))[_0x5f7d('0x39')](function(_0x7d82a4){if(_0x7d82a4){_0x390764[_0x5f7d('0x46')]=_[_0x5f7d('0x48')](db['Disposition'][_0x5f7d('0x42')]);_0x390764[_0x5f7d('0x47')]=_[_0x5f7d('0x48')](_0xedf58['query']);_0x390764[_0x5f7d('0x49')]=_['intersection'](_0x390764[_0x5f7d('0x46')],_0x390764['query']);_0x4a321a[_0x5f7d('0x4b')]=_[_0x5f7d('0x4a')](_0x390764['model'],qs[_0x5f7d('0x4c')](_0xedf58['query'][_0x5f7d('0x4c')]));_0x4a321a[_0x5f7d('0x4b')]=_0x4a321a['attributes'][_0x5f7d('0x4d')]?_0x4a321a['attributes']:_0x390764[_0x5f7d('0x46')];if(!_0xedf58['query'][_0x5f7d('0x4e')](_0x5f7d('0x6d'))){_0x4a321a[_0x5f7d('0x34')]=qs[_0x5f7d('0x34')](_0xedf58[_0x5f7d('0x47')]['limit']);_0x4a321a[_0x5f7d('0x33')]=qs[_0x5f7d('0x33')](_0xedf58['query'][_0x5f7d('0x33')]);}_0x4a321a[_0x5f7d('0x4f')]=qs[_0x5f7d('0x50')](_0xedf58[_0x5f7d('0x47')][_0x5f7d('0x50')]);_0x4a321a['where']=qs['filters'](_['pick'](_0xedf58[_0x5f7d('0x47')],_0x390764[_0x5f7d('0x49')]));_0x4a321a[_0x5f7d('0x51')][_0x5f7d('0x6e')]=_0x7d82a4['id'];if(_0xedf58[_0x5f7d('0x47')][_0x5f7d('0x56')]){_0x4a321a[_0x5f7d('0x51')]=_[_0x5f7d('0x53')](_0x4a321a[_0x5f7d('0x51')],{'$or':_['map'](_0x4a321a[_0x5f7d('0x4b')],function(_0x57fd59){var _0x25da1e={};_0x25da1e[_0x57fd59]={'$like':'%'+_0xedf58['query']['filter']+'%'};return _0x25da1e;})});}_0x4a321a=_[_0x5f7d('0x53')]({},_0x4a321a,_0xedf58[_0x5f7d('0x57')]);return db['Disposition']['count']({'where':_0x4a321a[_0x5f7d('0x51')]})[_0x5f7d('0x39')](function(_0x55309a){_0x452801[_0x5f7d('0x32')]=_0x55309a;if(_0xedf58['query'][_0x5f7d('0x59')]){_0x4a321a[_0x5f7d('0x5a')]=[{'all':!![]}];}return db[_0x5f7d('0x6a')]['findAll'](_0x4a321a);})['then'](function(_0x44bb16){_0x452801['rows']=_0x44bb16;return _0x452801;});}})['then'](respondWithFilteredResult(_0x4d7c46,_0x4a321a))['catch'](handleError(_0x4d7c46,null));};exports[_0x5f7d('0x6f')]=function(_0x4d93c6,_0x38cc89,_0x4e23d9){return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x4d93c6[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x38cc89,null))['then'](function(_0x5232e7){if(_0x5232e7){return _0x5232e7[_0x5f7d('0x6f')](_0x4d93c6[_0x5f7d('0x47')][_0x5f7d('0x70')]);}})[_0x5f7d('0x39')](respondWithStatusCode(_0x38cc89,null))[_0x5f7d('0x2e')](handleError(_0x38cc89,null));};exports[_0x5f7d('0x71')]=function(_0xf51d56,_0x21136e,_0x501523){if(_0xf51d56[_0x5f7d('0x60')]['id']){delete _0xf51d56[_0x5f7d('0x60')]['id'];}return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0xf51d56[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x21136e,null))[_0x5f7d('0x39')](function(_0x293e3d){if(_0x293e3d){_0xf51d56[_0x5f7d('0x60')][_0x5f7d('0x6e')]=_0x293e3d['id'];return db[_0x5f7d('0x72')]['create'](_0xf51d56[_0x5f7d('0x60')]);}})[_0x5f7d('0x39')](respondWithResult(_0x21136e,null))['catch'](handleError(_0x21136e,null));};exports[_0x5f7d('0x73')]=function(_0x34fc72,_0x2f17b5,_0xd3b3f0){var _0x1bd7f6={'raw':![],'where':{}};var _0x28e048={};var _0x14610b={'count':0x0,'rows':[]};return db[_0x5f7d('0x58')][_0x5f7d('0x6c')]({'where':{'id':_0x34fc72[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x2f17b5,null))[_0x5f7d('0x39')](function(_0x55b118){if(_0x55b118){_0x28e048[_0x5f7d('0x46')]=_[_0x5f7d('0x48')](db[_0x5f7d('0x72')]['rawAttributes']);_0x28e048[_0x5f7d('0x47')]=_[_0x5f7d('0x48')](_0x34fc72[_0x5f7d('0x47')]);_0x28e048[_0x5f7d('0x49')]=_[_0x5f7d('0x4a')](_0x28e048['model'],_0x28e048[_0x5f7d('0x47')]);_0x1bd7f6[_0x5f7d('0x4b')]=_[_0x5f7d('0x4a')](_0x28e048[_0x5f7d('0x46')],qs['fields'](_0x34fc72[_0x5f7d('0x47')][_0x5f7d('0x4c')]));_0x1bd7f6[_0x5f7d('0x4b')]=_0x1bd7f6['attributes'][_0x5f7d('0x4d')]?_0x1bd7f6[_0x5f7d('0x4b')]:_0x28e048[_0x5f7d('0x46')];if(!_0x34fc72['query'][_0x5f7d('0x4e')](_0x5f7d('0x6d'))){_0x1bd7f6[_0x5f7d('0x34')]=qs[_0x5f7d('0x34')](_0x34fc72[_0x5f7d('0x47')]['limit']);_0x1bd7f6[_0x5f7d('0x33')]=qs[_0x5f7d('0x33')](_0x34fc72[_0x5f7d('0x47')]['offset']);}_0x1bd7f6[_0x5f7d('0x4f')]=qs[_0x5f7d('0x50')](_0x34fc72[_0x5f7d('0x47')]['sort']);_0x1bd7f6[_0x5f7d('0x51')]=qs[_0x5f7d('0x49')](_[_0x5f7d('0x52')](_0x34fc72[_0x5f7d('0x47')],_0x28e048[_0x5f7d('0x49')]));_0x1bd7f6['where'][_0x5f7d('0x6e')]=_0x55b118['id'];if(_0x34fc72[_0x5f7d('0x47')]['filter']){_0x1bd7f6['where']=_[_0x5f7d('0x53')](_0x1bd7f6[_0x5f7d('0x51')],{'$or':_[_0x5f7d('0x54')](_0x1bd7f6[_0x5f7d('0x4b')],function(_0x674f61){var _0x14d644={};_0x14d644[_0x674f61]={'$like':'%'+_0x34fc72[_0x5f7d('0x47')]['filter']+'%'};return _0x14d644;})});}_0x1bd7f6=_[_0x5f7d('0x53')]({},_0x1bd7f6,_0x34fc72['options']);return db[_0x5f7d('0x72')]['count']({'where':_0x1bd7f6['where']})['then'](function(_0x3d6890){_0x14610b[_0x5f7d('0x32')]=_0x3d6890;if(_0x34fc72[_0x5f7d('0x47')][_0x5f7d('0x59')]){_0x1bd7f6['include']=[{'all':!![]}];}return db[_0x5f7d('0x72')][_0x5f7d('0x74')](_0x1bd7f6);})['then'](function(_0x1818d9){_0x14610b[_0x5f7d('0x75')]=_0x1818d9;return _0x14610b;});}})[_0x5f7d('0x39')](respondWithFilteredResult(_0x2f17b5,_0x1bd7f6))['catch'](handleError(_0x2f17b5,null));};exports[_0x5f7d('0x76')]=function(_0x4beab4,_0x499a62,_0x4c97d4){return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x4beab4[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x499a62,null))[_0x5f7d('0x39')](function(_0xcb3456){if(_0xcb3456){return _0xcb3456[_0x5f7d('0x76')](_0x4beab4[_0x5f7d('0x47')][_0x5f7d('0x70')]);}})['then'](respondWithStatusCode(_0x499a62,null))[_0x5f7d('0x2e')](handleError(_0x499a62,null));};exports[_0x5f7d('0x77')]=function(_0x28347e,_0x16ad64,_0x483ee5){_0x28347e[_0x5f7d('0x60')]['sitepic']=_0x28347e[_0x5f7d('0x78')][_0x5f7d('0x79')];return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x28347e[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x16ad64,null))[_0x5f7d('0x39')](saveUpdates(_0x28347e[_0x5f7d('0x60')],null))[_0x5f7d('0x39')](respondWithResult(_0x16ad64,null))['catch'](handleError(_0x16ad64,null));};exports[_0x5f7d('0x7a')]=function(_0x24c1b4,_0x313c0b,_0x5ee68f){_0x24c1b4['body']['agentAvatar']=_0x24c1b4[_0x5f7d('0x78')][_0x5f7d('0x79')];return db[_0x5f7d('0x58')]['find']({'where':{'id':_0x24c1b4[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x313c0b,null))[_0x5f7d('0x39')](saveUpdates(_0x24c1b4[_0x5f7d('0x60')],null))[_0x5f7d('0x39')](respondWithResult(_0x313c0b,null))['catch'](handleError(_0x313c0b,null));};exports[_0x5f7d('0x7b')]=function(_0x5c294f,_0x369b6e,_0x543da7){_0x5c294f[_0x5f7d('0x60')][_0x5f7d('0x7c')]=_0x5c294f[_0x5f7d('0x78')][_0x5f7d('0x79')];return db[_0x5f7d('0x58')]['find']({'where':{'id':_0x5c294f[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x369b6e,null))[_0x5f7d('0x39')](saveUpdates(_0x5c294f[_0x5f7d('0x60')],null))[_0x5f7d('0x39')](respondWithResult(_0x369b6e,null))[_0x5f7d('0x2e')](handleError(_0x369b6e,null));};exports[_0x5f7d('0x7d')]=function(_0x41ed44,_0x5b8eab,_0x2d093b){_0x41ed44['body']['systemAvatar']=_0x41ed44['file'][_0x5f7d('0x79')];return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x41ed44['params']['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x5b8eab,null))[_0x5f7d('0x39')](saveUpdates(_0x41ed44[_0x5f7d('0x60')],null))[_0x5f7d('0x39')](respondWithResult(_0x5b8eab,null))[_0x5f7d('0x2e')](handleError(_0x5b8eab,null));};exports['getLogo']=function(_0x4fe7ce,_0x3496b6,_0x4c9dc0){var _0x492147=path['join'](config[_0x5f7d('0x7e')],_0x5f7d('0x7f'));var _0x16becc={'where':{'id':_0x4fe7ce[_0x5f7d('0x5c')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3b93ff=![];return require(_0x5f7d('0x80'))[_0x5f7d('0x81')]()[_0x5f7d('0x39')](function(_0x1c7c72){if(_0x1c7c72){_0x3b93ff=_0x1c7c72[_0x5f7d('0x82')];}})['then'](function(){return db[_0x5f7d('0x58')][_0x5f7d('0x5e')](_0x16becc);})[_0x5f7d('0x39')](handleEntityNotFound(_0x3496b6,null))[_0x5f7d('0x39')](function(_0xf8e467){if(_0xf8e467){if(!_[_0x5f7d('0x83')](_0xf8e467['sitepic'])){if(fs[_0x5f7d('0x84')](path['join'](config[_0x5f7d('0x7e')],_0x5f7d('0x85'),_0xf8e467['sitepic']))&&_0x3b93ff){_0x492147=path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],'server/files/images/logos/',_0xf8e467[_0x5f7d('0x87')]);}}return _0x3496b6[_0x5f7d('0x88')](_0x492147);}})['catch'](handleError(_0x3496b6,null));};exports[_0x5f7d('0x89')]=function(_0x2d5058,_0x236e8b,_0x55d6fa){var _0x4d86aa=path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],_0x5f7d('0x8a'));var _0x1db73e={'where':{'id':_0x2d5058[_0x5f7d('0x5c')]['id']},'attributes':['id',_0x5f7d('0x8b')],'raw':!![]};return db[_0x5f7d('0x58')][_0x5f7d('0x5e')](_0x1db73e)['then'](handleEntityNotFound(_0x236e8b,null))['then'](function(_0x463abc){if(_0x463abc){if(!_[_0x5f7d('0x83')](_0x463abc[_0x5f7d('0x8b')])){if(fs[_0x5f7d('0x84')](path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],'server/files/images/avatars/',_0x463abc['agentAvatar']))){_0x4d86aa=path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],_0x5f7d('0x8c'),_0x463abc[_0x5f7d('0x8b')]);}}return _0x236e8b[_0x5f7d('0x88')](_0x4d86aa);}})[_0x5f7d('0x2e')](handleError(_0x236e8b,null));};exports[_0x5f7d('0x8d')]=function(_0x1d8970,_0x336fb2,_0x3e5a0c){var _0x2d75c6=path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],_0x5f7d('0x8e'));var _0x482b6a={'where':{'id':_0x1d8970['params']['id']},'attributes':['id',_0x5f7d('0x7c'),_0x5f7d('0x8f')],'raw':!![]};return db[_0x5f7d('0x58')][_0x5f7d('0x5e')](_0x482b6a)[_0x5f7d('0x39')](handleEntityNotFound(_0x336fb2,null))[_0x5f7d('0x39')](function(_0x35608c){if(_0x35608c){if(!_['isNil'](_0x35608c[_0x5f7d('0x7c')])){if(fs[_0x5f7d('0x84')](path[_0x5f7d('0x86')](config['root'],_0x5f7d('0x8c'),_0x35608c['customerAvatar']))&&_0x35608c[_0x5f7d('0x8f')]){_0x2d75c6=path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],_0x5f7d('0x8c'),_0x35608c[_0x5f7d('0x7c')]);}}return _0x336fb2[_0x5f7d('0x88')](_0x2d75c6);}})[_0x5f7d('0x2e')](handleError(_0x336fb2,null));};exports[_0x5f7d('0x90')]=function(_0x4868fa,_0xf7523b,_0x318234){var _0x552e11=path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],_0x5f7d('0x91'));var _0x104d60={'where':{'id':_0x4868fa[_0x5f7d('0x5c')]['id']},'attributes':['id',_0x5f7d('0x92')],'raw':!![]};return db[_0x5f7d('0x58')][_0x5f7d('0x5e')](_0x104d60)[_0x5f7d('0x39')](handleEntityNotFound(_0xf7523b,null))[_0x5f7d('0x39')](function(_0x161255){if(_0x161255){if(!_[_0x5f7d('0x83')](_0x161255[_0x5f7d('0x92')])){if(fs[_0x5f7d('0x84')](path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],_0x5f7d('0x8c'),_0x161255[_0x5f7d('0x92')]))){_0x552e11=path['join'](config[_0x5f7d('0x7e')],'server/files/images/avatars/',_0x161255['systemAvatar']);}}return _0xf7523b[_0x5f7d('0x88')](_0x552e11);}})[_0x5f7d('0x2e')](handleError(_0xf7523b,null));};exports['notify']=function(_0x42de26,_0x157bf1,_0x53e6cd){var _0x21b426=require(_0x5f7d('0x93'));var _0x398c7e=new _0x21b426();var _0xce077c=_0x398c7e[_0x5f7d('0x94')](_0x42de26[_0x5f7d('0x95')][_0x5f7d('0x96')])[_0x5f7d('0x97')]();var _0x34153e={'body':_0x42de26['body'],'channel':_0x5f7d('0x98')};var _0x30b168=[];var _0x2ae317=[];var _0x3db643={};var _0x591671=![];return db[_0x5f7d('0x99')][_0x5f7d('0x68')]()[_0x5f7d('0x39')](function(_0x4154d0){if(!_0x4154d0){throw new db['Sequelize']['ValidationError'](_0x5f7d('0x9a'));}_0x30b168=_['difference'](_[_0x5f7d('0x48')](_0x4154d0),[_0x5f7d('0x9b'),'updatedAt']);_0x2ae317=_[_0x5f7d('0x9c')](_['keys'](_0x4154d0),[_0x5f7d('0x9b'),_0x5f7d('0x9d'),_0x5f7d('0x9e'),_0x5f7d('0x9f')]);if(_0x42de26['body']['id']){delete _0x42de26[_0x5f7d('0x60')]['id'];}if(_[_0x5f7d('0x83')](_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xa0')])){throw new db[(_0x5f7d('0x22'))][(_0x5f7d('0xa1'))](_0x5f7d('0xa2'));}if(_[_0x5f7d('0x83')](_0x42de26[_0x5f7d('0x60')]['body'])||_0x42de26['body'][_0x5f7d('0x60')]===''){throw new db['Sequelize'][(_0x5f7d('0xa1'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5f7d('0x83')](_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xa3')])){throw new db[(_0x5f7d('0x22'))][(_0x5f7d('0xa1'))](_0x5f7d('0xa4')+_0x2ae317);}if(!_[_0x5f7d('0xa5')](_0x2ae317,_0x42de26[_0x5f7d('0x60')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ae317);}_0x3db643[_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xa3')]]=_0x42de26['body']['from'];})[_0x5f7d('0x39')](function(){return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x42de26[_0x5f7d('0x5c')]['id']},'include':[{'model':db[_0x5f7d('0xa6')],'as':_0x5f7d('0xa7'),'include':[{'model':db[_0x5f7d('0x99')],'as':_0x5f7d('0xa8'),'where':_0x3db643,'limit':0x1,'order':[['updatedAt',_0x5f7d('0xa9')]]}]},{'model':db['ChatApplication'],'as':_0x5f7d('0xaa')}]});})[_0x5f7d('0x39')](handleEntityNotFound(_0x157bf1,null))[_0x5f7d('0x39')](function(_0x33cff6){if(_0x33cff6&&_0x33cff6['List']){_0x34153e[_0x5f7d('0xab')]=_0x33cff6;_0x34153e[_0x5f7d('0xac')]=_0x33cff6['Applications'];_0x34153e[_0x5f7d('0xad')]=_0x33cff6['List'];_0x34153e[_0x5f7d('0xac')]=_['orderBy'](_0x34153e[_0x5f7d('0xac')],[_0x5f7d('0xae')],[_0x5f7d('0xaf')]);if(_0x34153e[_0x5f7d('0xab')][_0x5f7d('0xaa')]){delete _0x34153e[_0x5f7d('0xab')][_0x5f7d('0xaa')];}if(_0x34153e['account'][_0x5f7d('0xa7')]&&_0x34153e[_0x5f7d('0xab')][_0x5f7d('0xa7')]['Contacts']['length']){return _0x34153e[_0x5f7d('0xab')][_0x5f7d('0xa7')][_0x5f7d('0xa8')][0x0];}var _0x4812ec=_['defaults'](_0x42de26[_0x5f7d('0x60')],{'firstName':_0x42de26[_0x5f7d('0x60')]['from'],'ListId':_0x33cff6[_0x5f7d('0x9f')]});_0x4812ec[_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xa3')]]=_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xa0')];return db[_0x5f7d('0x99')][_0x5f7d('0x5f')](_0x4812ec,{'fields':_0x30b168,'raw':!![]});}})[_0x5f7d('0x39')](handleEntityNotFound(_0x157bf1,null))[_0x5f7d('0x39')](function(_0x9926b5){_0x34153e[_0x5f7d('0xb0')]=_0x9926b5;var _0x199ff0=_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xb1')];if(_0x42de26[_0x5f7d('0x95')]['cf-connecting-ip']){_0x199ff0=_0x42de26[_0x5f7d('0x95')][_0x5f7d('0xb2')];}else if(_0x42de26[_0x5f7d('0x95')][_0x5f7d('0xb3')]){_0x199ff0=_[_0x5f7d('0xb4')](_0x42de26[_0x5f7d('0x95')][_0x5f7d('0xb3')]['split'](','));}if(_0x9926b5){var _0x43d6fc={'ContactId':_0x9926b5['id'],'ChatWebsiteId':_0x42de26[_0x5f7d('0x5c')]['id'],'from':(_0x9926b5[_0x5f7d('0xb5')]||'')+'\x20'+(_0x9926b5[_0x5f7d('0xb6')]||''),'customerIp':_0x199ff0,'customerPort':_0x42de26[_0x5f7d('0x95')]['x-real-port']?_0x42de26['headers'][_0x5f7d('0xb7')]:null,'referer':_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xb8')],'browserName':_0xce077c[_0x5f7d('0xb9')]['name']&&_0xce077c[_0x5f7d('0xb9')][_0x5f7d('0xba')]?util['format'](_0x5f7d('0xbb'),_0xce077c[_0x5f7d('0xb9')][_0x5f7d('0x3e')],_0xce077c[_0x5f7d('0xb9')][_0x5f7d('0xba')]):_0x5f7d('0xbc'),'browserVersion':_0xce077c['browser'][_0x5f7d('0xba')]||_0x5f7d('0xbc'),'osName':util['format'](_0x5f7d('0xbb'),_0xce077c['os'][_0x5f7d('0x3e')],_0xce077c['os'][_0x5f7d('0xba')]),'osVersion':_0xce077c['os'][_0x5f7d('0xba')],'deviceModel':_0xce077c[_0x5f7d('0xbd')]['model']&&_0xce077c[_0x5f7d('0xbd')][_0x5f7d('0xbe')]?util['format'](_0x5f7d('0xbf'),_0xce077c['device']['model'],_0xce077c[_0x5f7d('0xbd')]['vendor'],_0xce077c[_0x5f7d('0xbd')]['type']):null,'deviceVendor':_0xce077c[_0x5f7d('0xbd')]['vendor'],'deviceType':_0xce077c[_0x5f7d('0xbd')][_0x5f7d('0x44')],'formData':JSON[_0x5f7d('0x29')](_0x42de26['body'])};var _0x2719cd={'ChatWebsiteId':_0x42de26[_0x5f7d('0x5c')]['id'],'closed':![]};if(_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xc0')]){_0x2719cd[_0x5f7d('0xc0')]=_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xc0')];return db[_0x5f7d('0xc1')][_0x5f7d('0x5e')]({'where':_0x2719cd})[_0x5f7d('0x39')](function(_0x2d6ff4){if(_0x2d6ff4){return[_0x2d6ff4,![]];}_0x43d6fc[_0x5f7d('0xc0')]=_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xc0')];_0x43d6fc['externalUrl']=_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xc2')];return db[_0x5f7d('0xc1')][_0x5f7d('0x5f')](_0x43d6fc)['then'](function(_0xd8d17a){return[_0xd8d17a,!![]];});});}_0x2719cd[_0x5f7d('0xc3')]=_0x9926b5['id'];if(_0x42de26[_0x5f7d('0x60')]['interaction']&&_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xc4')]['id']){_0x2719cd['id']=_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xc4')]['id'];return db[_0x5f7d('0xc1')][_0x5f7d('0x5e')]({'where':_0x2719cd})[_0x5f7d('0x39')](function(_0x4fcdc5){if(_0x4fcdc5){return[_0x4fcdc5,![]];}return db[_0x5f7d('0xc1')][_0x5f7d('0x5f')](_0x43d6fc)[_0x5f7d('0x39')](function(_0x3419ea){return[_0x3419ea,!![]];});});}return db[_0x5f7d('0xc1')][_0x5f7d('0x5f')](_0x43d6fc)['then'](function(_0x2c0ddd){return[_0x2c0ddd,!![]];});}})['spread'](function(_0x21ff12,_0x145932){if(_0x21ff12){_0x591671=_0x145932;if(!_0x145932){var _0x51d03a={'from':(_0x34153e[_0x5f7d('0xb0')][_0x5f7d('0xb5')]||'')+'\x20'+(_0x34153e[_0x5f7d('0xb0')][_0x5f7d('0xb6')]||'')};if(_0x42de26[_0x5f7d('0x60')][_0x5f7d('0xc0')]&&_0x42de26['body'][_0x5f7d('0xc5')]&&_0x42de26['body'][_0x5f7d('0xc0')]!=_0x42de26[_0x5f7d('0x60')]['messageId']){_0x51d03a[_0x5f7d('0xc0')]=_0x42de26[_0x5f7d('0x60')]['messageId'];}return _0x21ff12[_0x5f7d('0x38')](_0x51d03a);}else{return _0x21ff12;}}})[_0x5f7d('0x39')](function(_0x2d885e){_0x34153e[_0x5f7d('0xc4')]=_0x2d885e[_0x5f7d('0x3b')]({'plain':!![]});_0x34153e[_0x5f7d('0xc4')][_0x5f7d('0xc6')]=_0x591671;if(_0x34153e['interaction'][_0x5f7d('0xc6')]){if(_0x34153e['account'][_0x5f7d('0xc7')]){_0x34153e[_0x5f7d('0xac')][_0x5f7d('0xc8')]({'id':0x0,'priority':_0x34153e[_0x5f7d('0xac')][_0x5f7d('0x4d')]+0x1,'app':_0x5f7d('0xc9'),'appdata':'unmanaged','interval':_0x5f7d('0xca')});}}return db['ChatMessage'][_0x5f7d('0x5f')]({'body':_0x42de26[_0x5f7d('0x60')][_0x5f7d('0x60')],'ChatWebsiteId':_0x42de26[_0x5f7d('0x5c')]['id'],'ChatInteractionId':_0x2d885e['id'],'direction':'in','ContactId':_0x34153e[_0x5f7d('0xb0')]['id'],'AttachmentId':_0x42de26['body'][_0x5f7d('0xcb')]});})[_0x5f7d('0x39')](function(_0x2256d5){_0x34153e[_0x5f7d('0x2c')]=_0x2256d5;if(_0x34153e[_0x5f7d('0xc4')][_0x5f7d('0xcc')]){return db[_0x5f7d('0xcd')]['find']({'attributes':['id',_0x5f7d('0x3e')],'where':{'id':_0x34153e[_0x5f7d('0xc4')][_0x5f7d('0xcc')]}})['then'](function(_0x72c9ad){if(_0x72c9ad){_0x34153e['applications'][_0x5f7d('0xce')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x72c9ad[_0x5f7d('0x3e')]+','+(_0x34153e[_0x5f7d('0xab')][_0x5f7d('0xcf')]||0xa),'interval':_0x5f7d('0xca')});_0x34153e[_0x5f7d('0xd0')]=!![];}return respondWithRpcPromise(_0x5f7d('0xd1'),_0x5f7d('0xd2'),_0x34153e);});}return respondWithRpcPromise(_0x5f7d('0xd1'),'startRouting',_0x34153e);})[_0x5f7d('0x39')](function(_0x1f7875){respondWithRpcPromise(_0x5f7d('0xd3'),'EventManager',{'event':'notify','message':_0x1f7875},client9002);return _0x1f7875;})[_0x5f7d('0x39')](respondWithResult(_0x157bf1,null))['catch'](handleError(_0x157bf1,null));};exports[_0x5f7d('0xd4')]=function(_0x10de85,_0x5c12d7,_0x1be3af){var _0x4590ca,_0x445345,_0xaba87f;var _0x4f226b=[];var _0x21b0b2=[];var _0x267190={};return db[_0x5f7d('0x99')]['describe']()['then'](function(_0x277026){if(!_0x277026){throw new db[(_0x5f7d('0x22'))]['ValidationError'](_0x5f7d('0x9a'));}_0x21b0b2=_[_0x5f7d('0x9c')](_[_0x5f7d('0x48')](_0x277026),[_0x5f7d('0x9b'),'updatedAt']);_0x4f226b=_['difference'](_[_0x5f7d('0x48')](_0x277026),['createdAt',_0x5f7d('0x9d'),_0x5f7d('0x9e'),_0x5f7d('0x9f')]);if(_0x10de85[_0x5f7d('0x60')]['id']){delete _0x10de85[_0x5f7d('0x60')]['id'];}if(_['isNil'](_0x10de85[_0x5f7d('0x60')][_0x5f7d('0xa0')])){throw _0x5c12d7[_0x5f7d('0x30')](0x1f4)['send'](new db[(_0x5f7d('0x22'))][(_0x5f7d('0xa1'))](_0x5f7d('0xa2')));}if(_[_0x5f7d('0x83')](_0x10de85[_0x5f7d('0x60')][_0x5f7d('0x60')])||_0x10de85[_0x5f7d('0x60')]['body']===''){throw _0x5c12d7['status'](0x1f4)[_0x5f7d('0x3f')](new db['Sequelize']['ValidationError'](_0x5f7d('0xd5')));}if(_[_0x5f7d('0x83')](_0x10de85['body']['mapKeyOffline'])){throw _0x5c12d7[_0x5f7d('0x30')](0x1f4)[_0x5f7d('0x3f')](new db['Sequelize'][(_0x5f7d('0xa1'))](_0x5f7d('0xd6')+_0x4f226b));}if(!_['includes'](_0x4f226b,_0x10de85['body'][_0x5f7d('0xd7')])){throw _0x5c12d7['status'](0x1f4)[_0x5f7d('0x3f')](new db[(_0x5f7d('0x22'))][(_0x5f7d('0xa1'))](_0x5f7d('0xd8')+_0x4f226b));}_0x267190[_0x10de85[_0x5f7d('0x60')][_0x5f7d('0xd7')]]=_0x10de85[_0x5f7d('0x60')][_0x5f7d('0xa0')];})[_0x5f7d('0x39')](function(){return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x10de85[_0x5f7d('0x5c')]['id']},'include':[{'model':db[_0x5f7d('0xa6')],'as':_0x5f7d('0xa7')}]});})['then'](handleEntityNotFound(_0x5c12d7,null))[_0x5f7d('0x39')](function(_0x45e5b2){if(_0x45e5b2&&_0x45e5b2[_0x5f7d('0xa7')]){_0x445345=_0x45e5b2;var _0x366486=_['defaults'](_0x10de85[_0x5f7d('0x60')],{'firstName':_0x10de85[_0x5f7d('0x60')][_0x5f7d('0xa0')],'phone':_0x10de85[_0x5f7d('0x60')]['from'],'ListId':_0x45e5b2[_0x5f7d('0x9f')]});_0x366486[_0x10de85[_0x5f7d('0x60')]['mapKeyOffline']]=_0x10de85[_0x5f7d('0x60')][_0x5f7d('0xa0')];return db[_0x5f7d('0x99')][_0x5f7d('0xd9')]({'where':_0x267190,'defaults':_0x366486});}})['spread'](function(_0xee166){if(_0xee166){_0xaba87f=_0xee166;var _0x48d7fa=fs[_0x5f7d('0xda')](path[_0x5f7d('0x86')](config['root'],_0x5f7d('0xdb')),'utf8');var _0x25a5fc=ejs[_0x5f7d('0xdc')](_0x48d7fa,{'body':_[_0x5f7d('0xdd')](_0x10de85[_0x5f7d('0x60')][_0x5f7d('0x60')]),'bodyTitle':_0x445345[_0x5f7d('0xde')]});return db['ChatOfflineMessage'][_0x5f7d('0x5f')]({'body':_0x25a5fc,'ContactId':_0xee166['id'],'ChatWebsiteId':_0x445345['id']});}})[_0x5f7d('0x39')](function(_0xcc13a0){if(_0xcc13a0){_0x4590ca=_0xcc13a0;return db[_0x5f7d('0xdf')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x5f7d('0xe0')],'as':_0x5f7d('0xe1'),'raw':!![]}]});}})[_0x5f7d('0x39')](function(_0x532e35){if(_0x532e35&&_0x532e35[_0x5f7d('0xe1')]&&_0x445345[_0x5f7d('0xe2')]){var _0x46050b={'tls':{'rejectUnauthorized':![]}};if(_0x532e35[_0x5f7d('0xe1')]['service']){_0x46050b[_0x5f7d('0xe3')]=_0x532e35['Smtp'][_0x5f7d('0xe3')];}else{_0x46050b[_0x5f7d('0xe4')]=_0x532e35['Smtp'][_0x5f7d('0xe4')];_0x46050b[_0x5f7d('0xe5')]=_0x532e35['Smtp'][_0x5f7d('0xe5')];_0x46050b[_0x5f7d('0xe6')]=_0x532e35[_0x5f7d('0xe1')][_0x5f7d('0xe6')];}if(_0x532e35[_0x5f7d('0xe1')]['authentication']){_0x46050b[_0x5f7d('0xe7')]={'user':_0x532e35[_0x5f7d('0xe1')][_0x5f7d('0x61')],'pass':_0x532e35['Smtp'][_0x5f7d('0xe8')]};}return respondWithRpcPromise(_0x5f7d('0xe9'),_0x5f7d('0xea'),{'account':_0x46050b,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x532e35['name'],_0x532e35['email']||_0x532e35[_0x5f7d('0xe1')][_0x5f7d('0x61')]),'to':_0x445345[_0x5f7d('0xe2')],'subject':_0x445345['offlineMessageSubject'],'text':_0x4590ca[_0x5f7d('0x60')]}},client9003)[_0x5f7d('0x39')](function(){return _0x4590ca;})[_0x5f7d('0x2e')](function(_0x1da33b){console[_0x5f7d('0x2a')](_0x1da33b);});}})[_0x5f7d('0x39')](function(){if(_0x4590ca){return _0x4590ca;}})[_0x5f7d('0x39')](respondWithResult(_0x5c12d7,null))[_0x5f7d('0x2e')](handleError(_0x5c12d7,null));};exports['addInteraction']=function(_0x4f57de,_0x515cb5,_0x4980b0){return db['ChatInteraction'][_0x5f7d('0x5e')]({'where':{'id':_0x4f57de['params']['id']}})['then'](handleEntityNotFound(_0x515cb5,null))[_0x5f7d('0x39')](function(_0x17b7a1){if(_0x17b7a1){return _0x17b7a1['addInteraction'](_0x4f57de[_0x5f7d('0x60')]['ids'],_[_0x5f7d('0xeb')](_0x4f57de[_0x5f7d('0x60')],[_0x5f7d('0x70'),'id'])||{});}})[_0x5f7d('0x39')](respondWithResult(_0x515cb5,null))[_0x5f7d('0x2e')](handleError(_0x515cb5,null));};exports['getInteractions']=function(_0xcb1778,_0x8ee5aa,_0x3bd2a5){var _0x3d6fc6={'raw':![],'where':{}};var _0x497963={};var _0x3f8503={'count':0x0,'rows':[]};return db[_0x5f7d('0x58')][_0x5f7d('0x6c')]({'where':{'id':_0xcb1778[_0x5f7d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x8ee5aa,null))[_0x5f7d('0x39')](function(_0x5922e9){if(_0x5922e9){_0x497963[_0x5f7d('0x46')]=_[_0x5f7d('0x48')](db['ChatInteraction'][_0x5f7d('0x42')]);_0x497963['query']=_[_0x5f7d('0x48')](_0xcb1778['query']);_0x497963[_0x5f7d('0x49')]=_[_0x5f7d('0x4a')](_0x497963[_0x5f7d('0x46')],_0x497963[_0x5f7d('0x47')]);_0x3d6fc6[_0x5f7d('0x4b')]=_['intersection'](_0x497963[_0x5f7d('0x46')],qs['fields'](_0xcb1778[_0x5f7d('0x47')][_0x5f7d('0x4c')]));_0x3d6fc6[_0x5f7d('0x4b')]=_0x3d6fc6[_0x5f7d('0x4b')][_0x5f7d('0x4d')]?_0x3d6fc6[_0x5f7d('0x4b')]:_0x497963[_0x5f7d('0x46')];if(!_0xcb1778[_0x5f7d('0x47')][_0x5f7d('0x4e')](_0x5f7d('0x6d'))){_0x3d6fc6[_0x5f7d('0x34')]=qs[_0x5f7d('0x34')](_0xcb1778[_0x5f7d('0x47')][_0x5f7d('0x34')]);_0x3d6fc6['offset']=qs[_0x5f7d('0x33')](_0xcb1778[_0x5f7d('0x47')][_0x5f7d('0x33')]);}_0x3d6fc6['order']=qs[_0x5f7d('0x50')](_0xcb1778['query'][_0x5f7d('0x50')]);_0x3d6fc6[_0x5f7d('0x51')]=qs['filters'](_[_0x5f7d('0x52')](_0xcb1778[_0x5f7d('0x47')],_0x497963[_0x5f7d('0x49')]));_0x3d6fc6[_0x5f7d('0x51')][_0x5f7d('0x6e')]=_0x5922e9['id'];if(_0xcb1778[_0x5f7d('0x47')][_0x5f7d('0x56')]){_0x3d6fc6[_0x5f7d('0x51')]=_[_0x5f7d('0x53')](_0x3d6fc6[_0x5f7d('0x51')],{'$or':_[_0x5f7d('0x54')](_0x3d6fc6['attributes'],function(_0x39cdc5){var _0x495dd9={};_0x495dd9[_0x39cdc5]={'$like':'%'+_0xcb1778['query'][_0x5f7d('0x56')]+'%'};return _0x495dd9;})});}_0x3d6fc6=_['merge']({},_0x3d6fc6,_0xcb1778[_0x5f7d('0x57')]);return db[_0x5f7d('0xc1')][_0x5f7d('0x32')]({'where':_0x3d6fc6[_0x5f7d('0x51')]})['then'](function(_0x475bdb){_0x3f8503['count']=_0x475bdb;if(_0xcb1778[_0x5f7d('0x47')][_0x5f7d('0x59')]){_0x3d6fc6[_0x5f7d('0x5a')]=[{'model':db[_0x5f7d('0x99')],'as':_0x5f7d('0xec'),'required':![]},{'model':db[_0x5f7d('0xcd')],'as':_0x5f7d('0xed'),'attributes':['name',_0x5f7d('0xee'),_0x5f7d('0xef')],'required':![]},{'model':db[_0x5f7d('0xf0')],'as':_0x5f7d('0xf1'),'attributes':['id',_0x5f7d('0x3e'),_0x5f7d('0xf2')],'where':_0xcb1778['query']['tag']?{'id':_0xcb1778[_0x5f7d('0x47')][_0x5f7d('0xf3')]}:undefined,'required':_0xcb1778[_0x5f7d('0x47')][_0x5f7d('0xf3')]?!![]:![]}];}return db[_0x5f7d('0xc1')]['findAll'](_0x3d6fc6);})['then'](function(_0x4c3be5){_0x3f8503[_0x5f7d('0x75')]=_0x4c3be5;return _0x3f8503;});}})[_0x5f7d('0x39')](respondWithFilteredResult(_0x8ee5aa,_0x3d6fc6))[_0x5f7d('0x2e')](handleError(_0x8ee5aa,null));};function iftimePromise(_0x4b34c5,_0x16cd64){return respondWithRpcPromise(_0x5f7d('0xf4'),_0x5f7d('0xf5'),{'command':_0x16cd64[_0x5f7d('0xf6')]?util[_0x5f7d('0xf7')]('iftime\x20%s,%s',_0x4b34c5[_0x5f7d('0xf8')],_0x16cd64[_0x5f7d('0xf6')]):util['format']('iftime\x20%s',_0x4b34c5[_0x5f7d('0xf8')])},client9002)[_0x5f7d('0x39')](function(_0x41fae8){var _0x58f641=_0x41fae8&&_0x41fae8[_0x5f7d('0xf9')](_0x5f7d('0xfa'))>=0x0?!![]:![];logger[_0x5f7d('0x24')](_0x5f7d('0xfb'),_0x16cd64['id'],_0x4b34c5['id'],_0x4b34c5[_0x5f7d('0xf8')],_0x58f641?_0x5f7d('0xfc'):_0x5f7d('0xfd'),_0x16cd64[_0x5f7d('0xf6')]?_0x16cd64[_0x5f7d('0xf6')]:'No\x20timezone');return _0x58f641;})['catch'](function(_0x3e7912){logger[_0x5f7d('0x2a')](_0x5f7d('0xfb'),_0x16cd64['id'],_0x4b34c5['id'],_0x4b34c5[_0x5f7d('0xf8')],util['inspect'](_0x3e7912,{'showHidden':![],'depth':null}),_0x16cd64['timezone']?_0x16cd64[_0x5f7d('0xf6')]:_0x5f7d('0xfe'));return![];});}exports[_0x5f7d('0xf5')]=function(_0x4a273e,_0x286ef5,_0x2ca1c6){var _0x3d2c47=0x0;var _0x1b7744=0x0;var _0x51dc6c=![];var _0x15d611;var _0x426615;return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x4a273e[_0x5f7d('0x5c')]['id']},'include':[{'model':db['Interval'],'as':_0x5f7d('0xff'),'include':[{'model':db[_0x5f7d('0xff')],'as':_0x5f7d('0x100'),'attributes':['id',_0x5f7d('0xf8')],'raw':!![]}]}]})[_0x5f7d('0x39')](handleEntityNotFound(_0x286ef5,null))[_0x5f7d('0x39')](function(_0x4db77b){if(_0x4db77b){_0x15d611=_0x4db77b;return _0x4db77b[_0x5f7d('0x101')]({'raw':!![]});}})[_0x5f7d('0x39')](function(_0x479467){if(_0x15d611){if(_0x479467){_0x426615=_0x479467;}}return require(_0x5f7d('0x80'))['getLicense']();})[_0x5f7d('0x39')](function(_0xf453d7){if(_0xf453d7){_0x1b7744=_0xf453d7['virtual'];_0x51dc6c=_0xf453d7['custom'];}})[_0x5f7d('0x39')](function(){return db[_0x5f7d('0xc1')][_0x5f7d('0x32')]({'where':{'closed':![]}});})[_0x5f7d('0x39')](function(_0x5bc971){_0x3d2c47=_0x5bc971;if(_0x1b7744&&_0x5bc971>_0x1b7744){return db['License'][_0x5f7d('0x6c')]({'where':{'id':0x1}})[_0x5f7d('0x39')](function(_0x166ac4){if(_0x166ac4){_0x166ac4[_0x5f7d('0x102')](_0x5f7d('0x103'));}});}})[_0x5f7d('0x39')](function(){if(_0x15d611[_0x5f7d('0xff')]&&_0x15d611[_0x5f7d('0xff')]['Intervals']){var _0x27624c=[];for(var _0x113367=0x0;_0x113367<_0x15d611[_0x5f7d('0xff')][_0x5f7d('0x100')][_0x5f7d('0x4d')];_0x113367++){var _0x5e47cc=_0x15d611[_0x5f7d('0xff')][_0x5f7d('0x100')][_0x113367][_0x5f7d('0x3b')]({'plain':!![]});_0x27624c[_0x5f7d('0xc8')](iftimePromise(_0x5e47cc,_0x15d611));}return BPromise['all'](_0x27624c)[_0x5f7d('0x39')](function(_0x5e6d34){return _['some'](_0x5e6d34);});}else{return!![];}})['then'](function(_0xe86118){var _0x3d2145=fs['readFileSync'](path[_0x5f7d('0x86')](config[_0x5f7d('0x7e')],_0x5f7d('0x104')),'utf8');var _0x4d3b9f={'remote':_0x15d611[_0x5f7d('0x105')],'query':querystring['stringify'](_[_0x5f7d('0x53')](_0x15d611['get']({'plain':!![]}),{'customerIp':_0x4a273e['headers']['x-forwarded-for']||_0x4a273e[_0x5f7d('0x95')]['x-real-ip']||_0x4a273e[_0x5f7d('0x106')]['remoteAddress']||_0x4a273e['ip'],'referer':_0x4a273e['headers']['referer'],'openedInteractions':_0x3d2c47,'maxInteractions':_0x1b7744,'virtual':_0x51dc6c['virtual'],'online':_0xe86118,'custom':_0x51dc6c}))[_0x5f7d('0x107')](/'/g,'\x5c\x27')};_0x286ef5[_0x5f7d('0x3f')](ejs[_0x5f7d('0xdc')](Mustache[_0x5f7d('0xdc')](_0x3d2145,_0x4d3b9f),{'proactiveActions':_0x426615,'alignment':_0x15d611[_0x5f7d('0x108')],'verticalAlignment':_0x15d611[_0x5f7d('0x109')],'div_color':_0x15d611[_0x5f7d('0xf2')],'text_color':_0x15d611[_0x5f7d('0x10a')]}));})[_0x5f7d('0x2e')](handleError(_0x286ef5,null));};exports[_0x5f7d('0x10b')]=function(_0xaac5d9,_0x6d5694,_0x4df574){return db['ChatWebsite'][_0x5f7d('0x6c')]({'where':{'id':_0xaac5d9['params']['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x6d5694,null))[_0x5f7d('0x39')](function(_0x293a4d){if(_0x293a4d){return db['sequelize']['transaction'](function(_0x43dfe7){return db['ChatApplication'][_0x5f7d('0x3a')]({'where':{'ChatWebsiteId':_0xaac5d9[_0x5f7d('0x5c')]['id']},'transaction':_0x43dfe7})[_0x5f7d('0x39')](function(_0x2ea8db){var _0x18bfa9=_[_0x5f7d('0x54')](_0xaac5d9[_0x5f7d('0x60')],function(_0x1333ee){_0x1333ee[_0x5f7d('0x6e')]=_0xaac5d9[_0x5f7d('0x5c')]['id'];return _0x1333ee;});return db[_0x5f7d('0x10c')][_0x5f7d('0x10d')](_0x18bfa9,{'transaction':_0x43dfe7});});})['then'](function(){return db['ChatApplication'][_0x5f7d('0x10e')]({'where':{'ChatWebsiteId':_0xaac5d9[_0x5f7d('0x5c')]['id']},'order':_0x5f7d('0xae')});});}})['then'](respondWithResult(_0x6d5694,null))['catch'](handleError(_0x6d5694,null));};exports[_0x5f7d('0x10f')]=function(_0x3c6318,_0x329c24,_0x39c1b7){var _0x139fee={};var _0xc87696={};var _0x220c73;var _0x3460ee;return db['ChatWebsite'][_0x5f7d('0x6c')]({'where':{'id':_0x3c6318[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x329c24,null))[_0x5f7d('0x39')](function(_0xde4315){if(_0xde4315){_0x220c73=_0xde4315;_0xc87696[_0x5f7d('0x46')]=_['keys'](db[_0x5f7d('0x10c')]['rawAttributes']);_0xc87696[_0x5f7d('0x47')]=_[_0x5f7d('0x48')](_0x3c6318[_0x5f7d('0x47')]);_0xc87696[_0x5f7d('0x49')]=_[_0x5f7d('0x4a')](_0xc87696[_0x5f7d('0x46')],_0xc87696['query']);_0x139fee['attributes']=_[_0x5f7d('0x4a')](_0xc87696[_0x5f7d('0x46')],qs['fields'](_0x3c6318[_0x5f7d('0x47')][_0x5f7d('0x4c')]));_0x139fee[_0x5f7d('0x4b')]=_0x139fee['attributes'][_0x5f7d('0x4d')]?_0x139fee[_0x5f7d('0x4b')]:_0xc87696['model'];_0x139fee[_0x5f7d('0x4f')]=qs[_0x5f7d('0x50')](_0x3c6318[_0x5f7d('0x47')][_0x5f7d('0x50')]);_0x139fee[_0x5f7d('0x51')]=qs[_0x5f7d('0x49')](_[_0x5f7d('0x52')](_0x3c6318[_0x5f7d('0x47')],_0xc87696['filters']));if(_0x3c6318['query'][_0x5f7d('0x56')]){_0x139fee[_0x5f7d('0x51')]=_['merge'](_0x139fee[_0x5f7d('0x51')],{'$or':_[_0x5f7d('0x54')](_0x139fee[_0x5f7d('0x4b')],function(_0x1c6ab5){var _0x3ae7ee={};_0x3ae7ee[_0x1c6ab5]={'$like':'%'+_0x3c6318[_0x5f7d('0x47')][_0x5f7d('0x56')]+'%'};return _0x3ae7ee;})});}_0x139fee=_[_0x5f7d('0x53')]({},_0x139fee,_0x3c6318[_0x5f7d('0x57')]);return _0x220c73[_0x5f7d('0x10f')](_0x139fee);}})['then'](function(_0x9688c0){if(_0x9688c0){_0x3460ee=_0x9688c0[_0x5f7d('0x4d')];if(!_0x3c6318[_0x5f7d('0x47')]['hasOwnProperty'](_0x5f7d('0x6d'))){_0x139fee[_0x5f7d('0x34')]=qs['limit'](_0x3c6318[_0x5f7d('0x47')][_0x5f7d('0x34')]);_0x139fee[_0x5f7d('0x33')]=qs[_0x5f7d('0x33')](_0x3c6318[_0x5f7d('0x47')]['offset']);}return _0x220c73[_0x5f7d('0x10f')](_0x139fee);}})[_0x5f7d('0x39')](function(_0x56bf9b){if(_0x56bf9b){return _0x56bf9b?{'count':_0x3460ee,'rows':_0x56bf9b}:null;}})['then'](respondWithResult(_0x329c24,null))[_0x5f7d('0x2e')](handleError(_0x329c24,null));};exports['addProactiveActions']=function(_0x47209a,_0x53e1a2,_0x49610b){return db['chatProactiveAction'][_0x5f7d('0x5e')]({'where':{'id':_0x47209a[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x53e1a2,null))[_0x5f7d('0x39')](function(_0x55a21d){if(_0x55a21d){return _0x55a21d[_0x5f7d('0x110')](_0x47209a[_0x5f7d('0x60')]['ids'],_[_0x5f7d('0xeb')](_0x47209a['body'],[_0x5f7d('0x70'),'id'])||{});}})[_0x5f7d('0x39')](respondWithResult(_0x53e1a2,null))['catch'](handleError(_0x53e1a2,null));};exports[_0x5f7d('0x101')]=function(_0x55a7f2,_0x17bf6b,_0x5cda1e){var _0x369f35={};var _0x56c265={};var _0x486c4b;var _0x273c55;return db[_0x5f7d('0x58')][_0x5f7d('0x6c')]({'where':{'id':_0x55a7f2['params']['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x17bf6b,null))[_0x5f7d('0x39')](function(_0x1ab39e){if(_0x1ab39e){_0x486c4b=_0x1ab39e;_0x56c265[_0x5f7d('0x46')]=_['keys'](db[_0x5f7d('0x111')]['rawAttributes']);_0x56c265['query']=_[_0x5f7d('0x48')](_0x55a7f2['query']);_0x56c265[_0x5f7d('0x49')]=_[_0x5f7d('0x4a')](_0x56c265[_0x5f7d('0x46')],_0x56c265['query']);_0x369f35[_0x5f7d('0x4b')]=_[_0x5f7d('0x4a')](_0x56c265[_0x5f7d('0x46')],qs[_0x5f7d('0x4c')](_0x55a7f2[_0x5f7d('0x47')][_0x5f7d('0x4c')]));_0x369f35['attributes']=_0x369f35[_0x5f7d('0x4b')][_0x5f7d('0x4d')]?_0x369f35[_0x5f7d('0x4b')]:_0x56c265[_0x5f7d('0x46')];_0x369f35[_0x5f7d('0x4f')]=qs[_0x5f7d('0x50')](_0x55a7f2[_0x5f7d('0x47')][_0x5f7d('0x50')]);_0x369f35[_0x5f7d('0x51')]=qs['filters'](_['pick'](_0x55a7f2['query'],_0x56c265[_0x5f7d('0x49')]));if(_0x55a7f2['query'][_0x5f7d('0x56')]){_0x369f35[_0x5f7d('0x51')]=_['merge'](_0x369f35[_0x5f7d('0x51')],{'$or':_['map'](_0x369f35[_0x5f7d('0x4b')],function(_0x400101){var _0xd45e48={};_0xd45e48[_0x400101]={'$like':'%'+_0x55a7f2['query'][_0x5f7d('0x56')]+'%'};return _0xd45e48;})});}_0x369f35=_[_0x5f7d('0x53')]({},_0x369f35,_0x55a7f2[_0x5f7d('0x57')]);return _0x486c4b[_0x5f7d('0x101')](_0x369f35);}})[_0x5f7d('0x39')](function(_0x59515f){if(_0x59515f){_0x273c55=_0x59515f[_0x5f7d('0x4d')];if(!_0x55a7f2[_0x5f7d('0x47')]['hasOwnProperty']('nolimit')){_0x369f35[_0x5f7d('0x34')]=qs[_0x5f7d('0x34')](_0x55a7f2[_0x5f7d('0x47')][_0x5f7d('0x34')]);_0x369f35[_0x5f7d('0x33')]=qs['offset'](_0x55a7f2['query'][_0x5f7d('0x33')]);}return _0x486c4b['getProactiveActions'](_0x369f35);}})[_0x5f7d('0x39')](function(_0x474925){if(_0x474925){return _0x474925?{'count':_0x273c55,'rows':_0x474925}:null;}})[_0x5f7d('0x39')](respondWithResult(_0x17bf6b,null))['catch'](handleError(_0x17bf6b,null));};exports[_0x5f7d('0x112')]=function(_0x3daee2,_0xca51c3,_0x4d822f){var _0x29ae62=_0x3daee2[_0x5f7d('0x47')]['online']===_0x5f7d('0x113')?_0x5f7d('0x114'):_0x5f7d('0x115');return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'attributes':['id',_0x29ae62],'where':{'id':_0x3daee2[_0x5f7d('0x5c')]['id']}})['then'](handleEntityNotFound(_0xca51c3,null))[_0x5f7d('0x39')](function(_0x1bddba){if(_0x1bddba){var _0x260f27=_0x1bddba[_0x29ae62];var _0x4df756=_0x260f27&&_0x260f27[_0x5f7d('0x116')]?_0x260f27[_0x5f7d('0x116')]:[];_0xca51c3[_0x5f7d('0x3f')]({'fromKey':_['isNil'](_0x260f27[_0x5f7d('0x117')])?undefined:_0x260f27[_0x5f7d('0x117')],'count':_0x4df756[_0x5f7d('0x4d')],'rows':_0x4df756});}})[_0x5f7d('0x2e')](handleError(_0xca51c3,null));};exports['getOfflineMessages']=function(_0x5ac5a0,_0x4d0dc7,_0x3aa1b3){var _0x199eff={'raw':![],'where':{}};var _0xcebcf0={};var _0x262da6={'count':0x0,'rows':[]};return db[_0x5f7d('0x58')][_0x5f7d('0x6c')]({'where':{'id':_0x5ac5a0[_0x5f7d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4d0dc7,null))[_0x5f7d('0x39')](function(_0x13c4c0){if(_0x13c4c0){_0xcebcf0['model']=_[_0x5f7d('0x48')](db[_0x5f7d('0x118')][_0x5f7d('0x42')]);_0xcebcf0[_0x5f7d('0x47')]=_['keys'](_0x5ac5a0['query']);_0xcebcf0['filters']=_['intersection'](_0xcebcf0[_0x5f7d('0x46')],_0xcebcf0[_0x5f7d('0x47')]);_0x199eff[_0x5f7d('0x4b')]=_['intersection'](_0xcebcf0[_0x5f7d('0x46')],qs[_0x5f7d('0x4c')](_0x5ac5a0[_0x5f7d('0x47')][_0x5f7d('0x4c')]));_0x199eff[_0x5f7d('0x4b')]=_0x199eff[_0x5f7d('0x4b')][_0x5f7d('0x4d')]?_0x199eff[_0x5f7d('0x4b')]:_0xcebcf0[_0x5f7d('0x46')];if(!_0x5ac5a0[_0x5f7d('0x47')]['hasOwnProperty'](_0x5f7d('0x6d'))){_0x199eff[_0x5f7d('0x34')]=qs[_0x5f7d('0x34')](_0x5ac5a0['query'][_0x5f7d('0x34')]);_0x199eff[_0x5f7d('0x33')]=qs[_0x5f7d('0x33')](_0x5ac5a0[_0x5f7d('0x47')][_0x5f7d('0x33')]);}_0x199eff[_0x5f7d('0x4f')]=qs[_0x5f7d('0x50')](_0x5ac5a0[_0x5f7d('0x47')]['sort']);_0x199eff[_0x5f7d('0x51')]=qs[_0x5f7d('0x49')](_[_0x5f7d('0x52')](_0x5ac5a0[_0x5f7d('0x47')],_0xcebcf0[_0x5f7d('0x49')]));_0x199eff[_0x5f7d('0x51')][_0x5f7d('0x6e')]=_0x13c4c0['id'];if(_0x5ac5a0[_0x5f7d('0x47')][_0x5f7d('0x56')]){_0x199eff[_0x5f7d('0x51')]=_[_0x5f7d('0x53')](_0x199eff[_0x5f7d('0x51')],{'$or':_['map'](_0x199eff[_0x5f7d('0x4b')],function(_0x18fd42){var _0x30e77c={};_0x30e77c[_0x18fd42]={'$like':'%'+_0x5ac5a0[_0x5f7d('0x47')][_0x5f7d('0x56')]+'%'};return _0x30e77c;})});}_0x199eff=_['merge']({},_0x199eff,_0x5ac5a0[_0x5f7d('0x57')]);return db[_0x5f7d('0x118')][_0x5f7d('0x32')]({'where':_0x199eff[_0x5f7d('0x51')]})['then'](function(_0x1c0695){_0x262da6[_0x5f7d('0x32')]=_0x1c0695;if(_0x5ac5a0['query'][_0x5f7d('0x59')]){_0x199eff[_0x5f7d('0x5a')]=[{'all':!![]}];}else{_0x199eff[_0x5f7d('0x5a')]=[{'model':db[_0x5f7d('0x99')],'as':_0x5f7d('0xec'),'required':![]}];}return db[_0x5f7d('0x118')][_0x5f7d('0x74')](_0x199eff);})[_0x5f7d('0x39')](function(_0x39e143){_0x262da6[_0x5f7d('0x75')]=_0x39e143;return _0x262da6;});}})[_0x5f7d('0x39')](respondWithFilteredResult(_0x4d0dc7,_0x199eff))[_0x5f7d('0x2e')](handleError(_0x4d0dc7,null));};exports[_0x5f7d('0x119')]=function(_0x26c118,_0x582871,_0x1e59c5){return db[_0x5f7d('0x58')][_0x5f7d('0x5e')]({'where':{'id':_0x26c118[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x582871,null))[_0x5f7d('0x39')](function(_0x529899){if(_0x529899){return _0x529899[_0x5f7d('0x119')](_0x26c118['body'][_0x5f7d('0x70')],_[_0x5f7d('0xeb')](_0x26c118[_0x5f7d('0x60')],[_0x5f7d('0x70'),'id'])||{})[_0x5f7d('0x11a')](function(_0x57fe1c){for(var _0x4d9088=0x0;_0x4d9088<_0x26c118[_0x5f7d('0x60')]['ids'][_0x5f7d('0x4d')];_0x4d9088+=0x1){socket[_0x5f7d('0x11b')](_0x5f7d('0x11c'),{'UserId':_0x26c118['body'][_0x5f7d('0x70')][_0x4d9088],'ChatWebsiteId':_0x26c118[_0x5f7d('0x5c')]['id']});}return _0x57fe1c;});}})[_0x5f7d('0x39')](respondWithResult(_0x582871,null))[_0x5f7d('0x2e')](handleError(_0x582871,null));};exports[_0x5f7d('0x11d')]=function(_0x5432fe,_0x586924,_0x2ed3e0){return db[_0x5f7d('0x58')]['find']({'where':{'id':_0x5432fe[_0x5f7d('0x5c')]['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x586924,null))[_0x5f7d('0x39')](function(_0x2f1eda){if(_0x2f1eda){return _0x2f1eda[_0x5f7d('0x11d')](_0x5432fe['query'][_0x5f7d('0x70')])['then'](function(){if(_[_0x5f7d('0x11e')](_0x5432fe[_0x5f7d('0x47')]['ids'])){for(var _0x14138d=0x0;_0x14138d<_0x5432fe[_0x5f7d('0x47')]['ids'][_0x5f7d('0x4d')];_0x14138d+=0x1){socket['emit'](_0x5f7d('0x11f'),{'UserId':Number(_0x5432fe['query'][_0x5f7d('0x70')][_0x14138d]),'ChatWebsiteId':Number(_0x5432fe[_0x5f7d('0x5c')]['id'])});}}else{socket[_0x5f7d('0x11b')](_0x5f7d('0x11f'),{'UserId':Number(_0x5432fe[_0x5f7d('0x47')]['ids']),'ChatWebsiteId':Number(_0x5432fe['params']['id'])});}});}})[_0x5f7d('0x39')](respondWithStatusCode(_0x586924,null))['catch'](handleError(_0x586924,null));};exports[_0x5f7d('0x120')]=function(_0x3f51f2,_0x549c01,_0x386482){var _0x2f00fc={};var _0x38af61={};var _0x367901;var _0x12486b;return db[_0x5f7d('0x58')]['findOne']({'where':{'id':_0x3f51f2['params']['id']}})[_0x5f7d('0x39')](handleEntityNotFound(_0x549c01,null))[_0x5f7d('0x39')](function(_0x1994bc){if(_0x1994bc){_0x367901=_0x1994bc;_0x38af61[_0x5f7d('0x46')]=_['keys'](db['User']['rawAttributes']);_0x38af61[_0x5f7d('0x47')]=_['keys'](_0x3f51f2[_0x5f7d('0x47')]);_0x38af61[_0x5f7d('0x49')]=_['intersection'](_0x38af61[_0x5f7d('0x46')],_0x38af61[_0x5f7d('0x47')]);_0x2f00fc[_0x5f7d('0x4b')]=_[_0x5f7d('0x4a')](_0x38af61[_0x5f7d('0x46')],qs[_0x5f7d('0x4c')](_0x3f51f2[_0x5f7d('0x47')]['fields']));_0x2f00fc[_0x5f7d('0x4b')]=_0x2f00fc['attributes']['length']?_0x2f00fc['attributes']:_0x38af61['model'];_0x2f00fc[_0x5f7d('0x4f')]=qs[_0x5f7d('0x50')](_0x3f51f2[_0x5f7d('0x47')]['sort']);_0x2f00fc[_0x5f7d('0x51')]=qs[_0x5f7d('0x49')](_[_0x5f7d('0x52')](_0x3f51f2['query'],_0x38af61['filters']));if(_0x3f51f2['query'][_0x5f7d('0x56')]){_0x2f00fc[_0x5f7d('0x51')]=_[_0x5f7d('0x53')](_0x2f00fc[_0x5f7d('0x51')],{'$or':_[_0x5f7d('0x54')](_0x2f00fc[_0x5f7d('0x4b')],function(_0x4e1ee3){var _0x40d6ff={};_0x40d6ff[_0x4e1ee3]={'$like':'%'+_0x3f51f2['query'][_0x5f7d('0x56')]+'%'};return _0x40d6ff;})});}_0x2f00fc=_[_0x5f7d('0x53')]({},_0x2f00fc,_0x3f51f2[_0x5f7d('0x57')]);return _0x367901[_0x5f7d('0x120')](_0x2f00fc);}})[_0x5f7d('0x39')](function(_0x494ca8){if(_0x494ca8){_0x12486b=_0x494ca8['length'];if(!_0x3f51f2[_0x5f7d('0x47')][_0x5f7d('0x4e')]('nolimit')){_0x2f00fc['limit']=qs[_0x5f7d('0x34')](_0x3f51f2[_0x5f7d('0x47')]['limit']);_0x2f00fc['offset']=qs[_0x5f7d('0x33')](_0x3f51f2[_0x5f7d('0x47')][_0x5f7d('0x33')]);}return _0x367901[_0x5f7d('0x120')](_0x2f00fc);}})[_0x5f7d('0x39')](function(_0x584e8b){if(_0x584e8b){return _0x584e8b?{'count':_0x12486b,'rows':_0x584e8b}:null;}})['then'](respondWithResult(_0x549c01,null))[_0x5f7d('0x2e')](handleError(_0x549c01,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 0852a0b..5f259a7 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 _0x86dd=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x25cf10,_0x59ae67){var _0xe1f1d9=function(_0x4a9274){while(--_0x4a9274){_0x25cf10['push'](_0x25cf10['shift']());}};_0xe1f1d9(++_0x59ae67);}(_0x86dd,0x1ee));var _0xd86d=function(_0x486406,_0x2d3158){_0x486406=_0x486406-0x0;var _0x365d5e=_0x86dd[_0x486406];return _0x365d5e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xd86d('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd86d('0x1')](0x0);var events={'afterCreate':_0xd86d('0x2'),'afterUpdate':_0xd86d('0x3'),'afterDestroy':_0xd86d('0x4')};function emitEvent(_0x17237d){return function(_0x30a31c,_0x2e82a9,_0x240531){ChatWebsiteEvents[_0xd86d('0x5')](_0x17237d+':'+_0x30a31c['id'],_0x30a31c);ChatWebsiteEvents[_0xd86d('0x5')](_0x17237d,_0x30a31c);_0x240531(null);};}for(var e in events){if(events[_0xd86d('0x6')](e)){var event=events[e];ChatWebsite[_0xd86d('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xc0c2=['setMaxListeners','save','remove','emit','hasOwnProperty','../../mysqldb','ChatWebsite'];(function(_0xcbbd03,_0x67588f){var _0x1ae6f0=function(_0x5d55c7){while(--_0x5d55c7){_0xcbbd03['push'](_0xcbbd03['shift']());}};_0x1ae6f0(++_0x67588f);}(_0xc0c2,0x1b7));var _0x2c0c=function(_0x3ddb4e,_0x5d9ecf){_0x3ddb4e=_0x3ddb4e-0x0;var _0x16202e=_0xc0c2[_0x3ddb4e];return _0x16202e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x2c0c('0x0'))['db'][_0x2c0c('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2c0c('0x2')](0x0);var events={'afterCreate':_0x2c0c('0x3'),'afterUpdate':'update','afterDestroy':_0x2c0c('0x4')};function emitEvent(_0x33e994){return function(_0x362d03,_0x276285,_0x34d550){ChatWebsiteEvents[_0x2c0c('0x5')](_0x33e994+':'+_0x362d03['id'],_0x362d03);ChatWebsiteEvents[_0x2c0c('0x5')](_0x33e994,_0x362d03);_0x34d550(null);};}for(var e in events){if(events[_0x2c0c('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e283590..a082155 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','api','bluebird'];(function(_0xaa790c,_0x1e6c76){var _0x36555e=function(_0xb0dfbe){while(--_0xb0dfbe){_0xaa790c['push'](_0xaa790c['shift']());}};_0x36555e(++_0x1e6c76);}(_0x9bde,0xe1));var _0xe9bd=function(_0x47aebf,_0x507238){_0x47aebf=_0x47aebf-0x0;var _0x3df5e2=_0x9bde[_0x47aebf];return _0x3df5e2;};'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':!![]});}; \ No newline at end of file +var _0x2f72=['request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x181112,_0x266057){var _0x259948=function(_0x4e82c3){while(--_0x4e82c3){_0x181112['push'](_0x181112['shift']());}};_0x259948(++_0x266057);}(_0x2f72,0x166));var _0x22f7=function(_0x525904,_0x5b7a9c){_0x525904=_0x525904-0x0;var _0xb7b736=_0x2f72[_0x525904];return _0xb7b736;};'use strict';var _=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var logger=require(_0x22f7('0x2'))(_0x22f7('0x3'));var moment=require(_0x22f7('0x4'));var BPromise=require(_0x22f7('0x5'));var rp=require(_0x22f7('0x6'));var fs=require('fs');var path=require(_0x22f7('0x7'));var rimraf=require('rimraf');var config=require(_0x22f7('0x8'));var attributes=require(_0x22f7('0x9'));module[_0x22f7('0xa')]=function(_0x216f96,_0xd85654){return _0x216f96[_0x22f7('0xb')](_0x22f7('0xc'),attributes,{'tableName':_0x22f7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 1c09ca1..7a34db7 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 _0xdb28=['then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request'];(function(_0x3828cb,_0x392c98){var _0x351acf=function(_0x2718da){while(--_0x2718da){_0x3828cb['push'](_0x3828cb['shift']());}};_0x351acf(++_0x392c98);}(_0xdb28,0x106));var _0x8db2=function(_0x4e2267,_0x5e81eb){_0x4e2267=_0x4e2267-0x0;var _0x11c4e2=_0xdb28[_0x4e2267];return _0x11c4e2;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});} \ No newline at end of file +var _0x6d38=['catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x1156e9,_0x2977c8){var _0x4f428d=function(_0x16e588){while(--_0x16e588){_0x1156e9['push'](_0x1156e9['shift']());}};_0x4f428d(++_0x2977c8);}(_0x6d38,0x1ef));var _0x86d3=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6d38[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});config[_0x86d3('0x9')]=_[_0x86d3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x86d3('0xb'))(new Redis(config[_0x86d3('0x9')]));require(_0x86d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a277e,_0x3ed317,_0x555e6d){return new BPromise(function(_0x49b436,_0x5606eb){return client[_0x86d3('0xd')](_0x4a277e,_0x555e6d)[_0x86d3('0xe')](function(_0x4f216c){logger[_0x86d3('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x3ed317,_0x86d3('0x10'));logger[_0x86d3('0x11')](_0x86d3('0x12'),_0x3ed317,_0x86d3('0x10'),JSON[_0x86d3('0x13')](_0x4f216c));if(_0x4f216c[_0x86d3('0x14')]){if(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x15')]===0x1f4){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);return _0x5606eb(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}logger[_0x86d3('0x14')](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')]['message']);return _0x49b436(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}else{logger[_0x86d3('0xf')](_0x86d3('0x16'),_0x3ed317,_0x86d3('0x10'));_0x49b436(_0x4f216c[_0x86d3('0x18')][_0x86d3('0x17')]);}})[_0x86d3('0x19')](function(_0x9b76f2){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x9b76f2);_0x5606eb(_0x9b76f2);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f121aaa..6ab73bb 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(_0x60878f,_0x1166d3){var _0x1fbefb=function(_0x375d8c){while(--_0x375d8c){_0x60878f['push'](_0x60878f['shift']());}};_0x1fbefb(++_0x1166d3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ded05,_0x4e71a5){_0x4ded05=_0x4ded05-0x0;var _0x52810d=_0x5f2f[_0x4ded05];return _0x52810d;};'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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x253141,_0x396c1e){var _0x4472f3=function(_0x28b591){while(--_0x28b591){_0x253141['push'](_0x253141['shift']());}};_0x4472f3(++_0x396c1e);}(_0x5f2f,0x73));var _0xf5f2=function(_0xdc1176,_0x55c094){_0xdc1176=_0xdc1176-0x0;var _0x4d7c39=_0x5f2f[_0xdc1176];return _0x4d7c39;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7703d18..7a72444 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 _0xc713=['addLogo','server/files/images/avatars/','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/offline','offline','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','getFields','/:id/offline_messages','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0xc713,0x19a));var _0x3c71=function(_0x3e5ec3,_0x76e378){_0x3e5ec3=_0x3e5ec3-0x0;var _0x425633=_0xc713[_0x3e5ec3];return _0x425633;};'use strict';var multer=require('multer');var util=require(_0x3c71('0x0'));var path=require(_0x3c71('0x1'));var timeout=require(_0x3c71('0x2'));var express=require(_0x3c71('0x3'));var router=express[_0x3c71('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3c71('0x5'));var config=require(_0x3c71('0x6'));var controller=require('./chatWebsite.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3c71('0x7')]);router[_0x3c71('0x8')](_0x3c71('0x9'),auth[_0x3c71('0xa')](),controller[_0x3c71('0xb')]);router[_0x3c71('0x8')]('/:id',auth[_0x3c71('0xa')](),controller[_0x3c71('0xc')]);router[_0x3c71('0x8')](_0x3c71('0xd'),auth['isAuthenticated'](),controller[_0x3c71('0xe')]);router[_0x3c71('0x8')]('/:id/canned_answers',auth[_0x3c71('0xa')](),controller[_0x3c71('0xf')]);router['get'](_0x3c71('0x10'),controller[_0x3c71('0x11')]);router[_0x3c71('0x8')](_0x3c71('0x12'),controller[_0x3c71('0x13')]);router['get'](_0x3c71('0x14'),controller['getCustomerAvatar']);router[_0x3c71('0x8')](_0x3c71('0x15'),controller['getSystemAvatar']);router[_0x3c71('0x8')](_0x3c71('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x3c71('0x8')](_0x3c71('0x17'),controller[_0x3c71('0x18')]);router[_0x3c71('0x8')](_0x3c71('0x19'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x1a')]);router[_0x3c71('0x8')]('/:id/proactive_actions',auth[_0x3c71('0xa')](),controller['getProactiveActions']);router[_0x3c71('0x8')]('/:id/fields',controller[_0x3c71('0x1b')]);router[_0x3c71('0x8')](_0x3c71('0x1c'),auth[_0x3c71('0xa')](),controller['getOfflineMessages']);router[_0x3c71('0x8')](_0x3c71('0x1d'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x1e')]);router['post']('/',auth[_0x3c71('0xa')](),controller[_0x3c71('0x1f')]);router[_0x3c71('0x20')](_0x3c71('0xd'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x21')]);router[_0x3c71('0x20')](_0x3c71('0x22'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x23')]);var upload=multer({'storage':multer[_0x3c71('0x24')]({'destination':function(_0x4fb50b,_0x51eb07,_0x4036bc){_0x4036bc(null,path[_0x3c71('0x25')](config[_0x3c71('0x26')],_0x3c71('0x27')));},'filename':function(_0x2fe8a4,_0x32b480,_0x3df529){_0x3df529(null,util[_0x3c71('0x28')](_0x3c71('0x29'),Date[_0x3c71('0x2a')](),_0x32b480['originalname']));}})});router[_0x3c71('0x20')](_0x3c71('0x10'),upload[_0x3c71('0x2b')](_0x3c71('0x2c')),controller[_0x3c71('0x2d')]);var upload=multer({'storage':multer[_0x3c71('0x24')]({'destination':function(_0xdc756a,_0x1dbd33,_0x5bb63f){_0x5bb63f(null,path['join'](config['root'],_0x3c71('0x2e')));},'filename':function(_0x146ee2,_0x42159b,_0x40e19e){_0x40e19e(null,util[_0x3c71('0x28')]('%s-%s',Date[_0x3c71('0x2a')](),_0x42159b[_0x3c71('0x2f')]));}})});router[_0x3c71('0x20')]('/:id/avatar',upload[_0x3c71('0x2b')]('file'),controller[_0x3c71('0x30')]);var upload=multer({'storage':multer[_0x3c71('0x24')]({'destination':function(_0x2657c1,_0x3b17ae,_0x3fb530){_0x3fb530(null,path[_0x3c71('0x25')](config[_0x3c71('0x26')],_0x3c71('0x2e')));},'filename':function(_0x37f0e2,_0xa2b33c,_0x527666){_0x527666(null,util['format'](_0x3c71('0x29'),Date[_0x3c71('0x2a')](),_0xa2b33c[_0x3c71('0x2f')]));}})});router['post'](_0x3c71('0x14'),upload[_0x3c71('0x2b')](_0x3c71('0x2c')),controller[_0x3c71('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19d1d4,_0xfb6a4b,_0x142eab){_0x142eab(null,path['join'](config[_0x3c71('0x26')],_0x3c71('0x2e')));},'filename':function(_0x20fad7,_0x345890,_0xab18f){_0xab18f(null,util[_0x3c71('0x28')](_0x3c71('0x29'),Date[_0x3c71('0x2a')](),_0x345890[_0x3c71('0x2f')]));}})});router[_0x3c71('0x20')]('/:id/system_avatar',upload[_0x3c71('0x2b')](_0x3c71('0x2c')),controller[_0x3c71('0x32')]);router[_0x3c71('0x20')]('/:id/notify',controller['notify']);router[_0x3c71('0x20')](_0x3c71('0x33'),controller[_0x3c71('0x34')]);router[_0x3c71('0x20')]('/:id/interactions',auth[_0x3c71('0xa')](),controller[_0x3c71('0x35')]);router[_0x3c71('0x20')](_0x3c71('0x19'),auth[_0x3c71('0xa')](),controller['addApplications']);router[_0x3c71('0x20')](_0x3c71('0x36'),auth['isAuthenticated'](),controller[_0x3c71('0x37')]);router[_0x3c71('0x20')](_0x3c71('0x1d'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x38')]);router[_0x3c71('0x39')](_0x3c71('0x3a'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x3b')]);router[_0x3c71('0x3c')]('/:id',auth[_0x3c71('0xa')](),controller['destroy']);router[_0x3c71('0x3c')]('/:id/dispositions',auth[_0x3c71('0xa')](),controller[_0x3c71('0x3d')]);router[_0x3c71('0x3c')](_0x3c71('0x22'),auth['isAuthenticated'](),controller[_0x3c71('0x3e')]);router[_0x3c71('0x3c')](_0x3c71('0x1d'),auth[_0x3c71('0xa')](),controller[_0x3c71('0x3f')]);module[_0x3c71('0x40')]=router; \ No newline at end of file +var _0x14ec=['addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/fields','getFields','/:id/offline_messages','post','/:id/canned_answers','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x14ec,0x193));var _0xc14e=function(_0x2dbf61,_0x368497){_0x2dbf61=_0x2dbf61-0x0;var _0x5cbf49=_0x14ec[_0x2dbf61];return _0x5cbf49;};'use strict';var multer=require(_0xc14e('0x0'));var util=require(_0xc14e('0x1'));var path=require(_0xc14e('0x2'));var timeout=require(_0xc14e('0x3'));var express=require(_0xc14e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc14e('0x5'));var config=require(_0xc14e('0x6'));var controller=require(_0xc14e('0x7'));router[_0xc14e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc14e('0x9')]);router['get'](_0xc14e('0xa'),auth[_0xc14e('0xb')](),controller[_0xc14e('0xc')]);router[_0xc14e('0x8')]('/:id',auth[_0xc14e('0xb')](),controller[_0xc14e('0xd')]);router[_0xc14e('0x8')](_0xc14e('0xe'),auth['isAuthenticated'](),controller[_0xc14e('0xf')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xc14e('0x8')](_0xc14e('0x10'),controller['getLogo']);router[_0xc14e('0x8')](_0xc14e('0x11'),controller[_0xc14e('0x12')]);router[_0xc14e('0x8')](_0xc14e('0x13'),controller['getCustomerAvatar']);router['get'](_0xc14e('0x14'),controller[_0xc14e('0x15')]);router[_0xc14e('0x8')](_0xc14e('0x16'),auth[_0xc14e('0xb')](),controller[_0xc14e('0x17')]);router[_0xc14e('0x8')](_0xc14e('0x18'),controller[_0xc14e('0x19')]);router[_0xc14e('0x8')](_0xc14e('0x1a'),auth[_0xc14e('0xb')](),controller[_0xc14e('0x1b')]);router[_0xc14e('0x8')]('/:id/proactive_actions',auth[_0xc14e('0xb')](),controller['getProactiveActions']);router[_0xc14e('0x8')](_0xc14e('0x1c'),controller[_0xc14e('0x1d')]);router['get'](_0xc14e('0x1e'),auth['isAuthenticated'](),controller['getOfflineMessages']);router['get']('/:id/users',auth[_0xc14e('0xb')](),controller['getAgents']);router[_0xc14e('0x1f')]('/',auth[_0xc14e('0xb')](),controller['create']);router[_0xc14e('0x1f')]('/:id/dispositions',auth[_0xc14e('0xb')](),controller['addDisposition']);router[_0xc14e('0x1f')](_0xc14e('0x20'),auth[_0xc14e('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xc14e('0x21')]({'destination':function(_0x18b6d2,_0x52507f,_0x451057){_0x451057(null,path[_0xc14e('0x22')](config[_0xc14e('0x23')],'server/files/images/logos/'));},'filename':function(_0x274a87,_0x4ead7d,_0x650a48){_0x650a48(null,util[_0xc14e('0x24')](_0xc14e('0x25'),Date[_0xc14e('0x26')](),_0x4ead7d[_0xc14e('0x27')]));}})});router['post'](_0xc14e('0x10'),upload[_0xc14e('0x28')](_0xc14e('0x29')),controller[_0xc14e('0x2a')]);var upload=multer({'storage':multer[_0xc14e('0x21')]({'destination':function(_0x356556,_0x47430d,_0x305538){_0x305538(null,path[_0xc14e('0x22')](config['root'],_0xc14e('0x2b')));},'filename':function(_0x15598b,_0x365276,_0xec251a){_0xec251a(null,util['format']('%s-%s',Date[_0xc14e('0x26')](),_0x365276[_0xc14e('0x27')]));}})});router['post'](_0xc14e('0x11'),upload[_0xc14e('0x28')](_0xc14e('0x29')),controller[_0xc14e('0x2c')]);var upload=multer({'storage':multer[_0xc14e('0x21')]({'destination':function(_0x40775a,_0x593f09,_0x88155b){_0x88155b(null,path[_0xc14e('0x22')](config['root'],_0xc14e('0x2b')));},'filename':function(_0x5c30f2,_0x32d5f6,_0x4c9af0){_0x4c9af0(null,util['format'](_0xc14e('0x25'),Date[_0xc14e('0x26')](),_0x32d5f6[_0xc14e('0x27')]));}})});router[_0xc14e('0x1f')](_0xc14e('0x13'),upload[_0xc14e('0x28')](_0xc14e('0x29')),controller[_0xc14e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x229bab,_0x3c041a,_0x5b453d){_0x5b453d(null,path[_0xc14e('0x22')](config['root'],_0xc14e('0x2b')));},'filename':function(_0x1768c8,_0x53697d,_0x559ee2){_0x559ee2(null,util[_0xc14e('0x24')](_0xc14e('0x25'),Date[_0xc14e('0x26')](),_0x53697d[_0xc14e('0x27')]));}})});router[_0xc14e('0x1f')](_0xc14e('0x14'),upload['single'](_0xc14e('0x29')),controller[_0xc14e('0x2e')]);router[_0xc14e('0x1f')](_0xc14e('0x2f'),controller[_0xc14e('0x30')]);router[_0xc14e('0x1f')]('/:id/offline',controller[_0xc14e('0x31')]);router[_0xc14e('0x1f')](_0xc14e('0x16'),auth['isAuthenticated'](),controller[_0xc14e('0x32')]);router[_0xc14e('0x1f')](_0xc14e('0x1a'),auth['isAuthenticated'](),controller[_0xc14e('0x33')]);router[_0xc14e('0x1f')](_0xc14e('0x34'),auth['isAuthenticated'](),controller[_0xc14e('0x35')]);router[_0xc14e('0x1f')](_0xc14e('0x36'),auth[_0xc14e('0xb')](),controller[_0xc14e('0x37')]);router[_0xc14e('0x38')](_0xc14e('0x39'),auth[_0xc14e('0xb')](),controller[_0xc14e('0x3a')]);router[_0xc14e('0x3b')](_0xc14e('0x39'),auth[_0xc14e('0xb')](),controller[_0xc14e('0x3c')]);router[_0xc14e('0x3b')](_0xc14e('0xe'),auth[_0xc14e('0xb')](),controller['removeDispositions']);router[_0xc14e('0x3b')](_0xc14e('0x20'),auth['isAuthenticated'](),controller[_0xc14e('0x3d')]);router[_0xc14e('0x3b')](_0xc14e('0x36'),auth['isAuthenticated'](),controller[_0xc14e('0x3e')]);module[_0xc14e('0x3f')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 783a487..55b7a1a 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 _0xc7b3=['ENUM','AmazonAWS','Google','STRING','sequelize','exports'];(function(_0x18bb69,_0x11e204){var _0x14a63b=function(_0x47160e){while(--_0x47160e){_0x18bb69['push'](_0x18bb69['shift']());}};_0x14a63b(++_0x11e204);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc7b3[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x3c7b('0x0'));module[_0x3c7b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3c7b('0x2')](_0x3c7b('0x3'),_0x3c7b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3c7b('0x5')]},'data2':{'type':Sequelize[_0x3c7b('0x5')]}}; \ No newline at end of file +var _0x644f=['exports','AmazonAWS','Google','STRING','sequelize'];(function(_0x4a5f80,_0x2c17db){var _0x11501c=function(_0x25f997){while(--_0x25f997){_0x4a5f80['push'](_0x4a5f80['shift']());}};_0x11501c(++_0x2c17db);}(_0x644f,0xc2));var _0xf644=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x644f[_0x5b7788];return _0x573871;};'use strict';var Sequelize=require(_0xf644('0x0'));module[_0xf644('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xf644('0x2'),_0xf644('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xf644('0x4')]},'data2':{'type':Sequelize[_0xf644('0x4')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 6495e89..1c719c3 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 _0x9fa8=['includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','reject','save','update','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','key','map','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x4577f9,_0x1be596){var _0x42dea7=function(_0x1856a){while(--_0x1856a){_0x4577f9['push'](_0x4577f9['shift']());}};_0x42dea7(++_0x1be596);}(_0x9fa8,0x12e));var _0x89fa=function(_0x4a3483,_0x43752f){_0x4a3483=_0x4a3483-0x0;var _0x4eba78=_0x9fa8[_0x4a3483];return _0x4eba78;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89fa('0x0'));var rimraf=require(_0x89fa('0x1'));var zipdir=require(_0x89fa('0x2'));var jsonpatch=require(_0x89fa('0x3'));var rp=require(_0x89fa('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89fa('0x5'));var path=require(_0x89fa('0x6'));var sox=require(_0x89fa('0x7'));var csv=require(_0x89fa('0x8'));var ejs=require(_0x89fa('0x9'));var fs=require('fs');var _=require(_0x89fa('0xa'));var squel=require(_0x89fa('0xb'));var crypto=require(_0x89fa('0xc'));var jsforce=require(_0x89fa('0xd'));var deskjs=require(_0x89fa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x89fa('0xf'));var Papa=require('papaparse');var Redis=require(_0x89fa('0x10'));var authService=require(_0x89fa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x89fa('0x12'));var hardwareService=require(_0x89fa('0x13'));var logger=require(_0x89fa('0x14'))(_0x89fa('0x15'));var utils=require(_0x89fa('0x16'));var config=require(_0x89fa('0x17'));var db=require(_0x89fa('0x18'))['db'];function respondWithStatusCode(_0xdea476,_0xd300c3){_0xd300c3=_0xd300c3||0xcc;return function(_0x59cb3a){if(_0x59cb3a){return _0xdea476[_0x89fa('0x19')](_0xd300c3);}return _0xdea476[_0x89fa('0x1a')](_0xd300c3)[_0x89fa('0x1b')]();};}function respondWithResult(_0x7f868b,_0x48cdf0){_0x48cdf0=_0x48cdf0||0xc8;return function(_0x4de795){if(_0x4de795){return _0x7f868b[_0x89fa('0x1a')](_0x48cdf0)[_0x89fa('0x1c')](_0x4de795);}};}function respondWithFilteredResult(_0xf0a62d,_0x55aec9){return function(_0x5933b1){if(_0x5933b1){var _0x66b229=_0x5933b1[_0x89fa('0x1d')],_0x881fbf=_0x55aec9['offset'],_0x57c3c3=_0x55aec9['offset']+_0x55aec9[_0x89fa('0x1e')],_0x212092;if(_0x57c3c3>=_0x66b229){_0x57c3c3=_0x66b229;_0x212092=0xc8;}else{_0x212092=0xce;}_0xf0a62d[_0x89fa('0x1a')](_0x212092);return _0xf0a62d[_0x89fa('0x1f')]('Content-Range',_0x881fbf+'-'+_0x57c3c3+'/'+_0x66b229)[_0x89fa('0x1c')](_0x5933b1);}return null;};}function patchUpdates(_0x4a4c71){return function(_0x48352a){try{jsonpatch['apply'](_0x48352a,_0x4a4c71,!![]);}catch(_0xe4880f){return BPromise[_0x89fa('0x20')](_0xe4880f);}return _0x48352a[_0x89fa('0x21')]();};}function saveUpdates(_0x584dcb,_0x202cdf){return function(_0x2192f6){if(_0x2192f6){return _0x2192f6[_0x89fa('0x22')](_0x584dcb)[_0x89fa('0x23')](function(_0x50d968){return _0x50d968;});}return null;};}function removeEntity(_0x59e0ac,_0x78636){return function(_0x19c426){if(_0x19c426){return _0x19c426['destroy']()[_0x89fa('0x23')](function(){_0x59e0ac[_0x89fa('0x1a')](0xcc)[_0x89fa('0x1b')]();});}};}function handleEntityNotFound(_0x913d26,_0x36ae83){return function(_0x1b8ae2){if(!_0x1b8ae2){_0x913d26[_0x89fa('0x19')](0x194);}return _0x1b8ae2;};}function handleError(_0x4c1c7a,_0xfff3a0){_0xfff3a0=_0xfff3a0||0x1f4;return function(_0x4ceffd){logger['error'](_0x4ceffd[_0x89fa('0x24')]);if(_0x4ceffd['name']){delete _0x4ceffd[_0x89fa('0x25')];}_0x4c1c7a['status'](_0xfff3a0)[_0x89fa('0x26')](_0x4ceffd);};}exports[_0x89fa('0x27')]=function(_0x3bdd97,_0x11763c){var _0xd28d03={},_0xcbbe4d={},_0x5260be={'count':0x0,'rows':[]};var _0x9323f9=_['map'](db[_0x89fa('0x28')][_0x89fa('0x29')],function(_0x2d1549){return{'name':_0x2d1549[_0x89fa('0x2a')],'type':_0x2d1549[_0x89fa('0x2b')][_0x89fa('0x2c')]};});_0xcbbe4d['model']=_[_0x89fa('0x2d')](_0x9323f9,_0x89fa('0x25'));_0xcbbe4d['query']=_['keys'](_0x3bdd97[_0x89fa('0x2e')]);_0xcbbe4d[_0x89fa('0x2f')]=_['intersection'](_0xcbbe4d[_0x89fa('0x30')],_0xcbbe4d[_0x89fa('0x2e')]);_0xd28d03['attributes']=_[_0x89fa('0x31')](_0xcbbe4d['model'],qs['fields'](_0x3bdd97['query'][_0x89fa('0x32')]));_0xd28d03['attributes']=_0xd28d03[_0x89fa('0x33')][_0x89fa('0x34')]?_0xd28d03[_0x89fa('0x33')]:_0xcbbe4d['model'];if(!_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x35')](_0x89fa('0x36'))){_0xd28d03[_0x89fa('0x1e')]=qs[_0x89fa('0x1e')](_0x3bdd97['query'][_0x89fa('0x1e')]);_0xd28d03['offset']=qs[_0x89fa('0x37')](_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x37')]);}_0xd28d03['order']=qs[_0x89fa('0x38')](_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x38')]);_0xd28d03[_0x89fa('0x39')]=qs[_0x89fa('0x2f')](_[_0x89fa('0x3a')](_0x3bdd97[_0x89fa('0x2e')],_0xcbbe4d['filters']),_0x9323f9);if(_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x3b')]){_0xd28d03[_0x89fa('0x39')]=_[_0x89fa('0x3c')](_0xd28d03['where'],{'$or':_['map'](_0x9323f9,function(_0x1b26bd){if(_0x1b26bd[_0x89fa('0x2b')]!==_0x89fa('0x3d')){var _0x7f1fb7={};_0x7f1fb7[_0x1b26bd[_0x89fa('0x25')]]={'$like':'%'+_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x3b')]+'%'};return _0x7f1fb7;}})});}_0xd28d03=_[_0x89fa('0x3c')]({},_0xd28d03,_0x3bdd97[_0x89fa('0x3e')]);var _0x16db11={'where':_0xd28d03[_0x89fa('0x39')]};return db[_0x89fa('0x28')][_0x89fa('0x1d')](_0x16db11)[_0x89fa('0x23')](function(_0x460436){_0x5260be[_0x89fa('0x1d')]=_0x460436;if(_0x3bdd97[_0x89fa('0x2e')][_0x89fa('0x3f')]){_0xd28d03[_0x89fa('0x40')]=[{'all':!![]}];}return db[_0x89fa('0x28')]['findAll'](_0xd28d03);})[_0x89fa('0x23')](function(_0x7ae371){_0x5260be[_0x89fa('0x41')]=_0x7ae371;return _0x5260be;})[_0x89fa('0x23')](respondWithFilteredResult(_0x11763c,_0xd28d03))[_0x89fa('0x42')](handleError(_0x11763c,null));};exports[_0x89fa('0x43')]=function(_0x39064e,_0x571807){var _0x661388={'raw':!![],'where':{'id':_0x39064e[_0x89fa('0x44')]['id']}},_0x1a68c4={};_0x1a68c4[_0x89fa('0x30')]=_['keys'](db[_0x89fa('0x28')][_0x89fa('0x29')]);_0x1a68c4[_0x89fa('0x2e')]=_[_0x89fa('0x45')](_0x39064e[_0x89fa('0x2e')]);_0x1a68c4[_0x89fa('0x2f')]=_[_0x89fa('0x31')](_0x1a68c4[_0x89fa('0x30')],_0x1a68c4[_0x89fa('0x2e')]);_0x661388[_0x89fa('0x33')]=_['intersection'](_0x1a68c4[_0x89fa('0x30')],qs['fields'](_0x39064e[_0x89fa('0x2e')][_0x89fa('0x32')]));_0x661388[_0x89fa('0x33')]=_0x661388[_0x89fa('0x33')][_0x89fa('0x34')]?_0x661388[_0x89fa('0x33')]:_0x1a68c4[_0x89fa('0x30')];if(_0x39064e[_0x89fa('0x2e')][_0x89fa('0x3f')]){_0x661388[_0x89fa('0x40')]=[{'all':!![]}];}_0x661388=_['merge']({},_0x661388,_0x39064e[_0x89fa('0x3e')]);return db[_0x89fa('0x28')][_0x89fa('0x46')](_0x661388)['then'](handleEntityNotFound(_0x571807,null))[_0x89fa('0x23')](respondWithResult(_0x571807,null))[_0x89fa('0x42')](handleError(_0x571807,null));};exports['create']=function(_0x15ad8a,_0x3b78f9){return db[_0x89fa('0x28')][_0x89fa('0x47')](_0x15ad8a['body'],{})['then'](respondWithResult(_0x3b78f9,0xc9))['catch'](handleError(_0x3b78f9,null));};exports[_0x89fa('0x22')]=function(_0x4d4656,_0x589876){if(_0x4d4656[_0x89fa('0x48')]['id']){delete _0x4d4656['body']['id'];}return db[_0x89fa('0x28')][_0x89fa('0x46')]({'where':{'id':_0x4d4656['params']['id']}})[_0x89fa('0x23')](handleEntityNotFound(_0x589876,null))['then'](saveUpdates(_0x4d4656['body'],null))[_0x89fa('0x23')](respondWithResult(_0x589876,null))[_0x89fa('0x42')](handleError(_0x589876,null));};exports['destroy']=function(_0x39c027,_0x2e6e9c){return db['CloudProvider']['find']({'where':{'id':_0x39c027[_0x89fa('0x44')]['id']}})[_0x89fa('0x23')](handleEntityNotFound(_0x2e6e9c,null))['then'](removeEntity(_0x2e6e9c,null))[_0x89fa('0x42')](handleError(_0x2e6e9c,null));}; \ No newline at end of file +var _0x0321=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','then','destroy','end','error','name','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','sox'];(function(_0x4a0b3c,_0x5f151b){var _0x51190b=function(_0x222efd){while(--_0x222efd){_0x4a0b3c['push'](_0x4a0b3c['shift']());}};_0x51190b(++_0x5f151b);}(_0x0321,0x86));var _0x1032=function(_0x475d5f,_0x34abc4){_0x475d5f=_0x475d5f-0x0;var _0x27e851=_0x0321[_0x475d5f];return _0x27e851;};'use strict';var pdf=require(_0x1032('0x0'));var emlformat=require(_0x1032('0x1'));var rimraf=require(_0x1032('0x2'));var zipdir=require(_0x1032('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1032('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1032('0x5'));var util=require(_0x1032('0x6'));var path=require('path');var sox=require(_0x1032('0x7'));var csv=require(_0x1032('0x8'));var ejs=require(_0x1032('0x9'));var fs=require('fs');var _=require(_0x1032('0xa'));var squel=require(_0x1032('0xb'));var crypto=require(_0x1032('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1032('0xd'));var toCsv=require(_0x1032('0x8'));var querystring=require(_0x1032('0xe'));var Papa=require(_0x1032('0xf'));var Redis=require('ioredis');var authService=require(_0x1032('0x10'));var qs=require(_0x1032('0x11'));var as=require(_0x1032('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1032('0x13'))(_0x1032('0x14'));var utils=require(_0x1032('0x15'));var config=require(_0x1032('0x16'));var db=require(_0x1032('0x17'))['db'];function respondWithStatusCode(_0x220d3c,_0x1d359e){_0x1d359e=_0x1d359e||0xcc;return function(_0x229736){if(_0x229736){return _0x220d3c[_0x1032('0x18')](_0x1d359e);}return _0x220d3c[_0x1032('0x19')](_0x1d359e)['end']();};}function respondWithResult(_0x1798d7,_0x42e967){_0x42e967=_0x42e967||0xc8;return function(_0x358461){if(_0x358461){return _0x1798d7[_0x1032('0x19')](_0x42e967)['json'](_0x358461);}};}function respondWithFilteredResult(_0x5f5859,_0x32dd3b){return function(_0x5a5539){if(_0x5a5539){var _0x505e92=_0x5a5539[_0x1032('0x1a')],_0x2ce499=_0x32dd3b[_0x1032('0x1b')],_0x2ed85a=_0x32dd3b['offset']+_0x32dd3b[_0x1032('0x1c')],_0x14d7b0;if(_0x2ed85a>=_0x505e92){_0x2ed85a=_0x505e92;_0x14d7b0=0xc8;}else{_0x14d7b0=0xce;}_0x5f5859['status'](_0x14d7b0);return _0x5f5859[_0x1032('0x1d')]('Content-Range',_0x2ce499+'-'+_0x2ed85a+'/'+_0x505e92)[_0x1032('0x1e')](_0x5a5539);}return null;};}function patchUpdates(_0x2c0334){return function(_0x3fd5e8){try{jsonpatch['apply'](_0x3fd5e8,_0x2c0334,!![]);}catch(_0x4e1d3e){return BPromise['reject'](_0x4e1d3e);}return _0x3fd5e8['save']();};}function saveUpdates(_0x5c3153,_0x20af37){return function(_0x5a759e){if(_0x5a759e){return _0x5a759e['update'](_0x5c3153)[_0x1032('0x1f')](function(_0x2a5a36){return _0x2a5a36;});}return null;};}function removeEntity(_0x5b00b4,_0x310d73){return function(_0x253397){if(_0x253397){return _0x253397[_0x1032('0x20')]()[_0x1032('0x1f')](function(){_0x5b00b4[_0x1032('0x19')](0xcc)[_0x1032('0x21')]();});}};}function handleEntityNotFound(_0x35a336,_0x4d5024){return function(_0x4e60c9){if(!_0x4e60c9){_0x35a336['sendStatus'](0x194);}return _0x4e60c9;};}function handleError(_0x5467ec,_0x2b0d49){_0x2b0d49=_0x2b0d49||0x1f4;return function(_0x392dd8){logger[_0x1032('0x22')](_0x392dd8['stack']);if(_0x392dd8[_0x1032('0x23')]){delete _0x392dd8['name'];}_0x5467ec[_0x1032('0x19')](_0x2b0d49)['send'](_0x392dd8);};}exports[_0x1032('0x24')]=function(_0x173590,_0x40c6dd){var _0x2c3ed2={},_0x4bf8b6={},_0x564320={'count':0x0,'rows':[]};var _0x5cf4e0=_[_0x1032('0x25')](db[_0x1032('0x26')][_0x1032('0x27')],function(_0xd10a26){return{'name':_0xd10a26[_0x1032('0x28')],'type':_0xd10a26[_0x1032('0x29')][_0x1032('0x2a')]};});_0x4bf8b6[_0x1032('0x2b')]=_[_0x1032('0x25')](_0x5cf4e0,_0x1032('0x23'));_0x4bf8b6['query']=_[_0x1032('0x2c')](_0x173590[_0x1032('0x2d')]);_0x4bf8b6['filters']=_[_0x1032('0x2e')](_0x4bf8b6[_0x1032('0x2b')],_0x4bf8b6[_0x1032('0x2d')]);_0x2c3ed2[_0x1032('0x2f')]=_[_0x1032('0x2e')](_0x4bf8b6[_0x1032('0x2b')],qs[_0x1032('0x30')](_0x173590[_0x1032('0x2d')][_0x1032('0x30')]));_0x2c3ed2[_0x1032('0x2f')]=_0x2c3ed2['attributes'][_0x1032('0x31')]?_0x2c3ed2[_0x1032('0x2f')]:_0x4bf8b6[_0x1032('0x2b')];if(!_0x173590[_0x1032('0x2d')][_0x1032('0x32')](_0x1032('0x33'))){_0x2c3ed2[_0x1032('0x1c')]=qs[_0x1032('0x1c')](_0x173590['query'][_0x1032('0x1c')]);_0x2c3ed2[_0x1032('0x1b')]=qs[_0x1032('0x1b')](_0x173590[_0x1032('0x2d')][_0x1032('0x1b')]);}_0x2c3ed2[_0x1032('0x34')]=qs[_0x1032('0x35')](_0x173590[_0x1032('0x2d')][_0x1032('0x35')]);_0x2c3ed2[_0x1032('0x36')]=qs[_0x1032('0x37')](_[_0x1032('0x38')](_0x173590[_0x1032('0x2d')],_0x4bf8b6['filters']),_0x5cf4e0);if(_0x173590[_0x1032('0x2d')][_0x1032('0x39')]){_0x2c3ed2[_0x1032('0x36')]=_[_0x1032('0x3a')](_0x2c3ed2[_0x1032('0x36')],{'$or':_[_0x1032('0x25')](_0x5cf4e0,function(_0xaa6510){if(_0xaa6510[_0x1032('0x29')]!==_0x1032('0x3b')){var _0x5883c5={};_0x5883c5[_0xaa6510[_0x1032('0x23')]]={'$like':'%'+_0x173590[_0x1032('0x2d')]['filter']+'%'};return _0x5883c5;}})});}_0x2c3ed2=_['merge']({},_0x2c3ed2,_0x173590[_0x1032('0x3c')]);var _0x2d20b4={'where':_0x2c3ed2[_0x1032('0x36')]};return db[_0x1032('0x26')][_0x1032('0x1a')](_0x2d20b4)[_0x1032('0x1f')](function(_0x232781){_0x564320[_0x1032('0x1a')]=_0x232781;if(_0x173590['query'][_0x1032('0x3d')]){_0x2c3ed2[_0x1032('0x3e')]=[{'all':!![]}];}return db[_0x1032('0x26')][_0x1032('0x3f')](_0x2c3ed2);})[_0x1032('0x1f')](function(_0xbd4369){_0x564320[_0x1032('0x40')]=_0xbd4369;return _0x564320;})[_0x1032('0x1f')](respondWithFilteredResult(_0x40c6dd,_0x2c3ed2))[_0x1032('0x41')](handleError(_0x40c6dd,null));};exports[_0x1032('0x42')]=function(_0x380331,_0x498771){var _0x250395={'raw':!![],'where':{'id':_0x380331[_0x1032('0x43')]['id']}},_0x321323={};_0x321323[_0x1032('0x2b')]=_[_0x1032('0x2c')](db[_0x1032('0x26')]['rawAttributes']);_0x321323[_0x1032('0x2d')]=_[_0x1032('0x2c')](_0x380331[_0x1032('0x2d')]);_0x321323['filters']=_['intersection'](_0x321323[_0x1032('0x2b')],_0x321323[_0x1032('0x2d')]);_0x250395['attributes']=_[_0x1032('0x2e')](_0x321323['model'],qs[_0x1032('0x30')](_0x380331[_0x1032('0x2d')][_0x1032('0x30')]));_0x250395[_0x1032('0x2f')]=_0x250395[_0x1032('0x2f')][_0x1032('0x31')]?_0x250395[_0x1032('0x2f')]:_0x321323[_0x1032('0x2b')];if(_0x380331[_0x1032('0x2d')][_0x1032('0x3d')]){_0x250395[_0x1032('0x3e')]=[{'all':!![]}];}_0x250395=_[_0x1032('0x3a')]({},_0x250395,_0x380331['options']);return db[_0x1032('0x26')][_0x1032('0x44')](_0x250395)[_0x1032('0x1f')](handleEntityNotFound(_0x498771,null))[_0x1032('0x1f')](respondWithResult(_0x498771,null))[_0x1032('0x41')](handleError(_0x498771,null));};exports[_0x1032('0x45')]=function(_0x3253b4,_0x1adabb){return db[_0x1032('0x26')][_0x1032('0x45')](_0x3253b4[_0x1032('0x46')],{})['then'](respondWithResult(_0x1adabb,0xc9))[_0x1032('0x41')](handleError(_0x1adabb,null));};exports['update']=function(_0x436549,_0x2156d7){if(_0x436549[_0x1032('0x46')]['id']){delete _0x436549[_0x1032('0x46')]['id'];}return db[_0x1032('0x26')][_0x1032('0x44')]({'where':{'id':_0x436549[_0x1032('0x43')]['id']}})[_0x1032('0x1f')](handleEntityNotFound(_0x2156d7,null))[_0x1032('0x1f')](saveUpdates(_0x436549[_0x1032('0x46')],null))[_0x1032('0x1f')](respondWithResult(_0x2156d7,null))[_0x1032('0x41')](handleError(_0x2156d7,null));};exports['destroy']=function(_0xc032ef,_0x283fdc){return db[_0x1032('0x26')][_0x1032('0x44')]({'where':{'id':_0xc032ef[_0x1032('0x43')]['id']}})[_0x1032('0x1f')](handleEntityNotFound(_0x283fdc,null))['then'](removeEntity(_0x283fdc,null))[_0x1032('0x41')](handleError(_0x283fdc,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 24e5d8f..18d5755 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 _0xe1e7=['moment','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','../../config/logger','api'];(function(_0x20700f,_0x48d4ab){var _0x2c1f6a=function(_0x173bca){while(--_0x173bca){_0x20700f['push'](_0x20700f['shift']());}};_0x2c1f6a(++_0x48d4ab);}(_0xe1e7,0x16f));var _0x7e1e=function(_0x3d237d,_0x223920){_0x3d237d=_0x3d237d-0x0;var _0x51fd69=_0xe1e7[_0x3d237d];return _0x51fd69;};'use strict';var _=require(_0x7e1e('0x0'));var util=require('util');var logger=require(_0x7e1e('0x1'))(_0x7e1e('0x2'));var moment=require(_0x7e1e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e1e('0x4'));var config=require(_0x7e1e('0x5'));var attributes=require(_0x7e1e('0x6'));module[_0x7e1e('0x7')]=function(_0x26f074,_0x2f0f4a){return _0x26f074[_0x7e1e('0x8')](_0x7e1e('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x610a=['cloud_providers','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x610a,0x12d));var _0xa610=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x610a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa610('0x0'));var logger=require('../../config/logger')(_0xa610('0x1'));var moment=require(_0xa610('0x2'));var BPromise=require(_0xa610('0x3'));var rp=require(_0xa610('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa610('0x5'));var config=require(_0xa610('0x6'));var attributes=require(_0xa610('0x7'));module[_0xa610('0x8')]=function(_0x5e3adf,_0x1ff69a){return _0x5e3adf[_0xa610('0x9')](_0xa610('0xa'),attributes,{'tableName':_0xa610('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 8efeec1..34e20ad 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 _0x29e2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x196d5d,_0x35846f){var _0x4aa9de=function(_0x48724c){while(--_0x48724c){_0x196d5d['push'](_0x196d5d['shift']());}};_0x4aa9de(++_0x35846f);}(_0x29e2,0x197));var _0x229e=function(_0x3d72d4,_0x348baf){_0x3d72d4=_0x3d72d4-0x0;var _0x46c4fe=_0x29e2[_0x3d72d4];return _0x46c4fe;};'use strict';var _=require(_0x229e('0x0'));var util=require(_0x229e('0x1'));var moment=require(_0x229e('0x2'));var BPromise=require(_0x229e('0x3'));var rs=require(_0x229e('0x4'));var fs=require('fs');var Redis=require(_0x229e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x229e('0x6'));var logger=require(_0x229e('0x7'))(_0x229e('0x8'));var config=require(_0x229e('0x9'));var jayson=require(_0x229e('0xa'));var client=jayson[_0x229e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5090c5,_0x6e9d67,_0x82c9c6){return new BPromise(function(_0x38510a,_0xc70b00){return client[_0x229e('0xc')](_0x5090c5,_0x82c9c6)[_0x229e('0xd')](function(_0x584dd4){logger['info'](_0x229e('0xe'),_0x6e9d67,_0x229e('0xf'));logger['debug'](_0x229e('0x10'),_0x6e9d67,_0x229e('0xf'),JSON[_0x229e('0x11')](_0x584dd4));if(_0x584dd4[_0x229e('0x12')]){if(_0x584dd4[_0x229e('0x12')][_0x229e('0x13')]===0x1f4){logger['error'](_0x229e('0xe'),_0x6e9d67,_0x584dd4['error'][_0x229e('0x14')]);return _0xc70b00(_0x584dd4[_0x229e('0x12')][_0x229e('0x14')]);}logger[_0x229e('0x12')](_0x229e('0xe'),_0x6e9d67,_0x584dd4[_0x229e('0x12')][_0x229e('0x14')]);return _0x38510a(_0x584dd4['error']['message']);}else{logger[_0x229e('0x15')](_0x229e('0xe'),_0x6e9d67,_0x229e('0xf'));_0x38510a(_0x584dd4[_0x229e('0x16')][_0x229e('0x14')]);}})[_0x229e('0x17')](function(_0x325c5a){logger['error'](_0x229e('0xe'),_0x6e9d67,_0x325c5a);_0xc70b00(_0x325c5a);});});} \ No newline at end of file +var _0x7394=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x34a0a2,_0x6ab44b){var _0x51c94d=function(_0x372466){while(--_0x372466){_0x34a0a2['push'](_0x34a0a2['shift']());}};_0x51c94d(++_0x6ab44b);}(_0x7394,0xb9));var _0x4739=function(_0x9bfb45,_0x3f3c49){_0x9bfb45=_0x9bfb45-0x0;var _0x4cd01f=_0x7394[_0x9bfb45];return _0x4cd01f;};'use strict';var _=require(_0x4739('0x0'));var util=require(_0x4739('0x1'));var moment=require(_0x4739('0x2'));var BPromise=require(_0x4739('0x3'));var rs=require(_0x4739('0x4'));var fs=require('fs');var Redis=require(_0x4739('0x5'));var db=require(_0x4739('0x6'))['db'];var utils=require(_0x4739('0x7'));var logger=require(_0x4739('0x8'))('rpc');var config=require(_0x4739('0x9'));var jayson=require(_0x4739('0xa'));var client=jayson[_0x4739('0xb')][_0x4739('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c91ea,_0x276bd5,_0x589ed6){return new BPromise(function(_0x3f327e,_0x3eb6ca){return client['request'](_0x4c91ea,_0x589ed6)['then'](function(_0x1ccad4){logger[_0x4739('0xd')](_0x4739('0xe'),_0x276bd5,_0x4739('0xf'));logger[_0x4739('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x276bd5,_0x4739('0xf'),JSON[_0x4739('0x11')](_0x1ccad4));if(_0x1ccad4[_0x4739('0x12')]){if(_0x1ccad4[_0x4739('0x12')][_0x4739('0x13')]===0x1f4){logger[_0x4739('0x12')]('CloudProvider,\x20%s,\x20%s',_0x276bd5,_0x1ccad4[_0x4739('0x12')][_0x4739('0x14')]);return _0x3eb6ca(_0x1ccad4['error'][_0x4739('0x14')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x276bd5,_0x1ccad4[_0x4739('0x12')][_0x4739('0x14')]);return _0x3f327e(_0x1ccad4[_0x4739('0x12')][_0x4739('0x14')]);}else{logger[_0x4739('0xd')](_0x4739('0xe'),_0x276bd5,_0x4739('0xf'));_0x3f327e(_0x1ccad4['result'][_0x4739('0x14')]);}})[_0x4739('0x15')](function(_0x158d78){logger[_0x4739('0x12')]('CloudProvider,\x20%s,\x20%s',_0x276bd5,_0x158d78);_0x3eb6ca(_0x158d78);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index fdeb906..e253451 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 _0xe860=['put','update','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xe860,0x8b));var _0x0e86=function(_0x5de0ec,_0x439c1c){_0x5de0ec=_0x5de0ec-0x0;var _0x1bb675=_0xe860[_0x5de0ec];return _0x1bb675;};'use strict';var multer=require('multer');var util=require(_0x0e86('0x0'));var path=require(_0x0e86('0x1'));var timeout=require(_0x0e86('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0e86('0x3'));var interaction=require(_0x0e86('0x4'));var config=require(_0x0e86('0x5'));var controller=require(_0x0e86('0x6'));router[_0x0e86('0x7')]('/',auth[_0x0e86('0x8')](),controller[_0x0e86('0x9')]);router[_0x0e86('0x7')](_0x0e86('0xa'),auth[_0x0e86('0x8')](),controller[_0x0e86('0xb')]);router[_0x0e86('0xc')]('/',auth[_0x0e86('0x8')](),controller[_0x0e86('0xd')]);router[_0x0e86('0xe')]('/:id',auth[_0x0e86('0x8')](),controller[_0x0e86('0xf')]);router['delete'](_0x0e86('0xa'),auth[_0x0e86('0x8')](),controller[_0x0e86('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfc81=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x1f404a,_0x5088b2){var _0x2cdcd5=function(_0xe30d8c){while(--_0xe30d8c){_0x1f404a['push'](_0x1f404a['shift']());}};_0x2cdcd5(++_0x5088b2);}(_0xfc81,0x1df));var _0x1fc8=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xfc81[_0x49052b];return _0x48c045;};'use strict';var multer=require(_0x1fc8('0x0'));var util=require(_0x1fc8('0x1'));var path=require(_0x1fc8('0x2'));var timeout=require(_0x1fc8('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x1fc8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fc8('0x5'));var controller=require(_0x1fc8('0x6'));router[_0x1fc8('0x7')]('/',auth['isAuthenticated'](),controller[_0x1fc8('0x8')]);router[_0x1fc8('0x7')](_0x1fc8('0x9'),auth[_0x1fc8('0xa')](),controller[_0x1fc8('0xb')]);router['post']('/',auth[_0x1fc8('0xa')](),controller[_0x1fc8('0xc')]);router[_0x1fc8('0xd')](_0x1fc8('0x9'),auth[_0x1fc8('0xa')](),controller['update']);router[_0x1fc8('0xe')](_0x1fc8('0x9'),auth[_0x1fc8('0xa')](),controller[_0x1fc8('0xf')]);module[_0x1fc8('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index e18b961..839cb8f 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 _0xcc93=['exports','STRING','sequelize'];(function(_0x12280b,_0x16949b){var _0x50a939=function(_0x5835aa){while(--_0x5835aa){_0x12280b['push'](_0x12280b['shift']());}};_0x50a939(++_0x16949b);}(_0xcc93,0x176));var _0x3cc9=function(_0x3430a5,_0x202f8d){_0x3430a5=_0x3430a5-0x0;var _0x16189e=_0xcc93[_0x3430a5];return _0x16189e;};'use strict';var Sequelize=require(_0x3cc9('0x0'));module[_0x3cc9('0x1')]={'name':{'type':Sequelize[_0x3cc9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3cc9('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x3cc9('0x2')]},'phone':{'type':Sequelize[_0x3cc9('0x2')]},'fax':{'type':Sequelize[_0x3cc9('0x2')]},'type':{'type':Sequelize[_0x3cc9('0x2')]},'street':{'type':Sequelize[_0x3cc9('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3cc9('0x2')]},'country':{'type':Sequelize[_0x3cc9('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3cc9('0x2')]},'sStreet':{'type':Sequelize[_0x3cc9('0x2')]},'sPostalCode':{'type':Sequelize[_0x3cc9('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3cc9('0x2')]}}; \ No newline at end of file +var _0x1fda=['STRING','name','sequelize','exports'];(function(_0x554579,_0x342b8d){var _0x214575=function(_0x506fd1){while(--_0x506fd1){_0x554579['push'](_0x554579['shift']());}};_0x214575(++_0x342b8d);}(_0x1fda,0x1d2));var _0xa1fd=function(_0x1f8eb8,_0xfc4345){_0x1f8eb8=_0x1f8eb8-0x0;var _0x37ca05=_0x1fda[_0x1f8eb8];return _0x37ca05;};'use strict';var Sequelize=require(_0xa1fd('0x0'));module[_0xa1fd('0x1')]={'name':{'type':Sequelize[_0xa1fd('0x2')],'unique':_0xa1fd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa1fd('0x2')]},'companyId':{'type':Sequelize[_0xa1fd('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa1fd('0x2')]},'fax':{'type':Sequelize[_0xa1fd('0x2')]},'type':{'type':Sequelize[_0xa1fd('0x2')]},'street':{'type':Sequelize[_0xa1fd('0x2')]},'postalCode':{'type':Sequelize[_0xa1fd('0x2')]},'city':{'type':Sequelize[_0xa1fd('0x2')]},'country':{'type':Sequelize[_0xa1fd('0x2')]},'email':{'type':Sequelize[_0xa1fd('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xa1fd('0x2')]},'sPostalCode':{'type':Sequelize[_0xa1fd('0x2')]},'sCity':{'type':Sequelize[_0xa1fd('0x2')]},'sCountry':{'type':Sequelize[_0xa1fd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 42424ad..e548b68 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 _0xe071=['to-csv','querystring','papaparse','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','set','Content-Range','save','then','get','Companies','UserProfileResource','sendStatus','error','stack','name','index','describe','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','CmCompany','findAll','rows','show','params','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addContacts','CmContact','omit','ids','getContacts','findOne','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','mustache','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x11b2ce,_0x31f8d4){var _0x35d74e=function(_0x3fe74f){while(--_0x3fe74f){_0x11b2ce['push'](_0x11b2ce['shift']());}};_0x35d74e(++_0x31f8d4);}(_0xe071,0xf7));var _0x1e07=function(_0x4fab79,_0x4f76dc){_0x4fab79=_0x4fab79-0x0;var _0x31ec8e=_0xe071[_0x4fab79];return _0x31ec8e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1e07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e07('0x1'));var jsonpatch=require(_0x1e07('0x2'));var rp=require(_0x1e07('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1e07('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e07('0x5'));var fs=require('fs');var _=require(_0x1e07('0x6'));var squel=require(_0x1e07('0x7'));var crypto=require(_0x1e07('0x8'));var jsforce=require(_0x1e07('0x9'));var deskjs=require(_0x1e07('0xa'));var toCsv=require(_0x1e07('0xb'));var querystring=require(_0x1e07('0xc'));var Papa=require(_0x1e07('0xd'));var Redis=require(_0x1e07('0xe'));var authService=require(_0x1e07('0xf'));var qs=require(_0x1e07('0x10'));var as=require(_0x1e07('0x11'));var hardwareService=require(_0x1e07('0x12'));var logger=require('../../config/logger')(_0x1e07('0x13'));var utils=require(_0x1e07('0x14'));var config=require(_0x1e07('0x15'));var db=require(_0x1e07('0x16'))['db'];function respondWithStatusCode(_0x1d544c,_0x81ef9f){_0x81ef9f=_0x81ef9f||0xcc;return function(_0x42a648){if(_0x42a648){return _0x1d544c['sendStatus'](_0x81ef9f);}return _0x1d544c[_0x1e07('0x17')](_0x81ef9f)[_0x1e07('0x18')]();};}function respondWithResult(_0x20e386,_0x186fb6){_0x186fb6=_0x186fb6||0xc8;return function(_0x27ad6a){if(_0x27ad6a){return _0x20e386[_0x1e07('0x17')](_0x186fb6)[_0x1e07('0x19')](_0x27ad6a);}};}function respondWithFilteredResult(_0x180d6d,_0x19f8a3){return function(_0x1090ef){if(_0x1090ef){var _0x2d6044=_0x1090ef[_0x1e07('0x1a')],_0x53ad8e=_0x19f8a3[_0x1e07('0x1b')],_0x57f82f=_0x19f8a3[_0x1e07('0x1b')]+_0x19f8a3[_0x1e07('0x1c')],_0x246f65;if(_0x57f82f>=_0x2d6044){_0x57f82f=_0x2d6044;_0x246f65=0xc8;}else{_0x246f65=0xce;}_0x180d6d[_0x1e07('0x17')](_0x246f65);return _0x180d6d[_0x1e07('0x1d')](_0x1e07('0x1e'),_0x53ad8e+'-'+_0x57f82f+'/'+_0x2d6044)[_0x1e07('0x19')](_0x1090ef);}return null;};}function patchUpdates(_0x26e361){return function(_0x5a619a){try{jsonpatch['apply'](_0x5a619a,_0x26e361,!![]);}catch(_0x2f6063){return BPromise['reject'](_0x2f6063);}return _0x5a619a[_0x1e07('0x1f')]();};}function saveUpdates(_0x41ce7e,_0x1c76da){return function(_0x4ed88b){if(_0x4ed88b){return _0x4ed88b['update'](_0x41ce7e)[_0x1e07('0x20')](function(_0x585230){return _0x585230;});}return null;};}function removeEntity(_0x962cbe,_0x51ef1e){return function(_0x222beb){if(_0x222beb){return _0x222beb['destroy']()[_0x1e07('0x20')](function(){var _0x2be076=_0x222beb[_0x1e07('0x21')]({'plain':!![]});var _0x72661c=_0x1e07('0x22');return db[_0x1e07('0x23')]['destroy']({'where':{'type':_0x72661c,'resourceId':_0x2be076['id']}})[_0x1e07('0x20')](function(){return _0x222beb;});})['then'](function(){_0x962cbe[_0x1e07('0x17')](0xcc)[_0x1e07('0x18')]();});}};}function handleEntityNotFound(_0x12a06d,_0x17ed08){return function(_0x30677c){if(!_0x30677c){_0x12a06d[_0x1e07('0x24')](0x194);}return _0x30677c;};}function handleError(_0x1ac57a,_0x4b6c46){_0x4b6c46=_0x4b6c46||0x1f4;return function(_0x275545){logger[_0x1e07('0x25')](_0x275545[_0x1e07('0x26')]);if(_0x275545[_0x1e07('0x27')]){delete _0x275545[_0x1e07('0x27')];}_0x1ac57a[_0x1e07('0x17')](_0x4b6c46)['send'](_0x275545);};}exports[_0x1e07('0x28')]=function(_0x29171f,_0xb76556){var _0x418165={},_0x338081={},_0x289efa={'count':0x0,'rows':[]};return db['CmCompany'][_0x1e07('0x29')]()['then'](function(_0xbc86ea){_0x338081[_0x1e07('0x2a')]=_['keys'](_0xbc86ea);_0x338081[_0x1e07('0x2b')]=_[_0x1e07('0x2c')](_0x29171f['query']);_0x338081[_0x1e07('0x2d')]=_[_0x1e07('0x2e')](_0x338081[_0x1e07('0x2a')],_0x338081[_0x1e07('0x2b')]);_0x418165['attributes']=_[_0x1e07('0x2e')](_0x338081[_0x1e07('0x2a')],qs[_0x1e07('0x2f')](_0x29171f[_0x1e07('0x2b')][_0x1e07('0x2f')]));_0x418165[_0x1e07('0x30')]=_0x418165[_0x1e07('0x30')]['length']?_0x418165[_0x1e07('0x30')]:_0x338081[_0x1e07('0x2a')];if(!_0x29171f[_0x1e07('0x2b')]['hasOwnProperty'](_0x1e07('0x31'))){_0x418165['limit']=qs[_0x1e07('0x1c')](_0x29171f[_0x1e07('0x2b')][_0x1e07('0x1c')]);_0x418165[_0x1e07('0x1b')]=qs[_0x1e07('0x1b')](_0x29171f[_0x1e07('0x2b')][_0x1e07('0x1b')]);}_0x418165[_0x1e07('0x32')]=qs[_0x1e07('0x33')](_0x29171f[_0x1e07('0x2b')][_0x1e07('0x33')]);_0x418165[_0x1e07('0x34')]=qs[_0x1e07('0x2d')](_[_0x1e07('0x35')](_0x29171f['query'],_0x338081[_0x1e07('0x2d')]),_0xbc86ea);if(_0x29171f[_0x1e07('0x2b')][_0x1e07('0x36')]){_0x418165[_0x1e07('0x34')]=_[_0x1e07('0x37')](_0x418165[_0x1e07('0x34')],{'$or':_[_0x1e07('0x38')](_0x418165[_0x1e07('0x30')],function(_0x88ebec){var _0x20443a={};_0x20443a[_0x88ebec]={'$like':'%'+_0x29171f[_0x1e07('0x2b')][_0x1e07('0x36')]+'%'};return _0x20443a;})});}_0x418165=_['merge']({},_0x418165,_0x29171f[_0x1e07('0x39')]);var _0x257ef3={'where':_0x418165['where']};return db['CmCompany']['count'](_0x257ef3)[_0x1e07('0x20')](function(_0x41c365){_0x289efa[_0x1e07('0x1a')]=_0x41c365;if(_0x29171f[_0x1e07('0x2b')][_0x1e07('0x3a')]){_0x418165['include']=[{'all':!![]}];}return db[_0x1e07('0x3b')][_0x1e07('0x3c')](_0x418165);})[_0x1e07('0x20')](function(_0x10eab5){_0x289efa[_0x1e07('0x3d')]=_0x10eab5;return _0x289efa;})[_0x1e07('0x20')](respondWithFilteredResult(_0xb76556,_0x418165))['catch'](handleError(_0xb76556,null));})['catch'](handleError(_0xb76556,null));};exports[_0x1e07('0x3e')]=function(_0x4effbe,_0x584bcd){var _0x5a51f6={'raw':![],'where':{'id':_0x4effbe[_0x1e07('0x3f')]['id']}},_0x5b809c={};_0x5b809c[_0x1e07('0x2a')]=_[_0x1e07('0x2c')](db[_0x1e07('0x3b')][_0x1e07('0x40')]);_0x5b809c['query']=_[_0x1e07('0x2c')](_0x4effbe['query']);_0x5b809c[_0x1e07('0x2d')]=_[_0x1e07('0x2e')](_0x5b809c['model'],_0x5b809c[_0x1e07('0x2b')]);_0x5a51f6['attributes']=_['intersection'](_0x5b809c['model'],qs[_0x1e07('0x2f')](_0x4effbe[_0x1e07('0x2b')]['fields']));_0x5a51f6[_0x1e07('0x30')]=_0x5a51f6['attributes'][_0x1e07('0x41')]?_0x5a51f6[_0x1e07('0x30')]:_0x5b809c['model'];if(_0x4effbe[_0x1e07('0x2b')]['includeAll']){_0x5a51f6[_0x1e07('0x42')]=[{'all':!![]}];}_0x5a51f6=_[_0x1e07('0x37')]({},_0x5a51f6,_0x4effbe[_0x1e07('0x39')]);return db['CmCompany'][_0x1e07('0x43')](_0x5a51f6)[_0x1e07('0x20')](handleEntityNotFound(_0x584bcd,null))['then'](respondWithResult(_0x584bcd,null))[_0x1e07('0x44')](handleError(_0x584bcd,null));};exports['create']=function(_0x2b273b,_0x16e5de){return db[_0x1e07('0x3b')][_0x1e07('0x45')](_0x2b273b[_0x1e07('0x46')],{})[_0x1e07('0x20')](function(_0x718fa1){var _0x70d36a=_0x2b273b[_0x1e07('0x47')][_0x1e07('0x21')]({'plain':!![]});if(!_0x70d36a)throw new Error(_0x1e07('0x48'));if(_0x70d36a[_0x1e07('0x49')]===_0x1e07('0x47')){var _0x15d724=_0x718fa1[_0x1e07('0x21')]({'plain':!![]});var _0x3719d1=_0x1e07('0x22');return db[_0x1e07('0x4a')][_0x1e07('0x43')]({'where':{'name':_0x3719d1,'userProfileId':_0x70d36a['userProfileId']},'raw':!![]})[_0x1e07('0x20')](function(_0x4a7c83){if(_0x4a7c83&&_0x4a7c83[_0x1e07('0x4b')]===0x0){return db[_0x1e07('0x23')]['create']({'name':_0x15d724['name'],'resourceId':_0x15d724['id'],'type':_0x4a7c83[_0x1e07('0x27')],'sectionId':_0x4a7c83['id']},{})[_0x1e07('0x20')](function(){return _0x718fa1;});}else{return _0x718fa1;}})[_0x1e07('0x44')](function(_0x5266af){logger[_0x1e07('0x25')](_0x1e07('0x4c'),_0x5266af);throw _0x5266af;});}return _0x718fa1;})[_0x1e07('0x20')](respondWithResult(_0x16e5de,0xc9))['catch'](handleError(_0x16e5de,null));};exports[_0x1e07('0x4d')]=function(_0x5069b6,_0x2cf626){if(_0x5069b6[_0x1e07('0x46')]['id']){delete _0x5069b6[_0x1e07('0x46')]['id'];}return db[_0x1e07('0x3b')][_0x1e07('0x43')]({'where':{'id':_0x5069b6[_0x1e07('0x3f')]['id']}})[_0x1e07('0x20')](handleEntityNotFound(_0x2cf626,null))[_0x1e07('0x20')](saveUpdates(_0x5069b6['body'],null))[_0x1e07('0x20')](respondWithResult(_0x2cf626,null))[_0x1e07('0x44')](handleError(_0x2cf626,null));};exports[_0x1e07('0x4e')]=function(_0x22c76a,_0x1c63d8){return db[_0x1e07('0x3b')][_0x1e07('0x43')]({'where':{'id':_0x22c76a[_0x1e07('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1c63d8,null))['then'](removeEntity(_0x1c63d8,null))[_0x1e07('0x44')](handleError(_0x1c63d8,null));};exports[_0x1e07('0x29')]=function(_0x8fbf13,_0x37356a){return db[_0x1e07('0x3b')]['describe']()['then'](respondWithResult(_0x37356a,null))[_0x1e07('0x44')](handleError(_0x37356a,null));};exports[_0x1e07('0x4f')]=function(_0x5331d3,_0x124391,_0x5886fb){return db[_0x1e07('0x50')]['find']({'where':{'id':_0x5331d3[_0x1e07('0x3f')]['id']}})[_0x1e07('0x20')](handleEntityNotFound(_0x124391,null))['then'](function(_0x168072){if(_0x168072){return _0x168072[_0x1e07('0x4f')](_0x5331d3['body']['ids'],_[_0x1e07('0x51')](_0x5331d3[_0x1e07('0x46')],[_0x1e07('0x52'),'id'])||{});}})['then'](respondWithResult(_0x124391,null))['catch'](handleError(_0x124391,null));};exports[_0x1e07('0x53')]=function(_0x19499e,_0x38a972,_0x4c3b57){var _0x30e426={};var _0x3fd280={};var _0x206618;var _0x213833;return db[_0x1e07('0x3b')][_0x1e07('0x54')]({'where':{'id':_0x19499e[_0x1e07('0x3f')]['id']}})[_0x1e07('0x20')](handleEntityNotFound(_0x38a972,null))[_0x1e07('0x20')](function(_0x44e064){if(_0x44e064){_0x206618=_0x44e064;_0x3fd280[_0x1e07('0x2a')]=_[_0x1e07('0x2c')](db[_0x1e07('0x50')]['rawAttributes']);_0x3fd280['query']=_['keys'](_0x19499e['query']);_0x3fd280[_0x1e07('0x2d')]=_['intersection'](_0x3fd280[_0x1e07('0x2a')],_0x3fd280[_0x1e07('0x2b')]);_0x30e426[_0x1e07('0x30')]=_['intersection'](_0x3fd280[_0x1e07('0x2a')],qs[_0x1e07('0x2f')](_0x19499e['query'][_0x1e07('0x2f')]));_0x30e426['attributes']=_0x30e426[_0x1e07('0x30')][_0x1e07('0x41')]?_0x30e426[_0x1e07('0x30')]:_0x3fd280[_0x1e07('0x2a')];_0x30e426['order']=qs[_0x1e07('0x33')](_0x19499e[_0x1e07('0x2b')]['sort']);_0x30e426[_0x1e07('0x34')]=qs[_0x1e07('0x2d')](_[_0x1e07('0x35')](_0x19499e[_0x1e07('0x2b')],_0x3fd280['filters']));if(_0x19499e['query'][_0x1e07('0x36')]){_0x30e426[_0x1e07('0x34')]=_['merge'](_0x30e426[_0x1e07('0x34')],{'$or':_[_0x1e07('0x38')](_0x30e426['attributes'],function(_0x55bac2){var _0x535463={};_0x535463[_0x55bac2]={'$like':'%'+_0x19499e[_0x1e07('0x2b')]['filter']+'%'};return _0x535463;})});}_0x30e426=_['merge']({},_0x30e426,_0x19499e['options']);return _0x206618[_0x1e07('0x53')](_0x30e426);}})[_0x1e07('0x20')](function(_0x336450){if(_0x336450){_0x213833=_0x336450[_0x1e07('0x41')];if(!_0x19499e['query'][_0x1e07('0x55')](_0x1e07('0x31'))){_0x30e426[_0x1e07('0x1c')]=qs[_0x1e07('0x1c')](_0x19499e[_0x1e07('0x2b')][_0x1e07('0x1c')]);_0x30e426['offset']=qs[_0x1e07('0x1b')](_0x19499e[_0x1e07('0x2b')]['offset']);}return _0x206618['getContacts'](_0x30e426);}})[_0x1e07('0x20')](function(_0x56ba10){if(_0x56ba10){return _0x56ba10?{'count':_0x213833,'rows':_0x56ba10}:null;}})[_0x1e07('0x20')](respondWithResult(_0x38a972,null))[_0x1e07('0x44')](handleError(_0x38a972,null));}; \ No newline at end of file +var _0x4a0c=['findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','end','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll'];(function(_0x9e3d8c,_0x463816){var _0x2ad47e=function(_0x129f7f){while(--_0x129f7f){_0x9e3d8c['push'](_0x9e3d8c['shift']());}};_0x2ad47e(++_0x463816);}(_0x4a0c,0x1cc));var _0xc4a0=function(_0xbd6a7f,_0x2a4a6a){_0xbd6a7f=_0xbd6a7f-0x0;var _0xd66166=_0x4a0c[_0xbd6a7f];return _0xd66166;};'use strict';var pdf=require(_0xc4a0('0x0'));var emlformat=require(_0xc4a0('0x1'));var rimraf=require(_0xc4a0('0x2'));var zipdir=require(_0xc4a0('0x3'));var jsonpatch=require(_0xc4a0('0x4'));var rp=require(_0xc4a0('0x5'));var moment=require(_0xc4a0('0x6'));var BPromise=require(_0xc4a0('0x7'));var Mustache=require(_0xc4a0('0x8'));var util=require(_0xc4a0('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xc4a0('0xa'));var ejs=require(_0xc4a0('0xb'));var fs=require('fs');var _=require(_0xc4a0('0xc'));var squel=require(_0xc4a0('0xd'));var crypto=require('crypto');var jsforce=require(_0xc4a0('0xe'));var deskjs=require(_0xc4a0('0xf'));var toCsv=require(_0xc4a0('0xa'));var querystring=require(_0xc4a0('0x10'));var Papa=require(_0xc4a0('0x11'));var Redis=require(_0xc4a0('0x12'));var authService=require(_0xc4a0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc4a0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc4a0('0x15'))(_0xc4a0('0x16'));var utils=require('../../config/utils');var config=require(_0xc4a0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239a75,_0x381d61){_0x381d61=_0x381d61||0xcc;return function(_0x18df22){if(_0x18df22){return _0x239a75['sendStatus'](_0x381d61);}return _0x239a75['status'](_0x381d61)[_0xc4a0('0x18')]();};}function respondWithResult(_0x5ef7ad,_0x5f5877){_0x5f5877=_0x5f5877||0xc8;return function(_0x433cb5){if(_0x433cb5){return _0x5ef7ad[_0xc4a0('0x19')](_0x5f5877)[_0xc4a0('0x1a')](_0x433cb5);}};}function respondWithFilteredResult(_0xce9705,_0x582aa3){return function(_0x38a14b){if(_0x38a14b){var _0x4d9aab=_0x38a14b[_0xc4a0('0x1b')],_0x3a2ee4=_0x582aa3[_0xc4a0('0x1c')],_0x1942b5=_0x582aa3['offset']+_0x582aa3[_0xc4a0('0x1d')],_0x520f92;if(_0x1942b5>=_0x4d9aab){_0x1942b5=_0x4d9aab;_0x520f92=0xc8;}else{_0x520f92=0xce;}_0xce9705[_0xc4a0('0x19')](_0x520f92);return _0xce9705['set'](_0xc4a0('0x1e'),_0x3a2ee4+'-'+_0x1942b5+'/'+_0x4d9aab)[_0xc4a0('0x1a')](_0x38a14b);}return null;};}function patchUpdates(_0x50fd07){return function(_0x1bba3b){try{jsonpatch[_0xc4a0('0x1f')](_0x1bba3b,_0x50fd07,!![]);}catch(_0x2b37ca){return BPromise['reject'](_0x2b37ca);}return _0x1bba3b['save']();};}function saveUpdates(_0x301c41,_0x4085a0){return function(_0x2d7260){if(_0x2d7260){return _0x2d7260[_0xc4a0('0x20')](_0x301c41)[_0xc4a0('0x21')](function(_0x5ad01c){return _0x5ad01c;});}return null;};}function removeEntity(_0xcbd1ba,_0x56b4e5){return function(_0x3d008f){if(_0x3d008f){return _0x3d008f[_0xc4a0('0x22')]()[_0xc4a0('0x21')](function(){var _0x3e9436=_0x3d008f[_0xc4a0('0x23')]({'plain':!![]});var _0x16b13c='Companies';return db[_0xc4a0('0x24')][_0xc4a0('0x22')]({'where':{'type':_0x16b13c,'resourceId':_0x3e9436['id']}})['then'](function(){return _0x3d008f;});})['then'](function(){_0xcbd1ba[_0xc4a0('0x19')](0xcc)[_0xc4a0('0x18')]();});}};}function handleEntityNotFound(_0x4177c9,_0x280836){return function(_0x33aa87){if(!_0x33aa87){_0x4177c9[_0xc4a0('0x25')](0x194);}return _0x33aa87;};}function handleError(_0x4a5d0a,_0x4dd2a3){_0x4dd2a3=_0x4dd2a3||0x1f4;return function(_0x22dd72){logger[_0xc4a0('0x26')](_0x22dd72[_0xc4a0('0x27')]);if(_0x22dd72[_0xc4a0('0x28')]){delete _0x22dd72[_0xc4a0('0x28')];}_0x4a5d0a[_0xc4a0('0x19')](_0x4dd2a3)[_0xc4a0('0x29')](_0x22dd72);};}exports[_0xc4a0('0x2a')]=function(_0x5cea1d,_0x4a0b5c){var _0xf6ac70={},_0x2bd692={},_0x3d59c1={'count':0x0,'rows':[]};return db[_0xc4a0('0x2b')][_0xc4a0('0x2c')]()[_0xc4a0('0x21')](function(_0x4f62c3){_0x2bd692[_0xc4a0('0x2d')]=_[_0xc4a0('0x2e')](_0x4f62c3);_0x2bd692[_0xc4a0('0x2f')]=_[_0xc4a0('0x2e')](_0x5cea1d[_0xc4a0('0x2f')]);_0x2bd692[_0xc4a0('0x30')]=_[_0xc4a0('0x31')](_0x2bd692[_0xc4a0('0x2d')],_0x2bd692[_0xc4a0('0x2f')]);_0xf6ac70[_0xc4a0('0x32')]=_[_0xc4a0('0x31')](_0x2bd692[_0xc4a0('0x2d')],qs[_0xc4a0('0x33')](_0x5cea1d[_0xc4a0('0x2f')]['fields']));_0xf6ac70[_0xc4a0('0x32')]=_0xf6ac70[_0xc4a0('0x32')][_0xc4a0('0x34')]?_0xf6ac70['attributes']:_0x2bd692[_0xc4a0('0x2d')];if(!_0x5cea1d['query'][_0xc4a0('0x35')](_0xc4a0('0x36'))){_0xf6ac70[_0xc4a0('0x1d')]=qs['limit'](_0x5cea1d[_0xc4a0('0x2f')]['limit']);_0xf6ac70['offset']=qs[_0xc4a0('0x1c')](_0x5cea1d[_0xc4a0('0x2f')][_0xc4a0('0x1c')]);}_0xf6ac70['order']=qs['sort'](_0x5cea1d[_0xc4a0('0x2f')][_0xc4a0('0x37')]);_0xf6ac70[_0xc4a0('0x38')]=qs[_0xc4a0('0x30')](_[_0xc4a0('0x39')](_0x5cea1d[_0xc4a0('0x2f')],_0x2bd692[_0xc4a0('0x30')]),_0x4f62c3);if(_0x5cea1d[_0xc4a0('0x2f')][_0xc4a0('0x3a')]){_0xf6ac70[_0xc4a0('0x38')]=_[_0xc4a0('0x3b')](_0xf6ac70[_0xc4a0('0x38')],{'$or':_['map'](_0xf6ac70['attributes'],function(_0xae913e){var _0x5999eb={};_0x5999eb[_0xae913e]={'$like':'%'+_0x5cea1d[_0xc4a0('0x2f')][_0xc4a0('0x3a')]+'%'};return _0x5999eb;})});}_0xf6ac70=_['merge']({},_0xf6ac70,_0x5cea1d[_0xc4a0('0x3c')]);var _0xf9397b={'where':_0xf6ac70[_0xc4a0('0x38')]};return db['CmCompany'][_0xc4a0('0x1b')](_0xf9397b)[_0xc4a0('0x21')](function(_0x1a3f22){_0x3d59c1[_0xc4a0('0x1b')]=_0x1a3f22;if(_0x5cea1d[_0xc4a0('0x2f')][_0xc4a0('0x3d')]){_0xf6ac70['include']=[{'all':!![]}];}return db[_0xc4a0('0x2b')][_0xc4a0('0x3e')](_0xf6ac70);})[_0xc4a0('0x21')](function(_0x3d4a13){_0x3d59c1[_0xc4a0('0x3f')]=_0x3d4a13;return _0x3d59c1;})[_0xc4a0('0x21')](respondWithFilteredResult(_0x4a0b5c,_0xf6ac70))[_0xc4a0('0x40')](handleError(_0x4a0b5c,null));})['catch'](handleError(_0x4a0b5c,null));};exports[_0xc4a0('0x41')]=function(_0x4fb8db,_0x2b97fd){var _0x5b4331={'raw':![],'where':{'id':_0x4fb8db[_0xc4a0('0x42')]['id']}},_0x865f24={};_0x865f24[_0xc4a0('0x2d')]=_[_0xc4a0('0x2e')](db['CmCompany'][_0xc4a0('0x43')]);_0x865f24['query']=_[_0xc4a0('0x2e')](_0x4fb8db['query']);_0x865f24[_0xc4a0('0x30')]=_[_0xc4a0('0x31')](_0x865f24[_0xc4a0('0x2d')],_0x865f24['query']);_0x5b4331[_0xc4a0('0x32')]=_['intersection'](_0x865f24[_0xc4a0('0x2d')],qs['fields'](_0x4fb8db['query']['fields']));_0x5b4331['attributes']=_0x5b4331[_0xc4a0('0x32')][_0xc4a0('0x34')]?_0x5b4331[_0xc4a0('0x32')]:_0x865f24[_0xc4a0('0x2d')];if(_0x4fb8db['query'][_0xc4a0('0x3d')]){_0x5b4331[_0xc4a0('0x44')]=[{'all':!![]}];}_0x5b4331=_[_0xc4a0('0x3b')]({},_0x5b4331,_0x4fb8db[_0xc4a0('0x3c')]);return db[_0xc4a0('0x2b')][_0xc4a0('0x45')](_0x5b4331)[_0xc4a0('0x21')](handleEntityNotFound(_0x2b97fd,null))[_0xc4a0('0x21')](respondWithResult(_0x2b97fd,null))[_0xc4a0('0x40')](handleError(_0x2b97fd,null));};exports['create']=function(_0x356b17,_0x2547d6){return db[_0xc4a0('0x2b')][_0xc4a0('0x46')](_0x356b17[_0xc4a0('0x47')],{})[_0xc4a0('0x21')](function(_0x550a5a){var _0x3ec15c=_0x356b17[_0xc4a0('0x48')][_0xc4a0('0x23')]({'plain':!![]});if(!_0x3ec15c)throw new Error(_0xc4a0('0x49'));if(_0x3ec15c[_0xc4a0('0x4a')]===_0xc4a0('0x48')){var _0x530001=_0x550a5a[_0xc4a0('0x23')]({'plain':!![]});var _0x5e9ec6=_0xc4a0('0x4b');return db[_0xc4a0('0x4c')]['find']({'where':{'name':_0x5e9ec6,'userProfileId':_0x3ec15c[_0xc4a0('0x4d')]},'raw':!![]})['then'](function(_0xa7da3d){if(_0xa7da3d&&_0xa7da3d[_0xc4a0('0x4e')]===0x0){return db['UserProfileResource'][_0xc4a0('0x46')]({'name':_0x530001['name'],'resourceId':_0x530001['id'],'type':_0xa7da3d[_0xc4a0('0x28')],'sectionId':_0xa7da3d['id']},{})['then'](function(){return _0x550a5a;});}else{return _0x550a5a;}})[_0xc4a0('0x40')](function(_0x334abf){logger[_0xc4a0('0x26')](_0xc4a0('0x4f'),_0x334abf);throw _0x334abf;});}return _0x550a5a;})[_0xc4a0('0x21')](respondWithResult(_0x2547d6,0xc9))[_0xc4a0('0x40')](handleError(_0x2547d6,null));};exports[_0xc4a0('0x20')]=function(_0x135698,_0x16f4b3){if(_0x135698[_0xc4a0('0x47')]['id']){delete _0x135698[_0xc4a0('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x135698[_0xc4a0('0x42')]['id']}})[_0xc4a0('0x21')](handleEntityNotFound(_0x16f4b3,null))['then'](saveUpdates(_0x135698[_0xc4a0('0x47')],null))[_0xc4a0('0x21')](respondWithResult(_0x16f4b3,null))['catch'](handleError(_0x16f4b3,null));};exports[_0xc4a0('0x22')]=function(_0xba8075,_0x510fb0){return db[_0xc4a0('0x2b')][_0xc4a0('0x45')]({'where':{'id':_0xba8075[_0xc4a0('0x42')]['id']}})[_0xc4a0('0x21')](handleEntityNotFound(_0x510fb0,null))['then'](removeEntity(_0x510fb0,null))[_0xc4a0('0x40')](handleError(_0x510fb0,null));};exports[_0xc4a0('0x2c')]=function(_0xf23e49,_0x570f4f){return db[_0xc4a0('0x2b')]['describe']()[_0xc4a0('0x21')](respondWithResult(_0x570f4f,null))[_0xc4a0('0x40')](handleError(_0x570f4f,null));};exports[_0xc4a0('0x50')]=function(_0x429f9a,_0x4740bc,_0x498696){return db['CmContact']['find']({'where':{'id':_0x429f9a[_0xc4a0('0x42')]['id']}})[_0xc4a0('0x21')](handleEntityNotFound(_0x4740bc,null))[_0xc4a0('0x21')](function(_0x22b1f6){if(_0x22b1f6){return _0x22b1f6[_0xc4a0('0x50')](_0x429f9a['body'][_0xc4a0('0x51')],_[_0xc4a0('0x52')](_0x429f9a[_0xc4a0('0x47')],[_0xc4a0('0x51'),'id'])||{});}})[_0xc4a0('0x21')](respondWithResult(_0x4740bc,null))[_0xc4a0('0x40')](handleError(_0x4740bc,null));};exports[_0xc4a0('0x53')]=function(_0x3216cf,_0x4f9e48,_0x56032a){var _0x2bc569={};var _0x59d0f0={};var _0x5b14ad;var _0x4f49dd;return db[_0xc4a0('0x2b')][_0xc4a0('0x54')]({'where':{'id':_0x3216cf[_0xc4a0('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f9e48,null))[_0xc4a0('0x21')](function(_0x5d8a64){if(_0x5d8a64){_0x5b14ad=_0x5d8a64;_0x59d0f0['model']=_[_0xc4a0('0x2e')](db[_0xc4a0('0x55')][_0xc4a0('0x43')]);_0x59d0f0[_0xc4a0('0x2f')]=_['keys'](_0x3216cf[_0xc4a0('0x2f')]);_0x59d0f0[_0xc4a0('0x30')]=_[_0xc4a0('0x31')](_0x59d0f0['model'],_0x59d0f0[_0xc4a0('0x2f')]);_0x2bc569[_0xc4a0('0x32')]=_[_0xc4a0('0x31')](_0x59d0f0[_0xc4a0('0x2d')],qs[_0xc4a0('0x33')](_0x3216cf['query']['fields']));_0x2bc569[_0xc4a0('0x32')]=_0x2bc569[_0xc4a0('0x32')][_0xc4a0('0x34')]?_0x2bc569[_0xc4a0('0x32')]:_0x59d0f0[_0xc4a0('0x2d')];_0x2bc569['order']=qs[_0xc4a0('0x37')](_0x3216cf[_0xc4a0('0x2f')][_0xc4a0('0x37')]);_0x2bc569['where']=qs[_0xc4a0('0x30')](_[_0xc4a0('0x39')](_0x3216cf[_0xc4a0('0x2f')],_0x59d0f0[_0xc4a0('0x30')]));if(_0x3216cf['query']['filter']){_0x2bc569[_0xc4a0('0x38')]=_[_0xc4a0('0x3b')](_0x2bc569[_0xc4a0('0x38')],{'$or':_[_0xc4a0('0x56')](_0x2bc569[_0xc4a0('0x32')],function(_0x210d6a){var _0xf6f949={};_0xf6f949[_0x210d6a]={'$like':'%'+_0x3216cf[_0xc4a0('0x2f')][_0xc4a0('0x3a')]+'%'};return _0xf6f949;})});}_0x2bc569=_[_0xc4a0('0x3b')]({},_0x2bc569,_0x3216cf[_0xc4a0('0x3c')]);return _0x5b14ad[_0xc4a0('0x53')](_0x2bc569);}})[_0xc4a0('0x21')](function(_0x53312d){if(_0x53312d){_0x4f49dd=_0x53312d[_0xc4a0('0x34')];if(!_0x3216cf[_0xc4a0('0x2f')][_0xc4a0('0x35')](_0xc4a0('0x36'))){_0x2bc569[_0xc4a0('0x1d')]=qs['limit'](_0x3216cf[_0xc4a0('0x2f')][_0xc4a0('0x1d')]);_0x2bc569[_0xc4a0('0x1c')]=qs['offset'](_0x3216cf[_0xc4a0('0x2f')]['offset']);}return _0x5b14ad[_0xc4a0('0x53')](_0x2bc569);}})['then'](function(_0x54ab0d){if(_0x54ab0d){return _0x54ab0d?{'count':_0x4f49dd,'rows':_0x54ab0d}:null;}})[_0xc4a0('0x21')](respondWithResult(_0x4f9e48,null))[_0xc4a0('0x40')](handleError(_0x4f9e48,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 982713f..387b8f7 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 _0x97af=['util','api','moment','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x97af,0xfb));var _0xf97a=function(_0x3abd07,_0x5b9ca4){_0x3abd07=_0x3abd07-0x0;var _0x34a5fa=_0x97af[_0x3abd07];return _0x34a5fa;};'use strict';var _=require(_0xf97a('0x0'));var util=require(_0xf97a('0x1'));var logger=require('../../config/logger')(_0xf97a('0x2'));var moment=require(_0xf97a('0x3'));var BPromise=require('bluebird');var rp=require(_0xf97a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf97a('0x5'));var config=require(_0xf97a('0x6'));var attributes=require(_0xf97a('0x7'));module[_0xf97a('0x8')]=function(_0x5c10d1,_0x17e9ab){return _0x5c10d1[_0xf97a('0x9')](_0xf97a('0xa'),attributes,{'tableName':_0xf97a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08a0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash','util'];(function(_0x59dc86,_0x34812a){var _0x37c79c=function(_0x2e838c){while(--_0x2e838c){_0x59dc86['push'](_0x59dc86['shift']());}};_0x37c79c(++_0x34812a);}(_0x08a0,0x9a));var _0x008a=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x08a0[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x008a('0x0'));var util=require(_0x008a('0x1'));var logger=require(_0x008a('0x2'))(_0x008a('0x3'));var moment=require(_0x008a('0x4'));var BPromise=require(_0x008a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x008a('0x6'));var rimraf=require(_0x008a('0x7'));var config=require(_0x008a('0x8'));var attributes=require('./cmCompany.attributes');module[_0x008a('0x9')]=function(_0x288789,_0x203736){return _0x288789[_0x008a('0xa')](_0x008a('0xb'),attributes,{'tableName':_0x008a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 674b4cc..339518f 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 _0xb1e9=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb1e9,0xc0));var _0x9b1e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb1e9[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x9b1e('0x0'));var moment=require(_0x9b1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b1e('0x2'));var fs=require('fs');var Redis=require(_0x9b1e('0x3'));var db=require(_0x9b1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b1e('0x5'))(_0x9b1e('0x6'));var config=require(_0x9b1e('0x7'));var jayson=require(_0x9b1e('0x8'));var client=jayson[_0x9b1e('0x9')][_0x9b1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e36f6,_0x5e1584,_0xed85d3){return new BPromise(function(_0x4b57bb,_0x4a3bbb){return client['request'](_0x2e36f6,_0xed85d3)[_0x9b1e('0xb')](function(_0x345591){logger['info'](_0x9b1e('0xc'),_0x5e1584,_0x9b1e('0xd'));logger[_0x9b1e('0xe')](_0x9b1e('0xf'),_0x5e1584,'request\x20sent',JSON['stringify'](_0x345591));if(_0x345591[_0x9b1e('0x10')]){if(_0x345591[_0x9b1e('0x10')][_0x9b1e('0x11')]===0x1f4){logger[_0x9b1e('0x10')](_0x9b1e('0xc'),_0x5e1584,_0x345591[_0x9b1e('0x10')][_0x9b1e('0x12')]);return _0x4a3bbb(_0x345591[_0x9b1e('0x10')]['message']);}logger[_0x9b1e('0x10')](_0x9b1e('0xc'),_0x5e1584,_0x345591['error']['message']);return _0x4b57bb(_0x345591[_0x9b1e('0x10')][_0x9b1e('0x12')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x5e1584,_0x9b1e('0xd'));_0x4b57bb(_0x345591[_0x9b1e('0x13')][_0x9b1e('0x12')]);}})[_0x9b1e('0x14')](function(_0x1618c1){logger[_0x9b1e('0x10')](_0x9b1e('0xc'),_0x5e1584,_0x1618c1);_0x4a3bbb(_0x1618c1);});});} \ No newline at end of file +var _0x901d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','error','code','CmCompany,\x20%s,\x20%s','message','result','catch'];(function(_0x56a756,_0xd33ea2){var _0x475344=function(_0x2c1419){while(--_0x2c1419){_0x56a756['push'](_0x56a756['shift']());}};_0x475344(++_0xd33ea2);}(_0x901d,0xb0));var _0xd901=function(_0x2311b1,_0x2ec25d){_0x2311b1=_0x2311b1-0x0;var _0x1ae21c=_0x901d[_0x2311b1];return _0x1ae21c;};'use strict';var _=require(_0xd901('0x0'));var util=require(_0xd901('0x1'));var moment=require(_0xd901('0x2'));var BPromise=require(_0xd901('0x3'));var rs=require(_0xd901('0x4'));var fs=require('fs');var Redis=require(_0xd901('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd901('0x6'));var logger=require(_0xd901('0x7'))(_0xd901('0x8'));var config=require(_0xd901('0x9'));var jayson=require(_0xd901('0xa'));var client=jayson[_0xd901('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2b18,_0x3a228b,_0x52e7c8){return new BPromise(function(_0x536580,_0x36778c){return client['request'](_0x5a2b18,_0x52e7c8)[_0xd901('0xc')](function(_0x2e1741){logger[_0xd901('0xd')]('CmCompany,\x20%s,\x20%s',_0x3a228b,_0xd901('0xe'));logger[_0xd901('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3a228b,_0xd901('0xe'),JSON['stringify'](_0x2e1741));if(_0x2e1741[_0xd901('0x10')]){if(_0x2e1741[_0xd901('0x10')][_0xd901('0x11')]===0x1f4){logger['error'](_0xd901('0x12'),_0x3a228b,_0x2e1741[_0xd901('0x10')]['message']);return _0x36778c(_0x2e1741[_0xd901('0x10')][_0xd901('0x13')]);}logger[_0xd901('0x10')]('CmCompany,\x20%s,\x20%s',_0x3a228b,_0x2e1741['error'][_0xd901('0x13')]);return _0x536580(_0x2e1741[_0xd901('0x10')][_0xd901('0x13')]);}else{logger[_0xd901('0xd')]('CmCompany,\x20%s,\x20%s',_0x3a228b,'request\x20sent');_0x536580(_0x2e1741[_0xd901('0x14')][_0xd901('0x13')]);}})[_0xd901('0x15')](function(_0xf96f9c){logger[_0xd901('0x10')](_0xd901('0x12'),_0x3a228b,_0xf96f9c);_0x36778c(_0xf96f9c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9068c68..b6c9db0 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 _0x008c=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','create','addContacts','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x177f2f,_0x1b814e){var _0x28a5c3=function(_0x3a3333){while(--_0x3a3333){_0x177f2f['push'](_0x177f2f['shift']());}};_0x28a5c3(++_0x1b814e);}(_0x008c,0x188));var _0xc008=function(_0x7b8a87,_0x2f2523){_0x7b8a87=_0x7b8a87-0x0;var _0x2131a1=_0x008c[_0x7b8a87];return _0x2131a1;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['getContacts']);router['post']('/',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0xf'),auth[_0xc008('0xa')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x13')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('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 1914ae2..656858b 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 _0x5f7b=['lodash','sequelize','STRING','INTEGER','UNSIGNED'];(function(_0x34e7d4,_0x11a2c8){var _0x358daf=function(_0x5560ad){while(--_0x5560ad){_0x34e7d4['push'](_0x34e7d4['shift']());}};_0x358daf(++_0x11a2c8);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x5f7b[_0x3070dc];return _0x431489;};'use strict';var _=require(_0xb5f7('0x0'));var Sequelize=require(_0xb5f7('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xb5f7('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb5f7('0x2')]},'street':{'type':Sequelize[_0xb5f7('0x2')]},'postalCode':{'type':Sequelize[_0xb5f7('0x2')]},'city':{'type':Sequelize[_0xb5f7('0x2')]},'country':{'type':Sequelize[_0xb5f7('0x2')]},'dateOfBirth':{'type':Sequelize[_0xb5f7('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xb5f7('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xb5f7('0x2')]},'email':{'type':Sequelize[_0xb5f7('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xb5f7('0x2')]},'fb_data':{'type':Sequelize[_0xb5f7('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xb5f7('0x2')]},'teams':{'type':Sequelize[_0xb5f7('0x2')]},'viber':{'type':Sequelize[_0xb5f7('0x2')]},'line':{'type':Sequelize[_0xb5f7('0x2')]},'wechat':{'type':Sequelize[_0xb5f7('0x2')]},'telegram':{'type':Sequelize[_0xb5f7('0x2')]},'UserId':{'type':Sequelize[_0xb5f7('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb5f7('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xb5f7('0x2')]},'utcOffset':{'type':Sequelize[_0xb5f7('0x3')]}}; \ No newline at end of file +var _0xbd84=['NOW','sequelize','exports','STRING','INTEGER','UNSIGNED'];(function(_0x1dd19f,_0x2648e6){var _0x437ac2=function(_0x37accd){while(--_0x37accd){_0x1dd19f['push'](_0x1dd19f['shift']());}};_0x437ac2(++_0x2648e6);}(_0xbd84,0xb5));var _0x4bd8=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xbd84[_0x243b59];return _0x3e1676;};'use strict';var _=require('lodash');var Sequelize=require(_0x4bd8('0x0'));module[_0x4bd8('0x1')]={'firstName':{'type':Sequelize[_0x4bd8('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x4bd8('0x2')]},'street':{'type':Sequelize[_0x4bd8('0x2')]},'postalCode':{'type':Sequelize[_0x4bd8('0x2')]},'city':{'type':Sequelize[_0x4bd8('0x2')]},'country':{'type':Sequelize[_0x4bd8('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x4bd8('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x4bd8('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x4bd8('0x2')]},'facebook':{'type':Sequelize[_0x4bd8('0x2')]},'fb_data':{'type':Sequelize[_0x4bd8('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x4bd8('0x2')]},'viber':{'type':Sequelize[_0x4bd8('0x2')]},'line':{'type':Sequelize[_0x4bd8('0x2')]},'wechat':{'type':Sequelize[_0x4bd8('0x2')]},'telegram':{'type':Sequelize[_0x4bd8('0x2')]},'UserId':{'type':Sequelize[_0x4bd8('0x3')]},'priority':{'type':Sequelize[_0x4bd8('0x3')](0x2)[_0x4bd8('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x4bd8('0x5')]},'dialTimezone':{'type':Sequelize[_0x4bd8('0x2')]},'utcOffset':{'type':Sequelize[_0x4bd8('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 90715d6..cda53e4 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 _0xbd2d=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','./cmContact.socket','register','sendStatus','status','end','json','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','length','cf_','CmCustomField','findOne','trimStart','all','fieldType','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','split','map','union','User','uc.UserId\x20=\x20?','datetime','castTo','buildExpression','text','start','Contact','push','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','merge','CmContact','c.mobile','c.fax','c.email','c.ListId','TagIds','Tags','rows','catch','params','describe','tags','startsWith','displayName','alias','custom','values','columnName','body','findAll','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','omit','format','cf_%d','table','cm_contacts','setFields','toParam','phone','getTags','rawAttributes','pick','setTags','ids','ContactId','options','includeAll','include','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','root','file','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','parse','meta','binding','No\x20phone\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','exit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x365e80,_0x1c679a){var _0x2f0080=function(_0x328641){while(--_0x328641){_0x365e80['push'](_0x365e80['shift']());}};_0x2f0080(++_0x1c679a);}(_0xbd2d,0x1c5));var _0xdbd2=function(_0x385b42,_0x2a2fa7){_0x385b42=_0x385b42-0x0;var _0x2846af=_0xbd2d[_0x385b42];return _0x2846af;};'use strict';var pdf=require(_0xdbd2('0x0'));var emlformat=require(_0xdbd2('0x1'));var rimraf=require(_0xdbd2('0x2'));var zipdir=require(_0xdbd2('0x3'));var jsonpatch=require(_0xdbd2('0x4'));var rp=require(_0xdbd2('0x5'));var moment=require(_0xdbd2('0x6'));var BPromise=require(_0xdbd2('0x7'));var Mustache=require(_0xdbd2('0x8'));var util=require(_0xdbd2('0x9'));var path=require(_0xdbd2('0xa'));var sox=require(_0xdbd2('0xb'));var csv=require(_0xdbd2('0xc'));var ejs=require(_0xdbd2('0xd'));var fs=require('fs');var _=require(_0xdbd2('0xe'));var squel=require('squel');var crypto=require(_0xdbd2('0xf'));var jsforce=require(_0xdbd2('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdbd2('0x11'));var Papa=require(_0xdbd2('0x12'));var Redis=require('ioredis');var authService=require(_0xdbd2('0x13'));var qs=require(_0xdbd2('0x14'));var as=require(_0xdbd2('0x15'));var hardwareService=require(_0xdbd2('0x16'));var logger=require(_0xdbd2('0x17'))(_0xdbd2('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xdbd2('0x19'))['db'];config[_0xdbd2('0x1a')]=_['defaults'](config[_0xdbd2('0x1a')],{'host':_0xdbd2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbd2('0x1a')]));require(_0xdbd2('0x1c'))[_0xdbd2('0x1d')](socket);function respondWithStatusCode(_0x5e6bdb,_0x3da13c){_0x3da13c=_0x3da13c||0xcc;return function(_0x1ca603){if(_0x1ca603){return _0x5e6bdb[_0xdbd2('0x1e')](_0x3da13c);}return _0x5e6bdb[_0xdbd2('0x1f')](_0x3da13c)[_0xdbd2('0x20')]();};}function respondWithResult(_0xe5ae1a,_0x563c9c){_0x563c9c=_0x563c9c||0xc8;return function(_0x36a62b){if(_0x36a62b){return _0xe5ae1a[_0xdbd2('0x1f')](_0x563c9c)[_0xdbd2('0x21')](_0x36a62b);}};}function respondWithFilteredResult(_0x1b6338,_0x22a93a){return function(_0x2002a4){if(_0x2002a4){var _0x5895da=_0x2002a4[_0xdbd2('0x22')],_0x24594d=_0x22a93a['offset'],_0x2ac99b=_0x22a93a['offset']+_0x22a93a['limit'],_0x28e070;if(_0x2ac99b>=_0x5895da){_0x2ac99b=_0x5895da;_0x28e070=0xc8;}else{_0x28e070=0xce;}_0x1b6338[_0xdbd2('0x1f')](_0x28e070);return _0x1b6338[_0xdbd2('0x23')](_0xdbd2('0x24'),_0x24594d+'-'+_0x2ac99b+'/'+_0x5895da)[_0xdbd2('0x21')](_0x2002a4);}return null;};}function patchUpdates(_0x265203){return function(_0x27ec6b){try{jsonpatch[_0xdbd2('0x25')](_0x27ec6b,_0x265203,!![]);}catch(_0x35beb0){return BPromise['reject'](_0x35beb0);}return _0x27ec6b[_0xdbd2('0x26')]();};}function saveUpdates(_0x3eb695,_0x17bc69){return function(_0x2a6774){if(_0x2a6774){return _0x2a6774[_0xdbd2('0x27')](_0x3eb695)[_0xdbd2('0x28')](function(_0x555538){return _0x555538;});}return null;};}function removeEntity(_0x50bddc,_0x11d108){return function(_0x44d7ce){if(_0x44d7ce){return _0x44d7ce[_0xdbd2('0x29')]()[_0xdbd2('0x28')](function(){_0x50bddc['status'](0xcc)[_0xdbd2('0x20')]();});}};}function handleEntityNotFound(_0x249a58,_0x2df97e){return function(_0x566086){if(!_0x566086){_0x249a58[_0xdbd2('0x1e')](0x194);}return _0x566086;};}function handleError(_0x27e9ee,_0x4bd26b){_0x4bd26b=_0x4bd26b||0x1f4;return function(_0x5a3b4d){logger[_0xdbd2('0x2a')](_0x5a3b4d[_0xdbd2('0x2b')]);if(_0x5a3b4d[_0xdbd2('0x2c')]){delete _0x5a3b4d[_0xdbd2('0x2c')];}_0x27e9ee['status'](_0x4bd26b)[_0xdbd2('0x2d')](_0x5a3b4d);};}exports[_0xdbd2('0x2e')]=function(_0xa0c97d,_0x4d28be){var _0x377550={},_0xa7fcd6={},_0x102704={'count':0x0,'rows':[]};return db['CmContact']['describe']()['then'](function(_0x6f6517){var _0x1d6d58=[];for(var _0x219a2a=0x0;_0x219a2a0x1){_0x118bb9['or'](_0xdbd2('0x6c'),qs[_0xdbd2('0x6d')](_0x431a3d),null);}else{if(qs['isNumeric'](_0x431a3d)){_0x118bb9['or']('c.id\x20LIKE\x20?',_0x431a3d+'%');_0x118bb9['or'](_0xdbd2('0x6e'),_0x431a3d+'%');_0x118bb9['or'](_0xdbd2('0x6f'),_0x431a3d+'%');_0x118bb9['or'](_0xdbd2('0x70'),_0x431a3d+'%');}else if(qs[_0xdbd2('0x71')](_0x431a3d)){_0x118bb9['or'](_0xdbd2('0x72'),_0x431a3d+'%');}else{_0x118bb9['or']('c.firstName\x20LIKE\x20?','%'+_0x431a3d+'%');_0x118bb9['or']('c.lastName\x20LIKE\x20?','%'+_0x431a3d+'%');_0x118bb9['or'](_0xdbd2('0x72'),'%'+_0x431a3d+'%');}}}}_0x1e1d62[_0xdbd2('0x4d')](_0x118bb9);_0x1e1d62[_0xdbd2('0x73')](_0xdbd2('0x74'));var _0x572390={'type':db['Sequelize'][_0xdbd2('0x75')][_0xdbd2('0x76')],'raw':!![]};var _0x395e0e=_0x1e1d62[_0xdbd2('0x77')]()[_0xdbd2('0x44')]('c.id');if(_0x377550[_0xdbd2('0x42')]){_0x377550[_0xdbd2('0x42')][_0xdbd2('0x63')](function(_0x3ac3d7){_0x1e1d62[_0xdbd2('0x42')]('c.'+_0x3ac3d7[0x0],_0x3ac3d7[0x1]===_0xdbd2('0x78')?![]:!![]);});}if(!_[_0xdbd2('0x62')](_0x23168e)){_0x1e1d62[_0xdbd2('0x79')](_0x44a379);_0x395e0e[_0xdbd2('0x4d')](_0xdbd2('0x7a'),_0x23168e);}BPromise['resolve']()[_0xdbd2('0x28')](function(){if(_0x387380&&!_['some'](_0x387380[_0xdbd2('0x52')],[_0xdbd2('0x44'),'User'])){return _0xa0c97d[_0xdbd2('0x7b')][_0xdbd2('0x7c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c37ad){if(_[_0xdbd2('0x62')](_0x2c37ad)){_0x395e0e['where'](_0xdbd2('0x7d'));_0x1e1d62['where'](_0xdbd2('0x7d'));}else{_0x395e0e[_0xdbd2('0x4d')](_0xdbd2('0x65'),_['map'](_0x2c37ad,'id'));_0x1e1d62['where'](_0xdbd2('0x65'),_[_0xdbd2('0x57')](_0x2c37ad,'id'));}});}else{return;}})[_0xdbd2('0x28')](function(){db[_0xdbd2('0x7e')]['query'](_0x395e0e[_0xdbd2('0x7f')](),_0x572390)[_0xdbd2('0x28')](function(_0x1bfdbb){_0x102704[_0xdbd2('0x22')]=_0x1bfdbb['length'];if(_0x102704[_0xdbd2('0x22')]===0x0)return[];return db[_0xdbd2('0x7e')]['query'](_0x1a11ae['toString'](),_0x572390);})[_0xdbd2('0x28')](function(_0xd966ca){_0x42582e=_['keyBy'](_0xd966ca,'id');_0x572390=_[_0xdbd2('0x80')](_0x572390,{'model':db[_0xdbd2('0x81')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa0c97d[_0xdbd2('0x38')][_0xdbd2('0x3d')]){_0x377550[_0xdbd2('0x3c')][_0xdbd2('0x63')](function(_0x4d613c){_0x1e1d62[_0xdbd2('0x44')]('c.'+_0x4d613c);});}else{_0x1e1d62[_0xdbd2('0x44')](_0xdbd2('0x74'));_0x1e1d62[_0xdbd2('0x44')]('c.firstName');_0x1e1d62['field']('c.lastName');_0x1e1d62[_0xdbd2('0x44')]('c.phone');_0x1e1d62['field'](_0xdbd2('0x82'));_0x1e1d62[_0xdbd2('0x44')](_0xdbd2('0x83'));_0x1e1d62[_0xdbd2('0x44')](_0xdbd2('0x84'));_0x1e1d62['field'](_0xdbd2('0x85'));_0x1e1d62['field']('c.deletedAt');_0x1e1d62['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xdbd2('0x86'));}if(_0x377550[_0xdbd2('0x40')])_0x1e1d62[_0xdbd2('0x40')](_0x377550[_0xdbd2('0x40')]);if(_0x377550['offset'])_0x1e1d62[_0xdbd2('0x41')](_0x377550[_0xdbd2('0x41')]);return db['sequelize'][_0xdbd2('0x38')](_0x1e1d62[_0xdbd2('0x7f')](),_0x572390);})[_0xdbd2('0x28')](function(_0x4b1a28){_0x4b1a28['forEach'](function(_0x477600){if(_0x477600['TagIds']){_0x477600[_0xdbd2('0x87')]=[];_0x477600[_0xdbd2('0x86')]['split'](',')[_0xdbd2('0x63')](function(_0xbf830a){_0x477600[_0xdbd2('0x87')][_0xdbd2('0x61')](_0x42582e[_0xbf830a]);});}delete _0x477600['TagIds'];});_0x102704[_0xdbd2('0x88')]=_0x4b1a28;return _0x102704;})[_0xdbd2('0x28')](respondWithFilteredResult(_0x4d28be,_0x377550));});})[_0xdbd2('0x89')](handleError(_0x4d28be,null));};exports[_0xdbd2('0x29')]=function(_0x5dbf7a,_0x3ce068){return db[_0xdbd2('0x81')][_0xdbd2('0x53')]({'where':{'id':_0x5dbf7a[_0xdbd2('0x8a')]['id']}})[_0xdbd2('0x28')](handleEntityNotFound(_0x3ce068,null))[_0xdbd2('0x28')](removeEntity(_0x3ce068,null))[_0xdbd2('0x89')](handleError(_0x3ce068,null));};exports[_0xdbd2('0x8b')]=function(_0x555781,_0x5353bf){return db['CmContact'][_0xdbd2('0x8b')]()[_0xdbd2('0x28')](function(_0x1203bb){delete _0x1203bb[_0xdbd2('0x8c')];for(var _0x3cb1af=0x0;_0x3cb1af=_0x2611f4){_0x27bf3b=_0x2611f4;_0x53d1bc=0xc8;}else{_0x53d1bc=0xce;}_0xd6b84d[_0xbd4b('0x18')](_0x53d1bc);return _0xd6b84d[_0xbd4b('0x1d')](_0xbd4b('0x1e'),_0x225101+'-'+_0x27bf3b+'/'+_0x2611f4)['json'](_0x18f498);}return null;};}function patchUpdates(_0x4bf2af){return function(_0x324c8a){try{jsonpatch[_0xbd4b('0x1f')](_0x324c8a,_0x4bf2af,!![]);}catch(_0x37b2a2){return BPromise[_0xbd4b('0x20')](_0x37b2a2);}return _0x324c8a[_0xbd4b('0x21')]();};}function saveUpdates(_0x120212,_0x18e299){return function(_0x1aa0f5){if(_0x1aa0f5){return _0x1aa0f5[_0xbd4b('0x22')](_0x120212)[_0xbd4b('0x23')](function(_0x6ee0d9){return _0x6ee0d9;});}return null;};}function removeEntity(_0x1eb8ad,_0x2fbfe3){return function(_0x5e14cb){if(_0x5e14cb){return _0x5e14cb['destroy']()[_0xbd4b('0x23')](function(){_0x1eb8ad[_0xbd4b('0x18')](0xcc)[_0xbd4b('0x24')]();});}};}function handleEntityNotFound(_0x3e7fc3,_0x256a8b){return function(_0x42af66){if(!_0x42af66){_0x3e7fc3['sendStatus'](0x194);}return _0x42af66;};}function handleError(_0x20ccbb,_0x5237c2){_0x5237c2=_0x5237c2||0x1f4;return function(_0x1f4d53){logger['error'](_0x1f4d53['stack']);if(_0x1f4d53[_0xbd4b('0x25')]){delete _0x1f4d53['name'];}_0x20ccbb[_0xbd4b('0x18')](_0x5237c2)[_0xbd4b('0x26')](_0x1f4d53);};}exports[_0xbd4b('0x27')]=function(_0x42d5bd,_0x5b7d12){var _0x217101={},_0x285796={},_0x5d261a={'count':0x0,'rows':[]};return db[_0xbd4b('0x28')]['describe']()[_0xbd4b('0x23')](function(_0x1cf937){var _0x5c3b3c=[];for(var _0x2c5403=0x0;_0x2c54030x1){_0x1ca3b0['or'](_0xbd4b('0x65'),qs[_0xbd4b('0x66')](_0x5c8872),null);}else{if(qs[_0xbd4b('0x67')](_0x5c8872)){_0x1ca3b0['or']('c.id\x20LIKE\x20?',_0x5c8872+'%');_0x1ca3b0['or']('c.phone\x20LIKE\x20?',_0x5c8872+'%');_0x1ca3b0['or'](_0xbd4b('0x68'),_0x5c8872+'%');_0x1ca3b0['or'](_0xbd4b('0x69'),_0x5c8872+'%');}else if(qs[_0xbd4b('0x6a')](_0x5c8872)){_0x1ca3b0['or']('c.email\x20LIKE\x20?',_0x5c8872+'%');}else{_0x1ca3b0['or'](_0xbd4b('0x6b'),'%'+_0x5c8872+'%');_0x1ca3b0['or'](_0xbd4b('0x6c'),'%'+_0x5c8872+'%');_0x1ca3b0['or'](_0xbd4b('0x6d'),'%'+_0x5c8872+'%');}}}}_0x3a1da0['where'](_0x1ca3b0);_0x3a1da0[_0xbd4b('0x6e')](_0xbd4b('0x6f'));var _0x56d2c9={'type':db[_0xbd4b('0x70')][_0xbd4b('0x71')][_0xbd4b('0x72')],'raw':!![]};var _0xaf4769=_0x3a1da0[_0xbd4b('0x73')]()['field'](_0xbd4b('0x6f'));if(_0x217101[_0xbd4b('0x74')]){_0x217101[_0xbd4b('0x74')]['forEach'](function(_0xc3efb4){_0x3a1da0[_0xbd4b('0x74')]('c.'+_0xc3efb4[0x0],_0xc3efb4[0x1]==='DESC'?![]:!![]);});}if(!_[_0xbd4b('0x75')](_0x398cb1)){_0x3a1da0[_0xbd4b('0x76')](_0x55b7e0);_0xaf4769[_0xbd4b('0x3a')]('t.id\x20IN\x20?',_0x398cb1);}BPromise[_0xbd4b('0x77')]()[_0xbd4b('0x23')](function(){if(_0x46205e&&!_['some'](_0x46205e[_0xbd4b('0x4c')],[_0xbd4b('0x3e'),_0xbd4b('0x54')])){return _0x42d5bd['user']['getLists']({'attributes':['id'],'raw':!![]})[_0xbd4b('0x23')](function(_0x5bec7c){if(_[_0xbd4b('0x75')](_0x5bec7c)){_0xaf4769[_0xbd4b('0x3a')](_0xbd4b('0x78'));_0x3a1da0[_0xbd4b('0x3a')](_0xbd4b('0x78'));}else{_0xaf4769[_0xbd4b('0x3a')](_0xbd4b('0x79'),_[_0xbd4b('0x50')](_0x5bec7c,'id'));_0x3a1da0[_0xbd4b('0x3a')]('c.ListId\x20IN\x20?',_[_0xbd4b('0x50')](_0x5bec7c,'id'));}});}else{return;}})['then'](function(){db[_0xbd4b('0x7a')][_0xbd4b('0x34')](_0xaf4769['toString'](),_0x56d2c9)[_0xbd4b('0x23')](function(_0x14607d){_0x5d261a[_0xbd4b('0x1a')]=_0x14607d[_0xbd4b('0x29')];if(_0x5d261a[_0xbd4b('0x1a')]===0x0)return[];return db['sequelize'][_0xbd4b('0x34')](_0x373e90[_0xbd4b('0x7b')](),_0x56d2c9);})['then'](function(_0x3ccfb7){_0x228a0f=_['keyBy'](_0x3ccfb7,'id');_0x56d2c9=_[_0xbd4b('0x7c')](_0x56d2c9,{'model':db[_0xbd4b('0x28')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x42d5bd[_0xbd4b('0x34')][_0xbd4b('0x7d')]){_0x217101[_0xbd4b('0x36')][_0xbd4b('0x51')](function(_0x242294){_0x3a1da0[_0xbd4b('0x3e')]('c.'+_0x242294);});}else{_0x3a1da0['field'](_0xbd4b('0x6f'));_0x3a1da0[_0xbd4b('0x3e')](_0xbd4b('0x7e'));_0x3a1da0['field'](_0xbd4b('0x7f'));_0x3a1da0[_0xbd4b('0x3e')](_0xbd4b('0x80'));_0x3a1da0[_0xbd4b('0x3e')](_0xbd4b('0x81'));_0x3a1da0[_0xbd4b('0x3e')](_0xbd4b('0x82'));_0x3a1da0[_0xbd4b('0x3e')](_0xbd4b('0x83'));_0x3a1da0[_0xbd4b('0x3e')](_0xbd4b('0x84'));_0x3a1da0[_0xbd4b('0x3e')](_0xbd4b('0x85'));_0x3a1da0[_0xbd4b('0x3e')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x217101[_0xbd4b('0x1c')])_0x3a1da0[_0xbd4b('0x1c')](_0x217101['limit']);if(_0x217101['offset'])_0x3a1da0[_0xbd4b('0x1b')](_0x217101['offset']);return db['sequelize']['query'](_0x3a1da0['toString'](),_0x56d2c9);})[_0xbd4b('0x23')](function(_0x353e45){_0x353e45[_0xbd4b('0x51')](function(_0x17b72e){if(_0x17b72e[_0xbd4b('0x86')]){_0x17b72e[_0xbd4b('0x87')]=[];_0x17b72e[_0xbd4b('0x86')][_0xbd4b('0x4f')](',')['forEach'](function(_0x28d299){_0x17b72e['Tags'][_0xbd4b('0x2d')](_0x228a0f[_0x28d299]);});}delete _0x17b72e[_0xbd4b('0x86')];});_0x5d261a[_0xbd4b('0x88')]=_0x353e45;return _0x5d261a;})[_0xbd4b('0x23')](respondWithFilteredResult(_0x5b7d12,_0x217101));});})[_0xbd4b('0x89')](handleError(_0x5b7d12,null));};exports['destroy']=function(_0x45bf4c,_0x1554bd){return db[_0xbd4b('0x28')][_0xbd4b('0x4d')]({'where':{'id':_0x45bf4c['params']['id']}})[_0xbd4b('0x23')](handleEntityNotFound(_0x1554bd,null))['then'](removeEntity(_0x1554bd,null))[_0xbd4b('0x89')](handleError(_0x1554bd,null));};exports[_0xbd4b('0x8a')]=function(_0x158953,_0x487d66){return db[_0xbd4b('0x28')][_0xbd4b('0x8a')]()[_0xbd4b('0x23')](function(_0x3ff56a){delete _0x3ff56a[_0xbd4b('0x8b')];for(var _0x5c91e2=0x0;_0x5c91e2{}\s\\|]/g,'-');_0x54f8b9(null,util['format'](_0xa9c5('0x22'),path[_0xa9c5('0x23')](_0x2d95f8[_0xa9c5('0x21')],path[_0xa9c5('0x24')](_0x2d95f8[_0xa9c5('0x21')])),Date[_0xa9c5('0x25')](),path['extname'](_0x2d95f8['originalname'])));}})});router[_0xa9c5('0x15')](_0xa9c5('0x26'),upload['single'](_0xa9c5('0x27')),controller[_0xa9c5('0x28')]);var upload=multer({'storage':multer[_0xa9c5('0x1d')]({'destination':function(_0x32fc7d,_0x4cbba1,_0x40f08b){_0x40f08b(null,path[_0xa9c5('0x1e')](config['root'],'server/files/tmp'));},'filename':function(_0x242771,_0x4cd5e6,_0x1762ac){_0x4cd5e6[_0xa9c5('0x21')]=_0x4cd5e6['originalname'][_0xa9c5('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1762ac(null,util[_0xa9c5('0x2a')]('%s-%s%s',path[_0xa9c5('0x23')](_0x4cd5e6[_0xa9c5('0x21')],path[_0xa9c5('0x24')](_0x4cd5e6[_0xa9c5('0x21')])),Date[_0xa9c5('0x25')](),path['extname'](_0x4cd5e6[_0xa9c5('0x21')])));}})});router['post'](_0xa9c5('0x2b'),upload[_0xa9c5('0x2c')](_0xa9c5('0x27')),controller['upload']);router[_0xa9c5('0x15')](_0xa9c5('0x2d'),auth['isAuthenticated'](),controller[_0xa9c5('0x2e')]);router[_0xa9c5('0x2f')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x30')]);router[_0xa9c5('0x31')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0x32')]);module[_0xa9c5('0x33')]=router; \ No newline at end of file +var _0xa630=['%s-%s%s','now','extname','/csv','single','file','server/files/tmp','basename','upload','/upload/:id','import','update','delete','destroy','multer','util','express','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getJscriptySessions','post','/merge','merge','bulkCreate','setTags','diskStorage','join','originalname','replace','format'];(function(_0x3b9aef,_0x3ebe27){var _0x56c2ce=function(_0xc43fa1){while(--_0xc43fa1){_0x3b9aef['push'](_0x3b9aef['shift']());}};_0x56c2ce(++_0x3ebe27);}(_0xa630,0xbe));var _0x0a63=function(_0x549a15,_0x21290f){_0x549a15=_0x549a15-0x0;var _0x21275e=_0xa630[_0x549a15];return _0x21275e;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var auth=require(_0x0a63('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a63('0x4'));var controller=require(_0x0a63('0x5'));router[_0x0a63('0x6')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0x8')]);router['get'](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x6')](_0x0a63('0xb'),auth[_0x0a63('0x7')](),controller['show']);router[_0x0a63('0x6')](_0x0a63('0xc'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xd')]);router[_0x0a63('0x6')](_0x0a63('0xe'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xf')]);router[_0x0a63('0x6')](_0x0a63('0x10'),auth['isAuthenticated'](),controller[_0x0a63('0x11')]);router[_0x0a63('0x6')](_0x0a63('0x12'),auth[_0x0a63('0x7')](),controller['getHopperFinals']);router[_0x0a63('0x6')]('/:id/jscripty_sessions',auth[_0x0a63('0x7')](),controller[_0x0a63('0x13')]);router[_0x0a63('0x14')](_0x0a63('0x15'),auth[_0x0a63('0x7')](),controller[_0x0a63('0x16')]);router[_0x0a63('0x14')]('/',auth[_0x0a63('0x7')](),controller['create']);router[_0x0a63('0x14')]('/create_many',auth[_0x0a63('0x7')](),controller[_0x0a63('0x17')]);router[_0x0a63('0x14')](_0x0a63('0xc'),auth[_0x0a63('0x7')](),controller[_0x0a63('0x18')]);var upload=multer({'storage':multer[_0x0a63('0x19')]({'destination':function(_0x374c52,_0x2fd06c,_0x3cc74d){_0x3cc74d(null,path[_0x0a63('0x1a')](config['root'],'server/files/tmp'));},'filename':function(_0x7b2ccd,_0x586190,_0x2fc87c){_0x586190['originalname']=_0x586190[_0x0a63('0x1b')][_0x0a63('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2fc87c(null,util[_0x0a63('0x1d')](_0x0a63('0x1e'),path['basename'](_0x586190[_0x0a63('0x1b')],path['extname'](_0x586190[_0x0a63('0x1b')])),Date[_0x0a63('0x1f')](),path[_0x0a63('0x20')](_0x586190[_0x0a63('0x1b')])));}})});router[_0x0a63('0x14')](_0x0a63('0x21'),upload[_0x0a63('0x22')](_0x0a63('0x23')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x55fb70,_0x4c8637,_0xeacfc9){_0xeacfc9(null,path['join'](config['root'],_0x0a63('0x24')));},'filename':function(_0x1d5448,_0x362d6a,_0x2e2526){_0x362d6a['originalname']=_0x362d6a[_0x0a63('0x1b')][_0x0a63('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2e2526(null,util[_0x0a63('0x1d')]('%s-%s%s',path[_0x0a63('0x25')](_0x362d6a[_0x0a63('0x1b')],path[_0x0a63('0x20')](_0x362d6a[_0x0a63('0x1b')])),Date[_0x0a63('0x1f')](),path[_0x0a63('0x20')](_0x362d6a[_0x0a63('0x1b')])));}})});router[_0x0a63('0x14')]('/upload',upload[_0x0a63('0x22')]('file'),controller[_0x0a63('0x26')]);router[_0x0a63('0x14')](_0x0a63('0x27'),auth[_0x0a63('0x7')](),controller[_0x0a63('0x28')]);router['put'](_0x0a63('0xb'),auth[_0x0a63('0x7')](),controller[_0x0a63('0x29')]);router[_0x0a63('0x2a')]('/:id',auth[_0x0a63('0x7')](),controller[_0x0a63('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 2ef5d75..94c5449 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 _0x7c1a=['STRING','sequelize','exports','INTEGER'];(function(_0x1847fb,_0x938456){var _0x268823=function(_0x2363fc){while(--_0x2363fc){_0x1847fb['push'](_0x1847fb['shift']());}};_0x268823(++_0x938456);}(_0x7c1a,0x159));var _0xa7c1=function(_0xe81026,_0x146e58){_0xe81026=_0xe81026-0x0;var _0x466277=_0x7c1a[_0xe81026];return _0x466277;};'use strict';var Sequelize=require(_0xa7c1('0x0'));module[_0xa7c1('0x1')]={'CmContactId':{'type':Sequelize[_0xa7c1('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xa7c1('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa7c1('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa7c1('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xa7c1('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xf5a7=['INTEGER','PHONE','sequelize','exports','STRING'];(function(_0x2bfd0d,_0x367709){var _0x578620=function(_0x28c630){while(--_0x28c630){_0x2bfd0d['push'](_0x2bfd0d['shift']());}};_0x578620(++_0x367709);}(_0xf5a7,0x133));var _0x7f5a=function(_0x47305d,_0x1bd48c){_0x47305d=_0x47305d-0x0;var _0x1a0101=_0xf5a7[_0x47305d];return _0x1a0101;};'use strict';var Sequelize=require(_0x7f5a('0x0'));module[_0x7f5a('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x7f5a('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7f5a('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7f5a('0x2')],'defaultValue':_0x7f5a('0x4')},'OrderBy':{'type':Sequelize[_0x7f5a('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 cfa52d0..50cfed5 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 _0x1fad=['Content-Range','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','params','length','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x17959c,_0x439950){var _0x5b8968=function(_0x51a048){while(--_0x51a048){_0x17959c['push'](_0x17959c['shift']());}};_0x5b8968(++_0x439950);}(_0x1fad,0x18c));var _0xd1fa=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x1fad[_0x4d8a8f];return _0xfc4adc;};'use strict';var pdf=require(_0xd1fa('0x0'));var emlformat=require(_0xd1fa('0x1'));var rimraf=require(_0xd1fa('0x2'));var zipdir=require(_0xd1fa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1fa('0x4'));var moment=require('moment');var BPromise=require(_0xd1fa('0x5'));var Mustache=require(_0xd1fa('0x6'));var util=require(_0xd1fa('0x7'));var path=require(_0xd1fa('0x8'));var sox=require(_0xd1fa('0x9'));var csv=require(_0xd1fa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd1fa('0xb'));var squel=require(_0xd1fa('0xc'));var crypto=require(_0xd1fa('0xd'));var jsforce=require(_0xd1fa('0xe'));var deskjs=require(_0xd1fa('0xf'));var toCsv=require(_0xd1fa('0xa'));var querystring=require(_0xd1fa('0x10'));var Papa=require(_0xd1fa('0x11'));var Redis=require(_0xd1fa('0x12'));var authService=require(_0xd1fa('0x13'));var qs=require(_0xd1fa('0x14'));var as=require(_0xd1fa('0x15'));var hardwareService=require(_0xd1fa('0x16'));var logger=require(_0xd1fa('0x17'))(_0xd1fa('0x18'));var utils=require(_0xd1fa('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf5d6a1,_0x338754){_0x338754=_0x338754||0xcc;return function(_0x2411db){if(_0x2411db){return _0xf5d6a1[_0xd1fa('0x1a')](_0x338754);}return _0xf5d6a1['status'](_0x338754)[_0xd1fa('0x1b')]();};}function respondWithResult(_0x5b679c,_0x41096c){_0x41096c=_0x41096c||0xc8;return function(_0x51c9c5){if(_0x51c9c5){return _0x5b679c[_0xd1fa('0x1c')](_0x41096c)[_0xd1fa('0x1d')](_0x51c9c5);}};}function respondWithFilteredResult(_0x4629d4,_0x3374d0){return function(_0x266085){if(_0x266085){var _0x44a38e=_0x266085[_0xd1fa('0x1e')],_0x2154fa=_0x3374d0[_0xd1fa('0x1f')],_0x2e4e2e=_0x3374d0[_0xd1fa('0x1f')]+_0x3374d0[_0xd1fa('0x20')],_0x30b4af;if(_0x2e4e2e>=_0x44a38e){_0x2e4e2e=_0x44a38e;_0x30b4af=0xc8;}else{_0x30b4af=0xce;}_0x4629d4[_0xd1fa('0x1c')](_0x30b4af);return _0x4629d4[_0xd1fa('0x21')](_0xd1fa('0x22'),_0x2154fa+'-'+_0x2e4e2e+'/'+_0x44a38e)[_0xd1fa('0x1d')](_0x266085);}return null;};}function patchUpdates(_0x4daba6){return function(_0x137210){try{jsonpatch[_0xd1fa('0x23')](_0x137210,_0x4daba6,!![]);}catch(_0x320b95){return BPromise[_0xd1fa('0x24')](_0x320b95);}return _0x137210[_0xd1fa('0x25')]();};}function saveUpdates(_0xbebf26,_0x2895f0){return function(_0x2bb50a){if(_0x2bb50a){return _0x2bb50a[_0xd1fa('0x26')](_0xbebf26)[_0xd1fa('0x27')](function(_0x22b066){return _0x22b066;});}return null;};}function removeEntity(_0x1cbdc6,_0x30e5f9){return function(_0x9d0e21){if(_0x9d0e21){return _0x9d0e21['destroy']()[_0xd1fa('0x27')](function(){var _0x255ec5=_0x9d0e21[_0xd1fa('0x28')]({'plain':!![]});var _0x39785b=_0xd1fa('0x29');return db[_0xd1fa('0x2a')][_0xd1fa('0x2b')]({'where':{'type':_0x39785b,'resourceId':_0x255ec5['id']}})['then'](function(){return _0x9d0e21;});})[_0xd1fa('0x27')](function(){_0x1cbdc6[_0xd1fa('0x1c')](0xcc)[_0xd1fa('0x1b')]();});}};}function handleEntityNotFound(_0x3ffe5e,_0x23aebe){return function(_0x510b41){if(!_0x510b41){_0x3ffe5e[_0xd1fa('0x1a')](0x194);}return _0x510b41;};}function handleError(_0x56da42,_0x3f5b14){_0x3f5b14=_0x3f5b14||0x1f4;return function(_0x4a0be1){logger[_0xd1fa('0x2c')](_0x4a0be1[_0xd1fa('0x2d')]);if(_0x4a0be1[_0xd1fa('0x2e')]){delete _0x4a0be1[_0xd1fa('0x2e')];}_0x56da42[_0xd1fa('0x1c')](_0x3f5b14)['send'](_0x4a0be1);};}exports[_0xd1fa('0x2f')]=function(_0x58f700,_0x461e5e){var _0x17376f={},_0x52fbf4={},_0x502ca7={'count':0x0,'rows':[]};var _0x98490a=_[_0xd1fa('0x30')](db[_0xd1fa('0x31')][_0xd1fa('0x32')],function(_0x17fb3a){return{'name':_0x17fb3a[_0xd1fa('0x33')],'type':_0x17fb3a[_0xd1fa('0x34')]['key']};});_0x52fbf4['model']=_[_0xd1fa('0x30')](_0x98490a,_0xd1fa('0x2e'));_0x52fbf4[_0xd1fa('0x35')]=_[_0xd1fa('0x36')](_0x58f700[_0xd1fa('0x35')]);_0x52fbf4[_0xd1fa('0x37')]=_[_0xd1fa('0x38')](_0x52fbf4[_0xd1fa('0x39')],_0x52fbf4[_0xd1fa('0x35')]);_0x17376f[_0xd1fa('0x3a')]=_[_0xd1fa('0x38')](_0x52fbf4[_0xd1fa('0x39')],qs[_0xd1fa('0x3b')](_0x58f700['query'][_0xd1fa('0x3b')]));_0x17376f[_0xd1fa('0x3a')]=_0x17376f['attributes']['length']?_0x17376f[_0xd1fa('0x3a')]:_0x52fbf4['model'];if(!_0x58f700[_0xd1fa('0x35')]['hasOwnProperty'](_0xd1fa('0x3c'))){_0x17376f['limit']=qs[_0xd1fa('0x20')](_0x58f700[_0xd1fa('0x35')][_0xd1fa('0x20')]);_0x17376f[_0xd1fa('0x1f')]=qs[_0xd1fa('0x1f')](_0x58f700[_0xd1fa('0x35')][_0xd1fa('0x1f')]);}_0x17376f[_0xd1fa('0x3d')]=qs[_0xd1fa('0x3e')](_0x58f700[_0xd1fa('0x35')]['sort']);_0x17376f[_0xd1fa('0x3f')]=qs[_0xd1fa('0x37')](_['pick'](_0x58f700[_0xd1fa('0x35')],_0x52fbf4[_0xd1fa('0x37')]),_0x98490a);if(_0x58f700[_0xd1fa('0x35')][_0xd1fa('0x40')]){_0x17376f[_0xd1fa('0x3f')]=_[_0xd1fa('0x41')](_0x17376f[_0xd1fa('0x3f')],{'$or':_[_0xd1fa('0x30')](_0x98490a,function(_0x42d7dd){if(_0x42d7dd[_0xd1fa('0x34')]!==_0xd1fa('0x42')){var _0x79229a={};_0x79229a[_0x42d7dd[_0xd1fa('0x2e')]]={'$like':'%'+_0x58f700['query'][_0xd1fa('0x40')]+'%'};return _0x79229a;}})});}_0x17376f=_['merge']({},_0x17376f,_0x58f700[_0xd1fa('0x43')]);var _0x1b27c5={'where':_0x17376f[_0xd1fa('0x3f')]};return db[_0xd1fa('0x31')][_0xd1fa('0x1e')](_0x1b27c5)[_0xd1fa('0x27')](function(_0x2d72d9){_0x502ca7['count']=_0x2d72d9;if(_0x58f700[_0xd1fa('0x35')]['includeAll']){_0x17376f['include']=[{'all':!![]}];}return db[_0xd1fa('0x31')][_0xd1fa('0x44')](_0x17376f);})[_0xd1fa('0x27')](function(_0x5193e1){_0x502ca7[_0xd1fa('0x45')]=_0x5193e1;return _0x502ca7;})[_0xd1fa('0x27')](respondWithFilteredResult(_0x461e5e,_0x17376f))['catch'](handleError(_0x461e5e,null));};exports[_0xd1fa('0x46')]=function(_0x2adbb6,_0x4681ca){var _0x131a45={'raw':!![],'where':{'id':_0x2adbb6[_0xd1fa('0x47')]['id']}},_0x76ac41={};_0x76ac41[_0xd1fa('0x39')]=_['keys'](db['CmContactHasItem'][_0xd1fa('0x32')]);_0x76ac41[_0xd1fa('0x35')]=_[_0xd1fa('0x36')](_0x2adbb6[_0xd1fa('0x35')]);_0x76ac41[_0xd1fa('0x37')]=_['intersection'](_0x76ac41['model'],_0x76ac41[_0xd1fa('0x35')]);_0x131a45['attributes']=_[_0xd1fa('0x38')](_0x76ac41[_0xd1fa('0x39')],qs['fields'](_0x2adbb6['query'][_0xd1fa('0x3b')]));_0x131a45[_0xd1fa('0x3a')]=_0x131a45[_0xd1fa('0x3a')][_0xd1fa('0x48')]?_0x131a45[_0xd1fa('0x3a')]:_0x76ac41[_0xd1fa('0x39')];if(_0x2adbb6[_0xd1fa('0x35')][_0xd1fa('0x49')]){_0x131a45[_0xd1fa('0x4a')]=[{'all':!![]}];}_0x131a45=_[_0xd1fa('0x41')]({},_0x131a45,_0x2adbb6[_0xd1fa('0x43')]);return db[_0xd1fa('0x31')]['find'](_0x131a45)[_0xd1fa('0x27')](handleEntityNotFound(_0x4681ca,null))['then'](respondWithResult(_0x4681ca,null))[_0xd1fa('0x4b')](handleError(_0x4681ca,null));};exports[_0xd1fa('0x4c')]=function(_0x2df47b,_0x1a1019){return db['CmContactHasItem'][_0xd1fa('0x4c')](_0x2df47b[_0xd1fa('0x4d')],{})[_0xd1fa('0x27')](function(_0x44a9ff){var _0x186da3=_0x2df47b[_0xd1fa('0x4e')][_0xd1fa('0x28')]({'plain':!![]});if(!_0x186da3)throw new Error(_0xd1fa('0x4f'));if(_0x186da3[_0xd1fa('0x50')]===_0xd1fa('0x4e')){var _0x538642=_0x44a9ff[_0xd1fa('0x28')]({'plain':!![]});var _0x528448=_0xd1fa('0x29');return db[_0xd1fa('0x51')][_0xd1fa('0x52')]({'where':{'name':_0x528448,'userProfileId':_0x186da3[_0xd1fa('0x53')]},'raw':!![]})[_0xd1fa('0x27')](function(_0x53650b){if(_0x53650b&&_0x53650b[_0xd1fa('0x54')]===0x0){return db[_0xd1fa('0x2a')]['create']({'name':_0x538642['name'],'resourceId':_0x538642['id'],'type':_0x53650b[_0xd1fa('0x2e')],'sectionId':_0x53650b['id']},{})['then'](function(){return _0x44a9ff;});}else{return _0x44a9ff;}})['catch'](function(_0x31649d){logger[_0xd1fa('0x2c')](_0xd1fa('0x55'),_0x31649d);throw _0x31649d;});}return _0x44a9ff;})[_0xd1fa('0x27')](respondWithResult(_0x1a1019,0xc9))['catch'](handleError(_0x1a1019,null));};exports[_0xd1fa('0x26')]=function(_0xf171db,_0x126e00){if(_0xf171db[_0xd1fa('0x4d')]['id']){delete _0xf171db[_0xd1fa('0x4d')]['id'];}return db['CmContactHasItem'][_0xd1fa('0x52')]({'where':{'id':_0xf171db[_0xd1fa('0x47')]['id']}})[_0xd1fa('0x27')](handleEntityNotFound(_0x126e00,null))[_0xd1fa('0x27')](saveUpdates(_0xf171db['body'],null))[_0xd1fa('0x27')](respondWithResult(_0x126e00,null))['catch'](handleError(_0x126e00,null));};exports['destroy']=function(_0x505978,_0x1bd969){return db[_0xd1fa('0x31')][_0xd1fa('0x52')]({'where':{'id':_0x505978['params']['id']}})[_0xd1fa('0x27')](handleEntityNotFound(_0x1bd969,null))[_0xd1fa('0x27')](removeEntity(_0x1bd969,null))['catch'](handleError(_0x1bd969,null));}; \ No newline at end of file +var _0x3d96=['name','rawAttributes','fieldName','type','key','model','intersection','query','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','CmContactHasItem','fields','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x53d741,_0x23058a){var _0x2166fe=function(_0x316254){while(--_0x316254){_0x53d741['push'](_0x53d741['shift']());}};_0x2166fe(++_0x23058a);}(_0x3d96,0x1c7));var _0x63d9=function(_0x561f43,_0x5eb2dd){_0x561f43=_0x561f43-0x0;var _0x474e29=_0x3d96[_0x561f43];return _0x474e29;};'use strict';var pdf=require(_0x63d9('0x0'));var emlformat=require(_0x63d9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x63d9('0x2'));var jsonpatch=require(_0x63d9('0x3'));var rp=require(_0x63d9('0x4'));var moment=require('moment');var BPromise=require(_0x63d9('0x5'));var Mustache=require(_0x63d9('0x6'));var util=require(_0x63d9('0x7'));var path=require(_0x63d9('0x8'));var sox=require(_0x63d9('0x9'));var csv=require(_0x63d9('0xa'));var ejs=require(_0x63d9('0xb'));var fs=require('fs');var _=require(_0x63d9('0xc'));var squel=require(_0x63d9('0xd'));var crypto=require(_0x63d9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x63d9('0xa'));var querystring=require(_0x63d9('0xf'));var Papa=require(_0x63d9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x63d9('0x11'));var as=require(_0x63d9('0x12'));var hardwareService=require(_0x63d9('0x13'));var logger=require(_0x63d9('0x14'))(_0x63d9('0x15'));var utils=require(_0x63d9('0x16'));var config=require(_0x63d9('0x17'));var db=require(_0x63d9('0x18'))['db'];function respondWithStatusCode(_0xcd0d5,_0x29f958){_0x29f958=_0x29f958||0xcc;return function(_0x56d6f5){if(_0x56d6f5){return _0xcd0d5[_0x63d9('0x19')](_0x29f958);}return _0xcd0d5['status'](_0x29f958)[_0x63d9('0x1a')]();};}function respondWithResult(_0x383f8b,_0x3c5541){_0x3c5541=_0x3c5541||0xc8;return function(_0x4b9df9){if(_0x4b9df9){return _0x383f8b[_0x63d9('0x1b')](_0x3c5541)['json'](_0x4b9df9);}};}function respondWithFilteredResult(_0x598388,_0x4bfc7e){return function(_0x11b471){if(_0x11b471){var _0x576daf=_0x11b471['count'],_0x58b3a6=_0x4bfc7e['offset'],_0x3bbc40=_0x4bfc7e['offset']+_0x4bfc7e['limit'],_0x43b82e;if(_0x3bbc40>=_0x576daf){_0x3bbc40=_0x576daf;_0x43b82e=0xc8;}else{_0x43b82e=0xce;}_0x598388['status'](_0x43b82e);return _0x598388['set'](_0x63d9('0x1c'),_0x58b3a6+'-'+_0x3bbc40+'/'+_0x576daf)['json'](_0x11b471);}return null;};}function patchUpdates(_0x139689){return function(_0x3ebc94){try{jsonpatch[_0x63d9('0x1d')](_0x3ebc94,_0x139689,!![]);}catch(_0x3d651c){return BPromise[_0x63d9('0x1e')](_0x3d651c);}return _0x3ebc94[_0x63d9('0x1f')]();};}function saveUpdates(_0x2143aa,_0x2c1e6b){return function(_0x2b9a94){if(_0x2b9a94){return _0x2b9a94[_0x63d9('0x20')](_0x2143aa)[_0x63d9('0x21')](function(_0x403273){return _0x403273;});}return null;};}function removeEntity(_0x3eacdb,_0x147125){return function(_0x180f65){if(_0x180f65){return _0x180f65['destroy']()['then'](function(){var _0x6d1c20=_0x180f65['get']({'plain':!![]});var _0xa0a1ee='CmContactHasItems';return db['UserProfileResource'][_0x63d9('0x22')]({'where':{'type':_0xa0a1ee,'resourceId':_0x6d1c20['id']}})[_0x63d9('0x21')](function(){return _0x180f65;});})[_0x63d9('0x21')](function(){_0x3eacdb[_0x63d9('0x1b')](0xcc)[_0x63d9('0x1a')]();});}};}function handleEntityNotFound(_0x1b42ce,_0x125301){return function(_0x18e97b){if(!_0x18e97b){_0x1b42ce[_0x63d9('0x19')](0x194);}return _0x18e97b;};}function handleError(_0x45133b,_0x358398){_0x358398=_0x358398||0x1f4;return function(_0x41391f){logger[_0x63d9('0x23')](_0x41391f[_0x63d9('0x24')]);if(_0x41391f[_0x63d9('0x25')]){delete _0x41391f[_0x63d9('0x25')];}_0x45133b[_0x63d9('0x1b')](_0x358398)['send'](_0x41391f);};}exports['index']=function(_0xc5e844,_0x2efd48){var _0x43e930={},_0x3688d3={},_0x3db85e={'count':0x0,'rows':[]};var _0x31a579=_['map'](db['CmContactHasItem'][_0x63d9('0x26')],function(_0x5a4f03){return{'name':_0x5a4f03[_0x63d9('0x27')],'type':_0x5a4f03[_0x63d9('0x28')][_0x63d9('0x29')]};});_0x3688d3[_0x63d9('0x2a')]=_['map'](_0x31a579,_0x63d9('0x25'));_0x3688d3['query']=_['keys'](_0xc5e844['query']);_0x3688d3['filters']=_[_0x63d9('0x2b')](_0x3688d3[_0x63d9('0x2a')],_0x3688d3[_0x63d9('0x2c')]);_0x43e930[_0x63d9('0x2d')]=_[_0x63d9('0x2b')](_0x3688d3[_0x63d9('0x2a')],qs['fields'](_0xc5e844[_0x63d9('0x2c')]['fields']));_0x43e930[_0x63d9('0x2d')]=_0x43e930[_0x63d9('0x2d')][_0x63d9('0x2e')]?_0x43e930['attributes']:_0x3688d3['model'];if(!_0xc5e844[_0x63d9('0x2c')][_0x63d9('0x2f')](_0x63d9('0x30'))){_0x43e930[_0x63d9('0x31')]=qs[_0x63d9('0x31')](_0xc5e844[_0x63d9('0x2c')][_0x63d9('0x31')]);_0x43e930['offset']=qs[_0x63d9('0x32')](_0xc5e844[_0x63d9('0x2c')][_0x63d9('0x32')]);}_0x43e930[_0x63d9('0x33')]=qs['sort'](_0xc5e844[_0x63d9('0x2c')][_0x63d9('0x34')]);_0x43e930[_0x63d9('0x35')]=qs[_0x63d9('0x36')](_[_0x63d9('0x37')](_0xc5e844[_0x63d9('0x2c')],_0x3688d3['filters']),_0x31a579);if(_0xc5e844[_0x63d9('0x2c')][_0x63d9('0x38')]){_0x43e930[_0x63d9('0x35')]=_[_0x63d9('0x39')](_0x43e930['where'],{'$or':_[_0x63d9('0x3a')](_0x31a579,function(_0x4ca710){if(_0x4ca710['type']!==_0x63d9('0x3b')){var _0x4366f0={};_0x4366f0[_0x4ca710[_0x63d9('0x25')]]={'$like':'%'+_0xc5e844['query'][_0x63d9('0x38')]+'%'};return _0x4366f0;}})});}_0x43e930=_['merge']({},_0x43e930,_0xc5e844[_0x63d9('0x3c')]);var _0x2b8f60={'where':_0x43e930['where']};return db['CmContactHasItem'][_0x63d9('0x3d')](_0x2b8f60)[_0x63d9('0x21')](function(_0x44770b){_0x3db85e[_0x63d9('0x3d')]=_0x44770b;if(_0xc5e844[_0x63d9('0x2c')][_0x63d9('0x3e')]){_0x43e930[_0x63d9('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x63d9('0x40')](_0x43e930);})[_0x63d9('0x21')](function(_0x3ed13b){_0x3db85e[_0x63d9('0x41')]=_0x3ed13b;return _0x3db85e;})[_0x63d9('0x21')](respondWithFilteredResult(_0x2efd48,_0x43e930))[_0x63d9('0x42')](handleError(_0x2efd48,null));};exports[_0x63d9('0x43')]=function(_0x17aa45,_0x141036){var _0x16f6d7={'raw':!![],'where':{'id':_0x17aa45[_0x63d9('0x44')]['id']}},_0x35c233={};_0x35c233[_0x63d9('0x2a')]=_[_0x63d9('0x45')](db[_0x63d9('0x46')]['rawAttributes']);_0x35c233['query']=_[_0x63d9('0x45')](_0x17aa45[_0x63d9('0x2c')]);_0x35c233[_0x63d9('0x36')]=_[_0x63d9('0x2b')](_0x35c233[_0x63d9('0x2a')],_0x35c233[_0x63d9('0x2c')]);_0x16f6d7[_0x63d9('0x2d')]=_[_0x63d9('0x2b')](_0x35c233[_0x63d9('0x2a')],qs[_0x63d9('0x47')](_0x17aa45[_0x63d9('0x2c')]['fields']));_0x16f6d7[_0x63d9('0x2d')]=_0x16f6d7['attributes'][_0x63d9('0x2e')]?_0x16f6d7[_0x63d9('0x2d')]:_0x35c233[_0x63d9('0x2a')];if(_0x17aa45[_0x63d9('0x2c')][_0x63d9('0x3e')]){_0x16f6d7[_0x63d9('0x3f')]=[{'all':!![]}];}_0x16f6d7=_['merge']({},_0x16f6d7,_0x17aa45[_0x63d9('0x3c')]);return db[_0x63d9('0x46')]['find'](_0x16f6d7)[_0x63d9('0x21')](handleEntityNotFound(_0x141036,null))[_0x63d9('0x21')](respondWithResult(_0x141036,null))[_0x63d9('0x42')](handleError(_0x141036,null));};exports[_0x63d9('0x48')]=function(_0x57ce08,_0x3d1451){return db[_0x63d9('0x46')][_0x63d9('0x48')](_0x57ce08[_0x63d9('0x49')],{})[_0x63d9('0x21')](function(_0x381ac6){var _0x24ce3a=_0x57ce08[_0x63d9('0x4a')][_0x63d9('0x4b')]({'plain':!![]});if(!_0x24ce3a)throw new Error(_0x63d9('0x4c'));if(_0x24ce3a['role']==='user'){var _0x29c156=_0x381ac6['get']({'plain':!![]});var _0x2cebac=_0x63d9('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x2cebac,'userProfileId':_0x24ce3a['userProfileId']},'raw':!![]})[_0x63d9('0x21')](function(_0x19205d){if(_0x19205d&&_0x19205d[_0x63d9('0x4e')]===0x0){return db[_0x63d9('0x4f')][_0x63d9('0x48')]({'name':_0x29c156['name'],'resourceId':_0x29c156['id'],'type':_0x19205d[_0x63d9('0x25')],'sectionId':_0x19205d['id']},{})['then'](function(){return _0x381ac6;});}else{return _0x381ac6;}})[_0x63d9('0x42')](function(_0x34cc21){logger['error'](_0x63d9('0x50'),_0x34cc21);throw _0x34cc21;});}return _0x381ac6;})[_0x63d9('0x21')](respondWithResult(_0x3d1451,0xc9))[_0x63d9('0x42')](handleError(_0x3d1451,null));};exports[_0x63d9('0x20')]=function(_0x42f043,_0x220cb0){if(_0x42f043['body']['id']){delete _0x42f043['body']['id'];}return db['CmContactHasItem'][_0x63d9('0x51')]({'where':{'id':_0x42f043['params']['id']}})[_0x63d9('0x21')](handleEntityNotFound(_0x220cb0,null))['then'](saveUpdates(_0x42f043[_0x63d9('0x49')],null))[_0x63d9('0x21')](respondWithResult(_0x220cb0,null))['catch'](handleError(_0x220cb0,null));};exports['destroy']=function(_0x2e2375,_0x4b6b47){return db[_0x63d9('0x46')][_0x63d9('0x51')]({'where':{'id':_0x2e2375[_0x63d9('0x44')]['id']}})[_0x63d9('0x21')](handleEntityNotFound(_0x4b6b47,null))[_0x63d9('0x21')](removeEntity(_0x4b6b47,null))[_0x63d9('0x42')](handleError(_0x4b6b47,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index c36481f..deaa942 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 _0xafc4=['path','exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xafc4,0x69));var _0x4afc=function(_0x50ceef,_0x5536ec){_0x50ceef=_0x50ceef-0x0;var _0x298218=_0xafc4[_0x50ceef];return _0x298218;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x108867,_0x23b8f2){var _0x28a3aa=function(_0x32673d){while(--_0x32673d){_0x108867['push'](_0x108867['shift']());}};_0x28a3aa(++_0x23b8f2);}(_0x7c09,0x102));var _0x97c0=function(_0x482358,_0x574179){_0x482358=_0x482358-0x0;var _0x12a403=_0x7c09[_0x482358];return _0x12a403;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 146a57e..7fd3bb6 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 _0x2884=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xf3d277,_0x5b8991){var _0x2c2e99=function(_0x5f513a){while(--_0x5f513a){_0xf3d277['push'](_0xf3d277['shift']());}};_0x2c2e99(++_0x5b8991);}(_0x2884,0x11a));var _0x4288=function(_0x97ab47,_0x5cdab2){_0x97ab47=_0x97ab47-0x0;var _0x2d291f=_0x2884[_0x97ab47];return _0x2d291f;};'use strict';var _=require(_0x4288('0x0'));var util=require(_0x4288('0x1'));var moment=require(_0x4288('0x2'));var BPromise=require('bluebird');var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require(_0x4288('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4288('0x5'));var logger=require(_0x4288('0x6'))('rpc');var config=require(_0x4288('0x7'));var jayson=require(_0x4288('0x8'));var client=jayson[_0x4288('0x9')][_0x4288('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18e69a,_0x55c999,_0x341f80){return new BPromise(function(_0x43150a,_0x5ef497){return client[_0x4288('0xb')](_0x18e69a,_0x341f80)['then'](function(_0x238a77){logger[_0x4288('0xc')](_0x4288('0xd'),_0x55c999,_0x4288('0xe'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x55c999,_0x4288('0xe'),JSON[_0x4288('0xf')](_0x238a77));if(_0x238a77[_0x4288('0x10')]){if(_0x238a77['error'][_0x4288('0x11')]===0x1f4){logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0x238a77['error'][_0x4288('0x12')]);return _0x5ef497(_0x238a77[_0x4288('0x10')][_0x4288('0x12')]);}logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0x238a77['error'][_0x4288('0x12')]);return _0x43150a(_0x238a77[_0x4288('0x10')]['message']);}else{logger[_0x4288('0xc')](_0x4288('0xd'),_0x55c999,_0x4288('0xe'));_0x43150a(_0x238a77[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0xe3dd7){logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0xe3dd7);_0x5ef497(_0xe3dd7);});});} \ No newline at end of file +var _0xdb90=['rpc','../../config/environment','jayson/promise','client','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x175a8d,_0x4787b1){var _0x5c4394=function(_0x4e1753){while(--_0x4e1753){_0x175a8d['push'](_0x175a8d['shift']());}};_0x5c4394(++_0x4787b1);}(_0xdb90,0xcb));var _0x0db9=function(_0x3ce6c1,_0x3ab7a7){_0x3ce6c1=_0x3ce6c1-0x0;var _0xecc97d=_0xdb90[_0x3ce6c1];return _0xecc97d;};'use strict';var _=require(_0x0db9('0x0'));var util=require(_0x0db9('0x1'));var moment=require('moment');var BPromise=require(_0x0db9('0x2'));var rs=require(_0x0db9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0db9('0x4'))['db'];var utils=require(_0x0db9('0x5'));var logger=require(_0x0db9('0x6'))(_0x0db9('0x7'));var config=require(_0x0db9('0x8'));var jayson=require(_0x0db9('0x9'));var client=jayson[_0x0db9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b1ef,_0x2593b4,_0x425111){return new BPromise(function(_0x410814,_0x21c9e0){return client[_0x0db9('0xb')](_0x36b1ef,_0x425111)['then'](function(_0x32b6a4){logger[_0x0db9('0xc')](_0x0db9('0xd'),_0x2593b4,_0x0db9('0xe'));logger[_0x0db9('0xf')](_0x0db9('0x10'),_0x2593b4,_0x0db9('0xe'),JSON['stringify'](_0x32b6a4));if(_0x32b6a4['error']){if(_0x32b6a4[_0x0db9('0x11')][_0x0db9('0x12')]===0x1f4){logger[_0x0db9('0x11')](_0x0db9('0xd'),_0x2593b4,_0x32b6a4[_0x0db9('0x11')][_0x0db9('0x13')]);return _0x21c9e0(_0x32b6a4[_0x0db9('0x11')][_0x0db9('0x13')]);}logger[_0x0db9('0x11')](_0x0db9('0xd'),_0x2593b4,_0x32b6a4[_0x0db9('0x11')][_0x0db9('0x13')]);return _0x410814(_0x32b6a4['error'][_0x0db9('0x13')]);}else{logger[_0x0db9('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x2593b4,'request\x20sent');_0x410814(_0x32b6a4[_0x0db9('0x14')][_0x0db9('0x13')]);}})['catch'](function(_0x44591e){logger[_0x0db9('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x2593b4,_0x44591e);_0x21c9e0(_0x44591e);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 8786826..c8e02bb 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 _0xf83f=['multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','/:id','show','post','create','update','delete','exports'];(function(_0x19d52e,_0xf84043){var _0x3be91b=function(_0x25edd6){while(--_0x25edd6){_0x19d52e['push'](_0x19d52e['shift']());}};_0x3be91b(++_0xf84043);}(_0xf83f,0x14a));var _0xff83=function(_0x1554fe,_0x3e6281){_0x1554fe=_0x1554fe-0x0;var _0x843e87=_0xf83f[_0x1554fe];return _0x843e87;};'use strict';var multer=require(_0xff83('0x0'));var util=require(_0xff83('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff83('0x2')]();var auth=require(_0xff83('0x3'));var interaction=require(_0xff83('0x4'));var config=require(_0xff83('0x5'));var controller=require(_0xff83('0x6'));router['get']('/',auth[_0xff83('0x7')](),controller['index']);router['get'](_0xff83('0x8'),auth[_0xff83('0x7')](),controller[_0xff83('0x9')]);router[_0xff83('0xa')]('/',auth[_0xff83('0x7')](),controller[_0xff83('0xb')]);router['put'](_0xff83('0x8'),auth[_0xff83('0x7')](),controller[_0xff83('0xc')]);router[_0xff83('0xd')](_0xff83('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xff83('0xe')]=router; \ No newline at end of file +var _0x8d64=['get','/:id','show','isAuthenticated','create','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x417717,_0xe7755a){var _0x4303b2=function(_0x16cda5){while(--_0x16cda5){_0x417717['push'](_0x417717['shift']());}};_0x4303b2(++_0xe7755a);}(_0x8d64,0x1a8));var _0x48d6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8d64[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x48d6('0x0'));var util=require(_0x48d6('0x1'));var path=require('path');var timeout=require(_0x48d6('0x2'));var express=require('express');var router=express[_0x48d6('0x3')]();var auth=require(_0x48d6('0x4'));var interaction=require(_0x48d6('0x5'));var config=require(_0x48d6('0x6'));var controller=require(_0x48d6('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x48d6('0x8')](_0x48d6('0x9'),auth['isAuthenticated'](),controller[_0x48d6('0xa')]);router['post']('/',auth[_0x48d6('0xb')](),controller[_0x48d6('0xc')]);router['put'](_0x48d6('0x9'),auth[_0x48d6('0xb')](),controller[_0x48d6('0xd')]);router['delete'](_0x48d6('0x9'),auth[_0x48d6('0xb')](),controller[_0x48d6('0xe')]);module[_0x48d6('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 4225837..bc5dc7b 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 _0x8137=['sequelize','exports','STRING'];(function(_0x458db6,_0x4d19a0){var _0x389315=function(_0x4f2586){while(--_0x4f2586){_0x458db6['push'](_0x458db6['shift']());}};_0x389315(++_0x4d19a0);}(_0x8137,0xba));var _0x7813=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x8137[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x7813('0x0'));module[_0x7813('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0x7813('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x3613=['exports','INTEGER','STRING','sequelize'];(function(_0x559c4f,_0x5a771c){var _0x918c97=function(_0x31fc55){while(--_0x31fc55){_0x559c4f['push'](_0x559c4f['shift']());}};_0x918c97(++_0x5a771c);}(_0x3613,0xa3));var _0x3361=function(_0x126b9c,_0x39faa8){_0x126b9c=_0x126b9c-0x0;var _0x47cfda=_0x3613[_0x126b9c];return _0x47cfda;};'use strict';var Sequelize=require(_0x3361('0x0'));module[_0x3361('0x1')]={'CmContactId':{'type':Sequelize[_0x3361('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x3361('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 27acd41..ff8d441 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 _0x407c=['UserProfileResource','error','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','VIRTUAL','filter','options','CmContactHasPhone','count','rows','params','includeAll','include','merge','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','get','CmContactHasPhones'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0x407c,0x10a));var _0xc407=function(_0x23710a,_0x2a5257){_0x23710a=_0x23710a-0x0;var _0xb876d9=_0x407c[_0x23710a];return _0xb876d9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc407('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc407('0x1'));var rp=require(_0xc407('0x2'));var moment=require(_0xc407('0x3'));var BPromise=require(_0xc407('0x4'));var Mustache=require(_0xc407('0x5'));var util=require('util');var path=require(_0xc407('0x6'));var sox=require(_0xc407('0x7'));var csv=require(_0xc407('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc407('0x9'));var squel=require('squel');var crypto=require(_0xc407('0xa'));var jsforce=require(_0xc407('0xb'));var deskjs=require(_0xc407('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc407('0xd'));var Papa=require('papaparse');var Redis=require(_0xc407('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc407('0xf'));var hardwareService=require(_0xc407('0x10'));var logger=require('../../config/logger')(_0xc407('0x11'));var utils=require(_0xc407('0x12'));var config=require(_0xc407('0x13'));var db=require(_0xc407('0x14'))['db'];function respondWithStatusCode(_0x13d2d9,_0x39db9b){_0x39db9b=_0x39db9b||0xcc;return function(_0x3de857){if(_0x3de857){return _0x13d2d9[_0xc407('0x15')](_0x39db9b);}return _0x13d2d9[_0xc407('0x16')](_0x39db9b)[_0xc407('0x17')]();};}function respondWithResult(_0x4e9bd4,_0x548e15){_0x548e15=_0x548e15||0xc8;return function(_0x4cb080){if(_0x4cb080){return _0x4e9bd4[_0xc407('0x16')](_0x548e15)[_0xc407('0x18')](_0x4cb080);}};}function respondWithFilteredResult(_0x30f163,_0x2c6fdc){return function(_0x431f8c){if(_0x431f8c){var _0x8f7b18=_0x431f8c['count'],_0x4412ee=_0x2c6fdc[_0xc407('0x19')],_0x1b393f=_0x2c6fdc[_0xc407('0x19')]+_0x2c6fdc['limit'],_0x4297ed;if(_0x1b393f>=_0x8f7b18){_0x1b393f=_0x8f7b18;_0x4297ed=0xc8;}else{_0x4297ed=0xce;}_0x30f163[_0xc407('0x16')](_0x4297ed);return _0x30f163[_0xc407('0x1a')](_0xc407('0x1b'),_0x4412ee+'-'+_0x1b393f+'/'+_0x8f7b18)[_0xc407('0x18')](_0x431f8c);}return null;};}function patchUpdates(_0x1ad5e4){return function(_0x5dfe71){try{jsonpatch[_0xc407('0x1c')](_0x5dfe71,_0x1ad5e4,!![]);}catch(_0x54d3ea){return BPromise[_0xc407('0x1d')](_0x54d3ea);}return _0x5dfe71['save']();};}function saveUpdates(_0x22b5a1,_0xf202ce){return function(_0x2d6ce7){if(_0x2d6ce7){return _0x2d6ce7[_0xc407('0x1e')](_0x22b5a1)[_0xc407('0x1f')](function(_0x3759c8){return _0x3759c8;});}return null;};}function removeEntity(_0x3b8a88,_0x43f166){return function(_0x30a771){if(_0x30a771){return _0x30a771['destroy']()[_0xc407('0x1f')](function(){var _0x63bdd3=_0x30a771[_0xc407('0x20')]({'plain':!![]});var _0x554168=_0xc407('0x21');return db[_0xc407('0x22')]['destroy']({'where':{'type':_0x554168,'resourceId':_0x63bdd3['id']}})[_0xc407('0x1f')](function(){return _0x30a771;});})[_0xc407('0x1f')](function(){_0x3b8a88[_0xc407('0x16')](0xcc)[_0xc407('0x17')]();});}};}function handleEntityNotFound(_0x204791,_0x181f3a){return function(_0x561da3){if(!_0x561da3){_0x204791[_0xc407('0x15')](0x194);}return _0x561da3;};}function handleError(_0x1ad50a,_0x429572){_0x429572=_0x429572||0x1f4;return function(_0x38a062){logger[_0xc407('0x23')](_0x38a062['stack']);if(_0x38a062[_0xc407('0x24')]){delete _0x38a062[_0xc407('0x24')];}_0x1ad50a['status'](_0x429572)[_0xc407('0x25')](_0x38a062);};}exports['index']=function(_0xab93bc,_0x1f631b){var _0x1c437b={},_0x4ca35b={},_0x383617={'count':0x0,'rows':[]};var _0x126a52=_['map'](db['CmContactHasPhone'][_0xc407('0x26')],function(_0x4f264d){return{'name':_0x4f264d[_0xc407('0x27')],'type':_0x4f264d[_0xc407('0x28')]['key']};});_0x4ca35b[_0xc407('0x29')]=_[_0xc407('0x2a')](_0x126a52,_0xc407('0x24'));_0x4ca35b[_0xc407('0x2b')]=_[_0xc407('0x2c')](_0xab93bc[_0xc407('0x2b')]);_0x4ca35b['filters']=_[_0xc407('0x2d')](_0x4ca35b[_0xc407('0x29')],_0x4ca35b[_0xc407('0x2b')]);_0x1c437b['attributes']=_[_0xc407('0x2d')](_0x4ca35b[_0xc407('0x29')],qs[_0xc407('0x2e')](_0xab93bc[_0xc407('0x2b')]['fields']));_0x1c437b[_0xc407('0x2f')]=_0x1c437b[_0xc407('0x2f')][_0xc407('0x30')]?_0x1c437b[_0xc407('0x2f')]:_0x4ca35b['model'];if(!_0xab93bc[_0xc407('0x2b')][_0xc407('0x31')](_0xc407('0x32'))){_0x1c437b[_0xc407('0x33')]=qs[_0xc407('0x33')](_0xab93bc[_0xc407('0x2b')][_0xc407('0x33')]);_0x1c437b[_0xc407('0x19')]=qs['offset'](_0xab93bc[_0xc407('0x2b')][_0xc407('0x19')]);}_0x1c437b[_0xc407('0x34')]=qs[_0xc407('0x35')](_0xab93bc['query']['sort']);_0x1c437b[_0xc407('0x36')]=qs[_0xc407('0x37')](_['pick'](_0xab93bc['query'],_0x4ca35b[_0xc407('0x37')]),_0x126a52);if(_0xab93bc[_0xc407('0x2b')]['filter']){_0x1c437b[_0xc407('0x36')]=_['merge'](_0x1c437b[_0xc407('0x36')],{'$or':_['map'](_0x126a52,function(_0x3605ab){if(_0x3605ab[_0xc407('0x28')]!==_0xc407('0x38')){var _0x402a2f={};_0x402a2f[_0x3605ab['name']]={'$like':'%'+_0xab93bc[_0xc407('0x2b')][_0xc407('0x39')]+'%'};return _0x402a2f;}})});}_0x1c437b=_['merge']({},_0x1c437b,_0xab93bc[_0xc407('0x3a')]);var _0x487a69={'where':_0x1c437b['where']};return db[_0xc407('0x3b')][_0xc407('0x3c')](_0x487a69)[_0xc407('0x1f')](function(_0x10ed5f){_0x383617[_0xc407('0x3c')]=_0x10ed5f;if(_0xab93bc['query']['includeAll']){_0x1c437b['include']=[{'all':!![]}];}return db['CmContactHasPhone']['findAll'](_0x1c437b);})[_0xc407('0x1f')](function(_0xdb61f8){_0x383617[_0xc407('0x3d')]=_0xdb61f8;return _0x383617;})[_0xc407('0x1f')](respondWithFilteredResult(_0x1f631b,_0x1c437b))['catch'](handleError(_0x1f631b,null));};exports['show']=function(_0x27211e,_0x3532f5){var _0x4a7943={'raw':!![],'where':{'id':_0x27211e[_0xc407('0x3e')]['id']}},_0x23a595={};_0x23a595[_0xc407('0x29')]=_['keys'](db['CmContactHasPhone'][_0xc407('0x26')]);_0x23a595[_0xc407('0x2b')]=_[_0xc407('0x2c')](_0x27211e[_0xc407('0x2b')]);_0x23a595[_0xc407('0x37')]=_['intersection'](_0x23a595[_0xc407('0x29')],_0x23a595['query']);_0x4a7943[_0xc407('0x2f')]=_[_0xc407('0x2d')](_0x23a595[_0xc407('0x29')],qs[_0xc407('0x2e')](_0x27211e[_0xc407('0x2b')][_0xc407('0x2e')]));_0x4a7943[_0xc407('0x2f')]=_0x4a7943[_0xc407('0x2f')][_0xc407('0x30')]?_0x4a7943[_0xc407('0x2f')]:_0x23a595[_0xc407('0x29')];if(_0x27211e[_0xc407('0x2b')][_0xc407('0x3f')]){_0x4a7943[_0xc407('0x40')]=[{'all':!![]}];}_0x4a7943=_[_0xc407('0x41')]({},_0x4a7943,_0x27211e[_0xc407('0x3a')]);return db[_0xc407('0x3b')][_0xc407('0x42')](_0x4a7943)[_0xc407('0x1f')](handleEntityNotFound(_0x3532f5,null))[_0xc407('0x1f')](respondWithResult(_0x3532f5,null))[_0xc407('0x43')](handleError(_0x3532f5,null));};exports[_0xc407('0x44')]=function(_0x24ecdc,_0x51d5fd){return db[_0xc407('0x3b')]['create'](_0x24ecdc[_0xc407('0x45')],{})[_0xc407('0x1f')](function(_0x32f094){var _0x454504=_0x24ecdc['user'][_0xc407('0x20')]({'plain':!![]});if(!_0x454504)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x454504[_0xc407('0x46')]==='user'){var _0x452703=_0x32f094[_0xc407('0x20')]({'plain':!![]});var _0x51d879='CmContactHasPhones';return db[_0xc407('0x47')][_0xc407('0x42')]({'where':{'name':_0x51d879,'userProfileId':_0x454504[_0xc407('0x48')]},'raw':!![]})['then'](function(_0x59d0f6){if(_0x59d0f6&&_0x59d0f6[_0xc407('0x49')]===0x0){return db[_0xc407('0x22')]['create']({'name':_0x452703[_0xc407('0x24')],'resourceId':_0x452703['id'],'type':_0x59d0f6[_0xc407('0x24')],'sectionId':_0x59d0f6['id']},{})[_0xc407('0x1f')](function(){return _0x32f094;});}else{return _0x32f094;}})['catch'](function(_0x3decb3){logger[_0xc407('0x23')](_0xc407('0x4a'),_0x3decb3);throw _0x3decb3;});}return _0x32f094;})[_0xc407('0x1f')](respondWithResult(_0x51d5fd,0xc9))[_0xc407('0x43')](handleError(_0x51d5fd,null));};exports[_0xc407('0x1e')]=function(_0x2c3a48,_0x17cbf2){if(_0x2c3a48[_0xc407('0x45')]['id']){delete _0x2c3a48[_0xc407('0x45')]['id'];}return db[_0xc407('0x3b')][_0xc407('0x42')]({'where':{'id':_0x2c3a48['params']['id']}})['then'](handleEntityNotFound(_0x17cbf2,null))[_0xc407('0x1f')](saveUpdates(_0x2c3a48[_0xc407('0x45')],null))[_0xc407('0x1f')](respondWithResult(_0x17cbf2,null))[_0xc407('0x43')](handleError(_0x17cbf2,null));};exports['destroy']=function(_0x1d33d1,_0x2939b3){return db['CmContactHasPhone'][_0xc407('0x42')]({'where':{'id':_0x1d33d1['params']['id']}})[_0xc407('0x1f')](handleEntityNotFound(_0x2939b3,null))[_0xc407('0x1f')](removeEntity(_0x2939b3,null))[_0xc407('0x43')](handleError(_0x2939b3,null));}; \ No newline at end of file +var _0x38dc=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasPhones','UserProfileSection','autoAssociation','html-pdf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','map','CmContactHasPhone','fieldName','type'];(function(_0x12af84,_0x5dea7d){var _0xf8fa81=function(_0x9a28d2){while(--_0x9a28d2){_0x12af84['push'](_0x12af84['shift']());}};_0xf8fa81(++_0x5dea7d);}(_0x38dc,0xbb));var _0xc38d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x38dc[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xc38d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc38d('0x1'));var rp=require(_0xc38d('0x2'));var moment=require(_0xc38d('0x3'));var BPromise=require(_0xc38d('0x4'));var Mustache=require('mustache');var util=require(_0xc38d('0x5'));var path=require(_0xc38d('0x6'));var sox=require(_0xc38d('0x7'));var csv=require(_0xc38d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc38d('0x9'));var squel=require('squel');var crypto=require(_0xc38d('0xa'));var jsforce=require(_0xc38d('0xb'));var deskjs=require(_0xc38d('0xc'));var toCsv=require(_0xc38d('0x8'));var querystring=require('querystring');var Papa=require(_0xc38d('0xd'));var Redis=require(_0xc38d('0xe'));var authService=require(_0xc38d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc38d('0x10'));var hardwareService=require(_0xc38d('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc38d('0x12'));var db=require(_0xc38d('0x13'))['db'];function respondWithStatusCode(_0x145250,_0x487663){_0x487663=_0x487663||0xcc;return function(_0x3f65a7){if(_0x3f65a7){return _0x145250[_0xc38d('0x14')](_0x487663);}return _0x145250[_0xc38d('0x15')](_0x487663)[_0xc38d('0x16')]();};}function respondWithResult(_0x41139a,_0x44ac0c){_0x44ac0c=_0x44ac0c||0xc8;return function(_0x7eed19){if(_0x7eed19){return _0x41139a['status'](_0x44ac0c)[_0xc38d('0x17')](_0x7eed19);}};}function respondWithFilteredResult(_0x2b1ae4,_0x56c05a){return function(_0x37649f){if(_0x37649f){var _0x422b6c=_0x37649f[_0xc38d('0x18')],_0x3f7773=_0x56c05a['offset'],_0x2d215f=_0x56c05a[_0xc38d('0x19')]+_0x56c05a['limit'],_0x1ed362;if(_0x2d215f>=_0x422b6c){_0x2d215f=_0x422b6c;_0x1ed362=0xc8;}else{_0x1ed362=0xce;}_0x2b1ae4[_0xc38d('0x15')](_0x1ed362);return _0x2b1ae4[_0xc38d('0x1a')](_0xc38d('0x1b'),_0x3f7773+'-'+_0x2d215f+'/'+_0x422b6c)['json'](_0x37649f);}return null;};}function patchUpdates(_0x439cbe){return function(_0xd0285f){try{jsonpatch['apply'](_0xd0285f,_0x439cbe,!![]);}catch(_0x35e9eb){return BPromise['reject'](_0x35e9eb);}return _0xd0285f[_0xc38d('0x1c')]();};}function saveUpdates(_0x57be57,_0x52668d){return function(_0x188a70){if(_0x188a70){return _0x188a70[_0xc38d('0x1d')](_0x57be57)[_0xc38d('0x1e')](function(_0xb643ae){return _0xb643ae;});}return null;};}function removeEntity(_0x4dc391,_0x31a1f2){return function(_0x419902){if(_0x419902){return _0x419902['destroy']()[_0xc38d('0x1e')](function(){var _0x38ce87=_0x419902[_0xc38d('0x1f')]({'plain':!![]});var _0x20767d='CmContactHasPhones';return db[_0xc38d('0x20')][_0xc38d('0x21')]({'where':{'type':_0x20767d,'resourceId':_0x38ce87['id']}})[_0xc38d('0x1e')](function(){return _0x419902;});})[_0xc38d('0x1e')](function(){_0x4dc391[_0xc38d('0x15')](0xcc)[_0xc38d('0x16')]();});}};}function handleEntityNotFound(_0x29dde2,_0x1e76f0){return function(_0x131e1f){if(!_0x131e1f){_0x29dde2[_0xc38d('0x14')](0x194);}return _0x131e1f;};}function handleError(_0x543c7c,_0x14494f){_0x14494f=_0x14494f||0x1f4;return function(_0x2a44d8){logger[_0xc38d('0x22')](_0x2a44d8['stack']);if(_0x2a44d8[_0xc38d('0x23')]){delete _0x2a44d8[_0xc38d('0x23')];}_0x543c7c[_0xc38d('0x15')](_0x14494f)[_0xc38d('0x24')](_0x2a44d8);};}exports['index']=function(_0x546b43,_0x236c9a){var _0x39e7c5={},_0x3d7d2a={},_0x5bbabf={'count':0x0,'rows':[]};var _0x127151=_[_0xc38d('0x25')](db[_0xc38d('0x26')]['rawAttributes'],function(_0x38b96d){return{'name':_0x38b96d[_0xc38d('0x27')],'type':_0x38b96d[_0xc38d('0x28')][_0xc38d('0x29')]};});_0x3d7d2a[_0xc38d('0x2a')]=_[_0xc38d('0x25')](_0x127151,_0xc38d('0x23'));_0x3d7d2a['query']=_[_0xc38d('0x2b')](_0x546b43[_0xc38d('0x2c')]);_0x3d7d2a[_0xc38d('0x2d')]=_[_0xc38d('0x2e')](_0x3d7d2a['model'],_0x3d7d2a[_0xc38d('0x2c')]);_0x39e7c5[_0xc38d('0x2f')]=_[_0xc38d('0x2e')](_0x3d7d2a['model'],qs[_0xc38d('0x30')](_0x546b43[_0xc38d('0x2c')][_0xc38d('0x30')]));_0x39e7c5[_0xc38d('0x2f')]=_0x39e7c5[_0xc38d('0x2f')][_0xc38d('0x31')]?_0x39e7c5['attributes']:_0x3d7d2a['model'];if(!_0x546b43['query'][_0xc38d('0x32')]('nolimit')){_0x39e7c5[_0xc38d('0x33')]=qs[_0xc38d('0x33')](_0x546b43[_0xc38d('0x2c')][_0xc38d('0x33')]);_0x39e7c5['offset']=qs[_0xc38d('0x19')](_0x546b43[_0xc38d('0x2c')][_0xc38d('0x19')]);}_0x39e7c5[_0xc38d('0x34')]=qs[_0xc38d('0x35')](_0x546b43['query'][_0xc38d('0x35')]);_0x39e7c5[_0xc38d('0x36')]=qs[_0xc38d('0x2d')](_[_0xc38d('0x37')](_0x546b43['query'],_0x3d7d2a[_0xc38d('0x2d')]),_0x127151);if(_0x546b43[_0xc38d('0x2c')]['filter']){_0x39e7c5[_0xc38d('0x36')]=_[_0xc38d('0x38')](_0x39e7c5[_0xc38d('0x36')],{'$or':_[_0xc38d('0x25')](_0x127151,function(_0x24b281){if(_0x24b281['type']!==_0xc38d('0x39')){var _0x4bcf5b={};_0x4bcf5b[_0x24b281[_0xc38d('0x23')]]={'$like':'%'+_0x546b43[_0xc38d('0x2c')][_0xc38d('0x3a')]+'%'};return _0x4bcf5b;}})});}_0x39e7c5=_[_0xc38d('0x38')]({},_0x39e7c5,_0x546b43[_0xc38d('0x3b')]);var _0x43d00d={'where':_0x39e7c5[_0xc38d('0x36')]};return db[_0xc38d('0x26')][_0xc38d('0x18')](_0x43d00d)['then'](function(_0x7aeb21){_0x5bbabf[_0xc38d('0x18')]=_0x7aeb21;if(_0x546b43[_0xc38d('0x2c')][_0xc38d('0x3c')]){_0x39e7c5[_0xc38d('0x3d')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xc38d('0x3e')](_0x39e7c5);})[_0xc38d('0x1e')](function(_0x5a4c3b){_0x5bbabf[_0xc38d('0x3f')]=_0x5a4c3b;return _0x5bbabf;})[_0xc38d('0x1e')](respondWithFilteredResult(_0x236c9a,_0x39e7c5))[_0xc38d('0x40')](handleError(_0x236c9a,null));};exports['show']=function(_0x1ab0b8,_0x1a31ae){var _0x3d09fa={'raw':!![],'where':{'id':_0x1ab0b8[_0xc38d('0x41')]['id']}},_0x4b1f8f={};_0x4b1f8f['model']=_[_0xc38d('0x2b')](db['CmContactHasPhone'][_0xc38d('0x42')]);_0x4b1f8f[_0xc38d('0x2c')]=_[_0xc38d('0x2b')](_0x1ab0b8[_0xc38d('0x2c')]);_0x4b1f8f[_0xc38d('0x2d')]=_[_0xc38d('0x2e')](_0x4b1f8f[_0xc38d('0x2a')],_0x4b1f8f['query']);_0x3d09fa[_0xc38d('0x2f')]=_[_0xc38d('0x2e')](_0x4b1f8f[_0xc38d('0x2a')],qs[_0xc38d('0x30')](_0x1ab0b8[_0xc38d('0x2c')][_0xc38d('0x30')]));_0x3d09fa[_0xc38d('0x2f')]=_0x3d09fa['attributes'][_0xc38d('0x31')]?_0x3d09fa[_0xc38d('0x2f')]:_0x4b1f8f['model'];if(_0x1ab0b8[_0xc38d('0x2c')][_0xc38d('0x3c')]){_0x3d09fa['include']=[{'all':!![]}];}_0x3d09fa=_[_0xc38d('0x38')]({},_0x3d09fa,_0x1ab0b8[_0xc38d('0x3b')]);return db['CmContactHasPhone'][_0xc38d('0x43')](_0x3d09fa)[_0xc38d('0x1e')](handleEntityNotFound(_0x1a31ae,null))[_0xc38d('0x1e')](respondWithResult(_0x1a31ae,null))[_0xc38d('0x40')](handleError(_0x1a31ae,null));};exports[_0xc38d('0x44')]=function(_0x3622dc,_0x2abd78){return db[_0xc38d('0x26')][_0xc38d('0x44')](_0x3622dc[_0xc38d('0x45')],{})[_0xc38d('0x1e')](function(_0xb3ce98){var _0x245fc1=_0x3622dc[_0xc38d('0x46')]['get']({'plain':!![]});if(!_0x245fc1)throw new Error(_0xc38d('0x47'));if(_0x245fc1[_0xc38d('0x48')]===_0xc38d('0x46')){var _0x4d5445=_0xb3ce98[_0xc38d('0x1f')]({'plain':!![]});var _0x54e5b2=_0xc38d('0x49');return db[_0xc38d('0x4a')][_0xc38d('0x43')]({'where':{'name':_0x54e5b2,'userProfileId':_0x245fc1['userProfileId']},'raw':!![]})[_0xc38d('0x1e')](function(_0xbb151d){if(_0xbb151d&&_0xbb151d[_0xc38d('0x4b')]===0x0){return db[_0xc38d('0x20')]['create']({'name':_0x4d5445[_0xc38d('0x23')],'resourceId':_0x4d5445['id'],'type':_0xbb151d[_0xc38d('0x23')],'sectionId':_0xbb151d['id']},{})[_0xc38d('0x1e')](function(){return _0xb3ce98;});}else{return _0xb3ce98;}})[_0xc38d('0x40')](function(_0x2f64b1){logger[_0xc38d('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f64b1);throw _0x2f64b1;});}return _0xb3ce98;})['then'](respondWithResult(_0x2abd78,0xc9))[_0xc38d('0x40')](handleError(_0x2abd78,null));};exports[_0xc38d('0x1d')]=function(_0x444642,_0x4f52f3){if(_0x444642[_0xc38d('0x45')]['id']){delete _0x444642[_0xc38d('0x45')]['id'];}return db['CmContactHasPhone'][_0xc38d('0x43')]({'where':{'id':_0x444642[_0xc38d('0x41')]['id']}})[_0xc38d('0x1e')](handleEntityNotFound(_0x4f52f3,null))[_0xc38d('0x1e')](saveUpdates(_0x444642[_0xc38d('0x45')],null))[_0xc38d('0x1e')](respondWithResult(_0x4f52f3,null))[_0xc38d('0x40')](handleError(_0x4f52f3,null));};exports[_0xc38d('0x21')]=function(_0x36d5f0,_0x2a3dea){return db['CmContactHasPhone'][_0xc38d('0x43')]({'where':{'id':_0x36d5f0[_0xc38d('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a3dea,null))[_0xc38d('0x1e')](removeEntity(_0x2a3dea,null))[_0xc38d('0x40')](handleError(_0x2a3dea,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 58af56d..509e155 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 _0x117d=['bluebird','request-promise','path','rimraf','./cmContactHasPhone.attributes','exports','cm_contact_has_phones','lodash','util','../../config/logger','moment'];(function(_0x1abeb0,_0x36ab7a){var _0x3abfd1=function(_0x2bc6c2){while(--_0x2bc6c2){_0x1abeb0['push'](_0x1abeb0['shift']());}};_0x3abfd1(++_0x36ab7a);}(_0x117d,0xac));var _0xd117=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x117d[_0x435044];return _0x33d4c6;};'use strict';var _=require(_0xd117('0x0'));var util=require(_0xd117('0x1'));var logger=require(_0xd117('0x2'))('api');var moment=require(_0xd117('0x3'));var BPromise=require(_0xd117('0x4'));var rp=require(_0xd117('0x5'));var fs=require('fs');var path=require(_0xd117('0x6'));var rimraf=require(_0xd117('0x7'));var config=require('../../config/environment');var attributes=require(_0xd117('0x8'));module[_0xd117('0x9')]=function(_0xa760de,_0x55f7a3){return _0xa760de['define']('CmContactHasPhone',attributes,{'tableName':_0xd117('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ec7=['../../config/environment','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x264a0d,_0xfa9aac){var _0x8d4f6f=function(_0x25c1f7){while(--_0x25c1f7){_0x264a0d['push'](_0x264a0d['shift']());}};_0x8d4f6f(++_0xfa9aac);}(_0x0ec7,0x1dc));var _0x70ec=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0ec7[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x70ec('0x0'));var util=require(_0x70ec('0x1'));var logger=require(_0x70ec('0x2'))(_0x70ec('0x3'));var moment=require(_0x70ec('0x4'));var BPromise=require(_0x70ec('0x5'));var rp=require(_0x70ec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70ec('0x7'));var config=require(_0x70ec('0x8'));var attributes=require('./cmContactHasPhone.attributes');module['exports']=function(_0x225c64,_0x25500a){return _0x225c64['define'](_0x70ec('0x9'),attributes,{'tableName':_0x70ec('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 938d727..de31a7c 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 _0x30cf=['info','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2f8249,_0x47bb75){var _0x12b79e=function(_0x2bb957){while(--_0x2bb957){_0x2f8249['push'](_0x2f8249['shift']());}};_0x12b79e(++_0x47bb75);}(_0x30cf,0x93));var _0xf30c=function(_0x5f1cd4,_0x1339ac){_0x5f1cd4=_0x5f1cd4-0x0;var _0x3258aa=_0x30cf[_0x5f1cd4];return _0x3258aa;};'use strict';var _=require(_0xf30c('0x0'));var util=require(_0xf30c('0x1'));var moment=require(_0xf30c('0x2'));var BPromise=require(_0xf30c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf30c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf30c('0x5'));var logger=require(_0xf30c('0x6'))(_0xf30c('0x7'));var config=require(_0xf30c('0x8'));var jayson=require(_0xf30c('0x9'));var client=jayson[_0xf30c('0xa')][_0xf30c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x597c54,_0x712b15,_0x488b9e){return new BPromise(function(_0x3d2af1,_0x5456c6){return client[_0xf30c('0xc')](_0x597c54,_0x488b9e)[_0xf30c('0xd')](function(_0x376060){logger[_0xf30c('0xe')]('CmContactHasPhone,\x20%s,\x20%s',_0x712b15,_0xf30c('0xf'));logger[_0xf30c('0x10')](_0xf30c('0x11'),_0x712b15,'request\x20sent',JSON['stringify'](_0x376060));if(_0x376060[_0xf30c('0x12')]){if(_0x376060[_0xf30c('0x12')][_0xf30c('0x13')]===0x1f4){logger[_0xf30c('0x12')](_0xf30c('0x14'),_0x712b15,_0x376060[_0xf30c('0x12')]['message']);return _0x5456c6(_0x376060[_0xf30c('0x12')][_0xf30c('0x15')]);}logger[_0xf30c('0x12')](_0xf30c('0x14'),_0x712b15,_0x376060['error'][_0xf30c('0x15')]);return _0x3d2af1(_0x376060[_0xf30c('0x12')]['message']);}else{logger[_0xf30c('0xe')](_0xf30c('0x14'),_0x712b15,'request\x20sent');_0x3d2af1(_0x376060[_0xf30c('0x16')][_0xf30c('0x15')]);}})['catch'](function(_0x29a496){logger['error'](_0xf30c('0x14'),_0x712b15,_0x29a496);_0x5456c6(_0x29a496);});});} \ No newline at end of file +var _0x8cb8=['client','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x4d1948,_0x3a9b30){var _0x433a2a=function(_0xda07d3){while(--_0xda07d3){_0x4d1948['push'](_0x4d1948['shift']());}};_0x433a2a(++_0x3a9b30);}(_0x8cb8,0x1da));var _0x88cb=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x8cb8[_0x44039a];return _0x525de5;};'use strict';var _=require('lodash');var util=require(_0x88cb('0x0'));var moment=require('moment');var BPromise=require(_0x88cb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88cb('0x2'))['db'];var utils=require(_0x88cb('0x3'));var logger=require(_0x88cb('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x88cb('0x5'));var client=jayson[_0x88cb('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47a263,_0x202c6a,_0x5e23e1){return new BPromise(function(_0x549b92,_0x163174){return client['request'](_0x47a263,_0x5e23e1)['then'](function(_0x261d83){logger[_0x88cb('0x7')](_0x88cb('0x8'),_0x202c6a,_0x88cb('0x9'));logger['debug'](_0x88cb('0xa'),_0x202c6a,_0x88cb('0x9'),JSON[_0x88cb('0xb')](_0x261d83));if(_0x261d83[_0x88cb('0xc')]){if(_0x261d83[_0x88cb('0xc')]['code']===0x1f4){logger['error'](_0x88cb('0x8'),_0x202c6a,_0x261d83[_0x88cb('0xc')][_0x88cb('0xd')]);return _0x163174(_0x261d83[_0x88cb('0xc')][_0x88cb('0xd')]);}logger[_0x88cb('0xc')](_0x88cb('0x8'),_0x202c6a,_0x261d83[_0x88cb('0xc')][_0x88cb('0xd')]);return _0x549b92(_0x261d83['error'][_0x88cb('0xd')]);}else{logger[_0x88cb('0x7')](_0x88cb('0x8'),_0x202c6a,_0x88cb('0x9'));_0x549b92(_0x261d83[_0x88cb('0xe')][_0x88cb('0xd')]);}})[_0x88cb('0xf')](function(_0xbe8e9d){logger['error'](_0x88cb('0x8'),_0x202c6a,_0xbe8e9d);_0x163174(_0xbe8e9d);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 0d80363..ff2da3f 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 _0xf83c=['./cmContactHasPhone.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf83c,0x14a));var _0xcf83=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0xf83c[_0x473ee7];return _0x30f0d4;};'use strict';var multer=require(_0xcf83('0x0'));var util=require(_0xcf83('0x1'));var path=require(_0xcf83('0x2'));var timeout=require(_0xcf83('0x3'));var express=require('express');var router=express[_0xcf83('0x4')]();var auth=require(_0xcf83('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcf83('0x6'));router['get']('/',auth[_0xcf83('0x7')](),controller[_0xcf83('0x8')]);router['get'](_0xcf83('0x9'),auth[_0xcf83('0x7')](),controller[_0xcf83('0xa')]);router[_0xcf83('0xb')]('/',auth[_0xcf83('0x7')](),controller[_0xcf83('0xc')]);router[_0xcf83('0xd')](_0xcf83('0x9'),auth[_0xcf83('0x7')](),controller[_0xcf83('0xe')]);router[_0xcf83('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfc1c=['Router','../../components/auth/service','../../components/interaction/service','./cmContactHasPhone.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x24fcf3,_0x87a2c4){var _0x4b6ed6=function(_0x59717d){while(--_0x59717d){_0x24fcf3['push'](_0x24fcf3['shift']());}};_0x4b6ed6(++_0x87a2c4);}(_0xfc1c,0x119));var _0xcfc1=function(_0x45f0ab,_0x166cd2){_0x45f0ab=_0x45f0ab-0x0;var _0x53e0ee=_0xfc1c[_0x45f0ab];return _0x53e0ee;};'use strict';var multer=require('multer');var util=require(_0xcfc1('0x0'));var path=require(_0xcfc1('0x1'));var timeout=require(_0xcfc1('0x2'));var express=require(_0xcfc1('0x3'));var router=express[_0xcfc1('0x4')]();var auth=require(_0xcfc1('0x5'));var interaction=require(_0xcfc1('0x6'));var config=require('../../config/environment');var controller=require(_0xcfc1('0x7'));router['get']('/',auth[_0xcfc1('0x8')](),controller[_0xcfc1('0x9')]);router[_0xcfc1('0xa')](_0xcfc1('0xb'),auth[_0xcfc1('0x8')](),controller['show']);router[_0xcfc1('0xc')]('/',auth[_0xcfc1('0x8')](),controller[_0xcfc1('0xd')]);router[_0xcfc1('0xe')](_0xcfc1('0xb'),auth[_0xcfc1('0x8')](),controller[_0xcfc1('0xf')]);router[_0xcfc1('0x10')](_0xcfc1('0xb'),auth[_0xcfc1('0x8')](),controller[_0xcfc1('0x11')]);module[_0xcfc1('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 36f8a18..53b6075 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 _0x136a=['BOOLEAN','sequelize','lodash','exports','getDataValue','alias','STRING','parse','values','setDataValue','stringify'];(function(_0x5d1ea2,_0x11173e){var _0x10cc67=function(_0xe0855b){while(--_0xe0855b){_0x5d1ea2['push'](_0x5d1ea2['shift']());}};_0x10cc67(++_0x11173e);}(_0x136a,0x11f));var _0xa136=function(_0x59f9d1,_0x1a58d0){_0x59f9d1=_0x59f9d1-0x0;var _0x54c621=_0x136a[_0x59f9d1];return _0x54c621;};'use strict';var Sequelize=require(_0xa136('0x0'));var _=require(_0xa136('0x1'));module[_0xa136('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xd34acf){return this[_0xa136('0x3')](_0xa136('0x4'));}},'alias':{'type':Sequelize[_0xa136('0x5')],'allowNull':![],'set':function(_0x203920){this['setDataValue'](_0xa136('0x4'),_0x203920?_0x203920:this[_0xa136('0x3')]('name'));}},'type':{'type':Sequelize[_0xa136('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xa136('0x3')]('type')==='select'){return JSON[_0xa136('0x6')](this['getDataValue'](_0xa136('0x7')));}else{return this[_0xa136('0x3')](_0xa136('0x7'));}},'set':function(_0x4db26a){if(Array['isArray'](_0x4db26a)){this[_0xa136('0x8')](_0xa136('0x7'),JSON[_0xa136('0x9')](_0x4db26a));}else{this[_0xa136('0x8')](_0xa136('0x7'),_0x4db26a);}}},'required':{'type':Sequelize[_0xa136('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x30c9=['setDataValue','alias','name','STRING','TEXT','long','type','select','parse','values','isArray','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x264d9e,_0x11bf26){var _0x45a214=function(_0x2ecf95){while(--_0x2ecf95){_0x264d9e['push'](_0x264d9e['shift']());}};_0x45a214(++_0x11bf26);}(_0x30c9,0x1db));var _0x930c=function(_0x57b02f,_0x58db5a){_0x57b02f=_0x57b02f-0x0;var _0x5d301d=_0x30c9[_0x57b02f];return _0x5d301d;};'use strict';var Sequelize=require(_0x930c('0x0'));var _=require(_0x930c('0x1'));module[_0x930c('0x2')]={'name':{'type':Sequelize[_0x930c('0x3')],'get':function(_0x8982ff){return this[_0x930c('0x4')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x45fcc6){this[_0x930c('0x5')](_0x930c('0x6'),_0x45fcc6?_0x45fcc6:this['getDataValue'](_0x930c('0x7')));}},'type':{'type':Sequelize[_0x930c('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x930c('0x9')](_0x930c('0xa')),'get':function(){if(this[_0x930c('0x4')](_0x930c('0xb'))===_0x930c('0xc')){return JSON[_0x930c('0xd')](this['getDataValue'](_0x930c('0xe')));}else{return this[_0x930c('0x4')](_0x930c('0xe'));}},'set':function(_0x232540){if(Array[_0x930c('0xf')](_0x232540)){this[_0x930c('0x5')]('values',JSON['stringify'](_0x232540));}else{this[_0x930c('0x5')]('values',_0x232540);}}},'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 703f4b0..6078b56 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 _0x47d4=['find','body','create','sequelize','Sequelize','TEXT','INTEGER','switch','defaultValue','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','limit','set','json','reject','save','update','destroy','then','end','name','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','options'];(function(_0xf7bf02,_0x13da13){var _0x4f263f=function(_0x3b5603){while(--_0x3b5603){_0xf7bf02['push'](_0xf7bf02['shift']());}};_0x4f263f(++_0x13da13);}(_0x47d4,0x1a7));var _0x447d=function(_0x3c81ab,_0xaffc9f){_0x3c81ab=_0x3c81ab-0x0;var _0x120d48=_0x47d4[_0x3c81ab];return _0x120d48;};'use strict';var pdf=require(_0x447d('0x0'));var emlformat=require(_0x447d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x447d('0x2'));var jsonpatch=require(_0x447d('0x3'));var rp=require(_0x447d('0x4'));var moment=require(_0x447d('0x5'));var BPromise=require(_0x447d('0x6'));var Mustache=require(_0x447d('0x7'));var util=require(_0x447d('0x8'));var path=require(_0x447d('0x9'));var sox=require(_0x447d('0xa'));var csv=require(_0x447d('0xb'));var ejs=require(_0x447d('0xc'));var fs=require('fs');var _=require(_0x447d('0xd'));var squel=require(_0x447d('0xe'));var crypto=require('crypto');var jsforce=require(_0x447d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x447d('0xb'));var querystring=require(_0x447d('0x10'));var Papa=require(_0x447d('0x11'));var Redis=require(_0x447d('0x12'));var authService=require(_0x447d('0x13'));var qs=require(_0x447d('0x14'));var as=require(_0x447d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x447d('0x16'))('api');var utils=require(_0x447d('0x17'));var config=require('../../config/environment');var db=require(_0x447d('0x18'))['db'];function respondWithStatusCode(_0x5cf789,_0x389064){_0x389064=_0x389064||0xcc;return function(_0x58ceb9){if(_0x58ceb9){return _0x5cf789[_0x447d('0x19')](_0x389064);}return _0x5cf789[_0x447d('0x1a')](_0x389064)['end']();};}function respondWithResult(_0x20b977,_0x4fd454){_0x4fd454=_0x4fd454||0xc8;return function(_0x2ead3f){if(_0x2ead3f){return _0x20b977[_0x447d('0x1a')](_0x4fd454)['json'](_0x2ead3f);}};}function respondWithFilteredResult(_0x4f3e9b,_0x3a1e64){return function(_0x360ec0){if(_0x360ec0){var _0xc06f20=_0x360ec0[_0x447d('0x1b')],_0x13bcfb=_0x3a1e64['offset'],_0xbdac5b=_0x3a1e64['offset']+_0x3a1e64[_0x447d('0x1c')],_0x58f4af;if(_0xbdac5b>=_0xc06f20){_0xbdac5b=_0xc06f20;_0x58f4af=0xc8;}else{_0x58f4af=0xce;}_0x4f3e9b[_0x447d('0x1a')](_0x58f4af);return _0x4f3e9b[_0x447d('0x1d')]('Content-Range',_0x13bcfb+'-'+_0xbdac5b+'/'+_0xc06f20)[_0x447d('0x1e')](_0x360ec0);}return null;};}function patchUpdates(_0xc0cd84){return function(_0x340181){try{jsonpatch['apply'](_0x340181,_0xc0cd84,!![]);}catch(_0x1aba40){return BPromise[_0x447d('0x1f')](_0x1aba40);}return _0x340181[_0x447d('0x20')]();};}function saveUpdates(_0x26cf1e,_0x1438a4){return function(_0x14c5c3){if(_0x14c5c3){return _0x14c5c3[_0x447d('0x21')](_0x26cf1e)['then'](function(_0x31a8e8){return _0x31a8e8;});}return null;};}function removeEntity(_0x4ebd08,_0x239202){return function(_0x56127e){if(_0x56127e){return _0x56127e[_0x447d('0x22')]()[_0x447d('0x23')](function(){_0x4ebd08['status'](0xcc)[_0x447d('0x24')]();});}};}function handleEntityNotFound(_0x4e4460,_0x710031){return function(_0x2b88b1){if(!_0x2b88b1){_0x4e4460[_0x447d('0x19')](0x194);}return _0x2b88b1;};}function handleError(_0x444d4a,_0x33316f){_0x33316f=_0x33316f||0x1f4;return function(_0x5f30b8){logger['error'](_0x5f30b8['stack']);if(_0x5f30b8[_0x447d('0x25')]){delete _0x5f30b8[_0x447d('0x25')];}_0x444d4a[_0x447d('0x1a')](_0x33316f)['send'](_0x5f30b8);};}exports[_0x447d('0x26')]=function(_0x2db0e6,_0x4eeb31){var _0x110515={},_0x480834={},_0x5a9c14={'count':0x0,'rows':[]};var _0x42d2cc=_[_0x447d('0x27')](db[_0x447d('0x28')][_0x447d('0x29')],function(_0x455beb){return{'name':_0x455beb['fieldName'],'type':_0x455beb[_0x447d('0x2a')][_0x447d('0x2b')]};});_0x480834[_0x447d('0x2c')]=_[_0x447d('0x2d')](_[_0x447d('0x27')](_0x42d2cc,_0x447d('0x25')),[_0x447d('0x25')]);_0x480834[_0x447d('0x2e')]=_['keys'](_0x2db0e6['query']);_0x480834['filters']=_['intersection'](_0x480834['model'],_0x480834[_0x447d('0x2e')]);_0x110515[_0x447d('0x2f')]=_[_0x447d('0x30')](_0x480834[_0x447d('0x2c')],qs[_0x447d('0x31')](_0x2db0e6[_0x447d('0x2e')][_0x447d('0x31')]));_0x110515[_0x447d('0x2f')]=_0x110515[_0x447d('0x2f')][_0x447d('0x32')]?_0x110515[_0x447d('0x2f')]:_0x480834[_0x447d('0x2c')];if(!_0x2db0e6[_0x447d('0x2e')][_0x447d('0x33')]('nolimit')){_0x110515[_0x447d('0x1c')]=qs[_0x447d('0x1c')](_0x2db0e6[_0x447d('0x2e')][_0x447d('0x1c')]);_0x110515[_0x447d('0x34')]=qs[_0x447d('0x34')](_0x2db0e6[_0x447d('0x2e')][_0x447d('0x34')]);}_0x110515[_0x447d('0x35')]=qs[_0x447d('0x36')](_0x2db0e6['query'][_0x447d('0x36')]);_0x110515[_0x447d('0x37')]=qs[_0x447d('0x38')](_[_0x447d('0x39')](_0x2db0e6[_0x447d('0x2e')],_0x480834['filters']),_0x42d2cc);if(_0x2db0e6[_0x447d('0x2e')][_0x447d('0x3a')]){_0x110515['where']=_['merge'](_0x110515['where'],{'$or':_[_0x447d('0x27')](_0x42d2cc,function(_0x266ce5){if(_0x266ce5[_0x447d('0x2a')]!==_0x447d('0x3b')){var _0x373d54={};_0x373d54[_0x266ce5[_0x447d('0x25')]]={'$like':'%'+_0x2db0e6['query'][_0x447d('0x3a')]+'%'};return _0x373d54;}})});}_0x110515=_[_0x447d('0x3c')]({},_0x110515,_0x2db0e6['options']);var _0x3182f2={'where':_0x110515[_0x447d('0x37')]};return db['CmCustomField'][_0x447d('0x1b')](_0x3182f2)[_0x447d('0x23')](function(_0x3834b2){_0x5a9c14['count']=_0x3834b2;if(_0x2db0e6[_0x447d('0x2e')]['includeAll']){_0x110515[_0x447d('0x3d')]=[{'all':!![]}];}return db[_0x447d('0x28')][_0x447d('0x3e')](_0x110515);})['then'](function(_0x25cdf4){_0x5a9c14[_0x447d('0x3f')]=_0x25cdf4;return _0x5a9c14;})[_0x447d('0x23')](respondWithFilteredResult(_0x4eeb31,_0x110515))[_0x447d('0x40')](handleError(_0x4eeb31,null));};exports[_0x447d('0x41')]=function(_0x4e754e,_0x5b5254){var _0x2464ff={'raw':!![],'where':{'id':_0x4e754e[_0x447d('0x42')]['id']}},_0x1b0178={};_0x1b0178['model']=_['keys'](db[_0x447d('0x28')]['rawAttributes']);_0x1b0178[_0x447d('0x2e')]=_[_0x447d('0x43')](_0x4e754e[_0x447d('0x2e')]);_0x1b0178[_0x447d('0x38')]=_['intersection'](_0x1b0178[_0x447d('0x2c')],_0x1b0178[_0x447d('0x2e')]);_0x2464ff[_0x447d('0x2f')]=_['intersection'](_0x1b0178[_0x447d('0x2c')],qs['fields'](_0x4e754e[_0x447d('0x2e')][_0x447d('0x31')]));_0x2464ff[_0x447d('0x2f')]=_0x2464ff[_0x447d('0x2f')]['length']?_0x2464ff[_0x447d('0x2f')]:_0x1b0178[_0x447d('0x2c')];if(_0x4e754e[_0x447d('0x2e')]['includeAll']){_0x2464ff['include']=[{'all':!![]}];}_0x2464ff=_['merge']({},_0x2464ff,_0x4e754e[_0x447d('0x44')]);return db[_0x447d('0x28')][_0x447d('0x45')](_0x2464ff)[_0x447d('0x23')](handleEntityNotFound(_0x5b5254,null))[_0x447d('0x23')](respondWithResult(_0x5b5254,null))[_0x447d('0x40')](handleError(_0x5b5254,null));};exports[_0x447d('0x21')]=function(_0x311d04,_0xc05de0){if(_0x311d04['body']['id']){delete _0x311d04['body']['id'];}return db['CmCustomField'][_0x447d('0x45')]({'where':{'id':_0x311d04[_0x447d('0x42')]['id']}})['then'](handleEntityNotFound(_0xc05de0,null))['then'](saveUpdates(_0x311d04[_0x447d('0x46')],null))[_0x447d('0x23')](respondWithResult(_0xc05de0,null))[_0x447d('0x40')](handleError(_0xc05de0,null));};exports[_0x447d('0x22')]=function(_0x3e29e1,_0x432838){return db[_0x447d('0x28')][_0x447d('0x45')]({'where':{'id':_0x3e29e1['params']['id']}})[_0x447d('0x23')](handleEntityNotFound(_0x432838,null))[_0x447d('0x23')](removeEntity(_0x432838,null))[_0x447d('0x40')](handleError(_0x432838,null));};exports[_0x447d('0x47')]=function(_0x31e93a,_0x26761a){var _0xd4b421;return db[_0x447d('0x48')]['transaction'](function(_0x41cdb5){return db['CmCustomField'][_0x447d('0x47')](_0x31e93a[_0x447d('0x46')],{'transaction':_0x41cdb5})[_0x447d('0x23')](function(_0xe9ae60){_0xd4b421=_0xe9ae60;var _0xe1fc8={'type':db[_0x447d('0x49')][_0x447d('0x4a')],'transaction':_0x41cdb5};switch(_0x31e93a[_0x447d('0x46')][_0x447d('0x2a')]){case'text':_0xe1fc8[_0x447d('0x2a')]=db[_0x447d('0x49')][_0x447d('0x4a')];break;case'number':_0xe1fc8[_0x447d('0x2a')]=db['Sequelize'][_0x447d('0x4b')];break;case _0x447d('0x4c'):_0xe1fc8[_0x447d('0x2a')]=db['Sequelize']['BOOLEAN'];_0xe1fc8[_0x447d('0x4d')]=![];break;default:}return db[_0x447d('0x48')]['queryInterface'][_0x447d('0x4e')](_0x447d('0x4f'),util[_0x447d('0x50')](_0x447d('0x51'),_0xd4b421['id']),_0xe1fc8);})[_0x447d('0x23')](function(){return _0xd4b421;});})['then'](respondWithResult(_0x26761a,0xc9))[_0x447d('0x40')](handleError(_0x26761a,null));}; \ No newline at end of file +var _0xd2eb=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','index','CmCustomField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','map','VIRTUAL','name','options','count','includeAll','include','findAll','catch','show','params','body','find','create','sequelize','transaction','text','Sequelize','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x59f4c2,_0x87202){var _0xe3dfd1=function(_0x236c6f){while(--_0x236c6f){_0x59f4c2['push'](_0x59f4c2['shift']());}};_0xe3dfd1(++_0x87202);}(_0xd2eb,0x1d4));var _0xbd2e=function(_0x2d46ab,_0x4c8990){_0x2d46ab=_0x2d46ab-0x0;var _0x446733=_0xd2eb[_0x2d46ab];return _0x446733;};'use strict';var pdf=require(_0xbd2e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbd2e('0x1'));var zipdir=require(_0xbd2e('0x2'));var jsonpatch=require(_0xbd2e('0x3'));var rp=require(_0xbd2e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd2e('0x5'));var util=require('util');var path=require(_0xbd2e('0x6'));var sox=require(_0xbd2e('0x7'));var csv=require('to-csv');var ejs=require(_0xbd2e('0x8'));var fs=require('fs');var _=require(_0xbd2e('0x9'));var squel=require(_0xbd2e('0xa'));var crypto=require(_0xbd2e('0xb'));var jsforce=require(_0xbd2e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbd2e('0xd'));var querystring=require(_0xbd2e('0xe'));var Papa=require(_0xbd2e('0xf'));var Redis=require(_0xbd2e('0x10'));var authService=require(_0xbd2e('0x11'));var qs=require(_0xbd2e('0x12'));var as=require(_0xbd2e('0x13'));var hardwareService=require(_0xbd2e('0x14'));var logger=require(_0xbd2e('0x15'))(_0xbd2e('0x16'));var utils=require(_0xbd2e('0x17'));var config=require(_0xbd2e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe70cd8,_0x1e02f1){_0x1e02f1=_0x1e02f1||0xcc;return function(_0x1b56f6){if(_0x1b56f6){return _0xe70cd8['sendStatus'](_0x1e02f1);}return _0xe70cd8[_0xbd2e('0x19')](_0x1e02f1)['end']();};}function respondWithResult(_0x35c71,_0x30b84b){_0x30b84b=_0x30b84b||0xc8;return function(_0x8ec13d){if(_0x8ec13d){return _0x35c71[_0xbd2e('0x19')](_0x30b84b)[_0xbd2e('0x1a')](_0x8ec13d);}};}function respondWithFilteredResult(_0x115147,_0x2b4ad0){return function(_0x4e9932){if(_0x4e9932){var _0x50ba8d=_0x4e9932['count'],_0x2e47c7=_0x2b4ad0[_0xbd2e('0x1b')],_0x2b04c8=_0x2b4ad0[_0xbd2e('0x1b')]+_0x2b4ad0[_0xbd2e('0x1c')],_0x4e921c;if(_0x2b04c8>=_0x50ba8d){_0x2b04c8=_0x50ba8d;_0x4e921c=0xc8;}else{_0x4e921c=0xce;}_0x115147['status'](_0x4e921c);return _0x115147[_0xbd2e('0x1d')](_0xbd2e('0x1e'),_0x2e47c7+'-'+_0x2b04c8+'/'+_0x50ba8d)[_0xbd2e('0x1a')](_0x4e9932);}return null;};}function patchUpdates(_0x42ed25){return function(_0x1b8335){try{jsonpatch[_0xbd2e('0x1f')](_0x1b8335,_0x42ed25,!![]);}catch(_0x12d125){return BPromise[_0xbd2e('0x20')](_0x12d125);}return _0x1b8335['save']();};}function saveUpdates(_0xefb658,_0x1ace2a){return function(_0x277d38){if(_0x277d38){return _0x277d38[_0xbd2e('0x21')](_0xefb658)[_0xbd2e('0x22')](function(_0x14cb39){return _0x14cb39;});}return null;};}function removeEntity(_0x2952a5,_0x10bf56){return function(_0x37bb8d){if(_0x37bb8d){return _0x37bb8d[_0xbd2e('0x23')]()[_0xbd2e('0x22')](function(){_0x2952a5[_0xbd2e('0x19')](0xcc)[_0xbd2e('0x24')]();});}};}function handleEntityNotFound(_0x50a736,_0x3d73bb){return function(_0x26cae8){if(!_0x26cae8){_0x50a736[_0xbd2e('0x25')](0x194);}return _0x26cae8;};}function handleError(_0x53aa4,_0x299770){_0x299770=_0x299770||0x1f4;return function(_0x3900cf){logger['error'](_0x3900cf['stack']);if(_0x3900cf['name']){delete _0x3900cf['name'];}_0x53aa4['status'](_0x299770)['send'](_0x3900cf);};}exports[_0xbd2e('0x26')]=function(_0x24295a,_0x528d89){var _0x14e305={},_0x46e2d4={},_0x173e9a={'count':0x0,'rows':[]};var _0x43dd49=_['map'](db[_0xbd2e('0x27')][_0xbd2e('0x28')],function(_0x2a44d6){return{'name':_0x2a44d6[_0xbd2e('0x29')],'type':_0x2a44d6[_0xbd2e('0x2a')][_0xbd2e('0x2b')]};});_0x46e2d4[_0xbd2e('0x2c')]=_['differenceBy'](_['map'](_0x43dd49,'name'),['name']);_0x46e2d4['query']=_[_0xbd2e('0x2d')](_0x24295a[_0xbd2e('0x2e')]);_0x46e2d4[_0xbd2e('0x2f')]=_[_0xbd2e('0x30')](_0x46e2d4[_0xbd2e('0x2c')],_0x46e2d4[_0xbd2e('0x2e')]);_0x14e305[_0xbd2e('0x31')]=_[_0xbd2e('0x30')](_0x46e2d4[_0xbd2e('0x2c')],qs['fields'](_0x24295a['query'][_0xbd2e('0x32')]));_0x14e305[_0xbd2e('0x31')]=_0x14e305[_0xbd2e('0x31')][_0xbd2e('0x33')]?_0x14e305[_0xbd2e('0x31')]:_0x46e2d4['model'];if(!_0x24295a[_0xbd2e('0x2e')][_0xbd2e('0x34')](_0xbd2e('0x35'))){_0x14e305[_0xbd2e('0x1c')]=qs[_0xbd2e('0x1c')](_0x24295a['query'][_0xbd2e('0x1c')]);_0x14e305[_0xbd2e('0x1b')]=qs[_0xbd2e('0x1b')](_0x24295a['query'][_0xbd2e('0x1b')]);}_0x14e305['order']=qs['sort'](_0x24295a['query'][_0xbd2e('0x36')]);_0x14e305['where']=qs[_0xbd2e('0x2f')](_[_0xbd2e('0x37')](_0x24295a[_0xbd2e('0x2e')],_0x46e2d4[_0xbd2e('0x2f')]),_0x43dd49);if(_0x24295a['query']['filter']){_0x14e305[_0xbd2e('0x38')]=_[_0xbd2e('0x39')](_0x14e305['where'],{'$or':_[_0xbd2e('0x3a')](_0x43dd49,function(_0x369ea2){if(_0x369ea2[_0xbd2e('0x2a')]!==_0xbd2e('0x3b')){var _0x101fc2={};_0x101fc2[_0x369ea2[_0xbd2e('0x3c')]]={'$like':'%'+_0x24295a['query']['filter']+'%'};return _0x101fc2;}})});}_0x14e305=_[_0xbd2e('0x39')]({},_0x14e305,_0x24295a[_0xbd2e('0x3d')]);var _0x445bad={'where':_0x14e305['where']};return db[_0xbd2e('0x27')][_0xbd2e('0x3e')](_0x445bad)[_0xbd2e('0x22')](function(_0x6b811a){_0x173e9a[_0xbd2e('0x3e')]=_0x6b811a;if(_0x24295a['query'][_0xbd2e('0x3f')]){_0x14e305[_0xbd2e('0x40')]=[{'all':!![]}];}return db['CmCustomField'][_0xbd2e('0x41')](_0x14e305);})['then'](function(_0x2eaf4f){_0x173e9a['rows']=_0x2eaf4f;return _0x173e9a;})[_0xbd2e('0x22')](respondWithFilteredResult(_0x528d89,_0x14e305))[_0xbd2e('0x42')](handleError(_0x528d89,null));};exports[_0xbd2e('0x43')]=function(_0x3dd613,_0x39049){var _0x16c32b={'raw':!![],'where':{'id':_0x3dd613[_0xbd2e('0x44')]['id']}},_0x56bc2e={};_0x56bc2e[_0xbd2e('0x2c')]=_['keys'](db[_0xbd2e('0x27')]['rawAttributes']);_0x56bc2e[_0xbd2e('0x2e')]=_[_0xbd2e('0x2d')](_0x3dd613[_0xbd2e('0x2e')]);_0x56bc2e[_0xbd2e('0x2f')]=_['intersection'](_0x56bc2e[_0xbd2e('0x2c')],_0x56bc2e['query']);_0x16c32b[_0xbd2e('0x31')]=_['intersection'](_0x56bc2e['model'],qs[_0xbd2e('0x32')](_0x3dd613[_0xbd2e('0x2e')]['fields']));_0x16c32b['attributes']=_0x16c32b['attributes']['length']?_0x16c32b['attributes']:_0x56bc2e[_0xbd2e('0x2c')];if(_0x3dd613['query'][_0xbd2e('0x3f')]){_0x16c32b[_0xbd2e('0x40')]=[{'all':!![]}];}_0x16c32b=_[_0xbd2e('0x39')]({},_0x16c32b,_0x3dd613[_0xbd2e('0x3d')]);return db[_0xbd2e('0x27')]['find'](_0x16c32b)[_0xbd2e('0x22')](handleEntityNotFound(_0x39049,null))[_0xbd2e('0x22')](respondWithResult(_0x39049,null))[_0xbd2e('0x42')](handleError(_0x39049,null));};exports['update']=function(_0x551e8d,_0x47da76){if(_0x551e8d[_0xbd2e('0x45')]['id']){delete _0x551e8d['body']['id'];}return db['CmCustomField']['find']({'where':{'id':_0x551e8d['params']['id']}})[_0xbd2e('0x22')](handleEntityNotFound(_0x47da76,null))['then'](saveUpdates(_0x551e8d[_0xbd2e('0x45')],null))[_0xbd2e('0x22')](respondWithResult(_0x47da76,null))[_0xbd2e('0x42')](handleError(_0x47da76,null));};exports[_0xbd2e('0x23')]=function(_0x3f7dc8,_0x134c4f){return db[_0xbd2e('0x27')][_0xbd2e('0x46')]({'where':{'id':_0x3f7dc8[_0xbd2e('0x44')]['id']}})[_0xbd2e('0x22')](handleEntityNotFound(_0x134c4f,null))[_0xbd2e('0x22')](removeEntity(_0x134c4f,null))[_0xbd2e('0x42')](handleError(_0x134c4f,null));};exports[_0xbd2e('0x47')]=function(_0x22cb59,_0x1b48b4){var _0x4d980c;return db[_0xbd2e('0x48')][_0xbd2e('0x49')](function(_0x4f9591){return db[_0xbd2e('0x27')][_0xbd2e('0x47')](_0x22cb59[_0xbd2e('0x45')],{'transaction':_0x4f9591})[_0xbd2e('0x22')](function(_0x247f43){_0x4d980c=_0x247f43;var _0x2b8e84={'type':db['Sequelize']['TEXT'],'transaction':_0x4f9591};switch(_0x22cb59[_0xbd2e('0x45')][_0xbd2e('0x2a')]){case _0xbd2e('0x4a'):_0x2b8e84[_0xbd2e('0x2a')]=db[_0xbd2e('0x4b')]['TEXT'];break;case'number':_0x2b8e84[_0xbd2e('0x2a')]=db['Sequelize']['INTEGER'];break;case _0xbd2e('0x4c'):_0x2b8e84[_0xbd2e('0x2a')]=db[_0xbd2e('0x4b')][_0xbd2e('0x4d')];_0x2b8e84[_0xbd2e('0x4e')]=![];break;default:}return db[_0xbd2e('0x48')]['queryInterface'][_0xbd2e('0x4f')](_0xbd2e('0x50'),util['format']('cf_%d',_0x4d980c['id']),_0x2b8e84);})[_0xbd2e('0x22')](function(){return _0x4d980c;});})['then'](respondWithResult(_0x1b48b4,0xc9))[_0xbd2e('0x42')](handleError(_0x1b48b4,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6de55f7..7451e73 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 _0xa887=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2c2980,_0xbc3da6){var _0x4601a6=function(_0x49a1bb){while(--_0x49a1bb){_0x2c2980['push'](_0x2c2980['shift']());}};_0x4601a6(++_0xbc3da6);}(_0xa887,0x89));var _0x7a88=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa887[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7a88('0x0'));var util=require('util');var logger=require(_0x7a88('0x1'))(_0x7a88('0x2'));var moment=require('moment');var BPromise=require(_0x7a88('0x3'));var rp=require(_0x7a88('0x4'));var fs=require('fs');var path=require(_0x7a88('0x5'));var rimraf=require(_0x7a88('0x6'));var config=require(_0x7a88('0x7'));var attributes=require(_0x7a88('0x8'));module[_0x7a88('0x9')]=function(_0xf70f6,_0x12fabf){return _0xf70f6['define'](_0x7a88('0xa'),attributes,{'tableName':_0x7a88('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27c8=['path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','util','../../config/logger','bluebird','request-promise'];(function(_0x38495b,_0x11e1e2){var _0x529cd6=function(_0x4a48c8){while(--_0x4a48c8){_0x38495b['push'](_0x38495b['shift']());}};_0x529cd6(++_0x11e1e2);}(_0x27c8,0x6a));var _0x827c=function(_0x3be8ec,_0x5309fb){_0x3be8ec=_0x3be8ec-0x0;var _0x14c30e=_0x27c8[_0x3be8ec];return _0x14c30e;};'use strict';var _=require('lodash');var util=require(_0x827c('0x0'));var logger=require(_0x827c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x827c('0x2'));var rp=require(_0x827c('0x3'));var fs=require('fs');var path=require(_0x827c('0x4'));var rimraf=require(_0x827c('0x5'));var config=require(_0x827c('0x6'));var attributes=require(_0x827c('0x7'));module['exports']=function(_0x56b4eb,_0x390119){return _0x56b4eb[_0x827c('0x8')](_0x827c('0x9'),attributes,{'tableName':_0x827c('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index dbad6ee..8128cd1 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 _0xbb53=['http','then','info','request\x20sent','stringify','error','message','CmCustomField,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xbb53,0x121));var _0x3bb5=function(_0x38e1c0,_0x439ba1){_0x38e1c0=_0x38e1c0-0x0;var _0x31d04b=_0xbb53[_0x38e1c0];return _0x31d04b;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('CmCustomField,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('CmCustomField,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});} \ No newline at end of file +var _0x5089=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4dca4f,_0x3d3989){var _0xb1f24e=function(_0x125f21){while(--_0x125f21){_0x4dca4f['push'](_0x4dca4f['shift']());}};_0xb1f24e(++_0x3d3989);}(_0x5089,0x1bb));var _0x9508=function(_0x34e14d,_0x5dea39){_0x34e14d=_0x34e14d-0x0;var _0x3d8e08=_0x5089[_0x34e14d];return _0x3d8e08;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var moment=require('moment');var BPromise=require(_0x9508('0x2'));var rs=require(_0x9508('0x3'));var fs=require('fs');var Redis=require(_0x9508('0x4'));var db=require(_0x9508('0x5'))['db'];var utils=require(_0x9508('0x6'));var logger=require('../../config/logger')(_0x9508('0x7'));var config=require('../../config/environment');var jayson=require(_0x9508('0x8'));var client=jayson[_0x9508('0x9')][_0x9508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ab3c6,_0x1dc04c,_0x42d13a){return new BPromise(function(_0x55a5de,_0x14dae7){return client[_0x9508('0xb')](_0x4ab3c6,_0x42d13a)['then'](function(_0x342ddd){logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));logger[_0x9508('0xe')](_0x9508('0xf'),_0x1dc04c,_0x9508('0xd'),JSON[_0x9508('0x10')](_0x342ddd));if(_0x342ddd['error']){if(_0x342ddd[_0x9508('0x11')]['code']===0x1f4){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x342ddd['error'][_0x9508('0x12')]);return _0x14dae7(_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);}logger[_0x9508('0x11')]('CmCustomField,\x20%s,\x20%s',_0x1dc04c,_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);return _0x55a5de(_0x342ddd['error'][_0x9508('0x12')]);}else{logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));_0x55a5de(_0x342ddd[_0x9508('0x13')][_0x9508('0x12')]);}})[_0x9508('0x14')](function(_0x343802){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x343802);_0x14dae7(_0x343802);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4fdf1cb..0df42c3 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 _0xd3a3=['express','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x2621ac,_0x4d8774){var _0x57bc8c=function(_0x2cdfef){while(--_0x2cdfef){_0x2621ac['push'](_0x2621ac['shift']());}};_0x57bc8c(++_0x4d8774);}(_0xd3a3,0xb1));var _0x3d3a=function(_0x3cc688,_0x5c9ad2){_0x3cc688=_0x3cc688-0x0;var _0x2128f7=_0xd3a3[_0x3cc688];return _0x2128f7;};'use strict';var multer=require(_0x3d3a('0x0'));var util=require(_0x3d3a('0x1'));var path=require('path');var timeout=require(_0x3d3a('0x2'));var express=require(_0x3d3a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3d3a('0x4'));var config=require(_0x3d3a('0x5'));var controller=require(_0x3d3a('0x6'));router[_0x3d3a('0x7')]('/',auth[_0x3d3a('0x8')](),controller[_0x3d3a('0x9')]);router[_0x3d3a('0x7')](_0x3d3a('0xa'),auth['isAuthenticated'](),controller[_0x3d3a('0xb')]);router[_0x3d3a('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d3a('0xd')]);router['put'](_0x3d3a('0xa'),auth[_0x3d3a('0x8')](),controller[_0x3d3a('0xe')]);router[_0x3d3a('0xf')](_0x3d3a('0xa'),auth[_0x3d3a('0x8')](),controller[_0x3d3a('0x10')]);module[_0x3d3a('0x11')]=router; \ No newline at end of file +var _0x8fe9=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x523adf,_0x4decc8){var _0x11be1b=function(_0x38b975){while(--_0x38b975){_0x523adf['push'](_0x523adf['shift']());}};_0x11be1b(++_0x4decc8);}(_0x8fe9,0x17b));var _0x98fe=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0x8fe9[_0x11d95f];return _0x2b1a14;};'use strict';var multer=require(_0x98fe('0x0'));var util=require(_0x98fe('0x1'));var path=require(_0x98fe('0x2'));var timeout=require(_0x98fe('0x3'));var express=require(_0x98fe('0x4'));var router=express[_0x98fe('0x5')]();var auth=require(_0x98fe('0x6'));var interaction=require(_0x98fe('0x7'));var config=require(_0x98fe('0x8'));var controller=require(_0x98fe('0x9'));router[_0x98fe('0xa')]('/',auth[_0x98fe('0xb')](),controller[_0x98fe('0xc')]);router[_0x98fe('0xa')](_0x98fe('0xd'),auth[_0x98fe('0xb')](),controller[_0x98fe('0xe')]);router[_0x98fe('0xf')]('/',auth[_0x98fe('0xb')](),controller[_0x98fe('0x10')]);router[_0x98fe('0x11')]('/:id',auth[_0x98fe('0xb')](),controller[_0x98fe('0x12')]);router[_0x98fe('0x13')](_0x98fe('0xd'),auth[_0x98fe('0xb')](),controller[_0x98fe('0x14')]);module[_0x98fe('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index e722815..4500bd8 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 _0x5fab=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x2ee69d,_0x308214){var _0x3abd2a=function(_0x37f5d4){while(--_0x37f5d4){_0x2ee69d['push'](_0x2ee69d['shift']());}};_0x3abd2a(++_0x308214);}(_0x5fab,0x177));var _0xb5fa=function(_0x1f3681,_0x43cf48){_0x1f3681=_0x1f3681-0x0;var _0x4911fd=_0x5fab[_0x1f3681];return _0x4911fd;};'use strict';var moment=require(_0xb5fa('0x0'));var Sequelize=require(_0xb5fa('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb5fa('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb5fa('0x4')],'defaultValue':moment()[_0xb5fa('0x5')](_0xb5fa('0x6'))},'countbusyretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb5fa('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb5fa('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb5fa('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb5fa('0x7')],'unique':_0xb5fa('0x9')},'UserId':{'type':Sequelize[_0xb5fa('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb5fa('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb5fa('0x2')]}}; \ No newline at end of file +var _0x31f0=['INTEGER','contactListQueue','STRING','moment','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x31f0,0xb7));var _0x031f=function(_0x28e687,_0x59df47){_0x28e687=_0x28e687-0x0;var _0x3754bf=_0x31f0[_0x28e687];return _0x3754bf;};'use strict';var moment=require(_0x031f('0x0'));var Sequelize=require('sequelize');module[_0x031f('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x031f('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x031f('0x3')],'defaultValue':moment()[_0x031f('0x4')](_0x031f('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x031f('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x031f('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x031f('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x031f('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x031f('0x6')],'unique':_0x031f('0x7')},'ListId':{'type':Sequelize[_0x031f('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x031f('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x031f('0x6')],'unique':_0x031f('0x7')},'CampaignId':{'type':Sequelize[_0x031f('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x031f('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x031f('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x031f('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x031f('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x031f('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 1e116d2..0150805 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 _0xa1f4=['getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','DESC','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','ASC','findOne','scheduledat','Contact','CmCompany','CmList','List','Queue','dialActive','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/environment','../../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','apply','save','update','destroy','then','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','concat','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','attributes','fields','model','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','length','options','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','firstName','isNil','calleridname','lastName','finally','CmHopperFinal'];(function(_0x488ef8,_0xf7ff03){var _0x46a72c=function(_0x10444c){while(--_0x10444c){_0x488ef8['push'](_0x488ef8['shift']());}};_0x46a72c(++_0xf7ff03);}(_0xa1f4,0x1d6));var _0x4a1f=function(_0x22985c,_0x508396){_0x22985c=_0x22985c-0x0;var _0x43e6b3=_0xa1f4[_0x22985c];return _0x43e6b3;};'use strict';var pdf=require(_0x4a1f('0x0'));var emlformat=require(_0x4a1f('0x1'));var rimraf=require(_0x4a1f('0x2'));var zipdir=require(_0x4a1f('0x3'));var jsonpatch=require(_0x4a1f('0x4'));var rp=require(_0x4a1f('0x5'));var moment=require(_0x4a1f('0x6'));var BPromise=require(_0x4a1f('0x7'));var Mustache=require(_0x4a1f('0x8'));var util=require(_0x4a1f('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x4a1f('0xa'));var ejs=require(_0x4a1f('0xb'));var fs=require('fs');var _=require(_0x4a1f('0xc'));var squel=require('squel');var crypto=require(_0x4a1f('0xd'));var jsforce=require(_0x4a1f('0xe'));var deskjs=require(_0x4a1f('0xf'));var toCsv=require(_0x4a1f('0xa'));var querystring=require(_0x4a1f('0x10'));var Papa=require(_0x4a1f('0x11'));var Redis=require(_0x4a1f('0x12'));var shared=require(_0x4a1f('0x13'));var authService=require(_0x4a1f('0x14'));var qs=require(_0x4a1f('0x15'));var as=require(_0x4a1f('0x16'));var hardwareService=require(_0x4a1f('0x17'));var logger=require(_0x4a1f('0x18'))(_0x4a1f('0x19'));var utils=require(_0x4a1f('0x1a'));var config=require(_0x4a1f('0x13'));var db=require(_0x4a1f('0x1b'))['db'];function respondWithStatusCode(_0x5874b8,_0x1eced9){_0x1eced9=_0x1eced9||0xcc;return function(_0x8c91b3){if(_0x8c91b3){return _0x5874b8[_0x4a1f('0x1c')](_0x1eced9);}return _0x5874b8[_0x4a1f('0x1d')](_0x1eced9)[_0x4a1f('0x1e')]();};}function respondWithResult(_0x2591b9,_0x2c7d6e){_0x2c7d6e=_0x2c7d6e||0xc8;return function(_0x287ae1){if(_0x287ae1){return _0x2591b9['status'](_0x2c7d6e)[_0x4a1f('0x1f')](_0x287ae1);}};}function respondWithFilteredResult(_0x27ca74,_0x456b7a){return function(_0x5c8c2c){if(_0x5c8c2c){var _0x4d3d5e=_0x5c8c2c[_0x4a1f('0x20')],_0xb263f0=_0x456b7a['offset'],_0x47f32c=_0x456b7a[_0x4a1f('0x21')]+_0x456b7a[_0x4a1f('0x22')],_0x588bb8;if(_0x47f32c>=_0x4d3d5e){_0x47f32c=_0x4d3d5e;_0x588bb8=0xc8;}else{_0x588bb8=0xce;}_0x27ca74[_0x4a1f('0x1d')](_0x588bb8);return _0x27ca74['set']('Content-Range',_0xb263f0+'-'+_0x47f32c+'/'+_0x4d3d5e)[_0x4a1f('0x1f')](_0x5c8c2c);}return null;};}function patchUpdates(_0x403a0d){return function(_0x4eada2){try{jsonpatch[_0x4a1f('0x23')](_0x4eada2,_0x403a0d,!![]);}catch(_0x2cc85e){return BPromise['reject'](_0x2cc85e);}return _0x4eada2[_0x4a1f('0x24')]();};}function saveUpdates(_0x4685e1,_0x6fdc4c){return function(_0x5572d5){if(_0x5572d5){return _0x5572d5[_0x4a1f('0x25')](_0x4685e1)['then'](function(_0x92d9d4){return _0x92d9d4;});}return null;};}function removeEntity(_0x114887,_0x17f359){return function(_0x4f0972){if(_0x4f0972){return _0x4f0972[_0x4a1f('0x26')]()[_0x4a1f('0x27')](function(){_0x114887[_0x4a1f('0x1d')](0xcc)[_0x4a1f('0x1e')]();});}};}function handleEntityNotFound(_0x1b24ab,_0x515d3f){return function(_0xccd468){if(!_0xccd468){_0x1b24ab[_0x4a1f('0x1c')](0x194);}return _0xccd468;};}function handleError(_0x15cb9c,_0x13289f){_0x13289f=_0x13289f||0x1f4;return function(_0xa07e0b){logger[_0x4a1f('0x28')](_0xa07e0b[_0x4a1f('0x29')]);if(_0xa07e0b[_0x4a1f('0x2a')]){delete _0xa07e0b[_0x4a1f('0x2a')];}_0x15cb9c[_0x4a1f('0x1d')](_0x13289f)[_0x4a1f('0x2b')](_0xa07e0b);};}exports['index']=function(_0x3aca2f,_0x562d76){var _0x3cc593={},_0xf69f1e={},_0x5f5634={'count':0x0,'rows':[]};var _0x2e1b05=_[_0x4a1f('0x2c')](db[_0x4a1f('0x2d')][_0x4a1f('0x2e')],function(_0x87eb19){return{'name':_0x87eb19[_0x4a1f('0x2f')],'type':_0x87eb19[_0x4a1f('0x30')][_0x4a1f('0x31')]};});_0xf69f1e['model']=_[_0x4a1f('0x2c')](_0x2e1b05,_0x4a1f('0x2a'));_0xf69f1e[_0x4a1f('0x32')]=_[_0x4a1f('0x33')](_0x3aca2f[_0x4a1f('0x32')]);_0xf69f1e[_0x4a1f('0x34')]=_[_0x4a1f('0x35')](_0xf69f1e['model'],_0xf69f1e[_0x4a1f('0x32')]);_0xf69f1e['filters']=_[_0x4a1f('0x36')](_0xf69f1e['filters'],['$and','$or',_0x4a1f('0x37'),_0x4a1f('0x38'),_0x4a1f('0x39'),_0x4a1f('0x3a'),_0x4a1f('0x3b'),_0x4a1f('0x3c'),_0x4a1f('0x3d'),_0x4a1f('0x3e'),_0x4a1f('0x3f'),_0x4a1f('0x40'),'$notIn',_0x4a1f('0x41'),'$notLike',_0x4a1f('0x42'),_0x4a1f('0x43'),_0x4a1f('0x41'),_0x4a1f('0x44'),'$contains','$contained','$any']);_0x3cc593[_0x4a1f('0x45')]=_[_0x4a1f('0x35')](_0xf69f1e['model'],qs[_0x4a1f('0x46')](_0x3aca2f[_0x4a1f('0x32')][_0x4a1f('0x46')]));_0x3cc593[_0x4a1f('0x45')]=_0x3cc593[_0x4a1f('0x45')]['length']?_0x3cc593[_0x4a1f('0x45')]:_0xf69f1e[_0x4a1f('0x47')];if(!_0x3aca2f[_0x4a1f('0x32')][_0x4a1f('0x48')](_0x4a1f('0x49'))){_0x3cc593[_0x4a1f('0x22')]=qs[_0x4a1f('0x22')](_0x3aca2f[_0x4a1f('0x32')][_0x4a1f('0x22')]);_0x3cc593[_0x4a1f('0x21')]=qs[_0x4a1f('0x21')](_0x3aca2f['query'][_0x4a1f('0x21')]);}_0x3cc593[_0x4a1f('0x4a')]=qs['sort'](_0x3aca2f[_0x4a1f('0x32')]['sort']);_0x3cc593['where']=qs[_0x4a1f('0x34')](_[_0x4a1f('0x4b')](_0x3aca2f[_0x4a1f('0x32')],_0xf69f1e['filters']),_0x2e1b05);if(_0x3aca2f['query']['filter']){_0x3cc593[_0x4a1f('0x4c')]=_[_0x4a1f('0x4d')](_0x3cc593['where'],{'$or':_[_0x4a1f('0x2c')](_0x2e1b05,function(_0x1164f6){if(_0x1164f6['type']!==_0x4a1f('0x4e')){var _0x424f91={};_0x424f91[_0x1164f6[_0x4a1f('0x2a')]]={'$like':'%'+_0x3aca2f['query'][_0x4a1f('0x4f')]+'%'};return _0x424f91;}})});}_0x3cc593=_[_0x4a1f('0x4d')]({},_0x3cc593,_0x3aca2f['options']);var _0xff456={'where':_0x3cc593[_0x4a1f('0x4c')]};return db['CmHopper'][_0x4a1f('0x20')](_0xff456)[_0x4a1f('0x27')](function(_0x2f23a1){_0x5f5634[_0x4a1f('0x20')]=_0x2f23a1;if(_0x3aca2f[_0x4a1f('0x32')][_0x4a1f('0x50')]){_0x3cc593[_0x4a1f('0x51')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3cc593);})[_0x4a1f('0x27')](function(_0x9c001d){_0x5f5634[_0x4a1f('0x52')]=_0x9c001d;return _0x5f5634;})[_0x4a1f('0x27')](respondWithFilteredResult(_0x562d76,_0x3cc593))[_0x4a1f('0x53')](handleError(_0x562d76,null));};exports[_0x4a1f('0x54')]=function(_0x18180f,_0x47443c){var _0x3985bb={'raw':!![],'where':{'id':_0x18180f[_0x4a1f('0x55')]['id']}},_0x860ec1={};_0x860ec1[_0x4a1f('0x47')]=_[_0x4a1f('0x33')](db[_0x4a1f('0x2d')][_0x4a1f('0x2e')]);_0x860ec1['query']=_['keys'](_0x18180f[_0x4a1f('0x32')]);_0x860ec1[_0x4a1f('0x34')]=_[_0x4a1f('0x35')](_0x860ec1['model'],_0x860ec1[_0x4a1f('0x32')]);_0x3985bb[_0x4a1f('0x45')]=_[_0x4a1f('0x35')](_0x860ec1['model'],qs[_0x4a1f('0x46')](_0x18180f[_0x4a1f('0x32')][_0x4a1f('0x46')]));_0x3985bb[_0x4a1f('0x45')]=_0x3985bb[_0x4a1f('0x45')][_0x4a1f('0x56')]?_0x3985bb['attributes']:_0x860ec1[_0x4a1f('0x47')];if(_0x18180f[_0x4a1f('0x32')][_0x4a1f('0x50')]){_0x3985bb[_0x4a1f('0x51')]=[{'all':!![]}];}_0x3985bb=_[_0x4a1f('0x4d')]({},_0x3985bb,_0x18180f[_0x4a1f('0x57')]);return db[_0x4a1f('0x2d')][_0x4a1f('0x58')](_0x3985bb)['then'](handleEntityNotFound(_0x47443c,null))[_0x4a1f('0x27')](respondWithResult(_0x47443c,null))['catch'](handleError(_0x47443c,null));};exports[_0x4a1f('0x59')]=function(_0x2af3c1,_0x1a4ea9){return db['CmHopper'][_0x4a1f('0x59')](_0x2af3c1['body'],{})['then'](respondWithResult(_0x1a4ea9,0xc9))['catch'](handleError(_0x1a4ea9,null));};exports[_0x4a1f('0x25')]=function(_0x5c58af,_0x14103d){if(_0x5c58af[_0x4a1f('0x5a')]['id']){delete _0x5c58af['body']['id'];}return db[_0x4a1f('0x2d')]['find']({'where':{'id':_0x5c58af[_0x4a1f('0x55')]['id']}})['then'](handleEntityNotFound(_0x14103d,null))[_0x4a1f('0x27')](saveUpdates(_0x5c58af[_0x4a1f('0x5a')],null))[_0x4a1f('0x27')](respondWithResult(_0x14103d,null))[_0x4a1f('0x53')](handleError(_0x14103d,null));};exports[_0x4a1f('0x5b')]=function(_0x4cb8df,_0x790bd1){return db[_0x4a1f('0x2d')][_0x4a1f('0x5b')]()[_0x4a1f('0x27')](respondWithResult(_0x790bd1,null))['catch'](handleError(_0x790bd1,null));};exports[_0x4a1f('0x26')]=function(_0x1ba77e,_0x38b116){var _0x1a3218;return db['CmHopper'][_0x4a1f('0x58')]({'where':{'id':_0x1ba77e[_0x4a1f('0x55')]['id']}})[_0x4a1f('0x27')](handleEntityNotFound(_0x38b116,null))[_0x4a1f('0x27')](function(_0x36f8a9){if(_0x36f8a9){return _0x36f8a9[_0x4a1f('0x26')]()[_0x4a1f('0x27')](function(_0x18a5cb){return _0x18a5cb;});}})['then'](function(_0x1e13e4){_0x1a3218=_0x1e13e4;if(_0x1e13e4){if(_0x1e13e4[_0x4a1f('0x5c')]||_0x1e13e4[_0x4a1f('0x5d')]){return db[_0x1e13e4[_0x4a1f('0x5c')]?_0x4a1f('0x5e'):_0x4a1f('0x5f')][_0x4a1f('0x58')]({'where':{'id':_0x1e13e4[_0x4a1f('0x5c')]?_0x1e13e4[_0x4a1f('0x5c')]:_0x1e13e4[_0x4a1f('0x5d')]},'attributes':['id','name'],'raw':!![]});}}})[_0x4a1f('0x27')](function(_0x95e12){var _0x300acc={};if(_0x95e12){_[_0x4a1f('0x4d')](_0x300acc,_[_0x4a1f('0x60')](_0x1a3218['dataValues'],[_0x4a1f('0x61'),_0x4a1f('0x62'),'id']));_0x300acc[_0x4a1f('0x63')]=0x15;_0x300acc[_0x4a1f('0x64')]=_0x4a1f('0x65');_0x300acc[_0x4a1f('0x66')]=_0x95e12['name'];_0x300acc[_0x4a1f('0x67')]=_0x1ba77e[_0x4a1f('0x68')][_0x4a1f('0x2a')];_0x300acc[_0x4a1f('0x69')]=_0x1ba77e[_0x4a1f('0x68')]['id'];_0x300acc[_0x4a1f('0x65')]=!![];_0x300acc['deletedat']=moment()[_0x4a1f('0x6a')](_0x4a1f('0x6b'));_0x300acc[_0x4a1f('0x6c')]=_0x1a3218['phone'];_0x300acc[_0x4a1f('0x6d')]=_0x1a3218['VoiceQueueId']?'queue':_0x4a1f('0x6e');return db[_0x4a1f('0x6f')][_0x4a1f('0x58')]({'where':{'id':_0x300acc['ContactId']},'attributes':[_0x4a1f('0x70'),'lastName']})[_0x4a1f('0x27')](function(_0x5d4560){if(!_['isNil'](_0x38b116)&&!_[_0x4a1f('0x71')](_0x5d4560[_0x4a1f('0x70')])){_0x300acc[_0x4a1f('0x72')]=_0x5d4560[_0x4a1f('0x70')];if(!_[_0x4a1f('0x71')](_0x5d4560['lastName'])){_0x300acc[_0x4a1f('0x72')]+='\x20'+_0x5d4560[_0x4a1f('0x73')];}}})[_0x4a1f('0x74')](function(){return db[_0x4a1f('0x75')][_0x4a1f('0x59')](_0x300acc);});}})[_0x4a1f('0x27')](function(){return _0x38b116['status'](0xcc)[_0x4a1f('0x1e')]();})['catch'](handleError(_0x38b116,null));};exports['getPreview']=function(_0x4c73f7,_0x4e42c2,_0x2cbdbc){var _0x46dc58=[];return db[_0x4a1f('0x6f')][_0x4a1f('0x5b')]()[_0x4a1f('0x27')](function(_0x428eed){_0x46dc58=_[_0x4a1f('0x33')](_0x428eed);return _0x4c73f7[_0x4a1f('0x68')][_0x4a1f('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x4a1f('0x77')},'attributes':['id',_0x4a1f('0x78')],'raw':!![]});})[_0x4a1f('0x27')](function(_0x1a8912){if(_0x1a8912&&_0x1a8912['length']){return db[_0x4a1f('0x79')][_0x4a1f('0x7a')](function(_0x34ab85){var _0x5a180d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4a1f('0x6a')](_0x4a1f('0x6b'))},'VoiceQueueId':{'$in':_[_0x4a1f('0x2c')](_0x1a8912,'id')},'$or':[{'UserId':null},{'UserId':_0x4c73f7[_0x4a1f('0x68')]['id']}]};var _0x4222c3=[];if(_0x4c73f7['body'][_0x4a1f('0x7b')]&&_0x4c73f7[_0x4a1f('0x5a')][_0x4a1f('0x7b')]===_0x4a1f('0x7c')){if(!_[_0x4a1f('0x7d')](_0x4c73f7['body']['hopperIds'])){_0x5a180d['id']={'$in':_0x4c73f7[_0x4a1f('0x5a')][_0x4a1f('0x7e')]};}_0x4222c3=[[_0x4a1f('0x7f'),'ASC'],['scheduledAt',_0x1a8912[0x0]['dialOrderByScheduledAt']==='ASC'?_0x4a1f('0x80'):'ASC'],db['sequelize'][_0x4a1f('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x4c73f7['body'][_0x4a1f('0x7e')])){_0x5a180d['id']={'$notIn':_0x4c73f7[_0x4a1f('0x5a')][_0x4a1f('0x7e')]};}_0x4222c3=[[_0x4a1f('0x7f'),_0x4a1f('0x80')],[_0x4a1f('0x82'),_0x1a8912[0x0][_0x4a1f('0x78')]],db[_0x4a1f('0x79')][_0x4a1f('0x81')](_0x4a1f('0x83')),['id',_0x4a1f('0x84')]];}return db['CmHopper'][_0x4a1f('0x85')]({'attributes':['id',_0x4a1f('0x86')],'where':_0x5a180d,'order':_0x4222c3,'transaction':_0x34ab85,'lock':_0x34ab85['LOCK']['UPDATE'],'include':[{'model':db[_0x4a1f('0x6f')],'as':_0x4a1f('0x87'),'attributes':_0x46dc58,'include':[{'model':db[_0x4a1f('0x88')],'as':'Company','attributes':['id',_0x4a1f('0x2a')]}]},{'model':db[_0x4a1f('0x89')],'as':_0x4a1f('0x8a'),'attributes':['id',_0x4a1f('0x2a')]},{'model':db[_0x4a1f('0x5e')],'as':_0x4a1f('0x8b'),'attributes':['id',_0x4a1f('0x2a'),_0x4a1f('0x8c')]}]})['then'](function(_0x5e3c21){if(_0x5e3c21){return _0x5e3c21[_0x4a1f('0x25')]({'UserId':_0x4c73f7[_0x4a1f('0x68')]['id']},{'transaction':_0x34ab85});}});});}})[_0x4a1f('0x27')](handleEntityNotFound(_0x4e42c2,null))[_0x4a1f('0x27')](respondWithResult(_0x4e42c2,null))[_0x4a1f('0x53')](handleError(_0x4e42c2,null));};exports[_0x4a1f('0x8d')]=function(_0x4cb37b,_0x546d05,_0x35f88e){return _0x4cb37b['user'][_0x4a1f('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x4a1f('0x77')},'attributes':['id'],'raw':!![]})[_0x4a1f('0x27')](function(_0x3832c5){if(_0x3832c5&&_0x3832c5[_0x4a1f('0x56')]){return db[_0x4a1f('0x2d')][_0x4a1f('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x4a1f('0x2c')](_0x3832c5,'id')},'$or':[{'UserId':null},{'UserId':_0x4cb37b[_0x4a1f('0x68')]['id']}]}});}return 0x0;})[_0x4a1f('0x27')](function(_0x3d4c28){if(!_[_0x4a1f('0x71')](_0x3d4c28)&&_['isNumber'](_0x3d4c28)){return _0x546d05[_0x4a1f('0x1d')](0xc8)[_0x4a1f('0x1f')]({'contacts':_0x3d4c28});}else{logger[_0x4a1f('0x28')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x4a1f('0x8d'),0x194,_0x4a1f('0x8e'));_0x546d05['sendStatus'](0x194);}})[_0x4a1f('0x53')](handleError(_0x546d05,null));};exports[_0x4a1f('0x8f')]=function(_0x1ec28a,_0x8ad63b,_0x22fafd){var _0x4ec010=shared[_0x4a1f('0x90')];var _0x19e05e=[];_[_0x4a1f('0x2c')](_0x4ec010,function(_0x4618bc){_0x19e05e[_0x4a1f('0x91')]({'id':_0x4618bc[_0x4a1f('0x2a')],'name':_0x4618bc['name'],'utcOffset':_0x4618bc[_0x4a1f('0x92')]});});return _0x8ad63b['status'](0xc8)[_0x4a1f('0x1f')]({'tz':_0x19e05e});};exports['getTimezone']=function(_0x21bae2,_0x524b72,_0x33b60c){var _0x46217c=shared[_0x4a1f('0x90')];var _0x1dd59b={};if(!_[_0x4a1f('0x71')](_0x46217c[_0x21bae2[_0x4a1f('0x5a')]['id']]))_0x1dd59b=_0x46217c[_0x21bae2[_0x4a1f('0x5a')]['id']];return _0x524b72[_0x4a1f('0x1d')](0xc8)['json'](_0x1dd59b);}; \ No newline at end of file +var _0x79ae=['map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$eq','$between','$notBetween','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','state','deleted','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','getPreview','CmContact','user','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','outbound','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send'];(function(_0x46ed3a,_0x35b0b3){var _0x3caeb8=function(_0x46d704){while(--_0x46d704){_0x46ed3a['push'](_0x46ed3a['shift']());}};_0x3caeb8(++_0x35b0b3);}(_0x79ae,0x18b));var _0xe79a=function(_0x331c48,_0x51e0e3){_0x331c48=_0x331c48-0x0;var _0x882358=_0x79ae[_0x331c48];return _0x882358;};'use strict';var pdf=require(_0xe79a('0x0'));var emlformat=require(_0xe79a('0x1'));var rimraf=require(_0xe79a('0x2'));var zipdir=require(_0xe79a('0x3'));var jsonpatch=require(_0xe79a('0x4'));var rp=require('request-promise');var moment=require(_0xe79a('0x5'));var BPromise=require(_0xe79a('0x6'));var Mustache=require('mustache');var util=require(_0xe79a('0x7'));var path=require(_0xe79a('0x8'));var sox=require(_0xe79a('0x9'));var csv=require(_0xe79a('0xa'));var ejs=require(_0xe79a('0xb'));var fs=require('fs');var _=require(_0xe79a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe79a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe79a('0xa'));var querystring=require(_0xe79a('0xe'));var Papa=require('papaparse');var Redis=require(_0xe79a('0xf'));var shared=require(_0xe79a('0x10'));var authService=require(_0xe79a('0x11'));var qs=require(_0xe79a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe79a('0x13'))(_0xe79a('0x14'));var utils=require(_0xe79a('0x15'));var config=require(_0xe79a('0x10'));var db=require(_0xe79a('0x16'))['db'];function respondWithStatusCode(_0xfc502,_0x3c9ac0){_0x3c9ac0=_0x3c9ac0||0xcc;return function(_0x5f448b){if(_0x5f448b){return _0xfc502[_0xe79a('0x17')](_0x3c9ac0);}return _0xfc502[_0xe79a('0x18')](_0x3c9ac0)['end']();};}function respondWithResult(_0x4a95d5,_0x2f0b2f){_0x2f0b2f=_0x2f0b2f||0xc8;return function(_0xd2f91d){if(_0xd2f91d){return _0x4a95d5['status'](_0x2f0b2f)['json'](_0xd2f91d);}};}function respondWithFilteredResult(_0x4dbfb9,_0x3d5e75){return function(_0x58f780){if(_0x58f780){var _0x4783d5=_0x58f780[_0xe79a('0x19')],_0x20b1fa=_0x3d5e75['offset'],_0x3676a4=_0x3d5e75[_0xe79a('0x1a')]+_0x3d5e75['limit'],_0x3003a1;if(_0x3676a4>=_0x4783d5){_0x3676a4=_0x4783d5;_0x3003a1=0xc8;}else{_0x3003a1=0xce;}_0x4dbfb9['status'](_0x3003a1);return _0x4dbfb9[_0xe79a('0x1b')](_0xe79a('0x1c'),_0x20b1fa+'-'+_0x3676a4+'/'+_0x4783d5)[_0xe79a('0x1d')](_0x58f780);}return null;};}function patchUpdates(_0x36eeb8){return function(_0x5230ac){try{jsonpatch[_0xe79a('0x1e')](_0x5230ac,_0x36eeb8,!![]);}catch(_0x223c0f){return BPromise[_0xe79a('0x1f')](_0x223c0f);}return _0x5230ac[_0xe79a('0x20')]();};}function saveUpdates(_0x59d6d1,_0x2acbe6){return function(_0x1768ee){if(_0x1768ee){return _0x1768ee[_0xe79a('0x21')](_0x59d6d1)[_0xe79a('0x22')](function(_0x367911){return _0x367911;});}return null;};}function removeEntity(_0x5b9a70,_0x3dbd5d){return function(_0x38b2fb){if(_0x38b2fb){return _0x38b2fb[_0xe79a('0x23')]()[_0xe79a('0x22')](function(){_0x5b9a70[_0xe79a('0x18')](0xcc)[_0xe79a('0x24')]();});}};}function handleEntityNotFound(_0x322fe4,_0x2d7d8d){return function(_0x4f0c24){if(!_0x4f0c24){_0x322fe4[_0xe79a('0x17')](0x194);}return _0x4f0c24;};}function handleError(_0x419082,_0x5271a9){_0x5271a9=_0x5271a9||0x1f4;return function(_0x1059b9){logger[_0xe79a('0x25')](_0x1059b9['stack']);if(_0x1059b9[_0xe79a('0x26')]){delete _0x1059b9[_0xe79a('0x26')];}_0x419082[_0xe79a('0x18')](_0x5271a9)[_0xe79a('0x27')](_0x1059b9);};}exports['index']=function(_0x4710e5,_0x3c56b9){var _0x4ec913={},_0x55e285={},_0x5af6c3={'count':0x0,'rows':[]};var _0x4c34e3=_[_0xe79a('0x28')](db[_0xe79a('0x29')][_0xe79a('0x2a')],function(_0x90caa1){return{'name':_0x90caa1[_0xe79a('0x2b')],'type':_0x90caa1[_0xe79a('0x2c')][_0xe79a('0x2d')]};});_0x55e285[_0xe79a('0x2e')]=_[_0xe79a('0x28')](_0x4c34e3,_0xe79a('0x26'));_0x55e285['query']=_['keys'](_0x4710e5[_0xe79a('0x2f')]);_0x55e285[_0xe79a('0x30')]=_[_0xe79a('0x31')](_0x55e285[_0xe79a('0x2e')],_0x55e285['query']);_0x55e285[_0xe79a('0x30')]=_[_0xe79a('0x32')](_0x55e285[_0xe79a('0x30')],[_0xe79a('0x33'),_0xe79a('0x34'),_0xe79a('0x35'),'$gte',_0xe79a('0x36'),_0xe79a('0x37'),'$ne',_0xe79a('0x38'),'$not',_0xe79a('0x39'),_0xe79a('0x3a'),'$in','$notIn',_0xe79a('0x3b'),_0xe79a('0x3c'),'$iLike',_0xe79a('0x3d'),_0xe79a('0x3b'),_0xe79a('0x3e'),_0xe79a('0x3f'),_0xe79a('0x40'),_0xe79a('0x41')]);_0x4ec913[_0xe79a('0x42')]=_[_0xe79a('0x31')](_0x55e285[_0xe79a('0x2e')],qs['fields'](_0x4710e5[_0xe79a('0x2f')][_0xe79a('0x43')]));_0x4ec913[_0xe79a('0x42')]=_0x4ec913['attributes'][_0xe79a('0x44')]?_0x4ec913[_0xe79a('0x42')]:_0x55e285[_0xe79a('0x2e')];if(!_0x4710e5[_0xe79a('0x2f')][_0xe79a('0x45')](_0xe79a('0x46'))){_0x4ec913[_0xe79a('0x47')]=qs[_0xe79a('0x47')](_0x4710e5[_0xe79a('0x2f')][_0xe79a('0x47')]);_0x4ec913[_0xe79a('0x1a')]=qs['offset'](_0x4710e5[_0xe79a('0x2f')]['offset']);}_0x4ec913[_0xe79a('0x48')]=qs[_0xe79a('0x49')](_0x4710e5['query']['sort']);_0x4ec913[_0xe79a('0x4a')]=qs['filters'](_['pick'](_0x4710e5[_0xe79a('0x2f')],_0x55e285[_0xe79a('0x30')]),_0x4c34e3);if(_0x4710e5[_0xe79a('0x2f')]['filter']){_0x4ec913[_0xe79a('0x4a')]=_[_0xe79a('0x4b')](_0x4ec913['where'],{'$or':_[_0xe79a('0x28')](_0x4c34e3,function(_0x988efd){if(_0x988efd[_0xe79a('0x2c')]!==_0xe79a('0x4c')){var _0x1b4fb0={};_0x1b4fb0[_0x988efd[_0xe79a('0x26')]]={'$like':'%'+_0x4710e5[_0xe79a('0x2f')]['filter']+'%'};return _0x1b4fb0;}})});}_0x4ec913=_['merge']({},_0x4ec913,_0x4710e5[_0xe79a('0x4d')]);var _0xeb549b={'where':_0x4ec913[_0xe79a('0x4a')]};return db[_0xe79a('0x29')][_0xe79a('0x19')](_0xeb549b)[_0xe79a('0x22')](function(_0x359c83){_0x5af6c3['count']=_0x359c83;if(_0x4710e5[_0xe79a('0x2f')][_0xe79a('0x4e')]){_0x4ec913['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4ec913);})[_0xe79a('0x22')](function(_0x830780){_0x5af6c3[_0xe79a('0x4f')]=_0x830780;return _0x5af6c3;})[_0xe79a('0x22')](respondWithFilteredResult(_0x3c56b9,_0x4ec913))[_0xe79a('0x50')](handleError(_0x3c56b9,null));};exports[_0xe79a('0x51')]=function(_0x1df955,_0x477c97){var _0x423256={'raw':!![],'where':{'id':_0x1df955[_0xe79a('0x52')]['id']}},_0x210250={};_0x210250[_0xe79a('0x2e')]=_[_0xe79a('0x53')](db['CmHopper'][_0xe79a('0x2a')]);_0x210250[_0xe79a('0x2f')]=_[_0xe79a('0x53')](_0x1df955[_0xe79a('0x2f')]);_0x210250[_0xe79a('0x30')]=_[_0xe79a('0x31')](_0x210250['model'],_0x210250['query']);_0x423256['attributes']=_[_0xe79a('0x31')](_0x210250['model'],qs[_0xe79a('0x43')](_0x1df955[_0xe79a('0x2f')][_0xe79a('0x43')]));_0x423256[_0xe79a('0x42')]=_0x423256[_0xe79a('0x42')][_0xe79a('0x44')]?_0x423256[_0xe79a('0x42')]:_0x210250[_0xe79a('0x2e')];if(_0x1df955[_0xe79a('0x2f')][_0xe79a('0x4e')]){_0x423256[_0xe79a('0x54')]=[{'all':!![]}];}_0x423256=_[_0xe79a('0x4b')]({},_0x423256,_0x1df955['options']);return db['CmHopper'][_0xe79a('0x55')](_0x423256)['then'](handleEntityNotFound(_0x477c97,null))['then'](respondWithResult(_0x477c97,null))[_0xe79a('0x50')](handleError(_0x477c97,null));};exports['create']=function(_0x5b9402,_0x56cf71){return db['CmHopper'][_0xe79a('0x56')](_0x5b9402[_0xe79a('0x57')],{})['then'](respondWithResult(_0x56cf71,0xc9))[_0xe79a('0x50')](handleError(_0x56cf71,null));};exports[_0xe79a('0x21')]=function(_0x6f5ff2,_0x148395){if(_0x6f5ff2[_0xe79a('0x57')]['id']){delete _0x6f5ff2[_0xe79a('0x57')]['id'];}return db['CmHopper'][_0xe79a('0x55')]({'where':{'id':_0x6f5ff2[_0xe79a('0x52')]['id']}})[_0xe79a('0x22')](handleEntityNotFound(_0x148395,null))[_0xe79a('0x22')](saveUpdates(_0x6f5ff2[_0xe79a('0x57')],null))[_0xe79a('0x22')](respondWithResult(_0x148395,null))['catch'](handleError(_0x148395,null));};exports[_0xe79a('0x58')]=function(_0x4ccd19,_0x430168){return db[_0xe79a('0x29')]['describe']()[_0xe79a('0x22')](respondWithResult(_0x430168,null))[_0xe79a('0x50')](handleError(_0x430168,null));};exports[_0xe79a('0x23')]=function(_0x38b08a,_0x1151e3){var _0x531cf7;return db[_0xe79a('0x29')]['find']({'where':{'id':_0x38b08a['params']['id']}})[_0xe79a('0x22')](handleEntityNotFound(_0x1151e3,null))[_0xe79a('0x22')](function(_0x1183dc){if(_0x1183dc){return _0x1183dc['destroy']()[_0xe79a('0x22')](function(_0xfe3451){return _0xfe3451;});}})[_0xe79a('0x22')](function(_0x558282){_0x531cf7=_0x558282;if(_0x558282){if(_0x558282[_0xe79a('0x59')]||_0x558282[_0xe79a('0x5a')]){return db[_0x558282[_0xe79a('0x59')]?_0xe79a('0x5b'):'Campaign'][_0xe79a('0x55')]({'where':{'id':_0x558282[_0xe79a('0x59')]?_0x558282[_0xe79a('0x59')]:_0x558282['CampaignId']},'attributes':['id',_0xe79a('0x26')],'raw':!![]});}}})['then'](function(_0x2e9f60){var _0x1c0f29={};if(_0x2e9f60){_[_0xe79a('0x4b')](_0x1c0f29,_[_0xe79a('0x5c')](_0x531cf7['dataValues'],[_0xe79a('0x5d'),_0xe79a('0x5e'),'id']));_0x1c0f29[_0xe79a('0x5f')]=0x15;_0x1c0f29['statedesc']=_0xe79a('0x60');_0x1c0f29['campaign']=_0x2e9f60[_0xe79a('0x26')];_0x1c0f29['membername']=_0x38b08a['user'][_0xe79a('0x26')];_0x1c0f29[_0xe79a('0x61')]=_0x38b08a['user']['id'];_0x1c0f29[_0xe79a('0x60')]=!![];_0x1c0f29[_0xe79a('0x62')]=moment()['format'](_0xe79a('0x63'));_0x1c0f29[_0xe79a('0x64')]=_0x531cf7['phone'];_0x1c0f29['campaigntype']=_0x531cf7[_0xe79a('0x59')]?_0xe79a('0x65'):_0xe79a('0x66');return db['CmContact']['find']({'where':{'id':_0x1c0f29[_0xe79a('0x67')]},'attributes':[_0xe79a('0x68'),_0xe79a('0x69')]})[_0xe79a('0x22')](function(_0x15875d){if(!_[_0xe79a('0x6a')](_0x1151e3)&&!_[_0xe79a('0x6a')](_0x15875d[_0xe79a('0x68')])){_0x1c0f29[_0xe79a('0x6b')]=_0x15875d[_0xe79a('0x68')];if(!_[_0xe79a('0x6a')](_0x15875d['lastName'])){_0x1c0f29[_0xe79a('0x6b')]+='\x20'+_0x15875d[_0xe79a('0x69')];}}})['finally'](function(){return db['CmHopperFinal']['create'](_0x1c0f29);});}})[_0xe79a('0x22')](function(){return _0x1151e3['status'](0xcc)[_0xe79a('0x24')]();})['catch'](handleError(_0x1151e3,null));};exports[_0xe79a('0x6c')]=function(_0x90da9f,_0x241ac9,_0x5d4b4e){var _0x4bb744=[];return db[_0xe79a('0x6d')][_0xe79a('0x58')]()[_0xe79a('0x22')](function(_0x11e13f){_0x4bb744=_['keys'](_0x11e13f);return _0x90da9f[_0xe79a('0x6e')][_0xe79a('0x6f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe79a('0x70')},'attributes':['id',_0xe79a('0x71')],'raw':!![]});})[_0xe79a('0x22')](function(_0xc5f5ac){if(_0xc5f5ac&&_0xc5f5ac[_0xe79a('0x44')]){return db[_0xe79a('0x72')][_0xe79a('0x73')](function(_0x24c881){var _0x54fdfb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe79a('0x74')](_0xe79a('0x63'))},'VoiceQueueId':{'$in':_[_0xe79a('0x28')](_0xc5f5ac,'id')},'$or':[{'UserId':null},{'UserId':_0x90da9f[_0xe79a('0x6e')]['id']}]};var _0x361f43=[];if(_0x90da9f['body']['direction']&&_0x90da9f['body'][_0xe79a('0x75')]===_0xe79a('0x76')){if(!_['isEmpty'](_0x90da9f['body'][_0xe79a('0x77')])){_0x54fdfb['id']={'$in':_0x90da9f[_0xe79a('0x57')]['hopperIds']};}_0x361f43=[['priority',_0xe79a('0x78')],[_0xe79a('0x79'),_0xc5f5ac[0x0][_0xe79a('0x71')]===_0xe79a('0x78')?_0xe79a('0x7a'):_0xe79a('0x78')],db[_0xe79a('0x72')][_0xe79a('0x7b')](_0xe79a('0x7c')),['id',_0xe79a('0x7a')]];}else{if(!_[_0xe79a('0x7d')](_0x90da9f[_0xe79a('0x57')]['hopperIds'])){_0x54fdfb['id']={'$notIn':_0x90da9f['body']['hopperIds']};}_0x361f43=[[_0xe79a('0x7e'),_0xe79a('0x7a')],[_0xe79a('0x79'),_0xc5f5ac[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0xe79a('0x7b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xe79a('0x29')][_0xe79a('0x7f')]({'attributes':['id',_0xe79a('0x80')],'where':_0x54fdfb,'order':_0x361f43,'transaction':_0x24c881,'lock':_0x24c881[_0xe79a('0x81')][_0xe79a('0x82')],'include':[{'model':db['CmContact'],'as':_0xe79a('0x83'),'attributes':_0x4bb744,'include':[{'model':db[_0xe79a('0x84')],'as':_0xe79a('0x85'),'attributes':['id',_0xe79a('0x26')]}]},{'model':db[_0xe79a('0x86')],'as':_0xe79a('0x87'),'attributes':['id',_0xe79a('0x26')]},{'model':db[_0xe79a('0x5b')],'as':_0xe79a('0x88'),'attributes':['id',_0xe79a('0x26'),_0xe79a('0x89')]}]})[_0xe79a('0x22')](function(_0x41c759){if(_0x41c759){return _0x41c759[_0xe79a('0x21')]({'UserId':_0x90da9f['user']['id']},{'transaction':_0x24c881});}});});}})['then'](handleEntityNotFound(_0x241ac9,null))['then'](respondWithResult(_0x241ac9,null))[_0xe79a('0x50')](handleError(_0x241ac9,null));};exports[_0xe79a('0x8a')]=function(_0x1f53b7,_0x4f984b,_0x5a9263){return _0x1f53b7[_0xe79a('0x6e')][_0xe79a('0x6f')]({'where':{'type':_0xe79a('0x8b'),'dialActive':!![],'dialMethod':_0xe79a('0x70')},'attributes':['id'],'raw':!![]})[_0xe79a('0x22')](function(_0x1cf2db){if(_0x1cf2db&&_0x1cf2db[_0xe79a('0x44')]){return db[_0xe79a('0x29')][_0xe79a('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe79a('0x74')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe79a('0x28')](_0x1cf2db,'id')},'$or':[{'UserId':null},{'UserId':_0x1f53b7[_0xe79a('0x6e')]['id']}]}});}return 0x0;})[_0xe79a('0x22')](function(_0x41b970){if(!_['isNil'](_0x41b970)&&_['isNumber'](_0x41b970)){return _0x4f984b[_0xe79a('0x18')](0xc8)[_0xe79a('0x1d')]({'contacts':_0x41b970});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xe79a('0x8a'),0x194,_0xe79a('0x8c'));_0x4f984b[_0xe79a('0x17')](0x194);}})[_0xe79a('0x50')](handleError(_0x4f984b,null));};exports[_0xe79a('0x8d')]=function(_0x3b7b89,_0x2fcd7d,_0x1ba898){var _0x11a0a6=shared[_0xe79a('0x8e')];var _0xf36b7c=[];_[_0xe79a('0x28')](_0x11a0a6,function(_0x5355b4){_0xf36b7c['push']({'id':_0x5355b4['name'],'name':_0x5355b4[_0xe79a('0x26')],'utcOffset':_0x5355b4[_0xe79a('0x8f')]});});return _0x2fcd7d[_0xe79a('0x18')](0xc8)[_0xe79a('0x1d')]({'tz':_0xf36b7c});};exports[_0xe79a('0x90')]=function(_0x2edf9e,_0x5a7063,_0x17206d){var _0x24a95e=shared[_0xe79a('0x8e')];var _0x515a00={};if(!_[_0xe79a('0x6a')](_0x24a95e[_0x2edf9e[_0xe79a('0x57')]['id']]))_0x515a00=_0x24a95e[_0x2edf9e[_0xe79a('0x57')]['id']];return _0x5a7063[_0xe79a('0x18')](0xc8)[_0xe79a('0x1d')](_0x515a00);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 7abf1af..29f0ee4 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 _0xeb65=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x3ace5f,_0x3bd72a){var _0x5e1835=function(_0x1ed686){while(--_0x1ed686){_0x3ace5f['push'](_0x3ace5f['shift']());}};_0x5e1835(++_0x3bd72a);}(_0xeb65,0xc3));var _0x5eb6=function(_0x53df49,_0x4c47a1){_0x53df49=_0x53df49-0x0;var _0x1d85f0=_0xeb65[_0x53df49];return _0x1d85f0;};'use strict';var _=require(_0x5eb6('0x0'));var util=require(_0x5eb6('0x1'));var logger=require(_0x5eb6('0x2'))('api');var moment=require(_0x5eb6('0x3'));var BPromise=require(_0x5eb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5eb6('0x5'));var rimraf=require(_0x5eb6('0x6'));var config=require(_0x5eb6('0x7'));var attributes=require(_0x5eb6('0x8'));module['exports']=function(_0x326260,_0x29eca1){return _0x326260['define'](_0x5eb6('0x9'),attributes,{'tableName':_0x5eb6('0xa'),'paranoid':![],'indexes':[{'name':_0x5eb6('0xb'),'fields':[_0x5eb6('0xb')]},{'name':_0x5eb6('0xc'),'fields':[_0x5eb6('0xc')]},{'name':_0x5eb6('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd266=['exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xd266,0xe8));var _0x6d26=function(_0x5a06f8,_0x1ca6ae){_0x5a06f8=_0x5a06f8-0x0;var _0x5695ae=_0xd266[_0x5a06f8];return _0x5695ae;};'use strict';var _=require('lodash');var util=require(_0x6d26('0x0'));var logger=require('../../config/logger')(_0x6d26('0x1'));var moment=require('moment');var BPromise=require(_0x6d26('0x2'));var rp=require(_0x6d26('0x3'));var fs=require('fs');var path=require(_0x6d26('0x4'));var rimraf=require(_0x6d26('0x5'));var config=require(_0x6d26('0x6'));var attributes=require(_0x6d26('0x7'));module[_0x6d26('0x8')]=function(_0x5452e8,_0x153202){return _0x5452e8[_0x6d26('0x9')](_0x6d26('0xa'),attributes,{'tableName':_0x6d26('0xb'),'paranoid':![],'indexes':[{'name':_0x6d26('0xc'),'fields':['scheduledat']},{'name':_0x6d26('0xd'),'fields':[_0x6d26('0xd')]},{'name':_0x6d26('0xe'),'fields':[_0x6d26('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b8c453c..9bbe32f 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 _0xe635=['find','ShowCmHopper','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','Contact','keys','User','name','voicePause','UserId','push','all','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','log','req\x20value','phone\x20value','findOne','phone','dialTimezone','getcontactbyohone','getContactByPhone','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xe635,0xc9));var _0x5e63=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xe635[_0xdeac17];return _0x33aabd;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var moment=require(_0x5e63('0x2'));var BPromise=require(_0x5e63('0x3'));var rs=require(_0x5e63('0x4'));var fs=require('fs');var Redis=require(_0x5e63('0x5'));var db=require(_0x5e63('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e63('0x7'))(_0x5e63('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e63('0x9')][_0x5e63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x525875,_0x293187,_0x4cc4db){return new BPromise(function(_0x1b0859,_0x465e91){return client['request'](_0x525875,_0x4cc4db)[_0x5e63('0xb')](function(_0x683002){logger[_0x5e63('0xc')](_0x5e63('0xd'),_0x293187,_0x5e63('0xe'));logger[_0x5e63('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x293187,_0x5e63('0xe'),JSON[_0x5e63('0x10')](_0x683002));if(_0x683002[_0x5e63('0x11')]){if(_0x683002[_0x5e63('0x11')][_0x5e63('0x12')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x293187,_0x683002['error'][_0x5e63('0x13')]);return _0x465e91(_0x683002['error'][_0x5e63('0x13')]);}logger['error'](_0x5e63('0xd'),_0x293187,_0x683002['error'][_0x5e63('0x13')]);return _0x1b0859(_0x683002['error'][_0x5e63('0x13')]);}else{logger[_0x5e63('0xc')](_0x5e63('0xd'),_0x293187,_0x5e63('0xe'));_0x1b0859(_0x683002[_0x5e63('0x14')]['message']);}})[_0x5e63('0x15')](function(_0x5df442){logger[_0x5e63('0x11')](_0x5e63('0xd'),_0x293187,_0x5df442);_0x465e91(_0x5df442);});});}exports[_0x5e63('0x16')]=function(_0x591638){var _0x5b6723=this;return new Promise(function(_0x58609f,_0x4373f6){return db[_0x5e63('0x17')][_0x5e63('0x18')]({'raw':_0x591638['options']?_0x591638[_0x5e63('0x19')][_0x5e63('0x1a')]===undefined?!![]:![]:!![],'where':_0x591638[_0x5e63('0x19')]?_0x591638[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null,'attributes':_0x591638[_0x5e63('0x19')]?_0x591638[_0x5e63('0x19')][_0x5e63('0x1c')]||null:null,'limit':_0x591638[_0x5e63('0x19')]?_0x591638[_0x5e63('0x19')][_0x5e63('0x1d')]||null:null,'include':_0x591638[_0x5e63('0x19')]?_0x591638[_0x5e63('0x19')][_0x5e63('0x1e')]?_['map'](_0x591638['options'][_0x5e63('0x1e')],function(_0x3c0f53){return{'model':db[_0x3c0f53['model']],'as':_0x3c0f53['as'],'attributes':_0x3c0f53['attributes'],'include':_0x3c0f53[_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x3c0f53[_0x5e63('0x1e')],function(_0x43da17){return{'model':db[_0x43da17[_0x5e63('0x20')]],'as':_0x43da17['as'],'attributes':_0x43da17[_0x5e63('0x1c')],'include':_0x43da17['include']?_[_0x5e63('0x1f')](_0x43da17['include'],function(_0x38da1a){return{'model':db[_0x38da1a[_0x5e63('0x20')]],'as':_0x38da1a['as'],'attributes':_0x38da1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e63('0xb')](function(_0x3e063c){logger[_0x5e63('0xc')](_0x5e63('0x16'),_0x591638);logger['debug']('GetCmHopper',_0x591638,JSON[_0x5e63('0x10')](_0x3e063c));_0x58609f(_0x3e063c);})[_0x5e63('0x15')](function(_0x3e637d){logger['error']('GetCmHopper',_0x3e637d[_0x5e63('0x13')],_0x591638);_0x4373f6(_0x5b6723['error'](0x1f4,_0x3e637d[_0x5e63('0x13')]));});});};exports['ShowCmHopper']=function(_0x565599){var _0x479ead=this;return new Promise(function(_0x287c09,_0x2ed04f){return db[_0x5e63('0x17')][_0x5e63('0x21')]({'raw':_0x565599[_0x5e63('0x19')]?_0x565599[_0x5e63('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x565599[_0x5e63('0x19')]?_0x565599['options']['where']||null:null,'attributes':_0x565599[_0x5e63('0x19')]?_0x565599['options']['attributes']||null:null,'include':_0x565599[_0x5e63('0x19')]?_0x565599['options'][_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x565599[_0x5e63('0x19')]['include'],function(_0x12b742){return{'model':db[_0x12b742[_0x5e63('0x20')]],'as':_0x12b742['as'],'attributes':_0x12b742['attributes'],'include':_0x12b742[_0x5e63('0x1e')]?_['map'](_0x12b742[_0x5e63('0x1e')],function(_0x19f5de){return{'model':db[_0x19f5de[_0x5e63('0x20')]],'as':_0x19f5de['as'],'attributes':_0x19f5de[_0x5e63('0x1c')],'include':_0x19f5de[_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x19f5de[_0x5e63('0x1e')],function(_0x3ab1c2){return{'model':db[_0x3ab1c2['model']],'as':_0x3ab1c2['as'],'attributes':_0x3ab1c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e63('0xb')](function(_0x7d187){logger[_0x5e63('0xc')](_0x5e63('0x22'),_0x565599);logger[_0x5e63('0xf')](_0x5e63('0x22'),_0x565599,JSON[_0x5e63('0x10')](_0x7d187));_0x287c09(_0x7d187);})[_0x5e63('0x15')](function(_0x3c5348){logger[_0x5e63('0x11')](_0x5e63('0x22'),_0x3c5348[_0x5e63('0x13')],_0x565599);_0x2ed04f(_0x479ead[_0x5e63('0x11')](0x1f4,_0x3c5348['message']));});});};exports['CreateCmHopper']=function(_0x3dacf7){var _0x30b361=this;return new Promise(function(_0x251388,_0x204de7){return db[_0x5e63('0x17')][_0x5e63('0x23')](_0x3dacf7[_0x5e63('0x24')],{'raw':_0x3dacf7[_0x5e63('0x19')]?_0x3dacf7[_0x5e63('0x19')][_0x5e63('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x7f8b01){logger[_0x5e63('0xc')](_0x5e63('0x25'),_0x3dacf7);logger[_0x5e63('0xf')](_0x5e63('0x25'),_0x3dacf7,JSON[_0x5e63('0x10')](_0x7f8b01));_0x251388(_0x7f8b01);})['catch'](function(_0x4c2e3d){logger[_0x5e63('0x11')](_0x5e63('0x25'),_0x4c2e3d['message'],_0x3dacf7);_0x204de7(_0x30b361['error'](0x1f4,_0x4c2e3d[_0x5e63('0x13')]));});});};exports['UpdateCmHopper']=function(_0x591aae){var _0x25997e=this;return new Promise(function(_0x1f233f,_0x3ceabf){return db[_0x5e63('0x17')][_0x5e63('0x26')](_0x591aae[_0x5e63('0x24')],{'raw':_0x591aae[_0x5e63('0x19')]?_0x591aae[_0x5e63('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x591aae[_0x5e63('0x19')]?_0x591aae['options'][_0x5e63('0x1b')]||null:null,'attributes':_0x591aae['options']?_0x591aae[_0x5e63('0x19')][_0x5e63('0x1c')]||null:null,'limit':_0x591aae[_0x5e63('0x19')]?_0x591aae[_0x5e63('0x19')][_0x5e63('0x1d')]||null:null})[_0x5e63('0xb')](function(_0xbe5dfd){logger['info'](_0x5e63('0x27'),_0x591aae);logger['debug'](_0x5e63('0x27'),_0x591aae,JSON[_0x5e63('0x10')](_0xbe5dfd));_0x1f233f(_0xbe5dfd);})[_0x5e63('0x15')](function(_0xa1edf1){logger[_0x5e63('0x11')](_0x5e63('0x27'),_0xa1edf1['message'],_0x591aae);_0x3ceabf(_0x25997e['error'](0x1f4,_0xa1edf1['message']));});});};exports[_0x5e63('0x28')]=function(_0x59c3b5){var _0x514337=this;return new Promise(function(_0x257ff9,_0x56630a){return db[_0x5e63('0x17')][_0x5e63('0x29')]({'where':_0x59c3b5[_0x5e63('0x19')]?_0x59c3b5[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null})[_0x5e63('0xb')](function(_0x117b53){logger[_0x5e63('0xc')](_0x5e63('0x28'),_0x59c3b5);logger[_0x5e63('0xf')](_0x5e63('0x28'),_0x59c3b5,JSON['stringify'](_0x117b53));_0x257ff9(_0x117b53);})[_0x5e63('0x15')](function(_0x1da26e){logger['error'](_0x5e63('0x28'),_0x1da26e[_0x5e63('0x13')],_0x59c3b5);_0x56630a(_0x514337[_0x5e63('0x11')](0x1f4,_0x1da26e['message']));});});};exports[_0x5e63('0x2a')]=function(_0x5b2837){var _0x34b6bd=this;return new Promise(function(_0x377f6c,_0x4a3b1f){return db[_0x5e63('0x2b')][_0x5e63('0x2c')]()[_0x5e63('0xb')](function(_0x46d2ef){return db['sequelize'][_0x5e63('0x2d')](function(_0x2cc09f){return db[_0x5e63('0x17')]['findAll']({'where':_0x5b2837[_0x5e63('0x19')]?_0x5b2837['options'][_0x5e63('0x1b')]||null:null,'attributes':_0x5b2837[_0x5e63('0x19')]?_0x5b2837[_0x5e63('0x19')]['attributes']||null:null,'limit':_0x5b2837[_0x5e63('0x19')]?_0x5b2837[_0x5e63('0x19')]['limit']||null:null,'order':_0x5b2837[_0x5e63('0x19')]?_0x5b2837[_0x5e63('0x19')][_0x5e63('0x2e')]||null:null,'transaction':_0x2cc09f,'lock':_0x2cc09f[_0x5e63('0x2f')]['UPDATE'],'include':[{'model':db[_0x5e63('0x2b')],'as':_0x5e63('0x30'),'attributes':_[_0x5e63('0x31')](_0x46d2ef)},{'model':db[_0x5e63('0x32')],'as':'Agent','attributes':['id',_0x5e63('0x33'),_0x5e63('0x34')]}]})[_0x5e63('0xb')](function(_0x1e8349){var _0x1cf5bc=[];var _0x31492c=[];for(var _0x369ce7=0x0;_0x369ce7<_0x1e8349['length'];_0x369ce7+=0x1){if(!_0x31492c['includes'](_0x1e8349[_0x369ce7][_0x5e63('0x35')])){_0x31492c[_0x5e63('0x36')](_0x1e8349[_0x369ce7]['UserId']);_0x1cf5bc[_0x5e63('0x36')](_0x1e8349[_0x369ce7][_0x5e63('0x26')](_0x5b2837['body'],{'transaction':_0x2cc09f}));}}return BPromise[_0x5e63('0x37')](_0x1cf5bc);});})[_0x5e63('0xb')](function(_0x46f4d5){logger['info'](_0x5e63('0x2a'),_0x5b2837);logger[_0x5e63('0xf')](_0x5e63('0x2a'),_0x5b2837,JSON[_0x5e63('0x10')](_0x46f4d5));_0x377f6c(_0x46f4d5);})[_0x5e63('0x15')](function(_0x3ecf3a){logger['error'](_0x5e63('0x2a'),_0x3ecf3a[_0x5e63('0x13')],_0x5b2837);_0x4a3b1f(_0x34b6bd[_0x5e63('0x11')](0x1f4,_0x3ecf3a[_0x5e63('0x13')]));});});});};exports[_0x5e63('0x38')]=function(_0x2d7169){var _0x1319dd=this;return new Promise(function(_0x1c0b70,_0xfaf3b8){return db[_0x5e63('0x39')][_0x5e63('0x2d')](function(_0x3ccb3b){return db[_0x5e63('0x3a')][_0x5e63('0x23')](_0x2d7169[_0x5e63('0x24')],{'raw':_0x2d7169[_0x5e63('0x19')]?_0x2d7169[_0x5e63('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x3ccb3b})[_0x5e63('0xb')](function(){return db['CmHopper'][_0x5e63('0x29')]({'where':_0x2d7169[_0x5e63('0x19')]?_0x2d7169[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null,'transaction':_0x3ccb3b});});})[_0x5e63('0xb')](function(_0x249c10){logger['info'](_0x5e63('0x38'),_0x2d7169);logger[_0x5e63('0xf')]('MoveContactManagedDialer',_0x2d7169,JSON[_0x5e63('0x10')](_0x249c10));_0x1c0b70(_0x249c10);})[_0x5e63('0x15')](function(_0xfd69f7){logger[_0x5e63('0x11')](_0x5e63('0x38'),_0xfd69f7[_0x5e63('0x13')],_0x2d7169);_0xfaf3b8(_0x1319dd[_0x5e63('0x11')](0x1f4,_0xfd69f7[_0x5e63('0x13')]));});});};exports[_0x5e63('0x3b')]=function(_0x5f232d){var _0x2d5467=this;return new Promise(function(_0x26f9a3,_0x3c408f){return db['CmHopper'][_0x5e63('0x18')]({'raw':_0x5f232d[_0x5e63('0x19')]?_0x5f232d[_0x5e63('0x19')][_0x5e63('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f232d[_0x5e63('0x19')]?_0x5f232d[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5e63('0x3c'),db[_0x5e63('0x39')]['fn']('IF',db[_0x5e63('0x39')]['literal'](_0x5e63('0x3d')+util[_0x5e63('0x3e')](_0x5e63('0x3f'),moment()[_0x5e63('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x5e63('0x40')))),_0x5e63('0x41')]]})['then'](function(_0x1ecfd1){logger[_0x5e63('0xc')](_0x5e63('0x3b'),_0x5f232d);logger['debug'](_0x5e63('0x3b'),_0x5f232d,JSON[_0x5e63('0x10')](_0x1ecfd1));_0x26f9a3(_0x1ecfd1);})[_0x5e63('0x15')](function(_0x4df9cb){logger['error'](_0x5e63('0x3b'),_0x4df9cb[_0x5e63('0x13')],_0x5f232d);_0x3c408f(_0x2d5467['error'](0x1f4,_0x4df9cb['message']));});});};exports[_0x5e63('0x42')]=function(_0x202378){var _0x320cc2=this;return new Promise(function(_0x118128,_0x6a0f98){return db[_0x5e63('0x2b')]['describe']()['then'](function(_0x200649){return db[_0x5e63('0x39')][_0x5e63('0x2d')](function(_0x4886f1){return db[_0x5e63('0x17')][_0x5e63('0x18')]({'where':_0x202378['options']?_0x202378['options']['where']||null:null,'attributes':_0x202378[_0x5e63('0x19')]?_0x202378['options']['attributes']||null:null,'limit':0x1,'order':_0x202378['options']?_0x202378['options'][_0x5e63('0x2e')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x4886f1,'lock':_0x4886f1[_0x5e63('0x2f')][_0x5e63('0x43')],'include':_0x202378[_0x5e63('0x19')]?_0x202378[_0x5e63('0x19')][_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x202378['options'][_0x5e63('0x1e')],function(_0x4bf475){return{'model':db[_0x4bf475['model']],'as':_0x4bf475['as'],'attributes':_0x4bf475[_0x5e63('0x1c')],'include':_0x4bf475['include']?_[_0x5e63('0x1f')](_0x4bf475[_0x5e63('0x1e')],function(_0x41b997){return{'model':db[_0x41b997[_0x5e63('0x20')]],'as':_0x41b997['as'],'attributes':_0x41b997[_0x5e63('0x1c')],'include':_0x41b997[_0x5e63('0x1e')]?_['map'](_0x41b997['include'],function(_0x2a1423){return{'model':db[_0x2a1423['model']],'as':_0x2a1423['as'],'attributes':_0x2a1423[_0x5e63('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e63('0xb')](function(_0x562a66){var _0x4f0703=[];for(var _0x1d9a1c=0x0;_0x1d9a1c<_0x562a66['length'];_0x1d9a1c+=0x1){_0x4f0703[_0x5e63('0x36')](_0x562a66[_0x1d9a1c][_0x5e63('0x26')](_0x202378[_0x5e63('0x24')],{'transaction':_0x4886f1}));}return BPromise[_0x5e63('0x37')](_0x4f0703);});})['then'](function(_0x166005){logger[_0x5e63('0xc')](_0x5e63('0x42'),_0x202378);logger[_0x5e63('0xf')](_0x5e63('0x42'),_0x202378,JSON[_0x5e63('0x10')](_0x166005));_0x118128(_0x166005);})[_0x5e63('0x15')](function(_0x492f0e){logger[_0x5e63('0x11')]('GetContactRecallMe',_0x492f0e[_0x5e63('0x13')],_0x202378);_0x6a0f98(_0x320cc2[_0x5e63('0x11')](0x1f4,_0x492f0e[_0x5e63('0x13')]));});});});};exports[_0x5e63('0x44')]=function(_0x5b168c){var _0x46537d=this;return new Promise(function(_0x1bcbee,_0x51802d){db[_0x5e63('0x2b')]['describe']()['then'](function(_0x474238){return db[_0x5e63('0x17')][_0x5e63('0x18')]({'raw':_0x5b168c[_0x5e63('0x19')]?_0x5b168c[_0x5e63('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b168c['options']?_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1b')]||null:null,'attributes':_0x5b168c[_0x5e63('0x19')]?_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1c')]||null:null,'limit':_0x5b168c[_0x5e63('0x19')]?_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1d')]||null:null,'include':_0x5b168c[_0x5e63('0x19')]?_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x5b168c[_0x5e63('0x19')][_0x5e63('0x1e')],function(_0x24a929){return{'model':db[_0x24a929['model']],'as':_0x24a929['as'],'attributes':_0x24a929['as']===_0x5e63('0x30')?_[_0x5e63('0x31')](_0x474238):_0x24a929['attributes'],'include':_0x24a929[_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x24a929[_0x5e63('0x1e')],function(_0x1bc998){return{'model':db[_0x1bc998[_0x5e63('0x20')]],'as':_0x1bc998['as'],'attributes':_0x1bc998[_0x5e63('0x1c')],'include':_0x1bc998[_0x5e63('0x1e')]?_[_0x5e63('0x1f')](_0x1bc998[_0x5e63('0x1e')],function(_0x2936c4){return{'model':db[_0x2936c4[_0x5e63('0x20')]],'as':_0x2936c4['as'],'attributes':_0x2936c4[_0x5e63('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e63('0xb')](function(_0xdf483f){logger['info'](_0x5e63('0x16'),_0x5b168c);logger[_0x5e63('0xf')]('GetCmHopper',_0x5b168c,JSON[_0x5e63('0x10')](_0xdf483f));_0x1bcbee(_0xdf483f);})[_0x5e63('0x15')](function(_0x4f5072){logger['error']('GetCmHopper',_0x4f5072[_0x5e63('0x13')],_0x5b168c);_0x51802d(_0x46537d[_0x5e63('0x11')](0x1f4,_0x4f5072[_0x5e63('0x13')]));});});});};exports[_0x5e63('0x45')]=function(_0x58956c){console[_0x5e63('0x46')](_0x5e63('0x47'),_0x58956c);console[_0x5e63('0x46')](_0x5e63('0x48'),_0x58956c[_0x5e63('0x19')][_0x5e63('0x1b')]['phone']);_this=this;return new Promise(function(_0x1bc074,_0x3eea19){return db[_0x5e63('0x2b')][_0x5e63('0x49')]({'raw':!![],'where':{'phone':_0x58956c[_0x5e63('0x19')][_0x5e63('0x1b')][_0x5e63('0x4a')]},'attributes':['id',_0x5e63('0x4b')],'order':[['id','DESC']]})['then'](function(_0x5bbc4e){console[_0x5e63('0x46')](_0x5e63('0x4c'),_0x5bbc4e);logger['info'](_0x5e63('0x4d'),_0x58956c);logger['debug']('getContactByPhone',_0x58956c,JSON['stringify'](_0x5bbc4e));_0x1bc074(_0x5bbc4e);})[_0x5e63('0x15')](function(_0x4cb80d){logger[_0x5e63('0x11')](_0x5e63('0x4d'),_0x4cb80d[_0x5e63('0x13')],_0x58956c);_0x3eea19(_this[_0x5e63('0x11')](0x1f4,_0x4cb80d[_0x5e63('0x13')]));});});}; \ No newline at end of file +var _0xc2b4=['UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','voicePause','includes','UserId','push','all','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','GetContactRecallMe','describe','length','GetCmHopperPreview','GetContactByPhone','log','req\x20value','phone\x20value','phone','findOne','dialTimezone','DESC','getcontactbyohone','getContactByPhone','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetCmHopper','options','raw','where','limit','include','map','model','attributes','info','ShowCmHopper','CmHopper','find','create','CreateCmHopper','update','body'];(function(_0x295d44,_0x339fad){var _0x189d2b=function(_0x1a1c41){while(--_0x1a1c41){_0x295d44['push'](_0x295d44['shift']());}};_0x189d2b(++_0x339fad);}(_0xc2b4,0xc5));var _0x4c2b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc2b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c2b('0x0'));var util=require(_0x4c2b('0x1'));var moment=require(_0x4c2b('0x2'));var BPromise=require(_0x4c2b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c2b('0x4'))['db'];var utils=require(_0x4c2b('0x5'));var logger=require(_0x4c2b('0x6'))('rpc');var config=require(_0x4c2b('0x7'));var jayson=require(_0x4c2b('0x8'));var client=jayson['client'][_0x4c2b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x539c7e,_0x12c96e,_0xa5c76b){return new BPromise(function(_0x427f07,_0x9a40c8){return client[_0x4c2b('0xa')](_0x539c7e,_0xa5c76b)[_0x4c2b('0xb')](function(_0x251cd7){logger['info'](_0x4c2b('0xc'),_0x12c96e,_0x4c2b('0xd'));logger[_0x4c2b('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x12c96e,_0x4c2b('0xd'),JSON[_0x4c2b('0xf')](_0x251cd7));if(_0x251cd7[_0x4c2b('0x10')]){if(_0x251cd7['error']['code']===0x1f4){logger['error'](_0x4c2b('0xc'),_0x12c96e,_0x251cd7[_0x4c2b('0x10')][_0x4c2b('0x11')]);return _0x9a40c8(_0x251cd7[_0x4c2b('0x10')][_0x4c2b('0x11')]);}logger[_0x4c2b('0x10')](_0x4c2b('0xc'),_0x12c96e,_0x251cd7[_0x4c2b('0x10')][_0x4c2b('0x11')]);return _0x427f07(_0x251cd7['error']['message']);}else{logger['info'](_0x4c2b('0xc'),_0x12c96e,_0x4c2b('0xd'));_0x427f07(_0x251cd7[_0x4c2b('0x12')][_0x4c2b('0x11')]);}})[_0x4c2b('0x13')](function(_0x3e5a3b){logger[_0x4c2b('0x10')](_0x4c2b('0xc'),_0x12c96e,_0x3e5a3b);_0x9a40c8(_0x3e5a3b);});});}exports[_0x4c2b('0x14')]=function(_0x551a15){var _0x14dd86=this;return new Promise(function(_0x401dca,_0x28ac26){return db['CmHopper']['findAll']({'raw':_0x551a15['options']?_0x551a15[_0x4c2b('0x15')][_0x4c2b('0x16')]===undefined?!![]:![]:!![],'where':_0x551a15[_0x4c2b('0x15')]?_0x551a15[_0x4c2b('0x15')][_0x4c2b('0x17')]||null:null,'attributes':_0x551a15[_0x4c2b('0x15')]?_0x551a15[_0x4c2b('0x15')]['attributes']||null:null,'limit':_0x551a15['options']?_0x551a15[_0x4c2b('0x15')][_0x4c2b('0x18')]||null:null,'include':_0x551a15[_0x4c2b('0x15')]?_0x551a15['options'][_0x4c2b('0x19')]?_[_0x4c2b('0x1a')](_0x551a15['options'][_0x4c2b('0x19')],function(_0x3eb4fb){return{'model':db[_0x3eb4fb[_0x4c2b('0x1b')]],'as':_0x3eb4fb['as'],'attributes':_0x3eb4fb[_0x4c2b('0x1c')],'include':_0x3eb4fb[_0x4c2b('0x19')]?_[_0x4c2b('0x1a')](_0x3eb4fb['include'],function(_0x393428){return{'model':db[_0x393428['model']],'as':_0x393428['as'],'attributes':_0x393428[_0x4c2b('0x1c')],'include':_0x393428[_0x4c2b('0x19')]?_[_0x4c2b('0x1a')](_0x393428[_0x4c2b('0x19')],function(_0x38773e){return{'model':db[_0x38773e[_0x4c2b('0x1b')]],'as':_0x38773e['as'],'attributes':_0x38773e[_0x4c2b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a0698){logger[_0x4c2b('0x1d')]('GetCmHopper',_0x551a15);logger['debug'](_0x4c2b('0x14'),_0x551a15,JSON[_0x4c2b('0xf')](_0x1a0698));_0x401dca(_0x1a0698);})['catch'](function(_0xc42e5d){logger['error'](_0x4c2b('0x14'),_0xc42e5d['message'],_0x551a15);_0x28ac26(_0x14dd86[_0x4c2b('0x10')](0x1f4,_0xc42e5d[_0x4c2b('0x11')]));});});};exports[_0x4c2b('0x1e')]=function(_0x46bc2d){var _0x54fb81=this;return new Promise(function(_0x3afb6d,_0x3bc581){return db[_0x4c2b('0x1f')][_0x4c2b('0x20')]({'raw':_0x46bc2d[_0x4c2b('0x15')]?_0x46bc2d[_0x4c2b('0x15')][_0x4c2b('0x16')]===undefined?!![]:![]:!![],'where':_0x46bc2d['options']?_0x46bc2d[_0x4c2b('0x15')][_0x4c2b('0x17')]||null:null,'attributes':_0x46bc2d[_0x4c2b('0x15')]?_0x46bc2d[_0x4c2b('0x15')]['attributes']||null:null,'include':_0x46bc2d[_0x4c2b('0x15')]?_0x46bc2d['options']['include']?_['map'](_0x46bc2d[_0x4c2b('0x15')]['include'],function(_0x3927a2){return{'model':db[_0x3927a2[_0x4c2b('0x1b')]],'as':_0x3927a2['as'],'attributes':_0x3927a2[_0x4c2b('0x1c')],'include':_0x3927a2['include']?_[_0x4c2b('0x1a')](_0x3927a2[_0x4c2b('0x19')],function(_0x22dc15){return{'model':db[_0x22dc15[_0x4c2b('0x1b')]],'as':_0x22dc15['as'],'attributes':_0x22dc15[_0x4c2b('0x1c')],'include':_0x22dc15[_0x4c2b('0x19')]?_[_0x4c2b('0x1a')](_0x22dc15[_0x4c2b('0x19')],function(_0x21de83){return{'model':db[_0x21de83[_0x4c2b('0x1b')]],'as':_0x21de83['as'],'attributes':_0x21de83[_0x4c2b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4c2b('0xb')](function(_0x3bd440){logger['info'](_0x4c2b('0x1e'),_0x46bc2d);logger[_0x4c2b('0xe')](_0x4c2b('0x1e'),_0x46bc2d,JSON[_0x4c2b('0xf')](_0x3bd440));_0x3afb6d(_0x3bd440);})['catch'](function(_0x5a06a6){logger['error'](_0x4c2b('0x1e'),_0x5a06a6[_0x4c2b('0x11')],_0x46bc2d);_0x3bc581(_0x54fb81[_0x4c2b('0x10')](0x1f4,_0x5a06a6[_0x4c2b('0x11')]));});});};exports['CreateCmHopper']=function(_0x9e998f){var _0x4e5e8b=this;return new Promise(function(_0x453c62,_0x3cf19d){return db[_0x4c2b('0x1f')][_0x4c2b('0x21')](_0x9e998f['body'],{'raw':_0x9e998f[_0x4c2b('0x15')]?_0x9e998f[_0x4c2b('0x15')][_0x4c2b('0x16')]===undefined?!![]:![]:!![]})[_0x4c2b('0xb')](function(_0x5b63a0){logger[_0x4c2b('0x1d')](_0x4c2b('0x22'),_0x9e998f);logger['debug'](_0x4c2b('0x22'),_0x9e998f,JSON[_0x4c2b('0xf')](_0x5b63a0));_0x453c62(_0x5b63a0);})['catch'](function(_0x5e7b1a){logger[_0x4c2b('0x10')](_0x4c2b('0x22'),_0x5e7b1a[_0x4c2b('0x11')],_0x9e998f);_0x3cf19d(_0x4e5e8b['error'](0x1f4,_0x5e7b1a[_0x4c2b('0x11')]));});});};exports['UpdateCmHopper']=function(_0x5322ef){var _0x2fb9da=this;return new Promise(function(_0x4a5ec4,_0x17ec89){return db[_0x4c2b('0x1f')][_0x4c2b('0x23')](_0x5322ef[_0x4c2b('0x24')],{'raw':_0x5322ef[_0x4c2b('0x15')]?_0x5322ef['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5322ef[_0x4c2b('0x15')]?_0x5322ef['options'][_0x4c2b('0x17')]||null:null,'attributes':_0x5322ef[_0x4c2b('0x15')]?_0x5322ef[_0x4c2b('0x15')][_0x4c2b('0x1c')]||null:null,'limit':_0x5322ef[_0x4c2b('0x15')]?_0x5322ef['options'][_0x4c2b('0x18')]||null:null})['then'](function(_0x472b55){logger['info'](_0x4c2b('0x25'),_0x5322ef);logger[_0x4c2b('0xe')]('UpdateCmHopper',_0x5322ef,JSON[_0x4c2b('0xf')](_0x472b55));_0x4a5ec4(_0x472b55);})[_0x4c2b('0x13')](function(_0x47ed9d){logger['error'](_0x4c2b('0x25'),_0x47ed9d[_0x4c2b('0x11')],_0x5322ef);_0x17ec89(_0x2fb9da[_0x4c2b('0x10')](0x1f4,_0x47ed9d[_0x4c2b('0x11')]));});});};exports[_0x4c2b('0x26')]=function(_0x4419fd){var _0x259099=this;return new Promise(function(_0x4cb2eb,_0x4abf7e){return db[_0x4c2b('0x1f')][_0x4c2b('0x27')]({'where':_0x4419fd[_0x4c2b('0x15')]?_0x4419fd[_0x4c2b('0x15')][_0x4c2b('0x17')]||null:null})[_0x4c2b('0xb')](function(_0x53e4fc){logger[_0x4c2b('0x1d')](_0x4c2b('0x26'),_0x4419fd);logger[_0x4c2b('0xe')]('DestroyCmHopper',_0x4419fd,JSON[_0x4c2b('0xf')](_0x53e4fc));_0x4cb2eb(_0x53e4fc);})['catch'](function(_0x148542){logger[_0x4c2b('0x10')](_0x4c2b('0x26'),_0x148542[_0x4c2b('0x11')],_0x4419fd);_0x4abf7e(_0x259099[_0x4c2b('0x10')](0x1f4,_0x148542[_0x4c2b('0x11')]));});});};exports[_0x4c2b('0x28')]=function(_0x1644ef){var _0x8eb396=this;return new Promise(function(_0xa42b6e,_0xcd9280){return db[_0x4c2b('0x29')]['describe']()[_0x4c2b('0xb')](function(_0x214bd9){return db[_0x4c2b('0x2a')][_0x4c2b('0x2b')](function(_0x43cb38){return db[_0x4c2b('0x1f')][_0x4c2b('0x2c')]({'where':_0x1644ef['options']?_0x1644ef[_0x4c2b('0x15')][_0x4c2b('0x17')]||null:null,'attributes':_0x1644ef[_0x4c2b('0x15')]?_0x1644ef['options'][_0x4c2b('0x1c')]||null:null,'limit':_0x1644ef[_0x4c2b('0x15')]?_0x1644ef[_0x4c2b('0x15')]['limit']||null:null,'order':_0x1644ef[_0x4c2b('0x15')]?_0x1644ef[_0x4c2b('0x15')][_0x4c2b('0x2d')]||null:null,'transaction':_0x43cb38,'lock':_0x43cb38[_0x4c2b('0x2e')][_0x4c2b('0x2f')],'include':[{'model':db['CmContact'],'as':_0x4c2b('0x30'),'attributes':_[_0x4c2b('0x31')](_0x214bd9)},{'model':db[_0x4c2b('0x32')],'as':'Agent','attributes':['id','name',_0x4c2b('0x33')]}]})['then'](function(_0x345880){var _0x1813da=[];var _0x58c23a=[];for(var _0xd36cb=0x0;_0xd36cb<_0x345880['length'];_0xd36cb+=0x1){if(!_0x58c23a[_0x4c2b('0x34')](_0x345880[_0xd36cb][_0x4c2b('0x35')])){_0x58c23a['push'](_0x345880[_0xd36cb][_0x4c2b('0x35')]);_0x1813da[_0x4c2b('0x36')](_0x345880[_0xd36cb]['update'](_0x1644ef[_0x4c2b('0x24')],{'transaction':_0x43cb38}));}}return BPromise[_0x4c2b('0x37')](_0x1813da);});})['then'](function(_0x1767ff){logger[_0x4c2b('0x1d')](_0x4c2b('0x28'),_0x1644ef);logger['debug']('GetContactDialer',_0x1644ef,JSON[_0x4c2b('0xf')](_0x1767ff));_0xa42b6e(_0x1767ff);})[_0x4c2b('0x13')](function(_0x36e1c3){logger[_0x4c2b('0x10')]('GetContactDialer',_0x36e1c3[_0x4c2b('0x11')],_0x1644ef);_0xcd9280(_0x8eb396[_0x4c2b('0x10')](0x1f4,_0x36e1c3[_0x4c2b('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x5b1cb9){var _0x125658=this;return new Promise(function(_0xa0e0f2,_0x1eb685){return db['sequelize'][_0x4c2b('0x2b')](function(_0x3712bd){return db[_0x4c2b('0x38')]['create'](_0x5b1cb9[_0x4c2b('0x24')],{'raw':_0x5b1cb9[_0x4c2b('0x15')]?_0x5b1cb9['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x3712bd})[_0x4c2b('0xb')](function(){return db['CmHopper'][_0x4c2b('0x27')]({'where':_0x5b1cb9[_0x4c2b('0x15')]?_0x5b1cb9[_0x4c2b('0x15')][_0x4c2b('0x17')]||null:null,'transaction':_0x3712bd});});})['then'](function(_0x75d814){logger[_0x4c2b('0x1d')](_0x4c2b('0x39'),_0x5b1cb9);logger[_0x4c2b('0xe')]('MoveContactManagedDialer',_0x5b1cb9,JSON[_0x4c2b('0xf')](_0x75d814));_0xa0e0f2(_0x75d814);})[_0x4c2b('0x13')](function(_0x3053ac){logger[_0x4c2b('0x10')]('MoveContactManagedDialer',_0x3053ac[_0x4c2b('0x11')],_0x5b1cb9);_0x1eb685(_0x125658[_0x4c2b('0x10')](0x1f4,_0x3053ac[_0x4c2b('0x11')]));});});};exports[_0x4c2b('0x3a')]=function(_0x3937bc){var _0x3072d3=this;return new Promise(function(_0x14f4a1,_0x541410){return db['CmHopper'][_0x4c2b('0x2c')]({'raw':_0x3937bc[_0x4c2b('0x15')]?_0x3937bc['options'][_0x4c2b('0x16')]===undefined?!![]:![]:!![],'where':_0x3937bc['options']?_0x3937bc[_0x4c2b('0x15')][_0x4c2b('0x17')]||null:null,'attributes':[[db[_0x4c2b('0x2a')]['fn'](_0x4c2b('0x3b'),db[_0x4c2b('0x2a')]['fn']('IF',db[_0x4c2b('0x2a')]['literal'](_0x4c2b('0x3c')+util['format'](_0x4c2b('0x3d'),moment()[_0x4c2b('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x4c2b('0x3f')))),'contactsRescheduled']]})[_0x4c2b('0xb')](function(_0x65f8ec){logger[_0x4c2b('0x1d')](_0x4c2b('0x3a'),_0x3937bc);logger[_0x4c2b('0xe')](_0x4c2b('0x3a'),_0x3937bc,JSON['stringify'](_0x65f8ec));_0x14f4a1(_0x65f8ec);})[_0x4c2b('0x13')](function(_0x4374d8){logger[_0x4c2b('0x10')]('CountReScheduled',_0x4374d8[_0x4c2b('0x11')],_0x3937bc);_0x541410(_0x3072d3['error'](0x1f4,_0x4374d8[_0x4c2b('0x11')]));});});};exports[_0x4c2b('0x40')]=function(_0x4f05d7){var _0x16e15f=this;return new Promise(function(_0x879682,_0x2df403){return db[_0x4c2b('0x29')][_0x4c2b('0x41')]()[_0x4c2b('0xb')](function(_0xa291bb){return db[_0x4c2b('0x2a')][_0x4c2b('0x2b')](function(_0x4748fa){return db[_0x4c2b('0x1f')][_0x4c2b('0x2c')]({'where':_0x4f05d7[_0x4c2b('0x15')]?_0x4f05d7[_0x4c2b('0x15')][_0x4c2b('0x17')]||null:null,'attributes':_0x4f05d7['options']?_0x4f05d7[_0x4c2b('0x15')][_0x4c2b('0x1c')]||null:null,'limit':0x1,'order':_0x4f05d7[_0x4c2b('0x15')]?_0x4f05d7[_0x4c2b('0x15')][_0x4c2b('0x2d')]||null:null,'group':db[_0x4c2b('0x1f')][_0x4c2b('0x35')],'transaction':_0x4748fa,'lock':_0x4748fa[_0x4c2b('0x2e')]['UPDATE'],'include':_0x4f05d7[_0x4c2b('0x15')]?_0x4f05d7[_0x4c2b('0x15')][_0x4c2b('0x19')]?_[_0x4c2b('0x1a')](_0x4f05d7[_0x4c2b('0x15')][_0x4c2b('0x19')],function(_0x3f0ea0){return{'model':db[_0x3f0ea0['model']],'as':_0x3f0ea0['as'],'attributes':_0x3f0ea0[_0x4c2b('0x1c')],'include':_0x3f0ea0[_0x4c2b('0x19')]?_['map'](_0x3f0ea0[_0x4c2b('0x19')],function(_0x3eff3e){return{'model':db[_0x3eff3e[_0x4c2b('0x1b')]],'as':_0x3eff3e['as'],'attributes':_0x3eff3e[_0x4c2b('0x1c')],'include':_0x3eff3e['include']?_[_0x4c2b('0x1a')](_0x3eff3e[_0x4c2b('0x19')],function(_0x167108){return{'model':db[_0x167108[_0x4c2b('0x1b')]],'as':_0x167108['as'],'attributes':_0x167108['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c2b('0xb')](function(_0x36ba48){var _0x42f442=[];for(var _0x37937a=0x0;_0x37937a<_0x36ba48[_0x4c2b('0x42')];_0x37937a+=0x1){_0x42f442[_0x4c2b('0x36')](_0x36ba48[_0x37937a]['update'](_0x4f05d7[_0x4c2b('0x24')],{'transaction':_0x4748fa}));}return BPromise[_0x4c2b('0x37')](_0x42f442);});})['then'](function(_0x5f37d0){logger['info'](_0x4c2b('0x40'),_0x4f05d7);logger[_0x4c2b('0xe')](_0x4c2b('0x40'),_0x4f05d7,JSON[_0x4c2b('0xf')](_0x5f37d0));_0x879682(_0x5f37d0);})[_0x4c2b('0x13')](function(_0x4da485){logger[_0x4c2b('0x10')](_0x4c2b('0x40'),_0x4da485[_0x4c2b('0x11')],_0x4f05d7);_0x2df403(_0x16e15f[_0x4c2b('0x10')](0x1f4,_0x4da485[_0x4c2b('0x11')]));});});});};exports[_0x4c2b('0x43')]=function(_0x2dcb12){var _0x268292=this;return new Promise(function(_0x563c60,_0x1c3702){db[_0x4c2b('0x29')][_0x4c2b('0x41')]()[_0x4c2b('0xb')](function(_0x8a3c3d){return db[_0x4c2b('0x1f')][_0x4c2b('0x2c')]({'raw':_0x2dcb12[_0x4c2b('0x15')]?_0x2dcb12['options'][_0x4c2b('0x16')]===undefined?!![]:![]:!![],'where':_0x2dcb12[_0x4c2b('0x15')]?_0x2dcb12['options'][_0x4c2b('0x17')]||null:null,'attributes':_0x2dcb12[_0x4c2b('0x15')]?_0x2dcb12['options']['attributes']||null:null,'limit':_0x2dcb12[_0x4c2b('0x15')]?_0x2dcb12[_0x4c2b('0x15')][_0x4c2b('0x18')]||null:null,'include':_0x2dcb12['options']?_0x2dcb12[_0x4c2b('0x15')][_0x4c2b('0x19')]?_[_0x4c2b('0x1a')](_0x2dcb12['options'][_0x4c2b('0x19')],function(_0x47dc00){return{'model':db[_0x47dc00[_0x4c2b('0x1b')]],'as':_0x47dc00['as'],'attributes':_0x47dc00['as']===_0x4c2b('0x30')?_[_0x4c2b('0x31')](_0x8a3c3d):_0x47dc00[_0x4c2b('0x1c')],'include':_0x47dc00['include']?_[_0x4c2b('0x1a')](_0x47dc00[_0x4c2b('0x19')],function(_0x2ffc35){return{'model':db[_0x2ffc35[_0x4c2b('0x1b')]],'as':_0x2ffc35['as'],'attributes':_0x2ffc35[_0x4c2b('0x1c')],'include':_0x2ffc35[_0x4c2b('0x19')]?_[_0x4c2b('0x1a')](_0x2ffc35[_0x4c2b('0x19')],function(_0x4f0252){return{'model':db[_0x4f0252['model']],'as':_0x4f0252['as'],'attributes':_0x4f0252[_0x4c2b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5084fd){logger['info']('GetCmHopper',_0x2dcb12);logger[_0x4c2b('0xe')]('GetCmHopper',_0x2dcb12,JSON[_0x4c2b('0xf')](_0x5084fd));_0x563c60(_0x5084fd);})[_0x4c2b('0x13')](function(_0x1bfe52){logger[_0x4c2b('0x10')](_0x4c2b('0x14'),_0x1bfe52[_0x4c2b('0x11')],_0x2dcb12);_0x1c3702(_0x268292[_0x4c2b('0x10')](0x1f4,_0x1bfe52['message']));});});});};exports[_0x4c2b('0x44')]=function(_0x40a058){console[_0x4c2b('0x45')](_0x4c2b('0x46'),_0x40a058);console[_0x4c2b('0x45')](_0x4c2b('0x47'),_0x40a058['options'][_0x4c2b('0x17')][_0x4c2b('0x48')]);_this=this;return new Promise(function(_0x402c3c,_0x233ddf){return db[_0x4c2b('0x29')][_0x4c2b('0x49')]({'raw':!![],'where':{'phone':_0x40a058['options'][_0x4c2b('0x17')][_0x4c2b('0x48')]},'attributes':['id',_0x4c2b('0x4a')],'order':[['id',_0x4c2b('0x4b')]]})[_0x4c2b('0xb')](function(_0x2f9414){console['log'](_0x4c2b('0x4c'),_0x2f9414);logger[_0x4c2b('0x1d')](_0x4c2b('0x4d'),_0x40a058);logger[_0x4c2b('0xe')](_0x4c2b('0x4d'),_0x40a058,JSON['stringify'](_0x2f9414));_0x402c3c(_0x2f9414);})[_0x4c2b('0x13')](function(_0x9bdaf0){logger[_0x4c2b('0x10')](_0x4c2b('0x4d'),_0x9bdaf0[_0x4c2b('0x11')],_0x40a058);_0x233ddf(_this[_0x4c2b('0x10')](0x1f4,_0x9bdaf0['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index cbdf7d7..d2a1b7f 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 _0xeec6=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','/:id','post','/preview','getPreview','getTimezone','put','update','delete','destroy'];(function(_0x588c1c,_0x1f581f){var _0x476dd9=function(_0x32a2f9){while(--_0x32a2f9){_0x588c1c['push'](_0x588c1c['shift']());}};_0x476dd9(++_0x1f581f);}(_0xeec6,0x1c2));var _0x6eec=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0xeec6[_0x4d1ee9];return _0x9a5456;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var auth=require(_0x6eec('0x5'));var interaction=require(_0x6eec('0x6'));var config=require(_0x6eec('0x7'));var controller=require(_0x6eec('0x8'));router[_0x6eec('0x9')]('/',auth['isAuthenticated'](),controller[_0x6eec('0xa')]);router[_0x6eec('0x9')]('/describe',auth[_0x6eec('0xb')](),controller[_0x6eec('0xc')]);router[_0x6eec('0x9')](_0x6eec('0xd'),auth['isAuthenticated'](),controller[_0x6eec('0xe')]);router[_0x6eec('0x9')](_0x6eec('0xf'),auth['isAuthenticated'](),controller['getTimezones']);router['get'](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller['show']);router['post']('/',auth[_0x6eec('0xb')](),controller['create']);router[_0x6eec('0x11')](_0x6eec('0x12'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x13')]);router[_0x6eec('0x11')]('/timezone',auth[_0x6eec('0xb')](),controller[_0x6eec('0x14')]);router[_0x6eec('0x15')](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x16')]);router[_0x6eec('0x17')](_0x6eec('0x10'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8d0e=['/timezones','getTimezones','show','post','create','getPreview','/timezone','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts'];(function(_0x39e2e1,_0x300418){var _0x208522=function(_0x136bb1){while(--_0x136bb1){_0x39e2e1['push'](_0x39e2e1['shift']());}};_0x208522(++_0x300418);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0xae2f74,_0x26c85b){_0xae2f74=_0xae2f74-0x0;var _0x35210e=_0x8d0e[_0xae2f74];return _0x35210e;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var auth=require(_0xe8d0('0x6'));var interaction=require(_0xe8d0('0x7'));var config=require(_0xe8d0('0x8'));var controller=require('./cmHopper.controller');router[_0xe8d0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe8d0('0x9')](_0xe8d0('0xa'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0xc')]);router[_0xe8d0('0x9')](_0xe8d0('0xd'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0xe')]);router['get'](_0xe8d0('0xf'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x10')]);router['get']('/:id',auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x11')]);router[_0xe8d0('0x12')]('/',auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x13')]);router[_0xe8d0('0x12')]('/preview',auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x14')]);router['post'](_0xe8d0('0x15'),auth['isAuthenticated'](),controller['getTimezone']);router[_0xe8d0('0x16')](_0xe8d0('0x17'),auth[_0xe8d0('0xb')](),controller[_0xe8d0('0x18')]);router[_0xe8d0('0x19')](_0xe8d0('0x17'),auth['isAuthenticated'](),controller[_0xe8d0('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index afe5b56..fbc187d 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 _0x1474=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','DATE','format'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x1474,0x109));var _0x4147=function(_0x45ed90,_0x111e0b){_0x45ed90=_0x45ed90-0x0;var _0x47a846=_0x1474[_0x45ed90];return _0x47a846;};'use strict';var moment=require(_0x4147('0x0'));var Sequelize=require(_0x4147('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4147('0x3')],'defaultValue':moment()[_0x4147('0x4')](_0x4147('0x5'))},'countbusyretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4147('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ec6=['exports','INTEGER','STRING','DATE','moment','sequelize'];(function(_0x45e647,_0x4a1d96){var _0x47422c=function(_0x32722c){while(--_0x32722c){_0x45e647['push'](_0x45e647['shift']());}};_0x47422c(++_0x4a1d96);}(_0x7ec6,0x184));var _0x67ec=function(_0xd3a823,_0x4ad32e){_0xd3a823=_0xd3a823-0x0;var _0x54b98a=_0x7ec6[_0xd3a823];return _0x54b98a;};'use strict';var moment=require(_0x67ec('0x0'));var Sequelize=require(_0x67ec('0x1'));module[_0x67ec('0x2')]={'CmHopperId':{'type':Sequelize[_0x67ec('0x3')]},'phone':{'type':Sequelize[_0x67ec('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x67ec('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x67ec('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x67ec('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x67ec('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x67ec('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x67ec('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x67ec('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x67ec('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x67ec('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 6f08cbc..121ed5c 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 _0x69b4=['sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','map','CmHopperAdditionalPhone','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x162fa0,_0x1bdecc){var _0x266b9e=function(_0x379c8d){while(--_0x379c8d){_0x162fa0['push'](_0x162fa0['shift']());}};_0x266b9e(++_0x1bdecc);}(_0x69b4,0x132));var _0x469b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x69b4[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0x469b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x469b('0x1'));var zipdir=require(_0x469b('0x2'));var jsonpatch=require(_0x469b('0x3'));var rp=require(_0x469b('0x4'));var moment=require(_0x469b('0x5'));var BPromise=require(_0x469b('0x6'));var Mustache=require(_0x469b('0x7'));var util=require(_0x469b('0x8'));var path=require(_0x469b('0x9'));var sox=require(_0x469b('0xa'));var csv=require(_0x469b('0xb'));var ejs=require(_0x469b('0xc'));var fs=require('fs');var _=require(_0x469b('0xd'));var squel=require(_0x469b('0xe'));var crypto=require(_0x469b('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x469b('0x10'));var Redis=require(_0x469b('0x11'));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(_0x469b('0x12'))(_0x469b('0x13'));var utils=require(_0x469b('0x14'));var config=require(_0x469b('0x15'));var db=require(_0x469b('0x16'))['db'];function respondWithStatusCode(_0x21e768,_0x227502){_0x227502=_0x227502||0xcc;return function(_0x4d24b0){if(_0x4d24b0){return _0x21e768[_0x469b('0x17')](_0x227502);}return _0x21e768[_0x469b('0x18')](_0x227502)[_0x469b('0x19')]();};}function respondWithResult(_0x4bec18,_0x3e0497){_0x3e0497=_0x3e0497||0xc8;return function(_0x344673){if(_0x344673){return _0x4bec18[_0x469b('0x18')](_0x3e0497)[_0x469b('0x1a')](_0x344673);}};}function respondWithFilteredResult(_0x5c821a,_0x2b8b63){return function(_0x5cd50b){if(_0x5cd50b){var _0x5c3e13=_0x5cd50b[_0x469b('0x1b')],_0x546a50=_0x2b8b63[_0x469b('0x1c')],_0x30531a=_0x2b8b63[_0x469b('0x1c')]+_0x2b8b63[_0x469b('0x1d')],_0x2ef0d0;if(_0x30531a>=_0x5c3e13){_0x30531a=_0x5c3e13;_0x2ef0d0=0xc8;}else{_0x2ef0d0=0xce;}_0x5c821a[_0x469b('0x18')](_0x2ef0d0);return _0x5c821a['set'](_0x469b('0x1e'),_0x546a50+'-'+_0x30531a+'/'+_0x5c3e13)[_0x469b('0x1a')](_0x5cd50b);}return null;};}function patchUpdates(_0x4896f0){return function(_0xe9b0f4){try{jsonpatch[_0x469b('0x1f')](_0xe9b0f4,_0x4896f0,!![]);}catch(_0x54d78c){return BPromise['reject'](_0x54d78c);}return _0xe9b0f4[_0x469b('0x20')]();};}function saveUpdates(_0x368fd5,_0x3b77f5){return function(_0x4af5b3){if(_0x4af5b3){return _0x4af5b3[_0x469b('0x21')](_0x368fd5)[_0x469b('0x22')](function(_0x4621f4){return _0x4621f4;});}return null;};}function removeEntity(_0xba9548,_0x3148bc){return function(_0x374726){if(_0x374726){return _0x374726[_0x469b('0x23')]()[_0x469b('0x22')](function(){var _0x56b30e=_0x374726[_0x469b('0x24')]({'plain':!![]});var _0x43c645=_0x469b('0x25');return db[_0x469b('0x26')][_0x469b('0x23')]({'where':{'type':_0x43c645,'resourceId':_0x56b30e['id']}})[_0x469b('0x22')](function(){return _0x374726;});})['then'](function(){_0xba9548[_0x469b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341e2a,_0x162b88){return function(_0x314874){if(!_0x314874){_0x341e2a['sendStatus'](0x194);}return _0x314874;};}function handleError(_0x147abd,_0x493067){_0x493067=_0x493067||0x1f4;return function(_0x5049c7){logger[_0x469b('0x27')](_0x5049c7['stack']);if(_0x5049c7[_0x469b('0x28')]){delete _0x5049c7['name'];}_0x147abd[_0x469b('0x18')](_0x493067)[_0x469b('0x29')](_0x5049c7);};}exports[_0x469b('0x2a')]=function(_0x4a9c68,_0x37fccb){var _0x3dc2d3={},_0x1097f6={},_0x2ff77a={'count':0x0,'rows':[]};var _0x523e5f=_[_0x469b('0x2b')](db[_0x469b('0x2c')]['rawAttributes'],function(_0x295a9a){return{'name':_0x295a9a['fieldName'],'type':_0x295a9a[_0x469b('0x2d')][_0x469b('0x2e')]};});_0x1097f6[_0x469b('0x2f')]=_[_0x469b('0x2b')](_0x523e5f,_0x469b('0x28'));_0x1097f6[_0x469b('0x30')]=_[_0x469b('0x31')](_0x4a9c68['query']);_0x1097f6[_0x469b('0x32')]=_[_0x469b('0x33')](_0x1097f6[_0x469b('0x2f')],_0x1097f6[_0x469b('0x30')]);_0x3dc2d3[_0x469b('0x34')]=_[_0x469b('0x33')](_0x1097f6[_0x469b('0x2f')],qs[_0x469b('0x35')](_0x4a9c68[_0x469b('0x30')][_0x469b('0x35')]));_0x3dc2d3[_0x469b('0x34')]=_0x3dc2d3['attributes'][_0x469b('0x36')]?_0x3dc2d3['attributes']:_0x1097f6[_0x469b('0x2f')];if(!_0x4a9c68[_0x469b('0x30')]['hasOwnProperty']('nolimit')){_0x3dc2d3[_0x469b('0x1d')]=qs[_0x469b('0x1d')](_0x4a9c68['query'][_0x469b('0x1d')]);_0x3dc2d3[_0x469b('0x1c')]=qs[_0x469b('0x1c')](_0x4a9c68['query'][_0x469b('0x1c')]);}_0x3dc2d3[_0x469b('0x37')]=qs[_0x469b('0x38')](_0x4a9c68['query'][_0x469b('0x38')]);_0x3dc2d3[_0x469b('0x39')]=qs[_0x469b('0x32')](_['pick'](_0x4a9c68[_0x469b('0x30')],_0x1097f6[_0x469b('0x32')]),_0x523e5f);if(_0x4a9c68[_0x469b('0x30')][_0x469b('0x3a')]){_0x3dc2d3['where']=_[_0x469b('0x3b')](_0x3dc2d3['where'],{'$or':_['map'](_0x523e5f,function(_0x454cd5){if(_0x454cd5['type']!=='VIRTUAL'){var _0x26f6c8={};_0x26f6c8[_0x454cd5['name']]={'$like':'%'+_0x4a9c68[_0x469b('0x30')]['filter']+'%'};return _0x26f6c8;}})});}_0x3dc2d3=_['merge']({},_0x3dc2d3,_0x4a9c68[_0x469b('0x3c')]);var _0x561a71={'where':_0x3dc2d3[_0x469b('0x39')]};return db[_0x469b('0x2c')][_0x469b('0x1b')](_0x561a71)['then'](function(_0x3bc200){_0x2ff77a[_0x469b('0x1b')]=_0x3bc200;if(_0x4a9c68[_0x469b('0x30')][_0x469b('0x3d')]){_0x3dc2d3[_0x469b('0x3e')]=[{'all':!![]}];}return db[_0x469b('0x2c')][_0x469b('0x3f')](_0x3dc2d3);})[_0x469b('0x22')](function(_0x17531e){_0x2ff77a[_0x469b('0x40')]=_0x17531e;return _0x2ff77a;})[_0x469b('0x22')](respondWithFilteredResult(_0x37fccb,_0x3dc2d3))[_0x469b('0x41')](handleError(_0x37fccb,null));};exports[_0x469b('0x42')]=function(_0x2f7c4b,_0x138ed8){var _0x288151={'raw':!![],'where':{'id':_0x2f7c4b['params']['id']}},_0x4f8f7f={};_0x4f8f7f[_0x469b('0x2f')]=_[_0x469b('0x31')](db[_0x469b('0x2c')][_0x469b('0x43')]);_0x4f8f7f[_0x469b('0x30')]=_[_0x469b('0x31')](_0x2f7c4b[_0x469b('0x30')]);_0x4f8f7f[_0x469b('0x32')]=_['intersection'](_0x4f8f7f[_0x469b('0x2f')],_0x4f8f7f[_0x469b('0x30')]);_0x288151[_0x469b('0x34')]=_[_0x469b('0x33')](_0x4f8f7f['model'],qs[_0x469b('0x35')](_0x2f7c4b[_0x469b('0x30')][_0x469b('0x35')]));_0x288151[_0x469b('0x34')]=_0x288151[_0x469b('0x34')][_0x469b('0x36')]?_0x288151[_0x469b('0x34')]:_0x4f8f7f[_0x469b('0x2f')];if(_0x2f7c4b[_0x469b('0x30')][_0x469b('0x3d')]){_0x288151[_0x469b('0x3e')]=[{'all':!![]}];}_0x288151=_[_0x469b('0x3b')]({},_0x288151,_0x2f7c4b[_0x469b('0x3c')]);return db['CmHopperAdditionalPhone'][_0x469b('0x44')](_0x288151)[_0x469b('0x22')](handleEntityNotFound(_0x138ed8,null))['then'](respondWithResult(_0x138ed8,null))['catch'](handleError(_0x138ed8,null));};exports[_0x469b('0x45')]=function(_0x1f5de4,_0x39e42c){return db[_0x469b('0x2c')][_0x469b('0x45')](_0x1f5de4[_0x469b('0x46')],{})['then'](function(_0x5f22d9){var _0x3ab2dc=_0x1f5de4[_0x469b('0x47')][_0x469b('0x24')]({'plain':!![]});if(!_0x3ab2dc)throw new Error(_0x469b('0x48'));if(_0x3ab2dc[_0x469b('0x49')]===_0x469b('0x47')){var _0x4b6dc1=_0x5f22d9[_0x469b('0x24')]({'plain':!![]});var _0xddc67f=_0x469b('0x25');return db[_0x469b('0x4a')][_0x469b('0x44')]({'where':{'name':_0xddc67f,'userProfileId':_0x3ab2dc[_0x469b('0x4b')]},'raw':!![]})['then'](function(_0xa5234f){if(_0xa5234f&&_0xa5234f[_0x469b('0x4c')]===0x0){return db[_0x469b('0x26')][_0x469b('0x45')]({'name':_0x4b6dc1[_0x469b('0x28')],'resourceId':_0x4b6dc1['id'],'type':_0xa5234f[_0x469b('0x28')],'sectionId':_0xa5234f['id']},{})[_0x469b('0x22')](function(){return _0x5f22d9;});}else{return _0x5f22d9;}})[_0x469b('0x41')](function(_0x5bcf47){logger[_0x469b('0x27')](_0x469b('0x4d'),_0x5bcf47);throw _0x5bcf47;});}return _0x5f22d9;})['then'](respondWithResult(_0x39e42c,0xc9))[_0x469b('0x41')](handleError(_0x39e42c,null));};exports[_0x469b('0x21')]=function(_0x105b0d,_0x4f8f0b){if(_0x105b0d[_0x469b('0x46')]['id']){delete _0x105b0d[_0x469b('0x46')]['id'];}return db[_0x469b('0x2c')][_0x469b('0x44')]({'where':{'id':_0x105b0d['params']['id']}})['then'](handleEntityNotFound(_0x4f8f0b,null))['then'](saveUpdates(_0x105b0d[_0x469b('0x46')],null))[_0x469b('0x22')](respondWithResult(_0x4f8f0b,null))['catch'](handleError(_0x4f8f0b,null));};exports[_0x469b('0x23')]=function(_0x2992e0,_0x5cd270){return db['CmHopperAdditionalPhone'][_0x469b('0x44')]({'where':{'id':_0x2992e0[_0x469b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5cd270,null))[_0x469b('0x22')](removeEntity(_0x5cd270,null))[_0x469b('0x41')](handleError(_0x5cd270,null));}; \ No newline at end of file +var _0xa637=['length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x353026,_0x58894b){var _0x8c56f6=function(_0x5cf2ba){while(--_0x5cf2ba){_0x353026['push'](_0x353026['shift']());}};_0x8c56f6(++_0x58894b);}(_0xa637,0x113));var _0x7a63=function(_0x41e67c,_0x4f398d){_0x41e67c=_0x41e67c-0x0;var _0x1a53b2=_0xa637[_0x41e67c];return _0x1a53b2;};'use strict';var pdf=require(_0x7a63('0x0'));var emlformat=require(_0x7a63('0x1'));var rimraf=require(_0x7a63('0x2'));var zipdir=require(_0x7a63('0x3'));var jsonpatch=require(_0x7a63('0x4'));var rp=require(_0x7a63('0x5'));var moment=require(_0x7a63('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7a63('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7a63('0x8'));var csv=require('to-csv');var ejs=require(_0x7a63('0x9'));var fs=require('fs');var _=require(_0x7a63('0xa'));var squel=require(_0x7a63('0xb'));var crypto=require(_0x7a63('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a63('0xd'));var querystring=require(_0x7a63('0xe'));var Papa=require(_0x7a63('0xf'));var Redis=require(_0x7a63('0x10'));var authService=require(_0x7a63('0x11'));var qs=require(_0x7a63('0x12'));var as=require(_0x7a63('0x13'));var hardwareService=require(_0x7a63('0x14'));var logger=require('../../config/logger')(_0x7a63('0x15'));var utils=require(_0x7a63('0x16'));var config=require(_0x7a63('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x483891,_0x2eda8e){_0x2eda8e=_0x2eda8e||0xcc;return function(_0xe0a269){if(_0xe0a269){return _0x483891[_0x7a63('0x18')](_0x2eda8e);}return _0x483891[_0x7a63('0x19')](_0x2eda8e)[_0x7a63('0x1a')]();};}function respondWithResult(_0xe20477,_0x2127c9){_0x2127c9=_0x2127c9||0xc8;return function(_0x510123){if(_0x510123){return _0xe20477[_0x7a63('0x19')](_0x2127c9)[_0x7a63('0x1b')](_0x510123);}};}function respondWithFilteredResult(_0x47b4b9,_0xed87d1){return function(_0x199530){if(_0x199530){var _0x5adb22=_0x199530[_0x7a63('0x1c')],_0x57829f=_0xed87d1[_0x7a63('0x1d')],_0x2bcb53=_0xed87d1[_0x7a63('0x1d')]+_0xed87d1[_0x7a63('0x1e')],_0x273f07;if(_0x2bcb53>=_0x5adb22){_0x2bcb53=_0x5adb22;_0x273f07=0xc8;}else{_0x273f07=0xce;}_0x47b4b9[_0x7a63('0x19')](_0x273f07);return _0x47b4b9[_0x7a63('0x1f')](_0x7a63('0x20'),_0x57829f+'-'+_0x2bcb53+'/'+_0x5adb22)[_0x7a63('0x1b')](_0x199530);}return null;};}function patchUpdates(_0x277c19){return function(_0x206a70){try{jsonpatch[_0x7a63('0x21')](_0x206a70,_0x277c19,!![]);}catch(_0x1d4ee6){return BPromise['reject'](_0x1d4ee6);}return _0x206a70['save']();};}function saveUpdates(_0x5aa841,_0x41b1eb){return function(_0x5cf805){if(_0x5cf805){return _0x5cf805[_0x7a63('0x22')](_0x5aa841)[_0x7a63('0x23')](function(_0x50ba60){return _0x50ba60;});}return null;};}function removeEntity(_0x14f57c,_0x294ae3){return function(_0x553519){if(_0x553519){return _0x553519[_0x7a63('0x24')]()['then'](function(){var _0x48215a=_0x553519[_0x7a63('0x25')]({'plain':!![]});var _0x3d7de8=_0x7a63('0x26');return db[_0x7a63('0x27')][_0x7a63('0x24')]({'where':{'type':_0x3d7de8,'resourceId':_0x48215a['id']}})['then'](function(){return _0x553519;});})[_0x7a63('0x23')](function(){_0x14f57c['status'](0xcc)[_0x7a63('0x1a')]();});}};}function handleEntityNotFound(_0x2a4734,_0x1188ad){return function(_0x4e08d7){if(!_0x4e08d7){_0x2a4734[_0x7a63('0x18')](0x194);}return _0x4e08d7;};}function handleError(_0x3e1adc,_0x41eefc){_0x41eefc=_0x41eefc||0x1f4;return function(_0x363ae6){logger[_0x7a63('0x28')](_0x363ae6['stack']);if(_0x363ae6[_0x7a63('0x29')]){delete _0x363ae6['name'];}_0x3e1adc[_0x7a63('0x19')](_0x41eefc)[_0x7a63('0x2a')](_0x363ae6);};}exports[_0x7a63('0x2b')]=function(_0x12892c,_0x2094f3){var _0x11c37d={},_0x40ce24={},_0x45c676={'count':0x0,'rows':[]};var _0x4bd13f=_[_0x7a63('0x2c')](db[_0x7a63('0x2d')][_0x7a63('0x2e')],function(_0x44b8e5){return{'name':_0x44b8e5[_0x7a63('0x2f')],'type':_0x44b8e5[_0x7a63('0x30')][_0x7a63('0x31')]};});_0x40ce24['model']=_[_0x7a63('0x2c')](_0x4bd13f,_0x7a63('0x29'));_0x40ce24[_0x7a63('0x32')]=_[_0x7a63('0x33')](_0x12892c[_0x7a63('0x32')]);_0x40ce24[_0x7a63('0x34')]=_[_0x7a63('0x35')](_0x40ce24[_0x7a63('0x36')],_0x40ce24[_0x7a63('0x32')]);_0x11c37d[_0x7a63('0x37')]=_[_0x7a63('0x35')](_0x40ce24[_0x7a63('0x36')],qs[_0x7a63('0x38')](_0x12892c['query'][_0x7a63('0x38')]));_0x11c37d['attributes']=_0x11c37d[_0x7a63('0x37')][_0x7a63('0x39')]?_0x11c37d[_0x7a63('0x37')]:_0x40ce24[_0x7a63('0x36')];if(!_0x12892c[_0x7a63('0x32')][_0x7a63('0x3a')]('nolimit')){_0x11c37d[_0x7a63('0x1e')]=qs[_0x7a63('0x1e')](_0x12892c[_0x7a63('0x32')][_0x7a63('0x1e')]);_0x11c37d['offset']=qs[_0x7a63('0x1d')](_0x12892c['query']['offset']);}_0x11c37d[_0x7a63('0x3b')]=qs[_0x7a63('0x3c')](_0x12892c[_0x7a63('0x32')]['sort']);_0x11c37d['where']=qs[_0x7a63('0x34')](_[_0x7a63('0x3d')](_0x12892c[_0x7a63('0x32')],_0x40ce24[_0x7a63('0x34')]),_0x4bd13f);if(_0x12892c[_0x7a63('0x32')][_0x7a63('0x3e')]){_0x11c37d[_0x7a63('0x3f')]=_[_0x7a63('0x40')](_0x11c37d[_0x7a63('0x3f')],{'$or':_['map'](_0x4bd13f,function(_0x33e723){if(_0x33e723[_0x7a63('0x30')]!==_0x7a63('0x41')){var _0x255621={};_0x255621[_0x33e723[_0x7a63('0x29')]]={'$like':'%'+_0x12892c[_0x7a63('0x32')][_0x7a63('0x3e')]+'%'};return _0x255621;}})});}_0x11c37d=_['merge']({},_0x11c37d,_0x12892c[_0x7a63('0x42')]);var _0x5c119f={'where':_0x11c37d[_0x7a63('0x3f')]};return db['CmHopperAdditionalPhone'][_0x7a63('0x1c')](_0x5c119f)[_0x7a63('0x23')](function(_0x3faa7c){_0x45c676[_0x7a63('0x1c')]=_0x3faa7c;if(_0x12892c[_0x7a63('0x32')][_0x7a63('0x43')]){_0x11c37d[_0x7a63('0x44')]=[{'all':!![]}];}return db[_0x7a63('0x2d')][_0x7a63('0x45')](_0x11c37d);})['then'](function(_0x3bc663){_0x45c676[_0x7a63('0x46')]=_0x3bc663;return _0x45c676;})['then'](respondWithFilteredResult(_0x2094f3,_0x11c37d))[_0x7a63('0x47')](handleError(_0x2094f3,null));};exports[_0x7a63('0x48')]=function(_0x24646f,_0x59258f){var _0x1166a1={'raw':!![],'where':{'id':_0x24646f['params']['id']}},_0x245aa3={};_0x245aa3[_0x7a63('0x36')]=_[_0x7a63('0x33')](db[_0x7a63('0x2d')][_0x7a63('0x2e')]);_0x245aa3['query']=_[_0x7a63('0x33')](_0x24646f['query']);_0x245aa3[_0x7a63('0x34')]=_[_0x7a63('0x35')](_0x245aa3[_0x7a63('0x36')],_0x245aa3['query']);_0x1166a1['attributes']=_[_0x7a63('0x35')](_0x245aa3['model'],qs[_0x7a63('0x38')](_0x24646f[_0x7a63('0x32')][_0x7a63('0x38')]));_0x1166a1[_0x7a63('0x37')]=_0x1166a1['attributes']['length']?_0x1166a1[_0x7a63('0x37')]:_0x245aa3[_0x7a63('0x36')];if(_0x24646f[_0x7a63('0x32')][_0x7a63('0x43')]){_0x1166a1[_0x7a63('0x44')]=[{'all':!![]}];}_0x1166a1=_[_0x7a63('0x40')]({},_0x1166a1,_0x24646f['options']);return db[_0x7a63('0x2d')][_0x7a63('0x49')](_0x1166a1)[_0x7a63('0x23')](handleEntityNotFound(_0x59258f,null))['then'](respondWithResult(_0x59258f,null))[_0x7a63('0x47')](handleError(_0x59258f,null));};exports[_0x7a63('0x4a')]=function(_0xd51c96,_0x259240){return db[_0x7a63('0x2d')][_0x7a63('0x4a')](_0xd51c96[_0x7a63('0x4b')],{})['then'](function(_0x4c2c99){var _0x55e078=_0xd51c96['user']['get']({'plain':!![]});if(!_0x55e078)throw new Error(_0x7a63('0x4c'));if(_0x55e078['role']===_0x7a63('0x4d')){var _0x283552=_0x4c2c99[_0x7a63('0x25')]({'plain':!![]});var _0x478201=_0x7a63('0x26');return db[_0x7a63('0x4e')][_0x7a63('0x49')]({'where':{'name':_0x478201,'userProfileId':_0x55e078[_0x7a63('0x4f')]},'raw':!![]})[_0x7a63('0x23')](function(_0x705b70){if(_0x705b70&&_0x705b70[_0x7a63('0x50')]===0x0){return db[_0x7a63('0x27')][_0x7a63('0x4a')]({'name':_0x283552[_0x7a63('0x29')],'resourceId':_0x283552['id'],'type':_0x705b70['name'],'sectionId':_0x705b70['id']},{})['then'](function(){return _0x4c2c99;});}else{return _0x4c2c99;}})[_0x7a63('0x47')](function(_0x268198){logger[_0x7a63('0x28')](_0x7a63('0x51'),_0x268198);throw _0x268198;});}return _0x4c2c99;})[_0x7a63('0x23')](respondWithResult(_0x259240,0xc9))[_0x7a63('0x47')](handleError(_0x259240,null));};exports[_0x7a63('0x22')]=function(_0x557bd4,_0xc9cd90){if(_0x557bd4[_0x7a63('0x4b')]['id']){delete _0x557bd4[_0x7a63('0x4b')]['id'];}return db[_0x7a63('0x2d')][_0x7a63('0x49')]({'where':{'id':_0x557bd4['params']['id']}})[_0x7a63('0x23')](handleEntityNotFound(_0xc9cd90,null))[_0x7a63('0x23')](saveUpdates(_0x557bd4[_0x7a63('0x4b')],null))[_0x7a63('0x23')](respondWithResult(_0xc9cd90,null))[_0x7a63('0x47')](handleError(_0xc9cd90,null));};exports[_0x7a63('0x24')]=function(_0x103707,_0x3640a4){return db[_0x7a63('0x2d')]['find']({'where':{'id':_0x103707[_0x7a63('0x52')]['id']}})[_0x7a63('0x23')](handleEntityNotFound(_0x3640a4,null))[_0x7a63('0x23')](removeEntity(_0x3640a4,null))[_0x7a63('0x47')](handleError(_0x3640a4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 45185c4..e500ac5 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 _0x2c25=['rimraf','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','path'];(function(_0x47ab1b,_0x3df172){var _0x24a99c=function(_0x233baf){while(--_0x233baf){_0x47ab1b['push'](_0x47ab1b['shift']());}};_0x24a99c(++_0x3df172);}(_0x2c25,0x11c));var _0x52c2=function(_0x1f0ded,_0x404ba6){_0x1f0ded=_0x1f0ded-0x0;var _0xc14076=_0x2c25[_0x1f0ded];return _0xc14076;};'use strict';var _=require(_0x52c2('0x0'));var util=require('util');var logger=require(_0x52c2('0x1'))(_0x52c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x52c2('0x3'));var rimraf=require(_0x52c2('0x4'));var config=require('../../config/environment');var attributes=require(_0x52c2('0x5'));module[_0x52c2('0x6')]=function(_0x36ec01,_0x5842ec){return _0x36ec01['define'](_0x52c2('0x7'),attributes,{'tableName':_0x52c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cbf=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x2ef9f1,_0x9b6f6){var _0x746841=function(_0x21645d){while(--_0x21645d){_0x2ef9f1['push'](_0x2ef9f1['shift']());}};_0x746841(++_0x9b6f6);}(_0x8cbf,0x134));var _0xf8cb=function(_0x3ea00a,_0x1dd373){_0x3ea00a=_0x3ea00a-0x0;var _0x3b9b39=_0x8cbf[_0x3ea00a];return _0x3b9b39;};'use strict';var _=require(_0xf8cb('0x0'));var util=require(_0xf8cb('0x1'));var logger=require(_0xf8cb('0x2'))(_0xf8cb('0x3'));var moment=require(_0xf8cb('0x4'));var BPromise=require(_0xf8cb('0x5'));var rp=require(_0xf8cb('0x6'));var fs=require('fs');var path=require(_0xf8cb('0x7'));var rimraf=require(_0xf8cb('0x8'));var config=require(_0xf8cb('0x9'));var attributes=require(_0xf8cb('0xa'));module['exports']=function(_0xd8dcab,_0x54372c){return _0xd8dcab[_0xf8cb('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xf8cb('0xc'),'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 dba05dd..80ca6cd 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 _0x3fd8=['CmHopperAdditionalPhone','countdropretry','SwapAdditionalPhones','ListId','duration','waitTime','info','scheduledat','add','minutes','phone','createdAt','isNil','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry'];(function(_0x4f7384,_0x5e157c){var _0x41c281=function(_0x276147){while(--_0x276147){_0x4f7384['push'](_0x4f7384['shift']());}};_0x41c281(++_0x5e157c);}(_0x3fd8,0x19c));var _0x83fd=function(_0x364406,_0x3f0f37){_0x364406=_0x364406-0x0;var _0x10b5f1=_0x3fd8[_0x364406];return _0x10b5f1;};'use strict';var _=require('lodash');var util=require(_0x83fd('0x0'));var moment=require(_0x83fd('0x1'));var BPromise=require(_0x83fd('0x2'));var rs=require(_0x83fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83fd('0x4'))['db'];var utils=require(_0x83fd('0x5'));var logger=require('../../config/logger')(_0x83fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x83fd('0x7'));var client=jayson[_0x83fd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e8463,_0x3cf9d3,_0x10cdcc){return new BPromise(function(_0x498561,_0x350f29){return client[_0x83fd('0x9')](_0x5e8463,_0x10cdcc)[_0x83fd('0xa')](function(_0x3af711){logger['info'](_0x83fd('0xb'),_0x3cf9d3,_0x83fd('0xc'));logger[_0x83fd('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x3cf9d3,_0x83fd('0xc'),JSON[_0x83fd('0xe')](_0x3af711));if(_0x3af711[_0x83fd('0xf')]){if(_0x3af711[_0x83fd('0xf')][_0x83fd('0x10')]===0x1f4){logger[_0x83fd('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3cf9d3,_0x3af711[_0x83fd('0xf')]['message']);return _0x350f29(_0x3af711[_0x83fd('0xf')]['message']);}logger[_0x83fd('0xf')](_0x83fd('0xb'),_0x3cf9d3,_0x3af711['error']['message']);return _0x498561(_0x3af711[_0x83fd('0xf')]['message']);}else{logger['info'](_0x83fd('0xb'),_0x3cf9d3,_0x83fd('0xc'));_0x498561(_0x3af711['result'][_0x83fd('0x11')]);}})[_0x83fd('0x12')](function(_0x1b9565){logger[_0x83fd('0xf')](_0x83fd('0xb'),_0x3cf9d3,_0x1b9565);_0x350f29(_0x1b9565);});});}exports[_0x83fd('0x13')]=function(_0x558087){var _0x444fc2=this;return new Promise(function(_0x392c34,_0x337e26){return db[_0x83fd('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x558087[_0x83fd('0x15')][_0x83fd('0x16')],'ListId':_0x558087[_0x83fd('0x15')]['ListId'],'VoiceQueueId':_0x558087[_0x83fd('0x15')][_0x83fd('0x17')]===undefined?null:_0x558087[_0x83fd('0x15')][_0x83fd('0x17')],'CampaignId':_0x558087['body'][_0x83fd('0x18')]===undefined?null:_0x558087['body'][_0x83fd('0x18')]}})[_0x83fd('0xa')](function(_0x132b68){if(_0x132b68!=null){return db['CmHopperAdditionalPhone'][_0x83fd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x132b68['id'],'OrderBy':{'$gt':_0x132b68[_0x83fd('0x1a')]}},'order':[[_0x83fd('0x1a'),_0x83fd('0x1b')]]})[_0x83fd('0xa')](function(_0x1e857b){var _0x3dd298=0x0;if(_0x1e857b){if(_0x1e857b[_0x83fd('0x1c')]+_0x1e857b[_0x83fd('0x1d')]+_0x1e857b['countnoanswerretry']+_0x1e857b[_0x83fd('0x1e')]+_0x1e857b['countdropretry']+_0x1e857b[_0x83fd('0x1f')]+_0x1e857b[_0x83fd('0x20')]+_0x1e857b[_0x83fd('0x21')]<_0x558087[_0x83fd('0x22')][_0x83fd('0x23')])_0x3dd298=0x1;_0x392c34({'additional':_0x3dd298});}else{return db[_0x83fd('0x24')][_0x83fd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x132b68['id']},'order':[[_0x83fd('0x1a'),'ASC']]})[_0x83fd('0xa')](function(_0x16a174){var _0x3f4543=0x0;if(_0x16a174){if(_0x16a174[_0x83fd('0x1c')]+_0x16a174[_0x83fd('0x1d')]+_0x16a174['countnoanswerretry']+_0x16a174['countnosuchnumberretry']+_0x16a174[_0x83fd('0x25')]+_0x16a174[_0x83fd('0x1f')]+_0x16a174[_0x83fd('0x20')]+_0x16a174[_0x83fd('0x21')]<_0x558087['entity'][_0x83fd('0x23')])_0x3f4543=0x1;_0x392c34({'additional':_0x3f4543});}else{_0x392c34({'additional':0x0});}})['catch'](function(_0x58485d){logger[_0x83fd('0xf')](_0x83fd('0x13'),_0x58485d['message'],_0x558087);_0x337e26(_0x444fc2['error'](0x1f4,_0x58485d[_0x83fd('0x11')]));});}})['catch'](function(_0x3858cf){logger[_0x83fd('0xf')](_0x83fd('0x13'),_0x3858cf[_0x83fd('0x11')],_0x558087);_0x337e26(_0x444fc2['error'](0x1f4,_0x3858cf[_0x83fd('0x11')]));});}else _0x392c34({'additional':0x0});});});};exports[_0x83fd('0x26')]=function(_0x1cec0e){var _0x4bc256=this;return new Promise(function(_0x17c77a,_0x2e3c40){return db[_0x83fd('0x14')][_0x83fd('0x19')]({'raw':!![],'where':{'ContactId':_0x1cec0e[_0x83fd('0x15')]['ContactId'],'ListId':_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x27')],'VoiceQueueId':_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x17')]===undefined?null:_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x17')],'CampaignId':_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x18')]===undefined?null:_0x1cec0e[_0x83fd('0x15')][_0x83fd('0x18')]}})['then'](function(_0x23fc2a){if(_0x23fc2a!=null){return db[_0x83fd('0x24')][_0x83fd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x23fc2a['id'],'OrderBy':{'$gt':_0x23fc2a['OrderBy']}},'order':[[_0x83fd('0x1a'),_0x83fd('0x1b')]]})[_0x83fd('0xa')](function(_0x59a3f0){if(_0x59a3f0)return activateAdditionalPhone(_0x23fc2a,_0x1cec0e[_0x83fd('0x15')],_0x59a3f0,_0x1cec0e[_0x83fd('0x28')],_0x1cec0e[_0x83fd('0x29')])[_0x83fd('0xa')](function(_0x248e70){_0x17c77a(_0x248e70);});else{return db[_0x83fd('0x24')][_0x83fd('0x19')]({'raw':!![],'where':{'CmHopperId':_0x23fc2a['id']},'order':[['OrderBy',_0x83fd('0x1b')]]})[_0x83fd('0xa')](function(_0x126d19){if(_0x126d19)return activateAdditionalPhone(_0x23fc2a,_0x1cec0e['body'],_0x126d19,_0x1cec0e[_0x83fd('0x28')],_0x1cec0e[_0x83fd('0x29')])[_0x83fd('0xa')](function(_0x93de2){_0x17c77a(_0x93de2);});else{_0x17c77a({'id':_0x23fc2a['id'],'phone':''});}})['catch'](function(_0x1eb80c){logger[_0x83fd('0xf')](_0x83fd('0x13'),_0x1eb80c[_0x83fd('0x11')],_0x1cec0e);_0x2e3c40(_0x4bc256[_0x83fd('0xf')](0x1f4,_0x1eb80c[_0x83fd('0x11')]));});}})[_0x83fd('0x12')](function(_0x387b9e){logger['error']('VerifyAdditionalPhones',_0x387b9e[_0x83fd('0x11')],_0x1cec0e);_0x2e3c40(_0x4bc256[_0x83fd('0xf')](0x1f4,_0x387b9e[_0x83fd('0x11')]));});}else _0x17c77a(0x1);});});};function activateAdditionalPhone(_0x2c7221,_0x5bf9b4,_0xb2d02d,_0x1848c9,_0x3874d6){return new Promise(function(_0x2e673e,_0x4d6e38){logger[_0x83fd('0x2a')]('VerifyAdditionalPhones',_0xb2d02d);var _0xc0ecf4;if(moment()>moment(_0xb2d02d[_0x83fd('0x2b')])){_0xc0ecf4=moment()[_0x83fd('0x2c')](_0x3874d6||0x3,'minutes');}else{if(_0xb2d02d[_0x83fd('0x1a')]==0x0){_0xc0ecf4=moment(_0xb2d02d['scheduledat']);}else{_0xc0ecf4=moment()[_0x83fd('0x2c')](_0x3874d6||0x3,_0x83fd('0x2d'));}}var _0x42f4c8={'phone':_0x2c7221[_0x83fd('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x2c7221[_0x83fd('0x1a')])?0x0:_0x2c7221[_0x83fd('0x1a')],'scheduledat':moment()[_0x83fd('0x2c')](_0x1848c9||0x1,_0x83fd('0x2d')),'countbusyretry':_0x5bf9b4['countbusyretry'],'countcongestionretry':_0x5bf9b4[_0x83fd('0x1d')],'countnoanswerretry':_0x5bf9b4['countnoanswerretry'],'countnosuchnumberretry':_0x5bf9b4[_0x83fd('0x1e')],'countdropretry':_0x5bf9b4[_0x83fd('0x25')],'countabandonedretry':_0x5bf9b4[_0x83fd('0x1f')],'countmachineretry':_0x5bf9b4[_0x83fd('0x20')],'countagentrejectretry':_0x5bf9b4[_0x83fd('0x21')],'createdAt':_0x5bf9b4[_0x83fd('0x2f')],'updatedAt':_0x5bf9b4['updatedAt']};var _0x2a7da2={'CmHopperId':_0x2c7221['id'],'phone':_0xb2d02d[_0x83fd('0x2e')],'active':0x0,'OrderBy':_[_0x83fd('0x30')](_0xb2d02d[_0x83fd('0x1a')])?0x0:_0xb2d02d[_0x83fd('0x1a')],'scheduledat':_0xc0ecf4,'countbusyretry':_0xb2d02d['countbusyretry'],'countcongestionretry':_0xb2d02d[_0x83fd('0x1d')],'countnoanswerretry':_0xb2d02d['countnoanswerretry'],'countnosuchnumberretry':_0x5bf9b4[_0x83fd('0x1e')],'countdropretry':_0x5bf9b4['countdropretry'],'countabandonedretry':_0x5bf9b4['countabandonedretry'],'countmachineretry':_0x5bf9b4['countmachineretry'],'countagentrejectretry':_0x5bf9b4[_0x83fd('0x21')],'createdAt':_0xb2d02d[_0x83fd('0x2f')],'updatedAt':_0xb2d02d[_0x83fd('0x31')]};logger[_0x83fd('0x2a')](_0x83fd('0x32'),_0x42f4c8);logger['info'](_0x83fd('0x33'),_0x2a7da2);return db[_0x83fd('0x34')][_0x83fd('0x35')](function(_0x5c3ac9){return db[_0x83fd('0x24')]['update'](_0x42f4c8,{'where':{'id':_0xb2d02d['id']}},{'transaction':_0x5c3ac9})['then'](function(){return db['CmHopper'][_0x83fd('0x36')](_0x2a7da2,{'where':{'id':_0x2c7221['id']}},{'transaction':_0x5c3ac9});});})[_0x83fd('0xa')](function(_0x268112){_0x2e673e({'id':_0x2c7221['id'],'phone':_0xb2d02d[_0x83fd('0x2e')]});})[_0x83fd('0x12')](function(_0x1de72e){logger[_0x83fd('0xf')](_0x83fd('0x13'),_0x1de72e[_0x83fd('0x11')],req);_0x4d6e38(_this[_0x83fd('0xf')](0x1f4,_0x1de72e['message']));});});}exports[_0x83fd('0x37')]=function(_0x403607){var _0x432502=this;return new Promise(function(_0x3a5492,_0x1bb9a8){return db[_0x83fd('0x14')][_0x83fd('0x36')](_0x403607[_0x83fd('0x15')]['field'],{'where':{'id':_0x403607[_0x83fd('0x15')]['id']}})[_0x83fd('0xa')](function(_0x4b87d3){_0x3a5492(_0x4b87d3);})['catch'](function(_0x326d9f){logger['error']('IncrementPreviewCounters',_0x326d9f['message'],_0x403607);_0x1bb9a8(_0x432502['error'](0x1f4,_0x326d9f[_0x83fd('0x11')]));});});}; \ No newline at end of file +var _0x9c42=['findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','entity','OrderBy','countbusyretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopper','duration','minutes','scheduledat','add','phone','isNil','countabandonedretry','createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','update','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VerifyAdditionalPhones'];(function(_0x9f2e1,_0x1dc405){var _0xde4ef0=function(_0x377f55){while(--_0x377f55){_0x9f2e1['push'](_0x9f2e1['shift']());}};_0xde4ef0(++_0x1dc405);}(_0x9c42,0xce));var _0x29c4=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0x9c42[_0x4e11d5];return _0x5e4e4c;};'use strict';var _=require(_0x29c4('0x0'));var util=require('util');var moment=require(_0x29c4('0x1'));var BPromise=require(_0x29c4('0x2'));var rs=require(_0x29c4('0x3'));var fs=require('fs');var Redis=require(_0x29c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29c4('0x5'));var logger=require('../../config/logger')(_0x29c4('0x6'));var config=require(_0x29c4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x29c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d655e,_0x40d02d,_0x460604){return new BPromise(function(_0x4d5fb6,_0x4b6fbd){return client[_0x29c4('0x9')](_0x3d655e,_0x460604)[_0x29c4('0xa')](function(_0x5834d3){logger[_0x29c4('0xb')](_0x29c4('0xc'),_0x40d02d,'request\x20sent');logger[_0x29c4('0xd')](_0x29c4('0xe'),_0x40d02d,_0x29c4('0xf'),JSON[_0x29c4('0x10')](_0x5834d3));if(_0x5834d3[_0x29c4('0x11')]){if(_0x5834d3[_0x29c4('0x11')]['code']===0x1f4){logger[_0x29c4('0x11')](_0x29c4('0xc'),_0x40d02d,_0x5834d3['error'][_0x29c4('0x12')]);return _0x4b6fbd(_0x5834d3['error']['message']);}logger[_0x29c4('0x11')](_0x29c4('0xc'),_0x40d02d,_0x5834d3[_0x29c4('0x11')][_0x29c4('0x12')]);return _0x4d5fb6(_0x5834d3[_0x29c4('0x11')][_0x29c4('0x12')]);}else{logger[_0x29c4('0xb')](_0x29c4('0xc'),_0x40d02d,_0x29c4('0xf'));_0x4d5fb6(_0x5834d3[_0x29c4('0x13')][_0x29c4('0x12')]);}})[_0x29c4('0x14')](function(_0x1f4856){logger[_0x29c4('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x40d02d,_0x1f4856);_0x4b6fbd(_0x1f4856);});});}exports[_0x29c4('0x15')]=function(_0x1275ac){var _0x55c66c=this;return new Promise(function(_0x1efd6b,_0x12ce92){return db['CmHopper'][_0x29c4('0x16')]({'raw':!![],'where':{'ContactId':_0x1275ac[_0x29c4('0x17')][_0x29c4('0x18')],'ListId':_0x1275ac[_0x29c4('0x17')][_0x29c4('0x19')],'VoiceQueueId':_0x1275ac[_0x29c4('0x17')][_0x29c4('0x1a')]===undefined?null:_0x1275ac[_0x29c4('0x17')][_0x29c4('0x1a')],'CampaignId':_0x1275ac['body'][_0x29c4('0x1b')]===undefined?null:_0x1275ac['body']['CampaignId']}})[_0x29c4('0xa')](function(_0x27f3ff){if(_0x27f3ff!=null){return db[_0x29c4('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x27f3ff['id'],'OrderBy':{'$gt':_0x27f3ff['OrderBy']}},'order':[['OrderBy',_0x29c4('0x1d')]]})[_0x29c4('0xa')](function(_0x43e1ec){var _0x3ded7b=0x0;if(_0x43e1ec){if(_0x43e1ec['countbusyretry']+_0x43e1ec[_0x29c4('0x1e')]+_0x43e1ec[_0x29c4('0x1f')]+_0x43e1ec[_0x29c4('0x20')]+_0x43e1ec[_0x29c4('0x21')]+_0x43e1ec['countabandonedretry']+_0x43e1ec['countmachineretry']+_0x43e1ec['countagentrejectretry']<_0x1275ac[_0x29c4('0x22')]['dialGlobalMaxRetry'])_0x3ded7b=0x1;_0x1efd6b({'additional':_0x3ded7b});}else{return db[_0x29c4('0x1c')][_0x29c4('0x16')]({'raw':!![],'where':{'CmHopperId':_0x27f3ff['id']},'order':[[_0x29c4('0x23'),_0x29c4('0x1d')]]})[_0x29c4('0xa')](function(_0x44cdae){var _0xe3294f=0x0;if(_0x44cdae){if(_0x44cdae[_0x29c4('0x24')]+_0x44cdae[_0x29c4('0x1e')]+_0x44cdae['countnoanswerretry']+_0x44cdae[_0x29c4('0x20')]+_0x44cdae[_0x29c4('0x21')]+_0x44cdae['countabandonedretry']+_0x44cdae[_0x29c4('0x25')]+_0x44cdae[_0x29c4('0x26')]<_0x1275ac[_0x29c4('0x22')][_0x29c4('0x27')])_0xe3294f=0x1;_0x1efd6b({'additional':_0xe3294f});}else{_0x1efd6b({'additional':0x0});}})[_0x29c4('0x14')](function(_0x49c5c7){logger[_0x29c4('0x11')](_0x29c4('0x15'),_0x49c5c7[_0x29c4('0x12')],_0x1275ac);_0x12ce92(_0x55c66c[_0x29c4('0x11')](0x1f4,_0x49c5c7[_0x29c4('0x12')]));});}})[_0x29c4('0x14')](function(_0x1e56d2){logger[_0x29c4('0x11')](_0x29c4('0x15'),_0x1e56d2[_0x29c4('0x12')],_0x1275ac);_0x12ce92(_0x55c66c[_0x29c4('0x11')](0x1f4,_0x1e56d2[_0x29c4('0x12')]));});}else _0x1efd6b({'additional':0x0});});});};exports[_0x29c4('0x28')]=function(_0x19f2e0){var _0x528d4f=this;return new Promise(function(_0x64d898,_0x2a3532){return db[_0x29c4('0x29')][_0x29c4('0x16')]({'raw':!![],'where':{'ContactId':_0x19f2e0[_0x29c4('0x17')][_0x29c4('0x18')],'ListId':_0x19f2e0[_0x29c4('0x17')][_0x29c4('0x19')],'VoiceQueueId':_0x19f2e0[_0x29c4('0x17')][_0x29c4('0x1a')]===undefined?null:_0x19f2e0[_0x29c4('0x17')][_0x29c4('0x1a')],'CampaignId':_0x19f2e0[_0x29c4('0x17')][_0x29c4('0x1b')]===undefined?null:_0x19f2e0[_0x29c4('0x17')][_0x29c4('0x1b')]}})[_0x29c4('0xa')](function(_0x4c20f3){if(_0x4c20f3!=null){return db[_0x29c4('0x1c')][_0x29c4('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4c20f3['id'],'OrderBy':{'$gt':_0x4c20f3[_0x29c4('0x23')]}},'order':[['OrderBy','ASC']]})[_0x29c4('0xa')](function(_0x2575fb){if(_0x2575fb)return activateAdditionalPhone(_0x4c20f3,_0x19f2e0[_0x29c4('0x17')],_0x2575fb,_0x19f2e0[_0x29c4('0x2a')],_0x19f2e0['waitTime'])[_0x29c4('0xa')](function(_0x3d942d){_0x64d898(_0x3d942d);});else{return db[_0x29c4('0x1c')][_0x29c4('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4c20f3['id']},'order':[[_0x29c4('0x23'),_0x29c4('0x1d')]]})[_0x29c4('0xa')](function(_0x21e752){if(_0x21e752)return activateAdditionalPhone(_0x4c20f3,_0x19f2e0['body'],_0x21e752,_0x19f2e0[_0x29c4('0x2a')],_0x19f2e0['waitTime'])[_0x29c4('0xa')](function(_0x72429d){_0x64d898(_0x72429d);});else{_0x64d898({'id':_0x4c20f3['id'],'phone':''});}})[_0x29c4('0x14')](function(_0x2b1744){logger[_0x29c4('0x11')](_0x29c4('0x15'),_0x2b1744[_0x29c4('0x12')],_0x19f2e0);_0x2a3532(_0x528d4f[_0x29c4('0x11')](0x1f4,_0x2b1744[_0x29c4('0x12')]));});}})[_0x29c4('0x14')](function(_0x61c1b6){logger[_0x29c4('0x11')](_0x29c4('0x15'),_0x61c1b6[_0x29c4('0x12')],_0x19f2e0);_0x2a3532(_0x528d4f['error'](0x1f4,_0x61c1b6[_0x29c4('0x12')]));});}else _0x64d898(0x1);});});};function activateAdditionalPhone(_0x27d3b1,_0x26bb65,_0x5b60be,_0x2bf64e,_0x272df9){return new Promise(function(_0x18a6a1,_0xea84c0){logger['info'](_0x29c4('0x15'),_0x5b60be);var _0x34f482;if(moment()>moment(_0x5b60be['scheduledat'])){_0x34f482=moment()['add'](_0x272df9||0x3,_0x29c4('0x2b'));}else{if(_0x5b60be['OrderBy']==0x0){_0x34f482=moment(_0x5b60be[_0x29c4('0x2c')]);}else{_0x34f482=moment()[_0x29c4('0x2d')](_0x272df9||0x3,_0x29c4('0x2b'));}}var _0x3e798d={'phone':_0x27d3b1[_0x29c4('0x2e')],'active':0x0,'OrderBy':_[_0x29c4('0x2f')](_0x27d3b1[_0x29c4('0x23')])?0x0:_0x27d3b1[_0x29c4('0x23')],'scheduledat':moment()[_0x29c4('0x2d')](_0x2bf64e||0x1,_0x29c4('0x2b')),'countbusyretry':_0x26bb65['countbusyretry'],'countcongestionretry':_0x26bb65[_0x29c4('0x1e')],'countnoanswerretry':_0x26bb65[_0x29c4('0x1f')],'countnosuchnumberretry':_0x26bb65['countnosuchnumberretry'],'countdropretry':_0x26bb65['countdropretry'],'countabandonedretry':_0x26bb65[_0x29c4('0x30')],'countmachineretry':_0x26bb65[_0x29c4('0x25')],'countagentrejectretry':_0x26bb65[_0x29c4('0x26')],'createdAt':_0x26bb65[_0x29c4('0x31')],'updatedAt':_0x26bb65[_0x29c4('0x32')]};var _0x58671b={'CmHopperId':_0x27d3b1['id'],'phone':_0x5b60be[_0x29c4('0x2e')],'active':0x0,'OrderBy':_[_0x29c4('0x2f')](_0x5b60be[_0x29c4('0x23')])?0x0:_0x5b60be[_0x29c4('0x23')],'scheduledat':_0x34f482,'countbusyretry':_0x5b60be[_0x29c4('0x24')],'countcongestionretry':_0x5b60be[_0x29c4('0x1e')],'countnoanswerretry':_0x5b60be[_0x29c4('0x1f')],'countnosuchnumberretry':_0x26bb65[_0x29c4('0x20')],'countdropretry':_0x26bb65[_0x29c4('0x21')],'countabandonedretry':_0x26bb65[_0x29c4('0x30')],'countmachineretry':_0x26bb65[_0x29c4('0x25')],'countagentrejectretry':_0x26bb65['countagentrejectretry'],'createdAt':_0x5b60be[_0x29c4('0x31')],'updatedAt':_0x5b60be[_0x29c4('0x32')]};logger[_0x29c4('0xb')](_0x29c4('0x33'),_0x3e798d);logger[_0x29c4('0xb')](_0x29c4('0x34'),_0x58671b);return db[_0x29c4('0x35')]['transaction'](function(_0x1aec30){return db['CmHopperAdditionalPhone'][_0x29c4('0x36')](_0x3e798d,{'where':{'id':_0x5b60be['id']}},{'transaction':_0x1aec30})[_0x29c4('0xa')](function(){return db[_0x29c4('0x29')]['update'](_0x58671b,{'where':{'id':_0x27d3b1['id']}},{'transaction':_0x1aec30});});})[_0x29c4('0xa')](function(_0x46e406){_0x18a6a1({'id':_0x27d3b1['id'],'phone':_0x5b60be[_0x29c4('0x2e')]});})[_0x29c4('0x14')](function(_0x1635af){logger[_0x29c4('0x11')](_0x29c4('0x15'),_0x1635af[_0x29c4('0x12')],req);_0xea84c0(_this[_0x29c4('0x11')](0x1f4,_0x1635af[_0x29c4('0x12')]));});});}exports[_0x29c4('0x37')]=function(_0x233ffb){var _0x448ef1=this;return new Promise(function(_0x267e56,_0x3c8f88){return db['CmHopper'][_0x29c4('0x36')](_0x233ffb[_0x29c4('0x17')][_0x29c4('0x38')],{'where':{'id':_0x233ffb[_0x29c4('0x17')]['id']}})[_0x29c4('0xa')](function(_0x5aafa1){_0x267e56(_0x5aafa1);})[_0x29c4('0x14')](function(_0x8c0856){logger[_0x29c4('0x11')](_0x29c4('0x37'),_0x8c0856[_0x29c4('0x12')],_0x233ffb);_0x3c8f88(_0x448ef1[_0x29c4('0x11')](0x1f4,_0x8c0856['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index eb3b32b..75c6e7d 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 _0x31c4=['show','post','create','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x31c4,0x1d1));var _0x431c=function(_0x475580,_0x3e1697){_0x475580=_0x475580-0x0;var _0x15fd2d=_0x31c4[_0x475580];return _0x15fd2d;};'use strict';var multer=require(_0x431c('0x0'));var util=require('util');var path=require(_0x431c('0x1'));var timeout=require(_0x431c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x431c('0x3'));var interaction=require(_0x431c('0x4'));var config=require(_0x431c('0x5'));var controller=require(_0x431c('0x6'));router[_0x431c('0x7')]('/',auth[_0x431c('0x8')](),controller[_0x431c('0x9')]);router[_0x431c('0x7')](_0x431c('0xa'),auth[_0x431c('0x8')](),controller[_0x431c('0xb')]);router[_0x431c('0xc')]('/',auth[_0x431c('0x8')](),controller[_0x431c('0xd')]);router['put'](_0x431c('0xa'),auth[_0x431c('0x8')](),controller['update']);router[_0x431c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x431c('0xf')]);module[_0x431c('0x10')]=router; \ No newline at end of file +var _0xa72d=['index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get'];(function(_0x3bba37,_0xf0dc15){var _0x534df2=function(_0xefcf0){while(--_0xefcf0){_0x3bba37['push'](_0x3bba37['shift']());}};_0x534df2(++_0xf0dc15);}(_0xa72d,0x1bf));var _0xda72=function(_0x5e582b,_0xc495ff){_0x5e582b=_0x5e582b-0x0;var _0xbea2e2=_0xa72d[_0x5e582b];return _0xbea2e2;};'use strict';var multer=require(_0xda72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda72('0x1'));var express=require(_0xda72('0x2'));var router=express[_0xda72('0x3')]();var auth=require(_0xda72('0x4'));var interaction=require(_0xda72('0x5'));var config=require(_0xda72('0x6'));var controller=require(_0xda72('0x7'));router[_0xda72('0x8')]('/',auth['isAuthenticated'](),controller[_0xda72('0x9')]);router[_0xda72('0x8')](_0xda72('0xa'),auth['isAuthenticated'](),controller[_0xda72('0xb')]);router[_0xda72('0xc')]('/',auth[_0xda72('0xd')](),controller[_0xda72('0xe')]);router[_0xda72('0xf')](_0xda72('0xa'),auth[_0xda72('0xd')](),controller[_0xda72('0x10')]);router[_0xda72('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xda72('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 eaefd4f..e6e0e2f 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 _0x2cf8=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2cf8,0x1c7));var _0x82cf=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0x2cf8[_0x1af482];return _0x7e7580;};'use strict';var moment=require(_0x82cf('0x0'));var Sequelize=require(_0x82cf('0x1'));module[_0x82cf('0x2')]={'phone':{'type':Sequelize[_0x82cf('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x82cf('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x82cf('0x4')],'unique':_0x82cf('0x5')}}; \ No newline at end of file +var _0xdeca=['contactListQueue','INTEGER','sequelize','exports','STRING'];(function(_0x363643,_0x33f7af){var _0x48b910=function(_0x1da513){while(--_0x1da513){_0x363643['push'](_0x363643['shift']());}};_0x48b910(++_0x33f7af);}(_0xdeca,0x1c9));var _0xadec=function(_0x1298fc,_0x272e7f){_0x1298fc=_0x1298fc-0x0;var _0x3ab15b=_0xdeca[_0x1298fc];return _0x3ab15b;};'use strict';var moment=require('moment');var Sequelize=require(_0xadec('0x0'));module[_0xadec('0x1')]={'phone':{'type':Sequelize[_0xadec('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xadec('0x3')},'ListId':{'type':Sequelize[_0xadec('0x4')],'unique':_0xadec('0x3')},'VoiceQueueId':{'type':Sequelize[_0xadec('0x4')],'unique':_0xadec('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 86ba9a3..43c0b65 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(_0x3564d7,_0xa022d5){var _0x1c62f8=function(_0x4d9e88){while(--_0x4d9e88){_0x3564d7['push'](_0x3564d7['shift']());}};_0x1c62f8(++_0xa022d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x4d3b2e,_0x2ae87c){var _0x395f9a=function(_0x2f765c){while(--_0x2f765c){_0x4d3b2e['push'](_0x4d3b2e['shift']());}};_0x395f9a(++_0x2ae87c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 a9f4429..55c1e64 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 _0x9c44=['request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0x49a315,_0x3b3d96){var _0x167a44=function(_0x16ca1c){while(--_0x16ca1c){_0x49a315['push'](_0x49a315['shift']());}};_0x167a44(++_0x3b3d96);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger','api'];(function(_0x33f481,_0x900262){var _0x6aa784=function(_0x18d946){while(--_0x18d946){_0x33f481['push'](_0x33f481['shift']());}};_0x6aa784(++_0x900262);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 40321ca..79bce08 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 _0x07b2=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','raw','catch','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x07b2,0xfe));var _0x207b=function(_0x50d3a3,_0x253f47){_0x50d3a3=_0x50d3a3-0x0;var _0x4ccd92=_0x07b2[_0x50d3a3];return _0x4ccd92;};'use strict';var _=require(_0x207b('0x0'));var util=require(_0x207b('0x1'));var moment=require(_0x207b('0x2'));var BPromise=require(_0x207b('0x3'));var rs=require(_0x207b('0x4'));var fs=require('fs');var Redis=require(_0x207b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x207b('0x6'));var logger=require(_0x207b('0x7'))(_0x207b('0x8'));var config=require(_0x207b('0x9'));var jayson=require(_0x207b('0xa'));var client=jayson[_0x207b('0xb')][_0x207b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b3a4b,_0x7a968b,_0xe05fc2){return new BPromise(function(_0x51dacb,_0x14d24f){return client['request'](_0x1b3a4b,_0xe05fc2)[_0x207b('0xd')](function(_0xb5d055){logger[_0x207b('0xe')](_0x207b('0xf'),_0x7a968b,'request\x20sent');logger[_0x207b('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x7a968b,'request\x20sent',JSON[_0x207b('0x11')](_0xb5d055));if(_0xb5d055['error']){if(_0xb5d055[_0x207b('0x12')]['code']===0x1f4){logger[_0x207b('0x12')](_0x207b('0xf'),_0x7a968b,_0xb5d055[_0x207b('0x12')][_0x207b('0x13')]);return _0x14d24f(_0xb5d055[_0x207b('0x12')][_0x207b('0x13')]);}logger[_0x207b('0x12')](_0x207b('0xf'),_0x7a968b,_0xb5d055['error'][_0x207b('0x13')]);return _0x51dacb(_0xb5d055[_0x207b('0x12')][_0x207b('0x13')]);}else{logger[_0x207b('0xe')](_0x207b('0xf'),_0x7a968b,_0x207b('0x14'));_0x51dacb(_0xb5d055[_0x207b('0x15')]['message']);}})['catch'](function(_0x4f91ad){logger[_0x207b('0x12')](_0x207b('0xf'),_0x7a968b,_0x4f91ad);_0x14d24f(_0x4f91ad);});});}exports[_0x207b('0x16')]=function(_0x365fd6){var _0x59d850=this;return new Promise(function(_0x4548ef,_0x555086){return db[_0x207b('0x17')]['findAll']({'raw':_0x365fd6[_0x207b('0x18')]?_0x365fd6['options']['raw']===undefined?!![]:![]:!![],'where':_0x365fd6[_0x207b('0x18')]?_0x365fd6[_0x207b('0x18')][_0x207b('0x19')]||null:null,'attributes':_0x365fd6['options']?_0x365fd6[_0x207b('0x18')][_0x207b('0x1a')]||null:null,'limit':_0x365fd6[_0x207b('0x18')]?_0x365fd6[_0x207b('0x18')][_0x207b('0x1b')]||null:null,'include':_0x365fd6[_0x207b('0x18')]?_0x365fd6[_0x207b('0x18')][_0x207b('0x1c')]?_[_0x207b('0x1d')](_0x365fd6[_0x207b('0x18')]['include'],function(_0x53ba76){return{'model':db[_0x53ba76[_0x207b('0x1e')]],'as':_0x53ba76['as'],'attributes':_0x53ba76[_0x207b('0x1a')],'include':_0x53ba76['include']?_[_0x207b('0x1d')](_0x53ba76[_0x207b('0x1c')],function(_0x378e57){return{'model':db[_0x378e57[_0x207b('0x1e')]],'as':_0x378e57['as'],'attributes':_0x378e57['attributes'],'include':_0x378e57[_0x207b('0x1c')]?_[_0x207b('0x1d')](_0x378e57[_0x207b('0x1c')],function(_0x18ba35){return{'model':db[_0x18ba35[_0x207b('0x1e')]],'as':_0x18ba35['as'],'attributes':_0x18ba35[_0x207b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x207b('0xd')](function(_0xfa5abc){logger[_0x207b('0xe')](_0x207b('0x16'),_0x365fd6);logger[_0x207b('0x10')](_0x207b('0x16'),_0x365fd6,JSON['stringify'](_0xfa5abc));_0x4548ef(_0xfa5abc);})['catch'](function(_0x50ff73){logger[_0x207b('0x12')]('GetCmHopperBlack',_0x50ff73[_0x207b('0x13')],_0x365fd6);_0x555086(_0x59d850[_0x207b('0x12')](0x1f4,_0x50ff73[_0x207b('0x13')]));});});};exports[_0x207b('0x1f')]=function(_0x72159c){var _0x1b2e82=this;return new Promise(function(_0x2095ae,_0x50654a){return db['CmHopperBlack']['update'](_0x72159c[_0x207b('0x20')],{'raw':_0x72159c['options']?_0x72159c[_0x207b('0x18')][_0x207b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x72159c[_0x207b('0x18')]?_0x72159c[_0x207b('0x18')][_0x207b('0x19')]||null:null,'attributes':_0x72159c['options']?_0x72159c[_0x207b('0x18')]['attributes']||null:null,'limit':_0x72159c['options']?_0x72159c[_0x207b('0x18')][_0x207b('0x1b')]||null:null})[_0x207b('0xd')](function(_0x15db45){logger[_0x207b('0xe')](_0x207b('0x1f'),_0x72159c);logger[_0x207b('0x10')](_0x207b('0x1f'),_0x72159c,JSON[_0x207b('0x11')](_0x15db45));_0x2095ae(_0x15db45);})[_0x207b('0x22')](function(_0x11a752){logger[_0x207b('0x12')](_0x207b('0x1f'),_0x11a752[_0x207b('0x13')],_0x72159c);_0x50654a(_0x1b2e82[_0x207b('0x12')](0x1f4,_0x11a752[_0x207b('0x13')]));});});};exports[_0x207b('0x23')]=function(_0x7956b2){var _0x8a8af9=this;return new Promise(function(_0x10872f,_0x5d0721){return db[_0x207b('0x17')][_0x207b('0x24')]({'where':_0x7956b2['options']?_0x7956b2[_0x207b('0x18')]['where']||null:null})['then'](function(_0x17038a){logger['info'](_0x207b('0x23'),_0x7956b2);logger[_0x207b('0x10')](_0x207b('0x23'),_0x7956b2,JSON[_0x207b('0x11')](_0x17038a));_0x10872f(_0x17038a);})[_0x207b('0x22')](function(_0x4580dc){logger['error'](_0x207b('0x23'),_0x4580dc[_0x207b('0x13')],_0x7956b2);_0x5d0721(_0x8a8af9[_0x207b('0x12')](0x1f4,_0x4580dc[_0x207b('0x13')]));});});}; \ No newline at end of file +var _0x1520=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','limit','map','model','attributes','include','update','body','where','UpdateCmHopperBlack','catch','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xd07059,_0x145119){var _0x514f49=function(_0x87abec){while(--_0x87abec){_0xd07059['push'](_0xd07059['shift']());}};_0x514f49(++_0x145119);}(_0x1520,0x16b));var _0x0152=function(_0x43f3e8,_0x3a35cd){_0x43f3e8=_0x43f3e8-0x0;var _0x107890=_0x1520[_0x43f3e8];return _0x107890;};'use strict';var _=require(_0x0152('0x0'));var util=require(_0x0152('0x1'));var moment=require(_0x0152('0x2'));var BPromise=require(_0x0152('0x3'));var rs=require(_0x0152('0x4'));var fs=require('fs');var Redis=require(_0x0152('0x5'));var db=require(_0x0152('0x6'))['db'];var utils=require(_0x0152('0x7'));var logger=require(_0x0152('0x8'))(_0x0152('0x9'));var config=require(_0x0152('0xa'));var jayson=require(_0x0152('0xb'));var client=jayson[_0x0152('0xc')][_0x0152('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x481383,_0x56b436,_0x3b6ced){return new BPromise(function(_0x533fdc,_0x5b8167){return client[_0x0152('0xe')](_0x481383,_0x3b6ced)[_0x0152('0xf')](function(_0xc1b25b){logger[_0x0152('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x56b436,_0x0152('0x11'));logger[_0x0152('0x12')](_0x0152('0x13'),_0x56b436,_0x0152('0x11'),JSON[_0x0152('0x14')](_0xc1b25b));if(_0xc1b25b[_0x0152('0x15')]){if(_0xc1b25b['error'][_0x0152('0x16')]===0x1f4){logger[_0x0152('0x15')](_0x0152('0x17'),_0x56b436,_0xc1b25b[_0x0152('0x15')][_0x0152('0x18')]);return _0x5b8167(_0xc1b25b[_0x0152('0x15')][_0x0152('0x18')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x56b436,_0xc1b25b[_0x0152('0x15')][_0x0152('0x18')]);return _0x533fdc(_0xc1b25b['error'][_0x0152('0x18')]);}else{logger[_0x0152('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x56b436,_0x0152('0x11'));_0x533fdc(_0xc1b25b[_0x0152('0x19')][_0x0152('0x18')]);}})['catch'](function(_0x309db4){logger[_0x0152('0x15')]('CmHopperBlack,\x20%s,\x20%s',_0x56b436,_0x309db4);_0x5b8167(_0x309db4);});});}exports[_0x0152('0x1a')]=function(_0x4349da){var _0x5bd133=this;return new Promise(function(_0x6b480e,_0x36b2bb){return db[_0x0152('0x1b')][_0x0152('0x1c')]({'raw':_0x4349da[_0x0152('0x1d')]?_0x4349da[_0x0152('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4349da['options']?_0x4349da['options']['where']||null:null,'attributes':_0x4349da[_0x0152('0x1d')]?_0x4349da[_0x0152('0x1d')]['attributes']||null:null,'limit':_0x4349da['options']?_0x4349da[_0x0152('0x1d')][_0x0152('0x1e')]||null:null,'include':_0x4349da[_0x0152('0x1d')]?_0x4349da['options']['include']?_[_0x0152('0x1f')](_0x4349da['options']['include'],function(_0x56e686){return{'model':db[_0x56e686[_0x0152('0x20')]],'as':_0x56e686['as'],'attributes':_0x56e686[_0x0152('0x21')],'include':_0x56e686[_0x0152('0x22')]?_[_0x0152('0x1f')](_0x56e686[_0x0152('0x22')],function(_0x8cd026){return{'model':db[_0x8cd026[_0x0152('0x20')]],'as':_0x8cd026['as'],'attributes':_0x8cd026[_0x0152('0x21')],'include':_0x8cd026[_0x0152('0x22')]?_[_0x0152('0x1f')](_0x8cd026[_0x0152('0x22')],function(_0x1bcdfe){return{'model':db[_0x1bcdfe[_0x0152('0x20')]],'as':_0x1bcdfe['as'],'attributes':_0x1bcdfe[_0x0152('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0152('0xf')](function(_0x1f3758){logger[_0x0152('0x10')](_0x0152('0x1a'),_0x4349da);logger['debug']('GetCmHopperBlack',_0x4349da,JSON[_0x0152('0x14')](_0x1f3758));_0x6b480e(_0x1f3758);})['catch'](function(_0x17b8cf){logger[_0x0152('0x15')](_0x0152('0x1a'),_0x17b8cf[_0x0152('0x18')],_0x4349da);_0x36b2bb(_0x5bd133[_0x0152('0x15')](0x1f4,_0x17b8cf[_0x0152('0x18')]));});});};exports['UpdateCmHopperBlack']=function(_0x47784b){var _0x32510d=this;return new Promise(function(_0x19dbd7,_0x1e4326){return db[_0x0152('0x1b')][_0x0152('0x23')](_0x47784b[_0x0152('0x24')],{'raw':_0x47784b[_0x0152('0x1d')]?_0x47784b[_0x0152('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47784b[_0x0152('0x1d')]?_0x47784b[_0x0152('0x1d')][_0x0152('0x25')]||null:null,'attributes':_0x47784b[_0x0152('0x1d')]?_0x47784b[_0x0152('0x1d')][_0x0152('0x21')]||null:null,'limit':_0x47784b['options']?_0x47784b[_0x0152('0x1d')][_0x0152('0x1e')]||null:null})[_0x0152('0xf')](function(_0x32d576){logger[_0x0152('0x10')](_0x0152('0x26'),_0x47784b);logger['debug']('UpdateCmHopperBlack',_0x47784b,JSON[_0x0152('0x14')](_0x32d576));_0x19dbd7(_0x32d576);})[_0x0152('0x27')](function(_0x3d5a5f){logger[_0x0152('0x15')](_0x0152('0x26'),_0x3d5a5f[_0x0152('0x18')],_0x47784b);_0x1e4326(_0x32510d[_0x0152('0x15')](0x1f4,_0x3d5a5f[_0x0152('0x18')]));});});};exports[_0x0152('0x28')]=function(_0x234f2a){var _0x48f6b9=this;return new Promise(function(_0x13ceb9,_0x48b20b){return db[_0x0152('0x1b')]['destroy']({'where':_0x234f2a[_0x0152('0x1d')]?_0x234f2a[_0x0152('0x1d')][_0x0152('0x25')]||null:null})['then'](function(_0x28ae0a){logger['info'](_0x0152('0x28'),_0x234f2a);logger[_0x0152('0x12')](_0x0152('0x28'),_0x234f2a,JSON['stringify'](_0x28ae0a));_0x13ceb9(_0x28ae0a);})[_0x0152('0x27')](function(_0x1d4791){logger['error'](_0x0152('0x28'),_0x1d4791[_0x0152('0x18')],_0x234f2a);_0x48b20b(_0x48f6b9['error'](0x1f4,_0x1d4791[_0x0152('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e6f142a..2997599 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 _0xd0bb=['path','express','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id','show','put','update','delete','destroy','multer','util'];(function(_0x27b96e,_0x27b07d){var _0x54c1c2=function(_0x1f46d2){while(--_0x1f46d2){_0x27b96e['push'](_0x27b96e['shift']());}};_0x54c1c2(++_0x27b07d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0xd0bb[_0x458ed6];return _0xa5dfd9;};'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['describe']);router[_0xbd0b('0x9')](_0xbd0b('0xb'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xc')]);router[_0xbd0b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6f0d=['update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','show','put','/:id'];(function(_0x5ec314,_0x4cebd9){var _0x18e9a6=function(_0x5281d4){while(--_0x5281d4){_0x5ec314['push'](_0x5ec314['shift']());}};_0x18e9a6(++_0x4cebd9);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x18b563,_0x15e9a2){_0x18b563=_0x18b563-0x0;var _0x3d6984=_0x6f0d[_0x18b563];return _0x3d6984;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var auth=require(_0xd6f0('0x4'));var interaction=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var controller=require(_0xd6f0('0x7'));router[_0xd6f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6f0('0x9')]);router['get'](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')](_0xd6f0('0xf'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x10')]);router['delete'](_0xd6f0('0xf'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x11')]);module[_0xd6f0('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f38ae73..50dde4b 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 _0x8a9d=['STRING','DATE','getDataValue','setDataValue','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER'];(function(_0x45b63c,_0x31ae0f){var _0x167233=function(_0x148f1c){while(--_0x148f1c){_0x45b63c['push'](_0x45b63c['shift']());}};_0x167233(++_0x31ae0f);}(_0x8a9d,0x1c9));var _0xd8a9=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x8a9d[_0x5ce3c8];return _0xa76867;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd8a9('0x0'));module[_0xd8a9('0x1')]={'state':{'type':Sequelize[_0xd8a9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd8a9('0x3')]},'scheduledat':{'type':Sequelize[_0xd8a9('0x4')]},'countbusyretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd8a9('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd8a9('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd8a9('0x3')]},'calleridname':{'type':Sequelize[_0xd8a9('0x3')]},'starttime':{'type':Sequelize[_0xd8a9('0x4')]},'responsetime':{'type':Sequelize[_0xd8a9('0x4')]},'answertime':{'type':Sequelize[_0xd8a9('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd8a9('0x4')]},'ringtime':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd8a9('0x3')]},'campaign':{'type':Sequelize[_0xd8a9('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd8a9('0x3')]},'reason':{'type':Sequelize[_0xd8a9('0x3')]},'disposition':{'type':Sequelize[_0xd8a9('0x3')]},'dispositionat':{'type':Sequelize[_0xd8a9('0x4')],'set':function(_0x44078e){var _0x50af24=this[_0xd8a9('0x5')]('endtime');if(_0x50af24&&_0x44078e){this[_0xd8a9('0x6')]('followuptime',moment(_0x44078e)['diff'](moment(_0x50af24),_0xd8a9('0x7')));}return this['setDataValue'](_0xd8a9('0x8'),_0x44078e);}},'amd':{'type':Sequelize[_0xd8a9('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd8a9('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd8a9('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd8a9('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd8a9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd8a9('0x4')]},'deleted':{'type':Sequelize[_0xd8a9('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd8a9('0x4')]},'recallme':{'type':Sequelize[_0xd8a9('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd8a9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3987=['diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','followuptime'];(function(_0x1630b0,_0x5e0863){var _0x1d6a56=function(_0x3ccc7f){while(--_0x3ccc7f){_0x1630b0['push'](_0x1630b0['shift']());}};_0x1d6a56(++_0x5e0863);}(_0x3987,0x1d8));var _0x7398=function(_0x1543a2,_0x5970a0){_0x1543a2=_0x1543a2-0x0;var _0x4d6cda=_0x3987[_0x1543a2];return _0x4d6cda;};'use strict';var Sequelize=require(_0x7398('0x0'));var moment=require(_0x7398('0x1'));module[_0x7398('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x7398('0x3')]},'scheduledat':{'type':Sequelize[_0x7398('0x4')]},'countbusyretry':{'type':Sequelize[_0x7398('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7398('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7398('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7398('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7398('0x3')]},'calleridname':{'type':Sequelize[_0x7398('0x3')]},'starttime':{'type':Sequelize[_0x7398('0x4')]},'responsetime':{'type':Sequelize[_0x7398('0x4')]},'answertime':{'type':Sequelize[_0x7398('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7398('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7398('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7398('0x3')]},'campaign':{'type':Sequelize[_0x7398('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7398('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x7398('0x3')]},'dispositionat':{'type':Sequelize[_0x7398('0x4')],'set':function(_0x564d7d){var _0x462221=this[_0x7398('0x6')](_0x7398('0x7'));if(_0x462221&&_0x564d7d){this['setDataValue'](_0x7398('0x8'),moment(_0x564d7d)[_0x7398('0x9')](moment(_0x462221),_0x7398('0xa')));}return this['setDataValue'](_0x7398('0xb'),_0x564d7d);}},'amd':{'type':Sequelize[_0x7398('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7398('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7398('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7398('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7398('0x4')]},'callback':{'type':Sequelize[_0x7398('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7398('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7398('0x4')]},'deleted':{'type':Sequelize[_0x7398('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x7398('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7398('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7398('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7398('0x5')],'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 4b491db..d0d2359 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 _0x4975=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne'];(function(_0x28e9f9,_0xad591e){var _0x521b0c=function(_0x199dcc){while(--_0x199dcc){_0x28e9f9['push'](_0x28e9f9['shift']());}};_0x521b0c(++_0xad591e);}(_0x4975,0x86));var _0x5497=function(_0x1adb4d,_0x40388f){_0x1adb4d=_0x1adb4d-0x0;var _0x3021a0=_0x4975[_0x1adb4d];return _0x3021a0;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc250bb,_0x1b23df){_0x1b23df=_0x1b23df||0xcc;return function(_0x1bb794){if(_0x1bb794){return _0xc250bb[_0x5497('0x18')](_0x1b23df);}return _0xc250bb[_0x5497('0x19')](_0x1b23df)[_0x5497('0x1a')]();};}function respondWithResult(_0x1f7169,_0xaca97d){_0xaca97d=_0xaca97d||0xc8;return function(_0x363a5b){if(_0x363a5b){return _0x1f7169[_0x5497('0x19')](_0xaca97d)['json'](_0x363a5b);}};}function respondWithFilteredResult(_0x11b0a9,_0x4fb8e9){return function(_0x4237a9){if(_0x4237a9){var _0x2bfd8a=_0x4237a9[_0x5497('0x1b')],_0x19e5f3=_0x4fb8e9[_0x5497('0x1c')],_0x3ce50b=_0x4fb8e9['offset']+_0x4fb8e9['limit'],_0x37c18e;if(_0x3ce50b>=_0x2bfd8a){_0x3ce50b=_0x2bfd8a;_0x37c18e=0xc8;}else{_0x37c18e=0xce;}_0x11b0a9[_0x5497('0x19')](_0x37c18e);return _0x11b0a9[_0x5497('0x1d')](_0x5497('0x1e'),_0x19e5f3+'-'+_0x3ce50b+'/'+_0x2bfd8a)['json'](_0x4237a9);}return null;};}function patchUpdates(_0xbf1ba7){return function(_0xcbd71d){try{jsonpatch[_0x5497('0x1f')](_0xcbd71d,_0xbf1ba7,!![]);}catch(_0x43da2c){return BPromise[_0x5497('0x20')](_0x43da2c);}return _0xcbd71d[_0x5497('0x21')]();};}function saveUpdates(_0x16d378,_0x10226f){return function(_0x2e3960){if(_0x2e3960){return _0x2e3960[_0x5497('0x22')](_0x16d378)[_0x5497('0x23')](function(_0x52c049){return _0x52c049;});}return null;};}function removeEntity(_0x720767,_0x4d1b27){return function(_0x19200a){if(_0x19200a){return _0x19200a[_0x5497('0x24')]()[_0x5497('0x23')](function(){_0x720767[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(!_0x54043a){_0x3b2fbc[_0x5497('0x18')](0x194);}return _0x54043a;};}function handleError(_0x34b97f,_0x24482a){_0x24482a=_0x24482a||0x1f4;return function(_0x281155){logger['error'](_0x281155[_0x5497('0x25')]);if(_0x281155['name']){delete _0x281155[_0x5497('0x26')];}_0x34b97f[_0x5497('0x19')](_0x24482a)[_0x5497('0x27')](_0x281155);};}exports[_0x5497('0x28')]=function(_0x163a30,_0x31cd01){var _0x48b835={},_0x4af5f4={},_0x5406e2={'count':0x0,'rows':[]};var _0x583d06=_['map'](db[_0x5497('0x29')]['rawAttributes'],function(_0x5e9356){return{'name':_0x5e9356[_0x5497('0x2a')],'type':_0x5e9356[_0x5497('0x2b')][_0x5497('0x2c')]};});_0x4af5f4['model']=_['map'](_0x583d06,'name');_0x4af5f4[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x163a30[_0x5497('0x2d')]);_0x4af5f4['filters']=_['intersection'](_0x4af5f4['model'],_0x4af5f4[_0x5497('0x2d')]);_0x48b835['attributes']=_[_0x5497('0x2f')](_0x4af5f4[_0x5497('0x30')],qs[_0x5497('0x31')](_0x163a30['query'][_0x5497('0x31')]));_0x48b835[_0x5497('0x32')]=_0x48b835['attributes'][_0x5497('0x33')]?_0x48b835[_0x5497('0x32')]:_0x4af5f4[_0x5497('0x30')];if(!_0x163a30['query'][_0x5497('0x34')](_0x5497('0x35'))){_0x48b835[_0x5497('0x36')]=qs[_0x5497('0x36')](_0x163a30[_0x5497('0x2d')]['limit']);_0x48b835[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x163a30['query'][_0x5497('0x1c')]);}_0x48b835[_0x5497('0x37')]=qs[_0x5497('0x38')](_0x163a30[_0x5497('0x2d')][_0x5497('0x38')]);_0x48b835[_0x5497('0x39')]=qs['filters'](_[_0x5497('0x3a')](_0x163a30['query'],_0x4af5f4[_0x5497('0x3b')]),_0x583d06);if(_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]){_0x48b835['where']=_['merge'](_0x48b835[_0x5497('0x39')],{'$or':_[_0x5497('0x3d')](_0x583d06,function(_0x326d48){if(_0x326d48[_0x5497('0x2b')]!==_0x5497('0x3e')){var _0xc8a689={};_0xc8a689[_0x326d48['name']]={'$like':'%'+_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]+'%'};return _0xc8a689;}})});}_0x48b835=_[_0x5497('0x3f')]({},_0x48b835,_0x163a30[_0x5497('0x40')]);var _0x275aa7={'where':_0x48b835[_0x5497('0x39')]};return db[_0x5497('0x29')][_0x5497('0x1b')](_0x275aa7)[_0x5497('0x23')](function(_0x544065){_0x5406e2[_0x5497('0x1b')]=_0x544065;if(_0x163a30[_0x5497('0x2d')][_0x5497('0x41')]){_0x48b835[_0x5497('0x42')]=[{'all':!![]}];}return db[_0x5497('0x29')][_0x5497('0x43')](_0x48b835);})[_0x5497('0x23')](function(_0x59ed13){_0x5406e2[_0x5497('0x44')]=_0x59ed13;return _0x5406e2;})[_0x5497('0x23')](respondWithFilteredResult(_0x31cd01,_0x48b835))[_0x5497('0x45')](handleError(_0x31cd01,null));};exports[_0x5497('0x46')]=function(_0x1b251b,_0x125526){var _0x114471={'raw':!![],'where':{'id':_0x1b251b[_0x5497('0x47')]['id']}},_0x547437={};_0x547437[_0x5497('0x30')]=_[_0x5497('0x2e')](db[_0x5497('0x29')][_0x5497('0x48')]);_0x547437[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x1b251b[_0x5497('0x2d')]);_0x547437[_0x5497('0x3b')]=_[_0x5497('0x2f')](_0x547437['model'],_0x547437[_0x5497('0x2d')]);_0x114471['attributes']=_[_0x5497('0x2f')](_0x547437[_0x5497('0x30')],qs[_0x5497('0x31')](_0x1b251b[_0x5497('0x2d')][_0x5497('0x31')]));_0x114471['attributes']=_0x114471[_0x5497('0x32')][_0x5497('0x33')]?_0x114471['attributes']:_0x547437[_0x5497('0x30')];if(_0x1b251b['query'][_0x5497('0x41')]){_0x114471['include']=[{'all':!![]}];}_0x114471=_[_0x5497('0x3f')]({},_0x114471,_0x1b251b[_0x5497('0x40')]);return db[_0x5497('0x29')][_0x5497('0x49')](_0x114471)[_0x5497('0x23')](handleEntityNotFound(_0x125526,null))['then'](respondWithResult(_0x125526,null))['catch'](handleError(_0x125526,null));};exports['describe']=function(_0x55f654,_0x3cbe4b){return db[_0x5497('0x29')][_0x5497('0x4a')]()[_0x5497('0x23')](respondWithResult(_0x3cbe4b,null))[_0x5497('0x45')](handleError(_0x3cbe4b,null));};exports[_0x5497('0x22')]=function(_0xc78abe,_0x466287){if(_0xc78abe[_0x5497('0x4b')]['uniqueid']){delete _0xc78abe[_0x5497('0x4b')][_0x5497('0x4c')];}return db[_0x5497('0x29')]['find']({'where':{'uniqueid':_0xc78abe[_0x5497('0x47')]['id']}})['then'](handleEntityNotFound(_0x466287,null))[_0x5497('0x23')](saveUpdates(_0xc78abe[_0x5497('0x4b')],null))[_0x5497('0x23')](respondWithResult(_0x466287,null))['catch'](handleError(_0x466287,null));};exports[_0x5497('0x4d')]=function(_0x356d61,_0x515c3e,_0x3abc92){return db['CmHopperFinal'][_0x5497('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x356d61['params']['id']},'attributes':[[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x51')))),_0x5497('0x52')],[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x53')))),_0x5497('0x54')],[db['sequelize']['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x5497('0x55')],[db['sequelize']['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db['sequelize'][_0x5497('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5497('0x56')],[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x57')))),_0x5497('0x58')],[db['sequelize']['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x59')))),_0x5497('0x5a')],[db['sequelize']['fn'](_0x5497('0x4f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5497('0x5b')))),_0x5497('0x5c')]]})[_0x5497('0x23')](handleEntityNotFound(_0x515c3e,null))['then'](respondWithResult(_0x515c3e,null))[_0x5497('0x45')](handleError(_0x515c3e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5f0243,_0x5a676d,_0x1d320a){return db[_0x5497('0x29')][_0x5497('0x43')]({'raw':![],'where':{'CampaignId':_0x5f0243[_0x5497('0x47')]['id']},'attributes':[[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x51')))),'noSuchContacts'],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')]['literal'](_0x5497('0x53')))),_0x5497('0x54')],[db[_0x5497('0x4e')]['fn']('COUNT',db[_0x5497('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x5497('0x55')],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db['sequelize']['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x5d')))),_0x5497('0x5e')],[db['sequelize']['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')]['literal'](_0x5497('0x5f')))),_0x5497('0x56')],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5497('0x58')],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db[_0x5497('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x5497('0x5a')],[db[_0x5497('0x4e')]['fn'](_0x5497('0x4f'),db['sequelize']['fn']('IF',db[_0x5497('0x4e')][_0x5497('0x50')](_0x5497('0x5b')))),_0x5497('0x5c')]]})[_0x5497('0x23')](handleEntityNotFound(_0x5a676d,null))[_0x5497('0x23')](respondWithResult(_0x5a676d,null))[_0x5497('0x45')](handleError(_0x5a676d,null));};exports[_0x5497('0x60')]=function(_0x21da3d,_0x940188,_0x1fc6ad){return db['VoiceQueue'][_0x5497('0x49')]({'where':{'id':_0x21da3d[_0x5497('0x47')]['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x940188,null))['then'](function(_0x5794ff){var _0x589008;if(_0x5794ff){_0x589008=squel[_0x5497('0x61')]()[_0x5497('0x62')]('cm_hopper')[_0x5497('0x63')]([_0x5497('0x64'),_0x5497('0x65'),_0x5497('0x66'),'ListId',_0x5497('0x67'),_0x5497('0x68'),_0x5497('0x69')],squel['select']()[_0x5497('0x6a')](_0x5497('0x6b'),'phone')[_0x5497('0x6a')](_0x5497('0x6c'),_0x5497('0x65'))['field']('ANY_VALUE(ContactId)',_0x5497('0x66'))[_0x5497('0x6a')](_0x5497('0x6d'),_0x5497('0x6e'))[_0x5497('0x6a')](_0x5497('0x6f'),_0x5497('0x67'))['field']('NOW()',_0x5497('0x68'))[_0x5497('0x6a')]('NOW()',_0x5497('0x69'))[_0x5497('0x70')](_0x5497('0x71'))['where'](_0x5497('0x72'),_0x21da3d[_0x5497('0x47')]['id']['toString']())[_0x5497('0x39')](_0x5497('0x73'),_0x21da3d[_0x5497('0x4b')][_0x5497('0x74')][_0x5497('0x75')]())['where'](_0x5497('0x76'))[_0x5497('0x39')](_0x5497('0x77'),squel[_0x5497('0x78')]()[_0x5497('0x6a')]('phone')[_0x5497('0x70')](_0x5497('0x79'))[_0x5497('0x39')](_0x5497('0x72'),_0x21da3d['params']['id'][_0x5497('0x75')]()))[_0x5497('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5497('0x78')]()[_0x5497('0x6a')](_0x5497('0x7a'))[_0x5497('0x70')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x21da3d['params']['id']['toString']())[_0x5497('0x39')](_0x5497('0x7b')))[_0x5497('0x7c')](_0x5497('0x66')))[_0x5497('0x75')]();return db['sequelize']['query'](_0x589008);}return[];})[_0x5497('0x23')](respondWithResult(_0x940188,null))[_0x5497('0x45')](handleError(_0x940188,null));};exports[_0x5497('0x7d')]=function(_0x2737a2,_0x307dc5,_0x4ec76d){return db[_0x5497('0x7e')][_0x5497('0x49')]({'where':{'id':_0x2737a2[_0x5497('0x47')]['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x307dc5,null))['then'](function(_0x1515f1){var _0x4118ec;if(_0x1515f1){_0x4118ec=squel[_0x5497('0x61')]()[_0x5497('0x62')](_0x5497('0x79'))[_0x5497('0x63')](['phone',_0x5497('0x65'),'ContactId',_0x5497('0x6e'),_0x5497('0x7f'),_0x5497('0x68'),'updatedAt'],squel['select']()[_0x5497('0x6a')](_0x5497('0x6b'),_0x5497('0x64'))[_0x5497('0x6a')](_0x5497('0x6c'),_0x5497('0x65'))[_0x5497('0x6a')](_0x5497('0x80'),'ContactId')['field']('ANY_VALUE(ListId)',_0x5497('0x6e'))[_0x5497('0x6a')](_0x5497('0x81'),_0x5497('0x7f'))['field']('NOW()',_0x5497('0x68'))[_0x5497('0x6a')]('NOW()',_0x5497('0x69'))[_0x5497('0x70')](_0x5497('0x71'))[_0x5497('0x39')]('CampaignId\x20=\x20?',_0x2737a2['params']['id']['toString']())['where']('state\x20=\x20?',_0x2737a2[_0x5497('0x4b')]['state'][_0x5497('0x75')]())['where'](_0x5497('0x76'))[_0x5497('0x39')](_0x5497('0x77'),squel[_0x5497('0x78')]()[_0x5497('0x6a')](_0x5497('0x64'))['from'](_0x5497('0x79'))['where'](_0x5497('0x82'),_0x2737a2[_0x5497('0x47')]['id'][_0x5497('0x75')]()))[_0x5497('0x39')](_0x5497('0x77'),squel[_0x5497('0x78')]()[_0x5497('0x6a')](_0x5497('0x7a'))[_0x5497('0x70')](_0x5497('0x71'))['where'](_0x5497('0x82'),_0x2737a2['params']['id'][_0x5497('0x75')]())[_0x5497('0x39')]('state\x20=\x204'))[_0x5497('0x7c')](_0x5497('0x66')))[_0x5497('0x75')]();return db[_0x5497('0x4e')][_0x5497('0x2d')](_0x4118ec);}return[];})[_0x5497('0x23')](respondWithResult(_0x307dc5,null))[_0x5497('0x45')](handleError(_0x307dc5,null));};exports[_0x5497('0x83')]=function(_0x456ea4,_0x188fc1,_0x208a62){return db[_0x5497('0x84')][_0x5497('0x85')]({'where':{'VoiceQueueId':_0x456ea4[_0x5497('0x4b')]['VoiceQueueId'],'CampaignId':_0x456ea4[_0x5497('0x4b')][_0x5497('0x7f')],'ContactId':_0x456ea4[_0x5497('0x4b')][_0x5497('0x66')]}})[_0x5497('0x23')](handleEntityNotFound(_0x188fc1,null))['then'](function(_0x3e8fce){if(_0x3e8fce){return _0x3e8fce;}return null;})[_0x5497('0x23')](respondWithResult(_0x188fc1,null))['catch'](handleError(_0x188fc1,null));}; \ No newline at end of file +var _0xa5d7=['keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','length','include','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','createdAt','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query'];(function(_0xaeb2ce,_0x58d408){var _0x373618=function(_0x21bf8d){while(--_0x21bf8d){_0xaeb2ce['push'](_0xaeb2ce['shift']());}};_0x373618(++_0x58d408);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x252cf9,_0x5221f9){_0x252cf9=_0x252cf9-0x0;var _0x1eb966=_0xa5d7[_0x252cf9];return _0x1eb966;};'use strict';var pdf=require(_0x7a5d('0x0'));var emlformat=require(_0x7a5d('0x1'));var rimraf=require(_0x7a5d('0x2'));var zipdir=require(_0x7a5d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a5d('0x4'));var moment=require('moment');var BPromise=require(_0x7a5d('0x5'));var Mustache=require('mustache');var util=require(_0x7a5d('0x6'));var path=require('path');var sox=require(_0x7a5d('0x7'));var csv=require(_0x7a5d('0x8'));var ejs=require(_0x7a5d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7a5d('0xa'));var crypto=require(_0x7a5d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7a5d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7a5d('0xd'));var Papa=require(_0x7a5d('0xe'));var Redis=require(_0x7a5d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a5d('0x10'));var as=require(_0x7a5d('0x11'));var hardwareService=require(_0x7a5d('0x12'));var logger=require(_0x7a5d('0x13'))(_0x7a5d('0x14'));var utils=require(_0x7a5d('0x15'));var config=require(_0x7a5d('0x16'));var db=require(_0x7a5d('0x17'))['db'];function respondWithStatusCode(_0x196db3,_0xc4d232){_0xc4d232=_0xc4d232||0xcc;return function(_0x3a3344){if(_0x3a3344){return _0x196db3[_0x7a5d('0x18')](_0xc4d232);}return _0x196db3['status'](_0xc4d232)['end']();};}function respondWithResult(_0x34d400,_0x5335f6){_0x5335f6=_0x5335f6||0xc8;return function(_0x1e6179){if(_0x1e6179){return _0x34d400[_0x7a5d('0x19')](_0x5335f6)[_0x7a5d('0x1a')](_0x1e6179);}};}function respondWithFilteredResult(_0x1650c7,_0xd9d560){return function(_0x342f63){if(_0x342f63){var _0x50070a=_0x342f63[_0x7a5d('0x1b')],_0x35c72e=_0xd9d560[_0x7a5d('0x1c')],_0x288ffa=_0xd9d560['offset']+_0xd9d560[_0x7a5d('0x1d')],_0xaca430;if(_0x288ffa>=_0x50070a){_0x288ffa=_0x50070a;_0xaca430=0xc8;}else{_0xaca430=0xce;}_0x1650c7[_0x7a5d('0x19')](_0xaca430);return _0x1650c7['set']('Content-Range',_0x35c72e+'-'+_0x288ffa+'/'+_0x50070a)[_0x7a5d('0x1a')](_0x342f63);}return null;};}function patchUpdates(_0x4229f6){return function(_0x55fac7){try{jsonpatch[_0x7a5d('0x1e')](_0x55fac7,_0x4229f6,!![]);}catch(_0x4a02f2){return BPromise[_0x7a5d('0x1f')](_0x4a02f2);}return _0x55fac7['save']();};}function saveUpdates(_0x436bef,_0x334d3d){return function(_0x5bedc5){if(_0x5bedc5){return _0x5bedc5[_0x7a5d('0x20')](_0x436bef)['then'](function(_0x3ed941){return _0x3ed941;});}return null;};}function removeEntity(_0x58a09b,_0x56183a){return function(_0x1a0282){if(_0x1a0282){return _0x1a0282[_0x7a5d('0x21')]()[_0x7a5d('0x22')](function(){_0x58a09b['status'](0xcc)[_0x7a5d('0x23')]();});}};}function handleEntityNotFound(_0x45377a,_0x1bd069){return function(_0x4d1af5){if(!_0x4d1af5){_0x45377a[_0x7a5d('0x18')](0x194);}return _0x4d1af5;};}function handleError(_0x512831,_0x476cd2){_0x476cd2=_0x476cd2||0x1f4;return function(_0x393069){logger[_0x7a5d('0x24')](_0x393069[_0x7a5d('0x25')]);if(_0x393069[_0x7a5d('0x26')]){delete _0x393069[_0x7a5d('0x26')];}_0x512831['status'](_0x476cd2)[_0x7a5d('0x27')](_0x393069);};}exports[_0x7a5d('0x28')]=function(_0x4bd5fd,_0x1c33f5){var _0x431fe9={},_0x2b1f0b={},_0x72bedd={'count':0x0,'rows':[]};var _0x5c89c8=_[_0x7a5d('0x29')](db[_0x7a5d('0x2a')][_0x7a5d('0x2b')],function(_0x2931ef){return{'name':_0x2931ef[_0x7a5d('0x2c')],'type':_0x2931ef[_0x7a5d('0x2d')][_0x7a5d('0x2e')]};});_0x2b1f0b[_0x7a5d('0x2f')]=_['map'](_0x5c89c8,_0x7a5d('0x26'));_0x2b1f0b[_0x7a5d('0x30')]=_[_0x7a5d('0x31')](_0x4bd5fd[_0x7a5d('0x30')]);_0x2b1f0b[_0x7a5d('0x32')]=_[_0x7a5d('0x33')](_0x2b1f0b[_0x7a5d('0x2f')],_0x2b1f0b[_0x7a5d('0x30')]);_0x431fe9[_0x7a5d('0x34')]=_[_0x7a5d('0x33')](_0x2b1f0b[_0x7a5d('0x2f')],qs[_0x7a5d('0x35')](_0x4bd5fd[_0x7a5d('0x30')][_0x7a5d('0x35')]));_0x431fe9['attributes']=_0x431fe9[_0x7a5d('0x34')]['length']?_0x431fe9[_0x7a5d('0x34')]:_0x2b1f0b[_0x7a5d('0x2f')];if(!_0x4bd5fd[_0x7a5d('0x30')]['hasOwnProperty'](_0x7a5d('0x36'))){_0x431fe9[_0x7a5d('0x1d')]=qs[_0x7a5d('0x1d')](_0x4bd5fd[_0x7a5d('0x30')]['limit']);_0x431fe9[_0x7a5d('0x1c')]=qs[_0x7a5d('0x1c')](_0x4bd5fd[_0x7a5d('0x30')][_0x7a5d('0x1c')]);}_0x431fe9[_0x7a5d('0x37')]=qs[_0x7a5d('0x38')](_0x4bd5fd['query'][_0x7a5d('0x38')]);_0x431fe9[_0x7a5d('0x39')]=qs[_0x7a5d('0x32')](_['pick'](_0x4bd5fd[_0x7a5d('0x30')],_0x2b1f0b[_0x7a5d('0x32')]),_0x5c89c8);if(_0x4bd5fd[_0x7a5d('0x30')][_0x7a5d('0x3a')]){_0x431fe9[_0x7a5d('0x39')]=_[_0x7a5d('0x3b')](_0x431fe9[_0x7a5d('0x39')],{'$or':_[_0x7a5d('0x29')](_0x5c89c8,function(_0x356840){if(_0x356840[_0x7a5d('0x2d')]!==_0x7a5d('0x3c')){var _0x20d5f4={};_0x20d5f4[_0x356840[_0x7a5d('0x26')]]={'$like':'%'+_0x4bd5fd[_0x7a5d('0x30')]['filter']+'%'};return _0x20d5f4;}})});}_0x431fe9=_[_0x7a5d('0x3b')]({},_0x431fe9,_0x4bd5fd[_0x7a5d('0x3d')]);var _0x24c8e1={'where':_0x431fe9[_0x7a5d('0x39')]};return db[_0x7a5d('0x2a')][_0x7a5d('0x1b')](_0x24c8e1)[_0x7a5d('0x22')](function(_0x143156){_0x72bedd[_0x7a5d('0x1b')]=_0x143156;if(_0x4bd5fd['query'][_0x7a5d('0x3e')]){_0x431fe9['include']=[{'all':!![]}];}return db[_0x7a5d('0x2a')]['findAll'](_0x431fe9);})[_0x7a5d('0x22')](function(_0x1c54eb){_0x72bedd[_0x7a5d('0x3f')]=_0x1c54eb;return _0x72bedd;})['then'](respondWithFilteredResult(_0x1c33f5,_0x431fe9))[_0x7a5d('0x40')](handleError(_0x1c33f5,null));};exports['show']=function(_0x5b669f,_0x12adbf){var _0x824f98={'raw':!![],'where':{'id':_0x5b669f[_0x7a5d('0x41')]['id']}},_0x563d2a={};_0x563d2a[_0x7a5d('0x2f')]=_[_0x7a5d('0x31')](db['CmHopperFinal'][_0x7a5d('0x2b')]);_0x563d2a[_0x7a5d('0x30')]=_['keys'](_0x5b669f[_0x7a5d('0x30')]);_0x563d2a[_0x7a5d('0x32')]=_[_0x7a5d('0x33')](_0x563d2a[_0x7a5d('0x2f')],_0x563d2a[_0x7a5d('0x30')]);_0x824f98[_0x7a5d('0x34')]=_[_0x7a5d('0x33')](_0x563d2a['model'],qs[_0x7a5d('0x35')](_0x5b669f[_0x7a5d('0x30')][_0x7a5d('0x35')]));_0x824f98[_0x7a5d('0x34')]=_0x824f98[_0x7a5d('0x34')][_0x7a5d('0x42')]?_0x824f98[_0x7a5d('0x34')]:_0x563d2a[_0x7a5d('0x2f')];if(_0x5b669f[_0x7a5d('0x30')]['includeAll']){_0x824f98[_0x7a5d('0x43')]=[{'all':!![]}];}_0x824f98=_[_0x7a5d('0x3b')]({},_0x824f98,_0x5b669f[_0x7a5d('0x3d')]);return db[_0x7a5d('0x2a')][_0x7a5d('0x44')](_0x824f98)[_0x7a5d('0x22')](handleEntityNotFound(_0x12adbf,null))['then'](respondWithResult(_0x12adbf,null))[_0x7a5d('0x40')](handleError(_0x12adbf,null));};exports[_0x7a5d('0x45')]=function(_0x28ca5f,_0x5231ef){return db[_0x7a5d('0x2a')][_0x7a5d('0x45')]()['then'](respondWithResult(_0x5231ef,null))[_0x7a5d('0x40')](handleError(_0x5231ef,null));};exports[_0x7a5d('0x20')]=function(_0x496193,_0x4584bc){if(_0x496193['body'][_0x7a5d('0x46')]){delete _0x496193[_0x7a5d('0x47')]['uniqueid'];}return db[_0x7a5d('0x2a')]['find']({'where':{'uniqueid':_0x496193[_0x7a5d('0x41')]['id']}})[_0x7a5d('0x22')](handleEntityNotFound(_0x4584bc,null))[_0x7a5d('0x22')](saveUpdates(_0x496193[_0x7a5d('0x47')],null))[_0x7a5d('0x22')](respondWithResult(_0x4584bc,null))[_0x7a5d('0x40')](handleError(_0x4584bc,null));};exports[_0x7a5d('0x48')]=function(_0x2da745,_0x5af327,_0x260b01){return db[_0x7a5d('0x2a')][_0x7a5d('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x2da745[_0x7a5d('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')][_0x7a5d('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x7a5d('0x4d')],[db['sequelize']['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7a5d('0x4e')))),_0x7a5d('0x4f')],[db[_0x7a5d('0x4b')]['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db['sequelize'][_0x7a5d('0x4c')](_0x7a5d('0x50')))),_0x7a5d('0x51')],[db[_0x7a5d('0x4b')]['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')][_0x7a5d('0x4c')](_0x7a5d('0x52')))),_0x7a5d('0x53')],[db['sequelize']['fn']('COUNT',db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')]['literal'](_0x7a5d('0x54')))),_0x7a5d('0x55')],[db[_0x7a5d('0x4b')]['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')]['literal'](_0x7a5d('0x56')))),_0x7a5d('0x57')],[db['sequelize']['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db['sequelize'][_0x7a5d('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')]['literal'](_0x7a5d('0x58')))),_0x7a5d('0x59')]]})[_0x7a5d('0x22')](handleEntityNotFound(_0x5af327,null))[_0x7a5d('0x22')](respondWithResult(_0x5af327,null))['catch'](handleError(_0x5af327,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x57fcf3,_0x272704,_0x246148){return db[_0x7a5d('0x2a')][_0x7a5d('0x49')]({'raw':![],'where':{'CampaignId':_0x57fcf3[_0x7a5d('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')][_0x7a5d('0x4c')](_0x7a5d('0x5a')))),'noSuchContacts'],[db[_0x7a5d('0x4b')]['fn']('COUNT',db[_0x7a5d('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7a5d('0x4e')))),_0x7a5d('0x4f')],[db[_0x7a5d('0x4b')]['fn'](_0x7a5d('0x4a'),db['sequelize']['fn']('IF',db[_0x7a5d('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x7a5d('0x51')],[db[_0x7a5d('0x4b')]['fn']('COUNT',db[_0x7a5d('0x4b')]['fn']('IF',db['sequelize'][_0x7a5d('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x7a5d('0x4a'),db['sequelize']['fn']('IF',db[_0x7a5d('0x4b')][_0x7a5d('0x4c')](_0x7a5d('0x54')))),'dropContacts'],[db[_0x7a5d('0x4b')]['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')]['literal'](_0x7a5d('0x56')))),_0x7a5d('0x57')],[db[_0x7a5d('0x4b')]['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')][_0x7a5d('0x4c')](_0x7a5d('0x5b')))),_0x7a5d('0x5c')],[db[_0x7a5d('0x4b')]['fn'](_0x7a5d('0x4a'),db[_0x7a5d('0x4b')]['fn']('IF',db[_0x7a5d('0x4b')][_0x7a5d('0x4c')](_0x7a5d('0x58')))),_0x7a5d('0x59')]]})[_0x7a5d('0x22')](handleEntityNotFound(_0x272704,null))[_0x7a5d('0x22')](respondWithResult(_0x272704,null))[_0x7a5d('0x40')](handleError(_0x272704,null));};exports[_0x7a5d('0x5d')]=function(_0x59f50d,_0x3ecece,_0x26c3e2){return db['VoiceQueue'][_0x7a5d('0x44')]({'where':{'id':_0x59f50d[_0x7a5d('0x41')]['id']}})[_0x7a5d('0x22')](handleEntityNotFound(_0x3ecece,null))[_0x7a5d('0x22')](function(_0x21a28c){var _0x388273;if(_0x21a28c){_0x388273=squel[_0x7a5d('0x5e')]()['into'](_0x7a5d('0x5f'))[_0x7a5d('0x60')]([_0x7a5d('0x61'),_0x7a5d('0x62'),_0x7a5d('0x63'),_0x7a5d('0x64'),_0x7a5d('0x65'),'createdAt','updatedAt'],squel[_0x7a5d('0x66')]()[_0x7a5d('0x67')](_0x7a5d('0x68'),_0x7a5d('0x61'))['field'](_0x7a5d('0x69'),'scheduledAt')['field'](_0x7a5d('0x6a'),_0x7a5d('0x63'))['field'](_0x7a5d('0x6b'),'ListId')[_0x7a5d('0x67')](_0x7a5d('0x6c'),_0x7a5d('0x65'))[_0x7a5d('0x67')](_0x7a5d('0x69'),'createdAt')['field'](_0x7a5d('0x69'),'updatedAt')[_0x7a5d('0x6d')](_0x7a5d('0x6e'))['where'](_0x7a5d('0x6f'),_0x59f50d[_0x7a5d('0x41')]['id'][_0x7a5d('0x70')]())['where']('state\x20=\x20?',_0x59f50d['body']['state'][_0x7a5d('0x70')]())[_0x7a5d('0x39')](_0x7a5d('0x71'))['where'](_0x7a5d('0x72'),squel[_0x7a5d('0x66')]()[_0x7a5d('0x67')](_0x7a5d('0x61'))[_0x7a5d('0x6d')]('cm_hopper')[_0x7a5d('0x39')](_0x7a5d('0x6f'),_0x59f50d[_0x7a5d('0x41')]['id'][_0x7a5d('0x70')]()))[_0x7a5d('0x39')](_0x7a5d('0x72'),squel['select']()[_0x7a5d('0x67')]('calleridnum')['from'](_0x7a5d('0x6e'))[_0x7a5d('0x39')](_0x7a5d('0x6f'),_0x59f50d['params']['id'][_0x7a5d('0x70')]())[_0x7a5d('0x39')]('state\x20=\x204'))[_0x7a5d('0x73')](_0x7a5d('0x63')))['toString']();return db['sequelize'][_0x7a5d('0x30')](_0x388273);}return[];})[_0x7a5d('0x22')](respondWithResult(_0x3ecece,null))[_0x7a5d('0x40')](handleError(_0x3ecece,null));};exports[_0x7a5d('0x74')]=function(_0x549454,_0x53324b,_0x11fb74){return db['Campaign'][_0x7a5d('0x44')]({'where':{'id':_0x549454['params']['id']}})['then'](handleEntityNotFound(_0x53324b,null))[_0x7a5d('0x22')](function(_0x5ee489){var _0x879b0c;if(_0x5ee489){_0x879b0c=squel['insert']()['into'](_0x7a5d('0x5f'))[_0x7a5d('0x60')]([_0x7a5d('0x61'),'scheduledAt','ContactId','ListId','CampaignId',_0x7a5d('0x75'),_0x7a5d('0x76')],squel[_0x7a5d('0x66')]()[_0x7a5d('0x67')](_0x7a5d('0x68'),'phone')[_0x7a5d('0x67')]('NOW()',_0x7a5d('0x62'))['field'](_0x7a5d('0x6a'),_0x7a5d('0x63'))[_0x7a5d('0x67')]('ANY_VALUE(ListId)','ListId')['field'](_0x7a5d('0x77'),'CampaignId')[_0x7a5d('0x67')](_0x7a5d('0x69'),_0x7a5d('0x75'))[_0x7a5d('0x67')](_0x7a5d('0x69'),_0x7a5d('0x76'))[_0x7a5d('0x6d')](_0x7a5d('0x6e'))[_0x7a5d('0x39')](_0x7a5d('0x78'),_0x549454['params']['id']['toString']())[_0x7a5d('0x39')]('state\x20=\x20?',_0x549454[_0x7a5d('0x47')]['state'][_0x7a5d('0x70')]())['where'](_0x7a5d('0x71'))[_0x7a5d('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7a5d('0x66')]()[_0x7a5d('0x67')](_0x7a5d('0x61'))[_0x7a5d('0x6d')]('cm_hopper')[_0x7a5d('0x39')]('CampaignId\x20=\x20?',_0x549454['params']['id']['toString']()))[_0x7a5d('0x39')](_0x7a5d('0x72'),squel[_0x7a5d('0x66')]()['field'](_0x7a5d('0x79'))[_0x7a5d('0x6d')](_0x7a5d('0x6e'))['where'](_0x7a5d('0x78'),_0x549454[_0x7a5d('0x41')]['id']['toString']())[_0x7a5d('0x39')]('state\x20=\x204'))['group'](_0x7a5d('0x63')))['toString']();return db['sequelize'][_0x7a5d('0x30')](_0x879b0c);}return[];})['then'](respondWithResult(_0x53324b,null))[_0x7a5d('0x40')](handleError(_0x53324b,null));};exports[_0x7a5d('0x7a')]=function(_0x2b3fe2,_0x5e4fa7,_0x1efcc2){return db[_0x7a5d('0x7b')][_0x7a5d('0x7c')]({'where':{'VoiceQueueId':_0x2b3fe2[_0x7a5d('0x47')][_0x7a5d('0x65')],'CampaignId':_0x2b3fe2['body']['CampaignId'],'ContactId':_0x2b3fe2[_0x7a5d('0x47')]['ContactId']}})['then'](handleEntityNotFound(_0x5e4fa7,null))[_0x7a5d('0x22')](function(_0x5cc344){if(_0x5cc344){return _0x5cc344;}return null;})[_0x7a5d('0x22')](respondWithResult(_0x5e4fa7,null))['catch'](handleError(_0x5e4fa7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2bb9d2f..b9df721 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 _0xdecb=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0xdecb,0xe2));var _0xbdec=function(_0x50eb13,_0x1cf5cf){_0x50eb13=_0x50eb13-0x0;var _0xbf3841=_0xdecb[_0x50eb13];return _0xbf3841;};'use strict';var _=require('lodash');var util=require(_0xbdec('0x0'));var logger=require(_0xbdec('0x1'))(_0xbdec('0x2'));var moment=require('moment');var BPromise=require(_0xbdec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdec('0x4'));var rimraf=require(_0xbdec('0x5'));var config=require(_0xbdec('0x6'));var attributes=require(_0xbdec('0x7'));module[_0xbdec('0x8')]=function(_0x26fef3,_0x13d9f8){return _0x26fef3['define'](_0xbdec('0x9'),attributes,{'tableName':_0xbdec('0xa'),'paranoid':![],'indexes':[{'name':_0xbdec('0xb'),'fields':[_0xbdec('0xb')]},{'name':_0xbdec('0xc'),'fields':[_0xbdec('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d4a=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x48cd72,_0x1f32e1){var _0x5832b7=function(_0x5f0f80){while(--_0x5f0f80){_0x48cd72['push'](_0x48cd72['shift']());}};_0x5832b7(++_0x1f32e1);}(_0x6d4a,0x117));var _0xa6d4=function(_0x1a45ae,_0x9b429f){_0x1a45ae=_0x1a45ae-0x0;var _0x5162c0=_0x6d4a[_0x1a45ae];return _0x5162c0;};'use strict';var _=require(_0xa6d4('0x0'));var util=require('util');var logger=require(_0xa6d4('0x1'))(_0xa6d4('0x2'));var moment=require(_0xa6d4('0x3'));var BPromise=require(_0xa6d4('0x4'));var rp=require(_0xa6d4('0x5'));var fs=require('fs');var path=require(_0xa6d4('0x6'));var rimraf=require(_0xa6d4('0x7'));var config=require(_0xa6d4('0x8'));var attributes=require(_0xa6d4('0x9'));module[_0xa6d4('0xa')]=function(_0x25a720,_0xe6dda6){return _0x25a720[_0xa6d4('0xb')](_0xa6d4('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xa6d4('0xd'),'fields':[_0xa6d4('0xd')]},{'name':'uniqueid','fields':[_0xa6d4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e5b67fe..a21e302 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 _0x42ff=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','CreateCmHopperFinal','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5839d3,_0xe54d19){var _0x2367a1=function(_0x1e8292){while(--_0x1e8292){_0x5839d3['push'](_0x5839d3['shift']());}};_0x2367a1(++_0xe54d19);}(_0x42ff,0xa8));var _0xf42f=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x42ff[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xf42f('0x0'));var util=require(_0xf42f('0x1'));var moment=require(_0xf42f('0x2'));var BPromise=require(_0xf42f('0x3'));var rs=require(_0xf42f('0x4'));var fs=require('fs');var Redis=require(_0xf42f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf42f('0x6'));var logger=require(_0xf42f('0x7'))('rpc');var config=require(_0xf42f('0x8'));var jayson=require(_0xf42f('0x9'));var client=jayson[_0xf42f('0xa')][_0xf42f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da6b6,_0x475fc8,_0x3ce2db){return new BPromise(function(_0x144a3c,_0x2272ef){return client[_0xf42f('0xc')](_0x2da6b6,_0x3ce2db)[_0xf42f('0xd')](function(_0x3c8c72){logger[_0xf42f('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x475fc8,_0xf42f('0xf'));logger[_0xf42f('0x10')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x475fc8,_0xf42f('0xf'),JSON[_0xf42f('0x11')](_0x3c8c72));if(_0x3c8c72['error']){if(_0x3c8c72[_0xf42f('0x12')][_0xf42f('0x13')]===0x1f4){logger[_0xf42f('0x12')](_0xf42f('0x14'),_0x475fc8,_0x3c8c72[_0xf42f('0x12')][_0xf42f('0x15')]);return _0x2272ef(_0x3c8c72[_0xf42f('0x12')][_0xf42f('0x15')]);}logger[_0xf42f('0x12')](_0xf42f('0x14'),_0x475fc8,_0x3c8c72[_0xf42f('0x12')][_0xf42f('0x15')]);return _0x144a3c(_0x3c8c72[_0xf42f('0x12')]['message']);}else{logger[_0xf42f('0xe')](_0xf42f('0x14'),_0x475fc8,_0xf42f('0xf'));_0x144a3c(_0x3c8c72[_0xf42f('0x16')][_0xf42f('0x15')]);}})['catch'](function(_0x13d2c9){logger[_0xf42f('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x475fc8,_0x13d2c9);_0x2272ef(_0x13d2c9);});});}exports[_0xf42f('0x17')]=function(_0x2bb276){var _0x11bb8a=this;return new Promise(function(_0x2a9daa,_0x41a0b4){return db['CmHopperFinal'][_0xf42f('0x18')](_0x2bb276[_0xf42f('0x19')],{'raw':_0x2bb276[_0xf42f('0x1a')]?_0x2bb276[_0xf42f('0x1a')][_0xf42f('0x1b')]===undefined?!![]:![]:!![]})[_0xf42f('0xd')](function(_0x1d809b){logger[_0xf42f('0xe')](_0xf42f('0x17'),_0x2bb276);logger[_0xf42f('0x10')](_0xf42f('0x17'),_0x2bb276,JSON[_0xf42f('0x11')](_0x1d809b));_0x2a9daa(_0x1d809b);})[_0xf42f('0x1c')](function(_0x3a003a){logger[_0xf42f('0x12')](_0xf42f('0x17'),_0x3a003a[_0xf42f('0x15')],_0x2bb276);_0x41a0b4(_0x11bb8a['error'](0x1f4,_0x3a003a[_0xf42f('0x15')]));});});}; \ No newline at end of file +var _0xd2af=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperFinal','create','body','options','raw','stringify','lodash'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd2af,0x185));var _0xfd2a=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0xd2af[_0x1d8119];return _0x3e30f6;};'use strict';var _=require(_0xfd2a('0x0'));var util=require(_0xfd2a('0x1'));var moment=require(_0xfd2a('0x2'));var BPromise=require(_0xfd2a('0x3'));var rs=require(_0xfd2a('0x4'));var fs=require('fs');var Redis=require(_0xfd2a('0x5'));var db=require(_0xfd2a('0x6'))['db'];var utils=require(_0xfd2a('0x7'));var logger=require(_0xfd2a('0x8'))('rpc');var config=require(_0xfd2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfd2a('0xa')][_0xfd2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x587018,_0x5e3cad,_0x39c4f9){return new BPromise(function(_0x216ef4,_0x2cbbe3){return client[_0xfd2a('0xc')](_0x587018,_0x39c4f9)[_0xfd2a('0xd')](function(_0x226807){logger[_0xfd2a('0xe')](_0xfd2a('0xf'),_0x5e3cad,_0xfd2a('0x10'));logger[_0xfd2a('0x11')](_0xfd2a('0x12'),_0x5e3cad,_0xfd2a('0x10'),JSON['stringify'](_0x226807));if(_0x226807['error']){if(_0x226807[_0xfd2a('0x13')][_0xfd2a('0x14')]===0x1f4){logger[_0xfd2a('0x13')](_0xfd2a('0xf'),_0x5e3cad,_0x226807[_0xfd2a('0x13')][_0xfd2a('0x15')]);return _0x2cbbe3(_0x226807['error'][_0xfd2a('0x15')]);}logger['error'](_0xfd2a('0xf'),_0x5e3cad,_0x226807['error'][_0xfd2a('0x15')]);return _0x216ef4(_0x226807[_0xfd2a('0x13')]['message']);}else{logger[_0xfd2a('0xe')](_0xfd2a('0xf'),_0x5e3cad,_0xfd2a('0x10'));_0x216ef4(_0x226807[_0xfd2a('0x16')][_0xfd2a('0x15')]);}})[_0xfd2a('0x17')](function(_0x4ed743){logger[_0xfd2a('0x13')](_0xfd2a('0xf'),_0x5e3cad,_0x4ed743);_0x2cbbe3(_0x4ed743);});});}exports[_0xfd2a('0x18')]=function(_0x324dba){var _0x480dbc=this;return new Promise(function(_0x342e0f,_0x4bcbc6){return db['CmHopperFinal'][_0xfd2a('0x19')](_0x324dba[_0xfd2a('0x1a')],{'raw':_0x324dba[_0xfd2a('0x1b')]?_0x324dba[_0xfd2a('0x1b')][_0xfd2a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x20bbb3){logger[_0xfd2a('0xe')]('CreateCmHopperFinal',_0x324dba);logger['debug'](_0xfd2a('0x18'),_0x324dba,JSON[_0xfd2a('0x1d')](_0x20bbb3));_0x342e0f(_0x20bbb3);})[_0xfd2a('0x17')](function(_0x5554ca){logger[_0xfd2a('0x13')]('CreateCmHopperFinal',_0x5554ca['message'],_0x324dba);_0x4bcbc6(_0x480dbc[_0xfd2a('0x13')](0x1f4,_0x5554ca[_0xfd2a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 2ebc2e2..02dfb4c 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 _0x91c7=['/describe','describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x2c41ea,_0x4ca7d5){var _0x189eef=function(_0x5785f8){while(--_0x5785f8){_0x2c41ea['push'](_0x2c41ea['shift']());}};_0x189eef(++_0x4ca7d5);}(_0x91c7,0x8c));var _0x791c=function(_0x4ffafb,_0x20171a){_0x4ffafb=_0x4ffafb-0x0;var _0x4ab472=_0x91c7[_0x4ffafb];return _0x4ab472;};'use strict';var multer=require(_0x791c('0x0'));var util=require(_0x791c('0x1'));var path=require(_0x791c('0x2'));var timeout=require(_0x791c('0x3'));var express=require(_0x791c('0x4'));var router=express[_0x791c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x791c('0x6'));var config=require(_0x791c('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x791c('0x8')](),controller[_0x791c('0x9')]);router['get'](_0x791c('0xa'),auth[_0x791c('0x8')](),controller[_0x791c('0xb')]);router[_0x791c('0xc')](_0x791c('0xd'),auth[_0x791c('0x8')](),controller[_0x791c('0xe')]);router['get'](_0x791c('0xf'),auth['isAuthenticated'](),controller[_0x791c('0x10')]);router[_0x791c('0xc')](_0x791c('0x11'),auth[_0x791c('0x8')](),controller[_0x791c('0x12')]);router[_0x791c('0x13')](_0x791c('0x14'),auth[_0x791c('0x8')](),controller[_0x791c('0x15')]);router[_0x791c('0x13')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0x791c('0x16')]);router[_0x791c('0x13')]('/checkContactHopper',auth[_0x791c('0x8')](),controller[_0x791c('0x17')]);router['put'](_0x791c('0xd'),auth[_0x791c('0x8')](),controller[_0x791c('0x18')]);module['exports']=router; \ No newline at end of file +var _0x00b7=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/:id','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','express','Router'];(function(_0x3c46fc,_0x54d0e9){var _0x36a6e1=function(_0x44cafb){while(--_0x44cafb){_0x3c46fc['push'](_0x3c46fc['shift']());}};_0x36a6e1(++_0x54d0e9);}(_0x00b7,0x10e));var _0x700b=function(_0x170831,_0x510b7b){_0x170831=_0x170831-0x0;var _0x50ec6e=_0x00b7[_0x170831];return _0x50ec6e;};'use strict';var multer=require(_0x700b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x700b('0x1'));var router=express[_0x700b('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x700b('0x3'));var config=require(_0x700b('0x4'));var controller=require(_0x700b('0x5'));router[_0x700b('0x6')]('/',auth[_0x700b('0x7')](),controller[_0x700b('0x8')]);router[_0x700b('0x6')]('/describe',auth[_0x700b('0x7')](),controller['describe']);router[_0x700b('0x6')](_0x700b('0x9'),auth[_0x700b('0x7')](),controller['show']);router[_0x700b('0x6')](_0x700b('0xa'),auth[_0x700b('0x7')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x700b('0x6')](_0x700b('0xb'),auth[_0x700b('0x7')](),controller[_0x700b('0xc')]);router[_0x700b('0xd')](_0x700b('0xe'),auth[_0x700b('0x7')](),controller[_0x700b('0xf')]);router[_0x700b('0xd')](_0x700b('0x10'),auth['isAuthenticated'](),controller[_0x700b('0x11')]);router[_0x700b('0xd')](_0x700b('0x12'),auth[_0x700b('0x7')](),controller['checkContactHopper']);router[_0x700b('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x700b('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b687e32..d880e92 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 _0x255b=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x4eaa77,_0x371433){var _0x380200=function(_0x2dc489){while(--_0x2dc489){_0x4eaa77['push'](_0x4eaa77['shift']());}};_0x380200(++_0x371433);}(_0x255b,0x17d));var _0xb255=function(_0x5738c4,_0xbfdf99){_0x5738c4=_0x5738c4-0x0;var _0x15830b=_0x255b[_0x5738c4];return _0x15830b;};'use strict';var Sequelize=require(_0xb255('0x0'));module[_0xb255('0x1')]={'state':{'type':Sequelize[_0xb255('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb255('0x3')]},'scheduledat':{'type':Sequelize[_0xb255('0x4')]},'countbusyretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb255('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb255('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb255('0x4')]},'responsetime':{'type':Sequelize[_0xb255('0x4')]},'answertime':{'type':Sequelize[_0xb255('0x4')]},'droptime':{'type':Sequelize[_0xb255('0x4')]},'endtime':{'type':Sequelize[_0xb255('0x4')]},'ringtime':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb255('0x3')]},'campaigntype':{'type':Sequelize[_0xb255('0x3')]},'membername':{'type':Sequelize[_0xb255('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xb255('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb255('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb255('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb255('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb255('0x4')]},'recallme':{'type':Sequelize[_0xb255('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb255('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb255('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb255('0x3')]}}; \ No newline at end of file +var _0xde4d=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x14ee69,_0x436a8a){var _0x4d5664=function(_0x3e69bc){while(--_0x3e69bc){_0x14ee69['push'](_0x14ee69['shift']());}};_0x4d5664(++_0x436a8a);}(_0xde4d,0xe7));var _0xdde4=function(_0x20e74a,_0x12523e){_0x20e74a=_0x20e74a-0x0;var _0x358679=_0xde4d[_0x20e74a];return _0x358679;};'use strict';var Sequelize=require(_0xdde4('0x0'));module[_0xdde4('0x1')]={'state':{'type':Sequelize[_0xdde4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdde4('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdde4('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdde4('0x3')]},'starttime':{'type':Sequelize[_0xdde4('0x4')]},'responsetime':{'type':Sequelize[_0xdde4('0x4')]},'answertime':{'type':Sequelize[_0xdde4('0x4')]},'droptime':{'type':Sequelize[_0xdde4('0x4')]},'endtime':{'type':Sequelize[_0xdde4('0x4')]},'ringtime':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdde4('0x3')]},'campaign':{'type':Sequelize[_0xdde4('0x3')]},'campaigntype':{'type':Sequelize[_0xdde4('0x3')]},'membername':{'type':Sequelize[_0xdde4('0x3')]},'reason':{'type':Sequelize[_0xdde4('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xdde4('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xdde4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdde4('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xdde4('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdde4('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdde4('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 620b691..aebc425 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 _0x5640=['query','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','uniqueid','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model'];(function(_0x2b60bd,_0x49418d){var _0x3d9523=function(_0x460f6b){while(--_0x460f6b){_0x2b60bd['push'](_0x2b60bd['shift']());}};_0x3d9523(++_0x49418d);}(_0x5640,0x159));var _0x0564=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5640[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x0564('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0564('0x1'));var zipdir=require(_0x0564('0x2'));var jsonpatch=require(_0x0564('0x3'));var rp=require('request-promise');var moment=require(_0x0564('0x4'));var BPromise=require(_0x0564('0x5'));var Mustache=require(_0x0564('0x6'));var util=require(_0x0564('0x7'));var path=require(_0x0564('0x8'));var sox=require(_0x0564('0x9'));var csv=require(_0x0564('0xa'));var ejs=require(_0x0564('0xb'));var fs=require('fs');var _=require(_0x0564('0xc'));var squel=require(_0x0564('0xd'));var crypto=require(_0x0564('0xe'));var jsforce=require(_0x0564('0xf'));var deskjs=require(_0x0564('0x10'));var toCsv=require(_0x0564('0xa'));var querystring=require(_0x0564('0x11'));var Papa=require(_0x0564('0x12'));var Redis=require(_0x0564('0x13'));var authService=require(_0x0564('0x14'));var qs=require(_0x0564('0x15'));var as=require(_0x0564('0x16'));var hardwareService=require(_0x0564('0x17'));var logger=require(_0x0564('0x18'))(_0x0564('0x19'));var utils=require(_0x0564('0x1a'));var config=require(_0x0564('0x1b'));var db=require(_0x0564('0x1c'))['db'];function respondWithStatusCode(_0x4dd282,_0x177659){_0x177659=_0x177659||0xcc;return function(_0x3191b6){if(_0x3191b6){return _0x4dd282['sendStatus'](_0x177659);}return _0x4dd282[_0x0564('0x1d')](_0x177659)[_0x0564('0x1e')]();};}function respondWithResult(_0x165045,_0x12c654){_0x12c654=_0x12c654||0xc8;return function(_0x3b9951){if(_0x3b9951){return _0x165045[_0x0564('0x1d')](_0x12c654)[_0x0564('0x1f')](_0x3b9951);}};}function respondWithFilteredResult(_0x57d0ff,_0x18d3e4){return function(_0x1b82a3){if(_0x1b82a3){var _0x17e221=_0x1b82a3[_0x0564('0x20')],_0x5396bd=_0x18d3e4[_0x0564('0x21')],_0x2db79a=_0x18d3e4[_0x0564('0x21')]+_0x18d3e4[_0x0564('0x22')],_0x1f09d8;if(_0x2db79a>=_0x17e221){_0x2db79a=_0x17e221;_0x1f09d8=0xc8;}else{_0x1f09d8=0xce;}_0x57d0ff[_0x0564('0x1d')](_0x1f09d8);return _0x57d0ff[_0x0564('0x23')](_0x0564('0x24'),_0x5396bd+'-'+_0x2db79a+'/'+_0x17e221)[_0x0564('0x1f')](_0x1b82a3);}return null;};}function patchUpdates(_0x5172bc){return function(_0x27555e){try{jsonpatch[_0x0564('0x25')](_0x27555e,_0x5172bc,!![]);}catch(_0xbddb2d){return BPromise[_0x0564('0x26')](_0xbddb2d);}return _0x27555e['save']();};}function saveUpdates(_0x42aa97,_0x58b0fd){return function(_0x4bef5b){if(_0x4bef5b){return _0x4bef5b[_0x0564('0x27')](_0x42aa97)[_0x0564('0x28')](function(_0x5aa162){return _0x5aa162;});}return null;};}function removeEntity(_0x5fbc5,_0x44a7e8){return function(_0x58a24d){if(_0x58a24d){return _0x58a24d[_0x0564('0x29')]()['then'](function(){_0x5fbc5[_0x0564('0x1d')](0xcc)[_0x0564('0x1e')]();});}};}function handleEntityNotFound(_0x254e12,_0x38caa3){return function(_0x20ac63){if(!_0x20ac63){_0x254e12[_0x0564('0x2a')](0x194);}return _0x20ac63;};}function handleError(_0x2886ec,_0x5a0710){_0x5a0710=_0x5a0710||0x1f4;return function(_0x2c2189){logger[_0x0564('0x2b')](_0x2c2189[_0x0564('0x2c')]);if(_0x2c2189[_0x0564('0x2d')]){delete _0x2c2189[_0x0564('0x2d')];}_0x2886ec[_0x0564('0x1d')](_0x5a0710)[_0x0564('0x2e')](_0x2c2189);};}exports[_0x0564('0x2f')]=function(_0x32e59c,_0x56949a){var _0x5a770e={},_0xc420e6={},_0x40da58={'count':0x0,'rows':[]};var _0x1c2620=_[_0x0564('0x30')](db[_0x0564('0x31')][_0x0564('0x32')],function(_0x2bc56f){return{'name':_0x2bc56f[_0x0564('0x33')],'type':_0x2bc56f[_0x0564('0x34')][_0x0564('0x35')]};});_0xc420e6[_0x0564('0x36')]=_['map'](_0x1c2620,'name');_0xc420e6[_0x0564('0x37')]=_['keys'](_0x32e59c['query']);_0xc420e6[_0x0564('0x38')]=_[_0x0564('0x39')](_0xc420e6['model'],_0xc420e6[_0x0564('0x37')]);_0x5a770e['attributes']=_[_0x0564('0x39')](_0xc420e6[_0x0564('0x36')],qs[_0x0564('0x3a')](_0x32e59c['query']['fields']));_0x5a770e['attributes']=_0x5a770e[_0x0564('0x3b')][_0x0564('0x3c')]?_0x5a770e['attributes']:_0xc420e6[_0x0564('0x36')];if(!_0x32e59c[_0x0564('0x37')]['hasOwnProperty']('nolimit')){_0x5a770e[_0x0564('0x22')]=qs['limit'](_0x32e59c[_0x0564('0x37')][_0x0564('0x22')]);_0x5a770e['offset']=qs[_0x0564('0x21')](_0x32e59c[_0x0564('0x37')][_0x0564('0x21')]);}_0x5a770e[_0x0564('0x3d')]=qs[_0x0564('0x3e')](_0x32e59c[_0x0564('0x37')][_0x0564('0x3e')]);_0x5a770e[_0x0564('0x3f')]=qs[_0x0564('0x38')](_['pick'](_0x32e59c[_0x0564('0x37')],_0xc420e6[_0x0564('0x38')]),_0x1c2620);if(_0x32e59c[_0x0564('0x37')][_0x0564('0x40')]){_0x5a770e[_0x0564('0x3f')]=_[_0x0564('0x41')](_0x5a770e[_0x0564('0x3f')],{'$or':_['map'](_0x1c2620,function(_0x277441){if(_0x277441[_0x0564('0x34')]!==_0x0564('0x42')){var _0x4e9a18={};_0x4e9a18[_0x277441[_0x0564('0x2d')]]={'$like':'%'+_0x32e59c[_0x0564('0x37')][_0x0564('0x40')]+'%'};return _0x4e9a18;}})});}_0x5a770e=_[_0x0564('0x41')]({},_0x5a770e,_0x32e59c[_0x0564('0x43')]);var _0xc5c263={'where':_0x5a770e[_0x0564('0x3f')]};return db['CmHopperHistory'][_0x0564('0x20')](_0xc5c263)['then'](function(_0x2b0fe5){_0x40da58['count']=_0x2b0fe5;if(_0x32e59c[_0x0564('0x37')][_0x0564('0x44')]){_0x5a770e[_0x0564('0x45')]=[{'all':!![]}];}return db[_0x0564('0x31')][_0x0564('0x46')](_0x5a770e);})[_0x0564('0x28')](function(_0x2314a2){_0x40da58[_0x0564('0x47')]=_0x2314a2;return _0x40da58;})[_0x0564('0x28')](respondWithFilteredResult(_0x56949a,_0x5a770e))[_0x0564('0x48')](handleError(_0x56949a,null));};exports[_0x0564('0x49')]=function(_0x15e544,_0x538237){var _0x31252a={'raw':!![],'where':{'id':_0x15e544[_0x0564('0x4a')]['id']}},_0x1e8437={};_0x1e8437[_0x0564('0x36')]=_[_0x0564('0x4b')](db['CmHopperHistory'][_0x0564('0x32')]);_0x1e8437[_0x0564('0x37')]=_[_0x0564('0x4b')](_0x15e544[_0x0564('0x37')]);_0x1e8437[_0x0564('0x38')]=_[_0x0564('0x39')](_0x1e8437[_0x0564('0x36')],_0x1e8437[_0x0564('0x37')]);_0x31252a[_0x0564('0x3b')]=_[_0x0564('0x39')](_0x1e8437[_0x0564('0x36')],qs[_0x0564('0x3a')](_0x15e544[_0x0564('0x37')][_0x0564('0x3a')]));_0x31252a[_0x0564('0x3b')]=_0x31252a[_0x0564('0x3b')]['length']?_0x31252a[_0x0564('0x3b')]:_0x1e8437[_0x0564('0x36')];if(_0x15e544[_0x0564('0x37')][_0x0564('0x44')]){_0x31252a['include']=[{'all':!![]}];}_0x31252a=_[_0x0564('0x41')]({},_0x31252a,_0x15e544[_0x0564('0x43')]);return db[_0x0564('0x31')]['find'](_0x31252a)[_0x0564('0x28')](handleEntityNotFound(_0x538237,null))['then'](respondWithResult(_0x538237,null))[_0x0564('0x48')](handleError(_0x538237,null));};exports[_0x0564('0x4c')]=function(_0x528925,_0xafc4f6){return db[_0x0564('0x31')][_0x0564('0x4c')](_0x528925[_0x0564('0x4d')],{})['then'](respondWithResult(_0xafc4f6,0xc9))[_0x0564('0x48')](handleError(_0xafc4f6,null));};exports['describe']=function(_0x89ccd7,_0x6aac3e){return db['CmHopperHistory']['describe']()[_0x0564('0x28')](respondWithResult(_0x6aac3e,null))[_0x0564('0x48')](handleError(_0x6aac3e,null));};exports['update']=function(_0x49ad55,_0x5ef270){if(_0x49ad55[_0x0564('0x4d')]['uniqueid']){delete _0x49ad55[_0x0564('0x4d')][_0x0564('0x4e')];}return db[_0x0564('0x31')][_0x0564('0x4f')]({'where':{'uniqueid':_0x49ad55[_0x0564('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ef270,null))[_0x0564('0x28')](saveUpdates(_0x49ad55[_0x0564('0x4d')],null))['then'](respondWithResult(_0x5ef270,null))[_0x0564('0x48')](handleError(_0x5ef270,null));}; \ No newline at end of file +var _0x37ae=['json','offset','limit','status','set','Content-Range','apply','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','nolimit','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','describe','body','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x549837,_0x55d66c){var _0x41621e=function(_0x2c6d17){while(--_0x2c6d17){_0x549837['push'](_0x549837['shift']());}};_0x41621e(++_0x55d66c);}(_0x37ae,0xfd));var _0xe37a=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x37ae[_0x2a276d];return _0x2914cd;};'use strict';var pdf=require(_0xe37a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe37a('0x1'));var zipdir=require(_0xe37a('0x2'));var jsonpatch=require(_0xe37a('0x3'));var rp=require(_0xe37a('0x4'));var moment=require('moment');var BPromise=require(_0xe37a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe37a('0x6'));var sox=require('sox');var csv=require(_0xe37a('0x7'));var ejs=require(_0xe37a('0x8'));var fs=require('fs');var _=require(_0xe37a('0x9'));var squel=require(_0xe37a('0xa'));var crypto=require('crypto');var jsforce=require(_0xe37a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe37a('0x7'));var querystring=require(_0xe37a('0xc'));var Papa=require(_0xe37a('0xd'));var Redis=require(_0xe37a('0xe'));var authService=require(_0xe37a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe37a('0x10'));var logger=require(_0xe37a('0x11'))('api');var utils=require(_0xe37a('0x12'));var config=require(_0xe37a('0x13'));var db=require(_0xe37a('0x14'))['db'];function respondWithStatusCode(_0x30ccf3,_0xe89dfc){_0xe89dfc=_0xe89dfc||0xcc;return function(_0x2f3a2b){if(_0x2f3a2b){return _0x30ccf3[_0xe37a('0x15')](_0xe89dfc);}return _0x30ccf3['status'](_0xe89dfc)[_0xe37a('0x16')]();};}function respondWithResult(_0x52944f,_0x2faa91){_0x2faa91=_0x2faa91||0xc8;return function(_0x4a7e18){if(_0x4a7e18){return _0x52944f['status'](_0x2faa91)[_0xe37a('0x17')](_0x4a7e18);}};}function respondWithFilteredResult(_0x2204b7,_0x2d66a5){return function(_0x320f6b){if(_0x320f6b){var _0x1dd7b3=_0x320f6b['count'],_0x2a36ff=_0x2d66a5['offset'],_0xedc446=_0x2d66a5[_0xe37a('0x18')]+_0x2d66a5[_0xe37a('0x19')],_0x257f4e;if(_0xedc446>=_0x1dd7b3){_0xedc446=_0x1dd7b3;_0x257f4e=0xc8;}else{_0x257f4e=0xce;}_0x2204b7[_0xe37a('0x1a')](_0x257f4e);return _0x2204b7[_0xe37a('0x1b')](_0xe37a('0x1c'),_0x2a36ff+'-'+_0xedc446+'/'+_0x1dd7b3)[_0xe37a('0x17')](_0x320f6b);}return null;};}function patchUpdates(_0x50e6be){return function(_0x49418b){try{jsonpatch[_0xe37a('0x1d')](_0x49418b,_0x50e6be,!![]);}catch(_0x5d4e8c){return BPromise['reject'](_0x5d4e8c);}return _0x49418b['save']();};}function saveUpdates(_0x2f5861,_0x1b2fe4){return function(_0x140a27){if(_0x140a27){return _0x140a27[_0xe37a('0x1e')](_0x2f5861)[_0xe37a('0x1f')](function(_0x1c7ae7){return _0x1c7ae7;});}return null;};}function removeEntity(_0x22e302,_0x5ab368){return function(_0x2d3bde){if(_0x2d3bde){return _0x2d3bde['destroy']()[_0xe37a('0x1f')](function(){_0x22e302[_0xe37a('0x1a')](0xcc)[_0xe37a('0x16')]();});}};}function handleEntityNotFound(_0x11b6bf,_0x29c929){return function(_0x551993){if(!_0x551993){_0x11b6bf[_0xe37a('0x15')](0x194);}return _0x551993;};}function handleError(_0x46ec33,_0x5e043a){_0x5e043a=_0x5e043a||0x1f4;return function(_0x15b00d){logger[_0xe37a('0x20')](_0x15b00d[_0xe37a('0x21')]);if(_0x15b00d[_0xe37a('0x22')]){delete _0x15b00d[_0xe37a('0x22')];}_0x46ec33['status'](_0x5e043a)[_0xe37a('0x23')](_0x15b00d);};}exports[_0xe37a('0x24')]=function(_0x5bbf16,_0x2f9855){var _0x17cd16={},_0x4f0dd3={},_0x12a58e={'count':0x0,'rows':[]};var _0x1b4aef=_[_0xe37a('0x25')](db[_0xe37a('0x26')][_0xe37a('0x27')],function(_0x513d87){return{'name':_0x513d87[_0xe37a('0x28')],'type':_0x513d87['type'][_0xe37a('0x29')]};});_0x4f0dd3['model']=_[_0xe37a('0x25')](_0x1b4aef,_0xe37a('0x22'));_0x4f0dd3['query']=_['keys'](_0x5bbf16[_0xe37a('0x2a')]);_0x4f0dd3[_0xe37a('0x2b')]=_['intersection'](_0x4f0dd3['model'],_0x4f0dd3[_0xe37a('0x2a')]);_0x17cd16[_0xe37a('0x2c')]=_[_0xe37a('0x2d')](_0x4f0dd3[_0xe37a('0x2e')],qs[_0xe37a('0x2f')](_0x5bbf16[_0xe37a('0x2a')][_0xe37a('0x2f')]));_0x17cd16[_0xe37a('0x2c')]=_0x17cd16[_0xe37a('0x2c')]['length']?_0x17cd16[_0xe37a('0x2c')]:_0x4f0dd3[_0xe37a('0x2e')];if(!_0x5bbf16['query']['hasOwnProperty'](_0xe37a('0x30'))){_0x17cd16[_0xe37a('0x19')]=qs[_0xe37a('0x19')](_0x5bbf16['query']['limit']);_0x17cd16['offset']=qs[_0xe37a('0x18')](_0x5bbf16['query'][_0xe37a('0x18')]);}_0x17cd16[_0xe37a('0x31')]=qs['sort'](_0x5bbf16[_0xe37a('0x2a')]['sort']);_0x17cd16['where']=qs['filters'](_[_0xe37a('0x32')](_0x5bbf16[_0xe37a('0x2a')],_0x4f0dd3['filters']),_0x1b4aef);if(_0x5bbf16[_0xe37a('0x2a')][_0xe37a('0x33')]){_0x17cd16[_0xe37a('0x34')]=_[_0xe37a('0x35')](_0x17cd16[_0xe37a('0x34')],{'$or':_[_0xe37a('0x25')](_0x1b4aef,function(_0x43fc10){if(_0x43fc10[_0xe37a('0x36')]!==_0xe37a('0x37')){var _0xd568d1={};_0xd568d1[_0x43fc10[_0xe37a('0x22')]]={'$like':'%'+_0x5bbf16[_0xe37a('0x2a')][_0xe37a('0x33')]+'%'};return _0xd568d1;}})});}_0x17cd16=_[_0xe37a('0x35')]({},_0x17cd16,_0x5bbf16[_0xe37a('0x38')]);var _0x904440={'where':_0x17cd16[_0xe37a('0x34')]};return db[_0xe37a('0x26')]['count'](_0x904440)[_0xe37a('0x1f')](function(_0x377244){_0x12a58e['count']=_0x377244;if(_0x5bbf16[_0xe37a('0x2a')][_0xe37a('0x39')]){_0x17cd16[_0xe37a('0x3a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe37a('0x3b')](_0x17cd16);})[_0xe37a('0x1f')](function(_0x2c445d){_0x12a58e['rows']=_0x2c445d;return _0x12a58e;})[_0xe37a('0x1f')](respondWithFilteredResult(_0x2f9855,_0x17cd16))['catch'](handleError(_0x2f9855,null));};exports[_0xe37a('0x3c')]=function(_0x58d5c1,_0x213958){var _0x7e9ccb={'raw':!![],'where':{'id':_0x58d5c1[_0xe37a('0x3d')]['id']}},_0x5402fe={};_0x5402fe[_0xe37a('0x2e')]=_[_0xe37a('0x3e')](db[_0xe37a('0x26')][_0xe37a('0x27')]);_0x5402fe[_0xe37a('0x2a')]=_[_0xe37a('0x3e')](_0x58d5c1['query']);_0x5402fe['filters']=_[_0xe37a('0x2d')](_0x5402fe['model'],_0x5402fe[_0xe37a('0x2a')]);_0x7e9ccb[_0xe37a('0x2c')]=_[_0xe37a('0x2d')](_0x5402fe['model'],qs[_0xe37a('0x2f')](_0x58d5c1[_0xe37a('0x2a')][_0xe37a('0x2f')]));_0x7e9ccb[_0xe37a('0x2c')]=_0x7e9ccb[_0xe37a('0x2c')]['length']?_0x7e9ccb[_0xe37a('0x2c')]:_0x5402fe['model'];if(_0x58d5c1[_0xe37a('0x2a')][_0xe37a('0x39')]){_0x7e9ccb[_0xe37a('0x3a')]=[{'all':!![]}];}_0x7e9ccb=_[_0xe37a('0x35')]({},_0x7e9ccb,_0x58d5c1[_0xe37a('0x38')]);return db['CmHopperHistory'][_0xe37a('0x3f')](_0x7e9ccb)[_0xe37a('0x1f')](handleEntityNotFound(_0x213958,null))['then'](respondWithResult(_0x213958,null))[_0xe37a('0x40')](handleError(_0x213958,null));};exports['create']=function(_0x5f67ff,_0x2f9a9d){return db[_0xe37a('0x26')][_0xe37a('0x41')](_0x5f67ff['body'],{})[_0xe37a('0x1f')](respondWithResult(_0x2f9a9d,0xc9))[_0xe37a('0x40')](handleError(_0x2f9a9d,null));};exports[_0xe37a('0x42')]=function(_0x1bdf0f,_0x4b07f3){return db['CmHopperHistory'][_0xe37a('0x42')]()[_0xe37a('0x1f')](respondWithResult(_0x4b07f3,null))[_0xe37a('0x40')](handleError(_0x4b07f3,null));};exports[_0xe37a('0x1e')]=function(_0x131eff,_0x2968fb){if(_0x131eff[_0xe37a('0x43')][_0xe37a('0x44')]){delete _0x131eff['body']['uniqueid'];}return db[_0xe37a('0x26')][_0xe37a('0x3f')]({'where':{'uniqueid':_0x131eff['params']['id']}})[_0xe37a('0x1f')](handleEntityNotFound(_0x2968fb,null))[_0xe37a('0x1f')](saveUpdates(_0x131eff[_0xe37a('0x43')],null))[_0xe37a('0x1f')](respondWithResult(_0x2968fb,null))['catch'](handleError(_0x2968fb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 6e8f870..219eecb 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 _0xb1aa=['lodash','../../config/logger','api','moment','request-promise','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb1aa,0x1bc));var _0xab1a=function(_0x392288,_0x54ee4f){_0x392288=_0x392288-0x0;var _0x3e1eb9=_0xb1aa[_0x392288];return _0x3e1eb9;};'use strict';var _=require(_0xab1a('0x0'));var util=require('util');var logger=require(_0xab1a('0x1'))(_0xab1a('0x2'));var moment=require(_0xab1a('0x3'));var BPromise=require('bluebird');var rp=require(_0xab1a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab1a('0x5'));var attributes=require(_0xab1a('0x6'));module[_0xab1a('0x7')]=function(_0x2162c0,_0xcfd981){return _0x2162c0['define'](_0xab1a('0x8'),attributes,{'tableName':_0xab1a('0x9'),'paranoid':![],'indexes':[{'name':_0xab1a('0xa'),'fields':['endtime']},{'name':_0xab1a('0xb'),'fields':[_0xab1a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf21=['api','moment','bluebird','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x18a240,_0x2ce6b1){var _0x48bf53=function(_0x2e3eaa){while(--_0x2e3eaa){_0x18a240['push'](_0x18a240['shift']());}};_0x48bf53(++_0x2ce6b1);}(_0xdf21,0x101));var _0x1df2=function(_0xb6dae7,_0x2e19f){_0xb6dae7=_0xb6dae7-0x0;var _0x4811a5=_0xdf21[_0xb6dae7];return _0x4811a5;};'use strict';var _=require(_0x1df2('0x0'));var util=require(_0x1df2('0x1'));var logger=require(_0x1df2('0x2'))(_0x1df2('0x3'));var moment=require(_0x1df2('0x4'));var BPromise=require(_0x1df2('0x5'));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(_0x1df2('0x6'));module[_0x1df2('0x7')]=function(_0x1bc9b9,_0x5b0667){return _0x1bc9b9[_0x1df2('0x8')](_0x1df2('0x9'),attributes,{'tableName':_0x1df2('0xa'),'paranoid':![],'indexes':[{'name':_0x1df2('0xb'),'fields':['endtime']},{'name':_0x1df2('0xc'),'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 0592727..2d3cf2b 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 _0x96cc=['`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0xa6cb09,_0x39410f){var _0x12b437=function(_0x1813cc){while(--_0x1813cc){_0xa6cb09['push'](_0xa6cb09['shift']());}};_0x12b437(++_0x39410f);}(_0x96cc,0x16c));var _0xc96c=function(_0x2d58e6,_0x55cb14){_0x2d58e6=_0x2d58e6-0x0;var _0x5bcd81=_0x96cc[_0x2d58e6];return _0x5bcd81;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});}exports[_0xc96c('0x17')]=function(_0x99c402){var _0x16b6ce=this;return new Promise(function(_0x2ae19a,_0x4aa6a3){return db[_0xc96c('0x18')][_0xc96c('0x19')](_0x99c402[_0xc96c('0x1a')],{'raw':_0x99c402[_0xc96c('0x1b')]?_0x99c402[_0xc96c('0x1b')][_0xc96c('0x1c')]===undefined?!![]:![]:!![]})[_0xc96c('0xc')](function(_0x41daba){logger[_0xc96c('0xd')](_0xc96c('0x17'),_0x99c402);logger[_0xc96c('0x1d')](_0xc96c('0x17'),_0x99c402,JSON[_0xc96c('0x11')](_0x41daba));_0x2ae19a(_0x41daba);})[_0xc96c('0x16')](function(_0x325c54){logger[_0xc96c('0x12')](_0xc96c('0x17'),_0x325c54['message'],_0x99c402);_0x4aa6a3(_0x16b6ce[_0xc96c('0x12')](0x1f4,_0x325c54[_0xc96c('0x14')]));});});};exports[_0xc96c('0x1e')]=function(_0x10ae21){var _0x2b1df9=this;return new Promise(function(_0x35f480,_0x40f23d){return db[_0xc96c('0x18')][_0xc96c('0x1f')]({'raw':_0x10ae21[_0xc96c('0x1b')]?_0x10ae21['options'][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x10ae21[_0xc96c('0x1b')]?_0x10ae21[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xc96c('0x21')][_0xc96c('0x22')]('id')),_0xc96c('0x23')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x27')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal'](_0xc96c('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')](_0xc96c('0x29')))),_0xc96c('0x2a')],[db[_0xc96c('0x21')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x2b')))),'predictiveIntervalAvgHoldtime'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x2c'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal'](_0xc96c('0x2d')))),_0xc96c('0x2e')]]})['then'](function(_0x2b1dec){logger[_0xc96c('0xd')](_0xc96c('0x1e'),_0x10ae21);logger[_0xc96c('0x1d')](_0xc96c('0x1e'),_0x10ae21,JSON[_0xc96c('0x11')](_0x2b1dec));_0x35f480(_0x2b1dec);})['catch'](function(_0x35dfb7){logger[_0xc96c('0x12')](_0xc96c('0x1e'),_0x35dfb7[_0xc96c('0x14')],_0x10ae21);_0x40f23d(_0x2b1df9[_0xc96c('0x12')](0x1f4,_0x35dfb7[_0xc96c('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x56b5c9){var _0x33b4bb=this;return new Promise(function(_0x156d0f,_0x5006ec){return db['CmHopperHistory'][_0xc96c('0x1f')]({'raw':_0x56b5c9[_0xc96c('0x1b')]?_0x56b5c9[_0xc96c('0x1b')][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x56b5c9[_0xc96c('0x1b')]?_0x56b5c9[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[_0xc96c('0x2f'),_0xc96c('0x30')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x31')))),_0xc96c('0x32')],[db['sequelize']['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xc96c('0x33')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x34')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc96c('0x35')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x36')))),'outboundDropCallsDayTimeout'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc96c('0x37')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x38')))),_0xc96c('0x39')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0xc96c('0x3a')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0xc96c('0x3b')],[db[_0xc96c('0x21')]['fn']('COUNT',db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x3c')))),_0xc96c('0x3d')],[db[_0xc96c('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc96c('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0xc96c('0x3e')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x3f')))),_0xc96c('0x3d')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x40')))),_0xc96c('0x41')]],'group':[_0xc96c('0x2f')]})[_0xc96c('0xc')](function(_0xad88c3){logger[_0xc96c('0xd')]('GetVoiceQueueHopperHistory',_0x56b5c9);logger['debug']('GetVoiceQueueHopperHistory',_0x56b5c9,JSON['stringify'](_0xad88c3));_0x156d0f(_0xad88c3);})[_0xc96c('0x16')](function(_0x46c6fb){logger[_0xc96c('0x12')](_0xc96c('0x42'),_0x46c6fb[_0xc96c('0x14')],_0x56b5c9);_0x5006ec(_0x33b4bb[_0xc96c('0x12')](0x1f4,_0x46c6fb[_0xc96c('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x47115b){var _0x48dc98=this;return new Promise(function(_0x3c4b60,_0x103e90){return db[_0xc96c('0x18')][_0xc96c('0x1f')]({'raw':_0x47115b[_0xc96c('0x1b')]?_0x47115b['options'][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x47115b[_0xc96c('0x1b')]?_0x47115b[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[_0xc96c('0x2f'),_0xc96c('0x30')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')][_0xc96c('0x22')]('id')),_0xc96c('0x43')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x44')]],'group':[_0xc96c('0x2f')]})[_0xc96c('0xc')](function(_0x55219a){logger[_0xc96c('0xd')](_0xc96c('0x45'),_0x47115b);logger[_0xc96c('0x1d')](_0xc96c('0x45'),_0x47115b,JSON['stringify'](_0x55219a));_0x3c4b60(_0x55219a);})[_0xc96c('0x16')](function(_0x4629ce){logger['error']('GetCampaignHopperHistory',_0x4629ce['message'],_0x47115b);_0x103e90(_0x48dc98[_0xc96c('0x12')](0x1f4,_0x4629ce[_0xc96c('0x14')]));});});}; \ No newline at end of file +var _0xf7b4=['request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create','body','options','then','CreateCmHopperHistory','AvgHandleTime','findAll','raw','where','COUNT','sequelize','col','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0xf7b4,0x152));var _0x4f7b=function(_0x3315ab,_0x134bff){_0x3315ab=_0x3315ab-0x0;var _0x54725f=_0xf7b4[_0x3315ab];return _0x54725f;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['CreateCmHopperHistory']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')](_0x24e5cf[_0x4f7b('0x17')],{'raw':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x4f7b('0x19')](function(_0x12374b){logger[_0x4f7b('0xb')](_0x4f7b('0x1a'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x1a'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x12374b));_0x519d90(_0x12374b);})[_0x4f7b('0x14')](function(_0x2a8b50){logger['error'](_0x4f7b('0x1a'),_0x2a8b50[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da[_0x4f7b('0x10')](0x1f4,_0x2a8b50['message']));});});};exports[_0x4f7b('0x1b')]=function(_0x4610a4){var _0x5d22f4=this;return new Promise(function(_0x15dbec,_0x59ec24){return db[_0x4f7b('0x15')][_0x4f7b('0x1c')]({'raw':_0x4610a4[_0x4f7b('0x18')]?_0x4610a4[_0x4f7b('0x18')][_0x4f7b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4610a4[_0x4f7b('0x18')]?_0x4610a4[_0x4f7b('0x18')][_0x4f7b('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')][_0x4f7b('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x4f7b('0x23')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db['sequelize']['fn']('IF',db[_0x4f7b('0x20')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x4f7b('0x24')],[db['sequelize']['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x25')))),_0x4f7b('0x26')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x27'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x28')))),_0x4f7b('0x29')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x27'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x2a')))),_0x4f7b('0x2b')]]})[_0x4f7b('0x19')](function(_0x172235){logger['info'](_0x4f7b('0x1b'),_0x4610a4);logger['debug'](_0x4f7b('0x1b'),_0x4610a4,JSON[_0x4f7b('0xf')](_0x172235));_0x15dbec(_0x172235);})['catch'](function(_0xa28dab){logger[_0x4f7b('0x10')](_0x4f7b('0x1b'),_0xa28dab['message'],_0x4610a4);_0x59ec24(_0x5d22f4[_0x4f7b('0x10')](0x1f4,_0xa28dab[_0x4f7b('0x12')]));});});};exports[_0x4f7b('0x2c')]=function(_0x347ef1){var _0x244b99=this;return new Promise(function(_0x42ff48,_0xd42b30){return db['CmHopperHistory'][_0x4f7b('0x1c')]({'raw':_0x347ef1['options']?_0x347ef1[_0x4f7b('0x18')][_0x4f7b('0x1d')]===undefined?!![]:![]:!![],'where':_0x347ef1[_0x4f7b('0x18')]?_0x347ef1['options'][_0x4f7b('0x1e')]||null:null,'attributes':[['campaign',_0x4f7b('0x2d')],[db[_0x4f7b('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4f7b('0x20')]['literal'](_0x4f7b('0x2e')))),_0x4f7b('0x2f')],[db['sequelize']['fn'](_0x4f7b('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4f7b('0x30')))),_0x4f7b('0x31')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db['sequelize']['fn']('IF',db[_0x4f7b('0x20')]['literal'](_0x4f7b('0x32')))),'outboundAnswerCallsDay'],[db[_0x4f7b('0x20')]['fn']('COUNT',db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x33')))),_0x4f7b('0x34')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x35')))),_0x4f7b('0x36')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x37')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x4f7b('0x38')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')]['literal'](_0x4f7b('0x39')))),_0x4f7b('0x3a')],[db[_0x4f7b('0x20')]['fn']('COUNT',db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x3b')))),_0x4f7b('0x3c')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0x4f7b('0x3d')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db['sequelize']['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x3e')))),_0x4f7b('0x3f')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')][_0x4f7b('0x22')](_0x4f7b('0x40')))),'outboundRejectCallsDay'],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db['sequelize'][_0x4f7b('0x22')](_0x4f7b('0x41')))),_0x4f7b('0x42')]],'group':[_0x4f7b('0x43')]})[_0x4f7b('0x19')](function(_0x819fb3){logger['info'](_0x4f7b('0x2c'),_0x347ef1);logger[_0x4f7b('0xd')](_0x4f7b('0x2c'),_0x347ef1,JSON['stringify'](_0x819fb3));_0x42ff48(_0x819fb3);})[_0x4f7b('0x14')](function(_0x1906ad){logger[_0x4f7b('0x10')](_0x4f7b('0x2c'),_0x1906ad[_0x4f7b('0x12')],_0x347ef1);_0xd42b30(_0x244b99[_0x4f7b('0x10')](0x1f4,_0x1906ad['message']));});});};exports[_0x4f7b('0x44')]=function(_0x4eb5c0){var _0x52fa40=this;return new Promise(function(_0x5aef6e,_0x21e852){return db[_0x4f7b('0x15')][_0x4f7b('0x1c')]({'raw':_0x4eb5c0['options']?_0x4eb5c0['options'][_0x4f7b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4eb5c0[_0x4f7b('0x18')]?_0x4eb5c0['options'][_0x4f7b('0x1e')]||null:null,'attributes':[[_0x4f7b('0x43'),_0x4f7b('0x2d')],[db[_0x4f7b('0x20')]['fn']('COUNT',db[_0x4f7b('0x20')][_0x4f7b('0x21')]('id')),_0x4f7b('0x45')],[db[_0x4f7b('0x20')]['fn'](_0x4f7b('0x1f'),db[_0x4f7b('0x20')]['fn']('IF',db[_0x4f7b('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x4f7b('0x43')]})['then'](function(_0x4e8de8){logger['info']('GetCampaignHopperHistory',_0x4eb5c0);logger[_0x4f7b('0xd')](_0x4f7b('0x44'),_0x4eb5c0,JSON[_0x4f7b('0xf')](_0x4e8de8));_0x5aef6e(_0x4e8de8);})[_0x4f7b('0x14')](function(_0x25da52){logger[_0x4f7b('0x10')](_0x4f7b('0x44'),_0x25da52[_0x4f7b('0x12')],_0x4eb5c0);_0x21e852(_0x52fa40[_0x4f7b('0x10')](0x1f4,_0x25da52[_0x4f7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 5271eda..8762a57 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 _0x36bc=['/:id','show','create','put','update','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x36bc,0xf5));var _0xc36b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x36bc[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0xc36b('0x0'));var util=require(_0xc36b('0x1'));var path=require('path');var timeout=require(_0xc36b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc36b('0x3'));var config=require(_0xc36b('0x4'));var controller=require(_0xc36b('0x5'));router[_0xc36b('0x6')]('/',auth[_0xc36b('0x7')](),controller[_0xc36b('0x8')]);router['get'](_0xc36b('0x9'),auth[_0xc36b('0x7')](),controller[_0xc36b('0xa')]);router[_0xc36b('0x6')](_0xc36b('0xb'),auth['isAuthenticated'](),controller[_0xc36b('0xc')]);router['post']('/',auth[_0xc36b('0x7')](),controller[_0xc36b('0xd')]);router[_0xc36b('0xe')](_0xc36b('0xb'),auth[_0xc36b('0x7')](),controller[_0xc36b('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd461=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','exports','util','connect-timeout','express','Router'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xd461,0x13f));var _0x1d46=function(_0x220430,_0x4ce08b){_0x220430=_0x220430-0x0;var _0xec1263=_0xd461[_0x220430];return _0xec1263;};'use strict';var multer=require('multer');var util=require(_0x1d46('0x0'));var path=require('path');var timeout=require(_0x1d46('0x1'));var express=require(_0x1d46('0x2'));var router=express[_0x1d46('0x3')]();var auth=require(_0x1d46('0x4'));var interaction=require(_0x1d46('0x5'));var config=require(_0x1d46('0x6'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x1d46('0x7')](),controller['index']);router[_0x1d46('0x8')](_0x1d46('0x9'),auth[_0x1d46('0x7')](),controller[_0x1d46('0xa')]);router['get'](_0x1d46('0xb'),auth['isAuthenticated'](),controller[_0x1d46('0xc')]);router[_0x1d46('0xd')]('/',auth[_0x1d46('0x7')](),controller[_0x1d46('0xe')]);router[_0x1d46('0xf')](_0x1d46('0xb'),auth[_0x1d46('0x7')](),controller['update']);module[_0x1d46('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 77a003e..0df3747 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 _0xf3cc=['exports','STRING','name','sequelize'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xf3cc,0x1cb));var _0xcf3c=function(_0x524efa,_0xbe406e){_0x524efa=_0x524efa-0x0;var _0x775cd5=_0xf3cc[_0x524efa];return _0x775cd5;};'use strict';var Sequelize=require(_0xcf3c('0x0'));module[_0xcf3c('0x1')]={'name':{'type':Sequelize[_0xcf3c('0x2')],'unique':_0xcf3c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xcf3c('0x2')]}}; \ No newline at end of file +var _0xaa85=['sequelize','exports','STRING','name'];(function(_0x236df8,_0x103d28){var _0x34da1b=function(_0x5941d3){while(--_0x5941d3){_0x236df8['push'](_0x236df8['shift']());}};_0x34da1b(++_0x103d28);}(_0xaa85,0x94));var _0x5aa8=function(_0x26cd68,_0x264df0){_0x26cd68=_0x26cd68-0x0;var _0x388a80=_0xaa85[_0x26cd68];return _0x388a80;};'use strict';var Sequelize=require(_0x5aa8('0x0'));module[_0x5aa8('0x1')]={'name':{'type':Sequelize[_0x5aa8('0x2')],'unique':_0x5aa8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x5aa8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d129c18..aef08bc 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 _0x3698=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','CmList','count','include','rows','show','params','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','includeAll','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x1e6e3a,_0x432fac){var _0x2a4daf=function(_0xeeb55c){while(--_0xeeb55c){_0x1e6e3a['push'](_0x1e6e3a['shift']());}};_0x2a4daf(++_0x432fac);}(_0x3698,0x10e));var _0x8369=function(_0x186e7c,_0x542c10){_0x186e7c=_0x186e7c-0x0;var _0x1715e3=_0x3698[_0x186e7c];return _0x1715e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8369('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8369('0x1'));var rp=require(_0x8369('0x2'));var moment=require(_0x8369('0x3'));var BPromise=require(_0x8369('0x4'));var Mustache=require(_0x8369('0x5'));var util=require(_0x8369('0x6'));var path=require(_0x8369('0x7'));var sox=require('sox');var csv=require(_0x8369('0x8'));var ejs=require(_0x8369('0x9'));var fs=require('fs');var _=require(_0x8369('0xa'));var squel=require(_0x8369('0xb'));var crypto=require(_0x8369('0xc'));var jsforce=require(_0x8369('0xd'));var deskjs=require(_0x8369('0xe'));var toCsv=require(_0x8369('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8369('0xf'));var authService=require(_0x8369('0x10'));var qs=require(_0x8369('0x11'));var as=require(_0x8369('0x12'));var hardwareService=require(_0x8369('0x13'));var logger=require(_0x8369('0x14'))(_0x8369('0x15'));var utils=require(_0x8369('0x16'));var config=require(_0x8369('0x17'));var db=require('../../mysqldb')['db'];config[_0x8369('0x18')]=_[_0x8369('0x19')](config[_0x8369('0x18')],{'host':_0x8369('0x1a'),'port':0x18eb});var socket=require(_0x8369('0x1b'))(new Redis(config['redis']));require(_0x8369('0x1c'))[_0x8369('0x1d')](socket);function respondWithStatusCode(_0x2a9026,_0x390bd6){_0x390bd6=_0x390bd6||0xcc;return function(_0x5b8842){if(_0x5b8842){return _0x2a9026[_0x8369('0x1e')](_0x390bd6);}return _0x2a9026['status'](_0x390bd6)[_0x8369('0x1f')]();};}function respondWithResult(_0x161690,_0x322c7a){_0x322c7a=_0x322c7a||0xc8;return function(_0x277d48){if(_0x277d48){return _0x161690[_0x8369('0x20')](_0x322c7a)['json'](_0x277d48);}};}function respondWithFilteredResult(_0x5305b7,_0xb97100){return function(_0x15d538){if(_0x15d538){var _0x22263c=_0x15d538['count'],_0xa8385a=_0xb97100[_0x8369('0x21')],_0x27570b=_0xb97100[_0x8369('0x21')]+_0xb97100[_0x8369('0x22')],_0x12721c;if(_0x27570b>=_0x22263c){_0x27570b=_0x22263c;_0x12721c=0xc8;}else{_0x12721c=0xce;}_0x5305b7[_0x8369('0x20')](_0x12721c);return _0x5305b7[_0x8369('0x23')](_0x8369('0x24'),_0xa8385a+'-'+_0x27570b+'/'+_0x22263c)[_0x8369('0x25')](_0x15d538);}return null;};}function patchUpdates(_0x36cfc8){return function(_0x4d0a9e){try{jsonpatch[_0x8369('0x26')](_0x4d0a9e,_0x36cfc8,!![]);}catch(_0x11f050){return BPromise['reject'](_0x11f050);}return _0x4d0a9e[_0x8369('0x27')]();};}function saveUpdates(_0x46b343,_0x2c1395){return function(_0x9912e8){if(_0x9912e8){return _0x9912e8[_0x8369('0x28')](_0x46b343)[_0x8369('0x29')](function(_0x3e5f5c){return _0x3e5f5c;});}return null;};}function removeEntity(_0x31dadd,_0x533984){return function(_0x3be141){if(_0x3be141){return _0x3be141[_0x8369('0x2a')]()['then'](function(){var _0x2afb23=_0x3be141['get']({'plain':!![]});var _0x14fdb5='Lists';return db[_0x8369('0x2b')]['destroy']({'where':{'type':_0x14fdb5,'resourceId':_0x2afb23['id']}})['then'](function(){return _0x3be141;});})[_0x8369('0x29')](function(){_0x31dadd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x252ea3,_0x54be12){return function(_0x5d8d5e){if(!_0x5d8d5e){_0x252ea3['sendStatus'](0x194);}return _0x5d8d5e;};}function handleError(_0xc1c550,_0x48adf9){_0x48adf9=_0x48adf9||0x1f4;return function(_0x54f8c3){logger['error'](_0x54f8c3['stack']);if(_0x54f8c3[_0x8369('0x2c')]){delete _0x54f8c3[_0x8369('0x2c')];}_0xc1c550['status'](_0x48adf9)[_0x8369('0x2d')](_0x54f8c3);};}exports['index']=function(_0x596a1e,_0xfc6b04){var _0x388c40={},_0x3792bc={},_0x11a88e={'count':0x0,'rows':[]};var _0x1988a7=_[_0x8369('0x2e')](db['CmList']['rawAttributes'],function(_0x571aa2){return{'name':_0x571aa2[_0x8369('0x2f')],'type':_0x571aa2[_0x8369('0x30')][_0x8369('0x31')]};});_0x3792bc[_0x8369('0x32')]=_[_0x8369('0x2e')](_0x1988a7,'name');_0x3792bc['query']=_[_0x8369('0x33')](_0x596a1e[_0x8369('0x34')]);_0x3792bc[_0x8369('0x35')]=_[_0x8369('0x36')](_0x3792bc[_0x8369('0x32')],_0x3792bc[_0x8369('0x34')]);_0x388c40[_0x8369('0x37')]=_[_0x8369('0x36')](_0x3792bc['model'],qs[_0x8369('0x38')](_0x596a1e[_0x8369('0x34')][_0x8369('0x38')]));_0x388c40[_0x8369('0x37')]=_0x388c40[_0x8369('0x37')][_0x8369('0x39')]?_0x388c40[_0x8369('0x37')]:_0x3792bc[_0x8369('0x32')];if(!_0x596a1e[_0x8369('0x34')][_0x8369('0x3a')](_0x8369('0x3b'))){_0x388c40[_0x8369('0x22')]=qs[_0x8369('0x22')](_0x596a1e[_0x8369('0x34')][_0x8369('0x22')]);_0x388c40[_0x8369('0x21')]=qs[_0x8369('0x21')](_0x596a1e['query'][_0x8369('0x21')]);}_0x388c40[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x596a1e[_0x8369('0x34')][_0x8369('0x3d')]);_0x388c40['where']=qs[_0x8369('0x35')](_[_0x8369('0x3e')](_0x596a1e['query'],_0x3792bc[_0x8369('0x35')]),_0x1988a7);if(_0x596a1e['query'][_0x8369('0x3f')]){_0x388c40[_0x8369('0x40')]=_['merge'](_0x388c40[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x1988a7,function(_0x486a9a){if(_0x486a9a[_0x8369('0x30')]!==_0x8369('0x41')){var _0x4c3648={};_0x4c3648[_0x486a9a[_0x8369('0x2c')]]={'$like':'%'+_0x596a1e['query'][_0x8369('0x3f')]+'%'};return _0x4c3648;}})});}_0x388c40=_[_0x8369('0x42')]({},_0x388c40,_0x596a1e[_0x8369('0x43')]);var _0x359d75={'where':_0x388c40[_0x8369('0x40')]};return db[_0x8369('0x44')]['count'](_0x359d75)[_0x8369('0x29')](function(_0x184918){_0x11a88e[_0x8369('0x45')]=_0x184918;if(_0x596a1e[_0x8369('0x34')]['includeAll']){_0x388c40[_0x8369('0x46')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x388c40);})[_0x8369('0x29')](function(_0x373fc5){_0x11a88e[_0x8369('0x47')]=_0x373fc5;return _0x11a88e;})['then'](respondWithFilteredResult(_0xfc6b04,_0x388c40))['catch'](handleError(_0xfc6b04,null));};exports[_0x8369('0x48')]=function(_0x318e12,_0x3fc5dd){var _0x413b08={'raw':![],'where':{'id':_0x318e12[_0x8369('0x49')]['id']}},_0x333f5b={};_0x333f5b[_0x8369('0x32')]=_[_0x8369('0x33')](db['CmList'][_0x8369('0x4a')]);_0x333f5b[_0x8369('0x34')]=_['keys'](_0x318e12[_0x8369('0x34')]);_0x333f5b[_0x8369('0x35')]=_[_0x8369('0x36')](_0x333f5b[_0x8369('0x32')],_0x333f5b[_0x8369('0x34')]);_0x413b08[_0x8369('0x37')]=_[_0x8369('0x36')](_0x333f5b[_0x8369('0x32')],qs[_0x8369('0x38')](_0x318e12[_0x8369('0x34')][_0x8369('0x38')]));_0x413b08['attributes']=_0x413b08['attributes'][_0x8369('0x39')]?_0x413b08[_0x8369('0x37')]:_0x333f5b[_0x8369('0x32')];if(_0x318e12[_0x8369('0x34')]['includeAll']){_0x413b08[_0x8369('0x46')]=[{'all':!![]}];}_0x413b08=_[_0x8369('0x42')]({},_0x413b08,_0x318e12[_0x8369('0x43')]);return db['CmList']['find'](_0x413b08)[_0x8369('0x29')](handleEntityNotFound(_0x3fc5dd,null))[_0x8369('0x29')](respondWithResult(_0x3fc5dd,null))[_0x8369('0x4b')](handleError(_0x3fc5dd,null));};exports[_0x8369('0x4c')]=function(_0x946d3c,_0x422a00){return db['CmList']['create'](_0x946d3c[_0x8369('0x4d')],{})[_0x8369('0x29')](function(_0x4469eb){var _0x379050=_0x946d3c[_0x8369('0x4e')][_0x8369('0x4f')]({'plain':!![]});if(!_0x379050)throw new Error(_0x8369('0x50'));if(_0x379050['role']===_0x8369('0x4e')){var _0x49e9bd=_0x4469eb[_0x8369('0x4f')]({'plain':!![]});var _0x50b87f=_0x8369('0x51');return db[_0x8369('0x52')][_0x8369('0x53')]({'where':{'name':_0x50b87f,'userProfileId':_0x379050[_0x8369('0x54')]},'raw':!![]})['then'](function(_0x13acfb){if(_0x13acfb&&_0x13acfb[_0x8369('0x55')]===0x0){return db[_0x8369('0x2b')]['create']({'name':_0x49e9bd[_0x8369('0x2c')],'resourceId':_0x49e9bd['id'],'type':_0x13acfb[_0x8369('0x2c')],'sectionId':_0x13acfb['id']},{})[_0x8369('0x29')](function(){return _0x4469eb;});}else{return _0x4469eb;}})[_0x8369('0x4b')](function(_0x2b91b8){logger['error'](_0x8369('0x56'),_0x2b91b8);throw _0x2b91b8;});}return _0x4469eb;})[_0x8369('0x29')](respondWithResult(_0x422a00,0xc9))[_0x8369('0x4b')](handleError(_0x422a00,null));};exports[_0x8369('0x28')]=function(_0x1fbc5e,_0x5b3a23){if(_0x1fbc5e[_0x8369('0x4d')]['id']){delete _0x1fbc5e[_0x8369('0x4d')]['id'];}return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x1fbc5e[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x5b3a23,null))[_0x8369('0x29')](saveUpdates(_0x1fbc5e[_0x8369('0x4d')],null))[_0x8369('0x29')](respondWithResult(_0x5b3a23,null))[_0x8369('0x4b')](handleError(_0x5b3a23,null));};exports[_0x8369('0x2a')]=function(_0x45b2de,_0x7ff8a1){return db['CmList'][_0x8369('0x53')]({'where':{'id':_0x45b2de['params']['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x7ff8a1,null))[_0x8369('0x29')](removeEntity(_0x7ff8a1,null))[_0x8369('0x4b')](handleError(_0x7ff8a1,null));};exports[_0x8369('0x57')]=function(_0x386cd6,_0x4120ca){return db['CmList'][_0x8369('0x57')]()[_0x8369('0x29')](respondWithResult(_0x4120ca,null))[_0x8369('0x4b')](handleError(_0x4120ca,null));};exports[_0x8369('0x58')]=function(_0x29609b,_0x9f9e9d,_0x362dc9){if(_0x29609b[_0x8369('0x4d')]['id']){delete _0x29609b[_0x8369('0x4d')]['id'];}return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x29609b[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x9f9e9d,null))[_0x8369('0x29')](function(_0x589031){if(_0x589031){_0x29609b[_0x8369('0x4d')][_0x8369('0x59')]=_0x589031['id'];return db['Disposition']['create'](_0x29609b['body']);}})[_0x8369('0x29')](respondWithResult(_0x9f9e9d,null))['catch'](handleError(_0x9f9e9d,null));};exports['getDispositions']=function(_0x1d051e,_0x5dc0ec,_0x4cf349){var _0x55022a={'raw':![],'where':{}};var _0x114f06={};var _0x413c13={'count':0x0,'rows':[]};return db[_0x8369('0x44')]['findOne']({'where':{'id':_0x1d051e[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x5dc0ec,null))[_0x8369('0x29')](function(_0x1f858a){if(_0x1f858a){_0x114f06[_0x8369('0x32')]=_[_0x8369('0x33')](db[_0x8369('0x5a')]['rawAttributes']);_0x114f06[_0x8369('0x34')]=_['keys'](_0x1d051e['query']);_0x114f06['filters']=_[_0x8369('0x36')](_0x114f06['model'],_0x114f06[_0x8369('0x34')]);_0x55022a['attributes']=_[_0x8369('0x36')](_0x114f06['model'],qs['fields'](_0x1d051e[_0x8369('0x34')]['fields']));_0x55022a['attributes']=_0x55022a[_0x8369('0x37')][_0x8369('0x39')]?_0x55022a[_0x8369('0x37')]:_0x114f06['model'];if(!_0x1d051e[_0x8369('0x34')][_0x8369('0x3a')](_0x8369('0x3b'))){_0x55022a[_0x8369('0x22')]=qs[_0x8369('0x22')](_0x1d051e['query'][_0x8369('0x22')]);_0x55022a[_0x8369('0x21')]=qs[_0x8369('0x21')](_0x1d051e['query'][_0x8369('0x21')]);}_0x55022a[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x1d051e[_0x8369('0x34')][_0x8369('0x3d')]);_0x55022a[_0x8369('0x40')]=qs[_0x8369('0x35')](_['pick'](_0x1d051e['query'],_0x114f06[_0x8369('0x35')]));_0x55022a[_0x8369('0x40')][_0x8369('0x59')]=_0x1f858a['id'];if(_0x1d051e['query'][_0x8369('0x3f')]){_0x55022a['where']=_[_0x8369('0x42')](_0x55022a[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x55022a[_0x8369('0x37')],function(_0x57a241){var _0x51bdd7={};_0x51bdd7[_0x57a241]={'$like':'%'+_0x1d051e[_0x8369('0x34')][_0x8369('0x3f')]+'%'};return _0x51bdd7;})});}_0x55022a=_[_0x8369('0x42')]({},_0x55022a,_0x1d051e[_0x8369('0x43')]);return db['Disposition'][_0x8369('0x45')]({'where':_0x55022a['where']})[_0x8369('0x29')](function(_0x1b883d){_0x413c13[_0x8369('0x45')]=_0x1b883d;if(_0x1d051e[_0x8369('0x34')][_0x8369('0x5b')]){_0x55022a[_0x8369('0x46')]=[{'all':!![]}];}return db[_0x8369('0x5a')][_0x8369('0x5c')](_0x55022a);})['then'](function(_0x125c1d){_0x413c13[_0x8369('0x47')]=_0x125c1d;return _0x413c13;});}})[_0x8369('0x29')](respondWithFilteredResult(_0x5dc0ec,_0x55022a))['catch'](handleError(_0x5dc0ec,null));};exports[_0x8369('0x5d')]=function(_0x2ca85e,_0x45c97c,_0x58d369){return db[_0x8369('0x44')]['find']({'where':{'id':_0x2ca85e['params']['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x45c97c,null))[_0x8369('0x29')](function(_0x3567ad){if(_0x3567ad){return _0x3567ad[_0x8369('0x5d')](_0x2ca85e[_0x8369('0x34')][_0x8369('0x5e')]);}})[_0x8369('0x29')](respondWithStatusCode(_0x45c97c,null))['catch'](handleError(_0x45c97c,null));};exports[_0x8369('0x5f')]=function(_0x318671,_0x55cab4,_0x2a6731){return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x318671[_0x8369('0x49')]['id']}})['then'](handleEntityNotFound(_0x55cab4,null))[_0x8369('0x29')](function(_0xdd0787){if(_0xdd0787){var _0xbd79d7=[];var _0x3b6dac={'success':[],'errors':[]};return db[_0x8369('0x60')][_0x8369('0x57')]()['then'](function(_0x47d6f8){if(_0x318671[_0x8369('0x4d')]['tags']&&_['isArray'](_0x318671[_0x8369('0x4d')][_0x8369('0x61')])){if(_0x318671['body'][_0x8369('0x61')]['length']){_0x318671['body'][_0x8369('0x61')]=_0x318671['body'][_0x8369('0x61')]['join'](';')+';';}else{_0x318671[_0x8369('0x4d')][_0x8369('0x61')]=null;}}else{_0x318671['body'][_0x8369('0x61')]=null;}if(_0x318671[_0x8369('0x4d')]&&_[_0x8369('0x62')](_0x318671['body'])){for(var _0x2d3022=0x0;_0x2d3022<_0x318671[_0x8369('0x4d')]['length'];_0x2d3022+=0x1){_0x318671[_0x8369('0x4d')][_0x2d3022][_0x8369('0x59')]=_0x318671[_0x8369('0x49')]['id'];_0xbd79d7['push'](_0x318671['body'][_0x2d3022]);}return BPromise[_0x8369('0x63')](_0xbd79d7,function(_0x183b95){return db[_0x8369('0x60')][_0x8369('0x4c')](_[_0x8369('0x64')](_0x183b95,[_0x8369('0x5e'),'id'])||{},{'fields':_[_0x8369('0x33')](_0x47d6f8),'raw':!![]})['then'](function(_0x4da355){_0x3b6dac[_0x8369('0x65')][_0x8369('0x66')](_0x4da355[_0x8369('0x67')]);})[_0x8369('0x4b')](function(_0x8011cf){_0x3b6dac[_0x8369('0x68')][_0x8369('0x66')]({'data':_0x183b95,'error':_0x8011cf[_0x8369('0x69')]});});})[_0x8369('0x29')](function(_0x20ecb7){return _0x3b6dac;})[_0x8369('0x4b')](function(_0x4dca0b){return _0x4dca0b;});}else{_0x55cab4[_0x8369('0x20')](0x190)['json']({'message':_0x8369('0x6a')});}});}})[_0x8369('0x29')](respondWithResult(_0x55cab4,null))['catch'](handleError(_0x55cab4,null));};exports[_0x8369('0x6b')]=function(_0x6c1fe5,_0x3bf527,_0x12f43a){var _0x4ddb6;return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x6c1fe5[_0x8369('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x8369('0x6c')}]})[_0x8369('0x29')](handleEntityNotFound(_0x3bf527,null))[_0x8369('0x29')](function(_0x5c8a88){if(_0x5c8a88){_0x4ddb6=_0x5c8a88;return db[_0x8369('0x60')][_0x8369('0x4a')];}})[_0x8369('0x29')](function(_0x316a7e){if(_0x316a7e){var _0x1c89ec={};var _0x246f81={};_0x246f81['model']=_[_0x8369('0x6d')](_[_0x8369('0x33')](_0x316a7e),_[_0x8369('0x2e')](_0x4ddb6[_0x8369('0x6c')],function(_0x1469fc){return util[_0x8369('0x6e')](_0x8369('0x6f'),_0x1469fc['id']);}));_0x246f81['query']=_[_0x8369('0x33')](_0x6c1fe5[_0x8369('0x34')]);_0x246f81[_0x8369('0x35')]=_['intersection'](_0x246f81[_0x8369('0x32')],_0x246f81[_0x8369('0x34')]);_0x1c89ec['attributes']=_[_0x8369('0x36')](_0x246f81[_0x8369('0x32')],qs[_0x8369('0x38')](_0x6c1fe5[_0x8369('0x34')][_0x8369('0x38')]));_0x1c89ec['attributes']=_0x1c89ec[_0x8369('0x37')][_0x8369('0x39')]?_0x1c89ec[_0x8369('0x37')]:_0x246f81[_0x8369('0x32')];if(!_0x6c1fe5[_0x8369('0x34')][_0x8369('0x3a')](_0x8369('0x3b'))){_0x1c89ec['limit']=qs[_0x8369('0x22')](_0x6c1fe5[_0x8369('0x34')][_0x8369('0x22')]);_0x1c89ec[_0x8369('0x21')]=qs[_0x8369('0x21')](_0x6c1fe5[_0x8369('0x34')][_0x8369('0x21')]);}_0x1c89ec['order']=qs[_0x8369('0x3d')](_0x6c1fe5[_0x8369('0x34')][_0x8369('0x3d')]);_0x1c89ec[_0x8369('0x40')]=qs[_0x8369('0x35')](_[_0x8369('0x3e')](_0x6c1fe5[_0x8369('0x34')],_0x246f81[_0x8369('0x35')]));_0x1c89ec[_0x8369('0x70')]=!![];if(_0x6c1fe5[_0x8369('0x34')]['filter']){_0x1c89ec[_0x8369('0x40')]=_[_0x8369('0x42')](_0x1c89ec[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x1c89ec[_0x8369('0x37')],function(_0x2d0e73){var _0x8b3e1e={};_0x8b3e1e[_0x2d0e73]={'$like':'%'+_0x6c1fe5[_0x8369('0x34')][_0x8369('0x3f')]+'%'};return _0x8b3e1e;})});}_0x1c89ec=_[_0x8369('0x42')]({},_0x1c89ec,_0x6c1fe5[_0x8369('0x43')]);return _0x4ddb6[_0x8369('0x6b')](_0x1c89ec);}})[_0x8369('0x29')](respondWithResult(_0x3bf527,null))[_0x8369('0x4b')](handleError(_0x3bf527,null));};exports[_0x8369('0x71')]=function(_0x558355,_0x46d029,_0x3cb61e){var _0x5a7ecc;return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x558355['params']['id']},'include':[{'model':db[_0x8369('0x72')],'as':_0x8369('0x6c')}]})[_0x8369('0x29')](handleEntityNotFound(_0x46d029,null))['then'](function(_0x4530bd){if(_0x4530bd){_0x5a7ecc=_0x4530bd;return db[_0x8369('0x60')][_0x8369('0x4a')];}})[_0x8369('0x29')](function(_0x415709){if(_0x415709){var _0x3e455c={};var _0x3951e0={};_0x3951e0[_0x8369('0x32')]=_['concat'](_[_0x8369('0x33')](_0x415709),_['map'](_0x5a7ecc[_0x8369('0x6c')],function(_0x4b98d7){return util[_0x8369('0x6e')](_0x8369('0x6f'),_0x4b98d7['id']);}));_0x3951e0[_0x8369('0x34')]=_['keys'](_0x558355[_0x8369('0x34')]);_0x3951e0[_0x8369('0x35')]=_[_0x8369('0x36')](_0x3951e0[_0x8369('0x32')],_0x3951e0[_0x8369('0x34')]);_0x3e455c['attributes']=_['intersection'](_0x3951e0[_0x8369('0x32')],qs['fields'](_0x558355[_0x8369('0x34')][_0x8369('0x38')]));_0x3e455c[_0x8369('0x37')]=_0x3e455c[_0x8369('0x37')][_0x8369('0x39')]?_0x3e455c[_0x8369('0x37')]:_0x3951e0[_0x8369('0x32')];if(!_0x558355['query']['hasOwnProperty'](_0x8369('0x3b'))){_0x3e455c['limit']=qs[_0x8369('0x22')](_0x558355['query'][_0x8369('0x22')]);_0x3e455c[_0x8369('0x21')]=qs['offset'](_0x558355[_0x8369('0x34')]['offset']);}_0x3e455c[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x558355['query'][_0x8369('0x3d')]);_0x3e455c[_0x8369('0x40')]=qs[_0x8369('0x35')](_[_0x8369('0x3e')](_0x558355[_0x8369('0x34')],_0x3951e0[_0x8369('0x35')]));_0x3e455c[_0x8369('0x70')]=!![];if(_0x558355[_0x8369('0x34')][_0x8369('0x3f')]){_0x3e455c['where']=_[_0x8369('0x42')](_0x3e455c[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x3e455c[_0x8369('0x37')],function(_0x22b2e5){var _0x2f2c29={};_0x2f2c29[_0x22b2e5]={'$like':'%'+_0x558355[_0x8369('0x34')][_0x8369('0x3f')]+'%'};return _0x2f2c29;})});}_0x3e455c=_[_0x8369('0x42')]({},_0x3e455c,_0x558355[_0x8369('0x43')]);return _0x5a7ecc[_0x8369('0x6b')](_0x3e455c);}})['then'](function(_0x17332a){if(!_[_0x8369('0x73')](_0x17332a)){var _0x1fbbeb=toCsv(_0x17332a);var _0x122be4=Date['now']();fs['writeFileSync'](util[_0x8369('0x6e')]('/tmp/list_%d_%s.csv',_0x5a7ecc['id'],_0x122be4),_0x1fbbeb);_0x46d029[_0x8369('0x74')]('Content-disposition',_0x8369('0x75')+util[_0x8369('0x6e')](_0x8369('0x76'),_0x5a7ecc['id'],_0x122be4));_0x46d029[_0x8369('0x74')](_0x8369('0x77'),'text/csv');return _0x46d029['download'](util[_0x8369('0x6e')]('/tmp/list_%d_%s.csv',_0x5a7ecc['id'],_0x122be4));}else{return _0x46d029[_0x8369('0x1e')](0xcc);}})['catch'](handleError(_0x46d029,null));};exports[_0x8369('0x78')]=function(_0x1d4c75,_0x4726ff,_0x3ae0e0){var _0x2b58a8;delete _0x1d4c75['body']['id'];return db['CmList'][_0x8369('0x79')]({'where':{'id':_0x1d4c75[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x4726ff,null))[_0x8369('0x29')](function(_0x5cf71d){if(_0x5cf71d){return db[_0x8369('0x7a')][_0x8369('0x7b')](function(_0x308fa2){return db['CmCustomField'][_0x8369('0x4c')](_0x1d4c75[_0x8369('0x4d')],{'transaction':_0x308fa2})[_0x8369('0x29')](function(_0x465209){_0x2b58a8=_0x465209;return _0x5cf71d[_0x8369('0x7c')](_0x465209,{'transaction':_0x308fa2});})['then'](function(){var _0x186336={'type':db[_0x8369('0x7d')][_0x8369('0x7e')],'transaction':_0x308fa2};switch(_0x1d4c75['body'][_0x8369('0x30')]){case _0x8369('0x7f'):_0x186336[_0x8369('0x30')]=db[_0x8369('0x7d')][_0x8369('0x7e')];break;case'number':_0x186336[_0x8369('0x30')]=db[_0x8369('0x7d')]['INTEGER'];break;case _0x8369('0x80'):_0x186336[_0x8369('0x30')]=db[_0x8369('0x7d')][_0x8369('0x81')];_0x186336[_0x8369('0x82')]=![];break;default:}return db[_0x8369('0x7a')][_0x8369('0x83')][_0x8369('0x84')](_0x8369('0x85'),util['format'](_0x8369('0x86'),_0x2b58a8['id']),_0x186336);})['then'](function(){return _0x2b58a8;});});}})['then'](respondWithResult(_0x4726ff,null))[_0x8369('0x4b')](handleError(_0x4726ff,null));};exports['getCustomFields']=function(_0x16a5bb,_0x4a898b,_0x3f9aa4){var _0x4fda91={};var _0x500844={};var _0xf0cc75;var _0x293eeb;return db['CmList'][_0x8369('0x79')]({'where':{'id':_0x16a5bb[_0x8369('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a898b,null))[_0x8369('0x29')](function(_0x16069d){if(_0x16069d){_0xf0cc75=_0x16069d;_0x500844[_0x8369('0x32')]=_[_0x8369('0x33')](db['CmCustomField'][_0x8369('0x4a')]);_0x500844[_0x8369('0x34')]=_['keys'](_0x16a5bb[_0x8369('0x34')]);_0x500844['filters']=_['intersection'](_0x500844['model'],_0x500844[_0x8369('0x34')]);_0x4fda91[_0x8369('0x37')]=_[_0x8369('0x36')](_0x500844[_0x8369('0x32')],qs[_0x8369('0x38')](_0x16a5bb['query'][_0x8369('0x38')]));_0x4fda91[_0x8369('0x37')]=_0x4fda91[_0x8369('0x37')][_0x8369('0x39')]?_0x4fda91[_0x8369('0x37')]:_0x500844[_0x8369('0x32')];_0x4fda91[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x16a5bb[_0x8369('0x34')][_0x8369('0x3d')]);_0x4fda91[_0x8369('0x40')]=qs['filters'](_['pick'](_0x16a5bb['query'],_0x500844[_0x8369('0x35')]));_0x4fda91[_0x8369('0x40')]=_[_0x8369('0x42')](_0x4fda91[_0x8369('0x40')],{'$or':[{'ListId':_0x16069d['id']},{'ListId':null}]});if(_0x16a5bb[_0x8369('0x34')][_0x8369('0x3f')]){_0x4fda91[_0x8369('0x40')]=_[_0x8369('0x42')](_0x4fda91[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x4fda91[_0x8369('0x37')],function(_0x1e6633){var _0x53b67f={};_0x53b67f[_0x1e6633]={'$like':'%'+_0x16a5bb[_0x8369('0x34')]['filter']+'%'};return _0x53b67f;})});}_0x4fda91=_['merge']({},_0x4fda91,_0x16a5bb[_0x8369('0x43')]);return db[_0x8369('0x72')][_0x8369('0x87')](_0x4fda91);}})[_0x8369('0x29')](respondWithResult(_0x4a898b,null))[_0x8369('0x4b')](handleError(_0x4a898b,null));};exports['addAgents']=function(_0x3ac6a4,_0x5a8acc,_0x57e257){return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x3ac6a4[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x5a8acc,null))[_0x8369('0x29')](function(_0x1dbfdf){if(_0x1dbfdf){return _0x1dbfdf[_0x8369('0x88')](_0x3ac6a4['body'][_0x8369('0x5e')],_['omit'](_0x3ac6a4[_0x8369('0x4d')],[_0x8369('0x5e'),'id'])||{})[_0x8369('0x89')](function(_0x1f3898){for(var _0x14e0c6=0x0;_0x14e0c6<_0x3ac6a4[_0x8369('0x4d')][_0x8369('0x5e')][_0x8369('0x39')];_0x14e0c6+=0x1){socket[_0x8369('0x8a')](_0x8369('0x8b'),{'UserId':_0x3ac6a4['body'][_0x8369('0x5e')][_0x14e0c6],'CmListId':_0x3ac6a4['params']['id']});}return _0x1f3898;});}})[_0x8369('0x29')](respondWithResult(_0x5a8acc,null))['catch'](handleError(_0x5a8acc,null));};exports[_0x8369('0x8c')]=function(_0x444c19,_0x12b811,_0x4a9d18){return db[_0x8369('0x44')][_0x8369('0x53')]({'where':{'id':_0x444c19[_0x8369('0x49')]['id']}})['then'](handleEntityNotFound(_0x12b811,null))[_0x8369('0x29')](function(_0x186a85){if(_0x186a85){return _0x186a85[_0x8369('0x8c')](_0x444c19[_0x8369('0x34')][_0x8369('0x5e')])[_0x8369('0x29')](function(){if(_[_0x8369('0x62')](_0x444c19[_0x8369('0x34')][_0x8369('0x5e')])){for(var _0x38f821=0x0;_0x38f821<_0x444c19['query'][_0x8369('0x5e')][_0x8369('0x39')];_0x38f821+=0x1){socket[_0x8369('0x8a')](_0x8369('0x8d'),{'UserId':Number(_0x444c19[_0x8369('0x34')]['ids'][_0x38f821]),'CmListId':Number(_0x444c19[_0x8369('0x49')]['id'])});}}else{socket[_0x8369('0x8a')](_0x8369('0x8d'),{'UserId':Number(_0x444c19[_0x8369('0x34')][_0x8369('0x5e')]),'CmListId':Number(_0x444c19[_0x8369('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x12b811,null))['catch'](handleError(_0x12b811,null));};exports[_0x8369('0x8e')]=function(_0x1013c8,_0x35767d,_0x23a0e7){var _0x545790={};var _0x5b9104={};var _0x3a2799;var _0x1adc20;return db[_0x8369('0x44')]['findOne']({'where':{'id':_0x1013c8[_0x8369('0x49')]['id']}})[_0x8369('0x29')](handleEntityNotFound(_0x35767d,null))['then'](function(_0x58bee6){if(_0x58bee6){_0x3a2799=_0x58bee6;_0x5b9104[_0x8369('0x32')]=_['keys'](db['User'][_0x8369('0x4a')]);_0x5b9104['query']=_[_0x8369('0x33')](_0x1013c8[_0x8369('0x34')]);_0x5b9104[_0x8369('0x35')]=_[_0x8369('0x36')](_0x5b9104[_0x8369('0x32')],_0x5b9104[_0x8369('0x34')]);_0x545790[_0x8369('0x37')]=_['intersection'](_0x5b9104[_0x8369('0x32')],qs[_0x8369('0x38')](_0x1013c8[_0x8369('0x34')][_0x8369('0x38')]));_0x545790['attributes']=_0x545790[_0x8369('0x37')][_0x8369('0x39')]?_0x545790[_0x8369('0x37')]:_0x5b9104[_0x8369('0x32')];_0x545790[_0x8369('0x3c')]=qs[_0x8369('0x3d')](_0x1013c8[_0x8369('0x34')]['sort']);_0x545790[_0x8369('0x40')]=qs[_0x8369('0x35')](_[_0x8369('0x3e')](_0x1013c8[_0x8369('0x34')],_0x5b9104['filters']));if(_0x1013c8[_0x8369('0x34')]['filter']){_0x545790[_0x8369('0x40')]=_[_0x8369('0x42')](_0x545790[_0x8369('0x40')],{'$or':_[_0x8369('0x2e')](_0x545790[_0x8369('0x37')],function(_0xad0073){var _0x1bbb42={};_0x1bbb42[_0xad0073]={'$like':'%'+_0x1013c8[_0x8369('0x34')][_0x8369('0x3f')]+'%'};return _0x1bbb42;})});}_0x545790=_[_0x8369('0x42')]({},_0x545790,_0x1013c8[_0x8369('0x43')]);return _0x3a2799['getAgents'](_0x545790);}})['then'](function(_0x123a87){if(_0x123a87){_0x1adc20=_0x123a87[_0x8369('0x39')];if(!_0x1013c8[_0x8369('0x34')][_0x8369('0x3a')](_0x8369('0x3b'))){_0x545790[_0x8369('0x22')]=qs[_0x8369('0x22')](_0x1013c8['query'][_0x8369('0x22')]);_0x545790[_0x8369('0x21')]=qs[_0x8369('0x21')](_0x1013c8['query'][_0x8369('0x21')]);}return _0x3a2799['getAgents'](_0x545790);}})[_0x8369('0x29')](function(_0x28a161){if(_0x28a161){return _0x28a161?{'count':_0x1adc20,'rows':_0x28a161}:null;}})[_0x8369('0x29')](respondWithResult(_0x35767d,null))['catch'](handleError(_0x35767d,null));}; \ No newline at end of file +var _0x5ff8=['setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','switch','cm_contacts','cf_%s','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','Lists','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','CmList','includeAll','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','CmContact','describe','tags','isArray','join','push','each','omit','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','options','now','writeFileSync','/tmp/list_%d_%s.csv'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5ff8,0x138));var _0x85ff=function(_0x523fd6,_0xc7eb78){_0x523fd6=_0x523fd6-0x0;var _0x57ffc1=_0x5ff8[_0x523fd6];return _0x57ffc1;};'use strict';var pdf=require(_0x85ff('0x0'));var emlformat=require(_0x85ff('0x1'));var rimraf=require(_0x85ff('0x2'));var zipdir=require(_0x85ff('0x3'));var jsonpatch=require(_0x85ff('0x4'));var rp=require('request-promise');var moment=require(_0x85ff('0x5'));var BPromise=require(_0x85ff('0x6'));var Mustache=require(_0x85ff('0x7'));var util=require(_0x85ff('0x8'));var path=require(_0x85ff('0x9'));var sox=require(_0x85ff('0xa'));var csv=require(_0x85ff('0xb'));var ejs=require(_0x85ff('0xc'));var fs=require('fs');var _=require(_0x85ff('0xd'));var squel=require(_0x85ff('0xe'));var crypto=require(_0x85ff('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x85ff('0x10'));var toCsv=require(_0x85ff('0xb'));var querystring=require(_0x85ff('0x11'));var Papa=require(_0x85ff('0x12'));var Redis=require(_0x85ff('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x85ff('0x14'));var as=require(_0x85ff('0x15'));var hardwareService=require(_0x85ff('0x16'));var logger=require(_0x85ff('0x17'))(_0x85ff('0x18'));var utils=require(_0x85ff('0x19'));var config=require(_0x85ff('0x1a'));var db=require(_0x85ff('0x1b'))['db'];config[_0x85ff('0x1c')]=_[_0x85ff('0x1d')](config[_0x85ff('0x1c')],{'host':_0x85ff('0x1e'),'port':0x18eb});var socket=require(_0x85ff('0x1f'))(new Redis(config[_0x85ff('0x1c')]));require(_0x85ff('0x20'))[_0x85ff('0x21')](socket);function respondWithStatusCode(_0x2d5752,_0x179f73){_0x179f73=_0x179f73||0xcc;return function(_0x28c818){if(_0x28c818){return _0x2d5752[_0x85ff('0x22')](_0x179f73);}return _0x2d5752[_0x85ff('0x23')](_0x179f73)['end']();};}function respondWithResult(_0x40203a,_0x3ae7d7){_0x3ae7d7=_0x3ae7d7||0xc8;return function(_0x40859d){if(_0x40859d){return _0x40203a[_0x85ff('0x23')](_0x3ae7d7)[_0x85ff('0x24')](_0x40859d);}};}function respondWithFilteredResult(_0x3bd395,_0x34f7c2){return function(_0x55634d){if(_0x55634d){var _0x383988=_0x55634d[_0x85ff('0x25')],_0x3e54dc=_0x34f7c2['offset'],_0x4366be=_0x34f7c2[_0x85ff('0x26')]+_0x34f7c2['limit'],_0x24b864;if(_0x4366be>=_0x383988){_0x4366be=_0x383988;_0x24b864=0xc8;}else{_0x24b864=0xce;}_0x3bd395[_0x85ff('0x23')](_0x24b864);return _0x3bd395[_0x85ff('0x27')](_0x85ff('0x28'),_0x3e54dc+'-'+_0x4366be+'/'+_0x383988)['json'](_0x55634d);}return null;};}function patchUpdates(_0x1468e3){return function(_0x4dfd2b){try{jsonpatch['apply'](_0x4dfd2b,_0x1468e3,!![]);}catch(_0xe4156a){return BPromise[_0x85ff('0x29')](_0xe4156a);}return _0x4dfd2b[_0x85ff('0x2a')]();};}function saveUpdates(_0x479f38,_0x2f3f1f){return function(_0x2b65cb){if(_0x2b65cb){return _0x2b65cb[_0x85ff('0x2b')](_0x479f38)[_0x85ff('0x2c')](function(_0x169063){return _0x169063;});}return null;};}function removeEntity(_0x55a361,_0xdbdaba){return function(_0x440350){if(_0x440350){return _0x440350[_0x85ff('0x2d')]()[_0x85ff('0x2c')](function(){var _0x1f5934=_0x440350['get']({'plain':!![]});var _0x1fe0c0=_0x85ff('0x2e');return db[_0x85ff('0x2f')][_0x85ff('0x2d')]({'where':{'type':_0x1fe0c0,'resourceId':_0x1f5934['id']}})[_0x85ff('0x2c')](function(){return _0x440350;});})[_0x85ff('0x2c')](function(){_0x55a361[_0x85ff('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x419057,_0x22362e){return function(_0x327a17){if(!_0x327a17){_0x419057[_0x85ff('0x22')](0x194);}return _0x327a17;};}function handleError(_0x3d2899,_0x341b04){_0x341b04=_0x341b04||0x1f4;return function(_0x1d04ca){logger[_0x85ff('0x30')](_0x1d04ca['stack']);if(_0x1d04ca[_0x85ff('0x31')]){delete _0x1d04ca[_0x85ff('0x31')];}_0x3d2899[_0x85ff('0x23')](_0x341b04)[_0x85ff('0x32')](_0x1d04ca);};}exports[_0x85ff('0x33')]=function(_0x43f972,_0x30cd54){var _0x4021be={},_0x4ba99e={},_0x87e3db={'count':0x0,'rows':[]};var _0x457483=_[_0x85ff('0x34')](db['CmList'][_0x85ff('0x35')],function(_0x5460c7){return{'name':_0x5460c7[_0x85ff('0x36')],'type':_0x5460c7[_0x85ff('0x37')]['key']};});_0x4ba99e[_0x85ff('0x38')]=_[_0x85ff('0x34')](_0x457483,_0x85ff('0x31'));_0x4ba99e['query']=_[_0x85ff('0x39')](_0x43f972[_0x85ff('0x3a')]);_0x4ba99e[_0x85ff('0x3b')]=_[_0x85ff('0x3c')](_0x4ba99e['model'],_0x4ba99e[_0x85ff('0x3a')]);_0x4021be[_0x85ff('0x3d')]=_[_0x85ff('0x3c')](_0x4ba99e[_0x85ff('0x38')],qs[_0x85ff('0x3e')](_0x43f972[_0x85ff('0x3a')]['fields']));_0x4021be[_0x85ff('0x3d')]=_0x4021be[_0x85ff('0x3d')][_0x85ff('0x3f')]?_0x4021be[_0x85ff('0x3d')]:_0x4ba99e['model'];if(!_0x43f972['query']['hasOwnProperty'](_0x85ff('0x40'))){_0x4021be[_0x85ff('0x41')]=qs['limit'](_0x43f972[_0x85ff('0x3a')][_0x85ff('0x41')]);_0x4021be['offset']=qs[_0x85ff('0x26')](_0x43f972[_0x85ff('0x3a')][_0x85ff('0x26')]);}_0x4021be[_0x85ff('0x42')]=qs[_0x85ff('0x43')](_0x43f972[_0x85ff('0x3a')][_0x85ff('0x43')]);_0x4021be['where']=qs[_0x85ff('0x3b')](_[_0x85ff('0x44')](_0x43f972[_0x85ff('0x3a')],_0x4ba99e['filters']),_0x457483);if(_0x43f972[_0x85ff('0x3a')][_0x85ff('0x45')]){_0x4021be[_0x85ff('0x46')]=_['merge'](_0x4021be['where'],{'$or':_[_0x85ff('0x34')](_0x457483,function(_0x2b4092){if(_0x2b4092[_0x85ff('0x37')]!==_0x85ff('0x47')){var _0x1d24a9={};_0x1d24a9[_0x2b4092[_0x85ff('0x31')]]={'$like':'%'+_0x43f972[_0x85ff('0x3a')][_0x85ff('0x45')]+'%'};return _0x1d24a9;}})});}_0x4021be=_[_0x85ff('0x48')]({},_0x4021be,_0x43f972['options']);var _0x70e351={'where':_0x4021be[_0x85ff('0x46')]};return db[_0x85ff('0x49')]['count'](_0x70e351)[_0x85ff('0x2c')](function(_0x5e057b){_0x87e3db[_0x85ff('0x25')]=_0x5e057b;if(_0x43f972[_0x85ff('0x3a')][_0x85ff('0x4a')]){_0x4021be['include']=[{'all':!![]}];}return db[_0x85ff('0x49')]['findAll'](_0x4021be);})[_0x85ff('0x2c')](function(_0x5a6bc8){_0x87e3db['rows']=_0x5a6bc8;return _0x87e3db;})[_0x85ff('0x2c')](respondWithFilteredResult(_0x30cd54,_0x4021be))[_0x85ff('0x4b')](handleError(_0x30cd54,null));};exports[_0x85ff('0x4c')]=function(_0x50fcbd,_0x4660c0){var _0xd612bd={'raw':![],'where':{'id':_0x50fcbd[_0x85ff('0x4d')]['id']}},_0x5360ae={};_0x5360ae[_0x85ff('0x38')]=_[_0x85ff('0x39')](db[_0x85ff('0x49')]['rawAttributes']);_0x5360ae[_0x85ff('0x3a')]=_[_0x85ff('0x39')](_0x50fcbd[_0x85ff('0x3a')]);_0x5360ae['filters']=_[_0x85ff('0x3c')](_0x5360ae[_0x85ff('0x38')],_0x5360ae[_0x85ff('0x3a')]);_0xd612bd[_0x85ff('0x3d')]=_[_0x85ff('0x3c')](_0x5360ae[_0x85ff('0x38')],qs[_0x85ff('0x3e')](_0x50fcbd[_0x85ff('0x3a')]['fields']));_0xd612bd['attributes']=_0xd612bd['attributes'][_0x85ff('0x3f')]?_0xd612bd[_0x85ff('0x3d')]:_0x5360ae['model'];if(_0x50fcbd[_0x85ff('0x3a')][_0x85ff('0x4a')]){_0xd612bd[_0x85ff('0x4e')]=[{'all':!![]}];}_0xd612bd=_[_0x85ff('0x48')]({},_0xd612bd,_0x50fcbd['options']);return db[_0x85ff('0x49')][_0x85ff('0x4f')](_0xd612bd)[_0x85ff('0x2c')](handleEntityNotFound(_0x4660c0,null))[_0x85ff('0x2c')](respondWithResult(_0x4660c0,null))[_0x85ff('0x4b')](handleError(_0x4660c0,null));};exports[_0x85ff('0x50')]=function(_0x583c1a,_0x176f4c){return db['CmList'][_0x85ff('0x50')](_0x583c1a[_0x85ff('0x51')],{})[_0x85ff('0x2c')](function(_0x39c2af){var _0x386ef1=_0x583c1a['user']['get']({'plain':!![]});if(!_0x386ef1)throw new Error(_0x85ff('0x52'));if(_0x386ef1[_0x85ff('0x53')]==='user'){var _0x4f3d84=_0x39c2af[_0x85ff('0x54')]({'plain':!![]});var _0x1f8580=_0x85ff('0x2e');return db[_0x85ff('0x55')]['find']({'where':{'name':_0x1f8580,'userProfileId':_0x386ef1['userProfileId']},'raw':!![]})[_0x85ff('0x2c')](function(_0x1256c2){if(_0x1256c2&&_0x1256c2[_0x85ff('0x56')]===0x0){return db[_0x85ff('0x2f')][_0x85ff('0x50')]({'name':_0x4f3d84['name'],'resourceId':_0x4f3d84['id'],'type':_0x1256c2[_0x85ff('0x31')],'sectionId':_0x1256c2['id']},{})[_0x85ff('0x2c')](function(){return _0x39c2af;});}else{return _0x39c2af;}})['catch'](function(_0x2e2472){logger['error'](_0x85ff('0x57'),_0x2e2472);throw _0x2e2472;});}return _0x39c2af;})[_0x85ff('0x2c')](respondWithResult(_0x176f4c,0xc9))[_0x85ff('0x4b')](handleError(_0x176f4c,null));};exports[_0x85ff('0x2b')]=function(_0x1e8152,_0x4fd08a){if(_0x1e8152[_0x85ff('0x51')]['id']){delete _0x1e8152[_0x85ff('0x51')]['id'];}return db[_0x85ff('0x49')]['find']({'where':{'id':_0x1e8152[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x4fd08a,null))[_0x85ff('0x2c')](saveUpdates(_0x1e8152[_0x85ff('0x51')],null))[_0x85ff('0x2c')](respondWithResult(_0x4fd08a,null))[_0x85ff('0x4b')](handleError(_0x4fd08a,null));};exports[_0x85ff('0x2d')]=function(_0x3fbe15,_0x3fe04f){return db[_0x85ff('0x49')][_0x85ff('0x4f')]({'where':{'id':_0x3fbe15[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x3fe04f,null))[_0x85ff('0x2c')](removeEntity(_0x3fe04f,null))[_0x85ff('0x4b')](handleError(_0x3fe04f,null));};exports['describe']=function(_0x119660,_0x142f20){return db[_0x85ff('0x49')]['describe']()[_0x85ff('0x2c')](respondWithResult(_0x142f20,null))['catch'](handleError(_0x142f20,null));};exports[_0x85ff('0x58')]=function(_0x469428,_0x57e0cb,_0x22cee3){if(_0x469428[_0x85ff('0x51')]['id']){delete _0x469428[_0x85ff('0x51')]['id'];}return db['CmList']['find']({'where':{'id':_0x469428[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x57e0cb,null))[_0x85ff('0x2c')](function(_0x71dfa0){if(_0x71dfa0){_0x469428[_0x85ff('0x51')][_0x85ff('0x59')]=_0x71dfa0['id'];return db[_0x85ff('0x5a')][_0x85ff('0x50')](_0x469428[_0x85ff('0x51')]);}})[_0x85ff('0x2c')](respondWithResult(_0x57e0cb,null))['catch'](handleError(_0x57e0cb,null));};exports[_0x85ff('0x5b')]=function(_0x5913ae,_0x12b768,_0x1ae02e){var _0xe85ed2={'raw':![],'where':{}};var _0x190b01={};var _0x3e036c={'count':0x0,'rows':[]};return db[_0x85ff('0x49')][_0x85ff('0x5c')]({'where':{'id':_0x5913ae[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x12b768,null))['then'](function(_0x4c7c6e){if(_0x4c7c6e){_0x190b01[_0x85ff('0x38')]=_['keys'](db['Disposition'][_0x85ff('0x35')]);_0x190b01['query']=_[_0x85ff('0x39')](_0x5913ae['query']);_0x190b01[_0x85ff('0x3b')]=_[_0x85ff('0x3c')](_0x190b01['model'],_0x190b01[_0x85ff('0x3a')]);_0xe85ed2[_0x85ff('0x3d')]=_[_0x85ff('0x3c')](_0x190b01[_0x85ff('0x38')],qs['fields'](_0x5913ae[_0x85ff('0x3a')][_0x85ff('0x3e')]));_0xe85ed2[_0x85ff('0x3d')]=_0xe85ed2[_0x85ff('0x3d')][_0x85ff('0x3f')]?_0xe85ed2[_0x85ff('0x3d')]:_0x190b01[_0x85ff('0x38')];if(!_0x5913ae['query'][_0x85ff('0x5d')](_0x85ff('0x40'))){_0xe85ed2[_0x85ff('0x41')]=qs['limit'](_0x5913ae[_0x85ff('0x3a')][_0x85ff('0x41')]);_0xe85ed2[_0x85ff('0x26')]=qs['offset'](_0x5913ae[_0x85ff('0x3a')][_0x85ff('0x26')]);}_0xe85ed2['order']=qs[_0x85ff('0x43')](_0x5913ae[_0x85ff('0x3a')][_0x85ff('0x43')]);_0xe85ed2[_0x85ff('0x46')]=qs['filters'](_['pick'](_0x5913ae[_0x85ff('0x3a')],_0x190b01[_0x85ff('0x3b')]));_0xe85ed2['where'][_0x85ff('0x59')]=_0x4c7c6e['id'];if(_0x5913ae[_0x85ff('0x3a')][_0x85ff('0x45')]){_0xe85ed2[_0x85ff('0x46')]=_[_0x85ff('0x48')](_0xe85ed2['where'],{'$or':_[_0x85ff('0x34')](_0xe85ed2[_0x85ff('0x3d')],function(_0x467d2e){var _0x34c5ca={};_0x34c5ca[_0x467d2e]={'$like':'%'+_0x5913ae['query'][_0x85ff('0x45')]+'%'};return _0x34c5ca;})});}_0xe85ed2=_['merge']({},_0xe85ed2,_0x5913ae['options']);return db['Disposition']['count']({'where':_0xe85ed2[_0x85ff('0x46')]})[_0x85ff('0x2c')](function(_0x6e4187){_0x3e036c[_0x85ff('0x25')]=_0x6e4187;if(_0x5913ae[_0x85ff('0x3a')]['includeAll']){_0xe85ed2[_0x85ff('0x4e')]=[{'all':!![]}];}return db[_0x85ff('0x5a')]['findAll'](_0xe85ed2);})[_0x85ff('0x2c')](function(_0x260321){_0x3e036c[_0x85ff('0x5e')]=_0x260321;return _0x3e036c;});}})[_0x85ff('0x2c')](respondWithFilteredResult(_0x12b768,_0xe85ed2))[_0x85ff('0x4b')](handleError(_0x12b768,null));};exports[_0x85ff('0x5f')]=function(_0x1fe4aa,_0x367159,_0x297007){return db[_0x85ff('0x49')][_0x85ff('0x4f')]({'where':{'id':_0x1fe4aa[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x367159,null))[_0x85ff('0x2c')](function(_0x7144f8){if(_0x7144f8){return _0x7144f8[_0x85ff('0x5f')](_0x1fe4aa['query'][_0x85ff('0x60')]);}})[_0x85ff('0x2c')](respondWithStatusCode(_0x367159,null))[_0x85ff('0x4b')](handleError(_0x367159,null));};exports['addContacts']=function(_0x75f4e2,_0x123991,_0x1fc23a){return db['CmList'][_0x85ff('0x4f')]({'where':{'id':_0x75f4e2['params']['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x123991,null))[_0x85ff('0x2c')](function(_0x5c7155){if(_0x5c7155){var _0x6b2c19=[];var _0x3e6d69={'success':[],'errors':[]};return db[_0x85ff('0x61')][_0x85ff('0x62')]()[_0x85ff('0x2c')](function(_0xfcce80){if(_0x75f4e2[_0x85ff('0x51')][_0x85ff('0x63')]&&_[_0x85ff('0x64')](_0x75f4e2['body']['tags'])){if(_0x75f4e2['body'][_0x85ff('0x63')][_0x85ff('0x3f')]){_0x75f4e2[_0x85ff('0x51')][_0x85ff('0x63')]=_0x75f4e2[_0x85ff('0x51')][_0x85ff('0x63')][_0x85ff('0x65')](';')+';';}else{_0x75f4e2[_0x85ff('0x51')][_0x85ff('0x63')]=null;}}else{_0x75f4e2[_0x85ff('0x51')][_0x85ff('0x63')]=null;}if(_0x75f4e2[_0x85ff('0x51')]&&_[_0x85ff('0x64')](_0x75f4e2[_0x85ff('0x51')])){for(var _0x28a7d6=0x0;_0x28a7d6<_0x75f4e2[_0x85ff('0x51')]['length'];_0x28a7d6+=0x1){_0x75f4e2[_0x85ff('0x51')][_0x28a7d6][_0x85ff('0x59')]=_0x75f4e2[_0x85ff('0x4d')]['id'];_0x6b2c19[_0x85ff('0x66')](_0x75f4e2['body'][_0x28a7d6]);}return BPromise[_0x85ff('0x67')](_0x6b2c19,function(_0x1d8856){return db['CmContact'][_0x85ff('0x50')](_[_0x85ff('0x68')](_0x1d8856,[_0x85ff('0x60'),'id'])||{},{'fields':_[_0x85ff('0x39')](_0xfcce80),'raw':!![]})[_0x85ff('0x2c')](function(_0x418730){_0x3e6d69['success']['push'](_0x418730[_0x85ff('0x69')]);})[_0x85ff('0x4b')](function(_0x6add19){_0x3e6d69['errors']['push']({'data':_0x1d8856,'error':_0x6add19[_0x85ff('0x6a')]});});})['then'](function(_0xd2ec2f){return _0x3e6d69;})[_0x85ff('0x4b')](function(_0xf9214a){return _0xf9214a;});}else{_0x123991[_0x85ff('0x23')](0x190)[_0x85ff('0x24')]({'message':_0x85ff('0x6b')});}});}})[_0x85ff('0x2c')](respondWithResult(_0x123991,null))[_0x85ff('0x4b')](handleError(_0x123991,null));};exports[_0x85ff('0x6c')]=function(_0x4331a2,_0x5b94d3,_0x4a3e2e){var _0x10294a;return db[_0x85ff('0x49')][_0x85ff('0x4f')]({'where':{'id':_0x4331a2[_0x85ff('0x4d')]['id']},'include':[{'model':db[_0x85ff('0x6d')],'as':_0x85ff('0x6e')}]})[_0x85ff('0x2c')](handleEntityNotFound(_0x5b94d3,null))[_0x85ff('0x2c')](function(_0x4e9c8f){if(_0x4e9c8f){_0x10294a=_0x4e9c8f;return db[_0x85ff('0x61')][_0x85ff('0x35')];}})[_0x85ff('0x2c')](function(_0x352764){if(_0x352764){var _0x15870f={};var _0x33210d={};_0x33210d[_0x85ff('0x38')]=_[_0x85ff('0x6f')](_['keys'](_0x352764),_[_0x85ff('0x34')](_0x10294a[_0x85ff('0x6e')],function(_0xcd72f5){return util[_0x85ff('0x70')](_0x85ff('0x71'),_0xcd72f5['id']);}));_0x33210d['query']=_[_0x85ff('0x39')](_0x4331a2[_0x85ff('0x3a')]);_0x33210d[_0x85ff('0x3b')]=_[_0x85ff('0x3c')](_0x33210d[_0x85ff('0x38')],_0x33210d[_0x85ff('0x3a')]);_0x15870f[_0x85ff('0x3d')]=_[_0x85ff('0x3c')](_0x33210d[_0x85ff('0x38')],qs[_0x85ff('0x3e')](_0x4331a2[_0x85ff('0x3a')][_0x85ff('0x3e')]));_0x15870f['attributes']=_0x15870f[_0x85ff('0x3d')][_0x85ff('0x3f')]?_0x15870f[_0x85ff('0x3d')]:_0x33210d[_0x85ff('0x38')];if(!_0x4331a2[_0x85ff('0x3a')]['hasOwnProperty']('nolimit')){_0x15870f[_0x85ff('0x41')]=qs['limit'](_0x4331a2[_0x85ff('0x3a')][_0x85ff('0x41')]);_0x15870f['offset']=qs['offset'](_0x4331a2[_0x85ff('0x3a')]['offset']);}_0x15870f[_0x85ff('0x42')]=qs['sort'](_0x4331a2[_0x85ff('0x3a')][_0x85ff('0x43')]);_0x15870f['where']=qs[_0x85ff('0x3b')](_[_0x85ff('0x44')](_0x4331a2[_0x85ff('0x3a')],_0x33210d[_0x85ff('0x3b')]));_0x15870f[_0x85ff('0x72')]=!![];if(_0x4331a2[_0x85ff('0x3a')][_0x85ff('0x45')]){_0x15870f[_0x85ff('0x46')]=_[_0x85ff('0x48')](_0x15870f[_0x85ff('0x46')],{'$or':_[_0x85ff('0x34')](_0x15870f[_0x85ff('0x3d')],function(_0x3ae4c8){var _0x26ba1b={};_0x26ba1b[_0x3ae4c8]={'$like':'%'+_0x4331a2['query'][_0x85ff('0x45')]+'%'};return _0x26ba1b;})});}_0x15870f=_[_0x85ff('0x48')]({},_0x15870f,_0x4331a2['options']);return _0x10294a['getContacts'](_0x15870f);}})['then'](respondWithResult(_0x5b94d3,null))[_0x85ff('0x4b')](handleError(_0x5b94d3,null));};exports[_0x85ff('0x73')]=function(_0x29ed6b,_0x560bdd,_0x4193ff){var _0x2a58af;return db[_0x85ff('0x49')][_0x85ff('0x4f')]({'where':{'id':_0x29ed6b['params']['id']},'include':[{'model':db[_0x85ff('0x6d')],'as':_0x85ff('0x6e')}]})['then'](handleEntityNotFound(_0x560bdd,null))[_0x85ff('0x2c')](function(_0x19fd7a){if(_0x19fd7a){_0x2a58af=_0x19fd7a;return db['CmContact'][_0x85ff('0x35')];}})[_0x85ff('0x2c')](function(_0x5e212b){if(_0x5e212b){var _0x253b53={};var _0x521e1b={};_0x521e1b[_0x85ff('0x38')]=_[_0x85ff('0x6f')](_[_0x85ff('0x39')](_0x5e212b),_['map'](_0x2a58af['CustomFields'],function(_0x491108){return util[_0x85ff('0x70')]('cf_%d',_0x491108['id']);}));_0x521e1b['query']=_[_0x85ff('0x39')](_0x29ed6b[_0x85ff('0x3a')]);_0x521e1b[_0x85ff('0x3b')]=_['intersection'](_0x521e1b[_0x85ff('0x38')],_0x521e1b[_0x85ff('0x3a')]);_0x253b53['attributes']=_[_0x85ff('0x3c')](_0x521e1b[_0x85ff('0x38')],qs[_0x85ff('0x3e')](_0x29ed6b[_0x85ff('0x3a')][_0x85ff('0x3e')]));_0x253b53[_0x85ff('0x3d')]=_0x253b53['attributes'][_0x85ff('0x3f')]?_0x253b53[_0x85ff('0x3d')]:_0x521e1b[_0x85ff('0x38')];if(!_0x29ed6b[_0x85ff('0x3a')]['hasOwnProperty'](_0x85ff('0x40'))){_0x253b53[_0x85ff('0x41')]=qs[_0x85ff('0x41')](_0x29ed6b[_0x85ff('0x3a')][_0x85ff('0x41')]);_0x253b53[_0x85ff('0x26')]=qs[_0x85ff('0x26')](_0x29ed6b[_0x85ff('0x3a')]['offset']);}_0x253b53[_0x85ff('0x42')]=qs[_0x85ff('0x43')](_0x29ed6b[_0x85ff('0x3a')]['sort']);_0x253b53[_0x85ff('0x46')]=qs[_0x85ff('0x3b')](_['pick'](_0x29ed6b[_0x85ff('0x3a')],_0x521e1b[_0x85ff('0x3b')]));_0x253b53[_0x85ff('0x72')]=!![];if(_0x29ed6b[_0x85ff('0x3a')][_0x85ff('0x45')]){_0x253b53['where']=_[_0x85ff('0x48')](_0x253b53[_0x85ff('0x46')],{'$or':_['map'](_0x253b53[_0x85ff('0x3d')],function(_0x4c56ff){var _0x5abea4={};_0x5abea4[_0x4c56ff]={'$like':'%'+_0x29ed6b['query'][_0x85ff('0x45')]+'%'};return _0x5abea4;})});}_0x253b53=_['merge']({},_0x253b53,_0x29ed6b[_0x85ff('0x74')]);return _0x2a58af[_0x85ff('0x6c')](_0x253b53);}})[_0x85ff('0x2c')](function(_0x566a8c){if(!_['isEmpty'](_0x566a8c)){var _0x592715=toCsv(_0x566a8c);var _0x2513c5=Date[_0x85ff('0x75')]();fs[_0x85ff('0x76')](util['format'](_0x85ff('0x77'),_0x2a58af['id'],_0x2513c5),_0x592715);_0x560bdd[_0x85ff('0x78')](_0x85ff('0x79'),_0x85ff('0x7a')+util[_0x85ff('0x70')](_0x85ff('0x7b'),_0x2a58af['id'],_0x2513c5));_0x560bdd['setHeader'](_0x85ff('0x7c'),'text/csv');return _0x560bdd[_0x85ff('0x7d')](util[_0x85ff('0x70')]('/tmp/list_%d_%s.csv',_0x2a58af['id'],_0x2513c5));}else{return _0x560bdd[_0x85ff('0x22')](0xcc);}})[_0x85ff('0x4b')](handleError(_0x560bdd,null));};exports[_0x85ff('0x7e')]=function(_0x583ec5,_0x334668,_0x4f3236){var _0x5e9b3f;delete _0x583ec5[_0x85ff('0x51')]['id'];return db[_0x85ff('0x49')][_0x85ff('0x5c')]({'where':{'id':_0x583ec5['params']['id']}})['then'](handleEntityNotFound(_0x334668,null))[_0x85ff('0x2c')](function(_0x2652a6){if(_0x2652a6){return db[_0x85ff('0x7f')][_0x85ff('0x80')](function(_0x3cd70d){return db['CmCustomField'][_0x85ff('0x50')](_0x583ec5[_0x85ff('0x51')],{'transaction':_0x3cd70d})[_0x85ff('0x2c')](function(_0x4ebc67){_0x5e9b3f=_0x4ebc67;return _0x2652a6[_0x85ff('0x81')](_0x4ebc67,{'transaction':_0x3cd70d});})['then'](function(){var _0x4c4a49={'type':db[_0x85ff('0x82')][_0x85ff('0x83')],'transaction':_0x3cd70d};switch(_0x583ec5['body'][_0x85ff('0x37')]){case _0x85ff('0x84'):_0x4c4a49['type']=db[_0x85ff('0x82')][_0x85ff('0x83')];break;case'number':_0x4c4a49[_0x85ff('0x37')]=db[_0x85ff('0x82')]['INTEGER'];break;case _0x85ff('0x85'):_0x4c4a49['type']=db['Sequelize']['BOOLEAN'];_0x4c4a49['defaultValue']=![];break;default:}return db[_0x85ff('0x7f')]['queryInterface']['addColumn'](_0x85ff('0x86'),util[_0x85ff('0x70')](_0x85ff('0x87'),_0x5e9b3f['id']),_0x4c4a49);})[_0x85ff('0x2c')](function(){return _0x5e9b3f;});});}})['then'](respondWithResult(_0x334668,null))['catch'](handleError(_0x334668,null));};exports['getCustomFields']=function(_0x3a87ad,_0x189ce8,_0x3b1bf4){var _0x9ee804={};var _0x15ca43={};var _0x525416;var _0x884358;return db['CmList'][_0x85ff('0x5c')]({'where':{'id':_0x3a87ad[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x189ce8,null))[_0x85ff('0x2c')](function(_0x19c6e4){if(_0x19c6e4){_0x525416=_0x19c6e4;_0x15ca43[_0x85ff('0x38')]=_[_0x85ff('0x39')](db[_0x85ff('0x6d')][_0x85ff('0x35')]);_0x15ca43[_0x85ff('0x3a')]=_[_0x85ff('0x39')](_0x3a87ad[_0x85ff('0x3a')]);_0x15ca43[_0x85ff('0x3b')]=_[_0x85ff('0x3c')](_0x15ca43[_0x85ff('0x38')],_0x15ca43[_0x85ff('0x3a')]);_0x9ee804[_0x85ff('0x3d')]=_[_0x85ff('0x3c')](_0x15ca43[_0x85ff('0x38')],qs[_0x85ff('0x3e')](_0x3a87ad[_0x85ff('0x3a')][_0x85ff('0x3e')]));_0x9ee804[_0x85ff('0x3d')]=_0x9ee804['attributes'][_0x85ff('0x3f')]?_0x9ee804['attributes']:_0x15ca43[_0x85ff('0x38')];_0x9ee804[_0x85ff('0x42')]=qs[_0x85ff('0x43')](_0x3a87ad[_0x85ff('0x3a')][_0x85ff('0x43')]);_0x9ee804[_0x85ff('0x46')]=qs['filters'](_[_0x85ff('0x44')](_0x3a87ad[_0x85ff('0x3a')],_0x15ca43[_0x85ff('0x3b')]));_0x9ee804['where']=_['merge'](_0x9ee804[_0x85ff('0x46')],{'$or':[{'ListId':_0x19c6e4['id']},{'ListId':null}]});if(_0x3a87ad[_0x85ff('0x3a')]['filter']){_0x9ee804[_0x85ff('0x46')]=_['merge'](_0x9ee804[_0x85ff('0x46')],{'$or':_['map'](_0x9ee804['attributes'],function(_0x33d528){var _0x281fa6={};_0x281fa6[_0x33d528]={'$like':'%'+_0x3a87ad[_0x85ff('0x3a')][_0x85ff('0x45')]+'%'};return _0x281fa6;})});}_0x9ee804=_[_0x85ff('0x48')]({},_0x9ee804,_0x3a87ad['options']);return db[_0x85ff('0x6d')][_0x85ff('0x88')](_0x9ee804);}})['then'](respondWithResult(_0x189ce8,null))[_0x85ff('0x4b')](handleError(_0x189ce8,null));};exports['addAgents']=function(_0x52bd77,_0x22b18a,_0x525c5a){return db[_0x85ff('0x49')]['find']({'where':{'id':_0x52bd77[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x22b18a,null))[_0x85ff('0x2c')](function(_0x3df4d5){if(_0x3df4d5){return _0x3df4d5[_0x85ff('0x89')](_0x52bd77[_0x85ff('0x51')][_0x85ff('0x60')],_[_0x85ff('0x68')](_0x52bd77['body'],[_0x85ff('0x60'),'id'])||{})['spread'](function(_0x58cba8){for(var _0x1bbec9=0x0;_0x1bbec9<_0x52bd77[_0x85ff('0x51')][_0x85ff('0x60')][_0x85ff('0x3f')];_0x1bbec9+=0x1){socket[_0x85ff('0x8a')](_0x85ff('0x8b'),{'UserId':_0x52bd77[_0x85ff('0x51')]['ids'][_0x1bbec9],'CmListId':_0x52bd77[_0x85ff('0x4d')]['id']});}return _0x58cba8;});}})[_0x85ff('0x2c')](respondWithResult(_0x22b18a,null))[_0x85ff('0x4b')](handleError(_0x22b18a,null));};exports[_0x85ff('0x8c')]=function(_0x143c3d,_0x4e7e93,_0x1e5094){return db[_0x85ff('0x49')][_0x85ff('0x4f')]({'where':{'id':_0x143c3d[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x4e7e93,null))[_0x85ff('0x2c')](function(_0xa5e249){if(_0xa5e249){return _0xa5e249[_0x85ff('0x8c')](_0x143c3d[_0x85ff('0x3a')][_0x85ff('0x60')])[_0x85ff('0x2c')](function(){if(_[_0x85ff('0x64')](_0x143c3d[_0x85ff('0x3a')][_0x85ff('0x60')])){for(var _0x49a824=0x0;_0x49a824<_0x143c3d[_0x85ff('0x3a')]['ids'][_0x85ff('0x3f')];_0x49a824+=0x1){socket[_0x85ff('0x8a')]('userCmList:remove',{'UserId':Number(_0x143c3d[_0x85ff('0x3a')]['ids'][_0x49a824]),'CmListId':Number(_0x143c3d['params']['id'])});}}else{socket[_0x85ff('0x8a')](_0x85ff('0x8d'),{'UserId':Number(_0x143c3d['query'][_0x85ff('0x60')]),'CmListId':Number(_0x143c3d[_0x85ff('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e7e93,null))['catch'](handleError(_0x4e7e93,null));};exports[_0x85ff('0x8e')]=function(_0x4f89ea,_0x13784a,_0x3e3946){var _0x2adc8a={};var _0xd54bba={};var _0x5903ab;var _0x3ef69d;return db[_0x85ff('0x49')][_0x85ff('0x5c')]({'where':{'id':_0x4f89ea[_0x85ff('0x4d')]['id']}})[_0x85ff('0x2c')](handleEntityNotFound(_0x13784a,null))[_0x85ff('0x2c')](function(_0x48afa6){if(_0x48afa6){_0x5903ab=_0x48afa6;_0xd54bba[_0x85ff('0x38')]=_[_0x85ff('0x39')](db[_0x85ff('0x8f')][_0x85ff('0x35')]);_0xd54bba[_0x85ff('0x3a')]=_['keys'](_0x4f89ea['query']);_0xd54bba[_0x85ff('0x3b')]=_[_0x85ff('0x3c')](_0xd54bba[_0x85ff('0x38')],_0xd54bba[_0x85ff('0x3a')]);_0x2adc8a['attributes']=_[_0x85ff('0x3c')](_0xd54bba[_0x85ff('0x38')],qs['fields'](_0x4f89ea[_0x85ff('0x3a')]['fields']));_0x2adc8a[_0x85ff('0x3d')]=_0x2adc8a[_0x85ff('0x3d')][_0x85ff('0x3f')]?_0x2adc8a[_0x85ff('0x3d')]:_0xd54bba[_0x85ff('0x38')];_0x2adc8a['order']=qs['sort'](_0x4f89ea[_0x85ff('0x3a')][_0x85ff('0x43')]);_0x2adc8a[_0x85ff('0x46')]=qs['filters'](_[_0x85ff('0x44')](_0x4f89ea[_0x85ff('0x3a')],_0xd54bba['filters']));if(_0x4f89ea['query']['filter']){_0x2adc8a[_0x85ff('0x46')]=_[_0x85ff('0x48')](_0x2adc8a[_0x85ff('0x46')],{'$or':_['map'](_0x2adc8a['attributes'],function(_0x109498){var _0x22afc0={};_0x22afc0[_0x109498]={'$like':'%'+_0x4f89ea['query'][_0x85ff('0x45')]+'%'};return _0x22afc0;})});}_0x2adc8a=_[_0x85ff('0x48')]({},_0x2adc8a,_0x4f89ea[_0x85ff('0x74')]);return _0x5903ab[_0x85ff('0x8e')](_0x2adc8a);}})['then'](function(_0x27325f){if(_0x27325f){_0x3ef69d=_0x27325f[_0x85ff('0x3f')];if(!_0x4f89ea['query']['hasOwnProperty'](_0x85ff('0x40'))){_0x2adc8a['limit']=qs[_0x85ff('0x41')](_0x4f89ea[_0x85ff('0x3a')][_0x85ff('0x41')]);_0x2adc8a[_0x85ff('0x26')]=qs[_0x85ff('0x26')](_0x4f89ea['query'][_0x85ff('0x26')]);}return _0x5903ab['getAgents'](_0x2adc8a);}})[_0x85ff('0x2c')](function(_0x149cdb){if(_0x149cdb){return _0x149cdb?{'count':_0x3ef69d,'rows':_0x149cdb}:null;}})[_0x85ff('0x2c')](respondWithResult(_0x13784a,null))['catch'](handleError(_0x13784a,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 90c1f3f..b8c973c 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 _0xb3c5=['remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xd16d26,_0x5c4e33){var _0x40e3e1=function(_0x11071b){while(--_0x11071b){_0xd16d26['push'](_0xd16d26['shift']());}};_0x40e3e1(++_0x5c4e33);}(_0xb3c5,0xb9));var _0x5b3c=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0xb3c5[_0x1d5400];return _0x21d9fe;};'use strict';var EventEmitter=require(_0x5b3c('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5b3c('0x1')};function emitEvent(_0x3333f2){return function(_0x223225,_0x4dc2e5,_0xb85125){CmListEvents[_0x5b3c('0x2')](_0x3333f2+':'+_0x223225['id'],_0x223225);CmListEvents[_0x5b3c('0x2')](_0x3333f2,_0x223225);_0xb85125(null);};}for(var e in events){if(events[_0x5b3c('0x3')](e)){var event=events[e];CmList[_0x5b3c('0x4')](e,emitEvent(event));}}module[_0x5b3c('0x5')]=CmListEvents; \ No newline at end of file +var _0x04d0=['../../mysqldb','CmList','setMaxListeners','save','emit','hasOwnProperty','events'];(function(_0x3a22bd,_0x5cafa5){var _0x5a6411=function(_0x3a36b3){while(--_0x3a36b3){_0x3a22bd['push'](_0x3a22bd['shift']());}};_0x5a6411(++_0x5cafa5);}(_0x04d0,0x164));var _0x004d=function(_0x47915d,_0x28cc67){_0x47915d=_0x47915d-0x0;var _0x438851=_0x04d0[_0x47915d];return _0x438851;};'use strict';var EventEmitter=require(_0x004d('0x0'));var CmList=require(_0x004d('0x1'))['db'][_0x004d('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x004d('0x3')](0x0);var events={'afterCreate':_0x004d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a61f8){return function(_0x5ea76e,_0x50ce33,_0x3172e6){CmListEvents[_0x004d('0x5')](_0x5a61f8+':'+_0x5ea76e['id'],_0x5ea76e);CmListEvents[_0x004d('0x5')](_0x5a61f8,_0x5ea76e);_0x3172e6(null);};}for(var e in events){if(events[_0x004d('0x6')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5027c58..39d2977 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 _0x24e3=['bluebird','request-promise','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','api'];(function(_0x13594e,_0x6f0ed0){var _0x1a4f42=function(_0x30b064){while(--_0x30b064){_0x13594e['push'](_0x13594e['shift']());}};_0x1a4f42(++_0x6f0ed0);}(_0x24e3,0x168));var _0x324e=function(_0x53a4d8,_0x446a35){_0x53a4d8=_0x53a4d8-0x0;var _0xe97cbd=_0x24e3[_0x53a4d8];return _0xe97cbd;};'use strict';var _=require(_0x324e('0x0'));var util=require('util');var logger=require(_0x324e('0x1'))(_0x324e('0x2'));var moment=require('moment');var BPromise=require(_0x324e('0x3'));var rp=require(_0x324e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x324e('0x5'));var attributes=require(_0x324e('0x6'));module[_0x324e('0x7')]=function(_0x2f51f4,_0x1bea19){return _0x2f51f4[_0x324e('0x8')](_0x324e('0x9'),attributes,{'tableName':_0x324e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da6=['exports','define','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmList.attributes'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7da6,0x124));var _0x67da=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x7da6[_0x30bd66];return _0x74c9dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x67da('0x0'))(_0x67da('0x1'));var moment=require(_0x67da('0x2'));var BPromise=require(_0x67da('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67da('0x4'));var rimraf=require(_0x67da('0x5'));var config=require(_0x67da('0x6'));var attributes=require(_0x67da('0x7'));module[_0x67da('0x8')]=function(_0x40d5f8,_0x59af9a){return _0x40d5f8[_0x67da('0x9')]('CmList',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 af1bb37..1a2f1db 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 _0x86cd=['stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2bf31e,_0x3d5db7){var _0x528176=function(_0x4f8d63){while(--_0x4f8d63){_0x2bf31e['push'](_0x2bf31e['shift']());}};_0x528176(++_0x3d5db7);}(_0x86cd,0x12e));var _0xd86c=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x86cd[_0xb6e43];return _0x47c40f;};'use strict';var _=require(_0xd86c('0x0'));var util=require(_0xd86c('0x1'));var moment=require(_0xd86c('0x2'));var BPromise=require(_0xd86c('0x3'));var rs=require(_0xd86c('0x4'));var fs=require('fs');var Redis=require(_0xd86c('0x5'));var db=require(_0xd86c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd86c('0x7'))(_0xd86c('0x8'));var config=require(_0xd86c('0x9'));var jayson=require(_0xd86c('0xa'));var client=jayson['client'][_0xd86c('0xb')]({'port':0x232a});config[_0xd86c('0xc')]=_['defaults'](config['redis'],{'host':_0xd86c('0xd'),'port':0x18eb});var socket=require(_0xd86c('0xe'))(new Redis(config[_0xd86c('0xc')]));require(_0xd86c('0xf'))[_0xd86c('0x10')](socket);function respondWithRpcPromise(_0x58d004,_0xa768e,_0x229a58){return new BPromise(function(_0x397001,_0x13e0a9){return client['request'](_0x58d004,_0x229a58)['then'](function(_0x5c30a0){logger[_0xd86c('0x11')](_0xd86c('0x12'),_0xa768e,'request\x20sent');logger[_0xd86c('0x13')](_0xd86c('0x14'),_0xa768e,_0xd86c('0x15'),JSON[_0xd86c('0x16')](_0x5c30a0));if(_0x5c30a0['error']){if(_0x5c30a0['error'][_0xd86c('0x17')]===0x1f4){logger[_0xd86c('0x18')](_0xd86c('0x12'),_0xa768e,_0x5c30a0['error'][_0xd86c('0x19')]);return _0x13e0a9(_0x5c30a0[_0xd86c('0x18')]['message']);}logger[_0xd86c('0x18')](_0xd86c('0x12'),_0xa768e,_0x5c30a0[_0xd86c('0x18')][_0xd86c('0x19')]);return _0x397001(_0x5c30a0[_0xd86c('0x18')]['message']);}else{logger[_0xd86c('0x11')](_0xd86c('0x12'),_0xa768e,'request\x20sent');_0x397001(_0x5c30a0['result'][_0xd86c('0x19')]);}})[_0xd86c('0x1a')](function(_0x4cd3b5){logger[_0xd86c('0x18')](_0xd86c('0x12'),_0xa768e,_0x4cd3b5);_0x13e0a9(_0x4cd3b5);});});} \ No newline at end of file +var _0xd874=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','CmList,\x20%s,\x20%s','message','result','lodash'];(function(_0x220f7d,_0x6be322){var _0x2dbe6a=function(_0x35e6d7){while(--_0x35e6d7){_0x220f7d['push'](_0x220f7d['shift']());}};_0x2dbe6a(++_0x6be322);}(_0xd874,0x7c));var _0x4d87=function(_0x52a7f0,_0x163c8e){_0x52a7f0=_0x52a7f0-0x0;var _0x178e32=_0xd874[_0x52a7f0];return _0x178e32;};'use strict';var _=require(_0x4d87('0x0'));var util=require('util');var moment=require(_0x4d87('0x1'));var BPromise=require(_0x4d87('0x2'));var rs=require(_0x4d87('0x3'));var fs=require('fs');var Redis=require(_0x4d87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d87('0x5'));var logger=require(_0x4d87('0x6'))(_0x4d87('0x7'));var config=require(_0x4d87('0x8'));var jayson=require(_0x4d87('0x9'));var client=jayson['client'][_0x4d87('0xa')]({'port':0x232a});config[_0x4d87('0xb')]=_[_0x4d87('0xc')](config[_0x4d87('0xb')],{'host':_0x4d87('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d87('0xb')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x95d67f,_0x4c8fb8,_0x545b2f){return new BPromise(function(_0x23dacb,_0x3b8475){return client[_0x4d87('0xe')](_0x95d67f,_0x545b2f)[_0x4d87('0xf')](function(_0x5b5355){logger[_0x4d87('0x10')]('CmList,\x20%s,\x20%s',_0x4c8fb8,_0x4d87('0x11'));logger[_0x4d87('0x12')](_0x4d87('0x13'),_0x4c8fb8,_0x4d87('0x11'),JSON['stringify'](_0x5b5355));if(_0x5b5355[_0x4d87('0x14')]){if(_0x5b5355[_0x4d87('0x14')][_0x4d87('0x15')]===0x1f4){logger['error'](_0x4d87('0x16'),_0x4c8fb8,_0x5b5355['error'][_0x4d87('0x17')]);return _0x3b8475(_0x5b5355[_0x4d87('0x14')][_0x4d87('0x17')]);}logger['error'](_0x4d87('0x16'),_0x4c8fb8,_0x5b5355[_0x4d87('0x14')][_0x4d87('0x17')]);return _0x23dacb(_0x5b5355[_0x4d87('0x14')][_0x4d87('0x17')]);}else{logger[_0x4d87('0x10')](_0x4d87('0x16'),_0x4c8fb8,'request\x20sent');_0x23dacb(_0x5b5355[_0x4d87('0x18')][_0x4d87('0x17')]);}})['catch'](function(_0x6f9632){logger[_0x4d87('0x14')](_0x4d87('0x16'),_0x4c8fb8,_0x6f9632);_0x3b8475(_0x6f9632);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7ec6145..4ecbf15 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 _0xf569=['update','emit','removeListener','length','cmList:','save','remove'];(function(_0x424774,_0x407a9e){var _0x52a4f0=function(_0xdfddd7){while(--_0xdfddd7){_0x424774['push'](_0x424774['shift']());}};_0x52a4f0(++_0x407a9e);}(_0xf569,0xd0));var _0x9f56=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf569[_0x321bb2];return _0x9c12ed;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x9f56('0x0'),_0x9f56('0x1'),_0x9f56('0x2')];function createListener(_0x9c192,_0x45b196){return function(_0x4466ac){_0x45b196[_0x9f56('0x3')](_0x9c192,_0x4466ac);};}function removeListener(_0x6d506b,_0x5bc3e8){return function(){CmListEvents[_0x9f56('0x4')](_0x6d506b,_0x5bc3e8);};}exports['register']=function(_0x467a46){for(var _0x3488f2=0x0,_0x5c5e5f=events[_0x9f56('0x5')];_0x3488f2<_0x5c5e5f;_0x3488f2++){var _0x73c3b4=events[_0x3488f2];var _0x5980f2=createListener(_0x9f56('0x6')+_0x73c3b4,_0x467a46);CmListEvents['on'](_0x73c3b4,_0x5980f2);}}; \ No newline at end of file +var _0x1939=['register','length','cmList:','./cmList.events','remove','update','emit'];(function(_0x244eb3,_0x9a28e7){var _0x755636=function(_0x31f2ce){while(--_0x31f2ce){_0x244eb3['push'](_0x244eb3['shift']());}};_0x755636(++_0x9a28e7);}(_0x1939,0x1d1));var _0x9193=function(_0x5ebf85,_0x598413){_0x5ebf85=_0x5ebf85-0x0;var _0x5b175a=_0x1939[_0x5ebf85];return _0x5b175a;};'use strict';var CmListEvents=require(_0x9193('0x0'));var events=['save',_0x9193('0x1'),_0x9193('0x2')];function createListener(_0x3628d4,_0x538b4c){return function(_0x12643a){_0x538b4c[_0x9193('0x3')](_0x3628d4,_0x12643a);};}function removeListener(_0x31aa3c,_0x35b1c4){return function(){CmListEvents['removeListener'](_0x31aa3c,_0x35b1c4);};}exports[_0x9193('0x4')]=function(_0x20ab2b){for(var _0x5186dc=0x0,_0x5f7087=events[_0x9193('0x5')];_0x5186dc<_0x5f7087;_0x5186dc++){var _0x488d01=events[_0x5186dc];var _0x327de5=createListener(_0x9193('0x6')+_0x488d01,_0x20ab2b);CmListEvents['on'](_0x488d01,_0x327de5);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 852cd1c..7367a22 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 _0x4cd7=['/:id/fields','post','create','addDisposition','addContacts','addCustomField','addAgents','put','delete','destroy','removeDispositions','/:id/users','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x3e8d2f,_0x59afb0){var _0x42a9e8=function(_0x511fcb){while(--_0x511fcb){_0x3e8d2f['push'](_0x3e8d2f['shift']());}};_0x42a9e8(++_0x59afb0);}(_0x4cd7,0x1de));var _0x74cd=function(_0x3f131b,_0x2507a7){_0x3f131b=_0x3f131b-0x0;var _0x6db5df=_0x4cd7[_0x3f131b];return _0x6db5df;};'use strict';var multer=require('multer');var util=require(_0x74cd('0x0'));var path=require(_0x74cd('0x1'));var timeout=require(_0x74cd('0x2'));var express=require(_0x74cd('0x3'));var router=express[_0x74cd('0x4')]();var auth=require(_0x74cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x74cd('0x6'));var controller=require('./cmList.controller');router[_0x74cd('0x7')]('/',auth[_0x74cd('0x8')](),controller[_0x74cd('0x9')]);router[_0x74cd('0x7')]('/describe',auth[_0x74cd('0x8')](),controller[_0x74cd('0xa')]);router[_0x74cd('0x7')](_0x74cd('0xb'),auth['isAuthenticated'](),controller[_0x74cd('0xc')]);router[_0x74cd('0x7')](_0x74cd('0xd'),auth[_0x74cd('0x8')](),controller[_0x74cd('0xe')]);router['get'](_0x74cd('0xf'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x10')]);router[_0x74cd('0x7')](_0x74cd('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x74cd('0x7')](_0x74cd('0x12'),auth[_0x74cd('0x8')](),controller['getCustomFields']);router[_0x74cd('0x7')]('/:id/users',auth[_0x74cd('0x8')](),controller['getAgents']);router[_0x74cd('0x13')]('/',auth[_0x74cd('0x8')](),controller[_0x74cd('0x14')]);router[_0x74cd('0x13')](_0x74cd('0xd'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x15')]);router['post'](_0x74cd('0xf'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x16')]);router[_0x74cd('0x13')](_0x74cd('0x12'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x17')]);router['post']('/:id/users',auth[_0x74cd('0x8')](),controller[_0x74cd('0x18')]);router[_0x74cd('0x19')](_0x74cd('0xb'),auth[_0x74cd('0x8')](),controller['update']);router[_0x74cd('0x1a')](_0x74cd('0xb'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x1b')]);router['delete'](_0x74cd('0xd'),auth[_0x74cd('0x8')](),controller[_0x74cd('0x1c')]);router[_0x74cd('0x1a')](_0x74cd('0x1d'),auth[_0x74cd('0x8')](),controller['removeAgents']);module[_0x74cd('0x1e')]=router; \ No newline at end of file +var _0x350f=['update','delete','destroy','removeDispositions','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addAgents'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x350f,0x159));var _0xf350=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0x350f[_0x567bcb];return _0x4eebc2;};'use strict';var multer=require(_0xf350('0x0'));var util=require('util');var path=require(_0xf350('0x1'));var timeout=require(_0xf350('0x2'));var express=require('express');var router=express[_0xf350('0x3')]();var auth=require(_0xf350('0x4'));var interaction=require(_0xf350('0x5'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0xf350('0x6')]('/',auth[_0xf350('0x7')](),controller[_0xf350('0x8')]);router[_0xf350('0x6')](_0xf350('0x9'),auth[_0xf350('0x7')](),controller[_0xf350('0xa')]);router[_0xf350('0x6')](_0xf350('0xb'),auth[_0xf350('0x7')](),controller[_0xf350('0xc')]);router['get']('/:id/dispositions',auth[_0xf350('0x7')](),controller[_0xf350('0xd')]);router['get'](_0xf350('0xe'),auth['isAuthenticated'](),controller[_0xf350('0xf')]);router[_0xf350('0x6')](_0xf350('0x10'),auth['isAuthenticated'](),controller['getContactsCsv']);router['get'](_0xf350('0x11'),auth[_0xf350('0x7')](),controller[_0xf350('0x12')]);router[_0xf350('0x6')](_0xf350('0x13'),auth[_0xf350('0x7')](),controller[_0xf350('0x14')]);router[_0xf350('0x15')]('/',auth[_0xf350('0x7')](),controller[_0xf350('0x16')]);router[_0xf350('0x15')](_0xf350('0x17'),auth[_0xf350('0x7')](),controller[_0xf350('0x18')]);router[_0xf350('0x15')](_0xf350('0xe'),auth['isAuthenticated'](),controller[_0xf350('0x19')]);router[_0xf350('0x15')](_0xf350('0x11'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xf350('0x15')](_0xf350('0x13'),auth[_0xf350('0x7')](),controller[_0xf350('0x1a')]);router['put'](_0xf350('0xb'),auth[_0xf350('0x7')](),controller[_0xf350('0x1b')]);router[_0xf350('0x1c')]('/:id',auth[_0xf350('0x7')](),controller[_0xf350('0x1d')]);router['delete'](_0xf350('0x17'),auth[_0xf350('0x7')](),controller[_0xf350('0x1e')]);router[_0xf350('0x1c')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);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 dc9b815..5af094a 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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x578b39,_0x8d559c){var _0x4994a6=function(_0x1a3116){while(--_0x1a3116){_0x578b39['push'](_0x578b39['shift']());}};_0x4994a6(++_0x8d559c);}(_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')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x5a2ba7,_0x544a7a){var _0x1804a3=function(_0x4869db){while(--_0x4869db){_0x5a2ba7['push'](_0x5a2ba7['shift']());}};_0x1804a3(++_0x544a7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 537bdc3..bc4dafe 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 _0x0b37=['../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','body','find','params','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x12f773,_0x38b6c9){var _0x3a2b70=function(_0xe9f474){while(--_0xe9f474){_0x12f773['push'](_0x12f773['shift']());}};_0x3a2b70(++_0x38b6c9);}(_0x0b37,0x1d7));var _0x70b3=function(_0x414d0a,_0x1cc249){_0x414d0a=_0x414d0a-0x0;var _0x4fe38f=_0x0b37[_0x414d0a];return _0x4fe38f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70b3('0x0'));var rimraf=require(_0x70b3('0x1'));var zipdir=require(_0x70b3('0x2'));var jsonpatch=require(_0x70b3('0x3'));var rp=require('request-promise');var moment=require(_0x70b3('0x4'));var BPromise=require(_0x70b3('0x5'));var Mustache=require(_0x70b3('0x6'));var util=require(_0x70b3('0x7'));var path=require(_0x70b3('0x8'));var sox=require(_0x70b3('0x9'));var csv=require('to-csv');var ejs=require(_0x70b3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x70b3('0xb'));var crypto=require(_0x70b3('0xc'));var jsforce=require(_0x70b3('0xd'));var deskjs=require(_0x70b3('0xe'));var toCsv=require(_0x70b3('0xf'));var querystring=require('querystring');var Papa=require(_0x70b3('0x10'));var Redis=require('ioredis');var authService=require(_0x70b3('0x11'));var qs=require(_0x70b3('0x12'));var as=require(_0x70b3('0x13'));var hardwareService=require(_0x70b3('0x14'));var logger=require(_0x70b3('0x15'))('api');var utils=require(_0x70b3('0x16'));var config=require(_0x70b3('0x17'));var db=require(_0x70b3('0x18'))['db'];function respondWithStatusCode(_0x4102d8,_0x419c0b){_0x419c0b=_0x419c0b||0xcc;return function(_0xe0df0c){if(_0xe0df0c){return _0x4102d8[_0x70b3('0x19')](_0x419c0b);}return _0x4102d8['status'](_0x419c0b)['end']();};}function respondWithResult(_0x987a13,_0x5b9c4a){_0x5b9c4a=_0x5b9c4a||0xc8;return function(_0x3c035d){if(_0x3c035d){return _0x987a13[_0x70b3('0x1a')](_0x5b9c4a)[_0x70b3('0x1b')](_0x3c035d);}};}function respondWithFilteredResult(_0x28d356,_0x357a7a){return function(_0x42bcd2){if(_0x42bcd2){var _0x182819=_0x42bcd2[_0x70b3('0x1c')],_0x33acbd=_0x357a7a[_0x70b3('0x1d')],_0x363007=_0x357a7a[_0x70b3('0x1d')]+_0x357a7a['limit'],_0x58cf8f;if(_0x363007>=_0x182819){_0x363007=_0x182819;_0x58cf8f=0xc8;}else{_0x58cf8f=0xce;}_0x28d356[_0x70b3('0x1a')](_0x58cf8f);return _0x28d356[_0x70b3('0x1e')](_0x70b3('0x1f'),_0x33acbd+'-'+_0x363007+'/'+_0x182819)['json'](_0x42bcd2);}return null;};}function patchUpdates(_0x4cedc3){return function(_0x4b512f){try{jsonpatch[_0x70b3('0x20')](_0x4b512f,_0x4cedc3,!![]);}catch(_0x50189b){return BPromise['reject'](_0x50189b);}return _0x4b512f[_0x70b3('0x21')]();};}function saveUpdates(_0x38fbba,_0x22db68){return function(_0x4cf2c3){if(_0x4cf2c3){return _0x4cf2c3[_0x70b3('0x22')](_0x38fbba)[_0x70b3('0x23')](function(_0x29cfcf){return _0x29cfcf;});}return null;};}function removeEntity(_0x23c7f6,_0x37ee57){return function(_0x183481){if(_0x183481){return _0x183481['destroy']()[_0x70b3('0x23')](function(){_0x23c7f6[_0x70b3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54e284,_0x336d7d){return function(_0xa530ab){if(!_0xa530ab){_0x54e284[_0x70b3('0x19')](0x194);}return _0xa530ab;};}function handleError(_0x1f0227,_0x4f15d3){_0x4f15d3=_0x4f15d3||0x1f4;return function(_0x530d7d){logger[_0x70b3('0x24')](_0x530d7d[_0x70b3('0x25')]);if(_0x530d7d[_0x70b3('0x26')]){delete _0x530d7d['name'];}_0x1f0227[_0x70b3('0x1a')](_0x4f15d3)[_0x70b3('0x27')](_0x530d7d);};}exports[_0x70b3('0x22')]=function(_0x10f83f,_0x26b2b3){if(_0x10f83f[_0x70b3('0x28')]['id']){delete _0x10f83f[_0x70b3('0x28')]['id'];}return db['Condition'][_0x70b3('0x29')]({'where':{'id':_0x10f83f[_0x70b3('0x2a')]['id']}})[_0x70b3('0x23')](handleEntityNotFound(_0x26b2b3,null))[_0x70b3('0x23')](saveUpdates(_0x10f83f['body'],null))[_0x70b3('0x23')](respondWithResult(_0x26b2b3,null))[_0x70b3('0x2b')](handleError(_0x26b2b3,null));};exports[_0x70b3('0x2c')]=function(_0x54fe9a,_0x3500fd){return db['Condition'][_0x70b3('0x29')]({'where':{'id':_0x54fe9a['params']['id']}})[_0x70b3('0x23')](handleEntityNotFound(_0x3500fd,null))[_0x70b3('0x23')](removeEntity(_0x3500fd,null))[_0x70b3('0x2b')](handleError(_0x3500fd,null));}; \ No newline at end of file +var _0x9b50=['apply','reject','save','destroy','then','error','name','send','update','body','Condition','find','catch','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','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','offset','limit','set','Content-Range'];(function(_0x149190,_0x2d7d5b){var _0x1fb59d=function(_0x4a62e4){while(--_0x4a62e4){_0x149190['push'](_0x149190['shift']());}};_0x1fb59d(++_0x2d7d5b);}(_0x9b50,0x11b));var _0x09b5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9b50[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x09b5('0x0'));var emlformat=require(_0x09b5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x09b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09b5('0x3'));var moment=require(_0x09b5('0x4'));var BPromise=require(_0x09b5('0x5'));var Mustache=require(_0x09b5('0x6'));var util=require(_0x09b5('0x7'));var path=require(_0x09b5('0x8'));var sox=require(_0x09b5('0x9'));var csv=require(_0x09b5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x09b5('0xb'));var crypto=require('crypto');var jsforce=require(_0x09b5('0xc'));var deskjs=require(_0x09b5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09b5('0xe'));var Papa=require('papaparse');var Redis=require(_0x09b5('0xf'));var authService=require(_0x09b5('0x10'));var qs=require(_0x09b5('0x11'));var as=require(_0x09b5('0x12'));var hardwareService=require(_0x09b5('0x13'));var logger=require(_0x09b5('0x14'))(_0x09b5('0x15'));var utils=require(_0x09b5('0x16'));var config=require(_0x09b5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa378c4,_0x7543ac){_0x7543ac=_0x7543ac||0xcc;return function(_0x1401fd){if(_0x1401fd){return _0xa378c4[_0x09b5('0x18')](_0x7543ac);}return _0xa378c4[_0x09b5('0x19')](_0x7543ac)[_0x09b5('0x1a')]();};}function respondWithResult(_0x39e2a4,_0x30ea86){_0x30ea86=_0x30ea86||0xc8;return function(_0x586f00){if(_0x586f00){return _0x39e2a4[_0x09b5('0x19')](_0x30ea86)[_0x09b5('0x1b')](_0x586f00);}};}function respondWithFilteredResult(_0x2ed9a2,_0x31e1b7){return function(_0x1ea09c){if(_0x1ea09c){var _0x4c916c=_0x1ea09c['count'],_0xb00b9b=_0x31e1b7[_0x09b5('0x1c')],_0xd7d55b=_0x31e1b7[_0x09b5('0x1c')]+_0x31e1b7[_0x09b5('0x1d')],_0xed4dbb;if(_0xd7d55b>=_0x4c916c){_0xd7d55b=_0x4c916c;_0xed4dbb=0xc8;}else{_0xed4dbb=0xce;}_0x2ed9a2[_0x09b5('0x19')](_0xed4dbb);return _0x2ed9a2[_0x09b5('0x1e')](_0x09b5('0x1f'),_0xb00b9b+'-'+_0xd7d55b+'/'+_0x4c916c)[_0x09b5('0x1b')](_0x1ea09c);}return null;};}function patchUpdates(_0x74f417){return function(_0xa13410){try{jsonpatch[_0x09b5('0x20')](_0xa13410,_0x74f417,!![]);}catch(_0x4ad20c){return BPromise[_0x09b5('0x21')](_0x4ad20c);}return _0xa13410[_0x09b5('0x22')]();};}function saveUpdates(_0x4dd137,_0x4ab5a3){return function(_0xfa67b3){if(_0xfa67b3){return _0xfa67b3['update'](_0x4dd137)['then'](function(_0x1c5625){return _0x1c5625;});}return null;};}function removeEntity(_0x53589a,_0x1e1c9e){return function(_0x2bf0cb){if(_0x2bf0cb){return _0x2bf0cb[_0x09b5('0x23')]()[_0x09b5('0x24')](function(){_0x53589a[_0x09b5('0x19')](0xcc)[_0x09b5('0x1a')]();});}};}function handleEntityNotFound(_0x49db1d,_0x5945dc){return function(_0x373352){if(!_0x373352){_0x49db1d[_0x09b5('0x18')](0x194);}return _0x373352;};}function handleError(_0x4eeb78,_0x12ab1f){_0x12ab1f=_0x12ab1f||0x1f4;return function(_0x4a4fa4){logger[_0x09b5('0x25')](_0x4a4fa4['stack']);if(_0x4a4fa4[_0x09b5('0x26')]){delete _0x4a4fa4['name'];}_0x4eeb78[_0x09b5('0x19')](_0x12ab1f)[_0x09b5('0x27')](_0x4a4fa4);};}exports[_0x09b5('0x28')]=function(_0x289018,_0x4182bf){if(_0x289018[_0x09b5('0x29')]['id']){delete _0x289018[_0x09b5('0x29')]['id'];}return db[_0x09b5('0x2a')][_0x09b5('0x2b')]({'where':{'id':_0x289018['params']['id']}})[_0x09b5('0x24')](handleEntityNotFound(_0x4182bf,null))[_0x09b5('0x24')](saveUpdates(_0x289018['body'],null))[_0x09b5('0x24')](respondWithResult(_0x4182bf,null))['catch'](handleError(_0x4182bf,null));};exports[_0x09b5('0x23')]=function(_0x27ab33,_0x3e6c41){return db[_0x09b5('0x2a')][_0x09b5('0x2b')]({'where':{'id':_0x27ab33['params']['id']}})[_0x09b5('0x24')](handleEntityNotFound(_0x3e6c41,null))['then'](removeEntity(_0x3e6c41,null))[_0x09b5('0x2c')](handleError(_0x3e6c41,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a107d74..7e50eb5 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 _0x0f6f=['../../config/logger','api','moment','bluebird','request-promise','path','./condition.attributes','exports','Condition','tools_conditions','lodash','util'];(function(_0x1f3e03,_0xb8977a){var _0x4e27fb=function(_0x3a33b1){while(--_0x3a33b1){_0x1f3e03['push'](_0x1f3e03['shift']());}};_0x4e27fb(++_0xb8977a);}(_0x0f6f,0xbe));var _0xf0f6=function(_0x463183,_0x56bd4e){_0x463183=_0x463183-0x0;var _0xd5fe56=_0x0f6f[_0x463183];return _0xd5fe56;};'use strict';var _=require(_0xf0f6('0x0'));var util=require(_0xf0f6('0x1'));var logger=require(_0xf0f6('0x2'))(_0xf0f6('0x3'));var moment=require(_0xf0f6('0x4'));var BPromise=require(_0xf0f6('0x5'));var rp=require(_0xf0f6('0x6'));var fs=require('fs');var path=require(_0xf0f6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0f6('0x8'));module[_0xf0f6('0x9')]=function(_0xff4cc8,_0x5ce071){return _0xff4cc8['define'](_0xf0f6('0xa'),attributes,{'tableName':_0xf0f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95d2=['define','Condition','tools_conditions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports'];(function(_0x8d7c55,_0x4ec151){var _0x1e6602=function(_0x253d5){while(--_0x253d5){_0x8d7c55['push'](_0x8d7c55['shift']());}};_0x1e6602(++_0x4ec151);}(_0x95d2,0x6b));var _0x295d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x95d2[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x295d('0x0'));var util=require('util');var logger=require(_0x295d('0x1'))(_0x295d('0x2'));var moment=require(_0x295d('0x3'));var BPromise=require(_0x295d('0x4'));var rp=require(_0x295d('0x5'));var fs=require('fs');var path=require(_0x295d('0x6'));var rimraf=require('rimraf');var config=require(_0x295d('0x7'));var attributes=require(_0x295d('0x8'));module[_0x295d('0x9')]=function(_0x1e216f,_0x4fbae2){return _0x1e216f[_0x295d('0xa')](_0x295d('0xb'),attributes,{'tableName':_0x295d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index b2f8b4b..999fb47 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 _0x496d=['message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5e88cc,_0x59e168){var _0x24dbf7=function(_0x2999dc){while(--_0x2999dc){_0x5e88cc['push'](_0x5e88cc['shift']());}};_0x24dbf7(++_0x59e168);}(_0x496d,0x1e5));var _0xd496=function(_0x330426,_0x204abb){_0x330426=_0x330426-0x0;var _0x2dd763=_0x496d[_0x330426];return _0x2dd763;};'use strict';var _=require('lodash');var util=require(_0xd496('0x0'));var moment=require(_0xd496('0x1'));var BPromise=require('bluebird');var rs=require(_0xd496('0x2'));var fs=require('fs');var Redis=require(_0xd496('0x3'));var db=require(_0xd496('0x4'))['db'];var utils=require(_0xd496('0x5'));var logger=require(_0xd496('0x6'))(_0xd496('0x7'));var config=require(_0xd496('0x8'));var jayson=require(_0xd496('0x9'));var client=jayson['client'][_0xd496('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bbcce,_0x16e811,_0x12fe54){return new BPromise(function(_0x3005c3,_0x3c2d3c){return client[_0xd496('0xb')](_0x3bbcce,_0x12fe54)[_0xd496('0xc')](function(_0x4c0ca7){logger[_0xd496('0xd')](_0xd496('0xe'),_0x16e811,_0xd496('0xf'));logger[_0xd496('0x10')](_0xd496('0x11'),_0x16e811,_0xd496('0xf'),JSON[_0xd496('0x12')](_0x4c0ca7));if(_0x4c0ca7[_0xd496('0x13')]){if(_0x4c0ca7[_0xd496('0x13')][_0xd496('0x14')]===0x1f4){logger['error'](_0xd496('0xe'),_0x16e811,_0x4c0ca7[_0xd496('0x13')][_0xd496('0x15')]);return _0x3c2d3c(_0x4c0ca7[_0xd496('0x13')]['message']);}logger[_0xd496('0x13')](_0xd496('0xe'),_0x16e811,_0x4c0ca7[_0xd496('0x13')]['message']);return _0x3005c3(_0x4c0ca7[_0xd496('0x13')][_0xd496('0x15')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x16e811,'request\x20sent');_0x3005c3(_0x4c0ca7[_0xd496('0x16')][_0xd496('0x15')]);}})['catch'](function(_0xf7468c){logger[_0xd496('0x13')]('Condition,\x20%s,\x20%s',_0x16e811,_0xf7468c);_0x3c2d3c(_0xf7468c);});});} \ No newline at end of file +var _0xcae4=['stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x130fa6,_0x15c5de){var _0x41e1c9=function(_0x3977e9){while(--_0x3977e9){_0x130fa6['push'](_0x130fa6['shift']());}};_0x41e1c9(++_0x15c5de);}(_0xcae4,0x1d3));var _0x4cae=function(_0x37cbb8,_0x180ad2){_0x37cbb8=_0x37cbb8-0x0;var _0x50378f=_0xcae4[_0x37cbb8];return _0x50378f;};'use strict';var _=require(_0x4cae('0x0'));var util=require(_0x4cae('0x1'));var moment=require(_0x4cae('0x2'));var BPromise=require(_0x4cae('0x3'));var rs=require(_0x4cae('0x4'));var fs=require('fs');var Redis=require(_0x4cae('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cae('0x6'));var logger=require('../../config/logger')(_0x4cae('0x7'));var config=require('../../config/environment');var jayson=require(_0x4cae('0x8'));var client=jayson[_0x4cae('0x9')][_0x4cae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x61d40b,_0x9aee77,_0x26dc4f){return new BPromise(function(_0x1f81e6,_0x4e4ceb){return client[_0x4cae('0xb')](_0x61d40b,_0x26dc4f)[_0x4cae('0xc')](function(_0x148b19){logger['info']('Condition,\x20%s,\x20%s',_0x9aee77,_0x4cae('0xd'));logger[_0x4cae('0xe')](_0x4cae('0xf'),_0x9aee77,_0x4cae('0xd'),JSON[_0x4cae('0x10')](_0x148b19));if(_0x148b19['error']){if(_0x148b19[_0x4cae('0x11')][_0x4cae('0x12')]===0x1f4){logger[_0x4cae('0x11')](_0x4cae('0x13'),_0x9aee77,_0x148b19['error'][_0x4cae('0x14')]);return _0x4e4ceb(_0x148b19[_0x4cae('0x11')][_0x4cae('0x14')]);}logger['error'](_0x4cae('0x13'),_0x9aee77,_0x148b19[_0x4cae('0x11')][_0x4cae('0x14')]);return _0x1f81e6(_0x148b19['error'][_0x4cae('0x14')]);}else{logger['info'](_0x4cae('0x13'),_0x9aee77,_0x4cae('0xd'));_0x1f81e6(_0x148b19[_0x4cae('0x15')][_0x4cae('0x14')]);}})[_0x4cae('0x16')](function(_0x396813){logger[_0x4cae('0x11')](_0x4cae('0x13'),_0x9aee77,_0x396813);_0x4e4ceb(_0x396813);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 972b61d..7eec4ed 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 _0x863d=['update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated'];(function(_0x1422dd,_0x4465cf){var _0x304e54=function(_0xb46c63){while(--_0xb46c63){_0x1422dd['push'](_0x1422dd['shift']());}};_0x304e54(++_0x4465cf);}(_0x863d,0x1e4));var _0xd863=function(_0x5c3d42,_0xf2a84c){_0x5c3d42=_0x5c3d42-0x0;var _0xd478b3=_0x863d[_0x5c3d42];return _0xd478b3;};'use strict';var multer=require(_0xd863('0x0'));var util=require('util');var path=require(_0xd863('0x1'));var timeout=require('connect-timeout');var express=require(_0xd863('0x2'));var router=express['Router']();var auth=require(_0xd863('0x3'));var interaction=require(_0xd863('0x4'));var config=require(_0xd863('0x5'));var controller=require('./condition.controller');router['put'](_0xd863('0x6'),auth[_0xd863('0x7')](),controller[_0xd863('0x8')]);router[_0xd863('0x9')](_0xd863('0x6'),auth[_0xd863('0x7')](),controller[_0xd863('0xa')]);module[_0xd863('0xb')]=router; \ No newline at end of file +var _0x1631=['destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x26bebe,_0x52a17c){var _0x1b285f=function(_0x47981c){while(--_0x47981c){_0x26bebe['push'](_0x26bebe['shift']());}};_0x1b285f(++_0x52a17c);}(_0x1631,0x12e));var _0x1163=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x1631[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0x1163('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1163('0x1'));var router=express[_0x1163('0x2')]();var auth=require(_0x1163('0x3'));var interaction=require(_0x1163('0x4'));var config=require(_0x1163('0x5'));var controller=require('./condition.controller');router[_0x1163('0x6')](_0x1163('0x7'),auth[_0x1163('0x8')](),controller[_0x1163('0x9')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1163('0xa')]);module[_0x1163('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 4619ef1..8484871 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 _0xadb8=['STRING','INTEGER'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xadb8,0x1d0));var _0x8adb=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0xadb8[_0x5814ca];return _0xeb1833;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8adb('0x0')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x8adb('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8adb('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x975f=['STRING','sequelize','exports','INTEGER'];(function(_0x296601,_0x25c2de){var _0x4397aa=function(_0xc4e70e){while(--_0xc4e70e){_0x296601['push'](_0x296601['shift']());}};_0x4397aa(++_0x25c2de);}(_0x975f,0x109));var _0xf975=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x975f[_0x292f93];return _0x5a94b1;};'use strict';var Sequelize=require(_0xf975('0x0'));module[_0xf975('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xf975('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf975('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 7b52cb0..b087f9e 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x17d417,_0x51e28a){var _0x309a2f=function(_0x307ff1){while(--_0x307ff1){_0x17d417['push'](_0x17d417['shift']());}};_0x309a2f(++_0x51e28a);}(_0x9bde,0xe1));var _0xe9bd=function(_0xeb47f7,_0x3a540b){_0xeb47f7=_0xeb47f7-0x0;var _0xce0f94=_0x9bde[_0xeb47f7];return _0xce0f94;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){var _0x238ab1=_0x4ecaf5[_0xe9bd('0x27')]({'plain':!![]});var _0x36f8c0=_0xe9bd('0x28');return db['UserProfileResource'][_0xe9bd('0x26')]({'where':{'type':_0x36f8c0,'resourceId':_0x238ab1['id']}})[_0xe9bd('0x25')](function(){return _0x4ecaf5;});})[_0xe9bd('0x25')](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0xb52d45,_0x399f3c){return function(_0x43ea90){if(!_0x43ea90){_0xb52d45[_0xe9bd('0x29')](0x194);}return _0x43ea90;};}function handleError(_0x5987af,_0x3c211a){_0x3c211a=_0x3c211a||0x1f4;return function(_0x38fdfa){logger['error'](_0x38fdfa[_0xe9bd('0x2a')]);if(_0x38fdfa[_0xe9bd('0x2b')]){delete _0x38fdfa[_0xe9bd('0x2b')];}_0x5987af[_0xe9bd('0x19')](_0x3c211a)[_0xe9bd('0x2c')](_0x38fdfa);};}exports[_0xe9bd('0x2d')]=function(_0x519f48,_0x5b7f1d){var _0x1de54c={},_0x56e409={},_0xa45eb0={'count':0x0,'rows':[]};var _0x1f2c0e=_[_0xe9bd('0x2e')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')],function(_0x509e36){return{'name':_0x509e36['fieldName'],'type':_0x509e36[_0xe9bd('0x31')][_0xe9bd('0x32')]};});_0x56e409[_0xe9bd('0x33')]=_[_0xe9bd('0x2e')](_0x1f2c0e,_0xe9bd('0x2b'));_0x56e409[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x519f48[_0xe9bd('0x34')]);_0x56e409[_0xe9bd('0x36')]=_['intersection'](_0x56e409[_0xe9bd('0x33')],_0x56e409[_0xe9bd('0x34')]);_0x1de54c[_0xe9bd('0x37')]=_['intersection'](_0x56e409['model'],qs[_0xe9bd('0x38')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x1de54c[_0xe9bd('0x37')]=_0x1de54c[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x1de54c[_0xe9bd('0x37')]:_0x56e409[_0xe9bd('0x33')];if(!_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x1de54c[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x1de54c[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x519f48[_0xe9bd('0x34')]['offset']);}_0x1de54c[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x519f48['query'][_0xe9bd('0x3d')]);_0x1de54c[_0xe9bd('0x3e')]=qs['filters'](_['pick'](_0x519f48[_0xe9bd('0x34')],_0x56e409[_0xe9bd('0x36')]),_0x1f2c0e);if(_0x519f48['query'][_0xe9bd('0x3f')]){_0x1de54c[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x1de54c['where'],{'$or':_[_0xe9bd('0x2e')](_0x1f2c0e,function(_0x4d1945){if(_0x4d1945[_0xe9bd('0x31')]!==_0xe9bd('0x41')){var _0x63d67c={};_0x63d67c[_0x4d1945[_0xe9bd('0x2b')]]={'$like':'%'+_0x519f48['query'][_0xe9bd('0x3f')]+'%'};return _0x63d67c;}})});}_0x1de54c=_[_0xe9bd('0x40')]({},_0x1de54c,_0x519f48[_0xe9bd('0x42')]);var _0x3f1212={'where':_0x1de54c[_0xe9bd('0x3e')]};return db[_0xe9bd('0x2f')][_0xe9bd('0x1c')](_0x3f1212)[_0xe9bd('0x25')](function(_0x2b5a71){_0xa45eb0[_0xe9bd('0x1c')]=_0x2b5a71;if(_0x519f48['query']['includeAll']){_0x1de54c[_0xe9bd('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0xe9bd('0x44')](_0x1de54c);})[_0xe9bd('0x25')](function(_0x41881a){_0xa45eb0['rows']=_0x41881a;return _0xa45eb0;})[_0xe9bd('0x25')](respondWithFilteredResult(_0x5b7f1d,_0x1de54c))[_0xe9bd('0x45')](handleError(_0x5b7f1d,null));};exports[_0xe9bd('0x46')]=function(_0x5a4460,_0x2ef01b){var _0x3a5703={'raw':!![],'where':{'id':_0x5a4460[_0xe9bd('0x47')]['id']}},_0x2b3cd7={};_0x2b3cd7[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')]);_0x2b3cd7[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x5a4460[_0xe9bd('0x34')]);_0x2b3cd7[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x2b3cd7[_0xe9bd('0x33')],_0x2b3cd7[_0xe9bd('0x34')]);_0x3a5703['attributes']=_['intersection'](_0x2b3cd7[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x5a4460[_0xe9bd('0x34')]['fields']));_0x3a5703['attributes']=_0x3a5703[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x3a5703[_0xe9bd('0x37')]:_0x2b3cd7[_0xe9bd('0x33')];if(_0x5a4460[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x3a5703[_0xe9bd('0x43')]=[{'all':!![]}];}_0x3a5703=_['merge']({},_0x3a5703,_0x5a4460[_0xe9bd('0x42')]);return db['ContactItemType'][_0xe9bd('0x4a')](_0x3a5703)[_0xe9bd('0x25')](handleEntityNotFound(_0x2ef01b,null))[_0xe9bd('0x25')](respondWithResult(_0x2ef01b,null))[_0xe9bd('0x45')](handleError(_0x2ef01b,null));};exports[_0xe9bd('0x4b')]=function(_0x4b7b67,_0x3317d6){return db[_0xe9bd('0x2f')][_0xe9bd('0x4b')](_0x4b7b67['body'],{})[_0xe9bd('0x25')](function(_0x476f23){var _0x34f787=_0x4b7b67['user'][_0xe9bd('0x27')]({'plain':!![]});if(!_0x34f787)throw new Error(_0xe9bd('0x4c'));if(_0x34f787[_0xe9bd('0x4d')]===_0xe9bd('0x4e')){var _0x1ee09c=_0x476f23['get']({'plain':!![]});var _0x3f4833='ContactItemTypes';return db[_0xe9bd('0x4f')][_0xe9bd('0x4a')]({'where':{'name':_0x3f4833,'userProfileId':_0x34f787[_0xe9bd('0x50')]},'raw':!![]})[_0xe9bd('0x25')](function(_0x194b7d){if(_0x194b7d&&_0x194b7d['autoAssociation']===0x0){return db[_0xe9bd('0x51')]['create']({'name':_0x1ee09c[_0xe9bd('0x2b')],'resourceId':_0x1ee09c['id'],'type':_0x194b7d[_0xe9bd('0x2b')],'sectionId':_0x194b7d['id']},{})['then'](function(){return _0x476f23;});}else{return _0x476f23;}})['catch'](function(_0x1ce539){logger['error'](_0xe9bd('0x52'),_0x1ce539);throw _0x1ce539;});}return _0x476f23;})['then'](respondWithResult(_0x3317d6,0xc9))[_0xe9bd('0x45')](handleError(_0x3317d6,null));};exports[_0xe9bd('0x24')]=function(_0x5496d7,_0x55f619){if(_0x5496d7['body']['id']){delete _0x5496d7[_0xe9bd('0x53')]['id'];}return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x5496d7['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x55f619,null))[_0xe9bd('0x25')](saveUpdates(_0x5496d7[_0xe9bd('0x53')],null))[_0xe9bd('0x25')](respondWithResult(_0x55f619,null))['catch'](handleError(_0x55f619,null));};exports['destroy']=function(_0x441f89,_0x493aae){return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x441f89[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x493aae,null))[_0xe9bd('0x25')](removeEntity(_0x493aae,null))[_0xe9bd('0x45')](handleError(_0x493aae,null));}; \ No newline at end of file +var _0xf3cd=['findAll','rows','catch','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','ContactItemTypes','UserProfileResource','end','name','map','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','ContactItemType','includeAll'];(function(_0x2f1758,_0x3f37d1){var _0x4d5c65=function(_0x3117f9){while(--_0x3117f9){_0x2f1758['push'](_0x2f1758['shift']());}};_0x4d5c65(++_0x3f37d1);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0xf3cd[_0x408e38];return _0x426b0e;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var db=require(_0xdf3c('0x19'))['db'];function respondWithStatusCode(_0x5e8925,_0x1d483c){_0x1d483c=_0x1d483c||0xcc;return function(_0x166ae5){if(_0x166ae5){return _0x5e8925[_0xdf3c('0x1a')](_0x1d483c);}return _0x5e8925[_0xdf3c('0x1b')](_0x1d483c)['end']();};}function respondWithResult(_0x2ae4ad,_0x461079){_0x461079=_0x461079||0xc8;return function(_0x13ea5f){if(_0x13ea5f){return _0x2ae4ad['status'](_0x461079)[_0xdf3c('0x1c')](_0x13ea5f);}};}function respondWithFilteredResult(_0x38b01d,_0x173041){return function(_0x4274fd){if(_0x4274fd){var _0x21e587=_0x4274fd[_0xdf3c('0x1d')],_0x1a7a5a=_0x173041[_0xdf3c('0x1e')],_0x305ea5=_0x173041['offset']+_0x173041[_0xdf3c('0x1f')],_0x92008b;if(_0x305ea5>=_0x21e587){_0x305ea5=_0x21e587;_0x92008b=0xc8;}else{_0x92008b=0xce;}_0x38b01d[_0xdf3c('0x1b')](_0x92008b);return _0x38b01d[_0xdf3c('0x20')](_0xdf3c('0x21'),_0x1a7a5a+'-'+_0x305ea5+'/'+_0x21e587)[_0xdf3c('0x1c')](_0x4274fd);}return null;};}function patchUpdates(_0x113b56){return function(_0x16b02b){try{jsonpatch[_0xdf3c('0x22')](_0x16b02b,_0x113b56,!![]);}catch(_0x426f3a){return BPromise[_0xdf3c('0x23')](_0x426f3a);}return _0x16b02b[_0xdf3c('0x24')]();};}function saveUpdates(_0x3d14cc,_0x25487c){return function(_0x5d2390){if(_0x5d2390){return _0x5d2390['update'](_0x3d14cc)[_0xdf3c('0x25')](function(_0x583ce4){return _0x583ce4;});}return null;};}function removeEntity(_0x15776c,_0x40e7ec){return function(_0x36552e){if(_0x36552e){return _0x36552e[_0xdf3c('0x26')]()[_0xdf3c('0x25')](function(){var _0x36ba1c=_0x36552e['get']({'plain':!![]});var _0x22a164=_0xdf3c('0x27');return db[_0xdf3c('0x28')][_0xdf3c('0x26')]({'where':{'type':_0x22a164,'resourceId':_0x36ba1c['id']}})[_0xdf3c('0x25')](function(){return _0x36552e;});})[_0xdf3c('0x25')](function(){_0x15776c[_0xdf3c('0x1b')](0xcc)[_0xdf3c('0x29')]();});}};}function handleEntityNotFound(_0x18cb46,_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x18cb46[_0xdf3c('0x1a')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x2a')];}_0x153daa[_0xdf3c('0x1b')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={},_0x1ccdd4={},_0x5c98a2={'count':0x0,'rows':[]};var _0x43ce06=_[_0xdf3c('0x2b')](db['ContactItemType']['rawAttributes'],function(_0x1f1d8a){return{'name':_0x1f1d8a[_0xdf3c('0x2c')],'type':_0x1f1d8a[_0xdf3c('0x2d')]['key']};});_0x1ccdd4[_0xdf3c('0x2e')]=_[_0xdf3c('0x2b')](_0x43ce06,_0xdf3c('0x2a'));_0x1ccdd4[_0xdf3c('0x2f')]=_['keys'](_0x37ecfd[_0xdf3c('0x2f')]);_0x1ccdd4[_0xdf3c('0x30')]=_['intersection'](_0x1ccdd4[_0xdf3c('0x2e')],_0x1ccdd4[_0xdf3c('0x2f')]);_0xd3cfcb[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x1ccdd4['model'],qs[_0xdf3c('0x33')](_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x33')]));_0xd3cfcb[_0xdf3c('0x31')]=_0xd3cfcb['attributes'][_0xdf3c('0x34')]?_0xd3cfcb[_0xdf3c('0x31')]:_0x1ccdd4['model'];if(!_0x37ecfd['query'][_0xdf3c('0x35')]('nolimit')){_0xd3cfcb[_0xdf3c('0x1f')]=qs['limit'](_0x37ecfd['query']['limit']);_0xd3cfcb[_0xdf3c('0x1e')]=qs[_0xdf3c('0x1e')](_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x1e')]);}_0xd3cfcb['order']=qs['sort'](_0x37ecfd[_0xdf3c('0x2f')]['sort']);_0xd3cfcb[_0xdf3c('0x36')]=qs[_0xdf3c('0x30')](_[_0xdf3c('0x37')](_0x37ecfd[_0xdf3c('0x2f')],_0x1ccdd4[_0xdf3c('0x30')]),_0x43ce06);if(_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x38')]){_0xd3cfcb[_0xdf3c('0x36')]=_[_0xdf3c('0x39')](_0xd3cfcb['where'],{'$or':_[_0xdf3c('0x2b')](_0x43ce06,function(_0x54e689){if(_0x54e689['type']!==_0xdf3c('0x3a')){var _0x47f760={};_0x47f760[_0x54e689[_0xdf3c('0x2a')]]={'$like':'%'+_0x37ecfd['query'][_0xdf3c('0x38')]+'%'};return _0x47f760;}})});}_0xd3cfcb=_[_0xdf3c('0x39')]({},_0xd3cfcb,_0x37ecfd[_0xdf3c('0x3b')]);var _0x1349a4={'where':_0xd3cfcb[_0xdf3c('0x36')]};return db[_0xdf3c('0x3c')][_0xdf3c('0x1d')](_0x1349a4)[_0xdf3c('0x25')](function(_0x3cf131){_0x5c98a2[_0xdf3c('0x1d')]=_0x3cf131;if(_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x3d')]){_0xd3cfcb['include']=[{'all':!![]}];}return db['ContactItemType'][_0xdf3c('0x3e')](_0xd3cfcb);})['then'](function(_0x3a6527){_0x5c98a2[_0xdf3c('0x3f')]=_0x3a6527;return _0x5c98a2;})[_0xdf3c('0x25')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x40')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x563d31,_0x335c1b){var _0x33edab={'raw':!![],'where':{'id':_0x563d31['params']['id']}},_0x106975={};_0x106975[_0xdf3c('0x2e')]=_[_0xdf3c('0x41')](db[_0xdf3c('0x3c')][_0xdf3c('0x42')]);_0x106975['query']=_[_0xdf3c('0x41')](_0x563d31[_0xdf3c('0x2f')]);_0x106975[_0xdf3c('0x30')]=_[_0xdf3c('0x32')](_0x106975[_0xdf3c('0x2e')],_0x106975['query']);_0x33edab[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x106975[_0xdf3c('0x2e')],qs[_0xdf3c('0x33')](_0x563d31[_0xdf3c('0x2f')][_0xdf3c('0x33')]));_0x33edab['attributes']=_0x33edab['attributes'][_0xdf3c('0x34')]?_0x33edab[_0xdf3c('0x31')]:_0x106975['model'];if(_0x563d31['query'][_0xdf3c('0x3d')]){_0x33edab[_0xdf3c('0x43')]=[{'all':!![]}];}_0x33edab=_[_0xdf3c('0x39')]({},_0x33edab,_0x563d31[_0xdf3c('0x3b')]);return db[_0xdf3c('0x3c')][_0xdf3c('0x44')](_0x33edab)[_0xdf3c('0x25')](handleEntityNotFound(_0x335c1b,null))[_0xdf3c('0x25')](respondWithResult(_0x335c1b,null))[_0xdf3c('0x40')](handleError(_0x335c1b,null));};exports['create']=function(_0x129c2a,_0x2cfdb2){return db[_0xdf3c('0x3c')][_0xdf3c('0x45')](_0x129c2a[_0xdf3c('0x46')],{})[_0xdf3c('0x25')](function(_0x28a468){var _0x553f70=_0x129c2a[_0xdf3c('0x47')]['get']({'plain':!![]});if(!_0x553f70)throw new Error(_0xdf3c('0x48'));if(_0x553f70['role']===_0xdf3c('0x47')){var _0x28144f=_0x28a468[_0xdf3c('0x49')]({'plain':!![]});var _0x94c5b9='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x94c5b9,'userProfileId':_0x553f70[_0xdf3c('0x4a')]},'raw':!![]})['then'](function(_0x31c600){if(_0x31c600&&_0x31c600[_0xdf3c('0x4b')]===0x0){return db[_0xdf3c('0x28')][_0xdf3c('0x45')]({'name':_0x28144f[_0xdf3c('0x2a')],'resourceId':_0x28144f['id'],'type':_0x31c600['name'],'sectionId':_0x31c600['id']},{})['then'](function(){return _0x28a468;});}else{return _0x28a468;}})[_0xdf3c('0x40')](function(_0x27a541){logger['error'](_0xdf3c('0x4c'),_0x27a541);throw _0x27a541;});}return _0x28a468;})[_0xdf3c('0x25')](respondWithResult(_0x2cfdb2,0xc9))[_0xdf3c('0x40')](handleError(_0x2cfdb2,null));};exports[_0xdf3c('0x4d')]=function(_0x38de63,_0x46dfb1){if(_0x38de63[_0xdf3c('0x46')]['id']){delete _0x38de63['body']['id'];}return db['ContactItemType'][_0xdf3c('0x44')]({'where':{'id':_0x38de63[_0xdf3c('0x4e')]['id']}})[_0xdf3c('0x25')](handleEntityNotFound(_0x46dfb1,null))[_0xdf3c('0x25')](saveUpdates(_0x38de63[_0xdf3c('0x46')],null))[_0xdf3c('0x25')](respondWithResult(_0x46dfb1,null))[_0xdf3c('0x40')](handleError(_0x46dfb1,null));};exports[_0xdf3c('0x26')]=function(_0x143d01,_0x31624a){return db[_0xdf3c('0x3c')]['find']({'where':{'id':_0x143d01[_0xdf3c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31624a,null))['then'](removeEntity(_0x31624a,null))['catch'](handleError(_0x31624a,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d84db37..5dba8eb 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 _0x26d1=['define','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird','rimraf','./contactItemType.attributes','exports'];(function(_0x538ba5,_0x230141){var _0x248441=function(_0x2be38c){while(--_0x2be38c){_0x538ba5['push'](_0x538ba5['shift']());}};_0x248441(++_0x230141);}(_0x26d1,0x8e));var _0x126d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x26d1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var logger=require(_0x126d('0x1'))(_0x126d('0x2'));var moment=require(_0x126d('0x3'));var BPromise=require(_0x126d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x126d('0x5'));var config=require('../../config/environment');var attributes=require(_0x126d('0x6'));module[_0x126d('0x7')]=function(_0x442e04,_0x449ed0){return _0x442e04[_0x126d('0x8')]('ContactItemType',attributes,{'tableName':_0x126d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ca9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','ContactItemType','tools_contact_item_types'];(function(_0x45ca66,_0x47f5d2){var _0x329bdc=function(_0x48225c){while(--_0x48225c){_0x45ca66['push'](_0x45ca66['shift']());}};_0x329bdc(++_0x47f5d2);}(_0x8ca9,0x9c));var _0x98ca=function(_0x55957e,_0x2d1769){_0x55957e=_0x55957e-0x0;var _0x37b31b=_0x8ca9[_0x55957e];return _0x37b31b;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var logger=require(_0x98ca('0x2'))(_0x98ca('0x3'));var moment=require(_0x98ca('0x4'));var BPromise=require(_0x98ca('0x5'));var rp=require(_0x98ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x98ca('0x7'));var attributes=require('./contactItemType.attributes');module[_0x98ca('0x8')]=function(_0x48415d,_0x219619){return _0x48415d[_0x98ca('0x9')](_0x98ca('0xa'),attributes,{'tableName':_0x98ca('0xb'),'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 954a3fa..bf209c0 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 _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x493683,_0x10b42a){var _0x5b2a67=function(_0x54c4cf){while(--_0x54c4cf){_0x493683['push'](_0x493683['shift']());}};_0x5b2a67(++_0x10b42a);}(_0x668b,0x140));var _0xb668=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x668b[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('ContactItemType,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file +var _0xd3d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x3d1046,_0x154af3){var _0x37d799=function(_0x31f2e0){while(--_0x31f2e0){_0x3d1046['push'](_0x3d1046['shift']());}};_0x37d799(++_0x154af3);}(_0xd3d1,0x172));var _0x1d3d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd3d1[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('ContactItemType,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('ContactItemType,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 77b99d9..e0bcc07 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 _0x71c8=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./contactItemType.controller','get'];(function(_0x325fb6,_0x370d6c){var _0x42c761=function(_0x2645b0){while(--_0x2645b0){_0x325fb6['push'](_0x325fb6['shift']());}};_0x42c761(++_0x370d6c);}(_0x71c8,0xf2));var _0x871c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x71c8[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x871c('0x0'));var util=require(_0x871c('0x1'));var path=require(_0x871c('0x2'));var timeout=require(_0x871c('0x3'));var express=require(_0x871c('0x4'));var router=express[_0x871c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x871c('0x6'));var config=require(_0x871c('0x7'));var controller=require(_0x871c('0x8'));router[_0x871c('0x9')]('/',auth[_0x871c('0xa')](),controller[_0x871c('0xb')]);router[_0x871c('0x9')](_0x871c('0xc'),auth[_0x871c('0xa')](),controller[_0x871c('0xd')]);router[_0x871c('0xe')]('/',auth[_0x871c('0xa')](),controller[_0x871c('0xf')]);router[_0x871c('0x10')](_0x871c('0xc'),auth[_0x871c('0xa')](),controller[_0x871c('0x11')]);router[_0x871c('0x12')](_0x871c('0xc'),auth['isAuthenticated'](),controller[_0x871c('0x13')]);module[_0x871c('0x14')]=router; \ No newline at end of file +var _0xebaf=['isAuthenticated','index','/:id','show','put','update','delete','exports','util','connect-timeout','express','Router','../../config/environment','./contactItemType.controller','get'];(function(_0x4ad072,_0x2582f1){var _0x4f7ae5=function(_0x5abb9e){while(--_0x5abb9e){_0x4ad072['push'](_0x4ad072['shift']());}};_0x4f7ae5(++_0x2582f1);}(_0xebaf,0xcb));var _0xfeba=function(_0x223ca6,_0x30001f){_0x223ca6=_0x223ca6-0x0;var _0x3ca28f=_0xebaf[_0x223ca6];return _0x3ca28f;};'use strict';var multer=require('multer');var util=require(_0xfeba('0x0'));var path=require('path');var timeout=require(_0xfeba('0x1'));var express=require(_0xfeba('0x2'));var router=express[_0xfeba('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfeba('0x4'));var controller=require(_0xfeba('0x5'));router[_0xfeba('0x6')]('/',auth[_0xfeba('0x7')](),controller[_0xfeba('0x8')]);router[_0xfeba('0x6')](_0xfeba('0x9'),auth[_0xfeba('0x7')](),controller[_0xfeba('0xa')]);router['post']('/',auth[_0xfeba('0x7')](),controller['create']);router[_0xfeba('0xb')]('/:id',auth[_0xfeba('0x7')](),controller[_0xfeba('0xc')]);router[_0xfeba('0xd')](_0xfeba('0x9'),auth[_0xfeba('0x7')](),controller['destroy']);module[_0xfeba('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 018dcb7..8888082 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 _0x0f9f=['STRING','name','sequelize','exports'];(function(_0x4b793b,_0x1ee112){var _0xcfbd6a=function(_0x2eb91c){while(--_0x2eb91c){_0x4b793b['push'](_0x4b793b['shift']());}};_0xcfbd6a(++_0x1ee112);}(_0x0f9f,0xae));var _0xf0f9=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x0f9f[_0x16b992];return _0x385c78;};'use strict';var Sequelize=require(_0xf0f9('0x0'));module[_0xf0f9('0x1')]={'name':{'type':Sequelize[_0xf0f9('0x2')],'allowNull':![],'unique':_0xf0f9('0x3')},'description':{'type':Sequelize[_0xf0f9('0x2')]}}; \ No newline at end of file +var _0xf1c6=['sequelize','exports','STRING','name'];(function(_0x454af0,_0xfe1e7d){var _0x1abcef=function(_0x21d7c8){while(--_0x21d7c8){_0x454af0['push'](_0x454af0['shift']());}};_0x1abcef(++_0xfe1e7d);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x20e814,_0x42f1d4){_0x20e814=_0x20e814-0x0;var _0x50c359=_0xf1c6[_0x20e814];return _0x50c359;};'use strict';var Sequelize=require(_0x6f1c('0x0'));module[_0x6f1c('0x1')]={'name':{'type':Sequelize[_0x6f1c('0x2')],'allowNull':![],'unique':_0x6f1c('0x3')},'description':{'type':Sequelize[_0x6f1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d480599..f60a592 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 _0xb0d3=['attrUrl','attrs','https://','custom','value','clock','HH:mm:ss','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','findOne','getItems','nolimit','eml-format','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','set','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','end','stack','name','index','map','Dashboard','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','include','findAll','rows','params','includeAll','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb0d3,0xfa));var _0x3b0d=function(_0x89100d,_0x59c43d){_0x89100d=_0x89100d-0x0;var _0x15974a=_0xb0d3[_0x89100d];return _0x15974a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b0d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b0d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3b0d('0x2'));var util=require('util');var path=require(_0x3b0d('0x3'));var sox=require(_0x3b0d('0x4'));var csv=require(_0x3b0d('0x5'));var ejs=require(_0x3b0d('0x6'));var fs=require('fs');var _=require(_0x3b0d('0x7'));var squel=require(_0x3b0d('0x8'));var crypto=require(_0x3b0d('0x9'));var jsforce=require(_0x3b0d('0xa'));var deskjs=require(_0x3b0d('0xb'));var toCsv=require(_0x3b0d('0x5'));var querystring=require(_0x3b0d('0xc'));var Papa=require(_0x3b0d('0xd'));var Redis=require(_0x3b0d('0xe'));var authService=require(_0x3b0d('0xf'));var qs=require(_0x3b0d('0x10'));var as=require(_0x3b0d('0x11'));var hardwareService=require(_0x3b0d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3b0d('0x13'));var config=require(_0x3b0d('0x14'));var db=require(_0x3b0d('0x15'))['db'];config[_0x3b0d('0x16')]=_[_0x3b0d('0x17')](config[_0x3b0d('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b0d('0x18'))(new Redis(config[_0x3b0d('0x16')]));require(_0x3b0d('0x19'))[_0x3b0d('0x1a')](socket);function respondWithStatusCode(_0x5280d8,_0x4543ef){_0x4543ef=_0x4543ef||0xcc;return function(_0x38157e){if(_0x38157e){return _0x5280d8[_0x3b0d('0x1b')](_0x4543ef);}return _0x5280d8[_0x3b0d('0x1c')](_0x4543ef)['end']();};}function respondWithResult(_0x4522eb,_0x2467d7){_0x2467d7=_0x2467d7||0xc8;return function(_0xc73bd8){if(_0xc73bd8){return _0x4522eb['status'](_0x2467d7)[_0x3b0d('0x1d')](_0xc73bd8);}};}function respondWithFilteredResult(_0x2a40b8,_0x1c8bbe){return function(_0x591003){if(_0x591003){var _0x4b2be9=_0x591003['count'],_0x511a57=_0x1c8bbe['offset'],_0x4589d2=_0x1c8bbe[_0x3b0d('0x1e')]+_0x1c8bbe['limit'],_0x11ac55;if(_0x4589d2>=_0x4b2be9){_0x4589d2=_0x4b2be9;_0x11ac55=0xc8;}else{_0x11ac55=0xce;}_0x2a40b8[_0x3b0d('0x1c')](_0x11ac55);return _0x2a40b8[_0x3b0d('0x1f')]('Content-Range',_0x511a57+'-'+_0x4589d2+'/'+_0x4b2be9)[_0x3b0d('0x1d')](_0x591003);}return null;};}function patchUpdates(_0xc4ae44){return function(_0x4c01fd){try{jsonpatch[_0x3b0d('0x20')](_0x4c01fd,_0xc4ae44,!![]);}catch(_0x1a946b){return BPromise[_0x3b0d('0x21')](_0x1a946b);}return _0x4c01fd[_0x3b0d('0x22')]();};}function saveUpdates(_0x38e45,_0x447e6f){return function(_0x5093ec){if(_0x5093ec){return _0x5093ec[_0x3b0d('0x23')](_0x38e45)[_0x3b0d('0x24')](function(_0x696856){return _0x696856;});}return null;};}function removeEntity(_0x1a6eef,_0x2465ff){return function(_0x36f536){if(_0x36f536){return _0x36f536['destroy']()[_0x3b0d('0x24')](function(){var _0x37d490=_0x36f536[_0x3b0d('0x25')]({'plain':!![]});var _0x45d605=_0x3b0d('0x26');return db[_0x3b0d('0x27')][_0x3b0d('0x28')]({'where':{'type':_0x45d605,'resourceId':_0x37d490['id']}})['then'](function(){return _0x36f536;});})[_0x3b0d('0x24')](function(){_0x1a6eef[_0x3b0d('0x1c')](0xcc)[_0x3b0d('0x29')]();});}};}function handleEntityNotFound(_0x9a6152,_0x5be812){return function(_0x5904b4){if(!_0x5904b4){_0x9a6152[_0x3b0d('0x1b')](0x194);}return _0x5904b4;};}function handleError(_0x3f812f,_0x5b5b){_0x5b5b=_0x5b5b||0x1f4;return function(_0x30b818){logger['error'](_0x30b818[_0x3b0d('0x2a')]);if(_0x30b818[_0x3b0d('0x2b')]){delete _0x30b818[_0x3b0d('0x2b')];}_0x3f812f[_0x3b0d('0x1c')](_0x5b5b)['send'](_0x30b818);};}exports[_0x3b0d('0x2c')]=function(_0x239a27,_0x139c06){var _0x2d8679={},_0x527916={},_0x363f34={'count':0x0,'rows':[]};var _0x2b7731=_[_0x3b0d('0x2d')](db[_0x3b0d('0x2e')][_0x3b0d('0x2f')],function(_0x4e5959){return{'name':_0x4e5959['fieldName'],'type':_0x4e5959['type']['key']};});_0x527916[_0x3b0d('0x30')]=_[_0x3b0d('0x2d')](_0x2b7731,_0x3b0d('0x2b'));_0x527916[_0x3b0d('0x31')]=_[_0x3b0d('0x32')](_0x239a27[_0x3b0d('0x31')]);_0x527916[_0x3b0d('0x33')]=_['intersection'](_0x527916['model'],_0x527916[_0x3b0d('0x31')]);_0x2d8679[_0x3b0d('0x34')]=_[_0x3b0d('0x35')](_0x527916[_0x3b0d('0x30')],qs[_0x3b0d('0x36')](_0x239a27[_0x3b0d('0x31')]['fields']));_0x2d8679[_0x3b0d('0x34')]=_0x2d8679[_0x3b0d('0x34')][_0x3b0d('0x37')]?_0x2d8679[_0x3b0d('0x34')]:_0x527916[_0x3b0d('0x30')];if(!_0x239a27['query'][_0x3b0d('0x38')]('nolimit')){_0x2d8679[_0x3b0d('0x39')]=qs[_0x3b0d('0x39')](_0x239a27[_0x3b0d('0x31')][_0x3b0d('0x39')]);_0x2d8679[_0x3b0d('0x1e')]=qs[_0x3b0d('0x1e')](_0x239a27[_0x3b0d('0x31')][_0x3b0d('0x1e')]);}_0x2d8679[_0x3b0d('0x3a')]=qs[_0x3b0d('0x3b')](_0x239a27[_0x3b0d('0x31')][_0x3b0d('0x3b')]);_0x2d8679[_0x3b0d('0x3c')]=qs[_0x3b0d('0x33')](_[_0x3b0d('0x3d')](_0x239a27[_0x3b0d('0x31')],_0x527916[_0x3b0d('0x33')]),_0x2b7731);if(_0x239a27[_0x3b0d('0x31')][_0x3b0d('0x3e')]){_0x2d8679[_0x3b0d('0x3c')]=_[_0x3b0d('0x3f')](_0x2d8679['where'],{'$or':_[_0x3b0d('0x2d')](_0x2b7731,function(_0x490df0){if(_0x490df0[_0x3b0d('0x40')]!==_0x3b0d('0x41')){var _0x3cdd18={};_0x3cdd18[_0x490df0[_0x3b0d('0x2b')]]={'$like':'%'+_0x239a27['query'][_0x3b0d('0x3e')]+'%'};return _0x3cdd18;}})});}_0x2d8679=_[_0x3b0d('0x3f')]({},_0x2d8679,_0x239a27['options']);var _0xe42958={'where':_0x2d8679[_0x3b0d('0x3c')]};return db['Dashboard'][_0x3b0d('0x42')](_0xe42958)[_0x3b0d('0x24')](function(_0x5de619){_0x363f34[_0x3b0d('0x42')]=_0x5de619;if(_0x239a27[_0x3b0d('0x31')]['includeAll']){_0x2d8679[_0x3b0d('0x43')]=[{'all':!![]}];}return db[_0x3b0d('0x2e')][_0x3b0d('0x44')](_0x2d8679);})[_0x3b0d('0x24')](function(_0x5ba586){_0x363f34[_0x3b0d('0x45')]=_0x5ba586;return _0x363f34;})['then'](respondWithFilteredResult(_0x139c06,_0x2d8679))['catch'](handleError(_0x139c06,null));};exports['show']=function(_0x2fcdcd,_0x221e4b){var _0x4bf62b={'raw':![],'where':{'id':_0x2fcdcd[_0x3b0d('0x46')]['id']}},_0x2c1a5a={};_0x2c1a5a['model']=_[_0x3b0d('0x32')](db[_0x3b0d('0x2e')][_0x3b0d('0x2f')]);_0x2c1a5a[_0x3b0d('0x31')]=_[_0x3b0d('0x32')](_0x2fcdcd[_0x3b0d('0x31')]);_0x2c1a5a[_0x3b0d('0x33')]=_[_0x3b0d('0x35')](_0x2c1a5a[_0x3b0d('0x30')],_0x2c1a5a['query']);_0x4bf62b[_0x3b0d('0x34')]=_[_0x3b0d('0x35')](_0x2c1a5a[_0x3b0d('0x30')],qs[_0x3b0d('0x36')](_0x2fcdcd['query']['fields']));_0x4bf62b['attributes']=_0x4bf62b[_0x3b0d('0x34')][_0x3b0d('0x37')]?_0x4bf62b[_0x3b0d('0x34')]:_0x2c1a5a[_0x3b0d('0x30')];if(_0x2fcdcd[_0x3b0d('0x31')][_0x3b0d('0x47')]){_0x4bf62b[_0x3b0d('0x43')]=[{'all':!![]}];}_0x4bf62b=_[_0x3b0d('0x3f')]({},_0x4bf62b,_0x2fcdcd['options']);return db['Dashboard'][_0x3b0d('0x48')](_0x4bf62b)[_0x3b0d('0x24')](handleEntityNotFound(_0x221e4b,null))['then'](respondWithResult(_0x221e4b,null))[_0x3b0d('0x49')](handleError(_0x221e4b,null));};exports['create']=function(_0x3678f6,_0x254d29){return db[_0x3b0d('0x2e')][_0x3b0d('0x4a')](_0x3678f6[_0x3b0d('0x4b')],{})[_0x3b0d('0x24')](function(_0x38ccdc){var _0x11c049=_0x3678f6['user']['get']({'plain':!![]});if(!_0x11c049)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11c049[_0x3b0d('0x4c')]==='user'){var _0x23377e=_0x38ccdc[_0x3b0d('0x25')]({'plain':!![]});var _0x3ba8ea=_0x3b0d('0x26');return db[_0x3b0d('0x4d')][_0x3b0d('0x48')]({'where':{'name':_0x3ba8ea,'userProfileId':_0x11c049[_0x3b0d('0x4e')]},'raw':!![]})['then'](function(_0x542b47){if(_0x542b47&&_0x542b47[_0x3b0d('0x4f')]===0x0){return db['UserProfileResource'][_0x3b0d('0x4a')]({'name':_0x23377e['name'],'resourceId':_0x23377e['id'],'type':_0x542b47[_0x3b0d('0x2b')],'sectionId':_0x542b47['id']},{})[_0x3b0d('0x24')](function(){return _0x38ccdc;});}else{return _0x38ccdc;}})[_0x3b0d('0x49')](function(_0x1ebdd1){logger[_0x3b0d('0x50')](_0x3b0d('0x51'),_0x1ebdd1);throw _0x1ebdd1;});}return _0x38ccdc;})[_0x3b0d('0x24')](respondWithResult(_0x254d29,0xc9))['catch'](handleError(_0x254d29,null));};exports[_0x3b0d('0x52')]=function(_0x13335e,_0x5684ec){var _0x496264={'where':{'id':_0x13335e[_0x3b0d('0x46')]['id']}},_0x4824c0={};_0x4824c0[_0x3b0d('0x30')]=_[_0x3b0d('0x32')](db[_0x3b0d('0x2e')]['rawAttributes']);_0x496264['attributes']=_['intersection'](_0x4824c0[_0x3b0d('0x30')],qs['fields'](_0x13335e['query'][_0x3b0d('0x36')]));_0x496264[_0x3b0d('0x34')]=_0x496264[_0x3b0d('0x34')][_0x3b0d('0x37')]?_0x496264[_0x3b0d('0x34')]:_0x4824c0[_0x3b0d('0x30')];if(_0x13335e[_0x3b0d('0x31')][_0x3b0d('0x47')]){_0x496264['include']=[{'all':!![]}];}_0x496264=_['merge']({},_0x496264,_0x13335e[_0x3b0d('0x53')]);return db['Dashboard'][_0x3b0d('0x48')](_0x496264)[_0x3b0d('0x24')](handleEntityNotFound(_0x5684ec,null))[_0x3b0d('0x24')](function(_0x2b4d12){if(_0x2b4d12){var _0x22704e=_0x2b4d12[_0x3b0d('0x25')]({'plain':!![]});_0x22704e=qs[_0x3b0d('0x54')](_0x22704e,['id',_0x3b0d('0x55'),_0x3b0d('0x56')]);_0x13335e[_0x3b0d('0x4b')]=_[_0x3b0d('0x54')](_0x13335e[_0x3b0d('0x4b')],['id',_0x3b0d('0x55'),'updatedAt']);return db['Dashboard'][_0x3b0d('0x4a')](_['merge'](_0x22704e,_0x13335e[_0x3b0d('0x4b')]),{'include':_0x13335e[_0x3b0d('0x31')][_0x3b0d('0x47')]?[{'all':!![]}]:undefined})[_0x3b0d('0x24')](function(_0x37ba0c){var _0x31b12a=_0x13335e[_0x3b0d('0x57')][_0x3b0d('0x25')]({'plain':!![]});if(!_0x31b12a)throw new Error(_0x3b0d('0x58'));if(_0x31b12a['role']===_0x3b0d('0x57')){var _0x46637f=_0x37ba0c[_0x3b0d('0x25')]({'plain':!![]});var _0x2d625f=_0x3b0d('0x26');return db[_0x3b0d('0x4d')]['find']({'where':{'name':_0x2d625f,'userProfileId':_0x31b12a['userProfileId']},'raw':!![]})[_0x3b0d('0x24')](function(_0x38ec8d){if(_0x38ec8d&&_0x38ec8d['autoAssociation']===0x0){return db[_0x3b0d('0x27')][_0x3b0d('0x4a')]({'name':_0x46637f[_0x3b0d('0x2b')],'resourceId':_0x46637f['id'],'type':_0x38ec8d[_0x3b0d('0x2b')],'sectionId':_0x38ec8d['id']},{})['then'](function(){return _0x37ba0c;});}else{return _0x37ba0c;}})[_0x3b0d('0x49')](function(_0x461771){logger[_0x3b0d('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x461771);throw _0x461771;});}return _0x37ba0c;});}})[_0x3b0d('0x24')](respondWithResult(_0x5684ec,0xc9))[_0x3b0d('0x49')](handleError(_0x5684ec,null));};exports['update']=function(_0x1a8003,_0x5e0994){if(_0x1a8003['body']['id']){delete _0x1a8003[_0x3b0d('0x4b')]['id'];}return db[_0x3b0d('0x2e')]['find']({'where':{'id':_0x1a8003[_0x3b0d('0x46')]['id']}})[_0x3b0d('0x24')](handleEntityNotFound(_0x5e0994,null))[_0x3b0d('0x24')](saveUpdates(_0x1a8003[_0x3b0d('0x4b')],null))[_0x3b0d('0x24')](respondWithResult(_0x5e0994,null))[_0x3b0d('0x49')](handleError(_0x5e0994,null));};exports['destroy']=function(_0x22b905,_0xa37736){return db[_0x3b0d('0x2e')][_0x3b0d('0x48')]({'where':{'id':_0x22b905[_0x3b0d('0x46')]['id']}})[_0x3b0d('0x24')](handleEntityNotFound(_0xa37736,null))['then'](removeEntity(_0xa37736,null))[_0x3b0d('0x49')](handleError(_0xa37736,null));};function widgetAttributes(_0x4d352b){try{switch(_0x4d352b['type']){case'iframe':return[{'name':_0x3b0d('0x59'),'value':_0x4d352b[_0x3b0d('0x59')]||(_0x4d352b['attrs']&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0]['value']:undefined)||_0x3b0d('0x5b')}];case _0x3b0d('0x5c'):return[{'name':'attrPath','value':_0x4d352b['attrPath']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0][_0x3b0d('0x5d')]:undefined)||''}];case _0x3b0d('0x5e'):return[{'name':'attrHourFormat','value':_0x4d352b['attrHourFormat']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0][_0x3b0d('0x5d')]:undefined)||_0x3b0d('0x5f')},{'name':'attrTimezone','value':_0x4d352b['attrTimezone']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b['attrs'][0x1]?_0x4d352b['attrs'][0x1][_0x3b0d('0x5d')]:undefined)||_0x3b0d('0x60')},{'name':_0x3b0d('0x61'),'value':_0x4d352b[_0x3b0d('0x61')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x2]?_0x4d352b[_0x3b0d('0x5a')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x3b0d('0x62'),'value':_0x4d352b[_0x3b0d('0x62')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0][_0x3b0d('0x5d')]:undefined)||'total'},{'name':_0x3b0d('0x63'),'value':_0x4d352b['attrVoiceQueues']||(_0x4d352b['attrs']&&_0x4d352b[_0x3b0d('0x5a')][0x1]?_0x4d352b['attrs'][0x1]['value']:undefined)||[]},{'name':_0x3b0d('0x61'),'value':_0x4d352b['attrFontSize']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b['attrs'][0x2]?_0x4d352b[_0x3b0d('0x5a')][0x2]['value']:undefined)||0x14}];case _0x3b0d('0x64'):case'pie-chart':return[{'name':_0x3b0d('0x65'),'value':_0x4d352b['attrSerie1']||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x3b0d('0x66'),'value':_0x4d352b[_0x3b0d('0x66')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b['attrs'][0x1]?_0x4d352b[_0x3b0d('0x5a')][0x1][_0x3b0d('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x4d352b[_0x3b0d('0x67')]||(_0x4d352b['attrs']&&_0x4d352b[_0x3b0d('0x5a')][0x2]?_0x4d352b[_0x3b0d('0x5a')][0x2][_0x3b0d('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4d352b[_0x3b0d('0x63')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x3]?_0x4d352b[_0x3b0d('0x5a')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x4d352b[_0x3b0d('0x68')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0]['type']:undefined)||null,'value':_0x4d352b[_0x3b0d('0x69')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b[_0x3b0d('0x5a')][0x0]?_0x4d352b[_0x3b0d('0x5a')][0x0][_0x3b0d('0x5d')]:undefined)||null},{'name':_0x3b0d('0x6a'),'value':_0x4d352b[_0x3b0d('0x6a')]||(_0x4d352b[_0x3b0d('0x5a')]&&_0x4d352b['attrs'][0x1]?_0x4d352b[_0x3b0d('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x28586d){logger[_0x3b0d('0x50')]('widgetAttributes:\x20%s',JSON['stringify'](_0x28586d));return[];}}exports[_0x3b0d('0x6b')]=function(_0x3a1305,_0xa7faa1,_0x4e50fc){if(_0x3a1305['body']['id']){delete _0x3a1305['body']['id'];}return db[_0x3b0d('0x2e')][_0x3b0d('0x48')]({'where':{'id':_0x3a1305[_0x3b0d('0x46')]['id']}})[_0x3b0d('0x24')](handleEntityNotFound(_0xa7faa1,null))[_0x3b0d('0x24')](function(_0x19681e){if(_0x19681e){_0x3a1305[_0x3b0d('0x4b')][_0x3b0d('0x6c')]=_0x19681e['id'];_0x3a1305['body'][_0x3b0d('0x5a')]=widgetAttributes(_0x3a1305[_0x3b0d('0x4b')]);return db[_0x3b0d('0x6d')][_0x3b0d('0x4a')](_0x3a1305[_0x3b0d('0x4b')]);}})[_0x3b0d('0x24')](respondWithResult(_0xa7faa1,null))['catch'](handleError(_0xa7faa1,null));};exports['getItems']=function(_0x55ab0c,_0x1cd5ac,_0x152e59){var _0x1d9a3e={};var _0x49bfeb={};var _0x2a8dea;var _0x36bdfa;return db[_0x3b0d('0x2e')][_0x3b0d('0x6e')]({'where':{'id':_0x55ab0c[_0x3b0d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1cd5ac,null))[_0x3b0d('0x24')](function(_0x1ba595){if(_0x1ba595){_0x2a8dea=_0x1ba595;_0x49bfeb[_0x3b0d('0x30')]=_[_0x3b0d('0x32')](db[_0x3b0d('0x6d')][_0x3b0d('0x2f')]);_0x49bfeb[_0x3b0d('0x31')]=_[_0x3b0d('0x32')](_0x55ab0c[_0x3b0d('0x31')]);_0x49bfeb[_0x3b0d('0x33')]=_[_0x3b0d('0x35')](_0x49bfeb[_0x3b0d('0x30')],_0x49bfeb[_0x3b0d('0x31')]);_0x1d9a3e['attributes']=_[_0x3b0d('0x35')](_0x49bfeb[_0x3b0d('0x30')],qs[_0x3b0d('0x36')](_0x55ab0c[_0x3b0d('0x31')][_0x3b0d('0x36')]));_0x1d9a3e['attributes']=_0x1d9a3e[_0x3b0d('0x34')][_0x3b0d('0x37')]?_0x1d9a3e[_0x3b0d('0x34')]:_0x49bfeb[_0x3b0d('0x30')];_0x1d9a3e[_0x3b0d('0x3a')]=qs[_0x3b0d('0x3b')](_0x55ab0c[_0x3b0d('0x31')][_0x3b0d('0x3b')]);_0x1d9a3e[_0x3b0d('0x3c')]=qs['filters'](_[_0x3b0d('0x3d')](_0x55ab0c['query'],_0x49bfeb[_0x3b0d('0x33')]));if(_0x55ab0c[_0x3b0d('0x31')][_0x3b0d('0x3e')]){_0x1d9a3e['where']=_['merge'](_0x1d9a3e[_0x3b0d('0x3c')],{'$or':_[_0x3b0d('0x2d')](_0x1d9a3e[_0x3b0d('0x34')],function(_0x36bb05){var _0x5e9bfc={};_0x5e9bfc[_0x36bb05]={'$like':'%'+_0x55ab0c['query'][_0x3b0d('0x3e')]+'%'};return _0x5e9bfc;})});}_0x1d9a3e=_[_0x3b0d('0x3f')]({},_0x1d9a3e,_0x55ab0c[_0x3b0d('0x53')]);return _0x2a8dea[_0x3b0d('0x6f')](_0x1d9a3e);}})[_0x3b0d('0x24')](function(_0x1a46f3){if(_0x1a46f3){_0x36bdfa=_0x1a46f3['length'];if(!_0x55ab0c['query'][_0x3b0d('0x38')](_0x3b0d('0x70'))){_0x1d9a3e[_0x3b0d('0x39')]=qs['limit'](_0x55ab0c['query'][_0x3b0d('0x39')]);_0x1d9a3e[_0x3b0d('0x1e')]=qs[_0x3b0d('0x1e')](_0x55ab0c[_0x3b0d('0x31')][_0x3b0d('0x1e')]);}return _0x2a8dea[_0x3b0d('0x6f')](_0x1d9a3e);}})[_0x3b0d('0x24')](function(_0x17cf38){if(_0x17cf38){return _0x17cf38?{'count':_0x36bdfa,'rows':_0x17cf38}:null;}})[_0x3b0d('0x24')](respondWithResult(_0x1cd5ac,null))[_0x3b0d('0x49')](handleError(_0x1cd5ac,null));}; \ No newline at end of file +var _0xf89f=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','end','json','count','offset','limit','set','apply','reject','save','update','then','get','CustomDashboards','sendStatus','error','name','status','send','index','Dashboard','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','destroy','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf89f,0x158));var _0xff89=function(_0x17a2b5,_0x239133){_0x17a2b5=_0x17a2b5-0x0;var _0x1be2a0=_0xf89f[_0x17a2b5];return _0x1be2a0;};'use strict';var pdf=require(_0xff89('0x0'));var emlformat=require(_0xff89('0x1'));var rimraf=require(_0xff89('0x2'));var zipdir=require(_0xff89('0x3'));var jsonpatch=require(_0xff89('0x4'));var rp=require(_0xff89('0x5'));var moment=require(_0xff89('0x6'));var BPromise=require(_0xff89('0x7'));var Mustache=require(_0xff89('0x8'));var util=require(_0xff89('0x9'));var path=require(_0xff89('0xa'));var sox=require(_0xff89('0xb'));var csv=require(_0xff89('0xc'));var ejs=require(_0xff89('0xd'));var fs=require('fs');var _=require(_0xff89('0xe'));var squel=require(_0xff89('0xf'));var crypto=require(_0xff89('0x10'));var jsforce=require(_0xff89('0x11'));var deskjs=require(_0xff89('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff89('0x13'));var Redis=require(_0xff89('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xff89('0x15'));var as=require(_0xff89('0x16'));var hardwareService=require(_0xff89('0x17'));var logger=require('../../config/logger')(_0xff89('0x18'));var utils=require(_0xff89('0x19'));var config=require('../../config/environment');var db=require(_0xff89('0x1a'))['db'];config[_0xff89('0x1b')]=_[_0xff89('0x1c')](config['redis'],{'host':_0xff89('0x1d'),'port':0x18eb});var socket=require(_0xff89('0x1e'))(new Redis(config[_0xff89('0x1b')]));require(_0xff89('0x1f'))[_0xff89('0x20')](socket);function respondWithStatusCode(_0x2a57c4,_0x4ab415){_0x4ab415=_0x4ab415||0xcc;return function(_0x368a97){if(_0x368a97){return _0x2a57c4['sendStatus'](_0x4ab415);}return _0x2a57c4['status'](_0x4ab415)[_0xff89('0x21')]();};}function respondWithResult(_0x253919,_0x1246e2){_0x1246e2=_0x1246e2||0xc8;return function(_0x52f554){if(_0x52f554){return _0x253919['status'](_0x1246e2)[_0xff89('0x22')](_0x52f554);}};}function respondWithFilteredResult(_0x466213,_0x3988ee){return function(_0x168586){if(_0x168586){var _0x43450b=_0x168586[_0xff89('0x23')],_0x274a00=_0x3988ee[_0xff89('0x24')],_0x21533b=_0x3988ee[_0xff89('0x24')]+_0x3988ee[_0xff89('0x25')],_0x211e63;if(_0x21533b>=_0x43450b){_0x21533b=_0x43450b;_0x211e63=0xc8;}else{_0x211e63=0xce;}_0x466213['status'](_0x211e63);return _0x466213[_0xff89('0x26')]('Content-Range',_0x274a00+'-'+_0x21533b+'/'+_0x43450b)[_0xff89('0x22')](_0x168586);}return null;};}function patchUpdates(_0x126f83){return function(_0xd08dcb){try{jsonpatch[_0xff89('0x27')](_0xd08dcb,_0x126f83,!![]);}catch(_0x1abcb8){return BPromise[_0xff89('0x28')](_0x1abcb8);}return _0xd08dcb[_0xff89('0x29')]();};}function saveUpdates(_0x41b676,_0x151b47){return function(_0x5cfbd6){if(_0x5cfbd6){return _0x5cfbd6[_0xff89('0x2a')](_0x41b676)[_0xff89('0x2b')](function(_0xe0f92e){return _0xe0f92e;});}return null;};}function removeEntity(_0x5e8725,_0xa1355c){return function(_0x3f549f){if(_0x3f549f){return _0x3f549f['destroy']()[_0xff89('0x2b')](function(){var _0x36e852=_0x3f549f[_0xff89('0x2c')]({'plain':!![]});var _0x1395eb=_0xff89('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x1395eb,'resourceId':_0x36e852['id']}})[_0xff89('0x2b')](function(){return _0x3f549f;});})[_0xff89('0x2b')](function(){_0x5e8725['status'](0xcc)[_0xff89('0x21')]();});}};}function handleEntityNotFound(_0x5b3221,_0x802333){return function(_0x15a807){if(!_0x15a807){_0x5b3221[_0xff89('0x2e')](0x194);}return _0x15a807;};}function handleError(_0x543cd3,_0x208d4b){_0x208d4b=_0x208d4b||0x1f4;return function(_0x1bd64f){logger[_0xff89('0x2f')](_0x1bd64f['stack']);if(_0x1bd64f[_0xff89('0x30')]){delete _0x1bd64f[_0xff89('0x30')];}_0x543cd3[_0xff89('0x31')](_0x208d4b)[_0xff89('0x32')](_0x1bd64f);};}exports[_0xff89('0x33')]=function(_0x203161,_0x2e5751){var _0x56bf28={},_0x3389b8={},_0x5f28ca={'count':0x0,'rows':[]};var _0x3d0f01=_['map'](db[_0xff89('0x34')][_0xff89('0x35')],function(_0xbc4aa6){return{'name':_0xbc4aa6[_0xff89('0x36')],'type':_0xbc4aa6[_0xff89('0x37')]['key']};});_0x3389b8[_0xff89('0x38')]=_[_0xff89('0x39')](_0x3d0f01,_0xff89('0x30'));_0x3389b8[_0xff89('0x3a')]=_[_0xff89('0x3b')](_0x203161[_0xff89('0x3a')]);_0x3389b8[_0xff89('0x3c')]=_[_0xff89('0x3d')](_0x3389b8[_0xff89('0x38')],_0x3389b8[_0xff89('0x3a')]);_0x56bf28[_0xff89('0x3e')]=_['intersection'](_0x3389b8[_0xff89('0x38')],qs['fields'](_0x203161[_0xff89('0x3a')][_0xff89('0x3f')]));_0x56bf28[_0xff89('0x3e')]=_0x56bf28[_0xff89('0x3e')][_0xff89('0x40')]?_0x56bf28['attributes']:_0x3389b8['model'];if(!_0x203161[_0xff89('0x3a')][_0xff89('0x41')](_0xff89('0x42'))){_0x56bf28[_0xff89('0x25')]=qs[_0xff89('0x25')](_0x203161[_0xff89('0x3a')][_0xff89('0x25')]);_0x56bf28[_0xff89('0x24')]=qs[_0xff89('0x24')](_0x203161['query'][_0xff89('0x24')]);}_0x56bf28[_0xff89('0x43')]=qs[_0xff89('0x44')](_0x203161[_0xff89('0x3a')][_0xff89('0x44')]);_0x56bf28[_0xff89('0x45')]=qs[_0xff89('0x3c')](_[_0xff89('0x46')](_0x203161['query'],_0x3389b8[_0xff89('0x3c')]),_0x3d0f01);if(_0x203161[_0xff89('0x3a')][_0xff89('0x47')]){_0x56bf28['where']=_['merge'](_0x56bf28['where'],{'$or':_['map'](_0x3d0f01,function(_0x16f50d){if(_0x16f50d['type']!==_0xff89('0x48')){var _0x5605c2={};_0x5605c2[_0x16f50d[_0xff89('0x30')]]={'$like':'%'+_0x203161[_0xff89('0x3a')]['filter']+'%'};return _0x5605c2;}})});}_0x56bf28=_[_0xff89('0x49')]({},_0x56bf28,_0x203161[_0xff89('0x4a')]);var _0x2c18e8={'where':_0x56bf28['where']};return db[_0xff89('0x34')][_0xff89('0x23')](_0x2c18e8)[_0xff89('0x2b')](function(_0xc4b51e){_0x5f28ca[_0xff89('0x23')]=_0xc4b51e;if(_0x203161[_0xff89('0x3a')][_0xff89('0x4b')]){_0x56bf28['include']=[{'all':!![]}];}return db[_0xff89('0x34')][_0xff89('0x4c')](_0x56bf28);})[_0xff89('0x2b')](function(_0x324a4b){_0x5f28ca[_0xff89('0x4d')]=_0x324a4b;return _0x5f28ca;})[_0xff89('0x2b')](respondWithFilteredResult(_0x2e5751,_0x56bf28))[_0xff89('0x4e')](handleError(_0x2e5751,null));};exports[_0xff89('0x4f')]=function(_0x2a2ef4,_0x4445f9){var _0x5edf5e={'raw':![],'where':{'id':_0x2a2ef4[_0xff89('0x50')]['id']}},_0x49d536={};_0x49d536[_0xff89('0x38')]=_[_0xff89('0x3b')](db[_0xff89('0x34')][_0xff89('0x35')]);_0x49d536[_0xff89('0x3a')]=_[_0xff89('0x3b')](_0x2a2ef4['query']);_0x49d536[_0xff89('0x3c')]=_[_0xff89('0x3d')](_0x49d536[_0xff89('0x38')],_0x49d536['query']);_0x5edf5e[_0xff89('0x3e')]=_[_0xff89('0x3d')](_0x49d536[_0xff89('0x38')],qs['fields'](_0x2a2ef4[_0xff89('0x3a')]['fields']));_0x5edf5e[_0xff89('0x3e')]=_0x5edf5e[_0xff89('0x3e')][_0xff89('0x40')]?_0x5edf5e[_0xff89('0x3e')]:_0x49d536['model'];if(_0x2a2ef4[_0xff89('0x3a')]['includeAll']){_0x5edf5e[_0xff89('0x51')]=[{'all':!![]}];}_0x5edf5e=_[_0xff89('0x49')]({},_0x5edf5e,_0x2a2ef4[_0xff89('0x4a')]);return db[_0xff89('0x34')]['find'](_0x5edf5e)[_0xff89('0x2b')](handleEntityNotFound(_0x4445f9,null))[_0xff89('0x2b')](respondWithResult(_0x4445f9,null))[_0xff89('0x4e')](handleError(_0x4445f9,null));};exports[_0xff89('0x52')]=function(_0x2a8f65,_0x14d104){return db[_0xff89('0x34')][_0xff89('0x52')](_0x2a8f65['body'],{})[_0xff89('0x2b')](function(_0x5e3847){var _0x2a40c6=_0x2a8f65['user'][_0xff89('0x2c')]({'plain':!![]});if(!_0x2a40c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a40c6['role']==='user'){var _0x145e3a=_0x5e3847[_0xff89('0x2c')]({'plain':!![]});var _0x3e4339='CustomDashboards';return db[_0xff89('0x53')][_0xff89('0x54')]({'where':{'name':_0x3e4339,'userProfileId':_0x2a40c6[_0xff89('0x55')]},'raw':!![]})['then'](function(_0x18ce52){if(_0x18ce52&&_0x18ce52[_0xff89('0x56')]===0x0){return db[_0xff89('0x57')][_0xff89('0x52')]({'name':_0x145e3a[_0xff89('0x30')],'resourceId':_0x145e3a['id'],'type':_0x18ce52[_0xff89('0x30')],'sectionId':_0x18ce52['id']},{})[_0xff89('0x2b')](function(){return _0x5e3847;});}else{return _0x5e3847;}})[_0xff89('0x4e')](function(_0x170f27){logger[_0xff89('0x2f')](_0xff89('0x58'),_0x170f27);throw _0x170f27;});}return _0x5e3847;})[_0xff89('0x2b')](respondWithResult(_0x14d104,0xc9))[_0xff89('0x4e')](handleError(_0x14d104,null));};exports[_0xff89('0x59')]=function(_0x295bae,_0x53b245){var _0x15255e={'where':{'id':_0x295bae[_0xff89('0x50')]['id']}},_0x17d840={};_0x17d840[_0xff89('0x38')]=_[_0xff89('0x3b')](db[_0xff89('0x34')][_0xff89('0x35')]);_0x15255e['attributes']=_[_0xff89('0x3d')](_0x17d840[_0xff89('0x38')],qs[_0xff89('0x3f')](_0x295bae['query'][_0xff89('0x3f')]));_0x15255e[_0xff89('0x3e')]=_0x15255e[_0xff89('0x3e')]['length']?_0x15255e[_0xff89('0x3e')]:_0x17d840['model'];if(_0x295bae[_0xff89('0x3a')][_0xff89('0x4b')]){_0x15255e[_0xff89('0x51')]=[{'all':!![]}];}_0x15255e=_['merge']({},_0x15255e,_0x295bae[_0xff89('0x4a')]);return db[_0xff89('0x34')][_0xff89('0x54')](_0x15255e)[_0xff89('0x2b')](handleEntityNotFound(_0x53b245,null))[_0xff89('0x2b')](function(_0x50a8bf){if(_0x50a8bf){var _0xa8fd8a=_0x50a8bf['get']({'plain':!![]});_0xa8fd8a=qs[_0xff89('0x5a')](_0xa8fd8a,['id',_0xff89('0x5b'),_0xff89('0x5c')]);_0x295bae[_0xff89('0x5d')]=_[_0xff89('0x5a')](_0x295bae[_0xff89('0x5d')],['id','createdAt',_0xff89('0x5c')]);return db['Dashboard'][_0xff89('0x52')](_[_0xff89('0x49')](_0xa8fd8a,_0x295bae['body']),{'include':_0x295bae[_0xff89('0x3a')][_0xff89('0x4b')]?[{'all':!![]}]:undefined})[_0xff89('0x2b')](function(_0x4b4ceb){var _0x3f9c43=_0x295bae[_0xff89('0x5e')][_0xff89('0x2c')]({'plain':!![]});if(!_0x3f9c43)throw new Error(_0xff89('0x5f'));if(_0x3f9c43['role']==='user'){var _0x58ba2=_0x4b4ceb[_0xff89('0x2c')]({'plain':!![]});var _0x5d18a3=_0xff89('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x5d18a3,'userProfileId':_0x3f9c43['userProfileId']},'raw':!![]})[_0xff89('0x2b')](function(_0x16ef2a){if(_0x16ef2a&&_0x16ef2a[_0xff89('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x58ba2['name'],'resourceId':_0x58ba2['id'],'type':_0x16ef2a[_0xff89('0x30')],'sectionId':_0x16ef2a['id']},{})[_0xff89('0x2b')](function(){return _0x4b4ceb;});}else{return _0x4b4ceb;}})['catch'](function(_0x143a26){logger[_0xff89('0x2f')](_0xff89('0x58'),_0x143a26);throw _0x143a26;});}return _0x4b4ceb;});}})['then'](respondWithResult(_0x53b245,0xc9))[_0xff89('0x4e')](handleError(_0x53b245,null));};exports[_0xff89('0x2a')]=function(_0xa456d0,_0x440ebe){if(_0xa456d0[_0xff89('0x5d')]['id']){delete _0xa456d0[_0xff89('0x5d')]['id'];}return db['Dashboard'][_0xff89('0x54')]({'where':{'id':_0xa456d0[_0xff89('0x50')]['id']}})[_0xff89('0x2b')](handleEntityNotFound(_0x440ebe,null))[_0xff89('0x2b')](saveUpdates(_0xa456d0[_0xff89('0x5d')],null))[_0xff89('0x2b')](respondWithResult(_0x440ebe,null))[_0xff89('0x4e')](handleError(_0x440ebe,null));};exports[_0xff89('0x60')]=function(_0x580bed,_0x1fab20){return db[_0xff89('0x34')][_0xff89('0x54')]({'where':{'id':_0x580bed[_0xff89('0x50')]['id']}})['then'](handleEntityNotFound(_0x1fab20,null))['then'](removeEntity(_0x1fab20,null))[_0xff89('0x4e')](handleError(_0x1fab20,null));};function widgetAttributes(_0x4a7b61){try{switch(_0x4a7b61[_0xff89('0x37')]){case _0xff89('0x61'):return[{'name':_0xff89('0x62'),'value':_0x4a7b61[_0xff89('0x62')]||(_0x4a7b61['attrs']&&_0x4a7b61[_0xff89('0x63')][0x0]?_0x4a7b61[_0xff89('0x63')][0x0][_0xff89('0x64')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x4a7b61[_0xff89('0x65')]||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61[_0xff89('0x63')][0x0]?_0x4a7b61[_0xff89('0x63')][0x0][_0xff89('0x64')]:undefined)||''}];case _0xff89('0x66'):return[{'name':_0xff89('0x67'),'value':_0x4a7b61['attrHourFormat']||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61[_0xff89('0x63')][0x0]?_0x4a7b61['attrs'][0x0][_0xff89('0x64')]:undefined)||'HH:mm:ss'},{'name':_0xff89('0x68'),'value':_0x4a7b61[_0xff89('0x68')]||(_0x4a7b61['attrs']&&_0x4a7b61[_0xff89('0x63')][0x1]?_0x4a7b61[_0xff89('0x63')][0x1][_0xff89('0x64')]:undefined)||'0.00'},{'name':_0xff89('0x69'),'value':_0x4a7b61[_0xff89('0x69')]||(_0x4a7b61['attrs']&&_0x4a7b61[_0xff89('0x63')][0x2]?_0x4a7b61[_0xff89('0x63')][0x2][_0xff89('0x64')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x4a7b61[_0xff89('0x6a')]||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61['attrs'][0x0]?_0x4a7b61[_0xff89('0x63')][0x0][_0xff89('0x64')]:undefined)||_0xff89('0x6b')},{'name':_0xff89('0x6c'),'value':_0x4a7b61[_0xff89('0x6c')]||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61[_0xff89('0x63')][0x1]?_0x4a7b61[_0xff89('0x63')][0x1][_0xff89('0x64')]:undefined)||[]},{'name':_0xff89('0x69'),'value':_0x4a7b61[_0xff89('0x69')]||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61[_0xff89('0x63')][0x2]?_0x4a7b61['attrs'][0x2][_0xff89('0x64')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xff89('0x6d'),'value':_0x4a7b61['attrSerie1']||(_0x4a7b61['attrs']&&_0x4a7b61[_0xff89('0x63')][0x0]?_0x4a7b61['attrs'][0x0][_0xff89('0x64')]:undefined)||_0xff89('0x6b')},{'name':_0xff89('0x6e'),'value':_0x4a7b61[_0xff89('0x6e')]||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61[_0xff89('0x63')][0x1]?_0x4a7b61[_0xff89('0x63')][0x1][_0xff89('0x64')]:undefined)||null},{'name':'attrSerie3','value':_0x4a7b61[_0xff89('0x6f')]||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61[_0xff89('0x63')][0x2]?_0x4a7b61['attrs'][0x2][_0xff89('0x64')]:undefined)||null},{'name':_0xff89('0x6c'),'value':_0x4a7b61[_0xff89('0x6c')]||(_0x4a7b61['attrs']&&_0x4a7b61[_0xff89('0x63')][0x3]?_0x4a7b61[_0xff89('0x63')][0x3][_0xff89('0x64')]:undefined)||[]}];case _0xff89('0x70'):return[{'name':_0xff89('0x71'),'type':_0x4a7b61[_0xff89('0x72')]||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61['attrs'][0x0]?_0x4a7b61[_0xff89('0x63')][0x0][_0xff89('0x37')]:undefined)||null,'value':_0x4a7b61[_0xff89('0x71')]||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61[_0xff89('0x63')][0x0]?_0x4a7b61[_0xff89('0x63')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4a7b61['attrRefresh']||(_0x4a7b61[_0xff89('0x63')]&&_0x4a7b61[_0xff89('0x63')][0x1]?_0x4a7b61[_0xff89('0x63')][0x1][_0xff89('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x49b1fc){logger[_0xff89('0x2f')]('widgetAttributes:\x20%s',JSON[_0xff89('0x73')](_0x49b1fc));return[];}}exports[_0xff89('0x74')]=function(_0x5e0fcb,_0x2d6e8b,_0x3af718){if(_0x5e0fcb[_0xff89('0x5d')]['id']){delete _0x5e0fcb[_0xff89('0x5d')]['id'];}return db[_0xff89('0x34')][_0xff89('0x54')]({'where':{'id':_0x5e0fcb[_0xff89('0x50')]['id']}})[_0xff89('0x2b')](handleEntityNotFound(_0x2d6e8b,null))[_0xff89('0x2b')](function(_0x1862b8){if(_0x1862b8){_0x5e0fcb[_0xff89('0x5d')][_0xff89('0x75')]=_0x1862b8['id'];_0x5e0fcb[_0xff89('0x5d')][_0xff89('0x63')]=widgetAttributes(_0x5e0fcb[_0xff89('0x5d')]);return db[_0xff89('0x76')]['create'](_0x5e0fcb[_0xff89('0x5d')]);}})[_0xff89('0x2b')](respondWithResult(_0x2d6e8b,null))[_0xff89('0x4e')](handleError(_0x2d6e8b,null));};exports[_0xff89('0x77')]=function(_0x3c7b23,_0x38f4ec,_0x14ff23){var _0x3c6f99={};var _0x2a6397={};var _0x46313c;var _0x3099bf;return db['Dashboard'][_0xff89('0x78')]({'where':{'id':_0x3c7b23[_0xff89('0x50')]['id']}})[_0xff89('0x2b')](handleEntityNotFound(_0x38f4ec,null))[_0xff89('0x2b')](function(_0x355bd5){if(_0x355bd5){_0x46313c=_0x355bd5;_0x2a6397['model']=_['keys'](db[_0xff89('0x76')][_0xff89('0x35')]);_0x2a6397['query']=_[_0xff89('0x3b')](_0x3c7b23[_0xff89('0x3a')]);_0x2a6397['filters']=_['intersection'](_0x2a6397['model'],_0x2a6397[_0xff89('0x3a')]);_0x3c6f99[_0xff89('0x3e')]=_[_0xff89('0x3d')](_0x2a6397[_0xff89('0x38')],qs[_0xff89('0x3f')](_0x3c7b23[_0xff89('0x3a')][_0xff89('0x3f')]));_0x3c6f99[_0xff89('0x3e')]=_0x3c6f99[_0xff89('0x3e')][_0xff89('0x40')]?_0x3c6f99[_0xff89('0x3e')]:_0x2a6397[_0xff89('0x38')];_0x3c6f99[_0xff89('0x43')]=qs[_0xff89('0x44')](_0x3c7b23['query'][_0xff89('0x44')]);_0x3c6f99[_0xff89('0x45')]=qs[_0xff89('0x3c')](_[_0xff89('0x46')](_0x3c7b23[_0xff89('0x3a')],_0x2a6397[_0xff89('0x3c')]));if(_0x3c7b23[_0xff89('0x3a')][_0xff89('0x47')]){_0x3c6f99[_0xff89('0x45')]=_['merge'](_0x3c6f99[_0xff89('0x45')],{'$or':_['map'](_0x3c6f99[_0xff89('0x3e')],function(_0x42b3bf){var _0x17ee38={};_0x17ee38[_0x42b3bf]={'$like':'%'+_0x3c7b23[_0xff89('0x3a')][_0xff89('0x47')]+'%'};return _0x17ee38;})});}_0x3c6f99=_[_0xff89('0x49')]({},_0x3c6f99,_0x3c7b23['options']);return _0x46313c[_0xff89('0x77')](_0x3c6f99);}})[_0xff89('0x2b')](function(_0x2152a7){if(_0x2152a7){_0x3099bf=_0x2152a7[_0xff89('0x40')];if(!_0x3c7b23[_0xff89('0x3a')][_0xff89('0x41')](_0xff89('0x42'))){_0x3c6f99[_0xff89('0x25')]=qs[_0xff89('0x25')](_0x3c7b23['query'][_0xff89('0x25')]);_0x3c6f99[_0xff89('0x24')]=qs['offset'](_0x3c7b23[_0xff89('0x3a')][_0xff89('0x24')]);}return _0x46313c['getItems'](_0x3c6f99);}})[_0xff89('0x2b')](function(_0x306a8c){if(_0x306a8c){return _0x306a8c?{'count':_0x3099bf,'rows':_0x306a8c}:null;}})[_0xff89('0x2b')](respondWithResult(_0x38f4ec,null))[_0xff89('0x4e')](handleError(_0x38f4ec,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 9313ab0..967bb2a 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 _0xf0f5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x3a2855,_0x3495e1){var _0x1fc9cc=function(_0x3265f3){while(--_0x3265f3){_0x3a2855['push'](_0x3a2855['shift']());}};_0x1fc9cc(++_0x3495e1);}(_0xf0f5,0x119));var _0x5f0f=function(_0x44e949,_0x2757ef){_0x44e949=_0x44e949-0x0;var _0x50c736=_0xf0f5[_0x44e949];return _0x50c736;};'use strict';var EventEmitter=require(_0x5f0f('0x0'));var Dashboard=require(_0x5f0f('0x1'))['db'][_0x5f0f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5f0f('0x3')](0x0);var events={'afterCreate':_0x5f0f('0x4'),'afterUpdate':_0x5f0f('0x5'),'afterDestroy':_0x5f0f('0x6')};function emitEvent(_0x5eb361){return function(_0x274af4,_0x73c46c,_0x1898f7){DashboardEvents[_0x5f0f('0x7')](_0x5eb361+':'+_0x274af4['id'],_0x274af4);DashboardEvents['emit'](_0x5eb361,_0x274af4);_0x1898f7(null);};}for(var e in events){if(events[_0x5f0f('0x8')](e)){var event=events[e];Dashboard[_0x5f0f('0x9')](e,emitEvent(event));}}module[_0x5f0f('0xa')]=DashboardEvents; \ No newline at end of file +var _0x97cd=['save','update','remove','emit','exports','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x41dde4,_0x3d4473){var _0x758f9b=function(_0x1fe8e2){while(--_0x1fe8e2){_0x41dde4['push'](_0x41dde4['shift']());}};_0x758f9b(++_0x3d4473);}(_0x97cd,0x68));var _0xd97c=function(_0x4c8815,_0xa6523c){_0x4c8815=_0x4c8815-0x0;var _0x4c9f93=_0x97cd[_0x4c8815];return _0x4c9f93;};'use strict';var EventEmitter=require(_0xd97c('0x0'));var Dashboard=require(_0xd97c('0x1'))['db'][_0xd97c('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd97c('0x3')](0x0);var events={'afterCreate':_0xd97c('0x4'),'afterUpdate':_0xd97c('0x5'),'afterDestroy':_0xd97c('0x6')};function emitEvent(_0x379381){return function(_0x187816,_0xae7710,_0x1be818){DashboardEvents[_0xd97c('0x7')](_0x379381+':'+_0x187816['id'],_0x187816);DashboardEvents['emit'](_0x379381,_0x187816);_0x1be818(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xd97c('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 9dd1792..a6c7f48 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 _0xb426=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x1a30c7,_0x5d5441){var _0x3be1e6=function(_0x3ee7e8){while(--_0x3ee7e8){_0x1a30c7['push'](_0x1a30c7['shift']());}};_0x3be1e6(++_0x5d5441);}(_0xb426,0x1d8));var _0x6b42=function(_0x22c75c,_0x3624dd){_0x22c75c=_0x22c75c-0x0;var _0x392878=_0xb426[_0x22c75c];return _0x392878;};'use strict';var _=require(_0x6b42('0x0'));var util=require(_0x6b42('0x1'));var logger=require(_0x6b42('0x2'))(_0x6b42('0x3'));var moment=require(_0x6b42('0x4'));var BPromise=require(_0x6b42('0x5'));var rp=require(_0x6b42('0x6'));var fs=require('fs');var path=require(_0x6b42('0x7'));var rimraf=require(_0x6b42('0x8'));var config=require(_0x6b42('0x9'));var attributes=require(_0x6b42('0xa'));module[_0x6b42('0xb')]=function(_0x8f4d5,_0x1c14eb){return _0x8f4d5['define'](_0x6b42('0xc'),attributes,{'tableName':_0x6b42('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb1=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','Dashboard','dashboards'];(function(_0x1d90c2,_0x18ccb6){var _0x552549=function(_0x2c7a35){while(--_0x2c7a35){_0x1d90c2['push'](_0x1d90c2['shift']());}};_0x552549(++_0x18ccb6);}(_0xdbb1,0xe7));var _0x1dbb=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xdbb1[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x1dbb('0x0'));var util=require(_0x1dbb('0x1'));var logger=require(_0x1dbb('0x2'))('api');var moment=require(_0x1dbb('0x3'));var BPromise=require('bluebird');var rp=require(_0x1dbb('0x4'));var fs=require('fs');var path=require(_0x1dbb('0x5'));var rimraf=require('rimraf');var config=require(_0x1dbb('0x6'));var attributes=require('./dashboard.attributes');module[_0x1dbb('0x7')]=function(_0x12976d,_0x49beeb){return _0x12976d[_0x1dbb('0x8')](_0x1dbb('0x9'),attributes,{'tableName':_0x1dbb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8a923bb..708e451 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 _0x521f=['request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s'];(function(_0x409237,_0xe36701){var _0x2b3e72=function(_0x9c719f){while(--_0x9c719f){_0x409237['push'](_0x409237['shift']());}};_0x2b3e72(++_0xe36701);}(_0x521f,0xe8));var _0xf521=function(_0x45a6f3,_0x5047e9){_0x45a6f3=_0x45a6f3-0x0;var _0x48df23=_0x521f[_0x45a6f3];return _0x48df23;};'use strict';var _=require(_0xf521('0x0'));var util=require(_0xf521('0x1'));var moment=require('moment');var BPromise=require(_0xf521('0x2'));var rs=require(_0xf521('0x3'));var fs=require('fs');var Redis=require(_0xf521('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf521('0x5'));var logger=require(_0xf521('0x6'))(_0xf521('0x7'));var config=require(_0xf521('0x8'));var jayson=require(_0xf521('0x9'));var client=jayson[_0xf521('0xa')][_0xf521('0xb')]({'port':0x232a});config[_0xf521('0xc')]=_['defaults'](config[_0xf521('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf521('0xd'))(new Redis(config[_0xf521('0xc')]));require('./dashboard.socket')[_0xf521('0xe')](socket);function respondWithRpcPromise(_0x225421,_0x35c6d6,_0x359c29){return new BPromise(function(_0x515fd1,_0x462c8d){return client[_0xf521('0xf')](_0x225421,_0x359c29)[_0xf521('0x10')](function(_0x3f8e49){logger['info'](_0xf521('0x11'),_0x35c6d6,_0xf521('0x12'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x35c6d6,_0xf521('0x12'),JSON['stringify'](_0x3f8e49));if(_0x3f8e49[_0xf521('0x13')]){if(_0x3f8e49[_0xf521('0x13')][_0xf521('0x14')]===0x1f4){logger[_0xf521('0x13')](_0xf521('0x11'),_0x35c6d6,_0x3f8e49[_0xf521('0x13')][_0xf521('0x15')]);return _0x462c8d(_0x3f8e49[_0xf521('0x13')][_0xf521('0x15')]);}logger[_0xf521('0x13')](_0xf521('0x11'),_0x35c6d6,_0x3f8e49['error'][_0xf521('0x15')]);return _0x515fd1(_0x3f8e49[_0xf521('0x13')][_0xf521('0x15')]);}else{logger[_0xf521('0x16')]('Dashboard,\x20%s,\x20%s',_0x35c6d6,'request\x20sent');_0x515fd1(_0x3f8e49[_0xf521('0x17')]['message']);}})[_0xf521('0x18')](function(_0x426d7f){logger[_0xf521('0x13')](_0xf521('0x11'),_0x35c6d6,_0x426d7f);_0x462c8d(_0x426d7f);});});} \ No newline at end of file +var _0xc3e0=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x2f3471,_0x4041be){var _0x1afe02=function(_0x108e47){while(--_0x108e47){_0x2f3471['push'](_0x2f3471['shift']());}};_0x1afe02(++_0x4041be);}(_0xc3e0,0x103));var _0x0c3e=function(_0x499d16,_0x2d6547){_0x499d16=_0x499d16-0x0;var _0x2ab38a=_0xc3e0[_0x499d16];return _0x2ab38a;};'use strict';var _=require(_0x0c3e('0x0'));var util=require(_0x0c3e('0x1'));var moment=require('moment');var BPromise=require(_0x0c3e('0x2'));var rs=require(_0x0c3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c3e('0x4'))['db'];var utils=require(_0x0c3e('0x5'));var logger=require(_0x0c3e('0x6'))(_0x0c3e('0x7'));var config=require(_0x0c3e('0x8'));var jayson=require(_0x0c3e('0x9'));var client=jayson[_0x0c3e('0xa')][_0x0c3e('0xb')]({'port':0x232a});config[_0x0c3e('0xc')]=_[_0x0c3e('0xd')](config[_0x0c3e('0xc')],{'host':_0x0c3e('0xe'),'port':0x18eb});var socket=require(_0x0c3e('0xf'))(new Redis(config[_0x0c3e('0xc')]));require(_0x0c3e('0x10'))[_0x0c3e('0x11')](socket);function respondWithRpcPromise(_0x8e0014,_0x1c9d0b,_0x36ed38){return new BPromise(function(_0x352e55,_0x111930){return client[_0x0c3e('0x12')](_0x8e0014,_0x36ed38)[_0x0c3e('0x13')](function(_0x42b6b4){logger[_0x0c3e('0x14')]('Dashboard,\x20%s,\x20%s',_0x1c9d0b,_0x0c3e('0x15'));logger[_0x0c3e('0x16')](_0x0c3e('0x17'),_0x1c9d0b,_0x0c3e('0x15'),JSON['stringify'](_0x42b6b4));if(_0x42b6b4[_0x0c3e('0x18')]){if(_0x42b6b4[_0x0c3e('0x18')][_0x0c3e('0x19')]===0x1f4){logger[_0x0c3e('0x18')](_0x0c3e('0x1a'),_0x1c9d0b,_0x42b6b4[_0x0c3e('0x18')][_0x0c3e('0x1b')]);return _0x111930(_0x42b6b4['error'][_0x0c3e('0x1b')]);}logger[_0x0c3e('0x18')](_0x0c3e('0x1a'),_0x1c9d0b,_0x42b6b4['error'][_0x0c3e('0x1b')]);return _0x352e55(_0x42b6b4[_0x0c3e('0x18')]['message']);}else{logger[_0x0c3e('0x14')](_0x0c3e('0x1a'),_0x1c9d0b,_0x0c3e('0x15'));_0x352e55(_0x42b6b4[_0x0c3e('0x1c')][_0x0c3e('0x1b')]);}})['catch'](function(_0x48ef93){logger[_0x0c3e('0x18')](_0x0c3e('0x1a'),_0x1c9d0b,_0x48ef93);_0x111930(_0x48ef93);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0d1f328..fa69836 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 _0x2c74=['./dashboard.events','save','remove','update','emit','removeListener','length','dashboard:'];(function(_0x1cf5c8,_0xe8e966){var _0x26898d=function(_0x52da74){while(--_0x52da74){_0x1cf5c8['push'](_0x1cf5c8['shift']());}};_0x26898d(++_0xe8e966);}(_0x2c74,0x150));var _0x42c7=function(_0x4b9023,_0x4592cc){_0x4b9023=_0x4b9023-0x0;var _0x502620=_0x2c74[_0x4b9023];return _0x502620;};'use strict';var DashboardEvents=require(_0x42c7('0x0'));var events=[_0x42c7('0x1'),_0x42c7('0x2'),_0x42c7('0x3')];function createListener(_0x11c10d,_0x3ac10c){return function(_0x3e5fde){_0x3ac10c[_0x42c7('0x4')](_0x11c10d,_0x3e5fde);};}function removeListener(_0x2c946a,_0x6dc1ad){return function(){DashboardEvents[_0x42c7('0x5')](_0x2c946a,_0x6dc1ad);};}exports['register']=function(_0x1baac7){for(var _0x253399=0x0,_0x57682c=events[_0x42c7('0x6')];_0x253399<_0x57682c;_0x253399++){var _0x1b05d5=events[_0x253399];var _0x3bd6df=createListener(_0x42c7('0x7')+_0x1b05d5,_0x1baac7);DashboardEvents['on'](_0x1b05d5,_0x3bd6df);}}; \ No newline at end of file +var _0xce13=['remove','emit','removeListener','register','length','./dashboard.events','save'];(function(_0x2f98f3,_0x59655d){var _0x3e24fd=function(_0x5251ae){while(--_0x5251ae){_0x2f98f3['push'](_0x2f98f3['shift']());}};_0x3e24fd(++_0x59655d);}(_0xce13,0x147));var _0x3ce1=function(_0x3da81c,_0x51f8ae){_0x3da81c=_0x3da81c-0x0;var _0x3d2a8d=_0xce13[_0x3da81c];return _0x3d2a8d;};'use strict';var DashboardEvents=require(_0x3ce1('0x0'));var events=[_0x3ce1('0x1'),_0x3ce1('0x2'),'update'];function createListener(_0x30c1f7,_0x43d2f3){return function(_0x1e1f8b){_0x43d2f3[_0x3ce1('0x3')](_0x30c1f7,_0x1e1f8b);};}function removeListener(_0x3b02c6,_0x5de7c9){return function(){DashboardEvents[_0x3ce1('0x4')](_0x3b02c6,_0x5de7c9);};}exports[_0x3ce1('0x5')]=function(_0x1d47d3){for(var _0x45b8b8=0x0,_0x17879e=events[_0x3ce1('0x6')];_0x45b8b8<_0x17879e;_0x45b8b8++){var _0x3f25cb=events[_0x45b8b8];var _0x4746a8=createListener('dashboard:'+_0x3f25cb,_0x1d47d3);DashboardEvents['on'](_0x3f25cb,_0x4746a8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e9535fd..51db177 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x375c92,_0x2774be){var _0x49f14a=function(_0x2c4b47){while(--_0x2c4b47){_0x375c92['push'](_0x375c92['shift']());}};_0x49f14a(++_0x2774be);}(_0x70e0,0x17b));var _0x070e=function(_0x47984f,_0x425e71){_0x47984f=_0x47984f-0x0;var _0x569b22=_0x70e0[_0x47984f];return _0x569b22;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0xcb91[_0x49cb71];return _0x3a50fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fc47f59..b58cfa0 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 _0xf01b=['INTEGER','STRING','#2196f3','sequelize','squel','lodash','exports','TEXT','long','parse','attrs','stringify','setDataValue'];(function(_0xd58277,_0x4a39f7){var _0x522e3d=function(_0x1570ee){while(--_0x1570ee){_0xd58277['push'](_0xd58277['shift']());}};_0x522e3d(++_0x4a39f7);}(_0xf01b,0x9f));var _0xbf01=function(_0x3b4af0,_0x2df7c2){_0x3b4af0=_0x3b4af0-0x0;var _0x3efe6f=_0xf01b[_0x3b4af0];return _0x3efe6f;};'use strict';var Sequelize=require(_0xbf01('0x0'));var squel=require(_0xbf01('0x1'));var _=require(_0xbf01('0x2'));module[_0xbf01('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xbf01('0x4')](_0xbf01('0x5')),'get':function(){try{return JSON[_0xbf01('0x6')](this['getDataValue'](_0xbf01('0x7')));}catch(_0x566c86){return[];}},'set':function(_0xc9892c){try{this['setDataValue'](_0xbf01('0x7'),JSON[_0xbf01('0x8')](_0xc9892c));}catch(_0x4aaf8d){this[_0xbf01('0x9')]('attrs',JSON[_0xbf01('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbf01('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbf01('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xbf01('0xb')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbf01('0xb')],'allowNull':![],'defaultValue':_0xbf01('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xbf01('0xb')]}}; \ No newline at end of file +var _0x02fe=['squel','lodash','exports','STRING','TEXT','parse','getDataValue','setDataValue','stringify','INTEGER','#2196f3','sequelize'];(function(_0x2efa96,_0x4e2825){var _0x37160d=function(_0x531eb5){while(--_0x531eb5){_0x2efa96['push'](_0x2efa96['shift']());}};_0x37160d(++_0x4e2825);}(_0x02fe,0x143));var _0xe02f=function(_0x48e7e5,_0x1d7c7f){_0x48e7e5=_0x48e7e5-0x0;var _0x50a962=_0x02fe[_0x48e7e5];return _0x50a962;};'use strict';var Sequelize=require(_0xe02f('0x0'));var squel=require(_0xe02f('0x1'));var _=require(_0xe02f('0x2'));module[_0xe02f('0x3')]={'title':{'type':Sequelize[_0xe02f('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe02f('0x5')]('long'),'get':function(){try{return JSON[_0xe02f('0x6')](this[_0xe02f('0x7')]('attrs'));}catch(_0x231bd1){return[];}},'set':function(_0x206588){try{this[_0xe02f('0x8')]('attrs',JSON[_0xe02f('0x9')](_0x206588));}catch(_0x256fe6){this[_0xe02f('0x8')]('attrs',JSON[_0xe02f('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe02f('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xe02f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe02f('0x4')],'allowNull':![],'defaultValue':_0xe02f('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe02f('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 86c9266..6e18711 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 _0xc90b=['attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','DashboardItem','keys','query','filters','attributes','intersection','model','fields','length','includeAll','options','find','catch','type','iframe','attrUrl','attrs','value','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric'];(function(_0x53e12f,_0x136e5a){var _0x3bef4c=function(_0x5ed4f5){while(--_0x5ed4f5){_0x53e12f['push'](_0x53e12f['shift']());}};_0x3bef4c(++_0x136e5a);}(_0xc90b,0x165));var _0xbc90=function(_0x5299a9,_0x52b834){_0x5299a9=_0x5299a9-0x0;var _0x4b138d=_0xc90b[_0x5299a9];return _0x4b138d;};'use strict';var pdf=require(_0xbc90('0x0'));var emlformat=require(_0xbc90('0x1'));var rimraf=require(_0xbc90('0x2'));var zipdir=require(_0xbc90('0x3'));var jsonpatch=require(_0xbc90('0x4'));var rp=require(_0xbc90('0x5'));var moment=require(_0xbc90('0x6'));var BPromise=require(_0xbc90('0x7'));var Mustache=require(_0xbc90('0x8'));var util=require(_0xbc90('0x9'));var path=require(_0xbc90('0xa'));var sox=require(_0xbc90('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbc90('0xc'));var squel=require(_0xbc90('0xd'));var crypto=require('crypto');var jsforce=require(_0xbc90('0xe'));var deskjs=require(_0xbc90('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbc90('0x10'));var Redis=require('ioredis');var authService=require(_0xbc90('0x11'));var qs=require(_0xbc90('0x12'));var as=require(_0xbc90('0x13'));var hardwareService=require(_0xbc90('0x14'));var logger=require(_0xbc90('0x15'))(_0xbc90('0x16'));var utils=require(_0xbc90('0x17'));var config=require(_0xbc90('0x18'));var db=require('../../mysqldb')['db'];config[_0xbc90('0x19')]=_['defaults'](config[_0xbc90('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc90('0x1a'))(new Redis(config[_0xbc90('0x19')]));require('./dashboardItem.socket')[_0xbc90('0x1b')](socket);function respondWithStatusCode(_0x1e977b,_0xb5c9b2){_0xb5c9b2=_0xb5c9b2||0xcc;return function(_0x548505){if(_0x548505){return _0x1e977b[_0xbc90('0x1c')](_0xb5c9b2);}return _0x1e977b['status'](_0xb5c9b2)[_0xbc90('0x1d')]();};}function respondWithResult(_0x25f62d,_0x31bf07){_0x31bf07=_0x31bf07||0xc8;return function(_0x267baa){if(_0x267baa){return _0x25f62d[_0xbc90('0x1e')](_0x31bf07)[_0xbc90('0x1f')](_0x267baa);}};}function respondWithFilteredResult(_0x9c196a,_0x5c0025){return function(_0x5ec56e){if(_0x5ec56e){var _0x3b30a0=_0x5ec56e['count'],_0x172a98=_0x5c0025[_0xbc90('0x20')],_0x1f9ff6=_0x5c0025[_0xbc90('0x20')]+_0x5c0025[_0xbc90('0x21')],_0x5839b4;if(_0x1f9ff6>=_0x3b30a0){_0x1f9ff6=_0x3b30a0;_0x5839b4=0xc8;}else{_0x5839b4=0xce;}_0x9c196a[_0xbc90('0x1e')](_0x5839b4);return _0x9c196a[_0xbc90('0x22')](_0xbc90('0x23'),_0x172a98+'-'+_0x1f9ff6+'/'+_0x3b30a0)[_0xbc90('0x1f')](_0x5ec56e);}return null;};}function patchUpdates(_0x3b63e0){return function(_0x5e2587){try{jsonpatch[_0xbc90('0x24')](_0x5e2587,_0x3b63e0,!![]);}catch(_0x525a30){return BPromise[_0xbc90('0x25')](_0x525a30);}return _0x5e2587[_0xbc90('0x26')]();};}function saveUpdates(_0x5e63d3,_0x8ad1e0){return function(_0x2512d7){if(_0x2512d7){return _0x2512d7[_0xbc90('0x27')](_0x5e63d3)[_0xbc90('0x28')](function(_0x7b024){return _0x7b024;});}return null;};}function removeEntity(_0x449274,_0xc23df6){return function(_0x21d1a0){if(_0x21d1a0){return _0x21d1a0['destroy']()[_0xbc90('0x28')](function(){_0x449274['status'](0xcc)[_0xbc90('0x1d')]();});}};}function handleEntityNotFound(_0xcf1cc2,_0x441766){return function(_0x192ca0){if(!_0x192ca0){_0xcf1cc2[_0xbc90('0x1c')](0x194);}return _0x192ca0;};}function handleError(_0x229438,_0x4dd3e6){_0x4dd3e6=_0x4dd3e6||0x1f4;return function(_0x1f343b){logger[_0xbc90('0x29')](_0x1f343b[_0xbc90('0x2a')]);if(_0x1f343b[_0xbc90('0x2b')]){delete _0x1f343b[_0xbc90('0x2b')];}_0x229438[_0xbc90('0x1e')](_0x4dd3e6)[_0xbc90('0x2c')](_0x1f343b);};}exports[_0xbc90('0x2d')]=function(_0x4c1c6a,_0x2b3e8b){var _0x49c00f={'raw':![],'where':{'id':_0x4c1c6a[_0xbc90('0x2e')]['id']}},_0x1cdd7b={};_0x1cdd7b['model']=_['keys'](db[_0xbc90('0x2f')]['rawAttributes']);_0x1cdd7b['query']=_[_0xbc90('0x30')](_0x4c1c6a[_0xbc90('0x31')]);_0x1cdd7b[_0xbc90('0x32')]=_['intersection'](_0x1cdd7b['model'],_0x1cdd7b[_0xbc90('0x31')]);_0x49c00f[_0xbc90('0x33')]=_[_0xbc90('0x34')](_0x1cdd7b[_0xbc90('0x35')],qs[_0xbc90('0x36')](_0x4c1c6a[_0xbc90('0x31')][_0xbc90('0x36')]));_0x49c00f['attributes']=_0x49c00f[_0xbc90('0x33')][_0xbc90('0x37')]?_0x49c00f[_0xbc90('0x33')]:_0x1cdd7b[_0xbc90('0x35')];if(_0x4c1c6a[_0xbc90('0x31')][_0xbc90('0x38')]){_0x49c00f['include']=[{'all':!![]}];}_0x49c00f=_['merge']({},_0x49c00f,_0x4c1c6a[_0xbc90('0x39')]);return db['DashboardItem'][_0xbc90('0x3a')](_0x49c00f)[_0xbc90('0x28')](handleEntityNotFound(_0x2b3e8b,null))[_0xbc90('0x28')](respondWithResult(_0x2b3e8b,null))[_0xbc90('0x3b')](handleError(_0x2b3e8b,null));};exports['destroy']=function(_0x4a2369,_0x2756a7){return db[_0xbc90('0x2f')][_0xbc90('0x3a')]({'where':{'id':_0x4a2369[_0xbc90('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2756a7,null))[_0xbc90('0x28')](removeEntity(_0x2756a7,null))[_0xbc90('0x3b')](handleError(_0x2756a7,null));};function widgetAttributes(_0x459067){try{switch(_0x459067[_0xbc90('0x3c')]){case _0xbc90('0x3d'):return[{'name':_0xbc90('0x3e'),'value':_0x459067[_0xbc90('0x3e')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x40')]:undefined)||'https://'}];case'custom':return[{'name':_0xbc90('0x41'),'value':_0x459067[_0xbc90('0x41')]||(_0x459067['attrs']&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067['attrs'][0x0][_0xbc90('0x40')]:undefined)||''}];case _0xbc90('0x42'):return[{'name':'attrHourFormat','value':_0x459067['attrHourFormat']||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x40')]:undefined)||_0xbc90('0x43')},{'name':_0xbc90('0x44'),'value':_0x459067[_0xbc90('0x44')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x1]?_0x459067[_0xbc90('0x3f')][0x1]['value']:undefined)||_0xbc90('0x45')},{'name':_0xbc90('0x46'),'value':_0x459067[_0xbc90('0x46')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x2]?_0x459067[_0xbc90('0x3f')][0x2][_0xbc90('0x40')]:undefined)||0xc}];case _0xbc90('0x47'):return[{'name':_0xbc90('0x48'),'value':_0x459067[_0xbc90('0x48')]||(_0x459067['attrs']&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x40')]:undefined)||'total'},{'name':_0xbc90('0x49'),'value':_0x459067[_0xbc90('0x49')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x1]?_0x459067[_0xbc90('0x3f')][0x1][_0xbc90('0x40')]:undefined)||[]},{'name':'attrFontSize','value':_0x459067[_0xbc90('0x46')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x2]?_0x459067[_0xbc90('0x3f')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xbc90('0x4a'):return[{'name':_0xbc90('0x4b'),'value':_0x459067['attrSerie1']||(_0x459067[_0xbc90('0x3f')]&&_0x459067['attrs'][0x0]?_0x459067[_0xbc90('0x3f')][0x0]['value']:undefined)||_0xbc90('0x4c')},{'name':_0xbc90('0x4d'),'value':_0x459067[_0xbc90('0x4d')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x1]?_0x459067[_0xbc90('0x3f')][0x1][_0xbc90('0x40')]:undefined)||null},{'name':_0xbc90('0x4e'),'value':_0x459067['attrSerie3']||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x2]?_0x459067[_0xbc90('0x3f')][0x2]['value']:undefined)||null},{'name':_0xbc90('0x49'),'value':_0x459067[_0xbc90('0x49')]||(_0x459067['attrs']&&_0x459067[_0xbc90('0x3f')][0x3]?_0x459067[_0xbc90('0x3f')][0x3][_0xbc90('0x40')]:undefined)||[]}];case _0xbc90('0x4f'):return[{'name':_0xbc90('0x50'),'type':_0x459067['reportType']||(_0x459067[_0xbc90('0x3f')]&&_0x459067['attrs'][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x3c')]:undefined)||null,'value':_0x459067[_0xbc90('0x50')]||(_0x459067[_0xbc90('0x3f')]&&_0x459067[_0xbc90('0x3f')][0x0]?_0x459067[_0xbc90('0x3f')][0x0][_0xbc90('0x40')]:undefined)||null},{'name':_0xbc90('0x51'),'value':_0x459067[_0xbc90('0x51')]||(_0x459067['attrs']&&_0x459067[_0xbc90('0x3f')][0x1]?_0x459067[_0xbc90('0x3f')][0x1][_0xbc90('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x10dec4){logger[_0xbc90('0x29')](_0xbc90('0x52'),JSON[_0xbc90('0x53')](_0x10dec4));return[];}}exports[_0xbc90('0x54')]=function(_0x503963,_0x561a41){if(_0x503963['body']){_0x503963[_0xbc90('0x55')][_0xbc90('0x3f')]=widgetAttributes(_0x503963['body']);}return db[_0xbc90('0x2f')]['create'](_0x503963[_0xbc90('0x55')],{})[_0xbc90('0x28')](respondWithResult(_0x561a41,0xc9))[_0xbc90('0x3b')](handleError(_0x561a41,null));};exports[_0xbc90('0x27')]=function(_0x366c13,_0x241f0f){if(_0x366c13[_0xbc90('0x55')]['id']){delete _0x366c13[_0xbc90('0x55')]['id'];}_0x366c13[_0xbc90('0x55')][_0xbc90('0x3f')]=widgetAttributes(_0x366c13[_0xbc90('0x55')]);return db[_0xbc90('0x2f')][_0xbc90('0x3a')]({'where':{'id':_0x366c13[_0xbc90('0x2e')]['id']}})[_0xbc90('0x28')](handleEntityNotFound(_0x241f0f,null))[_0xbc90('0x28')](saveUpdates(_0x366c13[_0xbc90('0x55')],null))[_0xbc90('0x28')](respondWithResult(_0x241f0f,null))[_0xbc90('0x3b')](handleError(_0x241f0f,null));}; \ No newline at end of file +var _0x9007=['attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','end','stack','name','send','show','params','model','DashboardItem','rawAttributes','keys','query','intersection','attributes','fields','length','include','merge','find','catch','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat'];(function(_0x3bd2c2,_0x53b6e0){var _0x14dae5=function(_0x3b4122){while(--_0x3b4122){_0x3bd2c2['push'](_0x3bd2c2['shift']());}};_0x14dae5(++_0x53b6e0);}(_0x9007,0x1b8));var _0x7900=function(_0x1308ec,_0x32c99e){_0x1308ec=_0x1308ec-0x0;var _0x1a43c8=_0x9007[_0x1308ec];return _0x1a43c8;};'use strict';var pdf=require(_0x7900('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7900('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7900('0x2'));var rp=require('request-promise');var moment=require(_0x7900('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7900('0x4'));var util=require('util');var path=require(_0x7900('0x5'));var sox=require('sox');var csv=require(_0x7900('0x6'));var ejs=require(_0x7900('0x7'));var fs=require('fs');var _=require(_0x7900('0x8'));var squel=require('squel');var crypto=require(_0x7900('0x9'));var jsforce=require(_0x7900('0xa'));var deskjs=require(_0x7900('0xb'));var toCsv=require(_0x7900('0x6'));var querystring=require(_0x7900('0xc'));var Papa=require(_0x7900('0xd'));var Redis=require('ioredis');var authService=require(_0x7900('0xe'));var qs=require(_0x7900('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7900('0x10'));var utils=require('../../config/utils');var config=require(_0x7900('0x11'));var db=require(_0x7900('0x12'))['db'];config[_0x7900('0x13')]=_[_0x7900('0x14')](config[_0x7900('0x13')],{'host':_0x7900('0x15'),'port':0x18eb});var socket=require(_0x7900('0x16'))(new Redis(config[_0x7900('0x13')]));require(_0x7900('0x17'))[_0x7900('0x18')](socket);function respondWithStatusCode(_0x42f55d,_0x5a9673){_0x5a9673=_0x5a9673||0xcc;return function(_0x15a0c6){if(_0x15a0c6){return _0x42f55d[_0x7900('0x19')](_0x5a9673);}return _0x42f55d[_0x7900('0x1a')](_0x5a9673)['end']();};}function respondWithResult(_0x16d104,_0x244c74){_0x244c74=_0x244c74||0xc8;return function(_0x433670){if(_0x433670){return _0x16d104[_0x7900('0x1a')](_0x244c74)[_0x7900('0x1b')](_0x433670);}};}function respondWithFilteredResult(_0x1084db,_0xfabe6c){return function(_0x12d8d9){if(_0x12d8d9){var _0xf2b963=_0x12d8d9[_0x7900('0x1c')],_0x1da92b=_0xfabe6c[_0x7900('0x1d')],_0x582d8a=_0xfabe6c[_0x7900('0x1d')]+_0xfabe6c[_0x7900('0x1e')],_0x4cd2cc;if(_0x582d8a>=_0xf2b963){_0x582d8a=_0xf2b963;_0x4cd2cc=0xc8;}else{_0x4cd2cc=0xce;}_0x1084db[_0x7900('0x1a')](_0x4cd2cc);return _0x1084db[_0x7900('0x1f')]('Content-Range',_0x1da92b+'-'+_0x582d8a+'/'+_0xf2b963)[_0x7900('0x1b')](_0x12d8d9);}return null;};}function patchUpdates(_0x4d75c0){return function(_0x20793c){try{jsonpatch[_0x7900('0x20')](_0x20793c,_0x4d75c0,!![]);}catch(_0xb3a57b){return BPromise['reject'](_0xb3a57b);}return _0x20793c[_0x7900('0x21')]();};}function saveUpdates(_0x15cb1e,_0x12b766){return function(_0x552708){if(_0x552708){return _0x552708[_0x7900('0x22')](_0x15cb1e)[_0x7900('0x23')](function(_0x1d85a5){return _0x1d85a5;});}return null;};}function removeEntity(_0x4bff9c,_0x5eeecc){return function(_0x1824ee){if(_0x1824ee){return _0x1824ee[_0x7900('0x24')]()[_0x7900('0x23')](function(){_0x4bff9c['status'](0xcc)[_0x7900('0x25')]();});}};}function handleEntityNotFound(_0x4f4113,_0x186c84){return function(_0x4ea5a2){if(!_0x4ea5a2){_0x4f4113[_0x7900('0x19')](0x194);}return _0x4ea5a2;};}function handleError(_0x277d08,_0x47fc5c){_0x47fc5c=_0x47fc5c||0x1f4;return function(_0x590321){logger['error'](_0x590321[_0x7900('0x26')]);if(_0x590321[_0x7900('0x27')]){delete _0x590321[_0x7900('0x27')];}_0x277d08[_0x7900('0x1a')](_0x47fc5c)[_0x7900('0x28')](_0x590321);};}exports[_0x7900('0x29')]=function(_0x832e88,_0x3d584f){var _0x5a9b99={'raw':![],'where':{'id':_0x832e88[_0x7900('0x2a')]['id']}},_0x4a8a77={};_0x4a8a77[_0x7900('0x2b')]=_['keys'](db[_0x7900('0x2c')][_0x7900('0x2d')]);_0x4a8a77['query']=_[_0x7900('0x2e')](_0x832e88[_0x7900('0x2f')]);_0x4a8a77['filters']=_[_0x7900('0x30')](_0x4a8a77[_0x7900('0x2b')],_0x4a8a77['query']);_0x5a9b99[_0x7900('0x31')]=_[_0x7900('0x30')](_0x4a8a77[_0x7900('0x2b')],qs['fields'](_0x832e88[_0x7900('0x2f')][_0x7900('0x32')]));_0x5a9b99['attributes']=_0x5a9b99[_0x7900('0x31')][_0x7900('0x33')]?_0x5a9b99[_0x7900('0x31')]:_0x4a8a77['model'];if(_0x832e88[_0x7900('0x2f')]['includeAll']){_0x5a9b99[_0x7900('0x34')]=[{'all':!![]}];}_0x5a9b99=_[_0x7900('0x35')]({},_0x5a9b99,_0x832e88['options']);return db[_0x7900('0x2c')][_0x7900('0x36')](_0x5a9b99)['then'](handleEntityNotFound(_0x3d584f,null))[_0x7900('0x23')](respondWithResult(_0x3d584f,null))[_0x7900('0x37')](handleError(_0x3d584f,null));};exports[_0x7900('0x24')]=function(_0x1fe436,_0x1d484e){return db['DashboardItem'][_0x7900('0x36')]({'where':{'id':_0x1fe436[_0x7900('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1d484e,null))[_0x7900('0x23')](removeEntity(_0x1d484e,null))[_0x7900('0x37')](handleError(_0x1d484e,null));};function widgetAttributes(_0x7e3076){try{switch(_0x7e3076['type']){case'iframe':return[{'name':_0x7900('0x38'),'value':_0x7e3076[_0x7900('0x38')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076[_0x7900('0x39')][0x0]?_0x7e3076[_0x7900('0x39')][0x0][_0x7900('0x3a')]:undefined)||_0x7900('0x3b')}];case _0x7900('0x3c'):return[{'name':_0x7900('0x3d'),'value':_0x7e3076[_0x7900('0x3d')]||(_0x7e3076['attrs']&&_0x7e3076[_0x7900('0x39')][0x0]?_0x7e3076['attrs'][0x0][_0x7900('0x3a')]:undefined)||''}];case _0x7900('0x3e'):return[{'name':_0x7900('0x3f'),'value':_0x7e3076[_0x7900('0x3f')]||(_0x7e3076['attrs']&&_0x7e3076['attrs'][0x0]?_0x7e3076[_0x7900('0x39')][0x0][_0x7900('0x3a')]:undefined)||'HH:mm:ss'},{'name':_0x7900('0x40'),'value':_0x7e3076[_0x7900('0x40')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076[_0x7900('0x39')][0x1]?_0x7e3076[_0x7900('0x39')][0x1][_0x7900('0x3a')]:undefined)||_0x7900('0x41')},{'name':'attrFontSize','value':_0x7e3076[_0x7900('0x42')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076['attrs'][0x2]?_0x7e3076['attrs'][0x2][_0x7900('0x3a')]:undefined)||0xc}];case _0x7900('0x43'):return[{'name':'attrMetric','value':_0x7e3076[_0x7900('0x44')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076[_0x7900('0x39')][0x0]?_0x7e3076[_0x7900('0x39')][0x0]['value']:undefined)||_0x7900('0x45')},{'name':_0x7900('0x46'),'value':_0x7e3076[_0x7900('0x46')]||(_0x7e3076['attrs']&&_0x7e3076['attrs'][0x1]?_0x7e3076['attrs'][0x1][_0x7900('0x3a')]:undefined)||[]},{'name':_0x7900('0x42'),'value':_0x7e3076[_0x7900('0x42')]||(_0x7e3076['attrs']&&_0x7e3076[_0x7900('0x39')][0x2]?_0x7e3076[_0x7900('0x39')][0x2][_0x7900('0x3a')]:undefined)||0x14}];case _0x7900('0x47'):case _0x7900('0x48'):return[{'name':'attrSerie1','value':_0x7e3076[_0x7900('0x49')]||(_0x7e3076['attrs']&&_0x7e3076[_0x7900('0x39')][0x0]?_0x7e3076[_0x7900('0x39')][0x0][_0x7900('0x3a')]:undefined)||_0x7900('0x45')},{'name':'attrSerie2','value':_0x7e3076[_0x7900('0x4a')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076[_0x7900('0x39')][0x1]?_0x7e3076[_0x7900('0x39')][0x1][_0x7900('0x3a')]:undefined)||null},{'name':_0x7900('0x4b'),'value':_0x7e3076[_0x7900('0x4b')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076['attrs'][0x2]?_0x7e3076[_0x7900('0x39')][0x2][_0x7900('0x3a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x7e3076[_0x7900('0x46')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076[_0x7900('0x39')][0x3]?_0x7e3076[_0x7900('0x39')][0x3]['value']:undefined)||[]}];case _0x7900('0x4c'):return[{'name':_0x7900('0x4d'),'type':_0x7e3076[_0x7900('0x4e')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076[_0x7900('0x39')][0x0]?_0x7e3076[_0x7900('0x39')][0x0]['type']:undefined)||null,'value':_0x7e3076[_0x7900('0x4d')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076[_0x7900('0x39')][0x0]?_0x7e3076[_0x7900('0x39')][0x0][_0x7900('0x3a')]:undefined)||null},{'name':_0x7900('0x4f'),'value':_0x7e3076[_0x7900('0x4f')]||(_0x7e3076[_0x7900('0x39')]&&_0x7e3076['attrs'][0x1]?_0x7e3076['attrs'][0x1][_0x7900('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x46a899){logger['error'](_0x7900('0x50'),JSON[_0x7900('0x51')](_0x46a899));return[];}}exports[_0x7900('0x52')]=function(_0x3b6f52,_0x5d0832){if(_0x3b6f52['body']){_0x3b6f52[_0x7900('0x53')]['attrs']=widgetAttributes(_0x3b6f52['body']);}return db[_0x7900('0x2c')][_0x7900('0x52')](_0x3b6f52[_0x7900('0x53')],{})[_0x7900('0x23')](respondWithResult(_0x5d0832,0xc9))['catch'](handleError(_0x5d0832,null));};exports[_0x7900('0x22')]=function(_0x44c725,_0x540255){if(_0x44c725[_0x7900('0x53')]['id']){delete _0x44c725[_0x7900('0x53')]['id'];}_0x44c725[_0x7900('0x53')][_0x7900('0x39')]=widgetAttributes(_0x44c725['body']);return db[_0x7900('0x2c')][_0x7900('0x36')]({'where':{'id':_0x44c725[_0x7900('0x2a')]['id']}})[_0x7900('0x23')](handleEntityNotFound(_0x540255,null))[_0x7900('0x23')](saveUpdates(_0x44c725[_0x7900('0x53')],null))[_0x7900('0x23')](respondWithResult(_0x540255,null))[_0x7900('0x37')](handleError(_0x540255,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index b3442ff..c006e7a 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 _0x5d66=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove'];(function(_0x3feddf,_0x54a0be){var _0x409181=function(_0x2668c4){while(--_0x2668c4){_0x3feddf['push'](_0x3feddf['shift']());}};_0x409181(++_0x54a0be);}(_0x5d66,0x130));var _0x65d6=function(_0x294ca7,_0x189f84){_0x294ca7=_0x294ca7-0x0;var _0x491a18=_0x5d66[_0x294ca7];return _0x491a18;};'use strict';var EventEmitter=require(_0x65d6('0x0'));var DashboardItem=require(_0x65d6('0x1'))['db'][_0x65d6('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x65d6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x65d6('0x4'),'afterDestroy':_0x65d6('0x5')};function emitEvent(_0x4aff50){return function(_0x5c339b,_0xd94f91,_0x366957){DashboardItemEvents[_0x65d6('0x6')](_0x4aff50+':'+_0x5c339b['id'],_0x5c339b);DashboardItemEvents[_0x65d6('0x6')](_0x4aff50,_0x5c339b);_0x366957(null);};}for(var e in events){if(events[_0x65d6('0x7')](e)){var event=events[e];DashboardItem[_0x65d6('0x8')](e,emitEvent(event));}}module[_0x65d6('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x3b0d=['hasOwnProperty','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x370f67,_0x1495aa){var _0x4506af=function(_0x4c1b67){while(--_0x4c1b67){_0x370f67['push'](_0x370f67['shift']());}};_0x4506af(++_0x1495aa);}(_0x3b0d,0x1db));var _0xd3b0=function(_0x4c941f,_0x13e01d){_0x4c941f=_0x4c941f-0x0;var _0x59f360=_0x3b0d[_0x4c941f];return _0x59f360;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xd3b0('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd3b0('0x1')](0x0);var events={'afterCreate':_0xd3b0('0x2'),'afterUpdate':'update','afterDestroy':_0xd3b0('0x3')};function emitEvent(_0x4af7b8){return function(_0x6ca1da,_0x3d07ea,_0x2a78d4){DashboardItemEvents[_0xd3b0('0x4')](_0x4af7b8+':'+_0x6ca1da['id'],_0x6ca1da);DashboardItemEvents[_0xd3b0('0x4')](_0x4af7b8,_0x6ca1da);_0x2a78d4(null);};}for(var e in events){if(events[_0xd3b0('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b866241..e22ceb3 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 _0xe99b=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe99b,0x11f));var _0xbe99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe99b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbe99('0x0'));var util=require(_0xbe99('0x1'));var logger=require(_0xbe99('0x2'))(_0xbe99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbe99('0x4'));var fs=require('fs');var path=require(_0xbe99('0x5'));var rimraf=require(_0xbe99('0x6'));var config=require(_0xbe99('0x7'));var attributes=require(_0xbe99('0x8'));module[_0xbe99('0x9')]=function(_0x3af94c,_0x22a212){return _0x3af94c[_0xbe99('0xa')](_0xbe99('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f64=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items'];(function(_0x1c31d0,_0x26ccda){var _0x28a4a2=function(_0x1d9510){while(--_0x1d9510){_0x1c31d0['push'](_0x1c31d0['shift']());}};_0x28a4a2(++_0x26ccda);}(_0x1f64,0x13f));var _0x41f6=function(_0x33f7f7,_0x117932){_0x33f7f7=_0x33f7f7-0x0;var _0x2d4bb1=_0x1f64[_0x33f7f7];return _0x2d4bb1;};'use strict';var _=require(_0x41f6('0x0'));var util=require(_0x41f6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x41f6('0x2'));var BPromise=require(_0x41f6('0x3'));var rp=require(_0x41f6('0x4'));var fs=require('fs');var path=require(_0x41f6('0x5'));var rimraf=require(_0x41f6('0x6'));var config=require(_0x41f6('0x7'));var attributes=require(_0x41f6('0x8'));module['exports']=function(_0x272d50,_0x187237){return _0x272d50[_0x41f6('0x9')]('DashboardItem',attributes,{'tableName':_0x41f6('0xa'),'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 43b05ba..350d11c 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 _0x1404=['http','redis','defaults','localhost','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5bd10f,_0x44659f){var _0x4bd4c7=function(_0x2c299a){while(--_0x2c299a){_0x5bd10f['push'](_0x5bd10f['shift']());}};_0x4bd4c7(++_0x44659f);}(_0x1404,0x1a1));var _0x4140=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1404[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4140('0x0'));var BPromise=require(_0x4140('0x1'));var rs=require(_0x4140('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4140('0x3'))['db'];var utils=require(_0x4140('0x4'));var logger=require(_0x4140('0x5'))(_0x4140('0x6'));var config=require('../../config/environment');var jayson=require(_0x4140('0x7'));var client=jayson['client'][_0x4140('0x8')]({'port':0x232a});config[_0x4140('0x9')]=_[_0x4140('0xa')](config['redis'],{'host':_0x4140('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4140('0x9')]));require(_0x4140('0xc'))[_0x4140('0xd')](socket);function respondWithRpcPromise(_0x1ef80a,_0x56e4e9,_0xaef271){return new BPromise(function(_0x4c6410,_0x56dc1f){return client[_0x4140('0xe')](_0x1ef80a,_0xaef271)['then'](function(_0x4e5583){logger['info'](_0x4140('0xf'),_0x56e4e9,_0x4140('0x10'));logger[_0x4140('0x11')](_0x4140('0x12'),_0x56e4e9,_0x4140('0x10'),JSON[_0x4140('0x13')](_0x4e5583));if(_0x4e5583[_0x4140('0x14')]){if(_0x4e5583[_0x4140('0x14')][_0x4140('0x15')]===0x1f4){logger[_0x4140('0x14')](_0x4140('0xf'),_0x56e4e9,_0x4e5583[_0x4140('0x14')][_0x4140('0x16')]);return _0x56dc1f(_0x4e5583[_0x4140('0x14')][_0x4140('0x16')]);}logger[_0x4140('0x14')](_0x4140('0xf'),_0x56e4e9,_0x4e5583['error']['message']);return _0x4c6410(_0x4e5583[_0x4140('0x14')][_0x4140('0x16')]);}else{logger['info'](_0x4140('0xf'),_0x56e4e9,'request\x20sent');_0x4c6410(_0x4e5583[_0x4140('0x17')][_0x4140('0x16')]);}})[_0x4140('0x18')](function(_0x4370f5){logger[_0x4140('0x14')](_0x4140('0xf'),_0x56e4e9,_0x4370f5);_0x56dc1f(_0x4370f5);});});} \ No newline at end of file +var _0xfc59=['rpc','jayson/promise','client','http','defaults','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x38fbeb,_0x213cbd){var _0x271378=function(_0x51aac9){while(--_0x51aac9){_0x38fbeb['push'](_0x38fbeb['shift']());}};_0x271378(++_0x213cbd);}(_0xfc59,0x1a4));var _0x9fc5=function(_0x3409a7,_0x8dfb01){_0x3409a7=_0x3409a7-0x0;var _0x23d800=_0xfc59[_0x3409a7];return _0x23d800;};'use strict';var _=require('lodash');var util=require(_0x9fc5('0x0'));var moment=require(_0x9fc5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9fc5('0x2'));var db=require(_0x9fc5('0x3'))['db'];var utils=require(_0x9fc5('0x4'));var logger=require('../../config/logger')(_0x9fc5('0x5'));var config=require('../../config/environment');var jayson=require(_0x9fc5('0x6'));var client=jayson[_0x9fc5('0x7')][_0x9fc5('0x8')]({'port':0x232a});config['redis']=_[_0x9fc5('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9fc5('0xa'))[_0x9fc5('0xb')](socket);function respondWithRpcPromise(_0x48cff4,_0x3027d8,_0x3e92e9){return new BPromise(function(_0x116dc8,_0x19e4b4){return client[_0x9fc5('0xc')](_0x48cff4,_0x3e92e9)[_0x9fc5('0xd')](function(_0x556367){logger[_0x9fc5('0xe')](_0x9fc5('0xf'),_0x3027d8,_0x9fc5('0x10'));logger[_0x9fc5('0x11')](_0x9fc5('0x12'),_0x3027d8,'request\x20sent',JSON[_0x9fc5('0x13')](_0x556367));if(_0x556367['error']){if(_0x556367[_0x9fc5('0x14')][_0x9fc5('0x15')]===0x1f4){logger['error'](_0x9fc5('0xf'),_0x3027d8,_0x556367[_0x9fc5('0x14')][_0x9fc5('0x16')]);return _0x19e4b4(_0x556367['error'][_0x9fc5('0x16')]);}logger[_0x9fc5('0x14')](_0x9fc5('0xf'),_0x3027d8,_0x556367[_0x9fc5('0x14')][_0x9fc5('0x16')]);return _0x116dc8(_0x556367['error'][_0x9fc5('0x16')]);}else{logger[_0x9fc5('0xe')](_0x9fc5('0xf'),_0x3027d8,_0x9fc5('0x10'));_0x116dc8(_0x556367[_0x9fc5('0x17')][_0x9fc5('0x16')]);}})[_0x9fc5('0x18')](function(_0x5428ac){logger[_0x9fc5('0x14')](_0x9fc5('0xf'),_0x3027d8,_0x5428ac);_0x19e4b4(_0x5428ac);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 19b2d2a..b72d5e5 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 _0xc520=['save','remove','update','emit','length','./dashboardItem.events'];(function(_0x458031,_0x5c93a1){var _0x3d6aa2=function(_0x34bc08){while(--_0x34bc08){_0x458031['push'](_0x458031['shift']());}};_0x3d6aa2(++_0x5c93a1);}(_0xc520,0x1df));var _0x0c52=function(_0x1a4e52,_0x37f7b0){_0x1a4e52=_0x1a4e52-0x0;var _0x37cfb1=_0xc520[_0x1a4e52];return _0x37cfb1;};'use strict';var DashboardItemEvents=require(_0x0c52('0x0'));var events=[_0x0c52('0x1'),_0x0c52('0x2'),_0x0c52('0x3')];function createListener(_0x3fa60f,_0x33c63e){return function(_0x2a056b){_0x33c63e[_0x0c52('0x4')](_0x3fa60f,_0x2a056b);};}function removeListener(_0x47a220,_0x533899){return function(){DashboardItemEvents['removeListener'](_0x47a220,_0x533899);};}exports['register']=function(_0x250ab0){for(var _0x4eb1f2=0x0,_0x1bd8e0=events[_0x0c52('0x5')];_0x4eb1f2<_0x1bd8e0;_0x4eb1f2++){var _0x215dd2=events[_0x4eb1f2];var _0x2ecddd=createListener('dashboardItem:'+_0x215dd2,_0x250ab0);DashboardItemEvents['on'](_0x215dd2,_0x2ecddd);}}; \ No newline at end of file +var _0x9552=['removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0x1c8697,_0x47bb41){var _0x289968=function(_0x40c835){while(--_0x40c835){_0x1c8697['push'](_0x1c8697['shift']());}};_0x289968(++_0x47bb41);}(_0x9552,0x161));var _0x2955=function(_0x3778c2,_0x420d89){_0x3778c2=_0x3778c2-0x0;var _0x582181=_0x9552[_0x3778c2];return _0x582181;};'use strict';var DashboardItemEvents=require(_0x2955('0x0'));var events=[_0x2955('0x1'),_0x2955('0x2'),_0x2955('0x3')];function createListener(_0x49439a,_0x21c4b0){return function(_0x1456f8){_0x21c4b0['emit'](_0x49439a,_0x1456f8);};}function removeListener(_0x244c7c,_0x35579d){return function(){DashboardItemEvents[_0x2955('0x4')](_0x244c7c,_0x35579d);};}exports[_0x2955('0x5')]=function(_0x5924bb){for(var _0x1cd672=0x0,_0x4a5f83=events['length'];_0x1cd672<_0x4a5f83;_0x1cd672++){var _0x2dc5d4=events[_0x1cd672];var _0x2f520d=createListener(_0x2955('0x6')+_0x2dc5d4,_0x5924bb);DashboardItemEvents['on'](_0x2dc5d4,_0x2f520d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e5ab7c2..4d57c7e 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 _0x31f0=['create','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','post'];(function(_0x505a68,_0xa297b7){var _0x4caac6=function(_0xa21052){while(--_0xa21052){_0x505a68['push'](_0x505a68['shift']());}};_0x4caac6(++_0xa297b7);}(_0x31f0,0xb7));var _0x031f=function(_0x5ee4c6,_0x10d394){_0x5ee4c6=_0x5ee4c6-0x0;var _0x39b8f7=_0x31f0[_0x5ee4c6];return _0x39b8f7;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x031f('0x8')]('/',auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0xa')](_0x031f('0xb'),auth[_0x031f('0xc')](),controller['update']);router[_0x031f('0xd')](_0x031f('0xb'),auth[_0x031f('0xc')](),controller[_0x031f('0xe')]);module[_0x031f('0xf')]=router; \ No newline at end of file +var _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4e2861,_0x199be0){_0x4e2861=_0x4e2861-0x0;var _0x2265e3=_0xf2ca[_0x4e2861];return _0x2265e3;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('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 2a8b37e..4be231a 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 _0xec50=['STRING','sequelize'];(function(_0x5a2973,_0x367fa5){var _0x47165e=function(_0x2e69f7){while(--_0x2e69f7){_0x5a2973['push'](_0x5a2973['shift']());}};_0x47165e(++_0x367fa5);}(_0xec50,0x1a3));var _0x0ec5=function(_0x20b9fc,_0x5dab92){_0x20b9fc=_0x20b9fc-0x0;var _0x511a2b=_0xec50[_0x20b9fc];return _0x511a2b;};'use strict';var Sequelize=require(_0x0ec5('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ec5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf46d=['STRING','sequelize','exports'];(function(_0x2e4bdf,_0x3a24be){var _0x57ccc2=function(_0xc09468){while(--_0xc09468){_0x2e4bdf['push'](_0x2e4bdf['shift']());}};_0x57ccc2(++_0x3a24be);}(_0xf46d,0x1de));var _0xdf46=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xf46d[_0x80d733];return _0x435868;};'use strict';var Sequelize=require(_0xdf46('0x0'));module[_0xdf46('0x1')]={'name':{'type':Sequelize[_0xdf46('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3354d7d..07b3c45 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 _0x9e46=['../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','catch','show','params','keys','include','find','create','body','user','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','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x48c059,_0x5cb1fe){var _0xcb0f8c=function(_0x539ba7){while(--_0x539ba7){_0x48c059['push'](_0x48c059['shift']());}};_0xcb0f8c(++_0x5cb1fe);}(_0x9e46,0x19b));var _0x69e4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9e46[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x69e4('0x0'));var emlformat=require(_0x69e4('0x1'));var rimraf=require(_0x69e4('0x2'));var zipdir=require(_0x69e4('0x3'));var jsonpatch=require(_0x69e4('0x4'));var rp=require(_0x69e4('0x5'));var moment=require('moment');var BPromise=require(_0x69e4('0x6'));var Mustache=require(_0x69e4('0x7'));var util=require(_0x69e4('0x8'));var path=require(_0x69e4('0x9'));var sox=require(_0x69e4('0xa'));var csv=require(_0x69e4('0xb'));var ejs=require(_0x69e4('0xc'));var fs=require('fs');var _=require(_0x69e4('0xd'));var squel=require(_0x69e4('0xe'));var crypto=require(_0x69e4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x69e4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x69e4('0x11'));var Papa=require(_0x69e4('0x12'));var Redis=require(_0x69e4('0x13'));var authService=require(_0x69e4('0x14'));var qs=require(_0x69e4('0x15'));var as=require(_0x69e4('0x16'));var hardwareService=require(_0x69e4('0x17'));var logger=require(_0x69e4('0x18'))('api');var utils=require(_0x69e4('0x19'));var config=require(_0x69e4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5daba6,_0x5afeea){_0x5afeea=_0x5afeea||0xcc;return function(_0x5d8dd1){if(_0x5d8dd1){return _0x5daba6[_0x69e4('0x1b')](_0x5afeea);}return _0x5daba6[_0x69e4('0x1c')](_0x5afeea)[_0x69e4('0x1d')]();};}function respondWithResult(_0x421cee,_0x1b0516){_0x1b0516=_0x1b0516||0xc8;return function(_0x2e2436){if(_0x2e2436){return _0x421cee[_0x69e4('0x1c')](_0x1b0516)[_0x69e4('0x1e')](_0x2e2436);}};}function respondWithFilteredResult(_0x5cb39d,_0x47bd8f){return function(_0x3a5cf2){if(_0x3a5cf2){var _0x34419e=_0x3a5cf2['count'],_0xeaa774=_0x47bd8f[_0x69e4('0x1f')],_0x2a69a9=_0x47bd8f[_0x69e4('0x1f')]+_0x47bd8f[_0x69e4('0x20')],_0x27c26d;if(_0x2a69a9>=_0x34419e){_0x2a69a9=_0x34419e;_0x27c26d=0xc8;}else{_0x27c26d=0xce;}_0x5cb39d['status'](_0x27c26d);return _0x5cb39d[_0x69e4('0x21')]('Content-Range',_0xeaa774+'-'+_0x2a69a9+'/'+_0x34419e)[_0x69e4('0x1e')](_0x3a5cf2);}return null;};}function patchUpdates(_0x5b3a95){return function(_0x4627f2){try{jsonpatch[_0x69e4('0x22')](_0x4627f2,_0x5b3a95,!![]);}catch(_0x3da7e0){return BPromise[_0x69e4('0x23')](_0x3da7e0);}return _0x4627f2[_0x69e4('0x24')]();};}function saveUpdates(_0x4b31ef,_0x52bb9f){return function(_0x1f9ee5){if(_0x1f9ee5){return _0x1f9ee5[_0x69e4('0x25')](_0x4b31ef)[_0x69e4('0x26')](function(_0x3d5ea9){return _0x3d5ea9;});}return null;};}function removeEntity(_0x322ab0,_0x3607ef){return function(_0x5cf15f){if(_0x5cf15f){return _0x5cf15f[_0x69e4('0x27')]()['then'](function(){var _0x364bab=_0x5cf15f[_0x69e4('0x28')]({'plain':!![]});var _0xeba747=_0x69e4('0x29');return db[_0x69e4('0x2a')]['destroy']({'where':{'type':_0xeba747,'resourceId':_0x364bab['id']}})[_0x69e4('0x26')](function(){return _0x5cf15f;});})[_0x69e4('0x26')](function(){_0x322ab0[_0x69e4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b1df,_0x4a2863){return function(_0x5e5371){if(!_0x5e5371){_0x49b1df['sendStatus'](0x194);}return _0x5e5371;};}function handleError(_0x1b20e3,_0x227ba2){_0x227ba2=_0x227ba2||0x1f4;return function(_0x5cae8a){logger[_0x69e4('0x2b')](_0x5cae8a[_0x69e4('0x2c')]);if(_0x5cae8a[_0x69e4('0x2d')]){delete _0x5cae8a[_0x69e4('0x2d')];}_0x1b20e3[_0x69e4('0x1c')](_0x227ba2)[_0x69e4('0x2e')](_0x5cae8a);};}exports[_0x69e4('0x2f')]=function(_0x4390b1,_0xeeb857){var _0xbdbbb3={},_0x455934={},_0x3d8d75={'count':0x0,'rows':[]};var _0x5a98a4=_[_0x69e4('0x30')](db[_0x69e4('0x31')][_0x69e4('0x32')],function(_0x4f0e6f){return{'name':_0x4f0e6f[_0x69e4('0x33')],'type':_0x4f0e6f[_0x69e4('0x34')][_0x69e4('0x35')]};});_0x455934['model']=_[_0x69e4('0x30')](_0x5a98a4,_0x69e4('0x2d'));_0x455934[_0x69e4('0x36')]=_['keys'](_0x4390b1['query']);_0x455934[_0x69e4('0x37')]=_[_0x69e4('0x38')](_0x455934[_0x69e4('0x39')],_0x455934[_0x69e4('0x36')]);_0xbdbbb3[_0x69e4('0x3a')]=_[_0x69e4('0x38')](_0x455934[_0x69e4('0x39')],qs[_0x69e4('0x3b')](_0x4390b1['query'][_0x69e4('0x3b')]));_0xbdbbb3['attributes']=_0xbdbbb3[_0x69e4('0x3a')][_0x69e4('0x3c')]?_0xbdbbb3['attributes']:_0x455934['model'];if(!_0x4390b1[_0x69e4('0x36')][_0x69e4('0x3d')](_0x69e4('0x3e'))){_0xbdbbb3[_0x69e4('0x20')]=qs[_0x69e4('0x20')](_0x4390b1[_0x69e4('0x36')]['limit']);_0xbdbbb3[_0x69e4('0x1f')]=qs['offset'](_0x4390b1['query']['offset']);}_0xbdbbb3[_0x69e4('0x3f')]=qs[_0x69e4('0x40')](_0x4390b1[_0x69e4('0x36')][_0x69e4('0x40')]);_0xbdbbb3[_0x69e4('0x41')]=qs['filters'](_[_0x69e4('0x42')](_0x4390b1['query'],_0x455934[_0x69e4('0x37')]),_0x5a98a4);if(_0x4390b1['query']['filter']){_0xbdbbb3[_0x69e4('0x41')]=_[_0x69e4('0x43')](_0xbdbbb3[_0x69e4('0x41')],{'$or':_['map'](_0x5a98a4,function(_0x51e33a){if(_0x51e33a['type']!==_0x69e4('0x44')){var _0x44fa09={};_0x44fa09[_0x51e33a[_0x69e4('0x2d')]]={'$like':'%'+_0x4390b1[_0x69e4('0x36')][_0x69e4('0x45')]+'%'};return _0x44fa09;}})});}_0xbdbbb3=_[_0x69e4('0x43')]({},_0xbdbbb3,_0x4390b1[_0x69e4('0x46')]);var _0x9235a5={'where':_0xbdbbb3[_0x69e4('0x41')]};return db[_0x69e4('0x31')][_0x69e4('0x47')](_0x9235a5)[_0x69e4('0x26')](function(_0x3b2687){_0x3d8d75[_0x69e4('0x47')]=_0x3b2687;if(_0x4390b1['query'][_0x69e4('0x48')]){_0xbdbbb3['include']=[{'all':!![]}];}return db[_0x69e4('0x31')][_0x69e4('0x49')](_0xbdbbb3);})[_0x69e4('0x26')](function(_0x5761ab){_0x3d8d75['rows']=_0x5761ab;return _0x3d8d75;})['then'](respondWithFilteredResult(_0xeeb857,_0xbdbbb3))[_0x69e4('0x4a')](handleError(_0xeeb857,null));};exports[_0x69e4('0x4b')]=function(_0x32d0aa,_0x4f6e7b){var _0x599dd0={'raw':!![],'where':{'id':_0x32d0aa[_0x69e4('0x4c')]['id']}},_0x246fc3={};_0x246fc3[_0x69e4('0x39')]=_[_0x69e4('0x4d')](db['Disposition'][_0x69e4('0x32')]);_0x246fc3['query']=_[_0x69e4('0x4d')](_0x32d0aa[_0x69e4('0x36')]);_0x246fc3['filters']=_[_0x69e4('0x38')](_0x246fc3['model'],_0x246fc3[_0x69e4('0x36')]);_0x599dd0['attributes']=_[_0x69e4('0x38')](_0x246fc3[_0x69e4('0x39')],qs[_0x69e4('0x3b')](_0x32d0aa['query']['fields']));_0x599dd0[_0x69e4('0x3a')]=_0x599dd0['attributes'][_0x69e4('0x3c')]?_0x599dd0[_0x69e4('0x3a')]:_0x246fc3[_0x69e4('0x39')];if(_0x32d0aa[_0x69e4('0x36')][_0x69e4('0x48')]){_0x599dd0[_0x69e4('0x4e')]=[{'all':!![]}];}_0x599dd0=_[_0x69e4('0x43')]({},_0x599dd0,_0x32d0aa[_0x69e4('0x46')]);return db[_0x69e4('0x31')][_0x69e4('0x4f')](_0x599dd0)[_0x69e4('0x26')](handleEntityNotFound(_0x4f6e7b,null))[_0x69e4('0x26')](respondWithResult(_0x4f6e7b,null))[_0x69e4('0x4a')](handleError(_0x4f6e7b,null));};exports[_0x69e4('0x50')]=function(_0x366046,_0x3dee13){return db[_0x69e4('0x31')][_0x69e4('0x50')](_0x366046[_0x69e4('0x51')],{})[_0x69e4('0x26')](function(_0x284b2e){var _0x251aca=_0x366046[_0x69e4('0x52')]['get']({'plain':!![]});if(!_0x251aca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x251aca['role']===_0x69e4('0x52')){var _0x51d917=_0x284b2e[_0x69e4('0x28')]({'plain':!![]});var _0x29dded=_0x69e4('0x29');return db[_0x69e4('0x53')][_0x69e4('0x4f')]({'where':{'name':_0x29dded,'userProfileId':_0x251aca[_0x69e4('0x54')]},'raw':!![]})['then'](function(_0x97ba0b){if(_0x97ba0b&&_0x97ba0b[_0x69e4('0x55')]===0x0){return db[_0x69e4('0x2a')][_0x69e4('0x50')]({'name':_0x51d917[_0x69e4('0x2d')],'resourceId':_0x51d917['id'],'type':_0x97ba0b[_0x69e4('0x2d')],'sectionId':_0x97ba0b['id']},{})['then'](function(){return _0x284b2e;});}else{return _0x284b2e;}})[_0x69e4('0x4a')](function(_0x499eb4){logger[_0x69e4('0x2b')](_0x69e4('0x56'),_0x499eb4);throw _0x499eb4;});}return _0x284b2e;})[_0x69e4('0x26')](respondWithResult(_0x3dee13,0xc9))[_0x69e4('0x4a')](handleError(_0x3dee13,null));};exports[_0x69e4('0x25')]=function(_0x3b35e9,_0x184ff8){if(_0x3b35e9[_0x69e4('0x51')]['id']){delete _0x3b35e9[_0x69e4('0x51')]['id'];}return db[_0x69e4('0x31')][_0x69e4('0x4f')]({'where':{'id':_0x3b35e9[_0x69e4('0x4c')]['id']}})[_0x69e4('0x26')](handleEntityNotFound(_0x184ff8,null))[_0x69e4('0x26')](saveUpdates(_0x3b35e9['body'],null))['then'](respondWithResult(_0x184ff8,null))['catch'](handleError(_0x184ff8,null));};exports[_0x69e4('0x27')]=function(_0x56853e,_0x12f424){return db[_0x69e4('0x31')]['find']({'where':{'id':_0x56853e[_0x69e4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12f424,null))[_0x69e4('0x26')](removeEntity(_0x12f424,null))[_0x69e4('0x4a')](handleError(_0x12f424,null));}; \ No newline at end of file +var _0xa291=['ejs','crypto','desk.js','querystring','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','apply','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv'];(function(_0x528f85,_0x377582){var _0x3511c3=function(_0x35e84b){while(--_0x35e84b){_0x528f85['push'](_0x528f85['shift']());}};_0x3511c3(++_0x377582);}(_0xa291,0xe1));var _0x1a29=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0xa291[_0x466e57];return _0x34df42;};'use strict';var pdf=require(_0x1a29('0x0'));var emlformat=require(_0x1a29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1a29('0x2'));var jsonpatch=require(_0x1a29('0x3'));var rp=require('request-promise');var moment=require(_0x1a29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a29('0x5'));var util=require(_0x1a29('0x6'));var path=require('path');var sox=require(_0x1a29('0x7'));var csv=require(_0x1a29('0x8'));var ejs=require(_0x1a29('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1a29('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1a29('0xb'));var toCsv=require(_0x1a29('0x8'));var querystring=require(_0x1a29('0xc'));var Papa=require('papaparse');var Redis=require(_0x1a29('0xd'));var authService=require(_0x1a29('0xe'));var qs=require(_0x1a29('0xf'));var as=require(_0x1a29('0x10'));var hardwareService=require(_0x1a29('0x11'));var logger=require(_0x1a29('0x12'))(_0x1a29('0x13'));var utils=require('../../config/utils');var config=require(_0x1a29('0x14'));var db=require(_0x1a29('0x15'))['db'];function respondWithStatusCode(_0x5165de,_0x4e4c55){_0x4e4c55=_0x4e4c55||0xcc;return function(_0x57a74b){if(_0x57a74b){return _0x5165de[_0x1a29('0x16')](_0x4e4c55);}return _0x5165de[_0x1a29('0x17')](_0x4e4c55)['end']();};}function respondWithResult(_0x37b9af,_0x1d599b){_0x1d599b=_0x1d599b||0xc8;return function(_0x49372f){if(_0x49372f){return _0x37b9af[_0x1a29('0x17')](_0x1d599b)[_0x1a29('0x18')](_0x49372f);}};}function respondWithFilteredResult(_0x504d3b,_0x3f79ed){return function(_0x1c3b1b){if(_0x1c3b1b){var _0x148fc3=_0x1c3b1b[_0x1a29('0x19')],_0x4e7d3a=_0x3f79ed['offset'],_0x5a2034=_0x3f79ed[_0x1a29('0x1a')]+_0x3f79ed[_0x1a29('0x1b')],_0x43eae9;if(_0x5a2034>=_0x148fc3){_0x5a2034=_0x148fc3;_0x43eae9=0xc8;}else{_0x43eae9=0xce;}_0x504d3b['status'](_0x43eae9);return _0x504d3b['set']('Content-Range',_0x4e7d3a+'-'+_0x5a2034+'/'+_0x148fc3)[_0x1a29('0x18')](_0x1c3b1b);}return null;};}function patchUpdates(_0x29bdee){return function(_0x3cf2dd){try{jsonpatch[_0x1a29('0x1c')](_0x3cf2dd,_0x29bdee,!![]);}catch(_0x1a8363){return BPromise['reject'](_0x1a8363);}return _0x3cf2dd['save']();};}function saveUpdates(_0x37b8ae,_0x16dc2e){return function(_0x74eedf){if(_0x74eedf){return _0x74eedf['update'](_0x37b8ae)['then'](function(_0x220314){return _0x220314;});}return null;};}function removeEntity(_0x198950,_0x35b9f7){return function(_0x11fe3a){if(_0x11fe3a){return _0x11fe3a[_0x1a29('0x1d')]()[_0x1a29('0x1e')](function(){var _0x429ede=_0x11fe3a[_0x1a29('0x1f')]({'plain':!![]});var _0x1cb3dc='Dispositions';return db[_0x1a29('0x20')][_0x1a29('0x1d')]({'where':{'type':_0x1cb3dc,'resourceId':_0x429ede['id']}})[_0x1a29('0x1e')](function(){return _0x11fe3a;});})['then'](function(){_0x198950['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b4f6,_0x3d532e){return function(_0x37be31){if(!_0x37be31){_0x5b4f6[_0x1a29('0x16')](0x194);}return _0x37be31;};}function handleError(_0x4d68c4,_0x19c4ef){_0x19c4ef=_0x19c4ef||0x1f4;return function(_0x3e4f5d){logger[_0x1a29('0x21')](_0x3e4f5d[_0x1a29('0x22')]);if(_0x3e4f5d[_0x1a29('0x23')]){delete _0x3e4f5d[_0x1a29('0x23')];}_0x4d68c4[_0x1a29('0x17')](_0x19c4ef)[_0x1a29('0x24')](_0x3e4f5d);};}exports[_0x1a29('0x25')]=function(_0x474bda,_0xae7bee){var _0x3739cb={},_0x72cdcf={},_0x888fa2={'count':0x0,'rows':[]};var _0x268fe7=_[_0x1a29('0x26')](db[_0x1a29('0x27')][_0x1a29('0x28')],function(_0x2b7ded){return{'name':_0x2b7ded[_0x1a29('0x29')],'type':_0x2b7ded[_0x1a29('0x2a')][_0x1a29('0x2b')]};});_0x72cdcf[_0x1a29('0x2c')]=_[_0x1a29('0x26')](_0x268fe7,_0x1a29('0x23'));_0x72cdcf['query']=_['keys'](_0x474bda[_0x1a29('0x2d')]);_0x72cdcf[_0x1a29('0x2e')]=_[_0x1a29('0x2f')](_0x72cdcf[_0x1a29('0x2c')],_0x72cdcf[_0x1a29('0x2d')]);_0x3739cb['attributes']=_[_0x1a29('0x2f')](_0x72cdcf[_0x1a29('0x2c')],qs[_0x1a29('0x30')](_0x474bda[_0x1a29('0x2d')][_0x1a29('0x30')]));_0x3739cb[_0x1a29('0x31')]=_0x3739cb['attributes'][_0x1a29('0x32')]?_0x3739cb['attributes']:_0x72cdcf[_0x1a29('0x2c')];if(!_0x474bda['query'][_0x1a29('0x33')](_0x1a29('0x34'))){_0x3739cb[_0x1a29('0x1b')]=qs[_0x1a29('0x1b')](_0x474bda[_0x1a29('0x2d')][_0x1a29('0x1b')]);_0x3739cb[_0x1a29('0x1a')]=qs['offset'](_0x474bda[_0x1a29('0x2d')][_0x1a29('0x1a')]);}_0x3739cb[_0x1a29('0x35')]=qs[_0x1a29('0x36')](_0x474bda[_0x1a29('0x2d')][_0x1a29('0x36')]);_0x3739cb[_0x1a29('0x37')]=qs[_0x1a29('0x2e')](_['pick'](_0x474bda[_0x1a29('0x2d')],_0x72cdcf[_0x1a29('0x2e')]),_0x268fe7);if(_0x474bda['query'][_0x1a29('0x38')]){_0x3739cb[_0x1a29('0x37')]=_['merge'](_0x3739cb[_0x1a29('0x37')],{'$or':_[_0x1a29('0x26')](_0x268fe7,function(_0x21a044){if(_0x21a044[_0x1a29('0x2a')]!==_0x1a29('0x39')){var _0xed5927={};_0xed5927[_0x21a044[_0x1a29('0x23')]]={'$like':'%'+_0x474bda[_0x1a29('0x2d')]['filter']+'%'};return _0xed5927;}})});}_0x3739cb=_[_0x1a29('0x3a')]({},_0x3739cb,_0x474bda[_0x1a29('0x3b')]);var _0x58cfb4={'where':_0x3739cb[_0x1a29('0x37')]};return db[_0x1a29('0x27')][_0x1a29('0x19')](_0x58cfb4)[_0x1a29('0x1e')](function(_0x55237e){_0x888fa2[_0x1a29('0x19')]=_0x55237e;if(_0x474bda[_0x1a29('0x2d')][_0x1a29('0x3c')]){_0x3739cb['include']=[{'all':!![]}];}return db[_0x1a29('0x27')][_0x1a29('0x3d')](_0x3739cb);})['then'](function(_0x7bfbfe){_0x888fa2['rows']=_0x7bfbfe;return _0x888fa2;})[_0x1a29('0x1e')](respondWithFilteredResult(_0xae7bee,_0x3739cb))[_0x1a29('0x3e')](handleError(_0xae7bee,null));};exports[_0x1a29('0x3f')]=function(_0x336ed2,_0x59a6d3){var _0x2172aa={'raw':!![],'where':{'id':_0x336ed2[_0x1a29('0x40')]['id']}},_0x10a8da={};_0x10a8da[_0x1a29('0x2c')]=_['keys'](db[_0x1a29('0x27')][_0x1a29('0x28')]);_0x10a8da[_0x1a29('0x2d')]=_['keys'](_0x336ed2[_0x1a29('0x2d')]);_0x10a8da[_0x1a29('0x2e')]=_[_0x1a29('0x2f')](_0x10a8da['model'],_0x10a8da[_0x1a29('0x2d')]);_0x2172aa[_0x1a29('0x31')]=_[_0x1a29('0x2f')](_0x10a8da[_0x1a29('0x2c')],qs[_0x1a29('0x30')](_0x336ed2['query'][_0x1a29('0x30')]));_0x2172aa[_0x1a29('0x31')]=_0x2172aa['attributes'][_0x1a29('0x32')]?_0x2172aa[_0x1a29('0x31')]:_0x10a8da[_0x1a29('0x2c')];if(_0x336ed2[_0x1a29('0x2d')][_0x1a29('0x3c')]){_0x2172aa[_0x1a29('0x41')]=[{'all':!![]}];}_0x2172aa=_[_0x1a29('0x3a')]({},_0x2172aa,_0x336ed2['options']);return db[_0x1a29('0x27')][_0x1a29('0x42')](_0x2172aa)[_0x1a29('0x1e')](handleEntityNotFound(_0x59a6d3,null))['then'](respondWithResult(_0x59a6d3,null))[_0x1a29('0x3e')](handleError(_0x59a6d3,null));};exports[_0x1a29('0x43')]=function(_0x2c4e23,_0x17b16d){return db[_0x1a29('0x27')][_0x1a29('0x43')](_0x2c4e23[_0x1a29('0x44')],{})['then'](function(_0x49aa1e){var _0x241a74=_0x2c4e23[_0x1a29('0x45')][_0x1a29('0x1f')]({'plain':!![]});if(!_0x241a74)throw new Error(_0x1a29('0x46'));if(_0x241a74[_0x1a29('0x47')]===_0x1a29('0x45')){var _0x4c9282=_0x49aa1e[_0x1a29('0x1f')]({'plain':!![]});var _0x256fed=_0x1a29('0x48');return db[_0x1a29('0x49')][_0x1a29('0x42')]({'where':{'name':_0x256fed,'userProfileId':_0x241a74[_0x1a29('0x4a')]},'raw':!![]})[_0x1a29('0x1e')](function(_0x48efe9){if(_0x48efe9&&_0x48efe9[_0x1a29('0x4b')]===0x0){return db[_0x1a29('0x20')][_0x1a29('0x43')]({'name':_0x4c9282['name'],'resourceId':_0x4c9282['id'],'type':_0x48efe9['name'],'sectionId':_0x48efe9['id']},{})[_0x1a29('0x1e')](function(){return _0x49aa1e;});}else{return _0x49aa1e;}})[_0x1a29('0x3e')](function(_0x43d0f6){logger[_0x1a29('0x21')](_0x1a29('0x4c'),_0x43d0f6);throw _0x43d0f6;});}return _0x49aa1e;})[_0x1a29('0x1e')](respondWithResult(_0x17b16d,0xc9))[_0x1a29('0x3e')](handleError(_0x17b16d,null));};exports[_0x1a29('0x4d')]=function(_0x5953ff,_0x1dcf6c){if(_0x5953ff[_0x1a29('0x44')]['id']){delete _0x5953ff[_0x1a29('0x44')]['id'];}return db['Disposition']['find']({'where':{'id':_0x5953ff['params']['id']}})['then'](handleEntityNotFound(_0x1dcf6c,null))[_0x1a29('0x1e')](saveUpdates(_0x5953ff[_0x1a29('0x44')],null))[_0x1a29('0x1e')](respondWithResult(_0x1dcf6c,null))['catch'](handleError(_0x1dcf6c,null));};exports[_0x1a29('0x1d')]=function(_0x2dba8a,_0xd69021){return db[_0x1a29('0x27')][_0x1a29('0x42')]({'where':{'id':_0x2dba8a[_0x1a29('0x40')]['id']}})['then'](handleEntityNotFound(_0xd69021,null))[_0x1a29('0x1e')](removeEntity(_0xd69021,null))[_0x1a29('0x3e')](handleError(_0xd69021,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index dc61fbe..7f7ada9 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 _0x3e89=['define','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','request-promise','../../config/environment','./disposition.attributes','exports'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x3e89,0x1ec));var _0x93e8=function(_0x34089e,_0x340ac1){_0x34089e=_0x34089e-0x0;var _0x2302de=_0x3e89[_0x34089e];return _0x2302de;};'use strict';var _=require('lodash');var util=require(_0x93e8('0x0'));var logger=require(_0x93e8('0x1'))(_0x93e8('0x2'));var moment=require(_0x93e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x93e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x93e8('0x5'));var attributes=require(_0x93e8('0x6'));module[_0x93e8('0x7')]=function(_0x3e2b91,_0xa3ebc5){return _0x3e2b91[_0x93e8('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x93e8('0x9'),'fields':[_0x93e8('0xa'),_0x93e8('0xb')]},{'unique':!![],'name':'name_chat','fields':[_0x93e8('0xa'),_0x93e8('0xc')]},{'unique':!![],'name':_0x93e8('0xd'),'fields':[_0x93e8('0xa'),_0x93e8('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x93e8('0xa'),_0x93e8('0xf')]},{'unique':!![],'name':'name_fax','fields':[_0x93e8('0xa'),_0x93e8('0x10')]},{'unique':!![],'name':'name_openchannel','fields':[_0x93e8('0xa'),_0x93e8('0x11')]},{'unique':!![],'name':_0x93e8('0x12'),'fields':[_0x93e8('0xa'),_0x93e8('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2315=['WhatsappAccountId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp'];(function(_0x43c1a9,_0x272bfd){var _0x5de5b7=function(_0x132e7b){while(--_0x132e7b){_0x43c1a9['push'](_0x43c1a9['shift']());}};_0x5de5b7(++_0x272bfd);}(_0x2315,0xc7));var _0x5231=function(_0x2d437e,_0x4a72c0){_0x2d437e=_0x2d437e-0x0;var _0x23cb23=_0x2315[_0x2d437e];return _0x23cb23;};'use strict';var _=require(_0x5231('0x0'));var util=require(_0x5231('0x1'));var logger=require(_0x5231('0x2'))('api');var moment=require(_0x5231('0x3'));var BPromise=require('bluebird');var rp=require(_0x5231('0x4'));var fs=require('fs');var path=require(_0x5231('0x5'));var rimraf=require(_0x5231('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x5231('0x7')]=function(_0x223506,_0x482085){return _0x223506['define'](_0x5231('0x8'),attributes,{'tableName':_0x5231('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5231('0xa'),'fields':[_0x5231('0xb'),_0x5231('0xc')]},{'unique':!![],'name':_0x5231('0xd'),'fields':[_0x5231('0xb'),_0x5231('0xe')]},{'unique':!![],'name':'name_mail','fields':['name',_0x5231('0xf')]},{'unique':!![],'name':_0x5231('0x10'),'fields':[_0x5231('0xb'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x5231('0xb'),_0x5231('0x11')]},{'unique':!![],'name':_0x5231('0x12'),'fields':[_0x5231('0xb'),_0x5231('0x13')]},{'unique':!![],'name':_0x5231('0x14'),'fields':[_0x5231('0xb'),_0x5231('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d854fdd..4d362ab 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 _0x12d3=['request','then','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','Disposition,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x12d3,0xbb));var _0x312d=function(_0x5d63c9,_0x4bed60){_0x5d63c9=_0x5d63c9-0x0;var _0x311536=_0x12d3[_0x5d63c9];return _0x311536;};'use strict';var _=require(_0x312d('0x0'));var util=require(_0x312d('0x1'));var moment=require(_0x312d('0x2'));var BPromise=require(_0x312d('0x3'));var rs=require(_0x312d('0x4'));var fs=require('fs');var Redis=require(_0x312d('0x5'));var db=require(_0x312d('0x6'))['db'];var utils=require(_0x312d('0x7'));var logger=require(_0x312d('0x8'))('rpc');var config=require(_0x312d('0x9'));var jayson=require(_0x312d('0xa'));var client=jayson[_0x312d('0xb')][_0x312d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a19d2,_0x3211bf,_0x176d2d){return new BPromise(function(_0x2d3a63,_0xdf2f88){return client[_0x312d('0xd')](_0x3a19d2,_0x176d2d)[_0x312d('0xe')](function(_0x41a5e5){logger[_0x312d('0xf')]('Disposition,\x20%s,\x20%s',_0x3211bf,_0x312d('0x10'));logger[_0x312d('0x11')](_0x312d('0x12'),_0x3211bf,_0x312d('0x10'),JSON[_0x312d('0x13')](_0x41a5e5));if(_0x41a5e5[_0x312d('0x14')]){if(_0x41a5e5[_0x312d('0x14')][_0x312d('0x15')]===0x1f4){logger['error'](_0x312d('0x16'),_0x3211bf,_0x41a5e5[_0x312d('0x14')][_0x312d('0x17')]);return _0xdf2f88(_0x41a5e5[_0x312d('0x14')][_0x312d('0x17')]);}logger['error'](_0x312d('0x16'),_0x3211bf,_0x41a5e5[_0x312d('0x14')]['message']);return _0x2d3a63(_0x41a5e5[_0x312d('0x14')][_0x312d('0x17')]);}else{logger['info'](_0x312d('0x16'),_0x3211bf,_0x312d('0x10'));_0x2d3a63(_0x41a5e5[_0x312d('0x18')]['message']);}})['catch'](function(_0x227e3e){logger[_0x312d('0x14')](_0x312d('0x16'),_0x3211bf,_0x227e3e);_0xdf2f88(_0x227e3e);});});} \ No newline at end of file +var _0x574c=['then','info','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x574c,0xdd));var _0xc574=function(_0x363f42,_0x4e20bf){_0x363f42=_0x363f42-0x0;var _0x1e96ba=_0x574c[_0x363f42];return _0x1e96ba;};'use strict';var _=require('lodash');var util=require(_0xc574('0x0'));var moment=require('moment');var BPromise=require(_0xc574('0x1'));var rs=require(_0xc574('0x2'));var fs=require('fs');var Redis=require(_0xc574('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc574('0x4'));var logger=require('../../config/logger')(_0xc574('0x5'));var config=require(_0xc574('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc574('0x7')][_0xc574('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb36459,_0x3903e5,_0x1d332b){return new BPromise(function(_0x200a10,_0x5e7d01){return client[_0xc574('0x9')](_0xb36459,_0x1d332b)[_0xc574('0xa')](function(_0x6565f9){logger[_0xc574('0xb')](_0xc574('0xc'),_0x3903e5,_0xc574('0xd'));logger['debug'](_0xc574('0xe'),_0x3903e5,_0xc574('0xd'),JSON[_0xc574('0xf')](_0x6565f9));if(_0x6565f9[_0xc574('0x10')]){if(_0x6565f9[_0xc574('0x10')][_0xc574('0x11')]===0x1f4){logger[_0xc574('0x10')](_0xc574('0xc'),_0x3903e5,_0x6565f9[_0xc574('0x10')][_0xc574('0x12')]);return _0x5e7d01(_0x6565f9[_0xc574('0x10')]['message']);}logger[_0xc574('0x10')](_0xc574('0xc'),_0x3903e5,_0x6565f9[_0xc574('0x10')][_0xc574('0x12')]);return _0x200a10(_0x6565f9[_0xc574('0x10')][_0xc574('0x12')]);}else{logger[_0xc574('0xb')](_0xc574('0xc'),_0x3903e5,_0xc574('0xd'));_0x200a10(_0x6565f9[_0xc574('0x13')][_0xc574('0x12')]);}})[_0xc574('0x14')](function(_0x766e4d){logger[_0xc574('0x10')]('Disposition,\x20%s,\x20%s',_0x3903e5,_0x766e4d);_0x5e7d01(_0x766e4d);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 2b5b114..23eb339 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 _0xccef=['get','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xccef,0x1d4));var _0xfcce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xccef[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xfcce('0x0'));var path=require('path');var timeout=require(_0xfcce('0x1'));var express=require(_0xfcce('0x2'));var router=express[_0xfcce('0x3')]();var auth=require(_0xfcce('0x4'));var interaction=require(_0xfcce('0x5'));var config=require(_0xfcce('0x6'));var controller=require('./disposition.controller');router['get']('/',auth[_0xfcce('0x7')](),controller['index']);router[_0xfcce('0x8')](_0xfcce('0x9'),auth[_0xfcce('0x7')](),controller[_0xfcce('0xa')]);router[_0xfcce('0xb')]('/',auth[_0xfcce('0x7')](),controller[_0xfcce('0xc')]);router['put'](_0xfcce('0x9'),auth[_0xfcce('0x7')](),controller[_0xfcce('0xd')]);router[_0xfcce('0xe')](_0xfcce('0x9'),auth[_0xfcce('0x7')](),controller[_0xfcce('0xf')]);module[_0xfcce('0x10')]=router; \ No newline at end of file +var _0x9db7=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0x9db7,0x1bf));var _0x79db=function(_0x5b11f5,_0xee2429){_0x5b11f5=_0x5b11f5-0x0;var _0x3e0c58=_0x9db7[_0x5b11f5];return _0x3e0c58;};'use strict';var multer=require(_0x79db('0x0'));var util=require(_0x79db('0x1'));var path=require(_0x79db('0x2'));var timeout=require(_0x79db('0x3'));var express=require('express');var router=express[_0x79db('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x79db('0x5'));var config=require(_0x79db('0x6'));var controller=require('./disposition.controller');router[_0x79db('0x7')]('/',auth[_0x79db('0x8')](),controller[_0x79db('0x9')]);router[_0x79db('0x7')](_0x79db('0xa'),auth[_0x79db('0x8')](),controller[_0x79db('0xb')]);router[_0x79db('0xc')]('/',auth[_0x79db('0x8')](),controller[_0x79db('0xd')]);router[_0x79db('0xe')](_0x79db('0xa'),auth['isAuthenticated'](),controller[_0x79db('0xf')]);router[_0x79db('0x10')](_0x79db('0xa'),auth[_0x79db('0x8')](),controller[_0x79db('0x11')]);module[_0x79db('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a7623aa..97f3e08 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 _0xdd6f=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','xCALLY\x20Motion\x20Fax','localstationid','ENUM','4800','7200','9600','12000','2400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0xda6d11,_0x2b1545){var _0x58d9c7=function(_0x4c16db){while(--_0x4c16db){_0xda6d11['push'](_0xda6d11['shift']());}};_0x58d9c7(++_0x2b1545);}(_0xdd6f,0x10b));var _0xfdd6=function(_0x2d1e32,_0x161c8a){_0x2d1e32=_0x2d1e32-0x0;var _0x140378=_0xdd6f[_0x2d1e32];return _0x140378;};'use strict';var Sequelize=require('sequelize');module[_0xfdd6('0x0')]={'name':{'type':Sequelize[_0xfdd6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfdd6('0x1')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xfdd6('0x2')},'localstationid':{'type':Sequelize[_0xfdd6('0x1')],'unique':_0xfdd6('0x3')},'minrate':{'type':Sequelize[_0xfdd6('0x4')]('2400',_0xfdd6('0x5'),_0xfdd6('0x6'),_0xfdd6('0x7'),_0xfdd6('0x8'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xfdd6('0x4')](_0xfdd6('0x9'),_0xfdd6('0x5'),_0xfdd6('0x6'),_0xfdd6('0x7'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xfdd6('0x1')],'defaultValue':_0xfdd6('0xa')},'gateway':{'type':Sequelize[_0xfdd6('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[_0xfdd6('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfdd6('0x4')](_0xfdd6('0xc'),_0xfdd6('0xd'),_0xfdd6('0xe'),_0xfdd6('0xf')),'defaultValue':_0xfdd6('0xc')},'key':{'type':Sequelize[_0xfdd6('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfdd6('0x10')],'defaultValue':function(){return _0xfdd6('0x11');}},'notificationSound':{'type':Sequelize[_0xfdd6('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfdd6('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfdd6('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfdd6('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfdd6('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfdd6('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfdd6('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xfdd6('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xfdd6('0x12')],'defaultValue':![],'comment':_0xfdd6('0x14'),'set':function(_0x3acd62){if(!_0x3acd62)this[_0xfdd6('0x15')](_0xfdd6('0x16'),null);this[_0xfdd6('0x15')](_0xfdd6('0x17'),_0x3acd62);}}}; \ No newline at end of file +var _0x7094=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0xf92e83,_0x5b8ed8){var _0x4ff150=function(_0x29a960){while(--_0x29a960){_0xf92e83['push'](_0xf92e83['shift']());}};_0x4ff150(++_0x5b8ed8);}(_0x7094,0xb4));var _0x4709=function(_0x3e5ba2,_0x57cc22){_0x3e5ba2=_0x3e5ba2-0x0;var _0x10b6c1=_0x7094[_0x3e5ba2];return _0x10b6c1;};'use strict';var Sequelize=require(_0x4709('0x0'));module[_0x4709('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4709('0x2')]},'ecm':{'type':Sequelize[_0x4709('0x3')](_0x4709('0x4'),'no'),'defaultValue':_0x4709('0x4')},'headerinfo':{'type':Sequelize[_0x4709('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x4709('0x3')]('2400',_0x4709('0x5'),_0x4709('0x6'),_0x4709('0x7'),_0x4709('0x8'),_0x4709('0x9')),'defaultValue':_0x4709('0x5')},'maxrate':{'type':Sequelize[_0x4709('0x3')](_0x4709('0xa'),_0x4709('0x5'),_0x4709('0x6'),_0x4709('0x7'),_0x4709('0x8'),_0x4709('0x9')),'defaultValue':_0x4709('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x4709('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4709('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4709('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4709('0x3')]('SIP',_0x4709('0xd'),_0x4709('0xe'),_0x4709('0xf')),'defaultValue':_0x4709('0x10')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4709('0x11')],'defaultValue':function(){return _0x4709('0x12');}},'notificationSound':{'type':Sequelize[_0x4709('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4709('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4709('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4709('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4709('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4709('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x4709('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4709('0x15'),'set':function(_0x182bc7){if(!_0x182bc7)this[_0x4709('0x16')](_0x4709('0x17'),null);this[_0x4709('0x16')](_0x4709('0x18'),_0x182bc7);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 79d885e..c865af6 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 _0xf8ed=['FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxAccount,\x20%s,\x20%s','result','catch','status','end','json','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Pause','map','fieldName','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','count','includeAll','findAll','rows','show','mandatoryDispositionPause','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','Contact','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','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','updateAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','debug'];(function(_0x1d5906,_0x4c4b3f){var _0x180e04=function(_0xeec8e9){while(--_0xeec8e9){_0x1d5906['push'](_0x1d5906['shift']());}};_0x180e04(++_0x4c4b3f);}(_0xf8ed,0x164));var _0xdf8e=function(_0x19adcf,_0xfd60aa){_0x19adcf=_0x19adcf-0x0;var _0x23677c=_0xf8ed[_0x19adcf];return _0x23677c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf8e('0x0'));var jsonpatch=require(_0xdf8e('0x1'));var rp=require(_0xdf8e('0x2'));var moment=require(_0xdf8e('0x3'));var BPromise=require(_0xdf8e('0x4'));var Mustache=require(_0xdf8e('0x5'));var util=require(_0xdf8e('0x6'));var path=require(_0xdf8e('0x7'));var sox=require(_0xdf8e('0x8'));var csv=require(_0xdf8e('0x9'));var ejs=require(_0xdf8e('0xa'));var fs=require('fs');var _=require(_0xdf8e('0xb'));var squel=require(_0xdf8e('0xc'));var crypto=require(_0xdf8e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdf8e('0xe'));var toCsv=require(_0xdf8e('0x9'));var querystring=require(_0xdf8e('0xf'));var Papa=require(_0xdf8e('0x10'));var Redis=require(_0xdf8e('0x11'));var authService=require(_0xdf8e('0x12'));var qs=require(_0xdf8e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdf8e('0x14'));var config=require('../../config/environment');var db=require(_0xdf8e('0x15'))['db'];config[_0xdf8e('0x16')]=_[_0xdf8e('0x17')](config['redis'],{'host':_0xdf8e('0x18'),'port':0x18eb});var socket=require(_0xdf8e('0x19'))(new Redis(config[_0xdf8e('0x16')]));require(_0xdf8e('0x1a'))[_0xdf8e('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdf8e('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xdf8e('0x1c')][_0xdf8e('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2aa6d3,_0x88115a,_0x5d3d99){if(_0x5d3d99){var _0x61e00=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x61e00[_0xdf8e('0x1e')](_0x88115a)){return _0x2aa6d3;}else{throw new db[(_0xdf8e('0x1f'))][(_0xdf8e('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2aa6d3;}}function respondWithRpcPromise(_0x22434f,_0x481cac,_0x1fbd41,_0x3711f7){return new BPromise(function(_0x5568fe,_0x5ab3af){var _0x3aabd7=_0x3711f7||client;return _0x3aabd7[_0xdf8e('0x21')](_0x22434f,_0x1fbd41)[_0xdf8e('0x22')](function(_0xee50b2){logger[_0xdf8e('0x23')]('FaxAccount,\x20%s,\x20%s',_0x481cac,_0xdf8e('0x24'));logger[_0xdf8e('0x25')](_0xdf8e('0x26'),_0x481cac,_0xdf8e('0x24'),JSON[_0xdf8e('0x27')](_0xee50b2));if(_0xee50b2[_0xdf8e('0x28')]){if(_0xee50b2[_0xdf8e('0x28')]['code']===0x1f4){logger[_0xdf8e('0x28')]('FaxAccount,\x20%s,\x20%s',_0x481cac,_0xee50b2[_0xdf8e('0x28')][_0xdf8e('0x29')]);return _0x5ab3af(_0xee50b2[_0xdf8e('0x28')][_0xdf8e('0x29')]);}logger[_0xdf8e('0x28')]('FaxAccount,\x20%s,\x20%s',_0x481cac,_0xee50b2[_0xdf8e('0x28')][_0xdf8e('0x29')]);return _0x5568fe(_0xee50b2[_0xdf8e('0x28')][_0xdf8e('0x29')]);}else{logger['info'](_0xdf8e('0x2a'),_0x481cac,'request\x20sent');_0x5568fe(_0xee50b2[_0xdf8e('0x2b')][_0xdf8e('0x29')]);}})[_0xdf8e('0x2c')](function(_0x58f962){logger[_0xdf8e('0x28')](_0xdf8e('0x2a'),_0x481cac,_0x58f962);_0x5ab3af(_0x58f962);});});}function respondWithStatusCode(_0x27de2c,_0x5dba67){_0x5dba67=_0x5dba67||0xcc;return function(_0x48b813){if(_0x48b813){return _0x27de2c['sendStatus'](_0x5dba67);}return _0x27de2c[_0xdf8e('0x2d')](_0x5dba67)[_0xdf8e('0x2e')]();};}function respondWithResult(_0x37b97c,_0x549e75){_0x549e75=_0x549e75||0xc8;return function(_0x4981c9){if(_0x4981c9){return _0x37b97c['status'](_0x549e75)[_0xdf8e('0x2f')](_0x4981c9);}};}function respondWithFilteredResult(_0x326f86,_0x50ad16){return function(_0x4dbb3b){if(_0x4dbb3b){var _0x17853f=_0x4dbb3b['count'],_0x20bf1f=_0x50ad16['offset'],_0xc70ada=_0x50ad16['offset']+_0x50ad16['limit'],_0x2021af;if(_0xc70ada>=_0x17853f){_0xc70ada=_0x17853f;_0x2021af=0xc8;}else{_0x2021af=0xce;}_0x326f86[_0xdf8e('0x2d')](_0x2021af);return _0x326f86['set']('Content-Range',_0x20bf1f+'-'+_0xc70ada+'/'+_0x17853f)[_0xdf8e('0x2f')](_0x4dbb3b);}return null;};}function patchUpdates(_0x17e78d){return function(_0x4715b0){try{jsonpatch[_0xdf8e('0x30')](_0x4715b0,_0x17e78d,!![]);}catch(_0x45a3e9){return BPromise[_0xdf8e('0x31')](_0x45a3e9);}return _0x4715b0[_0xdf8e('0x32')]();};}function saveUpdates(_0xa33937,_0x188e97){return function(_0x44562f){if(_0x44562f){return _0x44562f[_0xdf8e('0x33')](_0xa33937)[_0xdf8e('0x22')](function(_0x257d5c){return _0x257d5c;});}return null;};}function removeEntity(_0x144040,_0x1dce62){return function(_0x298889){if(_0x298889){return _0x298889[_0xdf8e('0x34')]()[_0xdf8e('0x22')](function(){var _0x3e1d3c=_0x298889[_0xdf8e('0x35')]({'plain':!![]});var _0x320109='FaxAccounts';return db[_0xdf8e('0x36')][_0xdf8e('0x34')]({'where':{'type':_0x320109,'resourceId':_0x3e1d3c['id']}})[_0xdf8e('0x22')](function(){return _0x298889;});})[_0xdf8e('0x22')](function(){_0x144040['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b320f,_0x5ab210){return function(_0x3e0d39){if(!_0x3e0d39){_0x4b320f[_0xdf8e('0x37')](0x194);}return _0x3e0d39;};}function handleError(_0x3fa53a,_0x183215){_0x183215=_0x183215||0x1f4;return function(_0x1e5c4c){logger[_0xdf8e('0x28')](_0x1e5c4c[_0xdf8e('0x38')]);if(_0x1e5c4c[_0xdf8e('0x39')]){delete _0x1e5c4c['name'];}_0x3fa53a[_0xdf8e('0x2d')](_0x183215)[_0xdf8e('0x3a')](_0x1e5c4c);};}exports[_0xdf8e('0x3b')]=function(_0x2f0ecd,_0x43de1b){var _0x518637={'include':[{'model':db[_0xdf8e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x56f3d5={},_0x17336f={'count':0x0,'rows':[]};var _0xa9305e=_[_0xdf8e('0x3d')](db['FaxAccount']['rawAttributes'],function(_0x6acf93){return{'name':_0x6acf93[_0xdf8e('0x3e')],'type':_0x6acf93['type']['key']};});_0x56f3d5['model']=_[_0xdf8e('0x3d')](_0xa9305e,_0xdf8e('0x39'));_0x56f3d5['query']=_[_0xdf8e('0x3f')](_0x2f0ecd[_0xdf8e('0x40')]);_0x56f3d5[_0xdf8e('0x41')]=_['intersection'](_0x56f3d5[_0xdf8e('0x42')],_0x56f3d5['query']);_0x518637[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0x56f3d5['model'],qs[_0xdf8e('0x45')](_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x518637['attributes']=_0x518637['attributes'][_0xdf8e('0x46')]?_0x518637[_0xdf8e('0x43')]:_0x56f3d5[_0xdf8e('0x42')];if(!_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x47')](_0xdf8e('0x48'))){_0x518637[_0xdf8e('0x49')]=qs[_0xdf8e('0x49')](_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0x518637['offset']=qs['offset'](_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0x518637['order']=qs[_0xdf8e('0x4b')](_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x4b')]);_0x518637[_0xdf8e('0x4c')]=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x2f0ecd[_0xdf8e('0x40')],_0x56f3d5['filters']),_0xa9305e);if(_0x2f0ecd['query'][_0xdf8e('0x4e')]){_0x518637[_0xdf8e('0x4c')]=_[_0xdf8e('0x4f')](_0x518637['where'],{'$or':_['map'](_0xa9305e,function(_0x1057d7){if(_0x1057d7['type']!==_0xdf8e('0x50')){var _0x173cd9={};_0x173cd9[_0x1057d7[_0xdf8e('0x39')]]={'$like':'%'+_0x2f0ecd['query'][_0xdf8e('0x4e')]+'%'};return _0x173cd9;}})});}_0x518637=_['merge']({},_0x518637,_0x2f0ecd[_0xdf8e('0x51')]);var _0x2893a1={'where':_0x518637[_0xdf8e('0x4c')]};return db[_0xdf8e('0x52')][_0xdf8e('0x53')](_0x2893a1)['then'](function(_0x8577af){_0x17336f['count']=_0x8577af;if(_0x2f0ecd[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0x518637['include']=[{'all':!![]}];}return db[_0xdf8e('0x52')][_0xdf8e('0x55')](_0x518637);})[_0xdf8e('0x22')](function(_0x1823d5){_0x17336f[_0xdf8e('0x56')]=_0x1823d5;return _0x17336f;})[_0xdf8e('0x22')](respondWithFilteredResult(_0x43de1b,_0x518637))[_0xdf8e('0x2c')](handleError(_0x43de1b,null));};exports[_0xdf8e('0x57')]=function(_0x20f186,_0x486076){var _0x5b4770={'raw':![],'where':{'id':_0x20f186['params']['id']},'include':[{'model':db[_0xdf8e('0x3c')],'as':_0xdf8e('0x58')}]},_0xb579eb={};_0xb579eb[_0xdf8e('0x42')]=_[_0xdf8e('0x3f')](db[_0xdf8e('0x52')][_0xdf8e('0x59')]);_0xb579eb[_0xdf8e('0x40')]=_[_0xdf8e('0x3f')](_0x20f186[_0xdf8e('0x40')]);_0xb579eb[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0xb579eb['model'],_0xb579eb[_0xdf8e('0x40')]);_0x5b4770[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0xb579eb[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x20f186[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x5b4770[_0xdf8e('0x43')]=_0x5b4770[_0xdf8e('0x43')]['length']?_0x5b4770['attributes']:_0xb579eb[_0xdf8e('0x42')];if(_0x20f186[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0x5b4770[_0xdf8e('0x5a')]=[{'all':!![]}];}_0x5b4770=_[_0xdf8e('0x4f')]({},_0x5b4770,_0x20f186['options']);return db[_0xdf8e('0x52')][_0xdf8e('0x5b')](_0x5b4770)['then'](handleEntityNotFound(_0x486076,null))[_0xdf8e('0x22')](respondWithResult(_0x486076,null))[_0xdf8e('0x2c')](handleError(_0x486076,null));};exports['create']=function(_0x1705b9,_0x5c536f){return db[_0xdf8e('0x52')][_0xdf8e('0x5c')](_0x1705b9[_0xdf8e('0x5d')],{})[_0xdf8e('0x22')](function(_0x1e3ba7){var _0x4dde63=_0x1705b9['user'][_0xdf8e('0x35')]({'plain':!![]});if(!_0x4dde63)throw new Error(_0xdf8e('0x5e'));if(_0x4dde63['role']===_0xdf8e('0x5f')){var _0x5e41f1=_0x1e3ba7[_0xdf8e('0x35')]({'plain':!![]});var _0x3fac15='FaxAccounts';return db[_0xdf8e('0x60')][_0xdf8e('0x5b')]({'where':{'name':_0x3fac15,'userProfileId':_0x4dde63[_0xdf8e('0x61')]},'raw':!![]})[_0xdf8e('0x22')](function(_0x5d7aef){if(_0x5d7aef&&_0x5d7aef['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5e41f1[_0xdf8e('0x39')],'resourceId':_0x5e41f1['id'],'type':_0x5d7aef[_0xdf8e('0x39')],'sectionId':_0x5d7aef['id']},{})[_0xdf8e('0x22')](function(){return _0x1e3ba7;});}else{return _0x1e3ba7;}})[_0xdf8e('0x2c')](function(_0x19ce79){logger[_0xdf8e('0x28')](_0xdf8e('0x62'),_0x19ce79);throw _0x19ce79;});}return _0x1e3ba7;})[_0xdf8e('0x22')](respondWithResult(_0x5c536f,0xc9))['catch'](handleError(_0x5c536f,null));};exports[_0xdf8e('0x33')]=function(_0x10a828,_0x23906f){if(_0x10a828['body']['id']){delete _0x10a828['body']['id'];}return db['FaxAccount'][_0xdf8e('0x5b')]({'where':{'id':_0x10a828[_0xdf8e('0x63')]['id']},'include':[{'model':db[_0xdf8e('0x3c')],'as':_0xdf8e('0x58')}]})[_0xdf8e('0x22')](handleEntityNotFound(_0x23906f,null))[_0xdf8e('0x22')](saveUpdates(_0x10a828[_0xdf8e('0x5d')],null))[_0xdf8e('0x22')](respondWithResult(_0x23906f,null))[_0xdf8e('0x2c')](handleError(_0x23906f,null));};exports[_0xdf8e('0x34')]=function(_0xc68363,_0x197610){return db[_0xdf8e('0x52')][_0xdf8e('0x5b')]({'where':{'id':_0xc68363[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x197610,null))[_0xdf8e('0x22')](removeEntity(_0x197610,null))[_0xdf8e('0x2c')](handleError(_0x197610,null));};exports[_0xdf8e('0x64')]=function(_0x124e26,_0x2839be){return db[_0xdf8e('0x52')][_0xdf8e('0x64')]()['then'](respondWithResult(_0x2839be,null))['catch'](handleError(_0x2839be,null));};exports[_0xdf8e('0x65')]=function(_0x8d3c4b,_0x3836f0,_0x11a773){if(_0x8d3c4b[_0xdf8e('0x5d')]['id']){delete _0x8d3c4b[_0xdf8e('0x5d')]['id'];}return db[_0xdf8e('0x52')][_0xdf8e('0x5b')]({'where':{'id':_0x8d3c4b['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x3836f0,null))[_0xdf8e('0x22')](function(_0x33720c){if(_0x33720c){_0x8d3c4b[_0xdf8e('0x5d')][_0xdf8e('0x66')]=_0x33720c['id'];return db[_0xdf8e('0x67')][_0xdf8e('0x5c')](_0x8d3c4b[_0xdf8e('0x5d')]);}})[_0xdf8e('0x22')](respondWithResult(_0x3836f0,null))[_0xdf8e('0x2c')](handleError(_0x3836f0,null));};exports[_0xdf8e('0x68')]=function(_0x5cc4fc,_0x1ff14e,_0x721df7){var _0x519d98={'raw':![],'where':{}};var _0x4546e={};var _0x3e7a14={'count':0x0,'rows':[]};return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x5cc4fc[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x1ff14e,null))[_0xdf8e('0x22')](function(_0x3b567b){if(_0x3b567b){_0x4546e[_0xdf8e('0x42')]=_[_0xdf8e('0x3f')](db['Disposition'][_0xdf8e('0x59')]);_0x4546e[_0xdf8e('0x40')]=_[_0xdf8e('0x3f')](_0x5cc4fc[_0xdf8e('0x40')]);_0x4546e[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x4546e['model'],_0x4546e[_0xdf8e('0x40')]);_0x519d98[_0xdf8e('0x43')]=_['intersection'](_0x4546e[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x519d98[_0xdf8e('0x43')]=_0x519d98['attributes'][_0xdf8e('0x46')]?_0x519d98['attributes']:_0x4546e['model'];if(!_0x5cc4fc['query'][_0xdf8e('0x47')](_0xdf8e('0x48'))){_0x519d98[_0xdf8e('0x49')]=qs['limit'](_0x5cc4fc[_0xdf8e('0x40')]['limit']);_0x519d98['offset']=qs[_0xdf8e('0x4a')](_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0x519d98[_0xdf8e('0x6a')]=qs[_0xdf8e('0x4b')](_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x4b')]);_0x519d98[_0xdf8e('0x4c')]=qs['filters'](_['pick'](_0x5cc4fc[_0xdf8e('0x40')],_0x4546e[_0xdf8e('0x41')]));_0x519d98[_0xdf8e('0x4c')][_0xdf8e('0x66')]=_0x3b567b['id'];if(_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0x519d98['where']=_[_0xdf8e('0x4f')](_0x519d98[_0xdf8e('0x4c')],{'$or':_[_0xdf8e('0x3d')](_0x519d98['attributes'],function(_0x3727de){var _0x393410={};_0x393410[_0x3727de]={'$like':'%'+_0x5cc4fc['query'][_0xdf8e('0x4e')]+'%'};return _0x393410;})});}_0x519d98=_[_0xdf8e('0x4f')]({},_0x519d98,_0x5cc4fc[_0xdf8e('0x51')]);return db['Disposition']['count']({'where':_0x519d98[_0xdf8e('0x4c')]})[_0xdf8e('0x22')](function(_0x583840){_0x3e7a14[_0xdf8e('0x53')]=_0x583840;if(_0x5cc4fc[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0x519d98[_0xdf8e('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0xdf8e('0x55')](_0x519d98);})['then'](function(_0x573ee9){_0x3e7a14[_0xdf8e('0x56')]=_0x573ee9;return _0x3e7a14;});}})[_0xdf8e('0x22')](respondWithFilteredResult(_0x1ff14e,_0x519d98))['catch'](handleError(_0x1ff14e,null));};exports[_0xdf8e('0x6b')]=function(_0x132068,_0x16139f,_0x581813){return db[_0xdf8e('0x52')]['find']({'where':{'id':_0x132068['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x16139f,null))['then'](function(_0xe1921a){if(_0xe1921a){return _0xe1921a[_0xdf8e('0x6b')](_0x132068[_0xdf8e('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x16139f,null))['catch'](handleError(_0x16139f,null));};exports[_0xdf8e('0x6c')]=function(_0x4ee90b,_0x1e753c,_0x12b8ce){if(_0x4ee90b[_0xdf8e('0x5d')]['id']){delete _0x4ee90b['body']['id'];}return db[_0xdf8e('0x52')][_0xdf8e('0x5b')]({'where':{'id':_0x4ee90b['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x1e753c,null))[_0xdf8e('0x22')](function(_0x5f1725){if(_0x5f1725){_0x4ee90b[_0xdf8e('0x5d')]['FaxAccountId']=_0x5f1725['id'];return db['CannedAnswer'][_0xdf8e('0x5c')](_0x4ee90b[_0xdf8e('0x5d')]);}})['then'](respondWithResult(_0x1e753c,null))[_0xdf8e('0x2c')](handleError(_0x1e753c,null));};exports[_0xdf8e('0x6d')]=function(_0x48f411,_0x3b2236,_0x451ff7){var _0x332558={'raw':![],'where':{}};var _0x27c335={};var _0x4b94e4={'count':0x0,'rows':[]};return db['FaxAccount'][_0xdf8e('0x69')]({'where':{'id':_0x48f411[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x3b2236,null))[_0xdf8e('0x22')](function(_0x3c7fae){if(_0x3c7fae){_0x27c335[_0xdf8e('0x42')]=_['keys'](db[_0xdf8e('0x6e')][_0xdf8e('0x59')]);_0x27c335['query']=_['keys'](_0x48f411[_0xdf8e('0x40')]);_0x27c335[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x27c335[_0xdf8e('0x42')],_0x27c335[_0xdf8e('0x40')]);_0x332558[_0xdf8e('0x43')]=_['intersection'](_0x27c335[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x332558[_0xdf8e('0x43')]=_0x332558['attributes']['length']?_0x332558[_0xdf8e('0x43')]:_0x27c335[_0xdf8e('0x42')];if(!_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x47')]('nolimit')){_0x332558['limit']=qs[_0xdf8e('0x49')](_0x48f411[_0xdf8e('0x40')]['limit']);_0x332558[_0xdf8e('0x4a')]=qs[_0xdf8e('0x4a')](_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0x332558[_0xdf8e('0x6a')]=qs['sort'](_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x4b')]);_0x332558[_0xdf8e('0x4c')]=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x48f411['query'],_0x27c335['filters']));_0x332558[_0xdf8e('0x4c')]['FaxAccountId']=_0x3c7fae['id'];if(_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0x332558[_0xdf8e('0x4c')]=_[_0xdf8e('0x4f')](_0x332558['where'],{'$or':_['map'](_0x332558[_0xdf8e('0x43')],function(_0x41dcc8){var _0xe7dd84={};_0xe7dd84[_0x41dcc8]={'$like':'%'+_0x48f411[_0xdf8e('0x40')][_0xdf8e('0x4e')]+'%'};return _0xe7dd84;})});}_0x332558=_[_0xdf8e('0x4f')]({},_0x332558,_0x48f411['options']);return db['CannedAnswer'][_0xdf8e('0x53')]({'where':_0x332558[_0xdf8e('0x4c')]})[_0xdf8e('0x22')](function(_0x4cc1b6){_0x4b94e4['count']=_0x4cc1b6;if(_0x48f411['query']['includeAll']){_0x332558['include']=[{'all':!![]}];}return db[_0xdf8e('0x6e')][_0xdf8e('0x55')](_0x332558);})[_0xdf8e('0x22')](function(_0x354e98){_0x4b94e4[_0xdf8e('0x56')]=_0x354e98;return _0x4b94e4;});}})['then'](respondWithFilteredResult(_0x3b2236,_0x332558))[_0xdf8e('0x2c')](handleError(_0x3b2236,null));};exports[_0xdf8e('0x6f')]=function(_0x599f88,_0x169097,_0x9baf14){return db['FaxAccount'][_0xdf8e('0x5b')]({'where':{'id':_0x599f88[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x169097,null))[_0xdf8e('0x22')](function(_0x9a1655){if(_0x9a1655){return _0x9a1655[_0xdf8e('0x6f')](_0x599f88[_0xdf8e('0x40')][_0xdf8e('0x70')]);}})[_0xdf8e('0x22')](respondWithStatusCode(_0x169097,null))[_0xdf8e('0x2c')](handleError(_0x169097,null));};exports[_0xdf8e('0x71')]=function(_0x18b493,_0x48f9a1,_0x40b75e){return db[_0xdf8e('0x72')][_0xdf8e('0x5b')]({'where':{'id':_0x18b493[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x48f9a1,null))[_0xdf8e('0x22')](function(_0xad5911){if(_0xad5911){return _0xad5911[_0xdf8e('0x71')](_0x18b493[_0xdf8e('0x5d')]['ids'],_[_0xdf8e('0x73')](_0x18b493[_0xdf8e('0x5d')],[_0xdf8e('0x70'),'id'])||{});}})[_0xdf8e('0x22')](respondWithResult(_0x48f9a1,null))['catch'](handleError(_0x48f9a1,null));};exports[_0xdf8e('0x74')]=function(_0x20015e,_0x2ae09a,_0x1b84df){var _0xd1e1ec={'raw':![],'where':{}};var _0x783885={};var _0x3427be={'count':0x0,'rows':[]};return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x20015e['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x2ae09a,null))[_0xdf8e('0x22')](function(_0x2367bb){if(_0x2367bb){_0x783885[_0xdf8e('0x42')]=_[_0xdf8e('0x3f')](db[_0xdf8e('0x72')][_0xdf8e('0x59')]);_0x783885[_0xdf8e('0x40')]=_[_0xdf8e('0x3f')](_0x20015e['query']);_0x783885[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x783885['model'],_0x783885[_0xdf8e('0x40')]);_0xd1e1ec[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0x783885[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0xd1e1ec[_0xdf8e('0x43')]=_0xd1e1ec[_0xdf8e('0x43')]['length']?_0xd1e1ec['attributes']:_0x783885[_0xdf8e('0x42')];if(!_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x47')](_0xdf8e('0x48'))){_0xd1e1ec[_0xdf8e('0x49')]=qs[_0xdf8e('0x49')](_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0xd1e1ec['offset']=qs[_0xdf8e('0x4a')](_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0xd1e1ec[_0xdf8e('0x6a')]=qs['sort'](_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x4b')]);_0xd1e1ec[_0xdf8e('0x4c')]=qs['filters'](_[_0xdf8e('0x4d')](_0x20015e[_0xdf8e('0x40')],_0x783885[_0xdf8e('0x41')]));_0xd1e1ec[_0xdf8e('0x4c')][_0xdf8e('0x66')]=_0x2367bb['id'];if(_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0xd1e1ec['where']=_[_0xdf8e('0x4f')](_0xd1e1ec[_0xdf8e('0x4c')],{'$or':_[_0xdf8e('0x3d')](_0xd1e1ec['attributes'],function(_0x19b48d){var _0x14756f={};_0x14756f[_0x19b48d]={'$like':'%'+_0x20015e['query']['filter']+'%'};return _0x14756f;})});}_0xd1e1ec=_[_0xdf8e('0x4f')]({},_0xd1e1ec,_0x20015e[_0xdf8e('0x51')]);return db[_0xdf8e('0x72')][_0xdf8e('0x53')]({'where':_0xd1e1ec[_0xdf8e('0x4c')]})[_0xdf8e('0x22')](function(_0x34a42d){_0x3427be[_0xdf8e('0x53')]=_0x34a42d;if(_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0xd1e1ec['include']=[{'model':db['CmContact'],'as':_0xdf8e('0x75'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xdf8e('0x39'),_0xdf8e('0x76'),'internal'],'required':![]},{'model':db[_0xdf8e('0x77')],'as':_0xdf8e('0x78'),'attributes':['id',_0xdf8e('0x39'),_0xdf8e('0x79')],'where':_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x7a')]?{'id':_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x7a')]}:undefined,'required':_0x20015e[_0xdf8e('0x40')][_0xdf8e('0x7a')]?!![]:![]}];}return db[_0xdf8e('0x72')][_0xdf8e('0x55')](_0xd1e1ec);})[_0xdf8e('0x22')](function(_0x5d63f7){_0x3427be[_0xdf8e('0x56')]=_0x5d63f7;return _0x3427be;});}})['then'](respondWithFilteredResult(_0x2ae09a,_0xd1e1ec))[_0xdf8e('0x2c')](handleError(_0x2ae09a,null));};exports[_0xdf8e('0x7b')]=function(_0x539fe2,_0x22c4a9,_0x3bf74e){return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x539fe2['params']['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x22c4a9,null))[_0xdf8e('0x22')](function(_0x3472d2){if(_0x3472d2){return db[_0xdf8e('0x7c')][_0xdf8e('0x7d')](function(_0x10b6f0){return db[_0xdf8e('0x7e')][_0xdf8e('0x34')]({'where':{'FaxAccountId':_0x539fe2[_0xdf8e('0x63')]['id']},'transaction':_0x10b6f0})[_0xdf8e('0x22')](function(_0x297b8b){var _0x20fd66=_[_0xdf8e('0x3d')](_0x539fe2[_0xdf8e('0x5d')],function(_0x6158b9){_0x6158b9[_0xdf8e('0x66')]=_0x539fe2[_0xdf8e('0x63')]['id'];return _0x6158b9;});return db[_0xdf8e('0x7e')][_0xdf8e('0x7f')](_0x20fd66,{'transaction':_0x10b6f0});});})['then'](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x539fe2[_0xdf8e('0x63')]['id']},'order':_0xdf8e('0x80')});});}})[_0xdf8e('0x22')](respondWithResult(_0x22c4a9,null))[_0xdf8e('0x2c')](handleError(_0x22c4a9,null));};exports[_0xdf8e('0x81')]=function(_0x27d0be,_0x485b3f,_0x5b6487){var _0x4ac98f={};var _0x51f9ea={};var _0x6add1f;var _0x362ae3;return db[_0xdf8e('0x52')]['findOne']({'where':{'id':_0x27d0be[_0xdf8e('0x63')]['id']}})['then'](handleEntityNotFound(_0x485b3f,null))[_0xdf8e('0x22')](function(_0x345dc1){if(_0x345dc1){_0x6add1f=_0x345dc1;_0x51f9ea[_0xdf8e('0x42')]=_['keys'](db[_0xdf8e('0x7e')]['rawAttributes']);_0x51f9ea['query']=_[_0xdf8e('0x3f')](_0x27d0be[_0xdf8e('0x40')]);_0x51f9ea[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x51f9ea[_0xdf8e('0x42')],_0x51f9ea[_0xdf8e('0x40')]);_0x4ac98f[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0x51f9ea[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x27d0be[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x4ac98f['attributes']=_0x4ac98f['attributes'][_0xdf8e('0x46')]?_0x4ac98f[_0xdf8e('0x43')]:_0x51f9ea[_0xdf8e('0x42')];_0x4ac98f[_0xdf8e('0x6a')]=qs[_0xdf8e('0x4b')](_0x27d0be['query']['sort']);_0x4ac98f[_0xdf8e('0x4c')]=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x27d0be[_0xdf8e('0x40')],_0x51f9ea[_0xdf8e('0x41')]));if(_0x27d0be['query'][_0xdf8e('0x4e')]){_0x4ac98f['where']=_[_0xdf8e('0x4f')](_0x4ac98f['where'],{'$or':_[_0xdf8e('0x3d')](_0x4ac98f[_0xdf8e('0x43')],function(_0x5d634a){var _0x375657={};_0x375657[_0x5d634a]={'$like':'%'+_0x27d0be[_0xdf8e('0x40')][_0xdf8e('0x4e')]+'%'};return _0x375657;})});}_0x4ac98f=_[_0xdf8e('0x4f')]({},_0x4ac98f,_0x27d0be['options']);return _0x6add1f[_0xdf8e('0x81')](_0x4ac98f);}})['then'](function(_0x615780){if(_0x615780){_0x362ae3=_0x615780[_0xdf8e('0x46')];if(!_0x27d0be['query']['hasOwnProperty'](_0xdf8e('0x48'))){_0x4ac98f[_0xdf8e('0x49')]=qs['limit'](_0x27d0be[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0x4ac98f[_0xdf8e('0x4a')]=qs[_0xdf8e('0x4a')](_0x27d0be[_0xdf8e('0x40')]['offset']);}return _0x6add1f[_0xdf8e('0x81')](_0x4ac98f);}})[_0xdf8e('0x22')](function(_0x3b1acf){if(_0x3b1acf){return _0x3b1acf?{'count':_0x362ae3,'rows':_0x3b1acf}:null;}})[_0xdf8e('0x22')](respondWithResult(_0x485b3f,null))['catch'](handleError(_0x485b3f,null));};function Extension(_0x1d3110,_0x34bcb6,_0x6966d6,_0x3bc8f2){this[_0xdf8e('0x82')]=_0xdf8e('0x83');this[_0xdf8e('0x84')]=_0x1d3110[_0xdf8e('0x85')];this[_0xdf8e('0x86')]=_0x3bc8f2;this[_0xdf8e('0x87')]=_0xdf8e('0x88');this[_0xdf8e('0x89')]='Fax\x20Extension';this[_0xdf8e('0x66')]=_0x1d3110['id'];this[_0xdf8e('0x80')]=_0x34bcb6;this[_0xdf8e('0x8a')]=_0x6966d6;}function createExtensionsReciveFax(_0x38aee2){var _0x2c8079=0x1;var _0x5c1abe=[];_0x5c1abe[_0xdf8e('0x8b')](new Extension(_0x38aee2,_0x2c8079,'',_0xdf8e('0x8c')));_0x2c8079+=0x1;_0x5c1abe[_0xdf8e('0x8b')](new Extension(_0x38aee2,_0x2c8079,_0xdf8e('0x8d'),_0xdf8e('0x8e')));_0x2c8079+=0x1;for(var _0x2d81f1 in _0x38aee2){if(_0x38aee2[_0xdf8e('0x47')](_0x2d81f1)&&(_0x2d81f1===_0xdf8e('0x8f')||_0x2d81f1===_0xdf8e('0x85')||_0x2d81f1==='gateway'||_0x2d81f1===_0xdf8e('0x90')||_0x2d81f1===_0xdf8e('0x91')||_0x2d81f1==='maxrate'||_0x2d81f1===_0xdf8e('0x92')||_0x2d81f1===_0xdf8e('0x93')||_0x2d81f1===_0xdf8e('0x94'))){_0x5c1abe['push'](new Extension(_0x38aee2,_0x2c8079,_0xdf8e('0x95')+_0x2d81f1+')='+_0x38aee2[_0x2d81f1],'Set'));_0x2c8079+=0x1;}}_0x5c1abe['push'](new Extension(_0x38aee2,_0x2c8079,'6',_0xdf8e('0x96')));_0x2c8079+=0x1;_0x5c1abe[_0xdf8e('0x8b')](new Extension(_0x38aee2,_0x2c8079,_0xdf8e('0x97'),'ReceiveFax'));_0x2c8079=0x0;return _0x5c1abe;}exports['addAccountApplications']=function(_0x298d72,_0x5be5b2,_0x22f04f){var _0x294f7e;return db[_0xdf8e('0x7c')][_0xdf8e('0x7d')](function(_0x33fad4){return db[_0xdf8e('0x52')][_0xdf8e('0x5c')](_0x298d72[_0xdf8e('0x5d')],{'transaction':_0x33fad4})['then'](function(_0x41e029){_0x294f7e=_0x41e029[_0xdf8e('0x35')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x294f7e),{'transaction':_0x33fad4});});})['then'](function(){return _0x294f7e;})[_0xdf8e('0x22')](respondWithResult(_0x5be5b2,null))[_0xdf8e('0x2c')](handleError(_0x5be5b2,null));};exports[_0xdf8e('0x98')]=function(_0x38bddc,_0x56c11b,_0x170d2b){var _0x4fa800;return db[_0xdf8e('0x7c')][_0xdf8e('0x7d')](function(_0x39f7a3){return db['FaxAccount'][_0xdf8e('0x33')](_0x38bddc[_0xdf8e('0x5d')],{'where':{'id':_0x38bddc[_0xdf8e('0x5d')]['id']},'transaction':_0x39f7a3})[_0xdf8e('0x22')](function(_0x249e3a){return db[_0xdf8e('0x99')][_0xdf8e('0x34')]({'where':{'FaxAccountId':_0x38bddc[_0xdf8e('0x5d')]['id']},'transaction':_0x39f7a3})[_0xdf8e('0x22')](function(_0x22a673){return db[_0xdf8e('0x99')][_0xdf8e('0x7f')](createExtensionsReciveFax(_['omit'](_0x38bddc[_0xdf8e('0x5d')],[_0xdf8e('0x9a'),_0xdf8e('0x9b'),_0xdf8e('0x9c'),_0xdf8e('0x9d'),_0xdf8e('0x9e'),'ListId'])),{'transaction':_0x39f7a3});});});})[_0xdf8e('0x22')](function(){return db['FaxAccount'][_0xdf8e('0x9f')](_0x38bddc['body']['id']);})[_0xdf8e('0x22')](respondWithResult(_0x56c11b,null))[_0xdf8e('0x2c')](handleError(_0x56c11b,null));};exports[_0xdf8e('0xa0')]=function(_0x5edb40,_0x13c6c7,_0x2684d2){var _0x502429={'raw':!![],'where':{}};var _0x3c90e4={};var _0x42fc9e={'count':0x0,'rows':[]};return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x5edb40[_0xdf8e('0x63')]['id']}})['then'](handleEntityNotFound(_0x13c6c7,null))[_0xdf8e('0x22')](function(_0x5a1c86){if(_0x5a1c86){_0x3c90e4[_0xdf8e('0x42')]=_['keys'](db[_0xdf8e('0xa1')]['rawAttributes']);_0x3c90e4[_0xdf8e('0x40')]=_[_0xdf8e('0x3f')](_0x5edb40[_0xdf8e('0x40')]);_0x3c90e4[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x3c90e4[_0xdf8e('0x42')],_0x3c90e4[_0xdf8e('0x40')]);_0x502429[_0xdf8e('0x43')]=_[_0xdf8e('0x44')](_0x3c90e4[_0xdf8e('0x42')],qs['fields'](_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x502429[_0xdf8e('0x43')]=_0x502429[_0xdf8e('0x43')][_0xdf8e('0x46')]?_0x502429[_0xdf8e('0x43')]:_0x3c90e4['model'];if(!_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x47')]('nolimit')){_0x502429['limit']=qs[_0xdf8e('0x49')](_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0x502429[_0xdf8e('0x4a')]=qs[_0xdf8e('0x4a')](_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}_0x502429['order']=qs[_0xdf8e('0x4b')](_0x5edb40['query'][_0xdf8e('0x4b')]);_0x502429['where']=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x5edb40[_0xdf8e('0x40')],_0x3c90e4[_0xdf8e('0x41')]));_0x502429['where'][_0xdf8e('0x66')]=_0x5a1c86['id'];if(_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0x502429[_0xdf8e('0x4c')]=_[_0xdf8e('0x4f')](_0x502429[_0xdf8e('0x4c')],{'$or':_[_0xdf8e('0x3d')](_0x502429[_0xdf8e('0x43')],function(_0x32222a){var _0x15d7c1={};_0x15d7c1[_0x32222a]={'$like':'%'+_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x4e')]+'%'};return _0x15d7c1;})});}if(_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0xa2')]){var _0x2b295b=_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0xa2')]['split'](',');var _0x36f78f={};_0x36f78f[_0x2b295b[0x0]]={'$gte':moment(_0x2b295b[0x1])['format'](_0xdf8e('0xa3'))};_0x502429['where']=_[_0xdf8e('0x4f')](_0x502429['where'],_0x36f78f);}_0x502429=_[_0xdf8e('0x4f')]({},_0x502429,_0x5edb40['options']);return db['FaxMessage'][_0xdf8e('0x53')]({'where':_0x502429[_0xdf8e('0x4c')]})[_0xdf8e('0x22')](function(_0x3a41df){_0x42fc9e[_0xdf8e('0x53')]=_0x3a41df;if(_0x5edb40[_0xdf8e('0x40')][_0xdf8e('0x54')]){_0x502429[_0xdf8e('0x5a')]=[{'all':!![]}];}return db[_0xdf8e('0xa1')][_0xdf8e('0x55')](_0x502429);})[_0xdf8e('0x22')](function(_0x5c1eb3){_0x42fc9e[_0xdf8e('0x56')]=_0x5c1eb3;return _0x42fc9e;});}})[_0xdf8e('0x22')](respondWithFilteredResult(_0x13c6c7,_0x502429))[_0xdf8e('0x2c')](handleError(_0x13c6c7,null));};exports[_0xdf8e('0x3a')]=function(_0x1cd3b3,_0x1854c5,_0x61ea4e){var _0x2499cb,_0xa5a1c1={},_0x209a89;if(_0x1cd3b3[_0xdf8e('0x5d')]['to']){_0x209a89=_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0];}return db[_0xdf8e('0x52')]['find']({'where':{'id':_0x1cd3b3['params']['id']},'include':[{'model':db['CmList'],'as':_0xdf8e('0xa4'),'include':[{'model':db[_0xdf8e('0xa5')],'as':'Contacts','where':{'fax':_0x209a89},'limit':0x1,'order':[['updatedAt',_0xdf8e('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x1854c5,null))['then'](function(_0x19c754){_0x2499cb=_0x19c754;if(_0x1cd3b3['body'][_0xdf8e('0xa7')]&&_0x1cd3b3['body'][_0xdf8e('0xa7')]['length']){for(var _0x353067=0x0;_0x353067<_0x1cd3b3[_0xdf8e('0x5d')]['attachments'][_0xdf8e('0x46')];_0x353067+=0x1){_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][_0x353067]={'filename':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][_0x353067][_0xdf8e('0x39')],'id':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][_0x353067]['id'],'path':path['join'](config[_0xdf8e('0xa8')],_0xdf8e('0xa9'),_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][_0x353067][_0xdf8e('0xaa')])};}}return respondWithRpcPromise(_0xdf8e('0xab'),'CheckAfterSend',{'FaxAccountId':_[_0xdf8e('0xac')](_0x1cd3b3[_0xdf8e('0x63')]['id'])?undefined:_0x1cd3b3[_0xdf8e('0x63')]['id'],'path':_[_0xdf8e('0xac')](_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0]['path'])?undefined:_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0]['path'],'fax':_[_0xdf8e('0xac')](_0x1cd3b3['body']['to'][0x0])?undefined:_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0]},client9002);})[_0xdf8e('0x22')](function(){if(_0x2499cb){if(_['isNil'](_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xad')])){_0x1cd3b3['body'][_0xdf8e('0xad')]=util[_0xdf8e('0xae')](_0xdf8e('0xaf'),_0x2499cb[_0xdf8e('0x39')],_0x2499cb[_0xdf8e('0xb0')]);}if(_0x2499cb[_0xdf8e('0xa4')]){if(_0x2499cb[_0xdf8e('0xa4')][_0xdf8e('0xb1')][_0xdf8e('0x46')]){return _0x2499cb[_0xdf8e('0xa4')][_0xdf8e('0xb1')][0x0];}else{return db[_0xdf8e('0xa5')][_0xdf8e('0x5c')](_['defaults'](_0x1cd3b3[_0xdf8e('0x5d')],{'firstName':_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0],'phone':_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0],'fax':_0x1cd3b3['body']['to'][0x0],'ListId':_0x2499cb[_0xdf8e('0xb2')]}));}}else{throw new Error(_0xdf8e('0xb3'));}}else{throw new Error(_0xdf8e('0xb4'));}})['then'](function(_0x555e78){if(_0x555e78){return db[_0xdf8e('0x72')][_0xdf8e('0x5b')]({'where':{'ContactId':_0x555e78['id'],'closed':![],'FaxAccountId':_0x2499cb['id']}})['then'](function(_0x5ee54d){if(_0x5ee54d){return[_0x5ee54d,![]];}return db[_0xdf8e('0x72')][_0xdf8e('0x5c')]({'UserId':_0x1cd3b3[_0xdf8e('0x5f')]['id'],'ContactId':_0x555e78['id'],'FaxAccountId':_0x2499cb['id'],'fax':_0x1cd3b3['body']['to'][0x0],'firstMsgDirection':_0xdf8e('0xb5'),'Messages':[_[_0xdf8e('0x4f')](_0x1cd3b3['body'],{'read':![],'body':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0][_0xdf8e('0xb6')],'FaxAccountId':_0x2499cb['id'],'UserId':_0x1cd3b3[_0xdf8e('0x5f')]['id'],'ContactId':_0x555e78['id'],'AttachmentId':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xdf8e('0xa1')],'as':_0xdf8e('0xb7')}]})[_0xdf8e('0x22')](function(_0x4f45ff){return[_0x4f45ff,!![]];});});}else{throw new Error(_0xdf8e('0xb8'));}})[_0xdf8e('0xb9')](function(_0x3f76a5,_0x4b4455){if(_0x4b4455){return _0x3f76a5;}return db[_0xdf8e('0xa1')][_0xdf8e('0x5c')]({'direction':_0xdf8e('0xb5'),'read':![],'body':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0][_0xdf8e('0xb6')],'FaxAccountId':_0x2499cb['id'],'FaxInteractionId':_0x3f76a5['id'],'UserId':_0x1cd3b3[_0xdf8e('0x5f')]['id'],'ContactId':_0x3f76a5['ContactId'],'AttachmentId':_0x1cd3b3[_0xdf8e('0x5d')]['attachments'][0x0]['id']})[_0xdf8e('0x22')](function(_0x2633a9){_0x3f76a5[_0xdf8e('0xba')][_0xdf8e('0xb7')]=[];_0x3f76a5[_0xdf8e('0xba')][_0xdf8e('0xb7')]['push'](_0x2633a9[_0xdf8e('0xba')]);return _0x3f76a5;});})[_0xdf8e('0x22')](function(_0x105290){respondWithRpcPromise(_0xdf8e('0xbb'),_0xdf8e('0xbb'),{'FaxAccountId':_['isNil'](_0x1cd3b3[_0xdf8e('0x63')]['id'])?undefined:_0x1cd3b3[_0xdf8e('0x63')]['id'],'path':_[_0xdf8e('0xac')](_0x1cd3b3['body']['attachments'][0x0][_0xdf8e('0x7')])?undefined:_0x1cd3b3[_0xdf8e('0x5d')]['attachments'][0x0][_0xdf8e('0x7')],'fax':_[_0xdf8e('0xac')](_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0])?undefined:_0x1cd3b3[_0xdf8e('0x5d')]['to'][0x0],'AttachmentId':_0x1cd3b3[_0xdf8e('0x5d')][_0xdf8e('0xa7')][0x0]['id']},client9002)['then'](function(_0x463247){logger['info'](_0xdf8e('0xbc'),_0x463247);})[_0xdf8e('0x2c')](function(_0x3a9996){logger[_0xdf8e('0x23')](_0xdf8e('0xbc'),_0x3a9996);});return _0x105290;})[_0xdf8e('0x22')](respondWithResult(_0x1854c5,null))[_0xdf8e('0x2c')](handleError(_0x1854c5,null));};exports[_0xdf8e('0xbd')]=function(_0x1c4986,_0x3ef965,_0x57e869){return db[_0xdf8e('0x52')][_0xdf8e('0x5b')]({'where':{'id':_0x1c4986[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x3ef965,null))[_0xdf8e('0x22')](function(_0x56c497){if(_0x56c497){return _0x56c497[_0xdf8e('0xbd')](_0x1c4986['body'][_0xdf8e('0x70')],_[_0xdf8e('0x73')](_0x1c4986[_0xdf8e('0x5d')],[_0xdf8e('0x70'),'id'])||{})['spread'](function(_0x1c7a72){for(var _0x480539=0x0;_0x480539<_0x1c4986['body'][_0xdf8e('0x70')]['length'];_0x480539+=0x1){socket[_0xdf8e('0xbe')](_0xdf8e('0xbf'),{'UserId':_0x1c4986[_0xdf8e('0x5d')][_0xdf8e('0x70')][_0x480539],'FaxAccountId':_0x1c4986['params']['id']});}return _0x1c7a72;});}})[_0xdf8e('0x22')](respondWithResult(_0x3ef965,null))[_0xdf8e('0x2c')](handleError(_0x3ef965,null));};exports[_0xdf8e('0xc0')]=function(_0x283336,_0xa5c62,_0x5f1a4f){return db['FaxAccount']['find']({'where':{'id':_0x283336[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0xa5c62,null))['then'](function(_0x194fdf){if(_0x194fdf){return _0x194fdf[_0xdf8e('0xc0')](_0x283336[_0xdf8e('0x40')][_0xdf8e('0x70')])['then'](function(){if(_[_0xdf8e('0xc1')](_0x283336[_0xdf8e('0x40')][_0xdf8e('0x70')])){for(var _0x37ec49=0x0;_0x37ec49<_0x283336[_0xdf8e('0x40')][_0xdf8e('0x70')][_0xdf8e('0x46')];_0x37ec49+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x283336[_0xdf8e('0x40')]['ids'][_0x37ec49]),'FaxAccountId':Number(_0x283336[_0xdf8e('0x63')]['id'])});}}else{socket['emit'](_0xdf8e('0xc2'),{'UserId':Number(_0x283336[_0xdf8e('0x40')][_0xdf8e('0x70')]),'FaxAccountId':Number(_0x283336[_0xdf8e('0x63')]['id'])});}});}})[_0xdf8e('0x22')](respondWithStatusCode(_0xa5c62,null))[_0xdf8e('0x2c')](handleError(_0xa5c62,null));};exports['getAgents']=function(_0x1346c1,_0x5ee15b,_0x47f3bc){var _0x476d62={};var _0x101269={};var _0x21c276;var _0x349151;return db[_0xdf8e('0x52')][_0xdf8e('0x69')]({'where':{'id':_0x1346c1[_0xdf8e('0x63')]['id']}})[_0xdf8e('0x22')](handleEntityNotFound(_0x5ee15b,null))[_0xdf8e('0x22')](function(_0x337db6){if(_0x337db6){_0x21c276=_0x337db6;_0x101269[_0xdf8e('0x42')]=_['keys'](db[_0xdf8e('0xc3')][_0xdf8e('0x59')]);_0x101269[_0xdf8e('0x40')]=_['keys'](_0x1346c1[_0xdf8e('0x40')]);_0x101269[_0xdf8e('0x41')]=_[_0xdf8e('0x44')](_0x101269[_0xdf8e('0x42')],_0x101269['query']);_0x476d62['attributes']=_[_0xdf8e('0x44')](_0x101269[_0xdf8e('0x42')],qs[_0xdf8e('0x45')](_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x45')]));_0x476d62[_0xdf8e('0x43')]=_0x476d62[_0xdf8e('0x43')][_0xdf8e('0x46')]?_0x476d62['attributes']:_0x101269[_0xdf8e('0x42')];_0x476d62[_0xdf8e('0x6a')]=qs[_0xdf8e('0x4b')](_0x1346c1[_0xdf8e('0x40')]['sort']);_0x476d62[_0xdf8e('0x4c')]=qs[_0xdf8e('0x41')](_[_0xdf8e('0x4d')](_0x1346c1[_0xdf8e('0x40')],_0x101269[_0xdf8e('0x41')]));if(_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x4e')]){_0x476d62[_0xdf8e('0x4c')]=_[_0xdf8e('0x4f')](_0x476d62[_0xdf8e('0x4c')],{'$or':_[_0xdf8e('0x3d')](_0x476d62[_0xdf8e('0x43')],function(_0x2e0919){var _0x56f111={};_0x56f111[_0x2e0919]={'$like':'%'+_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x4e')]+'%'};return _0x56f111;})});}_0x476d62=_[_0xdf8e('0x4f')]({},_0x476d62,_0x1346c1[_0xdf8e('0x51')]);return _0x21c276[_0xdf8e('0xc4')](_0x476d62);}})[_0xdf8e('0x22')](function(_0x3ddd02){if(_0x3ddd02){_0x349151=_0x3ddd02[_0xdf8e('0x46')];if(!_0x1346c1[_0xdf8e('0x40')]['hasOwnProperty'](_0xdf8e('0x48'))){_0x476d62['limit']=qs[_0xdf8e('0x49')](_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x49')]);_0x476d62['offset']=qs[_0xdf8e('0x4a')](_0x1346c1[_0xdf8e('0x40')][_0xdf8e('0x4a')]);}return _0x21c276[_0xdf8e('0xc4')](_0x476d62);}})['then'](function(_0x4adaa2){if(_0x4adaa2){return _0x4adaa2?{'count':_0x349151,'rows':_0x4adaa2}:null;}})[_0xdf8e('0x22')](respondWithResult(_0x5ee15b,null))[_0xdf8e('0x2c')](handleError(_0x5ee15b,null));}; \ No newline at end of file +var _0x972a=['Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','status','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','FaxAccount','findAll','rows','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','bulkCreate','FaxApplication','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','Send\x20Fax\x20failed','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','register','jayson/promise','client','http','test','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','offset','set'];(function(_0x520bba,_0x1a7969){var _0x26cbc4=function(_0x315c8e){while(--_0x315c8e){_0x520bba['push'](_0x520bba['shift']());}};_0x26cbc4(++_0x1a7969);}(_0x972a,0x157));var _0xa972=function(_0xc8db78,_0x58b5a7){_0xc8db78=_0xc8db78-0x0;var _0x3483f3=_0x972a[_0xc8db78];return _0x3483f3;};'use strict';var pdf=require(_0xa972('0x0'));var emlformat=require(_0xa972('0x1'));var rimraf=require(_0xa972('0x2'));var zipdir=require(_0xa972('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa972('0x4'));var moment=require(_0xa972('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa972('0x6'));var path=require(_0xa972('0x7'));var sox=require('sox');var csv=require(_0xa972('0x8'));var ejs=require(_0xa972('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa972('0xa'));var crypto=require('crypto');var jsforce=require(_0xa972('0xb'));var deskjs=require(_0xa972('0xc'));var toCsv=require(_0xa972('0x8'));var querystring=require(_0xa972('0xd'));var Papa=require(_0xa972('0xe'));var Redis=require(_0xa972('0xf'));var authService=require(_0xa972('0x10'));var qs=require(_0xa972('0x11'));var as=require(_0xa972('0x12'));var hardwareService=require(_0xa972('0x13'));var logger=require(_0xa972('0x14'))(_0xa972('0x15'));var utils=require(_0xa972('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa972('0x17')]=_[_0xa972('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa972('0x17')]));require('./faxAccount.socket')[_0xa972('0x19')](socket);var jayson=require(_0xa972('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xa972('0x1b')][_0xa972('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x5cac88,_0x9411cc,_0x11a958){if(_0x11a958){var _0x446f89=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x446f89[_0xa972('0x1d')](_0x9411cc)){return _0x5cac88;}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 _0x5cac88;}}function respondWithRpcPromise(_0x3843fa,_0x185b31,_0x1d5b36,_0x526d30){return new BPromise(function(_0x3b5d98,_0x19a566){var _0x22e7f1=_0x526d30||client;return _0x22e7f1[_0xa972('0x1e')](_0x3843fa,_0x1d5b36)[_0xa972('0x1f')](function(_0x3098d4){logger[_0xa972('0x20')](_0xa972('0x21'),_0x185b31,_0xa972('0x22'));logger[_0xa972('0x23')](_0xa972('0x24'),_0x185b31,_0xa972('0x22'),JSON[_0xa972('0x25')](_0x3098d4));if(_0x3098d4[_0xa972('0x26')]){if(_0x3098d4[_0xa972('0x26')]['code']===0x1f4){logger[_0xa972('0x26')](_0xa972('0x21'),_0x185b31,_0x3098d4[_0xa972('0x26')][_0xa972('0x27')]);return _0x19a566(_0x3098d4[_0xa972('0x26')][_0xa972('0x27')]);}logger[_0xa972('0x26')](_0xa972('0x21'),_0x185b31,_0x3098d4[_0xa972('0x26')][_0xa972('0x27')]);return _0x3b5d98(_0x3098d4['error'][_0xa972('0x27')]);}else{logger[_0xa972('0x20')]('FaxAccount,\x20%s,\x20%s',_0x185b31,_0xa972('0x22'));_0x3b5d98(_0x3098d4[_0xa972('0x28')][_0xa972('0x27')]);}})[_0xa972('0x29')](function(_0x44196d){logger[_0xa972('0x26')]('FaxAccount,\x20%s,\x20%s',_0x185b31,_0x44196d);_0x19a566(_0x44196d);});});}function respondWithStatusCode(_0x55ab82,_0x52cf86){_0x52cf86=_0x52cf86||0xcc;return function(_0xdefc09){if(_0xdefc09){return _0x55ab82[_0xa972('0x2a')](_0x52cf86);}return _0x55ab82['status'](_0x52cf86)[_0xa972('0x2b')]();};}function respondWithResult(_0x34882e,_0x1d1e90){_0x1d1e90=_0x1d1e90||0xc8;return function(_0x42a0cd){if(_0x42a0cd){return _0x34882e['status'](_0x1d1e90)[_0xa972('0x2c')](_0x42a0cd);}};}function respondWithFilteredResult(_0x1ec909,_0x2608ef){return function(_0x1cc40a){if(_0x1cc40a){var _0x5bc51e=_0x1cc40a['count'],_0x4296c2=_0x2608ef[_0xa972('0x2d')],_0x4c2a8c=_0x2608ef[_0xa972('0x2d')]+_0x2608ef['limit'],_0x57588e;if(_0x4c2a8c>=_0x5bc51e){_0x4c2a8c=_0x5bc51e;_0x57588e=0xc8;}else{_0x57588e=0xce;}_0x1ec909['status'](_0x57588e);return _0x1ec909[_0xa972('0x2e')](_0xa972('0x2f'),_0x4296c2+'-'+_0x4c2a8c+'/'+_0x5bc51e)[_0xa972('0x2c')](_0x1cc40a);}return null;};}function patchUpdates(_0x1d218e){return function(_0xbc7351){try{jsonpatch[_0xa972('0x30')](_0xbc7351,_0x1d218e,!![]);}catch(_0x5cbe67){return BPromise['reject'](_0x5cbe67);}return _0xbc7351[_0xa972('0x31')]();};}function saveUpdates(_0x336f38,_0x29ec8e){return function(_0x128579){if(_0x128579){return _0x128579[_0xa972('0x32')](_0x336f38)[_0xa972('0x1f')](function(_0x40f25d){return _0x40f25d;});}return null;};}function removeEntity(_0x591e84,_0x36b224){return function(_0x6232f9){if(_0x6232f9){return _0x6232f9[_0xa972('0x33')]()[_0xa972('0x1f')](function(){var _0x810551=_0x6232f9[_0xa972('0x34')]({'plain':!![]});var _0x377387=_0xa972('0x35');return db[_0xa972('0x36')][_0xa972('0x33')]({'where':{'type':_0x377387,'resourceId':_0x810551['id']}})[_0xa972('0x1f')](function(){return _0x6232f9;});})[_0xa972('0x1f')](function(){_0x591e84[_0xa972('0x37')](0xcc)[_0xa972('0x2b')]();});}};}function handleEntityNotFound(_0x598160,_0x4741ec){return function(_0xd55ee1){if(!_0xd55ee1){_0x598160['sendStatus'](0x194);}return _0xd55ee1;};}function handleError(_0x31cc4,_0x70d739){_0x70d739=_0x70d739||0x1f4;return function(_0x1acd54){logger[_0xa972('0x26')](_0x1acd54[_0xa972('0x38')]);if(_0x1acd54[_0xa972('0x39')]){delete _0x1acd54[_0xa972('0x39')];}_0x31cc4[_0xa972('0x37')](_0x70d739)[_0xa972('0x3a')](_0x1acd54);};}exports[_0xa972('0x3b')]=function(_0x15b3c8,_0x36b5a8){var _0x483c4d={'include':[{'model':db[_0xa972('0x3c')],'as':_0xa972('0x3d')}]},_0x400fe3={},_0x18d6c3={'count':0x0,'rows':[]};var _0x255445=_[_0xa972('0x3e')](db['FaxAccount'][_0xa972('0x3f')],function(_0x3995f8){return{'name':_0x3995f8[_0xa972('0x40')],'type':_0x3995f8[_0xa972('0x41')][_0xa972('0x42')]};});_0x400fe3[_0xa972('0x43')]=_[_0xa972('0x3e')](_0x255445,_0xa972('0x39'));_0x400fe3[_0xa972('0x44')]=_['keys'](_0x15b3c8[_0xa972('0x44')]);_0x400fe3[_0xa972('0x45')]=_[_0xa972('0x46')](_0x400fe3[_0xa972('0x43')],_0x400fe3[_0xa972('0x44')]);_0x483c4d[_0xa972('0x47')]=_['intersection'](_0x400fe3[_0xa972('0x43')],qs[_0xa972('0x48')](_0x15b3c8[_0xa972('0x44')]['fields']));_0x483c4d[_0xa972('0x47')]=_0x483c4d['attributes'][_0xa972('0x49')]?_0x483c4d[_0xa972('0x47')]:_0x400fe3[_0xa972('0x43')];if(!_0x15b3c8[_0xa972('0x44')][_0xa972('0x4a')]('nolimit')){_0x483c4d['limit']=qs['limit'](_0x15b3c8['query'][_0xa972('0x4b')]);_0x483c4d[_0xa972('0x2d')]=qs[_0xa972('0x2d')](_0x15b3c8['query']['offset']);}_0x483c4d[_0xa972('0x4c')]=qs[_0xa972('0x4d')](_0x15b3c8['query'][_0xa972('0x4d')]);_0x483c4d[_0xa972('0x4e')]=qs['filters'](_[_0xa972('0x4f')](_0x15b3c8[_0xa972('0x44')],_0x400fe3[_0xa972('0x45')]),_0x255445);if(_0x15b3c8[_0xa972('0x44')]['filter']){_0x483c4d[_0xa972('0x4e')]=_[_0xa972('0x50')](_0x483c4d[_0xa972('0x4e')],{'$or':_['map'](_0x255445,function(_0x1ed8d7){if(_0x1ed8d7['type']!==_0xa972('0x51')){var _0x1ea5a3={};_0x1ea5a3[_0x1ed8d7[_0xa972('0x39')]]={'$like':'%'+_0x15b3c8[_0xa972('0x44')][_0xa972('0x52')]+'%'};return _0x1ea5a3;}})});}_0x483c4d=_[_0xa972('0x50')]({},_0x483c4d,_0x15b3c8['options']);var _0x26abd3={'where':_0x483c4d[_0xa972('0x4e')]};return db['FaxAccount'][_0xa972('0x53')](_0x26abd3)[_0xa972('0x1f')](function(_0x2155ad){_0x18d6c3[_0xa972('0x53')]=_0x2155ad;if(_0x15b3c8['query'][_0xa972('0x54')]){_0x483c4d[_0xa972('0x55')]=[{'all':!![]}];}return db[_0xa972('0x56')][_0xa972('0x57')](_0x483c4d);})[_0xa972('0x1f')](function(_0x35642b){_0x18d6c3[_0xa972('0x58')]=_0x35642b;return _0x18d6c3;})[_0xa972('0x1f')](respondWithFilteredResult(_0x36b5a8,_0x483c4d))[_0xa972('0x29')](handleError(_0x36b5a8,null));};exports['show']=function(_0x2ca040,_0x5ab76a){var _0x2adda2={'raw':![],'where':{'id':_0x2ca040['params']['id']},'include':[{'model':db[_0xa972('0x3c')],'as':_0xa972('0x3d')}]},_0x2f6742={};_0x2f6742[_0xa972('0x43')]=_[_0xa972('0x59')](db[_0xa972('0x56')][_0xa972('0x3f')]);_0x2f6742[_0xa972('0x44')]=_[_0xa972('0x59')](_0x2ca040[_0xa972('0x44')]);_0x2f6742['filters']=_[_0xa972('0x46')](_0x2f6742[_0xa972('0x43')],_0x2f6742[_0xa972('0x44')]);_0x2adda2[_0xa972('0x47')]=_[_0xa972('0x46')](_0x2f6742['model'],qs[_0xa972('0x48')](_0x2ca040[_0xa972('0x44')][_0xa972('0x48')]));_0x2adda2[_0xa972('0x47')]=_0x2adda2[_0xa972('0x47')][_0xa972('0x49')]?_0x2adda2[_0xa972('0x47')]:_0x2f6742[_0xa972('0x43')];if(_0x2ca040[_0xa972('0x44')][_0xa972('0x54')]){_0x2adda2[_0xa972('0x55')]=[{'all':!![]}];}_0x2adda2=_['merge']({},_0x2adda2,_0x2ca040[_0xa972('0x5a')]);return db[_0xa972('0x56')][_0xa972('0x5b')](_0x2adda2)['then'](handleEntityNotFound(_0x5ab76a,null))[_0xa972('0x1f')](respondWithResult(_0x5ab76a,null))['catch'](handleError(_0x5ab76a,null));};exports[_0xa972('0x5c')]=function(_0x5d9ed9,_0x550056){return db[_0xa972('0x56')][_0xa972('0x5c')](_0x5d9ed9[_0xa972('0x5d')],{})[_0xa972('0x1f')](function(_0x34c0fd){var _0x517647=_0x5d9ed9[_0xa972('0x5e')]['get']({'plain':!![]});if(!_0x517647)throw new Error(_0xa972('0x5f'));if(_0x517647[_0xa972('0x60')]===_0xa972('0x5e')){var _0x1c3d35=_0x34c0fd[_0xa972('0x34')]({'plain':!![]});var _0x3420ba=_0xa972('0x35');return db[_0xa972('0x61')]['find']({'where':{'name':_0x3420ba,'userProfileId':_0x517647['userProfileId']},'raw':!![]})[_0xa972('0x1f')](function(_0x1bbfca){if(_0x1bbfca&&_0x1bbfca[_0xa972('0x62')]===0x0){return db['UserProfileResource'][_0xa972('0x5c')]({'name':_0x1c3d35[_0xa972('0x39')],'resourceId':_0x1c3d35['id'],'type':_0x1bbfca[_0xa972('0x39')],'sectionId':_0x1bbfca['id']},{})[_0xa972('0x1f')](function(){return _0x34c0fd;});}else{return _0x34c0fd;}})['catch'](function(_0x9901d1){logger[_0xa972('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9901d1);throw _0x9901d1;});}return _0x34c0fd;})['then'](respondWithResult(_0x550056,0xc9))[_0xa972('0x29')](handleError(_0x550056,null));};exports['update']=function(_0x565291,_0x132e4c){if(_0x565291[_0xa972('0x5d')]['id']){delete _0x565291[_0xa972('0x5d')]['id'];}return db[_0xa972('0x56')][_0xa972('0x5b')]({'where':{'id':_0x565291[_0xa972('0x63')]['id']},'include':[{'model':db[_0xa972('0x3c')],'as':_0xa972('0x3d')}]})[_0xa972('0x1f')](handleEntityNotFound(_0x132e4c,null))[_0xa972('0x1f')](saveUpdates(_0x565291['body'],null))['then'](respondWithResult(_0x132e4c,null))['catch'](handleError(_0x132e4c,null));};exports[_0xa972('0x33')]=function(_0xcd8ff6,_0x5a3ad8){return db[_0xa972('0x56')][_0xa972('0x5b')]({'where':{'id':_0xcd8ff6['params']['id']}})['then'](handleEntityNotFound(_0x5a3ad8,null))[_0xa972('0x1f')](removeEntity(_0x5a3ad8,null))['catch'](handleError(_0x5a3ad8,null));};exports[_0xa972('0x64')]=function(_0x47e52a,_0x2505de){return db[_0xa972('0x56')]['describe']()[_0xa972('0x1f')](respondWithResult(_0x2505de,null))['catch'](handleError(_0x2505de,null));};exports[_0xa972('0x65')]=function(_0x123c5e,_0x4a587a,_0x53beb8){if(_0x123c5e['body']['id']){delete _0x123c5e[_0xa972('0x5d')]['id'];}return db[_0xa972('0x56')][_0xa972('0x5b')]({'where':{'id':_0x123c5e[_0xa972('0x63')]['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x4a587a,null))['then'](function(_0x5a956a){if(_0x5a956a){_0x123c5e[_0xa972('0x5d')]['FaxAccountId']=_0x5a956a['id'];return db[_0xa972('0x66')][_0xa972('0x5c')](_0x123c5e['body']);}})[_0xa972('0x1f')](respondWithResult(_0x4a587a,null))['catch'](handleError(_0x4a587a,null));};exports[_0xa972('0x67')]=function(_0x3405c0,_0x800d67,_0x33dfe8){var _0x2044ba={'raw':![],'where':{}};var _0x55764b={};var _0x3d3e99={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa972('0x68')]({'where':{'id':_0x3405c0['params']['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x800d67,null))['then'](function(_0x58891d){if(_0x58891d){_0x55764b[_0xa972('0x43')]=_[_0xa972('0x59')](db[_0xa972('0x66')][_0xa972('0x3f')]);_0x55764b[_0xa972('0x44')]=_[_0xa972('0x59')](_0x3405c0['query']);_0x55764b[_0xa972('0x45')]=_[_0xa972('0x46')](_0x55764b['model'],_0x55764b['query']);_0x2044ba[_0xa972('0x47')]=_[_0xa972('0x46')](_0x55764b[_0xa972('0x43')],qs['fields'](_0x3405c0[_0xa972('0x44')][_0xa972('0x48')]));_0x2044ba[_0xa972('0x47')]=_0x2044ba[_0xa972('0x47')][_0xa972('0x49')]?_0x2044ba[_0xa972('0x47')]:_0x55764b[_0xa972('0x43')];if(!_0x3405c0[_0xa972('0x44')]['hasOwnProperty'](_0xa972('0x69'))){_0x2044ba['limit']=qs[_0xa972('0x4b')](_0x3405c0['query'][_0xa972('0x4b')]);_0x2044ba[_0xa972('0x2d')]=qs[_0xa972('0x2d')](_0x3405c0['query'][_0xa972('0x2d')]);}_0x2044ba[_0xa972('0x4c')]=qs[_0xa972('0x4d')](_0x3405c0[_0xa972('0x44')][_0xa972('0x4d')]);_0x2044ba['where']=qs[_0xa972('0x45')](_[_0xa972('0x4f')](_0x3405c0[_0xa972('0x44')],_0x55764b['filters']));_0x2044ba[_0xa972('0x4e')][_0xa972('0x6a')]=_0x58891d['id'];if(_0x3405c0[_0xa972('0x44')]['filter']){_0x2044ba[_0xa972('0x4e')]=_['merge'](_0x2044ba[_0xa972('0x4e')],{'$or':_[_0xa972('0x3e')](_0x2044ba[_0xa972('0x47')],function(_0x5a08f4){var _0x20dc13={};_0x20dc13[_0x5a08f4]={'$like':'%'+_0x3405c0['query'][_0xa972('0x52')]+'%'};return _0x20dc13;})});}_0x2044ba=_[_0xa972('0x50')]({},_0x2044ba,_0x3405c0[_0xa972('0x5a')]);return db[_0xa972('0x66')][_0xa972('0x53')]({'where':_0x2044ba['where']})[_0xa972('0x1f')](function(_0x15e503){_0x3d3e99[_0xa972('0x53')]=_0x15e503;if(_0x3405c0['query']['includeAll']){_0x2044ba[_0xa972('0x55')]=[{'all':!![]}];}return db[_0xa972('0x66')]['findAll'](_0x2044ba);})[_0xa972('0x1f')](function(_0x2a0471){_0x3d3e99[_0xa972('0x58')]=_0x2a0471;return _0x3d3e99;});}})[_0xa972('0x1f')](respondWithFilteredResult(_0x800d67,_0x2044ba))[_0xa972('0x29')](handleError(_0x800d67,null));};exports[_0xa972('0x6b')]=function(_0x4280c5,_0x5365f4,_0x5ebae2){return db[_0xa972('0x56')]['find']({'where':{'id':_0x4280c5[_0xa972('0x63')]['id']}})['then'](handleEntityNotFound(_0x5365f4,null))[_0xa972('0x1f')](function(_0x1e383b){if(_0x1e383b){return _0x1e383b[_0xa972('0x6b')](_0x4280c5[_0xa972('0x44')][_0xa972('0x6c')]);}})[_0xa972('0x1f')](respondWithStatusCode(_0x5365f4,null))['catch'](handleError(_0x5365f4,null));};exports[_0xa972('0x6d')]=function(_0x5d2aaf,_0x33b68b,_0x1c135d){if(_0x5d2aaf[_0xa972('0x5d')]['id']){delete _0x5d2aaf['body']['id'];}return db[_0xa972('0x56')][_0xa972('0x5b')]({'where':{'id':_0x5d2aaf[_0xa972('0x63')]['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x33b68b,null))[_0xa972('0x1f')](function(_0x5742b9){if(_0x5742b9){_0x5d2aaf[_0xa972('0x5d')][_0xa972('0x6a')]=_0x5742b9['id'];return db[_0xa972('0x6e')][_0xa972('0x5c')](_0x5d2aaf[_0xa972('0x5d')]);}})['then'](respondWithResult(_0x33b68b,null))[_0xa972('0x29')](handleError(_0x33b68b,null));};exports['getAnswers']=function(_0x19b65b,_0x498618,_0x9170e6){var _0x254b96={'raw':![],'where':{}};var _0x39f1a0={};var _0x532ba2={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa972('0x68')]({'where':{'id':_0x19b65b[_0xa972('0x63')]['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x498618,null))['then'](function(_0xdc291d){if(_0xdc291d){_0x39f1a0['model']=_['keys'](db['CannedAnswer'][_0xa972('0x3f')]);_0x39f1a0[_0xa972('0x44')]=_[_0xa972('0x59')](_0x19b65b[_0xa972('0x44')]);_0x39f1a0[_0xa972('0x45')]=_[_0xa972('0x46')](_0x39f1a0[_0xa972('0x43')],_0x39f1a0[_0xa972('0x44')]);_0x254b96[_0xa972('0x47')]=_['intersection'](_0x39f1a0['model'],qs[_0xa972('0x48')](_0x19b65b[_0xa972('0x44')][_0xa972('0x48')]));_0x254b96[_0xa972('0x47')]=_0x254b96[_0xa972('0x47')][_0xa972('0x49')]?_0x254b96[_0xa972('0x47')]:_0x39f1a0[_0xa972('0x43')];if(!_0x19b65b['query']['hasOwnProperty']('nolimit')){_0x254b96[_0xa972('0x4b')]=qs[_0xa972('0x4b')](_0x19b65b[_0xa972('0x44')][_0xa972('0x4b')]);_0x254b96[_0xa972('0x2d')]=qs[_0xa972('0x2d')](_0x19b65b[_0xa972('0x44')][_0xa972('0x2d')]);}_0x254b96[_0xa972('0x4c')]=qs[_0xa972('0x4d')](_0x19b65b[_0xa972('0x44')]['sort']);_0x254b96[_0xa972('0x4e')]=qs['filters'](_[_0xa972('0x4f')](_0x19b65b[_0xa972('0x44')],_0x39f1a0[_0xa972('0x45')]));_0x254b96[_0xa972('0x4e')][_0xa972('0x6a')]=_0xdc291d['id'];if(_0x19b65b['query'][_0xa972('0x52')]){_0x254b96[_0xa972('0x4e')]=_[_0xa972('0x50')](_0x254b96['where'],{'$or':_[_0xa972('0x3e')](_0x254b96[_0xa972('0x47')],function(_0x215efb){var _0x4baade={};_0x4baade[_0x215efb]={'$like':'%'+_0x19b65b[_0xa972('0x44')][_0xa972('0x52')]+'%'};return _0x4baade;})});}_0x254b96=_[_0xa972('0x50')]({},_0x254b96,_0x19b65b[_0xa972('0x5a')]);return db[_0xa972('0x6e')][_0xa972('0x53')]({'where':_0x254b96[_0xa972('0x4e')]})['then'](function(_0x4bd9c7){_0x532ba2['count']=_0x4bd9c7;if(_0x19b65b[_0xa972('0x44')]['includeAll']){_0x254b96[_0xa972('0x55')]=[{'all':!![]}];}return db[_0xa972('0x6e')]['findAll'](_0x254b96);})[_0xa972('0x1f')](function(_0x290821){_0x532ba2[_0xa972('0x58')]=_0x290821;return _0x532ba2;});}})[_0xa972('0x1f')](respondWithFilteredResult(_0x498618,_0x254b96))[_0xa972('0x29')](handleError(_0x498618,null));};exports[_0xa972('0x6f')]=function(_0x673b24,_0x458172,_0x5ae029){return db[_0xa972('0x56')][_0xa972('0x5b')]({'where':{'id':_0x673b24['params']['id']}})['then'](handleEntityNotFound(_0x458172,null))[_0xa972('0x1f')](function(_0x95de2e){if(_0x95de2e){return _0x95de2e[_0xa972('0x6f')](_0x673b24[_0xa972('0x44')][_0xa972('0x6c')]);}})[_0xa972('0x1f')](respondWithStatusCode(_0x458172,null))['catch'](handleError(_0x458172,null));};exports['addInteraction']=function(_0x41a82d,_0x380a7b,_0xadf2a7){return db[_0xa972('0x70')][_0xa972('0x5b')]({'where':{'id':_0x41a82d[_0xa972('0x63')]['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x380a7b,null))[_0xa972('0x1f')](function(_0x2da1f7){if(_0x2da1f7){return _0x2da1f7[_0xa972('0x71')](_0x41a82d[_0xa972('0x5d')][_0xa972('0x6c')],_[_0xa972('0x72')](_0x41a82d[_0xa972('0x5d')],['ids','id'])||{});}})[_0xa972('0x1f')](respondWithResult(_0x380a7b,null))[_0xa972('0x29')](handleError(_0x380a7b,null));};exports[_0xa972('0x73')]=function(_0x1aeb1d,_0x3883d0,_0x2942e5){var _0x30881e={'raw':![],'where':{}};var _0x18d963={};var _0x406098={'count':0x0,'rows':[]};return db[_0xa972('0x56')][_0xa972('0x68')]({'where':{'id':_0x1aeb1d[_0xa972('0x63')]['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x3883d0,null))[_0xa972('0x1f')](function(_0x28f3c3){if(_0x28f3c3){_0x18d963[_0xa972('0x43')]=_[_0xa972('0x59')](db[_0xa972('0x70')]['rawAttributes']);_0x18d963['query']=_[_0xa972('0x59')](_0x1aeb1d[_0xa972('0x44')]);_0x18d963['filters']=_[_0xa972('0x46')](_0x18d963[_0xa972('0x43')],_0x18d963[_0xa972('0x44')]);_0x30881e[_0xa972('0x47')]=_[_0xa972('0x46')](_0x18d963[_0xa972('0x43')],qs[_0xa972('0x48')](_0x1aeb1d['query'][_0xa972('0x48')]));_0x30881e[_0xa972('0x47')]=_0x30881e['attributes'][_0xa972('0x49')]?_0x30881e[_0xa972('0x47')]:_0x18d963[_0xa972('0x43')];if(!_0x1aeb1d[_0xa972('0x44')][_0xa972('0x4a')](_0xa972('0x69'))){_0x30881e[_0xa972('0x4b')]=qs['limit'](_0x1aeb1d[_0xa972('0x44')][_0xa972('0x4b')]);_0x30881e[_0xa972('0x2d')]=qs[_0xa972('0x2d')](_0x1aeb1d[_0xa972('0x44')][_0xa972('0x2d')]);}_0x30881e[_0xa972('0x4c')]=qs['sort'](_0x1aeb1d[_0xa972('0x44')][_0xa972('0x4d')]);_0x30881e[_0xa972('0x4e')]=qs['filters'](_[_0xa972('0x4f')](_0x1aeb1d[_0xa972('0x44')],_0x18d963[_0xa972('0x45')]));_0x30881e[_0xa972('0x4e')][_0xa972('0x6a')]=_0x28f3c3['id'];if(_0x1aeb1d[_0xa972('0x44')]['filter']){_0x30881e[_0xa972('0x4e')]=_[_0xa972('0x50')](_0x30881e[_0xa972('0x4e')],{'$or':_[_0xa972('0x3e')](_0x30881e[_0xa972('0x47')],function(_0xfebb8c){var _0x510b03={};_0x510b03[_0xfebb8c]={'$like':'%'+_0x1aeb1d[_0xa972('0x44')][_0xa972('0x52')]+'%'};return _0x510b03;})});}_0x30881e=_[_0xa972('0x50')]({},_0x30881e,_0x1aeb1d['options']);return db[_0xa972('0x70')][_0xa972('0x53')]({'where':_0x30881e[_0xa972('0x4e')]})[_0xa972('0x1f')](function(_0x3b97c0){_0x406098[_0xa972('0x53')]=_0x3b97c0;if(_0x1aeb1d['query']['includeAll']){_0x30881e[_0xa972('0x55')]=[{'model':db[_0xa972('0x74')],'as':_0xa972('0x75'),'required':![]},{'model':db[_0xa972('0x76')],'as':_0xa972('0x77'),'attributes':['name',_0xa972('0x78'),_0xa972('0x79')],'required':![]},{'model':db['Tag'],'as':_0xa972('0x7a'),'attributes':['id',_0xa972('0x39'),_0xa972('0x7b')],'where':_0x1aeb1d[_0xa972('0x44')]['tag']?{'id':_0x1aeb1d[_0xa972('0x44')][_0xa972('0x7c')]}:undefined,'required':_0x1aeb1d['query']['tag']?!![]:![]}];}return db[_0xa972('0x70')][_0xa972('0x57')](_0x30881e);})[_0xa972('0x1f')](function(_0x528e47){_0x406098['rows']=_0x528e47;return _0x406098;});}})['then'](respondWithFilteredResult(_0x3883d0,_0x30881e))[_0xa972('0x29')](handleError(_0x3883d0,null));};exports[_0xa972('0x7d')]=function(_0x151f7e,_0x4e2476,_0x1751a4){return db[_0xa972('0x56')][_0xa972('0x68')]({'where':{'id':_0x151f7e[_0xa972('0x63')]['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x4e2476,null))[_0xa972('0x1f')](function(_0x55908c){if(_0x55908c){return db[_0xa972('0x7e')][_0xa972('0x7f')](function(_0x155802){return db['FaxApplication'][_0xa972('0x33')]({'where':{'FaxAccountId':_0x151f7e['params']['id']},'transaction':_0x155802})[_0xa972('0x1f')](function(_0x59fc39){var _0x41f2ee=_['map'](_0x151f7e[_0xa972('0x5d')],function(_0x33144d){_0x33144d[_0xa972('0x6a')]=_0x151f7e['params']['id'];return _0x33144d;});return db['FaxApplication'][_0xa972('0x80')](_0x41f2ee,{'transaction':_0x155802});});})[_0xa972('0x1f')](function(){return db[_0xa972('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x151f7e['params']['id']},'order':'priority'});});}})[_0xa972('0x1f')](respondWithResult(_0x4e2476,null))[_0xa972('0x29')](handleError(_0x4e2476,null));};exports[_0xa972('0x82')]=function(_0x221cca,_0x34908c,_0x663b6e){var _0x4c935d={};var _0xb1dd8c={};var _0x466b14;var _0x309b3b;return db['FaxAccount']['findOne']({'where':{'id':_0x221cca['params']['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x34908c,null))[_0xa972('0x1f')](function(_0xf44dce){if(_0xf44dce){_0x466b14=_0xf44dce;_0xb1dd8c[_0xa972('0x43')]=_['keys'](db[_0xa972('0x81')][_0xa972('0x3f')]);_0xb1dd8c[_0xa972('0x44')]=_[_0xa972('0x59')](_0x221cca[_0xa972('0x44')]);_0xb1dd8c[_0xa972('0x45')]=_[_0xa972('0x46')](_0xb1dd8c[_0xa972('0x43')],_0xb1dd8c[_0xa972('0x44')]);_0x4c935d[_0xa972('0x47')]=_[_0xa972('0x46')](_0xb1dd8c['model'],qs['fields'](_0x221cca[_0xa972('0x44')][_0xa972('0x48')]));_0x4c935d[_0xa972('0x47')]=_0x4c935d['attributes']['length']?_0x4c935d['attributes']:_0xb1dd8c[_0xa972('0x43')];_0x4c935d[_0xa972('0x4c')]=qs[_0xa972('0x4d')](_0x221cca[_0xa972('0x44')][_0xa972('0x4d')]);_0x4c935d[_0xa972('0x4e')]=qs[_0xa972('0x45')](_[_0xa972('0x4f')](_0x221cca[_0xa972('0x44')],_0xb1dd8c[_0xa972('0x45')]));if(_0x221cca['query']['filter']){_0x4c935d[_0xa972('0x4e')]=_[_0xa972('0x50')](_0x4c935d[_0xa972('0x4e')],{'$or':_['map'](_0x4c935d['attributes'],function(_0x3060ba){var _0x431f91={};_0x431f91[_0x3060ba]={'$like':'%'+_0x221cca[_0xa972('0x44')]['filter']+'%'};return _0x431f91;})});}_0x4c935d=_[_0xa972('0x50')]({},_0x4c935d,_0x221cca[_0xa972('0x5a')]);return _0x466b14[_0xa972('0x82')](_0x4c935d);}})[_0xa972('0x1f')](function(_0x1ac21d){if(_0x1ac21d){_0x309b3b=_0x1ac21d[_0xa972('0x49')];if(!_0x221cca[_0xa972('0x44')][_0xa972('0x4a')](_0xa972('0x69'))){_0x4c935d[_0xa972('0x4b')]=qs[_0xa972('0x4b')](_0x221cca[_0xa972('0x44')]['limit']);_0x4c935d['offset']=qs['offset'](_0x221cca[_0xa972('0x44')][_0xa972('0x2d')]);}return _0x466b14['getApplications'](_0x4c935d);}})[_0xa972('0x1f')](function(_0x206221){if(_0x206221){return _0x206221?{'count':_0x309b3b,'rows':_0x206221}:null;}})[_0xa972('0x1f')](respondWithResult(_0x34908c,null))[_0xa972('0x29')](handleError(_0x34908c,null));};function Extension(_0x484f09,_0x444427,_0x181e05,_0x182669){this[_0xa972('0x83')]=_0xa972('0x84');this[_0xa972('0x85')]=_0x484f09[_0xa972('0x86')];this[_0xa972('0x87')]=_0x182669;this[_0xa972('0x41')]=_0xa972('0x88');this[_0xa972('0x89')]=_0xa972('0x8a');this['FaxAccountId']=_0x484f09['id'];this[_0xa972('0x8b')]=_0x444427;this['appdata']=_0x181e05;}function createExtensionsReciveFax(_0x18f875){var _0x3878cd=0x1;var _0x28f7d2=[];_0x28f7d2[_0xa972('0x8c')](new Extension(_0x18f875,_0x3878cd,'','Answer'));_0x3878cd+=0x1;_0x28f7d2['push'](new Extension(_0x18f875,_0x3878cd,_0xa972('0x8d'),_0xa972('0x8e')));_0x3878cd+=0x1;for(var _0x5add65 in _0x18f875){if(_0x18f875[_0xa972('0x4a')](_0x5add65)&&(_0x5add65==='ecm'||_0x5add65===_0xa972('0x86')||_0x5add65===_0xa972('0x8f')||_0x5add65===_0xa972('0x90')||_0x5add65===_0xa972('0x91')||_0x5add65===_0xa972('0x92')||_0x5add65===_0xa972('0x93')||_0x5add65==='modem'||_0x5add65===_0xa972('0x94'))){_0x28f7d2[_0xa972('0x8c')](new Extension(_0x18f875,_0x3878cd,_0xa972('0x95')+_0x5add65+')='+_0x18f875[_0x5add65],'Set'));_0x3878cd+=0x1;}}_0x28f7d2['push'](new Extension(_0x18f875,_0x3878cd,'6',_0xa972('0x96')));_0x3878cd+=0x1;_0x28f7d2['push'](new Extension(_0x18f875,_0x3878cd,_0xa972('0x97'),_0xa972('0x98')));_0x3878cd=0x0;return _0x28f7d2;}exports[_0xa972('0x99')]=function(_0x58509d,_0x47cbdc,_0x42411f){var _0x4aa025;return db['sequelize'][_0xa972('0x7f')](function(_0x545ef6){return db['FaxAccount'][_0xa972('0x5c')](_0x58509d[_0xa972('0x5d')],{'transaction':_0x545ef6})[_0xa972('0x1f')](function(_0x8457ff){_0x4aa025=_0x8457ff[_0xa972('0x34')]({'plain':!![]});return db[_0xa972('0x9a')][_0xa972('0x80')](createExtensionsReciveFax(_0x4aa025),{'transaction':_0x545ef6});});})['then'](function(){return _0x4aa025;})[_0xa972('0x1f')](respondWithResult(_0x47cbdc,null))[_0xa972('0x29')](handleError(_0x47cbdc,null));};exports[_0xa972('0x9b')]=function(_0x247389,_0x255899,_0x1917da){var _0x507beb;return db[_0xa972('0x7e')][_0xa972('0x7f')](function(_0x1017e8){return db[_0xa972('0x56')][_0xa972('0x32')](_0x247389[_0xa972('0x5d')],{'where':{'id':_0x247389[_0xa972('0x5d')]['id']},'transaction':_0x1017e8})['then'](function(_0x2f01e1){return db[_0xa972('0x9a')][_0xa972('0x33')]({'where':{'FaxAccountId':_0x247389[_0xa972('0x5d')]['id']},'transaction':_0x1017e8})['then'](function(_0x486a12){return db[_0xa972('0x9a')][_0xa972('0x80')](createExtensionsReciveFax(_[_0xa972('0x72')](_0x247389[_0xa972('0x5d')],['tech',_0xa972('0x42'),_0xa972('0x9c'),_0xa972('0x9d'),_0xa972('0x9e'),'ListId'])),{'transaction':_0x1017e8});});});})[_0xa972('0x1f')](function(){return db[_0xa972('0x56')]['findById'](_0x247389['body']['id']);})[_0xa972('0x1f')](respondWithResult(_0x255899,null))[_0xa972('0x29')](handleError(_0x255899,null));};exports[_0xa972('0x9f')]=function(_0x40b196,_0x4783bc,_0x5500b5){var _0xe58ad2={'raw':!![],'where':{}};var _0x81bbe9={};var _0x3c1e3a={'count':0x0,'rows':[]};return db[_0xa972('0x56')][_0xa972('0x68')]({'where':{'id':_0x40b196['params']['id']}})['then'](handleEntityNotFound(_0x4783bc,null))[_0xa972('0x1f')](function(_0x122614){if(_0x122614){_0x81bbe9['model']=_[_0xa972('0x59')](db[_0xa972('0xa0')]['rawAttributes']);_0x81bbe9['query']=_[_0xa972('0x59')](_0x40b196[_0xa972('0x44')]);_0x81bbe9[_0xa972('0x45')]=_[_0xa972('0x46')](_0x81bbe9['model'],_0x81bbe9[_0xa972('0x44')]);_0xe58ad2[_0xa972('0x47')]=_[_0xa972('0x46')](_0x81bbe9[_0xa972('0x43')],qs[_0xa972('0x48')](_0x40b196[_0xa972('0x44')][_0xa972('0x48')]));_0xe58ad2[_0xa972('0x47')]=_0xe58ad2[_0xa972('0x47')][_0xa972('0x49')]?_0xe58ad2[_0xa972('0x47')]:_0x81bbe9[_0xa972('0x43')];if(!_0x40b196['query'][_0xa972('0x4a')](_0xa972('0x69'))){_0xe58ad2[_0xa972('0x4b')]=qs[_0xa972('0x4b')](_0x40b196[_0xa972('0x44')][_0xa972('0x4b')]);_0xe58ad2[_0xa972('0x2d')]=qs[_0xa972('0x2d')](_0x40b196[_0xa972('0x44')]['offset']);}_0xe58ad2[_0xa972('0x4c')]=qs[_0xa972('0x4d')](_0x40b196['query'][_0xa972('0x4d')]);_0xe58ad2[_0xa972('0x4e')]=qs[_0xa972('0x45')](_[_0xa972('0x4f')](_0x40b196['query'],_0x81bbe9[_0xa972('0x45')]));_0xe58ad2[_0xa972('0x4e')][_0xa972('0x6a')]=_0x122614['id'];if(_0x40b196['query']['filter']){_0xe58ad2[_0xa972('0x4e')]=_[_0xa972('0x50')](_0xe58ad2[_0xa972('0x4e')],{'$or':_['map'](_0xe58ad2[_0xa972('0x47')],function(_0x15b9fe){var _0x5d7e87={};_0x5d7e87[_0x15b9fe]={'$like':'%'+_0x40b196[_0xa972('0x44')][_0xa972('0x52')]+'%'};return _0x5d7e87;})});}if(_0x40b196[_0xa972('0x44')]['$gte']){var _0x55af82=_0x40b196['query'][_0xa972('0xa1')][_0xa972('0xa2')](',');var _0x26e8fe={};_0x26e8fe[_0x55af82[0x0]]={'$gte':moment(_0x55af82[0x1])[_0xa972('0xa3')](_0xa972('0xa4'))};_0xe58ad2['where']=_[_0xa972('0x50')](_0xe58ad2[_0xa972('0x4e')],_0x26e8fe);}_0xe58ad2=_[_0xa972('0x50')]({},_0xe58ad2,_0x40b196[_0xa972('0x5a')]);return db[_0xa972('0xa0')]['count']({'where':_0xe58ad2[_0xa972('0x4e')]})[_0xa972('0x1f')](function(_0x496936){_0x3c1e3a['count']=_0x496936;if(_0x40b196[_0xa972('0x44')]['includeAll']){_0xe58ad2[_0xa972('0x55')]=[{'all':!![]}];}return db[_0xa972('0xa0')][_0xa972('0x57')](_0xe58ad2);})[_0xa972('0x1f')](function(_0x8fdd93){_0x3c1e3a[_0xa972('0x58')]=_0x8fdd93;return _0x3c1e3a;});}})[_0xa972('0x1f')](respondWithFilteredResult(_0x4783bc,_0xe58ad2))['catch'](handleError(_0x4783bc,null));};exports[_0xa972('0x3a')]=function(_0x5bbb37,_0x335800,_0x648f7d){var _0xb62f46,_0x38f64d={},_0x2d5e00;if(_0x5bbb37[_0xa972('0x5d')]['to']){_0x2d5e00=_0x5bbb37['body']['to'][0x0];}return db[_0xa972('0x56')][_0xa972('0x5b')]({'where':{'id':_0x5bbb37[_0xa972('0x63')]['id']},'include':[{'model':db['CmList'],'as':_0xa972('0xa5'),'include':[{'model':db['CmContact'],'as':_0xa972('0xa6'),'where':{'fax':_0x2d5e00},'limit':0x1,'order':[[_0xa972('0x9d'),_0xa972('0xa7')]]}]}]})[_0xa972('0x1f')](handleEntityNotFound(_0x335800,null))[_0xa972('0x1f')](function(_0x29b78c){_0xb62f46=_0x29b78c;if(_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')]&&_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][_0xa972('0x49')]){for(var _0x4f67a1=0x0;_0x4f67a1<_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')]['length'];_0x4f67a1+=0x1){_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][_0x4f67a1]={'filename':_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][_0x4f67a1][_0xa972('0x39')],'id':_0x5bbb37['body'][_0xa972('0xa8')][_0x4f67a1]['id'],'path':path[_0xa972('0xa9')](config[_0xa972('0xaa')],_0xa972('0xab'),_0x5bbb37[_0xa972('0x5d')]['attachments'][_0x4f67a1][_0xa972('0xac')])};}}return respondWithRpcPromise(_0xa972('0xad'),_0xa972('0xad'),{'FaxAccountId':_[_0xa972('0xae')](_0x5bbb37[_0xa972('0x63')]['id'])?undefined:_0x5bbb37[_0xa972('0x63')]['id'],'path':_['isNil'](_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][0x0]['path'])?undefined:_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][0x0][_0xa972('0x7')],'fax':_['isNil'](_0x5bbb37[_0xa972('0x5d')]['to'][0x0])?undefined:_0x5bbb37[_0xa972('0x5d')]['to'][0x0]},client9002);})[_0xa972('0x1f')](function(){if(_0xb62f46){if(_[_0xa972('0xae')](_0x5bbb37[_0xa972('0x5d')][_0xa972('0xaf')])){_0x5bbb37['body'][_0xa972('0xaf')]=util[_0xa972('0xa3')](_0xa972('0xb0'),_0xb62f46[_0xa972('0x39')],_0xb62f46[_0xa972('0xb1')]);}if(_0xb62f46['List']){if(_0xb62f46[_0xa972('0xa5')]['Contacts'][_0xa972('0x49')]){return _0xb62f46[_0xa972('0xa5')][_0xa972('0xa6')][0x0];}else{return db[_0xa972('0x74')]['create'](_[_0xa972('0x18')](_0x5bbb37['body'],{'firstName':_0x5bbb37[_0xa972('0x5d')]['to'][0x0],'phone':_0x5bbb37[_0xa972('0x5d')]['to'][0x0],'fax':_0x5bbb37[_0xa972('0x5d')]['to'][0x0],'ListId':_0xb62f46[_0xa972('0xb2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xa972('0xb3'));}})[_0xa972('0x1f')](function(_0x15daf7){if(_0x15daf7){return db[_0xa972('0x70')][_0xa972('0x5b')]({'where':{'ContactId':_0x15daf7['id'],'closed':![],'FaxAccountId':_0xb62f46['id']}})[_0xa972('0x1f')](function(_0x3881f1){if(_0x3881f1){return[_0x3881f1,![]];}return db[_0xa972('0x70')]['create']({'UserId':_0x5bbb37['user']['id'],'ContactId':_0x15daf7['id'],'FaxAccountId':_0xb62f46['id'],'fax':_0x5bbb37['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x5bbb37['body'],{'read':![],'body':_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][0x0][_0xa972('0xb4')],'FaxAccountId':_0xb62f46['id'],'UserId':_0x5bbb37['user']['id'],'ContactId':_0x15daf7['id'],'AttachmentId':_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0xa972('0xa0')],'as':_0xa972('0xb5')}]})[_0xa972('0x1f')](function(_0x48e7e1){return[_0x48e7e1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa972('0xb6')](function(_0x1bd0ec,_0x322e11){if(_0x322e11){return _0x1bd0ec;}return db[_0xa972('0xa0')][_0xa972('0x5c')]({'direction':_0xa972('0xb7'),'read':![],'body':_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][0x0][_0xa972('0xb4')],'FaxAccountId':_0xb62f46['id'],'FaxInteractionId':_0x1bd0ec['id'],'UserId':_0x5bbb37[_0xa972('0x5e')]['id'],'ContactId':_0x1bd0ec[_0xa972('0xb8')],'AttachmentId':_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][0x0]['id']})[_0xa972('0x1f')](function(_0x5a3f38){_0x1bd0ec[_0xa972('0xb9')]['Messages']=[];_0x1bd0ec[_0xa972('0xb9')][_0xa972('0xb5')]['push'](_0x5a3f38[_0xa972('0xb9')]);return _0x1bd0ec;});})['then'](function(_0x5950cb){respondWithRpcPromise(_0xa972('0xba'),_0xa972('0xba'),{'FaxAccountId':_[_0xa972('0xae')](_0x5bbb37[_0xa972('0x63')]['id'])?undefined:_0x5bbb37['params']['id'],'path':_[_0xa972('0xae')](_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][0x0][_0xa972('0x7')])?undefined:_0x5bbb37[_0xa972('0x5d')][_0xa972('0xa8')][0x0][_0xa972('0x7')],'fax':_['isNil'](_0x5bbb37['body']['to'][0x0])?undefined:_0x5bbb37['body']['to'][0x0],'AttachmentId':_0x5bbb37[_0xa972('0x5d')]['attachments'][0x0]['id']},client9002)['then'](function(_0x52f319){logger[_0xa972('0x20')](_0xa972('0xbb'),_0x52f319);})['catch'](function(_0xd0989c){logger[_0xa972('0x20')](_0xa972('0xbb'),_0xd0989c);});return _0x5950cb;})[_0xa972('0x1f')](respondWithResult(_0x335800,null))[_0xa972('0x29')](handleError(_0x335800,null));};exports[_0xa972('0xbc')]=function(_0x225804,_0x10f5bd,_0x2591fa){return db['FaxAccount'][_0xa972('0x5b')]({'where':{'id':_0x225804[_0xa972('0x63')]['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x10f5bd,null))[_0xa972('0x1f')](function(_0x8005d6){if(_0x8005d6){return _0x8005d6[_0xa972('0xbc')](_0x225804[_0xa972('0x5d')][_0xa972('0x6c')],_[_0xa972('0x72')](_0x225804[_0xa972('0x5d')],['ids','id'])||{})[_0xa972('0xb6')](function(_0x160f41){for(var _0x356cec=0x0;_0x356cec<_0x225804['body']['ids'][_0xa972('0x49')];_0x356cec+=0x1){socket[_0xa972('0xbd')](_0xa972('0xbe'),{'UserId':_0x225804['body'][_0xa972('0x6c')][_0x356cec],'FaxAccountId':_0x225804[_0xa972('0x63')]['id']});}return _0x160f41;});}})[_0xa972('0x1f')](respondWithResult(_0x10f5bd,null))[_0xa972('0x29')](handleError(_0x10f5bd,null));};exports[_0xa972('0xbf')]=function(_0x3b577c,_0x433eb0,_0x1ca4f8){return db[_0xa972('0x56')][_0xa972('0x5b')]({'where':{'id':_0x3b577c[_0xa972('0x63')]['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x433eb0,null))[_0xa972('0x1f')](function(_0x5e1186){if(_0x5e1186){return _0x5e1186[_0xa972('0xbf')](_0x3b577c['query'][_0xa972('0x6c')])[_0xa972('0x1f')](function(){if(_[_0xa972('0xc0')](_0x3b577c[_0xa972('0x44')][_0xa972('0x6c')])){for(var _0x1fc85a=0x0;_0x1fc85a<_0x3b577c[_0xa972('0x44')][_0xa972('0x6c')][_0xa972('0x49')];_0x1fc85a+=0x1){socket[_0xa972('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x3b577c[_0xa972('0x44')]['ids'][_0x1fc85a]),'FaxAccountId':Number(_0x3b577c[_0xa972('0x63')]['id'])});}}else{socket[_0xa972('0xbd')](_0xa972('0xc1'),{'UserId':Number(_0x3b577c[_0xa972('0x44')][_0xa972('0x6c')]),'FaxAccountId':Number(_0x3b577c[_0xa972('0x63')]['id'])});}});}})[_0xa972('0x1f')](respondWithStatusCode(_0x433eb0,null))['catch'](handleError(_0x433eb0,null));};exports[_0xa972('0xc2')]=function(_0x33ee31,_0x44eaf7,_0x103b67){var _0x53a748={};var _0x3de826={};var _0x161b03;var _0x68b4c4;return db['FaxAccount'][_0xa972('0x68')]({'where':{'id':_0x33ee31['params']['id']}})[_0xa972('0x1f')](handleEntityNotFound(_0x44eaf7,null))[_0xa972('0x1f')](function(_0x107305){if(_0x107305){_0x161b03=_0x107305;_0x3de826[_0xa972('0x43')]=_[_0xa972('0x59')](db[_0xa972('0x76')][_0xa972('0x3f')]);_0x3de826[_0xa972('0x44')]=_[_0xa972('0x59')](_0x33ee31[_0xa972('0x44')]);_0x3de826[_0xa972('0x45')]=_[_0xa972('0x46')](_0x3de826[_0xa972('0x43')],_0x3de826[_0xa972('0x44')]);_0x53a748[_0xa972('0x47')]=_[_0xa972('0x46')](_0x3de826[_0xa972('0x43')],qs[_0xa972('0x48')](_0x33ee31[_0xa972('0x44')][_0xa972('0x48')]));_0x53a748[_0xa972('0x47')]=_0x53a748['attributes'][_0xa972('0x49')]?_0x53a748[_0xa972('0x47')]:_0x3de826[_0xa972('0x43')];_0x53a748[_0xa972('0x4c')]=qs[_0xa972('0x4d')](_0x33ee31[_0xa972('0x44')][_0xa972('0x4d')]);_0x53a748['where']=qs[_0xa972('0x45')](_[_0xa972('0x4f')](_0x33ee31[_0xa972('0x44')],_0x3de826[_0xa972('0x45')]));if(_0x33ee31['query'][_0xa972('0x52')]){_0x53a748[_0xa972('0x4e')]=_[_0xa972('0x50')](_0x53a748[_0xa972('0x4e')],{'$or':_['map'](_0x53a748['attributes'],function(_0xbbb900){var _0x3a68a1={};_0x3a68a1[_0xbbb900]={'$like':'%'+_0x33ee31['query'][_0xa972('0x52')]+'%'};return _0x3a68a1;})});}_0x53a748=_[_0xa972('0x50')]({},_0x53a748,_0x33ee31['options']);return _0x161b03[_0xa972('0xc2')](_0x53a748);}})[_0xa972('0x1f')](function(_0x3bb8ef){if(_0x3bb8ef){_0x68b4c4=_0x3bb8ef['length'];if(!_0x33ee31[_0xa972('0x44')]['hasOwnProperty'](_0xa972('0x69'))){_0x53a748['limit']=qs[_0xa972('0x4b')](_0x33ee31['query'][_0xa972('0x4b')]);_0x53a748[_0xa972('0x2d')]=qs[_0xa972('0x2d')](_0x33ee31[_0xa972('0x44')][_0xa972('0x2d')]);}return _0x161b03[_0xa972('0xc2')](_0x53a748);}})[_0xa972('0x1f')](function(_0x131831){if(_0x131831){return _0x131831?{'count':_0x68b4c4,'rows':_0x131831}:null;}})[_0xa972('0x1f')](respondWithResult(_0x44eaf7,null))[_0xa972('0x29')](handleError(_0x44eaf7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4596c05..ed444f3 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 _0x8bc8=['update','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x5506ac,_0x2254ee){var _0x2ae1c7=function(_0x99c9f9){while(--_0x99c9f9){_0x5506ac['push'](_0x5506ac['shift']());}};_0x2ae1c7(++_0x2254ee);}(_0x8bc8,0xc4));var _0x88bc=function(_0x418c3a,_0xafc508){_0x418c3a=_0x418c3a-0x0;var _0x5ebf73=_0x8bc8[_0x418c3a];return _0x5ebf73;};'use strict';var EventEmitter=require(_0x88bc('0x0'));var FaxAccount=require(_0x88bc('0x1'))['db'][_0x88bc('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x88bc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x88bc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d3509){return function(_0x5141d6,_0x49057f,_0x6a6b59){FaxAccountEvents['emit'](_0x4d3509+':'+_0x5141d6['id'],_0x5141d6);FaxAccountEvents[_0x88bc('0x5')](_0x4d3509,_0x5141d6);_0x6a6b59(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x88bc('0x6')](e,emitEvent(event));}}module[_0x88bc('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xd55b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x16b0d4,_0x103f31){var _0x810c45=function(_0x1a725a){while(--_0x1a725a){_0x16b0d4['push'](_0x16b0d4['shift']());}};_0x810c45(++_0x103f31);}(_0xd55b,0x119));var _0xbd55=function(_0x172012,_0x5f3400){_0x172012=_0x172012-0x0;var _0x284f99=_0xd55b[_0x172012];return _0x284f99;};'use strict';var EventEmitter=require(_0xbd55('0x0'));var FaxAccount=require(_0xbd55('0x1'))['db'][_0xbd55('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xbd55('0x3')](0x0);var events={'afterCreate':_0xbd55('0x4'),'afterUpdate':_0xbd55('0x5'),'afterDestroy':_0xbd55('0x6')};function emitEvent(_0x4c3fd1){return function(_0x6b8002,_0x38da4b,_0x578967){FaxAccountEvents[_0xbd55('0x7')](_0x4c3fd1+':'+_0x6b8002['id'],_0x6b8002);FaxAccountEvents[_0xbd55('0x7')](_0x4c3fd1,_0x6b8002);_0x578967(null);};}for(var e in events){if(events[_0xbd55('0x8')](e)){var event=events[e];FaxAccount[_0xbd55('0x9')](e,emitEvent(event));}}module[_0xbd55('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 3c805d1..683a7e3 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 _0x7a87=['path','rimraf','./faxAccount.attributes','exports','FaxAccount','fax_accounts','util','../../config/logger','api','request-promise'];(function(_0x2ab50a,_0x1184bf){var _0x4e54b0=function(_0x508e66){while(--_0x508e66){_0x2ab50a['push'](_0x2ab50a['shift']());}};_0x4e54b0(++_0x1184bf);}(_0x7a87,0xe2));var _0x77a8=function(_0x276076,_0x4d9d3a){_0x276076=_0x276076-0x0;var _0x385642=_0x7a87[_0x276076];return _0x385642;};'use strict';var _=require('lodash');var util=require(_0x77a8('0x0'));var logger=require(_0x77a8('0x1'))(_0x77a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x77a8('0x3'));var fs=require('fs');var path=require(_0x77a8('0x4'));var rimraf=require(_0x77a8('0x5'));var config=require('../../config/environment');var attributes=require(_0x77a8('0x6'));module[_0x77a8('0x7')]=function(_0x78a3d,_0x10aad3){return _0x78a3d['define'](_0x77a8('0x8'),attributes,{'tableName':_0x77a8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bb8=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','fax_accounts','util','../../config/logger','moment','request-promise'];(function(_0x3ea128,_0x298f3d){var _0x5c46bf=function(_0x278d52){while(--_0x278d52){_0x3ea128['push'](_0x3ea128['shift']());}};_0x5c46bf(++_0x298f3d);}(_0x7bb8,0x1dc));var _0x87bb=function(_0x153c3a,_0x34b730){_0x153c3a=_0x153c3a-0x0;var _0x5a1f7a=_0x7bb8[_0x153c3a];return _0x5a1f7a;};'use strict';var _=require('lodash');var util=require(_0x87bb('0x0'));var logger=require(_0x87bb('0x1'))('api');var moment=require(_0x87bb('0x2'));var BPromise=require('bluebird');var rp=require(_0x87bb('0x3'));var fs=require('fs');var path=require(_0x87bb('0x4'));var rimraf=require(_0x87bb('0x5'));var config=require(_0x87bb('0x6'));var attributes=require(_0x87bb('0x7'));module[_0x87bb('0x8')]=function(_0x131193,_0x2cdb55){return _0x131193['define']('FaxAccount',attributes,{'tableName':_0x87bb('0x9'),'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 f72609c..a2e9322 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 _0xc196=['../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxAccount','options','raw','attributes','include','map','model','then','debug','GetFaxAccount','catch','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','get','applications','list','List','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','UserId','name','interaction','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x451a2a,_0x1266c5){var _0x3a9b24=function(_0x41e7e8){while(--_0x41e7e8){_0x451a2a['push'](_0x451a2a['shift']());}};_0x3a9b24(++_0x1266c5);}(_0xc196,0x15d));var _0x6c19=function(_0x5589cb,_0x2a71e9){_0x5589cb=_0x5589cb-0x0;var _0x2399b0=_0xc196[_0x5589cb];return _0x2399b0;};'use strict';var _=require(_0x6c19('0x0'));var util=require(_0x6c19('0x1'));var moment=require(_0x6c19('0x2'));var BPromise=require(_0x6c19('0x3'));var rs=require(_0x6c19('0x4'));var fs=require('fs');var Redis=require(_0x6c19('0x5'));var db=require(_0x6c19('0x6'))['db'];var utils=require(_0x6c19('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c19('0x8'));var jayson=require(_0x6c19('0x9'));var client=jayson[_0x6c19('0xa')][_0x6c19('0xb')]({'port':0x232c});config[_0x6c19('0xc')]=_[_0x6c19('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c19('0xe'))(new Redis(config['redis']));require(_0x6c19('0xf'))['register'](socket);function respondWithRpcPromise(_0x534896,_0x17c3ba,_0x1c60c4){return new BPromise(function(_0x47ec2a,_0x194267){return client[_0x6c19('0x10')](_0x534896,_0x1c60c4)['then'](function(_0x207ea6){logger[_0x6c19('0x11')](_0x6c19('0x12'),_0x17c3ba,'request\x20sent');logger['debug'](_0x6c19('0x13'),_0x17c3ba,_0x6c19('0x14'),JSON[_0x6c19('0x15')](_0x207ea6));if(_0x207ea6[_0x6c19('0x16')]){if(_0x207ea6[_0x6c19('0x16')][_0x6c19('0x17')]===0x1f4){logger[_0x6c19('0x16')]('FaxAccount,\x20%s,\x20%s',_0x17c3ba,_0x207ea6[_0x6c19('0x16')][_0x6c19('0x18')]);return _0x194267(_0x207ea6[_0x6c19('0x16')][_0x6c19('0x18')]);}logger[_0x6c19('0x16')](_0x6c19('0x12'),_0x17c3ba,_0x207ea6[_0x6c19('0x16')][_0x6c19('0x18')]);return _0x47ec2a(_0x207ea6[_0x6c19('0x16')]['message']);}else{logger['info'](_0x6c19('0x12'),_0x17c3ba,_0x6c19('0x14'));_0x47ec2a(_0x207ea6['result'][_0x6c19('0x18')]);}})['catch'](function(_0x40beb9){logger[_0x6c19('0x16')](_0x6c19('0x12'),_0x17c3ba,_0x40beb9);_0x194267(_0x40beb9);});});}exports['GetFaxAccount']=function(_0x1a2650){var _0x5e63b5=this;return new Promise(function(_0x19e647,_0x82f413){return db[_0x6c19('0x19')]['findAll']({'raw':_0x1a2650[_0x6c19('0x1a')]?_0x1a2650['options'][_0x6c19('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a2650[_0x6c19('0x1a')]?_0x1a2650[_0x6c19('0x1a')]['where']||null:null,'attributes':_0x1a2650[_0x6c19('0x1a')]?_0x1a2650[_0x6c19('0x1a')][_0x6c19('0x1c')]||null:null,'limit':_0x1a2650['options']?_0x1a2650['options']['limit']||null:null,'include':_0x1a2650['options']?_0x1a2650[_0x6c19('0x1a')][_0x6c19('0x1d')]?_[_0x6c19('0x1e')](_0x1a2650[_0x6c19('0x1a')][_0x6c19('0x1d')],function(_0x38cf7e){return{'model':db[_0x38cf7e['model']],'as':_0x38cf7e['as'],'attributes':_0x38cf7e[_0x6c19('0x1c')],'include':_0x38cf7e[_0x6c19('0x1d')]?_[_0x6c19('0x1e')](_0x38cf7e[_0x6c19('0x1d')],function(_0x591eb3){return{'model':db[_0x591eb3['model']],'as':_0x591eb3['as'],'attributes':_0x591eb3[_0x6c19('0x1c')],'include':_0x591eb3[_0x6c19('0x1d')]?_[_0x6c19('0x1e')](_0x591eb3['include'],function(_0x2a8d22){return{'model':db[_0x2a8d22[_0x6c19('0x1f')]],'as':_0x2a8d22['as'],'attributes':_0x2a8d22[_0x6c19('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6c19('0x20')](function(_0x17c42e){logger['info']('GetFaxAccount',_0x1a2650);logger[_0x6c19('0x21')](_0x6c19('0x22'),_0x1a2650,JSON['stringify'](_0x17c42e));_0x19e647(_0x17c42e);})[_0x6c19('0x23')](function(_0x45e02d){logger[_0x6c19('0x16')](_0x6c19('0x22'),_0x45e02d[_0x6c19('0x18')],_0x1a2650);_0x82f413(_0x5e63b5[_0x6c19('0x16')](0x1f4,_0x45e02d[_0x6c19('0x18')]));});});};exports[_0x6c19('0x24')]=function(_0x3d2a2d,_0x5f065f,_0x34d14c){var _0xe66d2=this;return new Promise(function(_0x2f42f8,_0x2be580){var _0x2d20f5={'body':_0x3d2a2d[_0x6c19('0x25')],'channel':_0x6c19('0x26')};var _0x584a5d=[];var _0x507f8e=[];var _0x584608={};return db['CmContact'][_0x6c19('0x27')]()[_0x6c19('0x20')](function(_0x36ce4a){if(!_0x36ce4a){throw new db[(_0x6c19('0x28'))][(_0x6c19('0x29'))]('no\x20available\x20attributes');}_0x584a5d=_[_0x6c19('0x2a')](_[_0x6c19('0x2b')](_0x36ce4a),[_0x6c19('0x2c'),_0x6c19('0x2d')]);_0x507f8e=_['difference'](_[_0x6c19('0x2b')](_0x36ce4a),['createdAt',_0x6c19('0x2d'),_0x6c19('0x2e'),_0x6c19('0x2f')]);if(_0x3d2a2d['body']['id']){delete _0x3d2a2d[_0x6c19('0x25')]['id'];}if(_[_0x6c19('0x30')](_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x31')])){throw new db[(_0x6c19('0x28'))][(_0x6c19('0x29'))]('from\x20is\x20mandatory');}if(_[_0x6c19('0x30')](_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x25')])||_0x3d2a2d['body']['body']===''){throw new db[(_0x6c19('0x28'))]['ValidationError'](_0x6c19('0x32'));}if(_[_0x6c19('0x30')](_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x33')])){throw new db[(_0x6c19('0x28'))][(_0x6c19('0x29'))](_0x6c19('0x34')+_0x507f8e);}if(!_['includes'](_0x507f8e,_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x33')])){throw new db[(_0x6c19('0x28'))][(_0x6c19('0x29'))](_0x6c19('0x35')+_0x507f8e);}_0x584608[_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x33')]]=_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x31')];})[_0x6c19('0x20')](function(){return db[_0x6c19('0x19')][_0x6c19('0x36')]({'where':{'id':_0x3d2a2d[_0x6c19('0x37')]['id']},'include':[{'model':db[_0x6c19('0x38')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6c19('0x39'),'where':_0x584608,'limit':0x1,'order':[[_0x6c19('0x2d'),_0x6c19('0x3a')]]}]},{'model':db[_0x6c19('0x3b')],'as':_0x6c19('0x3c')}]});})[_0x6c19('0x20')](function(_0x3d9278){if(_0x3d9278&&_0x3d9278['List']){var _0x4101c=_0x3d9278[_0x6c19('0x3d')]({'plain':!![]});_0x2d20f5[_0x6c19('0x37')]=_0x4101c;_0x2d20f5[_0x6c19('0x3e')]=_0x4101c[_0x6c19('0x3c')];_0x2d20f5[_0x6c19('0x3f')]=_0x4101c[_0x6c19('0x40')];_0x2d20f5[_0x6c19('0x3e')]=_[_0x6c19('0x41')](_0x2d20f5[_0x6c19('0x3e')],[_0x6c19('0x42')],[_0x6c19('0x43')]);if(_0x2d20f5[_0x6c19('0x37')][_0x6c19('0x3c')]){delete _0x2d20f5[_0x6c19('0x37')][_0x6c19('0x3c')];}if(_0x2d20f5[_0x6c19('0x37')][_0x6c19('0x40')]&&_0x2d20f5['account'][_0x6c19('0x40')]['Contacts'][_0x6c19('0x44')]){return _0x2d20f5['account'][_0x6c19('0x40')]['Contacts'][0x0];}var _0x44099d=_['defaults'](_0x3d2a2d[_0x6c19('0x25')],{'firstName':_0x3d2a2d['body'][_0x6c19('0x31')],'ListId':_0x4101c[_0x6c19('0x2f')]});_0x44099d[_0x3d2a2d[_0x6c19('0x25')][_0x6c19('0x33')]]=_0x3d2a2d['body'][_0x6c19('0x31')];return db['CmContact'][_0x6c19('0x45')](_0x44099d,{'fields':_0x584a5d,'raw':!![]});}})['then'](function(_0x15576c){_0x2d20f5[_0x6c19('0x46')]=_0x15576c;if(_0x15576c){var _0x32c6e4={'ContactId':_0x15576c['id'],'FaxAccountId':_0x3d2a2d[_0x6c19('0x37')]['id'],'fax':_0x15576c['fax']};return db[_0x6c19('0x47')][_0x6c19('0x36')]({'where':{'ContactId':_0x15576c['id'],'closed':![],'FaxAccountId':_0x3d2a2d[_0x6c19('0x37')]['id']}})[_0x6c19('0x20')](function(_0x77e9b2){if(_0x77e9b2){return[_0x77e9b2,![]];}return db[_0x6c19('0x47')]['create'](_0x32c6e4)[_0x6c19('0x20')](function(_0x269346){return[_0x269346,!![]];});});}else{throw new Error(_0x6c19('0x48'));}})[_0x6c19('0x49')](function(_0x5c54ef,_0x3b0018){var _0x33d1d2=_0x5c54ef[_0x6c19('0x3d')]({'plain':!![]});if(_0x3b0018){if(_0x2d20f5[_0x6c19('0x37')][_0x6c19('0x4a')]){_0x2d20f5[_0x6c19('0x3e')][_0x6c19('0x4b')]({'id':0x0,'priority':_0x2d20f5[_0x6c19('0x3e')][_0x6c19('0x44')]+0x1,'app':_0x6c19('0x4c'),'appdata':_0x6c19('0x4d'),'interval':'*,*,*,*'});}_0x33d1d2[_0x6c19('0x4e')]=!![];}else{_0x33d1d2['created']=![];}_0x2d20f5['interaction']=_0x33d1d2;return db['FaxMessage'][_0x6c19('0x45')]({'body':_0x3d2a2d[_0x6c19('0x25')]['body'],'FaxAccountId':_0x3d2a2d[_0x6c19('0x37')]['id'],'FaxInteractionId':_0x5c54ef['id'],'direction':'in','ContactId':_0x5c54ef[_0x6c19('0x4f')],'AttachmentId':_0x3d2a2d['body'][_0x6c19('0x50')]});})[_0x6c19('0x20')](function(_0x13aed0){_0x2d20f5[_0x6c19('0x18')]=_0x13aed0;if(_0x2d20f5['interaction'][_0x6c19('0x51')]){return db['User'][_0x6c19('0x36')]({'attributes':['id',_0x6c19('0x52')],'where':{'id':_0x2d20f5[_0x6c19('0x53')][_0x6c19('0x51')]}})['then'](function(_0x482911){if(_0x482911){_0x2d20f5[_0x6c19('0x3e')][_0x6c19('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x482911[_0x6c19('0x52')]+','+(_0x2d20f5[_0x6c19('0x37')][_0x6c19('0x55')]||0xa),'interval':_0x6c19('0x56')});}return respondWithRpcPromise(_0x6c19('0x57'),_0x6c19('0x58'),_0x2d20f5);});}return respondWithRpcPromise(_0x6c19('0x57'),_0x6c19('0x58'),_0x2d20f5);})[_0x6c19('0x20')](function(_0xd59fc2){_0x2f42f8(_0xd59fc2);})[_0x6c19('0x23')](function(_0x32e72a){_0x2be580(_0xe66d2[_0x6c19('0x16')](0x1f4,_0x32e72a[_0x6c19('0x18')]));});});}; \ No newline at end of file +var _0xbc38=['redis','defaults','localhost','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','model','map','then','catch','NotifyFaxAccount','body','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmContact','Contacts','DESC','Applications','List','get','applications','priority','asc','length','ListId','contact','fax','find','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','create','AttachmentId','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xbc38,0x157));var _0x8bc3=function(_0x4cb618,_0x3226c8){_0x4cb618=_0x4cb618-0x0;var _0x49570a=_0xbc38[_0x4cb618];return _0x49570a;};'use strict';var _=require('lodash');var util=require(_0x8bc3('0x0'));var moment=require(_0x8bc3('0x1'));var BPromise=require(_0x8bc3('0x2'));var rs=require(_0x8bc3('0x3'));var fs=require('fs');var Redis=require(_0x8bc3('0x4'));var db=require(_0x8bc3('0x5'))['db'];var utils=require(_0x8bc3('0x6'));var logger=require(_0x8bc3('0x7'))(_0x8bc3('0x8'));var config=require(_0x8bc3('0x9'));var jayson=require(_0x8bc3('0xa'));var client=jayson[_0x8bc3('0xb')][_0x8bc3('0xc')]({'port':0x232c});config[_0x8bc3('0xd')]=_[_0x8bc3('0xe')](config[_0x8bc3('0xd')],{'host':_0x8bc3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bc3('0xd')]));require('./faxAccount.socket')[_0x8bc3('0x10')](socket);function respondWithRpcPromise(_0x1b8647,_0x57db17,_0x1dbae3){return new BPromise(function(_0x5e6995,_0x1ef966){return client[_0x8bc3('0x11')](_0x1b8647,_0x1dbae3)['then'](function(_0x503088){logger[_0x8bc3('0x12')](_0x8bc3('0x13'),_0x57db17,_0x8bc3('0x14'));logger[_0x8bc3('0x15')](_0x8bc3('0x16'),_0x57db17,_0x8bc3('0x14'),JSON[_0x8bc3('0x17')](_0x503088));if(_0x503088[_0x8bc3('0x18')]){if(_0x503088[_0x8bc3('0x18')]['code']===0x1f4){logger['error'](_0x8bc3('0x13'),_0x57db17,_0x503088[_0x8bc3('0x18')][_0x8bc3('0x19')]);return _0x1ef966(_0x503088['error']['message']);}logger[_0x8bc3('0x18')]('FaxAccount,\x20%s,\x20%s',_0x57db17,_0x503088[_0x8bc3('0x18')][_0x8bc3('0x19')]);return _0x5e6995(_0x503088[_0x8bc3('0x18')][_0x8bc3('0x19')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x57db17,'request\x20sent');_0x5e6995(_0x503088[_0x8bc3('0x1a')][_0x8bc3('0x19')]);}})['catch'](function(_0x226a56){logger[_0x8bc3('0x18')]('FaxAccount,\x20%s,\x20%s',_0x57db17,_0x226a56);_0x1ef966(_0x226a56);});});}exports[_0x8bc3('0x1b')]=function(_0x1de049){var _0x4701f1=this;return new Promise(function(_0x3ddc06,_0xc70210){return db[_0x8bc3('0x1c')]['findAll']({'raw':_0x1de049[_0x8bc3('0x1d')]?_0x1de049[_0x8bc3('0x1d')][_0x8bc3('0x1e')]===undefined?!![]:![]:!![],'where':_0x1de049[_0x8bc3('0x1d')]?_0x1de049['options'][_0x8bc3('0x1f')]||null:null,'attributes':_0x1de049[_0x8bc3('0x1d')]?_0x1de049[_0x8bc3('0x1d')][_0x8bc3('0x20')]||null:null,'limit':_0x1de049[_0x8bc3('0x1d')]?_0x1de049[_0x8bc3('0x1d')][_0x8bc3('0x21')]||null:null,'include':_0x1de049['options']?_0x1de049['options'][_0x8bc3('0x22')]?_['map'](_0x1de049['options'][_0x8bc3('0x22')],function(_0x3aadb9){return{'model':db[_0x3aadb9[_0x8bc3('0x23')]],'as':_0x3aadb9['as'],'attributes':_0x3aadb9[_0x8bc3('0x20')],'include':_0x3aadb9['include']?_['map'](_0x3aadb9['include'],function(_0x39fdbb){return{'model':db[_0x39fdbb[_0x8bc3('0x23')]],'as':_0x39fdbb['as'],'attributes':_0x39fdbb[_0x8bc3('0x20')],'include':_0x39fdbb[_0x8bc3('0x22')]?_[_0x8bc3('0x24')](_0x39fdbb['include'],function(_0x2c4387){return{'model':db[_0x2c4387[_0x8bc3('0x23')]],'as':_0x2c4387['as'],'attributes':_0x2c4387[_0x8bc3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8bc3('0x25')](function(_0x47d468){logger[_0x8bc3('0x12')](_0x8bc3('0x1b'),_0x1de049);logger[_0x8bc3('0x15')](_0x8bc3('0x1b'),_0x1de049,JSON['stringify'](_0x47d468));_0x3ddc06(_0x47d468);})[_0x8bc3('0x26')](function(_0xdaa6b1){logger['error']('GetFaxAccount',_0xdaa6b1[_0x8bc3('0x19')],_0x1de049);_0xc70210(_0x4701f1[_0x8bc3('0x18')](0x1f4,_0xdaa6b1[_0x8bc3('0x19')]));});});};exports[_0x8bc3('0x27')]=function(_0x1e16de,_0x2631d9,_0x508bbc){var _0x494221=this;return new Promise(function(_0x14f0a2,_0x2baa44){var _0x37d8d3={'body':_0x1e16de[_0x8bc3('0x28')],'channel':'fax'};var _0x4f882d=[];var _0x4b2068=[];var _0x29085f={};return db['CmContact'][_0x8bc3('0x29')]()[_0x8bc3('0x25')](function(_0x5ab618){if(!_0x5ab618){throw new db[(_0x8bc3('0x2a'))][(_0x8bc3('0x2b'))](_0x8bc3('0x2c'));}_0x4f882d=_[_0x8bc3('0x2d')](_[_0x8bc3('0x2e')](_0x5ab618),[_0x8bc3('0x2f'),_0x8bc3('0x30')]);_0x4b2068=_[_0x8bc3('0x2d')](_['keys'](_0x5ab618),['createdAt',_0x8bc3('0x30'),_0x8bc3('0x31'),'ListId']);if(_0x1e16de[_0x8bc3('0x28')]['id']){delete _0x1e16de[_0x8bc3('0x28')]['id'];}if(_[_0x8bc3('0x32')](_0x1e16de[_0x8bc3('0x28')][_0x8bc3('0x33')])){throw new db[(_0x8bc3('0x2a'))][(_0x8bc3('0x2b'))]('from\x20is\x20mandatory');}if(_[_0x8bc3('0x32')](_0x1e16de['body'][_0x8bc3('0x28')])||_0x1e16de['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0x8bc3('0x34'));}if(_[_0x8bc3('0x32')](_0x1e16de['body'][_0x8bc3('0x35')])){throw new db[(_0x8bc3('0x2a'))][(_0x8bc3('0x2b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b2068);}if(!_[_0x8bc3('0x36')](_0x4b2068,_0x1e16de[_0x8bc3('0x28')][_0x8bc3('0x35')])){throw new db['Sequelize'][(_0x8bc3('0x2b'))](_0x8bc3('0x37')+_0x4b2068);}_0x29085f[_0x1e16de[_0x8bc3('0x28')][_0x8bc3('0x35')]]=_0x1e16de['body'][_0x8bc3('0x33')];})['then'](function(){return db[_0x8bc3('0x1c')]['find']({'where':{'id':_0x1e16de[_0x8bc3('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8bc3('0x39')],'as':_0x8bc3('0x3a'),'where':_0x29085f,'limit':0x1,'order':[[_0x8bc3('0x30'),_0x8bc3('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0x8bc3('0x3c')}]});})[_0x8bc3('0x25')](function(_0x5ecfeb){if(_0x5ecfeb&&_0x5ecfeb[_0x8bc3('0x3d')]){var _0x5d8464=_0x5ecfeb[_0x8bc3('0x3e')]({'plain':!![]});_0x37d8d3[_0x8bc3('0x38')]=_0x5d8464;_0x37d8d3['applications']=_0x5d8464[_0x8bc3('0x3c')];_0x37d8d3['list']=_0x5d8464[_0x8bc3('0x3d')];_0x37d8d3['applications']=_['orderBy'](_0x37d8d3[_0x8bc3('0x3f')],[_0x8bc3('0x40')],[_0x8bc3('0x41')]);if(_0x37d8d3['account'][_0x8bc3('0x3c')]){delete _0x37d8d3[_0x8bc3('0x38')]['Applications'];}if(_0x37d8d3[_0x8bc3('0x38')][_0x8bc3('0x3d')]&&_0x37d8d3[_0x8bc3('0x38')][_0x8bc3('0x3d')][_0x8bc3('0x3a')][_0x8bc3('0x42')]){return _0x37d8d3[_0x8bc3('0x38')][_0x8bc3('0x3d')][_0x8bc3('0x3a')][0x0];}var _0x369976=_[_0x8bc3('0xe')](_0x1e16de['body'],{'firstName':_0x1e16de[_0x8bc3('0x28')][_0x8bc3('0x33')],'ListId':_0x5d8464[_0x8bc3('0x43')]});_0x369976[_0x1e16de[_0x8bc3('0x28')][_0x8bc3('0x35')]]=_0x1e16de['body'][_0x8bc3('0x33')];return db[_0x8bc3('0x39')]['create'](_0x369976,{'fields':_0x4f882d,'raw':!![]});}})[_0x8bc3('0x25')](function(_0x416ab1){_0x37d8d3[_0x8bc3('0x44')]=_0x416ab1;if(_0x416ab1){var _0x25d0d1={'ContactId':_0x416ab1['id'],'FaxAccountId':_0x1e16de['account']['id'],'fax':_0x416ab1[_0x8bc3('0x45')]};return db['FaxInteraction'][_0x8bc3('0x46')]({'where':{'ContactId':_0x416ab1['id'],'closed':![],'FaxAccountId':_0x1e16de['account']['id']}})[_0x8bc3('0x25')](function(_0x31c707){if(_0x31c707){return[_0x31c707,![]];}return db[_0x8bc3('0x47')]['create'](_0x25d0d1)['then'](function(_0x525368){return[_0x525368,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8bc3('0x48')](function(_0x862754,_0x209f36){var _0x4f71a0=_0x862754[_0x8bc3('0x3e')]({'plain':!![]});if(_0x209f36){if(_0x37d8d3[_0x8bc3('0x38')][_0x8bc3('0x49')]){_0x37d8d3[_0x8bc3('0x3f')][_0x8bc3('0x4a')]({'id':0x0,'priority':_0x37d8d3[_0x8bc3('0x3f')][_0x8bc3('0x42')]+0x1,'app':_0x8bc3('0x4b'),'appdata':_0x8bc3('0x4c'),'interval':_0x8bc3('0x4d')});}_0x4f71a0['created']=!![];}else{_0x4f71a0[_0x8bc3('0x4e')]=![];}_0x37d8d3[_0x8bc3('0x4f')]=_0x4f71a0;return db['FaxMessage'][_0x8bc3('0x50')]({'body':_0x1e16de[_0x8bc3('0x28')][_0x8bc3('0x28')],'FaxAccountId':_0x1e16de['account']['id'],'FaxInteractionId':_0x862754['id'],'direction':'in','ContactId':_0x862754['ContactId'],'AttachmentId':_0x1e16de[_0x8bc3('0x28')][_0x8bc3('0x51')]});})[_0x8bc3('0x25')](function(_0x1d6cc2){_0x37d8d3[_0x8bc3('0x19')]=_0x1d6cc2;if(_0x37d8d3[_0x8bc3('0x4f')]['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x37d8d3[_0x8bc3('0x4f')][_0x8bc3('0x52')]}})[_0x8bc3('0x25')](function(_0x78d7bd){if(_0x78d7bd){_0x37d8d3['applications'][_0x8bc3('0x53')]({'id':0x0,'priority':0x0,'app':_0x8bc3('0x54'),'appdata':_0x78d7bd[_0x8bc3('0x55')]+','+(_0x37d8d3[_0x8bc3('0x38')][_0x8bc3('0x56')]||0xa),'interval':_0x8bc3('0x4d')});}return respondWithRpcPromise(_0x8bc3('0x57'),_0x8bc3('0x58'),_0x37d8d3);});}return respondWithRpcPromise(_0x8bc3('0x57'),_0x8bc3('0x58'),_0x37d8d3);})[_0x8bc3('0x25')](function(_0x33d360){_0x14f0a2(_0x33d360);})[_0x8bc3('0x26')](function(_0x21d280){_0x2baa44(_0x494221[_0x8bc3('0x18')](0x1f4,_0x21d280[_0x8bc3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cad25c4..0ef0bff 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 _0xe5af=['faxAccount:','save','remove','register','length'];(function(_0x423b90,_0x2db6fd){var _0x789911=function(_0x1294ff){while(--_0x1294ff){_0x423b90['push'](_0x423b90['shift']());}};_0x789911(++_0x2db6fd);}(_0xe5af,0x9c));var _0xfe5a=function(_0x27fe26,_0x3b8ca7){_0x27fe26=_0x27fe26-0x0;var _0x4fcb35=_0xe5af[_0x27fe26];return _0x4fcb35;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xfe5a('0x0'),_0xfe5a('0x1'),'update'];function createListener(_0x9a3743,_0x1bad12){return function(_0x23b7f0){_0x1bad12['emit'](_0x9a3743,_0x23b7f0);};}function removeListener(_0x1165e3,_0x48e3a7){return function(){FaxAccountEvents['removeListener'](_0x1165e3,_0x48e3a7);};}exports[_0xfe5a('0x2')]=function(_0x2039cd){for(var _0x4e418f=0x0,_0x5eea2e=events[_0xfe5a('0x3')];_0x4e418f<_0x5eea2e;_0x4e418f++){var _0x106492=events[_0x4e418f];var _0xfb4357=createListener(_0xfe5a('0x4')+_0x106492,_0x2039cd);FaxAccountEvents['on'](_0x106492,_0xfb4357);}}; \ No newline at end of file +var _0xb145=['register','length','faxAccount:','save','remove','update','emit','removeListener'];(function(_0x593467,_0x14e615){var _0x67a71b=function(_0x32799e){while(--_0x32799e){_0x593467['push'](_0x593467['shift']());}};_0x67a71b(++_0x14e615);}(_0xb145,0xa3));var _0x5b14=function(_0x1518f1,_0x45d7e6){_0x1518f1=_0x1518f1-0x0;var _0x95f148=_0xb145[_0x1518f1];return _0x95f148;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x5b14('0x0'),_0x5b14('0x1'),_0x5b14('0x2')];function createListener(_0x1298e7,_0x40609d){return function(_0x3defa8){_0x40609d[_0x5b14('0x3')](_0x1298e7,_0x3defa8);};}function removeListener(_0x34b4cd,_0x5111cd){return function(){FaxAccountEvents[_0x5b14('0x4')](_0x34b4cd,_0x5111cd);};}exports[_0x5b14('0x5')]=function(_0x392425){for(var _0x4d82ad=0x0,_0x50fd91=events[_0x5b14('0x6')];_0x4d82ad<_0x50fd91;_0x4d82ad++){var _0x2a3921=events[_0x4d82ad];var _0x34530a=createListener(_0x5b14('0x7')+_0x2a3921,_0x392425);FaxAccountEvents['on'](_0x2a3921,_0x34530a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index bb791eb..340db83 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 _0xf0bf=['/:id/messages','getMessages','/:id/users','post','create','addDisposition','addInteraction','/addaccountapplications','/updateaccountapplications','/:id/send','send','addAgents','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications'];(function(_0x140688,_0x362b7d){var _0x4a3d28=function(_0x489506){while(--_0x489506){_0x140688['push'](_0x140688['shift']());}};_0x4a3d28(++_0x362b7d);}(_0xf0bf,0x88));var _0xff0b=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf0bf[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0xff0b('0x0'));var util=require(_0xff0b('0x1'));var path=require(_0xff0b('0x2'));var timeout=require(_0xff0b('0x3'));var express=require(_0xff0b('0x4'));var router=express[_0xff0b('0x5')]();var auth=require(_0xff0b('0x6'));var interaction=require(_0xff0b('0x7'));var config=require(_0xff0b('0x8'));var controller=require(_0xff0b('0x9'));router[_0xff0b('0xa')]('/',auth[_0xff0b('0xb')](),controller[_0xff0b('0xc')]);router['get'](_0xff0b('0xd'),auth['isAuthenticated'](),controller[_0xff0b('0xe')]);router[_0xff0b('0xa')](_0xff0b('0xf'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x10')]);router[_0xff0b('0xa')](_0xff0b('0x11'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x12')]);router[_0xff0b('0xa')](_0xff0b('0x13'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x14')]);router[_0xff0b('0xa')](_0xff0b('0x15'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x16')]);router['get'](_0xff0b('0x17'),auth[_0xff0b('0xb')](),controller['getApplications']);router['get'](_0xff0b('0x18'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x19')]);router['get'](_0xff0b('0x1a'),auth[_0xff0b('0xb')](),controller['getAgents']);router[_0xff0b('0x1b')]('/',auth[_0xff0b('0xb')](),controller[_0xff0b('0x1c')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xff0b('0x1d')]);router[_0xff0b('0x1b')](_0xff0b('0x13'),auth[_0xff0b('0xb')](),controller['addAnswer']);router[_0xff0b('0x1b')](_0xff0b('0x15'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x1e')]);router[_0xff0b('0x1b')](_0xff0b('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0xff0b('0x1f'),auth[_0xff0b('0xb')](),controller['addAccountApplications']);router[_0xff0b('0x1b')](_0xff0b('0x20'),auth[_0xff0b('0xb')](),controller['updateAccountApplications']);router[_0xff0b('0x1b')](_0xff0b('0x21'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x22')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xff0b('0x23')]);router['put'](_0xff0b('0xf'),auth[_0xff0b('0xb')](),controller['update']);router[_0xff0b('0x24')](_0xff0b('0xf'),auth[_0xff0b('0xb')](),controller['destroy']);router[_0xff0b('0x24')](_0xff0b('0x11'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x25')]);router[_0xff0b('0x24')](_0xff0b('0x13'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x26')]);router['delete'](_0xff0b('0x1a'),auth[_0xff0b('0xb')](),controller[_0xff0b('0x27')]);module['exports']=router; \ No newline at end of file +var _0x641b=['addDisposition','addAnswer','addInteraction','addApplications','/updateaccountapplications','/:id/send','send','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create'];(function(_0xf1ed6,_0x5b967f){var _0x43037a=function(_0x24919e){while(--_0x24919e){_0xf1ed6['push'](_0xf1ed6['shift']());}};_0x43037a(++_0x5b967f);}(_0x641b,0x1d2));var _0xb641=function(_0x4c6c78,_0x1cea34){_0x4c6c78=_0x4c6c78-0x0;var _0x403a48=_0x641b[_0x4c6c78];return _0x403a48;};'use strict';var multer=require('multer');var util=require(_0xb641('0x0'));var path=require(_0xb641('0x1'));var timeout=require(_0xb641('0x2'));var express=require(_0xb641('0x3'));var router=express['Router']();var auth=require(_0xb641('0x4'));var interaction=require(_0xb641('0x5'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xb641('0x6')]('/',auth[_0xb641('0x7')](),controller[_0xb641('0x8')]);router[_0xb641('0x6')](_0xb641('0x9'),auth[_0xb641('0x7')](),controller[_0xb641('0xa')]);router[_0xb641('0x6')](_0xb641('0xb'),auth[_0xb641('0x7')](),controller[_0xb641('0xc')]);router[_0xb641('0x6')](_0xb641('0xd'),auth[_0xb641('0x7')](),controller[_0xb641('0xe')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb641('0xf')]);router[_0xb641('0x6')](_0xb641('0x10'),auth[_0xb641('0x7')](),controller[_0xb641('0x11')]);router[_0xb641('0x6')](_0xb641('0x12'),auth[_0xb641('0x7')](),controller[_0xb641('0x13')]);router[_0xb641('0x6')](_0xb641('0x14'),auth[_0xb641('0x7')](),controller[_0xb641('0x15')]);router[_0xb641('0x6')](_0xb641('0x16'),auth[_0xb641('0x7')](),controller[_0xb641('0x17')]);router[_0xb641('0x18')]('/',auth['isAuthenticated'](),controller[_0xb641('0x19')]);router['post']('/:id/dispositions',auth[_0xb641('0x7')](),controller[_0xb641('0x1a')]);router[_0xb641('0x18')]('/:id/canned_answers',auth[_0xb641('0x7')](),controller[_0xb641('0x1b')]);router[_0xb641('0x18')](_0xb641('0x10'),auth[_0xb641('0x7')](),controller[_0xb641('0x1c')]);router[_0xb641('0x18')](_0xb641('0x12'),auth[_0xb641('0x7')](),controller[_0xb641('0x1d')]);router[_0xb641('0x18')]('/addaccountapplications',auth[_0xb641('0x7')](),controller['addAccountApplications']);router['post'](_0xb641('0x1e'),auth[_0xb641('0x7')](),controller['updateAccountApplications']);router['post'](_0xb641('0x1f'),auth[_0xb641('0x7')](),controller[_0xb641('0x20')]);router['post'](_0xb641('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb641('0x21')](_0xb641('0xb'),auth[_0xb641('0x7')](),controller[_0xb641('0x22')]);router[_0xb641('0x23')](_0xb641('0xb'),auth[_0xb641('0x7')](),controller[_0xb641('0x24')]);router[_0xb641('0x23')](_0xb641('0xd'),auth['isAuthenticated'](),controller[_0xb641('0x25')]);router[_0xb641('0x23')](_0xb641('0x26'),auth[_0xb641('0x7')](),controller[_0xb641('0x27')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb641('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 1d3f2c1..3d1d1a5 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 _0xada4=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x5ef4f8,_0x3be741){var _0x555a8b=function(_0x2327b9){while(--_0x2327b9){_0x5ef4f8['push'](_0x5ef4f8['shift']());}};_0x555a8b(++_0x3be741);}(_0xada4,0x1bc));var _0x4ada=function(_0x156be3,_0x4793e1){_0x156be3=_0x156be3-0x0;var _0x146bd0=_0xada4[_0x156be3];return _0x146bd0;};'use strict';var Sequelize=require('sequelize');module[_0x4ada('0x0')]={'priority':{'type':Sequelize[_0x4ada('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4ada('0x2')],'allowNull':![],'defaultValue':_0x4ada('0x3')},'appdata':{'type':Sequelize[_0x4ada('0x4')]()},'description':{'type':Sequelize[_0x4ada('0x2')]},'interval':{'type':Sequelize[_0x4ada('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xee65=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5eea0c,_0x1a9c89){var _0x3cd6e0=function(_0x174b4f){while(--_0x174b4f){_0x5eea0c['push'](_0x5eea0c['shift']());}};_0x3cd6e0(++_0x1a9c89);}(_0xee65,0x138));var _0x5ee6=function(_0x3696c9,_0x27cc18){_0x3696c9=_0x3696c9-0x0;var _0x3a9c7f=_0xee65[_0x3696c9];return _0x3a9c7f;};'use strict';var Sequelize=require(_0x5ee6('0x0'));module[_0x5ee6('0x1')]={'priority':{'type':Sequelize[_0x5ee6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5ee6('0x3')],'allowNull':![],'defaultValue':_0x5ee6('0x4')},'appdata':{'type':Sequelize[_0x5ee6('0x5')]()},'description':{'type':Sequelize[_0x5ee6('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5ee6('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 390e604..87dbbac 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 _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x130d59,_0x22ee62){var _0x2ffd14=function(_0x19a194){while(--_0x19a194){_0x130d59['push'](_0x130d59['shift']());}};_0x2ffd14(++_0x22ee62);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3b2826,_0x53270e){_0x3b2826=_0x3b2826-0x0;var _0x5dcd12=_0x8ef6[_0x3b2826];return _0x5dcd12;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file +var _0xc4aa=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];function respondWithStatusCode(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0xcc;return function(_0x5e16aa){if(_0x5e16aa){return _0x2a0776[_0xac4a('0x16')](_0x24291d);}return _0x2a0776[_0xac4a('0x17')](_0x24291d)[_0xac4a('0x18')]();};}function respondWithResult(_0x6e00d4,_0x1b4313){_0x1b4313=_0x1b4313||0xc8;return function(_0x3b71c0){if(_0x3b71c0){return _0x6e00d4[_0xac4a('0x17')](_0x1b4313)[_0xac4a('0x19')](_0x3b71c0);}};}function respondWithFilteredResult(_0x190418,_0x42c7fc){return function(_0x11e101){if(_0x11e101){var _0x26dbb8=_0x11e101[_0xac4a('0x1a')],_0x4a2119=_0x42c7fc[_0xac4a('0x1b')],_0x402fff=_0x42c7fc[_0xac4a('0x1b')]+_0x42c7fc[_0xac4a('0x1c')],_0x34d797;if(_0x402fff>=_0x26dbb8){_0x402fff=_0x26dbb8;_0x34d797=0xc8;}else{_0x34d797=0xce;}_0x190418[_0xac4a('0x17')](_0x34d797);return _0x190418[_0xac4a('0x1d')]('Content-Range',_0x4a2119+'-'+_0x402fff+'/'+_0x26dbb8)['json'](_0x11e101);}return null;};}function patchUpdates(_0x21a729){return function(_0x13c8eb){try{jsonpatch[_0xac4a('0x1e')](_0x13c8eb,_0x21a729,!![]);}catch(_0x4d837c){return BPromise[_0xac4a('0x1f')](_0x4d837c);}return _0x13c8eb[_0xac4a('0x20')]();};}function saveUpdates(_0x3752e4,_0x3a3cdb){return function(_0x123694){if(_0x123694){return _0x123694[_0xac4a('0x21')](_0x3752e4)[_0xac4a('0x22')](function(_0x3ca790){return _0x3ca790;});}return null;};}function removeEntity(_0x534092,_0x3d8f0a){return function(_0x3204ad){if(_0x3204ad){return _0x3204ad['destroy']()[_0xac4a('0x22')](function(){_0x534092[_0xac4a('0x17')](0xcc)[_0xac4a('0x18')]();});}};}function handleEntityNotFound(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(!_0x1b7998){_0x947d8e[_0xac4a('0x16')](0x194);}return _0x1b7998;};}function handleError(_0x15435c,_0x412494){_0x412494=_0x412494||0x1f4;return function(_0x594f36){logger[_0xac4a('0x23')](_0x594f36[_0xac4a('0x24')]);if(_0x594f36[_0xac4a('0x25')]){delete _0x594f36[_0xac4a('0x25')];}_0x15435c[_0xac4a('0x17')](_0x412494)[_0xac4a('0x26')](_0x594f36);};}exports[_0xac4a('0x27')]=function(_0x14832b,_0x472c57){var _0x1c13dc={},_0x20202c={},_0x4e17ce={'count':0x0,'rows':[]};var _0x23b061=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x116700){return{'name':_0x116700['fieldName'],'type':_0x116700['type'][_0xac4a('0x2b')]};});_0x20202c[_0xac4a('0x2c')]=_[_0xac4a('0x28')](_0x23b061,'name');_0x20202c['query']=_[_0xac4a('0x2d')](_0x14832b[_0xac4a('0x2e')]);_0x20202c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x20202c[_0xac4a('0x2c')],_0x20202c['query']);_0x1c13dc[_0xac4a('0x31')]=_['intersection'](_0x20202c[_0xac4a('0x2c')],qs['fields'](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x1c13dc[_0xac4a('0x31')]=_0x1c13dc[_0xac4a('0x31')][_0xac4a('0x33')]?_0x1c13dc[_0xac4a('0x31')]:_0x20202c[_0xac4a('0x2c')];if(!_0x14832b[_0xac4a('0x2e')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x1c13dc[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x1c')]);_0x1c13dc['offset']=qs[_0xac4a('0x1b')](_0x14832b[_0xac4a('0x2e')]['offset']);}_0x1c13dc[_0xac4a('0x36')]=qs[_0xac4a('0x37')](_0x14832b['query']['sort']);_0x1c13dc[_0xac4a('0x38')]=qs[_0xac4a('0x2f')](_[_0xac4a('0x39')](_0x14832b[_0xac4a('0x2e')],_0x20202c['filters']),_0x23b061);if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]){_0x1c13dc['where']=_[_0xac4a('0x3b')](_0x1c13dc[_0xac4a('0x38')],{'$or':_[_0xac4a('0x28')](_0x23b061,function(_0x5f0eb8){if(_0x5f0eb8[_0xac4a('0x3c')]!==_0xac4a('0x3d')){var _0x1b5427={};_0x1b5427[_0x5f0eb8['name']]={'$like':'%'+_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]+'%'};return _0x1b5427;}})});}_0x1c13dc=_['merge']({},_0x1c13dc,_0x14832b['options']);var _0x4319a1={'where':_0x1c13dc['where']};return db['FaxApplication']['count'](_0x4319a1)['then'](function(_0x41b757){_0x4e17ce[_0xac4a('0x1a')]=_0x41b757;if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1c13dc[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x1c13dc);})[_0xac4a('0x22')](function(_0x28292c){_0x4e17ce[_0xac4a('0x41')]=_0x28292c;return _0x4e17ce;})[_0xac4a('0x22')](respondWithFilteredResult(_0x472c57,_0x1c13dc))[_0xac4a('0x42')](handleError(_0x472c57,null));};exports['show']=function(_0x5086ff,_0x5cd24f){var _0x1e1cc5={'raw':!![],'where':{'id':_0x5086ff[_0xac4a('0x43')]['id']}},_0x5c46a={};_0x5c46a[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x5c46a[_0xac4a('0x2e')]=_[_0xac4a('0x2d')](_0x5086ff[_0xac4a('0x2e')]);_0x5c46a['filters']=_[_0xac4a('0x30')](_0x5c46a[_0xac4a('0x2c')],_0x5c46a[_0xac4a('0x2e')]);_0x1e1cc5[_0xac4a('0x31')]=_[_0xac4a('0x30')](_0x5c46a['model'],qs[_0xac4a('0x32')](_0x5086ff[_0xac4a('0x2e')]['fields']));_0x1e1cc5[_0xac4a('0x31')]=_0x1e1cc5['attributes'][_0xac4a('0x33')]?_0x1e1cc5[_0xac4a('0x31')]:_0x5c46a[_0xac4a('0x2c')];if(_0x5086ff[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1e1cc5[_0xac4a('0x3f')]=[{'all':!![]}];}_0x1e1cc5=_[_0xac4a('0x3b')]({},_0x1e1cc5,_0x5086ff[_0xac4a('0x44')]);return db[_0xac4a('0x29')][_0xac4a('0x45')](_0x1e1cc5)[_0xac4a('0x22')](handleEntityNotFound(_0x5cd24f,null))[_0xac4a('0x22')](respondWithResult(_0x5cd24f,null))['catch'](handleError(_0x5cd24f,null));};exports[_0xac4a('0x46')]=function(_0x41d11d,_0xeca4e9){return db['FaxApplication'][_0xac4a('0x46')](_0x41d11d[_0xac4a('0x47')],{})['then'](respondWithResult(_0xeca4e9,0xc9))[_0xac4a('0x42')](handleError(_0xeca4e9,null));};exports['update']=function(_0x244950,_0xe620f6){if(_0x244950[_0xac4a('0x47')]['id']){delete _0x244950['body']['id'];}return db['FaxApplication'][_0xac4a('0x45')]({'where':{'id':_0x244950['params']['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0xe620f6,null))['then'](saveUpdates(_0x244950[_0xac4a('0x47')],null))['then'](respondWithResult(_0xe620f6,null))[_0xac4a('0x42')](handleError(_0xe620f6,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){return db['FaxApplication'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index be8a325..929c3ea 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 _0x01cd=['rimraf','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x14943c,_0x267e04){var _0x1f061a=function(_0x54f0e5){while(--_0x54f0e5){_0x14943c['push'](_0x14943c['shift']());}};_0x1f061a(++_0x267e04);}(_0x01cd,0x1c0));var _0xd01c=function(_0xd2e386,_0x3801ef){_0xd2e386=_0xd2e386-0x0;var _0x1272d9=_0x01cd[_0xd2e386];return _0x1272d9;};'use strict';var _=require(_0xd01c('0x0'));var util=require(_0xd01c('0x1'));var logger=require(_0xd01c('0x2'))(_0xd01c('0x3'));var moment=require('moment');var BPromise=require(_0xd01c('0x4'));var rp=require(_0xd01c('0x5'));var fs=require('fs');var path=require(_0xd01c('0x6'));var rimraf=require(_0xd01c('0x7'));var config=require('../../config/environment');var attributes=require(_0xd01c('0x8'));module[_0xd01c('0x9')]=function(_0x20bdab,_0x2dff00){return _0x20bdab[_0xd01c('0xa')]('FaxApplication',attributes,{'tableName':_0xd01c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd01c('0xc')});}; \ No newline at end of file +var _0x70d4=['fax_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','./faxApplication.attributes','define'];(function(_0x1424f9,_0x1f9921){var _0x5c5a14=function(_0x6040ac){while(--_0x6040ac){_0x1424f9['push'](_0x1424f9['shift']());}};_0x5c5a14(++_0x1f9921);}(_0x70d4,0x1e7));var _0x470d=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0x70d4[_0x8b631b];return _0x3e6832;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x470d('0x0'))(_0x470d('0x1'));var moment=require(_0x470d('0x2'));var BPromise=require('bluebird');var rp=require(_0x470d('0x3'));var fs=require('fs');var path=require(_0x470d('0x4'));var rimraf=require(_0x470d('0x5'));var config=require('../../config/environment');var attributes=require(_0x470d('0x6'));module['exports']=function(_0x42f659,_0x1cf914){return _0x42f659[_0x470d('0x7')]('FaxApplication',attributes,{'tableName':_0x470d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x470d('0x9'),'collate':_0x470d('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1b71c08..c7ec845 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 _0x6320=['code','message','request\x20sent','result','catch','UpdateFaxApplication','update','body','options','raw','where','info','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x147b96,_0x329d31){var _0xa43fa=function(_0x3c15d3){while(--_0x3c15d3){_0x147b96['push'](_0x147b96['shift']());}};_0xa43fa(++_0x329d31);}(_0x6320,0x1e8));var _0x0632=function(_0x25cf06,_0x3de40a){_0x25cf06=_0x25cf06-0x0;var _0x312b23=_0x6320[_0x25cf06];return _0x312b23;};'use strict';var _=require('lodash');var util=require(_0x0632('0x0'));var moment=require(_0x0632('0x1'));var BPromise=require('bluebird');var rs=require(_0x0632('0x2'));var fs=require('fs');var Redis=require(_0x0632('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0632('0x4'))(_0x0632('0x5'));var config=require(_0x0632('0x6'));var jayson=require(_0x0632('0x7'));var client=jayson[_0x0632('0x8')][_0x0632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43ffb6,_0xa87afc,_0x39d861){return new BPromise(function(_0x333eb7,_0x3a834a){return client[_0x0632('0xa')](_0x43ffb6,_0x39d861)[_0x0632('0xb')](function(_0x481b62){logger['info'](_0x0632('0xc'),_0xa87afc,'request\x20sent');logger['debug'](_0x0632('0xd'),_0xa87afc,'request\x20sent',JSON[_0x0632('0xe')](_0x481b62));if(_0x481b62['error']){if(_0x481b62[_0x0632('0xf')][_0x0632('0x10')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0xa87afc,_0x481b62[_0x0632('0xf')][_0x0632('0x11')]);return _0x3a834a(_0x481b62[_0x0632('0xf')][_0x0632('0x11')]);}logger[_0x0632('0xf')]('FaxApplication,\x20%s,\x20%s',_0xa87afc,_0x481b62[_0x0632('0xf')][_0x0632('0x11')]);return _0x333eb7(_0x481b62['error'][_0x0632('0x11')]);}else{logger['info'](_0x0632('0xc'),_0xa87afc,_0x0632('0x12'));_0x333eb7(_0x481b62[_0x0632('0x13')][_0x0632('0x11')]);}})[_0x0632('0x14')](function(_0x1554c1){logger['error'](_0x0632('0xc'),_0xa87afc,_0x1554c1);_0x3a834a(_0x1554c1);});});}exports[_0x0632('0x15')]=function(_0x519fb9){var _0x190d6d=this;return new Promise(function(_0x3a69c0,_0x35f8ea){return db['FaxApplication'][_0x0632('0x16')](_0x519fb9[_0x0632('0x17')],{'raw':_0x519fb9[_0x0632('0x18')]?_0x519fb9[_0x0632('0x18')][_0x0632('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x519fb9[_0x0632('0x18')]?_0x519fb9[_0x0632('0x18')][_0x0632('0x1a')]||null:null,'attributes':_0x519fb9[_0x0632('0x18')]?_0x519fb9[_0x0632('0x18')]['attributes']||null:null,'limit':_0x519fb9[_0x0632('0x18')]?_0x519fb9[_0x0632('0x18')]['limit']||null:null})[_0x0632('0xb')](function(_0x39bd7e){logger[_0x0632('0x1b')]('UpdateFaxApplication',_0x519fb9);logger['debug']('UpdateFaxApplication',_0x519fb9,JSON[_0x0632('0xe')](_0x39bd7e));_0x3a69c0(_0x39bd7e);})[_0x0632('0x14')](function(_0x218fbe){logger['error']('UpdateFaxApplication',_0x218fbe['message'],_0x519fb9);_0x35f8ea(_0x190d6d['error'](0x1f4,_0x218fbe[_0x0632('0x11')]));});});}; \ No newline at end of file +var _0x255c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','request\x20sent','stringify','code','FaxApplication,\x20%s,\x20%s','message','error','result','catch','update','options','where','attributes','limit','then','UpdateFaxApplication','debug','util'];(function(_0x3e224a,_0x536946){var _0x4e4806=function(_0x20eee0){while(--_0x20eee0){_0x3e224a['push'](_0x3e224a['shift']());}};_0x4e4806(++_0x536946);}(_0x255c,0x15e));var _0xc255=function(_0x3f9130,_0xc0246f){_0x3f9130=_0x3f9130-0x0;var _0x568e1e=_0x255c[_0x3f9130];return _0x568e1e;};'use strict';var _=require('lodash');var util=require(_0xc255('0x0'));var moment=require(_0xc255('0x1'));var BPromise=require(_0xc255('0x2'));var rs=require(_0xc255('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc255('0x4'))['db'];var utils=require(_0xc255('0x5'));var logger=require(_0xc255('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc255('0x7'));var client=jayson[_0xc255('0x8')][_0xc255('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a080e,_0x1f30c8,_0x372817){return new BPromise(function(_0xaf4657,_0x42ff6d){return client['request'](_0x5a080e,_0x372817)['then'](function(_0x2506f8){logger[_0xc255('0xa')]('FaxApplication,\x20%s,\x20%s',_0x1f30c8,_0xc255('0xb'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1f30c8,_0xc255('0xb'),JSON[_0xc255('0xc')](_0x2506f8));if(_0x2506f8['error']){if(_0x2506f8['error'][_0xc255('0xd')]===0x1f4){logger['error'](_0xc255('0xe'),_0x1f30c8,_0x2506f8['error'][_0xc255('0xf')]);return _0x42ff6d(_0x2506f8[_0xc255('0x10')][_0xc255('0xf')]);}logger[_0xc255('0x10')](_0xc255('0xe'),_0x1f30c8,_0x2506f8[_0xc255('0x10')]['message']);return _0xaf4657(_0x2506f8['error'][_0xc255('0xf')]);}else{logger['info'](_0xc255('0xe'),_0x1f30c8,_0xc255('0xb'));_0xaf4657(_0x2506f8[_0xc255('0x11')]['message']);}})[_0xc255('0x12')](function(_0x247da5){logger[_0xc255('0x10')](_0xc255('0xe'),_0x1f30c8,_0x247da5);_0x42ff6d(_0x247da5);});});}exports['UpdateFaxApplication']=function(_0x5a889){var _0x5d5216=this;return new Promise(function(_0x3af920,_0x4c5c7c){return db['FaxApplication'][_0xc255('0x13')](_0x5a889['body'],{'raw':_0x5a889[_0xc255('0x14')]?_0x5a889['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a889['options']?_0x5a889['options'][_0xc255('0x15')]||null:null,'attributes':_0x5a889[_0xc255('0x14')]?_0x5a889['options'][_0xc255('0x16')]||null:null,'limit':_0x5a889['options']?_0x5a889[_0xc255('0x14')][_0xc255('0x17')]||null:null})[_0xc255('0x18')](function(_0x271264){logger[_0xc255('0xa')](_0xc255('0x19'),_0x5a889);logger[_0xc255('0x1a')](_0xc255('0x19'),_0x5a889,JSON['stringify'](_0x271264));_0x3af920(_0x271264);})[_0xc255('0x12')](function(_0x449fc4){logger['error'](_0xc255('0x19'),_0x449fc4[_0xc255('0xf')],_0x5a889);_0x4c5c7c(_0x5d5216[_0xc255('0x10')](0x1f4,_0x449fc4[_0xc255('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e3442d6..912cc03 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 _0x24ca=['show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0x24ca[_0x30f5bb];return _0x1cfc00;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['post']('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xd')]);router[_0xa24c('0xe')]('/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);module[_0xa24c('0x12')]=router; \ No newline at end of file +var _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x34bb12,_0x4e9455){var _0x39be5b=function(_0x25970c){while(--_0x25970c){_0x34bb12['push'](_0x34bb12['shift']());}};_0x39be5b(++_0x4e9455);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x51667b,_0x4409ec){_0x51667b=_0x51667b-0x0;var _0x3ec7ff=_0x3f8a[_0x51667b];return _0x3ec7ff;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a3e966b..386d6bc 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 _0xceb0=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x650d37,_0x170e7b){var _0x214298=function(_0xd51168){while(--_0xd51168){_0x650d37['push'](_0x650d37['shift']());}};_0x214298(++_0x170e7b);}(_0xceb0,0x1d7));var _0x0ceb=function(_0x548a19,_0x4d6d65){_0x548a19=_0x548a19-0x0;var _0x46e33e=_0xceb0[_0x548a19];return _0x46e33e;};'use strict';var Sequelize=require(_0x0ceb('0x0'));module[_0x0ceb('0x1')]={'closed':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0ceb('0x3')]},'disposition':{'type':Sequelize[_0x0ceb('0x4')]},'note':{'type':Sequelize[_0x0ceb('0x4')]},'read1stAt':{'type':Sequelize[_0x0ceb('0x3')]},'fax':{'type':Sequelize[_0x0ceb('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0ceb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0ceb('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0ceb('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa0d2=['out','ENUM','sequelize','BOOLEAN','STRING','DATE'];(function(_0x419498,_0x32fc7a){var _0x57d3b0=function(_0x318a23){while(--_0x318a23){_0x419498['push'](_0x419498['shift']());}};_0x57d3b0(++_0x32fc7a);}(_0xa0d2,0x6e));var _0x2a0d=function(_0x37aa44,_0x3f6b91){_0x37aa44=_0x37aa44-0x0;var _0x5c535e=_0xa0d2[_0x37aa44];return _0x5c535e;};'use strict';var Sequelize=require(_0x2a0d('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2a0d('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2a0d('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2a0d('0x3')]},'fax':{'type':Sequelize[_0x2a0d('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2a0d('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2a0d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2a0d('0x5')]('in',_0x2a0d('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 4059d61..db46f03 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 _0x574d=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','name','fullname','Tags','TagIds','split','forEach','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','fax_accounts','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','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','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','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','i.*','c.lastName','c.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','params','options','create','describe','ids','omit','getMessages','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','faxInteractionTags:save','removeTags','unix','join','server','files','tmp','attachments','Attachment','Messages','get','mkdirSync','createReadStream','pipe','createWriteStream','basename','resolve','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5acea7,_0x1d0d1f){var _0x1cddda=function(_0x3c3221){while(--_0x3c3221){_0x5acea7['push'](_0x5acea7['shift']());}};_0x1cddda(++_0x1d0d1f);}(_0x574d,0xc0));var _0xd574=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x574d[_0x3b0731];return _0x4204d7;};'use strict';var pdf=require(_0xd574('0x0'));var emlformat=require(_0xd574('0x1'));var rimraf=require(_0xd574('0x2'));var zipdir=require(_0xd574('0x3'));var jsonpatch=require(_0xd574('0x4'));var rp=require(_0xd574('0x5'));var moment=require(_0xd574('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd574('0x7'));var util=require(_0xd574('0x8'));var path=require(_0xd574('0x9'));var sox=require(_0xd574('0xa'));var csv=require('to-csv');var ejs=require(_0xd574('0xb'));var fs=require('fs');var _=require(_0xd574('0xc'));var squel=require(_0xd574('0xd'));var crypto=require(_0xd574('0xe'));var jsforce=require(_0xd574('0xf'));var deskjs=require(_0xd574('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd574('0x11'));var Redis=require(_0xd574('0x12'));var authService=require(_0xd574('0x13'));var qs=require(_0xd574('0x14'));var as=require(_0xd574('0x15'));var hardwareService=require(_0xd574('0x16'));var logger=require(_0xd574('0x17'))('api');var utils=require(_0xd574('0x18'));var config=require(_0xd574('0x19'));var db=require(_0xd574('0x1a'))['db'];config[_0xd574('0x1b')]=_[_0xd574('0x1c')](config[_0xd574('0x1b')],{'host':_0xd574('0x1d'),'port':0x18eb});var socket=require(_0xd574('0x1e'))(new Redis(config[_0xd574('0x1b')]));require(_0xd574('0x1f'))[_0xd574('0x20')](socket);function respondWithStatusCode(_0x2cc660,_0x564b36){_0x564b36=_0x564b36||0xcc;return function(_0xb44f5d){if(_0xb44f5d){return _0x2cc660[_0xd574('0x21')](_0x564b36);}return _0x2cc660[_0xd574('0x22')](_0x564b36)[_0xd574('0x23')]();};}function respondWithResult(_0x46fb4c,_0x341463){_0x341463=_0x341463||0xc8;return function(_0x137917){if(_0x137917){return _0x46fb4c[_0xd574('0x22')](_0x341463)['json'](_0x137917);}};}function respondWithFilteredResult(_0x5e3a20,_0x1486c7){return function(_0x343aa9){if(_0x343aa9){var _0x2ac01d=_0x343aa9[_0xd574('0x24')],_0x48fd46=_0x1486c7[_0xd574('0x25')],_0x58a74b=_0x1486c7[_0xd574('0x25')]+_0x1486c7[_0xd574('0x26')],_0x91c627;if(_0x58a74b>=_0x2ac01d){_0x58a74b=_0x2ac01d;_0x91c627=0xc8;}else{_0x91c627=0xce;}_0x5e3a20[_0xd574('0x22')](_0x91c627);return _0x5e3a20[_0xd574('0x27')](_0xd574('0x28'),_0x48fd46+'-'+_0x58a74b+'/'+_0x2ac01d)[_0xd574('0x29')](_0x343aa9);}return null;};}function patchUpdates(_0x9f980d){return function(_0x35c2bb){try{jsonpatch['apply'](_0x35c2bb,_0x9f980d,!![]);}catch(_0x2b6647){return BPromise[_0xd574('0x2a')](_0x2b6647);}return _0x35c2bb['save']();};}function saveUpdates(_0x39c39d,_0x5e5b9f){return function(_0x22d451){if(_0x22d451){return _0x22d451[_0xd574('0x2b')](_0x39c39d)[_0xd574('0x2c')](function(_0x3f85cf){return _0x3f85cf;});}return null;};}function removeEntity(_0x1aec00,_0x72d2b8){return function(_0x25751e){if(_0x25751e){return _0x25751e[_0xd574('0x2d')]()[_0xd574('0x2c')](function(){_0x1aec00[_0xd574('0x22')](0xcc)[_0xd574('0x23')]();});}};}function handleEntityNotFound(_0x44ddae,_0x3e0501){return function(_0x39f5be){if(!_0x39f5be){_0x44ddae['sendStatus'](0x194);}return _0x39f5be;};}function handleError(_0x441f13,_0x53142f){_0x53142f=_0x53142f||0x1f4;return function(_0x1dcd2f){logger['error'](_0x1dcd2f['stack']);if(_0x1dcd2f[_0xd574('0x2e')]){delete _0x1dcd2f[_0xd574('0x2e')];}_0x441f13[_0xd574('0x22')](_0x53142f)['send'](_0x1dcd2f);};}function getInteractionUsers(_0x2a8e86,_0x30e49e){return new BPromise(function(_0x8eefda,_0x9761f5){try{if(_0x30e49e[_0x2a8e86['id']]){_0x2a8e86['Users']=_['map'](_0x30e49e[_0x2a8e86['id']],function(_0x130b6d){return{'id':_0x130b6d['id'],'fullname':_0x130b6d[_0xd574('0x2f')]};});}}catch(_0x203bcb){_0x9761f5(_0x203bcb);}_0x8eefda(_0x2a8e86);});}function getInteractionTags(_0x23a495,_0x1e65b5){return new BPromise(function(_0x1c01f0,_0x5b66eb){try{if(_0x23a495['TagIds']){_0x23a495[_0xd574('0x30')]=[];_0x23a495[_0xd574('0x31')][_0xd574('0x32')](',')[_0xd574('0x33')](function(_0xd6d9c0){_0x23a495[_0xd574('0x30')][_0xd574('0x34')](_0x1e65b5[_0xd6d9c0]);});}delete _0x23a495[_0xd574('0x31')];}catch(_0x5d23f2){_0x5b66eb(_0x5d23f2);}_0x1c01f0(_0x23a495);});}function updateFaxInteraction(_0x535b49,_0x189946,_0x601382){return new BPromise(function(_0xd4b730,_0x43e402){return getInteractionUsers(_0x535b49,_0x601382)[_0xd574('0x2c')](function(_0x5d787e){return getInteractionTags(_0x5d787e,_0x189946);})[_0xd574('0x2c')](function(_0x1421d6){_0xd4b730(_0x1421d6);})[_0xd574('0x35')](function(_0x1a841a){_0x43e402(_0x1a841a);});});}exports[_0xd574('0x36')]=function(_0x2f1a1e,_0x27498e){var _0x4d1576={},_0x3ecc05={},_0x5dc0cf={'count':0x0,'rows':[]};var _0x35594e=_[_0xd574('0x37')](db[_0xd574('0x38')][_0xd574('0x39')],function(_0x45e3d0){return{'name':_0x45e3d0[_0xd574('0x3a')],'type':_0x45e3d0[_0xd574('0x3b')][_0xd574('0x3c')]};});_0x3ecc05[_0xd574('0x3d')]=_[_0xd574('0x37')](_0x35594e,_0xd574('0x2e'));_0x3ecc05['query']=_[_0xd574('0x3e')](_0x2f1a1e[_0xd574('0x3f')]);_0x3ecc05[_0xd574('0x40')]=_['intersection'](_0x3ecc05[_0xd574('0x3d')],_0x3ecc05[_0xd574('0x3f')]);_0x4d1576[_0xd574('0x41')]=_[_0xd574('0x42')](_0x3ecc05[_0xd574('0x3d')],qs[_0xd574('0x43')](_0x2f1a1e['query'][_0xd574('0x43')]));_0x4d1576[_0xd574('0x41')]=_0x4d1576[_0xd574('0x41')][_0xd574('0x44')]?_0x4d1576[_0xd574('0x41')]:_0x3ecc05['model'];if(!_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x45')](_0xd574('0x46'))){_0x4d1576['limit']=qs['limit'](_0x2f1a1e['query'][_0xd574('0x26')]);_0x4d1576['offset']=qs['offset'](_0x2f1a1e['query'][_0xd574('0x25')]);}_0x4d1576[_0xd574('0x47')]=qs[_0xd574('0x48')](_0x2f1a1e[_0xd574('0x3f')]['sort']);_0x4d1576[_0xd574('0x49')]=qs[_0xd574('0x40')](_[_0xd574('0x4a')](_0x2f1a1e[_0xd574('0x3f')],_0x3ecc05['filters']),_0x35594e);var _0x1bf7c5=[];var _0x4caf06=squel[_0xd574('0x4b')]()[_0xd574('0x4c')]('id')[_0xd574('0x4c')](_0xd574('0x2e'))[_0xd574('0x4c')](_0xd574('0x4d'))[_0xd574('0x4e')](_0xd574('0x4f'));var _0x1857bb=squel[_0xd574('0x4b')]()[_0xd574('0x4c')](_0xd574('0x50'))[_0xd574('0x4c')]('u.fullname')[_0xd574('0x4c')]('ui.FaxInteractionId')['from'](_0xd574('0x51'),'ui')[_0xd574('0x52')]('users','u',_0xd574('0x53'));var _0x2e4e53=squel[_0xd574('0x4b')]()['from'](_0xd574('0x54'),'i')[_0xd574('0x52')](_0xd574('0x55'),'c',_0xd574('0x56'))[_0xd574('0x52')](_0xd574('0x57'),'o','o.id\x20=\x20i.UserId')[_0xd574('0x52')](_0xd574('0x58'),'a',_0xd574('0x59'))[_0xd574('0x52')](_0xd574('0x5a'),'me',_0xd574('0x5b'))[_0xd574('0x52')](_0xd574('0x5c'),'it',_0xd574('0x5d'))[_0xd574('0x52')](_0xd574('0x4f'),'t',_0xd574('0x5e'));var _0x1cad77=squel[_0xd574('0x5f')]();var _0x2ee2d7=[];var _0x15f9cd=squel['expr']();var _0x3dbfdc;if(_0x2f1a1e[_0xd574('0x3f')]['search']){_0x3dbfdc=as[_0xd574('0x60')](_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x61')]);var _0x26c88c=_0x3dbfdc[_0xd574('0x62')];for(var _0x1426fb=0x0;_0x1426fb<_0x3dbfdc[_0xd574('0x63')][_0xd574('0x44')];_0x1426fb++){var _0x4168b2=_0x3dbfdc[_0xd574('0x63')][_0x1426fb];var _0x4e1344='i';var _0x3397a8=_[_0xd574('0x64')](_0x35594e,[_0xd574('0x2e'),_0x4168b2[_0xd574('0x4c')]]);if(!_0x3397a8){switch(_0x4168b2[_0xd574('0x4c')]){case _0xd574('0x65'):if(_0x4168b2[_0xd574('0x66')]==0x1){_0x2e4e53[_0xd574('0x67')]('`'+_0x4168b2[_0xd574('0x4c')]+_0xd574('0x68'));}else{_0x2e4e53[_0xd574('0x67')]('`'+_0x4168b2[_0xd574('0x4c')]+_0xd574('0x69'));}break;case _0xd574('0x6a'):if(_0x4168b2[_0xd574('0x6b')]===_0xd574('0x6c')){if(_0x4168b2[_0xd574('0x66')][_0xd574('0x32')]('\x20')[_0xd574('0x44')]>0x1){_0x1cad77[_0x26c88c](_0xd574('0x6d'),qs[_0xd574('0x6e')](_0x4168b2[_0xd574('0x66')]),null);}else{var _0x2f77f9='%'+_0x4168b2[_0xd574('0x66')]+'%';_0x1cad77[_0x26c88c](_0xd574('0x6f'),_0x2f77f9,_0x2f77f9,_0x2f77f9);}}else{_0x3397a8=_['find'](_0x35594e,[_0xd574('0x2e'),_0xd574('0x70')]);_0x4168b2[_0xd574('0x4c')]=_0xd574('0x70');_0x495213=as[_0xd574('0x71')](_0x4e1344,_0x3397a8[_0xd574('0x3b')],_0x4168b2);_0x1cad77[_0x26c88c](_0x495213[_0xd574('0x72')],_0x495213[_0xd574('0x66')][_0xd574('0x73')],_0x495213['value']['end']);}break;case _0xd574('0x74'):var _0x2cd5e5=_0x4168b2['value'][_0xd574('0x32')](',')[_0xd574('0x37')](function(_0x310f27){return Number(_0x310f27);});_0x2cd5e5[_0xd574('0x33')](function(_0x4d2a9c){_0x15f9cd['or'](_0xd574('0x75'),'%,'+_0x4d2a9c+',%');});_0x2ee2d7=_[_0xd574('0x76')](_0x2ee2d7,_0x2cd5e5);break;case _0xd574('0x77'):if(_0x4168b2[_0xd574('0x6b')]===_0xd574('0x6c')){_0x1cad77[_0x26c88c](_0xd574('0x78'),'%'+_0x4168b2['value']+'%',null);}else{_0x3397a8=_['find'](_0x35594e,[_0xd574('0x2e'),_0xd574('0x79')]);_0x4168b2['field']=_0xd574('0x79');_0x495213=as['buildExpression'](_0x4e1344,_0x3397a8['type'],_0x4168b2);_0x1cad77[_0x26c88c](_0x495213[_0xd574('0x72')],_0x495213[_0xd574('0x66')]['start'],_0x495213['value'][_0xd574('0x23')]);}break;case _0xd574('0x7a'):_0x495213=as[_0xd574('0x71')]('me',null,_0x4168b2);_0x1cad77[_0x26c88c](_0x495213[_0xd574('0x72')],_0x495213[_0xd574('0x66')]['start'],_0x495213[_0xd574('0x66')][_0xd574('0x23')]);break;}}else{var _0x495213=as[_0xd574('0x71')](_0x4e1344,_0x3397a8[_0xd574('0x3b')],_0x4168b2);_0x1cad77[_0x26c88c](_0x495213[_0xd574('0x72')],_0x495213[_0xd574('0x66')]['start'],_0x495213[_0xd574('0x66')][_0xd574('0x23')]);}}}else{var _0x4fc35d=_(_0x2f1a1e[_0xd574('0x3f')])[_0xd574('0x3e')]()[_0xd574('0x37')](function(_0x5b1ba1){return _[_0xd574('0x7b')](_0x35594e,['name',_0x5b1ba1])?_0x5b1ba1:undefined;})[_0xd574('0x7c')]()[_0xd574('0x66')]();if(!_['isEmpty'](_0x4fc35d)){_0x4fc35d['forEach'](function(_0x59f2bb){if(_0x59f2bb===_0xd574('0x7d')){_0x2e4e53[_0xd574('0x49')](_0xd574('0x7e'),[][_0xd574('0x7f')](_0x2f1a1e['query'][_0x59f2bb]));}else if(_0x59f2bb===_0xd574('0x80')){var _0xc38aae=JSON[_0xd574('0x81')](_0x2f1a1e[_0xd574('0x3f')][_0x59f2bb])[_0xd574('0x82')];var _0x446f4d=JSON[_0xd574('0x81')](_0x2f1a1e[_0xd574('0x3f')][_0x59f2bb])[_0xd574('0x83')];_0x2e4e53['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc38aae,_0x446f4d);}else{if(_0x2f1a1e[_0xd574('0x3f')][_0x59f2bb]===_0xd574('0x84')){_0x2e4e53[_0xd574('0x49')]('i.'+_0x59f2bb+'\x20IS\x20NULL');}else{_0x2e4e53['where']('i.'+_0x59f2bb+'\x20=\x20?',_0x2f1a1e[_0xd574('0x3f')][_0x59f2bb]);}}});}if(_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x85')]){if(_0x2f1a1e['query'][_0xd574('0x85')]==0x1){_0x2e4e53[_0xd574('0x67')](_0xd574('0x86'));}else{_0x2e4e53[_0xd574('0x67')](_0xd574('0x87'));}}if(_0x2f1a1e['query'][_0xd574('0x88')]){_0x2ee2d7=_[_0xd574('0x89')](_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x88')])?_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x88')]:new Array(_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x88')]);_0x2ee2d7[_0xd574('0x33')](function(_0xc20ad){_0x15f9cd['or'](_0xd574('0x75'),'%,'+_0xc20ad+',%');});}if(_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x8a')]){var _0x43d981=_0x2f1a1e['query']['filter'][_0xd574('0x8b')]('\x5c','\x5c\x5c')[_0xd574('0x8b')]('\x27\x27',_0xd574('0x8c'));if(qs[_0xd574('0x8d')](_0x43d981)){_0x1cad77['or'](_0xd574('0x8e'),_0x43d981+'%')['or']('i.fax\x20LIKE\x20?',_0x43d981+'%');}_0x1cad77['or'](_0xd574('0x8f'),_0x43d981+'%');}}_0x2e4e53[_0xd574('0x49')](_0x1cad77);_0x2e4e53[_0xd574('0x90')]('i.id');var _0x17feb3={'type':db[_0xd574('0x91')]['QueryTypes'][_0xd574('0x92')],'raw':!![]};var _0x287dda=_0x2e4e53[_0xd574('0x93')]();_0x287dda[_0xd574('0x4c')](_0xd574('0x94'));_0x287dda[_0xd574('0x4c')](_0xd574('0x95'),_0xd574('0x65'));if(_0x4d1576[_0xd574('0x47')]){_0x4d1576[_0xd574('0x47')]['forEach'](function(_0x57c878){_0x2e4e53[_0xd574('0x47')]('i.'+_0x57c878[0x0],_0x57c878[0x1]===_0xd574('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x2ee2d7)){_0x2e4e53[_0xd574('0x67')](_0x15f9cd);_0x287dda['where'](_0xd574('0x97'),_0x2ee2d7);}BPromise['resolve']()[_0xd574('0x2c')](function(){if(!_0x3dbfdc){if(_0x2f1a1e[_0xd574('0x3f')]['FaxAccountId']||_0x2f1a1e[_0xd574('0x3f')][_0xd574('0x98')])return;_0x287dda[_0xd574('0x49')](_0xd574('0x99'));_0x2e4e53['where'](_0xd574('0x99'));return;}return _0x2f1a1e[_0xd574('0x9a')][_0xd574('0x9b')]({'attributes':['id'],'raw':!![]})[_0xd574('0x2c')](function(_0x150c7a){if(_[_0xd574('0x9c')](_0x150c7a)){_0x287dda[_0xd574('0x49')](_0xd574('0x9d'));_0x2e4e53[_0xd574('0x49')](_0xd574('0x9d'));}else{_0x287dda['where'](_0xd574('0x7e'),_[_0xd574('0x37')](_0x150c7a,'id'));_0x2e4e53[_0xd574('0x49')](_0xd574('0x7e'),_['map'](_0x150c7a,'id'));}});})[_0xd574('0x2c')](function(){db['sequelize'][_0xd574('0x3f')](_0x287dda[_0xd574('0x9e')](),_0x17feb3)['then'](function(_0x33e256){_0x5dc0cf['count']=_0x33e256[_0xd574('0x44')];if(_0x5dc0cf['count']===0x0)return[];return db[_0xd574('0x9f')][_0xd574('0x3f')](_0x4caf06['toString'](),_0x17feb3)[_0xd574('0x2c')](function(_0x2dfc7a){_0x1bf7c5=_[_0xd574('0xa0')](_0x2dfc7a,'id');_0x17feb3=_[_0xd574('0xa1')](_0x17feb3,{'model':db[_0xd574('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f1a1e['query'][_0xd574('0x43')]){_0x4d1576[_0xd574('0x41')][_0xd574('0x33')](function(_0x427539){_0x2e4e53[_0xd574('0x4c')]('i.'+_0x427539);});}else{_0x2e4e53[_0xd574('0x4c')](_0xd574('0x95'),_0xd574('0x65'));_0x2e4e53[_0xd574('0x4c')](_0xd574('0xa2'),_0xd574('0xa3'));_0x2e4e53[_0xd574('0x4c')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2e4e53['field'](_0xd574('0xa4'));_0x2e4e53['field']('c.firstName','Contact.firstName');_0x2e4e53[_0xd574('0x4c')](_0xd574('0xa5'),'Contact.lastName');_0x2e4e53[_0xd574('0x4c')](_0xd574('0xa6'),'Contact.email');_0x2e4e53[_0xd574('0x4c')](_0xd574('0xa7'),'Contact.phone');_0x2e4e53['field'](_0xd574('0xa8'),'Contact.mobile');_0x2e4e53[_0xd574('0x4c')]('c.fax',_0xd574('0xa9'));_0x2e4e53[_0xd574('0x4c')](_0xd574('0xaa'),_0xd574('0xab'));_0x2e4e53['field'](_0xd574('0xac'),_0xd574('0xad'));_0x2e4e53['field'](_0xd574('0xae'),_0xd574('0x31'));}if(_0x4d1576['limit'])_0x2e4e53[_0xd574('0x26')](_0x4d1576[_0xd574('0x26')]);if(_0x4d1576[_0xd574('0x25')])_0x2e4e53[_0xd574('0x25')](_0x4d1576[_0xd574('0x25')]);return db['sequelize'][_0xd574('0x3f')](_0x2e4e53[_0xd574('0x9e')](),_0x17feb3);})[_0xd574('0x2c')](function(_0x3bde9b){_0x1857bb[_0xd574('0x49')](_0xd574('0xaf'),_[_0xd574('0x37')](_0x3bde9b,'id'));return db[_0xd574('0x9f')][_0xd574('0x3f')](_0x1857bb[_0xd574('0x9e')](),_0x17feb3)['then'](function(_0x14dbb4){var _0x145673=_[_0xd574('0xb0')](_0x14dbb4,_0xd574('0xb1'));var _0x412702=[];_0x3bde9b['forEach'](function(_0x21eb39){_0x412702['push'](updateFaxInteraction(_0x21eb39,_0x1bf7c5,_0x145673));});return BPromise[_0xd574('0xb2')](_0x412702);});});})['then'](function(_0x2bcc71){_0x5dc0cf[_0xd574('0xb3')]=_0x2bcc71;return _0x5dc0cf;})[_0xd574('0x2c')](respondWithFilteredResult(_0x27498e,_0x4d1576));})[_0xd574('0x35')](handleError(_0x27498e,null));};exports['show']=function(_0x514cfa,_0x9433be){var _0x24f973={'raw':![],'where':{'id':_0x514cfa[_0xd574('0xb4')]['id']}},_0x5f17f6={};_0x5f17f6[_0xd574('0x3d')]=_['keys'](db['FaxInteraction'][_0xd574('0x39')]);_0x5f17f6[_0xd574('0x3f')]=_[_0xd574('0x3e')](_0x514cfa['query']);_0x5f17f6[_0xd574('0x40')]=_['intersection'](_0x5f17f6[_0xd574('0x3d')],_0x5f17f6['query']);_0x24f973['attributes']=_['intersection'](_0x5f17f6[_0xd574('0x3d')],qs[_0xd574('0x43')](_0x514cfa[_0xd574('0x3f')]['fields']));_0x24f973[_0xd574('0x41')]=_0x24f973[_0xd574('0x41')]['length']?_0x24f973[_0xd574('0x41')]:_0x5f17f6[_0xd574('0x3d')];if(_0x514cfa[_0xd574('0x3f')]['includeAll']){_0x24f973['include']=[{'all':!![]}];}_0x24f973=_['merge']({},_0x24f973,_0x514cfa[_0xd574('0xb5')]);return db[_0xd574('0x38')][_0xd574('0x64')](_0x24f973)[_0xd574('0x2c')](handleEntityNotFound(_0x9433be,null))['then'](respondWithResult(_0x9433be,null))[_0xd574('0x35')](handleError(_0x9433be,null));};exports['create']=function(_0x54f482,_0x6d1c7f){return db['FaxInteraction'][_0xd574('0xb6')](_0x54f482['body'],{})[_0xd574('0x2c')](respondWithResult(_0x6d1c7f,0xc9))[_0xd574('0x35')](handleError(_0x6d1c7f,null));};exports[_0xd574('0x2b')]=function(_0x56f698,_0x579faf){if(_0x56f698['body']['id']){delete _0x56f698[_0xd574('0x7a')]['id'];}return db[_0xd574('0x38')][_0xd574('0x64')]({'where':{'id':_0x56f698[_0xd574('0xb4')]['id']}})[_0xd574('0x2c')](handleEntityNotFound(_0x579faf,null))[_0xd574('0x2c')](saveUpdates(_0x56f698[_0xd574('0x7a')],null))['then'](respondWithResult(_0x579faf,null))[_0xd574('0x35')](handleError(_0x579faf,null));};exports[_0xd574('0x2d')]=function(_0x59eb04,_0x257f99){return db[_0xd574('0x38')][_0xd574('0x64')]({'where':{'id':_0x59eb04['params']['id']}})[_0xd574('0x2c')](handleEntityNotFound(_0x257f99,null))[_0xd574('0x2c')](removeEntity(_0x257f99,null))[_0xd574('0x35')](handleError(_0x257f99,null));};exports[_0xd574('0xb7')]=function(_0x18f71c,_0x328a9d){return db[_0xd574('0x38')][_0xd574('0xb7')]()[_0xd574('0x2c')](respondWithResult(_0x328a9d,null))[_0xd574('0x35')](handleError(_0x328a9d,null));};exports['addMessage']=function(_0x3d278e,_0x40492c,_0x270591){return db['FaxMessage'][_0xd574('0x64')]({'where':{'id':_0x3d278e[_0xd574('0xb4')]['id']}})['then'](handleEntityNotFound(_0x40492c,null))[_0xd574('0x2c')](function(_0x333147){if(_0x333147){return _0x333147['addMessage'](_0x3d278e['body'][_0xd574('0xb8')],_[_0xd574('0xb9')](_0x3d278e[_0xd574('0x7a')],[_0xd574('0xb8'),'id'])||{});}})[_0xd574('0x2c')](respondWithResult(_0x40492c,null))[_0xd574('0x35')](handleError(_0x40492c,null));};exports[_0xd574('0xba')]=function(_0x529c9c,_0x3eb79,_0x1a7492){var _0x1791a7={'raw':![],'where':{}};var _0x296f92={};var _0x3ef7c1={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xd574('0xbb')]({'where':{'id':_0x529c9c[_0xd574('0xb4')]['id']}})[_0xd574('0x2c')](handleEntityNotFound(_0x3eb79,null))[_0xd574('0x2c')](function(_0x552e38){if(_0x552e38){_0x296f92[_0xd574('0x3d')]=_[_0xd574('0x3e')](db[_0xd574('0xbc')]['rawAttributes']);_0x296f92['query']=_[_0xd574('0x3e')](_0x529c9c[_0xd574('0x3f')]);_0x296f92[_0xd574('0x40')]=_['intersection'](_0x296f92['model'],_0x296f92['query']);_0x1791a7['attributes']=_[_0xd574('0x42')](_0x296f92[_0xd574('0x3d')],qs[_0xd574('0x43')](_0x529c9c[_0xd574('0x3f')][_0xd574('0x43')]));_0x1791a7[_0xd574('0x41')]=_0x1791a7[_0xd574('0x41')][_0xd574('0x44')]?_0x1791a7[_0xd574('0x41')]:_0x296f92[_0xd574('0x3d')];if(!_0x529c9c[_0xd574('0x3f')][_0xd574('0x45')]('nolimit')){_0x1791a7[_0xd574('0x26')]=qs[_0xd574('0x26')](_0x529c9c['query']['limit']);_0x1791a7['offset']=qs[_0xd574('0x25')](_0x529c9c[_0xd574('0x3f')]['offset']);}_0x1791a7[_0xd574('0x47')]=qs[_0xd574('0x48')](_0x529c9c['query']['sort']);_0x1791a7[_0xd574('0x49')]=qs[_0xd574('0x40')](_['pick'](_0x529c9c[_0xd574('0x3f')],_0x296f92[_0xd574('0x40')]));_0x1791a7[_0xd574('0x49')][_0xd574('0xb1')]=_0x552e38['id'];if(_0x529c9c[_0xd574('0x3f')]['filter']){_0x1791a7[_0xd574('0x49')]=_[_0xd574('0xa1')](_0x1791a7[_0xd574('0x49')],{'$or':_[_0xd574('0x37')](_0x1791a7[_0xd574('0x41')],function(_0x350aa2){var _0x34e67a={};_0x34e67a[_0x350aa2]={'$like':'%'+_0x529c9c['query'][_0xd574('0x8a')]+'%'};return _0x34e67a;})});}if(_0x529c9c[_0xd574('0x3f')][_0xd574('0x82')]){var _0x4292b7=_0x529c9c[_0xd574('0x3f')][_0xd574('0x82')][_0xd574('0x32')](',');var _0x1d3542={};_0x1d3542[_0x4292b7[0x0]]={'$gte':moment(_0x4292b7[0x1])[_0xd574('0xbd')](_0xd574('0xbe'))};_0x1791a7[_0xd574('0x49')]=_[_0xd574('0xa1')](_0x1791a7[_0xd574('0x49')],_0x1d3542);}_0x1791a7=_[_0xd574('0xa1')]({},_0x1791a7,_0x529c9c[_0xd574('0xb5')]);return db[_0xd574('0xbc')][_0xd574('0x24')]({'where':_0x1791a7[_0xd574('0x49')]})['then'](function(_0x2c79ca){_0x3ef7c1[_0xd574('0x24')]=_0x2c79ca;if(_0x529c9c[_0xd574('0x3f')]['includeAll']){_0x1791a7[_0xd574('0xbf')]=[{'all':!![]}];}return db[_0xd574('0xbc')][_0xd574('0xc0')](_0x1791a7);})[_0xd574('0x2c')](function(_0x5e21a3){_0x3ef7c1[_0xd574('0xb3')]=_0x5e21a3;return _0x3ef7c1;});}})[_0xd574('0x2c')](respondWithFilteredResult(_0x3eb79,_0x1791a7))[_0xd574('0x35')](handleError(_0x3eb79,null));};exports[_0xd574('0xc1')]=function(_0x4e28f6,_0x41a9b6,_0x58df8c){return db['FaxInteraction'][_0xd574('0x64')]({'where':{'id':_0x4e28f6[_0xd574('0xb4')]['id']}})[_0xd574('0x2c')](handleEntityNotFound(_0x41a9b6,null))['then'](function(_0x48e83d){if(_0x48e83d){return _0x48e83d[_0xd574('0xc2')](_0x4e28f6['body'][_0xd574('0xb8')],_['omit'](_0x4e28f6[_0xd574('0x7a')],['ids','id'])||{})['spread'](function(){return db[_0xd574('0x74')][_0xd574('0xc0')]({'attributes':['id',_0xd574('0x2e'),_0xd574('0x4d')],'where':{'id':_0x4e28f6['body']['ids']}});})[_0xd574('0x2c')](function(_0x29905e){socket['emit'](_0xd574('0xc3'),{'id':Number(_0x4e28f6['params']['id']),'tags':_0x29905e||[]});return{'id':Number(_0x4e28f6['params']['id']),'tags':_0x29905e||[]};});}})[_0xd574('0x2c')](respondWithResult(_0x41a9b6,null))['catch'](handleError(_0x41a9b6,null));};exports[_0xd574('0xc4')]=function(_0x2f8982,_0x15916f,_0x57f401){return db[_0xd574('0x38')]['find']({'where':{'id':_0x2f8982[_0xd574('0xb4')]['id']}})['then'](handleEntityNotFound(_0x15916f,null))[_0xd574('0x2c')](function(_0x52fe98){if(_0x52fe98){return _0x52fe98['removeTags'](_0x2f8982[_0xd574('0x3f')][_0xd574('0xb8')]);}})[_0xd574('0x2c')](respondWithStatusCode(_0x15916f,null))[_0xd574('0x35')](handleError(_0x15916f,null));};exports['download']=function(_0x4ee1ad,_0x1b11f5){var _0x106bec=moment()[_0xd574('0xc5')]()[_0xd574('0x9e')]();var _0x57aff7=path[_0xd574('0xc6')](config['root'],_0xd574('0xc7'),_0xd574('0xc8'),_0xd574('0xc9'));var _0x1b44ce=path[_0xd574('0xc6')](config['root'],_0xd574('0xc7'),_0xd574('0xc8'),_0xd574('0xca'));var _0x193bb1=path[_0xd574('0xc6')](_0x57aff7,_0x106bec);var _0x12343d=util[_0xd574('0xbd')]('transcript-%d-%s.zip',_0x4ee1ad['params']['id'],_0x106bec);var _0x2deb08=path[_0xd574('0xc6')](_0x57aff7,_0x12343d);var _0x39bbfe=[];_0x39bbfe[_0xd574('0x34')]({'model':db[_0xd574('0xcb')],'as':_0xd574('0xcb'),'raw':!![]});var _0x24c010=[{'model':db[_0xd574('0xbc')],'as':_0xd574('0xcc'),'attributes':['id','body',_0xd574('0x80')],'include':_0x39bbfe}];return db['FaxInteraction'][_0xd574('0x64')]({'where':{'id':_0x4ee1ad[_0xd574('0xb4')]['id']},'include':_0x24c010})[_0xd574('0x2c')](handleEntityNotFound(_0x1b11f5,null))[_0xd574('0x2c')](function(_0x20d92c){if(_0x20d92c&&_0x20d92c[_0xd574('0xcc')]){var _0x46205e=_0x20d92c[_0xd574('0xcd')]({'plain':!![]});fs[_0xd574('0xce')](_0x193bb1);for(var _0x53eb07=0x0;_0x53eb07<_0x46205e[_0xd574('0xcc')]['length'];_0x53eb07++){var _0x3d69fa=_0x46205e[_0xd574('0xcc')][_0x53eb07]['Attachment'];if(_0x3d69fa){var _0x32bc6d=path['join'](_0x1b44ce,_0x3d69fa['basename']);if(fs['existsSync'](_0x32bc6d)){fs[_0xd574('0xcf')](_0x32bc6d)[_0xd574('0xd0')](fs[_0xd574('0xd1')](path[_0xd574('0xc6')](_0x193bb1,_0x3d69fa[_0xd574('0xd2')])));}}}return BPromise[_0xd574('0xd3')]()[_0xd574('0x2c')](function(){return new BPromise(function(_0x3d1c27,_0x5b47ee){zipdir(_0x193bb1,{'saveTo':_0x2deb08},function(_0x2bc9de,_0x103648){if(_0x2bc9de)return _0x5b47ee(_0x2bc9de);return _0x3d1c27(_0x103648);});})[_0xd574('0x2c')](function(){return new BPromise(function(_0x227593,_0x561b59){rimraf(_0x193bb1,function(_0x52ebb5){if(_0x52ebb5)_0x561b59(_0x52ebb5);return _0x227593();});});})[_0xd574('0x2c')](function(){return _0x1b11f5[_0xd574('0xd4')](_0x2deb08,_0x12343d,function(_0x430c89){if(_0x430c89){console[_0xd574('0xd5')](_0xd574('0xd6'),_0x430c89);}else{fs[_0xd574('0xd7')](_0x2deb08);}});});});}else{return _0x1b11f5[_0xd574('0x21')](0xc8);}})[_0xd574('0x35')](handleError(_0x1b11f5,null));}; \ No newline at end of file +var _0xd844=['conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','User','UserId','buildExpression','some','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','SELECT','i.id','DESC','isEmpty','t.id\x20IN\x20?','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','sequelize','count','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','params','rawAttributes','includeAll','options','body','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','Attachment','Messages','get','mkdirSync','basename','existsSync','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','FaxInteraction','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator'];(function(_0x1246af,_0x477bc9){var _0x5d9762=function(_0x259c6c){while(--_0x259c6c){_0x1246af['push'](_0x1246af['shift']());}};_0x5d9762(++_0x477bc9);}(_0xd844,0x6d));var _0x4d84=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd844[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x4d84('0x0'));var emlformat=require(_0x4d84('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d84('0x2'));var jsonpatch=require(_0x4d84('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d84('0x4'));var Mustache=require(_0x4d84('0x5'));var util=require(_0x4d84('0x6'));var path=require(_0x4d84('0x7'));var sox=require('sox');var csv=require(_0x4d84('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4d84('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d84('0xa'));var toCsv=require(_0x4d84('0x8'));var querystring=require('querystring');var Papa=require(_0x4d84('0xb'));var Redis=require('ioredis');var authService=require(_0x4d84('0xc'));var qs=require(_0x4d84('0xd'));var as=require(_0x4d84('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d84('0xf'))(_0x4d84('0x10'));var utils=require(_0x4d84('0x11'));var config=require(_0x4d84('0x12'));var db=require(_0x4d84('0x13'))['db'];config[_0x4d84('0x14')]=_[_0x4d84('0x15')](config[_0x4d84('0x14')],{'host':_0x4d84('0x16'),'port':0x18eb});var socket=require(_0x4d84('0x17'))(new Redis(config[_0x4d84('0x14')]));require('./faxInteraction.socket')[_0x4d84('0x18')](socket);function respondWithStatusCode(_0x50f820,_0x34765d){_0x34765d=_0x34765d||0xcc;return function(_0x1e37e3){if(_0x1e37e3){return _0x50f820[_0x4d84('0x19')](_0x34765d);}return _0x50f820[_0x4d84('0x1a')](_0x34765d)['end']();};}function respondWithResult(_0x1df099,_0x4ee2fe){_0x4ee2fe=_0x4ee2fe||0xc8;return function(_0x2fc8db){if(_0x2fc8db){return _0x1df099[_0x4d84('0x1a')](_0x4ee2fe)['json'](_0x2fc8db);}};}function respondWithFilteredResult(_0x4f2a5c,_0x47076e){return function(_0x5f3a8d){if(_0x5f3a8d){var _0x4128d1=_0x5f3a8d['count'],_0x42ef73=_0x47076e[_0x4d84('0x1b')],_0x12349a=_0x47076e[_0x4d84('0x1b')]+_0x47076e[_0x4d84('0x1c')],_0xb99083;if(_0x12349a>=_0x4128d1){_0x12349a=_0x4128d1;_0xb99083=0xc8;}else{_0xb99083=0xce;}_0x4f2a5c['status'](_0xb99083);return _0x4f2a5c[_0x4d84('0x1d')](_0x4d84('0x1e'),_0x42ef73+'-'+_0x12349a+'/'+_0x4128d1)[_0x4d84('0x1f')](_0x5f3a8d);}return null;};}function patchUpdates(_0x27fdf2){return function(_0x41e946){try{jsonpatch[_0x4d84('0x20')](_0x41e946,_0x27fdf2,!![]);}catch(_0x542791){return BPromise[_0x4d84('0x21')](_0x542791);}return _0x41e946[_0x4d84('0x22')]();};}function saveUpdates(_0x29928e,_0x2fc7dd){return function(_0x5a2608){if(_0x5a2608){return _0x5a2608[_0x4d84('0x23')](_0x29928e)['then'](function(_0x229c8d){return _0x229c8d;});}return null;};}function removeEntity(_0x5ebe25,_0x48794f){return function(_0x5c616b){if(_0x5c616b){return _0x5c616b[_0x4d84('0x24')]()[_0x4d84('0x25')](function(){_0x5ebe25[_0x4d84('0x1a')](0xcc)[_0x4d84('0x26')]();});}};}function handleEntityNotFound(_0x49f921,_0x41a802){return function(_0x487ef9){if(!_0x487ef9){_0x49f921[_0x4d84('0x19')](0x194);}return _0x487ef9;};}function handleError(_0x35276a,_0x55c3b4){_0x55c3b4=_0x55c3b4||0x1f4;return function(_0x407371){logger[_0x4d84('0x27')](_0x407371[_0x4d84('0x28')]);if(_0x407371[_0x4d84('0x29')]){delete _0x407371[_0x4d84('0x29')];}_0x35276a['status'](_0x55c3b4)[_0x4d84('0x2a')](_0x407371);};}function getInteractionUsers(_0x2014a6,_0x353bf2){return new BPromise(function(_0x539e8c,_0x5ec750){try{if(_0x353bf2[_0x2014a6['id']]){_0x2014a6[_0x4d84('0x2b')]=_[_0x4d84('0x2c')](_0x353bf2[_0x2014a6['id']],function(_0x57e3b5){return{'id':_0x57e3b5['id'],'fullname':_0x57e3b5[_0x4d84('0x2d')]};});}}catch(_0x5b447b){_0x5ec750(_0x5b447b);}_0x539e8c(_0x2014a6);});}function getInteractionTags(_0x492e61,_0x37f532){return new BPromise(function(_0x5c3dc9,_0x1d7866){try{if(_0x492e61[_0x4d84('0x2e')]){_0x492e61[_0x4d84('0x2f')]=[];_0x492e61['TagIds'][_0x4d84('0x30')](',')[_0x4d84('0x31')](function(_0x465fc4){_0x492e61[_0x4d84('0x2f')][_0x4d84('0x32')](_0x37f532[_0x465fc4]);});}delete _0x492e61['TagIds'];}catch(_0x3c466b){_0x1d7866(_0x3c466b);}_0x5c3dc9(_0x492e61);});}function updateFaxInteraction(_0xc98921,_0xb5f765,_0x3cc286){return new BPromise(function(_0x313cb4,_0x589491){return getInteractionUsers(_0xc98921,_0x3cc286)['then'](function(_0x4b494e){return getInteractionTags(_0x4b494e,_0xb5f765);})['then'](function(_0x4d3247){_0x313cb4(_0x4d3247);})['catch'](function(_0x38450f){_0x589491(_0x38450f);});});}exports['index']=function(_0x3d2eee,_0x19904a){var _0x51f377={},_0x115a20={},_0x5c3fca={'count':0x0,'rows':[]};var _0x47ac06=_[_0x4d84('0x2c')](db[_0x4d84('0x33')]['rawAttributes'],function(_0x379266){return{'name':_0x379266[_0x4d84('0x34')],'type':_0x379266[_0x4d84('0x35')][_0x4d84('0x36')]};});_0x115a20[_0x4d84('0x37')]=_[_0x4d84('0x2c')](_0x47ac06,_0x4d84('0x29'));_0x115a20['query']=_[_0x4d84('0x38')](_0x3d2eee[_0x4d84('0x39')]);_0x115a20[_0x4d84('0x3a')]=_['intersection'](_0x115a20[_0x4d84('0x37')],_0x115a20[_0x4d84('0x39')]);_0x51f377['attributes']=_[_0x4d84('0x3b')](_0x115a20['model'],qs[_0x4d84('0x3c')](_0x3d2eee['query'][_0x4d84('0x3c')]));_0x51f377[_0x4d84('0x3d')]=_0x51f377[_0x4d84('0x3d')][_0x4d84('0x3e')]?_0x51f377[_0x4d84('0x3d')]:_0x115a20[_0x4d84('0x37')];if(!_0x3d2eee['query'][_0x4d84('0x3f')](_0x4d84('0x40'))){_0x51f377[_0x4d84('0x1c')]=qs['limit'](_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x1c')]);_0x51f377['offset']=qs[_0x4d84('0x1b')](_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x1b')]);}_0x51f377[_0x4d84('0x41')]=qs[_0x4d84('0x42')](_0x3d2eee[_0x4d84('0x39')]['sort']);_0x51f377[_0x4d84('0x43')]=qs[_0x4d84('0x3a')](_[_0x4d84('0x44')](_0x3d2eee[_0x4d84('0x39')],_0x115a20[_0x4d84('0x3a')]),_0x47ac06);var _0x4affef=[];var _0xbf42c1=squel[_0x4d84('0x45')]()[_0x4d84('0x46')]('id')['field'](_0x4d84('0x29'))[_0x4d84('0x46')](_0x4d84('0x47'))['from'](_0x4d84('0x48'));var _0x52c0d8=squel[_0x4d84('0x45')]()[_0x4d84('0x46')](_0x4d84('0x49'))['field']('u.fullname')[_0x4d84('0x46')](_0x4d84('0x4a'))[_0x4d84('0x4b')](_0x4d84('0x4c'),'ui')[_0x4d84('0x4d')]('users','u',_0x4d84('0x4e'));var _0x4785a1=squel[_0x4d84('0x45')]()[_0x4d84('0x4b')](_0x4d84('0x4f'),'i')[_0x4d84('0x4d')](_0x4d84('0x50'),'c',_0x4d84('0x51'))[_0x4d84('0x4d')](_0x4d84('0x52'),'o',_0x4d84('0x53'))[_0x4d84('0x4d')]('fax_accounts','a',_0x4d84('0x54'))[_0x4d84('0x4d')](_0x4d84('0x55'),'me',_0x4d84('0x56'))['left_join'](_0x4d84('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x4d84('0x4d')](_0x4d84('0x48'),'t',_0x4d84('0x58'));var _0x58e2d5=squel[_0x4d84('0x59')]();var _0x429c1b=[];var _0x3dc101=squel[_0x4d84('0x59')]();var _0x26c8ce;if(_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x5a')]){_0x26c8ce=as[_0x4d84('0x5b')](_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x5a')]);var _0x3eada9=_0x26c8ce[_0x4d84('0x5c')];for(var _0x10861f=0x0;_0x10861f<_0x26c8ce[_0x4d84('0x5d')]['length'];_0x10861f++){var _0x47f859=_0x26c8ce['conditions'][_0x10861f];var _0x2ba3db='i';var _0x1a385e=_[_0x4d84('0x5e')](_0x47ac06,['name',_0x47f859[_0x4d84('0x46')]]);if(!_0x1a385e){switch(_0x47f859[_0x4d84('0x46')]){case _0x4d84('0x5f'):if(_0x47f859[_0x4d84('0x60')]==0x1){_0x4785a1[_0x4d84('0x61')]('`'+_0x47f859[_0x4d84('0x46')]+_0x4d84('0x62'));}else{_0x4785a1[_0x4d84('0x61')]('`'+_0x47f859[_0x4d84('0x46')]+_0x4d84('0x63'));}break;case'Contact':if(_0x47f859[_0x4d84('0x64')]==='$substring'){if(_0x47f859[_0x4d84('0x60')][_0x4d84('0x30')]('\x20')[_0x4d84('0x3e')]>0x1){_0x58e2d5[_0x3eada9](_0x4d84('0x65'),qs[_0x4d84('0x66')](_0x47f859[_0x4d84('0x60')]),null);}else{var _0x374478='%'+_0x47f859['value']+'%';_0x58e2d5[_0x3eada9](_0x4d84('0x67'),_0x374478,_0x374478,_0x374478);}}else{_0x1a385e=_[_0x4d84('0x5e')](_0x47ac06,['name',_0x4d84('0x68')]);_0x47f859[_0x4d84('0x46')]=_0x4d84('0x68');_0x373c50=as['buildExpression'](_0x2ba3db,_0x1a385e[_0x4d84('0x35')],_0x47f859);_0x58e2d5[_0x3eada9](_0x373c50[_0x4d84('0x69')],_0x373c50['value'][_0x4d84('0x6a')],_0x373c50['value'][_0x4d84('0x26')]);}break;case _0x4d84('0x6b'):var _0x4a8caa=_0x47f859[_0x4d84('0x60')][_0x4d84('0x30')](',')[_0x4d84('0x2c')](function(_0x2bd90f){return Number(_0x2bd90f);});_0x4a8caa[_0x4d84('0x31')](function(_0xf28e1b){_0x3dc101['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf28e1b+',%');});_0x429c1b=_[_0x4d84('0x6c')](_0x429c1b,_0x4a8caa);break;case _0x4d84('0x6d'):if(_0x47f859[_0x4d84('0x64')]==='$substring'){_0x58e2d5[_0x3eada9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x47f859[_0x4d84('0x60')]+'%',null);}else{_0x1a385e=_[_0x4d84('0x5e')](_0x47ac06,[_0x4d84('0x29'),_0x4d84('0x6e')]);_0x47f859[_0x4d84('0x46')]=_0x4d84('0x6e');_0x373c50=as[_0x4d84('0x6f')](_0x2ba3db,_0x1a385e[_0x4d84('0x35')],_0x47f859);_0x58e2d5[_0x3eada9](_0x373c50[_0x4d84('0x69')],_0x373c50[_0x4d84('0x60')]['start'],_0x373c50[_0x4d84('0x60')][_0x4d84('0x26')]);}break;case'body':_0x373c50=as[_0x4d84('0x6f')]('me',null,_0x47f859);_0x58e2d5[_0x3eada9](_0x373c50['text'],_0x373c50[_0x4d84('0x60')]['start'],_0x373c50[_0x4d84('0x60')][_0x4d84('0x26')]);break;}}else{var _0x373c50=as[_0x4d84('0x6f')](_0x2ba3db,_0x1a385e[_0x4d84('0x35')],_0x47f859);_0x58e2d5[_0x3eada9](_0x373c50[_0x4d84('0x69')],_0x373c50[_0x4d84('0x60')][_0x4d84('0x6a')],_0x373c50[_0x4d84('0x60')]['end']);}}}else{var _0x1fcf1d=_(_0x3d2eee['query'])['keys']()[_0x4d84('0x2c')](function(_0x1c1193){return _[_0x4d84('0x70')](_0x47ac06,[_0x4d84('0x29'),_0x1c1193])?_0x1c1193:undefined;})['compact']()[_0x4d84('0x60')]();if(!_['isEmpty'](_0x1fcf1d)){_0x1fcf1d[_0x4d84('0x31')](function(_0x10a9ef){if(_0x10a9ef==='FaxAccountId'){_0x4785a1[_0x4d84('0x43')](_0x4d84('0x71'),[]['concat'](_0x3d2eee['query'][_0x10a9ef]));}else if(_0x10a9ef===_0x4d84('0x72')){var _0x24c07d=JSON[_0x4d84('0x73')](_0x3d2eee[_0x4d84('0x39')][_0x10a9ef])[_0x4d84('0x74')];var _0xb28f7c=JSON[_0x4d84('0x73')](_0x3d2eee['query'][_0x10a9ef])['$lte'];_0x4785a1[_0x4d84('0x43')](_0x4d84('0x75'),_0x24c07d,_0xb28f7c);}else{if(_0x3d2eee[_0x4d84('0x39')][_0x10a9ef]==='null'){_0x4785a1[_0x4d84('0x43')]('i.'+_0x10a9ef+'\x20IS\x20NULL');}else{_0x4785a1['where']('i.'+_0x10a9ef+'\x20=\x20?',_0x3d2eee[_0x4d84('0x39')][_0x10a9ef]);}}});}if(_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x76')]){if(_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x76')]==0x1){_0x4785a1['having'](_0x4d84('0x77'));}else{_0x4785a1[_0x4d84('0x61')](_0x4d84('0x78'));}}if(_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x79')]){_0x429c1b=_[_0x4d84('0x7a')](_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x79')])?_0x3d2eee[_0x4d84('0x39')]['tag']:new Array(_0x3d2eee['query']['tag']);_0x429c1b[_0x4d84('0x31')](function(_0x48996a){_0x3dc101['or'](_0x4d84('0x7b'),'%,'+_0x48996a+',%');});}if(_0x3d2eee['query']['filter']){var _0x16efc7=_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x7c')][_0x4d84('0x7d')]('\x5c','\x5c\x5c')[_0x4d84('0x7d')]('\x27\x27',_0x4d84('0x7e'));if(qs[_0x4d84('0x7f')](_0x16efc7)){_0x58e2d5['or'](_0x4d84('0x80'),_0x16efc7+'%')['or'](_0x4d84('0x81'),_0x16efc7+'%');}_0x58e2d5['or'](_0x4d84('0x82'),_0x16efc7+'%');}}_0x4785a1['where'](_0x58e2d5);_0x4785a1['group']('i.id');var _0x151659={'type':db['Sequelize'][_0x4d84('0x83')][_0x4d84('0x84')],'raw':!![]};var _0x4270cb=_0x4785a1['clone']();_0x4270cb[_0x4d84('0x46')](_0x4d84('0x85'));_0x4270cb['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x51f377['order']){_0x51f377[_0x4d84('0x41')]['forEach'](function(_0x12f65e){_0x4785a1[_0x4d84('0x41')]('i.'+_0x12f65e[0x0],_0x12f65e[0x1]===_0x4d84('0x86')?![]:!![]);});}if(!_[_0x4d84('0x87')](_0x429c1b)){_0x4785a1['having'](_0x3dc101);_0x4270cb[_0x4d84('0x43')](_0x4d84('0x88'),_0x429c1b);}BPromise['resolve']()[_0x4d84('0x25')](function(){if(!_0x26c8ce){if(_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x89')]||_0x3d2eee[_0x4d84('0x39')]['journey'])return;_0x4270cb[_0x4d84('0x43')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x4785a1[_0x4d84('0x43')](_0x4d84('0x8a'));return;}return _0x3d2eee[_0x4d84('0x8b')][_0x4d84('0x8c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x38b0c1){if(_['isEmpty'](_0x38b0c1)){_0x4270cb[_0x4d84('0x43')]('i.FaxAccountId\x20IS\x20NULL');_0x4785a1[_0x4d84('0x43')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4270cb[_0x4d84('0x43')]('i.FaxAccountId\x20IN\x20?',_[_0x4d84('0x2c')](_0x38b0c1,'id'));_0x4785a1[_0x4d84('0x43')](_0x4d84('0x71'),_[_0x4d84('0x2c')](_0x38b0c1,'id'));}});})[_0x4d84('0x25')](function(){db[_0x4d84('0x8d')][_0x4d84('0x39')](_0x4270cb['toString'](),_0x151659)[_0x4d84('0x25')](function(_0x4fd348){_0x5c3fca[_0x4d84('0x8e')]=_0x4fd348[_0x4d84('0x3e')];if(_0x5c3fca[_0x4d84('0x8e')]===0x0)return[];return db[_0x4d84('0x8d')][_0x4d84('0x39')](_0xbf42c1[_0x4d84('0x8f')](),_0x151659)['then'](function(_0x5f382c){_0x4affef=_['keyBy'](_0x5f382c,'id');_0x151659=_[_0x4d84('0x90')](_0x151659,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d2eee[_0x4d84('0x39')][_0x4d84('0x3c')]){_0x51f377['attributes'][_0x4d84('0x31')](function(_0x5cfb82){_0x4785a1[_0x4d84('0x46')]('i.'+_0x5cfb82);});}else{_0x4785a1[_0x4d84('0x46')](_0x4d84('0x91'),_0x4d84('0x5f'));_0x4785a1[_0x4d84('0x46')](_0x4d84('0x92'),_0x4d84('0x93'));_0x4785a1[_0x4d84('0x46')](_0x4d84('0x94'),'Account.mandatoryDisposition');_0x4785a1[_0x4d84('0x46')]('i.*');_0x4785a1[_0x4d84('0x46')](_0x4d84('0x95'),_0x4d84('0x96'));_0x4785a1[_0x4d84('0x46')]('c.lastName','Contact.lastName');_0x4785a1[_0x4d84('0x46')]('c.email',_0x4d84('0x97'));_0x4785a1[_0x4d84('0x46')](_0x4d84('0x98'),_0x4d84('0x99'));_0x4785a1[_0x4d84('0x46')](_0x4d84('0x9a'),_0x4d84('0x9b'));_0x4785a1[_0x4d84('0x46')]('c.fax','Contact.fax');_0x4785a1[_0x4d84('0x46')](_0x4d84('0x9c'),_0x4d84('0x9d'));_0x4785a1[_0x4d84('0x46')](_0x4d84('0x9e'),'Owner.internal');_0x4785a1[_0x4d84('0x46')](_0x4d84('0x9f'),_0x4d84('0x2e'));}if(_0x51f377[_0x4d84('0x1c')])_0x4785a1['limit'](_0x51f377['limit']);if(_0x51f377[_0x4d84('0x1b')])_0x4785a1[_0x4d84('0x1b')](_0x51f377[_0x4d84('0x1b')]);return db['sequelize'][_0x4d84('0x39')](_0x4785a1['toString'](),_0x151659);})['then'](function(_0x4ed7fe){_0x52c0d8[_0x4d84('0x43')](_0x4d84('0xa0'),_[_0x4d84('0x2c')](_0x4ed7fe,'id'));return db[_0x4d84('0x8d')][_0x4d84('0x39')](_0x52c0d8[_0x4d84('0x8f')](),_0x151659)['then'](function(_0x2ff689){var _0x1bb7c7=_[_0x4d84('0xa1')](_0x2ff689,_0x4d84('0xa2'));var _0x52c61e=[];_0x4ed7fe[_0x4d84('0x31')](function(_0x24bc7d){_0x52c61e[_0x4d84('0x32')](updateFaxInteraction(_0x24bc7d,_0x4affef,_0x1bb7c7));});return BPromise[_0x4d84('0xa3')](_0x52c61e);});});})[_0x4d84('0x25')](function(_0x54c5f6){_0x5c3fca[_0x4d84('0xa4')]=_0x54c5f6;return _0x5c3fca;})[_0x4d84('0x25')](respondWithFilteredResult(_0x19904a,_0x51f377));})[_0x4d84('0xa5')](handleError(_0x19904a,null));};exports['show']=function(_0x5859d8,_0x14ba60){var _0x3fd219={'raw':![],'where':{'id':_0x5859d8[_0x4d84('0xa6')]['id']}},_0x4407ec={};_0x4407ec[_0x4d84('0x37')]=_[_0x4d84('0x38')](db[_0x4d84('0x33')][_0x4d84('0xa7')]);_0x4407ec['query']=_['keys'](_0x5859d8[_0x4d84('0x39')]);_0x4407ec[_0x4d84('0x3a')]=_[_0x4d84('0x3b')](_0x4407ec['model'],_0x4407ec[_0x4d84('0x39')]);_0x3fd219[_0x4d84('0x3d')]=_['intersection'](_0x4407ec['model'],qs['fields'](_0x5859d8[_0x4d84('0x39')][_0x4d84('0x3c')]));_0x3fd219[_0x4d84('0x3d')]=_0x3fd219[_0x4d84('0x3d')][_0x4d84('0x3e')]?_0x3fd219[_0x4d84('0x3d')]:_0x4407ec[_0x4d84('0x37')];if(_0x5859d8['query'][_0x4d84('0xa8')]){_0x3fd219['include']=[{'all':!![]}];}_0x3fd219=_[_0x4d84('0x90')]({},_0x3fd219,_0x5859d8[_0x4d84('0xa9')]);return db['FaxInteraction'][_0x4d84('0x5e')](_0x3fd219)[_0x4d84('0x25')](handleEntityNotFound(_0x14ba60,null))[_0x4d84('0x25')](respondWithResult(_0x14ba60,null))[_0x4d84('0xa5')](handleError(_0x14ba60,null));};exports['create']=function(_0x53bcb2,_0x351f94){return db['FaxInteraction']['create'](_0x53bcb2[_0x4d84('0xaa')],{})['then'](respondWithResult(_0x351f94,0xc9))[_0x4d84('0xa5')](handleError(_0x351f94,null));};exports[_0x4d84('0x23')]=function(_0x3bd624,_0x365b0e){if(_0x3bd624[_0x4d84('0xaa')]['id']){delete _0x3bd624[_0x4d84('0xaa')]['id'];}return db[_0x4d84('0x33')][_0x4d84('0x5e')]({'where':{'id':_0x3bd624['params']['id']}})[_0x4d84('0x25')](handleEntityNotFound(_0x365b0e,null))[_0x4d84('0x25')](saveUpdates(_0x3bd624[_0x4d84('0xaa')],null))[_0x4d84('0x25')](respondWithResult(_0x365b0e,null))[_0x4d84('0xa5')](handleError(_0x365b0e,null));};exports['destroy']=function(_0x4eb494,_0x3df3da){return db['FaxInteraction'][_0x4d84('0x5e')]({'where':{'id':_0x4eb494[_0x4d84('0xa6')]['id']}})[_0x4d84('0x25')](handleEntityNotFound(_0x3df3da,null))[_0x4d84('0x25')](removeEntity(_0x3df3da,null))[_0x4d84('0xa5')](handleError(_0x3df3da,null));};exports[_0x4d84('0xab')]=function(_0xb6b968,_0x262f59){return db[_0x4d84('0x33')]['describe']()['then'](respondWithResult(_0x262f59,null))['catch'](handleError(_0x262f59,null));};exports['addMessage']=function(_0x365653,_0x43ecae,_0x5147ad){return db[_0x4d84('0xac')]['find']({'where':{'id':_0x365653[_0x4d84('0xa6')]['id']}})[_0x4d84('0x25')](handleEntityNotFound(_0x43ecae,null))['then'](function(_0x23a589){if(_0x23a589){return _0x23a589[_0x4d84('0xad')](_0x365653[_0x4d84('0xaa')][_0x4d84('0xae')],_[_0x4d84('0xaf')](_0x365653[_0x4d84('0xaa')],[_0x4d84('0xae'),'id'])||{});}})['then'](respondWithResult(_0x43ecae,null))['catch'](handleError(_0x43ecae,null));};exports[_0x4d84('0xb0')]=function(_0x5f2c04,_0x1114de,_0x575980){var _0x516b65={'raw':![],'where':{}};var _0x2b1e54={};var _0x16acd1={'count':0x0,'rows':[]};return db[_0x4d84('0x33')][_0x4d84('0xb1')]({'where':{'id':_0x5f2c04[_0x4d84('0xa6')]['id']}})[_0x4d84('0x25')](handleEntityNotFound(_0x1114de,null))[_0x4d84('0x25')](function(_0x22310b){if(_0x22310b){_0x2b1e54[_0x4d84('0x37')]=_['keys'](db[_0x4d84('0xac')][_0x4d84('0xa7')]);_0x2b1e54[_0x4d84('0x39')]=_['keys'](_0x5f2c04[_0x4d84('0x39')]);_0x2b1e54[_0x4d84('0x3a')]=_[_0x4d84('0x3b')](_0x2b1e54[_0x4d84('0x37')],_0x2b1e54[_0x4d84('0x39')]);_0x516b65[_0x4d84('0x3d')]=_['intersection'](_0x2b1e54[_0x4d84('0x37')],qs['fields'](_0x5f2c04['query']['fields']));_0x516b65[_0x4d84('0x3d')]=_0x516b65[_0x4d84('0x3d')][_0x4d84('0x3e')]?_0x516b65['attributes']:_0x2b1e54[_0x4d84('0x37')];if(!_0x5f2c04[_0x4d84('0x39')]['hasOwnProperty'](_0x4d84('0x40'))){_0x516b65[_0x4d84('0x1c')]=qs['limit'](_0x5f2c04[_0x4d84('0x39')][_0x4d84('0x1c')]);_0x516b65['offset']=qs[_0x4d84('0x1b')](_0x5f2c04[_0x4d84('0x39')][_0x4d84('0x1b')]);}_0x516b65[_0x4d84('0x41')]=qs[_0x4d84('0x42')](_0x5f2c04[_0x4d84('0x39')][_0x4d84('0x42')]);_0x516b65[_0x4d84('0x43')]=qs[_0x4d84('0x3a')](_[_0x4d84('0x44')](_0x5f2c04[_0x4d84('0x39')],_0x2b1e54['filters']));_0x516b65[_0x4d84('0x43')][_0x4d84('0xa2')]=_0x22310b['id'];if(_0x5f2c04[_0x4d84('0x39')][_0x4d84('0x7c')]){_0x516b65[_0x4d84('0x43')]=_[_0x4d84('0x90')](_0x516b65[_0x4d84('0x43')],{'$or':_[_0x4d84('0x2c')](_0x516b65[_0x4d84('0x3d')],function(_0x31c709){var _0x1bb2a6={};_0x1bb2a6[_0x31c709]={'$like':'%'+_0x5f2c04[_0x4d84('0x39')][_0x4d84('0x7c')]+'%'};return _0x1bb2a6;})});}if(_0x5f2c04[_0x4d84('0x39')][_0x4d84('0x74')]){var _0x52af4d=_0x5f2c04[_0x4d84('0x39')][_0x4d84('0x74')][_0x4d84('0x30')](',');var _0x4657b1={};_0x4657b1[_0x52af4d[0x0]]={'$gte':moment(_0x52af4d[0x1])[_0x4d84('0xb2')](_0x4d84('0xb3'))};_0x516b65['where']=_[_0x4d84('0x90')](_0x516b65['where'],_0x4657b1);}_0x516b65=_[_0x4d84('0x90')]({},_0x516b65,_0x5f2c04[_0x4d84('0xa9')]);return db['FaxMessage']['count']({'where':_0x516b65['where']})[_0x4d84('0x25')](function(_0x2b91be){_0x16acd1[_0x4d84('0x8e')]=_0x2b91be;if(_0x5f2c04[_0x4d84('0x39')][_0x4d84('0xa8')]){_0x516b65['include']=[{'all':!![]}];}return db['FaxMessage'][_0x4d84('0xb4')](_0x516b65);})['then'](function(_0x43bd70){_0x16acd1[_0x4d84('0xa4')]=_0x43bd70;return _0x16acd1;});}})[_0x4d84('0x25')](respondWithFilteredResult(_0x1114de,_0x516b65))[_0x4d84('0xa5')](handleError(_0x1114de,null));};exports[_0x4d84('0xb5')]=function(_0x273442,_0x112498,_0x252603){return db['FaxInteraction'][_0x4d84('0x5e')]({'where':{'id':_0x273442[_0x4d84('0xa6')]['id']}})[_0x4d84('0x25')](handleEntityNotFound(_0x112498,null))[_0x4d84('0x25')](function(_0x444d4e){if(_0x444d4e){return _0x444d4e[_0x4d84('0xb6')](_0x273442[_0x4d84('0xaa')][_0x4d84('0xae')],_['omit'](_0x273442[_0x4d84('0xaa')],[_0x4d84('0xae'),'id'])||{})['spread'](function(){return db[_0x4d84('0x6b')][_0x4d84('0xb4')]({'attributes':['id',_0x4d84('0x29'),_0x4d84('0x47')],'where':{'id':_0x273442[_0x4d84('0xaa')]['ids']}});})[_0x4d84('0x25')](function(_0x4b4870){socket[_0x4d84('0xb7')](_0x4d84('0xb8'),{'id':Number(_0x273442['params']['id']),'tags':_0x4b4870||[]});return{'id':Number(_0x273442[_0x4d84('0xa6')]['id']),'tags':_0x4b4870||[]};});}})[_0x4d84('0x25')](respondWithResult(_0x112498,null))[_0x4d84('0xa5')](handleError(_0x112498,null));};exports[_0x4d84('0xb9')]=function(_0x57090f,_0xfebaed,_0xc5bcbb){return db[_0x4d84('0x33')]['find']({'where':{'id':_0x57090f[_0x4d84('0xa6')]['id']}})[_0x4d84('0x25')](handleEntityNotFound(_0xfebaed,null))[_0x4d84('0x25')](function(_0x59845e){if(_0x59845e){return _0x59845e[_0x4d84('0xb9')](_0x57090f[_0x4d84('0x39')]['ids']);}})[_0x4d84('0x25')](respondWithStatusCode(_0xfebaed,null))[_0x4d84('0xa5')](handleError(_0xfebaed,null));};exports[_0x4d84('0xba')]=function(_0x22479d,_0x13ca33){var _0x4690b4=moment()[_0x4d84('0xbb')]()[_0x4d84('0x8f')]();var _0x23bcde=path[_0x4d84('0xbc')](config[_0x4d84('0xbd')],'server',_0x4d84('0xbe'),_0x4d84('0xbf'));var _0x581f9b=path['join'](config[_0x4d84('0xbd')],_0x4d84('0xc0'),'files',_0x4d84('0xc1'));var _0x134850=path[_0x4d84('0xbc')](_0x23bcde,_0x4690b4);var _0x1a3e24=util['format']('transcript-%d-%s.zip',_0x22479d[_0x4d84('0xa6')]['id'],_0x4690b4);var _0x35aabe=path[_0x4d84('0xbc')](_0x23bcde,_0x1a3e24);var _0x1b74b6=[];_0x1b74b6[_0x4d84('0x32')]({'model':db[_0x4d84('0xc2')],'as':_0x4d84('0xc2'),'raw':!![]});var _0x512342=[{'model':db[_0x4d84('0xac')],'as':_0x4d84('0xc3'),'attributes':['id',_0x4d84('0xaa'),_0x4d84('0x72')],'include':_0x1b74b6}];return db[_0x4d84('0x33')][_0x4d84('0x5e')]({'where':{'id':_0x22479d[_0x4d84('0xa6')]['id']},'include':_0x512342})[_0x4d84('0x25')](handleEntityNotFound(_0x13ca33,null))[_0x4d84('0x25')](function(_0x3f7637){if(_0x3f7637&&_0x3f7637['Messages']){var _0x4016c2=_0x3f7637[_0x4d84('0xc4')]({'plain':!![]});fs[_0x4d84('0xc5')](_0x134850);for(var _0x34d596=0x0;_0x34d596<_0x4016c2[_0x4d84('0xc3')][_0x4d84('0x3e')];_0x34d596++){var _0x24b7a1=_0x4016c2[_0x4d84('0xc3')][_0x34d596]['Attachment'];if(_0x24b7a1){var _0x391b9e=path[_0x4d84('0xbc')](_0x581f9b,_0x24b7a1[_0x4d84('0xc6')]);if(fs[_0x4d84('0xc7')](_0x391b9e)){fs['createReadStream'](_0x391b9e)['pipe'](fs['createWriteStream'](path[_0x4d84('0xbc')](_0x134850,_0x24b7a1[_0x4d84('0xc6')])));}}}return BPromise['resolve']()[_0x4d84('0x25')](function(){return new BPromise(function(_0x164474,_0x57a281){zipdir(_0x134850,{'saveTo':_0x35aabe},function(_0x4547f2,_0x29f46c){if(_0x4547f2)return _0x57a281(_0x4547f2);return _0x164474(_0x29f46c);});})[_0x4d84('0x25')](function(){return new BPromise(function(_0x5491a6,_0x5ae3cd){rimraf(_0x134850,function(_0xbb0ba0){if(_0xbb0ba0)_0x5ae3cd(_0xbb0ba0);return _0x5491a6();});});})[_0x4d84('0x25')](function(){return _0x13ca33[_0x4d84('0xba')](_0x35aabe,_0x1a3e24,function(_0x1f6b3c){if(_0x1f6b3c){console[_0x4d84('0xc8')](_0x4d84('0xc9'),_0x1f6b3c);}else{fs['unlinkSync'](_0x35aabe);}});});});}else{return _0x13ca33[_0x4d84('0x19')](0xc8);}})[_0x4d84('0xa5')](handleError(_0x13ca33,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c70dfc9..70e4da5 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x49ae6f,_0x409142){var _0x2a48c7=function(_0x35911c){while(--_0x35911c){_0x49ae6f['push'](_0x49ae6f['shift']());}};_0x2a48c7(++_0x409142);}(_0x814b,0x1a2));var _0xb814=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x814b[_0x380307];return _0x9ea14b;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index e75e9db..a6ceda2 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 _0x750a=['FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x414d86,_0x32abf3){var _0x4170d6=function(_0x5abcb2){while(--_0x5abcb2){_0x414d86['push'](_0x414d86['shift']());}};_0x4170d6(++_0x32abf3);}(_0x750a,0x140));var _0xa750=function(_0x5d5fd6,_0x22dbb8){_0x5d5fd6=_0x5d5fd6-0x0;var _0x2c93e7=_0x750a[_0x5d5fd6];return _0x2c93e7;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47a4dd,_0x53f2cb,_0x2678ff){if(_0x47a4dd['changed'](_0xa750('0xc'))){_0x47a4dd[_0xa750('0xd')]=moment()['format'](_0xa750('0xe'));}_0x2678ff(null,_0x47a4dd);}}});}; \ No newline at end of file +var _0x4483=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x3fa3ec,_0x45309d){var _0xb1f26e=function(_0x15dd7a){while(--_0x15dd7a){_0x3fa3ec['push'](_0x3fa3ec['shift']());}};_0xb1f26e(++_0x45309d);}(_0x4483,0x1a3));var _0x3448=function(_0x45a19a,_0x406fea){_0x45a19a=_0x45a19a-0x0;var _0x1bae6a=_0x4483[_0x45a19a];return _0x1bae6a;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require(_0x3448('0x5'));var fs=require('fs');var path=require(_0x3448('0x6'));var rimraf=require(_0x3448('0x7'));var config=require('../../config/environment');var attributes=require(_0x3448('0x8'));module[_0x3448('0x9')]=function(_0x1b05db,_0xd3606d){return _0x1b05db[_0x3448('0xa')](_0x3448('0xb'),attributes,{'tableName':_0x3448('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34b926,_0x5923ee,_0x5c82c6){if(_0x34b926[_0x3448('0xd')](_0x3448('0xe'))){_0x34b926[_0x3448('0xf')]=moment()[_0x3448('0x10')](_0x3448('0x11'));}_0x5c82c6(null,_0x34b926);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index bde325d..97e36c0 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 _0xdbd6=['request','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','where','limit','then','AddTagsToFaxInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register'];(function(_0x28765c,_0x12a2bd){var _0x57a6e7=function(_0x36eeae){while(--_0x36eeae){_0x28765c['push'](_0x28765c['shift']());}};_0x57a6e7(++_0x12a2bd);}(_0xdbd6,0x12e));var _0x6dbd=function(_0x3e3f61,_0x506633){_0x3e3f61=_0x3e3f61-0x0;var _0xae7de4=_0xdbd6[_0x3e3f61];return _0xae7de4;};'use strict';var _=require(_0x6dbd('0x0'));var util=require(_0x6dbd('0x1'));var moment=require(_0x6dbd('0x2'));var BPromise=require(_0x6dbd('0x3'));var rs=require(_0x6dbd('0x4'));var fs=require('fs');var Redis=require(_0x6dbd('0x5'));var db=require(_0x6dbd('0x6'))['db'];var utils=require(_0x6dbd('0x7'));var logger=require(_0x6dbd('0x8'))(_0x6dbd('0x9'));var config=require(_0x6dbd('0xa'));var jayson=require(_0x6dbd('0xb'));var client=jayson[_0x6dbd('0xc')][_0x6dbd('0xd')]({'port':0x232a});config[_0x6dbd('0xe')]=_[_0x6dbd('0xf')](config[_0x6dbd('0xe')],{'host':_0x6dbd('0x10'),'port':0x18eb});var socket=require(_0x6dbd('0x11'))(new Redis(config[_0x6dbd('0xe')]));require(_0x6dbd('0x12'))[_0x6dbd('0x13')](socket);function respondWithRpcPromise(_0x373e46,_0x53bc0e,_0x5dd56a){return new BPromise(function(_0x317973,_0x1f166a){return client[_0x6dbd('0x14')](_0x373e46,_0x5dd56a)['then'](function(_0x352e97){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x53bc0e,_0x6dbd('0x15'));logger[_0x6dbd('0x16')](_0x6dbd('0x17'),_0x53bc0e,_0x6dbd('0x15'),JSON[_0x6dbd('0x18')](_0x352e97));if(_0x352e97[_0x6dbd('0x19')]){if(_0x352e97[_0x6dbd('0x19')][_0x6dbd('0x1a')]===0x1f4){logger[_0x6dbd('0x19')](_0x6dbd('0x1b'),_0x53bc0e,_0x352e97[_0x6dbd('0x19')][_0x6dbd('0x1c')]);return _0x1f166a(_0x352e97['error'][_0x6dbd('0x1c')]);}logger[_0x6dbd('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x53bc0e,_0x352e97['error'][_0x6dbd('0x1c')]);return _0x317973(_0x352e97[_0x6dbd('0x19')]['message']);}else{logger[_0x6dbd('0x1d')](_0x6dbd('0x1b'),_0x53bc0e,_0x6dbd('0x15'));_0x317973(_0x352e97[_0x6dbd('0x1e')][_0x6dbd('0x1c')]);}})[_0x6dbd('0x1f')](function(_0x5d9fd2){logger[_0x6dbd('0x19')](_0x6dbd('0x1b'),_0x53bc0e,_0x5d9fd2);_0x1f166a(_0x5d9fd2);});});}exports[_0x6dbd('0x20')]=function(_0x4b01c3){var _0x58ddcb=this;return new Promise(function(_0x284a37,_0x5c9e90){return db[_0x6dbd('0x21')][_0x6dbd('0x22')](_0x4b01c3[_0x6dbd('0x23')],{'raw':_0x4b01c3['options']?_0x4b01c3['options'][_0x6dbd('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b01c3[_0x6dbd('0x25')]?_0x4b01c3[_0x6dbd('0x25')][_0x6dbd('0x26')]||null:null,'attributes':_0x4b01c3[_0x6dbd('0x25')]?_0x4b01c3[_0x6dbd('0x25')]['attributes']||null:null,'limit':_0x4b01c3[_0x6dbd('0x25')]?_0x4b01c3[_0x6dbd('0x25')][_0x6dbd('0x27')]||null:null})[_0x6dbd('0x28')](function(_0x3ad54e){logger[_0x6dbd('0x1d')](_0x6dbd('0x20'),_0x4b01c3);logger[_0x6dbd('0x16')](_0x6dbd('0x20'),_0x4b01c3,JSON['stringify'](_0x3ad54e));_0x284a37(_0x3ad54e);})[_0x6dbd('0x1f')](function(_0x33e3e9){logger['error'](_0x6dbd('0x20'),_0x33e3e9[_0x6dbd('0x1c')],_0x4b01c3);_0x5c9e90(_0x58ddcb['error'](0x1f4,_0x33e3e9[_0x6dbd('0x1c')]));});});};exports[_0x6dbd('0x29')]=function(_0x25c104){return new Promise(function(_0x4c6aaa,_0x48101b){return db[_0x6dbd('0x21')][_0x6dbd('0x2a')]({'where':_0x25c104['options']?_0x25c104[_0x6dbd('0x25')][_0x6dbd('0x26')]||null:null})['then'](function(_0x3267e7){if(_0x3267e7){return _0x3267e7['addTags'](_0x25c104[_0x6dbd('0x23')][_0x6dbd('0x2b')],_['omit'](_0x25c104[_0x6dbd('0x23')],[_0x6dbd('0x2b'),'id'])||{});}})[_0x6dbd('0x2c')](function(_0x3ba30b){logger[_0x6dbd('0x1d')]('AddTags',_0x25c104);logger[_0x6dbd('0x16')](_0x6dbd('0x2d'),_0x25c104,JSON[_0x6dbd('0x18')](_0x3ba30b));_0x4c6aaa(_0x3ba30b);})[_0x6dbd('0x1f')](function(_0x5f4304){logger[_0x6dbd('0x19')]('AddTags',_0x5f4304[_0x6dbd('0x1c')],_0x25c104);_0x48101b(_this[_0x6dbd('0x19')](0x1f4,_0x5f4304[_0x6dbd('0x1c')]));});});}; \ No newline at end of file +var _0xdaf1=['FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','addTags','omit','ids','spread','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x454f1e,_0x187cac){var _0x3e22bc=function(_0x6e5176){while(--_0x6e5176){_0x454f1e['push'](_0x454f1e['shift']());}};_0x3e22bc(++_0x187cac);}(_0xdaf1,0x105));var _0x1daf=function(_0x200dbd,_0x2d0e00){_0x200dbd=_0x200dbd-0x0;var _0x17b9bb=_0xdaf1[_0x200dbd];return _0x17b9bb;};'use strict';var _=require(_0x1daf('0x0'));var util=require(_0x1daf('0x1'));var moment=require(_0x1daf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1daf('0x3'));var db=require(_0x1daf('0x4'))['db'];var utils=require(_0x1daf('0x5'));var logger=require(_0x1daf('0x6'))(_0x1daf('0x7'));var config=require(_0x1daf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1daf('0x9')][_0x1daf('0xa')]({'port':0x232a});config[_0x1daf('0xb')]=_['defaults'](config[_0x1daf('0xb')],{'host':_0x1daf('0xc'),'port':0x18eb});var socket=require(_0x1daf('0xd'))(new Redis(config[_0x1daf('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3e63e5,_0x155e70,_0x5edd85){return new BPromise(function(_0xd49975,_0x3b776b){return client[_0x1daf('0xe')](_0x3e63e5,_0x5edd85)[_0x1daf('0xf')](function(_0x5bd9fb){logger['info'](_0x1daf('0x10'),_0x155e70,_0x1daf('0x11'));logger[_0x1daf('0x12')](_0x1daf('0x13'),_0x155e70,'request\x20sent',JSON[_0x1daf('0x14')](_0x5bd9fb));if(_0x5bd9fb[_0x1daf('0x15')]){if(_0x5bd9fb[_0x1daf('0x15')][_0x1daf('0x16')]===0x1f4){logger[_0x1daf('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x155e70,_0x5bd9fb[_0x1daf('0x15')][_0x1daf('0x17')]);return _0x3b776b(_0x5bd9fb[_0x1daf('0x15')][_0x1daf('0x17')]);}logger[_0x1daf('0x15')](_0x1daf('0x10'),_0x155e70,_0x5bd9fb['error'][_0x1daf('0x17')]);return _0xd49975(_0x5bd9fb[_0x1daf('0x15')][_0x1daf('0x17')]);}else{logger[_0x1daf('0x18')](_0x1daf('0x10'),_0x155e70,_0x1daf('0x11'));_0xd49975(_0x5bd9fb['result'][_0x1daf('0x17')]);}})[_0x1daf('0x19')](function(_0x3d8f02){logger[_0x1daf('0x15')](_0x1daf('0x10'),_0x155e70,_0x3d8f02);_0x3b776b(_0x3d8f02);});});}exports['UpdateFaxInteraction']=function(_0x3b7afb){var _0x178a44=this;return new Promise(function(_0x142680,_0x17eab8){return db[_0x1daf('0x1a')][_0x1daf('0x1b')](_0x3b7afb[_0x1daf('0x1c')],{'raw':_0x3b7afb[_0x1daf('0x1d')]?_0x3b7afb[_0x1daf('0x1d')][_0x1daf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b7afb[_0x1daf('0x1d')]?_0x3b7afb['options'][_0x1daf('0x1f')]||null:null,'attributes':_0x3b7afb[_0x1daf('0x1d')]?_0x3b7afb[_0x1daf('0x1d')][_0x1daf('0x20')]||null:null,'limit':_0x3b7afb['options']?_0x3b7afb[_0x1daf('0x1d')][_0x1daf('0x21')]||null:null})[_0x1daf('0xf')](function(_0x38edaa){logger[_0x1daf('0x18')](_0x1daf('0x22'),_0x3b7afb);logger[_0x1daf('0x12')](_0x1daf('0x22'),_0x3b7afb,JSON[_0x1daf('0x14')](_0x38edaa));_0x142680(_0x38edaa);})[_0x1daf('0x19')](function(_0x2711cc){logger[_0x1daf('0x15')](_0x1daf('0x22'),_0x2711cc['message'],_0x3b7afb);_0x17eab8(_0x178a44[_0x1daf('0x15')](0x1f4,_0x2711cc['message']));});});};exports[_0x1daf('0x23')]=function(_0xb09746){return new Promise(function(_0x218886,_0x26d369){return db[_0x1daf('0x1a')]['find']({'where':_0xb09746[_0x1daf('0x1d')]?_0xb09746[_0x1daf('0x1d')][_0x1daf('0x1f')]||null:null})['then'](function(_0x17d31c){if(_0x17d31c){return _0x17d31c[_0x1daf('0x24')](_0xb09746['body']['ids'],_[_0x1daf('0x25')](_0xb09746['body'],[_0x1daf('0x26'),'id'])||{});}})[_0x1daf('0x27')](function(_0x289809){logger[_0x1daf('0x18')]('AddTags',_0xb09746);logger['debug']('AddTags',_0xb09746,JSON[_0x1daf('0x14')](_0x289809));_0x218886(_0x289809);})[_0x1daf('0x19')](function(_0x408c1e){logger[_0x1daf('0x15')]('AddTags',_0x408c1e[_0x1daf('0x17')],_0xb09746);_0x26d369(_this['error'](0x1f4,_0x408c1e[_0x1daf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 50cf0dd..edd3b9f 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 _0x98e9=['update','emit','removeListener','register','./faxInteraction.events','save','remove'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x98e9,0x19a));var _0x998e=function(_0x26fadc,_0xf81575){_0x26fadc=_0x26fadc-0x0;var _0x49921a=_0x98e9[_0x26fadc];return _0x49921a;};'use strict';var FaxInteractionEvents=require(_0x998e('0x0'));var events=[_0x998e('0x1'),_0x998e('0x2'),_0x998e('0x3')];function createListener(_0x61d244,_0x23e29e){return function(_0x48bfdc){_0x23e29e[_0x998e('0x4')](_0x61d244,_0x48bfdc);};}function removeListener(_0x397859,_0x2a422e){return function(){FaxInteractionEvents[_0x998e('0x5')](_0x397859,_0x2a422e);};}exports[_0x998e('0x6')]=function(_0x8a2f8d){for(var _0x22c748=0x0,_0x45f0c6=events['length'];_0x22c748<_0x45f0c6;_0x22c748++){var _0x51da67=events[_0x22c748];var _0x2841b6=createListener('faxInteraction:'+_0x51da67,_0x8a2f8d);FaxInteractionEvents['on'](_0x51da67,_0x2841b6);}}; \ No newline at end of file +var _0x4d9e=['save','remove','update','emit','removeListener','length','faxInteraction:'];(function(_0x3a9b59,_0x36a0f1){var _0x2a80b8=function(_0x2cd779){while(--_0x2cd779){_0x3a9b59['push'](_0x3a9b59['shift']());}};_0x2a80b8(++_0x36a0f1);}(_0x4d9e,0x93));var _0xe4d9=function(_0x2667bc,_0x21aa1d){_0x2667bc=_0x2667bc-0x0;var _0x2c43f3=_0x4d9e[_0x2667bc];return _0x2c43f3;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xe4d9('0x0'),_0xe4d9('0x1'),_0xe4d9('0x2')];function createListener(_0x1d69c3,_0x53051e){return function(_0x112979){_0x53051e[_0xe4d9('0x3')](_0x1d69c3,_0x112979);};}function removeListener(_0x3f5b34,_0x41bf02){return function(){FaxInteractionEvents[_0xe4d9('0x4')](_0x3f5b34,_0x41bf02);};}exports['register']=function(_0x475c75){for(var _0x9c2c72=0x0,_0x30145b=events[_0xe4d9('0x5')];_0x9c2c72<_0x30145b;_0x9c2c72++){var _0x4e2df0=events[_0x9c2c72];var _0x301dd1=createListener(_0xe4d9('0x6')+_0x4e2df0,_0x475c75);FaxInteractionEvents['on'](_0x4e2df0,_0x301dd1);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 97fada9..9eb5716 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 _0xf13e=['put','/:id','tracked','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','fax','faxinteraction:addtags','addTags'];(function(_0x434010,_0x591dd5){var _0x37cab1=function(_0x4fab0b){while(--_0x4fab0b){_0x434010['push'](_0x434010['shift']());}};_0x37cab1(++_0x591dd5);}(_0xf13e,0x6a));var _0xef13=function(_0x2c5476,_0x3f9a0){_0x2c5476=_0x2c5476-0x0;var _0x493e1d=_0xf13e[_0x2c5476];return _0x493e1d;};'use strict';var multer=require(_0xef13('0x0'));var util=require(_0xef13('0x1'));var path=require(_0xef13('0x2'));var timeout=require(_0xef13('0x3'));var express=require(_0xef13('0x4'));var router=express[_0xef13('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xef13('0x6'));var controller=require(_0xef13('0x7'));router[_0xef13('0x8')]('/',auth[_0xef13('0x9')](),controller['index']);router[_0xef13('0x8')](_0xef13('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xef13('0x8')]('/:id',auth[_0xef13('0x9')](),controller[_0xef13('0xb')]);router[_0xef13('0x8')](_0xef13('0xc'),auth[_0xef13('0x9')](),controller[_0xef13('0xd')]);router['get'](_0xef13('0xe'),auth[_0xef13('0x9')](),controller[_0xef13('0xf')]);router[_0xef13('0x10')]('/',auth[_0xef13('0x9')](),controller[_0xef13('0x11')]);router[_0xef13('0x10')]('/:id/messages',auth[_0xef13('0x9')](),controller[_0xef13('0x12')]);router[_0xef13('0x10')]('/:id/tags',auth[_0xef13('0x9')](),interaction['tracked'](_0xef13('0x13'),_0xef13('0x14')),controller[_0xef13('0x15')]);router[_0xef13('0x16')](_0xef13('0x17'),auth[_0xef13('0x9')](),interaction[_0xef13('0x18')](_0xef13('0x13'),_0xef13('0x19')),controller[_0xef13('0x1a')]);router['delete'](_0xef13('0x17'),auth['isAuthenticated'](),interaction[_0xef13('0x18')](_0xef13('0x13'),_0xef13('0x1b')),controller[_0xef13('0x1c')]);router[_0xef13('0x1d')]('/:id/tags',auth[_0xef13('0x9')](),controller[_0xef13('0x1e')]);module[_0xef13('0x1f')]=router; \ No newline at end of file +var _0x4d2f=['tracked','faxinteraction:addtags','fax','faxinteraction:update','destroy','removeTags','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x1e2b8e,_0x595d21){var _0xe0be7=function(_0x4c551b){while(--_0x4c551b){_0x1e2b8e['push'](_0x1e2b8e['shift']());}};_0xe0be7(++_0x595d21);}(_0x4d2f,0x19c));var _0xf4d2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4d2f[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xf4d2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf4d2('0x1'));var express=require(_0xf4d2('0x2'));var router=express[_0xf4d2('0x3')]();var auth=require(_0xf4d2('0x4'));var interaction=require(_0xf4d2('0x5'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0xf4d2('0x6')]('/',auth[_0xf4d2('0x7')](),controller[_0xf4d2('0x8')]);router[_0xf4d2('0x6')](_0xf4d2('0x9'),auth[_0xf4d2('0x7')](),controller[_0xf4d2('0xa')]);router[_0xf4d2('0x6')](_0xf4d2('0xb'),auth[_0xf4d2('0x7')](),controller[_0xf4d2('0xc')]);router[_0xf4d2('0x6')]('/:id/messages',auth[_0xf4d2('0x7')](),controller[_0xf4d2('0xd')]);router[_0xf4d2('0x6')](_0xf4d2('0xe'),auth[_0xf4d2('0x7')](),controller[_0xf4d2('0xf')]);router[_0xf4d2('0x10')]('/',auth[_0xf4d2('0x7')](),controller[_0xf4d2('0x11')]);router[_0xf4d2('0x10')]('/:id/messages',auth[_0xf4d2('0x7')](),controller[_0xf4d2('0x12')]);router['post'](_0xf4d2('0x13'),auth['isAuthenticated'](),interaction[_0xf4d2('0x14')]('fax',_0xf4d2('0x15')),controller['addTags']);router['put'](_0xf4d2('0xb'),auth['isAuthenticated'](),interaction[_0xf4d2('0x14')](_0xf4d2('0x16'),_0xf4d2('0x17')),controller['update']);router['delete'](_0xf4d2('0xb'),auth[_0xf4d2('0x7')](),interaction[_0xf4d2('0x14')](_0xf4d2('0x16'),'faxinteraction:destroy'),controller[_0xf4d2('0x18')]);router['delete'](_0xf4d2('0x13'),auth[_0xf4d2('0x7')](),controller[_0xf4d2('0x19')]);module[_0xf4d2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7e385bf..35784a0 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 _0x0a50=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x479550,_0x237af1){var _0x424527=function(_0x3108bd){while(--_0x3108bd){_0x479550['push'](_0x479550['shift']());}};_0x424527(++_0x237af1);}(_0x0a50,0x158));var _0x00a5=function(_0x8f0755,_0x9b2637){_0x8f0755=_0x8f0755-0x0;var _0x2b2997=_0x0a50[_0x8f0755];return _0x2b2997;};'use strict';var Sequelize=require(_0x00a5('0x0'));module[_0x00a5('0x1')]={'body':{'type':Sequelize[_0x00a5('0x2')](_0x00a5('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x00a5('0x4')]('in',_0x00a5('0x5')),'defaultValue':_0x00a5('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x00a5('0x6')]}}; \ No newline at end of file +var _0x993f=['medium','ENUM','out','DATE','sequelize','TEXT'];(function(_0x29982b,_0x594e0){var _0xb1f0a9=function(_0x3d824c){while(--_0x3d824c){_0x29982b['push'](_0x29982b['shift']());}};_0xb1f0a9(++_0x594e0);}(_0x993f,0x1f0));var _0xf993=function(_0x39ff19,_0x416f57){_0x39ff19=_0x39ff19-0x0;var _0x4b15da=_0x993f[_0x39ff19];return _0x4b15da;};'use strict';var Sequelize=require(_0xf993('0x0'));module['exports']={'body':{'type':Sequelize[_0xf993('0x1')](_0xf993('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf993('0x3')]('in',_0xf993('0x4')),'defaultValue':_0xf993('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf993('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf993('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 00adc2d..b2dd99d 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 _0x1630=['include','params','find','body','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','SIP/%s','channel','event','EventManager','fax-interactions','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','findOne','ContactId','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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','redis','defaults','localhost','socket.io-emitter','register','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','FaxMessage','includeAll'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x1630,0x1c1));var _0x0163=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1630[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require(_0x0163('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0163('0x1'));var zipdir=require(_0x0163('0x2'));var jsonpatch=require(_0x0163('0x3'));var rp=require(_0x0163('0x4'));var moment=require(_0x0163('0x5'));var BPromise=require(_0x0163('0x6'));var Mustache=require(_0x0163('0x7'));var util=require(_0x0163('0x8'));var path=require('path');var sox=require(_0x0163('0x9'));var csv=require(_0x0163('0xa'));var ejs=require(_0x0163('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0163('0xc'));var crypto=require(_0x0163('0xd'));var jsforce=require(_0x0163('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0163('0xf'));var Redis=require(_0x0163('0x10'));var authService=require(_0x0163('0x11'));var qs=require(_0x0163('0x12'));var as=require(_0x0163('0x13'));var hardwareService=require(_0x0163('0x14'));var logger=require(_0x0163('0x15'))(_0x0163('0x16'));var utils=require(_0x0163('0x17'));var config=require(_0x0163('0x18'));var db=require(_0x0163('0x19'))['db'];config[_0x0163('0x1a')]=_[_0x0163('0x1b')](config['redis'],{'host':_0x0163('0x1c'),'port':0x18eb});var socket=require(_0x0163('0x1d'))(new Redis(config[_0x0163('0x1a')]));require('./faxMessage.socket')[_0x0163('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0163('0x1f')][_0x0163('0x20')]({'port':0x232c});var client9002=jayson[_0x0163('0x1f')][_0x0163('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1233f0,_0x490595,_0x26c4d4){if(_0x26c4d4){var _0x43b4d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43b4d5[_0x0163('0x21')](_0x490595)){return _0x1233f0;}else{throw new db['Sequelize'][(_0x0163('0x22'))](_0x0163('0x23'));}}else{return _0x1233f0;}}function respondWithRpcPromise(_0x4eec11,_0x24701e,_0x493bfc,_0x18c700){return new BPromise(function(_0x134c01,_0x2352d6){var _0x1e4ffe=_0x18c700||client;return _0x1e4ffe['request'](_0x4eec11,_0x493bfc)['then'](function(_0x39eb30){logger[_0x0163('0x24')](_0x0163('0x25'),_0x24701e,'request\x20sent');logger[_0x0163('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x24701e,_0x0163('0x27'),JSON[_0x0163('0x28')](_0x39eb30));if(_0x39eb30[_0x0163('0x29')]){if(_0x39eb30[_0x0163('0x29')][_0x0163('0x2a')]===0x1f4){logger[_0x0163('0x29')](_0x0163('0x25'),_0x24701e,_0x39eb30[_0x0163('0x29')][_0x0163('0x2b')]);return _0x2352d6(_0x39eb30[_0x0163('0x29')][_0x0163('0x2b')]);}logger[_0x0163('0x29')](_0x0163('0x25'),_0x24701e,_0x39eb30[_0x0163('0x29')]['message']);return _0x134c01(_0x39eb30[_0x0163('0x29')][_0x0163('0x2b')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x24701e,'request\x20sent');_0x134c01(_0x39eb30[_0x0163('0x2c')][_0x0163('0x2b')]);}})[_0x0163('0x2d')](function(_0x43324c){logger['error'](_0x0163('0x25'),_0x24701e,_0x43324c);_0x2352d6(_0x43324c);});});}function respondWithStatusCode(_0x28be90,_0x463f0c){_0x463f0c=_0x463f0c||0xcc;return function(_0x485b8f){if(_0x485b8f){return _0x28be90[_0x0163('0x2e')](_0x463f0c);}return _0x28be90[_0x0163('0x2f')](_0x463f0c)[_0x0163('0x30')]();};}function respondWithResult(_0x52593b,_0x1f21ad){_0x1f21ad=_0x1f21ad||0xc8;return function(_0x280afb){if(_0x280afb){return _0x52593b[_0x0163('0x2f')](_0x1f21ad)[_0x0163('0x31')](_0x280afb);}};}function respondWithFilteredResult(_0x4f29fb,_0x2496e2){return function(_0x45e40a){if(_0x45e40a){var _0x3d6054=_0x45e40a[_0x0163('0x32')],_0x125a59=_0x2496e2[_0x0163('0x33')],_0x1e2cd2=_0x2496e2[_0x0163('0x33')]+_0x2496e2[_0x0163('0x34')],_0x120a31;if(_0x1e2cd2>=_0x3d6054){_0x1e2cd2=_0x3d6054;_0x120a31=0xc8;}else{_0x120a31=0xce;}_0x4f29fb[_0x0163('0x2f')](_0x120a31);return _0x4f29fb[_0x0163('0x35')](_0x0163('0x36'),_0x125a59+'-'+_0x1e2cd2+'/'+_0x3d6054)[_0x0163('0x31')](_0x45e40a);}return null;};}function patchUpdates(_0xbcf440){return function(_0x59adc3){try{jsonpatch[_0x0163('0x37')](_0x59adc3,_0xbcf440,!![]);}catch(_0x4b36cc){return BPromise['reject'](_0x4b36cc);}return _0x59adc3[_0x0163('0x38')]();};}function saveUpdates(_0x258dd6,_0x39db80){return function(_0x5d4374){if(_0x5d4374){return _0x5d4374[_0x0163('0x39')](_0x258dd6)[_0x0163('0x3a')](function(_0x2a3e0d){return _0x2a3e0d;});}return null;};}function removeEntity(_0x250cc6,_0x125091){return function(_0x104bb3){if(_0x104bb3){return _0x104bb3[_0x0163('0x3b')]()[_0x0163('0x3a')](function(){_0x250cc6[_0x0163('0x2f')](0xcc)[_0x0163('0x30')]();});}};}function handleEntityNotFound(_0x5b5ae4,_0x353725){return function(_0x304a53){if(!_0x304a53){_0x5b5ae4['sendStatus'](0x194);}return _0x304a53;};}function handleError(_0x567b9d,_0xca2c1c){_0xca2c1c=_0xca2c1c||0x1f4;return function(_0x53d859){logger['error'](_0x53d859[_0x0163('0x3c')]);if(_0x53d859[_0x0163('0x3d')]){delete _0x53d859['name'];}_0x567b9d[_0x0163('0x2f')](_0xca2c1c)['send'](_0x53d859);};}exports[_0x0163('0x3e')]=function(_0x21fbac,_0x46874d){var _0x3ac366={},_0x3901d0={},_0x514726={'count':0x0,'rows':[]};var _0xd4e265=_[_0x0163('0x3f')](db['FaxMessage'][_0x0163('0x40')],function(_0x7325a5){return{'name':_0x7325a5[_0x0163('0x41')],'type':_0x7325a5[_0x0163('0x42')][_0x0163('0x43')]};});_0x3901d0[_0x0163('0x44')]=_[_0x0163('0x3f')](_0xd4e265,_0x0163('0x3d'));_0x3901d0[_0x0163('0x45')]=_[_0x0163('0x46')](_0x21fbac[_0x0163('0x45')]);_0x3901d0['filters']=_[_0x0163('0x47')](_0x3901d0[_0x0163('0x44')],_0x3901d0[_0x0163('0x45')]);_0x3ac366[_0x0163('0x48')]=_[_0x0163('0x47')](_0x3901d0['model'],qs[_0x0163('0x49')](_0x21fbac[_0x0163('0x45')][_0x0163('0x49')]));_0x3ac366['attributes']=_0x3ac366[_0x0163('0x48')][_0x0163('0x4a')]?_0x3ac366[_0x0163('0x48')]:_0x3901d0['model'];if(!_0x21fbac[_0x0163('0x45')][_0x0163('0x4b')](_0x0163('0x4c'))){_0x3ac366[_0x0163('0x34')]=qs[_0x0163('0x34')](_0x21fbac[_0x0163('0x45')][_0x0163('0x34')]);_0x3ac366[_0x0163('0x33')]=qs[_0x0163('0x33')](_0x21fbac[_0x0163('0x45')]['offset']);}_0x3ac366['order']=qs[_0x0163('0x4d')](_0x21fbac[_0x0163('0x45')][_0x0163('0x4d')]);_0x3ac366[_0x0163('0x4e')]=qs[_0x0163('0x4f')](_[_0x0163('0x50')](_0x21fbac[_0x0163('0x45')],_0x3901d0[_0x0163('0x4f')]),_0xd4e265);if(_0x21fbac[_0x0163('0x45')]['filter']){_0x3ac366[_0x0163('0x4e')]=_['merge'](_0x3ac366[_0x0163('0x4e')],{'$or':_['map'](_0xd4e265,function(_0x588260){if(_0x588260[_0x0163('0x42')]!==_0x0163('0x51')){var _0x3d3ea0={};_0x3d3ea0[_0x588260[_0x0163('0x3d')]]={'$like':'%'+_0x21fbac['query'][_0x0163('0x52')]+'%'};return _0x3d3ea0;}})});}_0x3ac366=_[_0x0163('0x53')]({},_0x3ac366,_0x21fbac[_0x0163('0x54')]);var _0x1b56a9={'where':_0x3ac366[_0x0163('0x4e')]};return db[_0x0163('0x55')][_0x0163('0x32')](_0x1b56a9)[_0x0163('0x3a')](function(_0x72078e){_0x514726['count']=_0x72078e;if(_0x21fbac[_0x0163('0x45')][_0x0163('0x56')]){_0x3ac366[_0x0163('0x57')]=[{'all':!![]}];}return db[_0x0163('0x55')]['findAll'](_0x3ac366);})[_0x0163('0x3a')](function(_0x5af884){_0x514726['rows']=_0x5af884;return _0x514726;})[_0x0163('0x3a')](respondWithFilteredResult(_0x46874d,_0x3ac366))['catch'](handleError(_0x46874d,null));};exports['show']=function(_0x3b6b89,_0xda65fd){var _0x5807eb={'raw':!![],'where':{'id':_0x3b6b89[_0x0163('0x58')]['id']}},_0x58123b={};_0x58123b[_0x0163('0x44')]=_[_0x0163('0x46')](db[_0x0163('0x55')][_0x0163('0x40')]);_0x58123b[_0x0163('0x45')]=_[_0x0163('0x46')](_0x3b6b89[_0x0163('0x45')]);_0x58123b[_0x0163('0x4f')]=_['intersection'](_0x58123b[_0x0163('0x44')],_0x58123b[_0x0163('0x45')]);_0x5807eb['attributes']=_[_0x0163('0x47')](_0x58123b[_0x0163('0x44')],qs[_0x0163('0x49')](_0x3b6b89[_0x0163('0x45')][_0x0163('0x49')]));_0x5807eb['attributes']=_0x5807eb[_0x0163('0x48')][_0x0163('0x4a')]?_0x5807eb[_0x0163('0x48')]:_0x58123b[_0x0163('0x44')];if(_0x3b6b89[_0x0163('0x45')][_0x0163('0x56')]){_0x5807eb[_0x0163('0x57')]=[{'all':!![]}];}_0x5807eb=_[_0x0163('0x53')]({},_0x5807eb,_0x3b6b89[_0x0163('0x54')]);return db[_0x0163('0x55')][_0x0163('0x59')](_0x5807eb)['then'](handleEntityNotFound(_0xda65fd,null))[_0x0163('0x3a')](respondWithResult(_0xda65fd,null))[_0x0163('0x2d')](handleError(_0xda65fd,null));};exports[_0x0163('0x39')]=function(_0x482c48,_0x49699d){if(_0x482c48[_0x0163('0x5a')]['id']){delete _0x482c48[_0x0163('0x5a')]['id'];}return db['FaxMessage'][_0x0163('0x59')]({'where':{'id':_0x482c48[_0x0163('0x58')]['id']}})[_0x0163('0x3a')](handleEntityNotFound(_0x49699d,null))[_0x0163('0x3a')](saveUpdates(_0x482c48[_0x0163('0x5a')],null))[_0x0163('0x3a')](respondWithResult(_0x49699d,null))[_0x0163('0x2d')](handleError(_0x49699d,null));};exports[_0x0163('0x3b')]=function(_0x1152fb,_0x1801cf){return db[_0x0163('0x55')][_0x0163('0x59')]({'where':{'id':_0x1152fb[_0x0163('0x58')]['id']}})[_0x0163('0x3a')](handleEntityNotFound(_0x1801cf,null))['then'](removeEntity(_0x1801cf,null))[_0x0163('0x2d')](handleError(_0x1801cf,null));};exports['describe']=function(_0x3d886b,_0x4cd682){return db[_0x0163('0x55')][_0x0163('0x5b')]()[_0x0163('0x3a')](respondWithResult(_0x4cd682,null))[_0x0163('0x2d')](handleError(_0x4cd682,null));};var interaction_log=require(_0x0163('0x15'))('fax-interactions');exports[_0x0163('0x5c')]=function(_0x398a44,_0x2f1ab2,_0x319031){var _0x186485={'channel':_0x0163('0x5d')};if(_0x398a44[_0x0163('0x5a')]['id']){delete _0x398a44[_0x0163('0x5a')]['id'];}_0x398a44[_0x0163('0x5a')][_0x0163('0x5e')]=!![];_0x398a44[_0x0163('0x5a')][_0x0163('0x5f')]=moment()[_0x0163('0x60')](_0x0163('0x61'));_0x398a44['body']['UserId']=_0x398a44[_0x0163('0x5a')][_0x0163('0x62')]||_0x398a44['user']['id'];return db['FaxMessage'][_0x0163('0x59')]({'where':{'id':_0x398a44[_0x0163('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x0163('0x63')],'as':_0x0163('0x64')}]})[_0x0163('0x3a')](handleEntityNotFound(_0x2f1ab2,null))[_0x0163('0x3a')](saveUpdates(_0x398a44[_0x0163('0x5a')],null))[_0x0163('0x3a')](function(_0x59f9fd){if(_0x59f9fd){_0x186485[_0x0163('0x2b')]=_0x59f9fd['get']({'plain':!![]});return db[_0x0163('0x65')][_0x0163('0x59')]({'where':{'id':_0x59f9fd[_0x0163('0x66')]}});}return null;})[_0x0163('0x3a')](handleEntityNotFound(_0x2f1ab2,null))[_0x0163('0x3a')](function(_0x3cf8fa){if(_0x3cf8fa){return _0x3cf8fa[_0x0163('0x39')]({'UserId':_0x398a44[_0x0163('0x5a')][_0x0163('0x62')],'read1stAt':_[_0x0163('0x67')](_0x3cf8fa[_0x0163('0x68')])?moment()[_0x0163('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0163('0x3a')](function(_0x535ab9){if(_0x535ab9){_0x186485['interaction']=_0x535ab9[_0x0163('0x69')]({'plain':!![]});interaction_log[_0x0163('0x24')](_0x0163('0x6a'),_0x398a44[_0x0163('0x6b')]['id'],_0x398a44['user']['name'],_0x398a44['user'][_0x0163('0x6c')],_0x186485[_0x0163('0x6d')]['id'],_0x398a44[_0x0163('0x5a')]?JSON[_0x0163('0x28')](_0x398a44[_0x0163('0x5a')]):_0x0163('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x0163('0x6f'),_0x186485);}return null;})[_0x0163('0x3a')](function(_0x5f4490){if(_0x5f4490){if(_0x398a44[_0x0163('0x5a')]['manual']){_0x186485['message']['interface']=util['format'](_0x0163('0x70'),_0x398a44[_0x0163('0x6b')][_0x0163('0x3d')]);_0x186485[_0x0163('0x2b')]['channel']=_0x186485[_0x0163('0x71')];_0x186485[_0x0163('0x2b')][_0x0163('0x72')]=_0x0163('0x5c');return respondWithRpcPromise(_0x0163('0x73'),'EventManager',{'event':'acceptmessage','message':_0x186485[_0x0163('0x2b')]},client9002)[_0x0163('0x3a')](function(){return _0x186485;});}return _0x186485;}return null;})[_0x0163('0x3a')](respondWithResult(_0x2f1ab2,null))[_0x0163('0x2d')](handleError(_0x2f1ab2,null));};var interaction_log=require(_0x0163('0x15'))(_0x0163('0x74'));exports[_0x0163('0x75')]=function(_0x3c2e91,_0x268c61,_0x1c9286){var _0x46f9ad={'agent':{},'channel':_0x0163('0x5d')};if(_0x3c2e91[_0x0163('0x5a')]['id']){delete _0x3c2e91[_0x0163('0x5a')]['id'];}_0x3c2e91['body'][_0x0163('0x62')]=_0x3c2e91['body'][_0x0163('0x62')]||_0x3c2e91[_0x0163('0x6b')]['id'];_0x46f9ad['agent']['id']=_0x3c2e91[_0x0163('0x5a')][_0x0163('0x62')];return db['FaxMessage'][_0x0163('0x59')]({'where':{'id':_0x3c2e91[_0x0163('0x58')]['id'],'UserId':null}})[_0x0163('0x3a')](handleEntityNotFound(_0x268c61,null))['then'](function(_0x4055f6){if(_0x4055f6){_0x46f9ad['message']=_0x4055f6[_0x0163('0x69')]({'plain':!![]});return db[_0x0163('0x65')][_0x0163('0x59')]({'where':{'id':_0x4055f6[_0x0163('0x66')]}});}return null;})[_0x0163('0x3a')](handleEntityNotFound(_0x268c61,null))[_0x0163('0x3a')](function(_0x10ffad){if(_0x10ffad){_0x46f9ad[_0x0163('0x6d')]=_0x10ffad[_0x0163('0x69')]({'plain':!![]});interaction_log['info'](_0x0163('0x76'),_0x3c2e91[_0x0163('0x6b')]['id'],_0x3c2e91[_0x0163('0x6b')][_0x0163('0x3d')],_0x3c2e91[_0x0163('0x6b')][_0x0163('0x6c')],_0x46f9ad[_0x0163('0x6d')]['id'],_0x3c2e91[_0x0163('0x5a')]?JSON[_0x0163('0x28')](_0x3c2e91[_0x0163('0x5a')]):_0x0163('0x6e'));return respondWithRpcPromise('RejectMessage',_0x0163('0x77'),_0x46f9ad);}return null;})['then'](function(_0x41ac71){if(_0x41ac71){_0x41ac71[_0x0163('0x2b')][_0x0163('0x78')]=util[_0x0163('0x60')]('SIP/%s',_0x3c2e91[_0x0163('0x6b')][_0x0163('0x3d')]);_0x41ac71['message']['channel']=_0x46f9ad['channel'];_0x41ac71[_0x0163('0x2b')][_0x0163('0x72')]='reject';respondWithRpcPromise('EventManager',_0x0163('0x73'),{'event':'rejectmessage','message':_0x41ac71['message']},client9002);return _0x46f9ad;}return null;})['then'](respondWithResult(_0x268c61,null))[_0x0163('0x2d')](handleError(_0x268c61,null));};exports['create']=function(_0x594c4,_0x92c3b8){var _0x48ff25;return db['FaxMessage']['create'](_0x594c4[_0x0163('0x5a')],{})[_0x0163('0x3a')](function(_0xf26146){_0x48ff25=_0xf26146;return db['CmContact'][_0x0163('0x79')]({'where':{'id':_0x48ff25[_0x0163('0x7a')]}});})[_0x0163('0x3a')](function(_0x3764b6){if(_[_0x0163('0x67')](_0x3764b6)){return;}else{_0x48ff25[_0x0163('0x5d')]=_0x3764b6[_0x0163('0x5d')];return db['Attachment'][_0x0163('0x79')]({'where':{'id':_0x48ff25[_0x0163('0x7b')]}});}})[_0x0163('0x3a')](function(_0x2f2ca3){return respondWithRpcPromise(_0x0163('0x7c'),_0x0163('0x7c'),{'FaxAccountId':_[_0x0163('0x67')](_0x594c4[_0x0163('0x5a')])?undefined:_0x594c4['body'][_0x0163('0x7d')],'path':_[_0x0163('0x67')](_0x2f2ca3)?undefined:util[_0x0163('0x60')](_0x0163('0x7e'),_0x2f2ca3[_0x0163('0x7f')]),'fax':_['isNil'](_0x48ff25[_0x0163('0x5d')])?undefined:_0x48ff25['fax'],'AttachmentId':_0x48ff25[_0x0163('0x7b')]},client9002);})[_0x0163('0x3a')](respondWithResult(_0x92c3b8,0xc9))[_0x0163('0x2d')](handleError(_0x92c3b8,null));};exports[_0x0163('0x80')]=function(_0x2c5ca8,_0x2a4540){var _0x46e06b=path[_0x0163('0x81')](config['root'],_0x0163('0x82'),_0x0163('0x83'),_0x0163('0x84'));return db[_0x0163('0x55')][_0x0163('0x59')]({'where':{'id':_0x2c5ca8['params']['id']},'include':[{'model':db['Attachment'],'as':_0x0163('0x85')}]})[_0x0163('0x3a')](handleEntityNotFound(_0x2a4540,null))[_0x0163('0x3a')](function(_0x1d78ad){if(_0x1d78ad){return _0x2a4540[_0x0163('0x80')](path[_0x0163('0x81')](_0x46e06b,_0x1d78ad[_0x0163('0x85')][_0x0163('0x7f')]));}})[_0x0163('0x2d')](handleError(_0x2a4540,null));}; \ No newline at end of file +var _0xca97=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','include','findAll','show','params','keys','catch','body','find','describe','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','isNil','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','interface','event','EventManager','acceptmessage','fax-interactions','agent','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','channel','create','ContactId','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','download','join','files','attachments','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','client','test','Sequelize','ValidationError','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x484179,_0x5a7c40){var _0x1f9c53=function(_0xca62bf){while(--_0xca62bf){_0x484179['push'](_0x484179['shift']());}};_0x1f9c53(++_0x5a7c40);}(_0xca97,0xc5));var _0x7ca9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xca97[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7ca9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7ca9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ca9('0x2'));var rp=require(_0x7ca9('0x3'));var moment=require('moment');var BPromise=require(_0x7ca9('0x4'));var Mustache=require(_0x7ca9('0x5'));var util=require(_0x7ca9('0x6'));var path=require(_0x7ca9('0x7'));var sox=require(_0x7ca9('0x8'));var csv=require(_0x7ca9('0x9'));var ejs=require(_0x7ca9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7ca9('0xb'));var crypto=require(_0x7ca9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7ca9('0xd'));var toCsv=require(_0x7ca9('0x9'));var querystring=require(_0x7ca9('0xe'));var Papa=require(_0x7ca9('0xf'));var Redis=require(_0x7ca9('0x10'));var authService=require(_0x7ca9('0x11'));var qs=require(_0x7ca9('0x12'));var as=require(_0x7ca9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ca9('0x14'))(_0x7ca9('0x15'));var utils=require(_0x7ca9('0x16'));var config=require(_0x7ca9('0x17'));var db=require(_0x7ca9('0x18'))['db'];config[_0x7ca9('0x19')]=_[_0x7ca9('0x1a')](config[_0x7ca9('0x19')],{'host':_0x7ca9('0x1b'),'port':0x18eb});var socket=require(_0x7ca9('0x1c'))(new Redis(config[_0x7ca9('0x19')]));require(_0x7ca9('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7ca9('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x7ca9('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x306e37,_0x149514,_0x3b3309){if(_0x3b3309){var _0x4c5023=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c5023[_0x7ca9('0x1f')](_0x149514)){return _0x306e37;}else{throw new db[(_0x7ca9('0x20'))][(_0x7ca9('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x306e37;}}function respondWithRpcPromise(_0x53034c,_0x393483,_0x1e7d93,_0x15ca00){return new BPromise(function(_0x2afb5c,_0x58304f){var _0x56785d=_0x15ca00||client;return _0x56785d['request'](_0x53034c,_0x1e7d93)[_0x7ca9('0x22')](function(_0x2b1a6c){logger['info'](_0x7ca9('0x23'),_0x393483,_0x7ca9('0x24'));logger[_0x7ca9('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x393483,'request\x20sent',JSON[_0x7ca9('0x26')](_0x2b1a6c));if(_0x2b1a6c[_0x7ca9('0x27')]){if(_0x2b1a6c['error'][_0x7ca9('0x28')]===0x1f4){logger[_0x7ca9('0x27')](_0x7ca9('0x23'),_0x393483,_0x2b1a6c['error'][_0x7ca9('0x29')]);return _0x58304f(_0x2b1a6c['error'][_0x7ca9('0x29')]);}logger[_0x7ca9('0x27')](_0x7ca9('0x23'),_0x393483,_0x2b1a6c[_0x7ca9('0x27')]['message']);return _0x2afb5c(_0x2b1a6c[_0x7ca9('0x27')][_0x7ca9('0x29')]);}else{logger[_0x7ca9('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x393483,_0x7ca9('0x24'));_0x2afb5c(_0x2b1a6c[_0x7ca9('0x2b')][_0x7ca9('0x29')]);}})['catch'](function(_0x4bdc32){logger[_0x7ca9('0x27')](_0x7ca9('0x23'),_0x393483,_0x4bdc32);_0x58304f(_0x4bdc32);});});}function respondWithStatusCode(_0x2c0ce0,_0x5c56fa){_0x5c56fa=_0x5c56fa||0xcc;return function(_0x874242){if(_0x874242){return _0x2c0ce0['sendStatus'](_0x5c56fa);}return _0x2c0ce0['status'](_0x5c56fa)['end']();};}function respondWithResult(_0x3c22ca,_0x33c711){_0x33c711=_0x33c711||0xc8;return function(_0x53f2ae){if(_0x53f2ae){return _0x3c22ca[_0x7ca9('0x2c')](_0x33c711)[_0x7ca9('0x2d')](_0x53f2ae);}};}function respondWithFilteredResult(_0x598a7d,_0x40ee23){return function(_0x98403b){if(_0x98403b){var _0x4df362=_0x98403b[_0x7ca9('0x2e')],_0x5a6679=_0x40ee23[_0x7ca9('0x2f')],_0x2a34cb=_0x40ee23[_0x7ca9('0x2f')]+_0x40ee23[_0x7ca9('0x30')],_0x542880;if(_0x2a34cb>=_0x4df362){_0x2a34cb=_0x4df362;_0x542880=0xc8;}else{_0x542880=0xce;}_0x598a7d[_0x7ca9('0x2c')](_0x542880);return _0x598a7d['set'](_0x7ca9('0x31'),_0x5a6679+'-'+_0x2a34cb+'/'+_0x4df362)[_0x7ca9('0x2d')](_0x98403b);}return null;};}function patchUpdates(_0x525fce){return function(_0x461efa){try{jsonpatch[_0x7ca9('0x32')](_0x461efa,_0x525fce,!![]);}catch(_0x42be1a){return BPromise[_0x7ca9('0x33')](_0x42be1a);}return _0x461efa[_0x7ca9('0x34')]();};}function saveUpdates(_0x5e6a94,_0x19e665){return function(_0x2a676a){if(_0x2a676a){return _0x2a676a[_0x7ca9('0x35')](_0x5e6a94)[_0x7ca9('0x22')](function(_0x525b1c){return _0x525b1c;});}return null;};}function removeEntity(_0x58ab2a,_0x48505b){return function(_0x4554af){if(_0x4554af){return _0x4554af[_0x7ca9('0x36')]()[_0x7ca9('0x22')](function(){_0x58ab2a[_0x7ca9('0x2c')](0xcc)[_0x7ca9('0x37')]();});}};}function handleEntityNotFound(_0x5bcae6,_0x4c29ab){return function(_0x32325a){if(!_0x32325a){_0x5bcae6[_0x7ca9('0x38')](0x194);}return _0x32325a;};}function handleError(_0x6aaf85,_0x2db9b9){_0x2db9b9=_0x2db9b9||0x1f4;return function(_0x46b8c3){logger['error'](_0x46b8c3[_0x7ca9('0x39')]);if(_0x46b8c3[_0x7ca9('0x3a')]){delete _0x46b8c3[_0x7ca9('0x3a')];}_0x6aaf85[_0x7ca9('0x2c')](_0x2db9b9)[_0x7ca9('0x3b')](_0x46b8c3);};}exports[_0x7ca9('0x3c')]=function(_0x4f16d1,_0xbf6c51){var _0x269ade={},_0x2909bb={},_0x3e93f4={'count':0x0,'rows':[]};var _0x13bf63=_[_0x7ca9('0x3d')](db['FaxMessage'][_0x7ca9('0x3e')],function(_0x58e0f1){return{'name':_0x58e0f1[_0x7ca9('0x3f')],'type':_0x58e0f1[_0x7ca9('0x40')][_0x7ca9('0x41')]};});_0x2909bb[_0x7ca9('0x42')]=_[_0x7ca9('0x3d')](_0x13bf63,_0x7ca9('0x3a'));_0x2909bb['query']=_['keys'](_0x4f16d1[_0x7ca9('0x43')]);_0x2909bb[_0x7ca9('0x44')]=_[_0x7ca9('0x45')](_0x2909bb[_0x7ca9('0x42')],_0x2909bb[_0x7ca9('0x43')]);_0x269ade[_0x7ca9('0x46')]=_[_0x7ca9('0x45')](_0x2909bb['model'],qs[_0x7ca9('0x47')](_0x4f16d1[_0x7ca9('0x43')]['fields']));_0x269ade[_0x7ca9('0x46')]=_0x269ade['attributes'][_0x7ca9('0x48')]?_0x269ade[_0x7ca9('0x46')]:_0x2909bb[_0x7ca9('0x42')];if(!_0x4f16d1[_0x7ca9('0x43')][_0x7ca9('0x49')](_0x7ca9('0x4a'))){_0x269ade[_0x7ca9('0x30')]=qs[_0x7ca9('0x30')](_0x4f16d1['query'][_0x7ca9('0x30')]);_0x269ade[_0x7ca9('0x2f')]=qs['offset'](_0x4f16d1[_0x7ca9('0x43')][_0x7ca9('0x2f')]);}_0x269ade[_0x7ca9('0x4b')]=qs[_0x7ca9('0x4c')](_0x4f16d1[_0x7ca9('0x43')]['sort']);_0x269ade[_0x7ca9('0x4d')]=qs[_0x7ca9('0x44')](_[_0x7ca9('0x4e')](_0x4f16d1[_0x7ca9('0x43')],_0x2909bb['filters']),_0x13bf63);if(_0x4f16d1[_0x7ca9('0x43')][_0x7ca9('0x4f')]){_0x269ade[_0x7ca9('0x4d')]=_[_0x7ca9('0x50')](_0x269ade['where'],{'$or':_[_0x7ca9('0x3d')](_0x13bf63,function(_0x2fe387){if(_0x2fe387['type']!==_0x7ca9('0x51')){var _0x56446f={};_0x56446f[_0x2fe387[_0x7ca9('0x3a')]]={'$like':'%'+_0x4f16d1['query'][_0x7ca9('0x4f')]+'%'};return _0x56446f;}})});}_0x269ade=_[_0x7ca9('0x50')]({},_0x269ade,_0x4f16d1[_0x7ca9('0x52')]);var _0x4f246d={'where':_0x269ade[_0x7ca9('0x4d')]};return db[_0x7ca9('0x53')][_0x7ca9('0x2e')](_0x4f246d)[_0x7ca9('0x22')](function(_0x489051){_0x3e93f4[_0x7ca9('0x2e')]=_0x489051;if(_0x4f16d1[_0x7ca9('0x43')]['includeAll']){_0x269ade[_0x7ca9('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x7ca9('0x55')](_0x269ade);})[_0x7ca9('0x22')](function(_0x525257){_0x3e93f4['rows']=_0x525257;return _0x3e93f4;})[_0x7ca9('0x22')](respondWithFilteredResult(_0xbf6c51,_0x269ade))['catch'](handleError(_0xbf6c51,null));};exports[_0x7ca9('0x56')]=function(_0x38942,_0x1d4028){var _0x589390={'raw':!![],'where':{'id':_0x38942[_0x7ca9('0x57')]['id']}},_0x4e5b3d={};_0x4e5b3d[_0x7ca9('0x42')]=_[_0x7ca9('0x58')](db[_0x7ca9('0x53')][_0x7ca9('0x3e')]);_0x4e5b3d[_0x7ca9('0x43')]=_['keys'](_0x38942[_0x7ca9('0x43')]);_0x4e5b3d[_0x7ca9('0x44')]=_[_0x7ca9('0x45')](_0x4e5b3d['model'],_0x4e5b3d[_0x7ca9('0x43')]);_0x589390[_0x7ca9('0x46')]=_[_0x7ca9('0x45')](_0x4e5b3d['model'],qs[_0x7ca9('0x47')](_0x38942[_0x7ca9('0x43')][_0x7ca9('0x47')]));_0x589390['attributes']=_0x589390['attributes']['length']?_0x589390[_0x7ca9('0x46')]:_0x4e5b3d[_0x7ca9('0x42')];if(_0x38942[_0x7ca9('0x43')]['includeAll']){_0x589390[_0x7ca9('0x54')]=[{'all':!![]}];}_0x589390=_[_0x7ca9('0x50')]({},_0x589390,_0x38942['options']);return db['FaxMessage']['find'](_0x589390)[_0x7ca9('0x22')](handleEntityNotFound(_0x1d4028,null))[_0x7ca9('0x22')](respondWithResult(_0x1d4028,null))[_0x7ca9('0x59')](handleError(_0x1d4028,null));};exports[_0x7ca9('0x35')]=function(_0x4705d1,_0xf05624){if(_0x4705d1[_0x7ca9('0x5a')]['id']){delete _0x4705d1[_0x7ca9('0x5a')]['id'];}return db['FaxMessage'][_0x7ca9('0x5b')]({'where':{'id':_0x4705d1[_0x7ca9('0x57')]['id']}})[_0x7ca9('0x22')](handleEntityNotFound(_0xf05624,null))[_0x7ca9('0x22')](saveUpdates(_0x4705d1['body'],null))[_0x7ca9('0x22')](respondWithResult(_0xf05624,null))[_0x7ca9('0x59')](handleError(_0xf05624,null));};exports[_0x7ca9('0x36')]=function(_0x197cb9,_0x785383){return db['FaxMessage'][_0x7ca9('0x5b')]({'where':{'id':_0x197cb9['params']['id']}})['then'](handleEntityNotFound(_0x785383,null))['then'](removeEntity(_0x785383,null))[_0x7ca9('0x59')](handleError(_0x785383,null));};exports[_0x7ca9('0x5c')]=function(_0xe8333a,_0x554e14){return db[_0x7ca9('0x53')]['describe']()[_0x7ca9('0x22')](respondWithResult(_0x554e14,null))[_0x7ca9('0x59')](handleError(_0x554e14,null));};var interaction_log=require(_0x7ca9('0x14'))('fax-interactions');exports[_0x7ca9('0x5d')]=function(_0x294706,_0x194ddf,_0x3176a1){var _0x39d903={'channel':_0x7ca9('0x5e')};if(_0x294706[_0x7ca9('0x5a')]['id']){delete _0x294706['body']['id'];}_0x294706[_0x7ca9('0x5a')]['read']=!![];_0x294706[_0x7ca9('0x5a')][_0x7ca9('0x5f')]=moment()['format'](_0x7ca9('0x60'));_0x294706[_0x7ca9('0x5a')]['UserId']=_0x294706[_0x7ca9('0x5a')][_0x7ca9('0x61')]||_0x294706['user']['id'];return db[_0x7ca9('0x53')][_0x7ca9('0x5b')]({'where':{'id':_0x294706[_0x7ca9('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x7ca9('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x194ddf,null))[_0x7ca9('0x22')](saveUpdates(_0x294706[_0x7ca9('0x5a')],null))[_0x7ca9('0x22')](function(_0x3b3a94){if(_0x3b3a94){_0x39d903[_0x7ca9('0x29')]=_0x3b3a94[_0x7ca9('0x63')]({'plain':!![]});return db['FaxInteraction'][_0x7ca9('0x5b')]({'where':{'id':_0x3b3a94['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x194ddf,null))[_0x7ca9('0x22')](function(_0x28acbd){if(_0x28acbd){return _0x28acbd[_0x7ca9('0x35')]({'UserId':_0x294706['body'][_0x7ca9('0x61')],'read1stAt':_[_0x7ca9('0x64')](_0x28acbd['read1stAt'])?moment()[_0x7ca9('0x65')](_0x7ca9('0x60')):undefined});}return null;})['then'](function(_0x1b175e){if(_0x1b175e){_0x39d903[_0x7ca9('0x66')]=_0x1b175e[_0x7ca9('0x63')]({'plain':!![]});interaction_log['info'](_0x7ca9('0x67'),_0x294706[_0x7ca9('0x68')]['id'],_0x294706[_0x7ca9('0x68')][_0x7ca9('0x3a')],_0x294706[_0x7ca9('0x68')]['role'],_0x39d903[_0x7ca9('0x66')]['id'],_0x294706['body']?JSON[_0x7ca9('0x26')](_0x294706['body']):_0x7ca9('0x69'));return respondWithRpcPromise(_0x7ca9('0x6a'),_0x7ca9('0x6b'),_0x39d903);}return null;})['then'](function(_0x172efb){if(_0x172efb){if(_0x294706[_0x7ca9('0x5a')]['manual']){_0x39d903[_0x7ca9('0x29')][_0x7ca9('0x6c')]=util[_0x7ca9('0x65')]('SIP/%s',_0x294706[_0x7ca9('0x68')]['name']);_0x39d903[_0x7ca9('0x29')]['channel']=_0x39d903['channel'];_0x39d903[_0x7ca9('0x29')][_0x7ca9('0x6d')]='accept';return respondWithRpcPromise(_0x7ca9('0x6e'),_0x7ca9('0x6e'),{'event':_0x7ca9('0x6f'),'message':_0x39d903[_0x7ca9('0x29')]},client9002)['then'](function(){return _0x39d903;});}return _0x39d903;}return null;})[_0x7ca9('0x22')](respondWithResult(_0x194ddf,null))[_0x7ca9('0x59')](handleError(_0x194ddf,null));};var interaction_log=require(_0x7ca9('0x14'))(_0x7ca9('0x70'));exports['reject']=function(_0x45a15d,_0x52aa01,_0x5b04cc){var _0x545786={'agent':{},'channel':_0x7ca9('0x5e')};if(_0x45a15d['body']['id']){delete _0x45a15d[_0x7ca9('0x5a')]['id'];}_0x45a15d[_0x7ca9('0x5a')][_0x7ca9('0x61')]=_0x45a15d[_0x7ca9('0x5a')][_0x7ca9('0x61')]||_0x45a15d[_0x7ca9('0x68')]['id'];_0x545786[_0x7ca9('0x71')]['id']=_0x45a15d[_0x7ca9('0x5a')][_0x7ca9('0x61')];return db['FaxMessage'][_0x7ca9('0x5b')]({'where':{'id':_0x45a15d[_0x7ca9('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52aa01,null))[_0x7ca9('0x22')](function(_0x51fd52){if(_0x51fd52){_0x545786[_0x7ca9('0x29')]=_0x51fd52[_0x7ca9('0x63')]({'plain':!![]});return db[_0x7ca9('0x72')][_0x7ca9('0x5b')]({'where':{'id':_0x51fd52[_0x7ca9('0x73')]}});}return null;})[_0x7ca9('0x22')](handleEntityNotFound(_0x52aa01,null))[_0x7ca9('0x22')](function(_0x1ac3d9){if(_0x1ac3d9){_0x545786[_0x7ca9('0x66')]=_0x1ac3d9[_0x7ca9('0x63')]({'plain':!![]});interaction_log[_0x7ca9('0x2a')](_0x7ca9('0x74'),_0x45a15d[_0x7ca9('0x68')]['id'],_0x45a15d[_0x7ca9('0x68')]['name'],_0x45a15d[_0x7ca9('0x68')]['role'],_0x545786[_0x7ca9('0x66')]['id'],_0x45a15d[_0x7ca9('0x5a')]?JSON[_0x7ca9('0x26')](_0x45a15d[_0x7ca9('0x5a')]):'null');return respondWithRpcPromise(_0x7ca9('0x75'),_0x7ca9('0x76'),_0x545786);}return null;})['then'](function(_0x332577){if(_0x332577){_0x332577[_0x7ca9('0x29')][_0x7ca9('0x6c')]=util['format'](_0x7ca9('0x77'),_0x45a15d[_0x7ca9('0x68')][_0x7ca9('0x3a')]);_0x332577['message'][_0x7ca9('0x78')]=_0x545786[_0x7ca9('0x78')];_0x332577[_0x7ca9('0x29')][_0x7ca9('0x6d')]=_0x7ca9('0x33');respondWithRpcPromise(_0x7ca9('0x6e'),_0x7ca9('0x6e'),{'event':'rejectmessage','message':_0x332577[_0x7ca9('0x29')]},client9002);return _0x545786;}return null;})[_0x7ca9('0x22')](respondWithResult(_0x52aa01,null))[_0x7ca9('0x59')](handleError(_0x52aa01,null));};exports[_0x7ca9('0x79')]=function(_0x458091,_0x146ca6){var _0x526d1e;return db['FaxMessage'][_0x7ca9('0x79')](_0x458091[_0x7ca9('0x5a')],{})[_0x7ca9('0x22')](function(_0x42ff30){_0x526d1e=_0x42ff30;return db['CmContact']['findOne']({'where':{'id':_0x526d1e[_0x7ca9('0x7a')]}});})['then'](function(_0x547bf1){if(_[_0x7ca9('0x64')](_0x547bf1)){return;}else{_0x526d1e['fax']=_0x547bf1[_0x7ca9('0x5e')];return db[_0x7ca9('0x7b')][_0x7ca9('0x7c')]({'where':{'id':_0x526d1e['AttachmentId']}});}})['then'](function(_0x5f4d57){return respondWithRpcPromise(_0x7ca9('0x7d'),_0x7ca9('0x7d'),{'FaxAccountId':_[_0x7ca9('0x64')](_0x458091[_0x7ca9('0x5a')])?undefined:_0x458091[_0x7ca9('0x5a')][_0x7ca9('0x7e')],'path':_['isNil'](_0x5f4d57)?undefined:util[_0x7ca9('0x65')](_0x7ca9('0x7f'),_0x5f4d57['basename']),'fax':_[_0x7ca9('0x64')](_0x526d1e[_0x7ca9('0x5e')])?undefined:_0x526d1e[_0x7ca9('0x5e')],'AttachmentId':_0x526d1e[_0x7ca9('0x80')]},client9002);})[_0x7ca9('0x22')](respondWithResult(_0x146ca6,0xc9))[_0x7ca9('0x59')](handleError(_0x146ca6,null));};exports[_0x7ca9('0x81')]=function(_0x3e5d83,_0x10a8fe){var _0x295b83=path[_0x7ca9('0x82')](config['root'],'server',_0x7ca9('0x83'),_0x7ca9('0x84'));return db['FaxMessage'][_0x7ca9('0x5b')]({'where':{'id':_0x3e5d83[_0x7ca9('0x57')]['id']},'include':[{'model':db[_0x7ca9('0x7b')],'as':_0x7ca9('0x7b')}]})['then'](handleEntityNotFound(_0x10a8fe,null))[_0x7ca9('0x22')](function(_0x3bf0c8){if(_0x3bf0c8){return _0x10a8fe[_0x7ca9('0x81')](path[_0x7ca9('0x82')](_0x295b83,_0x3bf0c8[_0x7ca9('0x7b')]['basename']));}})[_0x7ca9('0x59')](handleError(_0x10a8fe,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 7c54ce4..d47d764 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 _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x5c2d78,_0x2dc65f){_0x5c2d78=_0x5c2d78-0x0;var _0x50b883=_0x3e74[_0x5c2d78];return _0x50b883;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x5fc3[_0x328534];return _0x2796c0;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var FaxMessage=require(_0x35fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){FaxMessageEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);FaxMessageEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x35fc('0x7')](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 b2427d3..8680758 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 _0x3e66=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','./faxMessage.attributes','exports','define','fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt'];(function(_0xa9ccb9,_0x18d0c7){var _0x4fde26=function(_0x39e3ed){while(--_0x39e3ed){_0xa9ccb9['push'](_0xa9ccb9['shift']());}};_0x4fde26(++_0x18d0c7);}(_0x3e66,0x112));var _0x63e6=function(_0x5eb6b7,_0xa7c1a1){_0x5eb6b7=_0x5eb6b7-0x0;var _0xa4ca93=_0x3e66[_0x5eb6b7];return _0xa4ca93;};'use strict';var _=require(_0x63e6('0x0'));var util=require(_0x63e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x63e6('0x2'));var BPromise=require('bluebird');var rp=require(_0x63e6('0x3'));var fs=require('fs');var path=require(_0x63e6('0x4'));var rimraf=require(_0x63e6('0x5'));var config=require('../../config/environment');var attributes=require(_0x63e6('0x6'));module[_0x63e6('0x7')]=function(_0x345a8a,_0x50fa33){return _0x345a8a[_0x63e6('0x8')]('FaxMessage',attributes,{'tableName':_0x63e6('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x63e6('0xa')],'type':_0x63e6('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22984a,_0xe110ea,_0x5b84da){var _0x32fa87=_0x345a8a[_0x63e6('0xc')];var _0xc23ad1=_0x22984a['get']({'plain':!![]});if(_0xc23ad1[_0x63e6('0xd')][_0x63e6('0xe')]()==='in'||_0xc23ad1[_0x63e6('0xd')][_0x63e6('0xe')]()===_0x63e6('0xf')&&!_0xc23ad1[_0x63e6('0x10')]&&!_['isNil'](_0xc23ad1['UserId'])){_0x32fa87[_0x63e6('0x11')][_0x63e6('0x12')]({'where':{'id':_0xc23ad1[_0x63e6('0x13')]}})[_0x63e6('0x14')](function(_0x157bc7){if(_0x157bc7){_0x157bc7[_0x63e6('0x15')]({'lastMsgAt':_0xc23ad1[_0x63e6('0x16')],'lastMsgDirection':_0xc23ad1[_0x63e6('0xd')][_0x63e6('0xe')]()});}})[_0x63e6('0x17')](function(_0x590acf){console[_0x63e6('0x18')](_0x590acf);});}_0x5b84da();}},'charset':_0x63e6('0x19'),'collate':_0x63e6('0x1a')});}; \ No newline at end of file +var _0x4f41=['direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','FULLTEXT','models','get','toLowerCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f41,0x151));var _0x14f4=function(_0x5d84d6,_0x1a4671){_0x5d84d6=_0x5d84d6-0x0;var _0x2cd0f5=_0x4f41[_0x5d84d6];return _0x2cd0f5;};'use strict';var _=require(_0x14f4('0x0'));var util=require(_0x14f4('0x1'));var logger=require(_0x14f4('0x2'))(_0x14f4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x14f4('0x4'));var rimraf=require(_0x14f4('0x5'));var config=require('../../config/environment');var attributes=require(_0x14f4('0x6'));module[_0x14f4('0x7')]=function(_0xb5ff81,_0x4a6dc1){return _0xb5ff81['define'](_0x14f4('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x14f4('0x9'),'fields':['body'],'type':_0x14f4('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3113b4,_0x234cc2,_0x164c3f){var _0x23259d=_0xb5ff81[_0x14f4('0xb')];var _0x2fc36c=_0x3113b4[_0x14f4('0xc')]({'plain':!![]});if(_0x2fc36c['direction'][_0x14f4('0xd')]()==='in'||_0x2fc36c[_0x14f4('0xe')][_0x14f4('0xd')]()===_0x14f4('0xf')&&!_0x2fc36c[_0x14f4('0x10')]&&!_[_0x14f4('0x11')](_0x2fc36c[_0x14f4('0x12')])){_0x23259d[_0x14f4('0x13')][_0x14f4('0x14')]({'where':{'id':_0x2fc36c[_0x14f4('0x15')]}})[_0x14f4('0x16')](function(_0x4763df){if(_0x4763df){_0x4763df['update']({'lastMsgAt':_0x2fc36c['createdAt'],'lastMsgDirection':_0x2fc36c['direction'][_0x14f4('0xd')]()});}})[_0x14f4('0x17')](function(_0x12d006){console[_0x14f4('0x18')](_0x12d006);});}_0x164c3f();}},'charset':_0x14f4('0x19'),'collate':_0x14f4('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2578644..4eff4f4 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 _0x7b63=['then','stringify','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','bluebird','randomstring','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxMessage','create','body','options','raw'];(function(_0x349863,_0x53437f){var _0x2a57cf=function(_0x28db6f){while(--_0x28db6f){_0x349863['push'](_0x349863['shift']());}};_0x2a57cf(++_0x53437f);}(_0x7b63,0xac));var _0x37b6=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0x7b63[_0x4b2cc6];return _0x3e0b08;};'use strict';var _=require(_0x37b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x37b6('0x1'));var rs=require(_0x37b6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37b6('0x3'))(_0x37b6('0x4'));var config=require('../../config/environment');var jayson=require(_0x37b6('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x37b6('0x6')](config[_0x37b6('0x7')],{'host':_0x37b6('0x8'),'port':0x18eb});var socket=require(_0x37b6('0x9'))(new Redis(config[_0x37b6('0x7')]));require(_0x37b6('0xa'))['register'](socket);function respondWithRpcPromise(_0x3383d8,_0x559194,_0x304efd){return new BPromise(function(_0x25e6b8,_0x20b368){return client['request'](_0x3383d8,_0x304efd)['then'](function(_0x1b3c75){logger[_0x37b6('0xb')](_0x37b6('0xc'),_0x559194,_0x37b6('0xd'));logger[_0x37b6('0xe')](_0x37b6('0xf'),_0x559194,_0x37b6('0xd'),JSON['stringify'](_0x1b3c75));if(_0x1b3c75[_0x37b6('0x10')]){if(_0x1b3c75[_0x37b6('0x10')][_0x37b6('0x11')]===0x1f4){logger['error'](_0x37b6('0xc'),_0x559194,_0x1b3c75['error'][_0x37b6('0x12')]);return _0x20b368(_0x1b3c75[_0x37b6('0x10')][_0x37b6('0x12')]);}logger[_0x37b6('0x10')](_0x37b6('0xc'),_0x559194,_0x1b3c75[_0x37b6('0x10')][_0x37b6('0x12')]);return _0x25e6b8(_0x1b3c75[_0x37b6('0x10')][_0x37b6('0x12')]);}else{logger[_0x37b6('0xb')]('FaxMessage,\x20%s,\x20%s',_0x559194,'request\x20sent');_0x25e6b8(_0x1b3c75[_0x37b6('0x13')][_0x37b6('0x12')]);}})[_0x37b6('0x14')](function(_0x4ba1b0){logger[_0x37b6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x559194,_0x4ba1b0);_0x20b368(_0x4ba1b0);});});}exports[_0x37b6('0x15')]=function(_0x1d6cc5){var _0xa2688d=this;return new Promise(function(_0x2a87c8,_0x14732f){return db['FaxMessage'][_0x37b6('0x16')](_0x1d6cc5[_0x37b6('0x17')],{'raw':_0x1d6cc5['options']?_0x1d6cc5[_0x37b6('0x18')][_0x37b6('0x19')]===undefined?!![]:![]:!![]})[_0x37b6('0x1a')](function(_0x303496){logger[_0x37b6('0xb')](_0x37b6('0x15'),_0x1d6cc5);logger['debug']('CreateFaxMessage',_0x1d6cc5,JSON[_0x37b6('0x1b')](_0x303496));_0x2a87c8(_0x303496);})[_0x37b6('0x14')](function(_0x1d7ac0){logger['error'](_0x37b6('0x15'),_0x1d7ac0[_0x37b6('0x12')],_0x1d6cc5);_0x14732f(_0xa2688d[_0x37b6('0x10')](0x1f4,_0x1d7ac0[_0x37b6('0x12')]));});});};exports[_0x37b6('0x1c')]=function(_0x35f935){var _0x50f051=this;return new Promise(function(_0x924a9c,_0x31e143){return db[_0x37b6('0x1d')]['update'](_0x35f935['body'],{'raw':_0x35f935[_0x37b6('0x18')]?_0x35f935[_0x37b6('0x18')][_0x37b6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f935[_0x37b6('0x18')]?_0x35f935[_0x37b6('0x18')][_0x37b6('0x1e')]||null:null,'attributes':_0x35f935[_0x37b6('0x18')]?_0x35f935[_0x37b6('0x18')][_0x37b6('0x1f')]||null:null,'limit':_0x35f935['options']?_0x35f935['options'][_0x37b6('0x20')]||null:null})['then'](function(_0xaf81b8){logger[_0x37b6('0xb')](_0x37b6('0x1c'),_0x35f935);logger[_0x37b6('0xe')]('UpdateFaxMessage',_0x35f935,JSON[_0x37b6('0x1b')](_0xaf81b8));_0x924a9c(_0xaf81b8);})[_0x37b6('0x14')](function(_0xab63ee){logger['error'](_0x37b6('0x1c'),_0xab63ee[_0x37b6('0x12')],_0x35f935);_0x31e143(_0x50f051['error'](0x1f4,_0xab63ee[_0x37b6('0x12')]));});});}; \ No newline at end of file +var _0x12dc=['../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','FaxMessage','body','then','CreateFaxMessage','stringify','UpdateFaxMessage','update','options','raw','where','attributes','limit','lodash','util','bluebird','ioredis'];(function(_0x6d17e3,_0x372715){var _0x163e6c=function(_0x40d0d6){while(--_0x40d0d6){_0x6d17e3['push'](_0x6d17e3['shift']());}};_0x163e6c(++_0x372715);}(_0x12dc,0xab));var _0xc12d=function(_0x1f0495,_0x44dabc){_0x1f0495=_0x1f0495-0x0;var _0x310b64=_0x12dc[_0x1f0495];return _0x310b64;};'use strict';var _=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var moment=require('moment');var BPromise=require(_0xc12d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc12d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc12d('0x4'));var logger=require(_0xc12d('0x5'))('rpc');var config=require(_0xc12d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc12d('0x7')]({'port':0x232a});config['redis']=_[_0xc12d('0x8')](config[_0xc12d('0x9')],{'host':_0xc12d('0xa'),'port':0x18eb});var socket=require(_0xc12d('0xb'))(new Redis(config['redis']));require(_0xc12d('0xc'))['register'](socket);function respondWithRpcPromise(_0x293202,_0x126ea2,_0x1ba497){return new BPromise(function(_0x2d0371,_0x4f48b4){return client[_0xc12d('0xd')](_0x293202,_0x1ba497)['then'](function(_0x15ea4e){logger[_0xc12d('0xe')](_0xc12d('0xf'),_0x126ea2,_0xc12d('0x10'));logger[_0xc12d('0x11')](_0xc12d('0x12'),_0x126ea2,_0xc12d('0x10'),JSON['stringify'](_0x15ea4e));if(_0x15ea4e[_0xc12d('0x13')]){if(_0x15ea4e[_0xc12d('0x13')][_0xc12d('0x14')]===0x1f4){logger[_0xc12d('0x13')](_0xc12d('0xf'),_0x126ea2,_0x15ea4e['error'][_0xc12d('0x15')]);return _0x4f48b4(_0x15ea4e['error'][_0xc12d('0x15')]);}logger[_0xc12d('0x13')]('FaxMessage,\x20%s,\x20%s',_0x126ea2,_0x15ea4e[_0xc12d('0x13')]['message']);return _0x2d0371(_0x15ea4e[_0xc12d('0x13')][_0xc12d('0x15')]);}else{logger[_0xc12d('0xe')](_0xc12d('0xf'),_0x126ea2,'request\x20sent');_0x2d0371(_0x15ea4e['result'][_0xc12d('0x15')]);}})[_0xc12d('0x16')](function(_0x208e8f){logger[_0xc12d('0x13')](_0xc12d('0xf'),_0x126ea2,_0x208e8f);_0x4f48b4(_0x208e8f);});});}exports['CreateFaxMessage']=function(_0x5c9a90){var _0x40a3da=this;return new Promise(function(_0x4adbc3,_0xd3171){return db[_0xc12d('0x17')]['create'](_0x5c9a90[_0xc12d('0x18')],{'raw':_0x5c9a90['options']?_0x5c9a90['options']['raw']===undefined?!![]:![]:!![]})[_0xc12d('0x19')](function(_0xd8b4c7){logger[_0xc12d('0xe')](_0xc12d('0x1a'),_0x5c9a90);logger['debug']('CreateFaxMessage',_0x5c9a90,JSON[_0xc12d('0x1b')](_0xd8b4c7));_0x4adbc3(_0xd8b4c7);})['catch'](function(_0x806313){logger[_0xc12d('0x13')]('CreateFaxMessage',_0x806313[_0xc12d('0x15')],_0x5c9a90);_0xd3171(_0x40a3da[_0xc12d('0x13')](0x1f4,_0x806313[_0xc12d('0x15')]));});});};exports[_0xc12d('0x1c')]=function(_0x245a30){var _0x2cd0fb=this;return new Promise(function(_0x50f501,_0x4e64ed){return db[_0xc12d('0x17')][_0xc12d('0x1d')](_0x245a30['body'],{'raw':_0x245a30[_0xc12d('0x1e')]?_0x245a30['options'][_0xc12d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x245a30[_0xc12d('0x1e')]?_0x245a30['options'][_0xc12d('0x20')]||null:null,'attributes':_0x245a30['options']?_0x245a30[_0xc12d('0x1e')][_0xc12d('0x21')]||null:null,'limit':_0x245a30[_0xc12d('0x1e')]?_0x245a30[_0xc12d('0x1e')][_0xc12d('0x22')]||null:null})[_0xc12d('0x19')](function(_0x13c2ed){logger[_0xc12d('0xe')](_0xc12d('0x1c'),_0x245a30);logger[_0xc12d('0x11')]('UpdateFaxMessage',_0x245a30,JSON['stringify'](_0x13c2ed));_0x50f501(_0x13c2ed);})['catch'](function(_0x1d7203){logger[_0xc12d('0x13')](_0xc12d('0x1c'),_0x1d7203['message'],_0x245a30);_0x4e64ed(_0x2cd0fb[_0xc12d('0x13')](0x1f4,_0x1d7203[_0xc12d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b08b08d..9d7f3d9 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 359256b..91d73f5 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 _0x6dcb=['/:id/reject','reject','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','update','/:id/accept','accept','put'];(function(_0x52598d,_0x10fb73){var _0x170309=function(_0x30c9f7){while(--_0x30c9f7){_0x52598d['push'](_0x52598d['shift']());}};_0x170309(++_0x10fb73);}(_0x6dcb,0x170));var _0xb6dc=function(_0x237fe4,_0x57eecf){_0x237fe4=_0x237fe4-0x0;var _0x35cc3e=_0x6dcb[_0x237fe4];return _0x35cc3e;};'use strict';var multer=require(_0xb6dc('0x0'));var util=require(_0xb6dc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb6dc('0x2')]();var auth=require(_0xb6dc('0x3'));var interaction=require(_0xb6dc('0x4'));var config=require(_0xb6dc('0x5'));var controller=require(_0xb6dc('0x6'));router[_0xb6dc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb6dc('0x7')](_0xb6dc('0x8'),auth['isAuthenticated'](),controller[_0xb6dc('0x9')]);router[_0xb6dc('0x7')](_0xb6dc('0xa'),auth[_0xb6dc('0xb')](),controller[_0xb6dc('0xc')]);router[_0xb6dc('0x7')](_0xb6dc('0xd'),auth[_0xb6dc('0xb')](),controller[_0xb6dc('0xe')]);router[_0xb6dc('0xf')]('/',auth['isAuthenticated'](),interaction[_0xb6dc('0x10')](_0xb6dc('0x11'),_0xb6dc('0x12')),controller[_0xb6dc('0x13')]);router['put'](_0xb6dc('0xa'),auth['isAuthenticated'](),controller[_0xb6dc('0x14')]);router['put'](_0xb6dc('0x15'),auth[_0xb6dc('0xb')](),controller[_0xb6dc('0x16')]);router[_0xb6dc('0x17')](_0xb6dc('0x18'),auth[_0xb6dc('0xb')](),controller[_0xb6dc('0x19')]);router[_0xb6dc('0x1a')](_0xb6dc('0xa'),auth[_0xb6dc('0xb')](),controller['destroy']);module[_0xb6dc('0x1b')]=router; \ No newline at end of file +var _0x58a4=['post','fax','faxmessage:create','put','update','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','/:id/download','download'];(function(_0x1d4670,_0x4f3055){var _0x1cf4d8=function(_0x1133ad){while(--_0x1133ad){_0x1d4670['push'](_0x1d4670['shift']());}};_0x1cf4d8(++_0x4f3055);}(_0x58a4,0xbf));var _0x458a=function(_0x29db14,_0x4fcd9f){_0x29db14=_0x29db14-0x0;var _0x5cfc55=_0x58a4[_0x29db14];return _0x5cfc55;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var auth=require(_0x458a('0x6'));var interaction=require(_0x458a('0x7'));var config=require(_0x458a('0x8'));var controller=require(_0x458a('0x9'));router[_0x458a('0xa')]('/',auth[_0x458a('0xb')](),controller[_0x458a('0xc')]);router['get']('/describe',auth[_0x458a('0xb')](),controller[_0x458a('0xd')]);router[_0x458a('0xa')](_0x458a('0xe'),auth[_0x458a('0xb')](),controller['show']);router['get'](_0x458a('0xf'),auth[_0x458a('0xb')](),controller[_0x458a('0x10')]);router[_0x458a('0x11')]('/',auth[_0x458a('0xb')](),interaction['tracked'](_0x458a('0x12'),_0x458a('0x13')),controller['create']);router[_0x458a('0x14')](_0x458a('0xe'),auth[_0x458a('0xb')](),controller[_0x458a('0x15')]);router[_0x458a('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0x458a('0x16')]);router['put'](_0x458a('0x17'),auth[_0x458a('0xb')](),controller[_0x458a('0x18')]);router[_0x458a('0x19')](_0x458a('0xe'),auth[_0x458a('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 7e4e773..73c81ba 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 _0x7a28=['rrmemory','beepall','roundrobin','exports','name','INTEGER','ENUM'];(function(_0x5e1acf,_0x5463b1){var _0x389639=function(_0x173905){while(--_0x173905){_0x5e1acf['push'](_0x5e1acf['shift']());}};_0x389639(++_0x5463b1);}(_0x7a28,0x176));var _0x87a2=function(_0x31a8bf,_0x4b09a4){_0x31a8bf=_0x31a8bf-0x0;var _0x26a9a0=_0x7a28[_0x31a8bf];return _0x26a9a0;};'use strict';var Sequelize=require('sequelize');module[_0x87a2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x87a2('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x87a2('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x87a2('0x3')](_0x87a2('0x4'),_0x87a2('0x5'),_0x87a2('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x87a2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc570=['INTEGER','ENUM','rrmemory','beepall','exports','STRING'];(function(_0x4318b0,_0x620eff){var _0x3fb711=function(_0x198cac){while(--_0x198cac){_0x4318b0['push'](_0x4318b0['shift']());}};_0x3fb711(++_0x620eff);}(_0xc570,0x142));var _0x0c57=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xc570[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require('sequelize');module[_0x0c57('0x0')]={'name':{'type':Sequelize[_0x0c57('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0c57('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0c57('0x3')](_0x0c57('0x4'),_0x0c57('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 eb1044c..e2ff78d 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 _0x225b=['ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userFaxQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','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','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','get','error','name','send','index','FaxQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','include','findAll','rows','catch','params','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserFaxQueue','FaxQueueId','options','User','findAndCountAll','UserId','agent','format','SIP','faxPause','createdAt','getTeams','addTeams'];(function(_0x51c938,_0x7b322){var _0x4bb8b2=function(_0x148119){while(--_0x148119){_0x51c938['push'](_0x51c938['shift']());}};_0x4bb8b2(++_0x7b322);}(_0x225b,0xb1));var _0xb225=function(_0x1a60f6,_0x224970){_0x1a60f6=_0x1a60f6-0x0;var _0x2e9b02=_0x225b[_0x1a60f6];return _0x2e9b02;};'use strict';var pdf=require(_0xb225('0x0'));var emlformat=require(_0xb225('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb225('0x2'));var jsonpatch=require(_0xb225('0x3'));var rp=require('request-promise');var moment=require(_0xb225('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb225('0x5'));var util=require('util');var path=require(_0xb225('0x6'));var sox=require(_0xb225('0x7'));var csv=require(_0xb225('0x8'));var ejs=require(_0xb225('0x9'));var fs=require('fs');var _=require(_0xb225('0xa'));var squel=require(_0xb225('0xb'));var crypto=require(_0xb225('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb225('0xd'));var toCsv=require(_0xb225('0x8'));var querystring=require(_0xb225('0xe'));var Papa=require(_0xb225('0xf'));var Redis=require('ioredis');var authService=require(_0xb225('0x10'));var qs=require(_0xb225('0x11'));var as=require(_0xb225('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb225('0x13'))(_0xb225('0x14'));var utils=require(_0xb225('0x15'));var config=require(_0xb225('0x16'));var db=require(_0xb225('0x17'))['db'];config['redis']=_[_0xb225('0x18')](config[_0xb225('0x19')],{'host':_0xb225('0x1a'),'port':0x18eb});var socket=require(_0xb225('0x1b'))(new Redis(config[_0xb225('0x19')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x28f330,_0x897e1c){_0x897e1c=_0x897e1c||0xcc;return function(_0x2f163d){if(_0x2f163d){return _0x28f330[_0xb225('0x1c')](_0x897e1c);}return _0x28f330[_0xb225('0x1d')](_0x897e1c)[_0xb225('0x1e')]();};}function respondWithResult(_0x44d32d,_0x2be9b4){_0x2be9b4=_0x2be9b4||0xc8;return function(_0x41b06c){if(_0x41b06c){return _0x44d32d[_0xb225('0x1d')](_0x2be9b4)[_0xb225('0x1f')](_0x41b06c);}};}function respondWithFilteredResult(_0x42441a,_0x5ccb06){return function(_0x1ec9fe){if(_0x1ec9fe){var _0x5bd9e8=_0x1ec9fe[_0xb225('0x20')],_0x3df5f0=_0x5ccb06[_0xb225('0x21')],_0x10a0b6=_0x5ccb06[_0xb225('0x21')]+_0x5ccb06[_0xb225('0x22')],_0x400086;if(_0x10a0b6>=_0x5bd9e8){_0x10a0b6=_0x5bd9e8;_0x400086=0xc8;}else{_0x400086=0xce;}_0x42441a['status'](_0x400086);return _0x42441a['set'](_0xb225('0x23'),_0x3df5f0+'-'+_0x10a0b6+'/'+_0x5bd9e8)[_0xb225('0x1f')](_0x1ec9fe);}return null;};}function patchUpdates(_0x24c854){return function(_0x5df49c){try{jsonpatch['apply'](_0x5df49c,_0x24c854,!![]);}catch(_0x246f42){return BPromise[_0xb225('0x24')](_0x246f42);}return _0x5df49c[_0xb225('0x25')]();};}function saveUpdates(_0x12f00a,_0x8e76be){return function(_0x3d5a8d){if(_0x3d5a8d){return _0x3d5a8d['update'](_0x12f00a)[_0xb225('0x26')](function(_0x556ebf){return _0x556ebf;});}return null;};}function removeEntity(_0x535522,_0x3c323b){return function(_0x12a631){if(_0x12a631){return _0x12a631[_0xb225('0x27')]()[_0xb225('0x26')](function(){var _0xc8e76b=_0x12a631[_0xb225('0x28')]({'plain':!![]});var _0xf90a8b='FaxQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0xf90a8b,'resourceId':_0xc8e76b['id']}})[_0xb225('0x26')](function(){return _0x12a631;});})[_0xb225('0x26')](function(){_0x535522[_0xb225('0x1d')](0xcc)[_0xb225('0x1e')]();});}};}function handleEntityNotFound(_0x13e8e6,_0x5f4d74){return function(_0x8dad16){if(!_0x8dad16){_0x13e8e6[_0xb225('0x1c')](0x194);}return _0x8dad16;};}function handleError(_0x281e0f,_0x41bf0d){_0x41bf0d=_0x41bf0d||0x1f4;return function(_0x4200f9){logger[_0xb225('0x29')](_0x4200f9['stack']);if(_0x4200f9[_0xb225('0x2a')]){delete _0x4200f9[_0xb225('0x2a')];}_0x281e0f[_0xb225('0x1d')](_0x41bf0d)[_0xb225('0x2b')](_0x4200f9);};}exports[_0xb225('0x2c')]=function(_0x378724,_0xbd1a5d){var _0x396fa1={},_0x32dbda={},_0x3a1537={'count':0x0,'rows':[]};var _0x23dcdc=_['map'](db[_0xb225('0x2d')][_0xb225('0x2e')],function(_0x48e0d7){return{'name':_0x48e0d7[_0xb225('0x2f')],'type':_0x48e0d7['type'][_0xb225('0x30')]};});_0x32dbda[_0xb225('0x31')]=_[_0xb225('0x32')](_0x23dcdc,_0xb225('0x2a'));_0x32dbda[_0xb225('0x33')]=_[_0xb225('0x34')](_0x378724[_0xb225('0x33')]);_0x32dbda[_0xb225('0x35')]=_[_0xb225('0x36')](_0x32dbda['model'],_0x32dbda[_0xb225('0x33')]);_0x396fa1['attributes']=_[_0xb225('0x36')](_0x32dbda['model'],qs['fields'](_0x378724[_0xb225('0x33')][_0xb225('0x37')]));_0x396fa1[_0xb225('0x38')]=_0x396fa1[_0xb225('0x38')]['length']?_0x396fa1[_0xb225('0x38')]:_0x32dbda[_0xb225('0x31')];if(!_0x378724[_0xb225('0x33')][_0xb225('0x39')](_0xb225('0x3a'))){_0x396fa1[_0xb225('0x22')]=qs[_0xb225('0x22')](_0x378724[_0xb225('0x33')]['limit']);_0x396fa1['offset']=qs[_0xb225('0x21')](_0x378724['query'][_0xb225('0x21')]);}_0x396fa1[_0xb225('0x3b')]=qs['sort'](_0x378724[_0xb225('0x33')][_0xb225('0x3c')]);_0x396fa1['where']=qs[_0xb225('0x35')](_[_0xb225('0x3d')](_0x378724[_0xb225('0x33')],_0x32dbda[_0xb225('0x35')]),_0x23dcdc);if(_0x378724[_0xb225('0x33')]['filter']){_0x396fa1[_0xb225('0x3e')]=_[_0xb225('0x3f')](_0x396fa1['where'],{'$or':_[_0xb225('0x32')](_0x23dcdc,function(_0x26078a){if(_0x26078a[_0xb225('0x40')]!=='VIRTUAL'){var _0x507d45={};_0x507d45[_0x26078a['name']]={'$like':'%'+_0x378724['query'][_0xb225('0x41')]+'%'};return _0x507d45;}})});}_0x396fa1=_[_0xb225('0x3f')]({},_0x396fa1,_0x378724['options']);var _0x4d98fc={'where':_0x396fa1[_0xb225('0x3e')]};return db['FaxQueue'][_0xb225('0x20')](_0x4d98fc)[_0xb225('0x26')](function(_0x63f828){_0x3a1537['count']=_0x63f828;if(_0x378724[_0xb225('0x33')]['includeAll']){_0x396fa1[_0xb225('0x42')]=[{'all':!![]}];}return db[_0xb225('0x2d')][_0xb225('0x43')](_0x396fa1);})[_0xb225('0x26')](function(_0x383974){_0x3a1537[_0xb225('0x44')]=_0x383974;return _0x3a1537;})[_0xb225('0x26')](respondWithFilteredResult(_0xbd1a5d,_0x396fa1))[_0xb225('0x45')](handleError(_0xbd1a5d,null));};exports['show']=function(_0x3034ec,_0x1691ce){var _0x35b1f7={'raw':!![],'where':{'id':_0x3034ec[_0xb225('0x46')]['id']}},_0xec2af7={};_0xec2af7['model']=_[_0xb225('0x34')](db[_0xb225('0x2d')][_0xb225('0x2e')]);_0xec2af7[_0xb225('0x33')]=_[_0xb225('0x34')](_0x3034ec[_0xb225('0x33')]);_0xec2af7['filters']=_[_0xb225('0x36')](_0xec2af7[_0xb225('0x31')],_0xec2af7[_0xb225('0x33')]);_0x35b1f7[_0xb225('0x38')]=_['intersection'](_0xec2af7[_0xb225('0x31')],qs[_0xb225('0x37')](_0x3034ec['query'][_0xb225('0x37')]));_0x35b1f7[_0xb225('0x38')]=_0x35b1f7[_0xb225('0x38')][_0xb225('0x47')]?_0x35b1f7['attributes']:_0xec2af7['model'];if(_0x3034ec['query'][_0xb225('0x48')]){_0x35b1f7[_0xb225('0x42')]=[{'all':!![]}];}_0x35b1f7=_[_0xb225('0x3f')]({},_0x35b1f7,_0x3034ec['options']);return db[_0xb225('0x2d')]['find'](_0x35b1f7)[_0xb225('0x26')](handleEntityNotFound(_0x1691ce,null))[_0xb225('0x26')](respondWithResult(_0x1691ce,null))[_0xb225('0x45')](handleError(_0x1691ce,null));};exports['create']=function(_0x512c7e,_0x1a5397){return db[_0xb225('0x2d')][_0xb225('0x49')](_0x512c7e[_0xb225('0x4a')],{})[_0xb225('0x26')](function(_0x50b3d7){var _0xd87bbb=_0x512c7e['user']['get']({'plain':!![]});if(!_0xd87bbb)throw new Error(_0xb225('0x4b'));if(_0xd87bbb[_0xb225('0x4c')]==='user'){var _0x54cd0e=_0x50b3d7[_0xb225('0x28')]({'plain':!![]});var _0x5ad591=_0xb225('0x4d');return db[_0xb225('0x4e')][_0xb225('0x4f')]({'where':{'name':_0x5ad591,'userProfileId':_0xd87bbb[_0xb225('0x50')]},'raw':!![]})['then'](function(_0x332a1a){if(_0x332a1a&&_0x332a1a['autoAssociation']===0x0){return db[_0xb225('0x51')][_0xb225('0x49')]({'name':_0x54cd0e[_0xb225('0x2a')],'resourceId':_0x54cd0e['id'],'type':_0x332a1a[_0xb225('0x2a')],'sectionId':_0x332a1a['id']},{})['then'](function(){return _0x50b3d7;});}else{return _0x50b3d7;}})['catch'](function(_0x18a371){logger[_0xb225('0x29')](_0xb225('0x52'),_0x18a371);throw _0x18a371;});}return _0x50b3d7;})['then'](respondWithResult(_0x1a5397,0xc9))[_0xb225('0x45')](handleError(_0x1a5397,null));};exports[_0xb225('0x53')]=function(_0x230820,_0x17a920){if(_0x230820[_0xb225('0x4a')]['id']){delete _0x230820[_0xb225('0x4a')]['id'];}return db[_0xb225('0x2d')][_0xb225('0x4f')]({'where':{'id':_0x230820['params']['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x17a920,null))[_0xb225('0x26')](saveUpdates(_0x230820[_0xb225('0x4a')],null))[_0xb225('0x26')](respondWithResult(_0x17a920,null))[_0xb225('0x45')](handleError(_0x17a920,null));};exports['destroy']=function(_0x49345e,_0x556cb1){return db[_0xb225('0x2d')]['find']({'where':{'id':_0x49345e['params']['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x556cb1,null))[_0xb225('0x26')](removeEntity(_0x556cb1,null))[_0xb225('0x45')](handleError(_0x556cb1,null));};exports[_0xb225('0x54')]=function(_0x1e0dcf,_0x4c7a5e){return db[_0xb225('0x2d')][_0xb225('0x54')]()[_0xb225('0x26')](respondWithResult(_0x4c7a5e,null))['catch'](handleError(_0x4c7a5e,null));};exports['getMembers']=function(_0x4666b4,_0x553b06,_0x12073e){var _0x2678e8={'raw':!![],'where':{}},_0x5b687e={},_0x3653f8;return db[_0xb225('0x2d')][_0xb225('0x55')]({'where':{'id':_0x4666b4[_0xb225('0x46')]['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x553b06,null))['then'](function(_0x1d3ad9){if(_0x1d3ad9){_0x3653f8=_0x1d3ad9[_0xb225('0x28')]({'plain':!![]});_0x5b687e[_0xb225('0x31')]=_[_0xb225('0x34')](db[_0xb225('0x56')][_0xb225('0x2e')]);_0x5b687e[_0xb225('0x33')]=_[_0xb225('0x34')](_0x4666b4[_0xb225('0x33')]);_0x5b687e[_0xb225('0x35')]=_[_0xb225('0x36')](_0x5b687e[_0xb225('0x31')],_0x5b687e[_0xb225('0x33')]);_0x2678e8[_0xb225('0x38')]=_[_0xb225('0x36')](_0x5b687e['model'],qs[_0xb225('0x37')](_0x4666b4[_0xb225('0x33')]['fields']));_0x2678e8[_0xb225('0x38')]=_0x2678e8[_0xb225('0x38')][_0xb225('0x47')]?_0x2678e8['attributes']:_0x5b687e['model'];if(!_0x4666b4['query'][_0xb225('0x39')]('nolimit')){_0x2678e8[_0xb225('0x22')]=qs[_0xb225('0x22')](_0x4666b4[_0xb225('0x33')]['limit']);_0x2678e8[_0xb225('0x21')]=qs[_0xb225('0x21')](_0x4666b4[_0xb225('0x33')][_0xb225('0x21')]);}_0x2678e8[_0xb225('0x3b')]=qs['sort'](_0x4666b4['query'][_0xb225('0x3c')]);_0x2678e8['where']=qs[_0xb225('0x35')](_[_0xb225('0x3d')](_0x4666b4[_0xb225('0x33')],_0x5b687e[_0xb225('0x35')]));_0x2678e8[_0xb225('0x3e')][_0xb225('0x57')]=_0x1d3ad9['id'];if(_0x4666b4[_0xb225('0x33')][_0xb225('0x41')]){_0x2678e8[_0xb225('0x3e')]=_[_0xb225('0x3f')](_0x2678e8[_0xb225('0x3e')],{'$or':_['map'](_0x2678e8[_0xb225('0x38')],function(_0x10573d){var _0x1b58ed={};_0x1b58ed[_0x10573d]={'$like':'%'+_0x4666b4[_0xb225('0x33')][_0xb225('0x41')]+'%'};return _0x1b58ed;})});}_0x2678e8=_[_0xb225('0x3f')]({},_0x2678e8,_0x4666b4[_0xb225('0x58')]);return db[_0xb225('0x56')]['findAll'](_0x2678e8);}})[_0xb225('0x26')](function(_0x2d91a9){if(_0x2d91a9){return db[_0xb225('0x59')][_0xb225('0x5a')]({'where':{'id':_[_0xb225('0x32')](_0x2d91a9,_0xb225('0x5b')),'role':_0xb225('0x5c')},'attributes':['id',_0xb225('0x2a'),'faxPause','updatedAt','createdAt']});}})[_0xb225('0x26')](function(_0x6f404b){if(_0x6f404b){return{'count':_0x6f404b['count'],'rows':_['map'](_0x6f404b[_0xb225('0x44')],function(_0x26ede2){return{'membername':_0x26ede2[_0xb225('0x2a')],'UserId':_0x26ede2['id'],'queue_name':_0x3653f8['name'],'FaxQueueId':_0x3653f8['id'],'interface':util[_0xb225('0x5d')]('%s/%s',_0xb225('0x5e'),_0x26ede2[_0xb225('0x2a')]),'penalty':0x0,'paused':_0x26ede2[_0xb225('0x5f')],'createdAt':_0x26ede2[_0xb225('0x60')],'updatedAt':_0x26ede2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x553b06,_0x2678e8))[_0xb225('0x45')](handleError(_0x553b06,null));};exports[_0xb225('0x61')]=function(_0x5d18ba,_0x31f719,_0x2f5bd9){var _0x92f508={};var _0x1c2e75={};var _0x289245;var _0x4aaee7;return db[_0xb225('0x2d')]['findOne']({'where':{'id':_0x5d18ba['params']['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x31f719,null))[_0xb225('0x26')](function(_0x10bf86){if(_0x10bf86){_0x289245=_0x10bf86;_0x1c2e75[_0xb225('0x31')]=_[_0xb225('0x34')](db['Team'][_0xb225('0x2e')]);_0x1c2e75[_0xb225('0x33')]=_[_0xb225('0x34')](_0x5d18ba[_0xb225('0x33')]);_0x1c2e75[_0xb225('0x35')]=_[_0xb225('0x36')](_0x1c2e75[_0xb225('0x31')],_0x1c2e75[_0xb225('0x33')]);_0x92f508[_0xb225('0x38')]=_[_0xb225('0x36')](_0x1c2e75[_0xb225('0x31')],qs[_0xb225('0x37')](_0x5d18ba[_0xb225('0x33')]['fields']));_0x92f508[_0xb225('0x38')]=_0x92f508['attributes']['length']?_0x92f508[_0xb225('0x38')]:_0x1c2e75['model'];_0x92f508[_0xb225('0x3b')]=qs['sort'](_0x5d18ba[_0xb225('0x33')][_0xb225('0x3c')]);_0x92f508['where']=qs['filters'](_['pick'](_0x5d18ba[_0xb225('0x33')],_0x1c2e75[_0xb225('0x35')]));if(_0x5d18ba[_0xb225('0x33')][_0xb225('0x41')]){_0x92f508[_0xb225('0x3e')]=_[_0xb225('0x3f')](_0x92f508[_0xb225('0x3e')],{'$or':_[_0xb225('0x32')](_0x92f508[_0xb225('0x38')],function(_0x2ac4fe){var _0x1a9a7c={};_0x1a9a7c[_0x2ac4fe]={'$like':'%'+_0x5d18ba[_0xb225('0x33')][_0xb225('0x41')]+'%'};return _0x1a9a7c;})});}_0x92f508=_['merge']({},_0x92f508,_0x5d18ba[_0xb225('0x58')]);return _0x289245[_0xb225('0x61')](_0x92f508);}})['then'](function(_0x4b5241){if(_0x4b5241){_0x4aaee7=_0x4b5241[_0xb225('0x47')];if(!_0x5d18ba[_0xb225('0x33')]['hasOwnProperty'](_0xb225('0x3a'))){_0x92f508[_0xb225('0x22')]=qs['limit'](_0x5d18ba[_0xb225('0x33')]['limit']);_0x92f508['offset']=qs[_0xb225('0x21')](_0x5d18ba['query'][_0xb225('0x21')]);}return _0x289245[_0xb225('0x61')](_0x92f508);}})[_0xb225('0x26')](function(_0x494d9d){if(_0x494d9d){return _0x494d9d?{'count':_0x4aaee7,'rows':_0x494d9d}:null;}})[_0xb225('0x26')](respondWithResult(_0x31f719,null))[_0xb225('0x45')](handleError(_0x31f719,null));};exports[_0xb225('0x62')]=function(_0x483aed,_0x224fb5,_0x4fa2d9){var _0x46423e=_0x483aed[_0xb225('0x4a')][_0xb225('0x63')];return db['Team'][_0xb225('0x43')]({'where':{'id':_0x46423e},'attributes':['id'],'include':[{'model':db[_0xb225('0x59')],'as':_0xb225('0x64'),'attributes':['id',_0xb225('0x2a'),_0xb225('0x65'),_0xb225('0x66'),_0xb225('0x67')],'raw':!![]}]})[_0xb225('0x26')](function(_0x2544bb){if(_0x2544bb){var _0x2213f6=_[_0xb225('0x68')](_0x2544bb,function(_0x13304e){var _0x409284=_0x13304e[_0xb225('0x28')]({'plain':!![]});return _0x409284[_0xb225('0x64')];});return db[_0xb225('0x2d')]['find']({'where':{'id':_0x483aed['params']['id']}})['then'](function(_0x169470){return db[_0xb225('0x69')][_0xb225('0x6a')](function(_0x133fa8){return _0x169470[_0xb225('0x62')](_0x46423e,{'transaction':_0x133fa8})[_0xb225('0x26')](function(){return BPromise[_0xb225('0x6b')](_0x2213f6,function(_0x24c5fa){return db[_0xb225('0x56')]['findOrCreate']({'where':{'UserId':_0x24c5fa['id'],'FaxQueueId':_0x483aed['params']['id']},'transaction':_0x133fa8});});})[_0xb225('0x26')](function(){_0x2213f6[_0xb225('0x6c')](function(_0x578006){socket['emit'](_0xb225('0x6d'),{'UserId':_0x578006['id'],'FaxQueueId':_0x169470['id']});});});});});}})[_0xb225('0x26')](respondWithStatusCode(_0x224fb5,null))[_0xb225('0x45')](handleError(_0x224fb5,null));};exports[_0xb225('0x6e')]=function(_0x3c6cab,_0x358928,_0x291395){return db[_0xb225('0x6f')][_0xb225('0x43')]({'where':{'id':_0x3c6cab['query'][_0xb225('0x63')]},'attributes':['id'],'include':[{'model':db[_0xb225('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb225('0x26')](handleEntityNotFound(_0x358928,null))[_0xb225('0x26')](function(_0x4494f1){var _0x42cdc9=_[_0xb225('0x32')](_0x4494f1,'id');var _0x2ba0fd=[];var _0x421919=[];var _0x4f8e82=squel[_0xb225('0x70')]();_0x4f8e82[_0xb225('0x71')](_0xb225('0x72'))['from'](_0xb225('0x73'),'tq')[_0xb225('0x74')]('user_has_teams','ut',_0xb225('0x75'))['where'](_0xb225('0x76'),_0x3c6cab['params']['id']);for(var _0x35dd3a=0x0;_0x35dd3a<_0x4494f1[_0xb225('0x47')];_0x35dd3a+=0x1){let _0x52420a=_0x4494f1[_0x35dd3a];for(var _0x3c11a3=0x0;_0x3c11a3<_0x52420a[_0xb225('0x64')][_0xb225('0x47')];_0x3c11a3+=0x1){let _0x47c39a=_0x52420a[_0xb225('0x64')][_0x3c11a3];var _0x522c2a=_0x4f8e82[_0xb225('0x77')]();_0x522c2a[_0xb225('0x3e')]('ut.UserId\x20=\x20?',_0x47c39a['id']);_0x421919[_0xb225('0x78')](db[_0xb225('0x69')][_0xb225('0x33')](_0x522c2a[_0xb225('0x79')](),{'type':db['sequelize'][_0xb225('0x7a')][_0xb225('0x7b')]})[_0xb225('0x26')](function(_0x5a1f26){if(_0x5a1f26[_0xb225('0x47')]===0x1){return _0x47c39a['id'];}else{var _0xba8e0d=_[_0xb225('0x7c')](_[_0xb225('0x32')](_0x5a1f26,_0xb225('0x7d')),function(_0x31497b){return _[_0xb225('0x7e')](_0x42cdc9,_0x31497b);});if(_0xba8e0d){return _0x47c39a['id'];}}}));}}return BPromise[_0xb225('0x7f')](_0x421919)[_0xb225('0x26')](function(_0xfd2de1){_0x2ba0fd=_(_0x2ba0fd)['union'](_0xfd2de1)[_0xb225('0x80')]()[_0xb225('0x81')]();return db[_0xb225('0x2d')]['find']({'where':{'id':_0x3c6cab[_0xb225('0x46')]['id']}})[_0xb225('0x26')](function(_0xfe66c9){return db[_0xb225('0x69')][_0xb225('0x6a')](function(_0x21b5cc){return _0xfe66c9['removeTeams'](_0x3c6cab[_0xb225('0x33')][_0xb225('0x63')],{'transaction':_0x21b5cc})[_0xb225('0x26')](function(){if(!_[_0xb225('0x82')](_0x2ba0fd)){return _0xfe66c9[_0xb225('0x83')](_0x2ba0fd,{'transaction':_0x21b5cc});}})[_0xb225('0x26')](function(){_0x2ba0fd[_0xb225('0x6c')](function(_0x5070d5){socket[_0xb225('0x84')](_0xb225('0x85'),{'UserId':_0x5070d5,'FaxQueueId':_0xfe66c9['id']});});});});});});})[_0xb225('0x26')](respondWithStatusCode(_0x358928,null))['catch'](handleError(_0x358928,null));};exports[_0xb225('0x86')]=function(_0x27e0d5,_0x32c730,_0x2c4542){return db[_0xb225('0x2d')][_0xb225('0x4f')]({'where':{'id':_0x27e0d5[_0xb225('0x46')]['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x32c730,null))[_0xb225('0x26')](function(_0x5ea762){if(_0x5ea762){return _0x5ea762[_0xb225('0x86')](_0x27e0d5[_0xb225('0x4a')][_0xb225('0x63')],_[_0xb225('0x87')](_0x27e0d5[_0xb225('0x4a')],['ids','id'])||{})['spread'](function(_0x41633c){for(var _0x8a7e0a=0x0;_0x8a7e0a<_0x27e0d5[_0xb225('0x4a')]['ids']['length'];_0x8a7e0a+=0x1){socket[_0xb225('0x84')](_0xb225('0x6d'),{'UserId':_0x27e0d5[_0xb225('0x4a')][_0xb225('0x63')][_0x8a7e0a],'FaxQueueId':_0x27e0d5[_0xb225('0x46')]['id']});}return _0x41633c;});}})[_0xb225('0x26')](respondWithResult(_0x32c730,null))['catch'](handleError(_0x32c730,null));};exports[_0xb225('0x83')]=function(_0x2b43d2,_0x566016,_0x3479a5){return db[_0xb225('0x2d')][_0xb225('0x4f')]({'where':{'id':_0x2b43d2[_0xb225('0x46')]['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x566016,null))[_0xb225('0x26')](function(_0x50fa9c){if(_0x50fa9c){return _0x50fa9c['removeAgents'](_0x2b43d2['query'][_0xb225('0x63')])[_0xb225('0x26')](function(){if(_[_0xb225('0x88')](_0x2b43d2['query'][_0xb225('0x63')])){for(var _0xa88ef0=0x0;_0xa88ef0<_0x2b43d2[_0xb225('0x33')][_0xb225('0x63')][_0xb225('0x47')];_0xa88ef0+=0x1){socket[_0xb225('0x84')]('userFaxQueue:remove',{'UserId':Number(_0x2b43d2['query'][_0xb225('0x63')][_0xa88ef0]),'FaxQueueId':Number(_0x2b43d2[_0xb225('0x46')]['id'])});}}else{socket[_0xb225('0x84')](_0xb225('0x85'),{'UserId':Number(_0x2b43d2[_0xb225('0x33')][_0xb225('0x63')]),'FaxQueueId':Number(_0x2b43d2[_0xb225('0x46')]['id'])});}});}})[_0xb225('0x26')](respondWithStatusCode(_0x566016,null))[_0xb225('0x45')](handleError(_0x566016,null));};exports[_0xb225('0x89')]=function(_0x76716d,_0x3cf10a,_0x4ef85e){var _0x45f592={};var _0xe3533b={};var _0x204b67;var _0x2dd1bf;return db[_0xb225('0x2d')][_0xb225('0x55')]({'where':{'id':_0x76716d[_0xb225('0x46')]['id']}})[_0xb225('0x26')](handleEntityNotFound(_0x3cf10a,null))[_0xb225('0x26')](function(_0x475381){if(_0x475381){_0x204b67=_0x475381;_0xe3533b[_0xb225('0x31')]=_['keys'](db['User'][_0xb225('0x2e')]);_0xe3533b[_0xb225('0x33')]=_[_0xb225('0x34')](_0x76716d[_0xb225('0x33')]);_0xe3533b[_0xb225('0x35')]=_[_0xb225('0x36')](_0xe3533b[_0xb225('0x31')],_0xe3533b[_0xb225('0x33')]);_0x45f592[_0xb225('0x38')]=_[_0xb225('0x36')](_0xe3533b['model'],qs[_0xb225('0x37')](_0x76716d[_0xb225('0x33')]['fields']));_0x45f592[_0xb225('0x38')]=_0x45f592[_0xb225('0x38')][_0xb225('0x47')]?_0x45f592[_0xb225('0x38')]:_0xe3533b[_0xb225('0x31')];_0x45f592['order']=qs[_0xb225('0x3c')](_0x76716d['query'][_0xb225('0x3c')]);_0x45f592['where']=qs[_0xb225('0x35')](_[_0xb225('0x3d')](_0x76716d[_0xb225('0x33')],_0xe3533b[_0xb225('0x35')]));if(_0x76716d[_0xb225('0x33')][_0xb225('0x41')]){_0x45f592[_0xb225('0x3e')]=_[_0xb225('0x3f')](_0x45f592[_0xb225('0x3e')],{'$or':_['map'](_0x45f592[_0xb225('0x38')],function(_0x1bad17){var _0x50843a={};_0x50843a[_0x1bad17]={'$like':'%'+_0x76716d[_0xb225('0x33')][_0xb225('0x41')]+'%'};return _0x50843a;})});}_0x45f592=_[_0xb225('0x3f')]({},_0x45f592,_0x76716d[_0xb225('0x58')]);return _0x204b67[_0xb225('0x89')](_0x45f592);}})['then'](function(_0x39e03a){if(_0x39e03a){_0x2dd1bf=_0x39e03a[_0xb225('0x47')];if(!_0x76716d[_0xb225('0x33')][_0xb225('0x39')]('nolimit')){_0x45f592[_0xb225('0x22')]=qs[_0xb225('0x22')](_0x76716d[_0xb225('0x33')]['limit']);_0x45f592['offset']=qs[_0xb225('0x21')](_0x76716d[_0xb225('0x33')][_0xb225('0x21')]);}return _0x204b67[_0xb225('0x89')](_0x45f592);}})[_0xb225('0x26')](function(_0x1db9a5){if(_0x1db9a5){return _0x1db9a5?{'count':_0x2dd1bf,'rows':_0x1db9a5}:null;}})[_0xb225('0x26')](respondWithResult(_0x3cf10a,null))[_0xb225('0x45')](handleError(_0x3cf10a,null));}; \ No newline at end of file +var _0x94e6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','FaxQueue','include','rows','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','FaxQueueId','findAll','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','desk.js'];(function(_0x2a8957,_0x5418f2){var _0x5b1960=function(_0xeff538){while(--_0xeff538){_0x2a8957['push'](_0x2a8957['shift']());}};_0x5b1960(++_0x5418f2);}(_0x94e6,0x194));var _0x694e=function(_0x544b80,_0x428ab0){_0x544b80=_0x544b80-0x0;var _0x22cbe7=_0x94e6[_0x544b80];return _0x22cbe7;};'use strict';var pdf=require(_0x694e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x694e('0x1'));var zipdir=require(_0x694e('0x2'));var jsonpatch=require(_0x694e('0x3'));var rp=require(_0x694e('0x4'));var moment=require(_0x694e('0x5'));var BPromise=require(_0x694e('0x6'));var Mustache=require('mustache');var util=require(_0x694e('0x7'));var path=require(_0x694e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x694e('0x9'));var fs=require('fs');var _=require(_0x694e('0xa'));var squel=require(_0x694e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x694e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x694e('0xd'));var authService=require(_0x694e('0xe'));var qs=require(_0x694e('0xf'));var as=require(_0x694e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x694e('0x11'))(_0x694e('0x12'));var utils=require('../../config/utils');var config=require(_0x694e('0x13'));var db=require(_0x694e('0x14'))['db'];config[_0x694e('0x15')]=_[_0x694e('0x16')](config['redis'],{'host':_0x694e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x694e('0x15')]));require(_0x694e('0x18'))[_0x694e('0x19')](socket);function respondWithStatusCode(_0x3a4a60,_0x1532f6){_0x1532f6=_0x1532f6||0xcc;return function(_0x310a08){if(_0x310a08){return _0x3a4a60[_0x694e('0x1a')](_0x1532f6);}return _0x3a4a60[_0x694e('0x1b')](_0x1532f6)[_0x694e('0x1c')]();};}function respondWithResult(_0x1f4df1,_0x327f83){_0x327f83=_0x327f83||0xc8;return function(_0x46d46c){if(_0x46d46c){return _0x1f4df1[_0x694e('0x1b')](_0x327f83)['json'](_0x46d46c);}};}function respondWithFilteredResult(_0x45abd6,_0x414a6c){return function(_0x40b5bd){if(_0x40b5bd){var _0x38966f=_0x40b5bd[_0x694e('0x1d')],_0x2a332b=_0x414a6c[_0x694e('0x1e')],_0x3cd7b9=_0x414a6c[_0x694e('0x1e')]+_0x414a6c[_0x694e('0x1f')],_0x165125;if(_0x3cd7b9>=_0x38966f){_0x3cd7b9=_0x38966f;_0x165125=0xc8;}else{_0x165125=0xce;}_0x45abd6['status'](_0x165125);return _0x45abd6[_0x694e('0x20')]('Content-Range',_0x2a332b+'-'+_0x3cd7b9+'/'+_0x38966f)[_0x694e('0x21')](_0x40b5bd);}return null;};}function patchUpdates(_0x46868d){return function(_0x4b191b){try{jsonpatch[_0x694e('0x22')](_0x4b191b,_0x46868d,!![]);}catch(_0x443614){return BPromise[_0x694e('0x23')](_0x443614);}return _0x4b191b[_0x694e('0x24')]();};}function saveUpdates(_0x22d614,_0x308e24){return function(_0x2bb6dc){if(_0x2bb6dc){return _0x2bb6dc[_0x694e('0x25')](_0x22d614)[_0x694e('0x26')](function(_0x40b126){return _0x40b126;});}return null;};}function removeEntity(_0x415eb0,_0x508b9b){return function(_0x5e2332){if(_0x5e2332){return _0x5e2332[_0x694e('0x27')]()[_0x694e('0x26')](function(){var _0x4ea16c=_0x5e2332[_0x694e('0x28')]({'plain':!![]});var _0x2f6984=_0x694e('0x29');return db[_0x694e('0x2a')][_0x694e('0x27')]({'where':{'type':_0x2f6984,'resourceId':_0x4ea16c['id']}})[_0x694e('0x26')](function(){return _0x5e2332;});})[_0x694e('0x26')](function(){_0x415eb0[_0x694e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x315ef3,_0x3ef315){return function(_0xe34d77){if(!_0xe34d77){_0x315ef3[_0x694e('0x1a')](0x194);}return _0xe34d77;};}function handleError(_0xbce4e7,_0x3fe22a){_0x3fe22a=_0x3fe22a||0x1f4;return function(_0x482209){logger[_0x694e('0x2b')](_0x482209['stack']);if(_0x482209[_0x694e('0x2c')]){delete _0x482209[_0x694e('0x2c')];}_0xbce4e7[_0x694e('0x1b')](_0x3fe22a)['send'](_0x482209);};}exports[_0x694e('0x2d')]=function(_0x5a59cf,_0x548094){var _0x3771f4={},_0x44c8d1={},_0xd0a3ff={'count':0x0,'rows':[]};var _0x53c38d=_[_0x694e('0x2e')](db['FaxQueue'][_0x694e('0x2f')],function(_0x21a1d6){return{'name':_0x21a1d6['fieldName'],'type':_0x21a1d6[_0x694e('0x30')][_0x694e('0x31')]};});_0x44c8d1[_0x694e('0x32')]=_[_0x694e('0x2e')](_0x53c38d,'name');_0x44c8d1[_0x694e('0x33')]=_['keys'](_0x5a59cf[_0x694e('0x33')]);_0x44c8d1[_0x694e('0x34')]=_[_0x694e('0x35')](_0x44c8d1['model'],_0x44c8d1[_0x694e('0x33')]);_0x3771f4[_0x694e('0x36')]=_[_0x694e('0x35')](_0x44c8d1[_0x694e('0x32')],qs[_0x694e('0x37')](_0x5a59cf[_0x694e('0x33')][_0x694e('0x37')]));_0x3771f4[_0x694e('0x36')]=_0x3771f4['attributes'][_0x694e('0x38')]?_0x3771f4[_0x694e('0x36')]:_0x44c8d1[_0x694e('0x32')];if(!_0x5a59cf[_0x694e('0x33')]['hasOwnProperty'](_0x694e('0x39'))){_0x3771f4[_0x694e('0x1f')]=qs[_0x694e('0x1f')](_0x5a59cf[_0x694e('0x33')][_0x694e('0x1f')]);_0x3771f4[_0x694e('0x1e')]=qs[_0x694e('0x1e')](_0x5a59cf[_0x694e('0x33')][_0x694e('0x1e')]);}_0x3771f4['order']=qs['sort'](_0x5a59cf[_0x694e('0x33')][_0x694e('0x3a')]);_0x3771f4[_0x694e('0x3b')]=qs[_0x694e('0x34')](_[_0x694e('0x3c')](_0x5a59cf['query'],_0x44c8d1[_0x694e('0x34')]),_0x53c38d);if(_0x5a59cf[_0x694e('0x33')][_0x694e('0x3d')]){_0x3771f4[_0x694e('0x3b')]=_[_0x694e('0x3e')](_0x3771f4[_0x694e('0x3b')],{'$or':_[_0x694e('0x2e')](_0x53c38d,function(_0x196c9a){if(_0x196c9a[_0x694e('0x30')]!=='VIRTUAL'){var _0x345dbc={};_0x345dbc[_0x196c9a['name']]={'$like':'%'+_0x5a59cf[_0x694e('0x33')]['filter']+'%'};return _0x345dbc;}})});}_0x3771f4=_[_0x694e('0x3e')]({},_0x3771f4,_0x5a59cf[_0x694e('0x3f')]);var _0x331839={'where':_0x3771f4['where']};return db[_0x694e('0x40')][_0x694e('0x1d')](_0x331839)[_0x694e('0x26')](function(_0x3dd5a5){_0xd0a3ff[_0x694e('0x1d')]=_0x3dd5a5;if(_0x5a59cf[_0x694e('0x33')]['includeAll']){_0x3771f4[_0x694e('0x41')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x3771f4);})['then'](function(_0x2559cd){_0xd0a3ff[_0x694e('0x42')]=_0x2559cd;return _0xd0a3ff;})[_0x694e('0x26')](respondWithFilteredResult(_0x548094,_0x3771f4))[_0x694e('0x43')](handleError(_0x548094,null));};exports[_0x694e('0x44')]=function(_0x5e9fbc,_0x357599){var _0x29ecce={'raw':!![],'where':{'id':_0x5e9fbc[_0x694e('0x45')]['id']}},_0x10d041={};_0x10d041[_0x694e('0x32')]=_[_0x694e('0x46')](db[_0x694e('0x40')][_0x694e('0x2f')]);_0x10d041['query']=_['keys'](_0x5e9fbc[_0x694e('0x33')]);_0x10d041[_0x694e('0x34')]=_[_0x694e('0x35')](_0x10d041['model'],_0x10d041[_0x694e('0x33')]);_0x29ecce[_0x694e('0x36')]=_[_0x694e('0x35')](_0x10d041[_0x694e('0x32')],qs[_0x694e('0x37')](_0x5e9fbc[_0x694e('0x33')][_0x694e('0x37')]));_0x29ecce[_0x694e('0x36')]=_0x29ecce['attributes'][_0x694e('0x38')]?_0x29ecce[_0x694e('0x36')]:_0x10d041[_0x694e('0x32')];if(_0x5e9fbc['query'][_0x694e('0x47')]){_0x29ecce[_0x694e('0x41')]=[{'all':!![]}];}_0x29ecce=_[_0x694e('0x3e')]({},_0x29ecce,_0x5e9fbc[_0x694e('0x3f')]);return db['FaxQueue'][_0x694e('0x48')](_0x29ecce)[_0x694e('0x26')](handleEntityNotFound(_0x357599,null))[_0x694e('0x26')](respondWithResult(_0x357599,null))['catch'](handleError(_0x357599,null));};exports[_0x694e('0x49')]=function(_0xdfa0dd,_0xfc62b5){return db['FaxQueue'][_0x694e('0x49')](_0xdfa0dd[_0x694e('0x4a')],{})[_0x694e('0x26')](function(_0x30ccc4){var _0x537e23=_0xdfa0dd['user'][_0x694e('0x28')]({'plain':!![]});if(!_0x537e23)throw new Error(_0x694e('0x4b'));if(_0x537e23[_0x694e('0x4c')]===_0x694e('0x4d')){var _0x449675=_0x30ccc4[_0x694e('0x28')]({'plain':!![]});var _0x10a402=_0x694e('0x29');return db[_0x694e('0x4e')][_0x694e('0x48')]({'where':{'name':_0x10a402,'userProfileId':_0x537e23[_0x694e('0x4f')]},'raw':!![]})[_0x694e('0x26')](function(_0x350641){if(_0x350641&&_0x350641[_0x694e('0x50')]===0x0){return db['UserProfileResource'][_0x694e('0x49')]({'name':_0x449675[_0x694e('0x2c')],'resourceId':_0x449675['id'],'type':_0x350641[_0x694e('0x2c')],'sectionId':_0x350641['id']},{})[_0x694e('0x26')](function(){return _0x30ccc4;});}else{return _0x30ccc4;}})[_0x694e('0x43')](function(_0x27ad8b){logger[_0x694e('0x2b')](_0x694e('0x51'),_0x27ad8b);throw _0x27ad8b;});}return _0x30ccc4;})[_0x694e('0x26')](respondWithResult(_0xfc62b5,0xc9))[_0x694e('0x43')](handleError(_0xfc62b5,null));};exports[_0x694e('0x25')]=function(_0x12c014,_0x28d4f6){if(_0x12c014[_0x694e('0x4a')]['id']){delete _0x12c014[_0x694e('0x4a')]['id'];}return db[_0x694e('0x40')][_0x694e('0x48')]({'where':{'id':_0x12c014['params']['id']}})[_0x694e('0x26')](handleEntityNotFound(_0x28d4f6,null))[_0x694e('0x26')](saveUpdates(_0x12c014[_0x694e('0x4a')],null))[_0x694e('0x26')](respondWithResult(_0x28d4f6,null))[_0x694e('0x43')](handleError(_0x28d4f6,null));};exports['destroy']=function(_0x1fe3ed,_0x30b173){return db['FaxQueue']['find']({'where':{'id':_0x1fe3ed['params']['id']}})['then'](handleEntityNotFound(_0x30b173,null))[_0x694e('0x26')](removeEntity(_0x30b173,null))['catch'](handleError(_0x30b173,null));};exports[_0x694e('0x52')]=function(_0x277844,_0x497d2c){return db[_0x694e('0x40')][_0x694e('0x52')]()['then'](respondWithResult(_0x497d2c,null))['catch'](handleError(_0x497d2c,null));};exports[_0x694e('0x53')]=function(_0x498a7c,_0x5a171c,_0x5eea31){var _0x208973={'raw':!![],'where':{}},_0x54ca88={},_0x813b94;return db[_0x694e('0x40')][_0x694e('0x54')]({'where':{'id':_0x498a7c['params']['id']}})[_0x694e('0x26')](handleEntityNotFound(_0x5a171c,null))[_0x694e('0x26')](function(_0x1cba5f){if(_0x1cba5f){_0x813b94=_0x1cba5f[_0x694e('0x28')]({'plain':!![]});_0x54ca88[_0x694e('0x32')]=_[_0x694e('0x46')](db[_0x694e('0x55')][_0x694e('0x2f')]);_0x54ca88[_0x694e('0x33')]=_['keys'](_0x498a7c[_0x694e('0x33')]);_0x54ca88[_0x694e('0x34')]=_[_0x694e('0x35')](_0x54ca88[_0x694e('0x32')],_0x54ca88[_0x694e('0x33')]);_0x208973[_0x694e('0x36')]=_['intersection'](_0x54ca88[_0x694e('0x32')],qs[_0x694e('0x37')](_0x498a7c[_0x694e('0x33')]['fields']));_0x208973[_0x694e('0x36')]=_0x208973[_0x694e('0x36')]['length']?_0x208973[_0x694e('0x36')]:_0x54ca88['model'];if(!_0x498a7c['query'][_0x694e('0x56')]('nolimit')){_0x208973[_0x694e('0x1f')]=qs['limit'](_0x498a7c[_0x694e('0x33')]['limit']);_0x208973['offset']=qs['offset'](_0x498a7c[_0x694e('0x33')][_0x694e('0x1e')]);}_0x208973[_0x694e('0x57')]=qs['sort'](_0x498a7c['query'][_0x694e('0x3a')]);_0x208973[_0x694e('0x3b')]=qs[_0x694e('0x34')](_['pick'](_0x498a7c[_0x694e('0x33')],_0x54ca88[_0x694e('0x34')]));_0x208973[_0x694e('0x3b')][_0x694e('0x58')]=_0x1cba5f['id'];if(_0x498a7c[_0x694e('0x33')][_0x694e('0x3d')]){_0x208973[_0x694e('0x3b')]=_['merge'](_0x208973[_0x694e('0x3b')],{'$or':_[_0x694e('0x2e')](_0x208973[_0x694e('0x36')],function(_0x3577ad){var _0x5e47c5={};_0x5e47c5[_0x3577ad]={'$like':'%'+_0x498a7c[_0x694e('0x33')][_0x694e('0x3d')]+'%'};return _0x5e47c5;})});}_0x208973=_['merge']({},_0x208973,_0x498a7c['options']);return db[_0x694e('0x55')][_0x694e('0x59')](_0x208973);}})[_0x694e('0x26')](function(_0x577e81){if(_0x577e81){return db[_0x694e('0x5a')][_0x694e('0x5b')]({'where':{'id':_[_0x694e('0x2e')](_0x577e81,'UserId'),'role':_0x694e('0x5c')},'attributes':['id',_0x694e('0x2c'),_0x694e('0x5d'),_0x694e('0x5e'),_0x694e('0x5f')]});}})[_0x694e('0x26')](function(_0x450251){if(_0x450251){return{'count':_0x450251['count'],'rows':_[_0x694e('0x2e')](_0x450251['rows'],function(_0x55217b){return{'membername':_0x55217b[_0x694e('0x2c')],'UserId':_0x55217b['id'],'queue_name':_0x813b94['name'],'FaxQueueId':_0x813b94['id'],'interface':util[_0x694e('0x60')]('%s/%s',_0x694e('0x61'),_0x55217b[_0x694e('0x2c')]),'penalty':0x0,'paused':_0x55217b['faxPause'],'createdAt':_0x55217b[_0x694e('0x5f')],'updatedAt':_0x55217b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x694e('0x26')](respondWithFilteredResult(_0x5a171c,_0x208973))[_0x694e('0x43')](handleError(_0x5a171c,null));};exports[_0x694e('0x62')]=function(_0x3860ce,_0x33e369,_0x51ea34){var _0x39faab={};var _0x1bd40c={};var _0x48cc11;var _0x2dcc27;return db['FaxQueue'][_0x694e('0x54')]({'where':{'id':_0x3860ce[_0x694e('0x45')]['id']}})[_0x694e('0x26')](handleEntityNotFound(_0x33e369,null))[_0x694e('0x26')](function(_0x575290){if(_0x575290){_0x48cc11=_0x575290;_0x1bd40c['model']=_[_0x694e('0x46')](db[_0x694e('0x63')][_0x694e('0x2f')]);_0x1bd40c[_0x694e('0x33')]=_['keys'](_0x3860ce[_0x694e('0x33')]);_0x1bd40c['filters']=_[_0x694e('0x35')](_0x1bd40c[_0x694e('0x32')],_0x1bd40c['query']);_0x39faab['attributes']=_[_0x694e('0x35')](_0x1bd40c['model'],qs['fields'](_0x3860ce[_0x694e('0x33')][_0x694e('0x37')]));_0x39faab[_0x694e('0x36')]=_0x39faab[_0x694e('0x36')]['length']?_0x39faab[_0x694e('0x36')]:_0x1bd40c[_0x694e('0x32')];_0x39faab[_0x694e('0x57')]=qs[_0x694e('0x3a')](_0x3860ce['query'][_0x694e('0x3a')]);_0x39faab[_0x694e('0x3b')]=qs[_0x694e('0x34')](_['pick'](_0x3860ce[_0x694e('0x33')],_0x1bd40c[_0x694e('0x34')]));if(_0x3860ce['query'][_0x694e('0x3d')]){_0x39faab['where']=_['merge'](_0x39faab[_0x694e('0x3b')],{'$or':_[_0x694e('0x2e')](_0x39faab[_0x694e('0x36')],function(_0x421278){var _0x3df96e={};_0x3df96e[_0x421278]={'$like':'%'+_0x3860ce[_0x694e('0x33')][_0x694e('0x3d')]+'%'};return _0x3df96e;})});}_0x39faab=_['merge']({},_0x39faab,_0x3860ce[_0x694e('0x3f')]);return _0x48cc11[_0x694e('0x62')](_0x39faab);}})[_0x694e('0x26')](function(_0x5e4260){if(_0x5e4260){_0x2dcc27=_0x5e4260[_0x694e('0x38')];if(!_0x3860ce[_0x694e('0x33')][_0x694e('0x56')]('nolimit')){_0x39faab[_0x694e('0x1f')]=qs['limit'](_0x3860ce[_0x694e('0x33')][_0x694e('0x1f')]);_0x39faab[_0x694e('0x1e')]=qs[_0x694e('0x1e')](_0x3860ce['query'][_0x694e('0x1e')]);}return _0x48cc11[_0x694e('0x62')](_0x39faab);}})[_0x694e('0x26')](function(_0x433916){if(_0x433916){return _0x433916?{'count':_0x2dcc27,'rows':_0x433916}:null;}})['then'](respondWithResult(_0x33e369,null))['catch'](handleError(_0x33e369,null));};exports[_0x694e('0x64')]=function(_0x34ee4c,_0x177b82,_0xcba0c5){var _0x4b057f=_0x34ee4c[_0x694e('0x4a')][_0x694e('0x65')];return db['Team'][_0x694e('0x59')]({'where':{'id':_0x4b057f},'attributes':['id'],'include':[{'model':db[_0x694e('0x5a')],'as':_0x694e('0x66'),'attributes':['id',_0x694e('0x2c'),'online','voicePause',_0x694e('0x67')],'raw':!![]}]})[_0x694e('0x26')](function(_0x53f2f8){if(_0x53f2f8){var _0x4bd7f9=_[_0x694e('0x68')](_0x53f2f8,function(_0x4be9bf){var _0x2ba3c0=_0x4be9bf[_0x694e('0x28')]({'plain':!![]});return _0x2ba3c0[_0x694e('0x66')];});return db[_0x694e('0x40')][_0x694e('0x48')]({'where':{'id':_0x34ee4c[_0x694e('0x45')]['id']}})[_0x694e('0x26')](function(_0x150f81){return db[_0x694e('0x69')][_0x694e('0x6a')](function(_0x593834){return _0x150f81['addTeams'](_0x4b057f,{'transaction':_0x593834})[_0x694e('0x26')](function(){return BPromise[_0x694e('0x6b')](_0x4bd7f9,function(_0x57bca2){return db[_0x694e('0x55')][_0x694e('0x6c')]({'where':{'UserId':_0x57bca2['id'],'FaxQueueId':_0x34ee4c['params']['id']},'transaction':_0x593834});});})[_0x694e('0x26')](function(){_0x4bd7f9['forEach'](function(_0x1486bf){socket[_0x694e('0x6d')](_0x694e('0x6e'),{'UserId':_0x1486bf['id'],'FaxQueueId':_0x150f81['id']});});});});});}})[_0x694e('0x26')](respondWithStatusCode(_0x177b82,null))['catch'](handleError(_0x177b82,null));};exports[_0x694e('0x6f')]=function(_0xb1967,_0x32a9ab,_0x183e52){return db[_0x694e('0x63')][_0x694e('0x59')]({'where':{'id':_0xb1967[_0x694e('0x33')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x32a9ab,null))[_0x694e('0x26')](function(_0x2211d8){var _0x5a5bc8=_[_0x694e('0x2e')](_0x2211d8,'id');var _0x40445a=[];var _0x2dc2e6=[];var _0x441225=squel['select']();_0x441225[_0x694e('0x70')](_0x694e('0x71'))[_0x694e('0x72')]('team_has_fax_queues','tq')[_0x694e('0x73')](_0x694e('0x74'),'ut',_0x694e('0x75'))[_0x694e('0x3b')](_0x694e('0x76'),_0xb1967[_0x694e('0x45')]['id']);for(var _0xe0907e=0x0;_0xe0907e<_0x2211d8[_0x694e('0x38')];_0xe0907e+=0x1){let _0x37740c=_0x2211d8[_0xe0907e];for(var _0x201ade=0x0;_0x201ade<_0x37740c['Agents'][_0x694e('0x38')];_0x201ade+=0x1){let _0x6c82ba=_0x37740c[_0x694e('0x66')][_0x201ade];var _0x153a37=_0x441225[_0x694e('0x77')]();_0x153a37[_0x694e('0x3b')](_0x694e('0x78'),_0x6c82ba['id']);_0x2dc2e6[_0x694e('0x79')](db[_0x694e('0x69')]['query'](_0x153a37[_0x694e('0x7a')](),{'type':db[_0x694e('0x69')][_0x694e('0x7b')][_0x694e('0x7c')]})[_0x694e('0x26')](function(_0x31d7bd){if(_0x31d7bd[_0x694e('0x38')]===0x1){return _0x6c82ba['id'];}else{var _0x54bff3=_[_0x694e('0x7d')](_[_0x694e('0x2e')](_0x31d7bd,_0x694e('0x7e')),function(_0x1664d1){return _[_0x694e('0x7f')](_0x5a5bc8,_0x1664d1);});if(_0x54bff3){return _0x6c82ba['id'];}}}));}}return BPromise['all'](_0x2dc2e6)[_0x694e('0x26')](function(_0x5ddad0){_0x40445a=_(_0x40445a)[_0x694e('0x80')](_0x5ddad0)['compact']()[_0x694e('0x81')]();return db[_0x694e('0x40')]['find']({'where':{'id':_0xb1967[_0x694e('0x45')]['id']}})[_0x694e('0x26')](function(_0x59dc4f){return db[_0x694e('0x69')]['transaction'](function(_0x2e8b0c){return _0x59dc4f[_0x694e('0x6f')](_0xb1967['query'][_0x694e('0x65')],{'transaction':_0x2e8b0c})[_0x694e('0x26')](function(){if(!_[_0x694e('0x82')](_0x40445a)){return _0x59dc4f[_0x694e('0x83')](_0x40445a,{'transaction':_0x2e8b0c});}})[_0x694e('0x26')](function(){_0x40445a[_0x694e('0x84')](function(_0x2beed6){socket[_0x694e('0x6d')]('userFaxQueue:remove',{'UserId':_0x2beed6,'FaxQueueId':_0x59dc4f['id']});});});});});});})[_0x694e('0x26')](respondWithStatusCode(_0x32a9ab,null))[_0x694e('0x43')](handleError(_0x32a9ab,null));};exports[_0x694e('0x85')]=function(_0x38a612,_0x4ad6eb,_0x583314){return db['FaxQueue'][_0x694e('0x48')]({'where':{'id':_0x38a612['params']['id']}})[_0x694e('0x26')](handleEntityNotFound(_0x4ad6eb,null))[_0x694e('0x26')](function(_0xf62807){if(_0xf62807){return _0xf62807[_0x694e('0x85')](_0x38a612[_0x694e('0x4a')]['ids'],_[_0x694e('0x86')](_0x38a612['body'],[_0x694e('0x65'),'id'])||{})[_0x694e('0x87')](function(_0x358522){for(var _0x4fb674=0x0;_0x4fb674<_0x38a612[_0x694e('0x4a')]['ids'][_0x694e('0x38')];_0x4fb674+=0x1){socket[_0x694e('0x6d')](_0x694e('0x6e'),{'UserId':_0x38a612[_0x694e('0x4a')][_0x694e('0x65')][_0x4fb674],'FaxQueueId':_0x38a612[_0x694e('0x45')]['id']});}return _0x358522;});}})[_0x694e('0x26')](respondWithResult(_0x4ad6eb,null))[_0x694e('0x43')](handleError(_0x4ad6eb,null));};exports[_0x694e('0x83')]=function(_0x569495,_0x10ebab,_0x49070c){return db['FaxQueue'][_0x694e('0x48')]({'where':{'id':_0x569495[_0x694e('0x45')]['id']}})['then'](handleEntityNotFound(_0x10ebab,null))['then'](function(_0x543477){if(_0x543477){return _0x543477['removeAgents'](_0x569495[_0x694e('0x33')][_0x694e('0x65')])[_0x694e('0x26')](function(){if(_[_0x694e('0x88')](_0x569495[_0x694e('0x33')][_0x694e('0x65')])){for(var _0x347c1a=0x0;_0x347c1a<_0x569495['query'][_0x694e('0x65')][_0x694e('0x38')];_0x347c1a+=0x1){socket[_0x694e('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x569495[_0x694e('0x33')][_0x694e('0x65')][_0x347c1a]),'FaxQueueId':Number(_0x569495[_0x694e('0x45')]['id'])});}}else{socket['emit'](_0x694e('0x89'),{'UserId':Number(_0x569495[_0x694e('0x33')][_0x694e('0x65')]),'FaxQueueId':Number(_0x569495['params']['id'])});}});}})[_0x694e('0x26')](respondWithStatusCode(_0x10ebab,null))[_0x694e('0x43')](handleError(_0x10ebab,null));};exports[_0x694e('0x8a')]=function(_0x14fefb,_0x656be2,_0x39c0ac){var _0x51c4e9={};var _0x1d6ada={};var _0x16a38a;var _0x29cdd9;return db[_0x694e('0x40')][_0x694e('0x54')]({'where':{'id':_0x14fefb['params']['id']}})[_0x694e('0x26')](handleEntityNotFound(_0x656be2,null))[_0x694e('0x26')](function(_0x256898){if(_0x256898){_0x16a38a=_0x256898;_0x1d6ada[_0x694e('0x32')]=_[_0x694e('0x46')](db['User'][_0x694e('0x2f')]);_0x1d6ada[_0x694e('0x33')]=_[_0x694e('0x46')](_0x14fefb['query']);_0x1d6ada[_0x694e('0x34')]=_[_0x694e('0x35')](_0x1d6ada[_0x694e('0x32')],_0x1d6ada['query']);_0x51c4e9['attributes']=_[_0x694e('0x35')](_0x1d6ada[_0x694e('0x32')],qs['fields'](_0x14fefb[_0x694e('0x33')][_0x694e('0x37')]));_0x51c4e9[_0x694e('0x36')]=_0x51c4e9[_0x694e('0x36')][_0x694e('0x38')]?_0x51c4e9[_0x694e('0x36')]:_0x1d6ada['model'];_0x51c4e9[_0x694e('0x57')]=qs[_0x694e('0x3a')](_0x14fefb['query'][_0x694e('0x3a')]);_0x51c4e9[_0x694e('0x3b')]=qs[_0x694e('0x34')](_[_0x694e('0x3c')](_0x14fefb[_0x694e('0x33')],_0x1d6ada['filters']));if(_0x14fefb[_0x694e('0x33')]['filter']){_0x51c4e9[_0x694e('0x3b')]=_[_0x694e('0x3e')](_0x51c4e9[_0x694e('0x3b')],{'$or':_[_0x694e('0x2e')](_0x51c4e9[_0x694e('0x36')],function(_0x582aaa){var _0xd036aa={};_0xd036aa[_0x582aaa]={'$like':'%'+_0x14fefb[_0x694e('0x33')][_0x694e('0x3d')]+'%'};return _0xd036aa;})});}_0x51c4e9=_[_0x694e('0x3e')]({},_0x51c4e9,_0x14fefb[_0x694e('0x3f')]);return _0x16a38a['getAgents'](_0x51c4e9);}})[_0x694e('0x26')](function(_0x5b096a){if(_0x5b096a){_0x29cdd9=_0x5b096a[_0x694e('0x38')];if(!_0x14fefb['query'][_0x694e('0x56')](_0x694e('0x39'))){_0x51c4e9[_0x694e('0x1f')]=qs[_0x694e('0x1f')](_0x14fefb['query'][_0x694e('0x1f')]);_0x51c4e9[_0x694e('0x1e')]=qs[_0x694e('0x1e')](_0x14fefb[_0x694e('0x33')]['offset']);}return _0x16a38a[_0x694e('0x8a')](_0x51c4e9);}})[_0x694e('0x26')](function(_0x416948){if(_0x416948){return _0x416948?{'count':_0x29cdd9,'rows':_0x416948}:null;}})[_0x694e('0x26')](respondWithResult(_0x656be2,null))[_0x694e('0x43')](handleError(_0x656be2,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a12fa6a..85ea584 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 _0xe2f9=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit'];(function(_0xbb58c2,_0x56bfb7){var _0x3db3c3=function(_0x3e4c71){while(--_0x3e4c71){_0xbb58c2['push'](_0xbb58c2['shift']());}};_0x3db3c3(++_0x56bfb7);}(_0xe2f9,0x1ed));var _0x9e2f=function(_0x32f0ab,_0x1b4009){_0x32f0ab=_0x32f0ab-0x0;var _0x32a53e=_0xe2f9[_0x32f0ab];return _0x32a53e;};'use strict';var EventEmitter=require(_0x9e2f('0x0'));var FaxQueue=require(_0x9e2f('0x1'))['db'][_0x9e2f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9e2f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e2f('0x4'),'afterDestroy':_0x9e2f('0x5')};function emitEvent(_0x1ca494){return function(_0xc68352,_0x55e4df,_0x1fcf76){FaxQueueEvents[_0x9e2f('0x6')](_0x1ca494+':'+_0xc68352['id'],_0xc68352);FaxQueueEvents['emit'](_0x1ca494,_0xc68352);_0x1fcf76(null);};}for(var e in events){if(events[_0x9e2f('0x7')](e)){var event=events[e];FaxQueue[_0x9e2f('0x8')](e,emitEvent(event));}}module[_0x9e2f('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x4dd8=['hook','exports','events','save','update','remove','emit'];(function(_0x13b5d6,_0x1fd375){var _0x7d090f=function(_0x94c1d5){while(--_0x94c1d5){_0x13b5d6['push'](_0x13b5d6['shift']());}};_0x7d090f(++_0x1fd375);}(_0x4dd8,0xcd));var _0x84dd=function(_0x1a09b3,_0x392cb3){_0x1a09b3=_0x1a09b3-0x0;var _0x506cff=_0x4dd8[_0x1a09b3];return _0x506cff;};'use strict';var EventEmitter=require(_0x84dd('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x84dd('0x1'),'afterUpdate':_0x84dd('0x2'),'afterDestroy':_0x84dd('0x3')};function emitEvent(_0x56497b){return function(_0xe734a0,_0x4fc7ad,_0x122437){FaxQueueEvents[_0x84dd('0x4')](_0x56497b+':'+_0xe734a0['id'],_0xe734a0);FaxQueueEvents[_0x84dd('0x4')](_0x56497b,_0xe734a0);_0x122437(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x84dd('0x5')](e,emitEvent(event));}}module[_0x84dd('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 8cb4e45..0fe0462 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 _0xb699=['exports','define','FaxQueue','fax_queues','lodash','api','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x21dd98,_0x52877c){var _0x45799a=function(_0x574afb){while(--_0x574afb){_0x21dd98['push'](_0x21dd98['shift']());}};_0x45799a(++_0x52877c);}(_0xb699,0x101));var _0x9b69=function(_0x3947e5,_0x3cf8ce){_0x3947e5=_0x3947e5-0x0;var _0x3e64c1=_0xb699[_0x3947e5];return _0x3e64c1;};'use strict';var _=require(_0x9b69('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9b69('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9b69('0x2'));var fs=require('fs');var path=require(_0x9b69('0x3'));var rimraf=require(_0x9b69('0x4'));var config=require(_0x9b69('0x5'));var attributes=require(_0x9b69('0x6'));module[_0x9b69('0x7')]=function(_0x2809ee,_0x3c1083){return _0x2809ee[_0x9b69('0x8')](_0x9b69('0x9'),attributes,{'tableName':_0x9b69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbdc=['request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','../../config/logger','api','moment','bluebird'];(function(_0xd00c2c,_0x1be383){var _0x44c046=function(_0x2a37ce){while(--_0x2a37ce){_0xd00c2c['push'](_0xd00c2c['shift']());}};_0x44c046(++_0x1be383);}(_0xcbdc,0x1e8));var _0xccbd=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcbdc[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xccbd('0x0'))(_0xccbd('0x1'));var moment=require(_0xccbd('0x2'));var BPromise=require(_0xccbd('0x3'));var rp=require(_0xccbd('0x4'));var fs=require('fs');var path=require(_0xccbd('0x5'));var rimraf=require('rimraf');var config=require(_0xccbd('0x6'));var attributes=require(_0xccbd('0x7'));module[_0xccbd('0x8')]=function(_0x3c0212,_0x25d73a){return _0x3c0212[_0xccbd('0x9')](_0xccbd('0xa'),attributes,{'tableName':_0xccbd('0xb'),'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 4744668..c319937 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 _0x8ca3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','include','map','model','ShowFaxQueue','moment'];(function(_0xb1c2ef,_0x146cda){var _0x9f520=function(_0x3a7386){while(--_0x3a7386){_0xb1c2ef['push'](_0xb1c2ef['shift']());}};_0x9f520(++_0x146cda);}(_0x8ca3,0x1b7));var _0x38ca=function(_0x47dcb1,_0x2e7067){_0x47dcb1=_0x47dcb1-0x0;var _0x532b9f=_0x8ca3[_0x47dcb1];return _0x532b9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38ca('0x0'));var BPromise=require(_0x38ca('0x1'));var rs=require(_0x38ca('0x2'));var fs=require('fs');var Redis=require(_0x38ca('0x3'));var db=require(_0x38ca('0x4'))['db'];var utils=require(_0x38ca('0x5'));var logger=require(_0x38ca('0x6'))(_0x38ca('0x7'));var config=require(_0x38ca('0x8'));var jayson=require(_0x38ca('0x9'));var client=jayson[_0x38ca('0xa')][_0x38ca('0xb')]({'port':0x232a});config[_0x38ca('0xc')]=_[_0x38ca('0xd')](config[_0x38ca('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x38ca('0xe'))(new Redis(config[_0x38ca('0xc')]));require(_0x38ca('0xf'))[_0x38ca('0x10')](socket);function respondWithRpcPromise(_0x3a033a,_0x457dc2,_0x234539){return new BPromise(function(_0xd99985,_0x49a7c2){return client[_0x38ca('0x11')](_0x3a033a,_0x234539)[_0x38ca('0x12')](function(_0x11db54){logger['info'](_0x38ca('0x13'),_0x457dc2,_0x38ca('0x14'));logger[_0x38ca('0x15')](_0x38ca('0x16'),_0x457dc2,_0x38ca('0x14'),JSON[_0x38ca('0x17')](_0x11db54));if(_0x11db54[_0x38ca('0x18')]){if(_0x11db54['error'][_0x38ca('0x19')]===0x1f4){logger[_0x38ca('0x18')](_0x38ca('0x13'),_0x457dc2,_0x11db54[_0x38ca('0x18')][_0x38ca('0x1a')]);return _0x49a7c2(_0x11db54[_0x38ca('0x18')][_0x38ca('0x1a')]);}logger[_0x38ca('0x18')](_0x38ca('0x13'),_0x457dc2,_0x11db54[_0x38ca('0x18')]['message']);return _0xd99985(_0x11db54[_0x38ca('0x18')][_0x38ca('0x1a')]);}else{logger[_0x38ca('0x1b')](_0x38ca('0x13'),_0x457dc2,_0x38ca('0x14'));_0xd99985(_0x11db54[_0x38ca('0x1c')][_0x38ca('0x1a')]);}})[_0x38ca('0x1d')](function(_0x346c4a){logger[_0x38ca('0x18')](_0x38ca('0x13'),_0x457dc2,_0x346c4a);_0x49a7c2(_0x346c4a);});});}exports[_0x38ca('0x1e')]=function(_0x10efbb){var _0x28db93=this;return new Promise(function(_0x5e9179,_0x2c29b5){return db[_0x38ca('0x1f')][_0x38ca('0x20')]({'raw':_0x10efbb[_0x38ca('0x21')]?_0x10efbb[_0x38ca('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x10efbb[_0x38ca('0x21')]?_0x10efbb['options'][_0x38ca('0x22')]||null:null,'attributes':_0x10efbb[_0x38ca('0x21')]?_0x10efbb['options'][_0x38ca('0x23')]||null:null,'limit':_0x10efbb[_0x38ca('0x21')]?_0x10efbb['options']['limit']||null:null,'include':_0x10efbb[_0x38ca('0x21')]?_0x10efbb[_0x38ca('0x21')][_0x38ca('0x24')]?_[_0x38ca('0x25')](_0x10efbb[_0x38ca('0x21')]['include'],function(_0xb2525c){return{'model':db[_0xb2525c[_0x38ca('0x26')]],'as':_0xb2525c['as'],'attributes':_0xb2525c[_0x38ca('0x23')],'include':_0xb2525c[_0x38ca('0x24')]?_[_0x38ca('0x25')](_0xb2525c[_0x38ca('0x24')],function(_0x4161fe){return{'model':db[_0x4161fe[_0x38ca('0x26')]],'as':_0x4161fe['as'],'attributes':_0x4161fe['attributes'],'include':_0x4161fe[_0x38ca('0x24')]?_[_0x38ca('0x25')](_0x4161fe[_0x38ca('0x24')],function(_0x57f2dc){return{'model':db[_0x57f2dc['model']],'as':_0x57f2dc['as'],'attributes':_0x57f2dc[_0x38ca('0x23')]};}):[]};}):[]};}):[]:[]})[_0x38ca('0x12')](function(_0x4a37a2){logger[_0x38ca('0x1b')](_0x38ca('0x1e'),_0x10efbb);logger[_0x38ca('0x15')](_0x38ca('0x1e'),_0x10efbb,JSON[_0x38ca('0x17')](_0x4a37a2));_0x5e9179(_0x4a37a2);})[_0x38ca('0x1d')](function(_0xf1d604){logger['error'](_0x38ca('0x1e'),_0xf1d604[_0x38ca('0x1a')],_0x10efbb);_0x2c29b5(_0x28db93[_0x38ca('0x18')](0x1f4,_0xf1d604[_0x38ca('0x1a')]));});});};exports[_0x38ca('0x27')]=function(_0x5561be){var _0x592597=this;return new Promise(function(_0x4f7366,_0x4c7ff2){return db['FaxQueue']['find']({'raw':_0x5561be['options']?_0x5561be[_0x38ca('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x5561be[_0x38ca('0x21')]?_0x5561be[_0x38ca('0x21')]['where']||null:null,'attributes':_0x5561be[_0x38ca('0x21')]?_0x5561be[_0x38ca('0x21')][_0x38ca('0x23')]||null:null,'include':_0x5561be[_0x38ca('0x21')]?_0x5561be[_0x38ca('0x21')][_0x38ca('0x24')]?_['map'](_0x5561be[_0x38ca('0x21')][_0x38ca('0x24')],function(_0x4a097a){return{'model':db[_0x4a097a[_0x38ca('0x26')]],'as':_0x4a097a['as'],'attributes':_0x4a097a[_0x38ca('0x23')],'include':_0x4a097a[_0x38ca('0x24')]?_[_0x38ca('0x25')](_0x4a097a[_0x38ca('0x24')],function(_0x270d70){return{'model':db[_0x270d70[_0x38ca('0x26')]],'as':_0x270d70['as'],'attributes':_0x270d70['attributes'],'include':_0x270d70['include']?_[_0x38ca('0x25')](_0x270d70[_0x38ca('0x24')],function(_0x34bb9b){return{'model':db[_0x34bb9b[_0x38ca('0x26')]],'as':_0x34bb9b['as'],'attributes':_0x34bb9b[_0x38ca('0x23')]};}):[]};}):[]};}):[]:[]})[_0x38ca('0x12')](function(_0x353562){logger[_0x38ca('0x1b')]('ShowFaxQueue',_0x5561be);logger[_0x38ca('0x15')](_0x38ca('0x27'),_0x5561be,JSON[_0x38ca('0x17')](_0x353562));_0x4f7366(_0x353562);})['catch'](function(_0x2ae7b3){logger[_0x38ca('0x18')]('ShowFaxQueue',_0x2ae7b3[_0x38ca('0x1a')],_0x5561be);_0x4c7ff2(_0x592597[_0x38ca('0x18')](0x1f4,_0x2ae7b3['message']));});});}; \ No newline at end of file +var _0xec27=['info','result','catch','FaxQueue','findAll','options','raw','attributes','limit','include','model','map','GetFaxQueue','ShowFaxQueue','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xec27,0x1b4));var _0x7ec2=function(_0x58d188,_0xa06a1f){_0x58d188=_0x58d188-0x0;var _0x1fc4a6=_0xec27[_0x58d188];return _0x1fc4a6;};'use strict';var _=require(_0x7ec2('0x0'));var util=require(_0x7ec2('0x1'));var moment=require('moment');var BPromise=require(_0x7ec2('0x2'));var rs=require(_0x7ec2('0x3'));var fs=require('fs');var Redis=require(_0x7ec2('0x4'));var db=require(_0x7ec2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7ec2('0x6'))(_0x7ec2('0x7'));var config=require(_0x7ec2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7ec2('0x9')][_0x7ec2('0xa')]({'port':0x232a});config[_0x7ec2('0xb')]=_[_0x7ec2('0xc')](config[_0x7ec2('0xb')],{'host':_0x7ec2('0xd'),'port':0x18eb});var socket=require(_0x7ec2('0xe'))(new Redis(config[_0x7ec2('0xb')]));require(_0x7ec2('0xf'))[_0x7ec2('0x10')](socket);function respondWithRpcPromise(_0x438067,_0x50f949,_0x255e7a){return new BPromise(function(_0x172f55,_0x4b5b87){return client[_0x7ec2('0x11')](_0x438067,_0x255e7a)[_0x7ec2('0x12')](function(_0x549a0f){logger['info'](_0x7ec2('0x13'),_0x50f949,_0x7ec2('0x14'));logger[_0x7ec2('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x50f949,'request\x20sent',JSON[_0x7ec2('0x16')](_0x549a0f));if(_0x549a0f[_0x7ec2('0x17')]){if(_0x549a0f[_0x7ec2('0x17')][_0x7ec2('0x18')]===0x1f4){logger[_0x7ec2('0x17')](_0x7ec2('0x13'),_0x50f949,_0x549a0f[_0x7ec2('0x17')][_0x7ec2('0x19')]);return _0x4b5b87(_0x549a0f[_0x7ec2('0x17')][_0x7ec2('0x19')]);}logger[_0x7ec2('0x17')](_0x7ec2('0x13'),_0x50f949,_0x549a0f[_0x7ec2('0x17')][_0x7ec2('0x19')]);return _0x172f55(_0x549a0f[_0x7ec2('0x17')][_0x7ec2('0x19')]);}else{logger[_0x7ec2('0x1a')]('FaxQueue,\x20%s,\x20%s',_0x50f949,_0x7ec2('0x14'));_0x172f55(_0x549a0f[_0x7ec2('0x1b')][_0x7ec2('0x19')]);}})[_0x7ec2('0x1c')](function(_0x25dd71){logger['error'](_0x7ec2('0x13'),_0x50f949,_0x25dd71);_0x4b5b87(_0x25dd71);});});}exports['GetFaxQueue']=function(_0x33ea27){var _0xfa6d1a=this;return new Promise(function(_0x501349,_0x5be486){return db[_0x7ec2('0x1d')][_0x7ec2('0x1e')]({'raw':_0x33ea27['options']?_0x33ea27[_0x7ec2('0x1f')][_0x7ec2('0x20')]===undefined?!![]:![]:!![],'where':_0x33ea27[_0x7ec2('0x1f')]?_0x33ea27['options']['where']||null:null,'attributes':_0x33ea27[_0x7ec2('0x1f')]?_0x33ea27[_0x7ec2('0x1f')][_0x7ec2('0x21')]||null:null,'limit':_0x33ea27[_0x7ec2('0x1f')]?_0x33ea27[_0x7ec2('0x1f')][_0x7ec2('0x22')]||null:null,'include':_0x33ea27[_0x7ec2('0x1f')]?_0x33ea27[_0x7ec2('0x1f')][_0x7ec2('0x23')]?_['map'](_0x33ea27[_0x7ec2('0x1f')][_0x7ec2('0x23')],function(_0x8ccdd2){return{'model':db[_0x8ccdd2[_0x7ec2('0x24')]],'as':_0x8ccdd2['as'],'attributes':_0x8ccdd2['attributes'],'include':_0x8ccdd2[_0x7ec2('0x23')]?_[_0x7ec2('0x25')](_0x8ccdd2['include'],function(_0x1a26ab){return{'model':db[_0x1a26ab[_0x7ec2('0x24')]],'as':_0x1a26ab['as'],'attributes':_0x1a26ab[_0x7ec2('0x21')],'include':_0x1a26ab['include']?_[_0x7ec2('0x25')](_0x1a26ab['include'],function(_0x244434){return{'model':db[_0x244434[_0x7ec2('0x24')]],'as':_0x244434['as'],'attributes':_0x244434[_0x7ec2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7ec2('0x12')](function(_0x14bf5e){logger[_0x7ec2('0x1a')](_0x7ec2('0x26'),_0x33ea27);logger[_0x7ec2('0x15')](_0x7ec2('0x26'),_0x33ea27,JSON[_0x7ec2('0x16')](_0x14bf5e));_0x501349(_0x14bf5e);})[_0x7ec2('0x1c')](function(_0x38af37){logger[_0x7ec2('0x17')](_0x7ec2('0x26'),_0x38af37[_0x7ec2('0x19')],_0x33ea27);_0x5be486(_0xfa6d1a['error'](0x1f4,_0x38af37['message']));});});};exports[_0x7ec2('0x27')]=function(_0x227d34){var _0x4745ab=this;return new Promise(function(_0xfba3fe,_0x558d4a){return db[_0x7ec2('0x1d')][_0x7ec2('0x28')]({'raw':_0x227d34[_0x7ec2('0x1f')]?_0x227d34[_0x7ec2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x227d34[_0x7ec2('0x1f')]?_0x227d34[_0x7ec2('0x1f')][_0x7ec2('0x29')]||null:null,'attributes':_0x227d34[_0x7ec2('0x1f')]?_0x227d34[_0x7ec2('0x1f')][_0x7ec2('0x21')]||null:null,'include':_0x227d34[_0x7ec2('0x1f')]?_0x227d34[_0x7ec2('0x1f')][_0x7ec2('0x23')]?_[_0x7ec2('0x25')](_0x227d34['options'][_0x7ec2('0x23')],function(_0x5c186c){return{'model':db[_0x5c186c[_0x7ec2('0x24')]],'as':_0x5c186c['as'],'attributes':_0x5c186c[_0x7ec2('0x21')],'include':_0x5c186c[_0x7ec2('0x23')]?_['map'](_0x5c186c[_0x7ec2('0x23')],function(_0x33dec){return{'model':db[_0x33dec[_0x7ec2('0x24')]],'as':_0x33dec['as'],'attributes':_0x33dec['attributes'],'include':_0x33dec[_0x7ec2('0x23')]?_[_0x7ec2('0x25')](_0x33dec[_0x7ec2('0x23')],function(_0x7e9b44){return{'model':db[_0x7e9b44[_0x7ec2('0x24')]],'as':_0x7e9b44['as'],'attributes':_0x7e9b44['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ec2('0x12')](function(_0x2727ec){logger[_0x7ec2('0x1a')](_0x7ec2('0x27'),_0x227d34);logger[_0x7ec2('0x15')](_0x7ec2('0x27'),_0x227d34,JSON[_0x7ec2('0x16')](_0x2727ec));_0xfba3fe(_0x2727ec);})['catch'](function(_0x56a5cf){logger[_0x7ec2('0x17')](_0x7ec2('0x27'),_0x56a5cf[_0x7ec2('0x19')],_0x227d34);_0x558d4a(_0x4745ab['error'](0x1f4,_0x56a5cf[_0x7ec2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 87d2947..2209086 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 _0xfdf6=['removeListener','register','./faxQueue.events','save','update','emit'];(function(_0x3fbc6a,_0x1f1133){var _0x524a7c=function(_0x5d25c8){while(--_0x5d25c8){_0x3fbc6a['push'](_0x3fbc6a['shift']());}};_0x524a7c(++_0x1f1133);}(_0xfdf6,0xfe));var _0x6fdf=function(_0x2f2f70,_0x4d0a75){_0x2f2f70=_0x2f2f70-0x0;var _0x4c1c88=_0xfdf6[_0x2f2f70];return _0x4c1c88;};'use strict';var FaxQueueEvents=require(_0x6fdf('0x0'));var events=[_0x6fdf('0x1'),'remove',_0x6fdf('0x2')];function createListener(_0x17114f,_0x1e9442){return function(_0x3a5631){_0x1e9442[_0x6fdf('0x3')](_0x17114f,_0x3a5631);};}function removeListener(_0x2ebb1f,_0x501102){return function(){FaxQueueEvents[_0x6fdf('0x4')](_0x2ebb1f,_0x501102);};}exports[_0x6fdf('0x5')]=function(_0x25bbb3){for(var _0x3c180a=0x0,_0x54b9a9=events['length'];_0x3c180a<_0x54b9a9;_0x3c180a++){var _0x2d7c50=events[_0x3c180a];var _0xc36829=createListener('faxQueue:'+_0x2d7c50,_0x25bbb3);FaxQueueEvents['on'](_0x2d7c50,_0xc36829);}}; \ No newline at end of file +var _0x9e82=['faxQueue:','./faxQueue.events','save','remove'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x9e82,0x119));var _0x29e8=function(_0x2a134d,_0x4cb9d2){_0x2a134d=_0x2a134d-0x0;var _0x82053e=_0x9e82[_0x2a134d];return _0x82053e;};'use strict';var FaxQueueEvents=require(_0x29e8('0x0'));var events=[_0x29e8('0x1'),_0x29e8('0x2'),'update'];function createListener(_0x4b4694,_0xa38ba8){return function(_0xdb70fe){_0xa38ba8['emit'](_0x4b4694,_0xdb70fe);};}function removeListener(_0x217d27,_0x564af7){return function(){FaxQueueEvents['removeListener'](_0x217d27,_0x564af7);};}exports['register']=function(_0x884b3c){for(var _0x431480=0x0,_0x5883fc=events['length'];_0x431480<_0x5883fc;_0x431480++){var _0xc8aebc=events[_0x431480];var _0x3ad15c=createListener(_0x29e8('0x3')+_0xc8aebc,_0x884b3c);FaxQueueEvents['on'](_0xc8aebc,_0x3ad15c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1dba6c6..0441020 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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x2b76dc,_0x3ddb93){var _0x4ee7eb=function(_0x199bcd){while(--_0x199bcd){_0x2b76dc['push'](_0x2b76dc['shift']());}};_0x4ee7eb(++_0x3ddb93);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +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(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xb10b,0x12a));var _0xbb10=function(_0xc29e65,_0x7f1e9e){_0xc29e65=_0xc29e65-0x0;var _0x36240d=_0xb10b[_0xc29e65];return _0x36240d;};'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 212020c..71587d4 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 _0x8c93=['exports','STRING','DATE','sequelize'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x8c93,0x6b));var _0x38c9=function(_0x332dca,_0x2f5ce5){_0x332dca=_0x332dca-0x0;var _0x40fcae=_0x8c93[_0x332dca];return _0x40fcae;};'use strict';var moment=require('moment');var Sequelize=require(_0x38c9('0x0'));module[_0x38c9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x38c9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x38c9('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x38c9('0x3')]},'reason':{'type':Sequelize[_0x38c9('0x2')]}}; \ No newline at end of file +var _0x70d9=['moment','sequelize','exports','STRING','DATE'];(function(_0x42b13c,_0x55b4e7){var _0x39a0d=function(_0x352ce7){while(--_0x352ce7){_0x42b13c['push'](_0x42b13c['shift']());}};_0x39a0d(++_0x55b4e7);}(_0x70d9,0x13b));var _0x970d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x70d9[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x970d('0x0'));var Sequelize=require(_0x970d('0x1'));module[_0x970d('0x2')]={'uniqueid':{'type':Sequelize[_0x970d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x970d('0x3')]},'joinAt':{'type':Sequelize[_0x970d('0x4')]},'leaveAt':{'type':Sequelize[_0x970d('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x970d('0x4')]},'reason':{'type':Sequelize[_0x970d('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e8b520e..fe18fc5 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 _0x3b78=['rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueueReport','rows','show','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','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','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b78,0xb4));var _0x83b7=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0x3b78[_0x1e5068];return _0x2230b6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x83b7('0x0'));var rimraf=require(_0x83b7('0x1'));var zipdir=require(_0x83b7('0x2'));var jsonpatch=require(_0x83b7('0x3'));var rp=require(_0x83b7('0x4'));var moment=require('moment');var BPromise=require(_0x83b7('0x5'));var Mustache=require(_0x83b7('0x6'));var util=require('util');var path=require(_0x83b7('0x7'));var sox=require(_0x83b7('0x8'));var csv=require('to-csv');var ejs=require(_0x83b7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x83b7('0xa'));var crypto=require(_0x83b7('0xb'));var jsforce=require(_0x83b7('0xc'));var deskjs=require(_0x83b7('0xd'));var toCsv=require(_0x83b7('0xe'));var querystring=require(_0x83b7('0xf'));var Papa=require('papaparse');var Redis=require(_0x83b7('0x10'));var authService=require(_0x83b7('0x11'));var qs=require(_0x83b7('0x12'));var as=require(_0x83b7('0x13'));var hardwareService=require(_0x83b7('0x14'));var logger=require(_0x83b7('0x15'))(_0x83b7('0x16'));var utils=require(_0x83b7('0x17'));var config=require(_0x83b7('0x18'));var db=require(_0x83b7('0x19'))['db'];function respondWithStatusCode(_0x39ddb4,_0x12c91e){_0x12c91e=_0x12c91e||0xcc;return function(_0x488f18){if(_0x488f18){return _0x39ddb4[_0x83b7('0x1a')](_0x12c91e);}return _0x39ddb4['status'](_0x12c91e)[_0x83b7('0x1b')]();};}function respondWithResult(_0x13f5e5,_0x1aa694){_0x1aa694=_0x1aa694||0xc8;return function(_0x2afe83){if(_0x2afe83){return _0x13f5e5[_0x83b7('0x1c')](_0x1aa694)['json'](_0x2afe83);}};}function respondWithFilteredResult(_0x357a7a,_0x4852e1){return function(_0x412450){if(_0x412450){var _0x4eade7=_0x412450[_0x83b7('0x1d')],_0x4ae525=_0x4852e1[_0x83b7('0x1e')],_0x9595e4=_0x4852e1[_0x83b7('0x1e')]+_0x4852e1[_0x83b7('0x1f')],_0x3af149;if(_0x9595e4>=_0x4eade7){_0x9595e4=_0x4eade7;_0x3af149=0xc8;}else{_0x3af149=0xce;}_0x357a7a[_0x83b7('0x1c')](_0x3af149);return _0x357a7a[_0x83b7('0x20')](_0x83b7('0x21'),_0x4ae525+'-'+_0x9595e4+'/'+_0x4eade7)['json'](_0x412450);}return null;};}function patchUpdates(_0x5620f7){return function(_0xf9df09){try{jsonpatch[_0x83b7('0x22')](_0xf9df09,_0x5620f7,!![]);}catch(_0x4a23ac){return BPromise[_0x83b7('0x23')](_0x4a23ac);}return _0xf9df09['save']();};}function saveUpdates(_0x384fde,_0x5e0557){return function(_0x1ddcce){if(_0x1ddcce){return _0x1ddcce[_0x83b7('0x24')](_0x384fde)[_0x83b7('0x25')](function(_0x410b83){return _0x410b83;});}return null;};}function removeEntity(_0x4439c8,_0x332944){return function(_0x397a23){if(_0x397a23){return _0x397a23['destroy']()[_0x83b7('0x25')](function(){_0x4439c8[_0x83b7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f37a9,_0x4453b5){return function(_0x44a853){if(!_0x44a853){_0x1f37a9['sendStatus'](0x194);}return _0x44a853;};}function handleError(_0x312bbd,_0x79d732){_0x79d732=_0x79d732||0x1f4;return function(_0xa94d25){logger[_0x83b7('0x26')](_0xa94d25[_0x83b7('0x27')]);if(_0xa94d25[_0x83b7('0x28')]){delete _0xa94d25['name'];}_0x312bbd[_0x83b7('0x1c')](_0x79d732)['send'](_0xa94d25);};}exports['index']=function(_0x2ac00f,_0x238f53){var _0x46f0b0={},_0x37f8ab={},_0x4615cc={'count':0x0,'rows':[]};var _0x48c088=_[_0x83b7('0x29')](db['FaxQueueReport'][_0x83b7('0x2a')],function(_0x5bbfe6){return{'name':_0x5bbfe6['fieldName'],'type':_0x5bbfe6[_0x83b7('0x2b')][_0x83b7('0x2c')]};});_0x37f8ab[_0x83b7('0x2d')]=_[_0x83b7('0x29')](_0x48c088,_0x83b7('0x28'));_0x37f8ab['query']=_[_0x83b7('0x2e')](_0x2ac00f[_0x83b7('0x2f')]);_0x37f8ab[_0x83b7('0x30')]=_[_0x83b7('0x31')](_0x37f8ab[_0x83b7('0x2d')],_0x37f8ab[_0x83b7('0x2f')]);_0x46f0b0[_0x83b7('0x32')]=_[_0x83b7('0x31')](_0x37f8ab[_0x83b7('0x2d')],qs[_0x83b7('0x33')](_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x33')]));_0x46f0b0['attributes']=_0x46f0b0[_0x83b7('0x32')][_0x83b7('0x34')]?_0x46f0b0[_0x83b7('0x32')]:_0x37f8ab[_0x83b7('0x2d')];if(!_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x35')](_0x83b7('0x36'))){_0x46f0b0[_0x83b7('0x1f')]=qs[_0x83b7('0x1f')](_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x1f')]);_0x46f0b0['offset']=qs[_0x83b7('0x1e')](_0x2ac00f[_0x83b7('0x2f')]['offset']);}_0x46f0b0[_0x83b7('0x37')]=qs['sort'](_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x38')]);_0x46f0b0[_0x83b7('0x39')]=qs[_0x83b7('0x30')](_[_0x83b7('0x3a')](_0x2ac00f[_0x83b7('0x2f')],_0x37f8ab[_0x83b7('0x30')]),_0x48c088);if(_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x3b')]){_0x46f0b0[_0x83b7('0x39')]=_[_0x83b7('0x3c')](_0x46f0b0[_0x83b7('0x39')],{'$or':_[_0x83b7('0x29')](_0x48c088,function(_0x4ae1ff){if(_0x4ae1ff[_0x83b7('0x2b')]!==_0x83b7('0x3d')){var _0x3b839f={};_0x3b839f[_0x4ae1ff['name']]={'$like':'%'+_0x2ac00f[_0x83b7('0x2f')][_0x83b7('0x3b')]+'%'};return _0x3b839f;}})});}_0x46f0b0=_[_0x83b7('0x3c')]({},_0x46f0b0,_0x2ac00f[_0x83b7('0x3e')]);var _0x1a0da8={'where':_0x46f0b0[_0x83b7('0x39')]};return db[_0x83b7('0x3f')][_0x83b7('0x1d')](_0x1a0da8)[_0x83b7('0x25')](function(_0x438e6a){_0x4615cc[_0x83b7('0x1d')]=_0x438e6a;if(_0x2ac00f['query']['includeAll']){_0x46f0b0['include']=[{'all':!![]}];}return db[_0x83b7('0x3f')]['findAll'](_0x46f0b0);})[_0x83b7('0x25')](function(_0x5c9181){_0x4615cc[_0x83b7('0x40')]=_0x5c9181;return _0x4615cc;})[_0x83b7('0x25')](respondWithFilteredResult(_0x238f53,_0x46f0b0))['catch'](handleError(_0x238f53,null));};exports[_0x83b7('0x41')]=function(_0xede644,_0x50951e){var _0x581870={'raw':!![],'where':{'id':_0xede644[_0x83b7('0x42')]['id']}},_0x1fdeb2={};_0x1fdeb2[_0x83b7('0x2d')]=_['keys'](db[_0x83b7('0x3f')][_0x83b7('0x2a')]);_0x1fdeb2[_0x83b7('0x2f')]=_[_0x83b7('0x2e')](_0xede644[_0x83b7('0x2f')]);_0x1fdeb2[_0x83b7('0x30')]=_[_0x83b7('0x31')](_0x1fdeb2['model'],_0x1fdeb2[_0x83b7('0x2f')]);_0x581870[_0x83b7('0x32')]=_[_0x83b7('0x31')](_0x1fdeb2[_0x83b7('0x2d')],qs['fields'](_0xede644[_0x83b7('0x2f')][_0x83b7('0x33')]));_0x581870['attributes']=_0x581870[_0x83b7('0x32')][_0x83b7('0x34')]?_0x581870[_0x83b7('0x32')]:_0x1fdeb2[_0x83b7('0x2d')];if(_0xede644[_0x83b7('0x2f')]['includeAll']){_0x581870[_0x83b7('0x43')]=[{'all':!![]}];}_0x581870=_['merge']({},_0x581870,_0xede644[_0x83b7('0x3e')]);return db['FaxQueueReport'][_0x83b7('0x44')](_0x581870)[_0x83b7('0x25')](handleEntityNotFound(_0x50951e,null))['then'](respondWithResult(_0x50951e,null))[_0x83b7('0x45')](handleError(_0x50951e,null));};exports[_0x83b7('0x46')]=function(_0x13020d,_0x5cd89a){return db[_0x83b7('0x3f')][_0x83b7('0x46')](_0x13020d[_0x83b7('0x47')],{})[_0x83b7('0x25')](respondWithResult(_0x5cd89a,0xc9))[_0x83b7('0x45')](handleError(_0x5cd89a,null));};exports[_0x83b7('0x24')]=function(_0x377ac4,_0x20f61e){if(_0x377ac4['body']['id']){delete _0x377ac4['body']['id'];}return db['FaxQueueReport'][_0x83b7('0x44')]({'where':{'id':_0x377ac4[_0x83b7('0x42')]['id']}})[_0x83b7('0x25')](handleEntityNotFound(_0x20f61e,null))[_0x83b7('0x25')](saveUpdates(_0x377ac4[_0x83b7('0x47')],null))[_0x83b7('0x25')](respondWithResult(_0x20f61e,null))[_0x83b7('0x45')](handleError(_0x20f61e,null));};exports[_0x83b7('0x48')]=function(_0x4e3165,_0x50e7f1){return db['FaxQueueReport'][_0x83b7('0x44')]({'where':{'id':_0x4e3165[_0x83b7('0x42')]['id']}})[_0x83b7('0x25')](handleEntityNotFound(_0x50e7f1,null))[_0x83b7('0x25')](removeEntity(_0x50e7f1,null))[_0x83b7('0x45')](handleError(_0x50e7f1,null));};exports[_0x83b7('0x49')]=function(_0x4a7cd4,_0x577815){return db[_0x83b7('0x3f')][_0x83b7('0x49')]()[_0x83b7('0x25')](respondWithResult(_0x577815,null))[_0x83b7('0x45')](handleError(_0x577815,null));}; \ No newline at end of file +var _0x1962=['json','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0xd1abbc,_0x5d0d38){var _0x4c4848=function(_0x58fafe){while(--_0x58fafe){_0xd1abbc['push'](_0xd1abbc['shift']());}};_0x4c4848(++_0x5d0d38);}(_0x1962,0x111));var _0x2196=function(_0x146fc2,_0x4beccc){_0x146fc2=_0x146fc2-0x0;var _0x3600ee=_0x1962[_0x146fc2];return _0x3600ee;};'use strict';var pdf=require(_0x2196('0x0'));var emlformat=require(_0x2196('0x1'));var rimraf=require(_0x2196('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2196('0x3'));var rp=require(_0x2196('0x4'));var moment=require(_0x2196('0x5'));var BPromise=require(_0x2196('0x6'));var Mustache=require(_0x2196('0x7'));var util=require(_0x2196('0x8'));var path=require(_0x2196('0x9'));var sox=require(_0x2196('0xa'));var csv=require(_0x2196('0xb'));var ejs=require(_0x2196('0xc'));var fs=require('fs');var _=require(_0x2196('0xd'));var squel=require(_0x2196('0xe'));var crypto=require(_0x2196('0xf'));var jsforce=require(_0x2196('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2196('0xb'));var querystring=require('querystring');var Papa=require(_0x2196('0x11'));var Redis=require(_0x2196('0x12'));var authService=require(_0x2196('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2196('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2196('0x15'));var utils=require('../../config/utils');var config=require(_0x2196('0x16'));var db=require(_0x2196('0x17'))['db'];function respondWithStatusCode(_0x2a2d16,_0x3c196f){_0x3c196f=_0x3c196f||0xcc;return function(_0x2fc0f6){if(_0x2fc0f6){return _0x2a2d16[_0x2196('0x18')](_0x3c196f);}return _0x2a2d16['status'](_0x3c196f)[_0x2196('0x19')]();};}function respondWithResult(_0x1ae3f8,_0x3da474){_0x3da474=_0x3da474||0xc8;return function(_0x5b11e3){if(_0x5b11e3){return _0x1ae3f8[_0x2196('0x1a')](_0x3da474)[_0x2196('0x1b')](_0x5b11e3);}};}function respondWithFilteredResult(_0xdef55f,_0x2d99ef){return function(_0x353bc2){if(_0x353bc2){var _0x2bb164=_0x353bc2[_0x2196('0x1c')],_0x5f44a6=_0x2d99ef[_0x2196('0x1d')],_0x479f57=_0x2d99ef[_0x2196('0x1d')]+_0x2d99ef['limit'],_0x1af50d;if(_0x479f57>=_0x2bb164){_0x479f57=_0x2bb164;_0x1af50d=0xc8;}else{_0x1af50d=0xce;}_0xdef55f[_0x2196('0x1a')](_0x1af50d);return _0xdef55f['set'](_0x2196('0x1e'),_0x5f44a6+'-'+_0x479f57+'/'+_0x2bb164)[_0x2196('0x1b')](_0x353bc2);}return null;};}function patchUpdates(_0x224856){return function(_0x3c590f){try{jsonpatch[_0x2196('0x1f')](_0x3c590f,_0x224856,!![]);}catch(_0x5206a4){return BPromise[_0x2196('0x20')](_0x5206a4);}return _0x3c590f[_0x2196('0x21')]();};}function saveUpdates(_0x1abc1d,_0x2cedd4){return function(_0x5a458b){if(_0x5a458b){return _0x5a458b[_0x2196('0x22')](_0x1abc1d)['then'](function(_0x47a7f9){return _0x47a7f9;});}return null;};}function removeEntity(_0x4d9e76,_0x3f0528){return function(_0x53ffb3){if(_0x53ffb3){return _0x53ffb3[_0x2196('0x23')]()[_0x2196('0x24')](function(){_0x4d9e76[_0x2196('0x1a')](0xcc)[_0x2196('0x19')]();});}};}function handleEntityNotFound(_0x45192b,_0x35ae03){return function(_0x19965f){if(!_0x19965f){_0x45192b[_0x2196('0x18')](0x194);}return _0x19965f;};}function handleError(_0x3a9e7b,_0x20d8fb){_0x20d8fb=_0x20d8fb||0x1f4;return function(_0x251036){logger[_0x2196('0x25')](_0x251036[_0x2196('0x26')]);if(_0x251036['name']){delete _0x251036[_0x2196('0x27')];}_0x3a9e7b[_0x2196('0x1a')](_0x20d8fb)[_0x2196('0x28')](_0x251036);};}exports[_0x2196('0x29')]=function(_0x5d1984,_0x100c4e){var _0x5ad68d={},_0x62c313={},_0x1ce819={'count':0x0,'rows':[]};var _0x14a47f=_[_0x2196('0x2a')](db[_0x2196('0x2b')][_0x2196('0x2c')],function(_0xa3269b){return{'name':_0xa3269b[_0x2196('0x2d')],'type':_0xa3269b[_0x2196('0x2e')][_0x2196('0x2f')]};});_0x62c313[_0x2196('0x30')]=_[_0x2196('0x2a')](_0x14a47f,_0x2196('0x27'));_0x62c313[_0x2196('0x31')]=_['keys'](_0x5d1984[_0x2196('0x31')]);_0x62c313[_0x2196('0x32')]=_[_0x2196('0x33')](_0x62c313[_0x2196('0x30')],_0x62c313[_0x2196('0x31')]);_0x5ad68d['attributes']=_[_0x2196('0x33')](_0x62c313['model'],qs['fields'](_0x5d1984[_0x2196('0x31')][_0x2196('0x34')]));_0x5ad68d[_0x2196('0x35')]=_0x5ad68d[_0x2196('0x35')][_0x2196('0x36')]?_0x5ad68d[_0x2196('0x35')]:_0x62c313[_0x2196('0x30')];if(!_0x5d1984[_0x2196('0x31')][_0x2196('0x37')](_0x2196('0x38'))){_0x5ad68d['limit']=qs['limit'](_0x5d1984[_0x2196('0x31')]['limit']);_0x5ad68d[_0x2196('0x1d')]=qs[_0x2196('0x1d')](_0x5d1984['query']['offset']);}_0x5ad68d[_0x2196('0x39')]=qs[_0x2196('0x3a')](_0x5d1984['query'][_0x2196('0x3a')]);_0x5ad68d[_0x2196('0x3b')]=qs['filters'](_[_0x2196('0x3c')](_0x5d1984[_0x2196('0x31')],_0x62c313['filters']),_0x14a47f);if(_0x5d1984['query'][_0x2196('0x3d')]){_0x5ad68d[_0x2196('0x3b')]=_[_0x2196('0x3e')](_0x5ad68d['where'],{'$or':_[_0x2196('0x2a')](_0x14a47f,function(_0x3973c3){if(_0x3973c3['type']!==_0x2196('0x3f')){var _0x52b0e8={};_0x52b0e8[_0x3973c3[_0x2196('0x27')]]={'$like':'%'+_0x5d1984[_0x2196('0x31')][_0x2196('0x3d')]+'%'};return _0x52b0e8;}})});}_0x5ad68d=_[_0x2196('0x3e')]({},_0x5ad68d,_0x5d1984[_0x2196('0x40')]);var _0x3dc99a={'where':_0x5ad68d[_0x2196('0x3b')]};return db[_0x2196('0x2b')]['count'](_0x3dc99a)[_0x2196('0x24')](function(_0x30f18d){_0x1ce819[_0x2196('0x1c')]=_0x30f18d;if(_0x5d1984['query'][_0x2196('0x41')]){_0x5ad68d['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x2196('0x42')](_0x5ad68d);})[_0x2196('0x24')](function(_0x4a7b6c){_0x1ce819['rows']=_0x4a7b6c;return _0x1ce819;})[_0x2196('0x24')](respondWithFilteredResult(_0x100c4e,_0x5ad68d))[_0x2196('0x43')](handleError(_0x100c4e,null));};exports[_0x2196('0x44')]=function(_0xb45a11,_0x1bf544){var _0x3ef057={'raw':!![],'where':{'id':_0xb45a11[_0x2196('0x45')]['id']}},_0x460b79={};_0x460b79[_0x2196('0x30')]=_['keys'](db[_0x2196('0x2b')][_0x2196('0x2c')]);_0x460b79[_0x2196('0x31')]=_[_0x2196('0x46')](_0xb45a11[_0x2196('0x31')]);_0x460b79[_0x2196('0x32')]=_[_0x2196('0x33')](_0x460b79['model'],_0x460b79['query']);_0x3ef057[_0x2196('0x35')]=_[_0x2196('0x33')](_0x460b79[_0x2196('0x30')],qs[_0x2196('0x34')](_0xb45a11['query'][_0x2196('0x34')]));_0x3ef057[_0x2196('0x35')]=_0x3ef057[_0x2196('0x35')]['length']?_0x3ef057['attributes']:_0x460b79[_0x2196('0x30')];if(_0xb45a11['query'][_0x2196('0x41')]){_0x3ef057[_0x2196('0x47')]=[{'all':!![]}];}_0x3ef057=_[_0x2196('0x3e')]({},_0x3ef057,_0xb45a11['options']);return db[_0x2196('0x2b')]['find'](_0x3ef057)['then'](handleEntityNotFound(_0x1bf544,null))[_0x2196('0x24')](respondWithResult(_0x1bf544,null))[_0x2196('0x43')](handleError(_0x1bf544,null));};exports['create']=function(_0xb62c9,_0x11ac3){return db[_0x2196('0x2b')]['create'](_0xb62c9[_0x2196('0x48')],{})['then'](respondWithResult(_0x11ac3,0xc9))['catch'](handleError(_0x11ac3,null));};exports[_0x2196('0x22')]=function(_0x22ee36,_0x51eb30){if(_0x22ee36['body']['id']){delete _0x22ee36[_0x2196('0x48')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x22ee36[_0x2196('0x45')]['id']}})[_0x2196('0x24')](handleEntityNotFound(_0x51eb30,null))[_0x2196('0x24')](saveUpdates(_0x22ee36[_0x2196('0x48')],null))[_0x2196('0x24')](respondWithResult(_0x51eb30,null))[_0x2196('0x43')](handleError(_0x51eb30,null));};exports[_0x2196('0x23')]=function(_0x5710bb,_0x521f31){return db[_0x2196('0x2b')][_0x2196('0x49')]({'where':{'id':_0x5710bb['params']['id']}})[_0x2196('0x24')](handleEntityNotFound(_0x521f31,null))['then'](removeEntity(_0x521f31,null))[_0x2196('0x43')](handleError(_0x521f31,null));};exports['describe']=function(_0x1659cb,_0x36ea6e){return db[_0x2196('0x2b')][_0x2196('0x4a')]()[_0x2196('0x24')](respondWithResult(_0x36ea6e,null))['catch'](handleError(_0x36ea6e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c3918c3..409502b 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 _0x50a5=['lodash','util','request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x545573,_0x17d098){var _0x47aed9=function(_0x339359){while(--_0x339359){_0x545573['push'](_0x545573['shift']());}};_0x47aed9(++_0x17d098);}(_0x50a5,0xd1));var _0x550a=function(_0x32d719,_0x49837a){_0x32d719=_0x32d719-0x0;var _0x7e45fd=_0x50a5[_0x32d719];return _0x7e45fd;};'use strict';var _=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x550a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var attributes=require(_0x550a('0x5'));module[_0x550a('0x6')]=function(_0x402f66,_0x3b3c29){return _0x402f66[_0x550a('0x7')](_0x550a('0x8'),attributes,{'tableName':_0x550a('0x9'),'paranoid':![],'indexes':[{'name':_0x550a('0xa'),'fields':[_0x550a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd943=['api','bluebird','request-promise','path','rimraf','../../config/environment','report_fax_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x5b9a30,_0x2b3667){var _0x35f722=function(_0xfb962b){while(--_0xfb962b){_0x5b9a30['push'](_0x5b9a30['shift']());}};_0x35f722(++_0x2b3667);}(_0xd943,0x15d));var _0x3d94=function(_0x2cb517,_0x564c92){_0x2cb517=_0x2cb517-0x0;var _0x8b5aec=_0xd943[_0x2cb517];return _0x8b5aec;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('FaxQueueReport',attributes,{'tableName':_0x3d94('0x9'),'paranoid':![],'indexes':[{'name':_0x3d94('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ff4ad53..282fb86 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 _0xf0d9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','then','UpdateFaxQueueReport','FaxQueueReport','options','raw','where','attributes','limit','util','moment','bluebird','randomstring'];(function(_0x38e1b3,_0x485a69){var _0x42cdcd=function(_0x362b64){while(--_0x362b64){_0x38e1b3['push'](_0x38e1b3['shift']());}};_0x42cdcd(++_0x485a69);}(_0xf0d9,0x1ae));var _0x9f0d=function(_0x504487,_0x2835f0){_0x504487=_0x504487-0x0;var _0x35f823=_0xf0d9[_0x504487];return _0x35f823;};'use strict';var _=require('lodash');var util=require(_0x9f0d('0x0'));var moment=require(_0x9f0d('0x1'));var BPromise=require(_0x9f0d('0x2'));var rs=require(_0x9f0d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f0d('0x4'))['db'];var utils=require(_0x9f0d('0x5'));var logger=require(_0x9f0d('0x6'))(_0x9f0d('0x7'));var config=require(_0x9f0d('0x8'));var jayson=require(_0x9f0d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dcfce,_0x117303,_0x107d83){return new BPromise(function(_0x2e7976,_0x25a8a1){return client['request'](_0x4dcfce,_0x107d83)['then'](function(_0x1d8eb7){logger[_0x9f0d('0xa')](_0x9f0d('0xb'),_0x117303,'request\x20sent');logger[_0x9f0d('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x117303,_0x9f0d('0xd'),JSON[_0x9f0d('0xe')](_0x1d8eb7));if(_0x1d8eb7['error']){if(_0x1d8eb7[_0x9f0d('0xf')][_0x9f0d('0x10')]===0x1f4){logger[_0x9f0d('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x117303,_0x1d8eb7[_0x9f0d('0xf')][_0x9f0d('0x11')]);return _0x25a8a1(_0x1d8eb7['error']['message']);}logger[_0x9f0d('0xf')](_0x9f0d('0xb'),_0x117303,_0x1d8eb7[_0x9f0d('0xf')][_0x9f0d('0x11')]);return _0x2e7976(_0x1d8eb7[_0x9f0d('0xf')]['message']);}else{logger['info'](_0x9f0d('0xb'),_0x117303,_0x9f0d('0xd'));_0x2e7976(_0x1d8eb7[_0x9f0d('0x12')][_0x9f0d('0x11')]);}})[_0x9f0d('0x13')](function(_0x28ee1b){logger['error'](_0x9f0d('0xb'),_0x117303,_0x28ee1b);_0x25a8a1(_0x28ee1b);});});}exports[_0x9f0d('0x14')]=function(_0x33933c){var _0xe8bca4=this;return new Promise(function(_0x3d680e,_0x3c19b7){return db['FaxQueueReport'][_0x9f0d('0x15')](_0x33933c[_0x9f0d('0x16')],{'raw':_0x33933c['options']?_0x33933c['options']['raw']===undefined?!![]:![]:!![]})[_0x9f0d('0x17')](function(_0x234ac4){logger['info'](_0x9f0d('0x14'),_0x33933c);logger[_0x9f0d('0xc')](_0x9f0d('0x14'),_0x33933c,JSON[_0x9f0d('0xe')](_0x234ac4));_0x3d680e(_0x234ac4);})[_0x9f0d('0x13')](function(_0xb67346){logger[_0x9f0d('0xf')](_0x9f0d('0x14'),_0xb67346[_0x9f0d('0x11')],_0x33933c);_0x3c19b7(_0xe8bca4[_0x9f0d('0xf')](0x1f4,_0xb67346['message']));});});};exports[_0x9f0d('0x18')]=function(_0x2087a8){var _0x355597=this;return new Promise(function(_0x4e0610,_0xf4e15c){return db[_0x9f0d('0x19')]['update'](_0x2087a8[_0x9f0d('0x16')],{'raw':_0x2087a8[_0x9f0d('0x1a')]?_0x2087a8['options'][_0x9f0d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2087a8[_0x9f0d('0x1a')]?_0x2087a8[_0x9f0d('0x1a')][_0x9f0d('0x1c')]||null:null,'attributes':_0x2087a8['options']?_0x2087a8[_0x9f0d('0x1a')][_0x9f0d('0x1d')]||null:null,'limit':_0x2087a8[_0x9f0d('0x1a')]?_0x2087a8[_0x9f0d('0x1a')][_0x9f0d('0x1e')]||null:null})[_0x9f0d('0x17')](function(_0x1fdef6){logger['info'](_0x9f0d('0x18'),_0x2087a8);logger[_0x9f0d('0xc')](_0x9f0d('0x18'),_0x2087a8,JSON['stringify'](_0x1fdef6));_0x4e0610(_0x1fdef6);})[_0x9f0d('0x13')](function(_0x3ebbe7){logger['error'](_0x9f0d('0x18'),_0x3ebbe7[_0x9f0d('0x11')],_0x2087a8);_0xf4e15c(_0x355597['error'](0x1f4,_0x3ebbe7['message']));});});}; \ No newline at end of file +var _0x7533=['message','FaxQueueReport,\x20%s,\x20%s','info','result','catch','FaxQueueReport','create','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','options','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x7533,0x93));var _0x3753=function(_0xd40e6b,_0x4a8e56){_0xd40e6b=_0xd40e6b-0x0;var _0x359de4=_0x7533[_0xd40e6b];return _0x359de4;};'use strict';var _=require(_0x3753('0x0'));var util=require(_0x3753('0x1'));var moment=require(_0x3753('0x2'));var BPromise=require(_0x3753('0x3'));var rs=require(_0x3753('0x4'));var fs=require('fs');var Redis=require(_0x3753('0x5'));var db=require(_0x3753('0x6'))['db'];var utils=require(_0x3753('0x7'));var logger=require(_0x3753('0x8'))(_0x3753('0x9'));var config=require(_0x3753('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x525904,_0x27f53e,_0x339596){return new BPromise(function(_0x122aae,_0x30efa8){return client[_0x3753('0xb')](_0x525904,_0x339596)[_0x3753('0xc')](function(_0x26cb0){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x27f53e,_0x3753('0xd'));logger[_0x3753('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x27f53e,'request\x20sent',JSON[_0x3753('0xf')](_0x26cb0));if(_0x26cb0[_0x3753('0x10')]){if(_0x26cb0[_0x3753('0x10')][_0x3753('0x11')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x27f53e,_0x26cb0['error']['message']);return _0x30efa8(_0x26cb0[_0x3753('0x10')][_0x3753('0x12')]);}logger[_0x3753('0x10')](_0x3753('0x13'),_0x27f53e,_0x26cb0[_0x3753('0x10')][_0x3753('0x12')]);return _0x122aae(_0x26cb0[_0x3753('0x10')][_0x3753('0x12')]);}else{logger[_0x3753('0x14')](_0x3753('0x13'),_0x27f53e,_0x3753('0xd'));_0x122aae(_0x26cb0[_0x3753('0x15')][_0x3753('0x12')]);}})[_0x3753('0x16')](function(_0x47c284){logger[_0x3753('0x10')](_0x3753('0x13'),_0x27f53e,_0x47c284);_0x30efa8(_0x47c284);});});}exports['CreateFaxQueueReport']=function(_0x41ef44){var _0x27da2b=this;return new Promise(function(_0x1b0da6,_0x2eaab2){return db[_0x3753('0x17')][_0x3753('0x18')](_0x41ef44['body'],{'raw':_0x41ef44['options']?_0x41ef44['options'][_0x3753('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2614c9){logger['info'](_0x3753('0x1a'),_0x41ef44);logger[_0x3753('0xe')](_0x3753('0x1a'),_0x41ef44,JSON[_0x3753('0xf')](_0x2614c9));_0x1b0da6(_0x2614c9);})['catch'](function(_0x1383b8){logger['error']('CreateFaxQueueReport',_0x1383b8['message'],_0x41ef44);_0x2eaab2(_0x27da2b[_0x3753('0x10')](0x1f4,_0x1383b8[_0x3753('0x12')]));});});};exports[_0x3753('0x1b')]=function(_0x3ae759){var _0x249c6e=this;return new Promise(function(_0x1abf0b,_0xdf758d){return db[_0x3753('0x17')][_0x3753('0x1c')](_0x3ae759[_0x3753('0x1d')],{'raw':_0x3ae759[_0x3753('0x1e')]?_0x3ae759[_0x3753('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ae759[_0x3753('0x1e')]?_0x3ae759['options']['where']||null:null,'attributes':_0x3ae759[_0x3753('0x1e')]?_0x3ae759[_0x3753('0x1e')][_0x3753('0x1f')]||null:null,'limit':_0x3ae759[_0x3753('0x1e')]?_0x3ae759['options'][_0x3753('0x20')]||null:null})[_0x3753('0xc')](function(_0x1a2644){logger['info'](_0x3753('0x1b'),_0x3ae759);logger[_0x3753('0xe')](_0x3753('0x1b'),_0x3ae759,JSON[_0x3753('0xf')](_0x1a2644));_0x1abf0b(_0x1a2644);})[_0x3753('0x16')](function(_0x13f6e7){logger[_0x3753('0x10')](_0x3753('0x1b'),_0x13f6e7['message'],_0x3ae759);_0xdf758d(_0x249c6e[_0x3753('0x10')](0x1f4,_0x13f6e7[_0x3753('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ccc6a05..68943b0 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 _0x9241=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x9241,0x182));var _0x1924=function(_0x4f7404,_0x3ee924){_0x4f7404=_0x4f7404-0x0;var _0x4c4b76=_0x9241[_0x4f7404];return _0x4c4b76;};'use strict';var multer=require(_0x1924('0x0'));var util=require(_0x1924('0x1'));var path=require(_0x1924('0x2'));var timeout=require(_0x1924('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x1924('0x4'));var interaction=require(_0x1924('0x5'));var config=require(_0x1924('0x6'));var controller=require(_0x1924('0x7'));router[_0x1924('0x8')]('/',auth[_0x1924('0x9')](),controller[_0x1924('0xa')]);router['get'](_0x1924('0xb'),auth[_0x1924('0x9')](),controller[_0x1924('0xc')]);router[_0x1924('0x8')](_0x1924('0xd'),auth[_0x1924('0x9')](),controller[_0x1924('0xe')]);router[_0x1924('0xf')]('/',auth[_0x1924('0x9')](),controller[_0x1924('0x10')]);router[_0x1924('0x11')](_0x1924('0xd'),auth[_0x1924('0x9')](),controller[_0x1924('0x12')]);router[_0x1924('0x13')](_0x1924('0xd'),auth[_0x1924('0x9')](),controller[_0x1924('0x14')]);module[_0x1924('0x15')]=router; \ No newline at end of file +var _0xf7d3=['put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create'];(function(_0x1de158,_0x42540f){var _0x2ab676=function(_0x1b2d3f){while(--_0x1b2d3f){_0x1de158['push'](_0x1de158['shift']());}};_0x2ab676(++_0x42540f);}(_0xf7d3,0xcc));var _0x3f7d=function(_0x4c09b0,_0x2e33e6){_0x4c09b0=_0x4c09b0-0x0;var _0x3bfcbc=_0xf7d3[_0x4c09b0];return _0x3bfcbc;};'use strict';var multer=require(_0x3f7d('0x0'));var util=require(_0x3f7d('0x1'));var path=require(_0x3f7d('0x2'));var timeout=require(_0x3f7d('0x3'));var express=require(_0x3f7d('0x4'));var router=express[_0x3f7d('0x5')]();var auth=require(_0x3f7d('0x6'));var interaction=require(_0x3f7d('0x7'));var config=require('../../config/environment');var controller=require(_0x3f7d('0x8'));router[_0x3f7d('0x9')]('/',auth[_0x3f7d('0xa')](),controller[_0x3f7d('0xb')]);router[_0x3f7d('0x9')](_0x3f7d('0xc'),auth[_0x3f7d('0xa')](),controller[_0x3f7d('0xd')]);router[_0x3f7d('0x9')]('/:id',auth[_0x3f7d('0xa')](),controller[_0x3f7d('0xe')]);router['post']('/',auth[_0x3f7d('0xa')](),controller[_0x3f7d('0xf')]);router[_0x3f7d('0x10')](_0x3f7d('0x11'),auth[_0x3f7d('0xa')](),controller[_0x3f7d('0x12')]);router['delete'](_0x3f7d('0x11'),auth[_0x3f7d('0xa')](),controller['destroy']);module[_0x3f7d('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 92b2af4..7674c82 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 _0xf2fe=['sequelize','account','agent','queue','DATE','NOW','moment'];(function(_0x114b03,_0x279d0c){var _0x5a7b18=function(_0x486e52){while(--_0x486e52){_0x114b03['push'](_0x114b03['shift']());}};_0x5a7b18(++_0x279d0c);}(_0xf2fe,0xc3));var _0xef2f=function(_0x31e9eb,_0x588a45){_0x31e9eb=_0x31e9eb-0x0;var _0x2215ee=_0xf2fe[_0x31e9eb];return _0x2215ee;};'use strict';var moment=require(_0xef2f('0x0'));var Sequelize=require(_0xef2f('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xef2f('0x2'),_0xef2f('0x3'),_0xef2f('0x4')),'allowNull':![],'defaultValue':_0xef2f('0x4')},'transferredAt':{'type':Sequelize[_0xef2f('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xef2f('0x6')]}}; \ No newline at end of file +var _0x64d3=['STRING','ENUM','account','agent','queue','NOW','sequelize','exports'];(function(_0x53eb54,_0x292d5a){var _0x186387=function(_0x29889b){while(--_0x29889b){_0x53eb54['push'](_0x53eb54['shift']());}};_0x186387(++_0x292d5a);}(_0x64d3,0x15e));var _0x364d=function(_0x1f2e2d,_0x57f149){_0x1f2e2d=_0x1f2e2d-0x0;var _0x18f734=_0x64d3[_0x1f2e2d];return _0x18f734;};'use strict';var moment=require('moment');var Sequelize=require(_0x364d('0x0'));module[_0x364d('0x1')]={'uniqueid':{'type':Sequelize[_0x364d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x364d('0x3')](_0x364d('0x4'),_0x364d('0x5'),'queue'),'allowNull':![],'defaultValue':_0x364d('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x364d('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 13ecf1c..c4a71fe 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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5f2f,0x73));var _0xf5f2=function(_0x200915,_0x57da6e){_0x200915=_0x200915-0x0;var _0x589ac1=_0x5f2f[_0x200915];return _0x589ac1;};'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 _0x2ef3=['send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy','then','stack','name'];(function(_0x5830f1,_0x1a5dd8){var _0x1a35eb=function(_0x4a829c){while(--_0x4a829c){_0x5830f1['push'](_0x5830f1['shift']());}};_0x1a35eb(++_0x1a5dd8);}(_0x2ef3,0xba));var _0x32ef=function(_0xfa7827,_0x17c457){_0xfa7827=_0xfa7827-0x0;var _0x1b82f5=_0x2ef3[_0xfa7827];return _0x1b82f5;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];function respondWithStatusCode(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0xcc;return function(_0x49d590){if(_0x49d590){return _0x5afcc2[_0x32ef('0x19')](_0x1a5106);}return _0x5afcc2[_0x32ef('0x1a')](_0x1a5106)['end']();};}function respondWithResult(_0x539d18,_0x19ce1){_0x19ce1=_0x19ce1||0xc8;return function(_0x4d8009){if(_0x4d8009){return _0x539d18[_0x32ef('0x1a')](_0x19ce1)[_0x32ef('0x1b')](_0x4d8009);}};}function respondWithFilteredResult(_0x93d492,_0x54c7f5){return function(_0x57aff1){if(_0x57aff1){var _0x55bf0b=_0x57aff1[_0x32ef('0x1c')],_0x531e30=_0x54c7f5['offset'],_0x13db1a=_0x54c7f5['offset']+_0x54c7f5[_0x32ef('0x1d')],_0x3950e6;if(_0x13db1a>=_0x55bf0b){_0x13db1a=_0x55bf0b;_0x3950e6=0xc8;}else{_0x3950e6=0xce;}_0x93d492[_0x32ef('0x1a')](_0x3950e6);return _0x93d492[_0x32ef('0x1e')]('Content-Range',_0x531e30+'-'+_0x13db1a+'/'+_0x55bf0b)[_0x32ef('0x1b')](_0x57aff1);}return null;};}function patchUpdates(_0x33e230){return function(_0x4f4c98){try{jsonpatch[_0x32ef('0x1f')](_0x4f4c98,_0x33e230,!![]);}catch(_0x314ef1){return BPromise[_0x32ef('0x20')](_0x314ef1);}return _0x4f4c98[_0x32ef('0x21')]();};}function saveUpdates(_0x445cda,_0x3aec05){return function(_0x4de441){if(_0x4de441){return _0x4de441[_0x32ef('0x22')](_0x445cda)['then'](function(_0x309866){return _0x309866;});}return null;};}function removeEntity(_0x3a20ca,_0x49f2d8){return function(_0x1af371){if(_0x1af371){return _0x1af371[_0x32ef('0x23')]()[_0x32ef('0x24')](function(){_0x3a20ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(!_0x225feb){_0x22f2d7['sendStatus'](0x194);}return _0x225feb;};}function handleError(_0x59585f,_0x19ea6){_0x19ea6=_0x19ea6||0x1f4;return function(_0x4d584b){logger['error'](_0x4d584b[_0x32ef('0x25')]);if(_0x4d584b[_0x32ef('0x26')]){delete _0x4d584b[_0x32ef('0x26')];}_0x59585f[_0x32ef('0x1a')](_0x19ea6)[_0x32ef('0x27')](_0x4d584b);};}exports[_0x32ef('0x28')]=function(_0x1874ea,_0x38aed5){var _0x338f19={},_0x2f52d7={},_0x1335e2={'count':0x0,'rows':[]};var _0xba4b3f=_['map'](db[_0x32ef('0x29')][_0x32ef('0x2a')],function(_0x5a04cd){return{'name':_0x5a04cd[_0x32ef('0x2b')],'type':_0x5a04cd[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x2f52d7[_0x32ef('0x2e')]=_['map'](_0xba4b3f,_0x32ef('0x26'));_0x2f52d7[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x1874ea[_0x32ef('0x2f')]);_0x2f52d7[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2f52d7[_0x32ef('0x2e')],_0x2f52d7['query']);_0x338f19[_0x32ef('0x33')]=_['intersection'](_0x2f52d7[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x1874ea['query'][_0x32ef('0x34')]));_0x338f19[_0x32ef('0x33')]=_0x338f19[_0x32ef('0x33')][_0x32ef('0x35')]?_0x338f19[_0x32ef('0x33')]:_0x2f52d7['model'];if(!_0x1874ea['query'][_0x32ef('0x36')]('nolimit')){_0x338f19[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x338f19[_0x32ef('0x37')]=qs[_0x32ef('0x37')](_0x1874ea['query']['offset']);}_0x338f19['order']=qs[_0x32ef('0x38')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x38')]);_0x338f19['where']=qs['filters'](_[_0x32ef('0x39')](_0x1874ea[_0x32ef('0x2f')],_0x2f52d7[_0x32ef('0x31')]),_0xba4b3f);if(_0x1874ea['query']['filter']){_0x338f19[_0x32ef('0x3a')]=_[_0x32ef('0x3b')](_0x338f19[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x3c')](_0xba4b3f,function(_0x3a7c49){if(_0x3a7c49[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x21da90={};_0x21da90[_0x3a7c49[_0x32ef('0x26')]]={'$like':'%'+_0x1874ea['query'][_0x32ef('0x3e')]+'%'};return _0x21da90;}})});}_0x338f19=_[_0x32ef('0x3b')]({},_0x338f19,_0x1874ea[_0x32ef('0x3f')]);var _0x4b97dc={'where':_0x338f19[_0x32ef('0x3a')]};return db[_0x32ef('0x29')][_0x32ef('0x1c')](_0x4b97dc)[_0x32ef('0x24')](function(_0x1faf72){_0x1335e2[_0x32ef('0x1c')]=_0x1faf72;if(_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x338f19[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x29')][_0x32ef('0x42')](_0x338f19);})[_0x32ef('0x24')](function(_0x48e071){_0x1335e2[_0x32ef('0x43')]=_0x48e071;return _0x1335e2;})[_0x32ef('0x24')](respondWithFilteredResult(_0x38aed5,_0x338f19))[_0x32ef('0x44')](handleError(_0x38aed5,null));};exports[_0x32ef('0x45')]=function(_0x2f92f5,_0x2ca66b){var _0x3c0e44={'raw':!![],'where':{'id':_0x2f92f5['params']['id']}},_0x596d5a={};_0x596d5a[_0x32ef('0x2e')]=_[_0x32ef('0x30')](db[_0x32ef('0x29')][_0x32ef('0x2a')]);_0x596d5a['query']=_[_0x32ef('0x30')](_0x2f92f5[_0x32ef('0x2f')]);_0x596d5a['filters']=_[_0x32ef('0x32')](_0x596d5a['model'],_0x596d5a[_0x32ef('0x2f')]);_0x3c0e44[_0x32ef('0x33')]=_[_0x32ef('0x32')](_0x596d5a[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x2f92f5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x3c0e44[_0x32ef('0x33')]=_0x3c0e44[_0x32ef('0x33')][_0x32ef('0x35')]?_0x3c0e44['attributes']:_0x596d5a[_0x32ef('0x2e')];if(_0x2f92f5['query'][_0x32ef('0x40')]){_0x3c0e44[_0x32ef('0x41')]=[{'all':!![]}];}_0x3c0e44=_[_0x32ef('0x3b')]({},_0x3c0e44,_0x2f92f5['options']);return db[_0x32ef('0x29')][_0x32ef('0x46')](_0x3c0e44)[_0x32ef('0x24')](handleEntityNotFound(_0x2ca66b,null))[_0x32ef('0x24')](respondWithResult(_0x2ca66b,null))[_0x32ef('0x44')](handleError(_0x2ca66b,null));};exports[_0x32ef('0x47')]=function(_0x12c9e6,_0x47dbe1){return db['FaxTransferReport'][_0x32ef('0x47')](_0x12c9e6[_0x32ef('0x48')],{})[_0x32ef('0x24')](respondWithResult(_0x47dbe1,0xc9))[_0x32ef('0x44')](handleError(_0x47dbe1,null));};exports[_0x32ef('0x22')]=function(_0xd67dc9,_0x44ad11){if(_0xd67dc9[_0x32ef('0x48')]['id']){delete _0xd67dc9[_0x32ef('0x48')]['id'];}return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0xd67dc9[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x44ad11,null))['then'](saveUpdates(_0xd67dc9[_0x32ef('0x48')],null))[_0x32ef('0x24')](respondWithResult(_0x44ad11,null))[_0x32ef('0x44')](handleError(_0x44ad11,null));};exports[_0x32ef('0x23')]=function(_0x1cc9f3,_0x4353f0){return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0x1cc9f3[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x4353f0,null))[_0x32ef('0x24')](removeEntity(_0x4353f0,null))[_0x32ef('0x44')](handleError(_0x4353f0,null));};exports[_0x32ef('0x4a')]=function(_0x326445,_0x307ac8){return db[_0x32ef('0x29')][_0x32ef('0x4a')]()[_0x32ef('0x24')](respondWithResult(_0x307ac8,null))['catch'](handleError(_0x307ac8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 92efd95..60499ef 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 _0x8425=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x432e18,_0x4bf3a6){var _0xfbc0e5=function(_0xd9f625){while(--_0xd9f625){_0x432e18['push'](_0x432e18['shift']());}};_0xfbc0e5(++_0x4bf3a6);}(_0x8425,0x1a5));var _0x5842=function(_0x3ef1a6,_0x54f4dd){_0x3ef1a6=_0x3ef1a6-0x0;var _0x28d482=_0x8425[_0x3ef1a6];return _0x28d482;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var logger=require('../../config/logger')(_0x5842('0x2'));var moment=require(_0x5842('0x3'));var BPromise=require(_0x5842('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5842('0x5'));var rimraf=require(_0x5842('0x6'));var config=require(_0x5842('0x7'));var attributes=require(_0x5842('0x8'));module[_0x5842('0x9')]=function(_0x24a672,_0x3db420){return _0x24a672[_0x5842('0xa')](_0x5842('0xb'),attributes,{'tableName':_0x5842('0xc'),'paranoid':![],'indexes':[{'name':_0x5842('0xd'),'fields':[_0x5842('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe58a=['util','../../config/logger','moment','path','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x501ca1,_0x6c6edc){var _0x2a99c4=function(_0x542cad){while(--_0x542cad){_0x501ca1['push'](_0x501ca1['shift']());}};_0x2a99c4(++_0x6c6edc);}(_0xe58a,0x9f));var _0xae58=function(_0x28132e,_0x561138){_0x28132e=_0x28132e-0x0;var _0x3cf5b7=_0xe58a[_0x28132e];return _0x3cf5b7;};'use strict';var _=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));var logger=require(_0xae58('0x2'))('api');var moment=require(_0xae58('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae58('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae58('0x5'));module['exports']=function(_0x198e0c,_0x29749a){return _0x198e0c[_0xae58('0x6')](_0xae58('0x7'),attributes,{'tableName':_0xae58('0x8'),'paranoid':![],'indexes':[{'name':_0xae58('0x9'),'fields':[_0xae58('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 09a6997..e0e8bd8 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 _0xb002=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x31c4ba,_0x3c9d37){var _0x5a955f=function(_0x5ddcf3){while(--_0x5ddcf3){_0x31c4ba['push'](_0x31c4ba['shift']());}};_0x5a955f(++_0x3c9d37);}(_0xb002,0x78));var _0x2b00=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb002[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x2b00('0x0'));var moment=require(_0x2b00('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b00('0x2'));var fs=require('fs');var Redis=require(_0x2b00('0x3'));var db=require(_0x2b00('0x4'))['db'];var utils=require(_0x2b00('0x5'));var logger=require(_0x2b00('0x6'))(_0x2b00('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b00('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13de2e,_0x51e53d,_0x3ec71f){return new BPromise(function(_0x3ee59c,_0x27ee8f){return client[_0x2b00('0x9')](_0x13de2e,_0x3ec71f)[_0x2b00('0xa')](function(_0x267a17){logger['info'](_0x2b00('0xb'),_0x51e53d,_0x2b00('0xc'));logger['debug'](_0x2b00('0xd'),_0x51e53d,_0x2b00('0xc'),JSON[_0x2b00('0xe')](_0x267a17));if(_0x267a17[_0x2b00('0xf')]){if(_0x267a17['error']['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x51e53d,_0x267a17[_0x2b00('0xf')][_0x2b00('0x10')]);return _0x27ee8f(_0x267a17[_0x2b00('0xf')][_0x2b00('0x10')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x51e53d,_0x267a17[_0x2b00('0xf')][_0x2b00('0x10')]);return _0x3ee59c(_0x267a17[_0x2b00('0xf')][_0x2b00('0x10')]);}else{logger[_0x2b00('0x11')](_0x2b00('0xb'),_0x51e53d,_0x2b00('0xc'));_0x3ee59c(_0x267a17[_0x2b00('0x12')][_0x2b00('0x10')]);}})[_0x2b00('0x13')](function(_0x26892a){logger['error'](_0x2b00('0xb'),_0x51e53d,_0x26892a);_0x27ee8f(_0x26892a);});});} \ No newline at end of file +var _0x4b93=['../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc'];(function(_0x36b3f4,_0x2c6ae2){var _0x139d9e=function(_0x43e077){while(--_0x43e077){_0x36b3f4['push'](_0x36b3f4['shift']());}};_0x139d9e(++_0x2c6ae2);}(_0x4b93,0x1f2));var _0x34b9=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x4b93[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x34b9('0x0'));var util=require('util');var moment=require(_0x34b9('0x1'));var BPromise=require(_0x34b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34b9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x34b9('0x4'))(_0x34b9('0x5'));var config=require(_0x34b9('0x6'));var jayson=require(_0x34b9('0x7'));var client=jayson[_0x34b9('0x8')][_0x34b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44f47f,_0x2b700b,_0x355094){return new BPromise(function(_0x493b45,_0x2c11f8){return client[_0x34b9('0xa')](_0x44f47f,_0x355094)[_0x34b9('0xb')](function(_0xc4a8fe){logger['info'](_0x34b9('0xc'),_0x2b700b,_0x34b9('0xd'));logger[_0x34b9('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2b700b,_0x34b9('0xd'),JSON['stringify'](_0xc4a8fe));if(_0xc4a8fe[_0x34b9('0xf')]){if(_0xc4a8fe[_0x34b9('0xf')][_0x34b9('0x10')]===0x1f4){logger[_0x34b9('0xf')](_0x34b9('0xc'),_0x2b700b,_0xc4a8fe[_0x34b9('0xf')][_0x34b9('0x11')]);return _0x2c11f8(_0xc4a8fe[_0x34b9('0xf')][_0x34b9('0x11')]);}logger[_0x34b9('0xf')](_0x34b9('0xc'),_0x2b700b,_0xc4a8fe['error'][_0x34b9('0x11')]);return _0x493b45(_0xc4a8fe[_0x34b9('0xf')][_0x34b9('0x11')]);}else{logger[_0x34b9('0x12')](_0x34b9('0xc'),_0x2b700b,_0x34b9('0xd'));_0x493b45(_0xc4a8fe[_0x34b9('0x13')]['message']);}})[_0x34b9('0x14')](function(_0x4729c2){logger[_0x34b9('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x2b700b,_0x4729c2);_0x2c11f8(_0x4729c2);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index c6b695d..1303137 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 _0x7723=['connect-timeout','Router','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x236b4a,_0x41a29b){var _0x3a9223=function(_0x3d9403){while(--_0x3d9403){_0x236b4a['push'](_0x236b4a['shift']());}};_0x3a9223(++_0x41a29b);}(_0x7723,0x140));var _0x3772=function(_0x21dbc1,_0x5adf23){_0x21dbc1=_0x21dbc1-0x0;var _0x4c3f79=_0x7723[_0x21dbc1];return _0x4c3f79;};'use strict';var multer=require(_0x3772('0x0'));var util=require(_0x3772('0x1'));var path=require(_0x3772('0x2'));var timeout=require(_0x3772('0x3'));var express=require('express');var router=express[_0x3772('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3772('0x5'));var controller=require(_0x3772('0x6'));router[_0x3772('0x7')]('/',auth[_0x3772('0x8')](),controller[_0x3772('0x9')]);router[_0x3772('0x7')](_0x3772('0xa'),auth[_0x3772('0x8')](),controller[_0x3772('0xb')]);router[_0x3772('0x7')](_0x3772('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3772('0xd')]('/',auth[_0x3772('0x8')](),controller[_0x3772('0xe')]);router[_0x3772('0xf')](_0x3772('0xc'),auth[_0x3772('0x8')](),controller['update']);router[_0x3772('0x10')](_0x3772('0xc'),auth[_0x3772('0x8')](),controller[_0x3772('0x11')]);module[_0x3772('0x12')]=router; \ No newline at end of file +var _0x8541=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','update','destroy','exports','util','path'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x8541,0x11f));var _0x1854=function(_0x4b4aec,_0x264398){_0x4b4aec=_0x4b4aec-0x0;var _0x11577c=_0x8541[_0x4b4aec];return _0x11577c;};'use strict';var multer=require('multer');var util=require(_0x1854('0x0'));var path=require(_0x1854('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x1854('0x2'));var interaction=require(_0x1854('0x3'));var config=require(_0x1854('0x4'));var controller=require(_0x1854('0x5'));router[_0x1854('0x6')]('/',auth['isAuthenticated'](),controller[_0x1854('0x7')]);router[_0x1854('0x6')](_0x1854('0x8'),auth[_0x1854('0x9')](),controller['describe']);router[_0x1854('0x6')](_0x1854('0xa'),auth['isAuthenticated'](),controller[_0x1854('0xb')]);router[_0x1854('0xc')]('/',auth[_0x1854('0x9')](),controller[_0x1854('0xd')]);router['put'](_0x1854('0xa'),auth[_0x1854('0x9')](),controller[_0x1854('0xe')]);router['delete'](_0x1854('0xa'),auth[_0x1854('0x9')](),controller[_0x1854('0xf')]);module[_0x1854('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index aae8af0..7368a25 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 _0xbeea=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeea,0xb1));var _0xabee=function(_0x4c6ee1,_0x3a9158){_0x4c6ee1=_0x4c6ee1-0x0;var _0x2f8c70=_0xbeea[_0x4c6ee1];return _0x2f8c70;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var auth=require(_0xabee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xabee('0x5'));var controller=require(_0xabee('0x6'));router[_0xabee('0x7')]('/',auth[_0xabee('0x8')](),controller[_0xabee('0x9')]);router['get']('/:id',auth[_0xabee('0x8')](),controller[_0xabee('0xa')]);router['get'](_0xabee('0xb'),auth['isAuthenticated'](),controller[_0xabee('0xc')]);router[_0xabee('0x7')](_0xabee('0xd'),auth[_0xabee('0x8')](),controller[_0xabee('0xe')]);router[_0xabee('0xf')]('/',auth['isAuthenticated'](),controller[_0xabee('0x10')]);router[_0xabee('0xf')](_0xabee('0xb'),auth['isAuthenticated'](),controller[_0xabee('0x11')]);router[_0xabee('0x12')](_0xabee('0x13'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xabee('0x14')]);module[_0xabee('0x15')]=router; \ No newline at end of file +var _0x277c=['show','get','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','index','/:id'];(function(_0x5912e7,_0x1db12c){var _0x3ccdb0=function(_0x407741){while(--_0x407741){_0x5912e7['push'](_0x5912e7['shift']());}};_0x3ccdb0(++_0x1db12c);}(_0x277c,0x153));var _0xc277=function(_0xb2bc61,_0x390f29){_0xb2bc61=_0xb2bc61-0x0;var _0x1a73d5=_0x277c[_0xb2bc61];return _0x1a73d5;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var auth=require(_0xc277('0x5'));var interaction=require(_0xc277('0x6'));var config=require(_0xc277('0x7'));var controller=require(_0xc277('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc277('0x9')]);router['get'](_0xc277('0xa'),auth['isAuthenticated'](),controller[_0xc277('0xb')]);router[_0xc277('0xc')]('/:id/configurations',auth[_0xc277('0xd')](),controller[_0xc277('0xe')]);router[_0xc277('0xc')](_0xc277('0xf'),auth[_0xc277('0xd')](),controller[_0xc277('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc277('0x11')]);router[_0xc277('0x12')](_0xc277('0x13'),auth[_0xc277('0xd')](),controller['addConfiguration']);router[_0xc277('0x14')]('/:id',auth[_0xc277('0xd')](),controller[_0xc277('0x15')]);router[_0xc277('0x16')](_0xc277('0xa'),auth['isAuthenticated'](),controller[_0xc277('0x17')]);module[_0xc277('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5d4ffa7..9479461 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 _0x35bb=['integrationTab','exports','STRING','ENUM','basic'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x35bb,0x12d));var _0xb35b=function(_0x373c0f,_0x215273){_0x373c0f=_0x373c0f-0x0;var _0x501c01=_0x35bb[_0x373c0f];return _0x501c01;};'use strict';var Sequelize=require('sequelize');module[_0xb35b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb35b('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb35b('0x1')]},'authType':{'type':Sequelize[_0xb35b('0x2')](_0xb35b('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xb35b('0x1')]},'consumerSecret':{'type':Sequelize[_0xb35b('0x1')]},'token':{'type':Sequelize[_0xb35b('0x1')]},'tokenSecret':{'type':Sequelize[_0xb35b('0x1')]},'serverUrl':{'type':Sequelize[_0xb35b('0x1')]},'type':{'type':Sequelize[_0xb35b('0x2')](_0xb35b('0x4'),'newTab'),'defaultValue':_0xb35b('0x4')}}; \ No newline at end of file +var _0x2f16=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x4196a3,_0x3685de){var _0x17d255=function(_0x27bef6){while(--_0x27bef6){_0x4196a3['push'](_0x4196a3['shift']());}};_0x17d255(++_0x3685de);}(_0x2f16,0x18c));var _0x62f1=function(_0x1d2c63,_0x4bf487){_0x1d2c63=_0x1d2c63-0x0;var _0x498857=_0x2f16[_0x1d2c63];return _0x498857;};'use strict';var Sequelize=require(_0x62f1('0x0'));module[_0x62f1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x62f1('0x2')]},'username':{'type':Sequelize[_0x62f1('0x2')]},'remoteUri':{'type':Sequelize[_0x62f1('0x2')]},'authType':{'type':Sequelize[_0x62f1('0x3')](_0x62f1('0x4')),'defaultValue':_0x62f1('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x62f1('0x2')]},'consumerSecret':{'type':Sequelize[_0x62f1('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x62f1('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x62f1('0x3')](_0x62f1('0x5'),_0x62f1('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 0fcd23d..552b3a6 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 _0x9f38=['destroy','stack','name','send','DeskAccount','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','keys','create','body','find','params','getConfigurations','DeskConfiguration','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','username','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','info','debug','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x4e31a7,_0x144a35){var _0x1a26e7=function(_0x5ad2e0){while(--_0x5ad2e0){_0x4e31a7['push'](_0x4e31a7['shift']());}};_0x1a26e7(++_0x144a35);}(_0x9f38,0x153));var _0x89f3=function(_0x801009,_0x4a2c66){_0x801009=_0x801009-0x0;var _0x1c8d3f=_0x9f38[_0x801009];return _0x1c8d3f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x89f3('0x0'));var zipdir=require(_0x89f3('0x1'));var jsonpatch=require(_0x89f3('0x2'));var rp=require('request-promise');var moment=require(_0x89f3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89f3('0x4'));var path=require(_0x89f3('0x5'));var sox=require(_0x89f3('0x6'));var csv=require(_0x89f3('0x7'));var ejs=require(_0x89f3('0x8'));var fs=require('fs');var _=require(_0x89f3('0x9'));var squel=require(_0x89f3('0xa'));var crypto=require('crypto');var jsforce=require(_0x89f3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x89f3('0xc'));var Papa=require(_0x89f3('0xd'));var Redis=require(_0x89f3('0xe'));var authService=require(_0x89f3('0xf'));var qs=require(_0x89f3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89f3('0x11'));var logger=require(_0x89f3('0x12'))(_0x89f3('0x13'));var utils=require(_0x89f3('0x14'));var config=require(_0x89f3('0x15'));var db=require(_0x89f3('0x16'))['db'];var integrations=require(_0x89f3('0x17'));var jayson=require(_0x89f3('0x18'));var client=jayson[_0x89f3('0x19')][_0x89f3('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4f207e,_0x36c2f4,_0x4be279){if(_0x4be279){var _0x2133ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2133ab[_0x89f3('0x1b')](_0x36c2f4)){return _0x4f207e;}else{throw new db[(_0x89f3('0x1c'))]['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 _0x4f207e;}}function respondWithRpcPromise(_0x3c9b7a,_0x3aa22e,_0x15059b,_0x525051){return new BPromise(function(_0x25f013,_0x3fa863){var _0x328342=_0x525051||client;return _0x328342[_0x89f3('0x1d')](_0x3c9b7a,_0x15059b)['then'](function(_0x47ab3f){logger[_0x89f3('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x3aa22e,'request\x20sent');logger[_0x89f3('0x1f')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3aa22e,_0x89f3('0x20'),JSON[_0x89f3('0x21')](_0x47ab3f));if(_0x47ab3f[_0x89f3('0x22')]){if(_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x23')]===0x1f4){logger[_0x89f3('0x22')](_0x89f3('0x24'),_0x3aa22e,_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x25')]);return _0x3fa863(_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x25')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x3aa22e,_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x25')]);return _0x25f013(_0x47ab3f[_0x89f3('0x22')][_0x89f3('0x25')]);}else{logger[_0x89f3('0x1e')](_0x89f3('0x24'),_0x3aa22e,'request\x20sent');_0x25f013(_0x47ab3f[_0x89f3('0x26')][_0x89f3('0x25')]);}})[_0x89f3('0x27')](function(_0x439bea){logger[_0x89f3('0x22')](_0x89f3('0x24'),_0x3aa22e,_0x439bea);_0x3fa863(_0x439bea);});});}function respondWithStatusCode(_0x1a75be,_0x16e7a5){_0x16e7a5=_0x16e7a5||0xcc;return function(_0x4ee1c9){if(_0x4ee1c9){return _0x1a75be[_0x89f3('0x28')](_0x16e7a5);}return _0x1a75be[_0x89f3('0x29')](_0x16e7a5)[_0x89f3('0x2a')]();};}function respondWithResult(_0x5d135d,_0x5dbda9){_0x5dbda9=_0x5dbda9||0xc8;return function(_0x309014){if(_0x309014){return _0x5d135d[_0x89f3('0x29')](_0x5dbda9)[_0x89f3('0x2b')](_0x309014);}};}function respondWithFilteredResult(_0x4b016e,_0x18a106){return function(_0x44cf17){if(_0x44cf17){var _0x33ee27=_0x44cf17[_0x89f3('0x2c')],_0x454ed3=_0x18a106[_0x89f3('0x2d')],_0xee92f2=_0x18a106[_0x89f3('0x2d')]+_0x18a106[_0x89f3('0x2e')],_0x3e4809;if(_0xee92f2>=_0x33ee27){_0xee92f2=_0x33ee27;_0x3e4809=0xc8;}else{_0x3e4809=0xce;}_0x4b016e[_0x89f3('0x29')](_0x3e4809);return _0x4b016e[_0x89f3('0x2f')](_0x89f3('0x30'),_0x454ed3+'-'+_0xee92f2+'/'+_0x33ee27)[_0x89f3('0x2b')](_0x44cf17);}return null;};}function patchUpdates(_0x3fb632){return function(_0x290a42){try{jsonpatch[_0x89f3('0x31')](_0x290a42,_0x3fb632,!![]);}catch(_0x5677f6){return BPromise[_0x89f3('0x32')](_0x5677f6);}return _0x290a42[_0x89f3('0x33')]();};}function saveUpdates(_0x30017f,_0x4366d2){return function(_0x229526){if(_0x229526){return _0x229526[_0x89f3('0x34')](_0x30017f)[_0x89f3('0x35')](function(_0x32b306){return _0x32b306;});}return null;};}function removeEntity(_0x2fe17c,_0x3e504f){return function(_0x1a0194){if(_0x1a0194){return _0x1a0194[_0x89f3('0x36')]()[_0x89f3('0x35')](function(){_0x2fe17c[_0x89f3('0x29')](0xcc)[_0x89f3('0x2a')]();});}};}function handleEntityNotFound(_0x204e1a,_0x1beca6){return function(_0x453cf9){if(!_0x453cf9){_0x204e1a[_0x89f3('0x28')](0x194);}return _0x453cf9;};}function handleError(_0x2e91df,_0x1e76d7){_0x1e76d7=_0x1e76d7||0x1f4;return function(_0x1ef65d){logger[_0x89f3('0x22')](_0x1ef65d[_0x89f3('0x37')]);if(_0x1ef65d[_0x89f3('0x38')]){delete _0x1ef65d[_0x89f3('0x38')];}_0x2e91df['status'](_0x1e76d7)[_0x89f3('0x39')](_0x1ef65d);};}exports['index']=function(_0x3fdd68,_0x4796d1){var _0x191c5e={},_0x1efa99={},_0x31e48e={'count':0x0,'rows':[]};var _0x266545=_['map'](db[_0x89f3('0x3a')][_0x89f3('0x3b')],function(_0x42f250){return{'name':_0x42f250['fieldName'],'type':_0x42f250[_0x89f3('0x3c')][_0x89f3('0x3d')]};});_0x1efa99[_0x89f3('0x3e')]=_['map'](_0x266545,_0x89f3('0x38'));_0x1efa99[_0x89f3('0x3f')]=_['keys'](_0x3fdd68[_0x89f3('0x3f')]);_0x1efa99['filters']=_['intersection'](_0x1efa99[_0x89f3('0x3e')],_0x1efa99[_0x89f3('0x3f')]);_0x191c5e[_0x89f3('0x40')]=_[_0x89f3('0x41')](_0x1efa99[_0x89f3('0x3e')],qs['fields'](_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x42')]));_0x191c5e[_0x89f3('0x40')]=_0x191c5e[_0x89f3('0x40')][_0x89f3('0x43')]?_0x191c5e[_0x89f3('0x40')]:_0x1efa99[_0x89f3('0x3e')];if(!_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x44')](_0x89f3('0x45'))){_0x191c5e[_0x89f3('0x2e')]=qs[_0x89f3('0x2e')](_0x3fdd68['query'][_0x89f3('0x2e')]);_0x191c5e[_0x89f3('0x2d')]=qs[_0x89f3('0x2d')](_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x2d')]);}_0x191c5e['order']=qs[_0x89f3('0x46')](_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x46')]);_0x191c5e[_0x89f3('0x47')]=qs[_0x89f3('0x48')](_[_0x89f3('0x49')](_0x3fdd68[_0x89f3('0x3f')],_0x1efa99[_0x89f3('0x48')]),_0x266545);if(_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x4a')]){_0x191c5e[_0x89f3('0x47')]=_[_0x89f3('0x4b')](_0x191c5e[_0x89f3('0x47')],{'$or':_[_0x89f3('0x4c')](_0x266545,function(_0xa160b7){if(_0xa160b7['type']!==_0x89f3('0x4d')){var _0x2ae5d4={};_0x2ae5d4[_0xa160b7[_0x89f3('0x38')]]={'$like':'%'+_0x3fdd68[_0x89f3('0x3f')][_0x89f3('0x4a')]+'%'};return _0x2ae5d4;}})});}_0x191c5e=_[_0x89f3('0x4b')]({},_0x191c5e,_0x3fdd68[_0x89f3('0x4e')]);var _0x4724ce={'where':_0x191c5e[_0x89f3('0x47')]};return db[_0x89f3('0x3a')]['count'](_0x4724ce)[_0x89f3('0x35')](function(_0x540179){_0x31e48e[_0x89f3('0x2c')]=_0x540179;if(_0x3fdd68[_0x89f3('0x3f')]['includeAll']){_0x191c5e[_0x89f3('0x4f')]=[{'all':!![]}];}return db[_0x89f3('0x3a')][_0x89f3('0x50')](_0x191c5e);})[_0x89f3('0x35')](function(_0x4d9a31){_0x31e48e[_0x89f3('0x51')]=_0x4d9a31;return _0x31e48e;})['then'](respondWithFilteredResult(_0x4796d1,_0x191c5e))[_0x89f3('0x27')](handleError(_0x4796d1,null));};exports[_0x89f3('0x52')]=function(_0x3ebebc,_0x410868){var _0x1a7581={'raw':![],'where':{'id':_0x3ebebc['params']['id']}},_0x29953d={};_0x29953d[_0x89f3('0x3e')]=_[_0x89f3('0x53')](db[_0x89f3('0x3a')][_0x89f3('0x3b')]);_0x29953d[_0x89f3('0x3f')]=_[_0x89f3('0x53')](_0x3ebebc[_0x89f3('0x3f')]);_0x29953d[_0x89f3('0x48')]=_[_0x89f3('0x41')](_0x29953d[_0x89f3('0x3e')],_0x29953d[_0x89f3('0x3f')]);_0x1a7581[_0x89f3('0x40')]=_['intersection'](_0x29953d[_0x89f3('0x3e')],qs[_0x89f3('0x42')](_0x3ebebc[_0x89f3('0x3f')][_0x89f3('0x42')]));_0x1a7581['attributes']=_0x1a7581[_0x89f3('0x40')][_0x89f3('0x43')]?_0x1a7581['attributes']:_0x29953d[_0x89f3('0x3e')];if(_0x3ebebc[_0x89f3('0x3f')]['includeAll']){_0x1a7581[_0x89f3('0x4f')]=[{'all':!![]}];}_0x1a7581=_['merge']({},_0x1a7581,_0x3ebebc[_0x89f3('0x4e')]);return db[_0x89f3('0x3a')]['find'](_0x1a7581)[_0x89f3('0x35')](handleEntityNotFound(_0x410868,null))[_0x89f3('0x35')](respondWithResult(_0x410868,null))[_0x89f3('0x27')](handleError(_0x410868,null));};exports[_0x89f3('0x54')]=function(_0x54d4d1,_0x3aab95){return db[_0x89f3('0x3a')][_0x89f3('0x54')](_0x54d4d1[_0x89f3('0x55')],{})['then'](respondWithResult(_0x3aab95,0xc9))[_0x89f3('0x27')](handleError(_0x3aab95,null));};exports[_0x89f3('0x34')]=function(_0x3cb786,_0x50e1dd){if(_0x3cb786[_0x89f3('0x55')]['id']){delete _0x3cb786[_0x89f3('0x55')]['id'];}return db[_0x89f3('0x3a')][_0x89f3('0x56')]({'where':{'id':_0x3cb786[_0x89f3('0x57')]['id']}})[_0x89f3('0x35')](handleEntityNotFound(_0x50e1dd,null))[_0x89f3('0x35')](saveUpdates(_0x3cb786[_0x89f3('0x55')],null))[_0x89f3('0x35')](respondWithResult(_0x50e1dd,null))[_0x89f3('0x27')](handleError(_0x50e1dd,null));};exports[_0x89f3('0x36')]=function(_0x2c9bc,_0x18c6fa){return db[_0x89f3('0x3a')]['find']({'where':{'id':_0x2c9bc[_0x89f3('0x57')]['id']}})[_0x89f3('0x35')](handleEntityNotFound(_0x18c6fa,null))['then'](removeEntity(_0x18c6fa,null))[_0x89f3('0x27')](handleError(_0x18c6fa,null));};exports[_0x89f3('0x58')]=function(_0x56bbde,_0x4de4f0,_0x398bc4){var _0x4adc85={};var _0x11c978={};var _0x4f9252;var _0x5680e3;return db['DeskAccount']['findOne']({'where':{'id':_0x56bbde[_0x89f3('0x57')]['id']}})['then'](handleEntityNotFound(_0x4de4f0,null))['then'](function(_0x2108db){if(_0x2108db){_0x4f9252=_0x2108db;_0x11c978[_0x89f3('0x3e')]=_[_0x89f3('0x53')](db[_0x89f3('0x59')]['rawAttributes']);_0x11c978[_0x89f3('0x3f')]=_[_0x89f3('0x53')](_0x56bbde['query']);_0x11c978[_0x89f3('0x48')]=_[_0x89f3('0x41')](_0x11c978[_0x89f3('0x3e')],_0x11c978[_0x89f3('0x3f')]);_0x4adc85[_0x89f3('0x40')]=_[_0x89f3('0x41')](_0x11c978['model'],qs['fields'](_0x56bbde['query'][_0x89f3('0x42')]));_0x4adc85['attributes']=_0x4adc85['attributes'][_0x89f3('0x43')]?_0x4adc85[_0x89f3('0x40')]:_0x11c978[_0x89f3('0x3e')];_0x4adc85[_0x89f3('0x5a')]=qs[_0x89f3('0x46')](_0x56bbde['query'][_0x89f3('0x46')]);_0x4adc85[_0x89f3('0x47')]=qs[_0x89f3('0x48')](_[_0x89f3('0x49')](_0x56bbde[_0x89f3('0x3f')],_0x11c978['filters']));if(_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x4a')]){_0x4adc85[_0x89f3('0x47')]=_[_0x89f3('0x4b')](_0x4adc85['where'],{'$or':_[_0x89f3('0x4c')](_0x4adc85[_0x89f3('0x40')],function(_0x407022){var _0x14b790={};_0x14b790[_0x407022]={'$like':'%'+_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x4a')]+'%'};return _0x14b790;})});}_0x4adc85=_[_0x89f3('0x4b')]({},_0x4adc85,_0x56bbde[_0x89f3('0x4e')]);return _0x4f9252['getConfigurations'](_0x4adc85);}})[_0x89f3('0x35')](function(_0x3acaee){if(_0x3acaee){_0x5680e3=_0x3acaee[_0x89f3('0x43')];if(!_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x44')](_0x89f3('0x45'))){_0x4adc85['limit']=qs[_0x89f3('0x2e')](_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x2e')]);_0x4adc85[_0x89f3('0x2d')]=qs['offset'](_0x56bbde[_0x89f3('0x3f')][_0x89f3('0x2d')]);}return _0x4f9252[_0x89f3('0x58')](_0x4adc85);}})['then'](function(_0xcd5a70){if(_0xcd5a70){return _0xcd5a70?{'count':_0x5680e3,'rows':_0xcd5a70}:null;}})[_0x89f3('0x35')](respondWithResult(_0x4de4f0,null))['catch'](handleError(_0x4de4f0,null));};exports[_0x89f3('0x5b')]=function(_0x1c30ca,_0x50b340,_0x2d3755){if(_0x1c30ca[_0x89f3('0x55')]['id']){delete _0x1c30ca[_0x89f3('0x55')]['id'];}return db['DeskAccount'][_0x89f3('0x5c')]({'where':{'id':_0x1c30ca['params']['id']}})['then'](handleEntityNotFound(_0x50b340,null))[_0x89f3('0x35')](function(_0x1db211){if(_0x1db211){_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x5d')]=_0x1db211['id'];_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x5e')]=integrations[_0x89f3('0x5f')](_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x60')],_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x3c')]);_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x61')]=integrations[_0x89f3('0x62')](_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x60')],_0x1c30ca[_0x89f3('0x55')][_0x89f3('0x3c')]);return db['DeskConfiguration']['create'](_0x1c30ca[_0x89f3('0x55')],{'include':[{'model':db[_0x89f3('0x63')],'as':_0x89f3('0x5e')},{'model':db[_0x89f3('0x63')],'as':_0x89f3('0x61')}]});}return null;})[_0x89f3('0x35')](respondWithResult(_0x50b340,null))[_0x89f3('0x27')](handleError(_0x50b340,null));};exports[_0x89f3('0x64')]=function(_0x31e304,_0x3ebcfe,_0x3cd402){var _0x15dc58=[{'name':_0x89f3('0x65'),'label':_0x89f3('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 _0xc251e6='';return db[_0x89f3('0x3a')][_0x89f3('0x5c')]({'where':{'id':_0x31e304[_0x89f3('0x57')]['id']},'attributes':['id',_0x89f3('0x66'),_0x89f3('0x67'),'username',_0x89f3('0x68'),_0x89f3('0x69'),_0x89f3('0x6a'),_0x89f3('0x6b'),_0x89f3('0x6c')]})['then'](handleEntityNotFound(_0x3ebcfe,null))[_0x89f3('0x35')](function(_0x428757){if(_0x428757){_0xc251e6=_0x428757[_0x89f3('0x66')];var _0x25ac00=_0xc251e6[_0x89f3('0x6d')](-0x1);if(_0x25ac00==='/'){_0xc251e6=_0xc251e6[_0x89f3('0x6e')](0x0,_0xc251e6[_0x89f3('0x6f')](_0x25ac00));}var _0x338fcb={'method':_0x89f3('0x70'),'uri':util[_0x89f3('0x71')](_0x89f3('0x72'),_0xc251e6),'headers':{'Content-Type':'application/json','Accept':_0x89f3('0x73')},'json':!![]};if(_0x428757[_0x89f3('0x67')]===_0x89f3('0x74')){_0x338fcb[_0x89f3('0x75')][_0x89f3('0x76')]=util[_0x89f3('0x71')](_0x89f3('0x77'),new Buffer(util[_0x89f3('0x71')]('%s:%s',_0x428757[_0x89f3('0x78')],_0x428757[_0x89f3('0x68')]))[_0x89f3('0x79')](_0x89f3('0x7a')));}return rp(_0x338fcb)[_0x89f3('0x35')](function(_0x4c52a0){return _0x15dc58[_0x89f3('0x7b')](_[_0x89f3('0x4c')](_0x4c52a0[_0x89f3('0x7c')][_0x89f3('0x7d')],function(_0x296625){return{'id':_0x296625[_0x89f3('0x38')],'name':_0x296625[_0x89f3('0x38')],'type':_0x296625[_0x89f3('0x3c')],'active':_0x296625[_0x89f3('0x7e')],'label':_0x296625[_0x89f3('0x7f')],'custom':!![]};}));});}})['then'](function(_0x5b675f){return{'count':_0x5b675f[_0x89f3('0x43')],'rows':_0x5b675f};})[_0x89f3('0x35')](respondWithResult(_0x3ebcfe,null))['catch'](function(_0x42bd46){var _0x3f0047=_0x31e304[_0x89f3('0x3f')][_0x89f3('0x1b')]?0x1f4:_0x42bd46['statusCode']||0x1f4;logger['error'](_0x89f3('0x80'),_0x89f3('0x64'),_0x3f0047,JSON[_0x89f3('0x21')](_0x42bd46));delete _0x42bd46['name'];if(_0x3f0047===0x191){_0x3f0047=0x190;}_0x3ebcfe['status'](_0x3f0047)[_0x89f3('0x39')](_0x31e304[_0x89f3('0x3f')]['test']?{'message':_0x89f3('0x81'),'statusCode':_0x42bd46[_0x89f3('0x82')]}:_0x42bd46);});}; \ No newline at end of file +var _0x008b=['getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Basic\x20%s','toString','_embedded','entries','active','label','statusCode','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','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/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','rows','catch','show','params','create','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','channel','Descriptions','DeskField'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x008b,0x105));var _0xb008=function(_0x51463b,_0x58ddbc){_0x51463b=_0x51463b-0x0;var _0x5d99f1=_0x008b[_0x51463b];return _0x5d99f1;};'use strict';var pdf=require(_0xb008('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb008('0x1'));var zipdir=require(_0xb008('0x2'));var jsonpatch=require(_0xb008('0x3'));var rp=require(_0xb008('0x4'));var moment=require(_0xb008('0x5'));var BPromise=require(_0xb008('0x6'));var Mustache=require('mustache');var util=require(_0xb008('0x7'));var path=require(_0xb008('0x8'));var sox=require(_0xb008('0x9'));var csv=require(_0xb008('0xa'));var ejs=require(_0xb008('0xb'));var fs=require('fs');var _=require(_0xb008('0xc'));var squel=require(_0xb008('0xd'));var crypto=require(_0xb008('0xe'));var jsforce=require(_0xb008('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb008('0xa'));var querystring=require('querystring');var Papa=require(_0xb008('0x10'));var Redis=require(_0xb008('0x11'));var authService=require(_0xb008('0x12'));var qs=require(_0xb008('0x13'));var as=require(_0xb008('0x14'));var hardwareService=require(_0xb008('0x15'));var logger=require(_0xb008('0x16'))(_0xb008('0x17'));var utils=require('../../config/utils');var config=require(_0xb008('0x18'));var db=require(_0xb008('0x19'))['db'];var integrations=require(_0xb008('0x1a'));var jayson=require(_0xb008('0x1b'));var client=jayson[_0xb008('0x1c')][_0xb008('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x41f532,_0x2ef879,_0x3885e3){if(_0x3885e3){var _0x13ed41=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x13ed41['test'](_0x2ef879)){return _0x41f532;}else{throw new db[(_0xb008('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 _0x41f532;}}function respondWithRpcPromise(_0x502155,_0x33c31b,_0x5b8cf7,_0xd4df1f){return new BPromise(function(_0x161c36,_0xa770bb){var _0x514425=_0xd4df1f||client;return _0x514425['request'](_0x502155,_0x5b8cf7)[_0xb008('0x1f')](function(_0x1ca64b){logger[_0xb008('0x20')](_0xb008('0x21'),_0x33c31b,_0xb008('0x22'));logger[_0xb008('0x23')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x33c31b,'request\x20sent',JSON[_0xb008('0x24')](_0x1ca64b));if(_0x1ca64b[_0xb008('0x25')]){if(_0x1ca64b[_0xb008('0x25')][_0xb008('0x26')]===0x1f4){logger['error'](_0xb008('0x21'),_0x33c31b,_0x1ca64b['error'][_0xb008('0x27')]);return _0xa770bb(_0x1ca64b[_0xb008('0x25')][_0xb008('0x27')]);}logger['error'](_0xb008('0x21'),_0x33c31b,_0x1ca64b['error'][_0xb008('0x27')]);return _0x161c36(_0x1ca64b[_0xb008('0x25')][_0xb008('0x27')]);}else{logger[_0xb008('0x20')]('DeskAccount,\x20%s,\x20%s',_0x33c31b,_0xb008('0x22'));_0x161c36(_0x1ca64b[_0xb008('0x28')][_0xb008('0x27')]);}})['catch'](function(_0xd2cb86){logger[_0xb008('0x25')](_0xb008('0x21'),_0x33c31b,_0xd2cb86);_0xa770bb(_0xd2cb86);});});}function respondWithStatusCode(_0x391e0c,_0x5e6723){_0x5e6723=_0x5e6723||0xcc;return function(_0x13655d){if(_0x13655d){return _0x391e0c[_0xb008('0x29')](_0x5e6723);}return _0x391e0c[_0xb008('0x2a')](_0x5e6723)[_0xb008('0x2b')]();};}function respondWithResult(_0x518446,_0x572caf){_0x572caf=_0x572caf||0xc8;return function(_0x54f297){if(_0x54f297){return _0x518446['status'](_0x572caf)[_0xb008('0x2c')](_0x54f297);}};}function respondWithFilteredResult(_0x42ca39,_0x19c624){return function(_0x51d106){if(_0x51d106){var _0x449a19=_0x51d106[_0xb008('0x2d')],_0x4b696e=_0x19c624['offset'],_0x492150=_0x19c624[_0xb008('0x2e')]+_0x19c624[_0xb008('0x2f')],_0xe0d130;if(_0x492150>=_0x449a19){_0x492150=_0x449a19;_0xe0d130=0xc8;}else{_0xe0d130=0xce;}_0x42ca39[_0xb008('0x2a')](_0xe0d130);return _0x42ca39[_0xb008('0x30')](_0xb008('0x31'),_0x4b696e+'-'+_0x492150+'/'+_0x449a19)[_0xb008('0x2c')](_0x51d106);}return null;};}function patchUpdates(_0x2df8cf){return function(_0x44742f){try{jsonpatch['apply'](_0x44742f,_0x2df8cf,!![]);}catch(_0x262f15){return BPromise['reject'](_0x262f15);}return _0x44742f[_0xb008('0x32')]();};}function saveUpdates(_0xfd83de,_0x1141a3){return function(_0x111d06){if(_0x111d06){return _0x111d06[_0xb008('0x33')](_0xfd83de)[_0xb008('0x1f')](function(_0x93e9a9){return _0x93e9a9;});}return null;};}function removeEntity(_0x4e7097,_0x3384a2){return function(_0x22f4df){if(_0x22f4df){return _0x22f4df[_0xb008('0x34')]()[_0xb008('0x1f')](function(){_0x4e7097['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50a38b,_0x44f1d4){return function(_0x5dab5f){if(!_0x5dab5f){_0x50a38b[_0xb008('0x29')](0x194);}return _0x5dab5f;};}function handleError(_0x47638e,_0x3893bc){_0x3893bc=_0x3893bc||0x1f4;return function(_0x1050a6){logger['error'](_0x1050a6['stack']);if(_0x1050a6['name']){delete _0x1050a6[_0xb008('0x35')];}_0x47638e[_0xb008('0x2a')](_0x3893bc)[_0xb008('0x36')](_0x1050a6);};}exports[_0xb008('0x37')]=function(_0x594241,_0x4fff75){var _0x848eba={},_0x4110ef={},_0x402362={'count':0x0,'rows':[]};var _0x2ef549=_[_0xb008('0x38')](db[_0xb008('0x39')][_0xb008('0x3a')],function(_0x3b3790){return{'name':_0x3b3790[_0xb008('0x3b')],'type':_0x3b3790[_0xb008('0x3c')][_0xb008('0x3d')]};});_0x4110ef[_0xb008('0x3e')]=_[_0xb008('0x38')](_0x2ef549,_0xb008('0x35'));_0x4110ef[_0xb008('0x3f')]=_[_0xb008('0x40')](_0x594241[_0xb008('0x3f')]);_0x4110ef[_0xb008('0x41')]=_[_0xb008('0x42')](_0x4110ef[_0xb008('0x3e')],_0x4110ef[_0xb008('0x3f')]);_0x848eba[_0xb008('0x43')]=_['intersection'](_0x4110ef[_0xb008('0x3e')],qs[_0xb008('0x44')](_0x594241[_0xb008('0x3f')][_0xb008('0x44')]));_0x848eba[_0xb008('0x43')]=_0x848eba['attributes'][_0xb008('0x45')]?_0x848eba[_0xb008('0x43')]:_0x4110ef['model'];if(!_0x594241[_0xb008('0x3f')][_0xb008('0x46')](_0xb008('0x47'))){_0x848eba[_0xb008('0x2f')]=qs[_0xb008('0x2f')](_0x594241['query'][_0xb008('0x2f')]);_0x848eba[_0xb008('0x2e')]=qs[_0xb008('0x2e')](_0x594241['query'][_0xb008('0x2e')]);}_0x848eba['order']=qs[_0xb008('0x48')](_0x594241[_0xb008('0x3f')]['sort']);_0x848eba[_0xb008('0x49')]=qs[_0xb008('0x41')](_['pick'](_0x594241[_0xb008('0x3f')],_0x4110ef[_0xb008('0x41')]),_0x2ef549);if(_0x594241[_0xb008('0x3f')]['filter']){_0x848eba[_0xb008('0x49')]=_['merge'](_0x848eba['where'],{'$or':_[_0xb008('0x38')](_0x2ef549,function(_0x38757a){if(_0x38757a[_0xb008('0x3c')]!=='VIRTUAL'){var _0x18679f={};_0x18679f[_0x38757a[_0xb008('0x35')]]={'$like':'%'+_0x594241[_0xb008('0x3f')][_0xb008('0x4a')]+'%'};return _0x18679f;}})});}_0x848eba=_[_0xb008('0x4b')]({},_0x848eba,_0x594241[_0xb008('0x4c')]);var _0x5a0f6d={'where':_0x848eba[_0xb008('0x49')]};return db[_0xb008('0x39')]['count'](_0x5a0f6d)[_0xb008('0x1f')](function(_0x263cf8){_0x402362[_0xb008('0x2d')]=_0x263cf8;if(_0x594241[_0xb008('0x3f')]['includeAll']){_0x848eba[_0xb008('0x4d')]=[{'all':!![]}];}return db[_0xb008('0x39')]['findAll'](_0x848eba);})[_0xb008('0x1f')](function(_0x2dcc26){_0x402362[_0xb008('0x4e')]=_0x2dcc26;return _0x402362;})[_0xb008('0x1f')](respondWithFilteredResult(_0x4fff75,_0x848eba))[_0xb008('0x4f')](handleError(_0x4fff75,null));};exports[_0xb008('0x50')]=function(_0x2fd3e7,_0x27f162){var _0x50f2c7={'raw':![],'where':{'id':_0x2fd3e7[_0xb008('0x51')]['id']}},_0x193e7c={};_0x193e7c[_0xb008('0x3e')]=_[_0xb008('0x40')](db[_0xb008('0x39')][_0xb008('0x3a')]);_0x193e7c[_0xb008('0x3f')]=_[_0xb008('0x40')](_0x2fd3e7[_0xb008('0x3f')]);_0x193e7c[_0xb008('0x41')]=_[_0xb008('0x42')](_0x193e7c[_0xb008('0x3e')],_0x193e7c[_0xb008('0x3f')]);_0x50f2c7[_0xb008('0x43')]=_[_0xb008('0x42')](_0x193e7c[_0xb008('0x3e')],qs['fields'](_0x2fd3e7[_0xb008('0x3f')][_0xb008('0x44')]));_0x50f2c7[_0xb008('0x43')]=_0x50f2c7['attributes']['length']?_0x50f2c7[_0xb008('0x43')]:_0x193e7c['model'];if(_0x2fd3e7[_0xb008('0x3f')]['includeAll']){_0x50f2c7['include']=[{'all':!![]}];}_0x50f2c7=_[_0xb008('0x4b')]({},_0x50f2c7,_0x2fd3e7['options']);return db['DeskAccount']['find'](_0x50f2c7)[_0xb008('0x1f')](handleEntityNotFound(_0x27f162,null))['then'](respondWithResult(_0x27f162,null))[_0xb008('0x4f')](handleError(_0x27f162,null));};exports['create']=function(_0x4ee02f,_0x345696){return db[_0xb008('0x39')][_0xb008('0x52')](_0x4ee02f[_0xb008('0x53')],{})[_0xb008('0x1f')](respondWithResult(_0x345696,0xc9))[_0xb008('0x4f')](handleError(_0x345696,null));};exports[_0xb008('0x33')]=function(_0x1efdb9,_0x26eb6d){if(_0x1efdb9['body']['id']){delete _0x1efdb9[_0xb008('0x53')]['id'];}return db[_0xb008('0x39')][_0xb008('0x54')]({'where':{'id':_0x1efdb9[_0xb008('0x51')]['id']}})[_0xb008('0x1f')](handleEntityNotFound(_0x26eb6d,null))[_0xb008('0x1f')](saveUpdates(_0x1efdb9[_0xb008('0x53')],null))[_0xb008('0x1f')](respondWithResult(_0x26eb6d,null))[_0xb008('0x4f')](handleError(_0x26eb6d,null));};exports[_0xb008('0x34')]=function(_0x53a28d,_0x4432dd){return db[_0xb008('0x39')][_0xb008('0x54')]({'where':{'id':_0x53a28d['params']['id']}})[_0xb008('0x1f')](handleEntityNotFound(_0x4432dd,null))[_0xb008('0x1f')](removeEntity(_0x4432dd,null))[_0xb008('0x4f')](handleError(_0x4432dd,null));};exports[_0xb008('0x55')]=function(_0xa503b3,_0x3dec13,_0x13fb6a){var _0x2cc9a3={};var _0x50ebf3={};var _0x5dce29;var _0x32ad2c;return db[_0xb008('0x39')][_0xb008('0x56')]({'where':{'id':_0xa503b3[_0xb008('0x51')]['id']}})[_0xb008('0x1f')](handleEntityNotFound(_0x3dec13,null))['then'](function(_0x54e3bc){if(_0x54e3bc){_0x5dce29=_0x54e3bc;_0x50ebf3[_0xb008('0x3e')]=_[_0xb008('0x40')](db[_0xb008('0x57')][_0xb008('0x3a')]);_0x50ebf3[_0xb008('0x3f')]=_[_0xb008('0x40')](_0xa503b3[_0xb008('0x3f')]);_0x50ebf3[_0xb008('0x41')]=_[_0xb008('0x42')](_0x50ebf3[_0xb008('0x3e')],_0x50ebf3[_0xb008('0x3f')]);_0x2cc9a3[_0xb008('0x43')]=_['intersection'](_0x50ebf3[_0xb008('0x3e')],qs['fields'](_0xa503b3[_0xb008('0x3f')][_0xb008('0x44')]));_0x2cc9a3['attributes']=_0x2cc9a3[_0xb008('0x43')][_0xb008('0x45')]?_0x2cc9a3['attributes']:_0x50ebf3[_0xb008('0x3e')];_0x2cc9a3['order']=qs[_0xb008('0x48')](_0xa503b3['query'][_0xb008('0x48')]);_0x2cc9a3[_0xb008('0x49')]=qs['filters'](_['pick'](_0xa503b3[_0xb008('0x3f')],_0x50ebf3[_0xb008('0x41')]));if(_0xa503b3[_0xb008('0x3f')][_0xb008('0x4a')]){_0x2cc9a3[_0xb008('0x49')]=_[_0xb008('0x4b')](_0x2cc9a3[_0xb008('0x49')],{'$or':_[_0xb008('0x38')](_0x2cc9a3[_0xb008('0x43')],function(_0xd0c530){var _0x43ba73={};_0x43ba73[_0xd0c530]={'$like':'%'+_0xa503b3[_0xb008('0x3f')]['filter']+'%'};return _0x43ba73;})});}_0x2cc9a3=_[_0xb008('0x4b')]({},_0x2cc9a3,_0xa503b3[_0xb008('0x4c')]);return _0x5dce29[_0xb008('0x55')](_0x2cc9a3);}})['then'](function(_0x2cc1bf){if(_0x2cc1bf){_0x32ad2c=_0x2cc1bf['length'];if(!_0xa503b3[_0xb008('0x3f')][_0xb008('0x46')](_0xb008('0x47'))){_0x2cc9a3['limit']=qs[_0xb008('0x2f')](_0xa503b3[_0xb008('0x3f')][_0xb008('0x2f')]);_0x2cc9a3[_0xb008('0x2e')]=qs['offset'](_0xa503b3[_0xb008('0x3f')][_0xb008('0x2e')]);}return _0x5dce29[_0xb008('0x55')](_0x2cc9a3);}})[_0xb008('0x1f')](function(_0x212521){if(_0x212521){return _0x212521?{'count':_0x32ad2c,'rows':_0x212521}:null;}})[_0xb008('0x1f')](respondWithResult(_0x3dec13,null))['catch'](handleError(_0x3dec13,null));};exports[_0xb008('0x58')]=function(_0x416649,_0x3c5ceb,_0x6c82d){if(_0x416649[_0xb008('0x53')]['id']){delete _0x416649['body']['id'];}return db['DeskAccount'][_0xb008('0x56')]({'where':{'id':_0x416649[_0xb008('0x51')]['id']}})[_0xb008('0x1f')](handleEntityNotFound(_0x3c5ceb,null))[_0xb008('0x1f')](function(_0x157273){if(_0x157273){_0x416649[_0xb008('0x53')]['AccountId']=_0x157273['id'];_0x416649[_0xb008('0x53')][_0xb008('0x59')]=integrations['getSubjects'](_0x416649[_0xb008('0x53')][_0xb008('0x5a')],_0x416649[_0xb008('0x53')][_0xb008('0x3c')]);_0x416649['body'][_0xb008('0x5b')]=integrations['getDescriptions'](_0x416649[_0xb008('0x53')][_0xb008('0x5a')],_0x416649[_0xb008('0x53')][_0xb008('0x3c')]);return db[_0xb008('0x57')]['create'](_0x416649['body'],{'include':[{'model':db[_0xb008('0x5c')],'as':_0xb008('0x59')},{'model':db[_0xb008('0x5c')],'as':_0xb008('0x5b')}]});}return null;})['then'](respondWithResult(_0x3c5ceb,null))[_0xb008('0x4f')](handleError(_0x3c5ceb,null));};exports[_0xb008('0x5d')]=function(_0x10a49a,_0x50c754,_0x4e9fb8){var _0x41a676=[{'name':'priority','label':_0xb008('0x5e'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x53e5bf='';return db[_0xb008('0x39')][_0xb008('0x56')]({'where':{'id':_0x10a49a[_0xb008('0x51')]['id']},'attributes':['id','remoteUri',_0xb008('0x5f'),_0xb008('0x60'),_0xb008('0x61'),'consumerKey',_0xb008('0x62'),_0xb008('0x63'),_0xb008('0x64')]})[_0xb008('0x1f')](handleEntityNotFound(_0x50c754,null))[_0xb008('0x1f')](function(_0x5e820e){if(_0x5e820e){_0x53e5bf=_0x5e820e[_0xb008('0x65')];var _0x134603=_0x53e5bf[_0xb008('0x66')](-0x1);if(_0x134603==='/'){_0x53e5bf=_0x53e5bf['substring'](0x0,_0x53e5bf[_0xb008('0x67')](_0x134603));}var _0x3df177={'method':_0xb008('0x68'),'uri':util[_0xb008('0x69')](_0xb008('0x6a'),_0x53e5bf),'headers':{'Content-Type':_0xb008('0x6b'),'Accept':'application/json'},'json':!![]};if(_0x5e820e[_0xb008('0x5f')]==='basic'){_0x3df177[_0xb008('0x6c')]['Authorization']=util[_0xb008('0x69')](_0xb008('0x6d'),new Buffer(util[_0xb008('0x69')]('%s:%s',_0x5e820e[_0xb008('0x60')],_0x5e820e[_0xb008('0x61')]))[_0xb008('0x6e')]('base64'));}return rp(_0x3df177)[_0xb008('0x1f')](function(_0x1f0a8a){return _0x41a676['concat'](_['map'](_0x1f0a8a[_0xb008('0x6f')][_0xb008('0x70')],function(_0x31b787){return{'id':_0x31b787[_0xb008('0x35')],'name':_0x31b787[_0xb008('0x35')],'type':_0x31b787[_0xb008('0x3c')],'active':_0x31b787[_0xb008('0x71')],'label':_0x31b787[_0xb008('0x72')],'custom':!![]};}));});}})[_0xb008('0x1f')](function(_0x16daa6){return{'count':_0x16daa6[_0xb008('0x45')],'rows':_0x16daa6};})[_0xb008('0x1f')](respondWithResult(_0x50c754,null))[_0xb008('0x4f')](function(_0x459630){var _0x1111a1=_0x10a49a['query']['test']?0x1f4:_0x459630[_0xb008('0x73')]||0x1f4;logger[_0xb008('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xb008('0x5d'),_0x1111a1,JSON[_0xb008('0x24')](_0x459630));delete _0x459630[_0xb008('0x35')];if(_0x1111a1===0x191){_0x1111a1=0x190;}_0x50c754['status'](_0x1111a1)[_0xb008('0x36')](_0x10a49a[_0xb008('0x3f')][_0xb008('0x74')]?{'message':_0xb008('0x75'),'statusCode':_0x459630[_0xb008('0x73')]}:_0x459630);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8920384..bff7458 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 _0xeb48=['moment','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api'];(function(_0x4b0c73,_0x81d8c9){var _0x2e8f0b=function(_0x31c8db){while(--_0x31c8db){_0x4b0c73['push'](_0x4b0c73['shift']());}};_0x2e8f0b(++_0x81d8c9);}(_0xeb48,0xfa));var _0x8eb4=function(_0x15d9aa,_0x2b4405){_0x15d9aa=_0x15d9aa-0x0;var _0x25f3de=_0xeb48[_0x15d9aa];return _0x25f3de;};'use strict';var _=require('lodash');var util=require(_0x8eb4('0x0'));var logger=require(_0x8eb4('0x1'))(_0x8eb4('0x2'));var moment=require(_0x8eb4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8eb4('0x4'));var config=require(_0x8eb4('0x5'));var attributes=require(_0x8eb4('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x8eb4('0x7')]=function(_0x17624e,_0x1ef212){return _0x17624e[_0x8eb4('0x8')](_0x8eb4('0x9'),attributes,{'tableName':_0x8eb4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x612f=['request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x612f,0x19f));var _0xf612=function(_0x4082e3,_0x46da9f){_0x4082e3=_0x4082e3-0x0;var _0x523209=_0x612f[_0x4082e3];return _0x523209;};'use strict';var _=require(_0xf612('0x0'));var util=require(_0xf612('0x1'));var logger=require(_0xf612('0x2'))('api');var moment=require(_0xf612('0x3'));var BPromise=require(_0xf612('0x4'));var rp=require(_0xf612('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf612('0x6'));var config=require(_0xf612('0x7'));var attributes=require(_0xf612('0x8'));var integrations=require(_0xf612('0x9'));module['exports']=function(_0x19a7f4,_0x5b2f69){return _0x19a7f4[_0xf612('0xa')](_0xf612('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 90d782b..516c4f8 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 _0x6a9d=['http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','catch','GetDeskAccount','findAll','options','raw','where','map','model','attributes','include','then','ShowDeskAccount','DeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ee300,_0x59f054){var _0x15717b=function(_0x476c78){while(--_0x476c78){_0x5ee300['push'](_0x5ee300['shift']());}};_0x15717b(++_0x59f054);}(_0x6a9d,0x89));var _0xd6a9=function(_0x801e27,_0x322f08){_0x801e27=_0x801e27-0x0;var _0x24b258=_0x6a9d[_0x801e27];return _0x24b258;};'use strict';var _=require(_0xd6a9('0x0'));var util=require('util');var moment=require(_0xd6a9('0x1'));var BPromise=require(_0xd6a9('0x2'));var rs=require(_0xd6a9('0x3'));var fs=require('fs');var Redis=require(_0xd6a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6a9('0x5'));var logger=require(_0xd6a9('0x6'))(_0xd6a9('0x7'));var config=require(_0xd6a9('0x8'));var jayson=require(_0xd6a9('0x9'));var client=jayson[_0xd6a9('0xa')][_0xd6a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x472390,_0x21d866,_0x531d84){return new BPromise(function(_0xc5f81c,_0x1bacd6){return client[_0xd6a9('0xc')](_0x472390,_0x531d84)['then'](function(_0x8c4f4c){logger[_0xd6a9('0xd')]('DeskAccount,\x20%s,\x20%s',_0x21d866,_0xd6a9('0xe'));logger[_0xd6a9('0xf')](_0xd6a9('0x10'),_0x21d866,'request\x20sent',JSON[_0xd6a9('0x11')](_0x8c4f4c));if(_0x8c4f4c[_0xd6a9('0x12')]){if(_0x8c4f4c[_0xd6a9('0x12')][_0xd6a9('0x13')]===0x1f4){logger[_0xd6a9('0x12')]('DeskAccount,\x20%s,\x20%s',_0x21d866,_0x8c4f4c[_0xd6a9('0x12')]['message']);return _0x1bacd6(_0x8c4f4c[_0xd6a9('0x12')]['message']);}logger[_0xd6a9('0x12')]('DeskAccount,\x20%s,\x20%s',_0x21d866,_0x8c4f4c[_0xd6a9('0x12')][_0xd6a9('0x14')]);return _0xc5f81c(_0x8c4f4c[_0xd6a9('0x12')][_0xd6a9('0x14')]);}else{logger[_0xd6a9('0xd')](_0xd6a9('0x15'),_0x21d866,_0xd6a9('0xe'));_0xc5f81c(_0x8c4f4c[_0xd6a9('0x16')][_0xd6a9('0x14')]);}})[_0xd6a9('0x17')](function(_0x5e54ba){logger['error'](_0xd6a9('0x15'),_0x21d866,_0x5e54ba);_0x1bacd6(_0x5e54ba);});});}exports[_0xd6a9('0x18')]=function(_0x198ec5){var _0x1a3d2f=this;return new Promise(function(_0x2dbf23,_0x2c1b2b){return db['DeskAccount'][_0xd6a9('0x19')]({'raw':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5[_0xd6a9('0x1a')][_0xd6a9('0x1b')]===undefined?!![]:![]:!![],'where':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5['options'][_0xd6a9('0x1c')]||null:null,'attributes':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5[_0xd6a9('0x1a')]['attributes']||null:null,'limit':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5[_0xd6a9('0x1a')]['limit']||null:null,'include':_0x198ec5[_0xd6a9('0x1a')]?_0x198ec5[_0xd6a9('0x1a')]['include']?_[_0xd6a9('0x1d')](_0x198ec5[_0xd6a9('0x1a')]['include'],function(_0x2c4ff8){return{'model':db[_0x2c4ff8[_0xd6a9('0x1e')]],'as':_0x2c4ff8['as'],'attributes':_0x2c4ff8[_0xd6a9('0x1f')],'include':_0x2c4ff8[_0xd6a9('0x20')]?_[_0xd6a9('0x1d')](_0x2c4ff8[_0xd6a9('0x20')],function(_0x779fb6){return{'model':db[_0x779fb6[_0xd6a9('0x1e')]],'as':_0x779fb6['as'],'attributes':_0x779fb6[_0xd6a9('0x1f')],'include':_0x779fb6[_0xd6a9('0x20')]?_[_0xd6a9('0x1d')](_0x779fb6[_0xd6a9('0x20')],function(_0x1ae051){return{'model':db[_0x1ae051[_0xd6a9('0x1e')]],'as':_0x1ae051['as'],'attributes':_0x1ae051[_0xd6a9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd6a9('0x21')](function(_0x4f830f){logger[_0xd6a9('0xd')](_0xd6a9('0x18'),_0x198ec5);logger['debug'](_0xd6a9('0x18'),_0x198ec5,JSON[_0xd6a9('0x11')](_0x4f830f));_0x2dbf23(_0x4f830f);})[_0xd6a9('0x17')](function(_0x89e7db){logger['error'](_0xd6a9('0x18'),_0x89e7db['message'],_0x198ec5);_0x2c1b2b(_0x1a3d2f[_0xd6a9('0x12')](0x1f4,_0x89e7db[_0xd6a9('0x14')]));});});};exports[_0xd6a9('0x22')]=function(_0x584518){var _0x2e008f=this;return new Promise(function(_0x286cbb,_0x3b8f77){return db[_0xd6a9('0x23')][_0xd6a9('0x24')]({'raw':_0x584518[_0xd6a9('0x1a')]?_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x1b')]===undefined?!![]:![]:!![],'where':_0x584518[_0xd6a9('0x1a')]?_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x1c')]||null:null,'attributes':_0x584518[_0xd6a9('0x1a')]?_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x1f')]||null:null,'include':_0x584518['options']?_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x20')]?_[_0xd6a9('0x1d')](_0x584518[_0xd6a9('0x1a')][_0xd6a9('0x20')],function(_0x50bef7){return{'model':db[_0x50bef7['model']],'as':_0x50bef7['as'],'attributes':_0x50bef7[_0xd6a9('0x1f')],'include':_0x50bef7['include']?_[_0xd6a9('0x1d')](_0x50bef7[_0xd6a9('0x20')],function(_0x4615c7){return{'model':db[_0x4615c7[_0xd6a9('0x1e')]],'as':_0x4615c7['as'],'attributes':_0x4615c7['attributes'],'include':_0x4615c7['include']?_[_0xd6a9('0x1d')](_0x4615c7[_0xd6a9('0x20')],function(_0x1e64c2){return{'model':db[_0x1e64c2[_0xd6a9('0x1e')]],'as':_0x1e64c2['as'],'attributes':_0x1e64c2[_0xd6a9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd6a9('0x21')](function(_0x327da8){logger[_0xd6a9('0xd')](_0xd6a9('0x22'),_0x584518);logger[_0xd6a9('0xf')](_0xd6a9('0x22'),_0x584518,JSON[_0xd6a9('0x11')](_0x327da8));_0x286cbb(_0x327da8);})['catch'](function(_0xf7ba74){logger[_0xd6a9('0x12')](_0xd6a9('0x22'),_0xf7ba74[_0xd6a9('0x14')],_0x584518);_0x3b8f77(_0x2e008f[_0xd6a9('0x12')](0x1f4,_0xf7ba74[_0xd6a9('0x14')]));});});}; \ No newline at end of file +var _0xc6aa=['error','code','message','result','catch','GetDeskAccount','DeskAccount','options','include','model','attributes','map','ShowDeskAccount','find','where','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0xc6aa,0xf7));var _0xac6a=function(_0x1dea49,_0x20ec30){_0x1dea49=_0x1dea49-0x0;var _0xada06e=_0xc6aa[_0x1dea49];return _0xada06e;};'use strict';var _=require(_0xac6a('0x0'));var util=require(_0xac6a('0x1'));var moment=require(_0xac6a('0x2'));var BPromise=require(_0xac6a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac6a('0x4'));var db=require(_0xac6a('0x5'))['db'];var utils=require(_0xac6a('0x6'));var logger=require(_0xac6a('0x7'))(_0xac6a('0x8'));var config=require('../../config/environment');var jayson=require(_0xac6a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5db799,_0xd20075,_0x4c42fd){return new BPromise(function(_0x42e574,_0x5e0369){return client[_0xac6a('0xa')](_0x5db799,_0x4c42fd)[_0xac6a('0xb')](function(_0x57c886){logger[_0xac6a('0xc')](_0xac6a('0xd'),_0xd20075,_0xac6a('0xe'));logger[_0xac6a('0xf')](_0xac6a('0x10'),_0xd20075,_0xac6a('0xe'),JSON['stringify'](_0x57c886));if(_0x57c886['error']){if(_0x57c886[_0xac6a('0x11')][_0xac6a('0x12')]===0x1f4){logger[_0xac6a('0x11')](_0xac6a('0xd'),_0xd20075,_0x57c886[_0xac6a('0x11')]['message']);return _0x5e0369(_0x57c886[_0xac6a('0x11')][_0xac6a('0x13')]);}logger['error'](_0xac6a('0xd'),_0xd20075,_0x57c886[_0xac6a('0x11')][_0xac6a('0x13')]);return _0x42e574(_0x57c886[_0xac6a('0x11')][_0xac6a('0x13')]);}else{logger[_0xac6a('0xc')](_0xac6a('0xd'),_0xd20075,'request\x20sent');_0x42e574(_0x57c886[_0xac6a('0x14')][_0xac6a('0x13')]);}})[_0xac6a('0x15')](function(_0x14f3d8){logger[_0xac6a('0x11')](_0xac6a('0xd'),_0xd20075,_0x14f3d8);_0x5e0369(_0x14f3d8);});});}exports[_0xac6a('0x16')]=function(_0x282fad){var _0xac1432=this;return new Promise(function(_0x57fdbe,_0x2bb520){return db[_0xac6a('0x17')]['findAll']({'raw':_0x282fad[_0xac6a('0x18')]?_0x282fad['options']['raw']===undefined?!![]:![]:!![],'where':_0x282fad[_0xac6a('0x18')]?_0x282fad[_0xac6a('0x18')]['where']||null:null,'attributes':_0x282fad[_0xac6a('0x18')]?_0x282fad['options']['attributes']||null:null,'limit':_0x282fad[_0xac6a('0x18')]?_0x282fad['options']['limit']||null:null,'include':_0x282fad[_0xac6a('0x18')]?_0x282fad[_0xac6a('0x18')]['include']?_['map'](_0x282fad[_0xac6a('0x18')][_0xac6a('0x19')],function(_0x38a214){return{'model':db[_0x38a214[_0xac6a('0x1a')]],'as':_0x38a214['as'],'attributes':_0x38a214[_0xac6a('0x1b')],'include':_0x38a214[_0xac6a('0x19')]?_[_0xac6a('0x1c')](_0x38a214[_0xac6a('0x19')],function(_0x577846){return{'model':db[_0x577846[_0xac6a('0x1a')]],'as':_0x577846['as'],'attributes':_0x577846[_0xac6a('0x1b')],'include':_0x577846[_0xac6a('0x19')]?_[_0xac6a('0x1c')](_0x577846[_0xac6a('0x19')],function(_0x3649a6){return{'model':db[_0x3649a6[_0xac6a('0x1a')]],'as':_0x3649a6['as'],'attributes':_0x3649a6[_0xac6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac6a('0xb')](function(_0x3c88ce){logger[_0xac6a('0xc')](_0xac6a('0x16'),_0x282fad);logger[_0xac6a('0xf')](_0xac6a('0x16'),_0x282fad,JSON['stringify'](_0x3c88ce));_0x57fdbe(_0x3c88ce);})[_0xac6a('0x15')](function(_0x32ba12){logger[_0xac6a('0x11')](_0xac6a('0x16'),_0x32ba12['message'],_0x282fad);_0x2bb520(_0xac1432[_0xac6a('0x11')](0x1f4,_0x32ba12[_0xac6a('0x13')]));});});};exports[_0xac6a('0x1d')]=function(_0x1f2c40){var _0x3bec14=this;return new Promise(function(_0x2c8fbb,_0x257c34){return db[_0xac6a('0x17')][_0xac6a('0x1e')]({'raw':_0x1f2c40[_0xac6a('0x18')]?_0x1f2c40[_0xac6a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1f2c40['options']?_0x1f2c40[_0xac6a('0x18')][_0xac6a('0x1f')]||null:null,'attributes':_0x1f2c40['options']?_0x1f2c40[_0xac6a('0x18')][_0xac6a('0x1b')]||null:null,'include':_0x1f2c40['options']?_0x1f2c40[_0xac6a('0x18')][_0xac6a('0x19')]?_[_0xac6a('0x1c')](_0x1f2c40['options']['include'],function(_0x4e2dce){return{'model':db[_0x4e2dce[_0xac6a('0x1a')]],'as':_0x4e2dce['as'],'attributes':_0x4e2dce[_0xac6a('0x1b')],'include':_0x4e2dce[_0xac6a('0x19')]?_[_0xac6a('0x1c')](_0x4e2dce[_0xac6a('0x19')],function(_0xc37248){return{'model':db[_0xc37248[_0xac6a('0x1a')]],'as':_0xc37248['as'],'attributes':_0xc37248[_0xac6a('0x1b')],'include':_0xc37248[_0xac6a('0x19')]?_['map'](_0xc37248['include'],function(_0x305914){return{'model':db[_0x305914[_0xac6a('0x1a')]],'as':_0x305914['as'],'attributes':_0x305914[_0xac6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac6a('0xb')](function(_0x4d794d){logger[_0xac6a('0xc')](_0xac6a('0x1d'),_0x1f2c40);logger[_0xac6a('0xf')]('ShowDeskAccount',_0x1f2c40,JSON[_0xac6a('0x20')](_0x4d794d));_0x2c8fbb(_0x4d794d);})[_0xac6a('0x15')](function(_0x479906){logger[_0xac6a('0x11')](_0xac6a('0x1d'),_0x479906['message'],_0x1f2c40);_0x257c34(_0x3bec14[_0xac6a('0x11')](0x1f4,_0x479906[_0xac6a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7ef6b62..a82e5c1 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 _0x4991=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','put','update','delete','destroy','exports','multer','path','express'];(function(_0xd3990b,_0x50c98e){var _0x3e4a44=function(_0x56a094){while(--_0x56a094){_0xd3990b['push'](_0xd3990b['shift']());}};_0x3e4a44(++_0x50c98e);}(_0x4991,0xf7));var _0x1499=function(_0x4dbf1c,_0x222da9){_0x4dbf1c=_0x4dbf1c-0x0;var _0x5d0cb3=_0x4991[_0x4dbf1c];return _0x5d0cb3;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var auth=require(_0x1499('0x4'));var interaction=require(_0x1499('0x5'));var config=require(_0x1499('0x6'));var controller=require(_0x1499('0x7'));router[_0x1499('0x8')]('/',auth[_0x1499('0x9')](),controller['index']);router[_0x1499('0x8')](_0x1499('0xa'),auth[_0x1499('0x9')](),controller[_0x1499('0xb')]);router[_0x1499('0x8')](_0x1499('0xc'),auth[_0x1499('0x9')](),controller[_0x1499('0xd')]);router['get'](_0x1499('0xe'),auth[_0x1499('0x9')](),controller['getSubjects']);router[_0x1499('0x8')](_0x1499('0xf'),auth['isAuthenticated'](),controller[_0x1499('0x10')]);router[_0x1499('0x8')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x1499('0x11')]('/',auth[_0x1499('0x9')](),controller[_0x1499('0x12')]);router[_0x1499('0x11')](_0x1499('0x13'),auth['isAuthenticated'](),controller['setTags']);router[_0x1499('0x14')]('/:id',auth[_0x1499('0x9')](),controller[_0x1499('0x15')]);router[_0x1499('0x16')](_0x1499('0xa'),auth['isAuthenticated'](),controller[_0x1499('0x17')]);module[_0x1499('0x18')]=router; \ No newline at end of file +var _0xa817=['/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x132f76,_0x210b33){var _0x4d8953=function(_0x67f065){while(--_0x67f065){_0x132f76['push'](_0x132f76['shift']());}};_0x4d8953(++_0x210b33);}(_0xa817,0x7b));var _0x7a81=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0xa817[_0x574ce3];return _0x3447a0;};'use strict';var multer=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var path=require(_0x7a81('0x2'));var timeout=require(_0x7a81('0x3'));var express=require(_0x7a81('0x4'));var router=express[_0x7a81('0x5')]();var auth=require(_0x7a81('0x6'));var interaction=require(_0x7a81('0x7'));var config=require(_0x7a81('0x8'));var controller=require('./intDeskConfiguration.controller');router[_0x7a81('0x9')]('/',auth[_0x7a81('0xa')](),controller['index']);router[_0x7a81('0x9')](_0x7a81('0xb'),auth[_0x7a81('0xa')](),controller[_0x7a81('0xc')]);router[_0x7a81('0x9')](_0x7a81('0xd'),auth['isAuthenticated'](),controller[_0x7a81('0xe')]);router['get']('/:id/subjects',auth[_0x7a81('0xa')](),controller['getSubjects']);router[_0x7a81('0x9')](_0x7a81('0xf'),auth[_0x7a81('0xa')](),controller[_0x7a81('0x10')]);router[_0x7a81('0x9')](_0x7a81('0x11'),auth[_0x7a81('0xa')](),controller['getTags']);router[_0x7a81('0x12')]('/',auth[_0x7a81('0xa')](),controller[_0x7a81('0x13')]);router['post'](_0x7a81('0x11'),auth[_0x7a81('0xa')](),controller[_0x7a81('0x14')]);router[_0x7a81('0x15')](_0x7a81('0xb'),auth[_0x7a81('0xa')](),controller['update']);router['delete'](_0x7a81('0xb'),auth[_0x7a81('0xa')](),controller['destroy']);module[_0x7a81('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 8d9ae76..9426b80 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 _0x5ed1=['exports','STRING','sequelize'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x5ed1,0xf5));var _0x15ed=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x5ed1[_0xce93c];return _0x230720;};'use strict';var Sequelize=require(_0x15ed('0x0'));module[_0x15ed('0x1')]={'name':{'type':Sequelize[_0x15ed('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf66f=['STRING','sequelize','exports'];(function(_0x4d5376,_0x3d10c6){var _0x849db0=function(_0x316bce){while(--_0x316bce){_0x4d5376['push'](_0x4d5376['shift']());}};_0x849db0(++_0x3d10c6);}(_0xf66f,0x1f3));var _0xff66=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xf66f[_0x548200];return _0x1a6d74;};'use strict';var Sequelize=require(_0xff66('0x0'));module[_0xff66('0x1')]={'name':{'type':Sequelize[_0xff66('0x2')]},'description':{'type':Sequelize[_0xff66('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 8ce3b25..d5ab9bd 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 _0x177a=['VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getFields','findOne','DeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','sendStatus','name','send','index','DeskConfiguration','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x177a,0xdd));var _0xa177=function(_0x3f4a6b,_0x3dacec){_0x3f4a6b=_0x3f4a6b-0x0;var _0x1c8abc=_0x177a[_0x3f4a6b];return _0x1c8abc;};'use strict';var pdf=require(_0xa177('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa177('0x1'));var jsonpatch=require(_0xa177('0x2'));var rp=require(_0xa177('0x3'));var moment=require(_0xa177('0x4'));var BPromise=require(_0xa177('0x5'));var Mustache=require(_0xa177('0x6'));var util=require('util');var path=require(_0xa177('0x7'));var sox=require(_0xa177('0x8'));var csv=require(_0xa177('0x9'));var ejs=require(_0xa177('0xa'));var fs=require('fs');var _=require(_0xa177('0xb'));var squel=require(_0xa177('0xc'));var crypto=require(_0xa177('0xd'));var jsforce=require(_0xa177('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa177('0x9'));var querystring=require('querystring');var Papa=require(_0xa177('0xf'));var Redis=require(_0xa177('0x10'));var authService=require(_0xa177('0x11'));var qs=require(_0xa177('0x12'));var as=require(_0xa177('0x13'));var hardwareService=require(_0xa177('0x14'));var logger=require(_0xa177('0x15'))('api');var utils=require(_0xa177('0x16'));var config=require(_0xa177('0x17'));var db=require(_0xa177('0x18'))['db'];var jayson=require(_0xa177('0x19'));var client=jayson[_0xa177('0x1a')][_0xa177('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x26c738,_0x548bbf,_0x4e4d95){if(_0x4e4d95){var _0xca78d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xca78d4[_0xa177('0x1c')](_0x548bbf)){return _0x26c738;}else{throw new db[(_0xa177('0x1d'))][(_0xa177('0x1e'))](_0xa177('0x1f'));}}else{return _0x26c738;}}function respondWithRpcPromise(_0x1beaa0,_0x258985,_0xbc9fa4,_0x278633){return new BPromise(function(_0x3c1443,_0x26be7a){var _0x24a35e=_0x278633||client;return _0x24a35e['request'](_0x1beaa0,_0xbc9fa4)[_0xa177('0x20')](function(_0x43fc77){logger['info'](_0xa177('0x21'),_0x258985,_0xa177('0x22'));logger[_0xa177('0x23')](_0xa177('0x24'),_0x258985,'request\x20sent',JSON['stringify'](_0x43fc77));if(_0x43fc77['error']){if(_0x43fc77[_0xa177('0x25')][_0xa177('0x26')]===0x1f4){logger[_0xa177('0x25')](_0xa177('0x21'),_0x258985,_0x43fc77['error'][_0xa177('0x27')]);return _0x26be7a(_0x43fc77['error'][_0xa177('0x27')]);}logger['error'](_0xa177('0x21'),_0x258985,_0x43fc77[_0xa177('0x25')][_0xa177('0x27')]);return _0x3c1443(_0x43fc77[_0xa177('0x25')]['message']);}else{logger[_0xa177('0x28')](_0xa177('0x21'),_0x258985,_0xa177('0x22'));_0x3c1443(_0x43fc77['result']['message']);}})['catch'](function(_0x5c57f2){logger[_0xa177('0x25')](_0xa177('0x21'),_0x258985,_0x5c57f2);_0x26be7a(_0x5c57f2);});});}function respondWithStatusCode(_0x1cf775,_0x1b7cec){_0x1b7cec=_0x1b7cec||0xcc;return function(_0xf5d168){if(_0xf5d168){return _0x1cf775['sendStatus'](_0x1b7cec);}return _0x1cf775[_0xa177('0x29')](_0x1b7cec)[_0xa177('0x2a')]();};}function respondWithResult(_0x479587,_0x4c61b1){_0x4c61b1=_0x4c61b1||0xc8;return function(_0x182160){if(_0x182160){return _0x479587['status'](_0x4c61b1)['json'](_0x182160);}};}function respondWithFilteredResult(_0x59d40d,_0x45c513){return function(_0x4c8a61){if(_0x4c8a61){var _0x216cab=_0x4c8a61[_0xa177('0x2b')],_0x3ae38f=_0x45c513[_0xa177('0x2c')],_0x320cce=_0x45c513['offset']+_0x45c513[_0xa177('0x2d')],_0x5f20d4;if(_0x320cce>=_0x216cab){_0x320cce=_0x216cab;_0x5f20d4=0xc8;}else{_0x5f20d4=0xce;}_0x59d40d[_0xa177('0x29')](_0x5f20d4);return _0x59d40d[_0xa177('0x2e')](_0xa177('0x2f'),_0x3ae38f+'-'+_0x320cce+'/'+_0x216cab)[_0xa177('0x30')](_0x4c8a61);}return null;};}function patchUpdates(_0xe7a886){return function(_0x435e56){try{jsonpatch[_0xa177('0x31')](_0x435e56,_0xe7a886,!![]);}catch(_0x592139){return BPromise[_0xa177('0x32')](_0x592139);}return _0x435e56[_0xa177('0x33')]();};}function saveUpdates(_0x4c4ce4,_0x5b8f10){return function(_0x40cd9d){if(_0x40cd9d){return _0x40cd9d['update'](_0x4c4ce4)[_0xa177('0x20')](function(_0x1b7d71){return _0x1b7d71;});}return null;};}function removeEntity(_0x558c8c,_0x26dfd5){return function(_0x3c003a){if(_0x3c003a){return _0x3c003a[_0xa177('0x34')]()['then'](function(){_0x558c8c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf7fd,_0x54bce7){return function(_0x280acd){if(!_0x280acd){_0x4cf7fd[_0xa177('0x35')](0x194);}return _0x280acd;};}function handleError(_0x1efed3,_0x2b9bd0){_0x2b9bd0=_0x2b9bd0||0x1f4;return function(_0x27c2ae){logger[_0xa177('0x25')](_0x27c2ae['stack']);if(_0x27c2ae[_0xa177('0x36')]){delete _0x27c2ae[_0xa177('0x36')];}_0x1efed3[_0xa177('0x29')](_0x2b9bd0)[_0xa177('0x37')](_0x27c2ae);};}exports[_0xa177('0x38')]=function(_0x33aecc,_0x3d2350){var _0x3d141c={},_0x5ca2a2={},_0x2b92c8={'count':0x0,'rows':[]};var _0x23a1a7=_['map'](db[_0xa177('0x39')]['rawAttributes'],function(_0x319c9c){return{'name':_0x319c9c[_0xa177('0x3a')],'type':_0x319c9c['type'][_0xa177('0x3b')]};});_0x5ca2a2[_0xa177('0x3c')]=_[_0xa177('0x3d')](_0x23a1a7,_0xa177('0x36'));_0x5ca2a2[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x33aecc[_0xa177('0x3e')]);_0x5ca2a2[_0xa177('0x40')]=_[_0xa177('0x41')](_0x5ca2a2[_0xa177('0x3c')],_0x5ca2a2[_0xa177('0x3e')]);_0x3d141c[_0xa177('0x42')]=_['intersection'](_0x5ca2a2['model'],qs[_0xa177('0x43')](_0x33aecc[_0xa177('0x3e')][_0xa177('0x43')]));_0x3d141c[_0xa177('0x42')]=_0x3d141c[_0xa177('0x42')][_0xa177('0x44')]?_0x3d141c[_0xa177('0x42')]:_0x5ca2a2[_0xa177('0x3c')];if(!_0x33aecc['query']['hasOwnProperty'](_0xa177('0x45'))){_0x3d141c[_0xa177('0x2d')]=qs[_0xa177('0x2d')](_0x33aecc[_0xa177('0x3e')][_0xa177('0x2d')]);_0x3d141c[_0xa177('0x2c')]=qs[_0xa177('0x2c')](_0x33aecc['query'][_0xa177('0x2c')]);}_0x3d141c['order']=qs[_0xa177('0x46')](_0x33aecc[_0xa177('0x3e')][_0xa177('0x46')]);_0x3d141c[_0xa177('0x47')]=qs[_0xa177('0x40')](_[_0xa177('0x48')](_0x33aecc['query'],_0x5ca2a2[_0xa177('0x40')]),_0x23a1a7);if(_0x33aecc[_0xa177('0x3e')][_0xa177('0x49')]){_0x3d141c[_0xa177('0x47')]=_[_0xa177('0x4a')](_0x3d141c[_0xa177('0x47')],{'$or':_['map'](_0x23a1a7,function(_0x368f53){if(_0x368f53[_0xa177('0x4b')]!==_0xa177('0x4c')){var _0x304070={};_0x304070[_0x368f53[_0xa177('0x36')]]={'$like':'%'+_0x33aecc[_0xa177('0x3e')]['filter']+'%'};return _0x304070;}})});}_0x3d141c=_[_0xa177('0x4a')]({},_0x3d141c,_0x33aecc[_0xa177('0x4d')]);var _0x26afd7={'where':_0x3d141c[_0xa177('0x47')]};return db[_0xa177('0x39')][_0xa177('0x2b')](_0x26afd7)[_0xa177('0x20')](function(_0x280d40){_0x2b92c8[_0xa177('0x2b')]=_0x280d40;if(_0x33aecc[_0xa177('0x3e')][_0xa177('0x4e')]){_0x3d141c[_0xa177('0x4f')]=[{'all':!![]}];}return db[_0xa177('0x39')][_0xa177('0x50')](_0x3d141c);})[_0xa177('0x20')](function(_0x14a2c6){_0x2b92c8['rows']=_0x14a2c6;return _0x2b92c8;})[_0xa177('0x20')](respondWithFilteredResult(_0x3d2350,_0x3d141c))[_0xa177('0x51')](handleError(_0x3d2350,null));};exports[_0xa177('0x52')]=function(_0x423817,_0x34d9c4){var _0x54d596={'raw':![],'where':{'id':_0x423817[_0xa177('0x53')]['id']}},_0x2b7ed6={};_0x2b7ed6['model']=_[_0xa177('0x3f')](db[_0xa177('0x39')][_0xa177('0x54')]);_0x2b7ed6[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x423817[_0xa177('0x3e')]);_0x2b7ed6['filters']=_[_0xa177('0x41')](_0x2b7ed6[_0xa177('0x3c')],_0x2b7ed6[_0xa177('0x3e')]);_0x54d596['attributes']=_[_0xa177('0x41')](_0x2b7ed6[_0xa177('0x3c')],qs[_0xa177('0x43')](_0x423817[_0xa177('0x3e')][_0xa177('0x43')]));_0x54d596[_0xa177('0x42')]=_0x54d596[_0xa177('0x42')]['length']?_0x54d596[_0xa177('0x42')]:_0x2b7ed6[_0xa177('0x3c')];if(_0x423817['query'][_0xa177('0x4e')]){_0x54d596['include']=[{'all':!![]}];}_0x54d596=_[_0xa177('0x4a')]({},_0x54d596,_0x423817['options']);return db[_0xa177('0x39')][_0xa177('0x55')](_0x54d596)[_0xa177('0x20')](handleEntityNotFound(_0x34d9c4,null))[_0xa177('0x20')](respondWithResult(_0x34d9c4,null))[_0xa177('0x51')](handleError(_0x34d9c4,null));};exports[_0xa177('0x56')]=function(_0x1bc494,_0x207bfc){return db[_0xa177('0x39')][_0xa177('0x56')](_0x1bc494[_0xa177('0x57')],{})[_0xa177('0x20')](respondWithResult(_0x207bfc,0xc9))[_0xa177('0x51')](handleError(_0x207bfc,null));};exports['update']=function(_0x442c07,_0xb9359d){if(_0x442c07[_0xa177('0x57')]['id']){delete _0x442c07['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x442c07[_0xa177('0x53')]['id']}})[_0xa177('0x20')](handleEntityNotFound(_0xb9359d,null))[_0xa177('0x20')](saveUpdates(_0x442c07['body'],null))[_0xa177('0x20')](respondWithResult(_0xb9359d,null))[_0xa177('0x51')](handleError(_0xb9359d,null));};exports[_0xa177('0x34')]=function(_0x4306f5,_0x1febe3){return db[_0xa177('0x39')][_0xa177('0x55')]({'where':{'id':_0x4306f5[_0xa177('0x53')]['id']}})[_0xa177('0x20')](handleEntityNotFound(_0x1febe3,null))[_0xa177('0x20')](removeEntity(_0x1febe3,null))[_0xa177('0x51')](handleError(_0x1febe3,null));};exports[_0xa177('0x58')]=function(_0x1f19d3,_0x5f0c57,_0x52be95){var _0x126261={};var _0x2421d8={};var _0x381afc;var _0x2c08e5;return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x1f19d3[_0xa177('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f0c57,null))[_0xa177('0x20')](function(_0x42e7e8){if(_0x42e7e8){_0x381afc=_0x42e7e8;_0x2421d8['model']=_[_0xa177('0x3f')](db[_0xa177('0x5a')][_0xa177('0x54')]);_0x2421d8['query']=_['keys'](_0x1f19d3[_0xa177('0x3e')]);_0x2421d8[_0xa177('0x40')]=_[_0xa177('0x41')](_0x2421d8[_0xa177('0x3c')],_0x2421d8[_0xa177('0x3e')]);_0x126261[_0xa177('0x42')]=_[_0xa177('0x41')](_0x2421d8['model'],qs[_0xa177('0x43')](_0x1f19d3[_0xa177('0x3e')][_0xa177('0x43')]));_0x126261[_0xa177('0x42')]=_0x126261[_0xa177('0x42')][_0xa177('0x44')]?_0x126261['attributes']:_0x2421d8['model'];_0x126261[_0xa177('0x5b')]=qs[_0xa177('0x46')](_0x1f19d3['query']['sort']);_0x126261[_0xa177('0x47')]=qs[_0xa177('0x40')](_[_0xa177('0x48')](_0x1f19d3[_0xa177('0x3e')],_0x2421d8[_0xa177('0x40')]));if(_0x1f19d3[_0xa177('0x3e')][_0xa177('0x49')]){_0x126261[_0xa177('0x47')]=_['merge'](_0x126261[_0xa177('0x47')],{'$or':_[_0xa177('0x3d')](_0x126261['attributes'],function(_0x407d1f){var _0x5e936a={};_0x5e936a[_0x407d1f]={'$like':'%'+_0x1f19d3['query'][_0xa177('0x49')]+'%'};return _0x5e936a;})});}_0x126261=_['merge']({},_0x126261,_0x1f19d3['options']);return _0x381afc['getFields'](_0x126261);}})[_0xa177('0x20')](function(_0x45b0cc){if(_0x45b0cc){_0x2c08e5=_0x45b0cc[_0xa177('0x44')];if(!_0x1f19d3['query']['hasOwnProperty']('nolimit')){_0x126261[_0xa177('0x2d')]=qs[_0xa177('0x2d')](_0x1f19d3[_0xa177('0x3e')][_0xa177('0x2d')]);_0x126261['offset']=qs['offset'](_0x1f19d3[_0xa177('0x3e')][_0xa177('0x2c')]);}return _0x381afc['getFields'](_0x126261);}})[_0xa177('0x20')](function(_0x54a4fb){if(_0x54a4fb){return _0x54a4fb?{'count':_0x2c08e5,'rows':_0x54a4fb}:null;}})[_0xa177('0x20')](respondWithResult(_0x5f0c57,null))['catch'](handleError(_0x5f0c57,null));};exports['getSubjects']=function(_0x4bd3eb,_0x1b8d26,_0x128623){var _0x128b5f={};var _0x12bdb1={};var _0x23311d;var _0x1e7981;return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x4bd3eb[_0xa177('0x53')]['id']}})[_0xa177('0x20')](handleEntityNotFound(_0x1b8d26,null))[_0xa177('0x20')](function(_0x2411b3){if(_0x2411b3){_0x23311d=_0x2411b3;_0x12bdb1[_0xa177('0x3c')]=_[_0xa177('0x3f')](db[_0xa177('0x5a')][_0xa177('0x54')]);_0x12bdb1[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x4bd3eb['query']);_0x12bdb1[_0xa177('0x40')]=_[_0xa177('0x41')](_0x12bdb1['model'],_0x12bdb1[_0xa177('0x3e')]);_0x128b5f[_0xa177('0x42')]=_['intersection'](_0x12bdb1[_0xa177('0x3c')],qs[_0xa177('0x43')](_0x4bd3eb[_0xa177('0x3e')][_0xa177('0x43')]));_0x128b5f[_0xa177('0x42')]=_0x128b5f['attributes'][_0xa177('0x44')]?_0x128b5f['attributes']:_0x12bdb1[_0xa177('0x3c')];_0x128b5f[_0xa177('0x5b')]=qs[_0xa177('0x46')](_0x4bd3eb['query'][_0xa177('0x46')]);_0x128b5f[_0xa177('0x47')]=qs[_0xa177('0x40')](_[_0xa177('0x48')](_0x4bd3eb['query'],_0x12bdb1[_0xa177('0x40')]));if(_0x4bd3eb[_0xa177('0x3e')]['filter']){_0x128b5f['where']=_[_0xa177('0x4a')](_0x128b5f[_0xa177('0x47')],{'$or':_[_0xa177('0x3d')](_0x128b5f[_0xa177('0x42')],function(_0x30bb63){var _0x5ce02c={};_0x5ce02c[_0x30bb63]={'$like':'%'+_0x4bd3eb['query'][_0xa177('0x49')]+'%'};return _0x5ce02c;})});}_0x128b5f=_[_0xa177('0x4a')]({},_0x128b5f,_0x4bd3eb[_0xa177('0x4d')]);return _0x23311d['getSubjects'](_0x128b5f);}})[_0xa177('0x20')](function(_0xa81d26){if(_0xa81d26){_0x1e7981=_0xa81d26['length'];if(!_0x4bd3eb['query'][_0xa177('0x5c')]('nolimit')){_0x128b5f[_0xa177('0x2d')]=qs[_0xa177('0x2d')](_0x4bd3eb[_0xa177('0x3e')]['limit']);_0x128b5f[_0xa177('0x2c')]=qs['offset'](_0x4bd3eb[_0xa177('0x3e')]['offset']);}return _0x23311d[_0xa177('0x5d')](_0x128b5f);}})['then'](function(_0x301e01){if(_0x301e01){return _0x301e01?{'count':_0x1e7981,'rows':_0x301e01}:null;}})[_0xa177('0x20')](respondWithResult(_0x1b8d26,null))[_0xa177('0x51')](handleError(_0x1b8d26,null));};exports[_0xa177('0x5e')]=function(_0x546152,_0x22b4b3,_0x3097a8){var _0x12cfe9={};var _0x42d760={};var _0x14da8a;var _0x464e6b;return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x546152[_0xa177('0x53')]['id']}})[_0xa177('0x20')](handleEntityNotFound(_0x22b4b3,null))[_0xa177('0x20')](function(_0x25f897){if(_0x25f897){_0x14da8a=_0x25f897;_0x42d760[_0xa177('0x3c')]=_[_0xa177('0x3f')](db[_0xa177('0x5a')][_0xa177('0x54')]);_0x42d760[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x546152[_0xa177('0x3e')]);_0x42d760[_0xa177('0x40')]=_[_0xa177('0x41')](_0x42d760[_0xa177('0x3c')],_0x42d760[_0xa177('0x3e')]);_0x12cfe9[_0xa177('0x42')]=_['intersection'](_0x42d760[_0xa177('0x3c')],qs[_0xa177('0x43')](_0x546152[_0xa177('0x3e')][_0xa177('0x43')]));_0x12cfe9[_0xa177('0x42')]=_0x12cfe9[_0xa177('0x42')]['length']?_0x12cfe9[_0xa177('0x42')]:_0x42d760['model'];_0x12cfe9[_0xa177('0x5b')]=qs[_0xa177('0x46')](_0x546152[_0xa177('0x3e')][_0xa177('0x46')]);_0x12cfe9['where']=qs['filters'](_[_0xa177('0x48')](_0x546152[_0xa177('0x3e')],_0x42d760[_0xa177('0x40')]));if(_0x546152[_0xa177('0x3e')][_0xa177('0x49')]){_0x12cfe9[_0xa177('0x47')]=_['merge'](_0x12cfe9[_0xa177('0x47')],{'$or':_[_0xa177('0x3d')](_0x12cfe9[_0xa177('0x42')],function(_0x48dc4d){var _0x49186b={};_0x49186b[_0x48dc4d]={'$like':'%'+_0x546152[_0xa177('0x3e')]['filter']+'%'};return _0x49186b;})});}_0x12cfe9=_['merge']({},_0x12cfe9,_0x546152[_0xa177('0x4d')]);return _0x14da8a[_0xa177('0x5e')](_0x12cfe9);}})['then'](function(_0x1ca046){if(_0x1ca046){_0x464e6b=_0x1ca046['length'];if(!_0x546152[_0xa177('0x3e')]['hasOwnProperty'](_0xa177('0x45'))){_0x12cfe9[_0xa177('0x2d')]=qs[_0xa177('0x2d')](_0x546152[_0xa177('0x3e')][_0xa177('0x2d')]);_0x12cfe9[_0xa177('0x2c')]=qs['offset'](_0x546152['query'][_0xa177('0x2c')]);}return _0x14da8a[_0xa177('0x5e')](_0x12cfe9);}})[_0xa177('0x20')](function(_0x530d76){if(_0x530d76){return _0x530d76?{'count':_0x464e6b,'rows':_0x530d76}:null;}})[_0xa177('0x20')](respondWithResult(_0x22b4b3,null))[_0xa177('0x51')](handleError(_0x22b4b3,null));};exports[_0xa177('0x5f')]=function(_0x9a13a1,_0x4ec0b7,_0x485c97){var _0x43681a={};var _0x224a86={};var _0x230ed5;var _0x5d7157;return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x9a13a1[_0xa177('0x53')]['id']}})['then'](handleEntityNotFound(_0x4ec0b7,null))[_0xa177('0x20')](function(_0x15073e){if(_0x15073e){_0x230ed5=_0x15073e;_0x224a86[_0xa177('0x3c')]=_[_0xa177('0x3f')](db[_0xa177('0x60')]['rawAttributes']);_0x224a86[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x9a13a1[_0xa177('0x3e')]);_0x224a86[_0xa177('0x40')]=_[_0xa177('0x41')](_0x224a86[_0xa177('0x3c')],_0x224a86[_0xa177('0x3e')]);_0x43681a[_0xa177('0x42')]=_[_0xa177('0x41')](_0x224a86[_0xa177('0x3c')],qs[_0xa177('0x43')](_0x9a13a1[_0xa177('0x3e')][_0xa177('0x43')]));_0x43681a[_0xa177('0x42')]=_0x43681a[_0xa177('0x42')][_0xa177('0x44')]?_0x43681a[_0xa177('0x42')]:_0x224a86[_0xa177('0x3c')];_0x43681a[_0xa177('0x5b')]=qs[_0xa177('0x46')](_0x9a13a1['query'][_0xa177('0x46')]);_0x43681a['where']=qs['filters'](_[_0xa177('0x48')](_0x9a13a1[_0xa177('0x3e')],_0x224a86[_0xa177('0x40')]));if(_0x9a13a1[_0xa177('0x3e')][_0xa177('0x49')]){_0x43681a['where']=_[_0xa177('0x4a')](_0x43681a[_0xa177('0x47')],{'$or':_[_0xa177('0x3d')](_0x43681a['attributes'],function(_0x53ef06){var _0x5df8f4={};_0x5df8f4[_0x53ef06]={'$like':'%'+_0x9a13a1[_0xa177('0x3e')][_0xa177('0x49')]+'%'};return _0x5df8f4;})});}_0x43681a=_['merge']({},_0x43681a,_0x9a13a1[_0xa177('0x4d')]);return _0x230ed5[_0xa177('0x5f')](_0x43681a);}})[_0xa177('0x20')](function(_0x4599e7){if(_0x4599e7){_0x5d7157=_0x4599e7['length'];if(!_0x9a13a1[_0xa177('0x3e')][_0xa177('0x5c')](_0xa177('0x45'))){_0x43681a['limit']=qs['limit'](_0x9a13a1['query'][_0xa177('0x2d')]);_0x43681a['offset']=qs[_0xa177('0x2c')](_0x9a13a1[_0xa177('0x3e')][_0xa177('0x2c')]);}return _0x230ed5[_0xa177('0x5f')](_0x43681a);}})['then'](function(_0x10b3cf){if(_0x10b3cf){return _0x10b3cf?{'count':_0x5d7157,'rows':_0x10b3cf}:null;}})['then'](respondWithResult(_0x4ec0b7,null))['catch'](handleError(_0x4ec0b7,null));};exports[_0xa177('0x61')]=function(_0x48a75a,_0x4a410b,_0x47ee8d){if(_0x48a75a[_0xa177('0x57')]['id']){delete _0x48a75a[_0xa177('0x57')]['id'];}return db[_0xa177('0x39')][_0xa177('0x59')]({'where':{'id':_0x48a75a['params']['id']}})[_0xa177('0x20')](handleEntityNotFound(_0x4a410b,null))['then'](function(_0x499be5){if(_0x499be5){return _0x499be5[_0xa177('0x61')](_0x48a75a[_0xa177('0x57')][_0xa177('0x62')]||[]);}return null;})['then'](respondWithResult(_0x4a410b,null))[_0xa177('0x51')](handleError(_0x4a410b,null));}; \ No newline at end of file +var _0xb2ef=['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','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','limit','order','sort','where','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','rows','params','fields','body','find','findOne','DeskField','filter','hasOwnProperty','nolimit','getFields','getSubjects','pick','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','jayson/promise'];(function(_0x389b8d,_0x3199b3){var _0x4259c7=function(_0x30fc81){while(--_0x30fc81){_0x389b8d['push'](_0x389b8d['shift']());}};_0x4259c7(++_0x3199b3);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x20b5db,_0x4fc613){_0x20b5db=_0x20b5db-0x0;var _0x410181=_0xb2ef[_0x20b5db];return _0x410181;};'use strict';var pdf=require(_0xfb2e('0x0'));var emlformat=require(_0xfb2e('0x1'));var rimraf=require(_0xfb2e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb2e('0x3'));var rp=require(_0xfb2e('0x4'));var moment=require(_0xfb2e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb2e('0x6'));var util=require(_0xfb2e('0x7'));var path=require(_0xfb2e('0x8'));var sox=require(_0xfb2e('0x9'));var csv=require(_0xfb2e('0xa'));var ejs=require(_0xfb2e('0xb'));var fs=require('fs');var _=require(_0xfb2e('0xc'));var squel=require(_0xfb2e('0xd'));var crypto=require(_0xfb2e('0xe'));var jsforce=require(_0xfb2e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfb2e('0xa'));var querystring=require(_0xfb2e('0x10'));var Papa=require(_0xfb2e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfb2e('0x12'));var as=require(_0xfb2e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb2e('0x14'))(_0xfb2e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xfb2e('0x16'));var client=jayson['client'][_0xfb2e('0x17')]({'port':0x232a});function checkPasswordPattern(_0x8d5a90,_0x306481,_0x3ddf89){if(_0x3ddf89){var _0x3ffa17=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ffa17[_0xfb2e('0x18')](_0x306481)){return _0x8d5a90;}else{throw new db['Sequelize'][(_0xfb2e('0x19'))](_0xfb2e('0x1a'));}}else{return _0x8d5a90;}}function respondWithRpcPromise(_0x298e50,_0x363e52,_0x166b56,_0x48da9b){return new BPromise(function(_0x4b0005,_0x4d59e8){var _0x4d5607=_0x48da9b||client;return _0x4d5607[_0xfb2e('0x1b')](_0x298e50,_0x166b56)[_0xfb2e('0x1c')](function(_0x4d7f55){logger[_0xfb2e('0x1d')](_0xfb2e('0x1e'),_0x363e52,'request\x20sent');logger[_0xfb2e('0x1f')](_0xfb2e('0x20'),_0x363e52,'request\x20sent',JSON[_0xfb2e('0x21')](_0x4d7f55));if(_0x4d7f55['error']){if(_0x4d7f55['error'][_0xfb2e('0x22')]===0x1f4){logger[_0xfb2e('0x23')](_0xfb2e('0x1e'),_0x363e52,_0x4d7f55['error']['message']);return _0x4d59e8(_0x4d7f55['error'][_0xfb2e('0x24')]);}logger[_0xfb2e('0x23')](_0xfb2e('0x1e'),_0x363e52,_0x4d7f55[_0xfb2e('0x23')][_0xfb2e('0x24')]);return _0x4b0005(_0x4d7f55[_0xfb2e('0x23')][_0xfb2e('0x24')]);}else{logger[_0xfb2e('0x1d')](_0xfb2e('0x1e'),_0x363e52,_0xfb2e('0x25'));_0x4b0005(_0x4d7f55[_0xfb2e('0x26')][_0xfb2e('0x24')]);}})[_0xfb2e('0x27')](function(_0x1caafc){logger[_0xfb2e('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x363e52,_0x1caafc);_0x4d59e8(_0x1caafc);});});}function respondWithStatusCode(_0x105c17,_0x49c216){_0x49c216=_0x49c216||0xcc;return function(_0x331ee7){if(_0x331ee7){return _0x105c17[_0xfb2e('0x28')](_0x49c216);}return _0x105c17['status'](_0x49c216)['end']();};}function respondWithResult(_0x5f1950,_0x47dc1e){_0x47dc1e=_0x47dc1e||0xc8;return function(_0x227374){if(_0x227374){return _0x5f1950[_0xfb2e('0x29')](_0x47dc1e)[_0xfb2e('0x2a')](_0x227374);}};}function respondWithFilteredResult(_0x229256,_0x43cbab){return function(_0x42a80f){if(_0x42a80f){var _0x2ac1f1=_0x42a80f[_0xfb2e('0x2b')],_0x14c948=_0x43cbab[_0xfb2e('0x2c')],_0x31e8a1=_0x43cbab[_0xfb2e('0x2c')]+_0x43cbab['limit'],_0x2eef6d;if(_0x31e8a1>=_0x2ac1f1){_0x31e8a1=_0x2ac1f1;_0x2eef6d=0xc8;}else{_0x2eef6d=0xce;}_0x229256[_0xfb2e('0x29')](_0x2eef6d);return _0x229256[_0xfb2e('0x2d')](_0xfb2e('0x2e'),_0x14c948+'-'+_0x31e8a1+'/'+_0x2ac1f1)[_0xfb2e('0x2a')](_0x42a80f);}return null;};}function patchUpdates(_0xa05e59){return function(_0xd82f0f){try{jsonpatch['apply'](_0xd82f0f,_0xa05e59,!![]);}catch(_0x528d8b){return BPromise[_0xfb2e('0x2f')](_0x528d8b);}return _0xd82f0f[_0xfb2e('0x30')]();};}function saveUpdates(_0x5dc1a8,_0x5e6764){return function(_0x268473){if(_0x268473){return _0x268473[_0xfb2e('0x31')](_0x5dc1a8)[_0xfb2e('0x1c')](function(_0x1f5ada){return _0x1f5ada;});}return null;};}function removeEntity(_0x1a7e92,_0x4925db){return function(_0x3f74e2){if(_0x3f74e2){return _0x3f74e2[_0xfb2e('0x32')]()[_0xfb2e('0x1c')](function(){_0x1a7e92['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35921d,_0x10423a){return function(_0x54a5b5){if(!_0x54a5b5){_0x35921d[_0xfb2e('0x28')](0x194);}return _0x54a5b5;};}function handleError(_0x30fedb,_0x5754d9){_0x5754d9=_0x5754d9||0x1f4;return function(_0xe59faf){logger[_0xfb2e('0x23')](_0xe59faf[_0xfb2e('0x33')]);if(_0xe59faf[_0xfb2e('0x34')]){delete _0xe59faf[_0xfb2e('0x34')];}_0x30fedb['status'](_0x5754d9)[_0xfb2e('0x35')](_0xe59faf);};}exports[_0xfb2e('0x36')]=function(_0x551197,_0x4b15a2){var _0x58855d={},_0x3f2ed2={},_0x1efeca={'count':0x0,'rows':[]};var _0x31fdc3=_[_0xfb2e('0x37')](db['DeskConfiguration'][_0xfb2e('0x38')],function(_0x3f6eb0){return{'name':_0x3f6eb0[_0xfb2e('0x39')],'type':_0x3f6eb0[_0xfb2e('0x3a')][_0xfb2e('0x3b')]};});_0x3f2ed2[_0xfb2e('0x3c')]=_[_0xfb2e('0x37')](_0x31fdc3,_0xfb2e('0x34'));_0x3f2ed2[_0xfb2e('0x3d')]=_[_0xfb2e('0x3e')](_0x551197['query']);_0x3f2ed2[_0xfb2e('0x3f')]=_['intersection'](_0x3f2ed2['model'],_0x3f2ed2['query']);_0x58855d[_0xfb2e('0x40')]=_[_0xfb2e('0x41')](_0x3f2ed2[_0xfb2e('0x3c')],qs['fields'](_0x551197[_0xfb2e('0x3d')]['fields']));_0x58855d['attributes']=_0x58855d[_0xfb2e('0x40')][_0xfb2e('0x42')]?_0x58855d[_0xfb2e('0x40')]:_0x3f2ed2[_0xfb2e('0x3c')];if(!_0x551197[_0xfb2e('0x3d')]['hasOwnProperty']('nolimit')){_0x58855d[_0xfb2e('0x43')]=qs[_0xfb2e('0x43')](_0x551197['query']['limit']);_0x58855d[_0xfb2e('0x2c')]=qs['offset'](_0x551197[_0xfb2e('0x3d')][_0xfb2e('0x2c')]);}_0x58855d[_0xfb2e('0x44')]=qs[_0xfb2e('0x45')](_0x551197[_0xfb2e('0x3d')][_0xfb2e('0x45')]);_0x58855d[_0xfb2e('0x46')]=qs[_0xfb2e('0x3f')](_['pick'](_0x551197[_0xfb2e('0x3d')],_0x3f2ed2[_0xfb2e('0x3f')]),_0x31fdc3);if(_0x551197[_0xfb2e('0x3d')]['filter']){_0x58855d[_0xfb2e('0x46')]=_[_0xfb2e('0x47')](_0x58855d[_0xfb2e('0x46')],{'$or':_['map'](_0x31fdc3,function(_0x214dda){if(_0x214dda['type']!==_0xfb2e('0x48')){var _0xa9bcac={};_0xa9bcac[_0x214dda[_0xfb2e('0x34')]]={'$like':'%'+_0x551197['query']['filter']+'%'};return _0xa9bcac;}})});}_0x58855d=_[_0xfb2e('0x47')]({},_0x58855d,_0x551197[_0xfb2e('0x49')]);var _0x29054e={'where':_0x58855d[_0xfb2e('0x46')]};return db[_0xfb2e('0x4a')][_0xfb2e('0x2b')](_0x29054e)[_0xfb2e('0x1c')](function(_0x23ab97){_0x1efeca[_0xfb2e('0x2b')]=_0x23ab97;if(_0x551197['query'][_0xfb2e('0x4b')]){_0x58855d[_0xfb2e('0x4c')]=[{'all':!![]}];}return db[_0xfb2e('0x4a')]['findAll'](_0x58855d);})[_0xfb2e('0x1c')](function(_0x7beac8){_0x1efeca[_0xfb2e('0x4d')]=_0x7beac8;return _0x1efeca;})[_0xfb2e('0x1c')](respondWithFilteredResult(_0x4b15a2,_0x58855d))['catch'](handleError(_0x4b15a2,null));};exports['show']=function(_0x5069ed,_0x220047){var _0x32dccb={'raw':![],'where':{'id':_0x5069ed[_0xfb2e('0x4e')]['id']}},_0x1ffa50={};_0x1ffa50[_0xfb2e('0x3c')]=_[_0xfb2e('0x3e')](db[_0xfb2e('0x4a')][_0xfb2e('0x38')]);_0x1ffa50[_0xfb2e('0x3d')]=_['keys'](_0x5069ed[_0xfb2e('0x3d')]);_0x1ffa50[_0xfb2e('0x3f')]=_['intersection'](_0x1ffa50[_0xfb2e('0x3c')],_0x1ffa50[_0xfb2e('0x3d')]);_0x32dccb[_0xfb2e('0x40')]=_[_0xfb2e('0x41')](_0x1ffa50[_0xfb2e('0x3c')],qs[_0xfb2e('0x4f')](_0x5069ed[_0xfb2e('0x3d')][_0xfb2e('0x4f')]));_0x32dccb[_0xfb2e('0x40')]=_0x32dccb[_0xfb2e('0x40')][_0xfb2e('0x42')]?_0x32dccb[_0xfb2e('0x40')]:_0x1ffa50['model'];if(_0x5069ed[_0xfb2e('0x3d')][_0xfb2e('0x4b')]){_0x32dccb[_0xfb2e('0x4c')]=[{'all':!![]}];}_0x32dccb=_['merge']({},_0x32dccb,_0x5069ed[_0xfb2e('0x49')]);return db[_0xfb2e('0x4a')]['find'](_0x32dccb)[_0xfb2e('0x1c')](handleEntityNotFound(_0x220047,null))[_0xfb2e('0x1c')](respondWithResult(_0x220047,null))[_0xfb2e('0x27')](handleError(_0x220047,null));};exports['create']=function(_0x555ced,_0x363960){return db[_0xfb2e('0x4a')]['create'](_0x555ced[_0xfb2e('0x50')],{})['then'](respondWithResult(_0x363960,0xc9))[_0xfb2e('0x27')](handleError(_0x363960,null));};exports[_0xfb2e('0x31')]=function(_0x376d2e,_0x3a120c){if(_0x376d2e['body']['id']){delete _0x376d2e['body']['id'];}return db[_0xfb2e('0x4a')][_0xfb2e('0x51')]({'where':{'id':_0x376d2e[_0xfb2e('0x4e')]['id']}})[_0xfb2e('0x1c')](handleEntityNotFound(_0x3a120c,null))[_0xfb2e('0x1c')](saveUpdates(_0x376d2e[_0xfb2e('0x50')],null))[_0xfb2e('0x1c')](respondWithResult(_0x3a120c,null))[_0xfb2e('0x27')](handleError(_0x3a120c,null));};exports['destroy']=function(_0x278aed,_0xadb413){return db[_0xfb2e('0x4a')][_0xfb2e('0x51')]({'where':{'id':_0x278aed[_0xfb2e('0x4e')]['id']}})['then'](handleEntityNotFound(_0xadb413,null))[_0xfb2e('0x1c')](removeEntity(_0xadb413,null))[_0xfb2e('0x27')](handleError(_0xadb413,null));};exports['getFields']=function(_0x3090a1,_0x3c9cc0,_0x53b12c){var _0x4c5017={};var _0x3b5cf2={};var _0x9d40f9;var _0x47d369;return db[_0xfb2e('0x4a')][_0xfb2e('0x52')]({'where':{'id':_0x3090a1['params']['id']}})[_0xfb2e('0x1c')](handleEntityNotFound(_0x3c9cc0,null))[_0xfb2e('0x1c')](function(_0x28b415){if(_0x28b415){_0x9d40f9=_0x28b415;_0x3b5cf2['model']=_[_0xfb2e('0x3e')](db[_0xfb2e('0x53')]['rawAttributes']);_0x3b5cf2[_0xfb2e('0x3d')]=_[_0xfb2e('0x3e')](_0x3090a1['query']);_0x3b5cf2[_0xfb2e('0x3f')]=_[_0xfb2e('0x41')](_0x3b5cf2[_0xfb2e('0x3c')],_0x3b5cf2[_0xfb2e('0x3d')]);_0x4c5017[_0xfb2e('0x40')]=_[_0xfb2e('0x41')](_0x3b5cf2[_0xfb2e('0x3c')],qs[_0xfb2e('0x4f')](_0x3090a1['query']['fields']));_0x4c5017[_0xfb2e('0x40')]=_0x4c5017[_0xfb2e('0x40')]['length']?_0x4c5017['attributes']:_0x3b5cf2[_0xfb2e('0x3c')];_0x4c5017[_0xfb2e('0x44')]=qs[_0xfb2e('0x45')](_0x3090a1[_0xfb2e('0x3d')][_0xfb2e('0x45')]);_0x4c5017[_0xfb2e('0x46')]=qs[_0xfb2e('0x3f')](_['pick'](_0x3090a1['query'],_0x3b5cf2['filters']));if(_0x3090a1[_0xfb2e('0x3d')][_0xfb2e('0x54')]){_0x4c5017[_0xfb2e('0x46')]=_[_0xfb2e('0x47')](_0x4c5017[_0xfb2e('0x46')],{'$or':_[_0xfb2e('0x37')](_0x4c5017['attributes'],function(_0x51e3c0){var _0x23b93a={};_0x23b93a[_0x51e3c0]={'$like':'%'+_0x3090a1['query'][_0xfb2e('0x54')]+'%'};return _0x23b93a;})});}_0x4c5017=_[_0xfb2e('0x47')]({},_0x4c5017,_0x3090a1[_0xfb2e('0x49')]);return _0x9d40f9['getFields'](_0x4c5017);}})[_0xfb2e('0x1c')](function(_0x1826c3){if(_0x1826c3){_0x47d369=_0x1826c3['length'];if(!_0x3090a1[_0xfb2e('0x3d')][_0xfb2e('0x55')](_0xfb2e('0x56'))){_0x4c5017[_0xfb2e('0x43')]=qs[_0xfb2e('0x43')](_0x3090a1[_0xfb2e('0x3d')][_0xfb2e('0x43')]);_0x4c5017[_0xfb2e('0x2c')]=qs['offset'](_0x3090a1[_0xfb2e('0x3d')][_0xfb2e('0x2c')]);}return _0x9d40f9[_0xfb2e('0x57')](_0x4c5017);}})['then'](function(_0x2e8722){if(_0x2e8722){return _0x2e8722?{'count':_0x47d369,'rows':_0x2e8722}:null;}})[_0xfb2e('0x1c')](respondWithResult(_0x3c9cc0,null))[_0xfb2e('0x27')](handleError(_0x3c9cc0,null));};exports[_0xfb2e('0x58')]=function(_0x4fd8b0,_0x9e29,_0x4109b0){var _0x3e02fc={};var _0x235a2c={};var _0x161128;var _0x57c036;return db[_0xfb2e('0x4a')][_0xfb2e('0x52')]({'where':{'id':_0x4fd8b0[_0xfb2e('0x4e')]['id']}})[_0xfb2e('0x1c')](handleEntityNotFound(_0x9e29,null))[_0xfb2e('0x1c')](function(_0x3bc9fe){if(_0x3bc9fe){_0x161128=_0x3bc9fe;_0x235a2c[_0xfb2e('0x3c')]=_[_0xfb2e('0x3e')](db['DeskField'][_0xfb2e('0x38')]);_0x235a2c[_0xfb2e('0x3d')]=_[_0xfb2e('0x3e')](_0x4fd8b0[_0xfb2e('0x3d')]);_0x235a2c['filters']=_[_0xfb2e('0x41')](_0x235a2c['model'],_0x235a2c[_0xfb2e('0x3d')]);_0x3e02fc[_0xfb2e('0x40')]=_[_0xfb2e('0x41')](_0x235a2c['model'],qs[_0xfb2e('0x4f')](_0x4fd8b0['query'][_0xfb2e('0x4f')]));_0x3e02fc[_0xfb2e('0x40')]=_0x3e02fc[_0xfb2e('0x40')]['length']?_0x3e02fc[_0xfb2e('0x40')]:_0x235a2c[_0xfb2e('0x3c')];_0x3e02fc[_0xfb2e('0x44')]=qs[_0xfb2e('0x45')](_0x4fd8b0[_0xfb2e('0x3d')][_0xfb2e('0x45')]);_0x3e02fc['where']=qs['filters'](_[_0xfb2e('0x59')](_0x4fd8b0['query'],_0x235a2c[_0xfb2e('0x3f')]));if(_0x4fd8b0[_0xfb2e('0x3d')][_0xfb2e('0x54')]){_0x3e02fc[_0xfb2e('0x46')]=_[_0xfb2e('0x47')](_0x3e02fc[_0xfb2e('0x46')],{'$or':_[_0xfb2e('0x37')](_0x3e02fc['attributes'],function(_0x5d8eb2){var _0x2a4bea={};_0x2a4bea[_0x5d8eb2]={'$like':'%'+_0x4fd8b0[_0xfb2e('0x3d')][_0xfb2e('0x54')]+'%'};return _0x2a4bea;})});}_0x3e02fc=_[_0xfb2e('0x47')]({},_0x3e02fc,_0x4fd8b0[_0xfb2e('0x49')]);return _0x161128[_0xfb2e('0x58')](_0x3e02fc);}})[_0xfb2e('0x1c')](function(_0x5066c7){if(_0x5066c7){_0x57c036=_0x5066c7[_0xfb2e('0x42')];if(!_0x4fd8b0['query']['hasOwnProperty'](_0xfb2e('0x56'))){_0x3e02fc[_0xfb2e('0x43')]=qs['limit'](_0x4fd8b0[_0xfb2e('0x3d')][_0xfb2e('0x43')]);_0x3e02fc[_0xfb2e('0x2c')]=qs[_0xfb2e('0x2c')](_0x4fd8b0['query']['offset']);}return _0x161128[_0xfb2e('0x58')](_0x3e02fc);}})[_0xfb2e('0x1c')](function(_0x494231){if(_0x494231){return _0x494231?{'count':_0x57c036,'rows':_0x494231}:null;}})[_0xfb2e('0x1c')](respondWithResult(_0x9e29,null))[_0xfb2e('0x27')](handleError(_0x9e29,null));};exports[_0xfb2e('0x5a')]=function(_0x52c333,_0x20801f,_0x54caf7){var _0x4270ef={};var _0x53221b={};var _0x206c19;var _0x20cad8;return db[_0xfb2e('0x4a')][_0xfb2e('0x52')]({'where':{'id':_0x52c333[_0xfb2e('0x4e')]['id']}})[_0xfb2e('0x1c')](handleEntityNotFound(_0x20801f,null))[_0xfb2e('0x1c')](function(_0x4e1d3e){if(_0x4e1d3e){_0x206c19=_0x4e1d3e;_0x53221b[_0xfb2e('0x3c')]=_[_0xfb2e('0x3e')](db[_0xfb2e('0x53')][_0xfb2e('0x38')]);_0x53221b[_0xfb2e('0x3d')]=_[_0xfb2e('0x3e')](_0x52c333[_0xfb2e('0x3d')]);_0x53221b['filters']=_[_0xfb2e('0x41')](_0x53221b[_0xfb2e('0x3c')],_0x53221b[_0xfb2e('0x3d')]);_0x4270ef[_0xfb2e('0x40')]=_[_0xfb2e('0x41')](_0x53221b[_0xfb2e('0x3c')],qs[_0xfb2e('0x4f')](_0x52c333[_0xfb2e('0x3d')][_0xfb2e('0x4f')]));_0x4270ef[_0xfb2e('0x40')]=_0x4270ef[_0xfb2e('0x40')][_0xfb2e('0x42')]?_0x4270ef[_0xfb2e('0x40')]:_0x53221b[_0xfb2e('0x3c')];_0x4270ef[_0xfb2e('0x44')]=qs['sort'](_0x52c333[_0xfb2e('0x3d')][_0xfb2e('0x45')]);_0x4270ef[_0xfb2e('0x46')]=qs[_0xfb2e('0x3f')](_[_0xfb2e('0x59')](_0x52c333[_0xfb2e('0x3d')],_0x53221b['filters']));if(_0x52c333['query'][_0xfb2e('0x54')]){_0x4270ef['where']=_[_0xfb2e('0x47')](_0x4270ef[_0xfb2e('0x46')],{'$or':_[_0xfb2e('0x37')](_0x4270ef[_0xfb2e('0x40')],function(_0x502d7d){var _0x199fe6={};_0x199fe6[_0x502d7d]={'$like':'%'+_0x52c333[_0xfb2e('0x3d')][_0xfb2e('0x54')]+'%'};return _0x199fe6;})});}_0x4270ef=_['merge']({},_0x4270ef,_0x52c333[_0xfb2e('0x49')]);return _0x206c19['getDescriptions'](_0x4270ef);}})[_0xfb2e('0x1c')](function(_0x5808f6){if(_0x5808f6){_0x20cad8=_0x5808f6[_0xfb2e('0x42')];if(!_0x52c333['query'][_0xfb2e('0x55')](_0xfb2e('0x56'))){_0x4270ef['limit']=qs[_0xfb2e('0x43')](_0x52c333[_0xfb2e('0x3d')][_0xfb2e('0x43')]);_0x4270ef[_0xfb2e('0x2c')]=qs[_0xfb2e('0x2c')](_0x52c333['query']['offset']);}return _0x206c19[_0xfb2e('0x5a')](_0x4270ef);}})[_0xfb2e('0x1c')](function(_0x21746f){if(_0x21746f){return _0x21746f?{'count':_0x20cad8,'rows':_0x21746f}:null;}})[_0xfb2e('0x1c')](respondWithResult(_0x20801f,null))[_0xfb2e('0x27')](handleError(_0x20801f,null));};exports['getTags']=function(_0x5bc8e7,_0x24f471,_0xa6e222){var _0x36e4d8={};var _0x3c65e1={};var _0x5edb2b;var _0x3639cb;return db[_0xfb2e('0x4a')][_0xfb2e('0x52')]({'where':{'id':_0x5bc8e7[_0xfb2e('0x4e')]['id']}})[_0xfb2e('0x1c')](handleEntityNotFound(_0x24f471,null))[_0xfb2e('0x1c')](function(_0x30c132){if(_0x30c132){_0x5edb2b=_0x30c132;_0x3c65e1['model']=_['keys'](db[_0xfb2e('0x5b')]['rawAttributes']);_0x3c65e1[_0xfb2e('0x3d')]=_[_0xfb2e('0x3e')](_0x5bc8e7['query']);_0x3c65e1[_0xfb2e('0x3f')]=_['intersection'](_0x3c65e1[_0xfb2e('0x3c')],_0x3c65e1[_0xfb2e('0x3d')]);_0x36e4d8[_0xfb2e('0x40')]=_[_0xfb2e('0x41')](_0x3c65e1[_0xfb2e('0x3c')],qs[_0xfb2e('0x4f')](_0x5bc8e7[_0xfb2e('0x3d')][_0xfb2e('0x4f')]));_0x36e4d8[_0xfb2e('0x40')]=_0x36e4d8[_0xfb2e('0x40')][_0xfb2e('0x42')]?_0x36e4d8[_0xfb2e('0x40')]:_0x3c65e1['model'];_0x36e4d8[_0xfb2e('0x44')]=qs[_0xfb2e('0x45')](_0x5bc8e7[_0xfb2e('0x3d')][_0xfb2e('0x45')]);_0x36e4d8[_0xfb2e('0x46')]=qs[_0xfb2e('0x3f')](_[_0xfb2e('0x59')](_0x5bc8e7['query'],_0x3c65e1['filters']));if(_0x5bc8e7['query'][_0xfb2e('0x54')]){_0x36e4d8[_0xfb2e('0x46')]=_['merge'](_0x36e4d8[_0xfb2e('0x46')],{'$or':_['map'](_0x36e4d8[_0xfb2e('0x40')],function(_0x122420){var _0x205a5f={};_0x205a5f[_0x122420]={'$like':'%'+_0x5bc8e7[_0xfb2e('0x3d')][_0xfb2e('0x54')]+'%'};return _0x205a5f;})});}_0x36e4d8=_['merge']({},_0x36e4d8,_0x5bc8e7[_0xfb2e('0x49')]);return _0x5edb2b['getTags'](_0x36e4d8);}})[_0xfb2e('0x1c')](function(_0x57e4c8){if(_0x57e4c8){_0x3639cb=_0x57e4c8[_0xfb2e('0x42')];if(!_0x5bc8e7[_0xfb2e('0x3d')][_0xfb2e('0x55')](_0xfb2e('0x56'))){_0x36e4d8[_0xfb2e('0x43')]=qs[_0xfb2e('0x43')](_0x5bc8e7[_0xfb2e('0x3d')][_0xfb2e('0x43')]);_0x36e4d8[_0xfb2e('0x2c')]=qs[_0xfb2e('0x2c')](_0x5bc8e7['query'][_0xfb2e('0x2c')]);}return _0x5edb2b[_0xfb2e('0x5c')](_0x36e4d8);}})[_0xfb2e('0x1c')](function(_0x3ed099){if(_0x3ed099){return _0x3ed099?{'count':_0x3639cb,'rows':_0x3ed099}:null;}})[_0xfb2e('0x1c')](respondWithResult(_0x24f471,null))[_0xfb2e('0x27')](handleError(_0x24f471,null));};exports['setTags']=function(_0x5f432a,_0x37b98d,_0x321b4b){if(_0x5f432a['body']['id']){delete _0x5f432a[_0xfb2e('0x50')]['id'];}return db[_0xfb2e('0x4a')][_0xfb2e('0x52')]({'where':{'id':_0x5f432a['params']['id']}})['then'](handleEntityNotFound(_0x37b98d,null))[_0xfb2e('0x1c')](function(_0x525764){if(_0x525764){return _0x525764[_0xfb2e('0x5d')](_0x5f432a[_0xfb2e('0x50')][_0xfb2e('0x5e')]||[]);}return null;})[_0xfb2e('0x1c')](respondWithResult(_0x37b98d,null))[_0xfb2e('0x27')](handleError(_0x37b98d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 553b50a..cb1f7fe 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 _0x98a6=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x47d351,_0x549ba3){var _0x3b9fe8=function(_0x277e2e){while(--_0x277e2e){_0x47d351['push'](_0x47d351['shift']());}};_0x3b9fe8(++_0x549ba3);}(_0x98a6,0x13e));var _0x698a=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x98a6[_0x11946c];return _0x383935;};'use strict';var _=require(_0x698a('0x0'));var util=require(_0x698a('0x1'));var logger=require(_0x698a('0x2'))('api');var moment=require(_0x698a('0x3'));var BPromise=require(_0x698a('0x4'));var rp=require(_0x698a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x698a('0x6'));var config=require('../../config/environment');var attributes=require(_0x698a('0x7'));module[_0x698a('0x8')]=function(_0x4e15ea,_0x5b4181){return _0x4e15ea['define'](_0x698a('0x9'),attributes,{'tableName':_0x698a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x571e=['./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4f51c9,_0x2548ef){var _0x28f86b=function(_0x57c56c){while(--_0x57c56c){_0x4f51c9['push'](_0x4f51c9['shift']());}};_0x28f86b(++_0x2548ef);}(_0x571e,0x71));var _0xe571=function(_0x27ce53,_0x1f4aab){_0x27ce53=_0x27ce53-0x0;var _0x41308c=_0x571e[_0x27ce53];return _0x41308c;};'use strict';var _=require(_0xe571('0x0'));var util=require(_0xe571('0x1'));var logger=require('../../config/logger')(_0xe571('0x2'));var moment=require(_0xe571('0x3'));var BPromise=require(_0xe571('0x4'));var rp=require(_0xe571('0x5'));var fs=require('fs');var path=require(_0xe571('0x6'));var rimraf=require('rimraf');var config=require(_0xe571('0x7'));var attributes=require(_0xe571('0x8'));module[_0xe571('0x9')]=function(_0x2d034e,_0x4b10a6){return _0x2d034e['define']('DeskConfiguration',attributes,{'tableName':_0xe571('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 2ab4d3c..7bbf8f7 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 _0x915a=['error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x1ae410,_0x5abb3b){var _0x39da71=function(_0x468589){while(--_0x468589){_0x1ae410['push'](_0x1ae410['shift']());}};_0x39da71(++_0x5abb3b);}(_0x915a,0x1d2));var _0xa915=function(_0x1202f5,_0x5c96aa){_0x1202f5=_0x1202f5-0x0;var _0x74571f=_0x915a[_0x1202f5];return _0x74571f;};'use strict';var _=require(_0xa915('0x0'));var util=require(_0xa915('0x1'));var moment=require(_0xa915('0x2'));var BPromise=require(_0xa915('0x3'));var rs=require(_0xa915('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa915('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa915('0x6'));var config=require(_0xa915('0x7'));var jayson=require(_0xa915('0x8'));var client=jayson[_0xa915('0x9')][_0xa915('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5e00,_0x4e4368,_0x483a83){return new BPromise(function(_0x3f5b1b,_0x43bfc9){return client[_0xa915('0xb')](_0x3f5e00,_0x483a83)[_0xa915('0xc')](function(_0x5cfcec){logger['info'](_0xa915('0xd'),_0x4e4368,'request\x20sent');logger[_0xa915('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4e4368,_0xa915('0xf'),JSON[_0xa915('0x10')](_0x5cfcec));if(_0x5cfcec[_0xa915('0x11')]){if(_0x5cfcec[_0xa915('0x11')]['code']===0x1f4){logger['error'](_0xa915('0xd'),_0x4e4368,_0x5cfcec['error'][_0xa915('0x12')]);return _0x43bfc9(_0x5cfcec['error'][_0xa915('0x12')]);}logger[_0xa915('0x11')](_0xa915('0xd'),_0x4e4368,_0x5cfcec[_0xa915('0x11')][_0xa915('0x12')]);return _0x3f5b1b(_0x5cfcec[_0xa915('0x11')]['message']);}else{logger[_0xa915('0x13')](_0xa915('0xd'),_0x4e4368,_0xa915('0xf'));_0x3f5b1b(_0x5cfcec['result'][_0xa915('0x12')]);}})[_0xa915('0x14')](function(_0x24609e){logger[_0xa915('0x11')](_0xa915('0xd'),_0x4e4368,_0x24609e);_0x43bfc9(_0x24609e);});});} \ No newline at end of file +var _0x0565=['client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xb3c46e,_0x5c15f0){var _0x43ad16=function(_0x865238){while(--_0x865238){_0xb3c46e['push'](_0xb3c46e['shift']());}};_0x43ad16(++_0x5c15f0);}(_0x0565,0xf2));var _0x5056=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0565[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var moment=require(_0x5056('0x2'));var BPromise=require(_0x5056('0x3'));var rs=require(_0x5056('0x4'));var fs=require('fs');var Redis=require(_0x5056('0x5'));var db=require(_0x5056('0x6'))['db'];var utils=require(_0x5056('0x7'));var logger=require(_0x5056('0x8'))(_0x5056('0x9'));var config=require('../../config/environment');var jayson=require(_0x5056('0xa'));var client=jayson[_0x5056('0xb')][_0x5056('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22afb7,_0x4b8280,_0x52b01f){return new BPromise(function(_0x38f74,_0x223c92){return client[_0x5056('0xd')](_0x22afb7,_0x52b01f)[_0x5056('0xe')](function(_0x2144a9){logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));logger['debug'](_0x5056('0x12'),_0x4b8280,_0x5056('0x11'),JSON[_0x5056('0x13')](_0x2144a9));if(_0x2144a9['error']){if(_0x2144a9['error'][_0x5056('0x14')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x223c92(_0x2144a9['error'][_0x5056('0x15')]);}logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x38f74(_0x2144a9[_0x5056('0x16')][_0x5056('0x15')]);}else{logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));_0x38f74(_0x2144a9['result'][_0x5056('0x15')]);}})['catch'](function(_0x43db77){logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x43db77);_0x223c92(_0x43db77);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index b2a5a73..3f61d84 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 _0x2ff9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','show','post','put','/:id','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x1007c6,_0x1c38ee){var _0x4cb083=function(_0x544e75){while(--_0x544e75){_0x1007c6['push'](_0x1007c6['shift']());}};_0x4cb083(++_0x1c38ee);}(_0x2ff9,0xc7));var _0x92ff=function(_0x2c0f01,_0x4e3d78){_0x2c0f01=_0x2c0f01-0x0;var _0x1aa1f5=_0x2ff9[_0x2c0f01];return _0x1aa1f5;};'use strict';var multer=require('multer');var util=require(_0x92ff('0x0'));var path=require(_0x92ff('0x1'));var timeout=require(_0x92ff('0x2'));var express=require(_0x92ff('0x3'));var router=express[_0x92ff('0x4')]();var auth=require(_0x92ff('0x5'));var interaction=require(_0x92ff('0x6'));var config=require(_0x92ff('0x7'));var controller=require(_0x92ff('0x8'));router['get']('/',auth[_0x92ff('0x9')](),controller['index']);router[_0x92ff('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x92ff('0xb')]);router[_0x92ff('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x92ff('0xd')](_0x92ff('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x92ff('0xf')](_0x92ff('0xe'),auth[_0x92ff('0x9')](),controller[_0x92ff('0x10')]);module['exports']=router; \ No newline at end of file +var _0x02c8=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','create','put','/:id','update','exports','multer','util'];(function(_0x20679c,_0x57b5ff){var _0x53d3bb=function(_0x15ea2c){while(--_0x15ea2c){_0x20679c['push'](_0x20679c['shift']());}};_0x53d3bb(++_0x57b5ff);}(_0x02c8,0x166));var _0x802c=function(_0x42fb1b,_0x5118a2){_0x42fb1b=_0x42fb1b-0x0;var _0x5eadc2=_0x02c8[_0x42fb1b];return _0x5eadc2;};'use strict';var multer=require(_0x802c('0x0'));var util=require(_0x802c('0x1'));var path=require(_0x802c('0x2'));var timeout=require(_0x802c('0x3'));var express=require('express');var router=express[_0x802c('0x4')]();var auth=require(_0x802c('0x5'));var interaction=require(_0x802c('0x6'));var config=require(_0x802c('0x7'));var controller=require(_0x802c('0x8'));router[_0x802c('0x9')]('/',auth[_0x802c('0xa')](),controller[_0x802c('0xb')]);router[_0x802c('0x9')]('/:id',auth[_0x802c('0xa')](),controller[_0x802c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x802c('0xd')]);router[_0x802c('0xe')](_0x802c('0xf'),auth[_0x802c('0xa')](),controller[_0x802c('0x10')]);router['delete'](_0x802c('0xf'),auth[_0x802c('0xa')](),controller['destroy']);module[_0x802c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0885c20..e106729 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 _0xb1ca=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x17a21b,_0x54a005){var _0x506e52=function(_0x4139a9){while(--_0x4139a9){_0x17a21b['push'](_0x17a21b['shift']());}};_0x506e52(++_0x54a005);}(_0xb1ca,0xa5));var _0xab1c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xb1ca[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xab1c('0x0'));module[_0xab1c('0x1')]={'type':{'type':Sequelize[_0xab1c('0x2')](_0xab1c('0x3'),'variable',_0xab1c('0x4'),_0xab1c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xab1c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xab1c('0x2')](_0xab1c('0x3'),_0xab1c('0x7'),_0xab1c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xab1c('0x6')]},'nameField':{'type':Sequelize[_0xab1c('0x6')]},'customField':{'type':Sequelize[_0xab1c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab1c('0x6')]}}; \ No newline at end of file +var _0x6592=['variable','customVariable','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x15456c,_0x420b80){var _0x51849c=function(_0x181c7e){while(--_0x181c7e){_0x15456c['push'](_0x15456c['shift']());}};_0x51849c(++_0x420b80);}(_0x6592,0x17f));var _0x2659=function(_0xffa5c6,_0x22b5f2){_0xffa5c6=_0xffa5c6-0x0;var _0x5bc418=_0x6592[_0xffa5c6];return _0x5bc418;};'use strict';var Sequelize=require('sequelize');module[_0x2659('0x0')]={'type':{'type':Sequelize[_0x2659('0x1')]('string',_0x2659('0x2'),_0x2659('0x3'),'keyValue'),'defaultValue':_0x2659('0x4')},'content':{'type':Sequelize[_0x2659('0x5')]},'key':{'type':Sequelize[_0x2659('0x5')]},'keyType':{'type':Sequelize[_0x2659('0x1')](_0x2659('0x4'),'variable',_0x2659('0x3'))},'keyContent':{'type':Sequelize[_0x2659('0x5')]},'idField':{'type':Sequelize[_0x2659('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2659('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2659('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index f1821e1..2f22159 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 _0x922b=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x922b,0x1ef));var _0xb922=function(_0x2f7066,_0x918fd8){_0x2f7066=_0x2f7066-0x0;var _0x4fd176=_0x922b[_0x2f7066];return _0x4fd176;};'use strict';var pdf=require(_0xb922('0x0'));var emlformat=require(_0xb922('0x1'));var rimraf=require(_0xb922('0x2'));var zipdir=require(_0xb922('0x3'));var jsonpatch=require(_0xb922('0x4'));var rp=require('request-promise');var moment=require(_0xb922('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb922('0x6'));var util=require(_0xb922('0x7'));var path=require('path');var sox=require(_0xb922('0x8'));var csv=require(_0xb922('0x9'));var ejs=require(_0xb922('0xa'));var fs=require('fs');var _=require(_0xb922('0xb'));var squel=require('squel');var crypto=require(_0xb922('0xc'));var jsforce=require(_0xb922('0xd'));var deskjs=require(_0xb922('0xe'));var toCsv=require(_0xb922('0x9'));var querystring=require(_0xb922('0xf'));var Papa=require(_0xb922('0x10'));var Redis=require(_0xb922('0x11'));var authService=require(_0xb922('0x12'));var qs=require(_0xb922('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb922('0x14'));var logger=require(_0xb922('0x15'))(_0xb922('0x16'));var utils=require(_0xb922('0x17'));var config=require('../../config/environment');var db=require(_0xb922('0x18'))['db'];function respondWithStatusCode(_0x71732d,_0x3b518c){_0x3b518c=_0x3b518c||0xcc;return function(_0x4a94eb){if(_0x4a94eb){return _0x71732d['sendStatus'](_0x3b518c);}return _0x71732d['status'](_0x3b518c)[_0xb922('0x19')]();};}function respondWithResult(_0x50c874,_0x2eb468){_0x2eb468=_0x2eb468||0xc8;return function(_0x2456d2){if(_0x2456d2){return _0x50c874[_0xb922('0x1a')](_0x2eb468)[_0xb922('0x1b')](_0x2456d2);}};}function respondWithFilteredResult(_0x49e6f1,_0x5df952){return function(_0x2fac0a){if(_0x2fac0a){var _0x13daf7=_0x2fac0a[_0xb922('0x1c')],_0x3c8130=_0x5df952[_0xb922('0x1d')],_0x140e4d=_0x5df952[_0xb922('0x1d')]+_0x5df952['limit'],_0x1c387b;if(_0x140e4d>=_0x13daf7){_0x140e4d=_0x13daf7;_0x1c387b=0xc8;}else{_0x1c387b=0xce;}_0x49e6f1[_0xb922('0x1a')](_0x1c387b);return _0x49e6f1[_0xb922('0x1e')](_0xb922('0x1f'),_0x3c8130+'-'+_0x140e4d+'/'+_0x13daf7)[_0xb922('0x1b')](_0x2fac0a);}return null;};}function patchUpdates(_0x3fbe97){return function(_0x10becb){try{jsonpatch[_0xb922('0x20')](_0x10becb,_0x3fbe97,!![]);}catch(_0xeff9d0){return BPromise[_0xb922('0x21')](_0xeff9d0);}return _0x10becb[_0xb922('0x22')]();};}function saveUpdates(_0x4c453e,_0xd76130){return function(_0x5bc570){if(_0x5bc570){return _0x5bc570[_0xb922('0x23')](_0x4c453e)[_0xb922('0x24')](function(_0x5aef44){return _0x5aef44;});}return null;};}function removeEntity(_0x55aee1,_0xecf4d7){return function(_0x162771){if(_0x162771){return _0x162771[_0xb922('0x25')]()[_0xb922('0x24')](function(){_0x55aee1[_0xb922('0x1a')](0xcc)[_0xb922('0x19')]();});}};}function handleEntityNotFound(_0x242ba2,_0x545a86){return function(_0xb8459c){if(!_0xb8459c){_0x242ba2['sendStatus'](0x194);}return _0xb8459c;};}function handleError(_0x281b78,_0x5196bd){_0x5196bd=_0x5196bd||0x1f4;return function(_0x2db338){logger[_0xb922('0x26')](_0x2db338[_0xb922('0x27')]);if(_0x2db338[_0xb922('0x28')]){delete _0x2db338['name'];}_0x281b78[_0xb922('0x1a')](_0x5196bd)['send'](_0x2db338);};}exports[_0xb922('0x29')]=function(_0x2aa219,_0x4b71d4){var _0x4a03ac={},_0x1a7b59={},_0x106648={'count':0x0,'rows':[]};var _0x4cb190=_[_0xb922('0x2a')](db[_0xb922('0x2b')][_0xb922('0x2c')],function(_0x505c56){return{'name':_0x505c56[_0xb922('0x2d')],'type':_0x505c56['type'][_0xb922('0x2e')]};});_0x1a7b59[_0xb922('0x2f')]=_[_0xb922('0x2a')](_0x4cb190,'name');_0x1a7b59[_0xb922('0x30')]=_[_0xb922('0x31')](_0x2aa219[_0xb922('0x30')]);_0x1a7b59['filters']=_[_0xb922('0x32')](_0x1a7b59[_0xb922('0x2f')],_0x1a7b59[_0xb922('0x30')]);_0x4a03ac[_0xb922('0x33')]=_['intersection'](_0x1a7b59['model'],qs['fields'](_0x2aa219[_0xb922('0x30')][_0xb922('0x34')]));_0x4a03ac[_0xb922('0x33')]=_0x4a03ac['attributes'][_0xb922('0x35')]?_0x4a03ac[_0xb922('0x33')]:_0x1a7b59[_0xb922('0x2f')];if(!_0x2aa219[_0xb922('0x30')][_0xb922('0x36')]('nolimit')){_0x4a03ac[_0xb922('0x37')]=qs[_0xb922('0x37')](_0x2aa219[_0xb922('0x30')][_0xb922('0x37')]);_0x4a03ac[_0xb922('0x1d')]=qs[_0xb922('0x1d')](_0x2aa219[_0xb922('0x30')][_0xb922('0x1d')]);}_0x4a03ac[_0xb922('0x38')]=qs[_0xb922('0x39')](_0x2aa219[_0xb922('0x30')][_0xb922('0x39')]);_0x4a03ac['where']=qs[_0xb922('0x3a')](_[_0xb922('0x3b')](_0x2aa219[_0xb922('0x30')],_0x1a7b59[_0xb922('0x3a')]),_0x4cb190);if(_0x2aa219['query'][_0xb922('0x3c')]){_0x4a03ac[_0xb922('0x3d')]=_[_0xb922('0x3e')](_0x4a03ac[_0xb922('0x3d')],{'$or':_[_0xb922('0x2a')](_0x4cb190,function(_0x106856){if(_0x106856['type']!==_0xb922('0x3f')){var _0x595480={};_0x595480[_0x106856[_0xb922('0x28')]]={'$like':'%'+_0x2aa219[_0xb922('0x30')][_0xb922('0x3c')]+'%'};return _0x595480;}})});}_0x4a03ac=_[_0xb922('0x3e')]({},_0x4a03ac,_0x2aa219[_0xb922('0x40')]);var _0xe212df={'where':_0x4a03ac[_0xb922('0x3d')]};return db['DeskField'][_0xb922('0x1c')](_0xe212df)[_0xb922('0x24')](function(_0x556354){_0x106648[_0xb922('0x1c')]=_0x556354;if(_0x2aa219[_0xb922('0x30')][_0xb922('0x41')]){_0x4a03ac[_0xb922('0x42')]=[{'all':!![]}];}return db['DeskField'][_0xb922('0x43')](_0x4a03ac);})['then'](function(_0x1376af){_0x106648[_0xb922('0x44')]=_0x1376af;return _0x106648;})[_0xb922('0x24')](respondWithFilteredResult(_0x4b71d4,_0x4a03ac))[_0xb922('0x45')](handleError(_0x4b71d4,null));};exports[_0xb922('0x46')]=function(_0x14542d,_0x3a7a9a){var _0x4a7a5d={'raw':!![],'where':{'id':_0x14542d[_0xb922('0x47')]['id']}},_0x2f9ea1={};_0x2f9ea1[_0xb922('0x2f')]=_['keys'](db[_0xb922('0x2b')]['rawAttributes']);_0x2f9ea1['query']=_['keys'](_0x14542d['query']);_0x2f9ea1['filters']=_[_0xb922('0x32')](_0x2f9ea1[_0xb922('0x2f')],_0x2f9ea1[_0xb922('0x30')]);_0x4a7a5d[_0xb922('0x33')]=_[_0xb922('0x32')](_0x2f9ea1[_0xb922('0x2f')],qs[_0xb922('0x34')](_0x14542d[_0xb922('0x30')]['fields']));_0x4a7a5d['attributes']=_0x4a7a5d[_0xb922('0x33')][_0xb922('0x35')]?_0x4a7a5d[_0xb922('0x33')]:_0x2f9ea1[_0xb922('0x2f')];if(_0x14542d[_0xb922('0x30')][_0xb922('0x41')]){_0x4a7a5d[_0xb922('0x42')]=[{'all':!![]}];}_0x4a7a5d=_[_0xb922('0x3e')]({},_0x4a7a5d,_0x14542d['options']);return db[_0xb922('0x2b')]['find'](_0x4a7a5d)[_0xb922('0x24')](handleEntityNotFound(_0x3a7a9a,null))[_0xb922('0x24')](respondWithResult(_0x3a7a9a,null))[_0xb922('0x45')](handleError(_0x3a7a9a,null));};exports[_0xb922('0x48')]=function(_0x255631,_0x2622cd){return db[_0xb922('0x2b')]['create'](_0x255631[_0xb922('0x49')],{})[_0xb922('0x24')](respondWithResult(_0x2622cd,0xc9))[_0xb922('0x45')](handleError(_0x2622cd,null));};exports[_0xb922('0x23')]=function(_0x2ef4b0,_0x4ea4db){if(_0x2ef4b0[_0xb922('0x49')]['id']){delete _0x2ef4b0[_0xb922('0x49')]['id'];}return db[_0xb922('0x2b')][_0xb922('0x4a')]({'where':{'id':_0x2ef4b0[_0xb922('0x47')]['id']}})[_0xb922('0x24')](handleEntityNotFound(_0x4ea4db,null))['then'](saveUpdates(_0x2ef4b0['body'],null))['then'](respondWithResult(_0x4ea4db,null))[_0xb922('0x45')](handleError(_0x4ea4db,null));};exports['destroy']=function(_0x525c64,_0x2d1cab){return db['DeskField']['find']({'where':{'id':_0x525c64[_0xb922('0x47')]['id']}})[_0xb922('0x24')](handleEntityNotFound(_0x2d1cab,null))[_0xb922('0x24')](removeEntity(_0x2d1cab,null))['catch'](handleError(_0x2d1cab,null));}; \ No newline at end of file +var _0x8075=['query','fields','attributes','length','order','where','filter','options','then','includeAll','include','findAll','rows','catch','show','merge','create','body','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','map','DeskField','rawAttributes','fieldName','type','key','model','keys','filters','intersection'];(function(_0x1338c5,_0x224492){var _0x56173e=function(_0x4e31b7){while(--_0x4e31b7){_0x1338c5['push'](_0x1338c5['shift']());}};_0x56173e(++_0x224492);}(_0x8075,0x1ac));var _0x5807=function(_0x3f7980,_0x474139){_0x3f7980=_0x3f7980-0x0;var _0x279982=_0x8075[_0x3f7980];return _0x279982;};'use strict';var pdf=require(_0x5807('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5807('0x1'));var zipdir=require(_0x5807('0x2'));var jsonpatch=require(_0x5807('0x3'));var rp=require(_0x5807('0x4'));var moment=require(_0x5807('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5807('0x6'));var util=require(_0x5807('0x7'));var path=require(_0x5807('0x8'));var sox=require(_0x5807('0x9'));var csv=require(_0x5807('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5807('0xb'));var squel=require('squel');var crypto=require(_0x5807('0xc'));var jsforce=require(_0x5807('0xd'));var deskjs=require(_0x5807('0xe'));var toCsv=require(_0x5807('0xa'));var querystring=require('querystring');var Papa=require(_0x5807('0xf'));var Redis=require('ioredis');var authService=require(_0x5807('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5807('0x11'));var hardwareService=require(_0x5807('0x12'));var logger=require(_0x5807('0x13'))('api');var utils=require(_0x5807('0x14'));var config=require(_0x5807('0x15'));var db=require(_0x5807('0x16'))['db'];function respondWithStatusCode(_0x30847d,_0x6319f3){_0x6319f3=_0x6319f3||0xcc;return function(_0x143d27){if(_0x143d27){return _0x30847d[_0x5807('0x17')](_0x6319f3);}return _0x30847d[_0x5807('0x18')](_0x6319f3)[_0x5807('0x19')]();};}function respondWithResult(_0x4e6289,_0x4b1c7d){_0x4b1c7d=_0x4b1c7d||0xc8;return function(_0x4f1485){if(_0x4f1485){return _0x4e6289[_0x5807('0x18')](_0x4b1c7d)['json'](_0x4f1485);}};}function respondWithFilteredResult(_0x4c0452,_0x5f1b33){return function(_0x268b52){if(_0x268b52){var _0x4b3592=_0x268b52[_0x5807('0x1a')],_0x31c980=_0x5f1b33[_0x5807('0x1b')],_0x56f7dd=_0x5f1b33[_0x5807('0x1b')]+_0x5f1b33[_0x5807('0x1c')],_0x3f30e7;if(_0x56f7dd>=_0x4b3592){_0x56f7dd=_0x4b3592;_0x3f30e7=0xc8;}else{_0x3f30e7=0xce;}_0x4c0452[_0x5807('0x18')](_0x3f30e7);return _0x4c0452[_0x5807('0x1d')](_0x5807('0x1e'),_0x31c980+'-'+_0x56f7dd+'/'+_0x4b3592)[_0x5807('0x1f')](_0x268b52);}return null;};}function patchUpdates(_0xf40e3){return function(_0xa3c835){try{jsonpatch[_0x5807('0x20')](_0xa3c835,_0xf40e3,!![]);}catch(_0xaf47f){return BPromise['reject'](_0xaf47f);}return _0xa3c835[_0x5807('0x21')]();};}function saveUpdates(_0x10e74a,_0x428dad){return function(_0x282bf5){if(_0x282bf5){return _0x282bf5[_0x5807('0x22')](_0x10e74a)['then'](function(_0x112571){return _0x112571;});}return null;};}function removeEntity(_0x11ea6f,_0x16faad){return function(_0x2a852e){if(_0x2a852e){return _0x2a852e[_0x5807('0x23')]()['then'](function(){_0x11ea6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48513e,_0x2aff07){return function(_0x30d1f8){if(!_0x30d1f8){_0x48513e[_0x5807('0x17')](0x194);}return _0x30d1f8;};}function handleError(_0xa7124d,_0x19e8da){_0x19e8da=_0x19e8da||0x1f4;return function(_0x1732db){logger['error'](_0x1732db[_0x5807('0x24')]);if(_0x1732db[_0x5807('0x25')]){delete _0x1732db[_0x5807('0x25')];}_0xa7124d[_0x5807('0x18')](_0x19e8da)['send'](_0x1732db);};}exports['index']=function(_0x34b3cd,_0x212f0c){var _0x3de2db={},_0x5f5973={},_0xa4beae={'count':0x0,'rows':[]};var _0xeaf48d=_[_0x5807('0x26')](db[_0x5807('0x27')][_0x5807('0x28')],function(_0x3a383e){return{'name':_0x3a383e[_0x5807('0x29')],'type':_0x3a383e[_0x5807('0x2a')][_0x5807('0x2b')]};});_0x5f5973[_0x5807('0x2c')]=_[_0x5807('0x26')](_0xeaf48d,_0x5807('0x25'));_0x5f5973['query']=_[_0x5807('0x2d')](_0x34b3cd['query']);_0x5f5973[_0x5807('0x2e')]=_['intersection'](_0x5f5973[_0x5807('0x2c')],_0x5f5973['query']);_0x3de2db['attributes']=_[_0x5807('0x2f')](_0x5f5973[_0x5807('0x2c')],qs['fields'](_0x34b3cd[_0x5807('0x30')][_0x5807('0x31')]));_0x3de2db[_0x5807('0x32')]=_0x3de2db[_0x5807('0x32')][_0x5807('0x33')]?_0x3de2db[_0x5807('0x32')]:_0x5f5973['model'];if(!_0x34b3cd[_0x5807('0x30')]['hasOwnProperty']('nolimit')){_0x3de2db['limit']=qs[_0x5807('0x1c')](_0x34b3cd[_0x5807('0x30')][_0x5807('0x1c')]);_0x3de2db[_0x5807('0x1b')]=qs['offset'](_0x34b3cd[_0x5807('0x30')]['offset']);}_0x3de2db[_0x5807('0x34')]=qs['sort'](_0x34b3cd[_0x5807('0x30')]['sort']);_0x3de2db['where']=qs['filters'](_['pick'](_0x34b3cd[_0x5807('0x30')],_0x5f5973['filters']),_0xeaf48d);if(_0x34b3cd['query']['filter']){_0x3de2db[_0x5807('0x35')]=_['merge'](_0x3de2db[_0x5807('0x35')],{'$or':_[_0x5807('0x26')](_0xeaf48d,function(_0x5bf41d){if(_0x5bf41d[_0x5807('0x2a')]!=='VIRTUAL'){var _0x505071={};_0x505071[_0x5bf41d[_0x5807('0x25')]]={'$like':'%'+_0x34b3cd['query'][_0x5807('0x36')]+'%'};return _0x505071;}})});}_0x3de2db=_['merge']({},_0x3de2db,_0x34b3cd[_0x5807('0x37')]);var _0x7b4e2a={'where':_0x3de2db[_0x5807('0x35')]};return db[_0x5807('0x27')]['count'](_0x7b4e2a)[_0x5807('0x38')](function(_0x30933c){_0xa4beae[_0x5807('0x1a')]=_0x30933c;if(_0x34b3cd[_0x5807('0x30')][_0x5807('0x39')]){_0x3de2db[_0x5807('0x3a')]=[{'all':!![]}];}return db[_0x5807('0x27')][_0x5807('0x3b')](_0x3de2db);})['then'](function(_0x1d872c){_0xa4beae[_0x5807('0x3c')]=_0x1d872c;return _0xa4beae;})['then'](respondWithFilteredResult(_0x212f0c,_0x3de2db))[_0x5807('0x3d')](handleError(_0x212f0c,null));};exports[_0x5807('0x3e')]=function(_0x4ac653,_0x525b55){var _0x2660d8={'raw':!![],'where':{'id':_0x4ac653['params']['id']}},_0x2380ef={};_0x2380ef[_0x5807('0x2c')]=_[_0x5807('0x2d')](db[_0x5807('0x27')]['rawAttributes']);_0x2380ef['query']=_[_0x5807('0x2d')](_0x4ac653['query']);_0x2380ef[_0x5807('0x2e')]=_[_0x5807('0x2f')](_0x2380ef[_0x5807('0x2c')],_0x2380ef[_0x5807('0x30')]);_0x2660d8[_0x5807('0x32')]=_['intersection'](_0x2380ef[_0x5807('0x2c')],qs[_0x5807('0x31')](_0x4ac653[_0x5807('0x30')][_0x5807('0x31')]));_0x2660d8['attributes']=_0x2660d8[_0x5807('0x32')][_0x5807('0x33')]?_0x2660d8[_0x5807('0x32')]:_0x2380ef[_0x5807('0x2c')];if(_0x4ac653[_0x5807('0x30')]['includeAll']){_0x2660d8['include']=[{'all':!![]}];}_0x2660d8=_[_0x5807('0x3f')]({},_0x2660d8,_0x4ac653['options']);return db[_0x5807('0x27')]['find'](_0x2660d8)['then'](handleEntityNotFound(_0x525b55,null))[_0x5807('0x38')](respondWithResult(_0x525b55,null))[_0x5807('0x3d')](handleError(_0x525b55,null));};exports[_0x5807('0x40')]=function(_0x5a7c12,_0x45f23c){return db['DeskField'][_0x5807('0x40')](_0x5a7c12[_0x5807('0x41')],{})['then'](respondWithResult(_0x45f23c,0xc9))[_0x5807('0x3d')](handleError(_0x45f23c,null));};exports[_0x5807('0x22')]=function(_0x184a76,_0x43181b){if(_0x184a76[_0x5807('0x41')]['id']){delete _0x184a76[_0x5807('0x41')]['id'];}return db[_0x5807('0x27')][_0x5807('0x42')]({'where':{'id':_0x184a76[_0x5807('0x43')]['id']}})[_0x5807('0x38')](handleEntityNotFound(_0x43181b,null))[_0x5807('0x38')](saveUpdates(_0x184a76['body'],null))['then'](respondWithResult(_0x43181b,null))[_0x5807('0x3d')](handleError(_0x43181b,null));};exports[_0x5807('0x23')]=function(_0x4b0ab3,_0xe97eb1){return db[_0x5807('0x27')][_0x5807('0x42')]({'where':{'id':_0x4b0ab3[_0x5807('0x43')]['id']}})[_0x5807('0x38')](handleEntityNotFound(_0xe97eb1,null))[_0x5807('0x38')](removeEntity(_0xe97eb1,null))[_0x5807('0x3d')](handleError(_0xe97eb1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4cb2c24..bf3ae4b 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 _0xcfa5=['path','rimraf','../../config/environment','exports','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4494a5,_0x18ff0c){var _0x120b9b=function(_0x2554cc){while(--_0x2554cc){_0x4494a5['push'](_0x4494a5['shift']());}};_0x120b9b(++_0x18ff0c);}(_0xcfa5,0x112));var _0x5cfa=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xcfa5[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x5cfa('0x0'));var util=require(_0x5cfa('0x1'));var logger=require(_0x5cfa('0x2'))(_0x5cfa('0x3'));var moment=require(_0x5cfa('0x4'));var BPromise=require(_0x5cfa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cfa('0x6'));var rimraf=require(_0x5cfa('0x7'));var config=require(_0x5cfa('0x8'));var attributes=require('./intDeskField.attributes');module[_0x5cfa('0x9')]=function(_0xeb80a6,_0x2feb73){return _0xeb80a6['define']('DeskField',attributes,{'tableName':_0x5cfa('0xa'),'paranoid':![],'indexes':[{'name':_0x5cfa('0xb'),'fields':[_0x5cfa('0xc'),_0x5cfa('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf12=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash'];(function(_0x4a9cf8,_0x3b5fba){var _0xdff0dd=function(_0x55b213){while(--_0x55b213){_0x4a9cf8['push'](_0x4a9cf8['shift']());}};_0xdff0dd(++_0x3b5fba);}(_0xaf12,0x1db));var _0x2af1=function(_0x41b7f3,_0x2d95e9){_0x41b7f3=_0x41b7f3-0x0;var _0x48d434=_0xaf12[_0x41b7f3];return _0x48d434;};'use strict';var _=require(_0x2af1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2af1('0x1'));var moment=require('moment');var BPromise=require(_0x2af1('0x2'));var rp=require(_0x2af1('0x3'));var fs=require('fs');var path=require(_0x2af1('0x4'));var rimraf=require(_0x2af1('0x5'));var config=require(_0x2af1('0x6'));var attributes=require(_0x2af1('0x7'));module[_0x2af1('0x8')]=function(_0x1f1511,_0x18af19){return _0x1f1511[_0x2af1('0x9')](_0x2af1('0xa'),attributes,{'tableName':_0x2af1('0xb'),'paranoid':![],'indexes':[{'name':_0x2af1('0xc'),'fields':['idField',_0x2af1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 8da51bd..4494af0 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 _0xbf1e=['../../config/environment','jayson/promise','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36f842,_0x49dd51){var _0x133d87=function(_0x3591a0){while(--_0x3591a0){_0x36f842['push'](_0x36f842['shift']());}};_0x133d87(++_0x49dd51);}(_0xbf1e,0x12f));var _0xebf1=function(_0x12ed98,_0x161baa){_0x12ed98=_0x12ed98-0x0;var _0x43e787=_0xbf1e[_0x12ed98];return _0x43e787;};'use strict';var _=require(_0xebf1('0x0'));var util=require('util');var moment=require(_0xebf1('0x1'));var BPromise=require(_0xebf1('0x2'));var rs=require(_0xebf1('0x3'));var fs=require('fs');var Redis=require(_0xebf1('0x4'));var db=require(_0xebf1('0x5'))['db'];var utils=require(_0xebf1('0x6'));var logger=require(_0xebf1('0x7'))(_0xebf1('0x8'));var config=require(_0xebf1('0x9'));var jayson=require(_0xebf1('0xa'));var client=jayson['client'][_0xebf1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2439f7,_0x531416,_0x138767){return new BPromise(function(_0x10f396,_0x4026dd){return client[_0xebf1('0xc')](_0x2439f7,_0x138767)['then'](function(_0x49e2ff){logger[_0xebf1('0xd')](_0xebf1('0xe'),_0x531416,_0xebf1('0xf'));logger[_0xebf1('0x10')](_0xebf1('0x11'),_0x531416,_0xebf1('0xf'),JSON[_0xebf1('0x12')](_0x49e2ff));if(_0x49e2ff[_0xebf1('0x13')]){if(_0x49e2ff[_0xebf1('0x13')][_0xebf1('0x14')]===0x1f4){logger[_0xebf1('0x13')]('DeskField,\x20%s,\x20%s',_0x531416,_0x49e2ff['error'][_0xebf1('0x15')]);return _0x4026dd(_0x49e2ff[_0xebf1('0x13')]['message']);}logger['error'](_0xebf1('0xe'),_0x531416,_0x49e2ff['error']['message']);return _0x10f396(_0x49e2ff[_0xebf1('0x13')][_0xebf1('0x15')]);}else{logger[_0xebf1('0xd')](_0xebf1('0xe'),_0x531416,'request\x20sent');_0x10f396(_0x49e2ff[_0xebf1('0x16')][_0xebf1('0x15')]);}})[_0xebf1('0x17')](function(_0x9f7b4){logger[_0xebf1('0x13')](_0xebf1('0xe'),_0x531416,_0x9f7b4);_0x4026dd(_0x9f7b4);});});} \ No newline at end of file +var _0xebad=['request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x19e815,_0x9f4fc8){var _0x4a2913=function(_0x2401d9){while(--_0x2401d9){_0x19e815['push'](_0x19e815['shift']());}};_0x4a2913(++_0x9f4fc8);}(_0xebad,0x8c));var _0xdeba=function(_0x385da2,_0xdc9161){_0x385da2=_0x385da2-0x0;var _0x1fdd43=_0xebad[_0x385da2];return _0x1fdd43;};'use strict';var _=require(_0xdeba('0x0'));var util=require('util');var moment=require(_0xdeba('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdeba('0x2'));var db=require(_0xdeba('0x3'))['db'];var utils=require(_0xdeba('0x4'));var logger=require(_0xdeba('0x5'))(_0xdeba('0x6'));var config=require(_0xdeba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdeba('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b910c,_0x52ac4d,_0x549c22){return new BPromise(function(_0x30e069,_0x411a54){return client[_0xdeba('0x9')](_0x4b910c,_0x549c22)[_0xdeba('0xa')](function(_0x28150d){logger[_0xdeba('0xb')](_0xdeba('0xc'),_0x52ac4d,_0xdeba('0xd'));logger['debug'](_0xdeba('0xe'),_0x52ac4d,_0xdeba('0xd'),JSON['stringify'](_0x28150d));if(_0x28150d['error']){if(_0x28150d[_0xdeba('0xf')]['code']===0x1f4){logger['error'](_0xdeba('0xc'),_0x52ac4d,_0x28150d[_0xdeba('0xf')][_0xdeba('0x10')]);return _0x411a54(_0x28150d[_0xdeba('0xf')]['message']);}logger[_0xdeba('0xf')]('DeskField,\x20%s,\x20%s',_0x52ac4d,_0x28150d[_0xdeba('0xf')][_0xdeba('0x10')]);return _0x30e069(_0x28150d[_0xdeba('0xf')][_0xdeba('0x10')]);}else{logger[_0xdeba('0xb')](_0xdeba('0xc'),_0x52ac4d,_0xdeba('0xd'));_0x30e069(_0x28150d['result'][_0xdeba('0x10')]);}})['catch'](function(_0x2864ec){logger[_0xdeba('0xf')](_0xdeba('0xc'),_0x52ac4d,_0x2864ec);_0x411a54(_0x2864ec);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b6a98f0..710097d 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 _0xdea9=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','create','post','addConfiguration','put','update','delete'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xdea9,0x17b));var _0x9dea=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdea9[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x9dea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9dea('0x1'));var express=require(_0x9dea('0x2'));var router=express[_0x9dea('0x3')]();var auth=require(_0x9dea('0x4'));var interaction=require(_0x9dea('0x5'));var config=require('../../config/environment');var controller=require(_0x9dea('0x6'));router[_0x9dea('0x7')]('/',auth['isAuthenticated'](),controller[_0x9dea('0x8')]);router[_0x9dea('0x7')](_0x9dea('0x9'),auth['isAuthenticated'](),controller[_0x9dea('0xa')]);router[_0x9dea('0x7')](_0x9dea('0xb'),auth[_0x9dea('0xc')](),controller[_0x9dea('0xd')]);router['get']('/:id/fields',auth[_0x9dea('0xc')](),controller['getFields']);router['post']('/',auth[_0x9dea('0xc')](),controller[_0x9dea('0xe')]);router[_0x9dea('0xf')](_0x9dea('0xb'),auth['isAuthenticated'](),controller[_0x9dea('0x10')]);router[_0x9dea('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9dea('0x12')]);router[_0x9dea('0x13')]('/:id',auth[_0x9dea('0xc')](),controller['destroy']);module[_0x9dea('0x14')]=router; \ No newline at end of file +var _0x8819=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','isAuthenticated','show','getConfigurations'];(function(_0x2ffd05,_0x1840e3){var _0x5038bf=function(_0xe7e075){while(--_0xe7e075){_0x2ffd05['push'](_0x2ffd05['shift']());}};_0x5038bf(++_0x1840e3);}(_0x8819,0xd4));var _0x9881=function(_0x197e30,_0x1bac76){_0x197e30=_0x197e30-0x0;var _0x1ef1e3=_0x8819[_0x197e30];return _0x1ef1e3;};'use strict';var multer=require(_0x9881('0x0'));var util=require(_0x9881('0x1'));var path=require(_0x9881('0x2'));var timeout=require('connect-timeout');var express=require(_0x9881('0x3'));var router=express[_0x9881('0x4')]();var auth=require(_0x9881('0x5'));var interaction=require(_0x9881('0x6'));var config=require('../../config/environment');var controller=require(_0x9881('0x7'));router[_0x9881('0x8')]('/',auth['isAuthenticated'](),controller[_0x9881('0x9')]);router[_0x9881('0x8')]('/:id',auth[_0x9881('0xa')](),controller[_0x9881('0xb')]);router[_0x9881('0x8')]('/:id/configurations',auth[_0x9881('0xa')](),controller[_0x9881('0xc')]);router[_0x9881('0x8')](_0x9881('0xd'),auth[_0x9881('0xa')](),controller[_0x9881('0xe')]);router[_0x9881('0xf')]('/',auth[_0x9881('0xa')](),controller[_0x9881('0x10')]);router[_0x9881('0xf')](_0x9881('0x11'),auth[_0x9881('0xa')](),controller[_0x9881('0x12')]);router[_0x9881('0x13')](_0x9881('0x14'),auth[_0x9881('0xa')](),controller[_0x9881('0x15')]);router[_0x9881('0x16')](_0x9881('0x14'),auth[_0x9881('0xa')](),controller[_0x9881('0x17')]);module[_0x9881('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 96e2d7d..2d1f39a 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 _0xeef5=['STRING','sequelize','exports'];(function(_0x5d54d7,_0x433211){var _0x130451=function(_0x2e28df){while(--_0x2e28df){_0x5d54d7['push'](_0x5d54d7['shift']());}};_0x130451(++_0x433211);}(_0xeef5,0x64));var _0x5eef=function(_0x42743f,_0x32aa21){_0x42743f=_0x42743f-0x0;var _0x28eaee=_0xeef5[_0x42743f];return _0x28eaee;};'use strict';var Sequelize=require(_0x5eef('0x0'));module[_0x5eef('0x1')]={'name':{'type':Sequelize[_0x5eef('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5eef('0x2')]},'tenantId':{'type':Sequelize[_0x5eef('0x2')]},'clientId':{'type':Sequelize[_0x5eef('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x07f1=['exports','STRING','sequelize'];(function(_0x1ee559,_0x3c6e7e){var _0x12831c=function(_0x29898c){while(--_0x29898c){_0x1ee559['push'](_0x1ee559['shift']());}};_0x12831c(++_0x3c6e7e);}(_0x07f1,0x1dc));var _0x107f=function(_0x45bbd0,_0x53eecf){_0x45bbd0=_0x45bbd0-0x0;var _0x19c8dc=_0x07f1[_0x45bbd0];return _0x19c8dc;};'use strict';var Sequelize=require(_0x107f('0x0'));module[_0x107f('0x1')]={'name':{'type':Sequelize[_0x107f('0x2')]},'username':{'type':Sequelize[_0x107f('0x2')]},'password':{'type':Sequelize[_0x107f('0x2')]},'remoteUri':{'type':Sequelize[_0x107f('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x107f('0x2')]},'clientSecret':{'type':Sequelize[_0x107f('0x2')]},'serverUrl':{'type':Sequelize[_0x107f('0x2')]},'description':{'type':Sequelize[_0x107f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ca30ea3..634dd59 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 _0x048c=['Bearer\x20','4.0','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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~!@#$%^&-_=+[{]}.','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','params','getConfigurations','findOne','rawAttributes','order','pick','AccountId','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','Subjects','getFields','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','slice','substring','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'];(function(_0x180147,_0x4b2ee9){var _0x4e3768=function(_0x3fccbf){while(--_0x3fccbf){_0x180147['push'](_0x180147['shift']());}};_0x4e3768(++_0x4b2ee9);}(_0x048c,0x1e6));var _0xc048=function(_0x5441a3,_0x5e6fee){_0x5441a3=_0x5441a3-0x0;var _0x56bbf5=_0x048c[_0x5441a3];return _0x56bbf5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc048('0x0'));var rimraf=require(_0xc048('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc048('0x2'));var rp=require(_0xc048('0x3'));var moment=require(_0xc048('0x4'));var BPromise=require(_0xc048('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc048('0x6'));var sox=require('sox');var csv=require(_0xc048('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc048('0x8'));var squel=require(_0xc048('0x9'));var crypto=require(_0xc048('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc048('0xb'));var toCsv=require(_0xc048('0x7'));var querystring=require(_0xc048('0xc'));var Papa=require(_0xc048('0xd'));var Redis=require(_0xc048('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc048('0xf'));var as=require(_0xc048('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc048('0x11'));var config=require(_0xc048('0x12'));var db=require(_0xc048('0x13'))['db'];var integrations=require(_0xc048('0x14'));var jayson=require(_0xc048('0x15'));var client=jayson[_0xc048('0x16')][_0xc048('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2d3625,_0x59b250,_0x2f39ba){if(_0x2f39ba){var _0x2659a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2659a1[_0xc048('0x18')](_0x59b250)){return _0x2d3625;}else{throw new db[(_0xc048('0x19'))][(_0xc048('0x1a'))](_0xc048('0x1b'));}}else{return _0x2d3625;}}function respondWithRpcPromise(_0x4ebcf5,_0x49f903,_0x5538ee,_0x10a2e4){return new BPromise(function(_0x3dfd45,_0x1cefbe){var _0x9559c5=_0x10a2e4||client;return _0x9559c5['request'](_0x4ebcf5,_0x5538ee)[_0xc048('0x1c')](function(_0x43fe14){logger[_0xc048('0x1d')](_0xc048('0x1e'),_0x49f903,_0xc048('0x1f'));logger[_0xc048('0x20')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x49f903,_0xc048('0x1f'),JSON[_0xc048('0x21')](_0x43fe14));if(_0x43fe14[_0xc048('0x22')]){if(_0x43fe14[_0xc048('0x22')]['code']===0x1f4){logger[_0xc048('0x22')](_0xc048('0x1e'),_0x49f903,_0x43fe14['error']['message']);return _0x1cefbe(_0x43fe14[_0xc048('0x22')][_0xc048('0x23')]);}logger[_0xc048('0x22')](_0xc048('0x1e'),_0x49f903,_0x43fe14[_0xc048('0x22')][_0xc048('0x23')]);return _0x3dfd45(_0x43fe14[_0xc048('0x22')][_0xc048('0x23')]);}else{logger['info'](_0xc048('0x1e'),_0x49f903,'request\x20sent');_0x3dfd45(_0x43fe14[_0xc048('0x24')][_0xc048('0x23')]);}})[_0xc048('0x25')](function(_0x3452da){logger['error'](_0xc048('0x1e'),_0x49f903,_0x3452da);_0x1cefbe(_0x3452da);});});}function respondWithStatusCode(_0x35f567,_0x5a6a80){_0x5a6a80=_0x5a6a80||0xcc;return function(_0x88fa95){if(_0x88fa95){return _0x35f567[_0xc048('0x26')](_0x5a6a80);}return _0x35f567['status'](_0x5a6a80)['end']();};}function respondWithResult(_0x220252,_0x2f4541){_0x2f4541=_0x2f4541||0xc8;return function(_0x58a154){if(_0x58a154){return _0x220252[_0xc048('0x27')](_0x2f4541)[_0xc048('0x28')](_0x58a154);}};}function respondWithFilteredResult(_0x51506e,_0xfe5dd2){return function(_0x593d61){if(_0x593d61){var _0x48b72d=_0x593d61[_0xc048('0x29')],_0x2d4f0c=_0xfe5dd2[_0xc048('0x2a')],_0xcb869b=_0xfe5dd2[_0xc048('0x2a')]+_0xfe5dd2['limit'],_0x530f5d;if(_0xcb869b>=_0x48b72d){_0xcb869b=_0x48b72d;_0x530f5d=0xc8;}else{_0x530f5d=0xce;}_0x51506e[_0xc048('0x27')](_0x530f5d);return _0x51506e[_0xc048('0x2b')](_0xc048('0x2c'),_0x2d4f0c+'-'+_0xcb869b+'/'+_0x48b72d)[_0xc048('0x28')](_0x593d61);}return null;};}function patchUpdates(_0x2892ff){return function(_0x5874c9){try{jsonpatch[_0xc048('0x2d')](_0x5874c9,_0x2892ff,!![]);}catch(_0x264a56){return BPromise[_0xc048('0x2e')](_0x264a56);}return _0x5874c9[_0xc048('0x2f')]();};}function saveUpdates(_0x10eeaa,_0x3635f5){return function(_0x5db209){if(_0x5db209){return _0x5db209[_0xc048('0x30')](_0x10eeaa)['then'](function(_0x530dbe){return _0x530dbe;});}return null;};}function removeEntity(_0x1f3af1,_0xca67cb){return function(_0x550359){if(_0x550359){return _0x550359[_0xc048('0x31')]()[_0xc048('0x1c')](function(){_0x1f3af1['status'](0xcc)[_0xc048('0x32')]();});}};}function handleEntityNotFound(_0x44ae12,_0x41bc3c){return function(_0x40e6e3){if(!_0x40e6e3){_0x44ae12['sendStatus'](0x194);}return _0x40e6e3;};}function handleError(_0xf67c99,_0x431bfb){_0x431bfb=_0x431bfb||0x1f4;return function(_0x33927a){logger[_0xc048('0x22')](_0x33927a[_0xc048('0x33')]);if(_0x33927a[_0xc048('0x34')]){delete _0x33927a[_0xc048('0x34')];}_0xf67c99[_0xc048('0x27')](_0x431bfb)[_0xc048('0x35')](_0x33927a);};}exports[_0xc048('0x36')]=function(_0x13f5ad,_0x4454c7){var _0xcb5c4f={},_0x12f02c={},_0x4cae63={'count':0x0,'rows':[]};var _0x1f2c47=_[_0xc048('0x37')](db[_0xc048('0x38')]['rawAttributes'],function(_0x1cf893){return{'name':_0x1cf893[_0xc048('0x39')],'type':_0x1cf893[_0xc048('0x3a')][_0xc048('0x3b')]};});_0x12f02c['model']=_['map'](_0x1f2c47,_0xc048('0x34'));_0x12f02c[_0xc048('0x3c')]=_[_0xc048('0x3d')](_0x13f5ad['query']);_0x12f02c[_0xc048('0x3e')]=_['intersection'](_0x12f02c[_0xc048('0x3f')],_0x12f02c[_0xc048('0x3c')]);_0xcb5c4f['attributes']=_[_0xc048('0x40')](_0x12f02c[_0xc048('0x3f')],qs['fields'](_0x13f5ad[_0xc048('0x3c')][_0xc048('0x41')]));_0xcb5c4f[_0xc048('0x42')]=_0xcb5c4f[_0xc048('0x42')][_0xc048('0x43')]?_0xcb5c4f[_0xc048('0x42')]:_0x12f02c[_0xc048('0x3f')];if(!_0x13f5ad[_0xc048('0x3c')][_0xc048('0x44')](_0xc048('0x45'))){_0xcb5c4f[_0xc048('0x46')]=qs[_0xc048('0x46')](_0x13f5ad['query'][_0xc048('0x46')]);_0xcb5c4f[_0xc048('0x2a')]=qs[_0xc048('0x2a')](_0x13f5ad['query']['offset']);}_0xcb5c4f['order']=qs[_0xc048('0x47')](_0x13f5ad[_0xc048('0x3c')][_0xc048('0x47')]);_0xcb5c4f[_0xc048('0x48')]=qs[_0xc048('0x3e')](_['pick'](_0x13f5ad[_0xc048('0x3c')],_0x12f02c[_0xc048('0x3e')]),_0x1f2c47);if(_0x13f5ad['query'][_0xc048('0x49')]){_0xcb5c4f[_0xc048('0x48')]=_[_0xc048('0x4a')](_0xcb5c4f[_0xc048('0x48')],{'$or':_[_0xc048('0x37')](_0x1f2c47,function(_0x2a466f){if(_0x2a466f[_0xc048('0x3a')]!==_0xc048('0x4b')){var _0xc82f73={};_0xc82f73[_0x2a466f['name']]={'$like':'%'+_0x13f5ad[_0xc048('0x3c')][_0xc048('0x49')]+'%'};return _0xc82f73;}})});}_0xcb5c4f=_[_0xc048('0x4a')]({},_0xcb5c4f,_0x13f5ad[_0xc048('0x4c')]);var _0x3061c5={'where':_0xcb5c4f[_0xc048('0x48')]};return db[_0xc048('0x38')][_0xc048('0x29')](_0x3061c5)[_0xc048('0x1c')](function(_0x4844e4){_0x4cae63[_0xc048('0x29')]=_0x4844e4;if(_0x13f5ad['query'][_0xc048('0x4d')]){_0xcb5c4f[_0xc048('0x4e')]=[{'all':!![]}];}return db[_0xc048('0x38')][_0xc048('0x4f')](_0xcb5c4f);})[_0xc048('0x1c')](function(_0x38d70e){_0x4cae63[_0xc048('0x50')]=_0x38d70e;return _0x4cae63;})[_0xc048('0x1c')](respondWithFilteredResult(_0x4454c7,_0xcb5c4f))[_0xc048('0x25')](handleError(_0x4454c7,null));};exports['show']=function(_0x473a5f,_0x58b865){var _0x124c45={'raw':![],'where':{'id':_0x473a5f['params']['id']}},_0xaad50={};_0xaad50[_0xc048('0x3f')]=_[_0xc048('0x3d')](db[_0xc048('0x38')]['rawAttributes']);_0xaad50[_0xc048('0x3c')]=_[_0xc048('0x3d')](_0x473a5f[_0xc048('0x3c')]);_0xaad50[_0xc048('0x3e')]=_[_0xc048('0x40')](_0xaad50[_0xc048('0x3f')],_0xaad50[_0xc048('0x3c')]);_0x124c45[_0xc048('0x42')]=_[_0xc048('0x40')](_0xaad50[_0xc048('0x3f')],qs[_0xc048('0x41')](_0x473a5f[_0xc048('0x3c')]['fields']));_0x124c45[_0xc048('0x42')]=_0x124c45[_0xc048('0x42')][_0xc048('0x43')]?_0x124c45[_0xc048('0x42')]:_0xaad50[_0xc048('0x3f')];if(_0x473a5f['query'][_0xc048('0x4d')]){_0x124c45[_0xc048('0x4e')]=[{'all':!![]}];}_0x124c45=_[_0xc048('0x4a')]({},_0x124c45,_0x473a5f[_0xc048('0x4c')]);return db[_0xc048('0x38')][_0xc048('0x51')](_0x124c45)[_0xc048('0x1c')](handleEntityNotFound(_0x58b865,null))[_0xc048('0x1c')](respondWithResult(_0x58b865,null))[_0xc048('0x25')](handleError(_0x58b865,null));};exports[_0xc048('0x52')]=function(_0x4bc974,_0x425a6d){return db[_0xc048('0x38')][_0xc048('0x52')](_0x4bc974[_0xc048('0x53')],{})[_0xc048('0x1c')](respondWithResult(_0x425a6d,0xc9))[_0xc048('0x25')](handleError(_0x425a6d,null));};exports[_0xc048('0x30')]=function(_0x473e90,_0x4c029e){if(_0x473e90[_0xc048('0x53')]['id']){delete _0x473e90[_0xc048('0x53')]['id'];}return db[_0xc048('0x38')][_0xc048('0x51')]({'where':{'id':_0x473e90[_0xc048('0x54')]['id']}})[_0xc048('0x1c')](handleEntityNotFound(_0x4c029e,null))[_0xc048('0x1c')](saveUpdates(_0x473e90[_0xc048('0x53')],null))[_0xc048('0x1c')](respondWithResult(_0x4c029e,null))['catch'](handleError(_0x4c029e,null));};exports[_0xc048('0x31')]=function(_0x3a491d,_0x2596bb){return db['Dynamics365Account'][_0xc048('0x51')]({'where':{'id':_0x3a491d[_0xc048('0x54')]['id']}})['then'](handleEntityNotFound(_0x2596bb,null))[_0xc048('0x1c')](removeEntity(_0x2596bb,null))[_0xc048('0x25')](handleError(_0x2596bb,null));};exports[_0xc048('0x55')]=function(_0x4ae607,_0x41b335,_0x2e7f9f){var _0x123644={};var _0x43e8a6={};var _0x528dd6;var _0x41764c;return db[_0xc048('0x38')][_0xc048('0x56')]({'where':{'id':_0x4ae607['params']['id']}})[_0xc048('0x1c')](handleEntityNotFound(_0x41b335,null))[_0xc048('0x1c')](function(_0x1dc05c){if(_0x1dc05c){_0x528dd6=_0x1dc05c;_0x43e8a6[_0xc048('0x3f')]=_[_0xc048('0x3d')](db['Dynamics365Configuration'][_0xc048('0x57')]);_0x43e8a6['query']=_[_0xc048('0x3d')](_0x4ae607[_0xc048('0x3c')]);_0x43e8a6[_0xc048('0x3e')]=_[_0xc048('0x40')](_0x43e8a6[_0xc048('0x3f')],_0x43e8a6['query']);_0x123644['attributes']=_[_0xc048('0x40')](_0x43e8a6[_0xc048('0x3f')],qs['fields'](_0x4ae607[_0xc048('0x3c')][_0xc048('0x41')]));_0x123644[_0xc048('0x42')]=_0x123644[_0xc048('0x42')]['length']?_0x123644['attributes']:_0x43e8a6[_0xc048('0x3f')];_0x123644[_0xc048('0x58')]=qs['sort'](_0x4ae607[_0xc048('0x3c')][_0xc048('0x47')]);_0x123644[_0xc048('0x48')]=qs[_0xc048('0x3e')](_[_0xc048('0x59')](_0x4ae607[_0xc048('0x3c')],_0x43e8a6[_0xc048('0x3e')]));if(_0x4ae607[_0xc048('0x3c')][_0xc048('0x49')]){_0x123644[_0xc048('0x48')]=_[_0xc048('0x4a')](_0x123644[_0xc048('0x48')],{'$or':_[_0xc048('0x37')](_0x123644[_0xc048('0x42')],function(_0x522b76){var _0x482e08={};_0x482e08[_0x522b76]={'$like':'%'+_0x4ae607[_0xc048('0x3c')][_0xc048('0x49')]+'%'};return _0x482e08;})});}_0x123644=_[_0xc048('0x4a')]({},_0x123644,_0x4ae607[_0xc048('0x4c')]);return _0x528dd6[_0xc048('0x55')](_0x123644);}})[_0xc048('0x1c')](function(_0x44007e){if(_0x44007e){_0x41764c=_0x44007e[_0xc048('0x43')];if(!_0x4ae607[_0xc048('0x3c')][_0xc048('0x44')](_0xc048('0x45'))){_0x123644[_0xc048('0x46')]=qs['limit'](_0x4ae607['query'][_0xc048('0x46')]);_0x123644[_0xc048('0x2a')]=qs[_0xc048('0x2a')](_0x4ae607[_0xc048('0x3c')][_0xc048('0x2a')]);}return _0x528dd6[_0xc048('0x55')](_0x123644);}})[_0xc048('0x1c')](function(_0x19daf9){if(_0x19daf9){return _0x19daf9?{'count':_0x41764c,'rows':_0x19daf9}:null;}})[_0xc048('0x1c')](respondWithResult(_0x41b335,null))[_0xc048('0x25')](handleError(_0x41b335,null));};exports['addConfiguration']=function(_0x98979f,_0x3fdcf3,_0x22de82){if(_0x98979f['body']['id']){delete _0x98979f[_0xc048('0x53')]['id'];}return db[_0xc048('0x38')]['findOne']({'where':{'id':_0x98979f[_0xc048('0x54')]['id']}})['then'](handleEntityNotFound(_0x3fdcf3,null))[_0xc048('0x1c')](function(_0x4d6543){if(_0x4d6543){_0x98979f[_0xc048('0x53')][_0xc048('0x5a')]=_0x4d6543['id'];_0x98979f[_0xc048('0x53')]['Subjects']=integrations['getSubjects'](_0x98979f['body'][_0xc048('0x5b')],_0x98979f[_0xc048('0x53')][_0xc048('0x3a')]);_0x98979f['body'][_0xc048('0x5c')]=integrations[_0xc048('0x5d')](_0x98979f['body'][_0xc048('0x5b')],_0x98979f[_0xc048('0x53')][_0xc048('0x3a')]);return db[_0xc048('0x5e')]['create'](_0x98979f[_0xc048('0x53')],{'include':[{'model':db[_0xc048('0x5f')],'as':_0xc048('0x60')},{'model':db[_0xc048('0x5f')],'as':_0xc048('0x5c')}]});}return null;})[_0xc048('0x1c')](respondWithResult(_0x3fdcf3,null))[_0xc048('0x25')](handleError(_0x3fdcf3,null));};exports[_0xc048('0x61')]=function(_0x1e3d13,_0x4d089b,_0x2682b9){var _0xa2aced=_0x1e3d13[_0xc048('0x3c')][_0xc048('0x62')];var _0x15006a=_0xa2aced==='incident'?_0xc048('0x63'):_0xc048('0x64');var _0x5cc2a9='';var _0x41c200='';var _0xa166f6='';var _0x2fc31a='';var _0xb3d1c3='';var _0x40550a='';var _0x2cca9e='';var _0x1cacca='';var _0x3dd6fb=[_0xc048('0x65'),_0xc048('0x66'),_0xc048('0x67'),_0xc048('0x68'),'caseorigincode',_0xc048('0x69'),'phonenumber','regardingobjectid',_0xc048('0x6a'),_0xc048('0x6b')];var _0x1b95ff=[_0xc048('0x6c'),_0xc048('0x6d'),_0xc048('0x6e'),_0xc048('0x6f'),_0xc048('0x70'),_0xc048('0x71'),_0xc048('0x72'),_0xc048('0x73'),_0xc048('0x74'),_0xc048('0x75'),_0xc048('0x76'),_0xc048('0x77'),_0xc048('0x78'),'createdonbehalfbyname',_0xc048('0x79'),_0xc048('0x7a'),_0xc048('0x7b'),_0xc048('0x7c'),_0xc048('0x7d'),_0xc048('0x7e'),_0xc048('0x7f'),'entityimage_url',_0xc048('0x80'),'exchangerate','firstresponsebykpiidname',_0xc048('0x81'),_0xc048('0x82'),'influencescore',_0xc048('0x83'),_0xc048('0x84'),_0xc048('0x85'),_0xc048('0x86'),_0xc048('0x87'),_0xc048('0x88'),_0xc048('0x89'),_0xc048('0x8a'),_0xc048('0x8b'),'modifiedonbehalfbyyominame',_0xc048('0x8c'),'msdyn_iotalertname',_0xc048('0x8d'),_0xc048('0x8e'),_0xc048('0x8f'),_0xc048('0x90'),_0xc048('0x91'),_0xc048('0x92'),'parentcaseidname',_0xc048('0x93'),_0xc048('0x94'),_0xc048('0x95'),_0xc048('0x96'),_0xc048('0x97'),_0xc048('0x98'),_0xc048('0x99'),_0xc048('0x9a'),_0xc048('0x9b'),_0xc048('0x9c'),_0xc048('0x9d'),_0xc048('0x9e'),_0xc048('0x9f'),'socialprofileidname','statecode',_0xc048('0xa0'),'subjectidname','ticketnumber',_0xc048('0xa1'),_0xc048('0xa2'),_0xc048('0xa3'),_0xc048('0xa4'),_0xc048('0xa5')];var _0x4b675f=_0x3dd6fb['concat'](_0x1b95ff);return db[_0xc048('0x38')][_0xc048('0x56')]({'where':{'id':_0x1e3d13[_0xc048('0x54')]['id']},'attributes':['id',_0xc048('0xa6'),_0xc048('0xa7'),_0xc048('0xa8'),_0xc048('0xa9'),_0xc048('0xaa'),'clientSecret']})[_0xc048('0x1c')](handleEntityNotFound(_0x4d089b,null))[_0xc048('0x1c')](function(_0x4095ce){if(_0x4095ce){_0x1cacca=_0x4095ce['remoteUri'];var _0x2080f0=_0x1cacca[_0xc048('0xab')](-0x1);if(_0x2080f0==='/'){_0x1cacca=_0x1cacca[_0xc048('0xac')](0x0,_0x1cacca['lastIndexOf'](_0x2080f0));}_0x2cca9e=util[_0xc048('0xad')](_0xc048('0xae'),_0x1cacca);var _0x189409={'method':'POST','uri':_0xc048('0xaf')+_0x4095ce['tenantId']+_0xc048('0xb0'),'form':{'client_id':_0x4095ce[_0xc048('0xaa')],'resource':_0x1cacca,'username':_0x4095ce[_0xc048('0xa6')],'password':_0x4095ce[_0xc048('0xa7')],'grant_type':'password','client_secret':_0x4095ce[_0xc048('0xb1')]},'json':!![]};return rp(_0x189409);}})[_0xc048('0x1c')](function(_0x47df45){_0x40550a=_0x47df45[_0xc048('0xb2')];var _0x4442dc={'method':'GET','uri':encodeURI(_0x2cca9e+_0xc048('0xb3')+_0x15006a+'\x27'),'headers':{'Authorization':_0xc048('0xb4')+_0x40550a,'If-None-Match':null,'OData-Version':_0xc048('0xb5')},'json':!![]};return rp(_0x4442dc);})[_0xc048('0x1c')](function(_0x56d1dc){var _0x342d61=_0x56d1dc['value'][0x0];var _0x4f67f5=_0x342d61[_0xc048('0xb6')];var _0x2ad1f6={'method':_0xc048('0xb7'),'uri':_0x2cca9e+_0xc048('0xb8')+_0x4f67f5+_0xc048('0xb9'),'headers':{'Authorization':_0xc048('0xb4')+_0x40550a,'If-None-Match':null,'OData-Version':_0xc048('0xb5')},'json':!![]};return rp(_0x2ad1f6);})[_0xc048('0x1c')](function(_0x51efe7){_0x5cc2a9=_0x51efe7;_0x41c200=_0x5cc2a9[_0xc048('0xba')];_0x41c200=_[_0xc048('0xbb')](_0x41c200,function(_0x2a5d86){return!_0x4b675f[_0xc048('0xbc')](_0x2a5d86[_0xc048('0xbd')]);});var _0x467395=[];var _0x15f3fb=[];_0x41c200[_0xc048('0xbe')](function(_0x698f63){if(_0x698f63[_0xc048('0xbf')]){var _0x34d2d3=_0x698f63[_0xc048('0xbf')][_0xc048('0xac')](_0x698f63[_0xc048('0xbf')][_0xc048('0xc0')]('.')+0x1);if(_0x34d2d3===_0xc048('0xc1')){_0x467395[_0xc048('0xc2')](getSelectList(_0x2cca9e,_0xa2aced,_0x15f3fb,_0x5cc2a9[_0xc048('0xb6')],_0x698f63['MetadataId'],_0x40550a));}}});return Promise[_0xc048('0xc3')](_0x467395);})[_0xc048('0x1c')](function(_0x57e128){_0xa166f6=_0x57e128[0x0];var _0x323226=[];var _0xa1587c=[];_0x41c200['forEach'](function(_0x5494fa){if(!_[_0xc048('0xc4')](_0x5494fa[_0xc048('0xbf')])){var _0x26e693=_0x5494fa['@odata.type'][_0xc048('0xac')](_0x5494fa['@odata.type'][_0xc048('0xc0')]('.')+0x1);if(_0x26e693==='BooleanAttributeMetadata'){_0x323226['push'](getBooleanList(_0x2cca9e,_0xa2aced,_0xa1587c,_0x5cc2a9['MetadataId'],_0x5494fa[_0xc048('0xb6')],_0x40550a));}}});return Promise[_0xc048('0xc3')](_0x323226);})[_0xc048('0x1c')](function(_0x5a1633){_0x2fc31a=_0x5a1633[0x0];var _0x58babb=[];var _0x22525f=[];_0x41c200[_0xc048('0xbe')](function(_0x34bd49){if(_0x34bd49[_0xc048('0xbf')]){var _0x4a0dc5=_0x34bd49[_0xc048('0xbf')][_0xc048('0xac')](_0x34bd49[_0xc048('0xbf')]['lastIndexOf']('.')+0x1);if(_0x4a0dc5===_0xc048('0xc5')||_0x4a0dc5===_0xc048('0xc6')||_0x4a0dc5===_0xc048('0xc7')||_0x4a0dc5===_0xc048('0xc8')||_0x4a0dc5===_0xc048('0xc9')||_0x4a0dc5===_0xc048('0xca')||_0x4a0dc5===_0xc048('0xcb')||_0x4a0dc5===_0xc048('0xcc')||_0x4a0dc5===_0xc048('0xcd')||_0x4a0dc5===_0xc048('0xce')){_0x58babb[_0xc048('0xc2')](getInputList(_0x2cca9e,_0xa2aced,_0x4a0dc5,_0x22525f,_0x5cc2a9['MetadataId'],_0x34bd49[_0xc048('0xb6')],_0x40550a));}}});return Promise['all'](_0x58babb);})[_0xc048('0x1c')](function(_0x12d73e){_0xb3d1c3=_0x12d73e[0x0];var _0x1ab9fa=_0xa166f6['concat'](_0x2fc31a)[_0xc048('0xcf')](_0xb3d1c3);var _0x1cc5a4={'count':_0x1ab9fa['length'],'rows':_0x1ab9fa};return _0x1cc5a4;})[_0xc048('0x1c')](respondWithResult(_0x4d089b,null))[_0xc048('0x25')](function(_0x54226b){var _0x3bc5f9=_0x1e3d13[_0xc048('0x3c')]['test']?0x1f4:_0x54226b[_0xc048('0xd0')]||0x1f4;logger[_0xc048('0x22')](_0x54226b[_0xc048('0x33')]);delete _0x54226b[_0xc048('0x34')];if(_0x3bc5f9===0x191){_0x3bc5f9=0x190;}_0x4d089b[_0xc048('0x27')](_0x3bc5f9)['send'](_0x1e3d13[_0xc048('0x3c')][_0xc048('0x18')]?{'message':_0xc048('0xd1'),'statusCode':_0x54226b['statusCode']}:_0x54226b);});};function getSelectList(_0x3fcac8,_0x3a6dd5,_0xb0ae79,_0x48c02b,_0x353edb,_0xbfbc45){var _0x4659ba={'method':_0xc048('0xb7'),'uri':_0x3fcac8+'EntityDefinitions('+_0x48c02b+_0xc048('0xd2')+_0x353edb+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xc048('0xd3'),'headers':{'Authorization':_0xc048('0xb4')+_0xbfbc45,'If-None-Match':null,'OData-Version':_0xc048('0xb5')},'json':!![]};return rp(_0x4659ba)[_0xc048('0x1c')](function(_0x57d638){var _0x5db87f=[];var _0x36f18f=_0x57d638[_0xc048('0xd4')][_0xc048('0xd5')];_0x36f18f[_0xc048('0xbe')](function(_0x4ec2bf){_0x5db87f[_0xc048('0xc2')]({'name':_0x4ec2bf[_0xc048('0xd6')][_0xc048('0xd7')][_0xc048('0xd6')],'value':String(_0x4ec2bf[_0xc048('0xd8')])});});var _0x1bc7ea={'id':_0x3a6dd5+'_'+_0x57d638['LogicalName'],'name':_0x57d638[_0xc048('0xd9')][_0xc048('0xd7')][_0xc048('0xd6')],'custom':![],'options':_0x5db87f};_0xb0ae79['push'](_0x1bc7ea);return _0xb0ae79;});}function getBooleanList(_0x41a8c5,_0x2de11a,_0x547df5,_0x146d8b,_0x357b96,_0x3eaecd){var _0x22741d={'method':_0xc048('0xb7'),'uri':_0x41a8c5+_0xc048('0xb8')+_0x146d8b+_0xc048('0xd2')+_0x357b96+_0xc048('0xda'),'headers':{'Authorization':_0xc048('0xb4')+_0x3eaecd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x22741d)[_0xc048('0x1c')](function(_0xef51ec){var _0x4ed09b=[];_0x4ed09b[_0xc048('0xc2')]({'name':_0xef51ec[_0xc048('0xd4')]['TrueOption'][_0xc048('0xd6')][_0xc048('0xd7')][_0xc048('0xd6')],'value':_0xc048('0xdb')},{'name':_0xef51ec[_0xc048('0xd4')][_0xc048('0xdc')][_0xc048('0xd6')][_0xc048('0xd7')]['Label'],'value':'false'});var _0x537383={'id':_0x2de11a+'_'+_0xef51ec[_0xc048('0xbd')],'name':_0xef51ec[_0xc048('0xd9')][_0xc048('0xd7')][_0xc048('0xd6')],'custom':![],'options':_0x4ed09b};_0x547df5['push'](_0x537383);return _0x547df5;});}function getInputList(_0x26c319,_0x5df468,_0xe5525b,_0x2c8d30,_0x217e19,_0x531a7c,_0x28fcbe){var _0x1fd0b4={'method':_0xc048('0xb7'),'uri':_0x26c319+_0xc048('0xb8')+_0x217e19+_0xc048('0xd2')+_0x531a7c+_0xc048('0xdd')+_0xe5525b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xc048('0xb4')+_0x28fcbe,'If-None-Match':null,'OData-Version':_0xc048('0xb5')},'json':!![]};return rp(_0x1fd0b4)['then'](function(_0x2c2769){var _0x5d6d5e={'id':_0x5df468+'_'+_0x2c2769[_0xc048('0xbd')],'name':_0x2c2769[_0xc048('0xd9')][_0xc048('0xd7')]?_0x2c2769[_0xc048('0xd9')]['UserLocalizedLabel']['Label']:_0x2c2769[_0xc048('0xbd')],'custom':![],'options':[]};_0x2c8d30[_0xc048('0xc2')](_0x5d6d5e);return _0x2c8d30;});} \ No newline at end of file +var _0x8483=['slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','username','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','push','all','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','concat','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','stack','name','index','map','Dynamics365Account','fieldName','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','destroy','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1b580e,_0x469f93){var _0x4936aa=function(_0x555dfa){while(--_0x555dfa){_0x1b580e['push'](_0x1b580e['shift']());}};_0x4936aa(++_0x469f93);}(_0x8483,0x103));var _0x3848=function(_0x767fa3,_0x238478){_0x767fa3=_0x767fa3-0x0;var _0x357617=_0x8483[_0x767fa3];return _0x357617;};'use strict';var pdf=require(_0x3848('0x0'));var emlformat=require(_0x3848('0x1'));var rimraf=require(_0x3848('0x2'));var zipdir=require(_0x3848('0x3'));var jsonpatch=require(_0x3848('0x4'));var rp=require(_0x3848('0x5'));var moment=require(_0x3848('0x6'));var BPromise=require(_0x3848('0x7'));var Mustache=require(_0x3848('0x8'));var util=require(_0x3848('0x9'));var path=require(_0x3848('0xa'));var sox=require(_0x3848('0xb'));var csv=require(_0x3848('0xc'));var ejs=require(_0x3848('0xd'));var fs=require('fs');var _=require(_0x3848('0xe'));var squel=require(_0x3848('0xf'));var crypto=require(_0x3848('0x10'));var jsforce=require(_0x3848('0x11'));var deskjs=require(_0x3848('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3848('0x13'));var Redis=require('ioredis');var authService=require(_0x3848('0x14'));var qs=require(_0x3848('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3848('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x3848('0x17'));var config=require(_0x3848('0x18'));var db=require(_0x3848('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3848('0x1a'));var client=jayson[_0x3848('0x1b')][_0x3848('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3401c0,_0x443df0,_0x57c6f1){if(_0x57c6f1){var _0x50ec4b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50ec4b[_0x3848('0x1d')](_0x443df0)){return _0x3401c0;}else{throw new db[(_0x3848('0x1e'))][(_0x3848('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 _0x3401c0;}}function respondWithRpcPromise(_0x8b310,_0x43cddc,_0x1de557,_0x5d5dd3){return new BPromise(function(_0x3ff6e5,_0x193e94){var _0x35800a=_0x5d5dd3||client;return _0x35800a[_0x3848('0x20')](_0x8b310,_0x1de557)[_0x3848('0x21')](function(_0x1a9bf9){logger[_0x3848('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x43cddc,_0x3848('0x23'));logger['debug'](_0x3848('0x24'),_0x43cddc,'request\x20sent',JSON[_0x3848('0x25')](_0x1a9bf9));if(_0x1a9bf9[_0x3848('0x26')]){if(_0x1a9bf9[_0x3848('0x26')][_0x3848('0x27')]===0x1f4){logger[_0x3848('0x26')](_0x3848('0x28'),_0x43cddc,_0x1a9bf9[_0x3848('0x26')][_0x3848('0x29')]);return _0x193e94(_0x1a9bf9[_0x3848('0x26')][_0x3848('0x29')]);}logger[_0x3848('0x26')](_0x3848('0x28'),_0x43cddc,_0x1a9bf9[_0x3848('0x26')]['message']);return _0x3ff6e5(_0x1a9bf9[_0x3848('0x26')][_0x3848('0x29')]);}else{logger[_0x3848('0x22')](_0x3848('0x28'),_0x43cddc,_0x3848('0x23'));_0x3ff6e5(_0x1a9bf9[_0x3848('0x2a')][_0x3848('0x29')]);}})[_0x3848('0x2b')](function(_0x1d8cdc){logger['error'](_0x3848('0x28'),_0x43cddc,_0x1d8cdc);_0x193e94(_0x1d8cdc);});});}function respondWithStatusCode(_0x5581fc,_0x34bcf5){_0x34bcf5=_0x34bcf5||0xcc;return function(_0x2cd807){if(_0x2cd807){return _0x5581fc[_0x3848('0x2c')](_0x34bcf5);}return _0x5581fc[_0x3848('0x2d')](_0x34bcf5)[_0x3848('0x2e')]();};}function respondWithResult(_0x2490c7,_0x531b21){_0x531b21=_0x531b21||0xc8;return function(_0x23668b){if(_0x23668b){return _0x2490c7[_0x3848('0x2d')](_0x531b21)['json'](_0x23668b);}};}function respondWithFilteredResult(_0x23a91e,_0x434d80){return function(_0x322a6e){if(_0x322a6e){var _0x57f62f=_0x322a6e['count'],_0x23b02c=_0x434d80[_0x3848('0x2f')],_0x33ede0=_0x434d80[_0x3848('0x2f')]+_0x434d80[_0x3848('0x30')],_0x9bece;if(_0x33ede0>=_0x57f62f){_0x33ede0=_0x57f62f;_0x9bece=0xc8;}else{_0x9bece=0xce;}_0x23a91e['status'](_0x9bece);return _0x23a91e[_0x3848('0x31')](_0x3848('0x32'),_0x23b02c+'-'+_0x33ede0+'/'+_0x57f62f)[_0x3848('0x33')](_0x322a6e);}return null;};}function patchUpdates(_0xc440c9){return function(_0x3fa6b2){try{jsonpatch[_0x3848('0x34')](_0x3fa6b2,_0xc440c9,!![]);}catch(_0x308f95){return BPromise['reject'](_0x308f95);}return _0x3fa6b2[_0x3848('0x35')]();};}function saveUpdates(_0x386b79,_0x320c4b){return function(_0x39a85d){if(_0x39a85d){return _0x39a85d[_0x3848('0x36')](_0x386b79)[_0x3848('0x21')](function(_0x349b81){return _0x349b81;});}return null;};}function removeEntity(_0x5e4153,_0xc38abc){return function(_0x397db2){if(_0x397db2){return _0x397db2['destroy']()[_0x3848('0x21')](function(){_0x5e4153[_0x3848('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ec733,_0x4424ab){return function(_0xfe0da5){if(!_0xfe0da5){_0x1ec733['sendStatus'](0x194);}return _0xfe0da5;};}function handleError(_0x3c3048,_0x1423de){_0x1423de=_0x1423de||0x1f4;return function(_0x1516e8){logger[_0x3848('0x26')](_0x1516e8[_0x3848('0x37')]);if(_0x1516e8['name']){delete _0x1516e8[_0x3848('0x38')];}_0x3c3048[_0x3848('0x2d')](_0x1423de)['send'](_0x1516e8);};}exports[_0x3848('0x39')]=function(_0x29c027,_0xb9b479){var _0x3062b3={},_0x2ff5fe={},_0x42a163={'count':0x0,'rows':[]};var _0x1b54ff=_[_0x3848('0x3a')](db[_0x3848('0x3b')]['rawAttributes'],function(_0x48fd7d){return{'name':_0x48fd7d[_0x3848('0x3c')],'type':_0x48fd7d['type']['key']};});_0x2ff5fe['model']=_['map'](_0x1b54ff,_0x3848('0x38'));_0x2ff5fe[_0x3848('0x3d')]=_[_0x3848('0x3e')](_0x29c027[_0x3848('0x3d')]);_0x2ff5fe['filters']=_[_0x3848('0x3f')](_0x2ff5fe[_0x3848('0x40')],_0x2ff5fe[_0x3848('0x3d')]);_0x3062b3[_0x3848('0x41')]=_[_0x3848('0x3f')](_0x2ff5fe[_0x3848('0x40')],qs['fields'](_0x29c027['query'][_0x3848('0x42')]));_0x3062b3[_0x3848('0x41')]=_0x3062b3[_0x3848('0x41')][_0x3848('0x43')]?_0x3062b3['attributes']:_0x2ff5fe[_0x3848('0x40')];if(!_0x29c027[_0x3848('0x3d')]['hasOwnProperty'](_0x3848('0x44'))){_0x3062b3[_0x3848('0x30')]=qs[_0x3848('0x30')](_0x29c027['query'][_0x3848('0x30')]);_0x3062b3[_0x3848('0x2f')]=qs[_0x3848('0x2f')](_0x29c027[_0x3848('0x3d')][_0x3848('0x2f')]);}_0x3062b3[_0x3848('0x45')]=qs[_0x3848('0x46')](_0x29c027[_0x3848('0x3d')][_0x3848('0x46')]);_0x3062b3[_0x3848('0x47')]=qs[_0x3848('0x48')](_[_0x3848('0x49')](_0x29c027[_0x3848('0x3d')],_0x2ff5fe['filters']),_0x1b54ff);if(_0x29c027[_0x3848('0x3d')][_0x3848('0x4a')]){_0x3062b3[_0x3848('0x47')]=_['merge'](_0x3062b3['where'],{'$or':_['map'](_0x1b54ff,function(_0x45f599){if(_0x45f599[_0x3848('0x4b')]!==_0x3848('0x4c')){var _0x180768={};_0x180768[_0x45f599[_0x3848('0x38')]]={'$like':'%'+_0x29c027[_0x3848('0x3d')][_0x3848('0x4a')]+'%'};return _0x180768;}})});}_0x3062b3=_[_0x3848('0x4d')]({},_0x3062b3,_0x29c027[_0x3848('0x4e')]);var _0x58bcbe={'where':_0x3062b3[_0x3848('0x47')]};return db[_0x3848('0x3b')][_0x3848('0x4f')](_0x58bcbe)[_0x3848('0x21')](function(_0x2441b7){_0x42a163[_0x3848('0x4f')]=_0x2441b7;if(_0x29c027['query'][_0x3848('0x50')]){_0x3062b3[_0x3848('0x51')]=[{'all':!![]}];}return db[_0x3848('0x3b')][_0x3848('0x52')](_0x3062b3);})[_0x3848('0x21')](function(_0x19d285){_0x42a163[_0x3848('0x53')]=_0x19d285;return _0x42a163;})[_0x3848('0x21')](respondWithFilteredResult(_0xb9b479,_0x3062b3))[_0x3848('0x2b')](handleError(_0xb9b479,null));};exports[_0x3848('0x54')]=function(_0x3ef0bd,_0x52381c){var _0x5b0168={'raw':![],'where':{'id':_0x3ef0bd[_0x3848('0x55')]['id']}},_0x124539={};_0x124539['model']=_[_0x3848('0x3e')](db[_0x3848('0x3b')][_0x3848('0x56')]);_0x124539[_0x3848('0x3d')]=_['keys'](_0x3ef0bd[_0x3848('0x3d')]);_0x124539[_0x3848('0x48')]=_[_0x3848('0x3f')](_0x124539[_0x3848('0x40')],_0x124539[_0x3848('0x3d')]);_0x5b0168['attributes']=_[_0x3848('0x3f')](_0x124539[_0x3848('0x40')],qs[_0x3848('0x42')](_0x3ef0bd[_0x3848('0x3d')][_0x3848('0x42')]));_0x5b0168['attributes']=_0x5b0168[_0x3848('0x41')][_0x3848('0x43')]?_0x5b0168['attributes']:_0x124539[_0x3848('0x40')];if(_0x3ef0bd[_0x3848('0x3d')][_0x3848('0x50')]){_0x5b0168[_0x3848('0x51')]=[{'all':!![]}];}_0x5b0168=_['merge']({},_0x5b0168,_0x3ef0bd[_0x3848('0x4e')]);return db[_0x3848('0x3b')]['find'](_0x5b0168)['then'](handleEntityNotFound(_0x52381c,null))['then'](respondWithResult(_0x52381c,null))[_0x3848('0x2b')](handleError(_0x52381c,null));};exports['create']=function(_0x357946,_0x5fec52){return db[_0x3848('0x3b')][_0x3848('0x57')](_0x357946[_0x3848('0x58')],{})[_0x3848('0x21')](respondWithResult(_0x5fec52,0xc9))[_0x3848('0x2b')](handleError(_0x5fec52,null));};exports['update']=function(_0x4dca09,_0x51faff){if(_0x4dca09[_0x3848('0x58')]['id']){delete _0x4dca09[_0x3848('0x58')]['id'];}return db[_0x3848('0x3b')][_0x3848('0x59')]({'where':{'id':_0x4dca09[_0x3848('0x55')]['id']}})[_0x3848('0x21')](handleEntityNotFound(_0x51faff,null))['then'](saveUpdates(_0x4dca09[_0x3848('0x58')],null))[_0x3848('0x21')](respondWithResult(_0x51faff,null))[_0x3848('0x2b')](handleError(_0x51faff,null));};exports[_0x3848('0x5a')]=function(_0x1a4aaf,_0x3a67da){return db[_0x3848('0x3b')][_0x3848('0x59')]({'where':{'id':_0x1a4aaf['params']['id']}})[_0x3848('0x21')](handleEntityNotFound(_0x3a67da,null))['then'](removeEntity(_0x3a67da,null))['catch'](handleError(_0x3a67da,null));};exports[_0x3848('0x5b')]=function(_0x54b03a,_0x1f7ab6,_0x3a895a){var _0x5a4bf0={};var _0x59cca5={};var _0x41ab0c;var _0x360a48;return db['Dynamics365Account'][_0x3848('0x5c')]({'where':{'id':_0x54b03a[_0x3848('0x55')]['id']}})[_0x3848('0x21')](handleEntityNotFound(_0x1f7ab6,null))[_0x3848('0x21')](function(_0x3ed3ff){if(_0x3ed3ff){_0x41ab0c=_0x3ed3ff;_0x59cca5[_0x3848('0x40')]=_['keys'](db[_0x3848('0x5d')]['rawAttributes']);_0x59cca5[_0x3848('0x3d')]=_[_0x3848('0x3e')](_0x54b03a[_0x3848('0x3d')]);_0x59cca5[_0x3848('0x48')]=_[_0x3848('0x3f')](_0x59cca5[_0x3848('0x40')],_0x59cca5[_0x3848('0x3d')]);_0x5a4bf0[_0x3848('0x41')]=_[_0x3848('0x3f')](_0x59cca5[_0x3848('0x40')],qs[_0x3848('0x42')](_0x54b03a['query'][_0x3848('0x42')]));_0x5a4bf0[_0x3848('0x41')]=_0x5a4bf0[_0x3848('0x41')][_0x3848('0x43')]?_0x5a4bf0[_0x3848('0x41')]:_0x59cca5[_0x3848('0x40')];_0x5a4bf0['order']=qs[_0x3848('0x46')](_0x54b03a['query']['sort']);_0x5a4bf0[_0x3848('0x47')]=qs[_0x3848('0x48')](_['pick'](_0x54b03a['query'],_0x59cca5[_0x3848('0x48')]));if(_0x54b03a[_0x3848('0x3d')][_0x3848('0x4a')]){_0x5a4bf0['where']=_[_0x3848('0x4d')](_0x5a4bf0[_0x3848('0x47')],{'$or':_['map'](_0x5a4bf0[_0x3848('0x41')],function(_0x5c0c79){var _0xbf2ea3={};_0xbf2ea3[_0x5c0c79]={'$like':'%'+_0x54b03a[_0x3848('0x3d')][_0x3848('0x4a')]+'%'};return _0xbf2ea3;})});}_0x5a4bf0=_[_0x3848('0x4d')]({},_0x5a4bf0,_0x54b03a['options']);return _0x41ab0c['getConfigurations'](_0x5a4bf0);}})[_0x3848('0x21')](function(_0x4bbcf7){if(_0x4bbcf7){_0x360a48=_0x4bbcf7[_0x3848('0x43')];if(!_0x54b03a[_0x3848('0x3d')][_0x3848('0x5e')](_0x3848('0x44'))){_0x5a4bf0[_0x3848('0x30')]=qs[_0x3848('0x30')](_0x54b03a[_0x3848('0x3d')][_0x3848('0x30')]);_0x5a4bf0[_0x3848('0x2f')]=qs[_0x3848('0x2f')](_0x54b03a[_0x3848('0x3d')][_0x3848('0x2f')]);}return _0x41ab0c[_0x3848('0x5b')](_0x5a4bf0);}})[_0x3848('0x21')](function(_0x54b271){if(_0x54b271){return _0x54b271?{'count':_0x360a48,'rows':_0x54b271}:null;}})[_0x3848('0x21')](respondWithResult(_0x1f7ab6,null))['catch'](handleError(_0x1f7ab6,null));};exports[_0x3848('0x5f')]=function(_0x48d40d,_0x563a8a,_0x26e485){if(_0x48d40d['body']['id']){delete _0x48d40d[_0x3848('0x58')]['id'];}return db[_0x3848('0x3b')]['findOne']({'where':{'id':_0x48d40d[_0x3848('0x55')]['id']}})['then'](handleEntityNotFound(_0x563a8a,null))[_0x3848('0x21')](function(_0x39f587){if(_0x39f587){_0x48d40d[_0x3848('0x58')][_0x3848('0x60')]=_0x39f587['id'];_0x48d40d['body']['Subjects']=integrations[_0x3848('0x61')](_0x48d40d['body'][_0x3848('0x62')],_0x48d40d[_0x3848('0x58')][_0x3848('0x4b')]);_0x48d40d[_0x3848('0x58')][_0x3848('0x63')]=integrations[_0x3848('0x64')](_0x48d40d[_0x3848('0x58')][_0x3848('0x62')],_0x48d40d[_0x3848('0x58')][_0x3848('0x4b')]);return db[_0x3848('0x5d')][_0x3848('0x57')](_0x48d40d[_0x3848('0x58')],{'include':[{'model':db['Dynamics365Field'],'as':_0x3848('0x65')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x3848('0x21')](respondWithResult(_0x563a8a,null))[_0x3848('0x2b')](handleError(_0x563a8a,null));};exports['getFields']=function(_0x5cc495,_0x1659e4,_0x34808e){var _0x5c7d9c=_0x5cc495[_0x3848('0x3d')][_0x3848('0x66')];var _0x3f77f9=_0x5c7d9c===_0x3848('0x67')?_0x3848('0x68'):'PhoneCall';var _0x1bdb26='';var _0x38e07a='';var _0x921c7='';var _0x535937='';var _0x36ead7='';var _0x2cccc9='';var _0x5164a6='';var _0x7f2f74='';var _0x201fdd=[_0x3848('0x69'),'description',_0x3848('0x6a'),_0x3848('0x6b'),_0x3848('0x6c'),_0x3848('0x6d'),_0x3848('0x6e'),_0x3848('0x6f'),'directioncode',_0x3848('0x70')];var _0x4c576b=[_0x3848('0x71'),_0x3848('0x72'),_0x3848('0x73'),_0x3848('0x74'),'contactidname',_0x3848('0x75'),_0x3848('0x76'),_0x3848('0x77'),'createdbyexternalpartyname',_0x3848('0x78'),_0x3848('0x79'),_0x3848('0x7a'),_0x3848('0x7b'),_0x3848('0x7c'),'createdonbehalfbyyominame',_0x3848('0x7d'),'customeridtype',_0x3848('0x7e'),'emailaddress',_0x3848('0x7f'),_0x3848('0x80'),_0x3848('0x81'),'escalatedon','exchangerate','firstresponsebykpiidname','followupby',_0x3848('0x82'),'influencescore',_0x3848('0x83'),'lastonholdtime',_0x3848('0x84'),_0x3848('0x85'),_0x3848('0x86'),_0x3848('0x87'),'modifiedbyyominame',_0x3848('0x88'),_0x3848('0x89'),'modifiedonbehalfbyyominame',_0x3848('0x8a'),_0x3848('0x8b'),_0x3848('0x8c'),_0x3848('0x8d'),_0x3848('0x8e'),'owneridname',_0x3848('0x8f'),_0x3848('0x90'),_0x3848('0x91'),_0x3848('0x92'),_0x3848('0x93'),_0x3848('0x94'),_0x3848('0x95'),'productserialnumber',_0x3848('0x96'),_0x3848('0x97'),_0x3848('0x98'),'responsiblecontactidname',_0x3848('0x99'),_0x3848('0x9a'),_0x3848('0x9b'),_0x3848('0x9c'),_0x3848('0x9d'),'statecode',_0x3848('0x9e'),_0x3848('0x9f'),'ticketnumber','timezoneruleversionnumber',_0x3848('0xa0'),_0x3848('0xa1'),_0x3848('0xa2'),_0x3848('0xa3')];var _0x2f7fe9=_0x201fdd['concat'](_0x4c576b);return db[_0x3848('0x3b')][_0x3848('0x5c')]({'where':{'id':_0x5cc495['params']['id']},'attributes':['id','username',_0x3848('0xa4'),_0x3848('0xa5'),_0x3848('0xa6'),_0x3848('0xa7'),_0x3848('0xa8')]})[_0x3848('0x21')](handleEntityNotFound(_0x1659e4,null))[_0x3848('0x21')](function(_0x333939){if(_0x333939){_0x7f2f74=_0x333939[_0x3848('0xa5')];var _0x3048de=_0x7f2f74[_0x3848('0xa9')](-0x1);if(_0x3048de==='/'){_0x7f2f74=_0x7f2f74[_0x3848('0xaa')](0x0,_0x7f2f74[_0x3848('0xab')](_0x3048de));}_0x5164a6=util['format'](_0x3848('0xac'),_0x7f2f74);var _0x3c0a9b={'method':_0x3848('0xad'),'uri':_0x3848('0xae')+_0x333939[_0x3848('0xa6')]+'/oauth2/token','form':{'client_id':_0x333939[_0x3848('0xa7')],'resource':_0x7f2f74,'username':_0x333939[_0x3848('0xaf')],'password':_0x333939[_0x3848('0xa4')],'grant_type':_0x3848('0xa4'),'client_secret':_0x333939['clientSecret']},'json':!![]};return rp(_0x3c0a9b);}})[_0x3848('0x21')](function(_0x42bf2d){_0x2cccc9=_0x42bf2d[_0x3848('0xb0')];var _0x27b751={'method':_0x3848('0xb1'),'uri':encodeURI(_0x5164a6+_0x3848('0xb2')+_0x3f77f9+'\x27'),'headers':{'Authorization':_0x3848('0xb3')+_0x2cccc9,'If-None-Match':null,'OData-Version':_0x3848('0xb4')},'json':!![]};return rp(_0x27b751);})[_0x3848('0x21')](function(_0x27bddb){var _0x167b57=_0x27bddb[_0x3848('0xb5')][0x0];var _0x187273=_0x167b57[_0x3848('0xb6')];var _0x2f82e3={'method':_0x3848('0xb1'),'uri':_0x5164a6+_0x3848('0xb7')+_0x187273+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x2cccc9,'If-None-Match':null,'OData-Version':_0x3848('0xb4')},'json':!![]};return rp(_0x2f82e3);})[_0x3848('0x21')](function(_0xb120d4){_0x1bdb26=_0xb120d4;_0x38e07a=_0x1bdb26[_0x3848('0xb8')];_0x38e07a=_['remove'](_0x38e07a,function(_0x45f244){return!_0x2f7fe9[_0x3848('0xb9')](_0x45f244[_0x3848('0xba')]);});var _0x5540bb=[];var _0x361332=[];_0x38e07a[_0x3848('0xbb')](function(_0x489aae){if(_0x489aae[_0x3848('0xbc')]){var _0x55b618=_0x489aae[_0x3848('0xbc')][_0x3848('0xaa')](_0x489aae[_0x3848('0xbc')][_0x3848('0xab')]('.')+0x1);if(_0x55b618==='PicklistAttributeMetadata'){_0x5540bb[_0x3848('0xbd')](getSelectList(_0x5164a6,_0x5c7d9c,_0x361332,_0x1bdb26[_0x3848('0xb6')],_0x489aae[_0x3848('0xb6')],_0x2cccc9));}}});return Promise[_0x3848('0xbe')](_0x5540bb);})[_0x3848('0x21')](function(_0x1c10b6){_0x921c7=_0x1c10b6[0x0];var _0x45bfa6=[];var _0xbef7d0=[];_0x38e07a[_0x3848('0xbb')](function(_0x4fbcec){if(!_['isNil'](_0x4fbcec[_0x3848('0xbc')])){var _0x20c3de=_0x4fbcec[_0x3848('0xbc')][_0x3848('0xaa')](_0x4fbcec[_0x3848('0xbc')]['lastIndexOf']('.')+0x1);if(_0x20c3de===_0x3848('0xbf')){_0x45bfa6[_0x3848('0xbd')](getBooleanList(_0x5164a6,_0x5c7d9c,_0xbef7d0,_0x1bdb26[_0x3848('0xb6')],_0x4fbcec[_0x3848('0xb6')],_0x2cccc9));}}});return Promise[_0x3848('0xbe')](_0x45bfa6);})[_0x3848('0x21')](function(_0x12603d){_0x535937=_0x12603d[0x0];var _0x4a6e4b=[];var _0x1618ab=[];_0x38e07a[_0x3848('0xbb')](function(_0xe059d0){if(_0xe059d0[_0x3848('0xbc')]){var _0x101b3b=_0xe059d0[_0x3848('0xbc')]['substring'](_0xe059d0['@odata.type'][_0x3848('0xab')]('.')+0x1);if(_0x101b3b==='StringAttributeMetadata'||_0x101b3b==='DoubleAttributeMetadata'||_0x101b3b===_0x3848('0xc0')||_0x101b3b===_0x3848('0xc1')||_0x101b3b==='MemoAttributeMetadata'||_0x101b3b===_0x3848('0xc2')||_0x101b3b===_0x3848('0xc3')||_0x101b3b==='EntityNameAttributeMetadata'||_0x101b3b===_0x3848('0xc4')||_0x101b3b==='DecimalAttributeMetadata'){_0x4a6e4b[_0x3848('0xbd')](getInputList(_0x5164a6,_0x5c7d9c,_0x101b3b,_0x1618ab,_0x1bdb26[_0x3848('0xb6')],_0xe059d0['MetadataId'],_0x2cccc9));}}});return Promise[_0x3848('0xbe')](_0x4a6e4b);})[_0x3848('0x21')](function(_0x4a8284){_0x36ead7=_0x4a8284[0x0];var _0xcd41ba=_0x921c7[_0x3848('0xc5')](_0x535937)[_0x3848('0xc5')](_0x36ead7);var _0x34d5b4={'count':_0xcd41ba[_0x3848('0x43')],'rows':_0xcd41ba};return _0x34d5b4;})[_0x3848('0x21')](respondWithResult(_0x1659e4,null))[_0x3848('0x2b')](function(_0x182901){var _0x248c40=_0x5cc495[_0x3848('0x3d')][_0x3848('0x1d')]?0x1f4:_0x182901['statusCode']||0x1f4;logger[_0x3848('0x26')](_0x182901[_0x3848('0x37')]);delete _0x182901[_0x3848('0x38')];if(_0x248c40===0x191){_0x248c40=0x190;}_0x1659e4[_0x3848('0x2d')](_0x248c40)[_0x3848('0xc6')](_0x5cc495[_0x3848('0x3d')][_0x3848('0x1d')]?{'message':_0x3848('0xc7'),'statusCode':_0x182901[_0x3848('0xc8')]}:_0x182901);});};function getSelectList(_0x1d8c46,_0x369e09,_0x2ce5b5,_0x40e275,_0x25b830,_0x49e563){var _0xa31cad={'method':'GET','uri':_0x1d8c46+_0x3848('0xb7')+_0x40e275+_0x3848('0xc9')+_0x25b830+_0x3848('0xca')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x3848('0xb3')+_0x49e563,'If-None-Match':null,'OData-Version':_0x3848('0xb4')},'json':!![]};return rp(_0xa31cad)[_0x3848('0x21')](function(_0x355131){var _0x114ef3=[];var _0x1f2ff9=_0x355131['OptionSet'][_0x3848('0xcb')];_0x1f2ff9['forEach'](function(_0x1f462b){_0x114ef3[_0x3848('0xbd')]({'name':_0x1f462b[_0x3848('0xcc')]['UserLocalizedLabel'][_0x3848('0xcc')],'value':String(_0x1f462b[_0x3848('0xcd')])});});var _0x192ee2={'id':_0x369e09+'_'+_0x355131[_0x3848('0xba')],'name':_0x355131[_0x3848('0xce')][_0x3848('0xcf')]['Label'],'custom':![],'options':_0x114ef3};_0x2ce5b5[_0x3848('0xbd')](_0x192ee2);return _0x2ce5b5;});}function getBooleanList(_0x265977,_0xa82dcc,_0x11dc57,_0x2428ab,_0x194578,_0x3a5b5a){var _0x208244={'method':_0x3848('0xb1'),'uri':_0x265977+'EntityDefinitions('+_0x2428ab+')/Attributes('+_0x194578+_0x3848('0xd0'),'headers':{'Authorization':_0x3848('0xb3')+_0x3a5b5a,'If-None-Match':null,'OData-Version':_0x3848('0xb4')},'json':!![]};return rp(_0x208244)[_0x3848('0x21')](function(_0x51e4c3){var _0x1109e6=[];_0x1109e6[_0x3848('0xbd')]({'name':_0x51e4c3[_0x3848('0xd1')]['TrueOption'][_0x3848('0xcc')]['UserLocalizedLabel'][_0x3848('0xcc')],'value':_0x3848('0xd2')},{'name':_0x51e4c3[_0x3848('0xd1')][_0x3848('0xd3')]['Label'][_0x3848('0xcf')][_0x3848('0xcc')],'value':'false'});var _0x5603f5={'id':_0xa82dcc+'_'+_0x51e4c3[_0x3848('0xba')],'name':_0x51e4c3[_0x3848('0xce')][_0x3848('0xcf')][_0x3848('0xcc')],'custom':![],'options':_0x1109e6};_0x11dc57[_0x3848('0xbd')](_0x5603f5);return _0x11dc57;});}function getInputList(_0x3c154a,_0x2bc715,_0x572b9b,_0x4f91f5,_0xa1effd,_0x4849d3,_0x22d086){var _0x4d0d40={'method':_0x3848('0xb1'),'uri':_0x3c154a+_0x3848('0xb7')+_0xa1effd+')/Attributes('+_0x4849d3+_0x3848('0xd4')+_0x572b9b+_0x3848('0xd5'),'headers':{'Authorization':_0x3848('0xb3')+_0x22d086,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4d0d40)[_0x3848('0x21')](function(_0x5979e2){var _0xa15fc3={'id':_0x2bc715+'_'+_0x5979e2[_0x3848('0xba')],'name':_0x5979e2[_0x3848('0xce')][_0x3848('0xcf')]?_0x5979e2[_0x3848('0xce')][_0x3848('0xcf')][_0x3848('0xcc')]:_0x5979e2[_0x3848('0xba')],'custom':![],'options':[]};_0x4f91f5[_0x3848('0xbd')](_0xa15fc3);return _0x4f91f5;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b7bed01..f7c225b 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 _0xd786=['request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd786,0x1dc));var _0x6d78=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xd786[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var logger=require(_0x6d78('0x2'))(_0x6d78('0x3'));var moment=require('moment');var BPromise=require(_0x6d78('0x4'));var rp=require(_0x6d78('0x5'));var fs=require('fs');var path=require(_0x6d78('0x6'));var rimraf=require(_0x6d78('0x7'));var config=require(_0x6d78('0x8'));var attributes=require(_0x6d78('0x9'));var integrations=require(_0x6d78('0xa'));module['exports']=function(_0x18c038,_0x30e9e5){return _0x18c038['define'](_0x6d78('0xb'),attributes,{'tableName':_0x6d78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bb9=['exports','define','int_dynamics365_accounts','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x3e245e,_0x58d397){var _0x1980b1=function(_0x50ff63){while(--_0x50ff63){_0x3e245e['push'](_0x3e245e['shift']());}};_0x1980b1(++_0x58d397);}(_0x0bb9,0xd4));var _0x90bb=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x0bb9[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x90bb('0x0'));var util=require('util');var logger=require(_0x90bb('0x1'))(_0x90bb('0x2'));var moment=require('moment');var BPromise=require(_0x90bb('0x3'));var rp=require(_0x90bb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x90bb('0x5'));var attributes=require(_0x90bb('0x6'));var integrations=require(_0x90bb('0x7'));module[_0x90bb('0x8')]=function(_0x12ceaa,_0x3b54fd){return _0x12ceaa[_0x90bb('0x9')]('Dynamics365Account',attributes,{'tableName':_0x90bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index bb13120..59b562c 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 _0x0e4b=['rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','model','attributes','map','find','ShowDynamics365Account','lodash','util','moment','randomstring'];(function(_0x1b28aa,_0x51bb80){var _0x249bde=function(_0x4649e4){while(--_0x4649e4){_0x1b28aa['push'](_0x1b28aa['shift']());}};_0x249bde(++_0x51bb80);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x1c6c41,_0x2022a3){_0x1c6c41=_0x1c6c41-0x0;var _0x273a14=_0x0e4b[_0x1c6c41];return _0x273a14;};'use strict';var _=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var moment=require(_0xb0e4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb0e4('0x4'));var config=require(_0xb0e4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0e4('0x6')][_0xb0e4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x78e4ed,_0x3dff2f,_0x35aa64){return new BPromise(function(_0x57f45d,_0x5192f0){return client[_0xb0e4('0x8')](_0x78e4ed,_0x35aa64)[_0xb0e4('0x9')](function(_0x1d6452){logger[_0xb0e4('0xa')](_0xb0e4('0xb'),_0x3dff2f,_0xb0e4('0xc'));logger[_0xb0e4('0xd')](_0xb0e4('0xe'),_0x3dff2f,_0xb0e4('0xc'),JSON[_0xb0e4('0xf')](_0x1d6452));if(_0x1d6452[_0xb0e4('0x10')]){if(_0x1d6452[_0xb0e4('0x10')][_0xb0e4('0x11')]===0x1f4){logger[_0xb0e4('0x10')](_0xb0e4('0xb'),_0x3dff2f,_0x1d6452['error'][_0xb0e4('0x12')]);return _0x5192f0(_0x1d6452[_0xb0e4('0x10')]['message']);}logger[_0xb0e4('0x10')](_0xb0e4('0xb'),_0x3dff2f,_0x1d6452[_0xb0e4('0x10')][_0xb0e4('0x12')]);return _0x57f45d(_0x1d6452[_0xb0e4('0x10')]['message']);}else{logger['info'](_0xb0e4('0xb'),_0x3dff2f,_0xb0e4('0xc'));_0x57f45d(_0x1d6452['result'][_0xb0e4('0x12')]);}})[_0xb0e4('0x13')](function(_0xc12df2){logger[_0xb0e4('0x10')](_0xb0e4('0xb'),_0x3dff2f,_0xc12df2);_0x5192f0(_0xc12df2);});});}exports[_0xb0e4('0x14')]=function(_0x570886){var _0x491a29=this;return new Promise(function(_0x4ba49e,_0x42e43d){return db[_0xb0e4('0x15')][_0xb0e4('0x16')]({'raw':_0x570886[_0xb0e4('0x17')]?_0x570886[_0xb0e4('0x17')][_0xb0e4('0x18')]===undefined?!![]:![]:!![],'where':_0x570886['options']?_0x570886[_0xb0e4('0x17')][_0xb0e4('0x19')]||null:null,'attributes':_0x570886[_0xb0e4('0x17')]?_0x570886[_0xb0e4('0x17')]['attributes']||null:null,'limit':_0x570886[_0xb0e4('0x17')]?_0x570886[_0xb0e4('0x17')]['limit']||null:null,'include':_0x570886[_0xb0e4('0x17')]?_0x570886[_0xb0e4('0x17')][_0xb0e4('0x1a')]?_['map'](_0x570886[_0xb0e4('0x17')]['include'],function(_0x4bc636){return{'model':db[_0x4bc636[_0xb0e4('0x1b')]],'as':_0x4bc636['as'],'attributes':_0x4bc636[_0xb0e4('0x1c')],'include':_0x4bc636[_0xb0e4('0x1a')]?_[_0xb0e4('0x1d')](_0x4bc636[_0xb0e4('0x1a')],function(_0x248aa5){return{'model':db[_0x248aa5[_0xb0e4('0x1b')]],'as':_0x248aa5['as'],'attributes':_0x248aa5['attributes'],'include':_0x248aa5[_0xb0e4('0x1a')]?_['map'](_0x248aa5[_0xb0e4('0x1a')],function(_0x22033f){return{'model':db[_0x22033f[_0xb0e4('0x1b')]],'as':_0x22033f['as'],'attributes':_0x22033f[_0xb0e4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ed356){logger[_0xb0e4('0xa')](_0xb0e4('0x14'),_0x570886);logger[_0xb0e4('0xd')](_0xb0e4('0x14'),_0x570886,JSON[_0xb0e4('0xf')](_0x1ed356));_0x4ba49e(_0x1ed356);})[_0xb0e4('0x13')](function(_0x31a339){logger['error'](_0xb0e4('0x14'),_0x31a339['message'],_0x570886);_0x42e43d(_0x491a29[_0xb0e4('0x10')](0x1f4,_0x31a339[_0xb0e4('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x2c97aa){var _0xaa76d9=this;return new Promise(function(_0xbccf4b,_0x2694ea){return db[_0xb0e4('0x15')][_0xb0e4('0x1e')]({'raw':_0x2c97aa['options']?_0x2c97aa[_0xb0e4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2c97aa['options']?_0x2c97aa[_0xb0e4('0x17')]['where']||null:null,'attributes':_0x2c97aa[_0xb0e4('0x17')]?_0x2c97aa['options'][_0xb0e4('0x1c')]||null:null,'include':_0x2c97aa['options']?_0x2c97aa[_0xb0e4('0x17')][_0xb0e4('0x1a')]?_[_0xb0e4('0x1d')](_0x2c97aa['options'][_0xb0e4('0x1a')],function(_0x5eaeef){return{'model':db[_0x5eaeef[_0xb0e4('0x1b')]],'as':_0x5eaeef['as'],'attributes':_0x5eaeef[_0xb0e4('0x1c')],'include':_0x5eaeef[_0xb0e4('0x1a')]?_[_0xb0e4('0x1d')](_0x5eaeef[_0xb0e4('0x1a')],function(_0x59870f){return{'model':db[_0x59870f[_0xb0e4('0x1b')]],'as':_0x59870f['as'],'attributes':_0x59870f['attributes'],'include':_0x59870f[_0xb0e4('0x1a')]?_[_0xb0e4('0x1d')](_0x59870f[_0xb0e4('0x1a')],function(_0x5451f2){return{'model':db[_0x5451f2[_0xb0e4('0x1b')]],'as':_0x5451f2['as'],'attributes':_0x5451f2[_0xb0e4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb0e4('0x9')](function(_0x739afb){logger['info']('ShowDynamics365Account',_0x2c97aa);logger['debug']('ShowDynamics365Account',_0x2c97aa,JSON[_0xb0e4('0xf')](_0x739afb));_0xbccf4b(_0x739afb);})['catch'](function(_0x3beb07){logger['error'](_0xb0e4('0x1f'),_0x3beb07['message'],_0x2c97aa);_0x2694ea(_0xaa76d9[_0xb0e4('0x10')](0x1f4,_0x3beb07[_0xb0e4('0x12')]));});});}; \ No newline at end of file +var _0xdfa0=['raw','attributes','include','map','model','debug','ShowDynamics365Account','Dynamics365Account','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','findAll','options'];(function(_0x2fdb6e,_0x49380f){var _0xcf785f=function(_0x56d638){while(--_0x56d638){_0x2fdb6e['push'](_0x2fdb6e['shift']());}};_0xcf785f(++_0x49380f);}(_0xdfa0,0x69));var _0x0dfa=function(_0x5c33ea,_0x363a69){_0x5c33ea=_0x5c33ea-0x0;var _0xeabec8=_0xdfa0[_0x5c33ea];return _0xeabec8;};'use strict';var _=require(_0x0dfa('0x0'));var util=require('util');var moment=require(_0x0dfa('0x1'));var BPromise=require(_0x0dfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dfa('0x3'));var db=require(_0x0dfa('0x4'))['db'];var utils=require(_0x0dfa('0x5'));var logger=require('../../config/logger')(_0x0dfa('0x6'));var config=require('../../config/environment');var jayson=require(_0x0dfa('0x7'));var client=jayson[_0x0dfa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417f7a,_0x29ca78,_0x32280b){return new BPromise(function(_0x16070c,_0x3b6881){return client['request'](_0x417f7a,_0x32280b)[_0x0dfa('0x9')](function(_0x2f813e){logger[_0x0dfa('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x29ca78,_0x0dfa('0xb'));logger['debug'](_0x0dfa('0xc'),_0x29ca78,_0x0dfa('0xb'),JSON[_0x0dfa('0xd')](_0x2f813e));if(_0x2f813e['error']){if(_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0xf')]===0x1f4){logger['error'](_0x0dfa('0x10'),_0x29ca78,_0x2f813e[_0x0dfa('0xe')]['message']);return _0x3b6881(_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0x11')]);}logger[_0x0dfa('0xe')](_0x0dfa('0x10'),_0x29ca78,_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0x11')]);return _0x16070c(_0x2f813e['error'][_0x0dfa('0x11')]);}else{logger[_0x0dfa('0xa')](_0x0dfa('0x10'),_0x29ca78,_0x0dfa('0xb'));_0x16070c(_0x2f813e[_0x0dfa('0x12')][_0x0dfa('0x11')]);}})[_0x0dfa('0x13')](function(_0x3c79f0){logger[_0x0dfa('0xe')](_0x0dfa('0x10'),_0x29ca78,_0x3c79f0);_0x3b6881(_0x3c79f0);});});}exports[_0x0dfa('0x14')]=function(_0x1d3576){var _0x166107=this;return new Promise(function(_0x208c0b,_0x24e3ee){return db['Dynamics365Account'][_0x0dfa('0x15')]({'raw':_0x1d3576[_0x0dfa('0x16')]?_0x1d3576[_0x0dfa('0x16')][_0x0dfa('0x17')]===undefined?!![]:![]:!![],'where':_0x1d3576[_0x0dfa('0x16')]?_0x1d3576['options']['where']||null:null,'attributes':_0x1d3576[_0x0dfa('0x16')]?_0x1d3576[_0x0dfa('0x16')][_0x0dfa('0x18')]||null:null,'limit':_0x1d3576['options']?_0x1d3576[_0x0dfa('0x16')]['limit']||null:null,'include':_0x1d3576[_0x0dfa('0x16')]?_0x1d3576['options'][_0x0dfa('0x19')]?_[_0x0dfa('0x1a')](_0x1d3576[_0x0dfa('0x16')]['include'],function(_0x2e1566){return{'model':db[_0x2e1566[_0x0dfa('0x1b')]],'as':_0x2e1566['as'],'attributes':_0x2e1566[_0x0dfa('0x18')],'include':_0x2e1566[_0x0dfa('0x19')]?_[_0x0dfa('0x1a')](_0x2e1566[_0x0dfa('0x19')],function(_0x13005a){return{'model':db[_0x13005a[_0x0dfa('0x1b')]],'as':_0x13005a['as'],'attributes':_0x13005a[_0x0dfa('0x18')],'include':_0x13005a[_0x0dfa('0x19')]?_['map'](_0x13005a['include'],function(_0x4084c6){return{'model':db[_0x4084c6[_0x0dfa('0x1b')]],'as':_0x4084c6['as'],'attributes':_0x4084c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x0dfa('0x9')](function(_0x3be821){logger[_0x0dfa('0xa')]('GetDynamics365Account',_0x1d3576);logger[_0x0dfa('0x1c')](_0x0dfa('0x14'),_0x1d3576,JSON[_0x0dfa('0xd')](_0x3be821));_0x208c0b(_0x3be821);})[_0x0dfa('0x13')](function(_0x194790){logger[_0x0dfa('0xe')]('GetDynamics365Account',_0x194790[_0x0dfa('0x11')],_0x1d3576);_0x24e3ee(_0x166107[_0x0dfa('0xe')](0x1f4,_0x194790['message']));});});};exports[_0x0dfa('0x1d')]=function(_0x37e050){var _0x239230=this;return new Promise(function(_0xd03108,_0x5a8375){return db[_0x0dfa('0x1e')][_0x0dfa('0x1f')]({'raw':_0x37e050[_0x0dfa('0x16')]?_0x37e050['options']['raw']===undefined?!![]:![]:!![],'where':_0x37e050[_0x0dfa('0x16')]?_0x37e050[_0x0dfa('0x16')]['where']||null:null,'attributes':_0x37e050['options']?_0x37e050['options'][_0x0dfa('0x18')]||null:null,'include':_0x37e050[_0x0dfa('0x16')]?_0x37e050[_0x0dfa('0x16')][_0x0dfa('0x19')]?_['map'](_0x37e050[_0x0dfa('0x16')][_0x0dfa('0x19')],function(_0x6709a0){return{'model':db[_0x6709a0[_0x0dfa('0x1b')]],'as':_0x6709a0['as'],'attributes':_0x6709a0[_0x0dfa('0x18')],'include':_0x6709a0[_0x0dfa('0x19')]?_[_0x0dfa('0x1a')](_0x6709a0[_0x0dfa('0x19')],function(_0x10b105){return{'model':db[_0x10b105[_0x0dfa('0x1b')]],'as':_0x10b105['as'],'attributes':_0x10b105['attributes'],'include':_0x10b105['include']?_[_0x0dfa('0x1a')](_0x10b105[_0x0dfa('0x19')],function(_0xdb2edf){return{'model':db[_0xdb2edf[_0x0dfa('0x1b')]],'as':_0xdb2edf['as'],'attributes':_0xdb2edf[_0x0dfa('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cbc89){logger['info'](_0x0dfa('0x1d'),_0x37e050);logger[_0x0dfa('0x1c')](_0x0dfa('0x1d'),_0x37e050,JSON['stringify'](_0x2cbc89));_0xd03108(_0x2cbc89);})['catch'](function(_0x243dd0){logger[_0x0dfa('0xe')](_0x0dfa('0x1d'),_0x243dd0['message'],_0x37e050);_0x5a8375(_0x239230[_0x0dfa('0xe')](0x1f4,_0x243dd0['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index f9c0f15..5db4daa 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 _0x7c35=['show','/:id/fields','getSubjects','/:id/descriptions','post','put','delete','destroy','multer','path','connect-timeout','express','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c35,0x13a));var _0x57c3=function(_0xbb7f25,_0x2dece2){_0xbb7f25=_0xbb7f25-0x0;var _0x25f9e8=_0x7c35[_0xbb7f25];return _0x25f9e8;};'use strict';var multer=require(_0x57c3('0x0'));var util=require('util');var path=require(_0x57c3('0x1'));var timeout=require(_0x57c3('0x2'));var express=require(_0x57c3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57c3('0x4'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x57c3('0x5')]);router[_0x57c3('0x6')](_0x57c3('0x7'),auth[_0x57c3('0x8')](),controller[_0x57c3('0x9')]);router[_0x57c3('0x6')](_0x57c3('0xa'),auth[_0x57c3('0x8')](),controller['getFields']);router[_0x57c3('0x6')]('/:id/subjects',auth[_0x57c3('0x8')](),controller[_0x57c3('0xb')]);router['get'](_0x57c3('0xc'),auth[_0x57c3('0x8')](),controller['getDescriptions']);router[_0x57c3('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x57c3('0xe')](_0x57c3('0x7'),auth[_0x57c3('0x8')](),controller['update']);router[_0x57c3('0xf')](_0x57c3('0x7'),auth[_0x57c3('0x8')](),controller[_0x57c3('0x10')]);module['exports']=router; \ No newline at end of file +var _0x17f1=['/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x320362,_0x19438e){var _0x40ef57=function(_0x52f3f9){while(--_0x52f3f9){_0x320362['push'](_0x320362['shift']());}};_0x40ef57(++_0x19438e);}(_0x17f1,0x7b));var _0x117f=function(_0x5bda89,_0x283da4){_0x5bda89=_0x5bda89-0x0;var _0x43f2a1=_0x17f1[_0x5bda89];return _0x43f2a1;};'use strict';var multer=require(_0x117f('0x0'));var util=require('util');var path=require(_0x117f('0x1'));var timeout=require(_0x117f('0x2'));var express=require(_0x117f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x117f('0x4'));var config=require(_0x117f('0x5'));var controller=require(_0x117f('0x6'));router[_0x117f('0x7')]('/',auth[_0x117f('0x8')](),controller['index']);router[_0x117f('0x7')](_0x117f('0x9'),auth['isAuthenticated'](),controller[_0x117f('0xa')]);router[_0x117f('0x7')](_0x117f('0xb'),auth[_0x117f('0x8')](),controller['getFields']);router[_0x117f('0x7')](_0x117f('0xc'),auth[_0x117f('0x8')](),controller[_0x117f('0xd')]);router[_0x117f('0x7')](_0x117f('0xe'),auth['isAuthenticated'](),controller[_0x117f('0xf')]);router[_0x117f('0x10')]('/',auth[_0x117f('0x8')](),controller[_0x117f('0x11')]);router[_0x117f('0x12')](_0x117f('0x9'),auth[_0x117f('0x8')](),controller[_0x117f('0x13')]);router['delete'](_0x117f('0x9'),auth[_0x117f('0x8')](),controller[_0x117f('0x14')]);module[_0x117f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 965986e..4213194 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 _0x9c3a=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x9c3a,0x128));var _0xa9c3=function(_0x49f012,_0x3c3bf6){_0x49f012=_0x49f012-0x0;var _0x28ae97=_0x9c3a[_0x49f012];return _0x28ae97;};'use strict';var Sequelize=require(_0xa9c3('0x0'));module[_0xa9c3('0x1')]={'name':{'type':Sequelize[_0xa9c3('0x2')]},'description':{'type':Sequelize[_0xa9c3('0x2')]},'ticketType':{'type':Sequelize[_0xa9c3('0x3')](_0xa9c3('0x4'),_0xa9c3('0x5')),'defaultValue':_0xa9c3('0x4')}}; \ No newline at end of file +var _0x20da=['ENUM','incident','phonecall','STRING'];(function(_0x38f5f8,_0xefe164){var _0x34e820=function(_0x3a2407){while(--_0x3a2407){_0x38f5f8['push'](_0x38f5f8['shift']());}};_0x34e820(++_0xefe164);}(_0x20da,0x177));var _0xa20d=function(_0x251830,_0x493b1a){_0x251830=_0x251830-0x0;var _0x5b370e=_0x20da[_0x251830];return _0x5b370e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa20d('0x0')]},'ticketType':{'type':Sequelize[_0xa20d('0x1')](_0xa20d('0x2'),_0xa20d('0x3')),'defaultValue':_0xa20d('0x2')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 45bd491..faa36a7 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 _0x9f5c=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','show','params','find','create','body','getFields','findOne','getSubjects','pick','getDescriptions','Dynamics365Field'];(function(_0xea2dc6,_0x4910c7){var _0x5e7a1e=function(_0x41e612){while(--_0x41e612){_0xea2dc6['push'](_0xea2dc6['shift']());}};_0x5e7a1e(++_0x4910c7);}(_0x9f5c,0x174));var _0xc9f5=function(_0x3c3c9d,_0x49cacc){_0x3c3c9d=_0x3c3c9d-0x0;var _0x3cf365=_0x9f5c[_0x3c3c9d];return _0x3cf365;};'use strict';var pdf=require(_0xc9f5('0x0'));var emlformat=require(_0xc9f5('0x1'));var rimraf=require(_0xc9f5('0x2'));var zipdir=require(_0xc9f5('0x3'));var jsonpatch=require(_0xc9f5('0x4'));var rp=require(_0xc9f5('0x5'));var moment=require(_0xc9f5('0x6'));var BPromise=require(_0xc9f5('0x7'));var Mustache=require(_0xc9f5('0x8'));var util=require(_0xc9f5('0x9'));var path=require(_0xc9f5('0xa'));var sox=require('sox');var csv=require(_0xc9f5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc9f5('0xc'));var deskjs=require(_0xc9f5('0xd'));var toCsv=require(_0xc9f5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc9f5('0xe'));var authService=require(_0xc9f5('0xf'));var qs=require(_0xc9f5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9f5('0x11'))(_0xc9f5('0x12'));var utils=require(_0xc9f5('0x13'));var config=require(_0xc9f5('0x14'));var db=require(_0xc9f5('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc9f5('0x16')][_0xc9f5('0x17')]({'port':0x232a});function checkPasswordPattern(_0x403853,_0x178332,_0x45b689){if(_0x45b689){var _0xd52526=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd52526[_0xc9f5('0x18')](_0x178332)){return _0x403853;}else{throw new db[(_0xc9f5('0x19'))][(_0xc9f5('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 _0x403853;}}function respondWithRpcPromise(_0x1a5194,_0x5cbb23,_0x16a04c,_0x2c8742){return new BPromise(function(_0x36d90c,_0x172dcc){var _0x362074=_0x2c8742||client;return _0x362074[_0xc9f5('0x1b')](_0x1a5194,_0x16a04c)[_0xc9f5('0x1c')](function(_0x109ae2){logger[_0xc9f5('0x1d')](_0xc9f5('0x1e'),_0x5cbb23,_0xc9f5('0x1f'));logger[_0xc9f5('0x20')](_0xc9f5('0x21'),_0x5cbb23,_0xc9f5('0x1f'),JSON[_0xc9f5('0x22')](_0x109ae2));if(_0x109ae2[_0xc9f5('0x23')]){if(_0x109ae2[_0xc9f5('0x23')][_0xc9f5('0x24')]===0x1f4){logger[_0xc9f5('0x23')](_0xc9f5('0x1e'),_0x5cbb23,_0x109ae2[_0xc9f5('0x23')][_0xc9f5('0x25')]);return _0x172dcc(_0x109ae2['error'][_0xc9f5('0x25')]);}logger['error'](_0xc9f5('0x1e'),_0x5cbb23,_0x109ae2[_0xc9f5('0x23')][_0xc9f5('0x25')]);return _0x36d90c(_0x109ae2['error']['message']);}else{logger[_0xc9f5('0x1d')](_0xc9f5('0x1e'),_0x5cbb23,'request\x20sent');_0x36d90c(_0x109ae2[_0xc9f5('0x26')]['message']);}})[_0xc9f5('0x27')](function(_0x22cd7d){logger[_0xc9f5('0x23')](_0xc9f5('0x1e'),_0x5cbb23,_0x22cd7d);_0x172dcc(_0x22cd7d);});});}function respondWithStatusCode(_0xd84c19,_0x289bf7){_0x289bf7=_0x289bf7||0xcc;return function(_0x2c37cd){if(_0x2c37cd){return _0xd84c19['sendStatus'](_0x289bf7);}return _0xd84c19[_0xc9f5('0x28')](_0x289bf7)[_0xc9f5('0x29')]();};}function respondWithResult(_0x4fb924,_0xbf918d){_0xbf918d=_0xbf918d||0xc8;return function(_0x5040fa){if(_0x5040fa){return _0x4fb924[_0xc9f5('0x28')](_0xbf918d)[_0xc9f5('0x2a')](_0x5040fa);}};}function respondWithFilteredResult(_0x2bc377,_0x93709a){return function(_0x2d154e){if(_0x2d154e){var _0x5e16fa=_0x2d154e[_0xc9f5('0x2b')],_0xa8a469=_0x93709a[_0xc9f5('0x2c')],_0x241524=_0x93709a[_0xc9f5('0x2c')]+_0x93709a[_0xc9f5('0x2d')],_0x53293e;if(_0x241524>=_0x5e16fa){_0x241524=_0x5e16fa;_0x53293e=0xc8;}else{_0x53293e=0xce;}_0x2bc377[_0xc9f5('0x28')](_0x53293e);return _0x2bc377[_0xc9f5('0x2e')](_0xc9f5('0x2f'),_0xa8a469+'-'+_0x241524+'/'+_0x5e16fa)['json'](_0x2d154e);}return null;};}function patchUpdates(_0x295d1f){return function(_0x3068c3){try{jsonpatch[_0xc9f5('0x30')](_0x3068c3,_0x295d1f,!![]);}catch(_0x3c6a57){return BPromise[_0xc9f5('0x31')](_0x3c6a57);}return _0x3068c3[_0xc9f5('0x32')]();};}function saveUpdates(_0x424d3f,_0x343fe9){return function(_0xec8026){if(_0xec8026){return _0xec8026[_0xc9f5('0x33')](_0x424d3f)[_0xc9f5('0x1c')](function(_0x50bada){return _0x50bada;});}return null;};}function removeEntity(_0x1c931d,_0x1ae595){return function(_0x174169){if(_0x174169){return _0x174169[_0xc9f5('0x34')]()[_0xc9f5('0x1c')](function(){_0x1c931d['status'](0xcc)[_0xc9f5('0x29')]();});}};}function handleEntityNotFound(_0x5cdf59,_0x795cfe){return function(_0x5a1491){if(!_0x5a1491){_0x5cdf59[_0xc9f5('0x35')](0x194);}return _0x5a1491;};}function handleError(_0x37cc96,_0x3c4fd9){_0x3c4fd9=_0x3c4fd9||0x1f4;return function(_0x375f51){logger[_0xc9f5('0x23')](_0x375f51[_0xc9f5('0x36')]);if(_0x375f51[_0xc9f5('0x37')]){delete _0x375f51[_0xc9f5('0x37')];}_0x37cc96[_0xc9f5('0x28')](_0x3c4fd9)['send'](_0x375f51);};}exports[_0xc9f5('0x38')]=function(_0x2baf72,_0x5df058){var _0x15cd69={},_0x2c6c83={},_0x3b514a={'count':0x0,'rows':[]};var _0xfa526f=_[_0xc9f5('0x39')](db[_0xc9f5('0x3a')][_0xc9f5('0x3b')],function(_0x30debc){return{'name':_0x30debc[_0xc9f5('0x3c')],'type':_0x30debc['type'][_0xc9f5('0x3d')]};});_0x2c6c83[_0xc9f5('0x3e')]=_[_0xc9f5('0x39')](_0xfa526f,_0xc9f5('0x37'));_0x2c6c83['query']=_[_0xc9f5('0x3f')](_0x2baf72[_0xc9f5('0x40')]);_0x2c6c83[_0xc9f5('0x41')]=_['intersection'](_0x2c6c83[_0xc9f5('0x3e')],_0x2c6c83[_0xc9f5('0x40')]);_0x15cd69[_0xc9f5('0x42')]=_[_0xc9f5('0x43')](_0x2c6c83[_0xc9f5('0x3e')],qs['fields'](_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x44')]));_0x15cd69[_0xc9f5('0x42')]=_0x15cd69[_0xc9f5('0x42')][_0xc9f5('0x45')]?_0x15cd69[_0xc9f5('0x42')]:_0x2c6c83['model'];if(!_0x2baf72['query'][_0xc9f5('0x46')](_0xc9f5('0x47'))){_0x15cd69['limit']=qs[_0xc9f5('0x2d')](_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x2d')]);_0x15cd69[_0xc9f5('0x2c')]=qs[_0xc9f5('0x2c')](_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x2c')]);}_0x15cd69[_0xc9f5('0x48')]=qs[_0xc9f5('0x49')](_0x2baf72[_0xc9f5('0x40')]['sort']);_0x15cd69[_0xc9f5('0x4a')]=qs['filters'](_['pick'](_0x2baf72[_0xc9f5('0x40')],_0x2c6c83[_0xc9f5('0x41')]),_0xfa526f);if(_0x2baf72['query'][_0xc9f5('0x4b')]){_0x15cd69[_0xc9f5('0x4a')]=_[_0xc9f5('0x4c')](_0x15cd69[_0xc9f5('0x4a')],{'$or':_[_0xc9f5('0x39')](_0xfa526f,function(_0x41ec0b){if(_0x41ec0b[_0xc9f5('0x4d')]!=='VIRTUAL'){var _0x16681b={};_0x16681b[_0x41ec0b[_0xc9f5('0x37')]]={'$like':'%'+_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x4b')]+'%'};return _0x16681b;}})});}_0x15cd69=_[_0xc9f5('0x4c')]({},_0x15cd69,_0x2baf72[_0xc9f5('0x4e')]);var _0x422145={'where':_0x15cd69[_0xc9f5('0x4a')]};return db[_0xc9f5('0x3a')][_0xc9f5('0x2b')](_0x422145)[_0xc9f5('0x1c')](function(_0x4b0a2d){_0x3b514a['count']=_0x4b0a2d;if(_0x2baf72[_0xc9f5('0x40')][_0xc9f5('0x4f')]){_0x15cd69[_0xc9f5('0x50')]=[{'all':!![]}];}return db[_0xc9f5('0x3a')][_0xc9f5('0x51')](_0x15cd69);})['then'](function(_0xc5cddc){_0x3b514a['rows']=_0xc5cddc;return _0x3b514a;})[_0xc9f5('0x1c')](respondWithFilteredResult(_0x5df058,_0x15cd69))[_0xc9f5('0x27')](handleError(_0x5df058,null));};exports[_0xc9f5('0x52')]=function(_0x4cf4f8,_0x1a2614){var _0x494296={'raw':![],'where':{'id':_0x4cf4f8[_0xc9f5('0x53')]['id']}},_0x2f8a4d={};_0x2f8a4d[_0xc9f5('0x3e')]=_[_0xc9f5('0x3f')](db[_0xc9f5('0x3a')][_0xc9f5('0x3b')]);_0x2f8a4d['query']=_[_0xc9f5('0x3f')](_0x4cf4f8[_0xc9f5('0x40')]);_0x2f8a4d[_0xc9f5('0x41')]=_[_0xc9f5('0x43')](_0x2f8a4d[_0xc9f5('0x3e')],_0x2f8a4d['query']);_0x494296[_0xc9f5('0x42')]=_[_0xc9f5('0x43')](_0x2f8a4d[_0xc9f5('0x3e')],qs[_0xc9f5('0x44')](_0x4cf4f8[_0xc9f5('0x40')][_0xc9f5('0x44')]));_0x494296[_0xc9f5('0x42')]=_0x494296[_0xc9f5('0x42')][_0xc9f5('0x45')]?_0x494296[_0xc9f5('0x42')]:_0x2f8a4d['model'];if(_0x4cf4f8['query']['includeAll']){_0x494296[_0xc9f5('0x50')]=[{'all':!![]}];}_0x494296=_[_0xc9f5('0x4c')]({},_0x494296,_0x4cf4f8[_0xc9f5('0x4e')]);return db[_0xc9f5('0x3a')][_0xc9f5('0x54')](_0x494296)[_0xc9f5('0x1c')](handleEntityNotFound(_0x1a2614,null))[_0xc9f5('0x1c')](respondWithResult(_0x1a2614,null))['catch'](handleError(_0x1a2614,null));};exports[_0xc9f5('0x55')]=function(_0x23a8bd,_0x24afc7){return db[_0xc9f5('0x3a')]['create'](_0x23a8bd[_0xc9f5('0x56')],{})['then'](respondWithResult(_0x24afc7,0xc9))[_0xc9f5('0x27')](handleError(_0x24afc7,null));};exports[_0xc9f5('0x33')]=function(_0x203906,_0x1922c6){if(_0x203906[_0xc9f5('0x56')]['id']){delete _0x203906[_0xc9f5('0x56')]['id'];}return db[_0xc9f5('0x3a')]['find']({'where':{'id':_0x203906[_0xc9f5('0x53')]['id']}})[_0xc9f5('0x1c')](handleEntityNotFound(_0x1922c6,null))[_0xc9f5('0x1c')](saveUpdates(_0x203906[_0xc9f5('0x56')],null))[_0xc9f5('0x1c')](respondWithResult(_0x1922c6,null))['catch'](handleError(_0x1922c6,null));};exports[_0xc9f5('0x34')]=function(_0x552fcf,_0xbadc16){return db[_0xc9f5('0x3a')][_0xc9f5('0x54')]({'where':{'id':_0x552fcf['params']['id']}})[_0xc9f5('0x1c')](handleEntityNotFound(_0xbadc16,null))[_0xc9f5('0x1c')](removeEntity(_0xbadc16,null))[_0xc9f5('0x27')](handleError(_0xbadc16,null));};exports[_0xc9f5('0x57')]=function(_0x1f6408,_0x21fe32,_0xf88ac6){var _0x44f092={};var _0x18ea20={};var _0x2442ca;var _0x2043a6;return db[_0xc9f5('0x3a')][_0xc9f5('0x58')]({'where':{'id':_0x1f6408[_0xc9f5('0x53')]['id']}})[_0xc9f5('0x1c')](handleEntityNotFound(_0x21fe32,null))[_0xc9f5('0x1c')](function(_0x4df951){if(_0x4df951){_0x2442ca=_0x4df951;_0x18ea20[_0xc9f5('0x3e')]=_[_0xc9f5('0x3f')](db['Dynamics365Field'][_0xc9f5('0x3b')]);_0x18ea20['query']=_[_0xc9f5('0x3f')](_0x1f6408[_0xc9f5('0x40')]);_0x18ea20['filters']=_[_0xc9f5('0x43')](_0x18ea20['model'],_0x18ea20[_0xc9f5('0x40')]);_0x44f092[_0xc9f5('0x42')]=_['intersection'](_0x18ea20[_0xc9f5('0x3e')],qs[_0xc9f5('0x44')](_0x1f6408[_0xc9f5('0x40')][_0xc9f5('0x44')]));_0x44f092[_0xc9f5('0x42')]=_0x44f092[_0xc9f5('0x42')]['length']?_0x44f092[_0xc9f5('0x42')]:_0x18ea20[_0xc9f5('0x3e')];_0x44f092[_0xc9f5('0x48')]=qs[_0xc9f5('0x49')](_0x1f6408[_0xc9f5('0x40')][_0xc9f5('0x49')]);_0x44f092[_0xc9f5('0x4a')]=qs[_0xc9f5('0x41')](_['pick'](_0x1f6408['query'],_0x18ea20[_0xc9f5('0x41')]));if(_0x1f6408[_0xc9f5('0x40')][_0xc9f5('0x4b')]){_0x44f092[_0xc9f5('0x4a')]=_['merge'](_0x44f092[_0xc9f5('0x4a')],{'$or':_['map'](_0x44f092[_0xc9f5('0x42')],function(_0x21e0a1){var _0x55ca8b={};_0x55ca8b[_0x21e0a1]={'$like':'%'+_0x1f6408[_0xc9f5('0x40')]['filter']+'%'};return _0x55ca8b;})});}_0x44f092=_[_0xc9f5('0x4c')]({},_0x44f092,_0x1f6408['options']);return _0x2442ca[_0xc9f5('0x57')](_0x44f092);}})[_0xc9f5('0x1c')](function(_0x513fbd){if(_0x513fbd){_0x2043a6=_0x513fbd[_0xc9f5('0x45')];if(!_0x1f6408['query'][_0xc9f5('0x46')](_0xc9f5('0x47'))){_0x44f092['limit']=qs[_0xc9f5('0x2d')](_0x1f6408['query'][_0xc9f5('0x2d')]);_0x44f092[_0xc9f5('0x2c')]=qs[_0xc9f5('0x2c')](_0x1f6408[_0xc9f5('0x40')][_0xc9f5('0x2c')]);}return _0x2442ca[_0xc9f5('0x57')](_0x44f092);}})['then'](function(_0x3bb6bf){if(_0x3bb6bf){return _0x3bb6bf?{'count':_0x2043a6,'rows':_0x3bb6bf}:null;}})[_0xc9f5('0x1c')](respondWithResult(_0x21fe32,null))[_0xc9f5('0x27')](handleError(_0x21fe32,null));};exports[_0xc9f5('0x59')]=function(_0x5253ec,_0x5dbe97,_0x7e81a){var _0x481b51={};var _0x5343c2={};var _0x2b0d03;var _0x9d792a;return db[_0xc9f5('0x3a')][_0xc9f5('0x58')]({'where':{'id':_0x5253ec['params']['id']}})['then'](handleEntityNotFound(_0x5dbe97,null))[_0xc9f5('0x1c')](function(_0x126eba){if(_0x126eba){_0x2b0d03=_0x126eba;_0x5343c2['model']=_[_0xc9f5('0x3f')](db['Dynamics365Field'][_0xc9f5('0x3b')]);_0x5343c2[_0xc9f5('0x40')]=_['keys'](_0x5253ec['query']);_0x5343c2[_0xc9f5('0x41')]=_['intersection'](_0x5343c2[_0xc9f5('0x3e')],_0x5343c2['query']);_0x481b51[_0xc9f5('0x42')]=_[_0xc9f5('0x43')](_0x5343c2[_0xc9f5('0x3e')],qs[_0xc9f5('0x44')](_0x5253ec[_0xc9f5('0x40')][_0xc9f5('0x44')]));_0x481b51[_0xc9f5('0x42')]=_0x481b51[_0xc9f5('0x42')][_0xc9f5('0x45')]?_0x481b51['attributes']:_0x5343c2[_0xc9f5('0x3e')];_0x481b51[_0xc9f5('0x48')]=qs[_0xc9f5('0x49')](_0x5253ec[_0xc9f5('0x40')][_0xc9f5('0x49')]);_0x481b51[_0xc9f5('0x4a')]=qs[_0xc9f5('0x41')](_[_0xc9f5('0x5a')](_0x5253ec['query'],_0x5343c2['filters']));if(_0x5253ec['query'][_0xc9f5('0x4b')]){_0x481b51[_0xc9f5('0x4a')]=_['merge'](_0x481b51[_0xc9f5('0x4a')],{'$or':_[_0xc9f5('0x39')](_0x481b51['attributes'],function(_0x5e9774){var _0x382523={};_0x382523[_0x5e9774]={'$like':'%'+_0x5253ec['query'][_0xc9f5('0x4b')]+'%'};return _0x382523;})});}_0x481b51=_[_0xc9f5('0x4c')]({},_0x481b51,_0x5253ec[_0xc9f5('0x4e')]);return _0x2b0d03[_0xc9f5('0x59')](_0x481b51);}})[_0xc9f5('0x1c')](function(_0x2dc441){if(_0x2dc441){_0x9d792a=_0x2dc441[_0xc9f5('0x45')];if(!_0x5253ec[_0xc9f5('0x40')]['hasOwnProperty'](_0xc9f5('0x47'))){_0x481b51[_0xc9f5('0x2d')]=qs[_0xc9f5('0x2d')](_0x5253ec[_0xc9f5('0x40')][_0xc9f5('0x2d')]);_0x481b51[_0xc9f5('0x2c')]=qs[_0xc9f5('0x2c')](_0x5253ec['query'][_0xc9f5('0x2c')]);}return _0x2b0d03[_0xc9f5('0x59')](_0x481b51);}})[_0xc9f5('0x1c')](function(_0x2165da){if(_0x2165da){return _0x2165da?{'count':_0x9d792a,'rows':_0x2165da}:null;}})['then'](respondWithResult(_0x5dbe97,null))[_0xc9f5('0x27')](handleError(_0x5dbe97,null));};exports[_0xc9f5('0x5b')]=function(_0x3bbf1d,_0x39a327,_0x11caca){var _0x5ba572={};var _0x5226cb={};var _0x2c49c8;var _0x165881;return db[_0xc9f5('0x3a')][_0xc9f5('0x58')]({'where':{'id':_0x3bbf1d['params']['id']}})[_0xc9f5('0x1c')](handleEntityNotFound(_0x39a327,null))[_0xc9f5('0x1c')](function(_0x5d920b){if(_0x5d920b){_0x2c49c8=_0x5d920b;_0x5226cb[_0xc9f5('0x3e')]=_[_0xc9f5('0x3f')](db[_0xc9f5('0x5c')]['rawAttributes']);_0x5226cb['query']=_['keys'](_0x3bbf1d['query']);_0x5226cb[_0xc9f5('0x41')]=_[_0xc9f5('0x43')](_0x5226cb[_0xc9f5('0x3e')],_0x5226cb[_0xc9f5('0x40')]);_0x5ba572[_0xc9f5('0x42')]=_[_0xc9f5('0x43')](_0x5226cb[_0xc9f5('0x3e')],qs[_0xc9f5('0x44')](_0x3bbf1d['query'][_0xc9f5('0x44')]));_0x5ba572[_0xc9f5('0x42')]=_0x5ba572['attributes']['length']?_0x5ba572[_0xc9f5('0x42')]:_0x5226cb['model'];_0x5ba572['order']=qs[_0xc9f5('0x49')](_0x3bbf1d[_0xc9f5('0x40')][_0xc9f5('0x49')]);_0x5ba572[_0xc9f5('0x4a')]=qs[_0xc9f5('0x41')](_[_0xc9f5('0x5a')](_0x3bbf1d[_0xc9f5('0x40')],_0x5226cb[_0xc9f5('0x41')]));if(_0x3bbf1d[_0xc9f5('0x40')][_0xc9f5('0x4b')]){_0x5ba572[_0xc9f5('0x4a')]=_[_0xc9f5('0x4c')](_0x5ba572[_0xc9f5('0x4a')],{'$or':_[_0xc9f5('0x39')](_0x5ba572[_0xc9f5('0x42')],function(_0x3a9ed5){var _0x427b36={};_0x427b36[_0x3a9ed5]={'$like':'%'+_0x3bbf1d['query']['filter']+'%'};return _0x427b36;})});}_0x5ba572=_[_0xc9f5('0x4c')]({},_0x5ba572,_0x3bbf1d[_0xc9f5('0x4e')]);return _0x2c49c8[_0xc9f5('0x5b')](_0x5ba572);}})[_0xc9f5('0x1c')](function(_0x53f5f2){if(_0x53f5f2){_0x165881=_0x53f5f2[_0xc9f5('0x45')];if(!_0x3bbf1d[_0xc9f5('0x40')][_0xc9f5('0x46')](_0xc9f5('0x47'))){_0x5ba572[_0xc9f5('0x2d')]=qs['limit'](_0x3bbf1d['query'][_0xc9f5('0x2d')]);_0x5ba572['offset']=qs[_0xc9f5('0x2c')](_0x3bbf1d[_0xc9f5('0x40')][_0xc9f5('0x2c')]);}return _0x2c49c8[_0xc9f5('0x5b')](_0x5ba572);}})[_0xc9f5('0x1c')](function(_0x33c4b4){if(_0x33c4b4){return _0x33c4b4?{'count':_0x165881,'rows':_0x33c4b4}:null;}})[_0xc9f5('0x1c')](respondWithResult(_0x39a327,null))[_0xc9f5('0x27')](handleError(_0x39a327,null));}; \ No newline at end of file +var _0x6d7f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','model','query','keys','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','intersection','length','find','create','body','destroy','getFields','findOne','params','Dynamics365Field','options','hasOwnProperty','getSubjects','nolimit','getDescriptions'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x6d7f,0xbc));var _0xf6d7=function(_0x25efb2,_0x331357){_0x25efb2=_0x25efb2-0x0;var _0x1bed45=_0x6d7f[_0x25efb2];return _0x1bed45;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf6d7('0x0'));var rimraf=require(_0xf6d7('0x1'));var zipdir=require(_0xf6d7('0x2'));var jsonpatch=require(_0xf6d7('0x3'));var rp=require(_0xf6d7('0x4'));var moment=require(_0xf6d7('0x5'));var BPromise=require(_0xf6d7('0x6'));var Mustache=require(_0xf6d7('0x7'));var util=require('util');var path=require(_0xf6d7('0x8'));var sox=require(_0xf6d7('0x9'));var csv=require(_0xf6d7('0xa'));var ejs=require(_0xf6d7('0xb'));var fs=require('fs');var _=require(_0xf6d7('0xc'));var squel=require(_0xf6d7('0xd'));var crypto=require(_0xf6d7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6d7('0xa'));var querystring=require(_0xf6d7('0xf'));var Papa=require(_0xf6d7('0x10'));var Redis=require(_0xf6d7('0x11'));var authService=require(_0xf6d7('0x12'));var qs=require(_0xf6d7('0x13'));var as=require(_0xf6d7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6d7('0x15'))(_0xf6d7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf6d7('0x17'))['db'];var jayson=require(_0xf6d7('0x18'));var client=jayson[_0xf6d7('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x45e069,_0x58219d,_0x3d3010){if(_0x3d3010){var _0x35e2be=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35e2be[_0xf6d7('0x1a')](_0x58219d)){return _0x45e069;}else{throw new db[(_0xf6d7('0x1b'))][(_0xf6d7('0x1c'))](_0xf6d7('0x1d'));}}else{return _0x45e069;}}function respondWithRpcPromise(_0x447ef4,_0x554dab,_0x8a1d42,_0x323d8d){return new BPromise(function(_0x4487b8,_0x1b08ef){var _0x350b3a=_0x323d8d||client;return _0x350b3a[_0xf6d7('0x1e')](_0x447ef4,_0x8a1d42)[_0xf6d7('0x1f')](function(_0xc9f887){logger['info'](_0xf6d7('0x20'),_0x554dab,_0xf6d7('0x21'));logger[_0xf6d7('0x22')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x554dab,_0xf6d7('0x21'),JSON['stringify'](_0xc9f887));if(_0xc9f887['error']){if(_0xc9f887['error'][_0xf6d7('0x23')]===0x1f4){logger[_0xf6d7('0x24')](_0xf6d7('0x20'),_0x554dab,_0xc9f887[_0xf6d7('0x24')][_0xf6d7('0x25')]);return _0x1b08ef(_0xc9f887['error'][_0xf6d7('0x25')]);}logger[_0xf6d7('0x24')](_0xf6d7('0x20'),_0x554dab,_0xc9f887[_0xf6d7('0x24')]['message']);return _0x4487b8(_0xc9f887['error'][_0xf6d7('0x25')]);}else{logger[_0xf6d7('0x26')]('Dynamics365Configuration,\x20%s,\x20%s',_0x554dab,_0xf6d7('0x21'));_0x4487b8(_0xc9f887[_0xf6d7('0x27')][_0xf6d7('0x25')]);}})[_0xf6d7('0x28')](function(_0x18bfb7){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x554dab,_0x18bfb7);_0x1b08ef(_0x18bfb7);});});}function respondWithStatusCode(_0x3b8f01,_0x134c90){_0x134c90=_0x134c90||0xcc;return function(_0x54abfc){if(_0x54abfc){return _0x3b8f01[_0xf6d7('0x29')](_0x134c90);}return _0x3b8f01[_0xf6d7('0x2a')](_0x134c90)[_0xf6d7('0x2b')]();};}function respondWithResult(_0x1898bb,_0x40e115){_0x40e115=_0x40e115||0xc8;return function(_0x181891){if(_0x181891){return _0x1898bb['status'](_0x40e115)[_0xf6d7('0x2c')](_0x181891);}};}function respondWithFilteredResult(_0x58d3d5,_0x36e806){return function(_0xaca23e){if(_0xaca23e){var _0x26f420=_0xaca23e[_0xf6d7('0x2d')],_0x17a443=_0x36e806[_0xf6d7('0x2e')],_0x25acf5=_0x36e806[_0xf6d7('0x2e')]+_0x36e806[_0xf6d7('0x2f')],_0x53f091;if(_0x25acf5>=_0x26f420){_0x25acf5=_0x26f420;_0x53f091=0xc8;}else{_0x53f091=0xce;}_0x58d3d5[_0xf6d7('0x2a')](_0x53f091);return _0x58d3d5[_0xf6d7('0x30')]('Content-Range',_0x17a443+'-'+_0x25acf5+'/'+_0x26f420)[_0xf6d7('0x2c')](_0xaca23e);}return null;};}function patchUpdates(_0x508e0b){return function(_0x2e103d){try{jsonpatch[_0xf6d7('0x31')](_0x2e103d,_0x508e0b,!![]);}catch(_0x38a667){return BPromise[_0xf6d7('0x32')](_0x38a667);}return _0x2e103d[_0xf6d7('0x33')]();};}function saveUpdates(_0x5b7342,_0x6566d4){return function(_0xeebcc4){if(_0xeebcc4){return _0xeebcc4[_0xf6d7('0x34')](_0x5b7342)['then'](function(_0x2926d2){return _0x2926d2;});}return null;};}function removeEntity(_0x33185a,_0x303ece){return function(_0x183c2b){if(_0x183c2b){return _0x183c2b['destroy']()[_0xf6d7('0x1f')](function(){_0x33185a[_0xf6d7('0x2a')](0xcc)[_0xf6d7('0x2b')]();});}};}function handleEntityNotFound(_0x2aaa76,_0x355a9a){return function(_0x2bb1e8){if(!_0x2bb1e8){_0x2aaa76[_0xf6d7('0x29')](0x194);}return _0x2bb1e8;};}function handleError(_0x97f050,_0x5f0ea6){_0x5f0ea6=_0x5f0ea6||0x1f4;return function(_0x2ab18e){logger[_0xf6d7('0x24')](_0x2ab18e[_0xf6d7('0x35')]);if(_0x2ab18e[_0xf6d7('0x36')]){delete _0x2ab18e[_0xf6d7('0x36')];}_0x97f050[_0xf6d7('0x2a')](_0x5f0ea6)[_0xf6d7('0x37')](_0x2ab18e);};}exports[_0xf6d7('0x38')]=function(_0x46c359,_0x877f7f){var _0x5907a7={},_0x4254c5={},_0x36f39a={'count':0x0,'rows':[]};var _0x4071d6=_[_0xf6d7('0x39')](db[_0xf6d7('0x3a')][_0xf6d7('0x3b')],function(_0x1777bd){return{'name':_0x1777bd['fieldName'],'type':_0x1777bd[_0xf6d7('0x3c')]['key']};});_0x4254c5[_0xf6d7('0x3d')]=_[_0xf6d7('0x39')](_0x4071d6,'name');_0x4254c5[_0xf6d7('0x3e')]=_[_0xf6d7('0x3f')](_0x46c359[_0xf6d7('0x3e')]);_0x4254c5['filters']=_['intersection'](_0x4254c5[_0xf6d7('0x3d')],_0x4254c5['query']);_0x5907a7['attributes']=_['intersection'](_0x4254c5['model'],qs[_0xf6d7('0x40')](_0x46c359[_0xf6d7('0x3e')]['fields']));_0x5907a7[_0xf6d7('0x41')]=_0x5907a7[_0xf6d7('0x41')]['length']?_0x5907a7['attributes']:_0x4254c5[_0xf6d7('0x3d')];if(!_0x46c359[_0xf6d7('0x3e')]['hasOwnProperty']('nolimit')){_0x5907a7[_0xf6d7('0x2f')]=qs[_0xf6d7('0x2f')](_0x46c359[_0xf6d7('0x3e')][_0xf6d7('0x2f')]);_0x5907a7['offset']=qs[_0xf6d7('0x2e')](_0x46c359[_0xf6d7('0x3e')]['offset']);}_0x5907a7[_0xf6d7('0x42')]=qs['sort'](_0x46c359['query'][_0xf6d7('0x43')]);_0x5907a7[_0xf6d7('0x44')]=qs[_0xf6d7('0x45')](_[_0xf6d7('0x46')](_0x46c359[_0xf6d7('0x3e')],_0x4254c5['filters']),_0x4071d6);if(_0x46c359[_0xf6d7('0x3e')][_0xf6d7('0x47')]){_0x5907a7[_0xf6d7('0x44')]=_[_0xf6d7('0x48')](_0x5907a7['where'],{'$or':_[_0xf6d7('0x39')](_0x4071d6,function(_0x1bf46b){if(_0x1bf46b[_0xf6d7('0x3c')]!==_0xf6d7('0x49')){var _0x39e24b={};_0x39e24b[_0x1bf46b[_0xf6d7('0x36')]]={'$like':'%'+_0x46c359[_0xf6d7('0x3e')][_0xf6d7('0x47')]+'%'};return _0x39e24b;}})});}_0x5907a7=_[_0xf6d7('0x48')]({},_0x5907a7,_0x46c359['options']);var _0x529dad={'where':_0x5907a7[_0xf6d7('0x44')]};return db['Dynamics365Configuration']['count'](_0x529dad)[_0xf6d7('0x1f')](function(_0x5851f9){_0x36f39a[_0xf6d7('0x2d')]=_0x5851f9;if(_0x46c359[_0xf6d7('0x3e')][_0xf6d7('0x4a')]){_0x5907a7[_0xf6d7('0x4b')]=[{'all':!![]}];}return db[_0xf6d7('0x3a')][_0xf6d7('0x4c')](_0x5907a7);})[_0xf6d7('0x1f')](function(_0x91bd16){_0x36f39a[_0xf6d7('0x4d')]=_0x91bd16;return _0x36f39a;})[_0xf6d7('0x1f')](respondWithFilteredResult(_0x877f7f,_0x5907a7))[_0xf6d7('0x28')](handleError(_0x877f7f,null));};exports[_0xf6d7('0x4e')]=function(_0x460cf3,_0x122103){var _0x4f1992={'raw':![],'where':{'id':_0x460cf3['params']['id']}},_0x5ba58b={};_0x5ba58b[_0xf6d7('0x3d')]=_[_0xf6d7('0x3f')](db[_0xf6d7('0x3a')][_0xf6d7('0x3b')]);_0x5ba58b[_0xf6d7('0x3e')]=_[_0xf6d7('0x3f')](_0x460cf3[_0xf6d7('0x3e')]);_0x5ba58b[_0xf6d7('0x45')]=_[_0xf6d7('0x4f')](_0x5ba58b[_0xf6d7('0x3d')],_0x5ba58b['query']);_0x4f1992['attributes']=_[_0xf6d7('0x4f')](_0x5ba58b[_0xf6d7('0x3d')],qs['fields'](_0x460cf3[_0xf6d7('0x3e')][_0xf6d7('0x40')]));_0x4f1992[_0xf6d7('0x41')]=_0x4f1992[_0xf6d7('0x41')][_0xf6d7('0x50')]?_0x4f1992[_0xf6d7('0x41')]:_0x5ba58b[_0xf6d7('0x3d')];if(_0x460cf3['query'][_0xf6d7('0x4a')]){_0x4f1992[_0xf6d7('0x4b')]=[{'all':!![]}];}_0x4f1992=_[_0xf6d7('0x48')]({},_0x4f1992,_0x460cf3['options']);return db[_0xf6d7('0x3a')][_0xf6d7('0x51')](_0x4f1992)['then'](handleEntityNotFound(_0x122103,null))[_0xf6d7('0x1f')](respondWithResult(_0x122103,null))[_0xf6d7('0x28')](handleError(_0x122103,null));};exports['create']=function(_0x19dcd0,_0x1a177c){return db[_0xf6d7('0x3a')][_0xf6d7('0x52')](_0x19dcd0[_0xf6d7('0x53')],{})[_0xf6d7('0x1f')](respondWithResult(_0x1a177c,0xc9))[_0xf6d7('0x28')](handleError(_0x1a177c,null));};exports[_0xf6d7('0x34')]=function(_0x2d1935,_0x52ac18){if(_0x2d1935[_0xf6d7('0x53')]['id']){delete _0x2d1935['body']['id'];}return db[_0xf6d7('0x3a')]['find']({'where':{'id':_0x2d1935['params']['id']}})[_0xf6d7('0x1f')](handleEntityNotFound(_0x52ac18,null))[_0xf6d7('0x1f')](saveUpdates(_0x2d1935[_0xf6d7('0x53')],null))[_0xf6d7('0x1f')](respondWithResult(_0x52ac18,null))[_0xf6d7('0x28')](handleError(_0x52ac18,null));};exports[_0xf6d7('0x54')]=function(_0x52d57a,_0x4c2d07){return db[_0xf6d7('0x3a')][_0xf6d7('0x51')]({'where':{'id':_0x52d57a['params']['id']}})[_0xf6d7('0x1f')](handleEntityNotFound(_0x4c2d07,null))[_0xf6d7('0x1f')](removeEntity(_0x4c2d07,null))[_0xf6d7('0x28')](handleError(_0x4c2d07,null));};exports[_0xf6d7('0x55')]=function(_0x1d5808,_0xa9dd80,_0x3bd56d){var _0x12a3f5={};var _0x4c36d2={};var _0x3fc372;var _0x1a8ac2;return db[_0xf6d7('0x3a')][_0xf6d7('0x56')]({'where':{'id':_0x1d5808[_0xf6d7('0x57')]['id']}})[_0xf6d7('0x1f')](handleEntityNotFound(_0xa9dd80,null))[_0xf6d7('0x1f')](function(_0x44a92e){if(_0x44a92e){_0x3fc372=_0x44a92e;_0x4c36d2[_0xf6d7('0x3d')]=_[_0xf6d7('0x3f')](db[_0xf6d7('0x58')][_0xf6d7('0x3b')]);_0x4c36d2['query']=_[_0xf6d7('0x3f')](_0x1d5808[_0xf6d7('0x3e')]);_0x4c36d2[_0xf6d7('0x45')]=_[_0xf6d7('0x4f')](_0x4c36d2[_0xf6d7('0x3d')],_0x4c36d2[_0xf6d7('0x3e')]);_0x12a3f5['attributes']=_['intersection'](_0x4c36d2['model'],qs[_0xf6d7('0x40')](_0x1d5808['query'][_0xf6d7('0x40')]));_0x12a3f5[_0xf6d7('0x41')]=_0x12a3f5['attributes'][_0xf6d7('0x50')]?_0x12a3f5[_0xf6d7('0x41')]:_0x4c36d2[_0xf6d7('0x3d')];_0x12a3f5[_0xf6d7('0x42')]=qs[_0xf6d7('0x43')](_0x1d5808[_0xf6d7('0x3e')][_0xf6d7('0x43')]);_0x12a3f5[_0xf6d7('0x44')]=qs[_0xf6d7('0x45')](_[_0xf6d7('0x46')](_0x1d5808[_0xf6d7('0x3e')],_0x4c36d2[_0xf6d7('0x45')]));if(_0x1d5808[_0xf6d7('0x3e')][_0xf6d7('0x47')]){_0x12a3f5[_0xf6d7('0x44')]=_['merge'](_0x12a3f5[_0xf6d7('0x44')],{'$or':_[_0xf6d7('0x39')](_0x12a3f5[_0xf6d7('0x41')],function(_0x5ef52d){var _0x5276ba={};_0x5276ba[_0x5ef52d]={'$like':'%'+_0x1d5808[_0xf6d7('0x3e')][_0xf6d7('0x47')]+'%'};return _0x5276ba;})});}_0x12a3f5=_['merge']({},_0x12a3f5,_0x1d5808[_0xf6d7('0x59')]);return _0x3fc372['getFields'](_0x12a3f5);}})[_0xf6d7('0x1f')](function(_0x5a2d37){if(_0x5a2d37){_0x1a8ac2=_0x5a2d37[_0xf6d7('0x50')];if(!_0x1d5808[_0xf6d7('0x3e')][_0xf6d7('0x5a')]('nolimit')){_0x12a3f5[_0xf6d7('0x2f')]=qs[_0xf6d7('0x2f')](_0x1d5808['query'][_0xf6d7('0x2f')]);_0x12a3f5[_0xf6d7('0x2e')]=qs['offset'](_0x1d5808['query'][_0xf6d7('0x2e')]);}return _0x3fc372['getFields'](_0x12a3f5);}})[_0xf6d7('0x1f')](function(_0x4ab9f1){if(_0x4ab9f1){return _0x4ab9f1?{'count':_0x1a8ac2,'rows':_0x4ab9f1}:null;}})[_0xf6d7('0x1f')](respondWithResult(_0xa9dd80,null))[_0xf6d7('0x28')](handleError(_0xa9dd80,null));};exports[_0xf6d7('0x5b')]=function(_0x14d69a,_0x541a9b,_0x3387e8){var _0x1fac83={};var _0x3072c5={};var _0x432cd4;var _0x591c1e;return db['Dynamics365Configuration'][_0xf6d7('0x56')]({'where':{'id':_0x14d69a['params']['id']}})[_0xf6d7('0x1f')](handleEntityNotFound(_0x541a9b,null))[_0xf6d7('0x1f')](function(_0x3ebe5f){if(_0x3ebe5f){_0x432cd4=_0x3ebe5f;_0x3072c5[_0xf6d7('0x3d')]=_[_0xf6d7('0x3f')](db[_0xf6d7('0x58')][_0xf6d7('0x3b')]);_0x3072c5[_0xf6d7('0x3e')]=_[_0xf6d7('0x3f')](_0x14d69a[_0xf6d7('0x3e')]);_0x3072c5[_0xf6d7('0x45')]=_['intersection'](_0x3072c5['model'],_0x3072c5[_0xf6d7('0x3e')]);_0x1fac83['attributes']=_[_0xf6d7('0x4f')](_0x3072c5[_0xf6d7('0x3d')],qs[_0xf6d7('0x40')](_0x14d69a[_0xf6d7('0x3e')][_0xf6d7('0x40')]));_0x1fac83[_0xf6d7('0x41')]=_0x1fac83['attributes']['length']?_0x1fac83['attributes']:_0x3072c5['model'];_0x1fac83['order']=qs[_0xf6d7('0x43')](_0x14d69a[_0xf6d7('0x3e')][_0xf6d7('0x43')]);_0x1fac83[_0xf6d7('0x44')]=qs['filters'](_[_0xf6d7('0x46')](_0x14d69a['query'],_0x3072c5[_0xf6d7('0x45')]));if(_0x14d69a[_0xf6d7('0x3e')][_0xf6d7('0x47')]){_0x1fac83[_0xf6d7('0x44')]=_[_0xf6d7('0x48')](_0x1fac83['where'],{'$or':_['map'](_0x1fac83['attributes'],function(_0xd7dcc6){var _0x12cd81={};_0x12cd81[_0xd7dcc6]={'$like':'%'+_0x14d69a[_0xf6d7('0x3e')][_0xf6d7('0x47')]+'%'};return _0x12cd81;})});}_0x1fac83=_[_0xf6d7('0x48')]({},_0x1fac83,_0x14d69a[_0xf6d7('0x59')]);return _0x432cd4[_0xf6d7('0x5b')](_0x1fac83);}})[_0xf6d7('0x1f')](function(_0x2c98b0){if(_0x2c98b0){_0x591c1e=_0x2c98b0[_0xf6d7('0x50')];if(!_0x14d69a[_0xf6d7('0x3e')]['hasOwnProperty'](_0xf6d7('0x5c'))){_0x1fac83[_0xf6d7('0x2f')]=qs[_0xf6d7('0x2f')](_0x14d69a[_0xf6d7('0x3e')][_0xf6d7('0x2f')]);_0x1fac83[_0xf6d7('0x2e')]=qs['offset'](_0x14d69a[_0xf6d7('0x3e')][_0xf6d7('0x2e')]);}return _0x432cd4[_0xf6d7('0x5b')](_0x1fac83);}})['then'](function(_0xbbe1ed){if(_0xbbe1ed){return _0xbbe1ed?{'count':_0x591c1e,'rows':_0xbbe1ed}:null;}})['then'](respondWithResult(_0x541a9b,null))['catch'](handleError(_0x541a9b,null));};exports[_0xf6d7('0x5d')]=function(_0x227373,_0x1ea895,_0x386fd1){var _0x43bfb3={};var _0x13d188={};var _0x4b32e7;var _0x7c05de;return db[_0xf6d7('0x3a')][_0xf6d7('0x56')]({'where':{'id':_0x227373[_0xf6d7('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ea895,null))[_0xf6d7('0x1f')](function(_0x28409d){if(_0x28409d){_0x4b32e7=_0x28409d;_0x13d188['model']=_['keys'](db['Dynamics365Field'][_0xf6d7('0x3b')]);_0x13d188[_0xf6d7('0x3e')]=_['keys'](_0x227373[_0xf6d7('0x3e')]);_0x13d188['filters']=_[_0xf6d7('0x4f')](_0x13d188[_0xf6d7('0x3d')],_0x13d188['query']);_0x43bfb3['attributes']=_[_0xf6d7('0x4f')](_0x13d188[_0xf6d7('0x3d')],qs[_0xf6d7('0x40')](_0x227373[_0xf6d7('0x3e')][_0xf6d7('0x40')]));_0x43bfb3[_0xf6d7('0x41')]=_0x43bfb3[_0xf6d7('0x41')]['length']?_0x43bfb3['attributes']:_0x13d188[_0xf6d7('0x3d')];_0x43bfb3['order']=qs['sort'](_0x227373[_0xf6d7('0x3e')]['sort']);_0x43bfb3[_0xf6d7('0x44')]=qs[_0xf6d7('0x45')](_[_0xf6d7('0x46')](_0x227373[_0xf6d7('0x3e')],_0x13d188[_0xf6d7('0x45')]));if(_0x227373[_0xf6d7('0x3e')][_0xf6d7('0x47')]){_0x43bfb3[_0xf6d7('0x44')]=_[_0xf6d7('0x48')](_0x43bfb3[_0xf6d7('0x44')],{'$or':_['map'](_0x43bfb3[_0xf6d7('0x41')],function(_0x4dd48f){var _0x1211c0={};_0x1211c0[_0x4dd48f]={'$like':'%'+_0x227373[_0xf6d7('0x3e')][_0xf6d7('0x47')]+'%'};return _0x1211c0;})});}_0x43bfb3=_[_0xf6d7('0x48')]({},_0x43bfb3,_0x227373[_0xf6d7('0x59')]);return _0x4b32e7[_0xf6d7('0x5d')](_0x43bfb3);}})['then'](function(_0x19855f){if(_0x19855f){_0x7c05de=_0x19855f[_0xf6d7('0x50')];if(!_0x227373[_0xf6d7('0x3e')]['hasOwnProperty'](_0xf6d7('0x5c'))){_0x43bfb3[_0xf6d7('0x2f')]=qs[_0xf6d7('0x2f')](_0x227373['query'][_0xf6d7('0x2f')]);_0x43bfb3[_0xf6d7('0x2e')]=qs['offset'](_0x227373['query']['offset']);}return _0x4b32e7[_0xf6d7('0x5d')](_0x43bfb3);}})[_0xf6d7('0x1f')](function(_0x1c9991){if(_0x1c9991){return _0x1c9991?{'count':_0x7c05de,'rows':_0x1c9991}:null;}})[_0xf6d7('0x1f')](respondWithResult(_0x1ea895,null))[_0xf6d7('0x28')](handleError(_0x1ea895,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 7723a07..f12a6fe 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 _0x5105=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','lodash'];(function(_0x1cccf4,_0x74fe9b){var _0x4094df=function(_0x691508){while(--_0x691508){_0x1cccf4['push'](_0x1cccf4['shift']());}};_0x4094df(++_0x74fe9b);}(_0x5105,0x135));var _0x5510=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5105[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5510('0x0'));var util=require('util');var logger=require(_0x5510('0x1'))(_0x5510('0x2'));var moment=require(_0x5510('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5510('0x4'));var rimraf=require(_0x5510('0x5'));var config=require(_0x5510('0x6'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x5510('0x7')]=function(_0x24e4dc,_0x341f75){return _0x24e4dc[_0x5510('0x8')](_0x5510('0x9'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c23=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7c23,0x13a));var _0x37c2=function(_0x4da557,_0x4ca613){_0x4da557=_0x4da557-0x0;var _0x4795c3=_0x7c23[_0x4da557];return _0x4795c3;};'use strict';var _=require(_0x37c2('0x0'));var util=require(_0x37c2('0x1'));var logger=require(_0x37c2('0x2'))(_0x37c2('0x3'));var moment=require(_0x37c2('0x4'));var BPromise=require(_0x37c2('0x5'));var rp=require(_0x37c2('0x6'));var fs=require('fs');var path=require(_0x37c2('0x7'));var rimraf=require(_0x37c2('0x8'));var config=require(_0x37c2('0x9'));var attributes=require(_0x37c2('0xa'));module[_0x37c2('0xb')]=function(_0x29c8dd,_0x3185e6){return _0x29c8dd[_0x37c2('0xc')](_0x37c2('0xd'),attributes,{'tableName':_0x37c2('0xe'),'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 006575c..4040da6 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 _0x6699=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','../../mysqldb'];(function(_0x3aad3b,_0x5623de){var _0x590bf5=function(_0x541eb2){while(--_0x541eb2){_0x3aad3b['push'](_0x3aad3b['shift']());}};_0x590bf5(++_0x5623de);}(_0x6699,0xf5));var _0x9669=function(_0x4c9fd3,_0x2aee60){_0x4c9fd3=_0x4c9fd3-0x0;var _0x2c3256=_0x6699[_0x4c9fd3];return _0x2c3256;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9669('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9669('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x9669('0x2'))('rpc');var config=require(_0x9669('0x3'));var jayson=require(_0x9669('0x4'));var client=jayson[_0x9669('0x5')][_0x9669('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x224c38,_0x280fc4,_0x318f0f){return new BPromise(function(_0x1c1e18,_0x17fb9e){return client[_0x9669('0x7')](_0x224c38,_0x318f0f)[_0x9669('0x8')](function(_0x2909e1){logger[_0x9669('0x9')](_0x9669('0xa'),_0x280fc4,_0x9669('0xb'));logger[_0x9669('0xc')](_0x9669('0xd'),_0x280fc4,'request\x20sent',JSON[_0x9669('0xe')](_0x2909e1));if(_0x2909e1[_0x9669('0xf')]){if(_0x2909e1['error'][_0x9669('0x10')]===0x1f4){logger[_0x9669('0xf')](_0x9669('0xa'),_0x280fc4,_0x2909e1[_0x9669('0xf')][_0x9669('0x11')]);return _0x17fb9e(_0x2909e1[_0x9669('0xf')][_0x9669('0x11')]);}logger[_0x9669('0xf')](_0x9669('0xa'),_0x280fc4,_0x2909e1[_0x9669('0xf')][_0x9669('0x11')]);return _0x1c1e18(_0x2909e1[_0x9669('0xf')][_0x9669('0x11')]);}else{logger['info'](_0x9669('0xa'),_0x280fc4,'request\x20sent');_0x1c1e18(_0x2909e1['result'][_0x9669('0x11')]);}})[_0x9669('0x12')](function(_0x2f928d){logger[_0x9669('0xf')](_0x9669('0xa'),_0x280fc4,_0x2f928d);_0x17fb9e(_0x2f928d);});});} \ No newline at end of file +var _0x2066=['http','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5c4b6a,_0x3e4163){var _0x2dec05=function(_0x17017e){while(--_0x17017e){_0x5c4b6a['push'](_0x5c4b6a['shift']());}};_0x2dec05(++_0x3e4163);}(_0x2066,0x89));var _0x6206=function(_0x3bfb7a,_0x10f0fb){_0x3bfb7a=_0x3bfb7a-0x0;var _0x5a7039=_0x2066[_0x3bfb7a];return _0x5a7039;};'use strict';var _=require(_0x6206('0x0'));var util=require('util');var moment=require(_0x6206('0x1'));var BPromise=require('bluebird');var rs=require(_0x6206('0x2'));var fs=require('fs');var Redis=require(_0x6206('0x3'));var db=require(_0x6206('0x4'))['db'];var utils=require(_0x6206('0x5'));var logger=require(_0x6206('0x6'))(_0x6206('0x7'));var config=require(_0x6206('0x8'));var jayson=require(_0x6206('0x9'));var client=jayson['client'][_0x6206('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x514e65,_0x1a1d6b,_0x13ac34){return new BPromise(function(_0x53d17e,_0x3982b3){return client['request'](_0x514e65,_0x13ac34)[_0x6206('0xb')](function(_0x1ec4d2){logger[_0x6206('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a1d6b,_0x6206('0xd'));logger[_0x6206('0xe')](_0x6206('0xf'),_0x1a1d6b,_0x6206('0xd'),JSON['stringify'](_0x1ec4d2));if(_0x1ec4d2[_0x6206('0x10')]){if(_0x1ec4d2[_0x6206('0x10')]['code']===0x1f4){logger[_0x6206('0x10')](_0x6206('0x11'),_0x1a1d6b,_0x1ec4d2[_0x6206('0x10')][_0x6206('0x12')]);return _0x3982b3(_0x1ec4d2[_0x6206('0x10')]['message']);}logger[_0x6206('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a1d6b,_0x1ec4d2[_0x6206('0x10')][_0x6206('0x12')]);return _0x53d17e(_0x1ec4d2[_0x6206('0x10')][_0x6206('0x12')]);}else{logger['info'](_0x6206('0x11'),_0x1a1d6b,_0x6206('0xd'));_0x53d17e(_0x1ec4d2[_0x6206('0x13')]['message']);}})[_0x6206('0x14')](function(_0x50b3f3){logger['error'](_0x6206('0x11'),_0x1a1d6b,_0x50b3f3);_0x3982b3(_0x50b3f3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index d005f94..8e2fdc6 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 _0x8ce3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x402f91,_0x5190dc){var _0x174d42=function(_0x4f65e2){while(--_0x4f65e2){_0x402f91['push'](_0x402f91['shift']());}};_0x174d42(++_0x5190dc);}(_0x8ce3,0xc3));var _0x38ce=function(_0xe37cad,_0x9fcbdd){_0xe37cad=_0xe37cad-0x0;var _0x24593e=_0x8ce3[_0xe37cad];return _0x24593e;};'use strict';var multer=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var path=require('path');var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var auth=require(_0x38ce('0x5'));var interaction=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var controller=require(_0x38ce('0x8'));router[_0x38ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xa')]);router[_0x38ce('0x9')]('/:id',auth[_0x38ce('0xb')](),controller[_0x38ce('0xc')]);router[_0x38ce('0xd')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xe')]);router['put'](_0x38ce('0xf'),auth['isAuthenticated'](),controller[_0x38ce('0x10')]);router[_0x38ce('0x11')](_0x38ce('0xf'),auth[_0x38ce('0xb')](),controller[_0x38ce('0x12')]);module[_0x38ce('0x13')]=router; \ No newline at end of file +var _0x68fc=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x68fc,0xa5));var _0xc68f=function(_0x1fd383,_0x4e46b7){_0x1fd383=_0x1fd383-0x0;var _0x98d969=_0x68fc[_0x1fd383];return _0x98d969;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc68f('0x4'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0xc68f('0x5')]('/',auth[_0xc68f('0x6')](),controller[_0xc68f('0x7')]);router[_0xc68f('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xc68f('0x8')]);router[_0xc68f('0x9')]('/',auth[_0xc68f('0x6')](),controller[_0xc68f('0xa')]);router[_0xc68f('0xb')](_0xc68f('0xc'),auth[_0xc68f('0x6')](),controller[_0xc68f('0xd')]);router[_0xc68f('0xe')](_0xc68f('0xc'),auth['isAuthenticated'](),controller[_0xc68f('0xf')]);module[_0xc68f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 7363f91..2272767 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 _0xe524=['customVariable','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xe524,0x1d8));var _0x4e52=function(_0x4992dd,_0x37be50){_0x4992dd=_0x4992dd-0x0;var _0xa8973a=_0xe524[_0x4992dd];return _0xa8973a;};'use strict';var Sequelize=require('sequelize');module[_0x4e52('0x0')]={'type':{'type':Sequelize[_0x4e52('0x1')](_0x4e52('0x2'),_0x4e52('0x3'),_0x4e52('0x4'),'keyValue'),'defaultValue':_0x4e52('0x2')},'content':{'type':Sequelize[_0x4e52('0x5')]},'key':{'type':Sequelize[_0x4e52('0x5')]},'keyType':{'type':Sequelize[_0x4e52('0x1')](_0x4e52('0x2'),_0x4e52('0x3'),_0x4e52('0x4'))},'keyContent':{'type':Sequelize[_0x4e52('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4e52('0x5')]},'customField':{'type':Sequelize[_0x4e52('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4e52('0x5')]}}; \ No newline at end of file +var _0x34b3=['keyValue','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x44fc33,_0x480283){var _0x1e64a1=function(_0x2b642b){while(--_0x2b642b){_0x44fc33['push'](_0x44fc33['shift']());}};_0x1e64a1(++_0x480283);}(_0x34b3,0x1b2));var _0x334b=function(_0x185069,_0x259e5a){_0x185069=_0x185069-0x0;var _0x7344ec=_0x34b3[_0x185069];return _0x7344ec;};'use strict';var Sequelize=require(_0x334b('0x0'));module[_0x334b('0x1')]={'type':{'type':Sequelize[_0x334b('0x2')](_0x334b('0x3'),_0x334b('0x4'),_0x334b('0x5'),_0x334b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x334b('0x7')]},'key':{'type':Sequelize[_0x334b('0x7')]},'keyType':{'type':Sequelize[_0x334b('0x2')](_0x334b('0x3'),_0x334b('0x4'),_0x334b('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x334b('0x7')]},'nameField':{'type':Sequelize[_0x334b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 8df5ffd..3012a29 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 _0x5dbc=['show','params','find','create','body','catch','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','json','count','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','offset','sort','pick','filter','where','merge','type','options','includeAll','include','Dynamics365Field','findAll','rows'];(function(_0x48df53,_0x281757){var _0x4e4080=function(_0x305d51){while(--_0x305d51){_0x48df53['push'](_0x48df53['shift']());}};_0x4e4080(++_0x281757);}(_0x5dbc,0x16a));var _0xc5db=function(_0x38b1cc,_0x4a73c1){_0x38b1cc=_0x38b1cc-0x0;var _0x11d1ba=_0x5dbc[_0x38b1cc];return _0x11d1ba;};'use strict';var pdf=require(_0xc5db('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc5db('0x1'));var zipdir=require(_0xc5db('0x2'));var jsonpatch=require(_0xc5db('0x3'));var rp=require(_0xc5db('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc5db('0x5'));var util=require(_0xc5db('0x6'));var path=require(_0xc5db('0x7'));var sox=require(_0xc5db('0x8'));var csv=require(_0xc5db('0x9'));var ejs=require(_0xc5db('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc5db('0xb'));var crypto=require(_0xc5db('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc5db('0x9'));var querystring=require(_0xc5db('0xd'));var Papa=require(_0xc5db('0xe'));var Redis=require(_0xc5db('0xf'));var authService=require(_0xc5db('0x10'));var qs=require(_0xc5db('0x11'));var as=require(_0xc5db('0x12'));var hardwareService=require(_0xc5db('0x13'));var logger=require(_0xc5db('0x14'))('api');var utils=require(_0xc5db('0x15'));var config=require(_0xc5db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10afeb,_0x238db6){_0x238db6=_0x238db6||0xcc;return function(_0x2a6db7){if(_0x2a6db7){return _0x10afeb['sendStatus'](_0x238db6);}return _0x10afeb[_0xc5db('0x17')](_0x238db6)['end']();};}function respondWithResult(_0xc6dfc9,_0x4c3877){_0x4c3877=_0x4c3877||0xc8;return function(_0x5c536e){if(_0x5c536e){return _0xc6dfc9[_0xc5db('0x17')](_0x4c3877)[_0xc5db('0x18')](_0x5c536e);}};}function respondWithFilteredResult(_0x5f5c32,_0x913b40){return function(_0x4810c0){if(_0x4810c0){var _0xa8b9bd=_0x4810c0[_0xc5db('0x19')],_0x4f7df0=_0x913b40['offset'],_0x10f059=_0x913b40['offset']+_0x913b40[_0xc5db('0x1a')],_0x505c88;if(_0x10f059>=_0xa8b9bd){_0x10f059=_0xa8b9bd;_0x505c88=0xc8;}else{_0x505c88=0xce;}_0x5f5c32[_0xc5db('0x17')](_0x505c88);return _0x5f5c32[_0xc5db('0x1b')](_0xc5db('0x1c'),_0x4f7df0+'-'+_0x10f059+'/'+_0xa8b9bd)[_0xc5db('0x18')](_0x4810c0);}return null;};}function patchUpdates(_0x521f58){return function(_0x1e967e){try{jsonpatch[_0xc5db('0x1d')](_0x1e967e,_0x521f58,!![]);}catch(_0x41236a){return BPromise['reject'](_0x41236a);}return _0x1e967e[_0xc5db('0x1e')]();};}function saveUpdates(_0x46e87a,_0x3e1355){return function(_0xbc7e70){if(_0xbc7e70){return _0xbc7e70[_0xc5db('0x1f')](_0x46e87a)[_0xc5db('0x20')](function(_0xcca769){return _0xcca769;});}return null;};}function removeEntity(_0x332de3,_0x4ec214){return function(_0xe47b2c){if(_0xe47b2c){return _0xe47b2c['destroy']()['then'](function(){_0x332de3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39996e,_0x22fbb4){return function(_0x554d0f){if(!_0x554d0f){_0x39996e[_0xc5db('0x21')](0x194);}return _0x554d0f;};}function handleError(_0x890e3e,_0x26b508){_0x26b508=_0x26b508||0x1f4;return function(_0xc2134a){logger[_0xc5db('0x22')](_0xc2134a[_0xc5db('0x23')]);if(_0xc2134a['name']){delete _0xc2134a[_0xc5db('0x24')];}_0x890e3e['status'](_0x26b508)[_0xc5db('0x25')](_0xc2134a);};}exports[_0xc5db('0x26')]=function(_0x3b4058,_0x17f4a8){var _0x17f6f6={},_0xeaec0d={},_0x35d8af={'count':0x0,'rows':[]};var _0x21dfe2=_['map'](db['Dynamics365Field'][_0xc5db('0x27')],function(_0x5e6f03){return{'name':_0x5e6f03[_0xc5db('0x28')],'type':_0x5e6f03['type'][_0xc5db('0x29')]};});_0xeaec0d['model']=_[_0xc5db('0x2a')](_0x21dfe2,_0xc5db('0x24'));_0xeaec0d[_0xc5db('0x2b')]=_[_0xc5db('0x2c')](_0x3b4058['query']);_0xeaec0d[_0xc5db('0x2d')]=_[_0xc5db('0x2e')](_0xeaec0d['model'],_0xeaec0d[_0xc5db('0x2b')]);_0x17f6f6[_0xc5db('0x2f')]=_[_0xc5db('0x2e')](_0xeaec0d[_0xc5db('0x30')],qs[_0xc5db('0x31')](_0x3b4058[_0xc5db('0x2b')]['fields']));_0x17f6f6['attributes']=_0x17f6f6[_0xc5db('0x2f')][_0xc5db('0x32')]?_0x17f6f6['attributes']:_0xeaec0d['model'];if(!_0x3b4058['query']['hasOwnProperty']('nolimit')){_0x17f6f6['limit']=qs[_0xc5db('0x1a')](_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x1a')]);_0x17f6f6[_0xc5db('0x33')]=qs['offset'](_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x33')]);}_0x17f6f6['order']=qs[_0xc5db('0x34')](_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x34')]);_0x17f6f6['where']=qs[_0xc5db('0x2d')](_[_0xc5db('0x35')](_0x3b4058[_0xc5db('0x2b')],_0xeaec0d[_0xc5db('0x2d')]),_0x21dfe2);if(_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x36')]){_0x17f6f6[_0xc5db('0x37')]=_[_0xc5db('0x38')](_0x17f6f6[_0xc5db('0x37')],{'$or':_[_0xc5db('0x2a')](_0x21dfe2,function(_0x44f701){if(_0x44f701[_0xc5db('0x39')]!=='VIRTUAL'){var _0x54a48e={};_0x54a48e[_0x44f701[_0xc5db('0x24')]]={'$like':'%'+_0x3b4058[_0xc5db('0x2b')][_0xc5db('0x36')]+'%'};return _0x54a48e;}})});}_0x17f6f6=_[_0xc5db('0x38')]({},_0x17f6f6,_0x3b4058[_0xc5db('0x3a')]);var _0x269e0d={'where':_0x17f6f6[_0xc5db('0x37')]};return db['Dynamics365Field'][_0xc5db('0x19')](_0x269e0d)[_0xc5db('0x20')](function(_0x1c23d0){_0x35d8af[_0xc5db('0x19')]=_0x1c23d0;if(_0x3b4058['query'][_0xc5db('0x3b')]){_0x17f6f6[_0xc5db('0x3c')]=[{'all':!![]}];}return db[_0xc5db('0x3d')][_0xc5db('0x3e')](_0x17f6f6);})[_0xc5db('0x20')](function(_0x57757d){_0x35d8af[_0xc5db('0x3f')]=_0x57757d;return _0x35d8af;})[_0xc5db('0x20')](respondWithFilteredResult(_0x17f4a8,_0x17f6f6))['catch'](handleError(_0x17f4a8,null));};exports[_0xc5db('0x40')]=function(_0x119086,_0x41889d){var _0x1723d7={'raw':!![],'where':{'id':_0x119086[_0xc5db('0x41')]['id']}},_0x1e6319={};_0x1e6319['model']=_[_0xc5db('0x2c')](db[_0xc5db('0x3d')]['rawAttributes']);_0x1e6319[_0xc5db('0x2b')]=_[_0xc5db('0x2c')](_0x119086['query']);_0x1e6319[_0xc5db('0x2d')]=_['intersection'](_0x1e6319[_0xc5db('0x30')],_0x1e6319[_0xc5db('0x2b')]);_0x1723d7[_0xc5db('0x2f')]=_[_0xc5db('0x2e')](_0x1e6319[_0xc5db('0x30')],qs[_0xc5db('0x31')](_0x119086['query'][_0xc5db('0x31')]));_0x1723d7[_0xc5db('0x2f')]=_0x1723d7[_0xc5db('0x2f')][_0xc5db('0x32')]?_0x1723d7[_0xc5db('0x2f')]:_0x1e6319[_0xc5db('0x30')];if(_0x119086[_0xc5db('0x2b')][_0xc5db('0x3b')]){_0x1723d7[_0xc5db('0x3c')]=[{'all':!![]}];}_0x1723d7=_[_0xc5db('0x38')]({},_0x1723d7,_0x119086['options']);return db['Dynamics365Field'][_0xc5db('0x42')](_0x1723d7)[_0xc5db('0x20')](handleEntityNotFound(_0x41889d,null))[_0xc5db('0x20')](respondWithResult(_0x41889d,null))['catch'](handleError(_0x41889d,null));};exports['create']=function(_0x316117,_0xe7f00d){return db[_0xc5db('0x3d')][_0xc5db('0x43')](_0x316117[_0xc5db('0x44')],{})[_0xc5db('0x20')](respondWithResult(_0xe7f00d,0xc9))['catch'](handleError(_0xe7f00d,null));};exports[_0xc5db('0x1f')]=function(_0x52014d,_0x5a61fa){if(_0x52014d['body']['id']){delete _0x52014d['body']['id'];}return db['Dynamics365Field'][_0xc5db('0x42')]({'where':{'id':_0x52014d['params']['id']}})[_0xc5db('0x20')](handleEntityNotFound(_0x5a61fa,null))[_0xc5db('0x20')](saveUpdates(_0x52014d[_0xc5db('0x44')],null))[_0xc5db('0x20')](respondWithResult(_0x5a61fa,null))[_0xc5db('0x45')](handleError(_0x5a61fa,null));};exports[_0xc5db('0x46')]=function(_0x42bc17,_0x110bc9){return db[_0xc5db('0x3d')][_0xc5db('0x42')]({'where':{'id':_0x42bc17[_0xc5db('0x41')]['id']}})[_0xc5db('0x20')](handleEntityNotFound(_0x110bc9,null))[_0xc5db('0x20')](removeEntity(_0x110bc9,null))['catch'](handleError(_0x110bc9,null));}; \ No newline at end of file +var _0xf579=['limit','order','where','filters','pick','filter','merge','type','include','then','rows','catch','show','params','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit'];(function(_0x3e3d20,_0x2b6968){var _0x5605a5=function(_0x4d5a75){while(--_0x4d5a75){_0x3e3d20['push'](_0x3e3d20['shift']());}};_0x5605a5(++_0x2b6968);}(_0xf579,0x1bc));var _0x9f57=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf579[_0x376b45];return _0x2341b3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9f57('0x0'));var rimraf=require(_0x9f57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f57('0x2'));var rp=require(_0x9f57('0x3'));var moment=require('moment');var BPromise=require(_0x9f57('0x4'));var Mustache=require(_0x9f57('0x5'));var util=require(_0x9f57('0x6'));var path=require(_0x9f57('0x7'));var sox=require('sox');var csv=require(_0x9f57('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9f57('0x9'));var squel=require(_0x9f57('0xa'));var crypto=require(_0x9f57('0xb'));var jsforce=require(_0x9f57('0xc'));var deskjs=require(_0x9f57('0xd'));var toCsv=require(_0x9f57('0x8'));var querystring=require(_0x9f57('0xe'));var Papa=require(_0x9f57('0xf'));var Redis=require(_0x9f57('0x10'));var authService=require(_0x9f57('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9f57('0x12'));var hardwareService=require(_0x9f57('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9f57('0x14'));var config=require(_0x9f57('0x15'));var db=require(_0x9f57('0x16'))['db'];function respondWithStatusCode(_0x5f5465,_0x5380df){_0x5380df=_0x5380df||0xcc;return function(_0x3a6eb7){if(_0x3a6eb7){return _0x5f5465[_0x9f57('0x17')](_0x5380df);}return _0x5f5465[_0x9f57('0x18')](_0x5380df)['end']();};}function respondWithResult(_0x906fab,_0x3eed3c){_0x3eed3c=_0x3eed3c||0xc8;return function(_0x2742af){if(_0x2742af){return _0x906fab[_0x9f57('0x18')](_0x3eed3c)['json'](_0x2742af);}};}function respondWithFilteredResult(_0x569e97,_0x42c3cb){return function(_0x3678f2){if(_0x3678f2){var _0xb98953=_0x3678f2[_0x9f57('0x19')],_0x113e73=_0x42c3cb[_0x9f57('0x1a')],_0x154ae5=_0x42c3cb[_0x9f57('0x1a')]+_0x42c3cb['limit'],_0x345a8f;if(_0x154ae5>=_0xb98953){_0x154ae5=_0xb98953;_0x345a8f=0xc8;}else{_0x345a8f=0xce;}_0x569e97[_0x9f57('0x18')](_0x345a8f);return _0x569e97[_0x9f57('0x1b')](_0x9f57('0x1c'),_0x113e73+'-'+_0x154ae5+'/'+_0xb98953)[_0x9f57('0x1d')](_0x3678f2);}return null;};}function patchUpdates(_0x356abb){return function(_0x160082){try{jsonpatch[_0x9f57('0x1e')](_0x160082,_0x356abb,!![]);}catch(_0x31e836){return BPromise[_0x9f57('0x1f')](_0x31e836);}return _0x160082[_0x9f57('0x20')]();};}function saveUpdates(_0x32a4aa,_0x539e8c){return function(_0x42aba3){if(_0x42aba3){return _0x42aba3[_0x9f57('0x21')](_0x32a4aa)['then'](function(_0x41eac5){return _0x41eac5;});}return null;};}function removeEntity(_0x3bfe7f,_0x57c193){return function(_0x2abc65){if(_0x2abc65){return _0x2abc65[_0x9f57('0x22')]()['then'](function(){_0x3bfe7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae801,_0xae6f7b){return function(_0x19a702){if(!_0x19a702){_0x5ae801['sendStatus'](0x194);}return _0x19a702;};}function handleError(_0x38d14b,_0x3cdf5b){_0x3cdf5b=_0x3cdf5b||0x1f4;return function(_0x47918a){logger[_0x9f57('0x23')](_0x47918a[_0x9f57('0x24')]);if(_0x47918a[_0x9f57('0x25')]){delete _0x47918a[_0x9f57('0x25')];}_0x38d14b[_0x9f57('0x18')](_0x3cdf5b)[_0x9f57('0x26')](_0x47918a);};}exports[_0x9f57('0x27')]=function(_0x3ccc5b,_0x4734bb){var _0x2bbfe0={},_0x4f6e78={},_0x29da4b={'count':0x0,'rows':[]};var _0x15ef57=_[_0x9f57('0x28')](db[_0x9f57('0x29')][_0x9f57('0x2a')],function(_0x554994){return{'name':_0x554994[_0x9f57('0x2b')],'type':_0x554994['type'][_0x9f57('0x2c')]};});_0x4f6e78[_0x9f57('0x2d')]=_[_0x9f57('0x28')](_0x15ef57,_0x9f57('0x25'));_0x4f6e78[_0x9f57('0x2e')]=_[_0x9f57('0x2f')](_0x3ccc5b[_0x9f57('0x2e')]);_0x4f6e78['filters']=_['intersection'](_0x4f6e78[_0x9f57('0x2d')],_0x4f6e78[_0x9f57('0x2e')]);_0x2bbfe0[_0x9f57('0x30')]=_[_0x9f57('0x31')](_0x4f6e78[_0x9f57('0x2d')],qs['fields'](_0x3ccc5b[_0x9f57('0x2e')][_0x9f57('0x32')]));_0x2bbfe0[_0x9f57('0x30')]=_0x2bbfe0[_0x9f57('0x30')][_0x9f57('0x33')]?_0x2bbfe0[_0x9f57('0x30')]:_0x4f6e78[_0x9f57('0x2d')];if(!_0x3ccc5b[_0x9f57('0x2e')]['hasOwnProperty'](_0x9f57('0x34'))){_0x2bbfe0['limit']=qs[_0x9f57('0x35')](_0x3ccc5b[_0x9f57('0x2e')][_0x9f57('0x35')]);_0x2bbfe0['offset']=qs[_0x9f57('0x1a')](_0x3ccc5b[_0x9f57('0x2e')][_0x9f57('0x1a')]);}_0x2bbfe0[_0x9f57('0x36')]=qs['sort'](_0x3ccc5b[_0x9f57('0x2e')]['sort']);_0x2bbfe0[_0x9f57('0x37')]=qs[_0x9f57('0x38')](_[_0x9f57('0x39')](_0x3ccc5b[_0x9f57('0x2e')],_0x4f6e78[_0x9f57('0x38')]),_0x15ef57);if(_0x3ccc5b[_0x9f57('0x2e')][_0x9f57('0x3a')]){_0x2bbfe0[_0x9f57('0x37')]=_[_0x9f57('0x3b')](_0x2bbfe0[_0x9f57('0x37')],{'$or':_['map'](_0x15ef57,function(_0x23f9c8){if(_0x23f9c8[_0x9f57('0x3c')]!=='VIRTUAL'){var _0x38589a={};_0x38589a[_0x23f9c8['name']]={'$like':'%'+_0x3ccc5b[_0x9f57('0x2e')]['filter']+'%'};return _0x38589a;}})});}_0x2bbfe0=_[_0x9f57('0x3b')]({},_0x2bbfe0,_0x3ccc5b['options']);var _0x5cf42f={'where':_0x2bbfe0[_0x9f57('0x37')]};return db[_0x9f57('0x29')][_0x9f57('0x19')](_0x5cf42f)['then'](function(_0x204103){_0x29da4b['count']=_0x204103;if(_0x3ccc5b['query']['includeAll']){_0x2bbfe0[_0x9f57('0x3d')]=[{'all':!![]}];}return db[_0x9f57('0x29')]['findAll'](_0x2bbfe0);})[_0x9f57('0x3e')](function(_0x149958){_0x29da4b[_0x9f57('0x3f')]=_0x149958;return _0x29da4b;})[_0x9f57('0x3e')](respondWithFilteredResult(_0x4734bb,_0x2bbfe0))[_0x9f57('0x40')](handleError(_0x4734bb,null));};exports[_0x9f57('0x41')]=function(_0x1ac293,_0x188f6d){var _0xa13aa3={'raw':!![],'where':{'id':_0x1ac293[_0x9f57('0x42')]['id']}},_0x27266a={};_0x27266a['model']=_[_0x9f57('0x2f')](db[_0x9f57('0x29')][_0x9f57('0x2a')]);_0x27266a[_0x9f57('0x2e')]=_[_0x9f57('0x2f')](_0x1ac293[_0x9f57('0x2e')]);_0x27266a[_0x9f57('0x38')]=_['intersection'](_0x27266a[_0x9f57('0x2d')],_0x27266a[_0x9f57('0x2e')]);_0xa13aa3['attributes']=_['intersection'](_0x27266a[_0x9f57('0x2d')],qs[_0x9f57('0x32')](_0x1ac293[_0x9f57('0x2e')][_0x9f57('0x32')]));_0xa13aa3[_0x9f57('0x30')]=_0xa13aa3['attributes']['length']?_0xa13aa3[_0x9f57('0x30')]:_0x27266a[_0x9f57('0x2d')];if(_0x1ac293[_0x9f57('0x2e')]['includeAll']){_0xa13aa3[_0x9f57('0x3d')]=[{'all':!![]}];}_0xa13aa3=_[_0x9f57('0x3b')]({},_0xa13aa3,_0x1ac293[_0x9f57('0x43')]);return db[_0x9f57('0x29')]['find'](_0xa13aa3)['then'](handleEntityNotFound(_0x188f6d,null))[_0x9f57('0x3e')](respondWithResult(_0x188f6d,null))['catch'](handleError(_0x188f6d,null));};exports['create']=function(_0x51a020,_0x482f55){return db[_0x9f57('0x29')][_0x9f57('0x44')](_0x51a020[_0x9f57('0x45')],{})[_0x9f57('0x3e')](respondWithResult(_0x482f55,0xc9))[_0x9f57('0x40')](handleError(_0x482f55,null));};exports[_0x9f57('0x21')]=function(_0x2a92ab,_0x15fae1){if(_0x2a92ab[_0x9f57('0x45')]['id']){delete _0x2a92ab[_0x9f57('0x45')]['id'];}return db[_0x9f57('0x29')][_0x9f57('0x46')]({'where':{'id':_0x2a92ab['params']['id']}})[_0x9f57('0x3e')](handleEntityNotFound(_0x15fae1,null))[_0x9f57('0x3e')](saveUpdates(_0x2a92ab[_0x9f57('0x45')],null))[_0x9f57('0x3e')](respondWithResult(_0x15fae1,null))[_0x9f57('0x40')](handleError(_0x15fae1,null));};exports[_0x9f57('0x22')]=function(_0x35f222,_0x197e46){return db[_0x9f57('0x29')][_0x9f57('0x46')]({'where':{'id':_0x35f222[_0x9f57('0x42')]['id']}})[_0x9f57('0x3e')](handleEntityNotFound(_0x197e46,null))[_0x9f57('0x3e')](removeEntity(_0x197e46,null))[_0x9f57('0x40')](handleError(_0x197e46,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7a44e3f..f6bca9d 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 _0xa776=['Dynamics365Field','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','moment','path','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x47c673,_0x372b71){var _0x5f7647=function(_0x1a9d03){while(--_0x1a9d03){_0x47c673['push'](_0x47c673['shift']());}};_0x5f7647(++_0x372b71);}(_0xa776,0x19b));var _0x6a77=function(_0xa76a95,_0x5ab7c7){_0xa76a95=_0xa76a95-0x0;var _0x3b2d32=_0xa776[_0xa76a95];return _0x3b2d32;};'use strict';var _=require(_0x6a77('0x0'));var util=require(_0x6a77('0x1'));var logger=require(_0x6a77('0x2'))('api');var moment=require(_0x6a77('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a77('0x4'));var rimraf=require('rimraf');var config=require(_0x6a77('0x5'));var attributes=require(_0x6a77('0x6'));module[_0x6a77('0x7')]=function(_0x39e9c2,_0x3cab2e){return _0x39e9c2[_0x6a77('0x8')](_0x6a77('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x6a77('0xa'),'fields':['idField',_0x6a77('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa97=['util','../../config/logger','api','moment','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xaa97,0x144));var _0x7aa9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa97[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7aa9('0x0'));var util=require(_0x7aa9('0x1'));var logger=require(_0x7aa9('0x2'))(_0x7aa9('0x3'));var moment=require(_0x7aa9('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(_0x7aa9('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0x7aa9('0x6')]=function(_0x59e00d,_0x48ed29){return _0x59e00d[_0x7aa9('0x7')](_0x7aa9('0x8'),attributes,{'tableName':_0x7aa9('0x9'),'paranoid':![],'indexes':[{'name':_0x7aa9('0xa'),'fields':[_0x7aa9('0xb'),_0x7aa9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index b8edb25..2942375 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 _0xd2f5=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5abd77,_0x4d351d){var _0x32b660=function(_0x3d0327){while(--_0x3d0327){_0x5abd77['push'](_0x5abd77['shift']());}};_0x32b660(++_0x4d351d);}(_0xd2f5,0x144));var _0x5d2f=function(_0xd43538,_0x364a33){_0xd43538=_0xd43538-0x0;var _0x34857b=_0xd2f5[_0xd43538];return _0x34857b;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var moment=require(_0x5d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2f('0x3'))['db'];var utils=require(_0x5d2f('0x4'));var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require(_0x5d2f('0x8'));var client=jayson[_0x5d2f('0x9')][_0x5d2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2540,_0x443779,_0x908c6){return new BPromise(function(_0x1c8c59,_0x1670ea){return client[_0x5d2f('0xb')](_0x4b2540,_0x908c6)[_0x5d2f('0xc')](function(_0x58e637){logger[_0x5d2f('0xd')](_0x5d2f('0xe'),_0x443779,'request\x20sent');logger[_0x5d2f('0xf')](_0x5d2f('0x10'),_0x443779,_0x5d2f('0x11'),JSON['stringify'](_0x58e637));if(_0x58e637[_0x5d2f('0x12')]){if(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x13')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x443779,_0x58e637[_0x5d2f('0x12')]['message']);return _0x1670ea(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}logger['error'](_0x5d2f('0xe'),_0x443779,_0x58e637['error'][_0x5d2f('0x14')]);return _0x1c8c59(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}else{logger['info'](_0x5d2f('0xe'),_0x443779,_0x5d2f('0x11'));_0x1c8c59(_0x58e637[_0x5d2f('0x15')][_0x5d2f('0x14')]);}})[_0x5d2f('0x16')](function(_0x5796f6){logger[_0x5d2f('0x12')](_0x5d2f('0xe'),_0x443779,_0x5796f6);_0x1670ea(_0x5796f6);});});} \ No newline at end of file +var _0x46e1=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x200082,_0x25aec6){var _0x2903e2=function(_0x4e4082){while(--_0x4e4082){_0x200082['push'](_0x200082['shift']());}};_0x2903e2(++_0x25aec6);}(_0x46e1,0x155));var _0x146e=function(_0x20241c,_0x294c44){_0x20241c=_0x20241c-0x0;var _0x5b3087=_0x46e1[_0x20241c];return _0x5b3087;};'use strict';var _=require(_0x146e('0x0'));var util=require(_0x146e('0x1'));var moment=require(_0x146e('0x2'));var BPromise=require(_0x146e('0x3'));var rs=require(_0x146e('0x4'));var fs=require('fs');var Redis=require(_0x146e('0x5'));var db=require(_0x146e('0x6'))['db'];var utils=require(_0x146e('0x7'));var logger=require(_0x146e('0x8'))(_0x146e('0x9'));var config=require('../../config/environment');var jayson=require(_0x146e('0xa'));var client=jayson[_0x146e('0xb')][_0x146e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x228fe7,_0x70ce4,_0x35e40e){return new BPromise(function(_0x1c1398,_0x5f33c0){return client[_0x146e('0xd')](_0x228fe7,_0x35e40e)['then'](function(_0x36f843){logger[_0x146e('0xe')](_0x146e('0xf'),_0x70ce4,_0x146e('0x10'));logger[_0x146e('0x11')](_0x146e('0x12'),_0x70ce4,'request\x20sent',JSON['stringify'](_0x36f843));if(_0x36f843[_0x146e('0x13')]){if(_0x36f843[_0x146e('0x13')][_0x146e('0x14')]===0x1f4){logger[_0x146e('0x13')](_0x146e('0xf'),_0x70ce4,_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);return _0x5f33c0(_0x36f843[_0x146e('0x13')]['message']);}logger['error'](_0x146e('0xf'),_0x70ce4,_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);return _0x1c1398(_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);}else{logger[_0x146e('0xe')](_0x146e('0xf'),_0x70ce4,_0x146e('0x10'));_0x1c1398(_0x36f843[_0x146e('0x16')][_0x146e('0x15')]);}})[_0x146e('0x17')](function(_0x55fddc){logger[_0x146e('0x13')](_0x146e('0xf'),_0x70ce4,_0x55fddc);_0x5f33c0(_0x55fddc);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5b20127..cfd68f9 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 _0x50b9=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','exports'];(function(_0x148028,_0x8f4e9){var _0xb0ec6=function(_0x502efd){while(--_0x502efd){_0x148028['push'](_0x148028['shift']());}};_0xb0ec6(++_0x8f4e9);}(_0x50b9,0x138));var _0x950b=function(_0x4c94d1,_0x573a4f){_0x4c94d1=_0x4c94d1-0x0;var _0x48c2c3=_0x50b9[_0x4c94d1];return _0x48c2c3;};'use strict';var multer=require(_0x950b('0x0'));var util=require(_0x950b('0x1'));var path=require(_0x950b('0x2'));var timeout=require(_0x950b('0x3'));var express=require('express');var router=express[_0x950b('0x4')]();var auth=require(_0x950b('0x5'));var interaction=require(_0x950b('0x6'));var config=require(_0x950b('0x7'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x950b('0x8')](),controller[_0x950b('0x9')]);router[_0x950b('0xa')](_0x950b('0xb'),auth['isAuthenticated'](),controller[_0x950b('0xc')]);router['get'](_0x950b('0xd'),auth[_0x950b('0x8')](),controller[_0x950b('0xe')]);router['get'](_0x950b('0xf'),auth[_0x950b('0x8')](),controller[_0x950b('0x10')]);router['post']('/',auth[_0x950b('0x8')](),controller[_0x950b('0x11')]);router[_0x950b('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x950b('0x13')]);router[_0x950b('0x14')](_0x950b('0xb'),auth[_0x950b('0x8')](),controller[_0x950b('0x15')]);router[_0x950b('0x16')]('/:id',auth[_0x950b('0x8')](),controller['destroy']);module[_0x950b('0x17')]=router; \ No newline at end of file +var _0x21c1=['create','addConfiguration','put','delete','destroy','util','path','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','/:id','show','get','/:id/configurations','getConfigurations','isAuthenticated','getFields','post'];(function(_0x5d84d6,_0x1a4671){var _0x2cd0f5=function(_0x243d25){while(--_0x243d25){_0x5d84d6['push'](_0x5d84d6['shift']());}};_0x2cd0f5(++_0x1a4671);}(_0x21c1,0x195));var _0x121c=function(_0x2a69ee,_0x443917){_0x2a69ee=_0x2a69ee-0x0;var _0x5db1a5=_0x21c1[_0x2a69ee];return _0x5db1a5;};'use strict';var multer=require('multer');var util=require(_0x121c('0x0'));var path=require(_0x121c('0x1'));var timeout=require('connect-timeout');var express=require(_0x121c('0x2'));var router=express[_0x121c('0x3')]();var auth=require(_0x121c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x121c('0x5'));var controller=require(_0x121c('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x121c('0x7'),auth['isAuthenticated'](),controller[_0x121c('0x8')]);router[_0x121c('0x9')](_0x121c('0xa'),auth['isAuthenticated'](),controller[_0x121c('0xb')]);router['get']('/:id/fields',auth[_0x121c('0xc')](),controller[_0x121c('0xd')]);router[_0x121c('0xe')]('/',auth['isAuthenticated'](),controller[_0x121c('0xf')]);router[_0x121c('0xe')](_0x121c('0xa'),auth[_0x121c('0xc')](),controller[_0x121c('0x10')]);router[_0x121c('0x11')]('/:id',auth[_0x121c('0xc')](),controller['update']);router[_0x121c('0x12')]('/:id',auth[_0x121c('0xc')](),controller[_0x121c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 56961a3..ce09a02 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 _0x94d4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x94d4,0xa5));var _0x494d=function(_0x455ce1,_0xc2e5c9){_0x455ce1=_0x455ce1-0x0;var _0x25c86b=_0x94d4[_0x455ce1];return _0x25c86b;};'use strict';var Sequelize=require(_0x494d('0x0'));module[_0x494d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x494d('0x2')]},'username':{'type':Sequelize[_0x494d('0x2')],'unique':_0x494d('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x494d('0x2')],'unique':_0x494d('0x4')},'serverUrl':{'type':Sequelize[_0x494d('0x2')]}}; \ No newline at end of file +var _0xef4d=['username','remoteUri','sequelize','exports','STRING'];(function(_0xcdf550,_0x3c033a){var _0x5c390e=function(_0x3b0d7c){while(--_0x3b0d7c){_0xcdf550['push'](_0xcdf550['shift']());}};_0x5c390e(++_0x3c033a);}(_0xef4d,0x165));var _0xdef4=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xef4d[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0xdef4('0x0'));module[_0xdef4('0x1')]={'name':{'type':Sequelize[_0xdef4('0x2')]},'description':{'type':Sequelize[_0xdef4('0x2')]},'username':{'type':Sequelize[_0xdef4('0x2')],'unique':_0xdef4('0x3')},'apiKey':{'type':Sequelize[_0xdef4('0x2')]},'remoteUri':{'type':Sequelize[_0xdef4('0x2')],'unique':_0xdef4('0x4')},'serverUrl':{'type':Sequelize[_0xdef4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 571ca3f..b0f66b5 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['reject','save','update','destroy','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','keys','include','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Descriptions','channel','FreshdeskConfiguration','Subjects','FreshdeskField','getFields','remoteUri','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply'];(function(_0x59684c,_0x4f23bd){var _0x6e9beb=function(_0x316cde){while(--_0x316cde){_0x59684c['push'](_0x59684c['shift']());}};_0x6e9beb(++_0x4f23bd);}(_0x1cb9,0x14e));var _0x91cb=function(_0x411d3b,_0x4cdf9a){_0x411d3b=_0x411d3b-0x0;var _0x896ddb=_0x1cb9[_0x411d3b];return _0x896ddb;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x91cb('0x18'));var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ea707,_0x44f2e9,_0x2c7d40){if(_0x2c7d40){var _0x4a7d45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a7d45['test'](_0x44f2e9)){return _0x3ea707;}else{throw new db[(_0x91cb('0x1b'))][(_0x91cb('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3ea707;}}function respondWithRpcPromise(_0x528f73,_0x576369,_0xc3629e,_0x347980){return new BPromise(function(_0x5ea796,_0x238f11){var _0x135890=_0x347980||client;return _0x135890['request'](_0x528f73,_0xc3629e)[_0x91cb('0x1d')](function(_0x139f4b){logger[_0x91cb('0x1e')](_0x91cb('0x1f'),_0x576369,'request\x20sent');logger[_0x91cb('0x20')](_0x91cb('0x21'),_0x576369,'request\x20sent',JSON[_0x91cb('0x22')](_0x139f4b));if(_0x139f4b['error']){if(_0x139f4b['error'][_0x91cb('0x23')]===0x1f4){logger[_0x91cb('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x576369,_0x139f4b['error']['message']);return _0x238f11(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x139f4b['error'][_0x91cb('0x25')]);return _0x5ea796(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}else{logger['info'](_0x91cb('0x1f'),_0x576369,_0x91cb('0x26'));_0x5ea796(_0x139f4b[_0x91cb('0x27')][_0x91cb('0x25')]);}})[_0x91cb('0x28')](function(_0x7ad361){logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x7ad361);_0x238f11(_0x7ad361);});});}function respondWithStatusCode(_0x264e9b,_0x4c8438){_0x4c8438=_0x4c8438||0xcc;return function(_0x59bf3a){if(_0x59bf3a){return _0x264e9b[_0x91cb('0x29')](_0x4c8438);}return _0x264e9b['status'](_0x4c8438)[_0x91cb('0x2a')]();};}function respondWithResult(_0x34d372,_0x318031){_0x318031=_0x318031||0xc8;return function(_0x5595c5){if(_0x5595c5){return _0x34d372[_0x91cb('0x2b')](_0x318031)['json'](_0x5595c5);}};}function respondWithFilteredResult(_0x4572f6,_0x308e8c){return function(_0x3b3ee6){if(_0x3b3ee6){var _0x2fb473=_0x3b3ee6['count'],_0x468908=_0x308e8c[_0x91cb('0x2c')],_0x504275=_0x308e8c[_0x91cb('0x2c')]+_0x308e8c[_0x91cb('0x2d')],_0x2f04a3;if(_0x504275>=_0x2fb473){_0x504275=_0x2fb473;_0x2f04a3=0xc8;}else{_0x2f04a3=0xce;}_0x4572f6['status'](_0x2f04a3);return _0x4572f6[_0x91cb('0x2e')](_0x91cb('0x2f'),_0x468908+'-'+_0x504275+'/'+_0x2fb473)[_0x91cb('0x30')](_0x3b3ee6);}return null;};}function patchUpdates(_0x361e4c){return function(_0xf296bc){try{jsonpatch[_0x91cb('0x31')](_0xf296bc,_0x361e4c,!![]);}catch(_0x1e5bf1){return BPromise[_0x91cb('0x32')](_0x1e5bf1);}return _0xf296bc[_0x91cb('0x33')]();};}function saveUpdates(_0x5e6ed3,_0x2ccf6e){return function(_0x474a15){if(_0x474a15){return _0x474a15[_0x91cb('0x34')](_0x5e6ed3)[_0x91cb('0x1d')](function(_0x440060){return _0x440060;});}return null;};}function removeEntity(_0x4e70cd,_0x2409d3){return function(_0x74b443){if(_0x74b443){return _0x74b443[_0x91cb('0x35')]()[_0x91cb('0x1d')](function(){_0x4e70cd[_0x91cb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121c37,_0x5927cb){return function(_0x47fc17){if(!_0x47fc17){_0x121c37['sendStatus'](0x194);}return _0x47fc17;};}function handleError(_0x2011fc,_0x4bba88){_0x4bba88=_0x4bba88||0x1f4;return function(_0x341ebe){logger['error'](_0x341ebe['stack']);if(_0x341ebe[_0x91cb('0x36')]){delete _0x341ebe[_0x91cb('0x36')];}_0x2011fc[_0x91cb('0x2b')](_0x4bba88)[_0x91cb('0x37')](_0x341ebe);};}exports[_0x91cb('0x38')]=function(_0x4b0ca6,_0x8beb3a){var _0x3ddc0b={},_0x13a5ea={},_0x8496a3={'count':0x0,'rows':[]};var _0x486a89=_['map'](db[_0x91cb('0x39')][_0x91cb('0x3a')],function(_0x56d614){return{'name':_0x56d614[_0x91cb('0x3b')],'type':_0x56d614[_0x91cb('0x3c')]['key']};});_0x13a5ea[_0x91cb('0x3d')]=_[_0x91cb('0x3e')](_0x486a89,'name');_0x13a5ea[_0x91cb('0x3f')]=_['keys'](_0x4b0ca6[_0x91cb('0x3f')]);_0x13a5ea[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x13a5ea[_0x91cb('0x3d')],_0x13a5ea[_0x91cb('0x3f')]);_0x3ddc0b[_0x91cb('0x42')]=_['intersection'](_0x13a5ea[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x4b0ca6['query'][_0x91cb('0x43')]));_0x3ddc0b['attributes']=_0x3ddc0b[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3ddc0b[_0x91cb('0x42')]:_0x13a5ea[_0x91cb('0x3d')];if(!_0x4b0ca6['query'][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3ddc0b[_0x91cb('0x2d')]=qs[_0x91cb('0x2d')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3ddc0b[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2c')]);}_0x3ddc0b['order']=qs[_0x91cb('0x47')](_0x4b0ca6['query'][_0x91cb('0x47')]);_0x3ddc0b['where']=qs[_0x91cb('0x40')](_['pick'](_0x4b0ca6[_0x91cb('0x3f')],_0x13a5ea[_0x91cb('0x40')]),_0x486a89);if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3ddc0b['where']=_[_0x91cb('0x49')](_0x3ddc0b[_0x91cb('0x4a')],{'$or':_['map'](_0x486a89,function(_0x461e1e){if(_0x461e1e[_0x91cb('0x3c')]!==_0x91cb('0x4b')){var _0x32517d={};_0x32517d[_0x461e1e[_0x91cb('0x36')]]={'$like':'%'+_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x32517d;}})});}_0x3ddc0b=_[_0x91cb('0x49')]({},_0x3ddc0b,_0x4b0ca6[_0x91cb('0x4c')]);var _0x4b26f6={'where':_0x3ddc0b[_0x91cb('0x4a')]};return db[_0x91cb('0x39')][_0x91cb('0x4d')](_0x4b26f6)[_0x91cb('0x1d')](function(_0x3314cc){_0x8496a3[_0x91cb('0x4d')]=_0x3314cc;if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x3ddc0b['include']=[{'all':!![]}];}return db[_0x91cb('0x39')][_0x91cb('0x4f')](_0x3ddc0b);})[_0x91cb('0x1d')](function(_0x3b8cfd){_0x8496a3['rows']=_0x3b8cfd;return _0x8496a3;})[_0x91cb('0x1d')](respondWithFilteredResult(_0x8beb3a,_0x3ddc0b))[_0x91cb('0x28')](handleError(_0x8beb3a,null));};exports['show']=function(_0x212473,_0x47cdb7){var _0x2c419b={'raw':![],'where':{'id':_0x212473['params']['id']}},_0x4c0acd={};_0x4c0acd['model']=_[_0x91cb('0x50')](db[_0x91cb('0x39')][_0x91cb('0x3a')]);_0x4c0acd[_0x91cb('0x3f')]=_[_0x91cb('0x50')](_0x212473['query']);_0x4c0acd['filters']=_[_0x91cb('0x41')](_0x4c0acd[_0x91cb('0x3d')],_0x4c0acd[_0x91cb('0x3f')]);_0x2c419b[_0x91cb('0x42')]=_['intersection'](_0x4c0acd['model'],qs['fields'](_0x212473[_0x91cb('0x3f')]['fields']));_0x2c419b[_0x91cb('0x42')]=_0x2c419b['attributes'][_0x91cb('0x44')]?_0x2c419b[_0x91cb('0x42')]:_0x4c0acd[_0x91cb('0x3d')];if(_0x212473[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x2c419b[_0x91cb('0x51')]=[{'all':!![]}];}_0x2c419b=_[_0x91cb('0x49')]({},_0x2c419b,_0x212473[_0x91cb('0x4c')]);return db[_0x91cb('0x39')][_0x91cb('0x52')](_0x2c419b)[_0x91cb('0x1d')](handleEntityNotFound(_0x47cdb7,null))['then'](respondWithResult(_0x47cdb7,null))[_0x91cb('0x28')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x53')]=function(_0x4d7a34,_0x3f719b){return db[_0x91cb('0x39')]['create'](_0x4d7a34[_0x91cb('0x54')],{})[_0x91cb('0x1d')](respondWithResult(_0x3f719b,0xc9))[_0x91cb('0x28')](handleError(_0x3f719b,null));};exports[_0x91cb('0x34')]=function(_0x43ddee,_0x42a9ef){if(_0x43ddee[_0x91cb('0x54')]['id']){delete _0x43ddee[_0x91cb('0x54')]['id'];}return db[_0x91cb('0x39')][_0x91cb('0x52')]({'where':{'id':_0x43ddee[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a9ef,null))[_0x91cb('0x1d')](saveUpdates(_0x43ddee['body'],null))[_0x91cb('0x1d')](respondWithResult(_0x42a9ef,null))['catch'](handleError(_0x42a9ef,null));};exports[_0x91cb('0x35')]=function(_0x1b2fec,_0x1986d7){return db['FreshdeskAccount'][_0x91cb('0x52')]({'where':{'id':_0x1b2fec[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1986d7,null))[_0x91cb('0x1d')](removeEntity(_0x1986d7,null))[_0x91cb('0x28')](handleError(_0x1986d7,null));};exports[_0x91cb('0x56')]=function(_0x25548b,_0x48e825,_0x2f5658){var _0x3854e9={};var _0x4250c2={};var _0x373076;var _0x55a0e3;return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x25548b['params']['id']}})['then'](handleEntityNotFound(_0x48e825,null))[_0x91cb('0x1d')](function(_0x525021){if(_0x525021){_0x373076=_0x525021;_0x4250c2[_0x91cb('0x3d')]=_[_0x91cb('0x50')](db['FreshdeskConfiguration']['rawAttributes']);_0x4250c2[_0x91cb('0x3f')]=_['keys'](_0x25548b[_0x91cb('0x3f')]);_0x4250c2[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x4250c2['model'],_0x4250c2[_0x91cb('0x3f')]);_0x3854e9['attributes']=_[_0x91cb('0x41')](_0x4250c2[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x25548b[_0x91cb('0x3f')]['fields']));_0x3854e9[_0x91cb('0x42')]=_0x3854e9[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3854e9[_0x91cb('0x42')]:_0x4250c2[_0x91cb('0x3d')];_0x3854e9[_0x91cb('0x58')]=qs[_0x91cb('0x47')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x47')]);_0x3854e9[_0x91cb('0x4a')]=qs[_0x91cb('0x40')](_[_0x91cb('0x59')](_0x25548b['query'],_0x4250c2[_0x91cb('0x40')]));if(_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3854e9[_0x91cb('0x4a')]=_[_0x91cb('0x49')](_0x3854e9[_0x91cb('0x4a')],{'$or':_[_0x91cb('0x3e')](_0x3854e9['attributes'],function(_0x325b2d){var _0x5a3c7d={};_0x5a3c7d[_0x325b2d]={'$like':'%'+_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x5a3c7d;})});}_0x3854e9=_[_0x91cb('0x49')]({},_0x3854e9,_0x25548b[_0x91cb('0x4c')]);return _0x373076['getConfigurations'](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x22ab40){if(_0x22ab40){_0x55a0e3=_0x22ab40[_0x91cb('0x44')];if(!_0x25548b[_0x91cb('0x3f')][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3854e9['limit']=qs[_0x91cb('0x2d')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3854e9[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2c')]);}return _0x373076[_0x91cb('0x56')](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x457f81){if(_0x457f81){return _0x457f81?{'count':_0x55a0e3,'rows':_0x457f81}:null;}})[_0x91cb('0x1d')](respondWithResult(_0x48e825,null))[_0x91cb('0x28')](handleError(_0x48e825,null));};exports[_0x91cb('0x5a')]=function(_0x3eead5,_0x2d2613,_0x2605c3){if(_0x3eead5[_0x91cb('0x54')]['id']){delete _0x3eead5['body']['id'];}return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x3eead5['params']['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x2d2613,null))[_0x91cb('0x1d')](function(_0x1c3e0a){if(_0x1c3e0a){_0x3eead5['body'][_0x91cb('0x5b')]=_0x1c3e0a['id'];_0x3eead5[_0x91cb('0x54')]['Subjects']=integrations['getSubjects'](_0x3eead5[_0x91cb('0x54')]['channel'],_0x3eead5[_0x91cb('0x54')][_0x91cb('0x3c')]);_0x3eead5['body'][_0x91cb('0x5c')]=integrations['getDescriptions'](_0x3eead5[_0x91cb('0x54')][_0x91cb('0x5d')],_0x3eead5['body']['type']);return db[_0x91cb('0x5e')][_0x91cb('0x53')](_0x3eead5[_0x91cb('0x54')],{'include':[{'model':db['FreshdeskField'],'as':_0x91cb('0x5f')},{'model':db[_0x91cb('0x60')],'as':_0x91cb('0x5c')}]});}return null;})[_0x91cb('0x1d')](respondWithResult(_0x2d2613,null))['catch'](handleError(_0x2d2613,null));};exports[_0x91cb('0x61')]=function(_0x4ee1e3,_0x342587,_0x4118eb){var _0x30c607='';return db[_0x91cb('0x39')]['findOne']({'where':{'id':_0x4ee1e3['params']['id']},'attributes':['id',_0x91cb('0x62'),'apiKey']})[_0x91cb('0x1d')](handleEntityNotFound(_0x342587,null))[_0x91cb('0x1d')](function(_0x2ede77){if(_0x2ede77){_0x30c607=_0x2ede77[_0x91cb('0x62')];var _0x33d4ab=_0x30c607[_0x91cb('0x63')](-0x1);if(_0x33d4ab==='/'){_0x30c607=_0x30c607[_0x91cb('0x64')](0x0,_0x30c607['lastIndexOf'](_0x33d4ab));}return rp({'method':_0x91cb('0x65'),'uri':util[_0x91cb('0x66')]('%s/%s',_0x30c607,_0x91cb('0x67')),'headers':{'Authorization':util['format'](_0x91cb('0x68'),new Buffer(util[_0x91cb('0x66')](_0x91cb('0x69'),_0x2ede77[_0x91cb('0x6a')]))[_0x91cb('0x6b')](_0x91cb('0x6c')))},'json':!![]});}})[_0x91cb('0x1d')](function(_0x30259d){if(_0x30259d){var _0x23380a=[_0x91cb('0x6d'),_0x91cb('0x6e'),_0x91cb('0x6f'),_0x91cb('0x70'),_0x91cb('0x2b'),_0x91cb('0x71'),_0x91cb('0x72'),'source',_0x91cb('0x73'),'group',_0x91cb('0x74')];_[_0x91cb('0x75')](_0x30259d,function(_0x13f358){return _0x23380a[_0x91cb('0x76')](_0x13f358[_0x91cb('0x36')])||!_0x13f358[_0x91cb('0x77')]&&_0x13f358[_0x91cb('0x3c')]!==_0x91cb('0x78')&&_0x13f358['type']!==_0x91cb('0x79');});return{'count':_0x30259d[_0x91cb('0x44')],'rows':_['map'](_0x30259d,function(_0x4fb3c0){return{'id':_0x4fb3c0[_0x91cb('0x36')],'name':_0x4fb3c0['label'],'custom':!_0x4fb3c0['default'],'options':_0x4fb3c0[_0x91cb('0x7a')]?_['map'](_0x4fb3c0[_0x91cb('0x7a')],function(_0x498382){return{'name':_[_0x91cb('0x7b')](_0x498382),'value':_0x498382};}):[]};})};}})[_0x91cb('0x1d')](respondWithResult(_0x342587,null))[_0x91cb('0x28')](function(_0x443c01){var _0x4e899c=_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?0x1f4:_0x443c01[_0x91cb('0x7d')]||0x1f4;logger[_0x91cb('0x24')](_0x91cb('0x7e'),_0x91cb('0x61'),_0x4e899c,JSON[_0x91cb('0x22')](_0x443c01));delete _0x443c01[_0x91cb('0x36')];if(_0x4e899c===0x191){_0x4e899c=0x190;}_0x342587[_0x91cb('0x2b')](_0x4e899c)[_0x91cb('0x37')](_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?{'message':_0x91cb('0x7f'),'statusCode':_0x443c01[_0x91cb('0x7d')]}:_0x443c01);});}; \ No newline at end of file +var _0xa41a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','sendStatus','name','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','map','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','description','priority','source','ticket_type','company','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','send','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce'];(function(_0x30d061,_0x1b0de8){var _0x5c44c9=function(_0x7271c0){while(--_0x7271c0){_0x30d061['push'](_0x30d061['shift']());}};_0x5c44c9(++_0x1b0de8);}(_0xa41a,0x6b));var _0xaa41=function(_0xcae9f7,_0x1caec1){_0xcae9f7=_0xcae9f7-0x0;var _0x3b7f5e=_0xa41a[_0xcae9f7];return _0x3b7f5e;};'use strict';var pdf=require(_0xaa41('0x0'));var emlformat=require(_0xaa41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa41('0x2'));var jsonpatch=require(_0xaa41('0x3'));var rp=require(_0xaa41('0x4'));var moment=require(_0xaa41('0x5'));var BPromise=require(_0xaa41('0x6'));var Mustache=require(_0xaa41('0x7'));var util=require(_0xaa41('0x8'));var path=require(_0xaa41('0x9'));var sox=require('sox');var csv=require(_0xaa41('0xa'));var ejs=require(_0xaa41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xa'));var querystring=require(_0xaa41('0xe'));var Papa=require(_0xaa41('0xf'));var Redis=require(_0xaa41('0x10'));var authService=require(_0xaa41('0x11'));var qs=require(_0xaa41('0x12'));var as=require(_0xaa41('0x13'));var hardwareService=require(_0xaa41('0x14'));var logger=require(_0xaa41('0x15'))('api');var utils=require(_0xaa41('0x16'));var config=require(_0xaa41('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xaa41('0x18'));var client=jayson['client'][_0xaa41('0x19')]({'port':0x232a});function checkPasswordPattern(_0x12d9e6,_0x2f64bc,_0x889d44){if(_0x889d44){var _0x6f9ade=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6f9ade['test'](_0x2f64bc)){return _0x12d9e6;}else{throw new db[(_0xaa41('0x1a'))][(_0xaa41('0x1b'))](_0xaa41('0x1c'));}}else{return _0x12d9e6;}}function respondWithRpcPromise(_0x1ef7d9,_0x2a6988,_0x2005ae,_0x1e1e02){return new BPromise(function(_0x550ad5,_0x2d868a){var _0x16b930=_0x1e1e02||client;return _0x16b930[_0xaa41('0x1d')](_0x1ef7d9,_0x2005ae)[_0xaa41('0x1e')](function(_0x230a6a){logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));logger[_0xaa41('0x22')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2a6988,'request\x20sent',JSON[_0xaa41('0x23')](_0x230a6a));if(_0x230a6a[_0xaa41('0x24')]){if(_0x230a6a[_0xaa41('0x24')]['code']===0x1f4){logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a['error']['message']);return _0x2d868a(_0x230a6a[_0xaa41('0x24')]['message']);}logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a[_0xaa41('0x24')][_0xaa41('0x25')]);return _0x550ad5(_0x230a6a[_0xaa41('0x24')]['message']);}else{logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));_0x550ad5(_0x230a6a[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x5c3074){logger['error'](_0xaa41('0x20'),_0x2a6988,_0x5c3074);_0x2d868a(_0x5c3074);});});}function respondWithStatusCode(_0x527cac,_0x493a10){_0x493a10=_0x493a10||0xcc;return function(_0x12e362){if(_0x12e362){return _0x527cac['sendStatus'](_0x493a10);}return _0x527cac['status'](_0x493a10)[_0xaa41('0x28')]();};}function respondWithResult(_0x9c8c21,_0x392214){_0x392214=_0x392214||0xc8;return function(_0x632fd2){if(_0x632fd2){return _0x9c8c21[_0xaa41('0x29')](_0x392214)[_0xaa41('0x2a')](_0x632fd2);}};}function respondWithFilteredResult(_0x57ef96,_0x30a174){return function(_0x1f0275){if(_0x1f0275){var _0x63c18c=_0x1f0275[_0xaa41('0x2b')],_0x9a16e3=_0x30a174[_0xaa41('0x2c')],_0x1d8c2b=_0x30a174['offset']+_0x30a174[_0xaa41('0x2d')],_0x4466a3;if(_0x1d8c2b>=_0x63c18c){_0x1d8c2b=_0x63c18c;_0x4466a3=0xc8;}else{_0x4466a3=0xce;}_0x57ef96['status'](_0x4466a3);return _0x57ef96['set'](_0xaa41('0x2e'),_0x9a16e3+'-'+_0x1d8c2b+'/'+_0x63c18c)[_0xaa41('0x2a')](_0x1f0275);}return null;};}function patchUpdates(_0x534a85){return function(_0x392b5d){try{jsonpatch[_0xaa41('0x2f')](_0x392b5d,_0x534a85,!![]);}catch(_0x4e3b44){return BPromise['reject'](_0x4e3b44);}return _0x392b5d['save']();};}function saveUpdates(_0x1cf3da,_0x2f5cc0){return function(_0x2a186e){if(_0x2a186e){return _0x2a186e[_0xaa41('0x30')](_0x1cf3da)['then'](function(_0x289c4a){return _0x289c4a;});}return null;};}function removeEntity(_0x45c8fe,_0x3e0204){return function(_0x4de770){if(_0x4de770){return _0x4de770[_0xaa41('0x31')]()[_0xaa41('0x1e')](function(){_0x45c8fe[_0xaa41('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252c62,_0x374117){return function(_0x57fe1d){if(!_0x57fe1d){_0x252c62[_0xaa41('0x32')](0x194);}return _0x57fe1d;};}function handleError(_0x13b6d4,_0x2298ed){_0x2298ed=_0x2298ed||0x1f4;return function(_0x5cec87){logger[_0xaa41('0x24')](_0x5cec87['stack']);if(_0x5cec87[_0xaa41('0x33')]){delete _0x5cec87[_0xaa41('0x33')];}_0x13b6d4[_0xaa41('0x29')](_0x2298ed)['send'](_0x5cec87);};}exports['index']=function(_0x4cdd42,_0x2dc05a){var _0x2e785f={},_0x1334c8={},_0x224eb3={'count':0x0,'rows':[]};var _0x4fbb92=_['map'](db[_0xaa41('0x34')][_0xaa41('0x35')],function(_0x951e52){return{'name':_0x951e52[_0xaa41('0x36')],'type':_0x951e52[_0xaa41('0x37')][_0xaa41('0x38')]};});_0x1334c8[_0xaa41('0x39')]=_['map'](_0x4fbb92,_0xaa41('0x33'));_0x1334c8[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x4cdd42[_0xaa41('0x3a')]);_0x1334c8['filters']=_['intersection'](_0x1334c8[_0xaa41('0x39')],_0x1334c8[_0xaa41('0x3a')]);_0x2e785f['attributes']=_[_0xaa41('0x3c')](_0x1334c8['model'],qs[_0xaa41('0x3d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x3d')]));_0x2e785f[_0xaa41('0x3e')]=_0x2e785f[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0x2e785f[_0xaa41('0x3e')]:_0x1334c8[_0xaa41('0x39')];if(!_0x4cdd42['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0x2e785f[_0xaa41('0x2d')]=qs[_0xaa41('0x2d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0x2e785f['offset']=qs['offset'](_0x4cdd42[_0xaa41('0x3a')]['offset']);}_0x2e785f[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x43')]);_0x2e785f[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x4cdd42['query'],_0x1334c8[_0xaa41('0x45')]),_0x4fbb92);if(_0x4cdd42['query']['filter']){_0x2e785f[_0xaa41('0x44')]=_['merge'](_0x2e785f['where'],{'$or':_['map'](_0x4fbb92,function(_0x3bad48){if(_0x3bad48['type']!==_0xaa41('0x47')){var _0x198716={};_0x198716[_0x3bad48['name']]={'$like':'%'+_0x4cdd42['query'][_0xaa41('0x48')]+'%'};return _0x198716;}})});}_0x2e785f=_[_0xaa41('0x49')]({},_0x2e785f,_0x4cdd42[_0xaa41('0x4a')]);var _0x2af8ba={'where':_0x2e785f[_0xaa41('0x44')]};return db[_0xaa41('0x34')][_0xaa41('0x2b')](_0x2af8ba)[_0xaa41('0x1e')](function(_0x2fa6ec){_0x224eb3['count']=_0x2fa6ec;if(_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x2e785f[_0xaa41('0x4c')]=[{'all':!![]}];}return db[_0xaa41('0x34')][_0xaa41('0x4d')](_0x2e785f);})[_0xaa41('0x1e')](function(_0x538b12){_0x224eb3[_0xaa41('0x4e')]=_0x538b12;return _0x224eb3;})[_0xaa41('0x1e')](respondWithFilteredResult(_0x2dc05a,_0x2e785f))[_0xaa41('0x27')](handleError(_0x2dc05a,null));};exports[_0xaa41('0x4f')]=function(_0x57d1f6,_0x23bc61){var _0x5787f3={'raw':![],'where':{'id':_0x57d1f6[_0xaa41('0x50')]['id']}},_0x49fedd={};_0x49fedd[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db['FreshdeskAccount'][_0xaa41('0x35')]);_0x49fedd[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x57d1f6['query']);_0x49fedd[_0xaa41('0x45')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],_0x49fedd[_0xaa41('0x3a')]);_0x5787f3[_0xaa41('0x3e')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],qs[_0xaa41('0x3d')](_0x57d1f6['query'][_0xaa41('0x3d')]));_0x5787f3['attributes']=_0x5787f3['attributes'][_0xaa41('0x3f')]?_0x5787f3[_0xaa41('0x3e')]:_0x49fedd[_0xaa41('0x39')];if(_0x57d1f6[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x5787f3[_0xaa41('0x4c')]=[{'all':!![]}];}_0x5787f3=_[_0xaa41('0x49')]({},_0x5787f3,_0x57d1f6[_0xaa41('0x4a')]);return db['FreshdeskAccount'][_0xaa41('0x51')](_0x5787f3)[_0xaa41('0x1e')](handleEntityNotFound(_0x23bc61,null))[_0xaa41('0x1e')](respondWithResult(_0x23bc61,null))['catch'](handleError(_0x23bc61,null));};exports[_0xaa41('0x52')]=function(_0x35f664,_0x4cf674){return db[_0xaa41('0x34')][_0xaa41('0x52')](_0x35f664[_0xaa41('0x53')],{})['then'](respondWithResult(_0x4cf674,0xc9))[_0xaa41('0x27')](handleError(_0x4cf674,null));};exports[_0xaa41('0x30')]=function(_0x4e3b13,_0x49789a){if(_0x4e3b13[_0xaa41('0x53')]['id']){delete _0x4e3b13[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')]['find']({'where':{'id':_0x4e3b13[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x49789a,null))[_0xaa41('0x1e')](saveUpdates(_0x4e3b13[_0xaa41('0x53')],null))[_0xaa41('0x1e')](respondWithResult(_0x49789a,null))['catch'](handleError(_0x49789a,null));};exports[_0xaa41('0x31')]=function(_0x57cb70,_0x555186){return db[_0xaa41('0x34')]['find']({'where':{'id':_0x57cb70[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x555186,null))[_0xaa41('0x1e')](removeEntity(_0x555186,null))['catch'](handleError(_0x555186,null));};exports[_0xaa41('0x54')]=function(_0x41c7f4,_0x36154e,_0x857bbc){var _0xa1f9f9={};var _0x332a3c={};var _0xc56018;var _0x337059;return db[_0xaa41('0x34')]['findOne']({'where':{'id':_0x41c7f4[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x36154e,null))[_0xaa41('0x1e')](function(_0x5a5a55){if(_0x5a5a55){_0xc56018=_0x5a5a55;_0x332a3c[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db[_0xaa41('0x55')][_0xaa41('0x35')]);_0x332a3c[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x41c7f4[_0xaa41('0x3a')]);_0x332a3c['filters']=_['intersection'](_0x332a3c['model'],_0x332a3c['query']);_0xa1f9f9['attributes']=_['intersection'](_0x332a3c[_0xaa41('0x39')],qs['fields'](_0x41c7f4['query'][_0xaa41('0x3d')]));_0xa1f9f9[_0xaa41('0x3e')]=_0xa1f9f9[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0xa1f9f9['attributes']:_0x332a3c[_0xaa41('0x39')];_0xa1f9f9[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x43')]);_0xa1f9f9[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x41c7f4[_0xaa41('0x3a')],_0x332a3c['filters']));if(_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]){_0xa1f9f9['where']=_['merge'](_0xa1f9f9['where'],{'$or':_[_0xaa41('0x56')](_0xa1f9f9['attributes'],function(_0x1eac4a){var _0x5c8028={};_0x5c8028[_0x1eac4a]={'$like':'%'+_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]+'%'};return _0x5c8028;})});}_0xa1f9f9=_['merge']({},_0xa1f9f9,_0x41c7f4[_0xaa41('0x4a')]);return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})[_0xaa41('0x1e')](function(_0x33f5c2){if(_0x33f5c2){_0x337059=_0x33f5c2['length'];if(!_0x41c7f4['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0xa1f9f9['limit']=qs['limit'](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0xa1f9f9[_0xaa41('0x2c')]=qs[_0xaa41('0x2c')](_0x41c7f4[_0xaa41('0x3a')]['offset']);}return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})['then'](function(_0x5062db){if(_0x5062db){return _0x5062db?{'count':_0x337059,'rows':_0x5062db}:null;}})['then'](respondWithResult(_0x36154e,null))[_0xaa41('0x27')](handleError(_0x36154e,null));};exports[_0xaa41('0x57')]=function(_0x436362,_0x5bad74,_0x229297){if(_0x436362[_0xaa41('0x53')]['id']){delete _0x436362[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x436362[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x5bad74,null))['then'](function(_0x1d2978){if(_0x1d2978){_0x436362[_0xaa41('0x53')][_0xaa41('0x59')]=_0x1d2978['id'];_0x436362[_0xaa41('0x53')]['Subjects']=integrations[_0xaa41('0x5a')](_0x436362['body'][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')][_0xaa41('0x37')]);_0x436362[_0xaa41('0x53')]['Descriptions']=integrations[_0xaa41('0x5c')](_0x436362[_0xaa41('0x53')][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')]['type']);return db[_0xaa41('0x55')]['create'](_0x436362[_0xaa41('0x53')],{'include':[{'model':db[_0xaa41('0x5d')],'as':'Subjects'},{'model':db[_0xaa41('0x5d')],'as':_0xaa41('0x5e')}]});}return null;})[_0xaa41('0x1e')](respondWithResult(_0x5bad74,null))[_0xaa41('0x27')](handleError(_0x5bad74,null));};exports[_0xaa41('0x5f')]=function(_0x1338d3,_0x384aba,_0x297ec6){var _0x33b5f4='';return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x1338d3['params']['id']},'attributes':['id',_0xaa41('0x60'),_0xaa41('0x61')]})[_0xaa41('0x1e')](handleEntityNotFound(_0x384aba,null))['then'](function(_0x5ec19b){if(_0x5ec19b){_0x33b5f4=_0x5ec19b[_0xaa41('0x60')];var _0x39da69=_0x33b5f4['slice'](-0x1);if(_0x39da69==='/'){_0x33b5f4=_0x33b5f4[_0xaa41('0x62')](0x0,_0x33b5f4[_0xaa41('0x63')](_0x39da69));}return rp({'method':'GET','uri':util[_0xaa41('0x64')](_0xaa41('0x65'),_0x33b5f4,_0xaa41('0x66')),'headers':{'Authorization':util[_0xaa41('0x64')](_0xaa41('0x67'),new Buffer(util[_0xaa41('0x64')](_0xaa41('0x68'),_0x5ec19b[_0xaa41('0x61')]))['toString']('base64'))},'json':!![]});}})[_0xaa41('0x1e')](function(_0x481db9){if(_0x481db9){var _0x654594=[_0xaa41('0x69'),_0xaa41('0x6a'),'agent',_0xaa41('0x6b'),_0xaa41('0x29'),_0xaa41('0x6c'),'group',_0xaa41('0x6d'),_0xaa41('0x6e'),'group',_0xaa41('0x6f')];_['remove'](_0x481db9,function(_0x53faf4){return _0x654594[_0xaa41('0x70')](_0x53faf4[_0xaa41('0x33')])||!_0x53faf4['default']&&_0x53faf4['type']!==_0xaa41('0x71')&&_0x53faf4[_0xaa41('0x37')]!==_0xaa41('0x72');});return{'count':_0x481db9[_0xaa41('0x3f')],'rows':_['map'](_0x481db9,function(_0x9741a8){return{'id':_0x9741a8[_0xaa41('0x33')],'name':_0x9741a8[_0xaa41('0x73')],'custom':!_0x9741a8['default'],'options':_0x9741a8[_0xaa41('0x74')]?_[_0xaa41('0x56')](_0x9741a8[_0xaa41('0x74')],function(_0x5697b6){return{'name':_[_0xaa41('0x75')](_0x5697b6),'value':_0x5697b6};}):[]};})};}})['then'](respondWithResult(_0x384aba,null))['catch'](function(_0x364d24){var _0x25c4d0=_0x1338d3['query'][_0xaa41('0x76')]?0x1f4:_0x364d24[_0xaa41('0x77')]||0x1f4;logger[_0xaa41('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa41('0x5f'),_0x25c4d0,JSON[_0xaa41('0x23')](_0x364d24));delete _0x364d24[_0xaa41('0x33')];if(_0x25c4d0===0x191){_0x25c4d0=0x190;}_0x384aba[_0xaa41('0x29')](_0x25c4d0)[_0xaa41('0x78')](_0x1338d3['query'][_0xaa41('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x364d24[_0xaa41('0x77')]}:_0x364d24);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f9f773b..fbed279 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 _0xb951=['define','int_freshdesk_accounts','lodash','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xb951,0x17c));var _0x1b95=function(_0x57a1c9,_0xff0f89){_0x57a1c9=_0x57a1c9-0x0;var _0x3156c9=_0xb951[_0x57a1c9];return _0x3156c9;};'use strict';var _=require(_0x1b95('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1b95('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b95('0x2'));var fs=require('fs');var path=require(_0x1b95('0x3'));var rimraf=require(_0x1b95('0x4'));var config=require(_0x1b95('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1b95('0x6')]=function(_0xcb1612,_0x52d77b){return _0xcb1612[_0x1b95('0x7')]('FreshdeskAccount',attributes,{'tableName':_0x1b95('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59b1=['../../config/environment','../../components/integrations/configuration','FreshdeskAccount','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x16418d,_0x20e494){var _0x5f41f1=function(_0x43e9f6){while(--_0x43e9f6){_0x16418d['push'](_0x16418d['shift']());}};_0x5f41f1(++_0x20e494);}(_0x59b1,0x9c));var _0x159b=function(_0x8b3954,_0x5d2bdf){_0x8b3954=_0x8b3954-0x0;var _0x4dac97=_0x59b1[_0x8b3954];return _0x4dac97;};'use strict';var _=require(_0x159b('0x0'));var util=require(_0x159b('0x1'));var logger=require(_0x159b('0x2'))('api');var moment=require(_0x159b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x159b('0x4'));var rimraf=require(_0x159b('0x5'));var config=require(_0x159b('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x159b('0x7'));module['exports']=function(_0x63a42c,_0x4305f9){return _0x63a42c['define'](_0x159b('0x8'),attributes,{'tableName':'int_freshdesk_accounts','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 089a824..a1c1429 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 _0x2641=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','map','attributes','model','raw','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x201b7b,_0x166c79){var _0x5c2011=function(_0x35437e){while(--_0x35437e){_0x201b7b['push'](_0x201b7b['shift']());}};_0x5c2011(++_0x166c79);}(_0x2641,0xd7));var _0x1264=function(_0xaf60d2,_0x56cd4b){_0xaf60d2=_0xaf60d2-0x0;var _0x1d6cc5=_0x2641[_0xaf60d2];return _0x1d6cc5;};'use strict';var _=require(_0x1264('0x0'));var util=require(_0x1264('0x1'));var moment=require(_0x1264('0x2'));var BPromise=require(_0x1264('0x3'));var rs=require(_0x1264('0x4'));var fs=require('fs');var Redis=require(_0x1264('0x5'));var db=require(_0x1264('0x6'))['db'];var utils=require(_0x1264('0x7'));var logger=require(_0x1264('0x8'))(_0x1264('0x9'));var config=require(_0x1264('0xa'));var jayson=require(_0x1264('0xb'));var client=jayson[_0x1264('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e26c8,_0x539eb8,_0x558845){return new BPromise(function(_0x585b1a,_0x139b7a){return client[_0x1264('0xd')](_0x5e26c8,_0x558845)[_0x1264('0xe')](function(_0x5a0e6d){logger[_0x1264('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x539eb8,_0x1264('0x10'));logger[_0x1264('0x11')](_0x1264('0x12'),_0x539eb8,'request\x20sent',JSON[_0x1264('0x13')](_0x5a0e6d));if(_0x5a0e6d[_0x1264('0x14')]){if(_0x5a0e6d['error']['code']===0x1f4){logger[_0x1264('0x14')](_0x1264('0x15'),_0x539eb8,_0x5a0e6d[_0x1264('0x14')][_0x1264('0x16')]);return _0x139b7a(_0x5a0e6d['error'][_0x1264('0x16')]);}logger[_0x1264('0x14')](_0x1264('0x15'),_0x539eb8,_0x5a0e6d['error'][_0x1264('0x16')]);return _0x585b1a(_0x5a0e6d['error']['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x539eb8,'request\x20sent');_0x585b1a(_0x5a0e6d[_0x1264('0x17')][_0x1264('0x16')]);}})[_0x1264('0x18')](function(_0x34544e){logger[_0x1264('0x14')](_0x1264('0x15'),_0x539eb8,_0x34544e);_0x139b7a(_0x34544e);});});}exports[_0x1264('0x19')]=function(_0x43bfc0){var _0x2cca3e=this;return new Promise(function(_0x365820,_0x3a7121){return db[_0x1264('0x1a')][_0x1264('0x1b')]({'raw':_0x43bfc0['options']?_0x43bfc0[_0x1264('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x43bfc0[_0x1264('0x1c')]?_0x43bfc0[_0x1264('0x1c')][_0x1264('0x1d')]||null:null,'attributes':_0x43bfc0[_0x1264('0x1c')]?_0x43bfc0['options']['attributes']||null:null,'limit':_0x43bfc0['options']?_0x43bfc0['options'][_0x1264('0x1e')]||null:null,'include':_0x43bfc0[_0x1264('0x1c')]?_0x43bfc0[_0x1264('0x1c')][_0x1264('0x1f')]?_[_0x1264('0x20')](_0x43bfc0[_0x1264('0x1c')][_0x1264('0x1f')],function(_0x366944){return{'model':db[_0x366944['model']],'as':_0x366944['as'],'attributes':_0x366944[_0x1264('0x21')],'include':_0x366944[_0x1264('0x1f')]?_[_0x1264('0x20')](_0x366944[_0x1264('0x1f')],function(_0x58c839){return{'model':db[_0x58c839[_0x1264('0x22')]],'as':_0x58c839['as'],'attributes':_0x58c839['attributes'],'include':_0x58c839[_0x1264('0x1f')]?_[_0x1264('0x20')](_0x58c839['include'],function(_0x2c8333){return{'model':db[_0x2c8333['model']],'as':_0x2c8333['as'],'attributes':_0x2c8333['attributes']};}):[]};}):[]};}):[]:[]})[_0x1264('0xe')](function(_0xa2b826){logger['info'](_0x1264('0x19'),_0x43bfc0);logger[_0x1264('0x11')]('GetFreshdeskAccount',_0x43bfc0,JSON[_0x1264('0x13')](_0xa2b826));_0x365820(_0xa2b826);})[_0x1264('0x18')](function(_0x1b690e){logger['error'](_0x1264('0x19'),_0x1b690e[_0x1264('0x16')],_0x43bfc0);_0x3a7121(_0x2cca3e[_0x1264('0x14')](0x1f4,_0x1b690e[_0x1264('0x16')]));});});};exports['ShowFreshdeskAccount']=function(_0x36725d){var _0x570cfd=this;return new Promise(function(_0x3ef1c3,_0x3afdf4){return db['FreshdeskAccount']['find']({'raw':_0x36725d[_0x1264('0x1c')]?_0x36725d['options'][_0x1264('0x23')]===undefined?!![]:![]:!![],'where':_0x36725d['options']?_0x36725d['options'][_0x1264('0x1d')]||null:null,'attributes':_0x36725d['options']?_0x36725d[_0x1264('0x1c')][_0x1264('0x21')]||null:null,'include':_0x36725d[_0x1264('0x1c')]?_0x36725d[_0x1264('0x1c')][_0x1264('0x1f')]?_[_0x1264('0x20')](_0x36725d[_0x1264('0x1c')][_0x1264('0x1f')],function(_0x529ee0){return{'model':db[_0x529ee0[_0x1264('0x22')]],'as':_0x529ee0['as'],'attributes':_0x529ee0[_0x1264('0x21')],'include':_0x529ee0[_0x1264('0x1f')]?_[_0x1264('0x20')](_0x529ee0['include'],function(_0x34057d){return{'model':db[_0x34057d['model']],'as':_0x34057d['as'],'attributes':_0x34057d['attributes'],'include':_0x34057d[_0x1264('0x1f')]?_[_0x1264('0x20')](_0x34057d[_0x1264('0x1f')],function(_0x49658e){return{'model':db[_0x49658e[_0x1264('0x22')]],'as':_0x49658e['as'],'attributes':_0x49658e[_0x1264('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2167d6){logger['info'](_0x1264('0x24'),_0x36725d);logger[_0x1264('0x11')](_0x1264('0x24'),_0x36725d,JSON[_0x1264('0x13')](_0x2167d6));_0x3ef1c3(_0x2167d6);})['catch'](function(_0x1cd8e4){logger[_0x1264('0x14')]('ShowFreshdeskAccount',_0x1cd8e4['message'],_0x36725d);_0x3afdf4(_0x570cfd['error'](0x1f4,_0x1cd8e4[_0x1264('0x16')]));});});}; \ No newline at end of file +var _0xf8d0=['moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','options','where','attributes','limit','map','include','model','catch','find','raw','then','ShowFreshdeskAccount','lodash'];(function(_0x14c260,_0x1849ae){var _0x20901d=function(_0x1e2a1f){while(--_0x1e2a1f){_0x14c260['push'](_0x14c260['shift']());}};_0x20901d(++_0x1849ae);}(_0xf8d0,0x1ee));var _0x0f8d=function(_0xffc356,_0x113150){_0xffc356=_0xffc356-0x0;var _0x5e7f25=_0xf8d0[_0xffc356];return _0x5e7f25;};'use strict';var _=require(_0x0f8d('0x0'));var util=require('util');var moment=require(_0x0f8d('0x1'));var BPromise=require(_0x0f8d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f8d('0x3'))('rpc');var config=require(_0x0f8d('0x4'));var jayson=require(_0x0f8d('0x5'));var client=jayson[_0x0f8d('0x6')][_0x0f8d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2e6cd0,_0x49d37f,_0x443432){return new BPromise(function(_0x36c3a7,_0x37be01){return client[_0x0f8d('0x8')](_0x2e6cd0,_0x443432)['then'](function(_0x16ffa2){logger[_0x0f8d('0x9')](_0x0f8d('0xa'),_0x49d37f,_0x0f8d('0xb'));logger[_0x0f8d('0xc')](_0x0f8d('0xd'),_0x49d37f,_0x0f8d('0xb'),JSON[_0x0f8d('0xe')](_0x16ffa2));if(_0x16ffa2[_0x0f8d('0xf')]){if(_0x16ffa2[_0x0f8d('0xf')][_0x0f8d('0x10')]===0x1f4){logger['error'](_0x0f8d('0xa'),_0x49d37f,_0x16ffa2[_0x0f8d('0xf')][_0x0f8d('0x11')]);return _0x37be01(_0x16ffa2[_0x0f8d('0xf')][_0x0f8d('0x11')]);}logger['error'](_0x0f8d('0xa'),_0x49d37f,_0x16ffa2[_0x0f8d('0xf')][_0x0f8d('0x11')]);return _0x36c3a7(_0x16ffa2[_0x0f8d('0xf')][_0x0f8d('0x11')]);}else{logger[_0x0f8d('0x9')]('FreshdeskAccount,\x20%s,\x20%s',_0x49d37f,'request\x20sent');_0x36c3a7(_0x16ffa2[_0x0f8d('0x12')][_0x0f8d('0x11')]);}})['catch'](function(_0x49315c){logger[_0x0f8d('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x49d37f,_0x49315c);_0x37be01(_0x49315c);});});}exports[_0x0f8d('0x13')]=function(_0x979df0){var _0x29b419=this;return new Promise(function(_0x179c9a,_0x444318){return db[_0x0f8d('0x14')]['findAll']({'raw':_0x979df0[_0x0f8d('0x15')]?_0x979df0[_0x0f8d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x979df0[_0x0f8d('0x15')]?_0x979df0['options'][_0x0f8d('0x16')]||null:null,'attributes':_0x979df0[_0x0f8d('0x15')]?_0x979df0['options'][_0x0f8d('0x17')]||null:null,'limit':_0x979df0[_0x0f8d('0x15')]?_0x979df0['options'][_0x0f8d('0x18')]||null:null,'include':_0x979df0['options']?_0x979df0[_0x0f8d('0x15')]['include']?_[_0x0f8d('0x19')](_0x979df0['options'][_0x0f8d('0x1a')],function(_0x5f146e){return{'model':db[_0x5f146e[_0x0f8d('0x1b')]],'as':_0x5f146e['as'],'attributes':_0x5f146e[_0x0f8d('0x17')],'include':_0x5f146e[_0x0f8d('0x1a')]?_[_0x0f8d('0x19')](_0x5f146e[_0x0f8d('0x1a')],function(_0x354573){return{'model':db[_0x354573[_0x0f8d('0x1b')]],'as':_0x354573['as'],'attributes':_0x354573['attributes'],'include':_0x354573[_0x0f8d('0x1a')]?_[_0x0f8d('0x19')](_0x354573['include'],function(_0x331a7a){return{'model':db[_0x331a7a[_0x0f8d('0x1b')]],'as':_0x331a7a['as'],'attributes':_0x331a7a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd7fd4f){logger[_0x0f8d('0x9')](_0x0f8d('0x13'),_0x979df0);logger[_0x0f8d('0xc')]('GetFreshdeskAccount',_0x979df0,JSON['stringify'](_0xd7fd4f));_0x179c9a(_0xd7fd4f);})[_0x0f8d('0x1c')](function(_0x4bc6a4){logger['error'](_0x0f8d('0x13'),_0x4bc6a4[_0x0f8d('0x11')],_0x979df0);_0x444318(_0x29b419[_0x0f8d('0xf')](0x1f4,_0x4bc6a4['message']));});});};exports['ShowFreshdeskAccount']=function(_0x34341c){var _0x21cb08=this;return new Promise(function(_0x5b53eb,_0x14233b){return db[_0x0f8d('0x14')][_0x0f8d('0x1d')]({'raw':_0x34341c['options']?_0x34341c[_0x0f8d('0x15')][_0x0f8d('0x1e')]===undefined?!![]:![]:!![],'where':_0x34341c[_0x0f8d('0x15')]?_0x34341c[_0x0f8d('0x15')][_0x0f8d('0x16')]||null:null,'attributes':_0x34341c[_0x0f8d('0x15')]?_0x34341c[_0x0f8d('0x15')][_0x0f8d('0x17')]||null:null,'include':_0x34341c[_0x0f8d('0x15')]?_0x34341c[_0x0f8d('0x15')][_0x0f8d('0x1a')]?_[_0x0f8d('0x19')](_0x34341c[_0x0f8d('0x15')][_0x0f8d('0x1a')],function(_0x1d4901){return{'model':db[_0x1d4901[_0x0f8d('0x1b')]],'as':_0x1d4901['as'],'attributes':_0x1d4901[_0x0f8d('0x17')],'include':_0x1d4901[_0x0f8d('0x1a')]?_[_0x0f8d('0x19')](_0x1d4901['include'],function(_0x4858e7){return{'model':db[_0x4858e7[_0x0f8d('0x1b')]],'as':_0x4858e7['as'],'attributes':_0x4858e7[_0x0f8d('0x17')],'include':_0x4858e7['include']?_[_0x0f8d('0x19')](_0x4858e7[_0x0f8d('0x1a')],function(_0x118157){return{'model':db[_0x118157['model']],'as':_0x118157['as'],'attributes':_0x118157['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f8d('0x1f')](function(_0x4eca37){logger[_0x0f8d('0x9')]('ShowFreshdeskAccount',_0x34341c);logger['debug'](_0x0f8d('0x20'),_0x34341c,JSON[_0x0f8d('0xe')](_0x4eca37));_0x5b53eb(_0x4eca37);})['catch'](function(_0xb6da89){logger['error']('ShowFreshdeskAccount',_0xb6da89[_0x0f8d('0x11')],_0x34341c);_0x14233b(_0x21cb08[_0x0f8d('0xf')](0x1f4,_0xb6da89[_0x0f8d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ca53b9e..bb36d04 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 _0xec33=['update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','/:id/tags'];(function(_0x208589,_0x4ae466){var _0x13e8a7=function(_0x54fedb){while(--_0x54fedb){_0x208589['push'](_0x208589['shift']());}};_0x13e8a7(++_0x4ae466);}(_0xec33,0x1e6));var _0x3ec3=function(_0x3caca6,_0x21a8b7){_0x3caca6=_0x3caca6-0x0;var _0x17bc7d=_0xec33[_0x3caca6];return _0x17bc7d;};'use strict';var multer=require(_0x3ec3('0x0'));var util=require(_0x3ec3('0x1'));var path=require('path');var timeout=require(_0x3ec3('0x2'));var express=require(_0x3ec3('0x3'));var router=express['Router']();var auth=require(_0x3ec3('0x4'));var interaction=require(_0x3ec3('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x3ec3('0x6')]('/',auth[_0x3ec3('0x7')](),controller[_0x3ec3('0x8')]);router[_0x3ec3('0x6')](_0x3ec3('0x9'),auth[_0x3ec3('0x7')](),controller[_0x3ec3('0xa')]);router[_0x3ec3('0x6')](_0x3ec3('0xb'),auth[_0x3ec3('0x7')](),controller[_0x3ec3('0xc')]);router[_0x3ec3('0x6')](_0x3ec3('0xd'),auth[_0x3ec3('0x7')](),controller[_0x3ec3('0xe')]);router[_0x3ec3('0x6')](_0x3ec3('0xf'),auth[_0x3ec3('0x7')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x3ec3('0x7')](),controller[_0x3ec3('0x10')]);router[_0x3ec3('0x11')]('/',auth[_0x3ec3('0x7')](),controller[_0x3ec3('0x12')]);router['post'](_0x3ec3('0x13'),auth[_0x3ec3('0x7')](),controller['setTags']);router['put']('/:id',auth[_0x3ec3('0x7')](),controller[_0x3ec3('0x14')]);router['delete']('/:id',auth[_0x3ec3('0x7')](),controller['destroy']);module[_0x3ec3('0x15')]=router; \ No newline at end of file +var _0x3b16=['get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','/:id/tags','post','create','setTags','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x3b16,0x1ac));var _0x63b1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3b16[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x63b1('0x0'));var util=require(_0x63b1('0x1'));var path=require(_0x63b1('0x2'));var timeout=require(_0x63b1('0x3'));var express=require(_0x63b1('0x4'));var router=express[_0x63b1('0x5')]();var auth=require(_0x63b1('0x6'));var interaction=require(_0x63b1('0x7'));var config=require('../../config/environment');var controller=require(_0x63b1('0x8'));router[_0x63b1('0x9')]('/',auth[_0x63b1('0xa')](),controller[_0x63b1('0xb')]);router['get'](_0x63b1('0xc'),auth['isAuthenticated'](),controller[_0x63b1('0xd')]);router[_0x63b1('0x9')]('/:id/fields',auth[_0x63b1('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x63b1('0xa')](),controller[_0x63b1('0xe')]);router[_0x63b1('0x9')]('/:id/descriptions',auth[_0x63b1('0xa')](),controller[_0x63b1('0xf')]);router[_0x63b1('0x9')](_0x63b1('0x10'),auth[_0x63b1('0xa')](),controller['getTags']);router[_0x63b1('0x11')]('/',auth['isAuthenticated'](),controller[_0x63b1('0x12')]);router[_0x63b1('0x11')]('/:id/tags',auth[_0x63b1('0xa')](),controller[_0x63b1('0x13')]);router['put']('/:id',auth[_0x63b1('0xa')](),controller[_0x63b1('0x14')]);router[_0x63b1('0x15')](_0x63b1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x63b1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 37d8bfb..200a242 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 _0x0ab8=['exports','STRING','sequelize'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0ab8,0x12e));var _0x80ab=function(_0x1cd565,_0x2b8b58){_0x1cd565=_0x1cd565-0x0;var _0x2a838c=_0x0ab8[_0x1cd565];return _0x2a838c;};'use strict';var Sequelize=require(_0x80ab('0x0'));module[_0x80ab('0x1')]={'name':{'type':Sequelize[_0x80ab('0x2')]},'description':{'type':Sequelize[_0x80ab('0x2')]}}; \ No newline at end of file +var _0xec24=['sequelize','STRING'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0xec24,0x8e));var _0x4ec2=function(_0x3650e0,_0xda0f52){_0x3650e0=_0x3650e0-0x0;var _0x6841fb=_0xec24[_0x3650e0];return _0x6841fb;};'use strict';var Sequelize=require(_0x4ec2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4ec2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 6566c2b..58ae647 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 _0x15ff=['include','show','params','rawAttributes','create','body','find','getFields','findOne','FreshdeskField','order','filter','getSubjects','getDescriptions','pick','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','end','count','offset','status','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','options','includeAll'];(function(_0x5a0751,_0xaebaaf){var _0x2d7663=function(_0x51845f){while(--_0x51845f){_0x5a0751['push'](_0x5a0751['shift']());}};_0x2d7663(++_0xaebaaf);}(_0x15ff,0x74));var _0xf15f=function(_0xcd5ff6,_0xafb336){_0xcd5ff6=_0xcd5ff6-0x0;var _0x55f6b1=_0x15ff[_0xcd5ff6];return _0x55f6b1;};'use strict';var pdf=require(_0xf15f('0x0'));var emlformat=require(_0xf15f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf15f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf15f('0x3'));var moment=require(_0xf15f('0x4'));var BPromise=require(_0xf15f('0x5'));var Mustache=require(_0xf15f('0x6'));var util=require(_0xf15f('0x7'));var path=require(_0xf15f('0x8'));var sox=require('sox');var csv=require(_0xf15f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf15f('0xa'));var squel=require(_0xf15f('0xb'));var crypto=require(_0xf15f('0xc'));var jsforce=require(_0xf15f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf15f('0x9'));var querystring=require(_0xf15f('0xe'));var Papa=require(_0xf15f('0xf'));var Redis=require('ioredis');var authService=require(_0xf15f('0x10'));var qs=require(_0xf15f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15f('0x12'));var logger=require(_0xf15f('0x13'))(_0xf15f('0x14'));var utils=require(_0xf15f('0x15'));var config=require(_0xf15f('0x16'));var db=require(_0xf15f('0x17'))['db'];var jayson=require(_0xf15f('0x18'));var client=jayson[_0xf15f('0x19')][_0xf15f('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x35767b,_0x3b5ea8,_0x3e47c5){if(_0x3e47c5){var _0x135111=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x135111[_0xf15f('0x1b')](_0x3b5ea8)){return _0x35767b;}else{throw new db[(_0xf15f('0x1c'))][(_0xf15f('0x1d'))](_0xf15f('0x1e'));}}else{return _0x35767b;}}function respondWithRpcPromise(_0x855fd4,_0x37cb43,_0x5331ff,_0x5f4479){return new BPromise(function(_0x34dd78,_0x3eb071){var _0x4b6eb8=_0x5f4479||client;return _0x4b6eb8['request'](_0x855fd4,_0x5331ff)[_0xf15f('0x1f')](function(_0x54c173){logger[_0xf15f('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x37cb43,_0xf15f('0x21'));logger[_0xf15f('0x22')](_0xf15f('0x23'),_0x37cb43,_0xf15f('0x21'),JSON[_0xf15f('0x24')](_0x54c173));if(_0x54c173[_0xf15f('0x25')]){if(_0x54c173[_0xf15f('0x25')]['code']===0x1f4){logger['error'](_0xf15f('0x26'),_0x37cb43,_0x54c173[_0xf15f('0x25')][_0xf15f('0x27')]);return _0x3eb071(_0x54c173[_0xf15f('0x25')][_0xf15f('0x27')]);}logger[_0xf15f('0x25')](_0xf15f('0x26'),_0x37cb43,_0x54c173['error'][_0xf15f('0x27')]);return _0x34dd78(_0x54c173[_0xf15f('0x25')][_0xf15f('0x27')]);}else{logger[_0xf15f('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x37cb43,_0xf15f('0x21'));_0x34dd78(_0x54c173[_0xf15f('0x28')]['message']);}})[_0xf15f('0x29')](function(_0x1cb871){logger[_0xf15f('0x25')](_0xf15f('0x26'),_0x37cb43,_0x1cb871);_0x3eb071(_0x1cb871);});});}function respondWithStatusCode(_0xe060d0,_0x506cd6){_0x506cd6=_0x506cd6||0xcc;return function(_0x5201b6){if(_0x5201b6){return _0xe060d0['sendStatus'](_0x506cd6);}return _0xe060d0['status'](_0x506cd6)[_0xf15f('0x2a')]();};}function respondWithResult(_0x34021d,_0x2dbee1){_0x2dbee1=_0x2dbee1||0xc8;return function(_0x24b92d){if(_0x24b92d){return _0x34021d['status'](_0x2dbee1)['json'](_0x24b92d);}};}function respondWithFilteredResult(_0x36c6ee,_0x22d065){return function(_0x46136e){if(_0x46136e){var _0x1b7dd6=_0x46136e[_0xf15f('0x2b')],_0x1bd85d=_0x22d065[_0xf15f('0x2c')],_0x20b41b=_0x22d065['offset']+_0x22d065['limit'],_0x3bd730;if(_0x20b41b>=_0x1b7dd6){_0x20b41b=_0x1b7dd6;_0x3bd730=0xc8;}else{_0x3bd730=0xce;}_0x36c6ee[_0xf15f('0x2d')](_0x3bd730);return _0x36c6ee['set'](_0xf15f('0x2e'),_0x1bd85d+'-'+_0x20b41b+'/'+_0x1b7dd6)['json'](_0x46136e);}return null;};}function patchUpdates(_0x3123ec){return function(_0x6a658c){try{jsonpatch[_0xf15f('0x2f')](_0x6a658c,_0x3123ec,!![]);}catch(_0x152492){return BPromise[_0xf15f('0x30')](_0x152492);}return _0x6a658c[_0xf15f('0x31')]();};}function saveUpdates(_0x971bc6,_0x45b73d){return function(_0x26d863){if(_0x26d863){return _0x26d863[_0xf15f('0x32')](_0x971bc6)[_0xf15f('0x1f')](function(_0x2bcc43){return _0x2bcc43;});}return null;};}function removeEntity(_0x50e182,_0x5a6c6e){return function(_0x580245){if(_0x580245){return _0x580245[_0xf15f('0x33')]()[_0xf15f('0x1f')](function(){_0x50e182['status'](0xcc)[_0xf15f('0x2a')]();});}};}function handleEntityNotFound(_0x2c3366,_0x219ab7){return function(_0xd58a1f){if(!_0xd58a1f){_0x2c3366[_0xf15f('0x34')](0x194);}return _0xd58a1f;};}function handleError(_0x1bc0f1,_0x16a384){_0x16a384=_0x16a384||0x1f4;return function(_0x183fc8){logger[_0xf15f('0x25')](_0x183fc8[_0xf15f('0x35')]);if(_0x183fc8[_0xf15f('0x36')]){delete _0x183fc8[_0xf15f('0x36')];}_0x1bc0f1[_0xf15f('0x2d')](_0x16a384)[_0xf15f('0x37')](_0x183fc8);};}exports[_0xf15f('0x38')]=function(_0xcb5d06,_0xc7894e){var _0x32ad55={},_0x557e94={},_0x4847de={'count':0x0,'rows':[]};var _0x5952b1=_[_0xf15f('0x39')](db[_0xf15f('0x3a')]['rawAttributes'],function(_0x1b4074){return{'name':_0x1b4074['fieldName'],'type':_0x1b4074[_0xf15f('0x3b')][_0xf15f('0x3c')]};});_0x557e94[_0xf15f('0x3d')]=_[_0xf15f('0x39')](_0x5952b1,_0xf15f('0x36'));_0x557e94[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0xcb5d06[_0xf15f('0x3e')]);_0x557e94[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x557e94[_0xf15f('0x3d')],_0x557e94[_0xf15f('0x3e')]);_0x32ad55[_0xf15f('0x42')]=_[_0xf15f('0x41')](_0x557e94[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0xcb5d06[_0xf15f('0x3e')]['fields']));_0x32ad55[_0xf15f('0x42')]=_0x32ad55[_0xf15f('0x42')][_0xf15f('0x44')]?_0x32ad55[_0xf15f('0x42')]:_0x557e94[_0xf15f('0x3d')];if(!_0xcb5d06[_0xf15f('0x3e')][_0xf15f('0x45')](_0xf15f('0x46'))){_0x32ad55[_0xf15f('0x47')]=qs[_0xf15f('0x47')](_0xcb5d06[_0xf15f('0x3e')][_0xf15f('0x47')]);_0x32ad55[_0xf15f('0x2c')]=qs[_0xf15f('0x2c')](_0xcb5d06['query'][_0xf15f('0x2c')]);}_0x32ad55['order']=qs[_0xf15f('0x48')](_0xcb5d06[_0xf15f('0x3e')][_0xf15f('0x48')]);_0x32ad55[_0xf15f('0x49')]=qs[_0xf15f('0x40')](_['pick'](_0xcb5d06['query'],_0x557e94['filters']),_0x5952b1);if(_0xcb5d06[_0xf15f('0x3e')]['filter']){_0x32ad55[_0xf15f('0x49')]=_[_0xf15f('0x4a')](_0x32ad55['where'],{'$or':_[_0xf15f('0x39')](_0x5952b1,function(_0x352ce9){if(_0x352ce9[_0xf15f('0x3b')]!==_0xf15f('0x4b')){var _0x1eec10={};_0x1eec10[_0x352ce9[_0xf15f('0x36')]]={'$like':'%'+_0xcb5d06[_0xf15f('0x3e')]['filter']+'%'};return _0x1eec10;}})});}_0x32ad55=_[_0xf15f('0x4a')]({},_0x32ad55,_0xcb5d06[_0xf15f('0x4c')]);var _0x58a21d={'where':_0x32ad55[_0xf15f('0x49')]};return db['FreshdeskConfiguration']['count'](_0x58a21d)[_0xf15f('0x1f')](function(_0x5a3c98){_0x4847de['count']=_0x5a3c98;if(_0xcb5d06[_0xf15f('0x3e')][_0xf15f('0x4d')]){_0x32ad55[_0xf15f('0x4e')]=[{'all':!![]}];}return db[_0xf15f('0x3a')]['findAll'](_0x32ad55);})[_0xf15f('0x1f')](function(_0x2a2c16){_0x4847de['rows']=_0x2a2c16;return _0x4847de;})[_0xf15f('0x1f')](respondWithFilteredResult(_0xc7894e,_0x32ad55))['catch'](handleError(_0xc7894e,null));};exports[_0xf15f('0x4f')]=function(_0x3aa0be,_0x2150bf){var _0x684d95={'raw':![],'where':{'id':_0x3aa0be[_0xf15f('0x50')]['id']}},_0x295ec1={};_0x295ec1[_0xf15f('0x3d')]=_[_0xf15f('0x3f')](db[_0xf15f('0x3a')][_0xf15f('0x51')]);_0x295ec1[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x3aa0be[_0xf15f('0x3e')]);_0x295ec1[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x295ec1['model'],_0x295ec1['query']);_0x684d95['attributes']=_[_0xf15f('0x41')](_0x295ec1[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0x3aa0be[_0xf15f('0x3e')][_0xf15f('0x43')]));_0x684d95['attributes']=_0x684d95[_0xf15f('0x42')]['length']?_0x684d95[_0xf15f('0x42')]:_0x295ec1['model'];if(_0x3aa0be['query'][_0xf15f('0x4d')]){_0x684d95['include']=[{'all':!![]}];}_0x684d95=_[_0xf15f('0x4a')]({},_0x684d95,_0x3aa0be['options']);return db['FreshdeskConfiguration']['find'](_0x684d95)[_0xf15f('0x1f')](handleEntityNotFound(_0x2150bf,null))[_0xf15f('0x1f')](respondWithResult(_0x2150bf,null))[_0xf15f('0x29')](handleError(_0x2150bf,null));};exports[_0xf15f('0x52')]=function(_0x5a259c,_0x38720d){return db[_0xf15f('0x3a')][_0xf15f('0x52')](_0x5a259c[_0xf15f('0x53')],{})[_0xf15f('0x1f')](respondWithResult(_0x38720d,0xc9))['catch'](handleError(_0x38720d,null));};exports[_0xf15f('0x32')]=function(_0x17f802,_0x5c9815){if(_0x17f802[_0xf15f('0x53')]['id']){delete _0x17f802[_0xf15f('0x53')]['id'];}return db['FreshdeskConfiguration'][_0xf15f('0x54')]({'where':{'id':_0x17f802['params']['id']}})['then'](handleEntityNotFound(_0x5c9815,null))[_0xf15f('0x1f')](saveUpdates(_0x17f802[_0xf15f('0x53')],null))[_0xf15f('0x1f')](respondWithResult(_0x5c9815,null))['catch'](handleError(_0x5c9815,null));};exports['destroy']=function(_0x5eb3f2,_0x2a13ee){return db[_0xf15f('0x3a')][_0xf15f('0x54')]({'where':{'id':_0x5eb3f2[_0xf15f('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a13ee,null))[_0xf15f('0x1f')](removeEntity(_0x2a13ee,null))[_0xf15f('0x29')](handleError(_0x2a13ee,null));};exports[_0xf15f('0x55')]=function(_0x3b4c54,_0x39c424,_0x57fa58){var _0x1418f9={};var _0x31e3eb={};var _0x499550;var _0x561c53;return db[_0xf15f('0x3a')][_0xf15f('0x56')]({'where':{'id':_0x3b4c54[_0xf15f('0x50')]['id']}})['then'](handleEntityNotFound(_0x39c424,null))[_0xf15f('0x1f')](function(_0x4fc144){if(_0x4fc144){_0x499550=_0x4fc144;_0x31e3eb['model']=_[_0xf15f('0x3f')](db[_0xf15f('0x57')][_0xf15f('0x51')]);_0x31e3eb[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x3b4c54[_0xf15f('0x3e')]);_0x31e3eb[_0xf15f('0x40')]=_['intersection'](_0x31e3eb['model'],_0x31e3eb[_0xf15f('0x3e')]);_0x1418f9[_0xf15f('0x42')]=_[_0xf15f('0x41')](_0x31e3eb[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x43')]));_0x1418f9[_0xf15f('0x42')]=_0x1418f9[_0xf15f('0x42')][_0xf15f('0x44')]?_0x1418f9['attributes']:_0x31e3eb[_0xf15f('0x3d')];_0x1418f9[_0xf15f('0x58')]=qs[_0xf15f('0x48')](_0x3b4c54[_0xf15f('0x3e')]['sort']);_0x1418f9[_0xf15f('0x49')]=qs['filters'](_['pick'](_0x3b4c54[_0xf15f('0x3e')],_0x31e3eb['filters']));if(_0x3b4c54['query'][_0xf15f('0x59')]){_0x1418f9[_0xf15f('0x49')]=_[_0xf15f('0x4a')](_0x1418f9[_0xf15f('0x49')],{'$or':_[_0xf15f('0x39')](_0x1418f9['attributes'],function(_0x18b182){var _0x1b0793={};_0x1b0793[_0x18b182]={'$like':'%'+_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x59')]+'%'};return _0x1b0793;})});}_0x1418f9=_[_0xf15f('0x4a')]({},_0x1418f9,_0x3b4c54[_0xf15f('0x4c')]);return _0x499550[_0xf15f('0x55')](_0x1418f9);}})[_0xf15f('0x1f')](function(_0x5ec013){if(_0x5ec013){_0x561c53=_0x5ec013[_0xf15f('0x44')];if(!_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x45')](_0xf15f('0x46'))){_0x1418f9[_0xf15f('0x47')]=qs[_0xf15f('0x47')](_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x47')]);_0x1418f9[_0xf15f('0x2c')]=qs['offset'](_0x3b4c54[_0xf15f('0x3e')][_0xf15f('0x2c')]);}return _0x499550['getFields'](_0x1418f9);}})[_0xf15f('0x1f')](function(_0x335b6e){if(_0x335b6e){return _0x335b6e?{'count':_0x561c53,'rows':_0x335b6e}:null;}})[_0xf15f('0x1f')](respondWithResult(_0x39c424,null))['catch'](handleError(_0x39c424,null));};exports[_0xf15f('0x5a')]=function(_0x116d6c,_0x2f59e6,_0x12f08a){var _0x7eda08={};var _0x2030c0={};var _0x2bbdfb;var _0x4b0c77;return db[_0xf15f('0x3a')]['findOne']({'where':{'id':_0x116d6c[_0xf15f('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f59e6,null))['then'](function(_0x5c0233){if(_0x5c0233){_0x2bbdfb=_0x5c0233;_0x2030c0[_0xf15f('0x3d')]=_[_0xf15f('0x3f')](db[_0xf15f('0x57')]['rawAttributes']);_0x2030c0[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x116d6c['query']);_0x2030c0[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x2030c0[_0xf15f('0x3d')],_0x2030c0[_0xf15f('0x3e')]);_0x7eda08[_0xf15f('0x42')]=_['intersection'](_0x2030c0[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0x116d6c[_0xf15f('0x3e')][_0xf15f('0x43')]));_0x7eda08[_0xf15f('0x42')]=_0x7eda08[_0xf15f('0x42')][_0xf15f('0x44')]?_0x7eda08[_0xf15f('0x42')]:_0x2030c0[_0xf15f('0x3d')];_0x7eda08['order']=qs[_0xf15f('0x48')](_0x116d6c['query'][_0xf15f('0x48')]);_0x7eda08[_0xf15f('0x49')]=qs[_0xf15f('0x40')](_['pick'](_0x116d6c['query'],_0x2030c0[_0xf15f('0x40')]));if(_0x116d6c[_0xf15f('0x3e')]['filter']){_0x7eda08[_0xf15f('0x49')]=_[_0xf15f('0x4a')](_0x7eda08[_0xf15f('0x49')],{'$or':_[_0xf15f('0x39')](_0x7eda08['attributes'],function(_0x26a8a6){var _0x5b2a07={};_0x5b2a07[_0x26a8a6]={'$like':'%'+_0x116d6c[_0xf15f('0x3e')][_0xf15f('0x59')]+'%'};return _0x5b2a07;})});}_0x7eda08=_[_0xf15f('0x4a')]({},_0x7eda08,_0x116d6c[_0xf15f('0x4c')]);return _0x2bbdfb[_0xf15f('0x5a')](_0x7eda08);}})['then'](function(_0x35657f){if(_0x35657f){_0x4b0c77=_0x35657f['length'];if(!_0x116d6c[_0xf15f('0x3e')]['hasOwnProperty'](_0xf15f('0x46'))){_0x7eda08[_0xf15f('0x47')]=qs[_0xf15f('0x47')](_0x116d6c[_0xf15f('0x3e')][_0xf15f('0x47')]);_0x7eda08[_0xf15f('0x2c')]=qs[_0xf15f('0x2c')](_0x116d6c[_0xf15f('0x3e')][_0xf15f('0x2c')]);}return _0x2bbdfb[_0xf15f('0x5a')](_0x7eda08);}})['then'](function(_0x3092ef){if(_0x3092ef){return _0x3092ef?{'count':_0x4b0c77,'rows':_0x3092ef}:null;}})['then'](respondWithResult(_0x2f59e6,null))['catch'](handleError(_0x2f59e6,null));};exports[_0xf15f('0x5b')]=function(_0x6541e5,_0x2d5082,_0xe031aa){var _0x12a724={};var _0x353334={};var _0x1656d7;var _0x4f8793;return db['FreshdeskConfiguration'][_0xf15f('0x56')]({'where':{'id':_0x6541e5[_0xf15f('0x50')]['id']}})[_0xf15f('0x1f')](handleEntityNotFound(_0x2d5082,null))['then'](function(_0x2e877b){if(_0x2e877b){_0x1656d7=_0x2e877b;_0x353334[_0xf15f('0x3d')]=_['keys'](db[_0xf15f('0x57')][_0xf15f('0x51')]);_0x353334[_0xf15f('0x3e')]=_[_0xf15f('0x3f')](_0x6541e5[_0xf15f('0x3e')]);_0x353334[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x353334['model'],_0x353334[_0xf15f('0x3e')]);_0x12a724[_0xf15f('0x42')]=_['intersection'](_0x353334['model'],qs['fields'](_0x6541e5[_0xf15f('0x3e')][_0xf15f('0x43')]));_0x12a724[_0xf15f('0x42')]=_0x12a724[_0xf15f('0x42')]['length']?_0x12a724[_0xf15f('0x42')]:_0x353334[_0xf15f('0x3d')];_0x12a724[_0xf15f('0x58')]=qs[_0xf15f('0x48')](_0x6541e5[_0xf15f('0x3e')]['sort']);_0x12a724[_0xf15f('0x49')]=qs['filters'](_[_0xf15f('0x5c')](_0x6541e5[_0xf15f('0x3e')],_0x353334[_0xf15f('0x40')]));if(_0x6541e5[_0xf15f('0x3e')][_0xf15f('0x59')]){_0x12a724['where']=_['merge'](_0x12a724[_0xf15f('0x49')],{'$or':_[_0xf15f('0x39')](_0x12a724[_0xf15f('0x42')],function(_0x2de89d){var _0x3f390a={};_0x3f390a[_0x2de89d]={'$like':'%'+_0x6541e5[_0xf15f('0x3e')][_0xf15f('0x59')]+'%'};return _0x3f390a;})});}_0x12a724=_['merge']({},_0x12a724,_0x6541e5['options']);return _0x1656d7[_0xf15f('0x5b')](_0x12a724);}})[_0xf15f('0x1f')](function(_0x4da982){if(_0x4da982){_0x4f8793=_0x4da982['length'];if(!_0x6541e5[_0xf15f('0x3e')][_0xf15f('0x45')](_0xf15f('0x46'))){_0x12a724['limit']=qs['limit'](_0x6541e5[_0xf15f('0x3e')]['limit']);_0x12a724['offset']=qs[_0xf15f('0x2c')](_0x6541e5['query'][_0xf15f('0x2c')]);}return _0x1656d7[_0xf15f('0x5b')](_0x12a724);}})[_0xf15f('0x1f')](function(_0x347189){if(_0x347189){return _0x347189?{'count':_0x4f8793,'rows':_0x347189}:null;}})[_0xf15f('0x1f')](respondWithResult(_0x2d5082,null))[_0xf15f('0x29')](handleError(_0x2d5082,null));};exports[_0xf15f('0x5d')]=function(_0x512c7b,_0x3c965e,_0x25ba9c){var _0x31e8ad={};var _0x2e5443={};var _0x1b885b;var _0x36fb1f;return db[_0xf15f('0x3a')][_0xf15f('0x56')]({'where':{'id':_0x512c7b[_0xf15f('0x50')]['id']}})[_0xf15f('0x1f')](handleEntityNotFound(_0x3c965e,null))[_0xf15f('0x1f')](function(_0x25779e){if(_0x25779e){_0x1b885b=_0x25779e;_0x2e5443[_0xf15f('0x3d')]=_[_0xf15f('0x3f')](db[_0xf15f('0x5e')][_0xf15f('0x51')]);_0x2e5443['query']=_[_0xf15f('0x3f')](_0x512c7b[_0xf15f('0x3e')]);_0x2e5443[_0xf15f('0x40')]=_[_0xf15f('0x41')](_0x2e5443[_0xf15f('0x3d')],_0x2e5443[_0xf15f('0x3e')]);_0x31e8ad['attributes']=_[_0xf15f('0x41')](_0x2e5443[_0xf15f('0x3d')],qs[_0xf15f('0x43')](_0x512c7b['query'][_0xf15f('0x43')]));_0x31e8ad[_0xf15f('0x42')]=_0x31e8ad[_0xf15f('0x42')][_0xf15f('0x44')]?_0x31e8ad[_0xf15f('0x42')]:_0x2e5443[_0xf15f('0x3d')];_0x31e8ad[_0xf15f('0x58')]=qs[_0xf15f('0x48')](_0x512c7b[_0xf15f('0x3e')]['sort']);_0x31e8ad['where']=qs[_0xf15f('0x40')](_[_0xf15f('0x5c')](_0x512c7b[_0xf15f('0x3e')],_0x2e5443['filters']));if(_0x512c7b[_0xf15f('0x3e')][_0xf15f('0x59')]){_0x31e8ad[_0xf15f('0x49')]=_[_0xf15f('0x4a')](_0x31e8ad[_0xf15f('0x49')],{'$or':_[_0xf15f('0x39')](_0x31e8ad['attributes'],function(_0x17ea07){var _0x16f104={};_0x16f104[_0x17ea07]={'$like':'%'+_0x512c7b[_0xf15f('0x3e')][_0xf15f('0x59')]+'%'};return _0x16f104;})});}_0x31e8ad=_[_0xf15f('0x4a')]({},_0x31e8ad,_0x512c7b[_0xf15f('0x4c')]);return _0x1b885b[_0xf15f('0x5d')](_0x31e8ad);}})[_0xf15f('0x1f')](function(_0x5cc9fc){if(_0x5cc9fc){_0x36fb1f=_0x5cc9fc[_0xf15f('0x44')];if(!_0x512c7b[_0xf15f('0x3e')][_0xf15f('0x45')](_0xf15f('0x46'))){_0x31e8ad[_0xf15f('0x47')]=qs['limit'](_0x512c7b[_0xf15f('0x3e')][_0xf15f('0x47')]);_0x31e8ad['offset']=qs['offset'](_0x512c7b['query']['offset']);}return _0x1b885b[_0xf15f('0x5d')](_0x31e8ad);}})[_0xf15f('0x1f')](function(_0x17e6c3){if(_0x17e6c3){return _0x17e6c3?{'count':_0x36fb1f,'rows':_0x17e6c3}:null;}})[_0xf15f('0x1f')](respondWithResult(_0x3c965e,null))[_0xf15f('0x29')](handleError(_0x3c965e,null));};exports[_0xf15f('0x5f')]=function(_0x5ebd9c,_0x1c39e0,_0x530139){if(_0x5ebd9c['body']['id']){delete _0x5ebd9c['body']['id'];}return db['FreshdeskConfiguration'][_0xf15f('0x56')]({'where':{'id':_0x5ebd9c[_0xf15f('0x50')]['id']}})[_0xf15f('0x1f')](handleEntityNotFound(_0x1c39e0,null))[_0xf15f('0x1f')](function(_0x430cd6){if(_0x430cd6){return _0x430cd6['setTags'](_0x5ebd9c[_0xf15f('0x53')][_0xf15f('0x60')]||[]);}return null;})[_0xf15f('0x1f')](respondWithResult(_0x1c39e0,null))[_0xf15f('0x29')](handleError(_0x1c39e0,null));}; \ No newline at end of file +var _0xcba7=['rows','show','fields','include','body','find','params','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','then','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll'];(function(_0x21aafd,_0x1f0fa6){var _0x9f2800=function(_0xf23734){while(--_0xf23734){_0x21aafd['push'](_0x21aafd['shift']());}};_0x9f2800(++_0x1f0fa6);}(_0xcba7,0x199));var _0x7cba=function(_0x15e749,_0x3f70d0){_0x15e749=_0x15e749-0x0;var _0xf62575=_0xcba7[_0x15e749];return _0xf62575;};'use strict';var pdf=require(_0x7cba('0x0'));var emlformat=require(_0x7cba('0x1'));var rimraf=require(_0x7cba('0x2'));var zipdir=require(_0x7cba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cba('0x4'));var moment=require(_0x7cba('0x5'));var BPromise=require(_0x7cba('0x6'));var Mustache=require('mustache');var util=require(_0x7cba('0x7'));var path=require(_0x7cba('0x8'));var sox=require(_0x7cba('0x9'));var csv=require(_0x7cba('0xa'));var ejs=require(_0x7cba('0xb'));var fs=require('fs');var _=require(_0x7cba('0xc'));var squel=require(_0x7cba('0xd'));var crypto=require(_0x7cba('0xe'));var jsforce=require(_0x7cba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7cba('0xa'));var querystring=require(_0x7cba('0x10'));var Papa=require(_0x7cba('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7cba('0x12'));var as=require(_0x7cba('0x13'));var hardwareService=require(_0x7cba('0x14'));var logger=require(_0x7cba('0x15'))('api');var utils=require(_0x7cba('0x16'));var config=require(_0x7cba('0x17'));var db=require(_0x7cba('0x18'))['db'];var jayson=require(_0x7cba('0x19'));var client=jayson[_0x7cba('0x1a')][_0x7cba('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x522529,_0x3ed673,_0x2647b9){if(_0x2647b9){var _0x406553=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x406553[_0x7cba('0x1c')](_0x3ed673)){return _0x522529;}else{throw new db[(_0x7cba('0x1d'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x522529;}}function respondWithRpcPromise(_0x252005,_0xbf5ce8,_0x39585b,_0x2b52a4){return new BPromise(function(_0x38b935,_0x28dfd1){var _0x384768=_0x2b52a4||client;return _0x384768[_0x7cba('0x1e')](_0x252005,_0x39585b)[_0x7cba('0x1f')](function(_0x39761b){logger['info'](_0x7cba('0x20'),_0xbf5ce8,'request\x20sent');logger['debug'](_0x7cba('0x21'),_0xbf5ce8,_0x7cba('0x22'),JSON[_0x7cba('0x23')](_0x39761b));if(_0x39761b['error']){if(_0x39761b[_0x7cba('0x24')]['code']===0x1f4){logger[_0x7cba('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xbf5ce8,_0x39761b['error'][_0x7cba('0x25')]);return _0x28dfd1(_0x39761b[_0x7cba('0x24')][_0x7cba('0x25')]);}logger[_0x7cba('0x24')](_0x7cba('0x20'),_0xbf5ce8,_0x39761b['error'][_0x7cba('0x25')]);return _0x38b935(_0x39761b['error'][_0x7cba('0x25')]);}else{logger[_0x7cba('0x26')](_0x7cba('0x20'),_0xbf5ce8,_0x7cba('0x22'));_0x38b935(_0x39761b[_0x7cba('0x27')][_0x7cba('0x25')]);}})[_0x7cba('0x28')](function(_0x4a6883){logger[_0x7cba('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xbf5ce8,_0x4a6883);_0x28dfd1(_0x4a6883);});});}function respondWithStatusCode(_0x4e5974,_0x1c9535){_0x1c9535=_0x1c9535||0xcc;return function(_0x5391e6){if(_0x5391e6){return _0x4e5974[_0x7cba('0x29')](_0x1c9535);}return _0x4e5974[_0x7cba('0x2a')](_0x1c9535)[_0x7cba('0x2b')]();};}function respondWithResult(_0x109dfa,_0x1cb91a){_0x1cb91a=_0x1cb91a||0xc8;return function(_0x539bb1){if(_0x539bb1){return _0x109dfa[_0x7cba('0x2a')](_0x1cb91a)['json'](_0x539bb1);}};}function respondWithFilteredResult(_0x5d9ce3,_0xd9b2af){return function(_0x1f8065){if(_0x1f8065){var _0x34a121=_0x1f8065[_0x7cba('0x2c')],_0x336dcb=_0xd9b2af[_0x7cba('0x2d')],_0x2f4f15=_0xd9b2af[_0x7cba('0x2d')]+_0xd9b2af['limit'],_0x213f3a;if(_0x2f4f15>=_0x34a121){_0x2f4f15=_0x34a121;_0x213f3a=0xc8;}else{_0x213f3a=0xce;}_0x5d9ce3[_0x7cba('0x2a')](_0x213f3a);return _0x5d9ce3['set'](_0x7cba('0x2e'),_0x336dcb+'-'+_0x2f4f15+'/'+_0x34a121)[_0x7cba('0x2f')](_0x1f8065);}return null;};}function patchUpdates(_0x34b9e6){return function(_0x16bab3){try{jsonpatch[_0x7cba('0x30')](_0x16bab3,_0x34b9e6,!![]);}catch(_0xdcfb3f){return BPromise[_0x7cba('0x31')](_0xdcfb3f);}return _0x16bab3[_0x7cba('0x32')]();};}function saveUpdates(_0x4e9e93,_0x27837b){return function(_0x5da550){if(_0x5da550){return _0x5da550[_0x7cba('0x33')](_0x4e9e93)[_0x7cba('0x1f')](function(_0x3d29d1){return _0x3d29d1;});}return null;};}function removeEntity(_0x1863d0,_0x11d6a0){return function(_0x41661f){if(_0x41661f){return _0x41661f['destroy']()['then'](function(){_0x1863d0[_0x7cba('0x2a')](0xcc)[_0x7cba('0x2b')]();});}};}function handleEntityNotFound(_0x73614f,_0x51061b){return function(_0x58b1ba){if(!_0x58b1ba){_0x73614f[_0x7cba('0x29')](0x194);}return _0x58b1ba;};}function handleError(_0x49651b,_0x3a2844){_0x3a2844=_0x3a2844||0x1f4;return function(_0x179331){logger[_0x7cba('0x24')](_0x179331[_0x7cba('0x34')]);if(_0x179331[_0x7cba('0x35')]){delete _0x179331['name'];}_0x49651b[_0x7cba('0x2a')](_0x3a2844)[_0x7cba('0x36')](_0x179331);};}exports[_0x7cba('0x37')]=function(_0x540b9a,_0x4c91af){var _0x1dc306={},_0x5c4558={},_0x202c55={'count':0x0,'rows':[]};var _0x2861c6=_['map'](db[_0x7cba('0x38')][_0x7cba('0x39')],function(_0x3e6f99){return{'name':_0x3e6f99[_0x7cba('0x3a')],'type':_0x3e6f99[_0x7cba('0x3b')][_0x7cba('0x3c')]};});_0x5c4558[_0x7cba('0x3d')]=_[_0x7cba('0x3e')](_0x2861c6,'name');_0x5c4558[_0x7cba('0x3f')]=_[_0x7cba('0x40')](_0x540b9a[_0x7cba('0x3f')]);_0x5c4558[_0x7cba('0x41')]=_[_0x7cba('0x42')](_0x5c4558[_0x7cba('0x3d')],_0x5c4558[_0x7cba('0x3f')]);_0x1dc306[_0x7cba('0x43')]=_[_0x7cba('0x42')](_0x5c4558['model'],qs['fields'](_0x540b9a['query']['fields']));_0x1dc306['attributes']=_0x1dc306[_0x7cba('0x43')][_0x7cba('0x44')]?_0x1dc306[_0x7cba('0x43')]:_0x5c4558['model'];if(!_0x540b9a['query'][_0x7cba('0x45')](_0x7cba('0x46'))){_0x1dc306['limit']=qs[_0x7cba('0x47')](_0x540b9a[_0x7cba('0x3f')][_0x7cba('0x47')]);_0x1dc306[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x540b9a['query'][_0x7cba('0x2d')]);}_0x1dc306[_0x7cba('0x48')]=qs[_0x7cba('0x49')](_0x540b9a[_0x7cba('0x3f')]['sort']);_0x1dc306[_0x7cba('0x4a')]=qs['filters'](_[_0x7cba('0x4b')](_0x540b9a[_0x7cba('0x3f')],_0x5c4558[_0x7cba('0x41')]),_0x2861c6);if(_0x540b9a[_0x7cba('0x3f')][_0x7cba('0x4c')]){_0x1dc306[_0x7cba('0x4a')]=_[_0x7cba('0x4d')](_0x1dc306['where'],{'$or':_['map'](_0x2861c6,function(_0x1d81a1){if(_0x1d81a1['type']!=='VIRTUAL'){var _0x35f5e6={};_0x35f5e6[_0x1d81a1[_0x7cba('0x35')]]={'$like':'%'+_0x540b9a[_0x7cba('0x3f')][_0x7cba('0x4c')]+'%'};return _0x35f5e6;}})});}_0x1dc306=_[_0x7cba('0x4d')]({},_0x1dc306,_0x540b9a[_0x7cba('0x4e')]);var _0x2c4f72={'where':_0x1dc306[_0x7cba('0x4a')]};return db[_0x7cba('0x38')][_0x7cba('0x2c')](_0x2c4f72)[_0x7cba('0x1f')](function(_0x4c3f7c){_0x202c55['count']=_0x4c3f7c;if(_0x540b9a['query'][_0x7cba('0x4f')]){_0x1dc306['include']=[{'all':!![]}];}return db[_0x7cba('0x38')][_0x7cba('0x50')](_0x1dc306);})[_0x7cba('0x1f')](function(_0x2545dd){_0x202c55[_0x7cba('0x51')]=_0x2545dd;return _0x202c55;})['then'](respondWithFilteredResult(_0x4c91af,_0x1dc306))[_0x7cba('0x28')](handleError(_0x4c91af,null));};exports[_0x7cba('0x52')]=function(_0x5b077f,_0x6e8ab7){var _0x42d1b0={'raw':![],'where':{'id':_0x5b077f['params']['id']}},_0x5fc3d8={};_0x5fc3d8['model']=_[_0x7cba('0x40')](db[_0x7cba('0x38')][_0x7cba('0x39')]);_0x5fc3d8[_0x7cba('0x3f')]=_['keys'](_0x5b077f[_0x7cba('0x3f')]);_0x5fc3d8[_0x7cba('0x41')]=_[_0x7cba('0x42')](_0x5fc3d8[_0x7cba('0x3d')],_0x5fc3d8[_0x7cba('0x3f')]);_0x42d1b0['attributes']=_[_0x7cba('0x42')](_0x5fc3d8['model'],qs[_0x7cba('0x53')](_0x5b077f[_0x7cba('0x3f')][_0x7cba('0x53')]));_0x42d1b0['attributes']=_0x42d1b0[_0x7cba('0x43')][_0x7cba('0x44')]?_0x42d1b0[_0x7cba('0x43')]:_0x5fc3d8['model'];if(_0x5b077f[_0x7cba('0x3f')][_0x7cba('0x4f')]){_0x42d1b0[_0x7cba('0x54')]=[{'all':!![]}];}_0x42d1b0=_['merge']({},_0x42d1b0,_0x5b077f[_0x7cba('0x4e')]);return db['FreshdeskConfiguration']['find'](_0x42d1b0)[_0x7cba('0x1f')](handleEntityNotFound(_0x6e8ab7,null))[_0x7cba('0x1f')](respondWithResult(_0x6e8ab7,null))[_0x7cba('0x28')](handleError(_0x6e8ab7,null));};exports['create']=function(_0x23f2a0,_0x1d84f3){return db[_0x7cba('0x38')]['create'](_0x23f2a0['body'],{})['then'](respondWithResult(_0x1d84f3,0xc9))[_0x7cba('0x28')](handleError(_0x1d84f3,null));};exports[_0x7cba('0x33')]=function(_0x4c3045,_0x5a7099){if(_0x4c3045[_0x7cba('0x55')]['id']){delete _0x4c3045[_0x7cba('0x55')]['id'];}return db['FreshdeskConfiguration'][_0x7cba('0x56')]({'where':{'id':_0x4c3045[_0x7cba('0x57')]['id']}})[_0x7cba('0x1f')](handleEntityNotFound(_0x5a7099,null))[_0x7cba('0x1f')](saveUpdates(_0x4c3045[_0x7cba('0x55')],null))[_0x7cba('0x1f')](respondWithResult(_0x5a7099,null))[_0x7cba('0x28')](handleError(_0x5a7099,null));};exports[_0x7cba('0x58')]=function(_0x274982,_0x2c1e2f){return db[_0x7cba('0x38')]['find']({'where':{'id':_0x274982[_0x7cba('0x57')]['id']}})[_0x7cba('0x1f')](handleEntityNotFound(_0x2c1e2f,null))['then'](removeEntity(_0x2c1e2f,null))[_0x7cba('0x28')](handleError(_0x2c1e2f,null));};exports[_0x7cba('0x59')]=function(_0x2b7704,_0x5ce153,_0x1b13a9){var _0x5b1af3={};var _0x323a3d={};var _0x4c7726;var _0x3d21a2;return db[_0x7cba('0x38')][_0x7cba('0x5a')]({'where':{'id':_0x2b7704[_0x7cba('0x57')]['id']}})[_0x7cba('0x1f')](handleEntityNotFound(_0x5ce153,null))[_0x7cba('0x1f')](function(_0x15ffaf){if(_0x15ffaf){_0x4c7726=_0x15ffaf;_0x323a3d['model']=_[_0x7cba('0x40')](db[_0x7cba('0x5b')][_0x7cba('0x39')]);_0x323a3d[_0x7cba('0x3f')]=_[_0x7cba('0x40')](_0x2b7704['query']);_0x323a3d['filters']=_[_0x7cba('0x42')](_0x323a3d[_0x7cba('0x3d')],_0x323a3d[_0x7cba('0x3f')]);_0x5b1af3[_0x7cba('0x43')]=_[_0x7cba('0x42')](_0x323a3d[_0x7cba('0x3d')],qs[_0x7cba('0x53')](_0x2b7704[_0x7cba('0x3f')][_0x7cba('0x53')]));_0x5b1af3[_0x7cba('0x43')]=_0x5b1af3[_0x7cba('0x43')][_0x7cba('0x44')]?_0x5b1af3[_0x7cba('0x43')]:_0x323a3d[_0x7cba('0x3d')];_0x5b1af3[_0x7cba('0x48')]=qs[_0x7cba('0x49')](_0x2b7704[_0x7cba('0x3f')][_0x7cba('0x49')]);_0x5b1af3['where']=qs[_0x7cba('0x41')](_[_0x7cba('0x4b')](_0x2b7704['query'],_0x323a3d[_0x7cba('0x41')]));if(_0x2b7704[_0x7cba('0x3f')][_0x7cba('0x4c')]){_0x5b1af3[_0x7cba('0x4a')]=_['merge'](_0x5b1af3[_0x7cba('0x4a')],{'$or':_[_0x7cba('0x3e')](_0x5b1af3[_0x7cba('0x43')],function(_0x2649f6){var _0x30fac5={};_0x30fac5[_0x2649f6]={'$like':'%'+_0x2b7704[_0x7cba('0x3f')]['filter']+'%'};return _0x30fac5;})});}_0x5b1af3=_[_0x7cba('0x4d')]({},_0x5b1af3,_0x2b7704[_0x7cba('0x4e')]);return _0x4c7726[_0x7cba('0x59')](_0x5b1af3);}})[_0x7cba('0x1f')](function(_0x339146){if(_0x339146){_0x3d21a2=_0x339146[_0x7cba('0x44')];if(!_0x2b7704[_0x7cba('0x3f')][_0x7cba('0x45')](_0x7cba('0x46'))){_0x5b1af3[_0x7cba('0x47')]=qs[_0x7cba('0x47')](_0x2b7704[_0x7cba('0x3f')][_0x7cba('0x47')]);_0x5b1af3[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x2b7704[_0x7cba('0x3f')][_0x7cba('0x2d')]);}return _0x4c7726[_0x7cba('0x59')](_0x5b1af3);}})['then'](function(_0x24cac9){if(_0x24cac9){return _0x24cac9?{'count':_0x3d21a2,'rows':_0x24cac9}:null;}})[_0x7cba('0x1f')](respondWithResult(_0x5ce153,null))[_0x7cba('0x28')](handleError(_0x5ce153,null));};exports[_0x7cba('0x5c')]=function(_0x1364d8,_0x10ebab,_0x5201b1){var _0x280cf2={};var _0x2083dd={};var _0x1fa89b;var _0x12b3f7;return db[_0x7cba('0x38')][_0x7cba('0x5a')]({'where':{'id':_0x1364d8['params']['id']}})['then'](handleEntityNotFound(_0x10ebab,null))[_0x7cba('0x1f')](function(_0x6a0b82){if(_0x6a0b82){_0x1fa89b=_0x6a0b82;_0x2083dd[_0x7cba('0x3d')]=_[_0x7cba('0x40')](db[_0x7cba('0x5b')][_0x7cba('0x39')]);_0x2083dd[_0x7cba('0x3f')]=_[_0x7cba('0x40')](_0x1364d8[_0x7cba('0x3f')]);_0x2083dd[_0x7cba('0x41')]=_[_0x7cba('0x42')](_0x2083dd['model'],_0x2083dd['query']);_0x280cf2[_0x7cba('0x43')]=_[_0x7cba('0x42')](_0x2083dd[_0x7cba('0x3d')],qs[_0x7cba('0x53')](_0x1364d8[_0x7cba('0x3f')][_0x7cba('0x53')]));_0x280cf2[_0x7cba('0x43')]=_0x280cf2['attributes'][_0x7cba('0x44')]?_0x280cf2[_0x7cba('0x43')]:_0x2083dd[_0x7cba('0x3d')];_0x280cf2[_0x7cba('0x48')]=qs[_0x7cba('0x49')](_0x1364d8[_0x7cba('0x3f')][_0x7cba('0x49')]);_0x280cf2[_0x7cba('0x4a')]=qs['filters'](_[_0x7cba('0x4b')](_0x1364d8[_0x7cba('0x3f')],_0x2083dd[_0x7cba('0x41')]));if(_0x1364d8[_0x7cba('0x3f')][_0x7cba('0x4c')]){_0x280cf2[_0x7cba('0x4a')]=_[_0x7cba('0x4d')](_0x280cf2[_0x7cba('0x4a')],{'$or':_[_0x7cba('0x3e')](_0x280cf2[_0x7cba('0x43')],function(_0x21599d){var _0x4d6ff5={};_0x4d6ff5[_0x21599d]={'$like':'%'+_0x1364d8[_0x7cba('0x3f')][_0x7cba('0x4c')]+'%'};return _0x4d6ff5;})});}_0x280cf2=_[_0x7cba('0x4d')]({},_0x280cf2,_0x1364d8['options']);return _0x1fa89b[_0x7cba('0x5c')](_0x280cf2);}})[_0x7cba('0x1f')](function(_0x15d3d2){if(_0x15d3d2){_0x12b3f7=_0x15d3d2[_0x7cba('0x44')];if(!_0x1364d8[_0x7cba('0x3f')]['hasOwnProperty'](_0x7cba('0x46'))){_0x280cf2[_0x7cba('0x47')]=qs[_0x7cba('0x47')](_0x1364d8[_0x7cba('0x3f')][_0x7cba('0x47')]);_0x280cf2[_0x7cba('0x2d')]=qs['offset'](_0x1364d8[_0x7cba('0x3f')][_0x7cba('0x2d')]);}return _0x1fa89b['getSubjects'](_0x280cf2);}})[_0x7cba('0x1f')](function(_0x292b6e){if(_0x292b6e){return _0x292b6e?{'count':_0x12b3f7,'rows':_0x292b6e}:null;}})[_0x7cba('0x1f')](respondWithResult(_0x10ebab,null))[_0x7cba('0x28')](handleError(_0x10ebab,null));};exports[_0x7cba('0x5d')]=function(_0x799ef1,_0x53731d,_0x426cb6){var _0x595626={};var _0x5da879={};var _0x349271;var _0x140cf7;return db['FreshdeskConfiguration'][_0x7cba('0x5a')]({'where':{'id':_0x799ef1[_0x7cba('0x57')]['id']}})[_0x7cba('0x1f')](handleEntityNotFound(_0x53731d,null))['then'](function(_0x36bfa3){if(_0x36bfa3){_0x349271=_0x36bfa3;_0x5da879[_0x7cba('0x3d')]=_['keys'](db[_0x7cba('0x5b')]['rawAttributes']);_0x5da879[_0x7cba('0x3f')]=_[_0x7cba('0x40')](_0x799ef1[_0x7cba('0x3f')]);_0x5da879[_0x7cba('0x41')]=_['intersection'](_0x5da879[_0x7cba('0x3d')],_0x5da879[_0x7cba('0x3f')]);_0x595626[_0x7cba('0x43')]=_[_0x7cba('0x42')](_0x5da879[_0x7cba('0x3d')],qs[_0x7cba('0x53')](_0x799ef1[_0x7cba('0x3f')][_0x7cba('0x53')]));_0x595626['attributes']=_0x595626[_0x7cba('0x43')]['length']?_0x595626['attributes']:_0x5da879['model'];_0x595626['order']=qs[_0x7cba('0x49')](_0x799ef1['query'][_0x7cba('0x49')]);_0x595626[_0x7cba('0x4a')]=qs['filters'](_[_0x7cba('0x4b')](_0x799ef1['query'],_0x5da879['filters']));if(_0x799ef1[_0x7cba('0x3f')][_0x7cba('0x4c')]){_0x595626['where']=_['merge'](_0x595626['where'],{'$or':_[_0x7cba('0x3e')](_0x595626[_0x7cba('0x43')],function(_0x113d08){var _0x1d8f7f={};_0x1d8f7f[_0x113d08]={'$like':'%'+_0x799ef1[_0x7cba('0x3f')][_0x7cba('0x4c')]+'%'};return _0x1d8f7f;})});}_0x595626=_[_0x7cba('0x4d')]({},_0x595626,_0x799ef1[_0x7cba('0x4e')]);return _0x349271[_0x7cba('0x5d')](_0x595626);}})[_0x7cba('0x1f')](function(_0x3a2ab3){if(_0x3a2ab3){_0x140cf7=_0x3a2ab3['length'];if(!_0x799ef1[_0x7cba('0x3f')]['hasOwnProperty'](_0x7cba('0x46'))){_0x595626[_0x7cba('0x47')]=qs[_0x7cba('0x47')](_0x799ef1[_0x7cba('0x3f')][_0x7cba('0x47')]);_0x595626[_0x7cba('0x2d')]=qs[_0x7cba('0x2d')](_0x799ef1[_0x7cba('0x3f')][_0x7cba('0x2d')]);}return _0x349271[_0x7cba('0x5d')](_0x595626);}})['then'](function(_0x319fce){if(_0x319fce){return _0x319fce?{'count':_0x140cf7,'rows':_0x319fce}:null;}})[_0x7cba('0x1f')](respondWithResult(_0x53731d,null))[_0x7cba('0x28')](handleError(_0x53731d,null));};exports['getTags']=function(_0x1fc127,_0x3cc85e,_0x222dd6){var _0x5efd80={};var _0x5af8ab={};var _0x3e1cdd;var _0x198683;return db['FreshdeskConfiguration'][_0x7cba('0x5a')]({'where':{'id':_0x1fc127['params']['id']}})[_0x7cba('0x1f')](handleEntityNotFound(_0x3cc85e,null))['then'](function(_0x15fbbf){if(_0x15fbbf){_0x3e1cdd=_0x15fbbf;_0x5af8ab[_0x7cba('0x3d')]=_[_0x7cba('0x40')](db[_0x7cba('0x5e')]['rawAttributes']);_0x5af8ab[_0x7cba('0x3f')]=_[_0x7cba('0x40')](_0x1fc127[_0x7cba('0x3f')]);_0x5af8ab['filters']=_['intersection'](_0x5af8ab['model'],_0x5af8ab[_0x7cba('0x3f')]);_0x5efd80[_0x7cba('0x43')]=_[_0x7cba('0x42')](_0x5af8ab[_0x7cba('0x3d')],qs[_0x7cba('0x53')](_0x1fc127[_0x7cba('0x3f')][_0x7cba('0x53')]));_0x5efd80[_0x7cba('0x43')]=_0x5efd80[_0x7cba('0x43')][_0x7cba('0x44')]?_0x5efd80[_0x7cba('0x43')]:_0x5af8ab[_0x7cba('0x3d')];_0x5efd80[_0x7cba('0x48')]=qs[_0x7cba('0x49')](_0x1fc127[_0x7cba('0x3f')]['sort']);_0x5efd80[_0x7cba('0x4a')]=qs[_0x7cba('0x41')](_[_0x7cba('0x4b')](_0x1fc127[_0x7cba('0x3f')],_0x5af8ab['filters']));if(_0x1fc127[_0x7cba('0x3f')][_0x7cba('0x4c')]){_0x5efd80['where']=_[_0x7cba('0x4d')](_0x5efd80[_0x7cba('0x4a')],{'$or':_[_0x7cba('0x3e')](_0x5efd80[_0x7cba('0x43')],function(_0x2a91b5){var _0x4198d9={};_0x4198d9[_0x2a91b5]={'$like':'%'+_0x1fc127[_0x7cba('0x3f')][_0x7cba('0x4c')]+'%'};return _0x4198d9;})});}_0x5efd80=_['merge']({},_0x5efd80,_0x1fc127[_0x7cba('0x4e')]);return _0x3e1cdd[_0x7cba('0x5f')](_0x5efd80);}})[_0x7cba('0x1f')](function(_0x5243b8){if(_0x5243b8){_0x198683=_0x5243b8[_0x7cba('0x44')];if(!_0x1fc127[_0x7cba('0x3f')][_0x7cba('0x45')](_0x7cba('0x46'))){_0x5efd80[_0x7cba('0x47')]=qs['limit'](_0x1fc127['query'][_0x7cba('0x47')]);_0x5efd80[_0x7cba('0x2d')]=qs['offset'](_0x1fc127[_0x7cba('0x3f')]['offset']);}return _0x3e1cdd[_0x7cba('0x5f')](_0x5efd80);}})[_0x7cba('0x1f')](function(_0x3c5292){if(_0x3c5292){return _0x3c5292?{'count':_0x198683,'rows':_0x3c5292}:null;}})[_0x7cba('0x1f')](respondWithResult(_0x3cc85e,null))[_0x7cba('0x28')](handleError(_0x3cc85e,null));};exports[_0x7cba('0x60')]=function(_0x2fcf0e,_0x4dc337,_0x2ca57f){if(_0x2fcf0e[_0x7cba('0x55')]['id']){delete _0x2fcf0e[_0x7cba('0x55')]['id'];}return db[_0x7cba('0x38')][_0x7cba('0x5a')]({'where':{'id':_0x2fcf0e[_0x7cba('0x57')]['id']}})[_0x7cba('0x1f')](handleEntityNotFound(_0x4dc337,null))['then'](function(_0x5ab972){if(_0x5ab972){return _0x5ab972[_0x7cba('0x60')](_0x2fcf0e[_0x7cba('0x55')][_0x7cba('0x61')]||[]);}return null;})['then'](respondWithResult(_0x4dc337,null))[_0x7cba('0x28')](handleError(_0x4dc337,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f53f6a8..d85e7b3 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 _0x7217=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x319517,_0x411b3c){var _0x57ffcb=function(_0x3c3ec0){while(--_0x3c3ec0){_0x319517['push'](_0x319517['shift']());}};_0x57ffcb(++_0x411b3c);}(_0x53ec,0x192));var _0xc53e=function(_0x25ccbe,_0xc935c0){_0x25ccbe=_0x25ccbe-0x0;var _0x289529=_0x53ec[_0x25ccbe];return _0x289529;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'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 759126c..3ab544d 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 _0xf5d8=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0xf5d8,0xac));var _0x8f5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f5d('0x0'));var util=require(_0x8f5d('0x1'));var moment=require(_0x8f5d('0x2'));var BPromise=require(_0x8f5d('0x3'));var rs=require(_0x8f5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f5d('0x5'))['db'];var utils=require(_0x8f5d('0x6'));var logger=require(_0x8f5d('0x7'))(_0x8f5d('0x8'));var config=require(_0x8f5d('0x9'));var jayson=require(_0x8f5d('0xa'));var client=jayson[_0x8f5d('0xb')][_0x8f5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bc40e,_0x146cd4,_0xa20e9c){return new BPromise(function(_0x2c963b,_0x10b12d){return client['request'](_0x2bc40e,_0xa20e9c)[_0x8f5d('0xd')](function(_0x17a751){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x146cd4,_0x8f5d('0xe'));logger[_0x8f5d('0xf')](_0x8f5d('0x10'),_0x146cd4,_0x8f5d('0xe'),JSON[_0x8f5d('0x11')](_0x17a751));if(_0x17a751[_0x8f5d('0x12')]){if(_0x17a751['error']['code']===0x1f4){logger[_0x8f5d('0x12')](_0x8f5d('0x13'),_0x146cd4,_0x17a751[_0x8f5d('0x12')][_0x8f5d('0x14')]);return _0x10b12d(_0x17a751[_0x8f5d('0x12')][_0x8f5d('0x14')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x146cd4,_0x17a751[_0x8f5d('0x12')][_0x8f5d('0x14')]);return _0x2c963b(_0x17a751[_0x8f5d('0x12')][_0x8f5d('0x14')]);}else{logger[_0x8f5d('0x15')](_0x8f5d('0x13'),_0x146cd4,_0x8f5d('0xe'));_0x2c963b(_0x17a751[_0x8f5d('0x16')]['message']);}})[_0x8f5d('0x17')](function(_0x565f54){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x146cd4,_0x565f54);_0x10b12d(_0x565f54);});});} \ No newline at end of file +var _0x5b5d=['error','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0x5b5d,0x98));var _0xd5b5=function(_0x12237d,_0x58361e){_0x12237d=_0x12237d-0x0;var _0x57643d=_0x5b5d[_0x12237d];return _0x57643d;};'use strict';var _=require(_0xd5b5('0x0'));var util=require(_0xd5b5('0x1'));var moment=require('moment');var BPromise=require(_0xd5b5('0x2'));var rs=require(_0xd5b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5b5('0x4'))['db'];var utils=require(_0xd5b5('0x5'));var logger=require(_0xd5b5('0x6'))(_0xd5b5('0x7'));var config=require(_0xd5b5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd5b5('0x9')][_0xd5b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1078bd,_0xf5b6ab,_0xe65ec2){return new BPromise(function(_0x2b4793,_0x4faae5){return client[_0xd5b5('0xb')](_0x1078bd,_0xe65ec2)['then'](function(_0x1b2e17){logger[_0xd5b5('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xf5b6ab,_0xd5b5('0xd'));logger[_0xd5b5('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xf5b6ab,'request\x20sent',JSON[_0xd5b5('0xf')](_0x1b2e17));if(_0x1b2e17[_0xd5b5('0x10')]){if(_0x1b2e17[_0xd5b5('0x10')]['code']===0x1f4){logger[_0xd5b5('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xf5b6ab,_0x1b2e17[_0xd5b5('0x10')]['message']);return _0x4faae5(_0x1b2e17[_0xd5b5('0x10')][_0xd5b5('0x11')]);}logger[_0xd5b5('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xf5b6ab,_0x1b2e17[_0xd5b5('0x10')][_0xd5b5('0x11')]);return _0x2b4793(_0x1b2e17[_0xd5b5('0x10')][_0xd5b5('0x11')]);}else{logger[_0xd5b5('0xc')](_0xd5b5('0x12'),_0xf5b6ab,_0xd5b5('0xd'));_0x2b4793(_0x1b2e17[_0xd5b5('0x13')][_0xd5b5('0x11')]);}})[_0xd5b5('0x14')](function(_0x412e41){logger[_0xd5b5('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xf5b6ab,_0x412e41);_0x4faae5(_0x412e41);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index e151991..34facf7 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(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x34e8,0x12c));var _0x834e=function(_0x386f29,_0x2753ce){_0x386f29=_0x386f29-0x0;var _0x211c8d=_0x34e8[_0x386f29];return _0x211c8d;};'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 _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0xc6a3a4,_0x40e54f){var _0x2b8e96=function(_0x3082f0){while(--_0x3082f0){_0xc6a3a4['push'](_0xc6a3a4['shift']());}};_0x2b8e96(++_0x40e54f);}(_0x008c,0x188));var _0xc008=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0x008c[_0xd02bb];return _0x1cdf23;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4d2d34b..3b4c598 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 _0x8828=['customVariable','keyValue','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8828,0x1d1));var _0x8882=function(_0x5ba7f2,_0x2bf130){_0x5ba7f2=_0x5ba7f2-0x0;var _0x33d3ee=_0x8828[_0x5ba7f2];return _0x33d3ee;};'use strict';var Sequelize=require(_0x8882('0x0'));module[_0x8882('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8882('0x2'),_0x8882('0x3'),_0x8882('0x4')),'defaultValue':_0x8882('0x5')},'content':{'type':Sequelize[_0x8882('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8882('0x7')](_0x8882('0x5'),'variable',_0x8882('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8882('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8882('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xee5c=['string','variable','keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports'];(function(_0x1a8447,_0x36530a){var _0x395a51=function(_0x4c2d74){while(--_0x4c2d74){_0x1a8447['push'](_0x1a8447['shift']());}};_0x395a51(++_0x36530a);}(_0xee5c,0xcd));var _0xcee5=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0xee5c[_0x254abd];return _0x31bf1b;};'use strict';var Sequelize=require(_0xcee5('0x0'));module[_0xcee5('0x1')]={'type':{'type':Sequelize['ENUM'](_0xcee5('0x2'),_0xcee5('0x3'),'customVariable',_0xcee5('0x4')),'defaultValue':_0xcee5('0x2')},'content':{'type':Sequelize[_0xcee5('0x5')]},'key':{'type':Sequelize[_0xcee5('0x5')]},'keyType':{'type':Sequelize[_0xcee5('0x6')](_0xcee5('0x2'),_0xcee5('0x3'),_0xcee5('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xcee5('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcee5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcee5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 75b29dc..2ab37e4 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 _0x1566=['VIRTUAL','merge','options','count','include','findAll','rows','catch','params','includeAll','find','create','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter'];(function(_0x581adf,_0x37a1e5){var _0x3788c0=function(_0x49a427){while(--_0x49a427){_0x581adf['push'](_0x581adf['shift']());}};_0x3788c0(++_0x37a1e5);}(_0x1566,0xa0));var _0x6156=function(_0x2c4f3f,_0x266947){_0x2c4f3f=_0x2c4f3f-0x0;var _0x3d0234=_0x1566[_0x2c4f3f];return _0x3d0234;};'use strict';var pdf=require(_0x6156('0x0'));var emlformat=require(_0x6156('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6156('0x2'));var jsonpatch=require(_0x6156('0x3'));var rp=require(_0x6156('0x4'));var moment=require(_0x6156('0x5'));var BPromise=require(_0x6156('0x6'));var Mustache=require(_0x6156('0x7'));var util=require(_0x6156('0x8'));var path=require(_0x6156('0x9'));var sox=require(_0x6156('0xa'));var csv=require(_0x6156('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6156('0xc'));var squel=require('squel');var crypto=require(_0x6156('0xd'));var jsforce=require(_0x6156('0xe'));var deskjs=require(_0x6156('0xf'));var toCsv=require(_0x6156('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6156('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6156('0x11'));var as=require(_0x6156('0x12'));var hardwareService=require(_0x6156('0x13'));var logger=require(_0x6156('0x14'))(_0x6156('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6156('0x16'))['db'];function respondWithStatusCode(_0x3393fe,_0x119081){_0x119081=_0x119081||0xcc;return function(_0x7ab0a7){if(_0x7ab0a7){return _0x3393fe[_0x6156('0x17')](_0x119081);}return _0x3393fe['status'](_0x119081)[_0x6156('0x18')]();};}function respondWithResult(_0x589192,_0x43ea35){_0x43ea35=_0x43ea35||0xc8;return function(_0x8ce313){if(_0x8ce313){return _0x589192[_0x6156('0x19')](_0x43ea35)['json'](_0x8ce313);}};}function respondWithFilteredResult(_0x335238,_0x3429ad){return function(_0x1bf5c0){if(_0x1bf5c0){var _0x4b2680=_0x1bf5c0['count'],_0x28d3a9=_0x3429ad[_0x6156('0x1a')],_0xb476b1=_0x3429ad[_0x6156('0x1a')]+_0x3429ad[_0x6156('0x1b')],_0xeafa31;if(_0xb476b1>=_0x4b2680){_0xb476b1=_0x4b2680;_0xeafa31=0xc8;}else{_0xeafa31=0xce;}_0x335238[_0x6156('0x19')](_0xeafa31);return _0x335238['set'](_0x6156('0x1c'),_0x28d3a9+'-'+_0xb476b1+'/'+_0x4b2680)[_0x6156('0x1d')](_0x1bf5c0);}return null;};}function patchUpdates(_0x25964c){return function(_0x41b3a6){try{jsonpatch[_0x6156('0x1e')](_0x41b3a6,_0x25964c,!![]);}catch(_0x13b385){return BPromise[_0x6156('0x1f')](_0x13b385);}return _0x41b3a6[_0x6156('0x20')]();};}function saveUpdates(_0xa02515,_0x3fe3de){return function(_0x31f965){if(_0x31f965){return _0x31f965['update'](_0xa02515)[_0x6156('0x21')](function(_0x15bfe3){return _0x15bfe3;});}return null;};}function removeEntity(_0x17572b,_0x45addf){return function(_0x5aa419){if(_0x5aa419){return _0x5aa419[_0x6156('0x22')]()[_0x6156('0x21')](function(){_0x17572b[_0x6156('0x19')](0xcc)[_0x6156('0x18')]();});}};}function handleEntityNotFound(_0x1858e7,_0x8faae5){return function(_0x12b6c9){if(!_0x12b6c9){_0x1858e7[_0x6156('0x17')](0x194);}return _0x12b6c9;};}function handleError(_0x3c4895,_0x3c1dc5){_0x3c1dc5=_0x3c1dc5||0x1f4;return function(_0x91207b){logger[_0x6156('0x23')](_0x91207b['stack']);if(_0x91207b[_0x6156('0x24')]){delete _0x91207b[_0x6156('0x24')];}_0x3c4895[_0x6156('0x19')](_0x3c1dc5)[_0x6156('0x25')](_0x91207b);};}exports[_0x6156('0x26')]=function(_0xdd2541,_0x420e85){var _0x11af94={},_0x160a98={},_0x261b2d={'count':0x0,'rows':[]};var _0x4c05be=_[_0x6156('0x27')](db[_0x6156('0x28')][_0x6156('0x29')],function(_0x43f90e){return{'name':_0x43f90e[_0x6156('0x2a')],'type':_0x43f90e[_0x6156('0x2b')][_0x6156('0x2c')]};});_0x160a98[_0x6156('0x2d')]=_[_0x6156('0x27')](_0x4c05be,_0x6156('0x24'));_0x160a98[_0x6156('0x2e')]=_[_0x6156('0x2f')](_0xdd2541[_0x6156('0x2e')]);_0x160a98[_0x6156('0x30')]=_[_0x6156('0x31')](_0x160a98['model'],_0x160a98[_0x6156('0x2e')]);_0x11af94['attributes']=_[_0x6156('0x31')](_0x160a98['model'],qs[_0x6156('0x32')](_0xdd2541['query'][_0x6156('0x32')]));_0x11af94[_0x6156('0x33')]=_0x11af94[_0x6156('0x33')][_0x6156('0x34')]?_0x11af94['attributes']:_0x160a98[_0x6156('0x2d')];if(!_0xdd2541['query'][_0x6156('0x35')](_0x6156('0x36'))){_0x11af94[_0x6156('0x1b')]=qs[_0x6156('0x1b')](_0xdd2541['query'][_0x6156('0x1b')]);_0x11af94[_0x6156('0x1a')]=qs[_0x6156('0x1a')](_0xdd2541[_0x6156('0x2e')]['offset']);}_0x11af94[_0x6156('0x37')]=qs['sort'](_0xdd2541[_0x6156('0x2e')]['sort']);_0x11af94[_0x6156('0x38')]=qs[_0x6156('0x30')](_[_0x6156('0x39')](_0xdd2541[_0x6156('0x2e')],_0x160a98['filters']),_0x4c05be);if(_0xdd2541[_0x6156('0x2e')][_0x6156('0x3a')]){_0x11af94[_0x6156('0x38')]=_['merge'](_0x11af94[_0x6156('0x38')],{'$or':_[_0x6156('0x27')](_0x4c05be,function(_0xd8be52){if(_0xd8be52[_0x6156('0x2b')]!==_0x6156('0x3b')){var _0x250e10={};_0x250e10[_0xd8be52[_0x6156('0x24')]]={'$like':'%'+_0xdd2541[_0x6156('0x2e')][_0x6156('0x3a')]+'%'};return _0x250e10;}})});}_0x11af94=_[_0x6156('0x3c')]({},_0x11af94,_0xdd2541[_0x6156('0x3d')]);var _0x65ad0f={'where':_0x11af94[_0x6156('0x38')]};return db[_0x6156('0x28')]['count'](_0x65ad0f)['then'](function(_0x38516a){_0x261b2d[_0x6156('0x3e')]=_0x38516a;if(_0xdd2541[_0x6156('0x2e')]['includeAll']){_0x11af94[_0x6156('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0x6156('0x40')](_0x11af94);})[_0x6156('0x21')](function(_0x19331b){_0x261b2d[_0x6156('0x41')]=_0x19331b;return _0x261b2d;})[_0x6156('0x21')](respondWithFilteredResult(_0x420e85,_0x11af94))[_0x6156('0x42')](handleError(_0x420e85,null));};exports['show']=function(_0x1f5b3c,_0x30dc52){var _0x35115e={'raw':!![],'where':{'id':_0x1f5b3c[_0x6156('0x43')]['id']}},_0xf1d923={};_0xf1d923[_0x6156('0x2d')]=_[_0x6156('0x2f')](db[_0x6156('0x28')][_0x6156('0x29')]);_0xf1d923[_0x6156('0x2e')]=_['keys'](_0x1f5b3c['query']);_0xf1d923['filters']=_[_0x6156('0x31')](_0xf1d923[_0x6156('0x2d')],_0xf1d923['query']);_0x35115e['attributes']=_[_0x6156('0x31')](_0xf1d923[_0x6156('0x2d')],qs[_0x6156('0x32')](_0x1f5b3c[_0x6156('0x2e')][_0x6156('0x32')]));_0x35115e['attributes']=_0x35115e[_0x6156('0x33')][_0x6156('0x34')]?_0x35115e[_0x6156('0x33')]:_0xf1d923['model'];if(_0x1f5b3c[_0x6156('0x2e')][_0x6156('0x44')]){_0x35115e[_0x6156('0x3f')]=[{'all':!![]}];}_0x35115e=_[_0x6156('0x3c')]({},_0x35115e,_0x1f5b3c['options']);return db[_0x6156('0x28')][_0x6156('0x45')](_0x35115e)[_0x6156('0x21')](handleEntityNotFound(_0x30dc52,null))[_0x6156('0x21')](respondWithResult(_0x30dc52,null))[_0x6156('0x42')](handleError(_0x30dc52,null));};exports['create']=function(_0x492dac,_0x52ced3){return db['FreshdeskField'][_0x6156('0x46')](_0x492dac['body'],{})['then'](respondWithResult(_0x52ced3,0xc9))[_0x6156('0x42')](handleError(_0x52ced3,null));};exports[_0x6156('0x47')]=function(_0x300940,_0x142b48){if(_0x300940[_0x6156('0x48')]['id']){delete _0x300940[_0x6156('0x48')]['id'];}return db[_0x6156('0x28')]['find']({'where':{'id':_0x300940[_0x6156('0x43')]['id']}})['then'](handleEntityNotFound(_0x142b48,null))[_0x6156('0x21')](saveUpdates(_0x300940[_0x6156('0x48')],null))[_0x6156('0x21')](respondWithResult(_0x142b48,null))[_0x6156('0x42')](handleError(_0x142b48,null));};exports[_0x6156('0x22')]=function(_0x191d91,_0x40836f){return db[_0x6156('0x28')][_0x6156('0x45')]({'where':{'id':_0x191d91[_0x6156('0x43')]['id']}})[_0x6156('0x21')](handleEntityNotFound(_0x40836f,null))[_0x6156('0x21')](removeEntity(_0x40836f,null))[_0x6156('0x42')](handleError(_0x40836f,null));}; \ No newline at end of file +var _0x7c35=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','end','error','name','send','index','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','options','includeAll','include','findAll','show','params','find','catch','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7c35,0x147));var _0x57c3=function(_0x442f83,_0x47ddbf){_0x442f83=_0x442f83-0x0;var _0x5bf96b=_0x7c35[_0x442f83];return _0x5bf96b;};'use strict';var pdf=require(_0x57c3('0x0'));var emlformat=require(_0x57c3('0x1'));var rimraf=require(_0x57c3('0x2'));var zipdir=require(_0x57c3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57c3('0x4'));var moment=require('moment');var BPromise=require(_0x57c3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x57c3('0x6'));var csv=require(_0x57c3('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x57c3('0x8'));var jsforce=require(_0x57c3('0x9'));var deskjs=require(_0x57c3('0xa'));var toCsv=require('to-csv');var querystring=require(_0x57c3('0xb'));var Papa=require(_0x57c3('0xc'));var Redis=require(_0x57c3('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x57c3('0xe'));var as=require(_0x57c3('0xf'));var hardwareService=require(_0x57c3('0x10'));var logger=require(_0x57c3('0x11'))(_0x57c3('0x12'));var utils=require(_0x57c3('0x13'));var config=require('../../config/environment');var db=require(_0x57c3('0x14'))['db'];function respondWithStatusCode(_0x35f0d3,_0x5323b7){_0x5323b7=_0x5323b7||0xcc;return function(_0x1535ce){if(_0x1535ce){return _0x35f0d3[_0x57c3('0x15')](_0x5323b7);}return _0x35f0d3['status'](_0x5323b7)['end']();};}function respondWithResult(_0x3acc3f,_0xa51656){_0xa51656=_0xa51656||0xc8;return function(_0x2603ad){if(_0x2603ad){return _0x3acc3f[_0x57c3('0x16')](_0xa51656)[_0x57c3('0x17')](_0x2603ad);}};}function respondWithFilteredResult(_0x374c5a,_0x2f170d){return function(_0x134b97){if(_0x134b97){var _0x17f70a=_0x134b97[_0x57c3('0x18')],_0x249987=_0x2f170d[_0x57c3('0x19')],_0x3de554=_0x2f170d[_0x57c3('0x19')]+_0x2f170d[_0x57c3('0x1a')],_0x3f36e3;if(_0x3de554>=_0x17f70a){_0x3de554=_0x17f70a;_0x3f36e3=0xc8;}else{_0x3f36e3=0xce;}_0x374c5a[_0x57c3('0x16')](_0x3f36e3);return _0x374c5a[_0x57c3('0x1b')](_0x57c3('0x1c'),_0x249987+'-'+_0x3de554+'/'+_0x17f70a)['json'](_0x134b97);}return null;};}function patchUpdates(_0x14deda){return function(_0x2b80c4){try{jsonpatch[_0x57c3('0x1d')](_0x2b80c4,_0x14deda,!![]);}catch(_0x5ac599){return BPromise[_0x57c3('0x1e')](_0x5ac599);}return _0x2b80c4[_0x57c3('0x1f')]();};}function saveUpdates(_0x43a036,_0x13a6f0){return function(_0x2b0327){if(_0x2b0327){return _0x2b0327['update'](_0x43a036)[_0x57c3('0x20')](function(_0x43c791){return _0x43c791;});}return null;};}function removeEntity(_0x233840,_0xf2f9aa){return function(_0x319814){if(_0x319814){return _0x319814['destroy']()['then'](function(){_0x233840[_0x57c3('0x16')](0xcc)[_0x57c3('0x21')]();});}};}function handleEntityNotFound(_0x32d82d,_0xc76901){return function(_0x5fae56){if(!_0x5fae56){_0x32d82d[_0x57c3('0x15')](0x194);}return _0x5fae56;};}function handleError(_0xfb6af4,_0x28f1b3){_0x28f1b3=_0x28f1b3||0x1f4;return function(_0x109549){logger[_0x57c3('0x22')](_0x109549['stack']);if(_0x109549['name']){delete _0x109549[_0x57c3('0x23')];}_0xfb6af4[_0x57c3('0x16')](_0x28f1b3)[_0x57c3('0x24')](_0x109549);};}exports[_0x57c3('0x25')]=function(_0xb9df5e,_0x1a3d01){var _0x5d5ce6={},_0x142083={},_0x2c1581={'count':0x0,'rows':[]};var _0x306ee7=_['map'](db[_0x57c3('0x26')][_0x57c3('0x27')],function(_0x57f573){return{'name':_0x57f573[_0x57c3('0x28')],'type':_0x57f573['type']['key']};});_0x142083[_0x57c3('0x29')]=_['map'](_0x306ee7,_0x57c3('0x23'));_0x142083[_0x57c3('0x2a')]=_[_0x57c3('0x2b')](_0xb9df5e[_0x57c3('0x2a')]);_0x142083[_0x57c3('0x2c')]=_[_0x57c3('0x2d')](_0x142083[_0x57c3('0x29')],_0x142083[_0x57c3('0x2a')]);_0x5d5ce6[_0x57c3('0x2e')]=_['intersection'](_0x142083[_0x57c3('0x29')],qs[_0x57c3('0x2f')](_0xb9df5e[_0x57c3('0x2a')][_0x57c3('0x2f')]));_0x5d5ce6[_0x57c3('0x2e')]=_0x5d5ce6[_0x57c3('0x2e')][_0x57c3('0x30')]?_0x5d5ce6[_0x57c3('0x2e')]:_0x142083[_0x57c3('0x29')];if(!_0xb9df5e[_0x57c3('0x2a')][_0x57c3('0x31')](_0x57c3('0x32'))){_0x5d5ce6[_0x57c3('0x1a')]=qs['limit'](_0xb9df5e[_0x57c3('0x2a')][_0x57c3('0x1a')]);_0x5d5ce6[_0x57c3('0x19')]=qs[_0x57c3('0x19')](_0xb9df5e[_0x57c3('0x2a')][_0x57c3('0x19')]);}_0x5d5ce6[_0x57c3('0x33')]=qs[_0x57c3('0x34')](_0xb9df5e[_0x57c3('0x2a')][_0x57c3('0x34')]);_0x5d5ce6['where']=qs['filters'](_[_0x57c3('0x35')](_0xb9df5e[_0x57c3('0x2a')],_0x142083[_0x57c3('0x2c')]),_0x306ee7);if(_0xb9df5e['query'][_0x57c3('0x36')]){_0x5d5ce6['where']=_[_0x57c3('0x37')](_0x5d5ce6[_0x57c3('0x38')],{'$or':_['map'](_0x306ee7,function(_0x1e831d){if(_0x1e831d[_0x57c3('0x39')]!=='VIRTUAL'){var _0x2c3c58={};_0x2c3c58[_0x1e831d[_0x57c3('0x23')]]={'$like':'%'+_0xb9df5e['query'][_0x57c3('0x36')]+'%'};return _0x2c3c58;}})});}_0x5d5ce6=_[_0x57c3('0x37')]({},_0x5d5ce6,_0xb9df5e[_0x57c3('0x3a')]);var _0x26d82c={'where':_0x5d5ce6[_0x57c3('0x38')]};return db['FreshdeskField'][_0x57c3('0x18')](_0x26d82c)[_0x57c3('0x20')](function(_0x2d6419){_0x2c1581[_0x57c3('0x18')]=_0x2d6419;if(_0xb9df5e[_0x57c3('0x2a')][_0x57c3('0x3b')]){_0x5d5ce6[_0x57c3('0x3c')]=[{'all':!![]}];}return db[_0x57c3('0x26')][_0x57c3('0x3d')](_0x5d5ce6);})[_0x57c3('0x20')](function(_0x3c8880){_0x2c1581['rows']=_0x3c8880;return _0x2c1581;})['then'](respondWithFilteredResult(_0x1a3d01,_0x5d5ce6))['catch'](handleError(_0x1a3d01,null));};exports[_0x57c3('0x3e')]=function(_0x248122,_0x203a37){var _0x560d46={'raw':!![],'where':{'id':_0x248122[_0x57c3('0x3f')]['id']}},_0x208bf3={};_0x208bf3[_0x57c3('0x29')]=_['keys'](db['FreshdeskField'][_0x57c3('0x27')]);_0x208bf3['query']=_[_0x57c3('0x2b')](_0x248122[_0x57c3('0x2a')]);_0x208bf3[_0x57c3('0x2c')]=_['intersection'](_0x208bf3[_0x57c3('0x29')],_0x208bf3[_0x57c3('0x2a')]);_0x560d46[_0x57c3('0x2e')]=_[_0x57c3('0x2d')](_0x208bf3[_0x57c3('0x29')],qs['fields'](_0x248122[_0x57c3('0x2a')][_0x57c3('0x2f')]));_0x560d46['attributes']=_0x560d46[_0x57c3('0x2e')][_0x57c3('0x30')]?_0x560d46[_0x57c3('0x2e')]:_0x208bf3['model'];if(_0x248122[_0x57c3('0x2a')][_0x57c3('0x3b')]){_0x560d46['include']=[{'all':!![]}];}_0x560d46=_[_0x57c3('0x37')]({},_0x560d46,_0x248122[_0x57c3('0x3a')]);return db[_0x57c3('0x26')][_0x57c3('0x40')](_0x560d46)[_0x57c3('0x20')](handleEntityNotFound(_0x203a37,null))[_0x57c3('0x20')](respondWithResult(_0x203a37,null))[_0x57c3('0x41')](handleError(_0x203a37,null));};exports[_0x57c3('0x42')]=function(_0x155eba,_0x529524){return db['FreshdeskField']['create'](_0x155eba[_0x57c3('0x43')],{})[_0x57c3('0x20')](respondWithResult(_0x529524,0xc9))[_0x57c3('0x41')](handleError(_0x529524,null));};exports[_0x57c3('0x44')]=function(_0x3e93be,_0x1c6334){if(_0x3e93be[_0x57c3('0x43')]['id']){delete _0x3e93be[_0x57c3('0x43')]['id'];}return db[_0x57c3('0x26')][_0x57c3('0x40')]({'where':{'id':_0x3e93be[_0x57c3('0x3f')]['id']}})[_0x57c3('0x20')](handleEntityNotFound(_0x1c6334,null))[_0x57c3('0x20')](saveUpdates(_0x3e93be[_0x57c3('0x43')],null))[_0x57c3('0x20')](respondWithResult(_0x1c6334,null))[_0x57c3('0x41')](handleError(_0x1c6334,null));};exports[_0x57c3('0x45')]=function(_0x54d16a,_0x224270){return db[_0x57c3('0x26')]['find']({'where':{'id':_0x54d16a[_0x57c3('0x3f')]['id']}})[_0x57c3('0x20')](handleEntityNotFound(_0x224270,null))[_0x57c3('0x20')](removeEntity(_0x224270,null))[_0x57c3('0x41')](handleError(_0x224270,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3c34884..2bb25bc 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 _0xd417=['int_freshdesk_fields','idField','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0x291276,_0x5870a5){var _0x459a79=function(_0x5f295e){while(--_0x5f295e){_0x291276['push'](_0x291276['shift']());}};_0x459a79(++_0x5870a5);}(_0xd417,0xaa));var _0x7d41=function(_0x129a18,_0x5b308a){_0x129a18=_0x129a18-0x0;var _0x3ed324=_0xd417[_0x129a18];return _0x3ed324;};'use strict';var _=require(_0x7d41('0x0'));var util=require(_0x7d41('0x1'));var logger=require(_0x7d41('0x2'))(_0x7d41('0x3'));var moment=require(_0x7d41('0x4'));var BPromise=require('bluebird');var rp=require(_0x7d41('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d41('0x6'));var config=require(_0x7d41('0x7'));var attributes=require(_0x7d41('0x8'));module['exports']=function(_0x295ee5,_0x2c0391){return _0x295ee5[_0x7d41('0x9')]('FreshdeskField',attributes,{'tableName':_0x7d41('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x7d41('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1dcd=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0x3cfb45,_0x34cfa8){var _0x5dd7ad=function(_0x3b0f69){while(--_0x3b0f69){_0x3cfb45['push'](_0x3cfb45['shift']());}};_0x5dd7ad(++_0x34cfa8);}(_0x1dcd,0xa0));var _0xd1dc=function(_0x136f48,_0x14e54d){_0x136f48=_0x136f48-0x0;var _0x343726=_0x1dcd[_0x136f48];return _0x343726;};'use strict';var _=require('lodash');var util=require(_0xd1dc('0x0'));var logger=require(_0xd1dc('0x1'))(_0xd1dc('0x2'));var moment=require(_0xd1dc('0x3'));var BPromise=require('bluebird');var rp=require(_0xd1dc('0x4'));var fs=require('fs');var path=require(_0xd1dc('0x5'));var rimraf=require('rimraf');var config=require(_0xd1dc('0x6'));var attributes=require(_0xd1dc('0x7'));module['exports']=function(_0x1aa53e,_0x3a6373){return _0x1aa53e[_0xd1dc('0x8')](_0xd1dc('0x9'),attributes,{'tableName':_0xd1dc('0xa'),'paranoid':![],'indexes':[{'name':_0xd1dc('0xb'),'fields':[_0xd1dc('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 063df97..db99d47 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xb94a2f,_0x3a5f50){var _0x45e3ee=function(_0x5d5a89){while(--_0x5d5a89){_0xb94a2f['push'](_0xb94a2f['shift']());}};_0x45e3ee(++_0x3a5f50);}(_0xb10b,0x12a));var _0xbb10=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0xb10b[_0x13945b];return _0x1b1643;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3ebf20,_0x55ef3b){var _0x786bb3=function(_0x499672){while(--_0x499672){_0x3ebf20['push'](_0x3ebf20['shift']());}};_0x786bb3(++_0x55ef3b);}(_0xb10b,0x12a));var _0xbb10=function(_0x45aa18,_0x412fc5){_0x45aa18=_0x45aa18-0x0;var _0x26119d=_0xb10b[_0x45aa18];return _0x26119d;};'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 becf637..4e812c3 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 _0x52d2=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete'];(function(_0x22e5dc,_0x3d9c9e){var _0x28db29=function(_0x1abb82){while(--_0x1abb82){_0x22e5dc['push'](_0x22e5dc['shift']());}};_0x28db29(++_0x3d9c9e);}(_0x52d2,0x1e5));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x252d('0x0'));var util=require(_0x252d('0x1'));var path=require(_0x252d('0x2'));var timeout=require(_0x252d('0x3'));var express=require(_0x252d('0x4'));var router=express['Router']();var auth=require(_0x252d('0x5'));var interaction=require(_0x252d('0x6'));var config=require(_0x252d('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x252d('0x8')]('/',auth[_0x252d('0x9')](),controller[_0x252d('0xa')]);router[_0x252d('0x8')]('/:id',auth[_0x252d('0x9')](),controller[_0x252d('0xb')]);router['get'](_0x252d('0xc'),auth[_0x252d('0x9')](),controller['getConfigurations']);router['get'](_0x252d('0xd'),auth[_0x252d('0x9')](),controller[_0x252d('0xe')]);router[_0x252d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x252d('0x9')](),controller[_0x252d('0x10')]);router[_0x252d('0x11')](_0x252d('0x12'),auth[_0x252d('0x9')](),controller[_0x252d('0x13')]);router[_0x252d('0x14')]('/:id',auth[_0x252d('0x9')](),controller[_0x252d('0x15')]);module[_0x252d('0x16')]=router; \ No newline at end of file +var _0xbecb=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','/:id','update','destroy','exports'];(function(_0x5aa147,_0x3ba38f){var _0x59ff19=function(_0x50ee42){while(--_0x50ee42){_0x5aa147['push'](_0x5aa147['shift']());}};_0x59ff19(++_0x3ba38f);}(_0xbecb,0xb0));var _0xbbec=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xbecb[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0xbbec('0x0'));var util=require(_0xbbec('0x1'));var path=require(_0xbbec('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbec('0x3'));var router=express[_0xbbec('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbbec('0x5'));var config=require(_0xbbec('0x6'));var controller=require(_0xbbec('0x7'));router[_0xbbec('0x8')]('/',auth[_0xbbec('0x9')](),controller['index']);router[_0xbbec('0x8')]('/:id',auth[_0xbbec('0x9')](),controller[_0xbbec('0xa')]);router['get'](_0xbbec('0xb'),auth[_0xbbec('0x9')](),controller[_0xbbec('0xc')]);router[_0xbbec('0x8')](_0xbbec('0xd'),auth[_0xbbec('0x9')](),controller[_0xbbec('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbbec('0xf')]);router[_0xbbec('0x10')](_0xbbec('0xb'),auth[_0xbbec('0x9')](),controller['addConfiguration']);router[_0xbbec('0x11')](_0xbbec('0x12'),auth[_0xbbec('0x9')](),controller[_0xbbec('0x13')]);router['delete'](_0xbbec('0x12'),auth['isAuthenticated'](),controller[_0xbbec('0x14')]);module[_0xbbec('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c81c318..e225b98 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 _0x89fb=['STRING','username','remoteUri','exports'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x89fb,0x14b));var _0xb89f=function(_0x1c67df,_0x2b474d){_0x1c67df=_0x1c67df-0x0;var _0x5d038e=_0x89fb[_0x1c67df];return _0x5d038e;};'use strict';var Sequelize=require('sequelize');module[_0xb89f('0x0')]={'name':{'type':Sequelize[_0xb89f('0x1')]},'description':{'type':Sequelize[_0xb89f('0x1')]},'username':{'type':Sequelize[_0xb89f('0x1')],'unique':_0xb89f('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb89f('0x1')],'unique':_0xb89f('0x3')},'serverUrl':{'type':Sequelize[_0xb89f('0x1')]}}; \ No newline at end of file +var _0x4a03=['exports','STRING','username'];(function(_0x5f2637,_0x1eec28){var _0x4c1c9d=function(_0x5e3782){while(--_0x5e3782){_0x5f2637['push'](_0x5f2637['shift']());}};_0x4c1c9d(++_0x1eec28);}(_0x4a03,0x16e));var _0x34a0=function(_0x57be4c,_0x170051){_0x57be4c=_0x57be4c-0x0;var _0x191de4=_0x4a03[_0x57be4c];return _0x191de4;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')]},'description':{'type':Sequelize[_0x34a0('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x34a0('0x2')},'apiKey':{'type':Sequelize[_0x34a0('0x1')]},'remoteUri':{'type':Sequelize[_0x34a0('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x34a0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index bdf9838..1e7c3bd 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 _0xd873=['VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','create','body','getConfigurations','findOne','pick','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','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','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd873,0x9c));var _0x3d87=function(_0x4ebab3,_0x49e7c2){_0x4ebab3=_0x4ebab3-0x0;var _0x340fe7=_0xd873[_0x4ebab3];return _0x340fe7;};'use strict';var pdf=require(_0x3d87('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3d87('0x1'));var zipdir=require(_0x3d87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d87('0x3'));var moment=require(_0x3d87('0x4'));var BPromise=require(_0x3d87('0x5'));var Mustache=require(_0x3d87('0x6'));var util=require(_0x3d87('0x7'));var path=require(_0x3d87('0x8'));var sox=require('sox');var csv=require(_0x3d87('0x9'));var ejs=require(_0x3d87('0xa'));var fs=require('fs');var _=require(_0x3d87('0xb'));var squel=require(_0x3d87('0xc'));var crypto=require(_0x3d87('0xd'));var jsforce=require(_0x3d87('0xe'));var deskjs=require(_0x3d87('0xf'));var toCsv=require(_0x3d87('0x9'));var querystring=require(_0x3d87('0x10'));var Papa=require(_0x3d87('0x11'));var Redis=require(_0x3d87('0x12'));var authService=require(_0x3d87('0x13'));var qs=require(_0x3d87('0x14'));var as=require(_0x3d87('0x15'));var hardwareService=require(_0x3d87('0x16'));var logger=require('../../config/logger')(_0x3d87('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3d87('0x18'))['db'];var integrations=require(_0x3d87('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x3d87('0x1a')][_0x3d87('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1d7460,_0x30f1d5,_0x19f4d1){if(_0x19f4d1){var _0x4f87c1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f87c1['test'](_0x30f1d5)){return _0x1d7460;}else{throw new db[(_0x3d87('0x1c'))][(_0x3d87('0x1d'))](_0x3d87('0x1e'));}}else{return _0x1d7460;}}function respondWithRpcPromise(_0x43c14e,_0x2db352,_0x135274,_0x174f31){return new BPromise(function(_0x454629,_0x469bab){var _0x3c4a85=_0x174f31||client;return _0x3c4a85[_0x3d87('0x1f')](_0x43c14e,_0x135274)[_0x3d87('0x20')](function(_0x1c366e){logger[_0x3d87('0x21')](_0x3d87('0x22'),_0x2db352,_0x3d87('0x23'));logger[_0x3d87('0x24')](_0x3d87('0x25'),_0x2db352,_0x3d87('0x23'),JSON[_0x3d87('0x26')](_0x1c366e));if(_0x1c366e[_0x3d87('0x27')]){if(_0x1c366e['error'][_0x3d87('0x28')]===0x1f4){logger['error'](_0x3d87('0x22'),_0x2db352,_0x1c366e['error']['message']);return _0x469bab(_0x1c366e['error'][_0x3d87('0x29')]);}logger['error'](_0x3d87('0x22'),_0x2db352,_0x1c366e[_0x3d87('0x27')]['message']);return _0x454629(_0x1c366e[_0x3d87('0x27')]['message']);}else{logger[_0x3d87('0x21')](_0x3d87('0x22'),_0x2db352,_0x3d87('0x23'));_0x454629(_0x1c366e['result'][_0x3d87('0x29')]);}})[_0x3d87('0x2a')](function(_0xcf8929){logger[_0x3d87('0x27')]('FreshsalesAccount,\x20%s,\x20%s',_0x2db352,_0xcf8929);_0x469bab(_0xcf8929);});});}function respondWithStatusCode(_0x1c33f8,_0x21a12d){_0x21a12d=_0x21a12d||0xcc;return function(_0x847eca){if(_0x847eca){return _0x1c33f8['sendStatus'](_0x21a12d);}return _0x1c33f8[_0x3d87('0x2b')](_0x21a12d)['end']();};}function respondWithResult(_0x21a01a,_0x55f748){_0x55f748=_0x55f748||0xc8;return function(_0x1d381e){if(_0x1d381e){return _0x21a01a[_0x3d87('0x2b')](_0x55f748)['json'](_0x1d381e);}};}function respondWithFilteredResult(_0x5579fb,_0x1f18e9){return function(_0x2c6603){if(_0x2c6603){var _0x3f3007=_0x2c6603[_0x3d87('0x2c')],_0x3d31e9=_0x1f18e9[_0x3d87('0x2d')],_0x40db38=_0x1f18e9[_0x3d87('0x2d')]+_0x1f18e9[_0x3d87('0x2e')],_0x3981e7;if(_0x40db38>=_0x3f3007){_0x40db38=_0x3f3007;_0x3981e7=0xc8;}else{_0x3981e7=0xce;}_0x5579fb[_0x3d87('0x2b')](_0x3981e7);return _0x5579fb[_0x3d87('0x2f')](_0x3d87('0x30'),_0x3d31e9+'-'+_0x40db38+'/'+_0x3f3007)[_0x3d87('0x31')](_0x2c6603);}return null;};}function patchUpdates(_0x293b82){return function(_0x4f05e1){try{jsonpatch[_0x3d87('0x32')](_0x4f05e1,_0x293b82,!![]);}catch(_0x446525){return BPromise[_0x3d87('0x33')](_0x446525);}return _0x4f05e1[_0x3d87('0x34')]();};}function saveUpdates(_0x28f719,_0x7f61c1){return function(_0x44d4cc){if(_0x44d4cc){return _0x44d4cc[_0x3d87('0x35')](_0x28f719)[_0x3d87('0x20')](function(_0x5a2614){return _0x5a2614;});}return null;};}function removeEntity(_0x28fa4c,_0x63c4d1){return function(_0x31706c){if(_0x31706c){return _0x31706c[_0x3d87('0x36')]()[_0x3d87('0x20')](function(){_0x28fa4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x260d9f,_0xe556f){return function(_0xfd0aa6){if(!_0xfd0aa6){_0x260d9f[_0x3d87('0x37')](0x194);}return _0xfd0aa6;};}function handleError(_0x4e9a4b,_0x5284f9){_0x5284f9=_0x5284f9||0x1f4;return function(_0x2bbab7){logger[_0x3d87('0x27')](_0x2bbab7[_0x3d87('0x38')]);if(_0x2bbab7[_0x3d87('0x39')]){delete _0x2bbab7[_0x3d87('0x39')];}_0x4e9a4b['status'](_0x5284f9)[_0x3d87('0x3a')](_0x2bbab7);};}exports['index']=function(_0x1046d1,_0x455076){var _0x5e87aa={},_0x332b8e={},_0x580618={'count':0x0,'rows':[]};var _0x3994c7=_[_0x3d87('0x3b')](db[_0x3d87('0x3c')][_0x3d87('0x3d')],function(_0x482794){return{'name':_0x482794[_0x3d87('0x3e')],'type':_0x482794[_0x3d87('0x3f')][_0x3d87('0x40')]};});_0x332b8e[_0x3d87('0x41')]=_['map'](_0x3994c7,_0x3d87('0x39'));_0x332b8e[_0x3d87('0x42')]=_['keys'](_0x1046d1[_0x3d87('0x42')]);_0x332b8e['filters']=_[_0x3d87('0x43')](_0x332b8e[_0x3d87('0x41')],_0x332b8e[_0x3d87('0x42')]);_0x5e87aa['attributes']=_[_0x3d87('0x43')](_0x332b8e[_0x3d87('0x41')],qs[_0x3d87('0x44')](_0x1046d1[_0x3d87('0x42')][_0x3d87('0x44')]));_0x5e87aa['attributes']=_0x5e87aa[_0x3d87('0x45')][_0x3d87('0x46')]?_0x5e87aa[_0x3d87('0x45')]:_0x332b8e[_0x3d87('0x41')];if(!_0x1046d1[_0x3d87('0x42')][_0x3d87('0x47')]('nolimit')){_0x5e87aa[_0x3d87('0x2e')]=qs[_0x3d87('0x2e')](_0x1046d1[_0x3d87('0x42')][_0x3d87('0x2e')]);_0x5e87aa[_0x3d87('0x2d')]=qs[_0x3d87('0x2d')](_0x1046d1[_0x3d87('0x42')]['offset']);}_0x5e87aa[_0x3d87('0x48')]=qs[_0x3d87('0x49')](_0x1046d1[_0x3d87('0x42')][_0x3d87('0x49')]);_0x5e87aa[_0x3d87('0x4a')]=qs[_0x3d87('0x4b')](_['pick'](_0x1046d1[_0x3d87('0x42')],_0x332b8e[_0x3d87('0x4b')]),_0x3994c7);if(_0x1046d1[_0x3d87('0x42')][_0x3d87('0x4c')]){_0x5e87aa['where']=_[_0x3d87('0x4d')](_0x5e87aa[_0x3d87('0x4a')],{'$or':_['map'](_0x3994c7,function(_0x492ba5){if(_0x492ba5[_0x3d87('0x3f')]!==_0x3d87('0x4e')){var _0x152b8a={};_0x152b8a[_0x492ba5['name']]={'$like':'%'+_0x1046d1[_0x3d87('0x42')][_0x3d87('0x4c')]+'%'};return _0x152b8a;}})});}_0x5e87aa=_[_0x3d87('0x4d')]({},_0x5e87aa,_0x1046d1[_0x3d87('0x4f')]);var _0x14d751={'where':_0x5e87aa['where']};return db[_0x3d87('0x3c')][_0x3d87('0x2c')](_0x14d751)[_0x3d87('0x20')](function(_0x53eee6){_0x580618[_0x3d87('0x2c')]=_0x53eee6;if(_0x1046d1[_0x3d87('0x42')][_0x3d87('0x50')]){_0x5e87aa[_0x3d87('0x51')]=[{'all':!![]}];}return db[_0x3d87('0x3c')][_0x3d87('0x52')](_0x5e87aa);})[_0x3d87('0x20')](function(_0x1bb2de){_0x580618[_0x3d87('0x53')]=_0x1bb2de;return _0x580618;})[_0x3d87('0x20')](respondWithFilteredResult(_0x455076,_0x5e87aa))[_0x3d87('0x2a')](handleError(_0x455076,null));};exports['show']=function(_0x52a46d,_0xd7ab35){var _0x341283={'raw':![],'where':{'id':_0x52a46d[_0x3d87('0x54')]['id']}},_0x412bf0={};_0x412bf0[_0x3d87('0x41')]=_[_0x3d87('0x55')](db[_0x3d87('0x3c')][_0x3d87('0x3d')]);_0x412bf0[_0x3d87('0x42')]=_[_0x3d87('0x55')](_0x52a46d[_0x3d87('0x42')]);_0x412bf0[_0x3d87('0x4b')]=_['intersection'](_0x412bf0['model'],_0x412bf0[_0x3d87('0x42')]);_0x341283[_0x3d87('0x45')]=_['intersection'](_0x412bf0[_0x3d87('0x41')],qs[_0x3d87('0x44')](_0x52a46d[_0x3d87('0x42')][_0x3d87('0x44')]));_0x341283[_0x3d87('0x45')]=_0x341283[_0x3d87('0x45')][_0x3d87('0x46')]?_0x341283[_0x3d87('0x45')]:_0x412bf0[_0x3d87('0x41')];if(_0x52a46d[_0x3d87('0x42')]['includeAll']){_0x341283[_0x3d87('0x51')]=[{'all':!![]}];}_0x341283=_['merge']({},_0x341283,_0x52a46d[_0x3d87('0x4f')]);return db[_0x3d87('0x3c')][_0x3d87('0x56')](_0x341283)['then'](handleEntityNotFound(_0xd7ab35,null))[_0x3d87('0x20')](respondWithResult(_0xd7ab35,null))[_0x3d87('0x2a')](handleError(_0xd7ab35,null));};exports[_0x3d87('0x57')]=function(_0x4f182d,_0x244511){return db[_0x3d87('0x3c')]['create'](_0x4f182d['body'],{})['then'](respondWithResult(_0x244511,0xc9))['catch'](handleError(_0x244511,null));};exports[_0x3d87('0x35')]=function(_0x51a687,_0x3b762d){if(_0x51a687['body']['id']){delete _0x51a687[_0x3d87('0x58')]['id'];}return db['FreshsalesAccount'][_0x3d87('0x56')]({'where':{'id':_0x51a687[_0x3d87('0x54')]['id']}})[_0x3d87('0x20')](handleEntityNotFound(_0x3b762d,null))[_0x3d87('0x20')](saveUpdates(_0x51a687[_0x3d87('0x58')],null))['then'](respondWithResult(_0x3b762d,null))[_0x3d87('0x2a')](handleError(_0x3b762d,null));};exports[_0x3d87('0x36')]=function(_0x71ea1,_0x5a6b3f){return db['FreshsalesAccount'][_0x3d87('0x56')]({'where':{'id':_0x71ea1[_0x3d87('0x54')]['id']}})[_0x3d87('0x20')](handleEntityNotFound(_0x5a6b3f,null))[_0x3d87('0x20')](removeEntity(_0x5a6b3f,null))[_0x3d87('0x2a')](handleError(_0x5a6b3f,null));};exports[_0x3d87('0x59')]=function(_0x5c5af2,_0x3cc81f,_0x47fc0f){var _0x17900b={};var _0x5ee4ae={};var _0x4f1d03;var _0x2e5a4b;return db[_0x3d87('0x3c')][_0x3d87('0x5a')]({'where':{'id':_0x5c5af2['params']['id']}})[_0x3d87('0x20')](handleEntityNotFound(_0x3cc81f,null))[_0x3d87('0x20')](function(_0x581c1e){if(_0x581c1e){_0x4f1d03=_0x581c1e;_0x5ee4ae[_0x3d87('0x41')]=_[_0x3d87('0x55')](db['FreshsalesConfiguration'][_0x3d87('0x3d')]);_0x5ee4ae['query']=_[_0x3d87('0x55')](_0x5c5af2[_0x3d87('0x42')]);_0x5ee4ae['filters']=_[_0x3d87('0x43')](_0x5ee4ae[_0x3d87('0x41')],_0x5ee4ae[_0x3d87('0x42')]);_0x17900b['attributes']=_[_0x3d87('0x43')](_0x5ee4ae['model'],qs[_0x3d87('0x44')](_0x5c5af2[_0x3d87('0x42')][_0x3d87('0x44')]));_0x17900b['attributes']=_0x17900b[_0x3d87('0x45')]['length']?_0x17900b[_0x3d87('0x45')]:_0x5ee4ae[_0x3d87('0x41')];_0x17900b[_0x3d87('0x48')]=qs[_0x3d87('0x49')](_0x5c5af2['query'][_0x3d87('0x49')]);_0x17900b[_0x3d87('0x4a')]=qs[_0x3d87('0x4b')](_[_0x3d87('0x5b')](_0x5c5af2['query'],_0x5ee4ae['filters']));if(_0x5c5af2[_0x3d87('0x42')][_0x3d87('0x4c')]){_0x17900b[_0x3d87('0x4a')]=_[_0x3d87('0x4d')](_0x17900b[_0x3d87('0x4a')],{'$or':_['map'](_0x17900b[_0x3d87('0x45')],function(_0x313103){var _0x45b5b9={};_0x45b5b9[_0x313103]={'$like':'%'+_0x5c5af2[_0x3d87('0x42')]['filter']+'%'};return _0x45b5b9;})});}_0x17900b=_[_0x3d87('0x4d')]({},_0x17900b,_0x5c5af2['options']);return _0x4f1d03['getConfigurations'](_0x17900b);}})[_0x3d87('0x20')](function(_0x23ed0b){if(_0x23ed0b){_0x2e5a4b=_0x23ed0b[_0x3d87('0x46')];if(!_0x5c5af2[_0x3d87('0x42')][_0x3d87('0x47')](_0x3d87('0x5c'))){_0x17900b['limit']=qs['limit'](_0x5c5af2[_0x3d87('0x42')]['limit']);_0x17900b[_0x3d87('0x2d')]=qs[_0x3d87('0x2d')](_0x5c5af2[_0x3d87('0x42')][_0x3d87('0x2d')]);}return _0x4f1d03['getConfigurations'](_0x17900b);}})[_0x3d87('0x20')](function(_0x57f87e){if(_0x57f87e){return _0x57f87e?{'count':_0x2e5a4b,'rows':_0x57f87e}:null;}})[_0x3d87('0x20')](respondWithResult(_0x3cc81f,null))[_0x3d87('0x2a')](handleError(_0x3cc81f,null));};exports[_0x3d87('0x5d')]=function(_0x151a6a,_0x2f7fe4,_0x398591){if(_0x151a6a[_0x3d87('0x58')]['id']){delete _0x151a6a[_0x3d87('0x58')]['id'];}return db[_0x3d87('0x3c')]['findOne']({'where':{'id':_0x151a6a[_0x3d87('0x54')]['id']}})[_0x3d87('0x20')](handleEntityNotFound(_0x2f7fe4,null))[_0x3d87('0x20')](function(_0x5d5a26){if(_0x5d5a26){_0x151a6a['body']['AccountId']=_0x5d5a26['id'];_0x151a6a[_0x3d87('0x58')][_0x3d87('0x5e')]=integrations[_0x3d87('0x5f')](_0x151a6a[_0x3d87('0x58')]['channel'],_0x151a6a['body'][_0x3d87('0x3f')]);_0x151a6a['body'][_0x3d87('0x60')]=integrations[_0x3d87('0x61')](_0x151a6a['body'][_0x3d87('0x62')],_0x151a6a[_0x3d87('0x58')]['type']);return db[_0x3d87('0x63')][_0x3d87('0x57')](_0x151a6a[_0x3d87('0x58')],{'include':[{'model':db[_0x3d87('0x64')],'as':_0x3d87('0x5e')},{'model':db[_0x3d87('0x64')],'as':_0x3d87('0x60')}]});}return null;})[_0x3d87('0x20')](respondWithResult(_0x2f7fe4,null))[_0x3d87('0x2a')](handleError(_0x2f7fe4,null));};exports['getFields']=function(_0x261ed9,_0x45f4c1,_0x258983){var _0x5b8520='';var _0x4c7d91='';return db[_0x3d87('0x3c')][_0x3d87('0x5a')]({'where':{'id':_0x261ed9[_0x3d87('0x54')]['id']},'attributes':['id',_0x3d87('0x65'),_0x3d87('0x66'),_0x3d87('0x67')]})['then'](handleEntityNotFound(_0x45f4c1,null))[_0x3d87('0x20')](function(_0x11e15d){if(_0x11e15d){_0x4c7d91=_0x11e15d['username'];_0x5b8520=_0x11e15d['remoteUri'];var _0x767d5e=_0x11e15d[_0x3d87('0x66')][_0x3d87('0x68')](-0x1);if(_0x767d5e==='/'){_0x5b8520=_0x5b8520[_0x3d87('0x69')](0x0,_0x5b8520[_0x3d87('0x6a')](_0x767d5e));}return rp({'method':'GET','uri':util[_0x3d87('0x6b')](_0x3d87('0x6c'),_0x5b8520,_0x3d87('0x6d')),'headers':{'Authorization':_0x3d87('0x6e')+_0x11e15d[_0x3d87('0x67')]},'json':!![]});}})[_0x3d87('0x20')](function(_0x502b5c){if(_0x502b5c){var _0x2a1bca=_0x502b5c[_0x3d87('0x6f')];var _0xe2b3ce=![];var _0x3b66d3=null;for(_0x3b66d3=0x0;_0x3b66d3<_0x2a1bca[_0x3d87('0x46')];_0x3b66d3++){if(_0x2a1bca[_0x3b66d3]['email']===_0x4c7d91){_0xe2b3ce=!![];}}if(_0xe2b3ce){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3d87('0x70')});}}})[_0x3d87('0x20')](respondWithResult(_0x45f4c1,null))[_0x3d87('0x2a')](function(_0x2f450e){var _0x322910=_0x261ed9['query'][_0x3d87('0x71')]?0x1f4:_0x2f450e[_0x3d87('0x72')]||0x1f4;logger[_0x3d87('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x3d87('0x73'),_0x322910,JSON[_0x3d87('0x26')](_0x2f450e));delete _0x2f450e[_0x3d87('0x39')];if(_0x322910===0x191){_0x322910=0x190;}_0x45f4c1['status'](_0x322910)[_0x3d87('0x3a')](_0x261ed9[_0x3d87('0x42')][_0x3d87('0x71')]?{'message':_0x3d87('0x74'),'statusCode':_0x2f450e[_0x3d87('0x72')]}:_0x2f450e);});}; \ No newline at end of file +var _0x664c=['format','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','destroy','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','keys','create','body','find','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','FreshsalesField','getFields','remoteUri','username','substring','GET'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x664c,0x1ad));var _0xc664=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x664c[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xc664('0x0'));var emlformat=require(_0xc664('0x1'));var rimraf=require(_0xc664('0x2'));var zipdir=require(_0xc664('0x3'));var jsonpatch=require(_0xc664('0x4'));var rp=require(_0xc664('0x5'));var moment=require('moment');var BPromise=require(_0xc664('0x6'));var Mustache=require(_0xc664('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc664('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc664('0x9'));var squel=require('squel');var crypto=require(_0xc664('0xa'));var jsforce=require(_0xc664('0xb'));var deskjs=require(_0xc664('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc664('0xd'));var Papa=require(_0xc664('0xe'));var Redis=require(_0xc664('0xf'));var authService=require(_0xc664('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc664('0x11'));var hardwareService=require(_0xc664('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc664('0x13'));var db=require(_0xc664('0x14'))['db'];var integrations=require(_0xc664('0x15'));var jayson=require(_0xc664('0x16'));var client=jayson[_0xc664('0x17')][_0xc664('0x18')]({'port':0x232a});function checkPasswordPattern(_0x47b5c0,_0x4be781,_0x45517b){if(_0x45517b){var _0x4eeed2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4eeed2[_0xc664('0x19')](_0x4be781)){return _0x47b5c0;}else{throw new db[(_0xc664('0x1a'))][(_0xc664('0x1b'))](_0xc664('0x1c'));}}else{return _0x47b5c0;}}function respondWithRpcPromise(_0x48f0d7,_0x3eef7f,_0x196b82,_0x1ee774){return new BPromise(function(_0x574754,_0x126a67){var _0x14ed88=_0x1ee774||client;return _0x14ed88[_0xc664('0x1d')](_0x48f0d7,_0x196b82)[_0xc664('0x1e')](function(_0xb2751e){logger[_0xc664('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x3eef7f,_0xc664('0x20'));logger[_0xc664('0x21')](_0xc664('0x22'),_0x3eef7f,_0xc664('0x20'),JSON[_0xc664('0x23')](_0xb2751e));if(_0xb2751e[_0xc664('0x24')]){if(_0xb2751e[_0xc664('0x24')][_0xc664('0x25')]===0x1f4){logger['error'](_0xc664('0x26'),_0x3eef7f,_0xb2751e['error'][_0xc664('0x27')]);return _0x126a67(_0xb2751e['error']['message']);}logger[_0xc664('0x24')](_0xc664('0x26'),_0x3eef7f,_0xb2751e[_0xc664('0x24')][_0xc664('0x27')]);return _0x574754(_0xb2751e[_0xc664('0x24')][_0xc664('0x27')]);}else{logger[_0xc664('0x1f')](_0xc664('0x26'),_0x3eef7f,_0xc664('0x20'));_0x574754(_0xb2751e[_0xc664('0x28')][_0xc664('0x27')]);}})[_0xc664('0x29')](function(_0x834e9a){logger[_0xc664('0x24')](_0xc664('0x26'),_0x3eef7f,_0x834e9a);_0x126a67(_0x834e9a);});});}function respondWithStatusCode(_0xfcfd1e,_0x86adef){_0x86adef=_0x86adef||0xcc;return function(_0x4cf3d4){if(_0x4cf3d4){return _0xfcfd1e[_0xc664('0x2a')](_0x86adef);}return _0xfcfd1e[_0xc664('0x2b')](_0x86adef)[_0xc664('0x2c')]();};}function respondWithResult(_0x5eeb0d,_0xc0229e){_0xc0229e=_0xc0229e||0xc8;return function(_0x299310){if(_0x299310){return _0x5eeb0d[_0xc664('0x2b')](_0xc0229e)['json'](_0x299310);}};}function respondWithFilteredResult(_0x48c183,_0x2c4f22){return function(_0x2657f1){if(_0x2657f1){var _0x35b228=_0x2657f1['count'],_0x1551fe=_0x2c4f22['offset'],_0x479743=_0x2c4f22[_0xc664('0x2d')]+_0x2c4f22[_0xc664('0x2e')],_0x217ad0;if(_0x479743>=_0x35b228){_0x479743=_0x35b228;_0x217ad0=0xc8;}else{_0x217ad0=0xce;}_0x48c183[_0xc664('0x2b')](_0x217ad0);return _0x48c183[_0xc664('0x2f')]('Content-Range',_0x1551fe+'-'+_0x479743+'/'+_0x35b228)[_0xc664('0x30')](_0x2657f1);}return null;};}function patchUpdates(_0x532874){return function(_0x5649cc){try{jsonpatch[_0xc664('0x31')](_0x5649cc,_0x532874,!![]);}catch(_0x4275f9){return BPromise[_0xc664('0x32')](_0x4275f9);}return _0x5649cc[_0xc664('0x33')]();};}function saveUpdates(_0x4bcbe1,_0x1abfc6){return function(_0x35c7f6){if(_0x35c7f6){return _0x35c7f6[_0xc664('0x34')](_0x4bcbe1)[_0xc664('0x1e')](function(_0x2ad113){return _0x2ad113;});}return null;};}function removeEntity(_0x48bb16,_0x1107a2){return function(_0x464c6f){if(_0x464c6f){return _0x464c6f[_0xc664('0x35')]()[_0xc664('0x1e')](function(){_0x48bb16[_0xc664('0x2b')](0xcc)[_0xc664('0x2c')]();});}};}function handleEntityNotFound(_0x403d72,_0x121cce){return function(_0x25918a){if(!_0x25918a){_0x403d72[_0xc664('0x2a')](0x194);}return _0x25918a;};}function handleError(_0x3de0c5,_0x2088ed){_0x2088ed=_0x2088ed||0x1f4;return function(_0x1cc44f){logger[_0xc664('0x24')](_0x1cc44f['stack']);if(_0x1cc44f[_0xc664('0x36')]){delete _0x1cc44f[_0xc664('0x36')];}_0x3de0c5[_0xc664('0x2b')](_0x2088ed)[_0xc664('0x37')](_0x1cc44f);};}exports[_0xc664('0x38')]=function(_0x4cdba3,_0x539334){var _0xbd1259={},_0x374415={},_0xe3d3c={'count':0x0,'rows':[]};var _0x3754ee=_[_0xc664('0x39')](db[_0xc664('0x3a')][_0xc664('0x3b')],function(_0x476377){return{'name':_0x476377['fieldName'],'type':_0x476377[_0xc664('0x3c')][_0xc664('0x3d')]};});_0x374415['model']=_[_0xc664('0x39')](_0x3754ee,_0xc664('0x36'));_0x374415[_0xc664('0x3e')]=_['keys'](_0x4cdba3['query']);_0x374415[_0xc664('0x3f')]=_[_0xc664('0x40')](_0x374415[_0xc664('0x41')],_0x374415[_0xc664('0x3e')]);_0xbd1259['attributes']=_[_0xc664('0x40')](_0x374415['model'],qs[_0xc664('0x42')](_0x4cdba3[_0xc664('0x3e')][_0xc664('0x42')]));_0xbd1259[_0xc664('0x43')]=_0xbd1259['attributes'][_0xc664('0x44')]?_0xbd1259[_0xc664('0x43')]:_0x374415[_0xc664('0x41')];if(!_0x4cdba3[_0xc664('0x3e')][_0xc664('0x45')]('nolimit')){_0xbd1259[_0xc664('0x2e')]=qs[_0xc664('0x2e')](_0x4cdba3[_0xc664('0x3e')][_0xc664('0x2e')]);_0xbd1259[_0xc664('0x2d')]=qs[_0xc664('0x2d')](_0x4cdba3[_0xc664('0x3e')][_0xc664('0x2d')]);}_0xbd1259[_0xc664('0x46')]=qs[_0xc664('0x47')](_0x4cdba3[_0xc664('0x3e')]['sort']);_0xbd1259[_0xc664('0x48')]=qs[_0xc664('0x3f')](_['pick'](_0x4cdba3['query'],_0x374415[_0xc664('0x3f')]),_0x3754ee);if(_0x4cdba3['query'][_0xc664('0x49')]){_0xbd1259[_0xc664('0x48')]=_[_0xc664('0x4a')](_0xbd1259[_0xc664('0x48')],{'$or':_[_0xc664('0x39')](_0x3754ee,function(_0x1708d4){if(_0x1708d4[_0xc664('0x3c')]!==_0xc664('0x4b')){var _0x944944={};_0x944944[_0x1708d4['name']]={'$like':'%'+_0x4cdba3['query'][_0xc664('0x49')]+'%'};return _0x944944;}})});}_0xbd1259=_[_0xc664('0x4a')]({},_0xbd1259,_0x4cdba3[_0xc664('0x4c')]);var _0x5603ec={'where':_0xbd1259['where']};return db[_0xc664('0x3a')][_0xc664('0x4d')](_0x5603ec)[_0xc664('0x1e')](function(_0x2b155c){_0xe3d3c[_0xc664('0x4d')]=_0x2b155c;if(_0x4cdba3['query'][_0xc664('0x4e')]){_0xbd1259[_0xc664('0x4f')]=[{'all':!![]}];}return db[_0xc664('0x3a')]['findAll'](_0xbd1259);})['then'](function(_0x2b1ff6){_0xe3d3c[_0xc664('0x50')]=_0x2b1ff6;return _0xe3d3c;})[_0xc664('0x1e')](respondWithFilteredResult(_0x539334,_0xbd1259))['catch'](handleError(_0x539334,null));};exports['show']=function(_0x49c450,_0x7b2641){var _0x236779={'raw':![],'where':{'id':_0x49c450['params']['id']}},_0x1b4e1d={};_0x1b4e1d[_0xc664('0x41')]=_[_0xc664('0x51')](db[_0xc664('0x3a')]['rawAttributes']);_0x1b4e1d[_0xc664('0x3e')]=_[_0xc664('0x51')](_0x49c450[_0xc664('0x3e')]);_0x1b4e1d[_0xc664('0x3f')]=_['intersection'](_0x1b4e1d['model'],_0x1b4e1d[_0xc664('0x3e')]);_0x236779[_0xc664('0x43')]=_[_0xc664('0x40')](_0x1b4e1d['model'],qs[_0xc664('0x42')](_0x49c450[_0xc664('0x3e')][_0xc664('0x42')]));_0x236779['attributes']=_0x236779[_0xc664('0x43')][_0xc664('0x44')]?_0x236779[_0xc664('0x43')]:_0x1b4e1d['model'];if(_0x49c450['query'][_0xc664('0x4e')]){_0x236779['include']=[{'all':!![]}];}_0x236779=_[_0xc664('0x4a')]({},_0x236779,_0x49c450[_0xc664('0x4c')]);return db[_0xc664('0x3a')]['find'](_0x236779)[_0xc664('0x1e')](handleEntityNotFound(_0x7b2641,null))[_0xc664('0x1e')](respondWithResult(_0x7b2641,null))[_0xc664('0x29')](handleError(_0x7b2641,null));};exports[_0xc664('0x52')]=function(_0x1f2a4a,_0x59d410){return db['FreshsalesAccount']['create'](_0x1f2a4a['body'],{})[_0xc664('0x1e')](respondWithResult(_0x59d410,0xc9))[_0xc664('0x29')](handleError(_0x59d410,null));};exports[_0xc664('0x34')]=function(_0x5d0e62,_0x2ecd43){if(_0x5d0e62[_0xc664('0x53')]['id']){delete _0x5d0e62['body']['id'];}return db[_0xc664('0x3a')][_0xc664('0x54')]({'where':{'id':_0x5d0e62[_0xc664('0x55')]['id']}})[_0xc664('0x1e')](handleEntityNotFound(_0x2ecd43,null))[_0xc664('0x1e')](saveUpdates(_0x5d0e62['body'],null))[_0xc664('0x1e')](respondWithResult(_0x2ecd43,null))[_0xc664('0x29')](handleError(_0x2ecd43,null));};exports[_0xc664('0x35')]=function(_0xade90,_0x3ee750){return db[_0xc664('0x3a')][_0xc664('0x54')]({'where':{'id':_0xade90[_0xc664('0x55')]['id']}})[_0xc664('0x1e')](handleEntityNotFound(_0x3ee750,null))[_0xc664('0x1e')](removeEntity(_0x3ee750,null))['catch'](handleError(_0x3ee750,null));};exports[_0xc664('0x56')]=function(_0x375d14,_0x33fd9b,_0x364f70){var _0x2970c6={};var _0x39d12c={};var _0x2582b5;var _0x41a0fb;return db[_0xc664('0x3a')][_0xc664('0x57')]({'where':{'id':_0x375d14[_0xc664('0x55')]['id']}})[_0xc664('0x1e')](handleEntityNotFound(_0x33fd9b,null))['then'](function(_0x2a9234){if(_0x2a9234){_0x2582b5=_0x2a9234;_0x39d12c['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x39d12c[_0xc664('0x3e')]=_[_0xc664('0x51')](_0x375d14['query']);_0x39d12c['filters']=_[_0xc664('0x40')](_0x39d12c[_0xc664('0x41')],_0x39d12c[_0xc664('0x3e')]);_0x2970c6['attributes']=_[_0xc664('0x40')](_0x39d12c[_0xc664('0x41')],qs[_0xc664('0x42')](_0x375d14[_0xc664('0x3e')][_0xc664('0x42')]));_0x2970c6[_0xc664('0x43')]=_0x2970c6[_0xc664('0x43')]['length']?_0x2970c6[_0xc664('0x43')]:_0x39d12c[_0xc664('0x41')];_0x2970c6[_0xc664('0x46')]=qs[_0xc664('0x47')](_0x375d14['query'][_0xc664('0x47')]);_0x2970c6['where']=qs[_0xc664('0x3f')](_['pick'](_0x375d14[_0xc664('0x3e')],_0x39d12c[_0xc664('0x3f')]));if(_0x375d14[_0xc664('0x3e')]['filter']){_0x2970c6[_0xc664('0x48')]=_[_0xc664('0x4a')](_0x2970c6[_0xc664('0x48')],{'$or':_[_0xc664('0x39')](_0x2970c6['attributes'],function(_0x2a40ec){var _0x42f8b7={};_0x42f8b7[_0x2a40ec]={'$like':'%'+_0x375d14['query'][_0xc664('0x49')]+'%'};return _0x42f8b7;})});}_0x2970c6=_[_0xc664('0x4a')]({},_0x2970c6,_0x375d14[_0xc664('0x4c')]);return _0x2582b5['getConfigurations'](_0x2970c6);}})[_0xc664('0x1e')](function(_0x2856fd){if(_0x2856fd){_0x41a0fb=_0x2856fd['length'];if(!_0x375d14[_0xc664('0x3e')]['hasOwnProperty'](_0xc664('0x58'))){_0x2970c6[_0xc664('0x2e')]=qs[_0xc664('0x2e')](_0x375d14[_0xc664('0x3e')][_0xc664('0x2e')]);_0x2970c6['offset']=qs[_0xc664('0x2d')](_0x375d14[_0xc664('0x3e')][_0xc664('0x2d')]);}return _0x2582b5[_0xc664('0x56')](_0x2970c6);}})[_0xc664('0x1e')](function(_0x43aa4a){if(_0x43aa4a){return _0x43aa4a?{'count':_0x41a0fb,'rows':_0x43aa4a}:null;}})[_0xc664('0x1e')](respondWithResult(_0x33fd9b,null))[_0xc664('0x29')](handleError(_0x33fd9b,null));};exports[_0xc664('0x59')]=function(_0x362189,_0xccfaf0,_0x578ed6){if(_0x362189[_0xc664('0x53')]['id']){delete _0x362189[_0xc664('0x53')]['id'];}return db[_0xc664('0x3a')][_0xc664('0x57')]({'where':{'id':_0x362189[_0xc664('0x55')]['id']}})[_0xc664('0x1e')](handleEntityNotFound(_0xccfaf0,null))[_0xc664('0x1e')](function(_0x2e9619){if(_0x2e9619){_0x362189['body'][_0xc664('0x5a')]=_0x2e9619['id'];_0x362189['body'][_0xc664('0x5b')]=integrations[_0xc664('0x5c')](_0x362189[_0xc664('0x53')]['channel'],_0x362189[_0xc664('0x53')]['type']);_0x362189[_0xc664('0x53')][_0xc664('0x5d')]=integrations['getDescriptions'](_0x362189[_0xc664('0x53')][_0xc664('0x5e')],_0x362189[_0xc664('0x53')][_0xc664('0x3c')]);return db['FreshsalesConfiguration']['create'](_0x362189[_0xc664('0x53')],{'include':[{'model':db[_0xc664('0x5f')],'as':_0xc664('0x5b')},{'model':db['FreshsalesField'],'as':_0xc664('0x5d')}]});}return null;})[_0xc664('0x1e')](respondWithResult(_0xccfaf0,null))['catch'](handleError(_0xccfaf0,null));};exports[_0xc664('0x60')]=function(_0xd141c6,_0x353014,_0x43a261){var _0x279d4d='';var _0x1b0631='';return db[_0xc664('0x3a')]['findOne']({'where':{'id':_0xd141c6[_0xc664('0x55')]['id']},'attributes':['id','username',_0xc664('0x61'),'apiKey']})[_0xc664('0x1e')](handleEntityNotFound(_0x353014,null))[_0xc664('0x1e')](function(_0x814de0){if(_0x814de0){_0x1b0631=_0x814de0[_0xc664('0x62')];_0x279d4d=_0x814de0['remoteUri'];var _0x401a93=_0x814de0[_0xc664('0x61')]['slice'](-0x1);if(_0x401a93==='/'){_0x279d4d=_0x279d4d[_0xc664('0x63')](0x0,_0x279d4d['lastIndexOf'](_0x401a93));}return rp({'method':_0xc664('0x64'),'uri':util[_0xc664('0x65')]('%s%s',_0x279d4d,'/api/selector/owners'),'headers':{'Authorization':_0xc664('0x66')+_0x814de0['apiKey']},'json':!![]});}})[_0xc664('0x1e')](function(_0x40a947){if(_0x40a947){var _0x31bc9c=_0x40a947['users'];var _0x2160f1=![];var _0x14842d=null;for(_0x14842d=0x0;_0x14842d<_0x31bc9c[_0xc664('0x44')];_0x14842d++){if(_0x31bc9c[_0x14842d][_0xc664('0x67')]===_0x1b0631){_0x2160f1=!![];}}if(_0x2160f1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc664('0x68')});}}})['then'](respondWithResult(_0x353014,null))['catch'](function(_0x10911c){var _0x220b17=_0xd141c6[_0xc664('0x3e')][_0xc664('0x19')]?0x1f4:_0x10911c[_0xc664('0x69')]||0x1f4;logger[_0xc664('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xc664('0x60'),_0x220b17,JSON[_0xc664('0x23')](_0x10911c));delete _0x10911c[_0xc664('0x36')];if(_0x220b17===0x191){_0x220b17=0x190;}_0x353014[_0xc664('0x2b')](_0x220b17)[_0xc664('0x37')](_0xd141c6[_0xc664('0x3e')][_0xc664('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x10911c['statusCode']}:_0x10911c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 91dc8e2..082694e 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 _0xfd28=['moment','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','int_freshsales_accounts','util','../../config/logger'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xfd28,0x148));var _0x8fd2=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xfd28[_0x5d30b4];return _0x1acfb8;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));var integrations=require(_0x8fd2('0x7'));module[_0x8fd2('0x8')]=function(_0x36178a,_0x2f0afc){return _0x36178a['define']('FreshsalesAccount',attributes,{'tableName':_0x8fd2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b9b=['define','FreshsalesAccount','int_freshsales_accounts','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x9b9b,0x114));var _0xb9b9=function(_0x4a02e9,_0x5d7b67){_0x4a02e9=_0x4a02e9-0x0;var _0x229ed7=_0x9b9b[_0x4a02e9];return _0x229ed7;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));var integrations=require(_0xb9b9('0x8'));module[_0xb9b9('0x9')]=function(_0x3d1a95,_0x85eec){return _0x3d1a95[_0xb9b9('0xa')](_0xb9b9('0xb'),attributes,{'tableName':_0xb9b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 5605023..353985a 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 _0x9a2a=['ShowFreshsalesAccount','find','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','map','include','model'];(function(_0x338ac9,_0x4dc1af){var _0x673548=function(_0x4bb20c){while(--_0x4bb20c){_0x338ac9['push'](_0x338ac9['shift']());}};_0x673548(++_0x4dc1af);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x1383af,_0x29d2c3){_0x1383af=_0x1383af-0x0;var _0xbc03df=_0x9a2a[_0x1383af];return _0xbc03df;};'use strict';var _=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var moment=require(_0xa9a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9a2('0x3'))['db'];var utils=require(_0xa9a2('0x4'));var logger=require(_0xa9a2('0x5'))(_0xa9a2('0x6'));var config=require(_0xa9a2('0x7'));var jayson=require(_0xa9a2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388689,_0xb51739,_0xedae90){return new BPromise(function(_0x287343,_0xcd2750){return client[_0xa9a2('0x9')](_0x388689,_0xedae90)[_0xa9a2('0xa')](function(_0x26f1ce){logger[_0xa9a2('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0xb51739,_0xa9a2('0xc'));logger[_0xa9a2('0xd')](_0xa9a2('0xe'),_0xb51739,_0xa9a2('0xc'),JSON[_0xa9a2('0xf')](_0x26f1ce));if(_0x26f1ce[_0xa9a2('0x10')]){if(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x11')]===0x1f4){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce['error'][_0xa9a2('0x13')]);return _0xcd2750(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);return _0x287343(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}else{logger[_0xa9a2('0xb')](_0xa9a2('0x12'),_0xb51739,_0xa9a2('0xc'));_0x287343(_0x26f1ce[_0xa9a2('0x14')]['message']);}})[_0xa9a2('0x15')](function(_0xbb6546){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0xbb6546);_0xcd2750(_0xbb6546);});});}exports[_0xa9a2('0x16')]=function(_0x22993f){var _0x4e3f13=this;return new Promise(function(_0x677249,_0x11ca21){return db[_0xa9a2('0x17')][_0xa9a2('0x18')]({'raw':_0x22993f[_0xa9a2('0x19')]?_0x22993f[_0xa9a2('0x19')][_0xa9a2('0x1a')]===undefined?!![]:![]:!![],'where':_0x22993f[_0xa9a2('0x19')]?_0x22993f[_0xa9a2('0x19')]['where']||null:null,'attributes':_0x22993f['options']?_0x22993f['options'][_0xa9a2('0x1b')]||null:null,'limit':_0x22993f[_0xa9a2('0x19')]?_0x22993f[_0xa9a2('0x19')]['limit']||null:null,'include':_0x22993f[_0xa9a2('0x19')]?_0x22993f['options']['include']?_[_0xa9a2('0x1c')](_0x22993f['options'][_0xa9a2('0x1d')],function(_0x273f55){return{'model':db[_0x273f55['model']],'as':_0x273f55['as'],'attributes':_0x273f55[_0xa9a2('0x1b')],'include':_0x273f55[_0xa9a2('0x1d')]?_[_0xa9a2('0x1c')](_0x273f55[_0xa9a2('0x1d')],function(_0x21078c){return{'model':db[_0x21078c['model']],'as':_0x21078c['as'],'attributes':_0x21078c[_0xa9a2('0x1b')],'include':_0x21078c[_0xa9a2('0x1d')]?_['map'](_0x21078c[_0xa9a2('0x1d')],function(_0x3cdcfe){return{'model':db[_0x3cdcfe[_0xa9a2('0x1e')]],'as':_0x3cdcfe['as'],'attributes':_0x3cdcfe[_0xa9a2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa9a2('0xa')](function(_0x52d7e3){logger[_0xa9a2('0xb')]('GetFreshsalesAccount',_0x22993f);logger[_0xa9a2('0xd')](_0xa9a2('0x16'),_0x22993f,JSON['stringify'](_0x52d7e3));_0x677249(_0x52d7e3);})['catch'](function(_0x4b2d65){logger['error'](_0xa9a2('0x16'),_0x4b2d65[_0xa9a2('0x13')],_0x22993f);_0x11ca21(_0x4e3f13[_0xa9a2('0x10')](0x1f4,_0x4b2d65[_0xa9a2('0x13')]));});});};exports[_0xa9a2('0x1f')]=function(_0x34e754){var _0x409b4f=this;return new Promise(function(_0x3c035c,_0x5b7e8a){return db[_0xa9a2('0x17')][_0xa9a2('0x20')]({'raw':_0x34e754[_0xa9a2('0x19')]?_0x34e754[_0xa9a2('0x19')][_0xa9a2('0x1a')]===undefined?!![]:![]:!![],'where':_0x34e754[_0xa9a2('0x19')]?_0x34e754[_0xa9a2('0x19')]['where']||null:null,'attributes':_0x34e754[_0xa9a2('0x19')]?_0x34e754[_0xa9a2('0x19')][_0xa9a2('0x1b')]||null:null,'include':_0x34e754[_0xa9a2('0x19')]?_0x34e754[_0xa9a2('0x19')]['include']?_[_0xa9a2('0x1c')](_0x34e754[_0xa9a2('0x19')]['include'],function(_0x4a3fc0){return{'model':db[_0x4a3fc0[_0xa9a2('0x1e')]],'as':_0x4a3fc0['as'],'attributes':_0x4a3fc0[_0xa9a2('0x1b')],'include':_0x4a3fc0[_0xa9a2('0x1d')]?_[_0xa9a2('0x1c')](_0x4a3fc0[_0xa9a2('0x1d')],function(_0x4af21b){return{'model':db[_0x4af21b[_0xa9a2('0x1e')]],'as':_0x4af21b['as'],'attributes':_0x4af21b[_0xa9a2('0x1b')],'include':_0x4af21b[_0xa9a2('0x1d')]?_['map'](_0x4af21b[_0xa9a2('0x1d')],function(_0x172ee7){return{'model':db[_0x172ee7[_0xa9a2('0x1e')]],'as':_0x172ee7['as'],'attributes':_0x172ee7['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9a2('0xa')](function(_0x155abc){logger[_0xa9a2('0xb')](_0xa9a2('0x1f'),_0x34e754);logger[_0xa9a2('0xd')](_0xa9a2('0x1f'),_0x34e754,JSON[_0xa9a2('0xf')](_0x155abc));_0x3c035c(_0x155abc);})[_0xa9a2('0x15')](function(_0x152c6f){logger[_0xa9a2('0x10')](_0xa9a2('0x1f'),_0x152c6f[_0xa9a2('0x13')],_0x34e754);_0x5b7e8a(_0x409b4f[_0xa9a2('0x10')](0x1f4,_0x152c6f[_0xa9a2('0x13')]));});});}; \ No newline at end of file +var _0x01d9=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','ShowFreshsalesAccount','find','where','stringify','lodash','util','moment'];(function(_0x4c0e4f,_0x311307){var _0x27aafe=function(_0x2b13a4){while(--_0x2b13a4){_0x4c0e4f['push'](_0x4c0e4f['shift']());}};_0x27aafe(++_0x311307);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});}exports[_0x901d('0x17')]=function(_0x285353){var _0x403db9=this;return new Promise(function(_0x38f42b,_0x414171){return db[_0x901d('0x18')][_0x901d('0x19')]({'raw':_0x285353['options']?_0x285353[_0x901d('0x1a')][_0x901d('0x1b')]===undefined?!![]:![]:!![],'where':_0x285353['options']?_0x285353['options']['where']||null:null,'attributes':_0x285353['options']?_0x285353[_0x901d('0x1a')][_0x901d('0x1c')]||null:null,'limit':_0x285353['options']?_0x285353[_0x901d('0x1a')][_0x901d('0x1d')]||null:null,'include':_0x285353['options']?_0x285353[_0x901d('0x1a')][_0x901d('0x1e')]?_[_0x901d('0x1f')](_0x285353[_0x901d('0x1a')][_0x901d('0x1e')],function(_0x1818d3){return{'model':db[_0x1818d3[_0x901d('0x20')]],'as':_0x1818d3['as'],'attributes':_0x1818d3[_0x901d('0x1c')],'include':_0x1818d3['include']?_[_0x901d('0x1f')](_0x1818d3[_0x901d('0x1e')],function(_0xbc89a5){return{'model':db[_0xbc89a5[_0x901d('0x20')]],'as':_0xbc89a5['as'],'attributes':_0xbc89a5['attributes'],'include':_0xbc89a5[_0x901d('0x1e')]?_[_0x901d('0x1f')](_0xbc89a5[_0x901d('0x1e')],function(_0x3cbe43){return{'model':db[_0x3cbe43[_0x901d('0x20')]],'as':_0x3cbe43['as'],'attributes':_0x3cbe43['attributes']};}):[]};}):[]};}):[]:[]})[_0x901d('0xd')](function(_0xc52d0f){logger[_0x901d('0xe')](_0x901d('0x17'),_0x285353);logger[_0x901d('0x11')](_0x901d('0x17'),_0x285353,JSON['stringify'](_0xc52d0f));_0x38f42b(_0xc52d0f);})[_0x901d('0x16')](function(_0x533038){logger[_0x901d('0x12')](_0x901d('0x17'),_0x533038[_0x901d('0x14')],_0x285353);_0x414171(_0x403db9[_0x901d('0x12')](0x1f4,_0x533038[_0x901d('0x14')]));});});};exports[_0x901d('0x21')]=function(_0x4137b7){var _0x115676=this;return new Promise(function(_0x530c4b,_0x336f28){return db[_0x901d('0x18')][_0x901d('0x22')]({'raw':_0x4137b7[_0x901d('0x1a')]?_0x4137b7[_0x901d('0x1a')][_0x901d('0x1b')]===undefined?!![]:![]:!![],'where':_0x4137b7['options']?_0x4137b7[_0x901d('0x1a')][_0x901d('0x23')]||null:null,'attributes':_0x4137b7[_0x901d('0x1a')]?_0x4137b7['options'][_0x901d('0x1c')]||null:null,'include':_0x4137b7[_0x901d('0x1a')]?_0x4137b7[_0x901d('0x1a')][_0x901d('0x1e')]?_[_0x901d('0x1f')](_0x4137b7[_0x901d('0x1a')][_0x901d('0x1e')],function(_0x1b8d3){return{'model':db[_0x1b8d3[_0x901d('0x20')]],'as':_0x1b8d3['as'],'attributes':_0x1b8d3[_0x901d('0x1c')],'include':_0x1b8d3['include']?_['map'](_0x1b8d3[_0x901d('0x1e')],function(_0x4e66b4){return{'model':db[_0x4e66b4[_0x901d('0x20')]],'as':_0x4e66b4['as'],'attributes':_0x4e66b4[_0x901d('0x1c')],'include':_0x4e66b4['include']?_[_0x901d('0x1f')](_0x4e66b4[_0x901d('0x1e')],function(_0x2f5e22){return{'model':db[_0x2f5e22['model']],'as':_0x2f5e22['as'],'attributes':_0x2f5e22[_0x901d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x901d('0xd')](function(_0x1a1f9c){logger[_0x901d('0xe')](_0x901d('0x21'),_0x4137b7);logger[_0x901d('0x11')](_0x901d('0x21'),_0x4137b7,JSON[_0x901d('0x24')](_0x1a1f9c));_0x530c4b(_0x1a1f9c);})[_0x901d('0x16')](function(_0x384d82){logger[_0x901d('0x12')](_0x901d('0x21'),_0x384d82[_0x901d('0x14')],_0x4137b7);_0x336f28(_0x115676[_0x901d('0x12')](0x1f4,_0x384d82[_0x901d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 66d72ea..28c2f33 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 _0x5c09=['exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x5c09,0x143));var _0x95c0=function(_0x4b2092,_0x458854){_0x4b2092=_0x4b2092-0x0;var _0x2337c1=_0x5c09[_0x4b2092];return _0x2337c1;};'use strict';var multer=require('multer');var util=require(_0x95c0('0x0'));var path=require('path');var timeout=require(_0x95c0('0x1'));var express=require(_0x95c0('0x2'));var router=express['Router']();var auth=require(_0x95c0('0x3'));var interaction=require(_0x95c0('0x4'));var config=require(_0x95c0('0x5'));var controller=require(_0x95c0('0x6'));router['get']('/',auth[_0x95c0('0x7')](),controller[_0x95c0('0x8')]);router[_0x95c0('0x9')](_0x95c0('0xa'),auth[_0x95c0('0x7')](),controller['show']);router[_0x95c0('0x9')](_0x95c0('0xb'),auth[_0x95c0('0x7')](),controller[_0x95c0('0xc')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x95c0('0xd')]);router['get'](_0x95c0('0xe'),auth[_0x95c0('0x7')](),controller[_0x95c0('0xf')]);router[_0x95c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x95c0('0x11')]);router[_0x95c0('0x12')](_0x95c0('0xa'),auth[_0x95c0('0x7')](),controller[_0x95c0('0x13')]);router[_0x95c0('0x14')](_0x95c0('0xa'),auth['isAuthenticated'](),controller[_0x95c0('0x15')]);module[_0x95c0('0x16')]=router; \ No newline at end of file +var _0x1ad2=['getFields','create','exports','multer','util','path','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions'];(function(_0x4f5537,_0x1b1f5c){var _0x4d31f9=function(_0x3b6e30){while(--_0x3b6e30){_0x4f5537['push'](_0x4f5537['shift']());}};_0x4d31f9(++_0x1b1f5c);}(_0x1ad2,0x19b));var _0x21ad=function(_0xe1b111,_0x5661dc){_0xe1b111=_0xe1b111-0x0;var _0x339286=_0x1ad2[_0xe1b111];return _0x339286;};'use strict';var multer=require(_0x21ad('0x0'));var util=require(_0x21ad('0x1'));var path=require(_0x21ad('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x21ad('0x3'));var config=require(_0x21ad('0x4'));var controller=require(_0x21ad('0x5'));router[_0x21ad('0x6')]('/',auth[_0x21ad('0x7')](),controller[_0x21ad('0x8')]);router['get'](_0x21ad('0x9'),auth[_0x21ad('0x7')](),controller[_0x21ad('0xa')]);router['get'](_0x21ad('0xb'),auth[_0x21ad('0x7')](),controller[_0x21ad('0xc')]);router[_0x21ad('0x6')]('/:id/descriptions',auth[_0x21ad('0x7')](),controller[_0x21ad('0xd')]);router[_0x21ad('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x21ad('0xe')]);router['post']('/',auth[_0x21ad('0x7')](),controller[_0x21ad('0xf')]);router['put'](_0x21ad('0x9'),auth[_0x21ad('0x7')](),controller['update']);router['delete'](_0x21ad('0x9'),auth[_0x21ad('0x7')](),controller['destroy']);module[_0x21ad('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1b5c7d7..5b1dbb8 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 _0x1f35=['STRING','sequelize','exports'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x1f35,0x121));var _0x51f3=function(_0x41a4bf,_0x514209){_0x41a4bf=_0x41a4bf-0x0;var _0x262d84=_0x1f35[_0x41a4bf];return _0x262d84;};'use strict';var Sequelize=require(_0x51f3('0x0'));module[_0x51f3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x51f3('0x2')]}}; \ No newline at end of file +var _0xbdc4=['STRING','exports'];(function(_0x150994,_0x3ab8ca){var _0x249f7a=function(_0x498ef3){while(--_0x498ef3){_0x150994['push'](_0x150994['shift']());}};_0x249f7a(++_0x3ab8ca);}(_0xbdc4,0x195));var _0x4bdc=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xbdc4[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require('sequelize');module[_0x4bdc('0x0')]={'name':{'type':Sequelize[_0x4bdc('0x1')]},'description':{'type':Sequelize[_0x4bdc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 60be038..6cca888 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 _0xb67e=['request-promise','bluebird','path','sox','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','status','end','count','offset','set','json','apply','save','then','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','update','body','find','getSubjects','getDescriptions','getFields','findOne','FreshsalesField','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x16bc50,_0x2cdca7){var _0x44ecdf=function(_0x4c7951){while(--_0x4c7951){_0x16bc50['push'](_0x16bc50['shift']());}};_0x44ecdf(++_0x2cdca7);}(_0xb67e,0x15c));var _0xeb67=function(_0x2e73bb,_0x5db782){_0x2e73bb=_0x2e73bb-0x0;var _0xe016c5=_0xb67e[_0x2e73bb];return _0xe016c5;};'use strict';var pdf=require(_0xeb67('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeb67('0x1'));var zipdir=require(_0xeb67('0x2'));var jsonpatch=require(_0xeb67('0x3'));var rp=require(_0xeb67('0x4'));var moment=require('moment');var BPromise=require(_0xeb67('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeb67('0x6'));var sox=require(_0xeb67('0x7'));var csv=require('to-csv');var ejs=require(_0xeb67('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeb67('0x9'));var jsforce=require(_0xeb67('0xa'));var deskjs=require(_0xeb67('0xb'));var toCsv=require('to-csv');var querystring=require(_0xeb67('0xc'));var Papa=require('papaparse');var Redis=require(_0xeb67('0xd'));var authService=require(_0xeb67('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb67('0xf'));var logger=require(_0xeb67('0x10'))(_0xeb67('0x11'));var utils=require(_0xeb67('0x12'));var config=require(_0xeb67('0x13'));var db=require(_0xeb67('0x14'))['db'];var jayson=require(_0xeb67('0x15'));var client=jayson[_0xeb67('0x16')][_0xeb67('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23db29,_0x49cdf0,_0x3e6bff){if(_0x3e6bff){var _0x4fb458=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fb458[_0xeb67('0x18')](_0x49cdf0)){return _0x23db29;}else{throw new db[(_0xeb67('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 _0x23db29;}}function respondWithRpcPromise(_0x39f042,_0x3808ab,_0x238536,_0x57ffd4){return new BPromise(function(_0x33dcf9,_0x2a596d){var _0x3793bc=_0x57ffd4||client;return _0x3793bc[_0xeb67('0x1a')](_0x39f042,_0x238536)['then'](function(_0x3fe37d){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3808ab,_0xeb67('0x1b'));logger[_0xeb67('0x1c')](_0xeb67('0x1d'),_0x3808ab,_0xeb67('0x1b'),JSON[_0xeb67('0x1e')](_0x3fe37d));if(_0x3fe37d['error']){if(_0x3fe37d[_0xeb67('0x1f')][_0xeb67('0x20')]===0x1f4){logger[_0xeb67('0x1f')](_0xeb67('0x21'),_0x3808ab,_0x3fe37d[_0xeb67('0x1f')][_0xeb67('0x22')]);return _0x2a596d(_0x3fe37d['error'][_0xeb67('0x22')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3808ab,_0x3fe37d[_0xeb67('0x1f')][_0xeb67('0x22')]);return _0x33dcf9(_0x3fe37d[_0xeb67('0x1f')][_0xeb67('0x22')]);}else{logger[_0xeb67('0x23')](_0xeb67('0x21'),_0x3808ab,_0xeb67('0x1b'));_0x33dcf9(_0x3fe37d['result'][_0xeb67('0x22')]);}})['catch'](function(_0x514c90){logger[_0xeb67('0x1f')](_0xeb67('0x21'),_0x3808ab,_0x514c90);_0x2a596d(_0x514c90);});});}function respondWithStatusCode(_0x2908fa,_0x524722){_0x524722=_0x524722||0xcc;return function(_0x5efba5){if(_0x5efba5){return _0x2908fa['sendStatus'](_0x524722);}return _0x2908fa[_0xeb67('0x24')](_0x524722)[_0xeb67('0x25')]();};}function respondWithResult(_0xd5a2c1,_0x5edac5){_0x5edac5=_0x5edac5||0xc8;return function(_0x5c26b1){if(_0x5c26b1){return _0xd5a2c1[_0xeb67('0x24')](_0x5edac5)['json'](_0x5c26b1);}};}function respondWithFilteredResult(_0x184ec3,_0xfc36ba){return function(_0x13a36e){if(_0x13a36e){var _0x36786e=_0x13a36e[_0xeb67('0x26')],_0x2adc7e=_0xfc36ba[_0xeb67('0x27')],_0x121145=_0xfc36ba[_0xeb67('0x27')]+_0xfc36ba['limit'],_0x12045a;if(_0x121145>=_0x36786e){_0x121145=_0x36786e;_0x12045a=0xc8;}else{_0x12045a=0xce;}_0x184ec3[_0xeb67('0x24')](_0x12045a);return _0x184ec3[_0xeb67('0x28')]('Content-Range',_0x2adc7e+'-'+_0x121145+'/'+_0x36786e)[_0xeb67('0x29')](_0x13a36e);}return null;};}function patchUpdates(_0x2a6037){return function(_0x13638a){try{jsonpatch[_0xeb67('0x2a')](_0x13638a,_0x2a6037,!![]);}catch(_0x36baf1){return BPromise['reject'](_0x36baf1);}return _0x13638a[_0xeb67('0x2b')]();};}function saveUpdates(_0x483a3f,_0x16b1b9){return function(_0x36781b){if(_0x36781b){return _0x36781b['update'](_0x483a3f)[_0xeb67('0x2c')](function(_0x21c2cb){return _0x21c2cb;});}return null;};}function removeEntity(_0x2ee5a8,_0x16c24b){return function(_0xfecd87){if(_0xfecd87){return _0xfecd87['destroy']()[_0xeb67('0x2c')](function(){_0x2ee5a8[_0xeb67('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b72b,_0x1be90d){return function(_0x85706f){if(!_0x85706f){_0x41b72b['sendStatus'](0x194);}return _0x85706f;};}function handleError(_0x531431,_0x59d1cb){_0x59d1cb=_0x59d1cb||0x1f4;return function(_0x36f9b1){logger['error'](_0x36f9b1['stack']);if(_0x36f9b1['name']){delete _0x36f9b1[_0xeb67('0x2d')];}_0x531431[_0xeb67('0x24')](_0x59d1cb)[_0xeb67('0x2e')](_0x36f9b1);};}exports[_0xeb67('0x2f')]=function(_0x25fff6,_0x23c009){var _0x1c618c={},_0x5c6353={},_0x297594={'count':0x0,'rows':[]};var _0x2af3af=_[_0xeb67('0x30')](db[_0xeb67('0x31')]['rawAttributes'],function(_0x3d9119){return{'name':_0x3d9119[_0xeb67('0x32')],'type':_0x3d9119[_0xeb67('0x33')][_0xeb67('0x34')]};});_0x5c6353[_0xeb67('0x35')]=_['map'](_0x2af3af,'name');_0x5c6353['query']=_[_0xeb67('0x36')](_0x25fff6['query']);_0x5c6353[_0xeb67('0x37')]=_[_0xeb67('0x38')](_0x5c6353[_0xeb67('0x35')],_0x5c6353[_0xeb67('0x39')]);_0x1c618c['attributes']=_[_0xeb67('0x38')](_0x5c6353[_0xeb67('0x35')],qs['fields'](_0x25fff6[_0xeb67('0x39')][_0xeb67('0x3a')]));_0x1c618c[_0xeb67('0x3b')]=_0x1c618c[_0xeb67('0x3b')][_0xeb67('0x3c')]?_0x1c618c['attributes']:_0x5c6353[_0xeb67('0x35')];if(!_0x25fff6[_0xeb67('0x39')][_0xeb67('0x3d')](_0xeb67('0x3e'))){_0x1c618c[_0xeb67('0x3f')]=qs[_0xeb67('0x3f')](_0x25fff6['query'][_0xeb67('0x3f')]);_0x1c618c[_0xeb67('0x27')]=qs[_0xeb67('0x27')](_0x25fff6[_0xeb67('0x39')][_0xeb67('0x27')]);}_0x1c618c[_0xeb67('0x40')]=qs[_0xeb67('0x41')](_0x25fff6[_0xeb67('0x39')][_0xeb67('0x41')]);_0x1c618c[_0xeb67('0x42')]=qs['filters'](_[_0xeb67('0x43')](_0x25fff6[_0xeb67('0x39')],_0x5c6353[_0xeb67('0x37')]),_0x2af3af);if(_0x25fff6[_0xeb67('0x39')]['filter']){_0x1c618c[_0xeb67('0x42')]=_['merge'](_0x1c618c[_0xeb67('0x42')],{'$or':_[_0xeb67('0x30')](_0x2af3af,function(_0x1c2023){if(_0x1c2023[_0xeb67('0x33')]!==_0xeb67('0x44')){var _0x11b558={};_0x11b558[_0x1c2023[_0xeb67('0x2d')]]={'$like':'%'+_0x25fff6[_0xeb67('0x39')][_0xeb67('0x45')]+'%'};return _0x11b558;}})});}_0x1c618c=_[_0xeb67('0x46')]({},_0x1c618c,_0x25fff6[_0xeb67('0x47')]);var _0x44bd6d={'where':_0x1c618c[_0xeb67('0x42')]};return db['FreshsalesConfiguration'][_0xeb67('0x26')](_0x44bd6d)['then'](function(_0x444fe0){_0x297594[_0xeb67('0x26')]=_0x444fe0;if(_0x25fff6[_0xeb67('0x39')][_0xeb67('0x48')]){_0x1c618c[_0xeb67('0x49')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1c618c);})['then'](function(_0x18f3bd){_0x297594[_0xeb67('0x4a')]=_0x18f3bd;return _0x297594;})[_0xeb67('0x2c')](respondWithFilteredResult(_0x23c009,_0x1c618c))[_0xeb67('0x4b')](handleError(_0x23c009,null));};exports[_0xeb67('0x4c')]=function(_0x2481ff,_0x2d2fce){var _0x44d6cc={'raw':![],'where':{'id':_0x2481ff[_0xeb67('0x4d')]['id']}},_0x2b1971={};_0x2b1971[_0xeb67('0x35')]=_[_0xeb67('0x36')](db[_0xeb67('0x31')][_0xeb67('0x4e')]);_0x2b1971[_0xeb67('0x39')]=_[_0xeb67('0x36')](_0x2481ff[_0xeb67('0x39')]);_0x2b1971[_0xeb67('0x37')]=_[_0xeb67('0x38')](_0x2b1971[_0xeb67('0x35')],_0x2b1971[_0xeb67('0x39')]);_0x44d6cc[_0xeb67('0x3b')]=_[_0xeb67('0x38')](_0x2b1971['model'],qs[_0xeb67('0x3a')](_0x2481ff[_0xeb67('0x39')][_0xeb67('0x3a')]));_0x44d6cc[_0xeb67('0x3b')]=_0x44d6cc[_0xeb67('0x3b')]['length']?_0x44d6cc[_0xeb67('0x3b')]:_0x2b1971['model'];if(_0x2481ff['query'][_0xeb67('0x48')]){_0x44d6cc[_0xeb67('0x49')]=[{'all':!![]}];}_0x44d6cc=_[_0xeb67('0x46')]({},_0x44d6cc,_0x2481ff[_0xeb67('0x47')]);return db[_0xeb67('0x31')]['find'](_0x44d6cc)[_0xeb67('0x2c')](handleEntityNotFound(_0x2d2fce,null))[_0xeb67('0x2c')](respondWithResult(_0x2d2fce,null))[_0xeb67('0x4b')](handleError(_0x2d2fce,null));};exports[_0xeb67('0x4f')]=function(_0x5747cd,_0x48f0f7){return db['FreshsalesConfiguration']['create'](_0x5747cd['body'],{})['then'](respondWithResult(_0x48f0f7,0xc9))['catch'](handleError(_0x48f0f7,null));};exports[_0xeb67('0x50')]=function(_0x336096,_0x4939a5){if(_0x336096[_0xeb67('0x51')]['id']){delete _0x336096[_0xeb67('0x51')]['id'];}return db[_0xeb67('0x31')][_0xeb67('0x52')]({'where':{'id':_0x336096[_0xeb67('0x4d')]['id']}})[_0xeb67('0x2c')](handleEntityNotFound(_0x4939a5,null))[_0xeb67('0x2c')](saveUpdates(_0x336096[_0xeb67('0x51')],null))[_0xeb67('0x2c')](respondWithResult(_0x4939a5,null))['catch'](handleError(_0x4939a5,null));};exports['destroy']=function(_0x217fcf,_0x1acf32){return db[_0xeb67('0x31')][_0xeb67('0x52')]({'where':{'id':_0x217fcf[_0xeb67('0x4d')]['id']}})[_0xeb67('0x2c')](handleEntityNotFound(_0x1acf32,null))[_0xeb67('0x2c')](removeEntity(_0x1acf32,null))[_0xeb67('0x4b')](handleError(_0x1acf32,null));};exports[_0xeb67('0x53')]=function(_0xda01d,_0x374217,_0x3512f2){var _0x4af6fd={};var _0x624cfc={};var _0x1f4112;var _0x2ec4cf;return db[_0xeb67('0x31')]['findOne']({'where':{'id':_0xda01d[_0xeb67('0x4d')]['id']}})[_0xeb67('0x2c')](handleEntityNotFound(_0x374217,null))[_0xeb67('0x2c')](function(_0x50a8c7){if(_0x50a8c7){_0x1f4112=_0x50a8c7;_0x624cfc['model']=_[_0xeb67('0x36')](db['FreshsalesField'][_0xeb67('0x4e')]);_0x624cfc[_0xeb67('0x39')]=_['keys'](_0xda01d[_0xeb67('0x39')]);_0x624cfc[_0xeb67('0x37')]=_[_0xeb67('0x38')](_0x624cfc[_0xeb67('0x35')],_0x624cfc[_0xeb67('0x39')]);_0x4af6fd[_0xeb67('0x3b')]=_['intersection'](_0x624cfc['model'],qs[_0xeb67('0x3a')](_0xda01d['query'][_0xeb67('0x3a')]));_0x4af6fd['attributes']=_0x4af6fd[_0xeb67('0x3b')][_0xeb67('0x3c')]?_0x4af6fd[_0xeb67('0x3b')]:_0x624cfc[_0xeb67('0x35')];_0x4af6fd[_0xeb67('0x40')]=qs['sort'](_0xda01d['query']['sort']);_0x4af6fd['where']=qs['filters'](_[_0xeb67('0x43')](_0xda01d[_0xeb67('0x39')],_0x624cfc['filters']));if(_0xda01d['query'][_0xeb67('0x45')]){_0x4af6fd[_0xeb67('0x42')]=_[_0xeb67('0x46')](_0x4af6fd['where'],{'$or':_['map'](_0x4af6fd[_0xeb67('0x3b')],function(_0x2e92fb){var _0x1c3547={};_0x1c3547[_0x2e92fb]={'$like':'%'+_0xda01d['query']['filter']+'%'};return _0x1c3547;})});}_0x4af6fd=_[_0xeb67('0x46')]({},_0x4af6fd,_0xda01d[_0xeb67('0x47')]);return _0x1f4112[_0xeb67('0x53')](_0x4af6fd);}})[_0xeb67('0x2c')](function(_0xf104d3){if(_0xf104d3){_0x2ec4cf=_0xf104d3[_0xeb67('0x3c')];if(!_0xda01d['query'][_0xeb67('0x3d')](_0xeb67('0x3e'))){_0x4af6fd[_0xeb67('0x3f')]=qs[_0xeb67('0x3f')](_0xda01d[_0xeb67('0x39')][_0xeb67('0x3f')]);_0x4af6fd[_0xeb67('0x27')]=qs['offset'](_0xda01d['query'][_0xeb67('0x27')]);}return _0x1f4112[_0xeb67('0x53')](_0x4af6fd);}})[_0xeb67('0x2c')](function(_0x747b8e){if(_0x747b8e){return _0x747b8e?{'count':_0x2ec4cf,'rows':_0x747b8e}:null;}})[_0xeb67('0x2c')](respondWithResult(_0x374217,null))[_0xeb67('0x4b')](handleError(_0x374217,null));};exports[_0xeb67('0x54')]=function(_0x5b7d95,_0x542138,_0x56777e){var _0x26104b={};var _0x5a1371={};var _0xf6cd5;var _0x281b52;return db[_0xeb67('0x31')]['findOne']({'where':{'id':_0x5b7d95[_0xeb67('0x4d')]['id']}})['then'](handleEntityNotFound(_0x542138,null))[_0xeb67('0x2c')](function(_0x9eff02){if(_0x9eff02){_0xf6cd5=_0x9eff02;_0x5a1371[_0xeb67('0x35')]=_[_0xeb67('0x36')](db['FreshsalesField'][_0xeb67('0x4e')]);_0x5a1371['query']=_[_0xeb67('0x36')](_0x5b7d95[_0xeb67('0x39')]);_0x5a1371['filters']=_[_0xeb67('0x38')](_0x5a1371[_0xeb67('0x35')],_0x5a1371[_0xeb67('0x39')]);_0x26104b[_0xeb67('0x3b')]=_[_0xeb67('0x38')](_0x5a1371['model'],qs[_0xeb67('0x3a')](_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x3a')]));_0x26104b['attributes']=_0x26104b['attributes'][_0xeb67('0x3c')]?_0x26104b[_0xeb67('0x3b')]:_0x5a1371[_0xeb67('0x35')];_0x26104b['order']=qs[_0xeb67('0x41')](_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x41')]);_0x26104b[_0xeb67('0x42')]=qs[_0xeb67('0x37')](_[_0xeb67('0x43')](_0x5b7d95[_0xeb67('0x39')],_0x5a1371[_0xeb67('0x37')]));if(_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x45')]){_0x26104b[_0xeb67('0x42')]=_['merge'](_0x26104b[_0xeb67('0x42')],{'$or':_[_0xeb67('0x30')](_0x26104b[_0xeb67('0x3b')],function(_0xe8d320){var _0x559df2={};_0x559df2[_0xe8d320]={'$like':'%'+_0x5b7d95['query'][_0xeb67('0x45')]+'%'};return _0x559df2;})});}_0x26104b=_[_0xeb67('0x46')]({},_0x26104b,_0x5b7d95[_0xeb67('0x47')]);return _0xf6cd5[_0xeb67('0x54')](_0x26104b);}})[_0xeb67('0x2c')](function(_0x50a571){if(_0x50a571){_0x281b52=_0x50a571['length'];if(!_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x3d')]('nolimit')){_0x26104b[_0xeb67('0x3f')]=qs[_0xeb67('0x3f')](_0x5b7d95['query'][_0xeb67('0x3f')]);_0x26104b['offset']=qs['offset'](_0x5b7d95[_0xeb67('0x39')][_0xeb67('0x27')]);}return _0xf6cd5[_0xeb67('0x54')](_0x26104b);}})[_0xeb67('0x2c')](function(_0x2c2cd3){if(_0x2c2cd3){return _0x2c2cd3?{'count':_0x281b52,'rows':_0x2c2cd3}:null;}})[_0xeb67('0x2c')](respondWithResult(_0x542138,null))[_0xeb67('0x4b')](handleError(_0x542138,null));};exports[_0xeb67('0x55')]=function(_0x4827c6,_0x2ab898,_0x33046c){var _0x6b3b46={};var _0x34eaed={};var _0xc95bf4;var _0x1bf0cf;return db[_0xeb67('0x31')][_0xeb67('0x56')]({'where':{'id':_0x4827c6[_0xeb67('0x4d')]['id']}})[_0xeb67('0x2c')](handleEntityNotFound(_0x2ab898,null))[_0xeb67('0x2c')](function(_0x5eae79){if(_0x5eae79){_0xc95bf4=_0x5eae79;_0x34eaed['model']=_[_0xeb67('0x36')](db[_0xeb67('0x57')][_0xeb67('0x4e')]);_0x34eaed[_0xeb67('0x39')]=_['keys'](_0x4827c6['query']);_0x34eaed[_0xeb67('0x37')]=_[_0xeb67('0x38')](_0x34eaed[_0xeb67('0x35')],_0x34eaed[_0xeb67('0x39')]);_0x6b3b46[_0xeb67('0x3b')]=_[_0xeb67('0x38')](_0x34eaed[_0xeb67('0x35')],qs[_0xeb67('0x3a')](_0x4827c6[_0xeb67('0x39')][_0xeb67('0x3a')]));_0x6b3b46[_0xeb67('0x3b')]=_0x6b3b46[_0xeb67('0x3b')][_0xeb67('0x3c')]?_0x6b3b46['attributes']:_0x34eaed[_0xeb67('0x35')];_0x6b3b46[_0xeb67('0x40')]=qs[_0xeb67('0x41')](_0x4827c6['query'][_0xeb67('0x41')]);_0x6b3b46[_0xeb67('0x42')]=qs[_0xeb67('0x37')](_['pick'](_0x4827c6[_0xeb67('0x39')],_0x34eaed[_0xeb67('0x37')]));if(_0x4827c6[_0xeb67('0x39')][_0xeb67('0x45')]){_0x6b3b46['where']=_[_0xeb67('0x46')](_0x6b3b46[_0xeb67('0x42')],{'$or':_[_0xeb67('0x30')](_0x6b3b46[_0xeb67('0x3b')],function(_0x1f6de5){var _0xb89e80={};_0xb89e80[_0x1f6de5]={'$like':'%'+_0x4827c6['query'][_0xeb67('0x45')]+'%'};return _0xb89e80;})});}_0x6b3b46=_[_0xeb67('0x46')]({},_0x6b3b46,_0x4827c6['options']);return _0xc95bf4[_0xeb67('0x55')](_0x6b3b46);}})[_0xeb67('0x2c')](function(_0x5dec8f){if(_0x5dec8f){_0x1bf0cf=_0x5dec8f[_0xeb67('0x3c')];if(!_0x4827c6[_0xeb67('0x39')][_0xeb67('0x3d')](_0xeb67('0x3e'))){_0x6b3b46[_0xeb67('0x3f')]=qs[_0xeb67('0x3f')](_0x4827c6[_0xeb67('0x39')]['limit']);_0x6b3b46[_0xeb67('0x27')]=qs[_0xeb67('0x27')](_0x4827c6['query'][_0xeb67('0x27')]);}return _0xc95bf4[_0xeb67('0x55')](_0x6b3b46);}})[_0xeb67('0x2c')](function(_0x7ae97){if(_0x7ae97){return _0x7ae97?{'count':_0x1bf0cf,'rows':_0x7ae97}:null;}})[_0xeb67('0x2c')](respondWithResult(_0x2ab898,null))[_0xeb67('0x4b')](handleError(_0x2ab898,null));}; \ No newline at end of file +var _0x2bf9=['findAll','rows','show','find','create','body','catch','params','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','html-pdf','rimraf','moment','bluebird','mustache','util','path','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/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','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','destroy','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include'];(function(_0x1ba71b,_0xfa5ab){var _0x386eed=function(_0x380f24){while(--_0x380f24){_0x1ba71b['push'](_0x1ba71b['shift']());}};_0x386eed(++_0xfa5ab);}(_0x2bf9,0xc7));var _0x92bf=function(_0x2391cf,_0x2593e9){_0x2391cf=_0x2391cf-0x0;var _0x11f9e5=_0x2bf9[_0x2391cf];return _0x11f9e5;};'use strict';var pdf=require(_0x92bf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x92bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x92bf('0x2'));var BPromise=require(_0x92bf('0x3'));var Mustache=require(_0x92bf('0x4'));var util=require(_0x92bf('0x5'));var path=require(_0x92bf('0x6'));var sox=require(_0x92bf('0x7'));var csv=require(_0x92bf('0x8'));var ejs=require(_0x92bf('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x92bf('0xa'));var crypto=require(_0x92bf('0xb'));var jsforce=require(_0x92bf('0xc'));var deskjs=require(_0x92bf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x92bf('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x92bf('0xf'));var qs=require(_0x92bf('0x10'));var as=require(_0x92bf('0x11'));var hardwareService=require(_0x92bf('0x12'));var logger=require(_0x92bf('0x13'))(_0x92bf('0x14'));var utils=require(_0x92bf('0x15'));var config=require(_0x92bf('0x16'));var db=require(_0x92bf('0x17'))['db'];var jayson=require(_0x92bf('0x18'));var client=jayson[_0x92bf('0x19')][_0x92bf('0x1a')]({'port':0x232a});function checkPasswordPattern(_0xbd689,_0x20563f,_0xdd06cd){if(_0xdd06cd){var _0x1ebd76=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ebd76['test'](_0x20563f)){return _0xbd689;}else{throw new db[(_0x92bf('0x1b'))][(_0x92bf('0x1c'))](_0x92bf('0x1d'));}}else{return _0xbd689;}}function respondWithRpcPromise(_0x47eca1,_0x409795,_0x4b2e64,_0x5ea3f8){return new BPromise(function(_0x51d1ce,_0x383858){var _0x36b7b8=_0x5ea3f8||client;return _0x36b7b8[_0x92bf('0x1e')](_0x47eca1,_0x4b2e64)[_0x92bf('0x1f')](function(_0x6c306e){logger[_0x92bf('0x20')](_0x92bf('0x21'),_0x409795,_0x92bf('0x22'));logger['debug'](_0x92bf('0x23'),_0x409795,'request\x20sent',JSON[_0x92bf('0x24')](_0x6c306e));if(_0x6c306e[_0x92bf('0x25')]){if(_0x6c306e['error'][_0x92bf('0x26')]===0x1f4){logger['error'](_0x92bf('0x21'),_0x409795,_0x6c306e[_0x92bf('0x25')]['message']);return _0x383858(_0x6c306e[_0x92bf('0x25')][_0x92bf('0x27')]);}logger['error'](_0x92bf('0x21'),_0x409795,_0x6c306e['error'][_0x92bf('0x27')]);return _0x51d1ce(_0x6c306e[_0x92bf('0x25')][_0x92bf('0x27')]);}else{logger['info'](_0x92bf('0x21'),_0x409795,_0x92bf('0x22'));_0x51d1ce(_0x6c306e[_0x92bf('0x28')]['message']);}})['catch'](function(_0x5978a8){logger[_0x92bf('0x25')](_0x92bf('0x21'),_0x409795,_0x5978a8);_0x383858(_0x5978a8);});});}function respondWithStatusCode(_0x31c98d,_0x1ab65b){_0x1ab65b=_0x1ab65b||0xcc;return function(_0x1326e4){if(_0x1326e4){return _0x31c98d[_0x92bf('0x29')](_0x1ab65b);}return _0x31c98d[_0x92bf('0x2a')](_0x1ab65b)[_0x92bf('0x2b')]();};}function respondWithResult(_0x1110d0,_0x30a6bb){_0x30a6bb=_0x30a6bb||0xc8;return function(_0x591786){if(_0x591786){return _0x1110d0['status'](_0x30a6bb)[_0x92bf('0x2c')](_0x591786);}};}function respondWithFilteredResult(_0x1f791e,_0x6a9472){return function(_0x516e2c){if(_0x516e2c){var _0x523566=_0x516e2c['count'],_0x5245a9=_0x6a9472['offset'],_0x1056c7=_0x6a9472[_0x92bf('0x2d')]+_0x6a9472[_0x92bf('0x2e')],_0x1e2d8d;if(_0x1056c7>=_0x523566){_0x1056c7=_0x523566;_0x1e2d8d=0xc8;}else{_0x1e2d8d=0xce;}_0x1f791e[_0x92bf('0x2a')](_0x1e2d8d);return _0x1f791e[_0x92bf('0x2f')](_0x92bf('0x30'),_0x5245a9+'-'+_0x1056c7+'/'+_0x523566)['json'](_0x516e2c);}return null;};}function patchUpdates(_0x528d79){return function(_0x22add2){try{jsonpatch[_0x92bf('0x31')](_0x22add2,_0x528d79,!![]);}catch(_0x50ec8c){return BPromise['reject'](_0x50ec8c);}return _0x22add2['save']();};}function saveUpdates(_0xe7d203,_0x5494ea){return function(_0x203677){if(_0x203677){return _0x203677[_0x92bf('0x32')](_0xe7d203)[_0x92bf('0x1f')](function(_0x5ead26){return _0x5ead26;});}return null;};}function removeEntity(_0x40909f,_0x504987){return function(_0x3dc00e){if(_0x3dc00e){return _0x3dc00e[_0x92bf('0x33')]()[_0x92bf('0x1f')](function(){_0x40909f[_0x92bf('0x2a')](0xcc)[_0x92bf('0x2b')]();});}};}function handleEntityNotFound(_0x420770,_0x216ea2){return function(_0x43c747){if(!_0x43c747){_0x420770[_0x92bf('0x29')](0x194);}return _0x43c747;};}function handleError(_0x408310,_0x4c074e){_0x4c074e=_0x4c074e||0x1f4;return function(_0x5a4824){logger[_0x92bf('0x25')](_0x5a4824['stack']);if(_0x5a4824[_0x92bf('0x34')]){delete _0x5a4824[_0x92bf('0x34')];}_0x408310[_0x92bf('0x2a')](_0x4c074e)[_0x92bf('0x35')](_0x5a4824);};}exports['index']=function(_0x2202c3,_0x2dfd1e){var _0x4d0f3f={},_0x353e98={},_0x2289d4={'count':0x0,'rows':[]};var _0x162e4a=_[_0x92bf('0x36')](db[_0x92bf('0x37')][_0x92bf('0x38')],function(_0x2b156a){return{'name':_0x2b156a[_0x92bf('0x39')],'type':_0x2b156a[_0x92bf('0x3a')]['key']};});_0x353e98[_0x92bf('0x3b')]=_[_0x92bf('0x36')](_0x162e4a,_0x92bf('0x34'));_0x353e98[_0x92bf('0x3c')]=_[_0x92bf('0x3d')](_0x2202c3[_0x92bf('0x3c')]);_0x353e98[_0x92bf('0x3e')]=_[_0x92bf('0x3f')](_0x353e98[_0x92bf('0x3b')],_0x353e98['query']);_0x4d0f3f[_0x92bf('0x40')]=_[_0x92bf('0x3f')](_0x353e98['model'],qs[_0x92bf('0x41')](_0x2202c3[_0x92bf('0x3c')][_0x92bf('0x41')]));_0x4d0f3f[_0x92bf('0x40')]=_0x4d0f3f[_0x92bf('0x40')][_0x92bf('0x42')]?_0x4d0f3f[_0x92bf('0x40')]:_0x353e98[_0x92bf('0x3b')];if(!_0x2202c3[_0x92bf('0x3c')][_0x92bf('0x43')](_0x92bf('0x44'))){_0x4d0f3f[_0x92bf('0x2e')]=qs[_0x92bf('0x2e')](_0x2202c3[_0x92bf('0x3c')][_0x92bf('0x2e')]);_0x4d0f3f[_0x92bf('0x2d')]=qs[_0x92bf('0x2d')](_0x2202c3[_0x92bf('0x3c')][_0x92bf('0x2d')]);}_0x4d0f3f[_0x92bf('0x45')]=qs['sort'](_0x2202c3[_0x92bf('0x3c')][_0x92bf('0x46')]);_0x4d0f3f[_0x92bf('0x47')]=qs[_0x92bf('0x3e')](_[_0x92bf('0x48')](_0x2202c3[_0x92bf('0x3c')],_0x353e98[_0x92bf('0x3e')]),_0x162e4a);if(_0x2202c3['query'][_0x92bf('0x49')]){_0x4d0f3f['where']=_['merge'](_0x4d0f3f[_0x92bf('0x47')],{'$or':_[_0x92bf('0x36')](_0x162e4a,function(_0x545e7a){if(_0x545e7a[_0x92bf('0x3a')]!==_0x92bf('0x4a')){var _0x4c302e={};_0x4c302e[_0x545e7a[_0x92bf('0x34')]]={'$like':'%'+_0x2202c3[_0x92bf('0x3c')][_0x92bf('0x49')]+'%'};return _0x4c302e;}})});}_0x4d0f3f=_[_0x92bf('0x4b')]({},_0x4d0f3f,_0x2202c3[_0x92bf('0x4c')]);var _0x1511f1={'where':_0x4d0f3f['where']};return db['FreshsalesConfiguration']['count'](_0x1511f1)[_0x92bf('0x1f')](function(_0x306915){_0x2289d4[_0x92bf('0x4d')]=_0x306915;if(_0x2202c3[_0x92bf('0x3c')][_0x92bf('0x4e')]){_0x4d0f3f[_0x92bf('0x4f')]=[{'all':!![]}];}return db[_0x92bf('0x37')][_0x92bf('0x50')](_0x4d0f3f);})['then'](function(_0x317187){_0x2289d4[_0x92bf('0x51')]=_0x317187;return _0x2289d4;})['then'](respondWithFilteredResult(_0x2dfd1e,_0x4d0f3f))['catch'](handleError(_0x2dfd1e,null));};exports[_0x92bf('0x52')]=function(_0x286dae,_0x32f33d){var _0x1bf257={'raw':![],'where':{'id':_0x286dae['params']['id']}},_0x4e1c74={};_0x4e1c74[_0x92bf('0x3b')]=_[_0x92bf('0x3d')](db['FreshsalesConfiguration'][_0x92bf('0x38')]);_0x4e1c74['query']=_[_0x92bf('0x3d')](_0x286dae[_0x92bf('0x3c')]);_0x4e1c74['filters']=_['intersection'](_0x4e1c74[_0x92bf('0x3b')],_0x4e1c74[_0x92bf('0x3c')]);_0x1bf257[_0x92bf('0x40')]=_[_0x92bf('0x3f')](_0x4e1c74[_0x92bf('0x3b')],qs[_0x92bf('0x41')](_0x286dae[_0x92bf('0x3c')][_0x92bf('0x41')]));_0x1bf257[_0x92bf('0x40')]=_0x1bf257[_0x92bf('0x40')][_0x92bf('0x42')]?_0x1bf257[_0x92bf('0x40')]:_0x4e1c74[_0x92bf('0x3b')];if(_0x286dae[_0x92bf('0x3c')][_0x92bf('0x4e')]){_0x1bf257[_0x92bf('0x4f')]=[{'all':!![]}];}_0x1bf257=_[_0x92bf('0x4b')]({},_0x1bf257,_0x286dae[_0x92bf('0x4c')]);return db[_0x92bf('0x37')][_0x92bf('0x53')](_0x1bf257)[_0x92bf('0x1f')](handleEntityNotFound(_0x32f33d,null))[_0x92bf('0x1f')](respondWithResult(_0x32f33d,null))['catch'](handleError(_0x32f33d,null));};exports['create']=function(_0x306ac1,_0x2a504b){return db[_0x92bf('0x37')][_0x92bf('0x54')](_0x306ac1[_0x92bf('0x55')],{})['then'](respondWithResult(_0x2a504b,0xc9))[_0x92bf('0x56')](handleError(_0x2a504b,null));};exports[_0x92bf('0x32')]=function(_0x33a0b6,_0x590f56){if(_0x33a0b6[_0x92bf('0x55')]['id']){delete _0x33a0b6['body']['id'];}return db[_0x92bf('0x37')]['find']({'where':{'id':_0x33a0b6[_0x92bf('0x57')]['id']}})[_0x92bf('0x1f')](handleEntityNotFound(_0x590f56,null))[_0x92bf('0x1f')](saveUpdates(_0x33a0b6[_0x92bf('0x55')],null))[_0x92bf('0x1f')](respondWithResult(_0x590f56,null))[_0x92bf('0x56')](handleError(_0x590f56,null));};exports[_0x92bf('0x33')]=function(_0x58e406,_0x264425){return db[_0x92bf('0x37')][_0x92bf('0x53')]({'where':{'id':_0x58e406[_0x92bf('0x57')]['id']}})[_0x92bf('0x1f')](handleEntityNotFound(_0x264425,null))[_0x92bf('0x1f')](removeEntity(_0x264425,null))[_0x92bf('0x56')](handleError(_0x264425,null));};exports[_0x92bf('0x58')]=function(_0xd12d9e,_0x17ea28,_0x24f704){var _0x37b8db={};var _0x55e0ea={};var _0x513cb0;var _0x470147;return db[_0x92bf('0x37')][_0x92bf('0x59')]({'where':{'id':_0xd12d9e[_0x92bf('0x57')]['id']}})['then'](handleEntityNotFound(_0x17ea28,null))[_0x92bf('0x1f')](function(_0x2cdf09){if(_0x2cdf09){_0x513cb0=_0x2cdf09;_0x55e0ea[_0x92bf('0x3b')]=_[_0x92bf('0x3d')](db['FreshsalesField'][_0x92bf('0x38')]);_0x55e0ea[_0x92bf('0x3c')]=_['keys'](_0xd12d9e[_0x92bf('0x3c')]);_0x55e0ea[_0x92bf('0x3e')]=_[_0x92bf('0x3f')](_0x55e0ea['model'],_0x55e0ea[_0x92bf('0x3c')]);_0x37b8db[_0x92bf('0x40')]=_['intersection'](_0x55e0ea[_0x92bf('0x3b')],qs[_0x92bf('0x41')](_0xd12d9e[_0x92bf('0x3c')][_0x92bf('0x41')]));_0x37b8db[_0x92bf('0x40')]=_0x37b8db[_0x92bf('0x40')][_0x92bf('0x42')]?_0x37b8db[_0x92bf('0x40')]:_0x55e0ea[_0x92bf('0x3b')];_0x37b8db[_0x92bf('0x45')]=qs[_0x92bf('0x46')](_0xd12d9e[_0x92bf('0x3c')][_0x92bf('0x46')]);_0x37b8db[_0x92bf('0x47')]=qs['filters'](_[_0x92bf('0x48')](_0xd12d9e['query'],_0x55e0ea['filters']));if(_0xd12d9e[_0x92bf('0x3c')]['filter']){_0x37b8db[_0x92bf('0x47')]=_[_0x92bf('0x4b')](_0x37b8db[_0x92bf('0x47')],{'$or':_['map'](_0x37b8db[_0x92bf('0x40')],function(_0x12a44c){var _0x42ca8b={};_0x42ca8b[_0x12a44c]={'$like':'%'+_0xd12d9e['query'][_0x92bf('0x49')]+'%'};return _0x42ca8b;})});}_0x37b8db=_[_0x92bf('0x4b')]({},_0x37b8db,_0xd12d9e['options']);return _0x513cb0['getSubjects'](_0x37b8db);}})[_0x92bf('0x1f')](function(_0x318f66){if(_0x318f66){_0x470147=_0x318f66[_0x92bf('0x42')];if(!_0xd12d9e[_0x92bf('0x3c')][_0x92bf('0x43')](_0x92bf('0x44'))){_0x37b8db[_0x92bf('0x2e')]=qs[_0x92bf('0x2e')](_0xd12d9e[_0x92bf('0x3c')][_0x92bf('0x2e')]);_0x37b8db['offset']=qs[_0x92bf('0x2d')](_0xd12d9e[_0x92bf('0x3c')][_0x92bf('0x2d')]);}return _0x513cb0[_0x92bf('0x58')](_0x37b8db);}})[_0x92bf('0x1f')](function(_0x1b1dc6){if(_0x1b1dc6){return _0x1b1dc6?{'count':_0x470147,'rows':_0x1b1dc6}:null;}})[_0x92bf('0x1f')](respondWithResult(_0x17ea28,null))[_0x92bf('0x56')](handleError(_0x17ea28,null));};exports[_0x92bf('0x5a')]=function(_0x4fe4e5,_0x927191,_0x3d092b){var _0x4a1ad6={};var _0x1dc46d={};var _0x4069e5;var _0x48bdd9;return db[_0x92bf('0x37')][_0x92bf('0x59')]({'where':{'id':_0x4fe4e5[_0x92bf('0x57')]['id']}})['then'](handleEntityNotFound(_0x927191,null))[_0x92bf('0x1f')](function(_0x51c53d){if(_0x51c53d){_0x4069e5=_0x51c53d;_0x1dc46d['model']=_[_0x92bf('0x3d')](db['FreshsalesField'][_0x92bf('0x38')]);_0x1dc46d[_0x92bf('0x3c')]=_[_0x92bf('0x3d')](_0x4fe4e5[_0x92bf('0x3c')]);_0x1dc46d[_0x92bf('0x3e')]=_[_0x92bf('0x3f')](_0x1dc46d[_0x92bf('0x3b')],_0x1dc46d[_0x92bf('0x3c')]);_0x4a1ad6[_0x92bf('0x40')]=_['intersection'](_0x1dc46d['model'],qs[_0x92bf('0x41')](_0x4fe4e5[_0x92bf('0x3c')][_0x92bf('0x41')]));_0x4a1ad6[_0x92bf('0x40')]=_0x4a1ad6[_0x92bf('0x40')][_0x92bf('0x42')]?_0x4a1ad6[_0x92bf('0x40')]:_0x1dc46d[_0x92bf('0x3b')];_0x4a1ad6[_0x92bf('0x45')]=qs[_0x92bf('0x46')](_0x4fe4e5[_0x92bf('0x3c')][_0x92bf('0x46')]);_0x4a1ad6[_0x92bf('0x47')]=qs[_0x92bf('0x3e')](_[_0x92bf('0x48')](_0x4fe4e5[_0x92bf('0x3c')],_0x1dc46d[_0x92bf('0x3e')]));if(_0x4fe4e5[_0x92bf('0x3c')]['filter']){_0x4a1ad6[_0x92bf('0x47')]=_[_0x92bf('0x4b')](_0x4a1ad6[_0x92bf('0x47')],{'$or':_[_0x92bf('0x36')](_0x4a1ad6['attributes'],function(_0x1cc752){var _0x3786b5={};_0x3786b5[_0x1cc752]={'$like':'%'+_0x4fe4e5[_0x92bf('0x3c')][_0x92bf('0x49')]+'%'};return _0x3786b5;})});}_0x4a1ad6=_['merge']({},_0x4a1ad6,_0x4fe4e5[_0x92bf('0x4c')]);return _0x4069e5['getDescriptions'](_0x4a1ad6);}})[_0x92bf('0x1f')](function(_0x380d88){if(_0x380d88){_0x48bdd9=_0x380d88[_0x92bf('0x42')];if(!_0x4fe4e5['query'][_0x92bf('0x43')](_0x92bf('0x44'))){_0x4a1ad6['limit']=qs['limit'](_0x4fe4e5[_0x92bf('0x3c')]['limit']);_0x4a1ad6[_0x92bf('0x2d')]=qs[_0x92bf('0x2d')](_0x4fe4e5[_0x92bf('0x3c')][_0x92bf('0x2d')]);}return _0x4069e5[_0x92bf('0x5a')](_0x4a1ad6);}})[_0x92bf('0x1f')](function(_0x2e9742){if(_0x2e9742){return _0x2e9742?{'count':_0x48bdd9,'rows':_0x2e9742}:null;}})['then'](respondWithResult(_0x927191,null))[_0x92bf('0x56')](handleError(_0x927191,null));};exports['getFields']=function(_0x85d199,_0x3880e2,_0x207b58){var _0x9bd24a={};var _0xa2e22b={};var _0x192b01;var _0x574414;return db['FreshsalesConfiguration'][_0x92bf('0x59')]({'where':{'id':_0x85d199['params']['id']}})['then'](handleEntityNotFound(_0x3880e2,null))[_0x92bf('0x1f')](function(_0x5831fa){if(_0x5831fa){_0x192b01=_0x5831fa;_0xa2e22b[_0x92bf('0x3b')]=_['keys'](db[_0x92bf('0x5b')][_0x92bf('0x38')]);_0xa2e22b['query']=_[_0x92bf('0x3d')](_0x85d199[_0x92bf('0x3c')]);_0xa2e22b[_0x92bf('0x3e')]=_['intersection'](_0xa2e22b['model'],_0xa2e22b[_0x92bf('0x3c')]);_0x9bd24a[_0x92bf('0x40')]=_[_0x92bf('0x3f')](_0xa2e22b[_0x92bf('0x3b')],qs['fields'](_0x85d199['query']['fields']));_0x9bd24a[_0x92bf('0x40')]=_0x9bd24a[_0x92bf('0x40')]['length']?_0x9bd24a[_0x92bf('0x40')]:_0xa2e22b[_0x92bf('0x3b')];_0x9bd24a[_0x92bf('0x45')]=qs[_0x92bf('0x46')](_0x85d199['query'][_0x92bf('0x46')]);_0x9bd24a[_0x92bf('0x47')]=qs['filters'](_[_0x92bf('0x48')](_0x85d199[_0x92bf('0x3c')],_0xa2e22b[_0x92bf('0x3e')]));if(_0x85d199['query'][_0x92bf('0x49')]){_0x9bd24a['where']=_[_0x92bf('0x4b')](_0x9bd24a[_0x92bf('0x47')],{'$or':_['map'](_0x9bd24a[_0x92bf('0x40')],function(_0x1507b6){var _0x22687c={};_0x22687c[_0x1507b6]={'$like':'%'+_0x85d199['query'][_0x92bf('0x49')]+'%'};return _0x22687c;})});}_0x9bd24a=_[_0x92bf('0x4b')]({},_0x9bd24a,_0x85d199[_0x92bf('0x4c')]);return _0x192b01[_0x92bf('0x5c')](_0x9bd24a);}})[_0x92bf('0x1f')](function(_0x2c5f7e){if(_0x2c5f7e){_0x574414=_0x2c5f7e[_0x92bf('0x42')];if(!_0x85d199[_0x92bf('0x3c')][_0x92bf('0x43')](_0x92bf('0x44'))){_0x9bd24a[_0x92bf('0x2e')]=qs[_0x92bf('0x2e')](_0x85d199['query'][_0x92bf('0x2e')]);_0x9bd24a[_0x92bf('0x2d')]=qs[_0x92bf('0x2d')](_0x85d199[_0x92bf('0x3c')][_0x92bf('0x2d')]);}return _0x192b01['getFields'](_0x9bd24a);}})[_0x92bf('0x1f')](function(_0x209d43){if(_0x209d43){return _0x209d43?{'count':_0x574414,'rows':_0x209d43}:null;}})['then'](respondWithResult(_0x3880e2,null))[_0x92bf('0x56')](handleError(_0x3880e2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 599578c..76f3b99 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 _0xfd9a=['FreshsalesConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0xfd9a,0x12d));var _0xafd9=function(_0x199e76,_0x442c6f){_0x199e76=_0x199e76-0x0;var _0x1a640a=_0xfd9a[_0x199e76];return _0x1a640a;};'use strict';var _=require(_0xafd9('0x0'));var util=require(_0xafd9('0x1'));var logger=require(_0xafd9('0x2'))('api');var moment=require(_0xafd9('0x3'));var BPromise=require(_0xafd9('0x4'));var rp=require(_0xafd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafd9('0x6'));var config=require('../../config/environment');var attributes=require(_0xafd9('0x7'));module[_0xafd9('0x8')]=function(_0xd3c186,_0x393ad9){return _0xd3c186['define'](_0xafd9('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5055=['api','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','../../config/logger'];(function(_0x9d0e74,_0x40807a){var _0x21b6dd=function(_0x3c0ed3){while(--_0x3c0ed3){_0x9d0e74['push'](_0x9d0e74['shift']());}};_0x21b6dd(++_0x40807a);}(_0x5055,0xef));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5505('0x0'))(_0x5505('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5505('0x2'));var fs=require('fs');var path=require(_0x5505('0x3'));var rimraf=require(_0x5505('0x4'));var config=require(_0x5505('0x5'));var attributes=require(_0x5505('0x6'));module[_0x5505('0x7')]=function(_0x12c466,_0x37b8cf){return _0x12c466[_0x5505('0x8')](_0x5505('0x9'),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 2eb8f2b..2be02c8 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 _0x6822=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0x6822,0x18c));var _0x2682=function(_0x7e70b9,_0x4ac69e){_0x7e70b9=_0x7e70b9-0x0;var _0x25c261=_0x6822[_0x7e70b9];return _0x25c261;};'use strict';var _=require('lodash');var util=require(_0x2682('0x0'));var moment=require(_0x2682('0x1'));var BPromise=require(_0x2682('0x2'));var rs=require(_0x2682('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2682('0x4'))['db'];var utils=require(_0x2682('0x5'));var logger=require(_0x2682('0x6'))(_0x2682('0x7'));var config=require(_0x2682('0x8'));var jayson=require(_0x2682('0x9'));var client=jayson[_0x2682('0xa')][_0x2682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f55b,_0x3f706c,_0x4242c5){return new BPromise(function(_0x1a1307,_0x303fe4){return client[_0x2682('0xc')](_0x35f55b,_0x4242c5)['then'](function(_0x3e72bc){logger[_0x2682('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3f706c,'request\x20sent');logger['debug'](_0x2682('0xe'),_0x3f706c,_0x2682('0xf'),JSON['stringify'](_0x3e72bc));if(_0x3e72bc[_0x2682('0x10')]){if(_0x3e72bc[_0x2682('0x10')]['code']===0x1f4){logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x303fe4(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x1a1307(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}else{logger[_0x2682('0xd')](_0x2682('0x11'),_0x3f706c,_0x2682('0xf'));_0x1a1307(_0x3e72bc['result']['message']);}})[_0x2682('0x13')](function(_0x2b1ed2){logger[_0x2682('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3f706c,_0x2b1ed2);_0x303fe4(_0x2b1ed2);});});} \ No newline at end of file +var _0x138d=['FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x31fd0a,_0x1c41aa){var _0x11e7d1=function(_0x5b18df){while(--_0x5b18df){_0x31fd0a['push'](_0x31fd0a['shift']());}};_0x11e7d1(++_0x1c41aa);}(_0x138d,0x1ab));var _0xd138=function(_0x5c98ea,_0xa782aa){_0x5c98ea=_0x5c98ea-0x0;var _0x51e853=_0x138d[_0x5c98ea];return _0x51e853;};'use strict';var _=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var moment=require('moment');var BPromise=require(_0xd138('0x2'));var rs=require(_0xd138('0x3'));var fs=require('fs');var Redis=require(_0xd138('0x4'));var db=require(_0xd138('0x5'))['db'];var utils=require(_0xd138('0x6'));var logger=require(_0xd138('0x7'))('rpc');var config=require(_0xd138('0x8'));var jayson=require(_0xd138('0x9'));var client=jayson[_0xd138('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19869d,_0x1edfa7,_0x117c23){return new BPromise(function(_0x5790ff,_0x54e1f2){return client[_0xd138('0xb')](_0x19869d,_0x117c23)[_0xd138('0xc')](function(_0x121cce){logger['info'](_0xd138('0xd'),_0x1edfa7,'request\x20sent');logger['debug'](_0xd138('0xe'),_0x1edfa7,_0xd138('0xf'),JSON[_0xd138('0x10')](_0x121cce));if(_0x121cce[_0xd138('0x11')]){if(_0x121cce['error'][_0xd138('0x12')]===0x1f4){logger['error'](_0xd138('0xd'),_0x1edfa7,_0x121cce[_0xd138('0x11')][_0xd138('0x13')]);return _0x54e1f2(_0x121cce[_0xd138('0x11')][_0xd138('0x13')]);}logger[_0xd138('0x11')](_0xd138('0xd'),_0x1edfa7,_0x121cce[_0xd138('0x11')][_0xd138('0x13')]);return _0x5790ff(_0x121cce[_0xd138('0x11')][_0xd138('0x13')]);}else{logger[_0xd138('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1edfa7,_0xd138('0xf'));_0x5790ff(_0x121cce[_0xd138('0x15')]['message']);}})['catch'](function(_0x502d3b){logger[_0xd138('0x11')](_0xd138('0xd'),_0x1edfa7,_0x502d3b);_0x54e1f2(_0x502d3b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 494eea8..d918e5b 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 _0xfee5=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x45de5a,_0x2b42b1){var _0x5f40e7=function(_0x48a922){while(--_0x48a922){_0x45de5a['push'](_0x45de5a['shift']());}};_0x5f40e7(++_0x2b42b1);}(_0xfee5,0x11a));var _0x5fee=function(_0x71c287,_0x43426c){_0x71c287=_0x71c287-0x0;var _0x439987=_0xfee5[_0x71c287];return _0x439987;};'use strict';var multer=require('multer');var util=require(_0x5fee('0x0'));var path=require(_0x5fee('0x1'));var timeout=require(_0x5fee('0x2'));var express=require(_0x5fee('0x3'));var router=express['Router']();var auth=require(_0x5fee('0x4'));var interaction=require(_0x5fee('0x5'));var config=require(_0x5fee('0x6'));var controller=require(_0x5fee('0x7'));router[_0x5fee('0x8')]('/',auth[_0x5fee('0x9')](),controller['index']);router[_0x5fee('0x8')](_0x5fee('0xa'),auth[_0x5fee('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5fee('0xb')]);router[_0x5fee('0xc')](_0x5fee('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5fee('0xd')]('/:id',auth[_0x5fee('0x9')](),controller[_0x5fee('0xe')]);module[_0x5fee('0xf')]=router; \ No newline at end of file +var _0x5d33=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports'];(function(_0x39940d,_0x42d30c){var _0x492a28=function(_0x152b2d){while(--_0x152b2d){_0x39940d['push'](_0x39940d['shift']());}};_0x492a28(++_0x42d30c);}(_0x5d33,0x1b0));var _0x35d3=function(_0x393f10,_0x24c7cb){_0x393f10=_0x393f10-0x0;var _0x480dd4=_0x5d33[_0x393f10];return _0x480dd4;};'use strict';var multer=require(_0x35d3('0x0'));var util=require(_0x35d3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x35d3('0x2'));var router=express[_0x35d3('0x3')]();var auth=require(_0x35d3('0x4'));var interaction=require(_0x35d3('0x5'));var config=require(_0x35d3('0x6'));var controller=require(_0x35d3('0x7'));router['get']('/',auth[_0x35d3('0x8')](),controller[_0x35d3('0x9')]);router['get'](_0x35d3('0xa'),auth[_0x35d3('0x8')](),controller[_0x35d3('0xb')]);router[_0x35d3('0xc')]('/',auth[_0x35d3('0x8')](),controller[_0x35d3('0xd')]);router[_0x35d3('0xe')](_0x35d3('0xa'),auth['isAuthenticated'](),controller[_0x35d3('0xf')]);router[_0x35d3('0x10')](_0x35d3('0xa'),auth[_0x35d3('0x8')](),controller['destroy']);module[_0x35d3('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a3b65e2..83ff137 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 _0x2e01=['STRING','customVariable','exports','ENUM','string','variable','keyValue'];(function(_0x1f2ef9,_0x28dee6){var _0x5aa6c1=function(_0x28f4f0){while(--_0x28f4f0){_0x1f2ef9['push'](_0x1f2ef9['shift']());}};_0x5aa6c1(++_0x28dee6);}(_0x2e01,0x1d0));var _0x12e0=function(_0x202076,_0x9c9f87){_0x202076=_0x202076-0x0;var _0x35fca6=_0x2e01[_0x202076];return _0x35fca6;};'use strict';var Sequelize=require('sequelize');module[_0x12e0('0x0')]={'type':{'type':Sequelize[_0x12e0('0x1')](_0x12e0('0x2'),_0x12e0('0x3'),'customVariable',_0x12e0('0x4')),'defaultValue':_0x12e0('0x2')},'content':{'type':Sequelize[_0x12e0('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x12e0('0x2'),_0x12e0('0x3'),_0x12e0('0x6'))},'keyContent':{'type':Sequelize[_0x12e0('0x5')]},'idField':{'type':Sequelize[_0x12e0('0x5')]},'nameField':{'type':Sequelize[_0x12e0('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x12e0('0x5')]}}; \ No newline at end of file +var _0x24d3=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x1dab75,_0x584b43){var _0x59df44=function(_0x5f5536){while(--_0x5f5536){_0x1dab75['push'](_0x1dab75['shift']());}};_0x59df44(++_0x584b43);}(_0x24d3,0xcf));var _0x324d=function(_0x577227,_0x37be3a){_0x577227=_0x577227-0x0;var _0x5c6afd=_0x24d3[_0x577227];return _0x5c6afd;};'use strict';var Sequelize=require(_0x324d('0x0'));module[_0x324d('0x1')]={'type':{'type':Sequelize[_0x324d('0x2')](_0x324d('0x3'),_0x324d('0x4'),_0x324d('0x5'),_0x324d('0x6')),'defaultValue':_0x324d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x324d('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x324d('0x3'),_0x324d('0x4'),_0x324d('0x5'))},'keyContent':{'type':Sequelize[_0x324d('0x7')]},'idField':{'type':Sequelize[_0x324d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x324d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x324d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 6e36520..28e7f7a 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 _0x9e2b=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x9e2b,0x15a));var _0xb9e2=function(_0x27b03c,_0x14e71a){_0x27b03c=_0x27b03c-0x0;var _0x3099ba=_0x9e2b[_0x27b03c];return _0x3099ba;};'use strict';var pdf=require(_0xb9e2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb9e2('0x1'));var zipdir=require(_0xb9e2('0x2'));var jsonpatch=require(_0xb9e2('0x3'));var rp=require(_0xb9e2('0x4'));var moment=require('moment');var BPromise=require(_0xb9e2('0x5'));var Mustache=require(_0xb9e2('0x6'));var util=require(_0xb9e2('0x7'));var path=require(_0xb9e2('0x8'));var sox=require(_0xb9e2('0x9'));var csv=require('to-csv');var ejs=require(_0xb9e2('0xa'));var fs=require('fs');var _=require(_0xb9e2('0xb'));var squel=require(_0xb9e2('0xc'));var crypto=require(_0xb9e2('0xd'));var jsforce=require(_0xb9e2('0xe'));var deskjs=require(_0xb9e2('0xf'));var toCsv=require(_0xb9e2('0x10'));var querystring=require('querystring');var Papa=require(_0xb9e2('0x11'));var Redis=require(_0xb9e2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb9e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9e2('0x14'))(_0xb9e2('0x15'));var utils=require(_0xb9e2('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a369,_0xaad36f){_0xaad36f=_0xaad36f||0xcc;return function(_0x453a3b){if(_0x453a3b){return _0x42a369['sendStatus'](_0xaad36f);}return _0x42a369[_0xb9e2('0x17')](_0xaad36f)[_0xb9e2('0x18')]();};}function respondWithResult(_0x57ff73,_0x38a58b){_0x38a58b=_0x38a58b||0xc8;return function(_0x3eb458){if(_0x3eb458){return _0x57ff73['status'](_0x38a58b)['json'](_0x3eb458);}};}function respondWithFilteredResult(_0x5ff10b,_0x281f0c){return function(_0x1188e7){if(_0x1188e7){var _0x5e1f31=_0x1188e7[_0xb9e2('0x19')],_0x11ef77=_0x281f0c[_0xb9e2('0x1a')],_0x15fe51=_0x281f0c[_0xb9e2('0x1a')]+_0x281f0c[_0xb9e2('0x1b')],_0x35b64d;if(_0x15fe51>=_0x5e1f31){_0x15fe51=_0x5e1f31;_0x35b64d=0xc8;}else{_0x35b64d=0xce;}_0x5ff10b[_0xb9e2('0x17')](_0x35b64d);return _0x5ff10b[_0xb9e2('0x1c')](_0xb9e2('0x1d'),_0x11ef77+'-'+_0x15fe51+'/'+_0x5e1f31)[_0xb9e2('0x1e')](_0x1188e7);}return null;};}function patchUpdates(_0x3744b4){return function(_0x485cfa){try{jsonpatch[_0xb9e2('0x1f')](_0x485cfa,_0x3744b4,!![]);}catch(_0x558d49){return BPromise[_0xb9e2('0x20')](_0x558d49);}return _0x485cfa[_0xb9e2('0x21')]();};}function saveUpdates(_0xfa07cc,_0x320849){return function(_0x595c62){if(_0x595c62){return _0x595c62[_0xb9e2('0x22')](_0xfa07cc)[_0xb9e2('0x23')](function(_0x34f45f){return _0x34f45f;});}return null;};}function removeEntity(_0x6b34c8,_0x31ad71){return function(_0x374bf2){if(_0x374bf2){return _0x374bf2[_0xb9e2('0x24')]()[_0xb9e2('0x23')](function(){_0x6b34c8[_0xb9e2('0x17')](0xcc)[_0xb9e2('0x18')]();});}};}function handleEntityNotFound(_0x15ee75,_0x385322){return function(_0x28d9ab){if(!_0x28d9ab){_0x15ee75[_0xb9e2('0x25')](0x194);}return _0x28d9ab;};}function handleError(_0x4d73e9,_0x394caa){_0x394caa=_0x394caa||0x1f4;return function(_0x6be333){logger[_0xb9e2('0x26')](_0x6be333[_0xb9e2('0x27')]);if(_0x6be333[_0xb9e2('0x28')]){delete _0x6be333['name'];}_0x4d73e9['status'](_0x394caa)['send'](_0x6be333);};}exports[_0xb9e2('0x29')]=function(_0x2a5fbe,_0x497362){var _0x157f43={},_0x265153={},_0x4ea639={'count':0x0,'rows':[]};var _0x26cf8e=_[_0xb9e2('0x2a')](db[_0xb9e2('0x2b')][_0xb9e2('0x2c')],function(_0x28577d){return{'name':_0x28577d['fieldName'],'type':_0x28577d[_0xb9e2('0x2d')][_0xb9e2('0x2e')]};});_0x265153[_0xb9e2('0x2f')]=_[_0xb9e2('0x2a')](_0x26cf8e,_0xb9e2('0x28'));_0x265153[_0xb9e2('0x30')]=_[_0xb9e2('0x31')](_0x2a5fbe[_0xb9e2('0x30')]);_0x265153[_0xb9e2('0x32')]=_[_0xb9e2('0x33')](_0x265153[_0xb9e2('0x2f')],_0x265153[_0xb9e2('0x30')]);_0x157f43[_0xb9e2('0x34')]=_['intersection'](_0x265153[_0xb9e2('0x2f')],qs['fields'](_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x35')]));_0x157f43[_0xb9e2('0x34')]=_0x157f43[_0xb9e2('0x34')][_0xb9e2('0x36')]?_0x157f43[_0xb9e2('0x34')]:_0x265153['model'];if(!_0x2a5fbe['query']['hasOwnProperty'](_0xb9e2('0x37'))){_0x157f43[_0xb9e2('0x1b')]=qs['limit'](_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x1b')]);_0x157f43[_0xb9e2('0x1a')]=qs[_0xb9e2('0x1a')](_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x1a')]);}_0x157f43[_0xb9e2('0x38')]=qs[_0xb9e2('0x39')](_0x2a5fbe['query'][_0xb9e2('0x39')]);_0x157f43[_0xb9e2('0x3a')]=qs[_0xb9e2('0x32')](_[_0xb9e2('0x3b')](_0x2a5fbe[_0xb9e2('0x30')],_0x265153['filters']),_0x26cf8e);if(_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x3c')]){_0x157f43['where']=_[_0xb9e2('0x3d')](_0x157f43[_0xb9e2('0x3a')],{'$or':_[_0xb9e2('0x2a')](_0x26cf8e,function(_0x12d88c){if(_0x12d88c[_0xb9e2('0x2d')]!==_0xb9e2('0x3e')){var _0x25af49={};_0x25af49[_0x12d88c['name']]={'$like':'%'+_0x2a5fbe[_0xb9e2('0x30')]['filter']+'%'};return _0x25af49;}})});}_0x157f43=_[_0xb9e2('0x3d')]({},_0x157f43,_0x2a5fbe[_0xb9e2('0x3f')]);var _0x3f4c66={'where':_0x157f43[_0xb9e2('0x3a')]};return db[_0xb9e2('0x2b')][_0xb9e2('0x19')](_0x3f4c66)[_0xb9e2('0x23')](function(_0x597eac){_0x4ea639[_0xb9e2('0x19')]=_0x597eac;if(_0x2a5fbe[_0xb9e2('0x30')][_0xb9e2('0x40')]){_0x157f43['include']=[{'all':!![]}];}return db[_0xb9e2('0x2b')]['findAll'](_0x157f43);})[_0xb9e2('0x23')](function(_0x35e341){_0x4ea639[_0xb9e2('0x41')]=_0x35e341;return _0x4ea639;})[_0xb9e2('0x23')](respondWithFilteredResult(_0x497362,_0x157f43))[_0xb9e2('0x42')](handleError(_0x497362,null));};exports[_0xb9e2('0x43')]=function(_0x1b5fb6,_0x5ac546){var _0x4ffe90={'raw':!![],'where':{'id':_0x1b5fb6[_0xb9e2('0x44')]['id']}},_0x27ff29={};_0x27ff29['model']=_[_0xb9e2('0x31')](db[_0xb9e2('0x2b')]['rawAttributes']);_0x27ff29[_0xb9e2('0x30')]=_[_0xb9e2('0x31')](_0x1b5fb6['query']);_0x27ff29[_0xb9e2('0x32')]=_['intersection'](_0x27ff29[_0xb9e2('0x2f')],_0x27ff29['query']);_0x4ffe90[_0xb9e2('0x34')]=_['intersection'](_0x27ff29[_0xb9e2('0x2f')],qs['fields'](_0x1b5fb6[_0xb9e2('0x30')][_0xb9e2('0x35')]));_0x4ffe90[_0xb9e2('0x34')]=_0x4ffe90['attributes'][_0xb9e2('0x36')]?_0x4ffe90[_0xb9e2('0x34')]:_0x27ff29[_0xb9e2('0x2f')];if(_0x1b5fb6[_0xb9e2('0x30')][_0xb9e2('0x40')]){_0x4ffe90[_0xb9e2('0x45')]=[{'all':!![]}];}_0x4ffe90=_[_0xb9e2('0x3d')]({},_0x4ffe90,_0x1b5fb6[_0xb9e2('0x3f')]);return db[_0xb9e2('0x2b')][_0xb9e2('0x46')](_0x4ffe90)[_0xb9e2('0x23')](handleEntityNotFound(_0x5ac546,null))[_0xb9e2('0x23')](respondWithResult(_0x5ac546,null))[_0xb9e2('0x42')](handleError(_0x5ac546,null));};exports[_0xb9e2('0x47')]=function(_0x138e4a,_0x1797ef){return db[_0xb9e2('0x2b')]['create'](_0x138e4a[_0xb9e2('0x48')],{})['then'](respondWithResult(_0x1797ef,0xc9))[_0xb9e2('0x42')](handleError(_0x1797ef,null));};exports['update']=function(_0x52a586,_0x499a34){if(_0x52a586[_0xb9e2('0x48')]['id']){delete _0x52a586[_0xb9e2('0x48')]['id'];}return db[_0xb9e2('0x2b')][_0xb9e2('0x46')]({'where':{'id':_0x52a586[_0xb9e2('0x44')]['id']}})[_0xb9e2('0x23')](handleEntityNotFound(_0x499a34,null))[_0xb9e2('0x23')](saveUpdates(_0x52a586[_0xb9e2('0x48')],null))[_0xb9e2('0x23')](respondWithResult(_0x499a34,null))[_0xb9e2('0x42')](handleError(_0x499a34,null));};exports['destroy']=function(_0xfdc735,_0x556b73){return db[_0xb9e2('0x2b')]['find']({'where':{'id':_0xfdc735[_0xb9e2('0x44')]['id']}})[_0xb9e2('0x23')](handleEntityNotFound(_0x556b73,null))[_0xb9e2('0x23')](removeEntity(_0x556b73,null))['catch'](handleError(_0x556b73,null));}; \ No newline at end of file +var _0x4ad5=['update','body','html-pdf','eml-format','rimraf','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create'];(function(_0x1ace56,_0x1509be){var _0x5005c8=function(_0x179818){while(--_0x179818){_0x1ace56['push'](_0x1ace56['shift']());}};_0x5005c8(++_0x1509be);}(_0x4ad5,0x174));var _0x54ad=function(_0x2a2569,_0x53f529){_0x2a2569=_0x2a2569-0x0;var _0x490e52=_0x4ad5[_0x2a2569];return _0x490e52;};'use strict';var pdf=require(_0x54ad('0x0'));var emlformat=require(_0x54ad('0x1'));var rimraf=require(_0x54ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x54ad('0x3'));var Mustache=require(_0x54ad('0x4'));var util=require(_0x54ad('0x5'));var path=require(_0x54ad('0x6'));var sox=require(_0x54ad('0x7'));var csv=require('to-csv');var ejs=require(_0x54ad('0x8'));var fs=require('fs');var _=require(_0x54ad('0x9'));var squel=require(_0x54ad('0xa'));var crypto=require(_0x54ad('0xb'));var jsforce=require(_0x54ad('0xc'));var deskjs=require(_0x54ad('0xd'));var toCsv=require('to-csv');var querystring=require(_0x54ad('0xe'));var Papa=require(_0x54ad('0xf'));var Redis=require('ioredis');var authService=require(_0x54ad('0x10'));var qs=require(_0x54ad('0x11'));var as=require(_0x54ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54ad('0x13'))(_0x54ad('0x14'));var utils=require(_0x54ad('0x15'));var config=require(_0x54ad('0x16'));var db=require(_0x54ad('0x17'))['db'];function respondWithStatusCode(_0x59c216,_0x3daa17){_0x3daa17=_0x3daa17||0xcc;return function(_0x1eb443){if(_0x1eb443){return _0x59c216[_0x54ad('0x18')](_0x3daa17);}return _0x59c216[_0x54ad('0x19')](_0x3daa17)[_0x54ad('0x1a')]();};}function respondWithResult(_0xf552dd,_0x47e412){_0x47e412=_0x47e412||0xc8;return function(_0x8af55b){if(_0x8af55b){return _0xf552dd[_0x54ad('0x19')](_0x47e412)['json'](_0x8af55b);}};}function respondWithFilteredResult(_0x153587,_0x138202){return function(_0x4d2819){if(_0x4d2819){var _0x9cb13=_0x4d2819['count'],_0x1f73cd=_0x138202[_0x54ad('0x1b')],_0x226700=_0x138202[_0x54ad('0x1b')]+_0x138202[_0x54ad('0x1c')],_0xdb9e4f;if(_0x226700>=_0x9cb13){_0x226700=_0x9cb13;_0xdb9e4f=0xc8;}else{_0xdb9e4f=0xce;}_0x153587['status'](_0xdb9e4f);return _0x153587[_0x54ad('0x1d')]('Content-Range',_0x1f73cd+'-'+_0x226700+'/'+_0x9cb13)['json'](_0x4d2819);}return null;};}function patchUpdates(_0x191ecc){return function(_0x204c04){try{jsonpatch[_0x54ad('0x1e')](_0x204c04,_0x191ecc,!![]);}catch(_0x3428d3){return BPromise[_0x54ad('0x1f')](_0x3428d3);}return _0x204c04[_0x54ad('0x20')]();};}function saveUpdates(_0x3ddc08,_0x1bcfbe){return function(_0x5021cd){if(_0x5021cd){return _0x5021cd['update'](_0x3ddc08)['then'](function(_0x18ade5){return _0x18ade5;});}return null;};}function removeEntity(_0x1401b6,_0x2e46e5){return function(_0x102e14){if(_0x102e14){return _0x102e14[_0x54ad('0x21')]()[_0x54ad('0x22')](function(){_0x1401b6[_0x54ad('0x19')](0xcc)[_0x54ad('0x1a')]();});}};}function handleEntityNotFound(_0x1863ff,_0x34dc60){return function(_0x3975b5){if(!_0x3975b5){_0x1863ff[_0x54ad('0x18')](0x194);}return _0x3975b5;};}function handleError(_0x36d95d,_0x4bfc74){_0x4bfc74=_0x4bfc74||0x1f4;return function(_0x3ec08f){logger[_0x54ad('0x23')](_0x3ec08f[_0x54ad('0x24')]);if(_0x3ec08f[_0x54ad('0x25')]){delete _0x3ec08f['name'];}_0x36d95d['status'](_0x4bfc74)[_0x54ad('0x26')](_0x3ec08f);};}exports[_0x54ad('0x27')]=function(_0x334355,_0x1f90c1){var _0x5c0e74={},_0x373a5c={},_0x4be4a2={'count':0x0,'rows':[]};var _0x388bb3=_[_0x54ad('0x28')](db[_0x54ad('0x29')][_0x54ad('0x2a')],function(_0x1eca3d){return{'name':_0x1eca3d[_0x54ad('0x2b')],'type':_0x1eca3d['type']['key']};});_0x373a5c[_0x54ad('0x2c')]=_[_0x54ad('0x28')](_0x388bb3,_0x54ad('0x25'));_0x373a5c[_0x54ad('0x2d')]=_['keys'](_0x334355[_0x54ad('0x2d')]);_0x373a5c[_0x54ad('0x2e')]=_[_0x54ad('0x2f')](_0x373a5c['model'],_0x373a5c[_0x54ad('0x2d')]);_0x5c0e74['attributes']=_['intersection'](_0x373a5c['model'],qs[_0x54ad('0x30')](_0x334355[_0x54ad('0x2d')][_0x54ad('0x30')]));_0x5c0e74['attributes']=_0x5c0e74[_0x54ad('0x31')][_0x54ad('0x32')]?_0x5c0e74[_0x54ad('0x31')]:_0x373a5c[_0x54ad('0x2c')];if(!_0x334355[_0x54ad('0x2d')][_0x54ad('0x33')](_0x54ad('0x34'))){_0x5c0e74[_0x54ad('0x1c')]=qs[_0x54ad('0x1c')](_0x334355[_0x54ad('0x2d')][_0x54ad('0x1c')]);_0x5c0e74['offset']=qs['offset'](_0x334355[_0x54ad('0x2d')]['offset']);}_0x5c0e74[_0x54ad('0x35')]=qs[_0x54ad('0x36')](_0x334355[_0x54ad('0x2d')][_0x54ad('0x36')]);_0x5c0e74['where']=qs[_0x54ad('0x2e')](_[_0x54ad('0x37')](_0x334355['query'],_0x373a5c['filters']),_0x388bb3);if(_0x334355[_0x54ad('0x2d')][_0x54ad('0x38')]){_0x5c0e74[_0x54ad('0x39')]=_[_0x54ad('0x3a')](_0x5c0e74[_0x54ad('0x39')],{'$or':_[_0x54ad('0x28')](_0x388bb3,function(_0x5d935c){if(_0x5d935c[_0x54ad('0x3b')]!=='VIRTUAL'){var _0x5339b5={};_0x5339b5[_0x5d935c[_0x54ad('0x25')]]={'$like':'%'+_0x334355[_0x54ad('0x2d')]['filter']+'%'};return _0x5339b5;}})});}_0x5c0e74=_[_0x54ad('0x3a')]({},_0x5c0e74,_0x334355[_0x54ad('0x3c')]);var _0x47ec9e={'where':_0x5c0e74[_0x54ad('0x39')]};return db['FreshsalesField'][_0x54ad('0x3d')](_0x47ec9e)[_0x54ad('0x22')](function(_0x523cb9){_0x4be4a2[_0x54ad('0x3d')]=_0x523cb9;if(_0x334355[_0x54ad('0x2d')][_0x54ad('0x3e')]){_0x5c0e74[_0x54ad('0x3f')]=[{'all':!![]}];}return db['FreshsalesField'][_0x54ad('0x40')](_0x5c0e74);})[_0x54ad('0x22')](function(_0x5c2aa8){_0x4be4a2[_0x54ad('0x41')]=_0x5c2aa8;return _0x4be4a2;})[_0x54ad('0x22')](respondWithFilteredResult(_0x1f90c1,_0x5c0e74))[_0x54ad('0x42')](handleError(_0x1f90c1,null));};exports[_0x54ad('0x43')]=function(_0x562ddb,_0x481784){var _0x5e2079={'raw':!![],'where':{'id':_0x562ddb[_0x54ad('0x44')]['id']}},_0x8d3b73={};_0x8d3b73[_0x54ad('0x2c')]=_[_0x54ad('0x45')](db[_0x54ad('0x29')]['rawAttributes']);_0x8d3b73['query']=_[_0x54ad('0x45')](_0x562ddb['query']);_0x8d3b73[_0x54ad('0x2e')]=_[_0x54ad('0x2f')](_0x8d3b73[_0x54ad('0x2c')],_0x8d3b73[_0x54ad('0x2d')]);_0x5e2079[_0x54ad('0x31')]=_[_0x54ad('0x2f')](_0x8d3b73[_0x54ad('0x2c')],qs[_0x54ad('0x30')](_0x562ddb[_0x54ad('0x2d')]['fields']));_0x5e2079[_0x54ad('0x31')]=_0x5e2079['attributes'][_0x54ad('0x32')]?_0x5e2079['attributes']:_0x8d3b73[_0x54ad('0x2c')];if(_0x562ddb[_0x54ad('0x2d')][_0x54ad('0x3e')]){_0x5e2079[_0x54ad('0x3f')]=[{'all':!![]}];}_0x5e2079=_[_0x54ad('0x3a')]({},_0x5e2079,_0x562ddb['options']);return db['FreshsalesField'][_0x54ad('0x46')](_0x5e2079)[_0x54ad('0x22')](handleEntityNotFound(_0x481784,null))['then'](respondWithResult(_0x481784,null))[_0x54ad('0x42')](handleError(_0x481784,null));};exports[_0x54ad('0x47')]=function(_0xb01f2f,_0x2f7211){return db[_0x54ad('0x29')][_0x54ad('0x47')](_0xb01f2f['body'],{})['then'](respondWithResult(_0x2f7211,0xc9))[_0x54ad('0x42')](handleError(_0x2f7211,null));};exports[_0x54ad('0x48')]=function(_0x377a25,_0x3a1658){if(_0x377a25[_0x54ad('0x49')]['id']){delete _0x377a25[_0x54ad('0x49')]['id'];}return db[_0x54ad('0x29')]['find']({'where':{'id':_0x377a25['params']['id']}})[_0x54ad('0x22')](handleEntityNotFound(_0x3a1658,null))[_0x54ad('0x22')](saveUpdates(_0x377a25['body'],null))[_0x54ad('0x22')](respondWithResult(_0x3a1658,null))[_0x54ad('0x42')](handleError(_0x3a1658,null));};exports[_0x54ad('0x21')]=function(_0x29c5f9,_0x4a0ba6){return db[_0x54ad('0x29')][_0x54ad('0x46')]({'where':{'id':_0x29c5f9[_0x54ad('0x44')]['id']}})[_0x54ad('0x22')](handleEntityNotFound(_0x4a0ba6,null))['then'](removeEntity(_0x4a0ba6,null))['catch'](handleError(_0x4a0ba6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index a6d4fac..f91e2d8 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 _0xee0a=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x462c07,_0x2ac424){var _0x324613=function(_0x59212b){while(--_0x59212b){_0x462c07['push'](_0x462c07['shift']());}};_0x324613(++_0x2ac424);}(_0xee0a,0x1f0));var _0xaee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee0a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaee0('0x0'));var util=require(_0xaee0('0x1'));var logger=require(_0xaee0('0x2'))(_0xaee0('0x3'));var moment=require(_0xaee0('0x4'));var BPromise=require(_0xaee0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaee0('0x6'));var config=require(_0xaee0('0x7'));var attributes=require(_0xaee0('0x8'));module[_0xaee0('0x9')]=function(_0x190561,_0x204c40){return _0x190561[_0xaee0('0xa')](_0xaee0('0xb'),attributes,{'tableName':_0xaee0('0xc'),'paranoid':![],'indexes':[{'name':_0xaee0('0xd'),'fields':['idField',_0xaee0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55cb=['bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','lodash','util','../../config/logger','api'];(function(_0x3f6c8d,_0x40f3d7){var _0x2efde0=function(_0x2b8e30){while(--_0x2b8e30){_0x3f6c8d['push'](_0x3f6c8d['shift']());}};_0x2efde0(++_0x40f3d7);}(_0x55cb,0x151));var _0xb55c=function(_0xe9c8e4,_0x3aa2f6){_0xe9c8e4=_0xe9c8e4-0x0;var _0x2037fa=_0x55cb[_0xe9c8e4];return _0x2037fa;};'use strict';var _=require(_0xb55c('0x0'));var util=require(_0xb55c('0x1'));var logger=require(_0xb55c('0x2'))(_0xb55c('0x3'));var moment=require('moment');var BPromise=require(_0xb55c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb55c('0x5'));var rimraf=require('rimraf');var config=require(_0xb55c('0x6'));var attributes=require(_0xb55c('0x7'));module[_0xb55c('0x8')]=function(_0x1f56de,_0x1579c3){return _0x1f56de['define'](_0xb55c('0x9'),attributes,{'tableName':_0xb55c('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField','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 eae6a90..a345971 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 _0xd4ae=['moment','bluebird','ioredis','../../config/logger','rpc','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0xd4ae,0xfa));var _0xed4a=function(_0x2d9da3,_0x63174d){_0x2d9da3=_0x2d9da3-0x0;var _0x2a8d6a=_0xd4ae[_0x2d9da3];return _0x2a8d6a;};'use strict';var _=require(_0xed4a('0x0'));var util=require(_0xed4a('0x1'));var moment=require(_0xed4a('0x2'));var BPromise=require(_0xed4a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed4a('0x5'))(_0xed4a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed4a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28e460,_0x49f2d0,_0x366a76){return new BPromise(function(_0x6e6fa8,_0x1f12c5){return client['request'](_0x28e460,_0x366a76)[_0xed4a('0x8')](function(_0x20e319){logger[_0xed4a('0x9')](_0xed4a('0xa'),_0x49f2d0,_0xed4a('0xb'));logger[_0xed4a('0xc')](_0xed4a('0xd'),_0x49f2d0,_0xed4a('0xb'),JSON[_0xed4a('0xe')](_0x20e319));if(_0x20e319[_0xed4a('0xf')]){if(_0x20e319[_0xed4a('0xf')][_0xed4a('0x10')]===0x1f4){logger[_0xed4a('0xf')](_0xed4a('0xa'),_0x49f2d0,_0x20e319['error']['message']);return _0x1f12c5(_0x20e319[_0xed4a('0xf')]['message']);}logger[_0xed4a('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x49f2d0,_0x20e319[_0xed4a('0xf')]['message']);return _0x6e6fa8(_0x20e319[_0xed4a('0xf')][_0xed4a('0x11')]);}else{logger['info'](_0xed4a('0xa'),_0x49f2d0,_0xed4a('0xb'));_0x6e6fa8(_0x20e319['result'][_0xed4a('0x11')]);}})['catch'](function(_0x1f8043){logger[_0xed4a('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x49f2d0,_0x1f8043);_0x1f12c5(_0x1f8043);});});} \ No newline at end of file +var _0xc852=['FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x209e2e,_0x2ebe53){var _0x1a6358=function(_0x132102){while(--_0x132102){_0x209e2e['push'](_0x209e2e['shift']());}};_0x1a6358(++_0x2ebe53);}(_0xc852,0x1d5));var _0x2c85=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc852[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2c85('0x0'));var util=require(_0x2c85('0x1'));var moment=require(_0x2c85('0x2'));var BPromise=require(_0x2c85('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c85('0x4'))['db'];var utils=require(_0x2c85('0x5'));var logger=require(_0x2c85('0x6'))(_0x2c85('0x7'));var config=require(_0x2c85('0x8'));var jayson=require(_0x2c85('0x9'));var client=jayson[_0x2c85('0xa')][_0x2c85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22680c,_0x30456a,_0x473fc0){return new BPromise(function(_0x5d55c0,_0x11074b){return client[_0x2c85('0xc')](_0x22680c,_0x473fc0)[_0x2c85('0xd')](function(_0x4f6faa){logger[_0x2c85('0xe')](_0x2c85('0xf'),_0x30456a,_0x2c85('0x10'));logger[_0x2c85('0x11')](_0x2c85('0x12'),_0x30456a,_0x2c85('0x10'),JSON['stringify'](_0x4f6faa));if(_0x4f6faa[_0x2c85('0x13')]){if(_0x4f6faa[_0x2c85('0x13')]['code']===0x1f4){logger[_0x2c85('0x13')](_0x2c85('0xf'),_0x30456a,_0x4f6faa[_0x2c85('0x13')][_0x2c85('0x14')]);return _0x11074b(_0x4f6faa[_0x2c85('0x13')][_0x2c85('0x14')]);}logger[_0x2c85('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x30456a,_0x4f6faa[_0x2c85('0x13')]['message']);return _0x5d55c0(_0x4f6faa[_0x2c85('0x13')]['message']);}else{logger[_0x2c85('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x30456a,_0x2c85('0x10'));_0x5d55c0(_0x4f6faa[_0x2c85('0x15')]['message']);}})['catch'](function(_0x350e94){logger[_0x2c85('0x13')](_0x2c85('0xf'),_0x30456a,_0x350e94);_0x11074b(_0x350e94);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e891065..e3fbb91 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 _0x0f17=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x9d58e0,_0x5ee515){var _0x5eab07=function(_0x177eb4){while(--_0x177eb4){_0x9d58e0['push'](_0x9d58e0['shift']());}};_0x5eab07(++_0x5ee515);}(_0x0f17,0x8b));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x70f1('0x0'));var util=require(_0x70f1('0x1'));var path=require(_0x70f1('0x2'));var timeout=require(_0x70f1('0x3'));var express=require(_0x70f1('0x4'));var router=express[_0x70f1('0x5')]();var auth=require(_0x70f1('0x6'));var interaction=require(_0x70f1('0x7'));var config=require(_0x70f1('0x8'));var controller=require(_0x70f1('0x9'));router[_0x70f1('0xa')]('/',auth[_0x70f1('0xb')](),controller[_0x70f1('0xc')]);router[_0x70f1('0xa')](_0x70f1('0xd'),auth[_0x70f1('0xb')](),controller['show']);router[_0x70f1('0xa')]('/:id/configurations',auth[_0x70f1('0xb')](),controller[_0x70f1('0xe')]);router['get'](_0x70f1('0xf'),auth[_0x70f1('0xb')](),controller[_0x70f1('0x10')]);router['post']('/',auth[_0x70f1('0xb')](),controller[_0x70f1('0x11')]);router['post'](_0x70f1('0x12'),auth[_0x70f1('0xb')](),controller[_0x70f1('0x13')]);router[_0x70f1('0x14')](_0x70f1('0xd'),auth[_0x70f1('0xb')](),controller[_0x70f1('0x15')]);router[_0x70f1('0x16')]('/:id',auth[_0x70f1('0xb')](),controller['destroy']);module[_0x70f1('0x17')]=router; \ No newline at end of file +var _0xeb5d=['post','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x17d006,_0x4884c1){var _0x43ec4a=function(_0x3cd41b){while(--_0x3cd41b){_0x17d006['push'](_0x17d006['shift']());}};_0x43ec4a(++_0x4884c1);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xeb5d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0xdeb5('0x0'));var path=require(_0xdeb5('0x1'));var timeout=require(_0xdeb5('0x2'));var express=require(_0xdeb5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdeb5('0x4'));var config=require(_0xdeb5('0x5'));var controller=require('./intSalesforceAccount.controller');router[_0xdeb5('0x6')]('/',auth[_0xdeb5('0x7')](),controller[_0xdeb5('0x8')]);router[_0xdeb5('0x6')](_0xdeb5('0x9'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0xa')]);router[_0xdeb5('0x6')](_0xdeb5('0xb'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0xc')]);router[_0xdeb5('0x6')](_0xdeb5('0xd'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0xe')]);router[_0xdeb5('0xf')]('/',auth[_0xdeb5('0x7')](),controller['create']);router[_0xdeb5('0xf')](_0xdeb5('0xb'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0x10')]);router[_0xdeb5('0x11')](_0xdeb5('0x9'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0x12')]);router['delete'](_0xdeb5('0x9'),auth['isAuthenticated'](),controller[_0xdeb5('0x13')]);module[_0xdeb5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index cdf062c..2f15b15 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(_0x166dcd,_0x1ba118){var _0x1731d4=function(_0xa31e02){while(--_0xa31e02){_0x166dcd['push'](_0x166dcd['shift']());}};_0x1731d4(++_0x1ba118);}(_0x814b,0x1a2));var _0xb814=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0x814b[_0x2be240];return _0x123543;};'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(_0x10beb0,_0x494197){_0x10beb0=_0x10beb0-0x0;var _0x225f78=_0x326f[_0x10beb0];return _0x225f78;};'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 9d8c773..3f17020 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 _0x84c7=['attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','length','options','find','create','body','destroy','SalesforceConfiguration','nolimit','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','remoteUri','username','password','securityToken','slice','substring','clientSecret','login','isNil','ticketType','sobject','describe','CallDisposition','CallObject','IsArchived','Priority','Status','Type','Case','Origin','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','rimraf','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','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','count','offset','limit','apply','save','update','then','end','stack','name','send','SalesforceAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields'];(function(_0x1a4748,_0x40c46e){var _0x28ca99=function(_0x99232c){while(--_0x99232c){_0x1a4748['push'](_0x1a4748['shift']());}};_0x28ca99(++_0x40c46e);}(_0x84c7,0x1cd));var _0x784c=function(_0xde760f,_0x3d39ce){_0xde760f=_0xde760f-0x0;var _0x45e46d=_0x84c7[_0xde760f];return _0x45e46d;};'use strict';var pdf=require(_0x784c('0x0'));var emlformat=require(_0x784c('0x1'));var rimraf=require(_0x784c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x784c('0x3'));var moment=require('moment');var BPromise=require(_0x784c('0x4'));var Mustache=require(_0x784c('0x5'));var util=require('util');var path=require(_0x784c('0x6'));var sox=require(_0x784c('0x7'));var csv=require(_0x784c('0x8'));var ejs=require(_0x784c('0x9'));var fs=require('fs');var _=require(_0x784c('0xa'));var squel=require(_0x784c('0xb'));var crypto=require(_0x784c('0xc'));var jsforce=require(_0x784c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x784c('0xe'));var Papa=require(_0x784c('0xf'));var Redis=require(_0x784c('0x10'));var authService=require(_0x784c('0x11'));var qs=require(_0x784c('0x12'));var as=require(_0x784c('0x13'));var hardwareService=require(_0x784c('0x14'));var logger=require(_0x784c('0x15'))(_0x784c('0x16'));var utils=require(_0x784c('0x17'));var config=require(_0x784c('0x18'));var db=require(_0x784c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x784c('0x1a'));var client=jayson[_0x784c('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x44b692,_0x4d1666,_0x5012d6){if(_0x5012d6){var _0x2619b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2619b2[_0x784c('0x1c')](_0x4d1666)){return _0x44b692;}else{throw new db[(_0x784c('0x1d'))][(_0x784c('0x1e'))](_0x784c('0x1f'));}}else{return _0x44b692;}}function respondWithRpcPromise(_0x288801,_0x35bc74,_0x1f860b,_0xdbe9b4){return new BPromise(function(_0x9803fc,_0x177469){var _0x55923d=_0xdbe9b4||client;return _0x55923d[_0x784c('0x20')](_0x288801,_0x1f860b)['then'](function(_0x1dcc85){logger[_0x784c('0x21')](_0x784c('0x22'),_0x35bc74,_0x784c('0x23'));logger[_0x784c('0x24')](_0x784c('0x25'),_0x35bc74,_0x784c('0x23'),JSON['stringify'](_0x1dcc85));if(_0x1dcc85['error']){if(_0x1dcc85[_0x784c('0x26')][_0x784c('0x27')]===0x1f4){logger['error'](_0x784c('0x22'),_0x35bc74,_0x1dcc85[_0x784c('0x26')][_0x784c('0x28')]);return _0x177469(_0x1dcc85[_0x784c('0x26')]['message']);}logger[_0x784c('0x26')](_0x784c('0x22'),_0x35bc74,_0x1dcc85['error'][_0x784c('0x28')]);return _0x9803fc(_0x1dcc85[_0x784c('0x26')][_0x784c('0x28')]);}else{logger[_0x784c('0x21')](_0x784c('0x22'),_0x35bc74,'request\x20sent');_0x9803fc(_0x1dcc85['result'][_0x784c('0x28')]);}})[_0x784c('0x29')](function(_0x1258fc){logger['error'](_0x784c('0x22'),_0x35bc74,_0x1258fc);_0x177469(_0x1258fc);});});}function respondWithStatusCode(_0xaf8eec,_0x17f28b){_0x17f28b=_0x17f28b||0xcc;return function(_0x4aa6d8){if(_0x4aa6d8){return _0xaf8eec[_0x784c('0x2a')](_0x17f28b);}return _0xaf8eec[_0x784c('0x2b')](_0x17f28b)['end']();};}function respondWithResult(_0x40226d,_0x4f3176){_0x4f3176=_0x4f3176||0xc8;return function(_0x24ee88){if(_0x24ee88){return _0x40226d['status'](_0x4f3176)[_0x784c('0x2c')](_0x24ee88);}};}function respondWithFilteredResult(_0x33d355,_0x1d5ab7){return function(_0x11ff8b){if(_0x11ff8b){var _0x5ebe0a=_0x11ff8b[_0x784c('0x2d')],_0x54ce57=_0x1d5ab7[_0x784c('0x2e')],_0x14e70d=_0x1d5ab7['offset']+_0x1d5ab7[_0x784c('0x2f')],_0x5d982a;if(_0x14e70d>=_0x5ebe0a){_0x14e70d=_0x5ebe0a;_0x5d982a=0xc8;}else{_0x5d982a=0xce;}_0x33d355[_0x784c('0x2b')](_0x5d982a);return _0x33d355['set']('Content-Range',_0x54ce57+'-'+_0x14e70d+'/'+_0x5ebe0a)[_0x784c('0x2c')](_0x11ff8b);}return null;};}function patchUpdates(_0xe2e098){return function(_0x2b4d36){try{jsonpatch[_0x784c('0x30')](_0x2b4d36,_0xe2e098,!![]);}catch(_0x429a9c){return BPromise['reject'](_0x429a9c);}return _0x2b4d36[_0x784c('0x31')]();};}function saveUpdates(_0x476c12,_0x432536){return function(_0x267719){if(_0x267719){return _0x267719[_0x784c('0x32')](_0x476c12)[_0x784c('0x33')](function(_0x105540){return _0x105540;});}return null;};}function removeEntity(_0x5d55c7,_0x58cf4f){return function(_0x56a491){if(_0x56a491){return _0x56a491['destroy']()[_0x784c('0x33')](function(){_0x5d55c7[_0x784c('0x2b')](0xcc)[_0x784c('0x34')]();});}};}function handleEntityNotFound(_0x1d291a,_0x203b69){return function(_0x5bee36){if(!_0x5bee36){_0x1d291a[_0x784c('0x2a')](0x194);}return _0x5bee36;};}function handleError(_0x517c99,_0x1c7100){_0x1c7100=_0x1c7100||0x1f4;return function(_0x2c59f1){logger[_0x784c('0x26')](_0x2c59f1[_0x784c('0x35')]);if(_0x2c59f1[_0x784c('0x36')]){delete _0x2c59f1[_0x784c('0x36')];}_0x517c99['status'](_0x1c7100)[_0x784c('0x37')](_0x2c59f1);};}exports['index']=function(_0x3dd4f7,_0x56fb14){var _0x17ed5a={},_0xe892f5={},_0x505557={'count':0x0,'rows':[]};var _0x2a6aa2=_['map'](db[_0x784c('0x38')][_0x784c('0x39')],function(_0x5ae3fe){return{'name':_0x5ae3fe[_0x784c('0x3a')],'type':_0x5ae3fe[_0x784c('0x3b')]['key']};});_0xe892f5[_0x784c('0x3c')]=_[_0x784c('0x3d')](_0x2a6aa2,_0x784c('0x36'));_0xe892f5[_0x784c('0x3e')]=_[_0x784c('0x3f')](_0x3dd4f7[_0x784c('0x3e')]);_0xe892f5[_0x784c('0x40')]=_[_0x784c('0x41')](_0xe892f5['model'],_0xe892f5[_0x784c('0x3e')]);_0x17ed5a['attributes']=_[_0x784c('0x41')](_0xe892f5[_0x784c('0x3c')],qs[_0x784c('0x42')](_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x42')]));_0x17ed5a[_0x784c('0x43')]=_0x17ed5a[_0x784c('0x43')]['length']?_0x17ed5a[_0x784c('0x43')]:_0xe892f5[_0x784c('0x3c')];if(!_0x3dd4f7['query'][_0x784c('0x44')]('nolimit')){_0x17ed5a[_0x784c('0x2f')]=qs[_0x784c('0x2f')](_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x2f')]);_0x17ed5a['offset']=qs['offset'](_0x3dd4f7[_0x784c('0x3e')]['offset']);}_0x17ed5a[_0x784c('0x45')]=qs['sort'](_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x46')]);_0x17ed5a[_0x784c('0x47')]=qs[_0x784c('0x40')](_[_0x784c('0x48')](_0x3dd4f7[_0x784c('0x3e')],_0xe892f5[_0x784c('0x40')]),_0x2a6aa2);if(_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x49')]){_0x17ed5a[_0x784c('0x47')]=_[_0x784c('0x4a')](_0x17ed5a[_0x784c('0x47')],{'$or':_[_0x784c('0x3d')](_0x2a6aa2,function(_0x35c7d5){if(_0x35c7d5[_0x784c('0x3b')]!==_0x784c('0x4b')){var _0x3d966b={};_0x3d966b[_0x35c7d5[_0x784c('0x36')]]={'$like':'%'+_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x49')]+'%'};return _0x3d966b;}})});}_0x17ed5a=_[_0x784c('0x4a')]({},_0x17ed5a,_0x3dd4f7['options']);var _0x57e4fb={'where':_0x17ed5a[_0x784c('0x47')]};return db[_0x784c('0x38')][_0x784c('0x2d')](_0x57e4fb)[_0x784c('0x33')](function(_0x6f7388){_0x505557[_0x784c('0x2d')]=_0x6f7388;if(_0x3dd4f7[_0x784c('0x3e')][_0x784c('0x4c')]){_0x17ed5a[_0x784c('0x4d')]=[{'all':!![]}];}return db[_0x784c('0x38')][_0x784c('0x4e')](_0x17ed5a);})[_0x784c('0x33')](function(_0x4e40f3){_0x505557['rows']=_0x4e40f3;return _0x505557;})[_0x784c('0x33')](respondWithFilteredResult(_0x56fb14,_0x17ed5a))[_0x784c('0x29')](handleError(_0x56fb14,null));};exports[_0x784c('0x4f')]=function(_0x2d8cde,_0x19ebcb){var _0x4e5aec={'raw':![],'where':{'id':_0x2d8cde[_0x784c('0x50')]['id']}},_0x447dcd={};_0x447dcd[_0x784c('0x3c')]=_[_0x784c('0x3f')](db[_0x784c('0x38')]['rawAttributes']);_0x447dcd[_0x784c('0x3e')]=_[_0x784c('0x3f')](_0x2d8cde[_0x784c('0x3e')]);_0x447dcd[_0x784c('0x40')]=_[_0x784c('0x41')](_0x447dcd[_0x784c('0x3c')],_0x447dcd[_0x784c('0x3e')]);_0x4e5aec['attributes']=_[_0x784c('0x41')](_0x447dcd[_0x784c('0x3c')],qs[_0x784c('0x42')](_0x2d8cde[_0x784c('0x3e')][_0x784c('0x42')]));_0x4e5aec[_0x784c('0x43')]=_0x4e5aec['attributes'][_0x784c('0x51')]?_0x4e5aec[_0x784c('0x43')]:_0x447dcd[_0x784c('0x3c')];if(_0x2d8cde[_0x784c('0x3e')][_0x784c('0x4c')]){_0x4e5aec[_0x784c('0x4d')]=[{'all':!![]}];}_0x4e5aec=_['merge']({},_0x4e5aec,_0x2d8cde[_0x784c('0x52')]);return db[_0x784c('0x38')][_0x784c('0x53')](_0x4e5aec)[_0x784c('0x33')](handleEntityNotFound(_0x19ebcb,null))['then'](respondWithResult(_0x19ebcb,null))['catch'](handleError(_0x19ebcb,null));};exports[_0x784c('0x54')]=function(_0xd9bf81,_0x144c77){return db[_0x784c('0x38')][_0x784c('0x54')](_0xd9bf81['body'],{})[_0x784c('0x33')](respondWithResult(_0x144c77,0xc9))[_0x784c('0x29')](handleError(_0x144c77,null));};exports[_0x784c('0x32')]=function(_0x42ec28,_0x384d5e){if(_0x42ec28[_0x784c('0x55')]['id']){delete _0x42ec28[_0x784c('0x55')]['id'];}return db[_0x784c('0x38')][_0x784c('0x53')]({'where':{'id':_0x42ec28[_0x784c('0x50')]['id']}})[_0x784c('0x33')](handleEntityNotFound(_0x384d5e,null))['then'](saveUpdates(_0x42ec28['body'],null))[_0x784c('0x33')](respondWithResult(_0x384d5e,null))[_0x784c('0x29')](handleError(_0x384d5e,null));};exports[_0x784c('0x56')]=function(_0x22037e,_0x4bfa5c){return db[_0x784c('0x38')][_0x784c('0x53')]({'where':{'id':_0x22037e[_0x784c('0x50')]['id']}})['then'](handleEntityNotFound(_0x4bfa5c,null))[_0x784c('0x33')](removeEntity(_0x4bfa5c,null))['catch'](handleError(_0x4bfa5c,null));};exports['getConfigurations']=function(_0x2a65e8,_0x1e8f21,_0x209bf0){var _0x35fd35={};var _0x6010b={};var _0x2c023e;var _0x4874df;return db[_0x784c('0x38')]['findOne']({'where':{'id':_0x2a65e8[_0x784c('0x50')]['id']}})['then'](handleEntityNotFound(_0x1e8f21,null))[_0x784c('0x33')](function(_0x586a29){if(_0x586a29){_0x2c023e=_0x586a29;_0x6010b[_0x784c('0x3c')]=_['keys'](db[_0x784c('0x57')]['rawAttributes']);_0x6010b['query']=_[_0x784c('0x3f')](_0x2a65e8[_0x784c('0x3e')]);_0x6010b[_0x784c('0x40')]=_['intersection'](_0x6010b[_0x784c('0x3c')],_0x6010b[_0x784c('0x3e')]);_0x35fd35[_0x784c('0x43')]=_['intersection'](_0x6010b[_0x784c('0x3c')],qs['fields'](_0x2a65e8['query']['fields']));_0x35fd35[_0x784c('0x43')]=_0x35fd35['attributes'][_0x784c('0x51')]?_0x35fd35[_0x784c('0x43')]:_0x6010b['model'];_0x35fd35['order']=qs[_0x784c('0x46')](_0x2a65e8[_0x784c('0x3e')][_0x784c('0x46')]);_0x35fd35['where']=qs[_0x784c('0x40')](_[_0x784c('0x48')](_0x2a65e8[_0x784c('0x3e')],_0x6010b[_0x784c('0x40')]));if(_0x2a65e8[_0x784c('0x3e')][_0x784c('0x49')]){_0x35fd35['where']=_[_0x784c('0x4a')](_0x35fd35[_0x784c('0x47')],{'$or':_[_0x784c('0x3d')](_0x35fd35[_0x784c('0x43')],function(_0x36fd0a){var _0x295e22={};_0x295e22[_0x36fd0a]={'$like':'%'+_0x2a65e8[_0x784c('0x3e')]['filter']+'%'};return _0x295e22;})});}_0x35fd35=_[_0x784c('0x4a')]({},_0x35fd35,_0x2a65e8[_0x784c('0x52')]);return _0x2c023e['getConfigurations'](_0x35fd35);}})['then'](function(_0xe144a5){if(_0xe144a5){_0x4874df=_0xe144a5['length'];if(!_0x2a65e8[_0x784c('0x3e')][_0x784c('0x44')](_0x784c('0x58'))){_0x35fd35[_0x784c('0x2f')]=qs[_0x784c('0x2f')](_0x2a65e8[_0x784c('0x3e')][_0x784c('0x2f')]);_0x35fd35['offset']=qs['offset'](_0x2a65e8[_0x784c('0x3e')]['offset']);}return _0x2c023e[_0x784c('0x59')](_0x35fd35);}})[_0x784c('0x33')](function(_0x282ebe){if(_0x282ebe){return _0x282ebe?{'count':_0x4874df,'rows':_0x282ebe}:null;}})[_0x784c('0x33')](respondWithResult(_0x1e8f21,null))[_0x784c('0x29')](handleError(_0x1e8f21,null));};exports[_0x784c('0x5a')]=function(_0x3984ce,_0x55b711,_0x14fcbb){if(_0x3984ce['body']['id']){delete _0x3984ce[_0x784c('0x55')]['id'];}return db['SalesforceAccount'][_0x784c('0x5b')]({'where':{'id':_0x3984ce[_0x784c('0x50')]['id']}})[_0x784c('0x33')](handleEntityNotFound(_0x55b711,null))[_0x784c('0x33')](function(_0x4c5c6b){if(_0x4c5c6b){_0x3984ce[_0x784c('0x55')]['AccountId']=_0x4c5c6b['id'];_0x3984ce[_0x784c('0x55')][_0x784c('0x5c')]=integrations[_0x784c('0x5d')](_0x3984ce['body'][_0x784c('0x5e')],_0x3984ce['body'][_0x784c('0x3b')]);_0x3984ce['body']['Descriptions']=integrations['getDescriptions'](_0x3984ce['body']['channel'],_0x3984ce['body']['type']);return db[_0x784c('0x57')][_0x784c('0x54')](_0x3984ce[_0x784c('0x55')],{'include':[{'model':db['SalesforceField'],'as':_0x784c('0x5c')},{'model':db[_0x784c('0x5f')],'as':_0x784c('0x60')}]});}return null;})[_0x784c('0x33')](respondWithResult(_0x55b711,null))[_0x784c('0x29')](handleError(_0x55b711,null));};exports[_0x784c('0x61')]=function(_0x2a11d5,_0x2272a7,_0x418858){var _0x3bf8e0;var _0x191471='';var _0x2911fc='Task';return db[_0x784c('0x38')]['findOne']({'where':{'id':_0x2a11d5[_0x784c('0x50')]['id']},'attributes':['id',_0x784c('0x62'),'clientId','clientSecret',_0x784c('0x63'),_0x784c('0x64'),_0x784c('0x65')]})[_0x784c('0x33')](handleEntityNotFound(_0x2272a7,null))['then'](function(_0x4303db){if(_0x4303db){_0x191471=_0x4303db[_0x784c('0x62')];var _0x500b29=_0x191471[_0x784c('0x66')](-0x1);if(_0x500b29==='/'){_0x191471=_0x191471[_0x784c('0x67')](0x0,_0x191471['lastIndexOf'](_0x500b29));}_0x3bf8e0=new jsforce['Connection']({'oauth2':{'loginUrl':_0x191471,'clientId':_0x4303db['clientId'],'clientSecret':_0x4303db[_0x784c('0x68')]}});return _0x3bf8e0[_0x784c('0x69')](_0x4303db['username'],_0x4303db[_0x784c('0x64')]['concat'](_0x4303db[_0x784c('0x65')]));}})['then'](function(_0x4c601e){if(_0x4c601e){if(!_[_0x784c('0x6a')](_0x2a11d5[_0x784c('0x3e')][_0x784c('0x6b')])){_0x2911fc=_0x2a11d5[_0x784c('0x3e')][_0x784c('0x6b')];}return _0x3bf8e0[_0x784c('0x6c')](_0x2911fc)[_0x784c('0x6d')]();}})[_0x784c('0x33')](function(_0x20fea0){var _0x3db47f=[_0x784c('0x6e'),'CallDurationInSeconds',_0x784c('0x6f'),'CallType',_0x784c('0x70'),_0x784c('0x71'),_0x784c('0x72'),_0x784c('0x73')];if(!_[_0x784c('0x6a')](_0x2a11d5[_0x784c('0x3e')][_0x784c('0x6b')])&&_0x2a11d5[_0x784c('0x3e')][_0x784c('0x6b')]===_0x784c('0x74')){_0x3db47f=[_0x784c('0x73'),_0x784c('0x75'),'Reason',_0x784c('0x72'),'Priority','IsEscalated',_0x784c('0x76'),_0x784c('0x77')];}if(_0x20fea0){_[_0x784c('0x78')](_0x20fea0[_0x784c('0x42')],function(_0x655b76){return _0x655b76[_0x784c('0x79')]===![]&&!_0x3db47f[_0x784c('0x7a')](_0x655b76[_0x784c('0x36')]);});return{'count':_0x20fea0[_0x784c('0x42')][_0x784c('0x51')],'rows':_[_0x784c('0x3d')](_0x20fea0[_0x784c('0x42')],function(_0x35c878){return{'id':_0x35c878[_0x784c('0x36')],'name':_0x35c878[_0x784c('0x7b')],'custom':_0x35c878[_0x784c('0x79')],'options':_0x35c878[_0x784c('0x7c')][_0x784c('0x51')]>0x0?_[_0x784c('0x3d')](_0x35c878[_0x784c('0x7c')],function(_0x4892ee){return{'name':_0x4892ee[_0x784c('0x7b')],'value':_0x4892ee['value']};}):_0x35c878['type']=='boolean'?[{'name':_0x784c('0x7d'),'value':_0x784c('0x7e')},{'name':_0x784c('0x7f'),'value':_0x784c('0x80')}]:[]};})};}})[_0x784c('0x33')](respondWithResult(_0x2272a7,null))[_0x784c('0x29')](function(_0x209a60){var _0x27c087=_0x2a11d5[_0x784c('0x3e')][_0x784c('0x1c')]?0x1f4:_0x209a60[_0x784c('0x81')]||0x1f4;logger[_0x784c('0x26')](_0x784c('0x82'),_0x784c('0x61'),_0x27c087,JSON[_0x784c('0x83')](_0x209a60));delete _0x209a60[_0x784c('0x36')];if(_0x27c087===0x191){_0x27c087=0x190;}_0x2272a7[_0x784c('0x2b')](_0x27c087)[_0x784c('0x37')](_0x2a11d5[_0x784c('0x3e')][_0x784c('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x209a60[_0x784c('0x81')]}:_0x209a60);});}; \ No newline at end of file +var _0x3f98=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','name','send','index','map','SalesforceAccount','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','update','body','getConfigurations','findOne','rawAttributes','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','Connection','login','username','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallType','IsArchived','Priority','Status','Type','Reason','SuppliedCompany','remove','custom','includes','label','picklistValues','boolean','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x2af491,_0x282b08){var _0x4d281f=function(_0x3fd903){while(--_0x3fd903){_0x2af491['push'](_0x2af491['shift']());}};_0x4d281f(++_0x282b08);}(_0x3f98,0xfb));var _0x83f9=function(_0x3ba3f2,_0x322f22){_0x3ba3f2=_0x3ba3f2-0x0;var _0x110e03=_0x3f98[_0x3ba3f2];return _0x110e03;};'use strict';var pdf=require(_0x83f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x83f9('0x1'));var zipdir=require(_0x83f9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83f9('0x3'));var moment=require(_0x83f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x83f9('0x5'));var util=require(_0x83f9('0x6'));var path=require(_0x83f9('0x7'));var sox=require(_0x83f9('0x8'));var csv=require(_0x83f9('0x9'));var ejs=require(_0x83f9('0xa'));var fs=require('fs');var _=require(_0x83f9('0xb'));var squel=require(_0x83f9('0xc'));var crypto=require(_0x83f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x83f9('0xe'));var toCsv=require(_0x83f9('0x9'));var querystring=require(_0x83f9('0xf'));var Papa=require(_0x83f9('0x10'));var Redis=require(_0x83f9('0x11'));var authService=require(_0x83f9('0x12'));var qs=require(_0x83f9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83f9('0x14'));var logger=require(_0x83f9('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x83f9('0x16'));var db=require(_0x83f9('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x83f9('0x18')][_0x83f9('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3f6c90,_0x9764e6,_0xd7c2b2){if(_0xd7c2b2){var _0x1a4840=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a4840[_0x83f9('0x1a')](_0x9764e6)){return _0x3f6c90;}else{throw new db[(_0x83f9('0x1b'))][(_0x83f9('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 _0x3f6c90;}}function respondWithRpcPromise(_0x411248,_0x3d93e7,_0x17c1bf,_0x61fa6d){return new BPromise(function(_0x1b077c,_0x60e3c7){var _0x18c914=_0x61fa6d||client;return _0x18c914[_0x83f9('0x1d')](_0x411248,_0x17c1bf)['then'](function(_0x397c47){logger['info'](_0x83f9('0x1e'),_0x3d93e7,_0x83f9('0x1f'));logger[_0x83f9('0x20')](_0x83f9('0x21'),_0x3d93e7,_0x83f9('0x1f'),JSON[_0x83f9('0x22')](_0x397c47));if(_0x397c47[_0x83f9('0x23')]){if(_0x397c47[_0x83f9('0x23')][_0x83f9('0x24')]===0x1f4){logger[_0x83f9('0x23')](_0x83f9('0x1e'),_0x3d93e7,_0x397c47[_0x83f9('0x23')]['message']);return _0x60e3c7(_0x397c47[_0x83f9('0x23')][_0x83f9('0x25')]);}logger[_0x83f9('0x23')]('SalesforceAccount,\x20%s,\x20%s',_0x3d93e7,_0x397c47[_0x83f9('0x23')][_0x83f9('0x25')]);return _0x1b077c(_0x397c47['error'][_0x83f9('0x25')]);}else{logger[_0x83f9('0x26')]('SalesforceAccount,\x20%s,\x20%s',_0x3d93e7,'request\x20sent');_0x1b077c(_0x397c47['result']['message']);}})[_0x83f9('0x27')](function(_0xfa1235){logger[_0x83f9('0x23')](_0x83f9('0x1e'),_0x3d93e7,_0xfa1235);_0x60e3c7(_0xfa1235);});});}function respondWithStatusCode(_0x2598d6,_0x351d24){_0x351d24=_0x351d24||0xcc;return function(_0x343112){if(_0x343112){return _0x2598d6['sendStatus'](_0x351d24);}return _0x2598d6[_0x83f9('0x28')](_0x351d24)[_0x83f9('0x29')]();};}function respondWithResult(_0x19347f,_0xf0f7de){_0xf0f7de=_0xf0f7de||0xc8;return function(_0x18744b){if(_0x18744b){return _0x19347f[_0x83f9('0x28')](_0xf0f7de)[_0x83f9('0x2a')](_0x18744b);}};}function respondWithFilteredResult(_0x3cb932,_0x1fdb66){return function(_0x366efd){if(_0x366efd){var _0x58556a=_0x366efd[_0x83f9('0x2b')],_0x36fc48=_0x1fdb66[_0x83f9('0x2c')],_0x5d6418=_0x1fdb66[_0x83f9('0x2c')]+_0x1fdb66[_0x83f9('0x2d')],_0x2f11fe;if(_0x5d6418>=_0x58556a){_0x5d6418=_0x58556a;_0x2f11fe=0xc8;}else{_0x2f11fe=0xce;}_0x3cb932[_0x83f9('0x28')](_0x2f11fe);return _0x3cb932[_0x83f9('0x2e')](_0x83f9('0x2f'),_0x36fc48+'-'+_0x5d6418+'/'+_0x58556a)[_0x83f9('0x2a')](_0x366efd);}return null;};}function patchUpdates(_0x239340){return function(_0x3ea3be){try{jsonpatch[_0x83f9('0x30')](_0x3ea3be,_0x239340,!![]);}catch(_0x52d1f0){return BPromise['reject'](_0x52d1f0);}return _0x3ea3be[_0x83f9('0x31')]();};}function saveUpdates(_0xe570c4,_0x763d21){return function(_0xc717e){if(_0xc717e){return _0xc717e['update'](_0xe570c4)[_0x83f9('0x32')](function(_0x595654){return _0x595654;});}return null;};}function removeEntity(_0x1f9c2a,_0x582777){return function(_0x4dcbf0){if(_0x4dcbf0){return _0x4dcbf0[_0x83f9('0x33')]()[_0x83f9('0x32')](function(){_0x1f9c2a[_0x83f9('0x28')](0xcc)[_0x83f9('0x29')]();});}};}function handleEntityNotFound(_0x45e45f,_0x32c18a){return function(_0x56e111){if(!_0x56e111){_0x45e45f['sendStatus'](0x194);}return _0x56e111;};}function handleError(_0x4393f2,_0xc406d3){_0xc406d3=_0xc406d3||0x1f4;return function(_0x47990f){logger[_0x83f9('0x23')](_0x47990f['stack']);if(_0x47990f[_0x83f9('0x34')]){delete _0x47990f['name'];}_0x4393f2[_0x83f9('0x28')](_0xc406d3)[_0x83f9('0x35')](_0x47990f);};}exports[_0x83f9('0x36')]=function(_0x3ee198,_0x103572){var _0x563c40={},_0x55345a={},_0x2e6c8a={'count':0x0,'rows':[]};var _0x2a5226=_[_0x83f9('0x37')](db[_0x83f9('0x38')]['rawAttributes'],function(_0x3f282d){return{'name':_0x3f282d[_0x83f9('0x39')],'type':_0x3f282d['type']['key']};});_0x55345a[_0x83f9('0x3a')]=_[_0x83f9('0x37')](_0x2a5226,'name');_0x55345a['query']=_[_0x83f9('0x3b')](_0x3ee198['query']);_0x55345a[_0x83f9('0x3c')]=_[_0x83f9('0x3d')](_0x55345a[_0x83f9('0x3a')],_0x55345a[_0x83f9('0x3e')]);_0x563c40[_0x83f9('0x3f')]=_[_0x83f9('0x3d')](_0x55345a['model'],qs[_0x83f9('0x40')](_0x3ee198['query'][_0x83f9('0x40')]));_0x563c40['attributes']=_0x563c40[_0x83f9('0x3f')][_0x83f9('0x41')]?_0x563c40[_0x83f9('0x3f')]:_0x55345a[_0x83f9('0x3a')];if(!_0x3ee198['query'][_0x83f9('0x42')](_0x83f9('0x43'))){_0x563c40[_0x83f9('0x2d')]=qs[_0x83f9('0x2d')](_0x3ee198[_0x83f9('0x3e')][_0x83f9('0x2d')]);_0x563c40[_0x83f9('0x2c')]=qs[_0x83f9('0x2c')](_0x3ee198['query'][_0x83f9('0x2c')]);}_0x563c40['order']=qs[_0x83f9('0x44')](_0x3ee198[_0x83f9('0x3e')]['sort']);_0x563c40[_0x83f9('0x45')]=qs[_0x83f9('0x3c')](_['pick'](_0x3ee198[_0x83f9('0x3e')],_0x55345a['filters']),_0x2a5226);if(_0x3ee198[_0x83f9('0x3e')][_0x83f9('0x46')]){_0x563c40[_0x83f9('0x45')]=_[_0x83f9('0x47')](_0x563c40['where'],{'$or':_[_0x83f9('0x37')](_0x2a5226,function(_0x829f3d){if(_0x829f3d[_0x83f9('0x48')]!==_0x83f9('0x49')){var _0x3342bb={};_0x3342bb[_0x829f3d[_0x83f9('0x34')]]={'$like':'%'+_0x3ee198[_0x83f9('0x3e')]['filter']+'%'};return _0x3342bb;}})});}_0x563c40=_[_0x83f9('0x47')]({},_0x563c40,_0x3ee198[_0x83f9('0x4a')]);var _0x5d4d2b={'where':_0x563c40[_0x83f9('0x45')]};return db[_0x83f9('0x38')][_0x83f9('0x2b')](_0x5d4d2b)['then'](function(_0x4cf3a4){_0x2e6c8a[_0x83f9('0x2b')]=_0x4cf3a4;if(_0x3ee198['query'][_0x83f9('0x4b')]){_0x563c40[_0x83f9('0x4c')]=[{'all':!![]}];}return db[_0x83f9('0x38')][_0x83f9('0x4d')](_0x563c40);})[_0x83f9('0x32')](function(_0x214d98){_0x2e6c8a[_0x83f9('0x4e')]=_0x214d98;return _0x2e6c8a;})[_0x83f9('0x32')](respondWithFilteredResult(_0x103572,_0x563c40))[_0x83f9('0x27')](handleError(_0x103572,null));};exports[_0x83f9('0x4f')]=function(_0xf9f3d1,_0x254ffa){var _0x473ee6={'raw':![],'where':{'id':_0xf9f3d1[_0x83f9('0x50')]['id']}},_0x29cfbb={};_0x29cfbb[_0x83f9('0x3a')]=_[_0x83f9('0x3b')](db[_0x83f9('0x38')]['rawAttributes']);_0x29cfbb[_0x83f9('0x3e')]=_[_0x83f9('0x3b')](_0xf9f3d1[_0x83f9('0x3e')]);_0x29cfbb[_0x83f9('0x3c')]=_[_0x83f9('0x3d')](_0x29cfbb['model'],_0x29cfbb[_0x83f9('0x3e')]);_0x473ee6[_0x83f9('0x3f')]=_[_0x83f9('0x3d')](_0x29cfbb[_0x83f9('0x3a')],qs[_0x83f9('0x40')](_0xf9f3d1[_0x83f9('0x3e')][_0x83f9('0x40')]));_0x473ee6[_0x83f9('0x3f')]=_0x473ee6[_0x83f9('0x3f')]['length']?_0x473ee6[_0x83f9('0x3f')]:_0x29cfbb['model'];if(_0xf9f3d1[_0x83f9('0x3e')]['includeAll']){_0x473ee6[_0x83f9('0x4c')]=[{'all':!![]}];}_0x473ee6=_[_0x83f9('0x47')]({},_0x473ee6,_0xf9f3d1['options']);return db['SalesforceAccount'][_0x83f9('0x51')](_0x473ee6)[_0x83f9('0x32')](handleEntityNotFound(_0x254ffa,null))['then'](respondWithResult(_0x254ffa,null))[_0x83f9('0x27')](handleError(_0x254ffa,null));};exports[_0x83f9('0x52')]=function(_0x1d3cc6,_0x5091e3){return db['SalesforceAccount'][_0x83f9('0x52')](_0x1d3cc6['body'],{})[_0x83f9('0x32')](respondWithResult(_0x5091e3,0xc9))[_0x83f9('0x27')](handleError(_0x5091e3,null));};exports[_0x83f9('0x53')]=function(_0x5b85dd,_0x1e329d){if(_0x5b85dd[_0x83f9('0x54')]['id']){delete _0x5b85dd['body']['id'];}return db[_0x83f9('0x38')]['find']({'where':{'id':_0x5b85dd[_0x83f9('0x50')]['id']}})['then'](handleEntityNotFound(_0x1e329d,null))['then'](saveUpdates(_0x5b85dd[_0x83f9('0x54')],null))['then'](respondWithResult(_0x1e329d,null))['catch'](handleError(_0x1e329d,null));};exports[_0x83f9('0x33')]=function(_0x10c2f3,_0x17991c){return db['SalesforceAccount'][_0x83f9('0x51')]({'where':{'id':_0x10c2f3[_0x83f9('0x50')]['id']}})['then'](handleEntityNotFound(_0x17991c,null))[_0x83f9('0x32')](removeEntity(_0x17991c,null))[_0x83f9('0x27')](handleError(_0x17991c,null));};exports[_0x83f9('0x55')]=function(_0x2ebffc,_0x5b968a,_0x5181a0){var _0x123e32={};var _0x228cf9={};var _0x5da665;var _0x336ce5;return db['SalesforceAccount'][_0x83f9('0x56')]({'where':{'id':_0x2ebffc[_0x83f9('0x50')]['id']}})[_0x83f9('0x32')](handleEntityNotFound(_0x5b968a,null))[_0x83f9('0x32')](function(_0x3c865c){if(_0x3c865c){_0x5da665=_0x3c865c;_0x228cf9[_0x83f9('0x3a')]=_[_0x83f9('0x3b')](db['SalesforceConfiguration'][_0x83f9('0x57')]);_0x228cf9[_0x83f9('0x3e')]=_[_0x83f9('0x3b')](_0x2ebffc[_0x83f9('0x3e')]);_0x228cf9['filters']=_[_0x83f9('0x3d')](_0x228cf9[_0x83f9('0x3a')],_0x228cf9[_0x83f9('0x3e')]);_0x123e32['attributes']=_[_0x83f9('0x3d')](_0x228cf9['model'],qs[_0x83f9('0x40')](_0x2ebffc[_0x83f9('0x3e')]['fields']));_0x123e32[_0x83f9('0x3f')]=_0x123e32[_0x83f9('0x3f')][_0x83f9('0x41')]?_0x123e32['attributes']:_0x228cf9[_0x83f9('0x3a')];_0x123e32[_0x83f9('0x58')]=qs[_0x83f9('0x44')](_0x2ebffc[_0x83f9('0x3e')][_0x83f9('0x44')]);_0x123e32[_0x83f9('0x45')]=qs['filters'](_['pick'](_0x2ebffc['query'],_0x228cf9[_0x83f9('0x3c')]));if(_0x2ebffc[_0x83f9('0x3e')]['filter']){_0x123e32['where']=_[_0x83f9('0x47')](_0x123e32['where'],{'$or':_['map'](_0x123e32['attributes'],function(_0x16752c){var _0x41556d={};_0x41556d[_0x16752c]={'$like':'%'+_0x2ebffc[_0x83f9('0x3e')]['filter']+'%'};return _0x41556d;})});}_0x123e32=_[_0x83f9('0x47')]({},_0x123e32,_0x2ebffc[_0x83f9('0x4a')]);return _0x5da665[_0x83f9('0x55')](_0x123e32);}})[_0x83f9('0x32')](function(_0x4c2ed3){if(_0x4c2ed3){_0x336ce5=_0x4c2ed3[_0x83f9('0x41')];if(!_0x2ebffc[_0x83f9('0x3e')][_0x83f9('0x42')](_0x83f9('0x43'))){_0x123e32[_0x83f9('0x2d')]=qs[_0x83f9('0x2d')](_0x2ebffc[_0x83f9('0x3e')][_0x83f9('0x2d')]);_0x123e32['offset']=qs[_0x83f9('0x2c')](_0x2ebffc[_0x83f9('0x3e')][_0x83f9('0x2c')]);}return _0x5da665[_0x83f9('0x55')](_0x123e32);}})[_0x83f9('0x32')](function(_0x420895){if(_0x420895){return _0x420895?{'count':_0x336ce5,'rows':_0x420895}:null;}})[_0x83f9('0x32')](respondWithResult(_0x5b968a,null))[_0x83f9('0x27')](handleError(_0x5b968a,null));};exports[_0x83f9('0x59')]=function(_0x19987e,_0x725352,_0x5820af){if(_0x19987e[_0x83f9('0x54')]['id']){delete _0x19987e[_0x83f9('0x54')]['id'];}return db[_0x83f9('0x38')][_0x83f9('0x56')]({'where':{'id':_0x19987e[_0x83f9('0x50')]['id']}})[_0x83f9('0x32')](handleEntityNotFound(_0x725352,null))[_0x83f9('0x32')](function(_0x38f873){if(_0x38f873){_0x19987e[_0x83f9('0x54')][_0x83f9('0x5a')]=_0x38f873['id'];_0x19987e[_0x83f9('0x54')][_0x83f9('0x5b')]=integrations[_0x83f9('0x5c')](_0x19987e['body'][_0x83f9('0x5d')],_0x19987e[_0x83f9('0x54')][_0x83f9('0x48')]);_0x19987e[_0x83f9('0x54')][_0x83f9('0x5e')]=integrations[_0x83f9('0x5f')](_0x19987e[_0x83f9('0x54')][_0x83f9('0x5d')],_0x19987e[_0x83f9('0x54')]['type']);return db[_0x83f9('0x60')][_0x83f9('0x52')](_0x19987e[_0x83f9('0x54')],{'include':[{'model':db[_0x83f9('0x61')],'as':_0x83f9('0x5b')},{'model':db[_0x83f9('0x61')],'as':_0x83f9('0x5e')}]});}return null;})['then'](respondWithResult(_0x725352,null))[_0x83f9('0x27')](handleError(_0x725352,null));};exports['getFields']=function(_0xb4471e,_0x5911e3,_0x2dc43f){var _0x252bec;var _0x355b7a='';var _0x32c1e8='Task';return db['SalesforceAccount']['findOne']({'where':{'id':_0xb4471e[_0x83f9('0x50')]['id']},'attributes':['id',_0x83f9('0x62'),_0x83f9('0x63'),_0x83f9('0x64'),'username',_0x83f9('0x65'),_0x83f9('0x66')]})[_0x83f9('0x32')](handleEntityNotFound(_0x5911e3,null))[_0x83f9('0x32')](function(_0x1d6e05){if(_0x1d6e05){_0x355b7a=_0x1d6e05[_0x83f9('0x62')];var _0x54ed4e=_0x355b7a[_0x83f9('0x67')](-0x1);if(_0x54ed4e==='/'){_0x355b7a=_0x355b7a[_0x83f9('0x68')](0x0,_0x355b7a['lastIndexOf'](_0x54ed4e));}_0x252bec=new jsforce[(_0x83f9('0x69'))]({'oauth2':{'loginUrl':_0x355b7a,'clientId':_0x1d6e05[_0x83f9('0x63')],'clientSecret':_0x1d6e05[_0x83f9('0x64')]}});return _0x252bec[_0x83f9('0x6a')](_0x1d6e05[_0x83f9('0x6b')],_0x1d6e05[_0x83f9('0x65')]['concat'](_0x1d6e05[_0x83f9('0x66')]));}})[_0x83f9('0x32')](function(_0x19838a){if(_0x19838a){if(!_[_0x83f9('0x6c')](_0xb4471e['query'][_0x83f9('0x6d')])){_0x32c1e8=_0xb4471e[_0x83f9('0x3e')][_0x83f9('0x6d')];}return _0x252bec[_0x83f9('0x6e')](_0x32c1e8)['describe']();}})['then'](function(_0x5c784f){var _0xcb522=[_0x83f9('0x6f'),_0x83f9('0x70'),'CallObject',_0x83f9('0x71'),_0x83f9('0x72'),_0x83f9('0x73'),_0x83f9('0x74'),_0x83f9('0x75')];if(!_[_0x83f9('0x6c')](_0xb4471e[_0x83f9('0x3e')]['ticketType'])&&_0xb4471e[_0x83f9('0x3e')][_0x83f9('0x6d')]==='Case'){_0xcb522=['Type','Origin',_0x83f9('0x76'),_0x83f9('0x74'),_0x83f9('0x73'),'IsEscalated','SuppliedName',_0x83f9('0x77')];}if(_0x5c784f){_[_0x83f9('0x78')](_0x5c784f['fields'],function(_0x17e4c2){return _0x17e4c2[_0x83f9('0x79')]===![]&&!_0xcb522[_0x83f9('0x7a')](_0x17e4c2[_0x83f9('0x34')]);});return{'count':_0x5c784f[_0x83f9('0x40')][_0x83f9('0x41')],'rows':_['map'](_0x5c784f[_0x83f9('0x40')],function(_0x56df00){return{'id':_0x56df00[_0x83f9('0x34')],'name':_0x56df00[_0x83f9('0x7b')],'custom':_0x56df00['custom'],'options':_0x56df00['picklistValues'][_0x83f9('0x41')]>0x0?_[_0x83f9('0x37')](_0x56df00[_0x83f9('0x7c')],function(_0x250c9b){return{'name':_0x250c9b[_0x83f9('0x7b')],'value':_0x250c9b['value']};}):_0x56df00[_0x83f9('0x48')]==_0x83f9('0x7d')?[{'name':'True','value':_0x83f9('0x7e')},{'name':_0x83f9('0x7f'),'value':_0x83f9('0x80')}]:[]};})};}})[_0x83f9('0x32')](respondWithResult(_0x5911e3,null))['catch'](function(_0x4e9e73){var _0x496a45=_0xb4471e[_0x83f9('0x3e')][_0x83f9('0x1a')]?0x1f4:_0x4e9e73[_0x83f9('0x81')]||0x1f4;logger[_0x83f9('0x23')](_0x83f9('0x82'),_0x83f9('0x83'),_0x496a45,JSON['stringify'](_0x4e9e73));delete _0x4e9e73['name'];if(_0x496a45===0x191){_0x496a45=0x190;}_0x5911e3['status'](_0x496a45)[_0x83f9('0x35')](_0xb4471e[_0x83f9('0x3e')][_0x83f9('0x1a')]?{'message':_0x83f9('0x84'),'statusCode':_0x4e9e73['statusCode']}:_0x4e9e73);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 86db5c3..bc67322 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 _0xf21f=['int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0xd81b64,_0x182b6d){var _0x2b72cb=function(_0x330a1d){while(--_0x330a1d){_0xd81b64['push'](_0xd81b64['shift']());}};_0x2b72cb(++_0x182b6d);}(_0xf21f,0x13c));var _0xff21=function(_0x312940,_0x27d5aa){_0x312940=_0x312940-0x0;var _0x4c2cc5=_0xf21f[_0x312940];return _0x4c2cc5;};'use strict';var _=require(_0xff21('0x0'));var util=require('util');var logger=require(_0xff21('0x1'))(_0xff21('0x2'));var moment=require(_0xff21('0x3'));var BPromise=require(_0xff21('0x4'));var rp=require(_0xff21('0x5'));var fs=require('fs');var path=require(_0xff21('0x6'));var rimraf=require(_0xff21('0x7'));var config=require(_0xff21('0x8'));var attributes=require(_0xff21('0x9'));var integrations=require(_0xff21('0xa'));module[_0xff21('0xb')]=function(_0x1e1555,_0x513581){return _0x1e1555[_0xff21('0xc')](_0xff21('0xd'),attributes,{'tableName':_0xff21('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6700=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x17c715,_0x4fbf50){var _0x38b123=function(_0x58cdff){while(--_0x58cdff){_0x17c715['push'](_0x17c715['shift']());}};_0x38b123(++_0x4fbf50);}(_0x6700,0x1ad));var _0x0670=function(_0xb091d2,_0x43f12b){_0xb091d2=_0xb091d2-0x0;var _0x407cab=_0x6700[_0xb091d2];return _0x407cab;};'use strict';var _=require(_0x0670('0x0'));var util=require('util');var logger=require(_0x0670('0x1'))(_0x0670('0x2'));var moment=require(_0x0670('0x3'));var BPromise=require(_0x0670('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0670('0x5'));var rimraf=require('rimraf');var config=require(_0x0670('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0670('0x7')]=function(_0x14cf35,_0x3e19e0){return _0x14cf35['define'](_0x0670('0x8'),attributes,{'tableName':_0x0670('0x9'),'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 6d02bd2..8d901ce 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 _0xbec5=['jayson/promise','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','findAll','options','raw','attributes','include','map','model','SalesforceAccount','find','where','ShowSalesforceAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0xbec5,0xe5));var _0x5bec=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xbec5[_0x3d4ef1];return _0x409423;};'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':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});}exports[_0x5bec('0x16')]=function(_0x5cd7ae){var _0x5295f0=this;return new Promise(function(_0x3cd354,_0x6c0d35){return db['SalesforceAccount'][_0x5bec('0x17')]({'raw':_0x5cd7ae[_0x5bec('0x18')]?_0x5cd7ae[_0x5bec('0x18')][_0x5bec('0x19')]===undefined?!![]:![]:!![],'where':_0x5cd7ae['options']?_0x5cd7ae[_0x5bec('0x18')]['where']||null:null,'attributes':_0x5cd7ae[_0x5bec('0x18')]?_0x5cd7ae[_0x5bec('0x18')][_0x5bec('0x1a')]||null:null,'limit':_0x5cd7ae[_0x5bec('0x18')]?_0x5cd7ae[_0x5bec('0x18')]['limit']||null:null,'include':_0x5cd7ae[_0x5bec('0x18')]?_0x5cd7ae['options'][_0x5bec('0x1b')]?_[_0x5bec('0x1c')](_0x5cd7ae['options'][_0x5bec('0x1b')],function(_0xbef70b){return{'model':db[_0xbef70b['model']],'as':_0xbef70b['as'],'attributes':_0xbef70b[_0x5bec('0x1a')],'include':_0xbef70b[_0x5bec('0x1b')]?_[_0x5bec('0x1c')](_0xbef70b[_0x5bec('0x1b')],function(_0x226d55){return{'model':db[_0x226d55[_0x5bec('0x1d')]],'as':_0x226d55['as'],'attributes':_0x226d55[_0x5bec('0x1a')],'include':_0x226d55['include']?_['map'](_0x226d55['include'],function(_0x2961bd){return{'model':db[_0x2961bd[_0x5bec('0x1d')]],'as':_0x2961bd['as'],'attributes':_0x2961bd[_0x5bec('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b3b2c){logger[_0x5bec('0xd')]('GetSalesforceAccount',_0x5cd7ae);logger[_0x5bec('0xf')](_0x5bec('0x16'),_0x5cd7ae,JSON['stringify'](_0x2b3b2c));_0x3cd354(_0x2b3b2c);})['catch'](function(_0x3575e7){logger[_0x5bec('0x12')](_0x5bec('0x16'),_0x3575e7[_0x5bec('0x14')],_0x5cd7ae);_0x6c0d35(_0x5295f0[_0x5bec('0x12')](0x1f4,_0x3575e7[_0x5bec('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x2987ca){var _0x59b5b6=this;return new Promise(function(_0x45863b,_0xafbd94){return db[_0x5bec('0x1e')][_0x5bec('0x1f')]({'raw':_0x2987ca['options']?_0x2987ca[_0x5bec('0x18')][_0x5bec('0x19')]===undefined?!![]:![]:!![],'where':_0x2987ca[_0x5bec('0x18')]?_0x2987ca['options'][_0x5bec('0x20')]||null:null,'attributes':_0x2987ca['options']?_0x2987ca[_0x5bec('0x18')][_0x5bec('0x1a')]||null:null,'include':_0x2987ca[_0x5bec('0x18')]?_0x2987ca['options'][_0x5bec('0x1b')]?_[_0x5bec('0x1c')](_0x2987ca['options'][_0x5bec('0x1b')],function(_0x2e5efc){return{'model':db[_0x2e5efc[_0x5bec('0x1d')]],'as':_0x2e5efc['as'],'attributes':_0x2e5efc[_0x5bec('0x1a')],'include':_0x2e5efc[_0x5bec('0x1b')]?_['map'](_0x2e5efc[_0x5bec('0x1b')],function(_0x583b96){return{'model':db[_0x583b96[_0x5bec('0x1d')]],'as':_0x583b96['as'],'attributes':_0x583b96[_0x5bec('0x1a')],'include':_0x583b96[_0x5bec('0x1b')]?_[_0x5bec('0x1c')](_0x583b96[_0x5bec('0x1b')],function(_0x1923fc){return{'model':db[_0x1923fc['model']],'as':_0x1923fc['as'],'attributes':_0x1923fc[_0x5bec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5bec('0xc')](function(_0x1d42b0){logger['info'](_0x5bec('0x21'),_0x2987ca);logger[_0x5bec('0xf')]('ShowSalesforceAccount',_0x2987ca,JSON[_0x5bec('0x11')](_0x1d42b0));_0x45863b(_0x1d42b0);})['catch'](function(_0x400e22){logger[_0x5bec('0x12')](_0x5bec('0x21'),_0x400e22['message'],_0x2987ca);_0xafbd94(_0x59b5b6[_0x5bec('0x12')](0x1f4,_0x400e22[_0x5bec('0x14')]));});});}; \ No newline at end of file +var _0x9c44=['http','request','then','request\x20sent','debug','stringify','code','error','message','SalesforceAccount,\x20%s,\x20%s','info','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','include','model','map','ShowSalesforceAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x248c3d,_0x5438dc){var _0x12c2e2=function(_0x3add80){while(--_0x3add80){_0x248c3d['push'](_0x248c3d['shift']());}};_0x12c2e2(++_0x5438dc);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});}exports[_0x49c4('0x15')]=function(_0x4c3253){var _0x512650=this;return new Promise(function(_0x3c782d,_0x2f82d5){return db[_0x49c4('0x16')]['findAll']({'raw':_0x4c3253[_0x49c4('0x17')]?_0x4c3253['options'][_0x49c4('0x18')]===undefined?!![]:![]:!![],'where':_0x4c3253[_0x49c4('0x17')]?_0x4c3253[_0x49c4('0x17')][_0x49c4('0x19')]||null:null,'attributes':_0x4c3253[_0x49c4('0x17')]?_0x4c3253[_0x49c4('0x17')][_0x49c4('0x1a')]||null:null,'limit':_0x4c3253[_0x49c4('0x17')]?_0x4c3253[_0x49c4('0x17')]['limit']||null:null,'include':_0x4c3253['options']?_0x4c3253['options'][_0x49c4('0x1b')]?_['map'](_0x4c3253['options'][_0x49c4('0x1b')],function(_0x15581b){return{'model':db[_0x15581b[_0x49c4('0x1c')]],'as':_0x15581b['as'],'attributes':_0x15581b[_0x49c4('0x1a')],'include':_0x15581b['include']?_['map'](_0x15581b[_0x49c4('0x1b')],function(_0x9cb797){return{'model':db[_0x9cb797['model']],'as':_0x9cb797['as'],'attributes':_0x9cb797[_0x49c4('0x1a')],'include':_0x9cb797[_0x49c4('0x1b')]?_[_0x49c4('0x1d')](_0x9cb797[_0x49c4('0x1b')],function(_0x531d92){return{'model':db[_0x531d92['model']],'as':_0x531d92['as'],'attributes':_0x531d92[_0x49c4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3800b7){logger[_0x49c4('0x12')](_0x49c4('0x15'),_0x4c3253);logger[_0x49c4('0xc')]('GetSalesforceAccount',_0x4c3253,JSON[_0x49c4('0xd')](_0x3800b7));_0x3c782d(_0x3800b7);})[_0x49c4('0x14')](function(_0x46e04d){logger[_0x49c4('0xf')](_0x49c4('0x15'),_0x46e04d[_0x49c4('0x10')],_0x4c3253);_0x2f82d5(_0x512650[_0x49c4('0xf')](0x1f4,_0x46e04d[_0x49c4('0x10')]));});});};exports[_0x49c4('0x1e')]=function(_0x2cbd88){var _0x46f7ea=this;return new Promise(function(_0x4ea6ea,_0x4f4495){return db['SalesforceAccount'][_0x49c4('0x1f')]({'raw':_0x2cbd88[_0x49c4('0x17')]?_0x2cbd88[_0x49c4('0x17')][_0x49c4('0x18')]===undefined?!![]:![]:!![],'where':_0x2cbd88[_0x49c4('0x17')]?_0x2cbd88['options'][_0x49c4('0x19')]||null:null,'attributes':_0x2cbd88[_0x49c4('0x17')]?_0x2cbd88[_0x49c4('0x17')][_0x49c4('0x1a')]||null:null,'include':_0x2cbd88['options']?_0x2cbd88['options'][_0x49c4('0x1b')]?_[_0x49c4('0x1d')](_0x2cbd88[_0x49c4('0x17')][_0x49c4('0x1b')],function(_0xd38540){return{'model':db[_0xd38540['model']],'as':_0xd38540['as'],'attributes':_0xd38540[_0x49c4('0x1a')],'include':_0xd38540[_0x49c4('0x1b')]?_[_0x49c4('0x1d')](_0xd38540['include'],function(_0x5ba924){return{'model':db[_0x5ba924[_0x49c4('0x1c')]],'as':_0x5ba924['as'],'attributes':_0x5ba924[_0x49c4('0x1a')],'include':_0x5ba924[_0x49c4('0x1b')]?_[_0x49c4('0x1d')](_0x5ba924[_0x49c4('0x1b')],function(_0x2cf897){return{'model':db[_0x2cf897[_0x49c4('0x1c')]],'as':_0x2cf897['as'],'attributes':_0x2cf897[_0x49c4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x49c4('0xa')](function(_0x4e0209){logger[_0x49c4('0x12')]('ShowSalesforceAccount',_0x2cbd88);logger[_0x49c4('0xc')](_0x49c4('0x1e'),_0x2cbd88,JSON[_0x49c4('0xd')](_0x4e0209));_0x4ea6ea(_0x4e0209);})[_0x49c4('0x14')](function(_0x4ed4f8){logger[_0x49c4('0xf')](_0x49c4('0x1e'),_0x4ed4f8[_0x49c4('0x10')],_0x2cbd88);_0x4f4495(_0x46f7ea['error'](0x1f4,_0x4ed4f8[_0x49c4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9f8ddff..42f4f74 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 _0xd912=['../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getDescriptions','post','create','put','destroy','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0xd912,0x12b));var _0x2d91=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd912[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x2d91('0x0'));var util=require('util');var path=require(_0x2d91('0x1'));var timeout=require(_0x2d91('0x2'));var express=require(_0x2d91('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2d91('0x4'));var config=require(_0x2d91('0x5'));var controller=require(_0x2d91('0x6'));router[_0x2d91('0x7')]('/',auth[_0x2d91('0x8')](),controller[_0x2d91('0x9')]);router['get'](_0x2d91('0xa'),auth[_0x2d91('0x8')](),controller[_0x2d91('0xb')]);router[_0x2d91('0x7')](_0x2d91('0xc'),auth[_0x2d91('0x8')](),controller['getFields']);router[_0x2d91('0x7')](_0x2d91('0xd'),auth[_0x2d91('0x8')](),controller['getSubjects']);router[_0x2d91('0x7')]('/:id/descriptions',auth[_0x2d91('0x8')](),controller[_0x2d91('0xe')]);router[_0x2d91('0xf')]('/',auth['isAuthenticated'](),controller[_0x2d91('0x10')]);router[_0x2d91('0x11')]('/:id',auth[_0x2d91('0x8')](),controller['update']);router['delete'](_0x2d91('0xa'),auth[_0x2d91('0x8')](),controller[_0x2d91('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc8cf=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x5b6b11,_0x1bc350){var _0x5379d0=function(_0x444f0e){while(--_0x444f0e){_0x5b6b11['push'](_0x5b6b11['shift']());}};_0x5379d0(++_0x1bc350);}(_0xc8cf,0x111));var _0xfc8c=function(_0x235187,_0x467163){_0x235187=_0x235187-0x0;var _0x7337d0=_0xc8cf[_0x235187];return _0x7337d0;};'use strict';var multer=require(_0xfc8c('0x0'));var util=require('util');var path=require(_0xfc8c('0x1'));var timeout=require(_0xfc8c('0x2'));var express=require(_0xfc8c('0x3'));var router=express[_0xfc8c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfc8c('0x5'));var config=require(_0xfc8c('0x6'));var controller=require(_0xfc8c('0x7'));router[_0xfc8c('0x8')]('/',auth[_0xfc8c('0x9')](),controller[_0xfc8c('0xa')]);router[_0xfc8c('0x8')](_0xfc8c('0xb'),auth['isAuthenticated'](),controller[_0xfc8c('0xc')]);router[_0xfc8c('0x8')](_0xfc8c('0xd'),auth[_0xfc8c('0x9')](),controller[_0xfc8c('0xe')]);router[_0xfc8c('0x8')](_0xfc8c('0xf'),auth['isAuthenticated'](),controller[_0xfc8c('0x10')]);router[_0xfc8c('0x8')](_0xfc8c('0x11'),auth['isAuthenticated'](),controller[_0xfc8c('0x12')]);router[_0xfc8c('0x13')]('/',auth['isAuthenticated'](),controller[_0xfc8c('0x14')]);router['put'](_0xfc8c('0xb'),auth[_0xfc8c('0x9')](),controller['update']);router[_0xfc8c('0x15')](_0xfc8c('0xb'),auth[_0xfc8c('0x9')](),controller[_0xfc8c('0x16')]);module[_0xfc8c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 97a030f..ed38aa4 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 _0x7642=['lead','nothing','exports','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x1c699d,_0x4473cf){var _0x1dccf2=function(_0x8090ba){while(--_0x8090ba){_0x1c699d['push'](_0x1c699d['shift']());}};_0x1dccf2(++_0x4473cf);}(_0x7642,0x1e8));var _0x2764=function(_0x122d7a,_0xb5feaf){_0x122d7a=_0x122d7a-0x0;var _0x28a542=_0x7642[_0x122d7a];return _0x28a542;};'use strict';var Sequelize=require('sequelize');module[_0x2764('0x0')]={'name':{'type':Sequelize[_0x2764('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x2764('0x2')]('Task',_0x2764('0x3')),'defaultValue':_0x2764('0x4')},'moduleSearch':{'type':Sequelize[_0x2764('0x2')](_0x2764('0x5'),_0x2764('0x6'),_0x2764('0x7')),'defaultValue':_0x2764('0x5')},'moduleCreate':{'type':Sequelize[_0x2764('0x2')](_0x2764('0x8'),_0x2764('0x6'),'lead'),'defaultValue':_0x2764('0x7')}}; \ No newline at end of file +var _0xaf5d=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','nothing','sequelize'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0xaf5d,0x1b7));var _0xdaf5=function(_0xcbf68,_0x4dfe6b){_0xcbf68=_0xcbf68-0x0;var _0xb1aac7=_0xaf5d[_0xcbf68];return _0xb1aac7;};'use strict';var Sequelize=require(_0xdaf5('0x0'));module[_0xdaf5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdaf5('0x2')]},'ticketType':{'type':Sequelize[_0xdaf5('0x3')](_0xdaf5('0x4'),_0xdaf5('0x5')),'defaultValue':_0xdaf5('0x4')},'moduleSearch':{'type':Sequelize[_0xdaf5('0x3')](_0xdaf5('0x6'),_0xdaf5('0x7'),_0xdaf5('0x8')),'defaultValue':_0xdaf5('0x6')},'moduleCreate':{'type':Sequelize[_0xdaf5('0x3')](_0xdaf5('0x9'),'contact',_0xdaf5('0x8')),'defaultValue':_0xdaf5('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 272bd8c..9816719 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 _0xaaea=['rawAttributes','options','create','body','find','getFields','SalesforceField','getSubjects','findOne','order','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SalesforceConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xaaea,0x183));var _0xaaae=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xaaea[_0x465028];return _0xb783d4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaaae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaaae('0x1'));var jsonpatch=require(_0xaaae('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaaae('0x3'));var Mustache=require(_0xaaae('0x4'));var util=require(_0xaaae('0x5'));var path=require(_0xaaae('0x6'));var sox=require('sox');var csv=require(_0xaaae('0x7'));var ejs=require(_0xaaae('0x8'));var fs=require('fs');var _=require(_0xaaae('0x9'));var squel=require(_0xaaae('0xa'));var crypto=require('crypto');var jsforce=require(_0xaaae('0xb'));var deskjs=require(_0xaaae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaaae('0xd'));var Papa=require(_0xaaae('0xe'));var Redis=require('ioredis');var authService=require(_0xaaae('0xf'));var qs=require(_0xaaae('0x10'));var as=require(_0xaaae('0x11'));var hardwareService=require(_0xaaae('0x12'));var logger=require(_0xaaae('0x13'))(_0xaaae('0x14'));var utils=require(_0xaaae('0x15'));var config=require(_0xaaae('0x16'));var db=require(_0xaaae('0x17'))['db'];var jayson=require(_0xaaae('0x18'));var client=jayson['client'][_0xaaae('0x19')]({'port':0x232a});function checkPasswordPattern(_0x53c6b8,_0x33be02,_0x1e2938){if(_0x1e2938){var _0x422da2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x422da2[_0xaaae('0x1a')](_0x33be02)){return _0x53c6b8;}else{throw new db[(_0xaaae('0x1b'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x53c6b8;}}function respondWithRpcPromise(_0x494def,_0x4d80ed,_0x389218,_0x2eab92){return new BPromise(function(_0x358e10,_0x191bfb){var _0xb3d5ed=_0x2eab92||client;return _0xb3d5ed[_0xaaae('0x1c')](_0x494def,_0x389218)[_0xaaae('0x1d')](function(_0x29da48){logger['info'](_0xaaae('0x1e'),_0x4d80ed,_0xaaae('0x1f'));logger['debug'](_0xaaae('0x20'),_0x4d80ed,_0xaaae('0x1f'),JSON[_0xaaae('0x21')](_0x29da48));if(_0x29da48[_0xaaae('0x22')]){if(_0x29da48[_0xaaae('0x22')]['code']===0x1f4){logger[_0xaaae('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4d80ed,_0x29da48[_0xaaae('0x22')]['message']);return _0x191bfb(_0x29da48[_0xaaae('0x22')][_0xaaae('0x23')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4d80ed,_0x29da48[_0xaaae('0x22')]['message']);return _0x358e10(_0x29da48[_0xaaae('0x22')][_0xaaae('0x23')]);}else{logger[_0xaaae('0x24')](_0xaaae('0x1e'),_0x4d80ed,_0xaaae('0x1f'));_0x358e10(_0x29da48[_0xaaae('0x25')][_0xaaae('0x23')]);}})[_0xaaae('0x26')](function(_0x531e28){logger[_0xaaae('0x22')](_0xaaae('0x1e'),_0x4d80ed,_0x531e28);_0x191bfb(_0x531e28);});});}function respondWithStatusCode(_0x3fcf65,_0x24a448){_0x24a448=_0x24a448||0xcc;return function(_0x3a0907){if(_0x3a0907){return _0x3fcf65[_0xaaae('0x27')](_0x24a448);}return _0x3fcf65[_0xaaae('0x28')](_0x24a448)[_0xaaae('0x29')]();};}function respondWithResult(_0x11ff12,_0xbe3e28){_0xbe3e28=_0xbe3e28||0xc8;return function(_0x9e717b){if(_0x9e717b){return _0x11ff12[_0xaaae('0x28')](_0xbe3e28)[_0xaaae('0x2a')](_0x9e717b);}};}function respondWithFilteredResult(_0x2c87b0,_0x526bff){return function(_0x2b9004){if(_0x2b9004){var _0x3c9da1=_0x2b9004[_0xaaae('0x2b')],_0xb2b67a=_0x526bff['offset'],_0x43776a=_0x526bff[_0xaaae('0x2c')]+_0x526bff['limit'],_0x4c89b0;if(_0x43776a>=_0x3c9da1){_0x43776a=_0x3c9da1;_0x4c89b0=0xc8;}else{_0x4c89b0=0xce;}_0x2c87b0[_0xaaae('0x28')](_0x4c89b0);return _0x2c87b0['set'](_0xaaae('0x2d'),_0xb2b67a+'-'+_0x43776a+'/'+_0x3c9da1)[_0xaaae('0x2a')](_0x2b9004);}return null;};}function patchUpdates(_0x39ab24){return function(_0x301c6a){try{jsonpatch[_0xaaae('0x2e')](_0x301c6a,_0x39ab24,!![]);}catch(_0x99f0bc){return BPromise[_0xaaae('0x2f')](_0x99f0bc);}return _0x301c6a[_0xaaae('0x30')]();};}function saveUpdates(_0x4c9717,_0x19d568){return function(_0x4a830d){if(_0x4a830d){return _0x4a830d[_0xaaae('0x31')](_0x4c9717)['then'](function(_0x317f1d){return _0x317f1d;});}return null;};}function removeEntity(_0x171d17,_0x238f01){return function(_0x56000f){if(_0x56000f){return _0x56000f[_0xaaae('0x32')]()['then'](function(){_0x171d17[_0xaaae('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0ae9,_0x565500){return function(_0xf04729){if(!_0xf04729){_0x3e0ae9['sendStatus'](0x194);}return _0xf04729;};}function handleError(_0x46dc27,_0x71c1a6){_0x71c1a6=_0x71c1a6||0x1f4;return function(_0x10e1fd){logger[_0xaaae('0x22')](_0x10e1fd[_0xaaae('0x33')]);if(_0x10e1fd[_0xaaae('0x34')]){delete _0x10e1fd['name'];}_0x46dc27[_0xaaae('0x28')](_0x71c1a6)[_0xaaae('0x35')](_0x10e1fd);};}exports[_0xaaae('0x36')]=function(_0x5dfe3f,_0x1789c7){var _0x372efc={},_0xeb8b={},_0x39c6f6={'count':0x0,'rows':[]};var _0xf097de=_['map'](db[_0xaaae('0x37')]['rawAttributes'],function(_0x2854af){return{'name':_0x2854af[_0xaaae('0x38')],'type':_0x2854af[_0xaaae('0x39')][_0xaaae('0x3a')]};});_0xeb8b[_0xaaae('0x3b')]=_[_0xaaae('0x3c')](_0xf097de,'name');_0xeb8b['query']=_[_0xaaae('0x3d')](_0x5dfe3f[_0xaaae('0x3e')]);_0xeb8b[_0xaaae('0x3f')]=_[_0xaaae('0x40')](_0xeb8b['model'],_0xeb8b['query']);_0x372efc['attributes']=_['intersection'](_0xeb8b[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x5dfe3f[_0xaaae('0x3e')]['fields']));_0x372efc['attributes']=_0x372efc[_0xaaae('0x42')][_0xaaae('0x43')]?_0x372efc[_0xaaae('0x42')]:_0xeb8b['model'];if(!_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x44')](_0xaaae('0x45'))){_0x372efc[_0xaaae('0x46')]=qs[_0xaaae('0x46')](_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x46')]);_0x372efc[_0xaaae('0x2c')]=qs[_0xaaae('0x2c')](_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x2c')]);}_0x372efc['order']=qs['sort'](_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x47')]);_0x372efc[_0xaaae('0x48')]=qs['filters'](_[_0xaaae('0x49')](_0x5dfe3f[_0xaaae('0x3e')],_0xeb8b['filters']),_0xf097de);if(_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x4a')]){_0x372efc[_0xaaae('0x48')]=_[_0xaaae('0x4b')](_0x372efc['where'],{'$or':_['map'](_0xf097de,function(_0x4a32bd){if(_0x4a32bd[_0xaaae('0x39')]!==_0xaaae('0x4c')){var _0x50b01f={};_0x50b01f[_0x4a32bd[_0xaaae('0x34')]]={'$like':'%'+_0x5dfe3f[_0xaaae('0x3e')][_0xaaae('0x4a')]+'%'};return _0x50b01f;}})});}_0x372efc=_[_0xaaae('0x4b')]({},_0x372efc,_0x5dfe3f['options']);var _0xb6c96e={'where':_0x372efc[_0xaaae('0x48')]};return db[_0xaaae('0x37')][_0xaaae('0x2b')](_0xb6c96e)[_0xaaae('0x1d')](function(_0x5aa38f){_0x39c6f6['count']=_0x5aa38f;if(_0x5dfe3f['query'][_0xaaae('0x4d')]){_0x372efc[_0xaaae('0x4e')]=[{'all':!![]}];}return db[_0xaaae('0x37')][_0xaaae('0x4f')](_0x372efc);})['then'](function(_0x1389e8){_0x39c6f6[_0xaaae('0x50')]=_0x1389e8;return _0x39c6f6;})[_0xaaae('0x1d')](respondWithFilteredResult(_0x1789c7,_0x372efc))[_0xaaae('0x26')](handleError(_0x1789c7,null));};exports[_0xaaae('0x51')]=function(_0x336d72,_0x38ad6d){var _0x1d2c5f={'raw':![],'where':{'id':_0x336d72[_0xaaae('0x52')]['id']}},_0x23b915={};_0x23b915[_0xaaae('0x3b')]=_[_0xaaae('0x3d')](db[_0xaaae('0x37')][_0xaaae('0x53')]);_0x23b915[_0xaaae('0x3e')]=_['keys'](_0x336d72['query']);_0x23b915[_0xaaae('0x3f')]=_[_0xaaae('0x40')](_0x23b915[_0xaaae('0x3b')],_0x23b915[_0xaaae('0x3e')]);_0x1d2c5f[_0xaaae('0x42')]=_[_0xaaae('0x40')](_0x23b915[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x336d72[_0xaaae('0x3e')]['fields']));_0x1d2c5f[_0xaaae('0x42')]=_0x1d2c5f[_0xaaae('0x42')][_0xaaae('0x43')]?_0x1d2c5f[_0xaaae('0x42')]:_0x23b915[_0xaaae('0x3b')];if(_0x336d72[_0xaaae('0x3e')][_0xaaae('0x4d')]){_0x1d2c5f[_0xaaae('0x4e')]=[{'all':!![]}];}_0x1d2c5f=_['merge']({},_0x1d2c5f,_0x336d72[_0xaaae('0x54')]);return db[_0xaaae('0x37')]['find'](_0x1d2c5f)[_0xaaae('0x1d')](handleEntityNotFound(_0x38ad6d,null))[_0xaaae('0x1d')](respondWithResult(_0x38ad6d,null))['catch'](handleError(_0x38ad6d,null));};exports[_0xaaae('0x55')]=function(_0x20dee5,_0x51c061){return db['SalesforceConfiguration'][_0xaaae('0x55')](_0x20dee5[_0xaaae('0x56')],{})[_0xaaae('0x1d')](respondWithResult(_0x51c061,0xc9))[_0xaaae('0x26')](handleError(_0x51c061,null));};exports[_0xaaae('0x31')]=function(_0x5da5ff,_0x32963b){if(_0x5da5ff[_0xaaae('0x56')]['id']){delete _0x5da5ff['body']['id'];}return db[_0xaaae('0x37')]['find']({'where':{'id':_0x5da5ff[_0xaaae('0x52')]['id']}})[_0xaaae('0x1d')](handleEntityNotFound(_0x32963b,null))[_0xaaae('0x1d')](saveUpdates(_0x5da5ff['body'],null))[_0xaaae('0x1d')](respondWithResult(_0x32963b,null))[_0xaaae('0x26')](handleError(_0x32963b,null));};exports[_0xaaae('0x32')]=function(_0x3baa62,_0x30fedd){return db[_0xaaae('0x37')][_0xaaae('0x57')]({'where':{'id':_0x3baa62['params']['id']}})[_0xaaae('0x1d')](handleEntityNotFound(_0x30fedd,null))[_0xaaae('0x1d')](removeEntity(_0x30fedd,null))[_0xaaae('0x26')](handleError(_0x30fedd,null));};exports[_0xaaae('0x58')]=function(_0x70fe71,_0x28918a,_0x8571f4){var _0x5d777b={};var _0x86bc0a={};var _0x58fc5e;var _0x37fb9e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x70fe71[_0xaaae('0x52')]['id']}})[_0xaaae('0x1d')](handleEntityNotFound(_0x28918a,null))['then'](function(_0x565008){if(_0x565008){_0x58fc5e=_0x565008;_0x86bc0a['model']=_[_0xaaae('0x3d')](db[_0xaaae('0x59')][_0xaaae('0x53')]);_0x86bc0a[_0xaaae('0x3e')]=_[_0xaaae('0x3d')](_0x70fe71['query']);_0x86bc0a[_0xaaae('0x3f')]=_[_0xaaae('0x40')](_0x86bc0a[_0xaaae('0x3b')],_0x86bc0a[_0xaaae('0x3e')]);_0x5d777b[_0xaaae('0x42')]=_[_0xaaae('0x40')](_0x86bc0a[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x70fe71['query']['fields']));_0x5d777b[_0xaaae('0x42')]=_0x5d777b['attributes'][_0xaaae('0x43')]?_0x5d777b[_0xaaae('0x42')]:_0x86bc0a[_0xaaae('0x3b')];_0x5d777b['order']=qs['sort'](_0x70fe71['query'][_0xaaae('0x47')]);_0x5d777b['where']=qs[_0xaaae('0x3f')](_['pick'](_0x70fe71['query'],_0x86bc0a['filters']));if(_0x70fe71[_0xaaae('0x3e')][_0xaaae('0x4a')]){_0x5d777b[_0xaaae('0x48')]=_[_0xaaae('0x4b')](_0x5d777b['where'],{'$or':_[_0xaaae('0x3c')](_0x5d777b['attributes'],function(_0x33142a){var _0x1738c7={};_0x1738c7[_0x33142a]={'$like':'%'+_0x70fe71[_0xaaae('0x3e')]['filter']+'%'};return _0x1738c7;})});}_0x5d777b=_['merge']({},_0x5d777b,_0x70fe71[_0xaaae('0x54')]);return _0x58fc5e[_0xaaae('0x58')](_0x5d777b);}})[_0xaaae('0x1d')](function(_0x27d28c){if(_0x27d28c){_0x37fb9e=_0x27d28c[_0xaaae('0x43')];if(!_0x70fe71[_0xaaae('0x3e')][_0xaaae('0x44')](_0xaaae('0x45'))){_0x5d777b[_0xaaae('0x46')]=qs[_0xaaae('0x46')](_0x70fe71['query'][_0xaaae('0x46')]);_0x5d777b[_0xaaae('0x2c')]=qs[_0xaaae('0x2c')](_0x70fe71[_0xaaae('0x3e')][_0xaaae('0x2c')]);}return _0x58fc5e['getFields'](_0x5d777b);}})[_0xaaae('0x1d')](function(_0x540074){if(_0x540074){return _0x540074?{'count':_0x37fb9e,'rows':_0x540074}:null;}})[_0xaaae('0x1d')](respondWithResult(_0x28918a,null))[_0xaaae('0x26')](handleError(_0x28918a,null));};exports[_0xaaae('0x5a')]=function(_0x33e0c6,_0x238859,_0x41bef1){var _0x277ecb={};var _0x26e1cc={};var _0x16ca51;var _0x149095;return db['SalesforceConfiguration'][_0xaaae('0x5b')]({'where':{'id':_0x33e0c6[_0xaaae('0x52')]['id']}})['then'](handleEntityNotFound(_0x238859,null))[_0xaaae('0x1d')](function(_0x39efa5){if(_0x39efa5){_0x16ca51=_0x39efa5;_0x26e1cc[_0xaaae('0x3b')]=_[_0xaaae('0x3d')](db[_0xaaae('0x59')]['rawAttributes']);_0x26e1cc['query']=_[_0xaaae('0x3d')](_0x33e0c6[_0xaaae('0x3e')]);_0x26e1cc[_0xaaae('0x3f')]=_['intersection'](_0x26e1cc[_0xaaae('0x3b')],_0x26e1cc[_0xaaae('0x3e')]);_0x277ecb[_0xaaae('0x42')]=_[_0xaaae('0x40')](_0x26e1cc[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x33e0c6[_0xaaae('0x3e')][_0xaaae('0x41')]));_0x277ecb[_0xaaae('0x42')]=_0x277ecb[_0xaaae('0x42')][_0xaaae('0x43')]?_0x277ecb[_0xaaae('0x42')]:_0x26e1cc[_0xaaae('0x3b')];_0x277ecb[_0xaaae('0x5c')]=qs['sort'](_0x33e0c6[_0xaaae('0x3e')][_0xaaae('0x47')]);_0x277ecb[_0xaaae('0x48')]=qs['filters'](_[_0xaaae('0x49')](_0x33e0c6[_0xaaae('0x3e')],_0x26e1cc[_0xaaae('0x3f')]));if(_0x33e0c6[_0xaaae('0x3e')][_0xaaae('0x4a')]){_0x277ecb[_0xaaae('0x48')]=_[_0xaaae('0x4b')](_0x277ecb[_0xaaae('0x48')],{'$or':_[_0xaaae('0x3c')](_0x277ecb[_0xaaae('0x42')],function(_0xe425b){var _0x45e400={};_0x45e400[_0xe425b]={'$like':'%'+_0x33e0c6[_0xaaae('0x3e')]['filter']+'%'};return _0x45e400;})});}_0x277ecb=_[_0xaaae('0x4b')]({},_0x277ecb,_0x33e0c6[_0xaaae('0x54')]);return _0x16ca51['getSubjects'](_0x277ecb);}})[_0xaaae('0x1d')](function(_0x2258bf){if(_0x2258bf){_0x149095=_0x2258bf[_0xaaae('0x43')];if(!_0x33e0c6['query']['hasOwnProperty'](_0xaaae('0x45'))){_0x277ecb[_0xaaae('0x46')]=qs[_0xaaae('0x46')](_0x33e0c6['query'][_0xaaae('0x46')]);_0x277ecb[_0xaaae('0x2c')]=qs[_0xaaae('0x2c')](_0x33e0c6[_0xaaae('0x3e')]['offset']);}return _0x16ca51[_0xaaae('0x5a')](_0x277ecb);}})[_0xaaae('0x1d')](function(_0xacbbb1){if(_0xacbbb1){return _0xacbbb1?{'count':_0x149095,'rows':_0xacbbb1}:null;}})[_0xaaae('0x1d')](respondWithResult(_0x238859,null))[_0xaaae('0x26')](handleError(_0x238859,null));};exports[_0xaaae('0x5d')]=function(_0x5d9e4b,_0x5b800c,_0xc97ee1){var _0x5949a2={};var _0x75b0de={};var _0x1a62f6;var _0x3d2f50;return db[_0xaaae('0x37')][_0xaaae('0x5b')]({'where':{'id':_0x5d9e4b[_0xaaae('0x52')]['id']}})[_0xaaae('0x1d')](handleEntityNotFound(_0x5b800c,null))['then'](function(_0x32f7f0){if(_0x32f7f0){_0x1a62f6=_0x32f7f0;_0x75b0de[_0xaaae('0x3b')]=_[_0xaaae('0x3d')](db[_0xaaae('0x59')][_0xaaae('0x53')]);_0x75b0de[_0xaaae('0x3e')]=_[_0xaaae('0x3d')](_0x5d9e4b[_0xaaae('0x3e')]);_0x75b0de[_0xaaae('0x3f')]=_[_0xaaae('0x40')](_0x75b0de['model'],_0x75b0de['query']);_0x5949a2[_0xaaae('0x42')]=_[_0xaaae('0x40')](_0x75b0de[_0xaaae('0x3b')],qs[_0xaaae('0x41')](_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x41')]));_0x5949a2[_0xaaae('0x42')]=_0x5949a2[_0xaaae('0x42')][_0xaaae('0x43')]?_0x5949a2['attributes']:_0x75b0de['model'];_0x5949a2[_0xaaae('0x5c')]=qs[_0xaaae('0x47')](_0x5d9e4b['query'][_0xaaae('0x47')]);_0x5949a2[_0xaaae('0x48')]=qs['filters'](_[_0xaaae('0x49')](_0x5d9e4b['query'],_0x75b0de[_0xaaae('0x3f')]));if(_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x4a')]){_0x5949a2[_0xaaae('0x48')]=_[_0xaaae('0x4b')](_0x5949a2[_0xaaae('0x48')],{'$or':_[_0xaaae('0x3c')](_0x5949a2[_0xaaae('0x42')],function(_0x5ad0c7){var _0x5f4422={};_0x5f4422[_0x5ad0c7]={'$like':'%'+_0x5d9e4b[_0xaaae('0x3e')]['filter']+'%'};return _0x5f4422;})});}_0x5949a2=_[_0xaaae('0x4b')]({},_0x5949a2,_0x5d9e4b[_0xaaae('0x54')]);return _0x1a62f6[_0xaaae('0x5d')](_0x5949a2);}})[_0xaaae('0x1d')](function(_0x4aeb61){if(_0x4aeb61){_0x3d2f50=_0x4aeb61[_0xaaae('0x43')];if(!_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x44')](_0xaaae('0x45'))){_0x5949a2['limit']=qs[_0xaaae('0x46')](_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x46')]);_0x5949a2[_0xaaae('0x2c')]=qs[_0xaaae('0x2c')](_0x5d9e4b[_0xaaae('0x3e')][_0xaaae('0x2c')]);}return _0x1a62f6['getDescriptions'](_0x5949a2);}})[_0xaaae('0x1d')](function(_0x2436da){if(_0x2436da){return _0x2436da?{'count':_0x3d2f50,'rows':_0x2436da}:null;}})[_0xaaae('0x1d')](respondWithResult(_0x5b800c,null))[_0xaaae('0x26')](handleError(_0x5b800c,null));}; \ No newline at end of file +var _0x3c6d=['VIRTUAL','then','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getFields','findOne','length','getSubjects','SalesforceField','pick','options','getDescriptions','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','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','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~!@#$%^&-_=+[{]}.','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge'];(function(_0x342b67,_0x2941d2){var _0x1c97f7=function(_0x570454){while(--_0x570454){_0x342b67['push'](_0x342b67['shift']());}};_0x1c97f7(++_0x2941d2);}(_0x3c6d,0x190));var _0xd3c6=function(_0x4177ee,_0x507602){_0x4177ee=_0x4177ee-0x0;var _0xae98ab=_0x3c6d[_0x4177ee];return _0xae98ab;};'use strict';var pdf=require(_0xd3c6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd3c6('0x1'));var jsonpatch=require(_0xd3c6('0x2'));var rp=require(_0xd3c6('0x3'));var moment=require(_0xd3c6('0x4'));var BPromise=require(_0xd3c6('0x5'));var Mustache=require(_0xd3c6('0x6'));var util=require(_0xd3c6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd3c6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3c6('0x9'));var squel=require('squel');var crypto=require(_0xd3c6('0xa'));var jsforce=require(_0xd3c6('0xb'));var deskjs=require(_0xd3c6('0xc'));var toCsv=require(_0xd3c6('0x8'));var querystring=require(_0xd3c6('0xd'));var Papa=require(_0xd3c6('0xe'));var Redis=require(_0xd3c6('0xf'));var authService=require(_0xd3c6('0x10'));var qs=require(_0xd3c6('0x11'));var as=require(_0xd3c6('0x12'));var hardwareService=require(_0xd3c6('0x13'));var logger=require('../../config/logger')(_0xd3c6('0x14'));var utils=require(_0xd3c6('0x15'));var config=require(_0xd3c6('0x16'));var db=require(_0xd3c6('0x17'))['db'];var jayson=require(_0xd3c6('0x18'));var client=jayson[_0xd3c6('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x44d541,_0x2c4c,_0x55f959){if(_0x55f959){var _0x176bf8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x176bf8[_0xd3c6('0x1a')](_0x2c4c)){return _0x44d541;}else{throw new db[(_0xd3c6('0x1b'))][(_0xd3c6('0x1c'))](_0xd3c6('0x1d'));}}else{return _0x44d541;}}function respondWithRpcPromise(_0x4047c1,_0xd8cd4f,_0x1b8653,_0x5ad5f9){return new BPromise(function(_0x420b20,_0x12722f){var _0x1d78bf=_0x5ad5f9||client;return _0x1d78bf['request'](_0x4047c1,_0x1b8653)['then'](function(_0xe68efc){logger[_0xd3c6('0x1e')](_0xd3c6('0x1f'),_0xd8cd4f,'request\x20sent');logger[_0xd3c6('0x20')](_0xd3c6('0x21'),_0xd8cd4f,_0xd3c6('0x22'),JSON['stringify'](_0xe68efc));if(_0xe68efc[_0xd3c6('0x23')]){if(_0xe68efc[_0xd3c6('0x23')][_0xd3c6('0x24')]===0x1f4){logger['error'](_0xd3c6('0x1f'),_0xd8cd4f,_0xe68efc[_0xd3c6('0x23')]['message']);return _0x12722f(_0xe68efc[_0xd3c6('0x23')]['message']);}logger['error'](_0xd3c6('0x1f'),_0xd8cd4f,_0xe68efc[_0xd3c6('0x23')][_0xd3c6('0x25')]);return _0x420b20(_0xe68efc['error'][_0xd3c6('0x25')]);}else{logger[_0xd3c6('0x1e')](_0xd3c6('0x1f'),_0xd8cd4f,'request\x20sent');_0x420b20(_0xe68efc[_0xd3c6('0x26')][_0xd3c6('0x25')]);}})[_0xd3c6('0x27')](function(_0x3f1a81){logger[_0xd3c6('0x23')](_0xd3c6('0x1f'),_0xd8cd4f,_0x3f1a81);_0x12722f(_0x3f1a81);});});}function respondWithStatusCode(_0x38aeef,_0xcfa161){_0xcfa161=_0xcfa161||0xcc;return function(_0x37a237){if(_0x37a237){return _0x38aeef[_0xd3c6('0x28')](_0xcfa161);}return _0x38aeef['status'](_0xcfa161)[_0xd3c6('0x29')]();};}function respondWithResult(_0x150406,_0x484652){_0x484652=_0x484652||0xc8;return function(_0x5ad313){if(_0x5ad313){return _0x150406[_0xd3c6('0x2a')](_0x484652)['json'](_0x5ad313);}};}function respondWithFilteredResult(_0xe3e7eb,_0x343e54){return function(_0x12ebff){if(_0x12ebff){var _0xe1f688=_0x12ebff[_0xd3c6('0x2b')],_0x3bef90=_0x343e54[_0xd3c6('0x2c')],_0x1fbc60=_0x343e54[_0xd3c6('0x2c')]+_0x343e54['limit'],_0x5ee78c;if(_0x1fbc60>=_0xe1f688){_0x1fbc60=_0xe1f688;_0x5ee78c=0xc8;}else{_0x5ee78c=0xce;}_0xe3e7eb['status'](_0x5ee78c);return _0xe3e7eb[_0xd3c6('0x2d')](_0xd3c6('0x2e'),_0x3bef90+'-'+_0x1fbc60+'/'+_0xe1f688)[_0xd3c6('0x2f')](_0x12ebff);}return null;};}function patchUpdates(_0x921018){return function(_0x437819){try{jsonpatch[_0xd3c6('0x30')](_0x437819,_0x921018,!![]);}catch(_0x42c7d7){return BPromise[_0xd3c6('0x31')](_0x42c7d7);}return _0x437819[_0xd3c6('0x32')]();};}function saveUpdates(_0x5cf909,_0x155648){return function(_0x3f7dae){if(_0x3f7dae){return _0x3f7dae[_0xd3c6('0x33')](_0x5cf909)['then'](function(_0xa557fc){return _0xa557fc;});}return null;};}function removeEntity(_0xb3f10,_0x76d28c){return function(_0x220b0f){if(_0x220b0f){return _0x220b0f[_0xd3c6('0x34')]()['then'](function(){_0xb3f10[_0xd3c6('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x480de5,_0x140028){return function(_0x27eba6){if(!_0x27eba6){_0x480de5[_0xd3c6('0x28')](0x194);}return _0x27eba6;};}function handleError(_0x1fc90b,_0x4676d9){_0x4676d9=_0x4676d9||0x1f4;return function(_0x1cbc47){logger['error'](_0x1cbc47[_0xd3c6('0x35')]);if(_0x1cbc47['name']){delete _0x1cbc47[_0xd3c6('0x36')];}_0x1fc90b['status'](_0x4676d9)['send'](_0x1cbc47);};}exports['index']=function(_0x5e980e,_0x3e4126){var _0x206fac={},_0x463e54={},_0x1f8f91={'count':0x0,'rows':[]};var _0x2112db=_[_0xd3c6('0x37')](db[_0xd3c6('0x38')]['rawAttributes'],function(_0x124376){return{'name':_0x124376[_0xd3c6('0x39')],'type':_0x124376[_0xd3c6('0x3a')][_0xd3c6('0x3b')]};});_0x463e54[_0xd3c6('0x3c')]=_['map'](_0x2112db,'name');_0x463e54[_0xd3c6('0x3d')]=_[_0xd3c6('0x3e')](_0x5e980e[_0xd3c6('0x3d')]);_0x463e54['filters']=_[_0xd3c6('0x3f')](_0x463e54['model'],_0x463e54[_0xd3c6('0x3d')]);_0x206fac[_0xd3c6('0x40')]=_[_0xd3c6('0x3f')](_0x463e54['model'],qs[_0xd3c6('0x41')](_0x5e980e[_0xd3c6('0x3d')][_0xd3c6('0x41')]));_0x206fac['attributes']=_0x206fac[_0xd3c6('0x40')]['length']?_0x206fac[_0xd3c6('0x40')]:_0x463e54[_0xd3c6('0x3c')];if(!_0x5e980e['query'][_0xd3c6('0x42')](_0xd3c6('0x43'))){_0x206fac['limit']=qs[_0xd3c6('0x44')](_0x5e980e[_0xd3c6('0x3d')][_0xd3c6('0x44')]);_0x206fac[_0xd3c6('0x2c')]=qs[_0xd3c6('0x2c')](_0x5e980e[_0xd3c6('0x3d')]['offset']);}_0x206fac[_0xd3c6('0x45')]=qs[_0xd3c6('0x46')](_0x5e980e[_0xd3c6('0x3d')][_0xd3c6('0x46')]);_0x206fac[_0xd3c6('0x47')]=qs[_0xd3c6('0x48')](_['pick'](_0x5e980e[_0xd3c6('0x3d')],_0x463e54[_0xd3c6('0x48')]),_0x2112db);if(_0x5e980e[_0xd3c6('0x3d')][_0xd3c6('0x49')]){_0x206fac[_0xd3c6('0x47')]=_[_0xd3c6('0x4a')](_0x206fac[_0xd3c6('0x47')],{'$or':_[_0xd3c6('0x37')](_0x2112db,function(_0x26860d){if(_0x26860d[_0xd3c6('0x3a')]!==_0xd3c6('0x4b')){var _0x4c58a0={};_0x4c58a0[_0x26860d[_0xd3c6('0x36')]]={'$like':'%'+_0x5e980e[_0xd3c6('0x3d')][_0xd3c6('0x49')]+'%'};return _0x4c58a0;}})});}_0x206fac=_[_0xd3c6('0x4a')]({},_0x206fac,_0x5e980e['options']);var _0x543ba8={'where':_0x206fac[_0xd3c6('0x47')]};return db['SalesforceConfiguration']['count'](_0x543ba8)[_0xd3c6('0x4c')](function(_0x5274ea){_0x1f8f91[_0xd3c6('0x2b')]=_0x5274ea;if(_0x5e980e['query'][_0xd3c6('0x4d')]){_0x206fac[_0xd3c6('0x4e')]=[{'all':!![]}];}return db[_0xd3c6('0x38')][_0xd3c6('0x4f')](_0x206fac);})['then'](function(_0x54bb6f){_0x1f8f91[_0xd3c6('0x50')]=_0x54bb6f;return _0x1f8f91;})[_0xd3c6('0x4c')](respondWithFilteredResult(_0x3e4126,_0x206fac))[_0xd3c6('0x27')](handleError(_0x3e4126,null));};exports[_0xd3c6('0x51')]=function(_0x1a9a5a,_0x38878a){var _0x12ea1f={'raw':![],'where':{'id':_0x1a9a5a[_0xd3c6('0x52')]['id']}},_0x4ffa46={};_0x4ffa46[_0xd3c6('0x3c')]=_[_0xd3c6('0x3e')](db[_0xd3c6('0x38')][_0xd3c6('0x53')]);_0x4ffa46['query']=_[_0xd3c6('0x3e')](_0x1a9a5a[_0xd3c6('0x3d')]);_0x4ffa46[_0xd3c6('0x48')]=_[_0xd3c6('0x3f')](_0x4ffa46['model'],_0x4ffa46[_0xd3c6('0x3d')]);_0x12ea1f['attributes']=_['intersection'](_0x4ffa46[_0xd3c6('0x3c')],qs['fields'](_0x1a9a5a[_0xd3c6('0x3d')][_0xd3c6('0x41')]));_0x12ea1f[_0xd3c6('0x40')]=_0x12ea1f[_0xd3c6('0x40')]['length']?_0x12ea1f[_0xd3c6('0x40')]:_0x4ffa46[_0xd3c6('0x3c')];if(_0x1a9a5a[_0xd3c6('0x3d')]['includeAll']){_0x12ea1f[_0xd3c6('0x4e')]=[{'all':!![]}];}_0x12ea1f=_[_0xd3c6('0x4a')]({},_0x12ea1f,_0x1a9a5a['options']);return db['SalesforceConfiguration'][_0xd3c6('0x54')](_0x12ea1f)['then'](handleEntityNotFound(_0x38878a,null))[_0xd3c6('0x4c')](respondWithResult(_0x38878a,null))[_0xd3c6('0x27')](handleError(_0x38878a,null));};exports['create']=function(_0x3136ac,_0xa983e6){return db['SalesforceConfiguration'][_0xd3c6('0x55')](_0x3136ac[_0xd3c6('0x56')],{})[_0xd3c6('0x4c')](respondWithResult(_0xa983e6,0xc9))[_0xd3c6('0x27')](handleError(_0xa983e6,null));};exports[_0xd3c6('0x33')]=function(_0x5657b1,_0x22624f){if(_0x5657b1['body']['id']){delete _0x5657b1['body']['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x5657b1[_0xd3c6('0x52')]['id']}})['then'](handleEntityNotFound(_0x22624f,null))[_0xd3c6('0x4c')](saveUpdates(_0x5657b1['body'],null))[_0xd3c6('0x4c')](respondWithResult(_0x22624f,null))[_0xd3c6('0x27')](handleError(_0x22624f,null));};exports[_0xd3c6('0x34')]=function(_0x1a4b22,_0x788d17){return db[_0xd3c6('0x38')][_0xd3c6('0x54')]({'where':{'id':_0x1a4b22[_0xd3c6('0x52')]['id']}})[_0xd3c6('0x4c')](handleEntityNotFound(_0x788d17,null))[_0xd3c6('0x4c')](removeEntity(_0x788d17,null))['catch'](handleError(_0x788d17,null));};exports[_0xd3c6('0x57')]=function(_0x364f63,_0x533ea8,_0x570d88){var _0x21e1c6={};var _0x30c11f={};var _0x105ff8;var _0x414863;return db[_0xd3c6('0x38')][_0xd3c6('0x58')]({'where':{'id':_0x364f63[_0xd3c6('0x52')]['id']}})[_0xd3c6('0x4c')](handleEntityNotFound(_0x533ea8,null))[_0xd3c6('0x4c')](function(_0x237f08){if(_0x237f08){_0x105ff8=_0x237f08;_0x30c11f['model']=_[_0xd3c6('0x3e')](db['SalesforceField'][_0xd3c6('0x53')]);_0x30c11f[_0xd3c6('0x3d')]=_['keys'](_0x364f63[_0xd3c6('0x3d')]);_0x30c11f[_0xd3c6('0x48')]=_[_0xd3c6('0x3f')](_0x30c11f[_0xd3c6('0x3c')],_0x30c11f['query']);_0x21e1c6['attributes']=_[_0xd3c6('0x3f')](_0x30c11f[_0xd3c6('0x3c')],qs[_0xd3c6('0x41')](_0x364f63['query'][_0xd3c6('0x41')]));_0x21e1c6[_0xd3c6('0x40')]=_0x21e1c6['attributes'][_0xd3c6('0x59')]?_0x21e1c6[_0xd3c6('0x40')]:_0x30c11f['model'];_0x21e1c6[_0xd3c6('0x45')]=qs[_0xd3c6('0x46')](_0x364f63[_0xd3c6('0x3d')][_0xd3c6('0x46')]);_0x21e1c6['where']=qs[_0xd3c6('0x48')](_['pick'](_0x364f63[_0xd3c6('0x3d')],_0x30c11f[_0xd3c6('0x48')]));if(_0x364f63[_0xd3c6('0x3d')]['filter']){_0x21e1c6['where']=_[_0xd3c6('0x4a')](_0x21e1c6['where'],{'$or':_[_0xd3c6('0x37')](_0x21e1c6['attributes'],function(_0x509b5e){var _0x13562a={};_0x13562a[_0x509b5e]={'$like':'%'+_0x364f63[_0xd3c6('0x3d')][_0xd3c6('0x49')]+'%'};return _0x13562a;})});}_0x21e1c6=_['merge']({},_0x21e1c6,_0x364f63['options']);return _0x105ff8['getFields'](_0x21e1c6);}})[_0xd3c6('0x4c')](function(_0x1a7799){if(_0x1a7799){_0x414863=_0x1a7799[_0xd3c6('0x59')];if(!_0x364f63[_0xd3c6('0x3d')][_0xd3c6('0x42')](_0xd3c6('0x43'))){_0x21e1c6[_0xd3c6('0x44')]=qs[_0xd3c6('0x44')](_0x364f63[_0xd3c6('0x3d')][_0xd3c6('0x44')]);_0x21e1c6[_0xd3c6('0x2c')]=qs[_0xd3c6('0x2c')](_0x364f63[_0xd3c6('0x3d')][_0xd3c6('0x2c')]);}return _0x105ff8[_0xd3c6('0x57')](_0x21e1c6);}})[_0xd3c6('0x4c')](function(_0xc3cd76){if(_0xc3cd76){return _0xc3cd76?{'count':_0x414863,'rows':_0xc3cd76}:null;}})[_0xd3c6('0x4c')](respondWithResult(_0x533ea8,null))[_0xd3c6('0x27')](handleError(_0x533ea8,null));};exports[_0xd3c6('0x5a')]=function(_0x24572f,_0xadc0a3,_0x51180f){var _0x3441d5={};var _0x3aa61a={};var _0x3ddfa2;var _0x2c31f2;return db[_0xd3c6('0x38')][_0xd3c6('0x58')]({'where':{'id':_0x24572f[_0xd3c6('0x52')]['id']}})[_0xd3c6('0x4c')](handleEntityNotFound(_0xadc0a3,null))['then'](function(_0x375839){if(_0x375839){_0x3ddfa2=_0x375839;_0x3aa61a[_0xd3c6('0x3c')]=_[_0xd3c6('0x3e')](db[_0xd3c6('0x5b')][_0xd3c6('0x53')]);_0x3aa61a[_0xd3c6('0x3d')]=_['keys'](_0x24572f[_0xd3c6('0x3d')]);_0x3aa61a['filters']=_[_0xd3c6('0x3f')](_0x3aa61a[_0xd3c6('0x3c')],_0x3aa61a[_0xd3c6('0x3d')]);_0x3441d5[_0xd3c6('0x40')]=_[_0xd3c6('0x3f')](_0x3aa61a[_0xd3c6('0x3c')],qs[_0xd3c6('0x41')](_0x24572f[_0xd3c6('0x3d')][_0xd3c6('0x41')]));_0x3441d5[_0xd3c6('0x40')]=_0x3441d5[_0xd3c6('0x40')][_0xd3c6('0x59')]?_0x3441d5[_0xd3c6('0x40')]:_0x3aa61a['model'];_0x3441d5[_0xd3c6('0x45')]=qs[_0xd3c6('0x46')](_0x24572f[_0xd3c6('0x3d')][_0xd3c6('0x46')]);_0x3441d5[_0xd3c6('0x47')]=qs[_0xd3c6('0x48')](_[_0xd3c6('0x5c')](_0x24572f['query'],_0x3aa61a[_0xd3c6('0x48')]));if(_0x24572f[_0xd3c6('0x3d')][_0xd3c6('0x49')]){_0x3441d5[_0xd3c6('0x47')]=_['merge'](_0x3441d5['where'],{'$or':_[_0xd3c6('0x37')](_0x3441d5[_0xd3c6('0x40')],function(_0x2eed3f){var _0x1190a4={};_0x1190a4[_0x2eed3f]={'$like':'%'+_0x24572f[_0xd3c6('0x3d')][_0xd3c6('0x49')]+'%'};return _0x1190a4;})});}_0x3441d5=_[_0xd3c6('0x4a')]({},_0x3441d5,_0x24572f[_0xd3c6('0x5d')]);return _0x3ddfa2['getSubjects'](_0x3441d5);}})[_0xd3c6('0x4c')](function(_0x48439f){if(_0x48439f){_0x2c31f2=_0x48439f[_0xd3c6('0x59')];if(!_0x24572f[_0xd3c6('0x3d')][_0xd3c6('0x42')](_0xd3c6('0x43'))){_0x3441d5['limit']=qs[_0xd3c6('0x44')](_0x24572f[_0xd3c6('0x3d')][_0xd3c6('0x44')]);_0x3441d5['offset']=qs[_0xd3c6('0x2c')](_0x24572f[_0xd3c6('0x3d')][_0xd3c6('0x2c')]);}return _0x3ddfa2[_0xd3c6('0x5a')](_0x3441d5);}})[_0xd3c6('0x4c')](function(_0x19f37e){if(_0x19f37e){return _0x19f37e?{'count':_0x2c31f2,'rows':_0x19f37e}:null;}})[_0xd3c6('0x4c')](respondWithResult(_0xadc0a3,null))['catch'](handleError(_0xadc0a3,null));};exports[_0xd3c6('0x5e')]=function(_0x4e3143,_0x4a7694,_0x4d2f8b){var _0x44a428={};var _0x59cc54={};var _0xef38b4;var _0xf97334;return db['SalesforceConfiguration'][_0xd3c6('0x58')]({'where':{'id':_0x4e3143[_0xd3c6('0x52')]['id']}})['then'](handleEntityNotFound(_0x4a7694,null))['then'](function(_0x2e06bc){if(_0x2e06bc){_0xef38b4=_0x2e06bc;_0x59cc54[_0xd3c6('0x3c')]=_[_0xd3c6('0x3e')](db[_0xd3c6('0x5b')][_0xd3c6('0x53')]);_0x59cc54[_0xd3c6('0x3d')]=_[_0xd3c6('0x3e')](_0x4e3143[_0xd3c6('0x3d')]);_0x59cc54[_0xd3c6('0x48')]=_[_0xd3c6('0x3f')](_0x59cc54[_0xd3c6('0x3c')],_0x59cc54[_0xd3c6('0x3d')]);_0x44a428[_0xd3c6('0x40')]=_['intersection'](_0x59cc54[_0xd3c6('0x3c')],qs[_0xd3c6('0x41')](_0x4e3143['query'][_0xd3c6('0x41')]));_0x44a428[_0xd3c6('0x40')]=_0x44a428['attributes']['length']?_0x44a428[_0xd3c6('0x40')]:_0x59cc54[_0xd3c6('0x3c')];_0x44a428[_0xd3c6('0x45')]=qs[_0xd3c6('0x46')](_0x4e3143[_0xd3c6('0x3d')][_0xd3c6('0x46')]);_0x44a428[_0xd3c6('0x47')]=qs[_0xd3c6('0x48')](_[_0xd3c6('0x5c')](_0x4e3143[_0xd3c6('0x3d')],_0x59cc54[_0xd3c6('0x48')]));if(_0x4e3143[_0xd3c6('0x3d')]['filter']){_0x44a428['where']=_['merge'](_0x44a428[_0xd3c6('0x47')],{'$or':_[_0xd3c6('0x37')](_0x44a428[_0xd3c6('0x40')],function(_0x4fa26c){var _0x40e028={};_0x40e028[_0x4fa26c]={'$like':'%'+_0x4e3143[_0xd3c6('0x3d')][_0xd3c6('0x49')]+'%'};return _0x40e028;})});}_0x44a428=_[_0xd3c6('0x4a')]({},_0x44a428,_0x4e3143[_0xd3c6('0x5d')]);return _0xef38b4['getDescriptions'](_0x44a428);}})[_0xd3c6('0x4c')](function(_0x1bd62d){if(_0x1bd62d){_0xf97334=_0x1bd62d[_0xd3c6('0x59')];if(!_0x4e3143[_0xd3c6('0x3d')][_0xd3c6('0x42')]('nolimit')){_0x44a428[_0xd3c6('0x44')]=qs[_0xd3c6('0x44')](_0x4e3143[_0xd3c6('0x3d')]['limit']);_0x44a428[_0xd3c6('0x2c')]=qs[_0xd3c6('0x2c')](_0x4e3143['query']['offset']);}return _0xef38b4[_0xd3c6('0x5e')](_0x44a428);}})['then'](function(_0x5783c9){if(_0x5783c9){return _0x5783c9?{'count':_0xf97334,'rows':_0x5783c9}:null;}})[_0xd3c6('0x4c')](respondWithResult(_0x4a7694,null))[_0xd3c6('0x27')](handleError(_0x4a7694,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ef87a3b..43e92af 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 _0xb9b3=['moment','request-promise','path','rimraf','../../config/environment','exports','int_salesforce_configurations','util','../../config/logger','api'];(function(_0x1d90ca,_0x3bab16){var _0x28872b=function(_0x3ea71b){while(--_0x3ea71b){_0x1d90ca['push'](_0x1d90ca['shift']());}};_0x28872b(++_0x3bab16);}(_0xb9b3,0x15b));var _0x3b9b=function(_0xba9332,_0x4b4a65){_0xba9332=_0xba9332-0x0;var _0x4ef1ba=_0xb9b3[_0xba9332];return _0x4ef1ba;};'use strict';var _=require('lodash');var util=require(_0x3b9b('0x0'));var logger=require(_0x3b9b('0x1'))(_0x3b9b('0x2'));var moment=require(_0x3b9b('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b9b('0x4'));var fs=require('fs');var path=require(_0x3b9b('0x5'));var rimraf=require(_0x3b9b('0x6'));var config=require(_0x3b9b('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x3b9b('0x8')]=function(_0xebfe1d,_0x29795f){return _0xebfe1d['define']('SalesforceConfiguration',attributes,{'tableName':_0x3b9b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11e0=['path','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x45fb48,_0x2085cd){var _0x3bf6c9=function(_0x451cb0){while(--_0x451cb0){_0x45fb48['push'](_0x45fb48['shift']());}};_0x3bf6c9(++_0x2085cd);}(_0x11e0,0x14a));var _0x011e=function(_0x5692e6,_0xd5656b){_0x5692e6=_0x5692e6-0x0;var _0x3777de=_0x11e0[_0x5692e6];return _0x3777de;};'use strict';var _=require(_0x011e('0x0'));var util=require(_0x011e('0x1'));var logger=require('../../config/logger')(_0x011e('0x2'));var moment=require(_0x011e('0x3'));var BPromise=require(_0x011e('0x4'));var rp=require(_0x011e('0x5'));var fs=require('fs');var path=require(_0x011e('0x6'));var rimraf=require('rimraf');var config=require(_0x011e('0x7'));var attributes=require(_0x011e('0x8'));module['exports']=function(_0x50cde2,_0x2dfea5){return _0x50cde2[_0x011e('0x9')](_0x011e('0xa'),attributes,{'tableName':_0x011e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index f0b03d9..bf0db8f 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 _0x4858=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','bluebird','randomstring','ioredis'];(function(_0x4e0e9b,_0x45999e){var _0x4790b2=function(_0x3e2419){while(--_0x3e2419){_0x4e0e9b['push'](_0x4e0e9b['shift']());}};_0x4790b2(++_0x45999e);}(_0x4858,0x146));var _0x8485=function(_0x5cde01,_0x398a50){_0x5cde01=_0x5cde01-0x0;var _0x1a46de=_0x4858[_0x5cde01];return _0x1a46de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8485('0x0'));var BPromise=require(_0x8485('0x1'));var rs=require(_0x8485('0x2'));var fs=require('fs');var Redis=require(_0x8485('0x3'));var db=require(_0x8485('0x4'))['db'];var utils=require(_0x8485('0x5'));var logger=require(_0x8485('0x6'))(_0x8485('0x7'));var config=require(_0x8485('0x8'));var jayson=require(_0x8485('0x9'));var client=jayson['client'][_0x8485('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c08b6,_0x25b97d,_0xa71a82){return new BPromise(function(_0x38c3ad,_0x1105d3){return client[_0x8485('0xb')](_0x4c08b6,_0xa71a82)[_0x8485('0xc')](function(_0x145519){logger[_0x8485('0xd')](_0x8485('0xe'),_0x25b97d,_0x8485('0xf'));logger[_0x8485('0x10')](_0x8485('0x11'),_0x25b97d,_0x8485('0xf'),JSON['stringify'](_0x145519));if(_0x145519[_0x8485('0x12')]){if(_0x145519[_0x8485('0x12')][_0x8485('0x13')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x25b97d,_0x145519[_0x8485('0x12')][_0x8485('0x14')]);return _0x1105d3(_0x145519['error'][_0x8485('0x14')]);}logger[_0x8485('0x12')](_0x8485('0xe'),_0x25b97d,_0x145519[_0x8485('0x12')][_0x8485('0x14')]);return _0x38c3ad(_0x145519['error'][_0x8485('0x14')]);}else{logger[_0x8485('0xd')](_0x8485('0xe'),_0x25b97d,_0x8485('0xf'));_0x38c3ad(_0x145519[_0x8485('0x15')][_0x8485('0x14')]);}})['catch'](function(_0x212e67){logger[_0x8485('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x25b97d,_0x212e67);_0x1105d3(_0x212e67);});});} \ No newline at end of file +var _0xc8c0=['request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x806df2,_0xd5c588){var _0x24f68d=function(_0xdd8c1a){while(--_0xdd8c1a){_0x806df2['push'](_0x806df2['shift']());}};_0x24f68d(++_0xd5c588);}(_0xc8c0,0x17a));var _0x0c8c=function(_0xd08864,_0x16e352){_0xd08864=_0xd08864-0x0;var _0x3b5ccd=_0xc8c0[_0xd08864];return _0x3b5ccd;};'use strict';var _=require('lodash');var util=require(_0x0c8c('0x0'));var moment=require(_0x0c8c('0x1'));var BPromise=require(_0x0c8c('0x2'));var rs=require(_0x0c8c('0x3'));var fs=require('fs');var Redis=require(_0x0c8c('0x4'));var db=require(_0x0c8c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c8c('0x6'))(_0x0c8c('0x7'));var config=require('../../config/environment');var jayson=require(_0x0c8c('0x8'));var client=jayson[_0x0c8c('0x9')][_0x0c8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5971c5,_0xe0511,_0x8e6865){return new BPromise(function(_0x117d73,_0x2ac095){return client['request'](_0x5971c5,_0x8e6865)[_0x0c8c('0xb')](function(_0x4dbe24){logger[_0x0c8c('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xe0511,_0x0c8c('0xd'));logger[_0x0c8c('0xe')](_0x0c8c('0xf'),_0xe0511,_0x0c8c('0xd'),JSON[_0x0c8c('0x10')](_0x4dbe24));if(_0x4dbe24[_0x0c8c('0x11')]){if(_0x4dbe24[_0x0c8c('0x11')][_0x0c8c('0x12')]===0x1f4){logger[_0x0c8c('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0xe0511,_0x4dbe24[_0x0c8c('0x11')][_0x0c8c('0x13')]);return _0x2ac095(_0x4dbe24[_0x0c8c('0x11')]['message']);}logger[_0x0c8c('0x11')](_0x0c8c('0x14'),_0xe0511,_0x4dbe24[_0x0c8c('0x11')][_0x0c8c('0x13')]);return _0x117d73(_0x4dbe24['error']['message']);}else{logger['info'](_0x0c8c('0x14'),_0xe0511,_0x0c8c('0xd'));_0x117d73(_0x4dbe24[_0x0c8c('0x15')][_0x0c8c('0x13')]);}})[_0x0c8c('0x16')](function(_0x567198){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0xe0511,_0x567198);_0x2ac095(_0x567198);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8fee08f..e004858 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 _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x1261,0x144));var _0x1126=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x1261[_0x20d54d];return _0x516e8b;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0xc')]('/',auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router[_0x1126('0xf')]('/:id',auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8fb=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','multer'];(function(_0x3efd80,_0x556bea){var _0x515049=function(_0x26e2a6){while(--_0x26e2a6){_0x3efd80['push'](_0x3efd80['shift']());}};_0x515049(++_0x556bea);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3762d5,_0x5b8ebd){_0x3762d5=_0x3762d5-0x0;var _0x29f329=_0xd8fb[_0x3762d5];return _0x29f329;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd8f('0x4'));var config=require(_0xbd8f('0x5'));var controller=require('./intSalesforceField.controller');router[_0xbd8f('0x6')]('/',auth[_0xbd8f('0x7')](),controller['index']);router[_0xbd8f('0x6')]('/:id',auth[_0xbd8f('0x7')](),controller['show']);router[_0xbd8f('0x8')]('/',auth[_0xbd8f('0x7')](),controller['create']);router['put'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller[_0xbd8f('0xa')]);router['delete'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 6b46042..d06ce88 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 _0x7714=['variable','customVariable','keyValue','STRING','string','exports','ENUM'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x7714,0x163));var _0x4771=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x7714[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require('sequelize');module[_0x4771('0x0')]={'type':{'type':Sequelize[_0x4771('0x1')]('string',_0x4771('0x2'),_0x4771('0x3'),_0x4771('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4771('0x5')]},'key':{'type':Sequelize[_0x4771('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4771('0x6'),_0x4771('0x2'),_0x4771('0x3'))},'keyContent':{'type':Sequelize[_0x4771('0x5')]},'idField':{'type':Sequelize[_0x4771('0x5')]},'variableName':{'type':Sequelize[_0x4771('0x5')]}}; \ No newline at end of file +var _0xc7b6=['variable','customVariable','STRING','sequelize','exports','ENUM','string'];(function(_0x3d70da,_0x40b755){var _0x59bdc4=function(_0x544ce3){while(--_0x544ce3){_0x3d70da['push'](_0x3d70da['shift']());}};_0x59bdc4(++_0x40b755);}(_0xc7b6,0x199));var _0x6c7b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc7b6[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x6c7b('0x0'));module[_0x6c7b('0x1')]={'type':{'type':Sequelize[_0x6c7b('0x2')](_0x6c7b('0x3'),_0x6c7b('0x4'),_0x6c7b('0x5'),'keyValue'),'defaultValue':_0x6c7b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6c7b('0x6')]},'keyType':{'type':Sequelize[_0x6c7b('0x2')](_0x6c7b('0x3'),_0x6c7b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6c7b('0x6')]},'idField':{'type':Sequelize[_0x6c7b('0x6')]},'variableName':{'type':Sequelize[_0x6c7b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d874298..6e87a47 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 _0xf5a6=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0xf5a6,0x110));var _0x6f5a=function(_0x517eae,_0x3cea0f){_0x517eae=_0x517eae-0x0;var _0x14c8c4=_0xf5a6[_0x517eae];return _0x14c8c4;};'use strict';var pdf=require(_0x6f5a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6f5a('0x1'));var zipdir=require(_0x6f5a('0x2'));var jsonpatch=require(_0x6f5a('0x3'));var rp=require('request-promise');var moment=require(_0x6f5a('0x4'));var BPromise=require(_0x6f5a('0x5'));var Mustache=require(_0x6f5a('0x6'));var util=require(_0x6f5a('0x7'));var path=require(_0x6f5a('0x8'));var sox=require(_0x6f5a('0x9'));var csv=require(_0x6f5a('0xa'));var ejs=require(_0x6f5a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f5a('0xc'));var crypto=require('crypto');var jsforce=require(_0x6f5a('0xd'));var deskjs=require(_0x6f5a('0xe'));var toCsv=require(_0x6f5a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f5a('0xf'));var authService=require(_0x6f5a('0x10'));var qs=require(_0x6f5a('0x11'));var as=require(_0x6f5a('0x12'));var hardwareService=require(_0x6f5a('0x13'));var logger=require(_0x6f5a('0x14'))(_0x6f5a('0x15'));var utils=require(_0x6f5a('0x16'));var config=require(_0x6f5a('0x17'));var db=require(_0x6f5a('0x18'))['db'];function respondWithStatusCode(_0x7439cd,_0x23394f){_0x23394f=_0x23394f||0xcc;return function(_0x2b283f){if(_0x2b283f){return _0x7439cd[_0x6f5a('0x19')](_0x23394f);}return _0x7439cd[_0x6f5a('0x1a')](_0x23394f)[_0x6f5a('0x1b')]();};}function respondWithResult(_0x316d66,_0x10092f){_0x10092f=_0x10092f||0xc8;return function(_0x32f22d){if(_0x32f22d){return _0x316d66[_0x6f5a('0x1a')](_0x10092f)[_0x6f5a('0x1c')](_0x32f22d);}};}function respondWithFilteredResult(_0x38ce35,_0x479c8d){return function(_0x59ad78){if(_0x59ad78){var _0x428854=_0x59ad78[_0x6f5a('0x1d')],_0x3cbbd0=_0x479c8d[_0x6f5a('0x1e')],_0x4c036b=_0x479c8d[_0x6f5a('0x1e')]+_0x479c8d[_0x6f5a('0x1f')],_0x42ee34;if(_0x4c036b>=_0x428854){_0x4c036b=_0x428854;_0x42ee34=0xc8;}else{_0x42ee34=0xce;}_0x38ce35[_0x6f5a('0x1a')](_0x42ee34);return _0x38ce35['set'](_0x6f5a('0x20'),_0x3cbbd0+'-'+_0x4c036b+'/'+_0x428854)['json'](_0x59ad78);}return null;};}function patchUpdates(_0x23af1e){return function(_0x5c5c1a){try{jsonpatch[_0x6f5a('0x21')](_0x5c5c1a,_0x23af1e,!![]);}catch(_0x9f45a9){return BPromise[_0x6f5a('0x22')](_0x9f45a9);}return _0x5c5c1a['save']();};}function saveUpdates(_0x1036f0,_0x2ccaeb){return function(_0x37b21b){if(_0x37b21b){return _0x37b21b[_0x6f5a('0x23')](_0x1036f0)[_0x6f5a('0x24')](function(_0xdcd46a){return _0xdcd46a;});}return null;};}function removeEntity(_0x230379,_0x397c70){return function(_0x10d32c){if(_0x10d32c){return _0x10d32c[_0x6f5a('0x25')]()['then'](function(){_0x230379[_0x6f5a('0x1a')](0xcc)[_0x6f5a('0x1b')]();});}};}function handleEntityNotFound(_0x3ec384,_0x4fca4d){return function(_0x59029f){if(!_0x59029f){_0x3ec384[_0x6f5a('0x19')](0x194);}return _0x59029f;};}function handleError(_0xe15b99,_0xda931d){_0xda931d=_0xda931d||0x1f4;return function(_0x3889c4){logger[_0x6f5a('0x26')](_0x3889c4[_0x6f5a('0x27')]);if(_0x3889c4[_0x6f5a('0x28')]){delete _0x3889c4[_0x6f5a('0x28')];}_0xe15b99[_0x6f5a('0x1a')](_0xda931d)[_0x6f5a('0x29')](_0x3889c4);};}exports[_0x6f5a('0x2a')]=function(_0x60f485,_0x1fd599){var _0x477413={},_0x5d531b={},_0x45013e={'count':0x0,'rows':[]};var _0x21ec3b=_[_0x6f5a('0x2b')](db[_0x6f5a('0x2c')][_0x6f5a('0x2d')],function(_0x19d110){return{'name':_0x19d110['fieldName'],'type':_0x19d110[_0x6f5a('0x2e')][_0x6f5a('0x2f')]};});_0x5d531b[_0x6f5a('0x30')]=_[_0x6f5a('0x2b')](_0x21ec3b,_0x6f5a('0x28'));_0x5d531b[_0x6f5a('0x31')]=_[_0x6f5a('0x32')](_0x60f485['query']);_0x5d531b['filters']=_[_0x6f5a('0x33')](_0x5d531b[_0x6f5a('0x30')],_0x5d531b['query']);_0x477413[_0x6f5a('0x34')]=_['intersection'](_0x5d531b[_0x6f5a('0x30')],qs[_0x6f5a('0x35')](_0x60f485[_0x6f5a('0x31')]['fields']));_0x477413[_0x6f5a('0x34')]=_0x477413[_0x6f5a('0x34')][_0x6f5a('0x36')]?_0x477413[_0x6f5a('0x34')]:_0x5d531b[_0x6f5a('0x30')];if(!_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x37')](_0x6f5a('0x38'))){_0x477413[_0x6f5a('0x1f')]=qs[_0x6f5a('0x1f')](_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x1f')]);_0x477413['offset']=qs[_0x6f5a('0x1e')](_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x1e')]);}_0x477413[_0x6f5a('0x39')]=qs[_0x6f5a('0x3a')](_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x3a')]);_0x477413[_0x6f5a('0x3b')]=qs[_0x6f5a('0x3c')](_[_0x6f5a('0x3d')](_0x60f485[_0x6f5a('0x31')],_0x5d531b[_0x6f5a('0x3c')]),_0x21ec3b);if(_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x3e')]){_0x477413[_0x6f5a('0x3b')]=_[_0x6f5a('0x3f')](_0x477413[_0x6f5a('0x3b')],{'$or':_[_0x6f5a('0x2b')](_0x21ec3b,function(_0x2a0c17){if(_0x2a0c17[_0x6f5a('0x2e')]!==_0x6f5a('0x40')){var _0x4a1314={};_0x4a1314[_0x2a0c17[_0x6f5a('0x28')]]={'$like':'%'+_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x3e')]+'%'};return _0x4a1314;}})});}_0x477413=_[_0x6f5a('0x3f')]({},_0x477413,_0x60f485[_0x6f5a('0x41')]);var _0x37def1={'where':_0x477413['where']};return db[_0x6f5a('0x2c')][_0x6f5a('0x1d')](_0x37def1)['then'](function(_0x148431){_0x45013e['count']=_0x148431;if(_0x60f485[_0x6f5a('0x31')][_0x6f5a('0x42')]){_0x477413[_0x6f5a('0x43')]=[{'all':!![]}];}return db[_0x6f5a('0x2c')][_0x6f5a('0x44')](_0x477413);})['then'](function(_0x4b2cbf){_0x45013e['rows']=_0x4b2cbf;return _0x45013e;})[_0x6f5a('0x24')](respondWithFilteredResult(_0x1fd599,_0x477413))[_0x6f5a('0x45')](handleError(_0x1fd599,null));};exports[_0x6f5a('0x46')]=function(_0x45aaeb,_0x55be84){var _0x254fbf={'raw':!![],'where':{'id':_0x45aaeb[_0x6f5a('0x47')]['id']}},_0x214cbb={};_0x214cbb['model']=_['keys'](db['SalesforceField'][_0x6f5a('0x2d')]);_0x214cbb[_0x6f5a('0x31')]=_[_0x6f5a('0x32')](_0x45aaeb[_0x6f5a('0x31')]);_0x214cbb[_0x6f5a('0x3c')]=_[_0x6f5a('0x33')](_0x214cbb['model'],_0x214cbb[_0x6f5a('0x31')]);_0x254fbf['attributes']=_[_0x6f5a('0x33')](_0x214cbb[_0x6f5a('0x30')],qs[_0x6f5a('0x35')](_0x45aaeb[_0x6f5a('0x31')][_0x6f5a('0x35')]));_0x254fbf[_0x6f5a('0x34')]=_0x254fbf[_0x6f5a('0x34')]['length']?_0x254fbf[_0x6f5a('0x34')]:_0x214cbb[_0x6f5a('0x30')];if(_0x45aaeb[_0x6f5a('0x31')]['includeAll']){_0x254fbf[_0x6f5a('0x43')]=[{'all':!![]}];}_0x254fbf=_['merge']({},_0x254fbf,_0x45aaeb['options']);return db['SalesforceField']['find'](_0x254fbf)[_0x6f5a('0x24')](handleEntityNotFound(_0x55be84,null))[_0x6f5a('0x24')](respondWithResult(_0x55be84,null))[_0x6f5a('0x45')](handleError(_0x55be84,null));};exports[_0x6f5a('0x48')]=function(_0x1d2e98,_0x2d811e){return db[_0x6f5a('0x2c')][_0x6f5a('0x48')](_0x1d2e98[_0x6f5a('0x49')],{})[_0x6f5a('0x24')](respondWithResult(_0x2d811e,0xc9))[_0x6f5a('0x45')](handleError(_0x2d811e,null));};exports[_0x6f5a('0x23')]=function(_0x1de436,_0x3b161b){if(_0x1de436[_0x6f5a('0x49')]['id']){delete _0x1de436[_0x6f5a('0x49')]['id'];}return db[_0x6f5a('0x2c')]['find']({'where':{'id':_0x1de436[_0x6f5a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b161b,null))[_0x6f5a('0x24')](saveUpdates(_0x1de436[_0x6f5a('0x49')],null))['then'](respondWithResult(_0x3b161b,null))[_0x6f5a('0x45')](handleError(_0x3b161b,null));};exports[_0x6f5a('0x25')]=function(_0x200ea6,_0x408342){return db['SalesforceField']['find']({'where':{'id':_0x200ea6['params']['id']}})[_0x6f5a('0x24')](handleEntityNotFound(_0x408342,null))[_0x6f5a('0x24')](removeEntity(_0x408342,null))['catch'](handleError(_0x408342,null));}; \ No newline at end of file +var _0xdbeb=['order','sort','where','filter','VIRTUAL','merge','findAll','catch','show','keys','includeAll','include','options','find','create','body','params','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','send','index','map','SalesforceField','rawAttributes','type','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x46ad6c,_0x5f1539){var _0x1765ae=function(_0x4d3ed8){while(--_0x4d3ed8){_0x46ad6c['push'](_0x46ad6c['shift']());}};_0x1765ae(++_0x5f1539);}(_0xdbeb,0xa1));var _0xbdbe=function(_0x1713bb,_0x57062c){_0x1713bb=_0x1713bb-0x0;var _0x53363f=_0xdbeb[_0x1713bb];return _0x53363f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbdbe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbdbe('0x1'));var moment=require(_0xbdbe('0x2'));var BPromise=require(_0xbdbe('0x3'));var Mustache=require('mustache');var util=require(_0xbdbe('0x4'));var path=require(_0xbdbe('0x5'));var sox=require(_0xbdbe('0x6'));var csv=require(_0xbdbe('0x7'));var ejs=require(_0xbdbe('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbdbe('0x9'));var crypto=require('crypto');var jsforce=require(_0xbdbe('0xa'));var deskjs=require(_0xbdbe('0xb'));var toCsv=require(_0xbdbe('0x7'));var querystring=require(_0xbdbe('0xc'));var Papa=require(_0xbdbe('0xd'));var Redis=require(_0xbdbe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbdbe('0xf'));var as=require(_0xbdbe('0x10'));var hardwareService=require(_0xbdbe('0x11'));var logger=require(_0xbdbe('0x12'))(_0xbdbe('0x13'));var utils=require(_0xbdbe('0x14'));var config=require(_0xbdbe('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x444994,_0x21d2b4){_0x21d2b4=_0x21d2b4||0xcc;return function(_0x2f4bfa){if(_0x2f4bfa){return _0x444994[_0xbdbe('0x16')](_0x21d2b4);}return _0x444994['status'](_0x21d2b4)[_0xbdbe('0x17')]();};}function respondWithResult(_0x591ad2,_0x352803){_0x352803=_0x352803||0xc8;return function(_0x17f497){if(_0x17f497){return _0x591ad2[_0xbdbe('0x18')](_0x352803)['json'](_0x17f497);}};}function respondWithFilteredResult(_0x266cbc,_0x539200){return function(_0x4ec153){if(_0x4ec153){var _0x28e2e3=_0x4ec153[_0xbdbe('0x19')],_0x357484=_0x539200[_0xbdbe('0x1a')],_0x585fbc=_0x539200['offset']+_0x539200['limit'],_0x3afdbd;if(_0x585fbc>=_0x28e2e3){_0x585fbc=_0x28e2e3;_0x3afdbd=0xc8;}else{_0x3afdbd=0xce;}_0x266cbc[_0xbdbe('0x18')](_0x3afdbd);return _0x266cbc[_0xbdbe('0x1b')](_0xbdbe('0x1c'),_0x357484+'-'+_0x585fbc+'/'+_0x28e2e3)[_0xbdbe('0x1d')](_0x4ec153);}return null;};}function patchUpdates(_0x5959bf){return function(_0x5df019){try{jsonpatch[_0xbdbe('0x1e')](_0x5df019,_0x5959bf,!![]);}catch(_0x3747c0){return BPromise[_0xbdbe('0x1f')](_0x3747c0);}return _0x5df019[_0xbdbe('0x20')]();};}function saveUpdates(_0x37a711,_0x6ef11d){return function(_0x4ee149){if(_0x4ee149){return _0x4ee149[_0xbdbe('0x21')](_0x37a711)[_0xbdbe('0x22')](function(_0x39817e){return _0x39817e;});}return null;};}function removeEntity(_0x55d58d,_0x169866){return function(_0x2a1dfa){if(_0x2a1dfa){return _0x2a1dfa[_0xbdbe('0x23')]()[_0xbdbe('0x22')](function(){_0x55d58d[_0xbdbe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd29d,_0x26fe90){return function(_0x1baf4c){if(!_0x1baf4c){_0x2bd29d['sendStatus'](0x194);}return _0x1baf4c;};}function handleError(_0x540701,_0x4386c9){_0x4386c9=_0x4386c9||0x1f4;return function(_0x2444d4){logger['error'](_0x2444d4[_0xbdbe('0x24')]);if(_0x2444d4['name']){delete _0x2444d4['name'];}_0x540701[_0xbdbe('0x18')](_0x4386c9)[_0xbdbe('0x25')](_0x2444d4);};}exports[_0xbdbe('0x26')]=function(_0x38782f,_0x5b0302){var _0x2c80fb={},_0x2f1299={},_0x1ed259={'count':0x0,'rows':[]};var _0x414322=_[_0xbdbe('0x27')](db[_0xbdbe('0x28')][_0xbdbe('0x29')],function(_0x37889b){return{'name':_0x37889b['fieldName'],'type':_0x37889b[_0xbdbe('0x2a')][_0xbdbe('0x2b')]};});_0x2f1299['model']=_['map'](_0x414322,_0xbdbe('0x2c'));_0x2f1299[_0xbdbe('0x2d')]=_['keys'](_0x38782f[_0xbdbe('0x2d')]);_0x2f1299[_0xbdbe('0x2e')]=_[_0xbdbe('0x2f')](_0x2f1299[_0xbdbe('0x30')],_0x2f1299[_0xbdbe('0x2d')]);_0x2c80fb['attributes']=_['intersection'](_0x2f1299['model'],qs[_0xbdbe('0x31')](_0x38782f[_0xbdbe('0x2d')]['fields']));_0x2c80fb[_0xbdbe('0x32')]=_0x2c80fb[_0xbdbe('0x32')][_0xbdbe('0x33')]?_0x2c80fb[_0xbdbe('0x32')]:_0x2f1299[_0xbdbe('0x30')];if(!_0x38782f[_0xbdbe('0x2d')][_0xbdbe('0x34')](_0xbdbe('0x35'))){_0x2c80fb['limit']=qs[_0xbdbe('0x36')](_0x38782f[_0xbdbe('0x2d')][_0xbdbe('0x36')]);_0x2c80fb[_0xbdbe('0x1a')]=qs[_0xbdbe('0x1a')](_0x38782f['query'][_0xbdbe('0x1a')]);}_0x2c80fb[_0xbdbe('0x37')]=qs['sort'](_0x38782f[_0xbdbe('0x2d')][_0xbdbe('0x38')]);_0x2c80fb[_0xbdbe('0x39')]=qs[_0xbdbe('0x2e')](_['pick'](_0x38782f['query'],_0x2f1299[_0xbdbe('0x2e')]),_0x414322);if(_0x38782f[_0xbdbe('0x2d')][_0xbdbe('0x3a')]){_0x2c80fb[_0xbdbe('0x39')]=_['merge'](_0x2c80fb[_0xbdbe('0x39')],{'$or':_['map'](_0x414322,function(_0x2975eb){if(_0x2975eb[_0xbdbe('0x2a')]!==_0xbdbe('0x3b')){var _0x7d3127={};_0x7d3127[_0x2975eb[_0xbdbe('0x2c')]]={'$like':'%'+_0x38782f[_0xbdbe('0x2d')][_0xbdbe('0x3a')]+'%'};return _0x7d3127;}})});}_0x2c80fb=_[_0xbdbe('0x3c')]({},_0x2c80fb,_0x38782f['options']);var _0x17ce5c={'where':_0x2c80fb[_0xbdbe('0x39')]};return db['SalesforceField'][_0xbdbe('0x19')](_0x17ce5c)[_0xbdbe('0x22')](function(_0x5be6d2){_0x1ed259['count']=_0x5be6d2;if(_0x38782f[_0xbdbe('0x2d')]['includeAll']){_0x2c80fb['include']=[{'all':!![]}];}return db[_0xbdbe('0x28')][_0xbdbe('0x3d')](_0x2c80fb);})[_0xbdbe('0x22')](function(_0x3b1430){_0x1ed259['rows']=_0x3b1430;return _0x1ed259;})[_0xbdbe('0x22')](respondWithFilteredResult(_0x5b0302,_0x2c80fb))[_0xbdbe('0x3e')](handleError(_0x5b0302,null));};exports[_0xbdbe('0x3f')]=function(_0x1ccba9,_0x54ac5d){var _0x47d294={'raw':!![],'where':{'id':_0x1ccba9['params']['id']}},_0x47c6e4={};_0x47c6e4[_0xbdbe('0x30')]=_[_0xbdbe('0x40')](db[_0xbdbe('0x28')][_0xbdbe('0x29')]);_0x47c6e4['query']=_[_0xbdbe('0x40')](_0x1ccba9['query']);_0x47c6e4[_0xbdbe('0x2e')]=_[_0xbdbe('0x2f')](_0x47c6e4[_0xbdbe('0x30')],_0x47c6e4['query']);_0x47d294[_0xbdbe('0x32')]=_[_0xbdbe('0x2f')](_0x47c6e4['model'],qs[_0xbdbe('0x31')](_0x1ccba9[_0xbdbe('0x2d')][_0xbdbe('0x31')]));_0x47d294[_0xbdbe('0x32')]=_0x47d294['attributes'][_0xbdbe('0x33')]?_0x47d294['attributes']:_0x47c6e4[_0xbdbe('0x30')];if(_0x1ccba9[_0xbdbe('0x2d')][_0xbdbe('0x41')]){_0x47d294[_0xbdbe('0x42')]=[{'all':!![]}];}_0x47d294=_['merge']({},_0x47d294,_0x1ccba9[_0xbdbe('0x43')]);return db['SalesforceField'][_0xbdbe('0x44')](_0x47d294)[_0xbdbe('0x22')](handleEntityNotFound(_0x54ac5d,null))[_0xbdbe('0x22')](respondWithResult(_0x54ac5d,null))[_0xbdbe('0x3e')](handleError(_0x54ac5d,null));};exports[_0xbdbe('0x45')]=function(_0x5a70cf,_0x502daf){return db['SalesforceField'][_0xbdbe('0x45')](_0x5a70cf[_0xbdbe('0x46')],{})[_0xbdbe('0x22')](respondWithResult(_0x502daf,0xc9))[_0xbdbe('0x3e')](handleError(_0x502daf,null));};exports['update']=function(_0x536fd6,_0xb01acb){if(_0x536fd6[_0xbdbe('0x46')]['id']){delete _0x536fd6[_0xbdbe('0x46')]['id'];}return db[_0xbdbe('0x28')]['find']({'where':{'id':_0x536fd6[_0xbdbe('0x47')]['id']}})[_0xbdbe('0x22')](handleEntityNotFound(_0xb01acb,null))[_0xbdbe('0x22')](saveUpdates(_0x536fd6[_0xbdbe('0x46')],null))[_0xbdbe('0x22')](respondWithResult(_0xb01acb,null))['catch'](handleError(_0xb01acb,null));};exports[_0xbdbe('0x23')]=function(_0x4ee0e4,_0x494f64){return db['SalesforceField'][_0xbdbe('0x44')]({'where':{'id':_0x4ee0e4[_0xbdbe('0x47')]['id']}})[_0xbdbe('0x22')](handleEntityNotFound(_0x494f64,null))['then'](removeEntity(_0x494f64,null))['catch'](handleError(_0x494f64,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1625aa3..bba2eb4 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 _0x67e1=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d76b7,_0x419b41){var _0x57e41b=function(_0x2c443c){while(--_0x2c443c){_0x4d76b7['push'](_0x4d76b7['shift']());}};_0x57e41b(++_0x419b41);}(_0x67e1,0x17d));var _0x167e=function(_0x2d79c2,_0x37b25e){_0x2d79c2=_0x2d79c2-0x0;var _0x36e40d=_0x67e1[_0x2d79c2];return _0x36e40d;};'use strict';var _=require(_0x167e('0x0'));var util=require(_0x167e('0x1'));var logger=require(_0x167e('0x2'))('api');var moment=require(_0x167e('0x3'));var BPromise=require(_0x167e('0x4'));var rp=require(_0x167e('0x5'));var fs=require('fs');var path=require(_0x167e('0x6'));var rimraf=require(_0x167e('0x7'));var config=require(_0x167e('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x167e('0x9')]=function(_0xa1a950,_0x3ff52b){return _0xa1a950[_0x167e('0xa')](_0x167e('0xb'),attributes,{'tableName':_0x167e('0xc'),'paranoid':![],'indexes':[{'name':_0x167e('0xd'),'fields':[_0x167e('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e38=['util','api','moment','path','../../config/environment','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x3e38,0x1d3));var _0x83e3=function(_0x9a515,_0xf8fff2){_0x9a515=_0x9a515-0x0;var _0x4392ea=_0x3e38[_0x9a515];return _0x4392ea;};'use strict';var _=require(_0x83e3('0x0'));var util=require(_0x83e3('0x1'));var logger=require('../../config/logger')(_0x83e3('0x2'));var moment=require(_0x83e3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x83e3('0x4'));var rimraf=require('rimraf');var config=require(_0x83e3('0x5'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0xf315fb,_0x535813){return _0xf315fb[_0x83e3('0x6')](_0x83e3('0x7'),attributes,{'tableName':_0x83e3('0x8'),'paranoid':![],'indexes':[{'name':_0x83e3('0x9'),'fields':[_0x83e3('0xa'),_0x83e3('0xb')],'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 40fa4fa..d5fe64b 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xdd5da3,_0x23f91c){var _0x1ad238=function(_0x14d729){while(--_0x14d729){_0xdd5da3['push'](_0xdd5da3['shift']());}};_0x1ad238(++_0x23f91c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2b3478,_0x58afd7){var _0x1c106f=function(_0x4f12a1){while(--_0x4f12a1){_0x2b3478['push'](_0x2b3478['shift']());}};_0x1c106f(++_0x58afd7);}(_0x153f,0x15b));var _0xf153=function(_0x5aecc2,_0x307cfe){_0x5aecc2=_0x5aecc2-0x0;var _0x58767d=_0x153f[_0x5aecc2];return _0x58767d;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3e96c14..6ad64b6 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 _0x046e=['/:id/configurations','addConfiguration','delete','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','getFields','post'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x046e,0x1b4));var _0xe046=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x046e[_0x2b45b5];return _0x1d9c06;};'use strict';var multer=require(_0xe046('0x0'));var util=require('util');var path=require(_0xe046('0x1'));var timeout=require('connect-timeout');var express=require(_0xe046('0x2'));var router=express[_0xe046('0x3')]();var auth=require(_0xe046('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe046('0x5'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0xe046('0x6')](),controller['index']);router['get'](_0xe046('0x7'),auth['isAuthenticated'](),controller[_0xe046('0x8')]);router[_0xe046('0x9')]('/:id/configurations',auth[_0xe046('0x6')](),controller[_0xe046('0xa')]);router[_0xe046('0x9')](_0xe046('0xb'),auth[_0xe046('0x6')](),controller[_0xe046('0xc')]);router[_0xe046('0xd')]('/',auth[_0xe046('0x6')](),controller['create']);router[_0xe046('0xd')](_0xe046('0xe'),auth[_0xe046('0x6')](),controller[_0xe046('0xf')]);router['put'](_0xe046('0x7'),auth[_0xe046('0x6')](),controller['update']);router[_0xe046('0x10')](_0xe046('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xe046('0x11')]=router; \ No newline at end of file +var _0x5294=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','update','destroy','exports','multer','util','path'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x5294,0x111));var _0x4529=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x5294[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var path=require(_0x4529('0x2'));var timeout=require(_0x4529('0x3'));var express=require(_0x4529('0x4'));var router=express[_0x4529('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4529('0x6'));var config=require(_0x4529('0x7'));var controller=require(_0x4529('0x8'));router['get']('/',auth[_0x4529('0x9')](),controller[_0x4529('0xa')]);router[_0x4529('0xb')](_0x4529('0xc'),auth['isAuthenticated'](),controller[_0x4529('0xd')]);router[_0x4529('0xb')](_0x4529('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x4529('0xf'),auth[_0x4529('0x9')](),controller[_0x4529('0x10')]);router['post']('/',auth[_0x4529('0x9')](),controller[_0x4529('0x11')]);router[_0x4529('0x12')](_0x4529('0xe'),auth[_0x4529('0x9')](),controller[_0x4529('0x13')]);router['put']('/:id',auth[_0x4529('0x9')](),controller[_0x4529('0x14')]);router['delete'](_0x4529('0xc'),auth['isAuthenticated'](),controller[_0x4529('0x15')]);module[_0x4529('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 619ccae..66752ae 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 _0x0017=['username','remoteUri','exports','STRING'];(function(_0xc4dc1c,_0x47a3ce){var _0xdb10ea=function(_0x3f32f7){while(--_0x3f32f7){_0xc4dc1c['push'](_0xc4dc1c['shift']());}};_0xdb10ea(++_0x47a3ce);}(_0x0017,0x96));var _0x7001=function(_0x26f866,_0x1900bc){_0x26f866=_0x26f866-0x0;var _0x1abef3=_0x0017[_0x26f866];return _0x1abef3;};'use strict';var Sequelize=require('sequelize');module[_0x7001('0x0')]={'name':{'type':Sequelize[_0x7001('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7001('0x1')],'unique':_0x7001('0x2')},'password':{'type':Sequelize[_0x7001('0x1')]},'email':{'type':Sequelize[_0x7001('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x7001('0x3')},'serverUrl':{'type':Sequelize[_0x7001('0x1')]}}; \ No newline at end of file +var _0xa5f9=['exports','STRING','username','remoteUri'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa5f9,0x188));var _0x9a5f=function(_0x2bf39f,_0x3641ad){_0x2bf39f=_0x2bf39f-0x0;var _0x2d1c1c=_0xa5f9[_0x2bf39f];return _0x2d1c1c;};'use strict';var Sequelize=require('sequelize');module[_0x9a5f('0x0')]={'name':{'type':Sequelize[_0x9a5f('0x1')]},'description':{'type':Sequelize[_0x9a5f('0x1')]},'username':{'type':Sequelize[_0x9a5f('0x1')],'unique':_0x9a5f('0x2')},'password':{'type':Sequelize[_0x9a5f('0x1')]},'email':{'type':Sequelize[_0x9a5f('0x1')]},'remoteUri':{'type':Sequelize[_0x9a5f('0x1')],'unique':_0x9a5f('0x3')},'serverUrl':{'type':Sequelize[_0x9a5f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b4b5c26..2450635 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 _0xbeb0=['code','message','info','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','save','destroy','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','keys','rawAttributes','length','include','find','create','update','body','findOne','ServicenowConfiguration','getConfigurations','AccountId','Descriptions','getDescriptions','channel','ServicenowField','Subjects','made_sla','hold_reason','close_code','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','opened_by','sys_created_on','sys_domain','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','delivery_task','work_start','business_stc','description','close_notes','closed_by','contact_type','reopened_by','incident_state','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','boolean','True','true','False','false','GET','inactive','html-pdf','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3bf98a,_0x2b1625){var _0x2db380=function(_0x20a469){while(--_0x20a469){_0x3bf98a['push'](_0x3bf98a['shift']());}};_0x2db380(++_0x2b1625);}(_0xbeb0,0x15b));var _0x0beb=function(_0x5926b6,_0x73e2b0){_0x5926b6=_0x5926b6-0x0;var _0x26d589=_0xbeb0[_0x5926b6];return _0x26d589;};'use strict';var pdf=require(_0x0beb('0x0'));var emlformat=require(_0x0beb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0beb('0x2'));var moment=require(_0x0beb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0beb('0x4'));var util=require('util');var path=require(_0x0beb('0x5'));var sox=require(_0x0beb('0x6'));var csv=require(_0x0beb('0x7'));var ejs=require(_0x0beb('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0beb('0x9'));var crypto=require('crypto');var jsforce=require(_0x0beb('0xa'));var deskjs=require(_0x0beb('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0beb('0xc'));var Papa=require(_0x0beb('0xd'));var Redis=require('ioredis');var authService=require(_0x0beb('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0beb('0xf'))('api');var utils=require(_0x0beb('0x10'));var config=require('../../config/environment');var db=require(_0x0beb('0x11'))['db'];var integrations=require(_0x0beb('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x0beb('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x333553,_0x3f69b6,_0x7cb6d1){if(_0x7cb6d1){var _0x7bc623=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7bc623[_0x0beb('0x14')](_0x3f69b6)){return _0x333553;}else{throw new db[(_0x0beb('0x15'))][(_0x0beb('0x16'))](_0x0beb('0x17'));}}else{return _0x333553;}}function respondWithRpcPromise(_0x1c4b9b,_0x3c7b11,_0x7cb79b,_0x478760){return new BPromise(function(_0x1460a2,_0x4e2179){var _0x61f213=_0x478760||client;return _0x61f213[_0x0beb('0x18')](_0x1c4b9b,_0x7cb79b)[_0x0beb('0x19')](function(_0x296f79){logger['info'](_0x0beb('0x1a'),_0x3c7b11,_0x0beb('0x1b'));logger[_0x0beb('0x1c')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3c7b11,'request\x20sent',JSON[_0x0beb('0x1d')](_0x296f79));if(_0x296f79['error']){if(_0x296f79[_0x0beb('0x1e')][_0x0beb('0x1f')]===0x1f4){logger['error'](_0x0beb('0x1a'),_0x3c7b11,_0x296f79[_0x0beb('0x1e')][_0x0beb('0x20')]);return _0x4e2179(_0x296f79[_0x0beb('0x1e')]['message']);}logger[_0x0beb('0x1e')](_0x0beb('0x1a'),_0x3c7b11,_0x296f79[_0x0beb('0x1e')]['message']);return _0x1460a2(_0x296f79[_0x0beb('0x1e')][_0x0beb('0x20')]);}else{logger[_0x0beb('0x21')](_0x0beb('0x1a'),_0x3c7b11,_0x0beb('0x1b'));_0x1460a2(_0x296f79[_0x0beb('0x22')]['message']);}})[_0x0beb('0x23')](function(_0x2dbf2e){logger['error'](_0x0beb('0x1a'),_0x3c7b11,_0x2dbf2e);_0x4e2179(_0x2dbf2e);});});}function respondWithStatusCode(_0x1868b8,_0x39bea5){_0x39bea5=_0x39bea5||0xcc;return function(_0x211be5){if(_0x211be5){return _0x1868b8[_0x0beb('0x24')](_0x39bea5);}return _0x1868b8['status'](_0x39bea5)[_0x0beb('0x25')]();};}function respondWithResult(_0xcff12d,_0x5dd1cb){_0x5dd1cb=_0x5dd1cb||0xc8;return function(_0x21a328){if(_0x21a328){return _0xcff12d[_0x0beb('0x26')](_0x5dd1cb)[_0x0beb('0x27')](_0x21a328);}};}function respondWithFilteredResult(_0x422acb,_0x92170c){return function(_0x591989){if(_0x591989){var _0x10a99f=_0x591989['count'],_0x5221f7=_0x92170c['offset'],_0x37c055=_0x92170c[_0x0beb('0x28')]+_0x92170c['limit'],_0x12a7f3;if(_0x37c055>=_0x10a99f){_0x37c055=_0x10a99f;_0x12a7f3=0xc8;}else{_0x12a7f3=0xce;}_0x422acb[_0x0beb('0x26')](_0x12a7f3);return _0x422acb[_0x0beb('0x29')](_0x0beb('0x2a'),_0x5221f7+'-'+_0x37c055+'/'+_0x10a99f)['json'](_0x591989);}return null;};}function patchUpdates(_0x66b468){return function(_0x5b67ca){try{jsonpatch[_0x0beb('0x2b')](_0x5b67ca,_0x66b468,!![]);}catch(_0x4749e0){return BPromise['reject'](_0x4749e0);}return _0x5b67ca[_0x0beb('0x2c')]();};}function saveUpdates(_0x174c25,_0xacbf60){return function(_0x51607c){if(_0x51607c){return _0x51607c['update'](_0x174c25)[_0x0beb('0x19')](function(_0x58f84d){return _0x58f84d;});}return null;};}function removeEntity(_0x49f40a,_0x45206b){return function(_0x2a3a62){if(_0x2a3a62){return _0x2a3a62[_0x0beb('0x2d')]()[_0x0beb('0x19')](function(){_0x49f40a[_0x0beb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dd752,_0x1653a5){return function(_0x4a521c){if(!_0x4a521c){_0x1dd752[_0x0beb('0x24')](0x194);}return _0x4a521c;};}function handleError(_0x216e56,_0x1c9e0e){_0x1c9e0e=_0x1c9e0e||0x1f4;return function(_0xed2292){logger['error'](_0xed2292[_0x0beb('0x2e')]);if(_0xed2292[_0x0beb('0x2f')]){delete _0xed2292['name'];}_0x216e56[_0x0beb('0x26')](_0x1c9e0e)[_0x0beb('0x30')](_0xed2292);};}exports[_0x0beb('0x31')]=function(_0x1a4664,_0x3d65ce){var _0x511e0e={},_0x44c8b7={},_0x5b5698={'count':0x0,'rows':[]};var _0xd8c799=_[_0x0beb('0x32')](db[_0x0beb('0x33')]['rawAttributes'],function(_0x369ff1){return{'name':_0x369ff1[_0x0beb('0x34')],'type':_0x369ff1[_0x0beb('0x35')][_0x0beb('0x36')]};});_0x44c8b7[_0x0beb('0x37')]=_[_0x0beb('0x32')](_0xd8c799,_0x0beb('0x2f'));_0x44c8b7[_0x0beb('0x38')]=_['keys'](_0x1a4664[_0x0beb('0x38')]);_0x44c8b7[_0x0beb('0x39')]=_[_0x0beb('0x3a')](_0x44c8b7['model'],_0x44c8b7['query']);_0x511e0e[_0x0beb('0x3b')]=_[_0x0beb('0x3a')](_0x44c8b7[_0x0beb('0x37')],qs[_0x0beb('0x3c')](_0x1a4664[_0x0beb('0x38')][_0x0beb('0x3c')]));_0x511e0e[_0x0beb('0x3b')]=_0x511e0e[_0x0beb('0x3b')]['length']?_0x511e0e['attributes']:_0x44c8b7[_0x0beb('0x37')];if(!_0x1a4664['query'][_0x0beb('0x3d')](_0x0beb('0x3e'))){_0x511e0e[_0x0beb('0x3f')]=qs[_0x0beb('0x3f')](_0x1a4664['query']['limit']);_0x511e0e[_0x0beb('0x28')]=qs[_0x0beb('0x28')](_0x1a4664[_0x0beb('0x38')]['offset']);}_0x511e0e[_0x0beb('0x40')]=qs[_0x0beb('0x41')](_0x1a4664['query'][_0x0beb('0x41')]);_0x511e0e[_0x0beb('0x42')]=qs[_0x0beb('0x39')](_[_0x0beb('0x43')](_0x1a4664['query'],_0x44c8b7['filters']),_0xd8c799);if(_0x1a4664[_0x0beb('0x38')][_0x0beb('0x44')]){_0x511e0e['where']=_[_0x0beb('0x45')](_0x511e0e[_0x0beb('0x42')],{'$or':_[_0x0beb('0x32')](_0xd8c799,function(_0x5db1b4){if(_0x5db1b4[_0x0beb('0x35')]!=='VIRTUAL'){var _0x4e9d18={};_0x4e9d18[_0x5db1b4[_0x0beb('0x2f')]]={'$like':'%'+_0x1a4664[_0x0beb('0x38')][_0x0beb('0x44')]+'%'};return _0x4e9d18;}})});}_0x511e0e=_[_0x0beb('0x45')]({},_0x511e0e,_0x1a4664[_0x0beb('0x46')]);var _0x4ffdc5={'where':_0x511e0e[_0x0beb('0x42')]};return db[_0x0beb('0x33')][_0x0beb('0x47')](_0x4ffdc5)['then'](function(_0x1ee736){_0x5b5698[_0x0beb('0x47')]=_0x1ee736;if(_0x1a4664[_0x0beb('0x38')][_0x0beb('0x48')]){_0x511e0e['include']=[{'all':!![]}];}return db[_0x0beb('0x33')][_0x0beb('0x49')](_0x511e0e);})[_0x0beb('0x19')](function(_0x284283){_0x5b5698[_0x0beb('0x4a')]=_0x284283;return _0x5b5698;})[_0x0beb('0x19')](respondWithFilteredResult(_0x3d65ce,_0x511e0e))[_0x0beb('0x23')](handleError(_0x3d65ce,null));};exports[_0x0beb('0x4b')]=function(_0x366d64,_0x4f245e){var _0xaca1ff={'raw':![],'where':{'id':_0x366d64[_0x0beb('0x4c')]['id']}},_0x2a48f0={};_0x2a48f0['model']=_[_0x0beb('0x4d')](db[_0x0beb('0x33')][_0x0beb('0x4e')]);_0x2a48f0[_0x0beb('0x38')]=_[_0x0beb('0x4d')](_0x366d64[_0x0beb('0x38')]);_0x2a48f0[_0x0beb('0x39')]=_['intersection'](_0x2a48f0[_0x0beb('0x37')],_0x2a48f0[_0x0beb('0x38')]);_0xaca1ff[_0x0beb('0x3b')]=_['intersection'](_0x2a48f0[_0x0beb('0x37')],qs[_0x0beb('0x3c')](_0x366d64[_0x0beb('0x38')][_0x0beb('0x3c')]));_0xaca1ff[_0x0beb('0x3b')]=_0xaca1ff[_0x0beb('0x3b')][_0x0beb('0x4f')]?_0xaca1ff[_0x0beb('0x3b')]:_0x2a48f0['model'];if(_0x366d64[_0x0beb('0x38')]['includeAll']){_0xaca1ff[_0x0beb('0x50')]=[{'all':!![]}];}_0xaca1ff=_[_0x0beb('0x45')]({},_0xaca1ff,_0x366d64[_0x0beb('0x46')]);return db[_0x0beb('0x33')][_0x0beb('0x51')](_0xaca1ff)[_0x0beb('0x19')](handleEntityNotFound(_0x4f245e,null))[_0x0beb('0x19')](respondWithResult(_0x4f245e,null))[_0x0beb('0x23')](handleError(_0x4f245e,null));};exports[_0x0beb('0x52')]=function(_0x23b240,_0x1eabd3){return db['ServicenowAccount']['create'](_0x23b240['body'],{})[_0x0beb('0x19')](respondWithResult(_0x1eabd3,0xc9))['catch'](handleError(_0x1eabd3,null));};exports[_0x0beb('0x53')]=function(_0x5b6474,_0x56493c){if(_0x5b6474['body']['id']){delete _0x5b6474[_0x0beb('0x54')]['id'];}return db[_0x0beb('0x33')][_0x0beb('0x51')]({'where':{'id':_0x5b6474['params']['id']}})[_0x0beb('0x19')](handleEntityNotFound(_0x56493c,null))['then'](saveUpdates(_0x5b6474['body'],null))[_0x0beb('0x19')](respondWithResult(_0x56493c,null))[_0x0beb('0x23')](handleError(_0x56493c,null));};exports['destroy']=function(_0x9bed24,_0x7bcca3){return db['ServicenowAccount'][_0x0beb('0x51')]({'where':{'id':_0x9bed24[_0x0beb('0x4c')]['id']}})[_0x0beb('0x19')](handleEntityNotFound(_0x7bcca3,null))[_0x0beb('0x19')](removeEntity(_0x7bcca3,null))['catch'](handleError(_0x7bcca3,null));};exports['getConfigurations']=function(_0x2cdf73,_0x32b291,_0x4ed347){var _0x5a01b4={};var _0x176353={};var _0x1d555b;var _0x271a5f;return db[_0x0beb('0x33')][_0x0beb('0x55')]({'where':{'id':_0x2cdf73['params']['id']}})[_0x0beb('0x19')](handleEntityNotFound(_0x32b291,null))['then'](function(_0x461682){if(_0x461682){_0x1d555b=_0x461682;_0x176353[_0x0beb('0x37')]=_[_0x0beb('0x4d')](db[_0x0beb('0x56')][_0x0beb('0x4e')]);_0x176353[_0x0beb('0x38')]=_[_0x0beb('0x4d')](_0x2cdf73[_0x0beb('0x38')]);_0x176353[_0x0beb('0x39')]=_[_0x0beb('0x3a')](_0x176353[_0x0beb('0x37')],_0x176353[_0x0beb('0x38')]);_0x5a01b4[_0x0beb('0x3b')]=_[_0x0beb('0x3a')](_0x176353[_0x0beb('0x37')],qs[_0x0beb('0x3c')](_0x2cdf73[_0x0beb('0x38')]['fields']));_0x5a01b4[_0x0beb('0x3b')]=_0x5a01b4[_0x0beb('0x3b')][_0x0beb('0x4f')]?_0x5a01b4[_0x0beb('0x3b')]:_0x176353['model'];_0x5a01b4[_0x0beb('0x40')]=qs['sort'](_0x2cdf73[_0x0beb('0x38')][_0x0beb('0x41')]);_0x5a01b4[_0x0beb('0x42')]=qs['filters'](_['pick'](_0x2cdf73[_0x0beb('0x38')],_0x176353['filters']));if(_0x2cdf73[_0x0beb('0x38')][_0x0beb('0x44')]){_0x5a01b4['where']=_['merge'](_0x5a01b4[_0x0beb('0x42')],{'$or':_[_0x0beb('0x32')](_0x5a01b4[_0x0beb('0x3b')],function(_0x5d1b0b){var _0x3685fa={};_0x3685fa[_0x5d1b0b]={'$like':'%'+_0x2cdf73['query'][_0x0beb('0x44')]+'%'};return _0x3685fa;})});}_0x5a01b4=_[_0x0beb('0x45')]({},_0x5a01b4,_0x2cdf73[_0x0beb('0x46')]);return _0x1d555b[_0x0beb('0x57')](_0x5a01b4);}})['then'](function(_0x7a088){if(_0x7a088){_0x271a5f=_0x7a088[_0x0beb('0x4f')];if(!_0x2cdf73[_0x0beb('0x38')]['hasOwnProperty']('nolimit')){_0x5a01b4[_0x0beb('0x3f')]=qs[_0x0beb('0x3f')](_0x2cdf73['query'][_0x0beb('0x3f')]);_0x5a01b4[_0x0beb('0x28')]=qs[_0x0beb('0x28')](_0x2cdf73[_0x0beb('0x38')][_0x0beb('0x28')]);}return _0x1d555b[_0x0beb('0x57')](_0x5a01b4);}})['then'](function(_0x3ae3a4){if(_0x3ae3a4){return _0x3ae3a4?{'count':_0x271a5f,'rows':_0x3ae3a4}:null;}})[_0x0beb('0x19')](respondWithResult(_0x32b291,null))[_0x0beb('0x23')](handleError(_0x32b291,null));};exports['addConfiguration']=function(_0x10ae76,_0x4333dd,_0x3f44c4){if(_0x10ae76['body']['id']){delete _0x10ae76[_0x0beb('0x54')]['id'];}return db['ServicenowAccount'][_0x0beb('0x55')]({'where':{'id':_0x10ae76[_0x0beb('0x4c')]['id']}})[_0x0beb('0x19')](handleEntityNotFound(_0x4333dd,null))[_0x0beb('0x19')](function(_0x3e275e){if(_0x3e275e){_0x10ae76[_0x0beb('0x54')][_0x0beb('0x58')]=_0x3e275e['id'];_0x10ae76[_0x0beb('0x54')]['Subjects']=integrations['getSubjects'](_0x10ae76[_0x0beb('0x54')]['channel'],_0x10ae76[_0x0beb('0x54')][_0x0beb('0x35')]);_0x10ae76[_0x0beb('0x54')][_0x0beb('0x59')]=integrations[_0x0beb('0x5a')](_0x10ae76[_0x0beb('0x54')][_0x0beb('0x5b')],_0x10ae76['body'][_0x0beb('0x35')]);return db[_0x0beb('0x56')]['create'](_0x10ae76[_0x0beb('0x54')],{'include':[{'model':db[_0x0beb('0x5c')],'as':_0x0beb('0x5d')},{'model':db[_0x0beb('0x5c')],'as':_0x0beb('0x59')}]});}return null;})[_0x0beb('0x19')](respondWithResult(_0x4333dd,null))['catch'](handleError(_0x4333dd,null));};exports['getFields']=function(_0xa0d7ae,_0x5f276a,_0x5f5c6f){var _0x31e00a=[_0x0beb('0x5e'),_0x0beb('0x5f'),'knowledge','subcategory',_0x0beb('0x60'),_0x0beb('0x61'),'incident_state',_0x0beb('0x62'),_0x0beb('0x63')];var _0x31d9b9=['parent',_0x0beb('0x5e'),_0x0beb('0x64'),_0x0beb('0x65'),_0x0beb('0x66'),_0x0beb('0x67'),_0x0beb('0x68'),_0x0beb('0x5f'),'approval_history',_0x0beb('0x69'),_0x0beb('0x6a'),'sys_updated_by',_0x0beb('0x6b'),'user_input',_0x0beb('0x6c'),_0x0beb('0x6d'),'state','sys_created_by',_0x0beb('0x6e'),_0x0beb('0x40'),_0x0beb('0x6f'),_0x0beb('0x70'),_0x0beb('0x71'),_0x0beb('0x72'),_0x0beb('0x73'),_0x0beb('0x74'),_0x0beb('0x75'),_0x0beb('0x76'),'priority',_0x0beb('0x77'),'rfc',_0x0beb('0x78'),_0x0beb('0x79'),'opened_at',_0x0beb('0x7a'),_0x0beb('0x7b'),_0x0beb('0x7c'),_0x0beb('0x7d'),_0x0beb('0x7e'),_0x0beb('0x7f'),_0x0beb('0x80'),_0x0beb('0x81'),'work_notes',_0x0beb('0x82'),_0x0beb('0x60'),'correlation_display',_0x0beb('0x83'),_0x0beb('0x84'),'assignment_group',_0x0beb('0x85'),'additional_assignee_list',_0x0beb('0x86'),'calendar_duration',_0x0beb('0x61'),'sys_class_name',_0x0beb('0x87'),_0x0beb('0x88'),'follow_up','parent_incident','sys_id',_0x0beb('0x89'),_0x0beb('0x8a'),_0x0beb('0x8b'),_0x0beb('0x8c'),_0x0beb('0x8d'),'company',_0x0beb('0x8e'),_0x0beb('0x8f'),_0x0beb('0x90'),_0x0beb('0x62'),_0x0beb('0x91'),_0x0beb('0x92'),'approval',_0x0beb('0x93'),_0x0beb('0x94'),_0x0beb('0x95'),_0x0beb('0x96'),_0x0beb('0x97'),_0x0beb('0x98'),_0x0beb('0x99'),_0x0beb('0x9a'),_0x0beb('0x9b'),_0x0beb('0x63')];var _0x2f4b7c='';var _0x27a520='';var _0x54451e=[];var _0x5332ae='';var _0x31087e='';var _0xf4efe1=[];var _0x4d8e28='';var _0x5bca6a='';var _0x2a6c0f={};var _0xeed04='';return db['ServicenowAccount'][_0x0beb('0x55')]({'where':{'id':_0xa0d7ae['params']['id']},'attributes':['id','username',_0x0beb('0x9c'),_0x0beb('0x9d'),_0x0beb('0x9e'),_0x0beb('0x9f')]})[_0x0beb('0x19')](handleEntityNotFound(_0x5f276a,null))[_0x0beb('0x19')](function(_0x596fd5){if(_0x596fd5){_0xeed04=_0x596fd5['remoteUri'];var _0x1951c1=_0xeed04[_0x0beb('0xa0')](-0x1);if(_0x1951c1==='/'){_0xeed04=_0xeed04[_0x0beb('0xa1')](0x0,_0xeed04[_0x0beb('0xa2')](_0x1951c1));}_0x5bca6a=util[_0x0beb('0xa3')](_0x0beb('0xa4'),_0xeed04);_0x4d8e28=util[_0x0beb('0xa3')](_0x0beb('0xa5'),_0xeed04);_0x2a6c0f={'user':_0x596fd5[_0x0beb('0xa6')],'pass':_0x596fd5[_0x0beb('0x9c')]};var _0x187da2={'method':'GET','uri':_0x5bca6a+_0x0beb('0xa7'),'auth':_0x2a6c0f,'json':!![]};return rp(_0x187da2);}})[_0x0beb('0x19')](function(_0x369fbc){if(_0x369fbc[_0x0beb('0x22')][_0x0beb('0x4f')]>0x0){_0x2f4b7c=_0x369fbc[_0x0beb('0x22')];}console[_0x0beb('0xa8')](_0x0beb('0xa9'),_0x2f4b7c);_0xf4efe1=[];_0x27a520=Object[_0x0beb('0xaa')]([],_0x2f4b7c);_[_0x0beb('0xab')](_0x27a520,function(_0x5b77d7){return!_0x31e00a[_0x0beb('0xac')](_0x5b77d7[_0x0beb('0x2f')]);});_0x27a520[_0x0beb('0xad')](function(_0x33ffa2){var _0x305939=createFieldObject(_0x4d8e28,_0x2a6c0f,_0x33ffa2['internalType'],_0x33ffa2[_0x0beb('0x2f')],_0x33ffa2[_0x0beb('0xae')],![]);_0xf4efe1[_0x0beb('0xaf')](_0x305939);});return Promise['all'](_0xf4efe1);})[_0x0beb('0x19')](function(_0x402d3a){_0x54451e=_0x402d3a;_0x5332ae=Object[_0x0beb('0xaa')]([],_0x2f4b7c);console[_0x0beb('0xa8')](_0x0beb('0xb0'),_0x2f4b7c);_[_0x0beb('0xab')](_0x5332ae,function(_0x2a2da3){return _0x31d9b9['includes'](_0x2a2da3[_0x0beb('0x2f')]);});console[_0x0beb('0xa8')](_0x0beb('0xb1'),_0x5332ae);_0xf4efe1=[];_0x5332ae[_0x0beb('0xad')](function(_0x3756a0){var _0x4f3594=createFieldObject(_0x4d8e28,_0x2a6c0f,_0x3756a0['internalType'],_0x3756a0['name'],_0x3756a0['label'],!![]);_0xf4efe1[_0x0beb('0xaf')](_0x4f3594);});return Promise[_0x0beb('0xb2')](_0xf4efe1);})['then'](function(_0x242148){_0x31087e=_0x242148;var _0x1b1fbd=_0x54451e[_0x0beb('0xb3')](_0x31087e);return{'count':_0x1b1fbd[_0x0beb('0x4f')],'rows':_0x1b1fbd};})[_0x0beb('0x19')](respondWithResult(_0x5f276a,null))[_0x0beb('0x23')](function(_0x56818a){console['log'](_0x0beb('0xb4')+_0x56818a);var _0x10a371=_0xa0d7ae[_0x0beb('0x38')][_0x0beb('0x14')]?0x1f4:_0x56818a[_0x0beb('0xb5')]||0x1f4;logger[_0x0beb('0x1e')](_0x56818a['stack']);delete _0x56818a[_0x0beb('0x2f')];if(_0x10a371===0x191){_0x10a371=0x190;}_0x5f276a[_0x0beb('0x26')](_0x10a371)[_0x0beb('0x30')](_0xa0d7ae['query'][_0x0beb('0x14')]?{'message':'Wrong\x20credentials','statusCode':_0x56818a[_0x0beb('0xb5')]}:_0x56818a);});};function createFieldObject(_0x2f030f,_0x5569b1,_0x23f6f4,_0x30db07,_0x46889c,_0x3d6ef6){return new Promise(function(_0x4706b2,_0x5f3b25){var _0x30d807={'id':_0x30db07,'name':_0x46889c,'custom':_0x3d6ef6};if(_0x23f6f4===_0x0beb('0xb6')){_0x30d807['options']=[{'name':_0x0beb('0xb7'),'value':_0x0beb('0xb8')},{'name':_0x0beb('0xb9'),'value':_0x0beb('0xba')}];_0x4706b2(_0x30d807);}else{var _0xd7b44d={'method':_0x0beb('0xbb'),'uri':_0x2f030f+'sys_choice?sysparm_query=name=incident^element='+_0x30db07,'auth':_0x5569b1,'json':!![]};return rp(_0xd7b44d)[_0x0beb('0x19')](function(_0x30a105){var _0x5b788c=[];if(_0x30a105[_0x0beb('0x22')][_0x0beb('0x4f')]>0x0){_0x30a105[_0x0beb('0x22')][_0x0beb('0xad')](function(_0x1b86a8){if(_0x1b86a8[_0x0beb('0xbc')]===_0x0beb('0xba')){var _0x40d447={'name':_0x1b86a8[_0x0beb('0xae')],'value':_0x1b86a8['value']};_0x5b788c[_0x0beb('0xaf')](_0x40d447);}});}_0x30d807[_0x0beb('0x46')]=_0x5b788c;if(_0x30d807['options'][_0x0beb('0x4f')]>0x0){_0x4706b2(_0x30d807);}else{if(_0x3d6ef6==![]){_0x4706b2();}else{_0x4706b2(_0x30d807);}}});}});} \ No newline at end of file +var _0xa181=['close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','upon_approval','correlation_id','location','findOne','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','stack','test','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','ServicenowConfiguration','hasOwnProperty','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','watch_list','upon_reject','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name'];(function(_0x3d0fd2,_0x1f6d63){var _0x2aaa8d=function(_0x5551c1){while(--_0x5551c1){_0x3d0fd2['push'](_0x3d0fd2['shift']());}};_0x2aaa8d(++_0x1f6d63);}(_0xa181,0x10a));var _0x1a18=function(_0x5d2fc7,_0x2feef4){_0x5d2fc7=_0x5d2fc7-0x0;var _0x45b1fe=_0xa181[_0x5d2fc7];return _0x45b1fe;};'use strict';var pdf=require(_0x1a18('0x0'));var emlformat=require(_0x1a18('0x1'));var rimraf=require(_0x1a18('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a18('0x3'));var rp=require(_0x1a18('0x4'));var moment=require(_0x1a18('0x5'));var BPromise=require(_0x1a18('0x6'));var Mustache=require(_0x1a18('0x7'));var util=require(_0x1a18('0x8'));var path=require('path');var sox=require(_0x1a18('0x9'));var csv=require('to-csv');var ejs=require(_0x1a18('0xa'));var fs=require('fs');var _=require(_0x1a18('0xb'));var squel=require(_0x1a18('0xc'));var crypto=require(_0x1a18('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1a18('0xe'));var toCsv=require(_0x1a18('0xf'));var querystring=require(_0x1a18('0x10'));var Papa=require('papaparse');var Redis=require(_0x1a18('0x11'));var authService=require(_0x1a18('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1a18('0x13'));var hardwareService=require(_0x1a18('0x14'));var logger=require(_0x1a18('0x15'))(_0x1a18('0x16'));var utils=require(_0x1a18('0x17'));var config=require('../../config/environment');var db=require(_0x1a18('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1a18('0x19'));var client=jayson[_0x1a18('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x12c34d,_0x4ea0eb,_0x1b3de2){if(_0x1b3de2){var _0x15f465=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15f465['test'](_0x4ea0eb)){return _0x12c34d;}else{throw new db[(_0x1a18('0x1b'))][(_0x1a18('0x1c'))](_0x1a18('0x1d'));}}else{return _0x12c34d;}}function respondWithRpcPromise(_0x5da6ce,_0x2785f6,_0x47ac2e,_0x375527){return new BPromise(function(_0x4ef807,_0x30baba){var _0x5cdea8=_0x375527||client;return _0x5cdea8[_0x1a18('0x1e')](_0x5da6ce,_0x47ac2e)['then'](function(_0x2a621f){logger[_0x1a18('0x1f')](_0x1a18('0x20'),_0x2785f6,_0x1a18('0x21'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2785f6,'request\x20sent',JSON[_0x1a18('0x22')](_0x2a621f));if(_0x2a621f[_0x1a18('0x23')]){if(_0x2a621f[_0x1a18('0x23')][_0x1a18('0x24')]===0x1f4){logger[_0x1a18('0x23')](_0x1a18('0x20'),_0x2785f6,_0x2a621f['error'][_0x1a18('0x25')]);return _0x30baba(_0x2a621f[_0x1a18('0x23')][_0x1a18('0x25')]);}logger[_0x1a18('0x23')](_0x1a18('0x20'),_0x2785f6,_0x2a621f[_0x1a18('0x23')][_0x1a18('0x25')]);return _0x4ef807(_0x2a621f[_0x1a18('0x23')][_0x1a18('0x25')]);}else{logger[_0x1a18('0x1f')](_0x1a18('0x20'),_0x2785f6,_0x1a18('0x21'));_0x4ef807(_0x2a621f[_0x1a18('0x26')][_0x1a18('0x25')]);}})[_0x1a18('0x27')](function(_0x27932b){logger[_0x1a18('0x23')]('ServicenowAccount,\x20%s,\x20%s',_0x2785f6,_0x27932b);_0x30baba(_0x27932b);});});}function respondWithStatusCode(_0x8cebc6,_0x33cef2){_0x33cef2=_0x33cef2||0xcc;return function(_0x1616c9){if(_0x1616c9){return _0x8cebc6[_0x1a18('0x28')](_0x33cef2);}return _0x8cebc6[_0x1a18('0x29')](_0x33cef2)[_0x1a18('0x2a')]();};}function respondWithResult(_0x486294,_0x20425e){_0x20425e=_0x20425e||0xc8;return function(_0x36e016){if(_0x36e016){return _0x486294[_0x1a18('0x29')](_0x20425e)[_0x1a18('0x2b')](_0x36e016);}};}function respondWithFilteredResult(_0x54f60e,_0x3ea0b7){return function(_0x4699ab){if(_0x4699ab){var _0x299277=_0x4699ab[_0x1a18('0x2c')],_0x17776b=_0x3ea0b7[_0x1a18('0x2d')],_0x14c983=_0x3ea0b7[_0x1a18('0x2d')]+_0x3ea0b7[_0x1a18('0x2e')],_0x855cca;if(_0x14c983>=_0x299277){_0x14c983=_0x299277;_0x855cca=0xc8;}else{_0x855cca=0xce;}_0x54f60e[_0x1a18('0x29')](_0x855cca);return _0x54f60e[_0x1a18('0x2f')](_0x1a18('0x30'),_0x17776b+'-'+_0x14c983+'/'+_0x299277)[_0x1a18('0x2b')](_0x4699ab);}return null;};}function patchUpdates(_0x337130){return function(_0x54b624){try{jsonpatch[_0x1a18('0x31')](_0x54b624,_0x337130,!![]);}catch(_0x51fb15){return BPromise[_0x1a18('0x32')](_0x51fb15);}return _0x54b624[_0x1a18('0x33')]();};}function saveUpdates(_0x50e3f3,_0x49dd5f){return function(_0x55cc08){if(_0x55cc08){return _0x55cc08[_0x1a18('0x34')](_0x50e3f3)[_0x1a18('0x35')](function(_0x32bad1){return _0x32bad1;});}return null;};}function removeEntity(_0x24b537,_0x34674c){return function(_0x2b0636){if(_0x2b0636){return _0x2b0636[_0x1a18('0x36')]()[_0x1a18('0x35')](function(){_0x24b537[_0x1a18('0x29')](0xcc)[_0x1a18('0x2a')]();});}};}function handleEntityNotFound(_0x51b7c9,_0x4d5ba3){return function(_0xeb0b1f){if(!_0xeb0b1f){_0x51b7c9[_0x1a18('0x28')](0x194);}return _0xeb0b1f;};}function handleError(_0xaf21f,_0x1b5064){_0x1b5064=_0x1b5064||0x1f4;return function(_0x37c82c){logger['error'](_0x37c82c['stack']);if(_0x37c82c[_0x1a18('0x37')]){delete _0x37c82c[_0x1a18('0x37')];}_0xaf21f[_0x1a18('0x29')](_0x1b5064)[_0x1a18('0x38')](_0x37c82c);};}exports['index']=function(_0x21c6d2,_0x40c1b5){var _0x553ee6={},_0x164522={},_0x5adc6f={'count':0x0,'rows':[]};var _0x3c8ffe=_[_0x1a18('0x39')](db[_0x1a18('0x3a')][_0x1a18('0x3b')],function(_0x2a6f05){return{'name':_0x2a6f05[_0x1a18('0x3c')],'type':_0x2a6f05[_0x1a18('0x3d')][_0x1a18('0x3e')]};});_0x164522[_0x1a18('0x3f')]=_[_0x1a18('0x39')](_0x3c8ffe,_0x1a18('0x37'));_0x164522[_0x1a18('0x40')]=_[_0x1a18('0x41')](_0x21c6d2[_0x1a18('0x40')]);_0x164522[_0x1a18('0x42')]=_['intersection'](_0x164522['model'],_0x164522['query']);_0x553ee6[_0x1a18('0x43')]=_[_0x1a18('0x44')](_0x164522['model'],qs['fields'](_0x21c6d2[_0x1a18('0x40')][_0x1a18('0x45')]));_0x553ee6[_0x1a18('0x43')]=_0x553ee6['attributes'][_0x1a18('0x46')]?_0x553ee6[_0x1a18('0x43')]:_0x164522['model'];if(!_0x21c6d2[_0x1a18('0x40')]['hasOwnProperty'](_0x1a18('0x47'))){_0x553ee6[_0x1a18('0x2e')]=qs[_0x1a18('0x2e')](_0x21c6d2[_0x1a18('0x40')][_0x1a18('0x2e')]);_0x553ee6[_0x1a18('0x2d')]=qs[_0x1a18('0x2d')](_0x21c6d2['query'][_0x1a18('0x2d')]);}_0x553ee6[_0x1a18('0x48')]=qs[_0x1a18('0x49')](_0x21c6d2[_0x1a18('0x40')][_0x1a18('0x49')]);_0x553ee6[_0x1a18('0x4a')]=qs['filters'](_[_0x1a18('0x4b')](_0x21c6d2['query'],_0x164522[_0x1a18('0x42')]),_0x3c8ffe);if(_0x21c6d2['query'][_0x1a18('0x4c')]){_0x553ee6[_0x1a18('0x4a')]=_[_0x1a18('0x4d')](_0x553ee6[_0x1a18('0x4a')],{'$or':_[_0x1a18('0x39')](_0x3c8ffe,function(_0x58f845){if(_0x58f845[_0x1a18('0x3d')]!==_0x1a18('0x4e')){var _0x120fce={};_0x120fce[_0x58f845['name']]={'$like':'%'+_0x21c6d2[_0x1a18('0x40')][_0x1a18('0x4c')]+'%'};return _0x120fce;}})});}_0x553ee6=_[_0x1a18('0x4d')]({},_0x553ee6,_0x21c6d2[_0x1a18('0x4f')]);var _0x590d91={'where':_0x553ee6['where']};return db['ServicenowAccount']['count'](_0x590d91)[_0x1a18('0x35')](function(_0xe4b76e){_0x5adc6f[_0x1a18('0x2c')]=_0xe4b76e;if(_0x21c6d2[_0x1a18('0x40')][_0x1a18('0x50')]){_0x553ee6[_0x1a18('0x51')]=[{'all':!![]}];}return db[_0x1a18('0x3a')][_0x1a18('0x52')](_0x553ee6);})[_0x1a18('0x35')](function(_0x11e3d3){_0x5adc6f[_0x1a18('0x53')]=_0x11e3d3;return _0x5adc6f;})[_0x1a18('0x35')](respondWithFilteredResult(_0x40c1b5,_0x553ee6))[_0x1a18('0x27')](handleError(_0x40c1b5,null));};exports[_0x1a18('0x54')]=function(_0x340660,_0x5434e8){var _0xde94b0={'raw':![],'where':{'id':_0x340660[_0x1a18('0x55')]['id']}},_0x1a301c={};_0x1a301c['model']=_[_0x1a18('0x41')](db['ServicenowAccount'][_0x1a18('0x3b')]);_0x1a301c[_0x1a18('0x40')]=_[_0x1a18('0x41')](_0x340660[_0x1a18('0x40')]);_0x1a301c[_0x1a18('0x42')]=_[_0x1a18('0x44')](_0x1a301c[_0x1a18('0x3f')],_0x1a301c['query']);_0xde94b0[_0x1a18('0x43')]=_[_0x1a18('0x44')](_0x1a301c[_0x1a18('0x3f')],qs['fields'](_0x340660[_0x1a18('0x40')][_0x1a18('0x45')]));_0xde94b0[_0x1a18('0x43')]=_0xde94b0['attributes'][_0x1a18('0x46')]?_0xde94b0[_0x1a18('0x43')]:_0x1a301c[_0x1a18('0x3f')];if(_0x340660[_0x1a18('0x40')]['includeAll']){_0xde94b0[_0x1a18('0x51')]=[{'all':!![]}];}_0xde94b0=_[_0x1a18('0x4d')]({},_0xde94b0,_0x340660[_0x1a18('0x4f')]);return db[_0x1a18('0x3a')]['find'](_0xde94b0)[_0x1a18('0x35')](handleEntityNotFound(_0x5434e8,null))[_0x1a18('0x35')](respondWithResult(_0x5434e8,null))['catch'](handleError(_0x5434e8,null));};exports[_0x1a18('0x56')]=function(_0x557709,_0x48642c){return db[_0x1a18('0x3a')][_0x1a18('0x56')](_0x557709[_0x1a18('0x57')],{})['then'](respondWithResult(_0x48642c,0xc9))[_0x1a18('0x27')](handleError(_0x48642c,null));};exports[_0x1a18('0x34')]=function(_0x5781f0,_0x37aeba){if(_0x5781f0[_0x1a18('0x57')]['id']){delete _0x5781f0[_0x1a18('0x57')]['id'];}return db['ServicenowAccount'][_0x1a18('0x58')]({'where':{'id':_0x5781f0[_0x1a18('0x55')]['id']}})[_0x1a18('0x35')](handleEntityNotFound(_0x37aeba,null))['then'](saveUpdates(_0x5781f0[_0x1a18('0x57')],null))[_0x1a18('0x35')](respondWithResult(_0x37aeba,null))[_0x1a18('0x27')](handleError(_0x37aeba,null));};exports[_0x1a18('0x36')]=function(_0x3bfa4c,_0x375d5f){return db['ServicenowAccount']['find']({'where':{'id':_0x3bfa4c['params']['id']}})[_0x1a18('0x35')](handleEntityNotFound(_0x375d5f,null))['then'](removeEntity(_0x375d5f,null))[_0x1a18('0x27')](handleError(_0x375d5f,null));};exports['getConfigurations']=function(_0x249d5b,_0x6df303,_0xfd9aa8){var _0x497898={};var _0x1df3b8={};var _0x17150c;var _0x4c2210;return db[_0x1a18('0x3a')]['findOne']({'where':{'id':_0x249d5b[_0x1a18('0x55')]['id']}})[_0x1a18('0x35')](handleEntityNotFound(_0x6df303,null))[_0x1a18('0x35')](function(_0x2c9a72){if(_0x2c9a72){_0x17150c=_0x2c9a72;_0x1df3b8[_0x1a18('0x3f')]=_[_0x1a18('0x41')](db[_0x1a18('0x59')]['rawAttributes']);_0x1df3b8['query']=_[_0x1a18('0x41')](_0x249d5b[_0x1a18('0x40')]);_0x1df3b8[_0x1a18('0x42')]=_[_0x1a18('0x44')](_0x1df3b8['model'],_0x1df3b8[_0x1a18('0x40')]);_0x497898['attributes']=_[_0x1a18('0x44')](_0x1df3b8[_0x1a18('0x3f')],qs['fields'](_0x249d5b[_0x1a18('0x40')][_0x1a18('0x45')]));_0x497898[_0x1a18('0x43')]=_0x497898[_0x1a18('0x43')][_0x1a18('0x46')]?_0x497898[_0x1a18('0x43')]:_0x1df3b8[_0x1a18('0x3f')];_0x497898[_0x1a18('0x48')]=qs[_0x1a18('0x49')](_0x249d5b['query'][_0x1a18('0x49')]);_0x497898[_0x1a18('0x4a')]=qs['filters'](_[_0x1a18('0x4b')](_0x249d5b['query'],_0x1df3b8[_0x1a18('0x42')]));if(_0x249d5b[_0x1a18('0x40')]['filter']){_0x497898[_0x1a18('0x4a')]=_['merge'](_0x497898[_0x1a18('0x4a')],{'$or':_[_0x1a18('0x39')](_0x497898[_0x1a18('0x43')],function(_0x5d352c){var _0x27a8d2={};_0x27a8d2[_0x5d352c]={'$like':'%'+_0x249d5b[_0x1a18('0x40')][_0x1a18('0x4c')]+'%'};return _0x27a8d2;})});}_0x497898=_[_0x1a18('0x4d')]({},_0x497898,_0x249d5b[_0x1a18('0x4f')]);return _0x17150c['getConfigurations'](_0x497898);}})['then'](function(_0x198aa8){if(_0x198aa8){_0x4c2210=_0x198aa8[_0x1a18('0x46')];if(!_0x249d5b['query'][_0x1a18('0x5a')]('nolimit')){_0x497898[_0x1a18('0x2e')]=qs['limit'](_0x249d5b[_0x1a18('0x40')][_0x1a18('0x2e')]);_0x497898['offset']=qs[_0x1a18('0x2d')](_0x249d5b[_0x1a18('0x40')][_0x1a18('0x2d')]);}return _0x17150c[_0x1a18('0x5b')](_0x497898);}})['then'](function(_0x482096){if(_0x482096){return _0x482096?{'count':_0x4c2210,'rows':_0x482096}:null;}})['then'](respondWithResult(_0x6df303,null))[_0x1a18('0x27')](handleError(_0x6df303,null));};exports[_0x1a18('0x5c')]=function(_0x3c0eec,_0x3ff56e,_0x45ae21){if(_0x3c0eec[_0x1a18('0x57')]['id']){delete _0x3c0eec[_0x1a18('0x57')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x3c0eec[_0x1a18('0x55')]['id']}})[_0x1a18('0x35')](handleEntityNotFound(_0x3ff56e,null))[_0x1a18('0x35')](function(_0x320db1){if(_0x320db1){_0x3c0eec[_0x1a18('0x57')][_0x1a18('0x5d')]=_0x320db1['id'];_0x3c0eec['body'][_0x1a18('0x5e')]=integrations['getSubjects'](_0x3c0eec[_0x1a18('0x57')]['channel'],_0x3c0eec[_0x1a18('0x57')]['type']);_0x3c0eec['body'][_0x1a18('0x5f')]=integrations[_0x1a18('0x60')](_0x3c0eec[_0x1a18('0x57')][_0x1a18('0x61')],_0x3c0eec[_0x1a18('0x57')][_0x1a18('0x3d')]);return db['ServicenowConfiguration'][_0x1a18('0x56')](_0x3c0eec[_0x1a18('0x57')],{'include':[{'model':db[_0x1a18('0x62')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x1a18('0x5f')}]});}return null;})[_0x1a18('0x35')](respondWithResult(_0x3ff56e,null))[_0x1a18('0x27')](handleError(_0x3ff56e,null));};exports[_0x1a18('0x63')]=function(_0x217472,_0x45ef82,_0x1a0bd9){var _0x56450f=[_0x1a18('0x64'),_0x1a18('0x65'),_0x1a18('0x66'),_0x1a18('0x67'),_0x1a18('0x68'),_0x1a18('0x69'),_0x1a18('0x6a'),_0x1a18('0x6b'),_0x1a18('0x6c')];var _0x1ea9bd=[_0x1a18('0x6d'),'made_sla','caused_by',_0x1a18('0x6e'),_0x1a18('0x6f'),'sys_updated_on','child_incidents',_0x1a18('0x65'),_0x1a18('0x70'),_0x1a18('0x71'),_0x1a18('0x72'),_0x1a18('0x73'),_0x1a18('0x74'),'user_input',_0x1a18('0x75'),'sys_domain',_0x1a18('0x76'),_0x1a18('0x77'),_0x1a18('0x66'),_0x1a18('0x48'),_0x1a18('0x78'),_0x1a18('0x79'),_0x1a18('0x7a'),_0x1a18('0x7b'),_0x1a18('0x7c'),_0x1a18('0x7d'),'work_notes_list',_0x1a18('0x7e'),_0x1a18('0x7f'),_0x1a18('0x80'),_0x1a18('0x81'),_0x1a18('0x82'),'expected_start',_0x1a18('0x83'),_0x1a18('0x84'),_0x1a18('0x85'),_0x1a18('0x86'),_0x1a18('0x87'),_0x1a18('0x88'),'caller_id',_0x1a18('0x89'),_0x1a18('0x67'),'work_notes',_0x1a18('0x8a'),_0x1a18('0x68'),_0x1a18('0x8b'),'delivery_task',_0x1a18('0x8c'),_0x1a18('0x8d'),_0x1a18('0x8e'),_0x1a18('0x8f'),_0x1a18('0x90'),'calendar_duration',_0x1a18('0x69'),_0x1a18('0x91'),_0x1a18('0x92'),_0x1a18('0x93'),_0x1a18('0x94'),_0x1a18('0x95'),_0x1a18('0x96'),_0x1a18('0x97'),_0x1a18('0x98'),'incident_state',_0x1a18('0x99'),_0x1a18('0x9a'),'company',_0x1a18('0x9b'),_0x1a18('0x9c'),_0x1a18('0x9d'),'severity',_0x1a18('0x9e'),_0x1a18('0x9f'),_0x1a18('0xa0'),_0x1a18('0xa1'),_0x1a18('0xa2'),_0x1a18('0xa3'),_0x1a18('0xa4'),'sys_tags','escalation',_0x1a18('0xa5'),_0x1a18('0xa6'),_0x1a18('0xa7'),_0x1a18('0x6c')];var _0x192d4c='';var _0x456720='';var _0x327aa7=[];var _0x40781f='';var _0x14ee96='';var _0x477031=[];var _0x2316e8='';var _0x587e3c='';var _0x7a4d72={};var _0xc5a0af='';return db['ServicenowAccount'][_0x1a18('0xa8')]({'where':{'id':_0x217472[_0x1a18('0x55')]['id']},'attributes':['id',_0x1a18('0xa9'),_0x1a18('0xaa'),_0x1a18('0xab'),'remoteUri',_0x1a18('0xac')]})[_0x1a18('0x35')](handleEntityNotFound(_0x45ef82,null))[_0x1a18('0x35')](function(_0x36837b){if(_0x36837b){_0xc5a0af=_0x36837b[_0x1a18('0xad')];var _0x5eb1a5=_0xc5a0af[_0x1a18('0xae')](-0x1);if(_0x5eb1a5==='/'){_0xc5a0af=_0xc5a0af['substring'](0x0,_0xc5a0af[_0x1a18('0xaf')](_0x5eb1a5));}_0x587e3c=util[_0x1a18('0xb0')](_0x1a18('0xb1'),_0xc5a0af);_0x2316e8=util[_0x1a18('0xb0')](_0x1a18('0xb2'),_0xc5a0af);_0x7a4d72={'user':_0x36837b[_0x1a18('0xa9')],'pass':_0x36837b[_0x1a18('0xaa')]};var _0x14a95e={'method':_0x1a18('0xb3'),'uri':_0x587e3c+_0x1a18('0xb4'),'auth':_0x7a4d72,'json':!![]};return rp(_0x14a95e);}})[_0x1a18('0x35')](function(_0x4f59e2){if(_0x4f59e2['result'][_0x1a18('0x46')]>0x0){_0x192d4c=_0x4f59e2[_0x1a18('0x26')];}console[_0x1a18('0xb5')](_0x1a18('0xb6'),_0x192d4c);_0x477031=[];_0x456720=Object[_0x1a18('0xb7')]([],_0x192d4c);_[_0x1a18('0xb8')](_0x456720,function(_0x2cdb5b){return!_0x56450f[_0x1a18('0xb9')](_0x2cdb5b[_0x1a18('0x37')]);});_0x456720[_0x1a18('0xba')](function(_0x5159e9){var _0x5e21e5=createFieldObject(_0x2316e8,_0x7a4d72,_0x5159e9[_0x1a18('0xbb')],_0x5159e9[_0x1a18('0x37')],_0x5159e9[_0x1a18('0xbc')],![]);_0x477031[_0x1a18('0xbd')](_0x5e21e5);});return Promise[_0x1a18('0xbe')](_0x477031);})[_0x1a18('0x35')](function(_0x5bd0f0){_0x327aa7=_0x5bd0f0;_0x40781f=Object[_0x1a18('0xb7')]([],_0x192d4c);console[_0x1a18('0xb5')](_0x1a18('0xbf'),_0x192d4c);_[_0x1a18('0xb8')](_0x40781f,function(_0x380b7f){return _0x1ea9bd[_0x1a18('0xb9')](_0x380b7f[_0x1a18('0x37')]);});console[_0x1a18('0xb5')](_0x1a18('0xc0'),_0x40781f);_0x477031=[];_0x40781f[_0x1a18('0xba')](function(_0x7b3f11){var _0x2f969d=createFieldObject(_0x2316e8,_0x7a4d72,_0x7b3f11['internalType'],_0x7b3f11[_0x1a18('0x37')],_0x7b3f11[_0x1a18('0xbc')],!![]);_0x477031[_0x1a18('0xbd')](_0x2f969d);});return Promise[_0x1a18('0xbe')](_0x477031);})[_0x1a18('0x35')](function(_0x36eb21){_0x14ee96=_0x36eb21;var _0x1767cc=_0x327aa7[_0x1a18('0xc1')](_0x14ee96);return{'count':_0x1767cc['length'],'rows':_0x1767cc};})[_0x1a18('0x35')](respondWithResult(_0x45ef82,null))[_0x1a18('0x27')](function(_0x30f3a5){console['log'](_0x1a18('0xc2')+_0x30f3a5);var _0x402131=_0x217472[_0x1a18('0x40')]['test']?0x1f4:_0x30f3a5[_0x1a18('0xc3')]||0x1f4;logger[_0x1a18('0x23')](_0x30f3a5[_0x1a18('0xc4')]);delete _0x30f3a5[_0x1a18('0x37')];if(_0x402131===0x191){_0x402131=0x190;}_0x45ef82[_0x1a18('0x29')](_0x402131)[_0x1a18('0x38')](_0x217472['query'][_0x1a18('0xc5')]?{'message':_0x1a18('0xc6'),'statusCode':_0x30f3a5[_0x1a18('0xc3')]}:_0x30f3a5);});};function createFieldObject(_0x2d92c5,_0x1ffc83,_0x563326,_0x3f59ed,_0x1402db,_0x1de266){return new Promise(function(_0x398241,_0x4791ef){var _0xd61bc={'id':_0x3f59ed,'name':_0x1402db,'custom':_0x1de266};if(_0x563326===_0x1a18('0xc7')){_0xd61bc['options']=[{'name':_0x1a18('0xc8'),'value':_0x1a18('0xc9')},{'name':_0x1a18('0xca'),'value':_0x1a18('0xcb')}];_0x398241(_0xd61bc);}else{var _0x349ab0={'method':_0x1a18('0xb3'),'uri':_0x2d92c5+_0x1a18('0xcc')+_0x3f59ed,'auth':_0x1ffc83,'json':!![]};return rp(_0x349ab0)[_0x1a18('0x35')](function(_0x15b83e){var _0x182ab2=[];if(_0x15b83e[_0x1a18('0x26')]['length']>0x0){_0x15b83e['result']['forEach'](function(_0x1dcd63){if(_0x1dcd63['inactive']===_0x1a18('0xcb')){var _0x5b024c={'name':_0x1dcd63['label'],'value':_0x1dcd63[_0x1a18('0xcd')]};_0x182ab2['push'](_0x5b024c);}});}_0xd61bc[_0x1a18('0x4f')]=_0x182ab2;if(_0xd61bc[_0x1a18('0x4f')]['length']>0x0){_0x398241(_0xd61bc);}else{if(_0x1de266==![]){_0x398241();}else{_0x398241(_0xd61bc);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 92104a2..9cb3903 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 _0xb6a8=['define','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x52ec59,_0x401f6b){var _0x3085f0=function(_0x136de2){while(--_0x136de2){_0x52ec59['push'](_0x52ec59['shift']());}};_0x3085f0(++_0x401f6b);}(_0xb6a8,0xe7));var _0x8b6a=function(_0xc2cb69,_0x1d9101){_0xc2cb69=_0xc2cb69-0x0;var _0x19eeea=_0xb6a8[_0xc2cb69];return _0x19eeea;};'use strict';var _=require(_0x8b6a('0x0'));var util=require(_0x8b6a('0x1'));var logger=require(_0x8b6a('0x2'))('api');var moment=require(_0x8b6a('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b6a('0x4'));var fs=require('fs');var path=require(_0x8b6a('0x5'));var rimraf=require('rimraf');var config=require(_0x8b6a('0x6'));var attributes=require(_0x8b6a('0x7'));var integrations=require(_0x8b6a('0x8'));module['exports']=function(_0x511e85,_0x4b33f5){return _0x511e85[_0x8b6a('0x9')]('ServicenowAccount',attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f06=['rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','ServicenowAccount','lodash','util','moment','bluebird','request-promise'];(function(_0x36f76c,_0x111a33){var _0x14c483=function(_0x49062c){while(--_0x49062c){_0x36f76c['push'](_0x36f76c['shift']());}};_0x14c483(++_0x111a33);}(_0x1f06,0xb8));var _0x61f0=function(_0x18124a,_0x3d13a7){_0x18124a=_0x18124a-0x0;var _0x50262f=_0x1f06[_0x18124a];return _0x50262f;};'use strict';var _=require(_0x61f0('0x0'));var util=require(_0x61f0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x61f0('0x2'));var BPromise=require(_0x61f0('0x3'));var rp=require(_0x61f0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61f0('0x5'));var config=require('../../config/environment');var attributes=require(_0x61f0('0x6'));var integrations=require(_0x61f0('0x7'));module['exports']=function(_0x4322db,_0x292cc4){return _0x4322db['define'](_0x61f0('0x8'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index f27fd37..1b932a6 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 _0x06cd=['find','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','include','model','attributes','map','ShowServicenowAccount'];(function(_0x7d1996,_0x54c85b){var _0x38f3ad=function(_0x1ea531){while(--_0x1ea531){_0x7d1996['push'](_0x7d1996['shift']());}};_0x38f3ad(++_0x54c85b);}(_0x06cd,0x18d));var _0xd06c=function(_0x114b0e,_0x1956db){_0x114b0e=_0x114b0e-0x0;var _0x124c90=_0x06cd[_0x114b0e];return _0x124c90;};'use strict';var _=require(_0xd06c('0x0'));var util=require(_0xd06c('0x1'));var moment=require(_0xd06c('0x2'));var BPromise=require(_0xd06c('0x3'));var rs=require(_0xd06c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd06c('0x5'))('rpc');var config=require(_0xd06c('0x6'));var jayson=require(_0xd06c('0x7'));var client=jayson[_0xd06c('0x8')][_0xd06c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38205d,_0x2bc8b7,_0x12ef25){return new BPromise(function(_0x2f2158,_0xd27410){return client['request'](_0x38205d,_0x12ef25)[_0xd06c('0xa')](function(_0x31c52b){logger[_0xd06c('0xb')](_0xd06c('0xc'),_0x2bc8b7,_0xd06c('0xd'));logger[_0xd06c('0xe')](_0xd06c('0xf'),_0x2bc8b7,_0xd06c('0xd'),JSON[_0xd06c('0x10')](_0x31c52b));if(_0x31c52b[_0xd06c('0x11')]){if(_0x31c52b['error'][_0xd06c('0x12')]===0x1f4){logger[_0xd06c('0x11')](_0xd06c('0xc'),_0x2bc8b7,_0x31c52b[_0xd06c('0x11')][_0xd06c('0x13')]);return _0xd27410(_0x31c52b[_0xd06c('0x11')][_0xd06c('0x13')]);}logger['error'](_0xd06c('0xc'),_0x2bc8b7,_0x31c52b[_0xd06c('0x11')][_0xd06c('0x13')]);return _0x2f2158(_0x31c52b[_0xd06c('0x11')]['message']);}else{logger[_0xd06c('0xb')](_0xd06c('0xc'),_0x2bc8b7,_0xd06c('0xd'));_0x2f2158(_0x31c52b['result'][_0xd06c('0x13')]);}})[_0xd06c('0x14')](function(_0x298ea5){logger[_0xd06c('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2bc8b7,_0x298ea5);_0xd27410(_0x298ea5);});});}exports[_0xd06c('0x15')]=function(_0x41e60c){var _0x3e7464=this;return new Promise(function(_0x358a43,_0x17b37d){return db[_0xd06c('0x16')]['findAll']({'raw':_0x41e60c[_0xd06c('0x17')]?_0x41e60c[_0xd06c('0x17')][_0xd06c('0x18')]===undefined?!![]:![]:!![],'where':_0x41e60c['options']?_0x41e60c[_0xd06c('0x17')][_0xd06c('0x19')]||null:null,'attributes':_0x41e60c[_0xd06c('0x17')]?_0x41e60c[_0xd06c('0x17')]['attributes']||null:null,'limit':_0x41e60c[_0xd06c('0x17')]?_0x41e60c[_0xd06c('0x17')][_0xd06c('0x1a')]||null:null,'include':_0x41e60c[_0xd06c('0x17')]?_0x41e60c[_0xd06c('0x17')][_0xd06c('0x1b')]?_['map'](_0x41e60c[_0xd06c('0x17')]['include'],function(_0x249b19){return{'model':db[_0x249b19[_0xd06c('0x1c')]],'as':_0x249b19['as'],'attributes':_0x249b19[_0xd06c('0x1d')],'include':_0x249b19[_0xd06c('0x1b')]?_[_0xd06c('0x1e')](_0x249b19[_0xd06c('0x1b')],function(_0x8c0926){return{'model':db[_0x8c0926[_0xd06c('0x1c')]],'as':_0x8c0926['as'],'attributes':_0x8c0926[_0xd06c('0x1d')],'include':_0x8c0926[_0xd06c('0x1b')]?_[_0xd06c('0x1e')](_0x8c0926[_0xd06c('0x1b')],function(_0x17071a){return{'model':db[_0x17071a['model']],'as':_0x17071a['as'],'attributes':_0x17071a[_0xd06c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd06c('0xa')](function(_0x5f4dca){logger[_0xd06c('0xb')](_0xd06c('0x15'),_0x41e60c);logger['debug'](_0xd06c('0x15'),_0x41e60c,JSON[_0xd06c('0x10')](_0x5f4dca));_0x358a43(_0x5f4dca);})[_0xd06c('0x14')](function(_0x10b0bc){logger[_0xd06c('0x11')](_0xd06c('0x15'),_0x10b0bc[_0xd06c('0x13')],_0x41e60c);_0x17b37d(_0x3e7464['error'](0x1f4,_0x10b0bc[_0xd06c('0x13')]));});});};exports[_0xd06c('0x1f')]=function(_0x28c7fb){var _0x109941=this;return new Promise(function(_0xa13699,_0x2893ba){return db['ServicenowAccount'][_0xd06c('0x20')]({'raw':_0x28c7fb[_0xd06c('0x17')]?_0x28c7fb[_0xd06c('0x17')][_0xd06c('0x18')]===undefined?!![]:![]:!![],'where':_0x28c7fb['options']?_0x28c7fb[_0xd06c('0x17')]['where']||null:null,'attributes':_0x28c7fb[_0xd06c('0x17')]?_0x28c7fb[_0xd06c('0x17')][_0xd06c('0x1d')]||null:null,'include':_0x28c7fb['options']?_0x28c7fb[_0xd06c('0x17')]['include']?_[_0xd06c('0x1e')](_0x28c7fb[_0xd06c('0x17')]['include'],function(_0x28b272){return{'model':db[_0x28b272[_0xd06c('0x1c')]],'as':_0x28b272['as'],'attributes':_0x28b272[_0xd06c('0x1d')],'include':_0x28b272[_0xd06c('0x1b')]?_[_0xd06c('0x1e')](_0x28b272[_0xd06c('0x1b')],function(_0x1315d4){return{'model':db[_0x1315d4['model']],'as':_0x1315d4['as'],'attributes':_0x1315d4['attributes'],'include':_0x1315d4[_0xd06c('0x1b')]?_['map'](_0x1315d4[_0xd06c('0x1b')],function(_0x5b8cf9){return{'model':db[_0x5b8cf9['model']],'as':_0x5b8cf9['as'],'attributes':_0x5b8cf9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd06c('0xa')](function(_0x262397){logger['info'](_0xd06c('0x1f'),_0x28c7fb);logger['debug'](_0xd06c('0x1f'),_0x28c7fb,JSON[_0xd06c('0x10')](_0x262397));_0xa13699(_0x262397);})[_0xd06c('0x14')](function(_0xa2904c){logger[_0xd06c('0x11')](_0xd06c('0x1f'),_0xa2904c[_0xd06c('0x13')],_0x28c7fb);_0x2893ba(_0x109941[_0xd06c('0x11')](0x1f4,_0xa2904c[_0xd06c('0x13')]));});});}; \ No newline at end of file +var _0xc5df=['ServicenowAccount,\x20%s,\x20%s','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2c3287,_0x36e2ef){var _0xdeed9e=function(_0x290165){while(--_0x290165){_0x2c3287['push'](_0x2c3287['shift']());}};_0xdeed9e(++_0x36e2ef);}(_0xc5df,0x1b3));var _0xfc5d=function(_0x20cb0e,_0x4cd0f7){_0x20cb0e=_0x20cb0e-0x0;var _0x8be3e5=_0xc5df[_0x20cb0e];return _0x8be3e5;};'use strict';var _=require(_0xfc5d('0x0'));var util=require(_0xfc5d('0x1'));var moment=require(_0xfc5d('0x2'));var BPromise=require(_0xfc5d('0x3'));var rs=require(_0xfc5d('0x4'));var fs=require('fs');var Redis=require(_0xfc5d('0x5'));var db=require(_0xfc5d('0x6'))['db'];var utils=require(_0xfc5d('0x7'));var logger=require(_0xfc5d('0x8'))(_0xfc5d('0x9'));var config=require('../../config/environment');var jayson=require(_0xfc5d('0xa'));var client=jayson[_0xfc5d('0xb')][_0xfc5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xea662b,_0x21f4ce,_0x10a318){return new BPromise(function(_0x5a7be4,_0x1283af){return client[_0xfc5d('0xd')](_0xea662b,_0x10a318)[_0xfc5d('0xe')](function(_0x39096d){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x21f4ce,_0xfc5d('0xf'));logger[_0xfc5d('0x10')](_0xfc5d('0x11'),_0x21f4ce,_0xfc5d('0xf'),JSON[_0xfc5d('0x12')](_0x39096d));if(_0x39096d[_0xfc5d('0x13')]){if(_0x39096d[_0xfc5d('0x13')][_0xfc5d('0x14')]===0x1f4){logger[_0xfc5d('0x13')](_0xfc5d('0x15'),_0x21f4ce,_0x39096d['error'][_0xfc5d('0x16')]);return _0x1283af(_0x39096d[_0xfc5d('0x13')][_0xfc5d('0x16')]);}logger[_0xfc5d('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x21f4ce,_0x39096d['error'][_0xfc5d('0x16')]);return _0x5a7be4(_0x39096d[_0xfc5d('0x13')][_0xfc5d('0x16')]);}else{logger[_0xfc5d('0x17')](_0xfc5d('0x15'),_0x21f4ce,_0xfc5d('0xf'));_0x5a7be4(_0x39096d['result'][_0xfc5d('0x16')]);}})[_0xfc5d('0x18')](function(_0x4d805d){logger['error'](_0xfc5d('0x15'),_0x21f4ce,_0x4d805d);_0x1283af(_0x4d805d);});});}exports[_0xfc5d('0x19')]=function(_0x2d0e5a){var _0x577055=this;return new Promise(function(_0x17fc1a,_0x3bb8a9){return db[_0xfc5d('0x1a')][_0xfc5d('0x1b')]({'raw':_0x2d0e5a[_0xfc5d('0x1c')]?_0x2d0e5a['options'][_0xfc5d('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d0e5a[_0xfc5d('0x1c')]?_0x2d0e5a[_0xfc5d('0x1c')][_0xfc5d('0x1e')]||null:null,'attributes':_0x2d0e5a[_0xfc5d('0x1c')]?_0x2d0e5a[_0xfc5d('0x1c')]['attributes']||null:null,'limit':_0x2d0e5a['options']?_0x2d0e5a[_0xfc5d('0x1c')][_0xfc5d('0x1f')]||null:null,'include':_0x2d0e5a[_0xfc5d('0x1c')]?_0x2d0e5a[_0xfc5d('0x1c')][_0xfc5d('0x20')]?_['map'](_0x2d0e5a[_0xfc5d('0x1c')][_0xfc5d('0x20')],function(_0x38f469){return{'model':db[_0x38f469[_0xfc5d('0x21')]],'as':_0x38f469['as'],'attributes':_0x38f469[_0xfc5d('0x22')],'include':_0x38f469['include']?_[_0xfc5d('0x23')](_0x38f469[_0xfc5d('0x20')],function(_0x1996d8){return{'model':db[_0x1996d8[_0xfc5d('0x21')]],'as':_0x1996d8['as'],'attributes':_0x1996d8[_0xfc5d('0x22')],'include':_0x1996d8[_0xfc5d('0x20')]?_[_0xfc5d('0x23')](_0x1996d8[_0xfc5d('0x20')],function(_0x560b86){return{'model':db[_0x560b86[_0xfc5d('0x21')]],'as':_0x560b86['as'],'attributes':_0x560b86[_0xfc5d('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfc5d('0xe')](function(_0x7f1894){logger[_0xfc5d('0x17')]('GetServicenowAccount',_0x2d0e5a);logger[_0xfc5d('0x10')](_0xfc5d('0x19'),_0x2d0e5a,JSON['stringify'](_0x7f1894));_0x17fc1a(_0x7f1894);})[_0xfc5d('0x18')](function(_0x48e329){logger[_0xfc5d('0x13')]('GetServicenowAccount',_0x48e329['message'],_0x2d0e5a);_0x3bb8a9(_0x577055[_0xfc5d('0x13')](0x1f4,_0x48e329[_0xfc5d('0x16')]));});});};exports[_0xfc5d('0x24')]=function(_0x103968){var _0x286def=this;return new Promise(function(_0x2263e7,_0x527bd0){return db[_0xfc5d('0x1a')][_0xfc5d('0x25')]({'raw':_0x103968[_0xfc5d('0x1c')]?_0x103968[_0xfc5d('0x1c')][_0xfc5d('0x1d')]===undefined?!![]:![]:!![],'where':_0x103968[_0xfc5d('0x1c')]?_0x103968[_0xfc5d('0x1c')][_0xfc5d('0x1e')]||null:null,'attributes':_0x103968[_0xfc5d('0x1c')]?_0x103968[_0xfc5d('0x1c')][_0xfc5d('0x22')]||null:null,'include':_0x103968[_0xfc5d('0x1c')]?_0x103968[_0xfc5d('0x1c')][_0xfc5d('0x20')]?_[_0xfc5d('0x23')](_0x103968[_0xfc5d('0x1c')][_0xfc5d('0x20')],function(_0x3bde51){return{'model':db[_0x3bde51['model']],'as':_0x3bde51['as'],'attributes':_0x3bde51[_0xfc5d('0x22')],'include':_0x3bde51['include']?_[_0xfc5d('0x23')](_0x3bde51[_0xfc5d('0x20')],function(_0x171320){return{'model':db[_0x171320[_0xfc5d('0x21')]],'as':_0x171320['as'],'attributes':_0x171320[_0xfc5d('0x22')],'include':_0x171320['include']?_['map'](_0x171320[_0xfc5d('0x20')],function(_0x16cc28){return{'model':db[_0x16cc28[_0xfc5d('0x21')]],'as':_0x16cc28['as'],'attributes':_0x16cc28['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc5d('0xe')](function(_0x1b53df){logger[_0xfc5d('0x17')](_0xfc5d('0x24'),_0x103968);logger['debug'](_0xfc5d('0x24'),_0x103968,JSON['stringify'](_0x1b53df));_0x2263e7(_0x1b53df);})[_0xfc5d('0x18')](function(_0x1cee5e){logger['error'](_0xfc5d('0x24'),_0x1cee5e['message'],_0x103968);_0x527bd0(_0x286def[_0xfc5d('0x13')](0x1f4,_0x1cee5e[_0xfc5d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index fa2837f..2c338f5 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 _0xc449=['create','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5d880e,_0x52fb62){var _0x2dc29d=function(_0x31c082){while(--_0x31c082){_0x5d880e['push'](_0x5d880e['shift']());}};_0x2dc29d(++_0x52fb62);}(_0xc449,0x1cf));var _0x9c44=function(_0x2d1111,_0x28957e){_0x2d1111=_0x2d1111-0x0;var _0x4c2935=_0xc449[_0x2d1111];return _0x4c2935;};'use strict';var multer=require(_0x9c44('0x0'));var util=require('util');var path=require(_0x9c44('0x1'));var timeout=require(_0x9c44('0x2'));var express=require(_0x9c44('0x3'));var router=express[_0x9c44('0x4')]();var auth=require(_0x9c44('0x5'));var interaction=require(_0x9c44('0x6'));var config=require('../../config/environment');var controller=require(_0x9c44('0x7'));router[_0x9c44('0x8')]('/',auth[_0x9c44('0x9')](),controller[_0x9c44('0xa')]);router[_0x9c44('0x8')](_0x9c44('0xb'),auth[_0x9c44('0x9')](),controller[_0x9c44('0xc')]);router[_0x9c44('0x8')]('/:id/fields',auth[_0x9c44('0x9')](),controller['getFields']);router['get'](_0x9c44('0xd'),auth['isAuthenticated'](),controller[_0x9c44('0xe')]);router[_0x9c44('0x8')](_0x9c44('0xf'),auth['isAuthenticated'](),controller[_0x9c44('0x10')]);router['post']('/',auth[_0x9c44('0x9')](),controller[_0x9c44('0x11')]);router['put'](_0x9c44('0xb'),auth[_0x9c44('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9c44('0x12')]);module[_0x9c44('0x13')]=router; \ No newline at end of file +var _0xf03c=['util','path','express','Router','../../components/auth/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','post','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf03c,0x1c1));var _0xcf03=function(_0x2d9c65,_0x59b62e){_0x2d9c65=_0x2d9c65-0x0;var _0x56118a=_0xf03c[_0x2d9c65];return _0x56118a;};'use strict';var multer=require(_0xcf03('0x0'));var util=require(_0xcf03('0x1'));var path=require(_0xcf03('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf03('0x3'));var router=express[_0xcf03('0x4')]();var auth=require(_0xcf03('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcf03('0x6'));router[_0xcf03('0x7')]('/',auth['isAuthenticated'](),controller[_0xcf03('0x8')]);router[_0xcf03('0x7')](_0xcf03('0x9'),auth[_0xcf03('0xa')](),controller[_0xcf03('0xb')]);router['get']('/:id/fields',auth[_0xcf03('0xa')](),controller[_0xcf03('0xc')]);router[_0xcf03('0x7')](_0xcf03('0xd'),auth[_0xcf03('0xa')](),controller[_0xcf03('0xe')]);router[_0xcf03('0x7')]('/:id/descriptions',auth[_0xcf03('0xa')](),controller['getDescriptions']);router[_0xcf03('0xf')]('/',auth[_0xcf03('0xa')](),controller['create']);router['put'](_0xcf03('0x9'),auth[_0xcf03('0xa')](),controller['update']);router[_0xcf03('0x10')](_0xcf03('0x9'),auth[_0xcf03('0xa')](),controller['destroy']);module[_0xcf03('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index bf64d72..6b05b55 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 _0x9e82=['sequelize','exports','STRING'];(function(_0x7edac9,_0x4cae54){var _0x1236df=function(_0x5ce173){while(--_0x5ce173){_0x7edac9['push'](_0x7edac9['shift']());}};_0x1236df(++_0x4cae54);}(_0x9e82,0x159));var _0x29e8=function(_0x3c7cea,_0xbe550c){_0x3c7cea=_0x3c7cea-0x0;var _0x3d4442=_0x9e82[_0x3c7cea];return _0x3d4442;};'use strict';var Sequelize=require(_0x29e8('0x0'));module[_0x29e8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29e8('0x2')]}}; \ No newline at end of file +var _0x1d48=['exports','STRING'];(function(_0x1d7d0a,_0x4fc899){var _0x163fce=function(_0x5791ab){while(--_0x5791ab){_0x1d7d0a['push'](_0x1d7d0a['shift']());}};_0x163fce(++_0x4fc899);}(_0x1d48,0x1d6));var _0x81d4=function(_0xbdc673,_0x4a2d16){_0xbdc673=_0xbdc673-0x0;var _0x383eb9=_0x1d48[_0xbdc673];return _0x383eb9;};'use strict';var Sequelize=require('sequelize');module[_0x81d4('0x0')]={'name':{'type':Sequelize[_0x81d4('0x1')]},'description':{'type':Sequelize[_0x81d4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 40e4ef6..1f7824a 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 _0x6f7a=['../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','request','then','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','destroy','getFields','findOne','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x362eac,_0x4c6703){_0x362eac=_0x362eac-0x0;var _0x593567=_0x6f7a[_0x362eac];return _0x593567;};'use strict';var pdf=require(_0xa6f7('0x0'));var emlformat=require(_0xa6f7('0x1'));var rimraf=require(_0xa6f7('0x2'));var zipdir=require(_0xa6f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6f7('0x4'));var moment=require(_0xa6f7('0x5'));var BPromise=require(_0xa6f7('0x6'));var Mustache=require(_0xa6f7('0x7'));var util=require(_0xa6f7('0x8'));var path=require(_0xa6f7('0x9'));var sox=require(_0xa6f7('0xa'));var csv=require(_0xa6f7('0xb'));var ejs=require(_0xa6f7('0xc'));var fs=require('fs');var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xb'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var db=require(_0xa6f7('0x17'))['db'];var jayson=require(_0xa6f7('0x18'));var client=jayson[_0xa6f7('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3fc7f1,_0x532352,_0x25b48f){if(_0x25b48f){var _0x68fd8a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x68fd8a[_0xa6f7('0x1a')](_0x532352)){return _0x3fc7f1;}else{throw new db['Sequelize'][(_0xa6f7('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 _0x3fc7f1;}}function respondWithRpcPromise(_0x41bc4d,_0x57308a,_0x17b814,_0x17f9c5){return new BPromise(function(_0x6efd38,_0x47e664){var _0xdb37e2=_0x17f9c5||client;return _0xdb37e2[_0xa6f7('0x1c')](_0x41bc4d,_0x17b814)[_0xa6f7('0x1d')](function(_0x2401b9){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x57308a,_0xa6f7('0x1e'));logger['debug'](_0xa6f7('0x1f'),_0x57308a,_0xa6f7('0x1e'),JSON['stringify'](_0x2401b9));if(_0x2401b9[_0xa6f7('0x20')]){if(_0x2401b9[_0xa6f7('0x20')][_0xa6f7('0x21')]===0x1f4){logger[_0xa6f7('0x20')](_0xa6f7('0x22'),_0x57308a,_0x2401b9[_0xa6f7('0x20')]['message']);return _0x47e664(_0x2401b9[_0xa6f7('0x20')][_0xa6f7('0x23')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x57308a,_0x2401b9['error'][_0xa6f7('0x23')]);return _0x6efd38(_0x2401b9[_0xa6f7('0x20')]['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x57308a,_0xa6f7('0x1e'));_0x6efd38(_0x2401b9[_0xa6f7('0x24')][_0xa6f7('0x23')]);}})['catch'](function(_0x484874){logger[_0xa6f7('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x57308a,_0x484874);_0x47e664(_0x484874);});});}function respondWithStatusCode(_0x47ef97,_0x402d25){_0x402d25=_0x402d25||0xcc;return function(_0x5efdce){if(_0x5efdce){return _0x47ef97[_0xa6f7('0x25')](_0x402d25);}return _0x47ef97[_0xa6f7('0x26')](_0x402d25)[_0xa6f7('0x27')]();};}function respondWithResult(_0x2b4c6c,_0x3a3508){_0x3a3508=_0x3a3508||0xc8;return function(_0x4b8d2b){if(_0x4b8d2b){return _0x2b4c6c['status'](_0x3a3508)[_0xa6f7('0x28')](_0x4b8d2b);}};}function respondWithFilteredResult(_0x2ad0d9,_0x55d45a){return function(_0x267917){if(_0x267917){var _0x27babb=_0x267917[_0xa6f7('0x29')],_0x87bccc=_0x55d45a[_0xa6f7('0x2a')],_0x3a7ff9=_0x55d45a[_0xa6f7('0x2a')]+_0x55d45a[_0xa6f7('0x2b')],_0x224f5a;if(_0x3a7ff9>=_0x27babb){_0x3a7ff9=_0x27babb;_0x224f5a=0xc8;}else{_0x224f5a=0xce;}_0x2ad0d9[_0xa6f7('0x26')](_0x224f5a);return _0x2ad0d9[_0xa6f7('0x2c')](_0xa6f7('0x2d'),_0x87bccc+'-'+_0x3a7ff9+'/'+_0x27babb)['json'](_0x267917);}return null;};}function patchUpdates(_0x442ccf){return function(_0x42dc49){try{jsonpatch['apply'](_0x42dc49,_0x442ccf,!![]);}catch(_0xd6304f){return BPromise[_0xa6f7('0x2e')](_0xd6304f);}return _0x42dc49['save']();};}function saveUpdates(_0x55179e,_0x176378){return function(_0x25dcad){if(_0x25dcad){return _0x25dcad[_0xa6f7('0x2f')](_0x55179e)[_0xa6f7('0x1d')](function(_0x1e25e0){return _0x1e25e0;});}return null;};}function removeEntity(_0x4f33b3,_0x4dfd81){return function(_0x238e15){if(_0x238e15){return _0x238e15['destroy']()[_0xa6f7('0x1d')](function(){_0x4f33b3[_0xa6f7('0x26')](0xcc)[_0xa6f7('0x27')]();});}};}function handleEntityNotFound(_0x237e5d,_0x5b907d){return function(_0xbdfc5a){if(!_0xbdfc5a){_0x237e5d['sendStatus'](0x194);}return _0xbdfc5a;};}function handleError(_0x4576a7,_0xb1a7f8){_0xb1a7f8=_0xb1a7f8||0x1f4;return function(_0x1a5de5){logger['error'](_0x1a5de5[_0xa6f7('0x30')]);if(_0x1a5de5['name']){delete _0x1a5de5[_0xa6f7('0x31')];}_0x4576a7[_0xa6f7('0x26')](_0xb1a7f8)[_0xa6f7('0x32')](_0x1a5de5);};}exports['index']=function(_0x44a5f2,_0xfdf408){var _0x3b3bc2={},_0x37b833={},_0x14444c={'count':0x0,'rows':[]};var _0x28490e=_['map'](db[_0xa6f7('0x33')][_0xa6f7('0x34')],function(_0xc25a1b){return{'name':_0xc25a1b[_0xa6f7('0x35')],'type':_0xc25a1b[_0xa6f7('0x36')][_0xa6f7('0x37')]};});_0x37b833[_0xa6f7('0x38')]=_[_0xa6f7('0x39')](_0x28490e,'name');_0x37b833[_0xa6f7('0x3a')]=_[_0xa6f7('0x3b')](_0x44a5f2[_0xa6f7('0x3a')]);_0x37b833['filters']=_[_0xa6f7('0x3c')](_0x37b833[_0xa6f7('0x38')],_0x37b833['query']);_0x3b3bc2[_0xa6f7('0x3d')]=_[_0xa6f7('0x3c')](_0x37b833[_0xa6f7('0x38')],qs[_0xa6f7('0x3e')](_0x44a5f2[_0xa6f7('0x3a')]['fields']));_0x3b3bc2[_0xa6f7('0x3d')]=_0x3b3bc2[_0xa6f7('0x3d')][_0xa6f7('0x3f')]?_0x3b3bc2[_0xa6f7('0x3d')]:_0x37b833[_0xa6f7('0x38')];if(!_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x40')](_0xa6f7('0x41'))){_0x3b3bc2['limit']=qs['limit'](_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x2b')]);_0x3b3bc2[_0xa6f7('0x2a')]=qs[_0xa6f7('0x2a')](_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x2a')]);}_0x3b3bc2[_0xa6f7('0x42')]=qs[_0xa6f7('0x43')](_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x43')]);_0x3b3bc2['where']=qs[_0xa6f7('0x44')](_[_0xa6f7('0x45')](_0x44a5f2['query'],_0x37b833[_0xa6f7('0x44')]),_0x28490e);if(_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x46')]){_0x3b3bc2[_0xa6f7('0x47')]=_['merge'](_0x3b3bc2[_0xa6f7('0x47')],{'$or':_['map'](_0x28490e,function(_0x5cb909){if(_0x5cb909[_0xa6f7('0x36')]!==_0xa6f7('0x48')){var _0x3f5ef7={};_0x3f5ef7[_0x5cb909[_0xa6f7('0x31')]]={'$like':'%'+_0x44a5f2[_0xa6f7('0x3a')][_0xa6f7('0x46')]+'%'};return _0x3f5ef7;}})});}_0x3b3bc2=_[_0xa6f7('0x49')]({},_0x3b3bc2,_0x44a5f2['options']);var _0x17d934={'where':_0x3b3bc2[_0xa6f7('0x47')]};return db['ServicenowConfiguration'][_0xa6f7('0x29')](_0x17d934)[_0xa6f7('0x1d')](function(_0x36d6f4){_0x14444c['count']=_0x36d6f4;if(_0x44a5f2[_0xa6f7('0x3a')]['includeAll']){_0x3b3bc2[_0xa6f7('0x4a')]=[{'all':!![]}];}return db[_0xa6f7('0x33')][_0xa6f7('0x4b')](_0x3b3bc2);})['then'](function(_0x5df564){_0x14444c[_0xa6f7('0x4c')]=_0x5df564;return _0x14444c;})['then'](respondWithFilteredResult(_0xfdf408,_0x3b3bc2))[_0xa6f7('0x4d')](handleError(_0xfdf408,null));};exports['show']=function(_0x5700f3,_0x1e7089){var _0x2e3a04={'raw':![],'where':{'id':_0x5700f3[_0xa6f7('0x4e')]['id']}},_0x350071={};_0x350071[_0xa6f7('0x38')]=_[_0xa6f7('0x3b')](db['ServicenowConfiguration'][_0xa6f7('0x34')]);_0x350071[_0xa6f7('0x3a')]=_['keys'](_0x5700f3[_0xa6f7('0x3a')]);_0x350071['filters']=_[_0xa6f7('0x3c')](_0x350071['model'],_0x350071['query']);_0x2e3a04[_0xa6f7('0x3d')]=_[_0xa6f7('0x3c')](_0x350071[_0xa6f7('0x38')],qs[_0xa6f7('0x3e')](_0x5700f3[_0xa6f7('0x3a')]['fields']));_0x2e3a04[_0xa6f7('0x3d')]=_0x2e3a04[_0xa6f7('0x3d')]['length']?_0x2e3a04[_0xa6f7('0x3d')]:_0x350071['model'];if(_0x5700f3[_0xa6f7('0x3a')][_0xa6f7('0x4f')]){_0x2e3a04[_0xa6f7('0x4a')]=[{'all':!![]}];}_0x2e3a04=_['merge']({},_0x2e3a04,_0x5700f3[_0xa6f7('0x50')]);return db['ServicenowConfiguration'][_0xa6f7('0x51')](_0x2e3a04)[_0xa6f7('0x1d')](handleEntityNotFound(_0x1e7089,null))[_0xa6f7('0x1d')](respondWithResult(_0x1e7089,null))[_0xa6f7('0x4d')](handleError(_0x1e7089,null));};exports[_0xa6f7('0x52')]=function(_0x5628a0,_0x5d05d6){return db[_0xa6f7('0x33')][_0xa6f7('0x52')](_0x5628a0[_0xa6f7('0x53')],{})[_0xa6f7('0x1d')](respondWithResult(_0x5d05d6,0xc9))['catch'](handleError(_0x5d05d6,null));};exports[_0xa6f7('0x2f')]=function(_0x2105dd,_0x14d841){if(_0x2105dd[_0xa6f7('0x53')]['id']){delete _0x2105dd[_0xa6f7('0x53')]['id'];}return db[_0xa6f7('0x33')]['find']({'where':{'id':_0x2105dd[_0xa6f7('0x4e')]['id']}})[_0xa6f7('0x1d')](handleEntityNotFound(_0x14d841,null))[_0xa6f7('0x1d')](saveUpdates(_0x2105dd['body'],null))[_0xa6f7('0x1d')](respondWithResult(_0x14d841,null))[_0xa6f7('0x4d')](handleError(_0x14d841,null));};exports[_0xa6f7('0x54')]=function(_0x4496f1,_0x5908e3){return db['ServicenowConfiguration'][_0xa6f7('0x51')]({'where':{'id':_0x4496f1[_0xa6f7('0x4e')]['id']}})[_0xa6f7('0x1d')](handleEntityNotFound(_0x5908e3,null))[_0xa6f7('0x1d')](removeEntity(_0x5908e3,null))[_0xa6f7('0x4d')](handleError(_0x5908e3,null));};exports[_0xa6f7('0x55')]=function(_0x1fcb72,_0x5efd49,_0x169bbe){var _0xef3883={};var _0x2f131c={};var _0x3b03e6;var _0x41ec86;return db[_0xa6f7('0x33')][_0xa6f7('0x56')]({'where':{'id':_0x1fcb72[_0xa6f7('0x4e')]['id']}})[_0xa6f7('0x1d')](handleEntityNotFound(_0x5efd49,null))[_0xa6f7('0x1d')](function(_0x3ade42){if(_0x3ade42){_0x3b03e6=_0x3ade42;_0x2f131c['model']=_[_0xa6f7('0x3b')](db['ServicenowField'][_0xa6f7('0x34')]);_0x2f131c['query']=_[_0xa6f7('0x3b')](_0x1fcb72[_0xa6f7('0x3a')]);_0x2f131c['filters']=_[_0xa6f7('0x3c')](_0x2f131c[_0xa6f7('0x38')],_0x2f131c[_0xa6f7('0x3a')]);_0xef3883['attributes']=_[_0xa6f7('0x3c')](_0x2f131c['model'],qs[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')]['fields']));_0xef3883[_0xa6f7('0x3d')]=_0xef3883['attributes'][_0xa6f7('0x3f')]?_0xef3883['attributes']:_0x2f131c[_0xa6f7('0x38')];_0xef3883[_0xa6f7('0x42')]=qs[_0xa6f7('0x43')](_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x43')]);_0xef3883[_0xa6f7('0x47')]=qs[_0xa6f7('0x44')](_[_0xa6f7('0x45')](_0x1fcb72[_0xa6f7('0x3a')],_0x2f131c[_0xa6f7('0x44')]));if(_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x46')]){_0xef3883['where']=_[_0xa6f7('0x49')](_0xef3883[_0xa6f7('0x47')],{'$or':_[_0xa6f7('0x39')](_0xef3883[_0xa6f7('0x3d')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x46')]+'%'};return _0x3a464e;})});}_0xef3883=_['merge']({},_0xef3883,_0x1fcb72[_0xa6f7('0x50')]);return _0x3b03e6[_0xa6f7('0x55')](_0xef3883);}})[_0xa6f7('0x1d')](function(_0x522caf){if(_0x522caf){_0x41ec86=_0x522caf[_0xa6f7('0x3f')];if(!_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x40')](_0xa6f7('0x41'))){_0xef3883[_0xa6f7('0x2b')]=qs[_0xa6f7('0x2b')](_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x2b')]);_0xef3883['offset']=qs['offset'](_0x1fcb72[_0xa6f7('0x3a')][_0xa6f7('0x2a')]);}return _0x3b03e6['getFields'](_0xef3883);}})[_0xa6f7('0x1d')](function(_0x18ff29){if(_0x18ff29){return _0x18ff29?{'count':_0x41ec86,'rows':_0x18ff29}:null;}})[_0xa6f7('0x1d')](respondWithResult(_0x5efd49,null))['catch'](handleError(_0x5efd49,null));};exports[_0xa6f7('0x57')]=function(_0x48d5ad,_0x4f156e,_0x59ed13){var _0x5321d4={};var _0x522e5d={};var _0x39ba3d;var _0x3502b3;return db[_0xa6f7('0x33')]['findOne']({'where':{'id':_0x48d5ad[_0xa6f7('0x4e')]['id']}})[_0xa6f7('0x1d')](handleEntityNotFound(_0x4f156e,null))[_0xa6f7('0x1d')](function(_0x69c173){if(_0x69c173){_0x39ba3d=_0x69c173;_0x522e5d[_0xa6f7('0x38')]=_[_0xa6f7('0x3b')](db[_0xa6f7('0x58')][_0xa6f7('0x34')]);_0x522e5d[_0xa6f7('0x3a')]=_[_0xa6f7('0x3b')](_0x48d5ad['query']);_0x522e5d[_0xa6f7('0x44')]=_[_0xa6f7('0x3c')](_0x522e5d[_0xa6f7('0x38')],_0x522e5d[_0xa6f7('0x3a')]);_0x5321d4[_0xa6f7('0x3d')]=_[_0xa6f7('0x3c')](_0x522e5d[_0xa6f7('0x38')],qs[_0xa6f7('0x3e')](_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x3e')]));_0x5321d4[_0xa6f7('0x3d')]=_0x5321d4['attributes']['length']?_0x5321d4[_0xa6f7('0x3d')]:_0x522e5d[_0xa6f7('0x38')];_0x5321d4[_0xa6f7('0x42')]=qs['sort'](_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x43')]);_0x5321d4['where']=qs[_0xa6f7('0x44')](_[_0xa6f7('0x45')](_0x48d5ad['query'],_0x522e5d['filters']));if(_0x48d5ad[_0xa6f7('0x3a')]['filter']){_0x5321d4[_0xa6f7('0x47')]=_[_0xa6f7('0x49')](_0x5321d4['where'],{'$or':_['map'](_0x5321d4[_0xa6f7('0x3d')],function(_0x1da89a){var _0x122608={};_0x122608[_0x1da89a]={'$like':'%'+_0x48d5ad['query'][_0xa6f7('0x46')]+'%'};return _0x122608;})});}_0x5321d4=_[_0xa6f7('0x49')]({},_0x5321d4,_0x48d5ad[_0xa6f7('0x50')]);return _0x39ba3d[_0xa6f7('0x57')](_0x5321d4);}})[_0xa6f7('0x1d')](function(_0x282e79){if(_0x282e79){_0x3502b3=_0x282e79[_0xa6f7('0x3f')];if(!_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x40')](_0xa6f7('0x41'))){_0x5321d4[_0xa6f7('0x2b')]=qs['limit'](_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x2b')]);_0x5321d4[_0xa6f7('0x2a')]=qs[_0xa6f7('0x2a')](_0x48d5ad[_0xa6f7('0x3a')][_0xa6f7('0x2a')]);}return _0x39ba3d['getSubjects'](_0x5321d4);}})[_0xa6f7('0x1d')](function(_0x1f0c90){if(_0x1f0c90){return _0x1f0c90?{'count':_0x3502b3,'rows':_0x1f0c90}:null;}})[_0xa6f7('0x1d')](respondWithResult(_0x4f156e,null))[_0xa6f7('0x4d')](handleError(_0x4f156e,null));};exports[_0xa6f7('0x59')]=function(_0x1d98a2,_0x54c4e6,_0x5d5894){var _0x7ff027={};var _0x373ae3={};var _0x3ae028;var _0x4698b5;return db[_0xa6f7('0x33')]['findOne']({'where':{'id':_0x1d98a2[_0xa6f7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x54c4e6,null))[_0xa6f7('0x1d')](function(_0x4b6acb){if(_0x4b6acb){_0x3ae028=_0x4b6acb;_0x373ae3['model']=_['keys'](db[_0xa6f7('0x58')]['rawAttributes']);_0x373ae3['query']=_[_0xa6f7('0x3b')](_0x1d98a2[_0xa6f7('0x3a')]);_0x373ae3[_0xa6f7('0x44')]=_[_0xa6f7('0x3c')](_0x373ae3['model'],_0x373ae3[_0xa6f7('0x3a')]);_0x7ff027[_0xa6f7('0x3d')]=_[_0xa6f7('0x3c')](_0x373ae3[_0xa6f7('0x38')],qs[_0xa6f7('0x3e')](_0x1d98a2[_0xa6f7('0x3a')]['fields']));_0x7ff027[_0xa6f7('0x3d')]=_0x7ff027['attributes']['length']?_0x7ff027[_0xa6f7('0x3d')]:_0x373ae3[_0xa6f7('0x38')];_0x7ff027['order']=qs[_0xa6f7('0x43')](_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x43')]);_0x7ff027['where']=qs[_0xa6f7('0x44')](_['pick'](_0x1d98a2[_0xa6f7('0x3a')],_0x373ae3[_0xa6f7('0x44')]));if(_0x1d98a2['query'][_0xa6f7('0x46')]){_0x7ff027['where']=_[_0xa6f7('0x49')](_0x7ff027[_0xa6f7('0x47')],{'$or':_['map'](_0x7ff027[_0xa6f7('0x3d')],function(_0x473d17){var _0x1afd68={};_0x1afd68[_0x473d17]={'$like':'%'+_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x46')]+'%'};return _0x1afd68;})});}_0x7ff027=_['merge']({},_0x7ff027,_0x1d98a2[_0xa6f7('0x50')]);return _0x3ae028[_0xa6f7('0x59')](_0x7ff027);}})[_0xa6f7('0x1d')](function(_0x13219e){if(_0x13219e){_0x4698b5=_0x13219e['length'];if(!_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x40')](_0xa6f7('0x41'))){_0x7ff027[_0xa6f7('0x2b')]=qs[_0xa6f7('0x2b')](_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x2b')]);_0x7ff027[_0xa6f7('0x2a')]=qs['offset'](_0x1d98a2[_0xa6f7('0x3a')][_0xa6f7('0x2a')]);}return _0x3ae028['getDescriptions'](_0x7ff027);}})[_0xa6f7('0x1d')](function(_0x5485ac){if(_0x5485ac){return _0x5485ac?{'count':_0x4698b5,'rows':_0x5485ac}:null;}})[_0xa6f7('0x1d')](respondWithResult(_0x54c4e6,null))[_0xa6f7('0x4d')](handleError(_0x54c4e6,null));}; \ No newline at end of file +var _0xe511=['getFields','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','end','status','count','offset','Content-Range','json','apply','reject','save','then','sendStatus','stack','name','send','map','ServicenowConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','find','create','update','body','params','destroy','findOne','ServicenowField'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe511,0x16f));var _0x1e51=function(_0x1121fc,_0x3ad11a){_0x1121fc=_0x1121fc-0x0;var _0x7963c3=_0xe511[_0x1121fc];return _0x7963c3;};'use strict';var pdf=require(_0x1e51('0x0'));var emlformat=require(_0x1e51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e51('0x3'));var moment=require(_0x1e51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e51('0x5'));var util=require(_0x1e51('0x6'));var path=require(_0x1e51('0x7'));var sox=require(_0x1e51('0x8'));var csv=require('to-csv');var ejs=require(_0x1e51('0x9'));var fs=require('fs');var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var db=require(_0x1e51('0x16'))['db'];var jayson=require(_0x1e51('0x17'));var client=jayson[_0x1e51('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x408a77,_0x102f01,_0x2acdf5){if(_0x2acdf5){var _0xcf297f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcf297f[_0x1e51('0x19')](_0x102f01)){return _0x408a77;}else{throw new db[(_0x1e51('0x1a'))][(_0x1e51('0x1b'))](_0x1e51('0x1c'));}}else{return _0x408a77;}}function respondWithRpcPromise(_0x1cc62a,_0xd76fba,_0x5a5c07,_0x3b01b7){return new BPromise(function(_0x24db4f,_0x4526b4){var _0x5857e2=_0x3b01b7||client;return _0x5857e2[_0x1e51('0x1d')](_0x1cc62a,_0x5a5c07)['then'](function(_0x53d222){logger[_0x1e51('0x1e')](_0x1e51('0x1f'),_0xd76fba,_0x1e51('0x20'));logger[_0x1e51('0x21')](_0x1e51('0x22'),_0xd76fba,_0x1e51('0x20'),JSON['stringify'](_0x53d222));if(_0x53d222[_0x1e51('0x23')]){if(_0x53d222['error'][_0x1e51('0x24')]===0x1f4){logger[_0x1e51('0x23')](_0x1e51('0x1f'),_0xd76fba,_0x53d222[_0x1e51('0x23')]['message']);return _0x4526b4(_0x53d222['error']['message']);}logger['error'](_0x1e51('0x1f'),_0xd76fba,_0x53d222['error'][_0x1e51('0x25')]);return _0x24db4f(_0x53d222[_0x1e51('0x23')][_0x1e51('0x25')]);}else{logger[_0x1e51('0x1e')](_0x1e51('0x1f'),_0xd76fba,_0x1e51('0x20'));_0x24db4f(_0x53d222[_0x1e51('0x26')][_0x1e51('0x25')]);}})['catch'](function(_0x4d04c0){logger[_0x1e51('0x23')](_0x1e51('0x1f'),_0xd76fba,_0x4d04c0);_0x4526b4(_0x4d04c0);});});}function respondWithStatusCode(_0x2e42b1,_0x1386db){_0x1386db=_0x1386db||0xcc;return function(_0x505d79){if(_0x505d79){return _0x2e42b1['sendStatus'](_0x1386db);}return _0x2e42b1['status'](_0x1386db)[_0x1e51('0x27')]();};}function respondWithResult(_0x2a1561,_0x433c2d){_0x433c2d=_0x433c2d||0xc8;return function(_0x5412bc){if(_0x5412bc){return _0x2a1561[_0x1e51('0x28')](_0x433c2d)['json'](_0x5412bc);}};}function respondWithFilteredResult(_0x5eccee,_0x3349f0){return function(_0x5c5bbd){if(_0x5c5bbd){var _0x170ec6=_0x5c5bbd[_0x1e51('0x29')],_0x1eb79f=_0x3349f0[_0x1e51('0x2a')],_0x56722f=_0x3349f0[_0x1e51('0x2a')]+_0x3349f0['limit'],_0x3e6ef2;if(_0x56722f>=_0x170ec6){_0x56722f=_0x170ec6;_0x3e6ef2=0xc8;}else{_0x3e6ef2=0xce;}_0x5eccee['status'](_0x3e6ef2);return _0x5eccee['set'](_0x1e51('0x2b'),_0x1eb79f+'-'+_0x56722f+'/'+_0x170ec6)[_0x1e51('0x2c')](_0x5c5bbd);}return null;};}function patchUpdates(_0x1ba84a){return function(_0x36dabe){try{jsonpatch[_0x1e51('0x2d')](_0x36dabe,_0x1ba84a,!![]);}catch(_0x27d9a2){return BPromise[_0x1e51('0x2e')](_0x27d9a2);}return _0x36dabe[_0x1e51('0x2f')]();};}function saveUpdates(_0x31b678,_0x3167b6){return function(_0x27b550){if(_0x27b550){return _0x27b550['update'](_0x31b678)[_0x1e51('0x30')](function(_0x366925){return _0x366925;});}return null;};}function removeEntity(_0x92707a,_0x12da89){return function(_0xcf6b2){if(_0xcf6b2){return _0xcf6b2['destroy']()[_0x1e51('0x30')](function(){_0x92707a['status'](0xcc)[_0x1e51('0x27')]();});}};}function handleEntityNotFound(_0x3fb57e,_0x1fbd06){return function(_0x59f405){if(!_0x59f405){_0x3fb57e[_0x1e51('0x31')](0x194);}return _0x59f405;};}function handleError(_0x58f8b1,_0x247de2){_0x247de2=_0x247de2||0x1f4;return function(_0x4e0187){logger['error'](_0x4e0187[_0x1e51('0x32')]);if(_0x4e0187[_0x1e51('0x33')]){delete _0x4e0187[_0x1e51('0x33')];}_0x58f8b1['status'](_0x247de2)[_0x1e51('0x34')](_0x4e0187);};}exports['index']=function(_0x3797a6,_0x2df269){var _0x5760ba={},_0xd4fd91={},_0x1bab7f={'count':0x0,'rows':[]};var _0x433cb1=_[_0x1e51('0x35')](db[_0x1e51('0x36')][_0x1e51('0x37')],function(_0x5c57a6){return{'name':_0x5c57a6['fieldName'],'type':_0x5c57a6[_0x1e51('0x38')]['key']};});_0xd4fd91[_0x1e51('0x39')]=_[_0x1e51('0x35')](_0x433cb1,_0x1e51('0x33'));_0xd4fd91[_0x1e51('0x3a')]=_[_0x1e51('0x3b')](_0x3797a6[_0x1e51('0x3a')]);_0xd4fd91[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0xd4fd91[_0x1e51('0x39')],_0xd4fd91[_0x1e51('0x3a')]);_0x5760ba[_0x1e51('0x3e')]=_['intersection'](_0xd4fd91[_0x1e51('0x39')],qs['fields'](_0x3797a6[_0x1e51('0x3a')][_0x1e51('0x3f')]));_0x5760ba[_0x1e51('0x3e')]=_0x5760ba[_0x1e51('0x3e')][_0x1e51('0x40')]?_0x5760ba[_0x1e51('0x3e')]:_0xd4fd91[_0x1e51('0x39')];if(!_0x3797a6[_0x1e51('0x3a')][_0x1e51('0x41')](_0x1e51('0x42'))){_0x5760ba[_0x1e51('0x43')]=qs['limit'](_0x3797a6['query'][_0x1e51('0x43')]);_0x5760ba[_0x1e51('0x2a')]=qs[_0x1e51('0x2a')](_0x3797a6[_0x1e51('0x3a')][_0x1e51('0x2a')]);}_0x5760ba[_0x1e51('0x44')]=qs[_0x1e51('0x45')](_0x3797a6[_0x1e51('0x3a')]['sort']);_0x5760ba[_0x1e51('0x46')]=qs[_0x1e51('0x3c')](_[_0x1e51('0x47')](_0x3797a6[_0x1e51('0x3a')],_0xd4fd91[_0x1e51('0x3c')]),_0x433cb1);if(_0x3797a6[_0x1e51('0x3a')][_0x1e51('0x48')]){_0x5760ba['where']=_[_0x1e51('0x49')](_0x5760ba[_0x1e51('0x46')],{'$or':_['map'](_0x433cb1,function(_0xfd6521){if(_0xfd6521[_0x1e51('0x38')]!==_0x1e51('0x4a')){var _0x507d0c={};_0x507d0c[_0xfd6521[_0x1e51('0x33')]]={'$like':'%'+_0x3797a6[_0x1e51('0x3a')][_0x1e51('0x48')]+'%'};return _0x507d0c;}})});}_0x5760ba=_[_0x1e51('0x49')]({},_0x5760ba,_0x3797a6[_0x1e51('0x4b')]);var _0x3baebb={'where':_0x5760ba[_0x1e51('0x46')]};return db[_0x1e51('0x36')][_0x1e51('0x29')](_0x3baebb)['then'](function(_0x132625){_0x1bab7f[_0x1e51('0x29')]=_0x132625;if(_0x3797a6['query'][_0x1e51('0x4c')]){_0x5760ba[_0x1e51('0x4d')]=[{'all':!![]}];}return db[_0x1e51('0x36')]['findAll'](_0x5760ba);})[_0x1e51('0x30')](function(_0x4634de){_0x1bab7f[_0x1e51('0x4e')]=_0x4634de;return _0x1bab7f;})['then'](respondWithFilteredResult(_0x2df269,_0x5760ba))[_0x1e51('0x4f')](handleError(_0x2df269,null));};exports['show']=function(_0x581f7a,_0x54688b){var _0x169e6c={'raw':![],'where':{'id':_0x581f7a['params']['id']}},_0x2e79ca={};_0x2e79ca['model']=_[_0x1e51('0x3b')](db[_0x1e51('0x36')][_0x1e51('0x37')]);_0x2e79ca[_0x1e51('0x3a')]=_[_0x1e51('0x3b')](_0x581f7a[_0x1e51('0x3a')]);_0x2e79ca['filters']=_[_0x1e51('0x3d')](_0x2e79ca['model'],_0x2e79ca[_0x1e51('0x3a')]);_0x169e6c[_0x1e51('0x3e')]=_['intersection'](_0x2e79ca['model'],qs['fields'](_0x581f7a[_0x1e51('0x3a')][_0x1e51('0x3f')]));_0x169e6c[_0x1e51('0x3e')]=_0x169e6c['attributes'][_0x1e51('0x40')]?_0x169e6c[_0x1e51('0x3e')]:_0x2e79ca[_0x1e51('0x39')];if(_0x581f7a[_0x1e51('0x3a')][_0x1e51('0x4c')]){_0x169e6c[_0x1e51('0x4d')]=[{'all':!![]}];}_0x169e6c=_[_0x1e51('0x49')]({},_0x169e6c,_0x581f7a[_0x1e51('0x4b')]);return db['ServicenowConfiguration'][_0x1e51('0x50')](_0x169e6c)[_0x1e51('0x30')](handleEntityNotFound(_0x54688b,null))[_0x1e51('0x30')](respondWithResult(_0x54688b,null))[_0x1e51('0x4f')](handleError(_0x54688b,null));};exports[_0x1e51('0x51')]=function(_0x2a88db,_0x5ba6c2){return db[_0x1e51('0x36')]['create'](_0x2a88db['body'],{})['then'](respondWithResult(_0x5ba6c2,0xc9))[_0x1e51('0x4f')](handleError(_0x5ba6c2,null));};exports[_0x1e51('0x52')]=function(_0x4b2046,_0x56f9ba){if(_0x4b2046[_0x1e51('0x53')]['id']){delete _0x4b2046[_0x1e51('0x53')]['id'];}return db[_0x1e51('0x36')]['find']({'where':{'id':_0x4b2046[_0x1e51('0x54')]['id']}})[_0x1e51('0x30')](handleEntityNotFound(_0x56f9ba,null))[_0x1e51('0x30')](saveUpdates(_0x4b2046['body'],null))[_0x1e51('0x30')](respondWithResult(_0x56f9ba,null))[_0x1e51('0x4f')](handleError(_0x56f9ba,null));};exports[_0x1e51('0x55')]=function(_0x30ee67,_0x666ae9){return db[_0x1e51('0x36')][_0x1e51('0x50')]({'where':{'id':_0x30ee67[_0x1e51('0x54')]['id']}})['then'](handleEntityNotFound(_0x666ae9,null))[_0x1e51('0x30')](removeEntity(_0x666ae9,null))[_0x1e51('0x4f')](handleError(_0x666ae9,null));};exports['getFields']=function(_0x5a9d2a,_0x577b19,_0xa39f42){var _0x686433={};var _0x2ffd82={};var _0x3bdf55;var _0x18e9d1;return db[_0x1e51('0x36')][_0x1e51('0x56')]({'where':{'id':_0x5a9d2a[_0x1e51('0x54')]['id']}})[_0x1e51('0x30')](handleEntityNotFound(_0x577b19,null))['then'](function(_0x5acc97){if(_0x5acc97){_0x3bdf55=_0x5acc97;_0x2ffd82['model']=_[_0x1e51('0x3b')](db[_0x1e51('0x57')]['rawAttributes']);_0x2ffd82['query']=_[_0x1e51('0x3b')](_0x5a9d2a[_0x1e51('0x3a')]);_0x2ffd82['filters']=_[_0x1e51('0x3d')](_0x2ffd82[_0x1e51('0x39')],_0x2ffd82[_0x1e51('0x3a')]);_0x686433[_0x1e51('0x3e')]=_[_0x1e51('0x3d')](_0x2ffd82[_0x1e51('0x39')],qs[_0x1e51('0x3f')](_0x5a9d2a[_0x1e51('0x3a')][_0x1e51('0x3f')]));_0x686433[_0x1e51('0x3e')]=_0x686433['attributes'][_0x1e51('0x40')]?_0x686433[_0x1e51('0x3e')]:_0x2ffd82[_0x1e51('0x39')];_0x686433[_0x1e51('0x44')]=qs[_0x1e51('0x45')](_0x5a9d2a[_0x1e51('0x3a')]['sort']);_0x686433['where']=qs[_0x1e51('0x3c')](_[_0x1e51('0x47')](_0x5a9d2a[_0x1e51('0x3a')],_0x2ffd82[_0x1e51('0x3c')]));if(_0x5a9d2a['query']['filter']){_0x686433['where']=_[_0x1e51('0x49')](_0x686433[_0x1e51('0x46')],{'$or':_[_0x1e51('0x35')](_0x686433[_0x1e51('0x3e')],function(_0x184665){var _0x5c68b1={};_0x5c68b1[_0x184665]={'$like':'%'+_0x5a9d2a[_0x1e51('0x3a')][_0x1e51('0x48')]+'%'};return _0x5c68b1;})});}_0x686433=_[_0x1e51('0x49')]({},_0x686433,_0x5a9d2a['options']);return _0x3bdf55[_0x1e51('0x58')](_0x686433);}})[_0x1e51('0x30')](function(_0x45e607){if(_0x45e607){_0x18e9d1=_0x45e607['length'];if(!_0x5a9d2a[_0x1e51('0x3a')][_0x1e51('0x41')]('nolimit')){_0x686433['limit']=qs[_0x1e51('0x43')](_0x5a9d2a['query'][_0x1e51('0x43')]);_0x686433['offset']=qs[_0x1e51('0x2a')](_0x5a9d2a[_0x1e51('0x3a')][_0x1e51('0x2a')]);}return _0x3bdf55[_0x1e51('0x58')](_0x686433);}})['then'](function(_0x37f3e6){if(_0x37f3e6){return _0x37f3e6?{'count':_0x18e9d1,'rows':_0x37f3e6}:null;}})['then'](respondWithResult(_0x577b19,null))['catch'](handleError(_0x577b19,null));};exports[_0x1e51('0x59')]=function(_0x34ae65,_0x4aa76d,_0x4e69b5){var _0x1fc580={};var _0x25ce1d={};var _0x15f15b;var _0xbe8e21;return db['ServicenowConfiguration'][_0x1e51('0x56')]({'where':{'id':_0x34ae65['params']['id']}})['then'](handleEntityNotFound(_0x4aa76d,null))[_0x1e51('0x30')](function(_0x4f6e7b){if(_0x4f6e7b){_0x15f15b=_0x4f6e7b;_0x25ce1d[_0x1e51('0x39')]=_['keys'](db[_0x1e51('0x57')]['rawAttributes']);_0x25ce1d[_0x1e51('0x3a')]=_[_0x1e51('0x3b')](_0x34ae65['query']);_0x25ce1d[_0x1e51('0x3c')]=_['intersection'](_0x25ce1d[_0x1e51('0x39')],_0x25ce1d[_0x1e51('0x3a')]);_0x1fc580[_0x1e51('0x3e')]=_[_0x1e51('0x3d')](_0x25ce1d[_0x1e51('0x39')],qs[_0x1e51('0x3f')](_0x34ae65['query'][_0x1e51('0x3f')]));_0x1fc580['attributes']=_0x1fc580['attributes'][_0x1e51('0x40')]?_0x1fc580[_0x1e51('0x3e')]:_0x25ce1d[_0x1e51('0x39')];_0x1fc580[_0x1e51('0x44')]=qs[_0x1e51('0x45')](_0x34ae65[_0x1e51('0x3a')][_0x1e51('0x45')]);_0x1fc580['where']=qs[_0x1e51('0x3c')](_[_0x1e51('0x47')](_0x34ae65[_0x1e51('0x3a')],_0x25ce1d['filters']));if(_0x34ae65['query'][_0x1e51('0x48')]){_0x1fc580[_0x1e51('0x46')]=_['merge'](_0x1fc580[_0x1e51('0x46')],{'$or':_[_0x1e51('0x35')](_0x1fc580['attributes'],function(_0x5eb939){var _0xe96651={};_0xe96651[_0x5eb939]={'$like':'%'+_0x34ae65[_0x1e51('0x3a')][_0x1e51('0x48')]+'%'};return _0xe96651;})});}_0x1fc580=_[_0x1e51('0x49')]({},_0x1fc580,_0x34ae65[_0x1e51('0x4b')]);return _0x15f15b[_0x1e51('0x59')](_0x1fc580);}})[_0x1e51('0x30')](function(_0x56f13a){if(_0x56f13a){_0xbe8e21=_0x56f13a['length'];if(!_0x34ae65[_0x1e51('0x3a')][_0x1e51('0x41')]('nolimit')){_0x1fc580[_0x1e51('0x43')]=qs[_0x1e51('0x43')](_0x34ae65['query'][_0x1e51('0x43')]);_0x1fc580['offset']=qs[_0x1e51('0x2a')](_0x34ae65['query']['offset']);}return _0x15f15b['getSubjects'](_0x1fc580);}})['then'](function(_0x51ada3){if(_0x51ada3){return _0x51ada3?{'count':_0xbe8e21,'rows':_0x51ada3}:null;}})['then'](respondWithResult(_0x4aa76d,null))[_0x1e51('0x4f')](handleError(_0x4aa76d,null));};exports['getDescriptions']=function(_0xd05f32,_0x5682a6,_0x45d3b1){var _0x2ff3e5={};var _0xbb6872={};var _0x52d0ca;var _0x30336b;return db[_0x1e51('0x36')]['findOne']({'where':{'id':_0xd05f32[_0x1e51('0x54')]['id']}})['then'](handleEntityNotFound(_0x5682a6,null))[_0x1e51('0x30')](function(_0x5c4452){if(_0x5c4452){_0x52d0ca=_0x5c4452;_0xbb6872[_0x1e51('0x39')]=_[_0x1e51('0x3b')](db[_0x1e51('0x57')][_0x1e51('0x37')]);_0xbb6872[_0x1e51('0x3a')]=_[_0x1e51('0x3b')](_0xd05f32['query']);_0xbb6872[_0x1e51('0x3c')]=_['intersection'](_0xbb6872[_0x1e51('0x39')],_0xbb6872[_0x1e51('0x3a')]);_0x2ff3e5[_0x1e51('0x3e')]=_[_0x1e51('0x3d')](_0xbb6872['model'],qs['fields'](_0xd05f32['query'][_0x1e51('0x3f')]));_0x2ff3e5[_0x1e51('0x3e')]=_0x2ff3e5[_0x1e51('0x3e')][_0x1e51('0x40')]?_0x2ff3e5['attributes']:_0xbb6872[_0x1e51('0x39')];_0x2ff3e5['order']=qs[_0x1e51('0x45')](_0xd05f32['query']['sort']);_0x2ff3e5[_0x1e51('0x46')]=qs[_0x1e51('0x3c')](_['pick'](_0xd05f32[_0x1e51('0x3a')],_0xbb6872['filters']));if(_0xd05f32[_0x1e51('0x3a')]['filter']){_0x2ff3e5[_0x1e51('0x46')]=_[_0x1e51('0x49')](_0x2ff3e5['where'],{'$or':_[_0x1e51('0x35')](_0x2ff3e5['attributes'],function(_0x284348){var _0x29fc47={};_0x29fc47[_0x284348]={'$like':'%'+_0xd05f32[_0x1e51('0x3a')][_0x1e51('0x48')]+'%'};return _0x29fc47;})});}_0x2ff3e5=_['merge']({},_0x2ff3e5,_0xd05f32[_0x1e51('0x4b')]);return _0x52d0ca[_0x1e51('0x5a')](_0x2ff3e5);}})[_0x1e51('0x30')](function(_0x4ff0ff){if(_0x4ff0ff){_0x30336b=_0x4ff0ff['length'];if(!_0xd05f32[_0x1e51('0x3a')][_0x1e51('0x41')](_0x1e51('0x42'))){_0x2ff3e5['limit']=qs['limit'](_0xd05f32['query'][_0x1e51('0x43')]);_0x2ff3e5[_0x1e51('0x2a')]=qs[_0x1e51('0x2a')](_0xd05f32['query'][_0x1e51('0x2a')]);}return _0x52d0ca[_0x1e51('0x5a')](_0x2ff3e5);}})['then'](function(_0xd58339){if(_0xd58339){return _0xd58339?{'count':_0x30336b,'rows':_0xd58339}:null;}})[_0x1e51('0x30')](respondWithResult(_0x5682a6,null))[_0x1e51('0x4f')](handleError(_0x5682a6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index cd6aa75..5cb113b 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 _0xfbff=['define','ServicenowConfiguration','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x210b24,_0x11eea6){var _0x267fad=function(_0x185643){while(--_0x185643){_0x210b24['push'](_0x210b24['shift']());}};_0x267fad(++_0x11eea6);}(_0xfbff,0x18e));var _0xffbf=function(_0x4e9f29,_0x1bbcbf){_0x4e9f29=_0x4e9f29-0x0;var _0x8e1ab3=_0xfbff[_0x4e9f29];return _0x8e1ab3;};'use strict';var _=require(_0xffbf('0x0'));var util=require(_0xffbf('0x1'));var logger=require(_0xffbf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xffbf('0x3'));var rp=require(_0xffbf('0x4'));var fs=require('fs');var path=require(_0xffbf('0x5'));var rimraf=require(_0xffbf('0x6'));var config=require(_0xffbf('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xffbf('0x8')]=function(_0x4cccb3,_0x3c5ed6){return _0x4cccb3[_0xffbf('0x9')](_0xffbf('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01ed=['int_servicenow_configurations','util','../../config/logger','api','moment','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x30c710,_0x109af3){var _0x43dcf2=function(_0x4dfde2){while(--_0x4dfde2){_0x30c710['push'](_0x30c710['shift']());}};_0x43dcf2(++_0x109af3);}(_0x01ed,0x119));var _0xd01e=function(_0xbb7389,_0x12b29d){_0xbb7389=_0xbb7389-0x0;var _0x12537b=_0x01ed[_0xbb7389];return _0x12537b;};'use strict';var _=require('lodash');var util=require(_0xd01e('0x0'));var logger=require(_0xd01e('0x1'))(_0xd01e('0x2'));var moment=require(_0xd01e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd01e('0x4'));var rimraf=require('rimraf');var config=require(_0xd01e('0x5'));var attributes=require(_0xd01e('0x6'));module[_0xd01e('0x7')]=function(_0x4624c7,_0x43bc91){return _0x4624c7[_0xd01e('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xd01e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index f3f8fed..af76f87 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 _0xde2d=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x138270,_0x632ed4){var _0x5c769f=function(_0x49956b){while(--_0x49956b){_0x138270['push'](_0x138270['shift']());}};_0x5c769f(++_0x632ed4);}(_0xde2d,0xa3));var _0xdde2=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0xde2d[_0x1e5068];return _0x2230b6;};'use strict';var _=require(_0xdde2('0x0'));var util=require(_0xdde2('0x1'));var moment=require(_0xdde2('0x2'));var BPromise=require(_0xdde2('0x3'));var rs=require(_0xdde2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdde2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdde2('0x6')][_0xdde2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e6453,_0x3b6e6a,_0x18d91a){return new BPromise(function(_0x4b9719,_0x51ceb1){return client[_0xdde2('0x8')](_0x3e6453,_0x18d91a)['then'](function(_0x3d698){logger[_0xdde2('0x9')](_0xdde2('0xa'),_0x3b6e6a,'request\x20sent');logger[_0xdde2('0xb')](_0xdde2('0xc'),_0x3b6e6a,_0xdde2('0xd'),JSON[_0xdde2('0xe')](_0x3d698));if(_0x3d698['error']){if(_0x3d698[_0xdde2('0xf')][_0xdde2('0x10')]===0x1f4){logger[_0xdde2('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3b6e6a,_0x3d698[_0xdde2('0xf')]['message']);return _0x51ceb1(_0x3d698[_0xdde2('0xf')][_0xdde2('0x11')]);}logger[_0xdde2('0xf')](_0xdde2('0xa'),_0x3b6e6a,_0x3d698[_0xdde2('0xf')][_0xdde2('0x11')]);return _0x4b9719(_0x3d698['error']['message']);}else{logger[_0xdde2('0x9')](_0xdde2('0xa'),_0x3b6e6a,_0xdde2('0xd'));_0x4b9719(_0x3d698[_0xdde2('0x12')][_0xdde2('0x11')]);}})[_0xdde2('0x13')](function(_0x2ee8b8){logger['error'](_0xdde2('0xa'),_0x3b6e6a,_0x2ee8b8);_0x51ceb1(_0x2ee8b8);});});} \ No newline at end of file +var _0xe0c3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xe0c3,0x1f4));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3e0c('0x0'));var moment=require(_0x3e0c('0x1'));var BPromise=require('bluebird');var rs=require(_0x3e0c('0x2'));var fs=require('fs');var Redis=require(_0x3e0c('0x3'));var db=require(_0x3e0c('0x4'))['db'];var utils=require(_0x3e0c('0x5'));var logger=require(_0x3e0c('0x6'))(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var jayson=require(_0x3e0c('0x9'));var client=jayson[_0x3e0c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c2d6a,_0x2298e6,_0x11cb31){return new BPromise(function(_0x4d490a,_0x2784b7){return client[_0x3e0c('0xb')](_0x4c2d6a,_0x11cb31)[_0x3e0c('0xc')](function(_0x328560){logger['info'](_0x3e0c('0xd'),_0x2298e6,_0x3e0c('0xe'));logger[_0x3e0c('0xf')](_0x3e0c('0x10'),_0x2298e6,'request\x20sent',JSON[_0x3e0c('0x11')](_0x328560));if(_0x328560[_0x3e0c('0x12')]){if(_0x328560['error'][_0x3e0c('0x13')]===0x1f4){logger[_0x3e0c('0x12')](_0x3e0c('0xd'),_0x2298e6,_0x328560[_0x3e0c('0x12')][_0x3e0c('0x14')]);return _0x2784b7(_0x328560['error'][_0x3e0c('0x14')]);}logger[_0x3e0c('0x12')](_0x3e0c('0xd'),_0x2298e6,_0x328560['error'][_0x3e0c('0x14')]);return _0x4d490a(_0x328560[_0x3e0c('0x12')][_0x3e0c('0x14')]);}else{logger[_0x3e0c('0x15')](_0x3e0c('0xd'),_0x2298e6,_0x3e0c('0xe'));_0x4d490a(_0x328560[_0x3e0c('0x16')][_0x3e0c('0x14')]);}})[_0x3e0c('0x17')](function(_0x4effc7){logger['error'](_0x3e0c('0xd'),_0x2298e6,_0x4effc7);_0x2784b7(_0x4effc7);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e29d543..eea3b05 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 _0xfae0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','create','isAuthenticated','update','multer','util','path','connect-timeout','express'];(function(_0x5a4efe,_0x346f9f){var _0x3cd68d=function(_0x46102e){while(--_0x46102e){_0x5a4efe['push'](_0x5a4efe['shift']());}};_0x3cd68d(++_0x346f9f);}(_0xfae0,0xdb));var _0x0fae=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0xfae0[_0x1428d9];return _0x438019;};'use strict';var multer=require(_0x0fae('0x0'));var util=require(_0x0fae('0x1'));var path=require(_0x0fae('0x2'));var timeout=require(_0x0fae('0x3'));var express=require(_0x0fae('0x4'));var router=express[_0x0fae('0x5')]();var auth=require(_0x0fae('0x6'));var interaction=require(_0x0fae('0x7'));var config=require(_0x0fae('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0fae('0x9')]);router[_0x0fae('0xa')](_0x0fae('0xb'),auth['isAuthenticated'](),controller[_0x0fae('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0fae('0xd')]);router['put'](_0x0fae('0xb'),auth[_0x0fae('0xe')](),controller[_0x0fae('0xf')]);router['delete'](_0x0fae('0xb'),auth[_0x0fae('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1f27=['isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f27,0x1ef));var _0x71f2=function(_0x24e574,_0xe9c65c){_0x24e574=_0x24e574-0x0;var _0x3c4325=_0x1f27[_0x24e574];return _0x3c4325;};'use strict';var multer=require(_0x71f2('0x0'));var util=require(_0x71f2('0x1'));var path=require(_0x71f2('0x2'));var timeout=require(_0x71f2('0x3'));var express=require(_0x71f2('0x4'));var router=express[_0x71f2('0x5')]();var auth=require(_0x71f2('0x6'));var interaction=require(_0x71f2('0x7'));var config=require(_0x71f2('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x71f2('0x9')](),controller[_0x71f2('0xa')]);router['get'](_0x71f2('0xb'),auth['isAuthenticated'](),controller[_0x71f2('0xc')]);router['post']('/',auth[_0x71f2('0x9')](),controller[_0x71f2('0xd')]);router[_0x71f2('0xe')](_0x71f2('0xb'),auth[_0x71f2('0x9')](),controller['update']);router[_0x71f2('0xf')]('/:id',auth[_0x71f2('0x9')](),controller[_0x71f2('0x10')]);module[_0x71f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6d64f13..fc4bf15 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 _0x2794=['BOOLEAN','sequelize','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0x337d93,_0x7908a5){var _0x52a98b=function(_0x1d03d5){while(--_0x1d03d5){_0x337d93['push'](_0x337d93['shift']());}};_0x52a98b(++_0x7908a5);}(_0x2794,0x1b9));var _0x4279=function(_0x566888,_0x17c03f){_0x566888=_0x566888-0x0;var _0x567631=_0x2794[_0x566888];return _0x567631;};'use strict';var Sequelize=require(_0x4279('0x0'));module['exports']={'type':{'type':Sequelize[_0x4279('0x1')]('string','variable',_0x4279('0x2'),_0x4279('0x3')),'defaultValue':_0x4279('0x4')},'content':{'type':Sequelize[_0x4279('0x5')]},'key':{'type':Sequelize[_0x4279('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x4279('0x4'),_0x4279('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x4279('0x5')]},'idField':{'type':Sequelize[_0x4279('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4279('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4279('0x5')]}}; \ No newline at end of file +var _0x0d8e=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x0d8e,0x16a));var _0xe0d8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0d8e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xe0d8('0x0'));module[_0xe0d8('0x1')]={'type':{'type':Sequelize[_0xe0d8('0x2')](_0xe0d8('0x3'),_0xe0d8('0x4'),_0xe0d8('0x5'),_0xe0d8('0x6')),'defaultValue':_0xe0d8('0x3')},'content':{'type':Sequelize[_0xe0d8('0x7')]},'key':{'type':Sequelize[_0xe0d8('0x7')]},'keyType':{'type':Sequelize[_0xe0d8('0x2')]('string',_0xe0d8('0x4'),_0xe0d8('0x5'))},'keyContent':{'type':Sequelize[_0xe0d8('0x7')]},'idField':{'type':Sequelize[_0xe0d8('0x7')]},'nameField':{'type':Sequelize[_0xe0d8('0x7')]},'customField':{'type':Sequelize[_0xe0d8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0d8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 8a865ac..601c01f 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(_0x4f57e6,_0x5dbcad){var _0x23f04b=function(_0x47523c){while(--_0x47523c){_0x4f57e6['push'](_0x4f57e6['shift']());}};_0x23f04b(++_0x5dbcad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var 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(_0x823f14,_0xa8444c){var _0x5ac864=function(_0x5a4320){while(--_0x5a4320){_0x823f14['push'](_0x823f14['shift']());}};_0x5ac864(++_0xa8444c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 18014da..f49628d 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 _0x9acd=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','util','api','bluebird','request-promise','path','rimraf'];(function(_0x54bb1b,_0x260925){var _0x50cf03=function(_0x5e1a43){while(--_0x5e1a43){_0x54bb1b['push'](_0x54bb1b['shift']());}};_0x50cf03(++_0x260925);}(_0x9acd,0x166));var _0xd9ac=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9acd[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0xd9ac('0x0'));var logger=require('../../config/logger')(_0xd9ac('0x1'));var moment=require('moment');var BPromise=require(_0xd9ac('0x2'));var rp=require(_0xd9ac('0x3'));var fs=require('fs');var path=require(_0xd9ac('0x4'));var rimraf=require(_0xd9ac('0x5'));var config=require('../../config/environment');var attributes=require(_0xd9ac('0x6'));module[_0xd9ac('0x7')]=function(_0x37a7fa,_0x52065a){return _0x37a7fa[_0xd9ac('0x8')](_0xd9ac('0x9'),attributes,{'tableName':_0xd9ac('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xd9ac('0xb'),_0xd9ac('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf6d6=['FieldId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowField','servicenow_unique_index'];(function(_0x287e92,_0x14e6d9){var _0x11f5a8=function(_0xe18c43){while(--_0xe18c43){_0x287e92['push'](_0x287e92['shift']());}};_0x11f5a8(++_0x14e6d9);}(_0xf6d6,0x181));var _0x6f6d=function(_0x90810e,_0x5ed338){_0x90810e=_0x90810e-0x0;var _0x2c04dd=_0xf6d6[_0x90810e];return _0x2c04dd;};'use strict';var _=require(_0x6f6d('0x0'));var util=require('util');var logger=require(_0x6f6d('0x1'))('api');var moment=require(_0x6f6d('0x2'));var BPromise=require('bluebird');var rp=require(_0x6f6d('0x3'));var fs=require('fs');var path=require(_0x6f6d('0x4'));var rimraf=require(_0x6f6d('0x5'));var config=require(_0x6f6d('0x6'));var attributes=require('./intServicenowField.attributes');module[_0x6f6d('0x7')]=function(_0x3d1448,_0x2c82a3){return _0x3d1448[_0x6f6d('0x8')](_0x6f6d('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x6f6d('0xa'),'fields':['idField',_0x6f6d('0xb')],'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 99e87a4..51f86de 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 _0xb57f=['ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent'];(function(_0x29631f,_0xdb767){var _0x486d87=function(_0x33a1bb){while(--_0x33a1bb){_0x29631f['push'](_0x29631f['shift']());}};_0x486d87(++_0xdb767);}(_0xb57f,0x182));var _0xfb57=function(_0x477094,_0x25a514){_0x477094=_0x477094-0x0;var _0x5bffb1=_0xb57f[_0x477094];return _0x5bffb1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfb57('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb57('0x1'));var db=require(_0xfb57('0x2'))['db'];var utils=require(_0xfb57('0x3'));var logger=require(_0xfb57('0x4'))('rpc');var config=require(_0xfb57('0x5'));var jayson=require(_0xfb57('0x6'));var client=jayson[_0xfb57('0x7')][_0xfb57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50d263,_0x64ff1b,_0x46f462){return new BPromise(function(_0x459db1,_0x196e43){return client[_0xfb57('0x9')](_0x50d263,_0x46f462)[_0xfb57('0xa')](function(_0x153dcd){logger[_0xfb57('0xb')](_0xfb57('0xc'),_0x64ff1b,_0xfb57('0xd'));logger['debug'](_0xfb57('0xe'),_0x64ff1b,'request\x20sent',JSON[_0xfb57('0xf')](_0x153dcd));if(_0x153dcd['error']){if(_0x153dcd[_0xfb57('0x10')]['code']===0x1f4){logger[_0xfb57('0x10')](_0xfb57('0xc'),_0x64ff1b,_0x153dcd[_0xfb57('0x10')]['message']);return _0x196e43(_0x153dcd['error']['message']);}logger[_0xfb57('0x10')]('ServicenowField,\x20%s,\x20%s',_0x64ff1b,_0x153dcd[_0xfb57('0x10')][_0xfb57('0x11')]);return _0x459db1(_0x153dcd['error']['message']);}else{logger[_0xfb57('0xb')](_0xfb57('0xc'),_0x64ff1b,_0xfb57('0xd'));_0x459db1(_0x153dcd[_0xfb57('0x12')][_0xfb57('0x11')]);}})[_0xfb57('0x13')](function(_0x595f9f){logger['error'](_0xfb57('0xc'),_0x64ff1b,_0x595f9f);_0x196e43(_0x595f9f);});});} \ No newline at end of file +var _0xa648=['rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xbffc8c,_0x44e49e){var _0x13d9de=function(_0x584f5d){while(--_0x584f5d){_0xbffc8c['push'](_0xbffc8c['shift']());}};_0x13d9de(++_0x44e49e);}(_0xa648,0x185));var _0x8a64=function(_0x240b5c,_0x2230eb){_0x240b5c=_0x240b5c-0x0;var _0x26299d=_0xa648[_0x240b5c];return _0x26299d;};'use strict';var _=require(_0x8a64('0x0'));var util=require(_0x8a64('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8a64('0x2'));var fs=require('fs');var Redis=require(_0x8a64('0x3'));var db=require(_0x8a64('0x4'))['db'];var utils=require(_0x8a64('0x5'));var logger=require(_0x8a64('0x6'))(_0x8a64('0x7'));var config=require(_0x8a64('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8a64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fc4ef,_0x1b1ed0,_0x155bfe){return new BPromise(function(_0x460cb7,_0x3afb30){return client[_0x8a64('0xa')](_0x4fc4ef,_0x155bfe)[_0x8a64('0xb')](function(_0x5feb8){logger[_0x8a64('0xc')]('ServicenowField,\x20%s,\x20%s',_0x1b1ed0,_0x8a64('0xd'));logger[_0x8a64('0xe')](_0x8a64('0xf'),_0x1b1ed0,_0x8a64('0xd'),JSON[_0x8a64('0x10')](_0x5feb8));if(_0x5feb8['error']){if(_0x5feb8[_0x8a64('0x11')][_0x8a64('0x12')]===0x1f4){logger[_0x8a64('0x11')]('ServicenowField,\x20%s,\x20%s',_0x1b1ed0,_0x5feb8[_0x8a64('0x11')][_0x8a64('0x13')]);return _0x3afb30(_0x5feb8['error'][_0x8a64('0x13')]);}logger[_0x8a64('0x11')](_0x8a64('0x14'),_0x1b1ed0,_0x5feb8[_0x8a64('0x11')][_0x8a64('0x13')]);return _0x460cb7(_0x5feb8[_0x8a64('0x11')][_0x8a64('0x13')]);}else{logger[_0x8a64('0xc')]('ServicenowField,\x20%s,\x20%s',_0x1b1ed0,_0x8a64('0xd'));_0x460cb7(_0x5feb8['result']['message']);}})[_0x8a64('0x15')](function(_0x1fda22){logger[_0x8a64('0x11')](_0x8a64('0x14'),_0x1b1ed0,_0x1fda22);_0x3afb30(_0x1fda22);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 2f70209..32e4500 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 _0xadc5=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadc5,0x1c4));var _0x5adc=function(_0x192213,_0x4c2799){_0x192213=_0x192213-0x0;var _0x179a7d=_0xadc5[_0x192213];return _0x179a7d;};'use strict';var multer=require('multer');var util=require(_0x5adc('0x0'));var path=require('path');var timeout=require(_0x5adc('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5adc('0x2'));var config=require(_0x5adc('0x3'));var controller=require('./intSugarcrmAccount.controller');router[_0x5adc('0x4')]('/',auth[_0x5adc('0x5')](),controller[_0x5adc('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5adc('0x7')]);router[_0x5adc('0x4')](_0x5adc('0x8'),auth[_0x5adc('0x5')](),controller[_0x5adc('0x9')]);router[_0x5adc('0x4')](_0x5adc('0xa'),auth['isAuthenticated'](),controller[_0x5adc('0xb')]);router[_0x5adc('0xc')]('/',auth[_0x5adc('0x5')](),controller['create']);router[_0x5adc('0xc')](_0x5adc('0x8'),auth[_0x5adc('0x5')](),controller[_0x5adc('0xd')]);router[_0x5adc('0xe')](_0x5adc('0xf'),auth[_0x5adc('0x5')](),controller['update']);router['delete']('/:id',auth[_0x5adc('0x5')](),controller['destroy']);module[_0x5adc('0x10')]=router; \ No newline at end of file +var _0xb088=['./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','/:id/configurations','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xe4d6c6,_0x3bdbf2){var _0x3a8935=function(_0x131483){while(--_0x131483){_0xe4d6c6['push'](_0xe4d6c6['shift']());}};_0x3a8935(++_0x3bdbf2);}(_0xb088,0x1b1));var _0x8b08=function(_0x234589,_0x2e8250){_0x234589=_0x234589-0x0;var _0x3effa1=_0xb088[_0x234589];return _0x3effa1;};'use strict';var multer=require(_0x8b08('0x0'));var util=require('util');var path=require(_0x8b08('0x1'));var timeout=require(_0x8b08('0x2'));var express=require(_0x8b08('0x3'));var router=express[_0x8b08('0x4')]();var auth=require(_0x8b08('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b08('0x6'));var controller=require(_0x8b08('0x7'));router[_0x8b08('0x8')]('/',auth[_0x8b08('0x9')](),controller[_0x8b08('0xa')]);router[_0x8b08('0x8')](_0x8b08('0xb'),auth[_0x8b08('0x9')](),controller[_0x8b08('0xc')]);router[_0x8b08('0x8')]('/:id/configurations',auth[_0x8b08('0x9')](),controller[_0x8b08('0xd')]);router[_0x8b08('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8b08('0xe')]);router['post']('/',auth[_0x8b08('0x9')](),controller['create']);router[_0x8b08('0xf')](_0x8b08('0x10'),auth[_0x8b08('0x9')](),controller['addConfiguration']);router[_0x8b08('0x11')]('/:id',auth[_0x8b08('0x9')](),controller[_0x8b08('0x12')]);router[_0x8b08('0x13')](_0x8b08('0xb'),auth[_0x8b08('0x9')](),controller[_0x8b08('0x14')]);module[_0x8b08('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index c624eb0..61088b5 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 _0xc242=['remoteUri','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc242,0x73));var _0x2c24=function(_0x2c978b,_0x15fb74){_0x2c978b=_0x2c978b-0x0;var _0x795d80=_0xc242[_0x2c978b];return _0x795d80;};'use strict';var Sequelize=require(_0x2c24('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c24('0x1')]},'description':{'type':Sequelize[_0x2c24('0x1')]},'username':{'type':Sequelize[_0x2c24('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2c24('0x2')},'serverUrl':{'type':Sequelize[_0x2c24('0x1')]}}; \ No newline at end of file +var _0x9e94=['username','remoteUri','STRING'];(function(_0x49e888,_0x53a0be){var _0x263725=function(_0x29045c){while(--_0x29045c){_0x49e888['push'](_0x49e888['shift']());}};_0x263725(++_0x53a0be);}(_0x9e94,0xe0));var _0x49e9=function(_0x236316,_0x25d02b){_0x236316=_0x236316-0x0;var _0x18720a=_0x9e94[_0x236316];return _0x18720a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49e9('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x49e9('0x0')],'unique':_0x49e9('0x1')},'password':{'type':Sequelize[_0x49e9('0x0')]},'remoteUri':{'type':Sequelize[_0x49e9('0x0')],'unique':_0x49e9('0x2')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 9f8ff6e..b71b305 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 _0x4588=['date_start','duration_minutes','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','includes','label','statusCode','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../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','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','show','params','keys','find','body','getConfigurations','findOne','order','pick','AccountId','getSubjects','channel','getDescriptions','create','SugarcrmField','Subjects','Descriptions','assigned_user_id','description'];(function(_0x4d3acd,_0x394ae4){var _0x23bb42=function(_0x2cf51a){while(--_0x2cf51a){_0x4d3acd['push'](_0x4d3acd['shift']());}};_0x23bb42(++_0x394ae4);}(_0x4588,0x9c));var _0x8458=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x4588[_0x38a3d6];return _0x3768d7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8458('0x0'));var zipdir=require(_0x8458('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8458('0x2'));var moment=require(_0x8458('0x3'));var BPromise=require(_0x8458('0x4'));var Mustache=require(_0x8458('0x5'));var util=require(_0x8458('0x6'));var path=require(_0x8458('0x7'));var sox=require(_0x8458('0x8'));var csv=require(_0x8458('0x9'));var ejs=require(_0x8458('0xa'));var fs=require('fs');var _=require(_0x8458('0xb'));var squel=require(_0x8458('0xc'));var crypto=require(_0x8458('0xd'));var jsforce=require(_0x8458('0xe'));var deskjs=require(_0x8458('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8458('0x10'));var Papa=require(_0x8458('0x11'));var Redis=require(_0x8458('0x12'));var authService=require(_0x8458('0x13'));var qs=require(_0x8458('0x14'));var as=require(_0x8458('0x15'));var hardwareService=require(_0x8458('0x16'));var logger=require('../../config/logger')(_0x8458('0x17'));var utils=require('../../config/utils');var config=require(_0x8458('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8458('0x19'));var jayson=require(_0x8458('0x1a'));var client=jayson[_0x8458('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0xfae40f,_0x47c4a6,_0x1cfd2e){if(_0x1cfd2e){var _0x2a3a08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a3a08[_0x8458('0x1c')](_0x47c4a6)){return _0xfae40f;}else{throw new db[(_0x8458('0x1d'))][(_0x8458('0x1e'))](_0x8458('0x1f'));}}else{return _0xfae40f;}}function respondWithRpcPromise(_0xb96c2c,_0x121981,_0x53b747,_0x4dafcb){return new BPromise(function(_0x2e5da5,_0x4493b9){var _0x5150d8=_0x4dafcb||client;return _0x5150d8[_0x8458('0x20')](_0xb96c2c,_0x53b747)[_0x8458('0x21')](function(_0xd10635){logger[_0x8458('0x22')](_0x8458('0x23'),_0x121981,_0x8458('0x24'));logger[_0x8458('0x25')](_0x8458('0x26'),_0x121981,'request\x20sent',JSON[_0x8458('0x27')](_0xd10635));if(_0xd10635[_0x8458('0x28')]){if(_0xd10635['error'][_0x8458('0x29')]===0x1f4){logger[_0x8458('0x28')](_0x8458('0x23'),_0x121981,_0xd10635['error'][_0x8458('0x2a')]);return _0x4493b9(_0xd10635['error'][_0x8458('0x2a')]);}logger[_0x8458('0x28')](_0x8458('0x23'),_0x121981,_0xd10635[_0x8458('0x28')][_0x8458('0x2a')]);return _0x2e5da5(_0xd10635[_0x8458('0x28')][_0x8458('0x2a')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x121981,_0x8458('0x24'));_0x2e5da5(_0xd10635[_0x8458('0x2b')][_0x8458('0x2a')]);}})[_0x8458('0x2c')](function(_0x217945){logger[_0x8458('0x28')]('SugarcrmAccount,\x20%s,\x20%s',_0x121981,_0x217945);_0x4493b9(_0x217945);});});}function respondWithStatusCode(_0x2fd11f,_0x544af8){_0x544af8=_0x544af8||0xcc;return function(_0x4c56c9){if(_0x4c56c9){return _0x2fd11f[_0x8458('0x2d')](_0x544af8);}return _0x2fd11f[_0x8458('0x2e')](_0x544af8)[_0x8458('0x2f')]();};}function respondWithResult(_0x25b600,_0x4a9c14){_0x4a9c14=_0x4a9c14||0xc8;return function(_0x5ca6e0){if(_0x5ca6e0){return _0x25b600['status'](_0x4a9c14)[_0x8458('0x30')](_0x5ca6e0);}};}function respondWithFilteredResult(_0x10ce1a,_0x68d54f){return function(_0xc0b0a5){if(_0xc0b0a5){var _0x46104b=_0xc0b0a5[_0x8458('0x31')],_0x5f42b7=_0x68d54f[_0x8458('0x32')],_0x389373=_0x68d54f[_0x8458('0x32')]+_0x68d54f[_0x8458('0x33')],_0x396aef;if(_0x389373>=_0x46104b){_0x389373=_0x46104b;_0x396aef=0xc8;}else{_0x396aef=0xce;}_0x10ce1a[_0x8458('0x2e')](_0x396aef);return _0x10ce1a['set'](_0x8458('0x34'),_0x5f42b7+'-'+_0x389373+'/'+_0x46104b)[_0x8458('0x30')](_0xc0b0a5);}return null;};}function patchUpdates(_0x2a05d0){return function(_0x1bd69b){try{jsonpatch[_0x8458('0x35')](_0x1bd69b,_0x2a05d0,!![]);}catch(_0x36c3f7){return BPromise[_0x8458('0x36')](_0x36c3f7);}return _0x1bd69b[_0x8458('0x37')]();};}function saveUpdates(_0x13d72c,_0x3b13ef){return function(_0x48201d){if(_0x48201d){return _0x48201d[_0x8458('0x38')](_0x13d72c)[_0x8458('0x21')](function(_0x13745f){return _0x13745f;});}return null;};}function removeEntity(_0xb79b1a,_0x9c2828){return function(_0x27578f){if(_0x27578f){return _0x27578f[_0x8458('0x39')]()['then'](function(){_0xb79b1a[_0x8458('0x2e')](0xcc)[_0x8458('0x2f')]();});}};}function handleEntityNotFound(_0x54797d,_0x576062){return function(_0x41f48d){if(!_0x41f48d){_0x54797d['sendStatus'](0x194);}return _0x41f48d;};}function handleError(_0x500907,_0x4d5870){_0x4d5870=_0x4d5870||0x1f4;return function(_0x39ad9a){logger[_0x8458('0x28')](_0x39ad9a[_0x8458('0x3a')]);if(_0x39ad9a['name']){delete _0x39ad9a[_0x8458('0x3b')];}_0x500907[_0x8458('0x2e')](_0x4d5870)[_0x8458('0x3c')](_0x39ad9a);};}exports[_0x8458('0x3d')]=function(_0x239332,_0xa18f7e){var _0x322e24={},_0x401b34={},_0x50d18e={'count':0x0,'rows':[]};var _0x4291da=_[_0x8458('0x3e')](db[_0x8458('0x3f')][_0x8458('0x40')],function(_0x4a9572){return{'name':_0x4a9572[_0x8458('0x41')],'type':_0x4a9572[_0x8458('0x42')][_0x8458('0x43')]};});_0x401b34[_0x8458('0x44')]=_[_0x8458('0x3e')](_0x4291da,_0x8458('0x3b'));_0x401b34[_0x8458('0x45')]=_['keys'](_0x239332[_0x8458('0x45')]);_0x401b34[_0x8458('0x46')]=_[_0x8458('0x47')](_0x401b34['model'],_0x401b34[_0x8458('0x45')]);_0x322e24[_0x8458('0x48')]=_['intersection'](_0x401b34[_0x8458('0x44')],qs[_0x8458('0x49')](_0x239332[_0x8458('0x45')][_0x8458('0x49')]));_0x322e24[_0x8458('0x48')]=_0x322e24[_0x8458('0x48')][_0x8458('0x4a')]?_0x322e24[_0x8458('0x48')]:_0x401b34[_0x8458('0x44')];if(!_0x239332[_0x8458('0x45')][_0x8458('0x4b')](_0x8458('0x4c'))){_0x322e24[_0x8458('0x33')]=qs[_0x8458('0x33')](_0x239332['query']['limit']);_0x322e24[_0x8458('0x32')]=qs[_0x8458('0x32')](_0x239332[_0x8458('0x45')][_0x8458('0x32')]);}_0x322e24['order']=qs[_0x8458('0x4d')](_0x239332['query'][_0x8458('0x4d')]);_0x322e24['where']=qs[_0x8458('0x46')](_['pick'](_0x239332[_0x8458('0x45')],_0x401b34['filters']),_0x4291da);if(_0x239332['query'][_0x8458('0x4e')]){_0x322e24['where']=_['merge'](_0x322e24['where'],{'$or':_[_0x8458('0x3e')](_0x4291da,function(_0x134dea){if(_0x134dea[_0x8458('0x42')]!==_0x8458('0x4f')){var _0x1667dd={};_0x1667dd[_0x134dea[_0x8458('0x3b')]]={'$like':'%'+_0x239332['query'][_0x8458('0x4e')]+'%'};return _0x1667dd;}})});}_0x322e24=_[_0x8458('0x50')]({},_0x322e24,_0x239332[_0x8458('0x51')]);var _0x1f8344={'where':_0x322e24[_0x8458('0x52')]};return db[_0x8458('0x3f')][_0x8458('0x31')](_0x1f8344)[_0x8458('0x21')](function(_0x4191f8){_0x50d18e[_0x8458('0x31')]=_0x4191f8;if(_0x239332[_0x8458('0x45')][_0x8458('0x53')]){_0x322e24[_0x8458('0x54')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x8458('0x55')](_0x322e24);})[_0x8458('0x21')](function(_0x2a6ad9){_0x50d18e[_0x8458('0x56')]=_0x2a6ad9;return _0x50d18e;})[_0x8458('0x21')](respondWithFilteredResult(_0xa18f7e,_0x322e24))['catch'](handleError(_0xa18f7e,null));};exports[_0x8458('0x57')]=function(_0x31e7fb,_0x506a57){var _0x2bccca={'raw':![],'where':{'id':_0x31e7fb[_0x8458('0x58')]['id']}},_0x536491={};_0x536491['model']=_['keys'](db[_0x8458('0x3f')][_0x8458('0x40')]);_0x536491[_0x8458('0x45')]=_[_0x8458('0x59')](_0x31e7fb[_0x8458('0x45')]);_0x536491[_0x8458('0x46')]=_[_0x8458('0x47')](_0x536491[_0x8458('0x44')],_0x536491[_0x8458('0x45')]);_0x2bccca[_0x8458('0x48')]=_[_0x8458('0x47')](_0x536491[_0x8458('0x44')],qs['fields'](_0x31e7fb[_0x8458('0x45')][_0x8458('0x49')]));_0x2bccca[_0x8458('0x48')]=_0x2bccca['attributes']['length']?_0x2bccca[_0x8458('0x48')]:_0x536491[_0x8458('0x44')];if(_0x31e7fb[_0x8458('0x45')][_0x8458('0x53')]){_0x2bccca[_0x8458('0x54')]=[{'all':!![]}];}_0x2bccca=_['merge']({},_0x2bccca,_0x31e7fb['options']);return db[_0x8458('0x3f')][_0x8458('0x5a')](_0x2bccca)[_0x8458('0x21')](handleEntityNotFound(_0x506a57,null))[_0x8458('0x21')](respondWithResult(_0x506a57,null))[_0x8458('0x2c')](handleError(_0x506a57,null));};exports['create']=function(_0x546b47,_0x433a3b){return db[_0x8458('0x3f')]['create'](_0x546b47[_0x8458('0x5b')],{})[_0x8458('0x21')](respondWithResult(_0x433a3b,0xc9))[_0x8458('0x2c')](handleError(_0x433a3b,null));};exports[_0x8458('0x38')]=function(_0x449992,_0x2d5f85){if(_0x449992['body']['id']){delete _0x449992['body']['id'];}return db[_0x8458('0x3f')][_0x8458('0x5a')]({'where':{'id':_0x449992[_0x8458('0x58')]['id']}})[_0x8458('0x21')](handleEntityNotFound(_0x2d5f85,null))[_0x8458('0x21')](saveUpdates(_0x449992[_0x8458('0x5b')],null))[_0x8458('0x21')](respondWithResult(_0x2d5f85,null))[_0x8458('0x2c')](handleError(_0x2d5f85,null));};exports['destroy']=function(_0x78801c,_0x386f34){return db[_0x8458('0x3f')][_0x8458('0x5a')]({'where':{'id':_0x78801c[_0x8458('0x58')]['id']}})[_0x8458('0x21')](handleEntityNotFound(_0x386f34,null))[_0x8458('0x21')](removeEntity(_0x386f34,null))[_0x8458('0x2c')](handleError(_0x386f34,null));};exports[_0x8458('0x5c')]=function(_0x4c1be2,_0x38d5c3,_0x3f9d07){var _0x3fbe3f={};var _0x27320d={};var _0x5ad14c;var _0x516094;return db['SugarcrmAccount'][_0x8458('0x5d')]({'where':{'id':_0x4c1be2[_0x8458('0x58')]['id']}})[_0x8458('0x21')](handleEntityNotFound(_0x38d5c3,null))['then'](function(_0x1871c1){if(_0x1871c1){_0x5ad14c=_0x1871c1;_0x27320d[_0x8458('0x44')]=_[_0x8458('0x59')](db['SugarcrmConfiguration']['rawAttributes']);_0x27320d[_0x8458('0x45')]=_[_0x8458('0x59')](_0x4c1be2['query']);_0x27320d[_0x8458('0x46')]=_[_0x8458('0x47')](_0x27320d['model'],_0x27320d[_0x8458('0x45')]);_0x3fbe3f[_0x8458('0x48')]=_[_0x8458('0x47')](_0x27320d[_0x8458('0x44')],qs[_0x8458('0x49')](_0x4c1be2['query']['fields']));_0x3fbe3f[_0x8458('0x48')]=_0x3fbe3f[_0x8458('0x48')]['length']?_0x3fbe3f['attributes']:_0x27320d['model'];_0x3fbe3f[_0x8458('0x5e')]=qs[_0x8458('0x4d')](_0x4c1be2[_0x8458('0x45')][_0x8458('0x4d')]);_0x3fbe3f[_0x8458('0x52')]=qs['filters'](_[_0x8458('0x5f')](_0x4c1be2['query'],_0x27320d[_0x8458('0x46')]));if(_0x4c1be2[_0x8458('0x45')]['filter']){_0x3fbe3f[_0x8458('0x52')]=_[_0x8458('0x50')](_0x3fbe3f[_0x8458('0x52')],{'$or':_['map'](_0x3fbe3f['attributes'],function(_0x5a7974){var _0x23ced2={};_0x23ced2[_0x5a7974]={'$like':'%'+_0x4c1be2[_0x8458('0x45')][_0x8458('0x4e')]+'%'};return _0x23ced2;})});}_0x3fbe3f=_[_0x8458('0x50')]({},_0x3fbe3f,_0x4c1be2[_0x8458('0x51')]);return _0x5ad14c[_0x8458('0x5c')](_0x3fbe3f);}})[_0x8458('0x21')](function(_0x23710c){if(_0x23710c){_0x516094=_0x23710c[_0x8458('0x4a')];if(!_0x4c1be2[_0x8458('0x45')][_0x8458('0x4b')](_0x8458('0x4c'))){_0x3fbe3f[_0x8458('0x33')]=qs['limit'](_0x4c1be2[_0x8458('0x45')][_0x8458('0x33')]);_0x3fbe3f[_0x8458('0x32')]=qs[_0x8458('0x32')](_0x4c1be2[_0x8458('0x45')][_0x8458('0x32')]);}return _0x5ad14c[_0x8458('0x5c')](_0x3fbe3f);}})[_0x8458('0x21')](function(_0x5557c3){if(_0x5557c3){return _0x5557c3?{'count':_0x516094,'rows':_0x5557c3}:null;}})['then'](respondWithResult(_0x38d5c3,null))['catch'](handleError(_0x38d5c3,null));};exports['addConfiguration']=function(_0x47ba5f,_0x18014f,_0x35397a){if(_0x47ba5f[_0x8458('0x5b')]['id']){delete _0x47ba5f[_0x8458('0x5b')]['id'];}return db[_0x8458('0x3f')][_0x8458('0x5d')]({'where':{'id':_0x47ba5f['params']['id']}})[_0x8458('0x21')](handleEntityNotFound(_0x18014f,null))[_0x8458('0x21')](function(_0x250103){if(_0x250103){_0x47ba5f[_0x8458('0x5b')][_0x8458('0x60')]=_0x250103['id'];_0x47ba5f['body']['Subjects']=integrations[_0x8458('0x61')](_0x47ba5f[_0x8458('0x5b')][_0x8458('0x62')],_0x47ba5f['body']['type']);_0x47ba5f['body']['Descriptions']=integrations[_0x8458('0x63')](_0x47ba5f[_0x8458('0x5b')][_0x8458('0x62')],_0x47ba5f[_0x8458('0x5b')][_0x8458('0x42')]);return db['SugarcrmConfiguration'][_0x8458('0x64')](_0x47ba5f[_0x8458('0x5b')],{'include':[{'model':db[_0x8458('0x65')],'as':_0x8458('0x66')},{'model':db[_0x8458('0x65')],'as':_0x8458('0x67')}]});}return null;})['then'](respondWithResult(_0x18014f,null))[_0x8458('0x2c')](handleError(_0x18014f,null));};exports['getFields']=function(_0x279e25,_0x3732dd,_0x24a672){var _0x4bb47f='';var _0x56cabf=['id','name',_0x8458('0x68'),'created_by',_0x8458('0x69'),_0x8458('0x6a'),'duration_hours',_0x8458('0x6b'),'parent_id','parent_type','parent_name',_0x8458('0x6c')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x279e25[_0x8458('0x58')]['id']},'attributes':['id','username',_0x8458('0x6d'),_0x8458('0x6e')]})[_0x8458('0x21')](handleEntityNotFound(_0x3732dd,null))[_0x8458('0x21')](function(_0x49ed16){if(_0x49ed16){_0x4bb47f=_0x49ed16['remoteUri'];var _0x297949=_0x4bb47f[_0x8458('0x6f')](-0x1);if(_0x297949==='/'){_0x4bb47f=_0x4bb47f[_0x8458('0x70')](0x0,_0x4bb47f[_0x8458('0x71')](_0x297949));}return rp({'method':_0x8458('0x72'),'uri':util[_0x8458('0x73')](_0x8458('0x74'),_0x4bb47f,_0x8458('0x75')),'json':!![],'form':{'method':'login','input_type':_0x8458('0x76'),'response_type':_0x8458('0x76'),'rest_data':JSON[_0x8458('0x27')]({'user_auth':{'user_name':_0x49ed16[_0x8458('0x77')],'password':_0x49ed16[_0x8458('0x6d')],'encryption':'PLAIN'},'application':_0x8458('0x78')})}});}})[_0x8458('0x21')](function(_0x40d80c){if(_0x40d80c&&_0x40d80c['name']!==_0x8458('0x79')&&_0x40d80c[_0x8458('0x3b')]!=='Password\x20Expired'){return rp({'method':_0x8458('0x72'),'uri':util[_0x8458('0x73')](_0x8458('0x74'),_0x4bb47f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8458('0x7a'),'input_type':_0x8458('0x76'),'response_type':_0x8458('0x76'),'rest_data':JSON[_0x8458('0x27')]({'session':_0x40d80c['id'],'module_name':_0x8458('0x7b')})}})['then'](function(_0x357309){if(_0x357309){var _0x11efd5=_[_0x8458('0x7c')](_0x357309[_0x8458('0x7d')]);_[_0x8458('0x7e')](_0x11efd5,function(_0x259701){return _0x56cabf[_0x8458('0x7f')](_0x259701[_0x8458('0x3b')]);});return{'count':_0x11efd5['length'],'rows':_[_0x8458('0x3e')](_0x11efd5,function(_0x325b85){return{'id':_0x325b85[_0x8458('0x3b')],'name':_0x325b85[_0x8458('0x80')],'custom':_['endsWith'](_0x325b85[_0x8458('0x3b')],'_c')?!![]:![],'options':_0x325b85['options']?_[_0x8458('0x3e')](_['values'](_0x325b85[_0x8458('0x51')]),function(_0x5eb7e3){return{'name':_0x5eb7e3['value'],'value':_0x5eb7e3[_0x8458('0x3b')]};}):[]};})};}})[_0x8458('0x21')](respondWithResult(_0x3732dd,null))['catch'](function(_0x289554){var _0x3e6a01=_0x279e25[_0x8458('0x45')]['test']?0x1f4:_0x289554[_0x8458('0x81')]||0x1f4;logger[_0x8458('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3e6a01,JSON[_0x8458('0x27')](_0x289554));delete _0x289554['name'];if(_0x3e6a01===0x191){_0x3e6a01=0x190;}_0x3732dd['status'](_0x3e6a01)['send'](_0x279e25[_0x8458('0x45')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x289554[_0x8458('0x81')]}:_0x289554);});}else{var _0x4aa73a=0x1f4;_0x3732dd['status'](_0x4aa73a)[_0x8458('0x3c')]({'message':_0x8458('0x82'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xe517=['end','json','count','offset','limit','apply','save','update','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','params','length','find','create','body','destroy','getConfigurations','SugarcrmConfiguration','pick','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','duration_hours','parent_type','parent_name','direction','username','remoteUri','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status'];(function(_0x30927f,_0x125246){var _0x1b7e1e=function(_0x187590){while(--_0x187590){_0x30927f['push'](_0x30927f['shift']());}};_0x1b7e1e(++_0x125246);}(_0xe517,0x15e));var _0x7e51=function(_0x9a0d13,_0x4dd805){_0x9a0d13=_0x9a0d13-0x0;var _0x250f69=_0xe517[_0x9a0d13];return _0x250f69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7e51('0x0'));var rimraf=require(_0x7e51('0x1'));var zipdir=require(_0x7e51('0x2'));var jsonpatch=require(_0x7e51('0x3'));var rp=require('request-promise');var moment=require(_0x7e51('0x4'));var BPromise=require(_0x7e51('0x5'));var Mustache=require('mustache');var util=require(_0x7e51('0x6'));var path=require(_0x7e51('0x7'));var sox=require(_0x7e51('0x8'));var csv=require(_0x7e51('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e51('0xa'));var squel=require(_0x7e51('0xb'));var crypto=require('crypto');var jsforce=require(_0x7e51('0xc'));var deskjs=require(_0x7e51('0xd'));var toCsv=require(_0x7e51('0x9'));var querystring=require(_0x7e51('0xe'));var Papa=require(_0x7e51('0xf'));var Redis=require(_0x7e51('0x10'));var authService=require(_0x7e51('0x11'));var qs=require(_0x7e51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e51('0x13'));var logger=require(_0x7e51('0x14'))(_0x7e51('0x15'));var utils=require(_0x7e51('0x16'));var config=require(_0x7e51('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7e51('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x7e51('0x19')][_0x7e51('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x38cfd0,_0x246183,_0x117579){if(_0x117579){var _0x228f81=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x228f81[_0x7e51('0x1b')](_0x246183)){return _0x38cfd0;}else{throw new db[(_0x7e51('0x1c'))][(_0x7e51('0x1d'))](_0x7e51('0x1e'));}}else{return _0x38cfd0;}}function respondWithRpcPromise(_0x15ce6d,_0x12a237,_0x2674fd,_0x4c4886){return new BPromise(function(_0x4c117d,_0x3a454){var _0x4160e2=_0x4c4886||client;return _0x4160e2[_0x7e51('0x1f')](_0x15ce6d,_0x2674fd)[_0x7e51('0x20')](function(_0x530001){logger[_0x7e51('0x21')](_0x7e51('0x22'),_0x12a237,_0x7e51('0x23'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x12a237,_0x7e51('0x23'),JSON[_0x7e51('0x24')](_0x530001));if(_0x530001['error']){if(_0x530001[_0x7e51('0x25')][_0x7e51('0x26')]===0x1f4){logger[_0x7e51('0x25')](_0x7e51('0x22'),_0x12a237,_0x530001['error'][_0x7e51('0x27')]);return _0x3a454(_0x530001[_0x7e51('0x25')][_0x7e51('0x27')]);}logger[_0x7e51('0x25')]('SugarcrmAccount,\x20%s,\x20%s',_0x12a237,_0x530001['error']['message']);return _0x4c117d(_0x530001['error'][_0x7e51('0x27')]);}else{logger['info'](_0x7e51('0x22'),_0x12a237,_0x7e51('0x23'));_0x4c117d(_0x530001[_0x7e51('0x28')][_0x7e51('0x27')]);}})['catch'](function(_0xb3117){logger[_0x7e51('0x25')](_0x7e51('0x22'),_0x12a237,_0xb3117);_0x3a454(_0xb3117);});});}function respondWithStatusCode(_0x5ef75c,_0x239a46){_0x239a46=_0x239a46||0xcc;return function(_0x231c8d){if(_0x231c8d){return _0x5ef75c[_0x7e51('0x29')](_0x239a46);}return _0x5ef75c[_0x7e51('0x2a')](_0x239a46)[_0x7e51('0x2b')]();};}function respondWithResult(_0x23cdc3,_0x219b0c){_0x219b0c=_0x219b0c||0xc8;return function(_0x352e6e){if(_0x352e6e){return _0x23cdc3[_0x7e51('0x2a')](_0x219b0c)[_0x7e51('0x2c')](_0x352e6e);}};}function respondWithFilteredResult(_0x199518,_0x3b5a16){return function(_0x26f547){if(_0x26f547){var _0x2be78c=_0x26f547[_0x7e51('0x2d')],_0x225ebb=_0x3b5a16['offset'],_0x589a15=_0x3b5a16[_0x7e51('0x2e')]+_0x3b5a16[_0x7e51('0x2f')],_0x51c978;if(_0x589a15>=_0x2be78c){_0x589a15=_0x2be78c;_0x51c978=0xc8;}else{_0x51c978=0xce;}_0x199518['status'](_0x51c978);return _0x199518['set']('Content-Range',_0x225ebb+'-'+_0x589a15+'/'+_0x2be78c)[_0x7e51('0x2c')](_0x26f547);}return null;};}function patchUpdates(_0x32a715){return function(_0x3ee6fa){try{jsonpatch[_0x7e51('0x30')](_0x3ee6fa,_0x32a715,!![]);}catch(_0x303252){return BPromise['reject'](_0x303252);}return _0x3ee6fa[_0x7e51('0x31')]();};}function saveUpdates(_0x2ba784,_0x5c3e74){return function(_0xf5ad6a){if(_0xf5ad6a){return _0xf5ad6a[_0x7e51('0x32')](_0x2ba784)[_0x7e51('0x20')](function(_0x17eb19){return _0x17eb19;});}return null;};}function removeEntity(_0x23bbda,_0x5b8ec5){return function(_0x1ca473){if(_0x1ca473){return _0x1ca473['destroy']()['then'](function(){_0x23bbda[_0x7e51('0x2a')](0xcc)[_0x7e51('0x2b')]();});}};}function handleEntityNotFound(_0x32fff9,_0x19caf2){return function(_0x217a65){if(!_0x217a65){_0x32fff9['sendStatus'](0x194);}return _0x217a65;};}function handleError(_0x33670b,_0x6e0a79){_0x6e0a79=_0x6e0a79||0x1f4;return function(_0x163070){logger['error'](_0x163070['stack']);if(_0x163070['name']){delete _0x163070[_0x7e51('0x33')];}_0x33670b['status'](_0x6e0a79)['send'](_0x163070);};}exports[_0x7e51('0x34')]=function(_0x34be02,_0x19da5e){var _0x472784={},_0x1b9b4c={},_0x44f9d3={'count':0x0,'rows':[]};var _0x2210d3=_[_0x7e51('0x35')](db[_0x7e51('0x36')][_0x7e51('0x37')],function(_0x3fe822){return{'name':_0x3fe822[_0x7e51('0x38')],'type':_0x3fe822['type'][_0x7e51('0x39')]};});_0x1b9b4c[_0x7e51('0x3a')]=_[_0x7e51('0x35')](_0x2210d3,_0x7e51('0x33'));_0x1b9b4c[_0x7e51('0x3b')]=_[_0x7e51('0x3c')](_0x34be02[_0x7e51('0x3b')]);_0x1b9b4c[_0x7e51('0x3d')]=_[_0x7e51('0x3e')](_0x1b9b4c['model'],_0x1b9b4c[_0x7e51('0x3b')]);_0x472784[_0x7e51('0x3f')]=_['intersection'](_0x1b9b4c['model'],qs[_0x7e51('0x40')](_0x34be02[_0x7e51('0x3b')][_0x7e51('0x40')]));_0x472784[_0x7e51('0x3f')]=_0x472784[_0x7e51('0x3f')]['length']?_0x472784[_0x7e51('0x3f')]:_0x1b9b4c[_0x7e51('0x3a')];if(!_0x34be02[_0x7e51('0x3b')][_0x7e51('0x41')]('nolimit')){_0x472784['limit']=qs[_0x7e51('0x2f')](_0x34be02[_0x7e51('0x3b')][_0x7e51('0x2f')]);_0x472784['offset']=qs[_0x7e51('0x2e')](_0x34be02['query'][_0x7e51('0x2e')]);}_0x472784[_0x7e51('0x42')]=qs[_0x7e51('0x43')](_0x34be02[_0x7e51('0x3b')][_0x7e51('0x43')]);_0x472784['where']=qs['filters'](_['pick'](_0x34be02[_0x7e51('0x3b')],_0x1b9b4c[_0x7e51('0x3d')]),_0x2210d3);if(_0x34be02[_0x7e51('0x3b')][_0x7e51('0x44')]){_0x472784['where']=_[_0x7e51('0x45')](_0x472784[_0x7e51('0x46')],{'$or':_[_0x7e51('0x35')](_0x2210d3,function(_0x221737){if(_0x221737['type']!==_0x7e51('0x47')){var _0x370995={};_0x370995[_0x221737[_0x7e51('0x33')]]={'$like':'%'+_0x34be02[_0x7e51('0x3b')]['filter']+'%'};return _0x370995;}})});}_0x472784=_[_0x7e51('0x45')]({},_0x472784,_0x34be02[_0x7e51('0x48')]);var _0x38c341={'where':_0x472784[_0x7e51('0x46')]};return db[_0x7e51('0x36')]['count'](_0x38c341)[_0x7e51('0x20')](function(_0x1a03c7){_0x44f9d3[_0x7e51('0x2d')]=_0x1a03c7;if(_0x34be02[_0x7e51('0x3b')]['includeAll']){_0x472784[_0x7e51('0x49')]=[{'all':!![]}];}return db[_0x7e51('0x36')][_0x7e51('0x4a')](_0x472784);})['then'](function(_0x568812){_0x44f9d3['rows']=_0x568812;return _0x44f9d3;})['then'](respondWithFilteredResult(_0x19da5e,_0x472784))[_0x7e51('0x4b')](handleError(_0x19da5e,null));};exports[_0x7e51('0x4c')]=function(_0x3e8104,_0x3f43d0){var _0x1a3b4a={'raw':![],'where':{'id':_0x3e8104[_0x7e51('0x4d')]['id']}},_0x175f07={};_0x175f07['model']=_[_0x7e51('0x3c')](db[_0x7e51('0x36')][_0x7e51('0x37')]);_0x175f07['query']=_['keys'](_0x3e8104[_0x7e51('0x3b')]);_0x175f07[_0x7e51('0x3d')]=_['intersection'](_0x175f07[_0x7e51('0x3a')],_0x175f07[_0x7e51('0x3b')]);_0x1a3b4a[_0x7e51('0x3f')]=_[_0x7e51('0x3e')](_0x175f07[_0x7e51('0x3a')],qs[_0x7e51('0x40')](_0x3e8104[_0x7e51('0x3b')][_0x7e51('0x40')]));_0x1a3b4a[_0x7e51('0x3f')]=_0x1a3b4a[_0x7e51('0x3f')][_0x7e51('0x4e')]?_0x1a3b4a[_0x7e51('0x3f')]:_0x175f07['model'];if(_0x3e8104[_0x7e51('0x3b')]['includeAll']){_0x1a3b4a[_0x7e51('0x49')]=[{'all':!![]}];}_0x1a3b4a=_['merge']({},_0x1a3b4a,_0x3e8104[_0x7e51('0x48')]);return db[_0x7e51('0x36')][_0x7e51('0x4f')](_0x1a3b4a)[_0x7e51('0x20')](handleEntityNotFound(_0x3f43d0,null))[_0x7e51('0x20')](respondWithResult(_0x3f43d0,null))[_0x7e51('0x4b')](handleError(_0x3f43d0,null));};exports[_0x7e51('0x50')]=function(_0x104f60,_0x54f209){return db[_0x7e51('0x36')]['create'](_0x104f60[_0x7e51('0x51')],{})[_0x7e51('0x20')](respondWithResult(_0x54f209,0xc9))[_0x7e51('0x4b')](handleError(_0x54f209,null));};exports[_0x7e51('0x32')]=function(_0x41c025,_0x3e59b2){if(_0x41c025[_0x7e51('0x51')]['id']){delete _0x41c025[_0x7e51('0x51')]['id'];}return db[_0x7e51('0x36')][_0x7e51('0x4f')]({'where':{'id':_0x41c025[_0x7e51('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e59b2,null))[_0x7e51('0x20')](saveUpdates(_0x41c025[_0x7e51('0x51')],null))[_0x7e51('0x20')](respondWithResult(_0x3e59b2,null))[_0x7e51('0x4b')](handleError(_0x3e59b2,null));};exports[_0x7e51('0x52')]=function(_0x56b665,_0x2108e3){return db[_0x7e51('0x36')]['find']({'where':{'id':_0x56b665[_0x7e51('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2108e3,null))[_0x7e51('0x20')](removeEntity(_0x2108e3,null))['catch'](handleError(_0x2108e3,null));};exports[_0x7e51('0x53')]=function(_0x2342fe,_0x5776ed,_0xaed464){var _0x846c14={};var _0x294426={};var _0x5e9de3;var _0x3d1562;return db[_0x7e51('0x36')]['findOne']({'where':{'id':_0x2342fe[_0x7e51('0x4d')]['id']}})[_0x7e51('0x20')](handleEntityNotFound(_0x5776ed,null))[_0x7e51('0x20')](function(_0x41e90a){if(_0x41e90a){_0x5e9de3=_0x41e90a;_0x294426[_0x7e51('0x3a')]=_['keys'](db[_0x7e51('0x54')][_0x7e51('0x37')]);_0x294426['query']=_[_0x7e51('0x3c')](_0x2342fe[_0x7e51('0x3b')]);_0x294426[_0x7e51('0x3d')]=_[_0x7e51('0x3e')](_0x294426[_0x7e51('0x3a')],_0x294426['query']);_0x846c14[_0x7e51('0x3f')]=_[_0x7e51('0x3e')](_0x294426[_0x7e51('0x3a')],qs[_0x7e51('0x40')](_0x2342fe[_0x7e51('0x3b')]['fields']));_0x846c14['attributes']=_0x846c14[_0x7e51('0x3f')][_0x7e51('0x4e')]?_0x846c14['attributes']:_0x294426[_0x7e51('0x3a')];_0x846c14[_0x7e51('0x42')]=qs['sort'](_0x2342fe['query'][_0x7e51('0x43')]);_0x846c14[_0x7e51('0x46')]=qs[_0x7e51('0x3d')](_[_0x7e51('0x55')](_0x2342fe[_0x7e51('0x3b')],_0x294426['filters']));if(_0x2342fe['query'][_0x7e51('0x44')]){_0x846c14[_0x7e51('0x46')]=_[_0x7e51('0x45')](_0x846c14[_0x7e51('0x46')],{'$or':_['map'](_0x846c14[_0x7e51('0x3f')],function(_0x5c33f7){var _0x299cbd={};_0x299cbd[_0x5c33f7]={'$like':'%'+_0x2342fe[_0x7e51('0x3b')][_0x7e51('0x44')]+'%'};return _0x299cbd;})});}_0x846c14=_[_0x7e51('0x45')]({},_0x846c14,_0x2342fe[_0x7e51('0x48')]);return _0x5e9de3['getConfigurations'](_0x846c14);}})[_0x7e51('0x20')](function(_0x324ade){if(_0x324ade){_0x3d1562=_0x324ade[_0x7e51('0x4e')];if(!_0x2342fe[_0x7e51('0x3b')][_0x7e51('0x41')](_0x7e51('0x56'))){_0x846c14[_0x7e51('0x2f')]=qs['limit'](_0x2342fe[_0x7e51('0x3b')][_0x7e51('0x2f')]);_0x846c14['offset']=qs[_0x7e51('0x2e')](_0x2342fe['query'][_0x7e51('0x2e')]);}return _0x5e9de3[_0x7e51('0x53')](_0x846c14);}})['then'](function(_0x14adaf){if(_0x14adaf){return _0x14adaf?{'count':_0x3d1562,'rows':_0x14adaf}:null;}})[_0x7e51('0x20')](respondWithResult(_0x5776ed,null))[_0x7e51('0x4b')](handleError(_0x5776ed,null));};exports[_0x7e51('0x57')]=function(_0x528ae7,_0x478d9b,_0x5b4f9b){if(_0x528ae7['body']['id']){delete _0x528ae7[_0x7e51('0x51')]['id'];}return db[_0x7e51('0x36')][_0x7e51('0x58')]({'where':{'id':_0x528ae7[_0x7e51('0x4d')]['id']}})['then'](handleEntityNotFound(_0x478d9b,null))['then'](function(_0x59719d){if(_0x59719d){_0x528ae7['body'][_0x7e51('0x59')]=_0x59719d['id'];_0x528ae7[_0x7e51('0x51')][_0x7e51('0x5a')]=integrations[_0x7e51('0x5b')](_0x528ae7[_0x7e51('0x51')][_0x7e51('0x5c')],_0x528ae7[_0x7e51('0x51')][_0x7e51('0x5d')]);_0x528ae7['body'][_0x7e51('0x5e')]=integrations[_0x7e51('0x5f')](_0x528ae7['body'][_0x7e51('0x5c')],_0x528ae7[_0x7e51('0x51')][_0x7e51('0x5d')]);return db[_0x7e51('0x54')][_0x7e51('0x50')](_0x528ae7[_0x7e51('0x51')],{'include':[{'model':db[_0x7e51('0x60')],'as':_0x7e51('0x5a')},{'model':db[_0x7e51('0x60')],'as':_0x7e51('0x5e')}]});}return null;})[_0x7e51('0x20')](respondWithResult(_0x478d9b,null))[_0x7e51('0x4b')](handleError(_0x478d9b,null));};exports[_0x7e51('0x61')]=function(_0x1cc95c,_0x305ad1,_0x43f024){var _0x52fa6a='';var _0x5ee70b=['id',_0x7e51('0x33'),_0x7e51('0x62'),_0x7e51('0x63'),'description','date_start',_0x7e51('0x64'),'duration_minutes','parent_id',_0x7e51('0x65'),_0x7e51('0x66'),_0x7e51('0x67')];return db[_0x7e51('0x36')]['findOne']({'where':{'id':_0x1cc95c[_0x7e51('0x4d')]['id']},'attributes':['id',_0x7e51('0x68'),'password',_0x7e51('0x69')]})[_0x7e51('0x20')](handleEntityNotFound(_0x305ad1,null))['then'](function(_0x24bcdf){if(_0x24bcdf){_0x52fa6a=_0x24bcdf[_0x7e51('0x69')];var _0x2d0055=_0x52fa6a['slice'](-0x1);if(_0x2d0055==='/'){_0x52fa6a=_0x52fa6a[_0x7e51('0x6a')](0x0,_0x52fa6a[_0x7e51('0x6b')](_0x2d0055));}return rp({'method':_0x7e51('0x6c'),'uri':util[_0x7e51('0x6d')]('%s%s',_0x52fa6a,_0x7e51('0x6e')),'json':!![],'form':{'method':_0x7e51('0x6f'),'input_type':_0x7e51('0x70'),'response_type':_0x7e51('0x70'),'rest_data':JSON[_0x7e51('0x24')]({'user_auth':{'user_name':_0x24bcdf[_0x7e51('0x68')],'password':_0x24bcdf[_0x7e51('0x71')],'encryption':_0x7e51('0x72')},'application':_0x7e51('0x73')})}});}})['then'](function(_0x24eeca){if(_0x24eeca&&_0x24eeca[_0x7e51('0x33')]!==_0x7e51('0x74')&&_0x24eeca[_0x7e51('0x33')]!==_0x7e51('0x75')){return rp({'method':'POST','uri':util[_0x7e51('0x6d')](_0x7e51('0x76'),_0x52fa6a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x7e51('0x77'),'input_type':_0x7e51('0x70'),'response_type':_0x7e51('0x70'),'rest_data':JSON['stringify']({'session':_0x24eeca['id'],'module_name':_0x7e51('0x78')})}})[_0x7e51('0x20')](function(_0x3eb46f){if(_0x3eb46f){var _0x43e30f=_[_0x7e51('0x79')](_0x3eb46f[_0x7e51('0x7a')]);_[_0x7e51('0x7b')](_0x43e30f,function(_0x369fab){return _0x5ee70b[_0x7e51('0x7c')](_0x369fab['name']);});return{'count':_0x43e30f[_0x7e51('0x4e')],'rows':_[_0x7e51('0x35')](_0x43e30f,function(_0x19e136){return{'id':_0x19e136['name'],'name':_0x19e136[_0x7e51('0x7d')],'custom':_[_0x7e51('0x7e')](_0x19e136['name'],'_c')?!![]:![],'options':_0x19e136[_0x7e51('0x48')]?_[_0x7e51('0x35')](_[_0x7e51('0x79')](_0x19e136[_0x7e51('0x48')]),function(_0x4d532c){return{'name':_0x4d532c[_0x7e51('0x7f')],'value':_0x4d532c[_0x7e51('0x33')]};}):[]};})};}})['then'](respondWithResult(_0x305ad1,null))['catch'](function(_0x3665d2){var _0x3d8ec8=_0x1cc95c[_0x7e51('0x3b')]['test']?0x1f4:_0x3665d2[_0x7e51('0x80')]||0x1f4;logger[_0x7e51('0x25')](_0x7e51('0x81'),'getFields',_0x3d8ec8,JSON[_0x7e51('0x24')](_0x3665d2));delete _0x3665d2['name'];if(_0x3d8ec8===0x191){_0x3d8ec8=0x190;}_0x305ad1[_0x7e51('0x2a')](_0x3d8ec8)['send'](_0x1cc95c['query'][_0x7e51('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x3665d2[_0x7e51('0x80')]}:_0x3665d2);});}else{var _0x2baf04=0x1f4;_0x305ad1[_0x7e51('0x2a')](_0x2baf04)[_0x7e51('0x82')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 2baef00..f730cb1 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 _0xee84=['../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x5be3f8,_0xe2028d){var _0x15dacd=function(_0x1bc443){while(--_0x1bc443){_0x5be3f8['push'](_0x5be3f8['shift']());}};_0x15dacd(++_0xe2028d);}(_0xee84,0xcc));var _0x4ee8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xee84[_0x432682];return _0x463d05;};'use strict';var _=require(_0x4ee8('0x0'));var util=require(_0x4ee8('0x1'));var logger=require(_0x4ee8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ee8('0x3'));var rp=require(_0x4ee8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ee8('0x5'));var attributes=require(_0x4ee8('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x4ee8('0x7')]=function(_0x5bc23a,_0x8274fa){return _0x5bc23a[_0x4ee8('0x8')](_0x4ee8('0x9'),attributes,{'tableName':_0x4ee8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cbc=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0cbc,0xa7));var _0xc0cb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0cbc[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xc0cb('0x0'));var util=require(_0xc0cb('0x1'));var logger=require(_0xc0cb('0x2'))('api');var moment=require(_0xc0cb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc0cb('0x4'));var config=require('../../config/environment');var attributes=require(_0xc0cb('0x5'));var integrations=require(_0xc0cb('0x6'));module[_0xc0cb('0x7')]=function(_0x567e1c,_0x56aee2){return _0x567e1c[_0xc0cb('0x8')](_0xc0cb('0x9'),attributes,{'tableName':_0xc0cb('0xa'),'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 722f492..0353abc 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 _0x3d7a=['catch','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','where','attributes','limit','include','map','model','then','stringify','ShowSugarcrmAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x5757a1,_0xf93223){var _0x95b191=function(_0x5e5cf4){while(--_0x5e5cf4){_0x5757a1['push'](_0x5757a1['shift']());}};_0x95b191(++_0xf93223);}(_0x3d7a,0xa4));var _0xa3d7=function(_0x5c2d75,_0x4035fc){_0x5c2d75=_0x5c2d75-0x0;var _0x48f399=_0x3d7a[_0x5c2d75];return _0x48f399;};'use strict';var _=require(_0xa3d7('0x0'));var util=require(_0xa3d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3d7('0x2'));var fs=require('fs');var Redis=require(_0xa3d7('0x3'));var db=require(_0xa3d7('0x4'))['db'];var utils=require(_0xa3d7('0x5'));var logger=require(_0xa3d7('0x6'))(_0xa3d7('0x7'));var config=require(_0xa3d7('0x8'));var jayson=require(_0xa3d7('0x9'));var client=jayson[_0xa3d7('0xa')][_0xa3d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18f904,_0x23a2b5,_0x4320e7){return new BPromise(function(_0x1d8192,_0x367448){return client['request'](_0x18f904,_0x4320e7)['then'](function(_0x3ed1eb){logger[_0xa3d7('0xc')](_0xa3d7('0xd'),_0x23a2b5,'request\x20sent');logger[_0xa3d7('0xe')](_0xa3d7('0xf'),_0x23a2b5,_0xa3d7('0x10'),JSON['stringify'](_0x3ed1eb));if(_0x3ed1eb[_0xa3d7('0x11')]){if(_0x3ed1eb[_0xa3d7('0x11')][_0xa3d7('0x12')]===0x1f4){logger[_0xa3d7('0x11')](_0xa3d7('0xd'),_0x23a2b5,_0x3ed1eb[_0xa3d7('0x11')][_0xa3d7('0x13')]);return _0x367448(_0x3ed1eb['error'][_0xa3d7('0x13')]);}logger[_0xa3d7('0x11')](_0xa3d7('0xd'),_0x23a2b5,_0x3ed1eb[_0xa3d7('0x11')][_0xa3d7('0x13')]);return _0x1d8192(_0x3ed1eb[_0xa3d7('0x11')][_0xa3d7('0x13')]);}else{logger[_0xa3d7('0xc')](_0xa3d7('0xd'),_0x23a2b5,_0xa3d7('0x10'));_0x1d8192(_0x3ed1eb[_0xa3d7('0x14')][_0xa3d7('0x13')]);}})[_0xa3d7('0x15')](function(_0x18c779){logger[_0xa3d7('0x11')](_0xa3d7('0xd'),_0x23a2b5,_0x18c779);_0x367448(_0x18c779);});});}exports[_0xa3d7('0x16')]=function(_0x9578ce){var _0x5a4dff=this;return new Promise(function(_0x256716,_0x517e12){return db[_0xa3d7('0x17')][_0xa3d7('0x18')]({'raw':_0x9578ce['options']?_0x9578ce['options'][_0xa3d7('0x19')]===undefined?!![]:![]:!![],'where':_0x9578ce[_0xa3d7('0x1a')]?_0x9578ce[_0xa3d7('0x1a')][_0xa3d7('0x1b')]||null:null,'attributes':_0x9578ce[_0xa3d7('0x1a')]?_0x9578ce['options'][_0xa3d7('0x1c')]||null:null,'limit':_0x9578ce[_0xa3d7('0x1a')]?_0x9578ce[_0xa3d7('0x1a')][_0xa3d7('0x1d')]||null:null,'include':_0x9578ce[_0xa3d7('0x1a')]?_0x9578ce[_0xa3d7('0x1a')][_0xa3d7('0x1e')]?_[_0xa3d7('0x1f')](_0x9578ce[_0xa3d7('0x1a')][_0xa3d7('0x1e')],function(_0x3a39cb){return{'model':db[_0x3a39cb['model']],'as':_0x3a39cb['as'],'attributes':_0x3a39cb[_0xa3d7('0x1c')],'include':_0x3a39cb['include']?_['map'](_0x3a39cb['include'],function(_0x4e4493){return{'model':db[_0x4e4493[_0xa3d7('0x20')]],'as':_0x4e4493['as'],'attributes':_0x4e4493[_0xa3d7('0x1c')],'include':_0x4e4493[_0xa3d7('0x1e')]?_[_0xa3d7('0x1f')](_0x4e4493[_0xa3d7('0x1e')],function(_0x82a9f5){return{'model':db[_0x82a9f5['model']],'as':_0x82a9f5['as'],'attributes':_0x82a9f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xa3d7('0x21')](function(_0xa58d99){logger[_0xa3d7('0xc')](_0xa3d7('0x16'),_0x9578ce);logger[_0xa3d7('0xe')](_0xa3d7('0x16'),_0x9578ce,JSON[_0xa3d7('0x22')](_0xa58d99));_0x256716(_0xa58d99);})[_0xa3d7('0x15')](function(_0x533125){logger[_0xa3d7('0x11')](_0xa3d7('0x16'),_0x533125[_0xa3d7('0x13')],_0x9578ce);_0x517e12(_0x5a4dff[_0xa3d7('0x11')](0x1f4,_0x533125['message']));});});};exports[_0xa3d7('0x23')]=function(_0x414074){var _0x4b7bd4=this;return new Promise(function(_0x24104f,_0x2daaa0){return db[_0xa3d7('0x17')][_0xa3d7('0x24')]({'raw':_0x414074['options']?_0x414074['options']['raw']===undefined?!![]:![]:!![],'where':_0x414074[_0xa3d7('0x1a')]?_0x414074[_0xa3d7('0x1a')][_0xa3d7('0x1b')]||null:null,'attributes':_0x414074[_0xa3d7('0x1a')]?_0x414074['options'][_0xa3d7('0x1c')]||null:null,'include':_0x414074[_0xa3d7('0x1a')]?_0x414074[_0xa3d7('0x1a')][_0xa3d7('0x1e')]?_['map'](_0x414074[_0xa3d7('0x1a')][_0xa3d7('0x1e')],function(_0x1ba6f5){return{'model':db[_0x1ba6f5['model']],'as':_0x1ba6f5['as'],'attributes':_0x1ba6f5[_0xa3d7('0x1c')],'include':_0x1ba6f5[_0xa3d7('0x1e')]?_[_0xa3d7('0x1f')](_0x1ba6f5[_0xa3d7('0x1e')],function(_0x214ce1){return{'model':db[_0x214ce1[_0xa3d7('0x20')]],'as':_0x214ce1['as'],'attributes':_0x214ce1[_0xa3d7('0x1c')],'include':_0x214ce1[_0xa3d7('0x1e')]?_['map'](_0x214ce1[_0xa3d7('0x1e')],function(_0x19b15e){return{'model':db[_0x19b15e[_0xa3d7('0x20')]],'as':_0x19b15e['as'],'attributes':_0x19b15e[_0xa3d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa3d7('0x21')](function(_0xb9e024){logger[_0xa3d7('0xc')](_0xa3d7('0x23'),_0x414074);logger['debug'](_0xa3d7('0x23'),_0x414074,JSON['stringify'](_0xb9e024));_0x24104f(_0xb9e024);})[_0xa3d7('0x15')](function(_0x3e54d6){logger[_0xa3d7('0x11')](_0xa3d7('0x23'),_0x3e54d6[_0xa3d7('0x13')],_0x414074);_0x2daaa0(_0x4b7bd4[_0xa3d7('0x11')](0x1f4,_0x3e54d6[_0xa3d7('0x13')]));});});}; \ No newline at end of file +var _0x4330=['http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SugarcrmAccount','options','raw','where','limit','include','map','model','GetSugarcrmAccount','stringify','ShowSugarcrmAccount','find','attributes','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x4330,0x128));var _0x0433=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x4330[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0x0433('0x0'));var moment=require(_0x0433('0x1'));var BPromise=require(_0x0433('0x2'));var rs=require(_0x0433('0x3'));var fs=require('fs');var Redis=require(_0x0433('0x4'));var db=require(_0x0433('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0433('0x6'))('rpc');var config=require(_0x0433('0x7'));var jayson=require(_0x0433('0x8'));var client=jayson[_0x0433('0x9')][_0x0433('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b90fe,_0x8cbea9,_0x37de14){return new BPromise(function(_0x279cdd,_0x19f4c9){return client[_0x0433('0xb')](_0x1b90fe,_0x37de14)[_0x0433('0xc')](function(_0x245bf3){logger[_0x0433('0xd')](_0x0433('0xe'),_0x8cbea9,_0x0433('0xf'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x8cbea9,_0x0433('0xf'),JSON['stringify'](_0x245bf3));if(_0x245bf3[_0x0433('0x10')]){if(_0x245bf3[_0x0433('0x10')]['code']===0x1f4){logger[_0x0433('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x8cbea9,_0x245bf3[_0x0433('0x10')][_0x0433('0x11')]);return _0x19f4c9(_0x245bf3[_0x0433('0x10')][_0x0433('0x11')]);}logger[_0x0433('0x10')](_0x0433('0xe'),_0x8cbea9,_0x245bf3[_0x0433('0x10')]['message']);return _0x279cdd(_0x245bf3[_0x0433('0x10')][_0x0433('0x11')]);}else{logger[_0x0433('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x8cbea9,_0x0433('0xf'));_0x279cdd(_0x245bf3[_0x0433('0x12')][_0x0433('0x11')]);}})[_0x0433('0x13')](function(_0x2e983c){logger[_0x0433('0x10')](_0x0433('0xe'),_0x8cbea9,_0x2e983c);_0x19f4c9(_0x2e983c);});});}exports['GetSugarcrmAccount']=function(_0x3a19aa){var _0x483704=this;return new Promise(function(_0x4f3665,_0xcf6ebd){return db[_0x0433('0x14')]['findAll']({'raw':_0x3a19aa[_0x0433('0x15')]?_0x3a19aa[_0x0433('0x15')][_0x0433('0x16')]===undefined?!![]:![]:!![],'where':_0x3a19aa[_0x0433('0x15')]?_0x3a19aa['options'][_0x0433('0x17')]||null:null,'attributes':_0x3a19aa[_0x0433('0x15')]?_0x3a19aa[_0x0433('0x15')]['attributes']||null:null,'limit':_0x3a19aa[_0x0433('0x15')]?_0x3a19aa[_0x0433('0x15')][_0x0433('0x18')]||null:null,'include':_0x3a19aa[_0x0433('0x15')]?_0x3a19aa['options'][_0x0433('0x19')]?_[_0x0433('0x1a')](_0x3a19aa[_0x0433('0x15')][_0x0433('0x19')],function(_0x34df04){return{'model':db[_0x34df04['model']],'as':_0x34df04['as'],'attributes':_0x34df04['attributes'],'include':_0x34df04[_0x0433('0x19')]?_[_0x0433('0x1a')](_0x34df04['include'],function(_0x1025b6){return{'model':db[_0x1025b6['model']],'as':_0x1025b6['as'],'attributes':_0x1025b6['attributes'],'include':_0x1025b6['include']?_[_0x0433('0x1a')](_0x1025b6[_0x0433('0x19')],function(_0x378f34){return{'model':db[_0x378f34[_0x0433('0x1b')]],'as':_0x378f34['as'],'attributes':_0x378f34['attributes']};}):[]};}):[]};}):[]:[]})[_0x0433('0xc')](function(_0x350857){logger[_0x0433('0xd')](_0x0433('0x1c'),_0x3a19aa);logger['debug'](_0x0433('0x1c'),_0x3a19aa,JSON[_0x0433('0x1d')](_0x350857));_0x4f3665(_0x350857);})[_0x0433('0x13')](function(_0x23baad){logger['error'](_0x0433('0x1c'),_0x23baad[_0x0433('0x11')],_0x3a19aa);_0xcf6ebd(_0x483704[_0x0433('0x10')](0x1f4,_0x23baad[_0x0433('0x11')]));});});};exports[_0x0433('0x1e')]=function(_0x21ddcb){var _0x3f52de=this;return new Promise(function(_0x1ded05,_0x4241f){return db[_0x0433('0x14')][_0x0433('0x1f')]({'raw':_0x21ddcb['options']?_0x21ddcb['options'][_0x0433('0x16')]===undefined?!![]:![]:!![],'where':_0x21ddcb[_0x0433('0x15')]?_0x21ddcb['options'][_0x0433('0x17')]||null:null,'attributes':_0x21ddcb[_0x0433('0x15')]?_0x21ddcb[_0x0433('0x15')][_0x0433('0x20')]||null:null,'include':_0x21ddcb[_0x0433('0x15')]?_0x21ddcb[_0x0433('0x15')][_0x0433('0x19')]?_[_0x0433('0x1a')](_0x21ddcb[_0x0433('0x15')][_0x0433('0x19')],function(_0x5463ab){return{'model':db[_0x5463ab['model']],'as':_0x5463ab['as'],'attributes':_0x5463ab[_0x0433('0x20')],'include':_0x5463ab['include']?_['map'](_0x5463ab[_0x0433('0x19')],function(_0x222458){return{'model':db[_0x222458[_0x0433('0x1b')]],'as':_0x222458['as'],'attributes':_0x222458[_0x0433('0x20')],'include':_0x222458[_0x0433('0x19')]?_[_0x0433('0x1a')](_0x222458[_0x0433('0x19')],function(_0x5aaf1d){return{'model':db[_0x5aaf1d[_0x0433('0x1b')]],'as':_0x5aaf1d['as'],'attributes':_0x5aaf1d[_0x0433('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x334673){logger[_0x0433('0xd')]('ShowSugarcrmAccount',_0x21ddcb);logger[_0x0433('0x21')](_0x0433('0x1e'),_0x21ddcb,JSON[_0x0433('0x1d')](_0x334673));_0x1ded05(_0x334673);})[_0x0433('0x13')](function(_0x1a7755){logger[_0x0433('0x10')](_0x0433('0x1e'),_0x1a7755[_0x0433('0x11')],_0x21ddcb);_0x4241f(_0x3f52de[_0x0433('0x10')](0x1f4,_0x1a7755['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5b95486..3c886bc 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 _0xef5a=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','util','path','express'];(function(_0x221eb3,_0x285e44){var _0x5ac63d=function(_0x4e9459){while(--_0x4e9459){_0x221eb3['push'](_0x221eb3['shift']());}};_0x5ac63d(++_0x285e44);}(_0xef5a,0xb1));var _0xaef5=function(_0x38abcb,_0x4ea53e){_0x38abcb=_0x38abcb-0x0;var _0x37ea0d=_0xef5a[_0x38abcb];return _0x37ea0d;};'use strict';var multer=require('multer');var util=require(_0xaef5('0x0'));var path=require(_0xaef5('0x1'));var timeout=require('connect-timeout');var express=require(_0xaef5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xaef5('0x3'));var config=require(_0xaef5('0x4'));var controller=require(_0xaef5('0x5'));router[_0xaef5('0x6')]('/',auth[_0xaef5('0x7')](),controller['index']);router[_0xaef5('0x6')](_0xaef5('0x8'),auth['isAuthenticated'](),controller[_0xaef5('0x9')]);router[_0xaef5('0x6')]('/:id/fields',auth[_0xaef5('0x7')](),controller['getFields']);router[_0xaef5('0x6')](_0xaef5('0xa'),auth['isAuthenticated'](),controller[_0xaef5('0xb')]);router[_0xaef5('0x6')](_0xaef5('0xc'),auth['isAuthenticated'](),controller[_0xaef5('0xd')]);router[_0xaef5('0xe')]('/',auth[_0xaef5('0x7')](),controller[_0xaef5('0xf')]);router[_0xaef5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaef5('0x11')]);router['delete'](_0xaef5('0x8'),auth[_0xaef5('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x29bf=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29bf,0x1ce));var _0xf29b=function(_0x4a50ef,_0x1731bf){_0x4a50ef=_0x4a50ef-0x0;var _0x17ab1b=_0x29bf[_0x4a50ef];return _0x17ab1b;};'use strict';var multer=require(_0xf29b('0x0'));var util=require('util');var path=require(_0xf29b('0x1'));var timeout=require(_0xf29b('0x2'));var express=require('express');var router=express[_0xf29b('0x3')]();var auth=require(_0xf29b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf29b('0x5'));var controller=require(_0xf29b('0x6'));router[_0xf29b('0x7')]('/',auth[_0xf29b('0x8')](),controller[_0xf29b('0x9')]);router['get'](_0xf29b('0xa'),auth['isAuthenticated'](),controller[_0xf29b('0xb')]);router[_0xf29b('0x7')](_0xf29b('0xc'),auth[_0xf29b('0x8')](),controller[_0xf29b('0xd')]);router['get']('/:id/subjects',auth[_0xf29b('0x8')](),controller[_0xf29b('0xe')]);router[_0xf29b('0x7')](_0xf29b('0xf'),auth[_0xf29b('0x8')](),controller[_0xf29b('0x10')]);router[_0xf29b('0x11')]('/',auth['isAuthenticated'](),controller[_0xf29b('0x12')]);router[_0xf29b('0x13')](_0xf29b('0xa'),auth[_0xf29b('0x8')](),controller[_0xf29b('0x14')]);router['delete'](_0xf29b('0xa'),auth[_0xf29b('0x8')](),controller[_0xf29b('0x15')]);module[_0xf29b('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 633a7de..d8cafa8 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 _0x4fcc=['exports'];(function(_0x631577,_0x38e35d){var _0x517397=function(_0x4f9228){while(--_0x4f9228){_0x631577['push'](_0x631577['shift']());}};_0x517397(++_0x38e35d);}(_0x4fcc,0xfd));var _0xc4fc=function(_0x569283,_0x6bebbf){_0x569283=_0x569283-0x0;var _0x848726=_0x4fcc[_0x569283];return _0x848726;};'use strict';var Sequelize=require('sequelize');module[_0xc4fc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7600=['STRING','sequelize'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7600,0x8d));var _0x0760=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x7600[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0x0760('0x0'));module['exports']={'name':{'type':Sequelize[_0x0760('0x1')]},'description':{'type':Sequelize[_0x0760('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 7c8124c..9b662f9 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 _0xbd2d=['request\x20sent','debug','stringify','error','message','result','end','status','json','count','set','Content-Range','apply','reject','destroy','sendStatus','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','create','body','update','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x567f07,_0x306856){var _0x593033=function(_0x4c1402){while(--_0x4c1402){_0x567f07['push'](_0x567f07['shift']());}};_0x593033(++_0x306856);}(_0xbd2d,0x1ac));var _0xdbd2=function(_0x509d99,_0x54ebce){_0x509d99=_0x509d99-0x0;var _0x1ba9cb=_0xbd2d[_0x509d99];return _0x1ba9cb;};'use strict';var pdf=require(_0xdbd2('0x0'));var emlformat=require(_0xdbd2('0x1'));var rimraf=require(_0xdbd2('0x2'));var zipdir=require(_0xdbd2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbd2('0x4'));var moment=require(_0xdbd2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbd2('0x6'));var util=require(_0xdbd2('0x7'));var path=require('path');var sox=require(_0xdbd2('0x8'));var csv=require('to-csv');var ejs=require(_0xdbd2('0x9'));var fs=require('fs');var _=require(_0xdbd2('0xa'));var squel=require(_0xdbd2('0xb'));var crypto=require('crypto');var jsforce=require(_0xdbd2('0xc'));var deskjs=require(_0xdbd2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdbd2('0xe'));var Redis=require(_0xdbd2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdbd2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbd2('0x11'));var logger=require(_0xdbd2('0x12'))('api');var utils=require(_0xdbd2('0x13'));var config=require(_0xdbd2('0x14'));var db=require(_0xdbd2('0x15'))['db'];var jayson=require(_0xdbd2('0x16'));var client=jayson[_0xdbd2('0x17')][_0xdbd2('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2b39bf,_0x587e71,_0x39e48b){if(_0x39e48b){var _0x1c67b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c67b9['test'](_0x587e71)){return _0x2b39bf;}else{throw new db[(_0xdbd2('0x19'))][(_0xdbd2('0x1a'))](_0xdbd2('0x1b'));}}else{return _0x2b39bf;}}function respondWithRpcPromise(_0x4c1d45,_0xe0dfaa,_0x262f00,_0x49c5a7){return new BPromise(function(_0x48e43a,_0x1a57e7){var _0x3c485a=_0x49c5a7||client;return _0x3c485a[_0xdbd2('0x1c')](_0x4c1d45,_0x262f00)[_0xdbd2('0x1d')](function(_0x2b4d9f){logger[_0xdbd2('0x1e')](_0xdbd2('0x1f'),_0xe0dfaa,_0xdbd2('0x20'));logger[_0xdbd2('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xe0dfaa,_0xdbd2('0x20'),JSON[_0xdbd2('0x22')](_0x2b4d9f));if(_0x2b4d9f['error']){if(_0x2b4d9f['error']['code']===0x1f4){logger[_0xdbd2('0x23')](_0xdbd2('0x1f'),_0xe0dfaa,_0x2b4d9f[_0xdbd2('0x23')]['message']);return _0x1a57e7(_0x2b4d9f[_0xdbd2('0x23')][_0xdbd2('0x24')]);}logger[_0xdbd2('0x23')](_0xdbd2('0x1f'),_0xe0dfaa,_0x2b4d9f[_0xdbd2('0x23')]['message']);return _0x48e43a(_0x2b4d9f[_0xdbd2('0x23')]['message']);}else{logger[_0xdbd2('0x1e')](_0xdbd2('0x1f'),_0xe0dfaa,_0xdbd2('0x20'));_0x48e43a(_0x2b4d9f[_0xdbd2('0x25')][_0xdbd2('0x24')]);}})['catch'](function(_0x5edb2c){logger[_0xdbd2('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xe0dfaa,_0x5edb2c);_0x1a57e7(_0x5edb2c);});});}function respondWithStatusCode(_0x559003,_0x40cf2e){_0x40cf2e=_0x40cf2e||0xcc;return function(_0x1b251e){if(_0x1b251e){return _0x559003['sendStatus'](_0x40cf2e);}return _0x559003['status'](_0x40cf2e)[_0xdbd2('0x26')]();};}function respondWithResult(_0x1a8b78,_0xf81cde){_0xf81cde=_0xf81cde||0xc8;return function(_0x11f1c0){if(_0x11f1c0){return _0x1a8b78[_0xdbd2('0x27')](_0xf81cde)[_0xdbd2('0x28')](_0x11f1c0);}};}function respondWithFilteredResult(_0x432d2f,_0x56713b){return function(_0x34693f){if(_0x34693f){var _0x4d52d5=_0x34693f[_0xdbd2('0x29')],_0x2c252c=_0x56713b['offset'],_0x33f004=_0x56713b['offset']+_0x56713b['limit'],_0x2cef87;if(_0x33f004>=_0x4d52d5){_0x33f004=_0x4d52d5;_0x2cef87=0xc8;}else{_0x2cef87=0xce;}_0x432d2f[_0xdbd2('0x27')](_0x2cef87);return _0x432d2f[_0xdbd2('0x2a')](_0xdbd2('0x2b'),_0x2c252c+'-'+_0x33f004+'/'+_0x4d52d5)[_0xdbd2('0x28')](_0x34693f);}return null;};}function patchUpdates(_0x49fe20){return function(_0x38da9f){try{jsonpatch[_0xdbd2('0x2c')](_0x38da9f,_0x49fe20,!![]);}catch(_0x29e6aa){return BPromise[_0xdbd2('0x2d')](_0x29e6aa);}return _0x38da9f['save']();};}function saveUpdates(_0x5459c2,_0x2786cd){return function(_0x5ce8a0){if(_0x5ce8a0){return _0x5ce8a0['update'](_0x5459c2)[_0xdbd2('0x1d')](function(_0x3c9c81){return _0x3c9c81;});}return null;};}function removeEntity(_0x260f8c,_0x32f4bb){return function(_0x2a8aa1){if(_0x2a8aa1){return _0x2a8aa1[_0xdbd2('0x2e')]()[_0xdbd2('0x1d')](function(){_0x260f8c[_0xdbd2('0x27')](0xcc)[_0xdbd2('0x26')]();});}};}function handleEntityNotFound(_0x120b2d,_0x305a92){return function(_0x2b4cf7){if(!_0x2b4cf7){_0x120b2d[_0xdbd2('0x2f')](0x194);}return _0x2b4cf7;};}function handleError(_0x96a7bb,_0x226a9a){_0x226a9a=_0x226a9a||0x1f4;return function(_0x19e6e1){logger['error'](_0x19e6e1[_0xdbd2('0x30')]);if(_0x19e6e1[_0xdbd2('0x31')]){delete _0x19e6e1[_0xdbd2('0x31')];}_0x96a7bb[_0xdbd2('0x27')](_0x226a9a)['send'](_0x19e6e1);};}exports[_0xdbd2('0x32')]=function(_0x191916,_0x52918b){var _0xb07bc8={},_0x3849d0={},_0xbe0f37={'count':0x0,'rows':[]};var _0x4609aa=_[_0xdbd2('0x33')](db[_0xdbd2('0x34')]['rawAttributes'],function(_0x3ad761){return{'name':_0x3ad761[_0xdbd2('0x35')],'type':_0x3ad761[_0xdbd2('0x36')][_0xdbd2('0x37')]};});_0x3849d0[_0xdbd2('0x38')]=_['map'](_0x4609aa,_0xdbd2('0x31'));_0x3849d0[_0xdbd2('0x39')]=_[_0xdbd2('0x3a')](_0x191916[_0xdbd2('0x39')]);_0x3849d0[_0xdbd2('0x3b')]=_[_0xdbd2('0x3c')](_0x3849d0['model'],_0x3849d0[_0xdbd2('0x39')]);_0xb07bc8[_0xdbd2('0x3d')]=_[_0xdbd2('0x3c')](_0x3849d0[_0xdbd2('0x38')],qs[_0xdbd2('0x3e')](_0x191916['query'][_0xdbd2('0x3e')]));_0xb07bc8[_0xdbd2('0x3d')]=_0xb07bc8['attributes']['length']?_0xb07bc8[_0xdbd2('0x3d')]:_0x3849d0[_0xdbd2('0x38')];if(!_0x191916[_0xdbd2('0x39')][_0xdbd2('0x3f')](_0xdbd2('0x40'))){_0xb07bc8[_0xdbd2('0x41')]=qs['limit'](_0x191916[_0xdbd2('0x39')][_0xdbd2('0x41')]);_0xb07bc8[_0xdbd2('0x42')]=qs['offset'](_0x191916[_0xdbd2('0x39')][_0xdbd2('0x42')]);}_0xb07bc8[_0xdbd2('0x43')]=qs[_0xdbd2('0x44')](_0x191916[_0xdbd2('0x39')]['sort']);_0xb07bc8[_0xdbd2('0x45')]=qs[_0xdbd2('0x3b')](_[_0xdbd2('0x46')](_0x191916[_0xdbd2('0x39')],_0x3849d0[_0xdbd2('0x3b')]),_0x4609aa);if(_0x191916['query'][_0xdbd2('0x47')]){_0xb07bc8[_0xdbd2('0x45')]=_['merge'](_0xb07bc8[_0xdbd2('0x45')],{'$or':_['map'](_0x4609aa,function(_0x31d752){if(_0x31d752['type']!=='VIRTUAL'){var _0x2bb910={};_0x2bb910[_0x31d752['name']]={'$like':'%'+_0x191916['query'][_0xdbd2('0x47')]+'%'};return _0x2bb910;}})});}_0xb07bc8=_['merge']({},_0xb07bc8,_0x191916[_0xdbd2('0x48')]);var _0x48fe89={'where':_0xb07bc8[_0xdbd2('0x45')]};return db[_0xdbd2('0x34')][_0xdbd2('0x29')](_0x48fe89)[_0xdbd2('0x1d')](function(_0xb5a3a){_0xbe0f37[_0xdbd2('0x29')]=_0xb5a3a;if(_0x191916[_0xdbd2('0x39')][_0xdbd2('0x49')]){_0xb07bc8[_0xdbd2('0x4a')]=[{'all':!![]}];}return db[_0xdbd2('0x34')][_0xdbd2('0x4b')](_0xb07bc8);})[_0xdbd2('0x1d')](function(_0x5a5221){_0xbe0f37[_0xdbd2('0x4c')]=_0x5a5221;return _0xbe0f37;})[_0xdbd2('0x1d')](respondWithFilteredResult(_0x52918b,_0xb07bc8))[_0xdbd2('0x4d')](handleError(_0x52918b,null));};exports[_0xdbd2('0x4e')]=function(_0x5535f3,_0x582a10){var _0x3e3533={'raw':![],'where':{'id':_0x5535f3[_0xdbd2('0x4f')]['id']}},_0x18570f={};_0x18570f['model']=_[_0xdbd2('0x3a')](db[_0xdbd2('0x34')][_0xdbd2('0x50')]);_0x18570f[_0xdbd2('0x39')]=_[_0xdbd2('0x3a')](_0x5535f3[_0xdbd2('0x39')]);_0x18570f['filters']=_[_0xdbd2('0x3c')](_0x18570f[_0xdbd2('0x38')],_0x18570f[_0xdbd2('0x39')]);_0x3e3533['attributes']=_[_0xdbd2('0x3c')](_0x18570f[_0xdbd2('0x38')],qs[_0xdbd2('0x3e')](_0x5535f3[_0xdbd2('0x39')][_0xdbd2('0x3e')]));_0x3e3533['attributes']=_0x3e3533[_0xdbd2('0x3d')][_0xdbd2('0x51')]?_0x3e3533['attributes']:_0x18570f[_0xdbd2('0x38')];if(_0x5535f3[_0xdbd2('0x39')][_0xdbd2('0x49')]){_0x3e3533[_0xdbd2('0x4a')]=[{'all':!![]}];}_0x3e3533=_[_0xdbd2('0x52')]({},_0x3e3533,_0x5535f3['options']);return db[_0xdbd2('0x34')]['find'](_0x3e3533)[_0xdbd2('0x1d')](handleEntityNotFound(_0x582a10,null))[_0xdbd2('0x1d')](respondWithResult(_0x582a10,null))[_0xdbd2('0x4d')](handleError(_0x582a10,null));};exports[_0xdbd2('0x53')]=function(_0x58d870,_0x4c4e40){return db[_0xdbd2('0x34')][_0xdbd2('0x53')](_0x58d870[_0xdbd2('0x54')],{})['then'](respondWithResult(_0x4c4e40,0xc9))[_0xdbd2('0x4d')](handleError(_0x4c4e40,null));};exports[_0xdbd2('0x55')]=function(_0x172cbb,_0xf213d9){if(_0x172cbb['body']['id']){delete _0x172cbb['body']['id'];}return db[_0xdbd2('0x34')]['find']({'where':{'id':_0x172cbb[_0xdbd2('0x4f')]['id']}})[_0xdbd2('0x1d')](handleEntityNotFound(_0xf213d9,null))['then'](saveUpdates(_0x172cbb['body'],null))[_0xdbd2('0x1d')](respondWithResult(_0xf213d9,null))[_0xdbd2('0x4d')](handleError(_0xf213d9,null));};exports[_0xdbd2('0x2e')]=function(_0x4bdbfd,_0x10e386){return db[_0xdbd2('0x34')][_0xdbd2('0x56')]({'where':{'id':_0x4bdbfd['params']['id']}})[_0xdbd2('0x1d')](handleEntityNotFound(_0x10e386,null))[_0xdbd2('0x1d')](removeEntity(_0x10e386,null))[_0xdbd2('0x4d')](handleError(_0x10e386,null));};exports[_0xdbd2('0x57')]=function(_0xfe058f,_0x246762,_0x4e2297){var _0x257c69={};var _0x57e7bc={};var _0x53ab5d;var _0x18dd0d;return db[_0xdbd2('0x34')][_0xdbd2('0x58')]({'where':{'id':_0xfe058f[_0xdbd2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x246762,null))[_0xdbd2('0x1d')](function(_0x3548a1){if(_0x3548a1){_0x53ab5d=_0x3548a1;_0x57e7bc[_0xdbd2('0x38')]=_[_0xdbd2('0x3a')](db[_0xdbd2('0x59')][_0xdbd2('0x50')]);_0x57e7bc[_0xdbd2('0x39')]=_[_0xdbd2('0x3a')](_0xfe058f[_0xdbd2('0x39')]);_0x57e7bc[_0xdbd2('0x3b')]=_[_0xdbd2('0x3c')](_0x57e7bc[_0xdbd2('0x38')],_0x57e7bc[_0xdbd2('0x39')]);_0x257c69[_0xdbd2('0x3d')]=_['intersection'](_0x57e7bc['model'],qs[_0xdbd2('0x3e')](_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x3e')]));_0x257c69[_0xdbd2('0x3d')]=_0x257c69[_0xdbd2('0x3d')][_0xdbd2('0x51')]?_0x257c69['attributes']:_0x57e7bc[_0xdbd2('0x38')];_0x257c69['order']=qs[_0xdbd2('0x44')](_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x44')]);_0x257c69[_0xdbd2('0x45')]=qs[_0xdbd2('0x3b')](_[_0xdbd2('0x46')](_0xfe058f[_0xdbd2('0x39')],_0x57e7bc[_0xdbd2('0x3b')]));if(_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x47')]){_0x257c69['where']=_[_0xdbd2('0x52')](_0x257c69[_0xdbd2('0x45')],{'$or':_[_0xdbd2('0x33')](_0x257c69[_0xdbd2('0x3d')],function(_0x1e85dd){var _0x31f320={};_0x31f320[_0x1e85dd]={'$like':'%'+_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x47')]+'%'};return _0x31f320;})});}_0x257c69=_[_0xdbd2('0x52')]({},_0x257c69,_0xfe058f[_0xdbd2('0x48')]);return _0x53ab5d[_0xdbd2('0x57')](_0x257c69);}})[_0xdbd2('0x1d')](function(_0x556cc2){if(_0x556cc2){_0x18dd0d=_0x556cc2[_0xdbd2('0x51')];if(!_0xfe058f[_0xdbd2('0x39')]['hasOwnProperty'](_0xdbd2('0x40'))){_0x257c69['limit']=qs['limit'](_0xfe058f[_0xdbd2('0x39')][_0xdbd2('0x41')]);_0x257c69[_0xdbd2('0x42')]=qs['offset'](_0xfe058f['query'][_0xdbd2('0x42')]);}return _0x53ab5d[_0xdbd2('0x57')](_0x257c69);}})[_0xdbd2('0x1d')](function(_0x213f1b){if(_0x213f1b){return _0x213f1b?{'count':_0x18dd0d,'rows':_0x213f1b}:null;}})[_0xdbd2('0x1d')](respondWithResult(_0x246762,null))[_0xdbd2('0x4d')](handleError(_0x246762,null));};exports[_0xdbd2('0x5a')]=function(_0x506d88,_0xdff264,_0x4fc15c){var _0x20e4a0={};var _0x39d2a4={};var _0x57dbad;var _0x4e9df3;return db[_0xdbd2('0x34')][_0xdbd2('0x58')]({'where':{'id':_0x506d88['params']['id']}})[_0xdbd2('0x1d')](handleEntityNotFound(_0xdff264,null))['then'](function(_0x1d28cd){if(_0x1d28cd){_0x57dbad=_0x1d28cd;_0x39d2a4['model']=_[_0xdbd2('0x3a')](db['SugarcrmField'][_0xdbd2('0x50')]);_0x39d2a4[_0xdbd2('0x39')]=_['keys'](_0x506d88[_0xdbd2('0x39')]);_0x39d2a4[_0xdbd2('0x3b')]=_['intersection'](_0x39d2a4['model'],_0x39d2a4[_0xdbd2('0x39')]);_0x20e4a0[_0xdbd2('0x3d')]=_[_0xdbd2('0x3c')](_0x39d2a4[_0xdbd2('0x38')],qs['fields'](_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x3e')]));_0x20e4a0[_0xdbd2('0x3d')]=_0x20e4a0[_0xdbd2('0x3d')][_0xdbd2('0x51')]?_0x20e4a0[_0xdbd2('0x3d')]:_0x39d2a4[_0xdbd2('0x38')];_0x20e4a0['order']=qs[_0xdbd2('0x44')](_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x44')]);_0x20e4a0[_0xdbd2('0x45')]=qs[_0xdbd2('0x3b')](_['pick'](_0x506d88[_0xdbd2('0x39')],_0x39d2a4['filters']));if(_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x47')]){_0x20e4a0[_0xdbd2('0x45')]=_['merge'](_0x20e4a0['where'],{'$or':_[_0xdbd2('0x33')](_0x20e4a0['attributes'],function(_0x2b60a1){var _0x5eee5b={};_0x5eee5b[_0x2b60a1]={'$like':'%'+_0x506d88['query'][_0xdbd2('0x47')]+'%'};return _0x5eee5b;})});}_0x20e4a0=_[_0xdbd2('0x52')]({},_0x20e4a0,_0x506d88[_0xdbd2('0x48')]);return _0x57dbad[_0xdbd2('0x5a')](_0x20e4a0);}})[_0xdbd2('0x1d')](function(_0x37ee48){if(_0x37ee48){_0x4e9df3=_0x37ee48[_0xdbd2('0x51')];if(!_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x3f')](_0xdbd2('0x40'))){_0x20e4a0['limit']=qs['limit'](_0x506d88['query']['limit']);_0x20e4a0[_0xdbd2('0x42')]=qs[_0xdbd2('0x42')](_0x506d88[_0xdbd2('0x39')][_0xdbd2('0x42')]);}return _0x57dbad[_0xdbd2('0x5a')](_0x20e4a0);}})['then'](function(_0x492143){if(_0x492143){return _0x492143?{'count':_0x4e9df3,'rows':_0x492143}:null;}})['then'](respondWithResult(_0xdff264,null))[_0xdbd2('0x4d')](handleError(_0xdff264,null));};exports[_0xdbd2('0x5b')]=function(_0x4ea958,_0x4eb039,_0x3f3f2f){var _0x27448f={};var _0x2efbba={};var _0x583bb7;var _0x3b7ae9;return db[_0xdbd2('0x34')][_0xdbd2('0x58')]({'where':{'id':_0x4ea958[_0xdbd2('0x4f')]['id']}})[_0xdbd2('0x1d')](handleEntityNotFound(_0x4eb039,null))[_0xdbd2('0x1d')](function(_0x2c7774){if(_0x2c7774){_0x583bb7=_0x2c7774;_0x2efbba[_0xdbd2('0x38')]=_['keys'](db[_0xdbd2('0x59')][_0xdbd2('0x50')]);_0x2efbba[_0xdbd2('0x39')]=_[_0xdbd2('0x3a')](_0x4ea958[_0xdbd2('0x39')]);_0x2efbba[_0xdbd2('0x3b')]=_[_0xdbd2('0x3c')](_0x2efbba[_0xdbd2('0x38')],_0x2efbba[_0xdbd2('0x39')]);_0x27448f[_0xdbd2('0x3d')]=_['intersection'](_0x2efbba[_0xdbd2('0x38')],qs['fields'](_0x4ea958[_0xdbd2('0x39')][_0xdbd2('0x3e')]));_0x27448f[_0xdbd2('0x3d')]=_0x27448f[_0xdbd2('0x3d')]['length']?_0x27448f[_0xdbd2('0x3d')]:_0x2efbba[_0xdbd2('0x38')];_0x27448f[_0xdbd2('0x43')]=qs[_0xdbd2('0x44')](_0x4ea958[_0xdbd2('0x39')][_0xdbd2('0x44')]);_0x27448f[_0xdbd2('0x45')]=qs['filters'](_[_0xdbd2('0x46')](_0x4ea958['query'],_0x2efbba['filters']));if(_0x4ea958[_0xdbd2('0x39')][_0xdbd2('0x47')]){_0x27448f[_0xdbd2('0x45')]=_['merge'](_0x27448f[_0xdbd2('0x45')],{'$or':_[_0xdbd2('0x33')](_0x27448f[_0xdbd2('0x3d')],function(_0x4f78c5){var _0x273e36={};_0x273e36[_0x4f78c5]={'$like':'%'+_0x4ea958[_0xdbd2('0x39')][_0xdbd2('0x47')]+'%'};return _0x273e36;})});}_0x27448f=_[_0xdbd2('0x52')]({},_0x27448f,_0x4ea958[_0xdbd2('0x48')]);return _0x583bb7[_0xdbd2('0x5b')](_0x27448f);}})[_0xdbd2('0x1d')](function(_0x5a2b90){if(_0x5a2b90){_0x3b7ae9=_0x5a2b90[_0xdbd2('0x51')];if(!_0x4ea958['query']['hasOwnProperty']('nolimit')){_0x27448f[_0xdbd2('0x41')]=qs[_0xdbd2('0x41')](_0x4ea958['query'][_0xdbd2('0x41')]);_0x27448f[_0xdbd2('0x42')]=qs[_0xdbd2('0x42')](_0x4ea958['query'][_0xdbd2('0x42')]);}return _0x583bb7['getDescriptions'](_0x27448f);}})[_0xdbd2('0x1d')](function(_0x37761f){if(_0x37761f){return _0x37761f?{'count':_0x3b7ae9,'rows':_0x37761f}:null;}})[_0xdbd2('0x1d')](respondWithResult(_0x4eb039,null))['catch'](handleError(_0x4eb039,null));}; \ No newline at end of file +var _0x9310=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','keys','create','body','find','getFields','pick','getSubjects','findOne','SugarcrmField','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/environment','jayson/promise','client','Sequelize'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x9310,0x15e));var _0x0931=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x9310[_0x12ca5f];return _0xfc3ae9;};'use strict';var pdf=require(_0x0931('0x0'));var emlformat=require(_0x0931('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0931('0x2'));var jsonpatch=require(_0x0931('0x3'));var rp=require(_0x0931('0x4'));var moment=require(_0x0931('0x5'));var BPromise=require(_0x0931('0x6'));var Mustache=require(_0x0931('0x7'));var util=require('util');var path=require(_0x0931('0x8'));var sox=require('sox');var csv=require(_0x0931('0x9'));var ejs=require(_0x0931('0xa'));var fs=require('fs');var _=require(_0x0931('0xb'));var squel=require(_0x0931('0xc'));var crypto=require(_0x0931('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0931('0x9'));var querystring=require('querystring');var Papa=require(_0x0931('0xe'));var Redis=require('ioredis');var authService=require(_0x0931('0xf'));var qs=require(_0x0931('0x10'));var as=require(_0x0931('0x11'));var hardwareService=require(_0x0931('0x12'));var logger=require(_0x0931('0x13'))(_0x0931('0x14'));var utils=require(_0x0931('0x15'));var config=require(_0x0931('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0931('0x17'));var client=jayson[_0x0931('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x314a45,_0x1e212d,_0x5cbd87){if(_0x5cbd87){var _0x4f88dd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f88dd['test'](_0x1e212d)){return _0x314a45;}else{throw new db[(_0x0931('0x19'))][(_0x0931('0x1a'))](_0x0931('0x1b'));}}else{return _0x314a45;}}function respondWithRpcPromise(_0x38bf3a,_0x276875,_0x1b69f3,_0x55beea){return new BPromise(function(_0xe947c4,_0x2038e7){var _0x425327=_0x55beea||client;return _0x425327[_0x0931('0x1c')](_0x38bf3a,_0x1b69f3)[_0x0931('0x1d')](function(_0x1a05c4){logger['info'](_0x0931('0x1e'),_0x276875,_0x0931('0x1f'));logger[_0x0931('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x276875,_0x0931('0x1f'),JSON[_0x0931('0x21')](_0x1a05c4));if(_0x1a05c4[_0x0931('0x22')]){if(_0x1a05c4['error'][_0x0931('0x23')]===0x1f4){logger[_0x0931('0x22')](_0x0931('0x1e'),_0x276875,_0x1a05c4[_0x0931('0x22')]['message']);return _0x2038e7(_0x1a05c4[_0x0931('0x22')][_0x0931('0x24')]);}logger[_0x0931('0x22')](_0x0931('0x1e'),_0x276875,_0x1a05c4[_0x0931('0x22')][_0x0931('0x24')]);return _0xe947c4(_0x1a05c4['error'][_0x0931('0x24')]);}else{logger[_0x0931('0x25')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x276875,_0x0931('0x1f'));_0xe947c4(_0x1a05c4[_0x0931('0x26')][_0x0931('0x24')]);}})[_0x0931('0x27')](function(_0x3f83d8){logger[_0x0931('0x22')](_0x0931('0x1e'),_0x276875,_0x3f83d8);_0x2038e7(_0x3f83d8);});});}function respondWithStatusCode(_0x39ffc1,_0x1adae3){_0x1adae3=_0x1adae3||0xcc;return function(_0x58ae02){if(_0x58ae02){return _0x39ffc1['sendStatus'](_0x1adae3);}return _0x39ffc1[_0x0931('0x28')](_0x1adae3)[_0x0931('0x29')]();};}function respondWithResult(_0x49d744,_0x1c0913){_0x1c0913=_0x1c0913||0xc8;return function(_0x196f8c){if(_0x196f8c){return _0x49d744[_0x0931('0x28')](_0x1c0913)['json'](_0x196f8c);}};}function respondWithFilteredResult(_0x1dd7cc,_0x5dec1b){return function(_0x5f33b1){if(_0x5f33b1){var _0x4e5395=_0x5f33b1['count'],_0x4ee551=_0x5dec1b[_0x0931('0x2a')],_0x10dcac=_0x5dec1b['offset']+_0x5dec1b[_0x0931('0x2b')],_0x50f805;if(_0x10dcac>=_0x4e5395){_0x10dcac=_0x4e5395;_0x50f805=0xc8;}else{_0x50f805=0xce;}_0x1dd7cc['status'](_0x50f805);return _0x1dd7cc[_0x0931('0x2c')](_0x0931('0x2d'),_0x4ee551+'-'+_0x10dcac+'/'+_0x4e5395)[_0x0931('0x2e')](_0x5f33b1);}return null;};}function patchUpdates(_0x460d21){return function(_0x1dd0e4){try{jsonpatch[_0x0931('0x2f')](_0x1dd0e4,_0x460d21,!![]);}catch(_0x58a52d){return BPromise[_0x0931('0x30')](_0x58a52d);}return _0x1dd0e4['save']();};}function saveUpdates(_0x4bcd53,_0x3bb9a4){return function(_0x38decf){if(_0x38decf){return _0x38decf[_0x0931('0x31')](_0x4bcd53)['then'](function(_0x4091f3){return _0x4091f3;});}return null;};}function removeEntity(_0x3f47c3,_0x12decc){return function(_0x2d9e11){if(_0x2d9e11){return _0x2d9e11[_0x0931('0x32')]()[_0x0931('0x1d')](function(){_0x3f47c3[_0x0931('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc3c8fb,_0x41b3c1){return function(_0x121e44){if(!_0x121e44){_0xc3c8fb[_0x0931('0x33')](0x194);}return _0x121e44;};}function handleError(_0x22d612,_0x14a03b){_0x14a03b=_0x14a03b||0x1f4;return function(_0x5d7d8e){logger['error'](_0x5d7d8e[_0x0931('0x34')]);if(_0x5d7d8e[_0x0931('0x35')]){delete _0x5d7d8e['name'];}_0x22d612[_0x0931('0x28')](_0x14a03b)[_0x0931('0x36')](_0x5d7d8e);};}exports[_0x0931('0x37')]=function(_0x7da09d,_0x4c5aa0){var _0x390499={},_0x4ef01c={},_0xbc8146={'count':0x0,'rows':[]};var _0xa0b570=_[_0x0931('0x38')](db[_0x0931('0x39')][_0x0931('0x3a')],function(_0x939cd){return{'name':_0x939cd[_0x0931('0x3b')],'type':_0x939cd[_0x0931('0x3c')][_0x0931('0x3d')]};});_0x4ef01c[_0x0931('0x3e')]=_[_0x0931('0x38')](_0xa0b570,_0x0931('0x35'));_0x4ef01c[_0x0931('0x3f')]=_['keys'](_0x7da09d[_0x0931('0x3f')]);_0x4ef01c['filters']=_[_0x0931('0x40')](_0x4ef01c[_0x0931('0x3e')],_0x4ef01c[_0x0931('0x3f')]);_0x390499[_0x0931('0x41')]=_[_0x0931('0x40')](_0x4ef01c[_0x0931('0x3e')],qs[_0x0931('0x42')](_0x7da09d['query'][_0x0931('0x42')]));_0x390499[_0x0931('0x41')]=_0x390499['attributes'][_0x0931('0x43')]?_0x390499[_0x0931('0x41')]:_0x4ef01c['model'];if(!_0x7da09d['query'][_0x0931('0x44')](_0x0931('0x45'))){_0x390499[_0x0931('0x2b')]=qs[_0x0931('0x2b')](_0x7da09d[_0x0931('0x3f')][_0x0931('0x2b')]);_0x390499[_0x0931('0x2a')]=qs[_0x0931('0x2a')](_0x7da09d['query'][_0x0931('0x2a')]);}_0x390499[_0x0931('0x46')]=qs[_0x0931('0x47')](_0x7da09d[_0x0931('0x3f')]['sort']);_0x390499[_0x0931('0x48')]=qs['filters'](_['pick'](_0x7da09d[_0x0931('0x3f')],_0x4ef01c[_0x0931('0x49')]),_0xa0b570);if(_0x7da09d[_0x0931('0x3f')][_0x0931('0x4a')]){_0x390499['where']=_[_0x0931('0x4b')](_0x390499[_0x0931('0x48')],{'$or':_[_0x0931('0x38')](_0xa0b570,function(_0x3a6837){if(_0x3a6837[_0x0931('0x3c')]!==_0x0931('0x4c')){var _0x5e1324={};_0x5e1324[_0x3a6837['name']]={'$like':'%'+_0x7da09d[_0x0931('0x3f')][_0x0931('0x4a')]+'%'};return _0x5e1324;}})});}_0x390499=_['merge']({},_0x390499,_0x7da09d[_0x0931('0x4d')]);var _0x4a7b0a={'where':_0x390499[_0x0931('0x48')]};return db[_0x0931('0x39')][_0x0931('0x4e')](_0x4a7b0a)[_0x0931('0x1d')](function(_0x29842f){_0xbc8146[_0x0931('0x4e')]=_0x29842f;if(_0x7da09d[_0x0931('0x3f')][_0x0931('0x4f')]){_0x390499[_0x0931('0x50')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x0931('0x51')](_0x390499);})[_0x0931('0x1d')](function(_0x1f04d0){_0xbc8146['rows']=_0x1f04d0;return _0xbc8146;})[_0x0931('0x1d')](respondWithFilteredResult(_0x4c5aa0,_0x390499))['catch'](handleError(_0x4c5aa0,null));};exports[_0x0931('0x52')]=function(_0x4fef0e,_0x385042){var _0x30df97={'raw':![],'where':{'id':_0x4fef0e[_0x0931('0x53')]['id']}},_0x2562cb={};_0x2562cb['model']=_['keys'](db[_0x0931('0x39')]['rawAttributes']);_0x2562cb[_0x0931('0x3f')]=_[_0x0931('0x54')](_0x4fef0e[_0x0931('0x3f')]);_0x2562cb['filters']=_['intersection'](_0x2562cb[_0x0931('0x3e')],_0x2562cb['query']);_0x30df97[_0x0931('0x41')]=_[_0x0931('0x40')](_0x2562cb[_0x0931('0x3e')],qs['fields'](_0x4fef0e[_0x0931('0x3f')]['fields']));_0x30df97[_0x0931('0x41')]=_0x30df97[_0x0931('0x41')][_0x0931('0x43')]?_0x30df97[_0x0931('0x41')]:_0x2562cb[_0x0931('0x3e')];if(_0x4fef0e[_0x0931('0x3f')][_0x0931('0x4f')]){_0x30df97[_0x0931('0x50')]=[{'all':!![]}];}_0x30df97=_[_0x0931('0x4b')]({},_0x30df97,_0x4fef0e[_0x0931('0x4d')]);return db[_0x0931('0x39')]['find'](_0x30df97)[_0x0931('0x1d')](handleEntityNotFound(_0x385042,null))['then'](respondWithResult(_0x385042,null))[_0x0931('0x27')](handleError(_0x385042,null));};exports[_0x0931('0x55')]=function(_0x5b1432,_0x2200fe){return db[_0x0931('0x39')][_0x0931('0x55')](_0x5b1432[_0x0931('0x56')],{})[_0x0931('0x1d')](respondWithResult(_0x2200fe,0xc9))[_0x0931('0x27')](handleError(_0x2200fe,null));};exports[_0x0931('0x31')]=function(_0x24b420,_0x44610d){if(_0x24b420[_0x0931('0x56')]['id']){delete _0x24b420[_0x0931('0x56')]['id'];}return db[_0x0931('0x39')][_0x0931('0x57')]({'where':{'id':_0x24b420['params']['id']}})['then'](handleEntityNotFound(_0x44610d,null))['then'](saveUpdates(_0x24b420[_0x0931('0x56')],null))[_0x0931('0x1d')](respondWithResult(_0x44610d,null))[_0x0931('0x27')](handleError(_0x44610d,null));};exports[_0x0931('0x32')]=function(_0x1702e8,_0x2921ae){return db[_0x0931('0x39')][_0x0931('0x57')]({'where':{'id':_0x1702e8['params']['id']}})[_0x0931('0x1d')](handleEntityNotFound(_0x2921ae,null))['then'](removeEntity(_0x2921ae,null))['catch'](handleError(_0x2921ae,null));};exports[_0x0931('0x58')]=function(_0x6fce9a,_0x5243b9,_0x2bf6ea){var _0x390169={};var _0x53ae1b={};var _0x3311bb;var _0x2e7238;return db[_0x0931('0x39')]['findOne']({'where':{'id':_0x6fce9a[_0x0931('0x53')]['id']}})[_0x0931('0x1d')](handleEntityNotFound(_0x5243b9,null))[_0x0931('0x1d')](function(_0x211932){if(_0x211932){_0x3311bb=_0x211932;_0x53ae1b[_0x0931('0x3e')]=_[_0x0931('0x54')](db['SugarcrmField']['rawAttributes']);_0x53ae1b['query']=_[_0x0931('0x54')](_0x6fce9a['query']);_0x53ae1b['filters']=_['intersection'](_0x53ae1b[_0x0931('0x3e')],_0x53ae1b[_0x0931('0x3f')]);_0x390169[_0x0931('0x41')]=_[_0x0931('0x40')](_0x53ae1b[_0x0931('0x3e')],qs[_0x0931('0x42')](_0x6fce9a['query'][_0x0931('0x42')]));_0x390169[_0x0931('0x41')]=_0x390169[_0x0931('0x41')][_0x0931('0x43')]?_0x390169['attributes']:_0x53ae1b[_0x0931('0x3e')];_0x390169[_0x0931('0x46')]=qs[_0x0931('0x47')](_0x6fce9a[_0x0931('0x3f')]['sort']);_0x390169['where']=qs['filters'](_[_0x0931('0x59')](_0x6fce9a['query'],_0x53ae1b[_0x0931('0x49')]));if(_0x6fce9a[_0x0931('0x3f')]['filter']){_0x390169[_0x0931('0x48')]=_['merge'](_0x390169['where'],{'$or':_['map'](_0x390169[_0x0931('0x41')],function(_0x4d89f8){var _0x3a20b5={};_0x3a20b5[_0x4d89f8]={'$like':'%'+_0x6fce9a['query'][_0x0931('0x4a')]+'%'};return _0x3a20b5;})});}_0x390169=_[_0x0931('0x4b')]({},_0x390169,_0x6fce9a[_0x0931('0x4d')]);return _0x3311bb[_0x0931('0x58')](_0x390169);}})[_0x0931('0x1d')](function(_0x31b98b){if(_0x31b98b){_0x2e7238=_0x31b98b[_0x0931('0x43')];if(!_0x6fce9a[_0x0931('0x3f')][_0x0931('0x44')](_0x0931('0x45'))){_0x390169[_0x0931('0x2b')]=qs['limit'](_0x6fce9a['query'][_0x0931('0x2b')]);_0x390169[_0x0931('0x2a')]=qs[_0x0931('0x2a')](_0x6fce9a[_0x0931('0x3f')][_0x0931('0x2a')]);}return _0x3311bb['getFields'](_0x390169);}})[_0x0931('0x1d')](function(_0x33fdf1){if(_0x33fdf1){return _0x33fdf1?{'count':_0x2e7238,'rows':_0x33fdf1}:null;}})[_0x0931('0x1d')](respondWithResult(_0x5243b9,null))[_0x0931('0x27')](handleError(_0x5243b9,null));};exports[_0x0931('0x5a')]=function(_0x2de154,_0x590f7,_0x249375){var _0x75e94a={};var _0x3b8acb={};var _0xdc4479;var _0x16857d;return db[_0x0931('0x39')][_0x0931('0x5b')]({'where':{'id':_0x2de154[_0x0931('0x53')]['id']}})[_0x0931('0x1d')](handleEntityNotFound(_0x590f7,null))['then'](function(_0x1d2336){if(_0x1d2336){_0xdc4479=_0x1d2336;_0x3b8acb['model']=_[_0x0931('0x54')](db[_0x0931('0x5c')][_0x0931('0x3a')]);_0x3b8acb[_0x0931('0x3f')]=_[_0x0931('0x54')](_0x2de154[_0x0931('0x3f')]);_0x3b8acb['filters']=_['intersection'](_0x3b8acb[_0x0931('0x3e')],_0x3b8acb['query']);_0x75e94a[_0x0931('0x41')]=_[_0x0931('0x40')](_0x3b8acb[_0x0931('0x3e')],qs[_0x0931('0x42')](_0x2de154[_0x0931('0x3f')][_0x0931('0x42')]));_0x75e94a[_0x0931('0x41')]=_0x75e94a[_0x0931('0x41')]['length']?_0x75e94a[_0x0931('0x41')]:_0x3b8acb['model'];_0x75e94a['order']=qs[_0x0931('0x47')](_0x2de154[_0x0931('0x3f')][_0x0931('0x47')]);_0x75e94a[_0x0931('0x48')]=qs[_0x0931('0x49')](_[_0x0931('0x59')](_0x2de154['query'],_0x3b8acb[_0x0931('0x49')]));if(_0x2de154['query'][_0x0931('0x4a')]){_0x75e94a[_0x0931('0x48')]=_[_0x0931('0x4b')](_0x75e94a[_0x0931('0x48')],{'$or':_[_0x0931('0x38')](_0x75e94a['attributes'],function(_0x3e987c){var _0x4b8556={};_0x4b8556[_0x3e987c]={'$like':'%'+_0x2de154[_0x0931('0x3f')]['filter']+'%'};return _0x4b8556;})});}_0x75e94a=_['merge']({},_0x75e94a,_0x2de154['options']);return _0xdc4479[_0x0931('0x5a')](_0x75e94a);}})[_0x0931('0x1d')](function(_0x3cefd7){if(_0x3cefd7){_0x16857d=_0x3cefd7[_0x0931('0x43')];if(!_0x2de154[_0x0931('0x3f')][_0x0931('0x44')]('nolimit')){_0x75e94a[_0x0931('0x2b')]=qs[_0x0931('0x2b')](_0x2de154[_0x0931('0x3f')][_0x0931('0x2b')]);_0x75e94a[_0x0931('0x2a')]=qs[_0x0931('0x2a')](_0x2de154[_0x0931('0x3f')][_0x0931('0x2a')]);}return _0xdc4479[_0x0931('0x5a')](_0x75e94a);}})[_0x0931('0x1d')](function(_0x2a3cde){if(_0x2a3cde){return _0x2a3cde?{'count':_0x16857d,'rows':_0x2a3cde}:null;}})['then'](respondWithResult(_0x590f7,null))[_0x0931('0x27')](handleError(_0x590f7,null));};exports[_0x0931('0x5d')]=function(_0x1563b7,_0x3313c8,_0x1c9543){var _0x1c3684={};var _0x24dbea={};var _0x3cc6e6;var _0x46a0a1;return db[_0x0931('0x39')]['findOne']({'where':{'id':_0x1563b7[_0x0931('0x53')]['id']}})['then'](handleEntityNotFound(_0x3313c8,null))[_0x0931('0x1d')](function(_0x23ddab){if(_0x23ddab){_0x3cc6e6=_0x23ddab;_0x24dbea[_0x0931('0x3e')]=_['keys'](db[_0x0931('0x5c')][_0x0931('0x3a')]);_0x24dbea[_0x0931('0x3f')]=_['keys'](_0x1563b7[_0x0931('0x3f')]);_0x24dbea['filters']=_[_0x0931('0x40')](_0x24dbea[_0x0931('0x3e')],_0x24dbea['query']);_0x1c3684[_0x0931('0x41')]=_['intersection'](_0x24dbea[_0x0931('0x3e')],qs[_0x0931('0x42')](_0x1563b7['query']['fields']));_0x1c3684[_0x0931('0x41')]=_0x1c3684['attributes']['length']?_0x1c3684[_0x0931('0x41')]:_0x24dbea[_0x0931('0x3e')];_0x1c3684[_0x0931('0x46')]=qs['sort'](_0x1563b7[_0x0931('0x3f')][_0x0931('0x47')]);_0x1c3684[_0x0931('0x48')]=qs[_0x0931('0x49')](_[_0x0931('0x59')](_0x1563b7[_0x0931('0x3f')],_0x24dbea['filters']));if(_0x1563b7['query']['filter']){_0x1c3684[_0x0931('0x48')]=_['merge'](_0x1c3684[_0x0931('0x48')],{'$or':_['map'](_0x1c3684[_0x0931('0x41')],function(_0x3a5d7a){var _0x15e8bb={};_0x15e8bb[_0x3a5d7a]={'$like':'%'+_0x1563b7[_0x0931('0x3f')][_0x0931('0x4a')]+'%'};return _0x15e8bb;})});}_0x1c3684=_['merge']({},_0x1c3684,_0x1563b7[_0x0931('0x4d')]);return _0x3cc6e6[_0x0931('0x5d')](_0x1c3684);}})[_0x0931('0x1d')](function(_0x53288d){if(_0x53288d){_0x46a0a1=_0x53288d[_0x0931('0x43')];if(!_0x1563b7[_0x0931('0x3f')][_0x0931('0x44')]('nolimit')){_0x1c3684['limit']=qs[_0x0931('0x2b')](_0x1563b7[_0x0931('0x3f')]['limit']);_0x1c3684[_0x0931('0x2a')]=qs['offset'](_0x1563b7[_0x0931('0x3f')]['offset']);}return _0x3cc6e6[_0x0931('0x5d')](_0x1c3684);}})['then'](function(_0x6ec3ee){if(_0x6ec3ee){return _0x6ec3ee?{'count':_0x46a0a1,'rows':_0x6ec3ee}:null;}})[_0x0931('0x1d')](respondWithResult(_0x3313c8,null))[_0x0931('0x27')](handleError(_0x3313c8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 053725d..c094737 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 _0x2588=['api','moment','bluebird','request-promise','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util'];(function(_0x22d334,_0x57f1e6){var _0x52d3d4=function(_0x1c4264){while(--_0x1c4264){_0x22d334['push'](_0x22d334['shift']());}};_0x52d3d4(++_0x57f1e6);}(_0x2588,0x1b8));var _0x8258=function(_0x3aa254,_0x17ac37){_0x3aa254=_0x3aa254-0x0;var _0x45f0fc=_0x2588[_0x3aa254];return _0x45f0fc;};'use strict';var _=require('lodash');var util=require(_0x8258('0x0'));var logger=require('../../config/logger')(_0x8258('0x1'));var moment=require(_0x8258('0x2'));var BPromise=require(_0x8258('0x3'));var rp=require(_0x8258('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8258('0x5'));module[_0x8258('0x6')]=function(_0x165faf,_0x14dfd4){return _0x165faf[_0x8258('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x8258('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b3b=['exports','define','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','rimraf','./intSugarcrmConfiguration.attributes'];(function(_0x4e3fc7,_0x195200){var _0x4527bf=function(_0x122d8b){while(--_0x122d8b){_0x4e3fc7['push'](_0x4e3fc7['shift']());}};_0x4527bf(++_0x195200);}(_0x7b3b,0x107));var _0xb7b3=function(_0x323b64,_0x3bb64e){_0x323b64=_0x323b64-0x0;var _0x4d7b92=_0x7b3b[_0x323b64];return _0x4d7b92;};'use strict';var _=require('lodash');var util=require(_0xb7b3('0x0'));var logger=require(_0xb7b3('0x1'))(_0xb7b3('0x2'));var moment=require(_0xb7b3('0x3'));var BPromise=require(_0xb7b3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb7b3('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7b3('0x6'));module[_0xb7b3('0x7')]=function(_0x55ca42,_0x58f6f6){return _0x55ca42[_0xb7b3('0x8')]('SugarcrmConfiguration',attributes,{'tableName':_0xb7b3('0x9'),'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 d74a6b8..ee73d00 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 _0x333a=['request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xc04a3a,_0x1ece0c){var _0x4005ba=function(_0x2af6e6){while(--_0x2af6e6){_0xc04a3a['push'](_0xc04a3a['shift']());}};_0x4005ba(++_0x1ece0c);}(_0x333a,0x90));var _0xa333=function(_0x2358f9,_0x41d11f){_0x2358f9=_0x2358f9-0x0;var _0x43f542=_0x333a[_0x2358f9];return _0x43f542;};'use strict';var _=require(_0xa333('0x0'));var util=require(_0xa333('0x1'));var moment=require('moment');var BPromise=require(_0xa333('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa333('0x3'));var db=require(_0xa333('0x4'))['db'];var utils=require(_0xa333('0x5'));var logger=require(_0xa333('0x6'))('rpc');var config=require(_0xa333('0x7'));var jayson=require(_0xa333('0x8'));var client=jayson['client'][_0xa333('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c63c6,_0x4fe674,_0x41803a){return new BPromise(function(_0xcfe020,_0x23d56d){return client[_0xa333('0xa')](_0x3c63c6,_0x41803a)['then'](function(_0x58c807){logger[_0xa333('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4fe674,_0xa333('0xc'));logger[_0xa333('0xd')](_0xa333('0xe'),_0x4fe674,'request\x20sent',JSON[_0xa333('0xf')](_0x58c807));if(_0x58c807[_0xa333('0x10')]){if(_0x58c807['error'][_0xa333('0x11')]===0x1f4){logger['error'](_0xa333('0x12'),_0x4fe674,_0x58c807['error'][_0xa333('0x13')]);return _0x23d56d(_0x58c807['error']['message']);}logger[_0xa333('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4fe674,_0x58c807[_0xa333('0x10')][_0xa333('0x13')]);return _0xcfe020(_0x58c807[_0xa333('0x10')][_0xa333('0x13')]);}else{logger[_0xa333('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4fe674,_0xa333('0xc'));_0xcfe020(_0x58c807[_0xa333('0x14')][_0xa333('0x13')]);}})[_0xa333('0x15')](function(_0x3dcd11){logger[_0xa333('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4fe674,_0x3dcd11);_0x23d56d(_0x3dcd11);});});} \ No newline at end of file +var _0xfc49=['rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfc49,0x1dd));var _0x9fc4=function(_0x4e9b3b,_0x49a85c){_0x4e9b3b=_0x4e9b3b-0x0;var _0x3d18f0=_0xfc49[_0x4e9b3b];return _0x3d18f0;};'use strict';var _=require('lodash');var util=require(_0x9fc4('0x0'));var moment=require('moment');var BPromise=require(_0x9fc4('0x1'));var rs=require(_0x9fc4('0x2'));var fs=require('fs');var Redis=require(_0x9fc4('0x3'));var db=require(_0x9fc4('0x4'))['db'];var utils=require(_0x9fc4('0x5'));var logger=require(_0x9fc4('0x6'))(_0x9fc4('0x7'));var config=require(_0x9fc4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9fc4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x148202,_0xc9dd4b,_0x47283e){return new BPromise(function(_0x4cb2b8,_0x5a9432){return client[_0x9fc4('0xa')](_0x148202,_0x47283e)[_0x9fc4('0xb')](function(_0x52f016){logger[_0x9fc4('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc9dd4b,_0x9fc4('0xd'));logger[_0x9fc4('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xc9dd4b,_0x9fc4('0xd'),JSON[_0x9fc4('0xf')](_0x52f016));if(_0x52f016[_0x9fc4('0x10')]){if(_0x52f016['error'][_0x9fc4('0x11')]===0x1f4){logger[_0x9fc4('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc9dd4b,_0x52f016[_0x9fc4('0x10')][_0x9fc4('0x12')]);return _0x5a9432(_0x52f016[_0x9fc4('0x10')][_0x9fc4('0x12')]);}logger[_0x9fc4('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc9dd4b,_0x52f016[_0x9fc4('0x10')][_0x9fc4('0x12')]);return _0x4cb2b8(_0x52f016[_0x9fc4('0x10')][_0x9fc4('0x12')]);}else{logger[_0x9fc4('0xc')](_0x9fc4('0x13'),_0xc9dd4b,_0x9fc4('0xd'));_0x4cb2b8(_0x52f016[_0x9fc4('0x14')][_0x9fc4('0x12')]);}})[_0x9fc4('0x15')](function(_0x5b1f9d){logger[_0x9fc4('0x10')](_0x9fc4('0x13'),_0xc9dd4b,_0x5b1f9d);_0x5a9432(_0x5b1f9d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4c44e39..4780edf 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 _0xf789=['index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x3bd8c1,_0x4e23c3){var _0x5ba0c9=function(_0xcc9130){while(--_0xcc9130){_0x3bd8c1['push'](_0x3bd8c1['shift']());}};_0x5ba0c9(++_0x4e23c3);}(_0xf789,0x1ed));var _0x9f78=function(_0x228618,_0x5791cc){_0x228618=_0x228618-0x0;var _0xef5640=_0xf789[_0x228618];return _0xef5640;};'use strict';var multer=require(_0x9f78('0x0'));var util=require(_0x9f78('0x1'));var path=require(_0x9f78('0x2'));var timeout=require(_0x9f78('0x3'));var express=require(_0x9f78('0x4'));var router=express[_0x9f78('0x5')]();var auth=require(_0x9f78('0x6'));var interaction=require(_0x9f78('0x7'));var config=require(_0x9f78('0x8'));var controller=require(_0x9f78('0x9'));router[_0x9f78('0xa')]('/',auth['isAuthenticated'](),controller[_0x9f78('0xb')]);router[_0x9f78('0xa')](_0x9f78('0xc'),auth[_0x9f78('0xd')](),controller[_0x9f78('0xe')]);router[_0x9f78('0xf')]('/',auth[_0x9f78('0xd')](),controller[_0x9f78('0x10')]);router[_0x9f78('0x11')]('/:id',auth[_0x9f78('0xd')](),controller[_0x9f78('0x12')]);router['delete'](_0x9f78('0xc'),auth[_0x9f78('0xd')](),controller[_0x9f78('0x13')]);module[_0x9f78('0x14')]=router; \ No newline at end of file +var _0x94c4=['delete','util','express','../../components/interaction/service','../../config/environment','isAuthenticated','get','create','put','/:id','update'];(function(_0x33ab16,_0x249972){var _0x544b62=function(_0x597db7){while(--_0x597db7){_0x33ab16['push'](_0x33ab16['shift']());}};_0x544b62(++_0x249972);}(_0x94c4,0xfe));var _0x494c=function(_0xa94fd,_0x21edfe){_0xa94fd=_0xa94fd-0x0;var _0x315fea=_0x94c4[_0xa94fd];return _0x315fea;};'use strict';var multer=require('multer');var util=require(_0x494c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x494c('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x494c('0x2'));var config=require(_0x494c('0x3'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x494c('0x4')](),controller['index']);router[_0x494c('0x5')]('/:id',auth[_0x494c('0x4')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x494c('0x6')]);router[_0x494c('0x7')](_0x494c('0x8'),auth[_0x494c('0x4')](),controller[_0x494c('0x9')]);router[_0x494c('0xa')](_0x494c('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 927623b..5676e72 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 _0x607b=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x46319c,_0x5a5ea4){var _0x4b741b=function(_0x37a168){while(--_0x37a168){_0x46319c['push'](_0x46319c['shift']());}};_0x4b741b(++_0x5a5ea4);}(_0x607b,0x18f));var _0xb607=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x607b[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xb607('0x0'));module['exports']={'type':{'type':Sequelize[_0xb607('0x1')](_0xb607('0x2'),_0xb607('0x3'),_0xb607('0x4'),_0xb607('0x5')),'defaultValue':_0xb607('0x2')},'content':{'type':Sequelize[_0xb607('0x6')]},'key':{'type':Sequelize[_0xb607('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xb607('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb607('0x6')]},'nameField':{'type':Sequelize[_0xb607('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb607('0x6')]}}; \ No newline at end of file +var _0x0bde=['sequelize','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xe0bd('0x0'));module['exports']={'type':{'type':Sequelize[_0xe0bd('0x1')](_0xe0bd('0x2'),'variable',_0xe0bd('0x3'),_0xe0bd('0x4')),'defaultValue':_0xe0bd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe0bd('0x5')]},'keyType':{'type':Sequelize[_0xe0bd('0x1')](_0xe0bd('0x2'),_0xe0bd('0x6'),_0xe0bd('0x3'))},'keyContent':{'type':Sequelize[_0xe0bd('0x5')]},'idField':{'type':Sequelize[_0xe0bd('0x5')]},'nameField':{'type':Sequelize[_0xe0bd('0x5')]},'customField':{'type':Sequelize[_0xe0bd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0bd('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index dedd3eb..6a51aaa 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 _0x1c0c=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','SugarcrmField','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x462459,_0x25f6ab){var _0x2836ea=function(_0x352ca4){while(--_0x352ca4){_0x462459['push'](_0x462459['shift']());}};_0x2836ea(++_0x25f6ab);}(_0x1c0c,0x7a));var _0xc1c0=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x1c0c[_0x12d033];return _0x3b4e80;};'use strict';var pdf=require(_0xc1c0('0x0'));var emlformat=require(_0xc1c0('0x1'));var rimraf=require(_0xc1c0('0x2'));var zipdir=require(_0xc1c0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c0('0x4'));var moment=require(_0xc1c0('0x5'));var BPromise=require(_0xc1c0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc1c0('0x7'));var sox=require(_0xc1c0('0x8'));var csv=require(_0xc1c0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc1c0('0xa'));var squel=require(_0xc1c0('0xb'));var crypto=require(_0xc1c0('0xc'));var jsforce=require(_0xc1c0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc1c0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc1c0('0xf'));var qs=require(_0xc1c0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1c0('0x11'));var logger=require(_0xc1c0('0x12'))(_0xc1c0('0x13'));var utils=require(_0xc1c0('0x14'));var config=require(_0xc1c0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12f62b,_0x5246f7){_0x5246f7=_0x5246f7||0xcc;return function(_0x39fc11){if(_0x39fc11){return _0x12f62b['sendStatus'](_0x5246f7);}return _0x12f62b[_0xc1c0('0x16')](_0x5246f7)[_0xc1c0('0x17')]();};}function respondWithResult(_0x2e7b54,_0x53afc4){_0x53afc4=_0x53afc4||0xc8;return function(_0x4ff2e7){if(_0x4ff2e7){return _0x2e7b54[_0xc1c0('0x16')](_0x53afc4)[_0xc1c0('0x18')](_0x4ff2e7);}};}function respondWithFilteredResult(_0x3b8567,_0x3fe550){return function(_0x53794b){if(_0x53794b){var _0x5ecb6a=_0x53794b[_0xc1c0('0x19')],_0x4ccf0e=_0x3fe550[_0xc1c0('0x1a')],_0x2cdffc=_0x3fe550[_0xc1c0('0x1a')]+_0x3fe550[_0xc1c0('0x1b')],_0x53833b;if(_0x2cdffc>=_0x5ecb6a){_0x2cdffc=_0x5ecb6a;_0x53833b=0xc8;}else{_0x53833b=0xce;}_0x3b8567[_0xc1c0('0x16')](_0x53833b);return _0x3b8567[_0xc1c0('0x1c')](_0xc1c0('0x1d'),_0x4ccf0e+'-'+_0x2cdffc+'/'+_0x5ecb6a)[_0xc1c0('0x18')](_0x53794b);}return null;};}function patchUpdates(_0x278f0f){return function(_0x21d18a){try{jsonpatch[_0xc1c0('0x1e')](_0x21d18a,_0x278f0f,!![]);}catch(_0x39877e){return BPromise[_0xc1c0('0x1f')](_0x39877e);}return _0x21d18a['save']();};}function saveUpdates(_0x227a35,_0x593b82){return function(_0x2296a1){if(_0x2296a1){return _0x2296a1[_0xc1c0('0x20')](_0x227a35)[_0xc1c0('0x21')](function(_0x410262){return _0x410262;});}return null;};}function removeEntity(_0x53366e,_0xae1da0){return function(_0x42f7ed){if(_0x42f7ed){return _0x42f7ed[_0xc1c0('0x22')]()[_0xc1c0('0x21')](function(){_0x53366e['status'](0xcc)[_0xc1c0('0x17')]();});}};}function handleEntityNotFound(_0x23264f,_0x67aefd){return function(_0x3bef15){if(!_0x3bef15){_0x23264f[_0xc1c0('0x23')](0x194);}return _0x3bef15;};}function handleError(_0x779539,_0x2df421){_0x2df421=_0x2df421||0x1f4;return function(_0x1dd069){logger[_0xc1c0('0x24')](_0x1dd069[_0xc1c0('0x25')]);if(_0x1dd069[_0xc1c0('0x26')]){delete _0x1dd069[_0xc1c0('0x26')];}_0x779539[_0xc1c0('0x16')](_0x2df421)[_0xc1c0('0x27')](_0x1dd069);};}exports['index']=function(_0x101cb1,_0x264e5e){var _0x3a8fa9={},_0x8f91d7={},_0x1670e3={'count':0x0,'rows':[]};var _0x89e6e1=_[_0xc1c0('0x28')](db[_0xc1c0('0x29')]['rawAttributes'],function(_0x43d37d){return{'name':_0x43d37d[_0xc1c0('0x2a')],'type':_0x43d37d[_0xc1c0('0x2b')]['key']};});_0x8f91d7[_0xc1c0('0x2c')]=_[_0xc1c0('0x28')](_0x89e6e1,_0xc1c0('0x26'));_0x8f91d7[_0xc1c0('0x2d')]=_['keys'](_0x101cb1[_0xc1c0('0x2d')]);_0x8f91d7[_0xc1c0('0x2e')]=_['intersection'](_0x8f91d7[_0xc1c0('0x2c')],_0x8f91d7['query']);_0x3a8fa9[_0xc1c0('0x2f')]=_[_0xc1c0('0x30')](_0x8f91d7[_0xc1c0('0x2c')],qs[_0xc1c0('0x31')](_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x31')]));_0x3a8fa9[_0xc1c0('0x2f')]=_0x3a8fa9['attributes'][_0xc1c0('0x32')]?_0x3a8fa9[_0xc1c0('0x2f')]:_0x8f91d7[_0xc1c0('0x2c')];if(!_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x33')]('nolimit')){_0x3a8fa9[_0xc1c0('0x1b')]=qs['limit'](_0x101cb1['query'][_0xc1c0('0x1b')]);_0x3a8fa9[_0xc1c0('0x1a')]=qs[_0xc1c0('0x1a')](_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x1a')]);}_0x3a8fa9[_0xc1c0('0x34')]=qs[_0xc1c0('0x35')](_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x35')]);_0x3a8fa9[_0xc1c0('0x36')]=qs[_0xc1c0('0x2e')](_[_0xc1c0('0x37')](_0x101cb1[_0xc1c0('0x2d')],_0x8f91d7['filters']),_0x89e6e1);if(_0x101cb1['query'][_0xc1c0('0x38')]){_0x3a8fa9[_0xc1c0('0x36')]=_[_0xc1c0('0x39')](_0x3a8fa9['where'],{'$or':_[_0xc1c0('0x28')](_0x89e6e1,function(_0x42e509){if(_0x42e509[_0xc1c0('0x2b')]!==_0xc1c0('0x3a')){var _0x202936={};_0x202936[_0x42e509[_0xc1c0('0x26')]]={'$like':'%'+_0x101cb1[_0xc1c0('0x2d')]['filter']+'%'};return _0x202936;}})});}_0x3a8fa9=_[_0xc1c0('0x39')]({},_0x3a8fa9,_0x101cb1[_0xc1c0('0x3b')]);var _0x190545={'where':_0x3a8fa9[_0xc1c0('0x36')]};return db[_0xc1c0('0x29')][_0xc1c0('0x19')](_0x190545)[_0xc1c0('0x21')](function(_0x5ce49b){_0x1670e3[_0xc1c0('0x19')]=_0x5ce49b;if(_0x101cb1[_0xc1c0('0x2d')][_0xc1c0('0x3c')]){_0x3a8fa9[_0xc1c0('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0xc1c0('0x3e')](_0x3a8fa9);})[_0xc1c0('0x21')](function(_0x1152dc){_0x1670e3[_0xc1c0('0x3f')]=_0x1152dc;return _0x1670e3;})[_0xc1c0('0x21')](respondWithFilteredResult(_0x264e5e,_0x3a8fa9))[_0xc1c0('0x40')](handleError(_0x264e5e,null));};exports[_0xc1c0('0x41')]=function(_0x814afc,_0xca60b1){var _0x467e91={'raw':!![],'where':{'id':_0x814afc[_0xc1c0('0x42')]['id']}},_0x2d7cbd={};_0x2d7cbd['model']=_[_0xc1c0('0x43')](db[_0xc1c0('0x29')][_0xc1c0('0x44')]);_0x2d7cbd[_0xc1c0('0x2d')]=_[_0xc1c0('0x43')](_0x814afc['query']);_0x2d7cbd[_0xc1c0('0x2e')]=_[_0xc1c0('0x30')](_0x2d7cbd[_0xc1c0('0x2c')],_0x2d7cbd['query']);_0x467e91['attributes']=_[_0xc1c0('0x30')](_0x2d7cbd[_0xc1c0('0x2c')],qs[_0xc1c0('0x31')](_0x814afc['query']['fields']));_0x467e91['attributes']=_0x467e91[_0xc1c0('0x2f')][_0xc1c0('0x32')]?_0x467e91[_0xc1c0('0x2f')]:_0x2d7cbd['model'];if(_0x814afc[_0xc1c0('0x2d')]['includeAll']){_0x467e91[_0xc1c0('0x3d')]=[{'all':!![]}];}_0x467e91=_[_0xc1c0('0x39')]({},_0x467e91,_0x814afc[_0xc1c0('0x3b')]);return db[_0xc1c0('0x29')]['find'](_0x467e91)[_0xc1c0('0x21')](handleEntityNotFound(_0xca60b1,null))['then'](respondWithResult(_0xca60b1,null))[_0xc1c0('0x40')](handleError(_0xca60b1,null));};exports['create']=function(_0x5b6b61,_0x225f51){return db['SugarcrmField'][_0xc1c0('0x45')](_0x5b6b61[_0xc1c0('0x46')],{})['then'](respondWithResult(_0x225f51,0xc9))[_0xc1c0('0x40')](handleError(_0x225f51,null));};exports[_0xc1c0('0x20')]=function(_0x3d09b5,_0x567cf3){if(_0x3d09b5[_0xc1c0('0x46')]['id']){delete _0x3d09b5[_0xc1c0('0x46')]['id'];}return db[_0xc1c0('0x29')][_0xc1c0('0x47')]({'where':{'id':_0x3d09b5[_0xc1c0('0x42')]['id']}})[_0xc1c0('0x21')](handleEntityNotFound(_0x567cf3,null))[_0xc1c0('0x21')](saveUpdates(_0x3d09b5[_0xc1c0('0x46')],null))[_0xc1c0('0x21')](respondWithResult(_0x567cf3,null))[_0xc1c0('0x40')](handleError(_0x567cf3,null));};exports[_0xc1c0('0x22')]=function(_0x87d258,_0xae024){return db[_0xc1c0('0x29')][_0xc1c0('0x47')]({'where':{'id':_0x87d258[_0xc1c0('0x42')]['id']}})['then'](handleEntityNotFound(_0xae024,null))[_0xc1c0('0x21')](removeEntity(_0xae024,null))[_0xc1c0('0x40')](handleError(_0xae024,null));}; \ No newline at end of file +var _0x940e=['filter','VIRTUAL','merge','options','SugarcrmField','include','findAll','rows','show','params','create','catch','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0x940e,0x126));var _0xe940=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0x940e[_0x61b3ab];return _0x57097f;};'use strict';var pdf=require(_0xe940('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe940('0x1'));var zipdir=require(_0xe940('0x2'));var jsonpatch=require(_0xe940('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe940('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe940('0x5'));var sox=require(_0xe940('0x6'));var csv=require(_0xe940('0x7'));var ejs=require(_0xe940('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe940('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe940('0xa'));var toCsv=require(_0xe940('0x7'));var querystring=require(_0xe940('0xb'));var Papa=require(_0xe940('0xc'));var Redis=require('ioredis');var authService=require(_0xe940('0xd'));var qs=require(_0xe940('0xe'));var as=require(_0xe940('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe940('0x10'))(_0xe940('0x11'));var utils=require(_0xe940('0x12'));var config=require(_0xe940('0x13'));var db=require(_0xe940('0x14'))['db'];function respondWithStatusCode(_0x52774e,_0x36649f){_0x36649f=_0x36649f||0xcc;return function(_0x277691){if(_0x277691){return _0x52774e['sendStatus'](_0x36649f);}return _0x52774e[_0xe940('0x15')](_0x36649f)[_0xe940('0x16')]();};}function respondWithResult(_0x24d847,_0x3600fa){_0x3600fa=_0x3600fa||0xc8;return function(_0x2a9e3d){if(_0x2a9e3d){return _0x24d847['status'](_0x3600fa)['json'](_0x2a9e3d);}};}function respondWithFilteredResult(_0x23ff91,_0x58e154){return function(_0x7ee89e){if(_0x7ee89e){var _0x17a13b=_0x7ee89e[_0xe940('0x17')],_0x78dadc=_0x58e154[_0xe940('0x18')],_0x55587d=_0x58e154[_0xe940('0x18')]+_0x58e154[_0xe940('0x19')],_0x3d38bc;if(_0x55587d>=_0x17a13b){_0x55587d=_0x17a13b;_0x3d38bc=0xc8;}else{_0x3d38bc=0xce;}_0x23ff91['status'](_0x3d38bc);return _0x23ff91[_0xe940('0x1a')](_0xe940('0x1b'),_0x78dadc+'-'+_0x55587d+'/'+_0x17a13b)['json'](_0x7ee89e);}return null;};}function patchUpdates(_0x1f07bc){return function(_0x116a63){try{jsonpatch[_0xe940('0x1c')](_0x116a63,_0x1f07bc,!![]);}catch(_0x319bb9){return BPromise[_0xe940('0x1d')](_0x319bb9);}return _0x116a63[_0xe940('0x1e')]();};}function saveUpdates(_0x2d97eb,_0x2d4964){return function(_0x2538df){if(_0x2538df){return _0x2538df[_0xe940('0x1f')](_0x2d97eb)['then'](function(_0x4aadb6){return _0x4aadb6;});}return null;};}function removeEntity(_0x9143e4,_0x397f32){return function(_0x2091e3){if(_0x2091e3){return _0x2091e3[_0xe940('0x20')]()[_0xe940('0x21')](function(){_0x9143e4[_0xe940('0x15')](0xcc)[_0xe940('0x16')]();});}};}function handleEntityNotFound(_0x2a7f6b,_0x2d0269){return function(_0x3a5839){if(!_0x3a5839){_0x2a7f6b[_0xe940('0x22')](0x194);}return _0x3a5839;};}function handleError(_0x453bc6,_0x112d4d){_0x112d4d=_0x112d4d||0x1f4;return function(_0x35399c){logger['error'](_0x35399c[_0xe940('0x23')]);if(_0x35399c[_0xe940('0x24')]){delete _0x35399c['name'];}_0x453bc6['status'](_0x112d4d)[_0xe940('0x25')](_0x35399c);};}exports['index']=function(_0x12f4c9,_0x217fe5){var _0x441146={},_0x46e694={},_0x5d6c23={'count':0x0,'rows':[]};var _0x452acb=_[_0xe940('0x26')](db['SugarcrmField'][_0xe940('0x27')],function(_0x178731){return{'name':_0x178731[_0xe940('0x28')],'type':_0x178731[_0xe940('0x29')][_0xe940('0x2a')]};});_0x46e694[_0xe940('0x2b')]=_[_0xe940('0x26')](_0x452acb,_0xe940('0x24'));_0x46e694[_0xe940('0x2c')]=_[_0xe940('0x2d')](_0x12f4c9[_0xe940('0x2c')]);_0x46e694[_0xe940('0x2e')]=_[_0xe940('0x2f')](_0x46e694[_0xe940('0x2b')],_0x46e694['query']);_0x441146[_0xe940('0x30')]=_[_0xe940('0x2f')](_0x46e694['model'],qs['fields'](_0x12f4c9['query'][_0xe940('0x31')]));_0x441146[_0xe940('0x30')]=_0x441146[_0xe940('0x30')][_0xe940('0x32')]?_0x441146[_0xe940('0x30')]:_0x46e694[_0xe940('0x2b')];if(!_0x12f4c9[_0xe940('0x2c')][_0xe940('0x33')](_0xe940('0x34'))){_0x441146[_0xe940('0x19')]=qs[_0xe940('0x19')](_0x12f4c9[_0xe940('0x2c')][_0xe940('0x19')]);_0x441146[_0xe940('0x18')]=qs[_0xe940('0x18')](_0x12f4c9[_0xe940('0x2c')][_0xe940('0x18')]);}_0x441146[_0xe940('0x35')]=qs[_0xe940('0x36')](_0x12f4c9[_0xe940('0x2c')][_0xe940('0x36')]);_0x441146[_0xe940('0x37')]=qs['filters'](_['pick'](_0x12f4c9[_0xe940('0x2c')],_0x46e694[_0xe940('0x2e')]),_0x452acb);if(_0x12f4c9[_0xe940('0x2c')][_0xe940('0x38')]){_0x441146[_0xe940('0x37')]=_['merge'](_0x441146['where'],{'$or':_[_0xe940('0x26')](_0x452acb,function(_0x1f3a20){if(_0x1f3a20[_0xe940('0x29')]!==_0xe940('0x39')){var _0x2fcf76={};_0x2fcf76[_0x1f3a20[_0xe940('0x24')]]={'$like':'%'+_0x12f4c9[_0xe940('0x2c')][_0xe940('0x38')]+'%'};return _0x2fcf76;}})});}_0x441146=_[_0xe940('0x3a')]({},_0x441146,_0x12f4c9[_0xe940('0x3b')]);var _0x36f839={'where':_0x441146[_0xe940('0x37')]};return db[_0xe940('0x3c')]['count'](_0x36f839)[_0xe940('0x21')](function(_0x1374c4){_0x5d6c23[_0xe940('0x17')]=_0x1374c4;if(_0x12f4c9['query']['includeAll']){_0x441146[_0xe940('0x3d')]=[{'all':!![]}];}return db[_0xe940('0x3c')][_0xe940('0x3e')](_0x441146);})['then'](function(_0x5e2047){_0x5d6c23[_0xe940('0x3f')]=_0x5e2047;return _0x5d6c23;})['then'](respondWithFilteredResult(_0x217fe5,_0x441146))['catch'](handleError(_0x217fe5,null));};exports[_0xe940('0x40')]=function(_0x96979c,_0x1b49d3){var _0x2ee21b={'raw':!![],'where':{'id':_0x96979c[_0xe940('0x41')]['id']}},_0x571b89={};_0x571b89[_0xe940('0x2b')]=_[_0xe940('0x2d')](db[_0xe940('0x3c')]['rawAttributes']);_0x571b89[_0xe940('0x2c')]=_[_0xe940('0x2d')](_0x96979c[_0xe940('0x2c')]);_0x571b89[_0xe940('0x2e')]=_[_0xe940('0x2f')](_0x571b89[_0xe940('0x2b')],_0x571b89[_0xe940('0x2c')]);_0x2ee21b[_0xe940('0x30')]=_[_0xe940('0x2f')](_0x571b89[_0xe940('0x2b')],qs[_0xe940('0x31')](_0x96979c['query'][_0xe940('0x31')]));_0x2ee21b[_0xe940('0x30')]=_0x2ee21b['attributes'][_0xe940('0x32')]?_0x2ee21b[_0xe940('0x30')]:_0x571b89[_0xe940('0x2b')];if(_0x96979c[_0xe940('0x2c')]['includeAll']){_0x2ee21b[_0xe940('0x3d')]=[{'all':!![]}];}_0x2ee21b=_[_0xe940('0x3a')]({},_0x2ee21b,_0x96979c['options']);return db[_0xe940('0x3c')]['find'](_0x2ee21b)[_0xe940('0x21')](handleEntityNotFound(_0x1b49d3,null))['then'](respondWithResult(_0x1b49d3,null))['catch'](handleError(_0x1b49d3,null));};exports[_0xe940('0x42')]=function(_0x2138d4,_0x615b68){return db[_0xe940('0x3c')][_0xe940('0x42')](_0x2138d4['body'],{})[_0xe940('0x21')](respondWithResult(_0x615b68,0xc9))[_0xe940('0x43')](handleError(_0x615b68,null));};exports[_0xe940('0x1f')]=function(_0x99a02d,_0x39ba5b){if(_0x99a02d[_0xe940('0x44')]['id']){delete _0x99a02d[_0xe940('0x44')]['id'];}return db[_0xe940('0x3c')][_0xe940('0x45')]({'where':{'id':_0x99a02d['params']['id']}})['then'](handleEntityNotFound(_0x39ba5b,null))[_0xe940('0x21')](saveUpdates(_0x99a02d['body'],null))[_0xe940('0x21')](respondWithResult(_0x39ba5b,null))[_0xe940('0x43')](handleError(_0x39ba5b,null));};exports[_0xe940('0x20')]=function(_0x4253af,_0x2c4c16){return db[_0xe940('0x3c')][_0xe940('0x45')]({'where':{'id':_0x4253af['params']['id']}})[_0xe940('0x21')](handleEntityNotFound(_0x2c4c16,null))[_0xe940('0x21')](removeEntity(_0x2c4c16,null))[_0xe940('0x43')](handleError(_0x2c4c16,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4be2b56..9c1bfa1 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 _0x0224=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x315878,_0x502f7e){var _0x4f4148=function(_0x13387e){while(--_0x13387e){_0x315878['push'](_0x315878['shift']());}};_0x4f4148(++_0x502f7e);}(_0x0224,0x1ee));var _0x4022=function(_0x2a1338,_0x29f7aa){_0x2a1338=_0x2a1338-0x0;var _0xc02469=_0x0224[_0x2a1338];return _0xc02469;};'use strict';var _=require(_0x4022('0x0'));var util=require(_0x4022('0x1'));var logger=require(_0x4022('0x2'))(_0x4022('0x3'));var moment=require(_0x4022('0x4'));var BPromise=require(_0x4022('0x5'));var rp=require(_0x4022('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4022('0x7'));var config=require(_0x4022('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x4022('0x9')]=function(_0x4d379b,_0x5ebdf0){return _0x4d379b['define'](_0x4022('0xa'),attributes,{'tableName':_0x4022('0xb'),'paranoid':![],'indexes':[{'name':_0x4022('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x935c=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField'];(function(_0x15bf32,_0x2a4119){var _0x215301=function(_0x55079b){while(--_0x55079b){_0x15bf32['push'](_0x15bf32['shift']());}};_0x215301(++_0x2a4119);}(_0x935c,0x1f0));var _0xc935=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x935c[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xc935('0x0'));var util=require(_0xc935('0x1'));var logger=require(_0xc935('0x2'))(_0xc935('0x3'));var moment=require(_0xc935('0x4'));var BPromise=require(_0xc935('0x5'));var rp=require(_0xc935('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc935('0x7'));var attributes=require(_0xc935('0x8'));module['exports']=function(_0x2f88e4,_0x5212be){return _0x2f88e4[_0xc935('0x9')](_0xc935('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xc935('0xb'),_0xc935('0xc')],'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 b29d9a3..ec9a451 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x4f1498,_0x1bb62d){var _0x534891=function(_0x467c10){while(--_0x467c10){_0x4f1498['push'](_0x4f1498['shift']());}};_0x534891(++_0x1bb62d);}(_0x1a85,0x178));var _0x51a8=function(_0x488818,_0x17c6de){_0x488818=_0x488818-0x0;var _0x30783c=_0x1a85[_0x488818];return _0x30783c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x18492f,_0x1fd80a){var _0x39b8d2=function(_0x570347){while(--_0x570347){_0x18492f['push'](_0x18492f['shift']());}};_0x39b8d2(++_0x1fd80a);}(_0x1a85,0x178));var _0x51a8=function(_0x408a02,_0x478ca0){_0x408a02=_0x408a02-0x0;var _0x579bce=_0x1a85[_0x408a02];return _0x579bce;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 07b9288..67b6491 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 _0x2f33=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','/:id','update','delete','destroy'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2f33,0x109));var _0x32f3=function(_0x22b7ad,_0x5a93f8){_0x22b7ad=_0x22b7ad-0x0;var _0x1a526a=_0x2f33[_0x22b7ad];return _0x1a526a;};'use strict';var multer=require(_0x32f3('0x0'));var util=require(_0x32f3('0x1'));var path=require(_0x32f3('0x2'));var timeout=require(_0x32f3('0x3'));var express=require(_0x32f3('0x4'));var router=express['Router']();var auth=require(_0x32f3('0x5'));var interaction=require(_0x32f3('0x6'));var config=require(_0x32f3('0x7'));var controller=require('./intVtigerAccount.controller');router[_0x32f3('0x8')]('/',auth[_0x32f3('0x9')](),controller[_0x32f3('0xa')]);router['get']('/:id',auth[_0x32f3('0x9')](),controller['show']);router[_0x32f3('0x8')](_0x32f3('0xb'),auth[_0x32f3('0x9')](),controller[_0x32f3('0xc')]);router[_0x32f3('0x8')](_0x32f3('0xd'),auth[_0x32f3('0x9')](),controller['getFields']);router['post']('/',auth[_0x32f3('0x9')](),controller['create']);router[_0x32f3('0xe')](_0x32f3('0xb'),auth['isAuthenticated'](),controller[_0x32f3('0xf')]);router[_0x32f3('0x10')](_0x32f3('0x11'),auth['isAuthenticated'](),controller[_0x32f3('0x12')]);router[_0x32f3('0x13')](_0x32f3('0x11'),auth[_0x32f3('0x9')](),controller[_0x32f3('0x14')]);module[_0x32f3('0x15')]=router; \ No newline at end of file +var _0x0fcd=['getFields','post','create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x1ccb6b,_0x4e91e6){var _0x4c316=function(_0x324f8c){while(--_0x324f8c){_0x1ccb6b['push'](_0x1ccb6b['shift']());}};_0x4c316(++_0x4e91e6);}(_0x0fcd,0x197));var _0xd0fc=function(_0x5572b0,_0x3dfcce){_0x5572b0=_0x5572b0-0x0;var _0x559e38=_0x0fcd[_0x5572b0];return _0x559e38;};'use strict';var multer=require(_0xd0fc('0x0'));var util=require('util');var path=require(_0xd0fc('0x1'));var timeout=require(_0xd0fc('0x2'));var express=require('express');var router=express[_0xd0fc('0x3')]();var auth=require(_0xd0fc('0x4'));var interaction=require(_0xd0fc('0x5'));var config=require('../../config/environment');var controller=require(_0xd0fc('0x6'));router[_0xd0fc('0x7')]('/',auth[_0xd0fc('0x8')](),controller[_0xd0fc('0x9')]);router[_0xd0fc('0x7')](_0xd0fc('0xa'),auth[_0xd0fc('0x8')](),controller['show']);router[_0xd0fc('0x7')](_0xd0fc('0xb'),auth[_0xd0fc('0x8')](),controller[_0xd0fc('0xc')]);router[_0xd0fc('0x7')]('/:id/fields',auth[_0xd0fc('0x8')](),controller[_0xd0fc('0xd')]);router[_0xd0fc('0xe')]('/',auth[_0xd0fc('0x8')](),controller[_0xd0fc('0xf')]);router[_0xd0fc('0xe')](_0xd0fc('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd0fc('0x10')]('/:id',auth[_0xd0fc('0x8')](),controller[_0xd0fc('0x11')]);router[_0xd0fc('0x12')](_0xd0fc('0xa'),auth[_0xd0fc('0x8')](),controller['destroy']);module[_0xd0fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1c9f180..1671c8a 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 _0x0b68=['exports','STRING','HelpDesk'];(function(_0x16d004,_0x4d0ce7){var _0x28aa7a=function(_0x4882e8){while(--_0x4882e8){_0x16d004['push'](_0x16d004['shift']());}};_0x28aa7a(++_0x4d0ce7);}(_0x0b68,0x147));var _0x80b6=function(_0x2813fd,_0x3136ad){_0x2813fd=_0x2813fd-0x0;var _0x4f0cd9=_0x0b68[_0x2813fd];return _0x4f0cd9;};'use strict';var Sequelize=require('sequelize');module[_0x80b6('0x0')]={'name':{'type':Sequelize[_0x80b6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x80b6('0x1')]},'username':{'type':Sequelize[_0x80b6('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x80b6('0x1')],'allowNull':![],'defaultValue':_0x80b6('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x80b6('0x1')]},'accessKey':{'type':Sequelize[_0x80b6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1848=['STRING','HelpDesk','exports'];(function(_0x1d2fb7,_0x46f357){var _0x4fadd9=function(_0x54b557){while(--_0x54b557){_0x1d2fb7['push'](_0x1d2fb7['shift']());}};_0x4fadd9(++_0x46f357);}(_0x1848,0x12b));var _0x8184=function(_0x53b8f2,_0x33050a){_0x53b8f2=_0x53b8f2-0x0;var _0x40abf1=_0x1848[_0x53b8f2];return _0x40abf1;};'use strict';var Sequelize=require('sequelize');module[_0x8184('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8184('0x1')]},'username':{'type':Sequelize[_0x8184('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8184('0x1')],'allowNull':![],'defaultValue':_0x8184('0x2')},'remoteUri':{'type':Sequelize[_0x8184('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 0a720d7..5b6e004 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 _0x5f5c=['owner','remove','includes','editable','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','VtigerAccount','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','getFields','username','description','moduleName','accessKey','remoteUri','slice','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','describe','sessionName','autogenerated','reference'];(function(_0x27c295,_0x9df280){var _0x33fb47=function(_0x3978b4){while(--_0x3978b4){_0x27c295['push'](_0x27c295['shift']());}};_0x33fb47(++_0x9df280);}(_0x5f5c,0x110));var _0xc5f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f5c[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xc5f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc5f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5f5('0x2'));var rp=require(_0xc5f5('0x3'));var moment=require(_0xc5f5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc5f5('0x5'));var util=require(_0xc5f5('0x6'));var path=require(_0xc5f5('0x7'));var sox=require(_0xc5f5('0x8'));var csv=require(_0xc5f5('0x9'));var ejs=require(_0xc5f5('0xa'));var fs=require('fs');var _=require(_0xc5f5('0xb'));var squel=require(_0xc5f5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5f5('0xd'));var toCsv=require(_0xc5f5('0x9'));var querystring=require(_0xc5f5('0xe'));var Papa=require(_0xc5f5('0xf'));var Redis=require(_0xc5f5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc5f5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5f5('0x12'))(_0xc5f5('0x13'));var utils=require('../../config/utils');var config=require(_0xc5f5('0x14'));var db=require(_0xc5f5('0x15'))['db'];var integrations=require(_0xc5f5('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xc5f5('0x17')][_0xc5f5('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5d293e,_0x28494e,_0x546083){if(_0x546083){var _0xa4905d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa4905d[_0xc5f5('0x19')](_0x28494e)){return _0x5d293e;}else{throw new db[(_0xc5f5('0x1a'))][(_0xc5f5('0x1b'))](_0xc5f5('0x1c'));}}else{return _0x5d293e;}}function respondWithRpcPromise(_0x312937,_0x47bfd3,_0x3cc6a6,_0x3a2058){return new BPromise(function(_0x547c3a,_0x118f57){var _0x1c61b3=_0x3a2058||client;return _0x1c61b3[_0xc5f5('0x1d')](_0x312937,_0x3cc6a6)[_0xc5f5('0x1e')](function(_0x49a0bb){logger[_0xc5f5('0x1f')](_0xc5f5('0x20'),_0x47bfd3,'request\x20sent');logger[_0xc5f5('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x47bfd3,_0xc5f5('0x22'),JSON[_0xc5f5('0x23')](_0x49a0bb));if(_0x49a0bb[_0xc5f5('0x24')]){if(_0x49a0bb[_0xc5f5('0x24')]['code']===0x1f4){logger[_0xc5f5('0x24')](_0xc5f5('0x20'),_0x47bfd3,_0x49a0bb[_0xc5f5('0x24')][_0xc5f5('0x25')]);return _0x118f57(_0x49a0bb[_0xc5f5('0x24')][_0xc5f5('0x25')]);}logger[_0xc5f5('0x24')](_0xc5f5('0x20'),_0x47bfd3,_0x49a0bb[_0xc5f5('0x24')][_0xc5f5('0x25')]);return _0x547c3a(_0x49a0bb['error']['message']);}else{logger[_0xc5f5('0x1f')](_0xc5f5('0x20'),_0x47bfd3,_0xc5f5('0x22'));_0x547c3a(_0x49a0bb[_0xc5f5('0x26')]['message']);}})['catch'](function(_0x489796){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x47bfd3,_0x489796);_0x118f57(_0x489796);});});}function respondWithStatusCode(_0x2721de,_0x2f2c4d){_0x2f2c4d=_0x2f2c4d||0xcc;return function(_0x48ac47){if(_0x48ac47){return _0x2721de[_0xc5f5('0x27')](_0x2f2c4d);}return _0x2721de[_0xc5f5('0x28')](_0x2f2c4d)[_0xc5f5('0x29')]();};}function respondWithResult(_0x4593dd,_0x6e849b){_0x6e849b=_0x6e849b||0xc8;return function(_0x534d0d){if(_0x534d0d){return _0x4593dd[_0xc5f5('0x28')](_0x6e849b)[_0xc5f5('0x2a')](_0x534d0d);}};}function respondWithFilteredResult(_0x50b568,_0x2d96e9){return function(_0xc6f984){if(_0xc6f984){var _0x15ff17=_0xc6f984[_0xc5f5('0x2b')],_0x95da52=_0x2d96e9[_0xc5f5('0x2c')],_0x3405b5=_0x2d96e9[_0xc5f5('0x2c')]+_0x2d96e9['limit'],_0x26af92;if(_0x3405b5>=_0x15ff17){_0x3405b5=_0x15ff17;_0x26af92=0xc8;}else{_0x26af92=0xce;}_0x50b568['status'](_0x26af92);return _0x50b568[_0xc5f5('0x2d')](_0xc5f5('0x2e'),_0x95da52+'-'+_0x3405b5+'/'+_0x15ff17)[_0xc5f5('0x2a')](_0xc6f984);}return null;};}function patchUpdates(_0x590bdc){return function(_0x5b2dc9){try{jsonpatch[_0xc5f5('0x2f')](_0x5b2dc9,_0x590bdc,!![]);}catch(_0x687f8f){return BPromise[_0xc5f5('0x30')](_0x687f8f);}return _0x5b2dc9[_0xc5f5('0x31')]();};}function saveUpdates(_0x5e19d7,_0x4b707c){return function(_0x5e53ee){if(_0x5e53ee){return _0x5e53ee[_0xc5f5('0x32')](_0x5e19d7)[_0xc5f5('0x1e')](function(_0x313678){return _0x313678;});}return null;};}function removeEntity(_0x4e14fb,_0x97a8e4){return function(_0x265926){if(_0x265926){return _0x265926[_0xc5f5('0x33')]()[_0xc5f5('0x1e')](function(){_0x4e14fb[_0xc5f5('0x28')](0xcc)[_0xc5f5('0x29')]();});}};}function handleEntityNotFound(_0x5029bd,_0x38b952){return function(_0xad0ad6){if(!_0xad0ad6){_0x5029bd[_0xc5f5('0x27')](0x194);}return _0xad0ad6;};}function handleError(_0x7b1d67,_0x4ea2d2){_0x4ea2d2=_0x4ea2d2||0x1f4;return function(_0x4cfd47){logger[_0xc5f5('0x24')](_0x4cfd47['stack']);if(_0x4cfd47[_0xc5f5('0x34')]){delete _0x4cfd47[_0xc5f5('0x34')];}_0x7b1d67[_0xc5f5('0x28')](_0x4ea2d2)[_0xc5f5('0x35')](_0x4cfd47);};}exports[_0xc5f5('0x36')]=function(_0x3d95f3,_0x36d7ef){var _0x4ed5ee={},_0x5e3b7c={},_0x3f122a={'count':0x0,'rows':[]};var _0x3931cb=_[_0xc5f5('0x37')](db[_0xc5f5('0x38')]['rawAttributes'],function(_0x358b6f){return{'name':_0x358b6f['fieldName'],'type':_0x358b6f['type']['key']};});_0x5e3b7c[_0xc5f5('0x39')]=_['map'](_0x3931cb,'name');_0x5e3b7c[_0xc5f5('0x3a')]=_[_0xc5f5('0x3b')](_0x3d95f3[_0xc5f5('0x3a')]);_0x5e3b7c[_0xc5f5('0x3c')]=_[_0xc5f5('0x3d')](_0x5e3b7c[_0xc5f5('0x39')],_0x5e3b7c[_0xc5f5('0x3a')]);_0x4ed5ee[_0xc5f5('0x3e')]=_['intersection'](_0x5e3b7c[_0xc5f5('0x39')],qs[_0xc5f5('0x3f')](_0x3d95f3['query'][_0xc5f5('0x3f')]));_0x4ed5ee[_0xc5f5('0x3e')]=_0x4ed5ee[_0xc5f5('0x3e')][_0xc5f5('0x40')]?_0x4ed5ee[_0xc5f5('0x3e')]:_0x5e3b7c[_0xc5f5('0x39')];if(!_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x41')](_0xc5f5('0x42'))){_0x4ed5ee[_0xc5f5('0x43')]=qs['limit'](_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x43')]);_0x4ed5ee[_0xc5f5('0x2c')]=qs[_0xc5f5('0x2c')](_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x2c')]);}_0x4ed5ee[_0xc5f5('0x44')]=qs['sort'](_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x45')]);_0x4ed5ee[_0xc5f5('0x46')]=qs[_0xc5f5('0x3c')](_[_0xc5f5('0x47')](_0x3d95f3[_0xc5f5('0x3a')],_0x5e3b7c['filters']),_0x3931cb);if(_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x48')]){_0x4ed5ee[_0xc5f5('0x46')]=_[_0xc5f5('0x49')](_0x4ed5ee['where'],{'$or':_[_0xc5f5('0x37')](_0x3931cb,function(_0x1ec5a0){if(_0x1ec5a0[_0xc5f5('0x4a')]!==_0xc5f5('0x4b')){var _0x549a99={};_0x549a99[_0x1ec5a0[_0xc5f5('0x34')]]={'$like':'%'+_0x3d95f3['query'][_0xc5f5('0x48')]+'%'};return _0x549a99;}})});}_0x4ed5ee=_['merge']({},_0x4ed5ee,_0x3d95f3[_0xc5f5('0x4c')]);var _0x3d3d31={'where':_0x4ed5ee[_0xc5f5('0x46')]};return db[_0xc5f5('0x38')][_0xc5f5('0x2b')](_0x3d3d31)[_0xc5f5('0x1e')](function(_0xcb5cc3){_0x3f122a[_0xc5f5('0x2b')]=_0xcb5cc3;if(_0x3d95f3[_0xc5f5('0x3a')][_0xc5f5('0x4d')]){_0x4ed5ee[_0xc5f5('0x4e')]=[{'all':!![]}];}return db[_0xc5f5('0x38')][_0xc5f5('0x4f')](_0x4ed5ee);})[_0xc5f5('0x1e')](function(_0x3953ea){_0x3f122a[_0xc5f5('0x50')]=_0x3953ea;return _0x3f122a;})[_0xc5f5('0x1e')](respondWithFilteredResult(_0x36d7ef,_0x4ed5ee))[_0xc5f5('0x51')](handleError(_0x36d7ef,null));};exports[_0xc5f5('0x52')]=function(_0x2ddfce,_0x3a52be){var _0x560435={'raw':![],'where':{'id':_0x2ddfce[_0xc5f5('0x53')]['id']}},_0x53ed13={};_0x53ed13[_0xc5f5('0x39')]=_['keys'](db[_0xc5f5('0x38')][_0xc5f5('0x54')]);_0x53ed13[_0xc5f5('0x3a')]=_['keys'](_0x2ddfce['query']);_0x53ed13[_0xc5f5('0x3c')]=_['intersection'](_0x53ed13[_0xc5f5('0x39')],_0x53ed13['query']);_0x560435[_0xc5f5('0x3e')]=_[_0xc5f5('0x3d')](_0x53ed13['model'],qs[_0xc5f5('0x3f')](_0x2ddfce['query'][_0xc5f5('0x3f')]));_0x560435[_0xc5f5('0x3e')]=_0x560435[_0xc5f5('0x3e')][_0xc5f5('0x40')]?_0x560435[_0xc5f5('0x3e')]:_0x53ed13[_0xc5f5('0x39')];if(_0x2ddfce['query'][_0xc5f5('0x4d')]){_0x560435['include']=[{'all':!![]}];}_0x560435=_[_0xc5f5('0x49')]({},_0x560435,_0x2ddfce[_0xc5f5('0x4c')]);return db[_0xc5f5('0x38')]['find'](_0x560435)[_0xc5f5('0x1e')](handleEntityNotFound(_0x3a52be,null))[_0xc5f5('0x1e')](respondWithResult(_0x3a52be,null))[_0xc5f5('0x51')](handleError(_0x3a52be,null));};exports[_0xc5f5('0x55')]=function(_0x55e115,_0x352940){return db[_0xc5f5('0x38')][_0xc5f5('0x55')](_0x55e115['body'],{})[_0xc5f5('0x1e')](respondWithResult(_0x352940,0xc9))['catch'](handleError(_0x352940,null));};exports[_0xc5f5('0x32')]=function(_0x1623fe,_0x10173d){if(_0x1623fe[_0xc5f5('0x56')]['id']){delete _0x1623fe[_0xc5f5('0x56')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x1623fe[_0xc5f5('0x53')]['id']}})[_0xc5f5('0x1e')](handleEntityNotFound(_0x10173d,null))[_0xc5f5('0x1e')](saveUpdates(_0x1623fe['body'],null))['then'](respondWithResult(_0x10173d,null))[_0xc5f5('0x51')](handleError(_0x10173d,null));};exports[_0xc5f5('0x33')]=function(_0x811daa,_0xab3350){return db['VtigerAccount'][_0xc5f5('0x57')]({'where':{'id':_0x811daa[_0xc5f5('0x53')]['id']}})[_0xc5f5('0x1e')](handleEntityNotFound(_0xab3350,null))[_0xc5f5('0x1e')](removeEntity(_0xab3350,null))[_0xc5f5('0x51')](handleError(_0xab3350,null));};exports[_0xc5f5('0x58')]=function(_0x50b7cc,_0x58859f,_0x955e46){var _0x5bb09c={};var _0x492efa={};var _0x68917f;var _0x99d22c;return db[_0xc5f5('0x38')][_0xc5f5('0x59')]({'where':{'id':_0x50b7cc['params']['id']}})[_0xc5f5('0x1e')](handleEntityNotFound(_0x58859f,null))[_0xc5f5('0x1e')](function(_0x45a7e3){if(_0x45a7e3){_0x68917f=_0x45a7e3;_0x492efa[_0xc5f5('0x39')]=_[_0xc5f5('0x3b')](db[_0xc5f5('0x5a')][_0xc5f5('0x54')]);_0x492efa[_0xc5f5('0x3a')]=_[_0xc5f5('0x3b')](_0x50b7cc[_0xc5f5('0x3a')]);_0x492efa[_0xc5f5('0x3c')]=_['intersection'](_0x492efa['model'],_0x492efa[_0xc5f5('0x3a')]);_0x5bb09c[_0xc5f5('0x3e')]=_[_0xc5f5('0x3d')](_0x492efa[_0xc5f5('0x39')],qs[_0xc5f5('0x3f')](_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x3f')]));_0x5bb09c['attributes']=_0x5bb09c['attributes']['length']?_0x5bb09c[_0xc5f5('0x3e')]:_0x492efa[_0xc5f5('0x39')];_0x5bb09c[_0xc5f5('0x44')]=qs[_0xc5f5('0x45')](_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x45')]);_0x5bb09c['where']=qs[_0xc5f5('0x3c')](_['pick'](_0x50b7cc[_0xc5f5('0x3a')],_0x492efa[_0xc5f5('0x3c')]));if(_0x50b7cc[_0xc5f5('0x3a')]['filter']){_0x5bb09c['where']=_[_0xc5f5('0x49')](_0x5bb09c[_0xc5f5('0x46')],{'$or':_['map'](_0x5bb09c[_0xc5f5('0x3e')],function(_0xbdc44e){var _0x3fa641={};_0x3fa641[_0xbdc44e]={'$like':'%'+_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x48')]+'%'};return _0x3fa641;})});}_0x5bb09c=_[_0xc5f5('0x49')]({},_0x5bb09c,_0x50b7cc[_0xc5f5('0x4c')]);return _0x68917f[_0xc5f5('0x58')](_0x5bb09c);}})['then'](function(_0x3107df){if(_0x3107df){_0x99d22c=_0x3107df[_0xc5f5('0x40')];if(!_0x50b7cc['query'][_0xc5f5('0x41')](_0xc5f5('0x42'))){_0x5bb09c['limit']=qs[_0xc5f5('0x43')](_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x43')]);_0x5bb09c['offset']=qs[_0xc5f5('0x2c')](_0x50b7cc[_0xc5f5('0x3a')][_0xc5f5('0x2c')]);}return _0x68917f[_0xc5f5('0x58')](_0x5bb09c);}})[_0xc5f5('0x1e')](function(_0x14fd1a){if(_0x14fd1a){return _0x14fd1a?{'count':_0x99d22c,'rows':_0x14fd1a}:null;}})[_0xc5f5('0x1e')](respondWithResult(_0x58859f,null))[_0xc5f5('0x51')](handleError(_0x58859f,null));};exports['addConfiguration']=function(_0x3ea93a,_0x399e6a,_0x2d1503){if(_0x3ea93a[_0xc5f5('0x56')]['id']){delete _0x3ea93a[_0xc5f5('0x56')]['id'];}return db['VtigerAccount'][_0xc5f5('0x59')]({'where':{'id':_0x3ea93a[_0xc5f5('0x53')]['id']}})[_0xc5f5('0x1e')](handleEntityNotFound(_0x399e6a,null))[_0xc5f5('0x1e')](function(_0x26962d){if(_0x26962d){_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x5b')]=_0x26962d['id'];_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x5c')]=integrations['getSubjects'](_0x3ea93a[_0xc5f5('0x56')]['channel'],_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x4a')]);_0x3ea93a['body'][_0xc5f5('0x5d')]=integrations[_0xc5f5('0x5e')](_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x5f')],_0x3ea93a[_0xc5f5('0x56')][_0xc5f5('0x4a')]);return db[_0xc5f5('0x5a')][_0xc5f5('0x55')](_0x3ea93a[_0xc5f5('0x56')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xc5f5('0x60')],'as':_0xc5f5('0x5d')}]});}return null;})['then'](respondWithResult(_0x399e6a,null))['catch'](handleError(_0x399e6a,null));};var md5=require('md5');exports[_0xc5f5('0x61')]=function(_0x10132a,_0x2131b7,_0x482cb5){var _0x12ce49=null;var _0xb3dafb=null;var _0x76d071=null;var _0x12c975=null;var _0xe33284='';return db[_0xc5f5('0x38')][_0xc5f5('0x59')]({'where':{'id':_0x10132a[_0xc5f5('0x53')]['id']},'attributes':['id','name',_0xc5f5('0x62'),_0xc5f5('0x63'),_0xc5f5('0x64'),'remoteUri','serverUrl',_0xc5f5('0x65')]})[_0xc5f5('0x1e')](handleEntityNotFound(_0x2131b7,null))['then'](function(_0x444966){if(_0x444966){_0x12ce49=_0x444966[_0xc5f5('0x62')];_0xb3dafb=_0x444966[_0xc5f5('0x65')];_0x76d071=_0x444966[_0xc5f5('0x64')];_0xe33284=_0x444966[_0xc5f5('0x66')];var _0x31e9fd=_0xe33284[_0xc5f5('0x67')](-0x1);if(_0x31e9fd==='/'){_0xe33284=_0xe33284['substring'](0x0,_0xe33284[_0xc5f5('0x68')](_0x31e9fd));}_0x12c975=util[_0xc5f5('0x69')](_0xc5f5('0x6a'),_0xe33284);var _0x1302c8={'method':'GET','uri':_0x12c975,'qs':{'operation':_0xc5f5('0x6b'),'username':_0x444966[_0xc5f5('0x62')]},'json':!![]};return rp(_0x1302c8);}})[_0xc5f5('0x1e')](function(_0x3de9d0){if(_0x3de9d0[_0xc5f5('0x6c')]){var _0x5b5314={'method':_0xc5f5('0x6d'),'uri':_0x12c975,'form':{'operation':_0xc5f5('0x6e'),'username':_0x12ce49,'accessKey':md5(_0x3de9d0[_0xc5f5('0x26')]['token']+_0xb3dafb)},'json':!![]};return rp(_0x5b5314);}})[_0xc5f5('0x1e')](function(_0x274af8){if(_0x274af8[_0xc5f5('0x6c')]){var _0x42f1fc={'method':'GET','uri':_0x12c975,'qs':{'operation':_0xc5f5('0x6f'),'username':_0x12ce49,'sessionName':_0x274af8[_0xc5f5('0x26')][_0xc5f5('0x70')],'elementType':_0x76d071},'json':!![]};return rp(_0x42f1fc);}})[_0xc5f5('0x1e')](function(_0x551295){if(_0x551295[_0xc5f5('0x6c')]){var _0x2d5605=[_0xc5f5('0x71'),_0xc5f5('0x72'),_0xc5f5('0x73')];_[_0xc5f5('0x74')](_0x551295['result'][_0xc5f5('0x3f')],function(_0x2cb9ac){return _0x2d5605[_0xc5f5('0x75')](_0x2cb9ac[_0xc5f5('0x4a')]['name']);});_[_0xc5f5('0x74')](_0x551295[_0xc5f5('0x26')][_0xc5f5('0x3f')],function(_0x3bb96f){return _0x3bb96f[_0xc5f5('0x76')]==='false';});return{'count':_0x551295['result'][_0xc5f5('0x3f')][_0xc5f5('0x40')],'rows':_[_0xc5f5('0x37')](_0x551295['result'][_0xc5f5('0x3f')],function(_0x4a3353){return{'id':_0x4a3353[_0xc5f5('0x34')],'name':_0x4a3353[_0xc5f5('0x77')],'custom':_[_0xc5f5('0x78')](_0x4a3353['name'],'cf_')?!![]:![],'options':_0x4a3353['type'][_0xc5f5('0x34')]===_0xc5f5('0x79')&&_0x4a3353['type'][_0xc5f5('0x7a')][_0xc5f5('0x40')]>0x0?_[_0xc5f5('0x37')](_0x4a3353['type'][_0xc5f5('0x7a')],function(_0x17440b){return{'name':_0x17440b[_0xc5f5('0x77')],'value':_0x17440b[_0xc5f5('0x7b')]};}):[]};})};}})[_0xc5f5('0x1e')](respondWithResult(_0x2131b7,null))[_0xc5f5('0x51')](function(_0x46c8c4){console[_0xc5f5('0x7c')](_0xc5f5('0x7d')+_0x46c8c4);var _0x39a147=_0x10132a[_0xc5f5('0x3a')][_0xc5f5('0x19')]?0x1f4:_0x46c8c4[_0xc5f5('0x7e')]||0x1f4;logger[_0xc5f5('0x24')](_0xc5f5('0x7f'),_0xc5f5('0x61'),_0x39a147,JSON['stringify'](_0x46c8c4));delete _0x46c8c4[_0xc5f5('0x34')];if(_0x39a147===0x191){_0x39a147=0x190;}_0x2131b7['status'](_0x39a147)[_0xc5f5('0x35')](_0x10132a['query']['test']?{'message':_0xc5f5('0x80'),'statusCode':_0x46c8c4[_0xc5f5('0x7e')]}:_0x46c8c4);});}; \ No newline at end of file +var _0xf3ca=['owner','remove','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','index','map','rawAttributes','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','VtigerAccount','includeAll','findAll','rows','params','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','filters','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','sessionName','autogenerated','reference'];(function(_0x367725,_0x1888d4){var _0x2526f6=function(_0x18725e){while(--_0x18725e){_0x367725['push'](_0x367725['shift']());}};_0x2526f6(++_0x1888d4);}(_0xf3ca,0x97));var _0xaf3c=function(_0x3bcf38,_0x290cc0){_0x3bcf38=_0x3bcf38-0x0;var _0x49d42e=_0xf3ca[_0x3bcf38];return _0x49d42e;};'use strict';var pdf=require(_0xaf3c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaf3c('0x1'));var zipdir=require(_0xaf3c('0x2'));var jsonpatch=require(_0xaf3c('0x3'));var rp=require(_0xaf3c('0x4'));var moment=require(_0xaf3c('0x5'));var BPromise=require(_0xaf3c('0x6'));var Mustache=require(_0xaf3c('0x7'));var util=require('util');var path=require(_0xaf3c('0x8'));var sox=require(_0xaf3c('0x9'));var csv=require('to-csv');var ejs=require(_0xaf3c('0xa'));var fs=require('fs');var _=require(_0xaf3c('0xb'));var squel=require(_0xaf3c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf3c('0xd'));var toCsv=require(_0xaf3c('0xe'));var querystring=require('querystring');var Papa=require(_0xaf3c('0xf'));var Redis=require(_0xaf3c('0x10'));var authService=require(_0xaf3c('0x11'));var qs=require(_0xaf3c('0x12'));var as=require(_0xaf3c('0x13'));var hardwareService=require(_0xaf3c('0x14'));var logger=require(_0xaf3c('0x15'))(_0xaf3c('0x16'));var utils=require(_0xaf3c('0x17'));var config=require(_0xaf3c('0x18'));var db=require(_0xaf3c('0x19'))['db'];var integrations=require(_0xaf3c('0x1a'));var jayson=require(_0xaf3c('0x1b'));var client=jayson[_0xaf3c('0x1c')][_0xaf3c('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x563571,_0x3c66ac,_0x890fdc){if(_0x890fdc){var _0x180331=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x180331[_0xaf3c('0x1e')](_0x3c66ac)){return _0x563571;}else{throw new db['Sequelize'][(_0xaf3c('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 _0x563571;}}function respondWithRpcPromise(_0x194ff5,_0x962b9,_0x238c01,_0x197193){return new BPromise(function(_0x2d1f96,_0xb3b0c8){var _0x33cd12=_0x197193||client;return _0x33cd12[_0xaf3c('0x20')](_0x194ff5,_0x238c01)['then'](function(_0x5e23e5){logger[_0xaf3c('0x21')](_0xaf3c('0x22'),_0x962b9,_0xaf3c('0x23'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x962b9,_0xaf3c('0x23'),JSON[_0xaf3c('0x24')](_0x5e23e5));if(_0x5e23e5[_0xaf3c('0x25')]){if(_0x5e23e5['error'][_0xaf3c('0x26')]===0x1f4){logger[_0xaf3c('0x25')](_0xaf3c('0x22'),_0x962b9,_0x5e23e5[_0xaf3c('0x25')]['message']);return _0xb3b0c8(_0x5e23e5[_0xaf3c('0x25')][_0xaf3c('0x27')]);}logger[_0xaf3c('0x25')](_0xaf3c('0x22'),_0x962b9,_0x5e23e5[_0xaf3c('0x25')][_0xaf3c('0x27')]);return _0x2d1f96(_0x5e23e5[_0xaf3c('0x25')][_0xaf3c('0x27')]);}else{logger[_0xaf3c('0x21')](_0xaf3c('0x22'),_0x962b9,'request\x20sent');_0x2d1f96(_0x5e23e5[_0xaf3c('0x28')][_0xaf3c('0x27')]);}})[_0xaf3c('0x29')](function(_0x2d7c49){logger['error'](_0xaf3c('0x22'),_0x962b9,_0x2d7c49);_0xb3b0c8(_0x2d7c49);});});}function respondWithStatusCode(_0x32405d,_0x20ab0c){_0x20ab0c=_0x20ab0c||0xcc;return function(_0x4a9716){if(_0x4a9716){return _0x32405d[_0xaf3c('0x2a')](_0x20ab0c);}return _0x32405d[_0xaf3c('0x2b')](_0x20ab0c)[_0xaf3c('0x2c')]();};}function respondWithResult(_0x4cee46,_0x311a7f){_0x311a7f=_0x311a7f||0xc8;return function(_0x261db5){if(_0x261db5){return _0x4cee46[_0xaf3c('0x2b')](_0x311a7f)[_0xaf3c('0x2d')](_0x261db5);}};}function respondWithFilteredResult(_0x293c8f,_0x335ebf){return function(_0x31748d){if(_0x31748d){var _0x3ad0ba=_0x31748d[_0xaf3c('0x2e')],_0x1adcff=_0x335ebf[_0xaf3c('0x2f')],_0x5a502a=_0x335ebf[_0xaf3c('0x2f')]+_0x335ebf[_0xaf3c('0x30')],_0x5a4d7b;if(_0x5a502a>=_0x3ad0ba){_0x5a502a=_0x3ad0ba;_0x5a4d7b=0xc8;}else{_0x5a4d7b=0xce;}_0x293c8f[_0xaf3c('0x2b')](_0x5a4d7b);return _0x293c8f[_0xaf3c('0x31')](_0xaf3c('0x32'),_0x1adcff+'-'+_0x5a502a+'/'+_0x3ad0ba)['json'](_0x31748d);}return null;};}function patchUpdates(_0xe5adc){return function(_0x118536){try{jsonpatch[_0xaf3c('0x33')](_0x118536,_0xe5adc,!![]);}catch(_0x571787){return BPromise[_0xaf3c('0x34')](_0x571787);}return _0x118536[_0xaf3c('0x35')]();};}function saveUpdates(_0x3712cc,_0x34dd49){return function(_0x264f25){if(_0x264f25){return _0x264f25['update'](_0x3712cc)[_0xaf3c('0x36')](function(_0x318b9d){return _0x318b9d;});}return null;};}function removeEntity(_0x478f8c,_0x2f5069){return function(_0x1e4519){if(_0x1e4519){return _0x1e4519[_0xaf3c('0x37')]()['then'](function(){_0x478f8c[_0xaf3c('0x2b')](0xcc)[_0xaf3c('0x2c')]();});}};}function handleEntityNotFound(_0xb2a65e,_0x1d7f8d){return function(_0x537c34){if(!_0x537c34){_0xb2a65e[_0xaf3c('0x2a')](0x194);}return _0x537c34;};}function handleError(_0x2970af,_0x19cc6d){_0x19cc6d=_0x19cc6d||0x1f4;return function(_0x353076){logger['error'](_0x353076['stack']);if(_0x353076['name']){delete _0x353076['name'];}_0x2970af['status'](_0x19cc6d)['send'](_0x353076);};}exports[_0xaf3c('0x38')]=function(_0x1d9287,_0x1be0a6){var _0x52e041={},_0x20644e={},_0x4bf674={'count':0x0,'rows':[]};var _0x45b661=_[_0xaf3c('0x39')](db['VtigerAccount'][_0xaf3c('0x3a')],function(_0x239a62){return{'name':_0x239a62[_0xaf3c('0x3b')],'type':_0x239a62['type'][_0xaf3c('0x3c')]};});_0x20644e[_0xaf3c('0x3d')]=_[_0xaf3c('0x39')](_0x45b661,_0xaf3c('0x3e'));_0x20644e[_0xaf3c('0x3f')]=_[_0xaf3c('0x40')](_0x1d9287[_0xaf3c('0x3f')]);_0x20644e['filters']=_[_0xaf3c('0x41')](_0x20644e['model'],_0x20644e['query']);_0x52e041[_0xaf3c('0x42')]=_['intersection'](_0x20644e[_0xaf3c('0x3d')],qs[_0xaf3c('0x43')](_0x1d9287[_0xaf3c('0x3f')][_0xaf3c('0x43')]));_0x52e041[_0xaf3c('0x42')]=_0x52e041[_0xaf3c('0x42')][_0xaf3c('0x44')]?_0x52e041[_0xaf3c('0x42')]:_0x20644e['model'];if(!_0x1d9287['query'][_0xaf3c('0x45')](_0xaf3c('0x46'))){_0x52e041[_0xaf3c('0x30')]=qs[_0xaf3c('0x30')](_0x1d9287[_0xaf3c('0x3f')][_0xaf3c('0x30')]);_0x52e041[_0xaf3c('0x2f')]=qs[_0xaf3c('0x2f')](_0x1d9287[_0xaf3c('0x3f')][_0xaf3c('0x2f')]);}_0x52e041[_0xaf3c('0x47')]=qs[_0xaf3c('0x48')](_0x1d9287[_0xaf3c('0x3f')][_0xaf3c('0x48')]);_0x52e041[_0xaf3c('0x49')]=qs['filters'](_[_0xaf3c('0x4a')](_0x1d9287[_0xaf3c('0x3f')],_0x20644e['filters']),_0x45b661);if(_0x1d9287['query'][_0xaf3c('0x4b')]){_0x52e041[_0xaf3c('0x49')]=_[_0xaf3c('0x4c')](_0x52e041['where'],{'$or':_[_0xaf3c('0x39')](_0x45b661,function(_0x386f16){if(_0x386f16[_0xaf3c('0x4d')]!=='VIRTUAL'){var _0x3ab598={};_0x3ab598[_0x386f16[_0xaf3c('0x3e')]]={'$like':'%'+_0x1d9287[_0xaf3c('0x3f')][_0xaf3c('0x4b')]+'%'};return _0x3ab598;}})});}_0x52e041=_['merge']({},_0x52e041,_0x1d9287[_0xaf3c('0x4e')]);var _0x4c3cd8={'where':_0x52e041[_0xaf3c('0x49')]};return db[_0xaf3c('0x4f')][_0xaf3c('0x2e')](_0x4c3cd8)[_0xaf3c('0x36')](function(_0x38cec){_0x4bf674[_0xaf3c('0x2e')]=_0x38cec;if(_0x1d9287[_0xaf3c('0x3f')][_0xaf3c('0x50')]){_0x52e041['include']=[{'all':!![]}];}return db[_0xaf3c('0x4f')][_0xaf3c('0x51')](_0x52e041);})['then'](function(_0x93ff81){_0x4bf674[_0xaf3c('0x52')]=_0x93ff81;return _0x4bf674;})[_0xaf3c('0x36')](respondWithFilteredResult(_0x1be0a6,_0x52e041))[_0xaf3c('0x29')](handleError(_0x1be0a6,null));};exports['show']=function(_0x26d71a,_0x478bbf){var _0x55ec22={'raw':![],'where':{'id':_0x26d71a[_0xaf3c('0x53')]['id']}},_0x529d29={};_0x529d29['model']=_[_0xaf3c('0x40')](db[_0xaf3c('0x4f')][_0xaf3c('0x3a')]);_0x529d29[_0xaf3c('0x3f')]=_[_0xaf3c('0x40')](_0x26d71a['query']);_0x529d29['filters']=_[_0xaf3c('0x41')](_0x529d29['model'],_0x529d29[_0xaf3c('0x3f')]);_0x55ec22[_0xaf3c('0x42')]=_[_0xaf3c('0x41')](_0x529d29[_0xaf3c('0x3d')],qs[_0xaf3c('0x43')](_0x26d71a[_0xaf3c('0x3f')][_0xaf3c('0x43')]));_0x55ec22[_0xaf3c('0x42')]=_0x55ec22[_0xaf3c('0x42')][_0xaf3c('0x44')]?_0x55ec22[_0xaf3c('0x42')]:_0x529d29[_0xaf3c('0x3d')];if(_0x26d71a[_0xaf3c('0x3f')][_0xaf3c('0x50')]){_0x55ec22['include']=[{'all':!![]}];}_0x55ec22=_['merge']({},_0x55ec22,_0x26d71a[_0xaf3c('0x4e')]);return db['VtigerAccount'][_0xaf3c('0x54')](_0x55ec22)[_0xaf3c('0x36')](handleEntityNotFound(_0x478bbf,null))[_0xaf3c('0x36')](respondWithResult(_0x478bbf,null))['catch'](handleError(_0x478bbf,null));};exports[_0xaf3c('0x55')]=function(_0xc3a16e,_0x3576ea){return db[_0xaf3c('0x4f')][_0xaf3c('0x55')](_0xc3a16e[_0xaf3c('0x56')],{})['then'](respondWithResult(_0x3576ea,0xc9))[_0xaf3c('0x29')](handleError(_0x3576ea,null));};exports[_0xaf3c('0x57')]=function(_0x5821ed,_0x29dd46){if(_0x5821ed[_0xaf3c('0x56')]['id']){delete _0x5821ed[_0xaf3c('0x56')]['id'];}return db[_0xaf3c('0x4f')]['find']({'where':{'id':_0x5821ed[_0xaf3c('0x53')]['id']}})['then'](handleEntityNotFound(_0x29dd46,null))[_0xaf3c('0x36')](saveUpdates(_0x5821ed[_0xaf3c('0x56')],null))['then'](respondWithResult(_0x29dd46,null))[_0xaf3c('0x29')](handleError(_0x29dd46,null));};exports[_0xaf3c('0x37')]=function(_0x30f9df,_0x528db9){return db['VtigerAccount'][_0xaf3c('0x54')]({'where':{'id':_0x30f9df['params']['id']}})[_0xaf3c('0x36')](handleEntityNotFound(_0x528db9,null))[_0xaf3c('0x36')](removeEntity(_0x528db9,null))[_0xaf3c('0x29')](handleError(_0x528db9,null));};exports[_0xaf3c('0x58')]=function(_0xfbe8cc,_0x26f93e,_0x46cf4f){var _0x44fa0a={};var _0x1a926f={};var _0x50e361;var _0x5927ab;return db[_0xaf3c('0x4f')][_0xaf3c('0x59')]({'where':{'id':_0xfbe8cc[_0xaf3c('0x53')]['id']}})[_0xaf3c('0x36')](handleEntityNotFound(_0x26f93e,null))[_0xaf3c('0x36')](function(_0x235a30){if(_0x235a30){_0x50e361=_0x235a30;_0x1a926f[_0xaf3c('0x3d')]=_[_0xaf3c('0x40')](db[_0xaf3c('0x5a')]['rawAttributes']);_0x1a926f[_0xaf3c('0x3f')]=_[_0xaf3c('0x40')](_0xfbe8cc[_0xaf3c('0x3f')]);_0x1a926f[_0xaf3c('0x5b')]=_['intersection'](_0x1a926f[_0xaf3c('0x3d')],_0x1a926f['query']);_0x44fa0a[_0xaf3c('0x42')]=_[_0xaf3c('0x41')](_0x1a926f[_0xaf3c('0x3d')],qs[_0xaf3c('0x43')](_0xfbe8cc[_0xaf3c('0x3f')]['fields']));_0x44fa0a[_0xaf3c('0x42')]=_0x44fa0a[_0xaf3c('0x42')][_0xaf3c('0x44')]?_0x44fa0a[_0xaf3c('0x42')]:_0x1a926f['model'];_0x44fa0a[_0xaf3c('0x47')]=qs['sort'](_0xfbe8cc[_0xaf3c('0x3f')][_0xaf3c('0x48')]);_0x44fa0a[_0xaf3c('0x49')]=qs[_0xaf3c('0x5b')](_[_0xaf3c('0x4a')](_0xfbe8cc[_0xaf3c('0x3f')],_0x1a926f['filters']));if(_0xfbe8cc[_0xaf3c('0x3f')][_0xaf3c('0x4b')]){_0x44fa0a[_0xaf3c('0x49')]=_[_0xaf3c('0x4c')](_0x44fa0a[_0xaf3c('0x49')],{'$or':_[_0xaf3c('0x39')](_0x44fa0a[_0xaf3c('0x42')],function(_0x51677b){var _0x20b77a={};_0x20b77a[_0x51677b]={'$like':'%'+_0xfbe8cc['query'][_0xaf3c('0x4b')]+'%'};return _0x20b77a;})});}_0x44fa0a=_['merge']({},_0x44fa0a,_0xfbe8cc[_0xaf3c('0x4e')]);return _0x50e361['getConfigurations'](_0x44fa0a);}})[_0xaf3c('0x36')](function(_0x496464){if(_0x496464){_0x5927ab=_0x496464['length'];if(!_0xfbe8cc[_0xaf3c('0x3f')][_0xaf3c('0x45')](_0xaf3c('0x46'))){_0x44fa0a[_0xaf3c('0x30')]=qs[_0xaf3c('0x30')](_0xfbe8cc[_0xaf3c('0x3f')]['limit']);_0x44fa0a[_0xaf3c('0x2f')]=qs[_0xaf3c('0x2f')](_0xfbe8cc[_0xaf3c('0x3f')]['offset']);}return _0x50e361['getConfigurations'](_0x44fa0a);}})[_0xaf3c('0x36')](function(_0x2cd55c){if(_0x2cd55c){return _0x2cd55c?{'count':_0x5927ab,'rows':_0x2cd55c}:null;}})[_0xaf3c('0x36')](respondWithResult(_0x26f93e,null))[_0xaf3c('0x29')](handleError(_0x26f93e,null));};exports[_0xaf3c('0x5c')]=function(_0x37dce5,_0x4142a4,_0x209baa){if(_0x37dce5['body']['id']){delete _0x37dce5[_0xaf3c('0x56')]['id'];}return db[_0xaf3c('0x4f')][_0xaf3c('0x59')]({'where':{'id':_0x37dce5[_0xaf3c('0x53')]['id']}})[_0xaf3c('0x36')](handleEntityNotFound(_0x4142a4,null))['then'](function(_0xaf2e1){if(_0xaf2e1){_0x37dce5[_0xaf3c('0x56')][_0xaf3c('0x5d')]=_0xaf2e1['id'];_0x37dce5['body'][_0xaf3c('0x5e')]=integrations[_0xaf3c('0x5f')](_0x37dce5[_0xaf3c('0x56')][_0xaf3c('0x60')],_0x37dce5[_0xaf3c('0x56')][_0xaf3c('0x4d')]);_0x37dce5[_0xaf3c('0x56')]['Descriptions']=integrations[_0xaf3c('0x61')](_0x37dce5['body']['channel'],_0x37dce5[_0xaf3c('0x56')][_0xaf3c('0x4d')]);return db['VtigerConfiguration'][_0xaf3c('0x55')](_0x37dce5[_0xaf3c('0x56')],{'include':[{'model':db[_0xaf3c('0x62')],'as':_0xaf3c('0x5e')},{'model':db[_0xaf3c('0x62')],'as':_0xaf3c('0x63')}]});}return null;})['then'](respondWithResult(_0x4142a4,null))['catch'](handleError(_0x4142a4,null));};var md5=require(_0xaf3c('0x64'));exports[_0xaf3c('0x65')]=function(_0x339f3b,_0x27c43e,_0x396458){var _0x1f8f0b=null;var _0x1640f2=null;var _0x909c05=null;var _0x327aa5=null;var _0x1ab0ac='';return db[_0xaf3c('0x4f')]['findOne']({'where':{'id':_0x339f3b[_0xaf3c('0x53')]['id']},'attributes':['id',_0xaf3c('0x3e'),_0xaf3c('0x66'),_0xaf3c('0x67'),_0xaf3c('0x68'),'remoteUri',_0xaf3c('0x69'),'accessKey']})[_0xaf3c('0x36')](handleEntityNotFound(_0x27c43e,null))[_0xaf3c('0x36')](function(_0x122d5b){if(_0x122d5b){_0x1f8f0b=_0x122d5b[_0xaf3c('0x66')];_0x1640f2=_0x122d5b[_0xaf3c('0x6a')];_0x909c05=_0x122d5b[_0xaf3c('0x68')];_0x1ab0ac=_0x122d5b[_0xaf3c('0x6b')];var _0x154bec=_0x1ab0ac[_0xaf3c('0x6c')](-0x1);if(_0x154bec==='/'){_0x1ab0ac=_0x1ab0ac['substring'](0x0,_0x1ab0ac[_0xaf3c('0x6d')](_0x154bec));}_0x327aa5=util[_0xaf3c('0x6e')](_0xaf3c('0x6f'),_0x1ab0ac);var _0x399faa={'method':_0xaf3c('0x70'),'uri':_0x327aa5,'qs':{'operation':_0xaf3c('0x71'),'username':_0x122d5b[_0xaf3c('0x66')]},'json':!![]};return rp(_0x399faa);}})[_0xaf3c('0x36')](function(_0x1fcc92){if(_0x1fcc92['success']){var _0xcfe242={'method':_0xaf3c('0x72'),'uri':_0x327aa5,'form':{'operation':_0xaf3c('0x73'),'username':_0x1f8f0b,'accessKey':md5(_0x1fcc92['result'][_0xaf3c('0x74')]+_0x1640f2)},'json':!![]};return rp(_0xcfe242);}})[_0xaf3c('0x36')](function(_0x3192ce){if(_0x3192ce[_0xaf3c('0x75')]){var _0x5dee64={'method':'GET','uri':_0x327aa5,'qs':{'operation':'describe','username':_0x1f8f0b,'sessionName':_0x3192ce[_0xaf3c('0x28')][_0xaf3c('0x76')],'elementType':_0x909c05},'json':!![]};return rp(_0x5dee64);}})[_0xaf3c('0x36')](function(_0x507473){if(_0x507473[_0xaf3c('0x75')]){var _0x356243=[_0xaf3c('0x77'),_0xaf3c('0x78'),_0xaf3c('0x79')];_['remove'](_0x507473['result'][_0xaf3c('0x43')],function(_0x339a4c){return _0x356243['includes'](_0x339a4c[_0xaf3c('0x4d')][_0xaf3c('0x3e')]);});_[_0xaf3c('0x7a')](_0x507473[_0xaf3c('0x28')][_0xaf3c('0x43')],function(_0x1afae2){return _0x1afae2[_0xaf3c('0x7b')]===_0xaf3c('0x7c');});return{'count':_0x507473['result'][_0xaf3c('0x43')]['length'],'rows':_[_0xaf3c('0x39')](_0x507473[_0xaf3c('0x28')]['fields'],function(_0x1947fd){return{'id':_0x1947fd[_0xaf3c('0x3e')],'name':_0x1947fd[_0xaf3c('0x7d')],'custom':_['startsWith'](_0x1947fd[_0xaf3c('0x3e')],_0xaf3c('0x7e'))?!![]:![],'options':_0x1947fd[_0xaf3c('0x4d')]['name']===_0xaf3c('0x7f')&&_0x1947fd[_0xaf3c('0x4d')][_0xaf3c('0x80')][_0xaf3c('0x44')]>0x0?_[_0xaf3c('0x39')](_0x1947fd[_0xaf3c('0x4d')][_0xaf3c('0x80')],function(_0x3c7965){return{'name':_0x3c7965[_0xaf3c('0x7d')],'value':_0x3c7965[_0xaf3c('0x81')]};}):[]};})};}})['then'](respondWithResult(_0x27c43e,null))[_0xaf3c('0x29')](function(_0x108533){console[_0xaf3c('0x82')](_0xaf3c('0x83')+_0x108533);var _0x24037a=_0x339f3b['query'][_0xaf3c('0x1e')]?0x1f4:_0x108533[_0xaf3c('0x84')]||0x1f4;logger[_0xaf3c('0x25')](_0xaf3c('0x85'),_0xaf3c('0x65'),_0x24037a,JSON['stringify'](_0x108533));delete _0x108533[_0xaf3c('0x3e')];if(_0x24037a===0x191){_0x24037a=0x190;}_0x27c43e[_0xaf3c('0x2b')](_0x24037a)[_0xaf3c('0x86')](_0x339f3b[_0xaf3c('0x3f')][_0xaf3c('0x1e')]?{'message':_0xaf3c('0x87'),'statusCode':_0x108533[_0xaf3c('0x84')]}:_0x108533);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f94ef67..47d8e53 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 _0x55ec=['define','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x1f191b,_0x3ed8a3){var _0x4000f3=function(_0x318141){while(--_0x318141){_0x1f191b['push'](_0x1f191b['shift']());}};_0x4000f3(++_0x3ed8a3);}(_0x55ec,0x1c9));var _0xc55e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x55ec[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xc55e('0x0'));var util=require(_0xc55e('0x1'));var logger=require(_0xc55e('0x2'))(_0xc55e('0x3'));var moment=require(_0xc55e('0x4'));var BPromise=require(_0xc55e('0x5'));var rp=require(_0xc55e('0x6'));var fs=require('fs');var path=require(_0xc55e('0x7'));var rimraf=require(_0xc55e('0x8'));var config=require(_0xc55e('0x9'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xc55e('0xa'));module['exports']=function(_0x42a51b,_0x56f796){return _0x42a51b[_0xc55e('0xb')]('VtigerAccount',attributes,{'tableName':_0xc55e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb508=['rimraf','../../config/environment','./intVtigerAccount.attributes','VtigerAccount','lodash','util','../../config/logger','api','request-promise'];(function(_0x543ed1,_0x4bf288){var _0x4fb489=function(_0x455ccc){while(--_0x455ccc){_0x543ed1['push'](_0x543ed1['shift']());}};_0x4fb489(++_0x4bf288);}(_0xb508,0xaf));var _0x8b50=function(_0x4b30d2,_0x3815d0){_0x4b30d2=_0x4b30d2-0x0;var _0x1a27dc=_0xb508[_0x4b30d2];return _0x1a27dc;};'use strict';var _=require(_0x8b50('0x0'));var util=require(_0x8b50('0x1'));var logger=require(_0x8b50('0x2'))(_0x8b50('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8b50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b50('0x5'));var config=require(_0x8b50('0x6'));var attributes=require(_0x8b50('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56387e,_0x485dae){return _0x56387e['define'](_0x8b50('0x8'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 2eab4d0..f6efe61 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 _0x0e53=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','attributes','limit','include','model','map','then','debug','raw','where','ShowVtigerAccount','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf9ede0,_0x4b6018){var _0x5c0553=function(_0x46439f){while(--_0x46439f){_0xf9ede0['push'](_0xf9ede0['shift']());}};_0x5c0553(++_0x4b6018);}(_0x0e53,0xc7));var _0x30e5=function(_0x30d012,_0x1493e8){_0x30d012=_0x30d012-0x0;var _0x1943ef=_0x0e53[_0x30d012];return _0x1943ef;};'use strict';var _=require('lodash');var util=require(_0x30e5('0x0'));var moment=require('moment');var BPromise=require(_0x30e5('0x1'));var rs=require(_0x30e5('0x2'));var fs=require('fs');var Redis=require(_0x30e5('0x3'));var db=require(_0x30e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30e5('0x5'))(_0x30e5('0x6'));var config=require(_0x30e5('0x7'));var jayson=require(_0x30e5('0x8'));var client=jayson['client'][_0x30e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x224e81,_0x2b849a,_0x56f6d0){return new BPromise(function(_0x281899,_0x12403f){return client[_0x30e5('0xa')](_0x224e81,_0x56f6d0)['then'](function(_0x4986d6){logger[_0x30e5('0xb')](_0x30e5('0xc'),_0x2b849a,_0x30e5('0xd'));logger['debug'](_0x30e5('0xe'),_0x2b849a,_0x30e5('0xd'),JSON[_0x30e5('0xf')](_0x4986d6));if(_0x4986d6[_0x30e5('0x10')]){if(_0x4986d6[_0x30e5('0x10')][_0x30e5('0x11')]===0x1f4){logger[_0x30e5('0x10')](_0x30e5('0xc'),_0x2b849a,_0x4986d6[_0x30e5('0x10')][_0x30e5('0x12')]);return _0x12403f(_0x4986d6[_0x30e5('0x10')][_0x30e5('0x12')]);}logger[_0x30e5('0x10')](_0x30e5('0xc'),_0x2b849a,_0x4986d6['error']['message']);return _0x281899(_0x4986d6['error']['message']);}else{logger[_0x30e5('0xb')](_0x30e5('0xc'),_0x2b849a,_0x30e5('0xd'));_0x281899(_0x4986d6[_0x30e5('0x13')][_0x30e5('0x12')]);}})[_0x30e5('0x14')](function(_0x55d83b){logger[_0x30e5('0x10')](_0x30e5('0xc'),_0x2b849a,_0x55d83b);_0x12403f(_0x55d83b);});});}exports[_0x30e5('0x15')]=function(_0x27002e){var _0x3d9e9b=this;return new Promise(function(_0x5d5b27,_0x4aac21){return db[_0x30e5('0x16')]['findAll']({'raw':_0x27002e['options']?_0x27002e[_0x30e5('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x27002e[_0x30e5('0x17')]?_0x27002e[_0x30e5('0x17')]['where']||null:null,'attributes':_0x27002e[_0x30e5('0x17')]?_0x27002e['options'][_0x30e5('0x18')]||null:null,'limit':_0x27002e[_0x30e5('0x17')]?_0x27002e[_0x30e5('0x17')][_0x30e5('0x19')]||null:null,'include':_0x27002e[_0x30e5('0x17')]?_0x27002e[_0x30e5('0x17')][_0x30e5('0x1a')]?_['map'](_0x27002e[_0x30e5('0x17')]['include'],function(_0x5a5ec6){return{'model':db[_0x5a5ec6[_0x30e5('0x1b')]],'as':_0x5a5ec6['as'],'attributes':_0x5a5ec6[_0x30e5('0x18')],'include':_0x5a5ec6[_0x30e5('0x1a')]?_[_0x30e5('0x1c')](_0x5a5ec6[_0x30e5('0x1a')],function(_0x2139c3){return{'model':db[_0x2139c3['model']],'as':_0x2139c3['as'],'attributes':_0x2139c3['attributes'],'include':_0x2139c3['include']?_[_0x30e5('0x1c')](_0x2139c3[_0x30e5('0x1a')],function(_0x12e7a4){return{'model':db[_0x12e7a4[_0x30e5('0x1b')]],'as':_0x12e7a4['as'],'attributes':_0x12e7a4[_0x30e5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x30e5('0x1d')](function(_0x2b0a70){logger[_0x30e5('0xb')](_0x30e5('0x15'),_0x27002e);logger[_0x30e5('0x1e')]('GetVtigerAccount',_0x27002e,JSON[_0x30e5('0xf')](_0x2b0a70));_0x5d5b27(_0x2b0a70);})[_0x30e5('0x14')](function(_0x5affb6){logger[_0x30e5('0x10')](_0x30e5('0x15'),_0x5affb6[_0x30e5('0x12')],_0x27002e);_0x4aac21(_0x3d9e9b[_0x30e5('0x10')](0x1f4,_0x5affb6[_0x30e5('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x5f3977){var _0x3ff6ad=this;return new Promise(function(_0x333495,_0x3d465b){return db['VtigerAccount']['find']({'raw':_0x5f3977['options']?_0x5f3977['options'][_0x30e5('0x1f')]===undefined?!![]:![]:!![],'where':_0x5f3977[_0x30e5('0x17')]?_0x5f3977['options'][_0x30e5('0x20')]||null:null,'attributes':_0x5f3977[_0x30e5('0x17')]?_0x5f3977['options'][_0x30e5('0x18')]||null:null,'include':_0x5f3977[_0x30e5('0x17')]?_0x5f3977['options'][_0x30e5('0x1a')]?_['map'](_0x5f3977['options'][_0x30e5('0x1a')],function(_0x4691c1){return{'model':db[_0x4691c1[_0x30e5('0x1b')]],'as':_0x4691c1['as'],'attributes':_0x4691c1[_0x30e5('0x18')],'include':_0x4691c1[_0x30e5('0x1a')]?_[_0x30e5('0x1c')](_0x4691c1[_0x30e5('0x1a')],function(_0x20e7d1){return{'model':db[_0x20e7d1[_0x30e5('0x1b')]],'as':_0x20e7d1['as'],'attributes':_0x20e7d1[_0x30e5('0x18')],'include':_0x20e7d1['include']?_[_0x30e5('0x1c')](_0x20e7d1[_0x30e5('0x1a')],function(_0x26a058){return{'model':db[_0x26a058['model']],'as':_0x26a058['as'],'attributes':_0x26a058[_0x30e5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x30e5('0x1d')](function(_0x5a4c9c){logger['info'](_0x30e5('0x21'),_0x5f3977);logger['debug'](_0x30e5('0x21'),_0x5f3977,JSON[_0x30e5('0xf')](_0x5a4c9c));_0x333495(_0x5a4c9c);})[_0x30e5('0x14')](function(_0x219e25){logger[_0x30e5('0x10')](_0x30e5('0x21'),_0x219e25[_0x30e5('0x12')],_0x5f3977);_0x3d465b(_0x3ff6ad[_0x30e5('0x10')](0x1f4,_0x219e25['message']));});});}; \ No newline at end of file +var _0x74a1=['options','raw','attributes','limit','map','model','include','stringify','ShowVtigerAccount','VtigerAccount','find','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetVtigerAccount','findAll'];(function(_0xc96929,_0x6b9a4c){var _0x305d00=function(_0x38c36b){while(--_0x38c36b){_0xc96929['push'](_0xc96929['shift']());}};_0x305d00(++_0x6b9a4c);}(_0x74a1,0x17e));var _0x174a=function(_0x1f1283,_0x1bea3b){_0x1f1283=_0x1f1283-0x0;var _0x205041=_0x74a1[_0x1f1283];return _0x205041;};'use strict';var _=require(_0x174a('0x0'));var util=require(_0x174a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x174a('0x2'));var fs=require('fs');var Redis=require(_0x174a('0x3'));var db=require(_0x174a('0x4'))['db'];var utils=require(_0x174a('0x5'));var logger=require(_0x174a('0x6'))(_0x174a('0x7'));var config=require(_0x174a('0x8'));var jayson=require(_0x174a('0x9'));var client=jayson['client'][_0x174a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x438c0f,_0x434906,_0x7f55c2){return new BPromise(function(_0x35b62d,_0x205399){return client[_0x174a('0xb')](_0x438c0f,_0x7f55c2)[_0x174a('0xc')](function(_0x9e5008){logger['info'](_0x174a('0xd'),_0x434906,'request\x20sent');logger[_0x174a('0xe')](_0x174a('0xf'),_0x434906,_0x174a('0x10'),JSON['stringify'](_0x9e5008));if(_0x9e5008['error']){if(_0x9e5008[_0x174a('0x11')][_0x174a('0x12')]===0x1f4){logger[_0x174a('0x11')](_0x174a('0xd'),_0x434906,_0x9e5008['error'][_0x174a('0x13')]);return _0x205399(_0x9e5008[_0x174a('0x11')][_0x174a('0x13')]);}logger['error'](_0x174a('0xd'),_0x434906,_0x9e5008['error'][_0x174a('0x13')]);return _0x35b62d(_0x9e5008[_0x174a('0x11')]['message']);}else{logger[_0x174a('0x14')](_0x174a('0xd'),_0x434906,'request\x20sent');_0x35b62d(_0x9e5008[_0x174a('0x15')][_0x174a('0x13')]);}})[_0x174a('0x16')](function(_0x1e54a4){logger[_0x174a('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x434906,_0x1e54a4);_0x205399(_0x1e54a4);});});}exports[_0x174a('0x17')]=function(_0x587a1c){var _0x26a8df=this;return new Promise(function(_0x6581b4,_0x46fcdc){return db['VtigerAccount'][_0x174a('0x18')]({'raw':_0x587a1c[_0x174a('0x19')]?_0x587a1c[_0x174a('0x19')][_0x174a('0x1a')]===undefined?!![]:![]:!![],'where':_0x587a1c[_0x174a('0x19')]?_0x587a1c[_0x174a('0x19')]['where']||null:null,'attributes':_0x587a1c[_0x174a('0x19')]?_0x587a1c[_0x174a('0x19')][_0x174a('0x1b')]||null:null,'limit':_0x587a1c[_0x174a('0x19')]?_0x587a1c[_0x174a('0x19')][_0x174a('0x1c')]||null:null,'include':_0x587a1c[_0x174a('0x19')]?_0x587a1c[_0x174a('0x19')]['include']?_[_0x174a('0x1d')](_0x587a1c['options']['include'],function(_0x20c9f8){return{'model':db[_0x20c9f8[_0x174a('0x1e')]],'as':_0x20c9f8['as'],'attributes':_0x20c9f8[_0x174a('0x1b')],'include':_0x20c9f8['include']?_[_0x174a('0x1d')](_0x20c9f8[_0x174a('0x1f')],function(_0x2bbeed){return{'model':db[_0x2bbeed[_0x174a('0x1e')]],'as':_0x2bbeed['as'],'attributes':_0x2bbeed[_0x174a('0x1b')],'include':_0x2bbeed[_0x174a('0x1f')]?_[_0x174a('0x1d')](_0x2bbeed['include'],function(_0x2fae2f){return{'model':db[_0x2fae2f[_0x174a('0x1e')]],'as':_0x2fae2f['as'],'attributes':_0x2fae2f[_0x174a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x174a('0xc')](function(_0x5d6cdd){logger[_0x174a('0x14')](_0x174a('0x17'),_0x587a1c);logger[_0x174a('0xe')](_0x174a('0x17'),_0x587a1c,JSON[_0x174a('0x20')](_0x5d6cdd));_0x6581b4(_0x5d6cdd);})[_0x174a('0x16')](function(_0x1252a2){logger[_0x174a('0x11')](_0x174a('0x17'),_0x1252a2['message'],_0x587a1c);_0x46fcdc(_0x26a8df['error'](0x1f4,_0x1252a2[_0x174a('0x13')]));});});};exports[_0x174a('0x21')]=function(_0x3fb2c7){var _0x482ac1=this;return new Promise(function(_0x17afc3,_0x46cad3){return db[_0x174a('0x22')][_0x174a('0x23')]({'raw':_0x3fb2c7['options']?_0x3fb2c7[_0x174a('0x19')][_0x174a('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fb2c7[_0x174a('0x19')]?_0x3fb2c7[_0x174a('0x19')][_0x174a('0x24')]||null:null,'attributes':_0x3fb2c7[_0x174a('0x19')]?_0x3fb2c7['options'][_0x174a('0x1b')]||null:null,'include':_0x3fb2c7[_0x174a('0x19')]?_0x3fb2c7[_0x174a('0x19')][_0x174a('0x1f')]?_[_0x174a('0x1d')](_0x3fb2c7['options'][_0x174a('0x1f')],function(_0x532473){return{'model':db[_0x532473[_0x174a('0x1e')]],'as':_0x532473['as'],'attributes':_0x532473['attributes'],'include':_0x532473[_0x174a('0x1f')]?_[_0x174a('0x1d')](_0x532473[_0x174a('0x1f')],function(_0x5ee9f4){return{'model':db[_0x5ee9f4[_0x174a('0x1e')]],'as':_0x5ee9f4['as'],'attributes':_0x5ee9f4['attributes'],'include':_0x5ee9f4['include']?_[_0x174a('0x1d')](_0x5ee9f4['include'],function(_0x5ce11c){return{'model':db[_0x5ce11c[_0x174a('0x1e')]],'as':_0x5ce11c['as'],'attributes':_0x5ce11c[_0x174a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x174a('0xc')](function(_0xd64b1b){logger[_0x174a('0x14')](_0x174a('0x21'),_0x3fb2c7);logger['debug'](_0x174a('0x21'),_0x3fb2c7,JSON[_0x174a('0x20')](_0xd64b1b));_0x17afc3(_0xd64b1b);})[_0x174a('0x16')](function(_0x55ed1a){logger[_0x174a('0x11')]('ShowVtigerAccount',_0x55ed1a[_0x174a('0x13')],_0x3fb2c7);_0x46cad3(_0x482ac1[_0x174a('0x11')](0x1f4,_0x55ed1a[_0x174a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d7855cc..286890f 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(_0x2b7919,_0x21afcc){var _0x390d11=function(_0x44d9f2){while(--_0x44d9f2){_0x2b7919['push'](_0x2b7919['shift']());}};_0x390d11(++_0x21afcc);}(_0xb10b,0x12a));var _0xbb10=function(_0x38c0b2,_0x6a67a5){_0x38c0b2=_0x38c0b2-0x0;var _0x283c00=_0xb10b[_0x38c0b2];return _0x283c00;};'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 _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 7a19b88..8b8a3b6 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 _0xc4b4=['sequelize','STRING'];(function(_0x89bddd,_0x5c50e8){var _0x3a10e6=function(_0x2c887f){while(--_0x2c887f){_0x89bddd['push'](_0x89bddd['shift']());}};_0x3a10e6(++_0x5c50e8);}(_0xc4b4,0x76));var _0x4c4b=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xc4b4[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0x4c4b('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c4b('0x1')]},'description':{'type':Sequelize[_0x4c4b('0x1')]}}; \ No newline at end of file +var _0xf51e=['sequelize','exports','STRING'];(function(_0x361a28,_0x4da70e){var _0x2f8f23=function(_0x1fac35){while(--_0x1fac35){_0x361a28['push'](_0x361a28['shift']());}};_0x2f8f23(++_0x4da70e);}(_0xf51e,0x99));var _0xef51=function(_0x1e3045,_0x5a0c98){_0x1e3045=_0x1e3045-0x0;var _0x48ba27=_0xf51e[_0x1e3045];return _0x48ba27;};'use strict';var Sequelize=require(_0xef51('0x0'));module[_0xef51('0x1')]={'name':{'type':Sequelize[_0xef51('0x2')]},'description':{'type':Sequelize[_0xef51('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 8b8d4ed..a215a7c 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 _0xf16c=['jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../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~!@#$%^&-_=+[{]}.','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','map','VtigerConfiguration','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','include','rows','show','params','rawAttributes','includeAll','create','body','find','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto'];(function(_0x6cb701,_0x6e56db){var _0x28259e=function(_0x556354){while(--_0x556354){_0x6cb701['push'](_0x6cb701['shift']());}};_0x28259e(++_0x6e56db);}(_0xf16c,0xad));var _0xcf16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf16c[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xcf16('0x0'));var emlformat=require(_0xcf16('0x1'));var rimraf=require(_0xcf16('0x2'));var zipdir=require(_0xcf16('0x3'));var jsonpatch=require(_0xcf16('0x4'));var rp=require(_0xcf16('0x5'));var moment=require(_0xcf16('0x6'));var BPromise=require(_0xcf16('0x7'));var Mustache=require(_0xcf16('0x8'));var util=require(_0xcf16('0x9'));var path=require(_0xcf16('0xa'));var sox=require('sox');var csv=require(_0xcf16('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf16('0xc'));var squel=require(_0xcf16('0xd'));var crypto=require(_0xcf16('0xe'));var jsforce=require(_0xcf16('0xf'));var deskjs=require(_0xcf16('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcf16('0x11'));var Papa=require(_0xcf16('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf16('0x13'));var hardwareService=require(_0xcf16('0x14'));var logger=require(_0xcf16('0x15'))(_0xcf16('0x16'));var utils=require('../../config/utils');var config=require(_0xcf16('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcf16('0x18'));var client=jayson[_0xcf16('0x19')][_0xcf16('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x221fa4,_0x5b8f47,_0x168b12){if(_0x168b12){var _0x27348e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27348e['test'](_0x5b8f47)){return _0x221fa4;}else{throw new db[(_0xcf16('0x1b'))][(_0xcf16('0x1c'))](_0xcf16('0x1d'));}}else{return _0x221fa4;}}function respondWithRpcPromise(_0x4d60d1,_0x53d6e7,_0x2bf22b,_0x5775d3){return new BPromise(function(_0x117753,_0x381b86){var _0x588b33=_0x5775d3||client;return _0x588b33[_0xcf16('0x1e')](_0x4d60d1,_0x2bf22b)[_0xcf16('0x1f')](function(_0xdedc0e){logger['info'](_0xcf16('0x20'),_0x53d6e7,_0xcf16('0x21'));logger[_0xcf16('0x22')](_0xcf16('0x23'),_0x53d6e7,_0xcf16('0x21'),JSON[_0xcf16('0x24')](_0xdedc0e));if(_0xdedc0e[_0xcf16('0x25')]){if(_0xdedc0e[_0xcf16('0x25')][_0xcf16('0x26')]===0x1f4){logger['error'](_0xcf16('0x20'),_0x53d6e7,_0xdedc0e[_0xcf16('0x25')][_0xcf16('0x27')]);return _0x381b86(_0xdedc0e[_0xcf16('0x25')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x53d6e7,_0xdedc0e[_0xcf16('0x25')][_0xcf16('0x27')]);return _0x117753(_0xdedc0e[_0xcf16('0x25')][_0xcf16('0x27')]);}else{logger[_0xcf16('0x28')]('VtigerConfiguration,\x20%s,\x20%s',_0x53d6e7,_0xcf16('0x21'));_0x117753(_0xdedc0e[_0xcf16('0x29')]['message']);}})[_0xcf16('0x2a')](function(_0x58ef7c){logger[_0xcf16('0x25')](_0xcf16('0x20'),_0x53d6e7,_0x58ef7c);_0x381b86(_0x58ef7c);});});}function respondWithStatusCode(_0x36695b,_0x352e3e){_0x352e3e=_0x352e3e||0xcc;return function(_0xeec219){if(_0xeec219){return _0x36695b[_0xcf16('0x2b')](_0x352e3e);}return _0x36695b[_0xcf16('0x2c')](_0x352e3e)[_0xcf16('0x2d')]();};}function respondWithResult(_0x375558,_0x56401b){_0x56401b=_0x56401b||0xc8;return function(_0x14c44d){if(_0x14c44d){return _0x375558[_0xcf16('0x2c')](_0x56401b)[_0xcf16('0x2e')](_0x14c44d);}};}function respondWithFilteredResult(_0x42fcbb,_0x48038f){return function(_0x3ccc83){if(_0x3ccc83){var _0x39b394=_0x3ccc83[_0xcf16('0x2f')],_0x1c9ebc=_0x48038f[_0xcf16('0x30')],_0x2795a3=_0x48038f[_0xcf16('0x30')]+_0x48038f[_0xcf16('0x31')],_0x17519c;if(_0x2795a3>=_0x39b394){_0x2795a3=_0x39b394;_0x17519c=0xc8;}else{_0x17519c=0xce;}_0x42fcbb[_0xcf16('0x2c')](_0x17519c);return _0x42fcbb['set'](_0xcf16('0x32'),_0x1c9ebc+'-'+_0x2795a3+'/'+_0x39b394)[_0xcf16('0x2e')](_0x3ccc83);}return null;};}function patchUpdates(_0x3206f6){return function(_0x35f23e){try{jsonpatch['apply'](_0x35f23e,_0x3206f6,!![]);}catch(_0x41ef3b){return BPromise[_0xcf16('0x33')](_0x41ef3b);}return _0x35f23e[_0xcf16('0x34')]();};}function saveUpdates(_0x35991e,_0x58e2c0){return function(_0x231920){if(_0x231920){return _0x231920[_0xcf16('0x35')](_0x35991e)['then'](function(_0x1a23e5){return _0x1a23e5;});}return null;};}function removeEntity(_0x26ee92,_0x444cee){return function(_0x3ec0cb){if(_0x3ec0cb){return _0x3ec0cb[_0xcf16('0x36')]()['then'](function(){_0x26ee92['status'](0xcc)[_0xcf16('0x2d')]();});}};}function handleEntityNotFound(_0x20e8a1,_0x2d8e2e){return function(_0x1f6626){if(!_0x1f6626){_0x20e8a1[_0xcf16('0x2b')](0x194);}return _0x1f6626;};}function handleError(_0x4be872,_0x3c6847){_0x3c6847=_0x3c6847||0x1f4;return function(_0x35974c){logger['error'](_0x35974c[_0xcf16('0x37')]);if(_0x35974c[_0xcf16('0x38')]){delete _0x35974c['name'];}_0x4be872[_0xcf16('0x2c')](_0x3c6847)[_0xcf16('0x39')](_0x35974c);};}exports[_0xcf16('0x3a')]=function(_0xb1c4af,_0x36e879){var _0x4edf6d={},_0x4da321={},_0x28c0c6={'count':0x0,'rows':[]};var _0x599660=_[_0xcf16('0x3b')](db[_0xcf16('0x3c')]['rawAttributes'],function(_0x3e45ef){return{'name':_0x3e45ef['fieldName'],'type':_0x3e45ef[_0xcf16('0x3d')][_0xcf16('0x3e')]};});_0x4da321['model']=_['map'](_0x599660,_0xcf16('0x38'));_0x4da321[_0xcf16('0x3f')]=_[_0xcf16('0x40')](_0xb1c4af[_0xcf16('0x3f')]);_0x4da321['filters']=_['intersection'](_0x4da321[_0xcf16('0x41')],_0x4da321[_0xcf16('0x3f')]);_0x4edf6d['attributes']=_[_0xcf16('0x42')](_0x4da321[_0xcf16('0x41')],qs[_0xcf16('0x43')](_0xb1c4af['query'][_0xcf16('0x43')]));_0x4edf6d['attributes']=_0x4edf6d[_0xcf16('0x44')][_0xcf16('0x45')]?_0x4edf6d['attributes']:_0x4da321['model'];if(!_0xb1c4af[_0xcf16('0x3f')][_0xcf16('0x46')]('nolimit')){_0x4edf6d[_0xcf16('0x31')]=qs[_0xcf16('0x31')](_0xb1c4af[_0xcf16('0x3f')][_0xcf16('0x31')]);_0x4edf6d[_0xcf16('0x30')]=qs[_0xcf16('0x30')](_0xb1c4af[_0xcf16('0x3f')]['offset']);}_0x4edf6d[_0xcf16('0x47')]=qs[_0xcf16('0x48')](_0xb1c4af['query'][_0xcf16('0x48')]);_0x4edf6d[_0xcf16('0x49')]=qs[_0xcf16('0x4a')](_[_0xcf16('0x4b')](_0xb1c4af[_0xcf16('0x3f')],_0x4da321[_0xcf16('0x4a')]),_0x599660);if(_0xb1c4af[_0xcf16('0x3f')]['filter']){_0x4edf6d[_0xcf16('0x49')]=_[_0xcf16('0x4c')](_0x4edf6d[_0xcf16('0x49')],{'$or':_[_0xcf16('0x3b')](_0x599660,function(_0x4d15f0){if(_0x4d15f0[_0xcf16('0x3d')]!=='VIRTUAL'){var _0x20e49f={};_0x20e49f[_0x4d15f0[_0xcf16('0x38')]]={'$like':'%'+_0xb1c4af[_0xcf16('0x3f')][_0xcf16('0x4d')]+'%'};return _0x20e49f;}})});}_0x4edf6d=_[_0xcf16('0x4c')]({},_0x4edf6d,_0xb1c4af[_0xcf16('0x4e')]);var _0x2415c1={'where':_0x4edf6d['where']};return db[_0xcf16('0x3c')][_0xcf16('0x2f')](_0x2415c1)[_0xcf16('0x1f')](function(_0x3937fb){_0x28c0c6['count']=_0x3937fb;if(_0xb1c4af[_0xcf16('0x3f')]['includeAll']){_0x4edf6d[_0xcf16('0x4f')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x4edf6d);})[_0xcf16('0x1f')](function(_0x5aab63){_0x28c0c6[_0xcf16('0x50')]=_0x5aab63;return _0x28c0c6;})[_0xcf16('0x1f')](respondWithFilteredResult(_0x36e879,_0x4edf6d))[_0xcf16('0x2a')](handleError(_0x36e879,null));};exports[_0xcf16('0x51')]=function(_0x31505d,_0x44b373){var _0x2a022a={'raw':![],'where':{'id':_0x31505d[_0xcf16('0x52')]['id']}},_0xad175c={};_0xad175c['model']=_[_0xcf16('0x40')](db[_0xcf16('0x3c')][_0xcf16('0x53')]);_0xad175c[_0xcf16('0x3f')]=_['keys'](_0x31505d[_0xcf16('0x3f')]);_0xad175c[_0xcf16('0x4a')]=_[_0xcf16('0x42')](_0xad175c[_0xcf16('0x41')],_0xad175c[_0xcf16('0x3f')]);_0x2a022a[_0xcf16('0x44')]=_[_0xcf16('0x42')](_0xad175c[_0xcf16('0x41')],qs['fields'](_0x31505d[_0xcf16('0x3f')][_0xcf16('0x43')]));_0x2a022a[_0xcf16('0x44')]=_0x2a022a[_0xcf16('0x44')]['length']?_0x2a022a[_0xcf16('0x44')]:_0xad175c[_0xcf16('0x41')];if(_0x31505d[_0xcf16('0x3f')][_0xcf16('0x54')]){_0x2a022a[_0xcf16('0x4f')]=[{'all':!![]}];}_0x2a022a=_[_0xcf16('0x4c')]({},_0x2a022a,_0x31505d[_0xcf16('0x4e')]);return db[_0xcf16('0x3c')]['find'](_0x2a022a)['then'](handleEntityNotFound(_0x44b373,null))[_0xcf16('0x1f')](respondWithResult(_0x44b373,null))[_0xcf16('0x2a')](handleError(_0x44b373,null));};exports[_0xcf16('0x55')]=function(_0x220532,_0x45a13d){return db['VtigerConfiguration'][_0xcf16('0x55')](_0x220532[_0xcf16('0x56')],{})['then'](respondWithResult(_0x45a13d,0xc9))['catch'](handleError(_0x45a13d,null));};exports[_0xcf16('0x35')]=function(_0x422414,_0x28637d){if(_0x422414[_0xcf16('0x56')]['id']){delete _0x422414['body']['id'];}return db['VtigerConfiguration'][_0xcf16('0x57')]({'where':{'id':_0x422414[_0xcf16('0x52')]['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x28637d,null))[_0xcf16('0x1f')](saveUpdates(_0x422414[_0xcf16('0x56')],null))[_0xcf16('0x1f')](respondWithResult(_0x28637d,null))[_0xcf16('0x2a')](handleError(_0x28637d,null));};exports['destroy']=function(_0x1bb6a8,_0x174e34){return db[_0xcf16('0x3c')]['find']({'where':{'id':_0x1bb6a8['params']['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x174e34,null))[_0xcf16('0x1f')](removeEntity(_0x174e34,null))[_0xcf16('0x2a')](handleError(_0x174e34,null));};exports[_0xcf16('0x58')]=function(_0x18d972,_0x2319d0,_0x89597b){var _0x3f25e4={};var _0x316390={};var _0x315e55;var _0x22d32d;return db['VtigerConfiguration'][_0xcf16('0x59')]({'where':{'id':_0x18d972['params']['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x2319d0,null))['then'](function(_0x56d7a6){if(_0x56d7a6){_0x315e55=_0x56d7a6;_0x316390[_0xcf16('0x41')]=_[_0xcf16('0x40')](db[_0xcf16('0x5a')][_0xcf16('0x53')]);_0x316390['query']=_[_0xcf16('0x40')](_0x18d972[_0xcf16('0x3f')]);_0x316390[_0xcf16('0x4a')]=_['intersection'](_0x316390[_0xcf16('0x41')],_0x316390[_0xcf16('0x3f')]);_0x3f25e4['attributes']=_[_0xcf16('0x42')](_0x316390[_0xcf16('0x41')],qs['fields'](_0x18d972[_0xcf16('0x3f')][_0xcf16('0x43')]));_0x3f25e4[_0xcf16('0x44')]=_0x3f25e4[_0xcf16('0x44')][_0xcf16('0x45')]?_0x3f25e4['attributes']:_0x316390[_0xcf16('0x41')];_0x3f25e4['order']=qs[_0xcf16('0x48')](_0x18d972['query'][_0xcf16('0x48')]);_0x3f25e4[_0xcf16('0x49')]=qs[_0xcf16('0x4a')](_[_0xcf16('0x4b')](_0x18d972['query'],_0x316390[_0xcf16('0x4a')]));if(_0x18d972['query'][_0xcf16('0x4d')]){_0x3f25e4[_0xcf16('0x49')]=_[_0xcf16('0x4c')](_0x3f25e4[_0xcf16('0x49')],{'$or':_[_0xcf16('0x3b')](_0x3f25e4[_0xcf16('0x44')],function(_0x562a89){var _0x3363db={};_0x3363db[_0x562a89]={'$like':'%'+_0x18d972[_0xcf16('0x3f')][_0xcf16('0x4d')]+'%'};return _0x3363db;})});}_0x3f25e4=_[_0xcf16('0x4c')]({},_0x3f25e4,_0x18d972['options']);return _0x315e55[_0xcf16('0x58')](_0x3f25e4);}})['then'](function(_0x4fa9af){if(_0x4fa9af){_0x22d32d=_0x4fa9af[_0xcf16('0x45')];if(!_0x18d972[_0xcf16('0x3f')]['hasOwnProperty'](_0xcf16('0x5b'))){_0x3f25e4['limit']=qs[_0xcf16('0x31')](_0x18d972['query'][_0xcf16('0x31')]);_0x3f25e4['offset']=qs[_0xcf16('0x30')](_0x18d972[_0xcf16('0x3f')]['offset']);}return _0x315e55[_0xcf16('0x58')](_0x3f25e4);}})[_0xcf16('0x1f')](function(_0x310944){if(_0x310944){return _0x310944?{'count':_0x22d32d,'rows':_0x310944}:null;}})['then'](respondWithResult(_0x2319d0,null))['catch'](handleError(_0x2319d0,null));};exports[_0xcf16('0x5c')]=function(_0x4dca0e,_0x19259a,_0x417f08){var _0x2894d6={};var _0x212e49={};var _0x3200ba;var _0x1d0877;return db[_0xcf16('0x3c')][_0xcf16('0x59')]({'where':{'id':_0x4dca0e[_0xcf16('0x52')]['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x19259a,null))[_0xcf16('0x1f')](function(_0x392065){if(_0x392065){_0x3200ba=_0x392065;_0x212e49[_0xcf16('0x41')]=_[_0xcf16('0x40')](db[_0xcf16('0x5a')][_0xcf16('0x53')]);_0x212e49[_0xcf16('0x3f')]=_[_0xcf16('0x40')](_0x4dca0e[_0xcf16('0x3f')]);_0x212e49[_0xcf16('0x4a')]=_[_0xcf16('0x42')](_0x212e49['model'],_0x212e49[_0xcf16('0x3f')]);_0x2894d6[_0xcf16('0x44')]=_[_0xcf16('0x42')](_0x212e49['model'],qs['fields'](_0x4dca0e[_0xcf16('0x3f')]['fields']));_0x2894d6[_0xcf16('0x44')]=_0x2894d6['attributes'][_0xcf16('0x45')]?_0x2894d6['attributes']:_0x212e49[_0xcf16('0x41')];_0x2894d6[_0xcf16('0x47')]=qs[_0xcf16('0x48')](_0x4dca0e[_0xcf16('0x3f')][_0xcf16('0x48')]);_0x2894d6[_0xcf16('0x49')]=qs[_0xcf16('0x4a')](_[_0xcf16('0x4b')](_0x4dca0e[_0xcf16('0x3f')],_0x212e49[_0xcf16('0x4a')]));if(_0x4dca0e[_0xcf16('0x3f')][_0xcf16('0x4d')]){_0x2894d6[_0xcf16('0x49')]=_[_0xcf16('0x4c')](_0x2894d6[_0xcf16('0x49')],{'$or':_[_0xcf16('0x3b')](_0x2894d6['attributes'],function(_0x2378e1){var _0x34edaa={};_0x34edaa[_0x2378e1]={'$like':'%'+_0x4dca0e[_0xcf16('0x3f')]['filter']+'%'};return _0x34edaa;})});}_0x2894d6=_[_0xcf16('0x4c')]({},_0x2894d6,_0x4dca0e[_0xcf16('0x4e')]);return _0x3200ba[_0xcf16('0x5c')](_0x2894d6);}})[_0xcf16('0x1f')](function(_0x35ff8a){if(_0x35ff8a){_0x1d0877=_0x35ff8a[_0xcf16('0x45')];if(!_0x4dca0e['query'][_0xcf16('0x46')](_0xcf16('0x5b'))){_0x2894d6[_0xcf16('0x31')]=qs[_0xcf16('0x31')](_0x4dca0e[_0xcf16('0x3f')][_0xcf16('0x31')]);_0x2894d6[_0xcf16('0x30')]=qs[_0xcf16('0x30')](_0x4dca0e[_0xcf16('0x3f')]['offset']);}return _0x3200ba[_0xcf16('0x5c')](_0x2894d6);}})['then'](function(_0x305b30){if(_0x305b30){return _0x305b30?{'count':_0x1d0877,'rows':_0x305b30}:null;}})[_0xcf16('0x1f')](respondWithResult(_0x19259a,null))[_0xcf16('0x2a')](handleError(_0x19259a,null));};exports[_0xcf16('0x5d')]=function(_0x39304a,_0x5dea15,_0x463035){var _0x50f968={};var _0x5cbcca={};var _0x4a9103;var _0x1d6747;return db[_0xcf16('0x3c')][_0xcf16('0x59')]({'where':{'id':_0x39304a[_0xcf16('0x52')]['id']}})[_0xcf16('0x1f')](handleEntityNotFound(_0x5dea15,null))['then'](function(_0x1ca748){if(_0x1ca748){_0x4a9103=_0x1ca748;_0x5cbcca[_0xcf16('0x41')]=_[_0xcf16('0x40')](db[_0xcf16('0x5a')][_0xcf16('0x53')]);_0x5cbcca[_0xcf16('0x3f')]=_[_0xcf16('0x40')](_0x39304a[_0xcf16('0x3f')]);_0x5cbcca[_0xcf16('0x4a')]=_[_0xcf16('0x42')](_0x5cbcca[_0xcf16('0x41')],_0x5cbcca[_0xcf16('0x3f')]);_0x50f968['attributes']=_[_0xcf16('0x42')](_0x5cbcca[_0xcf16('0x41')],qs['fields'](_0x39304a['query']['fields']));_0x50f968[_0xcf16('0x44')]=_0x50f968[_0xcf16('0x44')][_0xcf16('0x45')]?_0x50f968[_0xcf16('0x44')]:_0x5cbcca[_0xcf16('0x41')];_0x50f968[_0xcf16('0x47')]=qs['sort'](_0x39304a[_0xcf16('0x3f')][_0xcf16('0x48')]);_0x50f968['where']=qs[_0xcf16('0x4a')](_['pick'](_0x39304a[_0xcf16('0x3f')],_0x5cbcca['filters']));if(_0x39304a[_0xcf16('0x3f')]['filter']){_0x50f968[_0xcf16('0x49')]=_[_0xcf16('0x4c')](_0x50f968[_0xcf16('0x49')],{'$or':_[_0xcf16('0x3b')](_0x50f968['attributes'],function(_0x56842d){var _0x1518f1={};_0x1518f1[_0x56842d]={'$like':'%'+_0x39304a[_0xcf16('0x3f')]['filter']+'%'};return _0x1518f1;})});}_0x50f968=_['merge']({},_0x50f968,_0x39304a['options']);return _0x4a9103['getDescriptions'](_0x50f968);}})['then'](function(_0x2ea657){if(_0x2ea657){_0x1d6747=_0x2ea657[_0xcf16('0x45')];if(!_0x39304a['query']['hasOwnProperty']('nolimit')){_0x50f968[_0xcf16('0x31')]=qs[_0xcf16('0x31')](_0x39304a[_0xcf16('0x3f')]['limit']);_0x50f968[_0xcf16('0x30')]=qs[_0xcf16('0x30')](_0x39304a[_0xcf16('0x3f')][_0xcf16('0x30')]);}return _0x4a9103[_0xcf16('0x5d')](_0x50f968);}})[_0xcf16('0x1f')](function(_0x11cc95){if(_0x11cc95){return _0x11cc95?{'count':_0x1d6747,'rows':_0x11cc95}:null;}})[_0xcf16('0x1f')](respondWithResult(_0x5dea15,null))[_0xcf16('0x2a')](handleError(_0x5dea15,null));}; \ No newline at end of file +var _0xaed1=['key','model','map','query','filters','intersection','attributes','fields','length','nolimit','offset','order','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','keys','VtigerField','sort','pick','hasOwnProperty','getSubjects','getDescriptions','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../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','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaed1,0x1b1));var _0x1aed=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0xaed1[_0x53e3de];return _0x7b905b;};'use strict';var pdf=require(_0x1aed('0x0'));var emlformat=require(_0x1aed('0x1'));var rimraf=require(_0x1aed('0x2'));var zipdir=require(_0x1aed('0x3'));var jsonpatch=require(_0x1aed('0x4'));var rp=require(_0x1aed('0x5'));var moment=require(_0x1aed('0x6'));var BPromise=require(_0x1aed('0x7'));var Mustache=require(_0x1aed('0x8'));var util=require(_0x1aed('0x9'));var path=require(_0x1aed('0xa'));var sox=require(_0x1aed('0xb'));var csv=require(_0x1aed('0xc'));var ejs=require(_0x1aed('0xd'));var fs=require('fs');var _=require(_0x1aed('0xe'));var squel=require(_0x1aed('0xf'));var crypto=require('crypto');var jsforce=require(_0x1aed('0x10'));var deskjs=require(_0x1aed('0x11'));var toCsv=require(_0x1aed('0xc'));var querystring=require('querystring');var Papa=require(_0x1aed('0x12'));var Redis=require(_0x1aed('0x13'));var authService=require(_0x1aed('0x14'));var qs=require(_0x1aed('0x15'));var as=require(_0x1aed('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1aed('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x1aed('0x18'));var db=require(_0x1aed('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1aed('0x1a')][_0x1aed('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4db5d4,_0x5d4309,_0x1dd8f7){if(_0x1dd8f7){var _0x4bb255=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bb255['test'](_0x5d4309)){return _0x4db5d4;}else{throw new db[(_0x1aed('0x1c'))][(_0x1aed('0x1d'))](_0x1aed('0x1e'));}}else{return _0x4db5d4;}}function respondWithRpcPromise(_0x4056fb,_0x8d87be,_0x1c8bcf,_0x5e466e){return new BPromise(function(_0x9ed034,_0x3b7636){var _0x1f0b32=_0x5e466e||client;return _0x1f0b32[_0x1aed('0x1f')](_0x4056fb,_0x1c8bcf)[_0x1aed('0x20')](function(_0x23c4e4){logger[_0x1aed('0x21')](_0x1aed('0x22'),_0x8d87be,_0x1aed('0x23'));logger[_0x1aed('0x24')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x8d87be,_0x1aed('0x23'),JSON[_0x1aed('0x25')](_0x23c4e4));if(_0x23c4e4[_0x1aed('0x26')]){if(_0x23c4e4[_0x1aed('0x26')][_0x1aed('0x27')]===0x1f4){logger['error'](_0x1aed('0x22'),_0x8d87be,_0x23c4e4[_0x1aed('0x26')]['message']);return _0x3b7636(_0x23c4e4[_0x1aed('0x26')]['message']);}logger[_0x1aed('0x26')](_0x1aed('0x22'),_0x8d87be,_0x23c4e4[_0x1aed('0x26')]['message']);return _0x9ed034(_0x23c4e4[_0x1aed('0x26')][_0x1aed('0x28')]);}else{logger['info'](_0x1aed('0x22'),_0x8d87be,_0x1aed('0x23'));_0x9ed034(_0x23c4e4[_0x1aed('0x29')][_0x1aed('0x28')]);}})['catch'](function(_0x1a00ad){logger[_0x1aed('0x26')](_0x1aed('0x22'),_0x8d87be,_0x1a00ad);_0x3b7636(_0x1a00ad);});});}function respondWithStatusCode(_0x31c4e6,_0x396a5f){_0x396a5f=_0x396a5f||0xcc;return function(_0xc19d30){if(_0xc19d30){return _0x31c4e6[_0x1aed('0x2a')](_0x396a5f);}return _0x31c4e6[_0x1aed('0x2b')](_0x396a5f)[_0x1aed('0x2c')]();};}function respondWithResult(_0x5d3fca,_0x15d80d){_0x15d80d=_0x15d80d||0xc8;return function(_0x5b8afd){if(_0x5b8afd){return _0x5d3fca[_0x1aed('0x2b')](_0x15d80d)['json'](_0x5b8afd);}};}function respondWithFilteredResult(_0x27b8c1,_0x2bfa77){return function(_0x2363a8){if(_0x2363a8){var _0x130cd0=_0x2363a8[_0x1aed('0x2d')],_0x38cf7d=_0x2bfa77['offset'],_0x6f4dab=_0x2bfa77['offset']+_0x2bfa77[_0x1aed('0x2e')],_0x4aba03;if(_0x6f4dab>=_0x130cd0){_0x6f4dab=_0x130cd0;_0x4aba03=0xc8;}else{_0x4aba03=0xce;}_0x27b8c1['status'](_0x4aba03);return _0x27b8c1[_0x1aed('0x2f')](_0x1aed('0x30'),_0x38cf7d+'-'+_0x6f4dab+'/'+_0x130cd0)[_0x1aed('0x31')](_0x2363a8);}return null;};}function patchUpdates(_0x5d6e28){return function(_0x1bc795){try{jsonpatch[_0x1aed('0x32')](_0x1bc795,_0x5d6e28,!![]);}catch(_0x368bd4){return BPromise[_0x1aed('0x33')](_0x368bd4);}return _0x1bc795[_0x1aed('0x34')]();};}function saveUpdates(_0x30b657,_0x4d5423){return function(_0x44f44a){if(_0x44f44a){return _0x44f44a[_0x1aed('0x35')](_0x30b657)[_0x1aed('0x20')](function(_0x3ad6ad){return _0x3ad6ad;});}return null;};}function removeEntity(_0x1b9101,_0x287f21){return function(_0x316596){if(_0x316596){return _0x316596[_0x1aed('0x36')]()[_0x1aed('0x20')](function(){_0x1b9101[_0x1aed('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62d394,_0xda8120){return function(_0x4369ce){if(!_0x4369ce){_0x62d394[_0x1aed('0x2a')](0x194);}return _0x4369ce;};}function handleError(_0x2b7edb,_0x24c7ae){_0x24c7ae=_0x24c7ae||0x1f4;return function(_0x182584){logger[_0x1aed('0x26')](_0x182584[_0x1aed('0x37')]);if(_0x182584[_0x1aed('0x38')]){delete _0x182584[_0x1aed('0x38')];}_0x2b7edb[_0x1aed('0x2b')](_0x24c7ae)[_0x1aed('0x39')](_0x182584);};}exports[_0x1aed('0x3a')]=function(_0x492dc6,_0x5378fd){var _0x36ce17={},_0x5d7c8d={},_0x446d6a={'count':0x0,'rows':[]};var _0xa0ac8=_['map'](db[_0x1aed('0x3b')][_0x1aed('0x3c')],function(_0x8fc169){return{'name':_0x8fc169[_0x1aed('0x3d')],'type':_0x8fc169['type'][_0x1aed('0x3e')]};});_0x5d7c8d[_0x1aed('0x3f')]=_[_0x1aed('0x40')](_0xa0ac8,_0x1aed('0x38'));_0x5d7c8d[_0x1aed('0x41')]=_['keys'](_0x492dc6[_0x1aed('0x41')]);_0x5d7c8d[_0x1aed('0x42')]=_[_0x1aed('0x43')](_0x5d7c8d[_0x1aed('0x3f')],_0x5d7c8d[_0x1aed('0x41')]);_0x36ce17[_0x1aed('0x44')]=_[_0x1aed('0x43')](_0x5d7c8d[_0x1aed('0x3f')],qs[_0x1aed('0x45')](_0x492dc6['query'][_0x1aed('0x45')]));_0x36ce17['attributes']=_0x36ce17['attributes'][_0x1aed('0x46')]?_0x36ce17[_0x1aed('0x44')]:_0x5d7c8d[_0x1aed('0x3f')];if(!_0x492dc6[_0x1aed('0x41')]['hasOwnProperty'](_0x1aed('0x47'))){_0x36ce17['limit']=qs[_0x1aed('0x2e')](_0x492dc6[_0x1aed('0x41')]['limit']);_0x36ce17[_0x1aed('0x48')]=qs[_0x1aed('0x48')](_0x492dc6['query'][_0x1aed('0x48')]);}_0x36ce17[_0x1aed('0x49')]=qs['sort'](_0x492dc6[_0x1aed('0x41')]['sort']);_0x36ce17[_0x1aed('0x4a')]=qs['filters'](_['pick'](_0x492dc6[_0x1aed('0x41')],_0x5d7c8d[_0x1aed('0x42')]),_0xa0ac8);if(_0x492dc6['query']['filter']){_0x36ce17['where']=_[_0x1aed('0x4b')](_0x36ce17[_0x1aed('0x4a')],{'$or':_['map'](_0xa0ac8,function(_0x59cab0){if(_0x59cab0[_0x1aed('0x4c')]!==_0x1aed('0x4d')){var _0x3bbcc8={};_0x3bbcc8[_0x59cab0[_0x1aed('0x38')]]={'$like':'%'+_0x492dc6[_0x1aed('0x41')][_0x1aed('0x4e')]+'%'};return _0x3bbcc8;}})});}_0x36ce17=_[_0x1aed('0x4b')]({},_0x36ce17,_0x492dc6[_0x1aed('0x4f')]);var _0x7e5dc9={'where':_0x36ce17[_0x1aed('0x4a')]};return db[_0x1aed('0x3b')][_0x1aed('0x2d')](_0x7e5dc9)[_0x1aed('0x20')](function(_0x165b9f){_0x446d6a[_0x1aed('0x2d')]=_0x165b9f;if(_0x492dc6[_0x1aed('0x41')][_0x1aed('0x50')]){_0x36ce17['include']=[{'all':!![]}];}return db[_0x1aed('0x3b')][_0x1aed('0x51')](_0x36ce17);})[_0x1aed('0x20')](function(_0x308106){_0x446d6a[_0x1aed('0x52')]=_0x308106;return _0x446d6a;})[_0x1aed('0x20')](respondWithFilteredResult(_0x5378fd,_0x36ce17))[_0x1aed('0x53')](handleError(_0x5378fd,null));};exports[_0x1aed('0x54')]=function(_0x16ec31,_0x24e20c){var _0x501bab={'raw':![],'where':{'id':_0x16ec31[_0x1aed('0x55')]['id']}},_0x21c446={};_0x21c446[_0x1aed('0x3f')]=_['keys'](db[_0x1aed('0x3b')][_0x1aed('0x3c')]);_0x21c446['query']=_['keys'](_0x16ec31[_0x1aed('0x41')]);_0x21c446[_0x1aed('0x42')]=_[_0x1aed('0x43')](_0x21c446[_0x1aed('0x3f')],_0x21c446[_0x1aed('0x41')]);_0x501bab[_0x1aed('0x44')]=_[_0x1aed('0x43')](_0x21c446[_0x1aed('0x3f')],qs[_0x1aed('0x45')](_0x16ec31[_0x1aed('0x41')][_0x1aed('0x45')]));_0x501bab['attributes']=_0x501bab[_0x1aed('0x44')][_0x1aed('0x46')]?_0x501bab[_0x1aed('0x44')]:_0x21c446['model'];if(_0x16ec31[_0x1aed('0x41')][_0x1aed('0x50')]){_0x501bab[_0x1aed('0x56')]=[{'all':!![]}];}_0x501bab=_[_0x1aed('0x4b')]({},_0x501bab,_0x16ec31[_0x1aed('0x4f')]);return db[_0x1aed('0x3b')][_0x1aed('0x57')](_0x501bab)['then'](handleEntityNotFound(_0x24e20c,null))['then'](respondWithResult(_0x24e20c,null))[_0x1aed('0x53')](handleError(_0x24e20c,null));};exports['create']=function(_0x185c17,_0x35f8d0){return db[_0x1aed('0x3b')][_0x1aed('0x58')](_0x185c17[_0x1aed('0x59')],{})[_0x1aed('0x20')](respondWithResult(_0x35f8d0,0xc9))[_0x1aed('0x53')](handleError(_0x35f8d0,null));};exports[_0x1aed('0x35')]=function(_0x4eb42,_0x4fe9d8){if(_0x4eb42[_0x1aed('0x59')]['id']){delete _0x4eb42['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x4eb42[_0x1aed('0x55')]['id']}})[_0x1aed('0x20')](handleEntityNotFound(_0x4fe9d8,null))[_0x1aed('0x20')](saveUpdates(_0x4eb42[_0x1aed('0x59')],null))[_0x1aed('0x20')](respondWithResult(_0x4fe9d8,null))[_0x1aed('0x53')](handleError(_0x4fe9d8,null));};exports[_0x1aed('0x36')]=function(_0x2b94dc,_0x4173b6){return db[_0x1aed('0x3b')][_0x1aed('0x57')]({'where':{'id':_0x2b94dc[_0x1aed('0x55')]['id']}})[_0x1aed('0x20')](handleEntityNotFound(_0x4173b6,null))[_0x1aed('0x20')](removeEntity(_0x4173b6,null))[_0x1aed('0x53')](handleError(_0x4173b6,null));};exports[_0x1aed('0x5a')]=function(_0x529e83,_0x24506d,_0x295c15){var _0x27073={};var _0x2f6b46={};var _0x50dfcc;var _0x4b9e03;return db[_0x1aed('0x3b')][_0x1aed('0x5b')]({'where':{'id':_0x529e83['params']['id']}})[_0x1aed('0x20')](handleEntityNotFound(_0x24506d,null))[_0x1aed('0x20')](function(_0x5b3e5f){if(_0x5b3e5f){_0x50dfcc=_0x5b3e5f;_0x2f6b46[_0x1aed('0x3f')]=_[_0x1aed('0x5c')](db[_0x1aed('0x5d')][_0x1aed('0x3c')]);_0x2f6b46['query']=_[_0x1aed('0x5c')](_0x529e83['query']);_0x2f6b46[_0x1aed('0x42')]=_[_0x1aed('0x43')](_0x2f6b46[_0x1aed('0x3f')],_0x2f6b46[_0x1aed('0x41')]);_0x27073[_0x1aed('0x44')]=_[_0x1aed('0x43')](_0x2f6b46['model'],qs[_0x1aed('0x45')](_0x529e83[_0x1aed('0x41')]['fields']));_0x27073[_0x1aed('0x44')]=_0x27073[_0x1aed('0x44')][_0x1aed('0x46')]?_0x27073[_0x1aed('0x44')]:_0x2f6b46[_0x1aed('0x3f')];_0x27073[_0x1aed('0x49')]=qs[_0x1aed('0x5e')](_0x529e83[_0x1aed('0x41')][_0x1aed('0x5e')]);_0x27073[_0x1aed('0x4a')]=qs[_0x1aed('0x42')](_[_0x1aed('0x5f')](_0x529e83[_0x1aed('0x41')],_0x2f6b46['filters']));if(_0x529e83['query'][_0x1aed('0x4e')]){_0x27073[_0x1aed('0x4a')]=_[_0x1aed('0x4b')](_0x27073[_0x1aed('0x4a')],{'$or':_[_0x1aed('0x40')](_0x27073[_0x1aed('0x44')],function(_0x5d954b){var _0x2d2e3a={};_0x2d2e3a[_0x5d954b]={'$like':'%'+_0x529e83['query'][_0x1aed('0x4e')]+'%'};return _0x2d2e3a;})});}_0x27073=_[_0x1aed('0x4b')]({},_0x27073,_0x529e83[_0x1aed('0x4f')]);return _0x50dfcc[_0x1aed('0x5a')](_0x27073);}})[_0x1aed('0x20')](function(_0x3d97b8){if(_0x3d97b8){_0x4b9e03=_0x3d97b8['length'];if(!_0x529e83[_0x1aed('0x41')][_0x1aed('0x60')](_0x1aed('0x47'))){_0x27073[_0x1aed('0x2e')]=qs[_0x1aed('0x2e')](_0x529e83['query'][_0x1aed('0x2e')]);_0x27073[_0x1aed('0x48')]=qs[_0x1aed('0x48')](_0x529e83[_0x1aed('0x41')]['offset']);}return _0x50dfcc[_0x1aed('0x5a')](_0x27073);}})[_0x1aed('0x20')](function(_0x5b4e77){if(_0x5b4e77){return _0x5b4e77?{'count':_0x4b9e03,'rows':_0x5b4e77}:null;}})[_0x1aed('0x20')](respondWithResult(_0x24506d,null))[_0x1aed('0x53')](handleError(_0x24506d,null));};exports[_0x1aed('0x61')]=function(_0x307c74,_0x22546e,_0x2c1eac){var _0x21c206={};var _0x245e30={};var _0x23a1ca;var _0x4f7a80;return db[_0x1aed('0x3b')][_0x1aed('0x5b')]({'where':{'id':_0x307c74[_0x1aed('0x55')]['id']}})[_0x1aed('0x20')](handleEntityNotFound(_0x22546e,null))[_0x1aed('0x20')](function(_0x380279){if(_0x380279){_0x23a1ca=_0x380279;_0x245e30[_0x1aed('0x3f')]=_[_0x1aed('0x5c')](db[_0x1aed('0x5d')][_0x1aed('0x3c')]);_0x245e30[_0x1aed('0x41')]=_[_0x1aed('0x5c')](_0x307c74[_0x1aed('0x41')]);_0x245e30[_0x1aed('0x42')]=_[_0x1aed('0x43')](_0x245e30[_0x1aed('0x3f')],_0x245e30['query']);_0x21c206[_0x1aed('0x44')]=_['intersection'](_0x245e30['model'],qs[_0x1aed('0x45')](_0x307c74[_0x1aed('0x41')][_0x1aed('0x45')]));_0x21c206[_0x1aed('0x44')]=_0x21c206[_0x1aed('0x44')][_0x1aed('0x46')]?_0x21c206['attributes']:_0x245e30['model'];_0x21c206[_0x1aed('0x49')]=qs['sort'](_0x307c74[_0x1aed('0x41')][_0x1aed('0x5e')]);_0x21c206[_0x1aed('0x4a')]=qs['filters'](_[_0x1aed('0x5f')](_0x307c74[_0x1aed('0x41')],_0x245e30[_0x1aed('0x42')]));if(_0x307c74['query'][_0x1aed('0x4e')]){_0x21c206[_0x1aed('0x4a')]=_[_0x1aed('0x4b')](_0x21c206['where'],{'$or':_['map'](_0x21c206[_0x1aed('0x44')],function(_0x3e27ec){var _0x3e77b1={};_0x3e77b1[_0x3e27ec]={'$like':'%'+_0x307c74['query'][_0x1aed('0x4e')]+'%'};return _0x3e77b1;})});}_0x21c206=_[_0x1aed('0x4b')]({},_0x21c206,_0x307c74[_0x1aed('0x4f')]);return _0x23a1ca[_0x1aed('0x61')](_0x21c206);}})['then'](function(_0xabd7d9){if(_0xabd7d9){_0x4f7a80=_0xabd7d9[_0x1aed('0x46')];if(!_0x307c74['query'][_0x1aed('0x60')](_0x1aed('0x47'))){_0x21c206[_0x1aed('0x2e')]=qs[_0x1aed('0x2e')](_0x307c74['query'][_0x1aed('0x2e')]);_0x21c206[_0x1aed('0x48')]=qs[_0x1aed('0x48')](_0x307c74['query'][_0x1aed('0x48')]);}return _0x23a1ca['getSubjects'](_0x21c206);}})[_0x1aed('0x20')](function(_0x415a9c){if(_0x415a9c){return _0x415a9c?{'count':_0x4f7a80,'rows':_0x415a9c}:null;}})['then'](respondWithResult(_0x22546e,null))['catch'](handleError(_0x22546e,null));};exports['getDescriptions']=function(_0x13e0f9,_0x1c2246,_0x4f8c4b){var _0x1113b0={};var _0x439f51={};var _0x484313;var _0x2978ff;return db[_0x1aed('0x3b')][_0x1aed('0x5b')]({'where':{'id':_0x13e0f9[_0x1aed('0x55')]['id']}})[_0x1aed('0x20')](handleEntityNotFound(_0x1c2246,null))[_0x1aed('0x20')](function(_0xae1f9c){if(_0xae1f9c){_0x484313=_0xae1f9c;_0x439f51[_0x1aed('0x3f')]=_[_0x1aed('0x5c')](db[_0x1aed('0x5d')][_0x1aed('0x3c')]);_0x439f51[_0x1aed('0x41')]=_['keys'](_0x13e0f9[_0x1aed('0x41')]);_0x439f51[_0x1aed('0x42')]=_[_0x1aed('0x43')](_0x439f51[_0x1aed('0x3f')],_0x439f51['query']);_0x1113b0[_0x1aed('0x44')]=_[_0x1aed('0x43')](_0x439f51['model'],qs[_0x1aed('0x45')](_0x13e0f9[_0x1aed('0x41')][_0x1aed('0x45')]));_0x1113b0[_0x1aed('0x44')]=_0x1113b0[_0x1aed('0x44')][_0x1aed('0x46')]?_0x1113b0['attributes']:_0x439f51[_0x1aed('0x3f')];_0x1113b0[_0x1aed('0x49')]=qs[_0x1aed('0x5e')](_0x13e0f9[_0x1aed('0x41')][_0x1aed('0x5e')]);_0x1113b0[_0x1aed('0x4a')]=qs[_0x1aed('0x42')](_[_0x1aed('0x5f')](_0x13e0f9[_0x1aed('0x41')],_0x439f51['filters']));if(_0x13e0f9[_0x1aed('0x41')]['filter']){_0x1113b0['where']=_[_0x1aed('0x4b')](_0x1113b0[_0x1aed('0x4a')],{'$or':_[_0x1aed('0x40')](_0x1113b0[_0x1aed('0x44')],function(_0x132ffd){var _0x684953={};_0x684953[_0x132ffd]={'$like':'%'+_0x13e0f9['query'][_0x1aed('0x4e')]+'%'};return _0x684953;})});}_0x1113b0=_[_0x1aed('0x4b')]({},_0x1113b0,_0x13e0f9[_0x1aed('0x4f')]);return _0x484313[_0x1aed('0x62')](_0x1113b0);}})['then'](function(_0x82fbe2){if(_0x82fbe2){_0x2978ff=_0x82fbe2['length'];if(!_0x13e0f9['query'][_0x1aed('0x60')](_0x1aed('0x47'))){_0x1113b0[_0x1aed('0x2e')]=qs[_0x1aed('0x2e')](_0x13e0f9[_0x1aed('0x41')][_0x1aed('0x2e')]);_0x1113b0['offset']=qs['offset'](_0x13e0f9[_0x1aed('0x41')]['offset']);}return _0x484313[_0x1aed('0x62')](_0x1113b0);}})[_0x1aed('0x20')](function(_0x65ee68){if(_0x65ee68){return _0x65ee68?{'count':_0x2978ff,'rows':_0x65ee68}:null;}})[_0x1aed('0x20')](respondWithResult(_0x1c2246,null))[_0x1aed('0x53')](handleError(_0x1c2246,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 0790df5..125d36e 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 _0x7971=['int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define'];(function(_0x4e5379,_0x421571){var _0xde535b=function(_0xa0df4f){while(--_0xa0df4f){_0x4e5379['push'](_0x4e5379['shift']());}};_0xde535b(++_0x421571);}(_0x7971,0x12d));var _0x1797=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x7971[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x1797('0x0'));var logger=require(_0x1797('0x1'))(_0x1797('0x2'));var moment=require(_0x1797('0x3'));var BPromise=require(_0x1797('0x4'));var rp=require(_0x1797('0x5'));var fs=require('fs');var path=require(_0x1797('0x6'));var rimraf=require(_0x1797('0x7'));var config=require('../../config/environment');var attributes=require(_0x1797('0x8'));module[_0x1797('0x9')]=function(_0x56dd42,_0x4bc203){return _0x56dd42[_0x1797('0xa')]('VtigerConfiguration',attributes,{'tableName':_0x1797('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x967f=['int_vtiger_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','VtigerConfiguration'];(function(_0x173721,_0x9803e5){var _0x2f8644=function(_0x7d96d2){while(--_0x7d96d2){_0x173721['push'](_0x173721['shift']());}};_0x2f8644(++_0x9803e5);}(_0x967f,0x1f0));var _0xf967=function(_0x279a4d,_0x345707){_0x279a4d=_0x279a4d-0x0;var _0x1a0cc5=_0x967f[_0x279a4d];return _0x1a0cc5;};'use strict';var _=require(_0xf967('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf967('0x1'));var moment=require(_0xf967('0x2'));var BPromise=require(_0xf967('0x3'));var rp=require(_0xf967('0x4'));var fs=require('fs');var path=require(_0xf967('0x5'));var rimraf=require(_0xf967('0x6'));var config=require('../../config/environment');var attributes=require(_0xf967('0x7'));module[_0xf967('0x8')]=function(_0x26c380,_0x5c7ffc){return _0x26c380['define'](_0xf967('0x9'),attributes,{'tableName':_0xf967('0xa'),'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 fb05080..b6234d3 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 _0xeba4=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x25d3bf,_0x3391c0){var _0xd75b39=function(_0x2d5d43){while(--_0x2d5d43){_0x25d3bf['push'](_0x25d3bf['shift']());}};_0xd75b39(++_0x3391c0);}(_0xeba4,0x18c));var _0x4eba=function(_0x42a134,_0x1ec016){_0x42a134=_0x42a134-0x0;var _0x4d4fde=_0xeba4[_0x42a134];return _0x4d4fde;};'use strict';var _=require(_0x4eba('0x0'));var util=require(_0x4eba('0x1'));var moment=require('moment');var BPromise=require(_0x4eba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4eba('0x3'));var db=require(_0x4eba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eba('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4eba('0x6'));var client=jayson[_0x4eba('0x7')][_0x4eba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b6c03,_0x22aaa1,_0xa20d57){return new BPromise(function(_0x6fc03a,_0x4c7d72){return client[_0x4eba('0x9')](_0x1b6c03,_0xa20d57)[_0x4eba('0xa')](function(_0x463a01){logger[_0x4eba('0xb')](_0x4eba('0xc'),_0x22aaa1,_0x4eba('0xd'));logger[_0x4eba('0xe')](_0x4eba('0xf'),_0x22aaa1,'request\x20sent',JSON[_0x4eba('0x10')](_0x463a01));if(_0x463a01[_0x4eba('0x11')]){if(_0x463a01['error'][_0x4eba('0x12')]===0x1f4){logger[_0x4eba('0x11')](_0x4eba('0xc'),_0x22aaa1,_0x463a01['error'][_0x4eba('0x13')]);return _0x4c7d72(_0x463a01[_0x4eba('0x11')][_0x4eba('0x13')]);}logger['error'](_0x4eba('0xc'),_0x22aaa1,_0x463a01[_0x4eba('0x11')]['message']);return _0x6fc03a(_0x463a01[_0x4eba('0x11')]['message']);}else{logger[_0x4eba('0xb')](_0x4eba('0xc'),_0x22aaa1,_0x4eba('0xd'));_0x6fc03a(_0x463a01[_0x4eba('0x14')][_0x4eba('0x13')]);}})[_0x4eba('0x15')](function(_0xed0313){logger[_0x4eba('0x11')](_0x4eba('0xc'),_0x22aaa1,_0xed0313);_0x4c7d72(_0xed0313);});});} \ No newline at end of file +var _0xb378=['rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xd3ae21,_0x40870f){var _0x20850b=function(_0x2d6860){while(--_0x2d6860){_0xd3ae21['push'](_0xd3ae21['shift']());}};_0x20850b(++_0x40870f);}(_0xb378,0x143));var _0x8b37=function(_0x434cf2,_0x4e49f8){_0x434cf2=_0x434cf2-0x0;var _0x41f6c7=_0xb378[_0x434cf2];return _0x41f6c7;};'use strict';var _=require('lodash');var util=require(_0x8b37('0x0'));var moment=require(_0x8b37('0x1'));var BPromise=require(_0x8b37('0x2'));var rs=require(_0x8b37('0x3'));var fs=require('fs');var Redis=require(_0x8b37('0x4'));var db=require(_0x8b37('0x5'))['db'];var utils=require(_0x8b37('0x6'));var logger=require('../../config/logger')(_0x8b37('0x7'));var config=require(_0x8b37('0x8'));var jayson=require(_0x8b37('0x9'));var client=jayson[_0x8b37('0xa')][_0x8b37('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f19f8,_0x31cce8,_0x23b870){return new BPromise(function(_0x18de25,_0x3548ab){return client[_0x8b37('0xc')](_0x1f19f8,_0x23b870)['then'](function(_0x5b7c4d){logger[_0x8b37('0xd')](_0x8b37('0xe'),_0x31cce8,_0x8b37('0xf'));logger[_0x8b37('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x31cce8,_0x8b37('0xf'),JSON['stringify'](_0x5b7c4d));if(_0x5b7c4d[_0x8b37('0x11')]){if(_0x5b7c4d[_0x8b37('0x11')][_0x8b37('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x31cce8,_0x5b7c4d[_0x8b37('0x11')][_0x8b37('0x13')]);return _0x3548ab(_0x5b7c4d[_0x8b37('0x11')][_0x8b37('0x13')]);}logger['error'](_0x8b37('0xe'),_0x31cce8,_0x5b7c4d[_0x8b37('0x11')][_0x8b37('0x13')]);return _0x18de25(_0x5b7c4d['error'][_0x8b37('0x13')]);}else{logger[_0x8b37('0xd')](_0x8b37('0xe'),_0x31cce8,'request\x20sent');_0x18de25(_0x5b7c4d[_0x8b37('0x14')][_0x8b37('0x13')]);}})[_0x8b37('0x15')](function(_0x169bc2){logger[_0x8b37('0x11')](_0x8b37('0xe'),_0x31cce8,_0x169bc2);_0x3548ab(_0x169bc2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 581ca7b..16d447b 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 _0x4c4a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x1e97a5,_0x37a2e9){var _0x42915d=function(_0x63f93b){while(--_0x63f93b){_0x1e97a5['push'](_0x1e97a5['shift']());}};_0x42915d(++_0x37a2e9);}(_0x4c4a,0xf6));var _0xa4c4=function(_0x54d5ba,_0x1f1ba9){_0x54d5ba=_0x54d5ba-0x0;var _0x6a592e=_0x4c4a[_0x54d5ba];return _0x6a592e;};'use strict';var multer=require('multer');var util=require(_0xa4c4('0x0'));var path=require('path');var timeout=require(_0xa4c4('0x1'));var express=require(_0xa4c4('0x2'));var router=express[_0xa4c4('0x3')]();var auth=require(_0xa4c4('0x4'));var interaction=require(_0xa4c4('0x5'));var config=require(_0xa4c4('0x6'));var controller=require(_0xa4c4('0x7'));router[_0xa4c4('0x8')]('/',auth[_0xa4c4('0x9')](),controller['index']);router[_0xa4c4('0x8')](_0xa4c4('0xa'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0xb')]);router[_0xa4c4('0xc')]('/',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0xd')]);router[_0xa4c4('0xe')](_0xa4c4('0xa'),auth[_0xa4c4('0x9')](),controller[_0xa4c4('0xf')]);router[_0xa4c4('0x10')]('/:id',auth[_0xa4c4('0x9')](),controller[_0xa4c4('0x11')]);module[_0xa4c4('0x12')]=router; \ No newline at end of file +var _0xf2b3=['index','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf2b3,0x182));var _0x3f2b=function(_0x18e5d9,_0x22e3d9){_0x18e5d9=_0x18e5d9-0x0;var _0x3e6e0c=_0xf2b3[_0x18e5d9];return _0x3e6e0c;};'use strict';var multer=require('multer');var util=require(_0x3f2b('0x0'));var path=require(_0x3f2b('0x1'));var timeout=require(_0x3f2b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3f2b('0x3'));var config=require(_0x3f2b('0x4'));var controller=require('./intVtigerField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3f2b('0x5')]);router[_0x3f2b('0x6')]('/:id',auth[_0x3f2b('0x7')](),controller[_0x3f2b('0x8')]);router[_0x3f2b('0x9')]('/',auth[_0x3f2b('0x7')](),controller[_0x3f2b('0xa')]);router[_0x3f2b('0xb')](_0x3f2b('0xc'),auth[_0x3f2b('0x7')](),controller[_0x3f2b('0xd')]);router[_0x3f2b('0xe')](_0x3f2b('0xc'),auth['isAuthenticated'](),controller[_0x3f2b('0xf')]);module[_0x3f2b('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 8903553..27d099c 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 _0xcef4=['customVariable','keyValue','string','STRING','ENUM','variable','sequelize'];(function(_0x1867e3,_0x589b2d){var _0x4b22aa=function(_0x36a685){while(--_0x36a685){_0x1867e3['push'](_0x1867e3['shift']());}};_0x4b22aa(++_0x589b2d);}(_0xcef4,0x1e9));var _0x4cef=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0xcef4[_0x166e96];return _0x553d73;};'use strict';var Sequelize=require(_0x4cef('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x4cef('0x1'),_0x4cef('0x2')),'defaultValue':_0x4cef('0x3')},'content':{'type':Sequelize[_0x4cef('0x4')]},'key':{'type':Sequelize[_0x4cef('0x4')]},'keyType':{'type':Sequelize[_0x4cef('0x5')](_0x4cef('0x3'),_0x4cef('0x6'),_0x4cef('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4cef('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4cef('0x4')]}}; \ No newline at end of file +var _0x29fb=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x4c3830,_0x529376){var _0x368604=function(_0x54d700){while(--_0x54d700){_0x4c3830['push'](_0x4c3830['shift']());}};_0x368604(++_0x529376);}(_0x29fb,0x13d));var _0xb29f=function(_0x5b73f6,_0x146997){_0x5b73f6=_0x5b73f6-0x0;var _0x2a2c05=_0x29fb[_0x5b73f6];return _0x2a2c05;};'use strict';var Sequelize=require(_0xb29f('0x0'));module['exports']={'type':{'type':Sequelize[_0xb29f('0x1')](_0xb29f('0x2'),_0xb29f('0x3'),_0xb29f('0x4'),_0xb29f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb29f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb29f('0x1')](_0xb29f('0x2'),_0xb29f('0x3'),_0xb29f('0x4'))},'keyContent':{'type':Sequelize[_0xb29f('0x6')]},'idField':{'type':Sequelize[_0xb29f('0x6')]},'nameField':{'type':Sequelize[_0xb29f('0x6')]},'customField':{'type':Sequelize[_0xb29f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb29f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index a56e9f4..9545ae2 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 _0x15ec=['keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params'];(function(_0x23867a,_0x2b39a4){var _0x591a7e=function(_0x1ec2ad){while(--_0x1ec2ad){_0x23867a['push'](_0x23867a['shift']());}};_0x591a7e(++_0x2b39a4);}(_0x15ec,0x16c));var _0xc15e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x15ec[_0x433a86];return _0x23000c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc15e('0x0'));var rimraf=require(_0xc15e('0x1'));var zipdir=require(_0xc15e('0x2'));var jsonpatch=require(_0xc15e('0x3'));var rp=require(_0xc15e('0x4'));var moment=require(_0xc15e('0x5'));var BPromise=require(_0xc15e('0x6'));var Mustache=require(_0xc15e('0x7'));var util=require(_0xc15e('0x8'));var path=require(_0xc15e('0x9'));var sox=require(_0xc15e('0xa'));var csv=require('to-csv');var ejs=require(_0xc15e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc15e('0xc'));var crypto=require(_0xc15e('0xd'));var jsforce=require(_0xc15e('0xe'));var deskjs=require(_0xc15e('0xf'));var toCsv=require(_0xc15e('0x10'));var querystring=require('querystring');var Papa=require(_0xc15e('0x11'));var Redis=require(_0xc15e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc15e('0x13'));var hardwareService=require(_0xc15e('0x14'));var logger=require(_0xc15e('0x15'))('api');var utils=require(_0xc15e('0x16'));var config=require(_0xc15e('0x17'));var db=require(_0xc15e('0x18'))['db'];function respondWithStatusCode(_0x5107ff,_0x19ab2f){_0x19ab2f=_0x19ab2f||0xcc;return function(_0x16da50){if(_0x16da50){return _0x5107ff[_0xc15e('0x19')](_0x19ab2f);}return _0x5107ff[_0xc15e('0x1a')](_0x19ab2f)['end']();};}function respondWithResult(_0x4b61e3,_0x407dd7){_0x407dd7=_0x407dd7||0xc8;return function(_0x4e7b9d){if(_0x4e7b9d){return _0x4b61e3[_0xc15e('0x1a')](_0x407dd7)[_0xc15e('0x1b')](_0x4e7b9d);}};}function respondWithFilteredResult(_0x1cc037,_0x4b98dd){return function(_0x7d4735){if(_0x7d4735){var _0x37bf50=_0x7d4735['count'],_0x1eb040=_0x4b98dd[_0xc15e('0x1c')],_0x3401bf=_0x4b98dd[_0xc15e('0x1c')]+_0x4b98dd[_0xc15e('0x1d')],_0x27dda5;if(_0x3401bf>=_0x37bf50){_0x3401bf=_0x37bf50;_0x27dda5=0xc8;}else{_0x27dda5=0xce;}_0x1cc037['status'](_0x27dda5);return _0x1cc037[_0xc15e('0x1e')](_0xc15e('0x1f'),_0x1eb040+'-'+_0x3401bf+'/'+_0x37bf50)['json'](_0x7d4735);}return null;};}function patchUpdates(_0x11d1ce){return function(_0x5083f2){try{jsonpatch['apply'](_0x5083f2,_0x11d1ce,!![]);}catch(_0x1dd2f2){return BPromise[_0xc15e('0x20')](_0x1dd2f2);}return _0x5083f2['save']();};}function saveUpdates(_0x31581d,_0x76c281){return function(_0x37d2d1){if(_0x37d2d1){return _0x37d2d1[_0xc15e('0x21')](_0x31581d)['then'](function(_0xe83efa){return _0xe83efa;});}return null;};}function removeEntity(_0x663f8,_0x2e4ef6){return function(_0xa2527){if(_0xa2527){return _0xa2527[_0xc15e('0x22')]()[_0xc15e('0x23')](function(){_0x663f8[_0xc15e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15beb7,_0x49e7ee){return function(_0x4e03c8){if(!_0x4e03c8){_0x15beb7[_0xc15e('0x19')](0x194);}return _0x4e03c8;};}function handleError(_0x55a424,_0x427a41){_0x427a41=_0x427a41||0x1f4;return function(_0x1c83b9){logger[_0xc15e('0x24')](_0x1c83b9[_0xc15e('0x25')]);if(_0x1c83b9[_0xc15e('0x26')]){delete _0x1c83b9[_0xc15e('0x26')];}_0x55a424[_0xc15e('0x1a')](_0x427a41)[_0xc15e('0x27')](_0x1c83b9);};}exports[_0xc15e('0x28')]=function(_0x58961c,_0x2c0377){var _0x5b04c6={},_0x29f6c7={},_0x152454={'count':0x0,'rows':[]};var _0x32010b=_[_0xc15e('0x29')](db[_0xc15e('0x2a')][_0xc15e('0x2b')],function(_0x39c470){return{'name':_0x39c470[_0xc15e('0x2c')],'type':_0x39c470['type'][_0xc15e('0x2d')]};});_0x29f6c7['model']=_['map'](_0x32010b,_0xc15e('0x26'));_0x29f6c7[_0xc15e('0x2e')]=_['keys'](_0x58961c[_0xc15e('0x2e')]);_0x29f6c7[_0xc15e('0x2f')]=_[_0xc15e('0x30')](_0x29f6c7[_0xc15e('0x31')],_0x29f6c7[_0xc15e('0x2e')]);_0x5b04c6['attributes']=_[_0xc15e('0x30')](_0x29f6c7[_0xc15e('0x31')],qs[_0xc15e('0x32')](_0x58961c['query'][_0xc15e('0x32')]));_0x5b04c6[_0xc15e('0x33')]=_0x5b04c6[_0xc15e('0x33')][_0xc15e('0x34')]?_0x5b04c6[_0xc15e('0x33')]:_0x29f6c7[_0xc15e('0x31')];if(!_0x58961c['query'][_0xc15e('0x35')]('nolimit')){_0x5b04c6[_0xc15e('0x1d')]=qs['limit'](_0x58961c[_0xc15e('0x2e')]['limit']);_0x5b04c6[_0xc15e('0x1c')]=qs[_0xc15e('0x1c')](_0x58961c['query'][_0xc15e('0x1c')]);}_0x5b04c6[_0xc15e('0x36')]=qs['sort'](_0x58961c[_0xc15e('0x2e')][_0xc15e('0x37')]);_0x5b04c6[_0xc15e('0x38')]=qs[_0xc15e('0x2f')](_[_0xc15e('0x39')](_0x58961c[_0xc15e('0x2e')],_0x29f6c7['filters']),_0x32010b);if(_0x58961c[_0xc15e('0x2e')]['filter']){_0x5b04c6[_0xc15e('0x38')]=_['merge'](_0x5b04c6[_0xc15e('0x38')],{'$or':_[_0xc15e('0x29')](_0x32010b,function(_0x26785b){if(_0x26785b[_0xc15e('0x3a')]!==_0xc15e('0x3b')){var _0x20f988={};_0x20f988[_0x26785b[_0xc15e('0x26')]]={'$like':'%'+_0x58961c[_0xc15e('0x2e')]['filter']+'%'};return _0x20f988;}})});}_0x5b04c6=_[_0xc15e('0x3c')]({},_0x5b04c6,_0x58961c[_0xc15e('0x3d')]);var _0x2d3087={'where':_0x5b04c6[_0xc15e('0x38')]};return db[_0xc15e('0x2a')][_0xc15e('0x3e')](_0x2d3087)[_0xc15e('0x23')](function(_0x1c432b){_0x152454[_0xc15e('0x3e')]=_0x1c432b;if(_0x58961c[_0xc15e('0x2e')][_0xc15e('0x3f')]){_0x5b04c6['include']=[{'all':!![]}];}return db[_0xc15e('0x2a')]['findAll'](_0x5b04c6);})[_0xc15e('0x23')](function(_0x349162){_0x152454[_0xc15e('0x40')]=_0x349162;return _0x152454;})[_0xc15e('0x23')](respondWithFilteredResult(_0x2c0377,_0x5b04c6))[_0xc15e('0x41')](handleError(_0x2c0377,null));};exports[_0xc15e('0x42')]=function(_0xb96a5e,_0x5205df){var _0x1b319d={'raw':!![],'where':{'id':_0xb96a5e[_0xc15e('0x43')]['id']}},_0x12ae24={};_0x12ae24[_0xc15e('0x31')]=_[_0xc15e('0x44')](db['VtigerField'][_0xc15e('0x2b')]);_0x12ae24[_0xc15e('0x2e')]=_['keys'](_0xb96a5e[_0xc15e('0x2e')]);_0x12ae24['filters']=_['intersection'](_0x12ae24[_0xc15e('0x31')],_0x12ae24[_0xc15e('0x2e')]);_0x1b319d[_0xc15e('0x33')]=_[_0xc15e('0x30')](_0x12ae24[_0xc15e('0x31')],qs[_0xc15e('0x32')](_0xb96a5e[_0xc15e('0x2e')][_0xc15e('0x32')]));_0x1b319d['attributes']=_0x1b319d[_0xc15e('0x33')][_0xc15e('0x34')]?_0x1b319d['attributes']:_0x12ae24[_0xc15e('0x31')];if(_0xb96a5e[_0xc15e('0x2e')][_0xc15e('0x3f')]){_0x1b319d['include']=[{'all':!![]}];}_0x1b319d=_[_0xc15e('0x3c')]({},_0x1b319d,_0xb96a5e[_0xc15e('0x3d')]);return db['VtigerField'][_0xc15e('0x45')](_0x1b319d)[_0xc15e('0x23')](handleEntityNotFound(_0x5205df,null))[_0xc15e('0x23')](respondWithResult(_0x5205df,null))[_0xc15e('0x41')](handleError(_0x5205df,null));};exports[_0xc15e('0x46')]=function(_0x4f22b7,_0x324bbd){return db[_0xc15e('0x2a')][_0xc15e('0x46')](_0x4f22b7['body'],{})[_0xc15e('0x23')](respondWithResult(_0x324bbd,0xc9))[_0xc15e('0x41')](handleError(_0x324bbd,null));};exports['update']=function(_0x3750c9,_0xf51063){if(_0x3750c9[_0xc15e('0x47')]['id']){delete _0x3750c9[_0xc15e('0x47')]['id'];}return db[_0xc15e('0x2a')]['find']({'where':{'id':_0x3750c9[_0xc15e('0x43')]['id']}})[_0xc15e('0x23')](handleEntityNotFound(_0xf51063,null))[_0xc15e('0x23')](saveUpdates(_0x3750c9[_0xc15e('0x47')],null))[_0xc15e('0x23')](respondWithResult(_0xf51063,null))[_0xc15e('0x41')](handleError(_0xf51063,null));};exports[_0xc15e('0x22')]=function(_0xeeda6,_0x5b752f){return db[_0xc15e('0x2a')][_0xc15e('0x45')]({'where':{'id':_0xeeda6[_0xc15e('0x43')]['id']}})['then'](handleEntityNotFound(_0x5b752f,null))[_0xc15e('0x23')](removeEntity(_0x5b752f,null))['catch'](handleError(_0x5b752f,null));}; \ No newline at end of file +var _0xe2c8=['create','body','html-pdf','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','VtigerField','fieldName','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find'];(function(_0x3512c3,_0x346843){var _0x3b2842=function(_0x49341b){while(--_0x49341b){_0x3512c3['push'](_0x3512c3['shift']());}};_0x3b2842(++_0x346843);}(_0xe2c8,0x8c));var _0x8e2c=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xe2c8[_0x13b02f];return _0x12e9a6;};'use strict';var pdf=require(_0x8e2c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8e2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e2c('0x2'));var BPromise=require(_0x8e2c('0x3'));var Mustache=require(_0x8e2c('0x4'));var util=require(_0x8e2c('0x5'));var path=require('path');var sox=require(_0x8e2c('0x6'));var csv=require(_0x8e2c('0x7'));var ejs=require(_0x8e2c('0x8'));var fs=require('fs');var _=require(_0x8e2c('0x9'));var squel=require(_0x8e2c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8e2c('0xb'));var toCsv=require(_0x8e2c('0x7'));var querystring=require(_0x8e2c('0xc'));var Papa=require('papaparse');var Redis=require(_0x8e2c('0xd'));var authService=require(_0x8e2c('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e2c('0xf'));var logger=require(_0x8e2c('0x10'))(_0x8e2c('0x11'));var utils=require(_0x8e2c('0x12'));var config=require(_0x8e2c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x827076,_0x37f8a8){_0x37f8a8=_0x37f8a8||0xcc;return function(_0x560748){if(_0x560748){return _0x827076[_0x8e2c('0x14')](_0x37f8a8);}return _0x827076[_0x8e2c('0x15')](_0x37f8a8)[_0x8e2c('0x16')]();};}function respondWithResult(_0x237b69,_0x3f7b0e){_0x3f7b0e=_0x3f7b0e||0xc8;return function(_0x3faf6f){if(_0x3faf6f){return _0x237b69[_0x8e2c('0x15')](_0x3f7b0e)[_0x8e2c('0x17')](_0x3faf6f);}};}function respondWithFilteredResult(_0x1f7711,_0x2556f0){return function(_0x318611){if(_0x318611){var _0x55dc72=_0x318611['count'],_0x133036=_0x2556f0['offset'],_0xeafae=_0x2556f0[_0x8e2c('0x18')]+_0x2556f0[_0x8e2c('0x19')],_0xbd1615;if(_0xeafae>=_0x55dc72){_0xeafae=_0x55dc72;_0xbd1615=0xc8;}else{_0xbd1615=0xce;}_0x1f7711[_0x8e2c('0x15')](_0xbd1615);return _0x1f7711['set'](_0x8e2c('0x1a'),_0x133036+'-'+_0xeafae+'/'+_0x55dc72)['json'](_0x318611);}return null;};}function patchUpdates(_0x38fbe4){return function(_0x3477e3){try{jsonpatch[_0x8e2c('0x1b')](_0x3477e3,_0x38fbe4,!![]);}catch(_0x42f299){return BPromise[_0x8e2c('0x1c')](_0x42f299);}return _0x3477e3[_0x8e2c('0x1d')]();};}function saveUpdates(_0x4e6398,_0x2130f1){return function(_0x1464b4){if(_0x1464b4){return _0x1464b4[_0x8e2c('0x1e')](_0x4e6398)[_0x8e2c('0x1f')](function(_0x35463d){return _0x35463d;});}return null;};}function removeEntity(_0x11b647,_0x5d2160){return function(_0x1c4537){if(_0x1c4537){return _0x1c4537[_0x8e2c('0x20')]()[_0x8e2c('0x1f')](function(){_0x11b647[_0x8e2c('0x15')](0xcc)[_0x8e2c('0x16')]();});}};}function handleEntityNotFound(_0x3606ad,_0x4c85d0){return function(_0x1aa6c2){if(!_0x1aa6c2){_0x3606ad[_0x8e2c('0x14')](0x194);}return _0x1aa6c2;};}function handleError(_0x4d9f62,_0x4e2f13){_0x4e2f13=_0x4e2f13||0x1f4;return function(_0x300cbd){logger[_0x8e2c('0x21')](_0x300cbd[_0x8e2c('0x22')]);if(_0x300cbd[_0x8e2c('0x23')]){delete _0x300cbd['name'];}_0x4d9f62[_0x8e2c('0x15')](_0x4e2f13)['send'](_0x300cbd);};}exports['index']=function(_0x4a9b50,_0x1847ba){var _0x5b1e87={},_0x22664c={},_0x1d29ff={'count':0x0,'rows':[]};var _0x507f93=_[_0x8e2c('0x24')](db[_0x8e2c('0x25')]['rawAttributes'],function(_0x319d5e){return{'name':_0x319d5e[_0x8e2c('0x26')],'type':_0x319d5e['type'][_0x8e2c('0x27')]};});_0x22664c[_0x8e2c('0x28')]=_[_0x8e2c('0x24')](_0x507f93,'name');_0x22664c['query']=_[_0x8e2c('0x29')](_0x4a9b50[_0x8e2c('0x2a')]);_0x22664c[_0x8e2c('0x2b')]=_['intersection'](_0x22664c['model'],_0x22664c[_0x8e2c('0x2a')]);_0x5b1e87['attributes']=_['intersection'](_0x22664c['model'],qs[_0x8e2c('0x2c')](_0x4a9b50[_0x8e2c('0x2a')][_0x8e2c('0x2c')]));_0x5b1e87['attributes']=_0x5b1e87[_0x8e2c('0x2d')][_0x8e2c('0x2e')]?_0x5b1e87[_0x8e2c('0x2d')]:_0x22664c[_0x8e2c('0x28')];if(!_0x4a9b50[_0x8e2c('0x2a')][_0x8e2c('0x2f')](_0x8e2c('0x30'))){_0x5b1e87[_0x8e2c('0x19')]=qs[_0x8e2c('0x19')](_0x4a9b50[_0x8e2c('0x2a')]['limit']);_0x5b1e87['offset']=qs[_0x8e2c('0x18')](_0x4a9b50[_0x8e2c('0x2a')]['offset']);}_0x5b1e87[_0x8e2c('0x31')]=qs['sort'](_0x4a9b50[_0x8e2c('0x2a')][_0x8e2c('0x32')]);_0x5b1e87[_0x8e2c('0x33')]=qs[_0x8e2c('0x2b')](_[_0x8e2c('0x34')](_0x4a9b50[_0x8e2c('0x2a')],_0x22664c[_0x8e2c('0x2b')]),_0x507f93);if(_0x4a9b50[_0x8e2c('0x2a')][_0x8e2c('0x35')]){_0x5b1e87[_0x8e2c('0x33')]=_[_0x8e2c('0x36')](_0x5b1e87[_0x8e2c('0x33')],{'$or':_[_0x8e2c('0x24')](_0x507f93,function(_0x1bb9ce){if(_0x1bb9ce[_0x8e2c('0x37')]!=='VIRTUAL'){var _0x4e38ae={};_0x4e38ae[_0x1bb9ce[_0x8e2c('0x23')]]={'$like':'%'+_0x4a9b50[_0x8e2c('0x2a')][_0x8e2c('0x35')]+'%'};return _0x4e38ae;}})});}_0x5b1e87=_[_0x8e2c('0x36')]({},_0x5b1e87,_0x4a9b50[_0x8e2c('0x38')]);var _0x2121b3={'where':_0x5b1e87[_0x8e2c('0x33')]};return db[_0x8e2c('0x25')][_0x8e2c('0x39')](_0x2121b3)['then'](function(_0x2a3896){_0x1d29ff[_0x8e2c('0x39')]=_0x2a3896;if(_0x4a9b50[_0x8e2c('0x2a')][_0x8e2c('0x3a')]){_0x5b1e87[_0x8e2c('0x3b')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x5b1e87);})['then'](function(_0x570edd){_0x1d29ff[_0x8e2c('0x3c')]=_0x570edd;return _0x1d29ff;})[_0x8e2c('0x1f')](respondWithFilteredResult(_0x1847ba,_0x5b1e87))[_0x8e2c('0x3d')](handleError(_0x1847ba,null));};exports[_0x8e2c('0x3e')]=function(_0x307cf6,_0x434446){var _0x8469b1={'raw':!![],'where':{'id':_0x307cf6[_0x8e2c('0x3f')]['id']}},_0x22ebf9={};_0x22ebf9[_0x8e2c('0x28')]=_[_0x8e2c('0x29')](db[_0x8e2c('0x25')][_0x8e2c('0x40')]);_0x22ebf9['query']=_[_0x8e2c('0x29')](_0x307cf6[_0x8e2c('0x2a')]);_0x22ebf9[_0x8e2c('0x2b')]=_[_0x8e2c('0x41')](_0x22ebf9[_0x8e2c('0x28')],_0x22ebf9[_0x8e2c('0x2a')]);_0x8469b1['attributes']=_[_0x8e2c('0x41')](_0x22ebf9['model'],qs[_0x8e2c('0x2c')](_0x307cf6[_0x8e2c('0x2a')]['fields']));_0x8469b1[_0x8e2c('0x2d')]=_0x8469b1[_0x8e2c('0x2d')][_0x8e2c('0x2e')]?_0x8469b1[_0x8e2c('0x2d')]:_0x22ebf9['model'];if(_0x307cf6[_0x8e2c('0x2a')][_0x8e2c('0x3a')]){_0x8469b1[_0x8e2c('0x3b')]=[{'all':!![]}];}_0x8469b1=_[_0x8e2c('0x36')]({},_0x8469b1,_0x307cf6[_0x8e2c('0x38')]);return db['VtigerField'][_0x8e2c('0x42')](_0x8469b1)['then'](handleEntityNotFound(_0x434446,null))['then'](respondWithResult(_0x434446,null))[_0x8e2c('0x3d')](handleError(_0x434446,null));};exports[_0x8e2c('0x43')]=function(_0x3f09dd,_0x111a0d){return db['VtigerField'][_0x8e2c('0x43')](_0x3f09dd[_0x8e2c('0x44')],{})[_0x8e2c('0x1f')](respondWithResult(_0x111a0d,0xc9))[_0x8e2c('0x3d')](handleError(_0x111a0d,null));};exports[_0x8e2c('0x1e')]=function(_0x5c8227,_0x140d96){if(_0x5c8227['body']['id']){delete _0x5c8227[_0x8e2c('0x44')]['id'];}return db[_0x8e2c('0x25')]['find']({'where':{'id':_0x5c8227[_0x8e2c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x140d96,null))[_0x8e2c('0x1f')](saveUpdates(_0x5c8227[_0x8e2c('0x44')],null))[_0x8e2c('0x1f')](respondWithResult(_0x140d96,null))[_0x8e2c('0x3d')](handleError(_0x140d96,null));};exports[_0x8e2c('0x20')]=function(_0x583ae5,_0x42870c){return db[_0x8e2c('0x25')][_0x8e2c('0x42')]({'where':{'id':_0x583ae5[_0x8e2c('0x3f')]['id']}})[_0x8e2c('0x1f')](handleEntityNotFound(_0x42870c,null))[_0x8e2c('0x1f')](removeEntity(_0x42870c,null))['catch'](handleError(_0x42870c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ae987ed..e0b93d1 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','VtigerField','idField','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports'];(function(_0x14384f,_0x1797fe){var _0x409b8e=function(_0xb4e11c){while(--_0xb4e11c){_0x14384f['push'](_0x14384f['shift']());}};_0x409b8e(++_0x1797fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x0a9e('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['VtigerField','int_vtiger_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','define'];(function(_0x111976,_0x1370f9){var _0x57982c=function(_0x3b30ad){while(--_0x3b30ad){_0x111976['push'](_0x111976['shift']());}};_0x57982c(++_0x1370f9);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'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':[{'name':'vtiger_unique_index','fields':[_0x49c4('0xa'),_0x49c4('0xb')],'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 4398eff..59032ab 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 _0xf12a=['info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xf12a,0x8e));var _0xaf12=function(_0x4883cb,_0x3df63c){_0x4883cb=_0x4883cb-0x0;var _0x33aad7=_0xf12a[_0x4883cb];return _0x33aad7;};'use strict';var _=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var moment=require(_0xaf12('0x2'));var BPromise=require(_0xaf12('0x3'));var rs=require(_0xaf12('0x4'));var fs=require('fs');var Redis=require(_0xaf12('0x5'));var db=require(_0xaf12('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf12('0x8'));var client=jayson['client'][_0xaf12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x581819,_0x38389d,_0x418c64){return new BPromise(function(_0x3b6626,_0xff1952){return client[_0xaf12('0xa')](_0x581819,_0x418c64)[_0xaf12('0xb')](function(_0x3d733d){logger[_0xaf12('0xc')]('VtigerField,\x20%s,\x20%s',_0x38389d,_0xaf12('0xd'));logger['debug'](_0xaf12('0xe'),_0x38389d,'request\x20sent',JSON[_0xaf12('0xf')](_0x3d733d));if(_0x3d733d['error']){if(_0x3d733d['error'][_0xaf12('0x10')]===0x1f4){logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0xff1952(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0x3b6626(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}else{logger[_0xaf12('0xc')](_0xaf12('0x12'),_0x38389d,_0xaf12('0xd'));_0x3b6626(_0x3d733d[_0xaf12('0x14')]['message']);}})[_0xaf12('0x15')](function(_0x31a420){logger['error']('VtigerField,\x20%s,\x20%s',_0x38389d,_0x31a420);_0xff1952(_0x31a420);});});} \ No newline at end of file +var _0x20d8=['stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x2916fe,_0x4b5b34){var _0x474a73=function(_0x10b287){while(--_0x10b287){_0x2916fe['push'](_0x2916fe['shift']());}};_0x474a73(++_0x4b5b34);}(_0x20d8,0xee));var _0x820d=function(_0x5f4b29,_0x5b1df1){_0x5f4b29=_0x5f4b29-0x0;var _0x3059c2=_0x20d8[_0x5f4b29];return _0x3059c2;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var moment=require(_0x820d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x820d('0x3'));var db=require(_0x820d('0x4'))['db'];var utils=require(_0x820d('0x5'));var logger=require(_0x820d('0x6'))(_0x820d('0x7'));var config=require('../../config/environment');var jayson=require(_0x820d('0x8'));var client=jayson[_0x820d('0x9')][_0x820d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e23e3,_0x435a84,_0xa2751d){return new BPromise(function(_0x3b084c,_0x485bde){return client[_0x820d('0xb')](_0x4e23e3,_0xa2751d)['then'](function(_0x45fdd7){logger['info']('VtigerField,\x20%s,\x20%s',_0x435a84,_0x820d('0xc'));logger['debug'](_0x820d('0xd'),_0x435a84,_0x820d('0xc'),JSON[_0x820d('0xe')](_0x45fdd7));if(_0x45fdd7['error']){if(_0x45fdd7[_0x820d('0xf')][_0x820d('0x10')]===0x1f4){logger['error'](_0x820d('0x11'),_0x435a84,_0x45fdd7['error'][_0x820d('0x12')]);return _0x485bde(_0x45fdd7[_0x820d('0xf')][_0x820d('0x12')]);}logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x45fdd7[_0x820d('0xf')]['message']);return _0x3b084c(_0x45fdd7['error'][_0x820d('0x12')]);}else{logger['info'](_0x820d('0x11'),_0x435a84,_0x820d('0xc'));_0x3b084c(_0x45fdd7[_0x820d('0x13')]['message']);}})[_0x820d('0x14')](function(_0x3466c1){logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x3466c1);_0x485bde(_0x3466c1);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index bd4e2bb..ac07c84 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 _0x4572=['create','addConfiguration','/:id','update','destroy','util','path','connect-timeout','Router','../../components/auth/service','./intZendeskAccount.controller','isAuthenticated','index','show','/:id/configurations','getConfigurations','get','/:id/fields','getFields','post'];(function(_0x164ef5,_0xba6238){var _0x2d60c5=function(_0x34deca){while(--_0x34deca){_0x164ef5['push'](_0x164ef5['shift']());}};_0x2d60c5(++_0xba6238);}(_0x4572,0xe1));var _0x2457=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0x4572[_0x71cd05];return _0x59c9e7;};'use strict';var multer=require('multer');var util=require(_0x2457('0x0'));var path=require(_0x2457('0x1'));var timeout=require(_0x2457('0x2'));var express=require('express');var router=express[_0x2457('0x3')]();var auth=require(_0x2457('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2457('0x5'));router['get']('/',auth[_0x2457('0x6')](),controller[_0x2457('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2457('0x8')]);router['get'](_0x2457('0x9'),auth[_0x2457('0x6')](),controller[_0x2457('0xa')]);router[_0x2457('0xb')](_0x2457('0xc'),auth[_0x2457('0x6')](),controller[_0x2457('0xd')]);router[_0x2457('0xe')]('/',auth['isAuthenticated'](),controller[_0x2457('0xf')]);router[_0x2457('0xe')](_0x2457('0x9'),auth[_0x2457('0x6')](),controller[_0x2457('0x10')]);router['put'](_0x2457('0x11'),auth[_0x2457('0x6')](),controller[_0x2457('0x12')]);router['delete'](_0x2457('0x11'),auth[_0x2457('0x6')](),controller[_0x2457('0x13')]);module['exports']=router; \ No newline at end of file +var _0x518f=['isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x4f24f6,_0x25e034){var _0x4f63f9=function(_0x104e13){while(--_0x104e13){_0x4f24f6['push'](_0x4f24f6['shift']());}};_0x4f63f9(++_0x25e034);}(_0x518f,0x1f1));var _0xf518=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x518f[_0x65c903];return _0x23e1d7;};'use strict';var multer=require(_0xf518('0x0'));var util=require('util');var path=require(_0xf518('0x1'));var timeout=require(_0xf518('0x2'));var express=require(_0xf518('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf518('0x4'));var config=require(_0xf518('0x5'));var controller=require('./intZendeskAccount.controller');router[_0xf518('0x6')]('/',auth[_0xf518('0x7')](),controller[_0xf518('0x8')]);router[_0xf518('0x6')]('/:id',auth[_0xf518('0x7')](),controller[_0xf518('0x9')]);router[_0xf518('0x6')](_0xf518('0xa'),auth[_0xf518('0x7')](),controller['getConfigurations']);router['get'](_0xf518('0xb'),auth[_0xf518('0x7')](),controller[_0xf518('0xc')]);router[_0xf518('0xd')]('/',auth[_0xf518('0x7')](),controller[_0xf518('0xe')]);router[_0xf518('0xd')](_0xf518('0xa'),auth['isAuthenticated'](),controller[_0xf518('0xf')]);router[_0xf518('0x10')](_0xf518('0x11'),auth[_0xf518('0x7')](),controller['update']);router[_0xf518('0x12')](_0xf518('0x11'),auth[_0xf518('0x7')](),controller[_0xf518('0x13')]);module[_0xf518('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 43cac86..2c1e9d0 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 _0xb7cf=['integrationTab','sequelize','exports','STRING','username','ENUM','password','newTab'];(function(_0x1aa4ae,_0x199535){var _0x1671bf=function(_0x419312){while(--_0x419312){_0x1aa4ae['push'](_0x1aa4ae['shift']());}};_0x1671bf(++_0x199535);}(_0xb7cf,0x151));var _0xfb7c=function(_0x89100d,_0x59c43d){_0x89100d=_0x89100d-0x0;var _0x15974a=_0xb7cf[_0x89100d];return _0x15974a;};'use strict';var Sequelize=require(_0xfb7c('0x0'));module[_0xfb7c('0x1')]={'name':{'type':Sequelize[_0xfb7c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfb7c('0x2')],'unique':_0xfb7c('0x3')},'password':{'type':Sequelize[_0xfb7c('0x2')]},'token':{'type':Sequelize[_0xfb7c('0x2')]},'remoteUri':{'type':Sequelize[_0xfb7c('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xfb7c('0x4')](_0xfb7c('0x5'),'token'),'defaultValue':_0xfb7c('0x5')},'serverUrl':{'type':Sequelize[_0xfb7c('0x2')]},'type':{'type':Sequelize[_0xfb7c('0x4')]('integrationTab',_0xfb7c('0x6')),'defaultValue':_0xfb7c('0x7')}}; \ No newline at end of file +var _0x8836=['exports','STRING','username','remoteUri','ENUM','token','password','integrationTab','newTab','sequelize'];(function(_0x38a616,_0x4cfea9){var _0x46e2e6=function(_0xb082c3){while(--_0xb082c3){_0x38a616['push'](_0x38a616['shift']());}};_0x46e2e6(++_0x4cfea9);}(_0x8836,0x199));var _0x6883=function(_0x2b6473,_0xaa5ff3){_0x2b6473=_0x2b6473-0x0;var _0x4e7348=_0x8836[_0x2b6473];return _0x4e7348;};'use strict';var Sequelize=require(_0x6883('0x0'));module[_0x6883('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6883('0x2')],'unique':_0x6883('0x3')},'password':{'type':Sequelize[_0x6883('0x2')]},'token':{'type':Sequelize[_0x6883('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x6883('0x4')},'authType':{'type':Sequelize[_0x6883('0x5')]('password',_0x6883('0x6')),'defaultValue':_0x6883('0x7')},'serverUrl':{'type':Sequelize[_0x6883('0x2')]},'type':{'type':Sequelize[_0x6883('0x5')](_0x6883('0x8'),_0x6883('0x9')),'defaultValue':_0x6883('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c25eedd..e2a7858 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 _0xd340=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','jayson/promise','client','http','Sequelize','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','destroy','stack','name','send','rawAttributes','fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','rows','show','params','length','includeAll','include','find','create','update','body','getConfigurations','findOne','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','username','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','password','headers','%s:%s','toString','base64','token','Basic\x20%s','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','ticket_fields','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','html-pdf','eml-format','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x460400,_0x475f20){var _0x50b500=function(_0x125b1b){while(--_0x125b1b){_0x460400['push'](_0x460400['shift']());}};_0x50b500(++_0x475f20);}(_0xd340,0x1e5));var _0x0d34=function(_0x2d5f85,_0x48f855){_0x2d5f85=_0x2d5f85-0x0;var _0x3d7eb8=_0xd340[_0x2d5f85];return _0x3d7eb8;};'use strict';var pdf=require(_0x0d34('0x0'));var emlformat=require(_0x0d34('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d34('0x2'));var moment=require('moment');var BPromise=require(_0x0d34('0x3'));var Mustache=require('mustache');var util=require(_0x0d34('0x4'));var path=require(_0x0d34('0x5'));var sox=require(_0x0d34('0x6'));var csv=require(_0x0d34('0x7'));var ejs=require(_0x0d34('0x8'));var fs=require('fs');var _=require(_0x0d34('0x9'));var squel=require(_0x0d34('0xa'));var crypto=require(_0x0d34('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0d34('0xc'));var toCsv=require(_0x0d34('0x7'));var querystring=require(_0x0d34('0xd'));var Papa=require(_0x0d34('0xe'));var Redis=require(_0x0d34('0xf'));var authService=require(_0x0d34('0x10'));var qs=require(_0x0d34('0x11'));var as=require(_0x0d34('0x12'));var hardwareService=require(_0x0d34('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0d34('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0d34('0x15'));var client=jayson[_0x0d34('0x16')][_0x0d34('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4d48f8,_0x116101,_0x152ba6){if(_0x152ba6){var _0x4524f5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4524f5['test'](_0x116101)){return _0x4d48f8;}else{throw new db[(_0x0d34('0x18'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4d48f8;}}function respondWithRpcPromise(_0x151543,_0x314d8d,_0x22fe53,_0x14730e){return new BPromise(function(_0x355d68,_0x4519da){var _0x130788=_0x14730e||client;return _0x130788[_0x0d34('0x19')](_0x151543,_0x22fe53)[_0x0d34('0x1a')](function(_0xd51701){logger[_0x0d34('0x1b')](_0x0d34('0x1c'),_0x314d8d,_0x0d34('0x1d'));logger['debug'](_0x0d34('0x1e'),_0x314d8d,_0x0d34('0x1d'),JSON[_0x0d34('0x1f')](_0xd51701));if(_0xd51701[_0x0d34('0x20')]){if(_0xd51701['error'][_0x0d34('0x21')]===0x1f4){logger['error'](_0x0d34('0x1c'),_0x314d8d,_0xd51701[_0x0d34('0x20')][_0x0d34('0x22')]);return _0x4519da(_0xd51701[_0x0d34('0x20')][_0x0d34('0x22')]);}logger[_0x0d34('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x314d8d,_0xd51701['error'][_0x0d34('0x22')]);return _0x355d68(_0xd51701['error'][_0x0d34('0x22')]);}else{logger[_0x0d34('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x314d8d,_0x0d34('0x1d'));_0x355d68(_0xd51701[_0x0d34('0x23')][_0x0d34('0x22')]);}})[_0x0d34('0x24')](function(_0x1f412c){logger['error'](_0x0d34('0x1c'),_0x314d8d,_0x1f412c);_0x4519da(_0x1f412c);});});}function respondWithStatusCode(_0x52e2d9,_0xcc4975){_0xcc4975=_0xcc4975||0xcc;return function(_0xaca19e){if(_0xaca19e){return _0x52e2d9[_0x0d34('0x25')](_0xcc4975);}return _0x52e2d9[_0x0d34('0x26')](_0xcc4975)[_0x0d34('0x27')]();};}function respondWithResult(_0x177a14,_0x23cbf2){_0x23cbf2=_0x23cbf2||0xc8;return function(_0x17c9e2){if(_0x17c9e2){return _0x177a14[_0x0d34('0x26')](_0x23cbf2)[_0x0d34('0x28')](_0x17c9e2);}};}function respondWithFilteredResult(_0x4925ad,_0x1baae6){return function(_0x2a670a){if(_0x2a670a){var _0x2b8e4e=_0x2a670a[_0x0d34('0x29')],_0x350066=_0x1baae6['offset'],_0x1e69b2=_0x1baae6['offset']+_0x1baae6[_0x0d34('0x2a')],_0x27961c;if(_0x1e69b2>=_0x2b8e4e){_0x1e69b2=_0x2b8e4e;_0x27961c=0xc8;}else{_0x27961c=0xce;}_0x4925ad[_0x0d34('0x26')](_0x27961c);return _0x4925ad[_0x0d34('0x2b')](_0x0d34('0x2c'),_0x350066+'-'+_0x1e69b2+'/'+_0x2b8e4e)['json'](_0x2a670a);}return null;};}function patchUpdates(_0x186b35){return function(_0x168662){try{jsonpatch[_0x0d34('0x2d')](_0x168662,_0x186b35,!![]);}catch(_0x1b3922){return BPromise[_0x0d34('0x2e')](_0x1b3922);}return _0x168662['save']();};}function saveUpdates(_0x34ece9,_0x2b63de){return function(_0x3dcabd){if(_0x3dcabd){return _0x3dcabd['update'](_0x34ece9)[_0x0d34('0x1a')](function(_0x213ddc){return _0x213ddc;});}return null;};}function removeEntity(_0x57699b,_0x117d94){return function(_0x5d4665){if(_0x5d4665){return _0x5d4665[_0x0d34('0x2f')]()[_0x0d34('0x1a')](function(){_0x57699b[_0x0d34('0x26')](0xcc)[_0x0d34('0x27')]();});}};}function handleEntityNotFound(_0x312f89,_0x4682bf){return function(_0x382b83){if(!_0x382b83){_0x312f89['sendStatus'](0x194);}return _0x382b83;};}function handleError(_0x47c1be,_0x98388a){_0x98388a=_0x98388a||0x1f4;return function(_0x5e819c){logger[_0x0d34('0x20')](_0x5e819c[_0x0d34('0x30')]);if(_0x5e819c[_0x0d34('0x31')]){delete _0x5e819c[_0x0d34('0x31')];}_0x47c1be[_0x0d34('0x26')](_0x98388a)[_0x0d34('0x32')](_0x5e819c);};}exports['index']=function(_0x5bac20,_0x3bd61a){var _0x4b990d={},_0x1820b2={},_0x2aba89={'count':0x0,'rows':[]};var _0x565500=_['map'](db['ZendeskAccount'][_0x0d34('0x33')],function(_0x25f2fa){return{'name':_0x25f2fa[_0x0d34('0x34')],'type':_0x25f2fa[_0x0d34('0x35')]['key']};});_0x1820b2['model']=_[_0x0d34('0x36')](_0x565500,'name');_0x1820b2['query']=_[_0x0d34('0x37')](_0x5bac20[_0x0d34('0x38')]);_0x1820b2[_0x0d34('0x39')]=_['intersection'](_0x1820b2[_0x0d34('0x3a')],_0x1820b2[_0x0d34('0x38')]);_0x4b990d[_0x0d34('0x3b')]=_[_0x0d34('0x3c')](_0x1820b2['model'],qs[_0x0d34('0x3d')](_0x5bac20['query'][_0x0d34('0x3d')]));_0x4b990d[_0x0d34('0x3b')]=_0x4b990d[_0x0d34('0x3b')]['length']?_0x4b990d['attributes']:_0x1820b2[_0x0d34('0x3a')];if(!_0x5bac20['query'][_0x0d34('0x3e')]('nolimit')){_0x4b990d[_0x0d34('0x2a')]=qs[_0x0d34('0x2a')](_0x5bac20[_0x0d34('0x38')]['limit']);_0x4b990d[_0x0d34('0x3f')]=qs[_0x0d34('0x3f')](_0x5bac20['query'][_0x0d34('0x3f')]);}_0x4b990d[_0x0d34('0x40')]=qs[_0x0d34('0x41')](_0x5bac20[_0x0d34('0x38')][_0x0d34('0x41')]);_0x4b990d[_0x0d34('0x42')]=qs['filters'](_[_0x0d34('0x43')](_0x5bac20[_0x0d34('0x38')],_0x1820b2[_0x0d34('0x39')]),_0x565500);if(_0x5bac20[_0x0d34('0x38')][_0x0d34('0x44')]){_0x4b990d[_0x0d34('0x42')]=_[_0x0d34('0x45')](_0x4b990d['where'],{'$or':_['map'](_0x565500,function(_0x5eeaf0){if(_0x5eeaf0[_0x0d34('0x35')]!==_0x0d34('0x46')){var _0x415260={};_0x415260[_0x5eeaf0['name']]={'$like':'%'+_0x5bac20[_0x0d34('0x38')][_0x0d34('0x44')]+'%'};return _0x415260;}})});}_0x4b990d=_[_0x0d34('0x45')]({},_0x4b990d,_0x5bac20[_0x0d34('0x47')]);var _0x4c4ce5={'where':_0x4b990d[_0x0d34('0x42')]};return db[_0x0d34('0x48')][_0x0d34('0x29')](_0x4c4ce5)[_0x0d34('0x1a')](function(_0x22d156){_0x2aba89[_0x0d34('0x29')]=_0x22d156;if(_0x5bac20[_0x0d34('0x38')]['includeAll']){_0x4b990d['include']=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4b990d);})[_0x0d34('0x1a')](function(_0x4df514){_0x2aba89[_0x0d34('0x49')]=_0x4df514;return _0x2aba89;})[_0x0d34('0x1a')](respondWithFilteredResult(_0x3bd61a,_0x4b990d))[_0x0d34('0x24')](handleError(_0x3bd61a,null));};exports[_0x0d34('0x4a')]=function(_0x59b993,_0x1eda30){var _0xc0bfe7={'raw':![],'where':{'id':_0x59b993[_0x0d34('0x4b')]['id']}},_0x2a303e={};_0x2a303e[_0x0d34('0x3a')]=_[_0x0d34('0x37')](db[_0x0d34('0x48')][_0x0d34('0x33')]);_0x2a303e[_0x0d34('0x38')]=_[_0x0d34('0x37')](_0x59b993[_0x0d34('0x38')]);_0x2a303e['filters']=_['intersection'](_0x2a303e[_0x0d34('0x3a')],_0x2a303e[_0x0d34('0x38')]);_0xc0bfe7[_0x0d34('0x3b')]=_[_0x0d34('0x3c')](_0x2a303e['model'],qs[_0x0d34('0x3d')](_0x59b993[_0x0d34('0x38')][_0x0d34('0x3d')]));_0xc0bfe7[_0x0d34('0x3b')]=_0xc0bfe7['attributes'][_0x0d34('0x4c')]?_0xc0bfe7['attributes']:_0x2a303e['model'];if(_0x59b993[_0x0d34('0x38')][_0x0d34('0x4d')]){_0xc0bfe7[_0x0d34('0x4e')]=[{'all':!![]}];}_0xc0bfe7=_['merge']({},_0xc0bfe7,_0x59b993[_0x0d34('0x47')]);return db[_0x0d34('0x48')][_0x0d34('0x4f')](_0xc0bfe7)[_0x0d34('0x1a')](handleEntityNotFound(_0x1eda30,null))[_0x0d34('0x1a')](respondWithResult(_0x1eda30,null))[_0x0d34('0x24')](handleError(_0x1eda30,null));};exports['create']=function(_0x26a28b,_0x2df0ff){return db[_0x0d34('0x48')][_0x0d34('0x50')](_0x26a28b['body'],{})[_0x0d34('0x1a')](respondWithResult(_0x2df0ff,0xc9))[_0x0d34('0x24')](handleError(_0x2df0ff,null));};exports[_0x0d34('0x51')]=function(_0x41c1b9,_0x29d9a6){if(_0x41c1b9[_0x0d34('0x52')]['id']){delete _0x41c1b9['body']['id'];}return db[_0x0d34('0x48')][_0x0d34('0x4f')]({'where':{'id':_0x41c1b9[_0x0d34('0x4b')]['id']}})[_0x0d34('0x1a')](handleEntityNotFound(_0x29d9a6,null))[_0x0d34('0x1a')](saveUpdates(_0x41c1b9[_0x0d34('0x52')],null))[_0x0d34('0x1a')](respondWithResult(_0x29d9a6,null))['catch'](handleError(_0x29d9a6,null));};exports[_0x0d34('0x2f')]=function(_0x396cd5,_0x8c8fc7){return db[_0x0d34('0x48')][_0x0d34('0x4f')]({'where':{'id':_0x396cd5[_0x0d34('0x4b')]['id']}})[_0x0d34('0x1a')](handleEntityNotFound(_0x8c8fc7,null))['then'](removeEntity(_0x8c8fc7,null))[_0x0d34('0x24')](handleError(_0x8c8fc7,null));};exports[_0x0d34('0x53')]=function(_0x5d0420,_0x4a6b69,_0x7647c6){var _0x2ec04c={};var _0x4af660={};var _0x353c08;var _0x53007f;return db[_0x0d34('0x48')][_0x0d34('0x54')]({'where':{'id':_0x5d0420[_0x0d34('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a6b69,null))[_0x0d34('0x1a')](function(_0xa9f944){if(_0xa9f944){_0x353c08=_0xa9f944;_0x4af660[_0x0d34('0x3a')]=_[_0x0d34('0x37')](db['ZendeskConfiguration'][_0x0d34('0x33')]);_0x4af660[_0x0d34('0x38')]=_[_0x0d34('0x37')](_0x5d0420[_0x0d34('0x38')]);_0x4af660[_0x0d34('0x39')]=_[_0x0d34('0x3c')](_0x4af660[_0x0d34('0x3a')],_0x4af660[_0x0d34('0x38')]);_0x2ec04c['attributes']=_[_0x0d34('0x3c')](_0x4af660[_0x0d34('0x3a')],qs[_0x0d34('0x3d')](_0x5d0420[_0x0d34('0x38')][_0x0d34('0x3d')]));_0x2ec04c[_0x0d34('0x3b')]=_0x2ec04c[_0x0d34('0x3b')]['length']?_0x2ec04c['attributes']:_0x4af660[_0x0d34('0x3a')];_0x2ec04c[_0x0d34('0x40')]=qs['sort'](_0x5d0420['query'][_0x0d34('0x41')]);_0x2ec04c[_0x0d34('0x42')]=qs[_0x0d34('0x39')](_[_0x0d34('0x43')](_0x5d0420[_0x0d34('0x38')],_0x4af660['filters']));if(_0x5d0420[_0x0d34('0x38')][_0x0d34('0x44')]){_0x2ec04c[_0x0d34('0x42')]=_[_0x0d34('0x45')](_0x2ec04c['where'],{'$or':_[_0x0d34('0x36')](_0x2ec04c[_0x0d34('0x3b')],function(_0x4b9eca){var _0xf976f5={};_0xf976f5[_0x4b9eca]={'$like':'%'+_0x5d0420[_0x0d34('0x38')][_0x0d34('0x44')]+'%'};return _0xf976f5;})});}_0x2ec04c=_['merge']({},_0x2ec04c,_0x5d0420[_0x0d34('0x47')]);return _0x353c08['getConfigurations'](_0x2ec04c);}})[_0x0d34('0x1a')](function(_0x249f5c){if(_0x249f5c){_0x53007f=_0x249f5c[_0x0d34('0x4c')];if(!_0x5d0420[_0x0d34('0x38')][_0x0d34('0x3e')](_0x0d34('0x55'))){_0x2ec04c['limit']=qs[_0x0d34('0x2a')](_0x5d0420[_0x0d34('0x38')][_0x0d34('0x2a')]);_0x2ec04c[_0x0d34('0x3f')]=qs['offset'](_0x5d0420[_0x0d34('0x38')][_0x0d34('0x3f')]);}return _0x353c08[_0x0d34('0x53')](_0x2ec04c);}})['then'](function(_0x3e6bc5){if(_0x3e6bc5){return _0x3e6bc5?{'count':_0x53007f,'rows':_0x3e6bc5}:null;}})[_0x0d34('0x1a')](respondWithResult(_0x4a6b69,null))[_0x0d34('0x24')](handleError(_0x4a6b69,null));};exports[_0x0d34('0x56')]=function(_0x11bb18,_0x633e05,_0x1d84b5){if(_0x11bb18[_0x0d34('0x52')]['id']){delete _0x11bb18['body']['id'];}return db[_0x0d34('0x48')]['findOne']({'where':{'id':_0x11bb18[_0x0d34('0x4b')]['id']}})[_0x0d34('0x1a')](handleEntityNotFound(_0x633e05,null))[_0x0d34('0x1a')](function(_0x133996){if(_0x133996){_0x11bb18['body']['AccountId']=_0x133996['id'];_0x11bb18[_0x0d34('0x52')][_0x0d34('0x57')]=integrations[_0x0d34('0x58')](_0x11bb18[_0x0d34('0x52')][_0x0d34('0x59')],_0x11bb18[_0x0d34('0x52')][_0x0d34('0x35')]);_0x11bb18[_0x0d34('0x52')]['Descriptions']=integrations[_0x0d34('0x5a')](_0x11bb18['body'][_0x0d34('0x59')],_0x11bb18['body'][_0x0d34('0x35')]);return db['ZendeskConfiguration']['create'](_0x11bb18[_0x0d34('0x52')],{'include':[{'model':db['ZendeskField'],'as':_0x0d34('0x57')},{'model':db[_0x0d34('0x5b')],'as':_0x0d34('0x5c')}]});}return null;})[_0x0d34('0x1a')](respondWithResult(_0x633e05,null))[_0x0d34('0x24')](handleError(_0x633e05,null));};exports['getFields']=function(_0x550b1a,_0x3d9e66,_0x143d33){var _0x2dc9bf='';return db[_0x0d34('0x48')][_0x0d34('0x54')]({'where':{'id':_0x550b1a[_0x0d34('0x4b')]['id']},'attributes':['id',_0x0d34('0x5d'),'password','token',_0x0d34('0x5e'),_0x0d34('0x5f')]})['then'](handleEntityNotFound(_0x3d9e66,null))[_0x0d34('0x1a')](function(_0x4daab0){if(_0x4daab0){_0x2dc9bf=_0x4daab0[_0x0d34('0x5f')];var _0x35c007=_0x2dc9bf[_0x0d34('0x60')](-0x1);if(_0x35c007==='/'){_0x2dc9bf=_0x2dc9bf[_0x0d34('0x61')](0x0,_0x2dc9bf[_0x0d34('0x62')](_0x35c007));}var _0x33707e={'method':'GET','uri':util[_0x0d34('0x63')](_0x0d34('0x64'),_0x2dc9bf,'ticket_fields'),'json':!![]};switch(_0x4daab0[_0x0d34('0x5e')]){case _0x0d34('0x65'):_0x33707e[_0x0d34('0x66')]={'Authorization':util[_0x0d34('0x63')]('Basic\x20%s',new Buffer(util[_0x0d34('0x63')](_0x0d34('0x67'),_0x4daab0[_0x0d34('0x5d')],_0x4daab0[_0x0d34('0x65')]))[_0x0d34('0x68')](_0x0d34('0x69')))};break;case _0x0d34('0x6a'):_0x33707e[_0x0d34('0x66')]={'Authorization':util[_0x0d34('0x63')](_0x0d34('0x6b'),new Buffer(util[_0x0d34('0x63')](_0x0d34('0x6c'),_0x4daab0[_0x0d34('0x5d')],_0x4daab0['token']))[_0x0d34('0x68')]('base64'))};break;default:throw new db[(_0x0d34('0x18'))][(_0x0d34('0x6d'))](_0x0d34('0x6e'));}return rp(_0x33707e);}})[_0x0d34('0x1a')](function(_0x527c08){if(_0x527c08){var _0xcbdbe5=[_0x0d34('0x6f'),_0x0d34('0x70'),_0x0d34('0x71'),'assignee'];_['remove'](_0x527c08[_0x0d34('0x72')],function(_0x5763bc){return _0xcbdbe5[_0x0d34('0x73')](_0x5763bc[_0x0d34('0x35')]);});return{'count':_0x527c08[_0x0d34('0x72')]['length'],'rows':_[_0x0d34('0x36')](_0x527c08[_0x0d34('0x72')],function(_0xf5106f){return{'id':_0xf5106f['id'],'name':_0xf5106f[_0x0d34('0x74')]>0x7?_0xf5106f[_0x0d34('0x75')]:_0xf5106f['type'],'custom':_0xf5106f[_0x0d34('0x74')]>0x7?!![]:![],'options':_0xf5106f[_0x0d34('0x76')]?_0xf5106f[_0x0d34('0x76')]:_0xf5106f[_0x0d34('0x77')]?_0xf5106f['custom_field_options']:[]};})};}})[_0x0d34('0x1a')](respondWithResult(_0x3d9e66,null))[_0x0d34('0x24')](function(_0x35db4e){var _0x54cbce=_0x550b1a[_0x0d34('0x38')]['test']?0x1f4:_0x35db4e[_0x0d34('0x78')]||0x1f4;logger[_0x0d34('0x20')](_0x0d34('0x79'),_0x0d34('0x7a'),_0x54cbce,JSON[_0x0d34('0x1f')](_0x35db4e));delete _0x35db4e[_0x0d34('0x31')];if(_0x54cbce===0x191){_0x54cbce=0x190;}_0x3d9e66[_0x0d34('0x26')](_0x54cbce)[_0x0d34('0x32')](_0x550b1a[_0x0d34('0x38')][_0x0d34('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x35db4e[_0x0d34('0x78')]}:_0x35db4e);});}; \ No newline at end of file +var _0x263b=['findOne','AccountId','getSubjects','channel','getDescriptions','Subjects','ZendeskField','Descriptions','getFields','username','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','password','toString','base64','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','title','position','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','ZendeskAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','fields','attributes','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','update','params','ZendeskConfiguration','length','getConfigurations','hasOwnProperty','nolimit','addConfiguration'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0x263b,0x12b));var _0xb263=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x263b[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0xb263('0x0'));var emlformat=require(_0xb263('0x1'));var rimraf=require(_0xb263('0x2'));var zipdir=require(_0xb263('0x3'));var jsonpatch=require(_0xb263('0x4'));var rp=require('request-promise');var moment=require(_0xb263('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb263('0x6'));var sox=require(_0xb263('0x7'));var csv=require(_0xb263('0x8'));var ejs=require(_0xb263('0x9'));var fs=require('fs');var _=require(_0xb263('0xa'));var squel=require(_0xb263('0xb'));var crypto=require(_0xb263('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb263('0xd'));var toCsv=require(_0xb263('0x8'));var querystring=require('querystring');var Papa=require(_0xb263('0xe'));var Redis=require(_0xb263('0xf'));var authService=require(_0xb263('0x10'));var qs=require(_0xb263('0x11'));var as=require(_0xb263('0x12'));var hardwareService=require(_0xb263('0x13'));var logger=require(_0xb263('0x14'))('api');var utils=require(_0xb263('0x15'));var config=require(_0xb263('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb263('0x17'));var client=jayson[_0xb263('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x2af8be,_0x3fcdb6,_0x3567e9){if(_0x3567e9){var _0x3f6f24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f6f24['test'](_0x3fcdb6)){return _0x2af8be;}else{throw new db[(_0xb263('0x19'))][(_0xb263('0x1a'))](_0xb263('0x1b'));}}else{return _0x2af8be;}}function respondWithRpcPromise(_0x13f63c,_0x38ef28,_0x253872,_0x48210c){return new BPromise(function(_0x369677,_0x3f4888){var _0x561a50=_0x48210c||client;return _0x561a50[_0xb263('0x1c')](_0x13f63c,_0x253872)[_0xb263('0x1d')](function(_0x48caa9){logger[_0xb263('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x38ef28,_0xb263('0x1f'));logger[_0xb263('0x20')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x38ef28,_0xb263('0x1f'),JSON['stringify'](_0x48caa9));if(_0x48caa9['error']){if(_0x48caa9[_0xb263('0x21')]['code']===0x1f4){logger[_0xb263('0x21')](_0xb263('0x22'),_0x38ef28,_0x48caa9['error']['message']);return _0x3f4888(_0x48caa9[_0xb263('0x21')][_0xb263('0x23')]);}logger['error'](_0xb263('0x22'),_0x38ef28,_0x48caa9['error'][_0xb263('0x23')]);return _0x369677(_0x48caa9[_0xb263('0x21')]['message']);}else{logger['info'](_0xb263('0x22'),_0x38ef28,_0xb263('0x1f'));_0x369677(_0x48caa9[_0xb263('0x24')][_0xb263('0x23')]);}})['catch'](function(_0x144d3a){logger[_0xb263('0x21')](_0xb263('0x22'),_0x38ef28,_0x144d3a);_0x3f4888(_0x144d3a);});});}function respondWithStatusCode(_0x48df4d,_0x4d3ccd){_0x4d3ccd=_0x4d3ccd||0xcc;return function(_0x46b705){if(_0x46b705){return _0x48df4d[_0xb263('0x25')](_0x4d3ccd);}return _0x48df4d['status'](_0x4d3ccd)[_0xb263('0x26')]();};}function respondWithResult(_0x20e8f6,_0x2aadbe){_0x2aadbe=_0x2aadbe||0xc8;return function(_0x2e93b8){if(_0x2e93b8){return _0x20e8f6[_0xb263('0x27')](_0x2aadbe)[_0xb263('0x28')](_0x2e93b8);}};}function respondWithFilteredResult(_0x56907e,_0x507c06){return function(_0x2f55d1){if(_0x2f55d1){var _0x4d00ef=_0x2f55d1['count'],_0x59e04a=_0x507c06[_0xb263('0x29')],_0x141bc1=_0x507c06[_0xb263('0x29')]+_0x507c06[_0xb263('0x2a')],_0x506246;if(_0x141bc1>=_0x4d00ef){_0x141bc1=_0x4d00ef;_0x506246=0xc8;}else{_0x506246=0xce;}_0x56907e[_0xb263('0x27')](_0x506246);return _0x56907e[_0xb263('0x2b')](_0xb263('0x2c'),_0x59e04a+'-'+_0x141bc1+'/'+_0x4d00ef)[_0xb263('0x28')](_0x2f55d1);}return null;};}function patchUpdates(_0x411bea){return function(_0x314863){try{jsonpatch[_0xb263('0x2d')](_0x314863,_0x411bea,!![]);}catch(_0x276368){return BPromise[_0xb263('0x2e')](_0x276368);}return _0x314863[_0xb263('0x2f')]();};}function saveUpdates(_0x1fd8d0,_0x2690d2){return function(_0xbfecda){if(_0xbfecda){return _0xbfecda['update'](_0x1fd8d0)['then'](function(_0x54f3d1){return _0x54f3d1;});}return null;};}function removeEntity(_0x258312,_0x19ac96){return function(_0x3215c8){if(_0x3215c8){return _0x3215c8[_0xb263('0x30')]()[_0xb263('0x1d')](function(){_0x258312['status'](0xcc)[_0xb263('0x26')]();});}};}function handleEntityNotFound(_0x3e3ac6,_0x248c63){return function(_0x531c2e){if(!_0x531c2e){_0x3e3ac6[_0xb263('0x25')](0x194);}return _0x531c2e;};}function handleError(_0x452f02,_0x537ab5){_0x537ab5=_0x537ab5||0x1f4;return function(_0x270162){logger[_0xb263('0x21')](_0x270162[_0xb263('0x31')]);if(_0x270162[_0xb263('0x32')]){delete _0x270162[_0xb263('0x32')];}_0x452f02[_0xb263('0x27')](_0x537ab5)[_0xb263('0x33')](_0x270162);};}exports[_0xb263('0x34')]=function(_0x391a47,_0x243ae0){var _0x16d68c={},_0xac8784={},_0x45c2ee={'count':0x0,'rows':[]};var _0x59891a=_[_0xb263('0x35')](db[_0xb263('0x36')][_0xb263('0x37')],function(_0x4c9fa9){return{'name':_0x4c9fa9[_0xb263('0x38')],'type':_0x4c9fa9[_0xb263('0x39')][_0xb263('0x3a')]};});_0xac8784[_0xb263('0x3b')]=_[_0xb263('0x35')](_0x59891a,_0xb263('0x32'));_0xac8784[_0xb263('0x3c')]=_['keys'](_0x391a47[_0xb263('0x3c')]);_0xac8784['filters']=_['intersection'](_0xac8784[_0xb263('0x3b')],_0xac8784['query']);_0x16d68c['attributes']=_['intersection'](_0xac8784[_0xb263('0x3b')],qs['fields'](_0x391a47[_0xb263('0x3c')][_0xb263('0x3d')]));_0x16d68c['attributes']=_0x16d68c[_0xb263('0x3e')]['length']?_0x16d68c[_0xb263('0x3e')]:_0xac8784[_0xb263('0x3b')];if(!_0x391a47['query']['hasOwnProperty']('nolimit')){_0x16d68c[_0xb263('0x2a')]=qs[_0xb263('0x2a')](_0x391a47['query'][_0xb263('0x2a')]);_0x16d68c[_0xb263('0x29')]=qs['offset'](_0x391a47['query'][_0xb263('0x29')]);}_0x16d68c[_0xb263('0x3f')]=qs[_0xb263('0x40')](_0x391a47[_0xb263('0x3c')][_0xb263('0x40')]);_0x16d68c[_0xb263('0x41')]=qs[_0xb263('0x42')](_[_0xb263('0x43')](_0x391a47[_0xb263('0x3c')],_0xac8784[_0xb263('0x42')]),_0x59891a);if(_0x391a47[_0xb263('0x3c')][_0xb263('0x44')]){_0x16d68c[_0xb263('0x41')]=_[_0xb263('0x45')](_0x16d68c['where'],{'$or':_[_0xb263('0x35')](_0x59891a,function(_0x1b7fa6){if(_0x1b7fa6[_0xb263('0x39')]!=='VIRTUAL'){var _0x28e531={};_0x28e531[_0x1b7fa6[_0xb263('0x32')]]={'$like':'%'+_0x391a47['query'][_0xb263('0x44')]+'%'};return _0x28e531;}})});}_0x16d68c=_[_0xb263('0x45')]({},_0x16d68c,_0x391a47[_0xb263('0x46')]);var _0x5d6916={'where':_0x16d68c[_0xb263('0x41')]};return db[_0xb263('0x36')][_0xb263('0x47')](_0x5d6916)[_0xb263('0x1d')](function(_0x4a9f4c){_0x45c2ee[_0xb263('0x47')]=_0x4a9f4c;if(_0x391a47[_0xb263('0x3c')][_0xb263('0x48')]){_0x16d68c[_0xb263('0x49')]=[{'all':!![]}];}return db[_0xb263('0x36')][_0xb263('0x4a')](_0x16d68c);})[_0xb263('0x1d')](function(_0x4c1713){_0x45c2ee[_0xb263('0x4b')]=_0x4c1713;return _0x45c2ee;})[_0xb263('0x1d')](respondWithFilteredResult(_0x243ae0,_0x16d68c))[_0xb263('0x4c')](handleError(_0x243ae0,null));};exports[_0xb263('0x4d')]=function(_0x410948,_0x177229){var _0x58a13f={'raw':![],'where':{'id':_0x410948['params']['id']}},_0x3bc61c={};_0x3bc61c[_0xb263('0x3b')]=_[_0xb263('0x4e')](db[_0xb263('0x36')][_0xb263('0x37')]);_0x3bc61c[_0xb263('0x3c')]=_[_0xb263('0x4e')](_0x410948[_0xb263('0x3c')]);_0x3bc61c['filters']=_[_0xb263('0x4f')](_0x3bc61c[_0xb263('0x3b')],_0x3bc61c[_0xb263('0x3c')]);_0x58a13f[_0xb263('0x3e')]=_['intersection'](_0x3bc61c[_0xb263('0x3b')],qs[_0xb263('0x3d')](_0x410948[_0xb263('0x3c')][_0xb263('0x3d')]));_0x58a13f['attributes']=_0x58a13f[_0xb263('0x3e')]['length']?_0x58a13f[_0xb263('0x3e')]:_0x3bc61c[_0xb263('0x3b')];if(_0x410948[_0xb263('0x3c')][_0xb263('0x48')]){_0x58a13f[_0xb263('0x49')]=[{'all':!![]}];}_0x58a13f=_['merge']({},_0x58a13f,_0x410948['options']);return db[_0xb263('0x36')][_0xb263('0x50')](_0x58a13f)[_0xb263('0x1d')](handleEntityNotFound(_0x177229,null))[_0xb263('0x1d')](respondWithResult(_0x177229,null))[_0xb263('0x4c')](handleError(_0x177229,null));};exports['create']=function(_0x4a99f7,_0x5e48a3){return db[_0xb263('0x36')][_0xb263('0x51')](_0x4a99f7[_0xb263('0x52')],{})[_0xb263('0x1d')](respondWithResult(_0x5e48a3,0xc9))[_0xb263('0x4c')](handleError(_0x5e48a3,null));};exports[_0xb263('0x53')]=function(_0x5802f0,_0x57cd01){if(_0x5802f0[_0xb263('0x52')]['id']){delete _0x5802f0[_0xb263('0x52')]['id'];}return db[_0xb263('0x36')][_0xb263('0x50')]({'where':{'id':_0x5802f0[_0xb263('0x54')]['id']}})[_0xb263('0x1d')](handleEntityNotFound(_0x57cd01,null))[_0xb263('0x1d')](saveUpdates(_0x5802f0[_0xb263('0x52')],null))[_0xb263('0x1d')](respondWithResult(_0x57cd01,null))[_0xb263('0x4c')](handleError(_0x57cd01,null));};exports[_0xb263('0x30')]=function(_0x25d169,_0x41b36e){return db['ZendeskAccount'][_0xb263('0x50')]({'where':{'id':_0x25d169[_0xb263('0x54')]['id']}})[_0xb263('0x1d')](handleEntityNotFound(_0x41b36e,null))[_0xb263('0x1d')](removeEntity(_0x41b36e,null))[_0xb263('0x4c')](handleError(_0x41b36e,null));};exports['getConfigurations']=function(_0x18ac53,_0x369cf1,_0x1b9ccb){var _0x13099b={};var _0x1ec46f={};var _0x32cc05;var _0x1aaa52;return db[_0xb263('0x36')]['findOne']({'where':{'id':_0x18ac53['params']['id']}})['then'](handleEntityNotFound(_0x369cf1,null))[_0xb263('0x1d')](function(_0xd72407){if(_0xd72407){_0x32cc05=_0xd72407;_0x1ec46f['model']=_['keys'](db[_0xb263('0x55')][_0xb263('0x37')]);_0x1ec46f[_0xb263('0x3c')]=_[_0xb263('0x4e')](_0x18ac53[_0xb263('0x3c')]);_0x1ec46f['filters']=_[_0xb263('0x4f')](_0x1ec46f['model'],_0x1ec46f[_0xb263('0x3c')]);_0x13099b[_0xb263('0x3e')]=_[_0xb263('0x4f')](_0x1ec46f[_0xb263('0x3b')],qs[_0xb263('0x3d')](_0x18ac53[_0xb263('0x3c')]['fields']));_0x13099b[_0xb263('0x3e')]=_0x13099b['attributes'][_0xb263('0x56')]?_0x13099b[_0xb263('0x3e')]:_0x1ec46f[_0xb263('0x3b')];_0x13099b[_0xb263('0x3f')]=qs[_0xb263('0x40')](_0x18ac53[_0xb263('0x3c')]['sort']);_0x13099b[_0xb263('0x41')]=qs[_0xb263('0x42')](_['pick'](_0x18ac53[_0xb263('0x3c')],_0x1ec46f[_0xb263('0x42')]));if(_0x18ac53[_0xb263('0x3c')][_0xb263('0x44')]){_0x13099b[_0xb263('0x41')]=_['merge'](_0x13099b[_0xb263('0x41')],{'$or':_['map'](_0x13099b[_0xb263('0x3e')],function(_0x5d2e66){var _0x258f8e={};_0x258f8e[_0x5d2e66]={'$like':'%'+_0x18ac53[_0xb263('0x3c')][_0xb263('0x44')]+'%'};return _0x258f8e;})});}_0x13099b=_[_0xb263('0x45')]({},_0x13099b,_0x18ac53[_0xb263('0x46')]);return _0x32cc05[_0xb263('0x57')](_0x13099b);}})[_0xb263('0x1d')](function(_0x1a678a){if(_0x1a678a){_0x1aaa52=_0x1a678a['length'];if(!_0x18ac53[_0xb263('0x3c')][_0xb263('0x58')](_0xb263('0x59'))){_0x13099b[_0xb263('0x2a')]=qs['limit'](_0x18ac53['query'][_0xb263('0x2a')]);_0x13099b[_0xb263('0x29')]=qs[_0xb263('0x29')](_0x18ac53[_0xb263('0x3c')]['offset']);}return _0x32cc05[_0xb263('0x57')](_0x13099b);}})[_0xb263('0x1d')](function(_0x2c892d){if(_0x2c892d){return _0x2c892d?{'count':_0x1aaa52,'rows':_0x2c892d}:null;}})['then'](respondWithResult(_0x369cf1,null))[_0xb263('0x4c')](handleError(_0x369cf1,null));};exports[_0xb263('0x5a')]=function(_0x36631d,_0x2e4596,_0x3bc595){if(_0x36631d['body']['id']){delete _0x36631d[_0xb263('0x52')]['id'];}return db[_0xb263('0x36')][_0xb263('0x5b')]({'where':{'id':_0x36631d[_0xb263('0x54')]['id']}})[_0xb263('0x1d')](handleEntityNotFound(_0x2e4596,null))[_0xb263('0x1d')](function(_0xaa739d){if(_0xaa739d){_0x36631d[_0xb263('0x52')][_0xb263('0x5c')]=_0xaa739d['id'];_0x36631d['body']['Subjects']=integrations[_0xb263('0x5d')](_0x36631d[_0xb263('0x52')][_0xb263('0x5e')],_0x36631d[_0xb263('0x52')][_0xb263('0x39')]);_0x36631d[_0xb263('0x52')]['Descriptions']=integrations[_0xb263('0x5f')](_0x36631d[_0xb263('0x52')][_0xb263('0x5e')],_0x36631d[_0xb263('0x52')]['type']);return db[_0xb263('0x55')][_0xb263('0x51')](_0x36631d[_0xb263('0x52')],{'include':[{'model':db['ZendeskField'],'as':_0xb263('0x60')},{'model':db[_0xb263('0x61')],'as':_0xb263('0x62')}]});}return null;})['then'](respondWithResult(_0x2e4596,null))[_0xb263('0x4c')](handleError(_0x2e4596,null));};exports[_0xb263('0x63')]=function(_0x129fb1,_0x3c1312,_0x1ba275){var _0x43763c='';return db[_0xb263('0x36')][_0xb263('0x5b')]({'where':{'id':_0x129fb1[_0xb263('0x54')]['id']},'attributes':['id',_0xb263('0x64'),'password',_0xb263('0x65'),_0xb263('0x66'),'remoteUri']})[_0xb263('0x1d')](handleEntityNotFound(_0x3c1312,null))['then'](function(_0x5a43c5){if(_0x5a43c5){_0x43763c=_0x5a43c5[_0xb263('0x67')];var _0x4daccd=_0x43763c[_0xb263('0x68')](-0x1);if(_0x4daccd==='/'){_0x43763c=_0x43763c['substring'](0x0,_0x43763c[_0xb263('0x69')](_0x4daccd));}var _0x23c133={'method':_0xb263('0x6a'),'uri':util[_0xb263('0x6b')](_0xb263('0x6c'),_0x43763c,_0xb263('0x6d')),'json':!![]};switch(_0x5a43c5[_0xb263('0x66')]){case'password':_0x23c133[_0xb263('0x6e')]={'Authorization':util['format'](_0xb263('0x6f'),new Buffer(util[_0xb263('0x6b')](_0xb263('0x70'),_0x5a43c5['username'],_0x5a43c5[_0xb263('0x71')]))[_0xb263('0x72')](_0xb263('0x73')))};break;case _0xb263('0x65'):_0x23c133['headers']={'Authorization':util[_0xb263('0x6b')](_0xb263('0x6f'),new Buffer(util[_0xb263('0x6b')]('%s/token:%s',_0x5a43c5['username'],_0x5a43c5[_0xb263('0x65')]))['toString']('base64'))};break;default:throw new db['Sequelize'][(_0xb263('0x1a'))](_0xb263('0x74'));}return rp(_0x23c133);}})['then'](function(_0x4b0d12){if(_0x4b0d12){var _0x2b3145=[_0xb263('0x75'),_0xb263('0x76'),'group',_0xb263('0x77')];_[_0xb263('0x78')](_0x4b0d12[_0xb263('0x6d')],function(_0x514212){return _0x2b3145[_0xb263('0x79')](_0x514212[_0xb263('0x39')]);});return{'count':_0x4b0d12[_0xb263('0x6d')][_0xb263('0x56')],'rows':_['map'](_0x4b0d12[_0xb263('0x6d')],function(_0x3d483f){return{'id':_0x3d483f['id'],'name':_0x3d483f['position']>0x7?_0x3d483f[_0xb263('0x7a')]:_0x3d483f[_0xb263('0x39')],'custom':_0x3d483f[_0xb263('0x7b')]>0x7?!![]:![],'options':_0x3d483f['system_field_options']?_0x3d483f['system_field_options']:_0x3d483f[_0xb263('0x7c')]?_0x3d483f[_0xb263('0x7c')]:[]};})};}})[_0xb263('0x1d')](respondWithResult(_0x3c1312,null))[_0xb263('0x4c')](function(_0x359e99){var _0x3b26a9=_0x129fb1[_0xb263('0x3c')]['test']?0x1f4:_0x359e99['statusCode']||0x1f4;logger[_0xb263('0x21')](_0xb263('0x7d'),_0xb263('0x63'),_0x3b26a9,JSON[_0xb263('0x7e')](_0x359e99));delete _0x359e99['name'];if(_0x3b26a9===0x191){_0x3b26a9=0x190;}_0x3c1312[_0xb263('0x27')](_0x3b26a9)[_0xb263('0x33')](_0x129fb1['query'][_0xb263('0x7f')]?{'message':_0xb263('0x80'),'statusCode':_0x359e99[_0xb263('0x81')]}:_0x359e99);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5863963..c5f0472 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 _0xadaa=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x45ded2,_0x395fbc){var _0x42875b=function(_0x3becd3){while(--_0x3becd3){_0x45ded2['push'](_0x45ded2['shift']());}};_0x42875b(++_0x395fbc);}(_0xadaa,0xcb));var _0xaada=function(_0x17c910,_0x107c4e){_0x17c910=_0x17c910-0x0;var _0x1541ba=_0xadaa[_0x17c910];return _0x1541ba;};'use strict';var _=require(_0xaada('0x0'));var util=require('util');var logger=require(_0xaada('0x1'))('api');var moment=require(_0xaada('0x2'));var BPromise=require(_0xaada('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaada('0x4'));var rimraf=require(_0xaada('0x5'));var config=require(_0xaada('0x6'));var attributes=require(_0xaada('0x7'));var integrations=require(_0xaada('0x8'));module[_0xaada('0x9')]=function(_0x57d981,_0x34a25a){return _0x57d981['define']('ZendeskAccount',attributes,{'tableName':_0xaada('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5073=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x18ce1b,_0x205cf4){var _0x2c4454=function(_0x396b38){while(--_0x396b38){_0x18ce1b['push'](_0x18ce1b['shift']());}};_0x2c4454(++_0x205cf4);}(_0x5073,0x191));var _0x3507=function(_0x24dfd2,_0x504fac){_0x24dfd2=_0x24dfd2-0x0;var _0x3abda1=_0x5073[_0x24dfd2];return _0x3abda1;};'use strict';var _=require(_0x3507('0x0'));var util=require(_0x3507('0x1'));var logger=require(_0x3507('0x2'))(_0x3507('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3507('0x4'));var fs=require('fs');var path=require(_0x3507('0x5'));var rimraf=require(_0x3507('0x6'));var config=require(_0x3507('0x7'));var attributes=require(_0x3507('0x8'));var integrations=require(_0x3507('0x9'));module['exports']=function(_0x53233b,_0x47a66f){return _0x53233b[_0x3507('0xa')](_0x3507('0xb'),attributes,{'tableName':_0x3507('0xc'),'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 9ab09b5..34f88e3 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0xcb91[_0x1a809b];return _0x5d90e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0xcb91[_0x3ed054];return _0x16dd95;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d0464bf..d5b39e8 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 _0xc74f=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','delete','destroy','exports','multer'];(function(_0x235751,_0x5d628a){var _0x336647=function(_0x214bbb){while(--_0x214bbb){_0x235751['push'](_0x235751['shift']());}};_0x336647(++_0x5d628a);}(_0xc74f,0x81));var _0xfc74=function(_0x3dd5da,_0x4304cf){_0x3dd5da=_0x3dd5da-0x0;var _0x5d81de=_0xc74f[_0x3dd5da];return _0x5d81de;};'use strict';var multer=require(_0xfc74('0x0'));var util=require('util');var path=require(_0xfc74('0x1'));var timeout=require(_0xfc74('0x2'));var express=require('express');var router=express[_0xfc74('0x3')]();var auth=require(_0xfc74('0x4'));var interaction=require(_0xfc74('0x5'));var config=require(_0xfc74('0x6'));var controller=require(_0xfc74('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfc74('0x8')](_0xfc74('0x9'),auth['isAuthenticated'](),controller[_0xfc74('0xa')]);router['get'](_0xfc74('0xb'),auth[_0xfc74('0xc')](),controller[_0xfc74('0xd')]);router[_0xfc74('0x8')](_0xfc74('0xe'),auth[_0xfc74('0xc')](),controller[_0xfc74('0xf')]);router[_0xfc74('0x8')](_0xfc74('0x10'),auth['isAuthenticated'](),controller[_0xfc74('0x11')]);router['get'](_0xfc74('0x12'),auth[_0xfc74('0xc')](),controller['getTags']);router[_0xfc74('0x13')]('/',auth[_0xfc74('0xc')](),controller[_0xfc74('0x14')]);router[_0xfc74('0x13')](_0xfc74('0x12'),auth[_0xfc74('0xc')](),controller['setTags']);router[_0xfc74('0x15')]('/:id',auth[_0xfc74('0xc')](),controller[_0xfc74('0x16')]);router[_0xfc74('0x17')]('/:id',auth[_0xfc74('0xc')](),controller[_0xfc74('0x18')]);module[_0xfc74('0x19')]=router; \ No newline at end of file +var _0xf528=['put','update','delete','/:id','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','getTags','post','create','setTags'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf528,0x78));var _0x8f52=function(_0x8284bc,_0x1a4b6c){_0x8284bc=_0x8284bc-0x0;var _0x49e865=_0xf528[_0x8284bc];return _0x49e865;};'use strict';var multer=require('multer');var util=require(_0x8f52('0x0'));var path=require('path');var timeout=require(_0x8f52('0x1'));var express=require('express');var router=express[_0x8f52('0x2')]();var auth=require(_0x8f52('0x3'));var interaction=require(_0x8f52('0x4'));var config=require(_0x8f52('0x5'));var controller=require('./intZendeskConfiguration.controller');router[_0x8f52('0x6')]('/',auth[_0x8f52('0x7')](),controller[_0x8f52('0x8')]);router[_0x8f52('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x8f52('0x9')]);router[_0x8f52('0x6')](_0x8f52('0xa'),auth['isAuthenticated'](),controller[_0x8f52('0xb')]);router[_0x8f52('0x6')](_0x8f52('0xc'),auth[_0x8f52('0x7')](),controller[_0x8f52('0xd')]);router['get']('/:id/descriptions',auth[_0x8f52('0x7')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x8f52('0xe')]);router[_0x8f52('0xf')]('/',auth[_0x8f52('0x7')](),controller[_0x8f52('0x10')]);router[_0x8f52('0xf')]('/:id/tags',auth[_0x8f52('0x7')](),controller[_0x8f52('0x11')]);router[_0x8f52('0x12')]('/:id',auth[_0x8f52('0x7')](),controller[_0x8f52('0x13')]);router[_0x8f52('0x14')](_0x8f52('0x15'),auth['isAuthenticated'](),controller[_0x8f52('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a08034d..8c7326e 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 _0x9d06=['STRING','sequelize'];(function(_0x32a89e,_0x4ef68c){var _0x1669aa=function(_0x1bd53c){while(--_0x1bd53c){_0x32a89e['push'](_0x32a89e['shift']());}};_0x1669aa(++_0x4ef68c);}(_0x9d06,0x183));var _0x69d0=function(_0x191cf1,_0x113bc2){_0x191cf1=_0x191cf1-0x0;var _0x70fe3c=_0x9d06[_0x191cf1];return _0x70fe3c;};'use strict';var Sequelize=require(_0x69d0('0x0'));module['exports']={'name':{'type':Sequelize[_0x69d0('0x1')]},'description':{'type':Sequelize[_0x69d0('0x1')]}}; \ No newline at end of file +var _0x2f11=['sequelize','exports','STRING'];(function(_0x24ccc0,_0x4b2ae1){var _0x11256e=function(_0x6ab9b){while(--_0x6ab9b){_0x24ccc0['push'](_0x24ccc0['shift']());}};_0x11256e(++_0x4b2ae1);}(_0x2f11,0x1ef));var _0x12f1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2f11[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x12f1('0x0'));module[_0x12f1('0x1')]={'name':{'type':Sequelize[_0x12f1('0x2')]},'description':{'type':Sequelize[_0x12f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index c9c79d7..16cb5d5 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 _0xf994=['stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','include','find','catch','create','body','getFields','findOne','ZendeskField','fields','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','code','error','message','sendStatus','end','count','offset','limit','set','Content-Range','json','apply','update','status'];(function(_0x2315c3,_0x44b645){var _0x279823=function(_0x106459){while(--_0x106459){_0x2315c3['push'](_0x2315c3['shift']());}};_0x279823(++_0x44b645);}(_0xf994,0x194));var _0x4f99=function(_0x4f1b51,_0x56b807){_0x4f1b51=_0x4f1b51-0x0;var _0x4e2211=_0xf994[_0x4f1b51];return _0x4e2211;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4f99('0x0'));var zipdir=require(_0x4f99('0x1'));var jsonpatch=require(_0x4f99('0x2'));var rp=require(_0x4f99('0x3'));var moment=require(_0x4f99('0x4'));var BPromise=require(_0x4f99('0x5'));var Mustache=require(_0x4f99('0x6'));var util=require(_0x4f99('0x7'));var path=require(_0x4f99('0x8'));var sox=require(_0x4f99('0x9'));var csv=require(_0x4f99('0xa'));var ejs=require(_0x4f99('0xb'));var fs=require('fs');var _=require(_0x4f99('0xc'));var squel=require(_0x4f99('0xd'));var crypto=require('crypto');var jsforce=require(_0x4f99('0xe'));var deskjs=require(_0x4f99('0xf'));var toCsv=require(_0x4f99('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f99('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f99('0x11'));var hardwareService=require(_0x4f99('0x12'));var logger=require(_0x4f99('0x13'))('api');var utils=require(_0x4f99('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x4f99('0x15'));var client=jayson[_0x4f99('0x16')][_0x4f99('0x17')]({'port':0x232a});function checkPasswordPattern(_0x29d089,_0x875f32,_0x118093){if(_0x118093){var _0x590986=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x590986[_0x4f99('0x18')](_0x875f32)){return _0x29d089;}else{throw new db[(_0x4f99('0x19'))][(_0x4f99('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 _0x29d089;}}function respondWithRpcPromise(_0x548543,_0x46084d,_0x4c3378,_0x1e21c2){return new BPromise(function(_0x473b82,_0x40667c){var _0x565def=_0x1e21c2||client;return _0x565def[_0x4f99('0x1b')](_0x548543,_0x4c3378)[_0x4f99('0x1c')](function(_0x13f82a){logger[_0x4f99('0x1d')](_0x4f99('0x1e'),_0x46084d,_0x4f99('0x1f'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x46084d,_0x4f99('0x1f'),JSON['stringify'](_0x13f82a));if(_0x13f82a['error']){if(_0x13f82a['error'][_0x4f99('0x20')]===0x1f4){logger['error'](_0x4f99('0x1e'),_0x46084d,_0x13f82a[_0x4f99('0x21')]['message']);return _0x40667c(_0x13f82a[_0x4f99('0x21')][_0x4f99('0x22')]);}logger[_0x4f99('0x21')](_0x4f99('0x1e'),_0x46084d,_0x13f82a[_0x4f99('0x21')][_0x4f99('0x22')]);return _0x473b82(_0x13f82a[_0x4f99('0x21')]['message']);}else{logger['info'](_0x4f99('0x1e'),_0x46084d,_0x4f99('0x1f'));_0x473b82(_0x13f82a['result']['message']);}})['catch'](function(_0x244886){logger[_0x4f99('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x46084d,_0x244886);_0x40667c(_0x244886);});});}function respondWithStatusCode(_0x3d37f1,_0xa8dcd1){_0xa8dcd1=_0xa8dcd1||0xcc;return function(_0x393374){if(_0x393374){return _0x3d37f1[_0x4f99('0x23')](_0xa8dcd1);}return _0x3d37f1['status'](_0xa8dcd1)[_0x4f99('0x24')]();};}function respondWithResult(_0x2276c6,_0x3fda08){_0x3fda08=_0x3fda08||0xc8;return function(_0x569487){if(_0x569487){return _0x2276c6['status'](_0x3fda08)['json'](_0x569487);}};}function respondWithFilteredResult(_0x52f4a9,_0x2924d0){return function(_0x3318ec){if(_0x3318ec){var _0x53f621=_0x3318ec[_0x4f99('0x25')],_0x3993cf=_0x2924d0[_0x4f99('0x26')],_0x17bbd6=_0x2924d0['offset']+_0x2924d0[_0x4f99('0x27')],_0x171b6a;if(_0x17bbd6>=_0x53f621){_0x17bbd6=_0x53f621;_0x171b6a=0xc8;}else{_0x171b6a=0xce;}_0x52f4a9['status'](_0x171b6a);return _0x52f4a9[_0x4f99('0x28')](_0x4f99('0x29'),_0x3993cf+'-'+_0x17bbd6+'/'+_0x53f621)[_0x4f99('0x2a')](_0x3318ec);}return null;};}function patchUpdates(_0x3a8bce){return function(_0x3ab290){try{jsonpatch[_0x4f99('0x2b')](_0x3ab290,_0x3a8bce,!![]);}catch(_0x289877){return BPromise['reject'](_0x289877);}return _0x3ab290['save']();};}function saveUpdates(_0x906a77,_0x3ef2f6){return function(_0x3494a3){if(_0x3494a3){return _0x3494a3[_0x4f99('0x2c')](_0x906a77)[_0x4f99('0x1c')](function(_0x551c1c){return _0x551c1c;});}return null;};}function removeEntity(_0x5c9509,_0x2c7f2e){return function(_0x382055){if(_0x382055){return _0x382055['destroy']()['then'](function(){_0x5c9509[_0x4f99('0x2d')](0xcc)[_0x4f99('0x24')]();});}};}function handleEntityNotFound(_0x142e92,_0x28f0a9){return function(_0x3b5f0e){if(!_0x3b5f0e){_0x142e92[_0x4f99('0x23')](0x194);}return _0x3b5f0e;};}function handleError(_0x1bd13a,_0x274237){_0x274237=_0x274237||0x1f4;return function(_0x4114f7){logger['error'](_0x4114f7[_0x4f99('0x2e')]);if(_0x4114f7[_0x4f99('0x2f')]){delete _0x4114f7[_0x4f99('0x2f')];}_0x1bd13a[_0x4f99('0x2d')](_0x274237)[_0x4f99('0x30')](_0x4114f7);};}exports[_0x4f99('0x31')]=function(_0x321d60,_0x1e86ed){var _0x5649eb={},_0x56d3a8={},_0x180a26={'count':0x0,'rows':[]};var _0x11a2a9=_['map'](db[_0x4f99('0x32')][_0x4f99('0x33')],function(_0x29be6b){return{'name':_0x29be6b[_0x4f99('0x34')],'type':_0x29be6b['type'][_0x4f99('0x35')]};});_0x56d3a8[_0x4f99('0x36')]=_[_0x4f99('0x37')](_0x11a2a9,_0x4f99('0x2f'));_0x56d3a8[_0x4f99('0x38')]=_['keys'](_0x321d60[_0x4f99('0x38')]);_0x56d3a8[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x56d3a8['model'],_0x56d3a8[_0x4f99('0x38')]);_0x5649eb['attributes']=_[_0x4f99('0x3a')](_0x56d3a8[_0x4f99('0x36')],qs['fields'](_0x321d60[_0x4f99('0x38')]['fields']));_0x5649eb['attributes']=_0x5649eb[_0x4f99('0x3b')][_0x4f99('0x3c')]?_0x5649eb[_0x4f99('0x3b')]:_0x56d3a8[_0x4f99('0x36')];if(!_0x321d60[_0x4f99('0x38')]['hasOwnProperty']('nolimit')){_0x5649eb[_0x4f99('0x27')]=qs['limit'](_0x321d60[_0x4f99('0x38')][_0x4f99('0x27')]);_0x5649eb[_0x4f99('0x26')]=qs['offset'](_0x321d60['query']['offset']);}_0x5649eb[_0x4f99('0x3d')]=qs[_0x4f99('0x3e')](_0x321d60['query'][_0x4f99('0x3e')]);_0x5649eb[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_[_0x4f99('0x40')](_0x321d60[_0x4f99('0x38')],_0x56d3a8[_0x4f99('0x39')]),_0x11a2a9);if(_0x321d60['query'][_0x4f99('0x41')]){_0x5649eb['where']=_['merge'](_0x5649eb[_0x4f99('0x3f')],{'$or':_[_0x4f99('0x37')](_0x11a2a9,function(_0x1e6447){if(_0x1e6447['type']!==_0x4f99('0x42')){var _0xd711b6={};_0xd711b6[_0x1e6447[_0x4f99('0x2f')]]={'$like':'%'+_0x321d60[_0x4f99('0x38')][_0x4f99('0x41')]+'%'};return _0xd711b6;}})});}_0x5649eb=_[_0x4f99('0x43')]({},_0x5649eb,_0x321d60[_0x4f99('0x44')]);var _0xfbfc5c={'where':_0x5649eb[_0x4f99('0x3f')]};return db[_0x4f99('0x32')][_0x4f99('0x25')](_0xfbfc5c)[_0x4f99('0x1c')](function(_0x5ba95c){_0x180a26[_0x4f99('0x25')]=_0x5ba95c;if(_0x321d60[_0x4f99('0x38')]['includeAll']){_0x5649eb['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4f99('0x45')](_0x5649eb);})['then'](function(_0x486c52){_0x180a26[_0x4f99('0x46')]=_0x486c52;return _0x180a26;})[_0x4f99('0x1c')](respondWithFilteredResult(_0x1e86ed,_0x5649eb))['catch'](handleError(_0x1e86ed,null));};exports[_0x4f99('0x47')]=function(_0x4a0250,_0xa6b14c){var _0x96a03d={'raw':![],'where':{'id':_0x4a0250[_0x4f99('0x48')]['id']}},_0xcb93ae={};_0xcb93ae['model']=_[_0x4f99('0x49')](db['ZendeskConfiguration']['rawAttributes']);_0xcb93ae[_0x4f99('0x38')]=_[_0x4f99('0x49')](_0x4a0250[_0x4f99('0x38')]);_0xcb93ae[_0x4f99('0x39')]=_['intersection'](_0xcb93ae[_0x4f99('0x36')],_0xcb93ae[_0x4f99('0x38')]);_0x96a03d['attributes']=_[_0x4f99('0x3a')](_0xcb93ae[_0x4f99('0x36')],qs['fields'](_0x4a0250[_0x4f99('0x38')]['fields']));_0x96a03d[_0x4f99('0x3b')]=_0x96a03d[_0x4f99('0x3b')][_0x4f99('0x3c')]?_0x96a03d[_0x4f99('0x3b')]:_0xcb93ae[_0x4f99('0x36')];if(_0x4a0250['query']['includeAll']){_0x96a03d[_0x4f99('0x4a')]=[{'all':!![]}];}_0x96a03d=_[_0x4f99('0x43')]({},_0x96a03d,_0x4a0250['options']);return db[_0x4f99('0x32')][_0x4f99('0x4b')](_0x96a03d)[_0x4f99('0x1c')](handleEntityNotFound(_0xa6b14c,null))['then'](respondWithResult(_0xa6b14c,null))[_0x4f99('0x4c')](handleError(_0xa6b14c,null));};exports['create']=function(_0x41165f,_0x4639fd){return db[_0x4f99('0x32')][_0x4f99('0x4d')](_0x41165f[_0x4f99('0x4e')],{})[_0x4f99('0x1c')](respondWithResult(_0x4639fd,0xc9))[_0x4f99('0x4c')](handleError(_0x4639fd,null));};exports['update']=function(_0x2488a8,_0x157b44){if(_0x2488a8[_0x4f99('0x4e')]['id']){delete _0x2488a8[_0x4f99('0x4e')]['id'];}return db[_0x4f99('0x32')]['find']({'where':{'id':_0x2488a8[_0x4f99('0x48')]['id']}})['then'](handleEntityNotFound(_0x157b44,null))[_0x4f99('0x1c')](saveUpdates(_0x2488a8[_0x4f99('0x4e')],null))[_0x4f99('0x1c')](respondWithResult(_0x157b44,null))[_0x4f99('0x4c')](handleError(_0x157b44,null));};exports['destroy']=function(_0x59e41a,_0x29ec72){return db[_0x4f99('0x32')][_0x4f99('0x4b')]({'where':{'id':_0x59e41a[_0x4f99('0x48')]['id']}})[_0x4f99('0x1c')](handleEntityNotFound(_0x29ec72,null))[_0x4f99('0x1c')](removeEntity(_0x29ec72,null))['catch'](handleError(_0x29ec72,null));};exports[_0x4f99('0x4f')]=function(_0x4a8941,_0x4d3d90,_0x5497e3){var _0xd9fb26={};var _0x540d24={};var _0x327a93;var _0x2a9a2c;return db[_0x4f99('0x32')][_0x4f99('0x50')]({'where':{'id':_0x4a8941[_0x4f99('0x48')]['id']}})[_0x4f99('0x1c')](handleEntityNotFound(_0x4d3d90,null))[_0x4f99('0x1c')](function(_0x593f50){if(_0x593f50){_0x327a93=_0x593f50;_0x540d24['model']=_[_0x4f99('0x49')](db[_0x4f99('0x51')][_0x4f99('0x33')]);_0x540d24[_0x4f99('0x38')]=_['keys'](_0x4a8941[_0x4f99('0x38')]);_0x540d24[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x540d24[_0x4f99('0x36')],_0x540d24[_0x4f99('0x38')]);_0xd9fb26[_0x4f99('0x3b')]=_['intersection'](_0x540d24[_0x4f99('0x36')],qs[_0x4f99('0x52')](_0x4a8941[_0x4f99('0x38')]['fields']));_0xd9fb26[_0x4f99('0x3b')]=_0xd9fb26[_0x4f99('0x3b')][_0x4f99('0x3c')]?_0xd9fb26[_0x4f99('0x3b')]:_0x540d24[_0x4f99('0x36')];_0xd9fb26[_0x4f99('0x3d')]=qs[_0x4f99('0x3e')](_0x4a8941[_0x4f99('0x38')][_0x4f99('0x3e')]);_0xd9fb26[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_['pick'](_0x4a8941['query'],_0x540d24[_0x4f99('0x39')]));if(_0x4a8941[_0x4f99('0x38')][_0x4f99('0x41')]){_0xd9fb26['where']=_['merge'](_0xd9fb26[_0x4f99('0x3f')],{'$or':_['map'](_0xd9fb26[_0x4f99('0x3b')],function(_0x550402){var _0x4e369d={};_0x4e369d[_0x550402]={'$like':'%'+_0x4a8941[_0x4f99('0x38')]['filter']+'%'};return _0x4e369d;})});}_0xd9fb26=_[_0x4f99('0x43')]({},_0xd9fb26,_0x4a8941[_0x4f99('0x44')]);return _0x327a93[_0x4f99('0x4f')](_0xd9fb26);}})[_0x4f99('0x1c')](function(_0x200961){if(_0x200961){_0x2a9a2c=_0x200961[_0x4f99('0x3c')];if(!_0x4a8941[_0x4f99('0x38')][_0x4f99('0x53')](_0x4f99('0x54'))){_0xd9fb26[_0x4f99('0x27')]=qs[_0x4f99('0x27')](_0x4a8941['query'][_0x4f99('0x27')]);_0xd9fb26[_0x4f99('0x26')]=qs[_0x4f99('0x26')](_0x4a8941[_0x4f99('0x38')][_0x4f99('0x26')]);}return _0x327a93[_0x4f99('0x4f')](_0xd9fb26);}})[_0x4f99('0x1c')](function(_0x5e1a12){if(_0x5e1a12){return _0x5e1a12?{'count':_0x2a9a2c,'rows':_0x5e1a12}:null;}})[_0x4f99('0x1c')](respondWithResult(_0x4d3d90,null))[_0x4f99('0x4c')](handleError(_0x4d3d90,null));};exports['getSubjects']=function(_0x3ff95a,_0x5c9627,_0x1df96e){var _0x1476a4={};var _0x5b54a5={};var _0x1d4bca;var _0x551651;return db[_0x4f99('0x32')][_0x4f99('0x50')]({'where':{'id':_0x3ff95a[_0x4f99('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c9627,null))[_0x4f99('0x1c')](function(_0xa10176){if(_0xa10176){_0x1d4bca=_0xa10176;_0x5b54a5['model']=_[_0x4f99('0x49')](db[_0x4f99('0x51')]['rawAttributes']);_0x5b54a5[_0x4f99('0x38')]=_['keys'](_0x3ff95a[_0x4f99('0x38')]);_0x5b54a5[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x5b54a5[_0x4f99('0x36')],_0x5b54a5['query']);_0x1476a4[_0x4f99('0x3b')]=_['intersection'](_0x5b54a5[_0x4f99('0x36')],qs[_0x4f99('0x52')](_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x52')]));_0x1476a4[_0x4f99('0x3b')]=_0x1476a4[_0x4f99('0x3b')]['length']?_0x1476a4[_0x4f99('0x3b')]:_0x5b54a5[_0x4f99('0x36')];_0x1476a4[_0x4f99('0x3d')]=qs[_0x4f99('0x3e')](_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x3e')]);_0x1476a4[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_[_0x4f99('0x40')](_0x3ff95a['query'],_0x5b54a5['filters']));if(_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x41')]){_0x1476a4[_0x4f99('0x3f')]=_[_0x4f99('0x43')](_0x1476a4[_0x4f99('0x3f')],{'$or':_[_0x4f99('0x37')](_0x1476a4[_0x4f99('0x3b')],function(_0xa78cf7){var _0x5ef716={};_0x5ef716[_0xa78cf7]={'$like':'%'+_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x41')]+'%'};return _0x5ef716;})});}_0x1476a4=_[_0x4f99('0x43')]({},_0x1476a4,_0x3ff95a['options']);return _0x1d4bca[_0x4f99('0x55')](_0x1476a4);}})[_0x4f99('0x1c')](function(_0x431c25){if(_0x431c25){_0x551651=_0x431c25['length'];if(!_0x3ff95a['query']['hasOwnProperty'](_0x4f99('0x54'))){_0x1476a4['limit']=qs[_0x4f99('0x27')](_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x27')]);_0x1476a4[_0x4f99('0x26')]=qs['offset'](_0x3ff95a[_0x4f99('0x38')][_0x4f99('0x26')]);}return _0x1d4bca[_0x4f99('0x55')](_0x1476a4);}})[_0x4f99('0x1c')](function(_0x1a41ed){if(_0x1a41ed){return _0x1a41ed?{'count':_0x551651,'rows':_0x1a41ed}:null;}})[_0x4f99('0x1c')](respondWithResult(_0x5c9627,null))[_0x4f99('0x4c')](handleError(_0x5c9627,null));};exports['getDescriptions']=function(_0x1732c7,_0x838b5b,_0x5a0e7e){var _0x2a5fc9={};var _0x4de5f4={};var _0x13985e;var _0x4bcdef;return db[_0x4f99('0x32')][_0x4f99('0x50')]({'where':{'id':_0x1732c7[_0x4f99('0x48')]['id']}})[_0x4f99('0x1c')](handleEntityNotFound(_0x838b5b,null))[_0x4f99('0x1c')](function(_0x3cced1){if(_0x3cced1){_0x13985e=_0x3cced1;_0x4de5f4[_0x4f99('0x36')]=_[_0x4f99('0x49')](db[_0x4f99('0x51')]['rawAttributes']);_0x4de5f4[_0x4f99('0x38')]=_[_0x4f99('0x49')](_0x1732c7[_0x4f99('0x38')]);_0x4de5f4[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x4de5f4[_0x4f99('0x36')],_0x4de5f4[_0x4f99('0x38')]);_0x2a5fc9[_0x4f99('0x3b')]=_[_0x4f99('0x3a')](_0x4de5f4[_0x4f99('0x36')],qs['fields'](_0x1732c7[_0x4f99('0x38')][_0x4f99('0x52')]));_0x2a5fc9[_0x4f99('0x3b')]=_0x2a5fc9['attributes'][_0x4f99('0x3c')]?_0x2a5fc9[_0x4f99('0x3b')]:_0x4de5f4[_0x4f99('0x36')];_0x2a5fc9['order']=qs[_0x4f99('0x3e')](_0x1732c7[_0x4f99('0x38')][_0x4f99('0x3e')]);_0x2a5fc9[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_['pick'](_0x1732c7[_0x4f99('0x38')],_0x4de5f4[_0x4f99('0x39')]));if(_0x1732c7[_0x4f99('0x38')][_0x4f99('0x41')]){_0x2a5fc9[_0x4f99('0x3f')]=_[_0x4f99('0x43')](_0x2a5fc9[_0x4f99('0x3f')],{'$or':_[_0x4f99('0x37')](_0x2a5fc9['attributes'],function(_0xb826fa){var _0x321b27={};_0x321b27[_0xb826fa]={'$like':'%'+_0x1732c7[_0x4f99('0x38')][_0x4f99('0x41')]+'%'};return _0x321b27;})});}_0x2a5fc9=_['merge']({},_0x2a5fc9,_0x1732c7[_0x4f99('0x44')]);return _0x13985e[_0x4f99('0x56')](_0x2a5fc9);}})[_0x4f99('0x1c')](function(_0x4a7bb5){if(_0x4a7bb5){_0x4bcdef=_0x4a7bb5[_0x4f99('0x3c')];if(!_0x1732c7['query'][_0x4f99('0x53')](_0x4f99('0x54'))){_0x2a5fc9['limit']=qs[_0x4f99('0x27')](_0x1732c7[_0x4f99('0x38')][_0x4f99('0x27')]);_0x2a5fc9[_0x4f99('0x26')]=qs[_0x4f99('0x26')](_0x1732c7[_0x4f99('0x38')]['offset']);}return _0x13985e[_0x4f99('0x56')](_0x2a5fc9);}})[_0x4f99('0x1c')](function(_0x3525be){if(_0x3525be){return _0x3525be?{'count':_0x4bcdef,'rows':_0x3525be}:null;}})[_0x4f99('0x1c')](respondWithResult(_0x838b5b,null))[_0x4f99('0x4c')](handleError(_0x838b5b,null));};exports[_0x4f99('0x57')]=function(_0x1603c7,_0x2b735f,_0x51b8b1){var _0x46207f={};var _0x11118c={};var _0x4e53d2;var _0x327911;return db[_0x4f99('0x32')][_0x4f99('0x50')]({'where':{'id':_0x1603c7[_0x4f99('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b735f,null))[_0x4f99('0x1c')](function(_0xaaa484){if(_0xaaa484){_0x4e53d2=_0xaaa484;_0x11118c[_0x4f99('0x36')]=_[_0x4f99('0x49')](db['Tag'][_0x4f99('0x33')]);_0x11118c[_0x4f99('0x38')]=_[_0x4f99('0x49')](_0x1603c7[_0x4f99('0x38')]);_0x11118c[_0x4f99('0x39')]=_[_0x4f99('0x3a')](_0x11118c[_0x4f99('0x36')],_0x11118c[_0x4f99('0x38')]);_0x46207f[_0x4f99('0x3b')]=_[_0x4f99('0x3a')](_0x11118c[_0x4f99('0x36')],qs['fields'](_0x1603c7[_0x4f99('0x38')][_0x4f99('0x52')]));_0x46207f[_0x4f99('0x3b')]=_0x46207f[_0x4f99('0x3b')][_0x4f99('0x3c')]?_0x46207f[_0x4f99('0x3b')]:_0x11118c[_0x4f99('0x36')];_0x46207f[_0x4f99('0x3d')]=qs['sort'](_0x1603c7[_0x4f99('0x38')][_0x4f99('0x3e')]);_0x46207f[_0x4f99('0x3f')]=qs[_0x4f99('0x39')](_[_0x4f99('0x40')](_0x1603c7[_0x4f99('0x38')],_0x11118c['filters']));if(_0x1603c7['query'][_0x4f99('0x41')]){_0x46207f[_0x4f99('0x3f')]=_[_0x4f99('0x43')](_0x46207f[_0x4f99('0x3f')],{'$or':_[_0x4f99('0x37')](_0x46207f[_0x4f99('0x3b')],function(_0x1f12f8){var _0xdc654f={};_0xdc654f[_0x1f12f8]={'$like':'%'+_0x1603c7[_0x4f99('0x38')]['filter']+'%'};return _0xdc654f;})});}_0x46207f=_[_0x4f99('0x43')]({},_0x46207f,_0x1603c7['options']);return _0x4e53d2[_0x4f99('0x57')](_0x46207f);}})[_0x4f99('0x1c')](function(_0x4a3730){if(_0x4a3730){_0x327911=_0x4a3730[_0x4f99('0x3c')];if(!_0x1603c7[_0x4f99('0x38')][_0x4f99('0x53')]('nolimit')){_0x46207f['limit']=qs['limit'](_0x1603c7[_0x4f99('0x38')][_0x4f99('0x27')]);_0x46207f['offset']=qs[_0x4f99('0x26')](_0x1603c7[_0x4f99('0x38')][_0x4f99('0x26')]);}return _0x4e53d2[_0x4f99('0x57')](_0x46207f);}})['then'](function(_0x2c481b){if(_0x2c481b){return _0x2c481b?{'count':_0x327911,'rows':_0x2c481b}:null;}})[_0x4f99('0x1c')](respondWithResult(_0x2b735f,null))['catch'](handleError(_0x2b735f,null));};exports['setTags']=function(_0x537ee2,_0x3c4337,_0x297a36){if(_0x537ee2['body']['id']){delete _0x537ee2['body']['id'];}return db['ZendeskConfiguration'][_0x4f99('0x50')]({'where':{'id':_0x537ee2['params']['id']}})[_0x4f99('0x1c')](handleEntityNotFound(_0x3c4337,null))[_0x4f99('0x1c')](function(_0x3fb774){if(_0x3fb774){return _0x3fb774[_0x4f99('0x58')](_0x537ee2[_0x4f99('0x4e')][_0x4f99('0x59')]||[]);}return null;})[_0x4f99('0x1c')](respondWithResult(_0x3c4337,null))[_0x4f99('0x4c')](handleError(_0x3c4337,null));}; \ No newline at end of file +var _0xbe44=['order','pick','getSubjects','getDescriptions','getTags','Tag','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','index','map','ZendeskConfiguration','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','body','destroy','getFields','findOne','ZendeskField','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe44,0x1e1));var _0x4be4=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0xbe44[_0x2431d6];return _0x4d0f9b;};'use strict';var pdf=require(_0x4be4('0x0'));var emlformat=require(_0x4be4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4be4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4be4('0x3'));var moment=require(_0x4be4('0x4'));var BPromise=require(_0x4be4('0x5'));var Mustache=require(_0x4be4('0x6'));var util=require(_0x4be4('0x7'));var path=require('path');var sox=require(_0x4be4('0x8'));var csv=require(_0x4be4('0x9'));var ejs=require(_0x4be4('0xa'));var fs=require('fs');var _=require(_0x4be4('0xb'));var squel=require(_0x4be4('0xc'));var crypto=require(_0x4be4('0xd'));var jsforce=require(_0x4be4('0xe'));var deskjs=require(_0x4be4('0xf'));var toCsv=require(_0x4be4('0x9'));var querystring=require(_0x4be4('0x10'));var Papa=require(_0x4be4('0x11'));var Redis=require(_0x4be4('0x12'));var authService=require(_0x4be4('0x13'));var qs=require(_0x4be4('0x14'));var as=require(_0x4be4('0x15'));var hardwareService=require(_0x4be4('0x16'));var logger=require(_0x4be4('0x17'))(_0x4be4('0x18'));var utils=require(_0x4be4('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x4be4('0x1a')][_0x4be4('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xdaecc1,_0x8f5b73,_0xbd27a8){if(_0xbd27a8){var _0x11d4b8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11d4b8['test'](_0x8f5b73)){return _0xdaecc1;}else{throw new db['Sequelize']['ValidationError'](_0x4be4('0x1c'));}}else{return _0xdaecc1;}}function respondWithRpcPromise(_0x35241c,_0x5be56f,_0x2f7525,_0x28ffbe){return new BPromise(function(_0x20654e,_0x4ce1b2){var _0x3ee013=_0x28ffbe||client;return _0x3ee013[_0x4be4('0x1d')](_0x35241c,_0x2f7525)['then'](function(_0x56c7fa){logger['info'](_0x4be4('0x1e'),_0x5be56f,_0x4be4('0x1f'));logger[_0x4be4('0x20')](_0x4be4('0x21'),_0x5be56f,_0x4be4('0x1f'),JSON['stringify'](_0x56c7fa));if(_0x56c7fa[_0x4be4('0x22')]){if(_0x56c7fa['error'][_0x4be4('0x23')]===0x1f4){logger[_0x4be4('0x22')](_0x4be4('0x1e'),_0x5be56f,_0x56c7fa['error']['message']);return _0x4ce1b2(_0x56c7fa[_0x4be4('0x22')][_0x4be4('0x24')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5be56f,_0x56c7fa[_0x4be4('0x22')]['message']);return _0x20654e(_0x56c7fa[_0x4be4('0x22')][_0x4be4('0x24')]);}else{logger[_0x4be4('0x25')](_0x4be4('0x1e'),_0x5be56f,_0x4be4('0x1f'));_0x20654e(_0x56c7fa[_0x4be4('0x26')][_0x4be4('0x24')]);}})[_0x4be4('0x27')](function(_0x13b347){logger[_0x4be4('0x22')](_0x4be4('0x1e'),_0x5be56f,_0x13b347);_0x4ce1b2(_0x13b347);});});}function respondWithStatusCode(_0x22d4e9,_0x3087a4){_0x3087a4=_0x3087a4||0xcc;return function(_0x2223c5){if(_0x2223c5){return _0x22d4e9[_0x4be4('0x28')](_0x3087a4);}return _0x22d4e9[_0x4be4('0x29')](_0x3087a4)[_0x4be4('0x2a')]();};}function respondWithResult(_0xe4dfe8,_0x31a947){_0x31a947=_0x31a947||0xc8;return function(_0x15cd8f){if(_0x15cd8f){return _0xe4dfe8[_0x4be4('0x29')](_0x31a947)[_0x4be4('0x2b')](_0x15cd8f);}};}function respondWithFilteredResult(_0x4be523,_0x5957b0){return function(_0x55a2a7){if(_0x55a2a7){var _0x48fff5=_0x55a2a7[_0x4be4('0x2c')],_0x48a0d2=_0x5957b0['offset'],_0x2098eb=_0x5957b0[_0x4be4('0x2d')]+_0x5957b0[_0x4be4('0x2e')],_0x2bb82d;if(_0x2098eb>=_0x48fff5){_0x2098eb=_0x48fff5;_0x2bb82d=0xc8;}else{_0x2bb82d=0xce;}_0x4be523['status'](_0x2bb82d);return _0x4be523[_0x4be4('0x2f')](_0x4be4('0x30'),_0x48a0d2+'-'+_0x2098eb+'/'+_0x48fff5)['json'](_0x55a2a7);}return null;};}function patchUpdates(_0x33fe1a){return function(_0x41f335){try{jsonpatch[_0x4be4('0x31')](_0x41f335,_0x33fe1a,!![]);}catch(_0x341a71){return BPromise[_0x4be4('0x32')](_0x341a71);}return _0x41f335['save']();};}function saveUpdates(_0x2adfb2,_0x156a1f){return function(_0x1bcc6e){if(_0x1bcc6e){return _0x1bcc6e[_0x4be4('0x33')](_0x2adfb2)[_0x4be4('0x34')](function(_0x7d608f){return _0x7d608f;});}return null;};}function removeEntity(_0xe8f33f,_0x359d58){return function(_0x10c93d){if(_0x10c93d){return _0x10c93d['destroy']()[_0x4be4('0x34')](function(){_0xe8f33f[_0x4be4('0x29')](0xcc)[_0x4be4('0x2a')]();});}};}function handleEntityNotFound(_0x31bfb3,_0x20b8cf){return function(_0x15cd07){if(!_0x15cd07){_0x31bfb3[_0x4be4('0x28')](0x194);}return _0x15cd07;};}function handleError(_0x849698,_0x50d98d){_0x50d98d=_0x50d98d||0x1f4;return function(_0xf503c7){logger['error'](_0xf503c7[_0x4be4('0x35')]);if(_0xf503c7[_0x4be4('0x36')]){delete _0xf503c7[_0x4be4('0x36')];}_0x849698[_0x4be4('0x29')](_0x50d98d)['send'](_0xf503c7);};}exports[_0x4be4('0x37')]=function(_0x5afa08,_0x221c7b){var _0xbcdf61={},_0x5db92d={},_0x4e6dd5={'count':0x0,'rows':[]};var _0x5f4ba3=_[_0x4be4('0x38')](db[_0x4be4('0x39')]['rawAttributes'],function(_0x19afbf){return{'name':_0x19afbf[_0x4be4('0x3a')],'type':_0x19afbf[_0x4be4('0x3b')]['key']};});_0x5db92d[_0x4be4('0x3c')]=_['map'](_0x5f4ba3,'name');_0x5db92d['query']=_['keys'](_0x5afa08[_0x4be4('0x3d')]);_0x5db92d[_0x4be4('0x3e')]=_[_0x4be4('0x3f')](_0x5db92d[_0x4be4('0x3c')],_0x5db92d[_0x4be4('0x3d')]);_0xbcdf61['attributes']=_[_0x4be4('0x3f')](_0x5db92d[_0x4be4('0x3c')],qs[_0x4be4('0x40')](_0x5afa08['query'][_0x4be4('0x40')]));_0xbcdf61[_0x4be4('0x41')]=_0xbcdf61['attributes'][_0x4be4('0x42')]?_0xbcdf61[_0x4be4('0x41')]:_0x5db92d[_0x4be4('0x3c')];if(!_0x5afa08[_0x4be4('0x3d')][_0x4be4('0x43')](_0x4be4('0x44'))){_0xbcdf61[_0x4be4('0x2e')]=qs[_0x4be4('0x2e')](_0x5afa08[_0x4be4('0x3d')][_0x4be4('0x2e')]);_0xbcdf61['offset']=qs[_0x4be4('0x2d')](_0x5afa08[_0x4be4('0x3d')]['offset']);}_0xbcdf61['order']=qs[_0x4be4('0x45')](_0x5afa08[_0x4be4('0x3d')]['sort']);_0xbcdf61[_0x4be4('0x46')]=qs[_0x4be4('0x3e')](_['pick'](_0x5afa08[_0x4be4('0x3d')],_0x5db92d[_0x4be4('0x3e')]),_0x5f4ba3);if(_0x5afa08[_0x4be4('0x3d')][_0x4be4('0x47')]){_0xbcdf61[_0x4be4('0x46')]=_[_0x4be4('0x48')](_0xbcdf61[_0x4be4('0x46')],{'$or':_[_0x4be4('0x38')](_0x5f4ba3,function(_0x5c60ce){if(_0x5c60ce[_0x4be4('0x3b')]!==_0x4be4('0x49')){var _0x500beb={};_0x500beb[_0x5c60ce[_0x4be4('0x36')]]={'$like':'%'+_0x5afa08['query']['filter']+'%'};return _0x500beb;}})});}_0xbcdf61=_[_0x4be4('0x48')]({},_0xbcdf61,_0x5afa08[_0x4be4('0x4a')]);var _0x5a473d={'where':_0xbcdf61[_0x4be4('0x46')]};return db[_0x4be4('0x39')][_0x4be4('0x2c')](_0x5a473d)[_0x4be4('0x34')](function(_0x2b97cc){_0x4e6dd5['count']=_0x2b97cc;if(_0x5afa08['query'][_0x4be4('0x4b')]){_0xbcdf61[_0x4be4('0x4c')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4be4('0x4d')](_0xbcdf61);})[_0x4be4('0x34')](function(_0x276af5){_0x4e6dd5['rows']=_0x276af5;return _0x4e6dd5;})[_0x4be4('0x34')](respondWithFilteredResult(_0x221c7b,_0xbcdf61))[_0x4be4('0x27')](handleError(_0x221c7b,null));};exports[_0x4be4('0x4e')]=function(_0x2d4e07,_0x1fc0a9){var _0x413886={'raw':![],'where':{'id':_0x2d4e07[_0x4be4('0x4f')]['id']}},_0x328c8c={};_0x328c8c['model']=_[_0x4be4('0x50')](db[_0x4be4('0x39')]['rawAttributes']);_0x328c8c[_0x4be4('0x3d')]=_[_0x4be4('0x50')](_0x2d4e07['query']);_0x328c8c[_0x4be4('0x3e')]=_[_0x4be4('0x3f')](_0x328c8c[_0x4be4('0x3c')],_0x328c8c[_0x4be4('0x3d')]);_0x413886['attributes']=_['intersection'](_0x328c8c[_0x4be4('0x3c')],qs[_0x4be4('0x40')](_0x2d4e07['query'][_0x4be4('0x40')]));_0x413886[_0x4be4('0x41')]=_0x413886[_0x4be4('0x41')][_0x4be4('0x42')]?_0x413886[_0x4be4('0x41')]:_0x328c8c[_0x4be4('0x3c')];if(_0x2d4e07[_0x4be4('0x3d')][_0x4be4('0x4b')]){_0x413886[_0x4be4('0x4c')]=[{'all':!![]}];}_0x413886=_[_0x4be4('0x48')]({},_0x413886,_0x2d4e07[_0x4be4('0x4a')]);return db[_0x4be4('0x39')][_0x4be4('0x51')](_0x413886)[_0x4be4('0x34')](handleEntityNotFound(_0x1fc0a9,null))[_0x4be4('0x34')](respondWithResult(_0x1fc0a9,null))['catch'](handleError(_0x1fc0a9,null));};exports[_0x4be4('0x52')]=function(_0x5436c9,_0x15818a){return db[_0x4be4('0x39')]['create'](_0x5436c9[_0x4be4('0x53')],{})[_0x4be4('0x34')](respondWithResult(_0x15818a,0xc9))['catch'](handleError(_0x15818a,null));};exports[_0x4be4('0x33')]=function(_0x3cddfd,_0x22b690){if(_0x3cddfd[_0x4be4('0x53')]['id']){delete _0x3cddfd[_0x4be4('0x53')]['id'];}return db[_0x4be4('0x39')][_0x4be4('0x51')]({'where':{'id':_0x3cddfd['params']['id']}})['then'](handleEntityNotFound(_0x22b690,null))[_0x4be4('0x34')](saveUpdates(_0x3cddfd[_0x4be4('0x53')],null))[_0x4be4('0x34')](respondWithResult(_0x22b690,null))[_0x4be4('0x27')](handleError(_0x22b690,null));};exports[_0x4be4('0x54')]=function(_0x73aedf,_0x39122e){return db[_0x4be4('0x39')][_0x4be4('0x51')]({'where':{'id':_0x73aedf[_0x4be4('0x4f')]['id']}})[_0x4be4('0x34')](handleEntityNotFound(_0x39122e,null))[_0x4be4('0x34')](removeEntity(_0x39122e,null))[_0x4be4('0x27')](handleError(_0x39122e,null));};exports[_0x4be4('0x55')]=function(_0x5f595e,_0x49fa73,_0x5692de){var _0x373b9a={};var _0x426ca3={};var _0x445737;var _0xf339b4;return db[_0x4be4('0x39')][_0x4be4('0x56')]({'where':{'id':_0x5f595e[_0x4be4('0x4f')]['id']}})[_0x4be4('0x34')](handleEntityNotFound(_0x49fa73,null))[_0x4be4('0x34')](function(_0xda5c65){if(_0xda5c65){_0x445737=_0xda5c65;_0x426ca3['model']=_[_0x4be4('0x50')](db[_0x4be4('0x57')][_0x4be4('0x58')]);_0x426ca3['query']=_[_0x4be4('0x50')](_0x5f595e['query']);_0x426ca3[_0x4be4('0x3e')]=_[_0x4be4('0x3f')](_0x426ca3[_0x4be4('0x3c')],_0x426ca3['query']);_0x373b9a[_0x4be4('0x41')]=_[_0x4be4('0x3f')](_0x426ca3['model'],qs['fields'](_0x5f595e[_0x4be4('0x3d')][_0x4be4('0x40')]));_0x373b9a['attributes']=_0x373b9a[_0x4be4('0x41')][_0x4be4('0x42')]?_0x373b9a[_0x4be4('0x41')]:_0x426ca3['model'];_0x373b9a[_0x4be4('0x59')]=qs[_0x4be4('0x45')](_0x5f595e[_0x4be4('0x3d')][_0x4be4('0x45')]);_0x373b9a[_0x4be4('0x46')]=qs['filters'](_[_0x4be4('0x5a')](_0x5f595e['query'],_0x426ca3[_0x4be4('0x3e')]));if(_0x5f595e[_0x4be4('0x3d')][_0x4be4('0x47')]){_0x373b9a[_0x4be4('0x46')]=_[_0x4be4('0x48')](_0x373b9a['where'],{'$or':_['map'](_0x373b9a[_0x4be4('0x41')],function(_0x2e959a){var _0x34bd39={};_0x34bd39[_0x2e959a]={'$like':'%'+_0x5f595e[_0x4be4('0x3d')][_0x4be4('0x47')]+'%'};return _0x34bd39;})});}_0x373b9a=_[_0x4be4('0x48')]({},_0x373b9a,_0x5f595e[_0x4be4('0x4a')]);return _0x445737['getFields'](_0x373b9a);}})[_0x4be4('0x34')](function(_0x4aa8bd){if(_0x4aa8bd){_0xf339b4=_0x4aa8bd['length'];if(!_0x5f595e[_0x4be4('0x3d')][_0x4be4('0x43')](_0x4be4('0x44'))){_0x373b9a[_0x4be4('0x2e')]=qs['limit'](_0x5f595e[_0x4be4('0x3d')][_0x4be4('0x2e')]);_0x373b9a[_0x4be4('0x2d')]=qs[_0x4be4('0x2d')](_0x5f595e[_0x4be4('0x3d')][_0x4be4('0x2d')]);}return _0x445737[_0x4be4('0x55')](_0x373b9a);}})['then'](function(_0xef9265){if(_0xef9265){return _0xef9265?{'count':_0xf339b4,'rows':_0xef9265}:null;}})[_0x4be4('0x34')](respondWithResult(_0x49fa73,null))[_0x4be4('0x27')](handleError(_0x49fa73,null));};exports['getSubjects']=function(_0x32ac3c,_0x276c3f,_0x35b1d9){var _0x406930={};var _0x15e3ca={};var _0xfb855e;var _0x2bc532;return db['ZendeskConfiguration'][_0x4be4('0x56')]({'where':{'id':_0x32ac3c['params']['id']}})[_0x4be4('0x34')](handleEntityNotFound(_0x276c3f,null))['then'](function(_0x592e89){if(_0x592e89){_0xfb855e=_0x592e89;_0x15e3ca[_0x4be4('0x3c')]=_['keys'](db[_0x4be4('0x57')]['rawAttributes']);_0x15e3ca['query']=_[_0x4be4('0x50')](_0x32ac3c[_0x4be4('0x3d')]);_0x15e3ca['filters']=_[_0x4be4('0x3f')](_0x15e3ca[_0x4be4('0x3c')],_0x15e3ca[_0x4be4('0x3d')]);_0x406930[_0x4be4('0x41')]=_['intersection'](_0x15e3ca[_0x4be4('0x3c')],qs[_0x4be4('0x40')](_0x32ac3c[_0x4be4('0x3d')]['fields']));_0x406930['attributes']=_0x406930['attributes']['length']?_0x406930[_0x4be4('0x41')]:_0x15e3ca[_0x4be4('0x3c')];_0x406930[_0x4be4('0x59')]=qs['sort'](_0x32ac3c['query']['sort']);_0x406930['where']=qs[_0x4be4('0x3e')](_[_0x4be4('0x5a')](_0x32ac3c[_0x4be4('0x3d')],_0x15e3ca['filters']));if(_0x32ac3c[_0x4be4('0x3d')][_0x4be4('0x47')]){_0x406930[_0x4be4('0x46')]=_[_0x4be4('0x48')](_0x406930[_0x4be4('0x46')],{'$or':_['map'](_0x406930['attributes'],function(_0x737cbc){var _0x3674eb={};_0x3674eb[_0x737cbc]={'$like':'%'+_0x32ac3c[_0x4be4('0x3d')][_0x4be4('0x47')]+'%'};return _0x3674eb;})});}_0x406930=_['merge']({},_0x406930,_0x32ac3c['options']);return _0xfb855e['getSubjects'](_0x406930);}})[_0x4be4('0x34')](function(_0x13f39c){if(_0x13f39c){_0x2bc532=_0x13f39c[_0x4be4('0x42')];if(!_0x32ac3c[_0x4be4('0x3d')][_0x4be4('0x43')]('nolimit')){_0x406930['limit']=qs[_0x4be4('0x2e')](_0x32ac3c[_0x4be4('0x3d')][_0x4be4('0x2e')]);_0x406930[_0x4be4('0x2d')]=qs[_0x4be4('0x2d')](_0x32ac3c[_0x4be4('0x3d')][_0x4be4('0x2d')]);}return _0xfb855e[_0x4be4('0x5b')](_0x406930);}})[_0x4be4('0x34')](function(_0x56e033){if(_0x56e033){return _0x56e033?{'count':_0x2bc532,'rows':_0x56e033}:null;}})[_0x4be4('0x34')](respondWithResult(_0x276c3f,null))[_0x4be4('0x27')](handleError(_0x276c3f,null));};exports[_0x4be4('0x5c')]=function(_0x4b9000,_0x424f51,_0x2b4905){var _0x549cfa={};var _0x202517={};var _0x21aeb4;var _0x2d3a66;return db['ZendeskConfiguration'][_0x4be4('0x56')]({'where':{'id':_0x4b9000[_0x4be4('0x4f')]['id']}})[_0x4be4('0x34')](handleEntityNotFound(_0x424f51,null))[_0x4be4('0x34')](function(_0x17e606){if(_0x17e606){_0x21aeb4=_0x17e606;_0x202517['model']=_[_0x4be4('0x50')](db[_0x4be4('0x57')][_0x4be4('0x58')]);_0x202517[_0x4be4('0x3d')]=_[_0x4be4('0x50')](_0x4b9000[_0x4be4('0x3d')]);_0x202517[_0x4be4('0x3e')]=_[_0x4be4('0x3f')](_0x202517[_0x4be4('0x3c')],_0x202517['query']);_0x549cfa[_0x4be4('0x41')]=_[_0x4be4('0x3f')](_0x202517['model'],qs[_0x4be4('0x40')](_0x4b9000[_0x4be4('0x3d')][_0x4be4('0x40')]));_0x549cfa['attributes']=_0x549cfa[_0x4be4('0x41')][_0x4be4('0x42')]?_0x549cfa['attributes']:_0x202517['model'];_0x549cfa[_0x4be4('0x59')]=qs[_0x4be4('0x45')](_0x4b9000[_0x4be4('0x3d')][_0x4be4('0x45')]);_0x549cfa[_0x4be4('0x46')]=qs[_0x4be4('0x3e')](_[_0x4be4('0x5a')](_0x4b9000[_0x4be4('0x3d')],_0x202517['filters']));if(_0x4b9000[_0x4be4('0x3d')]['filter']){_0x549cfa[_0x4be4('0x46')]=_[_0x4be4('0x48')](_0x549cfa[_0x4be4('0x46')],{'$or':_[_0x4be4('0x38')](_0x549cfa[_0x4be4('0x41')],function(_0x8c2d6d){var _0x13302c={};_0x13302c[_0x8c2d6d]={'$like':'%'+_0x4b9000['query'][_0x4be4('0x47')]+'%'};return _0x13302c;})});}_0x549cfa=_[_0x4be4('0x48')]({},_0x549cfa,_0x4b9000[_0x4be4('0x4a')]);return _0x21aeb4['getDescriptions'](_0x549cfa);}})['then'](function(_0x12a0e1){if(_0x12a0e1){_0x2d3a66=_0x12a0e1['length'];if(!_0x4b9000[_0x4be4('0x3d')][_0x4be4('0x43')]('nolimit')){_0x549cfa[_0x4be4('0x2e')]=qs[_0x4be4('0x2e')](_0x4b9000[_0x4be4('0x3d')][_0x4be4('0x2e')]);_0x549cfa['offset']=qs[_0x4be4('0x2d')](_0x4b9000[_0x4be4('0x3d')][_0x4be4('0x2d')]);}return _0x21aeb4[_0x4be4('0x5c')](_0x549cfa);}})['then'](function(_0x1b6a50){if(_0x1b6a50){return _0x1b6a50?{'count':_0x2d3a66,'rows':_0x1b6a50}:null;}})[_0x4be4('0x34')](respondWithResult(_0x424f51,null))['catch'](handleError(_0x424f51,null));};exports[_0x4be4('0x5d')]=function(_0x528364,_0x4fba4e,_0x2808a9){var _0x1315cf={};var _0x578322={};var _0xe2cf0b;var _0x59ff74;return db[_0x4be4('0x39')][_0x4be4('0x56')]({'where':{'id':_0x528364[_0x4be4('0x4f')]['id']}})[_0x4be4('0x34')](handleEntityNotFound(_0x4fba4e,null))[_0x4be4('0x34')](function(_0x89f5e8){if(_0x89f5e8){_0xe2cf0b=_0x89f5e8;_0x578322[_0x4be4('0x3c')]=_[_0x4be4('0x50')](db[_0x4be4('0x5e')][_0x4be4('0x58')]);_0x578322[_0x4be4('0x3d')]=_[_0x4be4('0x50')](_0x528364[_0x4be4('0x3d')]);_0x578322[_0x4be4('0x3e')]=_['intersection'](_0x578322[_0x4be4('0x3c')],_0x578322['query']);_0x1315cf[_0x4be4('0x41')]=_[_0x4be4('0x3f')](_0x578322[_0x4be4('0x3c')],qs[_0x4be4('0x40')](_0x528364['query'][_0x4be4('0x40')]));_0x1315cf[_0x4be4('0x41')]=_0x1315cf[_0x4be4('0x41')][_0x4be4('0x42')]?_0x1315cf[_0x4be4('0x41')]:_0x578322[_0x4be4('0x3c')];_0x1315cf[_0x4be4('0x59')]=qs['sort'](_0x528364[_0x4be4('0x3d')][_0x4be4('0x45')]);_0x1315cf['where']=qs[_0x4be4('0x3e')](_[_0x4be4('0x5a')](_0x528364[_0x4be4('0x3d')],_0x578322[_0x4be4('0x3e')]));if(_0x528364[_0x4be4('0x3d')][_0x4be4('0x47')]){_0x1315cf[_0x4be4('0x46')]=_[_0x4be4('0x48')](_0x1315cf[_0x4be4('0x46')],{'$or':_[_0x4be4('0x38')](_0x1315cf['attributes'],function(_0x42b712){var _0x34356c={};_0x34356c[_0x42b712]={'$like':'%'+_0x528364[_0x4be4('0x3d')][_0x4be4('0x47')]+'%'};return _0x34356c;})});}_0x1315cf=_[_0x4be4('0x48')]({},_0x1315cf,_0x528364['options']);return _0xe2cf0b[_0x4be4('0x5d')](_0x1315cf);}})['then'](function(_0x1fc4c7){if(_0x1fc4c7){_0x59ff74=_0x1fc4c7['length'];if(!_0x528364[_0x4be4('0x3d')][_0x4be4('0x43')](_0x4be4('0x44'))){_0x1315cf['limit']=qs[_0x4be4('0x2e')](_0x528364[_0x4be4('0x3d')]['limit']);_0x1315cf[_0x4be4('0x2d')]=qs[_0x4be4('0x2d')](_0x528364[_0x4be4('0x3d')][_0x4be4('0x2d')]);}return _0xe2cf0b[_0x4be4('0x5d')](_0x1315cf);}})[_0x4be4('0x34')](function(_0xb77b37){if(_0xb77b37){return _0xb77b37?{'count':_0x59ff74,'rows':_0xb77b37}:null;}})[_0x4be4('0x34')](respondWithResult(_0x4fba4e,null))[_0x4be4('0x27')](handleError(_0x4fba4e,null));};exports['setTags']=function(_0x2a39c8,_0x567d3b,_0xe28f52){if(_0x2a39c8[_0x4be4('0x53')]['id']){delete _0x2a39c8[_0x4be4('0x53')]['id'];}return db[_0x4be4('0x39')]['findOne']({'where':{'id':_0x2a39c8[_0x4be4('0x4f')]['id']}})[_0x4be4('0x34')](handleEntityNotFound(_0x567d3b,null))[_0x4be4('0x34')](function(_0x4d6155){if(_0x4d6155){return _0x4d6155['setTags'](_0x2a39c8[_0x4be4('0x53')]['ids']||[]);}return null;})['then'](respondWithResult(_0x567d3b,null))[_0x4be4('0x27')](handleError(_0x567d3b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 90210b2..975bf37 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 _0xa4d8=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xcdbb06,_0x355b35){var _0xe76293=function(_0x20c39e){while(--_0x20c39e){_0xcdbb06['push'](_0xcdbb06['shift']());}};_0xe76293(++_0x355b35);}(_0xa4d8,0x113));var _0x8a4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a4d('0x0'));var util=require(_0x8a4d('0x1'));var logger=require(_0x8a4d('0x2'))(_0x8a4d('0x3'));var moment=require(_0x8a4d('0x4'));var BPromise=require(_0x8a4d('0x5'));var rp=require(_0x8a4d('0x6'));var fs=require('fs');var path=require(_0x8a4d('0x7'));var rimraf=require(_0x8a4d('0x8'));var config=require(_0x8a4d('0x9'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x8a4d('0xa')]=function(_0x2a4064,_0x171def){return _0x2a4064['define'](_0x8a4d('0xb'),attributes,{'tableName':_0x8a4d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2619=['bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','util','api','moment'];(function(_0x5b5e43,_0x2a5f33){var _0x337596=function(_0xcf1cfe){while(--_0xcf1cfe){_0x5b5e43['push'](_0x5b5e43['shift']());}};_0x337596(++_0x2a5f33);}(_0x2619,0x168));var _0x9261=function(_0xc96648,_0x550944){_0xc96648=_0xc96648-0x0;var _0x46c5d9=_0x2619[_0xc96648];return _0x46c5d9;};'use strict';var _=require('lodash');var util=require(_0x9261('0x0'));var logger=require('../../config/logger')(_0x9261('0x1'));var moment=require(_0x9261('0x2'));var BPromise=require(_0x9261('0x3'));var rp=require(_0x9261('0x4'));var fs=require('fs');var path=require(_0x9261('0x5'));var rimraf=require('rimraf');var config=require(_0x9261('0x6'));var attributes=require(_0x9261('0x7'));module[_0x9261('0x8')]=function(_0x3e06ab,_0xaa3f90){return _0x3e06ab[_0x9261('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0x9261('0xa'),'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 44cb6ba..e4c399a 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 _0xb93f=['../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x23d726,_0x551c15){var _0x46879d=function(_0x30f17e){while(--_0x30f17e){_0x23d726['push'](_0x23d726['shift']());}};_0x46879d(++_0x551c15);}(_0xb93f,0xc9));var _0xfb93=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xb93f[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xfb93('0x0'));var util=require(_0xfb93('0x1'));var moment=require(_0xfb93('0x2'));var BPromise=require(_0xfb93('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb93('0x4'));var db=require(_0xfb93('0x5'))['db'];var utils=require(_0xfb93('0x6'));var logger=require(_0xfb93('0x7'))(_0xfb93('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfb93('0x9')][_0xfb93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x164546,_0x61411e,_0x43b17a){return new BPromise(function(_0x158f6b,_0x30882a){return client[_0xfb93('0xb')](_0x164546,_0x43b17a)[_0xfb93('0xc')](function(_0x3e57d7){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x61411e,_0xfb93('0xd'));logger[_0xfb93('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x61411e,_0xfb93('0xd'),JSON[_0xfb93('0xf')](_0x3e57d7));if(_0x3e57d7[_0xfb93('0x10')]){if(_0x3e57d7[_0xfb93('0x10')][_0xfb93('0x11')]===0x1f4){logger[_0xfb93('0x10')](_0xfb93('0x12'),_0x61411e,_0x3e57d7[_0xfb93('0x10')][_0xfb93('0x13')]);return _0x30882a(_0x3e57d7[_0xfb93('0x10')][_0xfb93('0x13')]);}logger[_0xfb93('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x61411e,_0x3e57d7['error'][_0xfb93('0x13')]);return _0x158f6b(_0x3e57d7[_0xfb93('0x10')][_0xfb93('0x13')]);}else{logger[_0xfb93('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x61411e,_0xfb93('0xd'));_0x158f6b(_0x3e57d7[_0xfb93('0x15')][_0xfb93('0x13')]);}})[_0xfb93('0x16')](function(_0x34d68c){logger['error'](_0xfb93('0x12'),_0x61411e,_0x34d68c);_0x30882a(_0x34d68c);});});} \ No newline at end of file +var _0xca6d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x8e6e61,_0x46ee60){var _0x5507c0=function(_0x1e0b9c){while(--_0x1e0b9c){_0x8e6e61['push'](_0x8e6e61['shift']());}};_0x5507c0(++_0x46ee60);}(_0xca6d,0x74));var _0xdca6=function(_0xc3b08e,_0x427235){_0xc3b08e=_0xc3b08e-0x0;var _0x4c5e08=_0xca6d[_0xc3b08e];return _0x4c5e08;};'use strict';var _=require(_0xdca6('0x0'));var util=require(_0xdca6('0x1'));var moment=require(_0xdca6('0x2'));var BPromise=require(_0xdca6('0x3'));var rs=require(_0xdca6('0x4'));var fs=require('fs');var Redis=require(_0xdca6('0x5'));var db=require(_0xdca6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdca6('0x7'));var config=require('../../config/environment');var jayson=require(_0xdca6('0x8'));var client=jayson[_0xdca6('0x9')][_0xdca6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548822,_0x5ae1ef,_0x557300){return new BPromise(function(_0x379b24,_0x47419f){return client[_0xdca6('0xb')](_0x548822,_0x557300)[_0xdca6('0xc')](function(_0x9e16bb){logger['info'](_0xdca6('0xd'),_0x5ae1ef,_0xdca6('0xe'));logger[_0xdca6('0xf')](_0xdca6('0x10'),_0x5ae1ef,_0xdca6('0xe'),JSON[_0xdca6('0x11')](_0x9e16bb));if(_0x9e16bb['error']){if(_0x9e16bb[_0xdca6('0x12')][_0xdca6('0x13')]===0x1f4){logger[_0xdca6('0x12')](_0xdca6('0xd'),_0x5ae1ef,_0x9e16bb['error']['message']);return _0x47419f(_0x9e16bb[_0xdca6('0x12')]['message']);}logger[_0xdca6('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5ae1ef,_0x9e16bb[_0xdca6('0x12')][_0xdca6('0x14')]);return _0x379b24(_0x9e16bb['error'][_0xdca6('0x14')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x5ae1ef,_0xdca6('0xe'));_0x379b24(_0x9e16bb[_0xdca6('0x15')]['message']);}})[_0xdca6('0x16')](function(_0x583417){logger['error'](_0xdca6('0xd'),_0x5ae1ef,_0x583417);_0x47419f(_0x583417);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ec79506..3896f3b 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 _0x25b0=['isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x25b0,0x140));var _0x025b=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x25b0[_0x4a5494];return _0x57cbb5;};'use strict';var multer=require(_0x025b('0x0'));var util=require(_0x025b('0x1'));var path=require(_0x025b('0x2'));var timeout=require(_0x025b('0x3'));var express=require(_0x025b('0x4'));var router=express[_0x025b('0x5')]();var auth=require(_0x025b('0x6'));var interaction=require(_0x025b('0x7'));var config=require(_0x025b('0x8'));var controller=require(_0x025b('0x9'));router['get']('/',auth[_0x025b('0xa')](),controller[_0x025b('0xb')]);router[_0x025b('0xc')]('/:id',auth[_0x025b('0xa')](),controller[_0x025b('0xd')]);router[_0x025b('0xe')]('/',auth[_0x025b('0xa')](),controller[_0x025b('0xf')]);router[_0x025b('0x10')](_0x025b('0x11'),auth['isAuthenticated'](),controller[_0x025b('0x12')]);router[_0x025b('0x13')](_0x025b('0x11'),auth[_0x025b('0xa')](),controller[_0x025b('0x14')]);module[_0x025b('0x15')]=router; \ No newline at end of file +var _0x3d1f=['Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','path','connect-timeout'];(function(_0x139c07,_0x5b120c){var _0xda8e22=function(_0x37d955){while(--_0x37d955){_0x139c07['push'](_0x139c07['shift']());}};_0xda8e22(++_0x5b120c);}(_0x3d1f,0x163));var _0xf3d1=function(_0x15b593,_0x28767f){_0x15b593=_0x15b593-0x0;var _0x2c285f=_0x3d1f[_0x15b593];return _0x2c285f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf3d1('0x0'));var timeout=require(_0xf3d1('0x1'));var express=require('express');var router=express[_0xf3d1('0x2')]();var auth=require(_0xf3d1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf3d1('0x4'));var controller=require(_0xf3d1('0x5'));router[_0xf3d1('0x6')]('/',auth['isAuthenticated'](),controller[_0xf3d1('0x7')]);router[_0xf3d1('0x6')](_0xf3d1('0x8'),auth[_0xf3d1('0x9')](),controller[_0xf3d1('0xa')]);router[_0xf3d1('0xb')]('/',auth[_0xf3d1('0x9')](),controller[_0xf3d1('0xc')]);router[_0xf3d1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf3d1('0xe')]);router['delete']('/:id',auth[_0xf3d1('0x9')](),controller[_0xf3d1('0xf')]);module[_0xf3d1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 8858182..d9db404 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 _0x769c=['STRING','variable','BOOLEAN','sequelize','ENUM','string','keyValue'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x769c,0x96));var _0xc769=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x769c[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xc769('0x0'));module['exports']={'type':{'type':Sequelize[_0xc769('0x1')](_0xc769('0x2'),'variable','customVariable',_0xc769('0x3')),'defaultValue':_0xc769('0x2')},'content':{'type':Sequelize[_0xc769('0x4')]},'key':{'type':Sequelize[_0xc769('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xc769('0x2'),_0xc769('0x5'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc769('0x4')]},'nameField':{'type':Sequelize[_0xc769('0x4')]},'customField':{'type':Sequelize[_0xc769('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc769('0x4')]}}; \ No newline at end of file +var _0x66fa=['sequelize','exports','ENUM','customVariable','keyValue','string','STRING','variable','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66fa,0x168));var _0xa66f=function(_0x222170,_0x4cffcf){_0x222170=_0x222170-0x0;var _0x4dd378=_0x66fa[_0x222170];return _0x4dd378;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'type':{'type':Sequelize[_0xa66f('0x2')]('string','variable',_0xa66f('0x3'),_0xa66f('0x4')),'defaultValue':_0xa66f('0x5')},'content':{'type':Sequelize[_0xa66f('0x6')]},'key':{'type':Sequelize[_0xa66f('0x6')]},'keyType':{'type':Sequelize[_0xa66f('0x2')](_0xa66f('0x5'),_0xa66f('0x7'),_0xa66f('0x3'))},'keyContent':{'type':Sequelize[_0xa66f('0x6')]},'idField':{'type':Sequelize[_0xa66f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa66f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d2aa3a0..1da5971 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 _0x5fae=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash'];(function(_0xcf0e7b,_0x311b1f){var _0x3781ce=function(_0x13ba35){while(--_0x13ba35){_0xcf0e7b['push'](_0xcf0e7b['shift']());}};_0x3781ce(++_0x311b1f);}(_0x5fae,0x82));var _0xe5fa=function(_0x473333,_0x5bfad4){_0x473333=_0x473333-0x0;var _0xb33117=_0x5fae[_0x473333];return _0xb33117;};'use strict';var pdf=require(_0xe5fa('0x0'));var emlformat=require(_0xe5fa('0x1'));var rimraf=require(_0xe5fa('0x2'));var zipdir=require(_0xe5fa('0x3'));var jsonpatch=require(_0xe5fa('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe5fa('0x5'));var Mustache=require(_0xe5fa('0x6'));var util=require(_0xe5fa('0x7'));var path=require(_0xe5fa('0x8'));var sox=require('sox');var csv=require(_0xe5fa('0x9'));var ejs=require(_0xe5fa('0xa'));var fs=require('fs');var _=require(_0xe5fa('0xb'));var squel=require(_0xe5fa('0xc'));var crypto=require(_0xe5fa('0xd'));var jsforce=require(_0xe5fa('0xe'));var deskjs=require(_0xe5fa('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe5fa('0x10'));var Redis=require(_0xe5fa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5fa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5fa('0x13'));var logger=require(_0xe5fa('0x14'))('api');var utils=require(_0xe5fa('0x15'));var config=require('../../config/environment');var db=require(_0xe5fa('0x16'))['db'];function respondWithStatusCode(_0x160505,_0x133c66){_0x133c66=_0x133c66||0xcc;return function(_0x13cde2){if(_0x13cde2){return _0x160505['sendStatus'](_0x133c66);}return _0x160505[_0xe5fa('0x17')](_0x133c66)[_0xe5fa('0x18')]();};}function respondWithResult(_0x25a4b4,_0x56c98b){_0x56c98b=_0x56c98b||0xc8;return function(_0x3924a3){if(_0x3924a3){return _0x25a4b4[_0xe5fa('0x17')](_0x56c98b)[_0xe5fa('0x19')](_0x3924a3);}};}function respondWithFilteredResult(_0x4fe29d,_0x238047){return function(_0x5f069d){if(_0x5f069d){var _0x4cce07=_0x5f069d[_0xe5fa('0x1a')],_0x30412b=_0x238047['offset'],_0xa36a5e=_0x238047[_0xe5fa('0x1b')]+_0x238047[_0xe5fa('0x1c')],_0x5ab861;if(_0xa36a5e>=_0x4cce07){_0xa36a5e=_0x4cce07;_0x5ab861=0xc8;}else{_0x5ab861=0xce;}_0x4fe29d[_0xe5fa('0x17')](_0x5ab861);return _0x4fe29d[_0xe5fa('0x1d')](_0xe5fa('0x1e'),_0x30412b+'-'+_0xa36a5e+'/'+_0x4cce07)[_0xe5fa('0x19')](_0x5f069d);}return null;};}function patchUpdates(_0x29e2b3){return function(_0x2ce4df){try{jsonpatch['apply'](_0x2ce4df,_0x29e2b3,!![]);}catch(_0x38fc7c){return BPromise[_0xe5fa('0x1f')](_0x38fc7c);}return _0x2ce4df['save']();};}function saveUpdates(_0x5ce393,_0x7c7e69){return function(_0x702355){if(_0x702355){return _0x702355['update'](_0x5ce393)[_0xe5fa('0x20')](function(_0xd5f389){return _0xd5f389;});}return null;};}function removeEntity(_0x29b0be,_0x465e41){return function(_0x4b7ffe){if(_0x4b7ffe){return _0x4b7ffe[_0xe5fa('0x21')]()['then'](function(){_0x29b0be[_0xe5fa('0x17')](0xcc)[_0xe5fa('0x18')]();});}};}function handleEntityNotFound(_0x3963f6,_0x1ac647){return function(_0x35f30f){if(!_0x35f30f){_0x3963f6['sendStatus'](0x194);}return _0x35f30f;};}function handleError(_0xa4a176,_0x19eb80){_0x19eb80=_0x19eb80||0x1f4;return function(_0x47c404){logger[_0xe5fa('0x22')](_0x47c404[_0xe5fa('0x23')]);if(_0x47c404[_0xe5fa('0x24')]){delete _0x47c404['name'];}_0xa4a176[_0xe5fa('0x17')](_0x19eb80)[_0xe5fa('0x25')](_0x47c404);};}exports[_0xe5fa('0x26')]=function(_0x32f802,_0x848d85){var _0x3a3801={},_0x495afe={},_0x15a008={'count':0x0,'rows':[]};var _0x3a3414=_['map'](db[_0xe5fa('0x27')][_0xe5fa('0x28')],function(_0x39a64a){return{'name':_0x39a64a[_0xe5fa('0x29')],'type':_0x39a64a[_0xe5fa('0x2a')][_0xe5fa('0x2b')]};});_0x495afe['model']=_[_0xe5fa('0x2c')](_0x3a3414,_0xe5fa('0x24'));_0x495afe[_0xe5fa('0x2d')]=_[_0xe5fa('0x2e')](_0x32f802[_0xe5fa('0x2d')]);_0x495afe[_0xe5fa('0x2f')]=_[_0xe5fa('0x30')](_0x495afe[_0xe5fa('0x31')],_0x495afe[_0xe5fa('0x2d')]);_0x3a3801['attributes']=_[_0xe5fa('0x30')](_0x495afe['model'],qs['fields'](_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x32')]));_0x3a3801['attributes']=_0x3a3801[_0xe5fa('0x33')]['length']?_0x3a3801[_0xe5fa('0x33')]:_0x495afe['model'];if(!_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x34')]('nolimit')){_0x3a3801['limit']=qs['limit'](_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x1c')]);_0x3a3801[_0xe5fa('0x1b')]=qs['offset'](_0x32f802['query'][_0xe5fa('0x1b')]);}_0x3a3801['order']=qs[_0xe5fa('0x35')](_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x35')]);_0x3a3801['where']=qs[_0xe5fa('0x2f')](_[_0xe5fa('0x36')](_0x32f802[_0xe5fa('0x2d')],_0x495afe[_0xe5fa('0x2f')]),_0x3a3414);if(_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x37')]){_0x3a3801[_0xe5fa('0x38')]=_[_0xe5fa('0x39')](_0x3a3801[_0xe5fa('0x38')],{'$or':_['map'](_0x3a3414,function(_0x49ff42){if(_0x49ff42[_0xe5fa('0x2a')]!=='VIRTUAL'){var _0x4f3c85={};_0x4f3c85[_0x49ff42['name']]={'$like':'%'+_0x32f802['query'][_0xe5fa('0x37')]+'%'};return _0x4f3c85;}})});}_0x3a3801=_[_0xe5fa('0x39')]({},_0x3a3801,_0x32f802[_0xe5fa('0x3a')]);var _0xdc8674={'where':_0x3a3801['where']};return db['ZendeskField'][_0xe5fa('0x1a')](_0xdc8674)[_0xe5fa('0x20')](function(_0x46f127){_0x15a008[_0xe5fa('0x1a')]=_0x46f127;if(_0x32f802[_0xe5fa('0x2d')][_0xe5fa('0x3b')]){_0x3a3801[_0xe5fa('0x3c')]=[{'all':!![]}];}return db[_0xe5fa('0x27')][_0xe5fa('0x3d')](_0x3a3801);})[_0xe5fa('0x20')](function(_0x50f001){_0x15a008[_0xe5fa('0x3e')]=_0x50f001;return _0x15a008;})[_0xe5fa('0x20')](respondWithFilteredResult(_0x848d85,_0x3a3801))[_0xe5fa('0x3f')](handleError(_0x848d85,null));};exports[_0xe5fa('0x40')]=function(_0x5a66d9,_0x1c5003){var _0x46543a={'raw':!![],'where':{'id':_0x5a66d9[_0xe5fa('0x41')]['id']}},_0x1d8b2e={};_0x1d8b2e[_0xe5fa('0x31')]=_['keys'](db[_0xe5fa('0x27')][_0xe5fa('0x28')]);_0x1d8b2e[_0xe5fa('0x2d')]=_[_0xe5fa('0x2e')](_0x5a66d9[_0xe5fa('0x2d')]);_0x1d8b2e[_0xe5fa('0x2f')]=_[_0xe5fa('0x30')](_0x1d8b2e['model'],_0x1d8b2e[_0xe5fa('0x2d')]);_0x46543a['attributes']=_[_0xe5fa('0x30')](_0x1d8b2e['model'],qs['fields'](_0x5a66d9[_0xe5fa('0x2d')][_0xe5fa('0x32')]));_0x46543a[_0xe5fa('0x33')]=_0x46543a[_0xe5fa('0x33')][_0xe5fa('0x42')]?_0x46543a[_0xe5fa('0x33')]:_0x1d8b2e['model'];if(_0x5a66d9[_0xe5fa('0x2d')][_0xe5fa('0x3b')]){_0x46543a[_0xe5fa('0x3c')]=[{'all':!![]}];}_0x46543a=_[_0xe5fa('0x39')]({},_0x46543a,_0x5a66d9[_0xe5fa('0x3a')]);return db[_0xe5fa('0x27')][_0xe5fa('0x43')](_0x46543a)['then'](handleEntityNotFound(_0x1c5003,null))[_0xe5fa('0x20')](respondWithResult(_0x1c5003,null))[_0xe5fa('0x3f')](handleError(_0x1c5003,null));};exports[_0xe5fa('0x44')]=function(_0x11510c,_0x5c0778){return db['ZendeskField'][_0xe5fa('0x44')](_0x11510c['body'],{})['then'](respondWithResult(_0x5c0778,0xc9))[_0xe5fa('0x3f')](handleError(_0x5c0778,null));};exports[_0xe5fa('0x45')]=function(_0x2f6cc5,_0x34d2ea){if(_0x2f6cc5[_0xe5fa('0x46')]['id']){delete _0x2f6cc5[_0xe5fa('0x46')]['id'];}return db[_0xe5fa('0x27')][_0xe5fa('0x43')]({'where':{'id':_0x2f6cc5[_0xe5fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x34d2ea,null))[_0xe5fa('0x20')](saveUpdates(_0x2f6cc5[_0xe5fa('0x46')],null))[_0xe5fa('0x20')](respondWithResult(_0x34d2ea,null))['catch'](handleError(_0x34d2ea,null));};exports['destroy']=function(_0x2b4c2d,_0xaebf3){return db[_0xe5fa('0x27')][_0xe5fa('0x43')]({'where':{'id':_0x2b4c2d[_0xe5fa('0x41')]['id']}})[_0xe5fa('0x20')](handleEntityNotFound(_0xaebf3,null))[_0xe5fa('0x20')](removeEntity(_0xaebf3,null))['catch'](handleError(_0xaebf3,null));}; \ No newline at end of file +var _0xfc0e=['filters','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','map','keys'];(function(_0x358c99,_0x4c17ab){var _0x354267=function(_0x21d4e4){while(--_0x21d4e4){_0x358c99['push'](_0x358c99['shift']());}};_0x354267(++_0x4c17ab);}(_0xfc0e,0x1d4));var _0xefc0=function(_0xf6e75d,_0xc70967){_0xf6e75d=_0xf6e75d-0x0;var _0x27514d=_0xfc0e[_0xf6e75d];return _0x27514d;};'use strict';var pdf=require(_0xefc0('0x0'));var emlformat=require(_0xefc0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xefc0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefc0('0x3'));var moment=require(_0xefc0('0x4'));var BPromise=require(_0xefc0('0x5'));var Mustache=require(_0xefc0('0x6'));var util=require(_0xefc0('0x7'));var path=require(_0xefc0('0x8'));var sox=require(_0xefc0('0x9'));var csv=require(_0xefc0('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xefc0('0xb'));var squel=require(_0xefc0('0xc'));var crypto=require(_0xefc0('0xd'));var jsforce=require(_0xefc0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xefc0('0xf'));var Redis=require(_0xefc0('0x10'));var authService=require(_0xefc0('0x11'));var qs=require(_0xefc0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefc0('0x13'));var logger=require(_0xefc0('0x14'))(_0xefc0('0x15'));var utils=require(_0xefc0('0x16'));var config=require(_0xefc0('0x17'));var db=require(_0xefc0('0x18'))['db'];function respondWithStatusCode(_0x4f81da,_0x558b3d){_0x558b3d=_0x558b3d||0xcc;return function(_0x57d220){if(_0x57d220){return _0x4f81da['sendStatus'](_0x558b3d);}return _0x4f81da[_0xefc0('0x19')](_0x558b3d)[_0xefc0('0x1a')]();};}function respondWithResult(_0x225861,_0xf01e44){_0xf01e44=_0xf01e44||0xc8;return function(_0x10882a){if(_0x10882a){return _0x225861[_0xefc0('0x19')](_0xf01e44)['json'](_0x10882a);}};}function respondWithFilteredResult(_0x4f9b87,_0x38366a){return function(_0x959c59){if(_0x959c59){var _0x15947f=_0x959c59[_0xefc0('0x1b')],_0x180d8a=_0x38366a['offset'],_0x14ee89=_0x38366a[_0xefc0('0x1c')]+_0x38366a[_0xefc0('0x1d')],_0x5c6647;if(_0x14ee89>=_0x15947f){_0x14ee89=_0x15947f;_0x5c6647=0xc8;}else{_0x5c6647=0xce;}_0x4f9b87[_0xefc0('0x19')](_0x5c6647);return _0x4f9b87[_0xefc0('0x1e')]('Content-Range',_0x180d8a+'-'+_0x14ee89+'/'+_0x15947f)[_0xefc0('0x1f')](_0x959c59);}return null;};}function patchUpdates(_0x47197f){return function(_0x389557){try{jsonpatch[_0xefc0('0x20')](_0x389557,_0x47197f,!![]);}catch(_0xb27d61){return BPromise[_0xefc0('0x21')](_0xb27d61);}return _0x389557['save']();};}function saveUpdates(_0x1c6688,_0x42a1cf){return function(_0x56102c){if(_0x56102c){return _0x56102c[_0xefc0('0x22')](_0x1c6688)[_0xefc0('0x23')](function(_0x1edfc5){return _0x1edfc5;});}return null;};}function removeEntity(_0xa8d006,_0x135a5){return function(_0x39c023){if(_0x39c023){return _0x39c023[_0xefc0('0x24')]()[_0xefc0('0x23')](function(){_0xa8d006[_0xefc0('0x19')](0xcc)[_0xefc0('0x1a')]();});}};}function handleEntityNotFound(_0x5d698a,_0x4da9c3){return function(_0x41b115){if(!_0x41b115){_0x5d698a[_0xefc0('0x25')](0x194);}return _0x41b115;};}function handleError(_0x1b9771,_0x452885){_0x452885=_0x452885||0x1f4;return function(_0x59ad7a){logger[_0xefc0('0x26')](_0x59ad7a[_0xefc0('0x27')]);if(_0x59ad7a[_0xefc0('0x28')]){delete _0x59ad7a[_0xefc0('0x28')];}_0x1b9771[_0xefc0('0x19')](_0x452885)[_0xefc0('0x29')](_0x59ad7a);};}exports[_0xefc0('0x2a')]=function(_0x50d2ed,_0x10cd53){var _0x5a7a7a={},_0x6605e2={},_0x5583e1={'count':0x0,'rows':[]};var _0x44ebc5=_['map'](db[_0xefc0('0x2b')][_0xefc0('0x2c')],function(_0x367ae8){return{'name':_0x367ae8[_0xefc0('0x2d')],'type':_0x367ae8[_0xefc0('0x2e')][_0xefc0('0x2f')]};});_0x6605e2['model']=_[_0xefc0('0x30')](_0x44ebc5,_0xefc0('0x28'));_0x6605e2['query']=_[_0xefc0('0x31')](_0x50d2ed['query']);_0x6605e2[_0xefc0('0x32')]=_[_0xefc0('0x33')](_0x6605e2[_0xefc0('0x34')],_0x6605e2[_0xefc0('0x35')]);_0x5a7a7a[_0xefc0('0x36')]=_['intersection'](_0x6605e2['model'],qs[_0xefc0('0x37')](_0x50d2ed['query']['fields']));_0x5a7a7a[_0xefc0('0x36')]=_0x5a7a7a[_0xefc0('0x36')]['length']?_0x5a7a7a[_0xefc0('0x36')]:_0x6605e2['model'];if(!_0x50d2ed[_0xefc0('0x35')][_0xefc0('0x38')]('nolimit')){_0x5a7a7a[_0xefc0('0x1d')]=qs[_0xefc0('0x1d')](_0x50d2ed[_0xefc0('0x35')]['limit']);_0x5a7a7a[_0xefc0('0x1c')]=qs[_0xefc0('0x1c')](_0x50d2ed[_0xefc0('0x35')]['offset']);}_0x5a7a7a[_0xefc0('0x39')]=qs[_0xefc0('0x3a')](_0x50d2ed['query'][_0xefc0('0x3a')]);_0x5a7a7a['where']=qs[_0xefc0('0x32')](_[_0xefc0('0x3b')](_0x50d2ed[_0xefc0('0x35')],_0x6605e2[_0xefc0('0x32')]),_0x44ebc5);if(_0x50d2ed[_0xefc0('0x35')][_0xefc0('0x3c')]){_0x5a7a7a[_0xefc0('0x3d')]=_[_0xefc0('0x3e')](_0x5a7a7a[_0xefc0('0x3d')],{'$or':_[_0xefc0('0x30')](_0x44ebc5,function(_0x34aff2){if(_0x34aff2[_0xefc0('0x2e')]!==_0xefc0('0x3f')){var _0x4549f5={};_0x4549f5[_0x34aff2['name']]={'$like':'%'+_0x50d2ed[_0xefc0('0x35')]['filter']+'%'};return _0x4549f5;}})});}_0x5a7a7a=_[_0xefc0('0x3e')]({},_0x5a7a7a,_0x50d2ed[_0xefc0('0x40')]);var _0x210f8e={'where':_0x5a7a7a[_0xefc0('0x3d')]};return db[_0xefc0('0x2b')][_0xefc0('0x1b')](_0x210f8e)[_0xefc0('0x23')](function(_0x5281fb){_0x5583e1[_0xefc0('0x1b')]=_0x5281fb;if(_0x50d2ed[_0xefc0('0x35')][_0xefc0('0x41')]){_0x5a7a7a[_0xefc0('0x42')]=[{'all':!![]}];}return db[_0xefc0('0x2b')]['findAll'](_0x5a7a7a);})[_0xefc0('0x23')](function(_0x5ede33){_0x5583e1[_0xefc0('0x43')]=_0x5ede33;return _0x5583e1;})['then'](respondWithFilteredResult(_0x10cd53,_0x5a7a7a))[_0xefc0('0x44')](handleError(_0x10cd53,null));};exports[_0xefc0('0x45')]=function(_0x41c323,_0x5c23ac){var _0x267a22={'raw':!![],'where':{'id':_0x41c323[_0xefc0('0x46')]['id']}},_0x8e98bc={};_0x8e98bc[_0xefc0('0x34')]=_[_0xefc0('0x31')](db[_0xefc0('0x2b')][_0xefc0('0x2c')]);_0x8e98bc[_0xefc0('0x35')]=_[_0xefc0('0x31')](_0x41c323[_0xefc0('0x35')]);_0x8e98bc[_0xefc0('0x32')]=_['intersection'](_0x8e98bc[_0xefc0('0x34')],_0x8e98bc[_0xefc0('0x35')]);_0x267a22[_0xefc0('0x36')]=_[_0xefc0('0x33')](_0x8e98bc['model'],qs[_0xefc0('0x37')](_0x41c323[_0xefc0('0x35')][_0xefc0('0x37')]));_0x267a22[_0xefc0('0x36')]=_0x267a22[_0xefc0('0x36')]['length']?_0x267a22[_0xefc0('0x36')]:_0x8e98bc[_0xefc0('0x34')];if(_0x41c323['query'][_0xefc0('0x41')]){_0x267a22['include']=[{'all':!![]}];}_0x267a22=_[_0xefc0('0x3e')]({},_0x267a22,_0x41c323[_0xefc0('0x40')]);return db[_0xefc0('0x2b')][_0xefc0('0x47')](_0x267a22)['then'](handleEntityNotFound(_0x5c23ac,null))[_0xefc0('0x23')](respondWithResult(_0x5c23ac,null))[_0xefc0('0x44')](handleError(_0x5c23ac,null));};exports['create']=function(_0x581115,_0x15a942){return db[_0xefc0('0x2b')][_0xefc0('0x48')](_0x581115[_0xefc0('0x49')],{})[_0xefc0('0x23')](respondWithResult(_0x15a942,0xc9))[_0xefc0('0x44')](handleError(_0x15a942,null));};exports[_0xefc0('0x22')]=function(_0x591a63,_0x4738e7){if(_0x591a63[_0xefc0('0x49')]['id']){delete _0x591a63['body']['id'];}return db[_0xefc0('0x2b')][_0xefc0('0x47')]({'where':{'id':_0x591a63['params']['id']}})[_0xefc0('0x23')](handleEntityNotFound(_0x4738e7,null))[_0xefc0('0x23')](saveUpdates(_0x591a63[_0xefc0('0x49')],null))[_0xefc0('0x23')](respondWithResult(_0x4738e7,null))[_0xefc0('0x44')](handleError(_0x4738e7,null));};exports[_0xefc0('0x24')]=function(_0x58f1f5,_0x3aa216){return db[_0xefc0('0x2b')][_0xefc0('0x47')]({'where':{'id':_0x58f1f5[_0xefc0('0x46')]['id']}})['then'](handleEntityNotFound(_0x3aa216,null))[_0xefc0('0x23')](removeEntity(_0x3aa216,null))[_0xefc0('0x44')](handleError(_0x3aa216,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a492dd3..833d43f 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 _0x42f4=['moment','bluebird','request-promise','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','../../config/logger','api'];(function(_0x1e3bc9,_0x26f07a){var _0x5ed15f=function(_0x50c132){while(--_0x50c132){_0x1e3bc9['push'](_0x1e3bc9['shift']());}};_0x5ed15f(++_0x26f07a);}(_0x42f4,0x19d));var _0x442f=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x42f4[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('0xa'),'paranoid':![],'indexes':[{'name':_0x442f('0xb'),'fields':[_0x442f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a5c=['exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes'];(function(_0x7c3bae,_0x2fb37d){var _0x460159=function(_0x5d7644){while(--_0x5d7644){_0x7c3bae['push'](_0x7c3bae['shift']());}};_0x460159(++_0x2fb37d);}(_0x8a5c,0x136));var _0xc8a5=function(_0x2a8087,_0x457331){_0x2a8087=_0x2a8087-0x0;var _0x200dbe=_0x8a5c[_0x2a8087];return _0x200dbe;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var logger=require(_0xc8a5('0x2'))(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require(_0xc8a5('0x5'));var rp=require(_0xc8a5('0x6'));var fs=require('fs');var path=require(_0xc8a5('0x7'));var rimraf=require(_0xc8a5('0x8'));var config=require('../../config/environment');var attributes=require(_0xc8a5('0x9'));module[_0xc8a5('0xa')]=function(_0x5b6cc2,_0x1b4ed4){return _0x5b6cc2[_0xc8a5('0xb')](_0xc8a5('0xc'),attributes,{'tableName':_0xc8a5('0xd'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xc8a5('0xe'),_0xc8a5('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 4b7f875..59f061b 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 _0x196e=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x1c4622,_0x276630){var _0x2a0bd1=function(_0x5de1b6){while(--_0x5de1b6){_0x1c4622['push'](_0x1c4622['shift']());}};_0x2a0bd1(++_0x276630);}(_0x196e,0xe1));var _0xe196=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x196e[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xe196('0x0'));var util=require(_0xe196('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe196('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe196('0x3'))['db'];var utils=require(_0xe196('0x4'));var logger=require(_0xe196('0x5'))(_0xe196('0x6'));var config=require(_0xe196('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe196('0x8')][_0xe196('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19046f,_0x4bf924,_0x12b4fd){return new BPromise(function(_0x1fd464,_0x770701){return client[_0xe196('0xa')](_0x19046f,_0x12b4fd)[_0xe196('0xb')](function(_0x26d6b9){logger[_0xe196('0xc')](_0xe196('0xd'),_0x4bf924,_0xe196('0xe'));logger[_0xe196('0xf')](_0xe196('0x10'),_0x4bf924,_0xe196('0xe'),JSON[_0xe196('0x11')](_0x26d6b9));if(_0x26d6b9[_0xe196('0x12')]){if(_0x26d6b9[_0xe196('0x12')][_0xe196('0x13')]===0x1f4){logger[_0xe196('0x12')](_0xe196('0xd'),_0x4bf924,_0x26d6b9[_0xe196('0x12')][_0xe196('0x14')]);return _0x770701(_0x26d6b9[_0xe196('0x12')][_0xe196('0x14')]);}logger[_0xe196('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4bf924,_0x26d6b9[_0xe196('0x12')][_0xe196('0x14')]);return _0x1fd464(_0x26d6b9[_0xe196('0x12')]['message']);}else{logger[_0xe196('0xc')](_0xe196('0xd'),_0x4bf924,'request\x20sent');_0x1fd464(_0x26d6b9[_0xe196('0x15')][_0xe196('0x14')]);}})[_0xe196('0x16')](function(_0x293090){logger[_0xe196('0x12')](_0xe196('0xd'),_0x4bf924,_0x293090);_0x770701(_0x293090);});});} \ No newline at end of file +var _0x3095=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment'];(function(_0x3c4298,_0x35155f){var _0x4517ae=function(_0x46e2c4){while(--_0x46e2c4){_0x3c4298['push'](_0x3c4298['shift']());}};_0x4517ae(++_0x35155f);}(_0x3095,0xc6));var _0x5309=function(_0x5cbcdf,_0x2224a4){_0x5cbcdf=_0x5cbcdf-0x0;var _0x4be16f=_0x3095[_0x5cbcdf];return _0x4be16f;};'use strict';var _=require('lodash');var util=require(_0x5309('0x0'));var moment=require(_0x5309('0x1'));var BPromise=require(_0x5309('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5309('0x3'));var db=require(_0x5309('0x4'))['db'];var utils=require(_0x5309('0x5'));var logger=require(_0x5309('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5309('0x7'));var client=jayson[_0x5309('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5755ba,_0x45a496,_0x1628c3){return new BPromise(function(_0x50873c,_0x1b73b5){return client[_0x5309('0x9')](_0x5755ba,_0x1628c3)[_0x5309('0xa')](function(_0x3ac459){logger[_0x5309('0xb')](_0x5309('0xc'),_0x45a496,_0x5309('0xd'));logger[_0x5309('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x45a496,_0x5309('0xd'),JSON['stringify'](_0x3ac459));if(_0x3ac459['error']){if(_0x3ac459[_0x5309('0xf')][_0x5309('0x10')]===0x1f4){logger['error'](_0x5309('0xc'),_0x45a496,_0x3ac459[_0x5309('0xf')][_0x5309('0x11')]);return _0x1b73b5(_0x3ac459['error']['message']);}logger['error'](_0x5309('0xc'),_0x45a496,_0x3ac459[_0x5309('0xf')]['message']);return _0x50873c(_0x3ac459[_0x5309('0xf')][_0x5309('0x11')]);}else{logger[_0x5309('0xb')]('ZendeskField,\x20%s,\x20%s',_0x45a496,'request\x20sent');_0x50873c(_0x3ac459[_0x5309('0x12')][_0x5309('0x11')]);}})[_0x5309('0x13')](function(_0xe3b701){logger[_0x5309('0xf')](_0x5309('0xc'),_0x45a496,_0xe3b701);_0x1b73b5(_0xe3b701);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 5e9ab8b..37ca856 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 _0xe822=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2c84c1,_0x49ba6a){var _0xd91ee8=function(_0x3c641a){while(--_0x3c641a){_0x2c84c1['push'](_0x2c84c1['shift']());}};_0xd91ee8(++_0x49ba6a);}(_0xe822,0xfd));var _0x2e82=function(_0x3e40bd,_0x12b79e){_0x3e40bd=_0x3e40bd-0x0;var _0x200a86=_0xe822[_0x3e40bd];return _0x200a86;};'use strict';var multer=require(_0x2e82('0x0'));var util=require(_0x2e82('0x1'));var path=require(_0x2e82('0x2'));var timeout=require(_0x2e82('0x3'));var express=require(_0x2e82('0x4'));var router=express[_0x2e82('0x5')]();var auth=require(_0x2e82('0x6'));var interaction=require(_0x2e82('0x7'));var config=require(_0x2e82('0x8'));var controller=require(_0x2e82('0x9'));router[_0x2e82('0xa')]('/',auth[_0x2e82('0xb')](),controller[_0x2e82('0xc')]);router[_0x2e82('0xa')]('/:id',auth[_0x2e82('0xb')](),controller[_0x2e82('0xd')]);router[_0x2e82('0xa')]('/:id/configurations',auth[_0x2e82('0xb')](),controller[_0x2e82('0xe')]);router[_0x2e82('0xa')](_0x2e82('0xf'),auth[_0x2e82('0xb')](),controller['getFields']);router[_0x2e82('0x10')]('/',auth[_0x2e82('0xb')](),controller[_0x2e82('0x11')]);router[_0x2e82('0x10')](_0x2e82('0x12'),auth[_0x2e82('0xb')](),controller[_0x2e82('0x13')]);router[_0x2e82('0x14')](_0x2e82('0x15'),auth['isAuthenticated'](),controller[_0x2e82('0x16')]);router[_0x2e82('0x17')](_0x2e82('0x15'),auth[_0x2e82('0xb')](),controller[_0x2e82('0x18')]);module[_0x2e82('0x19')]=router; \ No newline at end of file +var _0x08e3=['util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','/:id','destroy','exports','multer'];(function(_0x4c0ff1,_0x435923){var _0x56f73e=function(_0x349c73){while(--_0x349c73){_0x4c0ff1['push'](_0x4c0ff1['shift']());}};_0x56f73e(++_0x435923);}(_0x08e3,0x142));var _0x308e=function(_0x444ba8,_0x375704){_0x444ba8=_0x444ba8-0x0;var _0x325f47=_0x08e3[_0x444ba8];return _0x325f47;};'use strict';var multer=require(_0x308e('0x0'));var util=require(_0x308e('0x1'));var path=require('path');var timeout=require(_0x308e('0x2'));var express=require('express');var router=express[_0x308e('0x3')]();var auth=require(_0x308e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x308e('0x5'));var controller=require('./intZohoAccount.controller');router[_0x308e('0x6')]('/',auth[_0x308e('0x7')](),controller[_0x308e('0x8')]);router[_0x308e('0x6')]('/:id',auth[_0x308e('0x7')](),controller[_0x308e('0x9')]);router[_0x308e('0x6')](_0x308e('0xa'),auth[_0x308e('0x7')](),controller[_0x308e('0xb')]);router[_0x308e('0x6')]('/:id/fields',auth[_0x308e('0x7')](),controller[_0x308e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x308e('0xd')]);router[_0x308e('0xe')](_0x308e('0xa'),auth['isAuthenticated'](),controller[_0x308e('0xf')]);router['put'](_0x308e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x308e('0x11')]);module[_0x308e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b3bc125..b68ac13 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 _0x0fe2=['sequelize','STRING'];(function(_0x10fdef,_0x8a8aff){var _0x545bfc=function(_0x30f43d){while(--_0x30f43d){_0x10fdef['push'](_0x10fdef['shift']());}};_0x545bfc(++_0x8a8aff);}(_0x0fe2,0x9e));var _0x20fe=function(_0x3192e3,_0x3639b7){_0x3192e3=_0x3192e3-0x0;var _0x234915=_0x0fe2[_0x3192e3];return _0x234915;};'use strict';var Sequelize=require(_0x20fe('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x20fe('0x1')]},'zone':{'type':Sequelize[_0x20fe('0x1')]},'clientId':{'type':Sequelize[_0x20fe('0x1')]},'clientSecret':{'type':Sequelize[_0x20fe('0x1')]},'serverUrl':{'type':Sequelize[_0x20fe('0x1')]},'code':{'type':Sequelize[_0x20fe('0x1')]},'refreshToken':{'type':Sequelize[_0x20fe('0x1')]}}; \ No newline at end of file +var _0xbe79=['STRING','sequelize','exports'];(function(_0x447193,_0x1b602d){var _0x410ddf=function(_0x71e1e9){while(--_0x71e1e9){_0x447193['push'](_0x447193['shift']());}};_0x410ddf(++_0x1b602d);}(_0xbe79,0x169));var _0x9be7=function(_0x4fac81,_0x1cf513){_0x4fac81=_0x4fac81-0x0;var _0xc117c1=_0xbe79[_0x4fac81];return _0xc117c1;};'use strict';var Sequelize=require(_0x9be7('0x0'));module[_0x9be7('0x1')]={'name':{'type':Sequelize[_0x9be7('0x2')]},'description':{'type':Sequelize[_0x9be7('0x2')]},'host':{'type':Sequelize[_0x9be7('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9be7('0x2')]},'clientSecret':{'type':Sequelize[_0x9be7('0x2')]},'serverUrl':{'type':Sequelize[_0x9be7('0x2')]},'code':{'type':Sequelize[_0x9be7('0x2')]},'refreshToken':{'type':Sequelize[_0x9be7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 2c6f0f8..a86c081 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 _0x7932=['https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','host','serverUrl','code','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','api_name','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','map','ZohoAccount','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','rawAttributes','keys','includeAll','find','create','body','params','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x4591ee,_0x3a1daf){var _0x4cdb81=function(_0x22b5cf){while(--_0x22b5cf){_0x4591ee['push'](_0x4591ee['shift']());}};_0x4cdb81(++_0x3a1daf);}(_0x7932,0xa8));var _0x2793=function(_0x2100b8,_0x205963){_0x2100b8=_0x2100b8-0x0;var _0x4f2732=_0x7932[_0x2100b8];return _0x4f2732;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2793('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2793('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2793('0x2'));var moment=require(_0x2793('0x3'));var BPromise=require(_0x2793('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2793('0x5'));var csv=require(_0x2793('0x6'));var ejs=require(_0x2793('0x7'));var fs=require('fs');var _=require(_0x2793('0x8'));var squel=require(_0x2793('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2793('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2793('0xb'));var Papa=require(_0x2793('0xc'));var Redis=require(_0x2793('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2793('0xe'));var as=require(_0x2793('0xf'));var hardwareService=require(_0x2793('0x10'));var logger=require('../../config/logger')(_0x2793('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2793('0x12'))['db'];var integrations=require(_0x2793('0x13'));var jayson=require('jayson/promise');var client=jayson[_0x2793('0x14')][_0x2793('0x15')]({'port':0x232a});function checkPasswordPattern(_0x243820,_0x22009e,_0x54571a){if(_0x54571a){var _0x5b9367=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b9367[_0x2793('0x16')](_0x22009e)){return _0x243820;}else{throw new db[(_0x2793('0x17'))][(_0x2793('0x18'))](_0x2793('0x19'));}}else{return _0x243820;}}function respondWithRpcPromise(_0x1ec94e,_0x68f351,_0x347c64,_0x1d6526){return new BPromise(function(_0x38dab1,_0x2a1f12){var _0x4bd038=_0x1d6526||client;return _0x4bd038[_0x2793('0x1a')](_0x1ec94e,_0x347c64)[_0x2793('0x1b')](function(_0x15f14d){logger[_0x2793('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0x68f351,_0x2793('0x1d'));logger[_0x2793('0x1e')](_0x2793('0x1f'),_0x68f351,_0x2793('0x1d'),JSON[_0x2793('0x20')](_0x15f14d));if(_0x15f14d[_0x2793('0x21')]){if(_0x15f14d[_0x2793('0x21')]['code']===0x1f4){logger[_0x2793('0x21')](_0x2793('0x22'),_0x68f351,_0x15f14d['error'][_0x2793('0x23')]);return _0x2a1f12(_0x15f14d['error'][_0x2793('0x23')]);}logger[_0x2793('0x21')](_0x2793('0x22'),_0x68f351,_0x15f14d['error'][_0x2793('0x23')]);return _0x38dab1(_0x15f14d[_0x2793('0x21')][_0x2793('0x23')]);}else{logger[_0x2793('0x1c')](_0x2793('0x22'),_0x68f351,'request\x20sent');_0x38dab1(_0x15f14d[_0x2793('0x24')]['message']);}})[_0x2793('0x25')](function(_0x18dd61){logger['error'](_0x2793('0x22'),_0x68f351,_0x18dd61);_0x2a1f12(_0x18dd61);});});}function respondWithStatusCode(_0x40f637,_0x1e2046){_0x1e2046=_0x1e2046||0xcc;return function(_0x545155){if(_0x545155){return _0x40f637[_0x2793('0x26')](_0x1e2046);}return _0x40f637[_0x2793('0x27')](_0x1e2046)[_0x2793('0x28')]();};}function respondWithResult(_0x242e2b,_0x45a189){_0x45a189=_0x45a189||0xc8;return function(_0x196f32){if(_0x196f32){return _0x242e2b[_0x2793('0x27')](_0x45a189)[_0x2793('0x29')](_0x196f32);}};}function respondWithFilteredResult(_0x5c1ac2,_0x3f4cfe){return function(_0x346a84){if(_0x346a84){var _0x40899b=_0x346a84[_0x2793('0x2a')],_0x33d420=_0x3f4cfe[_0x2793('0x2b')],_0x34b170=_0x3f4cfe[_0x2793('0x2b')]+_0x3f4cfe[_0x2793('0x2c')],_0x2f11b8;if(_0x34b170>=_0x40899b){_0x34b170=_0x40899b;_0x2f11b8=0xc8;}else{_0x2f11b8=0xce;}_0x5c1ac2['status'](_0x2f11b8);return _0x5c1ac2['set'](_0x2793('0x2d'),_0x33d420+'-'+_0x34b170+'/'+_0x40899b)[_0x2793('0x29')](_0x346a84);}return null;};}function patchUpdates(_0x237115){return function(_0x34f1a5){try{jsonpatch['apply'](_0x34f1a5,_0x237115,!![]);}catch(_0x21734d){return BPromise[_0x2793('0x2e')](_0x21734d);}return _0x34f1a5[_0x2793('0x2f')]();};}function saveUpdates(_0x139884,_0xa062b7){return function(_0x5b2f86){if(_0x5b2f86){return _0x5b2f86[_0x2793('0x30')](_0x139884)[_0x2793('0x1b')](function(_0x30680d){return _0x30680d;});}return null;};}function removeEntity(_0xb0523,_0x57d375){return function(_0x27680f){if(_0x27680f){return _0x27680f[_0x2793('0x31')]()[_0x2793('0x1b')](function(){_0xb0523[_0x2793('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4642b1,_0x59d596){return function(_0x376627){if(!_0x376627){_0x4642b1[_0x2793('0x26')](0x194);}return _0x376627;};}function handleError(_0x611788,_0x2cdf2a){_0x2cdf2a=_0x2cdf2a||0x1f4;return function(_0x41d221){logger[_0x2793('0x21')](_0x41d221[_0x2793('0x32')]);if(_0x41d221[_0x2793('0x33')]){delete _0x41d221[_0x2793('0x33')];}_0x611788['status'](_0x2cdf2a)[_0x2793('0x34')](_0x41d221);};}exports[_0x2793('0x35')]=function(_0x1c100d,_0x48ac29){var _0x4915a5={},_0x1ab22f={},_0x3601f0={'count':0x0,'rows':[]};var _0x1999c1=_[_0x2793('0x36')](db[_0x2793('0x37')]['rawAttributes'],function(_0x3af4da){return{'name':_0x3af4da[_0x2793('0x38')],'type':_0x3af4da[_0x2793('0x39')]['key']};});_0x1ab22f[_0x2793('0x3a')]=_[_0x2793('0x36')](_0x1999c1,'name');_0x1ab22f['query']=_['keys'](_0x1c100d[_0x2793('0x3b')]);_0x1ab22f[_0x2793('0x3c')]=_[_0x2793('0x3d')](_0x1ab22f[_0x2793('0x3a')],_0x1ab22f['query']);_0x4915a5[_0x2793('0x3e')]=_[_0x2793('0x3d')](_0x1ab22f[_0x2793('0x3a')],qs[_0x2793('0x3f')](_0x1c100d[_0x2793('0x3b')][_0x2793('0x3f')]));_0x4915a5['attributes']=_0x4915a5[_0x2793('0x3e')][_0x2793('0x40')]?_0x4915a5['attributes']:_0x1ab22f[_0x2793('0x3a')];if(!_0x1c100d[_0x2793('0x3b')][_0x2793('0x41')](_0x2793('0x42'))){_0x4915a5[_0x2793('0x2c')]=qs[_0x2793('0x2c')](_0x1c100d[_0x2793('0x3b')][_0x2793('0x2c')]);_0x4915a5[_0x2793('0x2b')]=qs[_0x2793('0x2b')](_0x1c100d['query'][_0x2793('0x2b')]);}_0x4915a5[_0x2793('0x43')]=qs['sort'](_0x1c100d[_0x2793('0x3b')][_0x2793('0x44')]);_0x4915a5[_0x2793('0x45')]=qs['filters'](_[_0x2793('0x46')](_0x1c100d[_0x2793('0x3b')],_0x1ab22f['filters']),_0x1999c1);if(_0x1c100d['query']['filter']){_0x4915a5[_0x2793('0x45')]=_['merge'](_0x4915a5[_0x2793('0x45')],{'$or':_[_0x2793('0x36')](_0x1999c1,function(_0x3878ae){if(_0x3878ae[_0x2793('0x39')]!==_0x2793('0x47')){var _0x4def5c={};_0x4def5c[_0x3878ae['name']]={'$like':'%'+_0x1c100d['query'][_0x2793('0x48')]+'%'};return _0x4def5c;}})});}_0x4915a5=_[_0x2793('0x49')]({},_0x4915a5,_0x1c100d[_0x2793('0x4a')]);var _0x44a32a={'where':_0x4915a5[_0x2793('0x45')]};return db[_0x2793('0x37')][_0x2793('0x2a')](_0x44a32a)[_0x2793('0x1b')](function(_0x3e2bef){_0x3601f0[_0x2793('0x2a')]=_0x3e2bef;if(_0x1c100d[_0x2793('0x3b')]['includeAll']){_0x4915a5[_0x2793('0x4b')]=[{'all':!![]}];}return db['ZohoAccount'][_0x2793('0x4c')](_0x4915a5);})[_0x2793('0x1b')](function(_0x493de2){_0x3601f0[_0x2793('0x4d')]=_0x493de2;return _0x3601f0;})[_0x2793('0x1b')](respondWithFilteredResult(_0x48ac29,_0x4915a5))[_0x2793('0x25')](handleError(_0x48ac29,null));};exports[_0x2793('0x4e')]=function(_0x53a1ea,_0x43944d){var _0x613e4b={'raw':![],'where':{'id':_0x53a1ea['params']['id']}},_0x13d246={};_0x13d246['model']=_['keys'](db[_0x2793('0x37')][_0x2793('0x4f')]);_0x13d246[_0x2793('0x3b')]=_[_0x2793('0x50')](_0x53a1ea[_0x2793('0x3b')]);_0x13d246[_0x2793('0x3c')]=_['intersection'](_0x13d246[_0x2793('0x3a')],_0x13d246['query']);_0x613e4b['attributes']=_[_0x2793('0x3d')](_0x13d246[_0x2793('0x3a')],qs[_0x2793('0x3f')](_0x53a1ea[_0x2793('0x3b')][_0x2793('0x3f')]));_0x613e4b[_0x2793('0x3e')]=_0x613e4b['attributes'][_0x2793('0x40')]?_0x613e4b[_0x2793('0x3e')]:_0x13d246[_0x2793('0x3a')];if(_0x53a1ea['query'][_0x2793('0x51')]){_0x613e4b[_0x2793('0x4b')]=[{'all':!![]}];}_0x613e4b=_['merge']({},_0x613e4b,_0x53a1ea['options']);return db['ZohoAccount'][_0x2793('0x52')](_0x613e4b)[_0x2793('0x1b')](handleEntityNotFound(_0x43944d,null))[_0x2793('0x1b')](respondWithResult(_0x43944d,null))[_0x2793('0x25')](handleError(_0x43944d,null));};exports[_0x2793('0x53')]=function(_0xa0cd34,_0xe5ccb9){return db['ZohoAccount'][_0x2793('0x53')](_0xa0cd34[_0x2793('0x54')],{})[_0x2793('0x1b')](respondWithResult(_0xe5ccb9,0xc9))['catch'](handleError(_0xe5ccb9,null));};exports['update']=function(_0x522dd3,_0x276e67){if(_0x522dd3[_0x2793('0x54')]['id']){delete _0x522dd3[_0x2793('0x54')]['id'];}return db[_0x2793('0x37')][_0x2793('0x52')]({'where':{'id':_0x522dd3[_0x2793('0x55')]['id']}})[_0x2793('0x1b')](handleEntityNotFound(_0x276e67,null))[_0x2793('0x1b')](saveUpdates(_0x522dd3['body'],null))[_0x2793('0x1b')](respondWithResult(_0x276e67,null))['catch'](handleError(_0x276e67,null));};exports[_0x2793('0x31')]=function(_0x5624c4,_0x2a960f){return db[_0x2793('0x37')][_0x2793('0x52')]({'where':{'id':_0x5624c4[_0x2793('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a960f,null))['then'](removeEntity(_0x2a960f,null))[_0x2793('0x25')](handleError(_0x2a960f,null));};exports['getConfigurations']=function(_0x19f7df,_0x27bba5,_0x1c27a6){var _0x188e23={};var _0xabe9a0={};var _0x549b8c;var _0x49e389;return db[_0x2793('0x37')][_0x2793('0x56')]({'where':{'id':_0x19f7df[_0x2793('0x55')]['id']}})[_0x2793('0x1b')](handleEntityNotFound(_0x27bba5,null))[_0x2793('0x1b')](function(_0x56292d){if(_0x56292d){_0x549b8c=_0x56292d;_0xabe9a0['model']=_[_0x2793('0x50')](db[_0x2793('0x57')][_0x2793('0x4f')]);_0xabe9a0['query']=_[_0x2793('0x50')](_0x19f7df[_0x2793('0x3b')]);_0xabe9a0[_0x2793('0x3c')]=_[_0x2793('0x3d')](_0xabe9a0[_0x2793('0x3a')],_0xabe9a0['query']);_0x188e23['attributes']=_[_0x2793('0x3d')](_0xabe9a0['model'],qs[_0x2793('0x3f')](_0x19f7df[_0x2793('0x3b')][_0x2793('0x3f')]));_0x188e23['attributes']=_0x188e23['attributes'][_0x2793('0x40')]?_0x188e23[_0x2793('0x3e')]:_0xabe9a0[_0x2793('0x3a')];_0x188e23[_0x2793('0x43')]=qs[_0x2793('0x44')](_0x19f7df[_0x2793('0x3b')][_0x2793('0x44')]);_0x188e23[_0x2793('0x45')]=qs[_0x2793('0x3c')](_[_0x2793('0x46')](_0x19f7df['query'],_0xabe9a0[_0x2793('0x3c')]));if(_0x19f7df['query'][_0x2793('0x48')]){_0x188e23[_0x2793('0x45')]=_[_0x2793('0x49')](_0x188e23[_0x2793('0x45')],{'$or':_[_0x2793('0x36')](_0x188e23['attributes'],function(_0x37857d){var _0x4b228f={};_0x4b228f[_0x37857d]={'$like':'%'+_0x19f7df[_0x2793('0x3b')]['filter']+'%'};return _0x4b228f;})});}_0x188e23=_[_0x2793('0x49')]({},_0x188e23,_0x19f7df['options']);return _0x549b8c[_0x2793('0x58')](_0x188e23);}})[_0x2793('0x1b')](function(_0x54a967){if(_0x54a967){_0x49e389=_0x54a967[_0x2793('0x40')];if(!_0x19f7df['query']['hasOwnProperty'](_0x2793('0x42'))){_0x188e23[_0x2793('0x2c')]=qs[_0x2793('0x2c')](_0x19f7df[_0x2793('0x3b')][_0x2793('0x2c')]);_0x188e23['offset']=qs[_0x2793('0x2b')](_0x19f7df['query'][_0x2793('0x2b')]);}return _0x549b8c['getConfigurations'](_0x188e23);}})[_0x2793('0x1b')](function(_0x124932){if(_0x124932){return _0x124932?{'count':_0x49e389,'rows':_0x124932}:null;}})[_0x2793('0x1b')](respondWithResult(_0x27bba5,null))[_0x2793('0x25')](handleError(_0x27bba5,null));};exports[_0x2793('0x59')]=function(_0x307896,_0x4950c2,_0x42868c){if(_0x307896[_0x2793('0x54')]['id']){delete _0x307896[_0x2793('0x54')]['id'];}return db['ZohoAccount'][_0x2793('0x56')]({'where':{'id':_0x307896[_0x2793('0x55')]['id']}})['then'](handleEntityNotFound(_0x4950c2,null))[_0x2793('0x1b')](function(_0x106fb3){if(_0x106fb3){_0x307896[_0x2793('0x54')][_0x2793('0x5a')]=_0x106fb3['id'];_0x307896[_0x2793('0x54')][_0x2793('0x5b')]=integrations[_0x2793('0x5c')](_0x307896[_0x2793('0x54')][_0x2793('0x5d')],_0x307896[_0x2793('0x54')][_0x2793('0x39')]);_0x307896['body'][_0x2793('0x5e')]=integrations[_0x2793('0x5f')](_0x307896[_0x2793('0x54')][_0x2793('0x5d')],_0x307896[_0x2793('0x54')][_0x2793('0x39')]);return db[_0x2793('0x57')][_0x2793('0x53')](_0x307896[_0x2793('0x54')],{'include':[{'model':db[_0x2793('0x60')],'as':_0x2793('0x5b')},{'model':db[_0x2793('0x60')],'as':_0x2793('0x5e')}]});}return null;})[_0x2793('0x1b')](respondWithResult(_0x4950c2,null))[_0x2793('0x25')](handleError(_0x4950c2,null));};function getAccessToken(_0x29c83e){return new Promise(function(_0x57ec77,_0x4a6a6a){var _0x1d491e;switch(_0x29c83e[_0x2793('0x61')]){case'US':_0x1d491e=_0x2793('0x62');break;case'AU':_0x1d491e=_0x2793('0x63');break;case'EU':_0x1d491e='https://accounts.zoho.eu';break;case'IN':_0x1d491e=_0x2793('0x64');break;case'CN':_0x1d491e=_0x2793('0x65');break;default:_0x1d491e='https://accounts.zoho.eu';break;}var _0x4da4b5={'method':_0x2793('0x66'),'uri':_0x1d491e+'/oauth/v2/token','qs':{'refresh_token':_0x29c83e[_0x2793('0x67')],'client_id':_0x29c83e[_0x2793('0x68')],'client_secret':_0x29c83e[_0x2793('0x69')],'grant_type':_0x2793('0x6a')},'json':!![]};return rp(_0x4da4b5)[_0x2793('0x1b')](function(_0x1b5104){if(_0x1b5104[_0x2793('0x6b')]){_0x57ec77(_0x1b5104[_0x2793('0x6b')]);}else{_0x4a6a6a('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x2793('0x25')](function(_0x130d30){_0x4a6a6a(_0x130d30);});});}exports['getFields']=function(_0x58992e,_0x57ea68,_0x46505d){var _0x52e18a,_0x5058fe,_0xfd35cb,_0x293911,_0x164bad;return db[_0x2793('0x37')]['findOne']({'where':{'id':_0x58992e[_0x2793('0x55')]['id']},'attributes':['id',_0x2793('0x6c'),_0x2793('0x61'),'clientId','clientSecret',_0x2793('0x6d'),_0x2793('0x6e'),_0x2793('0x67')]})[_0x2793('0x1b')](handleEntityNotFound(_0x57ea68,null))[_0x2793('0x1b')](function(_0x56ab12){_0x164bad=_0x56ab12;_0x52e18a=_0x164bad[_0x2793('0x6c')];_0x5058fe=_0x52e18a==='zoho.eu'?'eu':'com';_0xfd35cb=_0x164bad[_0x2793('0x6d')];var _0xd6a7f3=_0xfd35cb[_0x2793('0x6f')](-0x1);if(_0xd6a7f3==='/'||_0xd6a7f3==='\x5c'||_0xd6a7f3===':'){_0xfd35cb=_0xfd35cb[_0x2793('0x70')](0x0,_0xfd35cb[_0x2793('0x71')](_0xd6a7f3));}if(!_0x164bad[_0x2793('0x67')]){throw new Error(_0x2793('0x72'));}return getAccessToken(_0x164bad);})[_0x2793('0x1b')](function(_0x4d91dc){if(_0x4d91dc){return rp({'method':_0x2793('0x73'),'uri':util['format'](_0x2793('0x74'),_0x5058fe),'qs':{'module':_0x2793('0x75')},'headers':{'Authorization':_0x2793('0x76')+_0x4d91dc},'json':!![]});}})['then'](function(_0x18b572){if(_0x18b572){if(_0x18b572[_0x2793('0x77')]&&_0x18b572['response']['error']){throw new Error(_0x18b572['response'][_0x2793('0x21')]['message']);}var _0x40b19f=[];var _0x3e5acb=[];var _0x4f63db=[_0x2793('0x78'),'Subject',_0x2793('0x79'),_0x2793('0x7a'),_0x2793('0x7b'),'Call_Result','Call_Start_Time','Call_Type'];_0x3e5acb=_['remove'](_0x18b572[_0x2793('0x3f')],function(_0xdce85c){return _0x4f63db['includes'](_0xdce85c[_0x2793('0x7c')]);});for(var _0xc565a6=0x0;_0xc565a6<_0x3e5acb[_0x2793('0x40')];_0xc565a6++){if(_0x3e5acb[_0xc565a6]['system_mandatory']===![]){_0x40b19f[_0x2793('0x7d')]({'id':_0x3e5acb[_0xc565a6]['id'],'name':_0x3e5acb[_0xc565a6][_0x2793('0x7e')],'custom':_0x3e5acb[_0xc565a6][_0x2793('0x7f')],'options':_0x3e5acb[_0xc565a6][_0x2793('0x80')]==='picklist'&&_0x3e5acb[_0xc565a6][_0x2793('0x81')][_0x2793('0x40')]>-0x1?_['map'](_0x3e5acb[_0xc565a6][_0x2793('0x81')],function(_0x124039){return{'name':_0x124039,'value':_0x124039};}):[]});}}return{'count':_0x40b19f['length'],'rows':_0x40b19f};}else{return{'count':0x0,'rows':[]};}})[_0x2793('0x1b')](respondWithResult(_0x57ea68,null))[_0x2793('0x25')](function(_0x281817){var _0x164ff3=_0x58992e[_0x2793('0x3b')][_0x2793('0x16')]?0x1f4:_0x281817[_0x2793('0x82')]||0x1f4;logger[_0x2793('0x21')](_0x2793('0x83'),_0x2793('0x84'),_0x164ff3,JSON[_0x2793('0x20')](_0x281817));delete _0x281817[_0x2793('0x33')];if(_0x164ff3===0x191){_0x164ff3=0x190;}_0x57ea68[_0x2793('0x27')](_0x164ff3)[_0x2793('0x34')](_0x58992e['query'][_0x2793('0x16')]?{'message':_0x2793('0x85'),'statusCode':_0x281817[_0x2793('0x82')]}:_0x281817);});}; \ No newline at end of file +var _0x5066=['getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','serverUrl','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','api_name','push','display_label','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','limit','set','apply','reject','update','then','name','index','map','ZohoAccount','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','keys','rawAttributes','includeAll','options','create','body','find','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x5066,0x1ce));var _0x6506=function(_0x5aa6a9,_0x3ae14c){_0x5aa6a9=_0x5aa6a9-0x0;var _0x119ce5=_0x5066[_0x5aa6a9];return _0x119ce5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6506('0x0'));var rimraf=require(_0x6506('0x1'));var zipdir=require(_0x6506('0x2'));var jsonpatch=require(_0x6506('0x3'));var rp=require('request-promise');var moment=require(_0x6506('0x4'));var BPromise=require(_0x6506('0x5'));var Mustache=require(_0x6506('0x6'));var util=require(_0x6506('0x7'));var path=require(_0x6506('0x8'));var sox=require(_0x6506('0x9'));var csv=require(_0x6506('0xa'));var ejs=require(_0x6506('0xb'));var fs=require('fs');var _=require(_0x6506('0xc'));var squel=require(_0x6506('0xd'));var crypto=require(_0x6506('0xe'));var jsforce=require(_0x6506('0xf'));var deskjs=require(_0x6506('0x10'));var toCsv=require(_0x6506('0xa'));var querystring=require(_0x6506('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6506('0x12'));var qs=require(_0x6506('0x13'));var as=require(_0x6506('0x14'));var hardwareService=require(_0x6506('0x15'));var logger=require(_0x6506('0x16'))(_0x6506('0x17'));var utils=require('../../config/utils');var config=require(_0x6506('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6506('0x19'));var jayson=require(_0x6506('0x1a'));var client=jayson['client'][_0x6506('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x58790b,_0x2c14f8,_0x66d03a){if(_0x66d03a){var _0x81bb8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x81bb8d[_0x6506('0x1c')](_0x2c14f8)){return _0x58790b;}else{throw new db[(_0x6506('0x1d'))][(_0x6506('0x1e'))](_0x6506('0x1f'));}}else{return _0x58790b;}}function respondWithRpcPromise(_0x4b9405,_0x133e91,_0x45de6a,_0x4b8ef4){return new BPromise(function(_0x1f90b4,_0x2728c6){var _0x4b7936=_0x4b8ef4||client;return _0x4b7936[_0x6506('0x20')](_0x4b9405,_0x45de6a)['then'](function(_0x3cf127){logger[_0x6506('0x21')](_0x6506('0x22'),_0x133e91,_0x6506('0x23'));logger[_0x6506('0x24')](_0x6506('0x25'),_0x133e91,_0x6506('0x23'),JSON[_0x6506('0x26')](_0x3cf127));if(_0x3cf127[_0x6506('0x27')]){if(_0x3cf127[_0x6506('0x27')][_0x6506('0x28')]===0x1f4){logger[_0x6506('0x27')]('ZohoAccount,\x20%s,\x20%s',_0x133e91,_0x3cf127['error'][_0x6506('0x29')]);return _0x2728c6(_0x3cf127[_0x6506('0x27')][_0x6506('0x29')]);}logger[_0x6506('0x27')]('ZohoAccount,\x20%s,\x20%s',_0x133e91,_0x3cf127['error']['message']);return _0x1f90b4(_0x3cf127[_0x6506('0x27')][_0x6506('0x29')]);}else{logger[_0x6506('0x21')](_0x6506('0x22'),_0x133e91,_0x6506('0x23'));_0x1f90b4(_0x3cf127['result'][_0x6506('0x29')]);}})[_0x6506('0x2a')](function(_0x2322f7){logger['error'](_0x6506('0x22'),_0x133e91,_0x2322f7);_0x2728c6(_0x2322f7);});});}function respondWithStatusCode(_0x5edf08,_0x111758){_0x111758=_0x111758||0xcc;return function(_0x16e895){if(_0x16e895){return _0x5edf08[_0x6506('0x2b')](_0x111758);}return _0x5edf08[_0x6506('0x2c')](_0x111758)[_0x6506('0x2d')]();};}function respondWithResult(_0x2db65d,_0xfde7ee){_0xfde7ee=_0xfde7ee||0xc8;return function(_0x3be010){if(_0x3be010){return _0x2db65d[_0x6506('0x2c')](_0xfde7ee)[_0x6506('0x2e')](_0x3be010);}};}function respondWithFilteredResult(_0x374704,_0x41e245){return function(_0x5c24bc){if(_0x5c24bc){var _0x167540=_0x5c24bc['count'],_0x221cd4=_0x41e245['offset'],_0x43052c=_0x41e245['offset']+_0x41e245[_0x6506('0x2f')],_0xbb7a52;if(_0x43052c>=_0x167540){_0x43052c=_0x167540;_0xbb7a52=0xc8;}else{_0xbb7a52=0xce;}_0x374704['status'](_0xbb7a52);return _0x374704[_0x6506('0x30')]('Content-Range',_0x221cd4+'-'+_0x43052c+'/'+_0x167540)[_0x6506('0x2e')](_0x5c24bc);}return null;};}function patchUpdates(_0x49d8a0){return function(_0x2fbcc2){try{jsonpatch[_0x6506('0x31')](_0x2fbcc2,_0x49d8a0,!![]);}catch(_0x1f4756){return BPromise[_0x6506('0x32')](_0x1f4756);}return _0x2fbcc2['save']();};}function saveUpdates(_0x2afb61,_0x3e91cf){return function(_0xca1f1b){if(_0xca1f1b){return _0xca1f1b[_0x6506('0x33')](_0x2afb61)[_0x6506('0x34')](function(_0x27986e){return _0x27986e;});}return null;};}function removeEntity(_0x27bb43,_0x19cd1c){return function(_0x290443){if(_0x290443){return _0x290443['destroy']()[_0x6506('0x34')](function(){_0x27bb43[_0x6506('0x2c')](0xcc)[_0x6506('0x2d')]();});}};}function handleEntityNotFound(_0x11654c,_0x4497f8){return function(_0x6aa688){if(!_0x6aa688){_0x11654c[_0x6506('0x2b')](0x194);}return _0x6aa688;};}function handleError(_0x30b3d9,_0x562919){_0x562919=_0x562919||0x1f4;return function(_0x5d08cd){logger['error'](_0x5d08cd['stack']);if(_0x5d08cd['name']){delete _0x5d08cd[_0x6506('0x35')];}_0x30b3d9['status'](_0x562919)['send'](_0x5d08cd);};}exports[_0x6506('0x36')]=function(_0x5c80ff,_0x18f245){var _0x191946={},_0x3bf64f={},_0xab2181={'count':0x0,'rows':[]};var _0x5af782=_[_0x6506('0x37')](db[_0x6506('0x38')]['rawAttributes'],function(_0xf00054){return{'name':_0xf00054[_0x6506('0x39')],'type':_0xf00054[_0x6506('0x3a')]['key']};});_0x3bf64f['model']=_[_0x6506('0x37')](_0x5af782,_0x6506('0x35'));_0x3bf64f[_0x6506('0x3b')]=_['keys'](_0x5c80ff[_0x6506('0x3b')]);_0x3bf64f[_0x6506('0x3c')]=_[_0x6506('0x3d')](_0x3bf64f[_0x6506('0x3e')],_0x3bf64f[_0x6506('0x3b')]);_0x191946[_0x6506('0x3f')]=_['intersection'](_0x3bf64f['model'],qs['fields'](_0x5c80ff[_0x6506('0x3b')][_0x6506('0x40')]));_0x191946['attributes']=_0x191946[_0x6506('0x3f')][_0x6506('0x41')]?_0x191946[_0x6506('0x3f')]:_0x3bf64f[_0x6506('0x3e')];if(!_0x5c80ff[_0x6506('0x3b')][_0x6506('0x42')](_0x6506('0x43'))){_0x191946['limit']=qs[_0x6506('0x2f')](_0x5c80ff['query']['limit']);_0x191946[_0x6506('0x44')]=qs[_0x6506('0x44')](_0x5c80ff[_0x6506('0x3b')][_0x6506('0x44')]);}_0x191946[_0x6506('0x45')]=qs['sort'](_0x5c80ff[_0x6506('0x3b')][_0x6506('0x46')]);_0x191946[_0x6506('0x47')]=qs[_0x6506('0x3c')](_['pick'](_0x5c80ff[_0x6506('0x3b')],_0x3bf64f[_0x6506('0x3c')]),_0x5af782);if(_0x5c80ff['query'][_0x6506('0x48')]){_0x191946[_0x6506('0x47')]=_[_0x6506('0x49')](_0x191946[_0x6506('0x47')],{'$or':_[_0x6506('0x37')](_0x5af782,function(_0x4445bf){if(_0x4445bf['type']!==_0x6506('0x4a')){var _0x6e26b={};_0x6e26b[_0x4445bf[_0x6506('0x35')]]={'$like':'%'+_0x5c80ff[_0x6506('0x3b')][_0x6506('0x48')]+'%'};return _0x6e26b;}})});}_0x191946=_[_0x6506('0x49')]({},_0x191946,_0x5c80ff['options']);var _0x1dbca1={'where':_0x191946[_0x6506('0x47')]};return db[_0x6506('0x38')]['count'](_0x1dbca1)[_0x6506('0x34')](function(_0x23090a){_0xab2181[_0x6506('0x4b')]=_0x23090a;if(_0x5c80ff[_0x6506('0x3b')]['includeAll']){_0x191946[_0x6506('0x4c')]=[{'all':!![]}];}return db[_0x6506('0x38')][_0x6506('0x4d')](_0x191946);})[_0x6506('0x34')](function(_0x28b415){_0xab2181[_0x6506('0x4e')]=_0x28b415;return _0xab2181;})[_0x6506('0x34')](respondWithFilteredResult(_0x18f245,_0x191946))[_0x6506('0x2a')](handleError(_0x18f245,null));};exports[_0x6506('0x4f')]=function(_0x53fd06,_0x2e5105){var _0x23df9d={'raw':![],'where':{'id':_0x53fd06[_0x6506('0x50')]['id']}},_0x39cb22={};_0x39cb22['model']=_[_0x6506('0x51')](db['ZohoAccount'][_0x6506('0x52')]);_0x39cb22[_0x6506('0x3b')]=_[_0x6506('0x51')](_0x53fd06[_0x6506('0x3b')]);_0x39cb22[_0x6506('0x3c')]=_[_0x6506('0x3d')](_0x39cb22[_0x6506('0x3e')],_0x39cb22[_0x6506('0x3b')]);_0x23df9d[_0x6506('0x3f')]=_[_0x6506('0x3d')](_0x39cb22[_0x6506('0x3e')],qs[_0x6506('0x40')](_0x53fd06[_0x6506('0x3b')]['fields']));_0x23df9d[_0x6506('0x3f')]=_0x23df9d['attributes']['length']?_0x23df9d['attributes']:_0x39cb22[_0x6506('0x3e')];if(_0x53fd06['query'][_0x6506('0x53')]){_0x23df9d[_0x6506('0x4c')]=[{'all':!![]}];}_0x23df9d=_[_0x6506('0x49')]({},_0x23df9d,_0x53fd06[_0x6506('0x54')]);return db[_0x6506('0x38')]['find'](_0x23df9d)[_0x6506('0x34')](handleEntityNotFound(_0x2e5105,null))[_0x6506('0x34')](respondWithResult(_0x2e5105,null))[_0x6506('0x2a')](handleError(_0x2e5105,null));};exports['create']=function(_0x1f7d58,_0x42fe77){return db[_0x6506('0x38')][_0x6506('0x55')](_0x1f7d58[_0x6506('0x56')],{})[_0x6506('0x34')](respondWithResult(_0x42fe77,0xc9))[_0x6506('0x2a')](handleError(_0x42fe77,null));};exports['update']=function(_0x4e15f2,_0x324f76){if(_0x4e15f2[_0x6506('0x56')]['id']){delete _0x4e15f2[_0x6506('0x56')]['id'];}return db[_0x6506('0x38')][_0x6506('0x57')]({'where':{'id':_0x4e15f2['params']['id']}})[_0x6506('0x34')](handleEntityNotFound(_0x324f76,null))['then'](saveUpdates(_0x4e15f2['body'],null))['then'](respondWithResult(_0x324f76,null))[_0x6506('0x2a')](handleError(_0x324f76,null));};exports['destroy']=function(_0x15b0e3,_0x5c5fa3){return db[_0x6506('0x38')][_0x6506('0x57')]({'where':{'id':_0x15b0e3[_0x6506('0x50')]['id']}})[_0x6506('0x34')](handleEntityNotFound(_0x5c5fa3,null))[_0x6506('0x34')](removeEntity(_0x5c5fa3,null))['catch'](handleError(_0x5c5fa3,null));};exports['getConfigurations']=function(_0x13f7d5,_0x8f8c72,_0x7615bf){var _0x1cdcd7={};var _0x502d21={};var _0x4b6bf7;var _0x4df0b5;return db[_0x6506('0x38')]['findOne']({'where':{'id':_0x13f7d5[_0x6506('0x50')]['id']}})[_0x6506('0x34')](handleEntityNotFound(_0x8f8c72,null))[_0x6506('0x34')](function(_0x13a264){if(_0x13a264){_0x4b6bf7=_0x13a264;_0x502d21[_0x6506('0x3e')]=_[_0x6506('0x51')](db['ZohoConfiguration'][_0x6506('0x52')]);_0x502d21[_0x6506('0x3b')]=_[_0x6506('0x51')](_0x13f7d5['query']);_0x502d21[_0x6506('0x3c')]=_[_0x6506('0x3d')](_0x502d21[_0x6506('0x3e')],_0x502d21[_0x6506('0x3b')]);_0x1cdcd7[_0x6506('0x3f')]=_[_0x6506('0x3d')](_0x502d21[_0x6506('0x3e')],qs[_0x6506('0x40')](_0x13f7d5[_0x6506('0x3b')][_0x6506('0x40')]));_0x1cdcd7[_0x6506('0x3f')]=_0x1cdcd7[_0x6506('0x3f')][_0x6506('0x41')]?_0x1cdcd7[_0x6506('0x3f')]:_0x502d21['model'];_0x1cdcd7[_0x6506('0x45')]=qs[_0x6506('0x46')](_0x13f7d5[_0x6506('0x3b')][_0x6506('0x46')]);_0x1cdcd7[_0x6506('0x47')]=qs[_0x6506('0x3c')](_[_0x6506('0x58')](_0x13f7d5[_0x6506('0x3b')],_0x502d21['filters']));if(_0x13f7d5[_0x6506('0x3b')][_0x6506('0x48')]){_0x1cdcd7[_0x6506('0x47')]=_[_0x6506('0x49')](_0x1cdcd7[_0x6506('0x47')],{'$or':_[_0x6506('0x37')](_0x1cdcd7[_0x6506('0x3f')],function(_0x167200){var _0x8d490b={};_0x8d490b[_0x167200]={'$like':'%'+_0x13f7d5[_0x6506('0x3b')][_0x6506('0x48')]+'%'};return _0x8d490b;})});}_0x1cdcd7=_[_0x6506('0x49')]({},_0x1cdcd7,_0x13f7d5[_0x6506('0x54')]);return _0x4b6bf7[_0x6506('0x59')](_0x1cdcd7);}})[_0x6506('0x34')](function(_0x496005){if(_0x496005){_0x4df0b5=_0x496005[_0x6506('0x41')];if(!_0x13f7d5[_0x6506('0x3b')]['hasOwnProperty']('nolimit')){_0x1cdcd7[_0x6506('0x2f')]=qs[_0x6506('0x2f')](_0x13f7d5[_0x6506('0x3b')][_0x6506('0x2f')]);_0x1cdcd7[_0x6506('0x44')]=qs['offset'](_0x13f7d5[_0x6506('0x3b')]['offset']);}return _0x4b6bf7[_0x6506('0x59')](_0x1cdcd7);}})['then'](function(_0x57015e){if(_0x57015e){return _0x57015e?{'count':_0x4df0b5,'rows':_0x57015e}:null;}})[_0x6506('0x34')](respondWithResult(_0x8f8c72,null))[_0x6506('0x2a')](handleError(_0x8f8c72,null));};exports[_0x6506('0x5a')]=function(_0x46004e,_0x29919f,_0x16d307){if(_0x46004e['body']['id']){delete _0x46004e[_0x6506('0x56')]['id'];}return db['ZohoAccount'][_0x6506('0x5b')]({'where':{'id':_0x46004e[_0x6506('0x50')]['id']}})[_0x6506('0x34')](handleEntityNotFound(_0x29919f,null))['then'](function(_0x307fa9){if(_0x307fa9){_0x46004e[_0x6506('0x56')][_0x6506('0x5c')]=_0x307fa9['id'];_0x46004e[_0x6506('0x56')][_0x6506('0x5d')]=integrations[_0x6506('0x5e')](_0x46004e[_0x6506('0x56')][_0x6506('0x5f')],_0x46004e['body'][_0x6506('0x3a')]);_0x46004e[_0x6506('0x56')][_0x6506('0x60')]=integrations[_0x6506('0x61')](_0x46004e[_0x6506('0x56')][_0x6506('0x5f')],_0x46004e[_0x6506('0x56')][_0x6506('0x3a')]);return db['ZohoConfiguration'][_0x6506('0x55')](_0x46004e[_0x6506('0x56')],{'include':[{'model':db[_0x6506('0x62')],'as':_0x6506('0x5d')},{'model':db[_0x6506('0x62')],'as':_0x6506('0x60')}]});}return null;})[_0x6506('0x34')](respondWithResult(_0x29919f,null))['catch'](handleError(_0x29919f,null));};function getAccessToken(_0x19c867){return new Promise(function(_0xe099d4,_0x5bd67c){var _0x203094;switch(_0x19c867['zone']){case'US':_0x203094=_0x6506('0x63');break;case'AU':_0x203094=_0x6506('0x64');break;case'EU':_0x203094=_0x6506('0x65');break;case'IN':_0x203094=_0x6506('0x66');break;case'CN':_0x203094=_0x6506('0x67');break;default:_0x203094=_0x6506('0x65');break;}var _0x93b207={'method':_0x6506('0x68'),'uri':_0x203094+'/oauth/v2/token','qs':{'refresh_token':_0x19c867[_0x6506('0x69')],'client_id':_0x19c867[_0x6506('0x6a')],'client_secret':_0x19c867[_0x6506('0x6b')],'grant_type':_0x6506('0x6c')},'json':!![]};return rp(_0x93b207)[_0x6506('0x34')](function(_0x57ce1b){if(_0x57ce1b[_0x6506('0x6d')]){_0xe099d4(_0x57ce1b[_0x6506('0x6d')]);}else{_0x5bd67c(_0x6506('0x6e'));}})[_0x6506('0x2a')](function(_0x56b840){_0x5bd67c(_0x56b840);});});}exports[_0x6506('0x6f')]=function(_0x1a234a,_0x52cad4,_0xa2af97){var _0x11b934,_0xa456e9,_0x2addb6,_0x2ba77d,_0x11edd3;return db[_0x6506('0x38')][_0x6506('0x5b')]({'where':{'id':_0x1a234a[_0x6506('0x50')]['id']},'attributes':['id','host',_0x6506('0x70'),_0x6506('0x6a'),'clientSecret',_0x6506('0x71'),_0x6506('0x28'),_0x6506('0x69')]})[_0x6506('0x34')](handleEntityNotFound(_0x52cad4,null))[_0x6506('0x34')](function(_0x930500){_0x11edd3=_0x930500;_0x11b934=_0x11edd3[_0x6506('0x72')];_0xa456e9=_0x11b934===_0x6506('0x73')?'eu':_0x6506('0x74');_0x2addb6=_0x11edd3[_0x6506('0x71')];var _0x4d8878=_0x2addb6[_0x6506('0x75')](-0x1);if(_0x4d8878==='/'||_0x4d8878==='\x5c'||_0x4d8878===':'){_0x2addb6=_0x2addb6[_0x6506('0x76')](0x0,_0x2addb6[_0x6506('0x77')](_0x4d8878));}if(!_0x11edd3['refreshToken']){throw new Error(_0x6506('0x78'));}return getAccessToken(_0x11edd3);})[_0x6506('0x34')](function(_0x1665e8){if(_0x1665e8){return rp({'method':'GET','uri':util['format'](_0x6506('0x79'),_0xa456e9),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1665e8},'json':!![]});}})[_0x6506('0x34')](function(_0x25a8d9){if(_0x25a8d9){if(_0x25a8d9[_0x6506('0x7a')]&&_0x25a8d9[_0x6506('0x7a')][_0x6506('0x27')]){throw new Error(_0x25a8d9[_0x6506('0x7a')]['error'][_0x6506('0x29')]);}var _0x566b8a=[];var _0xaa1c2e=[];var _0x1ac6fe=[_0x6506('0x7b'),_0x6506('0x7c'),'Description',_0x6506('0x7d'),_0x6506('0x7e'),_0x6506('0x7f'),_0x6506('0x80'),'Call_Type'];_0xaa1c2e=_[_0x6506('0x81')](_0x25a8d9[_0x6506('0x40')],function(_0x5b539d){return _0x1ac6fe['includes'](_0x5b539d[_0x6506('0x82')]);});for(var _0x8c28a=0x0;_0x8c28a<_0xaa1c2e[_0x6506('0x41')];_0x8c28a++){if(_0xaa1c2e[_0x8c28a]['system_mandatory']===![]){_0x566b8a[_0x6506('0x83')]({'id':_0xaa1c2e[_0x8c28a]['id'],'name':_0xaa1c2e[_0x8c28a][_0x6506('0x84')],'custom':_0xaa1c2e[_0x8c28a]['custom_field'],'options':_0xaa1c2e[_0x8c28a]['data_type']===_0x6506('0x85')&&_0xaa1c2e[_0x8c28a][_0x6506('0x86')][_0x6506('0x41')]>-0x1?_[_0x6506('0x37')](_0xaa1c2e[_0x8c28a][_0x6506('0x86')],function(_0x18be95){return{'name':_0x18be95,'value':_0x18be95};}):[]});}}return{'count':_0x566b8a['length'],'rows':_0x566b8a};}else{return{'count':0x0,'rows':[]};}})[_0x6506('0x34')](respondWithResult(_0x52cad4,null))[_0x6506('0x2a')](function(_0xe694d){var _0xe5ecb4=_0x1a234a['query'][_0x6506('0x1c')]?0x1f4:_0xe694d['statusCode']||0x1f4;logger[_0x6506('0x27')](_0x6506('0x87'),_0x6506('0x6f'),_0xe5ecb4,JSON['stringify'](_0xe694d));delete _0xe694d['name'];if(_0xe5ecb4===0x191){_0xe5ecb4=0x190;}_0x52cad4[_0x6506('0x2c')](_0xe5ecb4)[_0x6506('0x88')](_0x1a234a[_0x6506('0x3b')][_0x6506('0x1c')]?{'message':_0x6506('0x89'),'statusCode':_0xe694d[_0x6506('0x8a')]}:_0xe694d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2738110..a5f9857 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 _0x94f7=['serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','then','refresh_token','refreshToken','info','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','inspect','catch','format','POST','/oauth/v2/token','application/x-www-form-urlencoded','parse','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','ZohoAccount','int_zoho_accounts','zone','changed'];(function(_0x104a7a,_0x19bd5c){var _0x2070bb=function(_0x1d279b){while(--_0x1d279b){_0x104a7a['push'](_0x104a7a['shift']());}};_0x2070bb(++_0x19bd5c);}(_0x94f7,0x97));var _0x794f=function(_0x48a2ec,_0xf91663){_0x48a2ec=_0x48a2ec-0x0;var _0x4c6cbf=_0x94f7[_0x48a2ec];return _0x4c6cbf;};'use strict';var _=require('lodash');var util=require(_0x794f('0x0'));var logger=require(_0x794f('0x1'))(_0x794f('0x2'));var moment=require(_0x794f('0x3'));var BPromise=require(_0x794f('0x4'));var rp=require(_0x794f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x794f('0x6'));var config=require(_0x794f('0x7'));var attributes=require(_0x794f('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x39a08c,_0x32f886){return _0x39a08c['define'](_0x794f('0x9'),attributes,{'tableName':_0x794f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b4ee8,_0x40c74a,_0x3bbee3){if(_0x1b4ee8['changed'](_0x794f('0xb'))||_0x1b4ee8[_0x794f('0xc')](_0x794f('0xd'))||_0x1b4ee8[_0x794f('0xc')](_0x794f('0xe'))||_0x1b4ee8[_0x794f('0xc')](_0x794f('0xf'))||_0x1b4ee8['changed'](_0x794f('0x10'))||_0x1b4ee8[_0x794f('0xc')](_0x794f('0x11'))){var _0x585c70,_0x1831fe;_0x585c70=_0x1b4ee8[_0x794f('0xd')];var _0x5a77b4=_0x585c70[_0x794f('0x12')](-0x1);if(_0x5a77b4==='/'||_0x5a77b4==='\x5c'||_0x5a77b4===':'){_0x585c70=_0x585c70[_0x794f('0x13')](0x0,_0x585c70[_0x794f('0x14')](_0x5a77b4));}switch(_0x1b4ee8[_0x794f('0xb')]){case'US':_0x1831fe=_0x794f('0x15');break;case'AU':_0x1831fe='https://accounts.zoho.com.au';break;case'IN':_0x1831fe=_0x794f('0x16');break;case'CN':_0x1831fe=_0x794f('0x17');break;default:_0x1831fe=_0x794f('0x18');break;}var _0x20e244={'method':'POST','uri':_0x1831fe+'/oauth/v2/token','form':{'grant_type':_0x794f('0x19'),'client_id':_0x1b4ee8['clientId'],'client_secret':_0x1b4ee8[_0x794f('0xf')],'redirect_uri':_0x1b4ee8['serverUrl'],'code':_0x1b4ee8[_0x794f('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x20e244)[_0x794f('0x1a')](function(_0x32d8a6){var _0x45629a=JSON['parse'](_0x32d8a6);if(_0x45629a[_0x794f('0x1b')]){_0x1b4ee8[_0x794f('0x1c')]=_0x45629a[_0x794f('0x1b')];logger[_0x794f('0x1d')](util['format'](_0x794f('0x1e'),_0x1b4ee8[_0x794f('0x1f')],_0x1b4ee8['id']));}else{logger[_0x794f('0x20')](util['format'](_0x794f('0x21'),_0x1b4ee8[_0x794f('0x1f')],_0x1b4ee8['id']),util[_0x794f('0x22')](_0x45629a,{'showHidden':![],'depth':null}));}return _0x3bbee3(null,_0x40c74a);})[_0x794f('0x23')](function(_0x498932){logger[_0x794f('0x20')](util[_0x794f('0x24')](_0x794f('0x21'),_0x1b4ee8[_0x794f('0x1f')],_0x1b4ee8['id']),util[_0x794f('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x3bbee3(_0x498932);});}else{return _0x3bbee3(null,_0x40c74a);}},'beforeUpdate':function(_0x20d500,_0x1cb369,_0x1c7ca0){if(_0x20d500[_0x794f('0xc')](_0x794f('0xb'))||_0x20d500[_0x794f('0xc')](_0x794f('0xd'))||_0x20d500['changed'](_0x794f('0xe'))||_0x20d500[_0x794f('0xc')]('clientSecret')||_0x20d500[_0x794f('0xc')](_0x794f('0x10'))||_0x20d500[_0x794f('0xc')](_0x794f('0x11'))){var _0x13d126,_0x1f7b81;_0x13d126=_0x20d500[_0x794f('0xd')];var _0x17eb43=_0x13d126[_0x794f('0x12')](-0x1);if(_0x17eb43==='/'||_0x17eb43==='\x5c'||_0x17eb43===':'){_0x13d126=_0x13d126[_0x794f('0x13')](0x0,_0x13d126[_0x794f('0x14')](_0x17eb43));}switch(_0x20d500[_0x794f('0xb')]){case'US':_0x1f7b81=_0x794f('0x15');break;case'AU':_0x1f7b81='https://accounts.zoho.com.au';break;case'IN':_0x1f7b81=_0x794f('0x16');break;case'CN':_0x1f7b81='https://accounts.zoho.com.cn';break;default:_0x1f7b81=_0x794f('0x18');break;}var _0x35d9fc={'method':_0x794f('0x25'),'uri':_0x1f7b81+_0x794f('0x26'),'form':{'grant_type':'authorization_code','client_id':_0x20d500[_0x794f('0xe')],'client_secret':_0x20d500[_0x794f('0xf')],'redirect_uri':_0x20d500[_0x794f('0xd')],'code':_0x20d500[_0x794f('0x10')]},'headers':{'Content-Type':_0x794f('0x27')}};return rp(_0x35d9fc)[_0x794f('0x1a')](function(_0x269f89){var _0x106b4f=JSON[_0x794f('0x28')](_0x269f89);if(_0x106b4f[_0x794f('0x1b')]){_0x20d500[_0x794f('0x1c')]=_0x106b4f[_0x794f('0x1b')];logger[_0x794f('0x1d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x20d500[_0x794f('0x1f')],_0x20d500['id']));}else{logger[_0x794f('0x20')](util['format'](_0x794f('0x21'),_0x20d500[_0x794f('0x1f')],_0x20d500['id']),util[_0x794f('0x22')](_0x106b4f,{'showHidden':![],'depth':null}));}return _0x1c7ca0(null,_0x1cb369);})[_0x794f('0x23')](function(_0x33c75e){logger[_0x794f('0x20')](util[_0x794f('0x24')](_0x794f('0x21'),_0x20d500['name'],_0x20d500['id']),util[_0x794f('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c7ca0(_0x33c75e);});}else{return _0x1c7ca0(null,_0x1cb369);}}}});}; \ No newline at end of file +var _0x0480=['rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','zone','changed','clientId','clientSecret','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','then','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.in','https://accounts.zoho.com.cn','serverUrl','application/x-www-form-urlencoded','parse','util','../../config/logger','api','bluebird','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0480,0xf7));var _0x0048=function(_0x565411,_0x5a59db){_0x565411=_0x565411-0x0;var _0x214584=_0x0480[_0x565411];return _0x214584;};'use strict';var _=require('lodash');var util=require(_0x0048('0x0'));var logger=require(_0x0048('0x1'))(_0x0048('0x2'));var moment=require('moment');var BPromise=require(_0x0048('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0048('0x4'));var rimraf=require(_0x0048('0x5'));var config=require(_0x0048('0x6'));var attributes=require(_0x0048('0x7'));var integrations=require(_0x0048('0x8'));module['exports']=function(_0x5477cf,_0x223e50){return _0x5477cf[_0x0048('0x9')](_0x0048('0xa'),attributes,{'tableName':_0x0048('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x138c08,_0x24bfa1,_0x5cbb66){if(_0x138c08['changed'](_0x0048('0xc'))||_0x138c08[_0x0048('0xd')]('serverUrl')||_0x138c08[_0x0048('0xd')](_0x0048('0xe'))||_0x138c08[_0x0048('0xd')](_0x0048('0xf'))||_0x138c08[_0x0048('0xd')]('code')||_0x138c08['changed'](_0x0048('0x10'))){var _0x157319,_0x1f4a44;_0x157319=_0x138c08['serverUrl'];var _0x4d9e4a=_0x157319['slice'](-0x1);if(_0x4d9e4a==='/'||_0x4d9e4a==='\x5c'||_0x4d9e4a===':'){_0x157319=_0x157319[_0x0048('0x11')](0x0,_0x157319[_0x0048('0x12')](_0x4d9e4a));}switch(_0x138c08['zone']){case'US':_0x1f4a44=_0x0048('0x13');break;case'AU':_0x1f4a44=_0x0048('0x14');break;case'IN':_0x1f4a44='https://accounts.zoho.in';break;case'CN':_0x1f4a44='https://accounts.zoho.com.cn';break;default:_0x1f4a44=_0x0048('0x15');break;}var _0x573a2e={'method':_0x0048('0x16'),'uri':_0x1f4a44+_0x0048('0x17'),'form':{'grant_type':_0x0048('0x18'),'client_id':_0x138c08[_0x0048('0xe')],'client_secret':_0x138c08['clientSecret'],'redirect_uri':_0x138c08['serverUrl'],'code':_0x138c08[_0x0048('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x573a2e)[_0x0048('0x1a')](function(_0x485f98){var _0x4f4858=JSON['parse'](_0x485f98);if(_0x4f4858[_0x0048('0x1b')]){_0x138c08[_0x0048('0x1c')]=_0x4f4858['refresh_token'];logger[_0x0048('0x1d')](util['format'](_0x0048('0x1e'),_0x138c08[_0x0048('0x1f')],_0x138c08['id']));}else{logger[_0x0048('0x20')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x138c08[_0x0048('0x1f')],_0x138c08['id']),util[_0x0048('0x21')](_0x4f4858,{'showHidden':![],'depth':null}));}return _0x5cbb66(null,_0x24bfa1);})[_0x0048('0x22')](function(_0x13ffe1){logger[_0x0048('0x20')](util[_0x0048('0x23')](_0x0048('0x24'),_0x138c08['name'],_0x138c08['id']),util[_0x0048('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x5cbb66(_0x13ffe1);});}else{return _0x5cbb66(null,_0x24bfa1);}},'beforeUpdate':function(_0x2c7f64,_0x1c7b01,_0x45931d){if(_0x2c7f64[_0x0048('0xd')](_0x0048('0xc'))||_0x2c7f64[_0x0048('0xd')]('serverUrl')||_0x2c7f64[_0x0048('0xd')](_0x0048('0xe'))||_0x2c7f64[_0x0048('0xd')]('clientSecret')||_0x2c7f64['changed']('code')||_0x2c7f64[_0x0048('0xd')]('host')){var _0x340d6b,_0x9d43b0;_0x340d6b=_0x2c7f64['serverUrl'];var _0x446fa1=_0x340d6b['slice'](-0x1);if(_0x446fa1==='/'||_0x446fa1==='\x5c'||_0x446fa1===':'){_0x340d6b=_0x340d6b[_0x0048('0x11')](0x0,_0x340d6b[_0x0048('0x12')](_0x446fa1));}switch(_0x2c7f64[_0x0048('0xc')]){case'US':_0x9d43b0=_0x0048('0x13');break;case'AU':_0x9d43b0='https://accounts.zoho.com.au';break;case'IN':_0x9d43b0=_0x0048('0x25');break;case'CN':_0x9d43b0=_0x0048('0x26');break;default:_0x9d43b0=_0x0048('0x15');break;}var _0x1519be={'method':_0x0048('0x16'),'uri':_0x9d43b0+_0x0048('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x2c7f64['clientId'],'client_secret':_0x2c7f64['clientSecret'],'redirect_uri':_0x2c7f64[_0x0048('0x27')],'code':_0x2c7f64[_0x0048('0x19')]},'headers':{'Content-Type':_0x0048('0x28')}};return rp(_0x1519be)[_0x0048('0x1a')](function(_0x663e97){var _0xe1f24f=JSON[_0x0048('0x29')](_0x663e97);if(_0xe1f24f[_0x0048('0x1b')]){_0x2c7f64[_0x0048('0x1c')]=_0xe1f24f[_0x0048('0x1b')];logger[_0x0048('0x1d')](util[_0x0048('0x23')](_0x0048('0x1e'),_0x2c7f64[_0x0048('0x1f')],_0x2c7f64['id']));}else{logger['error'](util[_0x0048('0x23')](_0x0048('0x24'),_0x2c7f64[_0x0048('0x1f')],_0x2c7f64['id']),util['inspect'](_0xe1f24f,{'showHidden':![],'depth':null}));}return _0x45931d(null,_0x1c7b01);})[_0x0048('0x22')](function(_0x50af97){logger[_0x0048('0x20')](util['format'](_0x0048('0x24'),_0x2c7f64['name'],_0x2c7f64['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x45931d(_0x50af97);});}else{return _0x45931d(null,_0x1c7b01);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 5ba2189..ef9624d 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 _0x0d49=['ZohoAccount','options','raw','attributes','limit','include','map','model','ShowZohoAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetZohoAccount'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x0d49,0x19c));var _0x90d4=function(_0x5c0dc5,_0x5cfe64){_0x5c0dc5=_0x5c0dc5-0x0;var _0x254c85=_0x0d49[_0x5c0dc5];return _0x254c85;};'use strict';var _=require('lodash');var util=require(_0x90d4('0x0'));var moment=require('moment');var BPromise=require(_0x90d4('0x1'));var rs=require(_0x90d4('0x2'));var fs=require('fs');var Redis=require(_0x90d4('0x3'));var db=require(_0x90d4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x90d4('0x5'))(_0x90d4('0x6'));var config=require(_0x90d4('0x7'));var jayson=require(_0x90d4('0x8'));var client=jayson[_0x90d4('0x9')][_0x90d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d5761,_0x43fb54,_0xff38a7){return new BPromise(function(_0x3f7aab,_0x43ebd1){return client['request'](_0x2d5761,_0xff38a7)[_0x90d4('0xb')](function(_0x294015){logger['info'](_0x90d4('0xc'),_0x43fb54,'request\x20sent');logger[_0x90d4('0xd')](_0x90d4('0xe'),_0x43fb54,_0x90d4('0xf'),JSON[_0x90d4('0x10')](_0x294015));if(_0x294015[_0x90d4('0x11')]){if(_0x294015[_0x90d4('0x11')][_0x90d4('0x12')]===0x1f4){logger[_0x90d4('0x11')](_0x90d4('0xc'),_0x43fb54,_0x294015[_0x90d4('0x11')][_0x90d4('0x13')]);return _0x43ebd1(_0x294015[_0x90d4('0x11')][_0x90d4('0x13')]);}logger[_0x90d4('0x11')](_0x90d4('0xc'),_0x43fb54,_0x294015[_0x90d4('0x11')][_0x90d4('0x13')]);return _0x3f7aab(_0x294015[_0x90d4('0x11')][_0x90d4('0x13')]);}else{logger[_0x90d4('0x14')](_0x90d4('0xc'),_0x43fb54,_0x90d4('0xf'));_0x3f7aab(_0x294015['result'][_0x90d4('0x13')]);}})['catch'](function(_0x492085){logger[_0x90d4('0x11')](_0x90d4('0xc'),_0x43fb54,_0x492085);_0x43ebd1(_0x492085);});});}exports[_0x90d4('0x15')]=function(_0x39ddcc){var _0x327bbc=this;return new Promise(function(_0x2d88a1,_0x3be119){return db[_0x90d4('0x16')]['findAll']({'raw':_0x39ddcc[_0x90d4('0x17')]?_0x39ddcc[_0x90d4('0x17')][_0x90d4('0x18')]===undefined?!![]:![]:!![],'where':_0x39ddcc[_0x90d4('0x17')]?_0x39ddcc[_0x90d4('0x17')]['where']||null:null,'attributes':_0x39ddcc[_0x90d4('0x17')]?_0x39ddcc[_0x90d4('0x17')][_0x90d4('0x19')]||null:null,'limit':_0x39ddcc[_0x90d4('0x17')]?_0x39ddcc[_0x90d4('0x17')][_0x90d4('0x1a')]||null:null,'include':_0x39ddcc['options']?_0x39ddcc[_0x90d4('0x17')][_0x90d4('0x1b')]?_[_0x90d4('0x1c')](_0x39ddcc[_0x90d4('0x17')]['include'],function(_0x42d39c){return{'model':db[_0x42d39c[_0x90d4('0x1d')]],'as':_0x42d39c['as'],'attributes':_0x42d39c[_0x90d4('0x19')],'include':_0x42d39c[_0x90d4('0x1b')]?_[_0x90d4('0x1c')](_0x42d39c['include'],function(_0xa7e465){return{'model':db[_0xa7e465['model']],'as':_0xa7e465['as'],'attributes':_0xa7e465[_0x90d4('0x19')],'include':_0xa7e465['include']?_[_0x90d4('0x1c')](_0xa7e465[_0x90d4('0x1b')],function(_0x10a808){return{'model':db[_0x10a808[_0x90d4('0x1d')]],'as':_0x10a808['as'],'attributes':_0x10a808[_0x90d4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48b4c7){logger['info'](_0x90d4('0x15'),_0x39ddcc);logger[_0x90d4('0xd')](_0x90d4('0x15'),_0x39ddcc,JSON[_0x90d4('0x10')](_0x48b4c7));_0x2d88a1(_0x48b4c7);})['catch'](function(_0x271a92){logger['error'](_0x90d4('0x15'),_0x271a92[_0x90d4('0x13')],_0x39ddcc);_0x3be119(_0x327bbc[_0x90d4('0x11')](0x1f4,_0x271a92['message']));});});};exports[_0x90d4('0x1e')]=function(_0x354f55){var _0x460186=this;return new Promise(function(_0x3f2c99,_0x1b75f2){return db[_0x90d4('0x16')]['find']({'raw':_0x354f55[_0x90d4('0x17')]?_0x354f55[_0x90d4('0x17')][_0x90d4('0x18')]===undefined?!![]:![]:!![],'where':_0x354f55[_0x90d4('0x17')]?_0x354f55[_0x90d4('0x17')]['where']||null:null,'attributes':_0x354f55['options']?_0x354f55[_0x90d4('0x17')]['attributes']||null:null,'include':_0x354f55[_0x90d4('0x17')]?_0x354f55['options'][_0x90d4('0x1b')]?_['map'](_0x354f55[_0x90d4('0x17')][_0x90d4('0x1b')],function(_0x4fb942){return{'model':db[_0x4fb942[_0x90d4('0x1d')]],'as':_0x4fb942['as'],'attributes':_0x4fb942['attributes'],'include':_0x4fb942[_0x90d4('0x1b')]?_[_0x90d4('0x1c')](_0x4fb942[_0x90d4('0x1b')],function(_0x93e702){return{'model':db[_0x93e702[_0x90d4('0x1d')]],'as':_0x93e702['as'],'attributes':_0x93e702[_0x90d4('0x19')],'include':_0x93e702[_0x90d4('0x1b')]?_[_0x90d4('0x1c')](_0x93e702['include'],function(_0x5c8451){return{'model':db[_0x5c8451['model']],'as':_0x5c8451['as'],'attributes':_0x5c8451[_0x90d4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x90d4('0xb')](function(_0x31aee8){logger[_0x90d4('0x14')](_0x90d4('0x1e'),_0x354f55);logger[_0x90d4('0xd')](_0x90d4('0x1e'),_0x354f55,JSON[_0x90d4('0x10')](_0x31aee8));_0x3f2c99(_0x31aee8);})['catch'](function(_0x538034){logger[_0x90d4('0x11')](_0x90d4('0x1e'),_0x538034[_0x90d4('0x13')],_0x354f55);_0x1b75f2(_0x460186[_0x90d4('0x11')](0x1f4,_0x538034[_0x90d4('0x13')]));});});}; \ No newline at end of file +var _0xe81e=['include','map','model','attributes','stringify','ShowZohoAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetZohoAccount','findAll','options','raw','where','limit'];(function(_0x1ed36f,_0x3a544f){var _0x99d754=function(_0x5d6459){while(--_0x5d6459){_0x1ed36f['push'](_0x1ed36f['shift']());}};_0x99d754(++_0x3a544f);}(_0xe81e,0xb6));var _0xee81=function(_0x72c194,_0x1a953a){_0x72c194=_0x72c194-0x0;var _0x1f4f68=_0xe81e[_0x72c194];return _0x1f4f68;};'use strict';var _=require(_0xee81('0x0'));var util=require(_0xee81('0x1'));var moment=require(_0xee81('0x2'));var BPromise=require('bluebird');var rs=require(_0xee81('0x3'));var fs=require('fs');var Redis=require(_0xee81('0x4'));var db=require(_0xee81('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xee81('0x6'))(_0xee81('0x7'));var config=require(_0xee81('0x8'));var jayson=require(_0xee81('0x9'));var client=jayson[_0xee81('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27a465,_0x4543be,_0x3814a5){return new BPromise(function(_0x86f845,_0xdde81d){return client[_0xee81('0xb')](_0x27a465,_0x3814a5)[_0xee81('0xc')](function(_0x29c197){logger['info'](_0xee81('0xd'),_0x4543be,_0xee81('0xe'));logger[_0xee81('0xf')](_0xee81('0x10'),_0x4543be,_0xee81('0xe'),JSON['stringify'](_0x29c197));if(_0x29c197[_0xee81('0x11')]){if(_0x29c197['error'][_0xee81('0x12')]===0x1f4){logger[_0xee81('0x11')](_0xee81('0xd'),_0x4543be,_0x29c197[_0xee81('0x11')][_0xee81('0x13')]);return _0xdde81d(_0x29c197[_0xee81('0x11')][_0xee81('0x13')]);}logger[_0xee81('0x11')](_0xee81('0xd'),_0x4543be,_0x29c197[_0xee81('0x11')]['message']);return _0x86f845(_0x29c197[_0xee81('0x11')]['message']);}else{logger[_0xee81('0x14')](_0xee81('0xd'),_0x4543be,_0xee81('0xe'));_0x86f845(_0x29c197['result'][_0xee81('0x13')]);}})[_0xee81('0x15')](function(_0x32e472){logger[_0xee81('0x11')](_0xee81('0xd'),_0x4543be,_0x32e472);_0xdde81d(_0x32e472);});});}exports[_0xee81('0x16')]=function(_0x1b6c46){var _0x4dd4fa=this;return new Promise(function(_0x5065d7,_0x3c6f70){return db['ZohoAccount'][_0xee81('0x17')]({'raw':_0x1b6c46[_0xee81('0x18')]?_0x1b6c46[_0xee81('0x18')][_0xee81('0x19')]===undefined?!![]:![]:!![],'where':_0x1b6c46[_0xee81('0x18')]?_0x1b6c46['options'][_0xee81('0x1a')]||null:null,'attributes':_0x1b6c46[_0xee81('0x18')]?_0x1b6c46[_0xee81('0x18')]['attributes']||null:null,'limit':_0x1b6c46['options']?_0x1b6c46[_0xee81('0x18')][_0xee81('0x1b')]||null:null,'include':_0x1b6c46[_0xee81('0x18')]?_0x1b6c46[_0xee81('0x18')][_0xee81('0x1c')]?_[_0xee81('0x1d')](_0x1b6c46[_0xee81('0x18')][_0xee81('0x1c')],function(_0x43d52a){return{'model':db[_0x43d52a[_0xee81('0x1e')]],'as':_0x43d52a['as'],'attributes':_0x43d52a[_0xee81('0x1f')],'include':_0x43d52a[_0xee81('0x1c')]?_[_0xee81('0x1d')](_0x43d52a[_0xee81('0x1c')],function(_0x4bbe10){return{'model':db[_0x4bbe10[_0xee81('0x1e')]],'as':_0x4bbe10['as'],'attributes':_0x4bbe10[_0xee81('0x1f')],'include':_0x4bbe10[_0xee81('0x1c')]?_[_0xee81('0x1d')](_0x4bbe10['include'],function(_0xb792ec){return{'model':db[_0xb792ec[_0xee81('0x1e')]],'as':_0xb792ec['as'],'attributes':_0xb792ec['attributes']};}):[]};}):[]};}):[]:[]})[_0xee81('0xc')](function(_0x5ee93d){logger[_0xee81('0x14')](_0xee81('0x16'),_0x1b6c46);logger[_0xee81('0xf')](_0xee81('0x16'),_0x1b6c46,JSON[_0xee81('0x20')](_0x5ee93d));_0x5065d7(_0x5ee93d);})[_0xee81('0x15')](function(_0x4077ef){logger[_0xee81('0x11')](_0xee81('0x16'),_0x4077ef['message'],_0x1b6c46);_0x3c6f70(_0x4dd4fa['error'](0x1f4,_0x4077ef[_0xee81('0x13')]));});});};exports[_0xee81('0x21')]=function(_0x556a83){var _0x2dece7=this;return new Promise(function(_0x18a3eb,_0x3c247b){return db['ZohoAccount'][_0xee81('0x22')]({'raw':_0x556a83[_0xee81('0x18')]?_0x556a83[_0xee81('0x18')][_0xee81('0x19')]===undefined?!![]:![]:!![],'where':_0x556a83['options']?_0x556a83['options']['where']||null:null,'attributes':_0x556a83[_0xee81('0x18')]?_0x556a83[_0xee81('0x18')]['attributes']||null:null,'include':_0x556a83[_0xee81('0x18')]?_0x556a83[_0xee81('0x18')][_0xee81('0x1c')]?_['map'](_0x556a83[_0xee81('0x18')][_0xee81('0x1c')],function(_0x3da047){return{'model':db[_0x3da047[_0xee81('0x1e')]],'as':_0x3da047['as'],'attributes':_0x3da047[_0xee81('0x1f')],'include':_0x3da047[_0xee81('0x1c')]?_['map'](_0x3da047[_0xee81('0x1c')],function(_0x25b152){return{'model':db[_0x25b152['model']],'as':_0x25b152['as'],'attributes':_0x25b152['attributes'],'include':_0x25b152[_0xee81('0x1c')]?_['map'](_0x25b152['include'],function(_0x430dc4){return{'model':db[_0x430dc4[_0xee81('0x1e')]],'as':_0x430dc4['as'],'attributes':_0x430dc4[_0xee81('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee81('0xc')](function(_0x1e23c0){logger['info'](_0xee81('0x21'),_0x556a83);logger[_0xee81('0xf')](_0xee81('0x21'),_0x556a83,JSON['stringify'](_0x1e23c0));_0x18a3eb(_0x1e23c0);})[_0xee81('0x15')](function(_0x40417e){logger[_0xee81('0x11')](_0xee81('0x21'),_0x40417e['message'],_0x556a83);_0x3c247b(_0x2dece7['error'](0x1f4,_0x40417e['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 554f765..d68147b 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 _0x68b7=['/:id/subjects','getSubjects','getDescriptions','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x38409e,_0x48b289){var _0x200265=function(_0x63243c){while(--_0x63243c){_0x38409e['push'](_0x38409e['shift']());}};_0x200265(++_0x48b289);}(_0x68b7,0x8c));var _0x768b=function(_0x133ad1,_0xad51d3){_0x133ad1=_0x133ad1-0x0;var _0x4de3a0=_0x68b7[_0x133ad1];return _0x4de3a0;};'use strict';var multer=require(_0x768b('0x0'));var util=require('util');var path=require(_0x768b('0x1'));var timeout=require(_0x768b('0x2'));var express=require(_0x768b('0x3'));var router=express['Router']();var auth=require(_0x768b('0x4'));var interaction=require(_0x768b('0x5'));var config=require(_0x768b('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x768b('0x7')]('/',auth[_0x768b('0x8')](),controller[_0x768b('0x9')]);router[_0x768b('0x7')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0xb')]);router['get'](_0x768b('0xc'),auth['isAuthenticated'](),controller[_0x768b('0xd')]);router[_0x768b('0x7')](_0x768b('0xe'),auth[_0x768b('0x8')](),controller[_0x768b('0xf')]);router[_0x768b('0x7')]('/:id/descriptions',auth[_0x768b('0x8')](),controller[_0x768b('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x768b('0x11')]);router[_0x768b('0x12')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0x13')]);router[_0x768b('0x14')](_0x768b('0xa'),auth[_0x768b('0x8')](),controller[_0x768b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5fc7=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x59a053,_0x3d743f){var _0x4bf794=function(_0x5589ef){while(--_0x5589ef){_0x59a053['push'](_0x59a053['shift']());}};_0x4bf794(++_0x3d743f);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x5fc7[_0x31b5a5];return _0x364cc9;};'use strict';var multer=require(_0x75fc('0x0'));var util=require(_0x75fc('0x1'));var path=require(_0x75fc('0x2'));var timeout=require(_0x75fc('0x3'));var express=require(_0x75fc('0x4'));var router=express[_0x75fc('0x5')]();var auth=require(_0x75fc('0x6'));var interaction=require(_0x75fc('0x7'));var config=require(_0x75fc('0x8'));var controller=require(_0x75fc('0x9'));router[_0x75fc('0xa')]('/',auth[_0x75fc('0xb')](),controller['index']);router[_0x75fc('0xa')](_0x75fc('0xc'),auth[_0x75fc('0xb')](),controller[_0x75fc('0xd')]);router[_0x75fc('0xa')](_0x75fc('0xe'),auth[_0x75fc('0xb')](),controller[_0x75fc('0xf')]);router[_0x75fc('0xa')](_0x75fc('0x10'),auth['isAuthenticated'](),controller[_0x75fc('0x11')]);router[_0x75fc('0xa')](_0x75fc('0x12'),auth[_0x75fc('0xb')](),controller['getDescriptions']);router[_0x75fc('0x13')]('/',auth[_0x75fc('0xb')](),controller[_0x75fc('0x14')]);router[_0x75fc('0x15')](_0x75fc('0xc'),auth[_0x75fc('0xb')](),controller[_0x75fc('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x75fc('0x17')]);module[_0x75fc('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e4d4fa2..4aaab82 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 _0x8f0e=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0x5654c0,_0x151b1b){var _0x5b2c8e=function(_0x1e5a95){while(--_0x1e5a95){_0x5654c0['push'](_0x5654c0['shift']());}};_0x5b2c8e(++_0x151b1b);}(_0x8f0e,0x171));var _0xe8f0=function(_0x4e84d7,_0x3b317d){_0x4e84d7=_0x4e84d7-0x0;var _0x5c99fa=_0x8f0e[_0x4e84d7];return _0x5c99fa;};'use strict';var Sequelize=require('sequelize');module[_0xe8f0('0x0')]={'name':{'type':Sequelize[_0xe8f0('0x1')]},'moduleCreate':{'type':Sequelize[_0xe8f0('0x2')](_0xe8f0('0x3'),_0xe8f0('0x4'),_0xe8f0('0x5')),'defaultValue':_0xe8f0('0x3')},'moduleSearch':{'type':Sequelize[_0xe8f0('0x2')](_0xe8f0('0x6'),_0xe8f0('0x4'),_0xe8f0('0x3')),'defaultValue':_0xe8f0('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa733=['exports','STRING','ENUM','contact','nothing','lead','contact_lead','sequelize'];(function(_0x3329bd,_0xd1b1b2){var _0x4416cc=function(_0x4f5a37){while(--_0x4f5a37){_0x3329bd['push'](_0x3329bd['shift']());}};_0x4416cc(++_0xd1b1b2);}(_0xa733,0x16f));var _0x3a73=function(_0x4cad09,_0x31dbca){_0x4cad09=_0x4cad09-0x0;var _0x2a31a6=_0xa733[_0x4cad09];return _0x2a31a6;};'use strict';var Sequelize=require(_0x3a73('0x0'));module[_0x3a73('0x1')]={'name':{'type':Sequelize[_0x3a73('0x2')]},'moduleCreate':{'type':Sequelize[_0x3a73('0x3')]('lead',_0x3a73('0x4'),_0x3a73('0x5')),'defaultValue':_0x3a73('0x6')},'moduleSearch':{'type':Sequelize['ENUM'](_0x3a73('0x7'),_0x3a73('0x4'),_0x3a73('0x6')),'defaultValue':_0x3a73('0x7')},'description':{'type':Sequelize[_0x3a73('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 079593f..692eecf 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 _0x0693=['order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','destroy','findOne','pick','getFields','ZohoField','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','json','count','offset','limit','status','set','Content-Range','apply','reject','update','end','sendStatus','stack','name','send','ZohoConfiguration','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x0693,0xce));var _0x3069=function(_0x4278e0,_0x520733){_0x4278e0=_0x4278e0-0x0;var _0x53d653=_0x0693[_0x4278e0];return _0x53d653;};'use strict';var pdf=require(_0x3069('0x0'));var emlformat=require(_0x3069('0x1'));var rimraf=require(_0x3069('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3069('0x3'));var rp=require(_0x3069('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3069('0x5'));var util=require('util');var path=require(_0x3069('0x6'));var sox=require(_0x3069('0x7'));var csv=require(_0x3069('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3069('0x9'));var squel=require(_0x3069('0xa'));var crypto=require(_0x3069('0xb'));var jsforce=require(_0x3069('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3069('0x8'));var querystring=require(_0x3069('0xd'));var Papa=require(_0x3069('0xe'));var Redis=require('ioredis');var authService=require(_0x3069('0xf'));var qs=require(_0x3069('0x10'));var as=require(_0x3069('0x11'));var hardwareService=require(_0x3069('0x12'));var logger=require(_0x3069('0x13'))('api');var utils=require(_0x3069('0x14'));var config=require(_0x3069('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3069('0x16'));var client=jayson[_0x3069('0x17')][_0x3069('0x18')]({'port':0x232a});function checkPasswordPattern(_0x62ecb0,_0x40ab2e,_0x5d3c6f){if(_0x5d3c6f){var _0x8682d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8682d4['test'](_0x40ab2e)){return _0x62ecb0;}else{throw new db[(_0x3069('0x19'))]['ValidationError'](_0x3069('0x1a'));}}else{return _0x62ecb0;}}function respondWithRpcPromise(_0x391661,_0x43813f,_0x3a94f5,_0x467def){return new BPromise(function(_0x46f89a,_0x1368a5){var _0x18c37e=_0x467def||client;return _0x18c37e[_0x3069('0x1b')](_0x391661,_0x3a94f5)[_0x3069('0x1c')](function(_0x4e660b){logger[_0x3069('0x1d')](_0x3069('0x1e'),_0x43813f,_0x3069('0x1f'));logger[_0x3069('0x20')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x43813f,_0x3069('0x1f'),JSON['stringify'](_0x4e660b));if(_0x4e660b[_0x3069('0x21')]){if(_0x4e660b[_0x3069('0x21')][_0x3069('0x22')]===0x1f4){logger[_0x3069('0x21')](_0x3069('0x1e'),_0x43813f,_0x4e660b['error'][_0x3069('0x23')]);return _0x1368a5(_0x4e660b['error'][_0x3069('0x23')]);}logger[_0x3069('0x21')](_0x3069('0x1e'),_0x43813f,_0x4e660b[_0x3069('0x21')][_0x3069('0x23')]);return _0x46f89a(_0x4e660b['error'][_0x3069('0x23')]);}else{logger[_0x3069('0x1d')](_0x3069('0x1e'),_0x43813f,_0x3069('0x1f'));_0x46f89a(_0x4e660b['result'][_0x3069('0x23')]);}})[_0x3069('0x24')](function(_0x566933){logger['error'](_0x3069('0x1e'),_0x43813f,_0x566933);_0x1368a5(_0x566933);});});}function respondWithStatusCode(_0x435385,_0xbe067){_0xbe067=_0xbe067||0xcc;return function(_0x1aa64e){if(_0x1aa64e){return _0x435385['sendStatus'](_0xbe067);}return _0x435385['status'](_0xbe067)['end']();};}function respondWithResult(_0x1e4e9f,_0x16b15){_0x16b15=_0x16b15||0xc8;return function(_0x74e04){if(_0x74e04){return _0x1e4e9f['status'](_0x16b15)[_0x3069('0x25')](_0x74e04);}};}function respondWithFilteredResult(_0x5d0671,_0x17faa1){return function(_0x4f9243){if(_0x4f9243){var _0xf7526f=_0x4f9243[_0x3069('0x26')],_0x4393f0=_0x17faa1[_0x3069('0x27')],_0x1875ca=_0x17faa1[_0x3069('0x27')]+_0x17faa1[_0x3069('0x28')],_0x225590;if(_0x1875ca>=_0xf7526f){_0x1875ca=_0xf7526f;_0x225590=0xc8;}else{_0x225590=0xce;}_0x5d0671[_0x3069('0x29')](_0x225590);return _0x5d0671[_0x3069('0x2a')](_0x3069('0x2b'),_0x4393f0+'-'+_0x1875ca+'/'+_0xf7526f)['json'](_0x4f9243);}return null;};}function patchUpdates(_0x270472){return function(_0x3a4eaa){try{jsonpatch[_0x3069('0x2c')](_0x3a4eaa,_0x270472,!![]);}catch(_0x1d021c){return BPromise[_0x3069('0x2d')](_0x1d021c);}return _0x3a4eaa['save']();};}function saveUpdates(_0x221436,_0x53c304){return function(_0x47226e){if(_0x47226e){return _0x47226e[_0x3069('0x2e')](_0x221436)[_0x3069('0x1c')](function(_0x304d65){return _0x304d65;});}return null;};}function removeEntity(_0x4970ea,_0x5c0109){return function(_0x26324a){if(_0x26324a){return _0x26324a['destroy']()[_0x3069('0x1c')](function(){_0x4970ea['status'](0xcc)[_0x3069('0x2f')]();});}};}function handleEntityNotFound(_0x5cc30f,_0x294b95){return function(_0x1291bd){if(!_0x1291bd){_0x5cc30f[_0x3069('0x30')](0x194);}return _0x1291bd;};}function handleError(_0x469f42,_0x3306a8){_0x3306a8=_0x3306a8||0x1f4;return function(_0x2e6851){logger[_0x3069('0x21')](_0x2e6851[_0x3069('0x31')]);if(_0x2e6851['name']){delete _0x2e6851[_0x3069('0x32')];}_0x469f42[_0x3069('0x29')](_0x3306a8)[_0x3069('0x33')](_0x2e6851);};}exports['index']=function(_0x43c853,_0x401ad5){var _0x12b755={},_0x1fe0b6={},_0x3e941c={'count':0x0,'rows':[]};var _0x1e990a=_['map'](db[_0x3069('0x34')]['rawAttributes'],function(_0x3d5862){return{'name':_0x3d5862[_0x3069('0x35')],'type':_0x3d5862[_0x3069('0x36')]['key']};});_0x1fe0b6[_0x3069('0x37')]=_[_0x3069('0x38')](_0x1e990a,'name');_0x1fe0b6[_0x3069('0x39')]=_[_0x3069('0x3a')](_0x43c853[_0x3069('0x39')]);_0x1fe0b6['filters']=_[_0x3069('0x3b')](_0x1fe0b6['model'],_0x1fe0b6[_0x3069('0x39')]);_0x12b755[_0x3069('0x3c')]=_[_0x3069('0x3b')](_0x1fe0b6[_0x3069('0x37')],qs[_0x3069('0x3d')](_0x43c853[_0x3069('0x39')][_0x3069('0x3d')]));_0x12b755['attributes']=_0x12b755[_0x3069('0x3c')][_0x3069('0x3e')]?_0x12b755[_0x3069('0x3c')]:_0x1fe0b6[_0x3069('0x37')];if(!_0x43c853[_0x3069('0x39')][_0x3069('0x3f')]('nolimit')){_0x12b755['limit']=qs[_0x3069('0x28')](_0x43c853[_0x3069('0x39')]['limit']);_0x12b755['offset']=qs['offset'](_0x43c853[_0x3069('0x39')][_0x3069('0x27')]);}_0x12b755[_0x3069('0x40')]=qs['sort'](_0x43c853[_0x3069('0x39')][_0x3069('0x41')]);_0x12b755[_0x3069('0x42')]=qs[_0x3069('0x43')](_['pick'](_0x43c853[_0x3069('0x39')],_0x1fe0b6[_0x3069('0x43')]),_0x1e990a);if(_0x43c853[_0x3069('0x39')]['filter']){_0x12b755[_0x3069('0x42')]=_[_0x3069('0x44')](_0x12b755[_0x3069('0x42')],{'$or':_['map'](_0x1e990a,function(_0x4df24a){if(_0x4df24a[_0x3069('0x36')]!==_0x3069('0x45')){var _0x4ede98={};_0x4ede98[_0x4df24a[_0x3069('0x32')]]={'$like':'%'+_0x43c853[_0x3069('0x39')][_0x3069('0x46')]+'%'};return _0x4ede98;}})});}_0x12b755=_[_0x3069('0x44')]({},_0x12b755,_0x43c853[_0x3069('0x47')]);var _0x1b7acc={'where':_0x12b755[_0x3069('0x42')]};return db[_0x3069('0x34')]['count'](_0x1b7acc)[_0x3069('0x1c')](function(_0xc60351){_0x3e941c['count']=_0xc60351;if(_0x43c853[_0x3069('0x39')][_0x3069('0x48')]){_0x12b755[_0x3069('0x49')]=[{'all':!![]}];}return db[_0x3069('0x34')][_0x3069('0x4a')](_0x12b755);})[_0x3069('0x1c')](function(_0x2c830f){_0x3e941c[_0x3069('0x4b')]=_0x2c830f;return _0x3e941c;})[_0x3069('0x1c')](respondWithFilteredResult(_0x401ad5,_0x12b755))['catch'](handleError(_0x401ad5,null));};exports[_0x3069('0x4c')]=function(_0x36fc51,_0x1d8508){var _0x23c948={'raw':![],'where':{'id':_0x36fc51[_0x3069('0x4d')]['id']}},_0x51f321={};_0x51f321[_0x3069('0x37')]=_[_0x3069('0x3a')](db[_0x3069('0x34')][_0x3069('0x4e')]);_0x51f321[_0x3069('0x39')]=_['keys'](_0x36fc51[_0x3069('0x39')]);_0x51f321[_0x3069('0x43')]=_[_0x3069('0x3b')](_0x51f321[_0x3069('0x37')],_0x51f321[_0x3069('0x39')]);_0x23c948[_0x3069('0x3c')]=_[_0x3069('0x3b')](_0x51f321[_0x3069('0x37')],qs[_0x3069('0x3d')](_0x36fc51[_0x3069('0x39')]['fields']));_0x23c948[_0x3069('0x3c')]=_0x23c948[_0x3069('0x3c')]['length']?_0x23c948[_0x3069('0x3c')]:_0x51f321[_0x3069('0x37')];if(_0x36fc51[_0x3069('0x39')][_0x3069('0x48')]){_0x23c948[_0x3069('0x49')]=[{'all':!![]}];}_0x23c948=_[_0x3069('0x44')]({},_0x23c948,_0x36fc51[_0x3069('0x47')]);return db[_0x3069('0x34')]['find'](_0x23c948)[_0x3069('0x1c')](handleEntityNotFound(_0x1d8508,null))[_0x3069('0x1c')](respondWithResult(_0x1d8508,null))[_0x3069('0x24')](handleError(_0x1d8508,null));};exports['create']=function(_0x2d923a,_0x4efb1d){return db[_0x3069('0x34')][_0x3069('0x4f')](_0x2d923a[_0x3069('0x50')],{})[_0x3069('0x1c')](respondWithResult(_0x4efb1d,0xc9))[_0x3069('0x24')](handleError(_0x4efb1d,null));};exports[_0x3069('0x2e')]=function(_0x566172,_0xc69a42){if(_0x566172['body']['id']){delete _0x566172[_0x3069('0x50')]['id'];}return db['ZohoConfiguration'][_0x3069('0x51')]({'where':{'id':_0x566172[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0xc69a42,null))[_0x3069('0x1c')](saveUpdates(_0x566172[_0x3069('0x50')],null))[_0x3069('0x1c')](respondWithResult(_0xc69a42,null))[_0x3069('0x24')](handleError(_0xc69a42,null));};exports[_0x3069('0x52')]=function(_0x3a18b7,_0x10603e){return db[_0x3069('0x34')]['find']({'where':{'id':_0x3a18b7[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0x10603e,null))['then'](removeEntity(_0x10603e,null))['catch'](handleError(_0x10603e,null));};exports['getFields']=function(_0x4d8312,_0x2046e2,_0xf630d3){var _0x535371={};var _0x74ef07={};var _0xa30959;var _0x32a38f;return db['ZohoConfiguration'][_0x3069('0x53')]({'where':{'id':_0x4d8312[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0x2046e2,null))[_0x3069('0x1c')](function(_0x30512c){if(_0x30512c){_0xa30959=_0x30512c;_0x74ef07[_0x3069('0x37')]=_[_0x3069('0x3a')](db['ZohoField']['rawAttributes']);_0x74ef07[_0x3069('0x39')]=_[_0x3069('0x3a')](_0x4d8312['query']);_0x74ef07[_0x3069('0x43')]=_[_0x3069('0x3b')](_0x74ef07[_0x3069('0x37')],_0x74ef07['query']);_0x535371[_0x3069('0x3c')]=_['intersection'](_0x74ef07['model'],qs[_0x3069('0x3d')](_0x4d8312[_0x3069('0x39')][_0x3069('0x3d')]));_0x535371[_0x3069('0x3c')]=_0x535371[_0x3069('0x3c')][_0x3069('0x3e')]?_0x535371[_0x3069('0x3c')]:_0x74ef07[_0x3069('0x37')];_0x535371[_0x3069('0x40')]=qs['sort'](_0x4d8312[_0x3069('0x39')][_0x3069('0x41')]);_0x535371[_0x3069('0x42')]=qs[_0x3069('0x43')](_[_0x3069('0x54')](_0x4d8312[_0x3069('0x39')],_0x74ef07[_0x3069('0x43')]));if(_0x4d8312['query'][_0x3069('0x46')]){_0x535371[_0x3069('0x42')]=_[_0x3069('0x44')](_0x535371['where'],{'$or':_[_0x3069('0x38')](_0x535371['attributes'],function(_0x82a658){var _0x44493d={};_0x44493d[_0x82a658]={'$like':'%'+_0x4d8312[_0x3069('0x39')][_0x3069('0x46')]+'%'};return _0x44493d;})});}_0x535371=_[_0x3069('0x44')]({},_0x535371,_0x4d8312[_0x3069('0x47')]);return _0xa30959['getFields'](_0x535371);}})[_0x3069('0x1c')](function(_0xe3aa12){if(_0xe3aa12){_0x32a38f=_0xe3aa12[_0x3069('0x3e')];if(!_0x4d8312['query'][_0x3069('0x3f')]('nolimit')){_0x535371[_0x3069('0x28')]=qs['limit'](_0x4d8312['query'][_0x3069('0x28')]);_0x535371['offset']=qs[_0x3069('0x27')](_0x4d8312[_0x3069('0x39')][_0x3069('0x27')]);}return _0xa30959[_0x3069('0x55')](_0x535371);}})['then'](function(_0x573cd3){if(_0x573cd3){return _0x573cd3?{'count':_0x32a38f,'rows':_0x573cd3}:null;}})['then'](respondWithResult(_0x2046e2,null))['catch'](handleError(_0x2046e2,null));};exports['getSubjects']=function(_0x7262a8,_0x16e9f5,_0x8179f6){var _0x1228e9={};var _0x1b553d={};var _0x53e8a2;var _0x2e491f;return db[_0x3069('0x34')][_0x3069('0x53')]({'where':{'id':_0x7262a8[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0x16e9f5,null))[_0x3069('0x1c')](function(_0x351328){if(_0x351328){_0x53e8a2=_0x351328;_0x1b553d[_0x3069('0x37')]=_[_0x3069('0x3a')](db[_0x3069('0x56')]['rawAttributes']);_0x1b553d[_0x3069('0x39')]=_[_0x3069('0x3a')](_0x7262a8['query']);_0x1b553d[_0x3069('0x43')]=_[_0x3069('0x3b')](_0x1b553d[_0x3069('0x37')],_0x1b553d['query']);_0x1228e9[_0x3069('0x3c')]=_[_0x3069('0x3b')](_0x1b553d[_0x3069('0x37')],qs[_0x3069('0x3d')](_0x7262a8[_0x3069('0x39')][_0x3069('0x3d')]));_0x1228e9[_0x3069('0x3c')]=_0x1228e9[_0x3069('0x3c')][_0x3069('0x3e')]?_0x1228e9[_0x3069('0x3c')]:_0x1b553d['model'];_0x1228e9[_0x3069('0x40')]=qs[_0x3069('0x41')](_0x7262a8[_0x3069('0x39')][_0x3069('0x41')]);_0x1228e9['where']=qs[_0x3069('0x43')](_[_0x3069('0x54')](_0x7262a8[_0x3069('0x39')],_0x1b553d['filters']));if(_0x7262a8[_0x3069('0x39')][_0x3069('0x46')]){_0x1228e9[_0x3069('0x42')]=_['merge'](_0x1228e9[_0x3069('0x42')],{'$or':_[_0x3069('0x38')](_0x1228e9['attributes'],function(_0x413bae){var _0xac383f={};_0xac383f[_0x413bae]={'$like':'%'+_0x7262a8[_0x3069('0x39')][_0x3069('0x46')]+'%'};return _0xac383f;})});}_0x1228e9=_[_0x3069('0x44')]({},_0x1228e9,_0x7262a8['options']);return _0x53e8a2['getSubjects'](_0x1228e9);}})[_0x3069('0x1c')](function(_0x1a1ecc){if(_0x1a1ecc){_0x2e491f=_0x1a1ecc[_0x3069('0x3e')];if(!_0x7262a8[_0x3069('0x39')][_0x3069('0x3f')](_0x3069('0x57'))){_0x1228e9['limit']=qs[_0x3069('0x28')](_0x7262a8[_0x3069('0x39')][_0x3069('0x28')]);_0x1228e9[_0x3069('0x27')]=qs[_0x3069('0x27')](_0x7262a8['query'][_0x3069('0x27')]);}return _0x53e8a2[_0x3069('0x58')](_0x1228e9);}})[_0x3069('0x1c')](function(_0x4cf6f3){if(_0x4cf6f3){return _0x4cf6f3?{'count':_0x2e491f,'rows':_0x4cf6f3}:null;}})[_0x3069('0x1c')](respondWithResult(_0x16e9f5,null))['catch'](handleError(_0x16e9f5,null));};exports['getDescriptions']=function(_0x122c35,_0x51ec54,_0x55fce9){var _0x3587f9={};var _0x25c421={};var _0x5f4a80;var _0x26c334;return db[_0x3069('0x34')][_0x3069('0x53')]({'where':{'id':_0x122c35[_0x3069('0x4d')]['id']}})[_0x3069('0x1c')](handleEntityNotFound(_0x51ec54,null))[_0x3069('0x1c')](function(_0x68a78f){if(_0x68a78f){_0x5f4a80=_0x68a78f;_0x25c421[_0x3069('0x37')]=_['keys'](db['ZohoField'][_0x3069('0x4e')]);_0x25c421[_0x3069('0x39')]=_[_0x3069('0x3a')](_0x122c35[_0x3069('0x39')]);_0x25c421[_0x3069('0x43')]=_['intersection'](_0x25c421[_0x3069('0x37')],_0x25c421[_0x3069('0x39')]);_0x3587f9['attributes']=_[_0x3069('0x3b')](_0x25c421['model'],qs[_0x3069('0x3d')](_0x122c35[_0x3069('0x39')][_0x3069('0x3d')]));_0x3587f9[_0x3069('0x3c')]=_0x3587f9[_0x3069('0x3c')][_0x3069('0x3e')]?_0x3587f9[_0x3069('0x3c')]:_0x25c421['model'];_0x3587f9['order']=qs[_0x3069('0x41')](_0x122c35[_0x3069('0x39')][_0x3069('0x41')]);_0x3587f9['where']=qs['filters'](_[_0x3069('0x54')](_0x122c35['query'],_0x25c421['filters']));if(_0x122c35[_0x3069('0x39')][_0x3069('0x46')]){_0x3587f9[_0x3069('0x42')]=_[_0x3069('0x44')](_0x3587f9[_0x3069('0x42')],{'$or':_[_0x3069('0x38')](_0x3587f9['attributes'],function(_0x5b797e){var _0x16ef2d={};_0x16ef2d[_0x5b797e]={'$like':'%'+_0x122c35['query']['filter']+'%'};return _0x16ef2d;})});}_0x3587f9=_[_0x3069('0x44')]({},_0x3587f9,_0x122c35[_0x3069('0x47')]);return _0x5f4a80[_0x3069('0x59')](_0x3587f9);}})['then'](function(_0x52858c){if(_0x52858c){_0x26c334=_0x52858c['length'];if(!_0x122c35[_0x3069('0x39')][_0x3069('0x3f')](_0x3069('0x57'))){_0x3587f9[_0x3069('0x28')]=qs[_0x3069('0x28')](_0x122c35[_0x3069('0x39')]['limit']);_0x3587f9['offset']=qs[_0x3069('0x27')](_0x122c35[_0x3069('0x39')]['offset']);}return _0x5f4a80[_0x3069('0x59')](_0x3587f9);}})['then'](function(_0x27acc1){if(_0x27acc1){return _0x27acc1?{'count':_0x26c334,'rows':_0x27acc1}:null;}})['then'](respondWithResult(_0x51ec54,null))[_0x3069('0x24')](handleError(_0x51ec54,null));}; \ No newline at end of file +var _0xbd1f=['nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','params','include','create','body','find','getFields','findOne','hasOwnProperty','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','ZohoConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length'];(function(_0x463a6e,_0x1b47b5){var _0x51d8c6=function(_0x21f507){while(--_0x21f507){_0x463a6e['push'](_0x463a6e['shift']());}};_0x51d8c6(++_0x1b47b5);}(_0xbd1f,0x1c9));var _0xfbd1=function(_0x283b55,_0x279bee){_0x283b55=_0x283b55-0x0;var _0x192e58=_0xbd1f[_0x283b55];return _0x192e58;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfbd1('0x0'));var rimraf=require(_0xfbd1('0x1'));var zipdir=require(_0xfbd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbd1('0x3'));var moment=require(_0xfbd1('0x4'));var BPromise=require(_0xfbd1('0x5'));var Mustache=require('mustache');var util=require(_0xfbd1('0x6'));var path=require('path');var sox=require(_0xfbd1('0x7'));var csv=require(_0xfbd1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbd1('0x9'));var squel=require('squel');var crypto=require(_0xfbd1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfbd1('0xb'));var Papa=require(_0xfbd1('0xc'));var Redis=require(_0xfbd1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfbd1('0xe'));var as=require(_0xfbd1('0xf'));var hardwareService=require(_0xfbd1('0x10'));var logger=require('../../config/logger')(_0xfbd1('0x11'));var utils=require(_0xfbd1('0x12'));var config=require(_0xfbd1('0x13'));var db=require(_0xfbd1('0x14'))['db'];var jayson=require(_0xfbd1('0x15'));var client=jayson[_0xfbd1('0x16')][_0xfbd1('0x17')]({'port':0x232a});function checkPasswordPattern(_0xc9f5df,_0xfb2a5c,_0x532782){if(_0x532782){var _0x29e872=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29e872[_0xfbd1('0x18')](_0xfb2a5c)){return _0xc9f5df;}else{throw new db[(_0xfbd1('0x19'))]['ValidationError'](_0xfbd1('0x1a'));}}else{return _0xc9f5df;}}function respondWithRpcPromise(_0xf8858a,_0x4bf40d,_0x25f86f,_0x4fb03b){return new BPromise(function(_0x5a92d8,_0x3b0060){var _0x5e27b1=_0x4fb03b||client;return _0x5e27b1[_0xfbd1('0x1b')](_0xf8858a,_0x25f86f)['then'](function(_0x101d0f){logger[_0xfbd1('0x1c')](_0xfbd1('0x1d'),_0x4bf40d,_0xfbd1('0x1e'));logger['debug'](_0xfbd1('0x1f'),_0x4bf40d,'request\x20sent',JSON['stringify'](_0x101d0f));if(_0x101d0f[_0xfbd1('0x20')]){if(_0x101d0f[_0xfbd1('0x20')][_0xfbd1('0x21')]===0x1f4){logger[_0xfbd1('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x4bf40d,_0x101d0f[_0xfbd1('0x20')][_0xfbd1('0x22')]);return _0x3b0060(_0x101d0f[_0xfbd1('0x20')][_0xfbd1('0x22')]);}logger['error'](_0xfbd1('0x1d'),_0x4bf40d,_0x101d0f[_0xfbd1('0x20')][_0xfbd1('0x22')]);return _0x5a92d8(_0x101d0f['error'][_0xfbd1('0x22')]);}else{logger[_0xfbd1('0x1c')](_0xfbd1('0x1d'),_0x4bf40d,_0xfbd1('0x1e'));_0x5a92d8(_0x101d0f['result']['message']);}})[_0xfbd1('0x23')](function(_0x2b09a2){logger[_0xfbd1('0x20')](_0xfbd1('0x1d'),_0x4bf40d,_0x2b09a2);_0x3b0060(_0x2b09a2);});});}function respondWithStatusCode(_0x38d655,_0x23492b){_0x23492b=_0x23492b||0xcc;return function(_0x3d3ab8){if(_0x3d3ab8){return _0x38d655['sendStatus'](_0x23492b);}return _0x38d655['status'](_0x23492b)[_0xfbd1('0x24')]();};}function respondWithResult(_0x558bc6,_0x2ee2fb){_0x2ee2fb=_0x2ee2fb||0xc8;return function(_0x4eda8f){if(_0x4eda8f){return _0x558bc6[_0xfbd1('0x25')](_0x2ee2fb)['json'](_0x4eda8f);}};}function respondWithFilteredResult(_0x45257e,_0x1d7f5a){return function(_0xa22ddd){if(_0xa22ddd){var _0x13d2a2=_0xa22ddd[_0xfbd1('0x26')],_0x5a206b=_0x1d7f5a['offset'],_0x3b47dc=_0x1d7f5a[_0xfbd1('0x27')]+_0x1d7f5a[_0xfbd1('0x28')],_0xdf9a90;if(_0x3b47dc>=_0x13d2a2){_0x3b47dc=_0x13d2a2;_0xdf9a90=0xc8;}else{_0xdf9a90=0xce;}_0x45257e[_0xfbd1('0x25')](_0xdf9a90);return _0x45257e[_0xfbd1('0x29')](_0xfbd1('0x2a'),_0x5a206b+'-'+_0x3b47dc+'/'+_0x13d2a2)[_0xfbd1('0x2b')](_0xa22ddd);}return null;};}function patchUpdates(_0x3038b3){return function(_0x53c6a9){try{jsonpatch[_0xfbd1('0x2c')](_0x53c6a9,_0x3038b3,!![]);}catch(_0x4da0b7){return BPromise[_0xfbd1('0x2d')](_0x4da0b7);}return _0x53c6a9['save']();};}function saveUpdates(_0x1dc627,_0x198343){return function(_0x142551){if(_0x142551){return _0x142551[_0xfbd1('0x2e')](_0x1dc627)[_0xfbd1('0x2f')](function(_0x1623e7){return _0x1623e7;});}return null;};}function removeEntity(_0x476e4b,_0x279caa){return function(_0x3a16d2){if(_0x3a16d2){return _0x3a16d2[_0xfbd1('0x30')]()[_0xfbd1('0x2f')](function(){_0x476e4b[_0xfbd1('0x25')](0xcc)[_0xfbd1('0x24')]();});}};}function handleEntityNotFound(_0x42dcc5,_0x31e1df){return function(_0x1d65f5){if(!_0x1d65f5){_0x42dcc5['sendStatus'](0x194);}return _0x1d65f5;};}function handleError(_0xcc8512,_0x274f26){_0x274f26=_0x274f26||0x1f4;return function(_0x1cb42f){logger[_0xfbd1('0x20')](_0x1cb42f[_0xfbd1('0x31')]);if(_0x1cb42f[_0xfbd1('0x32')]){delete _0x1cb42f[_0xfbd1('0x32')];}_0xcc8512[_0xfbd1('0x25')](_0x274f26)['send'](_0x1cb42f);};}exports['index']=function(_0x5d8318,_0x4a2f6a){var _0x15cf78={},_0x25c622={},_0x9f9526={'count':0x0,'rows':[]};var _0x1dabf2=_['map'](db[_0xfbd1('0x33')][_0xfbd1('0x34')],function(_0x4a50d1){return{'name':_0x4a50d1[_0xfbd1('0x35')],'type':_0x4a50d1[_0xfbd1('0x36')][_0xfbd1('0x37')]};});_0x25c622['model']=_[_0xfbd1('0x38')](_0x1dabf2,_0xfbd1('0x32'));_0x25c622[_0xfbd1('0x39')]=_[_0xfbd1('0x3a')](_0x5d8318[_0xfbd1('0x39')]);_0x25c622[_0xfbd1('0x3b')]=_['intersection'](_0x25c622[_0xfbd1('0x3c')],_0x25c622[_0xfbd1('0x39')]);_0x15cf78['attributes']=_[_0xfbd1('0x3d')](_0x25c622[_0xfbd1('0x3c')],qs[_0xfbd1('0x3e')](_0x5d8318[_0xfbd1('0x39')][_0xfbd1('0x3e')]));_0x15cf78[_0xfbd1('0x3f')]=_0x15cf78[_0xfbd1('0x3f')][_0xfbd1('0x40')]?_0x15cf78[_0xfbd1('0x3f')]:_0x25c622[_0xfbd1('0x3c')];if(!_0x5d8318['query']['hasOwnProperty'](_0xfbd1('0x41'))){_0x15cf78[_0xfbd1('0x28')]=qs['limit'](_0x5d8318[_0xfbd1('0x39')]['limit']);_0x15cf78['offset']=qs[_0xfbd1('0x27')](_0x5d8318['query'][_0xfbd1('0x27')]);}_0x15cf78[_0xfbd1('0x42')]=qs[_0xfbd1('0x43')](_0x5d8318[_0xfbd1('0x39')][_0xfbd1('0x43')]);_0x15cf78['where']=qs[_0xfbd1('0x3b')](_[_0xfbd1('0x44')](_0x5d8318[_0xfbd1('0x39')],_0x25c622['filters']),_0x1dabf2);if(_0x5d8318[_0xfbd1('0x39')][_0xfbd1('0x45')]){_0x15cf78[_0xfbd1('0x46')]=_[_0xfbd1('0x47')](_0x15cf78[_0xfbd1('0x46')],{'$or':_[_0xfbd1('0x38')](_0x1dabf2,function(_0x28f45a){if(_0x28f45a[_0xfbd1('0x36')]!=='VIRTUAL'){var _0x37452d={};_0x37452d[_0x28f45a[_0xfbd1('0x32')]]={'$like':'%'+_0x5d8318[_0xfbd1('0x39')]['filter']+'%'};return _0x37452d;}})});}_0x15cf78=_['merge']({},_0x15cf78,_0x5d8318[_0xfbd1('0x48')]);var _0x595d56={'where':_0x15cf78[_0xfbd1('0x46')]};return db['ZohoConfiguration'][_0xfbd1('0x26')](_0x595d56)['then'](function(_0x26ab27){_0x9f9526['count']=_0x26ab27;if(_0x5d8318[_0xfbd1('0x39')][_0xfbd1('0x49')]){_0x15cf78['include']=[{'all':!![]}];}return db[_0xfbd1('0x33')][_0xfbd1('0x4a')](_0x15cf78);})[_0xfbd1('0x2f')](function(_0x1ea7c7){_0x9f9526[_0xfbd1('0x4b')]=_0x1ea7c7;return _0x9f9526;})[_0xfbd1('0x2f')](respondWithFilteredResult(_0x4a2f6a,_0x15cf78))[_0xfbd1('0x23')](handleError(_0x4a2f6a,null));};exports['show']=function(_0x1d9659,_0x172776){var _0x5433e5={'raw':![],'where':{'id':_0x1d9659[_0xfbd1('0x4c')]['id']}},_0x17eff4={};_0x17eff4[_0xfbd1('0x3c')]=_[_0xfbd1('0x3a')](db['ZohoConfiguration']['rawAttributes']);_0x17eff4[_0xfbd1('0x39')]=_[_0xfbd1('0x3a')](_0x1d9659[_0xfbd1('0x39')]);_0x17eff4['filters']=_['intersection'](_0x17eff4[_0xfbd1('0x3c')],_0x17eff4[_0xfbd1('0x39')]);_0x5433e5[_0xfbd1('0x3f')]=_[_0xfbd1('0x3d')](_0x17eff4[_0xfbd1('0x3c')],qs[_0xfbd1('0x3e')](_0x1d9659[_0xfbd1('0x39')][_0xfbd1('0x3e')]));_0x5433e5[_0xfbd1('0x3f')]=_0x5433e5['attributes'][_0xfbd1('0x40')]?_0x5433e5[_0xfbd1('0x3f')]:_0x17eff4[_0xfbd1('0x3c')];if(_0x1d9659[_0xfbd1('0x39')][_0xfbd1('0x49')]){_0x5433e5[_0xfbd1('0x4d')]=[{'all':!![]}];}_0x5433e5=_[_0xfbd1('0x47')]({},_0x5433e5,_0x1d9659[_0xfbd1('0x48')]);return db[_0xfbd1('0x33')]['find'](_0x5433e5)[_0xfbd1('0x2f')](handleEntityNotFound(_0x172776,null))[_0xfbd1('0x2f')](respondWithResult(_0x172776,null))[_0xfbd1('0x23')](handleError(_0x172776,null));};exports[_0xfbd1('0x4e')]=function(_0x1d51a7,_0x31554d){return db['ZohoConfiguration'][_0xfbd1('0x4e')](_0x1d51a7['body'],{})[_0xfbd1('0x2f')](respondWithResult(_0x31554d,0xc9))[_0xfbd1('0x23')](handleError(_0x31554d,null));};exports['update']=function(_0x5c039f,_0x41ba22){if(_0x5c039f[_0xfbd1('0x4f')]['id']){delete _0x5c039f['body']['id'];}return db[_0xfbd1('0x33')][_0xfbd1('0x50')]({'where':{'id':_0x5c039f['params']['id']}})[_0xfbd1('0x2f')](handleEntityNotFound(_0x41ba22,null))[_0xfbd1('0x2f')](saveUpdates(_0x5c039f[_0xfbd1('0x4f')],null))[_0xfbd1('0x2f')](respondWithResult(_0x41ba22,null))[_0xfbd1('0x23')](handleError(_0x41ba22,null));};exports['destroy']=function(_0x805d3e,_0x113c91){return db[_0xfbd1('0x33')][_0xfbd1('0x50')]({'where':{'id':_0x805d3e[_0xfbd1('0x4c')]['id']}})[_0xfbd1('0x2f')](handleEntityNotFound(_0x113c91,null))[_0xfbd1('0x2f')](removeEntity(_0x113c91,null))[_0xfbd1('0x23')](handleError(_0x113c91,null));};exports[_0xfbd1('0x51')]=function(_0x55caa5,_0x1a6f78,_0x48246d){var _0x3dd21f={};var _0xcdcbcc={};var _0x3038cb;var _0x516fc4;return db['ZohoConfiguration'][_0xfbd1('0x52')]({'where':{'id':_0x55caa5[_0xfbd1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a6f78,null))['then'](function(_0x18a596){if(_0x18a596){_0x3038cb=_0x18a596;_0xcdcbcc[_0xfbd1('0x3c')]=_[_0xfbd1('0x3a')](db['ZohoField']['rawAttributes']);_0xcdcbcc['query']=_[_0xfbd1('0x3a')](_0x55caa5['query']);_0xcdcbcc[_0xfbd1('0x3b')]=_[_0xfbd1('0x3d')](_0xcdcbcc[_0xfbd1('0x3c')],_0xcdcbcc[_0xfbd1('0x39')]);_0x3dd21f['attributes']=_[_0xfbd1('0x3d')](_0xcdcbcc[_0xfbd1('0x3c')],qs[_0xfbd1('0x3e')](_0x55caa5[_0xfbd1('0x39')][_0xfbd1('0x3e')]));_0x3dd21f['attributes']=_0x3dd21f[_0xfbd1('0x3f')][_0xfbd1('0x40')]?_0x3dd21f[_0xfbd1('0x3f')]:_0xcdcbcc[_0xfbd1('0x3c')];_0x3dd21f[_0xfbd1('0x42')]=qs['sort'](_0x55caa5[_0xfbd1('0x39')][_0xfbd1('0x43')]);_0x3dd21f[_0xfbd1('0x46')]=qs[_0xfbd1('0x3b')](_['pick'](_0x55caa5[_0xfbd1('0x39')],_0xcdcbcc[_0xfbd1('0x3b')]));if(_0x55caa5['query'][_0xfbd1('0x45')]){_0x3dd21f[_0xfbd1('0x46')]=_[_0xfbd1('0x47')](_0x3dd21f[_0xfbd1('0x46')],{'$or':_['map'](_0x3dd21f['attributes'],function(_0x454066){var _0x91dd14={};_0x91dd14[_0x454066]={'$like':'%'+_0x55caa5[_0xfbd1('0x39')][_0xfbd1('0x45')]+'%'};return _0x91dd14;})});}_0x3dd21f=_[_0xfbd1('0x47')]({},_0x3dd21f,_0x55caa5[_0xfbd1('0x48')]);return _0x3038cb['getFields'](_0x3dd21f);}})[_0xfbd1('0x2f')](function(_0x2a2a50){if(_0x2a2a50){_0x516fc4=_0x2a2a50[_0xfbd1('0x40')];if(!_0x55caa5['query'][_0xfbd1('0x53')](_0xfbd1('0x41'))){_0x3dd21f[_0xfbd1('0x28')]=qs[_0xfbd1('0x28')](_0x55caa5[_0xfbd1('0x39')][_0xfbd1('0x28')]);_0x3dd21f[_0xfbd1('0x27')]=qs['offset'](_0x55caa5[_0xfbd1('0x39')][_0xfbd1('0x27')]);}return _0x3038cb[_0xfbd1('0x51')](_0x3dd21f);}})['then'](function(_0x25f603){if(_0x25f603){return _0x25f603?{'count':_0x516fc4,'rows':_0x25f603}:null;}})[_0xfbd1('0x2f')](respondWithResult(_0x1a6f78,null))[_0xfbd1('0x23')](handleError(_0x1a6f78,null));};exports['getSubjects']=function(_0x215a77,_0x231e40,_0x2688be){var _0x124d04={};var _0x399218={};var _0x2a544c;var _0x56fa03;return db['ZohoConfiguration'][_0xfbd1('0x52')]({'where':{'id':_0x215a77[_0xfbd1('0x4c')]['id']}})[_0xfbd1('0x2f')](handleEntityNotFound(_0x231e40,null))['then'](function(_0x4a891a){if(_0x4a891a){_0x2a544c=_0x4a891a;_0x399218[_0xfbd1('0x3c')]=_['keys'](db[_0xfbd1('0x54')][_0xfbd1('0x34')]);_0x399218['query']=_['keys'](_0x215a77[_0xfbd1('0x39')]);_0x399218[_0xfbd1('0x3b')]=_[_0xfbd1('0x3d')](_0x399218[_0xfbd1('0x3c')],_0x399218[_0xfbd1('0x39')]);_0x124d04['attributes']=_[_0xfbd1('0x3d')](_0x399218[_0xfbd1('0x3c')],qs[_0xfbd1('0x3e')](_0x215a77[_0xfbd1('0x39')][_0xfbd1('0x3e')]));_0x124d04['attributes']=_0x124d04[_0xfbd1('0x3f')][_0xfbd1('0x40')]?_0x124d04[_0xfbd1('0x3f')]:_0x399218[_0xfbd1('0x3c')];_0x124d04['order']=qs[_0xfbd1('0x43')](_0x215a77[_0xfbd1('0x39')]['sort']);_0x124d04[_0xfbd1('0x46')]=qs[_0xfbd1('0x3b')](_[_0xfbd1('0x44')](_0x215a77[_0xfbd1('0x39')],_0x399218[_0xfbd1('0x3b')]));if(_0x215a77['query'][_0xfbd1('0x45')]){_0x124d04[_0xfbd1('0x46')]=_[_0xfbd1('0x47')](_0x124d04['where'],{'$or':_['map'](_0x124d04[_0xfbd1('0x3f')],function(_0xa6b848){var _0x430fc8={};_0x430fc8[_0xa6b848]={'$like':'%'+_0x215a77[_0xfbd1('0x39')][_0xfbd1('0x45')]+'%'};return _0x430fc8;})});}_0x124d04=_[_0xfbd1('0x47')]({},_0x124d04,_0x215a77[_0xfbd1('0x48')]);return _0x2a544c[_0xfbd1('0x55')](_0x124d04);}})[_0xfbd1('0x2f')](function(_0x5c0274){if(_0x5c0274){_0x56fa03=_0x5c0274[_0xfbd1('0x40')];if(!_0x215a77[_0xfbd1('0x39')]['hasOwnProperty'](_0xfbd1('0x41'))){_0x124d04[_0xfbd1('0x28')]=qs['limit'](_0x215a77[_0xfbd1('0x39')][_0xfbd1('0x28')]);_0x124d04[_0xfbd1('0x27')]=qs[_0xfbd1('0x27')](_0x215a77[_0xfbd1('0x39')]['offset']);}return _0x2a544c[_0xfbd1('0x55')](_0x124d04);}})[_0xfbd1('0x2f')](function(_0x1e06c2){if(_0x1e06c2){return _0x1e06c2?{'count':_0x56fa03,'rows':_0x1e06c2}:null;}})['then'](respondWithResult(_0x231e40,null))['catch'](handleError(_0x231e40,null));};exports[_0xfbd1('0x56')]=function(_0x142052,_0x289727,_0x55ab67){var _0x54898b={};var _0x17b4b0={};var _0x4f0daa;var _0xd4cb84;return db[_0xfbd1('0x33')][_0xfbd1('0x52')]({'where':{'id':_0x142052[_0xfbd1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x289727,null))['then'](function(_0x5d3730){if(_0x5d3730){_0x4f0daa=_0x5d3730;_0x17b4b0[_0xfbd1('0x3c')]=_['keys'](db['ZohoField']['rawAttributes']);_0x17b4b0[_0xfbd1('0x39')]=_['keys'](_0x142052[_0xfbd1('0x39')]);_0x17b4b0[_0xfbd1('0x3b')]=_[_0xfbd1('0x3d')](_0x17b4b0[_0xfbd1('0x3c')],_0x17b4b0[_0xfbd1('0x39')]);_0x54898b[_0xfbd1('0x3f')]=_[_0xfbd1('0x3d')](_0x17b4b0[_0xfbd1('0x3c')],qs[_0xfbd1('0x3e')](_0x142052['query']['fields']));_0x54898b['attributes']=_0x54898b['attributes'][_0xfbd1('0x40')]?_0x54898b[_0xfbd1('0x3f')]:_0x17b4b0[_0xfbd1('0x3c')];_0x54898b[_0xfbd1('0x42')]=qs[_0xfbd1('0x43')](_0x142052['query']['sort']);_0x54898b[_0xfbd1('0x46')]=qs['filters'](_[_0xfbd1('0x44')](_0x142052['query'],_0x17b4b0[_0xfbd1('0x3b')]));if(_0x142052['query'][_0xfbd1('0x45')]){_0x54898b[_0xfbd1('0x46')]=_[_0xfbd1('0x47')](_0x54898b[_0xfbd1('0x46')],{'$or':_[_0xfbd1('0x38')](_0x54898b[_0xfbd1('0x3f')],function(_0x4fedf5){var _0x3368e5={};_0x3368e5[_0x4fedf5]={'$like':'%'+_0x142052[_0xfbd1('0x39')][_0xfbd1('0x45')]+'%'};return _0x3368e5;})});}_0x54898b=_['merge']({},_0x54898b,_0x142052[_0xfbd1('0x48')]);return _0x4f0daa['getDescriptions'](_0x54898b);}})[_0xfbd1('0x2f')](function(_0x5bbd80){if(_0x5bbd80){_0xd4cb84=_0x5bbd80['length'];if(!_0x142052[_0xfbd1('0x39')][_0xfbd1('0x53')](_0xfbd1('0x41'))){_0x54898b[_0xfbd1('0x28')]=qs[_0xfbd1('0x28')](_0x142052[_0xfbd1('0x39')][_0xfbd1('0x28')]);_0x54898b[_0xfbd1('0x27')]=qs['offset'](_0x142052[_0xfbd1('0x39')][_0xfbd1('0x27')]);}return _0x4f0daa[_0xfbd1('0x56')](_0x54898b);}})['then'](function(_0xe1aa05){if(_0xe1aa05){return _0xe1aa05?{'count':_0xd4cb84,'rows':_0xe1aa05}:null;}})[_0xfbd1('0x2f')](respondWithResult(_0x289727,null))[_0xfbd1('0x23')](handleError(_0x289727,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 96fcc35..f527a05 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 _0xc2d7=['define','ZohoConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x420a11,_0xe6a72b){var _0x2da685=function(_0xc136ae){while(--_0xc136ae){_0x420a11['push'](_0x420a11['shift']());}};_0x2da685(++_0xe6a72b);}(_0xc2d7,0x9e));var _0x7c2d=function(_0x11f110,_0x30e39c){_0x11f110=_0x11f110-0x0;var _0x4b95fd=_0xc2d7[_0x11f110];return _0x4b95fd;};'use strict';var _=require(_0x7c2d('0x0'));var util=require('util');var logger=require(_0x7c2d('0x1'))(_0x7c2d('0x2'));var moment=require(_0x7c2d('0x3'));var BPromise=require(_0x7c2d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c2d('0x5'));var rimraf=require(_0x7c2d('0x6'));var config=require(_0x7c2d('0x7'));var attributes=require(_0x7c2d('0x8'));module[_0x7c2d('0x9')]=function(_0x5a5fca,_0x524e3d){return _0x5a5fca[_0x7c2d('0xa')](_0x7c2d('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa355=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x59b6a1,_0x2189fe){var _0x5964a9=function(_0x41c4e3){while(--_0x41c4e3){_0x59b6a1['push'](_0x59b6a1['shift']());}};_0x5964a9(++_0x2189fe);}(_0xa355,0x19d));var _0x5a35=function(_0x4f6f69,_0x3e672e){_0x4f6f69=_0x4f6f69-0x0;var _0x41891f=_0xa355[_0x4f6f69];return _0x41891f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a35('0x0'))(_0x5a35('0x1'));var moment=require(_0x5a35('0x2'));var BPromise=require(_0x5a35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a35('0x4'));var rimraf=require(_0x5a35('0x5'));var config=require(_0x5a35('0x6'));var attributes=require(_0x5a35('0x7'));module[_0x5a35('0x8')]=function(_0x105340,_0x4df252){return _0x105340[_0x5a35('0x9')](_0x5a35('0xa'),attributes,{'tableName':_0x5a35('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 e3d0c1d..b362432 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 _0x529d=['stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x523baa,_0x3fab0f){var _0x288f43=function(_0x3889e8){while(--_0x3889e8){_0x523baa['push'](_0x523baa['shift']());}};_0x288f43(++_0x3fab0f);}(_0x529d,0xfd));var _0xd529=function(_0x1bcf49,_0x41a42c){_0x1bcf49=_0x1bcf49-0x0;var _0x364505=_0x529d[_0x1bcf49];return _0x364505;};'use strict';var _=require(_0xd529('0x0'));var util=require(_0xd529('0x1'));var moment=require('moment');var BPromise=require(_0xd529('0x2'));var rs=require(_0xd529('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd529('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd529('0x5'))(_0xd529('0x6'));var config=require('../../config/environment');var jayson=require(_0xd529('0x7'));var client=jayson[_0xd529('0x8')][_0xd529('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f59d8,_0x1e8f52,_0x451a18){return new BPromise(function(_0x57bbff,_0x5a9c11){return client['request'](_0x2f59d8,_0x451a18)[_0xd529('0xa')](function(_0x4a2495){logger[_0xd529('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x1e8f52,'request\x20sent');logger['debug'](_0xd529('0xc'),_0x1e8f52,'request\x20sent',JSON[_0xd529('0xd')](_0x4a2495));if(_0x4a2495['error']){if(_0x4a2495[_0xd529('0xe')]['code']===0x1f4){logger[_0xd529('0xe')](_0xd529('0xf'),_0x1e8f52,_0x4a2495[_0xd529('0xe')]['message']);return _0x5a9c11(_0x4a2495[_0xd529('0xe')][_0xd529('0x10')]);}logger['error'](_0xd529('0xf'),_0x1e8f52,_0x4a2495[_0xd529('0xe')][_0xd529('0x10')]);return _0x57bbff(_0x4a2495[_0xd529('0xe')]['message']);}else{logger[_0xd529('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x1e8f52,_0xd529('0x11'));_0x57bbff(_0x4a2495[_0xd529('0x12')][_0xd529('0x10')]);}})['catch'](function(_0x2ececd){logger[_0xd529('0xe')](_0xd529('0xf'),_0x1e8f52,_0x2ececd);_0x5a9c11(_0x2ececd);});});} \ No newline at end of file +var _0x8a74=['http','request','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x8a74,0x1ad));var _0x48a7=function(_0x45a28f,_0x5db840){_0x45a28f=_0x45a28f-0x0;var _0x1fde36=_0x8a74[_0x45a28f];return _0x1fde36;};'use strict';var _=require(_0x48a7('0x0'));var util=require(_0x48a7('0x1'));var moment=require(_0x48a7('0x2'));var BPromise=require(_0x48a7('0x3'));var rs=require(_0x48a7('0x4'));var fs=require('fs');var Redis=require(_0x48a7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48a7('0x6'))(_0x48a7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x48a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x189371,_0x4ab360,_0xee3441){return new BPromise(function(_0x21f933,_0x34c68a){return client[_0x48a7('0x9')](_0x189371,_0xee3441)[_0x48a7('0xa')](function(_0x3af27e){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x4ab360,_0x48a7('0xb'));logger[_0x48a7('0xc')](_0x48a7('0xd'),_0x4ab360,_0x48a7('0xb'),JSON['stringify'](_0x3af27e));if(_0x3af27e[_0x48a7('0xe')]){if(_0x3af27e[_0x48a7('0xe')][_0x48a7('0xf')]===0x1f4){logger[_0x48a7('0xe')](_0x48a7('0x10'),_0x4ab360,_0x3af27e[_0x48a7('0xe')][_0x48a7('0x11')]);return _0x34c68a(_0x3af27e[_0x48a7('0xe')]['message']);}logger[_0x48a7('0xe')](_0x48a7('0x10'),_0x4ab360,_0x3af27e[_0x48a7('0xe')][_0x48a7('0x11')]);return _0x21f933(_0x3af27e['error']['message']);}else{logger[_0x48a7('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4ab360,_0x48a7('0xb'));_0x21f933(_0x3af27e['result'][_0x48a7('0x11')]);}})['catch'](function(_0x187a8e){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x4ab360,_0x187a8e);_0x34c68a(_0x187a8e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 42c6179..fe56764 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 _0x32b6=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','destroy'];(function(_0x17560b,_0x223f54){var _0x4b5e9b=function(_0x1373a4){while(--_0x1373a4){_0x17560b['push'](_0x17560b['shift']());}};_0x4b5e9b(++_0x223f54);}(_0x32b6,0x1d1));var _0x632b=function(_0x263c07,_0x48546c){_0x263c07=_0x263c07-0x0;var _0x5891b0=_0x32b6[_0x263c07];return _0x5891b0;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x632b('0x4'));var config=require(_0x632b('0x5'));var controller=require(_0x632b('0x6'));router[_0x632b('0x7')]('/',auth[_0x632b('0x8')](),controller[_0x632b('0x9')]);router[_0x632b('0x7')](_0x632b('0xa'),auth[_0x632b('0x8')](),controller[_0x632b('0xb')]);router['post']('/',auth[_0x632b('0x8')](),controller[_0x632b('0xc')]);router[_0x632b('0xd')](_0x632b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x632b('0xa'),auth['isAuthenticated'](),controller[_0x632b('0xe')]);module[_0x632b('0xf')]=router; \ No newline at end of file +var _0x5464=['express','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','multer','util','path'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x5464,0x15d));var _0x4546=function(_0x1643f4,_0xc7dac3){_0x1643f4=_0x1643f4-0x0;var _0x230356=_0x5464[_0x1643f4];return _0x230356;};'use strict';var multer=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var path=require(_0x4546('0x2'));var timeout=require('connect-timeout');var express=require(_0x4546('0x3'));var router=express['Router']();var auth=require(_0x4546('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4546('0x5'));var controller=require(_0x4546('0x6'));router[_0x4546('0x7')]('/',auth[_0x4546('0x8')](),controller['index']);router['get']('/:id',auth[_0x4546('0x8')](),controller[_0x4546('0x9')]);router[_0x4546('0xa')]('/',auth[_0x4546('0x8')](),controller[_0x4546('0xb')]);router[_0x4546('0xc')](_0x4546('0xd'),auth[_0x4546('0x8')](),controller[_0x4546('0xe')]);router['delete'](_0x4546('0xd'),auth[_0x4546('0x8')](),controller[_0x4546('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 0db49a4..7571c3c 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 _0x9d3e=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x5561c8,_0xa85337){var _0x579f85=function(_0x51383c){while(--_0x51383c){_0x5561c8['push'](_0x5561c8['shift']());}};_0x579f85(++_0xa85337);}(_0x9d3e,0xd5));var _0xe9d3=function(_0x44aa52,_0x4bc38d){_0x44aa52=_0x44aa52-0x0;var _0x43e51d=_0x9d3e[_0x44aa52];return _0x43e51d;};'use strict';var Sequelize=require(_0xe9d3('0x0'));module['exports']={'type':{'type':Sequelize[_0xe9d3('0x1')]('string',_0xe9d3('0x2'),_0xe9d3('0x3'),_0xe9d3('0x4')),'defaultValue':_0xe9d3('0x5')},'content':{'type':Sequelize[_0xe9d3('0x6')]},'key':{'type':Sequelize[_0xe9d3('0x6')]},'keyType':{'type':Sequelize[_0xe9d3('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xe9d3('0x6')]},'idField':{'type':Sequelize[_0xe9d3('0x6')]},'nameField':{'type':Sequelize[_0xe9d3('0x6')]},'customField':{'type':Sequelize[_0xe9d3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9d3('0x6')]}}; \ No newline at end of file +var _0x44e8=['variable','customVariable','keyValue','STRING','ENUM','sequelize','string'];(function(_0x33e177,_0x1b352e){var _0x570b42=function(_0x3723d0){while(--_0x3723d0){_0x33e177['push'](_0x33e177['shift']());}};_0x570b42(++_0x1b352e);}(_0x44e8,0xd7));var _0x844e=function(_0x5c8020,_0x29e80f){_0x5c8020=_0x5c8020-0x0;var _0x294d4e=_0x44e8[_0x5c8020];return _0x294d4e;};'use strict';var Sequelize=require(_0x844e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x844e('0x1'),_0x844e('0x2'),_0x844e('0x3'),_0x844e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x844e('0x5')]},'key':{'type':Sequelize[_0x844e('0x5')]},'keyType':{'type':Sequelize[_0x844e('0x6')](_0x844e('0x1'),'variable',_0x844e('0x3'))},'keyContent':{'type':Sequelize[_0x844e('0x5')]},'idField':{'type':Sequelize[_0x844e('0x5')]},'nameField':{'type':Sequelize[_0x844e('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x844e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 67c8020..12e9a29 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(_0xe0ba74,_0x5dcbac){var _0x5efbef=function(_0x607401){while(--_0x607401){_0xe0ba74['push'](_0xe0ba74['shift']());}};_0x5efbef(++_0x5dcbac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var 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(_0x510313,_0xd493e1){var _0xd9ad55=function(_0x134499){while(--_0x134499){_0x510313['push'](_0x510313['shift']());}};_0xd9ad55(++_0xd493e1);}(_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('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 b92de16..8e8af65 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 _0x0d5f=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','api'];(function(_0x1ba426,_0xfc02ea){var _0x329bcc=function(_0x4b0f7d){while(--_0x4b0f7d){_0x1ba426['push'](_0x1ba426['shift']());}};_0x329bcc(++_0xfc02ea);}(_0x0d5f,0x138));var _0xf0d5=function(_0x3510c5,_0x5517ee){_0x3510c5=_0x3510c5-0x0;var _0x373f21=_0x0d5f[_0x3510c5];return _0x373f21;};'use strict';var _=require(_0xf0d5('0x0'));var util=require(_0xf0d5('0x1'));var logger=require('../../config/logger')(_0xf0d5('0x2'));var moment=require(_0xf0d5('0x3'));var BPromise=require(_0xf0d5('0x4'));var rp=require(_0xf0d5('0x5'));var fs=require('fs');var path=require(_0xf0d5('0x6'));var rimraf=require('rimraf');var config=require(_0xf0d5('0x7'));var attributes=require(_0xf0d5('0x8'));module[_0xf0d5('0x9')]=function(_0x1e1ac,_0x44deef){return _0x1e1ac[_0xf0d5('0xa')](_0xf0d5('0xb'),attributes,{'tableName':_0xf0d5('0xc'),'paranoid':![],'indexes':[{'name':_0xf0d5('0xd'),'fields':['idField',_0xf0d5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7da6=['path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','../../config/logger','moment','bluebird'];(function(_0x20fc70,_0x48338a){var _0x413347=function(_0x39db1f){while(--_0x39db1f){_0x20fc70['push'](_0x20fc70['shift']());}};_0x413347(++_0x48338a);}(_0x7da6,0x127));var _0x67da=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x7da6[_0x51b661];return _0x5d1971;};'use strict';var _=require(_0x67da('0x0'));var util=require('util');var logger=require(_0x67da('0x1'))('api');var moment=require(_0x67da('0x2'));var BPromise=require(_0x67da('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67da('0x4'));var rimraf=require(_0x67da('0x5'));var config=require('../../config/environment');var attributes=require(_0x67da('0x6'));module[_0x67da('0x7')]=function(_0x2d9b26,_0x22f098){return _0x2d9b26[_0x67da('0x8')](_0x67da('0x9'),attributes,{'tableName':_0x67da('0xa'),'paranoid':![],'indexes':[{'name':_0x67da('0xb'),'fields':['idField',_0x67da('0xc')],'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 d5848b3..26f9cc3 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('ZohoField,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0xbd50=['ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd50,0x196));var _0x0bd5=function(_0x5de62a,_0x598b61){_0x5de62a=_0x5de62a-0x0;var _0x170063=_0xbd50[_0x5de62a];return _0x170063;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c74333a..1f78a08 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 _0x89c9=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0x1fcd54,_0x52ed54){var _0x5e5fb2=function(_0x3ebe23){while(--_0x3ebe23){_0x1fcd54['push'](_0x1fcd54['shift']());}};_0x5e5fb2(++_0x52ed54);}(_0x89c9,0x1de));var _0x989c=function(_0x49bdc4,_0x1e2507){_0x49bdc4=_0x49bdc4-0x0;var _0x1f7437=_0x89c9[_0x49bdc4];return _0x1f7437;};'use strict';var multer=require(_0x989c('0x0'));var util=require('util');var path=require(_0x989c('0x1'));var timeout=require(_0x989c('0x2'));var express=require(_0x989c('0x3'));var router=express['Router']();var auth=require(_0x989c('0x4'));var interaction=require(_0x989c('0x5'));var config=require(_0x989c('0x6'));module[_0x989c('0x7')]=router; \ No newline at end of file +var _0x9c3e=['util','path','connect-timeout','../../components/auth/service','../../config/environment','exports','multer'];(function(_0xbfbef0,_0x218b21){var _0x3fdf6f=function(_0x468471){while(--_0x468471){_0xbfbef0['push'](_0xbfbef0['shift']());}};_0x3fdf6f(++_0x218b21);}(_0x9c3e,0x1d4));var _0xe9c3=function(_0x167a95,_0x30fca5){_0x167a95=_0x167a95-0x0;var _0x1a2a1b=_0x9c3e[_0x167a95];return _0x1a2a1b;};'use strict';var multer=require(_0xe9c3('0x0'));var util=require(_0xe9c3('0x1'));var path=require(_0xe9c3('0x2'));var timeout=require(_0xe9c3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe9c3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe9c3('0x5'));module[_0xe9c3('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 7fada5d..3fa0ba5 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 _0xef5b=['STRING','unique_name_and_version','INTEGER','state','sequelize','exports'];(function(_0x30dfa4,_0x1a6275){var _0x185b37=function(_0x1a8025){while(--_0x1a8025){_0x30dfa4['push'](_0x30dfa4['shift']());}};_0x185b37(++_0x1a6275);}(_0xef5b,0x154));var _0xbef5=function(_0x34bf68,_0x23be3e){_0x34bf68=_0x34bf68-0x0;var _0x8ae855=_0xef5b[_0x34bf68];return _0x8ae855;};'use strict';var Sequelize=require(_0xbef5('0x0'));module[_0xbef5('0x1')]={'name':{'type':Sequelize[_0xbef5('0x2')],'allowNull':![],'unique':_0xbef5('0x3')},'version':{'type':Sequelize[_0xbef5('0x2')],'allowNull':![],'unique':_0xbef5('0x3')},'main':{'type':Sequelize[_0xbef5('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xbef5('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbef5('0x2')]},'size':{'type':Sequelize[_0xbef5('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xbef5('0x2')]},'logo':{'type':Sequelize[_0xbef5('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xbef5('0x5')},'description':{'type':Sequelize[_0xbef5('0x2')]},'title':{'type':Sequelize[_0xbef5('0x2')]},'remoteUri':{'type':Sequelize[_0xbef5('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xe2e4=['app.js','INTEGER','state','sequelize','STRING','unique_name_and_version'];(function(_0x16443d,_0x2b719f){var _0x475f89=function(_0x29bcbe){while(--_0x29bcbe){_0x16443d['push'](_0x16443d['shift']());}};_0x475f89(++_0x2b719f);}(_0xe2e4,0x1d7));var _0x4e2e=function(_0x3fd0b6,_0x216f79){_0x3fd0b6=_0x3fd0b6-0x0;var _0x445dcd=_0xe2e4[_0x3fd0b6];return _0x445dcd;};'use strict';var Sequelize=require(_0x4e2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e2e('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x4e2e('0x1')],'allowNull':![],'unique':_0x4e2e('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x4e2e('0x3')},'filename':{'type':Sequelize[_0x4e2e('0x1')]},'path':{'type':Sequelize[_0x4e2e('0x1')]},'type':{'type':Sequelize[_0x4e2e('0x1')]},'size':{'type':Sequelize[_0x4e2e('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x4e2e('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x4e2e('0x1')],'unique':_0x4e2e('0x5')},'description':{'type':Sequelize[_0x4e2e('0x1')]},'title':{'type':Sequelize[_0x4e2e('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x4e2e('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 3040cb5..0d02266 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 _0xb692=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','Integration','includeAll','findAll','catch','show','params','include','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0xf08c14,_0x3fffc1){var _0x5cfc14=function(_0x214ec9){while(--_0x214ec9){_0xf08c14['push'](_0xf08c14['shift']());}};_0x5cfc14(++_0x3fffc1);}(_0xb692,0x1ea));var _0x2b69=function(_0x20e5e2,_0x57c3b1){_0x20e5e2=_0x20e5e2-0x0;var _0x803951=_0xb692[_0x20e5e2];return _0x803951;};'use strict';var pdf=require(_0x2b69('0x0'));var emlformat=require(_0x2b69('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2b69('0x2'));var jsonpatch=require(_0x2b69('0x3'));var rp=require(_0x2b69('0x4'));var moment=require('moment');var BPromise=require(_0x2b69('0x5'));var Mustache=require(_0x2b69('0x6'));var util=require(_0x2b69('0x7'));var path=require(_0x2b69('0x8'));var sox=require(_0x2b69('0x9'));var csv=require(_0x2b69('0xa'));var ejs=require(_0x2b69('0xb'));var fs=require('fs');var _=require(_0x2b69('0xc'));var squel=require('squel');var crypto=require(_0x2b69('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2b69('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b69('0xf'));var Papa=require(_0x2b69('0x10'));var Redis=require('ioredis');var authService=require(_0x2b69('0x11'));var qs=require(_0x2b69('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b69('0x13'));var logger=require(_0x2b69('0x14'))('api');var utils=require(_0x2b69('0x15'));var config=require(_0x2b69('0x16'));var db=require(_0x2b69('0x17'))['db'];function respondWithStatusCode(_0x1548eb,_0x35aebe){_0x35aebe=_0x35aebe||0xcc;return function(_0x237fb6){if(_0x237fb6){return _0x1548eb[_0x2b69('0x18')](_0x35aebe);}return _0x1548eb[_0x2b69('0x19')](_0x35aebe)[_0x2b69('0x1a')]();};}function respondWithResult(_0x216ca8,_0x2c3b67){_0x2c3b67=_0x2c3b67||0xc8;return function(_0x311655){if(_0x311655){return _0x216ca8['status'](_0x2c3b67)[_0x2b69('0x1b')](_0x311655);}};}function respondWithFilteredResult(_0x20512b,_0x17be53){return function(_0xfb4c56){if(_0xfb4c56){var _0x336ebf=_0xfb4c56[_0x2b69('0x1c')],_0x15bbfb=_0x17be53[_0x2b69('0x1d')],_0x2f807a=_0x17be53['offset']+_0x17be53['limit'],_0x24413c;if(_0x2f807a>=_0x336ebf){_0x2f807a=_0x336ebf;_0x24413c=0xc8;}else{_0x24413c=0xce;}_0x20512b[_0x2b69('0x19')](_0x24413c);return _0x20512b[_0x2b69('0x1e')]('Content-Range',_0x15bbfb+'-'+_0x2f807a+'/'+_0x336ebf)[_0x2b69('0x1b')](_0xfb4c56);}return null;};}function patchUpdates(_0x2951da){return function(_0x206d2f){try{jsonpatch[_0x2b69('0x1f')](_0x206d2f,_0x2951da,!![]);}catch(_0x3f02a1){return BPromise[_0x2b69('0x20')](_0x3f02a1);}return _0x206d2f['save']();};}function saveUpdates(_0x340893,_0x57ea08){return function(_0x2e8293){if(_0x2e8293){return _0x2e8293[_0x2b69('0x21')](_0x340893)[_0x2b69('0x22')](function(_0x14c859){return _0x14c859;});}return null;};}function removeEntity(_0x3542f6,_0x56b1f9){return function(_0x4aa819){if(_0x4aa819){return _0x4aa819[_0x2b69('0x23')]()[_0x2b69('0x22')](function(){_0x3542f6[_0x2b69('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160e26,_0x322b0d){return function(_0x438c90){if(!_0x438c90){_0x160e26['sendStatus'](0x194);}return _0x438c90;};}function handleError(_0xdaaa66,_0x350dc3){_0x350dc3=_0x350dc3||0x1f4;return function(_0x37f209){logger['error'](_0x37f209[_0x2b69('0x24')]);if(_0x37f209[_0x2b69('0x25')]){delete _0x37f209[_0x2b69('0x25')];}_0xdaaa66[_0x2b69('0x19')](_0x350dc3)[_0x2b69('0x26')](_0x37f209);};}exports[_0x2b69('0x27')]=function(_0x495269,_0x510cb2){var _0x4b5734={},_0x1e93eb={},_0x48cdb8={'count':0x0,'rows':[]};var _0x808126=_[_0x2b69('0x28')](db['Integration'][_0x2b69('0x29')],function(_0x283b52){return{'name':_0x283b52[_0x2b69('0x2a')],'type':_0x283b52[_0x2b69('0x2b')][_0x2b69('0x2c')]};});_0x1e93eb[_0x2b69('0x2d')]=_['map'](_0x808126,_0x2b69('0x25'));_0x1e93eb[_0x2b69('0x2e')]=_[_0x2b69('0x2f')](_0x495269[_0x2b69('0x2e')]);_0x1e93eb[_0x2b69('0x30')]=_['intersection'](_0x1e93eb[_0x2b69('0x2d')],_0x1e93eb[_0x2b69('0x2e')]);_0x4b5734[_0x2b69('0x31')]=_[_0x2b69('0x32')](_0x1e93eb[_0x2b69('0x2d')],qs[_0x2b69('0x33')](_0x495269[_0x2b69('0x2e')][_0x2b69('0x33')]));_0x4b5734['attributes']=_0x4b5734[_0x2b69('0x31')][_0x2b69('0x34')]?_0x4b5734[_0x2b69('0x31')]:_0x1e93eb['model'];if(!_0x495269[_0x2b69('0x2e')][_0x2b69('0x35')](_0x2b69('0x36'))){_0x4b5734['limit']=qs[_0x2b69('0x37')](_0x495269[_0x2b69('0x2e')][_0x2b69('0x37')]);_0x4b5734[_0x2b69('0x1d')]=qs[_0x2b69('0x1d')](_0x495269[_0x2b69('0x2e')][_0x2b69('0x1d')]);}_0x4b5734['order']=qs[_0x2b69('0x38')](_0x495269[_0x2b69('0x2e')]['sort']);_0x4b5734['where']=qs[_0x2b69('0x30')](_[_0x2b69('0x39')](_0x495269['query'],_0x1e93eb[_0x2b69('0x30')]),_0x808126);if(_0x495269[_0x2b69('0x2e')]['filter']){_0x4b5734[_0x2b69('0x3a')]=_[_0x2b69('0x3b')](_0x4b5734[_0x2b69('0x3a')],{'$or':_[_0x2b69('0x28')](_0x808126,function(_0x2c98a2){if(_0x2c98a2[_0x2b69('0x2b')]!==_0x2b69('0x3c')){var _0x4e97ef={};_0x4e97ef[_0x2c98a2[_0x2b69('0x25')]]={'$like':'%'+_0x495269[_0x2b69('0x2e')][_0x2b69('0x3d')]+'%'};return _0x4e97ef;}})});}_0x4b5734=_[_0x2b69('0x3b')]({},_0x4b5734,_0x495269[_0x2b69('0x3e')]);var _0x825c05={'where':_0x4b5734[_0x2b69('0x3a')]};return db[_0x2b69('0x3f')][_0x2b69('0x1c')](_0x825c05)[_0x2b69('0x22')](function(_0x585027){_0x48cdb8[_0x2b69('0x1c')]=_0x585027;if(_0x495269[_0x2b69('0x2e')][_0x2b69('0x40')]){_0x4b5734['include']=[{'all':!![]}];}return db['Integration'][_0x2b69('0x41')](_0x4b5734);})['then'](function(_0x3fa996){_0x48cdb8['rows']=_0x3fa996;return _0x48cdb8;})[_0x2b69('0x22')](respondWithFilteredResult(_0x510cb2,_0x4b5734))[_0x2b69('0x42')](handleError(_0x510cb2,null));};exports[_0x2b69('0x43')]=function(_0x10f23a,_0x55f0cb){var _0x46c543={'raw':![],'where':{'id':_0x10f23a[_0x2b69('0x44')]['id']}},_0x203393={};_0x203393[_0x2b69('0x2d')]=_[_0x2b69('0x2f')](db[_0x2b69('0x3f')][_0x2b69('0x29')]);_0x203393['query']=_[_0x2b69('0x2f')](_0x10f23a['query']);_0x203393[_0x2b69('0x30')]=_['intersection'](_0x203393['model'],_0x203393[_0x2b69('0x2e')]);_0x46c543[_0x2b69('0x31')]=_[_0x2b69('0x32')](_0x203393[_0x2b69('0x2d')],qs['fields'](_0x10f23a['query']['fields']));_0x46c543[_0x2b69('0x31')]=_0x46c543['attributes']['length']?_0x46c543[_0x2b69('0x31')]:_0x203393[_0x2b69('0x2d')];if(_0x10f23a['query'][_0x2b69('0x40')]){_0x46c543[_0x2b69('0x45')]=[{'all':!![]}];}_0x46c543=_[_0x2b69('0x3b')]({},_0x46c543,_0x10f23a['options']);return db[_0x2b69('0x3f')]['find'](_0x46c543)[_0x2b69('0x22')](handleEntityNotFound(_0x55f0cb,null))['then'](respondWithResult(_0x55f0cb,null))['catch'](handleError(_0x55f0cb,null));};exports[_0x2b69('0x46')]=function(_0x494413,_0x4cbcab){return db[_0x2b69('0x3f')][_0x2b69('0x46')](_0x494413['body'],{})[_0x2b69('0x22')](respondWithResult(_0x4cbcab,0xc9))[_0x2b69('0x42')](handleError(_0x4cbcab,null));};exports['update']=function(_0x5e31cf,_0x461465){if(_0x5e31cf[_0x2b69('0x47')]['id']){delete _0x5e31cf[_0x2b69('0x47')]['id'];}return db['Integration'][_0x2b69('0x48')]({'where':{'id':_0x5e31cf[_0x2b69('0x44')]['id']}})[_0x2b69('0x22')](handleEntityNotFound(_0x461465,null))['then'](saveUpdates(_0x5e31cf[_0x2b69('0x47')],null))['then'](respondWithResult(_0x461465,null))['catch'](handleError(_0x461465,null));};exports[_0x2b69('0x23')]=function(_0x2c46fa,_0x33efb3){return db[_0x2b69('0x3f')]['find']({'where':{'id':_0x2c46fa[_0x2b69('0x44')]['id']}})[_0x2b69('0x22')](handleEntityNotFound(_0x33efb3,null))[_0x2b69('0x22')](removeEntity(_0x33efb3,null))[_0x2b69('0x42')](handleError(_0x33efb3,null));}; \ No newline at end of file +var _0x410c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','Integration','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x410c,0x199));var _0xc410=function(_0x35d052,_0x41169d){_0x35d052=_0x35d052-0x0;var _0x9d7788=_0x410c[_0x35d052];return _0x9d7788;};'use strict';var pdf=require(_0xc410('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc410('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc410('0x2'));var rp=require('request-promise');var moment=require(_0xc410('0x3'));var BPromise=require(_0xc410('0x4'));var Mustache=require(_0xc410('0x5'));var util=require(_0xc410('0x6'));var path=require(_0xc410('0x7'));var sox=require('sox');var csv=require(_0xc410('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc410('0x9'));var squel=require(_0xc410('0xa'));var crypto=require(_0xc410('0xb'));var jsforce=require(_0xc410('0xc'));var deskjs=require(_0xc410('0xd'));var toCsv=require(_0xc410('0x8'));var querystring=require(_0xc410('0xe'));var Papa=require('papaparse');var Redis=require(_0xc410('0xf'));var authService=require(_0xc410('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc410('0x11'));var hardwareService=require(_0xc410('0x12'));var logger=require('../../config/logger')(_0xc410('0x13'));var utils=require(_0xc410('0x14'));var config=require(_0xc410('0x15'));var db=require(_0xc410('0x16'))['db'];function respondWithStatusCode(_0x5a3632,_0x5a3d33){_0x5a3d33=_0x5a3d33||0xcc;return function(_0x266ea7){if(_0x266ea7){return _0x5a3632[_0xc410('0x17')](_0x5a3d33);}return _0x5a3632[_0xc410('0x18')](_0x5a3d33)[_0xc410('0x19')]();};}function respondWithResult(_0x3c7139,_0x4b09ca){_0x4b09ca=_0x4b09ca||0xc8;return function(_0x196326){if(_0x196326){return _0x3c7139['status'](_0x4b09ca)[_0xc410('0x1a')](_0x196326);}};}function respondWithFilteredResult(_0x42b5a5,_0x58b165){return function(_0x2fe26b){if(_0x2fe26b){var _0x5b3465=_0x2fe26b[_0xc410('0x1b')],_0x3cd6e5=_0x58b165[_0xc410('0x1c')],_0x1d0d64=_0x58b165[_0xc410('0x1c')]+_0x58b165[_0xc410('0x1d')],_0x374ca0;if(_0x1d0d64>=_0x5b3465){_0x1d0d64=_0x5b3465;_0x374ca0=0xc8;}else{_0x374ca0=0xce;}_0x42b5a5[_0xc410('0x18')](_0x374ca0);return _0x42b5a5[_0xc410('0x1e')]('Content-Range',_0x3cd6e5+'-'+_0x1d0d64+'/'+_0x5b3465)[_0xc410('0x1a')](_0x2fe26b);}return null;};}function patchUpdates(_0x579985){return function(_0x5d4c6f){try{jsonpatch[_0xc410('0x1f')](_0x5d4c6f,_0x579985,!![]);}catch(_0x1f388e){return BPromise[_0xc410('0x20')](_0x1f388e);}return _0x5d4c6f[_0xc410('0x21')]();};}function saveUpdates(_0x1848da,_0x1aaf7a){return function(_0x32b502){if(_0x32b502){return _0x32b502[_0xc410('0x22')](_0x1848da)[_0xc410('0x23')](function(_0x5db0c7){return _0x5db0c7;});}return null;};}function removeEntity(_0x30a2ec,_0x43ef4c){return function(_0x47fa6e){if(_0x47fa6e){return _0x47fa6e[_0xc410('0x24')]()[_0xc410('0x23')](function(){_0x30a2ec[_0xc410('0x18')](0xcc)[_0xc410('0x19')]();});}};}function handleEntityNotFound(_0x46daf1,_0x52e85b){return function(_0x708e47){if(!_0x708e47){_0x46daf1['sendStatus'](0x194);}return _0x708e47;};}function handleError(_0x5feaa2,_0x4dcb2a){_0x4dcb2a=_0x4dcb2a||0x1f4;return function(_0x2c38a6){logger[_0xc410('0x25')](_0x2c38a6[_0xc410('0x26')]);if(_0x2c38a6[_0xc410('0x27')]){delete _0x2c38a6['name'];}_0x5feaa2['status'](_0x4dcb2a)[_0xc410('0x28')](_0x2c38a6);};}exports['index']=function(_0x5719cf,_0x3fb025){var _0x29c61a={},_0x4fc251={},_0x146886={'count':0x0,'rows':[]};var _0x4d3bc4=_['map'](db[_0xc410('0x29')][_0xc410('0x2a')],function(_0x5ea2ea){return{'name':_0x5ea2ea[_0xc410('0x2b')],'type':_0x5ea2ea[_0xc410('0x2c')]['key']};});_0x4fc251[_0xc410('0x2d')]=_[_0xc410('0x2e')](_0x4d3bc4,_0xc410('0x27'));_0x4fc251[_0xc410('0x2f')]=_[_0xc410('0x30')](_0x5719cf[_0xc410('0x2f')]);_0x4fc251[_0xc410('0x31')]=_['intersection'](_0x4fc251[_0xc410('0x2d')],_0x4fc251['query']);_0x29c61a[_0xc410('0x32')]=_[_0xc410('0x33')](_0x4fc251[_0xc410('0x2d')],qs['fields'](_0x5719cf[_0xc410('0x2f')][_0xc410('0x34')]));_0x29c61a[_0xc410('0x32')]=_0x29c61a['attributes'][_0xc410('0x35')]?_0x29c61a['attributes']:_0x4fc251[_0xc410('0x2d')];if(!_0x5719cf['query']['hasOwnProperty'](_0xc410('0x36'))){_0x29c61a[_0xc410('0x1d')]=qs[_0xc410('0x1d')](_0x5719cf[_0xc410('0x2f')]['limit']);_0x29c61a[_0xc410('0x1c')]=qs[_0xc410('0x1c')](_0x5719cf['query'][_0xc410('0x1c')]);}_0x29c61a[_0xc410('0x37')]=qs['sort'](_0x5719cf[_0xc410('0x2f')][_0xc410('0x38')]);_0x29c61a[_0xc410('0x39')]=qs['filters'](_[_0xc410('0x3a')](_0x5719cf['query'],_0x4fc251[_0xc410('0x31')]),_0x4d3bc4);if(_0x5719cf[_0xc410('0x2f')][_0xc410('0x3b')]){_0x29c61a[_0xc410('0x39')]=_['merge'](_0x29c61a[_0xc410('0x39')],{'$or':_['map'](_0x4d3bc4,function(_0x5ec8a0){if(_0x5ec8a0['type']!==_0xc410('0x3c')){var _0x4f6628={};_0x4f6628[_0x5ec8a0[_0xc410('0x27')]]={'$like':'%'+_0x5719cf[_0xc410('0x2f')][_0xc410('0x3b')]+'%'};return _0x4f6628;}})});}_0x29c61a=_[_0xc410('0x3d')]({},_0x29c61a,_0x5719cf[_0xc410('0x3e')]);var _0x39e03c={'where':_0x29c61a[_0xc410('0x39')]};return db[_0xc410('0x29')][_0xc410('0x1b')](_0x39e03c)[_0xc410('0x23')](function(_0x511f04){_0x146886[_0xc410('0x1b')]=_0x511f04;if(_0x5719cf[_0xc410('0x2f')][_0xc410('0x3f')]){_0x29c61a[_0xc410('0x40')]=[{'all':!![]}];}return db[_0xc410('0x29')]['findAll'](_0x29c61a);})[_0xc410('0x23')](function(_0x2a5cf4){_0x146886[_0xc410('0x41')]=_0x2a5cf4;return _0x146886;})[_0xc410('0x23')](respondWithFilteredResult(_0x3fb025,_0x29c61a))[_0xc410('0x42')](handleError(_0x3fb025,null));};exports['show']=function(_0xdfe5ed,_0x27e0f2){var _0x56b3b4={'raw':![],'where':{'id':_0xdfe5ed[_0xc410('0x43')]['id']}},_0x196cec={};_0x196cec[_0xc410('0x2d')]=_[_0xc410('0x30')](db[_0xc410('0x29')][_0xc410('0x2a')]);_0x196cec[_0xc410('0x2f')]=_[_0xc410('0x30')](_0xdfe5ed['query']);_0x196cec[_0xc410('0x31')]=_['intersection'](_0x196cec[_0xc410('0x2d')],_0x196cec[_0xc410('0x2f')]);_0x56b3b4[_0xc410('0x32')]=_['intersection'](_0x196cec[_0xc410('0x2d')],qs[_0xc410('0x34')](_0xdfe5ed[_0xc410('0x2f')][_0xc410('0x34')]));_0x56b3b4[_0xc410('0x32')]=_0x56b3b4[_0xc410('0x32')][_0xc410('0x35')]?_0x56b3b4[_0xc410('0x32')]:_0x196cec['model'];if(_0xdfe5ed['query']['includeAll']){_0x56b3b4[_0xc410('0x40')]=[{'all':!![]}];}_0x56b3b4=_['merge']({},_0x56b3b4,_0xdfe5ed[_0xc410('0x3e')]);return db['Integration'][_0xc410('0x44')](_0x56b3b4)[_0xc410('0x23')](handleEntityNotFound(_0x27e0f2,null))[_0xc410('0x23')](respondWithResult(_0x27e0f2,null))['catch'](handleError(_0x27e0f2,null));};exports[_0xc410('0x45')]=function(_0x44ee79,_0x4bc206){return db[_0xc410('0x29')][_0xc410('0x45')](_0x44ee79['body'],{})[_0xc410('0x23')](respondWithResult(_0x4bc206,0xc9))['catch'](handleError(_0x4bc206,null));};exports[_0xc410('0x22')]=function(_0x3d8a6c,_0x735d60){if(_0x3d8a6c['body']['id']){delete _0x3d8a6c['body']['id'];}return db['Integration'][_0xc410('0x44')]({'where':{'id':_0x3d8a6c[_0xc410('0x43')]['id']}})[_0xc410('0x23')](handleEntityNotFound(_0x735d60,null))['then'](saveUpdates(_0x3d8a6c[_0xc410('0x46')],null))['then'](respondWithResult(_0x735d60,null))['catch'](handleError(_0x735d60,null));};exports[_0xc410('0x24')]=function(_0x294534,_0x148df6){return db['Integration'][_0xc410('0x44')]({'where':{'id':_0x294534['params']['id']}})[_0xc410('0x23')](handleEntityNotFound(_0x148df6,null))['then'](removeEntity(_0x148df6,null))[_0xc410('0x42')](handleError(_0x148df6,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index df72b1d..3f4f885 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 _0xc81b=['integrations','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0xc81b,0xc9));var _0xbc81=function(_0x589bab,_0x46a0bf){_0x589bab=_0x589bab-0x0;var _0x50c677=_0xc81b[_0x589bab];return _0x50c677;};'use strict';var _=require('lodash');var util=require(_0xbc81('0x0'));var logger=require(_0xbc81('0x1'))(_0xbc81('0x2'));var moment=require(_0xbc81('0x3'));var BPromise=require(_0xbc81('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc81('0x5'));var config=require(_0xbc81('0x6'));var attributes=require('./integration.attributes');module[_0xbc81('0x7')]=function(_0xe21b5a,_0x4593de){return _0xe21b5a[_0xbc81('0x8')]('Integration',attributes,{'tableName':_0xbc81('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f42=['define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports'];(function(_0x120647,_0x5ab0d0){var _0x3f7cba=function(_0x122d9f){while(--_0x122d9f){_0x120647['push'](_0x120647['shift']());}};_0x3f7cba(++_0x5ab0d0);}(_0x5f42,0x17a));var _0x25f4=function(_0x47635d,_0x56cf35){_0x47635d=_0x47635d-0x0;var _0x8869a4=_0x5f42[_0x47635d];return _0x8869a4;};'use strict';var _=require(_0x25f4('0x0'));var util=require(_0x25f4('0x1'));var logger=require(_0x25f4('0x2'))(_0x25f4('0x3'));var moment=require(_0x25f4('0x4'));var BPromise=require(_0x25f4('0x5'));var rp=require(_0x25f4('0x6'));var fs=require('fs');var path=require(_0x25f4('0x7'));var rimraf=require(_0x25f4('0x8'));var config=require(_0x25f4('0x9'));var attributes=require(_0x25f4('0xa'));module[_0x25f4('0xb')]=function(_0x1ce8b8,_0x1f437a){return _0x1ce8b8[_0x25f4('0xc')](_0x25f4('0xd'),attributes,{'tableName':_0x25f4('0xe'),'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 9b97a2d..d3c5c3b 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 _0xec82=['jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x252f2a,_0x550648){var _0x3ff9f2=function(_0x4c2c48){while(--_0x4c2c48){_0x252f2a['push'](_0x252f2a['shift']());}};_0x3ff9f2(++_0x550648);}(_0xec82,0x184));var _0x2ec8=function(_0xdb77b9,_0x472ad7){_0xdb77b9=_0xdb77b9-0x0;var _0x4ea885=_0xec82[_0xdb77b9];return _0x4ea885;};'use strict';var _=require(_0x2ec8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ec8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ec8('0x2'));var db=require(_0x2ec8('0x3'))['db'];var utils=require(_0x2ec8('0x4'));var logger=require(_0x2ec8('0x5'))(_0x2ec8('0x6'));var config=require(_0x2ec8('0x7'));var jayson=require(_0x2ec8('0x8'));var client=jayson[_0x2ec8('0x9')][_0x2ec8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38a971,_0x34be0a,_0x10bd09){return new BPromise(function(_0x180c63,_0x57dd82){return client[_0x2ec8('0xb')](_0x38a971,_0x10bd09)[_0x2ec8('0xc')](function(_0x24b423){logger[_0x2ec8('0xd')](_0x2ec8('0xe'),_0x34be0a,_0x2ec8('0xf'));logger[_0x2ec8('0x10')](_0x2ec8('0x11'),_0x34be0a,'request\x20sent',JSON['stringify'](_0x24b423));if(_0x24b423[_0x2ec8('0x12')]){if(_0x24b423[_0x2ec8('0x12')][_0x2ec8('0x13')]===0x1f4){logger[_0x2ec8('0x12')]('Integration,\x20%s,\x20%s',_0x34be0a,_0x24b423[_0x2ec8('0x12')][_0x2ec8('0x14')]);return _0x57dd82(_0x24b423['error'][_0x2ec8('0x14')]);}logger['error'](_0x2ec8('0xe'),_0x34be0a,_0x24b423[_0x2ec8('0x12')]['message']);return _0x180c63(_0x24b423['error']['message']);}else{logger[_0x2ec8('0xd')](_0x2ec8('0xe'),_0x34be0a,_0x2ec8('0xf'));_0x180c63(_0x24b423[_0x2ec8('0x15')][_0x2ec8('0x14')]);}})['catch'](function(_0x2ccabd){logger[_0x2ec8('0x12')](_0x2ec8('0xe'),_0x34be0a,_0x2ccabd);_0x57dd82(_0x2ccabd);});});} \ No newline at end of file +var _0xbd50=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd50,0x196));var _0x0bd5=function(_0xf5e35f,_0x271b45){_0xf5e35f=_0xf5e35f-0x0;var _0x2163ad=_0xbd50[_0xf5e35f];return _0x2163ad;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 9e73b0f..f2256cb 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 _0x8d7b=['isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./integrationReport.controller','get'];(function(_0x4c7d23,_0x1eed42){var _0x4bd04c=function(_0x3409cf){while(--_0x3409cf){_0x4c7d23['push'](_0x4c7d23['shift']());}};_0x4bd04c(++_0x1eed42);}(_0x8d7b,0x70));var _0xb8d7=function(_0x4ef343,_0x124611){_0x4ef343=_0x4ef343-0x0;var _0x14f697=_0x8d7b[_0x4ef343];return _0x14f697;};'use strict';var multer=require(_0xb8d7('0x0'));var util=require(_0xb8d7('0x1'));var path=require(_0xb8d7('0x2'));var timeout=require(_0xb8d7('0x3'));var express=require('express');var router=express[_0xb8d7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb8d7('0x5'));var config=require('../../config/environment');var controller=require(_0xb8d7('0x6'));router[_0xb8d7('0x7')]('/',auth[_0xb8d7('0x8')](),controller[_0xb8d7('0x9')]);router[_0xb8d7('0x7')]('/describe',auth[_0xb8d7('0x8')](),controller[_0xb8d7('0xa')]);router[_0xb8d7('0x7')](_0xb8d7('0xb'),auth[_0xb8d7('0x8')](),controller[_0xb8d7('0xc')]);router[_0xb8d7('0xd')]('/',auth[_0xb8d7('0x8')](),controller[_0xb8d7('0xe')]);router[_0xb8d7('0xf')](_0xb8d7('0xb'),auth[_0xb8d7('0x8')](),controller[_0xb8d7('0x10')]);router[_0xb8d7('0x11')](_0xb8d7('0xb'),auth[_0xb8d7('0x8')](),controller[_0xb8d7('0x12')]);module[_0xb8d7('0x13')]=router; \ No newline at end of file +var _0x720c=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','put','update','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x720c,0x154));var _0xc720=function(_0x47707e,_0x58c7dc){_0x47707e=_0x47707e-0x0;var _0x37b727=_0x720c[_0x47707e];return _0x37b727;};'use strict';var multer=require(_0xc720('0x0'));var util=require('util');var path=require(_0xc720('0x1'));var timeout=require(_0xc720('0x2'));var express=require(_0xc720('0x3'));var router=express[_0xc720('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc720('0x5'));var config=require(_0xc720('0x6'));var controller=require(_0xc720('0x7'));router[_0xc720('0x8')]('/',auth[_0xc720('0x9')](),controller[_0xc720('0xa')]);router[_0xc720('0x8')]('/describe',auth[_0xc720('0x9')](),controller[_0xc720('0xb')]);router[_0xc720('0x8')](_0xc720('0xc'),auth[_0xc720('0x9')](),controller['show']);router['post']('/',auth[_0xc720('0x9')](),controller['create']);router[_0xc720('0xd')](_0xc720('0xc'),auth['isAuthenticated'](),controller[_0xc720('0xe')]);router[_0xc720('0xf')](_0xc720('0xc'),auth[_0xc720('0x9')](),controller[_0xc720('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index ecdb5bd..5df275f 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 _0x98d6=['BOOLEAN','TEXT','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x98d6,0xb9));var _0x698d=function(_0x139b3b,_0x593058){_0x139b3b=_0x139b3b-0x0;var _0x55cc2a=_0x98d6[_0x139b3b];return _0x55cc2a;};'use strict';var Sequelize=require(_0x698d('0x0'));module[_0x698d('0x1')]={'integration':{'type':Sequelize[_0x698d('0x2')]},'eventChannel':{'type':Sequelize[_0x698d('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x698d('0x2')]},'integrationId':{'type':Sequelize[_0x698d('0x3')]},'contacts':{'type':Sequelize[_0x698d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x698d('0x2')]},'calleridname':{'type':Sequelize[_0x698d('0x2')]},'queue':{'type':Sequelize[_0x698d('0x2')]},'interface':{'type':Sequelize[_0x698d('0x2')]},'membername':{'type':Sequelize[_0x698d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x698d('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x698d('0x3')]},'agentcomplete':{'type':Sequelize[_0x698d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x698d('0x4')]},'talktime':{'type':Sequelize[_0x698d('0x3')]},'agentacw':{'type':Sequelize[_0x698d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x698d('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x698d('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x698d('0x4')]},'agentdump':{'type':Sequelize[_0x698d('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x698d('0x4')]},'lastevent':{'type':Sequelize[_0x698d('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x698d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x698d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x698d('0x2')]},'connectedlinename':{'type':Sequelize[_0x698d('0x2')]},'language':{'type':Sequelize[_0x698d('0x2')]},'accountcode':{'type':Sequelize[_0x698d('0x2')]},'context':{'type':Sequelize[_0x698d('0x2')]},'exten':{'type':Sequelize[_0x698d('0x2')]},'priority':{'type':Sequelize[_0x698d('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x698d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x698d('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x698d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x698d('0x2')]},'destaccountcode':{'type':Sequelize[_0x698d('0x2')]},'destcontext':{'type':Sequelize[_0x698d('0x2')]},'destexten':{'type':Sequelize[_0x698d('0x2')]},'destpriority':{'type':Sequelize[_0x698d('0x2')]},'destuniqueid':{'type':Sequelize[_0x698d('0x2')]},'messageId':{'type':Sequelize[_0x698d('0x2')]},'inReplyTo':{'type':Sequelize[_0x698d('0x2')]},'subject':{'type':Sequelize[_0x698d('0x2')]},'from':{'type':Sequelize[_0x698d('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x698d('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x698d('0x6')]},'status':{'type':Sequelize['ENUM'](_0x698d('0x7'),'SENDING',_0x698d('0x8'),_0x698d('0x9'))},'url':{'type':Sequelize[_0x698d('0x2')]},'app':{'type':Sequelize[_0x698d('0x2')]},'appdata':{'type':Sequelize[_0x698d('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9657=['SENDING','RECEIVED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x2dfbcb,_0x37be1c){var _0x49ad5c=function(_0x342402){while(--_0x342402){_0x2dfbcb['push'](_0x2dfbcb['shift']());}};_0x49ad5c(++_0x37be1c);}(_0x9657,0x1e8));var _0x7965=function(_0x168c5a,_0x25c2cc){_0x168c5a=_0x168c5a-0x0;var _0x51434d=_0x9657[_0x168c5a];return _0x51434d;};'use strict';var Sequelize=require(_0x7965('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7965('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x7965('0x2')]},'contacts':{'type':Sequelize[_0x7965('0x1')]},'uniqueid':{'type':Sequelize[_0x7965('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7965('0x1')]},'queue':{'type':Sequelize[_0x7965('0x1')]},'interface':{'type':Sequelize[_0x7965('0x1')]},'membername':{'type':Sequelize[_0x7965('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7965('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7965('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7965('0x3')]},'talktime':{'type':Sequelize[_0x7965('0x2')]},'agentacw':{'type':Sequelize[_0x7965('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7965('0x2')]},'reason':{'type':Sequelize[_0x7965('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x7965('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7965('0x3')]},'lastevent':{'type':Sequelize[_0x7965('0x1')]},'channel':{'type':Sequelize[_0x7965('0x1')]},'channelstate':{'type':Sequelize[_0x7965('0x2')]},'channelstatedesc':{'type':Sequelize[_0x7965('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7965('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7965('0x1')]},'accountcode':{'type':Sequelize[_0x7965('0x1')]},'context':{'type':Sequelize[_0x7965('0x1')]},'exten':{'type':Sequelize[_0x7965('0x1')]},'priority':{'type':Sequelize[_0x7965('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7965('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x7965('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7965('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7965('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7965('0x1')]},'destlanguage':{'type':Sequelize[_0x7965('0x1')]},'destaccountcode':{'type':Sequelize[_0x7965('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7965('0x1')]},'destpriority':{'type':Sequelize[_0x7965('0x1')]},'destuniqueid':{'type':Sequelize[_0x7965('0x1')]},'messageId':{'type':Sequelize[_0x7965('0x1')]},'inReplyTo':{'type':Sequelize[_0x7965('0x1')]},'subject':{'type':Sequelize[_0x7965('0x1')]},'from':{'type':Sequelize[_0x7965('0x1')]},'to':{'type':Sequelize[_0x7965('0x1')]},'cc':{'type':Sequelize[_0x7965('0x1')]},'attachment':{'type':Sequelize[_0x7965('0x5')]},'html':{'type':Sequelize[_0x7965('0x5')]},'text':{'type':Sequelize[_0x7965('0x5')]},'status':{'type':Sequelize[_0x7965('0x6')]('SENT',_0x7965('0x7'),_0x7965('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x7965('0x1')]},'projectId':{'type':Sequelize[_0x7965('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index bda13af..82a7071 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 _0x969b=['to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','include','findAll','then','rows','params','IntegrationReport','length','options','find','catch','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x969b,0x172));var _0xb969=function(_0xe21519,_0x45c9f3){_0xe21519=_0xe21519-0x0;var _0x506a2e=_0x969b[_0xe21519];return _0x506a2e;};'use strict';var pdf=require(_0xb969('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb969('0x1'));var zipdir=require(_0xb969('0x2'));var jsonpatch=require(_0xb969('0x3'));var rp=require(_0xb969('0x4'));var moment=require(_0xb969('0x5'));var BPromise=require(_0xb969('0x6'));var Mustache=require(_0xb969('0x7'));var util=require('util');var path=require(_0xb969('0x8'));var sox=require(_0xb969('0x9'));var csv=require(_0xb969('0xa'));var ejs=require(_0xb969('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb969('0xc'));var crypto=require(_0xb969('0xd'));var jsforce=require(_0xb969('0xe'));var deskjs=require(_0xb969('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb969('0x10'));var Papa=require(_0xb969('0x11'));var Redis=require(_0xb969('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb969('0x13'));var as=require(_0xb969('0x14'));var hardwareService=require(_0xb969('0x15'));var logger=require(_0xb969('0x16'))(_0xb969('0x17'));var utils=require(_0xb969('0x18'));var config=require(_0xb969('0x19'));var db=require(_0xb969('0x1a'))['db'];function respondWithStatusCode(_0x4d7faf,_0x39caa4){_0x39caa4=_0x39caa4||0xcc;return function(_0x62a2b9){if(_0x62a2b9){return _0x4d7faf[_0xb969('0x1b')](_0x39caa4);}return _0x4d7faf[_0xb969('0x1c')](_0x39caa4)[_0xb969('0x1d')]();};}function respondWithResult(_0x4d4437,_0x550367){_0x550367=_0x550367||0xc8;return function(_0x2096d1){if(_0x2096d1){return _0x4d4437['status'](_0x550367)[_0xb969('0x1e')](_0x2096d1);}};}function respondWithFilteredResult(_0x51e768,_0x16e117){return function(_0xe4e712){if(_0xe4e712){var _0x98dd60=_0xe4e712[_0xb969('0x1f')],_0x1f6902=_0x16e117['offset'],_0x1034b2=_0x16e117[_0xb969('0x20')]+_0x16e117['limit'],_0x57665a;if(_0x1034b2>=_0x98dd60){_0x1034b2=_0x98dd60;_0x57665a=0xc8;}else{_0x57665a=0xce;}_0x51e768[_0xb969('0x1c')](_0x57665a);return _0x51e768[_0xb969('0x21')](_0xb969('0x22'),_0x1f6902+'-'+_0x1034b2+'/'+_0x98dd60)[_0xb969('0x1e')](_0xe4e712);}return null;};}function patchUpdates(_0x4a948f){return function(_0x57963b){try{jsonpatch['apply'](_0x57963b,_0x4a948f,!![]);}catch(_0x4056ce){return BPromise['reject'](_0x4056ce);}return _0x57963b[_0xb969('0x23')]();};}function saveUpdates(_0x26f81d,_0x6180d){return function(_0x1612f8){if(_0x1612f8){return _0x1612f8[_0xb969('0x24')](_0x26f81d)['then'](function(_0x18b5f4){return _0x18b5f4;});}return null;};}function removeEntity(_0x4b1c41,_0x52fd5b){return function(_0x1a88ad){if(_0x1a88ad){return _0x1a88ad['destroy']()['then'](function(){_0x4b1c41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cd04,_0x2369d2){return function(_0x66149e){if(!_0x66149e){_0x46cd04['sendStatus'](0x194);}return _0x66149e;};}function handleError(_0x3c2e04,_0x55d5d1){_0x55d5d1=_0x55d5d1||0x1f4;return function(_0x41d0ab){logger[_0xb969('0x25')](_0x41d0ab[_0xb969('0x26')]);if(_0x41d0ab[_0xb969('0x27')]){delete _0x41d0ab[_0xb969('0x27')];}_0x3c2e04[_0xb969('0x1c')](_0x55d5d1)['send'](_0x41d0ab);};}exports[_0xb969('0x28')]=function(_0x4a4186,_0x54fcd9){var _0x5b6eea={},_0x3c4d13={},_0x19ce81={'count':0x0,'rows':[]};var _0x5d4973=_['map'](db['IntegrationReport'][_0xb969('0x29')],function(_0x41e848){return{'name':_0x41e848[_0xb969('0x2a')],'type':_0x41e848[_0xb969('0x2b')][_0xb969('0x2c')]};});_0x3c4d13[_0xb969('0x2d')]=_['map'](_0x5d4973,_0xb969('0x27'));_0x3c4d13[_0xb969('0x2e')]=_[_0xb969('0x2f')](_0x4a4186['query']);_0x3c4d13['filters']=_[_0xb969('0x30')](_0x3c4d13['model'],_0x3c4d13['query']);_0x5b6eea['attributes']=_[_0xb969('0x30')](_0x3c4d13[_0xb969('0x2d')],qs['fields'](_0x4a4186[_0xb969('0x2e')][_0xb969('0x31')]));_0x5b6eea[_0xb969('0x32')]=_0x5b6eea[_0xb969('0x32')]['length']?_0x5b6eea[_0xb969('0x32')]:_0x3c4d13[_0xb969('0x2d')];if(!_0x4a4186[_0xb969('0x2e')][_0xb969('0x33')](_0xb969('0x34'))){_0x5b6eea['limit']=qs[_0xb969('0x35')](_0x4a4186[_0xb969('0x2e')][_0xb969('0x35')]);_0x5b6eea['offset']=qs[_0xb969('0x20')](_0x4a4186[_0xb969('0x2e')]['offset']);}_0x5b6eea[_0xb969('0x36')]=qs['sort'](_0x4a4186[_0xb969('0x2e')][_0xb969('0x37')]);_0x5b6eea[_0xb969('0x38')]=qs[_0xb969('0x39')](_[_0xb969('0x3a')](_0x4a4186[_0xb969('0x2e')],_0x3c4d13[_0xb969('0x39')]),_0x5d4973);if(_0x4a4186['query']['filter']){_0x5b6eea[_0xb969('0x38')]=_[_0xb969('0x3b')](_0x5b6eea['where'],{'$or':_[_0xb969('0x3c')](_0x5d4973,function(_0x1c3eb0){if(_0x1c3eb0['type']!==_0xb969('0x3d')){var _0x155fd7={};_0x155fd7[_0x1c3eb0[_0xb969('0x27')]]={'$like':'%'+_0x4a4186[_0xb969('0x2e')][_0xb969('0x3e')]+'%'};return _0x155fd7;}})});}_0x5b6eea=_[_0xb969('0x3b')]({},_0x5b6eea,_0x4a4186['options']);var _0x2c1534={'where':_0x5b6eea[_0xb969('0x38')]};return db['IntegrationReport'][_0xb969('0x1f')](_0x2c1534)['then'](function(_0x235664){_0x19ce81['count']=_0x235664;if(_0x4a4186[_0xb969('0x2e')]['includeAll']){_0x5b6eea[_0xb969('0x3f')]=[{'all':!![]}];}return db['IntegrationReport'][_0xb969('0x40')](_0x5b6eea);})[_0xb969('0x41')](function(_0x4915c6){_0x19ce81[_0xb969('0x42')]=_0x4915c6;return _0x19ce81;})[_0xb969('0x41')](respondWithFilteredResult(_0x54fcd9,_0x5b6eea))['catch'](handleError(_0x54fcd9,null));};exports['show']=function(_0x2856cf,_0x5a5a06){var _0x14f221={'raw':![],'where':{'id':_0x2856cf[_0xb969('0x43')]['id']}},_0x44a43d={};_0x44a43d['model']=_['keys'](db[_0xb969('0x44')][_0xb969('0x29')]);_0x44a43d[_0xb969('0x2e')]=_[_0xb969('0x2f')](_0x2856cf[_0xb969('0x2e')]);_0x44a43d[_0xb969('0x39')]=_[_0xb969('0x30')](_0x44a43d[_0xb969('0x2d')],_0x44a43d[_0xb969('0x2e')]);_0x14f221[_0xb969('0x32')]=_['intersection'](_0x44a43d['model'],qs[_0xb969('0x31')](_0x2856cf['query']['fields']));_0x14f221[_0xb969('0x32')]=_0x14f221[_0xb969('0x32')][_0xb969('0x45')]?_0x14f221[_0xb969('0x32')]:_0x44a43d['model'];if(_0x2856cf[_0xb969('0x2e')]['includeAll']){_0x14f221[_0xb969('0x3f')]=[{'all':!![]}];}_0x14f221=_['merge']({},_0x14f221,_0x2856cf[_0xb969('0x46')]);return db[_0xb969('0x44')][_0xb969('0x47')](_0x14f221)[_0xb969('0x41')](handleEntityNotFound(_0x5a5a06,null))['then'](respondWithResult(_0x5a5a06,null))[_0xb969('0x48')](handleError(_0x5a5a06,null));};exports['create']=function(_0x160b90,_0x1d42e1){return db['IntegrationReport']['create'](_0x160b90['body'],{})[_0xb969('0x41')](respondWithResult(_0x1d42e1,0xc9))[_0xb969('0x48')](handleError(_0x1d42e1,null));};exports[_0xb969('0x24')]=function(_0x449c5f,_0x31ddde){if(_0x449c5f[_0xb969('0x49')]['id']){delete _0x449c5f['body']['id'];}return db[_0xb969('0x44')][_0xb969('0x47')]({'where':{'id':_0x449c5f[_0xb969('0x43')]['id']}})[_0xb969('0x41')](handleEntityNotFound(_0x31ddde,null))[_0xb969('0x41')](saveUpdates(_0x449c5f['body'],null))['then'](respondWithResult(_0x31ddde,null))['catch'](handleError(_0x31ddde,null));};exports[_0xb969('0x4a')]=function(_0x5ac940,_0x4932d4){return db['IntegrationReport']['find']({'where':{'id':_0x5ac940['params']['id']}})[_0xb969('0x41')](handleEntityNotFound(_0x4932d4,null))['then'](removeEntity(_0x4932d4,null))['catch'](handleError(_0x4932d4,null));};exports[_0xb969('0x4b')]=function(_0x27da33,_0x5a82e0){return db['IntegrationReport']['describe']()[_0xb969('0x41')](respondWithResult(_0x5a82e0,null))[_0xb969('0x48')](handleError(_0x5a82e0,null));}; \ No newline at end of file +var _0x17cd=['end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','send','index','IntegrationReport','rawAttributes','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x4f8db8,_0x4604ae){var _0x479796=function(_0x23cfee){while(--_0x23cfee){_0x4f8db8['push'](_0x4f8db8['shift']());}};_0x479796(++_0x4604ae);}(_0x17cd,0x111));var _0xd17c=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x17cd[_0x110c3d];return _0x226d67;};'use strict';var pdf=require(_0xd17c('0x0'));var emlformat=require(_0xd17c('0x1'));var rimraf=require(_0xd17c('0x2'));var zipdir=require(_0xd17c('0x3'));var jsonpatch=require(_0xd17c('0x4'));var rp=require(_0xd17c('0x5'));var moment=require(_0xd17c('0x6'));var BPromise=require(_0xd17c('0x7'));var Mustache=require(_0xd17c('0x8'));var util=require(_0xd17c('0x9'));var path=require(_0xd17c('0xa'));var sox=require('sox');var csv=require(_0xd17c('0xb'));var ejs=require(_0xd17c('0xc'));var fs=require('fs');var _=require(_0xd17c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd17c('0xe'));var deskjs=require(_0xd17c('0xf'));var toCsv=require(_0xd17c('0xb'));var querystring=require(_0xd17c('0x10'));var Papa=require(_0xd17c('0x11'));var Redis=require(_0xd17c('0x12'));var authService=require(_0xd17c('0x13'));var qs=require(_0xd17c('0x14'));var as=require(_0xd17c('0x15'));var hardwareService=require(_0xd17c('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xd17c('0x17'));var config=require(_0xd17c('0x18'));var db=require(_0xd17c('0x19'))['db'];function respondWithStatusCode(_0x454b78,_0x1aba1a){_0x1aba1a=_0x1aba1a||0xcc;return function(_0x442351){if(_0x442351){return _0x454b78['sendStatus'](_0x1aba1a);}return _0x454b78[_0xd17c('0x1a')](_0x1aba1a)[_0xd17c('0x1b')]();};}function respondWithResult(_0x253b65,_0x3787e1){_0x3787e1=_0x3787e1||0xc8;return function(_0x33ebba){if(_0x33ebba){return _0x253b65['status'](_0x3787e1)[_0xd17c('0x1c')](_0x33ebba);}};}function respondWithFilteredResult(_0x1b583a,_0x4474c6){return function(_0x4dd89b){if(_0x4dd89b){var _0x5c925e=_0x4dd89b[_0xd17c('0x1d')],_0x4d53fc=_0x4474c6['offset'],_0x268c46=_0x4474c6[_0xd17c('0x1e')]+_0x4474c6[_0xd17c('0x1f')],_0x337235;if(_0x268c46>=_0x5c925e){_0x268c46=_0x5c925e;_0x337235=0xc8;}else{_0x337235=0xce;}_0x1b583a['status'](_0x337235);return _0x1b583a[_0xd17c('0x20')](_0xd17c('0x21'),_0x4d53fc+'-'+_0x268c46+'/'+_0x5c925e)[_0xd17c('0x1c')](_0x4dd89b);}return null;};}function patchUpdates(_0x39c43d){return function(_0xb20d0d){try{jsonpatch[_0xd17c('0x22')](_0xb20d0d,_0x39c43d,!![]);}catch(_0x19c0c0){return BPromise[_0xd17c('0x23')](_0x19c0c0);}return _0xb20d0d[_0xd17c('0x24')]();};}function saveUpdates(_0x5ca3d4,_0x5528b8){return function(_0x34770a){if(_0x34770a){return _0x34770a['update'](_0x5ca3d4)['then'](function(_0x16155b){return _0x16155b;});}return null;};}function removeEntity(_0x37474d,_0x1cdb94){return function(_0xc5e627){if(_0xc5e627){return _0xc5e627[_0xd17c('0x25')]()[_0xd17c('0x26')](function(){_0x37474d[_0xd17c('0x1a')](0xcc)[_0xd17c('0x1b')]();});}};}function handleEntityNotFound(_0x1b650f,_0x465162){return function(_0x468beb){if(!_0x468beb){_0x1b650f[_0xd17c('0x27')](0x194);}return _0x468beb;};}function handleError(_0x352c62,_0x2e1c88){_0x2e1c88=_0x2e1c88||0x1f4;return function(_0x3195ff){logger[_0xd17c('0x28')](_0x3195ff[_0xd17c('0x29')]);if(_0x3195ff['name']){delete _0x3195ff['name'];}_0x352c62[_0xd17c('0x1a')](_0x2e1c88)[_0xd17c('0x2a')](_0x3195ff);};}exports[_0xd17c('0x2b')]=function(_0xd42eec,_0x680658){var _0x105b89={},_0x24e4a0={},_0x485e13={'count':0x0,'rows':[]};var _0x3038b1=_['map'](db[_0xd17c('0x2c')][_0xd17c('0x2d')],function(_0x37dcf4){return{'name':_0x37dcf4['fieldName'],'type':_0x37dcf4[_0xd17c('0x2e')][_0xd17c('0x2f')]};});_0x24e4a0[_0xd17c('0x30')]=_[_0xd17c('0x31')](_0x3038b1,_0xd17c('0x32'));_0x24e4a0[_0xd17c('0x33')]=_['keys'](_0xd42eec['query']);_0x24e4a0[_0xd17c('0x34')]=_[_0xd17c('0x35')](_0x24e4a0[_0xd17c('0x30')],_0x24e4a0[_0xd17c('0x33')]);_0x105b89[_0xd17c('0x36')]=_[_0xd17c('0x35')](_0x24e4a0[_0xd17c('0x30')],qs[_0xd17c('0x37')](_0xd42eec[_0xd17c('0x33')][_0xd17c('0x37')]));_0x105b89[_0xd17c('0x36')]=_0x105b89['attributes'][_0xd17c('0x38')]?_0x105b89[_0xd17c('0x36')]:_0x24e4a0[_0xd17c('0x30')];if(!_0xd42eec[_0xd17c('0x33')][_0xd17c('0x39')]('nolimit')){_0x105b89[_0xd17c('0x1f')]=qs['limit'](_0xd42eec[_0xd17c('0x33')][_0xd17c('0x1f')]);_0x105b89[_0xd17c('0x1e')]=qs[_0xd17c('0x1e')](_0xd42eec['query']['offset']);}_0x105b89[_0xd17c('0x3a')]=qs[_0xd17c('0x3b')](_0xd42eec[_0xd17c('0x33')][_0xd17c('0x3b')]);_0x105b89['where']=qs[_0xd17c('0x34')](_[_0xd17c('0x3c')](_0xd42eec[_0xd17c('0x33')],_0x24e4a0[_0xd17c('0x34')]),_0x3038b1);if(_0xd42eec[_0xd17c('0x33')][_0xd17c('0x3d')]){_0x105b89[_0xd17c('0x3e')]=_[_0xd17c('0x3f')](_0x105b89[_0xd17c('0x3e')],{'$or':_[_0xd17c('0x31')](_0x3038b1,function(_0x1b358f){if(_0x1b358f[_0xd17c('0x2e')]!==_0xd17c('0x40')){var _0x7cc054={};_0x7cc054[_0x1b358f[_0xd17c('0x32')]]={'$like':'%'+_0xd42eec['query']['filter']+'%'};return _0x7cc054;}})});}_0x105b89=_[_0xd17c('0x3f')]({},_0x105b89,_0xd42eec['options']);var _0x40e76b={'where':_0x105b89[_0xd17c('0x3e')]};return db[_0xd17c('0x2c')]['count'](_0x40e76b)[_0xd17c('0x26')](function(_0x5a5a3){_0x485e13[_0xd17c('0x1d')]=_0x5a5a3;if(_0xd42eec[_0xd17c('0x33')]['includeAll']){_0x105b89['include']=[{'all':!![]}];}return db[_0xd17c('0x2c')][_0xd17c('0x41')](_0x105b89);})[_0xd17c('0x26')](function(_0x33fe24){_0x485e13[_0xd17c('0x42')]=_0x33fe24;return _0x485e13;})[_0xd17c('0x26')](respondWithFilteredResult(_0x680658,_0x105b89))[_0xd17c('0x43')](handleError(_0x680658,null));};exports[_0xd17c('0x44')]=function(_0x50589c,_0x3da617){var _0x1a3387={'raw':![],'where':{'id':_0x50589c[_0xd17c('0x45')]['id']}},_0x3727ff={};_0x3727ff['model']=_[_0xd17c('0x46')](db[_0xd17c('0x2c')]['rawAttributes']);_0x3727ff[_0xd17c('0x33')]=_[_0xd17c('0x46')](_0x50589c[_0xd17c('0x33')]);_0x3727ff[_0xd17c('0x34')]=_[_0xd17c('0x35')](_0x3727ff[_0xd17c('0x30')],_0x3727ff[_0xd17c('0x33')]);_0x1a3387[_0xd17c('0x36')]=_[_0xd17c('0x35')](_0x3727ff[_0xd17c('0x30')],qs[_0xd17c('0x37')](_0x50589c[_0xd17c('0x33')]['fields']));_0x1a3387['attributes']=_0x1a3387['attributes'][_0xd17c('0x38')]?_0x1a3387['attributes']:_0x3727ff[_0xd17c('0x30')];if(_0x50589c[_0xd17c('0x33')]['includeAll']){_0x1a3387['include']=[{'all':!![]}];}_0x1a3387=_['merge']({},_0x1a3387,_0x50589c['options']);return db[_0xd17c('0x2c')][_0xd17c('0x47')](_0x1a3387)['then'](handleEntityNotFound(_0x3da617,null))['then'](respondWithResult(_0x3da617,null))[_0xd17c('0x43')](handleError(_0x3da617,null));};exports[_0xd17c('0x48')]=function(_0x5c55c7,_0x3f72c2){return db[_0xd17c('0x2c')][_0xd17c('0x48')](_0x5c55c7['body'],{})[_0xd17c('0x26')](respondWithResult(_0x3f72c2,0xc9))[_0xd17c('0x43')](handleError(_0x3f72c2,null));};exports['update']=function(_0x31410c,_0x1bfcf8){if(_0x31410c['body']['id']){delete _0x31410c['body']['id'];}return db[_0xd17c('0x2c')][_0xd17c('0x47')]({'where':{'id':_0x31410c['params']['id']}})[_0xd17c('0x26')](handleEntityNotFound(_0x1bfcf8,null))[_0xd17c('0x26')](saveUpdates(_0x31410c[_0xd17c('0x49')],null))[_0xd17c('0x26')](respondWithResult(_0x1bfcf8,null))[_0xd17c('0x43')](handleError(_0x1bfcf8,null));};exports[_0xd17c('0x25')]=function(_0xd5d5bf,_0x3e9219){return db[_0xd17c('0x2c')][_0xd17c('0x47')]({'where':{'id':_0xd5d5bf[_0xd17c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e9219,null))['then'](removeEntity(_0x3e9219,null))[_0xd17c('0x43')](handleError(_0x3e9219,null));};exports[_0xd17c('0x4a')]=function(_0x207c1b,_0x55363d){return db[_0xd17c('0x2c')][_0xd17c('0x4a')]()[_0xd17c('0x26')](respondWithResult(_0x55363d,null))[_0xd17c('0x43')](handleError(_0x55363d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 2471776..fe0f009 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 _0xe9b1=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x572e51,_0x4a2cb7){var _0x550bc6=function(_0x2daa4b){while(--_0x2daa4b){_0x572e51['push'](_0x572e51['shift']());}};_0x550bc6(++_0x4a2cb7);}(_0xe9b1,0x170));var _0x1e9b=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0xe9b1[_0x3457b4];return _0xaa8fa9;};'use strict';var _=require(_0x1e9b('0x0'));var util=require(_0x1e9b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1e9b('0x2'));var rp=require(_0x1e9b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e9b('0x4'));var config=require(_0x1e9b('0x5'));var attributes=require(_0x1e9b('0x6'));module[_0x1e9b('0x7')]=function(_0x44ac5f,_0x3da4da){return _0x44ac5f[_0x1e9b('0x8')](_0x1e9b('0x9'),attributes,{'tableName':_0x1e9b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd63d=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x181e89,_0x1dd6c4){var _0x12fae0=function(_0x1c4dd1){while(--_0x1c4dd1){_0x181e89['push'](_0x181e89['shift']());}};_0x12fae0(++_0x1dd6c4);}(_0xd63d,0x16b));var _0xdd63=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0xd63d[_0x27031e];return _0xfd46b3;};'use strict';var _=require(_0xdd63('0x0'));var util=require(_0xdd63('0x1'));var logger=require(_0xdd63('0x2'))(_0xdd63('0x3'));var moment=require(_0xdd63('0x4'));var BPromise=require(_0xdd63('0x5'));var rp=require(_0xdd63('0x6'));var fs=require('fs');var path=require(_0xdd63('0x7'));var rimraf=require(_0xdd63('0x8'));var config=require(_0xdd63('0x9'));var attributes=require(_0xdd63('0xa'));module[_0xdd63('0xb')]=function(_0x42a542,_0x2b099b){return _0x42a542[_0xdd63('0xc')](_0xdd63('0xd'),attributes,{'tableName':_0xdd63('0xe'),'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 ad0d32b..1094224 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5cb367,_0x27ec9d){var _0x279365=function(_0x1d9d85){while(--_0x1d9d85){_0x5cb367['push'](_0x5cb367['shift']());}};_0x279365(++_0x27ec9d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ 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(_0x3962c1,_0x5cab17){var _0xe0cfb6=function(_0x2b6fab){while(--_0x2b6fab){_0x3962c1['push'](_0x3962c1['shift']());}};_0xe0cfb6(++_0x5cab17);}(_0x757a,0xde));var _0xa757=function(_0x503a27,_0x1982e6){_0x503a27=_0x503a27-0x0;var _0x258b4d=_0x757a[_0x503a27];return _0x258b4d;};'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 9f469b6..4167ba6 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 _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x1353c9,_0x314a5b){var _0x1a4ec3=function(_0x245e06){while(--_0x245e06){_0x1353c9['push'](_0x1353c9['shift']());}};_0x1a4ec3(++_0x314a5b);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b755a,_0x5b5ac7){_0x4b755a=_0x4b755a-0x0;var _0x11727e=_0xedd9[_0x4b755a];return _0x11727e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x396446,_0x3554fd){var _0x1b803b=function(_0x595172){while(--_0x595172){_0x396446['push'](_0x396446['shift']());}};_0x1b803b(++_0x3554fd);}(_0x008c,0x188));var _0xc008=function(_0x2fff52,_0x1580ac){_0x2fff52=_0x2fff52-0x0;var _0x4fef52=_0x008c[_0x2fff52];return _0x4fef52;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 62cd38a..c423151 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 _0xd1bb=['exports','STRING','sequelize'];(function(_0x586580,_0x51cafb){var _0x18bfab=function(_0x31d69e){while(--_0x31d69e){_0x586580['push'](_0x586580['shift']());}};_0x18bfab(++_0x51cafb);}(_0xd1bb,0x125));var _0xbd1b=function(_0x53d8f2,_0x5cceb8){_0x53d8f2=_0x53d8f2-0x0;var _0x23b89c=_0xd1bb[_0x53d8f2];return _0x23b89c;};'use strict';var Sequelize=require(_0xbd1b('0x0'));module[_0xbd1b('0x1')]={'name':{'type':Sequelize[_0xbd1b('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x130c=['exports','STRING','sequelize'];(function(_0x4f7e5b,_0x452c65){var _0x13ea34=function(_0x3f04c0){while(--_0x3f04c0){_0x4f7e5b['push'](_0x4f7e5b['shift']());}};_0x13ea34(++_0x452c65);}(_0x130c,0x107));var _0xc130=function(_0x1896e5,_0x31b560){_0x1896e5=_0x1896e5-0x0;var _0x4fe8ba=_0x130c[_0x1896e5];return _0x4fe8ba;};'use strict';var Sequelize=require(_0xc130('0x0'));module[_0xc130('0x1')]={'name':{'type':Sequelize[_0xc130('0x2')]},'description':{'type':Sequelize[_0xc130('0x2')]},'interval':{'type':Sequelize[_0xc130('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 efb0667..12621d8 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 _0x959d=['options','Interval','catch','show','params','includeAll','include','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','transaction','bulkCreate','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/extensions/rewrite','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','destroy','then','get','Intervals','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge'];(function(_0x4ed37d,_0x1a84c9){var _0x4fb2c5=function(_0x5c9013){while(--_0x5c9013){_0x4ed37d['push'](_0x4ed37d['shift']());}};_0x4fb2c5(++_0x1a84c9);}(_0x959d,0x71));var _0xd959=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x959d[_0x23ec06];return _0x2831d4;};'use strict';var pdf=require(_0xd959('0x0'));var emlformat=require(_0xd959('0x1'));var rimraf=require(_0xd959('0x2'));var zipdir=require(_0xd959('0x3'));var jsonpatch=require(_0xd959('0x4'));var rp=require(_0xd959('0x5'));var moment=require(_0xd959('0x6'));var BPromise=require(_0xd959('0x7'));var Mustache=require('mustache');var util=require(_0xd959('0x8'));var path=require(_0xd959('0x9'));var sox=require(_0xd959('0xa'));var csv=require(_0xd959('0xb'));var ejs=require(_0xd959('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd959('0xd'));var jsforce=require(_0xd959('0xe'));var deskjs=require(_0xd959('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd959('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd959('0x11'));var as=require(_0xd959('0x12'));var hardwareService=require(_0xd959('0x13'));var logger=require(_0xd959('0x14'))(_0xd959('0x15'));var utils=require(_0xd959('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var extensions=require(_0xd959('0x17'));function respondWithStatusCode(_0x43db49,_0x34eae8){_0x34eae8=_0x34eae8||0xcc;return function(_0x3a98c2){if(_0x3a98c2){return _0x43db49[_0xd959('0x18')](_0x34eae8);}return _0x43db49[_0xd959('0x19')](_0x34eae8)[_0xd959('0x1a')]();};}function respondWithResult(_0xaeb770,_0x4f7bc2){_0x4f7bc2=_0x4f7bc2||0xc8;return function(_0x156462){if(_0x156462){return _0xaeb770[_0xd959('0x19')](_0x4f7bc2)['json'](_0x156462);}};}function respondWithFilteredResult(_0x350aa8,_0x8fa14a){return function(_0x4a3976){if(_0x4a3976){var _0x4de89f=_0x4a3976[_0xd959('0x1b')],_0x542801=_0x8fa14a[_0xd959('0x1c')],_0x3693c0=_0x8fa14a[_0xd959('0x1c')]+_0x8fa14a[_0xd959('0x1d')],_0x277d4a;if(_0x3693c0>=_0x4de89f){_0x3693c0=_0x4de89f;_0x277d4a=0xc8;}else{_0x277d4a=0xce;}_0x350aa8['status'](_0x277d4a);return _0x350aa8[_0xd959('0x1e')]('Content-Range',_0x542801+'-'+_0x3693c0+'/'+_0x4de89f)[_0xd959('0x1f')](_0x4a3976);}return null;};}function patchUpdates(_0x1bdb37){return function(_0x45485e){try{jsonpatch[_0xd959('0x20')](_0x45485e,_0x1bdb37,!![]);}catch(_0xe3f2ab){return BPromise[_0xd959('0x21')](_0xe3f2ab);}return _0x45485e['save']();};}function saveUpdates(_0x45c40d,_0x361dc2){return function(_0x6cae2){if(_0x6cae2){return _0x6cae2[_0xd959('0x22')](_0x45c40d)['then'](function(_0x333a33){return _0x333a33;});}return null;};}function removeEntity(_0x4c9950,_0x1d36b2){return function(_0x458c1f){if(_0x458c1f){return _0x458c1f[_0xd959('0x23')]()[_0xd959('0x24')](function(){var _0x2575a8=_0x458c1f[_0xd959('0x25')]({'plain':!![]});var _0x58d73a=_0xd959('0x26');return db['UserProfileResource'][_0xd959('0x23')]({'where':{'type':_0x58d73a,'resourceId':_0x2575a8['id']}})['then'](function(){return _0x458c1f;});})[_0xd959('0x24')](function(){_0x4c9950['status'](0xcc)[_0xd959('0x1a')]();});}};}function handleEntityNotFound(_0x3822cc,_0x48623c){return function(_0x3301bd){if(!_0x3301bd){_0x3822cc['sendStatus'](0x194);}return _0x3301bd;};}function handleError(_0x9d666c,_0x3b230e){_0x3b230e=_0x3b230e||0x1f4;return function(_0x22d454){logger[_0xd959('0x27')](_0x22d454[_0xd959('0x28')]);if(_0x22d454[_0xd959('0x29')]){delete _0x22d454[_0xd959('0x29')];}_0x9d666c[_0xd959('0x19')](_0x3b230e)['send'](_0x22d454);};}exports[_0xd959('0x2a')]=function(_0x45e63a,_0x4759d8){var _0x4d679b={},_0x23c50c={},_0x4df297={'count':0x0,'rows':[]};var _0x15c3b7=_['map'](db['Interval'][_0xd959('0x2b')],function(_0xa638d6){return{'name':_0xa638d6[_0xd959('0x2c')],'type':_0xa638d6[_0xd959('0x2d')][_0xd959('0x2e')]};});_0x23c50c[_0xd959('0x2f')]=_[_0xd959('0x30')](_0x15c3b7,_0xd959('0x29'));_0x23c50c[_0xd959('0x31')]=_[_0xd959('0x32')](_0x45e63a[_0xd959('0x31')]);_0x23c50c['filters']=_[_0xd959('0x33')](_0x23c50c['model'],_0x23c50c['query']);_0x4d679b[_0xd959('0x34')]=_[_0xd959('0x33')](_0x23c50c[_0xd959('0x2f')],qs[_0xd959('0x35')](_0x45e63a[_0xd959('0x31')]['fields']));_0x4d679b[_0xd959('0x34')]=_0x4d679b[_0xd959('0x34')][_0xd959('0x36')]?_0x4d679b[_0xd959('0x34')]:_0x23c50c[_0xd959('0x2f')];if(!_0x45e63a['query'][_0xd959('0x37')](_0xd959('0x38'))){_0x4d679b[_0xd959('0x1d')]=qs[_0xd959('0x1d')](_0x45e63a[_0xd959('0x31')][_0xd959('0x1d')]);_0x4d679b[_0xd959('0x1c')]=qs[_0xd959('0x1c')](_0x45e63a[_0xd959('0x31')][_0xd959('0x1c')]);}_0x4d679b[_0xd959('0x39')]=qs[_0xd959('0x3a')](_0x45e63a['query'][_0xd959('0x3a')]);_0x4d679b[_0xd959('0x3b')]=qs[_0xd959('0x3c')](_['pick'](_0x45e63a[_0xd959('0x31')],_0x23c50c[_0xd959('0x3c')]),_0x15c3b7);if(_0x45e63a['query'][_0xd959('0x3d')]){_0x4d679b[_0xd959('0x3b')]=_[_0xd959('0x3e')](_0x4d679b[_0xd959('0x3b')],{'$or':_[_0xd959('0x30')](_0x15c3b7,function(_0x49702f){if(_0x49702f['type']!=='VIRTUAL'){var _0x1838c5={};_0x1838c5[_0x49702f[_0xd959('0x29')]]={'$like':'%'+_0x45e63a['query'][_0xd959('0x3d')]+'%'};return _0x1838c5;}})});}_0x4d679b=_[_0xd959('0x3e')]({},_0x4d679b,_0x45e63a[_0xd959('0x3f')]);var _0x852758={'where':_0x4d679b[_0xd959('0x3b')]};return db[_0xd959('0x40')][_0xd959('0x1b')](_0x852758)[_0xd959('0x24')](function(_0x114701){_0x4df297[_0xd959('0x1b')]=_0x114701;if(_0x45e63a['query']['includeAll']){_0x4d679b['include']=[{'all':!![]}];}return db[_0xd959('0x40')]['findAll'](_0x4d679b);})['then'](function(_0x32ab15){_0x4df297['rows']=_0x32ab15;return _0x4df297;})['then'](respondWithFilteredResult(_0x4759d8,_0x4d679b))[_0xd959('0x41')](handleError(_0x4759d8,null));};exports[_0xd959('0x42')]=function(_0x44a27d,_0x6d9227){var _0x1647a5={'raw':!![],'where':{'id':_0x44a27d[_0xd959('0x43')]['id']}},_0x2da2b7={};_0x2da2b7[_0xd959('0x2f')]=_[_0xd959('0x32')](db['Interval'][_0xd959('0x2b')]);_0x2da2b7['query']=_[_0xd959('0x32')](_0x44a27d[_0xd959('0x31')]);_0x2da2b7[_0xd959('0x3c')]=_[_0xd959('0x33')](_0x2da2b7['model'],_0x2da2b7[_0xd959('0x31')]);_0x1647a5[_0xd959('0x34')]=_[_0xd959('0x33')](_0x2da2b7['model'],qs[_0xd959('0x35')](_0x44a27d[_0xd959('0x31')][_0xd959('0x35')]));_0x1647a5['attributes']=_0x1647a5[_0xd959('0x34')][_0xd959('0x36')]?_0x1647a5[_0xd959('0x34')]:_0x2da2b7['model'];if(_0x44a27d[_0xd959('0x31')][_0xd959('0x44')]){_0x1647a5[_0xd959('0x45')]=[{'all':!![]}];}_0x1647a5=_['merge']({},_0x1647a5,_0x44a27d[_0xd959('0x3f')]);return db[_0xd959('0x40')][_0xd959('0x46')](_0x1647a5)[_0xd959('0x24')](handleEntityNotFound(_0x6d9227,null))[_0xd959('0x24')](respondWithResult(_0x6d9227,null))['catch'](handleError(_0x6d9227,null));};exports[_0xd959('0x47')]=function(_0x4e9a04,_0x49bd31){return db[_0xd959('0x40')][_0xd959('0x47')](_0x4e9a04[_0xd959('0x48')],{})[_0xd959('0x24')](function(_0x4f42cd){var _0x54f6f5=_0x4e9a04[_0xd959('0x49')][_0xd959('0x25')]({'plain':!![]});if(!_0x54f6f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54f6f5[_0xd959('0x4a')]==='user'){var _0x14e0ac=_0x4f42cd['get']({'plain':!![]});var _0x454426=_0xd959('0x26');return db[_0xd959('0x4b')]['find']({'where':{'name':_0x454426,'userProfileId':_0x54f6f5['userProfileId']},'raw':!![]})[_0xd959('0x24')](function(_0x4c5a3f){if(_0x4c5a3f&&_0x4c5a3f[_0xd959('0x4c')]===0x0){return db['UserProfileResource'][_0xd959('0x47')]({'name':_0x14e0ac[_0xd959('0x29')],'resourceId':_0x14e0ac['id'],'type':_0x4c5a3f[_0xd959('0x29')],'sectionId':_0x4c5a3f['id']},{})[_0xd959('0x24')](function(){return _0x4f42cd;});}else{return _0x4f42cd;}})[_0xd959('0x41')](function(_0x4608b3){logger[_0xd959('0x27')](_0xd959('0x4d'),_0x4608b3);throw _0x4608b3;});}return _0x4f42cd;})[_0xd959('0x24')](respondWithResult(_0x49bd31,0xc9))['catch'](handleError(_0x49bd31,null));};exports[_0xd959('0x22')]=function(_0x28590f,_0x5ea2fc){if(_0x28590f['body']['id']){delete _0x28590f[_0xd959('0x48')]['id'];}return db[_0xd959('0x40')][_0xd959('0x46')]({'where':{'id':_0x28590f[_0xd959('0x43')]['id']}})[_0xd959('0x24')](handleEntityNotFound(_0x5ea2fc,null))[_0xd959('0x24')](saveUpdates(_0x28590f[_0xd959('0x48')],null))[_0xd959('0x24')](respondWithResult(_0x5ea2fc,null))[_0xd959('0x41')](handleError(_0x5ea2fc,null));};exports[_0xd959('0x23')]=function(_0x5aed2d,_0x2586a5){return db[_0xd959('0x40')]['find']({'where':{'id':_0x5aed2d[_0xd959('0x43')]['id']}})['then'](handleEntityNotFound(_0x2586a5,null))['then'](removeEntity(_0x2586a5,null))['catch'](handleError(_0x2586a5,null));};exports[_0xd959('0x4e')]=function(_0x318090,_0x27a947,_0x134136){if(_0x318090[_0xd959('0x48')]['id']){delete _0x318090[_0xd959('0x48')]['id'];}return db[_0xd959('0x40')]['find']({'where':{'id':_0x318090[_0xd959('0x43')]['id']}})[_0xd959('0x24')](handleEntityNotFound(_0x27a947,null))[_0xd959('0x24')](function(_0x189e44){if(_0x189e44){_0x318090[_0xd959('0x48')][_0xd959('0x4f')]=_0x189e44['id'];return db['Interval'][_0xd959('0x47')](_0x318090[_0xd959('0x48')]);}})[_0xd959('0x24')](respondWithResult(_0x27a947,null))['catch'](handleError(_0x27a947,null));};exports[_0xd959('0x50')]=function(_0x2f377c,_0x145512,_0x23a7ee){var _0x4ecdcc={};var _0x57ca28={};var _0xbb9b5f;var _0x2f4751;return db[_0xd959('0x40')][_0xd959('0x51')]({'where':{'id':_0x2f377c[_0xd959('0x43')]['id']}})[_0xd959('0x24')](handleEntityNotFound(_0x145512,null))[_0xd959('0x24')](function(_0x237d23){if(_0x237d23){_0xbb9b5f=_0x237d23;_0x57ca28[_0xd959('0x2f')]=_[_0xd959('0x32')](db['Interval'][_0xd959('0x2b')]);_0x57ca28['query']=_[_0xd959('0x32')](_0x2f377c['query']);_0x57ca28[_0xd959('0x3c')]=_[_0xd959('0x33')](_0x57ca28[_0xd959('0x2f')],_0x57ca28['query']);_0x4ecdcc['attributes']=_[_0xd959('0x33')](_0x57ca28[_0xd959('0x2f')],qs[_0xd959('0x35')](_0x2f377c[_0xd959('0x31')][_0xd959('0x35')]));_0x4ecdcc[_0xd959('0x34')]=_0x4ecdcc[_0xd959('0x34')][_0xd959('0x36')]?_0x4ecdcc[_0xd959('0x34')]:_0x57ca28[_0xd959('0x2f')];_0x4ecdcc['order']=qs[_0xd959('0x3a')](_0x2f377c['query'][_0xd959('0x3a')]);_0x4ecdcc[_0xd959('0x3b')]=qs[_0xd959('0x3c')](_[_0xd959('0x52')](_0x2f377c[_0xd959('0x31')],_0x57ca28[_0xd959('0x3c')]));if(_0x2f377c[_0xd959('0x31')][_0xd959('0x3d')]){_0x4ecdcc['where']=_['merge'](_0x4ecdcc[_0xd959('0x3b')],{'$or':_[_0xd959('0x30')](_0x4ecdcc[_0xd959('0x34')],function(_0x2c6727){var _0xce3750={};_0xce3750[_0x2c6727]={'$like':'%'+_0x2f377c[_0xd959('0x31')]['filter']+'%'};return _0xce3750;})});}_0x4ecdcc=_[_0xd959('0x3e')]({},_0x4ecdcc,_0x2f377c['options']);return _0xbb9b5f[_0xd959('0x50')](_0x4ecdcc);}})[_0xd959('0x24')](function(_0x4821c5){if(_0x4821c5){_0x2f4751=_0x4821c5[_0xd959('0x36')];if(!_0x2f377c[_0xd959('0x31')][_0xd959('0x37')](_0xd959('0x38'))){_0x4ecdcc['limit']=qs[_0xd959('0x1d')](_0x2f377c[_0xd959('0x31')]['limit']);_0x4ecdcc[_0xd959('0x1c')]=qs[_0xd959('0x1c')](_0x2f377c[_0xd959('0x31')]['offset']);}return _0xbb9b5f[_0xd959('0x50')](_0x4ecdcc);}})['then'](function(_0x2f0f0b){if(_0x2f0f0b){return _0x2f0f0b?{'count':_0x2f4751,'rows':_0x2f0f0b}:null;}})[_0xd959('0x24')](respondWithResult(_0x145512,null))[_0xd959('0x41')](handleError(_0x145512,null));};exports[_0xd959('0x53')]=function(_0x5a47af,_0x14417d,_0x3ca6d3){return db[_0xd959('0x40')][_0xd959('0x51')]({'where':{'id':_0x5a47af[_0xd959('0x43')]['id']}})[_0xd959('0x24')](handleEntityNotFound(_0x14417d,null))[_0xd959('0x24')](function(_0xcf398a){if(_0xcf398a){return db[_0xd959('0x54')][_0xd959('0x55')](function(_0x42395a){return db[_0xd959('0x40')][_0xd959('0x23')]({'where':{'IntervalId':_0x5a47af[_0xd959('0x43')]['id']},'transaction':_0x42395a})[_0xd959('0x24')](function(_0x5532f3){var _0x506e75=_[_0xd959('0x30')](_0x5a47af[_0xd959('0x48')],function(_0x341cbe){delete _0x341cbe['id'];_0x341cbe['IntervalId']=_0x5a47af[_0xd959('0x43')]['id'];return _0x341cbe;});return db['Interval'][_0xd959('0x56')](_0x506e75,{'transaction':_0x42395a});});})['then'](function(){return db['Interval'][_0xd959('0x57')]({'where':{'IntervalId':_0x5a47af[_0xd959('0x43')]['id']}});});}})['then'](respondWithResult(_0x14417d,null))['catch'](handleError(_0x14417d,null));}; \ No newline at end of file +var _0x5349=['count','offset','set','Content-Range','json','reject','save','then','get','destroy','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','where','VIRTUAL','filter','merge','options','include','findAll','rows','includeAll','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','userProfileId','autoAssociation','UserProfileResource','update','body','find','params','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','html-pdf','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status'];(function(_0x50daa4,_0x3c336d){var _0x389935=function(_0x292d12){while(--_0x292d12){_0x50daa4['push'](_0x50daa4['shift']());}};_0x389935(++_0x3c336d);}(_0x5349,0x141));var _0x9534=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x5349[_0x1eda20];return _0x31b953;};'use strict';var pdf=require(_0x9534('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9534('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9534('0x2'));var moment=require(_0x9534('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9534('0x4'));var util=require(_0x9534('0x5'));var path=require('path');var sox=require(_0x9534('0x6'));var csv=require(_0x9534('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9534('0x8'));var squel=require('squel');var crypto=require(_0x9534('0x9'));var jsforce=require(_0x9534('0xa'));var deskjs=require(_0x9534('0xb'));var toCsv=require(_0x9534('0x7'));var querystring=require(_0x9534('0xc'));var Papa=require(_0x9534('0xd'));var Redis=require(_0x9534('0xe'));var authService=require(_0x9534('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9534('0x10'))('api');var utils=require(_0x9534('0x11'));var config=require(_0x9534('0x12'));var db=require(_0x9534('0x13'))['db'];var extensions=require(_0x9534('0x14'));function respondWithStatusCode(_0x35a001,_0x578a84){_0x578a84=_0x578a84||0xcc;return function(_0x3652e9){if(_0x3652e9){return _0x35a001[_0x9534('0x15')](_0x578a84);}return _0x35a001[_0x9534('0x16')](_0x578a84)['end']();};}function respondWithResult(_0x17d24d,_0x15eb90){_0x15eb90=_0x15eb90||0xc8;return function(_0x1ff9d6){if(_0x1ff9d6){return _0x17d24d[_0x9534('0x16')](_0x15eb90)['json'](_0x1ff9d6);}};}function respondWithFilteredResult(_0x5b287c,_0x4793c1){return function(_0x1db872){if(_0x1db872){var _0x5bd4fe=_0x1db872[_0x9534('0x17')],_0x2b26a8=_0x4793c1[_0x9534('0x18')],_0x45aa0b=_0x4793c1[_0x9534('0x18')]+_0x4793c1['limit'],_0x423abf;if(_0x45aa0b>=_0x5bd4fe){_0x45aa0b=_0x5bd4fe;_0x423abf=0xc8;}else{_0x423abf=0xce;}_0x5b287c[_0x9534('0x16')](_0x423abf);return _0x5b287c[_0x9534('0x19')](_0x9534('0x1a'),_0x2b26a8+'-'+_0x45aa0b+'/'+_0x5bd4fe)[_0x9534('0x1b')](_0x1db872);}return null;};}function patchUpdates(_0xc02663){return function(_0x176278){try{jsonpatch['apply'](_0x176278,_0xc02663,!![]);}catch(_0x20d0ff){return BPromise[_0x9534('0x1c')](_0x20d0ff);}return _0x176278[_0x9534('0x1d')]();};}function saveUpdates(_0x115530,_0x3b3ddf){return function(_0x1e65e6){if(_0x1e65e6){return _0x1e65e6['update'](_0x115530)[_0x9534('0x1e')](function(_0x45948c){return _0x45948c;});}return null;};}function removeEntity(_0x54dbdc,_0x3a8211){return function(_0x2a6493){if(_0x2a6493){return _0x2a6493['destroy']()[_0x9534('0x1e')](function(){var _0x43620f=_0x2a6493[_0x9534('0x1f')]({'plain':!![]});var _0x3bd3df='Intervals';return db['UserProfileResource'][_0x9534('0x20')]({'where':{'type':_0x3bd3df,'resourceId':_0x43620f['id']}})[_0x9534('0x1e')](function(){return _0x2a6493;});})['then'](function(){_0x54dbdc[_0x9534('0x16')](0xcc)[_0x9534('0x21')]();});}};}function handleEntityNotFound(_0x90be6f,_0x1e31ee){return function(_0x552efa){if(!_0x552efa){_0x90be6f['sendStatus'](0x194);}return _0x552efa;};}function handleError(_0x5dace1,_0x591adb){_0x591adb=_0x591adb||0x1f4;return function(_0x570f4c){logger[_0x9534('0x22')](_0x570f4c[_0x9534('0x23')]);if(_0x570f4c['name']){delete _0x570f4c[_0x9534('0x24')];}_0x5dace1['status'](_0x591adb)[_0x9534('0x25')](_0x570f4c);};}exports[_0x9534('0x26')]=function(_0x43bb7a,_0x50aa1c){var _0x1c5496={},_0x513a1c={},_0x19c03c={'count':0x0,'rows':[]};var _0x1f41fe=_[_0x9534('0x27')](db[_0x9534('0x28')][_0x9534('0x29')],function(_0x136760){return{'name':_0x136760[_0x9534('0x2a')],'type':_0x136760[_0x9534('0x2b')]['key']};});_0x513a1c[_0x9534('0x2c')]=_['map'](_0x1f41fe,_0x9534('0x24'));_0x513a1c['query']=_[_0x9534('0x2d')](_0x43bb7a[_0x9534('0x2e')]);_0x513a1c['filters']=_[_0x9534('0x2f')](_0x513a1c['model'],_0x513a1c[_0x9534('0x2e')]);_0x1c5496['attributes']=_['intersection'](_0x513a1c[_0x9534('0x2c')],qs['fields'](_0x43bb7a[_0x9534('0x2e')][_0x9534('0x30')]));_0x1c5496[_0x9534('0x31')]=_0x1c5496['attributes'][_0x9534('0x32')]?_0x1c5496[_0x9534('0x31')]:_0x513a1c['model'];if(!_0x43bb7a[_0x9534('0x2e')][_0x9534('0x33')](_0x9534('0x34'))){_0x1c5496[_0x9534('0x35')]=qs[_0x9534('0x35')](_0x43bb7a[_0x9534('0x2e')][_0x9534('0x35')]);_0x1c5496['offset']=qs[_0x9534('0x18')](_0x43bb7a['query'][_0x9534('0x18')]);}_0x1c5496[_0x9534('0x36')]=qs[_0x9534('0x37')](_0x43bb7a[_0x9534('0x2e')]['sort']);_0x1c5496['where']=qs['filters'](_['pick'](_0x43bb7a[_0x9534('0x2e')],_0x513a1c[_0x9534('0x38')]),_0x1f41fe);if(_0x43bb7a['query']['filter']){_0x1c5496[_0x9534('0x39')]=_['merge'](_0x1c5496[_0x9534('0x39')],{'$or':_[_0x9534('0x27')](_0x1f41fe,function(_0x3d76f1){if(_0x3d76f1[_0x9534('0x2b')]!==_0x9534('0x3a')){var _0x5acaef={};_0x5acaef[_0x3d76f1[_0x9534('0x24')]]={'$like':'%'+_0x43bb7a['query'][_0x9534('0x3b')]+'%'};return _0x5acaef;}})});}_0x1c5496=_[_0x9534('0x3c')]({},_0x1c5496,_0x43bb7a[_0x9534('0x3d')]);var _0x408e08={'where':_0x1c5496[_0x9534('0x39')]};return db[_0x9534('0x28')][_0x9534('0x17')](_0x408e08)['then'](function(_0x3a2543){_0x19c03c['count']=_0x3a2543;if(_0x43bb7a[_0x9534('0x2e')]['includeAll']){_0x1c5496[_0x9534('0x3e')]=[{'all':!![]}];}return db[_0x9534('0x28')][_0x9534('0x3f')](_0x1c5496);})[_0x9534('0x1e')](function(_0x252633){_0x19c03c[_0x9534('0x40')]=_0x252633;return _0x19c03c;})[_0x9534('0x1e')](respondWithFilteredResult(_0x50aa1c,_0x1c5496))['catch'](handleError(_0x50aa1c,null));};exports['show']=function(_0x5b55de,_0x119b56){var _0xf301a2={'raw':!![],'where':{'id':_0x5b55de['params']['id']}},_0x564054={};_0x564054['model']=_[_0x9534('0x2d')](db['Interval'][_0x9534('0x29')]);_0x564054[_0x9534('0x2e')]=_[_0x9534('0x2d')](_0x5b55de[_0x9534('0x2e')]);_0x564054[_0x9534('0x38')]=_[_0x9534('0x2f')](_0x564054[_0x9534('0x2c')],_0x564054[_0x9534('0x2e')]);_0xf301a2[_0x9534('0x31')]=_['intersection'](_0x564054[_0x9534('0x2c')],qs[_0x9534('0x30')](_0x5b55de[_0x9534('0x2e')][_0x9534('0x30')]));_0xf301a2[_0x9534('0x31')]=_0xf301a2['attributes'][_0x9534('0x32')]?_0xf301a2[_0x9534('0x31')]:_0x564054[_0x9534('0x2c')];if(_0x5b55de[_0x9534('0x2e')][_0x9534('0x41')]){_0xf301a2[_0x9534('0x3e')]=[{'all':!![]}];}_0xf301a2=_[_0x9534('0x3c')]({},_0xf301a2,_0x5b55de[_0x9534('0x3d')]);return db[_0x9534('0x28')]['find'](_0xf301a2)[_0x9534('0x1e')](handleEntityNotFound(_0x119b56,null))[_0x9534('0x1e')](respondWithResult(_0x119b56,null))[_0x9534('0x42')](handleError(_0x119b56,null));};exports[_0x9534('0x43')]=function(_0x2765d2,_0x127c1d){return db[_0x9534('0x28')][_0x9534('0x43')](_0x2765d2['body'],{})[_0x9534('0x1e')](function(_0x59c782){var _0x26aff5=_0x2765d2[_0x9534('0x44')]['get']({'plain':!![]});if(!_0x26aff5)throw new Error(_0x9534('0x45'));if(_0x26aff5['role']===_0x9534('0x44')){var _0x896365=_0x59c782[_0x9534('0x1f')]({'plain':!![]});var _0x3a371c=_0x9534('0x46');return db['UserProfileSection']['find']({'where':{'name':_0x3a371c,'userProfileId':_0x26aff5[_0x9534('0x47')]},'raw':!![]})[_0x9534('0x1e')](function(_0xb09507){if(_0xb09507&&_0xb09507[_0x9534('0x48')]===0x0){return db[_0x9534('0x49')][_0x9534('0x43')]({'name':_0x896365['name'],'resourceId':_0x896365['id'],'type':_0xb09507[_0x9534('0x24')],'sectionId':_0xb09507['id']},{})[_0x9534('0x1e')](function(){return _0x59c782;});}else{return _0x59c782;}})['catch'](function(_0x20dcfd){logger[_0x9534('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20dcfd);throw _0x20dcfd;});}return _0x59c782;})['then'](respondWithResult(_0x127c1d,0xc9))[_0x9534('0x42')](handleError(_0x127c1d,null));};exports[_0x9534('0x4a')]=function(_0x1b2490,_0x3c07eb){if(_0x1b2490[_0x9534('0x4b')]['id']){delete _0x1b2490[_0x9534('0x4b')]['id'];}return db['Interval']['find']({'where':{'id':_0x1b2490['params']['id']}})[_0x9534('0x1e')](handleEntityNotFound(_0x3c07eb,null))[_0x9534('0x1e')](saveUpdates(_0x1b2490[_0x9534('0x4b')],null))[_0x9534('0x1e')](respondWithResult(_0x3c07eb,null))['catch'](handleError(_0x3c07eb,null));};exports['destroy']=function(_0x24b07a,_0x24a4c1){return db[_0x9534('0x28')][_0x9534('0x4c')]({'where':{'id':_0x24b07a[_0x9534('0x4d')]['id']}})[_0x9534('0x1e')](handleEntityNotFound(_0x24a4c1,null))[_0x9534('0x1e')](removeEntity(_0x24a4c1,null))[_0x9534('0x42')](handleError(_0x24a4c1,null));};exports[_0x9534('0x4e')]=function(_0x46a49e,_0x2db031,_0x516c72){if(_0x46a49e['body']['id']){delete _0x46a49e['body']['id'];}return db['Interval'][_0x9534('0x4c')]({'where':{'id':_0x46a49e[_0x9534('0x4d')]['id']}})[_0x9534('0x1e')](handleEntityNotFound(_0x2db031,null))[_0x9534('0x1e')](function(_0x37089c){if(_0x37089c){_0x46a49e[_0x9534('0x4b')][_0x9534('0x4f')]=_0x37089c['id'];return db['Interval'][_0x9534('0x43')](_0x46a49e[_0x9534('0x4b')]);}})['then'](respondWithResult(_0x2db031,null))[_0x9534('0x42')](handleError(_0x2db031,null));};exports[_0x9534('0x50')]=function(_0x20614f,_0x7ca3b0,_0xf4702b){var _0x2f4ce3={};var _0x645775={};var _0x5852bb;var _0x182f5f;return db['Interval']['findOne']({'where':{'id':_0x20614f[_0x9534('0x4d')]['id']}})[_0x9534('0x1e')](handleEntityNotFound(_0x7ca3b0,null))[_0x9534('0x1e')](function(_0x49ddfe){if(_0x49ddfe){_0x5852bb=_0x49ddfe;_0x645775[_0x9534('0x2c')]=_['keys'](db['Interval'][_0x9534('0x29')]);_0x645775[_0x9534('0x2e')]=_[_0x9534('0x2d')](_0x20614f[_0x9534('0x2e')]);_0x645775['filters']=_[_0x9534('0x2f')](_0x645775[_0x9534('0x2c')],_0x645775['query']);_0x2f4ce3[_0x9534('0x31')]=_['intersection'](_0x645775['model'],qs[_0x9534('0x30')](_0x20614f[_0x9534('0x2e')][_0x9534('0x30')]));_0x2f4ce3[_0x9534('0x31')]=_0x2f4ce3[_0x9534('0x31')]['length']?_0x2f4ce3[_0x9534('0x31')]:_0x645775['model'];_0x2f4ce3['order']=qs[_0x9534('0x37')](_0x20614f[_0x9534('0x2e')][_0x9534('0x37')]);_0x2f4ce3['where']=qs[_0x9534('0x38')](_['pick'](_0x20614f['query'],_0x645775[_0x9534('0x38')]));if(_0x20614f[_0x9534('0x2e')]['filter']){_0x2f4ce3[_0x9534('0x39')]=_['merge'](_0x2f4ce3['where'],{'$or':_[_0x9534('0x27')](_0x2f4ce3[_0x9534('0x31')],function(_0x3ecf82){var _0x35d8d2={};_0x35d8d2[_0x3ecf82]={'$like':'%'+_0x20614f[_0x9534('0x2e')]['filter']+'%'};return _0x35d8d2;})});}_0x2f4ce3=_[_0x9534('0x3c')]({},_0x2f4ce3,_0x20614f[_0x9534('0x3d')]);return _0x5852bb['getIntervals'](_0x2f4ce3);}})[_0x9534('0x1e')](function(_0x5ea41f){if(_0x5ea41f){_0x182f5f=_0x5ea41f['length'];if(!_0x20614f[_0x9534('0x2e')][_0x9534('0x33')]('nolimit')){_0x2f4ce3[_0x9534('0x35')]=qs[_0x9534('0x35')](_0x20614f[_0x9534('0x2e')]['limit']);_0x2f4ce3[_0x9534('0x18')]=qs['offset'](_0x20614f[_0x9534('0x2e')][_0x9534('0x18')]);}return _0x5852bb[_0x9534('0x50')](_0x2f4ce3);}})[_0x9534('0x1e')](function(_0x10a4ee){if(_0x10a4ee){return _0x10a4ee?{'count':_0x182f5f,'rows':_0x10a4ee}:null;}})[_0x9534('0x1e')](respondWithResult(_0x7ca3b0,null))[_0x9534('0x42')](handleError(_0x7ca3b0,null));};exports[_0x9534('0x51')]=function(_0x3b0af3,_0x3eb215,_0x4ab3f5){return db[_0x9534('0x28')][_0x9534('0x52')]({'where':{'id':_0x3b0af3[_0x9534('0x4d')]['id']}})[_0x9534('0x1e')](handleEntityNotFound(_0x3eb215,null))[_0x9534('0x1e')](function(_0x3397b5){if(_0x3397b5){return db[_0x9534('0x53')][_0x9534('0x54')](function(_0x13fc8b){return db[_0x9534('0x28')][_0x9534('0x20')]({'where':{'IntervalId':_0x3b0af3['params']['id']},'transaction':_0x13fc8b})[_0x9534('0x1e')](function(_0x447db1){var _0xbf115d=_['map'](_0x3b0af3[_0x9534('0x4b')],function(_0x1cd328){delete _0x1cd328['id'];_0x1cd328[_0x9534('0x4f')]=_0x3b0af3[_0x9534('0x4d')]['id'];return _0x1cd328;});return db[_0x9534('0x28')][_0x9534('0x55')](_0xbf115d,{'transaction':_0x13fc8b});});})[_0x9534('0x1e')](function(){return db[_0x9534('0x28')][_0x9534('0x3f')]({'where':{'IntervalId':_0x3b0af3[_0x9534('0x4d')]['id']}});});}})['then'](respondWithResult(_0x3eb215,null))[_0x9534('0x42')](handleError(_0x3eb215,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1a07999..e6f11d3 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 _0xf9bc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','define','Interval','tools_intervals','rewrite'];(function(_0x967148,_0x2a8497){var _0x14e78d=function(_0x57f2fb){while(--_0x57f2fb){_0x967148['push'](_0x967148['shift']());}};_0x14e78d(++_0x2a8497);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x3c4b09,_0x51264d){_0x3c4b09=_0x3c4b09-0x0;var _0x5318c4=_0xf9bc[_0x3c4b09];return _0x5318c4;};'use strict';var _=require('lodash');var util=require(_0xcf9b('0x0'));var logger=require(_0xcf9b('0x1'))(_0xcf9b('0x2'));var moment=require(_0xcf9b('0x3'));var BPromise=require(_0xcf9b('0x4'));var rp=require(_0xcf9b('0x5'));var fs=require('fs');var path=require(_0xcf9b('0x6'));var rimraf=require(_0xcf9b('0x7'));var config=require(_0xcf9b('0x8'));var attributes=require(_0xcf9b('0x9'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x3595ac,_0x2ba407){return _0x3595ac[_0xcf9b('0xa')](_0xcf9b('0xb'),attributes,{'tableName':_0xcf9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c0e77,_0x182df7){extensions[_0xcf9b('0xd')](_0x3595ac,_0x2c0e77);},'afterBulkCreate':function(_0x3447ef,_0x5aec9b,_0x415d49){_0x415d49();extensions[_0xcf9b('0xd')](_0x3595ac,_0x3447ef[0x0]);},'afterUpdate':function(_0x5563d1,_0x31a5df){extensions['rewrite'](_0x3595ac,_0x5563d1);},'afterDestroy':function(_0x546d46,_0x56e384){extensions[_0xcf9b('0xd')](_0x3595ac,_0x546d46);}}});}; \ No newline at end of file +var _0x6d4a=['path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x340fb6,_0x47f6cc){var _0x6b8f9=function(_0x44f2e2){while(--_0x44f2e2){_0x340fb6['push'](_0x340fb6['shift']());}};_0x6b8f9(++_0x47f6cc);}(_0x6d4a,0x117));var _0xa6d4=function(_0x5ee02d,_0x56fc77){_0x5ee02d=_0x5ee02d-0x0;var _0x321430=_0x6d4a[_0x5ee02d];return _0x321430;};'use strict';var _=require(_0xa6d4('0x0'));var util=require('util');var logger=require(_0xa6d4('0x1'))(_0xa6d4('0x2'));var moment=require(_0xa6d4('0x3'));var BPromise=require(_0xa6d4('0x4'));var rp=require(_0xa6d4('0x5'));var fs=require('fs');var path=require(_0xa6d4('0x6'));var rimraf=require(_0xa6d4('0x7'));var config=require(_0xa6d4('0x8'));var attributes=require(_0xa6d4('0x9'));var extensions=require(_0xa6d4('0xa'));module[_0xa6d4('0xb')]=function(_0xe6dda6,_0x354148){return _0xe6dda6[_0xa6d4('0xc')]('Interval',attributes,{'tableName':_0xa6d4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc6d920,_0x52739a){extensions[_0xa6d4('0xe')](_0xe6dda6,_0xc6d920);},'afterBulkCreate':function(_0x36af3a,_0x2bea15,_0xb76050){_0xb76050();extensions[_0xa6d4('0xe')](_0xe6dda6,_0x36af3a[0x0]);},'afterUpdate':function(_0x54edec,_0x340d84){extensions[_0xa6d4('0xe')](_0xe6dda6,_0x54edec);},'afterDestroy':function(_0x58d06f,_0x2c7f14){extensions[_0xa6d4('0xe')](_0xe6dda6,_0x58d06f);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 00b8092..9cc84f1 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 _0xebeb=['Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','find','ShowInterval','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Interval,\x20%s,\x20%s','debug'];(function(_0x2df335,_0x58d4da){var _0x89db1b=function(_0x44b699){while(--_0x44b699){_0x2df335['push'](_0x2df335['shift']());}};_0x89db1b(++_0x58d4da);}(_0xebeb,0x1e8));var _0xbebe=function(_0x407fbb,_0x53d187){_0x407fbb=_0x407fbb-0x0;var _0x4580be=_0xebeb[_0x407fbb];return _0x4580be;};'use strict';var _=require(_0xbebe('0x0'));var util=require(_0xbebe('0x1'));var moment=require(_0xbebe('0x2'));var BPromise=require(_0xbebe('0x3'));var rs=require(_0xbebe('0x4'));var fs=require('fs');var Redis=require(_0xbebe('0x5'));var db=require(_0xbebe('0x6'))['db'];var utils=require(_0xbebe('0x7'));var logger=require('../../config/logger')(_0xbebe('0x8'));var config=require(_0xbebe('0x9'));var jayson=require(_0xbebe('0xa'));var client=jayson[_0xbebe('0xb')][_0xbebe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x436d95,_0x579402,_0x208ae0){return new BPromise(function(_0x38f6c9,_0x22ecb8){return client['request'](_0x436d95,_0x208ae0)[_0xbebe('0xd')](function(_0x1b6d41){logger['info'](_0xbebe('0xe'),_0x579402,'request\x20sent');logger[_0xbebe('0xf')](_0xbebe('0x10'),_0x579402,_0xbebe('0x11'),JSON[_0xbebe('0x12')](_0x1b6d41));if(_0x1b6d41[_0xbebe('0x13')]){if(_0x1b6d41['error']['code']===0x1f4){logger[_0xbebe('0x13')](_0xbebe('0xe'),_0x579402,_0x1b6d41[_0xbebe('0x13')][_0xbebe('0x14')]);return _0x22ecb8(_0x1b6d41['error']['message']);}logger[_0xbebe('0x13')]('Interval,\x20%s,\x20%s',_0x579402,_0x1b6d41[_0xbebe('0x13')][_0xbebe('0x14')]);return _0x38f6c9(_0x1b6d41['error'][_0xbebe('0x14')]);}else{logger[_0xbebe('0x15')]('Interval,\x20%s,\x20%s',_0x579402,_0xbebe('0x11'));_0x38f6c9(_0x1b6d41[_0xbebe('0x16')]['message']);}})['catch'](function(_0x105e23){logger[_0xbebe('0x13')](_0xbebe('0xe'),_0x579402,_0x105e23);_0x22ecb8(_0x105e23);});});}exports[_0xbebe('0x17')]=function(_0x18e73d){var _0x1e9b2b=this;return new Promise(function(_0xb8cd22,_0x51c8d8){return db[_0xbebe('0x18')][_0xbebe('0x19')]({'raw':_0x18e73d['options']?_0x18e73d[_0xbebe('0x1a')][_0xbebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x18e73d[_0xbebe('0x1a')]?_0x18e73d[_0xbebe('0x1a')][_0xbebe('0x1c')]||null:null,'attributes':_0x18e73d[_0xbebe('0x1a')]?_0x18e73d['options'][_0xbebe('0x1d')]||null:null,'limit':_0x18e73d[_0xbebe('0x1a')]?_0x18e73d[_0xbebe('0x1a')]['limit']||null:null,'include':_0x18e73d['options']?_0x18e73d[_0xbebe('0x1a')][_0xbebe('0x1e')]?_[_0xbebe('0x1f')](_0x18e73d[_0xbebe('0x1a')][_0xbebe('0x1e')],function(_0x30588c){return{'model':db[_0x30588c[_0xbebe('0x20')]],'as':_0x30588c['as'],'attributes':_0x30588c['attributes'],'include':_0x30588c[_0xbebe('0x1e')]?_[_0xbebe('0x1f')](_0x30588c[_0xbebe('0x1e')],function(_0x37b673){return{'model':db[_0x37b673['model']],'as':_0x37b673['as'],'attributes':_0x37b673[_0xbebe('0x1d')],'include':_0x37b673[_0xbebe('0x1e')]?_['map'](_0x37b673[_0xbebe('0x1e')],function(_0x4d8057){return{'model':db[_0x4d8057['model']],'as':_0x4d8057['as'],'attributes':_0x4d8057['attributes']};}):[]};}):[]};}):[]:[]})[_0xbebe('0xd')](function(_0x25e14c){logger[_0xbebe('0x15')]('GetInterval',_0x18e73d);logger[_0xbebe('0xf')](_0xbebe('0x17'),_0x18e73d,JSON[_0xbebe('0x12')](_0x25e14c));_0xb8cd22(_0x25e14c);})['catch'](function(_0x52803b){logger[_0xbebe('0x13')](_0xbebe('0x17'),_0x52803b['message'],_0x18e73d);_0x51c8d8(_0x1e9b2b['error'](0x1f4,_0x52803b['message']));});});};exports['ShowInterval']=function(_0x4f5604){var _0x4cbd8f=this;return new Promise(function(_0x1819d5,_0x3e78dd){return db['Interval'][_0xbebe('0x21')]({'raw':_0x4f5604[_0xbebe('0x1a')]?_0x4f5604[_0xbebe('0x1a')][_0xbebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f5604[_0xbebe('0x1a')]?_0x4f5604[_0xbebe('0x1a')][_0xbebe('0x1c')]||null:null,'attributes':_0x4f5604['options']?_0x4f5604[_0xbebe('0x1a')][_0xbebe('0x1d')]||null:null,'include':_0x4f5604[_0xbebe('0x1a')]?_0x4f5604[_0xbebe('0x1a')][_0xbebe('0x1e')]?_[_0xbebe('0x1f')](_0x4f5604['options'][_0xbebe('0x1e')],function(_0x12dcbf){return{'model':db[_0x12dcbf[_0xbebe('0x20')]],'as':_0x12dcbf['as'],'attributes':_0x12dcbf['attributes'],'include':_0x12dcbf[_0xbebe('0x1e')]?_[_0xbebe('0x1f')](_0x12dcbf[_0xbebe('0x1e')],function(_0x15c59f){return{'model':db[_0x15c59f[_0xbebe('0x20')]],'as':_0x15c59f['as'],'attributes':_0x15c59f[_0xbebe('0x1d')],'include':_0x15c59f['include']?_[_0xbebe('0x1f')](_0x15c59f[_0xbebe('0x1e')],function(_0x1d6df2){return{'model':db[_0x1d6df2['model']],'as':_0x1d6df2['as'],'attributes':_0x1d6df2[_0xbebe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbebe('0xd')](function(_0x3bb879){logger[_0xbebe('0x15')](_0xbebe('0x22'),_0x4f5604);logger[_0xbebe('0xf')](_0xbebe('0x22'),_0x4f5604,JSON[_0xbebe('0x12')](_0x3bb879));_0x1819d5(_0x3bb879);})[_0xbebe('0x23')](function(_0x5ddf5c){logger[_0xbebe('0x13')](_0xbebe('0x22'),_0x5ddf5c[_0xbebe('0x14')],_0x4f5604);_0x3e78dd(_0x4cbd8f[_0xbebe('0x13')](0x1f4,_0x5ddf5c[_0xbebe('0x14')]));});});}; \ No newline at end of file +var _0x2114=['error','message','catch','GetInterval','Interval','findAll','options','where','limit','include','map','attributes','model','find','raw','ShowInterval','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x315b61,_0x4bb11e){var _0x3521e8=function(_0x5e6389){while(--_0x5e6389){_0x315b61['push'](_0x315b61['shift']());}};_0x3521e8(++_0x4bb11e);}(_0x2114,0x191));var _0x4211=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x2114[_0x2a18b7];return _0x45e74e;};'use strict';var _=require('lodash');var util=require(_0x4211('0x0'));var moment=require(_0x4211('0x1'));var BPromise=require('bluebird');var rs=require(_0x4211('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4211('0x3'))['db'];var utils=require(_0x4211('0x4'));var logger=require(_0x4211('0x5'))(_0x4211('0x6'));var config=require(_0x4211('0x7'));var jayson=require(_0x4211('0x8'));var client=jayson[_0x4211('0x9')][_0x4211('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x326e5a,_0x20a343,_0x10ce34){return new BPromise(function(_0x46ca18,_0x3c84a4){return client[_0x4211('0xb')](_0x326e5a,_0x10ce34)[_0x4211('0xc')](function(_0x308b60){logger[_0x4211('0xd')](_0x4211('0xe'),_0x20a343,_0x4211('0xf'));logger[_0x4211('0x10')](_0x4211('0x11'),_0x20a343,_0x4211('0xf'),JSON[_0x4211('0x12')](_0x308b60));if(_0x308b60[_0x4211('0x13')]){if(_0x308b60[_0x4211('0x13')]['code']===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x20a343,_0x308b60['error']['message']);return _0x3c84a4(_0x308b60[_0x4211('0x13')][_0x4211('0x14')]);}logger[_0x4211('0x13')](_0x4211('0xe'),_0x20a343,_0x308b60[_0x4211('0x13')][_0x4211('0x14')]);return _0x46ca18(_0x308b60[_0x4211('0x13')][_0x4211('0x14')]);}else{logger[_0x4211('0xd')]('Interval,\x20%s,\x20%s',_0x20a343,'request\x20sent');_0x46ca18(_0x308b60['result'][_0x4211('0x14')]);}})[_0x4211('0x15')](function(_0x1800e6){logger[_0x4211('0x13')]('Interval,\x20%s,\x20%s',_0x20a343,_0x1800e6);_0x3c84a4(_0x1800e6);});});}exports[_0x4211('0x16')]=function(_0x2e48c1){var _0x4ebc1d=this;return new Promise(function(_0x3470b0,_0x56eb44){return db[_0x4211('0x17')][_0x4211('0x18')]({'raw':_0x2e48c1[_0x4211('0x19')]?_0x2e48c1[_0x4211('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2e48c1[_0x4211('0x19')]?_0x2e48c1[_0x4211('0x19')][_0x4211('0x1a')]||null:null,'attributes':_0x2e48c1['options']?_0x2e48c1[_0x4211('0x19')]['attributes']||null:null,'limit':_0x2e48c1['options']?_0x2e48c1['options'][_0x4211('0x1b')]||null:null,'include':_0x2e48c1[_0x4211('0x19')]?_0x2e48c1[_0x4211('0x19')][_0x4211('0x1c')]?_[_0x4211('0x1d')](_0x2e48c1['options'][_0x4211('0x1c')],function(_0x3a8420){return{'model':db[_0x3a8420['model']],'as':_0x3a8420['as'],'attributes':_0x3a8420['attributes'],'include':_0x3a8420[_0x4211('0x1c')]?_[_0x4211('0x1d')](_0x3a8420[_0x4211('0x1c')],function(_0x567732){return{'model':db[_0x567732['model']],'as':_0x567732['as'],'attributes':_0x567732[_0x4211('0x1e')],'include':_0x567732[_0x4211('0x1c')]?_[_0x4211('0x1d')](_0x567732[_0x4211('0x1c')],function(_0x2eb403){return{'model':db[_0x2eb403[_0x4211('0x1f')]],'as':_0x2eb403['as'],'attributes':_0x2eb403[_0x4211('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4211('0xc')](function(_0x3e099a){logger[_0x4211('0xd')](_0x4211('0x16'),_0x2e48c1);logger[_0x4211('0x10')]('GetInterval',_0x2e48c1,JSON['stringify'](_0x3e099a));_0x3470b0(_0x3e099a);})[_0x4211('0x15')](function(_0x29b19e){logger[_0x4211('0x13')](_0x4211('0x16'),_0x29b19e[_0x4211('0x14')],_0x2e48c1);_0x56eb44(_0x4ebc1d['error'](0x1f4,_0x29b19e['message']));});});};exports['ShowInterval']=function(_0x433426){var _0x29ce01=this;return new Promise(function(_0x4b5ef2,_0xeb6970){return db['Interval'][_0x4211('0x20')]({'raw':_0x433426['options']?_0x433426[_0x4211('0x19')][_0x4211('0x21')]===undefined?!![]:![]:!![],'where':_0x433426[_0x4211('0x19')]?_0x433426[_0x4211('0x19')][_0x4211('0x1a')]||null:null,'attributes':_0x433426[_0x4211('0x19')]?_0x433426['options']['attributes']||null:null,'include':_0x433426[_0x4211('0x19')]?_0x433426[_0x4211('0x19')][_0x4211('0x1c')]?_['map'](_0x433426[_0x4211('0x19')][_0x4211('0x1c')],function(_0x578b79){return{'model':db[_0x578b79[_0x4211('0x1f')]],'as':_0x578b79['as'],'attributes':_0x578b79['attributes'],'include':_0x578b79[_0x4211('0x1c')]?_[_0x4211('0x1d')](_0x578b79['include'],function(_0x173da8){return{'model':db[_0x173da8[_0x4211('0x1f')]],'as':_0x173da8['as'],'attributes':_0x173da8[_0x4211('0x1e')],'include':_0x173da8['include']?_[_0x4211('0x1d')](_0x173da8[_0x4211('0x1c')],function(_0x150106){return{'model':db[_0x150106[_0x4211('0x1f')]],'as':_0x150106['as'],'attributes':_0x150106[_0x4211('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4211('0xc')](function(_0x2ad215){logger['info'](_0x4211('0x22'),_0x433426);logger[_0x4211('0x10')](_0x4211('0x22'),_0x433426,JSON[_0x4211('0x12')](_0x2ad215));_0x4b5ef2(_0x2ad215);})[_0x4211('0x15')](function(_0x3e590d){logger[_0x4211('0x13')](_0x4211('0x22'),_0x3e590d[_0x4211('0x14')],_0x433426);_0xeb6970(_0x29ce01['error'](0x1f4,_0x3e590d[_0x4211('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 092c546..c0571ab 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 _0x5139=['express','Router','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x1ead91,_0x2d1bc2){var _0x33a8b3=function(_0x59b406){while(--_0x59b406){_0x1ead91['push'](_0x1ead91['shift']());}};_0x33a8b3(++_0x2d1bc2);}(_0x5139,0x8c));var _0x9513=function(_0x2bf903,_0x30b955){_0x2bf903=_0x2bf903-0x0;var _0x2d6fa1=_0x5139[_0x2bf903];return _0x2d6fa1;};'use strict';var express=require(_0x9513('0x0'));var router=express[_0x9513('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9513('0x2'));router[_0x9513('0x3')]('/',auth[_0x9513('0x4')](),controller[_0x9513('0x5')]);module[_0x9513('0x6')]=router; \ No newline at end of file +var _0xb5dc=['send','exports','express','Router','./jira.controller','post','isAuthenticated'];(function(_0x4e3e84,_0x2462dc){var _0x1b8acf=function(_0x239b12){while(--_0x239b12){_0x4e3e84['push'](_0x4e3e84['shift']());}};_0x1b8acf(++_0x2462dc);}(_0xb5dc,0x1c2));var _0xcb5d=function(_0x3b6d96,_0x5d3241){_0x3b6d96=_0x3b6d96-0x0;var _0x1e6b1c=_0xb5dc[_0x3b6d96];return _0x1e6b1c;};'use strict';var express=require(_0xcb5d('0x0'));var router=express[_0xcb5d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xcb5d('0x2'));router[_0xcb5d('0x3')]('/',auth[_0xcb5d('0x4')](),controller[_0xcb5d('0x5')]);module[_0xcb5d('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6fd9800..e7bec39 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 _0xca87=['utf8','data','end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','api','support','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11501','oldToken','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','request','setEncoding'];(function(_0x35980a,_0x45bd42){var _0x1c068f=function(_0x425dc0){while(--_0x425dc0){_0x35980a['push'](_0x35980a['shift']());}};_0x1c068f(++_0x45bd42);}(_0xca87,0x121));var _0x7ca8=function(_0x1ecb2b,_0x5d2346){_0x1ecb2b=_0x1ecb2b-0x0;var _0xafdb79=_0xca87[_0x1ecb2b];return _0xafdb79;};'use strict';var BPromise=require(_0x7ca8('0x0'));var https=require(_0x7ca8('0x1'));var logger=require('../../config/logger')(_0x7ca8('0x2'));var USERNAME=_0x7ca8('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x1b5a7e,_0x1b7195){var _0x5dce41={'fields':{'project':{'key':_0x1b5a7e[_0x7ca8('0x4')]||_0x7ca8('0x5')},'summary':(_0x1b5a7e['summary']||_0x7ca8('0x6'))+_0x7ca8('0x7')+_0x1b5a7e['ip'],'description':_0x1b5a7e[_0x7ca8('0x8')]||JSON[_0x7ca8('0x9')](_0x1b5a7e),'issuetype':{'name':_0x1b5a7e[_0x7ca8('0xa')]||'Bug'}}};_0x5dce41['fields']['customfield_11500']=_0x1b5a7e['email'];_0x5dce41[_0x7ca8('0xb')][_0x7ca8('0xc')]=_0x1b5a7e[_0x7ca8('0xd')];_0x5dce41[_0x7ca8('0xb')]['customfield_11502']=_0x1b5a7e[_0x7ca8('0xe')];_0x5dce41[_0x7ca8('0xb')][_0x7ca8('0xf')]=_0x1b5a7e['name'];_0x5dce41['fields'][_0x7ca8('0x10')]=_0x1b5a7e[_0x7ca8('0x11')];_0x5dce41[_0x7ca8('0xb')][_0x7ca8('0x12')]=_0x1b5a7e['ip'];var _0x72f4e={'host':_0x7ca8('0x13'),'port':0x1bb,'path':_0x7ca8('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x7ca8('0x15'),'Authorization':_0x7ca8('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x7ca8('0x17'))}};var _0xf48999=JSON[_0x7ca8('0x9')](_0x5dce41);var _0x117c7b=https[_0x7ca8('0x18')](_0x72f4e,function(_0x4e6595){_0x4e6595[_0x7ca8('0x19')](_0x7ca8('0x1a'));var _0x5273d5='';_0x4e6595['on'](_0x7ca8('0x1b'),function(_0x2c2ded){_0x5273d5+=_0x2c2ded;});_0x4e6595['on'](_0x7ca8('0x1c'),function(){if(_0x1b7195){return _0x1b7195['status'](_0x4e6595[_0x7ca8('0x1d')])[_0x7ca8('0x1e')](JSON[_0x7ca8('0x1f')](_0x5273d5));}});});_0x117c7b['on'](_0x7ca8('0x20'),function(_0x3e6258){if(_0x1b7195){return _0x1b7195[_0x7ca8('0x21')](0x1f4)['json']({'errors':[{'message':_0x7ca8('0x22'),'type':_0x7ca8('0x23')}]});}});_0x117c7b[_0x7ca8('0x24')](_0xf48999);_0x117c7b[_0x7ca8('0x1c')]();}exports[_0x7ca8('0x25')]=openIssue;exports[_0x7ca8('0x26')]=function(_0x22fe56,_0x207228){_0x22fe56['body']['ip']=_0x22fe56[_0x7ca8('0x27')][_0x7ca8('0x28')]||_0x22fe56[_0x7ca8('0x29')][_0x7ca8('0x2a')]||_0x22fe56[_0x7ca8('0x2b')]['remoteAddress']||_0x22fe56['connection'][_0x7ca8('0x2b')]['remoteAddress'];return openIssue(_0x22fe56[_0x7ca8('0x2c')],_0x207228);}; \ No newline at end of file +var _0x4e3c=['status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','socket','remoteAddress','body','bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','utf8','data','end'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4e3c,0x98));var _0xc4e3=function(_0x34986b,_0x56fb4a){_0x34986b=_0x34986b-0x0;var _0x28a0d1=_0x4e3c[_0x34986b];return _0x28a0d1;};'use strict';var BPromise=require(_0xc4e3('0x0'));var https=require(_0xc4e3('0x1'));var logger=require(_0xc4e3('0x2'))(_0xc4e3('0x3'));var USERNAME=_0xc4e3('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0xa65497,_0x30aa1c){var _0x21cc06={'fields':{'project':{'key':_0xa65497[_0xc4e3('0x5')]||_0xc4e3('0x6')},'summary':(_0xa65497[_0xc4e3('0x7')]||'Report')+_0xc4e3('0x8')+_0xa65497['ip'],'description':_0xa65497[_0xc4e3('0x9')]||JSON[_0xc4e3('0xa')](_0xa65497),'issuetype':{'name':_0xa65497['issuetype']||_0xc4e3('0xb')}}};_0x21cc06[_0xc4e3('0xc')][_0xc4e3('0xd')]=_0xa65497[_0xc4e3('0xe')];_0x21cc06[_0xc4e3('0xc')]['customfield_11501']=_0xa65497[_0xc4e3('0xf')];_0x21cc06['fields'][_0xc4e3('0x10')]=_0xa65497['newToken'];_0x21cc06[_0xc4e3('0xc')][_0xc4e3('0x11')]=_0xa65497[_0xc4e3('0x12')];_0x21cc06[_0xc4e3('0xc')][_0xc4e3('0x13')]=_0xa65497[_0xc4e3('0x14')];_0x21cc06[_0xc4e3('0xc')][_0xc4e3('0x15')]=_0xa65497['ip'];var _0x2a0d09={'host':_0xc4e3('0x16'),'port':0x1bb,'path':_0xc4e3('0x17'),'method':_0xc4e3('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xc4e3('0x19'),'Authorization':_0xc4e3('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xc4e3('0x1b')]('base64')}};var _0x5a563e=JSON['stringify'](_0x21cc06);var _0x5157df=https[_0xc4e3('0x1c')](_0x2a0d09,function(_0x2e9715){_0x2e9715['setEncoding'](_0xc4e3('0x1d'));var _0x43269f='';_0x2e9715['on'](_0xc4e3('0x1e'),function(_0x10c7b6){_0x43269f+=_0x10c7b6;});_0x2e9715['on'](_0xc4e3('0x1f'),function(){if(_0x30aa1c){return _0x30aa1c[_0xc4e3('0x20')](_0x2e9715['statusCode'])[_0xc4e3('0x21')](JSON[_0xc4e3('0x22')](_0x43269f));}});});_0x5157df['on']('error',function(_0x3cfb5e){if(_0x30aa1c){return _0x30aa1c[_0xc4e3('0x20')](0x1f4)['json']({'errors':[{'message':_0xc4e3('0x23'),'type':_0xc4e3('0x24')}]});}});_0x5157df[_0xc4e3('0x25')](_0x5a563e);_0x5157df[_0xc4e3('0x1f')]();}exports[_0xc4e3('0x26')]=openIssue;exports[_0xc4e3('0x27')]=function(_0x1bbdc6,_0x15fbaa){_0x1bbdc6['body']['ip']=_0x1bbdc6[_0xc4e3('0x28')][_0xc4e3('0x29')]||_0x1bbdc6[_0xc4e3('0x2a')]['remoteAddress']||_0x1bbdc6[_0xc4e3('0x2b')][_0xc4e3('0x2c')]||_0x1bbdc6['connection'][_0xc4e3('0x2b')][_0xc4e3('0x2c')];return openIssue(_0x1bbdc6[_0xc4e3('0x2d')],_0x15fbaa);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 0b50bd6..495401a 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 _0x98dd=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x564064,_0x3af5f8){var _0x319322=function(_0x3c6637){while(--_0x3c6637){_0x564064['push'](_0x564064['shift']());}};_0x319322(++_0x3af5f8);}(_0x98dd,0xa9));var _0xd98d=function(_0xd82416,_0x788ce0){_0xd82416=_0xd82416-0x0;var _0xd24347=_0x98dd[_0xd82416];return _0xd24347;};'use strict';var multer=require(_0xd98d('0x0'));var util=require(_0xd98d('0x1'));var path=require(_0xd98d('0x2'));var timeout=require(_0xd98d('0x3'));var express=require(_0xd98d('0x4'));var router=express[_0xd98d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd98d('0x6'));var config=require(_0xd98d('0x7'));var controller=require(_0xd98d('0x8'));router[_0xd98d('0x9')]('/',auth[_0xd98d('0xa')](),controller[_0xd98d('0xb')]);router[_0xd98d('0x9')](_0xd98d('0xc'),auth[_0xd98d('0xa')](),controller[_0xd98d('0xd')]);router[_0xd98d('0x9')](_0xd98d('0xe'),auth[_0xd98d('0xa')](),controller[_0xd98d('0xf')]);router[_0xd98d('0x10')]('/',auth[_0xd98d('0xa')](),controller[_0xd98d('0x11')]);router[_0xd98d('0x12')]('/:id',auth[_0xd98d('0xa')](),controller[_0xd98d('0x13')]);router[_0xd98d('0x14')](_0xd98d('0xe'),auth[_0xd98d('0xa')](),controller[_0xd98d('0x15')]);module[_0xd98d('0x16')]=router; \ No newline at end of file +var _0x6837=['express','Router','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0x6837,0xf8));var _0x7683=function(_0x4aaaeb,_0x1d0819){_0x4aaaeb=_0x4aaaeb-0x0;var _0x521328=_0x6837[_0x4aaaeb];return _0x521328;};'use strict';var multer=require(_0x7683('0x0'));var util=require(_0x7683('0x1'));var path=require(_0x7683('0x2'));var timeout=require(_0x7683('0x3'));var express=require(_0x7683('0x4'));var router=express[_0x7683('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7683('0x6'));var config=require('../../config/environment');var controller=require(_0x7683('0x7'));router[_0x7683('0x8')]('/',auth[_0x7683('0x9')](),controller[_0x7683('0xa')]);router[_0x7683('0x8')](_0x7683('0xb'),auth[_0x7683('0x9')](),controller[_0x7683('0xc')]);router[_0x7683('0x8')](_0x7683('0xd'),auth[_0x7683('0x9')](),controller[_0x7683('0xe')]);router[_0x7683('0xf')]('/',auth[_0x7683('0x9')](),controller[_0x7683('0x10')]);router[_0x7683('0x11')](_0x7683('0xd'),auth[_0x7683('0x9')](),controller['update']);router[_0x7683('0x12')](_0x7683('0xd'),auth[_0x7683('0x9')](),controller[_0x7683('0x13')]);module[_0x7683('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5b66a1f..b5e152d 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 _0x57be=['STRING','TEXT','long','exports'];(function(_0x532378,_0x7501ca){var _0x311568=function(_0x2a4cb7){while(--_0x2a4cb7){_0x532378['push'](_0x532378['shift']());}};_0x311568(++_0x7501ca);}(_0x57be,0x67));var _0xe57b=function(_0x204e65,_0x4309fd){_0x204e65=_0x204e65-0x0;var _0x2057d8=_0x57be[_0x204e65];return _0x2057d8;};'use strict';var Sequelize=require('sequelize');module[_0xe57b('0x0')]={'question':{'type':Sequelize[_0xe57b('0x1')]},'answer':{'type':Sequelize[_0xe57b('0x2')](_0xe57b('0x3'))},'membername':{'type':Sequelize[_0xe57b('0x1')]},'projectname':{'type':Sequelize[_0xe57b('0x1')]},'queue':{'type':Sequelize[_0xe57b('0x1')]},'uniqueid':{'type':Sequelize[_0xe57b('0x1')]},'calleridname':{'type':Sequelize[_0xe57b('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xe57b('0x1')]}}; \ No newline at end of file +var _0x82ea=['TEXT','long','sequelize','STRING'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x82ea,0x10a));var _0xa82e=function(_0x35666b,_0xa44069){_0x35666b=_0x35666b-0x0;var _0x204cdd=_0x82ea[_0x35666b];return _0x204cdd;};'use strict';var Sequelize=require(_0xa82e('0x0'));module['exports']={'question':{'type':Sequelize[_0xa82e('0x1')]},'answer':{'type':Sequelize[_0xa82e('0x2')](_0xa82e('0x3'))},'membername':{'type':Sequelize[_0xa82e('0x1')]},'projectname':{'type':Sequelize[_0xa82e('0x1')]},'queue':{'type':Sequelize[_0xa82e('0x1')]},'uniqueid':{'type':Sequelize[_0xa82e('0x1')]},'calleridname':{'type':Sequelize[_0xa82e('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index ee9cf64..ab30e26 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 _0x52b7=['sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','keys','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x52b7,0x13a));var _0x752b=function(_0x81eb80,_0x2743d7){_0x81eb80=_0x81eb80-0x0;var _0x290cce=_0x52b7[_0x81eb80];return _0x290cce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x752b('0x0'));var rimraf=require(_0x752b('0x1'));var zipdir=require(_0x752b('0x2'));var jsonpatch=require(_0x752b('0x3'));var rp=require(_0x752b('0x4'));var moment=require(_0x752b('0x5'));var BPromise=require(_0x752b('0x6'));var Mustache=require(_0x752b('0x7'));var util=require(_0x752b('0x8'));var path=require(_0x752b('0x9'));var sox=require(_0x752b('0xa'));var csv=require(_0x752b('0xb'));var ejs=require(_0x752b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x752b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x752b('0xe'));var toCsv=require(_0x752b('0xb'));var querystring=require(_0x752b('0xf'));var Papa=require('papaparse');var Redis=require(_0x752b('0x10'));var authService=require(_0x752b('0x11'));var qs=require(_0x752b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x752b('0x13'));var logger=require(_0x752b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x752b('0x15'));var db=require(_0x752b('0x16'))['db'];function respondWithStatusCode(_0x4f7e65,_0x4e04dc){_0x4e04dc=_0x4e04dc||0xcc;return function(_0x52d092){if(_0x52d092){return _0x4f7e65['sendStatus'](_0x4e04dc);}return _0x4f7e65['status'](_0x4e04dc)[_0x752b('0x17')]();};}function respondWithResult(_0x229345,_0x373496){_0x373496=_0x373496||0xc8;return function(_0x4380ae){if(_0x4380ae){return _0x229345['status'](_0x373496)['json'](_0x4380ae);}};}function respondWithFilteredResult(_0x1a3d78,_0x315787){return function(_0x277592){if(_0x277592){var _0x4bbca0=_0x277592[_0x752b('0x18')],_0x3b3cd8=_0x315787[_0x752b('0x19')],_0x729f33=_0x315787[_0x752b('0x19')]+_0x315787[_0x752b('0x1a')],_0x269786;if(_0x729f33>=_0x4bbca0){_0x729f33=_0x4bbca0;_0x269786=0xc8;}else{_0x269786=0xce;}_0x1a3d78[_0x752b('0x1b')](_0x269786);return _0x1a3d78[_0x752b('0x1c')](_0x752b('0x1d'),_0x3b3cd8+'-'+_0x729f33+'/'+_0x4bbca0)[_0x752b('0x1e')](_0x277592);}return null;};}function patchUpdates(_0x57359d){return function(_0x3bf31b){try{jsonpatch['apply'](_0x3bf31b,_0x57359d,!![]);}catch(_0x3f8920){return BPromise[_0x752b('0x1f')](_0x3f8920);}return _0x3bf31b[_0x752b('0x20')]();};}function saveUpdates(_0xcf0835,_0x2a7672){return function(_0x4fc03e){if(_0x4fc03e){return _0x4fc03e[_0x752b('0x21')](_0xcf0835)[_0x752b('0x22')](function(_0x348bfc){return _0x348bfc;});}return null;};}function removeEntity(_0x2d91f8,_0x48abd8){return function(_0x118b10){if(_0x118b10){return _0x118b10[_0x752b('0x23')]()[_0x752b('0x22')](function(){_0x2d91f8[_0x752b('0x1b')](0xcc)[_0x752b('0x17')]();});}};}function handleEntityNotFound(_0x35d6e8,_0x451047){return function(_0x4c8330){if(!_0x4c8330){_0x35d6e8[_0x752b('0x24')](0x194);}return _0x4c8330;};}function handleError(_0x4862ee,_0x549ac1){_0x549ac1=_0x549ac1||0x1f4;return function(_0x11aa6e){logger[_0x752b('0x25')](_0x11aa6e[_0x752b('0x26')]);if(_0x11aa6e[_0x752b('0x27')]){delete _0x11aa6e[_0x752b('0x27')];}_0x4862ee[_0x752b('0x1b')](_0x549ac1)[_0x752b('0x28')](_0x11aa6e);};}exports[_0x752b('0x29')]=function(_0x461834,_0x46e79d){var _0x2c83e3={},_0x2918bb={},_0x6a3681={'count':0x0,'rows':[]};var _0x3adc8f=_[_0x752b('0x2a')](db[_0x752b('0x2b')][_0x752b('0x2c')],function(_0x5e5502){return{'name':_0x5e5502[_0x752b('0x2d')],'type':_0x5e5502[_0x752b('0x2e')][_0x752b('0x2f')]};});_0x2918bb[_0x752b('0x30')]=_[_0x752b('0x2a')](_0x3adc8f,_0x752b('0x27'));_0x2918bb['query']=_['keys'](_0x461834[_0x752b('0x31')]);_0x2918bb[_0x752b('0x32')]=_[_0x752b('0x33')](_0x2918bb['model'],_0x2918bb[_0x752b('0x31')]);_0x2c83e3[_0x752b('0x34')]=_[_0x752b('0x33')](_0x2918bb[_0x752b('0x30')],qs[_0x752b('0x35')](_0x461834['query'][_0x752b('0x35')]));_0x2c83e3['attributes']=_0x2c83e3[_0x752b('0x34')][_0x752b('0x36')]?_0x2c83e3[_0x752b('0x34')]:_0x2918bb['model'];if(!_0x461834[_0x752b('0x31')][_0x752b('0x37')]('nolimit')){_0x2c83e3[_0x752b('0x1a')]=qs['limit'](_0x461834[_0x752b('0x31')][_0x752b('0x1a')]);_0x2c83e3[_0x752b('0x19')]=qs['offset'](_0x461834['query']['offset']);}_0x2c83e3['order']=qs[_0x752b('0x38')](_0x461834[_0x752b('0x31')][_0x752b('0x38')]);_0x2c83e3[_0x752b('0x39')]=qs[_0x752b('0x32')](_[_0x752b('0x3a')](_0x461834['query'],_0x2918bb['filters']),_0x3adc8f);if(_0x461834[_0x752b('0x31')][_0x752b('0x3b')]){_0x2c83e3[_0x752b('0x39')]=_['merge'](_0x2c83e3[_0x752b('0x39')],{'$or':_['map'](_0x3adc8f,function(_0x1714e6){if(_0x1714e6[_0x752b('0x2e')]!==_0x752b('0x3c')){var _0x1f71a7={};_0x1f71a7[_0x1714e6[_0x752b('0x27')]]={'$like':'%'+_0x461834[_0x752b('0x31')][_0x752b('0x3b')]+'%'};return _0x1f71a7;}})});}_0x2c83e3=_[_0x752b('0x3d')]({},_0x2c83e3,_0x461834[_0x752b('0x3e')]);var _0x5f3d85={'where':_0x2c83e3[_0x752b('0x39')]};return db[_0x752b('0x2b')][_0x752b('0x18')](_0x5f3d85)[_0x752b('0x22')](function(_0x182711){_0x6a3681['count']=_0x182711;if(_0x461834[_0x752b('0x31')][_0x752b('0x3f')]){_0x2c83e3['include']=[{'all':!![]}];}return db[_0x752b('0x2b')][_0x752b('0x40')](_0x2c83e3);})[_0x752b('0x22')](function(_0x305816){_0x6a3681[_0x752b('0x41')]=_0x305816;return _0x6a3681;})[_0x752b('0x22')](respondWithFilteredResult(_0x46e79d,_0x2c83e3))['catch'](handleError(_0x46e79d,null));};exports['show']=function(_0xaae0ff,_0x169ff6){var _0xad180d={'raw':!![],'where':{'id':_0xaae0ff[_0x752b('0x42')]['id']}},_0x3b27bd={};_0x3b27bd[_0x752b('0x30')]=_[_0x752b('0x43')](db[_0x752b('0x2b')][_0x752b('0x2c')]);_0x3b27bd[_0x752b('0x31')]=_[_0x752b('0x43')](_0xaae0ff[_0x752b('0x31')]);_0x3b27bd['filters']=_[_0x752b('0x33')](_0x3b27bd[_0x752b('0x30')],_0x3b27bd[_0x752b('0x31')]);_0xad180d['attributes']=_['intersection'](_0x3b27bd['model'],qs[_0x752b('0x35')](_0xaae0ff['query'][_0x752b('0x35')]));_0xad180d[_0x752b('0x34')]=_0xad180d[_0x752b('0x34')][_0x752b('0x36')]?_0xad180d[_0x752b('0x34')]:_0x3b27bd[_0x752b('0x30')];if(_0xaae0ff[_0x752b('0x31')][_0x752b('0x3f')]){_0xad180d[_0x752b('0x44')]=[{'all':!![]}];}_0xad180d=_['merge']({},_0xad180d,_0xaae0ff[_0x752b('0x3e')]);return db[_0x752b('0x2b')][_0x752b('0x45')](_0xad180d)[_0x752b('0x22')](handleEntityNotFound(_0x169ff6,null))[_0x752b('0x22')](respondWithResult(_0x169ff6,null))[_0x752b('0x46')](handleError(_0x169ff6,null));};exports[_0x752b('0x47')]=function(_0x13554c,_0x531c72){return db[_0x752b('0x2b')][_0x752b('0x47')](_0x13554c[_0x752b('0x48')],{})[_0x752b('0x22')](respondWithResult(_0x531c72,0xc9))[_0x752b('0x46')](handleError(_0x531c72,null));};exports[_0x752b('0x21')]=function(_0x36bd12,_0x4c9c42){if(_0x36bd12['body']['id']){delete _0x36bd12[_0x752b('0x48')]['id'];}return db[_0x752b('0x2b')][_0x752b('0x45')]({'where':{'id':_0x36bd12[_0x752b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c9c42,null))[_0x752b('0x22')](saveUpdates(_0x36bd12[_0x752b('0x48')],null))[_0x752b('0x22')](respondWithResult(_0x4c9c42,null))['catch'](handleError(_0x4c9c42,null));};exports['destroy']=function(_0xd5ca13,_0x34effa){return db[_0x752b('0x2b')][_0x752b('0x45')]({'where':{'id':_0xd5ca13['params']['id']}})[_0x752b('0x22')](handleEntityNotFound(_0x34effa,null))[_0x752b('0x22')](removeEntity(_0x34effa,null))[_0x752b('0x46')](handleError(_0x34effa,null));};exports[_0x752b('0x49')]=function(_0x48b52b,_0x583fb8){return db[_0x752b('0x2b')]['describe']()[_0x752b('0x22')](respondWithResult(_0x583fb8,null))[_0x752b('0x46')](handleError(_0x583fb8,null));}; \ No newline at end of file +var _0x4e48=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','status','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x27a24a,_0x4b5d8f){var _0x3ec224=function(_0x270edf){while(--_0x270edf){_0x27a24a['push'](_0x27a24a['shift']());}};_0x3ec224(++_0x4b5d8f);}(_0x4e48,0xd6));var _0x84e4=function(_0x3124f7,_0x5db6e7){_0x3124f7=_0x3124f7-0x0;var _0x35903a=_0x4e48[_0x3124f7];return _0x35903a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x84e4('0x0'));var jsonpatch=require(_0x84e4('0x1'));var rp=require(_0x84e4('0x2'));var moment=require(_0x84e4('0x3'));var BPromise=require(_0x84e4('0x4'));var Mustache=require(_0x84e4('0x5'));var util=require(_0x84e4('0x6'));var path=require(_0x84e4('0x7'));var sox=require(_0x84e4('0x8'));var csv=require(_0x84e4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x84e4('0xa'));var squel=require(_0x84e4('0xb'));var crypto=require(_0x84e4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x84e4('0xd'));var toCsv=require(_0x84e4('0x9'));var querystring=require(_0x84e4('0xe'));var Papa=require(_0x84e4('0xf'));var Redis=require(_0x84e4('0x10'));var authService=require(_0x84e4('0x11'));var qs=require(_0x84e4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84e4('0x13'));var logger=require(_0x84e4('0x14'))(_0x84e4('0x15'));var utils=require(_0x84e4('0x16'));var config=require(_0x84e4('0x17'));var db=require(_0x84e4('0x18'))['db'];function respondWithStatusCode(_0x1f4629,_0x2222fa){_0x2222fa=_0x2222fa||0xcc;return function(_0x5dc7c3){if(_0x5dc7c3){return _0x1f4629[_0x84e4('0x19')](_0x2222fa);}return _0x1f4629['status'](_0x2222fa)[_0x84e4('0x1a')]();};}function respondWithResult(_0x4f345f,_0x1ef766){_0x1ef766=_0x1ef766||0xc8;return function(_0x348fe5){if(_0x348fe5){return _0x4f345f['status'](_0x1ef766)[_0x84e4('0x1b')](_0x348fe5);}};}function respondWithFilteredResult(_0x54c298,_0xc42231){return function(_0x1a4109){if(_0x1a4109){var _0x488706=_0x1a4109['count'],_0xcb8f0a=_0xc42231[_0x84e4('0x1c')],_0x327245=_0xc42231[_0x84e4('0x1c')]+_0xc42231['limit'],_0x3b5cd9;if(_0x327245>=_0x488706){_0x327245=_0x488706;_0x3b5cd9=0xc8;}else{_0x3b5cd9=0xce;}_0x54c298[_0x84e4('0x1d')](_0x3b5cd9);return _0x54c298[_0x84e4('0x1e')](_0x84e4('0x1f'),_0xcb8f0a+'-'+_0x327245+'/'+_0x488706)[_0x84e4('0x1b')](_0x1a4109);}return null;};}function patchUpdates(_0x434969){return function(_0x55329f){try{jsonpatch[_0x84e4('0x20')](_0x55329f,_0x434969,!![]);}catch(_0x4f3b65){return BPromise['reject'](_0x4f3b65);}return _0x55329f[_0x84e4('0x21')]();};}function saveUpdates(_0x4a5746,_0x29271f){return function(_0x41d96d){if(_0x41d96d){return _0x41d96d[_0x84e4('0x22')](_0x4a5746)[_0x84e4('0x23')](function(_0x3cf455){return _0x3cf455;});}return null;};}function removeEntity(_0x322e64,_0x544579){return function(_0x5d1589){if(_0x5d1589){return _0x5d1589[_0x84e4('0x24')]()[_0x84e4('0x23')](function(){_0x322e64['status'](0xcc)[_0x84e4('0x1a')]();});}};}function handleEntityNotFound(_0x465747,_0x3eb640){return function(_0x4644b7){if(!_0x4644b7){_0x465747[_0x84e4('0x19')](0x194);}return _0x4644b7;};}function handleError(_0x52f2ed,_0x47f616){_0x47f616=_0x47f616||0x1f4;return function(_0x2513e1){logger[_0x84e4('0x25')](_0x2513e1['stack']);if(_0x2513e1[_0x84e4('0x26')]){delete _0x2513e1[_0x84e4('0x26')];}_0x52f2ed[_0x84e4('0x1d')](_0x47f616)[_0x84e4('0x27')](_0x2513e1);};}exports[_0x84e4('0x28')]=function(_0x2a8365,_0x15a2ab){var _0x56cfc3={},_0x51ffe5={},_0x157ad4={'count':0x0,'rows':[]};var _0x4e7293=_[_0x84e4('0x29')](db[_0x84e4('0x2a')][_0x84e4('0x2b')],function(_0x295b5a){return{'name':_0x295b5a[_0x84e4('0x2c')],'type':_0x295b5a[_0x84e4('0x2d')][_0x84e4('0x2e')]};});_0x51ffe5[_0x84e4('0x2f')]=_[_0x84e4('0x29')](_0x4e7293,_0x84e4('0x26'));_0x51ffe5[_0x84e4('0x30')]=_[_0x84e4('0x31')](_0x2a8365['query']);_0x51ffe5[_0x84e4('0x32')]=_[_0x84e4('0x33')](_0x51ffe5[_0x84e4('0x2f')],_0x51ffe5[_0x84e4('0x30')]);_0x56cfc3['attributes']=_['intersection'](_0x51ffe5[_0x84e4('0x2f')],qs[_0x84e4('0x34')](_0x2a8365[_0x84e4('0x30')][_0x84e4('0x34')]));_0x56cfc3['attributes']=_0x56cfc3[_0x84e4('0x35')][_0x84e4('0x36')]?_0x56cfc3[_0x84e4('0x35')]:_0x51ffe5[_0x84e4('0x2f')];if(!_0x2a8365['query']['hasOwnProperty'](_0x84e4('0x37'))){_0x56cfc3[_0x84e4('0x38')]=qs[_0x84e4('0x38')](_0x2a8365[_0x84e4('0x30')][_0x84e4('0x38')]);_0x56cfc3['offset']=qs[_0x84e4('0x1c')](_0x2a8365[_0x84e4('0x30')]['offset']);}_0x56cfc3[_0x84e4('0x39')]=qs['sort'](_0x2a8365[_0x84e4('0x30')][_0x84e4('0x3a')]);_0x56cfc3[_0x84e4('0x3b')]=qs['filters'](_['pick'](_0x2a8365['query'],_0x51ffe5[_0x84e4('0x32')]),_0x4e7293);if(_0x2a8365[_0x84e4('0x30')]['filter']){_0x56cfc3[_0x84e4('0x3b')]=_[_0x84e4('0x3c')](_0x56cfc3[_0x84e4('0x3b')],{'$or':_[_0x84e4('0x29')](_0x4e7293,function(_0x7ede74){if(_0x7ede74[_0x84e4('0x2d')]!==_0x84e4('0x3d')){var _0x46e164={};_0x46e164[_0x7ede74[_0x84e4('0x26')]]={'$like':'%'+_0x2a8365[_0x84e4('0x30')][_0x84e4('0x3e')]+'%'};return _0x46e164;}})});}_0x56cfc3=_['merge']({},_0x56cfc3,_0x2a8365[_0x84e4('0x3f')]);var _0x41998e={'where':_0x56cfc3[_0x84e4('0x3b')]};return db['JscriptyAnswerReport'][_0x84e4('0x40')](_0x41998e)[_0x84e4('0x23')](function(_0x597cc1){_0x157ad4[_0x84e4('0x40')]=_0x597cc1;if(_0x2a8365['query'][_0x84e4('0x41')]){_0x56cfc3['include']=[{'all':!![]}];}return db[_0x84e4('0x2a')][_0x84e4('0x42')](_0x56cfc3);})[_0x84e4('0x23')](function(_0x4004a6){_0x157ad4[_0x84e4('0x43')]=_0x4004a6;return _0x157ad4;})[_0x84e4('0x23')](respondWithFilteredResult(_0x15a2ab,_0x56cfc3))['catch'](handleError(_0x15a2ab,null));};exports[_0x84e4('0x44')]=function(_0x4e12a4,_0x408af8){var _0x49de81={'raw':!![],'where':{'id':_0x4e12a4[_0x84e4('0x45')]['id']}},_0xd5c997={};_0xd5c997[_0x84e4('0x2f')]=_['keys'](db[_0x84e4('0x2a')]['rawAttributes']);_0xd5c997[_0x84e4('0x30')]=_['keys'](_0x4e12a4[_0x84e4('0x30')]);_0xd5c997[_0x84e4('0x32')]=_['intersection'](_0xd5c997[_0x84e4('0x2f')],_0xd5c997[_0x84e4('0x30')]);_0x49de81['attributes']=_[_0x84e4('0x33')](_0xd5c997[_0x84e4('0x2f')],qs[_0x84e4('0x34')](_0x4e12a4[_0x84e4('0x30')][_0x84e4('0x34')]));_0x49de81[_0x84e4('0x35')]=_0x49de81[_0x84e4('0x35')][_0x84e4('0x36')]?_0x49de81[_0x84e4('0x35')]:_0xd5c997[_0x84e4('0x2f')];if(_0x4e12a4[_0x84e4('0x30')]['includeAll']){_0x49de81[_0x84e4('0x46')]=[{'all':!![]}];}_0x49de81=_[_0x84e4('0x3c')]({},_0x49de81,_0x4e12a4['options']);return db['JscriptyAnswerReport']['find'](_0x49de81)[_0x84e4('0x23')](handleEntityNotFound(_0x408af8,null))[_0x84e4('0x23')](respondWithResult(_0x408af8,null))[_0x84e4('0x47')](handleError(_0x408af8,null));};exports[_0x84e4('0x48')]=function(_0x4d1fc1,_0x4a69f6){return db[_0x84e4('0x2a')]['create'](_0x4d1fc1[_0x84e4('0x49')],{})[_0x84e4('0x23')](respondWithResult(_0x4a69f6,0xc9))[_0x84e4('0x47')](handleError(_0x4a69f6,null));};exports[_0x84e4('0x22')]=function(_0x2c9f74,_0x3b38d1){if(_0x2c9f74['body']['id']){delete _0x2c9f74[_0x84e4('0x49')]['id'];}return db['JscriptyAnswerReport'][_0x84e4('0x4a')]({'where':{'id':_0x2c9f74[_0x84e4('0x45')]['id']}})[_0x84e4('0x23')](handleEntityNotFound(_0x3b38d1,null))[_0x84e4('0x23')](saveUpdates(_0x2c9f74['body'],null))[_0x84e4('0x23')](respondWithResult(_0x3b38d1,null))[_0x84e4('0x47')](handleError(_0x3b38d1,null));};exports['destroy']=function(_0x4cc780,_0x5875cf){return db[_0x84e4('0x2a')][_0x84e4('0x4a')]({'where':{'id':_0x4cc780[_0x84e4('0x45')]['id']}})[_0x84e4('0x23')](handleEntityNotFound(_0x5875cf,null))[_0x84e4('0x23')](removeEntity(_0x5875cf,null))['catch'](handleError(_0x5875cf,null));};exports[_0x84e4('0x4b')]=function(_0x1cbe35,_0x3f5c2e){return db['JscriptyAnswerReport'][_0x84e4('0x4b')]()[_0x84e4('0x23')](respondWithResult(_0x3f5c2e,null))[_0x84e4('0x47')](handleError(_0x3f5c2e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 8fe1763..30e60df 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 _0xe9c7=['report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x2dd2b2,_0x14b504){var _0x5bdeb3=function(_0x139eb4){while(--_0x139eb4){_0x2dd2b2['push'](_0x2dd2b2['shift']());}};_0x5bdeb3(++_0x14b504);}(_0xe9c7,0xd9));var _0x7e9c=function(_0x16941a,_0x37bf83){_0x16941a=_0x16941a-0x0;var _0x30004e=_0xe9c7[_0x16941a];return _0x30004e;};'use strict';var _=require(_0x7e9c('0x0'));var util=require(_0x7e9c('0x1'));var logger=require('../../config/logger')(_0x7e9c('0x2'));var moment=require(_0x7e9c('0x3'));var BPromise=require(_0x7e9c('0x4'));var rp=require(_0x7e9c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e9c('0x6'));var config=require(_0x7e9c('0x7'));var attributes=require(_0x7e9c('0x8'));module[_0x7e9c('0x9')]=function(_0x7e558,_0x50b77c){return _0x7e558[_0x7e9c('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x7e9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0626=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','report_jscripty_answers'];(function(_0x139b54,_0x242dcf){var _0x647405=function(_0x1e6614){while(--_0x1e6614){_0x139b54['push'](_0x139b54['shift']());}};_0x647405(++_0x242dcf);}(_0x0626,0x1ef));var _0x6062=function(_0x23c5b3,_0x369a5e){_0x23c5b3=_0x23c5b3-0x0;var _0x4cfde9=_0x0626[_0x23c5b3];return _0x4cfde9;};'use strict';var _=require(_0x6062('0x0'));var util=require(_0x6062('0x1'));var logger=require(_0x6062('0x2'))(_0x6062('0x3'));var moment=require(_0x6062('0x4'));var BPromise=require(_0x6062('0x5'));var rp=require(_0x6062('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6062('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x6062('0x8')]=function(_0x354f34,_0x7c3d72){return _0x354f34[_0x6062('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0x6062('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 3075ec4..51e3235 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 _0x28ea=['client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b9abb,_0x242e16){var _0x30c6d6=function(_0x59cac9){while(--_0x59cac9){_0x5b9abb['push'](_0x5b9abb['shift']());}};_0x30c6d6(++_0x242e16);}(_0x28ea,0x109));var _0xa28e=function(_0x232459,_0x2001cf){_0x232459=_0x232459-0x0;var _0x25f607=_0x28ea[_0x232459];return _0x25f607;};'use strict';var _=require('lodash');var util=require(_0xa28e('0x0'));var moment=require(_0xa28e('0x1'));var BPromise=require(_0xa28e('0x2'));var rs=require(_0xa28e('0x3'));var fs=require('fs');var Redis=require(_0xa28e('0x4'));var db=require(_0xa28e('0x5'))['db'];var utils=require(_0xa28e('0x6'));var logger=require(_0xa28e('0x7'))(_0xa28e('0x8'));var config=require(_0xa28e('0x9'));var jayson=require(_0xa28e('0xa'));var client=jayson[_0xa28e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e23c1,_0xd19bf2,_0x2edf61){return new BPromise(function(_0x5e451b,_0x2b6e6b){return client[_0xa28e('0xc')](_0x4e23c1,_0x2edf61)[_0xa28e('0xd')](function(_0x1f22ae){logger[_0xa28e('0xe')](_0xa28e('0xf'),_0xd19bf2,_0xa28e('0x10'));logger[_0xa28e('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xd19bf2,_0xa28e('0x10'),JSON[_0xa28e('0x12')](_0x1f22ae));if(_0x1f22ae[_0xa28e('0x13')]){if(_0x1f22ae[_0xa28e('0x13')]['code']===0x1f4){logger[_0xa28e('0x13')](_0xa28e('0xf'),_0xd19bf2,_0x1f22ae['error']['message']);return _0x2b6e6b(_0x1f22ae['error'][_0xa28e('0x14')]);}logger[_0xa28e('0x13')](_0xa28e('0xf'),_0xd19bf2,_0x1f22ae[_0xa28e('0x13')]['message']);return _0x5e451b(_0x1f22ae[_0xa28e('0x13')][_0xa28e('0x14')]);}else{logger['info'](_0xa28e('0xf'),_0xd19bf2,'request\x20sent');_0x5e451b(_0x1f22ae[_0xa28e('0x15')][_0xa28e('0x14')]);}})[_0xa28e('0x16')](function(_0x15884c){logger[_0xa28e('0x13')](_0xa28e('0xf'),_0xd19bf2,_0x15884c);_0x2b6e6b(_0x15884c);});});} \ No newline at end of file +var _0x952c=['request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','JscriptyAnswerReport,\x20%s,\x20%s','debug'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x952c,0xd6));var _0xc952=function(_0x705b98,_0x1c345b){_0x705b98=_0x705b98-0x0;var _0x47b72f=_0x952c[_0x705b98];return _0x47b72f;};'use strict';var _=require(_0xc952('0x0'));var util=require(_0xc952('0x1'));var moment=require(_0xc952('0x2'));var BPromise=require(_0xc952('0x3'));var rs=require(_0xc952('0x4'));var fs=require('fs');var Redis=require(_0xc952('0x5'));var db=require(_0xc952('0x6'))['db'];var utils=require(_0xc952('0x7'));var logger=require(_0xc952('0x8'))(_0xc952('0x9'));var config=require(_0xc952('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc952('0xb')][_0xc952('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47a44d,_0x23bf20,_0x20e046){return new BPromise(function(_0x1f8b83,_0x1c311b){return client['request'](_0x47a44d,_0x20e046)[_0xc952('0xd')](function(_0x29bd89){logger['info'](_0xc952('0xe'),_0x23bf20,'request\x20sent');logger[_0xc952('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x23bf20,_0xc952('0x10'),JSON['stringify'](_0x29bd89));if(_0x29bd89[_0xc952('0x11')]){if(_0x29bd89['error'][_0xc952('0x12')]===0x1f4){logger[_0xc952('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x23bf20,_0x29bd89[_0xc952('0x11')][_0xc952('0x13')]);return _0x1c311b(_0x29bd89[_0xc952('0x11')][_0xc952('0x13')]);}logger[_0xc952('0x11')](_0xc952('0xe'),_0x23bf20,_0x29bd89[_0xc952('0x11')]['message']);return _0x1f8b83(_0x29bd89[_0xc952('0x11')][_0xc952('0x13')]);}else{logger[_0xc952('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x23bf20,'request\x20sent');_0x1f8b83(_0x29bd89[_0xc952('0x15')][_0xc952('0x13')]);}})[_0xc952('0x16')](function(_0x72cf30){logger[_0xc952('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x23bf20,_0x72cf30);_0x1c311b(_0x72cf30);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 467dca1..25aaf79 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 _0x41a6=['multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','clone','update','delete','destroy','exports'];(function(_0x1e24b8,_0x333b2e){var _0x2122a3=function(_0x38883e){while(--_0x38883e){_0x1e24b8['push'](_0x1e24b8['shift']());}};_0x2122a3(++_0x333b2e);}(_0x41a6,0x1c8));var _0x641a=function(_0x16bae8,_0x548696){_0x16bae8=_0x16bae8-0x0;var _0x5b465f=_0x41a6[_0x16bae8];return _0x5b465f;};'use strict';var multer=require(_0x641a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x641a('0x1'));var express=require('express');var router=express[_0x641a('0x2')]();var auth=require(_0x641a('0x3'));var interaction=require(_0x641a('0x4'));var config=require(_0x641a('0x5'));var controller=require(_0x641a('0x6'));router['get']('/',auth[_0x641a('0x7')](),controller[_0x641a('0x8')]);router[_0x641a('0x9')](_0x641a('0xa'),auth[_0x641a('0x7')](),controller[_0x641a('0xb')]);router['get'](_0x641a('0xc'),auth['isAuthenticated'](),controller[_0x641a('0xd')]);router[_0x641a('0x9')](_0x641a('0xe'),auth[_0x641a('0x7')](),controller[_0x641a('0xf')]);router[_0x641a('0x9')](_0x641a('0x10'),auth[_0x641a('0x7')](),timeout('30s'),controller[_0x641a('0x11')]);router[_0x641a('0x12')]('/',auth[_0x641a('0x7')](),controller['create']);router[_0x641a('0x12')]('/:id/clone',auth['isAuthenticated'](),controller[_0x641a('0x13')]);router['put'](_0x641a('0xa'),auth[_0x641a('0x7')](),controller[_0x641a('0x14')]);router[_0x641a('0x15')]('/:id',auth[_0x641a('0x7')](),controller[_0x641a('0x16')]);module[_0x641a('0x17')]=router; \ No newline at end of file +var _0x6452=['/:id','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','/:id/clone','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated'];(function(_0x27161e,_0x136b07){var _0x179d9=function(_0x44d83b){while(--_0x44d83b){_0x27161e['push'](_0x27161e['shift']());}};_0x179d9(++_0x136b07);}(_0x6452,0x156));var _0x2645=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x6452[_0x5311e8];return _0x582ad8;};'use strict';var multer=require(_0x2645('0x0'));var util=require(_0x2645('0x1'));var path=require(_0x2645('0x2'));var timeout=require('connect-timeout');var express=require(_0x2645('0x3'));var router=express[_0x2645('0x4')]();var auth=require(_0x2645('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2645('0x6'));var controller=require(_0x2645('0x7'));router[_0x2645('0x8')]('/',auth[_0x2645('0x9')](),controller['index']);router[_0x2645('0x8')](_0x2645('0xa'),auth[_0x2645('0x9')](),controller['show']);router['get']('/:id/sessions',auth[_0x2645('0x9')](),controller[_0x2645('0xb')]);router['get'](_0x2645('0xc'),auth['isAuthenticated'](),controller[_0x2645('0xd')]);router['get'](_0x2645('0xe'),auth['isAuthenticated'](),timeout('30s'),controller[_0x2645('0xf')]);router[_0x2645('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2645('0x10')](_0x2645('0x11'),auth[_0x2645('0x9')](),controller['clone']);router[_0x2645('0x12')](_0x2645('0xa'),auth[_0x2645('0x9')](),controller[_0x2645('0x13')]);router['delete'](_0x2645('0xa'),auth[_0x2645('0x9')](),controller[_0x2645('0x14')]);module[_0x2645('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 7d1a551..3272a6b 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 _0xbf4b=['exports','STRING','name','TEXT','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xbf4b,0x12d));var _0xbbf4=function(_0x22a409,_0x1e7083){_0x22a409=_0x22a409-0x0;var _0x4ffcf0=_0xbf4b[_0x22a409];return _0x4ffcf0;};'use strict';var Sequelize=require(_0xbbf4('0x0'));var _=require(_0xbbf4('0x1'));var util=require(_0xbbf4('0x2'));module[_0xbbf4('0x3')]={'name':{'type':Sequelize[_0xbbf4('0x4')],'unique':_0xbbf4('0x5')},'description':{'type':Sequelize[_0xbbf4('0x4')]},'formData':{'type':Sequelize[_0xbbf4('0x6')]('long'),'set':function(_0x38efb1){if(_['isObjectLike'](_0x38efb1)){this['setDataValue'](_0xbbf4('0x7'),JSON[_0xbbf4('0x8')](_0x38efb1));}else if(_[_0xbbf4('0x9')](_0x38efb1)){this[_0xbbf4('0xa')]('formData',_0x38efb1);}else{this['setDataValue'](_0xbbf4('0x7'),util[_0xbbf4('0xb')](_0xbbf4('0xc'),this[_0xbbf4('0xd')]('name')||'',this['getDataValue'](_0xbbf4('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbbf4('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x6040=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name','STRING','TEXT','isObjectLike','setDataValue','stringify','isString','formData'];(function(_0x3470c3,_0xb7e4fc){var _0x5045c5=function(_0x5a16f5){while(--_0x5a16f5){_0x3470c3['push'](_0x3470c3['shift']());}};_0x5045c5(++_0xb7e4fc);}(_0x6040,0x19d));var _0x0604=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x6040[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require(_0x0604('0x0'));var _=require(_0x0604('0x1'));var util=require(_0x0604('0x2'));module[_0x0604('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x0604('0x4')},'description':{'type':Sequelize[_0x0604('0x5')]},'formData':{'type':Sequelize[_0x0604('0x6')]('long'),'set':function(_0x1556d9){if(_[_0x0604('0x7')](_0x1556d9)){this[_0x0604('0x8')]('formData',JSON[_0x0604('0x9')](_0x1556d9));}else if(_[_0x0604('0xa')](_0x1556d9)){this[_0x0604('0x8')](_0x0604('0xb'),_0x1556d9);}else{this[_0x0604('0x8')](_0x0604('0xb'),util[_0x0604('0xc')](_0x0604('0xd'),this[_0x0604('0xe')](_0x0604('0x4'))||'',this['getDataValue'](_0x0604('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0604('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 4169662..a7384b3 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 _0xbead=['includeAll','JscriptyProject','findAll','rows','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','error','clone','params','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','getAnswers','findOne','pick','ProjectId','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','Projects','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x424afb,_0x51dd5a){var _0x3f6ff9=function(_0x3085bc){while(--_0x3085bc){_0x424afb['push'](_0x424afb['shift']());}};_0x3f6ff9(++_0x51dd5a);}(_0xbead,0xac));var _0xdbea=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0xbead[_0x1b8e60];return _0x363363;};'use strict';var pdf=require(_0xdbea('0x0'));var emlformat=require(_0xdbea('0x1'));var rimraf=require(_0xdbea('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbea('0x3'));var rp=require(_0xdbea('0x4'));var moment=require(_0xdbea('0x5'));var BPromise=require(_0xdbea('0x6'));var Mustache=require(_0xdbea('0x7'));var util=require(_0xdbea('0x8'));var path=require(_0xdbea('0x9'));var sox=require('sox');var csv=require(_0xdbea('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdbea('0xb'));var squel=require('squel');var crypto=require(_0xdbea('0xc'));var jsforce=require(_0xdbea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdbea('0xa'));var querystring=require(_0xdbea('0xe'));var Papa=require(_0xdbea('0xf'));var Redis=require('ioredis');var authService=require(_0xdbea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbea('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdbea('0x12'));var config=require('../../config/environment');var db=require(_0xdbea('0x13'))['db'];function respondWithStatusCode(_0xbe98ff,_0x5d4d5e){_0x5d4d5e=_0x5d4d5e||0xcc;return function(_0x10543b){if(_0x10543b){return _0xbe98ff[_0xdbea('0x14')](_0x5d4d5e);}return _0xbe98ff['status'](_0x5d4d5e)[_0xdbea('0x15')]();};}function respondWithResult(_0x28ab7b,_0x299789){_0x299789=_0x299789||0xc8;return function(_0x14619f){if(_0x14619f){return _0x28ab7b[_0xdbea('0x16')](_0x299789)[_0xdbea('0x17')](_0x14619f);}};}function respondWithFilteredResult(_0x441dd6,_0x480a7d){return function(_0x206d34){if(_0x206d34){var _0x482ee7=_0x206d34[_0xdbea('0x18')],_0x58fc54=_0x480a7d[_0xdbea('0x19')],_0x40eef6=_0x480a7d[_0xdbea('0x19')]+_0x480a7d[_0xdbea('0x1a')],_0x2a0d62;if(_0x40eef6>=_0x482ee7){_0x40eef6=_0x482ee7;_0x2a0d62=0xc8;}else{_0x2a0d62=0xce;}_0x441dd6[_0xdbea('0x16')](_0x2a0d62);return _0x441dd6[_0xdbea('0x1b')](_0xdbea('0x1c'),_0x58fc54+'-'+_0x40eef6+'/'+_0x482ee7)['json'](_0x206d34);}return null;};}function patchUpdates(_0x1a5fb8){return function(_0x23afdf){try{jsonpatch[_0xdbea('0x1d')](_0x23afdf,_0x1a5fb8,!![]);}catch(_0x58abdd){return BPromise[_0xdbea('0x1e')](_0x58abdd);}return _0x23afdf['save']();};}function saveUpdates(_0x489924,_0xa42c4e){return function(_0x738348){if(_0x738348){return _0x738348[_0xdbea('0x1f')](_0x489924)['then'](function(_0x62225c){return _0x62225c;});}return null;};}function removeEntity(_0x551f60,_0x4736ff){return function(_0x29e985){if(_0x29e985){return _0x29e985[_0xdbea('0x20')]()[_0xdbea('0x21')](function(){var _0x51a396=_0x29e985[_0xdbea('0x22')]({'plain':!![]});var _0x1e7455=_0xdbea('0x23');return db['UserProfileResource'][_0xdbea('0x20')]({'where':{'type':_0x1e7455,'resourceId':_0x51a396['id']}})[_0xdbea('0x21')](function(){return _0x29e985;});})[_0xdbea('0x21')](function(){_0x551f60['status'](0xcc)[_0xdbea('0x15')]();});}};}function handleEntityNotFound(_0x1bbfb7,_0xd21e4c){return function(_0x36e5bb){if(!_0x36e5bb){_0x1bbfb7[_0xdbea('0x14')](0x194);}return _0x36e5bb;};}function handleError(_0x3d11be,_0x27d23f){_0x27d23f=_0x27d23f||0x1f4;return function(_0xbc04d9){logger['error'](_0xbc04d9[_0xdbea('0x24')]);if(_0xbc04d9[_0xdbea('0x25')]){delete _0xbc04d9[_0xdbea('0x25')];}_0x3d11be[_0xdbea('0x16')](_0x27d23f)[_0xdbea('0x26')](_0xbc04d9);};}exports[_0xdbea('0x27')]=function(_0x3e4958,_0x55eb90){var _0x257a27={},_0x1d9658={},_0x56b855={'count':0x0,'rows':[]};var _0x270314=_[_0xdbea('0x28')](db['JscriptyProject'][_0xdbea('0x29')],function(_0x1355ea){return{'name':_0x1355ea[_0xdbea('0x2a')],'type':_0x1355ea[_0xdbea('0x2b')][_0xdbea('0x2c')]};});_0x1d9658['model']=_['map'](_0x270314,_0xdbea('0x25'));_0x1d9658[_0xdbea('0x2d')]=_[_0xdbea('0x2e')](_0x3e4958[_0xdbea('0x2d')]);_0x1d9658[_0xdbea('0x2f')]=_[_0xdbea('0x30')](_0x1d9658['model'],_0x1d9658[_0xdbea('0x2d')]);_0x257a27[_0xdbea('0x31')]=_[_0xdbea('0x30')](_0x1d9658[_0xdbea('0x32')],qs[_0xdbea('0x33')](_0x3e4958[_0xdbea('0x2d')]['fields']));_0x257a27[_0xdbea('0x31')]=_0x257a27[_0xdbea('0x31')][_0xdbea('0x34')]?_0x257a27[_0xdbea('0x31')]:_0x1d9658[_0xdbea('0x32')];if(!_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x35')](_0xdbea('0x36'))){_0x257a27[_0xdbea('0x1a')]=qs[_0xdbea('0x1a')](_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x1a')]);_0x257a27[_0xdbea('0x19')]=qs[_0xdbea('0x19')](_0x3e4958[_0xdbea('0x2d')]['offset']);}_0x257a27[_0xdbea('0x37')]=qs[_0xdbea('0x38')](_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x38')]);_0x257a27[_0xdbea('0x39')]=qs[_0xdbea('0x2f')](_['pick'](_0x3e4958[_0xdbea('0x2d')],_0x1d9658['filters']),_0x270314);if(_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x3a')]){_0x257a27[_0xdbea('0x39')]=_['merge'](_0x257a27[_0xdbea('0x39')],{'$or':_[_0xdbea('0x28')](_0x270314,function(_0x1e54e5){if(_0x1e54e5[_0xdbea('0x2b')]!==_0xdbea('0x3b')){var _0x15535f={};_0x15535f[_0x1e54e5[_0xdbea('0x25')]]={'$like':'%'+_0x3e4958[_0xdbea('0x2d')]['filter']+'%'};return _0x15535f;}})});}_0x257a27=_[_0xdbea('0x3c')]({},_0x257a27,_0x3e4958[_0xdbea('0x3d')]);var _0x2dc646={'where':_0x257a27[_0xdbea('0x39')]};return db['JscriptyProject'][_0xdbea('0x18')](_0x2dc646)['then'](function(_0x5690d1){_0x56b855['count']=_0x5690d1;if(_0x3e4958[_0xdbea('0x2d')][_0xdbea('0x3e')]){_0x257a27['include']=[{'all':!![]}];}return db[_0xdbea('0x3f')][_0xdbea('0x40')](_0x257a27);})[_0xdbea('0x21')](function(_0x26bbc7){_0x56b855[_0xdbea('0x41')]=_0x26bbc7;return _0x56b855;})[_0xdbea('0x21')](respondWithFilteredResult(_0x55eb90,_0x257a27))['catch'](handleError(_0x55eb90,null));};exports[_0xdbea('0x42')]=function(_0x286ba1,_0x156da9){var _0xa49632={'raw':![],'where':{'id':_0x286ba1['params']['id']}},_0x4d09cf={};_0x4d09cf['model']=_[_0xdbea('0x2e')](db[_0xdbea('0x3f')][_0xdbea('0x29')]);_0x4d09cf[_0xdbea('0x2d')]=_[_0xdbea('0x2e')](_0x286ba1[_0xdbea('0x2d')]);_0x4d09cf[_0xdbea('0x2f')]=_[_0xdbea('0x30')](_0x4d09cf[_0xdbea('0x32')],_0x4d09cf[_0xdbea('0x2d')]);_0xa49632[_0xdbea('0x31')]=_['intersection'](_0x4d09cf[_0xdbea('0x32')],qs['fields'](_0x286ba1[_0xdbea('0x2d')][_0xdbea('0x33')]));_0xa49632[_0xdbea('0x31')]=_0xa49632[_0xdbea('0x31')][_0xdbea('0x34')]?_0xa49632[_0xdbea('0x31')]:_0x4d09cf[_0xdbea('0x32')];if(_0x286ba1[_0xdbea('0x2d')][_0xdbea('0x3e')]){_0xa49632[_0xdbea('0x43')]=[{'all':!![]}];}_0xa49632=_[_0xdbea('0x3c')]({},_0xa49632,_0x286ba1['options']);return db['JscriptyProject'][_0xdbea('0x44')](_0xa49632)[_0xdbea('0x21')](handleEntityNotFound(_0x156da9,null))[_0xdbea('0x21')](respondWithResult(_0x156da9,null))[_0xdbea('0x45')](handleError(_0x156da9,null));};exports[_0xdbea('0x46')]=function(_0x465e40,_0x5b70b5){return db[_0xdbea('0x3f')][_0xdbea('0x46')](_0x465e40[_0xdbea('0x47')],{})[_0xdbea('0x21')](function(_0x292b08){var _0x58b433=_0x465e40[_0xdbea('0x48')]['get']({'plain':!![]});if(!_0x58b433)throw new Error(_0xdbea('0x49'));if(_0x58b433[_0xdbea('0x4a')]===_0xdbea('0x48')){var _0x5ac6a8=_0x292b08[_0xdbea('0x22')]({'plain':!![]});var _0x4789e4=_0xdbea('0x23');return db['UserProfileSection'][_0xdbea('0x44')]({'where':{'name':_0x4789e4,'userProfileId':_0x58b433[_0xdbea('0x4b')]},'raw':!![]})[_0xdbea('0x21')](function(_0x93442e){if(_0x93442e&&_0x93442e['autoAssociation']===0x0){return db[_0xdbea('0x4c')]['create']({'name':_0x5ac6a8[_0xdbea('0x25')],'resourceId':_0x5ac6a8['id'],'type':_0x93442e[_0xdbea('0x25')],'sectionId':_0x93442e['id']},{})[_0xdbea('0x21')](function(){return _0x292b08;});}else{return _0x292b08;}})[_0xdbea('0x45')](function(_0xc2aa70){logger[_0xdbea('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc2aa70);throw _0xc2aa70;});}return _0x292b08;})[_0xdbea('0x21')](respondWithResult(_0x5b70b5,0xc9))[_0xdbea('0x45')](handleError(_0x5b70b5,null));};exports[_0xdbea('0x4e')]=function(_0x2016cc,_0x133f2c){var _0x8aad7f={'where':{'id':_0x2016cc[_0xdbea('0x4f')]['id']}},_0x161922={};_0x161922[_0xdbea('0x32')]=_[_0xdbea('0x2e')](db[_0xdbea('0x3f')][_0xdbea('0x29')]);_0x8aad7f[_0xdbea('0x31')]=_['intersection'](_0x161922['model'],qs[_0xdbea('0x33')](_0x2016cc[_0xdbea('0x2d')]['fields']));_0x8aad7f['attributes']=_0x8aad7f[_0xdbea('0x31')][_0xdbea('0x34')]?_0x8aad7f['attributes']:_0x161922['model'];if(_0x2016cc['query'][_0xdbea('0x3e')]){_0x8aad7f[_0xdbea('0x43')]=[{'all':!![]}];}_0x8aad7f=_[_0xdbea('0x3c')]({},_0x8aad7f,_0x2016cc[_0xdbea('0x3d')]);return db[_0xdbea('0x3f')][_0xdbea('0x44')](_0x8aad7f)[_0xdbea('0x21')](handleEntityNotFound(_0x133f2c,null))[_0xdbea('0x21')](function(_0x265a6f){if(_0x265a6f){var _0x32a997=_0x265a6f[_0xdbea('0x22')]({'plain':!![]});_0x32a997=qs[_0xdbea('0x50')](_0x32a997,['id',_0xdbea('0x51'),_0xdbea('0x52')]);_0x2016cc[_0xdbea('0x47')]=_[_0xdbea('0x50')](_0x2016cc[_0xdbea('0x47')],['id',_0xdbea('0x51'),_0xdbea('0x52')]);return db[_0xdbea('0x3f')][_0xdbea('0x46')](_['merge'](_0x32a997,_0x2016cc[_0xdbea('0x47')]),{'include':_0x2016cc['query'][_0xdbea('0x3e')]?[{'all':!![]}]:undefined})[_0xdbea('0x21')](function(_0x3b8aa6){var _0x3dbb10=_0x2016cc[_0xdbea('0x48')][_0xdbea('0x22')]({'plain':!![]});if(!_0x3dbb10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dbb10[_0xdbea('0x4a')]==='user'){var _0x2bfb0a=_0x3b8aa6['get']({'plain':!![]});var _0x5e81c0='Projects';return db[_0xdbea('0x53')]['find']({'where':{'name':_0x5e81c0,'userProfileId':_0x3dbb10['userProfileId']},'raw':!![]})['then'](function(_0x15db52){if(_0x15db52&&_0x15db52['autoAssociation']===0x0){return db[_0xdbea('0x4c')][_0xdbea('0x46')]({'name':_0x2bfb0a[_0xdbea('0x25')],'resourceId':_0x2bfb0a['id'],'type':_0x15db52[_0xdbea('0x25')],'sectionId':_0x15db52['id']},{})['then'](function(){return _0x3b8aa6;});}else{return _0x3b8aa6;}})[_0xdbea('0x45')](function(_0x21d8c8){logger[_0xdbea('0x4d')](_0xdbea('0x54'),_0x21d8c8);throw _0x21d8c8;});}return _0x3b8aa6;});}})[_0xdbea('0x21')](respondWithResult(_0x133f2c,0xc9))['catch'](handleError(_0x133f2c,null));};exports[_0xdbea('0x1f')]=function(_0x373d50,_0x2fa61d){if(_0x373d50[_0xdbea('0x47')]['id']){delete _0x373d50[_0xdbea('0x47')]['id'];}return db['JscriptyProject'][_0xdbea('0x44')]({'where':{'id':_0x373d50['params']['id']}})[_0xdbea('0x21')](handleEntityNotFound(_0x2fa61d,null))[_0xdbea('0x21')](saveUpdates(_0x373d50['body'],null))['then'](respondWithResult(_0x2fa61d,null))[_0xdbea('0x45')](handleError(_0x2fa61d,null));};exports[_0xdbea('0x20')]=function(_0x3e1242,_0xd46a7b){return db['JscriptyProject']['find']({'where':{'id':_0x3e1242[_0xdbea('0x4f')]['id']}})[_0xdbea('0x21')](handleEntityNotFound(_0xd46a7b,null))[_0xdbea('0x21')](removeEntity(_0xd46a7b,null))[_0xdbea('0x45')](handleError(_0xd46a7b,null));};exports[_0xdbea('0x55')]=function(_0x2d94b9,_0x46c421,_0x225f0b){var _0x42c51e={'raw':!![],'where':{}};var _0xa81423={};var _0x5a65ef={'count':0x0,'rows':[]};return db[_0xdbea('0x3f')]['findOne']({'where':{'id':_0x2d94b9['params']['id']}})['then'](handleEntityNotFound(_0x46c421,null))['then'](function(_0x2831dd){if(_0x2831dd){_0xa81423['model']=_['keys'](db[_0xdbea('0x56')]['rawAttributes']);_0xa81423[_0xdbea('0x2d')]=_[_0xdbea('0x2e')](_0x2d94b9[_0xdbea('0x2d')]);_0xa81423[_0xdbea('0x2f')]=_[_0xdbea('0x30')](_0xa81423[_0xdbea('0x32')],_0xa81423[_0xdbea('0x2d')]);_0x42c51e[_0xdbea('0x31')]=_[_0xdbea('0x30')](_0xa81423[_0xdbea('0x32')],qs[_0xdbea('0x33')](_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x33')]));_0x42c51e[_0xdbea('0x31')]=_0x42c51e['attributes'][_0xdbea('0x34')]?_0x42c51e[_0xdbea('0x31')]:_0xa81423[_0xdbea('0x32')];if(!_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x35')](_0xdbea('0x36'))){_0x42c51e[_0xdbea('0x1a')]=qs['limit'](_0x2d94b9[_0xdbea('0x2d')]['limit']);_0x42c51e[_0xdbea('0x19')]=qs[_0xdbea('0x19')](_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x19')]);}_0x42c51e[_0xdbea('0x37')]=qs[_0xdbea('0x38')](_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x38')]);_0x42c51e[_0xdbea('0x39')]=qs[_0xdbea('0x2f')](_['pick'](_0x2d94b9[_0xdbea('0x2d')],_0xa81423[_0xdbea('0x2f')]));_0x42c51e[_0xdbea('0x39')]['ProjectId']=_0x2831dd['id'];if(_0x2d94b9[_0xdbea('0x2d')][_0xdbea('0x3a')]){_0x42c51e[_0xdbea('0x39')]=_[_0xdbea('0x3c')](_0x42c51e[_0xdbea('0x39')],{'$or':_[_0xdbea('0x28')](_0x42c51e['attributes'],function(_0x47705f){var _0x2d10fc={};_0x2d10fc[_0x47705f]={'$like':'%'+_0x2d94b9[_0xdbea('0x2d')]['filter']+'%'};return _0x2d10fc;})});}_0x42c51e=_[_0xdbea('0x3c')]({},_0x42c51e,_0x2d94b9['options']);return db[_0xdbea('0x56')][_0xdbea('0x18')]({'where':_0x42c51e[_0xdbea('0x39')]})['then'](function(_0x4fba27){_0x5a65ef['count']=_0x4fba27;if(_0x2d94b9[_0xdbea('0x2d')]['includeAll']){_0x42c51e[_0xdbea('0x43')]=[{'all':!![]}];}return db[_0xdbea('0x56')][_0xdbea('0x40')](_0x42c51e);})[_0xdbea('0x21')](function(_0x26452f){_0x5a65ef[_0xdbea('0x41')]=_0x26452f;return _0x5a65ef;});}})[_0xdbea('0x21')](respondWithFilteredResult(_0x46c421,_0x42c51e))[_0xdbea('0x45')](handleError(_0x46c421,null));};exports[_0xdbea('0x57')]=function(_0x15a96f,_0x1573da,_0x19aef6){var _0x53f808={'raw':!![],'where':{}};var _0x485aca={};var _0x1c6dc6={'count':0x0,'rows':[]};return db[_0xdbea('0x3f')][_0xdbea('0x58')]({'where':{'id':_0x15a96f[_0xdbea('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1573da,null))[_0xdbea('0x21')](function(_0x5a923a){if(_0x5a923a){_0x485aca[_0xdbea('0x32')]=_[_0xdbea('0x2e')](db['JscriptyAnswerReport']['rawAttributes']);_0x485aca[_0xdbea('0x2d')]=_[_0xdbea('0x2e')](_0x15a96f[_0xdbea('0x2d')]);_0x485aca['filters']=_[_0xdbea('0x30')](_0x485aca['model'],_0x485aca[_0xdbea('0x2d')]);_0x53f808[_0xdbea('0x31')]=_[_0xdbea('0x30')](_0x485aca[_0xdbea('0x32')],qs[_0xdbea('0x33')](_0x15a96f['query'][_0xdbea('0x33')]));_0x53f808[_0xdbea('0x31')]=_0x53f808['attributes'][_0xdbea('0x34')]?_0x53f808[_0xdbea('0x31')]:_0x485aca[_0xdbea('0x32')];if(!_0x15a96f[_0xdbea('0x2d')]['hasOwnProperty'](_0xdbea('0x36'))){_0x53f808[_0xdbea('0x1a')]=qs[_0xdbea('0x1a')](_0x15a96f['query'][_0xdbea('0x1a')]);_0x53f808[_0xdbea('0x19')]=qs[_0xdbea('0x19')](_0x15a96f[_0xdbea('0x2d')]['offset']);}_0x53f808[_0xdbea('0x37')]=qs[_0xdbea('0x38')](_0x15a96f['query']['sort']);_0x53f808['where']=qs[_0xdbea('0x2f')](_[_0xdbea('0x59')](_0x15a96f['query'],_0x485aca[_0xdbea('0x2f')]));_0x53f808[_0xdbea('0x39')][_0xdbea('0x5a')]=_0x5a923a['id'];if(_0x15a96f[_0xdbea('0x2d')][_0xdbea('0x3a')]){_0x53f808[_0xdbea('0x39')]=_[_0xdbea('0x3c')](_0x53f808[_0xdbea('0x39')],{'$or':_[_0xdbea('0x28')](_0x53f808[_0xdbea('0x31')],function(_0x28a92a){var _0xb03fe4={};_0xb03fe4[_0x28a92a]={'$like':'%'+_0x15a96f['query'][_0xdbea('0x3a')]+'%'};return _0xb03fe4;})});}_0x53f808=_[_0xdbea('0x3c')]({},_0x53f808,_0x15a96f['options']);return db[_0xdbea('0x5b')][_0xdbea('0x18')]({'where':_0x53f808[_0xdbea('0x39')]})[_0xdbea('0x21')](function(_0x36d43c){_0x1c6dc6[_0xdbea('0x18')]=_0x36d43c;if(_0x15a96f[_0xdbea('0x2d')]['includeAll']){_0x53f808[_0xdbea('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xdbea('0x40')](_0x53f808);})[_0xdbea('0x21')](function(_0x2092fc){_0x1c6dc6[_0xdbea('0x41')]=_0x2092fc;return _0x1c6dc6;});}})[_0xdbea('0x21')](respondWithFilteredResult(_0x1573da,_0x53f808))[_0xdbea('0x45')](handleError(_0x1573da,null));};function char(_0x141bde){return _0xdbea('0x5c')===typeof _0x141bde?String['fromCharCode'][_0xdbea('0x1d')](null,arguments):_0x141bde;}function needsEncapsulation(_0x331229){return!!_0x331229&&(_0x331229[_0xdbea('0x5d')]()[_0xdbea('0x5e')](char(0xd))>=0x0||_0x331229['toString']()[_0xdbea('0x5e')](char(0xa))>=0x0||_0x331229['toString']()['indexOf'](char(0x2c))>=0x0||_0x331229['toString']()[_0xdbea('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x4d6002){var _0xe74ca2=char(0x22),_0x39252d='\x5c'+char(0x22),_0x454a49=_0x4d6002['toString']()[_0xdbea('0x5f')](new RegExp(_0xe74ca2,'g'),_0x39252d);return _0xe74ca2+_0x454a49+_0xe74ca2;}exports[_0xdbea('0x60')]=function(_0x35ea68,_0x43d9d1,_0x29c298){var _0x1378db,_0xc610e4;var _0x50a018={'where':{'ProjectId':_0x35ea68['params']['id']}};if(_0x35ea68[_0xdbea('0x2d')][_0xdbea('0x61')]){_0x50a018['where'][_0xdbea('0x62')]=JSON['parse'](_0x35ea68[_0xdbea('0x2d')][_0xdbea('0x61')]);}return db['JscriptySessionReport']['findAll'](_0x50a018)[_0xdbea('0x21')](handleEntityNotFound(_0x43d9d1,null))[_0xdbea('0x21')](function(_0x57d252){if(_0x57d252){_0x1378db=_0x57d252;return db[_0xdbea('0x63')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x1378db,'id')},'ProjectId':_0x35ea68['params']['id']},'order':_0xdbea('0x64')});}})[_0xdbea('0x21')](handleEntityNotFound(_0x43d9d1,null))[_0xdbea('0x21')](function(_0x570bdb){if(_0x570bdb){_0xc610e4=_0x570bdb;var _0x3aa9dd={};for(var _0x2d36ef=0x0,_0x4020b0=_0xc610e4['length'];_0x2d36ef<_0x4020b0;_0x2d36ef++){if(!_0x3aa9dd[_0xdbea('0x35')](_0xc610e4[_0x2d36ef]['questionId'])){_0x3aa9dd[_0xc610e4[_0x2d36ef][_0xdbea('0x65')]]=needsEncapsulation(_0xc610e4[_0x2d36ef][_0xdbea('0x66')])?encapsulate(_0xc610e4[_0x2d36ef][_0xdbea('0x66')]):_0xc610e4[_0x2d36ef][_0xdbea('0x66')];}}var _0x110bb6=[],_0x2f645a={};for(var _0x2b3830=0x0,_0x3bf099=_0x1378db[_0xdbea('0x34')];_0x2b3830<_0x3bf099;_0x2b3830++){_0x2f645a={'ProjectId':_0x35ea68[_0xdbea('0x4f')]['id'],'SessionId':_0x1378db[_0x2b3830]['id'],'StartTime':moment(_0x1378db[_0x2b3830]['starttime'])[_0xdbea('0x67')](_0xdbea('0x68'))};for(var _0x53b79a=0x0,_0x4943e8=_0xc610e4['length'];_0x53b79a<_0x4943e8;_0x53b79a++){if(_0xc610e4[_0x53b79a][_0xdbea('0x69')]==_0x1378db[_0x2b3830]['id']&&_0x3aa9dd[_0xdbea('0x35')](_0xc610e4[_0x53b79a][_0xdbea('0x65')])){_0x2f645a[_0x3aa9dd[_0xc610e4[_0x53b79a][_0xdbea('0x65')]]]=_0xc610e4[_0x53b79a][_0xdbea('0x6a')];}}for(var _0x1f4e32 in _0x3aa9dd){if(!_0x2f645a['hasOwnProperty'](_0x3aa9dd[_0x1f4e32])){_0x2f645a[_0x3aa9dd[_0x1f4e32]]=null;}}_0x110bb6[_0xdbea('0x6b')](_0x2f645a);}return _0x110bb6;}})[_0xdbea('0x21')](function(_0x13affe){if(!_['isEmpty'](_0x13affe)){var _0x5a119a=toCsv(_0x13affe);var _0x19c731=Date['now']();fs[_0xdbea('0x6c')](util[_0xdbea('0x67')](_0xdbea('0x6d'),_0x35ea68[_0xdbea('0x4f')]['id'],_0x19c731),_0x5a119a);_0x43d9d1[_0xdbea('0x6e')](_0xdbea('0x6f'),_0xdbea('0x70')+util[_0xdbea('0x67')](_0xdbea('0x71'),_0x35ea68[_0xdbea('0x4f')]['id'],_0x19c731));_0x43d9d1[_0xdbea('0x6e')](_0xdbea('0x72'),_0xdbea('0x73'));return _0x43d9d1[_0xdbea('0x74')](util[_0xdbea('0x67')](_0xdbea('0x6d'),_0x35ea68['params']['id'],_0x19c731));}else{return _0x43d9d1[_0xdbea('0x14')](0xcc);}})['catch'](handleError(_0x43d9d1,null));}; \ No newline at end of file +var _0x6178=['UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','findOne','JscriptySessionReport','order','pick','ProjectId','findAll','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','question','format','SessionId','questionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Projects','sendStatus','error','send','index','map','JscriptyProject','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','params','catch','create','body','role'];(function(_0x5ed8f2,_0x4ab02d){var _0x49803d=function(_0x508539){while(--_0x508539){_0x5ed8f2['push'](_0x5ed8f2['shift']());}};_0x49803d(++_0x4ab02d);}(_0x6178,0x9f));var _0x8617=function(_0x37420b,_0x9f3340){_0x37420b=_0x37420b-0x0;var _0x531f8a=_0x6178[_0x37420b];return _0x531f8a;};'use strict';var pdf=require(_0x8617('0x0'));var emlformat=require(_0x8617('0x1'));var rimraf=require(_0x8617('0x2'));var zipdir=require(_0x8617('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8617('0x4'));var moment=require(_0x8617('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8617('0x6'));var util=require(_0x8617('0x7'));var path=require(_0x8617('0x8'));var sox=require('sox');var csv=require(_0x8617('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8617('0xa'));var squel=require(_0x8617('0xb'));var crypto=require(_0x8617('0xc'));var jsforce=require(_0x8617('0xd'));var deskjs=require(_0x8617('0xe'));var toCsv=require(_0x8617('0x9'));var querystring=require(_0x8617('0xf'));var Papa=require(_0x8617('0x10'));var Redis=require('ioredis');var authService=require(_0x8617('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8617('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8617('0x13'))(_0x8617('0x14'));var utils=require('../../config/utils');var config=require(_0x8617('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43701a,_0x5af201){_0x5af201=_0x5af201||0xcc;return function(_0x192df1){if(_0x192df1){return _0x43701a['sendStatus'](_0x5af201);}return _0x43701a[_0x8617('0x16')](_0x5af201)[_0x8617('0x17')]();};}function respondWithResult(_0x1cc316,_0x187ba0){_0x187ba0=_0x187ba0||0xc8;return function(_0x1a39f7){if(_0x1a39f7){return _0x1cc316[_0x8617('0x16')](_0x187ba0)[_0x8617('0x18')](_0x1a39f7);}};}function respondWithFilteredResult(_0xfd0741,_0x1f4e45){return function(_0x36c41d){if(_0x36c41d){var _0x288bd9=_0x36c41d[_0x8617('0x19')],_0x33fc4f=_0x1f4e45['offset'],_0xf8b2f0=_0x1f4e45[_0x8617('0x1a')]+_0x1f4e45[_0x8617('0x1b')],_0x5ec8a0;if(_0xf8b2f0>=_0x288bd9){_0xf8b2f0=_0x288bd9;_0x5ec8a0=0xc8;}else{_0x5ec8a0=0xce;}_0xfd0741[_0x8617('0x16')](_0x5ec8a0);return _0xfd0741['set'](_0x8617('0x1c'),_0x33fc4f+'-'+_0xf8b2f0+'/'+_0x288bd9)['json'](_0x36c41d);}return null;};}function patchUpdates(_0x3799fa){return function(_0x3c5f9c){try{jsonpatch[_0x8617('0x1d')](_0x3c5f9c,_0x3799fa,!![]);}catch(_0x38f718){return BPromise[_0x8617('0x1e')](_0x38f718);}return _0x3c5f9c[_0x8617('0x1f')]();};}function saveUpdates(_0x4ede94,_0x202bfd){return function(_0x3e7908){if(_0x3e7908){return _0x3e7908[_0x8617('0x20')](_0x4ede94)['then'](function(_0x4271a7){return _0x4271a7;});}return null;};}function removeEntity(_0x4ac27a,_0x1e68b1){return function(_0x5937b9){if(_0x5937b9){return _0x5937b9[_0x8617('0x21')]()[_0x8617('0x22')](function(){var _0x2d9c5f=_0x5937b9[_0x8617('0x23')]({'plain':!![]});var _0x388567=_0x8617('0x24');return db['UserProfileResource'][_0x8617('0x21')]({'where':{'type':_0x388567,'resourceId':_0x2d9c5f['id']}})[_0x8617('0x22')](function(){return _0x5937b9;});})['then'](function(){_0x4ac27a[_0x8617('0x16')](0xcc)[_0x8617('0x17')]();});}};}function handleEntityNotFound(_0x77f92a,_0x2816e1){return function(_0x5b95f6){if(!_0x5b95f6){_0x77f92a[_0x8617('0x25')](0x194);}return _0x5b95f6;};}function handleError(_0x5e28ca,_0x48f2f6){_0x48f2f6=_0x48f2f6||0x1f4;return function(_0x2c9e51){logger[_0x8617('0x26')](_0x2c9e51['stack']);if(_0x2c9e51['name']){delete _0x2c9e51['name'];}_0x5e28ca[_0x8617('0x16')](_0x48f2f6)[_0x8617('0x27')](_0x2c9e51);};}exports[_0x8617('0x28')]=function(_0x384d4a,_0x223e22){var _0xd73817={},_0x49b150={},_0x3f63fd={'count':0x0,'rows':[]};var _0x45641b=_[_0x8617('0x29')](db[_0x8617('0x2a')][_0x8617('0x2b')],function(_0xbe4343){return{'name':_0xbe4343['fieldName'],'type':_0xbe4343[_0x8617('0x2c')][_0x8617('0x2d')]};});_0x49b150[_0x8617('0x2e')]=_[_0x8617('0x29')](_0x45641b,_0x8617('0x2f'));_0x49b150[_0x8617('0x30')]=_[_0x8617('0x31')](_0x384d4a[_0x8617('0x30')]);_0x49b150[_0x8617('0x32')]=_[_0x8617('0x33')](_0x49b150[_0x8617('0x2e')],_0x49b150[_0x8617('0x30')]);_0xd73817[_0x8617('0x34')]=_[_0x8617('0x33')](_0x49b150['model'],qs[_0x8617('0x35')](_0x384d4a[_0x8617('0x30')][_0x8617('0x35')]));_0xd73817[_0x8617('0x34')]=_0xd73817['attributes'][_0x8617('0x36')]?_0xd73817['attributes']:_0x49b150['model'];if(!_0x384d4a[_0x8617('0x30')][_0x8617('0x37')](_0x8617('0x38'))){_0xd73817['limit']=qs[_0x8617('0x1b')](_0x384d4a[_0x8617('0x30')]['limit']);_0xd73817[_0x8617('0x1a')]=qs['offset'](_0x384d4a[_0x8617('0x30')][_0x8617('0x1a')]);}_0xd73817['order']=qs[_0x8617('0x39')](_0x384d4a[_0x8617('0x30')][_0x8617('0x39')]);_0xd73817[_0x8617('0x3a')]=qs['filters'](_['pick'](_0x384d4a[_0x8617('0x30')],_0x49b150[_0x8617('0x32')]),_0x45641b);if(_0x384d4a['query'][_0x8617('0x3b')]){_0xd73817[_0x8617('0x3a')]=_['merge'](_0xd73817['where'],{'$or':_[_0x8617('0x29')](_0x45641b,function(_0x48e5b5){if(_0x48e5b5[_0x8617('0x2c')]!==_0x8617('0x3c')){var _0x3d0837={};_0x3d0837[_0x48e5b5[_0x8617('0x2f')]]={'$like':'%'+_0x384d4a['query']['filter']+'%'};return _0x3d0837;}})});}_0xd73817=_[_0x8617('0x3d')]({},_0xd73817,_0x384d4a[_0x8617('0x3e')]);var _0x598a3f={'where':_0xd73817[_0x8617('0x3a')]};return db['JscriptyProject'][_0x8617('0x19')](_0x598a3f)['then'](function(_0x2037d5){_0x3f63fd[_0x8617('0x19')]=_0x2037d5;if(_0x384d4a[_0x8617('0x30')][_0x8617('0x3f')]){_0xd73817[_0x8617('0x40')]=[{'all':!![]}];}return db[_0x8617('0x2a')]['findAll'](_0xd73817);})[_0x8617('0x22')](function(_0x4ad693){_0x3f63fd[_0x8617('0x41')]=_0x4ad693;return _0x3f63fd;})[_0x8617('0x22')](respondWithFilteredResult(_0x223e22,_0xd73817))['catch'](handleError(_0x223e22,null));};exports['show']=function(_0x5d956a,_0x3c3041){var _0x571ace={'raw':![],'where':{'id':_0x5d956a[_0x8617('0x42')]['id']}},_0x2fd20d={};_0x2fd20d[_0x8617('0x2e')]=_['keys'](db[_0x8617('0x2a')][_0x8617('0x2b')]);_0x2fd20d['query']=_[_0x8617('0x31')](_0x5d956a[_0x8617('0x30')]);_0x2fd20d[_0x8617('0x32')]=_[_0x8617('0x33')](_0x2fd20d[_0x8617('0x2e')],_0x2fd20d['query']);_0x571ace['attributes']=_[_0x8617('0x33')](_0x2fd20d['model'],qs[_0x8617('0x35')](_0x5d956a[_0x8617('0x30')][_0x8617('0x35')]));_0x571ace['attributes']=_0x571ace[_0x8617('0x34')][_0x8617('0x36')]?_0x571ace['attributes']:_0x2fd20d[_0x8617('0x2e')];if(_0x5d956a[_0x8617('0x30')]['includeAll']){_0x571ace['include']=[{'all':!![]}];}_0x571ace=_[_0x8617('0x3d')]({},_0x571ace,_0x5d956a['options']);return db['JscriptyProject']['find'](_0x571ace)[_0x8617('0x22')](handleEntityNotFound(_0x3c3041,null))[_0x8617('0x22')](respondWithResult(_0x3c3041,null))[_0x8617('0x43')](handleError(_0x3c3041,null));};exports[_0x8617('0x44')]=function(_0x5b3996,_0x4347e5){return db['JscriptyProject']['create'](_0x5b3996[_0x8617('0x45')],{})['then'](function(_0x14f9e2){var _0x498778=_0x5b3996['user'][_0x8617('0x23')]({'plain':!![]});if(!_0x498778)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x498778[_0x8617('0x46')]==='user'){var _0x508fff=_0x14f9e2[_0x8617('0x23')]({'plain':!![]});var _0x193790=_0x8617('0x24');return db[_0x8617('0x47')][_0x8617('0x48')]({'where':{'name':_0x193790,'userProfileId':_0x498778['userProfileId']},'raw':!![]})[_0x8617('0x22')](function(_0x27ccb1){if(_0x27ccb1&&_0x27ccb1['autoAssociation']===0x0){return db[_0x8617('0x49')][_0x8617('0x44')]({'name':_0x508fff[_0x8617('0x2f')],'resourceId':_0x508fff['id'],'type':_0x27ccb1['name'],'sectionId':_0x27ccb1['id']},{})[_0x8617('0x22')](function(){return _0x14f9e2;});}else{return _0x14f9e2;}})['catch'](function(_0x5ee194){logger[_0x8617('0x26')](_0x8617('0x4a'),_0x5ee194);throw _0x5ee194;});}return _0x14f9e2;})[_0x8617('0x22')](respondWithResult(_0x4347e5,0xc9))[_0x8617('0x43')](handleError(_0x4347e5,null));};exports['clone']=function(_0x5eb4b2,_0x1f81cc){var _0x408b33={'where':{'id':_0x5eb4b2['params']['id']}},_0x31e160={};_0x31e160[_0x8617('0x2e')]=_[_0x8617('0x31')](db[_0x8617('0x2a')][_0x8617('0x2b')]);_0x408b33['attributes']=_[_0x8617('0x33')](_0x31e160[_0x8617('0x2e')],qs['fields'](_0x5eb4b2[_0x8617('0x30')][_0x8617('0x35')]));_0x408b33[_0x8617('0x34')]=_0x408b33[_0x8617('0x34')][_0x8617('0x36')]?_0x408b33[_0x8617('0x34')]:_0x31e160[_0x8617('0x2e')];if(_0x5eb4b2[_0x8617('0x30')][_0x8617('0x3f')]){_0x408b33[_0x8617('0x40')]=[{'all':!![]}];}_0x408b33=_[_0x8617('0x3d')]({},_0x408b33,_0x5eb4b2[_0x8617('0x3e')]);return db[_0x8617('0x2a')][_0x8617('0x48')](_0x408b33)[_0x8617('0x22')](handleEntityNotFound(_0x1f81cc,null))[_0x8617('0x22')](function(_0x25d788){if(_0x25d788){var _0x4e9e51=_0x25d788[_0x8617('0x23')]({'plain':!![]});_0x4e9e51=qs['omit'](_0x4e9e51,['id',_0x8617('0x4b'),_0x8617('0x4c')]);_0x5eb4b2[_0x8617('0x45')]=_[_0x8617('0x4d')](_0x5eb4b2[_0x8617('0x45')],['id',_0x8617('0x4b'),_0x8617('0x4c')]);return db[_0x8617('0x2a')][_0x8617('0x44')](_[_0x8617('0x3d')](_0x4e9e51,_0x5eb4b2['body']),{'include':_0x5eb4b2[_0x8617('0x30')][_0x8617('0x3f')]?[{'all':!![]}]:undefined})[_0x8617('0x22')](function(_0x10b47f){var _0x16f7dc=_0x5eb4b2['user'][_0x8617('0x23')]({'plain':!![]});if(!_0x16f7dc)throw new Error(_0x8617('0x4e'));if(_0x16f7dc['role']===_0x8617('0x4f')){var _0x2776a0=_0x10b47f[_0x8617('0x23')]({'plain':!![]});var _0x5eb252='Projects';return db[_0x8617('0x47')]['find']({'where':{'name':_0x5eb252,'userProfileId':_0x16f7dc[_0x8617('0x50')]},'raw':!![]})['then'](function(_0x35a300){if(_0x35a300&&_0x35a300[_0x8617('0x51')]===0x0){return db[_0x8617('0x49')][_0x8617('0x44')]({'name':_0x2776a0[_0x8617('0x2f')],'resourceId':_0x2776a0['id'],'type':_0x35a300[_0x8617('0x2f')],'sectionId':_0x35a300['id']},{})[_0x8617('0x22')](function(){return _0x10b47f;});}else{return _0x10b47f;}})['catch'](function(_0x4552c1){logger['error'](_0x8617('0x4a'),_0x4552c1);throw _0x4552c1;});}return _0x10b47f;});}})[_0x8617('0x22')](respondWithResult(_0x1f81cc,0xc9))[_0x8617('0x43')](handleError(_0x1f81cc,null));};exports[_0x8617('0x20')]=function(_0x1d8b22,_0x8ac34c){if(_0x1d8b22['body']['id']){delete _0x1d8b22[_0x8617('0x45')]['id'];}return db[_0x8617('0x2a')][_0x8617('0x48')]({'where':{'id':_0x1d8b22['params']['id']}})[_0x8617('0x22')](handleEntityNotFound(_0x8ac34c,null))[_0x8617('0x22')](saveUpdates(_0x1d8b22[_0x8617('0x45')],null))['then'](respondWithResult(_0x8ac34c,null))[_0x8617('0x43')](handleError(_0x8ac34c,null));};exports[_0x8617('0x21')]=function(_0x23e055,_0x1e1664){return db[_0x8617('0x2a')]['find']({'where':{'id':_0x23e055[_0x8617('0x42')]['id']}})[_0x8617('0x22')](handleEntityNotFound(_0x1e1664,null))[_0x8617('0x22')](removeEntity(_0x1e1664,null))['catch'](handleError(_0x1e1664,null));};exports['getSessions']=function(_0x301790,_0x4177d2,_0x1cd4db){var _0x5aef01={'raw':!![],'where':{}};var _0x4fe894={};var _0x8e9c9c={'count':0x0,'rows':[]};return db[_0x8617('0x2a')][_0x8617('0x52')]({'where':{'id':_0x301790[_0x8617('0x42')]['id']}})[_0x8617('0x22')](handleEntityNotFound(_0x4177d2,null))[_0x8617('0x22')](function(_0x2f271e){if(_0x2f271e){_0x4fe894[_0x8617('0x2e')]=_['keys'](db[_0x8617('0x53')][_0x8617('0x2b')]);_0x4fe894[_0x8617('0x30')]=_[_0x8617('0x31')](_0x301790['query']);_0x4fe894[_0x8617('0x32')]=_[_0x8617('0x33')](_0x4fe894[_0x8617('0x2e')],_0x4fe894['query']);_0x5aef01[_0x8617('0x34')]=_[_0x8617('0x33')](_0x4fe894[_0x8617('0x2e')],qs[_0x8617('0x35')](_0x301790[_0x8617('0x30')]['fields']));_0x5aef01[_0x8617('0x34')]=_0x5aef01[_0x8617('0x34')][_0x8617('0x36')]?_0x5aef01[_0x8617('0x34')]:_0x4fe894[_0x8617('0x2e')];if(!_0x301790[_0x8617('0x30')][_0x8617('0x37')](_0x8617('0x38'))){_0x5aef01[_0x8617('0x1b')]=qs[_0x8617('0x1b')](_0x301790['query'][_0x8617('0x1b')]);_0x5aef01[_0x8617('0x1a')]=qs['offset'](_0x301790['query'][_0x8617('0x1a')]);}_0x5aef01[_0x8617('0x54')]=qs[_0x8617('0x39')](_0x301790['query'][_0x8617('0x39')]);_0x5aef01[_0x8617('0x3a')]=qs[_0x8617('0x32')](_[_0x8617('0x55')](_0x301790['query'],_0x4fe894['filters']));_0x5aef01[_0x8617('0x3a')][_0x8617('0x56')]=_0x2f271e['id'];if(_0x301790[_0x8617('0x30')][_0x8617('0x3b')]){_0x5aef01[_0x8617('0x3a')]=_[_0x8617('0x3d')](_0x5aef01[_0x8617('0x3a')],{'$or':_['map'](_0x5aef01[_0x8617('0x34')],function(_0x24449b){var _0x157163={};_0x157163[_0x24449b]={'$like':'%'+_0x301790[_0x8617('0x30')]['filter']+'%'};return _0x157163;})});}_0x5aef01=_[_0x8617('0x3d')]({},_0x5aef01,_0x301790[_0x8617('0x3e')]);return db['JscriptySessionReport'][_0x8617('0x19')]({'where':_0x5aef01[_0x8617('0x3a')]})[_0x8617('0x22')](function(_0x12da5c){_0x8e9c9c['count']=_0x12da5c;if(_0x301790[_0x8617('0x30')]['includeAll']){_0x5aef01[_0x8617('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x8617('0x57')](_0x5aef01);})[_0x8617('0x22')](function(_0x38b376){_0x8e9c9c[_0x8617('0x41')]=_0x38b376;return _0x8e9c9c;});}})['then'](respondWithFilteredResult(_0x4177d2,_0x5aef01))[_0x8617('0x43')](handleError(_0x4177d2,null));};exports['getAnswers']=function(_0x21f173,_0x1de665,_0x2b7e8d){var _0x29274a={'raw':!![],'where':{}};var _0x424086={};var _0x546818={'count':0x0,'rows':[]};return db[_0x8617('0x2a')][_0x8617('0x52')]({'where':{'id':_0x21f173[_0x8617('0x42')]['id']}})[_0x8617('0x22')](handleEntityNotFound(_0x1de665,null))[_0x8617('0x22')](function(_0x2a2eae){if(_0x2a2eae){_0x424086[_0x8617('0x2e')]=_[_0x8617('0x31')](db[_0x8617('0x58')]['rawAttributes']);_0x424086[_0x8617('0x30')]=_[_0x8617('0x31')](_0x21f173[_0x8617('0x30')]);_0x424086[_0x8617('0x32')]=_[_0x8617('0x33')](_0x424086['model'],_0x424086[_0x8617('0x30')]);_0x29274a[_0x8617('0x34')]=_[_0x8617('0x33')](_0x424086[_0x8617('0x2e')],qs[_0x8617('0x35')](_0x21f173['query'][_0x8617('0x35')]));_0x29274a['attributes']=_0x29274a[_0x8617('0x34')][_0x8617('0x36')]?_0x29274a['attributes']:_0x424086['model'];if(!_0x21f173[_0x8617('0x30')][_0x8617('0x37')](_0x8617('0x38'))){_0x29274a[_0x8617('0x1b')]=qs['limit'](_0x21f173[_0x8617('0x30')][_0x8617('0x1b')]);_0x29274a[_0x8617('0x1a')]=qs[_0x8617('0x1a')](_0x21f173['query']['offset']);}_0x29274a['order']=qs[_0x8617('0x39')](_0x21f173[_0x8617('0x30')][_0x8617('0x39')]);_0x29274a['where']=qs[_0x8617('0x32')](_[_0x8617('0x55')](_0x21f173[_0x8617('0x30')],_0x424086['filters']));_0x29274a['where'][_0x8617('0x56')]=_0x2a2eae['id'];if(_0x21f173['query']['filter']){_0x29274a['where']=_['merge'](_0x29274a[_0x8617('0x3a')],{'$or':_[_0x8617('0x29')](_0x29274a[_0x8617('0x34')],function(_0x2f98a6){var _0x13928c={};_0x13928c[_0x2f98a6]={'$like':'%'+_0x21f173['query'][_0x8617('0x3b')]+'%'};return _0x13928c;})});}_0x29274a=_[_0x8617('0x3d')]({},_0x29274a,_0x21f173[_0x8617('0x3e')]);return db['JscriptyAnswerReport'][_0x8617('0x19')]({'where':_0x29274a[_0x8617('0x3a')]})[_0x8617('0x22')](function(_0x1eb14b){_0x546818['count']=_0x1eb14b;if(_0x21f173[_0x8617('0x30')]['includeAll']){_0x29274a['include']=[{'all':!![]}];}return db[_0x8617('0x58')]['findAll'](_0x29274a);})[_0x8617('0x22')](function(_0x13ff98){_0x546818[_0x8617('0x41')]=_0x13ff98;return _0x546818;});}})[_0x8617('0x22')](respondWithFilteredResult(_0x1de665,_0x29274a))[_0x8617('0x43')](handleError(_0x1de665,null));};function char(_0x3bfd53){return _0x8617('0x59')===typeof _0x3bfd53?String[_0x8617('0x5a')]['apply'](null,arguments):_0x3bfd53;}function needsEncapsulation(_0x11606a){return!!_0x11606a&&(_0x11606a[_0x8617('0x5b')]()[_0x8617('0x5c')](char(0xd))>=0x0||_0x11606a[_0x8617('0x5b')]()['indexOf'](char(0xa))>=0x0||_0x11606a['toString']()[_0x8617('0x5c')](char(0x2c))>=0x0||_0x11606a['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x589fc7){var _0x557896=char(0x22),_0xfa125='\x5c'+char(0x22),_0x86e138=_0x589fc7[_0x8617('0x5b')]()[_0x8617('0x5d')](new RegExp(_0x557896,'g'),_0xfa125);return _0x557896+_0x86e138+_0x557896;}exports[_0x8617('0x5e')]=function(_0x45a8d2,_0xde966c,_0x1fca90){var _0x3cdbf4,_0x27e4f5;var _0x264fb7={'where':{'ProjectId':_0x45a8d2[_0x8617('0x42')]['id']}};if(_0x45a8d2[_0x8617('0x30')]['startTime']){_0x264fb7[_0x8617('0x3a')][_0x8617('0x5f')]=JSON[_0x8617('0x60')](_0x45a8d2[_0x8617('0x30')][_0x8617('0x61')]);}return db[_0x8617('0x53')]['findAll'](_0x264fb7)[_0x8617('0x22')](handleEntityNotFound(_0xde966c,null))['then'](function(_0x251bcc){if(_0x251bcc){_0x3cdbf4=_0x251bcc;return db[_0x8617('0x62')][_0x8617('0x57')]({'where':{'SessionId':{'$in':_[_0x8617('0x29')](_0x3cdbf4,'id')},'ProjectId':_0x45a8d2[_0x8617('0x42')]['id']},'order':_0x8617('0x63')});}})[_0x8617('0x22')](handleEntityNotFound(_0xde966c,null))['then'](function(_0x20358d){if(_0x20358d){_0x27e4f5=_0x20358d;var _0x38154b={};for(var _0x87be6a=0x0,_0x58329c=_0x27e4f5[_0x8617('0x36')];_0x87be6a<_0x58329c;_0x87be6a++){if(!_0x38154b[_0x8617('0x37')](_0x27e4f5[_0x87be6a]['questionId'])){_0x38154b[_0x27e4f5[_0x87be6a]['questionId']]=needsEncapsulation(_0x27e4f5[_0x87be6a][_0x8617('0x64')])?encapsulate(_0x27e4f5[_0x87be6a][_0x8617('0x64')]):_0x27e4f5[_0x87be6a][_0x8617('0x64')];}}var _0x327e5b=[],_0x95ceaa={};for(var _0xef6654=0x0,_0x3cec60=_0x3cdbf4[_0x8617('0x36')];_0xef6654<_0x3cec60;_0xef6654++){_0x95ceaa={'ProjectId':_0x45a8d2[_0x8617('0x42')]['id'],'SessionId':_0x3cdbf4[_0xef6654]['id'],'StartTime':moment(_0x3cdbf4[_0xef6654]['starttime'])[_0x8617('0x65')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5b9e66=0x0,_0x80d679=_0x27e4f5['length'];_0x5b9e66<_0x80d679;_0x5b9e66++){if(_0x27e4f5[_0x5b9e66][_0x8617('0x66')]==_0x3cdbf4[_0xef6654]['id']&&_0x38154b['hasOwnProperty'](_0x27e4f5[_0x5b9e66][_0x8617('0x67')])){_0x95ceaa[_0x38154b[_0x27e4f5[_0x5b9e66][_0x8617('0x67')]]]=_0x27e4f5[_0x5b9e66][_0x8617('0x68')];}}for(var _0x34e97e in _0x38154b){if(!_0x95ceaa['hasOwnProperty'](_0x38154b[_0x34e97e])){_0x95ceaa[_0x38154b[_0x34e97e]]=null;}}_0x327e5b[_0x8617('0x69')](_0x95ceaa);}return _0x327e5b;}})[_0x8617('0x22')](function(_0x4eba2a){if(!_[_0x8617('0x6a')](_0x4eba2a)){var _0x5182e1=toCsv(_0x4eba2a);var _0x59fb16=Date[_0x8617('0x6b')]();fs[_0x8617('0x6c')](util[_0x8617('0x65')](_0x8617('0x6d'),_0x45a8d2[_0x8617('0x42')]['id'],_0x59fb16),_0x5182e1);_0xde966c[_0x8617('0x6e')]('Content-disposition',_0x8617('0x6f')+util[_0x8617('0x65')](_0x8617('0x70'),_0x45a8d2[_0x8617('0x42')]['id'],_0x59fb16));_0xde966c[_0x8617('0x6e')](_0x8617('0x71'),'text/csv');return _0xde966c[_0x8617('0x72')](util['format'](_0x8617('0x6d'),_0x45a8d2[_0x8617('0x42')]['id'],_0x59fb16));}else{return _0xde966c[_0x8617('0x25')](0xcc);}})[_0x8617('0x43')](handleError(_0xde966c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index dbbb108..19f8e90 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 _0x94d3=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x512808,_0x27dcbe){var _0x369835=function(_0x590645){while(--_0x590645){_0x512808['push'](_0x512808['shift']());}};_0x369835(++_0x27dcbe);}(_0x94d3,0x94));var _0x394d=function(_0x5326d1,_0x1ad65a){_0x5326d1=_0x5326d1-0x0;var _0x2b9817=_0x94d3[_0x5326d1];return _0x2b9817;};'use strict';var _=require(_0x394d('0x0'));var util=require(_0x394d('0x1'));var logger=require(_0x394d('0x2'))(_0x394d('0x3'));var moment=require(_0x394d('0x4'));var BPromise=require('bluebird');var rp=require(_0x394d('0x5'));var fs=require('fs');var path=require(_0x394d('0x6'));var rimraf=require(_0x394d('0x7'));var config=require(_0x394d('0x8'));var attributes=require(_0x394d('0x9'));module['exports']=function(_0x450012,_0x25cda1){return _0x450012[_0x394d('0xa')](_0x394d('0xb'),attributes,{'tableName':_0x394d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc29c=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment'];(function(_0x3e5d09,_0x36a139){var _0x47d1e=function(_0x4bd133){while(--_0x4bd133){_0x3e5d09['push'](_0x3e5d09['shift']());}};_0x47d1e(++_0x36a139);}(_0xc29c,0x105));var _0xcc29=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0xc29c[_0x5a187b];return _0x14d601;};'use strict';var _=require(_0xcc29('0x0'));var util=require(_0xcc29('0x1'));var logger=require(_0xcc29('0x2'))(_0xcc29('0x3'));var moment=require(_0xcc29('0x4'));var BPromise=require(_0xcc29('0x5'));var rp=require(_0xcc29('0x6'));var fs=require('fs');var path=require(_0xcc29('0x7'));var rimraf=require(_0xcc29('0x8'));var config=require(_0xcc29('0x9'));var attributes=require(_0xcc29('0xa'));module[_0xcc29('0xb')]=function(_0x10f8c4,_0x30f43a){return _0x10f8c4['define'](_0xcc29('0xc'),attributes,{'tableName':_0xcc29('0xd'),'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 6060381..cc65ac9 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 _0xbc1f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','result','catch'];(function(_0x32dc2f,_0x427b7e){var _0x59da9a=function(_0x4de4a5){while(--_0x4de4a5){_0x32dc2f['push'](_0x32dc2f['shift']());}};_0x59da9a(++_0x427b7e);}(_0xbc1f,0x18f));var _0xfbc1=function(_0x426ffd,_0x26644e){_0x426ffd=_0x426ffd-0x0;var _0x505173=_0xbc1f[_0x426ffd];return _0x505173;};'use strict';var _=require('lodash');var util=require(_0xfbc1('0x0'));var moment=require(_0xfbc1('0x1'));var BPromise=require(_0xfbc1('0x2'));var rs=require(_0xfbc1('0x3'));var fs=require('fs');var Redis=require(_0xfbc1('0x4'));var db=require(_0xfbc1('0x5'))['db'];var utils=require(_0xfbc1('0x6'));var logger=require(_0xfbc1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfbc1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a28e0,_0x4cf0f7,_0x1603b8){return new BPromise(function(_0x5fcda8,_0x404de0){return client[_0xfbc1('0x9')](_0x4a28e0,_0x1603b8)[_0xfbc1('0xa')](function(_0x2a8369){logger[_0xfbc1('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0xfbc1('0xc'));logger['debug'](_0xfbc1('0xd'),_0x4cf0f7,'request\x20sent',JSON[_0xfbc1('0xe')](_0x2a8369));if(_0x2a8369['error']){if(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x10')]===0x1f4){logger[_0xfbc1('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);return _0x404de0(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);}logger[_0xfbc1('0xf')](_0xfbc1('0x12'),_0x4cf0f7,_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);return _0x5fcda8(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);}else{logger[_0xfbc1('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0xfbc1('0xc'));_0x5fcda8(_0x2a8369[_0xfbc1('0x13')][_0xfbc1('0x11')]);}})[_0xfbc1('0x14')](function(_0x23a7fb){logger[_0xfbc1('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0x23a7fb);_0x404de0(_0x23a7fb);});});} \ No newline at end of file +var _0x7f22=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x7f22,0x1ba));var _0x27f2=function(_0x5ed0e7,_0x3cb09c){_0x5ed0e7=_0x5ed0e7-0x0;var _0xd29408=_0x7f22[_0x5ed0e7];return _0xd29408;};'use strict';var _=require(_0x27f2('0x0'));var util=require(_0x27f2('0x1'));var moment=require(_0x27f2('0x2'));var BPromise=require(_0x27f2('0x3'));var rs=require(_0x27f2('0x4'));var fs=require('fs');var Redis=require(_0x27f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x27f2('0x6'));var logger=require(_0x27f2('0x7'))(_0x27f2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x27f2('0x9')][_0x27f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb568,_0x9b6d4e,_0x5da1fb){return new BPromise(function(_0x465364,_0x51cefc){return client[_0x27f2('0xb')](_0x5eb568,_0x5da1fb)[_0x27f2('0xc')](function(_0x6850a0){logger['info'](_0x27f2('0xd'),_0x9b6d4e,'request\x20sent');logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x9b6d4e,_0x27f2('0xe'),JSON[_0x27f2('0xf')](_0x6850a0));if(_0x6850a0['error']){if(_0x6850a0[_0x27f2('0x10')]['code']===0x1f4){logger[_0x27f2('0x10')](_0x27f2('0xd'),_0x9b6d4e,_0x6850a0[_0x27f2('0x10')][_0x27f2('0x11')]);return _0x51cefc(_0x6850a0[_0x27f2('0x10')][_0x27f2('0x11')]);}logger[_0x27f2('0x10')](_0x27f2('0xd'),_0x9b6d4e,_0x6850a0[_0x27f2('0x10')]['message']);return _0x465364(_0x6850a0[_0x27f2('0x10')]['message']);}else{logger[_0x27f2('0x12')](_0x27f2('0xd'),_0x9b6d4e,_0x27f2('0xe'));_0x465364(_0x6850a0[_0x27f2('0x13')][_0x27f2('0x11')]);}})[_0x27f2('0x14')](function(_0x16b40c){logger[_0x27f2('0x10')](_0x27f2('0xd'),_0x9b6d4e,_0x16b40c);_0x51cefc(_0x16b40c);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 64c1408..12efbf6 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 _0x8e8b=['/:id','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated'];(function(_0x2fe5b9,_0x127e48){var _0x6f874=function(_0x23f8e7){while(--_0x23f8e7){_0x2fe5b9['push'](_0x2fe5b9['shift']());}};_0x6f874(++_0x127e48);}(_0x8e8b,0x1a5));var _0xb8e8=function(_0x2e3b71,_0x30094a){_0x2e3b71=_0x2e3b71-0x0;var _0x19bfc8=_0x8e8b[_0x2e3b71];return _0x19bfc8;};'use strict';var multer=require(_0xb8e8('0x0'));var util=require(_0xb8e8('0x1'));var path=require(_0xb8e8('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8e8('0x3'));var router=express[_0xb8e8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb8e8('0x5'));var config=require(_0xb8e8('0x6'));var controller=require(_0xb8e8('0x7'));router[_0xb8e8('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8e8('0x9')]);router['get']('/describe',auth[_0xb8e8('0xa')](),controller['describe']);router[_0xb8e8('0x8')](_0xb8e8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb8e8('0xc')]('/',auth[_0xb8e8('0xa')](),controller[_0xb8e8('0xd')]);router[_0xb8e8('0xe')](_0xb8e8('0xb'),auth[_0xb8e8('0xa')](),controller[_0xb8e8('0xf')]);router[_0xb8e8('0x10')](_0xb8e8('0xb'),auth[_0xb8e8('0xa')](),controller['destroy']);module[_0xb8e8('0x11')]=router; \ No newline at end of file +var _0x17f7=['create','update','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x13219f,_0x13c6e7){var _0x387ee6=function(_0x255112){while(--_0x255112){_0x13219f['push'](_0x13219f['shift']());}};_0x387ee6(++_0x13c6e7);}(_0x17f7,0x16b));var _0x717f=function(_0x24b08a,_0x58c333){_0x24b08a=_0x24b08a-0x0;var _0x4a8b06=_0x17f7[_0x24b08a];return _0x4a8b06;};'use strict';var multer=require(_0x717f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x717f('0x1'));var express=require(_0x717f('0x2'));var router=express[_0x717f('0x3')]();var auth=require(_0x717f('0x4'));var interaction=require(_0x717f('0x5'));var config=require('../../config/environment');var controller=require(_0x717f('0x6'));router[_0x717f('0x7')]('/',auth[_0x717f('0x8')](),controller[_0x717f('0x9')]);router[_0x717f('0x7')](_0x717f('0xa'),auth['isAuthenticated'](),controller[_0x717f('0xb')]);router['get'](_0x717f('0xc'),auth[_0x717f('0x8')](),controller[_0x717f('0xd')]);router[_0x717f('0xe')]('/',auth[_0x717f('0x8')](),controller[_0x717f('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x717f('0x10')]);router[_0x717f('0x11')](_0x717f('0xc'),auth[_0x717f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 389de2a..dc2f166 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 _0xe6e9=['TEXT','exports','STRING'];(function(_0x198445,_0xc6c075){var _0x5efc34=function(_0x4902c8){while(--_0x4902c8){_0x198445['push'](_0x198445['shift']());}};_0x5efc34(++_0xc6c075);}(_0xe6e9,0x16c));var _0x9e6e=function(_0x2f4467,_0x5f2175){_0x2f4467=_0x2f4467-0x0;var _0x3a60c3=_0xe6e9[_0x2f4467];return _0x3a60c3;};'use strict';var Sequelize=require('sequelize');module[_0x9e6e('0x0')]={'question':{'type':Sequelize[_0x9e6e('0x1')]},'answer':{'type':Sequelize[_0x9e6e('0x2')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x9e6e('0x1')]},'queue':{'type':Sequelize[_0x9e6e('0x1')]},'uniqueid':{'type':Sequelize[_0x9e6e('0x1')]},'calleridname':{'type':Sequelize[_0x9e6e('0x1')]},'calleridnum':{'type':Sequelize[_0x9e6e('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc784=['exports','STRING','long','sequelize'];(function(_0x2f1339,_0x429823){var _0x2054c5=function(_0x3aeadb){while(--_0x3aeadb){_0x2f1339['push'](_0x2f1339['shift']());}};_0x2054c5(++_0x429823);}(_0xc784,0x1e3));var _0x4c78=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0xc784[_0x281e5e];return _0x5a22d2;};'use strict';var Sequelize=require(_0x4c78('0x0'));module[_0x4c78('0x1')]={'question':{'type':Sequelize[_0x4c78('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x4c78('0x3'))},'membername':{'type':Sequelize[_0x4c78('0x2')]},'projectname':{'type':Sequelize[_0x4c78('0x2')]},'queue':{'type':Sequelize[_0x4c78('0x2')]},'uniqueid':{'type':Sequelize[_0x4c78('0x2')]},'calleridname':{'type':Sequelize[_0x4c78('0x2')]},'calleridnum':{'type':Sequelize[_0x4c78('0x2')]},'questionId':{'type':Sequelize[_0x4c78('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 00c6a3e..0e26511 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 _0x7c6c=['options','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','describe','html-pdf','eml-format','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1ab90b,_0x1cfd37){var _0x127584=function(_0x56c734){while(--_0x56c734){_0x1ab90b['push'](_0x1ab90b['shift']());}};_0x127584(++_0x1cfd37);}(_0x7c6c,0xb5));var _0xc7c6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7c6c[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xc7c6('0x0'));var emlformat=require(_0xc7c6('0x1'));var rimraf=require(_0xc7c6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7c6('0x3'));var rp=require(_0xc7c6('0x4'));var moment=require(_0xc7c6('0x5'));var BPromise=require(_0xc7c6('0x6'));var Mustache=require(_0xc7c6('0x7'));var util=require(_0xc7c6('0x8'));var path=require(_0xc7c6('0x9'));var sox=require(_0xc7c6('0xa'));var csv=require(_0xc7c6('0xb'));var ejs=require(_0xc7c6('0xc'));var fs=require('fs');var _=require(_0xc7c6('0xd'));var squel=require(_0xc7c6('0xe'));var crypto=require('crypto');var jsforce=require(_0xc7c6('0xf'));var deskjs=require(_0xc7c6('0x10'));var toCsv=require(_0xc7c6('0xb'));var querystring=require(_0xc7c6('0x11'));var Papa=require(_0xc7c6('0x12'));var Redis=require(_0xc7c6('0x13'));var authService=require(_0xc7c6('0x14'));var qs=require(_0xc7c6('0x15'));var as=require(_0xc7c6('0x16'));var hardwareService=require(_0xc7c6('0x17'));var logger=require(_0xc7c6('0x18'))(_0xc7c6('0x19'));var utils=require(_0xc7c6('0x1a'));var config=require(_0xc7c6('0x1b'));var db=require(_0xc7c6('0x1c'))['db'];function respondWithStatusCode(_0x19a6dd,_0x52cf52){_0x52cf52=_0x52cf52||0xcc;return function(_0x4543e6){if(_0x4543e6){return _0x19a6dd[_0xc7c6('0x1d')](_0x52cf52);}return _0x19a6dd[_0xc7c6('0x1e')](_0x52cf52)['end']();};}function respondWithResult(_0x2b3802,_0x442c26){_0x442c26=_0x442c26||0xc8;return function(_0x388d56){if(_0x388d56){return _0x2b3802[_0xc7c6('0x1e')](_0x442c26)[_0xc7c6('0x1f')](_0x388d56);}};}function respondWithFilteredResult(_0x41154,_0x5ccc7a){return function(_0x4e7c2f){if(_0x4e7c2f){var _0x516aee=_0x4e7c2f[_0xc7c6('0x20')],_0x37e18d=_0x5ccc7a[_0xc7c6('0x21')],_0x2d820f=_0x5ccc7a[_0xc7c6('0x21')]+_0x5ccc7a[_0xc7c6('0x22')],_0x2f5fdf;if(_0x2d820f>=_0x516aee){_0x2d820f=_0x516aee;_0x2f5fdf=0xc8;}else{_0x2f5fdf=0xce;}_0x41154[_0xc7c6('0x1e')](_0x2f5fdf);return _0x41154[_0xc7c6('0x23')](_0xc7c6('0x24'),_0x37e18d+'-'+_0x2d820f+'/'+_0x516aee)[_0xc7c6('0x1f')](_0x4e7c2f);}return null;};}function patchUpdates(_0x245514){return function(_0x215d15){try{jsonpatch[_0xc7c6('0x25')](_0x215d15,_0x245514,!![]);}catch(_0x2c76ea){return BPromise[_0xc7c6('0x26')](_0x2c76ea);}return _0x215d15[_0xc7c6('0x27')]();};}function saveUpdates(_0x447e40,_0x3219e9){return function(_0x5048c6){if(_0x5048c6){return _0x5048c6['update'](_0x447e40)['then'](function(_0x4f3457){return _0x4f3457;});}return null;};}function removeEntity(_0x50b95d,_0x531b47){return function(_0x2397c2){if(_0x2397c2){return _0x2397c2[_0xc7c6('0x28')]()[_0xc7c6('0x29')](function(){_0x50b95d['status'](0xcc)[_0xc7c6('0x2a')]();});}};}function handleEntityNotFound(_0x54f5cc,_0x48775c){return function(_0x1135c0){if(!_0x1135c0){_0x54f5cc[_0xc7c6('0x1d')](0x194);}return _0x1135c0;};}function handleError(_0x1a6873,_0x3eed10){_0x3eed10=_0x3eed10||0x1f4;return function(_0x3f243c){logger[_0xc7c6('0x2b')](_0x3f243c[_0xc7c6('0x2c')]);if(_0x3f243c[_0xc7c6('0x2d')]){delete _0x3f243c['name'];}_0x1a6873[_0xc7c6('0x1e')](_0x3eed10)[_0xc7c6('0x2e')](_0x3f243c);};}exports[_0xc7c6('0x2f')]=function(_0x49ff2d,_0x5b1a05){var _0x129ff7={},_0xab1914={},_0x2df848={'count':0x0,'rows':[]};var _0xd62d7a=_[_0xc7c6('0x30')](db[_0xc7c6('0x31')][_0xc7c6('0x32')],function(_0x57aa64){return{'name':_0x57aa64[_0xc7c6('0x33')],'type':_0x57aa64[_0xc7c6('0x34')][_0xc7c6('0x35')]};});_0xab1914[_0xc7c6('0x36')]=_[_0xc7c6('0x30')](_0xd62d7a,_0xc7c6('0x2d'));_0xab1914['query']=_[_0xc7c6('0x37')](_0x49ff2d['query']);_0xab1914[_0xc7c6('0x38')]=_['intersection'](_0xab1914['model'],_0xab1914[_0xc7c6('0x39')]);_0x129ff7['attributes']=_[_0xc7c6('0x3a')](_0xab1914[_0xc7c6('0x36')],qs[_0xc7c6('0x3b')](_0x49ff2d['query']['fields']));_0x129ff7[_0xc7c6('0x3c')]=_0x129ff7['attributes'][_0xc7c6('0x3d')]?_0x129ff7['attributes']:_0xab1914[_0xc7c6('0x36')];if(!_0x49ff2d[_0xc7c6('0x39')][_0xc7c6('0x3e')](_0xc7c6('0x3f'))){_0x129ff7[_0xc7c6('0x22')]=qs[_0xc7c6('0x22')](_0x49ff2d[_0xc7c6('0x39')][_0xc7c6('0x22')]);_0x129ff7['offset']=qs[_0xc7c6('0x21')](_0x49ff2d[_0xc7c6('0x39')][_0xc7c6('0x21')]);}_0x129ff7[_0xc7c6('0x40')]=qs[_0xc7c6('0x41')](_0x49ff2d['query'][_0xc7c6('0x41')]);_0x129ff7[_0xc7c6('0x42')]=qs[_0xc7c6('0x38')](_[_0xc7c6('0x43')](_0x49ff2d[_0xc7c6('0x39')],_0xab1914[_0xc7c6('0x38')]),_0xd62d7a);if(_0x49ff2d[_0xc7c6('0x39')][_0xc7c6('0x44')]){_0x129ff7[_0xc7c6('0x42')]=_[_0xc7c6('0x45')](_0x129ff7[_0xc7c6('0x42')],{'$or':_['map'](_0xd62d7a,function(_0xa670bf){if(_0xa670bf[_0xc7c6('0x34')]!==_0xc7c6('0x46')){var _0x5a2253={};_0x5a2253[_0xa670bf[_0xc7c6('0x2d')]]={'$like':'%'+_0x49ff2d['query']['filter']+'%'};return _0x5a2253;}})});}_0x129ff7=_[_0xc7c6('0x45')]({},_0x129ff7,_0x49ff2d[_0xc7c6('0x47')]);var _0x37a27d={'where':_0x129ff7['where']};return db[_0xc7c6('0x31')]['count'](_0x37a27d)['then'](function(_0x2d6208){_0x2df848[_0xc7c6('0x20')]=_0x2d6208;if(_0x49ff2d[_0xc7c6('0x39')]['includeAll']){_0x129ff7[_0xc7c6('0x48')]=[{'all':!![]}];}return db[_0xc7c6('0x31')][_0xc7c6('0x49')](_0x129ff7);})[_0xc7c6('0x29')](function(_0x2b60aa){_0x2df848[_0xc7c6('0x4a')]=_0x2b60aa;return _0x2df848;})['then'](respondWithFilteredResult(_0x5b1a05,_0x129ff7))[_0xc7c6('0x4b')](handleError(_0x5b1a05,null));};exports[_0xc7c6('0x4c')]=function(_0x222cff,_0xccbd26){var _0x23df16={'raw':!![],'where':{'id':_0x222cff['params']['id']}},_0x4d0356={};_0x4d0356['model']=_['keys'](db['JscriptyQuestionReport'][_0xc7c6('0x32')]);_0x4d0356['query']=_[_0xc7c6('0x37')](_0x222cff[_0xc7c6('0x39')]);_0x4d0356[_0xc7c6('0x38')]=_[_0xc7c6('0x3a')](_0x4d0356[_0xc7c6('0x36')],_0x4d0356[_0xc7c6('0x39')]);_0x23df16[_0xc7c6('0x3c')]=_[_0xc7c6('0x3a')](_0x4d0356[_0xc7c6('0x36')],qs[_0xc7c6('0x3b')](_0x222cff['query']['fields']));_0x23df16[_0xc7c6('0x3c')]=_0x23df16[_0xc7c6('0x3c')][_0xc7c6('0x3d')]?_0x23df16[_0xc7c6('0x3c')]:_0x4d0356['model'];if(_0x222cff[_0xc7c6('0x39')][_0xc7c6('0x4d')]){_0x23df16[_0xc7c6('0x48')]=[{'all':!![]}];}_0x23df16=_['merge']({},_0x23df16,_0x222cff[_0xc7c6('0x47')]);return db[_0xc7c6('0x31')][_0xc7c6('0x4e')](_0x23df16)['then'](handleEntityNotFound(_0xccbd26,null))[_0xc7c6('0x29')](respondWithResult(_0xccbd26,null))[_0xc7c6('0x4b')](handleError(_0xccbd26,null));};exports[_0xc7c6('0x4f')]=function(_0x1eaf4d,_0xb63937){return db['JscriptyQuestionReport'][_0xc7c6('0x4f')](_0x1eaf4d[_0xc7c6('0x50')],{})[_0xc7c6('0x29')](respondWithResult(_0xb63937,0xc9))[_0xc7c6('0x4b')](handleError(_0xb63937,null));};exports[_0xc7c6('0x51')]=function(_0x41cb1f,_0x340852){if(_0x41cb1f[_0xc7c6('0x50')]['id']){delete _0x41cb1f[_0xc7c6('0x50')]['id'];}return db['JscriptyQuestionReport'][_0xc7c6('0x4e')]({'where':{'id':_0x41cb1f[_0xc7c6('0x52')]['id']}})[_0xc7c6('0x29')](handleEntityNotFound(_0x340852,null))[_0xc7c6('0x29')](saveUpdates(_0x41cb1f[_0xc7c6('0x50')],null))['then'](respondWithResult(_0x340852,null))[_0xc7c6('0x4b')](handleError(_0x340852,null));};exports['destroy']=function(_0x535831,_0x5e3c11){return db[_0xc7c6('0x31')][_0xc7c6('0x4e')]({'where':{'id':_0x535831[_0xc7c6('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e3c11,null))[_0xc7c6('0x29')](removeEntity(_0x5e3c11,null))[_0xc7c6('0x4b')](handleError(_0x5e3c11,null));};exports[_0xc7c6('0x53')]=function(_0x38806d,_0x11f7f2){return db['JscriptyQuestionReport'][_0xc7c6('0x53')]()['then'](respondWithResult(_0x11f7f2,null))[_0xc7c6('0x4b')](handleError(_0x11f7f2,null));}; \ No newline at end of file +var _0x5a6d=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','fields','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x3f43ef,_0x4c2ba9){var _0x20af43=function(_0x17fb2b){while(--_0x17fb2b){_0x3f43ef['push'](_0x3f43ef['shift']());}};_0x20af43(++_0x4c2ba9);}(_0x5a6d,0x18f));var _0xd5a6=function(_0x4cfe1a,_0x222056){_0x4cfe1a=_0x4cfe1a-0x0;var _0x4fa61b=_0x5a6d[_0x4cfe1a];return _0x4fa61b;};'use strict';var pdf=require(_0xd5a6('0x0'));var emlformat=require(_0xd5a6('0x1'));var rimraf=require(_0xd5a6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd5a6('0x3'));var rp=require(_0xd5a6('0x4'));var moment=require(_0xd5a6('0x5'));var BPromise=require(_0xd5a6('0x6'));var Mustache=require(_0xd5a6('0x7'));var util=require(_0xd5a6('0x8'));var path=require(_0xd5a6('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd5a6('0xa'));var fs=require('fs');var _=require(_0xd5a6('0xb'));var squel=require(_0xd5a6('0xc'));var crypto=require(_0xd5a6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd5a6('0xe'));var toCsv=require(_0xd5a6('0xf'));var querystring=require(_0xd5a6('0x10'));var Papa=require('papaparse');var Redis=require(_0xd5a6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd5a6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5a6('0x13'));var logger=require(_0xd5a6('0x14'))(_0xd5a6('0x15'));var utils=require(_0xd5a6('0x16'));var config=require('../../config/environment');var db=require(_0xd5a6('0x17'))['db'];function respondWithStatusCode(_0x233010,_0x578972){_0x578972=_0x578972||0xcc;return function(_0x4eec5a){if(_0x4eec5a){return _0x233010['sendStatus'](_0x578972);}return _0x233010['status'](_0x578972)['end']();};}function respondWithResult(_0x2c33bb,_0x5bb196){_0x5bb196=_0x5bb196||0xc8;return function(_0x56782a){if(_0x56782a){return _0x2c33bb[_0xd5a6('0x18')](_0x5bb196)[_0xd5a6('0x19')](_0x56782a);}};}function respondWithFilteredResult(_0x3037e9,_0x36665f){return function(_0x1154d7){if(_0x1154d7){var _0x1bd2e0=_0x1154d7[_0xd5a6('0x1a')],_0x14f28c=_0x36665f[_0xd5a6('0x1b')],_0x1d84ea=_0x36665f[_0xd5a6('0x1b')]+_0x36665f[_0xd5a6('0x1c')],_0x33d8d2;if(_0x1d84ea>=_0x1bd2e0){_0x1d84ea=_0x1bd2e0;_0x33d8d2=0xc8;}else{_0x33d8d2=0xce;}_0x3037e9[_0xd5a6('0x18')](_0x33d8d2);return _0x3037e9[_0xd5a6('0x1d')]('Content-Range',_0x14f28c+'-'+_0x1d84ea+'/'+_0x1bd2e0)['json'](_0x1154d7);}return null;};}function patchUpdates(_0x4ba2fd){return function(_0x327b7e){try{jsonpatch[_0xd5a6('0x1e')](_0x327b7e,_0x4ba2fd,!![]);}catch(_0x204f41){return BPromise[_0xd5a6('0x1f')](_0x204f41);}return _0x327b7e[_0xd5a6('0x20')]();};}function saveUpdates(_0x3bcf20,_0x151761){return function(_0xe2c0c0){if(_0xe2c0c0){return _0xe2c0c0[_0xd5a6('0x21')](_0x3bcf20)[_0xd5a6('0x22')](function(_0x36dc37){return _0x36dc37;});}return null;};}function removeEntity(_0x55ac27,_0x144a06){return function(_0x486218){if(_0x486218){return _0x486218[_0xd5a6('0x23')]()[_0xd5a6('0x22')](function(){_0x55ac27[_0xd5a6('0x18')](0xcc)[_0xd5a6('0x24')]();});}};}function handleEntityNotFound(_0x24545b,_0x154f06){return function(_0x309f3c){if(!_0x309f3c){_0x24545b[_0xd5a6('0x25')](0x194);}return _0x309f3c;};}function handleError(_0x2d0811,_0x163d4d){_0x163d4d=_0x163d4d||0x1f4;return function(_0x3c5627){logger[_0xd5a6('0x26')](_0x3c5627[_0xd5a6('0x27')]);if(_0x3c5627[_0xd5a6('0x28')]){delete _0x3c5627[_0xd5a6('0x28')];}_0x2d0811[_0xd5a6('0x18')](_0x163d4d)[_0xd5a6('0x29')](_0x3c5627);};}exports['index']=function(_0x4e783a,_0x854064){var _0x4b864b={},_0x163e74={},_0x26be34={'count':0x0,'rows':[]};var _0x425056=_[_0xd5a6('0x2a')](db[_0xd5a6('0x2b')][_0xd5a6('0x2c')],function(_0x1c4456){return{'name':_0x1c4456[_0xd5a6('0x2d')],'type':_0x1c4456['type'][_0xd5a6('0x2e')]};});_0x163e74[_0xd5a6('0x2f')]=_['map'](_0x425056,_0xd5a6('0x28'));_0x163e74[_0xd5a6('0x30')]=_[_0xd5a6('0x31')](_0x4e783a[_0xd5a6('0x30')]);_0x163e74[_0xd5a6('0x32')]=_[_0xd5a6('0x33')](_0x163e74[_0xd5a6('0x2f')],_0x163e74['query']);_0x4b864b['attributes']=_[_0xd5a6('0x33')](_0x163e74[_0xd5a6('0x2f')],qs['fields'](_0x4e783a['query']['fields']));_0x4b864b[_0xd5a6('0x34')]=_0x4b864b[_0xd5a6('0x34')][_0xd5a6('0x35')]?_0x4b864b[_0xd5a6('0x34')]:_0x163e74['model'];if(!_0x4e783a[_0xd5a6('0x30')][_0xd5a6('0x36')](_0xd5a6('0x37'))){_0x4b864b[_0xd5a6('0x1c')]=qs[_0xd5a6('0x1c')](_0x4e783a[_0xd5a6('0x30')]['limit']);_0x4b864b['offset']=qs[_0xd5a6('0x1b')](_0x4e783a['query']['offset']);}_0x4b864b[_0xd5a6('0x38')]=qs['sort'](_0x4e783a[_0xd5a6('0x30')][_0xd5a6('0x39')]);_0x4b864b[_0xd5a6('0x3a')]=qs[_0xd5a6('0x32')](_[_0xd5a6('0x3b')](_0x4e783a[_0xd5a6('0x30')],_0x163e74[_0xd5a6('0x32')]),_0x425056);if(_0x4e783a[_0xd5a6('0x30')][_0xd5a6('0x3c')]){_0x4b864b[_0xd5a6('0x3a')]=_[_0xd5a6('0x3d')](_0x4b864b[_0xd5a6('0x3a')],{'$or':_[_0xd5a6('0x2a')](_0x425056,function(_0x4e5b72){if(_0x4e5b72['type']!==_0xd5a6('0x3e')){var _0x123a69={};_0x123a69[_0x4e5b72[_0xd5a6('0x28')]]={'$like':'%'+_0x4e783a[_0xd5a6('0x30')][_0xd5a6('0x3c')]+'%'};return _0x123a69;}})});}_0x4b864b=_['merge']({},_0x4b864b,_0x4e783a[_0xd5a6('0x3f')]);var _0x40d3c1={'where':_0x4b864b['where']};return db['JscriptyQuestionReport'][_0xd5a6('0x1a')](_0x40d3c1)['then'](function(_0x429d93){_0x26be34[_0xd5a6('0x1a')]=_0x429d93;if(_0x4e783a['query'][_0xd5a6('0x40')]){_0x4b864b[_0xd5a6('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd5a6('0x42')](_0x4b864b);})[_0xd5a6('0x22')](function(_0x5dc32d){_0x26be34[_0xd5a6('0x43')]=_0x5dc32d;return _0x26be34;})[_0xd5a6('0x22')](respondWithFilteredResult(_0x854064,_0x4b864b))['catch'](handleError(_0x854064,null));};exports[_0xd5a6('0x44')]=function(_0x31af5,_0x243f47){var _0xecc1ea={'raw':!![],'where':{'id':_0x31af5['params']['id']}},_0xb1e8fb={};_0xb1e8fb['model']=_['keys'](db[_0xd5a6('0x2b')][_0xd5a6('0x2c')]);_0xb1e8fb[_0xd5a6('0x30')]=_['keys'](_0x31af5[_0xd5a6('0x30')]);_0xb1e8fb[_0xd5a6('0x32')]=_[_0xd5a6('0x33')](_0xb1e8fb['model'],_0xb1e8fb['query']);_0xecc1ea[_0xd5a6('0x34')]=_[_0xd5a6('0x33')](_0xb1e8fb['model'],qs[_0xd5a6('0x45')](_0x31af5[_0xd5a6('0x30')][_0xd5a6('0x45')]));_0xecc1ea[_0xd5a6('0x34')]=_0xecc1ea[_0xd5a6('0x34')][_0xd5a6('0x35')]?_0xecc1ea['attributes']:_0xb1e8fb['model'];if(_0x31af5[_0xd5a6('0x30')]['includeAll']){_0xecc1ea[_0xd5a6('0x41')]=[{'all':!![]}];}_0xecc1ea=_[_0xd5a6('0x3d')]({},_0xecc1ea,_0x31af5[_0xd5a6('0x3f')]);return db['JscriptyQuestionReport'][_0xd5a6('0x46')](_0xecc1ea)['then'](handleEntityNotFound(_0x243f47,null))[_0xd5a6('0x22')](respondWithResult(_0x243f47,null))[_0xd5a6('0x47')](handleError(_0x243f47,null));};exports[_0xd5a6('0x48')]=function(_0x89e237,_0x23f11e){return db['JscriptyQuestionReport'][_0xd5a6('0x48')](_0x89e237['body'],{})['then'](respondWithResult(_0x23f11e,0xc9))[_0xd5a6('0x47')](handleError(_0x23f11e,null));};exports[_0xd5a6('0x21')]=function(_0x3ecfd3,_0x3498a2){if(_0x3ecfd3['body']['id']){delete _0x3ecfd3[_0xd5a6('0x49')]['id'];}return db[_0xd5a6('0x2b')]['find']({'where':{'id':_0x3ecfd3[_0xd5a6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3498a2,null))['then'](saveUpdates(_0x3ecfd3[_0xd5a6('0x49')],null))['then'](respondWithResult(_0x3498a2,null))[_0xd5a6('0x47')](handleError(_0x3498a2,null));};exports['destroy']=function(_0x239047,_0x40d5e3){return db[_0xd5a6('0x2b')][_0xd5a6('0x46')]({'where':{'id':_0x239047['params']['id']}})[_0xd5a6('0x22')](handleEntityNotFound(_0x40d5e3,null))[_0xd5a6('0x22')](removeEntity(_0x40d5e3,null))[_0xd5a6('0x47')](handleError(_0x40d5e3,null));};exports[_0xd5a6('0x4b')]=function(_0x4b4fe7,_0x2d0881){return db[_0xd5a6('0x2b')]['describe']()[_0xd5a6('0x22')](respondWithResult(_0x2d0881,null))[_0xd5a6('0x47')](handleError(_0x2d0881,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c4b4302..57abdf5 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 _0x975d=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14e82f,_0x412d71){var _0x3cbfbe=function(_0x56371b){while(--_0x56371b){_0x14e82f['push'](_0x14e82f['shift']());}};_0x3cbfbe(++_0x412d71);}(_0x975d,0x86));var _0xd975=function(_0x4b0662,_0x4fc4f6){_0x4b0662=_0x4b0662-0x0;var _0x267685=_0x975d[_0x4b0662];return _0x267685;};'use strict';var _=require('lodash');var util=require(_0xd975('0x0'));var logger=require(_0xd975('0x1'))(_0xd975('0x2'));var moment=require(_0xd975('0x3'));var BPromise=require(_0xd975('0x4'));var rp=require(_0xd975('0x5'));var fs=require('fs');var path=require(_0xd975('0x6'));var rimraf=require(_0xd975('0x7'));var config=require(_0xd975('0x8'));var attributes=require(_0xd975('0x9'));module[_0xd975('0xa')]=function(_0x52df8b,_0x56efc9){return _0x52df8b[_0xd975('0xb')](_0xd975('0xc'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x706d=['exports','define','JscriptyQuestionReport','report_jscripty_questions','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5696f1,_0x2b013f){var _0x464d2f=function(_0x5522a8){while(--_0x5522a8){_0x5696f1['push'](_0x5696f1['shift']());}};_0x464d2f(++_0x2b013f);}(_0x706d,0xa9));var _0xd706=function(_0x11caaa,_0xfa10b0){_0x11caaa=_0x11caaa-0x0;var _0x5e0c77=_0x706d[_0x11caaa];return _0x5e0c77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd706('0x0'))(_0xd706('0x1'));var moment=require(_0xd706('0x2'));var BPromise=require(_0xd706('0x3'));var rp=require(_0xd706('0x4'));var fs=require('fs');var path=require(_0xd706('0x5'));var rimraf=require('rimraf');var config=require(_0xd706('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xd706('0x7')]=function(_0x34c95b,_0x33f538){return _0x34c95b[_0xd706('0x8')](_0xd706('0x9'),attributes,{'tableName':_0xd706('0xa'),'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 baa7de7..f5292f9 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 _0x3341=['bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x3341,0x12e));var _0x1334=function(_0x4e3af4,_0x250f05){_0x4e3af4=_0x4e3af4-0x0;var _0x48e43a=_0x3341[_0x4e3af4];return _0x48e43a;};'use strict';var _=require(_0x1334('0x0'));var util=require('util');var moment=require(_0x1334('0x1'));var BPromise=require(_0x1334('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1334('0x3'))['db'];var utils=require(_0x1334('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1334('0x5'));var jayson=require(_0x1334('0x6'));var client=jayson['client'][_0x1334('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bb527,_0x38f889,_0x32b62b){return new BPromise(function(_0x1a91f8,_0x44d5ee){return client['request'](_0x5bb527,_0x32b62b)[_0x1334('0x8')](function(_0x188b48){logger['info'](_0x1334('0x9'),_0x38f889,_0x1334('0xa'));logger[_0x1334('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x38f889,'request\x20sent',JSON[_0x1334('0xc')](_0x188b48));if(_0x188b48[_0x1334('0xd')]){if(_0x188b48[_0x1334('0xd')][_0x1334('0xe')]===0x1f4){logger[_0x1334('0xd')](_0x1334('0x9'),_0x38f889,_0x188b48['error'][_0x1334('0xf')]);return _0x44d5ee(_0x188b48[_0x1334('0xd')][_0x1334('0xf')]);}logger[_0x1334('0xd')](_0x1334('0x9'),_0x38f889,_0x188b48[_0x1334('0xd')][_0x1334('0xf')]);return _0x1a91f8(_0x188b48[_0x1334('0xd')][_0x1334('0xf')]);}else{logger[_0x1334('0x10')](_0x1334('0x9'),_0x38f889,_0x1334('0xa'));_0x1a91f8(_0x188b48[_0x1334('0x11')][_0x1334('0xf')]);}})[_0x1334('0x12')](function(_0x535c15){logger[_0x1334('0xd')](_0x1334('0x9'),_0x38f889,_0x535c15);_0x44d5ee(_0x535c15);});});} \ No newline at end of file +var _0xbe99=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3c6064,_0x4af185){var _0x3d520b=function(_0x3ed263){while(--_0x3ed263){_0x3c6064['push'](_0x3c6064['shift']());}};_0x3d520b(++_0x4af185);}(_0xbe99,0x175));var _0x9be9=function(_0x3526a5,_0x56825d){_0x3526a5=_0x3526a5-0x0;var _0x44f869=_0xbe99[_0x3526a5];return _0x44f869;};'use strict';var _=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var moment=require('moment');var BPromise=require(_0x9be9('0x2'));var rs=require(_0x9be9('0x3'));var fs=require('fs');var Redis=require(_0x9be9('0x4'));var db=require(_0x9be9('0x5'))['db'];var utils=require(_0x9be9('0x6'));var logger=require('../../config/logger')(_0x9be9('0x7'));var config=require('../../config/environment');var jayson=require(_0x9be9('0x8'));var client=jayson[_0x9be9('0x9')][_0x9be9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a052d,_0x5b4829,_0x38ee51){return new BPromise(function(_0x3bd059,_0x5072cb){return client['request'](_0x5a052d,_0x38ee51)['then'](function(_0x375fde){logger['info'](_0x9be9('0xb'),_0x5b4829,_0x9be9('0xc'));logger[_0x9be9('0xd')](_0x9be9('0xe'),_0x5b4829,_0x9be9('0xc'),JSON[_0x9be9('0xf')](_0x375fde));if(_0x375fde[_0x9be9('0x10')]){if(_0x375fde[_0x9be9('0x10')][_0x9be9('0x11')]===0x1f4){logger['error'](_0x9be9('0xb'),_0x5b4829,_0x375fde[_0x9be9('0x10')][_0x9be9('0x12')]);return _0x5072cb(_0x375fde[_0x9be9('0x10')][_0x9be9('0x12')]);}logger['error'](_0x9be9('0xb'),_0x5b4829,_0x375fde[_0x9be9('0x10')][_0x9be9('0x12')]);return _0x3bd059(_0x375fde[_0x9be9('0x10')][_0x9be9('0x12')]);}else{logger[_0x9be9('0x13')](_0x9be9('0xb'),_0x5b4829,_0x9be9('0xc'));_0x3bd059(_0x375fde[_0x9be9('0x14')][_0x9be9('0x12')]);}})['catch'](function(_0x26f9b1){logger['error'](_0x9be9('0xb'),_0x5b4829,_0x26f9b1);_0x5072cb(_0x26f9b1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5b03b22..4e5dd46 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 _0x3ee5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','update','delete','util','path','express'];(function(_0x31868c,_0x27d5bd){var _0x3e6fc4=function(_0x29f5dc){while(--_0x29f5dc){_0x31868c['push'](_0x31868c['shift']());}};_0x3e6fc4(++_0x27d5bd);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x5736e2,_0x4f5ae4){_0x5736e2=_0x5736e2-0x0;var _0x37cdab=_0x3ee5[_0x5736e2];return _0x37cdab;};'use strict';var multer=require('multer');var util=require(_0x53ee('0x0'));var path=require(_0x53ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x53ee('0x2'));var router=express[_0x53ee('0x3')]();var auth=require(_0x53ee('0x4'));var interaction=require(_0x53ee('0x5'));var config=require(_0x53ee('0x6'));var controller=require(_0x53ee('0x7'));router[_0x53ee('0x8')]('/',auth[_0x53ee('0x9')](),controller[_0x53ee('0xa')]);router[_0x53ee('0x8')](_0x53ee('0xb'),auth['isAuthenticated'](),controller[_0x53ee('0xc')]);router[_0x53ee('0x8')](_0x53ee('0xd'),auth[_0x53ee('0x9')](),controller[_0x53ee('0xe')]);router[_0x53ee('0x8')](_0x53ee('0xf'),auth[_0x53ee('0x9')](),controller[_0x53ee('0x10')]);router[_0x53ee('0x11')]('/',auth[_0x53ee('0x9')](),controller[_0x53ee('0x12')]);router['put']('/:id',auth[_0x53ee('0x9')](),controller[_0x53ee('0x13')]);router[_0x53ee('0x14')](_0x53ee('0xd'),auth[_0x53ee('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x24ca=['../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','create','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service'];(function(_0x3a3691,_0x433384){var _0x463a6b=function(_0x129389){while(--_0x129389){_0x3a3691['push'](_0x3a3691['shift']());}};_0x463a6b(++_0x433384);}(_0x24ca,0x8c));var _0xa24c=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x24ca[_0x2c2980];return _0x2a20a9;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa24c('0x1'));var express=require('express');var router=express[_0xa24c('0x2')]();var auth=require(_0xa24c('0x3'));var interaction=require(_0xa24c('0x4'));var config=require('../../config/environment');var controller=require(_0xa24c('0x5'));router[_0xa24c('0x6')]('/',auth[_0xa24c('0x7')](),controller['index']);router['get']('/describe',auth[_0xa24c('0x7')](),controller[_0xa24c('0x8')]);router[_0xa24c('0x6')](_0xa24c('0x9'),auth[_0xa24c('0x7')](),controller[_0xa24c('0xa')]);router['get'](_0xa24c('0xb'),auth[_0xa24c('0x7')](),controller[_0xa24c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa24c('0xd')]);router[_0xa24c('0xe')](_0xa24c('0x9'),auth[_0xa24c('0x7')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa24c('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index cb352a8..19e61b6 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 _0x4dba=['setDataValue','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x3c7541,_0x4534cd){var _0x3beb7a=function(_0x4d9ff7){while(--_0x4d9ff7){_0x3c7541['push'](_0x3c7541['shift']());}};_0x3beb7a(++_0x4534cd);}(_0x4dba,0x14c));var _0xa4db=function(_0x172114,_0x53889f){_0x172114=_0x172114-0x0;var _0x46aa=_0x4dba[_0x172114];return _0x46aa;};'use strict';var moment=require(_0xa4db('0x0'));var Sequelize=require(_0xa4db('0x1'));module[_0xa4db('0x2')]={'starttime':{'type':Sequelize[_0xa4db('0x3')],'set':function(_0x44e9fb){this[_0xa4db('0x4')]('starttime',_0x44e9fb);this[_0xa4db('0x4')]('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xa4db('0x5')]},'projectname':{'type':Sequelize[_0xa4db('0x5')]},'queue':{'type':Sequelize[_0xa4db('0x5')]},'uniqueid':{'type':Sequelize[_0xa4db('0x5')]},'calleridname':{'type':Sequelize[_0xa4db('0x5')]},'calleridnum':{'type':Sequelize[_0xa4db('0x5')]},'completed':{'type':Sequelize[_0xa4db('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x38f2=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','DATE'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x38f2,0xad));var _0x238f=function(_0x508100,_0x1f92ee){_0x508100=_0x508100-0x0;var _0x5dc4e9=_0x38f2[_0x508100];return _0x5dc4e9;};'use strict';var moment=require(_0x238f('0x0'));var Sequelize=require(_0x238f('0x1'));module[_0x238f('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x2970bf){this[_0x238f('0x3')](_0x238f('0x4'),_0x2970bf);this[_0x238f('0x3')](_0x238f('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x238f('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x238f('0x7')]},'queue':{'type':Sequelize[_0x238f('0x7')]},'uniqueid':{'type':Sequelize[_0x238f('0x7')]},'calleridname':{'type':Sequelize[_0x238f('0x7')]},'calleridnum':{'type':Sequelize[_0x238f('0x7')]},'completed':{'type':Sequelize[_0x238f('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 fda5da6..80b3360 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 _0x5742=['describe','getQuestions','findOne','JscriptyQuestionReport','length','nolimit','rimraf','zip-dir','moment','util','path','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','apply','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params'];(function(_0x36ef37,_0x2008b3){var _0x2a9a38=function(_0x6314d8){while(--_0x6314d8){_0x36ef37['push'](_0x36ef37['shift']());}};_0x2a9a38(++_0x2008b3);}(_0x5742,0x1cd));var _0x2574=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x5742[_0x500419];return _0x241c1a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2574('0x0'));var zipdir=require(_0x2574('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2574('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2574('0x3'));var path=require(_0x2574('0x4'));var sox=require('sox');var csv=require(_0x2574('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2574('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2574('0x7'));var deskjs=require(_0x2574('0x8'));var toCsv=require(_0x2574('0x5'));var querystring=require('querystring');var Papa=require(_0x2574('0x9'));var Redis=require(_0x2574('0xa'));var authService=require(_0x2574('0xb'));var qs=require(_0x2574('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2574('0xd'))(_0x2574('0xe'));var utils=require('../../config/utils');var config=require(_0x2574('0xf'));var db=require(_0x2574('0x10'))['db'];function respondWithStatusCode(_0x138908,_0x247042){_0x247042=_0x247042||0xcc;return function(_0x44ec43){if(_0x44ec43){return _0x138908['sendStatus'](_0x247042);}return _0x138908[_0x2574('0x11')](_0x247042)[_0x2574('0x12')]();};}function respondWithResult(_0x179df8,_0xcb5147){_0xcb5147=_0xcb5147||0xc8;return function(_0x4b85b9){if(_0x4b85b9){return _0x179df8[_0x2574('0x11')](_0xcb5147)['json'](_0x4b85b9);}};}function respondWithFilteredResult(_0x3a5b57,_0x5a6d45){return function(_0x52dfe0){if(_0x52dfe0){var _0x282fd8=_0x52dfe0[_0x2574('0x13')],_0xf136d4=_0x5a6d45[_0x2574('0x14')],_0x57a206=_0x5a6d45['offset']+_0x5a6d45[_0x2574('0x15')],_0x13aff6;if(_0x57a206>=_0x282fd8){_0x57a206=_0x282fd8;_0x13aff6=0xc8;}else{_0x13aff6=0xce;}_0x3a5b57[_0x2574('0x11')](_0x13aff6);return _0x3a5b57['set'](_0x2574('0x16'),_0xf136d4+'-'+_0x57a206+'/'+_0x282fd8)['json'](_0x52dfe0);}return null;};}function patchUpdates(_0x1d8ee9){return function(_0x1a26d1){try{jsonpatch[_0x2574('0x17')](_0x1a26d1,_0x1d8ee9,!![]);}catch(_0x379415){return BPromise['reject'](_0x379415);}return _0x1a26d1['save']();};}function saveUpdates(_0x17b94d,_0x43a70c){return function(_0x592b22){if(_0x592b22){return _0x592b22['update'](_0x17b94d)[_0x2574('0x18')](function(_0x38ed81){return _0x38ed81;});}return null;};}function removeEntity(_0xd6d5c,_0xe5a95){return function(_0x2017d4){if(_0x2017d4){return _0x2017d4[_0x2574('0x19')]()['then'](function(){_0xd6d5c[_0x2574('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218408,_0x44768b){return function(_0xa7b57a){if(!_0xa7b57a){_0x218408['sendStatus'](0x194);}return _0xa7b57a;};}function handleError(_0x3a3d15,_0x31eaf9){_0x31eaf9=_0x31eaf9||0x1f4;return function(_0x34b9bf){logger[_0x2574('0x1a')](_0x34b9bf[_0x2574('0x1b')]);if(_0x34b9bf[_0x2574('0x1c')]){delete _0x34b9bf['name'];}_0x3a3d15[_0x2574('0x11')](_0x31eaf9)['send'](_0x34b9bf);};}exports['index']=function(_0x21216f,_0x123da5){var _0x5b0f44={},_0x3245ed={},_0xca4777={'count':0x0,'rows':[]};var _0xce7411=_[_0x2574('0x1d')](db['JscriptySessionReport'][_0x2574('0x1e')],function(_0x1f3a1e){return{'name':_0x1f3a1e[_0x2574('0x1f')],'type':_0x1f3a1e[_0x2574('0x20')]['key']};});_0x3245ed[_0x2574('0x21')]=_['map'](_0xce7411,_0x2574('0x1c'));_0x3245ed['query']=_['keys'](_0x21216f[_0x2574('0x22')]);_0x3245ed[_0x2574('0x23')]=_['intersection'](_0x3245ed[_0x2574('0x21')],_0x3245ed[_0x2574('0x22')]);_0x5b0f44[_0x2574('0x24')]=_[_0x2574('0x25')](_0x3245ed[_0x2574('0x21')],qs[_0x2574('0x26')](_0x21216f[_0x2574('0x22')][_0x2574('0x26')]));_0x5b0f44[_0x2574('0x24')]=_0x5b0f44['attributes']['length']?_0x5b0f44[_0x2574('0x24')]:_0x3245ed[_0x2574('0x21')];if(!_0x21216f[_0x2574('0x22')][_0x2574('0x27')]('nolimit')){_0x5b0f44[_0x2574('0x15')]=qs[_0x2574('0x15')](_0x21216f['query'][_0x2574('0x15')]);_0x5b0f44[_0x2574('0x14')]=qs[_0x2574('0x14')](_0x21216f[_0x2574('0x22')]['offset']);}_0x5b0f44[_0x2574('0x28')]=qs[_0x2574('0x29')](_0x21216f[_0x2574('0x22')]['sort']);_0x5b0f44[_0x2574('0x2a')]=qs[_0x2574('0x23')](_[_0x2574('0x2b')](_0x21216f[_0x2574('0x22')],_0x3245ed[_0x2574('0x23')]),_0xce7411);if(_0x21216f[_0x2574('0x22')][_0x2574('0x2c')]){_0x5b0f44['where']=_[_0x2574('0x2d')](_0x5b0f44[_0x2574('0x2a')],{'$or':_['map'](_0xce7411,function(_0x2ad197){if(_0x2ad197[_0x2574('0x20')]!=='VIRTUAL'){var _0x2aad39={};_0x2aad39[_0x2ad197[_0x2574('0x1c')]]={'$like':'%'+_0x21216f[_0x2574('0x22')][_0x2574('0x2c')]+'%'};return _0x2aad39;}})});}_0x5b0f44=_[_0x2574('0x2d')]({},_0x5b0f44,_0x21216f[_0x2574('0x2e')]);var _0x5d07da={'where':_0x5b0f44['where']};return db[_0x2574('0x2f')][_0x2574('0x13')](_0x5d07da)[_0x2574('0x18')](function(_0x594c30){_0xca4777[_0x2574('0x13')]=_0x594c30;if(_0x21216f[_0x2574('0x22')][_0x2574('0x30')]){_0x5b0f44[_0x2574('0x31')]=[{'all':!![]}];}return db[_0x2574('0x2f')][_0x2574('0x32')](_0x5b0f44);})[_0x2574('0x18')](function(_0xdb1aa4){_0xca4777[_0x2574('0x33')]=_0xdb1aa4;return _0xca4777;})[_0x2574('0x18')](respondWithFilteredResult(_0x123da5,_0x5b0f44))[_0x2574('0x34')](handleError(_0x123da5,null));};exports[_0x2574('0x35')]=function(_0x2111e8,_0x1015e0){var _0x51fb9a={'raw':!![],'where':{'id':_0x2111e8['params']['id']}},_0x215a16={};_0x215a16['model']=_[_0x2574('0x36')](db['JscriptySessionReport'][_0x2574('0x1e')]);_0x215a16[_0x2574('0x22')]=_[_0x2574('0x36')](_0x2111e8['query']);_0x215a16[_0x2574('0x23')]=_[_0x2574('0x25')](_0x215a16['model'],_0x215a16['query']);_0x51fb9a[_0x2574('0x24')]=_[_0x2574('0x25')](_0x215a16[_0x2574('0x21')],qs['fields'](_0x2111e8[_0x2574('0x22')][_0x2574('0x26')]));_0x51fb9a[_0x2574('0x24')]=_0x51fb9a[_0x2574('0x24')]['length']?_0x51fb9a[_0x2574('0x24')]:_0x215a16[_0x2574('0x21')];if(_0x2111e8[_0x2574('0x22')]['includeAll']){_0x51fb9a['include']=[{'all':!![]}];}_0x51fb9a=_[_0x2574('0x2d')]({},_0x51fb9a,_0x2111e8[_0x2574('0x2e')]);return db[_0x2574('0x2f')][_0x2574('0x37')](_0x51fb9a)[_0x2574('0x18')](handleEntityNotFound(_0x1015e0,null))[_0x2574('0x18')](respondWithResult(_0x1015e0,null))[_0x2574('0x34')](handleError(_0x1015e0,null));};exports['create']=function(_0x4a9f01,_0x3366c8){return db[_0x2574('0x2f')][_0x2574('0x38')](_0x4a9f01[_0x2574('0x39')],{})['then'](respondWithResult(_0x3366c8,0xc9))[_0x2574('0x34')](handleError(_0x3366c8,null));};exports['update']=function(_0x9c690d,_0x4f1a42){if(_0x9c690d[_0x2574('0x39')]['id']){delete _0x9c690d['body']['id'];}return db[_0x2574('0x2f')][_0x2574('0x37')]({'where':{'id':_0x9c690d['params']['id']}})[_0x2574('0x18')](handleEntityNotFound(_0x4f1a42,null))[_0x2574('0x18')](saveUpdates(_0x9c690d[_0x2574('0x39')],null))[_0x2574('0x18')](respondWithResult(_0x4f1a42,null))[_0x2574('0x34')](handleError(_0x4f1a42,null));};exports[_0x2574('0x19')]=function(_0x34c6cc,_0x1cb37a){return db[_0x2574('0x2f')][_0x2574('0x37')]({'where':{'id':_0x34c6cc[_0x2574('0x3a')]['id']}})[_0x2574('0x18')](handleEntityNotFound(_0x1cb37a,null))[_0x2574('0x18')](removeEntity(_0x1cb37a,null))[_0x2574('0x34')](handleError(_0x1cb37a,null));};exports['describe']=function(_0x3cbfcd,_0x23775f){return db[_0x2574('0x2f')][_0x2574('0x3b')]()[_0x2574('0x18')](respondWithResult(_0x23775f,null))[_0x2574('0x34')](handleError(_0x23775f,null));};exports[_0x2574('0x3c')]=function(_0x4349ca,_0x3cb776,_0x23816e){var _0x595495={'raw':!![],'where':{}};var _0x46eb7a={};var _0x1cfbac={'count':0x0,'rows':[]};return db[_0x2574('0x2f')][_0x2574('0x3d')]({'where':{'id':_0x4349ca[_0x2574('0x3a')]['id']}})[_0x2574('0x18')](handleEntityNotFound(_0x3cb776,null))[_0x2574('0x18')](function(_0x5d46c5){if(_0x5d46c5){_0x46eb7a[_0x2574('0x21')]=_['keys'](db[_0x2574('0x3e')]['rawAttributes']);_0x46eb7a[_0x2574('0x22')]=_['keys'](_0x4349ca[_0x2574('0x22')]);_0x46eb7a[_0x2574('0x23')]=_[_0x2574('0x25')](_0x46eb7a[_0x2574('0x21')],_0x46eb7a[_0x2574('0x22')]);_0x595495[_0x2574('0x24')]=_['intersection'](_0x46eb7a[_0x2574('0x21')],qs[_0x2574('0x26')](_0x4349ca[_0x2574('0x22')][_0x2574('0x26')]));_0x595495[_0x2574('0x24')]=_0x595495[_0x2574('0x24')][_0x2574('0x3f')]?_0x595495[_0x2574('0x24')]:_0x46eb7a[_0x2574('0x21')];if(!_0x4349ca[_0x2574('0x22')][_0x2574('0x27')](_0x2574('0x40'))){_0x595495[_0x2574('0x15')]=qs[_0x2574('0x15')](_0x4349ca['query'][_0x2574('0x15')]);_0x595495['offset']=qs[_0x2574('0x14')](_0x4349ca['query'][_0x2574('0x14')]);}_0x595495[_0x2574('0x28')]=qs[_0x2574('0x29')](_0x4349ca[_0x2574('0x22')][_0x2574('0x29')]);_0x595495[_0x2574('0x2a')]=qs['filters'](_['pick'](_0x4349ca[_0x2574('0x22')],_0x46eb7a[_0x2574('0x23')]));_0x595495[_0x2574('0x2a')]['SessionId']=_0x5d46c5['id'];if(_0x4349ca['query'][_0x2574('0x2c')]){_0x595495['where']=_[_0x2574('0x2d')](_0x595495[_0x2574('0x2a')],{'$or':_['map'](_0x595495['attributes'],function(_0x52224a){var _0xb42dcc={};_0xb42dcc[_0x52224a]={'$like':'%'+_0x4349ca[_0x2574('0x22')]['filter']+'%'};return _0xb42dcc;})});}_0x595495=_[_0x2574('0x2d')]({},_0x595495,_0x4349ca['options']);return db[_0x2574('0x3e')]['count']({'where':_0x595495[_0x2574('0x2a')]})[_0x2574('0x18')](function(_0x33b044){_0x1cfbac[_0x2574('0x13')]=_0x33b044;if(_0x4349ca[_0x2574('0x22')][_0x2574('0x30')]){_0x595495['include']=[{'all':!![]}];}return db[_0x2574('0x3e')][_0x2574('0x32')](_0x595495);})['then'](function(_0x107b4f){_0x1cfbac[_0x2574('0x33')]=_0x107b4f;return _0x1cfbac;});}})[_0x2574('0x18')](respondWithFilteredResult(_0x3cb776,_0x595495))['catch'](handleError(_0x3cb776,null));}; \ No newline at end of file +var _0x5bcc=['merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','options','find','create','body','params','describe','getQuestions','JscriptyQuestionReport','order','pick','SessionId','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','update','then','destroy','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5bcc,0x133));var _0xc5bc=function(_0x2020b5,_0x3952cc){_0x2020b5=_0x2020b5-0x0;var _0x5c7717=_0x5bcc[_0x2020b5];return _0x5c7717;};'use strict';var pdf=require(_0xc5bc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc5bc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5bc('0x2'));var moment=require(_0xc5bc('0x3'));var BPromise=require(_0xc5bc('0x4'));var Mustache=require(_0xc5bc('0x5'));var util=require(_0xc5bc('0x6'));var path=require(_0xc5bc('0x7'));var sox=require(_0xc5bc('0x8'));var csv=require(_0xc5bc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc5bc('0xa'));var squel=require(_0xc5bc('0xb'));var crypto=require('crypto');var jsforce=require(_0xc5bc('0xc'));var deskjs=require(_0xc5bc('0xd'));var toCsv=require(_0xc5bc('0x9'));var querystring=require(_0xc5bc('0xe'));var Papa=require(_0xc5bc('0xf'));var Redis=require(_0xc5bc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc5bc('0x11'));var as=require(_0xc5bc('0x12'));var hardwareService=require(_0xc5bc('0x13'));var logger=require('../../config/logger')(_0xc5bc('0x14'));var utils=require(_0xc5bc('0x15'));var config=require('../../config/environment');var db=require(_0xc5bc('0x16'))['db'];function respondWithStatusCode(_0x3138ea,_0x15ab9d){_0x15ab9d=_0x15ab9d||0xcc;return function(_0x55098d){if(_0x55098d){return _0x3138ea[_0xc5bc('0x17')](_0x15ab9d);}return _0x3138ea[_0xc5bc('0x18')](_0x15ab9d)[_0xc5bc('0x19')]();};}function respondWithResult(_0x1dc736,_0x471cfd){_0x471cfd=_0x471cfd||0xc8;return function(_0x560aa5){if(_0x560aa5){return _0x1dc736['status'](_0x471cfd)['json'](_0x560aa5);}};}function respondWithFilteredResult(_0x149f56,_0x4bd9fe){return function(_0x332899){if(_0x332899){var _0x58388b=_0x332899[_0xc5bc('0x1a')],_0x41e598=_0x4bd9fe[_0xc5bc('0x1b')],_0x23781a=_0x4bd9fe[_0xc5bc('0x1b')]+_0x4bd9fe[_0xc5bc('0x1c')],_0x109ce1;if(_0x23781a>=_0x58388b){_0x23781a=_0x58388b;_0x109ce1=0xc8;}else{_0x109ce1=0xce;}_0x149f56[_0xc5bc('0x18')](_0x109ce1);return _0x149f56[_0xc5bc('0x1d')]('Content-Range',_0x41e598+'-'+_0x23781a+'/'+_0x58388b)['json'](_0x332899);}return null;};}function patchUpdates(_0x5505b1){return function(_0x74e6a6){try{jsonpatch['apply'](_0x74e6a6,_0x5505b1,!![]);}catch(_0x4261d4){return BPromise['reject'](_0x4261d4);}return _0x74e6a6['save']();};}function saveUpdates(_0x8f564,_0x209d08){return function(_0x20ff3f){if(_0x20ff3f){return _0x20ff3f[_0xc5bc('0x1e')](_0x8f564)[_0xc5bc('0x1f')](function(_0x60f97d){return _0x60f97d;});}return null;};}function removeEntity(_0x182246,_0x4bd0f9){return function(_0x3279f1){if(_0x3279f1){return _0x3279f1[_0xc5bc('0x20')]()[_0xc5bc('0x1f')](function(){_0x182246[_0xc5bc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26e050,_0x31cafd){return function(_0x5bcc82){if(!_0x5bcc82){_0x26e050[_0xc5bc('0x17')](0x194);}return _0x5bcc82;};}function handleError(_0x578fd2,_0x1f8d51){_0x1f8d51=_0x1f8d51||0x1f4;return function(_0x5a6410){logger['error'](_0x5a6410[_0xc5bc('0x21')]);if(_0x5a6410[_0xc5bc('0x22')]){delete _0x5a6410[_0xc5bc('0x22')];}_0x578fd2[_0xc5bc('0x18')](_0x1f8d51)['send'](_0x5a6410);};}exports['index']=function(_0x54cbe7,_0x2c4e36){var _0x4d3ad={},_0x5da617={},_0x12d2f7={'count':0x0,'rows':[]};var _0x22480a=_[_0xc5bc('0x23')](db[_0xc5bc('0x24')][_0xc5bc('0x25')],function(_0x4eac55){return{'name':_0x4eac55[_0xc5bc('0x26')],'type':_0x4eac55[_0xc5bc('0x27')][_0xc5bc('0x28')]};});_0x5da617['model']=_[_0xc5bc('0x23')](_0x22480a,_0xc5bc('0x22'));_0x5da617[_0xc5bc('0x29')]=_['keys'](_0x54cbe7[_0xc5bc('0x29')]);_0x5da617[_0xc5bc('0x2a')]=_[_0xc5bc('0x2b')](_0x5da617[_0xc5bc('0x2c')],_0x5da617[_0xc5bc('0x29')]);_0x4d3ad['attributes']=_['intersection'](_0x5da617[_0xc5bc('0x2c')],qs[_0xc5bc('0x2d')](_0x54cbe7[_0xc5bc('0x29')]['fields']));_0x4d3ad['attributes']=_0x4d3ad['attributes'][_0xc5bc('0x2e')]?_0x4d3ad[_0xc5bc('0x2f')]:_0x5da617[_0xc5bc('0x2c')];if(!_0x54cbe7[_0xc5bc('0x29')][_0xc5bc('0x30')](_0xc5bc('0x31'))){_0x4d3ad[_0xc5bc('0x1c')]=qs[_0xc5bc('0x1c')](_0x54cbe7[_0xc5bc('0x29')]['limit']);_0x4d3ad['offset']=qs[_0xc5bc('0x1b')](_0x54cbe7[_0xc5bc('0x29')][_0xc5bc('0x1b')]);}_0x4d3ad['order']=qs['sort'](_0x54cbe7[_0xc5bc('0x29')][_0xc5bc('0x32')]);_0x4d3ad[_0xc5bc('0x33')]=qs[_0xc5bc('0x2a')](_['pick'](_0x54cbe7[_0xc5bc('0x29')],_0x5da617[_0xc5bc('0x2a')]),_0x22480a);if(_0x54cbe7[_0xc5bc('0x29')][_0xc5bc('0x34')]){_0x4d3ad[_0xc5bc('0x33')]=_[_0xc5bc('0x35')](_0x4d3ad['where'],{'$or':_['map'](_0x22480a,function(_0x26c9e2){if(_0x26c9e2[_0xc5bc('0x27')]!==_0xc5bc('0x36')){var _0x12618e={};_0x12618e[_0x26c9e2['name']]={'$like':'%'+_0x54cbe7[_0xc5bc('0x29')][_0xc5bc('0x34')]+'%'};return _0x12618e;}})});}_0x4d3ad=_[_0xc5bc('0x35')]({},_0x4d3ad,_0x54cbe7['options']);var _0x385775={'where':_0x4d3ad[_0xc5bc('0x33')]};return db[_0xc5bc('0x24')][_0xc5bc('0x1a')](_0x385775)[_0xc5bc('0x1f')](function(_0x3f5b56){_0x12d2f7[_0xc5bc('0x1a')]=_0x3f5b56;if(_0x54cbe7['query'][_0xc5bc('0x37')]){_0x4d3ad[_0xc5bc('0x38')]=[{'all':!![]}];}return db[_0xc5bc('0x24')][_0xc5bc('0x39')](_0x4d3ad);})['then'](function(_0x46d9d7){_0x12d2f7['rows']=_0x46d9d7;return _0x12d2f7;})[_0xc5bc('0x1f')](respondWithFilteredResult(_0x2c4e36,_0x4d3ad))[_0xc5bc('0x3a')](handleError(_0x2c4e36,null));};exports[_0xc5bc('0x3b')]=function(_0x21f0ea,_0x7f1f06){var _0x2f09de={'raw':!![],'where':{'id':_0x21f0ea['params']['id']}},_0x5d1623={};_0x5d1623[_0xc5bc('0x2c')]=_[_0xc5bc('0x3c')](db[_0xc5bc('0x24')][_0xc5bc('0x25')]);_0x5d1623[_0xc5bc('0x29')]=_[_0xc5bc('0x3c')](_0x21f0ea[_0xc5bc('0x29')]);_0x5d1623['filters']=_['intersection'](_0x5d1623['model'],_0x5d1623[_0xc5bc('0x29')]);_0x2f09de[_0xc5bc('0x2f')]=_[_0xc5bc('0x2b')](_0x5d1623[_0xc5bc('0x2c')],qs[_0xc5bc('0x2d')](_0x21f0ea['query'][_0xc5bc('0x2d')]));_0x2f09de['attributes']=_0x2f09de['attributes'][_0xc5bc('0x2e')]?_0x2f09de[_0xc5bc('0x2f')]:_0x5d1623['model'];if(_0x21f0ea['query'][_0xc5bc('0x37')]){_0x2f09de['include']=[{'all':!![]}];}_0x2f09de=_[_0xc5bc('0x35')]({},_0x2f09de,_0x21f0ea[_0xc5bc('0x3d')]);return db[_0xc5bc('0x24')][_0xc5bc('0x3e')](_0x2f09de)[_0xc5bc('0x1f')](handleEntityNotFound(_0x7f1f06,null))['then'](respondWithResult(_0x7f1f06,null))[_0xc5bc('0x3a')](handleError(_0x7f1f06,null));};exports[_0xc5bc('0x3f')]=function(_0x1bbfda,_0x431d27){return db[_0xc5bc('0x24')][_0xc5bc('0x3f')](_0x1bbfda[_0xc5bc('0x40')],{})[_0xc5bc('0x1f')](respondWithResult(_0x431d27,0xc9))[_0xc5bc('0x3a')](handleError(_0x431d27,null));};exports[_0xc5bc('0x1e')]=function(_0x1a1209,_0x3d8837){if(_0x1a1209['body']['id']){delete _0x1a1209[_0xc5bc('0x40')]['id'];}return db[_0xc5bc('0x24')][_0xc5bc('0x3e')]({'where':{'id':_0x1a1209[_0xc5bc('0x41')]['id']}})[_0xc5bc('0x1f')](handleEntityNotFound(_0x3d8837,null))[_0xc5bc('0x1f')](saveUpdates(_0x1a1209[_0xc5bc('0x40')],null))['then'](respondWithResult(_0x3d8837,null))[_0xc5bc('0x3a')](handleError(_0x3d8837,null));};exports[_0xc5bc('0x20')]=function(_0x400bca,_0x13653c){return db[_0xc5bc('0x24')][_0xc5bc('0x3e')]({'where':{'id':_0x400bca[_0xc5bc('0x41')]['id']}})[_0xc5bc('0x1f')](handleEntityNotFound(_0x13653c,null))[_0xc5bc('0x1f')](removeEntity(_0x13653c,null))[_0xc5bc('0x3a')](handleError(_0x13653c,null));};exports[_0xc5bc('0x42')]=function(_0x8d4e17,_0x48a665){return db[_0xc5bc('0x24')][_0xc5bc('0x42')]()[_0xc5bc('0x1f')](respondWithResult(_0x48a665,null))[_0xc5bc('0x3a')](handleError(_0x48a665,null));};exports[_0xc5bc('0x43')]=function(_0xe0bff,_0x498551,_0x1b5f5f){var _0x4562d9={'raw':!![],'where':{}};var _0x42e0da={};var _0x2d574b={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0xe0bff['params']['id']}})['then'](handleEntityNotFound(_0x498551,null))[_0xc5bc('0x1f')](function(_0x24ad15){if(_0x24ad15){_0x42e0da['model']=_[_0xc5bc('0x3c')](db[_0xc5bc('0x44')][_0xc5bc('0x25')]);_0x42e0da['query']=_[_0xc5bc('0x3c')](_0xe0bff[_0xc5bc('0x29')]);_0x42e0da['filters']=_[_0xc5bc('0x2b')](_0x42e0da[_0xc5bc('0x2c')],_0x42e0da[_0xc5bc('0x29')]);_0x4562d9['attributes']=_[_0xc5bc('0x2b')](_0x42e0da[_0xc5bc('0x2c')],qs['fields'](_0xe0bff[_0xc5bc('0x29')][_0xc5bc('0x2d')]));_0x4562d9['attributes']=_0x4562d9['attributes']['length']?_0x4562d9[_0xc5bc('0x2f')]:_0x42e0da[_0xc5bc('0x2c')];if(!_0xe0bff['query']['hasOwnProperty'](_0xc5bc('0x31'))){_0x4562d9[_0xc5bc('0x1c')]=qs[_0xc5bc('0x1c')](_0xe0bff[_0xc5bc('0x29')][_0xc5bc('0x1c')]);_0x4562d9[_0xc5bc('0x1b')]=qs[_0xc5bc('0x1b')](_0xe0bff[_0xc5bc('0x29')][_0xc5bc('0x1b')]);}_0x4562d9[_0xc5bc('0x45')]=qs['sort'](_0xe0bff[_0xc5bc('0x29')]['sort']);_0x4562d9['where']=qs[_0xc5bc('0x2a')](_[_0xc5bc('0x46')](_0xe0bff[_0xc5bc('0x29')],_0x42e0da[_0xc5bc('0x2a')]));_0x4562d9[_0xc5bc('0x33')][_0xc5bc('0x47')]=_0x24ad15['id'];if(_0xe0bff[_0xc5bc('0x29')][_0xc5bc('0x34')]){_0x4562d9[_0xc5bc('0x33')]=_['merge'](_0x4562d9[_0xc5bc('0x33')],{'$or':_[_0xc5bc('0x23')](_0x4562d9[_0xc5bc('0x2f')],function(_0x1ad167){var _0x26c6b5={};_0x26c6b5[_0x1ad167]={'$like':'%'+_0xe0bff[_0xc5bc('0x29')][_0xc5bc('0x34')]+'%'};return _0x26c6b5;})});}_0x4562d9=_[_0xc5bc('0x35')]({},_0x4562d9,_0xe0bff[_0xc5bc('0x3d')]);return db[_0xc5bc('0x44')][_0xc5bc('0x1a')]({'where':_0x4562d9['where']})[_0xc5bc('0x1f')](function(_0x43a7c0){_0x2d574b[_0xc5bc('0x1a')]=_0x43a7c0;if(_0xe0bff[_0xc5bc('0x29')][_0xc5bc('0x37')]){_0x4562d9[_0xc5bc('0x38')]=[{'all':!![]}];}return db[_0xc5bc('0x44')]['findAll'](_0x4562d9);})[_0xc5bc('0x1f')](function(_0x5e89de){_0x2d574b['rows']=_0x5e89de;return _0x2d574b;});}})[_0xc5bc('0x1f')](respondWithFilteredResult(_0x498551,_0x4562d9))[_0xc5bc('0x3a')](handleError(_0x498551,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4f4d8c0..f67d18d 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 _0x2eba=['report_jscripty_sessions','util','../../config/logger','api','moment','path','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x4b3d12,_0x1d4133){var _0x104e8c=function(_0x55db69){while(--_0x55db69){_0x4b3d12['push'](_0x4b3d12['shift']());}};_0x104e8c(++_0x1d4133);}(_0x2eba,0xc7));var _0xa2eb=function(_0x1651fe,_0x385d3f){_0x1651fe=_0x1651fe-0x0;var _0x2b85ce=_0x2eba[_0x1651fe];return _0x2b85ce;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));module[_0xa2eb('0x7')]=function(_0x1e6fa2,_0x575a5c){return _0x1e6fa2['define']('JscriptySessionReport',attributes,{'tableName':_0xa2eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','../../config/logger','api','moment'];(function(_0x47513d,_0x335d90){var _0x55c187=function(_0x10dcfb){while(--_0x10dcfb){_0x47513d['push'](_0x47513d['shift']());}};_0x55c187(++_0x335d90);}(_0x5f2f,0x73));var _0xf5f2=function(_0x339c7e,_0x4e3b7b){_0x339c7e=_0x339c7e-0x0;var _0x9809bc=_0x5f2f[_0x339c7e];return _0x9809bc;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e4a6514..03e4a2e 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 _0x6427=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x6427,0xbe));var _0x7642=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x6427[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x7642('0x0'));var moment=require(_0x7642('0x1'));var BPromise=require(_0x7642('0x2'));var rs=require(_0x7642('0x3'));var fs=require('fs');var Redis=require(_0x7642('0x4'));var db=require(_0x7642('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7642('0x6'))(_0x7642('0x7'));var config=require(_0x7642('0x8'));var jayson=require(_0x7642('0x9'));var client=jayson[_0x7642('0xa')][_0x7642('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cd5f4,_0x266b9b,_0xd37092){return new BPromise(function(_0x30946f,_0x5e4b1f){return client['request'](_0x1cd5f4,_0xd37092)[_0x7642('0xc')](function(_0x17527f){logger[_0x7642('0xd')](_0x7642('0xe'),_0x266b9b,_0x7642('0xf'));logger[_0x7642('0x10')](_0x7642('0x11'),_0x266b9b,_0x7642('0xf'),JSON[_0x7642('0x12')](_0x17527f));if(_0x17527f[_0x7642('0x13')]){if(_0x17527f[_0x7642('0x13')][_0x7642('0x14')]===0x1f4){logger[_0x7642('0x13')](_0x7642('0xe'),_0x266b9b,_0x17527f[_0x7642('0x13')][_0x7642('0x15')]);return _0x5e4b1f(_0x17527f[_0x7642('0x13')]['message']);}logger[_0x7642('0x13')](_0x7642('0xe'),_0x266b9b,_0x17527f['error'][_0x7642('0x15')]);return _0x30946f(_0x17527f['error'][_0x7642('0x15')]);}else{logger['info'](_0x7642('0xe'),_0x266b9b,_0x7642('0xf'));_0x30946f(_0x17527f[_0x7642('0x16')][_0x7642('0x15')]);}})[_0x7642('0x17')](function(_0x2febf8){logger[_0x7642('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x266b9b,_0x2febf8);_0x5e4b1f(_0x2febf8);});});} \ No newline at end of file +var _0x2e21=['request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1c7534,_0x50b70b){var _0x31c5c1=function(_0x7df4d6){while(--_0x7df4d6){_0x1c7534['push'](_0x1c7534['shift']());}};_0x31c5c1(++_0x50b70b);}(_0x2e21,0xba));var _0x12e2=function(_0x125037,_0x58bfae){_0x125037=_0x125037-0x0;var _0x3341bc=_0x2e21[_0x125037];return _0x3341bc;};'use strict';var _=require(_0x12e2('0x0'));var util=require(_0x12e2('0x1'));var moment=require(_0x12e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12e2('0x4'))['db'];var utils=require(_0x12e2('0x5'));var logger=require(_0x12e2('0x6'))(_0x12e2('0x7'));var config=require(_0x12e2('0x8'));var jayson=require(_0x12e2('0x9'));var client=jayson[_0x12e2('0xa')][_0x12e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f52d6,_0x2a7059,_0x321e79){return new BPromise(function(_0x372494,_0x4a53a2){return client[_0x12e2('0xc')](_0x2f52d6,_0x321e79)['then'](function(_0xf7ae46){logger['info'](_0x12e2('0xd'),_0x2a7059,_0x12e2('0xe'));logger[_0x12e2('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2a7059,_0x12e2('0xe'),JSON[_0x12e2('0x10')](_0xf7ae46));if(_0xf7ae46['error']){if(_0xf7ae46[_0x12e2('0x11')]['code']===0x1f4){logger[_0x12e2('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x2a7059,_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);return _0x4a53a2(_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);}logger[_0x12e2('0x11')](_0x12e2('0xd'),_0x2a7059,_0xf7ae46[_0x12e2('0x11')][_0x12e2('0x12')]);return _0x372494(_0xf7ae46[_0x12e2('0x11')]['message']);}else{logger[_0x12e2('0x13')](_0x12e2('0xd'),_0x2a7059,_0x12e2('0xe'));_0x372494(_0xf7ae46[_0x12e2('0x14')][_0x12e2('0x12')]);}})[_0x12e2('0x15')](function(_0x18e557){logger[_0x12e2('0x11')](_0x12e2('0xd'),_0x2a7059,_0x18e557);_0x4a53a2(_0x18e557);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6b901df..90b56b4 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 _0x7f43=['./license.controller','index','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4a778a,_0x42fc80){var _0x29a3d3=function(_0x5ce5cf){while(--_0x5ce5cf){_0x4a778a['push'](_0x4a778a['shift']());}};_0x29a3d3(++_0x42fc80);}(_0x7f43,0xdd));var _0x37f4=function(_0x35a153,_0x36047f){_0x35a153=_0x35a153-0x0;var _0x2b000a=_0x7f43[_0x35a153];return _0x2b000a;};'use strict';var multer=require(_0x37f4('0x0'));var util=require(_0x37f4('0x1'));var path=require('path');var timeout=require(_0x37f4('0x2'));var express=require(_0x37f4('0x3'));var router=express[_0x37f4('0x4')]();var auth=require(_0x37f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37f4('0x6'));var controller=require(_0x37f4('0x7'));router['get']('/',controller[_0x37f4('0x8')]);router[_0x37f4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x37f4('0xa')]);module[_0x37f4('0xb')]=router; \ No newline at end of file +var _0x6df5=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','isAuthenticated','update','exports'];(function(_0x409ec2,_0x1270c4){var _0x2a811c=function(_0x5a6035){while(--_0x5a6035){_0x409ec2['push'](_0x409ec2['shift']());}};_0x2a811c(++_0x1270c4);}(_0x6df5,0x1c7));var _0x56df=function(_0x1d8d9e,_0x20b77b){_0x1d8d9e=_0x1d8d9e-0x0;var _0x151b9d=_0x6df5[_0x1d8d9e];return _0x151b9d;};'use strict';var multer=require(_0x56df('0x0'));var util=require(_0x56df('0x1'));var path=require(_0x56df('0x2'));var timeout=require('connect-timeout');var express=require(_0x56df('0x3'));var router=express['Router']();var auth=require(_0x56df('0x4'));var interaction=require(_0x56df('0x5'));var config=require(_0x56df('0x6'));var controller=require(_0x56df('0x7'));router[_0x56df('0x8')]('/',controller[_0x56df('0x9')]);router['put']('/:id',auth[_0x56df('0xa')](),controller[_0x56df('0xb')]);module[_0x56df('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 9b9af28..2bcef80 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 _0xdbf5=['exports','STRING','INTEGER'];(function(_0x4b630,_0x151f86){var _0x24f855=function(_0x2ead2a){while(--_0x2ead2a){_0x4b630['push'](_0x4b630['shift']());}};_0x24f855(++_0x151f86);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x444996,_0x57805b){_0x444996=_0x444996-0x0;var _0x380e17=_0xdbf5[_0x444996];return _0x380e17;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe2fe=['STRING','INTEGER','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xee2f('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xee2f('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 345c5da..a926e2c 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 _0x8091=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','options','catch','body','get','checkLicense','key','demo','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','squel','crypto'];(function(_0x3d5d0d,_0x1e9398){var _0x4ba730=function(_0x1624db){while(--_0x1624db){_0x3d5d0d['push'](_0x3d5d0d['shift']());}};_0x4ba730(++_0x1e9398);}(_0x8091,0xe2));var _0x1809=function(_0x10234f,_0x334f96){_0x10234f=_0x10234f-0x0;var _0x162065=_0x8091[_0x10234f];return _0x162065;};'use strict';var pdf=require(_0x1809('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1809('0x1'));var jsonpatch=require(_0x1809('0x2'));var rp=require(_0x1809('0x3'));var moment=require('moment');var BPromise=require(_0x1809('0x4'));var Mustache=require('mustache');var util=require(_0x1809('0x5'));var path=require(_0x1809('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1809('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1809('0x8'));var crypto=require(_0x1809('0x9'));var jsforce=require(_0x1809('0xa'));var deskjs=require(_0x1809('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1809('0xc'));var Papa=require(_0x1809('0xd'));var Redis=require(_0x1809('0xe'));var authService=require(_0x1809('0xf'));var qs=require(_0x1809('0x10'));var as=require(_0x1809('0x11'));var hardwareService=require(_0x1809('0x12'));var logger=require(_0x1809('0x13'))('api');var utils=require(_0x1809('0x14'));var config=require(_0x1809('0x15'));var db=require(_0x1809('0x16'))['db'];function respondWithStatusCode(_0x481a2f,_0x10e380){_0x10e380=_0x10e380||0xcc;return function(_0x3a6964){if(_0x3a6964){return _0x481a2f[_0x1809('0x17')](_0x10e380);}return _0x481a2f[_0x1809('0x18')](_0x10e380)[_0x1809('0x19')]();};}function respondWithResult(_0x70704b,_0xf73170){_0xf73170=_0xf73170||0xc8;return function(_0x3e3ece){if(_0x3e3ece){return _0x70704b[_0x1809('0x18')](_0xf73170)[_0x1809('0x1a')](_0x3e3ece);}};}function respondWithFilteredResult(_0x254375,_0x31fda6){return function(_0x13d299){if(_0x13d299){var _0x21d695=_0x13d299[_0x1809('0x1b')],_0xdb1ca=_0x31fda6[_0x1809('0x1c')],_0x20add6=_0x31fda6[_0x1809('0x1c')]+_0x31fda6[_0x1809('0x1d')],_0x46f97b;if(_0x20add6>=_0x21d695){_0x20add6=_0x21d695;_0x46f97b=0xc8;}else{_0x46f97b=0xce;}_0x254375[_0x1809('0x18')](_0x46f97b);return _0x254375[_0x1809('0x1e')](_0x1809('0x1f'),_0xdb1ca+'-'+_0x20add6+'/'+_0x21d695)[_0x1809('0x1a')](_0x13d299);}return null;};}function patchUpdates(_0x1175c8){return function(_0x37529c){try{jsonpatch[_0x1809('0x20')](_0x37529c,_0x1175c8,!![]);}catch(_0x2143da){return BPromise[_0x1809('0x21')](_0x2143da);}return _0x37529c['save']();};}function saveUpdates(_0x26b46a,_0x3c836a){return function(_0x705c5f){if(_0x705c5f){return _0x705c5f[_0x1809('0x22')](_0x26b46a)[_0x1809('0x23')](function(_0x3fe57a){return _0x3fe57a;});}return null;};}function removeEntity(_0x196f2b,_0x55a5c4){return function(_0x262436){if(_0x262436){return _0x262436[_0x1809('0x24')]()[_0x1809('0x23')](function(){_0x196f2b['status'](0xcc)[_0x1809('0x19')]();});}};}function handleEntityNotFound(_0x2b67af,_0x33da55){return function(_0x2f2ea0){if(!_0x2f2ea0){_0x2b67af[_0x1809('0x17')](0x194);}return _0x2f2ea0;};}function handleError(_0x5732b3,_0x3803d0){_0x3803d0=_0x3803d0||0x1f4;return function(_0x1c41f9){logger['error'](_0x1c41f9[_0x1809('0x25')]);if(_0x1c41f9['name']){delete _0x1c41f9[_0x1809('0x26')];}_0x5732b3[_0x1809('0x18')](_0x3803d0)[_0x1809('0x27')](_0x1c41f9);};}var utilLicense=require(_0x1809('0x28'));exports[_0x1809('0x29')]=function(_0x847baf,_0x3708b0){var _0x2e818d={'raw':!![],'where':{'id':0x1}},_0x5af8d3={};_0x5af8d3[_0x1809('0x2a')]=_[_0x1809('0x2b')](db[_0x1809('0x2c')][_0x1809('0x2d')]);_0x5af8d3[_0x1809('0x2e')]=_['keys'](_0x847baf['query']);_0x5af8d3[_0x1809('0x2f')]=_['intersection'](_0x5af8d3[_0x1809('0x2a')],_0x5af8d3[_0x1809('0x2e')]);_0x2e818d[_0x1809('0x30')]=_[_0x1809('0x31')](_0x5af8d3[_0x1809('0x2a')],qs[_0x1809('0x32')](_0x847baf[_0x1809('0x2e')][_0x1809('0x32')]));_0x2e818d[_0x1809('0x30')]=_0x2e818d[_0x1809('0x30')][_0x1809('0x33')]?_0x2e818d[_0x1809('0x30')]:_0x5af8d3['model'];_0x2e818d=_['merge']({},_0x2e818d,_0x847baf[_0x1809('0x34')]);return utilLicense['getLicense'](_0x2e818d)['then'](respondWithResult(_0x3708b0,null))[_0x1809('0x35')](handleError(_0x3708b0,null));};exports['update']=function(_0x415768,_0x5697){if(_0x415768[_0x1809('0x36')]['id']){delete _0x415768[_0x1809('0x36')]['id'];}return db[_0x1809('0x2c')]['find']({'where':{'id':_0x415768['params']['id']}})[_0x1809('0x23')](handleEntityNotFound(_0x5697,null))[_0x1809('0x23')](function(_0x53232a){var _0x19e4e6=_0x53232a[_0x1809('0x37')]({'plain':!![]});return utilLicense[_0x1809('0x38')](_0x19e4e6,_0x415768['body'][_0x1809('0x39')]);})['then'](function(_0x32e336){if(!_0x32e336[_0x1809('0x3a')]){return saveUpdates(_0x415768[_0x1809('0x36')],null);}return _0x32e336;})[_0x1809('0x23')](respondWithResult(_0x5697,null))[_0x1809('0x35')](handleError(_0x5697,null));}; \ No newline at end of file +var _0x7a13=['fields','options','getLicense','catch','update','body','License','find','get','checkLicense','key','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','reject','then','error','stack','name','send','../../config/license/util','index','model','keys','rawAttributes','query','filters','intersection','attributes'];(function(_0x18cd55,_0x314fc4){var _0x295117=function(_0x18b2d7){while(--_0x18b2d7){_0x18cd55['push'](_0x18cd55['shift']());}};_0x295117(++_0x314fc4);}(_0x7a13,0x1af));var _0x37a1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7a13[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x37a1('0x0'));var emlformat=require(_0x37a1('0x1'));var rimraf=require(_0x37a1('0x2'));var zipdir=require(_0x37a1('0x3'));var jsonpatch=require(_0x37a1('0x4'));var rp=require(_0x37a1('0x5'));var moment=require(_0x37a1('0x6'));var BPromise=require(_0x37a1('0x7'));var Mustache=require(_0x37a1('0x8'));var util=require('util');var path=require(_0x37a1('0x9'));var sox=require(_0x37a1('0xa'));var csv=require(_0x37a1('0xb'));var ejs=require(_0x37a1('0xc'));var fs=require('fs');var _=require(_0x37a1('0xd'));var squel=require(_0x37a1('0xe'));var crypto=require(_0x37a1('0xf'));var jsforce=require(_0x37a1('0x10'));var deskjs=require(_0x37a1('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x37a1('0x12'));var Redis=require(_0x37a1('0x13'));var authService=require(_0x37a1('0x14'));var qs=require(_0x37a1('0x15'));var as=require(_0x37a1('0x16'));var hardwareService=require(_0x37a1('0x17'));var logger=require(_0x37a1('0x18'))('api');var utils=require(_0x37a1('0x19'));var config=require(_0x37a1('0x1a'));var db=require(_0x37a1('0x1b'))['db'];function respondWithStatusCode(_0x2e4a55,_0x388a30){_0x388a30=_0x388a30||0xcc;return function(_0x5eab9e){if(_0x5eab9e){return _0x2e4a55[_0x37a1('0x1c')](_0x388a30);}return _0x2e4a55[_0x37a1('0x1d')](_0x388a30)[_0x37a1('0x1e')]();};}function respondWithResult(_0x2ebc40,_0x58b8fb){_0x58b8fb=_0x58b8fb||0xc8;return function(_0x2b54df){if(_0x2b54df){return _0x2ebc40['status'](_0x58b8fb)[_0x37a1('0x1f')](_0x2b54df);}};}function respondWithFilteredResult(_0x3f3f33,_0x2de801){return function(_0x5ce9e7){if(_0x5ce9e7){var _0x5ce260=_0x5ce9e7['count'],_0x480d56=_0x2de801[_0x37a1('0x20')],_0x402998=_0x2de801['offset']+_0x2de801['limit'],_0x1d7a84;if(_0x402998>=_0x5ce260){_0x402998=_0x5ce260;_0x1d7a84=0xc8;}else{_0x1d7a84=0xce;}_0x3f3f33[_0x37a1('0x1d')](_0x1d7a84);return _0x3f3f33['set'](_0x37a1('0x21'),_0x480d56+'-'+_0x402998+'/'+_0x5ce260)['json'](_0x5ce9e7);}return null;};}function patchUpdates(_0x4fed63){return function(_0x232622){try{jsonpatch['apply'](_0x232622,_0x4fed63,!![]);}catch(_0x216682){return BPromise[_0x37a1('0x22')](_0x216682);}return _0x232622['save']();};}function saveUpdates(_0x1b6aa7,_0x5d120f){return function(_0x593963){if(_0x593963){return _0x593963['update'](_0x1b6aa7)[_0x37a1('0x23')](function(_0x5e3230){return _0x5e3230;});}return null;};}function removeEntity(_0x4156a6,_0x540c97){return function(_0x15929c){if(_0x15929c){return _0x15929c['destroy']()[_0x37a1('0x23')](function(){_0x4156a6[_0x37a1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2efbf3,_0x57b905){return function(_0x175ae4){if(!_0x175ae4){_0x2efbf3['sendStatus'](0x194);}return _0x175ae4;};}function handleError(_0x107278,_0x46f2a8){_0x46f2a8=_0x46f2a8||0x1f4;return function(_0x305e25){logger[_0x37a1('0x24')](_0x305e25[_0x37a1('0x25')]);if(_0x305e25[_0x37a1('0x26')]){delete _0x305e25[_0x37a1('0x26')];}_0x107278[_0x37a1('0x1d')](_0x46f2a8)[_0x37a1('0x27')](_0x305e25);};}var utilLicense=require(_0x37a1('0x28'));exports[_0x37a1('0x29')]=function(_0x5be7e1,_0x236427){var _0x1f839e={'raw':!![],'where':{'id':0x1}},_0x5a8e68={};_0x5a8e68[_0x37a1('0x2a')]=_[_0x37a1('0x2b')](db['License'][_0x37a1('0x2c')]);_0x5a8e68[_0x37a1('0x2d')]=_[_0x37a1('0x2b')](_0x5be7e1[_0x37a1('0x2d')]);_0x5a8e68[_0x37a1('0x2e')]=_[_0x37a1('0x2f')](_0x5a8e68['model'],_0x5a8e68[_0x37a1('0x2d')]);_0x1f839e[_0x37a1('0x30')]=_['intersection'](_0x5a8e68[_0x37a1('0x2a')],qs[_0x37a1('0x31')](_0x5be7e1[_0x37a1('0x2d')][_0x37a1('0x31')]));_0x1f839e[_0x37a1('0x30')]=_0x1f839e[_0x37a1('0x30')]['length']?_0x1f839e[_0x37a1('0x30')]:_0x5a8e68['model'];_0x1f839e=_['merge']({},_0x1f839e,_0x5be7e1[_0x37a1('0x32')]);return utilLicense[_0x37a1('0x33')](_0x1f839e)[_0x37a1('0x23')](respondWithResult(_0x236427,null))[_0x37a1('0x34')](handleError(_0x236427,null));};exports[_0x37a1('0x35')]=function(_0x4187ac,_0x4dd509){if(_0x4187ac['body']['id']){delete _0x4187ac[_0x37a1('0x36')]['id'];}return db[_0x37a1('0x37')][_0x37a1('0x38')]({'where':{'id':_0x4187ac['params']['id']}})[_0x37a1('0x23')](handleEntityNotFound(_0x4dd509,null))[_0x37a1('0x23')](function(_0x649f5e){var _0x30ba8a=_0x649f5e[_0x37a1('0x39')]({'plain':!![]});return utilLicense[_0x37a1('0x3a')](_0x30ba8a,_0x4187ac['body'][_0x37a1('0x3b')]);})['then'](function(_0x39cd91){if(!_0x39cd91['demo']){return saveUpdates(_0x4187ac[_0x37a1('0x36')],null);}return _0x39cd91;})[_0x37a1('0x23')](respondWithResult(_0x4dd509,null))[_0x37a1('0x34')](handleError(_0x4dd509,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e956a11..4d51efd 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','license','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x369a0d,_0x3f8019){var _0x2a4244=function(_0x42a7da){while(--_0x42a7da){_0x369a0d['push'](_0x369a0d['shift']());}};_0x2a4244(++_0x3f8019);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d6135,_0x256136){_0x3d6135=_0x3d6135-0x0;var _0x16f3c1=_0xb10b[_0x3d6135];return _0x16f3c1;};'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 diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index df429e5..a7c8879 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 _0x9173=['client','http','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3ab47f,_0x441b32){var _0x1221fe=function(_0x5176b6){while(--_0x5176b6){_0x3ab47f['push'](_0x3ab47f['shift']());}};_0x1221fe(++_0x441b32);}(_0x9173,0xb4));var _0x3917=function(_0x57dae3,_0x10f468){_0x57dae3=_0x57dae3-0x0;var _0x1c98de=_0x9173[_0x57dae3];return _0x1c98de;};'use strict';var _=require(_0x3917('0x0'));var util=require(_0x3917('0x1'));var moment=require('moment');var BPromise=require(_0x3917('0x2'));var rs=require(_0x3917('0x3'));var fs=require('fs');var Redis=require(_0x3917('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3917('0x5'));var logger=require('../../config/logger')(_0x3917('0x6'));var config=require(_0x3917('0x7'));var jayson=require(_0x3917('0x8'));var client=jayson[_0x3917('0x9')][_0x3917('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d592,_0x181918,_0x27f513){return new BPromise(function(_0x11267b,_0x44d50e){return client[_0x3917('0xb')](_0x48d592,_0x27f513)[_0x3917('0xc')](function(_0x58282f){logger[_0x3917('0xd')](_0x3917('0xe'),_0x181918,'request\x20sent');logger[_0x3917('0xf')](_0x3917('0x10'),_0x181918,'request\x20sent',JSON['stringify'](_0x58282f));if(_0x58282f['error']){if(_0x58282f[_0x3917('0x11')][_0x3917('0x12')]===0x1f4){logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x58282f[_0x3917('0x11')][_0x3917('0x13')]);return _0x44d50e(_0x58282f['error'][_0x3917('0x13')]);}logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x58282f[_0x3917('0x11')]['message']);return _0x11267b(_0x58282f[_0x3917('0x11')][_0x3917('0x13')]);}else{logger[_0x3917('0xd')](_0x3917('0xe'),_0x181918,_0x3917('0x14'));_0x11267b(_0x58282f['result'][_0x3917('0x13')]);}})['catch'](function(_0x4912cd){logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x4912cd);_0x44d50e(_0x4912cd);});});} \ No newline at end of file +var _0xbbfa=['License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x276f25,_0x4e485b){var _0x3bb4fa=function(_0x21c5f5){while(--_0x21c5f5){_0x276f25['push'](_0x276f25['shift']());}};_0x3bb4fa(++_0x4e485b);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x504575,_0x1ad9e0){_0x504575=_0x504575-0x0;var _0x4484cc=_0xbbfa[_0x504575];return _0x4484cc;};'use strict';var _=require(_0xabbf('0x0'));var util=require('util');var moment=require(_0xabbf('0x1'));var BPromise=require('bluebird');var rs=require(_0xabbf('0x2'));var fs=require('fs');var Redis=require(_0xabbf('0x3'));var db=require(_0xabbf('0x4'))['db'];var utils=require(_0xabbf('0x5'));var logger=require(_0xabbf('0x6'))(_0xabbf('0x7'));var config=require(_0xabbf('0x8'));var jayson=require(_0xabbf('0x9'));var client=jayson[_0xabbf('0xa')][_0xabbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b7d6,_0x58f0a8,_0x5b471b){return new BPromise(function(_0x536a4c,_0x1380cd){return client[_0xabbf('0xc')](_0x45b7d6,_0x5b471b)['then'](function(_0x5f35ee){logger[_0xabbf('0xd')]('License,\x20%s,\x20%s',_0x58f0a8,_0xabbf('0xe'));logger['debug'](_0xabbf('0xf'),_0x58f0a8,'request\x20sent',JSON['stringify'](_0x5f35ee));if(_0x5f35ee[_0xabbf('0x10')]){if(_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x11')]===0x1f4){logger[_0xabbf('0x10')](_0xabbf('0x12'),_0x58f0a8,_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x13')]);return _0x1380cd(_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x13')]);}logger['error'](_0xabbf('0x12'),_0x58f0a8,_0x5f35ee['error'][_0xabbf('0x13')]);return _0x536a4c(_0x5f35ee['error'][_0xabbf('0x13')]);}else{logger[_0xabbf('0xd')](_0xabbf('0x12'),_0x58f0a8,_0xabbf('0xe'));_0x536a4c(_0x5f35ee['result'][_0xabbf('0x13')]);}})[_0xabbf('0x14')](function(_0x31245d){logger[_0xabbf('0x10')](_0xabbf('0x12'),_0x58f0a8,_0x31245d);_0x1380cd(_0x31245d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 53f5d25..899c99b 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 _0x4fd5=['describe','/:id','show','getAnswers','/:id/in_servers','getImap','getSmtp','getInteractions','getApplications','getMessages','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','/:id/canned_answers','addAnswer','addImap','/:id/out_servers','addSmtp','/:id/interactions','addInteraction','/:id/applications','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x4fd5,0x193));var _0x54fd=function(_0x116478,_0x34ecc9){_0x116478=_0x116478-0x0;var _0x1b3b6b=_0x4fd5[_0x116478];return _0x1b3b6b;};'use strict';var multer=require(_0x54fd('0x0'));var util=require(_0x54fd('0x1'));var path=require(_0x54fd('0x2'));var timeout=require(_0x54fd('0x3'));var express=require(_0x54fd('0x4'));var router=express[_0x54fd('0x5')]();var auth=require(_0x54fd('0x6'));var interaction=require(_0x54fd('0x7'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0x54fd('0x8')](),controller['index']);router[_0x54fd('0x9')](_0x54fd('0xa'),auth[_0x54fd('0x8')](),controller[_0x54fd('0xb')]);router[_0x54fd('0x9')](_0x54fd('0xc'),auth[_0x54fd('0x8')](),controller[_0x54fd('0xd')]);router[_0x54fd('0x9')]('/:id/dispositions',auth[_0x54fd('0x8')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x54fd('0x8')](),controller[_0x54fd('0xe')]);router['get'](_0x54fd('0xf'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x10')]);router[_0x54fd('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x54fd('0x11')]);router[_0x54fd('0x9')]('/:id/interactions',auth[_0x54fd('0x8')](),controller[_0x54fd('0x12')]);router[_0x54fd('0x9')]('/:id/applications',auth[_0x54fd('0x8')](),controller[_0x54fd('0x13')]);router[_0x54fd('0x9')]('/:id/messages',auth[_0x54fd('0x8')](),controller[_0x54fd('0x14')]);router['get']('/:id/verify',auth[_0x54fd('0x8')](),controller[_0x54fd('0x15')]);router[_0x54fd('0x9')](_0x54fd('0x16'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x17')]);router['post'](_0x54fd('0x18'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x19')]);router[_0x54fd('0x1a')](_0x54fd('0x1b'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x1c')]);router[_0x54fd('0x1a')]('/',auth[_0x54fd('0x8')](),controller['create']);router['post']('/:id/in_servers',auth[_0x54fd('0x8')](),controller[_0x54fd('0x1d')]);router['post'](_0x54fd('0x1e'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x1f')]);router['post'](_0x54fd('0x20'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x21')]);router[_0x54fd('0x1a')](_0x54fd('0x22'),auth[_0x54fd('0x8')](),controller['addApplications']);router[_0x54fd('0x1a')](_0x54fd('0x23'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x24')]);router['post'](_0x54fd('0x16'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x25')]);router[_0x54fd('0x26')](_0x54fd('0xc'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x27')]);router['delete'](_0x54fd('0x18'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x28')]);router[_0x54fd('0x29')]('/:id/canned_answers',auth[_0x54fd('0x8')](),controller[_0x54fd('0x2a')]);router['delete']('/:id/in_servers',auth[_0x54fd('0x8')](),controller[_0x54fd('0x2b')]);router[_0x54fd('0x29')](_0x54fd('0x1e'),auth[_0x54fd('0x8')](),controller[_0x54fd('0x2c')]);router[_0x54fd('0x29')]('/:id',auth[_0x54fd('0x8')](),controller['destroy']);router[_0x54fd('0x29')]('/:id/users',auth[_0x54fd('0x8')](),controller[_0x54fd('0x2d')]);module['exports']=router; \ No newline at end of file +var _0x514e=['verifySmtp','getAgents','addDisposition','post','addAnswer','create','/:id/out_servers','addSmtp','/:id/interactions','addInteraction','addApplications','send','/:id/users','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','getInteractions','/:id/applications','getApplications','getMessages'];(function(_0x216370,_0x4b9c47){var _0x93aa9d=function(_0x2f1ca4){while(--_0x2f1ca4){_0x216370['push'](_0x216370['shift']());}};_0x93aa9d(++_0x4b9c47);}(_0x514e,0x73));var _0xe514=function(_0x2c5018,_0x17078a){_0x2c5018=_0x2c5018-0x0;var _0x14a42b=_0x514e[_0x2c5018];return _0x14a42b;};'use strict';var multer=require('multer');var util=require(_0xe514('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe514('0x1'));var router=express[_0xe514('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe514('0x3'));var config=require(_0xe514('0x4'));var controller=require('./mailAccount.controller');router[_0xe514('0x5')]('/',auth[_0xe514('0x6')](),controller[_0xe514('0x7')]);router[_0xe514('0x5')](_0xe514('0x8'),auth[_0xe514('0x6')](),controller[_0xe514('0x9')]);router['get']('/:id',auth[_0xe514('0x6')](),controller[_0xe514('0xa')]);router[_0xe514('0x5')](_0xe514('0xb'),auth[_0xe514('0x6')](),controller[_0xe514('0xc')]);router[_0xe514('0x5')](_0xe514('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe514('0x5')](_0xe514('0xe'),auth[_0xe514('0x6')](),controller[_0xe514('0xf')]);router[_0xe514('0x5')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0xe514('0x5')]('/:id/interactions',auth[_0xe514('0x6')](),controller[_0xe514('0x10')]);router['get'](_0xe514('0x11'),auth[_0xe514('0x6')](),controller[_0xe514('0x12')]);router[_0xe514('0x5')]('/:id/messages',auth[_0xe514('0x6')](),controller[_0xe514('0x13')]);router[_0xe514('0x5')]('/:id/verify',auth[_0xe514('0x6')](),controller[_0xe514('0x14')]);router[_0xe514('0x5')]('/:id/users',auth[_0xe514('0x6')](),controller[_0xe514('0x15')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe514('0x16')]);router[_0xe514('0x17')](_0xe514('0xd'),auth[_0xe514('0x6')](),controller[_0xe514('0x18')]);router['post']('/',auth[_0xe514('0x6')](),controller[_0xe514('0x19')]);router[_0xe514('0x17')](_0xe514('0xe'),auth[_0xe514('0x6')](),controller['addImap']);router[_0xe514('0x17')](_0xe514('0x1a'),auth[_0xe514('0x6')](),controller[_0xe514('0x1b')]);router[_0xe514('0x17')](_0xe514('0x1c'),auth[_0xe514('0x6')](),controller[_0xe514('0x1d')]);router[_0xe514('0x17')](_0xe514('0x11'),auth[_0xe514('0x6')](),controller[_0xe514('0x1e')]);router[_0xe514('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xe514('0x1f')]);router[_0xe514('0x17')](_0xe514('0x20'),auth[_0xe514('0x6')](),controller[_0xe514('0x21')]);router[_0xe514('0x22')](_0xe514('0x23'),auth['isAuthenticated'](),controller[_0xe514('0x24')]);router[_0xe514('0x25')](_0xe514('0xb'),auth[_0xe514('0x6')](),controller[_0xe514('0x26')]);router[_0xe514('0x25')]('/:id/canned_answers',auth[_0xe514('0x6')](),controller[_0xe514('0x27')]);router[_0xe514('0x25')]('/:id/in_servers',auth[_0xe514('0x6')](),controller[_0xe514('0x28')]);router[_0xe514('0x25')](_0xe514('0x1a'),auth['isAuthenticated'](),controller[_0xe514('0x29')]);router['delete'](_0xe514('0x23'),auth[_0xe514('0x6')](),controller[_0xe514('0x2a')]);router[_0xe514('0x25')](_0xe514('0x20'),auth[_0xe514('0x6')](),controller[_0xe514('0x2b')]);module[_0xe514('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ecb49d5..b7d9d7b 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 _0x63d4=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x3dad4a,_0x13525a){var _0x4398dc=function(_0x278cc8){while(--_0x278cc8){_0x3dad4a['push'](_0x3dad4a['shift']());}};_0x4398dc(++_0x13525a);}(_0x63d4,0x1e4));var _0x463d=function(_0xfe4948,_0x5259ae){_0xfe4948=_0xfe4948-0x0;var _0x3c752c=_0x63d4[_0xfe4948];return _0x3c752c;};'use strict';var Sequelize=require(_0x463d('0x0'));module[_0x463d('0x1')]={'description':{'type':Sequelize[_0x463d('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x463d('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x463d('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x463d('0x4')]},'markAsUnread':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x463d('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x463d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x463d('0x4')],'defaultValue':function(){return _0x463d('0x7');}},'notificationSound':{'type':Sequelize[_0x463d('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x463d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x463d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x463d('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x463d('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x463d('0x3')],'defaultValue':![],'comment':_0x463d('0xa'),'set':function(_0x2e876d){if(!_0x2e876d)this[_0x463d('0xb')](_0x463d('0xc'),null);this[_0x463d('0xb')](_0x463d('0xd'),_0x2e876d);}}}; \ No newline at end of file +var _0x19b7=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3dafe6,_0x7bcc30){var _0xe8e073=function(_0x244160){while(--_0x244160){_0x3dafe6['push'](_0x3dafe6['shift']());}};_0xe8e073(++_0x7bcc30);}(_0x19b7,0xcb));var _0x719b=function(_0x573e33,_0xea7dd9){_0x573e33=_0x573e33-0x0;var _0x1b20b5=_0x19b7[_0x573e33];return _0x1b20b5;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x719b('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x719b('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x719b('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x719b('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x719b('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x719b('0x2')]},'markAsUnread':{'type':Sequelize[_0x719b('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x719b('0x0')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x719b('0x3')](0x2)[_0x719b('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x719b('0x2')],'defaultValue':function(){return _0x719b('0x5');}},'notificationSound':{'type':Sequelize[_0x719b('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x719b('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x719b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x719b('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x719b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x719b('0x3')],'allowNull':!![],'defaultValue':null,'comment':_0x719b('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x719b('0x1')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x14a99e){if(!_0x14a99e)this[_0x719b('0x7')](_0x719b('0x8'),null);this[_0x719b('0x7')](_0x719b('0x9'),_0x14a99e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5ef8d17..feef9b4 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 _0x7429=['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','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','MailAccounts','UserProfileResource','stack','name','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Smtp','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','rawAttributes','merge','find','removeDispositions','CannedAnswer','create','getAnswers','sort','removeAnswers','ids','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','transaction','MailApplication','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','SendMail','defaults','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','./mailAccount.socket','register','jayson/promise','client','http'];(function(_0x33fdec,_0x12834e){var _0x296c6a=function(_0x3bdb9f){while(--_0x3bdb9f){_0x33fdec['push'](_0x33fdec['shift']());}};_0x296c6a(++_0x12834e);}(_0x7429,0x9e));var _0x9742=function(_0x5ca712,_0x33115c){_0x5ca712=_0x5ca712-0x0;var _0x32cbe4=_0x7429[_0x5ca712];return _0x32cbe4;};'use strict';var pdf=require(_0x9742('0x0'));var emlformat=require(_0x9742('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9742('0x2'));var jsonpatch=require(_0x9742('0x3'));var rp=require(_0x9742('0x4'));var moment=require(_0x9742('0x5'));var BPromise=require(_0x9742('0x6'));var Mustache=require(_0x9742('0x7'));var util=require(_0x9742('0x8'));var path=require('path');var sox=require(_0x9742('0x9'));var csv=require('to-csv');var ejs=require(_0x9742('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9742('0xb'));var crypto=require('crypto');var jsforce=require(_0x9742('0xc'));var deskjs=require(_0x9742('0xd'));var toCsv=require(_0x9742('0xe'));var querystring=require(_0x9742('0xf'));var Papa=require(_0x9742('0x10'));var Redis=require(_0x9742('0x11'));var authService=require(_0x9742('0x12'));var qs=require(_0x9742('0x13'));var as=require(_0x9742('0x14'));var hardwareService=require(_0x9742('0x15'));var logger=require(_0x9742('0x16'))('api');var utils=require(_0x9742('0x17'));var config=require(_0x9742('0x18'));var db=require(_0x9742('0x19'))['db'];config['redis']=_['defaults'](config[_0x9742('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9742('0x1b'))[_0x9742('0x1c')](socket);var jayson=require(_0x9742('0x1d'));var client=jayson[_0x9742('0x1e')][_0x9742('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x453f20,_0x5f1ca7,_0x512b72){if(_0x512b72){var _0xeb34fa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xeb34fa[_0x9742('0x20')](_0x5f1ca7)){return _0x453f20;}else{throw new db['Sequelize'][(_0x9742('0x21'))](_0x9742('0x22'));}}else{return _0x453f20;}}function respondWithRpcPromise(_0x127e39,_0x52fb39,_0x37d3e9,_0x3cfdf8){return new BPromise(function(_0x2e60c3,_0xabe6e5){var _0x64d3db=_0x3cfdf8||client;return _0x64d3db[_0x9742('0x23')](_0x127e39,_0x37d3e9)['then'](function(_0x272808){logger[_0x9742('0x24')](_0x9742('0x25'),_0x52fb39,'request\x20sent');logger[_0x9742('0x26')](_0x9742('0x27'),_0x52fb39,_0x9742('0x28'),JSON[_0x9742('0x29')](_0x272808));if(_0x272808[_0x9742('0x2a')]){if(_0x272808[_0x9742('0x2a')][_0x9742('0x2b')]===0x1f4){logger['error'](_0x9742('0x25'),_0x52fb39,_0x272808[_0x9742('0x2a')][_0x9742('0x2c')]);return _0xabe6e5(_0x272808[_0x9742('0x2a')][_0x9742('0x2c')]);}logger['error'](_0x9742('0x25'),_0x52fb39,_0x272808[_0x9742('0x2a')][_0x9742('0x2c')]);return _0x2e60c3(_0x272808[_0x9742('0x2a')][_0x9742('0x2c')]);}else{logger[_0x9742('0x24')](_0x9742('0x25'),_0x52fb39,_0x9742('0x28'));_0x2e60c3(_0x272808['result'][_0x9742('0x2c')]);}})[_0x9742('0x2d')](function(_0x26ddbe){logger[_0x9742('0x2a')](_0x9742('0x25'),_0x52fb39,_0x26ddbe);_0xabe6e5(_0x26ddbe);});});}function respondWithStatusCode(_0x4d384,_0x2fa858){_0x2fa858=_0x2fa858||0xcc;return function(_0x16d237){if(_0x16d237){return _0x4d384[_0x9742('0x2e')](_0x2fa858);}return _0x4d384[_0x9742('0x2f')](_0x2fa858)[_0x9742('0x30')]();};}function respondWithResult(_0x2a100d,_0x3a5835){_0x3a5835=_0x3a5835||0xc8;return function(_0x1775e5){if(_0x1775e5){return _0x2a100d[_0x9742('0x2f')](_0x3a5835)[_0x9742('0x31')](_0x1775e5);}};}function respondWithFilteredResult(_0x45ea1a,_0x3de2ed){return function(_0x50a269){if(_0x50a269){var _0xbbe135=_0x50a269[_0x9742('0x32')],_0x8bbd2d=_0x3de2ed[_0x9742('0x33')],_0x13c696=_0x3de2ed[_0x9742('0x33')]+_0x3de2ed[_0x9742('0x34')],_0xaaccdf;if(_0x13c696>=_0xbbe135){_0x13c696=_0xbbe135;_0xaaccdf=0xc8;}else{_0xaaccdf=0xce;}_0x45ea1a[_0x9742('0x2f')](_0xaaccdf);return _0x45ea1a['set'](_0x9742('0x35'),_0x8bbd2d+'-'+_0x13c696+'/'+_0xbbe135)[_0x9742('0x31')](_0x50a269);}return null;};}function patchUpdates(_0x1d9e85){return function(_0x3b86d8){try{jsonpatch[_0x9742('0x36')](_0x3b86d8,_0x1d9e85,!![]);}catch(_0xba31c8){return BPromise['reject'](_0xba31c8);}return _0x3b86d8[_0x9742('0x37')]();};}function saveUpdates(_0x1fe52f,_0x3aafaa){return function(_0x11f16e){if(_0x11f16e){return _0x11f16e[_0x9742('0x38')](_0x1fe52f)[_0x9742('0x39')](function(_0x4ce66d){return _0x4ce66d;});}return null;};}function removeEntity(_0x5a4b0a,_0x411d77){return function(_0x22af73){if(_0x22af73){return _0x22af73[_0x9742('0x3a')]()[_0x9742('0x39')](function(){var _0x17a154=_0x22af73['get']({'plain':!![]});var _0x3eaa6b=_0x9742('0x3b');return db[_0x9742('0x3c')][_0x9742('0x3a')]({'where':{'type':_0x3eaa6b,'resourceId':_0x17a154['id']}})[_0x9742('0x39')](function(){return _0x22af73;});})['then'](function(){_0x5a4b0a[_0x9742('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f7f64,_0x19532e){return function(_0x23d1cb){if(!_0x23d1cb){_0x4f7f64[_0x9742('0x2e')](0x194);}return _0x23d1cb;};}function handleError(_0x3f3642,_0x1fdf0e){_0x1fdf0e=_0x1fdf0e||0x1f4;return function(_0x1a1240){logger[_0x9742('0x2a')](_0x1a1240[_0x9742('0x3d')]);if(_0x1a1240['name']){delete _0x1a1240[_0x9742('0x3e')];}_0x3f3642[_0x9742('0x2f')](_0x1fdf0e)['send'](_0x1a1240);};}exports[_0x9742('0x3f')]=function(_0x5ee213,_0x592322){var _0xfcae41={'include':[{'model':db[_0x9742('0x40')],'as':_0x9742('0x41')},{'model':db[_0x9742('0x42')],'as':'Smtp'},{'model':db[_0x9742('0x43')],'as':_0x9742('0x44')}]},_0x5ce67a={},_0x5922dc={'count':0x0,'rows':[]};var _0x46c61b=_[_0x9742('0x45')](db[_0x9742('0x46')]['rawAttributes'],function(_0x57dcce){return{'name':_0x57dcce['fieldName'],'type':_0x57dcce[_0x9742('0x47')][_0x9742('0x48')]};});_0x5ce67a[_0x9742('0x49')]=_[_0x9742('0x45')](_0x46c61b,'name');_0x5ce67a['query']=_[_0x9742('0x4a')](_0x5ee213[_0x9742('0x4b')]);_0x5ce67a[_0x9742('0x4c')]=_[_0x9742('0x4d')](_0x5ce67a[_0x9742('0x49')],_0x5ce67a[_0x9742('0x4b')]);_0xfcae41[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x5ce67a[_0x9742('0x49')],qs[_0x9742('0x4f')](_0x5ee213[_0x9742('0x4b')][_0x9742('0x4f')]));_0xfcae41[_0x9742('0x4e')]=_0xfcae41[_0x9742('0x4e')][_0x9742('0x50')]?_0xfcae41[_0x9742('0x4e')]:_0x5ce67a[_0x9742('0x49')];if(!_0x5ee213['query'][_0x9742('0x51')](_0x9742('0x52'))){_0xfcae41[_0x9742('0x34')]=qs['limit'](_0x5ee213['query']['limit']);_0xfcae41[_0x9742('0x33')]=qs['offset'](_0x5ee213[_0x9742('0x4b')]['offset']);}_0xfcae41[_0x9742('0x53')]=qs['sort'](_0x5ee213[_0x9742('0x4b')]['sort']);_0xfcae41[_0x9742('0x54')]=qs['filters'](_[_0x9742('0x55')](_0x5ee213[_0x9742('0x4b')],_0x5ce67a['filters']),_0x46c61b);if(_0x5ee213[_0x9742('0x4b')][_0x9742('0x56')]){_0xfcae41['where']=_['merge'](_0xfcae41['where'],{'$or':_[_0x9742('0x45')](_0x46c61b,function(_0x437260){if(_0x437260[_0x9742('0x47')]!==_0x9742('0x57')){var _0x5ad17a={};_0x5ad17a[_0x437260[_0x9742('0x3e')]]={'$like':'%'+_0x5ee213['query'][_0x9742('0x56')]+'%'};return _0x5ad17a;}})});}_0xfcae41=_['merge']({},_0xfcae41,_0x5ee213[_0x9742('0x58')]);var _0xd2b8ed={'where':_0xfcae41['where']};return db[_0x9742('0x46')][_0x9742('0x32')](_0xd2b8ed)[_0x9742('0x39')](function(_0x48e007){_0x5922dc[_0x9742('0x32')]=_0x48e007;if(_0x5ee213[_0x9742('0x4b')][_0x9742('0x59')]){_0xfcae41[_0x9742('0x5a')]=[{'all':!![]}];}return db[_0x9742('0x46')][_0x9742('0x5b')](_0xfcae41);})[_0x9742('0x39')](function(_0x34e364){_0x5922dc[_0x9742('0x5c')]=_0x34e364;return _0x5922dc;})[_0x9742('0x39')](respondWithFilteredResult(_0x592322,_0xfcae41))[_0x9742('0x2d')](handleError(_0x592322,null));};exports[_0x9742('0x5d')]=function(_0x2f3c68,_0x263ef1){var _0xb9c391={'raw':![],'where':{'id':_0x2f3c68[_0x9742('0x5e')]['id']},'include':[{'model':db[_0x9742('0x40')],'as':'Imap'},{'model':db[_0x9742('0x42')],'as':_0x9742('0x5f')},{'model':db[_0x9742('0x43')],'as':_0x9742('0x44')}]},_0x50c286={};_0x50c286[_0x9742('0x49')]=_[_0x9742('0x4a')](db[_0x9742('0x46')]['rawAttributes']);_0x50c286['query']=_['keys'](_0x2f3c68[_0x9742('0x4b')]);_0x50c286['filters']=_[_0x9742('0x4d')](_0x50c286[_0x9742('0x49')],_0x50c286[_0x9742('0x4b')]);_0xb9c391['attributes']=_[_0x9742('0x4d')](_0x50c286[_0x9742('0x49')],qs[_0x9742('0x4f')](_0x2f3c68['query']['fields']));_0xb9c391[_0x9742('0x4e')]=_0xb9c391[_0x9742('0x4e')][_0x9742('0x50')]?_0xb9c391[_0x9742('0x4e')]:_0x50c286['model'];if(_0x2f3c68[_0x9742('0x4b')][_0x9742('0x59')]){_0xb9c391[_0x9742('0x5a')]=[{'all':!![]}];}_0xb9c391=_['merge']({},_0xb9c391,_0x2f3c68[_0x9742('0x58')]);return db[_0x9742('0x46')]['find'](_0xb9c391)[_0x9742('0x39')](handleEntityNotFound(_0x263ef1,null))[_0x9742('0x39')](respondWithResult(_0x263ef1,null))[_0x9742('0x2d')](handleError(_0x263ef1,null));};exports[_0x9742('0x38')]=function(_0x2d9dc9,_0x1963d7){if(_0x2d9dc9[_0x9742('0x60')]['id']){delete _0x2d9dc9['body']['id'];}return db[_0x9742('0x46')]['find']({'where':{'id':_0x2d9dc9[_0x9742('0x5e')]['id']},'include':[{'model':db[_0x9742('0x40')],'as':_0x9742('0x41')},{'model':db[_0x9742('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x9742('0x39')](handleEntityNotFound(_0x1963d7,null))[_0x9742('0x39')](saveUpdates(_0x2d9dc9[_0x9742('0x60')],null))[_0x9742('0x39')](function(_0x515610){if(_0x515610&&_0x2d9dc9['body'][_0x9742('0x41')]){return db[_0x9742('0x40')]['update'](_0x2d9dc9['body']['Imap'],{'where':{'MailAccountId':_0x515610['id']}})[_0x9742('0x39')](function(){return _0x515610;});}return _0x515610;})[_0x9742('0x39')](function(_0x313ca4){if(_0x313ca4&&_0x2d9dc9[_0x9742('0x60')][_0x9742('0x5f')]){return db[_0x9742('0x42')][_0x9742('0x38')](_0x2d9dc9[_0x9742('0x60')]['Smtp'],{'where':{'MailAccountId':_0x313ca4['id']}})[_0x9742('0x39')](function(){return _0x313ca4;});}return _0x313ca4;})['then'](respondWithResult(_0x1963d7,null))[_0x9742('0x2d')](handleError(_0x1963d7,null));};exports[_0x9742('0x61')]=function(_0xcb6a46,_0x3c6b2c){return db[_0x9742('0x46')][_0x9742('0x61')]()[_0x9742('0x39')](respondWithResult(_0x3c6b2c,null))[_0x9742('0x2d')](handleError(_0x3c6b2c,null));};exports[_0x9742('0x62')]=function(_0x112370,_0x1ba965,_0x20c103){if(_0x112370[_0x9742('0x60')]['id']){delete _0x112370['body']['id'];}return db[_0x9742('0x46')]['find']({'where':{'id':_0x112370['params']['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x1ba965,null))[_0x9742('0x39')](function(_0x29e1d4){if(_0x29e1d4){_0x112370[_0x9742('0x60')][_0x9742('0x63')]=_0x29e1d4['id'];return db[_0x9742('0x64')]['create'](_0x112370['body']);}})[_0x9742('0x39')](respondWithResult(_0x1ba965,null))[_0x9742('0x2d')](handleError(_0x1ba965,null));};exports[_0x9742('0x65')]=function(_0x31ccc6,_0x2cdf78,_0x3b55c3){var _0x28f7ab={'raw':![],'where':{}};var _0x292c40={};var _0xef88d7={'count':0x0,'rows':[]};return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x31ccc6[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x2cdf78,null))['then'](function(_0x1243ef){if(_0x1243ef){_0x292c40[_0x9742('0x49')]=_[_0x9742('0x4a')](db[_0x9742('0x64')][_0x9742('0x67')]);_0x292c40[_0x9742('0x4b')]=_['keys'](_0x31ccc6[_0x9742('0x4b')]);_0x292c40[_0x9742('0x4c')]=_[_0x9742('0x4d')](_0x292c40[_0x9742('0x49')],_0x292c40[_0x9742('0x4b')]);_0x28f7ab[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x292c40['model'],qs[_0x9742('0x4f')](_0x31ccc6[_0x9742('0x4b')]['fields']));_0x28f7ab['attributes']=_0x28f7ab[_0x9742('0x4e')][_0x9742('0x50')]?_0x28f7ab[_0x9742('0x4e')]:_0x292c40[_0x9742('0x49')];if(!_0x31ccc6['query']['hasOwnProperty']('nolimit')){_0x28f7ab[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x31ccc6[_0x9742('0x4b')]['limit']);_0x28f7ab[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x31ccc6[_0x9742('0x4b')]['offset']);}_0x28f7ab[_0x9742('0x53')]=qs['sort'](_0x31ccc6['query']['sort']);_0x28f7ab['where']=qs[_0x9742('0x4c')](_['pick'](_0x31ccc6[_0x9742('0x4b')],_0x292c40[_0x9742('0x4c')]));_0x28f7ab['where'][_0x9742('0x63')]=_0x1243ef['id'];if(_0x31ccc6[_0x9742('0x4b')][_0x9742('0x56')]){_0x28f7ab[_0x9742('0x54')]=_[_0x9742('0x68')](_0x28f7ab['where'],{'$or':_[_0x9742('0x45')](_0x28f7ab[_0x9742('0x4e')],function(_0x5144aa){var _0x4932c6={};_0x4932c6[_0x5144aa]={'$like':'%'+_0x31ccc6[_0x9742('0x4b')][_0x9742('0x56')]+'%'};return _0x4932c6;})});}_0x28f7ab=_[_0x9742('0x68')]({},_0x28f7ab,_0x31ccc6[_0x9742('0x58')]);return db['Disposition']['count']({'where':_0x28f7ab[_0x9742('0x54')]})[_0x9742('0x39')](function(_0x5dc66b){_0xef88d7[_0x9742('0x32')]=_0x5dc66b;if(_0x31ccc6[_0x9742('0x4b')][_0x9742('0x59')]){_0x28f7ab['include']=[{'all':!![]}];}return db['Disposition'][_0x9742('0x5b')](_0x28f7ab);})[_0x9742('0x39')](function(_0x1bbbe8){_0xef88d7[_0x9742('0x5c')]=_0x1bbbe8;return _0xef88d7;});}})[_0x9742('0x39')](respondWithFilteredResult(_0x2cdf78,_0x28f7ab))['catch'](handleError(_0x2cdf78,null));};exports['removeDispositions']=function(_0x57384c,_0x328296,_0x21b9d6){return db['MailAccount'][_0x9742('0x69')]({'where':{'id':_0x57384c[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x328296,null))[_0x9742('0x39')](function(_0xd52bc7){if(_0xd52bc7){return _0xd52bc7[_0x9742('0x6a')](_0x57384c[_0x9742('0x4b')]['ids']);}})[_0x9742('0x39')](respondWithStatusCode(_0x328296,null))['catch'](handleError(_0x328296,null));};exports['addAnswer']=function(_0x30e8c8,_0x46dab3,_0x4ec997){if(_0x30e8c8['body']['id']){delete _0x30e8c8[_0x9742('0x60')]['id'];}return db[_0x9742('0x46')]['find']({'where':{'id':_0x30e8c8[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x46dab3,null))[_0x9742('0x39')](function(_0x457362){if(_0x457362){_0x30e8c8[_0x9742('0x60')][_0x9742('0x63')]=_0x457362['id'];return db[_0x9742('0x6b')][_0x9742('0x6c')](_0x30e8c8[_0x9742('0x60')]);}})['then'](respondWithResult(_0x46dab3,null))[_0x9742('0x2d')](handleError(_0x46dab3,null));};exports[_0x9742('0x6d')]=function(_0x89814e,_0x75f778,_0x5e0c1c){var _0x24bc5f={'raw':![],'where':{}};var _0x15e8eb={};var _0x594256={'count':0x0,'rows':[]};return db[_0x9742('0x46')]['findOne']({'where':{'id':_0x89814e[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x75f778,null))[_0x9742('0x39')](function(_0x3e211b){if(_0x3e211b){_0x15e8eb['model']=_[_0x9742('0x4a')](db['CannedAnswer'][_0x9742('0x67')]);_0x15e8eb[_0x9742('0x4b')]=_[_0x9742('0x4a')](_0x89814e[_0x9742('0x4b')]);_0x15e8eb[_0x9742('0x4c')]=_['intersection'](_0x15e8eb[_0x9742('0x49')],_0x15e8eb['query']);_0x24bc5f[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x15e8eb[_0x9742('0x49')],qs['fields'](_0x89814e[_0x9742('0x4b')][_0x9742('0x4f')]));_0x24bc5f[_0x9742('0x4e')]=_0x24bc5f[_0x9742('0x4e')][_0x9742('0x50')]?_0x24bc5f[_0x9742('0x4e')]:_0x15e8eb[_0x9742('0x49')];if(!_0x89814e[_0x9742('0x4b')]['hasOwnProperty'](_0x9742('0x52'))){_0x24bc5f[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x89814e['query'][_0x9742('0x34')]);_0x24bc5f[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x89814e[_0x9742('0x4b')][_0x9742('0x33')]);}_0x24bc5f[_0x9742('0x53')]=qs[_0x9742('0x6e')](_0x89814e[_0x9742('0x4b')][_0x9742('0x6e')]);_0x24bc5f[_0x9742('0x54')]=qs[_0x9742('0x4c')](_[_0x9742('0x55')](_0x89814e[_0x9742('0x4b')],_0x15e8eb[_0x9742('0x4c')]));_0x24bc5f['where'][_0x9742('0x63')]=_0x3e211b['id'];if(_0x89814e[_0x9742('0x4b')][_0x9742('0x56')]){_0x24bc5f[_0x9742('0x54')]=_[_0x9742('0x68')](_0x24bc5f[_0x9742('0x54')],{'$or':_[_0x9742('0x45')](_0x24bc5f['attributes'],function(_0x2dd3e6){var _0x2ae243={};_0x2ae243[_0x2dd3e6]={'$like':'%'+_0x89814e[_0x9742('0x4b')]['filter']+'%'};return _0x2ae243;})});}_0x24bc5f=_[_0x9742('0x68')]({},_0x24bc5f,_0x89814e[_0x9742('0x58')]);return db[_0x9742('0x6b')]['count']({'where':_0x24bc5f[_0x9742('0x54')]})[_0x9742('0x39')](function(_0xe729e7){_0x594256[_0x9742('0x32')]=_0xe729e7;if(_0x89814e[_0x9742('0x4b')][_0x9742('0x59')]){_0x24bc5f[_0x9742('0x5a')]=[{'all':!![]}];}return db[_0x9742('0x6b')][_0x9742('0x5b')](_0x24bc5f);})[_0x9742('0x39')](function(_0x491725){_0x594256[_0x9742('0x5c')]=_0x491725;return _0x594256;});}})[_0x9742('0x39')](respondWithFilteredResult(_0x75f778,_0x24bc5f))[_0x9742('0x2d')](handleError(_0x75f778,null));};exports[_0x9742('0x6f')]=function(_0x3d0309,_0x5d6641,_0x4ff8dd){return db['MailAccount']['find']({'where':{'id':_0x3d0309[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x5d6641,null))[_0x9742('0x39')](function(_0x3ba496){if(_0x3ba496){return _0x3ba496[_0x9742('0x6f')](_0x3d0309[_0x9742('0x4b')][_0x9742('0x70')]);}})[_0x9742('0x39')](respondWithStatusCode(_0x5d6641,null))[_0x9742('0x2d')](handleError(_0x5d6641,null));};exports[_0x9742('0x6c')]=function(_0x17da78,_0x5d790c){var _0x5c8eb2={'name':_0x17da78[_0x9742('0x60')][_0x9742('0x3e')],'key':_0x17da78[_0x9742('0x60')][_0x9742('0x48')],'email':_0x17da78[_0x9742('0x60')][_0x9742('0x71')],'ListId':_0x17da78['body'][_0x9742('0x72')],'active':!_[_0x9742('0x73')](_0x17da78['body'][_0x9742('0x74')])?_0x17da78[_0x9742('0x60')][_0x9742('0x74')]:!![],'description':_0x17da78[_0x9742('0x60')][_0x9742('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x9742('0x73')](_0x17da78[_0x9742('0x60')][_0x9742('0x76')])){if(_0x17da78['body'][_0x9742('0x77')]){_0x5c8eb2['Imap']['user']=_0x5c8eb2['Smtp'][_0x9742('0x78')]=_0x17da78[_0x9742('0x60')][_0x9742('0x79')];_0x5c8eb2['Imap'][_0x9742('0x7a')]=_0x5c8eb2['Smtp'][_0x9742('0x7b')]=_0x17da78[_0x9742('0x60')]['cpassword'];}else{_0x5c8eb2[_0x9742('0x41')][_0x9742('0x7c')]=_0x5c8eb2[_0x9742('0x5f')][_0x9742('0x7c')]=![];}_0x5c8eb2[_0x9742('0x41')][_0x9742('0x7d')]=_0x17da78[_0x9742('0x60')][_0x9742('0x41')][_0x9742('0x7d')];_0x5c8eb2['Imap'][_0x9742('0x7e')]=_0x17da78['body'][_0x9742('0x41')][_0x9742('0x7e')];_0x5c8eb2['Smtp'][_0x9742('0x7d')]=_0x17da78[_0x9742('0x60')][_0x9742('0x5f')]['host'];_0x5c8eb2[_0x9742('0x5f')]['port']=_0x17da78[_0x9742('0x60')][_0x9742('0x5f')][_0x9742('0x7e')];}else{_0x5c8eb2[_0x9742('0x41')][_0x9742('0x7f')]=_0x5c8eb2[_0x9742('0x5f')][_0x9742('0x7f')]=_0x17da78[_0x9742('0x60')][_0x9742('0x76')];_0x5c8eb2[_0x9742('0x41')]['user']=_0x5c8eb2['Smtp'][_0x9742('0x78')]=_0x17da78['body'][_0x9742('0x79')];_0x5c8eb2[_0x9742('0x41')][_0x9742('0x7a')]=_0x5c8eb2['Smtp']['pass']=_0x17da78[_0x9742('0x60')]['cpassword'];}return db[_0x9742('0x46')][_0x9742('0x6c')](_0x5c8eb2,{'include':[{'model':db[_0x9742('0x42')],'as':_0x9742('0x5f')},{'model':db[_0x9742('0x40')],'as':_0x9742('0x41')}]})[_0x9742('0x39')](function(_0x2c7121){var _0xae0f2a=_0x17da78[_0x9742('0x78')][_0x9742('0x80')]({'plain':!![]});if(!_0xae0f2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xae0f2a[_0x9742('0x81')]==='user'){var _0x649d88=_0x2c7121[_0x9742('0x80')]({'plain':!![]});return db[_0x9742('0x82')][_0x9742('0x69')]({'where':{'name':_0x9742('0x3b'),'userProfileId':_0xae0f2a['userProfileId']},'raw':!![]})[_0x9742('0x39')](function(_0x199402){if(_0x199402&&_0x199402[_0x9742('0x83')]===0x0){return db['UserProfileResource'][_0x9742('0x6c')]({'name':_0x649d88[_0x9742('0x3e')],'resourceId':_0x649d88['id'],'type':_0x199402[_0x9742('0x3e')],'sectionId':_0x199402['id']},{})['then'](function(){return _0x2c7121;});}else{return _0x2c7121;}})[_0x9742('0x2d')](function(_0x445da3){logger['error'](_0x9742('0x84'),_0x445da3);throw _0x445da3;});}return _0x2c7121;})[_0x9742('0x39')](respondWithResult(_0x5d790c,0xc9))['catch'](handleError(_0x5d790c,null));};exports[_0x9742('0x85')]=function(_0x5556d3,_0x47312f,_0x17def4){return db[_0x9742('0x46')]['findOne']({'where':{'id':_0x5556d3[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x47312f,null))[_0x9742('0x39')](function(_0x5b9463){if(_0x5b9463){return _0x5b9463[_0x9742('0x85')]();}return null;})['then'](respondWithResult(_0x47312f,null))[_0x9742('0x2d')](handleError(_0x47312f,null));};exports['addImap']=function(_0x23ab91,_0x2cbe36,_0x3f9ec3){if(_0x23ab91[_0x9742('0x60')]['id']){delete _0x23ab91[_0x9742('0x60')]['id'];}return db[_0x9742('0x46')]['find']({'where':{'id':_0x23ab91['params']['id']}})['then'](handleEntityNotFound(_0x2cbe36,null))['then'](function(_0x17ee95){if(_0x17ee95){_0x23ab91[_0x9742('0x60')]['MailAccountId']=_0x17ee95['id'];return db['MailServerIn'][_0x9742('0x6c')](_0x23ab91['body']);}})[_0x9742('0x39')](respondWithResult(_0x2cbe36,null))[_0x9742('0x2d')](handleError(_0x2cbe36,null));};exports['removeImap']=function(_0x51c45b,_0xd5ca00,_0xc8b263){return db[_0x9742('0x46')]['findOne']({'where':{'id':_0x51c45b[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0xd5ca00,null))['then'](function(_0x384e43){if(_0x384e43){return _0x384e43[_0x9742('0x86')](null);}return null;})[_0x9742('0x39')](respondWithStatusCode(_0xd5ca00,null))['catch'](handleError(_0xd5ca00,null));};exports['getSmtp']=function(_0x58d4b8,_0xea70f2,_0x4947cb){return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x58d4b8['params']['id']}})[_0x9742('0x39')](handleEntityNotFound(_0xea70f2,null))[_0x9742('0x39')](function(_0x1f938b){if(_0x1f938b){return _0x1f938b[_0x9742('0x87')]();}return null;})[_0x9742('0x39')](respondWithResult(_0xea70f2,null))[_0x9742('0x2d')](handleError(_0xea70f2,null));};exports[_0x9742('0x88')]=function(_0x27e148,_0x49b21a,_0x20da43){if(_0x27e148['body']['id']){delete _0x27e148['body']['id'];}return db[_0x9742('0x46')][_0x9742('0x69')]({'where':{'id':_0x27e148[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x49b21a,null))[_0x9742('0x39')](function(_0x33a56a){if(_0x33a56a){_0x27e148[_0x9742('0x60')]['MailAccountId']=_0x33a56a['id'];return db['MailServerOut']['create'](_0x27e148[_0x9742('0x60')]);}})[_0x9742('0x39')](respondWithResult(_0x49b21a,null))['catch'](handleError(_0x49b21a,null));};exports['removeSmtp']=function(_0x2c6dab,_0x23be54,_0xfc6d67){return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x2c6dab[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x23be54,null))[_0x9742('0x39')](function(_0x542c9b){if(_0x542c9b){return _0x542c9b[_0x9742('0x89')](null);}return null;})['then'](respondWithStatusCode(_0x23be54,null))[_0x9742('0x2d')](handleError(_0x23be54,null));};exports[_0x9742('0x8a')]=function(_0x3c7e51,_0x484882,_0x3af749){return db[_0x9742('0x8b')][_0x9742('0x69')]({'where':{'id':_0x3c7e51[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x484882,null))[_0x9742('0x39')](function(_0x5c3a39){if(_0x5c3a39){return _0x5c3a39[_0x9742('0x8a')](_0x3c7e51[_0x9742('0x60')][_0x9742('0x70')],_[_0x9742('0x8c')](_0x3c7e51[_0x9742('0x60')],[_0x9742('0x70'),'id'])||{});}})[_0x9742('0x39')](respondWithResult(_0x484882,null))[_0x9742('0x2d')](handleError(_0x484882,null));};exports[_0x9742('0x8d')]=function(_0x1c4a7c,_0xdf501c,_0x57b899){var _0x1b2a00={'raw':![],'where':{}};var _0x4308eb={};var _0x10ee20={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1c4a7c['params']['id']}})[_0x9742('0x39')](handleEntityNotFound(_0xdf501c,null))[_0x9742('0x39')](function(_0x508642){if(_0x508642){_0x4308eb[_0x9742('0x49')]=_[_0x9742('0x4a')](db[_0x9742('0x8b')][_0x9742('0x67')]);_0x4308eb['query']=_[_0x9742('0x4a')](_0x1c4a7c['query']);_0x4308eb[_0x9742('0x4c')]=_[_0x9742('0x4d')](_0x4308eb[_0x9742('0x49')],_0x4308eb['query']);_0x1b2a00[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x4308eb[_0x9742('0x49')],qs[_0x9742('0x4f')](_0x1c4a7c['query'][_0x9742('0x4f')]));_0x1b2a00[_0x9742('0x4e')]=_0x1b2a00[_0x9742('0x4e')][_0x9742('0x50')]?_0x1b2a00['attributes']:_0x4308eb['model'];if(!_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x51')](_0x9742('0x52'))){_0x1b2a00['limit']=qs[_0x9742('0x34')](_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x34')]);_0x1b2a00[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x1c4a7c['query'][_0x9742('0x33')]);}_0x1b2a00[_0x9742('0x53')]=qs[_0x9742('0x6e')](_0x1c4a7c['query'][_0x9742('0x6e')]);_0x1b2a00[_0x9742('0x54')]=qs[_0x9742('0x4c')](_[_0x9742('0x55')](_0x1c4a7c[_0x9742('0x4b')],_0x4308eb[_0x9742('0x4c')]));_0x1b2a00['where'][_0x9742('0x63')]=_0x508642['id'];if(_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x56')]){_0x1b2a00[_0x9742('0x54')]=_[_0x9742('0x68')](_0x1b2a00[_0x9742('0x54')],{'$or':_[_0x9742('0x45')](_0x1b2a00[_0x9742('0x4e')],function(_0xccd8fe){var _0x321996={};_0x321996[_0xccd8fe]={'$like':'%'+_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x56')]+'%'};return _0x321996;})});}_0x1b2a00=_[_0x9742('0x68')]({},_0x1b2a00,_0x1c4a7c[_0x9742('0x58')]);return db[_0x9742('0x8b')]['count']({'where':_0x1b2a00['where']})[_0x9742('0x39')](function(_0xa75ebd){_0x10ee20[_0x9742('0x32')]=_0xa75ebd;if(_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x59')]){_0x1b2a00[_0x9742('0x5a')]=[{'model':db[_0x9742('0x8e')],'as':_0x9742('0x8f'),'required':![]},{'model':db[_0x9742('0x90')],'as':_0x9742('0x91'),'attributes':[_0x9742('0x3e'),_0x9742('0x92'),'internal'],'required':![]},{'model':db[_0x9742('0x93')],'as':_0x9742('0x94'),'attributes':['id','name',_0x9742('0x95')],'where':_0x1c4a7c[_0x9742('0x4b')][_0x9742('0x96')]?{'id':_0x1c4a7c['query']['tag']}:undefined,'required':_0x1c4a7c[_0x9742('0x4b')]['tag']?!![]:![]}];}return db[_0x9742('0x8b')]['findAll'](_0x1b2a00);})['then'](function(_0x33c53e){_0x10ee20['rows']=_0x33c53e;return _0x10ee20;});}})[_0x9742('0x39')](respondWithFilteredResult(_0xdf501c,_0x1b2a00))[_0x9742('0x2d')](handleError(_0xdf501c,null));};exports['addApplications']=function(_0xfac9d0,_0x28b556,_0x16fb8b){return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0xfac9d0[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x28b556,null))[_0x9742('0x39')](function(_0x525136){if(_0x525136){return db['sequelize'][_0x9742('0x97')](function(_0x5bc4e1){return db[_0x9742('0x98')][_0x9742('0x3a')]({'where':{'MailAccountId':_0xfac9d0['params']['id']},'transaction':_0x5bc4e1})[_0x9742('0x39')](function(_0x338c5a){var _0x486355=_['map'](_0xfac9d0[_0x9742('0x60')],function(_0x140978){_0x140978[_0x9742('0x63')]=_0xfac9d0['params']['id'];return _0x140978;});return db[_0x9742('0x98')]['bulkCreate'](_0x486355,{'transaction':_0x5bc4e1});});})[_0x9742('0x39')](function(){return db['MailApplication'][_0x9742('0x99')]({'where':{'MailAccountId':_0xfac9d0[_0x9742('0x5e')]['id']},'order':_0x9742('0x9a')});});}})[_0x9742('0x39')](respondWithResult(_0x28b556,null))[_0x9742('0x2d')](handleError(_0x28b556,null));};exports[_0x9742('0x9b')]=function(_0x2862af,_0x39dc04,_0x18720a){var _0x4f20b4={};var _0x4b0daf={};var _0x4b4a2c;var _0x989ba8;return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x2862af[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x39dc04,null))[_0x9742('0x39')](function(_0x4f4819){if(_0x4f4819){_0x4b4a2c=_0x4f4819;_0x4b0daf['model']=_[_0x9742('0x4a')](db[_0x9742('0x98')]['rawAttributes']);_0x4b0daf['query']=_[_0x9742('0x4a')](_0x2862af[_0x9742('0x4b')]);_0x4b0daf['filters']=_[_0x9742('0x4d')](_0x4b0daf['model'],_0x4b0daf[_0x9742('0x4b')]);_0x4f20b4[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x4b0daf[_0x9742('0x49')],qs[_0x9742('0x4f')](_0x2862af[_0x9742('0x4b')][_0x9742('0x4f')]));_0x4f20b4[_0x9742('0x4e')]=_0x4f20b4[_0x9742('0x4e')][_0x9742('0x50')]?_0x4f20b4[_0x9742('0x4e')]:_0x4b0daf['model'];_0x4f20b4[_0x9742('0x53')]=qs['sort'](_0x2862af[_0x9742('0x4b')][_0x9742('0x6e')]);_0x4f20b4[_0x9742('0x54')]=qs[_0x9742('0x4c')](_[_0x9742('0x55')](_0x2862af[_0x9742('0x4b')],_0x4b0daf['filters']));if(_0x2862af['query']['filter']){_0x4f20b4[_0x9742('0x54')]=_[_0x9742('0x68')](_0x4f20b4[_0x9742('0x54')],{'$or':_['map'](_0x4f20b4[_0x9742('0x4e')],function(_0x3467fc){var _0x262eba={};_0x262eba[_0x3467fc]={'$like':'%'+_0x2862af['query'][_0x9742('0x56')]+'%'};return _0x262eba;})});}_0x4f20b4=_['merge']({},_0x4f20b4,_0x2862af['options']);return _0x4b4a2c[_0x9742('0x9b')](_0x4f20b4);}})[_0x9742('0x39')](function(_0x140dc9){if(_0x140dc9){_0x989ba8=_0x140dc9['length'];if(!_0x2862af[_0x9742('0x4b')][_0x9742('0x51')](_0x9742('0x52'))){_0x4f20b4[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x2862af['query'][_0x9742('0x34')]);_0x4f20b4[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x2862af[_0x9742('0x4b')][_0x9742('0x33')]);}return _0x4b4a2c[_0x9742('0x9b')](_0x4f20b4);}})[_0x9742('0x39')](function(_0xab2242){if(_0xab2242){return _0xab2242?{'count':_0x989ba8,'rows':_0xab2242}:null;}})[_0x9742('0x39')](respondWithResult(_0x39dc04,null))['catch'](handleError(_0x39dc04,null));};exports['getMessages']=function(_0x25fdb5,_0x49fb5b,_0x294573){var _0x438edd={'raw':!![],'where':{}};var _0x4512d9={};var _0x56f332={'count':0x0,'rows':[]};return db['MailAccount'][_0x9742('0x66')]({'where':{'id':_0x25fdb5[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x49fb5b,null))[_0x9742('0x39')](function(_0x3ddd4d){if(_0x3ddd4d){_0x4512d9['model']=_[_0x9742('0x4a')](db[_0x9742('0x9c')][_0x9742('0x67')]);_0x4512d9[_0x9742('0x4b')]=_[_0x9742('0x4a')](_0x25fdb5[_0x9742('0x4b')]);_0x4512d9[_0x9742('0x4c')]=_[_0x9742('0x4d')](_0x4512d9[_0x9742('0x49')],_0x4512d9[_0x9742('0x4b')]);_0x438edd[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x4512d9['model'],qs[_0x9742('0x4f')](_0x25fdb5[_0x9742('0x4b')][_0x9742('0x4f')]));_0x438edd[_0x9742('0x4e')]=_0x438edd[_0x9742('0x4e')][_0x9742('0x50')]?_0x438edd[_0x9742('0x4e')]:_0x4512d9[_0x9742('0x49')];if(!_0x25fdb5['query'][_0x9742('0x51')](_0x9742('0x52'))){_0x438edd[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x25fdb5[_0x9742('0x4b')][_0x9742('0x34')]);_0x438edd[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x25fdb5['query'][_0x9742('0x33')]);}_0x438edd[_0x9742('0x53')]=qs[_0x9742('0x6e')](_0x25fdb5['query'][_0x9742('0x6e')]);_0x438edd[_0x9742('0x54')]=qs[_0x9742('0x4c')](_[_0x9742('0x55')](_0x25fdb5[_0x9742('0x4b')],_0x4512d9['filters']));_0x438edd['where'][_0x9742('0x63')]=_0x3ddd4d['id'];if(_0x25fdb5[_0x9742('0x4b')][_0x9742('0x56')]){_0x438edd[_0x9742('0x54')]=_[_0x9742('0x68')](_0x438edd['where'],{'$or':_[_0x9742('0x45')](_0x438edd[_0x9742('0x4e')],function(_0x5d4c8a){var _0x481015={};_0x481015[_0x5d4c8a]={'$like':'%'+_0x25fdb5['query'][_0x9742('0x56')]+'%'};return _0x481015;})});}if(_0x25fdb5[_0x9742('0x4b')]['$gte']){var _0x42f3f0=_0x25fdb5['query'][_0x9742('0x9d')][_0x9742('0x9e')](',');var _0x71e558={};_0x71e558[_0x42f3f0[0x0]]={'$gte':moment(_0x42f3f0[0x1])[_0x9742('0x9f')](_0x9742('0xa0'))};_0x438edd[_0x9742('0x54')]=_[_0x9742('0x68')](_0x438edd[_0x9742('0x54')],_0x71e558);}_0x438edd=_[_0x9742('0x68')]({},_0x438edd,_0x25fdb5['options']);return db[_0x9742('0x9c')][_0x9742('0x32')]({'where':_0x438edd[_0x9742('0x54')]})[_0x9742('0x39')](function(_0x2da0a6){_0x56f332[_0x9742('0x32')]=_0x2da0a6;if(_0x25fdb5['query'][_0x9742('0x59')]){_0x438edd[_0x9742('0x5a')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x438edd);})[_0x9742('0x39')](function(_0x294cce){_0x56f332[_0x9742('0x5c')]=_0x294cce;return _0x56f332;});}})[_0x9742('0x39')](respondWithFilteredResult(_0x49fb5b,_0x438edd))[_0x9742('0x2d')](handleError(_0x49fb5b,null));};exports['send']=function(_0x1a0a2b,_0x5f3867,_0x3d3efc){var _0x243f0e,_0x18cceb={},_0x559554;if(_0x1a0a2b[_0x9742('0x60')]['to']){_0x559554=_0x1a0a2b[_0x9742('0x60')]['to'][_0x9742('0x9e')](',')[0x0];}return db[_0x9742('0x46')][_0x9742('0x69')]({'where':{'id':_0x1a0a2b[_0x9742('0x5e')]['id']},'include':[{'model':db[_0x9742('0xa1')],'as':_0x9742('0xa2'),'include':[{'model':db[_0x9742('0x8e')],'as':_0x9742('0xa3'),'where':{'email':_0x559554},'limit':0x1,'order':[[_0x9742('0xa4'),_0x9742('0xa5')]]}]},{'model':db[_0x9742('0x42')],'as':_0x9742('0x5f'),'raw':!![]}]})[_0x9742('0x39')](handleEntityNotFound(_0x5f3867,null))[_0x9742('0x39')](function(_0x20b337){if(_0x20b337){_0x243f0e=_0x20b337;if(_0x20b337['Smtp']){if(_[_0x9742('0x73')](_0x1a0a2b[_0x9742('0x60')]['from'])){_0x1a0a2b[_0x9742('0x60')][_0x9742('0xa6')]=util[_0x9742('0x9f')](_0x9742('0xa7'),_0x20b337[_0x9742('0x3e')],_0x20b337[_0x9742('0x71')]||_0x20b337[_0x9742('0x5f')][_0x9742('0x78')]);}if(_0x1a0a2b[_0x9742('0x60')]['attachments']&&_0x1a0a2b['body'][_0x9742('0xa8')][_0x9742('0x50')]){for(var _0x22ee39=0x0;_0x22ee39<_0x1a0a2b['body'][_0x9742('0xa8')][_0x9742('0x50')];_0x22ee39+=0x1){_0x1a0a2b[_0x9742('0x60')][_0x9742('0xa8')][_0x22ee39]={'filename':_0x1a0a2b['body'][_0x9742('0xa8')][_0x22ee39][_0x9742('0x3e')],'path':path['join'](config['root'],_0x9742('0xa9'),_0x1a0a2b[_0x9742('0x60')][_0x9742('0xa8')][_0x22ee39][_0x9742('0xaa')])};}}var _0x2a4978={'tls':{'rejectUnauthorized':![]}};if(_[_0x9742('0x73')](_0x20b337['Smtp'][_0x9742('0x7f')])){if(_0x20b337['Smtp'][_0x9742('0x7c')]){_0x2a4978[_0x9742('0xab')]={'user':_0x20b337['Smtp'][_0x9742('0x78')],'pass':_0x20b337['Smtp'][_0x9742('0x7b')]};}_0x2a4978[_0x9742('0x7d')]=_0x20b337['Smtp'][_0x9742('0x7d')];_0x2a4978['port']=_0x20b337['Smtp'][_0x9742('0x7e')];_0x2a4978[_0x9742('0xac')]=_0x20b337[_0x9742('0x5f')][_0x9742('0xac')];}else{_0x2a4978[_0x9742('0x7f')]=_0x20b337[_0x9742('0x5f')][_0x9742('0x7f')];_0x2a4978[_0x9742('0xab')]={'user':_0x20b337['Smtp'][_0x9742('0x78')],'pass':_0x20b337['Smtp'][_0x9742('0x7b')]};}return respondWithRpcPromise(_0x9742('0xad'),'sendMail',{'account':_0x2a4978,'message':_0x1a0a2b[_0x9742('0x60')]});}else{throw new Error('List\x20not\x20found');}}})[_0x9742('0x39')](function(_0x57700f){if(_0x57700f){_0x18cceb=_0x57700f;if(_0x243f0e[_0x9742('0xa2')]){if(_0x243f0e['List'][_0x9742('0xa3')][_0x9742('0x50')]){return _0x243f0e[_0x9742('0xa2')][_0x9742('0xa3')][0x0];}else{return db[_0x9742('0x8e')][_0x9742('0x6c')](_[_0x9742('0xae')](_0x1a0a2b[_0x9742('0x60')],{'firstName':_0x1a0a2b[_0x9742('0x60')]['to'],'email':_0x1a0a2b[_0x9742('0x60')]['to'],'phone':_0x1a0a2b[_0x9742('0x60')]['to'],'ListId':_0x243f0e[_0x9742('0x72')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x9742('0x39')](function(_0x1e5a40){if(_0x1e5a40){var _0x4e3ea9={'UserId':_0x1a0a2b[_0x9742('0x78')]['id'],'ContactId':_0x1e5a40['id'],'MailAccountId':_0x243f0e['id'],'inReplyTo':_0x18cceb[_0x9742('0xaf')],'to':_0x1a0a2b[_0x9742('0x60')]['from'],'cc':_0x1a0a2b['body']['cc'],'subject':_0x1a0a2b['body'][_0x9742('0xb0')],'attach':_0x1a0a2b[_0x9742('0x60')][_0x9742('0xb1')],'firstMsgDirection':_0x9742('0xb2'),'lastMsgAt':moment()['format'](_0x9742('0xa0')),'lastMsgDirection':_0x9742('0xb2'),'lastMsgBody':_0x1a0a2b[_0x9742('0x60')][_0x9742('0x60')],'Messages':[_['merge'](_0x1a0a2b[_0x9742('0x60')],{'messageId':_0x18cceb['messageId'],'sentAt':moment()[_0x9742('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x243f0e['id'],'UserId':_0x1a0a2b[_0x9742('0x78')]['id'],'ContactId':_0x1e5a40['id']})]};if(_0x1a0a2b[_0x9742('0x60')]['Interaction']){_0x4e3ea9=_[_0x9742('0x68')](_0x4e3ea9,_0x1a0a2b[_0x9742('0x60')][_0x9742('0xb3')]);}return db[_0x9742('0x8b')][_0x9742('0x6c')](_0x4e3ea9,{'include':[{'model':db[_0x9742('0x9c')],'as':'Messages'}]});}})['then'](respondWithResult(_0x5f3867,null))[_0x9742('0x2d')](handleError(_0x5f3867,null));};exports[_0x9742('0xb4')]=function(_0x22a1a3,_0x299a4a,_0x484efc){return db['MailAccount']['find']({'where':{'id':_0x22a1a3[_0x9742('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x9742('0x5f'),'raw':!![]}]})[_0x9742('0x39')](handleEntityNotFound(_0x299a4a,null))[_0x9742('0x39')](function(_0x276797){if(_0x276797&&_0x276797[_0x9742('0x5f')]){var _0x5a0d5f={'id':_0x276797['id'],'tls':{'rejectUnauthorized':![]}};if(_0x276797[_0x9742('0x5f')][_0x9742('0x7f')]){_0x5a0d5f[_0x9742('0x7f')]=_0x276797[_0x9742('0x5f')]['service'];}else{_0x5a0d5f['host']=_0x276797[_0x9742('0x5f')][_0x9742('0x7d')];_0x5a0d5f[_0x9742('0x7e')]=_0x276797[_0x9742('0x5f')][_0x9742('0x7e')];_0x5a0d5f[_0x9742('0xac')]=_0x276797['Smtp'][_0x9742('0xac')];}if(_0x276797['Smtp'][_0x9742('0x7c')]){_0x5a0d5f[_0x9742('0xab')]={'user':_0x276797[_0x9742('0x5f')][_0x9742('0x78')],'pass':_0x276797[_0x9742('0x5f')][_0x9742('0x7b')]};}return respondWithRpcPromise(_0x9742('0xb5'),_0x9742('0xb4'),{'account':_0x5a0d5f});}})['then'](respondWithResult(_0x299a4a,null))[_0x9742('0x2d')](handleError(_0x299a4a,null));};exports['destroy']=function(_0x1f16ef,_0x36847b){return db['MailAccount'][_0x9742('0x69')]({'where':{'id':_0x1f16ef[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x36847b,null))['then'](function(_0x5f1a51){if(_0x5f1a51&&_0x5f1a51[_0x9742('0x7f')]){throw new db['Sequelize']['ValidationError'](_0x9742('0xb6'));}return _0x5f1a51;})[_0x9742('0x39')](removeEntity(_0x36847b,null))[_0x9742('0x2d')](handleError(_0x36847b,null));};exports[_0x9742('0xb7')]=function(_0x3a9c84,_0x39f3a3,_0x5448d4){return db[_0x9742('0x46')]['find']({'where':{'id':_0x3a9c84[_0x9742('0x5e')]['id']}})['then'](handleEntityNotFound(_0x39f3a3,null))['then'](function(_0x4d45e8){if(_0x4d45e8){return _0x4d45e8[_0x9742('0xb7')](_0x3a9c84['body'][_0x9742('0x70')],_['omit'](_0x3a9c84['body'],[_0x9742('0x70'),'id'])||{})[_0x9742('0xb8')](function(_0x41ea2e){for(var _0x5b5728=0x0;_0x5b5728<_0x3a9c84['body'][_0x9742('0x70')][_0x9742('0x50')];_0x5b5728+=0x1){socket[_0x9742('0xb9')](_0x9742('0xba'),{'UserId':_0x3a9c84['body'][_0x9742('0x70')][_0x5b5728],'MailAccountId':_0x3a9c84[_0x9742('0x5e')]['id']});}return _0x41ea2e;});}})[_0x9742('0x39')](respondWithResult(_0x39f3a3,null))[_0x9742('0x2d')](handleError(_0x39f3a3,null));};exports[_0x9742('0xbb')]=function(_0x484a24,_0x258848,_0x2a3a9d){return db['MailAccount']['find']({'where':{'id':_0x484a24['params']['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x258848,null))[_0x9742('0x39')](function(_0x40b09a){if(_0x40b09a){return _0x40b09a[_0x9742('0xbb')](_0x484a24['query'][_0x9742('0x70')])[_0x9742('0x39')](function(){if(_['isArray'](_0x484a24['query'][_0x9742('0x70')])){for(var _0x17e86a=0x0;_0x17e86a<_0x484a24[_0x9742('0x4b')][_0x9742('0x70')]['length'];_0x17e86a+=0x1){socket[_0x9742('0xb9')](_0x9742('0xbc'),{'UserId':Number(_0x484a24['query'][_0x9742('0x70')][_0x17e86a]),'MailAccountId':Number(_0x484a24[_0x9742('0x5e')]['id'])});}}else{socket[_0x9742('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x484a24[_0x9742('0x4b')][_0x9742('0x70')]),'MailAccountId':Number(_0x484a24[_0x9742('0x5e')]['id'])});}});}})[_0x9742('0x39')](respondWithStatusCode(_0x258848,null))[_0x9742('0x2d')](handleError(_0x258848,null));};exports[_0x9742('0xbd')]=function(_0x510419,_0x5f1d20,_0x13470e){var _0x542e0e={};var _0x288ccc={};var _0x7d5653;var _0x2fd264;return db[_0x9742('0x46')][_0x9742('0x66')]({'where':{'id':_0x510419[_0x9742('0x5e')]['id']}})[_0x9742('0x39')](handleEntityNotFound(_0x5f1d20,null))[_0x9742('0x39')](function(_0x39de9d){if(_0x39de9d){_0x7d5653=_0x39de9d;_0x288ccc['model']=_[_0x9742('0x4a')](db[_0x9742('0x90')]['rawAttributes']);_0x288ccc[_0x9742('0x4b')]=_['keys'](_0x510419[_0x9742('0x4b')]);_0x288ccc['filters']=_['intersection'](_0x288ccc['model'],_0x288ccc[_0x9742('0x4b')]);_0x542e0e[_0x9742('0x4e')]=_[_0x9742('0x4d')](_0x288ccc['model'],qs[_0x9742('0x4f')](_0x510419[_0x9742('0x4b')][_0x9742('0x4f')]));_0x542e0e[_0x9742('0x4e')]=_0x542e0e['attributes'][_0x9742('0x50')]?_0x542e0e[_0x9742('0x4e')]:_0x288ccc[_0x9742('0x49')];_0x542e0e[_0x9742('0x53')]=qs[_0x9742('0x6e')](_0x510419['query'][_0x9742('0x6e')]);_0x542e0e['where']=qs['filters'](_[_0x9742('0x55')](_0x510419['query'],_0x288ccc[_0x9742('0x4c')]));if(_0x510419['query'][_0x9742('0x56')]){_0x542e0e['where']=_[_0x9742('0x68')](_0x542e0e[_0x9742('0x54')],{'$or':_['map'](_0x542e0e[_0x9742('0x4e')],function(_0x191d25){var _0xa1508b={};_0xa1508b[_0x191d25]={'$like':'%'+_0x510419[_0x9742('0x4b')][_0x9742('0x56')]+'%'};return _0xa1508b;})});}_0x542e0e=_[_0x9742('0x68')]({},_0x542e0e,_0x510419['options']);return _0x7d5653[_0x9742('0xbd')](_0x542e0e);}})[_0x9742('0x39')](function(_0x2837b5){if(_0x2837b5){_0x2fd264=_0x2837b5[_0x9742('0x50')];if(!_0x510419[_0x9742('0x4b')][_0x9742('0x51')](_0x9742('0x52'))){_0x542e0e[_0x9742('0x34')]=qs[_0x9742('0x34')](_0x510419['query']['limit']);_0x542e0e[_0x9742('0x33')]=qs[_0x9742('0x33')](_0x510419['query'][_0x9742('0x33')]);}return _0x7d5653[_0x9742('0xbd')](_0x542e0e);}})[_0x9742('0x39')](function(_0x5748b2){if(_0x5748b2){return _0x5748b2?{'count':_0x2fd264,'rows':_0x5748b2}:null;}})[_0x9742('0x39')](respondWithResult(_0x5f1d20,null))[_0x9742('0x2d')](handleError(_0x5f1d20,null));}; \ No newline at end of file +var _0x3dfa=['status','count','offset','limit','set','json','apply','save','then','get','MailAccounts','UserProfileResource','destroy','name','index','MailServerIn','MailServerOut','Smtp','Pause','map','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','rows','show','mandatoryDispositionPause','length','update','find','params','Imap','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','removeDispositions','ids','CannedAnswer','getAnswers','pick','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','cpassword','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','findOne','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','send','CmList','List','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','subject','attach','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end'];(function(_0x23945f,_0x9d3e4e){var _0xa38592=function(_0x406b83){while(--_0x406b83){_0x23945f['push'](_0x23945f['shift']());}};_0xa38592(++_0x9d3e4e);}(_0x3dfa,0x95));var _0xa3df=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x3dfa[_0x5bf420];return _0x1c5255;};'use strict';var pdf=require(_0xa3df('0x0'));var emlformat=require(_0xa3df('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa3df('0x2'));var jsonpatch=require(_0xa3df('0x3'));var rp=require(_0xa3df('0x4'));var moment=require('moment');var BPromise=require(_0xa3df('0x5'));var Mustache=require(_0xa3df('0x6'));var util=require(_0xa3df('0x7'));var path=require(_0xa3df('0x8'));var sox=require(_0xa3df('0x9'));var csv=require(_0xa3df('0xa'));var ejs=require(_0xa3df('0xb'));var fs=require('fs');var _=require(_0xa3df('0xc'));var squel=require(_0xa3df('0xd'));var crypto=require(_0xa3df('0xe'));var jsforce=require(_0xa3df('0xf'));var deskjs=require(_0xa3df('0x10'));var toCsv=require(_0xa3df('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa3df('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa3df('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3df('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa3df('0x14'));var config=require('../../config/environment');var db=require(_0xa3df('0x15'))['db'];config[_0xa3df('0x16')]=_[_0xa3df('0x17')](config[_0xa3df('0x16')],{'host':_0xa3df('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3df('0x16')]));require(_0xa3df('0x19'))[_0xa3df('0x1a')](socket);var jayson=require(_0xa3df('0x1b'));var client=jayson[_0xa3df('0x1c')][_0xa3df('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x752641,_0x55e29f,_0x18e762){if(_0x18e762){var _0xf52a29=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf52a29['test'](_0x55e29f)){return _0x752641;}else{throw new db['Sequelize'][(_0xa3df('0x1e'))](_0xa3df('0x1f'));}}else{return _0x752641;}}function respondWithRpcPromise(_0x1cc910,_0x3fed70,_0x4d2dae,_0x423a8c){return new BPromise(function(_0x4da63b,_0x5cc5ed){var _0x5c37cb=_0x423a8c||client;return _0x5c37cb[_0xa3df('0x20')](_0x1cc910,_0x4d2dae)['then'](function(_0x4d9261){logger['info']('MailAccount,\x20%s,\x20%s',_0x3fed70,_0xa3df('0x21'));logger[_0xa3df('0x22')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3fed70,_0xa3df('0x21'),JSON[_0xa3df('0x23')](_0x4d9261));if(_0x4d9261['error']){if(_0x4d9261[_0xa3df('0x24')]['code']===0x1f4){logger[_0xa3df('0x24')](_0xa3df('0x25'),_0x3fed70,_0x4d9261[_0xa3df('0x24')][_0xa3df('0x26')]);return _0x5cc5ed(_0x4d9261['error'][_0xa3df('0x26')]);}logger[_0xa3df('0x24')](_0xa3df('0x25'),_0x3fed70,_0x4d9261[_0xa3df('0x24')][_0xa3df('0x26')]);return _0x4da63b(_0x4d9261[_0xa3df('0x24')][_0xa3df('0x26')]);}else{logger['info'](_0xa3df('0x25'),_0x3fed70,_0xa3df('0x21'));_0x4da63b(_0x4d9261[_0xa3df('0x27')][_0xa3df('0x26')]);}})[_0xa3df('0x28')](function(_0x1d0f2b){logger[_0xa3df('0x24')]('MailAccount,\x20%s,\x20%s',_0x3fed70,_0x1d0f2b);_0x5cc5ed(_0x1d0f2b);});});}function respondWithStatusCode(_0x3e4152,_0x4117d3){_0x4117d3=_0x4117d3||0xcc;return function(_0x321c26){if(_0x321c26){return _0x3e4152[_0xa3df('0x29')](_0x4117d3);}return _0x3e4152['status'](_0x4117d3)[_0xa3df('0x2a')]();};}function respondWithResult(_0x25397e,_0x509e8a){_0x509e8a=_0x509e8a||0xc8;return function(_0x4067c8){if(_0x4067c8){return _0x25397e[_0xa3df('0x2b')](_0x509e8a)['json'](_0x4067c8);}};}function respondWithFilteredResult(_0x5f22c5,_0x1529d1){return function(_0x238e88){if(_0x238e88){var _0x15f193=_0x238e88[_0xa3df('0x2c')],_0x2e28de=_0x1529d1[_0xa3df('0x2d')],_0x426542=_0x1529d1[_0xa3df('0x2d')]+_0x1529d1[_0xa3df('0x2e')],_0x1193e3;if(_0x426542>=_0x15f193){_0x426542=_0x15f193;_0x1193e3=0xc8;}else{_0x1193e3=0xce;}_0x5f22c5[_0xa3df('0x2b')](_0x1193e3);return _0x5f22c5[_0xa3df('0x2f')]('Content-Range',_0x2e28de+'-'+_0x426542+'/'+_0x15f193)[_0xa3df('0x30')](_0x238e88);}return null;};}function patchUpdates(_0x5aa30c){return function(_0xc1a66c){try{jsonpatch[_0xa3df('0x31')](_0xc1a66c,_0x5aa30c,!![]);}catch(_0x2c81dd){return BPromise['reject'](_0x2c81dd);}return _0xc1a66c[_0xa3df('0x32')]();};}function saveUpdates(_0x4b297c,_0x2b4c35){return function(_0x109f36){if(_0x109f36){return _0x109f36['update'](_0x4b297c)[_0xa3df('0x33')](function(_0x2cc267){return _0x2cc267;});}return null;};}function removeEntity(_0x2dd53d,_0x4aeac7){return function(_0x4f9f3a){if(_0x4f9f3a){return _0x4f9f3a['destroy']()[_0xa3df('0x33')](function(){var _0x457938=_0x4f9f3a[_0xa3df('0x34')]({'plain':!![]});var _0x386548=_0xa3df('0x35');return db[_0xa3df('0x36')][_0xa3df('0x37')]({'where':{'type':_0x386548,'resourceId':_0x457938['id']}})[_0xa3df('0x33')](function(){return _0x4f9f3a;});})[_0xa3df('0x33')](function(){_0x2dd53d['status'](0xcc)[_0xa3df('0x2a')]();});}};}function handleEntityNotFound(_0x114149,_0x4de013){return function(_0xd30452){if(!_0xd30452){_0x114149['sendStatus'](0x194);}return _0xd30452;};}function handleError(_0x36112e,_0x371bb7){_0x371bb7=_0x371bb7||0x1f4;return function(_0x9b86b8){logger[_0xa3df('0x24')](_0x9b86b8['stack']);if(_0x9b86b8[_0xa3df('0x38')]){delete _0x9b86b8[_0xa3df('0x38')];}_0x36112e[_0xa3df('0x2b')](_0x371bb7)['send'](_0x9b86b8);};}exports[_0xa3df('0x39')]=function(_0x45d9d2,_0x1864da){var _0x160fb5={'include':[{'model':db[_0xa3df('0x3a')],'as':'Imap'},{'model':db[_0xa3df('0x3b')],'as':_0xa3df('0x3c')},{'model':db[_0xa3df('0x3d')],'as':'mandatoryDispositionPause'}]},_0x386719={},_0x2e210f={'count':0x0,'rows':[]};var _0xf0c69b=_[_0xa3df('0x3e')](db['MailAccount'][_0xa3df('0x3f')],function(_0x205601){return{'name':_0x205601[_0xa3df('0x40')],'type':_0x205601[_0xa3df('0x41')]['key']};});_0x386719['model']=_[_0xa3df('0x3e')](_0xf0c69b,_0xa3df('0x38'));_0x386719['query']=_[_0xa3df('0x42')](_0x45d9d2[_0xa3df('0x43')]);_0x386719['filters']=_[_0xa3df('0x44')](_0x386719[_0xa3df('0x45')],_0x386719[_0xa3df('0x43')]);_0x160fb5['attributes']=_[_0xa3df('0x44')](_0x386719['model'],qs[_0xa3df('0x46')](_0x45d9d2[_0xa3df('0x43')][_0xa3df('0x46')]));_0x160fb5[_0xa3df('0x47')]=_0x160fb5['attributes']['length']?_0x160fb5[_0xa3df('0x47')]:_0x386719[_0xa3df('0x45')];if(!_0x45d9d2[_0xa3df('0x43')][_0xa3df('0x48')](_0xa3df('0x49'))){_0x160fb5['limit']=qs['limit'](_0x45d9d2[_0xa3df('0x43')][_0xa3df('0x2e')]);_0x160fb5['offset']=qs['offset'](_0x45d9d2[_0xa3df('0x43')]['offset']);}_0x160fb5[_0xa3df('0x4a')]=qs[_0xa3df('0x4b')](_0x45d9d2[_0xa3df('0x43')][_0xa3df('0x4b')]);_0x160fb5[_0xa3df('0x4c')]=qs[_0xa3df('0x4d')](_['pick'](_0x45d9d2['query'],_0x386719['filters']),_0xf0c69b);if(_0x45d9d2[_0xa3df('0x43')][_0xa3df('0x4e')]){_0x160fb5[_0xa3df('0x4c')]=_[_0xa3df('0x4f')](_0x160fb5[_0xa3df('0x4c')],{'$or':_[_0xa3df('0x3e')](_0xf0c69b,function(_0x113e53){if(_0x113e53['type']!==_0xa3df('0x50')){var _0x444d93={};_0x444d93[_0x113e53['name']]={'$like':'%'+_0x45d9d2[_0xa3df('0x43')]['filter']+'%'};return _0x444d93;}})});}_0x160fb5=_[_0xa3df('0x4f')]({},_0x160fb5,_0x45d9d2[_0xa3df('0x51')]);var _0x4d4cc1={'where':_0x160fb5[_0xa3df('0x4c')]};return db[_0xa3df('0x52')][_0xa3df('0x2c')](_0x4d4cc1)[_0xa3df('0x33')](function(_0x41497f){_0x2e210f[_0xa3df('0x2c')]=_0x41497f;if(_0x45d9d2[_0xa3df('0x43')][_0xa3df('0x53')]){_0x160fb5[_0xa3df('0x54')]=[{'all':!![]}];}return db[_0xa3df('0x52')][_0xa3df('0x55')](_0x160fb5);})[_0xa3df('0x33')](function(_0x5428c9){_0x2e210f[_0xa3df('0x56')]=_0x5428c9;return _0x2e210f;})[_0xa3df('0x33')](respondWithFilteredResult(_0x1864da,_0x160fb5))[_0xa3df('0x28')](handleError(_0x1864da,null));};exports[_0xa3df('0x57')]=function(_0x4383df,_0x2d08c1){var _0x5ad79d={'raw':![],'where':{'id':_0x4383df['params']['id']},'include':[{'model':db[_0xa3df('0x3a')],'as':'Imap'},{'model':db[_0xa3df('0x3b')],'as':_0xa3df('0x3c')},{'model':db[_0xa3df('0x3d')],'as':_0xa3df('0x58')}]},_0x5e1426={};_0x5e1426[_0xa3df('0x45')]=_[_0xa3df('0x42')](db[_0xa3df('0x52')]['rawAttributes']);_0x5e1426[_0xa3df('0x43')]=_['keys'](_0x4383df['query']);_0x5e1426[_0xa3df('0x4d')]=_['intersection'](_0x5e1426[_0xa3df('0x45')],_0x5e1426[_0xa3df('0x43')]);_0x5ad79d[_0xa3df('0x47')]=_[_0xa3df('0x44')](_0x5e1426[_0xa3df('0x45')],qs[_0xa3df('0x46')](_0x4383df[_0xa3df('0x43')][_0xa3df('0x46')]));_0x5ad79d['attributes']=_0x5ad79d[_0xa3df('0x47')][_0xa3df('0x59')]?_0x5ad79d[_0xa3df('0x47')]:_0x5e1426[_0xa3df('0x45')];if(_0x4383df[_0xa3df('0x43')][_0xa3df('0x53')]){_0x5ad79d['include']=[{'all':!![]}];}_0x5ad79d=_[_0xa3df('0x4f')]({},_0x5ad79d,_0x4383df[_0xa3df('0x51')]);return db[_0xa3df('0x52')]['find'](_0x5ad79d)[_0xa3df('0x33')](handleEntityNotFound(_0x2d08c1,null))[_0xa3df('0x33')](respondWithResult(_0x2d08c1,null))['catch'](handleError(_0x2d08c1,null));};exports[_0xa3df('0x5a')]=function(_0x4113ba,_0x4640e1){if(_0x4113ba['body']['id']){delete _0x4113ba['body']['id'];}return db[_0xa3df('0x52')][_0xa3df('0x5b')]({'where':{'id':_0x4113ba[_0xa3df('0x5c')]['id']},'include':[{'model':db[_0xa3df('0x3a')],'as':_0xa3df('0x5d')},{'model':db['MailServerOut'],'as':_0xa3df('0x3c')},{'model':db[_0xa3df('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xa3df('0x33')](handleEntityNotFound(_0x4640e1,null))['then'](saveUpdates(_0x4113ba[_0xa3df('0x5e')],null))[_0xa3df('0x33')](function(_0x8e245){if(_0x8e245&&_0x4113ba['body'][_0xa3df('0x5d')]){return db['MailServerIn'][_0xa3df('0x5a')](_0x4113ba[_0xa3df('0x5e')][_0xa3df('0x5d')],{'where':{'MailAccountId':_0x8e245['id']}})[_0xa3df('0x33')](function(){return _0x8e245;});}return _0x8e245;})[_0xa3df('0x33')](function(_0x3e66a0){if(_0x3e66a0&&_0x4113ba[_0xa3df('0x5e')]['Smtp']){return db[_0xa3df('0x3b')][_0xa3df('0x5a')](_0x4113ba['body'][_0xa3df('0x3c')],{'where':{'MailAccountId':_0x3e66a0['id']}})[_0xa3df('0x33')](function(){return _0x3e66a0;});}return _0x3e66a0;})[_0xa3df('0x33')](respondWithResult(_0x4640e1,null))[_0xa3df('0x28')](handleError(_0x4640e1,null));};exports['describe']=function(_0x255440,_0x42682c){return db[_0xa3df('0x52')][_0xa3df('0x5f')]()['then'](respondWithResult(_0x42682c,null))[_0xa3df('0x28')](handleError(_0x42682c,null));};exports[_0xa3df('0x60')]=function(_0x25f12b,_0x86adaa,_0x57fa9b){if(_0x25f12b['body']['id']){delete _0x25f12b['body']['id'];}return db[_0xa3df('0x52')]['find']({'where':{'id':_0x25f12b[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x86adaa,null))[_0xa3df('0x33')](function(_0x5534d9){if(_0x5534d9){_0x25f12b[_0xa3df('0x5e')][_0xa3df('0x61')]=_0x5534d9['id'];return db[_0xa3df('0x62')][_0xa3df('0x63')](_0x25f12b[_0xa3df('0x5e')]);}})[_0xa3df('0x33')](respondWithResult(_0x86adaa,null))[_0xa3df('0x28')](handleError(_0x86adaa,null));};exports[_0xa3df('0x64')]=function(_0x2313b0,_0x369797,_0x59b039){var _0x10e87a={'raw':![],'where':{}};var _0x4be5f4={};var _0x5957c3={'count':0x0,'rows':[]};return db[_0xa3df('0x52')]['findOne']({'where':{'id':_0x2313b0[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x369797,null))['then'](function(_0x31b698){if(_0x31b698){_0x4be5f4[_0xa3df('0x45')]=_['keys'](db[_0xa3df('0x62')][_0xa3df('0x3f')]);_0x4be5f4[_0xa3df('0x43')]=_['keys'](_0x2313b0[_0xa3df('0x43')]);_0x4be5f4[_0xa3df('0x4d')]=_['intersection'](_0x4be5f4[_0xa3df('0x45')],_0x4be5f4['query']);_0x10e87a[_0xa3df('0x47')]=_['intersection'](_0x4be5f4[_0xa3df('0x45')],qs[_0xa3df('0x46')](_0x2313b0[_0xa3df('0x43')][_0xa3df('0x46')]));_0x10e87a[_0xa3df('0x47')]=_0x10e87a[_0xa3df('0x47')][_0xa3df('0x59')]?_0x10e87a[_0xa3df('0x47')]:_0x4be5f4['model'];if(!_0x2313b0[_0xa3df('0x43')]['hasOwnProperty'](_0xa3df('0x49'))){_0x10e87a['limit']=qs[_0xa3df('0x2e')](_0x2313b0[_0xa3df('0x43')]['limit']);_0x10e87a['offset']=qs[_0xa3df('0x2d')](_0x2313b0['query'][_0xa3df('0x2d')]);}_0x10e87a[_0xa3df('0x4a')]=qs[_0xa3df('0x4b')](_0x2313b0[_0xa3df('0x43')][_0xa3df('0x4b')]);_0x10e87a[_0xa3df('0x4c')]=qs['filters'](_['pick'](_0x2313b0[_0xa3df('0x43')],_0x4be5f4[_0xa3df('0x4d')]));_0x10e87a['where'][_0xa3df('0x61')]=_0x31b698['id'];if(_0x2313b0[_0xa3df('0x43')][_0xa3df('0x4e')]){_0x10e87a[_0xa3df('0x4c')]=_[_0xa3df('0x4f')](_0x10e87a[_0xa3df('0x4c')],{'$or':_[_0xa3df('0x3e')](_0x10e87a[_0xa3df('0x47')],function(_0x1c95d2){var _0x552962={};_0x552962[_0x1c95d2]={'$like':'%'+_0x2313b0[_0xa3df('0x43')][_0xa3df('0x4e')]+'%'};return _0x552962;})});}_0x10e87a=_[_0xa3df('0x4f')]({},_0x10e87a,_0x2313b0[_0xa3df('0x51')]);return db[_0xa3df('0x62')]['count']({'where':_0x10e87a[_0xa3df('0x4c')]})[_0xa3df('0x33')](function(_0x1f7679){_0x5957c3[_0xa3df('0x2c')]=_0x1f7679;if(_0x2313b0[_0xa3df('0x43')][_0xa3df('0x53')]){_0x10e87a['include']=[{'all':!![]}];}return db[_0xa3df('0x62')]['findAll'](_0x10e87a);})[_0xa3df('0x33')](function(_0x17ed2b){_0x5957c3[_0xa3df('0x56')]=_0x17ed2b;return _0x5957c3;});}})[_0xa3df('0x33')](respondWithFilteredResult(_0x369797,_0x10e87a))[_0xa3df('0x28')](handleError(_0x369797,null));};exports['removeDispositions']=function(_0x1a085c,_0xe50875,_0x3485fc){return db[_0xa3df('0x52')]['find']({'where':{'id':_0x1a085c[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0xe50875,null))['then'](function(_0x1e25b4){if(_0x1e25b4){return _0x1e25b4[_0xa3df('0x65')](_0x1a085c['query'][_0xa3df('0x66')]);}})[_0xa3df('0x33')](respondWithStatusCode(_0xe50875,null))[_0xa3df('0x28')](handleError(_0xe50875,null));};exports['addAnswer']=function(_0x3b342b,_0x58b23c,_0x5c4288){if(_0x3b342b[_0xa3df('0x5e')]['id']){delete _0x3b342b[_0xa3df('0x5e')]['id'];}return db[_0xa3df('0x52')][_0xa3df('0x5b')]({'where':{'id':_0x3b342b[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x58b23c,null))['then'](function(_0x261aef){if(_0x261aef){_0x3b342b[_0xa3df('0x5e')]['MailAccountId']=_0x261aef['id'];return db[_0xa3df('0x67')]['create'](_0x3b342b[_0xa3df('0x5e')]);}})[_0xa3df('0x33')](respondWithResult(_0x58b23c,null))[_0xa3df('0x28')](handleError(_0x58b23c,null));};exports[_0xa3df('0x68')]=function(_0x20499f,_0x13cb16,_0x4736f3){var _0x2a7d17={'raw':![],'where':{}};var _0x172572={};var _0x98e71a={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x20499f[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x13cb16,null))[_0xa3df('0x33')](function(_0x51ea5b){if(_0x51ea5b){_0x172572['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x172572['query']=_['keys'](_0x20499f[_0xa3df('0x43')]);_0x172572[_0xa3df('0x4d')]=_[_0xa3df('0x44')](_0x172572[_0xa3df('0x45')],_0x172572[_0xa3df('0x43')]);_0x2a7d17['attributes']=_[_0xa3df('0x44')](_0x172572[_0xa3df('0x45')],qs[_0xa3df('0x46')](_0x20499f[_0xa3df('0x43')][_0xa3df('0x46')]));_0x2a7d17[_0xa3df('0x47')]=_0x2a7d17[_0xa3df('0x47')][_0xa3df('0x59')]?_0x2a7d17['attributes']:_0x172572[_0xa3df('0x45')];if(!_0x20499f[_0xa3df('0x43')][_0xa3df('0x48')](_0xa3df('0x49'))){_0x2a7d17[_0xa3df('0x2e')]=qs['limit'](_0x20499f[_0xa3df('0x43')][_0xa3df('0x2e')]);_0x2a7d17[_0xa3df('0x2d')]=qs['offset'](_0x20499f[_0xa3df('0x43')][_0xa3df('0x2d')]);}_0x2a7d17[_0xa3df('0x4a')]=qs[_0xa3df('0x4b')](_0x20499f[_0xa3df('0x43')][_0xa3df('0x4b')]);_0x2a7d17['where']=qs[_0xa3df('0x4d')](_[_0xa3df('0x69')](_0x20499f[_0xa3df('0x43')],_0x172572['filters']));_0x2a7d17['where'][_0xa3df('0x61')]=_0x51ea5b['id'];if(_0x20499f[_0xa3df('0x43')][_0xa3df('0x4e')]){_0x2a7d17[_0xa3df('0x4c')]=_[_0xa3df('0x4f')](_0x2a7d17[_0xa3df('0x4c')],{'$or':_[_0xa3df('0x3e')](_0x2a7d17[_0xa3df('0x47')],function(_0x7a5bee){var _0xb1384a={};_0xb1384a[_0x7a5bee]={'$like':'%'+_0x20499f[_0xa3df('0x43')][_0xa3df('0x4e')]+'%'};return _0xb1384a;})});}_0x2a7d17=_[_0xa3df('0x4f')]({},_0x2a7d17,_0x20499f['options']);return db[_0xa3df('0x67')][_0xa3df('0x2c')]({'where':_0x2a7d17[_0xa3df('0x4c')]})[_0xa3df('0x33')](function(_0x5c3d74){_0x98e71a[_0xa3df('0x2c')]=_0x5c3d74;if(_0x20499f[_0xa3df('0x43')]['includeAll']){_0x2a7d17[_0xa3df('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa3df('0x55')](_0x2a7d17);})[_0xa3df('0x33')](function(_0x338d6a){_0x98e71a['rows']=_0x338d6a;return _0x98e71a;});}})['then'](respondWithFilteredResult(_0x13cb16,_0x2a7d17))[_0xa3df('0x28')](handleError(_0x13cb16,null));};exports[_0xa3df('0x6a')]=function(_0xe6de98,_0x46b193,_0x46ecd6){return db[_0xa3df('0x52')][_0xa3df('0x5b')]({'where':{'id':_0xe6de98[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x46b193,null))[_0xa3df('0x33')](function(_0x26cc96){if(_0x26cc96){return _0x26cc96[_0xa3df('0x6a')](_0xe6de98['query']['ids']);}})['then'](respondWithStatusCode(_0x46b193,null))['catch'](handleError(_0x46b193,null));};exports[_0xa3df('0x63')]=function(_0x5b3283,_0x23ae62){var _0xcdcbc7={'name':_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x38')],'key':_0x5b3283['body'][_0xa3df('0x6b')],'email':_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x6c')],'ListId':_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x6d')],'active':!_[_0xa3df('0x6e')](_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x6f')])?_0x5b3283[_0xa3df('0x5e')]['active']:!![],'description':_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0xa3df('0x6e')](_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x71')])){if(_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x72')]){_0xcdcbc7['Imap']['user']=_0xcdcbc7['Smtp'][_0xa3df('0x73')]=_0x5b3283['body'][_0xa3df('0x74')];_0xcdcbc7[_0xa3df('0x5d')][_0xa3df('0x75')]=_0xcdcbc7[_0xa3df('0x3c')][_0xa3df('0x76')]=_0x5b3283['body']['cpassword'];}else{_0xcdcbc7[_0xa3df('0x5d')][_0xa3df('0x77')]=_0xcdcbc7['Smtp'][_0xa3df('0x77')]=![];}_0xcdcbc7['Imap'][_0xa3df('0x78')]=_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x5d')][_0xa3df('0x78')];_0xcdcbc7[_0xa3df('0x5d')][_0xa3df('0x79')]=_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x5d')][_0xa3df('0x79')];_0xcdcbc7[_0xa3df('0x3c')][_0xa3df('0x78')]=_0x5b3283[_0xa3df('0x5e')]['Smtp'][_0xa3df('0x78')];_0xcdcbc7['Smtp'][_0xa3df('0x79')]=_0x5b3283[_0xa3df('0x5e')]['Smtp'][_0xa3df('0x79')];}else{_0xcdcbc7['Imap'][_0xa3df('0x7a')]=_0xcdcbc7[_0xa3df('0x3c')][_0xa3df('0x7a')]=_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x71')];_0xcdcbc7[_0xa3df('0x5d')][_0xa3df('0x73')]=_0xcdcbc7['Smtp'][_0xa3df('0x73')]=_0x5b3283['body']['cuser'];_0xcdcbc7[_0xa3df('0x5d')][_0xa3df('0x75')]=_0xcdcbc7[_0xa3df('0x3c')][_0xa3df('0x76')]=_0x5b3283[_0xa3df('0x5e')][_0xa3df('0x7b')];}return db[_0xa3df('0x52')][_0xa3df('0x63')](_0xcdcbc7,{'include':[{'model':db[_0xa3df('0x3b')],'as':'Smtp'},{'model':db[_0xa3df('0x3a')],'as':_0xa3df('0x5d')}]})[_0xa3df('0x33')](function(_0x515219){var _0x4433bc=_0x5b3283[_0xa3df('0x73')]['get']({'plain':!![]});if(!_0x4433bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4433bc[_0xa3df('0x7c')]===_0xa3df('0x73')){var _0x5b5b0f=_0x515219[_0xa3df('0x34')]({'plain':!![]});return db[_0xa3df('0x7d')][_0xa3df('0x5b')]({'where':{'name':_0xa3df('0x35'),'userProfileId':_0x4433bc['userProfileId']},'raw':!![]})[_0xa3df('0x33')](function(_0x1422f9){if(_0x1422f9&&_0x1422f9[_0xa3df('0x7e')]===0x0){return db[_0xa3df('0x36')][_0xa3df('0x63')]({'name':_0x5b5b0f[_0xa3df('0x38')],'resourceId':_0x5b5b0f['id'],'type':_0x1422f9['name'],'sectionId':_0x1422f9['id']},{})[_0xa3df('0x33')](function(){return _0x515219;});}else{return _0x515219;}})[_0xa3df('0x28')](function(_0x4135cf){logger['error'](_0xa3df('0x7f'),_0x4135cf);throw _0x4135cf;});}return _0x515219;})[_0xa3df('0x33')](respondWithResult(_0x23ae62,0xc9))[_0xa3df('0x28')](handleError(_0x23ae62,null));};exports[_0xa3df('0x80')]=function(_0x2ac36e,_0xfc1ecc,_0xaf529a){return db[_0xa3df('0x52')][_0xa3df('0x81')]({'where':{'id':_0x2ac36e['params']['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0xfc1ecc,null))[_0xa3df('0x33')](function(_0x198ab8){if(_0x198ab8){return _0x198ab8['getImap']();}return null;})['then'](respondWithResult(_0xfc1ecc,null))['catch'](handleError(_0xfc1ecc,null));};exports[_0xa3df('0x82')]=function(_0x56af4b,_0x4f2f82,_0x1c45ac){if(_0x56af4b[_0xa3df('0x5e')]['id']){delete _0x56af4b[_0xa3df('0x5e')]['id'];}return db[_0xa3df('0x52')][_0xa3df('0x5b')]({'where':{'id':_0x56af4b['params']['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x4f2f82,null))[_0xa3df('0x33')](function(_0x1751bd){if(_0x1751bd){_0x56af4b[_0xa3df('0x5e')][_0xa3df('0x61')]=_0x1751bd['id'];return db[_0xa3df('0x3a')][_0xa3df('0x63')](_0x56af4b[_0xa3df('0x5e')]);}})['then'](respondWithResult(_0x4f2f82,null))['catch'](handleError(_0x4f2f82,null));};exports[_0xa3df('0x83')]=function(_0x1d79b4,_0x26dfa1,_0x5af905){return db['MailAccount'][_0xa3df('0x81')]({'where':{'id':_0x1d79b4[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x26dfa1,null))[_0xa3df('0x33')](function(_0x5305fa){if(_0x5305fa){return _0x5305fa[_0xa3df('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x26dfa1,null))['catch'](handleError(_0x26dfa1,null));};exports[_0xa3df('0x85')]=function(_0x12cee3,_0x21956b,_0x2e08cf){return db[_0xa3df('0x52')][_0xa3df('0x81')]({'where':{'id':_0x12cee3[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x21956b,null))[_0xa3df('0x33')](function(_0xe443b6){if(_0xe443b6){return _0xe443b6[_0xa3df('0x85')]();}return null;})['then'](respondWithResult(_0x21956b,null))[_0xa3df('0x28')](handleError(_0x21956b,null));};exports[_0xa3df('0x86')]=function(_0x588fe9,_0x5e56ed,_0x1cea57){if(_0x588fe9[_0xa3df('0x5e')]['id']){delete _0x588fe9[_0xa3df('0x5e')]['id'];}return db['MailAccount'][_0xa3df('0x5b')]({'where':{'id':_0x588fe9[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x5e56ed,null))['then'](function(_0x430409){if(_0x430409){_0x588fe9['body'][_0xa3df('0x61')]=_0x430409['id'];return db[_0xa3df('0x3b')][_0xa3df('0x63')](_0x588fe9['body']);}})[_0xa3df('0x33')](respondWithResult(_0x5e56ed,null))[_0xa3df('0x28')](handleError(_0x5e56ed,null));};exports[_0xa3df('0x87')]=function(_0x3c1f64,_0x5341ef,_0x385977){return db[_0xa3df('0x52')][_0xa3df('0x81')]({'where':{'id':_0x3c1f64[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x5341ef,null))[_0xa3df('0x33')](function(_0x12dcb9){if(_0x12dcb9){return _0x12dcb9[_0xa3df('0x88')](null);}return null;})[_0xa3df('0x33')](respondWithStatusCode(_0x5341ef,null))[_0xa3df('0x28')](handleError(_0x5341ef,null));};exports['addInteraction']=function(_0x5b6971,_0x10134f,_0x15599b){return db[_0xa3df('0x89')][_0xa3df('0x5b')]({'where':{'id':_0x5b6971['params']['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x10134f,null))['then'](function(_0x21fad6){if(_0x21fad6){return _0x21fad6[_0xa3df('0x8a')](_0x5b6971[_0xa3df('0x5e')][_0xa3df('0x66')],_[_0xa3df('0x8b')](_0x5b6971[_0xa3df('0x5e')],['ids','id'])||{});}})[_0xa3df('0x33')](respondWithResult(_0x10134f,null))['catch'](handleError(_0x10134f,null));};exports[_0xa3df('0x8c')]=function(_0x5e681f,_0x3d5073,_0x44816c){var _0xa74103={'raw':![],'where':{}};var _0xfd8b5f={};var _0x31bbf6={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5e681f[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x3d5073,null))['then'](function(_0x3c2628){if(_0x3c2628){_0xfd8b5f[_0xa3df('0x45')]=_['keys'](db[_0xa3df('0x89')]['rawAttributes']);_0xfd8b5f[_0xa3df('0x43')]=_[_0xa3df('0x42')](_0x5e681f[_0xa3df('0x43')]);_0xfd8b5f['filters']=_[_0xa3df('0x44')](_0xfd8b5f[_0xa3df('0x45')],_0xfd8b5f[_0xa3df('0x43')]);_0xa74103['attributes']=_['intersection'](_0xfd8b5f[_0xa3df('0x45')],qs['fields'](_0x5e681f['query']['fields']));_0xa74103[_0xa3df('0x47')]=_0xa74103[_0xa3df('0x47')][_0xa3df('0x59')]?_0xa74103[_0xa3df('0x47')]:_0xfd8b5f[_0xa3df('0x45')];if(!_0x5e681f[_0xa3df('0x43')][_0xa3df('0x48')](_0xa3df('0x49'))){_0xa74103[_0xa3df('0x2e')]=qs[_0xa3df('0x2e')](_0x5e681f[_0xa3df('0x43')]['limit']);_0xa74103[_0xa3df('0x2d')]=qs[_0xa3df('0x2d')](_0x5e681f[_0xa3df('0x43')][_0xa3df('0x2d')]);}_0xa74103[_0xa3df('0x4a')]=qs[_0xa3df('0x4b')](_0x5e681f[_0xa3df('0x43')][_0xa3df('0x4b')]);_0xa74103[_0xa3df('0x4c')]=qs['filters'](_['pick'](_0x5e681f[_0xa3df('0x43')],_0xfd8b5f['filters']));_0xa74103['where'][_0xa3df('0x61')]=_0x3c2628['id'];if(_0x5e681f[_0xa3df('0x43')]['filter']){_0xa74103[_0xa3df('0x4c')]=_[_0xa3df('0x4f')](_0xa74103['where'],{'$or':_[_0xa3df('0x3e')](_0xa74103[_0xa3df('0x47')],function(_0x46f0f1){var _0x5c368f={};_0x5c368f[_0x46f0f1]={'$like':'%'+_0x5e681f[_0xa3df('0x43')][_0xa3df('0x4e')]+'%'};return _0x5c368f;})});}_0xa74103=_[_0xa3df('0x4f')]({},_0xa74103,_0x5e681f[_0xa3df('0x51')]);return db[_0xa3df('0x89')][_0xa3df('0x2c')]({'where':_0xa74103['where']})[_0xa3df('0x33')](function(_0x23ea06){_0x31bbf6[_0xa3df('0x2c')]=_0x23ea06;if(_0x5e681f[_0xa3df('0x43')][_0xa3df('0x53')]){_0xa74103[_0xa3df('0x54')]=[{'model':db[_0xa3df('0x8d')],'as':_0xa3df('0x8e'),'required':![]},{'model':db[_0xa3df('0x8f')],'as':_0xa3df('0x90'),'attributes':['name',_0xa3df('0x91'),_0xa3df('0x92')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xa3df('0x38'),'color'],'where':_0x5e681f[_0xa3df('0x43')][_0xa3df('0x93')]?{'id':_0x5e681f['query'][_0xa3df('0x93')]}:undefined,'required':_0x5e681f['query'][_0xa3df('0x93')]?!![]:![]}];}return db[_0xa3df('0x89')]['findAll'](_0xa74103);})[_0xa3df('0x33')](function(_0x173810){_0x31bbf6[_0xa3df('0x56')]=_0x173810;return _0x31bbf6;});}})[_0xa3df('0x33')](respondWithFilteredResult(_0x3d5073,_0xa74103))['catch'](handleError(_0x3d5073,null));};exports[_0xa3df('0x94')]=function(_0x1dfa4f,_0xd0b955,_0x1c52cb){return db['MailAccount'][_0xa3df('0x81')]({'where':{'id':_0x1dfa4f[_0xa3df('0x5c')]['id']}})['then'](handleEntityNotFound(_0xd0b955,null))[_0xa3df('0x33')](function(_0x3d2828){if(_0x3d2828){return db[_0xa3df('0x95')][_0xa3df('0x96')](function(_0xf1b035){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x1dfa4f[_0xa3df('0x5c')]['id']},'transaction':_0xf1b035})[_0xa3df('0x33')](function(_0x4f4038){var _0x23f0d5=_['map'](_0x1dfa4f[_0xa3df('0x5e')],function(_0x1072ab){_0x1072ab[_0xa3df('0x61')]=_0x1dfa4f[_0xa3df('0x5c')]['id'];return _0x1072ab;});return db[_0xa3df('0x97')]['bulkCreate'](_0x23f0d5,{'transaction':_0xf1b035});});})['then'](function(){return db[_0xa3df('0x97')][_0xa3df('0x98')]({'where':{'MailAccountId':_0x1dfa4f[_0xa3df('0x5c')]['id']},'order':_0xa3df('0x99')});});}})[_0xa3df('0x33')](respondWithResult(_0xd0b955,null))['catch'](handleError(_0xd0b955,null));};exports[_0xa3df('0x9a')]=function(_0x3a2953,_0x24476c,_0x1c4218){var _0x13264c={};var _0x23af87={};var _0x34ee1f;var _0xda984b;return db['MailAccount'][_0xa3df('0x81')]({'where':{'id':_0x3a2953[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x24476c,null))[_0xa3df('0x33')](function(_0x372f88){if(_0x372f88){_0x34ee1f=_0x372f88;_0x23af87[_0xa3df('0x45')]=_[_0xa3df('0x42')](db[_0xa3df('0x97')][_0xa3df('0x3f')]);_0x23af87[_0xa3df('0x43')]=_[_0xa3df('0x42')](_0x3a2953['query']);_0x23af87[_0xa3df('0x4d')]=_[_0xa3df('0x44')](_0x23af87[_0xa3df('0x45')],_0x23af87[_0xa3df('0x43')]);_0x13264c[_0xa3df('0x47')]=_['intersection'](_0x23af87[_0xa3df('0x45')],qs['fields'](_0x3a2953[_0xa3df('0x43')][_0xa3df('0x46')]));_0x13264c['attributes']=_0x13264c[_0xa3df('0x47')][_0xa3df('0x59')]?_0x13264c[_0xa3df('0x47')]:_0x23af87[_0xa3df('0x45')];_0x13264c[_0xa3df('0x4a')]=qs[_0xa3df('0x4b')](_0x3a2953['query'][_0xa3df('0x4b')]);_0x13264c['where']=qs[_0xa3df('0x4d')](_['pick'](_0x3a2953[_0xa3df('0x43')],_0x23af87[_0xa3df('0x4d')]));if(_0x3a2953[_0xa3df('0x43')][_0xa3df('0x4e')]){_0x13264c[_0xa3df('0x4c')]=_['merge'](_0x13264c[_0xa3df('0x4c')],{'$or':_[_0xa3df('0x3e')](_0x13264c[_0xa3df('0x47')],function(_0x2bbb36){var _0x56693d={};_0x56693d[_0x2bbb36]={'$like':'%'+_0x3a2953[_0xa3df('0x43')]['filter']+'%'};return _0x56693d;})});}_0x13264c=_['merge']({},_0x13264c,_0x3a2953[_0xa3df('0x51')]);return _0x34ee1f['getApplications'](_0x13264c);}})[_0xa3df('0x33')](function(_0x3d46d2){if(_0x3d46d2){_0xda984b=_0x3d46d2[_0xa3df('0x59')];if(!_0x3a2953[_0xa3df('0x43')][_0xa3df('0x48')](_0xa3df('0x49'))){_0x13264c[_0xa3df('0x2e')]=qs[_0xa3df('0x2e')](_0x3a2953[_0xa3df('0x43')][_0xa3df('0x2e')]);_0x13264c[_0xa3df('0x2d')]=qs[_0xa3df('0x2d')](_0x3a2953[_0xa3df('0x43')][_0xa3df('0x2d')]);}return _0x34ee1f[_0xa3df('0x9a')](_0x13264c);}})[_0xa3df('0x33')](function(_0x58b312){if(_0x58b312){return _0x58b312?{'count':_0xda984b,'rows':_0x58b312}:null;}})['then'](respondWithResult(_0x24476c,null))[_0xa3df('0x28')](handleError(_0x24476c,null));};exports[_0xa3df('0x9b')]=function(_0x2032f6,_0x536fb2,_0x56fb21){var _0xf92ae={'raw':!![],'where':{}};var _0x25e88d={};var _0x443354={'count':0x0,'rows':[]};return db[_0xa3df('0x52')][_0xa3df('0x81')]({'where':{'id':_0x2032f6[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x536fb2,null))[_0xa3df('0x33')](function(_0x2bf724){if(_0x2bf724){_0x25e88d['model']=_[_0xa3df('0x42')](db['MailMessage'][_0xa3df('0x3f')]);_0x25e88d[_0xa3df('0x43')]=_[_0xa3df('0x42')](_0x2032f6[_0xa3df('0x43')]);_0x25e88d[_0xa3df('0x4d')]=_[_0xa3df('0x44')](_0x25e88d[_0xa3df('0x45')],_0x25e88d[_0xa3df('0x43')]);_0xf92ae[_0xa3df('0x47')]=_[_0xa3df('0x44')](_0x25e88d[_0xa3df('0x45')],qs[_0xa3df('0x46')](_0x2032f6['query']['fields']));_0xf92ae[_0xa3df('0x47')]=_0xf92ae[_0xa3df('0x47')][_0xa3df('0x59')]?_0xf92ae['attributes']:_0x25e88d['model'];if(!_0x2032f6['query'][_0xa3df('0x48')]('nolimit')){_0xf92ae[_0xa3df('0x2e')]=qs['limit'](_0x2032f6[_0xa3df('0x43')][_0xa3df('0x2e')]);_0xf92ae['offset']=qs[_0xa3df('0x2d')](_0x2032f6[_0xa3df('0x43')]['offset']);}_0xf92ae[_0xa3df('0x4a')]=qs[_0xa3df('0x4b')](_0x2032f6[_0xa3df('0x43')]['sort']);_0xf92ae[_0xa3df('0x4c')]=qs[_0xa3df('0x4d')](_[_0xa3df('0x69')](_0x2032f6[_0xa3df('0x43')],_0x25e88d[_0xa3df('0x4d')]));_0xf92ae[_0xa3df('0x4c')]['MailAccountId']=_0x2bf724['id'];if(_0x2032f6[_0xa3df('0x43')]['filter']){_0xf92ae[_0xa3df('0x4c')]=_[_0xa3df('0x4f')](_0xf92ae[_0xa3df('0x4c')],{'$or':_['map'](_0xf92ae['attributes'],function(_0x16b1d2){var _0x3e3168={};_0x3e3168[_0x16b1d2]={'$like':'%'+_0x2032f6[_0xa3df('0x43')][_0xa3df('0x4e')]+'%'};return _0x3e3168;})});}if(_0x2032f6['query'][_0xa3df('0x9c')]){var _0x3c9514=_0x2032f6[_0xa3df('0x43')]['$gte'][_0xa3df('0x9d')](',');var _0xd14427={};_0xd14427[_0x3c9514[0x0]]={'$gte':moment(_0x3c9514[0x1])[_0xa3df('0x9e')](_0xa3df('0x9f'))};_0xf92ae[_0xa3df('0x4c')]=_[_0xa3df('0x4f')](_0xf92ae[_0xa3df('0x4c')],_0xd14427);}_0xf92ae=_[_0xa3df('0x4f')]({},_0xf92ae,_0x2032f6['options']);return db[_0xa3df('0xa0')][_0xa3df('0x2c')]({'where':_0xf92ae['where']})[_0xa3df('0x33')](function(_0x518a0c){_0x443354[_0xa3df('0x2c')]=_0x518a0c;if(_0x2032f6[_0xa3df('0x43')]['includeAll']){_0xf92ae[_0xa3df('0x54')]=[{'all':!![]}];}return db['MailMessage'][_0xa3df('0x55')](_0xf92ae);})[_0xa3df('0x33')](function(_0x4e614b){_0x443354[_0xa3df('0x56')]=_0x4e614b;return _0x443354;});}})[_0xa3df('0x33')](respondWithFilteredResult(_0x536fb2,_0xf92ae))[_0xa3df('0x28')](handleError(_0x536fb2,null));};exports[_0xa3df('0xa1')]=function(_0x32d4ce,_0x1e2024,_0xed5f6c){var _0x32bdc6,_0x1a3f06={},_0x1792b3;if(_0x32d4ce[_0xa3df('0x5e')]['to']){_0x1792b3=_0x32d4ce[_0xa3df('0x5e')]['to'][_0xa3df('0x9d')](',')[0x0];}return db[_0xa3df('0x52')][_0xa3df('0x5b')]({'where':{'id':_0x32d4ce[_0xa3df('0x5c')]['id']},'include':[{'model':db[_0xa3df('0xa2')],'as':_0xa3df('0xa3'),'include':[{'model':db[_0xa3df('0x8d')],'as':_0xa3df('0xa4'),'where':{'email':_0x1792b3},'limit':0x1,'order':[[_0xa3df('0xa5'),_0xa3df('0xa6')]]}]},{'model':db[_0xa3df('0x3b')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x1e2024,null))['then'](function(_0x422daa){if(_0x422daa){_0x32bdc6=_0x422daa;if(_0x422daa['Smtp']){if(_[_0xa3df('0x6e')](_0x32d4ce[_0xa3df('0x5e')][_0xa3df('0xa7')])){_0x32d4ce['body'][_0xa3df('0xa7')]=util[_0xa3df('0x9e')]('%s\x20<%s>',_0x422daa[_0xa3df('0x38')],_0x422daa[_0xa3df('0x6c')]||_0x422daa[_0xa3df('0x3c')][_0xa3df('0x73')]);}if(_0x32d4ce[_0xa3df('0x5e')]['attachments']&&_0x32d4ce['body']['attachments'][_0xa3df('0x59')]){for(var _0x3ba882=0x0;_0x3ba882<_0x32d4ce['body'][_0xa3df('0xa8')][_0xa3df('0x59')];_0x3ba882+=0x1){_0x32d4ce[_0xa3df('0x5e')][_0xa3df('0xa8')][_0x3ba882]={'filename':_0x32d4ce['body'][_0xa3df('0xa8')][_0x3ba882][_0xa3df('0x38')],'path':path[_0xa3df('0xa9')](config[_0xa3df('0xaa')],_0xa3df('0xab'),_0x32d4ce['body'][_0xa3df('0xa8')][_0x3ba882][_0xa3df('0xac')])};}}var _0x5699c2={'tls':{'rejectUnauthorized':![]}};if(_[_0xa3df('0x6e')](_0x422daa[_0xa3df('0x3c')][_0xa3df('0x7a')])){if(_0x422daa[_0xa3df('0x3c')][_0xa3df('0x77')]){_0x5699c2[_0xa3df('0xad')]={'user':_0x422daa[_0xa3df('0x3c')][_0xa3df('0x73')],'pass':_0x422daa[_0xa3df('0x3c')][_0xa3df('0x76')]};}_0x5699c2['host']=_0x422daa[_0xa3df('0x3c')][_0xa3df('0x78')];_0x5699c2[_0xa3df('0x79')]=_0x422daa[_0xa3df('0x3c')][_0xa3df('0x79')];_0x5699c2[_0xa3df('0xae')]=_0x422daa[_0xa3df('0x3c')][_0xa3df('0xae')];}else{_0x5699c2[_0xa3df('0x7a')]=_0x422daa[_0xa3df('0x3c')]['service'];_0x5699c2[_0xa3df('0xad')]={'user':_0x422daa[_0xa3df('0x3c')]['user'],'pass':_0x422daa[_0xa3df('0x3c')]['pass']};}return respondWithRpcPromise(_0xa3df('0xaf'),_0xa3df('0xb0'),{'account':_0x5699c2,'message':_0x32d4ce[_0xa3df('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})[_0xa3df('0x33')](function(_0x2f4c8e){if(_0x2f4c8e){_0x1a3f06=_0x2f4c8e;if(_0x32bdc6[_0xa3df('0xa3')]){if(_0x32bdc6['List'][_0xa3df('0xa4')][_0xa3df('0x59')]){return _0x32bdc6['List']['Contacts'][0x0];}else{return db[_0xa3df('0x8d')]['create'](_[_0xa3df('0x17')](_0x32d4ce[_0xa3df('0x5e')],{'firstName':_0x32d4ce['body']['to'],'email':_0x32d4ce[_0xa3df('0x5e')]['to'],'phone':_0x32d4ce[_0xa3df('0x5e')]['to'],'ListId':_0x32bdc6['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0xa3df('0x33')](function(_0x356bb4){if(_0x356bb4){var _0x46e89b={'UserId':_0x32d4ce[_0xa3df('0x73')]['id'],'ContactId':_0x356bb4['id'],'MailAccountId':_0x32bdc6['id'],'inReplyTo':_0x1a3f06['messageId'],'to':_0x32d4ce[_0xa3df('0x5e')][_0xa3df('0xa7')],'cc':_0x32d4ce['body']['cc'],'subject':_0x32d4ce[_0xa3df('0x5e')][_0xa3df('0xb1')],'attach':_0x32d4ce[_0xa3df('0x5e')][_0xa3df('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xa3df('0x9f')),'lastMsgDirection':'out','lastMsgBody':_0x32d4ce['body'][_0xa3df('0x5e')],'Messages':[_[_0xa3df('0x4f')](_0x32d4ce['body'],{'messageId':_0x1a3f06[_0xa3df('0xb3')],'sentAt':moment()[_0xa3df('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x32bdc6['id'],'UserId':_0x32d4ce[_0xa3df('0x73')]['id'],'ContactId':_0x356bb4['id']})]};if(_0x32d4ce[_0xa3df('0x5e')][_0xa3df('0xb4')]){_0x46e89b=_[_0xa3df('0x4f')](_0x46e89b,_0x32d4ce[_0xa3df('0x5e')][_0xa3df('0xb4')]);}return db['MailInteraction'][_0xa3df('0x63')](_0x46e89b,{'include':[{'model':db[_0xa3df('0xa0')],'as':_0xa3df('0xb5')}]});}})[_0xa3df('0x33')](respondWithResult(_0x1e2024,null))[_0xa3df('0x28')](handleError(_0x1e2024,null));};exports[_0xa3df('0xb6')]=function(_0x1c1284,_0x321209,_0x883ba9){return db['MailAccount'][_0xa3df('0x5b')]({'where':{'id':_0x1c1284[_0xa3df('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xa3df('0x3c'),'raw':!![]}]})[_0xa3df('0x33')](handleEntityNotFound(_0x321209,null))[_0xa3df('0x33')](function(_0x21a597){if(_0x21a597&&_0x21a597[_0xa3df('0x3c')]){var _0x90a0f8={'id':_0x21a597['id'],'tls':{'rejectUnauthorized':![]}};if(_0x21a597[_0xa3df('0x3c')][_0xa3df('0x7a')]){_0x90a0f8[_0xa3df('0x7a')]=_0x21a597[_0xa3df('0x3c')][_0xa3df('0x7a')];}else{_0x90a0f8['host']=_0x21a597[_0xa3df('0x3c')][_0xa3df('0x78')];_0x90a0f8[_0xa3df('0x79')]=_0x21a597[_0xa3df('0x3c')][_0xa3df('0x79')];_0x90a0f8[_0xa3df('0xae')]=_0x21a597[_0xa3df('0x3c')][_0xa3df('0xae')];}if(_0x21a597[_0xa3df('0x3c')][_0xa3df('0x77')]){_0x90a0f8[_0xa3df('0xad')]={'user':_0x21a597['Smtp'][_0xa3df('0x73')],'pass':_0x21a597[_0xa3df('0x3c')][_0xa3df('0x76')]};}return respondWithRpcPromise(_0xa3df('0xb7'),_0xa3df('0xb6'),{'account':_0x90a0f8});}})[_0xa3df('0x33')](respondWithResult(_0x321209,null))['catch'](handleError(_0x321209,null));};exports['destroy']=function(_0x33d1d5,_0x562c56){return db[_0xa3df('0x52')][_0xa3df('0x5b')]({'where':{'id':_0x33d1d5[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x562c56,null))[_0xa3df('0x33')](function(_0x419bd5){if(_0x419bd5&&_0x419bd5[_0xa3df('0x7a')]){throw new db[(_0xa3df('0xb8'))][(_0xa3df('0x1e'))](_0xa3df('0xb9'));}return _0x419bd5;})['then'](removeEntity(_0x562c56,null))[_0xa3df('0x28')](handleError(_0x562c56,null));};exports['addAgents']=function(_0x4e8e1c,_0x412c6b,_0x4706e1){return db[_0xa3df('0x52')][_0xa3df('0x5b')]({'where':{'id':_0x4e8e1c[_0xa3df('0x5c')]['id']}})['then'](handleEntityNotFound(_0x412c6b,null))[_0xa3df('0x33')](function(_0x33cf82){if(_0x33cf82){return _0x33cf82['addAgents'](_0x4e8e1c['body'][_0xa3df('0x66')],_[_0xa3df('0x8b')](_0x4e8e1c[_0xa3df('0x5e')],[_0xa3df('0x66'),'id'])||{})[_0xa3df('0xba')](function(_0x486622){for(var _0x48f271=0x0;_0x48f271<_0x4e8e1c[_0xa3df('0x5e')][_0xa3df('0x66')][_0xa3df('0x59')];_0x48f271+=0x1){socket[_0xa3df('0xbb')]('userMailAccount:save',{'UserId':_0x4e8e1c['body'][_0xa3df('0x66')][_0x48f271],'MailAccountId':_0x4e8e1c[_0xa3df('0x5c')]['id']});}return _0x486622;});}})[_0xa3df('0x33')](respondWithResult(_0x412c6b,null))[_0xa3df('0x28')](handleError(_0x412c6b,null));};exports['removeAgents']=function(_0x57d3da,_0x9d8b98,_0x2c5ba4){return db['MailAccount'][_0xa3df('0x5b')]({'where':{'id':_0x57d3da[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x9d8b98,null))['then'](function(_0xb9fc4f){if(_0xb9fc4f){return _0xb9fc4f[_0xa3df('0xbc')](_0x57d3da[_0xa3df('0x43')][_0xa3df('0x66')])['then'](function(){if(_[_0xa3df('0xbd')](_0x57d3da[_0xa3df('0x43')][_0xa3df('0x66')])){for(var _0x36dc66=0x0;_0x36dc66<_0x57d3da['query'][_0xa3df('0x66')][_0xa3df('0x59')];_0x36dc66+=0x1){socket[_0xa3df('0xbb')](_0xa3df('0xbe'),{'UserId':Number(_0x57d3da[_0xa3df('0x43')][_0xa3df('0x66')][_0x36dc66]),'MailAccountId':Number(_0x57d3da['params']['id'])});}}else{socket[_0xa3df('0xbb')](_0xa3df('0xbe'),{'UserId':Number(_0x57d3da[_0xa3df('0x43')][_0xa3df('0x66')]),'MailAccountId':Number(_0x57d3da['params']['id'])});}});}})[_0xa3df('0x33')](respondWithStatusCode(_0x9d8b98,null))[_0xa3df('0x28')](handleError(_0x9d8b98,null));};exports['getAgents']=function(_0x48c1c4,_0x1db375,_0x4eb10a){var _0x47901e={};var _0x270086={};var _0xcbd187;var _0x16a183;return db[_0xa3df('0x52')]['findOne']({'where':{'id':_0x48c1c4[_0xa3df('0x5c')]['id']}})[_0xa3df('0x33')](handleEntityNotFound(_0x1db375,null))[_0xa3df('0x33')](function(_0x22eb0f){if(_0x22eb0f){_0xcbd187=_0x22eb0f;_0x270086[_0xa3df('0x45')]=_[_0xa3df('0x42')](db[_0xa3df('0x8f')][_0xa3df('0x3f')]);_0x270086[_0xa3df('0x43')]=_[_0xa3df('0x42')](_0x48c1c4[_0xa3df('0x43')]);_0x270086[_0xa3df('0x4d')]=_[_0xa3df('0x44')](_0x270086['model'],_0x270086[_0xa3df('0x43')]);_0x47901e[_0xa3df('0x47')]=_[_0xa3df('0x44')](_0x270086[_0xa3df('0x45')],qs[_0xa3df('0x46')](_0x48c1c4['query'][_0xa3df('0x46')]));_0x47901e[_0xa3df('0x47')]=_0x47901e[_0xa3df('0x47')][_0xa3df('0x59')]?_0x47901e['attributes']:_0x270086[_0xa3df('0x45')];_0x47901e[_0xa3df('0x4a')]=qs[_0xa3df('0x4b')](_0x48c1c4[_0xa3df('0x43')][_0xa3df('0x4b')]);_0x47901e[_0xa3df('0x4c')]=qs[_0xa3df('0x4d')](_[_0xa3df('0x69')](_0x48c1c4['query'],_0x270086['filters']));if(_0x48c1c4[_0xa3df('0x43')][_0xa3df('0x4e')]){_0x47901e[_0xa3df('0x4c')]=_['merge'](_0x47901e[_0xa3df('0x4c')],{'$or':_['map'](_0x47901e['attributes'],function(_0x40cb3c){var _0x434aa2={};_0x434aa2[_0x40cb3c]={'$like':'%'+_0x48c1c4[_0xa3df('0x43')][_0xa3df('0x4e')]+'%'};return _0x434aa2;})});}_0x47901e=_['merge']({},_0x47901e,_0x48c1c4[_0xa3df('0x51')]);return _0xcbd187[_0xa3df('0xbf')](_0x47901e);}})['then'](function(_0x3d3a9b){if(_0x3d3a9b){_0x16a183=_0x3d3a9b[_0xa3df('0x59')];if(!_0x48c1c4[_0xa3df('0x43')][_0xa3df('0x48')](_0xa3df('0x49'))){_0x47901e[_0xa3df('0x2e')]=qs['limit'](_0x48c1c4[_0xa3df('0x43')][_0xa3df('0x2e')]);_0x47901e[_0xa3df('0x2d')]=qs[_0xa3df('0x2d')](_0x48c1c4[_0xa3df('0x43')][_0xa3df('0x2d')]);}return _0xcbd187[_0xa3df('0xbf')](_0x47901e);}})[_0xa3df('0x33')](function(_0x3e791e){if(_0x3e791e){return _0x3e791e?{'count':_0x16a183,'rows':_0x3e791e}:null;}})[_0xa3df('0x33')](respondWithResult(_0x1db375,null))[_0xa3df('0x28')](handleError(_0x1db375,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 740b815..5bd155f 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 _0x8965=['save','update','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x208c06,_0x309350){var _0x46efef=function(_0xddcb87){while(--_0xddcb87){_0x208c06['push'](_0x208c06['shift']());}};_0x46efef(++_0x309350);}(_0x8965,0x1e8));var _0x5896=function(_0x346ff6,_0x5b525a){_0x346ff6=_0x346ff6-0x0;var _0x4ef56b=_0x8965[_0x346ff6];return _0x4ef56b;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x5896('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5896('0x1')](0x0);var events={'afterCreate':_0x5896('0x2'),'afterUpdate':_0x5896('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3743db){return function(_0x3dbc11,_0x3879bd,_0xca0c36){MailAccountEvents[_0x5896('0x4')](_0x3743db+':'+_0x3dbc11['id'],_0x3dbc11);MailAccountEvents[_0x5896('0x4')](_0x3743db,_0x3dbc11);_0xca0c36(null);};}for(var e in events){if(events[_0x5896('0x5')](e)){var event=events[e];MailAccount[_0x5896('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xdd15=['MailAccount','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2f8e01,_0x278674){var _0x5333e9=function(_0x1abd14){while(--_0x1abd14){_0x2f8e01['push'](_0x2f8e01['shift']());}};_0x5333e9(++_0x278674);}(_0xdd15,0x1e7));var _0x5dd1=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdd15[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x5dd1('0x0'))['db'][_0x5dd1('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5dd1('0x2'),'afterUpdate':'update','afterDestroy':_0x5dd1('0x3')};function emitEvent(_0x466de0){return function(_0x10b96f,_0xee0868,_0x3d3a6d){MailAccountEvents[_0x5dd1('0x4')](_0x466de0+':'+_0x10b96f['id'],_0x10b96f);MailAccountEvents[_0x5dd1('0x4')](_0x466de0,_0x10b96f);_0x3d3a6d(null);};}for(var e in events){if(events[_0x5dd1('0x5')](e)){var event=events[e];MailAccount[_0x5dd1('0x6')](e,emitEvent(event));}}module[_0x5dd1('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3473be1..f59005b 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 _0x14b2=['request-promise','path','rimraf','../../config/environment','exports','MailAccount','lodash','../../config/logger'];(function(_0x50a45f,_0x428399){var _0x5279ef=function(_0x5c2bb3){while(--_0x5c2bb3){_0x50a45f['push'](_0x50a45f['shift']());}};_0x5279ef(++_0x428399);}(_0x14b2,0x9e));var _0x214b=function(_0x5c4100,_0x1c72be){_0x5c4100=_0x5c4100-0x0;var _0x3c6b06=_0x14b2[_0x5c4100];return _0x3c6b06;};'use strict';var _=require(_0x214b('0x0'));var util=require('util');var logger=require(_0x214b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x214b('0x2'));var fs=require('fs');var path=require(_0x214b('0x3'));var rimraf=require(_0x214b('0x4'));var config=require(_0x214b('0x5'));var attributes=require('./mailAccount.attributes');module[_0x214b('0x6')]=function(_0x2eb489,_0x5e1461){return _0x2eb489['define'](_0x214b('0x7'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f9=['util','../../config/logger','api','bluebird','path','../../config/environment','exports','MailAccount','mail_accounts','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35f9,0x10d));var _0x935f=function(_0x3283c3,_0x249100){_0x3283c3=_0x3283c3-0x0;var _0x393f5c=_0x35f9[_0x3283c3];return _0x393f5c;};'use strict';var _=require(_0x935f('0x0'));var util=require(_0x935f('0x1'));var logger=require(_0x935f('0x2'))(_0x935f('0x3'));var moment=require('moment');var BPromise=require(_0x935f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x935f('0x5'));var rimraf=require('rimraf');var config=require(_0x935f('0x6'));var attributes=require('./mailAccount.attributes');module[_0x935f('0x7')]=function(_0x4a038a,_0x754386){return _0x4a038a['define'](_0x935f('0x8'),attributes,{'tableName':_0x935f('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 0aa1e86..543ca65 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 _0x6324=['created','attachments','originTo','originCc','bcc','Attachment','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowMailAccount','NotifyMailAccount','body','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','list','applications','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','Contacts','defaults','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','update','subject','interaction'];(function(_0x70db11,_0x3cdc8c){var _0x2155d9=function(_0x16a116){while(--_0x16a116){_0x70db11['push'](_0x70db11['shift']());}};_0x2155d9(++_0x3cdc8c);}(_0x6324,0x142));var _0x4632=function(_0x479f6f,_0x1c26c4){_0x479f6f=_0x479f6f-0x0;var _0x24e701=_0x6324[_0x479f6f];return _0x24e701;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232c});config[_0x4632('0xa')]=_['defaults'](config[_0x4632('0xa')],{'host':_0x4632('0xb'),'port':0x18eb});var socket=require(_0x4632('0xc'))(new Redis(config['redis']));require(_0x4632('0xd'))[_0x4632('0xe')](socket);function respondWithRpcPromise(_0x47a518,_0x556bbc,_0xcdefa2){return new BPromise(function(_0x21999d,_0x30a7cf){return client[_0x4632('0xf')](_0x47a518,_0xcdefa2)[_0x4632('0x10')](function(_0xe28f38){logger[_0x4632('0x11')](_0x4632('0x12'),_0x556bbc,'request\x20sent');logger[_0x4632('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x556bbc,_0x4632('0x14'),JSON[_0x4632('0x15')](_0xe28f38));if(_0xe28f38[_0x4632('0x16')]){if(_0xe28f38[_0x4632('0x16')]['code']===0x1f4){logger[_0x4632('0x16')](_0x4632('0x12'),_0x556bbc,_0xe28f38[_0x4632('0x16')][_0x4632('0x17')]);return _0x30a7cf(_0xe28f38[_0x4632('0x16')]['message']);}logger['error'](_0x4632('0x12'),_0x556bbc,_0xe28f38[_0x4632('0x16')][_0x4632('0x17')]);return _0x21999d(_0xe28f38[_0x4632('0x16')]['message']);}else{logger[_0x4632('0x11')](_0x4632('0x12'),_0x556bbc,_0x4632('0x14'));_0x21999d(_0xe28f38['result'][_0x4632('0x17')]);}})[_0x4632('0x18')](function(_0x58e193){logger['error'](_0x4632('0x12'),_0x556bbc,_0x58e193);_0x30a7cf(_0x58e193);});});}exports[_0x4632('0x19')]=function(_0x3bdced){var _0x3e3766=this;return new Promise(function(_0x2d63b1,_0x3d2d23){return db[_0x4632('0x1a')][_0x4632('0x1b')]({'raw':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x1d')]===undefined?!![]:![]:!![],'where':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x1e')]||null:null,'attributes':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x1f')]||null:null,'limit':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x20')]||null:null,'include':_0x3bdced[_0x4632('0x1c')]?_0x3bdced[_0x4632('0x1c')][_0x4632('0x21')]?_[_0x4632('0x22')](_0x3bdced[_0x4632('0x1c')][_0x4632('0x21')],function(_0x4af026){return{'model':db[_0x4af026[_0x4632('0x23')]],'as':_0x4af026['as'],'attributes':_0x4af026[_0x4632('0x1f')],'include':_0x4af026[_0x4632('0x21')]?_[_0x4632('0x22')](_0x4af026[_0x4632('0x21')],function(_0x438354){return{'model':db[_0x438354['model']],'as':_0x438354['as'],'attributes':_0x438354['attributes'],'include':_0x438354[_0x4632('0x21')]?_[_0x4632('0x22')](_0x438354[_0x4632('0x21')],function(_0x35a533){return{'model':db[_0x35a533[_0x4632('0x23')]],'as':_0x35a533['as'],'attributes':_0x35a533[_0x4632('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4632('0x10')](function(_0x5e2ee4){logger[_0x4632('0x11')](_0x4632('0x19'),_0x3bdced);logger['debug'](_0x4632('0x19'),_0x3bdced,JSON['stringify'](_0x5e2ee4));_0x2d63b1(_0x5e2ee4);})[_0x4632('0x18')](function(_0x4cb661){logger['error'](_0x4632('0x19'),_0x4cb661[_0x4632('0x17')],_0x3bdced);_0x3d2d23(_0x3e3766[_0x4632('0x16')](0x1f4,_0x4cb661['message']));});});};exports['ShowMailAccount']=function(_0x395f4e){var _0x7671ab=this;return new Promise(function(_0x596586,_0x4aab76){return db[_0x4632('0x1a')][_0x4632('0x24')]({'raw':_0x395f4e['options']?_0x395f4e[_0x4632('0x1c')][_0x4632('0x1d')]===undefined?!![]:![]:!![],'where':_0x395f4e[_0x4632('0x1c')]?_0x395f4e[_0x4632('0x1c')][_0x4632('0x1e')]||null:null,'attributes':_0x395f4e['options']?_0x395f4e[_0x4632('0x1c')][_0x4632('0x1f')]||null:null,'include':_0x395f4e['options']?_0x395f4e['options'][_0x4632('0x21')]?_['map'](_0x395f4e['options'][_0x4632('0x21')],function(_0x5d34ac){return{'model':db[_0x5d34ac[_0x4632('0x23')]],'as':_0x5d34ac['as'],'attributes':_0x5d34ac[_0x4632('0x1f')],'include':_0x5d34ac[_0x4632('0x21')]?_['map'](_0x5d34ac[_0x4632('0x21')],function(_0xf37b63){return{'model':db[_0xf37b63[_0x4632('0x23')]],'as':_0xf37b63['as'],'attributes':_0xf37b63[_0x4632('0x1f')],'include':_0xf37b63[_0x4632('0x21')]?_['map'](_0xf37b63['include'],function(_0x3114c4){return{'model':db[_0x3114c4[_0x4632('0x23')]],'as':_0x3114c4['as'],'attributes':_0x3114c4[_0x4632('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a3fb4){logger['info'](_0x4632('0x25'),_0x395f4e);logger[_0x4632('0x13')]('ShowMailAccount',_0x395f4e,JSON[_0x4632('0x15')](_0x5a3fb4));_0x596586(_0x5a3fb4);})[_0x4632('0x18')](function(_0x40452e){logger[_0x4632('0x16')](_0x4632('0x25'),_0x40452e[_0x4632('0x17')],_0x395f4e);_0x4aab76(_0x7671ab[_0x4632('0x16')](0x1f4,_0x40452e[_0x4632('0x17')]));});});};exports[_0x4632('0x26')]=function(_0x2c04a8){var _0x1fd3f1=this;return new Promise(function(_0x3b6258,_0x47f206){var _0x1c1418={'body':_0x2c04a8[_0x4632('0x27')],'channel':'mail'};var _0x19fdd0=_[_0x4632('0x28')](_['keys'](db[_0x4632('0x29')]['rawAttributes']),[_0x4632('0x2a'),_0x4632('0x2b'),_0x4632('0x2c'),_0x4632('0x2d')]);var _0x5b630a=![];if(_0x2c04a8[_0x4632('0x27')]['id']){delete _0x2c04a8[_0x4632('0x27')]['id'];}if(_[_0x4632('0x2e')](_0x2c04a8[_0x4632('0x27')]['from'])){return _0x47f206(_0x1fd3f1['error'](0x1f4,_0x4632('0x2f')));}if(_[_0x4632('0x2e')](_0x2c04a8[_0x4632('0x27')]['body'])||_0x2c04a8[_0x4632('0x27')][_0x4632('0x27')]===''){return _0x47f206(_0x1fd3f1[_0x4632('0x16')](0x1f4,_0x4632('0x30')));}if(_[_0x4632('0x2e')](_0x2c04a8[_0x4632('0x27')][_0x4632('0x31')])){return _0x47f206(_0x1fd3f1['error'](0x1f4,_0x4632('0x32')+_0x19fdd0));}if(!_[_0x4632('0x33')](_0x19fdd0,_0x2c04a8[_0x4632('0x27')][_0x4632('0x31')])){return _0x47f206(_0x1fd3f1[_0x4632('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x19fdd0));}var _0x579ed2={};_0x579ed2[_0x2c04a8[_0x4632('0x27')][_0x4632('0x31')]]=_0x2c04a8[_0x4632('0x27')][_0x4632('0x34')];return db['MailAccount'][_0x4632('0x24')]({'where':{'id':_0x2c04a8[_0x4632('0x35')]['id']},'include':[{'model':db[_0x4632('0x36')],'as':_0x4632('0x37'),'include':[{'model':db[_0x4632('0x29')],'as':'Contacts','where':_0x579ed2,'limit':0x1,'order':[[_0x4632('0x2b'),_0x4632('0x38')]]}]},{'model':db[_0x4632('0x39')],'as':_0x4632('0x3a')},{'model':db[_0x4632('0x3b')],'as':_0x4632('0x3c')}]})[_0x4632('0x10')](function(_0x1f02d5){if(_0x1f02d5&&_0x1f02d5[_0x4632('0x37')]){var _0x225bd2=_0x1f02d5[_0x4632('0x3d')]({'plain':!![]});_0x1c1418['account']=_[_0x4632('0x3e')](_0x225bd2,[_0x4632('0x3a'),_0x4632('0x37')]);_0x1c1418['applications']=_0x225bd2[_0x4632('0x3a')];_0x1c1418[_0x4632('0x3f')]=_0x225bd2[_0x4632('0x37')];_0x1c1418[_0x4632('0x40')]=_[_0x4632('0x41')](_0x1c1418[_0x4632('0x40')],[_0x4632('0x42')],[_0x4632('0x43')]);if(_0x1c1418[_0x4632('0x35')]&&_0x1c1418[_0x4632('0x35')]['autoclose']){_0x1c1418[_0x4632('0x40')][_0x4632('0x44')]({'id':0x0,'priority':_0x1c1418['applications'][_0x4632('0x45')]+0x1,'app':_0x4632('0x46'),'appdata':_0x4632('0x47'),'interval':_0x4632('0x48')});}if(_0x1c1418[_0x4632('0x35')][_0x4632('0x3a')]){delete _0x1c1418[_0x4632('0x35')][_0x4632('0x3a')];}if(_0x1c1418[_0x4632('0x35')][_0x4632('0x37')]){delete _0x1c1418[_0x4632('0x35')][_0x4632('0x37')];}if(_0x225bd2[_0x4632('0x37')][_0x4632('0x49')][_0x4632('0x45')]){return _0x225bd2[_0x4632('0x37')][_0x4632('0x49')][0x0];}var _0x6c2864=_[_0x4632('0x4a')](_0x2c04a8[_0x4632('0x27')],{'firstName':_0x2c04a8['body'][_0x4632('0x34')],'ListId':_0x225bd2[_0x4632('0x2d')]});_0x6c2864[_0x2c04a8[_0x4632('0x27')][_0x4632('0x31')]]=_0x2c04a8[_0x4632('0x27')][_0x4632('0x34')];return db['CmContact'][_0x4632('0x4b')](_0x6c2864);}else{throw new Error(_0x4632('0x4c'));}})[_0x4632('0x10')](function(_0x5877b9){_0x1c1418[_0x4632('0x4d')]=_0x5877b9;if(_0x5877b9){if(!_0x2c04a8[_0x4632('0x27')]['message'][_0x4632('0x4e')]){_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['messageId']=rs[_0x4632('0x4f')]()+'\x20'+_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x34')];}var _0x3e0811={'ContactId':_0x5877b9['id'],'MailAccountId':_0x2c04a8[_0x4632('0x35')]['id'],'inReplyTo':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x4e')],'to':_0x2c04a8[_0x4632('0x27')]['message'][_0x4632('0x34')],'cc':_0x2c04a8[_0x4632('0x27')]['message']['cc'],'subject':_0x2c04a8[_0x4632('0x27')]['message']['subject'],'attach':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x50')],'lastMsgAt':moment()[_0x4632('0x51')](_0x4632('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x2c04a8[_0x4632('0x27')][_0x4632('0x27')]};return db[_0x4632('0x53')][_0x4632('0x24')]({'where':{'closed':![],'MailAccountId':_0x2c04a8[_0x4632('0x35')]['id']},'include':[{'model':db[_0x4632('0x54')],'as':_0x4632('0x55'),'attributes':[_0x4632('0x4e')],'where':{'messageId':_0x2c04a8[_0x4632('0x27')]['message']['inReplyTo']}}]})[_0x4632('0x10')](function(_0x313dcd){if(_0x313dcd){return[_0x313dcd,![]];}return db[_0x4632('0x53')][_0x4632('0x4b')](_0x3e0811)[_0x4632('0x10')](function(_0x29321c){return[_0x29321c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4632('0x56')](function(_0x211c9d,_0x4217ea){if(_0x211c9d){_0x5b630a=_0x4217ea;if(!_0x4217ea){return _0x211c9d[_0x4632('0x57')]({'inReplyTo':_0x2c04a8['body']['message'][_0x4632('0x4e')],'to':_0x2c04a8['body'][_0x4632('0x17')][_0x4632('0x34')],'cc':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['cc'],'subject':_0x2c04a8[_0x4632('0x27')]['message'][_0x4632('0x58')],'attach':_0x211c9d[_0x4632('0x50')]?_0x211c9d['attach']:_0x2c04a8['body'][_0x4632('0x17')][_0x4632('0x50')],'substatus':null,'substatusAt':moment()[_0x4632('0x51')](_0x4632('0x52')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x2c04a8['body'][_0x4632('0x27')]});}else{return _0x211c9d;}}})['then'](function(_0x3af9ec){_0x1c1418[_0x4632('0x59')]=_0x3af9ec[_0x4632('0x3d')]({'plain':!![]});_0x1c1418[_0x4632('0x59')][_0x4632('0x5a')]=_0x5b630a;return db[_0x4632('0x54')][_0x4632('0x4b')]({'body':_0x2c04a8[_0x4632('0x27')][_0x4632('0x27')],'MailAccountId':_0x2c04a8[_0x4632('0x35')]['id'],'MailInteractionId':_0x3af9ec['id'],'direction':'in','ContactId':_0x1c1418[_0x4632('0x4d')]['id'],'messageId':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x4e')],'from':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['from'],'to':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['to'],'cc':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')]['cc'],'subject':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x58')],'attach':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x50')],'Attachments':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x5b')],'originTo':_0x2c04a8['body'][_0x4632('0x17')][_0x4632('0x5c')],'originCc':_0x2c04a8[_0x4632('0x27')][_0x4632('0x17')][_0x4632('0x5d')],'bcc':_0x2c04a8[_0x4632('0x27')]['message'][_0x4632('0x5e')]},{'include':[{'model':db[_0x4632('0x5f')],'as':'Attachments'}]});})[_0x4632('0x10')](function(_0x458688){_0x1c1418[_0x4632('0x17')]=_0x458688;if(_0x1c1418[_0x4632('0x59')][_0x4632('0x60')]){return db['User'][_0x4632('0x24')]({'attributes':['id',_0x4632('0x61')],'where':{'id':_0x1c1418[_0x4632('0x59')]['UserId']}})[_0x4632('0x10')](function(_0x400a95){if(_0x400a95){_0x1c1418[_0x4632('0x40')][_0x4632('0x62')]({'id':0x0,'priority':0x0,'app':_0x4632('0x63'),'appdata':_0x400a95[_0x4632('0x61')]+','+(_0x1c1418[_0x4632('0x35')][_0x4632('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4632('0x65'),_0x4632('0x66'),_0x1c1418);});}return respondWithRpcPromise(_0x4632('0x65'),'startRouting',_0x1c1418);})[_0x4632('0x10')](function(_0x2cadac){_0x3b6258(_0x2cadac);})['catch'](function(_0x4a4ae2){_0x47f206(_0x1fd3f1[_0x4632('0x16')](0x1f4,_0x4a4ae2[_0x4632('0x17')]));});});}; \ No newline at end of file +var _0x4058=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','request','then','debug','code','error','message','MailAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','find','where','ShowMailAccount','body','mail','difference','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','MailApplication','Applications','MailServerOut','get','account','omit','applications','list','orderBy','asc','autoclose','push','length','create','List\x20not\x20found','messageId','generate','subject','attach','MailInteraction','Messages','inReplyTo','spread','update','YYYY-MM-DD\x20HH:mm:ss','format','interaction','created','MailMessage','attachments','originCc','bcc','Attachment','Attachments','UserId','User','unshift','agent','name','*,*,*,*','Start','startRouting'];(function(_0x4d471b,_0x281167){var _0x54fd9b=function(_0x4d85b0){while(--_0x4d85b0){_0x4d471b['push'](_0x4d471b['shift']());}};_0x54fd9b(++_0x281167);}(_0x4058,0x129));var _0x8405=function(_0x52864c,_0x51caad){_0x52864c=_0x52864c-0x0;var _0x3d3fcd=_0x4058[_0x52864c];return _0x3d3fcd;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232c});config[_0x8405('0xb')]=_[_0x8405('0xc')](config[_0x8405('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8405('0xd'))(new Redis(config[_0x8405('0xb')]));require(_0x8405('0xe'))['register'](socket);function respondWithRpcPromise(_0x30705f,_0x5e132b,_0x6979fd){return new BPromise(function(_0xb442,_0x50344e){return client[_0x8405('0xf')](_0x30705f,_0x6979fd)[_0x8405('0x10')](function(_0x5b94d5){logger['info']('MailAccount,\x20%s,\x20%s',_0x5e132b,'request\x20sent');logger[_0x8405('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5e132b,'request\x20sent',JSON['stringify'](_0x5b94d5));if(_0x5b94d5['error']){if(_0x5b94d5['error'][_0x8405('0x12')]===0x1f4){logger[_0x8405('0x13')]('MailAccount,\x20%s,\x20%s',_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0x50344e(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}logger['error'](_0x8405('0x15'),_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0xb442(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}else{logger[_0x8405('0x16')](_0x8405('0x15'),_0x5e132b,_0x8405('0x17'));_0xb442(_0x5b94d5[_0x8405('0x18')][_0x8405('0x14')]);}})[_0x8405('0x19')](function(_0x21376d){logger[_0x8405('0x13')](_0x8405('0x15'),_0x5e132b,_0x21376d);_0x50344e(_0x21376d);});});}exports[_0x8405('0x1a')]=function(_0x42c191){var _0x2902d9=this;return new Promise(function(_0x14bc3e,_0x2483ab){return db[_0x8405('0x1b')][_0x8405('0x1c')]({'raw':_0x42c191[_0x8405('0x1d')]?_0x42c191[_0x8405('0x1d')][_0x8405('0x1e')]===undefined?!![]:![]:!![],'where':_0x42c191[_0x8405('0x1d')]?_0x42c191[_0x8405('0x1d')]['where']||null:null,'attributes':_0x42c191['options']?_0x42c191[_0x8405('0x1d')][_0x8405('0x1f')]||null:null,'limit':_0x42c191[_0x8405('0x1d')]?_0x42c191['options'][_0x8405('0x20')]||null:null,'include':_0x42c191['options']?_0x42c191[_0x8405('0x1d')]['include']?_[_0x8405('0x21')](_0x42c191[_0x8405('0x1d')][_0x8405('0x22')],function(_0x4450eb){return{'model':db[_0x4450eb[_0x8405('0x23')]],'as':_0x4450eb['as'],'attributes':_0x4450eb[_0x8405('0x1f')],'include':_0x4450eb[_0x8405('0x22')]?_[_0x8405('0x21')](_0x4450eb[_0x8405('0x22')],function(_0x24b88d){return{'model':db[_0x24b88d[_0x8405('0x23')]],'as':_0x24b88d['as'],'attributes':_0x24b88d[_0x8405('0x1f')],'include':_0x24b88d['include']?_[_0x8405('0x21')](_0x24b88d['include'],function(_0x48a425){return{'model':db[_0x48a425[_0x8405('0x23')]],'as':_0x48a425['as'],'attributes':_0x48a425[_0x8405('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8405('0x10')](function(_0x26d5ec){logger[_0x8405('0x16')](_0x8405('0x1a'),_0x42c191);logger[_0x8405('0x11')](_0x8405('0x1a'),_0x42c191,JSON[_0x8405('0x24')](_0x26d5ec));_0x14bc3e(_0x26d5ec);})[_0x8405('0x19')](function(_0x20bca3){logger[_0x8405('0x13')](_0x8405('0x1a'),_0x20bca3['message'],_0x42c191);_0x2483ab(_0x2902d9[_0x8405('0x13')](0x1f4,_0x20bca3[_0x8405('0x14')]));});});};exports['ShowMailAccount']=function(_0x3c12e3){var _0x17c589=this;return new Promise(function(_0x1bcfa5,_0x5c50f9){return db[_0x8405('0x1b')][_0x8405('0x25')]({'raw':_0x3c12e3[_0x8405('0x1d')]?_0x3c12e3['options'][_0x8405('0x1e')]===undefined?!![]:![]:!![],'where':_0x3c12e3[_0x8405('0x1d')]?_0x3c12e3['options'][_0x8405('0x26')]||null:null,'attributes':_0x3c12e3['options']?_0x3c12e3[_0x8405('0x1d')][_0x8405('0x1f')]||null:null,'include':_0x3c12e3[_0x8405('0x1d')]?_0x3c12e3[_0x8405('0x1d')][_0x8405('0x22')]?_[_0x8405('0x21')](_0x3c12e3[_0x8405('0x1d')][_0x8405('0x22')],function(_0x1ae1c4){return{'model':db[_0x1ae1c4[_0x8405('0x23')]],'as':_0x1ae1c4['as'],'attributes':_0x1ae1c4[_0x8405('0x1f')],'include':_0x1ae1c4[_0x8405('0x22')]?_['map'](_0x1ae1c4[_0x8405('0x22')],function(_0x4c174c){return{'model':db[_0x4c174c['model']],'as':_0x4c174c['as'],'attributes':_0x4c174c[_0x8405('0x1f')],'include':_0x4c174c[_0x8405('0x22')]?_['map'](_0x4c174c[_0x8405('0x22')],function(_0x4349d2){return{'model':db[_0x4349d2[_0x8405('0x23')]],'as':_0x4349d2['as'],'attributes':_0x4349d2[_0x8405('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8405('0x10')](function(_0x565324){logger[_0x8405('0x16')](_0x8405('0x27'),_0x3c12e3);logger[_0x8405('0x11')](_0x8405('0x27'),_0x3c12e3,JSON[_0x8405('0x24')](_0x565324));_0x1bcfa5(_0x565324);})['catch'](function(_0x349143){logger[_0x8405('0x13')](_0x8405('0x27'),_0x349143[_0x8405('0x14')],_0x3c12e3);_0x5c50f9(_0x17c589[_0x8405('0x13')](0x1f4,_0x349143[_0x8405('0x14')]));});});};exports['NotifyMailAccount']=function(_0xfe699c){var _0x37ea80=this;return new Promise(function(_0x23e559,_0x1df6a6){var _0x27ce36={'body':_0xfe699c[_0x8405('0x28')],'channel':_0x8405('0x29')};var _0x4f3692=_[_0x8405('0x2a')](_['keys'](db[_0x8405('0x2b')][_0x8405('0x2c')]),['createdAt',_0x8405('0x2d'),_0x8405('0x2e'),_0x8405('0x2f')]);var _0xaf6465=![];if(_0xfe699c[_0x8405('0x28')]['id']){delete _0xfe699c[_0x8405('0x28')]['id'];}if(_[_0x8405('0x30')](_0xfe699c[_0x8405('0x28')][_0x8405('0x31')])){return _0x1df6a6(_0x37ea80[_0x8405('0x13')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0xfe699c[_0x8405('0x28')]['body'])||_0xfe699c[_0x8405('0x28')][_0x8405('0x28')]===''){return _0x1df6a6(_0x37ea80[_0x8405('0x13')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8405('0x30')](_0xfe699c[_0x8405('0x28')]['mapKey'])){return _0x1df6a6(_0x37ea80[_0x8405('0x13')](0x1f4,_0x8405('0x32')+_0x4f3692));}if(!_[_0x8405('0x33')](_0x4f3692,_0xfe699c[_0x8405('0x28')][_0x8405('0x34')])){return _0x1df6a6(_0x37ea80[_0x8405('0x13')](0x1f4,_0x8405('0x35')+_0x4f3692));}var _0x4fec13={};_0x4fec13[_0xfe699c['body']['mapKey']]=_0xfe699c[_0x8405('0x28')][_0x8405('0x31')];return db[_0x8405('0x1b')][_0x8405('0x25')]({'where':{'id':_0xfe699c['account']['id']},'include':[{'model':db['CmList'],'as':_0x8405('0x36'),'include':[{'model':db[_0x8405('0x2b')],'as':_0x8405('0x37'),'where':_0x4fec13,'limit':0x1,'order':[[_0x8405('0x2d'),_0x8405('0x38')]]}]},{'model':db[_0x8405('0x39')],'as':_0x8405('0x3a')},{'model':db[_0x8405('0x3b')],'as':'Smtp'}]})[_0x8405('0x10')](function(_0x4e9c9e){if(_0x4e9c9e&&_0x4e9c9e[_0x8405('0x36')]){var _0xe34167=_0x4e9c9e[_0x8405('0x3c')]({'plain':!![]});_0x27ce36[_0x8405('0x3d')]=_[_0x8405('0x3e')](_0xe34167,[_0x8405('0x3a'),_0x8405('0x36')]);_0x27ce36[_0x8405('0x3f')]=_0xe34167['Applications'];_0x27ce36[_0x8405('0x40')]=_0xe34167[_0x8405('0x36')];_0x27ce36[_0x8405('0x3f')]=_[_0x8405('0x41')](_0x27ce36['applications'],['priority'],[_0x8405('0x42')]);if(_0x27ce36[_0x8405('0x3d')]&&_0x27ce36[_0x8405('0x3d')][_0x8405('0x43')]){_0x27ce36[_0x8405('0x3f')][_0x8405('0x44')]({'id':0x0,'priority':_0x27ce36[_0x8405('0x3f')]['length']+0x1,'app':'close','appdata':_0x8405('0x43'),'interval':'*,*,*,*'});}if(_0x27ce36[_0x8405('0x3d')][_0x8405('0x3a')]){delete _0x27ce36[_0x8405('0x3d')]['Applications'];}if(_0x27ce36['account'][_0x8405('0x36')]){delete _0x27ce36['account'][_0x8405('0x36')];}if(_0xe34167[_0x8405('0x36')][_0x8405('0x37')][_0x8405('0x45')]){return _0xe34167[_0x8405('0x36')][_0x8405('0x37')][0x0];}var _0x1f720c=_[_0x8405('0xc')](_0xfe699c[_0x8405('0x28')],{'firstName':_0xfe699c['body'][_0x8405('0x31')],'ListId':_0xe34167[_0x8405('0x2f')]});_0x1f720c[_0xfe699c[_0x8405('0x28')][_0x8405('0x34')]]=_0xfe699c['body'][_0x8405('0x31')];return db[_0x8405('0x2b')][_0x8405('0x46')](_0x1f720c);}else{throw new Error(_0x8405('0x47'));}})[_0x8405('0x10')](function(_0x3ce3ff){_0x27ce36['contact']=_0x3ce3ff;if(_0x3ce3ff){if(!_0xfe699c[_0x8405('0x28')][_0x8405('0x14')][_0x8405('0x48')]){_0xfe699c['body'][_0x8405('0x14')][_0x8405('0x48')]=rs[_0x8405('0x49')]()+'\x20'+_0xfe699c[_0x8405('0x28')][_0x8405('0x14')][_0x8405('0x31')];}var _0x283dcb={'ContactId':_0x3ce3ff['id'],'MailAccountId':_0xfe699c[_0x8405('0x3d')]['id'],'inReplyTo':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')]['messageId'],'to':_0xfe699c[_0x8405('0x28')]['message'][_0x8405('0x31')],'cc':_0xfe699c['body'][_0x8405('0x14')]['cc'],'subject':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')][_0x8405('0x4a')],'attach':_0xfe699c[_0x8405('0x28')]['message'][_0x8405('0x4b')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0xfe699c[_0x8405('0x28')]['body']};return db[_0x8405('0x4c')][_0x8405('0x25')]({'where':{'closed':![],'MailAccountId':_0xfe699c[_0x8405('0x3d')]['id']},'include':[{'model':db['MailMessage'],'as':_0x8405('0x4d'),'attributes':[_0x8405('0x48')],'where':{'messageId':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')][_0x8405('0x4e')]}}]})[_0x8405('0x10')](function(_0x485af5){if(_0x485af5){return[_0x485af5,![]];}return db[_0x8405('0x4c')][_0x8405('0x46')](_0x283dcb)[_0x8405('0x10')](function(_0x539969){return[_0x539969,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8405('0x4f')](function(_0x408e39,_0x13d60f){if(_0x408e39){_0xaf6465=_0x13d60f;if(!_0x13d60f){return _0x408e39[_0x8405('0x50')]({'inReplyTo':_0xfe699c[_0x8405('0x28')]['message']['messageId'],'to':_0xfe699c['body'][_0x8405('0x14')][_0x8405('0x31')],'cc':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')]['cc'],'subject':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')][_0x8405('0x4a')],'attach':_0x408e39[_0x8405('0x4b')]?_0x408e39[_0x8405('0x4b')]:_0xfe699c[_0x8405('0x28')][_0x8405('0x14')][_0x8405('0x4b')],'substatus':null,'substatusAt':moment()['format'](_0x8405('0x51')),'lastMsgAt':moment()[_0x8405('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0xfe699c[_0x8405('0x28')][_0x8405('0x28')]});}else{return _0x408e39;}}})[_0x8405('0x10')](function(_0x3fd943){_0x27ce36[_0x8405('0x53')]=_0x3fd943[_0x8405('0x3c')]({'plain':!![]});_0x27ce36[_0x8405('0x53')][_0x8405('0x54')]=_0xaf6465;return db[_0x8405('0x55')]['create']({'body':_0xfe699c[_0x8405('0x28')][_0x8405('0x28')],'MailAccountId':_0xfe699c[_0x8405('0x3d')]['id'],'MailInteractionId':_0x3fd943['id'],'direction':'in','ContactId':_0x27ce36['contact']['id'],'messageId':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')][_0x8405('0x48')],'from':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')]['from'],'to':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')]['to'],'cc':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')]['cc'],'subject':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')][_0x8405('0x4a')],'attach':_0xfe699c[_0x8405('0x28')][_0x8405('0x14')]['attach'],'Attachments':_0xfe699c[_0x8405('0x28')]['message'][_0x8405('0x56')],'originTo':_0xfe699c[_0x8405('0x28')]['message']['originTo'],'originCc':_0xfe699c['body']['message'][_0x8405('0x57')],'bcc':_0xfe699c['body'][_0x8405('0x14')][_0x8405('0x58')]},{'include':[{'model':db[_0x8405('0x59')],'as':_0x8405('0x5a')}]});})[_0x8405('0x10')](function(_0x22d5ef){_0x27ce36[_0x8405('0x14')]=_0x22d5ef;if(_0x27ce36['interaction'][_0x8405('0x5b')]){return db[_0x8405('0x5c')]['find']({'attributes':['id','name'],'where':{'id':_0x27ce36['interaction']['UserId']}})['then'](function(_0x506456){if(_0x506456){_0x27ce36[_0x8405('0x3f')][_0x8405('0x5d')]({'id':0x0,'priority':0x0,'app':_0x8405('0x5e'),'appdata':_0x506456[_0x8405('0x5f')]+','+(_0x27ce36[_0x8405('0x3d')]['waitForTheAssignedAgent']||0xa),'interval':_0x8405('0x60')});}return respondWithRpcPromise(_0x8405('0x61'),_0x8405('0x62'),_0x27ce36);});}return respondWithRpcPromise(_0x8405('0x61'),_0x8405('0x62'),_0x27ce36);})['then'](function(_0x2e648d){_0x23e559(_0x2e648d);})[_0x8405('0x19')](function(_0xaf9bf){_0x1df6a6(_0x37ea80[_0x8405('0x13')](0x1f4,_0xaf9bf[_0x8405('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 0be4400..7d32d14 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 _0x5697=['remove','update','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x5697,0x1b5));var _0x7569=function(_0x4dc0c8,_0x48d51f){_0x4dc0c8=_0x4dc0c8-0x0;var _0x26bf81=_0x5697[_0x4dc0c8];return _0x26bf81;};'use strict';var MailAccountEvents=require(_0x7569('0x0'));var events=['save',_0x7569('0x1'),_0x7569('0x2')];function createListener(_0x14218a,_0x5c6bbc){return function(_0x5a06a6){_0x5c6bbc['emit'](_0x14218a,_0x5a06a6);};}function removeListener(_0x499e06,_0x48340f){return function(){MailAccountEvents[_0x7569('0x3')](_0x499e06,_0x48340f);};}exports['register']=function(_0x5705bd){for(var _0x5afe12=0x0,_0x149fa1=events[_0x7569('0x4')];_0x5afe12<_0x149fa1;_0x5afe12++){var _0x30b7e2=events[_0x5afe12];var _0xee5a4=createListener(_0x7569('0x5')+_0x30b7e2,_0x5705bd);MailAccountEvents['on'](_0x30b7e2,_0xee5a4);}}; \ No newline at end of file +var _0x96f1=['emit','removeListener','register','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x40ce76,_0x3a1c50){var _0x3fa6ec=function(_0x31cad0){while(--_0x31cad0){_0x40ce76['push'](_0x40ce76['shift']());}};_0x3fa6ec(++_0x3a1c50);}(_0x96f1,0x19c));var _0x196f=function(_0x419f9a,_0x35ae89){_0x419f9a=_0x419f9a-0x0;var _0x25ba8f=_0x96f1[_0x419f9a];return _0x25ba8f;};'use strict';var MailAccountEvents=require(_0x196f('0x0'));var events=[_0x196f('0x1'),_0x196f('0x2'),_0x196f('0x3')];function createListener(_0x227254,_0x219e87){return function(_0xe61e26){_0x219e87[_0x196f('0x4')](_0x227254,_0xe61e26);};}function removeListener(_0x5b8eb5,_0x56fc61){return function(){MailAccountEvents[_0x196f('0x5')](_0x5b8eb5,_0x56fc61);};}exports[_0x196f('0x6')]=function(_0x267906){for(var _0x1f401c=0x0,_0x17f603=events['length'];_0x1f401c<_0x17f603;_0x1f401c++){var _0x427333=events[_0x1f401c];var _0x425e5c=createListener(_0x196f('0x7')+_0x427333,_0x267906);MailAccountEvents['on'](_0x427333,_0x425e5c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 855cac1..da2af4a 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 _0xf45e=['put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x2b03ff,_0x4fcd84){var _0xa7d7a=function(_0x1bb2ca){while(--_0x1bb2ca){_0x2b03ff['push'](_0x2b03ff['shift']());}};_0xa7d7a(++_0x4fcd84);}(_0xf45e,0x115));var _0xef45=function(_0x20e84a,_0x495a8a){_0x20e84a=_0x20e84a-0x0;var _0x231de1=_0xf45e[_0x20e84a];return _0x231de1;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var auth=require(_0xef45('0x4'));var interaction=require(_0xef45('0x5'));var config=require(_0xef45('0x6'));var controller=require(_0xef45('0x7'));router[_0xef45('0x8')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0xc')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0xe')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);module[_0xef45('0x10')]=router; \ No newline at end of file +var _0xb49a=['express','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xb49a,0xfb));var _0xab49=function(_0x294a77,_0x8a359d){_0x294a77=_0x294a77-0x0;var _0x17db6d=_0xb49a[_0x294a77];return _0x17db6d;};'use strict';var multer=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var path=require(_0xab49('0x2'));var timeout=require(_0xab49('0x3'));var express=require(_0xab49('0x4'));var router=express['Router']();var auth=require(_0xab49('0x5'));var interaction=require(_0xab49('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xab49('0x7')](_0xab49('0x8'),auth[_0xab49('0x9')](),controller[_0xab49('0xa')]);router[_0xab49('0xb')](_0xab49('0x8'),auth[_0xab49('0x9')](),controller['update']);router[_0xab49('0xc')](_0xab49('0x8'),auth[_0xab49('0x9')](),controller[_0xab49('0xd')]);module[_0xab49('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 404a551..70f2d19 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 _0x0b69=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x41c28f,_0x168c22){var _0xa6f925=function(_0x54ca66){while(--_0x54ca66){_0x41c28f['push'](_0x41c28f['shift']());}};_0xa6f925(++_0x168c22);}(_0x0b69,0x1d2));var _0x90b6=function(_0x28b3c8,_0x499ca8){_0x28b3c8=_0x28b3c8-0x0;var _0x1f6322=_0x0b69[_0x28b3c8];return _0x1f6322;};'use strict';var Sequelize=require(_0x90b6('0x0'));module[_0x90b6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x90b6('0x2')],'allowNull':![],'defaultValue':_0x90b6('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x90b6('0x4')}}; \ No newline at end of file +var _0xcafc=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xcafc,0x69));var _0xccaf=function(_0x7d5f94,_0x5ea962){_0x7d5f94=_0x7d5f94-0x0;var _0x444a11=_0xcafc[_0x7d5f94];return _0x444a11;};'use strict';var Sequelize=require(_0xccaf('0x0'));module[_0xccaf('0x1')]={'priority':{'type':Sequelize[_0xccaf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xccaf('0x3')],'allowNull':![],'defaultValue':_0xccaf('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xccaf('0x3')],'defaultValue':_0xccaf('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 026fdf0..186429e 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 _0x8435=['model','MailApplication','rawAttributes','query','keys','filters','fields','length','attributes','merge','options','catch','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','show','params'];(function(_0x4608ac,_0x340cd9){var _0x318daa=function(_0x58c895){while(--_0x58c895){_0x4608ac['push'](_0x4608ac['shift']());}};_0x318daa(++_0x340cd9);}(_0x8435,0xf6));var _0x5843=function(_0x522416,_0x11b844){_0x522416=_0x522416-0x0;var _0x3ff1ba=_0x8435[_0x522416];return _0x3ff1ba;};'use strict';var pdf=require(_0x5843('0x0'));var emlformat=require(_0x5843('0x1'));var rimraf=require(_0x5843('0x2'));var zipdir=require(_0x5843('0x3'));var jsonpatch=require(_0x5843('0x4'));var rp=require(_0x5843('0x5'));var moment=require(_0x5843('0x6'));var BPromise=require(_0x5843('0x7'));var Mustache=require(_0x5843('0x8'));var util=require(_0x5843('0x9'));var path=require(_0x5843('0xa'));var sox=require(_0x5843('0xb'));var csv=require(_0x5843('0xc'));var ejs=require(_0x5843('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5843('0xe'));var crypto=require('crypto');var jsforce=require(_0x5843('0xf'));var deskjs=require(_0x5843('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5843('0x11'));var Papa=require(_0x5843('0x12'));var Redis=require(_0x5843('0x13'));var authService=require(_0x5843('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5843('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5843('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5843('0x17'));var db=require(_0x5843('0x18'))['db'];function respondWithStatusCode(_0x448a90,_0x19372a){_0x19372a=_0x19372a||0xcc;return function(_0x411586){if(_0x411586){return _0x448a90['sendStatus'](_0x19372a);}return _0x448a90[_0x5843('0x19')](_0x19372a)[_0x5843('0x1a')]();};}function respondWithResult(_0x25397a,_0x404c0a){_0x404c0a=_0x404c0a||0xc8;return function(_0x9587db){if(_0x9587db){return _0x25397a['status'](_0x404c0a)['json'](_0x9587db);}};}function respondWithFilteredResult(_0x53e0a8,_0x47e933){return function(_0x1b010c){if(_0x1b010c){var _0x7c7e59=_0x1b010c['count'],_0x14497a=_0x47e933[_0x5843('0x1b')],_0x464d6a=_0x47e933[_0x5843('0x1b')]+_0x47e933[_0x5843('0x1c')],_0x9376a7;if(_0x464d6a>=_0x7c7e59){_0x464d6a=_0x7c7e59;_0x9376a7=0xc8;}else{_0x9376a7=0xce;}_0x53e0a8['status'](_0x9376a7);return _0x53e0a8[_0x5843('0x1d')](_0x5843('0x1e'),_0x14497a+'-'+_0x464d6a+'/'+_0x7c7e59)[_0x5843('0x1f')](_0x1b010c);}return null;};}function patchUpdates(_0x3eca12){return function(_0x1625c7){try{jsonpatch[_0x5843('0x20')](_0x1625c7,_0x3eca12,!![]);}catch(_0x1b8006){return BPromise[_0x5843('0x21')](_0x1b8006);}return _0x1625c7[_0x5843('0x22')]();};}function saveUpdates(_0x5c0391,_0x21f0eb){return function(_0x1133fd){if(_0x1133fd){return _0x1133fd[_0x5843('0x23')](_0x5c0391)[_0x5843('0x24')](function(_0x3469fb){return _0x3469fb;});}return null;};}function removeEntity(_0x31f5ce,_0x54af41){return function(_0x5075f7){if(_0x5075f7){return _0x5075f7[_0x5843('0x25')]()[_0x5843('0x24')](function(){_0x31f5ce[_0x5843('0x19')](0xcc)[_0x5843('0x1a')]();});}};}function handleEntityNotFound(_0x56fb14,_0x188e90){return function(_0x243d40){if(!_0x243d40){_0x56fb14[_0x5843('0x26')](0x194);}return _0x243d40;};}function handleError(_0x1c078b,_0x509822){_0x509822=_0x509822||0x1f4;return function(_0x125e1b){logger['error'](_0x125e1b[_0x5843('0x27')]);if(_0x125e1b[_0x5843('0x28')]){delete _0x125e1b[_0x5843('0x28')];}_0x1c078b[_0x5843('0x19')](_0x509822)[_0x5843('0x29')](_0x125e1b);};}exports[_0x5843('0x2a')]=function(_0x2bfb73,_0x9ca66c){var _0x16814d={'raw':!![],'where':{'id':_0x2bfb73[_0x5843('0x2b')]['id']}},_0x23478a={};_0x23478a[_0x5843('0x2c')]=_['keys'](db[_0x5843('0x2d')][_0x5843('0x2e')]);_0x23478a[_0x5843('0x2f')]=_[_0x5843('0x30')](_0x2bfb73[_0x5843('0x2f')]);_0x23478a[_0x5843('0x31')]=_['intersection'](_0x23478a[_0x5843('0x2c')],_0x23478a[_0x5843('0x2f')]);_0x16814d['attributes']=_['intersection'](_0x23478a[_0x5843('0x2c')],qs[_0x5843('0x32')](_0x2bfb73[_0x5843('0x2f')][_0x5843('0x32')]));_0x16814d['attributes']=_0x16814d['attributes'][_0x5843('0x33')]?_0x16814d[_0x5843('0x34')]:_0x23478a['model'];if(_0x2bfb73[_0x5843('0x2f')]['includeAll']){_0x16814d['include']=[{'all':!![]}];}_0x16814d=_[_0x5843('0x35')]({},_0x16814d,_0x2bfb73[_0x5843('0x36')]);return db['MailApplication']['find'](_0x16814d)[_0x5843('0x24')](handleEntityNotFound(_0x9ca66c,null))[_0x5843('0x24')](respondWithResult(_0x9ca66c,null))[_0x5843('0x37')](handleError(_0x9ca66c,null));};exports[_0x5843('0x23')]=function(_0x295bf3,_0x46603f){if(_0x295bf3['body']['id']){delete _0x295bf3['body']['id'];}return db[_0x5843('0x2d')][_0x5843('0x38')]({'where':{'id':_0x295bf3[_0x5843('0x2b')]['id']}})[_0x5843('0x24')](handleEntityNotFound(_0x46603f,null))['then'](saveUpdates(_0x295bf3[_0x5843('0x39')],null))['then'](respondWithResult(_0x46603f,null))[_0x5843('0x37')](handleError(_0x46603f,null));};exports[_0x5843('0x25')]=function(_0x53d945,_0x429c9b){return db[_0x5843('0x2d')][_0x5843('0x38')]({'where':{'id':_0x53d945[_0x5843('0x2b')]['id']}})[_0x5843('0x24')](handleEntityNotFound(_0x429c9b,null))[_0x5843('0x24')](removeEntity(_0x429c9b,null))[_0x5843('0x37')](handleError(_0x429c9b,null));}; \ No newline at end of file +var _0x5f6b=['save','then','destroy','stack','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','merge','options','find','catch','body','params','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply'];(function(_0x4c3ece,_0x57053e){var _0x409c1d=function(_0x411a3b){while(--_0x411a3b){_0x4c3ece['push'](_0x4c3ece['shift']());}};_0x409c1d(++_0x57053e);}(_0x5f6b,0x81));var _0xb5f6=function(_0x1cbcf2,_0xffa353){_0x1cbcf2=_0x1cbcf2-0x0;var _0x2ce899=_0x5f6b[_0x1cbcf2];return _0x2ce899;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb5f6('0x0'));var zipdir=require(_0xb5f6('0x1'));var jsonpatch=require(_0xb5f6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb5f6('0x3'));var Mustache=require(_0xb5f6('0x4'));var util=require('util');var path=require(_0xb5f6('0x5'));var sox=require(_0xb5f6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb5f6('0x7'));var squel=require(_0xb5f6('0x8'));var crypto=require(_0xb5f6('0x9'));var jsforce=require(_0xb5f6('0xa'));var deskjs=require(_0xb5f6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb5f6('0xc'));var Papa=require(_0xb5f6('0xd'));var Redis=require(_0xb5f6('0xe'));var authService=require(_0xb5f6('0xf'));var qs=require(_0xb5f6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5f6('0x11'));var logger=require(_0xb5f6('0x12'))(_0xb5f6('0x13'));var utils=require('../../config/utils');var config=require(_0xb5f6('0x14'));var db=require(_0xb5f6('0x15'))['db'];function respondWithStatusCode(_0xb21200,_0x332096){_0x332096=_0x332096||0xcc;return function(_0x19d1e7){if(_0x19d1e7){return _0xb21200[_0xb5f6('0x16')](_0x332096);}return _0xb21200[_0xb5f6('0x17')](_0x332096)[_0xb5f6('0x18')]();};}function respondWithResult(_0xc71b82,_0x547f2d){_0x547f2d=_0x547f2d||0xc8;return function(_0x210b2f){if(_0x210b2f){return _0xc71b82[_0xb5f6('0x17')](_0x547f2d)['json'](_0x210b2f);}};}function respondWithFilteredResult(_0x10cc67,_0x4521d9){return function(_0x520946){if(_0x520946){var _0x5d5823=_0x520946[_0xb5f6('0x19')],_0xfc9507=_0x4521d9[_0xb5f6('0x1a')],_0x1eb805=_0x4521d9[_0xb5f6('0x1a')]+_0x4521d9['limit'],_0x113aaf;if(_0x1eb805>=_0x5d5823){_0x1eb805=_0x5d5823;_0x113aaf=0xc8;}else{_0x113aaf=0xce;}_0x10cc67[_0xb5f6('0x17')](_0x113aaf);return _0x10cc67[_0xb5f6('0x1b')](_0xb5f6('0x1c'),_0xfc9507+'-'+_0x1eb805+'/'+_0x5d5823)['json'](_0x520946);}return null;};}function patchUpdates(_0x5a8592){return function(_0x4c410d){try{jsonpatch[_0xb5f6('0x1d')](_0x4c410d,_0x5a8592,!![]);}catch(_0x2748c6){return BPromise['reject'](_0x2748c6);}return _0x4c410d[_0xb5f6('0x1e')]();};}function saveUpdates(_0x5b9d20,_0x3e123b){return function(_0x53fc9f){if(_0x53fc9f){return _0x53fc9f['update'](_0x5b9d20)[_0xb5f6('0x1f')](function(_0x5a8930){return _0x5a8930;});}return null;};}function removeEntity(_0x403159,_0x1dd202){return function(_0xdf5f19){if(_0xdf5f19){return _0xdf5f19[_0xb5f6('0x20')]()[_0xb5f6('0x1f')](function(){_0x403159['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e84d1,_0x2cf0e6){return function(_0x49c5d0){if(!_0x49c5d0){_0x1e84d1['sendStatus'](0x194);}return _0x49c5d0;};}function handleError(_0x4bfd97,_0x10f9fc){_0x10f9fc=_0x10f9fc||0x1f4;return function(_0x826969){logger['error'](_0x826969[_0xb5f6('0x21')]);if(_0x826969[_0xb5f6('0x22')]){delete _0x826969[_0xb5f6('0x22')];}_0x4bfd97[_0xb5f6('0x17')](_0x10f9fc)[_0xb5f6('0x23')](_0x826969);};}exports[_0xb5f6('0x24')]=function(_0xda8a9e,_0x37a327){var _0x1388d8={'raw':!![],'where':{'id':_0xda8a9e['params']['id']}},_0x56f42c={};_0x56f42c[_0xb5f6('0x25')]=_[_0xb5f6('0x26')](db[_0xb5f6('0x27')][_0xb5f6('0x28')]);_0x56f42c[_0xb5f6('0x29')]=_[_0xb5f6('0x26')](_0xda8a9e[_0xb5f6('0x29')]);_0x56f42c[_0xb5f6('0x2a')]=_[_0xb5f6('0x2b')](_0x56f42c[_0xb5f6('0x25')],_0x56f42c[_0xb5f6('0x29')]);_0x1388d8['attributes']=_[_0xb5f6('0x2b')](_0x56f42c[_0xb5f6('0x25')],qs[_0xb5f6('0x2c')](_0xda8a9e[_0xb5f6('0x29')]['fields']));_0x1388d8['attributes']=_0x1388d8[_0xb5f6('0x2d')]['length']?_0x1388d8[_0xb5f6('0x2d')]:_0x56f42c['model'];if(_0xda8a9e[_0xb5f6('0x29')][_0xb5f6('0x2e')]){_0x1388d8['include']=[{'all':!![]}];}_0x1388d8=_[_0xb5f6('0x2f')]({},_0x1388d8,_0xda8a9e[_0xb5f6('0x30')]);return db[_0xb5f6('0x27')][_0xb5f6('0x31')](_0x1388d8)[_0xb5f6('0x1f')](handleEntityNotFound(_0x37a327,null))['then'](respondWithResult(_0x37a327,null))[_0xb5f6('0x32')](handleError(_0x37a327,null));};exports['update']=function(_0x3ee3b1,_0xf9f5f3){if(_0x3ee3b1[_0xb5f6('0x33')]['id']){delete _0x3ee3b1[_0xb5f6('0x33')]['id'];}return db[_0xb5f6('0x27')][_0xb5f6('0x31')]({'where':{'id':_0x3ee3b1[_0xb5f6('0x34')]['id']}})[_0xb5f6('0x1f')](handleEntityNotFound(_0xf9f5f3,null))['then'](saveUpdates(_0x3ee3b1[_0xb5f6('0x33')],null))[_0xb5f6('0x1f')](respondWithResult(_0xf9f5f3,null))[_0xb5f6('0x32')](handleError(_0xf9f5f3,null));};exports[_0xb5f6('0x20')]=function(_0x6b65b1,_0x129752){return db[_0xb5f6('0x27')][_0xb5f6('0x31')]({'where':{'id':_0x6b65b1['params']['id']}})['then'](handleEntityNotFound(_0x129752,null))['then'](removeEntity(_0x129752,null))[_0xb5f6('0x32')](handleError(_0x129752,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c84c53f..c712b35 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 _0x8410=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','mail_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x2e6dd7,_0x27e160){var _0x584987=function(_0x4abc27){while(--_0x4abc27){_0x2e6dd7['push'](_0x2e6dd7['shift']());}};_0x584987(++_0x27e160);}(_0x8410,0xba));var _0x0841=function(_0x2f70de,_0xb36df7){_0x2f70de=_0x2f70de-0x0;var _0x3cdf30=_0x8410[_0x2f70de];return _0x3cdf30;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0841('0x0'))('api');var moment=require(_0x0841('0x1'));var BPromise=require(_0x0841('0x2'));var rp=require(_0x0841('0x3'));var fs=require('fs');var path=require(_0x0841('0x4'));var rimraf=require(_0x0841('0x5'));var config=require(_0x0841('0x6'));var attributes=require(_0x0841('0x7'));module['exports']=function(_0x2544cb,_0x271e9f){return _0x2544cb['define']('MailApplication',attributes,{'tableName':_0x0841('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0841('0x9'),'collate':_0x0841('0xa')});}; \ No newline at end of file +var _0x5a14=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x5840fb,_0x384987){var _0x90a609=function(_0x26eb7c){while(--_0x26eb7c){_0x5840fb['push'](_0x5840fb['shift']());}};_0x90a609(++_0x384987);}(_0x5a14,0x19e));var _0x45a1=function(_0x3c31e0,_0xe68ef4){_0x3c31e0=_0x3c31e0-0x0;var _0x55366e=_0x5a14[_0x3c31e0];return _0x55366e;};'use strict';var _=require(_0x45a1('0x0'));var util=require(_0x45a1('0x1'));var logger=require(_0x45a1('0x2'))(_0x45a1('0x3'));var moment=require(_0x45a1('0x4'));var BPromise=require(_0x45a1('0x5'));var rp=require(_0x45a1('0x6'));var fs=require('fs');var path=require(_0x45a1('0x7'));var rimraf=require(_0x45a1('0x8'));var config=require(_0x45a1('0x9'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x5d003e,_0x3f2f65){return _0x5d003e['define'](_0x45a1('0xa'),attributes,{'tableName':_0x45a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x45a1('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 62df53f..c8f2974 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 _0xe028=['UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','update','body','options','raw','where','attributes','limit'];(function(_0x24d560,_0x2e0e7b){var _0x18f7b3=function(_0x564a93){while(--_0x564a93){_0x24d560['push'](_0x24d560['shift']());}};_0x18f7b3(++_0x2e0e7b);}(_0xe028,0x1f1));var _0x8e02=function(_0x319f82,_0x388a6f){_0x319f82=_0x319f82-0x0;var _0x22065d=_0xe028[_0x319f82];return _0x22065d;};'use strict';var _=require(_0x8e02('0x0'));var util=require(_0x8e02('0x1'));var moment=require(_0x8e02('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e02('0x3'));var fs=require('fs');var Redis=require(_0x8e02('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e02('0x5'));var logger=require(_0x8e02('0x6'))(_0x8e02('0x7'));var config=require(_0x8e02('0x8'));var jayson=require(_0x8e02('0x9'));var client=jayson[_0x8e02('0xa')][_0x8e02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x65aa85,_0x11b945,_0x4aa556){return new BPromise(function(_0x2ffed9,_0x3c2d36){return client['request'](_0x65aa85,_0x4aa556)[_0x8e02('0xc')](function(_0x380b4c){logger[_0x8e02('0xd')](_0x8e02('0xe'),_0x11b945,'request\x20sent');logger[_0x8e02('0xf')](_0x8e02('0x10'),_0x11b945,_0x8e02('0x11'),JSON[_0x8e02('0x12')](_0x380b4c));if(_0x380b4c[_0x8e02('0x13')]){if(_0x380b4c[_0x8e02('0x13')][_0x8e02('0x14')]===0x1f4){logger[_0x8e02('0x13')](_0x8e02('0xe'),_0x11b945,_0x380b4c[_0x8e02('0x13')]['message']);return _0x3c2d36(_0x380b4c[_0x8e02('0x13')][_0x8e02('0x15')]);}logger[_0x8e02('0x13')](_0x8e02('0xe'),_0x11b945,_0x380b4c[_0x8e02('0x13')]['message']);return _0x2ffed9(_0x380b4c[_0x8e02('0x13')][_0x8e02('0x15')]);}else{logger[_0x8e02('0xd')](_0x8e02('0xe'),_0x11b945,_0x8e02('0x11'));_0x2ffed9(_0x380b4c['result'][_0x8e02('0x15')]);}})[_0x8e02('0x16')](function(_0x51ce47){logger[_0x8e02('0x13')](_0x8e02('0xe'),_0x11b945,_0x51ce47);_0x3c2d36(_0x51ce47);});});}exports['UpdateMailApplication']=function(_0x330aa8){var _0xf1ea63=this;return new Promise(function(_0x2b1f91,_0x352ad5){return db['MailApplication'][_0x8e02('0x17')](_0x330aa8[_0x8e02('0x18')],{'raw':_0x330aa8[_0x8e02('0x19')]?_0x330aa8['options'][_0x8e02('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x330aa8[_0x8e02('0x19')]?_0x330aa8['options'][_0x8e02('0x1b')]||null:null,'attributes':_0x330aa8['options']?_0x330aa8[_0x8e02('0x19')][_0x8e02('0x1c')]||null:null,'limit':_0x330aa8[_0x8e02('0x19')]?_0x330aa8[_0x8e02('0x19')][_0x8e02('0x1d')]||null:null})[_0x8e02('0xc')](function(_0x452578){logger['info'](_0x8e02('0x1e'),_0x330aa8);logger[_0x8e02('0xf')](_0x8e02('0x1e'),_0x330aa8,JSON[_0x8e02('0x12')](_0x452578));_0x2b1f91(_0x452578);})['catch'](function(_0x232695){logger[_0x8e02('0x13')](_0x8e02('0x1e'),_0x232695[_0x8e02('0x15')],_0x330aa8);_0x352ad5(_0xf1ea63[_0x8e02('0x13')](0x1f4,_0x232695[_0x8e02('0x15')]));});});}; \ No newline at end of file +var _0x3e2b=['options','raw','where','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','body'];(function(_0x403d5b,_0x16af13){var _0x193deb=function(_0x490d0b){while(--_0x490d0b){_0x403d5b['push'](_0x403d5b['shift']());}};_0x193deb(++_0x16af13);}(_0x3e2b,0x1c5));var _0xb3e2=function(_0x56922c,_0x22f4a3){_0x56922c=_0x56922c-0x0;var _0x3beedd=_0x3e2b[_0x56922c];return _0x3beedd;};'use strict';var _=require(_0xb3e2('0x0'));var util=require(_0xb3e2('0x1'));var moment=require(_0xb3e2('0x2'));var BPromise=require(_0xb3e2('0x3'));var rs=require(_0xb3e2('0x4'));var fs=require('fs');var Redis=require(_0xb3e2('0x5'));var db=require(_0xb3e2('0x6'))['db'];var utils=require(_0xb3e2('0x7'));var logger=require(_0xb3e2('0x8'))(_0xb3e2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb3e2('0xa')][_0xb3e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41995b,_0x43a10c,_0x51f593){return new BPromise(function(_0x53e1fb,_0x166638){return client[_0xb3e2('0xc')](_0x41995b,_0x51f593)[_0xb3e2('0xd')](function(_0x4a8bdb){logger[_0xb3e2('0xe')](_0xb3e2('0xf'),_0x43a10c,'request\x20sent');logger['debug'](_0xb3e2('0x10'),_0x43a10c,_0xb3e2('0x11'),JSON[_0xb3e2('0x12')](_0x4a8bdb));if(_0x4a8bdb[_0xb3e2('0x13')]){if(_0x4a8bdb[_0xb3e2('0x13')][_0xb3e2('0x14')]===0x1f4){logger['error'](_0xb3e2('0xf'),_0x43a10c,_0x4a8bdb['error'][_0xb3e2('0x15')]);return _0x166638(_0x4a8bdb[_0xb3e2('0x13')][_0xb3e2('0x15')]);}logger['error'](_0xb3e2('0xf'),_0x43a10c,_0x4a8bdb[_0xb3e2('0x13')][_0xb3e2('0x15')]);return _0x53e1fb(_0x4a8bdb['error'][_0xb3e2('0x15')]);}else{logger[_0xb3e2('0xe')](_0xb3e2('0xf'),_0x43a10c,'request\x20sent');_0x53e1fb(_0x4a8bdb[_0xb3e2('0x16')]['message']);}})[_0xb3e2('0x17')](function(_0x351d2b){logger[_0xb3e2('0x13')]('MailApplication,\x20%s,\x20%s',_0x43a10c,_0x351d2b);_0x166638(_0x351d2b);});});}exports[_0xb3e2('0x18')]=function(_0x35d37f){var _0x437115=this;return new Promise(function(_0x2b6425,_0x139bc5){return db['MailApplication'][_0xb3e2('0x19')](_0x35d37f[_0xb3e2('0x1a')],{'raw':_0x35d37f[_0xb3e2('0x1b')]?_0x35d37f[_0xb3e2('0x1b')][_0xb3e2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35d37f['options']?_0x35d37f[_0xb3e2('0x1b')][_0xb3e2('0x1d')]||null:null,'attributes':_0x35d37f[_0xb3e2('0x1b')]?_0x35d37f['options']['attributes']||null:null,'limit':_0x35d37f[_0xb3e2('0x1b')]?_0x35d37f[_0xb3e2('0x1b')][_0xb3e2('0x1e')]||null:null})['then'](function(_0x1e935f){logger['info'](_0xb3e2('0x18'),_0x35d37f);logger[_0xb3e2('0x1f')](_0xb3e2('0x18'),_0x35d37f,JSON[_0xb3e2('0x12')](_0x1e935f));_0x2b6425(_0x1e935f);})[_0xb3e2('0x17')](function(_0x487d49){logger[_0xb3e2('0x13')](_0xb3e2('0x18'),_0x487d49[_0xb3e2('0x15')],_0x35d37f);_0x139bc5(_0x437115[_0xb3e2('0x13')](0x1f4,_0x487d49[_0xb3e2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 923fdac..e5c5092 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 _0x4af3=['describe','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','mail','mailinteraction:addtags','addTags','/:id','tracked','update','delete','mailinteraction:destroy','removeTags','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x2cb6d3,_0xad38c5){var _0x276b6f=function(_0x1ecfb7){while(--_0x1ecfb7){_0x2cb6d3['push'](_0x2cb6d3['shift']());}};_0x276b6f(++_0xad38c5);}(_0x4af3,0x118));var _0x34af=function(_0x44b249,_0x5b4811){_0x44b249=_0x44b249-0x0;var _0x23b853=_0x4af3[_0x44b249];return _0x23b853;};'use strict';var multer=require('multer');var util=require(_0x34af('0x0'));var path=require(_0x34af('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x34af('0x2'));var interaction=require(_0x34af('0x3'));var config=require(_0x34af('0x4'));var controller=require(_0x34af('0x5'));router[_0x34af('0x6')]('/',auth[_0x34af('0x7')](),controller[_0x34af('0x8')]);router['get'](_0x34af('0x9'),auth[_0x34af('0x7')](),controller[_0x34af('0xa')]);router[_0x34af('0x6')]('/:id',auth[_0x34af('0x7')](),controller[_0x34af('0xb')]);router[_0x34af('0x6')]('/:id/messages',auth['isAuthenticated'](),controller[_0x34af('0xc')]);router[_0x34af('0x6')](_0x34af('0xd'),auth['isAuthenticated'](),controller[_0x34af('0xe')]);router[_0x34af('0xf')]('/',auth[_0x34af('0x7')](),controller[_0x34af('0x10')]);router[_0x34af('0xf')](_0x34af('0x11'),auth[_0x34af('0x7')](),controller['addMessage']);router[_0x34af('0xf')](_0x34af('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0x34af('0x13'),_0x34af('0x14')),controller[_0x34af('0x15')]);router['put'](_0x34af('0x16'),auth[_0x34af('0x7')](),interaction[_0x34af('0x17')](_0x34af('0x13'),'mailinteraction:update'),controller[_0x34af('0x18')]);router[_0x34af('0x19')]('/:id',auth[_0x34af('0x7')](),interaction['tracked'](_0x34af('0x13'),_0x34af('0x1a')),controller['destroy']);router[_0x34af('0x19')](_0x34af('0x12'),auth[_0x34af('0x7')](),controller[_0x34af('0x1b')]);module[_0x34af('0x1c')]=router; \ No newline at end of file +var _0xf228=['mailinteraction:update','delete','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','put','/:id','tracked'];(function(_0xedbfd,_0x3df491){var _0x3b0cff=function(_0x9f2e04){while(--_0x9f2e04){_0xedbfd['push'](_0xedbfd['shift']());}};_0x3b0cff(++_0x3df491);}(_0xf228,0x1a9));var _0x8f22=function(_0x17a510,_0x432726){_0x17a510=_0x17a510-0x0;var _0x36a919=_0xf228[_0x17a510];return _0x36a919;};'use strict';var multer=require(_0x8f22('0x0'));var util=require(_0x8f22('0x1'));var path=require('path');var timeout=require(_0x8f22('0x2'));var express=require(_0x8f22('0x3'));var router=express[_0x8f22('0x4')]();var auth=require(_0x8f22('0x5'));var interaction=require(_0x8f22('0x6'));var config=require(_0x8f22('0x7'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x8f22('0x8')](),controller['index']);router[_0x8f22('0x9')](_0x8f22('0xa'),auth['isAuthenticated'](),controller[_0x8f22('0xb')]);router[_0x8f22('0x9')]('/:id',auth[_0x8f22('0x8')](),controller[_0x8f22('0xc')]);router[_0x8f22('0x9')](_0x8f22('0xd'),auth[_0x8f22('0x8')](),controller[_0x8f22('0xe')]);router[_0x8f22('0x9')](_0x8f22('0xf'),auth['isAuthenticated'](),controller[_0x8f22('0x10')]);router[_0x8f22('0x11')]('/',auth[_0x8f22('0x8')](),controller['create']);router[_0x8f22('0x11')]('/:id/messages',auth[_0x8f22('0x8')](),controller[_0x8f22('0x12')]);router[_0x8f22('0x11')](_0x8f22('0x13'),auth[_0x8f22('0x8')](),interaction['tracked'](_0x8f22('0x14'),_0x8f22('0x15')),controller['addTags']);router[_0x8f22('0x16')](_0x8f22('0x17'),auth['isAuthenticated'](),interaction[_0x8f22('0x18')](_0x8f22('0x14'),_0x8f22('0x19')),controller['update']);router[_0x8f22('0x1a')](_0x8f22('0x17'),auth[_0x8f22('0x8')](),interaction[_0x8f22('0x18')]('mail','mailinteraction:destroy'),controller[_0x8f22('0x1b')]);router['delete'](_0x8f22('0x13'),auth['isAuthenticated'](),controller[_0x8f22('0x1c')]);module[_0x8f22('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 8e9860c..797cdec 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 _0xec9f=['DATE','STRING','TEXT','long','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x302345,_0x5c1151){var _0x57c7fd=function(_0x4ddb7a){while(--_0x4ddb7a){_0x302345['push'](_0x302345['shift']());}};_0x57c7fd(++_0x5c1151);}(_0xec9f,0xf8));var _0xfec9=function(_0x4a19ba,_0x3db590){_0x4a19ba=_0x4a19ba-0x0;var _0x3b72d6=_0xec9f[_0x4a19ba];return _0x3b72d6;};'use strict';var Sequelize=require(_0xfec9('0x0'));var iconv=require(_0xfec9('0x1'));module[_0xfec9('0x2')]={'closed':{'type':Sequelize[_0xfec9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfec9('0x4')]},'disposition':{'type':Sequelize[_0xfec9('0x5')]},'note':{'type':Sequelize[_0xfec9('0x5')]},'inReplyTo':{'type':Sequelize[_0xfec9('0x5')](0x1fe)},'to':{'type':Sequelize[_0xfec9('0x5')]},'cc':{'type':Sequelize[_0xfec9('0x6')](_0xfec9('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xfec9('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xfec9('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xfec9('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfec9('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xfec9('0x6')](_0xfec9('0x7'))},'lastMsgText':{'type':Sequelize[_0xfec9('0x6')](_0xfec9('0x7'))}}; \ No newline at end of file +var _0x9d80=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports'];(function(_0x22c4d1,_0x4e508e){var _0x103d87=function(_0x50de16){while(--_0x50de16){_0x22c4d1['push'](_0x22c4d1['shift']());}};_0x103d87(++_0x4e508e);}(_0x9d80,0x18d));var _0x09d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d80[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x09d8('0x0'));var iconv=require(_0x09d8('0x1'));module[_0x09d8('0x2')]={'closed':{'type':Sequelize[_0x09d8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x09d8('0x4')]},'disposition':{'type':Sequelize[_0x09d8('0x5')]},'note':{'type':Sequelize[_0x09d8('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x09d8('0x6')](_0x09d8('0x7'))},'subject':{'type':Sequelize[_0x09d8('0x6')]()},'attach':{'type':Sequelize[_0x09d8('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x09d8('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x09d8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x09d8('0x8')]('in',_0x09d8('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x09d8('0x6')](_0x09d8('0x7'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x09d8('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b39cc1a..0679b24 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(_0x2a3146,_0xfc02bd){var _0x368b73=function(_0x1006c7){while(--_0x1006c7){_0x2a3146['push'](_0x2a3146['shift']());}};_0x368b73(++_0xfc02bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x3b93fe,_0x45a258){var _0x20ae53=function(_0x3f06eb){while(--_0x3f06eb){_0x3b93fe['push'](_0x3b93fe['shift']());}};_0x20ae53(++_0x45a258);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 7cb80ac..2b9bbab 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 _0x524d=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x448f23,_0x62556f){var _0x545300=function(_0x24e4af){while(--_0x24e4af){_0x448f23['push'](_0x448f23['shift']());}};_0x545300(++_0x62556f);}(_0x524d,0x6c));var _0xd524=function(_0x381cef,_0x129a87){_0x381cef=_0x381cef-0x0;var _0x256226=_0x524d[_0x381cef];return _0x256226;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xd524('0x0'))['db'][_0xd524('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd524('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd524('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b0d0c){return function(_0x5b71dd,_0x112622,_0x384fec){_0x5b71dd[_0xd524('0x4')]({'attributes':['id'],'raw':!![]})[_0xd524('0x5')](function(_0x2d61fd){_0x5b71dd[_0xd524('0x6')](_0xd524('0x7'),_0x2d61fd[_0xd524('0x8')](function(_0x27461f){return{'id':_0x27461f['id']};}));return MailMessage[_0xd524('0x9')]({'where':{'MailInteractionId':_0x5b71dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd524('0x5')](function(_0x4fbb00){_0x5b71dd[_0xd524('0x6')](_0xd524('0xa'),_0x4fbb00['length']);MailInteractionEvents[_0xd524('0xb')](_0x5b0d0c+':'+_0x5b71dd['id'],_0x5b71dd);MailInteractionEvents['emit'](_0x5b0d0c,_0x5b71dd);_0x384fec(null);})[_0xd524('0xc')](_0x384fec(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xd524('0xd')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xd11f=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x4f7fc6,_0x554d2f){var _0x235170=function(_0x489da4){while(--_0x489da4){_0x4f7fc6['push'](_0x4f7fc6['shift']());}};_0x235170(++_0x554d2f);}(_0xd11f,0xf8));var _0xfd11=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xd11f[_0x29e3b6];return _0x55d4b0;};'use strict';var EventEmitter=require(_0xfd11('0x0'));var MailInteraction=require(_0xfd11('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xfd11('0x1'))['db'][_0xfd11('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xfd11('0x3')](0x0);var events={'afterCreate':_0xfd11('0x4'),'afterUpdate':'update','afterDestroy':_0xfd11('0x5')};function emitEvent(_0x4517c9){return function(_0x1b72c2,_0x1f36af,_0x476115){_0x1b72c2[_0xfd11('0x6')]({'attributes':['id'],'raw':!![]})[_0xfd11('0x7')](function(_0x1e0256){_0x1b72c2[_0xfd11('0x8')](_0xfd11('0x9'),_0x1e0256[_0xfd11('0xa')](function(_0x312966){return{'id':_0x312966['id']};}));return MailMessage[_0xfd11('0xb')]({'where':{'MailInteractionId':_0x1b72c2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfd11('0x7')](function(_0x369006){_0x1b72c2[_0xfd11('0x8')](_0xfd11('0xc'),_0x369006[_0xfd11('0xd')]);MailInteractionEvents[_0xfd11('0xe')](_0x4517c9+':'+_0x1b72c2['id'],_0x1b72c2);MailInteractionEvents[_0xfd11('0xe')](_0x4517c9,_0x1b72c2);_0x476115(null);})[_0xfd11('0xf')](_0x476115(null));};}for(var e in events){if(events[_0xfd11('0x10')](e)){var event=events[e];MailInteraction[_0xfd11('0x11')](e,emitEvent(event));}}module[_0xfd11('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 5afb0e5..541fc17 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 _0x3e74=['changed','substatus','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3e74,0x175));var _0x43e7=function(_0x2ce1ac,_0x4246bd){_0x2ce1ac=_0x2ce1ac-0x0;var _0xe4b4ed=_0x3e74[_0x2ce1ac];return _0xe4b4ed;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[{'name':_0x43e7('0xa'),'fields':[_0x43e7('0xb'),'to'],'type':_0x43e7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x516b4d,_0x212c6c,_0x554d44){if(_0x516b4d['substatus']){_0x516b4d[_0x43e7('0xd')]=moment()[_0x43e7('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x516b4d[_0x43e7('0xf')]){_0x516b4d['closedAt']=moment()[_0x43e7('0xe')](_0x43e7('0x10'));}_0x554d44(null,_0x212c6c);},'beforeUpdate':function(_0x4ebc8e,_0x3eb206,_0xc960ea){if(_0x4ebc8e[_0x43e7('0x11')](_0x43e7('0x12'))){_0x4ebc8e['substatusAt']=_0x4ebc8e['substatus']?moment()[_0x43e7('0xe')](_0x43e7('0x10')):null;}if(_0x4ebc8e[_0x43e7('0x11')]('closed')){_0x4ebc8e['closedAt']=moment()[_0x43e7('0xe')](_0x43e7('0x10'));_0x4ebc8e[_0x43e7('0x12')]=null;_0x4ebc8e[_0x43e7('0xd')]=null;}_0xc960ea(null,_0x4ebc8e);},'afterUpdate':function(_0x4de324,_0x5c4eaa,_0xdf16c){var _0x264575=_0x1c503b[_0x43e7('0x13')];var _0x5d346f=_0x4de324['get']({'plain':!![]});if(_0x5d346f[_0x43e7('0xf')]){return _0x264575[_0x43e7('0x14')][_0x43e7('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5d346f['id']}})[_0x43e7('0x16')](function(){_0xdf16c();})[_0x43e7('0x17')](function(_0x1f24fb){_0xdf16c(_0x1f24fb);});}else{_0xdf16c();}}},'charset':_0x43e7('0x18'),'collate':_0x43e7('0x19')});}; \ No newline at end of file +var _0x9c44=['MailInteraction','mail_interactions','subject','FULLTEXT','substatusAt','format','closed','closedAt','changed','substatus','YYYY-MM-DD\x20HH:mm:ss','get','update','then','catch','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','./mailInteraction.attributes','define'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'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':[{'name':'fti_mail_interactions','fields':[_0x49c4('0xa'),'to'],'type':_0x49c4('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d13fb,_0x4487ca,_0x4c7d3a){if(_0x1d13fb['substatus']){_0x1d13fb[_0x49c4('0xc')]=moment()[_0x49c4('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1d13fb[_0x49c4('0xe')]){_0x1d13fb[_0x49c4('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4c7d3a(null,_0x4487ca);},'beforeUpdate':function(_0x1d19bf,_0x6d1b08,_0x5487cd){if(_0x1d19bf[_0x49c4('0x10')](_0x49c4('0x11'))){_0x1d19bf['substatusAt']=_0x1d19bf[_0x49c4('0x11')]?moment()[_0x49c4('0xd')](_0x49c4('0x12')):null;}if(_0x1d19bf[_0x49c4('0x10')](_0x49c4('0xe'))){_0x1d19bf[_0x49c4('0xf')]=moment()[_0x49c4('0xd')](_0x49c4('0x12'));_0x1d19bf['substatus']=null;_0x1d19bf[_0x49c4('0xc')]=null;}_0x5487cd(null,_0x1d19bf);},'afterUpdate':function(_0x141003,_0x13a2db,_0x81e831){var _0x2abc78=_0xc1278f['models'];var _0x44e607=_0x141003[_0x49c4('0x13')]({'plain':!![]});if(_0x44e607['closed']){return _0x2abc78['MailMessage'][_0x49c4('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x44e607['id']}})[_0x49c4('0x15')](function(){_0x81e831();})[_0x49c4('0x16')](function(_0x59f29b){_0x81e831(_0x59f29b);});}else{_0x81e831();}}},'charset':_0x49c4('0x17'),'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 58299ef..50c6d13 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 _0xd5b6=['./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x5ad820,_0x955136){var _0x1969d3=function(_0x156309){while(--_0x156309){_0x5ad820['push'](_0x5ad820['shift']());}};_0x1969d3(++_0x955136);}(_0xd5b6,0x73));var _0x6d5b=function(_0x5371a3,_0x3eb5b7){_0x5371a3=_0x5371a3-0x0;var _0x444f23=_0xd5b6[_0x5371a3];return _0x444f23;};'use strict';var _=require(_0x6d5b('0x0'));var util=require(_0x6d5b('0x1'));var moment=require(_0x6d5b('0x2'));var BPromise=require(_0x6d5b('0x3'));var rs=require(_0x6d5b('0x4'));var fs=require('fs');var Redis=require(_0x6d5b('0x5'));var db=require(_0x6d5b('0x6'))['db'];var utils=require(_0x6d5b('0x7'));var logger=require('../../config/logger')(_0x6d5b('0x8'));var config=require(_0x6d5b('0x9'));var jayson=require(_0x6d5b('0xa'));var client=jayson['client'][_0x6d5b('0xb')]({'port':0x232a});config[_0x6d5b('0xc')]=_[_0x6d5b('0xd')](config[_0x6d5b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d5b('0xc')]));require(_0x6d5b('0xe'))[_0x6d5b('0xf')](socket);function respondWithRpcPromise(_0xee20ae,_0x79d24,_0x3c4e93){return new BPromise(function(_0x47314e,_0x391450){return client[_0x6d5b('0x10')](_0xee20ae,_0x3c4e93)[_0x6d5b('0x11')](function(_0x354f5c){logger[_0x6d5b('0x12')](_0x6d5b('0x13'),_0x79d24,_0x6d5b('0x14'));logger[_0x6d5b('0x15')](_0x6d5b('0x16'),_0x79d24,_0x6d5b('0x14'),JSON[_0x6d5b('0x17')](_0x354f5c));if(_0x354f5c['error']){if(_0x354f5c[_0x6d5b('0x18')][_0x6d5b('0x19')]===0x1f4){logger[_0x6d5b('0x18')](_0x6d5b('0x13'),_0x79d24,_0x354f5c[_0x6d5b('0x18')]['message']);return _0x391450(_0x354f5c[_0x6d5b('0x18')][_0x6d5b('0x1a')]);}logger['error'](_0x6d5b('0x13'),_0x79d24,_0x354f5c['error'][_0x6d5b('0x1a')]);return _0x47314e(_0x354f5c['error']['message']);}else{logger['info'](_0x6d5b('0x13'),_0x79d24,_0x6d5b('0x14'));_0x47314e(_0x354f5c[_0x6d5b('0x1b')]['message']);}})[_0x6d5b('0x1c')](function(_0x25f8cc){logger[_0x6d5b('0x18')]('MailInteraction,\x20%s,\x20%s',_0x79d24,_0x25f8cc);_0x391450(_0x25f8cc);});});}exports[_0x6d5b('0x1d')]=function(_0x485c2d){var _0x40348a=this;return new Promise(function(_0x2e1ecf,_0x26b175){return db['MailInteraction'][_0x6d5b('0x1e')](_0x485c2d[_0x6d5b('0x1f')],{'raw':_0x485c2d[_0x6d5b('0x20')]?_0x485c2d[_0x6d5b('0x20')][_0x6d5b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485c2d[_0x6d5b('0x20')]?_0x485c2d[_0x6d5b('0x20')][_0x6d5b('0x22')]||null:null,'attributes':_0x485c2d[_0x6d5b('0x20')]?_0x485c2d[_0x6d5b('0x20')][_0x6d5b('0x23')]||null:null,'limit':_0x485c2d[_0x6d5b('0x20')]?_0x485c2d[_0x6d5b('0x20')][_0x6d5b('0x24')]||null:null})['then'](function(_0x38efa7){logger['info'](_0x6d5b('0x1d'),_0x485c2d);logger[_0x6d5b('0x15')](_0x6d5b('0x1d'),_0x485c2d,JSON[_0x6d5b('0x17')](_0x38efa7));_0x2e1ecf(_0x38efa7);})[_0x6d5b('0x1c')](function(_0x161c12){logger[_0x6d5b('0x18')](_0x6d5b('0x1d'),_0x161c12[_0x6d5b('0x1a')],_0x485c2d);_0x26b175(_0x40348a[_0x6d5b('0x18')](0x1f4,_0x161c12[_0x6d5b('0x1a')]));});});};exports[_0x6d5b('0x25')]=function(_0x202ec2){return new Promise(function(_0x5dd460,_0x597e06){return db['MailInteraction'][_0x6d5b('0x26')]({'where':_0x202ec2[_0x6d5b('0x20')]?_0x202ec2[_0x6d5b('0x20')]['where']||null:null})[_0x6d5b('0x11')](function(_0x3e2ecc){if(_0x3e2ecc){return _0x3e2ecc['addTags'](_0x202ec2['body'][_0x6d5b('0x27')],_[_0x6d5b('0x28')](_0x202ec2[_0x6d5b('0x1f')],[_0x6d5b('0x27'),'id'])||{});}})[_0x6d5b('0x29')](function(_0x555317){logger['info'](_0x6d5b('0x2a'),_0x202ec2);logger['debug'](_0x6d5b('0x2a'),_0x202ec2,JSON[_0x6d5b('0x17')](_0x555317));_0x5dd460(_0x555317);})[_0x6d5b('0x1c')](function(_0x2185b4){logger[_0x6d5b('0x18')](_0x6d5b('0x2a'),_0x2185b4[_0x6d5b('0x1a')],_0x202ec2);_0x597e06(_this[_0x6d5b('0x18')](0x1f4,_0x2185b4['message']));});});}; \ No newline at end of file +var _0x4876=['body','options','raw','where','debug','AddTagsToMailInteraction','find','addTags','omit','ids','spread','AddTags','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update'];(function(_0x505382,_0x389a5b){var _0x7260b4=function(_0x59fadf){while(--_0x59fadf){_0x505382['push'](_0x505382['shift']());}};_0x7260b4(++_0x389a5b);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6487('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6487('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x6487('0x2'));var logger=require(_0x6487('0x3'))(_0x6487('0x4'));var config=require(_0x6487('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6487('0x6')][_0x6487('0x7')]({'port':0x232a});config['redis']=_[_0x6487('0x8')](config[_0x6487('0x9')],{'host':_0x6487('0xa'),'port':0x18eb});var socket=require(_0x6487('0xb'))(new Redis(config[_0x6487('0x9')]));require(_0x6487('0xc'))[_0x6487('0xd')](socket);function respondWithRpcPromise(_0x12ff32,_0x5f8f96,_0x5e8c83){return new BPromise(function(_0x14750d,_0x3964d5){return client[_0x6487('0xe')](_0x12ff32,_0x5e8c83)[_0x6487('0xf')](function(_0x47238b){logger[_0x6487('0x10')](_0x6487('0x11'),_0x5f8f96,_0x6487('0x12'));logger['debug'](_0x6487('0x13'),_0x5f8f96,_0x6487('0x12'),JSON[_0x6487('0x14')](_0x47238b));if(_0x47238b[_0x6487('0x15')]){if(_0x47238b['error'][_0x6487('0x16')]===0x1f4){logger[_0x6487('0x15')](_0x6487('0x11'),_0x5f8f96,_0x47238b[_0x6487('0x15')]['message']);return _0x3964d5(_0x47238b['error'][_0x6487('0x17')]);}logger['error'](_0x6487('0x11'),_0x5f8f96,_0x47238b['error'][_0x6487('0x17')]);return _0x14750d(_0x47238b[_0x6487('0x15')][_0x6487('0x17')]);}else{logger[_0x6487('0x10')](_0x6487('0x11'),_0x5f8f96,'request\x20sent');_0x14750d(_0x47238b['result']['message']);}})[_0x6487('0x18')](function(_0x366cc8){logger[_0x6487('0x15')](_0x6487('0x11'),_0x5f8f96,_0x366cc8);_0x3964d5(_0x366cc8);});});}exports[_0x6487('0x19')]=function(_0xaa843){var _0x469513=this;return new Promise(function(_0x35543e,_0x1b99ef){return db[_0x6487('0x1a')][_0x6487('0x1b')](_0xaa843[_0x6487('0x1c')],{'raw':_0xaa843[_0x6487('0x1d')]?_0xaa843[_0x6487('0x1d')][_0x6487('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaa843[_0x6487('0x1d')]?_0xaa843[_0x6487('0x1d')][_0x6487('0x1f')]||null:null,'attributes':_0xaa843[_0x6487('0x1d')]?_0xaa843['options']['attributes']||null:null,'limit':_0xaa843[_0x6487('0x1d')]?_0xaa843['options']['limit']||null:null})[_0x6487('0xf')](function(_0xc42717){logger['info'](_0x6487('0x19'),_0xaa843);logger[_0x6487('0x20')](_0x6487('0x19'),_0xaa843,JSON[_0x6487('0x14')](_0xc42717));_0x35543e(_0xc42717);})[_0x6487('0x18')](function(_0x5439f7){logger[_0x6487('0x15')]('UpdateMailInteraction',_0x5439f7[_0x6487('0x17')],_0xaa843);_0x1b99ef(_0x469513['error'](0x1f4,_0x5439f7['message']));});});};exports[_0x6487('0x21')]=function(_0x31ede3){return new Promise(function(_0x5338b4,_0x4c424a){return db[_0x6487('0x1a')][_0x6487('0x22')]({'where':_0x31ede3[_0x6487('0x1d')]?_0x31ede3[_0x6487('0x1d')][_0x6487('0x1f')]||null:null})[_0x6487('0xf')](function(_0x4ae8ed){if(_0x4ae8ed){return _0x4ae8ed[_0x6487('0x23')](_0x31ede3[_0x6487('0x1c')]['ids'],_[_0x6487('0x24')](_0x31ede3[_0x6487('0x1c')],[_0x6487('0x25'),'id'])||{});}})[_0x6487('0x26')](function(_0x19b176){logger[_0x6487('0x10')](_0x6487('0x27'),_0x31ede3);logger['debug'](_0x6487('0x27'),_0x31ede3,JSON['stringify'](_0x19b176));_0x5338b4(_0x19b176);})[_0x6487('0x18')](function(_0x4d5c04){logger['error']('AddTags',_0x4d5c04['message'],_0x31ede3);_0x4c424a(_this[_0x6487('0x15')](0x1f4,_0x4d5c04[_0x6487('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 2cec376..5ec2ebf 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 _0x1680=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','remove'];(function(_0xbf9ef4,_0x575b09){var _0x28dcec=function(_0x4cb117){while(--_0x4cb117){_0xbf9ef4['push'](_0xbf9ef4['shift']());}};_0x28dcec(++_0x575b09);}(_0x1680,0x76));var _0x0168=function(_0x54d5ba,_0x1f1ba9){_0x54d5ba=_0x54d5ba-0x0;var _0x6a592e=_0x1680[_0x54d5ba];return _0x6a592e;};'use strict';var MailInteractionEvents=require(_0x0168('0x0'));var events=['save',_0x0168('0x1'),_0x0168('0x2')];function createListener(_0x3fcf69,_0x468b0d){return function(_0x398108){_0x468b0d[_0x0168('0x3')](_0x3fcf69,_0x398108);};}function removeListener(_0x71c03f,_0x4307f8){return function(){MailInteractionEvents[_0x0168('0x4')](_0x71c03f,_0x4307f8);};}exports[_0x0168('0x5')]=function(_0x45cabd){for(var _0x4ba76a=0x0,_0x37159c=events[_0x0168('0x6')];_0x4ba76a<_0x37159c;_0x4ba76a++){var _0x5abf59=events[_0x4ba76a];var _0x33d329=createListener(_0x0168('0x7')+_0x5abf59,_0x45cabd);MailInteractionEvents['on'](_0x5abf59,_0x33d329);}}; \ No newline at end of file +var _0xf512=['mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener','register'];(function(_0x22585f,_0x550f05){var _0x17322d=function(_0x2263b){while(--_0x2263b){_0x22585f['push'](_0x22585f['shift']());}};_0x17322d(++_0x550f05);}(_0xf512,0x16d));var _0x2f51=function(_0x19d018,_0x565ccf){_0x19d018=_0x19d018-0x0;var _0x32d79a=_0xf512[_0x19d018];return _0x32d79a;};'use strict';var MailInteractionEvents=require(_0x2f51('0x0'));var events=[_0x2f51('0x1'),_0x2f51('0x2'),'update'];function createListener(_0x5f52f5,_0x639bbd){return function(_0x97ffe1){_0x639bbd[_0x2f51('0x3')](_0x5f52f5,_0x97ffe1);};}function removeListener(_0x4b329e,_0x2ba664){return function(){MailInteractionEvents[_0x2f51('0x4')](_0x4b329e,_0x2ba664);};}exports[_0x2f51('0x5')]=function(_0x27a5ab){for(var _0x477f96=0x0,_0xa637c5=events['length'];_0x477f96<_0xa637c5;_0x477f96++){var _0x353b34=events[_0x477f96];var _0x44a5ca=createListener(_0x2f51('0x6')+_0x353b34,_0x27a5ab);MailInteractionEvents['on'](_0x353b34,_0x44a5ca);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 8caf19c..7f434c2 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 _0xbec5=['/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','put','/:id/accept','accept'];(function(_0x240107,_0x4cb5ed){var _0x161508=function(_0x3b9dbd){while(--_0x3b9dbd){_0x240107['push'](_0x240107['shift']());}};_0x161508(++_0x4cb5ed);}(_0xbec5,0xe5));var _0x5bec=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xbec5[_0x213518];return _0x1baf75;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0x8')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router['get'](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0xf')]);router[_0x5bec('0x10')]('/',auth[_0x5bec('0x9')](),interaction['tracked'](_0x5bec('0x11'),_0x5bec('0x12')),controller[_0x5bec('0x13')]);router['put'](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0x14')](_0x5bec('0x15'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x16')]);router[_0x5bec('0x14')](_0x5bec('0x17'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x18')]);router[_0x5bec('0x19')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x1a')]);module[_0x5bec('0x1b')]=router; \ No newline at end of file +var _0x008c=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','tracked','mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21a19a,_0x9acf33){var _0x2749e1=function(_0x221529){while(--_0x221529){_0x21a19a['push'](_0x21a19a['shift']());}};_0x2749e1(++_0x9acf33);}(_0x008c,0x188));var _0xc008=function(_0x540178,_0x1feb3d){_0x540178=_0x540178-0x0;var _0x58a85c=_0x008c[_0x540178];return _0x58a85c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xc008('0xa')](),interaction[_0xc008('0x10')]('mail',_0xc008('0x11')),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router[_0xc008('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router['put'](_0xc008('0x16'),auth[_0xc008('0xa')](),controller[_0xc008('0x17')]);router[_0xc008('0x18')](_0xc008('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c1fb013..9f20e42 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 _0x28f2=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','lodash','exports','TEXT'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x28f2,0x193));var _0x228f=function(_0x1179ed,_0x3be897){_0x1179ed=_0x1179ed-0x0;var _0x281b79=_0x28f2[_0x1179ed];return _0x281b79;};'use strict';var Sequelize=require(_0x228f('0x0'));var _=require(_0x228f('0x1'));module[_0x228f('0x2')]={'body':{'type':Sequelize[_0x228f('0x3')](_0x228f('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x228f('0x5'))},'read':{'type':Sequelize[_0x228f('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x228f('0x7')]('in',_0x228f('0x8')),'defaultValue':_0x228f('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x228f('0x9')](0x1fe)},'from':{'type':Sequelize[_0x228f('0x9')]},'to':{'type':Sequelize['TEXT'](_0x228f('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x228f('0x4'))},'bcc':{'type':Sequelize[_0x228f('0x3')](_0x228f('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x228f('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x228f('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x228f('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0x228f('0x4'))},'originCc':{'type':Sequelize[_0x228f('0x3')](_0x228f('0x4'))}}; \ No newline at end of file +var _0xccde=['BOOLEAN','sequelize','exports','long','TEXT','ENUM','out','STRING','DATE','INTEGER'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xccde,0x1e1));var _0xeccd=function(_0xd73d53,_0x598443){_0xd73d53=_0xd73d53-0x0;var _0x560148=_0xccde[_0xd73d53];return _0x560148;};'use strict';var Sequelize=require(_0xeccd('0x0'));var _=require('lodash');module[_0xeccd('0x1')]={'body':{'type':Sequelize['TEXT'](_0xeccd('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xeccd('0x3')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xeccd('0x4')]('in',_0xeccd('0x5')),'defaultValue':_0xeccd('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xeccd('0x6')](0x1fe)},'from':{'type':Sequelize[_0xeccd('0x6')]},'to':{'type':Sequelize['TEXT'](_0xeccd('0x2'))},'cc':{'type':Sequelize[_0xeccd('0x3')](_0xeccd('0x2'))},'bcc':{'type':Sequelize[_0xeccd('0x3')]('long')},'subject':{'type':Sequelize[_0xeccd('0x3')]},'sentAt':{'type':Sequelize[_0xeccd('0x7')]},'attach':{'type':Sequelize[_0xeccd('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xeccd('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize['TEXT'](_0xeccd('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b0c3c04..a116f8e 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 _0xa786=['debug','request\x20sent','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','apply','save','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','body','describe','create','out','secret','split','MailAccount','findOne','Contacts','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','pass','service','attachments','join','root','server/files/attachments','basename','List','defaults','ListId','List\x20not\x20found','SendMail','sendMail','update','format','mail-interactions','accept','read','UserId','user','CmContact','get','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','MailInteraction','MailInteractionId','RejectMessage','rejectMessage','reject','download','unix','toString','files','tmp','server','bcc','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','readFileSync','build','writeFileSync','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.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','MailMessage,\x20%s,\x20%s'];(function(_0x45806b,_0x53eeae){var _0x3e228e=function(_0x3ee031){while(--_0x3ee031){_0x45806b['push'](_0x45806b['shift']());}};_0x3e228e(++_0x53eeae);}(_0xa786,0x1d2));var _0x6a78=function(_0x224bc0,_0x15990c){_0x224bc0=_0x224bc0-0x0;var _0x33519a=_0xa786[_0x224bc0];return _0x33519a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6a78('0x0'));var zipdir=require(_0x6a78('0x1'));var jsonpatch=require(_0x6a78('0x2'));var rp=require(_0x6a78('0x3'));var moment=require(_0x6a78('0x4'));var BPromise=require(_0x6a78('0x5'));var Mustache=require(_0x6a78('0x6'));var util=require('util');var path=require(_0x6a78('0x7'));var sox=require(_0x6a78('0x8'));var csv=require(_0x6a78('0x9'));var ejs=require(_0x6a78('0xa'));var fs=require('fs');var _=require(_0x6a78('0xb'));var squel=require(_0x6a78('0xc'));var crypto=require(_0x6a78('0xd'));var jsforce=require(_0x6a78('0xe'));var deskjs=require(_0x6a78('0xf'));var toCsv=require(_0x6a78('0x9'));var querystring=require(_0x6a78('0x10'));var Papa=require(_0x6a78('0x11'));var Redis=require(_0x6a78('0x12'));var authService=require(_0x6a78('0x13'));var qs=require(_0x6a78('0x14'));var as=require(_0x6a78('0x15'));var hardwareService=require(_0x6a78('0x16'));var logger=require(_0x6a78('0x17'))(_0x6a78('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6a78('0x19'))['db'];config[_0x6a78('0x1a')]=_['defaults'](config[_0x6a78('0x1a')],{'host':_0x6a78('0x1b'),'port':0x18eb});var socket=require(_0x6a78('0x1c'))(new Redis(config[_0x6a78('0x1a')]));require(_0x6a78('0x1d'))[_0x6a78('0x1e')](socket);var jayson=require(_0x6a78('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0x6a78('0x20')]({'port':0x232b});var client9002=jayson[_0x6a78('0x21')][_0x6a78('0x20')]({'port':0x232a});function checkPasswordPattern(_0x535dc8,_0x1085ca,_0x428060){if(_0x428060){var _0x5b5a5d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b5a5d[_0x6a78('0x22')](_0x1085ca)){return _0x535dc8;}else{throw new db[(_0x6a78('0x23'))][(_0x6a78('0x24'))](_0x6a78('0x25'));}}else{return _0x535dc8;}}function respondWithRpcPromise(_0x3f24ac,_0xe0e5e6,_0x28b91f,_0x3c3e5d){return new BPromise(function(_0x5ec2fa,_0x2d6ef3){var _0x5292eb=_0x3c3e5d||client;return _0x5292eb[_0x6a78('0x26')](_0x3f24ac,_0x28b91f)[_0x6a78('0x27')](function(_0x2ae9c5){logger['info'](_0x6a78('0x28'),_0xe0e5e6,'request\x20sent');logger[_0x6a78('0x29')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xe0e5e6,_0x6a78('0x2a'),JSON['stringify'](_0x2ae9c5));if(_0x2ae9c5[_0x6a78('0x2b')]){if(_0x2ae9c5['error']['code']===0x1f4){logger['error'](_0x6a78('0x28'),_0xe0e5e6,_0x2ae9c5[_0x6a78('0x2b')][_0x6a78('0x2c')]);return _0x2d6ef3(_0x2ae9c5['error'][_0x6a78('0x2c')]);}logger[_0x6a78('0x2b')](_0x6a78('0x28'),_0xe0e5e6,_0x2ae9c5[_0x6a78('0x2b')]['message']);return _0x5ec2fa(_0x2ae9c5[_0x6a78('0x2b')]['message']);}else{logger[_0x6a78('0x2d')](_0x6a78('0x28'),_0xe0e5e6,_0x6a78('0x2a'));_0x5ec2fa(_0x2ae9c5[_0x6a78('0x2e')]['message']);}})[_0x6a78('0x2f')](function(_0x2c1893){logger['error'](_0x6a78('0x28'),_0xe0e5e6,_0x2c1893);_0x2d6ef3(_0x2c1893);});});}function respondWithStatusCode(_0x526a94,_0x297708){_0x297708=_0x297708||0xcc;return function(_0x48c692){if(_0x48c692){return _0x526a94[_0x6a78('0x30')](_0x297708);}return _0x526a94[_0x6a78('0x31')](_0x297708)['end']();};}function respondWithResult(_0x31ca28,_0x231f1a){_0x231f1a=_0x231f1a||0xc8;return function(_0x50f6b1){if(_0x50f6b1){return _0x31ca28[_0x6a78('0x31')](_0x231f1a)[_0x6a78('0x32')](_0x50f6b1);}};}function respondWithFilteredResult(_0x5abf0b,_0x1e5cd4){return function(_0x86d08f){if(_0x86d08f){var _0x470ab2=_0x86d08f[_0x6a78('0x33')],_0xa40d44=_0x1e5cd4['offset'],_0x816c52=_0x1e5cd4[_0x6a78('0x34')]+_0x1e5cd4[_0x6a78('0x35')],_0x2c8074;if(_0x816c52>=_0x470ab2){_0x816c52=_0x470ab2;_0x2c8074=0xc8;}else{_0x2c8074=0xce;}_0x5abf0b['status'](_0x2c8074);return _0x5abf0b[_0x6a78('0x36')]('Content-Range',_0xa40d44+'-'+_0x816c52+'/'+_0x470ab2)[_0x6a78('0x32')](_0x86d08f);}return null;};}function patchUpdates(_0x22852c){return function(_0x4b76e7){try{jsonpatch[_0x6a78('0x37')](_0x4b76e7,_0x22852c,!![]);}catch(_0x784e39){return BPromise['reject'](_0x784e39);}return _0x4b76e7[_0x6a78('0x38')]();};}function saveUpdates(_0x58c8ed,_0x30fe15){return function(_0x2b9974){if(_0x2b9974){return _0x2b9974['update'](_0x58c8ed)['then'](function(_0x314775){return _0x314775;});}return null;};}function removeEntity(_0x6d1a66,_0x39dd29){return function(_0x725b9f){if(_0x725b9f){return _0x725b9f['destroy']()['then'](function(){_0x6d1a66[_0x6a78('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x210e0c,_0x16ff80){return function(_0x58cf10){if(!_0x58cf10){_0x210e0c[_0x6a78('0x30')](0x194);}return _0x58cf10;};}function handleError(_0x580aad,_0x14953c){_0x14953c=_0x14953c||0x1f4;return function(_0x29d375){logger['error'](_0x29d375[_0x6a78('0x39')]);if(_0x29d375['name']){delete _0x29d375[_0x6a78('0x3a')];}_0x580aad[_0x6a78('0x31')](_0x14953c)[_0x6a78('0x3b')](_0x29d375);};}exports[_0x6a78('0x3c')]=function(_0x2c5722,_0x3127d8){var _0x338a4e={},_0x24c9ac={},_0x1e0c52={'count':0x0,'rows':[]};var _0x5ab9aa=_[_0x6a78('0x3d')](db[_0x6a78('0x3e')][_0x6a78('0x3f')],function(_0x2987c8){return{'name':_0x2987c8[_0x6a78('0x40')],'type':_0x2987c8[_0x6a78('0x41')][_0x6a78('0x42')]};});_0x24c9ac[_0x6a78('0x43')]=_[_0x6a78('0x3d')](_0x5ab9aa,_0x6a78('0x3a'));_0x24c9ac[_0x6a78('0x44')]=_['keys'](_0x2c5722[_0x6a78('0x44')]);_0x24c9ac['filters']=_[_0x6a78('0x45')](_0x24c9ac[_0x6a78('0x43')],_0x24c9ac[_0x6a78('0x44')]);_0x338a4e['attributes']=_[_0x6a78('0x45')](_0x24c9ac[_0x6a78('0x43')],qs[_0x6a78('0x46')](_0x2c5722[_0x6a78('0x44')][_0x6a78('0x46')]));_0x338a4e[_0x6a78('0x47')]=_0x338a4e[_0x6a78('0x47')][_0x6a78('0x48')]?_0x338a4e[_0x6a78('0x47')]:_0x24c9ac[_0x6a78('0x43')];if(!_0x2c5722[_0x6a78('0x44')][_0x6a78('0x49')](_0x6a78('0x4a'))){_0x338a4e[_0x6a78('0x35')]=qs[_0x6a78('0x35')](_0x2c5722['query'][_0x6a78('0x35')]);_0x338a4e[_0x6a78('0x34')]=qs[_0x6a78('0x34')](_0x2c5722[_0x6a78('0x44')][_0x6a78('0x34')]);}_0x338a4e[_0x6a78('0x4b')]=qs[_0x6a78('0x4c')](_0x2c5722[_0x6a78('0x44')][_0x6a78('0x4c')]);_0x338a4e['where']=qs[_0x6a78('0x4d')](_[_0x6a78('0x4e')](_0x2c5722['query'],_0x24c9ac[_0x6a78('0x4d')]),_0x5ab9aa);if(_0x2c5722[_0x6a78('0x44')][_0x6a78('0x4f')]){_0x338a4e[_0x6a78('0x50')]=_[_0x6a78('0x51')](_0x338a4e['where'],{'$or':_[_0x6a78('0x3d')](_0x5ab9aa,function(_0x599550){if(_0x599550[_0x6a78('0x41')]!==_0x6a78('0x52')){var _0x1f42c7={};_0x1f42c7[_0x599550[_0x6a78('0x3a')]]={'$like':'%'+_0x2c5722[_0x6a78('0x44')][_0x6a78('0x4f')]+'%'};return _0x1f42c7;}})});}_0x338a4e=_[_0x6a78('0x51')]({},_0x338a4e,_0x2c5722[_0x6a78('0x53')]);var _0xede538={'where':_0x338a4e[_0x6a78('0x50')]};return db[_0x6a78('0x3e')]['count'](_0xede538)[_0x6a78('0x27')](function(_0xa4f975){_0x1e0c52[_0x6a78('0x33')]=_0xa4f975;if(_0x2c5722['query'][_0x6a78('0x54')]){_0x338a4e[_0x6a78('0x55')]=[{'all':!![]}];}return db[_0x6a78('0x3e')][_0x6a78('0x56')](_0x338a4e);})[_0x6a78('0x27')](function(_0x36bea3){_0x1e0c52['rows']=_0x36bea3;return _0x1e0c52;})['then'](respondWithFilteredResult(_0x3127d8,_0x338a4e))['catch'](handleError(_0x3127d8,null));};exports[_0x6a78('0x57')]=function(_0x24fe9b,_0x241270){var _0x253376={'raw':!![],'where':{'id':_0x24fe9b[_0x6a78('0x58')]['id']}},_0x2bcb06={};_0x2bcb06[_0x6a78('0x43')]=_[_0x6a78('0x59')](db[_0x6a78('0x3e')][_0x6a78('0x3f')]);_0x2bcb06[_0x6a78('0x44')]=_[_0x6a78('0x59')](_0x24fe9b[_0x6a78('0x44')]);_0x2bcb06[_0x6a78('0x4d')]=_[_0x6a78('0x45')](_0x2bcb06[_0x6a78('0x43')],_0x2bcb06[_0x6a78('0x44')]);_0x253376['attributes']=_[_0x6a78('0x45')](_0x2bcb06[_0x6a78('0x43')],qs['fields'](_0x24fe9b['query'][_0x6a78('0x46')]));_0x253376['attributes']=_0x253376['attributes'][_0x6a78('0x48')]?_0x253376[_0x6a78('0x47')]:_0x2bcb06[_0x6a78('0x43')];if(_0x24fe9b[_0x6a78('0x44')][_0x6a78('0x54')]){_0x253376[_0x6a78('0x55')]=[{'all':!![]}];}_0x253376=_['merge']({},_0x253376,_0x24fe9b[_0x6a78('0x53')]);return db[_0x6a78('0x3e')][_0x6a78('0x5a')](_0x253376)[_0x6a78('0x27')](handleEntityNotFound(_0x241270,null))[_0x6a78('0x27')](respondWithResult(_0x241270,null))['catch'](handleError(_0x241270,null));};exports['update']=function(_0x1f8483,_0x45cb10){if(_0x1f8483[_0x6a78('0x5b')]['id']){delete _0x1f8483['body']['id'];}return db[_0x6a78('0x3e')][_0x6a78('0x5a')]({'where':{'id':_0x1f8483[_0x6a78('0x58')]['id']}})[_0x6a78('0x27')](handleEntityNotFound(_0x45cb10,null))[_0x6a78('0x27')](saveUpdates(_0x1f8483[_0x6a78('0x5b')],null))['then'](respondWithResult(_0x45cb10,null))[_0x6a78('0x2f')](handleError(_0x45cb10,null));};exports['destroy']=function(_0x5795b7,_0x59bfae){return db[_0x6a78('0x3e')][_0x6a78('0x5a')]({'where':{'id':_0x5795b7[_0x6a78('0x58')]['id']}})[_0x6a78('0x27')](handleEntityNotFound(_0x59bfae,null))[_0x6a78('0x27')](removeEntity(_0x59bfae,null))[_0x6a78('0x2f')](handleError(_0x59bfae,null));};exports[_0x6a78('0x5c')]=function(_0x23de46,_0x38a6ab){return db['MailMessage'][_0x6a78('0x5c')]()[_0x6a78('0x27')](respondWithResult(_0x38a6ab,null))[_0x6a78('0x2f')](handleError(_0x38a6ab,null));};exports[_0x6a78('0x5d')]=function(_0x47feaa,_0x1bfadf){return db[_0x6a78('0x3e')][_0x6a78('0x5d')](_0x47feaa[_0x6a78('0x5b')])['then'](function(_0x227fa1){if(_0x227fa1){if(_0x227fa1['direction']===_0x6a78('0x5e')&&!_0x227fa1[_0x6a78('0x5f')]){var _0x2c9a1f,_0x199e06,_0x8da3ad;if(_0x47feaa['body']['to']){_0x199e06=_0x47feaa['body']['to'][_0x6a78('0x60')](',')[0x0];}return db[_0x6a78('0x61')][_0x6a78('0x62')]({'where':{'id':_0x227fa1['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x6a78('0x63'),'where':{'email':_0x199e06},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x6a78('0x64')],'as':'Smtp','raw':!![]}]})[_0x6a78('0x27')](function(_0x1c0490){_0x2c9a1f=_0x1c0490;if(_0x2c9a1f&&_0x2c9a1f[_0x6a78('0x65')]){var _0x4bfde8={'tls':{'rejectUnauthorized':![]}};if(_[_0x6a78('0x66')](_0x2c9a1f[_0x6a78('0x65')]['service'])){_0x4bfde8[_0x6a78('0x67')]=_0x2c9a1f[_0x6a78('0x65')]['host'];_0x4bfde8[_0x6a78('0x68')]=_0x2c9a1f['Smtp'][_0x6a78('0x68')];_0x4bfde8[_0x6a78('0x69')]=_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x69')];if(_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x6a')]){_0x4bfde8[_0x6a78('0x6b')]={'user':_0x2c9a1f['Smtp']['user'],'pass':_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x6c')]};}}else{_0x4bfde8['service']=_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x6d')];_0x4bfde8[_0x6a78('0x6b')]={'user':_0x2c9a1f['Smtp']['user'],'pass':_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x6c')]};_0x4bfde8[_0x6a78('0x69')]=_0x2c9a1f[_0x6a78('0x65')][_0x6a78('0x69')];}if(_0x47feaa[_0x6a78('0x5b')][_0x6a78('0x6e')]&&_0x47feaa[_0x6a78('0x5b')]['attachments'][_0x6a78('0x48')]){for(var _0xc34195=0x0;_0xc34195<_0x47feaa['body'][_0x6a78('0x6e')]['length'];_0xc34195+=0x1){_0x47feaa[_0x6a78('0x5b')]['attachments'][_0xc34195]={'filename':_0x47feaa['body'][_0x6a78('0x6e')][_0xc34195][_0x6a78('0x3a')],'path':path[_0x6a78('0x6f')](config[_0x6a78('0x70')],_0x6a78('0x71'),_0x47feaa[_0x6a78('0x5b')]['attachments'][_0xc34195][_0x6a78('0x72')])};}}_0x8da3ad={'account':_0x4bfde8,'message':_0x47feaa[_0x6a78('0x5b')]};return;}})[_0x6a78('0x27')](function(){if(_0x2c9a1f[_0x6a78('0x73')]){if(_0x2c9a1f[_0x6a78('0x73')][_0x6a78('0x63')][_0x6a78('0x48')]){return _0x2c9a1f[_0x6a78('0x73')][_0x6a78('0x63')][0x0];}else{return db['CmContact'][_0x6a78('0x5d')](_[_0x6a78('0x74')](_0x47feaa[_0x6a78('0x5b')],{'firstName':_0x47feaa[_0x6a78('0x5b')]['to'],'email':_0x47feaa['body']['to'],'phone':_0x47feaa[_0x6a78('0x5b')]['to'],'ListId':_0x2c9a1f[_0x6a78('0x75')]}));}}else{throw new Error(_0x6a78('0x76'));}})[_0x6a78('0x27')](function(){if(_0x8da3ad){return respondWithRpcPromise(_0x6a78('0x77'),_0x6a78('0x78'),_0x8da3ad,client9003)['then'](function(_0x4a2181){return _0x227fa1[_0x6a78('0x79')]({'read':!![],'messageId':_0x4a2181['messageId'],'sentAt':moment()[_0x6a78('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x13c984){logger[_0x6a78('0x2b')]('%s',JSON['stringify'](_0x13c984));return _0x227fa1;});}return _0x227fa1;});}return _0x227fa1;}})[_0x6a78('0x27')](respondWithResult(_0x1bfadf,0xc9))[_0x6a78('0x2f')](handleError(_0x1bfadf,null));};var interaction_log=require('../../config/logger')(_0x6a78('0x7b'));exports[_0x6a78('0x7c')]=function(_0x333bc4,_0x474e35,_0x3044d9){var _0x52844a={'channel':'mail'};if(_0x333bc4[_0x6a78('0x5b')]['id']){delete _0x333bc4[_0x6a78('0x5b')]['id'];}_0x333bc4[_0x6a78('0x5b')][_0x6a78('0x7d')]=!![];_0x333bc4[_0x6a78('0x5b')]['readAt']=moment()[_0x6a78('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x333bc4[_0x6a78('0x5b')]['UserId']=_0x333bc4['body'][_0x6a78('0x7e')]||_0x333bc4[_0x6a78('0x7f')]['id'];return db['MailMessage']['find']({'where':{'id':_0x333bc4['params']['id'],'UserId':null},'include':[{'model':db[_0x6a78('0x80')],'as':'Contact'}]})[_0x6a78('0x27')](handleEntityNotFound(_0x474e35,null))[_0x6a78('0x27')](saveUpdates(_0x333bc4[_0x6a78('0x5b')],null))[_0x6a78('0x27')](function(_0x297cdf){if(_0x297cdf){_0x52844a[_0x6a78('0x2c')]=_0x297cdf[_0x6a78('0x81')]({'plain':!![]});return db['MailInteraction'][_0x6a78('0x5a')]({'where':{'id':_0x297cdf['MailInteractionId']}});}return null;})[_0x6a78('0x27')](handleEntityNotFound(_0x474e35,null))['then'](function(_0x3e93dd){if(_0x3e93dd){return _0x3e93dd[_0x6a78('0x79')]({'UserId':_0x333bc4[_0x6a78('0x5b')]['UserId'],'read1stAt':_[_0x6a78('0x66')](_0x3e93dd['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6a78('0x27')](function(_0x37e9ca){if(_0x37e9ca){_0x52844a[_0x6a78('0x82')]=_0x37e9ca[_0x6a78('0x81')]({'plain':!![]});interaction_log[_0x6a78('0x2d')](_0x6a78('0x83'),_0x333bc4[_0x6a78('0x7f')]['id'],_0x333bc4[_0x6a78('0x7f')][_0x6a78('0x3a')],_0x333bc4[_0x6a78('0x7f')][_0x6a78('0x84')],_0x52844a[_0x6a78('0x82')]['id'],_0x333bc4[_0x6a78('0x5b')]?JSON[_0x6a78('0x85')](_0x333bc4['body']):_0x6a78('0x86'));return respondWithRpcPromise(_0x6a78('0x87'),'acceptMessage',_0x52844a);}return null;})[_0x6a78('0x27')](function(_0xac5ca7){if(_0xac5ca7){if(_0x333bc4['body'][_0x6a78('0x88')]){_0x52844a[_0x6a78('0x2c')][_0x6a78('0x89')]=util['format'](_0x6a78('0x8a'),_0x333bc4['user']['name']);_0x52844a['message'][_0x6a78('0x8b')]=_0x52844a[_0x6a78('0x8b')];_0x52844a[_0x6a78('0x2c')][_0x6a78('0x8c')]='accept';return respondWithRpcPromise(_0x6a78('0x8d'),_0x6a78('0x8d'),{'event':_0x6a78('0x8e'),'message':_0x52844a['message']},client9002)[_0x6a78('0x27')](function(){return _0x52844a;});}return _0x52844a;}return null;})['then'](respondWithResult(_0x474e35,null))[_0x6a78('0x2f')](handleError(_0x474e35,null));};var interaction_log=require(_0x6a78('0x17'))(_0x6a78('0x7b'));exports['reject']=function(_0x4589f0,_0x2b5adc,_0x38773b){var _0x3b9b1e={'agent':{},'channel':_0x6a78('0x8f')};if(_0x4589f0['body']['id']){delete _0x4589f0[_0x6a78('0x5b')]['id'];}_0x4589f0[_0x6a78('0x5b')]['UserId']=_0x4589f0[_0x6a78('0x5b')]['UserId']||_0x4589f0[_0x6a78('0x7f')]['id'];_0x3b9b1e['agent']['id']=_0x4589f0[_0x6a78('0x5b')][_0x6a78('0x7e')];return db[_0x6a78('0x3e')][_0x6a78('0x5a')]({'where':{'id':_0x4589f0[_0x6a78('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b5adc,null))[_0x6a78('0x27')](function(_0x2233da){if(_0x2233da){_0x3b9b1e['message']=_0x2233da[_0x6a78('0x81')]({'plain':!![]});return db[_0x6a78('0x90')]['find']({'where':{'id':_0x2233da[_0x6a78('0x91')]}});}return null;})[_0x6a78('0x27')](handleEntityNotFound(_0x2b5adc,null))['then'](function(_0x3bee80){if(_0x3bee80){_0x3b9b1e['interaction']=_0x3bee80[_0x6a78('0x81')]({'plain':!![]});interaction_log[_0x6a78('0x2d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4589f0['user']['id'],_0x4589f0[_0x6a78('0x7f')][_0x6a78('0x3a')],_0x4589f0[_0x6a78('0x7f')][_0x6a78('0x84')],_0x3b9b1e['interaction']['id'],_0x4589f0[_0x6a78('0x5b')]?JSON[_0x6a78('0x85')](_0x4589f0[_0x6a78('0x5b')]):'null');return respondWithRpcPromise(_0x6a78('0x92'),_0x6a78('0x93'),_0x3b9b1e);}return null;})[_0x6a78('0x27')](function(_0x343b4c){if(_0x343b4c){_0x343b4c[_0x6a78('0x2c')][_0x6a78('0x89')]=util[_0x6a78('0x7a')](_0x6a78('0x8a'),_0x4589f0[_0x6a78('0x7f')][_0x6a78('0x3a')]);_0x343b4c[_0x6a78('0x2c')][_0x6a78('0x8b')]=_0x3b9b1e[_0x6a78('0x8b')];_0x343b4c[_0x6a78('0x2c')][_0x6a78('0x8c')]=_0x6a78('0x94');respondWithRpcPromise(_0x6a78('0x8d'),_0x6a78('0x8d'),{'event':'rejectmessage','message':_0x343b4c[_0x6a78('0x2c')]},client9002);return _0x3b9b1e;}return null;})[_0x6a78('0x27')](respondWithResult(_0x2b5adc,null))['catch'](handleError(_0x2b5adc,null));};exports[_0x6a78('0x95')]=function(_0x54bd9f,_0x105e4d){var _0x4cb9e8=moment()[_0x6a78('0x96')]()[_0x6a78('0x97')]();var _0x46614e=path[_0x6a78('0x6f')](config[_0x6a78('0x70')],'server',_0x6a78('0x98'),_0x6a78('0x99'));var _0x3b603a=path['join'](config['root'],_0x6a78('0x9a'),_0x6a78('0x98'),_0x6a78('0x6e'));var _0x36b425=util['format']('message-%s.eml',_0x4cb9e8);return db['MailMessage'][_0x6a78('0x5a')]({'where':{'id':_0x54bd9f[_0x6a78('0x58')]['id']},'attributes':['id',_0x6a78('0x5b'),'from','to','cc',_0x6a78('0x9b'),_0x6a78('0x9c'),_0x6a78('0x9d')],'include':_0x54bd9f[_0x6a78('0x44')][_0x6a78('0x6e')]?[{'model':db[_0x6a78('0x9e')],'as':_0x6a78('0x9f')}]:undefined})[_0x6a78('0x27')](handleEntityNotFound(_0x105e4d,null))['then'](function(_0x499ce0){if(_0x499ce0){var _0x3bf269=_0x499ce0;var _0x41928a={'from':_0x3bf269[_0x6a78('0xa0')],'to':_0x3bf269['to'],'subject':_0x3bf269[_0x6a78('0x9c')],'html':_0x3bf269[_0x6a78('0x5b')],'headers':{'Date':moment(_0x3bf269[_0x6a78('0x9d')])[_0x6a78('0x7a')](_0x6a78('0xa1'))},'attachments':[]};if(_0x499ce0['cc']){_0x41928a[_0x6a78('0xa2')]['Cc']=_0x499ce0['cc'];}if(_0x499ce0[_0x6a78('0x9b')]){_0x41928a[_0x6a78('0xa2')]['Bcc']=_0x499ce0[_0x6a78('0x9b')];}return new BPromise(function(_0x4938b7,_0x336dd1){if(_0x499ce0[_0x6a78('0x9f')]){for(var _0x2b8ded=0x0;_0x2b8ded<_0x499ce0[_0x6a78('0x9f')][_0x6a78('0x48')];_0x2b8ded++){var _0x1c6cf2=_0x499ce0[_0x6a78('0x9f')][_0x2b8ded];var _0x22d373=path[_0x6a78('0x6f')](_0x3b603a,_0x1c6cf2[_0x6a78('0x72')]);if(fs[_0x6a78('0xa3')](_0x22d373)){_0x41928a[_0x6a78('0x6e')]['push']({'name':_0x1c6cf2[_0x6a78('0x3a')],'contentType':_0x1c6cf2[_0x6a78('0x41')],'data':fs[_0x6a78('0xa4')](_0x22d373)});}}}emlformat[_0x6a78('0xa5')](_0x41928a,function(_0x1c68f2,_0x2d19bb){if(_0x1c68f2)return _0x336dd1(_0x1c68f2);fs[_0x6a78('0xa6')](path[_0x6a78('0x6f')](_0x46614e,_0x36b425),_0x2d19bb);return _0x4938b7(_0x2d19bb);});});}})[_0x6a78('0x27')](function(_0x20ba48){if(_0x20ba48){return _0x105e4d[_0x6a78('0x95')](path[_0x6a78('0x6f')](_0x46614e,_0x36b425),_0x36b425,function(_0x2436dd){if(_0x2436dd){console['log'](_0x6a78('0xa7'),_0x2436dd);}else{fs[_0x6a78('0xa8')](path['join'](_0x46614e,_0x36b425));}});}})[_0x6a78('0x2f')](handleError(_0x105e4d,null));}; \ No newline at end of file +var _0xde02=['mail-interactions','mail','read','readAt','format','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','UserId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','download','unix','toString','files','from','bcc','createdAt','subject','headers','Bcc','Attachments','readFileSync','build','writeFileSync','err','unlinkSync','html-pdf','eml-format','rimraf','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','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','body','destroy','describe','create','direction','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','host','port','secure','auth','pass','service','attachments','length','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xde02,0xd5));var _0x2de0=function(_0x5823a7,_0x1c6d9e){_0x5823a7=_0x5823a7-0x0;var _0x35c2c2=_0xde02[_0x5823a7];return _0x35c2c2;};'use strict';var pdf=require(_0x2de0('0x0'));var emlformat=require(_0x2de0('0x1'));var rimraf=require(_0x2de0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2de0('0x3'));var moment=require(_0x2de0('0x4'));var BPromise=require(_0x2de0('0x5'));var Mustache=require('mustache');var util=require(_0x2de0('0x6'));var path=require(_0x2de0('0x7'));var sox=require(_0x2de0('0x8'));var csv=require(_0x2de0('0x9'));var ejs=require(_0x2de0('0xa'));var fs=require('fs');var _=require(_0x2de0('0xb'));var squel=require(_0x2de0('0xc'));var crypto=require(_0x2de0('0xd'));var jsforce=require(_0x2de0('0xe'));var deskjs=require(_0x2de0('0xf'));var toCsv=require(_0x2de0('0x9'));var querystring=require(_0x2de0('0x10'));var Papa=require(_0x2de0('0x11'));var Redis=require(_0x2de0('0x12'));var authService=require(_0x2de0('0x13'));var qs=require(_0x2de0('0x14'));var as=require(_0x2de0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2de0('0x16'))(_0x2de0('0x17'));var utils=require(_0x2de0('0x18'));var config=require(_0x2de0('0x19'));var db=require(_0x2de0('0x1a'))['db'];config[_0x2de0('0x1b')]=_[_0x2de0('0x1c')](config[_0x2de0('0x1b')],{'host':_0x2de0('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2de0('0x1b')]));require(_0x2de0('0x1e'))[_0x2de0('0x1f')](socket);var jayson=require(_0x2de0('0x20'));var client=jayson[_0x2de0('0x21')][_0x2de0('0x22')]({'port':0x232c});var client9003=jayson['client'][_0x2de0('0x22')]({'port':0x232b});var client9002=jayson[_0x2de0('0x21')][_0x2de0('0x22')]({'port':0x232a});function checkPasswordPattern(_0x9f062f,_0x30a16b,_0x1f56e5){if(_0x1f56e5){var _0x469a0c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x469a0c[_0x2de0('0x23')](_0x30a16b)){return _0x9f062f;}else{throw new db[(_0x2de0('0x24'))]['ValidationError'](_0x2de0('0x25'));}}else{return _0x9f062f;}}function respondWithRpcPromise(_0x596b61,_0x189c85,_0x20d3cf,_0x1ab43a){return new BPromise(function(_0x47326d,_0x56f627){var _0x32e553=_0x1ab43a||client;return _0x32e553[_0x2de0('0x26')](_0x596b61,_0x20d3cf)[_0x2de0('0x27')](function(_0x50fcdd){logger[_0x2de0('0x28')](_0x2de0('0x29'),_0x189c85,_0x2de0('0x2a'));logger[_0x2de0('0x2b')](_0x2de0('0x2c'),_0x189c85,_0x2de0('0x2a'),JSON[_0x2de0('0x2d')](_0x50fcdd));if(_0x50fcdd[_0x2de0('0x2e')]){if(_0x50fcdd[_0x2de0('0x2e')][_0x2de0('0x2f')]===0x1f4){logger[_0x2de0('0x2e')](_0x2de0('0x29'),_0x189c85,_0x50fcdd[_0x2de0('0x2e')][_0x2de0('0x30')]);return _0x56f627(_0x50fcdd[_0x2de0('0x2e')][_0x2de0('0x30')]);}logger[_0x2de0('0x2e')]('MailMessage,\x20%s,\x20%s',_0x189c85,_0x50fcdd['error']['message']);return _0x47326d(_0x50fcdd[_0x2de0('0x2e')][_0x2de0('0x30')]);}else{logger[_0x2de0('0x28')](_0x2de0('0x29'),_0x189c85,_0x2de0('0x2a'));_0x47326d(_0x50fcdd[_0x2de0('0x31')][_0x2de0('0x30')]);}})[_0x2de0('0x32')](function(_0x5e81ce){logger[_0x2de0('0x2e')](_0x2de0('0x29'),_0x189c85,_0x5e81ce);_0x56f627(_0x5e81ce);});});}function respondWithStatusCode(_0x2a0e92,_0x448cf7){_0x448cf7=_0x448cf7||0xcc;return function(_0x17575a){if(_0x17575a){return _0x2a0e92[_0x2de0('0x33')](_0x448cf7);}return _0x2a0e92[_0x2de0('0x34')](_0x448cf7)['end']();};}function respondWithResult(_0x982303,_0x32c30c){_0x32c30c=_0x32c30c||0xc8;return function(_0x24cd80){if(_0x24cd80){return _0x982303[_0x2de0('0x34')](_0x32c30c)[_0x2de0('0x35')](_0x24cd80);}};}function respondWithFilteredResult(_0x37224e,_0x219da4){return function(_0x2f0683){if(_0x2f0683){var _0x1e098c=_0x2f0683[_0x2de0('0x36')],_0x53c639=_0x219da4[_0x2de0('0x37')],_0x47d35a=_0x219da4[_0x2de0('0x37')]+_0x219da4[_0x2de0('0x38')],_0x2b4494;if(_0x47d35a>=_0x1e098c){_0x47d35a=_0x1e098c;_0x2b4494=0xc8;}else{_0x2b4494=0xce;}_0x37224e[_0x2de0('0x34')](_0x2b4494);return _0x37224e[_0x2de0('0x39')]('Content-Range',_0x53c639+'-'+_0x47d35a+'/'+_0x1e098c)[_0x2de0('0x35')](_0x2f0683);}return null;};}function patchUpdates(_0xf78a5f){return function(_0xdd582f){try{jsonpatch[_0x2de0('0x3a')](_0xdd582f,_0xf78a5f,!![]);}catch(_0x414b21){return BPromise[_0x2de0('0x3b')](_0x414b21);}return _0xdd582f[_0x2de0('0x3c')]();};}function saveUpdates(_0x1a17d2,_0x647619){return function(_0x414f2f){if(_0x414f2f){return _0x414f2f[_0x2de0('0x3d')](_0x1a17d2)[_0x2de0('0x27')](function(_0xdcb90){return _0xdcb90;});}return null;};}function removeEntity(_0x254bb9,_0x3042b1){return function(_0xd4fdb8){if(_0xd4fdb8){return _0xd4fdb8['destroy']()[_0x2de0('0x27')](function(){_0x254bb9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38fa45,_0xb78aa){return function(_0x555c2d){if(!_0x555c2d){_0x38fa45[_0x2de0('0x33')](0x194);}return _0x555c2d;};}function handleError(_0x4dbbf1,_0xe7917d){_0xe7917d=_0xe7917d||0x1f4;return function(_0x315485){logger[_0x2de0('0x2e')](_0x315485[_0x2de0('0x3e')]);if(_0x315485[_0x2de0('0x3f')]){delete _0x315485[_0x2de0('0x3f')];}_0x4dbbf1[_0x2de0('0x34')](_0xe7917d)[_0x2de0('0x40')](_0x315485);};}exports[_0x2de0('0x41')]=function(_0x4df92b,_0x365adf){var _0x2082db={},_0x4079c0={},_0x1b7e35={'count':0x0,'rows':[]};var _0x3882fa=_[_0x2de0('0x42')](db[_0x2de0('0x43')][_0x2de0('0x44')],function(_0x530606){return{'name':_0x530606[_0x2de0('0x45')],'type':_0x530606[_0x2de0('0x46')][_0x2de0('0x47')]};});_0x4079c0[_0x2de0('0x48')]=_[_0x2de0('0x42')](_0x3882fa,_0x2de0('0x3f'));_0x4079c0[_0x2de0('0x49')]=_[_0x2de0('0x4a')](_0x4df92b[_0x2de0('0x49')]);_0x4079c0[_0x2de0('0x4b')]=_[_0x2de0('0x4c')](_0x4079c0[_0x2de0('0x48')],_0x4079c0[_0x2de0('0x49')]);_0x2082db[_0x2de0('0x4d')]=_['intersection'](_0x4079c0[_0x2de0('0x48')],qs[_0x2de0('0x4e')](_0x4df92b['query'][_0x2de0('0x4e')]));_0x2082db[_0x2de0('0x4d')]=_0x2082db[_0x2de0('0x4d')]['length']?_0x2082db['attributes']:_0x4079c0['model'];if(!_0x4df92b[_0x2de0('0x49')][_0x2de0('0x4f')](_0x2de0('0x50'))){_0x2082db['limit']=qs[_0x2de0('0x38')](_0x4df92b[_0x2de0('0x49')][_0x2de0('0x38')]);_0x2082db['offset']=qs[_0x2de0('0x37')](_0x4df92b[_0x2de0('0x49')][_0x2de0('0x37')]);}_0x2082db[_0x2de0('0x51')]=qs[_0x2de0('0x52')](_0x4df92b[_0x2de0('0x49')][_0x2de0('0x52')]);_0x2082db[_0x2de0('0x53')]=qs['filters'](_[_0x2de0('0x54')](_0x4df92b[_0x2de0('0x49')],_0x4079c0['filters']),_0x3882fa);if(_0x4df92b[_0x2de0('0x49')]['filter']){_0x2082db[_0x2de0('0x53')]=_[_0x2de0('0x55')](_0x2082db[_0x2de0('0x53')],{'$or':_[_0x2de0('0x42')](_0x3882fa,function(_0x27ac80){if(_0x27ac80[_0x2de0('0x46')]!=='VIRTUAL'){var _0x47bc9c={};_0x47bc9c[_0x27ac80[_0x2de0('0x3f')]]={'$like':'%'+_0x4df92b[_0x2de0('0x49')][_0x2de0('0x56')]+'%'};return _0x47bc9c;}})});}_0x2082db=_[_0x2de0('0x55')]({},_0x2082db,_0x4df92b[_0x2de0('0x57')]);var _0x486b01={'where':_0x2082db[_0x2de0('0x53')]};return db['MailMessage'][_0x2de0('0x36')](_0x486b01)[_0x2de0('0x27')](function(_0x1413c7){_0x1b7e35[_0x2de0('0x36')]=_0x1413c7;if(_0x4df92b['query'][_0x2de0('0x58')]){_0x2082db[_0x2de0('0x59')]=[{'all':!![]}];}return db[_0x2de0('0x43')][_0x2de0('0x5a')](_0x2082db);})[_0x2de0('0x27')](function(_0x2dfc8c){_0x1b7e35[_0x2de0('0x5b')]=_0x2dfc8c;return _0x1b7e35;})[_0x2de0('0x27')](respondWithFilteredResult(_0x365adf,_0x2082db))[_0x2de0('0x32')](handleError(_0x365adf,null));};exports[_0x2de0('0x5c')]=function(_0x14e104,_0x4f6232){var _0x12c08b={'raw':!![],'where':{'id':_0x14e104[_0x2de0('0x5d')]['id']}},_0x470a79={};_0x470a79[_0x2de0('0x48')]=_[_0x2de0('0x4a')](db['MailMessage'][_0x2de0('0x44')]);_0x470a79['query']=_[_0x2de0('0x4a')](_0x14e104[_0x2de0('0x49')]);_0x470a79[_0x2de0('0x4b')]=_[_0x2de0('0x4c')](_0x470a79[_0x2de0('0x48')],_0x470a79['query']);_0x12c08b['attributes']=_['intersection'](_0x470a79[_0x2de0('0x48')],qs[_0x2de0('0x4e')](_0x14e104[_0x2de0('0x49')]['fields']));_0x12c08b['attributes']=_0x12c08b[_0x2de0('0x4d')]['length']?_0x12c08b[_0x2de0('0x4d')]:_0x470a79['model'];if(_0x14e104[_0x2de0('0x49')][_0x2de0('0x58')]){_0x12c08b[_0x2de0('0x59')]=[{'all':!![]}];}_0x12c08b=_[_0x2de0('0x55')]({},_0x12c08b,_0x14e104[_0x2de0('0x57')]);return db['MailMessage'][_0x2de0('0x5e')](_0x12c08b)['then'](handleEntityNotFound(_0x4f6232,null))[_0x2de0('0x27')](respondWithResult(_0x4f6232,null))[_0x2de0('0x32')](handleError(_0x4f6232,null));};exports['update']=function(_0xf30b27,_0x36904b){if(_0xf30b27['body']['id']){delete _0xf30b27[_0x2de0('0x5f')]['id'];}return db['MailMessage'][_0x2de0('0x5e')]({'where':{'id':_0xf30b27[_0x2de0('0x5d')]['id']}})[_0x2de0('0x27')](handleEntityNotFound(_0x36904b,null))[_0x2de0('0x27')](saveUpdates(_0xf30b27[_0x2de0('0x5f')],null))['then'](respondWithResult(_0x36904b,null))[_0x2de0('0x32')](handleError(_0x36904b,null));};exports[_0x2de0('0x60')]=function(_0x2bf510,_0x1e5cbb){return db[_0x2de0('0x43')]['find']({'where':{'id':_0x2bf510['params']['id']}})[_0x2de0('0x27')](handleEntityNotFound(_0x1e5cbb,null))[_0x2de0('0x27')](removeEntity(_0x1e5cbb,null))[_0x2de0('0x32')](handleError(_0x1e5cbb,null));};exports['describe']=function(_0x54d5f5,_0x22efc8){return db['MailMessage'][_0x2de0('0x61')]()['then'](respondWithResult(_0x22efc8,null))[_0x2de0('0x32')](handleError(_0x22efc8,null));};exports['create']=function(_0x5cca2e,_0x372894){return db[_0x2de0('0x43')][_0x2de0('0x62')](_0x5cca2e[_0x2de0('0x5f')])[_0x2de0('0x27')](function(_0x4ee24f){if(_0x4ee24f){if(_0x4ee24f[_0x2de0('0x63')]==='out'&&!_0x4ee24f[_0x2de0('0x64')]){var _0x4d2c8a,_0x243e94,_0x37167f;if(_0x5cca2e['body']['to']){_0x243e94=_0x5cca2e[_0x2de0('0x5f')]['to'][_0x2de0('0x65')](',')[0x0];}return db[_0x2de0('0x66')]['findOne']({'where':{'id':_0x4ee24f[_0x2de0('0x67')]},'include':[{'model':db[_0x2de0('0x68')],'as':_0x2de0('0x69'),'include':[{'model':db[_0x2de0('0x6a')],'as':'Contacts','where':{'email':_0x243e94},'limit':0x1,'order':[['updatedAt',_0x2de0('0x6b')]]}]},{'model':db[_0x2de0('0x6c')],'as':_0x2de0('0x6d'),'raw':!![]}]})[_0x2de0('0x27')](function(_0x16f21e){_0x4d2c8a=_0x16f21e;if(_0x4d2c8a&&_0x4d2c8a['Smtp']){var _0x304a20={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x4d2c8a['Smtp']['service'])){_0x304a20[_0x2de0('0x6e')]=_0x4d2c8a[_0x2de0('0x6d')][_0x2de0('0x6e')];_0x304a20['port']=_0x4d2c8a['Smtp'][_0x2de0('0x6f')];_0x304a20[_0x2de0('0x70')]=_0x4d2c8a[_0x2de0('0x6d')][_0x2de0('0x70')];if(_0x4d2c8a[_0x2de0('0x6d')]['authentication']){_0x304a20[_0x2de0('0x71')]={'user':_0x4d2c8a['Smtp']['user'],'pass':_0x4d2c8a[_0x2de0('0x6d')][_0x2de0('0x72')]};}}else{_0x304a20[_0x2de0('0x73')]=_0x4d2c8a[_0x2de0('0x6d')][_0x2de0('0x73')];_0x304a20['auth']={'user':_0x4d2c8a[_0x2de0('0x6d')]['user'],'pass':_0x4d2c8a['Smtp'][_0x2de0('0x72')]};_0x304a20[_0x2de0('0x70')]=_0x4d2c8a[_0x2de0('0x6d')]['secure'];}if(_0x5cca2e[_0x2de0('0x5f')][_0x2de0('0x74')]&&_0x5cca2e[_0x2de0('0x5f')]['attachments']['length']){for(var _0x50316b=0x0;_0x50316b<_0x5cca2e['body'][_0x2de0('0x74')][_0x2de0('0x75')];_0x50316b+=0x1){_0x5cca2e[_0x2de0('0x5f')]['attachments'][_0x50316b]={'filename':_0x5cca2e[_0x2de0('0x5f')][_0x2de0('0x74')][_0x50316b][_0x2de0('0x3f')],'path':path[_0x2de0('0x76')](config[_0x2de0('0x77')],_0x2de0('0x78'),_0x5cca2e['body'][_0x2de0('0x74')][_0x50316b][_0x2de0('0x79')])};}}_0x37167f={'account':_0x304a20,'message':_0x5cca2e[_0x2de0('0x5f')]};return;}})['then'](function(){if(_0x4d2c8a[_0x2de0('0x69')]){if(_0x4d2c8a[_0x2de0('0x69')]['Contacts'][_0x2de0('0x75')]){return _0x4d2c8a[_0x2de0('0x69')][_0x2de0('0x7a')][0x0];}else{return db[_0x2de0('0x6a')][_0x2de0('0x62')](_[_0x2de0('0x1c')](_0x5cca2e[_0x2de0('0x5f')],{'firstName':_0x5cca2e[_0x2de0('0x5f')]['to'],'email':_0x5cca2e[_0x2de0('0x5f')]['to'],'phone':_0x5cca2e['body']['to'],'ListId':_0x4d2c8a[_0x2de0('0x7b')]}));}}else{throw new Error(_0x2de0('0x7c'));}})['then'](function(){if(_0x37167f){return respondWithRpcPromise(_0x2de0('0x7d'),'sendMail',_0x37167f,client9003)[_0x2de0('0x27')](function(_0x3793ce){return _0x4ee24f['update']({'read':!![],'messageId':_0x3793ce['messageId'],'sentAt':moment()['format'](_0x2de0('0x7e'))});})['catch'](function(_0x4ce790){logger[_0x2de0('0x2e')]('%s',JSON['stringify'](_0x4ce790));return _0x4ee24f;});}return _0x4ee24f;});}return _0x4ee24f;}})['then'](respondWithResult(_0x372894,0xc9))[_0x2de0('0x32')](handleError(_0x372894,null));};var interaction_log=require(_0x2de0('0x16'))(_0x2de0('0x7f'));exports['accept']=function(_0x118e58,_0x9ee2e3,_0x14d9fe){var _0x1c638d={'channel':_0x2de0('0x80')};if(_0x118e58['body']['id']){delete _0x118e58[_0x2de0('0x5f')]['id'];}_0x118e58[_0x2de0('0x5f')][_0x2de0('0x81')]=!![];_0x118e58[_0x2de0('0x5f')][_0x2de0('0x82')]=moment()[_0x2de0('0x83')](_0x2de0('0x7e'));_0x118e58[_0x2de0('0x5f')]['UserId']=_0x118e58[_0x2de0('0x5f')]['UserId']||_0x118e58[_0x2de0('0x84')]['id'];return db[_0x2de0('0x43')][_0x2de0('0x5e')]({'where':{'id':_0x118e58[_0x2de0('0x5d')]['id'],'UserId':null},'include':[{'model':db[_0x2de0('0x6a')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x9ee2e3,null))[_0x2de0('0x27')](saveUpdates(_0x118e58[_0x2de0('0x5f')],null))['then'](function(_0x4c0596){if(_0x4c0596){_0x1c638d[_0x2de0('0x30')]=_0x4c0596[_0x2de0('0x85')]({'plain':!![]});return db[_0x2de0('0x86')][_0x2de0('0x5e')]({'where':{'id':_0x4c0596[_0x2de0('0x87')]}});}return null;})[_0x2de0('0x27')](handleEntityNotFound(_0x9ee2e3,null))[_0x2de0('0x27')](function(_0x1f4d3b){if(_0x1f4d3b){return _0x1f4d3b[_0x2de0('0x3d')]({'UserId':_0x118e58[_0x2de0('0x5f')]['UserId'],'read1stAt':_[_0x2de0('0x88')](_0x1f4d3b[_0x2de0('0x89')])?moment()[_0x2de0('0x83')](_0x2de0('0x7e')):undefined});}return null;})[_0x2de0('0x27')](function(_0x3e6f92){if(_0x3e6f92){_0x1c638d[_0x2de0('0x8a')]=_0x3e6f92[_0x2de0('0x85')]({'plain':!![]});interaction_log[_0x2de0('0x28')](_0x2de0('0x8b'),_0x118e58[_0x2de0('0x84')]['id'],_0x118e58[_0x2de0('0x84')][_0x2de0('0x3f')],_0x118e58[_0x2de0('0x84')][_0x2de0('0x8c')],_0x1c638d[_0x2de0('0x8a')]['id'],_0x118e58[_0x2de0('0x5f')]?JSON['stringify'](_0x118e58[_0x2de0('0x5f')]):_0x2de0('0x8d'));return respondWithRpcPromise(_0x2de0('0x8e'),'acceptMessage',_0x1c638d);}return null;})[_0x2de0('0x27')](function(_0x1d09ba){if(_0x1d09ba){if(_0x118e58[_0x2de0('0x5f')][_0x2de0('0x8f')]){_0x1c638d['message'][_0x2de0('0x90')]=util['format'](_0x2de0('0x91'),_0x118e58['user']['name']);_0x1c638d[_0x2de0('0x30')][_0x2de0('0x92')]=_0x1c638d['channel'];_0x1c638d[_0x2de0('0x30')][_0x2de0('0x93')]='accept';return respondWithRpcPromise('EventManager',_0x2de0('0x94'),{'event':_0x2de0('0x95'),'message':_0x1c638d['message']},client9002)[_0x2de0('0x27')](function(){return _0x1c638d;});}return _0x1c638d;}return null;})[_0x2de0('0x27')](respondWithResult(_0x9ee2e3,null))[_0x2de0('0x32')](handleError(_0x9ee2e3,null));};var interaction_log=require(_0x2de0('0x16'))(_0x2de0('0x7f'));exports[_0x2de0('0x3b')]=function(_0x3038cf,_0x2b1bf2,_0x21167d){var _0x5abb71={'agent':{},'channel':_0x2de0('0x80')};if(_0x3038cf[_0x2de0('0x5f')]['id']){delete _0x3038cf[_0x2de0('0x5f')]['id'];}_0x3038cf[_0x2de0('0x5f')][_0x2de0('0x96')]=_0x3038cf[_0x2de0('0x5f')][_0x2de0('0x96')]||_0x3038cf[_0x2de0('0x84')]['id'];_0x5abb71['agent']['id']=_0x3038cf[_0x2de0('0x5f')][_0x2de0('0x96')];return db[_0x2de0('0x43')][_0x2de0('0x5e')]({'where':{'id':_0x3038cf[_0x2de0('0x5d')]['id'],'UserId':null}})[_0x2de0('0x27')](handleEntityNotFound(_0x2b1bf2,null))[_0x2de0('0x27')](function(_0x29a538){if(_0x29a538){_0x5abb71[_0x2de0('0x30')]=_0x29a538[_0x2de0('0x85')]({'plain':!![]});return db[_0x2de0('0x86')][_0x2de0('0x5e')]({'where':{'id':_0x29a538[_0x2de0('0x87')]}});}return null;})[_0x2de0('0x27')](handleEntityNotFound(_0x2b1bf2,null))[_0x2de0('0x27')](function(_0x464a50){if(_0x464a50){_0x5abb71['interaction']=_0x464a50[_0x2de0('0x85')]({'plain':!![]});interaction_log[_0x2de0('0x28')](_0x2de0('0x97'),_0x3038cf[_0x2de0('0x84')]['id'],_0x3038cf[_0x2de0('0x84')][_0x2de0('0x3f')],_0x3038cf[_0x2de0('0x84')][_0x2de0('0x8c')],_0x5abb71[_0x2de0('0x8a')]['id'],_0x3038cf[_0x2de0('0x5f')]?JSON[_0x2de0('0x2d')](_0x3038cf[_0x2de0('0x5f')]):_0x2de0('0x8d'));return respondWithRpcPromise(_0x2de0('0x98'),'rejectMessage',_0x5abb71);}return null;})[_0x2de0('0x27')](function(_0x2cc538){if(_0x2cc538){_0x2cc538[_0x2de0('0x30')][_0x2de0('0x90')]=util[_0x2de0('0x83')](_0x2de0('0x91'),_0x3038cf[_0x2de0('0x84')][_0x2de0('0x3f')]);_0x2cc538[_0x2de0('0x30')]['channel']=_0x5abb71[_0x2de0('0x92')];_0x2cc538[_0x2de0('0x30')]['event']=_0x2de0('0x3b');respondWithRpcPromise('EventManager',_0x2de0('0x94'),{'event':_0x2de0('0x99'),'message':_0x2cc538[_0x2de0('0x30')]},client9002);return _0x5abb71;}return null;})[_0x2de0('0x27')](respondWithResult(_0x2b1bf2,null))[_0x2de0('0x32')](handleError(_0x2b1bf2,null));};exports[_0x2de0('0x9a')]=function(_0xf8cd82,_0x3d4957){var _0x51185e=moment()[_0x2de0('0x9b')]()[_0x2de0('0x9c')]();var _0x31fd64=path['join'](config['root'],'server',_0x2de0('0x9d'),'tmp');var _0x3a68d8=path[_0x2de0('0x76')](config['root'],'server',_0x2de0('0x9d'),_0x2de0('0x74'));var _0x1be49a=util[_0x2de0('0x83')]('message-%s.eml',_0x51185e);return db['MailMessage'][_0x2de0('0x5e')]({'where':{'id':_0xf8cd82[_0x2de0('0x5d')]['id']},'attributes':['id',_0x2de0('0x5f'),_0x2de0('0x9e'),'to','cc',_0x2de0('0x9f'),'subject',_0x2de0('0xa0')],'include':_0xf8cd82[_0x2de0('0x49')][_0x2de0('0x74')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x2de0('0x27')](handleEntityNotFound(_0x3d4957,null))[_0x2de0('0x27')](function(_0x280298){if(_0x280298){var _0x551b6f=_0x280298;var _0x22f7ba={'from':_0x551b6f['from'],'to':_0x551b6f['to'],'subject':_0x551b6f[_0x2de0('0xa1')],'html':_0x551b6f[_0x2de0('0x5f')],'headers':{'Date':moment(_0x551b6f[_0x2de0('0xa0')])[_0x2de0('0x83')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x280298['cc']){_0x22f7ba[_0x2de0('0xa2')]['Cc']=_0x280298['cc'];}if(_0x280298[_0x2de0('0x9f')]){_0x22f7ba[_0x2de0('0xa2')][_0x2de0('0xa3')]=_0x280298[_0x2de0('0x9f')];}return new BPromise(function(_0x258b3a,_0x1fb37b){if(_0x280298[_0x2de0('0xa4')]){for(var _0x32c20f=0x0;_0x32c20f<_0x280298['Attachments'][_0x2de0('0x75')];_0x32c20f++){var _0x35b117=_0x280298[_0x2de0('0xa4')][_0x32c20f];var _0x5902cb=path[_0x2de0('0x76')](_0x3a68d8,_0x35b117[_0x2de0('0x79')]);if(fs['existsSync'](_0x5902cb)){_0x22f7ba[_0x2de0('0x74')]['push']({'name':_0x35b117[_0x2de0('0x3f')],'contentType':_0x35b117[_0x2de0('0x46')],'data':fs[_0x2de0('0xa5')](_0x5902cb)});}}}emlformat[_0x2de0('0xa6')](_0x22f7ba,function(_0x45f10c,_0x3d07f2){if(_0x45f10c)return _0x1fb37b(_0x45f10c);fs[_0x2de0('0xa7')](path[_0x2de0('0x76')](_0x31fd64,_0x1be49a),_0x3d07f2);return _0x258b3a(_0x3d07f2);});});}})[_0x2de0('0x27')](function(_0x154159){if(_0x154159){return _0x3d4957[_0x2de0('0x9a')](path[_0x2de0('0x76')](_0x31fd64,_0x1be49a),_0x1be49a,function(_0x3e0a8b){if(_0x3e0a8b){console['log'](_0x2de0('0xa8'),_0x3e0a8b);}else{fs[_0x2de0('0xa9')](path[_0x2de0('0x76')](_0x31fd64,_0x1be49a));}});}})['catch'](handleError(_0x3d4957,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3467309..0fa33a7 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 _0x4aaa=['hook','exports','events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x13587e,_0x4e4afd){var _0x25d01d=function(_0x2d6226){while(--_0x2d6226){_0x13587e['push'](_0x13587e['shift']());}};_0x25d01d(++_0x4e4afd);}(_0x4aaa,0x70));var _0xa4aa=function(_0x2ee461,_0x292283){_0x2ee461=_0x2ee461-0x0;var _0x5bad40=_0x4aaa[_0x2ee461];return _0x5bad40;};'use strict';var EventEmitter=require(_0xa4aa('0x0'));var MailMessage=require(_0xa4aa('0x1'))['db'][_0xa4aa('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa4aa('0x3'),'afterUpdate':_0xa4aa('0x4'),'afterDestroy':_0xa4aa('0x5')};function emitEvent(_0x23169e){return function(_0x298da1,_0x4eae19,_0x246800){MailMessageEvents[_0xa4aa('0x6')](_0x23169e+':'+_0x298da1['id'],_0x298da1);MailMessageEvents[_0xa4aa('0x6')](_0x23169e,_0x298da1);_0x246800(null);};}for(var e in events){if(events[_0xa4aa('0x7')](e)){var event=events[e];MailMessage[_0xa4aa('0x8')](e,emitEvent(event));}}module[_0xa4aa('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x4284=['exports','events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x596541,_0x3e674e){var _0x4e3383=function(_0x1c82a9){while(--_0x1c82a9){_0x596541['push'](_0x596541['shift']());}};_0x4e3383(++_0x3e674e);}(_0x4284,0x97));var _0x4428=function(_0x2cccbf,_0x3183bc){_0x2cccbf=_0x2cccbf-0x0;var _0x23e46e=_0x4284[_0x2cccbf];return _0x23e46e;};'use strict';var EventEmitter=require(_0x4428('0x0'));var MailMessage=require(_0x4428('0x1'))['db'][_0x4428('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4428('0x3'),'afterUpdate':_0x4428('0x4'),'afterDestroy':_0x4428('0x5')};function emitEvent(_0x248c78){return function(_0x4ac935,_0x1a7643,_0x3ccc94){MailMessageEvents[_0x4428('0x6')](_0x248c78+':'+_0x4ac935['id'],_0x4ac935);MailMessageEvents['emit'](_0x248c78,_0x4ac935);_0x3ccc94(null);};}for(var e in events){if(events[_0x4428('0x7')](e)){var event=events[e];MailMessage[_0x4428('0x8')](e,emitEvent(event));}}module[_0x4428('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 4e74f0f..16ab0cb 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 _0x7b4d=['toLowerCase','direction','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models'];(function(_0x29a08d,_0x551eca){var _0x10fc1a=function(_0x4a2117){while(--_0x4a2117){_0x29a08d['push'](_0x29a08d['shift']());}};_0x10fc1a(++_0x551eca);}(_0x7b4d,0x11c));var _0xd7b4=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x7b4d[_0x367336];return _0x3423a7;};'use strict';var _=require(_0xd7b4('0x0'));var util=require(_0xd7b4('0x1'));var logger=require(_0xd7b4('0x2'))(_0xd7b4('0x3'));var moment=require(_0xd7b4('0x4'));var BPromise=require('bluebird');var rp=require(_0xd7b4('0x5'));var htmlToText=require(_0xd7b4('0x6'));var fs=require('fs');var path=require(_0xd7b4('0x7'));var rimraf=require(_0xd7b4('0x8'));var config=require(_0xd7b4('0x9'));var attributes=require(_0xd7b4('0xa'));module[_0xd7b4('0xb')]=function(_0x2c8156,_0x3f07b7){return _0x2c8156[_0xd7b4('0xc')](_0xd7b4('0xd'),attributes,{'tableName':_0xd7b4('0xe'),'paranoid':![],'indexes':[{'name':_0xd7b4('0xf'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0xd7b4('0x10'),_0xd7b4('0x11')],'type':_0xd7b4('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44a4c7,_0xdf4992,_0xead0ec){if(_0x44a4c7[_0xd7b4('0x13')]){_0x44a4c7['plainBody']=htmlToText[_0xd7b4('0x14')](_0x44a4c7[_0xd7b4('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xead0ec(null,_0xdf4992);},'afterCreate':function(_0x32c8db,_0x1f5e3c,_0x505c5d){var _0x32b90d=_0x2c8156[_0xd7b4('0x15')];var _0x45f76b=_0x32c8db['get']({'plain':!![]});if(_0x45f76b['direction'][_0xd7b4('0x16')]()==='in'||_0x45f76b[_0xd7b4('0x17')][_0xd7b4('0x16')]()==='out'&&!_0x45f76b[_0xd7b4('0x18')]&&!_[_0xd7b4('0x19')](_0x45f76b[_0xd7b4('0x1a')])){_0x32b90d[_0xd7b4('0x1b')][_0xd7b4('0x1c')]({'where':{'id':_0x45f76b[_0xd7b4('0x1d')]}})['then'](function(_0x77352){if(_0x77352){_0x77352[_0xd7b4('0x1e')]({'lastMsgAt':_0x45f76b['createdAt'],'lastMsgDirection':_0x45f76b['direction'][_0xd7b4('0x16')](),'lastMsgBody':_0x45f76b[_0xd7b4('0x13')]});}})[_0xd7b4('0x1f')](function(_0x25444d){console[_0xd7b4('0x20')](_0x25444d);});}_0x505c5d();}},'charset':_0xd7b4('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2ce3=['fti_mail_messages','plainBody','subject','fromString','models','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','createdAt','body','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId'];(function(_0x5828d0,_0x2c3e93){var _0x239b02=function(_0x702fe4){while(--_0x702fe4){_0x5828d0['push'](_0x5828d0['shift']());}};_0x239b02(++_0x2c3e93);}(_0x2ce3,0x98));var _0x32ce=function(_0x7d5b36,_0x6c122a){_0x7d5b36=_0x7d5b36-0x0;var _0x10b0fb=_0x2ce3[_0x7d5b36];return _0x10b0fb;};'use strict';var _=require(_0x32ce('0x0'));var util=require('util');var logger=require(_0x32ce('0x1'))(_0x32ce('0x2'));var moment=require(_0x32ce('0x3'));var BPromise=require(_0x32ce('0x4'));var rp=require(_0x32ce('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x32ce('0x6'));var rimraf=require('rimraf');var config=require(_0x32ce('0x7'));var attributes=require(_0x32ce('0x8'));module[_0x32ce('0x9')]=function(_0xe65493,_0x292d25){return _0xe65493['define'](_0x32ce('0xa'),attributes,{'tableName':_0x32ce('0xb'),'paranoid':![],'indexes':[{'name':_0x32ce('0xc'),'fields':['messageId']},{'name':_0x32ce('0xd'),'fields':[_0x32ce('0xe'),_0x32ce('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3193bb,_0x3ac3be,_0x241cb4){if(_0x3193bb['body']){_0x3193bb[_0x32ce('0xe')]=htmlToText[_0x32ce('0x10')](_0x3193bb['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x241cb4(null,_0x3ac3be);},'afterCreate':function(_0x2f651d,_0x356be8,_0xb52ba5){var _0x2baaea=_0xe65493[_0x32ce('0x11')];var _0x50ad55=_0x2f651d['get']({'plain':!![]});if(_0x50ad55['direction'][_0x32ce('0x12')]()==='in'||_0x50ad55[_0x32ce('0x13')][_0x32ce('0x12')]()===_0x32ce('0x14')&&!_0x50ad55[_0x32ce('0x15')]&&!_[_0x32ce('0x16')](_0x50ad55[_0x32ce('0x17')])){_0x2baaea[_0x32ce('0x18')][_0x32ce('0x19')]({'where':{'id':_0x50ad55[_0x32ce('0x1a')]}})['then'](function(_0xfcce56){if(_0xfcce56){_0xfcce56['update']({'lastMsgAt':_0x50ad55[_0x32ce('0x1b')],'lastMsgDirection':_0x50ad55[_0x32ce('0x13')][_0x32ce('0x12')](),'lastMsgBody':_0x50ad55[_0x32ce('0x1c')]});}})[_0x32ce('0x1d')](function(_0x5e3812){console[_0x32ce('0x1e')](_0x5e3812);});}_0xb52ba5();}},'charset':_0x32ce('0x1f'),'collate':_0x32ce('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4218566..5c4c000 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 _0x78e0=['options','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body'];(function(_0x50d544,_0x578bad){var _0x510a38=function(_0x574e13){while(--_0x574e13){_0x50d544['push'](_0x50d544['shift']());}};_0x510a38(++_0x578bad);}(_0x78e0,0x13e));var _0x078e=function(_0x1c0028,_0x1ffe06){_0x1c0028=_0x1c0028-0x0;var _0x4c3b77=_0x78e0[_0x1c0028];return _0x4c3b77;};'use strict';var _=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var moment=require(_0x078e('0x2'));var BPromise=require(_0x078e('0x3'));var rs=require(_0x078e('0x4'));var fs=require('fs');var Redis=require(_0x078e('0x5'));var db=require(_0x078e('0x6'))['db'];var utils=require(_0x078e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x078e('0x8'));var jayson=require(_0x078e('0x9'));var client=jayson[_0x078e('0xa')][_0x078e('0xb')]({'port':0x232a});config[_0x078e('0xc')]=_['defaults'](config[_0x078e('0xc')],{'host':_0x078e('0xd'),'port':0x18eb});var socket=require(_0x078e('0xe'))(new Redis(config[_0x078e('0xc')]));require(_0x078e('0xf'))[_0x078e('0x10')](socket);function respondWithRpcPromise(_0x1f6779,_0x507f38,_0x3c144e){return new BPromise(function(_0xb02b76,_0x121aca){return client[_0x078e('0x11')](_0x1f6779,_0x3c144e)[_0x078e('0x12')](function(_0x2cf01b){logger[_0x078e('0x13')](_0x078e('0x14'),_0x507f38,_0x078e('0x15'));logger['debug'](_0x078e('0x16'),_0x507f38,'request\x20sent',JSON['stringify'](_0x2cf01b));if(_0x2cf01b[_0x078e('0x17')]){if(_0x2cf01b['error'][_0x078e('0x18')]===0x1f4){logger[_0x078e('0x17')](_0x078e('0x14'),_0x507f38,_0x2cf01b[_0x078e('0x17')][_0x078e('0x19')]);return _0x121aca(_0x2cf01b[_0x078e('0x17')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x507f38,_0x2cf01b[_0x078e('0x17')][_0x078e('0x19')]);return _0xb02b76(_0x2cf01b['error'][_0x078e('0x19')]);}else{logger[_0x078e('0x13')](_0x078e('0x14'),_0x507f38,_0x078e('0x15'));_0xb02b76(_0x2cf01b[_0x078e('0x1a')][_0x078e('0x19')]);}})[_0x078e('0x1b')](function(_0x2900e3){logger[_0x078e('0x17')](_0x078e('0x14'),_0x507f38,_0x2900e3);_0x121aca(_0x2900e3);});});}exports[_0x078e('0x1c')]=function(_0x478f27){var _0x3bfcb5=this;return new Promise(function(_0x5a0681,_0x1d0b2b){return db[_0x078e('0x1d')][_0x078e('0x1e')](_0x478f27[_0x078e('0x1f')],{'raw':_0x478f27['options']?_0x478f27[_0x078e('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x078e('0x12')](function(_0x30b6b0){logger[_0x078e('0x13')]('CreateMailMessage',_0x478f27);logger[_0x078e('0x21')]('CreateMailMessage',_0x478f27,JSON[_0x078e('0x22')](_0x30b6b0));_0x5a0681(_0x30b6b0);})[_0x078e('0x1b')](function(_0x23173b){logger[_0x078e('0x17')](_0x078e('0x1c'),_0x23173b[_0x078e('0x19')],_0x478f27);_0x1d0b2b(_0x3bfcb5[_0x078e('0x17')](0x1f4,_0x23173b['message']));});});}; \ No newline at end of file +var _0x044a=['localhost','socket.io-emitter','register','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x5502f2,_0x19801e){var _0x2d829d=function(_0xfc4bfe){while(--_0xfc4bfe){_0x5502f2['push'](_0x5502f2['shift']());}};_0x2d829d(++_0x19801e);}(_0x044a,0x173));var _0xa044=function(_0x12726e,_0x927169){_0x12726e=_0x12726e-0x0;var _0x5f1375=_0x044a[_0x12726e];return _0x5f1375;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var moment=require(_0xa044('0x2'));var BPromise=require(_0xa044('0x3'));var rs=require(_0xa044('0x4'));var fs=require('fs');var Redis=require(_0xa044('0x5'));var db=require(_0xa044('0x6'))['db'];var utils=require(_0xa044('0x7'));var logger=require(_0xa044('0x8'))(_0xa044('0x9'));var config=require('../../config/environment');var jayson=require(_0xa044('0xa'));var client=jayson[_0xa044('0xb')][_0xa044('0xc')]({'port':0x232a});config[_0xa044('0xd')]=_['defaults'](config[_0xa044('0xd')],{'host':_0xa044('0xe'),'port':0x18eb});var socket=require(_0xa044('0xf'))(new Redis(config[_0xa044('0xd')]));require('./mailMessage.socket')[_0xa044('0x10')](socket);function respondWithRpcPromise(_0x9dec14,_0x3f170b,_0x47a9dc){return new BPromise(function(_0xdf14f6,_0xa3b07f){return client[_0xa044('0x11')](_0x9dec14,_0x47a9dc)[_0xa044('0x12')](function(_0x5e203d){logger[_0xa044('0x13')]('MailMessage,\x20%s,\x20%s',_0x3f170b,'request\x20sent');logger[_0xa044('0x14')](_0xa044('0x15'),_0x3f170b,_0xa044('0x16'),JSON[_0xa044('0x17')](_0x5e203d));if(_0x5e203d[_0xa044('0x18')]){if(_0x5e203d[_0xa044('0x18')][_0xa044('0x19')]===0x1f4){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error'][_0xa044('0x1b')]);return _0xa3b07f(_0x5e203d[_0xa044('0x18')][_0xa044('0x1b')]);}logger[_0xa044('0x18')](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error']['message']);return _0xdf14f6(_0x5e203d[_0xa044('0x18')]['message']);}else{logger[_0xa044('0x13')](_0xa044('0x1a'),_0x3f170b,_0xa044('0x16'));_0xdf14f6(_0x5e203d[_0xa044('0x1c')][_0xa044('0x1b')]);}})['catch'](function(_0x567124){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x567124);_0xa3b07f(_0x567124);});});}exports[_0xa044('0x1d')]=function(_0x273f06){var _0x537bbb=this;return new Promise(function(_0x2092d4,_0x19854d){return db['MailMessage'][_0xa044('0x1e')](_0x273f06[_0xa044('0x1f')],{'raw':_0x273f06[_0xa044('0x20')]?_0x273f06['options'][_0xa044('0x21')]===undefined?!![]:![]:!![]})[_0xa044('0x12')](function(_0x26747b){logger[_0xa044('0x13')](_0xa044('0x1d'),_0x273f06);logger[_0xa044('0x14')](_0xa044('0x1d'),_0x273f06,JSON[_0xa044('0x17')](_0x26747b));_0x2092d4(_0x26747b);})[_0xa044('0x22')](function(_0x57ecd2){logger['error'](_0xa044('0x1d'),_0x57ecd2[_0xa044('0x1b')],_0x273f06);_0x19854d(_0x537bbb[_0xa044('0x18')](0x1f4,_0x57ecd2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 24d093b..534cb77 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 _0xfd48=['save','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x256d2e,_0x3a2009){var _0x197803=function(_0x507484){while(--_0x507484){_0x256d2e['push'](_0x256d2e['shift']());}};_0x197803(++_0x3a2009);}(_0xfd48,0x168));var _0x8fd4=function(_0x59f3c3,_0x46fe86){_0x59f3c3=_0x59f3c3-0x0;var _0x1c398a=_0xfd48[_0x59f3c3];return _0x1c398a;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x8fd4('0x0'),_0x8fd4('0x1'),_0x8fd4('0x2')];function createListener(_0x12ce6b,_0x42a50b){return function(_0x540e85){_0x42a50b[_0x8fd4('0x3')](_0x12ce6b,_0x540e85);};}function removeListener(_0x4a83e0,_0x2f6851){return function(){MailMessageEvents[_0x8fd4('0x4')](_0x4a83e0,_0x2f6851);};}exports[_0x8fd4('0x5')]=function(_0x2c480c){for(var _0x282b61=0x0,_0x533bec=events[_0x8fd4('0x6')];_0x282b61<_0x533bec;_0x282b61++){var _0x4546bb=events[_0x282b61];var _0x3ce49b=createListener(_0x8fd4('0x7')+_0x4546bb,_0x2c480c);MailMessageEvents['on'](_0x4546bb,_0x3ce49b);}}; \ No newline at end of file +var _0xe91f=['removeListener','length','mailMessage:','./mailMessage.events','save','update','emit'];(function(_0xf0d5b4,_0x3f480c){var _0x802fe2=function(_0x23e787){while(--_0x23e787){_0xf0d5b4['push'](_0xf0d5b4['shift']());}};_0x802fe2(++_0x3f480c);}(_0xe91f,0xf8));var _0xfe91=function(_0x1b4a6d,_0xf21f05){_0x1b4a6d=_0x1b4a6d-0x0;var _0x31ec4d=_0xe91f[_0x1b4a6d];return _0x31ec4d;};'use strict';var MailMessageEvents=require(_0xfe91('0x0'));var events=[_0xfe91('0x1'),'remove',_0xfe91('0x2')];function createListener(_0x569a3b,_0x2d3127){return function(_0x219329){_0x2d3127[_0xfe91('0x3')](_0x569a3b,_0x219329);};}function removeListener(_0x5c60b3,_0xa43e10){return function(){MailMessageEvents[_0xfe91('0x4')](_0x5c60b3,_0xa43e10);};}exports['register']=function(_0x59a492){for(var _0x4ab544=0x0,_0xed1057=events[_0xfe91('0x5')];_0x4ab544<_0xed1057;_0x4ab544++){var _0x249be6=events[_0x4ab544];var _0x5e35ae=createListener(_0xfe91('0x6')+_0x249be6,_0x59a492);MailMessageEvents['on'](_0x249be6,_0x5e35ae);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ea83de7..01d5c6e 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 _0xad97=['getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents','update','delete','removeTeams','exports','util','connect-timeout','Router','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0xad97,0x9e));var _0x7ad9=function(_0x418ea3,_0x32b726){_0x418ea3=_0x418ea3-0x0;var _0x186e85=_0xad97[_0x418ea3];return _0x186e85;};'use strict';var multer=require('multer');var util=require(_0x7ad9('0x0'));var path=require('path');var timeout=require(_0x7ad9('0x1'));var express=require('express');var router=express[_0x7ad9('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7ad9('0x3'));var controller=require(_0x7ad9('0x4'));router[_0x7ad9('0x5')]('/',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x7')]);router[_0x7ad9('0x5')]('/describe',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x8')]);router[_0x7ad9('0x5')](_0x7ad9('0x9'),auth[_0x7ad9('0x6')](),controller['show']);router[_0x7ad9('0x5')]('/:id/members',auth[_0x7ad9('0x6')](),controller['getMembers']);router[_0x7ad9('0x5')]('/:id/teams',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0xa')]);router[_0x7ad9('0x5')](_0x7ad9('0xb'),auth[_0x7ad9('0x6')](),controller['getAgents']);router['post']('/',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0xc')]);router[_0x7ad9('0xd')](_0x7ad9('0xe'),auth['isAuthenticated'](),controller[_0x7ad9('0xf')]);router[_0x7ad9('0xd')](_0x7ad9('0xb'),auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x10')]);router['put'](_0x7ad9('0x9'),auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x11')]);router[_0x7ad9('0x12')](_0x7ad9('0x9'),auth[_0x7ad9('0x6')](),controller['destroy']);router[_0x7ad9('0x12')]('/:id/teams',auth[_0x7ad9('0x6')](),controller[_0x7ad9('0x13')]);router[_0x7ad9('0x12')](_0x7ad9('0xb'),auth[_0x7ad9('0x6')](),controller['removeAgents']);module[_0x7ad9('0x14')]=router; \ No newline at end of file +var _0x9375=['../../components/interaction/service','./mailQueue.controller','index','get','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x52d120,_0x490293){var _0x2b37f1=function(_0x372019){while(--_0x372019){_0x52d120['push'](_0x52d120['shift']());}};_0x2b37f1(++_0x490293);}(_0x9375,0xc3));var _0x5937=function(_0x460ad7,_0x21ac08){_0x460ad7=_0x460ad7-0x0;var _0x25bd94=_0x9375[_0x460ad7];return _0x25bd94;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5937('0x0'));var timeout=require(_0x5937('0x1'));var express=require(_0x5937('0x2'));var router=express[_0x5937('0x3')]();var auth=require(_0x5937('0x4'));var interaction=require(_0x5937('0x5'));var config=require('../../config/environment');var controller=require(_0x5937('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5937('0x7')]);router[_0x5937('0x8')]('/describe',auth[_0x5937('0x9')](),controller['describe']);router[_0x5937('0x8')](_0x5937('0xa'),auth[_0x5937('0x9')](),controller[_0x5937('0xb')]);router[_0x5937('0x8')](_0x5937('0xc'),auth[_0x5937('0x9')](),controller[_0x5937('0xd')]);router['get'](_0x5937('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x5937('0x8')](_0x5937('0xf'),auth['isAuthenticated'](),controller[_0x5937('0x10')]);router[_0x5937('0x11')]('/',auth['isAuthenticated'](),controller[_0x5937('0x12')]);router[_0x5937('0x11')](_0x5937('0xe'),auth['isAuthenticated'](),controller[_0x5937('0x13')]);router[_0x5937('0x11')](_0x5937('0xf'),auth[_0x5937('0x9')](),controller[_0x5937('0x14')]);router[_0x5937('0x15')]('/:id',auth[_0x5937('0x9')](),controller['update']);router[_0x5937('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x5937('0x17')]);router[_0x5937('0x16')](_0x5937('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x5937('0x16')](_0x5937('0xf'),auth[_0x5937('0x9')](),controller['removeAgents']);module[_0x5937('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 146b3bf..69fd3f3 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 _0x2168=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x2168,0x112));var _0x8216=function(_0x702d36,_0x11499c){_0x702d36=_0x702d36-0x0;var _0x19a734=_0x2168[_0x702d36];return _0x19a734;};'use strict';var Sequelize=require(_0x8216('0x0'));module[_0x8216('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8216('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8216('0x3')]},'timeout':{'type':Sequelize[_0x8216('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8216('0x5')](_0x8216('0x6'),_0x8216('0x7'),_0x8216('0x8'))}}; \ No newline at end of file +var _0xe2ea=['exports','STRING','name','INTEGER','rrmemory','beepall','sequelize'];(function(_0x5921a5,_0x69c710){var _0x53e882=function(_0x3d7706){while(--_0x3d7706){_0x5921a5['push'](_0x5921a5['shift']());}};_0x53e882(++_0x69c710);}(_0xe2ea,0xc3));var _0xae2e=function(_0x264dc3,_0x118bae){_0x264dc3=_0x264dc3-0x0;var _0x1f80b5=_0xe2ea[_0x264dc3];return _0x1f80b5;};'use strict';var Sequelize=require(_0xae2e('0x0'));module[_0xae2e('0x1')]={'name':{'type':Sequelize[_0xae2e('0x2')],'unique':_0xae2e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xae2e('0x2')]},'timeout':{'type':Sequelize[_0xae2e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xae2e('0x5'),_0xae2e('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 1721c0d..cf11796 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 _0x9607=['interface','flatMap','findOrCreate','forEach','emit','userMailQueue:save','Agents','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','value','sequelize','userMailQueue:remove','addAgents','ids','removeAgents','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','MailQueue','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','getTeams','Team','addTeams','online','voicePause'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9607,0xa0));var _0x7960=function(_0x372145,_0x224563){_0x372145=_0x372145-0x0;var _0x15a7ff=_0x9607[_0x372145];return _0x15a7ff;};'use strict';var pdf=require(_0x7960('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7960('0x1'));var zipdir=require(_0x7960('0x2'));var jsonpatch=require(_0x7960('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7960('0x4'));var util=require(_0x7960('0x5'));var path=require(_0x7960('0x6'));var sox=require(_0x7960('0x7'));var csv=require(_0x7960('0x8'));var ejs=require(_0x7960('0x9'));var fs=require('fs');var _=require(_0x7960('0xa'));var squel=require(_0x7960('0xb'));var crypto=require(_0x7960('0xc'));var jsforce=require(_0x7960('0xd'));var deskjs=require(_0x7960('0xe'));var toCsv=require(_0x7960('0x8'));var querystring=require(_0x7960('0xf'));var Papa=require(_0x7960('0x10'));var Redis=require(_0x7960('0x11'));var authService=require(_0x7960('0x12'));var qs=require(_0x7960('0x13'));var as=require(_0x7960('0x14'));var hardwareService=require(_0x7960('0x15'));var logger=require('../../config/logger')(_0x7960('0x16'));var utils=require(_0x7960('0x17'));var config=require(_0x7960('0x18'));var db=require('../../mysqldb')['db'];config[_0x7960('0x19')]=_[_0x7960('0x1a')](config[_0x7960('0x19')],{'host':_0x7960('0x1b'),'port':0x18eb});var socket=require(_0x7960('0x1c'))(new Redis(config['redis']));require(_0x7960('0x1d'))['register'](socket);function respondWithStatusCode(_0x6362d5,_0x3759d1){_0x3759d1=_0x3759d1||0xcc;return function(_0x416a73){if(_0x416a73){return _0x6362d5[_0x7960('0x1e')](_0x3759d1);}return _0x6362d5['status'](_0x3759d1)[_0x7960('0x1f')]();};}function respondWithResult(_0x38a798,_0x16a828){_0x16a828=_0x16a828||0xc8;return function(_0xe7c682){if(_0xe7c682){return _0x38a798[_0x7960('0x20')](_0x16a828)[_0x7960('0x21')](_0xe7c682);}};}function respondWithFilteredResult(_0xafe2c8,_0x3eb0ab){return function(_0x50df8a){if(_0x50df8a){var _0x37c5ef=_0x50df8a['count'],_0x40ec34=_0x3eb0ab[_0x7960('0x22')],_0x1e83cd=_0x3eb0ab['offset']+_0x3eb0ab[_0x7960('0x23')],_0x1def7e;if(_0x1e83cd>=_0x37c5ef){_0x1e83cd=_0x37c5ef;_0x1def7e=0xc8;}else{_0x1def7e=0xce;}_0xafe2c8['status'](_0x1def7e);return _0xafe2c8[_0x7960('0x24')](_0x7960('0x25'),_0x40ec34+'-'+_0x1e83cd+'/'+_0x37c5ef)[_0x7960('0x21')](_0x50df8a);}return null;};}function patchUpdates(_0x3416fc){return function(_0x2cae65){try{jsonpatch[_0x7960('0x26')](_0x2cae65,_0x3416fc,!![]);}catch(_0x273d20){return BPromise['reject'](_0x273d20);}return _0x2cae65[_0x7960('0x27')]();};}function saveUpdates(_0x1d922d,_0x5d81b){return function(_0x2bf261){if(_0x2bf261){return _0x2bf261[_0x7960('0x28')](_0x1d922d)[_0x7960('0x29')](function(_0x357253){return _0x357253;});}return null;};}function removeEntity(_0x1abb03,_0x5c4e06){return function(_0xab6d69){if(_0xab6d69){return _0xab6d69[_0x7960('0x2a')]()[_0x7960('0x29')](function(){var _0x670967=_0xab6d69[_0x7960('0x2b')]({'plain':!![]});var _0x801693='MailQueues';return db['UserProfileResource'][_0x7960('0x2a')]({'where':{'type':_0x801693,'resourceId':_0x670967['id']}})[_0x7960('0x29')](function(){return _0xab6d69;});})['then'](function(){_0x1abb03[_0x7960('0x20')](0xcc)[_0x7960('0x1f')]();});}};}function handleEntityNotFound(_0x41267a,_0x3ab03f){return function(_0x36ac09){if(!_0x36ac09){_0x41267a[_0x7960('0x1e')](0x194);}return _0x36ac09;};}function handleError(_0x25b065,_0x45cbc8){_0x45cbc8=_0x45cbc8||0x1f4;return function(_0x3babc5){logger[_0x7960('0x2c')](_0x3babc5[_0x7960('0x2d')]);if(_0x3babc5[_0x7960('0x2e')]){delete _0x3babc5[_0x7960('0x2e')];}_0x25b065[_0x7960('0x20')](_0x45cbc8)['send'](_0x3babc5);};}exports['index']=function(_0x3f6f97,_0x565f29){var _0x2c085b={},_0x3c3aaf={},_0x2bc0b5={'count':0x0,'rows':[]};var _0x54adb4=_['map'](db[_0x7960('0x2f')]['rawAttributes'],function(_0xb33372){return{'name':_0xb33372['fieldName'],'type':_0xb33372[_0x7960('0x30')][_0x7960('0x31')]};});_0x3c3aaf[_0x7960('0x32')]=_[_0x7960('0x33')](_0x54adb4,_0x7960('0x2e'));_0x3c3aaf[_0x7960('0x34')]=_[_0x7960('0x35')](_0x3f6f97[_0x7960('0x34')]);_0x3c3aaf[_0x7960('0x36')]=_[_0x7960('0x37')](_0x3c3aaf[_0x7960('0x32')],_0x3c3aaf[_0x7960('0x34')]);_0x2c085b[_0x7960('0x38')]=_['intersection'](_0x3c3aaf[_0x7960('0x32')],qs[_0x7960('0x39')](_0x3f6f97[_0x7960('0x34')][_0x7960('0x39')]));_0x2c085b[_0x7960('0x38')]=_0x2c085b[_0x7960('0x38')]['length']?_0x2c085b[_0x7960('0x38')]:_0x3c3aaf[_0x7960('0x32')];if(!_0x3f6f97[_0x7960('0x34')][_0x7960('0x3a')](_0x7960('0x3b'))){_0x2c085b['limit']=qs[_0x7960('0x23')](_0x3f6f97[_0x7960('0x34')][_0x7960('0x23')]);_0x2c085b[_0x7960('0x22')]=qs[_0x7960('0x22')](_0x3f6f97['query']['offset']);}_0x2c085b[_0x7960('0x3c')]=qs[_0x7960('0x3d')](_0x3f6f97[_0x7960('0x34')][_0x7960('0x3d')]);_0x2c085b[_0x7960('0x3e')]=qs['filters'](_['pick'](_0x3f6f97[_0x7960('0x34')],_0x3c3aaf[_0x7960('0x36')]),_0x54adb4);if(_0x3f6f97['query'][_0x7960('0x3f')]){_0x2c085b[_0x7960('0x3e')]=_[_0x7960('0x40')](_0x2c085b[_0x7960('0x3e')],{'$or':_[_0x7960('0x33')](_0x54adb4,function(_0x480489){if(_0x480489[_0x7960('0x30')]!==_0x7960('0x41')){var _0x12ab58={};_0x12ab58[_0x480489[_0x7960('0x2e')]]={'$like':'%'+_0x3f6f97[_0x7960('0x34')][_0x7960('0x3f')]+'%'};return _0x12ab58;}})});}_0x2c085b=_[_0x7960('0x40')]({},_0x2c085b,_0x3f6f97[_0x7960('0x42')]);var _0x4e3090={'where':_0x2c085b[_0x7960('0x3e')]};return db['MailQueue']['count'](_0x4e3090)[_0x7960('0x29')](function(_0x1cd0ee){_0x2bc0b5[_0x7960('0x43')]=_0x1cd0ee;if(_0x3f6f97[_0x7960('0x34')][_0x7960('0x44')]){_0x2c085b[_0x7960('0x45')]=[{'all':!![]}];}return db[_0x7960('0x2f')][_0x7960('0x46')](_0x2c085b);})[_0x7960('0x29')](function(_0x31c58d){_0x2bc0b5[_0x7960('0x47')]=_0x31c58d;return _0x2bc0b5;})[_0x7960('0x29')](respondWithFilteredResult(_0x565f29,_0x2c085b))[_0x7960('0x48')](handleError(_0x565f29,null));};exports['show']=function(_0x25b626,_0x408e11){var _0x20f56e={'raw':!![],'where':{'id':_0x25b626['params']['id']}},_0x118636={};_0x118636[_0x7960('0x32')]=_['keys'](db[_0x7960('0x2f')][_0x7960('0x49')]);_0x118636[_0x7960('0x34')]=_[_0x7960('0x35')](_0x25b626[_0x7960('0x34')]);_0x118636['filters']=_[_0x7960('0x37')](_0x118636[_0x7960('0x32')],_0x118636[_0x7960('0x34')]);_0x20f56e[_0x7960('0x38')]=_[_0x7960('0x37')](_0x118636['model'],qs[_0x7960('0x39')](_0x25b626['query'][_0x7960('0x39')]));_0x20f56e[_0x7960('0x38')]=_0x20f56e[_0x7960('0x38')][_0x7960('0x4a')]?_0x20f56e[_0x7960('0x38')]:_0x118636[_0x7960('0x32')];if(_0x25b626[_0x7960('0x34')][_0x7960('0x44')]){_0x20f56e[_0x7960('0x45')]=[{'all':!![]}];}_0x20f56e=_[_0x7960('0x40')]({},_0x20f56e,_0x25b626[_0x7960('0x42')]);return db[_0x7960('0x2f')][_0x7960('0x4b')](_0x20f56e)['then'](handleEntityNotFound(_0x408e11,null))[_0x7960('0x29')](respondWithResult(_0x408e11,null))[_0x7960('0x48')](handleError(_0x408e11,null));};exports[_0x7960('0x4c')]=function(_0x4ec0ac,_0xa8b84d){return db['MailQueue'][_0x7960('0x4c')](_0x4ec0ac[_0x7960('0x4d')],{})[_0x7960('0x29')](function(_0x94de36){var _0x15acc0=_0x4ec0ac[_0x7960('0x4e')][_0x7960('0x2b')]({'plain':!![]});if(!_0x15acc0)throw new Error(_0x7960('0x4f'));if(_0x15acc0['role']==='user'){var _0x5c078e=_0x94de36[_0x7960('0x2b')]({'plain':!![]});var _0x147b49='MailQueues';return db[_0x7960('0x50')][_0x7960('0x4b')]({'where':{'name':_0x147b49,'userProfileId':_0x15acc0[_0x7960('0x51')]},'raw':!![]})[_0x7960('0x29')](function(_0x6766f4){if(_0x6766f4&&_0x6766f4['autoAssociation']===0x0){return db[_0x7960('0x52')][_0x7960('0x4c')]({'name':_0x5c078e[_0x7960('0x2e')],'resourceId':_0x5c078e['id'],'type':_0x6766f4[_0x7960('0x2e')],'sectionId':_0x6766f4['id']},{})[_0x7960('0x29')](function(){return _0x94de36;});}else{return _0x94de36;}})['catch'](function(_0x2ba77f){logger[_0x7960('0x2c')](_0x7960('0x53'),_0x2ba77f);throw _0x2ba77f;});}return _0x94de36;})[_0x7960('0x29')](respondWithResult(_0xa8b84d,0xc9))[_0x7960('0x48')](handleError(_0xa8b84d,null));};exports[_0x7960('0x28')]=function(_0x25809a,_0x535ae1){if(_0x25809a[_0x7960('0x4d')]['id']){delete _0x25809a[_0x7960('0x4d')]['id'];}return db[_0x7960('0x2f')][_0x7960('0x4b')]({'where':{'id':_0x25809a[_0x7960('0x54')]['id']}})['then'](handleEntityNotFound(_0x535ae1,null))[_0x7960('0x29')](saveUpdates(_0x25809a[_0x7960('0x4d')],null))[_0x7960('0x29')](respondWithResult(_0x535ae1,null))['catch'](handleError(_0x535ae1,null));};exports[_0x7960('0x2a')]=function(_0x471fb7,_0x4fa827){return db['MailQueue'][_0x7960('0x4b')]({'where':{'id':_0x471fb7[_0x7960('0x54')]['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x4fa827,null))['then'](removeEntity(_0x4fa827,null))[_0x7960('0x48')](handleError(_0x4fa827,null));};exports[_0x7960('0x55')]=function(_0x1eefd3,_0x55a33e){return db['MailQueue'][_0x7960('0x55')]()['then'](respondWithResult(_0x55a33e,null))['catch'](handleError(_0x55a33e,null));};exports['getMembers']=function(_0x2b435c,_0x28500a,_0x1591c6){var _0x43d25b={'raw':!![],'where':{}},_0x90194={},_0xf95490;return db[_0x7960('0x2f')][_0x7960('0x56')]({'where':{'id':_0x2b435c['params']['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x28500a,null))[_0x7960('0x29')](function(_0x2b0e03){if(_0x2b0e03){_0xf95490=_0x2b0e03[_0x7960('0x2b')]({'plain':!![]});_0x90194[_0x7960('0x32')]=_[_0x7960('0x35')](db[_0x7960('0x57')]['rawAttributes']);_0x90194[_0x7960('0x34')]=_['keys'](_0x2b435c[_0x7960('0x34')]);_0x90194[_0x7960('0x36')]=_[_0x7960('0x37')](_0x90194[_0x7960('0x32')],_0x90194[_0x7960('0x34')]);_0x43d25b[_0x7960('0x38')]=_[_0x7960('0x37')](_0x90194[_0x7960('0x32')],qs['fields'](_0x2b435c['query'][_0x7960('0x39')]));_0x43d25b[_0x7960('0x38')]=_0x43d25b[_0x7960('0x38')][_0x7960('0x4a')]?_0x43d25b[_0x7960('0x38')]:_0x90194[_0x7960('0x32')];if(!_0x2b435c[_0x7960('0x34')][_0x7960('0x3a')](_0x7960('0x3b'))){_0x43d25b[_0x7960('0x23')]=qs['limit'](_0x2b435c[_0x7960('0x34')][_0x7960('0x23')]);_0x43d25b[_0x7960('0x22')]=qs[_0x7960('0x22')](_0x2b435c[_0x7960('0x34')][_0x7960('0x22')]);}_0x43d25b[_0x7960('0x3c')]=qs['sort'](_0x2b435c['query']['sort']);_0x43d25b['where']=qs['filters'](_[_0x7960('0x58')](_0x2b435c[_0x7960('0x34')],_0x90194[_0x7960('0x36')]));_0x43d25b['where'][_0x7960('0x59')]=_0x2b0e03['id'];if(_0x2b435c[_0x7960('0x34')][_0x7960('0x3f')]){_0x43d25b[_0x7960('0x3e')]=_[_0x7960('0x40')](_0x43d25b['where'],{'$or':_['map'](_0x43d25b['attributes'],function(_0x3d6ef3){var _0x310d24={};_0x310d24[_0x3d6ef3]={'$like':'%'+_0x2b435c[_0x7960('0x34')][_0x7960('0x3f')]+'%'};return _0x310d24;})});}_0x43d25b=_[_0x7960('0x40')]({},_0x43d25b,_0x2b435c[_0x7960('0x42')]);return db[_0x7960('0x57')]['findAll'](_0x43d25b);}})['then'](function(_0x1637d3){if(_0x1637d3){return db[_0x7960('0x5a')][_0x7960('0x5b')]({'where':{'id':_[_0x7960('0x33')](_0x1637d3,_0x7960('0x5c')),'role':'agent'},'attributes':['id','name',_0x7960('0x5d'),_0x7960('0x5e'),_0x7960('0x5f')]});}})[_0x7960('0x29')](function(_0x523f48){if(_0x523f48){return{'count':_0x523f48[_0x7960('0x43')],'rows':_[_0x7960('0x33')](_0x523f48[_0x7960('0x47')],function(_0x27d3ad){return{'membername':_0x27d3ad[_0x7960('0x2e')],'UserId':_0x27d3ad['id'],'queue_name':_0xf95490[_0x7960('0x2e')],'MailQueueId':_0xf95490['id'],'interface':util[_0x7960('0x60')]('%s/%s','SIP',_0x27d3ad[_0x7960('0x2e')]),'penalty':0x0,'paused':_0x27d3ad[_0x7960('0x5d')],'createdAt':_0x27d3ad[_0x7960('0x5f')],'updatedAt':_0x27d3ad['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x28500a,_0x43d25b))['catch'](handleError(_0x28500a,null));};exports[_0x7960('0x61')]=function(_0x1d9649,_0x402c80,_0x524b89){var _0x1c9ac4={};var _0x27ce57={};var _0x2aa831;var _0x3c6076;return db['MailQueue'][_0x7960('0x56')]({'where':{'id':_0x1d9649['params']['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x402c80,null))[_0x7960('0x29')](function(_0x25ee7a){if(_0x25ee7a){_0x2aa831=_0x25ee7a;_0x27ce57['model']=_[_0x7960('0x35')](db[_0x7960('0x62')][_0x7960('0x49')]);_0x27ce57[_0x7960('0x34')]=_[_0x7960('0x35')](_0x1d9649['query']);_0x27ce57[_0x7960('0x36')]=_['intersection'](_0x27ce57[_0x7960('0x32')],_0x27ce57[_0x7960('0x34')]);_0x1c9ac4[_0x7960('0x38')]=_[_0x7960('0x37')](_0x27ce57['model'],qs[_0x7960('0x39')](_0x1d9649[_0x7960('0x34')]['fields']));_0x1c9ac4[_0x7960('0x38')]=_0x1c9ac4['attributes']['length']?_0x1c9ac4[_0x7960('0x38')]:_0x27ce57['model'];_0x1c9ac4[_0x7960('0x3c')]=qs[_0x7960('0x3d')](_0x1d9649[_0x7960('0x34')][_0x7960('0x3d')]);_0x1c9ac4[_0x7960('0x3e')]=qs['filters'](_[_0x7960('0x58')](_0x1d9649[_0x7960('0x34')],_0x27ce57[_0x7960('0x36')]));if(_0x1d9649[_0x7960('0x34')][_0x7960('0x3f')]){_0x1c9ac4[_0x7960('0x3e')]=_[_0x7960('0x40')](_0x1c9ac4[_0x7960('0x3e')],{'$or':_[_0x7960('0x33')](_0x1c9ac4[_0x7960('0x38')],function(_0x44d670){var _0x578a06={};_0x578a06[_0x44d670]={'$like':'%'+_0x1d9649[_0x7960('0x34')][_0x7960('0x3f')]+'%'};return _0x578a06;})});}_0x1c9ac4=_[_0x7960('0x40')]({},_0x1c9ac4,_0x1d9649[_0x7960('0x42')]);return _0x2aa831[_0x7960('0x61')](_0x1c9ac4);}})['then'](function(_0x3056a1){if(_0x3056a1){_0x3c6076=_0x3056a1['length'];if(!_0x1d9649[_0x7960('0x34')][_0x7960('0x3a')]('nolimit')){_0x1c9ac4[_0x7960('0x23')]=qs[_0x7960('0x23')](_0x1d9649['query'][_0x7960('0x23')]);_0x1c9ac4[_0x7960('0x22')]=qs[_0x7960('0x22')](_0x1d9649[_0x7960('0x34')][_0x7960('0x22')]);}return _0x2aa831['getTeams'](_0x1c9ac4);}})[_0x7960('0x29')](function(_0x39d791){if(_0x39d791){return _0x39d791?{'count':_0x3c6076,'rows':_0x39d791}:null;}})[_0x7960('0x29')](respondWithResult(_0x402c80,null))[_0x7960('0x48')](handleError(_0x402c80,null));};exports[_0x7960('0x63')]=function(_0x2962f9,_0x238669,_0x5708b6){var _0x234086=_0x2962f9['body']['ids'];return db[_0x7960('0x62')]['findAll']({'where':{'id':_0x234086},'attributes':['id'],'include':[{'model':db[_0x7960('0x5a')],'as':'Agents','attributes':['id',_0x7960('0x2e'),_0x7960('0x64'),_0x7960('0x65'),_0x7960('0x66')],'raw':!![]}]})[_0x7960('0x29')](function(_0x32b667){if(_0x32b667){var _0x36174c=_[_0x7960('0x67')](_0x32b667,function(_0x579bf5){var _0x427550=_0x579bf5[_0x7960('0x2b')]({'plain':!![]});return _0x427550['Agents'];});return db[_0x7960('0x2f')][_0x7960('0x4b')]({'where':{'id':_0x2962f9['params']['id']}})[_0x7960('0x29')](function(_0xa06353){return db['sequelize']['transaction'](function(_0x187038){return _0xa06353[_0x7960('0x63')](_0x234086,{'transaction':_0x187038})['then'](function(){return BPromise['each'](_0x36174c,function(_0x54ca0c){return db[_0x7960('0x57')][_0x7960('0x68')]({'where':{'UserId':_0x54ca0c['id'],'MailQueueId':_0x2962f9[_0x7960('0x54')]['id']},'transaction':_0x187038});});})[_0x7960('0x29')](function(){_0x36174c[_0x7960('0x69')](function(_0x263f99){socket[_0x7960('0x6a')](_0x7960('0x6b'),{'UserId':_0x263f99['id'],'MailQueueId':_0xa06353['id']});});});});});}})['then'](respondWithStatusCode(_0x238669,null))['catch'](handleError(_0x238669,null));};exports['removeTeams']=function(_0x53ce70,_0x16f719,_0x345a1e){return db['Team']['findAll']({'where':{'id':_0x53ce70[_0x7960('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7960('0x5a')],'as':_0x7960('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x16f719,null))[_0x7960('0x29')](function(_0x1f24ed){var _0x305163=_[_0x7960('0x33')](_0x1f24ed,'id');var _0x333ca3=[];var _0x5092b4=[];var _0x5c56df=squel[_0x7960('0x6d')]();_0x5c56df[_0x7960('0x6e')]('tq.TeamId')['from'](_0x7960('0x6f'),'tq')[_0x7960('0x70')](_0x7960('0x71'),'ut',_0x7960('0x72'))['where']('MailQueueId\x20=\x20?',_0x53ce70[_0x7960('0x54')]['id']);for(var _0x46172c=0x0;_0x46172c<_0x1f24ed[_0x7960('0x4a')];_0x46172c+=0x1){let _0x507cc6=_0x1f24ed[_0x46172c];for(var _0x262584=0x0;_0x262584<_0x507cc6[_0x7960('0x6c')]['length'];_0x262584+=0x1){let _0x10cdc5=_0x507cc6[_0x7960('0x6c')][_0x262584];var _0x16e8ae=_0x5c56df[_0x7960('0x73')]();_0x16e8ae[_0x7960('0x3e')](_0x7960('0x74'),_0x10cdc5['id']);_0x5092b4[_0x7960('0x75')](db['sequelize']['query'](_0x16e8ae[_0x7960('0x76')](),{'type':db['sequelize']['QueryTypes'][_0x7960('0x77')]})[_0x7960('0x29')](function(_0x17a93a){if(_0x17a93a[_0x7960('0x4a')]===0x1){return _0x10cdc5['id'];}else{var _0x5e67c4=_[_0x7960('0x78')](_[_0x7960('0x33')](_0x17a93a,_0x7960('0x79')),function(_0x2eccbf){return _[_0x7960('0x7a')](_0x305163,_0x2eccbf);});if(_0x5e67c4){return _0x10cdc5['id'];}}}));}}return BPromise['all'](_0x5092b4)[_0x7960('0x29')](function(_0xb467d2){_0x333ca3=_(_0x333ca3)[_0x7960('0x7b')](_0xb467d2)['compact']()[_0x7960('0x7c')]();return db['MailQueue'][_0x7960('0x4b')]({'where':{'id':_0x53ce70[_0x7960('0x54')]['id']}})[_0x7960('0x29')](function(_0x498ea7){return db[_0x7960('0x7d')]['transaction'](function(_0x48e563){return _0x498ea7['removeTeams'](_0x53ce70[_0x7960('0x34')]['ids'],{'transaction':_0x48e563})[_0x7960('0x29')](function(){if(!_['isEmpty'](_0x333ca3)){return _0x498ea7['removeAgents'](_0x333ca3,{'transaction':_0x48e563});}})['then'](function(){_0x333ca3[_0x7960('0x69')](function(_0xd3b201){socket[_0x7960('0x6a')](_0x7960('0x7e'),{'UserId':_0xd3b201,'MailQueueId':_0x498ea7['id']});});});});});});})['then'](respondWithStatusCode(_0x16f719,null))[_0x7960('0x48')](handleError(_0x16f719,null));};exports[_0x7960('0x7f')]=function(_0x335122,_0x4ce6c5,_0x5dba64){return db['MailQueue']['find']({'where':{'id':_0x335122[_0x7960('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ce6c5,null))['then'](function(_0x554d2b){if(_0x554d2b){return _0x554d2b[_0x7960('0x7f')](_0x335122[_0x7960('0x4d')][_0x7960('0x80')],_['omit'](_0x335122[_0x7960('0x4d')],['ids','id'])||{})['spread'](function(_0x1f8d1a){for(var _0x56a963=0x0;_0x56a963<_0x335122[_0x7960('0x4d')][_0x7960('0x80')]['length'];_0x56a963+=0x1){socket['emit'](_0x7960('0x6b'),{'UserId':_0x335122[_0x7960('0x4d')]['ids'][_0x56a963],'MailQueueId':_0x335122['params']['id']});}return _0x1f8d1a;});}})['then'](respondWithResult(_0x4ce6c5,null))[_0x7960('0x48')](handleError(_0x4ce6c5,null));};exports[_0x7960('0x81')]=function(_0x49fc3d,_0x58d333,_0x2d6f40){return db[_0x7960('0x2f')]['find']({'where':{'id':_0x49fc3d[_0x7960('0x54')]['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x58d333,null))[_0x7960('0x29')](function(_0xe811d7){if(_0xe811d7){return _0xe811d7[_0x7960('0x81')](_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')])[_0x7960('0x29')](function(){if(_['isArray'](_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')])){for(var _0xecf19a=0x0;_0xecf19a<_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')]['length'];_0xecf19a+=0x1){socket[_0x7960('0x6a')](_0x7960('0x7e'),{'UserId':Number(_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')][_0xecf19a]),'MailQueueId':Number(_0x49fc3d['params']['id'])});}}else{socket[_0x7960('0x6a')](_0x7960('0x7e'),{'UserId':Number(_0x49fc3d[_0x7960('0x34')][_0x7960('0x80')]),'MailQueueId':Number(_0x49fc3d[_0x7960('0x54')]['id'])});}});}})[_0x7960('0x29')](respondWithStatusCode(_0x58d333,null))[_0x7960('0x48')](handleError(_0x58d333,null));};exports[_0x7960('0x82')]=function(_0x48ff94,_0x3daa10,_0x52f5e1){var _0x388660={};var _0x125850={};var _0x19e5e0;var _0x46fc2c;return db[_0x7960('0x2f')][_0x7960('0x56')]({'where':{'id':_0x48ff94[_0x7960('0x54')]['id']}})[_0x7960('0x29')](handleEntityNotFound(_0x3daa10,null))[_0x7960('0x29')](function(_0x2a97ef){if(_0x2a97ef){_0x19e5e0=_0x2a97ef;_0x125850[_0x7960('0x32')]=_['keys'](db[_0x7960('0x5a')][_0x7960('0x49')]);_0x125850[_0x7960('0x34')]=_[_0x7960('0x35')](_0x48ff94[_0x7960('0x34')]);_0x125850[_0x7960('0x36')]=_[_0x7960('0x37')](_0x125850[_0x7960('0x32')],_0x125850['query']);_0x388660['attributes']=_[_0x7960('0x37')](_0x125850[_0x7960('0x32')],qs[_0x7960('0x39')](_0x48ff94[_0x7960('0x34')]['fields']));_0x388660['attributes']=_0x388660[_0x7960('0x38')][_0x7960('0x4a')]?_0x388660['attributes']:_0x125850['model'];_0x388660[_0x7960('0x3c')]=qs[_0x7960('0x3d')](_0x48ff94[_0x7960('0x34')]['sort']);_0x388660[_0x7960('0x3e')]=qs[_0x7960('0x36')](_['pick'](_0x48ff94[_0x7960('0x34')],_0x125850[_0x7960('0x36')]));if(_0x48ff94[_0x7960('0x34')][_0x7960('0x3f')]){_0x388660['where']=_[_0x7960('0x40')](_0x388660[_0x7960('0x3e')],{'$or':_[_0x7960('0x33')](_0x388660['attributes'],function(_0x1f5a20){var _0x1526f8={};_0x1526f8[_0x1f5a20]={'$like':'%'+_0x48ff94[_0x7960('0x34')][_0x7960('0x3f')]+'%'};return _0x1526f8;})});}_0x388660=_[_0x7960('0x40')]({},_0x388660,_0x48ff94[_0x7960('0x42')]);return _0x19e5e0[_0x7960('0x82')](_0x388660);}})[_0x7960('0x29')](function(_0x43cf9a){if(_0x43cf9a){_0x46fc2c=_0x43cf9a[_0x7960('0x4a')];if(!_0x48ff94['query']['hasOwnProperty'](_0x7960('0x3b'))){_0x388660[_0x7960('0x23')]=qs[_0x7960('0x23')](_0x48ff94[_0x7960('0x34')]['limit']);_0x388660[_0x7960('0x22')]=qs[_0x7960('0x22')](_0x48ff94['query'][_0x7960('0x22')]);}return _0x19e5e0['getAgents'](_0x388660);}})[_0x7960('0x29')](function(_0x2ca55b){if(_0x2ca55b){return _0x2ca55b?{'count':_0x46fc2c,'rows':_0x2ca55b}:null;}})[_0x7960('0x29')](respondWithResult(_0x3daa10,null))[_0x7960('0x48')](handleError(_0x3daa10,null));}; \ No newline at end of file +var _0x41c6=['update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','index','map','MailQueue','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','MailQueueId','UserMailQueue','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','Team','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','removeAgents','userMailQueue:remove','omit','userMailQueue:save','isArray','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x4818c4,_0x349b68){var _0x49fa3d=function(_0x2eae0b){while(--_0x2eae0b){_0x4818c4['push'](_0x4818c4['shift']());}};_0x49fa3d(++_0x349b68);}(_0x41c6,0xf6));var _0x641c=function(_0x1b6382,_0x135c26){_0x1b6382=_0x1b6382-0x0;var _0x46d1d2=_0x41c6[_0x1b6382];return _0x46d1d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x641c('0x0'));var rimraf=require(_0x641c('0x1'));var zipdir=require(_0x641c('0x2'));var jsonpatch=require(_0x641c('0x3'));var rp=require(_0x641c('0x4'));var moment=require(_0x641c('0x5'));var BPromise=require(_0x641c('0x6'));var Mustache=require(_0x641c('0x7'));var util=require(_0x641c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x641c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x641c('0xa'));var squel=require(_0x641c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x641c('0xc'));var toCsv=require(_0x641c('0x9'));var querystring=require(_0x641c('0xd'));var Papa=require('papaparse');var Redis=require(_0x641c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x641c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x641c('0x10'));var logger=require(_0x641c('0x11'))(_0x641c('0x12'));var utils=require(_0x641c('0x13'));var config=require(_0x641c('0x14'));var db=require(_0x641c('0x15'))['db'];config['redis']=_[_0x641c('0x16')](config[_0x641c('0x17')],{'host':_0x641c('0x18'),'port':0x18eb});var socket=require(_0x641c('0x19'))(new Redis(config[_0x641c('0x17')]));require(_0x641c('0x1a'))[_0x641c('0x1b')](socket);function respondWithStatusCode(_0x1730ec,_0x1a5ff3){_0x1a5ff3=_0x1a5ff3||0xcc;return function(_0xa9178e){if(_0xa9178e){return _0x1730ec['sendStatus'](_0x1a5ff3);}return _0x1730ec['status'](_0x1a5ff3)[_0x641c('0x1c')]();};}function respondWithResult(_0x5f0da0,_0x46c3d0){_0x46c3d0=_0x46c3d0||0xc8;return function(_0xd31419){if(_0xd31419){return _0x5f0da0[_0x641c('0x1d')](_0x46c3d0)[_0x641c('0x1e')](_0xd31419);}};}function respondWithFilteredResult(_0x28b4a8,_0x18b255){return function(_0x55487a){if(_0x55487a){var _0x2dd121=_0x55487a['count'],_0x8e062e=_0x18b255[_0x641c('0x1f')],_0x2df4a5=_0x18b255[_0x641c('0x1f')]+_0x18b255[_0x641c('0x20')],_0x39193b;if(_0x2df4a5>=_0x2dd121){_0x2df4a5=_0x2dd121;_0x39193b=0xc8;}else{_0x39193b=0xce;}_0x28b4a8[_0x641c('0x1d')](_0x39193b);return _0x28b4a8[_0x641c('0x21')](_0x641c('0x22'),_0x8e062e+'-'+_0x2df4a5+'/'+_0x2dd121)[_0x641c('0x1e')](_0x55487a);}return null;};}function patchUpdates(_0x2d9c35){return function(_0x42b1f9){try{jsonpatch[_0x641c('0x23')](_0x42b1f9,_0x2d9c35,!![]);}catch(_0x3e5154){return BPromise[_0x641c('0x24')](_0x3e5154);}return _0x42b1f9[_0x641c('0x25')]();};}function saveUpdates(_0x4cf9b2,_0x1e426e){return function(_0xbe5c59){if(_0xbe5c59){return _0xbe5c59[_0x641c('0x26')](_0x4cf9b2)[_0x641c('0x27')](function(_0x3b8119){return _0x3b8119;});}return null;};}function removeEntity(_0x402abb,_0x340f5b){return function(_0x31e68a){if(_0x31e68a){return _0x31e68a[_0x641c('0x28')]()['then'](function(){var _0x5c5c54=_0x31e68a[_0x641c('0x29')]({'plain':!![]});var _0x156366=_0x641c('0x2a');return db[_0x641c('0x2b')][_0x641c('0x28')]({'where':{'type':_0x156366,'resourceId':_0x5c5c54['id']}})['then'](function(){return _0x31e68a;});})[_0x641c('0x27')](function(){_0x402abb['status'](0xcc)[_0x641c('0x1c')]();});}};}function handleEntityNotFound(_0x5f259e,_0x29ab1a){return function(_0x49fd96){if(!_0x49fd96){_0x5f259e[_0x641c('0x2c')](0x194);}return _0x49fd96;};}function handleError(_0x3b7f05,_0x325258){_0x325258=_0x325258||0x1f4;return function(_0xf5ea5f){logger[_0x641c('0x2d')](_0xf5ea5f[_0x641c('0x2e')]);if(_0xf5ea5f['name']){delete _0xf5ea5f[_0x641c('0x2f')];}_0x3b7f05[_0x641c('0x1d')](_0x325258)['send'](_0xf5ea5f);};}exports[_0x641c('0x30')]=function(_0x457bac,_0x155d5e){var _0x59c246={},_0x373cb7={},_0x130e07={'count':0x0,'rows':[]};var _0x27e34f=_[_0x641c('0x31')](db[_0x641c('0x32')]['rawAttributes'],function(_0x4f852c){return{'name':_0x4f852c['fieldName'],'type':_0x4f852c[_0x641c('0x33')][_0x641c('0x34')]};});_0x373cb7[_0x641c('0x35')]=_[_0x641c('0x31')](_0x27e34f,'name');_0x373cb7[_0x641c('0x36')]=_[_0x641c('0x37')](_0x457bac[_0x641c('0x36')]);_0x373cb7[_0x641c('0x38')]=_['intersection'](_0x373cb7[_0x641c('0x35')],_0x373cb7['query']);_0x59c246[_0x641c('0x39')]=_['intersection'](_0x373cb7[_0x641c('0x35')],qs[_0x641c('0x3a')](_0x457bac['query'][_0x641c('0x3a')]));_0x59c246['attributes']=_0x59c246[_0x641c('0x39')][_0x641c('0x3b')]?_0x59c246[_0x641c('0x39')]:_0x373cb7[_0x641c('0x35')];if(!_0x457bac['query'][_0x641c('0x3c')](_0x641c('0x3d'))){_0x59c246['limit']=qs[_0x641c('0x20')](_0x457bac[_0x641c('0x36')]['limit']);_0x59c246[_0x641c('0x1f')]=qs[_0x641c('0x1f')](_0x457bac[_0x641c('0x36')][_0x641c('0x1f')]);}_0x59c246[_0x641c('0x3e')]=qs[_0x641c('0x3f')](_0x457bac[_0x641c('0x36')][_0x641c('0x3f')]);_0x59c246[_0x641c('0x40')]=qs[_0x641c('0x38')](_[_0x641c('0x41')](_0x457bac[_0x641c('0x36')],_0x373cb7[_0x641c('0x38')]),_0x27e34f);if(_0x457bac[_0x641c('0x36')][_0x641c('0x42')]){_0x59c246[_0x641c('0x40')]=_[_0x641c('0x43')](_0x59c246['where'],{'$or':_[_0x641c('0x31')](_0x27e34f,function(_0x5969c3){if(_0x5969c3['type']!==_0x641c('0x44')){var _0x3d3488={};_0x3d3488[_0x5969c3[_0x641c('0x2f')]]={'$like':'%'+_0x457bac[_0x641c('0x36')][_0x641c('0x42')]+'%'};return _0x3d3488;}})});}_0x59c246=_[_0x641c('0x43')]({},_0x59c246,_0x457bac[_0x641c('0x45')]);var _0x548448={'where':_0x59c246['where']};return db['MailQueue'][_0x641c('0x46')](_0x548448)[_0x641c('0x27')](function(_0xb6637b){_0x130e07[_0x641c('0x46')]=_0xb6637b;if(_0x457bac[_0x641c('0x36')]['includeAll']){_0x59c246[_0x641c('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0x641c('0x48')](_0x59c246);})[_0x641c('0x27')](function(_0x57afd8){_0x130e07[_0x641c('0x49')]=_0x57afd8;return _0x130e07;})[_0x641c('0x27')](respondWithFilteredResult(_0x155d5e,_0x59c246))[_0x641c('0x4a')](handleError(_0x155d5e,null));};exports['show']=function(_0x2cf4fa,_0x4fab78){var _0xe31a5d={'raw':!![],'where':{'id':_0x2cf4fa[_0x641c('0x4b')]['id']}},_0x4b96b4={};_0x4b96b4[_0x641c('0x35')]=_[_0x641c('0x37')](db['MailQueue']['rawAttributes']);_0x4b96b4['query']=_[_0x641c('0x37')](_0x2cf4fa['query']);_0x4b96b4[_0x641c('0x38')]=_[_0x641c('0x4c')](_0x4b96b4['model'],_0x4b96b4[_0x641c('0x36')]);_0xe31a5d[_0x641c('0x39')]=_[_0x641c('0x4c')](_0x4b96b4[_0x641c('0x35')],qs['fields'](_0x2cf4fa[_0x641c('0x36')][_0x641c('0x3a')]));_0xe31a5d[_0x641c('0x39')]=_0xe31a5d[_0x641c('0x39')]['length']?_0xe31a5d[_0x641c('0x39')]:_0x4b96b4[_0x641c('0x35')];if(_0x2cf4fa[_0x641c('0x36')][_0x641c('0x4d')]){_0xe31a5d[_0x641c('0x47')]=[{'all':!![]}];}_0xe31a5d=_[_0x641c('0x43')]({},_0xe31a5d,_0x2cf4fa[_0x641c('0x45')]);return db[_0x641c('0x32')]['find'](_0xe31a5d)[_0x641c('0x27')](handleEntityNotFound(_0x4fab78,null))[_0x641c('0x27')](respondWithResult(_0x4fab78,null))[_0x641c('0x4a')](handleError(_0x4fab78,null));};exports[_0x641c('0x4e')]=function(_0x1fb60f,_0x4f7ca2){return db[_0x641c('0x32')][_0x641c('0x4e')](_0x1fb60f[_0x641c('0x4f')],{})[_0x641c('0x27')](function(_0x168350){var _0x58a228=_0x1fb60f[_0x641c('0x50')][_0x641c('0x29')]({'plain':!![]});if(!_0x58a228)throw new Error(_0x641c('0x51'));if(_0x58a228[_0x641c('0x52')]===_0x641c('0x50')){var _0x5aef85=_0x168350[_0x641c('0x29')]({'plain':!![]});var _0x554b04=_0x641c('0x2a');return db[_0x641c('0x53')][_0x641c('0x54')]({'where':{'name':_0x554b04,'userProfileId':_0x58a228['userProfileId']},'raw':!![]})[_0x641c('0x27')](function(_0x4de2e8){if(_0x4de2e8&&_0x4de2e8[_0x641c('0x55')]===0x0){return db[_0x641c('0x2b')][_0x641c('0x4e')]({'name':_0x5aef85[_0x641c('0x2f')],'resourceId':_0x5aef85['id'],'type':_0x4de2e8[_0x641c('0x2f')],'sectionId':_0x4de2e8['id']},{})[_0x641c('0x27')](function(){return _0x168350;});}else{return _0x168350;}})[_0x641c('0x4a')](function(_0x1e6ca6){logger[_0x641c('0x2d')](_0x641c('0x56'),_0x1e6ca6);throw _0x1e6ca6;});}return _0x168350;})[_0x641c('0x27')](respondWithResult(_0x4f7ca2,0xc9))[_0x641c('0x4a')](handleError(_0x4f7ca2,null));};exports[_0x641c('0x26')]=function(_0x10e258,_0x55055b){if(_0x10e258[_0x641c('0x4f')]['id']){delete _0x10e258[_0x641c('0x4f')]['id'];}return db[_0x641c('0x32')][_0x641c('0x54')]({'where':{'id':_0x10e258['params']['id']}})[_0x641c('0x27')](handleEntityNotFound(_0x55055b,null))[_0x641c('0x27')](saveUpdates(_0x10e258[_0x641c('0x4f')],null))[_0x641c('0x27')](respondWithResult(_0x55055b,null))[_0x641c('0x4a')](handleError(_0x55055b,null));};exports[_0x641c('0x28')]=function(_0x362cd7,_0x17307b){return db['MailQueue'][_0x641c('0x54')]({'where':{'id':_0x362cd7[_0x641c('0x4b')]['id']}})[_0x641c('0x27')](handleEntityNotFound(_0x17307b,null))[_0x641c('0x27')](removeEntity(_0x17307b,null))[_0x641c('0x4a')](handleError(_0x17307b,null));};exports[_0x641c('0x57')]=function(_0x31171d,_0x7a7313){return db[_0x641c('0x32')][_0x641c('0x57')]()[_0x641c('0x27')](respondWithResult(_0x7a7313,null))[_0x641c('0x4a')](handleError(_0x7a7313,null));};exports[_0x641c('0x58')]=function(_0x2aace3,_0x4386b4,_0x3b2dbc){var _0x34fe91={'raw':!![],'where':{}},_0x33dc2a={},_0x4039ca;return db['MailQueue']['findOne']({'where':{'id':_0x2aace3[_0x641c('0x4b')]['id']}})[_0x641c('0x27')](handleEntityNotFound(_0x4386b4,null))['then'](function(_0x52872a){if(_0x52872a){_0x4039ca=_0x52872a['get']({'plain':!![]});_0x33dc2a[_0x641c('0x35')]=_[_0x641c('0x37')](db['UserMailQueue']['rawAttributes']);_0x33dc2a[_0x641c('0x36')]=_[_0x641c('0x37')](_0x2aace3[_0x641c('0x36')]);_0x33dc2a[_0x641c('0x38')]=_[_0x641c('0x4c')](_0x33dc2a[_0x641c('0x35')],_0x33dc2a[_0x641c('0x36')]);_0x34fe91[_0x641c('0x39')]=_['intersection'](_0x33dc2a[_0x641c('0x35')],qs[_0x641c('0x3a')](_0x2aace3[_0x641c('0x36')][_0x641c('0x3a')]));_0x34fe91[_0x641c('0x39')]=_0x34fe91['attributes'][_0x641c('0x3b')]?_0x34fe91[_0x641c('0x39')]:_0x33dc2a[_0x641c('0x35')];if(!_0x2aace3[_0x641c('0x36')][_0x641c('0x3c')](_0x641c('0x3d'))){_0x34fe91[_0x641c('0x20')]=qs['limit'](_0x2aace3['query'][_0x641c('0x20')]);_0x34fe91[_0x641c('0x1f')]=qs[_0x641c('0x1f')](_0x2aace3[_0x641c('0x36')]['offset']);}_0x34fe91[_0x641c('0x3e')]=qs[_0x641c('0x3f')](_0x2aace3[_0x641c('0x36')][_0x641c('0x3f')]);_0x34fe91[_0x641c('0x40')]=qs['filters'](_[_0x641c('0x41')](_0x2aace3['query'],_0x33dc2a['filters']));_0x34fe91[_0x641c('0x40')][_0x641c('0x59')]=_0x52872a['id'];if(_0x2aace3[_0x641c('0x36')][_0x641c('0x42')]){_0x34fe91[_0x641c('0x40')]=_['merge'](_0x34fe91[_0x641c('0x40')],{'$or':_['map'](_0x34fe91[_0x641c('0x39')],function(_0x21f6db){var _0x3eaa72={};_0x3eaa72[_0x21f6db]={'$like':'%'+_0x2aace3[_0x641c('0x36')][_0x641c('0x42')]+'%'};return _0x3eaa72;})});}_0x34fe91=_['merge']({},_0x34fe91,_0x2aace3[_0x641c('0x45')]);return db[_0x641c('0x5a')]['findAll'](_0x34fe91);}})['then'](function(_0x5a6924){if(_0x5a6924){return db['User'][_0x641c('0x5b')]({'where':{'id':_[_0x641c('0x31')](_0x5a6924,_0x641c('0x5c')),'role':_0x641c('0x5d')},'attributes':['id',_0x641c('0x2f'),'mailPause',_0x641c('0x5e'),'createdAt']});}})[_0x641c('0x27')](function(_0x30e7b0){if(_0x30e7b0){return{'count':_0x30e7b0[_0x641c('0x46')],'rows':_[_0x641c('0x31')](_0x30e7b0[_0x641c('0x49')],function(_0x3064f4){return{'membername':_0x3064f4[_0x641c('0x2f')],'UserId':_0x3064f4['id'],'queue_name':_0x4039ca[_0x641c('0x2f')],'MailQueueId':_0x4039ca['id'],'interface':util[_0x641c('0x5f')](_0x641c('0x60'),_0x641c('0x61'),_0x3064f4[_0x641c('0x2f')]),'penalty':0x0,'paused':_0x3064f4['mailPause'],'createdAt':_0x3064f4[_0x641c('0x62')],'updatedAt':_0x3064f4[_0x641c('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4386b4,_0x34fe91))[_0x641c('0x4a')](handleError(_0x4386b4,null));};exports[_0x641c('0x63')]=function(_0x3bdeaf,_0x2f4245,_0x45b4e6){var _0x3754ee={};var _0x189de4={};var _0x3cbc3d;var _0x30e8d9;return db[_0x641c('0x32')]['findOne']({'where':{'id':_0x3bdeaf[_0x641c('0x4b')]['id']}})[_0x641c('0x27')](handleEntityNotFound(_0x2f4245,null))['then'](function(_0x2b749f){if(_0x2b749f){_0x3cbc3d=_0x2b749f;_0x189de4[_0x641c('0x35')]=_['keys'](db['Team']['rawAttributes']);_0x189de4[_0x641c('0x36')]=_[_0x641c('0x37')](_0x3bdeaf[_0x641c('0x36')]);_0x189de4['filters']=_[_0x641c('0x4c')](_0x189de4[_0x641c('0x35')],_0x189de4[_0x641c('0x36')]);_0x3754ee[_0x641c('0x39')]=_[_0x641c('0x4c')](_0x189de4[_0x641c('0x35')],qs['fields'](_0x3bdeaf[_0x641c('0x36')]['fields']));_0x3754ee['attributes']=_0x3754ee[_0x641c('0x39')][_0x641c('0x3b')]?_0x3754ee[_0x641c('0x39')]:_0x189de4['model'];_0x3754ee[_0x641c('0x3e')]=qs['sort'](_0x3bdeaf[_0x641c('0x36')]['sort']);_0x3754ee[_0x641c('0x40')]=qs[_0x641c('0x38')](_[_0x641c('0x41')](_0x3bdeaf['query'],_0x189de4[_0x641c('0x38')]));if(_0x3bdeaf[_0x641c('0x36')]['filter']){_0x3754ee['where']=_[_0x641c('0x43')](_0x3754ee[_0x641c('0x40')],{'$or':_[_0x641c('0x31')](_0x3754ee[_0x641c('0x39')],function(_0x3d2c58){var _0x2ae1b6={};_0x2ae1b6[_0x3d2c58]={'$like':'%'+_0x3bdeaf[_0x641c('0x36')][_0x641c('0x42')]+'%'};return _0x2ae1b6;})});}_0x3754ee=_[_0x641c('0x43')]({},_0x3754ee,_0x3bdeaf[_0x641c('0x45')]);return _0x3cbc3d['getTeams'](_0x3754ee);}})[_0x641c('0x27')](function(_0x20648e){if(_0x20648e){_0x30e8d9=_0x20648e[_0x641c('0x3b')];if(!_0x3bdeaf[_0x641c('0x36')][_0x641c('0x3c')](_0x641c('0x3d'))){_0x3754ee[_0x641c('0x20')]=qs[_0x641c('0x20')](_0x3bdeaf[_0x641c('0x36')][_0x641c('0x20')]);_0x3754ee[_0x641c('0x1f')]=qs[_0x641c('0x1f')](_0x3bdeaf['query']['offset']);}return _0x3cbc3d['getTeams'](_0x3754ee);}})[_0x641c('0x27')](function(_0x1fbd3c){if(_0x1fbd3c){return _0x1fbd3c?{'count':_0x30e8d9,'rows':_0x1fbd3c}:null;}})['then'](respondWithResult(_0x2f4245,null))['catch'](handleError(_0x2f4245,null));};exports[_0x641c('0x64')]=function(_0x5ac617,_0x5224c6,_0x56cf33){var _0x4d6637=_0x5ac617['body'][_0x641c('0x65')];return db['Team'][_0x641c('0x48')]({'where':{'id':_0x4d6637},'attributes':['id'],'include':[{'model':db[_0x641c('0x66')],'as':_0x641c('0x67'),'attributes':['id','name',_0x641c('0x68'),_0x641c('0x69'),_0x641c('0x6a')],'raw':!![]}]})[_0x641c('0x27')](function(_0x6931c8){if(_0x6931c8){var _0x27a1ef=_[_0x641c('0x6b')](_0x6931c8,function(_0x1f4ac3){var _0x430277=_0x1f4ac3[_0x641c('0x29')]({'plain':!![]});return _0x430277[_0x641c('0x67')];});return db[_0x641c('0x32')][_0x641c('0x54')]({'where':{'id':_0x5ac617['params']['id']}})[_0x641c('0x27')](function(_0x4d6b8c){return db[_0x641c('0x6c')][_0x641c('0x6d')](function(_0x38ceb0){return _0x4d6b8c[_0x641c('0x64')](_0x4d6637,{'transaction':_0x38ceb0})['then'](function(){return BPromise['each'](_0x27a1ef,function(_0x4a48c1){return db[_0x641c('0x5a')][_0x641c('0x6e')]({'where':{'UserId':_0x4a48c1['id'],'MailQueueId':_0x5ac617[_0x641c('0x4b')]['id']},'transaction':_0x38ceb0});});})[_0x641c('0x27')](function(){_0x27a1ef[_0x641c('0x6f')](function(_0x389d1d){socket[_0x641c('0x70')]('userMailQueue:save',{'UserId':_0x389d1d['id'],'MailQueueId':_0x4d6b8c['id']});});});});});}})[_0x641c('0x27')](respondWithStatusCode(_0x5224c6,null))[_0x641c('0x4a')](handleError(_0x5224c6,null));};exports[_0x641c('0x71')]=function(_0xe0c99d,_0x2783c0,_0x450d53){return db[_0x641c('0x72')][_0x641c('0x48')]({'where':{'id':_0xe0c99d[_0x641c('0x36')][_0x641c('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x641c('0x27')](handleEntityNotFound(_0x2783c0,null))[_0x641c('0x27')](function(_0x24a166){var _0xde6663=_[_0x641c('0x31')](_0x24a166,'id');var _0x147dc8=[];var _0xc2cd1=[];var _0x2d50a4=squel[_0x641c('0x73')]();_0x2d50a4[_0x641c('0x74')](_0x641c('0x75'))[_0x641c('0x76')](_0x641c('0x77'),'tq')[_0x641c('0x78')](_0x641c('0x79'),'ut',_0x641c('0x7a'))[_0x641c('0x40')](_0x641c('0x7b'),_0xe0c99d[_0x641c('0x4b')]['id']);for(var _0x535cb8=0x0;_0x535cb8<_0x24a166['length'];_0x535cb8+=0x1){let _0x106009=_0x24a166[_0x535cb8];for(var _0x591627=0x0;_0x591627<_0x106009['Agents'][_0x641c('0x3b')];_0x591627+=0x1){let _0x3e4283=_0x106009[_0x641c('0x67')][_0x591627];var _0x495a78=_0x2d50a4[_0x641c('0x7c')]();_0x495a78[_0x641c('0x40')](_0x641c('0x7d'),_0x3e4283['id']);_0xc2cd1[_0x641c('0x7e')](db[_0x641c('0x6c')]['query'](_0x495a78[_0x641c('0x7f')](),{'type':db['sequelize'][_0x641c('0x80')]['SELECT']})[_0x641c('0x27')](function(_0x379b4f){if(_0x379b4f[_0x641c('0x3b')]===0x1){return _0x3e4283['id'];}else{var _0x3a879f=_[_0x641c('0x81')](_[_0x641c('0x31')](_0x379b4f,_0x641c('0x82')),function(_0x3126b0){return _[_0x641c('0x83')](_0xde6663,_0x3126b0);});if(_0x3a879f){return _0x3e4283['id'];}}}));}}return BPromise[_0x641c('0x84')](_0xc2cd1)[_0x641c('0x27')](function(_0x1fb97c){_0x147dc8=_(_0x147dc8)['union'](_0x1fb97c)[_0x641c('0x85')]()[_0x641c('0x86')]();return db[_0x641c('0x32')][_0x641c('0x54')]({'where':{'id':_0xe0c99d[_0x641c('0x4b')]['id']}})[_0x641c('0x27')](function(_0x5bc9e0){return db[_0x641c('0x6c')][_0x641c('0x6d')](function(_0x4c7111){return _0x5bc9e0[_0x641c('0x71')](_0xe0c99d['query']['ids'],{'transaction':_0x4c7111})[_0x641c('0x27')](function(){if(!_['isEmpty'](_0x147dc8)){return _0x5bc9e0[_0x641c('0x87')](_0x147dc8,{'transaction':_0x4c7111});}})[_0x641c('0x27')](function(){_0x147dc8[_0x641c('0x6f')](function(_0x41c460){socket[_0x641c('0x70')](_0x641c('0x88'),{'UserId':_0x41c460,'MailQueueId':_0x5bc9e0['id']});});});});});});})[_0x641c('0x27')](respondWithStatusCode(_0x2783c0,null))[_0x641c('0x4a')](handleError(_0x2783c0,null));};exports['addAgents']=function(_0x4427a9,_0x868260,_0xe41a8a){return db[_0x641c('0x32')]['find']({'where':{'id':_0x4427a9[_0x641c('0x4b')]['id']}})[_0x641c('0x27')](handleEntityNotFound(_0x868260,null))[_0x641c('0x27')](function(_0xa802b0){if(_0xa802b0){return _0xa802b0['addAgents'](_0x4427a9[_0x641c('0x4f')]['ids'],_[_0x641c('0x89')](_0x4427a9[_0x641c('0x4f')],['ids','id'])||{})['spread'](function(_0x5f3d95){for(var _0x312333=0x0;_0x312333<_0x4427a9[_0x641c('0x4f')][_0x641c('0x65')][_0x641c('0x3b')];_0x312333+=0x1){socket[_0x641c('0x70')](_0x641c('0x8a'),{'UserId':_0x4427a9[_0x641c('0x4f')][_0x641c('0x65')][_0x312333],'MailQueueId':_0x4427a9[_0x641c('0x4b')]['id']});}return _0x5f3d95;});}})[_0x641c('0x27')](respondWithResult(_0x868260,null))[_0x641c('0x4a')](handleError(_0x868260,null));};exports[_0x641c('0x87')]=function(_0x4c1f87,_0x7f6561,_0x543787){return db['MailQueue'][_0x641c('0x54')]({'where':{'id':_0x4c1f87[_0x641c('0x4b')]['id']}})[_0x641c('0x27')](handleEntityNotFound(_0x7f6561,null))['then'](function(_0x32cfcc){if(_0x32cfcc){return _0x32cfcc[_0x641c('0x87')](_0x4c1f87['query']['ids'])[_0x641c('0x27')](function(){if(_[_0x641c('0x8b')](_0x4c1f87['query']['ids'])){for(var _0x8c249e=0x0;_0x8c249e<_0x4c1f87[_0x641c('0x36')][_0x641c('0x65')][_0x641c('0x3b')];_0x8c249e+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4c1f87[_0x641c('0x36')][_0x641c('0x65')][_0x8c249e]),'MailQueueId':Number(_0x4c1f87[_0x641c('0x4b')]['id'])});}}else{socket[_0x641c('0x70')](_0x641c('0x88'),{'UserId':Number(_0x4c1f87['query']['ids']),'MailQueueId':Number(_0x4c1f87['params']['id'])});}});}})['then'](respondWithStatusCode(_0x7f6561,null))[_0x641c('0x4a')](handleError(_0x7f6561,null));};exports['getAgents']=function(_0x3bf504,_0x221371,_0x3743e6){var _0x54a10d={};var _0x1f9d1e={};var _0x5405fb;var _0x387b5f;return db[_0x641c('0x32')][_0x641c('0x8c')]({'where':{'id':_0x3bf504[_0x641c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x221371,null))['then'](function(_0x5f1603){if(_0x5f1603){_0x5405fb=_0x5f1603;_0x1f9d1e[_0x641c('0x35')]=_['keys'](db['User']['rawAttributes']);_0x1f9d1e[_0x641c('0x36')]=_[_0x641c('0x37')](_0x3bf504['query']);_0x1f9d1e[_0x641c('0x38')]=_[_0x641c('0x4c')](_0x1f9d1e['model'],_0x1f9d1e['query']);_0x54a10d['attributes']=_['intersection'](_0x1f9d1e[_0x641c('0x35')],qs[_0x641c('0x3a')](_0x3bf504['query'][_0x641c('0x3a')]));_0x54a10d[_0x641c('0x39')]=_0x54a10d['attributes']['length']?_0x54a10d[_0x641c('0x39')]:_0x1f9d1e['model'];_0x54a10d[_0x641c('0x3e')]=qs['sort'](_0x3bf504[_0x641c('0x36')][_0x641c('0x3f')]);_0x54a10d[_0x641c('0x40')]=qs[_0x641c('0x38')](_['pick'](_0x3bf504['query'],_0x1f9d1e[_0x641c('0x38')]));if(_0x3bf504[_0x641c('0x36')][_0x641c('0x42')]){_0x54a10d[_0x641c('0x40')]=_[_0x641c('0x43')](_0x54a10d['where'],{'$or':_[_0x641c('0x31')](_0x54a10d[_0x641c('0x39')],function(_0x2f8969){var _0x3c276c={};_0x3c276c[_0x2f8969]={'$like':'%'+_0x3bf504[_0x641c('0x36')][_0x641c('0x42')]+'%'};return _0x3c276c;})});}_0x54a10d=_[_0x641c('0x43')]({},_0x54a10d,_0x3bf504[_0x641c('0x45')]);return _0x5405fb['getAgents'](_0x54a10d);}})['then'](function(_0x139bd7){if(_0x139bd7){_0x387b5f=_0x139bd7['length'];if(!_0x3bf504[_0x641c('0x36')][_0x641c('0x3c')]('nolimit')){_0x54a10d['limit']=qs['limit'](_0x3bf504[_0x641c('0x36')]['limit']);_0x54a10d[_0x641c('0x1f')]=qs[_0x641c('0x1f')](_0x3bf504[_0x641c('0x36')]['offset']);}return _0x5405fb[_0x641c('0x8d')](_0x54a10d);}})[_0x641c('0x27')](function(_0x31a32e){if(_0x31a32e){return _0x31a32e?{'count':_0x387b5f,'rows':_0x31a32e}:null;}})[_0x641c('0x27')](respondWithResult(_0x221371,null))[_0x641c('0x4a')](handleError(_0x221371,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 27180d1..55b5263 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 _0x07ca=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x2a63f3,_0x3caa75){var _0x46b4e6=function(_0xed1d41){while(--_0xed1d41){_0x2a63f3['push'](_0x2a63f3['shift']());}};_0x46b4e6(++_0x3caa75);}(_0x07ca,0x1a6));var _0xa07c=function(_0xdd9a5f,_0x3ced93){_0xdd9a5f=_0xdd9a5f-0x0;var _0x3464b7=_0x07ca[_0xdd9a5f];return _0x3464b7;};'use strict';var EventEmitter=require(_0xa07c('0x0'));var MailQueue=require(_0xa07c('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa07c('0x2')](0x0);var events={'afterCreate':_0xa07c('0x3'),'afterUpdate':_0xa07c('0x4'),'afterDestroy':_0xa07c('0x5')};function emitEvent(_0x482bfc){return function(_0x4d332d,_0xce5c1b,_0xccc097){MailQueueEvents['emit'](_0x482bfc+':'+_0x4d332d['id'],_0x4d332d);MailQueueEvents[_0xa07c('0x6')](_0x482bfc,_0x4d332d);_0xccc097(null);};}for(var e in events){if(events[_0xa07c('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xa07c('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xb7c3=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xb7c3,0x1f0));var _0x3b7c=function(_0x227687,_0x5bc752){_0x227687=_0x227687-0x0;var _0x5c1a30=_0xb7c3[_0x227687];return _0x5c1a30;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x3b7c('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b7c('0x1'),'afterUpdate':_0x3b7c('0x2'),'afterDestroy':_0x3b7c('0x3')};function emitEvent(_0x3bcb78){return function(_0x4edad0,_0x2529fa,_0x1f47df){MailQueueEvents[_0x3b7c('0x4')](_0x3bcb78+':'+_0x4edad0['id'],_0x4edad0);MailQueueEvents[_0x3b7c('0x4')](_0x3bcb78,_0x4edad0);_0x1f47df(null);};}for(var e in events){if(events[_0x3b7c('0x5')](e)){var event=events[e];MailQueue[_0x3b7c('0x6')](e,emitEvent(event));}}module[_0x3b7c('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 48b2c8e..1aa8625 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 _0xccfd=['exports','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x3d075a,_0x507f04){var _0x418be1=function(_0x19c75b){while(--_0x19c75b){_0x3d075a['push'](_0x3d075a['shift']());}};_0x418be1(++_0x507f04);}(_0xccfd,0x161));var _0xdccf=function(_0x8c8643,_0x2ddd9b){_0x8c8643=_0x8c8643-0x0;var _0x5bd91a=_0xccfd[_0x8c8643];return _0x5bd91a;};'use strict';var _=require(_0xdccf('0x0'));var util=require(_0xdccf('0x1'));var logger=require(_0xdccf('0x2'))(_0xdccf('0x3'));var moment=require(_0xdccf('0x4'));var BPromise=require(_0xdccf('0x5'));var rp=require(_0xdccf('0x6'));var fs=require('fs');var path=require(_0xdccf('0x7'));var rimraf=require(_0xdccf('0x8'));var config=require(_0xdccf('0x9'));var attributes=require(_0xdccf('0xa'));module[_0xdccf('0xb')]=function(_0xf58792,_0x43014c){return _0xf58792['define'](_0xdccf('0xc'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73f3=['moment','bluebird','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','util','../../config/logger','api'];(function(_0x233543,_0x258205){var _0x3b34ea=function(_0x2f9e25){while(--_0x2f9e25){_0x233543['push'](_0x233543['shift']());}};_0x3b34ea(++_0x258205);}(_0x73f3,0x76));var _0x373f=function(_0x24e9e4,_0x3be39a){_0x24e9e4=_0x24e9e4-0x0;var _0x5973cc=_0x73f3[_0x24e9e4];return _0x5973cc;};'use strict';var _=require('lodash');var util=require(_0x373f('0x0'));var logger=require(_0x373f('0x1'))(_0x373f('0x2'));var moment=require(_0x373f('0x3'));var BPromise=require(_0x373f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x373f('0x5'));var config=require(_0x373f('0x6'));var attributes=require(_0x373f('0x7'));module[_0x373f('0x8')]=function(_0x234f6c,_0x599aab){return _0x234f6c['define'](_0x373f('0x9'),attributes,{'tableName':_0x373f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 9dd3562..81ba968 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 _0x2f5a=['catch','ShowMailQueue','find','raw','where','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailQueue','MailQueue','findAll','options','attributes','include','map','model'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x2f5a,0x1e6));var _0xa2f5=function(_0x402a43,_0x68abb5){_0x402a43=_0x402a43-0x0;var _0xe8bc0=_0x2f5a[_0x402a43];return _0xe8bc0;};'use strict';var _=require('lodash');var util=require(_0xa2f5('0x0'));var moment=require('moment');var BPromise=require(_0xa2f5('0x1'));var rs=require(_0xa2f5('0x2'));var fs=require('fs');var Redis=require(_0xa2f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2f5('0x4'));var logger=require(_0xa2f5('0x5'))(_0xa2f5('0x6'));var config=require('../../config/environment');var jayson=require(_0xa2f5('0x7'));var client=jayson[_0xa2f5('0x8')]['http']({'port':0x232a});config[_0xa2f5('0x9')]=_[_0xa2f5('0xa')](config[_0xa2f5('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2f5('0xb'))(new Redis(config[_0xa2f5('0x9')]));require(_0xa2f5('0xc'))[_0xa2f5('0xd')](socket);function respondWithRpcPromise(_0x25e61e,_0x4cdd1d,_0x6f20b8){return new BPromise(function(_0x5683e2,_0x5ed0b0){return client['request'](_0x25e61e,_0x6f20b8)[_0xa2f5('0xe')](function(_0x5aed10){logger[_0xa2f5('0xf')](_0xa2f5('0x10'),_0x4cdd1d,_0xa2f5('0x11'));logger[_0xa2f5('0x12')](_0xa2f5('0x13'),_0x4cdd1d,_0xa2f5('0x11'),JSON[_0xa2f5('0x14')](_0x5aed10));if(_0x5aed10[_0xa2f5('0x15')]){if(_0x5aed10['error'][_0xa2f5('0x16')]===0x1f4){logger[_0xa2f5('0x15')](_0xa2f5('0x10'),_0x4cdd1d,_0x5aed10['error'][_0xa2f5('0x17')]);return _0x5ed0b0(_0x5aed10['error'][_0xa2f5('0x17')]);}logger[_0xa2f5('0x15')](_0xa2f5('0x10'),_0x4cdd1d,_0x5aed10['error'][_0xa2f5('0x17')]);return _0x5683e2(_0x5aed10['error'][_0xa2f5('0x17')]);}else{logger[_0xa2f5('0xf')](_0xa2f5('0x10'),_0x4cdd1d,'request\x20sent');_0x5683e2(_0x5aed10['result'][_0xa2f5('0x17')]);}})['catch'](function(_0x928c5b){logger[_0xa2f5('0x15')](_0xa2f5('0x10'),_0x4cdd1d,_0x928c5b);_0x5ed0b0(_0x928c5b);});});}exports[_0xa2f5('0x18')]=function(_0x2e78a4){var _0x1e58b8=this;return new Promise(function(_0x1cf655,_0x26ced1){return db[_0xa2f5('0x19')][_0xa2f5('0x1a')]({'raw':_0x2e78a4[_0xa2f5('0x1b')]?_0x2e78a4[_0xa2f5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2e78a4[_0xa2f5('0x1b')]?_0x2e78a4[_0xa2f5('0x1b')]['where']||null:null,'attributes':_0x2e78a4['options']?_0x2e78a4[_0xa2f5('0x1b')][_0xa2f5('0x1c')]||null:null,'limit':_0x2e78a4['options']?_0x2e78a4[_0xa2f5('0x1b')]['limit']||null:null,'include':_0x2e78a4[_0xa2f5('0x1b')]?_0x2e78a4[_0xa2f5('0x1b')][_0xa2f5('0x1d')]?_[_0xa2f5('0x1e')](_0x2e78a4[_0xa2f5('0x1b')]['include'],function(_0x41e38f){return{'model':db[_0x41e38f['model']],'as':_0x41e38f['as'],'attributes':_0x41e38f[_0xa2f5('0x1c')],'include':_0x41e38f['include']?_[_0xa2f5('0x1e')](_0x41e38f[_0xa2f5('0x1d')],function(_0x7e166){return{'model':db[_0x7e166[_0xa2f5('0x1f')]],'as':_0x7e166['as'],'attributes':_0x7e166[_0xa2f5('0x1c')],'include':_0x7e166['include']?_[_0xa2f5('0x1e')](_0x7e166[_0xa2f5('0x1d')],function(_0x4bf572){return{'model':db[_0x4bf572[_0xa2f5('0x1f')]],'as':_0x4bf572['as'],'attributes':_0x4bf572['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x871dce){logger[_0xa2f5('0xf')](_0xa2f5('0x18'),_0x2e78a4);logger[_0xa2f5('0x12')](_0xa2f5('0x18'),_0x2e78a4,JSON[_0xa2f5('0x14')](_0x871dce));_0x1cf655(_0x871dce);})[_0xa2f5('0x20')](function(_0x4054fa){logger[_0xa2f5('0x15')](_0xa2f5('0x18'),_0x4054fa[_0xa2f5('0x17')],_0x2e78a4);_0x26ced1(_0x1e58b8[_0xa2f5('0x15')](0x1f4,_0x4054fa[_0xa2f5('0x17')]));});});};exports[_0xa2f5('0x21')]=function(_0x4dce6a){var _0xbf7b9f=this;return new Promise(function(_0x371b68,_0x59e7cc){return db['MailQueue'][_0xa2f5('0x22')]({'raw':_0x4dce6a[_0xa2f5('0x1b')]?_0x4dce6a[_0xa2f5('0x1b')][_0xa2f5('0x23')]===undefined?!![]:![]:!![],'where':_0x4dce6a[_0xa2f5('0x1b')]?_0x4dce6a['options'][_0xa2f5('0x24')]||null:null,'attributes':_0x4dce6a[_0xa2f5('0x1b')]?_0x4dce6a[_0xa2f5('0x1b')][_0xa2f5('0x1c')]||null:null,'include':_0x4dce6a[_0xa2f5('0x1b')]?_0x4dce6a[_0xa2f5('0x1b')]['include']?_[_0xa2f5('0x1e')](_0x4dce6a[_0xa2f5('0x1b')][_0xa2f5('0x1d')],function(_0x1e58b7){return{'model':db[_0x1e58b7[_0xa2f5('0x1f')]],'as':_0x1e58b7['as'],'attributes':_0x1e58b7[_0xa2f5('0x1c')],'include':_0x1e58b7[_0xa2f5('0x1d')]?_[_0xa2f5('0x1e')](_0x1e58b7[_0xa2f5('0x1d')],function(_0xf3872){return{'model':db[_0xf3872[_0xa2f5('0x1f')]],'as':_0xf3872['as'],'attributes':_0xf3872[_0xa2f5('0x1c')],'include':_0xf3872[_0xa2f5('0x1d')]?_[_0xa2f5('0x1e')](_0xf3872[_0xa2f5('0x1d')],function(_0x4af6bf){return{'model':db[_0x4af6bf[_0xa2f5('0x1f')]],'as':_0x4af6bf['as'],'attributes':_0x4af6bf[_0xa2f5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa2f5('0xe')](function(_0x51eaba){logger[_0xa2f5('0xf')](_0xa2f5('0x21'),_0x4dce6a);logger['debug'](_0xa2f5('0x21'),_0x4dce6a,JSON[_0xa2f5('0x14')](_0x51eaba));_0x371b68(_0x51eaba);})[_0xa2f5('0x20')](function(_0x384add){logger[_0xa2f5('0x15')](_0xa2f5('0x21'),_0x384add['message'],_0x4dce6a);_0x59e7cc(_0xbf7b9f[_0xa2f5('0x15')](0x1f4,_0x384add['message']));});});}; \ No newline at end of file +var _0x3a62=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','info','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','findAll','options','attributes','limit','include','model','map','then','debug','GetMailQueue','find','raw','where','ShowMailQueue','lodash','util','randomstring','ioredis','../../config/logger'];(function(_0x16e586,_0x3e6274){var _0x13837d=function(_0x1c0e66){while(--_0x1c0e66){_0x16e586['push'](_0x16e586['shift']());}};_0x13837d(++_0x3e6274);}(_0x3a62,0x19d));var _0x23a6=function(_0x1bb4f0,_0x20f762){_0x1bb4f0=_0x1bb4f0-0x0;var _0x564396=_0x3a62[_0x1bb4f0];return _0x564396;};'use strict';var _=require(_0x23a6('0x0'));var util=require(_0x23a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x23a6('0x2'));var fs=require('fs');var Redis=require(_0x23a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x23a6('0x4'))(_0x23a6('0x5'));var config=require(_0x23a6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x23a6('0x7')][_0x23a6('0x8')]({'port':0x232a});config[_0x23a6('0x9')]=_[_0x23a6('0xa')](config['redis'],{'host':_0x23a6('0xb'),'port':0x18eb});var socket=require(_0x23a6('0xc'))(new Redis(config[_0x23a6('0x9')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5020a5,_0x387763,_0x5d6d00){return new BPromise(function(_0x6afef2,_0x107784){return client[_0x23a6('0xd')](_0x5020a5,_0x5d6d00)['then'](function(_0x17d97a){logger[_0x23a6('0xe')]('MailQueue,\x20%s,\x20%s',_0x387763,'request\x20sent');logger['debug'](_0x23a6('0xf'),_0x387763,_0x23a6('0x10'),JSON[_0x23a6('0x11')](_0x17d97a));if(_0x17d97a[_0x23a6('0x12')]){if(_0x17d97a[_0x23a6('0x12')][_0x23a6('0x13')]===0x1f4){logger[_0x23a6('0x12')](_0x23a6('0x14'),_0x387763,_0x17d97a[_0x23a6('0x12')][_0x23a6('0x15')]);return _0x107784(_0x17d97a[_0x23a6('0x12')]['message']);}logger[_0x23a6('0x12')](_0x23a6('0x14'),_0x387763,_0x17d97a['error']['message']);return _0x6afef2(_0x17d97a['error'][_0x23a6('0x15')]);}else{logger[_0x23a6('0xe')](_0x23a6('0x14'),_0x387763,_0x23a6('0x10'));_0x6afef2(_0x17d97a[_0x23a6('0x16')][_0x23a6('0x15')]);}})[_0x23a6('0x17')](function(_0x5caae0){logger['error']('MailQueue,\x20%s,\x20%s',_0x387763,_0x5caae0);_0x107784(_0x5caae0);});});}exports['GetMailQueue']=function(_0x3d706d){var _0xefc23b=this;return new Promise(function(_0x257409,_0x11b999){return db['MailQueue'][_0x23a6('0x18')]({'raw':_0x3d706d[_0x23a6('0x19')]?_0x3d706d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d706d[_0x23a6('0x19')]?_0x3d706d[_0x23a6('0x19')]['where']||null:null,'attributes':_0x3d706d[_0x23a6('0x19')]?_0x3d706d[_0x23a6('0x19')][_0x23a6('0x1a')]||null:null,'limit':_0x3d706d[_0x23a6('0x19')]?_0x3d706d[_0x23a6('0x19')][_0x23a6('0x1b')]||null:null,'include':_0x3d706d['options']?_0x3d706d[_0x23a6('0x19')]['include']?_['map'](_0x3d706d[_0x23a6('0x19')][_0x23a6('0x1c')],function(_0x33b830){return{'model':db[_0x33b830[_0x23a6('0x1d')]],'as':_0x33b830['as'],'attributes':_0x33b830['attributes'],'include':_0x33b830[_0x23a6('0x1c')]?_[_0x23a6('0x1e')](_0x33b830[_0x23a6('0x1c')],function(_0x5367fb){return{'model':db[_0x5367fb[_0x23a6('0x1d')]],'as':_0x5367fb['as'],'attributes':_0x5367fb[_0x23a6('0x1a')],'include':_0x5367fb[_0x23a6('0x1c')]?_[_0x23a6('0x1e')](_0x5367fb[_0x23a6('0x1c')],function(_0x359c15){return{'model':db[_0x359c15['model']],'as':_0x359c15['as'],'attributes':_0x359c15[_0x23a6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x23a6('0x1f')](function(_0x22a752){logger[_0x23a6('0xe')]('GetMailQueue',_0x3d706d);logger[_0x23a6('0x20')]('GetMailQueue',_0x3d706d,JSON['stringify'](_0x22a752));_0x257409(_0x22a752);})[_0x23a6('0x17')](function(_0x4f0d44){logger[_0x23a6('0x12')](_0x23a6('0x21'),_0x4f0d44[_0x23a6('0x15')],_0x3d706d);_0x11b999(_0xefc23b[_0x23a6('0x12')](0x1f4,_0x4f0d44[_0x23a6('0x15')]));});});};exports['ShowMailQueue']=function(_0x1dd5e3){var _0x5841cc=this;return new Promise(function(_0x673721,_0x43b3e6){return db['MailQueue'][_0x23a6('0x22')]({'raw':_0x1dd5e3[_0x23a6('0x19')]?_0x1dd5e3[_0x23a6('0x19')][_0x23a6('0x23')]===undefined?!![]:![]:!![],'where':_0x1dd5e3['options']?_0x1dd5e3['options'][_0x23a6('0x24')]||null:null,'attributes':_0x1dd5e3[_0x23a6('0x19')]?_0x1dd5e3[_0x23a6('0x19')]['attributes']||null:null,'include':_0x1dd5e3[_0x23a6('0x19')]?_0x1dd5e3[_0x23a6('0x19')]['include']?_[_0x23a6('0x1e')](_0x1dd5e3['options'][_0x23a6('0x1c')],function(_0xcc70d9){return{'model':db[_0xcc70d9[_0x23a6('0x1d')]],'as':_0xcc70d9['as'],'attributes':_0xcc70d9['attributes'],'include':_0xcc70d9[_0x23a6('0x1c')]?_[_0x23a6('0x1e')](_0xcc70d9[_0x23a6('0x1c')],function(_0xa01fdc){return{'model':db[_0xa01fdc[_0x23a6('0x1d')]],'as':_0xa01fdc['as'],'attributes':_0xa01fdc[_0x23a6('0x1a')],'include':_0xa01fdc['include']?_[_0x23a6('0x1e')](_0xa01fdc[_0x23a6('0x1c')],function(_0x49d7c7){return{'model':db[_0x49d7c7[_0x23a6('0x1d')]],'as':_0x49d7c7['as'],'attributes':_0x49d7c7[_0x23a6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x23a6('0x1f')](function(_0x36bcda){logger['info']('ShowMailQueue',_0x1dd5e3);logger[_0x23a6('0x20')]('ShowMailQueue',_0x1dd5e3,JSON[_0x23a6('0x11')](_0x36bcda));_0x673721(_0x36bcda);})['catch'](function(_0x570c71){logger['error'](_0x23a6('0x25'),_0x570c71[_0x23a6('0x15')],_0x1dd5e3);_0x43b3e6(_0x5841cc[_0x23a6('0x12')](0x1f4,_0x570c71[_0x23a6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7b38fd7..8e8124a 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 _0xb018=['save','remove','update','emit','removeListener','register','length'];(function(_0x14ad1b,_0x1a9fc4){var _0x23307f=function(_0x10c3d8){while(--_0x10c3d8){_0x14ad1b['push'](_0x14ad1b['shift']());}};_0x23307f(++_0x1a9fc4);}(_0xb018,0xcb));var _0x8b01=function(_0x5e781c,_0x25a011){_0x5e781c=_0x5e781c-0x0;var _0x277e54=_0xb018[_0x5e781c];return _0x277e54;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x8b01('0x0'),_0x8b01('0x1'),_0x8b01('0x2')];function createListener(_0x4215cf,_0x4c4278){return function(_0x161863){_0x4c4278[_0x8b01('0x3')](_0x4215cf,_0x161863);};}function removeListener(_0x33d476,_0x3884c7){return function(){MailQueueEvents[_0x8b01('0x4')](_0x33d476,_0x3884c7);};}exports[_0x8b01('0x5')]=function(_0x3c3dcc){for(var _0x2b7acc=0x0,_0x3eb637=events[_0x8b01('0x6')];_0x2b7acc<_0x3eb637;_0x2b7acc++){var _0x22e65e=events[_0x2b7acc];var _0x863a44=createListener('mailQueue:'+_0x22e65e,_0x3c3dcc);MailQueueEvents['on'](_0x22e65e,_0x863a44);}}; \ No newline at end of file +var _0xf468=['save','update','emit','register','length','./mailQueue.events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf468,0x1e5));var _0x8f46=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xf468[_0x1cfa0d];return _0xe33279;};'use strict';var MailQueueEvents=require(_0x8f46('0x0'));var events=[_0x8f46('0x1'),'remove',_0x8f46('0x2')];function createListener(_0x525677,_0x3f9aba){return function(_0x2ac263){_0x3f9aba[_0x8f46('0x3')](_0x525677,_0x2ac263);};}function removeListener(_0xefc6cd,_0x2abe67){return function(){MailQueueEvents['removeListener'](_0xefc6cd,_0x2abe67);};}exports[_0x8f46('0x4')]=function(_0x5ef851){for(var _0x1210c8=0x0,_0x240358=events[_0x8f46('0x5')];_0x1210c8<_0x240358;_0x1210c8++){var _0x19a7ec=events[_0x1210c8];var _0x5e299c=createListener('mailQueue:'+_0x19a7ec,_0x5ef851);MailQueueEvents['on'](_0x19a7ec,_0x5e299c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8e0dbd2..36bb118 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 _0xc16a=['update','delete','destroy','multer','path','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x17a6dd,_0x1543c1){var _0x4d1b6d=function(_0x47995c){while(--_0x47995c){_0x17a6dd['push'](_0x17a6dd['shift']());}};_0x4d1b6d(++_0x1543c1);}(_0xc16a,0x12f));var _0xac16=function(_0x4afb3b,_0x51614c){_0x4afb3b=_0x4afb3b-0x0;var _0x14cd9f=_0xc16a[_0x4afb3b];return _0x14cd9f;};'use strict';var multer=require(_0xac16('0x0'));var util=require('util');var path=require(_0xac16('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xac16('0x2'));var config=require('../../config/environment');var controller=require(_0xac16('0x3'));router[_0xac16('0x4')]('/',auth[_0xac16('0x5')](),controller[_0xac16('0x6')]);router[_0xac16('0x4')](_0xac16('0x7'),auth[_0xac16('0x5')](),controller[_0xac16('0x8')]);router[_0xac16('0x4')](_0xac16('0x9'),auth[_0xac16('0x5')](),controller[_0xac16('0xa')]);router['post']('/',auth[_0xac16('0x5')](),controller['create']);router[_0xac16('0xb')](_0xac16('0x9'),auth[_0xac16('0x5')](),controller[_0xac16('0xc')]);router[_0xac16('0xd')](_0xac16('0x9'),auth['isAuthenticated'](),controller[_0xac16('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7717=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','update','destroy','exports'];(function(_0x4b1cf8,_0x4ce962){var _0x45cac1=function(_0x5ac132){while(--_0x5ac132){_0x4b1cf8['push'](_0x4b1cf8['shift']());}};_0x45cac1(++_0x4ce962);}(_0x7717,0x168));var _0x7771=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7717[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7771('0x0'));var util=require(_0x7771('0x1'));var path=require(_0x7771('0x2'));var timeout=require('connect-timeout');var express=require(_0x7771('0x3'));var router=express[_0x7771('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7771('0x5'));var config=require(_0x7771('0x6'));var controller=require('./mailQueueReport.controller');router[_0x7771('0x7')]('/',auth[_0x7771('0x8')](),controller['index']);router[_0x7771('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x7771('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7771('0x8')](),controller[_0x7771('0xa')]);router[_0x7771('0xb')](_0x7771('0x9'),auth[_0x7771('0x8')](),controller[_0x7771('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7771('0xd')]);module[_0x7771('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index d9073e2..645dd94 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 _0xdf8b=['sequelize','STRING','DATE','moment'];(function(_0x5066c0,_0x24ce1a){var _0x5962f1=function(_0xbeeb40){while(--_0xbeeb40){_0x5066c0['push'](_0x5066c0['shift']());}};_0x5962f1(++_0x24ce1a);}(_0xdf8b,0x1cb));var _0xbdf8=function(_0x4d214f,_0x4a9d72){_0x4d214f=_0x4d214f-0x0;var _0x35d3e0=_0xdf8b[_0x4d214f];return _0x35d3e0;};'use strict';var moment=require(_0xbdf8('0x0'));var Sequelize=require(_0xbdf8('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbdf8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbdf8('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbdf8('0x3')]},'acceptAt':{'type':Sequelize[_0xbdf8('0x3')]},'exitAt':{'type':Sequelize[_0xbdf8('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b81=['sequelize','exports','STRING','DATE','moment'];(function(_0x1b1365,_0x205568){var _0x5edfd8=function(_0xae9b3d){while(--_0xae9b3d){_0x1b1365['push'](_0x1b1365['shift']());}};_0x5edfd8(++_0x205568);}(_0x5b81,0xf4));var _0x15b8=function(_0x5cda03,_0x249db1){_0x5cda03=_0x5cda03-0x0;var _0x4318d5=_0x5b81[_0x5cda03];return _0x4318d5;};'use strict';var moment=require(_0x15b8('0x0'));var Sequelize=require(_0x15b8('0x1'));module[_0x15b8('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x15b8('0x3')]},'joinAt':{'type':Sequelize[_0x15b8('0x4')]},'leaveAt':{'type':Sequelize[_0x15b8('0x4')]},'acceptAt':{'type':Sequelize[_0x15b8('0x4')]},'exitAt':{'type':Sequelize[_0x15b8('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 557ad44..0fad467 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 _0x372b=['merge','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x372b,0x18a));var _0xb372=function(_0x2d844a,_0x15e969){_0x2d844a=_0x2d844a-0x0;var _0x24c3ed=_0x372b[_0x2d844a];return _0x24c3ed;};'use strict';var pdf=require(_0xb372('0x0'));var emlformat=require(_0xb372('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb372('0x2'));var jsonpatch=require(_0xb372('0x3'));var rp=require(_0xb372('0x4'));var moment=require(_0xb372('0x5'));var BPromise=require(_0xb372('0x6'));var Mustache=require(_0xb372('0x7'));var util=require('util');var path=require(_0xb372('0x8'));var sox=require(_0xb372('0x9'));var csv=require(_0xb372('0xa'));var ejs=require(_0xb372('0xb'));var fs=require('fs');var _=require(_0xb372('0xc'));var squel=require(_0xb372('0xd'));var crypto=require(_0xb372('0xe'));var jsforce=require(_0xb372('0xf'));var deskjs=require(_0xb372('0x10'));var toCsv=require(_0xb372('0xa'));var querystring=require(_0xb372('0x11'));var Papa=require(_0xb372('0x12'));var Redis=require('ioredis');var authService=require(_0xb372('0x13'));var qs=require(_0xb372('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb372('0x15'));var logger=require(_0xb372('0x16'))('api');var utils=require(_0xb372('0x17'));var config=require(_0xb372('0x18'));var db=require(_0xb372('0x19'))['db'];function respondWithStatusCode(_0x5b61c6,_0x1181ac){_0x1181ac=_0x1181ac||0xcc;return function(_0x1dbb6a){if(_0x1dbb6a){return _0x5b61c6[_0xb372('0x1a')](_0x1181ac);}return _0x5b61c6[_0xb372('0x1b')](_0x1181ac)[_0xb372('0x1c')]();};}function respondWithResult(_0x2894cc,_0x1b34a5){_0x1b34a5=_0x1b34a5||0xc8;return function(_0x47d45a){if(_0x47d45a){return _0x2894cc[_0xb372('0x1b')](_0x1b34a5)[_0xb372('0x1d')](_0x47d45a);}};}function respondWithFilteredResult(_0x4862b3,_0x1221cc){return function(_0x5be5b9){if(_0x5be5b9){var _0x452834=_0x5be5b9[_0xb372('0x1e')],_0x1eebee=_0x1221cc['offset'],_0xb45a2a=_0x1221cc[_0xb372('0x1f')]+_0x1221cc[_0xb372('0x20')],_0x197b7c;if(_0xb45a2a>=_0x452834){_0xb45a2a=_0x452834;_0x197b7c=0xc8;}else{_0x197b7c=0xce;}_0x4862b3[_0xb372('0x1b')](_0x197b7c);return _0x4862b3[_0xb372('0x21')](_0xb372('0x22'),_0x1eebee+'-'+_0xb45a2a+'/'+_0x452834)[_0xb372('0x1d')](_0x5be5b9);}return null;};}function patchUpdates(_0x476c89){return function(_0x5535a2){try{jsonpatch[_0xb372('0x23')](_0x5535a2,_0x476c89,!![]);}catch(_0x22c8c9){return BPromise[_0xb372('0x24')](_0x22c8c9);}return _0x5535a2['save']();};}function saveUpdates(_0x4f1a8b,_0x110d31){return function(_0x208389){if(_0x208389){return _0x208389[_0xb372('0x25')](_0x4f1a8b)[_0xb372('0x26')](function(_0x5d8ab3){return _0x5d8ab3;});}return null;};}function removeEntity(_0x270305,_0x18ba9f){return function(_0x1f9511){if(_0x1f9511){return _0x1f9511[_0xb372('0x27')]()['then'](function(){_0x270305[_0xb372('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10eea2,_0x1777e4){return function(_0x208fac){if(!_0x208fac){_0x10eea2[_0xb372('0x1a')](0x194);}return _0x208fac;};}function handleError(_0x267455,_0x20416d){_0x20416d=_0x20416d||0x1f4;return function(_0x355a1e){logger['error'](_0x355a1e[_0xb372('0x28')]);if(_0x355a1e[_0xb372('0x29')]){delete _0x355a1e[_0xb372('0x29')];}_0x267455[_0xb372('0x1b')](_0x20416d)[_0xb372('0x2a')](_0x355a1e);};}exports[_0xb372('0x2b')]=function(_0x2f9030,_0x306a4a){var _0x40ba78={},_0x2f5e61={},_0x4811d5={'count':0x0,'rows':[]};var _0x14187e=_[_0xb372('0x2c')](db['MailQueueReport'][_0xb372('0x2d')],function(_0x3819ce){return{'name':_0x3819ce['fieldName'],'type':_0x3819ce[_0xb372('0x2e')][_0xb372('0x2f')]};});_0x2f5e61[_0xb372('0x30')]=_[_0xb372('0x2c')](_0x14187e,'name');_0x2f5e61[_0xb372('0x31')]=_[_0xb372('0x32')](_0x2f9030[_0xb372('0x31')]);_0x2f5e61[_0xb372('0x33')]=_[_0xb372('0x34')](_0x2f5e61['model'],_0x2f5e61[_0xb372('0x31')]);_0x40ba78['attributes']=_[_0xb372('0x34')](_0x2f5e61[_0xb372('0x30')],qs[_0xb372('0x35')](_0x2f9030['query'][_0xb372('0x35')]));_0x40ba78[_0xb372('0x36')]=_0x40ba78[_0xb372('0x36')][_0xb372('0x37')]?_0x40ba78[_0xb372('0x36')]:_0x2f5e61[_0xb372('0x30')];if(!_0x2f9030[_0xb372('0x31')][_0xb372('0x38')]('nolimit')){_0x40ba78[_0xb372('0x20')]=qs['limit'](_0x2f9030['query'][_0xb372('0x20')]);_0x40ba78[_0xb372('0x1f')]=qs[_0xb372('0x1f')](_0x2f9030[_0xb372('0x31')][_0xb372('0x1f')]);}_0x40ba78[_0xb372('0x39')]=qs[_0xb372('0x3a')](_0x2f9030[_0xb372('0x31')][_0xb372('0x3a')]);_0x40ba78['where']=qs[_0xb372('0x33')](_[_0xb372('0x3b')](_0x2f9030[_0xb372('0x31')],_0x2f5e61[_0xb372('0x33')]),_0x14187e);if(_0x2f9030[_0xb372('0x31')][_0xb372('0x3c')]){_0x40ba78[_0xb372('0x3d')]=_[_0xb372('0x3e')](_0x40ba78[_0xb372('0x3d')],{'$or':_[_0xb372('0x2c')](_0x14187e,function(_0x7fe12a){if(_0x7fe12a[_0xb372('0x2e')]!=='VIRTUAL'){var _0x3af253={};_0x3af253[_0x7fe12a[_0xb372('0x29')]]={'$like':'%'+_0x2f9030['query'][_0xb372('0x3c')]+'%'};return _0x3af253;}})});}_0x40ba78=_['merge']({},_0x40ba78,_0x2f9030[_0xb372('0x3f')]);var _0x358c8d={'where':_0x40ba78['where']};return db[_0xb372('0x40')][_0xb372('0x1e')](_0x358c8d)[_0xb372('0x26')](function(_0xc1e63a){_0x4811d5[_0xb372('0x1e')]=_0xc1e63a;if(_0x2f9030[_0xb372('0x31')][_0xb372('0x41')]){_0x40ba78[_0xb372('0x42')]=[{'all':!![]}];}return db[_0xb372('0x40')][_0xb372('0x43')](_0x40ba78);})['then'](function(_0x1819ea){_0x4811d5[_0xb372('0x44')]=_0x1819ea;return _0x4811d5;})[_0xb372('0x26')](respondWithFilteredResult(_0x306a4a,_0x40ba78))[_0xb372('0x45')](handleError(_0x306a4a,null));};exports[_0xb372('0x46')]=function(_0x1541ff,_0x1a90d3){var _0x211ff5={'raw':!![],'where':{'id':_0x1541ff[_0xb372('0x47')]['id']}},_0x19dd7a={};_0x19dd7a[_0xb372('0x30')]=_[_0xb372('0x32')](db[_0xb372('0x40')][_0xb372('0x2d')]);_0x19dd7a[_0xb372('0x31')]=_['keys'](_0x1541ff[_0xb372('0x31')]);_0x19dd7a[_0xb372('0x33')]=_[_0xb372('0x34')](_0x19dd7a[_0xb372('0x30')],_0x19dd7a[_0xb372('0x31')]);_0x211ff5[_0xb372('0x36')]=_[_0xb372('0x34')](_0x19dd7a[_0xb372('0x30')],qs['fields'](_0x1541ff[_0xb372('0x31')][_0xb372('0x35')]));_0x211ff5['attributes']=_0x211ff5[_0xb372('0x36')][_0xb372('0x37')]?_0x211ff5[_0xb372('0x36')]:_0x19dd7a[_0xb372('0x30')];if(_0x1541ff[_0xb372('0x31')][_0xb372('0x41')]){_0x211ff5['include']=[{'all':!![]}];}_0x211ff5=_[_0xb372('0x3e')]({},_0x211ff5,_0x1541ff[_0xb372('0x3f')]);return db[_0xb372('0x40')][_0xb372('0x48')](_0x211ff5)[_0xb372('0x26')](handleEntityNotFound(_0x1a90d3,null))[_0xb372('0x26')](respondWithResult(_0x1a90d3,null))[_0xb372('0x45')](handleError(_0x1a90d3,null));};exports[_0xb372('0x49')]=function(_0x5ac25e,_0x28c0da){return db[_0xb372('0x40')][_0xb372('0x49')](_0x5ac25e[_0xb372('0x4a')],{})[_0xb372('0x26')](respondWithResult(_0x28c0da,0xc9))[_0xb372('0x45')](handleError(_0x28c0da,null));};exports[_0xb372('0x25')]=function(_0x3c46d2,_0xb256ac){if(_0x3c46d2[_0xb372('0x4a')]['id']){delete _0x3c46d2['body']['id'];}return db['MailQueueReport'][_0xb372('0x48')]({'where':{'id':_0x3c46d2[_0xb372('0x47')]['id']}})[_0xb372('0x26')](handleEntityNotFound(_0xb256ac,null))[_0xb372('0x26')](saveUpdates(_0x3c46d2[_0xb372('0x4a')],null))[_0xb372('0x26')](respondWithResult(_0xb256ac,null))[_0xb372('0x45')](handleError(_0xb256ac,null));};exports[_0xb372('0x27')]=function(_0x247fd6,_0x50e6fb){return db['MailQueueReport'][_0xb372('0x48')]({'where':{'id':_0x247fd6['params']['id']}})[_0xb372('0x26')](handleEntityNotFound(_0x50e6fb,null))[_0xb372('0x26')](removeEntity(_0x50e6fb,null))[_0xb372('0x45')](handleError(_0x50e6fb,null));};exports[_0xb372('0x4b')]=function(_0x589666,_0x232f59){return db[_0xb372('0x40')]['describe']()['then'](respondWithResult(_0x232f59,null))[_0xb372('0x45')](handleError(_0x232f59,null));}; \ No newline at end of file +var _0x9a0b=['index','MailQueueReport','rawAttributes','fieldName','type','key','map','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','length','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send'];(function(_0x75b304,_0x27d53f){var _0x321412=function(_0x37adb0){while(--_0x37adb0){_0x75b304['push'](_0x75b304['shift']());}};_0x321412(++_0x27d53f);}(_0x9a0b,0xff));var _0xb9a0=function(_0x2fb1b3,_0x264ac2){_0x2fb1b3=_0x2fb1b3-0x0;var _0x25fd2c=_0x9a0b[_0x2fb1b3];return _0x25fd2c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb9a0('0x0'));var zipdir=require(_0xb9a0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9a0('0x2'));var moment=require(_0xb9a0('0x3'));var BPromise=require(_0xb9a0('0x4'));var Mustache=require(_0xb9a0('0x5'));var util=require(_0xb9a0('0x6'));var path=require(_0xb9a0('0x7'));var sox=require(_0xb9a0('0x8'));var csv=require(_0xb9a0('0x9'));var ejs=require(_0xb9a0('0xa'));var fs=require('fs');var _=require(_0xb9a0('0xb'));var squel=require(_0xb9a0('0xc'));var crypto=require(_0xb9a0('0xd'));var jsforce=require(_0xb9a0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9a0('0xf'));var Papa=require(_0xb9a0('0x10'));var Redis=require('ioredis');var authService=require(_0xb9a0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb9a0('0x12'));var hardwareService=require(_0xb9a0('0x13'));var logger=require(_0xb9a0('0x14'))(_0xb9a0('0x15'));var utils=require(_0xb9a0('0x16'));var config=require(_0xb9a0('0x17'));var db=require(_0xb9a0('0x18'))['db'];function respondWithStatusCode(_0xeec7f4,_0x1d4ae3){_0x1d4ae3=_0x1d4ae3||0xcc;return function(_0x45533b){if(_0x45533b){return _0xeec7f4[_0xb9a0('0x19')](_0x1d4ae3);}return _0xeec7f4[_0xb9a0('0x1a')](_0x1d4ae3)[_0xb9a0('0x1b')]();};}function respondWithResult(_0x1f1458,_0x386343){_0x386343=_0x386343||0xc8;return function(_0x38f17f){if(_0x38f17f){return _0x1f1458[_0xb9a0('0x1a')](_0x386343)['json'](_0x38f17f);}};}function respondWithFilteredResult(_0x588f84,_0x44aabb){return function(_0x2670df){if(_0x2670df){var _0x39fe85=_0x2670df[_0xb9a0('0x1c')],_0x2395c3=_0x44aabb['offset'],_0x280365=_0x44aabb[_0xb9a0('0x1d')]+_0x44aabb[_0xb9a0('0x1e')],_0x2accf0;if(_0x280365>=_0x39fe85){_0x280365=_0x39fe85;_0x2accf0=0xc8;}else{_0x2accf0=0xce;}_0x588f84[_0xb9a0('0x1a')](_0x2accf0);return _0x588f84[_0xb9a0('0x1f')](_0xb9a0('0x20'),_0x2395c3+'-'+_0x280365+'/'+_0x39fe85)['json'](_0x2670df);}return null;};}function patchUpdates(_0x142d96){return function(_0x3b944a){try{jsonpatch[_0xb9a0('0x21')](_0x3b944a,_0x142d96,!![]);}catch(_0xe0a836){return BPromise['reject'](_0xe0a836);}return _0x3b944a[_0xb9a0('0x22')]();};}function saveUpdates(_0x5067b3,_0x20d4bb){return function(_0x1a3f6c){if(_0x1a3f6c){return _0x1a3f6c[_0xb9a0('0x23')](_0x5067b3)[_0xb9a0('0x24')](function(_0x4979e0){return _0x4979e0;});}return null;};}function removeEntity(_0x34ca5a,_0x38f101){return function(_0x5015b0){if(_0x5015b0){return _0x5015b0[_0xb9a0('0x25')]()[_0xb9a0('0x24')](function(){_0x34ca5a[_0xb9a0('0x1a')](0xcc)[_0xb9a0('0x1b')]();});}};}function handleEntityNotFound(_0x282c29,_0x4820a3){return function(_0x3117d1){if(!_0x3117d1){_0x282c29['sendStatus'](0x194);}return _0x3117d1;};}function handleError(_0x3514a4,_0x1b4b7e){_0x1b4b7e=_0x1b4b7e||0x1f4;return function(_0x18ed03){logger['error'](_0x18ed03[_0xb9a0('0x26')]);if(_0x18ed03['name']){delete _0x18ed03[_0xb9a0('0x27')];}_0x3514a4[_0xb9a0('0x1a')](_0x1b4b7e)[_0xb9a0('0x28')](_0x18ed03);};}exports[_0xb9a0('0x29')]=function(_0x12c56c,_0x242c84){var _0x3451af={},_0x1611e6={},_0x211de8={'count':0x0,'rows':[]};var _0xd4e6c4=_['map'](db[_0xb9a0('0x2a')][_0xb9a0('0x2b')],function(_0x5cd33a){return{'name':_0x5cd33a[_0xb9a0('0x2c')],'type':_0x5cd33a[_0xb9a0('0x2d')][_0xb9a0('0x2e')]};});_0x1611e6['model']=_[_0xb9a0('0x2f')](_0xd4e6c4,_0xb9a0('0x27'));_0x1611e6['query']=_[_0xb9a0('0x30')](_0x12c56c[_0xb9a0('0x31')]);_0x1611e6['filters']=_[_0xb9a0('0x32')](_0x1611e6['model'],_0x1611e6[_0xb9a0('0x31')]);_0x3451af[_0xb9a0('0x33')]=_[_0xb9a0('0x32')](_0x1611e6[_0xb9a0('0x34')],qs[_0xb9a0('0x35')](_0x12c56c[_0xb9a0('0x31')][_0xb9a0('0x35')]));_0x3451af[_0xb9a0('0x33')]=_0x3451af[_0xb9a0('0x33')]['length']?_0x3451af[_0xb9a0('0x33')]:_0x1611e6[_0xb9a0('0x34')];if(!_0x12c56c[_0xb9a0('0x31')][_0xb9a0('0x36')](_0xb9a0('0x37'))){_0x3451af[_0xb9a0('0x1e')]=qs['limit'](_0x12c56c[_0xb9a0('0x31')]['limit']);_0x3451af[_0xb9a0('0x1d')]=qs[_0xb9a0('0x1d')](_0x12c56c['query'][_0xb9a0('0x1d')]);}_0x3451af['order']=qs[_0xb9a0('0x38')](_0x12c56c[_0xb9a0('0x31')][_0xb9a0('0x38')]);_0x3451af[_0xb9a0('0x39')]=qs['filters'](_[_0xb9a0('0x3a')](_0x12c56c['query'],_0x1611e6[_0xb9a0('0x3b')]),_0xd4e6c4);if(_0x12c56c[_0xb9a0('0x31')]['filter']){_0x3451af[_0xb9a0('0x39')]=_['merge'](_0x3451af[_0xb9a0('0x39')],{'$or':_[_0xb9a0('0x2f')](_0xd4e6c4,function(_0x52cca9){if(_0x52cca9['type']!==_0xb9a0('0x3c')){var _0x32be87={};_0x32be87[_0x52cca9[_0xb9a0('0x27')]]={'$like':'%'+_0x12c56c['query'][_0xb9a0('0x3d')]+'%'};return _0x32be87;}})});}_0x3451af=_[_0xb9a0('0x3e')]({},_0x3451af,_0x12c56c[_0xb9a0('0x3f')]);var _0x4157eb={'where':_0x3451af[_0xb9a0('0x39')]};return db['MailQueueReport']['count'](_0x4157eb)['then'](function(_0x499959){_0x211de8[_0xb9a0('0x1c')]=_0x499959;if(_0x12c56c[_0xb9a0('0x31')][_0xb9a0('0x40')]){_0x3451af['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xb9a0('0x41')](_0x3451af);})[_0xb9a0('0x24')](function(_0x4bb043){_0x211de8[_0xb9a0('0x42')]=_0x4bb043;return _0x211de8;})[_0xb9a0('0x24')](respondWithFilteredResult(_0x242c84,_0x3451af))[_0xb9a0('0x43')](handleError(_0x242c84,null));};exports['show']=function(_0x53d668,_0x3f7baa){var _0x565e78={'raw':!![],'where':{'id':_0x53d668[_0xb9a0('0x44')]['id']}},_0x71ce98={};_0x71ce98['model']=_[_0xb9a0('0x30')](db[_0xb9a0('0x2a')][_0xb9a0('0x2b')]);_0x71ce98[_0xb9a0('0x31')]=_[_0xb9a0('0x30')](_0x53d668['query']);_0x71ce98['filters']=_[_0xb9a0('0x32')](_0x71ce98[_0xb9a0('0x34')],_0x71ce98[_0xb9a0('0x31')]);_0x565e78[_0xb9a0('0x33')]=_[_0xb9a0('0x32')](_0x71ce98[_0xb9a0('0x34')],qs['fields'](_0x53d668['query']['fields']));_0x565e78['attributes']=_0x565e78['attributes'][_0xb9a0('0x45')]?_0x565e78[_0xb9a0('0x33')]:_0x71ce98[_0xb9a0('0x34')];if(_0x53d668[_0xb9a0('0x31')]['includeAll']){_0x565e78['include']=[{'all':!![]}];}_0x565e78=_['merge']({},_0x565e78,_0x53d668[_0xb9a0('0x3f')]);return db['MailQueueReport'][_0xb9a0('0x46')](_0x565e78)[_0xb9a0('0x24')](handleEntityNotFound(_0x3f7baa,null))['then'](respondWithResult(_0x3f7baa,null))[_0xb9a0('0x43')](handleError(_0x3f7baa,null));};exports[_0xb9a0('0x47')]=function(_0x16d569,_0x192671){return db['MailQueueReport'][_0xb9a0('0x47')](_0x16d569['body'],{})[_0xb9a0('0x24')](respondWithResult(_0x192671,0xc9))[_0xb9a0('0x43')](handleError(_0x192671,null));};exports[_0xb9a0('0x23')]=function(_0xc83db1,_0x4df346){if(_0xc83db1[_0xb9a0('0x48')]['id']){delete _0xc83db1['body']['id'];}return db['MailQueueReport'][_0xb9a0('0x46')]({'where':{'id':_0xc83db1[_0xb9a0('0x44')]['id']}})['then'](handleEntityNotFound(_0x4df346,null))[_0xb9a0('0x24')](saveUpdates(_0xc83db1[_0xb9a0('0x48')],null))[_0xb9a0('0x24')](respondWithResult(_0x4df346,null))[_0xb9a0('0x43')](handleError(_0x4df346,null));};exports[_0xb9a0('0x25')]=function(_0x2d46d0,_0x171caa){return db[_0xb9a0('0x2a')][_0xb9a0('0x46')]({'where':{'id':_0x2d46d0[_0xb9a0('0x44')]['id']}})[_0xb9a0('0x24')](handleEntityNotFound(_0x171caa,null))[_0xb9a0('0x24')](removeEntity(_0x171caa,null))[_0xb9a0('0x43')](handleError(_0x171caa,null));};exports[_0xb9a0('0x49')]=function(_0x2e0e79,_0x15b000){return db[_0xb9a0('0x2a')]['describe']()[_0xb9a0('0x24')](respondWithResult(_0x15b000,null))['catch'](handleError(_0x15b000,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3433684..0756171 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 _0x8aad=['report_mail_queue','uniqueid','lodash','util','api','bluebird','request-promise','../../config/environment','define'];(function(_0x51ee42,_0x34e391){var _0x47a70d=function(_0x42f512){while(--_0x42f512){_0x51ee42['push'](_0x51ee42['shift']());}};_0x47a70d(++_0x34e391);}(_0x8aad,0x146));var _0xd8aa=function(_0x46e3e6,_0x93f105){_0x46e3e6=_0x46e3e6-0x0;var _0x5c5d7d=_0x8aad[_0x46e3e6];return _0x5c5d7d;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var logger=require('../../config/logger')(_0xd8aa('0x2'));var moment=require('moment');var BPromise=require(_0xd8aa('0x3'));var rp=require(_0xd8aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8aa('0x5'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x16b648,_0x43ddeb){return _0x16b648[_0xd8aa('0x6')]('MailQueueReport',attributes,{'tableName':_0xd8aa('0x7'),'paranoid':![],'indexes':[{'name':_0xd8aa('0x8'),'fields':[_0xd8aa('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa30a=['./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x482065,_0x100d05){var _0xf7a180=function(_0x27bca3){while(--_0x27bca3){_0x482065['push'](_0x482065['shift']());}};_0xf7a180(++_0x100d05);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var logger=require(_0xaa30('0x2'))('api');var moment=require(_0xaa30('0x3'));var BPromise=require(_0xaa30('0x4'));var rp=require(_0xaa30('0x5'));var fs=require('fs');var path=require(_0xaa30('0x6'));var rimraf=require(_0xaa30('0x7'));var config=require(_0xaa30('0x8'));var attributes=require(_0xaa30('0x9'));module['exports']=function(_0x347cd5,_0x4efe89){return _0x347cd5[_0xaa30('0xa')](_0xaa30('0xb'),attributes,{'tableName':_0xaa30('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaa30('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a3e9e92..f8489da 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 _0x1883=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailQueueReport','MailQueueReport','create','options','info','UpdateMailQueueReport','update','body','raw','limit','then','lodash','util','moment','bluebird'];(function(_0x41241b,_0xbfa517){var _0x12a5f4=function(_0x8868c7){while(--_0x8868c7){_0x41241b['push'](_0x41241b['shift']());}};_0x12a5f4(++_0xbfa517);}(_0x1883,0xab));var _0x3188=function(_0x12b1fd,_0x545887){_0x12b1fd=_0x12b1fd-0x0;var _0x4197fa=_0x1883[_0x12b1fd];return _0x4197fa;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});}exports[_0x3188('0x18')]=function(_0x3f5b35){var _0x37e646=this;return new Promise(function(_0x18a71a,_0x4f27b0){return db[_0x3188('0x19')][_0x3188('0x1a')](_0x3f5b35['body'],{'raw':_0x3f5b35[_0x3188('0x1b')]?_0x3f5b35[_0x3188('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5d8d62){logger[_0x3188('0x1c')](_0x3188('0x18'),_0x3f5b35);logger[_0x3188('0x11')]('CreateMailQueueReport',_0x3f5b35,JSON['stringify'](_0x5d8d62));_0x18a71a(_0x5d8d62);})[_0x3188('0x17')](function(_0x461286){logger[_0x3188('0x14')](_0x3188('0x18'),_0x461286[_0x3188('0x15')],_0x3f5b35);_0x4f27b0(_0x37e646['error'](0x1f4,_0x461286[_0x3188('0x15')]));});});};exports[_0x3188('0x1d')]=function(_0x5a2e67){var _0xcbaec9=this;return new Promise(function(_0x4be6c3,_0x5c69be){return db[_0x3188('0x19')][_0x3188('0x1e')](_0x5a2e67[_0x3188('0x1f')],{'raw':_0x5a2e67[_0x3188('0x1b')]?_0x5a2e67[_0x3188('0x1b')][_0x3188('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2e67[_0x3188('0x1b')]?_0x5a2e67[_0x3188('0x1b')]['where']||null:null,'attributes':_0x5a2e67[_0x3188('0x1b')]?_0x5a2e67[_0x3188('0x1b')]['attributes']||null:null,'limit':_0x5a2e67[_0x3188('0x1b')]?_0x5a2e67[_0x3188('0x1b')][_0x3188('0x21')]||null:null})[_0x3188('0x22')](function(_0x20e6aa){logger[_0x3188('0x1c')](_0x3188('0x1d'),_0x5a2e67);logger[_0x3188('0x11')]('UpdateMailQueueReport',_0x5a2e67,JSON[_0x3188('0x13')](_0x20e6aa));_0x4be6c3(_0x20e6aa);})['catch'](function(_0xaead48){logger['error'](_0x3188('0x1d'),_0xaead48[_0x3188('0x15')],_0x5a2e67);_0x5c69be(_0xcbaec9[_0x3188('0x14')](0x1f4,_0xaead48[_0x3188('0x15')]));});});}; \ No newline at end of file +var _0x7096=['then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','body','options','raw','UpdateMailQueueReport','update','where','attributes','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34f073,_0x19314c){var _0x1eb403=function(_0x2be314){while(--_0x2be314){_0x34f073['push'](_0x34f073['shift']());}};_0x1eb403(++_0x19314c);}(_0x7096,0x10c));var _0x6709=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7096[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}exports[_0x6709('0x16')]=function(_0x235a54){var _0x4a732e=this;return new Promise(function(_0x9c1fd8,_0x166c97){return db[_0x6709('0x17')]['create'](_0x235a54[_0x6709('0x18')],{'raw':_0x235a54[_0x6709('0x19')]?_0x235a54[_0x6709('0x19')][_0x6709('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3c4971){logger[_0x6709('0xc')](_0x6709('0x16'),_0x235a54);logger[_0x6709('0xf')](_0x6709('0x16'),_0x235a54,JSON[_0x6709('0x10')](_0x3c4971));_0x9c1fd8(_0x3c4971);})[_0x6709('0x15')](function(_0x17763d){logger[_0x6709('0x11')](_0x6709('0x16'),_0x17763d[_0x6709('0x13')],_0x235a54);_0x166c97(_0x4a732e[_0x6709('0x11')](0x1f4,_0x17763d['message']));});});};exports[_0x6709('0x1b')]=function(_0x81138e){var _0x2bcc73=this;return new Promise(function(_0x5c7982,_0x2e3483){return db[_0x6709('0x17')][_0x6709('0x1c')](_0x81138e[_0x6709('0x18')],{'raw':_0x81138e['options']?_0x81138e[_0x6709('0x19')][_0x6709('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x81138e['options']?_0x81138e[_0x6709('0x19')][_0x6709('0x1d')]||null:null,'attributes':_0x81138e['options']?_0x81138e[_0x6709('0x19')][_0x6709('0x1e')]||null:null,'limit':_0x81138e['options']?_0x81138e[_0x6709('0x19')]['limit']||null:null})[_0x6709('0xb')](function(_0x3cd555){logger['info'](_0x6709('0x1b'),_0x81138e);logger['debug'](_0x6709('0x1b'),_0x81138e,JSON[_0x6709('0x10')](_0x3cd555));_0x5c7982(_0x3cd555);})['catch'](function(_0x1a9eea){logger['error'](_0x6709('0x1b'),_0x1a9eea[_0x6709('0x13')],_0x81138e);_0x2e3483(_0x2bcc73['error'](0x1f4,_0x1a9eea['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 2e29619..afb31af 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 _0xa234=['util','path','connect-timeout','express','Router','../../components/auth/service','multer'];(function(_0xf9ea9b,_0x193341){var _0xb13f63=function(_0x2d506a){while(--_0x2d506a){_0xf9ea9b['push'](_0xf9ea9b['shift']());}};_0xb13f63(++_0x193341);}(_0xa234,0x99));var _0x4a23=function(_0xd1bdb8,_0x20e405){_0xd1bdb8=_0xd1bdb8-0x0;var _0x43a500=_0xa234[_0xd1bdb8];return _0x43a500;};'use strict';var multer=require(_0x4a23('0x0'));var util=require(_0x4a23('0x1'));var path=require(_0x4a23('0x2'));var timeout=require(_0x4a23('0x3'));var express=require(_0x4a23('0x4'));var router=express[_0x4a23('0x5')]();var auth=require(_0x4a23('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x393e=['exports','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4f2fd9,_0x329789){var _0x36888a=function(_0xbce87a){while(--_0xbce87a){_0x4f2fd9['push'](_0x4f2fd9['shift']());}};_0x36888a(++_0x329789);}(_0x393e,0x191));var _0xe393=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x393e[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe393('0x0'));var router=express[_0xe393('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xe393('0x2'));var config=require(_0xe393('0x3'));module[_0xe393('0x4')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1d6acfc..645a464 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 _0x990f=['exports','STRING','username','INBOX','INTEGER'];(function(_0x162ca0,_0x2c23f6){var _0x27b4d0=function(_0x52df67){while(--_0x52df67){_0x162ca0['push'](_0x162ca0['shift']());}};_0x27b4d0(++_0x2c23f6);}(_0x990f,0x87));var _0xf990=function(_0x364caf,_0x487183){_0x364caf=_0x364caf-0x0;var _0x2f9296=_0x990f[_0x364caf];return _0x2f9296;};'use strict';var Sequelize=require('sequelize');module[_0xf990('0x0')]={'description':{'type':Sequelize[_0xf990('0x1')]},'host':{'type':Sequelize[_0xf990('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xf990('0x2')},'password':{'type':Sequelize[_0xf990('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf990('0x1')],'defaultValue':_0xf990('0x3')},'connTimeout':{'type':Sequelize[_0xf990('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbfcf=['sequelize','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x3a53cb,_0x1fcb5d){var _0x3317bd=function(_0xc52e7){while(--_0xc52e7){_0x3a53cb['push'](_0x3a53cb['shift']());}};_0x3317bd(++_0x1fcb5d);}(_0xbfcf,0xff));var _0xfbfc=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xbfcf[_0xae1a83];return _0xdb9da8;};'use strict';var Sequelize=require(_0xfbfc('0x0'));module['exports']={'description':{'type':Sequelize[_0xfbfc('0x1')]},'host':{'type':Sequelize[_0xfbfc('0x1')]},'authentication':{'type':Sequelize[_0xfbfc('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xfbfc('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xfbfc('0x1')]},'port':{'type':Sequelize[_0xfbfc('0x3')]},'tls':{'type':Sequelize[_0xfbfc('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xfbfc('0x1')],'defaultValue':_0xfbfc('0x4')},'connTimeout':{'type':Sequelize[_0xfbfc('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfbfc('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index b5ac2ff..55bcb8e 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 _0x7d9f=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','mail_servers_in'];(function(_0x2b3dd6,_0xdee79f){var _0x49b2a3=function(_0x7c3020){while(--_0x7c3020){_0x2b3dd6['push'](_0x2b3dd6['shift']());}};_0x49b2a3(++_0xdee79f);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x47ad1a,_0x467d68){_0x47ad1a=_0x47ad1a-0x0;var _0x586211=_0x7d9f[_0x47ad1a];return _0x586211;};'use strict';var _=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var logger=require(_0xf7d9('0x2'))(_0xf7d9('0x3'));var moment=require(_0xf7d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7d9('0x5'));var fs=require('fs');var path=require(_0xf7d9('0x6'));var rimraf=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var attributes=require(_0xf7d9('0x9'));module['exports']=function(_0x4b50c7,_0x2eb0f1){return _0x4b50c7[_0xf7d9('0xa')]('MailServerIn',attributes,{'tableName':_0xf7d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25fa=['path','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xca526f,_0x4341a0){var _0x524cf6=function(_0x2fc4cb){while(--_0x2fc4cb){_0xca526f['push'](_0xca526f['shift']());}};_0x524cf6(++_0x4341a0);}(_0x25fa,0x109));var _0xa25f=function(_0x1a5433,_0x57f2a3){_0x1a5433=_0x1a5433-0x0;var _0x4a98cc=_0x25fa[_0x1a5433];return _0x4a98cc;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'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 32332be..0ee9f70 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 _0xf19f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','model','map','stringify','util','randomstring','ioredis','../../mysqldb'];(function(_0x746a11,_0x4abdca){var _0x33de7c=function(_0x212fda){while(--_0x212fda){_0x746a11['push'](_0x746a11['shift']());}};_0x33de7c(++_0x4abdca);}(_0xf19f,0xb6));var _0xff19=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf19f[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var util=require(_0xff19('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xff19('0x1'));var fs=require('fs');var Redis=require(_0xff19('0x2'));var db=require(_0xff19('0x3'))['db'];var utils=require(_0xff19('0x4'));var logger=require(_0xff19('0x5'))(_0xff19('0x6'));var config=require(_0xff19('0x7'));var jayson=require(_0xff19('0x8'));var client=jayson['client'][_0xff19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4799f1,_0x5a569b,_0xf7ee30){return new BPromise(function(_0x463699,_0x307b3f){return client[_0xff19('0xa')](_0x4799f1,_0xf7ee30)[_0xff19('0xb')](function(_0x3b35a0){logger[_0xff19('0xc')]('MailServerIn,\x20%s,\x20%s',_0x5a569b,_0xff19('0xd'));logger[_0xff19('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5a569b,'request\x20sent',JSON['stringify'](_0x3b35a0));if(_0x3b35a0['error']){if(_0x3b35a0[_0xff19('0xf')][_0xff19('0x10')]===0x1f4){logger['error'](_0xff19('0x11'),_0x5a569b,_0x3b35a0[_0xff19('0xf')][_0xff19('0x12')]);return _0x307b3f(_0x3b35a0[_0xff19('0xf')][_0xff19('0x12')]);}logger[_0xff19('0xf')](_0xff19('0x11'),_0x5a569b,_0x3b35a0[_0xff19('0xf')][_0xff19('0x12')]);return _0x463699(_0x3b35a0[_0xff19('0xf')][_0xff19('0x12')]);}else{logger['info'](_0xff19('0x11'),_0x5a569b,_0xff19('0xd'));_0x463699(_0x3b35a0['result']['message']);}})[_0xff19('0x13')](function(_0x40ecbf){logger['error']('MailServerIn,\x20%s,\x20%s',_0x5a569b,_0x40ecbf);_0x307b3f(_0x40ecbf);});});}exports[_0xff19('0x14')]=function(_0x444871){var _0x509acb=this;return new Promise(function(_0xf506dd,_0x503131){return db[_0xff19('0x15')]['findAll']({'raw':_0x444871['options']?_0x444871[_0xff19('0x16')][_0xff19('0x17')]===undefined?!![]:![]:!![],'where':_0x444871[_0xff19('0x16')]?_0x444871['options'][_0xff19('0x18')]||null:null,'attributes':_0x444871[_0xff19('0x16')]?_0x444871[_0xff19('0x16')][_0xff19('0x19')]||null:null,'limit':_0x444871[_0xff19('0x16')]?_0x444871[_0xff19('0x16')][_0xff19('0x1a')]||null:null,'include':_0x444871[_0xff19('0x16')]?_0x444871[_0xff19('0x16')][_0xff19('0x1b')]?_['map'](_0x444871[_0xff19('0x16')][_0xff19('0x1b')],function(_0x4ff555){return{'model':db[_0x4ff555[_0xff19('0x1c')]],'as':_0x4ff555['as'],'attributes':_0x4ff555[_0xff19('0x19')],'include':_0x4ff555[_0xff19('0x1b')]?_[_0xff19('0x1d')](_0x4ff555['include'],function(_0x58d388){return{'model':db[_0x58d388[_0xff19('0x1c')]],'as':_0x58d388['as'],'attributes':_0x58d388['attributes'],'include':_0x58d388[_0xff19('0x1b')]?_[_0xff19('0x1d')](_0x58d388[_0xff19('0x1b')],function(_0x11efc6){return{'model':db[_0x11efc6[_0xff19('0x1c')]],'as':_0x11efc6['as'],'attributes':_0x11efc6[_0xff19('0x19')]};}):[]};}):[]};}):[]:[]})[_0xff19('0xb')](function(_0x530509){logger[_0xff19('0xc')](_0xff19('0x14'),_0x444871);logger[_0xff19('0xe')](_0xff19('0x14'),_0x444871,JSON[_0xff19('0x1e')](_0x530509));_0xf506dd(_0x530509);})[_0xff19('0x13')](function(_0x19d349){logger['error'](_0xff19('0x14'),_0x19d349[_0xff19('0x12')],_0x444871);_0x503131(_0x509acb[_0xff19('0xf')](0x1f4,_0x19d349['message']));});});}; \ No newline at end of file +var _0x00ff=['map','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x00ff,0x103));var _0xf00f=function(_0x59467b,_0x5da907){_0x59467b=_0x59467b-0x0;var _0x5d69da=_0x00ff[_0x59467b];return _0x5d69da;};'use strict';var _=require(_0xf00f('0x0'));var util=require(_0xf00f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf00f('0x2'));var fs=require('fs');var Redis=require(_0xf00f('0x3'));var db=require(_0xf00f('0x4'))['db'];var utils=require(_0xf00f('0x5'));var logger=require('../../config/logger')(_0xf00f('0x6'));var config=require('../../config/environment');var jayson=require(_0xf00f('0x7'));var client=jayson[_0xf00f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb4fae9,_0x382222,_0x3774d4){return new BPromise(function(_0x1351f4,_0x5609e7){return client[_0xf00f('0x9')](_0xb4fae9,_0x3774d4)['then'](function(_0x42f78a){logger[_0xf00f('0xa')]('MailServerIn,\x20%s,\x20%s',_0x382222,_0xf00f('0xb'));logger[_0xf00f('0xc')](_0xf00f('0xd'),_0x382222,_0xf00f('0xb'),JSON[_0xf00f('0xe')](_0x42f78a));if(_0x42f78a['error']){if(_0x42f78a[_0xf00f('0xf')]['code']===0x1f4){logger[_0xf00f('0xf')](_0xf00f('0x10'),_0x382222,_0x42f78a[_0xf00f('0xf')]['message']);return _0x5609e7(_0x42f78a[_0xf00f('0xf')][_0xf00f('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x382222,_0x42f78a['error'][_0xf00f('0x11')]);return _0x1351f4(_0x42f78a[_0xf00f('0xf')][_0xf00f('0x11')]);}else{logger[_0xf00f('0xa')](_0xf00f('0x10'),_0x382222,_0xf00f('0xb'));_0x1351f4(_0x42f78a[_0xf00f('0x12')]['message']);}})[_0xf00f('0x13')](function(_0x2840fc){logger[_0xf00f('0xf')](_0xf00f('0x10'),_0x382222,_0x2840fc);_0x5609e7(_0x2840fc);});});}exports[_0xf00f('0x14')]=function(_0x43f481){var _0x26e304=this;return new Promise(function(_0x203e1f,_0x246350){return db[_0xf00f('0x15')][_0xf00f('0x16')]({'raw':_0x43f481[_0xf00f('0x17')]?_0x43f481[_0xf00f('0x17')][_0xf00f('0x18')]===undefined?!![]:![]:!![],'where':_0x43f481[_0xf00f('0x17')]?_0x43f481[_0xf00f('0x17')][_0xf00f('0x19')]||null:null,'attributes':_0x43f481[_0xf00f('0x17')]?_0x43f481[_0xf00f('0x17')][_0xf00f('0x1a')]||null:null,'limit':_0x43f481[_0xf00f('0x17')]?_0x43f481[_0xf00f('0x17')][_0xf00f('0x1b')]||null:null,'include':_0x43f481['options']?_0x43f481[_0xf00f('0x17')]['include']?_['map'](_0x43f481['options']['include'],function(_0x4108b9){return{'model':db[_0x4108b9['model']],'as':_0x4108b9['as'],'attributes':_0x4108b9[_0xf00f('0x1a')],'include':_0x4108b9[_0xf00f('0x1c')]?_[_0xf00f('0x1d')](_0x4108b9[_0xf00f('0x1c')],function(_0x32add6){return{'model':db[_0x32add6[_0xf00f('0x1e')]],'as':_0x32add6['as'],'attributes':_0x32add6[_0xf00f('0x1a')],'include':_0x32add6[_0xf00f('0x1c')]?_[_0xf00f('0x1d')](_0x32add6[_0xf00f('0x1c')],function(_0x502093){return{'model':db[_0x502093['model']],'as':_0x502093['as'],'attributes':_0x502093[_0xf00f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf00f('0x1f')](function(_0xa3beb1){logger[_0xf00f('0xa')](_0xf00f('0x14'),_0x43f481);logger[_0xf00f('0xc')](_0xf00f('0x14'),_0x43f481,JSON[_0xf00f('0xe')](_0xa3beb1));_0x203e1f(_0xa3beb1);})[_0xf00f('0x13')](function(_0x18e1f8){logger['error']('GetMailServerIn',_0x18e1f8[_0xf00f('0x11')],_0x43f481);_0x246350(_0x26e304[_0xf00f('0xf')](0x1f4,_0x18e1f8[_0xf00f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index e2cd315..7f2d08b 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 _0x4cbb=['post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','Router','./mailServerOut.controller','get','index','/:id','show'];(function(_0x1a24f8,_0xf25039){var _0x232269=function(_0x437b18){while(--_0x437b18){_0x1a24f8['push'](_0x1a24f8['shift']());}};_0x232269(++_0xf25039);}(_0x4cbb,0xc8));var _0xb4cb=function(_0x17c487,_0x2b72f1){_0x17c487=_0x17c487-0x0;var _0x3feeb8=_0x4cbb[_0x17c487];return _0x3feeb8;};'use strict';var multer=require(_0xb4cb('0x0'));var util=require(_0xb4cb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb4cb('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb4cb('0x3'));router[_0xb4cb('0x4')]('/',auth['isAuthenticated'](),controller[_0xb4cb('0x5')]);router[_0xb4cb('0x4')](_0xb4cb('0x6'),auth['isAuthenticated'](),controller[_0xb4cb('0x7')]);router[_0xb4cb('0x8')]('/',auth[_0xb4cb('0x9')](),controller[_0xb4cb('0xa')]);router[_0xb4cb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb4cb('0xc')]);router[_0xb4cb('0xd')](_0xb4cb('0x6'),auth['isAuthenticated'](),controller[_0xb4cb('0xe')]);module[_0xb4cb('0xf')]=router; \ No newline at end of file +var _0xdf7f=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xdf7f,0x81));var _0xfdf7=function(_0x2cb4cc,_0x1042c9){_0x2cb4cc=_0x2cb4cc-0x0;var _0x54bca9=_0xdf7f[_0x2cb4cc];return _0x54bca9;};'use strict';var multer=require(_0xfdf7('0x0'));var util=require(_0xfdf7('0x1'));var path=require(_0xfdf7('0x2'));var timeout=require(_0xfdf7('0x3'));var express=require(_0xfdf7('0x4'));var router=express[_0xfdf7('0x5')]();var auth=require(_0xfdf7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfdf7('0x7'));var controller=require(_0xfdf7('0x8'));router[_0xfdf7('0x9')]('/',auth[_0xfdf7('0xa')](),controller['index']);router[_0xfdf7('0x9')](_0xfdf7('0xb'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0xc')]);router[_0xfdf7('0xd')]('/',auth[_0xfdf7('0xa')](),controller[_0xfdf7('0xe')]);router['put'](_0xfdf7('0xb'),auth[_0xfdf7('0xa')](),controller['update']);router[_0xfdf7('0xf')](_0xfdf7('0xb'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0x10')]);module[_0xfdf7('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 739f4b6..2a42109 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 _0xa456=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x293bcb,_0x163e4c){var _0x3dc9b4=function(_0x3dbdcf){while(--_0x3dbdcf){_0x293bcb['push'](_0x293bcb['shift']());}};_0x3dc9b4(++_0x163e4c);}(_0xa456,0x142));var _0x6a45=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xa456[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'description':{'type':Sequelize[_0x6a45('0x2')]},'host':{'type':Sequelize[_0x6a45('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x6a45('0x2')]},'port':{'type':Sequelize[_0x6a45('0x3')]},'secure':{'type':Sequelize[_0x6a45('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x6a45('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8ca9=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x8ca9,0x9c));var _0x98ca=function(_0x264af2,_0xd46cfb){_0x264af2=_0x264af2-0x0;var _0x58c582=_0x8ca9[_0x264af2];return _0x58c582;};'use strict';var Sequelize=require(_0x98ca('0x0'));module[_0x98ca('0x1')]={'description':{'type':Sequelize[_0x98ca('0x2')]},'host':{'type':Sequelize[_0x98ca('0x2')]},'user':{'type':Sequelize[_0x98ca('0x2')]},'pass':{'type':Sequelize[_0x98ca('0x2')]},'port':{'type':Sequelize[_0x98ca('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x98ca('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 3550576..c3acdba 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 _0x1edf=['to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','Content-Range','json','apply','save','destroy','then','stack','name','send','index','map','MailServerOut','fieldName','key','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','sort','filters','pick','where','type','VIRTUAL','filter','merge','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0x1edf,0xcd));var _0xf1ed=function(_0x543b2c,_0xb73dd3){_0x543b2c=_0x543b2c-0x0;var _0x216472=_0x1edf[_0x543b2c];return _0x216472;};'use strict';var pdf=require(_0xf1ed('0x0'));var emlformat=require(_0xf1ed('0x1'));var rimraf=require(_0xf1ed('0x2'));var zipdir=require(_0xf1ed('0x3'));var jsonpatch=require(_0xf1ed('0x4'));var rp=require(_0xf1ed('0x5'));var moment=require(_0xf1ed('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf1ed('0x7'));var util=require(_0xf1ed('0x8'));var path=require(_0xf1ed('0x9'));var sox=require(_0xf1ed('0xa'));var csv=require(_0xf1ed('0xb'));var ejs=require(_0xf1ed('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf1ed('0xd'));var jsforce=require(_0xf1ed('0xe'));var deskjs=require(_0xf1ed('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf1ed('0x10'));var Papa=require(_0xf1ed('0x11'));var Redis=require('ioredis');var authService=require(_0xf1ed('0x12'));var qs=require(_0xf1ed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1ed('0x14'));var logger=require(_0xf1ed('0x15'))(_0xf1ed('0x16'));var utils=require(_0xf1ed('0x17'));var config=require('../../config/environment');var db=require(_0xf1ed('0x18'))['db'];function respondWithStatusCode(_0x5b8127,_0x20aca8){_0x20aca8=_0x20aca8||0xcc;return function(_0x2bb9dc){if(_0x2bb9dc){return _0x5b8127[_0xf1ed('0x19')](_0x20aca8);}return _0x5b8127[_0xf1ed('0x1a')](_0x20aca8)[_0xf1ed('0x1b')]();};}function respondWithResult(_0x558f87,_0x5bf7a8){_0x5bf7a8=_0x5bf7a8||0xc8;return function(_0x1eefd5){if(_0x1eefd5){return _0x558f87['status'](_0x5bf7a8)['json'](_0x1eefd5);}};}function respondWithFilteredResult(_0x485c10,_0x3f6c06){return function(_0xbde09a){if(_0xbde09a){var _0x466964=_0xbde09a['count'],_0x36244a=_0x3f6c06[_0xf1ed('0x1c')],_0x30b635=_0x3f6c06['offset']+_0x3f6c06['limit'],_0x6eab82;if(_0x30b635>=_0x466964){_0x30b635=_0x466964;_0x6eab82=0xc8;}else{_0x6eab82=0xce;}_0x485c10[_0xf1ed('0x1a')](_0x6eab82);return _0x485c10['set'](_0xf1ed('0x1d'),_0x36244a+'-'+_0x30b635+'/'+_0x466964)[_0xf1ed('0x1e')](_0xbde09a);}return null;};}function patchUpdates(_0x52cc00){return function(_0x33e35b){try{jsonpatch[_0xf1ed('0x1f')](_0x33e35b,_0x52cc00,!![]);}catch(_0x4bdd52){return BPromise['reject'](_0x4bdd52);}return _0x33e35b[_0xf1ed('0x20')]();};}function saveUpdates(_0x354315,_0x1eb7d0){return function(_0x684dd6){if(_0x684dd6){return _0x684dd6['update'](_0x354315)['then'](function(_0x26748b){return _0x26748b;});}return null;};}function removeEntity(_0xd0012e,_0x559424){return function(_0x5e1c9e){if(_0x5e1c9e){return _0x5e1c9e[_0xf1ed('0x21')]()[_0xf1ed('0x22')](function(){_0xd0012e[_0xf1ed('0x1a')](0xcc)[_0xf1ed('0x1b')]();});}};}function handleEntityNotFound(_0x4b4104,_0x5b60be){return function(_0x17c523){if(!_0x17c523){_0x4b4104[_0xf1ed('0x19')](0x194);}return _0x17c523;};}function handleError(_0x3a2f97,_0x215188){_0x215188=_0x215188||0x1f4;return function(_0x45aa20){logger['error'](_0x45aa20[_0xf1ed('0x23')]);if(_0x45aa20[_0xf1ed('0x24')]){delete _0x45aa20[_0xf1ed('0x24')];}_0x3a2f97[_0xf1ed('0x1a')](_0x215188)[_0xf1ed('0x25')](_0x45aa20);};}exports[_0xf1ed('0x26')]=function(_0x317b59,_0x451d6a){var _0x3c2926={},_0x48819c={},_0x4e75ae={'count':0x0,'rows':[]};var _0x30a048=_[_0xf1ed('0x27')](db[_0xf1ed('0x28')]['rawAttributes'],function(_0x5e2602){return{'name':_0x5e2602[_0xf1ed('0x29')],'type':_0x5e2602['type'][_0xf1ed('0x2a')]};});_0x48819c['model']=_[_0xf1ed('0x27')](_0x30a048,_0xf1ed('0x24'));_0x48819c['query']=_['keys'](_0x317b59[_0xf1ed('0x2b')]);_0x48819c['filters']=_[_0xf1ed('0x2c')](_0x48819c['model'],_0x48819c[_0xf1ed('0x2b')]);_0x3c2926[_0xf1ed('0x2d')]=_['intersection'](_0x48819c['model'],qs[_0xf1ed('0x2e')](_0x317b59['query'][_0xf1ed('0x2e')]));_0x3c2926['attributes']=_0x3c2926[_0xf1ed('0x2d')][_0xf1ed('0x2f')]?_0x3c2926[_0xf1ed('0x2d')]:_0x48819c[_0xf1ed('0x30')];if(!_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x31')](_0xf1ed('0x32'))){_0x3c2926[_0xf1ed('0x33')]=qs[_0xf1ed('0x33')](_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x33')]);_0x3c2926[_0xf1ed('0x1c')]=qs[_0xf1ed('0x1c')](_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x1c')]);}_0x3c2926['order']=qs[_0xf1ed('0x34')](_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x34')]);_0x3c2926['where']=qs[_0xf1ed('0x35')](_[_0xf1ed('0x36')](_0x317b59[_0xf1ed('0x2b')],_0x48819c[_0xf1ed('0x35')]),_0x30a048);if(_0x317b59[_0xf1ed('0x2b')]['filter']){_0x3c2926[_0xf1ed('0x37')]=_['merge'](_0x3c2926[_0xf1ed('0x37')],{'$or':_[_0xf1ed('0x27')](_0x30a048,function(_0x30e89d){if(_0x30e89d[_0xf1ed('0x38')]!==_0xf1ed('0x39')){var _0x75b1c={};_0x75b1c[_0x30e89d[_0xf1ed('0x24')]]={'$like':'%'+_0x317b59[_0xf1ed('0x2b')][_0xf1ed('0x3a')]+'%'};return _0x75b1c;}})});}_0x3c2926=_[_0xf1ed('0x3b')]({},_0x3c2926,_0x317b59['options']);var _0x2ed301={'where':_0x3c2926[_0xf1ed('0x37')]};return db[_0xf1ed('0x28')][_0xf1ed('0x3c')](_0x2ed301)[_0xf1ed('0x22')](function(_0x12008a){_0x4e75ae['count']=_0x12008a;if(_0x317b59['query'][_0xf1ed('0x3d')]){_0x3c2926['include']=[{'all':!![]}];}return db[_0xf1ed('0x28')][_0xf1ed('0x3e')](_0x3c2926);})[_0xf1ed('0x22')](function(_0x49c011){_0x4e75ae[_0xf1ed('0x3f')]=_0x49c011;return _0x4e75ae;})['then'](respondWithFilteredResult(_0x451d6a,_0x3c2926))[_0xf1ed('0x40')](handleError(_0x451d6a,null));};exports[_0xf1ed('0x41')]=function(_0xae515,_0x5cc35a){var _0x30b6f2={'raw':!![],'where':{'id':_0xae515[_0xf1ed('0x42')]['id']}},_0x3f7a20={};_0x3f7a20['model']=_[_0xf1ed('0x43')](db[_0xf1ed('0x28')]['rawAttributes']);_0x3f7a20['query']=_[_0xf1ed('0x43')](_0xae515[_0xf1ed('0x2b')]);_0x3f7a20['filters']=_['intersection'](_0x3f7a20[_0xf1ed('0x30')],_0x3f7a20[_0xf1ed('0x2b')]);_0x30b6f2['attributes']=_['intersection'](_0x3f7a20['model'],qs[_0xf1ed('0x2e')](_0xae515[_0xf1ed('0x2b')]['fields']));_0x30b6f2[_0xf1ed('0x2d')]=_0x30b6f2[_0xf1ed('0x2d')]['length']?_0x30b6f2[_0xf1ed('0x2d')]:_0x3f7a20[_0xf1ed('0x30')];if(_0xae515[_0xf1ed('0x2b')][_0xf1ed('0x3d')]){_0x30b6f2[_0xf1ed('0x44')]=[{'all':!![]}];}_0x30b6f2=_[_0xf1ed('0x3b')]({},_0x30b6f2,_0xae515['options']);return db[_0xf1ed('0x28')][_0xf1ed('0x45')](_0x30b6f2)['then'](handleEntityNotFound(_0x5cc35a,null))[_0xf1ed('0x22')](respondWithResult(_0x5cc35a,null))[_0xf1ed('0x40')](handleError(_0x5cc35a,null));};exports['create']=function(_0x411dba,_0x3dfdbf){return db[_0xf1ed('0x28')][_0xf1ed('0x46')](_0x411dba[_0xf1ed('0x47')],{})[_0xf1ed('0x22')](respondWithResult(_0x3dfdbf,0xc9))[_0xf1ed('0x40')](handleError(_0x3dfdbf,null));};exports['update']=function(_0x5de9c5,_0x4ad18e){if(_0x5de9c5[_0xf1ed('0x47')]['id']){delete _0x5de9c5[_0xf1ed('0x47')]['id'];}return db[_0xf1ed('0x28')]['find']({'where':{'id':_0x5de9c5[_0xf1ed('0x42')]['id']}})[_0xf1ed('0x22')](handleEntityNotFound(_0x4ad18e,null))['then'](saveUpdates(_0x5de9c5[_0xf1ed('0x47')],null))['then'](respondWithResult(_0x4ad18e,null))[_0xf1ed('0x40')](handleError(_0x4ad18e,null));};exports[_0xf1ed('0x21')]=function(_0x1ca715,_0x4e80c5){return db[_0xf1ed('0x28')][_0xf1ed('0x45')]({'where':{'id':_0x1ca715[_0xf1ed('0x42')]['id']}})[_0xf1ed('0x22')](handleEntityNotFound(_0x4e80c5,null))[_0xf1ed('0x22')](removeEntity(_0x4e80c5,null))['catch'](handleError(_0x4e80c5,null));}; \ No newline at end of file +var _0xf263=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','Content-Range','json','apply','update','then','destroy','end','error','name','map','MailServerOut','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0xf263,0x149));var _0x3f26=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0xf263[_0x12ddb2];return _0x10b6dd;};'use strict';var pdf=require(_0x3f26('0x0'));var emlformat=require(_0x3f26('0x1'));var rimraf=require(_0x3f26('0x2'));var zipdir=require(_0x3f26('0x3'));var jsonpatch=require(_0x3f26('0x4'));var rp=require('request-promise');var moment=require(_0x3f26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f26('0x6'));var util=require(_0x3f26('0x7'));var path=require(_0x3f26('0x8'));var sox=require(_0x3f26('0x9'));var csv=require('to-csv');var ejs=require(_0x3f26('0xa'));var fs=require('fs');var _=require(_0x3f26('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f26('0xc'));var deskjs=require(_0x3f26('0xd'));var toCsv=require(_0x3f26('0xe'));var querystring=require('querystring');var Papa=require(_0x3f26('0xf'));var Redis=require(_0x3f26('0x10'));var authService=require(_0x3f26('0x11'));var qs=require(_0x3f26('0x12'));var as=require(_0x3f26('0x13'));var hardwareService=require(_0x3f26('0x14'));var logger=require(_0x3f26('0x15'))(_0x3f26('0x16'));var utils=require(_0x3f26('0x17'));var config=require(_0x3f26('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ab0ef,_0x258b7f){_0x258b7f=_0x258b7f||0xcc;return function(_0x1ad495){if(_0x1ad495){return _0x5ab0ef[_0x3f26('0x19')](_0x258b7f);}return _0x5ab0ef[_0x3f26('0x1a')](_0x258b7f)['end']();};}function respondWithResult(_0x1802e4,_0x227655){_0x227655=_0x227655||0xc8;return function(_0x3f69c0){if(_0x3f69c0){return _0x1802e4[_0x3f26('0x1a')](_0x227655)['json'](_0x3f69c0);}};}function respondWithFilteredResult(_0x3d18ae,_0x1ce98c){return function(_0x37ee5c){if(_0x37ee5c){var _0x414672=_0x37ee5c[_0x3f26('0x1b')],_0x577ca3=_0x1ce98c[_0x3f26('0x1c')],_0x96bd2d=_0x1ce98c[_0x3f26('0x1c')]+_0x1ce98c['limit'],_0x2b9cd9;if(_0x96bd2d>=_0x414672){_0x96bd2d=_0x414672;_0x2b9cd9=0xc8;}else{_0x2b9cd9=0xce;}_0x3d18ae['status'](_0x2b9cd9);return _0x3d18ae['set'](_0x3f26('0x1d'),_0x577ca3+'-'+_0x96bd2d+'/'+_0x414672)[_0x3f26('0x1e')](_0x37ee5c);}return null;};}function patchUpdates(_0x54e79b){return function(_0x346461){try{jsonpatch[_0x3f26('0x1f')](_0x346461,_0x54e79b,!![]);}catch(_0x53b245){return BPromise['reject'](_0x53b245);}return _0x346461['save']();};}function saveUpdates(_0x3080f2,_0x20fe9c){return function(_0x4a8fcf){if(_0x4a8fcf){return _0x4a8fcf[_0x3f26('0x20')](_0x3080f2)[_0x3f26('0x21')](function(_0x172a07){return _0x172a07;});}return null;};}function removeEntity(_0x191a22,_0x254638){return function(_0x5a228f){if(_0x5a228f){return _0x5a228f[_0x3f26('0x22')]()[_0x3f26('0x21')](function(){_0x191a22[_0x3f26('0x1a')](0xcc)[_0x3f26('0x23')]();});}};}function handleEntityNotFound(_0x230400,_0x8d9aa1){return function(_0x272d05){if(!_0x272d05){_0x230400[_0x3f26('0x19')](0x194);}return _0x272d05;};}function handleError(_0x335584,_0xd5d467){_0xd5d467=_0xd5d467||0x1f4;return function(_0x12a0df){logger[_0x3f26('0x24')](_0x12a0df['stack']);if(_0x12a0df[_0x3f26('0x25')]){delete _0x12a0df[_0x3f26('0x25')];}_0x335584[_0x3f26('0x1a')](_0xd5d467)['send'](_0x12a0df);};}exports['index']=function(_0x16effb,_0x1eab9c){var _0x279057={},_0x2e48b2={},_0x1880d8={'count':0x0,'rows':[]};var _0x379001=_[_0x3f26('0x26')](db[_0x3f26('0x27')][_0x3f26('0x28')],function(_0x2bbf11){return{'name':_0x2bbf11['fieldName'],'type':_0x2bbf11[_0x3f26('0x29')][_0x3f26('0x2a')]};});_0x2e48b2[_0x3f26('0x2b')]=_['map'](_0x379001,'name');_0x2e48b2['query']=_[_0x3f26('0x2c')](_0x16effb[_0x3f26('0x2d')]);_0x2e48b2[_0x3f26('0x2e')]=_['intersection'](_0x2e48b2[_0x3f26('0x2b')],_0x2e48b2['query']);_0x279057[_0x3f26('0x2f')]=_[_0x3f26('0x30')](_0x2e48b2[_0x3f26('0x2b')],qs['fields'](_0x16effb[_0x3f26('0x2d')]['fields']));_0x279057[_0x3f26('0x2f')]=_0x279057[_0x3f26('0x2f')]['length']?_0x279057[_0x3f26('0x2f')]:_0x2e48b2[_0x3f26('0x2b')];if(!_0x16effb[_0x3f26('0x2d')][_0x3f26('0x31')]('nolimit')){_0x279057[_0x3f26('0x32')]=qs[_0x3f26('0x32')](_0x16effb[_0x3f26('0x2d')][_0x3f26('0x32')]);_0x279057[_0x3f26('0x1c')]=qs[_0x3f26('0x1c')](_0x16effb[_0x3f26('0x2d')]['offset']);}_0x279057[_0x3f26('0x33')]=qs[_0x3f26('0x34')](_0x16effb['query']['sort']);_0x279057[_0x3f26('0x35')]=qs['filters'](_[_0x3f26('0x36')](_0x16effb[_0x3f26('0x2d')],_0x2e48b2[_0x3f26('0x2e')]),_0x379001);if(_0x16effb['query'][_0x3f26('0x37')]){_0x279057[_0x3f26('0x35')]=_['merge'](_0x279057[_0x3f26('0x35')],{'$or':_[_0x3f26('0x26')](_0x379001,function(_0x3da11f){if(_0x3da11f[_0x3f26('0x29')]!==_0x3f26('0x38')){var _0x15106d={};_0x15106d[_0x3da11f[_0x3f26('0x25')]]={'$like':'%'+_0x16effb[_0x3f26('0x2d')][_0x3f26('0x37')]+'%'};return _0x15106d;}})});}_0x279057=_[_0x3f26('0x39')]({},_0x279057,_0x16effb[_0x3f26('0x3a')]);var _0x29212b={'where':_0x279057[_0x3f26('0x35')]};return db[_0x3f26('0x27')][_0x3f26('0x1b')](_0x29212b)['then'](function(_0x5edd7b){_0x1880d8[_0x3f26('0x1b')]=_0x5edd7b;if(_0x16effb[_0x3f26('0x2d')][_0x3f26('0x3b')]){_0x279057[_0x3f26('0x3c')]=[{'all':!![]}];}return db[_0x3f26('0x27')][_0x3f26('0x3d')](_0x279057);})[_0x3f26('0x21')](function(_0x3d1050){_0x1880d8[_0x3f26('0x3e')]=_0x3d1050;return _0x1880d8;})[_0x3f26('0x21')](respondWithFilteredResult(_0x1eab9c,_0x279057))[_0x3f26('0x3f')](handleError(_0x1eab9c,null));};exports[_0x3f26('0x40')]=function(_0x3b33a3,_0x38c07e){var _0x5161dc={'raw':!![],'where':{'id':_0x3b33a3[_0x3f26('0x41')]['id']}},_0x3bb322={};_0x3bb322[_0x3f26('0x2b')]=_[_0x3f26('0x2c')](db[_0x3f26('0x27')][_0x3f26('0x28')]);_0x3bb322[_0x3f26('0x2d')]=_['keys'](_0x3b33a3['query']);_0x3bb322['filters']=_['intersection'](_0x3bb322[_0x3f26('0x2b')],_0x3bb322['query']);_0x5161dc[_0x3f26('0x2f')]=_[_0x3f26('0x30')](_0x3bb322['model'],qs['fields'](_0x3b33a3[_0x3f26('0x2d')]['fields']));_0x5161dc[_0x3f26('0x2f')]=_0x5161dc[_0x3f26('0x2f')]['length']?_0x5161dc[_0x3f26('0x2f')]:_0x3bb322['model'];if(_0x3b33a3[_0x3f26('0x2d')][_0x3f26('0x3b')]){_0x5161dc['include']=[{'all':!![]}];}_0x5161dc=_[_0x3f26('0x39')]({},_0x5161dc,_0x3b33a3[_0x3f26('0x3a')]);return db[_0x3f26('0x27')]['find'](_0x5161dc)[_0x3f26('0x21')](handleEntityNotFound(_0x38c07e,null))[_0x3f26('0x21')](respondWithResult(_0x38c07e,null))[_0x3f26('0x3f')](handleError(_0x38c07e,null));};exports[_0x3f26('0x42')]=function(_0x129d4a,_0x7ead3){return db[_0x3f26('0x27')]['create'](_0x129d4a[_0x3f26('0x43')],{})[_0x3f26('0x21')](respondWithResult(_0x7ead3,0xc9))['catch'](handleError(_0x7ead3,null));};exports[_0x3f26('0x20')]=function(_0x3131d4,_0x39701c){if(_0x3131d4['body']['id']){delete _0x3131d4[_0x3f26('0x43')]['id'];}return db[_0x3f26('0x27')][_0x3f26('0x44')]({'where':{'id':_0x3131d4[_0x3f26('0x41')]['id']}})[_0x3f26('0x21')](handleEntityNotFound(_0x39701c,null))['then'](saveUpdates(_0x3131d4[_0x3f26('0x43')],null))[_0x3f26('0x21')](respondWithResult(_0x39701c,null))[_0x3f26('0x3f')](handleError(_0x39701c,null));};exports[_0x3f26('0x22')]=function(_0x493769,_0x2feabf){return db[_0x3f26('0x27')][_0x3f26('0x44')]({'where':{'id':_0x493769[_0x3f26('0x41')]['id']}})[_0x3f26('0x21')](handleEntityNotFound(_0x2feabf,null))[_0x3f26('0x21')](removeEntity(_0x2feabf,null))[_0x3f26('0x3f')](handleError(_0x2feabf,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 8629b87..546cb97 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 _0x3259=['MailServerOut','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports'];(function(_0x35ec52,_0x16d639){var _0x2f38f5=function(_0x340e83){while(--_0x340e83){_0x35ec52['push'](_0x35ec52['shift']());}};_0x2f38f5(++_0x16d639);}(_0x3259,0xeb));var _0x9325=function(_0x487a10,_0xf06e9a){_0x487a10=_0x487a10-0x0;var _0x49a3b0=_0x3259[_0x487a10];return _0x49a3b0;};'use strict';var _=require(_0x9325('0x0'));var util=require(_0x9325('0x1'));var logger=require(_0x9325('0x2'))(_0x9325('0x3'));var moment=require(_0x9325('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9325('0x5'));var rimraf=require('rimraf');var config=require(_0x9325('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x9325('0x7')]=function(_0x474e46,_0x58d817){return _0x474e46['define'](_0x9325('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0154=['request-promise','path','rimraf','../../config/environment','define','MailServerOut','lodash','util','api','moment','bluebird'];(function(_0x1cfba1,_0xceafc){var _0x4fd6aa=function(_0x27e430){while(--_0x27e430){_0x1cfba1['push'](_0x1cfba1['shift']());}};_0x4fd6aa(++_0xceafc);}(_0x0154,0x124));var _0x4015=function(_0x566e80,_0x586219){_0x566e80=_0x566e80-0x0;var _0x4193de=_0x0154[_0x566e80];return _0x4193de;};'use strict';var _=require(_0x4015('0x0'));var util=require(_0x4015('0x1'));var logger=require('../../config/logger')(_0x4015('0x2'));var moment=require(_0x4015('0x3'));var BPromise=require(_0x4015('0x4'));var rp=require(_0x4015('0x5'));var fs=require('fs');var path=require(_0x4015('0x6'));var rimraf=require(_0x4015('0x7'));var config=require(_0x4015('0x8'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x1921db,_0x3b7a0b){return _0x1921db[_0x4015('0x9')](_0x4015('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2e0c224..c458995 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 _0x0ad5=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','MailServerOut,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x1a8102,_0x513653){var _0x1333b4=function(_0x20fc71){while(--_0x20fc71){_0x1a8102['push'](_0x1a8102['shift']());}};_0x1333b4(++_0x513653);}(_0x0ad5,0x1e0));var _0x50ad=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0ad5[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x50ad('0x0'));var util=require(_0x50ad('0x1'));var moment=require(_0x50ad('0x2'));var BPromise=require('bluebird');var rs=require(_0x50ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50ad('0x4'))['db'];var utils=require(_0x50ad('0x5'));var logger=require(_0x50ad('0x6'))(_0x50ad('0x7'));var config=require(_0x50ad('0x8'));var jayson=require(_0x50ad('0x9'));var client=jayson[_0x50ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373813,_0x52acfd,_0xdb9522){return new BPromise(function(_0x390381,_0x59add5){return client[_0x50ad('0xb')](_0x373813,_0xdb9522)[_0x50ad('0xc')](function(_0x5808b3){logger[_0x50ad('0xd')]('MailServerOut,\x20%s,\x20%s',_0x52acfd,_0x50ad('0xe'));logger[_0x50ad('0xf')](_0x50ad('0x10'),_0x52acfd,_0x50ad('0xe'),JSON['stringify'](_0x5808b3));if(_0x5808b3[_0x50ad('0x11')]){if(_0x5808b3[_0x50ad('0x11')]['code']===0x1f4){logger[_0x50ad('0x11')](_0x50ad('0x12'),_0x52acfd,_0x5808b3[_0x50ad('0x11')][_0x50ad('0x13')]);return _0x59add5(_0x5808b3['error'][_0x50ad('0x13')]);}logger[_0x50ad('0x11')](_0x50ad('0x12'),_0x52acfd,_0x5808b3[_0x50ad('0x11')][_0x50ad('0x13')]);return _0x390381(_0x5808b3['error'][_0x50ad('0x13')]);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0x52acfd,_0x50ad('0xe'));_0x390381(_0x5808b3['result'][_0x50ad('0x13')]);}})[_0x50ad('0x14')](function(_0x2b3734){logger[_0x50ad('0x11')]('MailServerOut,\x20%s,\x20%s',_0x52acfd,_0x2b3734);_0x59add5(_0x2b3734);});});} \ No newline at end of file +var _0xd361=['request','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','MailServerOut,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x261347,_0x3744bd){var _0x47e650=function(_0xd19ed2){while(--_0xd19ed2){_0x261347['push'](_0x261347['shift']());}};_0x47e650(++_0x3744bd);}(_0xd361,0xf3));var _0x1d36=function(_0x2cd1f2,_0x39972b){_0x2cd1f2=_0x2cd1f2-0x0;var _0x5f1267=_0xd361[_0x2cd1f2];return _0x5f1267;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d36('0x0'));var BPromise=require(_0x1d36('0x1'));var rs=require(_0x1d36('0x2'));var fs=require('fs');var Redis=require(_0x1d36('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d36('0x4'));var logger=require(_0x1d36('0x5'))(_0x1d36('0x6'));var config=require(_0x1d36('0x7'));var jayson=require(_0x1d36('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e24ef,_0x2fa114,_0x116f25){return new BPromise(function(_0x1b530c,_0x59371a){return client[_0x1d36('0x9')](_0x1e24ef,_0x116f25)[_0x1d36('0xa')](function(_0x485533){logger[_0x1d36('0xb')]('MailServerOut,\x20%s,\x20%s',_0x2fa114,_0x1d36('0xc'));logger[_0x1d36('0xd')](_0x1d36('0xe'),_0x2fa114,_0x1d36('0xc'),JSON[_0x1d36('0xf')](_0x485533));if(_0x485533[_0x1d36('0x10')]){if(_0x485533[_0x1d36('0x10')]['code']===0x1f4){logger[_0x1d36('0x10')](_0x1d36('0x11'),_0x2fa114,_0x485533[_0x1d36('0x10')][_0x1d36('0x12')]);return _0x59371a(_0x485533[_0x1d36('0x10')][_0x1d36('0x12')]);}logger[_0x1d36('0x10')](_0x1d36('0x11'),_0x2fa114,_0x485533[_0x1d36('0x10')]['message']);return _0x1b530c(_0x485533['error'][_0x1d36('0x12')]);}else{logger[_0x1d36('0xb')](_0x1d36('0x11'),_0x2fa114,'request\x20sent');_0x1b530c(_0x485533[_0x1d36('0x13')][_0x1d36('0x12')]);}})[_0x1d36('0x14')](function(_0xa5696f){logger[_0x1d36('0x10')](_0x1d36('0x11'),_0x2fa114,_0xa5696f);_0x59371a(_0xa5696f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 74f820f..c17b712 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 _0xf427=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id','create','put','update','delete','destroy','path'];(function(_0x43028e,_0x33a648){var _0x2fed6d=function(_0x3d2598){while(--_0x3d2598){_0x43028e['push'](_0x43028e['shift']());}};_0x2fed6d(++_0x33a648);}(_0xf427,0x1ee));var _0x7f42=function(_0x321bf0,_0x879e7){_0x321bf0=_0x321bf0-0x0;var _0x39cfa3=_0xf427[_0x321bf0];return _0x39cfa3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f42('0x0'));var timeout=require(_0x7f42('0x1'));var express=require(_0x7f42('0x2'));var router=express[_0x7f42('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7f42('0x4'));var config=require(_0x7f42('0x5'));var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7f42('0x6')]);router[_0x7f42('0x7')]('/describe',auth[_0x7f42('0x8')](),controller['describe']);router[_0x7f42('0x7')](_0x7f42('0x9'),auth[_0x7f42('0x8')](),controller['show']);router['post']('/',auth[_0x7f42('0x8')](),controller[_0x7f42('0xa')]);router[_0x7f42('0xb')](_0x7f42('0x9'),auth[_0x7f42('0x8')](),controller[_0x7f42('0xc')]);router[_0x7f42('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7f42('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0d0c=['get','index','isAuthenticated','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailSubstatus.controller'];(function(_0x31e76c,_0x4bc691){var _0x54773e=function(_0x687377){while(--_0x687377){_0x31e76c['push'](_0x31e76c['shift']());}};_0x54773e(++_0x4bc691);}(_0x0d0c,0x6f));var _0xc0d0=function(_0x388601,_0x1cc3b9){_0x388601=_0x388601-0x0;var _0x4a29ec=_0x0d0c[_0x388601];return _0x4a29ec;};'use strict';var multer=require(_0xc0d0('0x0'));var util=require(_0xc0d0('0x1'));var path=require(_0xc0d0('0x2'));var timeout=require(_0xc0d0('0x3'));var express=require(_0xc0d0('0x4'));var router=express['Router']();var auth=require(_0xc0d0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc0d0('0x6'));var controller=require(_0xc0d0('0x7'));router[_0xc0d0('0x8')]('/',auth['isAuthenticated'](),controller[_0xc0d0('0x9')]);router[_0xc0d0('0x8')]('/describe',auth[_0xc0d0('0xa')](),controller['describe']);router[_0xc0d0('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc0d0('0xb')]('/',auth[_0xc0d0('0xa')](),controller[_0xc0d0('0xc')]);router[_0xc0d0('0xd')]('/:id',auth[_0xc0d0('0xa')](),controller[_0xc0d0('0xe')]);router['delete']('/:id',auth[_0xc0d0('0xa')](),controller[_0xc0d0('0xf')]);module[_0xc0d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 5a39806..0871dec 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 _0xf981=['STRING','name','sequelize','exports'];(function(_0x3449ed,_0x242e49){var _0x125128=function(_0x1cc7bc){while(--_0x1cc7bc){_0x3449ed['push'](_0x3449ed['shift']());}};_0x125128(++_0x242e49);}(_0xf981,0xe6));var _0x1f98=function(_0x451bf6,_0x437892){_0x451bf6=_0x451bf6-0x0;var _0x10a6a2=_0xf981[_0x451bf6];return _0x10a6a2;};'use strict';var Sequelize=require(_0x1f98('0x0'));module[_0x1f98('0x1')]={'name':{'type':Sequelize[_0x1f98('0x2')],'unique':_0x1f98('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1f98('0x2')]}}; \ No newline at end of file +var _0xbcae=['name','sequelize','exports','STRING'];(function(_0x340a7c,_0x4e3a82){var _0x41dc1d=function(_0x163cb4){while(--_0x163cb4){_0x340a7c['push'](_0x340a7c['shift']());}};_0x41dc1d(++_0x4e3a82);}(_0xbcae,0xa9));var _0xebca=function(_0x481943,_0x38003c){_0x481943=_0x481943-0x0;var _0x2b4dd0=_0xbcae[_0x481943];return _0x2b4dd0;};'use strict';var Sequelize=require(_0xebca('0x0'));module[_0xebca('0x1')]={'name':{'type':Sequelize[_0xebca('0x2')],'unique':_0xebca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xebca('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index ffc1f6e..ee77eb3 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 _0xb09f=['rawAttributes','find','catch','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','MailSubstatus','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show'];(function(_0xdb47d8,_0x933e5b){var _0x5cdfd9=function(_0x3b69a8){while(--_0x3b69a8){_0xdb47d8['push'](_0xdb47d8['shift']());}};_0x5cdfd9(++_0x933e5b);}(_0xb09f,0x130));var _0xfb09=function(_0x14dbdb,_0x87a2aa){_0x14dbdb=_0x14dbdb-0x0;var _0x20d83a=_0xb09f[_0x14dbdb];return _0x20d83a;};'use strict';var pdf=require(_0xfb09('0x0'));var emlformat=require(_0xfb09('0x1'));var rimraf=require(_0xfb09('0x2'));var zipdir=require(_0xfb09('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfb09('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfb09('0x5'));var util=require(_0xfb09('0x6'));var path=require(_0xfb09('0x7'));var sox=require(_0xfb09('0x8'));var csv=require(_0xfb09('0x9'));var ejs=require(_0xfb09('0xa'));var fs=require('fs');var _=require(_0xfb09('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb09('0x9'));var querystring=require(_0xfb09('0xc'));var Papa=require('papaparse');var Redis=require(_0xfb09('0xd'));var authService=require(_0xfb09('0xe'));var qs=require(_0xfb09('0xf'));var as=require(_0xfb09('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb09('0x11'))(_0xfb09('0x12'));var utils=require(_0xfb09('0x13'));var config=require(_0xfb09('0x14'));var db=require(_0xfb09('0x15'))['db'];function respondWithStatusCode(_0x59d496,_0x49febd){_0x49febd=_0x49febd||0xcc;return function(_0x246b90){if(_0x246b90){return _0x59d496['sendStatus'](_0x49febd);}return _0x59d496[_0xfb09('0x16')](_0x49febd)[_0xfb09('0x17')]();};}function respondWithResult(_0x17c665,_0xee7fb7){_0xee7fb7=_0xee7fb7||0xc8;return function(_0x20a679){if(_0x20a679){return _0x17c665[_0xfb09('0x16')](_0xee7fb7)[_0xfb09('0x18')](_0x20a679);}};}function respondWithFilteredResult(_0x333733,_0xad7936){return function(_0x103a03){if(_0x103a03){var _0x49da81=_0x103a03[_0xfb09('0x19')],_0x56c96a=_0xad7936[_0xfb09('0x1a')],_0x4f6f2b=_0xad7936[_0xfb09('0x1a')]+_0xad7936[_0xfb09('0x1b')],_0x5c155f;if(_0x4f6f2b>=_0x49da81){_0x4f6f2b=_0x49da81;_0x5c155f=0xc8;}else{_0x5c155f=0xce;}_0x333733['status'](_0x5c155f);return _0x333733['set'](_0xfb09('0x1c'),_0x56c96a+'-'+_0x4f6f2b+'/'+_0x49da81)['json'](_0x103a03);}return null;};}function patchUpdates(_0x394219){return function(_0x1bb3da){try{jsonpatch[_0xfb09('0x1d')](_0x1bb3da,_0x394219,!![]);}catch(_0x2274ed){return BPromise[_0xfb09('0x1e')](_0x2274ed);}return _0x1bb3da[_0xfb09('0x1f')]();};}function saveUpdates(_0x5cc0af,_0x52c079){return function(_0x5c173d){if(_0x5c173d){return _0x5c173d['update'](_0x5cc0af)[_0xfb09('0x20')](function(_0x3ec9f6){return _0x3ec9f6;});}return null;};}function removeEntity(_0x2eb9c9,_0x41a20d){return function(_0x37ee88){if(_0x37ee88){return _0x37ee88[_0xfb09('0x21')]()[_0xfb09('0x20')](function(){_0x2eb9c9[_0xfb09('0x16')](0xcc)[_0xfb09('0x17')]();});}};}function handleEntityNotFound(_0x534772,_0x45c1d9){return function(_0x2606bd){if(!_0x2606bd){_0x534772[_0xfb09('0x22')](0x194);}return _0x2606bd;};}function handleError(_0x18623b,_0x5ab9ae){_0x5ab9ae=_0x5ab9ae||0x1f4;return function(_0x2c3a8e){logger[_0xfb09('0x23')](_0x2c3a8e['stack']);if(_0x2c3a8e['name']){delete _0x2c3a8e[_0xfb09('0x24')];}_0x18623b['status'](_0x5ab9ae)[_0xfb09('0x25')](_0x2c3a8e);};}exports[_0xfb09('0x26')]=function(_0x12f6b8,_0x3dd9bf){var _0x19523c={},_0xee5d32={},_0x4996da={'count':0x0,'rows':[]};var _0x500fc4=_[_0xfb09('0x27')](db[_0xfb09('0x28')]['rawAttributes'],function(_0x17e032){return{'name':_0x17e032[_0xfb09('0x29')],'type':_0x17e032['type'][_0xfb09('0x2a')]};});_0xee5d32[_0xfb09('0x2b')]=_[_0xfb09('0x27')](_0x500fc4,_0xfb09('0x24'));_0xee5d32[_0xfb09('0x2c')]=_[_0xfb09('0x2d')](_0x12f6b8[_0xfb09('0x2c')]);_0xee5d32[_0xfb09('0x2e')]=_[_0xfb09('0x2f')](_0xee5d32[_0xfb09('0x2b')],_0xee5d32[_0xfb09('0x2c')]);_0x19523c[_0xfb09('0x30')]=_[_0xfb09('0x2f')](_0xee5d32[_0xfb09('0x2b')],qs[_0xfb09('0x31')](_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x31')]));_0x19523c[_0xfb09('0x30')]=_0x19523c['attributes'][_0xfb09('0x32')]?_0x19523c[_0xfb09('0x30')]:_0xee5d32[_0xfb09('0x2b')];if(!_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x33')](_0xfb09('0x34'))){_0x19523c['limit']=qs[_0xfb09('0x1b')](_0x12f6b8['query']['limit']);_0x19523c[_0xfb09('0x1a')]=qs['offset'](_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x1a')]);}_0x19523c[_0xfb09('0x35')]=qs[_0xfb09('0x36')](_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x36')]);_0x19523c['where']=qs['filters'](_[_0xfb09('0x37')](_0x12f6b8[_0xfb09('0x2c')],_0xee5d32['filters']),_0x500fc4);if(_0x12f6b8['query'][_0xfb09('0x38')]){_0x19523c['where']=_['merge'](_0x19523c[_0xfb09('0x39')],{'$or':_['map'](_0x500fc4,function(_0x4809da){if(_0x4809da['type']!==_0xfb09('0x3a')){var _0x5af2a5={};_0x5af2a5[_0x4809da[_0xfb09('0x24')]]={'$like':'%'+_0x12f6b8['query'][_0xfb09('0x38')]+'%'};return _0x5af2a5;}})});}_0x19523c=_[_0xfb09('0x3b')]({},_0x19523c,_0x12f6b8[_0xfb09('0x3c')]);var _0xcb7eb8={'where':_0x19523c[_0xfb09('0x39')]};return db[_0xfb09('0x28')][_0xfb09('0x19')](_0xcb7eb8)['then'](function(_0x96611a){_0x4996da[_0xfb09('0x19')]=_0x96611a;if(_0x12f6b8[_0xfb09('0x2c')][_0xfb09('0x3d')]){_0x19523c[_0xfb09('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0xfb09('0x3f')](_0x19523c);})[_0xfb09('0x20')](function(_0x42893d){_0x4996da[_0xfb09('0x40')]=_0x42893d;return _0x4996da;})[_0xfb09('0x20')](respondWithFilteredResult(_0x3dd9bf,_0x19523c))['catch'](handleError(_0x3dd9bf,null));};exports[_0xfb09('0x41')]=function(_0x582ebd,_0x1d1683){var _0x642cc={'raw':!![],'where':{'id':_0x582ebd['params']['id']}},_0x4f3316={};_0x4f3316['model']=_[_0xfb09('0x2d')](db['MailSubstatus'][_0xfb09('0x42')]);_0x4f3316[_0xfb09('0x2c')]=_['keys'](_0x582ebd[_0xfb09('0x2c')]);_0x4f3316['filters']=_[_0xfb09('0x2f')](_0x4f3316[_0xfb09('0x2b')],_0x4f3316[_0xfb09('0x2c')]);_0x642cc[_0xfb09('0x30')]=_[_0xfb09('0x2f')](_0x4f3316[_0xfb09('0x2b')],qs[_0xfb09('0x31')](_0x582ebd[_0xfb09('0x2c')][_0xfb09('0x31')]));_0x642cc[_0xfb09('0x30')]=_0x642cc['attributes']['length']?_0x642cc[_0xfb09('0x30')]:_0x4f3316[_0xfb09('0x2b')];if(_0x582ebd[_0xfb09('0x2c')]['includeAll']){_0x642cc['include']=[{'all':!![]}];}_0x642cc=_['merge']({},_0x642cc,_0x582ebd[_0xfb09('0x3c')]);return db['MailSubstatus'][_0xfb09('0x43')](_0x642cc)[_0xfb09('0x20')](handleEntityNotFound(_0x1d1683,null))[_0xfb09('0x20')](respondWithResult(_0x1d1683,null))[_0xfb09('0x44')](handleError(_0x1d1683,null));};exports[_0xfb09('0x45')]=function(_0x2f6749,_0x4974ed){return db[_0xfb09('0x28')]['create'](_0x2f6749['body'],{})[_0xfb09('0x20')](respondWithResult(_0x4974ed,0xc9))[_0xfb09('0x44')](handleError(_0x4974ed,null));};exports[_0xfb09('0x46')]=function(_0x172952,_0xaa18bb){if(_0x172952[_0xfb09('0x47')]['id']){delete _0x172952['body']['id'];}return db['MailSubstatus'][_0xfb09('0x43')]({'where':{'id':_0x172952[_0xfb09('0x48')]['id']}})[_0xfb09('0x20')](handleEntityNotFound(_0xaa18bb,null))[_0xfb09('0x20')](saveUpdates(_0x172952['body'],null))[_0xfb09('0x20')](respondWithResult(_0xaa18bb,null))['catch'](handleError(_0xaa18bb,null));};exports[_0xfb09('0x21')]=function(_0x39cc00,_0x171b19){return db[_0xfb09('0x28')][_0xfb09('0x43')]({'where':{'id':_0x39cc00[_0xfb09('0x48')]['id']}})[_0xfb09('0x20')](handleEntityNotFound(_0x171b19,null))[_0xfb09('0x20')](removeEntity(_0x171b19,null))[_0xfb09('0x44')](handleError(_0x171b19,null));};exports[_0xfb09('0x49')]=function(_0x4ce83e,_0x2a1e9a){return db[_0xfb09('0x28')][_0xfb09('0x49')]()['then'](respondWithResult(_0x2a1e9a,null))[_0xfb09('0x44')](handleError(_0x2a1e9a,null));}; \ No newline at end of file +var _0x048a=['bluebird','mustache','path','sox','ejs','squel','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','map','MailSubstatus','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','filter','options','includeAll','findAll','catch','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x5a8ea5,_0x2ff794){var _0x3e5df1=function(_0x4493e2){while(--_0x4493e2){_0x5a8ea5['push'](_0x5a8ea5['shift']());}};_0x3e5df1(++_0x2ff794);}(_0x048a,0x1d8));var _0xa048=function(_0x441398,_0x5cf481){_0x441398=_0x441398-0x0;var _0x29b137=_0x048a[_0x441398];return _0x29b137;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa048('0x0'));var zipdir=require(_0xa048('0x1'));var jsonpatch=require(_0xa048('0x2'));var rp=require('request-promise');var moment=require(_0xa048('0x3'));var BPromise=require(_0xa048('0x4'));var Mustache=require(_0xa048('0x5'));var util=require('util');var path=require(_0xa048('0x6'));var sox=require(_0xa048('0x7'));var csv=require('to-csv');var ejs=require(_0xa048('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa048('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa048('0xa'));var toCsv=require(_0xa048('0xb'));var querystring=require(_0xa048('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa048('0xd'));var as=require(_0xa048('0xe'));var hardwareService=require(_0xa048('0xf'));var logger=require('../../config/logger')(_0xa048('0x10'));var utils=require(_0xa048('0x11'));var config=require(_0xa048('0x12'));var db=require(_0xa048('0x13'))['db'];function respondWithStatusCode(_0x37864b,_0xe4a621){_0xe4a621=_0xe4a621||0xcc;return function(_0x57becc){if(_0x57becc){return _0x37864b[_0xa048('0x14')](_0xe4a621);}return _0x37864b[_0xa048('0x15')](_0xe4a621)[_0xa048('0x16')]();};}function respondWithResult(_0xee9088,_0x90b1dc){_0x90b1dc=_0x90b1dc||0xc8;return function(_0x81c4cd){if(_0x81c4cd){return _0xee9088[_0xa048('0x15')](_0x90b1dc)[_0xa048('0x17')](_0x81c4cd);}};}function respondWithFilteredResult(_0x4348b0,_0x1adf69){return function(_0x4b0a2d){if(_0x4b0a2d){var _0x558e17=_0x4b0a2d[_0xa048('0x18')],_0x1c6785=_0x1adf69['offset'],_0x459ac9=_0x1adf69['offset']+_0x1adf69[_0xa048('0x19')],_0x44918b;if(_0x459ac9>=_0x558e17){_0x459ac9=_0x558e17;_0x44918b=0xc8;}else{_0x44918b=0xce;}_0x4348b0[_0xa048('0x15')](_0x44918b);return _0x4348b0[_0xa048('0x1a')](_0xa048('0x1b'),_0x1c6785+'-'+_0x459ac9+'/'+_0x558e17)[_0xa048('0x17')](_0x4b0a2d);}return null;};}function patchUpdates(_0xf61d09){return function(_0x329acf){try{jsonpatch[_0xa048('0x1c')](_0x329acf,_0xf61d09,!![]);}catch(_0x5027e1){return BPromise[_0xa048('0x1d')](_0x5027e1);}return _0x329acf[_0xa048('0x1e')]();};}function saveUpdates(_0x233732,_0x459c7d){return function(_0x53f325){if(_0x53f325){return _0x53f325[_0xa048('0x1f')](_0x233732)[_0xa048('0x20')](function(_0x446866){return _0x446866;});}return null;};}function removeEntity(_0x8e7e3d,_0x239fe4){return function(_0x474d4a){if(_0x474d4a){return _0x474d4a[_0xa048('0x21')]()[_0xa048('0x20')](function(){_0x8e7e3d['status'](0xcc)[_0xa048('0x16')]();});}};}function handleEntityNotFound(_0x2fbb67,_0x449eae){return function(_0x247130){if(!_0x247130){_0x2fbb67[_0xa048('0x14')](0x194);}return _0x247130;};}function handleError(_0x5559d2,_0x3ba97c){_0x3ba97c=_0x3ba97c||0x1f4;return function(_0x1d38f9){logger[_0xa048('0x22')](_0x1d38f9[_0xa048('0x23')]);if(_0x1d38f9['name']){delete _0x1d38f9['name'];}_0x5559d2[_0xa048('0x15')](_0x3ba97c)['send'](_0x1d38f9);};}exports['index']=function(_0x377957,_0x985bec){var _0x4fe7c0={},_0x46792f={},_0x20ac61={'count':0x0,'rows':[]};var _0x4826b4=_[_0xa048('0x24')](db[_0xa048('0x25')][_0xa048('0x26')],function(_0x2fc514){return{'name':_0x2fc514[_0xa048('0x27')],'type':_0x2fc514[_0xa048('0x28')][_0xa048('0x29')]};});_0x46792f['model']=_[_0xa048('0x24')](_0x4826b4,_0xa048('0x2a'));_0x46792f[_0xa048('0x2b')]=_[_0xa048('0x2c')](_0x377957[_0xa048('0x2b')]);_0x46792f[_0xa048('0x2d')]=_[_0xa048('0x2e')](_0x46792f[_0xa048('0x2f')],_0x46792f['query']);_0x4fe7c0[_0xa048('0x30')]=_[_0xa048('0x2e')](_0x46792f[_0xa048('0x2f')],qs[_0xa048('0x31')](_0x377957[_0xa048('0x2b')][_0xa048('0x31')]));_0x4fe7c0[_0xa048('0x30')]=_0x4fe7c0[_0xa048('0x30')][_0xa048('0x32')]?_0x4fe7c0[_0xa048('0x30')]:_0x46792f[_0xa048('0x2f')];if(!_0x377957[_0xa048('0x2b')][_0xa048('0x33')](_0xa048('0x34'))){_0x4fe7c0['limit']=qs[_0xa048('0x19')](_0x377957[_0xa048('0x2b')]['limit']);_0x4fe7c0[_0xa048('0x35')]=qs[_0xa048('0x35')](_0x377957[_0xa048('0x2b')][_0xa048('0x35')]);}_0x4fe7c0['order']=qs[_0xa048('0x36')](_0x377957[_0xa048('0x2b')][_0xa048('0x36')]);_0x4fe7c0[_0xa048('0x37')]=qs[_0xa048('0x2d')](_[_0xa048('0x38')](_0x377957['query'],_0x46792f[_0xa048('0x2d')]),_0x4826b4);if(_0x377957[_0xa048('0x2b')]['filter']){_0x4fe7c0['where']=_[_0xa048('0x39')](_0x4fe7c0[_0xa048('0x37')],{'$or':_['map'](_0x4826b4,function(_0x23f82d){if(_0x23f82d['type']!=='VIRTUAL'){var _0x2cf760={};_0x2cf760[_0x23f82d[_0xa048('0x2a')]]={'$like':'%'+_0x377957[_0xa048('0x2b')][_0xa048('0x3a')]+'%'};return _0x2cf760;}})});}_0x4fe7c0=_[_0xa048('0x39')]({},_0x4fe7c0,_0x377957[_0xa048('0x3b')]);var _0x19474f={'where':_0x4fe7c0[_0xa048('0x37')]};return db[_0xa048('0x25')][_0xa048('0x18')](_0x19474f)[_0xa048('0x20')](function(_0x21e801){_0x20ac61[_0xa048('0x18')]=_0x21e801;if(_0x377957[_0xa048('0x2b')][_0xa048('0x3c')]){_0x4fe7c0['include']=[{'all':!![]}];}return db[_0xa048('0x25')][_0xa048('0x3d')](_0x4fe7c0);})[_0xa048('0x20')](function(_0x215811){_0x20ac61['rows']=_0x215811;return _0x20ac61;})[_0xa048('0x20')](respondWithFilteredResult(_0x985bec,_0x4fe7c0))[_0xa048('0x3e')](handleError(_0x985bec,null));};exports['show']=function(_0x547b44,_0x127748){var _0x29177b={'raw':!![],'where':{'id':_0x547b44['params']['id']}},_0x4c1b45={};_0x4c1b45[_0xa048('0x2f')]=_[_0xa048('0x2c')](db['MailSubstatus'][_0xa048('0x26')]);_0x4c1b45[_0xa048('0x2b')]=_[_0xa048('0x2c')](_0x547b44[_0xa048('0x2b')]);_0x4c1b45['filters']=_[_0xa048('0x2e')](_0x4c1b45[_0xa048('0x2f')],_0x4c1b45[_0xa048('0x2b')]);_0x29177b['attributes']=_[_0xa048('0x2e')](_0x4c1b45[_0xa048('0x2f')],qs['fields'](_0x547b44[_0xa048('0x2b')][_0xa048('0x31')]));_0x29177b[_0xa048('0x30')]=_0x29177b[_0xa048('0x30')][_0xa048('0x32')]?_0x29177b['attributes']:_0x4c1b45[_0xa048('0x2f')];if(_0x547b44[_0xa048('0x2b')][_0xa048('0x3c')]){_0x29177b['include']=[{'all':!![]}];}_0x29177b=_[_0xa048('0x39')]({},_0x29177b,_0x547b44['options']);return db[_0xa048('0x25')][_0xa048('0x3f')](_0x29177b)[_0xa048('0x20')](handleEntityNotFound(_0x127748,null))[_0xa048('0x20')](respondWithResult(_0x127748,null))[_0xa048('0x3e')](handleError(_0x127748,null));};exports[_0xa048('0x40')]=function(_0x5bf2fd,_0x1a653c){return db[_0xa048('0x25')]['create'](_0x5bf2fd['body'],{})[_0xa048('0x20')](respondWithResult(_0x1a653c,0xc9))['catch'](handleError(_0x1a653c,null));};exports['update']=function(_0x5e47b7,_0x23744c){if(_0x5e47b7[_0xa048('0x41')]['id']){delete _0x5e47b7[_0xa048('0x41')]['id'];}return db[_0xa048('0x25')][_0xa048('0x3f')]({'where':{'id':_0x5e47b7[_0xa048('0x42')]['id']}})[_0xa048('0x20')](handleEntityNotFound(_0x23744c,null))[_0xa048('0x20')](saveUpdates(_0x5e47b7[_0xa048('0x41')],null))[_0xa048('0x20')](respondWithResult(_0x23744c,null))[_0xa048('0x3e')](handleError(_0x23744c,null));};exports[_0xa048('0x21')]=function(_0x594cdb,_0x148256){return db[_0xa048('0x25')][_0xa048('0x3f')]({'where':{'id':_0x594cdb['params']['id']}})['then'](handleEntityNotFound(_0x148256,null))[_0xa048('0x20')](removeEntity(_0x148256,null))[_0xa048('0x3e')](handleError(_0x148256,null));};exports[_0xa048('0x43')]=function(_0x348546,_0x4dcc65){return db[_0xa048('0x25')][_0xa048('0x43')]()[_0xa048('0x20')](respondWithResult(_0x4dcc65,null))[_0xa048('0x3e')](handleError(_0x4dcc65,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3aadb42..0f27e01 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 _0x7ff9=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x7ff9,0xc6));var _0x97ff=function(_0x249a07,_0x4787c7){_0x249a07=_0x249a07-0x0;var _0xc75928=_0x7ff9[_0x249a07];return _0xc75928;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x97ff('0x0'))('api');var moment=require('moment');var BPromise=require(_0x97ff('0x1'));var rp=require(_0x97ff('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97ff('0x3'));var config=require(_0x97ff('0x4'));var attributes=require('./mailSubstatus.attributes');module[_0x97ff('0x5')]=function(_0x1333e0,_0x27e088){return _0x1333e0[_0x97ff('0x6')](_0x97ff('0x7'),attributes,{'tableName':_0x97ff('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcf2=['request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0xbcf2,0x174));var _0x2bcf=function(_0x270e46,_0x122174){_0x270e46=_0x270e46-0x0;var _0x18ca4e=_0xbcf2[_0x270e46];return _0x18ca4e;};'use strict';var _=require(_0x2bcf('0x0'));var util=require(_0x2bcf('0x1'));var logger=require(_0x2bcf('0x2'))(_0x2bcf('0x3'));var moment=require(_0x2bcf('0x4'));var BPromise=require(_0x2bcf('0x5'));var rp=require(_0x2bcf('0x6'));var fs=require('fs');var path=require(_0x2bcf('0x7'));var rimraf=require(_0x2bcf('0x8'));var config=require(_0x2bcf('0x9'));var attributes=require(_0x2bcf('0xa'));module[_0x2bcf('0xb')]=function(_0x4d7b47,_0x2911d9){return _0x4d7b47['define'](_0x2bcf('0xc'),attributes,{'tableName':_0x2bcf('0xd'),'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 8647fec..76d1829 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 _0x6324=['client','http','then','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x23545c,_0x5991f5){var _0x1db75c=function(_0x110b0a){while(--_0x110b0a){_0x23545c['push'](_0x23545c['shift']());}};_0x1db75c(++_0x5991f5);}(_0x6324,0x142));var _0x4632=function(_0x174a7c,_0x163b97){_0x174a7c=_0x174a7c-0x0;var _0x2e35d6=_0x6324[_0x174a7c];return _0x2e35d6;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e9a,_0x4a15b2,_0x17e860){return new BPromise(function(_0x44dd6d,_0x390a46){return client['request'](_0x126e9a,_0x17e860)[_0x4632('0xa')](function(_0x47824c){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x4a15b2,_0x4632('0xb'));logger[_0x4632('0xc')](_0x4632('0xd'),_0x4a15b2,_0x4632('0xb'),JSON[_0x4632('0xe')](_0x47824c));if(_0x47824c[_0x4632('0xf')]){if(_0x47824c[_0x4632('0xf')][_0x4632('0x10')]===0x1f4){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x47824c['error'][_0x4632('0x12')]);return _0x390a46(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}logger[_0x4632('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x4a15b2,'request\x20sent');_0x44dd6d(_0x47824c[_0x4632('0x14')][_0x4632('0x12')]);}})[_0x4632('0x15')](function(_0x125eb9){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x125eb9);_0x390a46(_0x125eb9);});});} \ No newline at end of file +var _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x26fdc8,_0x2f70c1){var _0x574ebd=function(_0x8edbfa){while(--_0x8edbfa){_0x26fdc8['push'](_0x26fdc8['shift']());}};_0x574ebd(++_0x2f70c1);}(_0x702d,0x147));var _0xd702=function(_0x301936,_0x2c173f){_0x301936=_0x301936-0x0;var _0x398bee=_0x702d[_0x301936];return _0x398bee;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index b27d05c..ebbabb6 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 _0xaf7b=['get','index','describe','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf7b,0x1c4));var _0xbaf7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaf7b[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xbaf7('0x0'));var util=require(_0xbaf7('0x1'));var path=require(_0xbaf7('0x2'));var timeout=require(_0xbaf7('0x3'));var express=require(_0xbaf7('0x4'));var router=express[_0xbaf7('0x5')]();var auth=require(_0xbaf7('0x6'));var interaction=require(_0xbaf7('0x7'));var config=require(_0xbaf7('0x8'));var controller=require(_0xbaf7('0x9'));router[_0xbaf7('0xa')]('/',auth['isAuthenticated'](),controller[_0xbaf7('0xb')]);router[_0xbaf7('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xbaf7('0xc')]);router[_0xbaf7('0xa')](_0xbaf7('0xd'),auth[_0xbaf7('0xe')](),controller[_0xbaf7('0xf')]);router[_0xbaf7('0x10')]('/',auth[_0xbaf7('0xe')](),controller[_0xbaf7('0x11')]);router['put'](_0xbaf7('0xd'),auth[_0xbaf7('0xe')](),controller['update']);router[_0xbaf7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbaf7('0x13')]);module[_0xbaf7('0x14')]=router; \ No newline at end of file +var _0xa960=['create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa960,0x1d0));var _0x0a96=function(_0x29da06,_0x4564fb){_0x29da06=_0x29da06-0x0;var _0x4b29fe=_0xa960[_0x29da06];return _0x4b29fe;};'use strict';var multer=require(_0x0a96('0x0'));var util=require('util');var path=require(_0x0a96('0x1'));var timeout=require(_0x0a96('0x2'));var express=require('express');var router=express[_0x0a96('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a96('0x4'));var config=require(_0x0a96('0x5'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x0a96('0x6')](),controller['index']);router[_0x0a96('0x7')](_0x0a96('0x8'),auth[_0x0a96('0x6')](),controller['describe']);router[_0x0a96('0x7')](_0x0a96('0x9'),auth[_0x0a96('0x6')](),controller[_0x0a96('0xa')]);router[_0x0a96('0xb')]('/',auth[_0x0a96('0x6')](),controller[_0x0a96('0xc')]);router[_0x0a96('0xd')](_0x0a96('0x9'),auth[_0x0a96('0x6')](),controller[_0x0a96('0xe')]);router[_0x0a96('0xf')]('/:id',auth[_0x0a96('0x6')](),controller['destroy']);module[_0x0a96('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f108d82..4499e51 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 _0x57e9=['NOW','sequelize','exports','STRING','ENUM','account','queue','DATE'];(function(_0x217110,_0x53e425){var _0x49d701=function(_0x3da120){while(--_0x3da120){_0x217110['push'](_0x217110['shift']());}};_0x49d701(++_0x53e425);}(_0x57e9,0xe1));var _0x957e=function(_0x52c5ea,_0x54f60e){_0x52c5ea=_0x52c5ea-0x0;var _0x1769e2=_0x57e9[_0x52c5ea];return _0x1769e2;};'use strict';var moment=require('moment');var Sequelize=require(_0x957e('0x0'));module[_0x957e('0x1')]={'uniqueid':{'type':Sequelize[_0x957e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x957e('0x3')](_0x957e('0x4'),'agent',_0x957e('0x5')),'allowNull':![],'defaultValue':_0x957e('0x5')},'transferredAt':{'type':Sequelize[_0x957e('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x957e('0x7')]}}; \ No newline at end of file +var _0xa9b7=['exports','STRING','ENUM','account','agent','queue','DATE','moment','sequelize'];(function(_0x29995d,_0x54e53f){var _0x55348f=function(_0x12cf97){while(--_0x12cf97){_0x29995d['push'](_0x29995d['shift']());}};_0x55348f(++_0x54e53f);}(_0xa9b7,0xfa));var _0x7a9b=function(_0x3eb111,_0x307910){_0x3eb111=_0x3eb111-0x0;var _0x56c646=_0xa9b7[_0x3eb111];return _0x56c646;};'use strict';var moment=require(_0x7a9b('0x0'));var Sequelize=require(_0x7a9b('0x1'));module[_0x7a9b('0x2')]={'uniqueid':{'type':Sequelize[_0x7a9b('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7a9b('0x4')](_0x7a9b('0x5'),_0x7a9b('0x6'),_0x7a9b('0x7')),'allowNull':![],'defaultValue':_0x7a9b('0x7')},'transferredAt':{'type':Sequelize[_0x7a9b('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index a1f068b..a6b04e2 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 _0x7daf=['send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x303ab3,_0x25c2f4){var _0xd5171e=function(_0x3fe32b){while(--_0x3fe32b){_0x303ab3['push'](_0x303ab3['shift']());}};_0xd5171e(++_0x25c2f4);}(_0x7daf,0x19a));var _0xf7da=function(_0x3ef2d8,_0x4fdf2e){_0x3ef2d8=_0x3ef2d8-0x0;var _0x5c86a5=_0x7daf[_0x3ef2d8];return _0x5c86a5;};'use strict';var pdf=require(_0xf7da('0x0'));var emlformat=require(_0xf7da('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf7da('0x2'));var jsonpatch=require(_0xf7da('0x3'));var rp=require(_0xf7da('0x4'));var moment=require(_0xf7da('0x5'));var BPromise=require(_0xf7da('0x6'));var Mustache=require(_0xf7da('0x7'));var util=require(_0xf7da('0x8'));var path=require('path');var sox=require(_0xf7da('0x9'));var csv=require(_0xf7da('0xa'));var ejs=require(_0xf7da('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf7da('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf7da('0xd'));var toCsv=require(_0xf7da('0xa'));var querystring=require(_0xf7da('0xe'));var Papa=require(_0xf7da('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf7da('0x10'));var as=require(_0xf7da('0x11'));var hardwareService=require(_0xf7da('0x12'));var logger=require(_0xf7da('0x13'))('api');var utils=require(_0xf7da('0x14'));var config=require(_0xf7da('0x15'));var db=require(_0xf7da('0x16'))['db'];function respondWithStatusCode(_0x1791cd,_0x4009ef){_0x4009ef=_0x4009ef||0xcc;return function(_0x1aa6cd){if(_0x1aa6cd){return _0x1791cd[_0xf7da('0x17')](_0x4009ef);}return _0x1791cd[_0xf7da('0x18')](_0x4009ef)[_0xf7da('0x19')]();};}function respondWithResult(_0x30e0f0,_0x331712){_0x331712=_0x331712||0xc8;return function(_0x4e4d3c){if(_0x4e4d3c){return _0x30e0f0[_0xf7da('0x18')](_0x331712)[_0xf7da('0x1a')](_0x4e4d3c);}};}function respondWithFilteredResult(_0x2aab47,_0x59d0d2){return function(_0x5d30aa){if(_0x5d30aa){var _0x503d3b=_0x5d30aa[_0xf7da('0x1b')],_0x1732d8=_0x59d0d2['offset'],_0x560102=_0x59d0d2['offset']+_0x59d0d2[_0xf7da('0x1c')],_0x2a5fcf;if(_0x560102>=_0x503d3b){_0x560102=_0x503d3b;_0x2a5fcf=0xc8;}else{_0x2a5fcf=0xce;}_0x2aab47[_0xf7da('0x18')](_0x2a5fcf);return _0x2aab47[_0xf7da('0x1d')](_0xf7da('0x1e'),_0x1732d8+'-'+_0x560102+'/'+_0x503d3b)[_0xf7da('0x1a')](_0x5d30aa);}return null;};}function patchUpdates(_0x1a1d19){return function(_0xfdc6ba){try{jsonpatch[_0xf7da('0x1f')](_0xfdc6ba,_0x1a1d19,!![]);}catch(_0x48f8d8){return BPromise[_0xf7da('0x20')](_0x48f8d8);}return _0xfdc6ba[_0xf7da('0x21')]();};}function saveUpdates(_0x5139aa,_0x5f3c92){return function(_0xd08b4b){if(_0xd08b4b){return _0xd08b4b[_0xf7da('0x22')](_0x5139aa)['then'](function(_0x12d07e){return _0x12d07e;});}return null;};}function removeEntity(_0x11e9d7,_0x27a65c){return function(_0x149a5b){if(_0x149a5b){return _0x149a5b[_0xf7da('0x23')]()[_0xf7da('0x24')](function(){_0x11e9d7[_0xf7da('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2c03,_0x1de135){return function(_0x3b6851){if(!_0x3b6851){_0x4c2c03[_0xf7da('0x17')](0x194);}return _0x3b6851;};}function handleError(_0x408acd,_0x39154e){_0x39154e=_0x39154e||0x1f4;return function(_0x8563a9){logger[_0xf7da('0x25')](_0x8563a9[_0xf7da('0x26')]);if(_0x8563a9[_0xf7da('0x27')]){delete _0x8563a9['name'];}_0x408acd[_0xf7da('0x18')](_0x39154e)[_0xf7da('0x28')](_0x8563a9);};}exports[_0xf7da('0x29')]=function(_0xd26618,_0x2e610d){var _0x229792={},_0xc1591d={},_0x10001a={'count':0x0,'rows':[]};var _0x5006c8=_[_0xf7da('0x2a')](db[_0xf7da('0x2b')][_0xf7da('0x2c')],function(_0x58d026){return{'name':_0x58d026[_0xf7da('0x2d')],'type':_0x58d026[_0xf7da('0x2e')][_0xf7da('0x2f')]};});_0xc1591d[_0xf7da('0x30')]=_[_0xf7da('0x2a')](_0x5006c8,'name');_0xc1591d[_0xf7da('0x31')]=_['keys'](_0xd26618['query']);_0xc1591d[_0xf7da('0x32')]=_[_0xf7da('0x33')](_0xc1591d['model'],_0xc1591d['query']);_0x229792[_0xf7da('0x34')]=_['intersection'](_0xc1591d[_0xf7da('0x30')],qs[_0xf7da('0x35')](_0xd26618['query'][_0xf7da('0x35')]));_0x229792[_0xf7da('0x34')]=_0x229792['attributes'][_0xf7da('0x36')]?_0x229792[_0xf7da('0x34')]:_0xc1591d[_0xf7da('0x30')];if(!_0xd26618['query'][_0xf7da('0x37')]('nolimit')){_0x229792[_0xf7da('0x1c')]=qs[_0xf7da('0x1c')](_0xd26618['query'][_0xf7da('0x1c')]);_0x229792[_0xf7da('0x38')]=qs[_0xf7da('0x38')](_0xd26618['query'][_0xf7da('0x38')]);}_0x229792[_0xf7da('0x39')]=qs[_0xf7da('0x3a')](_0xd26618[_0xf7da('0x31')][_0xf7da('0x3a')]);_0x229792[_0xf7da('0x3b')]=qs['filters'](_[_0xf7da('0x3c')](_0xd26618['query'],_0xc1591d[_0xf7da('0x32')]),_0x5006c8);if(_0xd26618['query']['filter']){_0x229792[_0xf7da('0x3b')]=_['merge'](_0x229792[_0xf7da('0x3b')],{'$or':_[_0xf7da('0x2a')](_0x5006c8,function(_0x2518eb){if(_0x2518eb[_0xf7da('0x2e')]!=='VIRTUAL'){var _0x21760c={};_0x21760c[_0x2518eb['name']]={'$like':'%'+_0xd26618[_0xf7da('0x31')][_0xf7da('0x3d')]+'%'};return _0x21760c;}})});}_0x229792=_[_0xf7da('0x3e')]({},_0x229792,_0xd26618[_0xf7da('0x3f')]);var _0x4a411f={'where':_0x229792[_0xf7da('0x3b')]};return db[_0xf7da('0x2b')][_0xf7da('0x1b')](_0x4a411f)[_0xf7da('0x24')](function(_0x362dce){_0x10001a[_0xf7da('0x1b')]=_0x362dce;if(_0xd26618[_0xf7da('0x31')][_0xf7da('0x40')]){_0x229792[_0xf7da('0x41')]=[{'all':!![]}];}return db['MailTransferReport'][_0xf7da('0x42')](_0x229792);})[_0xf7da('0x24')](function(_0x1b4fde){_0x10001a['rows']=_0x1b4fde;return _0x10001a;})['then'](respondWithFilteredResult(_0x2e610d,_0x229792))[_0xf7da('0x43')](handleError(_0x2e610d,null));};exports[_0xf7da('0x44')]=function(_0x58124d,_0x2cdadf){var _0x58f3be={'raw':!![],'where':{'id':_0x58124d[_0xf7da('0x45')]['id']}},_0x5d5e17={};_0x5d5e17[_0xf7da('0x30')]=_[_0xf7da('0x46')](db[_0xf7da('0x2b')][_0xf7da('0x2c')]);_0x5d5e17[_0xf7da('0x31')]=_[_0xf7da('0x46')](_0x58124d['query']);_0x5d5e17[_0xf7da('0x32')]=_[_0xf7da('0x33')](_0x5d5e17[_0xf7da('0x30')],_0x5d5e17['query']);_0x58f3be[_0xf7da('0x34')]=_[_0xf7da('0x33')](_0x5d5e17[_0xf7da('0x30')],qs[_0xf7da('0x35')](_0x58124d[_0xf7da('0x31')]['fields']));_0x58f3be[_0xf7da('0x34')]=_0x58f3be[_0xf7da('0x34')]['length']?_0x58f3be[_0xf7da('0x34')]:_0x5d5e17['model'];if(_0x58124d[_0xf7da('0x31')][_0xf7da('0x40')]){_0x58f3be[_0xf7da('0x41')]=[{'all':!![]}];}_0x58f3be=_[_0xf7da('0x3e')]({},_0x58f3be,_0x58124d[_0xf7da('0x3f')]);return db['MailTransferReport']['find'](_0x58f3be)[_0xf7da('0x24')](handleEntityNotFound(_0x2cdadf,null))[_0xf7da('0x24')](respondWithResult(_0x2cdadf,null))[_0xf7da('0x43')](handleError(_0x2cdadf,null));};exports[_0xf7da('0x47')]=function(_0x52244c,_0x182f28){return db[_0xf7da('0x2b')][_0xf7da('0x47')](_0x52244c[_0xf7da('0x48')],{})[_0xf7da('0x24')](respondWithResult(_0x182f28,0xc9))[_0xf7da('0x43')](handleError(_0x182f28,null));};exports['update']=function(_0x4ca5cf,_0x3c434e){if(_0x4ca5cf[_0xf7da('0x48')]['id']){delete _0x4ca5cf[_0xf7da('0x48')]['id'];}return db[_0xf7da('0x2b')][_0xf7da('0x49')]({'where':{'id':_0x4ca5cf[_0xf7da('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c434e,null))[_0xf7da('0x24')](saveUpdates(_0x4ca5cf['body'],null))['then'](respondWithResult(_0x3c434e,null))[_0xf7da('0x43')](handleError(_0x3c434e,null));};exports['destroy']=function(_0x12689c,_0xe3d039){return db[_0xf7da('0x2b')][_0xf7da('0x49')]({'where':{'id':_0x12689c[_0xf7da('0x45')]['id']}})['then'](handleEntityNotFound(_0xe3d039,null))[_0xf7da('0x24')](removeEntity(_0xe3d039,null))[_0xf7da('0x43')](handleError(_0xe3d039,null));};exports[_0xf7da('0x4a')]=function(_0x233ffd,_0x1690e0){return db[_0xf7da('0x2b')][_0xf7da('0x4a')]()['then'](respondWithResult(_0x1690e0,null))[_0xf7da('0x43')](handleError(_0x1690e0,null));}; \ No newline at end of file +var _0xa95d=['filter','merge','VIRTUAL','count','include','findAll','rows','show','includeAll','options','create','body','catch','update','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','then','error','stack','send','MailTransferReport','rawAttributes','fieldName','type','key','map','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x8ce99,_0xe40fa0){var _0x186ca7=function(_0xa277bc){while(--_0xa277bc){_0x8ce99['push'](_0x8ce99['shift']());}};_0x186ca7(++_0xe40fa0);}(_0xa95d,0x12e));var _0xda95=function(_0x163807,_0x558cfa){_0x163807=_0x163807-0x0;var _0x535b97=_0xa95d[_0x163807];return _0x535b97;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xda95('0x0'));var zipdir=require(_0xda95('0x1'));var jsonpatch=require(_0xda95('0x2'));var rp=require('request-promise');var moment=require(_0xda95('0x3'));var BPromise=require(_0xda95('0x4'));var Mustache=require(_0xda95('0x5'));var util=require('util');var path=require(_0xda95('0x6'));var sox=require(_0xda95('0x7'));var csv=require(_0xda95('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda95('0x9'));var squel=require(_0xda95('0xa'));var crypto=require(_0xda95('0xb'));var jsforce=require(_0xda95('0xc'));var deskjs=require(_0xda95('0xd'));var toCsv=require(_0xda95('0x8'));var querystring=require(_0xda95('0xe'));var Papa=require(_0xda95('0xf'));var Redis=require(_0xda95('0x10'));var authService=require(_0xda95('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda95('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xda95('0x13'));var config=require('../../config/environment');var db=require(_0xda95('0x14'))['db'];function respondWithStatusCode(_0x226c7f,_0x2161c5){_0x2161c5=_0x2161c5||0xcc;return function(_0x3f1706){if(_0x3f1706){return _0x226c7f[_0xda95('0x15')](_0x2161c5);}return _0x226c7f[_0xda95('0x16')](_0x2161c5)[_0xda95('0x17')]();};}function respondWithResult(_0x4af5dc,_0x25f794){_0x25f794=_0x25f794||0xc8;return function(_0x544990){if(_0x544990){return _0x4af5dc[_0xda95('0x16')](_0x25f794)[_0xda95('0x18')](_0x544990);}};}function respondWithFilteredResult(_0x35d3dc,_0x269ace){return function(_0x4aaa9e){if(_0x4aaa9e){var _0xdd0a7c=_0x4aaa9e['count'],_0x4bdf78=_0x269ace[_0xda95('0x19')],_0x4bf97f=_0x269ace[_0xda95('0x19')]+_0x269ace[_0xda95('0x1a')],_0x261719;if(_0x4bf97f>=_0xdd0a7c){_0x4bf97f=_0xdd0a7c;_0x261719=0xc8;}else{_0x261719=0xce;}_0x35d3dc[_0xda95('0x16')](_0x261719);return _0x35d3dc[_0xda95('0x1b')]('Content-Range',_0x4bdf78+'-'+_0x4bf97f+'/'+_0xdd0a7c)[_0xda95('0x18')](_0x4aaa9e);}return null;};}function patchUpdates(_0x5373a2){return function(_0x33af6f){try{jsonpatch['apply'](_0x33af6f,_0x5373a2,!![]);}catch(_0x2506af){return BPromise[_0xda95('0x1c')](_0x2506af);}return _0x33af6f[_0xda95('0x1d')]();};}function saveUpdates(_0x40f5bd,_0x1d11c8){return function(_0x17ade6){if(_0x17ade6){return _0x17ade6['update'](_0x40f5bd)[_0xda95('0x1e')](function(_0x3050d8){return _0x3050d8;});}return null;};}function removeEntity(_0x5f2e91,_0x4b15cf){return function(_0x1cf5e0){if(_0x1cf5e0){return _0x1cf5e0['destroy']()[_0xda95('0x1e')](function(){_0x5f2e91[_0xda95('0x16')](0xcc)[_0xda95('0x17')]();});}};}function handleEntityNotFound(_0x57e164,_0x275519){return function(_0x5decee){if(!_0x5decee){_0x57e164[_0xda95('0x15')](0x194);}return _0x5decee;};}function handleError(_0x3ffc12,_0x4fd009){_0x4fd009=_0x4fd009||0x1f4;return function(_0x10ac8f){logger[_0xda95('0x1f')](_0x10ac8f[_0xda95('0x20')]);if(_0x10ac8f['name']){delete _0x10ac8f['name'];}_0x3ffc12[_0xda95('0x16')](_0x4fd009)[_0xda95('0x21')](_0x10ac8f);};}exports['index']=function(_0x24bc17,_0x163132){var _0x272708={},_0x591f30={},_0x1865f1={'count':0x0,'rows':[]};var _0xfe26b3=_['map'](db[_0xda95('0x22')][_0xda95('0x23')],function(_0x1715b6){return{'name':_0x1715b6[_0xda95('0x24')],'type':_0x1715b6[_0xda95('0x25')][_0xda95('0x26')]};});_0x591f30['model']=_[_0xda95('0x27')](_0xfe26b3,_0xda95('0x28'));_0x591f30['query']=_[_0xda95('0x29')](_0x24bc17[_0xda95('0x2a')]);_0x591f30[_0xda95('0x2b')]=_[_0xda95('0x2c')](_0x591f30[_0xda95('0x2d')],_0x591f30['query']);_0x272708[_0xda95('0x2e')]=_[_0xda95('0x2c')](_0x591f30['model'],qs[_0xda95('0x2f')](_0x24bc17[_0xda95('0x2a')]['fields']));_0x272708[_0xda95('0x2e')]=_0x272708[_0xda95('0x2e')][_0xda95('0x30')]?_0x272708[_0xda95('0x2e')]:_0x591f30[_0xda95('0x2d')];if(!_0x24bc17[_0xda95('0x2a')][_0xda95('0x31')](_0xda95('0x32'))){_0x272708[_0xda95('0x1a')]=qs[_0xda95('0x1a')](_0x24bc17[_0xda95('0x2a')][_0xda95('0x1a')]);_0x272708[_0xda95('0x19')]=qs[_0xda95('0x19')](_0x24bc17[_0xda95('0x2a')][_0xda95('0x19')]);}_0x272708['order']=qs[_0xda95('0x33')](_0x24bc17['query']['sort']);_0x272708[_0xda95('0x34')]=qs[_0xda95('0x2b')](_['pick'](_0x24bc17[_0xda95('0x2a')],_0x591f30[_0xda95('0x2b')]),_0xfe26b3);if(_0x24bc17[_0xda95('0x2a')][_0xda95('0x35')]){_0x272708[_0xda95('0x34')]=_[_0xda95('0x36')](_0x272708['where'],{'$or':_['map'](_0xfe26b3,function(_0x93735c){if(_0x93735c[_0xda95('0x25')]!==_0xda95('0x37')){var _0xeef388={};_0xeef388[_0x93735c[_0xda95('0x28')]]={'$like':'%'+_0x24bc17['query']['filter']+'%'};return _0xeef388;}})});}_0x272708=_['merge']({},_0x272708,_0x24bc17['options']);var _0x5d5618={'where':_0x272708[_0xda95('0x34')]};return db[_0xda95('0x22')]['count'](_0x5d5618)[_0xda95('0x1e')](function(_0x49d949){_0x1865f1[_0xda95('0x38')]=_0x49d949;if(_0x24bc17['query']['includeAll']){_0x272708[_0xda95('0x39')]=[{'all':!![]}];}return db[_0xda95('0x22')][_0xda95('0x3a')](_0x272708);})['then'](function(_0x579beb){_0x1865f1[_0xda95('0x3b')]=_0x579beb;return _0x1865f1;})['then'](respondWithFilteredResult(_0x163132,_0x272708))['catch'](handleError(_0x163132,null));};exports[_0xda95('0x3c')]=function(_0x34d93c,_0x865613){var _0x22c1ed={'raw':!![],'where':{'id':_0x34d93c['params']['id']}},_0x3b2bd7={};_0x3b2bd7[_0xda95('0x2d')]=_[_0xda95('0x29')](db[_0xda95('0x22')][_0xda95('0x23')]);_0x3b2bd7[_0xda95('0x2a')]=_[_0xda95('0x29')](_0x34d93c['query']);_0x3b2bd7[_0xda95('0x2b')]=_['intersection'](_0x3b2bd7[_0xda95('0x2d')],_0x3b2bd7[_0xda95('0x2a')]);_0x22c1ed[_0xda95('0x2e')]=_[_0xda95('0x2c')](_0x3b2bd7[_0xda95('0x2d')],qs[_0xda95('0x2f')](_0x34d93c[_0xda95('0x2a')]['fields']));_0x22c1ed[_0xda95('0x2e')]=_0x22c1ed[_0xda95('0x2e')][_0xda95('0x30')]?_0x22c1ed[_0xda95('0x2e')]:_0x3b2bd7[_0xda95('0x2d')];if(_0x34d93c[_0xda95('0x2a')][_0xda95('0x3d')]){_0x22c1ed[_0xda95('0x39')]=[{'all':!![]}];}_0x22c1ed=_['merge']({},_0x22c1ed,_0x34d93c[_0xda95('0x3e')]);return db[_0xda95('0x22')]['find'](_0x22c1ed)[_0xda95('0x1e')](handleEntityNotFound(_0x865613,null))[_0xda95('0x1e')](respondWithResult(_0x865613,null))['catch'](handleError(_0x865613,null));};exports[_0xda95('0x3f')]=function(_0x21c40e,_0x63948b){return db[_0xda95('0x22')][_0xda95('0x3f')](_0x21c40e[_0xda95('0x40')],{})['then'](respondWithResult(_0x63948b,0xc9))[_0xda95('0x41')](handleError(_0x63948b,null));};exports[_0xda95('0x42')]=function(_0xc371b1,_0x4b7a38){if(_0xc371b1[_0xda95('0x40')]['id']){delete _0xc371b1[_0xda95('0x40')]['id'];}return db[_0xda95('0x22')][_0xda95('0x43')]({'where':{'id':_0xc371b1[_0xda95('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b7a38,null))[_0xda95('0x1e')](saveUpdates(_0xc371b1[_0xda95('0x40')],null))['then'](respondWithResult(_0x4b7a38,null))['catch'](handleError(_0x4b7a38,null));};exports[_0xda95('0x45')]=function(_0x33b663,_0x5723d8){return db[_0xda95('0x22')]['find']({'where':{'id':_0x33b663[_0xda95('0x44')]['id']}})['then'](handleEntityNotFound(_0x5723d8,null))['then'](removeEntity(_0x5723d8,null))['catch'](handleError(_0x5723d8,null));};exports[_0xda95('0x46')]=function(_0x25c705,_0x55746e){return db[_0xda95('0x22')][_0xda95('0x46')]()[_0xda95('0x1e')](respondWithResult(_0x55746e,null))['catch'](handleError(_0x55746e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 6130093..6c87bd2 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 _0x67c6=['../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','request-promise','path'];(function(_0x2dbd8a,_0x14e373){var _0x53d100=function(_0x5b084b){while(--_0x5b084b){_0x2dbd8a['push'](_0x2dbd8a['shift']());}};_0x53d100(++_0x14e373);}(_0x67c6,0x1bd));var _0x667c=function(_0x38c7fb,_0x52c5d9){_0x38c7fb=_0x38c7fb-0x0;var _0x5b7f16=_0x67c6[_0x38c7fb];return _0x5b7f16;};'use strict';var _=require(_0x667c('0x0'));var util=require(_0x667c('0x1'));var logger=require('../../config/logger')(_0x667c('0x2'));var moment=require(_0x667c('0x3'));var BPromise=require('bluebird');var rp=require(_0x667c('0x4'));var fs=require('fs');var path=require(_0x667c('0x5'));var rimraf=require('rimraf');var config=require(_0x667c('0x6'));var attributes=require(_0x667c('0x7'));module['exports']=function(_0x5598e8,_0xaaef81){return _0x5598e8['define'](_0x667c('0x8'),attributes,{'tableName':_0x667c('0x9'),'paranoid':![],'indexes':[{'name':_0x667c('0xa'),'fields':[_0x667c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce94=['bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x407a0d,_0x27b5e7){var _0x8b822b=function(_0x215550){while(--_0x215550){_0x407a0d['push'](_0x407a0d['shift']());}};_0x8b822b(++_0x27b5e7);}(_0xce94,0x19f));var _0x4ce9=function(_0x33902d,_0xa9b9d){_0x33902d=_0x33902d-0x0;var _0x14121e=_0xce94[_0x33902d];return _0x14121e;};'use strict';var _=require(_0x4ce9('0x0'));var util=require(_0x4ce9('0x1'));var logger=require(_0x4ce9('0x2'))(_0x4ce9('0x3'));var moment=require(_0x4ce9('0x4'));var BPromise=require(_0x4ce9('0x5'));var rp=require(_0x4ce9('0x6'));var fs=require('fs');var path=require(_0x4ce9('0x7'));var rimraf=require(_0x4ce9('0x8'));var config=require(_0x4ce9('0x9'));var attributes=require(_0x4ce9('0xa'));module['exports']=function(_0x3aa6eb,_0x5515c9){return _0x3aa6eb['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x4ce9('0xb'),'fields':[_0x4ce9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 18371bd..9d32f22 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 _0x78b8=['MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4544b2,_0x3202b6){var _0x347ac4=function(_0x1d6d17){while(--_0x1d6d17){_0x4544b2['push'](_0x4544b2['shift']());}};_0x347ac4(++_0x3202b6);}(_0x78b8,0xcc));var _0x878b=function(_0x54fe0f,_0x52bc9d){_0x54fe0f=_0x54fe0f-0x0;var _0x1647b9=_0x78b8[_0x54fe0f];return _0x1647b9;};'use strict';var _=require(_0x878b('0x0'));var util=require(_0x878b('0x1'));var moment=require(_0x878b('0x2'));var BPromise=require(_0x878b('0x3'));var rs=require(_0x878b('0x4'));var fs=require('fs');var Redis=require(_0x878b('0x5'));var db=require(_0x878b('0x6'))['db'];var utils=require(_0x878b('0x7'));var logger=require(_0x878b('0x8'))(_0x878b('0x9'));var config=require(_0x878b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x878b('0xb')][_0x878b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x229853,_0x429efe,_0x2b2707){return new BPromise(function(_0x15dfb5,_0x344980){return client[_0x878b('0xd')](_0x229853,_0x2b2707)[_0x878b('0xe')](function(_0x25cf2b){logger[_0x878b('0xf')](_0x878b('0x10'),_0x429efe,_0x878b('0x11'));logger['debug'](_0x878b('0x12'),_0x429efe,'request\x20sent',JSON['stringify'](_0x25cf2b));if(_0x25cf2b[_0x878b('0x13')]){if(_0x25cf2b[_0x878b('0x13')]['code']===0x1f4){logger[_0x878b('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x429efe,_0x25cf2b[_0x878b('0x13')]['message']);return _0x344980(_0x25cf2b['error'][_0x878b('0x14')]);}logger[_0x878b('0x13')](_0x878b('0x10'),_0x429efe,_0x25cf2b['error']['message']);return _0x15dfb5(_0x25cf2b[_0x878b('0x13')][_0x878b('0x14')]);}else{logger['info'](_0x878b('0x10'),_0x429efe,_0x878b('0x11'));_0x15dfb5(_0x25cf2b[_0x878b('0x15')]['message']);}})['catch'](function(_0x11c0ab){logger['error'](_0x878b('0x10'),_0x429efe,_0x11c0ab);_0x344980(_0x11c0ab);});});} \ No newline at end of file +var _0x5d41=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x5d41,0xf4));var _0x15d4=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x5d41[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x15d4('0x0'));var util=require(_0x15d4('0x1'));var moment=require(_0x15d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x15d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15d4('0x4'))['db'];var utils=require(_0x15d4('0x5'));var logger=require(_0x15d4('0x6'))(_0x15d4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x15d4('0x8')][_0x15d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3faafc,_0x111aa1,_0x4166c2){return new BPromise(function(_0x1f806d,_0xc22083){return client['request'](_0x3faafc,_0x4166c2)['then'](function(_0x8ae96b){logger['info'](_0x15d4('0xa'),_0x111aa1,_0x15d4('0xb'));logger[_0x15d4('0xc')](_0x15d4('0xd'),_0x111aa1,'request\x20sent',JSON[_0x15d4('0xe')](_0x8ae96b));if(_0x8ae96b[_0x15d4('0xf')]){if(_0x8ae96b[_0x15d4('0xf')][_0x15d4('0x10')]===0x1f4){logger['error'](_0x15d4('0xa'),_0x111aa1,_0x8ae96b['error']['message']);return _0xc22083(_0x8ae96b[_0x15d4('0xf')][_0x15d4('0x11')]);}logger[_0x15d4('0xf')](_0x15d4('0xa'),_0x111aa1,_0x8ae96b[_0x15d4('0xf')][_0x15d4('0x11')]);return _0x1f806d(_0x8ae96b['error'][_0x15d4('0x11')]);}else{logger['info'](_0x15d4('0xa'),_0x111aa1,_0x15d4('0xb'));_0x1f806d(_0x8ae96b[_0x15d4('0x12')]['message']);}})[_0x15d4('0x13')](function(_0x39bcec){logger[_0x15d4('0xf')](_0x15d4('0xa'),_0x111aa1,_0x39bcec);_0xc22083(_0x39bcec);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 8e92690..8adf820 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 _0x5105=['/:id','show','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','index','/describe','isAuthenticated'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x5105,0x97));var _0x5510=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5105[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x5510('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5510('0x1'));var express=require(_0x5510('0x2'));var router=express[_0x5510('0x3')]();var auth=require(_0x5510('0x4'));var interaction=require(_0x5510('0x5'));var config=require('../../config/environment');var controller=require(_0x5510('0x6'));router[_0x5510('0x7')]('/',auth['isAuthenticated'](),controller[_0x5510('0x8')]);router[_0x5510('0x7')](_0x5510('0x9'),auth[_0x5510('0xa')](),controller['describe']);router[_0x5510('0x7')](_0x5510('0xb'),auth[_0x5510('0xa')](),controller[_0x5510('0xc')]);router['post']('/',auth[_0x5510('0xa')](),controller[_0x5510('0xd')]);router[_0x5510('0xe')]('/:id',auth[_0x5510('0xa')](),controller[_0x5510('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5510('0x10')]);module[_0x5510('0x11')]=router; \ No newline at end of file +var _0xe1bc=['create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x51f629,_0x308fac){var _0x538b08=function(_0x53facf){while(--_0x53facf){_0x51f629['push'](_0x51f629['shift']());}};_0x538b08(++_0x308fac);}(_0xe1bc,0xf4));var _0xce1b=function(_0x14b1cd,_0x4fb930){_0x14b1cd=_0x14b1cd-0x0;var _0x4aaf98=_0xe1bc[_0x14b1cd];return _0x4aaf98;};'use strict';var multer=require('multer');var util=require(_0xce1b('0x0'));var path=require(_0xce1b('0x1'));var timeout=require(_0xce1b('0x2'));var express=require(_0xce1b('0x3'));var router=express[_0xce1b('0x4')]();var auth=require(_0xce1b('0x5'));var interaction=require(_0xce1b('0x6'));var config=require(_0xce1b('0x7'));var controller=require(_0xce1b('0x8'));router[_0xce1b('0x9')]('/',auth[_0xce1b('0xa')](),controller[_0xce1b('0xb')]);router[_0xce1b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xce1b('0xc')]);router[_0xce1b('0x9')](_0xce1b('0xd'),auth['isAuthenticated'](),controller[_0xce1b('0xe')]);router[_0xce1b('0xf')]('/',auth[_0xce1b('0xa')](),controller[_0xce1b('0x10')]);router[_0xce1b('0x11')](_0xce1b('0xd'),auth[_0xce1b('0xa')](),controller[_0xce1b('0x12')]);router[_0xce1b('0x13')](_0xce1b('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0d4464a..58ba40b 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 _0xace6=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','setDataValue','duration','talk:[queue]','sequelize','moment','exports'];(function(_0x3878b9,_0x781c48){var _0x16f76c=function(_0x505e98){while(--_0x505e98){_0x3878b9['push'](_0x3878b9['shift']());}};_0x16f76c(++_0x781c48);}(_0xace6,0x17d));var _0x6ace=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xace6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6ace('0x0'));var moment=require(_0x6ace('0x1'));module[_0x6ace('0x2')]={'channel':{'type':Sequelize[_0x6ace('0x3')]},'membername':{'type':Sequelize[_0x6ace('0x3')]},'interface':{'type':Sequelize[_0x6ace('0x3')]},'type':{'type':Sequelize[_0x6ace('0x3')],'defaultValue':_0x6ace('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x6ace('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6ace('0x6')],'set':function(_0x23c215){var _0x5b9031=moment(_0x23c215);var _0x232419=moment(this[_0x6ace('0x7')](_0x6ace('0x8')));var _0xcf851c=_0x5b9031['diff'](_0x232419,'seconds');this[_0x6ace('0x9')]('exitAt',_0x23c215);this['setDataValue'](_0x6ace('0xa'),_0xcf851c||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x6ace('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x6ace('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x6ace('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x6ace('0x3')],'comment':_0x6ace('0xb')},'role':{'type':Sequelize[_0x6ace('0x3')]},'internal':{'type':Sequelize[_0x6ace('0x5')]},'uniqueid':{'type':Sequelize[_0x6ace('0x3')]}}; \ No newline at end of file +var _0x0b0d=['enterAt','diff','seconds','setDataValue','talk:[start]','talk:[destination]','talk:[dial\x20string]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue'];(function(_0x5691f2,_0x346508){var _0x5a5975=function(_0x494b3a){while(--_0x494b3a){_0x5691f2['push'](_0x5691f2['shift']());}};_0x5a5975(++_0x346508);}(_0x0b0d,0x108));var _0xd0b0=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x0b0d[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0xd0b0('0x0'));var moment=require(_0xd0b0('0x1'));module[_0xd0b0('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd0b0('0x3')]},'interface':{'type':Sequelize[_0xd0b0('0x3')]},'type':{'type':Sequelize[_0xd0b0('0x3')],'defaultValue':_0xd0b0('0x4'),'comment':_0xd0b0('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xd0b0('0x6')]},'exitAt':{'type':Sequelize[_0xd0b0('0x6')],'set':function(_0x20d127){var _0x589c17=moment(_0x20d127);var _0x17a37a=moment(this[_0xd0b0('0x7')](_0xd0b0('0x8')));var _0x215bb2=_0x589c17[_0xd0b0('0x9')](_0x17a37a,_0xd0b0('0xa'));this[_0xd0b0('0xb')]('exitAt',_0x20d127);this[_0xd0b0('0xb')]('duration',_0x215bb2||null);}},'data1':{'type':Sequelize[_0xd0b0('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xd0b0('0xc')},'data3':{'type':Sequelize[_0xd0b0('0x3')],'comment':_0xd0b0('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0xd0b0('0xe')},'data5':{'type':Sequelize[_0xd0b0('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xd0b0('0x3')]},'internal':{'type':Sequelize[_0xd0b0('0xf')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 694603f..d50c31f 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 _0x923c=['sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','error','stack','name','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x1d8b60,_0xb6c036){var _0x108a1c=function(_0x2cb94a){while(--_0x2cb94a){_0x1d8b60['push'](_0x1d8b60['shift']());}};_0x108a1c(++_0xb6c036);}(_0x923c,0xe9));var _0xc923=function(_0x5d891e,_0xbec511){_0x5d891e=_0x5d891e-0x0;var _0x40d481=_0x923c[_0x5d891e];return _0x40d481;};'use strict';var pdf=require(_0xc923('0x0'));var emlformat=require(_0xc923('0x1'));var rimraf=require(_0xc923('0x2'));var zipdir=require(_0xc923('0x3'));var jsonpatch=require(_0xc923('0x4'));var rp=require('request-promise');var moment=require(_0xc923('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc923('0x6'));var path=require(_0xc923('0x7'));var sox=require(_0xc923('0x8'));var csv=require('to-csv');var ejs=require(_0xc923('0x9'));var fs=require('fs');var _=require(_0xc923('0xa'));var squel=require(_0xc923('0xb'));var crypto=require(_0xc923('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc923('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc923('0xe'));var Redis=require(_0xc923('0xf'));var authService=require(_0xc923('0x10'));var qs=require(_0xc923('0x11'));var as=require(_0xc923('0x12'));var hardwareService=require(_0xc923('0x13'));var logger=require(_0xc923('0x14'))(_0xc923('0x15'));var utils=require(_0xc923('0x16'));var config=require('../../config/environment');var db=require(_0xc923('0x17'))['db'];function respondWithStatusCode(_0x2786f2,_0x382ffa){_0x382ffa=_0x382ffa||0xcc;return function(_0x4d7cd0){if(_0x4d7cd0){return _0x2786f2[_0xc923('0x18')](_0x382ffa);}return _0x2786f2[_0xc923('0x19')](_0x382ffa)[_0xc923('0x1a')]();};}function respondWithResult(_0x5516ae,_0x4d41b9){_0x4d41b9=_0x4d41b9||0xc8;return function(_0x20dcbf){if(_0x20dcbf){return _0x5516ae['status'](_0x4d41b9)[_0xc923('0x1b')](_0x20dcbf);}};}function respondWithFilteredResult(_0x398eaf,_0xb73349){return function(_0x426026){if(_0x426026){var _0x155fac=_0x426026[_0xc923('0x1c')],_0xa5778a=_0xb73349[_0xc923('0x1d')],_0x2493f4=_0xb73349['offset']+_0xb73349[_0xc923('0x1e')],_0x2b8f18;if(_0x2493f4>=_0x155fac){_0x2493f4=_0x155fac;_0x2b8f18=0xc8;}else{_0x2b8f18=0xce;}_0x398eaf['status'](_0x2b8f18);return _0x398eaf[_0xc923('0x1f')]('Content-Range',_0xa5778a+'-'+_0x2493f4+'/'+_0x155fac)['json'](_0x426026);}return null;};}function patchUpdates(_0x24d796){return function(_0x2043fa){try{jsonpatch['apply'](_0x2043fa,_0x24d796,!![]);}catch(_0x25c0d8){return BPromise['reject'](_0x25c0d8);}return _0x2043fa[_0xc923('0x20')]();};}function saveUpdates(_0x43b828,_0x2dce23){return function(_0x14bb55){if(_0x14bb55){return _0x14bb55[_0xc923('0x21')](_0x43b828)['then'](function(_0x4a9bc2){return _0x4a9bc2;});}return null;};}function removeEntity(_0x1a4e16,_0x43dab5){return function(_0x21fe36){if(_0x21fe36){return _0x21fe36['destroy']()[_0xc923('0x22')](function(){_0x1a4e16[_0xc923('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x352ef4,_0x1de344){return function(_0x51cca1){if(!_0x51cca1){_0x352ef4[_0xc923('0x18')](0x194);}return _0x51cca1;};}function handleError(_0x2d4515,_0x434632){_0x434632=_0x434632||0x1f4;return function(_0x358629){logger[_0xc923('0x23')](_0x358629[_0xc923('0x24')]);if(_0x358629[_0xc923('0x25')]){delete _0x358629[_0xc923('0x25')];}_0x2d4515['status'](_0x434632)['send'](_0x358629);};}exports[_0xc923('0x26')]=function(_0x13627f,_0x1e09ec){var _0x3eb1f0={},_0x5eadc5={},_0x34aede={'count':0x0,'rows':[]};var _0x52c5f1=_[_0xc923('0x27')](db[_0xc923('0x28')][_0xc923('0x29')],function(_0x3fa3ca){return{'name':_0x3fa3ca[_0xc923('0x2a')],'type':_0x3fa3ca[_0xc923('0x2b')][_0xc923('0x2c')]};});_0x5eadc5[_0xc923('0x2d')]=_[_0xc923('0x27')](_0x52c5f1,_0xc923('0x25'));_0x5eadc5['query']=_[_0xc923('0x2e')](_0x13627f[_0xc923('0x2f')]);_0x5eadc5[_0xc923('0x30')]=_['intersection'](_0x5eadc5[_0xc923('0x2d')],_0x5eadc5['query']);_0x3eb1f0[_0xc923('0x31')]=_[_0xc923('0x32')](_0x5eadc5[_0xc923('0x2d')],qs[_0xc923('0x33')](_0x13627f[_0xc923('0x2f')][_0xc923('0x33')]));_0x3eb1f0[_0xc923('0x31')]=_0x3eb1f0[_0xc923('0x31')][_0xc923('0x34')]?_0x3eb1f0[_0xc923('0x31')]:_0x5eadc5[_0xc923('0x2d')];if(!_0x13627f[_0xc923('0x2f')][_0xc923('0x35')](_0xc923('0x36'))){_0x3eb1f0[_0xc923('0x1e')]=qs[_0xc923('0x1e')](_0x13627f['query'][_0xc923('0x1e')]);_0x3eb1f0['offset']=qs[_0xc923('0x1d')](_0x13627f[_0xc923('0x2f')][_0xc923('0x1d')]);}_0x3eb1f0['order']=qs[_0xc923('0x37')](_0x13627f[_0xc923('0x2f')][_0xc923('0x37')]);_0x3eb1f0['where']=qs['filters'](_[_0xc923('0x38')](_0x13627f[_0xc923('0x2f')],_0x5eadc5['filters']),_0x52c5f1);if(_0x13627f[_0xc923('0x2f')][_0xc923('0x39')]){_0x3eb1f0[_0xc923('0x3a')]=_[_0xc923('0x3b')](_0x3eb1f0[_0xc923('0x3a')],{'$or':_[_0xc923('0x27')](_0x52c5f1,function(_0xbbfbd3){if(_0xbbfbd3[_0xc923('0x2b')]!==_0xc923('0x3c')){var _0x5d4077={};_0x5d4077[_0xbbfbd3[_0xc923('0x25')]]={'$like':'%'+_0x13627f[_0xc923('0x2f')][_0xc923('0x39')]+'%'};return _0x5d4077;}})});}_0x3eb1f0=_[_0xc923('0x3b')]({},_0x3eb1f0,_0x13627f[_0xc923('0x3d')]);var _0x1b2852={'where':_0x3eb1f0[_0xc923('0x3a')]};return db[_0xc923('0x28')][_0xc923('0x1c')](_0x1b2852)['then'](function(_0x5c51dc){_0x34aede[_0xc923('0x1c')]=_0x5c51dc;if(_0x13627f['query'][_0xc923('0x3e')]){_0x3eb1f0[_0xc923('0x3f')]=[{'all':!![]}];}return db[_0xc923('0x28')]['findAll'](_0x3eb1f0);})[_0xc923('0x22')](function(_0x5f26e1){_0x34aede[_0xc923('0x40')]=_0x5f26e1;return _0x34aede;})[_0xc923('0x22')](respondWithFilteredResult(_0x1e09ec,_0x3eb1f0))[_0xc923('0x41')](handleError(_0x1e09ec,null));};exports[_0xc923('0x42')]=function(_0x28203d,_0x4bf585){var _0xca840c={'raw':!![],'where':{'id':_0x28203d[_0xc923('0x43')]['id']}},_0x349d85={};_0x349d85[_0xc923('0x2d')]=_[_0xc923('0x2e')](db[_0xc923('0x28')][_0xc923('0x29')]);_0x349d85[_0xc923('0x2f')]=_[_0xc923('0x2e')](_0x28203d['query']);_0x349d85[_0xc923('0x30')]=_['intersection'](_0x349d85[_0xc923('0x2d')],_0x349d85[_0xc923('0x2f')]);_0xca840c[_0xc923('0x31')]=_[_0xc923('0x32')](_0x349d85[_0xc923('0x2d')],qs[_0xc923('0x33')](_0x28203d[_0xc923('0x2f')][_0xc923('0x33')]));_0xca840c[_0xc923('0x31')]=_0xca840c[_0xc923('0x31')][_0xc923('0x34')]?_0xca840c[_0xc923('0x31')]:_0x349d85['model'];if(_0x28203d[_0xc923('0x2f')][_0xc923('0x3e')]){_0xca840c['include']=[{'all':!![]}];}_0xca840c=_[_0xc923('0x3b')]({},_0xca840c,_0x28203d[_0xc923('0x3d')]);return db[_0xc923('0x28')][_0xc923('0x44')](_0xca840c)[_0xc923('0x22')](handleEntityNotFound(_0x4bf585,null))[_0xc923('0x22')](respondWithResult(_0x4bf585,null))[_0xc923('0x41')](handleError(_0x4bf585,null));};exports['create']=function(_0x207539,_0x185e8c){return db['MemberReport'][_0xc923('0x45')](_0x207539[_0xc923('0x46')],{})[_0xc923('0x22')](respondWithResult(_0x185e8c,0xc9))[_0xc923('0x41')](handleError(_0x185e8c,null));};exports[_0xc923('0x21')]=function(_0x345c09,_0x1a35b0){if(_0x345c09[_0xc923('0x46')]['id']){delete _0x345c09[_0xc923('0x46')]['id'];}return db['MemberReport']['find']({'where':{'id':_0x345c09[_0xc923('0x43')]['id']}})[_0xc923('0x22')](handleEntityNotFound(_0x1a35b0,null))[_0xc923('0x22')](saveUpdates(_0x345c09['body'],null))[_0xc923('0x22')](respondWithResult(_0x1a35b0,null))[_0xc923('0x41')](handleError(_0x1a35b0,null));};exports['destroy']=function(_0x4bbf4b,_0x5a2629){return db[_0xc923('0x28')]['find']({'where':{'id':_0x4bbf4b[_0xc923('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a2629,null))[_0xc923('0x22')](removeEntity(_0x5a2629,null))['catch'](handleError(_0x5a2629,null));};exports['describe']=function(_0x1c5e87,_0x2c815b){return db['MemberReport'][_0xc923('0x47')]()[_0xc923('0x22')](respondWithResult(_0x2c815b,null))[_0xc923('0x41')](handleError(_0x2c815b,null));}; \ No newline at end of file +var _0x7f8c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5badd5,_0x37bdf1){var _0x326348=function(_0x38f3ba){while(--_0x38f3ba){_0x5badd5['push'](_0x5badd5['shift']());}};_0x326348(++_0x37bdf1);}(_0x7f8c,0xcf));var _0xc7f8=function(_0x5e6860,_0x2f654a){_0x5e6860=_0x5e6860-0x0;var _0x1ca768=_0x7f8c[_0x5e6860];return _0x1ca768;};'use strict';var pdf=require(_0xc7f8('0x0'));var emlformat=require(_0xc7f8('0x1'));var rimraf=require(_0xc7f8('0x2'));var zipdir=require(_0xc7f8('0x3'));var jsonpatch=require(_0xc7f8('0x4'));var rp=require(_0xc7f8('0x5'));var moment=require(_0xc7f8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc7f8('0x7'));var util=require(_0xc7f8('0x8'));var path=require(_0xc7f8('0x9'));var sox=require(_0xc7f8('0xa'));var csv=require(_0xc7f8('0xb'));var ejs=require(_0xc7f8('0xc'));var fs=require('fs');var _=require(_0xc7f8('0xd'));var squel=require(_0xc7f8('0xe'));var crypto=require(_0xc7f8('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc7f8('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc7f8('0x11'));var Papa=require('papaparse');var Redis=require(_0xc7f8('0x12'));var authService=require(_0xc7f8('0x13'));var qs=require(_0xc7f8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7f8('0x15'));var logger=require(_0xc7f8('0x16'))(_0xc7f8('0x17'));var utils=require(_0xc7f8('0x18'));var config=require('../../config/environment');var db=require(_0xc7f8('0x19'))['db'];function respondWithStatusCode(_0x5180f,_0x23c73f){_0x23c73f=_0x23c73f||0xcc;return function(_0x381b0d){if(_0x381b0d){return _0x5180f[_0xc7f8('0x1a')](_0x23c73f);}return _0x5180f[_0xc7f8('0x1b')](_0x23c73f)[_0xc7f8('0x1c')]();};}function respondWithResult(_0x4408a3,_0x1afc71){_0x1afc71=_0x1afc71||0xc8;return function(_0x4be462){if(_0x4be462){return _0x4408a3[_0xc7f8('0x1b')](_0x1afc71)['json'](_0x4be462);}};}function respondWithFilteredResult(_0x2c6554,_0x9f193b){return function(_0x207809){if(_0x207809){var _0x3544ed=_0x207809[_0xc7f8('0x1d')],_0x526bb9=_0x9f193b[_0xc7f8('0x1e')],_0x5ae7b6=_0x9f193b[_0xc7f8('0x1e')]+_0x9f193b[_0xc7f8('0x1f')],_0x20d11;if(_0x5ae7b6>=_0x3544ed){_0x5ae7b6=_0x3544ed;_0x20d11=0xc8;}else{_0x20d11=0xce;}_0x2c6554[_0xc7f8('0x1b')](_0x20d11);return _0x2c6554[_0xc7f8('0x20')](_0xc7f8('0x21'),_0x526bb9+'-'+_0x5ae7b6+'/'+_0x3544ed)['json'](_0x207809);}return null;};}function patchUpdates(_0x253777){return function(_0x523242){try{jsonpatch[_0xc7f8('0x22')](_0x523242,_0x253777,!![]);}catch(_0x2d4b4e){return BPromise['reject'](_0x2d4b4e);}return _0x523242['save']();};}function saveUpdates(_0x384420,_0x38f46e){return function(_0x50ad8c){if(_0x50ad8c){return _0x50ad8c[_0xc7f8('0x23')](_0x384420)[_0xc7f8('0x24')](function(_0x19cf71){return _0x19cf71;});}return null;};}function removeEntity(_0x1c57e7,_0x388c47){return function(_0x2e8e5b){if(_0x2e8e5b){return _0x2e8e5b[_0xc7f8('0x25')]()[_0xc7f8('0x24')](function(){_0x1c57e7[_0xc7f8('0x1b')](0xcc)[_0xc7f8('0x1c')]();});}};}function handleEntityNotFound(_0x24c2a0,_0x2e0da3){return function(_0x17acf9){if(!_0x17acf9){_0x24c2a0['sendStatus'](0x194);}return _0x17acf9;};}function handleError(_0x4e2347,_0x1336c3){_0x1336c3=_0x1336c3||0x1f4;return function(_0x487964){logger[_0xc7f8('0x26')](_0x487964[_0xc7f8('0x27')]);if(_0x487964[_0xc7f8('0x28')]){delete _0x487964[_0xc7f8('0x28')];}_0x4e2347[_0xc7f8('0x1b')](_0x1336c3)[_0xc7f8('0x29')](_0x487964);};}exports[_0xc7f8('0x2a')]=function(_0xbbd49d,_0x211c2c){var _0x1b3675={},_0x1a944c={},_0x3f3ad8={'count':0x0,'rows':[]};var _0x243c01=_[_0xc7f8('0x2b')](db[_0xc7f8('0x2c')][_0xc7f8('0x2d')],function(_0xb884aa){return{'name':_0xb884aa[_0xc7f8('0x2e')],'type':_0xb884aa[_0xc7f8('0x2f')][_0xc7f8('0x30')]};});_0x1a944c[_0xc7f8('0x31')]=_[_0xc7f8('0x2b')](_0x243c01,_0xc7f8('0x28'));_0x1a944c[_0xc7f8('0x32')]=_[_0xc7f8('0x33')](_0xbbd49d[_0xc7f8('0x32')]);_0x1a944c[_0xc7f8('0x34')]=_[_0xc7f8('0x35')](_0x1a944c[_0xc7f8('0x31')],_0x1a944c['query']);_0x1b3675[_0xc7f8('0x36')]=_['intersection'](_0x1a944c[_0xc7f8('0x31')],qs[_0xc7f8('0x37')](_0xbbd49d[_0xc7f8('0x32')][_0xc7f8('0x37')]));_0x1b3675['attributes']=_0x1b3675[_0xc7f8('0x36')]['length']?_0x1b3675['attributes']:_0x1a944c[_0xc7f8('0x31')];if(!_0xbbd49d[_0xc7f8('0x32')][_0xc7f8('0x38')](_0xc7f8('0x39'))){_0x1b3675[_0xc7f8('0x1f')]=qs[_0xc7f8('0x1f')](_0xbbd49d[_0xc7f8('0x32')][_0xc7f8('0x1f')]);_0x1b3675[_0xc7f8('0x1e')]=qs[_0xc7f8('0x1e')](_0xbbd49d[_0xc7f8('0x32')][_0xc7f8('0x1e')]);}_0x1b3675[_0xc7f8('0x3a')]=qs['sort'](_0xbbd49d['query'][_0xc7f8('0x3b')]);_0x1b3675['where']=qs[_0xc7f8('0x34')](_['pick'](_0xbbd49d[_0xc7f8('0x32')],_0x1a944c[_0xc7f8('0x34')]),_0x243c01);if(_0xbbd49d[_0xc7f8('0x32')][_0xc7f8('0x3c')]){_0x1b3675[_0xc7f8('0x3d')]=_[_0xc7f8('0x3e')](_0x1b3675[_0xc7f8('0x3d')],{'$or':_[_0xc7f8('0x2b')](_0x243c01,function(_0xf32114){if(_0xf32114[_0xc7f8('0x2f')]!==_0xc7f8('0x3f')){var _0x319428={};_0x319428[_0xf32114[_0xc7f8('0x28')]]={'$like':'%'+_0xbbd49d[_0xc7f8('0x32')][_0xc7f8('0x3c')]+'%'};return _0x319428;}})});}_0x1b3675=_['merge']({},_0x1b3675,_0xbbd49d[_0xc7f8('0x40')]);var _0x5b850e={'where':_0x1b3675['where']};return db[_0xc7f8('0x2c')][_0xc7f8('0x1d')](_0x5b850e)['then'](function(_0x4bcd90){_0x3f3ad8[_0xc7f8('0x1d')]=_0x4bcd90;if(_0xbbd49d[_0xc7f8('0x32')][_0xc7f8('0x41')]){_0x1b3675[_0xc7f8('0x42')]=[{'all':!![]}];}return db['MemberReport'][_0xc7f8('0x43')](_0x1b3675);})[_0xc7f8('0x24')](function(_0x5cd2d0){_0x3f3ad8[_0xc7f8('0x44')]=_0x5cd2d0;return _0x3f3ad8;})['then'](respondWithFilteredResult(_0x211c2c,_0x1b3675))[_0xc7f8('0x45')](handleError(_0x211c2c,null));};exports[_0xc7f8('0x46')]=function(_0x5d297b,_0x14826e){var _0x2a39c0={'raw':!![],'where':{'id':_0x5d297b[_0xc7f8('0x47')]['id']}},_0x28aeb6={};_0x28aeb6[_0xc7f8('0x31')]=_['keys'](db[_0xc7f8('0x2c')][_0xc7f8('0x2d')]);_0x28aeb6[_0xc7f8('0x32')]=_[_0xc7f8('0x33')](_0x5d297b['query']);_0x28aeb6[_0xc7f8('0x34')]=_[_0xc7f8('0x35')](_0x28aeb6[_0xc7f8('0x31')],_0x28aeb6['query']);_0x2a39c0[_0xc7f8('0x36')]=_[_0xc7f8('0x35')](_0x28aeb6[_0xc7f8('0x31')],qs[_0xc7f8('0x37')](_0x5d297b[_0xc7f8('0x32')]['fields']));_0x2a39c0[_0xc7f8('0x36')]=_0x2a39c0[_0xc7f8('0x36')][_0xc7f8('0x48')]?_0x2a39c0[_0xc7f8('0x36')]:_0x28aeb6[_0xc7f8('0x31')];if(_0x5d297b[_0xc7f8('0x32')]['includeAll']){_0x2a39c0['include']=[{'all':!![]}];}_0x2a39c0=_[_0xc7f8('0x3e')]({},_0x2a39c0,_0x5d297b[_0xc7f8('0x40')]);return db['MemberReport']['find'](_0x2a39c0)[_0xc7f8('0x24')](handleEntityNotFound(_0x14826e,null))[_0xc7f8('0x24')](respondWithResult(_0x14826e,null))[_0xc7f8('0x45')](handleError(_0x14826e,null));};exports[_0xc7f8('0x49')]=function(_0x48b0de,_0x11c8df){return db['MemberReport'][_0xc7f8('0x49')](_0x48b0de[_0xc7f8('0x4a')],{})[_0xc7f8('0x24')](respondWithResult(_0x11c8df,0xc9))[_0xc7f8('0x45')](handleError(_0x11c8df,null));};exports[_0xc7f8('0x23')]=function(_0x4399b2,_0x48f9c9){if(_0x4399b2['body']['id']){delete _0x4399b2[_0xc7f8('0x4a')]['id'];}return db[_0xc7f8('0x2c')][_0xc7f8('0x4b')]({'where':{'id':_0x4399b2['params']['id']}})[_0xc7f8('0x24')](handleEntityNotFound(_0x48f9c9,null))[_0xc7f8('0x24')](saveUpdates(_0x4399b2[_0xc7f8('0x4a')],null))[_0xc7f8('0x24')](respondWithResult(_0x48f9c9,null))[_0xc7f8('0x45')](handleError(_0x48f9c9,null));};exports[_0xc7f8('0x25')]=function(_0xa69d4d,_0x3115e7){return db[_0xc7f8('0x2c')][_0xc7f8('0x4b')]({'where':{'id':_0xa69d4d['params']['id']}})[_0xc7f8('0x24')](handleEntityNotFound(_0x3115e7,null))['then'](removeEntity(_0x3115e7,null))[_0xc7f8('0x45')](handleError(_0x3115e7,null));};exports['describe']=function(_0x343c0c,_0x79fa45){return db[_0xc7f8('0x2c')]['describe']()[_0xc7f8('0x24')](respondWithResult(_0x79fa45,null))['catch'](handleError(_0x79fa45,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3d30e9e..61f1cb8 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 _0x008c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername'];(function(_0x14612f,_0x1c3389){var _0x3c41ad=function(_0x41043c){while(--_0x41043c){_0x14612f['push'](_0x14612f['shift']());}};_0x3c41ad(++_0x1c3389);}(_0x008c,0x188));var _0xc008=function(_0x2b8bbe,_0x37eb6a){_0x2b8bbe=_0x2b8bbe-0x0;var _0x1bb210=_0x008c[_0x2b8bbe];return _0x1bb210;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('MemberReport',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xc008('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d9e=['lodash','api','bluebird','path','rimraf','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface'];(function(_0x42bae6,_0x2c98a2){var _0x1cfb87=function(_0x181225){while(--_0x181225){_0x42bae6['push'](_0x42bae6['shift']());}};_0x1cfb87(++_0x2c98a2);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x3f16e9,_0x310346){_0x3f16e9=_0x3f16e9-0x0;var _0x2c27a1=_0x4d9e[_0x3f16e9];return _0x2c27a1;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));module[_0xe4d9('0x6')]=function(_0x278035,_0x34c2a2){return _0x278035[_0xe4d9('0x7')](_0xe4d9('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xe4d9('0x9'),'fields':[_0xe4d9('0xa'),_0xe4d9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4624d77..d6b98d5 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 _0x0160=['create','body','raw','UpdateMemberReport','MemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','GetMemberReport','findAll','options','where','attributes','limit','include','model','map','stringify','catch','CreateMemberReport'];(function(_0xdb7442,_0x303f6f){var _0x478409=function(_0x3f5140){while(--_0x3f5140){_0xdb7442['push'](_0xdb7442['shift']());}};_0x478409(++_0x303f6f);}(_0x0160,0x117));var _0x0016=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0x0160[_0xf10840];return _0x1fdf7e;};'use strict';var _=require(_0x0016('0x0'));var util=require(_0x0016('0x1'));var moment=require(_0x0016('0x2'));var BPromise=require(_0x0016('0x3'));var rs=require(_0x0016('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0016('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0016('0x6'));var config=require(_0x0016('0x7'));var jayson=require(_0x0016('0x8'));var client=jayson[_0x0016('0x9')][_0x0016('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7046e7,_0x260869,_0x342822){return new BPromise(function(_0x2357b4,_0x6221e6){return client[_0x0016('0xb')](_0x7046e7,_0x342822)[_0x0016('0xc')](function(_0x236d5d){logger[_0x0016('0xd')]('MemberReport,\x20%s,\x20%s',_0x260869,_0x0016('0xe'));logger[_0x0016('0xf')](_0x0016('0x10'),_0x260869,_0x0016('0xe'),JSON['stringify'](_0x236d5d));if(_0x236d5d[_0x0016('0x11')]){if(_0x236d5d[_0x0016('0x11')][_0x0016('0x12')]===0x1f4){logger[_0x0016('0x11')](_0x0016('0x13'),_0x260869,_0x236d5d[_0x0016('0x11')]['message']);return _0x6221e6(_0x236d5d[_0x0016('0x11')][_0x0016('0x14')]);}logger[_0x0016('0x11')](_0x0016('0x13'),_0x260869,_0x236d5d[_0x0016('0x11')]['message']);return _0x2357b4(_0x236d5d[_0x0016('0x11')][_0x0016('0x14')]);}else{logger['info'](_0x0016('0x13'),_0x260869,_0x0016('0xe'));_0x2357b4(_0x236d5d['result']['message']);}})['catch'](function(_0x1d6c6c){logger[_0x0016('0x11')](_0x0016('0x13'),_0x260869,_0x1d6c6c);_0x6221e6(_0x1d6c6c);});});}exports[_0x0016('0x15')]=function(_0x1b616f){var _0xbddcf2=this;return new Promise(function(_0x4f04ce,_0x185a3b){return db['MemberReport'][_0x0016('0x16')]({'raw':_0x1b616f['options']?_0x1b616f['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b616f[_0x0016('0x17')]?_0x1b616f[_0x0016('0x17')][_0x0016('0x18')]||null:null,'attributes':_0x1b616f[_0x0016('0x17')]?_0x1b616f[_0x0016('0x17')][_0x0016('0x19')]||null:null,'limit':_0x1b616f[_0x0016('0x17')]?_0x1b616f['options'][_0x0016('0x1a')]||null:null,'include':_0x1b616f[_0x0016('0x17')]?_0x1b616f[_0x0016('0x17')][_0x0016('0x1b')]?_['map'](_0x1b616f[_0x0016('0x17')][_0x0016('0x1b')],function(_0x1d4fec){return{'model':db[_0x1d4fec[_0x0016('0x1c')]],'as':_0x1d4fec['as'],'attributes':_0x1d4fec['attributes'],'include':_0x1d4fec['include']?_['map'](_0x1d4fec[_0x0016('0x1b')],function(_0x577634){return{'model':db[_0x577634[_0x0016('0x1c')]],'as':_0x577634['as'],'attributes':_0x577634[_0x0016('0x19')],'include':_0x577634[_0x0016('0x1b')]?_[_0x0016('0x1d')](_0x577634[_0x0016('0x1b')],function(_0x656ae7){return{'model':db[_0x656ae7[_0x0016('0x1c')]],'as':_0x656ae7['as'],'attributes':_0x656ae7[_0x0016('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0016('0xc')](function(_0x5980bf){logger['info'](_0x0016('0x15'),_0x1b616f);logger[_0x0016('0xf')](_0x0016('0x15'),_0x1b616f,JSON[_0x0016('0x1e')](_0x5980bf));_0x4f04ce(_0x5980bf);})[_0x0016('0x1f')](function(_0x2534af){logger[_0x0016('0x11')](_0x0016('0x15'),_0x2534af[_0x0016('0x14')],_0x1b616f);_0x185a3b(_0xbddcf2[_0x0016('0x11')](0x1f4,_0x2534af['message']));});});};exports[_0x0016('0x20')]=function(_0x306d1e){var _0x4cdfc4=this;return new Promise(function(_0x30948b,_0x45c2bc){return db['MemberReport'][_0x0016('0x21')](_0x306d1e[_0x0016('0x22')],{'raw':_0x306d1e[_0x0016('0x17')]?_0x306d1e[_0x0016('0x17')][_0x0016('0x23')]===undefined?!![]:![]:!![]})[_0x0016('0xc')](function(_0x5632b5){logger[_0x0016('0xd')]('CreateMemberReport',_0x306d1e);logger[_0x0016('0xf')]('CreateMemberReport',_0x306d1e,JSON[_0x0016('0x1e')](_0x5632b5));_0x30948b(_0x5632b5);})[_0x0016('0x1f')](function(_0x3b2018){logger[_0x0016('0x11')](_0x0016('0x20'),_0x3b2018['message'],_0x306d1e);_0x45c2bc(_0x4cdfc4[_0x0016('0x11')](0x1f4,_0x3b2018[_0x0016('0x14')]));});});};exports[_0x0016('0x24')]=function(_0x16bb23){var _0x36c792=this;return new Promise(function(_0x4a15ba,_0x2809d9){return db[_0x0016('0x25')][_0x0016('0x26')](_0x16bb23[_0x0016('0x22')],{'raw':_0x16bb23[_0x0016('0x17')]?_0x16bb23[_0x0016('0x17')][_0x0016('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16bb23[_0x0016('0x17')]?_0x16bb23[_0x0016('0x17')][_0x0016('0x18')]||null:null,'attributes':_0x16bb23[_0x0016('0x17')]?_0x16bb23['options'][_0x0016('0x19')]||null:null,'limit':_0x16bb23['options']?_0x16bb23[_0x0016('0x17')][_0x0016('0x1a')]||null:null})[_0x0016('0xc')](function(_0x39b46b){logger[_0x0016('0xd')](_0x0016('0x24'),_0x16bb23);logger[_0x0016('0xf')]('UpdateMemberReport',_0x16bb23,JSON[_0x0016('0x1e')](_0x39b46b));_0x4a15ba(_0x39b46b);})[_0x0016('0x1f')](function(_0x59a7f3){logger[_0x0016('0x11')](_0x0016('0x24'),_0x59a7f3[_0x0016('0x14')],_0x16bb23);_0x2809d9(_0x36c792['error'](0x1f4,_0x59a7f3['message']));});});}; \ No newline at end of file +var _0x8032=['include','map','model','debug','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8032,0x1c1));var _0x2803=function(_0x2f31d0,_0x4fce9a){_0x2f31d0=_0x2f31d0-0x0;var _0x1d0256=_0x8032[_0x2f31d0];return _0x1d0256;};'use strict';var _=require(_0x2803('0x0'));var util=require(_0x2803('0x1'));var moment=require(_0x2803('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2803('0x3'));var db=require(_0x2803('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2803('0x5'))(_0x2803('0x6'));var config=require(_0x2803('0x7'));var jayson=require(_0x2803('0x8'));var client=jayson[_0x2803('0x9')][_0x2803('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x156306,_0x1ecf43,_0x6197bc){return new BPromise(function(_0x47ce3a,_0x3ddda8){return client[_0x2803('0xb')](_0x156306,_0x6197bc)[_0x2803('0xc')](function(_0x1da925){logger[_0x2803('0xd')](_0x2803('0xe'),_0x1ecf43,_0x2803('0xf'));logger['debug'](_0x2803('0x10'),_0x1ecf43,_0x2803('0xf'),JSON[_0x2803('0x11')](_0x1da925));if(_0x1da925[_0x2803('0x12')]){if(_0x1da925[_0x2803('0x12')][_0x2803('0x13')]===0x1f4){logger['error'](_0x2803('0xe'),_0x1ecf43,_0x1da925[_0x2803('0x12')]['message']);return _0x3ddda8(_0x1da925[_0x2803('0x12')][_0x2803('0x14')]);}logger[_0x2803('0x12')]('MemberReport,\x20%s,\x20%s',_0x1ecf43,_0x1da925['error'][_0x2803('0x14')]);return _0x47ce3a(_0x1da925['error'][_0x2803('0x14')]);}else{logger[_0x2803('0xd')]('MemberReport,\x20%s,\x20%s',_0x1ecf43,'request\x20sent');_0x47ce3a(_0x1da925[_0x2803('0x15')][_0x2803('0x14')]);}})[_0x2803('0x16')](function(_0x3b31e2){logger['error'](_0x2803('0xe'),_0x1ecf43,_0x3b31e2);_0x3ddda8(_0x3b31e2);});});}exports[_0x2803('0x17')]=function(_0x5d69d6){var _0x5d67bf=this;return new Promise(function(_0x2089a2,_0xb22a38){return db[_0x2803('0x18')][_0x2803('0x19')]({'raw':_0x5d69d6[_0x2803('0x1a')]?_0x5d69d6['options'][_0x2803('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d69d6[_0x2803('0x1a')]?_0x5d69d6['options'][_0x2803('0x1c')]||null:null,'attributes':_0x5d69d6[_0x2803('0x1a')]?_0x5d69d6[_0x2803('0x1a')][_0x2803('0x1d')]||null:null,'limit':_0x5d69d6['options']?_0x5d69d6[_0x2803('0x1a')][_0x2803('0x1e')]||null:null,'include':_0x5d69d6[_0x2803('0x1a')]?_0x5d69d6[_0x2803('0x1a')][_0x2803('0x1f')]?_[_0x2803('0x20')](_0x5d69d6[_0x2803('0x1a')]['include'],function(_0x6f1731){return{'model':db[_0x6f1731[_0x2803('0x21')]],'as':_0x6f1731['as'],'attributes':_0x6f1731[_0x2803('0x1d')],'include':_0x6f1731[_0x2803('0x1f')]?_[_0x2803('0x20')](_0x6f1731['include'],function(_0x2ecb31){return{'model':db[_0x2ecb31[_0x2803('0x21')]],'as':_0x2ecb31['as'],'attributes':_0x2ecb31[_0x2803('0x1d')],'include':_0x2ecb31[_0x2803('0x1f')]?_[_0x2803('0x20')](_0x2ecb31[_0x2803('0x1f')],function(_0x4d4283){return{'model':db[_0x4d4283[_0x2803('0x21')]],'as':_0x4d4283['as'],'attributes':_0x4d4283[_0x2803('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2803('0xc')](function(_0x3ca001){logger[_0x2803('0xd')](_0x2803('0x17'),_0x5d69d6);logger[_0x2803('0x22')](_0x2803('0x17'),_0x5d69d6,JSON[_0x2803('0x11')](_0x3ca001));_0x2089a2(_0x3ca001);})['catch'](function(_0x24d2c4){logger[_0x2803('0x12')](_0x2803('0x17'),_0x24d2c4[_0x2803('0x14')],_0x5d69d6);_0xb22a38(_0x5d67bf[_0x2803('0x12')](0x1f4,_0x24d2c4['message']));});});};exports['CreateMemberReport']=function(_0x3f8db6){var _0x10843b=this;return new Promise(function(_0x1dfcfa,_0x239d2c){return db[_0x2803('0x18')][_0x2803('0x23')](_0x3f8db6[_0x2803('0x24')],{'raw':_0x3f8db6[_0x2803('0x1a')]?_0x3f8db6[_0x2803('0x1a')][_0x2803('0x1b')]===undefined?!![]:![]:!![]})[_0x2803('0xc')](function(_0x45fb19){logger['info']('CreateMemberReport',_0x3f8db6);logger[_0x2803('0x22')](_0x2803('0x25'),_0x3f8db6,JSON[_0x2803('0x11')](_0x45fb19));_0x1dfcfa(_0x45fb19);})[_0x2803('0x16')](function(_0xb69078){logger[_0x2803('0x12')](_0x2803('0x25'),_0xb69078[_0x2803('0x14')],_0x3f8db6);_0x239d2c(_0x10843b[_0x2803('0x12')](0x1f4,_0xb69078[_0x2803('0x14')]));});});};exports[_0x2803('0x26')]=function(_0x50fa2c){var _0x4a1bc8=this;return new Promise(function(_0x14a6f6,_0x515ba4){return db[_0x2803('0x18')][_0x2803('0x27')](_0x50fa2c[_0x2803('0x24')],{'raw':_0x50fa2c[_0x2803('0x1a')]?_0x50fa2c['options'][_0x2803('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50fa2c['options']?_0x50fa2c[_0x2803('0x1a')]['where']||null:null,'attributes':_0x50fa2c['options']?_0x50fa2c['options'][_0x2803('0x1d')]||null:null,'limit':_0x50fa2c[_0x2803('0x1a')]?_0x50fa2c['options'][_0x2803('0x1e')]||null:null})[_0x2803('0xc')](function(_0xfc1e8c){logger['info']('UpdateMemberReport',_0x50fa2c);logger['debug'](_0x2803('0x26'),_0x50fa2c,JSON[_0x2803('0x11')](_0xfc1e8c));_0x14a6f6(_0xfc1e8c);})['catch'](function(_0x576ea9){logger[_0x2803('0x12')](_0x2803('0x26'),_0x576ea9[_0x2803('0x14')],_0x50fa2c);_0x515ba4(_0x4a1bc8[_0x2803('0x12')](0x1f4,_0x576ea9[_0x2803('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0bfed82..5e362e5 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 _0x2e54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','connect-timeout','express'];(function(_0x38323b,_0x5f79df){var _0x2b9af5=function(_0x576caa){while(--_0x576caa){_0x38323b['push'](_0x38323b['shift']());}};_0x2b9af5(++_0x5f79df);}(_0x2e54,0x1dd));var _0x42e5=function(_0x10ae4d,_0x574bc1){_0x10ae4d=_0x10ae4d-0x0;var _0x19c8b1=_0x2e54[_0x10ae4d];return _0x19c8b1;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var auth=require(_0x42e5('0x4'));var interaction=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var controller=require(_0x42e5('0x7'));router['get']('/',controller[_0x42e5('0x8')]);module[_0x42e5('0x9')]=router; \ No newline at end of file +var _0x373d=['Router','../../components/interaction/service','../../config/environment','./migration.controller','exports','multer','path','connect-timeout','express'];(function(_0x3d933d,_0x5d1cd1){var _0x3b0433=function(_0x4fa6c2){while(--_0x4fa6c2){_0x3d933d['push'](_0x3d933d['shift']());}};_0x3b0433(++_0x5d1cd1);}(_0x373d,0x1e2));var _0xd373=function(_0xf93b08,_0x2559d7){_0xf93b08=_0xf93b08-0x0;var _0x12f72e=_0x373d[_0xf93b08];return _0x12f72e;};'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']('/',controller['index']);module[_0xd373('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7661d7e..088bbca 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 _0x9c37=['sequelize','version'];(function(_0x3b4493,_0x106e71){var _0x28fc72=function(_0x1c6ec5){while(--_0x1c6ec5){_0x3b4493['push'](_0x3b4493['shift']());}};_0x28fc72(++_0x106e71);}(_0x9c37,0x166));var _0x79c3=function(_0xb273e5,_0x5d0762){_0xb273e5=_0xb273e5-0x0;var _0x5a18f6=_0x9c37[_0xb273e5];return _0x5a18f6;};'use strict';var Sequelize=require(_0x79c3('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x79c3('0x1')}}; \ No newline at end of file +var _0x81e5=['STRING','version','exports'];(function(_0x1f1359,_0xce4649){var _0x46977e=function(_0x4d6447){while(--_0x4d6447){_0x1f1359['push'](_0x1f1359['shift']());}};_0x46977e(++_0xce4649);}(_0x81e5,0x1a0));var _0x581e=function(_0x495fea,_0x363134){_0x495fea=_0x495fea-0x0;var _0x93773b=_0x81e5[_0x495fea];return _0x93773b;};'use strict';var Sequelize=require('sequelize');module[_0x581e('0x0')]={'version':{'type':Sequelize[_0x581e('0x1')],'unique':_0x581e('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 576d829..47ca3f2 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 _0xa9e0=['save','update','then','destroy','end','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','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'];(function(_0x481299,_0x43b7a1){var _0x380b8a=function(_0x21ca80){while(--_0x21ca80){_0x481299['push'](_0x481299['shift']());}};_0x380b8a(++_0x43b7a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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));}; \ No newline at end of file +var _0x00bb=['html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','error','stack','map','Migration','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff792,_0x2d8ddf){_0x2d8ddf=_0x2d8ddf||0xcc;return function(_0x1be8aa){if(_0x1be8aa){return _0x4ff792[_0xb00b('0x14')](_0x2d8ddf);}return _0x4ff792[_0xb00b('0x15')](_0x2d8ddf)[_0xb00b('0x16')]();};}function respondWithResult(_0x4ada81,_0x218de2){_0x218de2=_0x218de2||0xc8;return function(_0xb0d42e){if(_0xb0d42e){return _0x4ada81['status'](_0x218de2)[_0xb00b('0x17')](_0xb0d42e);}};}function respondWithFilteredResult(_0x1084a6,_0x540b79){return function(_0x5da36b){if(_0x5da36b){var _0x9b471e=_0x5da36b[_0xb00b('0x18')],_0x4dcd45=_0x540b79[_0xb00b('0x19')],_0x51d136=_0x540b79[_0xb00b('0x19')]+_0x540b79['limit'],_0x1f9c78;if(_0x51d136>=_0x9b471e){_0x51d136=_0x9b471e;_0x1f9c78=0xc8;}else{_0x1f9c78=0xce;}_0x1084a6[_0xb00b('0x15')](_0x1f9c78);return _0x1084a6['set'](_0xb00b('0x1a'),_0x4dcd45+'-'+_0x51d136+'/'+_0x9b471e)['json'](_0x5da36b);}return null;};}function patchUpdates(_0x25d7a0){return function(_0x5e8d7b){try{jsonpatch[_0xb00b('0x1b')](_0x5e8d7b,_0x25d7a0,!![]);}catch(_0x3355a3){return BPromise['reject'](_0x3355a3);}return _0x5e8d7b['save']();};}function saveUpdates(_0x2b0da1,_0x4a334b){return function(_0x1344c4){if(_0x1344c4){return _0x1344c4[_0xb00b('0x1c')](_0x2b0da1)[_0xb00b('0x1d')](function(_0x3501af){return _0x3501af;});}return null;};}function removeEntity(_0x56c189,_0x362ee0){return function(_0x4df284){if(_0x4df284){return _0x4df284[_0xb00b('0x1e')]()[_0xb00b('0x1d')](function(){_0x56c189['status'](0xcc)[_0xb00b('0x16')]();});}};}function handleEntityNotFound(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(!_0x3ab3cc){_0x2896d1[_0xb00b('0x14')](0x194);}return _0x3ab3cc;};}function handleError(_0x5568bb,_0x44efe5){_0x44efe5=_0x44efe5||0x1f4;return function(_0x243fdb){logger[_0xb00b('0x1f')](_0x243fdb[_0xb00b('0x20')]);if(_0x243fdb['name']){delete _0x243fdb['name'];}_0x5568bb[_0xb00b('0x15')](_0x44efe5)['send'](_0x243fdb);};}exports['index']=function(_0x4a635e,_0x16ac55){var _0x73b6b0={},_0x2592cf={},_0x3825af={'count':0x0,'rows':[]};var _0x1f14fa=_[_0xb00b('0x21')](db[_0xb00b('0x22')]['rawAttributes'],function(_0x22c22d){return{'name':_0x22c22d['fieldName'],'type':_0x22c22d[_0xb00b('0x23')][_0xb00b('0x24')]};});_0x2592cf[_0xb00b('0x25')]=_['map'](_0x1f14fa,_0xb00b('0x26'));_0x2592cf[_0xb00b('0x27')]=_[_0xb00b('0x28')](_0x4a635e[_0xb00b('0x27')]);_0x2592cf[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_0x2592cf[_0xb00b('0x25')],_0x2592cf[_0xb00b('0x27')]);_0x73b6b0[_0xb00b('0x2b')]=_['intersection'](_0x2592cf[_0xb00b('0x25')],qs[_0xb00b('0x2c')](_0x4a635e['query'][_0xb00b('0x2c')]));_0x73b6b0[_0xb00b('0x2b')]=_0x73b6b0['attributes'][_0xb00b('0x2d')]?_0x73b6b0['attributes']:_0x2592cf[_0xb00b('0x25')];if(!_0x4a635e[_0xb00b('0x27')][_0xb00b('0x2e')](_0xb00b('0x2f'))){_0x73b6b0[_0xb00b('0x30')]=qs[_0xb00b('0x30')](_0x4a635e[_0xb00b('0x27')]['limit']);_0x73b6b0['offset']=qs['offset'](_0x4a635e[_0xb00b('0x27')][_0xb00b('0x19')]);}_0x73b6b0[_0xb00b('0x31')]=qs[_0xb00b('0x32')](_0x4a635e['query'][_0xb00b('0x32')]);_0x73b6b0[_0xb00b('0x33')]=qs[_0xb00b('0x29')](_[_0xb00b('0x34')](_0x4a635e[_0xb00b('0x27')],_0x2592cf[_0xb00b('0x29')]),_0x1f14fa);if(_0x4a635e[_0xb00b('0x27')][_0xb00b('0x35')]){_0x73b6b0['where']=_['merge'](_0x73b6b0[_0xb00b('0x33')],{'$or':_['map'](_0x1f14fa,function(_0x1c8258){if(_0x1c8258[_0xb00b('0x23')]!==_0xb00b('0x36')){var _0x45ca74={};_0x45ca74[_0x1c8258[_0xb00b('0x26')]]={'$like':'%'+_0x4a635e[_0xb00b('0x27')][_0xb00b('0x35')]+'%'};return _0x45ca74;}})});}_0x73b6b0=_['merge']({},_0x73b6b0,_0x4a635e[_0xb00b('0x37')]);var _0x25578e={'where':_0x73b6b0[_0xb00b('0x33')]};return db[_0xb00b('0x22')][_0xb00b('0x18')](_0x25578e)[_0xb00b('0x1d')](function(_0x59fb00){_0x3825af[_0xb00b('0x18')]=_0x59fb00;if(_0x4a635e[_0xb00b('0x27')]['includeAll']){_0x73b6b0[_0xb00b('0x38')]=[{'all':!![]}];}return db[_0xb00b('0x22')][_0xb00b('0x39')](_0x73b6b0);})[_0xb00b('0x1d')](function(_0x2954e8){_0x3825af['rows']=_0x2954e8;return _0x3825af;})[_0xb00b('0x1d')](respondWithFilteredResult(_0x16ac55,_0x73b6b0))[_0xb00b('0x3a')](handleError(_0x16ac55,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 90f96cd..2cd4ea8 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 _0xe600=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','api','moment','bluebird','request-promise','path'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xe600,0x159));var _0x0e60=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe600[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x0e60('0x0'));var logger=require('../../config/logger')(_0x0e60('0x1'));var moment=require(_0x0e60('0x2'));var BPromise=require(_0x0e60('0x3'));var rp=require(_0x0e60('0x4'));var fs=require('fs');var path=require(_0x0e60('0x5'));var rimraf=require(_0x0e60('0x6'));var config=require(_0x0e60('0x7'));var attributes=require(_0x0e60('0x8'));module[_0x0e60('0x9')]=function(_0x2f9c33,_0x4c5738){return _0x2f9c33[_0x0e60('0xa')](_0x0e60('0xb'),attributes,{'tableName':_0x0e60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1edd=['api','moment','bluebird','path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger'];(function(_0x31ce3d,_0x581047){var _0x203d95=function(_0x9b9243){while(--_0x9b9243){_0x31ce3d['push'](_0x31ce3d['shift']());}};_0x203d95(++_0x581047);}(_0x1edd,0xcd));var _0xd1ed=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x1edd[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0xd1ed('0x0'));var util=require(_0xd1ed('0x1'));var logger=require(_0xd1ed('0x2'))(_0xd1ed('0x3'));var moment=require(_0xd1ed('0x4'));var BPromise=require(_0xd1ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1ed('0x6'));var rimraf=require(_0xd1ed('0x7'));var config=require('../../config/environment');var attributes=require(_0xd1ed('0x8'));module[_0xd1ed('0x9')]=function(_0x59458c,_0x58283f){return _0x59458c[_0xd1ed('0xa')](_0xd1ed('0xb'),attributes,{'tableName':_0xd1ed('0xc'),'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 8a9abbb..80450d0 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 _0x87d9=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x362fdf,_0x5bc6a8){var _0x458388=function(_0x8a6fe7){while(--_0x8a6fe7){_0x362fdf['push'](_0x362fdf['shift']());}};_0x458388(++_0x5bc6a8);}(_0x87d9,0x143));var _0x987d=function(_0x25de09,_0x96ed5a){_0x25de09=_0x25de09-0x0;var _0x3eda1e=_0x87d9[_0x25de09];return _0x3eda1e;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var moment=require(_0x987d('0x1'));var BPromise=require(_0x987d('0x2'));var rs=require(_0x987d('0x3'));var fs=require('fs');var Redis=require(_0x987d('0x4'));var db=require(_0x987d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x987d('0x6'))('rpc');var config=require(_0x987d('0x7'));var jayson=require(_0x987d('0x8'));var client=jayson['client'][_0x987d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ee510,_0x5bf349,_0x11d89e){return new BPromise(function(_0x1f97b6,_0x444273){return client[_0x987d('0xa')](_0x3ee510,_0x11d89e)[_0x987d('0xb')](function(_0x325c8b){logger[_0x987d('0xc')]('Migration,\x20%s,\x20%s',_0x5bf349,_0x987d('0xd'));logger[_0x987d('0xe')](_0x987d('0xf'),_0x5bf349,_0x987d('0xd'),JSON['stringify'](_0x325c8b));if(_0x325c8b[_0x987d('0x10')]){if(_0x325c8b[_0x987d('0x10')][_0x987d('0x11')]===0x1f4){logger[_0x987d('0x10')](_0x987d('0x12'),_0x5bf349,_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);return _0x444273(_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);}logger['error']('Migration,\x20%s,\x20%s',_0x5bf349,_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);return _0x1f97b6(_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);}else{logger[_0x987d('0xc')](_0x987d('0x12'),_0x5bf349,_0x987d('0xd'));_0x1f97b6(_0x325c8b[_0x987d('0x14')][_0x987d('0x13')]);}})[_0x987d('0x15')](function(_0x197e46){logger[_0x987d('0x10')](_0x987d('0x12'),_0x5bf349,_0x197e46);_0x444273(_0x197e46);});});} \ No newline at end of file +var _0x7d31=['result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x7d31,0x1e4));var _0x17d3=function(_0xe1063b,_0x49f6a5){_0xe1063b=_0xe1063b-0x0;var _0x3f79b1=_0x7d31[_0xe1063b];return _0x3f79b1;};'use strict';var _=require(_0x17d3('0x0'));var util=require('util');var moment=require(_0x17d3('0x1'));var BPromise=require(_0x17d3('0x2'));var rs=require(_0x17d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17d3('0x4'))['db'];var utils=require(_0x17d3('0x5'));var logger=require(_0x17d3('0x6'))(_0x17d3('0x7'));var config=require(_0x17d3('0x8'));var jayson=require(_0x17d3('0x9'));var client=jayson[_0x17d3('0xa')][_0x17d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14c515,_0x7e7376,_0x59589f){return new BPromise(function(_0x3d7936,_0x359c2e){return client['request'](_0x14c515,_0x59589f)[_0x17d3('0xc')](function(_0x250c4b){logger[_0x17d3('0xd')]('Migration,\x20%s,\x20%s',_0x7e7376,'request\x20sent');logger[_0x17d3('0xe')](_0x17d3('0xf'),_0x7e7376,_0x17d3('0x10'),JSON[_0x17d3('0x11')](_0x250c4b));if(_0x250c4b[_0x17d3('0x12')]){if(_0x250c4b[_0x17d3('0x12')][_0x17d3('0x13')]===0x1f4){logger[_0x17d3('0x12')](_0x17d3('0x14'),_0x7e7376,_0x250c4b[_0x17d3('0x12')][_0x17d3('0x15')]);return _0x359c2e(_0x250c4b[_0x17d3('0x12')][_0x17d3('0x15')]);}logger[_0x17d3('0x12')]('Migration,\x20%s,\x20%s',_0x7e7376,_0x250c4b[_0x17d3('0x12')]['message']);return _0x3d7936(_0x250c4b['error']['message']);}else{logger[_0x17d3('0xd')]('Migration,\x20%s,\x20%s',_0x7e7376,_0x17d3('0x10'));_0x3d7936(_0x250c4b[_0x17d3('0x16')]['message']);}})['catch'](function(_0x5d7f4e){logger[_0x17d3('0x12')](_0x17d3('0x14'),_0x7e7376,_0x5d7f4e);_0x359c2e(_0x5d7f4e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index bcf6a9f..edfd7ba 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 _0xbedb=['destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','update'];(function(_0x55edaf,_0x4e1845){var _0x22d47b=function(_0x5a9cc0){while(--_0x5a9cc0){_0x55edaf['push'](_0x55edaf['shift']());}};_0x22d47b(++_0x4e1845);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbbed('0x0'));var util=require('util');var path=require(_0xbbed('0x1'));var timeout=require(_0xbbed('0x2'));var express=require(_0xbbed('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbbed('0x4'));var config=require(_0xbbed('0x5'));var controller=require(_0xbbed('0x6'));router[_0xbbed('0x7')]('/',auth[_0xbbed('0x8')](),controller[_0xbbed('0x9')]);router[_0xbbed('0x7')](_0xbbed('0xa'),auth[_0xbbed('0x8')](),controller[_0xbbed('0xb')]);router['post']('/',auth[_0xbbed('0x8')](),controller['create']);router['put'](_0xbbed('0xa'),auth[_0xbbed('0x8')](),controller[_0xbbed('0xc')]);router['delete']('/:id',auth[_0xbbed('0x8')](),controller[_0xbbed('0xd')]);module[_0xbbed('0xe')]=router; \ No newline at end of file +var _0xf1c6=['./network.controller','isAuthenticated','index','get','post','create','/:id','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x52c5ac,_0x38272d){var _0x1b8234=function(_0x21ba42){while(--_0x21ba42){_0x52c5ac['push'](_0x52c5ac['shift']());}};_0x1b8234(++_0x38272d);}(_0xf1c6,0x145));var _0x6f1c=function(_0x2a325e,_0xed2333){_0x2a325e=_0x2a325e-0x0;var _0x3e06af=_0xf1c6[_0x2a325e];return _0x3e06af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f1c('0x0'));var timeout=require(_0x6f1c('0x1'));var express=require(_0x6f1c('0x2'));var router=express[_0x6f1c('0x3')]();var auth=require(_0x6f1c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f1c('0x5'));router['get']('/',auth[_0x6f1c('0x6')](),controller[_0x6f1c('0x7')]);router[_0x6f1c('0x8')]('/:id',auth[_0x6f1c('0x6')](),controller['show']);router[_0x6f1c('0x9')]('/',auth[_0x6f1c('0x6')](),controller[_0x6f1c('0xa')]);router['put'](_0x6f1c('0xb'),auth['isAuthenticated'](),controller[_0x6f1c('0xc')]);router[_0x6f1c('0xd')]('/:id',auth[_0x6f1c('0x6')](),controller[_0x6f1c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index df6eb05..a3bddb2 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(_0x1faf5c,_0x413b3f){var _0x52d857=function(_0x2753a4){while(--_0x2753a4){_0x1faf5c['push'](_0x1faf5c['shift']());}};_0x52d857(++_0x413b3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x36834f,_0x165f02){var _0x19ac8e=function(_0x32b6b7){while(--_0x32b6b7){_0x36834f['push'](_0x36834f['shift']());}};_0x19ac8e(++_0x165f02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 a4c3294..be1b501 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 _0x59dc=['limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','Network','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','body','toLowerCase','chan_sip.so','transaction','STUN','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','html-pdf','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','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','count','offset'];(function(_0x37a822,_0x280ed8){var _0x17c56b=function(_0x34ef76){while(--_0x34ef76){_0x37a822['push'](_0x37a822['shift']());}};_0x17c56b(++_0x280ed8);}(_0x59dc,0x11b));var _0xc59d=function(_0x10a054,_0x4f1e1f){_0x10a054=_0x10a054-0x0;var _0x13f602=_0x59dc[_0x10a054];return _0x13f602;};'use strict';var pdf=require(_0xc59d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc59d('0x1'));var zipdir=require(_0xc59d('0x2'));var jsonpatch=require(_0xc59d('0x3'));var rp=require(_0xc59d('0x4'));var moment=require(_0xc59d('0x5'));var BPromise=require(_0xc59d('0x6'));var Mustache=require(_0xc59d('0x7'));var util=require(_0xc59d('0x8'));var path=require(_0xc59d('0x9'));var sox=require(_0xc59d('0xa'));var csv=require(_0xc59d('0xb'));var ejs=require(_0xc59d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc59d('0xd'));var jsforce=require(_0xc59d('0xe'));var deskjs=require(_0xc59d('0xf'));var toCsv=require(_0xc59d('0xb'));var querystring=require(_0xc59d('0x10'));var Papa=require(_0xc59d('0x11'));var Redis=require(_0xc59d('0x12'));var authService=require(_0xc59d('0x13'));var qs=require(_0xc59d('0x14'));var as=require(_0xc59d('0x15'));var hardwareService=require(_0xc59d('0x16'));var logger=require(_0xc59d('0x17'))('api');var utils=require(_0xc59d('0x18'));var config=require(_0xc59d('0x19'));var db=require(_0xc59d('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc59d('0x1b')][_0xc59d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x49f99f,_0x3c0163,_0x291df6){if(_0x291df6){var _0x3912bd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3912bd[_0xc59d('0x1d')](_0x3c0163)){return _0x49f99f;}else{throw new db['Sequelize']['ValidationError'](_0xc59d('0x1e'));}}else{return _0x49f99f;}}function respondWithRpcPromise(_0x4e519a,_0x38fa96,_0x2c2a98,_0x24808a){return new BPromise(function(_0x13d3a3,_0x7fc570){var _0x32de35=_0x24808a||client;return _0x32de35['request'](_0x4e519a,_0x2c2a98)['then'](function(_0x26d8f2){logger[_0xc59d('0x1f')](_0xc59d('0x20'),_0x38fa96,_0xc59d('0x21'));logger[_0xc59d('0x22')](_0xc59d('0x23'),_0x38fa96,_0xc59d('0x21'),JSON['stringify'](_0x26d8f2));if(_0x26d8f2[_0xc59d('0x24')]){if(_0x26d8f2[_0xc59d('0x24')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x38fa96,_0x26d8f2['error'][_0xc59d('0x25')]);return _0x7fc570(_0x26d8f2[_0xc59d('0x24')]['message']);}logger[_0xc59d('0x24')](_0xc59d('0x20'),_0x38fa96,_0x26d8f2[_0xc59d('0x24')][_0xc59d('0x25')]);return _0x13d3a3(_0x26d8f2[_0xc59d('0x24')][_0xc59d('0x25')]);}else{logger[_0xc59d('0x1f')](_0xc59d('0x20'),_0x38fa96,_0xc59d('0x21'));_0x13d3a3(_0x26d8f2['result']['message']);}})[_0xc59d('0x26')](function(_0x20b297){logger[_0xc59d('0x24')](_0xc59d('0x20'),_0x38fa96,_0x20b297);_0x7fc570(_0x20b297);});});}function respondWithStatusCode(_0xa6725f,_0x3b1d8d){_0x3b1d8d=_0x3b1d8d||0xcc;return function(_0xb61a0a){if(_0xb61a0a){return _0xa6725f[_0xc59d('0x27')](_0x3b1d8d);}return _0xa6725f[_0xc59d('0x28')](_0x3b1d8d)['end']();};}function respondWithResult(_0x5e1443,_0x41d466){_0x41d466=_0x41d466||0xc8;return function(_0x5e4a74){if(_0x5e4a74){return _0x5e1443[_0xc59d('0x28')](_0x41d466)[_0xc59d('0x29')](_0x5e4a74);}};}function respondWithFilteredResult(_0x4b2058,_0x38d4ae){return function(_0x2d58f0){if(_0x2d58f0){var _0x24ecb5=_0x2d58f0[_0xc59d('0x2a')],_0x5cbaa0=_0x38d4ae['offset'],_0x1a18d9=_0x38d4ae[_0xc59d('0x2b')]+_0x38d4ae[_0xc59d('0x2c')],_0x2d8d9b;if(_0x1a18d9>=_0x24ecb5){_0x1a18d9=_0x24ecb5;_0x2d8d9b=0xc8;}else{_0x2d8d9b=0xce;}_0x4b2058['status'](_0x2d8d9b);return _0x4b2058[_0xc59d('0x2d')](_0xc59d('0x2e'),_0x5cbaa0+'-'+_0x1a18d9+'/'+_0x24ecb5)['json'](_0x2d58f0);}return null;};}function patchUpdates(_0x1794ac){return function(_0x475561){try{jsonpatch[_0xc59d('0x2f')](_0x475561,_0x1794ac,!![]);}catch(_0x3c5db1){return BPromise[_0xc59d('0x30')](_0x3c5db1);}return _0x475561[_0xc59d('0x31')]();};}function saveUpdates(_0x17884b,_0x2706a3){return function(_0x55fecf){if(_0x55fecf){return _0x55fecf[_0xc59d('0x32')](_0x17884b)[_0xc59d('0x33')](function(_0x5373a6){return _0x5373a6;});}return null;};}function removeEntity(_0x11808a,_0x353ca0){return function(_0x25fc50){if(_0x25fc50){return _0x25fc50[_0xc59d('0x34')]()[_0xc59d('0x33')](function(){_0x11808a[_0xc59d('0x28')](0xcc)[_0xc59d('0x35')]();});}};}function handleEntityNotFound(_0x43865d,_0xc17f16){return function(_0x165344){if(!_0x165344){_0x43865d[_0xc59d('0x27')](0x194);}return _0x165344;};}function handleError(_0x55920e,_0x8cd5ff){_0x8cd5ff=_0x8cd5ff||0x1f4;return function(_0x25a4fc){logger[_0xc59d('0x24')](_0x25a4fc['stack']);if(_0x25a4fc['name']){delete _0x25a4fc[_0xc59d('0x36')];}_0x55920e[_0xc59d('0x28')](_0x8cd5ff)[_0xc59d('0x37')](_0x25a4fc);};}exports[_0xc59d('0x38')]=function(_0x44aac6,_0x10e5c9){var _0x5263f4={},_0x5a797a={},_0x1dd2e8={'count':0x0,'rows':[]};var _0x4bad6d=_[_0xc59d('0x39')](db[_0xc59d('0x3a')]['rawAttributes'],function(_0x184167){return{'name':_0x184167[_0xc59d('0x3b')],'type':_0x184167['type']['key']};});_0x5a797a[_0xc59d('0x3c')]=_[_0xc59d('0x39')](_0x4bad6d,'name');_0x5a797a['query']=_[_0xc59d('0x3d')](_0x44aac6[_0xc59d('0x3e')]);_0x5a797a[_0xc59d('0x3f')]=_[_0xc59d('0x40')](_0x5a797a[_0xc59d('0x3c')],_0x5a797a[_0xc59d('0x3e')]);_0x5263f4[_0xc59d('0x41')]=_[_0xc59d('0x40')](_0x5a797a[_0xc59d('0x3c')],qs[_0xc59d('0x42')](_0x44aac6['query'][_0xc59d('0x42')]));_0x5263f4[_0xc59d('0x41')]=_0x5263f4[_0xc59d('0x41')][_0xc59d('0x43')]?_0x5263f4[_0xc59d('0x41')]:_0x5a797a[_0xc59d('0x3c')];if(!_0x44aac6[_0xc59d('0x3e')][_0xc59d('0x44')](_0xc59d('0x45'))){_0x5263f4[_0xc59d('0x2c')]=qs[_0xc59d('0x2c')](_0x44aac6[_0xc59d('0x3e')][_0xc59d('0x2c')]);_0x5263f4[_0xc59d('0x2b')]=qs[_0xc59d('0x2b')](_0x44aac6[_0xc59d('0x3e')]['offset']);}_0x5263f4[_0xc59d('0x46')]=qs['sort'](_0x44aac6[_0xc59d('0x3e')][_0xc59d('0x47')]);_0x5263f4[_0xc59d('0x48')]=qs[_0xc59d('0x3f')](_[_0xc59d('0x49')](_0x44aac6[_0xc59d('0x3e')],_0x5a797a[_0xc59d('0x3f')]),_0x4bad6d);if(_0x44aac6[_0xc59d('0x3e')]['filter']){_0x5263f4[_0xc59d('0x48')]=_[_0xc59d('0x4a')](_0x5263f4['where'],{'$or':_[_0xc59d('0x39')](_0x4bad6d,function(_0x5d129f){if(_0x5d129f[_0xc59d('0x4b')]!=='VIRTUAL'){var _0x4b67db={};_0x4b67db[_0x5d129f[_0xc59d('0x36')]]={'$like':'%'+_0x44aac6[_0xc59d('0x3e')][_0xc59d('0x4c')]+'%'};return _0x4b67db;}})});}_0x5263f4=_[_0xc59d('0x4a')]({},_0x5263f4,_0x44aac6[_0xc59d('0x4d')]);var _0x51ebbe={'where':_0x5263f4[_0xc59d('0x48')]};return db['Network'][_0xc59d('0x2a')](_0x51ebbe)[_0xc59d('0x33')](function(_0x544c3e){_0x1dd2e8[_0xc59d('0x2a')]=_0x544c3e;if(_0x44aac6['query'][_0xc59d('0x4e')]){_0x5263f4[_0xc59d('0x4f')]=[{'all':!![]}];}return db[_0xc59d('0x3a')][_0xc59d('0x50')](_0x5263f4);})[_0xc59d('0x33')](function(_0x4cb2f0){_0x1dd2e8[_0xc59d('0x51')]=_0x4cb2f0;return _0x1dd2e8;})[_0xc59d('0x33')](respondWithFilteredResult(_0x10e5c9,_0x5263f4))[_0xc59d('0x26')](handleError(_0x10e5c9,null));};exports[_0xc59d('0x52')]=function(_0x5d77e3,_0x164546){var _0x52cd76={'raw':!![],'where':{'id':_0x5d77e3[_0xc59d('0x53')]['id']}},_0x33c078={};_0x33c078[_0xc59d('0x3c')]=_[_0xc59d('0x3d')](db['Network'][_0xc59d('0x54')]);_0x33c078[_0xc59d('0x3e')]=_[_0xc59d('0x3d')](_0x5d77e3['query']);_0x33c078[_0xc59d('0x3f')]=_[_0xc59d('0x40')](_0x33c078['model'],_0x33c078[_0xc59d('0x3e')]);_0x52cd76['attributes']=_[_0xc59d('0x40')](_0x33c078['model'],qs[_0xc59d('0x42')](_0x5d77e3[_0xc59d('0x3e')]['fields']));_0x52cd76[_0xc59d('0x41')]=_0x52cd76[_0xc59d('0x41')]['length']?_0x52cd76[_0xc59d('0x41')]:_0x33c078[_0xc59d('0x3c')];if(_0x5d77e3[_0xc59d('0x3e')][_0xc59d('0x4e')]){_0x52cd76[_0xc59d('0x4f')]=[{'all':!![]}];}_0x52cd76=_[_0xc59d('0x4a')]({},_0x52cd76,_0x5d77e3[_0xc59d('0x4d')]);return db[_0xc59d('0x3a')][_0xc59d('0x55')](_0x52cd76)[_0xc59d('0x33')](handleEntityNotFound(_0x164546,null))[_0xc59d('0x33')](respondWithResult(_0x164546,null))[_0xc59d('0x26')](handleError(_0x164546,null));};exports[_0xc59d('0x56')]=function(_0x3057b1,_0x23d7b1,_0x456e9b){var _0x1bf299;return db['sequelize']['transaction'](function(_0x1ad224){return db[_0xc59d('0x3a')][_0xc59d('0x56')](_0x3057b1['body'],{'raw':!![]})[_0xc59d('0x33')](function(_0x187009){_0x1bf299=_0x187009;return db[_0xc59d('0x3a')][_0xc59d('0x50')]({'where':{'type':_0x3057b1['body']['type']},'raw':!![]});})[_0xc59d('0x33')](function(_0x293792){if(_0x1bf299[_0xc59d('0x4b')][_0xc59d('0x57')]()=='STUN'){var _0x4fedd7=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config['root'],_0xc59d('0x5a')),_0xc59d('0x5b'));var _0x70c4af=ejs[_0xc59d('0x5c')](_0x4fedd7,{'networks':_0x293792||[]});fs[_0xc59d('0x5d')](_0xc59d('0x5e'),_0x70c4af);return respondWithRpcPromise(_0xc59d('0x5f'),_0xc59d('0x56'),{'module':_0xc59d('0x60')});}else if(_0x1bf299['type'][_0xc59d('0x57')]()==_0xc59d('0x61')){var _0x1d65f5=fs[_0xc59d('0x58')](path['join'](config[_0xc59d('0x62')],_0xc59d('0x63')),'utf8');var _0x4982ee=ejs['render'](_0x1d65f5,{'networks':_0x293792||[]});fs['writeFileSync'](_0xc59d('0x64'),_0x4982ee);return respondWithRpcPromise('Reload',_0xc59d('0x56'),{'module':_0xc59d('0x60')});}else{var _0x2c7b5d=fs[_0xc59d('0x58')](path['join'](config[_0xc59d('0x62')],'server/files/templates/network.ejs'),'utf8');var _0x27d84c=ejs[_0xc59d('0x5c')](_0x2c7b5d,{'networks':_0x293792||[]});fs[_0xc59d('0x5d')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3057b1[_0xc59d('0x65')][_0xc59d('0x4b')][_0xc59d('0x66')]()),_0x27d84c);return respondWithRpcPromise('Reload',_0xc59d('0x56'),{'module':_0xc59d('0x67')});}return null;})[_0xc59d('0x33')](function(){return _0x1bf299;});})[_0xc59d('0x33')](respondWithResult(_0x23d7b1,0xc9))[_0xc59d('0x26')](handleError(_0x23d7b1,null));};exports[_0xc59d('0x32')]=function(_0x2be5ac,_0x26eff8,_0x27de5f){var _0x533367;return db['sequelize'][_0xc59d('0x68')](function(_0x13eadd){return db[_0xc59d('0x3a')]['find']({'where':{'id':_0x2be5ac['params']['id']}})[_0xc59d('0x33')](handleEntityNotFound(_0x26eff8,null))[_0xc59d('0x33')](saveUpdates(_0x2be5ac[_0xc59d('0x65')],null))[_0xc59d('0x33')](function(_0x234192){if(_0x234192){_0x533367=_0x234192;return db[_0xc59d('0x3a')]['findAll']({'where':{'type':_0x533367[_0xc59d('0x4b')]},'raw':!![]});}return null;})[_0xc59d('0x33')](function(_0x274802){if(_0x533367[_0xc59d('0x4b')][_0xc59d('0x57')]()==_0xc59d('0x69')){var _0x2499cd=fs['readFileSync'](path[_0xc59d('0x59')](config[_0xc59d('0x62')],_0xc59d('0x5a')),_0xc59d('0x5b'));var _0x1fbcbc=ejs['render'](_0x2499cd,{'networks':_0x274802||[]});fs[_0xc59d('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x1fbcbc);return respondWithRpcPromise(_0xc59d('0x5f'),_0xc59d('0x32'),{'module':_0xc59d('0x60')});}else if(_0x533367[_0xc59d('0x4b')][_0xc59d('0x57')]()==_0xc59d('0x61')){var _0x3926a3=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config[_0xc59d('0x62')],_0xc59d('0x63')),'utf8');var _0xd4ef3a=ejs[_0xc59d('0x5c')](_0x3926a3,{'networks':_0x274802||[]});fs[_0xc59d('0x5d')](_0xc59d('0x64'),_0xd4ef3a);return respondWithRpcPromise('Reload',_0xc59d('0x32'),{'module':_0xc59d('0x60')});}else{var _0x5571bf=fs['readFileSync'](path[_0xc59d('0x59')](config['root'],_0xc59d('0x6a')),_0xc59d('0x5b'));var _0xf618be=ejs[_0xc59d('0x5c')](_0x5571bf,{'networks':_0x274802||[]});fs['writeFileSync'](util[_0xc59d('0x6b')](_0xc59d('0x6c'),_0x2be5ac[_0xc59d('0x65')][_0xc59d('0x4b')][_0xc59d('0x66')]()),_0xf618be);return respondWithRpcPromise('Reload','update',{'module':_0xc59d('0x67')});}return null;})[_0xc59d('0x33')](function(_0x43b21f){if(_0x43b21f){return _0x533367;}return null;});})[_0xc59d('0x33')](respondWithResult(_0x26eff8,null))['catch'](handleError(_0x26eff8,null));};exports['destroy']=function(_0x348f72,_0x59dab1,_0x1627fc){var _0x2709d3;return db['Network'][_0xc59d('0x55')]({'where':{'id':_0x348f72[_0xc59d('0x53')]['id']}})[_0xc59d('0x33')](function(_0xf6a876){_0x2709d3=_0xf6a876;return _0xf6a876;})['then'](handleEntityNotFound(_0x59dab1,null))[_0xc59d('0x33')](removeEntity(_0x59dab1,null))[_0xc59d('0x33')](function(){if(_0x2709d3){return db[_0xc59d('0x3a')]['findAll']({'where':{'type':_0x2709d3[_0xc59d('0x4b')]},'raw':!![]});}})[_0xc59d('0x33')](function(_0x50238c){if(_0x2709d3['type'][_0xc59d('0x57')]()==_0xc59d('0x69')){var _0x4c7f52=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xc59d('0x5b'));var _0x450730=ejs['render'](_0x4c7f52,{'networks':_0x50238c||[]});fs[_0xc59d('0x5d')](_0xc59d('0x5e'),_0x450730);return respondWithRpcPromise(_0xc59d('0x5f'),_0xc59d('0x34'),{'module':_0xc59d('0x60')});}else if(_0x2709d3[_0xc59d('0x4b')][_0xc59d('0x57')]()==_0xc59d('0x61')){var _0x391736=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config[_0xc59d('0x62')],_0xc59d('0x63')),_0xc59d('0x5b'));var _0x57306f=ejs[_0xc59d('0x5c')](_0x391736,{'networks':_0x50238c||[]});fs['writeFileSync'](_0xc59d('0x64'),_0x57306f);return respondWithRpcPromise(_0xc59d('0x5f'),_0xc59d('0x34'),{'module':_0xc59d('0x60')});}else{var _0x4641e4=fs[_0xc59d('0x58')](path[_0xc59d('0x59')](config[_0xc59d('0x62')],_0xc59d('0x6a')),'utf8');var _0x19997f=ejs[_0xc59d('0x5c')](_0x4641e4,{'networks':_0x50238c||[]});fs[_0xc59d('0x5d')](util[_0xc59d('0x6b')](_0xc59d('0x6c'),_0x348f72[_0xc59d('0x65')][_0xc59d('0x4b')][_0xc59d('0x66')]()),_0x19997f);return respondWithRpcPromise('Reload',_0xc59d('0x34'),{'module':_0xc59d('0x67')});}return null;})[_0xc59d('0x26')](handleError(_0x59dab1,null));}; \ No newline at end of file +var _0xb968=['params','intersection','include','find','sequelize','body','type','toUpperCase','STUN','join','utf8','render','Reload','create','res_stun_monitor.so','readFileSync','root','server/files/templates/turn_multiple.ejs','writeFileSync','server/files/templates/network.ejs','format','chan_sip.so','transaction','/etc/asterisk/stun_xcally.conf','TURN','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','server/files/templates/stun_multiple.ejs','toLowerCase','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Network','rawAttributes','fieldName','key','query','keys','filters','fields','attributes','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show'];(function(_0x3940e4,_0x1aea48){var _0x1c9c03=function(_0x421054){while(--_0x421054){_0x3940e4['push'](_0x3940e4['shift']());}};_0x1c9c03(++_0x1aea48);}(_0xb968,0xe9));var _0x8b96=function(_0x1c75c4,_0x4bef49){_0x1c75c4=_0x1c75c4-0x0;var _0x5b9cdd=_0xb968[_0x1c75c4];return _0x5b9cdd;};'use strict';var pdf=require(_0x8b96('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8b96('0x1'));var zipdir=require(_0x8b96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b96('0x3'));var moment=require('moment');var BPromise=require(_0x8b96('0x4'));var Mustache=require('mustache');var util=require(_0x8b96('0x5'));var path=require(_0x8b96('0x6'));var sox=require(_0x8b96('0x7'));var csv=require(_0x8b96('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8b96('0x9'));var crypto=require(_0x8b96('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8b96('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b96('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x8b96('0xc'));var as=require(_0x8b96('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b96('0xe'))(_0x8b96('0xf'));var utils=require(_0x8b96('0x10'));var config=require('../../config/environment');var db=require(_0x8b96('0x11'))['db'];var jayson=require(_0x8b96('0x12'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x323574,_0x702437,_0x98d8fd){if(_0x98d8fd){var _0x4a53df=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a53df[_0x8b96('0x13')](_0x702437)){return _0x323574;}else{throw new db[(_0x8b96('0x14'))]['ValidationError'](_0x8b96('0x15'));}}else{return _0x323574;}}function respondWithRpcPromise(_0x2726bc,_0x41a183,_0x3e3740,_0x36da29){return new BPromise(function(_0x208a91,_0x59c643){var _0x2a0422=_0x36da29||client;return _0x2a0422['request'](_0x2726bc,_0x3e3740)[_0x8b96('0x16')](function(_0x3e5076){logger[_0x8b96('0x17')](_0x8b96('0x18'),_0x41a183,'request\x20sent');logger[_0x8b96('0x19')](_0x8b96('0x1a'),_0x41a183,_0x8b96('0x1b'),JSON[_0x8b96('0x1c')](_0x3e5076));if(_0x3e5076[_0x8b96('0x1d')]){if(_0x3e5076[_0x8b96('0x1d')]['code']===0x1f4){logger[_0x8b96('0x1d')](_0x8b96('0x18'),_0x41a183,_0x3e5076[_0x8b96('0x1d')][_0x8b96('0x1e')]);return _0x59c643(_0x3e5076['error'][_0x8b96('0x1e')]);}logger[_0x8b96('0x1d')]('Network,\x20%s,\x20%s',_0x41a183,_0x3e5076['error'][_0x8b96('0x1e')]);return _0x208a91(_0x3e5076['error'][_0x8b96('0x1e')]);}else{logger[_0x8b96('0x17')](_0x8b96('0x18'),_0x41a183,_0x8b96('0x1b'));_0x208a91(_0x3e5076[_0x8b96('0x1f')][_0x8b96('0x1e')]);}})[_0x8b96('0x20')](function(_0x230580){logger['error']('Network,\x20%s,\x20%s',_0x41a183,_0x230580);_0x59c643(_0x230580);});});}function respondWithStatusCode(_0x4197a4,_0x4d4265){_0x4d4265=_0x4d4265||0xcc;return function(_0x15bb63){if(_0x15bb63){return _0x4197a4[_0x8b96('0x21')](_0x4d4265);}return _0x4197a4[_0x8b96('0x22')](_0x4d4265)[_0x8b96('0x23')]();};}function respondWithResult(_0x5a9b93,_0x336e02){_0x336e02=_0x336e02||0xc8;return function(_0x36d0fb){if(_0x36d0fb){return _0x5a9b93['status'](_0x336e02)[_0x8b96('0x24')](_0x36d0fb);}};}function respondWithFilteredResult(_0x6ee9b5,_0x5dd82a){return function(_0x12943c){if(_0x12943c){var _0x46dd44=_0x12943c[_0x8b96('0x25')],_0x1e8e83=_0x5dd82a['offset'],_0x28cd10=_0x5dd82a[_0x8b96('0x26')]+_0x5dd82a['limit'],_0x5ba76e;if(_0x28cd10>=_0x46dd44){_0x28cd10=_0x46dd44;_0x5ba76e=0xc8;}else{_0x5ba76e=0xce;}_0x6ee9b5[_0x8b96('0x22')](_0x5ba76e);return _0x6ee9b5['set'](_0x8b96('0x27'),_0x1e8e83+'-'+_0x28cd10+'/'+_0x46dd44)['json'](_0x12943c);}return null;};}function patchUpdates(_0x13bd6f){return function(_0x30b262){try{jsonpatch[_0x8b96('0x28')](_0x30b262,_0x13bd6f,!![]);}catch(_0x4e3cc8){return BPromise[_0x8b96('0x29')](_0x4e3cc8);}return _0x30b262[_0x8b96('0x2a')]();};}function saveUpdates(_0x2c50ad,_0x10b209){return function(_0x48c6f6){if(_0x48c6f6){return _0x48c6f6[_0x8b96('0x2b')](_0x2c50ad)[_0x8b96('0x16')](function(_0x1bf77d){return _0x1bf77d;});}return null;};}function removeEntity(_0x58855c,_0x399b99){return function(_0x15e985){if(_0x15e985){return _0x15e985[_0x8b96('0x2c')]()[_0x8b96('0x16')](function(){_0x58855c[_0x8b96('0x22')](0xcc)[_0x8b96('0x23')]();});}};}function handleEntityNotFound(_0x2996ac,_0x381233){return function(_0x203418){if(!_0x203418){_0x2996ac['sendStatus'](0x194);}return _0x203418;};}function handleError(_0x3d51b7,_0x3866e8){_0x3866e8=_0x3866e8||0x1f4;return function(_0x3781f3){logger[_0x8b96('0x1d')](_0x3781f3[_0x8b96('0x2d')]);if(_0x3781f3[_0x8b96('0x2e')]){delete _0x3781f3[_0x8b96('0x2e')];}_0x3d51b7[_0x8b96('0x22')](_0x3866e8)['send'](_0x3781f3);};}exports[_0x8b96('0x2f')]=function(_0x3679f3,_0x5f16f7){var _0x59f5a2={},_0x3b1ba8={},_0x1649fa={'count':0x0,'rows':[]};var _0x3298a2=_[_0x8b96('0x30')](db[_0x8b96('0x31')][_0x8b96('0x32')],function(_0x261c49){return{'name':_0x261c49[_0x8b96('0x33')],'type':_0x261c49['type'][_0x8b96('0x34')]};});_0x3b1ba8['model']=_['map'](_0x3298a2,_0x8b96('0x2e'));_0x3b1ba8[_0x8b96('0x35')]=_[_0x8b96('0x36')](_0x3679f3[_0x8b96('0x35')]);_0x3b1ba8[_0x8b96('0x37')]=_['intersection'](_0x3b1ba8['model'],_0x3b1ba8['query']);_0x59f5a2['attributes']=_['intersection'](_0x3b1ba8['model'],qs['fields'](_0x3679f3[_0x8b96('0x35')][_0x8b96('0x38')]));_0x59f5a2[_0x8b96('0x39')]=_0x59f5a2[_0x8b96('0x39')]['length']?_0x59f5a2['attributes']:_0x3b1ba8[_0x8b96('0x3a')];if(!_0x3679f3[_0x8b96('0x35')][_0x8b96('0x3b')](_0x8b96('0x3c'))){_0x59f5a2[_0x8b96('0x3d')]=qs[_0x8b96('0x3d')](_0x3679f3[_0x8b96('0x35')][_0x8b96('0x3d')]);_0x59f5a2['offset']=qs['offset'](_0x3679f3[_0x8b96('0x35')][_0x8b96('0x26')]);}_0x59f5a2[_0x8b96('0x3e')]=qs[_0x8b96('0x3f')](_0x3679f3[_0x8b96('0x35')]['sort']);_0x59f5a2[_0x8b96('0x40')]=qs[_0x8b96('0x37')](_[_0x8b96('0x41')](_0x3679f3['query'],_0x3b1ba8[_0x8b96('0x37')]),_0x3298a2);if(_0x3679f3[_0x8b96('0x35')][_0x8b96('0x42')]){_0x59f5a2[_0x8b96('0x40')]=_[_0x8b96('0x43')](_0x59f5a2[_0x8b96('0x40')],{'$or':_[_0x8b96('0x30')](_0x3298a2,function(_0x564968){if(_0x564968['type']!==_0x8b96('0x44')){var _0x3c7436={};_0x3c7436[_0x564968['name']]={'$like':'%'+_0x3679f3[_0x8b96('0x35')][_0x8b96('0x42')]+'%'};return _0x3c7436;}})});}_0x59f5a2=_['merge']({},_0x59f5a2,_0x3679f3['options']);var _0x14716f={'where':_0x59f5a2['where']};return db[_0x8b96('0x31')][_0x8b96('0x25')](_0x14716f)[_0x8b96('0x16')](function(_0x57e597){_0x1649fa[_0x8b96('0x25')]=_0x57e597;if(_0x3679f3['query'][_0x8b96('0x45')]){_0x59f5a2['include']=[{'all':!![]}];}return db['Network'][_0x8b96('0x46')](_0x59f5a2);})[_0x8b96('0x16')](function(_0x1c1ba6){_0x1649fa[_0x8b96('0x47')]=_0x1c1ba6;return _0x1649fa;})['then'](respondWithFilteredResult(_0x5f16f7,_0x59f5a2))[_0x8b96('0x20')](handleError(_0x5f16f7,null));};exports[_0x8b96('0x48')]=function(_0x174aef,_0x4a9eee){var _0x346107={'raw':!![],'where':{'id':_0x174aef[_0x8b96('0x49')]['id']}},_0x5f16ac={};_0x5f16ac[_0x8b96('0x3a')]=_[_0x8b96('0x36')](db[_0x8b96('0x31')][_0x8b96('0x32')]);_0x5f16ac[_0x8b96('0x35')]=_['keys'](_0x174aef[_0x8b96('0x35')]);_0x5f16ac[_0x8b96('0x37')]=_['intersection'](_0x5f16ac[_0x8b96('0x3a')],_0x5f16ac['query']);_0x346107['attributes']=_[_0x8b96('0x4a')](_0x5f16ac[_0x8b96('0x3a')],qs[_0x8b96('0x38')](_0x174aef[_0x8b96('0x35')][_0x8b96('0x38')]));_0x346107['attributes']=_0x346107[_0x8b96('0x39')]['length']?_0x346107[_0x8b96('0x39')]:_0x5f16ac['model'];if(_0x174aef['query'][_0x8b96('0x45')]){_0x346107[_0x8b96('0x4b')]=[{'all':!![]}];}_0x346107=_[_0x8b96('0x43')]({},_0x346107,_0x174aef['options']);return db['Network'][_0x8b96('0x4c')](_0x346107)[_0x8b96('0x16')](handleEntityNotFound(_0x4a9eee,null))[_0x8b96('0x16')](respondWithResult(_0x4a9eee,null))[_0x8b96('0x20')](handleError(_0x4a9eee,null));};exports['create']=function(_0x2a56c2,_0x4ef4b4,_0x559df4){var _0xf0f534;return db[_0x8b96('0x4d')]['transaction'](function(_0x5edd54){return db[_0x8b96('0x31')]['create'](_0x2a56c2[_0x8b96('0x4e')],{'raw':!![]})[_0x8b96('0x16')](function(_0x1585cb){_0xf0f534=_0x1585cb;return db[_0x8b96('0x31')][_0x8b96('0x46')]({'where':{'type':_0x2a56c2[_0x8b96('0x4e')][_0x8b96('0x4f')]},'raw':!![]});})[_0x8b96('0x16')](function(_0x446f9f){if(_0xf0f534[_0x8b96('0x4f')][_0x8b96('0x50')]()==_0x8b96('0x51')){var _0x406e64=fs['readFileSync'](path[_0x8b96('0x52')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x8b96('0x53'));var _0x26e928=ejs[_0x8b96('0x54')](_0x406e64,{'networks':_0x446f9f||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x26e928);return respondWithRpcPromise(_0x8b96('0x55'),_0x8b96('0x56'),{'module':_0x8b96('0x57')});}else if(_0xf0f534['type'][_0x8b96('0x50')]()=='TURN'){var _0x41dab6=fs[_0x8b96('0x58')](path[_0x8b96('0x52')](config[_0x8b96('0x59')],_0x8b96('0x5a')),_0x8b96('0x53'));var _0x2968da=ejs['render'](_0x41dab6,{'networks':_0x446f9f||[]});fs[_0x8b96('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x2968da);return respondWithRpcPromise('Reload',_0x8b96('0x56'),{'module':'res_stun_monitor.so'});}else{var _0x204a8d=fs[_0x8b96('0x58')](path[_0x8b96('0x52')](config[_0x8b96('0x59')],_0x8b96('0x5c')),'utf8');var _0x321f90=ejs['render'](_0x204a8d,{'networks':_0x446f9f||[]});fs[_0x8b96('0x5b')](util[_0x8b96('0x5d')]('/etc/asterisk/sip_xcally_%s.conf',_0x2a56c2[_0x8b96('0x4e')][_0x8b96('0x4f')]['toLowerCase']()),_0x321f90);return respondWithRpcPromise(_0x8b96('0x55'),_0x8b96('0x56'),{'module':_0x8b96('0x5e')});}return null;})[_0x8b96('0x16')](function(){return _0xf0f534;});})[_0x8b96('0x16')](respondWithResult(_0x4ef4b4,0xc9))[_0x8b96('0x20')](handleError(_0x4ef4b4,null));};exports[_0x8b96('0x2b')]=function(_0x3c2ae2,_0x24fa91,_0x5610db){var _0x4bc42e;return db[_0x8b96('0x4d')][_0x8b96('0x5f')](function(_0x190c2e){return db[_0x8b96('0x31')][_0x8b96('0x4c')]({'where':{'id':_0x3c2ae2[_0x8b96('0x49')]['id']}})[_0x8b96('0x16')](handleEntityNotFound(_0x24fa91,null))[_0x8b96('0x16')](saveUpdates(_0x3c2ae2['body'],null))[_0x8b96('0x16')](function(_0x3b62a1){if(_0x3b62a1){_0x4bc42e=_0x3b62a1;return db[_0x8b96('0x31')][_0x8b96('0x46')]({'where':{'type':_0x4bc42e[_0x8b96('0x4f')]},'raw':!![]});}return null;})[_0x8b96('0x16')](function(_0x17f1d5){if(_0x4bc42e[_0x8b96('0x4f')][_0x8b96('0x50')]()==_0x8b96('0x51')){var _0x5cc807=fs['readFileSync'](path[_0x8b96('0x52')](config[_0x8b96('0x59')],'server/files/templates/stun_multiple.ejs'),_0x8b96('0x53'));var _0x53c852=ejs['render'](_0x5cc807,{'networks':_0x17f1d5||[]});fs[_0x8b96('0x5b')](_0x8b96('0x60'),_0x53c852);return respondWithRpcPromise(_0x8b96('0x55'),_0x8b96('0x2b'),{'module':_0x8b96('0x57')});}else if(_0x4bc42e[_0x8b96('0x4f')][_0x8b96('0x50')]()==_0x8b96('0x61')){var _0x366956=fs[_0x8b96('0x58')](path['join'](config[_0x8b96('0x59')],'server/files/templates/turn_multiple.ejs'),_0x8b96('0x53'));var _0x56a12f=ejs[_0x8b96('0x54')](_0x366956,{'networks':_0x17f1d5||[]});fs['writeFileSync'](_0x8b96('0x62'),_0x56a12f);return respondWithRpcPromise(_0x8b96('0x55'),_0x8b96('0x2b'),{'module':_0x8b96('0x57')});}else{var _0x1a7e1e=fs[_0x8b96('0x58')](path[_0x8b96('0x52')](config[_0x8b96('0x59')],_0x8b96('0x5c')),_0x8b96('0x53'));var _0x2a5ab8=ejs[_0x8b96('0x54')](_0x1a7e1e,{'networks':_0x17f1d5||[]});fs['writeFileSync'](util[_0x8b96('0x5d')](_0x8b96('0x63'),_0x3c2ae2[_0x8b96('0x4e')][_0x8b96('0x4f')]['toLowerCase']()),_0x2a5ab8);return respondWithRpcPromise(_0x8b96('0x55'),_0x8b96('0x2b'),{'module':_0x8b96('0x5e')});}return null;})['then'](function(_0x2be839){if(_0x2be839){return _0x4bc42e;}return null;});})[_0x8b96('0x16')](respondWithResult(_0x24fa91,null))[_0x8b96('0x20')](handleError(_0x24fa91,null));};exports[_0x8b96('0x2c')]=function(_0x4d532a,_0x55a6bd,_0x2f759a){var _0x291993;return db[_0x8b96('0x31')][_0x8b96('0x4c')]({'where':{'id':_0x4d532a['params']['id']}})[_0x8b96('0x16')](function(_0x516a60){_0x291993=_0x516a60;return _0x516a60;})[_0x8b96('0x16')](handleEntityNotFound(_0x55a6bd,null))[_0x8b96('0x16')](removeEntity(_0x55a6bd,null))[_0x8b96('0x16')](function(){if(_0x291993){return db['Network']['findAll']({'where':{'type':_0x291993[_0x8b96('0x4f')]},'raw':!![]});}})[_0x8b96('0x16')](function(_0x2d5a39){if(_0x291993[_0x8b96('0x4f')][_0x8b96('0x50')]()==_0x8b96('0x51')){var _0x462fa8=fs[_0x8b96('0x58')](path[_0x8b96('0x52')](config[_0x8b96('0x59')],_0x8b96('0x64')),_0x8b96('0x53'));var _0x126ebd=ejs[_0x8b96('0x54')](_0x462fa8,{'networks':_0x2d5a39||[]});fs['writeFileSync'](_0x8b96('0x60'),_0x126ebd);return respondWithRpcPromise(_0x8b96('0x55'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x291993[_0x8b96('0x4f')][_0x8b96('0x50')]()==_0x8b96('0x61')){var _0x1d61ef=fs['readFileSync'](path[_0x8b96('0x52')](config[_0x8b96('0x59')],_0x8b96('0x5a')),_0x8b96('0x53'));var _0x42f2e9=ejs[_0x8b96('0x54')](_0x1d61ef,{'networks':_0x2d5a39||[]});fs[_0x8b96('0x5b')](_0x8b96('0x62'),_0x42f2e9);return respondWithRpcPromise('Reload',_0x8b96('0x2c'),{'module':_0x8b96('0x57')});}else{var _0x239444=fs[_0x8b96('0x58')](path[_0x8b96('0x52')](config['root'],_0x8b96('0x5c')),_0x8b96('0x53'));var _0x2ebf86=ejs[_0x8b96('0x54')](_0x239444,{'networks':_0x2d5a39||[]});fs[_0x8b96('0x5b')](util[_0x8b96('0x5d')](_0x8b96('0x63'),_0x4d532a[_0x8b96('0x4e')][_0x8b96('0x4f')][_0x8b96('0x65')]()),_0x2ebf86);return respondWithRpcPromise('Reload',_0x8b96('0x2c'),{'module':_0x8b96('0x5e')});}return null;})[_0x8b96('0x20')](handleError(_0x55a6bd,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 5d0a202..0775152 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 _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./network.attributes','Network','network'];(function(_0xd87161,_0xe6dd6a){var _0x31d7ea=function(_0x1d7ad9){while(--_0x1d7ad9){_0xd87161['push'](_0xd87161['shift']());}};_0x31d7ea(++_0xe6dd6a);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x3ede97,_0x5a1016){_0x3ede97=_0x3ede97-0x0;var _0x547ef2=_0x4fdb[_0x3ede97];return _0x547ef2;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda55=['util','moment','bluebird','request-promise','path','rimraf','./network.attributes','define','Network','network','lodash'];(function(_0x3551ad,_0x37802f){var _0x4ac4d6=function(_0x4d1a8c){while(--_0x4d1a8c){_0x3551ad['push'](_0x3551ad['shift']());}};_0x4ac4d6(++_0x37802f);}(_0xda55,0x6d));var _0x5da5=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xda55[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('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 d0e47ac..354704c 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 _0xa8bb=['lodash','moment','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','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x5d00c0,_0x2cf1ec){var _0x4e068c=function(_0x3d562e){while(--_0x3d562e){_0x5d00c0['push'](_0x5d00c0['shift']());}};_0x4e068c(++_0x2cf1ec);}(_0xa8bb,0xea));var _0xba8b=function(_0x432d92,_0x3a0b3f){_0x432d92=_0x432d92-0x0;var _0x573b32=_0xa8bb[_0x432d92];return _0x573b32;};'use strict';var _=require(_0xba8b('0x0'));var util=require('util');var moment=require(_0xba8b('0x1'));var BPromise=require(_0xba8b('0x2'));var rs=require(_0xba8b('0x3'));var fs=require('fs');var Redis=require(_0xba8b('0x4'));var db=require(_0xba8b('0x5'))['db'];var utils=require(_0xba8b('0x6'));var logger=require(_0xba8b('0x7'))(_0xba8b('0x8'));var config=require(_0xba8b('0x9'));var jayson=require(_0xba8b('0xa'));var client=jayson[_0xba8b('0xb')][_0xba8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x385a0b,_0x1c812f,_0x3cc736){return new BPromise(function(_0x16e7c5,_0x32c9a0){return client[_0xba8b('0xd')](_0x385a0b,_0x3cc736)[_0xba8b('0xe')](function(_0x4a9261){logger[_0xba8b('0xf')](_0xba8b('0x10'),_0x1c812f,_0xba8b('0x11'));logger[_0xba8b('0x12')](_0xba8b('0x13'),_0x1c812f,_0xba8b('0x11'),JSON[_0xba8b('0x14')](_0x4a9261));if(_0x4a9261['error']){if(_0x4a9261['error'][_0xba8b('0x15')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x1c812f,_0x4a9261[_0xba8b('0x16')][_0xba8b('0x17')]);return _0x32c9a0(_0x4a9261[_0xba8b('0x16')]['message']);}logger['error'](_0xba8b('0x10'),_0x1c812f,_0x4a9261['error'][_0xba8b('0x17')]);return _0x16e7c5(_0x4a9261[_0xba8b('0x16')]['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x1c812f,_0xba8b('0x11'));_0x16e7c5(_0x4a9261[_0xba8b('0x18')][_0xba8b('0x17')]);}})[_0xba8b('0x19')](function(_0xa94307){logger[_0xba8b('0x16')](_0xba8b('0x10'),_0x1c812f,_0xa94307);_0x32c9a0(_0xa94307);});});} \ No newline at end of file +var _0x0433=['info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','then'];(function(_0x20f375,_0x366b80){var _0x563d0b=function(_0x4e286b){while(--_0x4e286b){_0x20f375['push'](_0x20f375['shift']());}};_0x563d0b(++_0x366b80);}(_0x0433,0x199));var _0x3043=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x0433[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3043('0x0'));var BPromise=require(_0x3043('0x1'));var rs=require(_0x3043('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3043('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3043('0x4'))(_0x3043('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3043('0x6')][_0x3043('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b20a6,_0xdcb1c9,_0x545dd){return new BPromise(function(_0x5c009d,_0x285257){return client['request'](_0x5b20a6,_0x545dd)[_0x3043('0x8')](function(_0x45c6dd){logger[_0x3043('0x9')](_0x3043('0xa'),_0xdcb1c9,'request\x20sent');logger[_0x3043('0xb')](_0x3043('0xc'),_0xdcb1c9,'request\x20sent',JSON['stringify'](_0x45c6dd));if(_0x45c6dd['error']){if(_0x45c6dd['error'][_0x3043('0xd')]===0x1f4){logger[_0x3043('0xe')](_0x3043('0xa'),_0xdcb1c9,_0x45c6dd[_0x3043('0xe')][_0x3043('0xf')]);return _0x285257(_0x45c6dd[_0x3043('0xe')][_0x3043('0xf')]);}logger[_0x3043('0xe')](_0x3043('0xa'),_0xdcb1c9,_0x45c6dd[_0x3043('0xe')]['message']);return _0x5c009d(_0x45c6dd['error'][_0x3043('0xf')]);}else{logger[_0x3043('0x9')](_0x3043('0xa'),_0xdcb1c9,_0x3043('0x10'));_0x5c009d(_0x45c6dd[_0x3043('0x11')][_0x3043('0xf')]);}})[_0x3043('0x12')](function(_0x58ca97){logger['error'](_0x3043('0xa'),_0xdcb1c9,_0x58ca97);_0x285257(_0x58ca97);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index ee73e83..2733ed9 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 _0xeb65=['isAuthenticated','sendNotification','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xeb65,0x77));var _0x5eb6=function(_0x562f26,_0x9062ab){_0x562f26=_0x562f26-0x0;var _0x10a648=_0xeb65[_0x562f26];return _0x10a648;};'use strict';var multer=require(_0x5eb6('0x0'));var util=require(_0x5eb6('0x1'));var path=require(_0x5eb6('0x2'));var timeout=require(_0x5eb6('0x3'));var express=require(_0x5eb6('0x4'));var router=express['Router']();var auth=require(_0x5eb6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5eb6('0x6'));var controller=require('./notification.controller');router['post']('/',auth[_0x5eb6('0x7')](),controller[_0x5eb6('0x8')]);module['exports']=router; \ No newline at end of file +var _0x3f23=['./notification.controller','post','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3f23,0x111));var _0x33f2=function(_0x501a90,_0x3267d1){_0x501a90=_0x501a90-0x0;var _0x28bb97=_0x3f23[_0x501a90];return _0x28bb97;};'use strict';var multer=require(_0x33f2('0x0'));var util=require(_0x33f2('0x1'));var path=require(_0x33f2('0x2'));var timeout=require(_0x33f2('0x3'));var express=require(_0x33f2('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x33f2('0x5'));var config=require(_0x33f2('0x6'));var controller=require(_0x33f2('0x7'));router[_0x33f2('0x8')]('/',auth['isAuthenticated'](),controller['sendNotification']);module[_0x33f2('0x9')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index ffa08bf..be39d66 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 _0x609a=['exports','TEXT','STRING','BOOLEAN'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x609a,0x88));var _0xa609=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x609a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xa609('0x0')]={'body':{'type':Sequelize[_0xa609('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xa609('0x1')]},'recipientsDescription':{'type':Sequelize[_0xa609('0x2')]},'beep':{'type':Sequelize[_0xa609('0x3')]}}; \ No newline at end of file +var _0x1b64=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x1fd544,_0x331069){var _0x230dd3=function(_0x1a3add){while(--_0x1a3add){_0x1fd544['push'](_0x1fd544['shift']());}};_0x230dd3(++_0x331069);}(_0x1b64,0xaf));var _0x41b6=function(_0x1109f8,_0x506244){_0x1109f8=_0x1109f8-0x0;var _0x24154a=_0x1b64[_0x1109f8];return _0x24154a;};'use strict';var Sequelize=require(_0x41b6('0x0'));module[_0x41b6('0x1')]={'body':{'type':Sequelize[_0x41b6('0x2')]},'senderName':{'type':Sequelize[_0x41b6('0x3')]},'recipientsId':{'type':Sequelize[_0x41b6('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x41b6('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 35d909d..2f9aa33 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 _0x8e51=['Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','join','sequelize','transaction','Notification','forEach','recipient','notification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids','queue','replace','push','all','catch','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','./notification.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','sendNotification','body','hasOwnProperty','ValidationError'];(function(_0x1d90ca,_0x3bab16){var _0x28872b=function(_0x3ea71b){while(--_0x3ea71b){_0x1d90ca['push'](_0x1d90ca['shift']());}};_0x28872b(++_0x3bab16);}(_0x8e51,0xde));var _0x18e5=function(_0x40f17f,_0x34c8c0){_0x40f17f=_0x40f17f-0x0;var _0x543aea=_0x8e51[_0x40f17f];return _0x543aea;};'use strict';var pdf=require(_0x18e5('0x0'));var emlformat=require(_0x18e5('0x1'));var rimraf=require(_0x18e5('0x2'));var zipdir=require(_0x18e5('0x3'));var jsonpatch=require(_0x18e5('0x4'));var rp=require('request-promise');var moment=require(_0x18e5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x18e5('0x6'));var path=require('path');var sox=require(_0x18e5('0x7'));var csv=require(_0x18e5('0x8'));var ejs=require(_0x18e5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x18e5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x18e5('0x8'));var querystring=require(_0x18e5('0xb'));var Papa=require('papaparse');var Redis=require(_0x18e5('0xc'));var authService=require(_0x18e5('0xd'));var qs=require(_0x18e5('0xe'));var as=require(_0x18e5('0xf'));var hardwareService=require(_0x18e5('0x10'));var logger=require(_0x18e5('0x11'))('api');var utils=require(_0x18e5('0x12'));var config=require(_0x18e5('0x13'));var db=require('../../mysqldb')['db'];config[_0x18e5('0x14')]=_['defaults'](config[_0x18e5('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18e5('0x14')]));require(_0x18e5('0x15'))[_0x18e5('0x16')](socket);function respondWithStatusCode(_0x39f493,_0x5efd4e){_0x5efd4e=_0x5efd4e||0xcc;return function(_0x3f5a7c){if(_0x3f5a7c){return _0x39f493['sendStatus'](_0x5efd4e);}return _0x39f493[_0x18e5('0x17')](_0x5efd4e)[_0x18e5('0x18')]();};}function respondWithResult(_0x25ca86,_0x135606){_0x135606=_0x135606||0xc8;return function(_0x262bbc){if(_0x262bbc){return _0x25ca86[_0x18e5('0x17')](_0x135606)[_0x18e5('0x19')](_0x262bbc);}};}function respondWithFilteredResult(_0x138a7a,_0x2a8c9d){return function(_0x286c29){if(_0x286c29){var _0x226c1d=_0x286c29[_0x18e5('0x1a')],_0x4127a7=_0x2a8c9d[_0x18e5('0x1b')],_0x3c68e8=_0x2a8c9d[_0x18e5('0x1b')]+_0x2a8c9d['limit'],_0x3f0d87;if(_0x3c68e8>=_0x226c1d){_0x3c68e8=_0x226c1d;_0x3f0d87=0xc8;}else{_0x3f0d87=0xce;}_0x138a7a['status'](_0x3f0d87);return _0x138a7a[_0x18e5('0x1c')](_0x18e5('0x1d'),_0x4127a7+'-'+_0x3c68e8+'/'+_0x226c1d)['json'](_0x286c29);}return null;};}function patchUpdates(_0x1b6b44){return function(_0x496a8b){try{jsonpatch[_0x18e5('0x1e')](_0x496a8b,_0x1b6b44,!![]);}catch(_0x4cdf08){return BPromise[_0x18e5('0x1f')](_0x4cdf08);}return _0x496a8b[_0x18e5('0x20')]();};}function saveUpdates(_0xdf4986,_0x216be5){return function(_0x33da69){if(_0x33da69){return _0x33da69[_0x18e5('0x21')](_0xdf4986)[_0x18e5('0x22')](function(_0x5d5b66){return _0x5d5b66;});}return null;};}function removeEntity(_0x505baa,_0x50a314){return function(_0x199a23){if(_0x199a23){return _0x199a23[_0x18e5('0x23')]()[_0x18e5('0x22')](function(){_0x505baa[_0x18e5('0x17')](0xcc)[_0x18e5('0x18')]();});}};}function handleEntityNotFound(_0x449339,_0x27d3d3){return function(_0x487a85){if(!_0x487a85){_0x449339[_0x18e5('0x24')](0x194);}return _0x487a85;};}function handleError(_0x1da146,_0x48d2af){_0x48d2af=_0x48d2af||0x1f4;return function(_0x948d70){logger['error'](_0x948d70[_0x18e5('0x25')]);if(_0x948d70['name']){delete _0x948d70['name'];}_0x1da146[_0x18e5('0x17')](_0x48d2af)['send'](_0x948d70);};}exports[_0x18e5('0x26')]=function(_0x9fbc94,_0x59d41a,_0x414f4e){if(!_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x28')]('text')&&!_0x9fbc94['body'][_0x18e5('0x28')]('TemplateId')){throw new db['Sequelize'][(_0x18e5('0x29'))](_0x18e5('0x2a'));}else{if(_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x28')](_0x18e5('0x2b'))&&!_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x28')](_0x18e5('0x2c'))){throw new db['Sequelize'][(_0x18e5('0x29'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x9fbc94['body'][_0x18e5('0x28')](_0x18e5('0x2d'))){throw new db[(_0x18e5('0x2e'))][(_0x18e5('0x29'))](_0x18e5('0x2f'));}else{try{var _0x1bc5a8=JSON[_0x18e5('0x30')](_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x2d')]);}catch(_0x1e8603){logger[_0x18e5('0x31')](_0x1e8603);throw new db[(_0x18e5('0x2e'))][(_0x18e5('0x29'))](_0x18e5('0x32'));}var _0xcd41b5=[_0x18e5('0x33'),_0x18e5('0x34'),_0x18e5('0x35'),_0x18e5('0x36'),_0x18e5('0x37'),_0x18e5('0x38'),_0x18e5('0x39'),_0x18e5('0x3a'),_0x18e5('0x3b')];if(_['some'](_0x1bc5a8,function(_0x5d6409){return!_[_0x18e5('0x3c')](_0xcd41b5,_0x5d6409[_0x18e5('0x3d')][_0x18e5('0x3e')]());})){throw new db[(_0x18e5('0x2e'))][(_0x18e5('0x29'))](_0x18e5('0x3f'));}}}var _0x2b1e46={};_0x2b1e46[_0x18e5('0x40')]=_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x28')](_0x18e5('0x40'))?_0x9fbc94['body'][_0x18e5('0x40')]:_0x9fbc94[_0x18e5('0x3b')]['fullname'];_0x2b1e46[_0x18e5('0x41')]=_[_0x18e5('0x42')](_0x9fbc94['body'][_0x18e5('0x41')])?null:_0x9fbc94['body']['recipientsDescription'];_0x2b1e46['beep']=_0x9fbc94[_0x18e5('0x27')][_0x18e5('0x43')]||![];_0x2b1e46['SenderId']=_0x9fbc94['user']['id'];return getContent(_0x9fbc94[_0x18e5('0x27')])[_0x18e5('0x22')](function(_0x581341){_0x2b1e46[_0x18e5('0x27')]=_0x581341;return getRecipients(_0x1bc5a8);})[_0x18e5('0x22')](function(_0x54ba80){_0x2b1e46['recipientsId']=_['sortBy'](_0x54ba80)[_0x18e5('0x44')](',');return db[_0x18e5('0x45')][_0x18e5('0x46')](function(_0x1df39c){return db[_0x18e5('0x47')]['create'](_0x2b1e46,{'raw':!![],'transaction':_0x1df39c})['then'](function(_0x18bace){var _0x224b8a={'sender':_0x2b1e46[_0x18e5('0x40')],'description':_0x2b1e46[_0x18e5('0x41')],'content':_0x2b1e46[_0x18e5('0x27')],'beep':_0x2b1e46[_0x18e5('0x43')]};_0x54ba80[_0x18e5('0x48')](function(_0x53675c){_0x224b8a[_0x18e5('0x49')]=_0x53675c;socket['emit'](_0x18e5('0x4a'),_0x224b8a);});return _0x18bace;});});})['then'](respondWithResult(_0x59d41a,0xc9))['catch'](handleError(_0x59d41a,null));};function getContent(_0x350cf4){return new BPromise(function(_0x5d805f,_0x496463){if(_0x350cf4['text']){_0x5d805f(_0x350cf4['text']);return;}return db['Template'][_0x18e5('0x4b')]({'attributes':[_0x18e5('0x4c')],'where':{'id':_0x350cf4[_0x18e5('0x2b')]},'raw':!![]})[_0x18e5('0x22')](function(_0x50fa60){if(!_0x50fa60)throw new db[(_0x18e5('0x2e'))]['ValidationError'](_0x18e5('0x4d'));var _0x12ff4e=Mustache[_0x18e5('0x4e')](_0x50fa60[_0x18e5('0x4c')],_0x350cf4['view']);_0x5d805f(_0x12ff4e);})['catch'](function(_0x25c1b0){_0x496463(_0x25c1b0);});});}function getRecipients(_0x46b1a8){return new BPromise(function(_0x500fb7,_0x245de8){var _0x214969=[];var _0x9a98c3=[];_0x46b1a8[_0x18e5('0x48')](function(_0x4870b0){var _0x4d2693=_[_0x18e5('0x4f')](_0x4870b0['model'][_0x18e5('0x3e')]());if(_0x4d2693==='User'){_0x214969=_[_0x18e5('0x50')](_0x214969,_0x4870b0[_0x18e5('0x51')]);}else{if(_[_0x18e5('0x3c')](_0x4d2693,_0x18e5('0x52')))_0x4d2693=_0x4d2693[_0x18e5('0x53')]('queue','Queue');_0x4870b0[_0x18e5('0x51')][_0x18e5('0x48')](function(_0x149a17){_0x9a98c3[_0x18e5('0x54')](getAgents(_0x4d2693,_0x149a17));});}});return BPromise[_0x18e5('0x55')](_0x9a98c3)[_0x18e5('0x22')](function(_0x390bed){_0x214969=_[_0x18e5('0x50')](_0x214969,_['flatten'](_0x390bed));_0x500fb7(_0x214969);})[_0x18e5('0x56')](function(_0x5219c6){_0x245de8(_0x5219c6);});});}function getAgents(_0x5b6cbe,_0x1f6aa0){return new BPromise(function(_0x253eb5,_0x1c37e1){return db[_0x5b6cbe]['findOne']({'where':{'id':_0x1f6aa0}})[_0x18e5('0x22')](function(_0x477416){return _0x477416[_0x18e5('0x57')]({'attributes':['id'],'raw':!![]})[_0x18e5('0x22')](function(_0x876e18){var _0x1367ab=_['map'](_0x876e18,'id');_0x253eb5(_0x1367ab);});})[_0x18e5('0x56')](function(_0x507950){_0x1c37e1(_0x507950);});});} \ No newline at end of file +var _0x389e=['recipientsId','sortBy','Notification','create','recipient','notification:send','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','startCase','User','union','ids','replace','queue','Queue','forEach','push','all','flatten','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','chatqueue','faxqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId'];(function(_0x2879df,_0x180e9f){var _0x46ec78=function(_0x30c809){while(--_0x30c809){_0x2879df['push'](_0x2879df['shift']());}};_0x46ec78(++_0x180e9f);}(_0x389e,0x137));var _0xe389=function(_0x425d5b,_0x546a25){_0x425d5b=_0x425d5b-0x0;var _0x517ec2=_0x389e[_0x425d5b];return _0x517ec2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe389('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe389('0x1'));var rp=require(_0xe389('0x2'));var moment=require(_0xe389('0x3'));var BPromise=require(_0xe389('0x4'));var Mustache=require(_0xe389('0x5'));var util=require(_0xe389('0x6'));var path=require(_0xe389('0x7'));var sox=require('sox');var csv=require(_0xe389('0x8'));var ejs=require(_0xe389('0x9'));var fs=require('fs');var _=require(_0xe389('0xa'));var squel=require('squel');var crypto=require(_0xe389('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe389('0x8'));var querystring=require(_0xe389('0xc'));var Papa=require('papaparse');var Redis=require(_0xe389('0xd'));var authService=require(_0xe389('0xe'));var qs=require(_0xe389('0xf'));var as=require(_0xe389('0x10'));var hardwareService=require(_0xe389('0x11'));var logger=require(_0xe389('0x12'))(_0xe389('0x13'));var utils=require(_0xe389('0x14'));var config=require('../../config/environment');var db=require(_0xe389('0x15'))['db'];config['redis']=_[_0xe389('0x16')](config['redis'],{'host':_0xe389('0x17'),'port':0x18eb});var socket=require(_0xe389('0x18'))(new Redis(config['redis']));require('./notification.socket')[_0xe389('0x19')](socket);function respondWithStatusCode(_0x3f840,_0x26a1b4){_0x26a1b4=_0x26a1b4||0xcc;return function(_0x244d44){if(_0x244d44){return _0x3f840[_0xe389('0x1a')](_0x26a1b4);}return _0x3f840['status'](_0x26a1b4)[_0xe389('0x1b')]();};}function respondWithResult(_0x13b794,_0x3efdb7){_0x3efdb7=_0x3efdb7||0xc8;return function(_0x454335){if(_0x454335){return _0x13b794[_0xe389('0x1c')](_0x3efdb7)[_0xe389('0x1d')](_0x454335);}};}function respondWithFilteredResult(_0x89779a,_0x1aef9f){return function(_0xe8089f){if(_0xe8089f){var _0x1067d4=_0xe8089f[_0xe389('0x1e')],_0x44264a=_0x1aef9f[_0xe389('0x1f')],_0x3d2d12=_0x1aef9f['offset']+_0x1aef9f[_0xe389('0x20')],_0x48ce8d;if(_0x3d2d12>=_0x1067d4){_0x3d2d12=_0x1067d4;_0x48ce8d=0xc8;}else{_0x48ce8d=0xce;}_0x89779a[_0xe389('0x1c')](_0x48ce8d);return _0x89779a[_0xe389('0x21')](_0xe389('0x22'),_0x44264a+'-'+_0x3d2d12+'/'+_0x1067d4)[_0xe389('0x1d')](_0xe8089f);}return null;};}function patchUpdates(_0x3723e8){return function(_0x3b054f){try{jsonpatch[_0xe389('0x23')](_0x3b054f,_0x3723e8,!![]);}catch(_0x3f65cb){return BPromise['reject'](_0x3f65cb);}return _0x3b054f[_0xe389('0x24')]();};}function saveUpdates(_0x29a128,_0x3c4f76){return function(_0x4dde4d){if(_0x4dde4d){return _0x4dde4d[_0xe389('0x25')](_0x29a128)[_0xe389('0x26')](function(_0x2d3bbc){return _0x2d3bbc;});}return null;};}function removeEntity(_0x223e1f,_0x1d9f09){return function(_0x224dd1){if(_0x224dd1){return _0x224dd1[_0xe389('0x27')]()[_0xe389('0x26')](function(){_0x223e1f[_0xe389('0x1c')](0xcc)[_0xe389('0x1b')]();});}};}function handleEntityNotFound(_0x288534,_0x2dbc6a){return function(_0x3d9765){if(!_0x3d9765){_0x288534[_0xe389('0x1a')](0x194);}return _0x3d9765;};}function handleError(_0x2a7489,_0x28a54f){_0x28a54f=_0x28a54f||0x1f4;return function(_0x58c2d9){logger['error'](_0x58c2d9[_0xe389('0x28')]);if(_0x58c2d9[_0xe389('0x29')]){delete _0x58c2d9[_0xe389('0x29')];}_0x2a7489[_0xe389('0x1c')](_0x28a54f)[_0xe389('0x2a')](_0x58c2d9);};}exports[_0xe389('0x2b')]=function(_0x102806,_0x45d2c2,_0x755abe){if(!_0x102806[_0xe389('0x2c')][_0xe389('0x2d')](_0xe389('0x2e'))&&!_0x102806[_0xe389('0x2c')][_0xe389('0x2d')](_0xe389('0x2f'))){throw new db['Sequelize']['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x102806[_0xe389('0x2c')]['hasOwnProperty']('TemplateId')&&!_0x102806[_0xe389('0x2c')][_0xe389('0x2d')](_0xe389('0x30'))){throw new db[(_0xe389('0x31'))][(_0xe389('0x32'))](_0xe389('0x33'));}if(!_0x102806['body'][_0xe389('0x2d')](_0xe389('0x34'))){throw new db[(_0xe389('0x31'))][(_0xe389('0x32'))](_0xe389('0x35'));}else{try{var _0xca2eaa=JSON[_0xe389('0x36')](_0x102806[_0xe389('0x2c')][_0xe389('0x34')]);}catch(_0x1b1506){logger[_0xe389('0x37')](_0x1b1506);throw new db['Sequelize'][(_0xe389('0x32'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5368cf=[_0xe389('0x38'),_0xe389('0x39'),'mailqueue','openchannelqueue',_0xe389('0x3a'),_0xe389('0x3b'),_0xe389('0x3c'),_0xe389('0x3d'),_0xe389('0x3e')];if(_[_0xe389('0x3f')](_0xca2eaa,function(_0x4adb5d){return!_[_0xe389('0x40')](_0x5368cf,_0x4adb5d[_0xe389('0x41')][_0xe389('0x42')]());})){throw new db[(_0xe389('0x31'))][(_0xe389('0x32'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4c695f={};_0x4c695f['senderName']=_0x102806[_0xe389('0x2c')][_0xe389('0x2d')](_0xe389('0x43'))?_0x102806[_0xe389('0x2c')][_0xe389('0x43')]:_0x102806['user'][_0xe389('0x44')];_0x4c695f['recipientsDescription']=_[_0xe389('0x45')](_0x102806[_0xe389('0x2c')][_0xe389('0x46')])?null:_0x102806[_0xe389('0x2c')][_0xe389('0x46')];_0x4c695f[_0xe389('0x47')]=_0x102806['body'][_0xe389('0x47')]||![];_0x4c695f[_0xe389('0x48')]=_0x102806[_0xe389('0x3e')]['id'];return getContent(_0x102806[_0xe389('0x2c')])[_0xe389('0x26')](function(_0x3f5bb0){_0x4c695f[_0xe389('0x2c')]=_0x3f5bb0;return getRecipients(_0xca2eaa);})[_0xe389('0x26')](function(_0x205df6){_0x4c695f[_0xe389('0x49')]=_[_0xe389('0x4a')](_0x205df6)['join'](',');return db['sequelize']['transaction'](function(_0xd7527){return db[_0xe389('0x4b')][_0xe389('0x4c')](_0x4c695f,{'raw':!![],'transaction':_0xd7527})[_0xe389('0x26')](function(_0x2e85ae){var _0x2fd301={'sender':_0x4c695f[_0xe389('0x43')],'description':_0x4c695f[_0xe389('0x46')],'content':_0x4c695f[_0xe389('0x2c')],'beep':_0x4c695f[_0xe389('0x47')]};_0x205df6['forEach'](function(_0x12b794){_0x2fd301[_0xe389('0x4d')]=_0x12b794;socket['emit'](_0xe389('0x4e'),_0x2fd301);});return _0x2e85ae;});});})[_0xe389('0x26')](respondWithResult(_0x45d2c2,0xc9))['catch'](handleError(_0x45d2c2,null));};function getContent(_0x156224){return new BPromise(function(_0x3a720c,_0x3803d8){if(_0x156224[_0xe389('0x2e')]){_0x3a720c(_0x156224['text']);return;}return db[_0xe389('0x4f')][_0xe389('0x50')]({'attributes':['html'],'where':{'id':_0x156224[_0xe389('0x2f')]},'raw':!![]})[_0xe389('0x26')](function(_0x2cdfca){if(!_0x2cdfca)throw new db[(_0xe389('0x31'))][(_0xe389('0x32'))](_0xe389('0x51'));var _0x1145c6=Mustache[_0xe389('0x52')](_0x2cdfca[_0xe389('0x53')],_0x156224[_0xe389('0x30')]);_0x3a720c(_0x1145c6);})[_0xe389('0x54')](function(_0x3fa51e){_0x3803d8(_0x3fa51e);});});}function getRecipients(_0x1812eb){return new BPromise(function(_0x14ffec,_0x1625b9){var _0x1c66e8=[];var _0x9389d4=[];_0x1812eb['forEach'](function(_0x27872a){var _0x309874=_[_0xe389('0x55')](_0x27872a[_0xe389('0x41')][_0xe389('0x42')]());if(_0x309874===_0xe389('0x56')){_0x1c66e8=_[_0xe389('0x57')](_0x1c66e8,_0x27872a[_0xe389('0x58')]);}else{if(_[_0xe389('0x40')](_0x309874,'queue'))_0x309874=_0x309874[_0xe389('0x59')](_0xe389('0x5a'),_0xe389('0x5b'));_0x27872a['ids'][_0xe389('0x5c')](function(_0x46ff6e){_0x9389d4[_0xe389('0x5d')](getAgents(_0x309874,_0x46ff6e));});}});return BPromise[_0xe389('0x5e')](_0x9389d4)[_0xe389('0x26')](function(_0x6bd54a){_0x1c66e8=_['union'](_0x1c66e8,_[_0xe389('0x5f')](_0x6bd54a));_0x14ffec(_0x1c66e8);})[_0xe389('0x54')](function(_0x36781b){_0x1625b9(_0x36781b);});});}function getAgents(_0x41ab5b,_0x5e9ff8){return new BPromise(function(_0x5729c7,_0x3303cd){return db[_0x41ab5b][_0xe389('0x50')]({'where':{'id':_0x5e9ff8}})['then'](function(_0x54ccd3){return _0x54ccd3['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x2f8c05){var _0x57942f=_['map'](_0x2f8c05,'id');_0x5729c7(_0x57942f);});})[_0xe389('0x54')](function(_0x3cfb20){_0x3303cd(_0x3cfb20);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index c93119b..4d2a752 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 _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x2032,0xd9));var _0x2203=function(_0x5e8d5f,_0x514c55){_0x5e8d5f=_0x5e8d5f-0x0;var _0x5493ba=_0x2032[_0x5e8d5f];return _0x5493ba;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x4d991a,_0x3dcfa0){_0x4d991a=_0x4d991a-0x0;var _0x438cd6=_0x2032[_0x4d991a];return _0x438cd6;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 9a02769..c1c62e1 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 _0xb62e=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','define','notifications'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('Notification',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb62('0xc'),'collate':_0xeb62('0xd')});}; \ No newline at end of file +var _0x087b=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x087b,0x11a));var _0xb087=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x087b[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb087('0x2'));var BPromise=require('bluebird');var rp=require(_0xb087('0x3'));var fs=require('fs');var path=require(_0xb087('0x4'));var rimraf=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var attributes=require(_0xb087('0x7'));module[_0xb087('0x8')]=function(_0x40156d,_0x17d6e8){return _0x40156d[_0xb087('0x9')](_0xb087('0xa'),attributes,{'tableName':_0xb087('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb087('0xc'),'collate':_0xb087('0xd')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index fbdbf94..6ab0ffc 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 _0x9e41=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','error','code','message','Notification,\x20%s,\x20%s','catch'];(function(_0x1e65e5,_0x28bd82){var _0x438caf=function(_0x2ce5d2){while(--_0x2ce5d2){_0x1e65e5['push'](_0x1e65e5['shift']());}};_0x438caf(++_0x28bd82);}(_0x9e41,0x150));var _0x19e4=function(_0xa4d6ae,_0x516961){_0xa4d6ae=_0xa4d6ae-0x0;var _0x5e7673=_0x9e41[_0xa4d6ae];return _0x5e7673;};'use strict';var _=require(_0x19e4('0x0'));var util=require(_0x19e4('0x1'));var moment=require(_0x19e4('0x2'));var BPromise=require(_0x19e4('0x3'));var rs=require(_0x19e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19e4('0x5'))['db'];var utils=require(_0x19e4('0x6'));var logger=require(_0x19e4('0x7'))(_0x19e4('0x8'));var config=require(_0x19e4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x19e4('0xa')]['http']({'port':0x232a});config[_0x19e4('0xb')]=_[_0x19e4('0xc')](config[_0x19e4('0xb')],{'host':_0x19e4('0xd'),'port':0x18eb});var socket=require(_0x19e4('0xe'))(new Redis(config[_0x19e4('0xb')]));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x1f3fd5,_0x3449c1,_0x36e0e4){return new BPromise(function(_0x5047de,_0x4f345e){return client['request'](_0x1f3fd5,_0x36e0e4)[_0x19e4('0xf')](function(_0x21ba6c){logger[_0x19e4('0x10')]('Notification,\x20%s,\x20%s',_0x3449c1,_0x19e4('0x11'));logger['debug'](_0x19e4('0x12'),_0x3449c1,_0x19e4('0x11'),JSON['stringify'](_0x21ba6c));if(_0x21ba6c[_0x19e4('0x13')]){if(_0x21ba6c['error'][_0x19e4('0x14')]===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x3449c1,_0x21ba6c[_0x19e4('0x13')][_0x19e4('0x15')]);return _0x4f345e(_0x21ba6c[_0x19e4('0x13')][_0x19e4('0x15')]);}logger[_0x19e4('0x13')](_0x19e4('0x16'),_0x3449c1,_0x21ba6c[_0x19e4('0x13')][_0x19e4('0x15')]);return _0x5047de(_0x21ba6c['error']['message']);}else{logger[_0x19e4('0x10')]('Notification,\x20%s,\x20%s',_0x3449c1,_0x19e4('0x11'));_0x5047de(_0x21ba6c['result'][_0x19e4('0x15')]);}})[_0x19e4('0x17')](function(_0x206980){logger[_0x19e4('0x13')]('Notification,\x20%s,\x20%s',_0x3449c1,_0x206980);_0x4f345e(_0x206980);});});} \ No newline at end of file +var _0xd951=['message','Notification,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','info','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2e2b55,_0x7fc09e){var _0x36b6c1=function(_0x310290){while(--_0x310290){_0x2e2b55['push'](_0x2e2b55['shift']());}};_0x36b6c1(++_0x7fc09e);}(_0xd951,0x18a));var _0x1d95=function(_0x219627,_0x43e533){_0x219627=_0x219627-0x0;var _0x14b454=_0xd951[_0x219627];return _0x14b454;};'use strict';var _=require(_0x1d95('0x0'));var util=require(_0x1d95('0x1'));var moment=require('moment');var BPromise=require(_0x1d95('0x2'));var rs=require(_0x1d95('0x3'));var fs=require('fs');var Redis=require(_0x1d95('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d95('0x5'));var logger=require('../../config/logger')(_0x1d95('0x6'));var config=require(_0x1d95('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d95('0x8')][_0x1d95('0x9')]({'port':0x232a});config[_0x1d95('0xa')]=_[_0x1d95('0xb')](config[_0x1d95('0xa')],{'host':_0x1d95('0xc'),'port':0x18eb});var socket=require(_0x1d95('0xd'))(new Redis(config[_0x1d95('0xa')]));require(_0x1d95('0xe'))['register'](socket);function respondWithRpcPromise(_0x2e0c90,_0x2d1c71,_0x4be55b){return new BPromise(function(_0x449641,_0x5caa56){return client['request'](_0x2e0c90,_0x4be55b)['then'](function(_0x4d46fd){logger[_0x1d95('0xf')]('Notification,\x20%s,\x20%s',_0x2d1c71,'request\x20sent');logger[_0x1d95('0x10')](_0x1d95('0x11'),_0x2d1c71,_0x1d95('0x12'),JSON[_0x1d95('0x13')](_0x4d46fd));if(_0x4d46fd[_0x1d95('0x14')]){if(_0x4d46fd[_0x1d95('0x14')][_0x1d95('0x15')]===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x2d1c71,_0x4d46fd[_0x1d95('0x14')][_0x1d95('0x16')]);return _0x5caa56(_0x4d46fd[_0x1d95('0x14')]['message']);}logger[_0x1d95('0x14')]('Notification,\x20%s,\x20%s',_0x2d1c71,_0x4d46fd[_0x1d95('0x14')][_0x1d95('0x16')]);return _0x449641(_0x4d46fd['error'][_0x1d95('0x16')]);}else{logger['info'](_0x1d95('0x17'),_0x2d1c71,'request\x20sent');_0x449641(_0x4d46fd[_0x1d95('0x18')][_0x1d95('0x16')]);}})[_0x1d95('0x19')](function(_0x2fdd19){logger[_0x1d95('0x14')](_0x1d95('0x17'),_0x2d1c71,_0x2fdd19);_0x5caa56(_0x2fdd19);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 2cdcd1a..3c7a398 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 _0xe490=['remove','emit','removeListener','register','length','notification:','./notification.events','save'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe490,0xae));var _0x0e49=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe490[_0x33032e];return _0x13316b;};'use strict';var NotificationEvents=require(_0x0e49('0x0'));var events=[_0x0e49('0x1'),_0x0e49('0x2'),'update'];function createListener(_0x5e9149,_0x336188){return function(_0x4e103f){_0x336188[_0x0e49('0x3')](_0x5e9149,_0x4e103f);};}function removeListener(_0xd5405a,_0x19048a){return function(){NotificationEvents[_0x0e49('0x4')](_0xd5405a,_0x19048a);};}exports[_0x0e49('0x5')]=function(_0x35d310){for(var _0x3481e7=0x0,_0x80f2c7=events[_0x0e49('0x6')];_0x3481e7<_0x80f2c7;_0x3481e7++){var _0x5e8a4c=events[_0x3481e7];var _0x307600=createListener(_0x0e49('0x7')+_0x5e8a4c,_0x35d310);NotificationEvents['on'](_0x5e8a4c,_0x307600);}}; \ No newline at end of file +var _0x9d00=['notification:','./notification.events','save','remove','update','emit','removeListener'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x9d00,0x166));var _0x09d0=function(_0x111d9a,_0x120b2b){_0x111d9a=_0x111d9a-0x0;var _0x31bcb7=_0x9d00[_0x111d9a];return _0x31bcb7;};'use strict';var NotificationEvents=require(_0x09d0('0x0'));var events=[_0x09d0('0x1'),_0x09d0('0x2'),_0x09d0('0x3')];function createListener(_0x22500b,_0x2fefff){return function(_0x46b12c){_0x2fefff[_0x09d0('0x4')](_0x22500b,_0x46b12c);};}function removeListener(_0xc665a3,_0x26082d){return function(){NotificationEvents[_0x09d0('0x5')](_0xc665a3,_0x26082d);};}exports['register']=function(_0x23aa58){for(var _0x34180a=0x0,_0x58191f=events['length'];_0x34180a<_0x58191f;_0x34180a++){var _0x47f0fe=events[_0x34180a];var _0x29cc47=createListener(_0x09d0('0x6')+_0x47f0fe,_0x23aa58);NotificationEvents['on'](_0x47f0fe,_0x29cc47);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 779d5b2..b32a78e 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 _0x2852=['getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','post','addAnswer','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2852,0x1f0));var _0x2285=function(_0x47a4f6,_0x3030bf){_0x47a4f6=_0x47a4f6-0x0;var _0x29f3a7=_0x2852[_0x47a4f6];return _0x29f3a7;};'use strict';var multer=require(_0x2285('0x0'));var util=require(_0x2285('0x1'));var path=require(_0x2285('0x2'));var timeout=require('connect-timeout');var express=require(_0x2285('0x3'));var router=express[_0x2285('0x4')]();var auth=require(_0x2285('0x5'));var interaction=require(_0x2285('0x6'));var config=require(_0x2285('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2285('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2285('0x8')](_0x2285('0x9'),auth[_0x2285('0xa')](),controller['show']);router[_0x2285('0x8')](_0x2285('0xb'),auth[_0x2285('0xa')](),controller[_0x2285('0xc')]);router[_0x2285('0x8')](_0x2285('0xd'),auth[_0x2285('0xa')](),controller[_0x2285('0xe')]);router[_0x2285('0x8')](_0x2285('0xf'),auth['isAuthenticated'](),controller[_0x2285('0x10')]);router['get'](_0x2285('0x11'),auth[_0x2285('0xa')](),controller[_0x2285('0x12')]);router['get']('/:id/users',auth[_0x2285('0xa')](),controller['getAgents']);router[_0x2285('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2285('0x13')](_0x2285('0xb'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x2285('0xd'),auth[_0x2285('0xa')](),controller[_0x2285('0x14')]);router['post']('/:id/notify',controller[_0x2285('0x15')]);router['post'](_0x2285('0xf'),auth[_0x2285('0xa')](),controller[_0x2285('0x16')]);router[_0x2285('0x13')](_0x2285('0x17'),auth[_0x2285('0xa')](),controller[_0x2285('0x18')]);router['post'](_0x2285('0x19'),auth[_0x2285('0xa')](),controller[_0x2285('0x1a')]);router[_0x2285('0x1b')](_0x2285('0x9'),auth[_0x2285('0xa')](),controller[_0x2285('0x1c')]);router[_0x2285('0x1d')](_0x2285('0x9'),auth[_0x2285('0xa')](),controller[_0x2285('0x1e')]);router['delete'](_0x2285('0xb'),auth['isAuthenticated'](),controller[_0x2285('0x1f')]);router[_0x2285('0x1d')](_0x2285('0xd'),auth[_0x2285('0xa')](),controller[_0x2285('0x20')]);router[_0x2285('0x1d')](_0x2285('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x2285('0x21')]=router; \ No newline at end of file +var _0x088d=['/:id/notify','post','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','describe','show','/:id/dispositions','getDispositions','isAuthenticated','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','create','addDisposition','/:id/canned_answers'];(function(_0x36a82f,_0x2be5b6){var _0x3d1d1d=function(_0x2a1bdc){while(--_0x2a1bdc){_0x36a82f['push'](_0x36a82f['shift']());}};_0x3d1d1d(++_0x2be5b6);}(_0x088d,0x1a4));var _0xd088=function(_0x3131b6,_0x3efb01){_0x3131b6=_0x3131b6-0x0;var _0x39f385=_0x088d[_0x3131b6];return _0x39f385;};'use strict';var multer=require('multer');var util=require(_0xd088('0x0'));var path=require(_0xd088('0x1'));var timeout=require('connect-timeout');var express=require(_0xd088('0x2'));var router=express[_0xd088('0x3')]();var auth=require(_0xd088('0x4'));var interaction=require(_0xd088('0x5'));var config=require(_0xd088('0x6'));var controller=require(_0xd088('0x7'));router[_0xd088('0x8')]('/',auth['isAuthenticated'](),controller[_0xd088('0x9')]);router[_0xd088('0x8')](_0xd088('0xa'),auth['isAuthenticated'](),controller[_0xd088('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd088('0xc')]);router[_0xd088('0x8')](_0xd088('0xd'),auth['isAuthenticated'](),controller[_0xd088('0xe')]);router[_0xd088('0x8')]('/:id/canned_answers',auth[_0xd088('0xf')](),controller['getAnswers']);router[_0xd088('0x8')](_0xd088('0x10'),auth[_0xd088('0xf')](),controller['getApplications']);router['get'](_0xd088('0x11'),auth[_0xd088('0xf')](),controller[_0xd088('0x12')]);router['get'](_0xd088('0x13'),auth[_0xd088('0xf')](),controller[_0xd088('0x14')]);router['post']('/',auth[_0xd088('0xf')](),controller[_0xd088('0x15')]);router['post'](_0xd088('0xd'),auth[_0xd088('0xf')](),controller[_0xd088('0x16')]);router['post'](_0xd088('0x17'),auth[_0xd088('0xf')](),controller['addAnswer']);router['post'](_0xd088('0x18'),controller['notify']);router[_0xd088('0x19')](_0xd088('0x10'),auth[_0xd088('0xf')](),controller[_0xd088('0x1a')]);router[_0xd088('0x19')](_0xd088('0x13'),auth['isAuthenticated'](),controller[_0xd088('0x1b')]);router['post'](_0xd088('0x1c'),auth[_0xd088('0xf')](),controller[_0xd088('0x1d')]);router[_0xd088('0x1e')](_0xd088('0x1f'),auth[_0xd088('0xf')](),controller[_0xd088('0x20')]);router[_0xd088('0x21')]('/:id',auth[_0xd088('0xf')](),controller['destroy']);router[_0xd088('0x21')](_0xd088('0xd'),auth[_0xd088('0xf')](),controller[_0xd088('0x22')]);router[_0xd088('0x21')](_0xd088('0x17'),auth[_0xd088('0xf')](),controller[_0xd088('0x23')]);router[_0xd088('0x21')]('/:id/users',auth[_0xd088('0xf')](),controller['removeAgents']);module[_0xd088('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e75be4e..8ce7e05 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 _0x7ead=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x97d527,_0x198ff0){var _0x502ae0=function(_0x4e78fe){while(--_0x4e78fe){_0x97d527['push'](_0x97d527['shift']());}};_0x502ae0(++_0x198ff0);}(_0x7ead,0x79));var _0xd7ea=function(_0x1a4966,_0x4bf333){_0x1a4966=_0x1a4966-0x0;var _0x11cba6=_0x7ead[_0x1a4966];return _0x11cba6;};'use strict';var Sequelize=require(_0xd7ea('0x0'));var rs=require(_0xd7ea('0x1'));module[_0xd7ea('0x2')]={'name':{'type':Sequelize[_0xd7ea('0x3')],'unique':_0xd7ea('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xd7ea('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd7ea('0x5')]();}},'replyUri':{'type':Sequelize[_0xd7ea('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd7ea('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd7ea('0x6')],'defaultValue':function(){return _0xd7ea('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd7ea('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd7ea('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd7ea('0x3')]},'queueTransfer':{'type':Sequelize[_0xd7ea('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd7ea('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd7ea('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd7ea('0xa'),'set':function(_0x47b289){if(!_0x47b289)this[_0xd7ea('0xb')](_0xd7ea('0xc'),null);this[_0xd7ea('0xb')](_0xd7ea('0xd'),_0x47b289);}}}; \ No newline at end of file +var _0x6672=['mandatoryDisposition','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x8ecc14,_0x5af5c1){var _0x2f80a8=function(_0x8dada6){while(--_0x8dada6){_0x8ecc14['push'](_0x8ecc14['shift']());}};_0x2f80a8(++_0x5af5c1);}(_0x6672,0x119));var _0x2667=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0x6672[_0x9be28f];return _0xa9f52d;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2667('0x0')]},'token':{'type':Sequelize[_0x2667('0x0')],'defaultValue':function(){return rs[_0x2667('0x1')]();}},'replyUri':{'type':Sequelize[_0x2667('0x0')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2667('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2667('0x2');}},'notificationSound':{'type':Sequelize[_0x2667('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2667('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2667('0x0')]},'queueTransfer':{'type':Sequelize[_0x2667('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2667('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2667('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x2667('0x5')},'mandatoryDisposition':{'type':Sequelize[_0x2667('0x3')],'defaultValue':![],'comment':_0x2667('0x6'),'set':function(_0xdecd23){if(!_0xdecd23)this[_0x2667('0x7')](_0x2667('0x8'),null);this[_0x2667('0x7')](_0x2667('0x9'),_0xdecd23);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 33d38c7..8ce3a8e 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 _0xb1e2=['list','asc','ListId','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','Start','startRouting','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','send','dataValues','Messages','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','./openchannelAccount.socket','register','client','http','test','ValidationError','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','reject','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','update','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','order','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xb1e2,0xe6));var _0x2b1e=function(_0x273398,_0x5c77f1){_0x273398=_0x273398-0x0;var _0x410683=_0xb1e2[_0x273398];return _0x410683;};'use strict';var pdf=require(_0x2b1e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b1e('0x1'));var zipdir=require(_0x2b1e('0x2'));var jsonpatch=require(_0x2b1e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b1e('0x4'));var util=require(_0x2b1e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2b1e('0x6'));var ejs=require(_0x2b1e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2b1e('0x8'));var toCsv=require(_0x2b1e('0x6'));var querystring=require(_0x2b1e('0x9'));var Papa=require(_0x2b1e('0xa'));var Redis=require(_0x2b1e('0xb'));var authService=require(_0x2b1e('0xc'));var qs=require(_0x2b1e('0xd'));var as=require(_0x2b1e('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b1e('0xf'))(_0x2b1e('0x10'));var utils=require(_0x2b1e('0x11'));var config=require(_0x2b1e('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2b1e('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2b1e('0x14'))(new Redis(config[_0x2b1e('0x15')]));require(_0x2b1e('0x16'))[_0x2b1e('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2b1e('0x18')][_0x2b1e('0x19')]({'port':0x232c});var client9002=jayson['client'][_0x2b1e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x481455,_0x202167,_0x1d6759){if(_0x1d6759){var _0x454e38=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x454e38[_0x2b1e('0x1a')](_0x202167)){return _0x481455;}else{throw new db['Sequelize'][(_0x2b1e('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 _0x481455;}}function respondWithRpcPromise(_0x49f796,_0x2cd606,_0x55fcee,_0x19a2c4){return new BPromise(function(_0x187fb3,_0x412c86){var _0x317fe2=_0x19a2c4||client;return _0x317fe2[_0x2b1e('0x1c')](_0x49f796,_0x55fcee)[_0x2b1e('0x1d')](function(_0x25c02a){logger[_0x2b1e('0x1e')](_0x2b1e('0x1f'),_0x2cd606,_0x2b1e('0x20'));logger[_0x2b1e('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2cd606,'request\x20sent',JSON[_0x2b1e('0x22')](_0x25c02a));if(_0x25c02a[_0x2b1e('0x23')]){if(_0x25c02a['error'][_0x2b1e('0x24')]===0x1f4){logger[_0x2b1e('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x2cd606,_0x25c02a['error'][_0x2b1e('0x25')]);return _0x412c86(_0x25c02a[_0x2b1e('0x23')]['message']);}logger[_0x2b1e('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x2cd606,_0x25c02a['error'][_0x2b1e('0x25')]);return _0x187fb3(_0x25c02a[_0x2b1e('0x23')]['message']);}else{logger['info'](_0x2b1e('0x1f'),_0x2cd606,_0x2b1e('0x20'));_0x187fb3(_0x25c02a[_0x2b1e('0x26')][_0x2b1e('0x25')]);}})[_0x2b1e('0x27')](function(_0x6dd8b){logger[_0x2b1e('0x23')](_0x2b1e('0x1f'),_0x2cd606,_0x6dd8b);_0x412c86(_0x6dd8b);});});}function respondWithStatusCode(_0x5170e7,_0x532fc3){_0x532fc3=_0x532fc3||0xcc;return function(_0x476527){if(_0x476527){return _0x5170e7['sendStatus'](_0x532fc3);}return _0x5170e7[_0x2b1e('0x28')](_0x532fc3)[_0x2b1e('0x29')]();};}function respondWithResult(_0x32f9b5,_0x4a0eb9){_0x4a0eb9=_0x4a0eb9||0xc8;return function(_0xe5b85a){if(_0xe5b85a){return _0x32f9b5[_0x2b1e('0x28')](_0x4a0eb9)[_0x2b1e('0x2a')](_0xe5b85a);}};}function respondWithFilteredResult(_0xd74cc5,_0x47f407){return function(_0x627d7){if(_0x627d7){var _0x157742=_0x627d7[_0x2b1e('0x2b')],_0x72a76=_0x47f407[_0x2b1e('0x2c')],_0x43bca9=_0x47f407[_0x2b1e('0x2c')]+_0x47f407[_0x2b1e('0x2d')],_0x25a8f2;if(_0x43bca9>=_0x157742){_0x43bca9=_0x157742;_0x25a8f2=0xc8;}else{_0x25a8f2=0xce;}_0xd74cc5[_0x2b1e('0x28')](_0x25a8f2);return _0xd74cc5['set'](_0x2b1e('0x2e'),_0x72a76+'-'+_0x43bca9+'/'+_0x157742)[_0x2b1e('0x2a')](_0x627d7);}return null;};}function patchUpdates(_0x29e3b3){return function(_0x856433){try{jsonpatch['apply'](_0x856433,_0x29e3b3,!![]);}catch(_0x38a714){return BPromise[_0x2b1e('0x2f')](_0x38a714);}return _0x856433['save']();};}function saveUpdates(_0x1e7176,_0x548b57){return function(_0xf24b19){if(_0xf24b19){return _0xf24b19['update'](_0x1e7176)['then'](function(_0x1b65da){return _0x1b65da;});}return null;};}function removeEntity(_0x3a8116,_0x4f7b14){return function(_0x4c1707){if(_0x4c1707){return _0x4c1707[_0x2b1e('0x30')]()[_0x2b1e('0x1d')](function(){var _0x563189=_0x4c1707[_0x2b1e('0x31')]({'plain':!![]});var _0x3715b2=_0x2b1e('0x32');return db[_0x2b1e('0x33')][_0x2b1e('0x30')]({'where':{'type':_0x3715b2,'resourceId':_0x563189['id']}})[_0x2b1e('0x1d')](function(){return _0x4c1707;});})['then'](function(){_0x3a8116[_0x2b1e('0x28')](0xcc)[_0x2b1e('0x29')]();});}};}function handleEntityNotFound(_0xf5d18a,_0x53cfff){return function(_0x1e3ff4){if(!_0x1e3ff4){_0xf5d18a[_0x2b1e('0x34')](0x194);}return _0x1e3ff4;};}function handleError(_0x4e3d4d,_0x132c1f){_0x132c1f=_0x132c1f||0x1f4;return function(_0x213c9d){logger['error'](_0x213c9d[_0x2b1e('0x35')]);if(_0x213c9d[_0x2b1e('0x36')]){delete _0x213c9d[_0x2b1e('0x36')];}_0x4e3d4d[_0x2b1e('0x28')](_0x132c1f)['send'](_0x213c9d);};}exports[_0x2b1e('0x37')]=function(_0x4c80ac,_0x3c4219){var _0x5815d6={'include':[{'model':db[_0x2b1e('0x38')],'as':_0x2b1e('0x39')}]},_0x47aaaa={},_0x2952c4={'count':0x0,'rows':[]};var _0xa1b68f=_[_0x2b1e('0x3a')](db[_0x2b1e('0x3b')][_0x2b1e('0x3c')],function(_0x5aa1ae){return{'name':_0x5aa1ae[_0x2b1e('0x3d')],'type':_0x5aa1ae[_0x2b1e('0x3e')][_0x2b1e('0x3f')]};});_0x47aaaa[_0x2b1e('0x40')]=_[_0x2b1e('0x3a')](_0xa1b68f,_0x2b1e('0x36'));_0x47aaaa['query']=_[_0x2b1e('0x41')](_0x4c80ac['query']);_0x47aaaa[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x47aaaa[_0x2b1e('0x40')],_0x47aaaa['query']);_0x5815d6['attributes']=_['intersection'](_0x47aaaa[_0x2b1e('0x40')],qs[_0x2b1e('0x44')](_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x44')]));_0x5815d6[_0x2b1e('0x46')]=_0x5815d6['attributes'][_0x2b1e('0x47')]?_0x5815d6['attributes']:_0x47aaaa[_0x2b1e('0x40')];if(!_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x5815d6[_0x2b1e('0x2d')]=qs['limit'](_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x2d')]);_0x5815d6[_0x2b1e('0x2c')]=qs['offset'](_0x4c80ac['query'][_0x2b1e('0x2c')]);}_0x5815d6['order']=qs[_0x2b1e('0x4a')](_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x4a')]);_0x5815d6[_0x2b1e('0x4b')]=qs[_0x2b1e('0x42')](_[_0x2b1e('0x4c')](_0x4c80ac[_0x2b1e('0x45')],_0x47aaaa[_0x2b1e('0x42')]),_0xa1b68f);if(_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x4d')]){_0x5815d6['where']=_[_0x2b1e('0x4e')](_0x5815d6['where'],{'$or':_['map'](_0xa1b68f,function(_0x3766dd){if(_0x3766dd[_0x2b1e('0x3e')]!==_0x2b1e('0x4f')){var _0x3892f7={};_0x3892f7[_0x3766dd['name']]={'$like':'%'+_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x4d')]+'%'};return _0x3892f7;}})});}_0x5815d6=_['merge']({},_0x5815d6,_0x4c80ac[_0x2b1e('0x50')]);var _0x1995f9={'where':_0x5815d6[_0x2b1e('0x4b')]};return db[_0x2b1e('0x3b')]['count'](_0x1995f9)[_0x2b1e('0x1d')](function(_0x30d21e){_0x2952c4[_0x2b1e('0x2b')]=_0x30d21e;if(_0x4c80ac[_0x2b1e('0x45')][_0x2b1e('0x51')]){_0x5815d6[_0x2b1e('0x52')]=[{'all':!![]}];}return db[_0x2b1e('0x3b')][_0x2b1e('0x53')](_0x5815d6);})[_0x2b1e('0x1d')](function(_0xfbe75a){_0x2952c4[_0x2b1e('0x54')]=_0xfbe75a;return _0x2952c4;})[_0x2b1e('0x1d')](respondWithFilteredResult(_0x3c4219,_0x5815d6))[_0x2b1e('0x27')](handleError(_0x3c4219,null));};exports['show']=function(_0xb8da24,_0x287215){var _0x56f196={'raw':![],'where':{'id':_0xb8da24[_0x2b1e('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x2b1e('0x39')}]},_0x1bde88={};_0x1bde88[_0x2b1e('0x40')]=_[_0x2b1e('0x41')](db[_0x2b1e('0x3b')][_0x2b1e('0x3c')]);_0x1bde88['query']=_[_0x2b1e('0x41')](_0xb8da24[_0x2b1e('0x45')]);_0x1bde88[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x1bde88[_0x2b1e('0x40')],_0x1bde88[_0x2b1e('0x45')]);_0x56f196[_0x2b1e('0x46')]=_[_0x2b1e('0x43')](_0x1bde88['model'],qs[_0x2b1e('0x44')](_0xb8da24['query']['fields']));_0x56f196[_0x2b1e('0x46')]=_0x56f196[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x56f196[_0x2b1e('0x46')]:_0x1bde88[_0x2b1e('0x40')];if(_0xb8da24[_0x2b1e('0x45')][_0x2b1e('0x51')]){_0x56f196[_0x2b1e('0x52')]=[{'all':!![]}];}_0x56f196=_[_0x2b1e('0x4e')]({},_0x56f196,_0xb8da24[_0x2b1e('0x50')]);return db['OpenchannelAccount'][_0x2b1e('0x56')](_0x56f196)['then'](handleEntityNotFound(_0x287215,null))[_0x2b1e('0x1d')](respondWithResult(_0x287215,null))[_0x2b1e('0x27')](handleError(_0x287215,null));};exports['create']=function(_0x4dc4b8,_0x38034d){return db[_0x2b1e('0x3b')][_0x2b1e('0x57')](_0x4dc4b8[_0x2b1e('0x58')],{})[_0x2b1e('0x1d')](function(_0x1fa9fb){var _0x1b1577=_0x4dc4b8['user']['get']({'plain':!![]});if(!_0x1b1577)throw new Error(_0x2b1e('0x59'));if(_0x1b1577[_0x2b1e('0x5a')]===_0x2b1e('0x5b')){var _0x4bf5a8=_0x1fa9fb[_0x2b1e('0x31')]({'plain':!![]});var _0x221939=_0x2b1e('0x32');return db[_0x2b1e('0x5c')][_0x2b1e('0x56')]({'where':{'name':_0x221939,'userProfileId':_0x1b1577['userProfileId']},'raw':!![]})[_0x2b1e('0x1d')](function(_0x595f0a){if(_0x595f0a&&_0x595f0a['autoAssociation']===0x0){return db[_0x2b1e('0x33')][_0x2b1e('0x57')]({'name':_0x4bf5a8[_0x2b1e('0x36')],'resourceId':_0x4bf5a8['id'],'type':_0x595f0a['name'],'sectionId':_0x595f0a['id']},{})[_0x2b1e('0x1d')](function(){return _0x1fa9fb;});}else{return _0x1fa9fb;}})[_0x2b1e('0x27')](function(_0x79e7b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x79e7b3);throw _0x79e7b3;});}return _0x1fa9fb;})[_0x2b1e('0x1d')](respondWithResult(_0x38034d,0xc9))['catch'](handleError(_0x38034d,null));};exports[_0x2b1e('0x5d')]=function(_0x5ddc5c,_0x1c736d){if(_0x5ddc5c[_0x2b1e('0x58')]['id']){delete _0x5ddc5c[_0x2b1e('0x58')]['id'];}return db[_0x2b1e('0x3b')]['find']({'where':{'id':_0x5ddc5c[_0x2b1e('0x55')]['id']},'include':[{'model':db[_0x2b1e('0x38')],'as':_0x2b1e('0x39')}]})[_0x2b1e('0x1d')](handleEntityNotFound(_0x1c736d,null))[_0x2b1e('0x1d')](saveUpdates(_0x5ddc5c[_0x2b1e('0x58')],null))['then'](respondWithResult(_0x1c736d,null))[_0x2b1e('0x27')](handleError(_0x1c736d,null));};exports[_0x2b1e('0x30')]=function(_0x4562c1,_0x421359){return db['OpenchannelAccount'][_0x2b1e('0x56')]({'where':{'id':_0x4562c1[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0x421359,null))[_0x2b1e('0x1d')](removeEntity(_0x421359,null))['catch'](handleError(_0x421359,null));};exports[_0x2b1e('0x5e')]=function(_0x4ebf4f,_0x2ad5b9){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x2ad5b9,null))[_0x2b1e('0x27')](handleError(_0x2ad5b9,null));};exports[_0x2b1e('0x5f')]=function(_0x553624,_0x4ff76a,_0x2e7de2){if(_0x553624[_0x2b1e('0x58')]['id']){delete _0x553624[_0x2b1e('0x58')]['id'];}return db[_0x2b1e('0x3b')][_0x2b1e('0x56')]({'where':{'id':_0x553624[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x4ff76a,null))[_0x2b1e('0x1d')](function(_0x58d443){if(_0x58d443){_0x553624[_0x2b1e('0x58')][_0x2b1e('0x60')]=_0x58d443['id'];return db['Disposition'][_0x2b1e('0x57')](_0x553624[_0x2b1e('0x58')]);}})[_0x2b1e('0x1d')](respondWithResult(_0x4ff76a,null))['catch'](handleError(_0x4ff76a,null));};exports[_0x2b1e('0x61')]=function(_0x4222f1,_0x50111f,_0x46ef6e){var _0x4d95c4={'raw':![],'where':{}};var _0x156b14={};var _0x405412={'count':0x0,'rows':[]};return db[_0x2b1e('0x3b')][_0x2b1e('0x62')]({'where':{'id':_0x4222f1[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x50111f,null))[_0x2b1e('0x1d')](function(_0x18bd5d){if(_0x18bd5d){_0x156b14['model']=_[_0x2b1e('0x41')](db[_0x2b1e('0x63')][_0x2b1e('0x3c')]);_0x156b14[_0x2b1e('0x45')]=_[_0x2b1e('0x41')](_0x4222f1['query']);_0x156b14[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x156b14[_0x2b1e('0x40')],_0x156b14[_0x2b1e('0x45')]);_0x4d95c4['attributes']=_[_0x2b1e('0x43')](_0x156b14[_0x2b1e('0x40')],qs[_0x2b1e('0x44')](_0x4222f1['query'][_0x2b1e('0x44')]));_0x4d95c4[_0x2b1e('0x46')]=_0x4d95c4['attributes'][_0x2b1e('0x47')]?_0x4d95c4[_0x2b1e('0x46')]:_0x156b14[_0x2b1e('0x40')];if(!_0x4222f1[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x4d95c4[_0x2b1e('0x2d')]=qs[_0x2b1e('0x2d')](_0x4222f1[_0x2b1e('0x45')]['limit']);_0x4d95c4[_0x2b1e('0x2c')]=qs[_0x2b1e('0x2c')](_0x4222f1[_0x2b1e('0x45')]['offset']);}_0x4d95c4['order']=qs[_0x2b1e('0x4a')](_0x4222f1['query'][_0x2b1e('0x4a')]);_0x4d95c4[_0x2b1e('0x4b')]=qs[_0x2b1e('0x42')](_['pick'](_0x4222f1['query'],_0x156b14[_0x2b1e('0x42')]));_0x4d95c4[_0x2b1e('0x4b')]['OpenchannelAccountId']=_0x18bd5d['id'];if(_0x4222f1[_0x2b1e('0x45')][_0x2b1e('0x4d')]){_0x4d95c4[_0x2b1e('0x4b')]=_[_0x2b1e('0x4e')](_0x4d95c4[_0x2b1e('0x4b')],{'$or':_[_0x2b1e('0x3a')](_0x4d95c4[_0x2b1e('0x46')],function(_0x11f8d0){var _0x518ee3={};_0x518ee3[_0x11f8d0]={'$like':'%'+_0x4222f1[_0x2b1e('0x45')]['filter']+'%'};return _0x518ee3;})});}_0x4d95c4=_[_0x2b1e('0x4e')]({},_0x4d95c4,_0x4222f1[_0x2b1e('0x50')]);return db[_0x2b1e('0x63')][_0x2b1e('0x2b')]({'where':_0x4d95c4[_0x2b1e('0x4b')]})[_0x2b1e('0x1d')](function(_0x2735e2){_0x405412[_0x2b1e('0x2b')]=_0x2735e2;if(_0x4222f1[_0x2b1e('0x45')]['includeAll']){_0x4d95c4['include']=[{'all':!![]}];}return db['Disposition'][_0x2b1e('0x53')](_0x4d95c4);})[_0x2b1e('0x1d')](function(_0x4762bd){_0x405412['rows']=_0x4762bd;return _0x405412;});}})[_0x2b1e('0x1d')](respondWithFilteredResult(_0x50111f,_0x4d95c4))['catch'](handleError(_0x50111f,null));};exports['removeDispositions']=function(_0x1bc579,_0x20eb22,_0x3cf9bd){return db[_0x2b1e('0x3b')][_0x2b1e('0x56')]({'where':{'id':_0x1bc579[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x20eb22,null))[_0x2b1e('0x1d')](function(_0xa187eb){if(_0xa187eb){return _0xa187eb[_0x2b1e('0x64')](_0x1bc579['query'][_0x2b1e('0x65')]);}})[_0x2b1e('0x1d')](respondWithStatusCode(_0x20eb22,null))[_0x2b1e('0x27')](handleError(_0x20eb22,null));};exports[_0x2b1e('0x66')]=function(_0x251d11,_0x492cdf,_0xb67af8){if(_0x251d11[_0x2b1e('0x58')]['id']){delete _0x251d11['body']['id'];}return db[_0x2b1e('0x3b')][_0x2b1e('0x56')]({'where':{'id':_0x251d11[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0x492cdf,null))[_0x2b1e('0x1d')](function(_0x460e7f){if(_0x460e7f){_0x251d11[_0x2b1e('0x58')][_0x2b1e('0x67')]=_0x460e7f['id'];return db[_0x2b1e('0x68')][_0x2b1e('0x57')](_0x251d11[_0x2b1e('0x58')]);}})[_0x2b1e('0x1d')](respondWithResult(_0x492cdf,null))[_0x2b1e('0x27')](handleError(_0x492cdf,null));};exports[_0x2b1e('0x69')]=function(_0x4dc159,_0x4426b9,_0x47763b){var _0x33fee3={'raw':![],'where':{}};var _0x566f50={};var _0x59cee1={'count':0x0,'rows':[]};return db[_0x2b1e('0x3b')][_0x2b1e('0x62')]({'where':{'id':_0x4dc159[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x4426b9,null))[_0x2b1e('0x1d')](function(_0x24cb38){if(_0x24cb38){_0x566f50[_0x2b1e('0x40')]=_[_0x2b1e('0x41')](db[_0x2b1e('0x68')][_0x2b1e('0x3c')]);_0x566f50[_0x2b1e('0x45')]=_['keys'](_0x4dc159['query']);_0x566f50[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x566f50[_0x2b1e('0x40')],_0x566f50[_0x2b1e('0x45')]);_0x33fee3['attributes']=_[_0x2b1e('0x43')](_0x566f50['model'],qs[_0x2b1e('0x44')](_0x4dc159['query'][_0x2b1e('0x44')]));_0x33fee3[_0x2b1e('0x46')]=_0x33fee3[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x33fee3[_0x2b1e('0x46')]:_0x566f50[_0x2b1e('0x40')];if(!_0x4dc159[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x33fee3['limit']=qs['limit'](_0x4dc159['query'][_0x2b1e('0x2d')]);_0x33fee3[_0x2b1e('0x2c')]=qs[_0x2b1e('0x2c')](_0x4dc159['query'][_0x2b1e('0x2c')]);}_0x33fee3[_0x2b1e('0x6a')]=qs[_0x2b1e('0x4a')](_0x4dc159[_0x2b1e('0x45')][_0x2b1e('0x4a')]);_0x33fee3[_0x2b1e('0x4b')]=qs[_0x2b1e('0x42')](_['pick'](_0x4dc159[_0x2b1e('0x45')],_0x566f50[_0x2b1e('0x42')]));_0x33fee3[_0x2b1e('0x4b')]['OpenchannelAccountId']=_0x24cb38['id'];if(_0x4dc159['query'][_0x2b1e('0x4d')]){_0x33fee3[_0x2b1e('0x4b')]=_['merge'](_0x33fee3[_0x2b1e('0x4b')],{'$or':_['map'](_0x33fee3['attributes'],function(_0x471135){var _0x46d3ed={};_0x46d3ed[_0x471135]={'$like':'%'+_0x4dc159[_0x2b1e('0x45')][_0x2b1e('0x4d')]+'%'};return _0x46d3ed;})});}_0x33fee3=_['merge']({},_0x33fee3,_0x4dc159[_0x2b1e('0x50')]);return db['CannedAnswer'][_0x2b1e('0x2b')]({'where':_0x33fee3[_0x2b1e('0x4b')]})[_0x2b1e('0x1d')](function(_0x3f30fe){_0x59cee1[_0x2b1e('0x2b')]=_0x3f30fe;if(_0x4dc159[_0x2b1e('0x45')][_0x2b1e('0x51')]){_0x33fee3['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x2b1e('0x53')](_0x33fee3);})['then'](function(_0x5c763e){_0x59cee1[_0x2b1e('0x54')]=_0x5c763e;return _0x59cee1;});}})[_0x2b1e('0x1d')](respondWithFilteredResult(_0x4426b9,_0x33fee3))[_0x2b1e('0x27')](handleError(_0x4426b9,null));};exports[_0x2b1e('0x6b')]=function(_0x21f484,_0xacf2b7,_0x21e8a3){return db[_0x2b1e('0x3b')][_0x2b1e('0x56')]({'where':{'id':_0x21f484[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0xacf2b7,null))[_0x2b1e('0x1d')](function(_0x50ae1b){if(_0x50ae1b){return _0x50ae1b[_0x2b1e('0x6b')](_0x21f484[_0x2b1e('0x45')][_0x2b1e('0x65')]);}})[_0x2b1e('0x1d')](respondWithStatusCode(_0xacf2b7,null))[_0x2b1e('0x27')](handleError(_0xacf2b7,null));};exports[_0x2b1e('0x6c')]=function(_0x4bfbf8,_0x375420,_0x1c9f2a){var _0x59c372={'body':_0x4bfbf8[_0x2b1e('0x58')],'channel':_0x2b1e('0x6d')};var _0x521510=[];var _0x4f2e30=[];var _0x30bf2a={};var _0x5da88d=![];return db[_0x2b1e('0x6e')][_0x2b1e('0x5e')]()[_0x2b1e('0x1d')](function(_0x49a5e4){if(!_0x49a5e4){throw new db[(_0x2b1e('0x6f'))][(_0x2b1e('0x1b'))](_0x2b1e('0x70'));}_0x521510=_[_0x2b1e('0x71')](_['keys'](_0x49a5e4),[_0x2b1e('0x72'),_0x2b1e('0x73')]);_0x4f2e30=_[_0x2b1e('0x71')](_[_0x2b1e('0x41')](_0x49a5e4),[_0x2b1e('0x72'),_0x2b1e('0x73'),_0x2b1e('0x74'),'ListId']);if(_0x4bfbf8[_0x2b1e('0x58')]['id']){delete _0x4bfbf8[_0x2b1e('0x58')]['id'];}if(_[_0x2b1e('0x75')](_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x76')])){throw new db[(_0x2b1e('0x6f'))][(_0x2b1e('0x1b'))](_0x2b1e('0x77'));}if(_[_0x2b1e('0x75')](_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x58')])||_0x4bfbf8[_0x2b1e('0x58')]['body']===''){throw new db[(_0x2b1e('0x6f'))][(_0x2b1e('0x1b'))](_0x2b1e('0x78'));}if(_[_0x2b1e('0x75')](_0x4bfbf8['body'][_0x2b1e('0x79')])){throw new db[(_0x2b1e('0x6f'))][(_0x2b1e('0x1b'))](_0x2b1e('0x7a')+_0x4f2e30);}if(!_['includes'](_0x4f2e30,_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x79')])){throw new db[(_0x2b1e('0x6f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f2e30);}_0x30bf2a[_0x4bfbf8['body'][_0x2b1e('0x79')]]=_0x4bfbf8['body'][_0x2b1e('0x76')];})[_0x2b1e('0x1d')](function(){return db['OpenchannelAccount'][_0x2b1e('0x56')]({'where':{'id':_0x4bfbf8[_0x2b1e('0x55')]['id']},'include':[{'model':db[_0x2b1e('0x7b')],'as':_0x2b1e('0x7c'),'include':[{'model':db[_0x2b1e('0x6e')],'as':_0x2b1e('0x7d'),'where':_0x30bf2a,'limit':0x1,'order':[[_0x2b1e('0x73'),_0x2b1e('0x7e')]]}]},{'model':db['OpenchannelApplication'],'as':_0x2b1e('0x7f')}]});})[_0x2b1e('0x1d')](handleEntityNotFound(_0x375420,null))[_0x2b1e('0x1d')](function(_0x26c14a){if(_0x26c14a&&_0x26c14a[_0x2b1e('0x7c')]){_0x59c372[_0x2b1e('0x80')]=_0x26c14a;_0x59c372[_0x2b1e('0x81')]=_0x26c14a[_0x2b1e('0x7f')];_0x59c372[_0x2b1e('0x82')]=_0x26c14a['List'];_0x59c372[_0x2b1e('0x81')]=_['orderBy'](_0x59c372['applications'],['priority'],[_0x2b1e('0x83')]);if(_0x59c372[_0x2b1e('0x80')]['Applications']){delete _0x59c372[_0x2b1e('0x80')][_0x2b1e('0x7f')];}if(_0x59c372[_0x2b1e('0x80')]['List']&&_0x59c372[_0x2b1e('0x80')][_0x2b1e('0x7c')][_0x2b1e('0x7d')][_0x2b1e('0x47')]){return _0x59c372[_0x2b1e('0x80')][_0x2b1e('0x7c')][_0x2b1e('0x7d')][0x0];}var _0x130353=_['defaults'](_0x4bfbf8['body'],{'firstName':_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x76')],'ListId':_0x26c14a[_0x2b1e('0x84')]});_0x130353[_0x4bfbf8['body'][_0x2b1e('0x79')]]=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x76')];return db[_0x2b1e('0x6e')][_0x2b1e('0x57')](_0x130353,{'fields':_0x521510,'raw':!![]});}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x375420,null))['then'](function(_0x37eddf){_0x59c372['contact']=_0x37eddf;if(_0x37eddf){var _0x5e5338={'ContactId':_0x37eddf['id'],'OpenchannelAccountId':_0x4bfbf8['params']['id'],'from':(_0x37eddf[_0x2b1e('0x85')]||'')+'\x20'+(_0x37eddf[_0x2b1e('0x86')]||'')};var _0x2b966d={'OpenchannelAccountId':_0x4bfbf8['params']['id'],'closed':![]};if(_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x87')]){_0x2b966d[_0x2b1e('0x87')]=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x87')];return db['OpenchannelInteraction']['find']({'where':_0x2b966d})[_0x2b1e('0x1d')](function(_0x52e258){if(_0x52e258){return[_0x52e258,![]];}_0x5e5338[_0x2b1e('0x87')]=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x87')];_0x5e5338['externalUrl']=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x88')];return db[_0x2b1e('0x89')]['create'](_0x5e5338)['then'](function(_0x16e0c2){return[_0x16e0c2,!![]];});});}else{_0x2b966d[_0x2b1e('0x87')]=null;}_0x2b966d[_0x2b1e('0x8a')]=_0x37eddf['id'];return db[_0x2b1e('0x89')][_0x2b1e('0x56')]({'where':_0x2b966d})[_0x2b1e('0x1d')](function(_0x1db778){if(_0x1db778){return[_0x1db778,![]];}return db[_0x2b1e('0x89')][_0x2b1e('0x57')](_0x5e5338)[_0x2b1e('0x1d')](function(_0x4cc62b){return[_0x4cc62b,!![]];});});}})[_0x2b1e('0x8b')](function(_0x5c8acb,_0x32d4ce){if(_0x5c8acb){_0x5da88d=_0x32d4ce;if(!_0x32d4ce){var _0x14dfee={'from':(_0x59c372[_0x2b1e('0x8c')][_0x2b1e('0x85')]||'')+'\x20'+(_0x59c372['contact'][_0x2b1e('0x86')]||'')};if(_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x87')]&&_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x8d')]&&_0x4bfbf8[_0x2b1e('0x58')]['threadId']!=_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x8d')]){_0x14dfee[_0x2b1e('0x87')]=_0x4bfbf8['body'][_0x2b1e('0x8d')];}return _0x5c8acb['update'](_0x14dfee);}else{return _0x5c8acb;}}})['then'](function(_0x3cc5fe){_0x59c372['interaction']=_0x3cc5fe[_0x2b1e('0x31')]({'plain':!![]});_0x59c372[_0x2b1e('0x8e')][_0x2b1e('0x8f')]=_0x5da88d;if(_0x59c372[_0x2b1e('0x8e')]['created']){if(_0x59c372[_0x2b1e('0x80')][_0x2b1e('0x90')]){_0x59c372[_0x2b1e('0x81')][_0x2b1e('0x91')]({'id':0x0,'priority':_0x59c372[_0x2b1e('0x81')][_0x2b1e('0x47')]+0x1,'app':_0x2b1e('0x92'),'appdata':_0x2b1e('0x93'),'interval':_0x2b1e('0x94')});}}return db[_0x2b1e('0x95')][_0x2b1e('0x57')]({'body':_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x58')],'OpenchannelAccountId':_0x4bfbf8[_0x2b1e('0x55')]['id'],'OpenchannelInteractionId':_0x3cc5fe['id'],'direction':'in','ContactId':_0x59c372['contact']['id'],'AttachmentId':_0x4bfbf8[_0x2b1e('0x58')][_0x2b1e('0x96')]});})[_0x2b1e('0x1d')](function(_0x3e9ae0){_0x59c372['message']=_0x3e9ae0;if(_0x59c372[_0x2b1e('0x8e')][_0x2b1e('0x97')]){return db[_0x2b1e('0x98')][_0x2b1e('0x56')]({'attributes':['id','name'],'where':{'id':_0x59c372[_0x2b1e('0x8e')][_0x2b1e('0x97')]}})[_0x2b1e('0x1d')](function(_0x3aa490){if(_0x3aa490){_0x59c372[_0x2b1e('0x81')][_0x2b1e('0x99')]({'id':0x0,'priority':0x0,'app':_0x2b1e('0x9a'),'appdata':_0x3aa490[_0x2b1e('0x36')]+','+(_0x59c372[_0x2b1e('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0x2b1e('0x94')});_0x59c372['forcedOwnership']=![];}return respondWithRpcPromise(_0x2b1e('0x9b'),'startRouting',_0x59c372);});}return respondWithRpcPromise(_0x2b1e('0x9b'),_0x2b1e('0x9c'),_0x59c372);})[_0x2b1e('0x1d')](function(_0x1666af){respondWithRpcPromise('EventManager','EventManager',{'event':_0x2b1e('0x6c'),'message':_0x1666af},client9002);return _0x1666af;})[_0x2b1e('0x1d')](respondWithResult(_0x375420,null))[_0x2b1e('0x27')](handleError(_0x375420,null));};exports[_0x2b1e('0x9d')]=function(_0x2782c1,_0x477402,_0x497a68){return db[_0x2b1e('0x3b')][_0x2b1e('0x62')]({'where':{'id':_0x2782c1['params']['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x477402,null))[_0x2b1e('0x1d')](function(_0x244d7c){if(_0x244d7c){return db[_0x2b1e('0x9e')][_0x2b1e('0x9f')](function(_0x2a5318){return db[_0x2b1e('0xa0')][_0x2b1e('0x30')]({'where':{'OpenchannelAccountId':_0x2782c1['params']['id']},'transaction':_0x2a5318})[_0x2b1e('0x1d')](function(_0x5666c2){var _0x4c396c=_[_0x2b1e('0x3a')](_0x2782c1[_0x2b1e('0x58')],function(_0xb547a){_0xb547a[_0x2b1e('0x67')]=_0x2782c1['params']['id'];return _0xb547a;});return db['OpenchannelApplication'][_0x2b1e('0xa1')](_0x4c396c,{'transaction':_0x2a5318});});})[_0x2b1e('0x1d')](function(){return db['OpenchannelApplication'][_0x2b1e('0xa2')]({'where':{'OpenchannelAccountId':_0x2782c1[_0x2b1e('0x55')]['id']},'order':_0x2b1e('0xa3')});});}})['then'](respondWithResult(_0x477402,null))[_0x2b1e('0x27')](handleError(_0x477402,null));};exports[_0x2b1e('0xa4')]=function(_0x440d3b,_0x2bd056,_0x4c8e0a){var _0x337df1={};var _0x25582f={};var _0x51a535;var _0x51f9b7;return db['OpenchannelAccount'][_0x2b1e('0x62')]({'where':{'id':_0x440d3b[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x2bd056,null))['then'](function(_0x44be1d){if(_0x44be1d){_0x51a535=_0x44be1d;_0x25582f['model']=_['keys'](db[_0x2b1e('0xa0')][_0x2b1e('0x3c')]);_0x25582f[_0x2b1e('0x45')]=_['keys'](_0x440d3b[_0x2b1e('0x45')]);_0x25582f[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x25582f[_0x2b1e('0x40')],_0x25582f['query']);_0x337df1['attributes']=_[_0x2b1e('0x43')](_0x25582f[_0x2b1e('0x40')],qs[_0x2b1e('0x44')](_0x440d3b[_0x2b1e('0x45')]['fields']));_0x337df1['attributes']=_0x337df1[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x337df1[_0x2b1e('0x46')]:_0x25582f['model'];_0x337df1['order']=qs[_0x2b1e('0x4a')](_0x440d3b[_0x2b1e('0x45')]['sort']);_0x337df1[_0x2b1e('0x4b')]=qs['filters'](_[_0x2b1e('0x4c')](_0x440d3b[_0x2b1e('0x45')],_0x25582f['filters']));if(_0x440d3b[_0x2b1e('0x45')][_0x2b1e('0x4d')]){_0x337df1[_0x2b1e('0x4b')]=_[_0x2b1e('0x4e')](_0x337df1[_0x2b1e('0x4b')],{'$or':_['map'](_0x337df1['attributes'],function(_0x1a0874){var _0x3f8d06={};_0x3f8d06[_0x1a0874]={'$like':'%'+_0x440d3b[_0x2b1e('0x45')][_0x2b1e('0x4d')]+'%'};return _0x3f8d06;})});}_0x337df1=_[_0x2b1e('0x4e')]({},_0x337df1,_0x440d3b['options']);return _0x51a535[_0x2b1e('0xa4')](_0x337df1);}})[_0x2b1e('0x1d')](function(_0x182ecc){if(_0x182ecc){_0x51f9b7=_0x182ecc[_0x2b1e('0x47')];if(!_0x440d3b[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x337df1[_0x2b1e('0x2d')]=qs[_0x2b1e('0x2d')](_0x440d3b['query'][_0x2b1e('0x2d')]);_0x337df1[_0x2b1e('0x2c')]=qs[_0x2b1e('0x2c')](_0x440d3b[_0x2b1e('0x45')][_0x2b1e('0x2c')]);}return _0x51a535['getApplications'](_0x337df1);}})[_0x2b1e('0x1d')](function(_0x20e6e0){if(_0x20e6e0){return _0x20e6e0?{'count':_0x51f9b7,'rows':_0x20e6e0}:null;}})[_0x2b1e('0x1d')](respondWithResult(_0x2bd056,null))['catch'](handleError(_0x2bd056,null));};exports['getInteractions']=function(_0x100dc4,_0x4e9ac8,_0x16c626){var _0x174ac4={'raw':![],'where':{}};var _0x3c39cd={};var _0x5ec85a={'count':0x0,'rows':[]};return db[_0x2b1e('0x3b')]['findOne']({'where':{'id':_0x100dc4['params']['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x4e9ac8,null))['then'](function(_0x84d91f){if(_0x84d91f){_0x3c39cd[_0x2b1e('0x40')]=_[_0x2b1e('0x41')](db['OpenchannelInteraction'][_0x2b1e('0x3c')]);_0x3c39cd[_0x2b1e('0x45')]=_[_0x2b1e('0x41')](_0x100dc4['query']);_0x3c39cd[_0x2b1e('0x42')]=_[_0x2b1e('0x43')](_0x3c39cd[_0x2b1e('0x40')],_0x3c39cd['query']);_0x174ac4[_0x2b1e('0x46')]=_[_0x2b1e('0x43')](_0x3c39cd['model'],qs['fields'](_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0x44')]));_0x174ac4[_0x2b1e('0x46')]=_0x174ac4[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x174ac4[_0x2b1e('0x46')]:_0x3c39cd[_0x2b1e('0x40')];if(!_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0x48')](_0x2b1e('0x49'))){_0x174ac4['limit']=qs['limit'](_0x100dc4[_0x2b1e('0x45')]['limit']);_0x174ac4['offset']=qs[_0x2b1e('0x2c')](_0x100dc4[_0x2b1e('0x45')]['offset']);}_0x174ac4[_0x2b1e('0x6a')]=qs[_0x2b1e('0x4a')](_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0x4a')]);_0x174ac4[_0x2b1e('0x4b')]=qs['filters'](_['pick'](_0x100dc4[_0x2b1e('0x45')],_0x3c39cd[_0x2b1e('0x42')]));_0x174ac4[_0x2b1e('0x4b')][_0x2b1e('0x67')]=_0x84d91f['id'];if(_0x100dc4[_0x2b1e('0x45')]['filter']){_0x174ac4[_0x2b1e('0x4b')]=_[_0x2b1e('0x4e')](_0x174ac4[_0x2b1e('0x4b')],{'$or':_[_0x2b1e('0x3a')](_0x174ac4[_0x2b1e('0x46')],function(_0x209d58){var _0x2c05dd={};_0x2c05dd[_0x209d58]={'$like':'%'+_0x100dc4[_0x2b1e('0x45')]['filter']+'%'};return _0x2c05dd;})});}_0x174ac4=_[_0x2b1e('0x4e')]({},_0x174ac4,_0x100dc4['options']);return db[_0x2b1e('0x89')][_0x2b1e('0x2b')]({'where':_0x174ac4[_0x2b1e('0x4b')]})[_0x2b1e('0x1d')](function(_0x1e9864){_0x5ec85a[_0x2b1e('0x2b')]=_0x1e9864;if(_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0x51')]){_0x174ac4[_0x2b1e('0x52')]=[{'model':db[_0x2b1e('0x6e')],'as':'Contact','required':![]},{'model':db[_0x2b1e('0x98')],'as':_0x2b1e('0xa5'),'attributes':[_0x2b1e('0x36'),_0x2b1e('0xa6'),'internal'],'required':![]},{'model':db[_0x2b1e('0xa7')],'as':_0x2b1e('0xa8'),'attributes':['id',_0x2b1e('0x36'),_0x2b1e('0xa9')],'where':_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0xaa')]?{'id':_0x100dc4[_0x2b1e('0x45')][_0x2b1e('0xaa')]}:undefined,'required':_0x100dc4['query'][_0x2b1e('0xaa')]?!![]:![]}];}return db[_0x2b1e('0x89')][_0x2b1e('0x53')](_0x174ac4);})[_0x2b1e('0x1d')](function(_0x12f42c){_0x5ec85a[_0x2b1e('0x54')]=_0x12f42c;return _0x5ec85a;});}})['then'](respondWithFilteredResult(_0x4e9ac8,_0x174ac4))[_0x2b1e('0x27')](handleError(_0x4e9ac8,null));};exports[_0x2b1e('0xab')]=function(_0x329967,_0x33e07e,_0x44c529){return db['OpenchannelAccount']['find']({'where':{'id':_0x329967[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0x33e07e,null))[_0x2b1e('0x1d')](function(_0x266f1){if(_0x266f1){return _0x266f1[_0x2b1e('0xab')](_0x329967[_0x2b1e('0x58')][_0x2b1e('0x65')],_[_0x2b1e('0xac')](_0x329967[_0x2b1e('0x58')],[_0x2b1e('0x65'),'id'])||{})[_0x2b1e('0x8b')](function(_0x20c2dc){for(var _0x469b5e=0x0;_0x469b5e<_0x329967[_0x2b1e('0x58')][_0x2b1e('0x65')][_0x2b1e('0x47')];_0x469b5e+=0x1){socket[_0x2b1e('0xad')]('userOpenchannelAccount:save',{'UserId':_0x329967[_0x2b1e('0x58')][_0x2b1e('0x65')][_0x469b5e],'OpenchannelAccountId':_0x329967[_0x2b1e('0x55')]['id']});}return _0x20c2dc;});}})[_0x2b1e('0x1d')](respondWithResult(_0x33e07e,null))[_0x2b1e('0x27')](handleError(_0x33e07e,null));};exports['removeAgents']=function(_0x4ddded,_0x389aa3,_0xf42304){return db[_0x2b1e('0x3b')]['find']({'where':{'id':_0x4ddded[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x389aa3,null))['then'](function(_0x3f7a52){if(_0x3f7a52){return _0x3f7a52[_0x2b1e('0xae')](_0x4ddded[_0x2b1e('0x45')][_0x2b1e('0x65')])[_0x2b1e('0x1d')](function(){if(_['isArray'](_0x4ddded['query'][_0x2b1e('0x65')])){for(var _0x10d9f3=0x0;_0x10d9f3<_0x4ddded['query']['ids'][_0x2b1e('0x47')];_0x10d9f3+=0x1){socket['emit'](_0x2b1e('0xaf'),{'UserId':Number(_0x4ddded[_0x2b1e('0x45')][_0x2b1e('0x65')][_0x10d9f3]),'OpenchannelAccountId':Number(_0x4ddded[_0x2b1e('0x55')]['id'])});}}else{socket[_0x2b1e('0xad')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4ddded['query']['ids']),'OpenchannelAccountId':Number(_0x4ddded['params']['id'])});}});}})[_0x2b1e('0x1d')](respondWithStatusCode(_0x389aa3,null))[_0x2b1e('0x27')](handleError(_0x389aa3,null));};exports[_0x2b1e('0xb0')]=function(_0x20d7d2,_0x4ddf5c,_0x42de9c){var _0x4198b6={};var _0x482ae4={};var _0x28c6af;var _0x3bba75;return db[_0x2b1e('0x3b')]['findOne']({'where':{'id':_0x20d7d2[_0x2b1e('0x55')]['id']}})[_0x2b1e('0x1d')](handleEntityNotFound(_0x4ddf5c,null))[_0x2b1e('0x1d')](function(_0x8b092a){if(_0x8b092a){_0x28c6af=_0x8b092a;_0x482ae4[_0x2b1e('0x40')]=_[_0x2b1e('0x41')](db['User'][_0x2b1e('0x3c')]);_0x482ae4['query']=_['keys'](_0x20d7d2[_0x2b1e('0x45')]);_0x482ae4[_0x2b1e('0x42')]=_['intersection'](_0x482ae4['model'],_0x482ae4['query']);_0x4198b6[_0x2b1e('0x46')]=_[_0x2b1e('0x43')](_0x482ae4[_0x2b1e('0x40')],qs[_0x2b1e('0x44')](_0x20d7d2['query'][_0x2b1e('0x44')]));_0x4198b6[_0x2b1e('0x46')]=_0x4198b6[_0x2b1e('0x46')][_0x2b1e('0x47')]?_0x4198b6['attributes']:_0x482ae4[_0x2b1e('0x40')];_0x4198b6[_0x2b1e('0x6a')]=qs[_0x2b1e('0x4a')](_0x20d7d2[_0x2b1e('0x45')][_0x2b1e('0x4a')]);_0x4198b6['where']=qs[_0x2b1e('0x42')](_[_0x2b1e('0x4c')](_0x20d7d2['query'],_0x482ae4[_0x2b1e('0x42')]));if(_0x20d7d2['query'][_0x2b1e('0x4d')]){_0x4198b6['where']=_[_0x2b1e('0x4e')](_0x4198b6[_0x2b1e('0x4b')],{'$or':_[_0x2b1e('0x3a')](_0x4198b6['attributes'],function(_0x407ab4){var _0x16f7bb={};_0x16f7bb[_0x407ab4]={'$like':'%'+_0x20d7d2[_0x2b1e('0x45')][_0x2b1e('0x4d')]+'%'};return _0x16f7bb;})});}_0x4198b6=_['merge']({},_0x4198b6,_0x20d7d2[_0x2b1e('0x50')]);return _0x28c6af['getAgents'](_0x4198b6);}})[_0x2b1e('0x1d')](function(_0xe075db){if(_0xe075db){_0x3bba75=_0xe075db[_0x2b1e('0x47')];if(!_0x20d7d2['query']['hasOwnProperty'](_0x2b1e('0x49'))){_0x4198b6[_0x2b1e('0x2d')]=qs[_0x2b1e('0x2d')](_0x20d7d2['query'][_0x2b1e('0x2d')]);_0x4198b6['offset']=qs[_0x2b1e('0x2c')](_0x20d7d2['query'][_0x2b1e('0x2c')]);}return _0x28c6af[_0x2b1e('0xb0')](_0x4198b6);}})[_0x2b1e('0x1d')](function(_0x63802e){if(_0x63802e){return _0x63802e?{'count':_0x3bba75,'rows':_0x63802e}:null;}})['then'](respondWithResult(_0x4ddf5c,null))[_0x2b1e('0x27')](handleError(_0x4ddf5c,null));};exports[_0x2b1e('0xb1')]=function(_0x24fcf9,_0x2a3922,_0x27a2f7){var _0x322005,_0x310d2c,_0x4ea25d;if(_['isNil'](_0x24fcf9[_0x2b1e('0x58')]['body'])||_0x24fcf9['body'][_0x2b1e('0x58')]===''){throw new db[(_0x2b1e('0x6f'))]['ValidationError'](_0x2b1e('0x78'));}if(_[_0x2b1e('0x75')](_0x24fcf9[_0x2b1e('0x58')]['to'])){}_0x322005=_0x24fcf9[_0x2b1e('0x58')]['to'];return db[_0x2b1e('0x3b')]['findOne']({'where':{'id':_0x24fcf9[_0x2b1e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a3922,null))['then'](function(_0x1d5826){if(_0x1d5826){return db['OpenchannelAccount'][_0x2b1e('0x56')]({'where':{'id':_0x1d5826['id']},'include':[{'model':db[_0x2b1e('0x7b')],'as':'List','include':[{'model':db[_0x2b1e('0x6e')],'as':_0x2b1e('0x7d'),'where':{[_0x1d5826['mapKey']]:_0x322005},'limit':0x1,'order':[[_0x2b1e('0x73'),_0x2b1e('0x7e')]]}]}]})['then'](handleEntityNotFound(_0x2a3922,null))[_0x2b1e('0x1d')](function(_0x508fd8){if(_0x508fd8&&_0x508fd8[_0x2b1e('0x7c')]){_0x310d2c=_0x508fd8[_0x2b1e('0x31')]({'plain':!![]});if(_0x310d2c[_0x2b1e('0x7c')]&&_0x310d2c['List'][_0x2b1e('0x7d')][_0x2b1e('0x47')]){return _0x310d2c['List'][_0x2b1e('0x7d')][0x0];}return db[_0x2b1e('0x6e')][_0x2b1e('0x57')](_[_0x2b1e('0x13')](_0x24fcf9[_0x2b1e('0x58')],{'firstName':_0x322005,[_0x508fd8[_0x2b1e('0x79')]]:_0x322005,'phone':_0x322005,'ListId':_0x310d2c[_0x2b1e('0x84')]}));}})['then'](handleEntityNotFound(_0x2a3922,null))[_0x2b1e('0x1d')](function(_0x50cd3b){if(_0x50cd3b){_0x4ea25d=_0x50cd3b;return db['OpenchannelInteraction'][_0x2b1e('0x56')]({'where':{'ContactId':_0x4ea25d['id'],'closed':![],'OpenchannelAccountId':_0x310d2c['id']}})[_0x2b1e('0x1d')](function(_0x3115d2){if(_0x3115d2){return[_0x3115d2,![]];}return db[_0x2b1e('0x89')][_0x2b1e('0x57')]({'UserId':_0x24fcf9[_0x2b1e('0x5b')]['id'],'ContactId':_0x4ea25d['id'],'OpenchannelAccountId':_0x310d2c['id'],'lastMsgDirection':'out','Messages':[_[_0x2b1e('0x4e')](_0x24fcf9[_0x2b1e('0x58')],{'read':![],'body':_0x24fcf9[_0x2b1e('0x58')][_0x2b1e('0x58')],'OpenchannelAccountId':_0x310d2c['id'],'UserId':_0x24fcf9[_0x2b1e('0x5b')]['id'],'ContactId':_0x4ea25d['id']})]},{'include':[{'model':db[_0x2b1e('0x95')],'as':'Messages'}]})[_0x2b1e('0x1d')](function(_0x45ff15){return[_0x45ff15,!![]];});});}})[_0x2b1e('0x8b')](function(_0x54831a,_0x3c218d){if(_0x3c218d){return _0x54831a;}return db[_0x2b1e('0x95')][_0x2b1e('0x57')](_[_0x2b1e('0x4e')](_0x24fcf9[_0x2b1e('0x58')],{'read':![],'body':_0x24fcf9[_0x2b1e('0x58')]['body'],'OpenchannelAccountId':_0x310d2c['id'],'OpenchannelInteractionId':_0x54831a['id'],'UserId':_0x24fcf9[_0x2b1e('0x5b')]['id'],'ContactId':_0x4ea25d['id']}))[_0x2b1e('0x1d')](function(_0x4b36d3){_0x54831a[_0x2b1e('0xb2')][_0x2b1e('0xb3')]=[];_0x54831a[_0x2b1e('0xb2')][_0x2b1e('0xb3')]['push'](_0x4b36d3['dataValues']);return _0x54831a;});});}})[_0x2b1e('0x1d')](respondWithResult(_0x2a3922,null))[_0x2b1e('0x27')](handleError(_0x2a3922,null));}; \ No newline at end of file +var _0x8440=['sort','filters','filter','where','merge','type','VIRTUAL','OpenchannelAccount','includeAll','findAll','rows','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','describe','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','pick','removeAnswers','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','firstName','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','hasOwnProperty','getInteractions','Contact','Owner','fullname','Tags','color','tag','omit','spread','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','defaults','Messages','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelAccount.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','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','OpenchannelAccounts','end','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','offset','order'];(function(_0x1d9dfa,_0x30598d){var _0x252661=function(_0x4bcc24){while(--_0x4bcc24){_0x1d9dfa['push'](_0x1d9dfa['shift']());}};_0x252661(++_0x30598d);}(_0x8440,0x122));var _0x0844=function(_0x97fc4e,_0x493241){_0x97fc4e=_0x97fc4e-0x0;var _0x2ff264=_0x8440[_0x97fc4e];return _0x2ff264;};'use strict';var pdf=require(_0x0844('0x0'));var emlformat=require(_0x0844('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0844('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0844('0x3'));var moment=require(_0x0844('0x4'));var BPromise=require(_0x0844('0x5'));var Mustache=require(_0x0844('0x6'));var util=require(_0x0844('0x7'));var path=require(_0x0844('0x8'));var sox=require(_0x0844('0x9'));var csv=require(_0x0844('0xa'));var ejs=require(_0x0844('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0844('0xc'));var crypto=require(_0x0844('0xd'));var jsforce=require(_0x0844('0xe'));var deskjs=require(_0x0844('0xf'));var toCsv=require(_0x0844('0xa'));var querystring=require(_0x0844('0x10'));var Papa=require(_0x0844('0x11'));var Redis=require(_0x0844('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0844('0x13'));var as=require(_0x0844('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0844('0x15'))('api');var utils=require(_0x0844('0x16'));var config=require(_0x0844('0x17'));var db=require(_0x0844('0x18'))['db'];config[_0x0844('0x19')]=_['defaults'](config[_0x0844('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0844('0x1a'))(new Redis(config[_0x0844('0x19')]));require(_0x0844('0x1b'))[_0x0844('0x1c')](socket);var jayson=require(_0x0844('0x1d'));var client=jayson[_0x0844('0x1e')][_0x0844('0x1f')]({'port':0x232c});var client9002=jayson[_0x0844('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x19115c,_0x232486,_0x1ec66b){if(_0x1ec66b){var _0x229af3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x229af3[_0x0844('0x20')](_0x232486)){return _0x19115c;}else{throw new db[(_0x0844('0x21'))][(_0x0844('0x22'))](_0x0844('0x23'));}}else{return _0x19115c;}}function respondWithRpcPromise(_0x490498,_0x4b8351,_0x35d772,_0x12ef7b){return new BPromise(function(_0x177223,_0x1e3656){var _0x1e50de=_0x12ef7b||client;return _0x1e50de[_0x0844('0x24')](_0x490498,_0x35d772)['then'](function(_0x525470){logger[_0x0844('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b8351,'request\x20sent');logger[_0x0844('0x26')](_0x0844('0x27'),_0x4b8351,'request\x20sent',JSON[_0x0844('0x28')](_0x525470));if(_0x525470['error']){if(_0x525470['error'][_0x0844('0x29')]===0x1f4){logger[_0x0844('0x2a')](_0x0844('0x2b'),_0x4b8351,_0x525470[_0x0844('0x2a')][_0x0844('0x2c')]);return _0x1e3656(_0x525470[_0x0844('0x2a')]['message']);}logger[_0x0844('0x2a')](_0x0844('0x2b'),_0x4b8351,_0x525470[_0x0844('0x2a')]['message']);return _0x177223(_0x525470[_0x0844('0x2a')][_0x0844('0x2c')]);}else{logger[_0x0844('0x25')](_0x0844('0x2b'),_0x4b8351,_0x0844('0x2d'));_0x177223(_0x525470[_0x0844('0x2e')][_0x0844('0x2c')]);}})[_0x0844('0x2f')](function(_0xef46dd){logger[_0x0844('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b8351,_0xef46dd);_0x1e3656(_0xef46dd);});});}function respondWithStatusCode(_0x24e610,_0x4a7ff3){_0x4a7ff3=_0x4a7ff3||0xcc;return function(_0x375d30){if(_0x375d30){return _0x24e610[_0x0844('0x30')](_0x4a7ff3);}return _0x24e610[_0x0844('0x31')](_0x4a7ff3)['end']();};}function respondWithResult(_0x280eb4,_0x4f1de6){_0x4f1de6=_0x4f1de6||0xc8;return function(_0x699b45){if(_0x699b45){return _0x280eb4[_0x0844('0x31')](_0x4f1de6)[_0x0844('0x32')](_0x699b45);}};}function respondWithFilteredResult(_0x1f1e46,_0x36b48a){return function(_0x62a77b){if(_0x62a77b){var _0x47164a=_0x62a77b[_0x0844('0x33')],_0x1cc64d=_0x36b48a['offset'],_0x48bee3=_0x36b48a['offset']+_0x36b48a[_0x0844('0x34')],_0x46b271;if(_0x48bee3>=_0x47164a){_0x48bee3=_0x47164a;_0x46b271=0xc8;}else{_0x46b271=0xce;}_0x1f1e46[_0x0844('0x31')](_0x46b271);return _0x1f1e46['set'](_0x0844('0x35'),_0x1cc64d+'-'+_0x48bee3+'/'+_0x47164a)[_0x0844('0x32')](_0x62a77b);}return null;};}function patchUpdates(_0x14fc4b){return function(_0x5a17de){try{jsonpatch[_0x0844('0x36')](_0x5a17de,_0x14fc4b,!![]);}catch(_0x2a03a9){return BPromise[_0x0844('0x37')](_0x2a03a9);}return _0x5a17de[_0x0844('0x38')]();};}function saveUpdates(_0x4423e1,_0x5437e3){return function(_0x244eaf){if(_0x244eaf){return _0x244eaf[_0x0844('0x39')](_0x4423e1)['then'](function(_0x59aab9){return _0x59aab9;});}return null;};}function removeEntity(_0x20340f,_0x1b741a){return function(_0x122ace){if(_0x122ace){return _0x122ace[_0x0844('0x3a')]()[_0x0844('0x3b')](function(){var _0x2b6ed7=_0x122ace['get']({'plain':!![]});var _0xa37334=_0x0844('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0xa37334,'resourceId':_0x2b6ed7['id']}})[_0x0844('0x3b')](function(){return _0x122ace;});})[_0x0844('0x3b')](function(){_0x20340f[_0x0844('0x31')](0xcc)[_0x0844('0x3d')]();});}};}function handleEntityNotFound(_0xb5ee55,_0x457a77){return function(_0x11691e){if(!_0x11691e){_0xb5ee55[_0x0844('0x30')](0x194);}return _0x11691e;};}function handleError(_0x4f7461,_0xf17e9d){_0xf17e9d=_0xf17e9d||0x1f4;return function(_0xea2ad5){logger[_0x0844('0x2a')](_0xea2ad5['stack']);if(_0xea2ad5[_0x0844('0x3e')]){delete _0xea2ad5[_0x0844('0x3e')];}_0x4f7461[_0x0844('0x31')](_0xf17e9d)[_0x0844('0x3f')](_0xea2ad5);};}exports['index']=function(_0xa8f968,_0x3a402a){var _0x55ab70={'include':[{'model':db[_0x0844('0x40')],'as':_0x0844('0x41')}]},_0x3520e0={},_0x29ee05={'count':0x0,'rows':[]};var _0x4873c0=_[_0x0844('0x42')](db['OpenchannelAccount'][_0x0844('0x43')],function(_0x1b262b){return{'name':_0x1b262b[_0x0844('0x44')],'type':_0x1b262b['type'][_0x0844('0x45')]};});_0x3520e0[_0x0844('0x46')]=_[_0x0844('0x42')](_0x4873c0,_0x0844('0x3e'));_0x3520e0[_0x0844('0x47')]=_[_0x0844('0x48')](_0xa8f968[_0x0844('0x47')]);_0x3520e0['filters']=_['intersection'](_0x3520e0[_0x0844('0x46')],_0x3520e0[_0x0844('0x47')]);_0x55ab70[_0x0844('0x49')]=_[_0x0844('0x4a')](_0x3520e0[_0x0844('0x46')],qs['fields'](_0xa8f968[_0x0844('0x47')][_0x0844('0x4b')]));_0x55ab70[_0x0844('0x49')]=_0x55ab70[_0x0844('0x49')][_0x0844('0x4c')]?_0x55ab70[_0x0844('0x49')]:_0x3520e0[_0x0844('0x46')];if(!_0xa8f968['query']['hasOwnProperty'](_0x0844('0x4d'))){_0x55ab70[_0x0844('0x34')]=qs[_0x0844('0x34')](_0xa8f968[_0x0844('0x47')]['limit']);_0x55ab70[_0x0844('0x4e')]=qs['offset'](_0xa8f968[_0x0844('0x47')][_0x0844('0x4e')]);}_0x55ab70[_0x0844('0x4f')]=qs[_0x0844('0x50')](_0xa8f968[_0x0844('0x47')][_0x0844('0x50')]);_0x55ab70['where']=qs['filters'](_['pick'](_0xa8f968['query'],_0x3520e0[_0x0844('0x51')]),_0x4873c0);if(_0xa8f968[_0x0844('0x47')][_0x0844('0x52')]){_0x55ab70[_0x0844('0x53')]=_[_0x0844('0x54')](_0x55ab70[_0x0844('0x53')],{'$or':_[_0x0844('0x42')](_0x4873c0,function(_0x3cdb35){if(_0x3cdb35[_0x0844('0x55')]!==_0x0844('0x56')){var _0x331e67={};_0x331e67[_0x3cdb35[_0x0844('0x3e')]]={'$like':'%'+_0xa8f968['query']['filter']+'%'};return _0x331e67;}})});}_0x55ab70=_[_0x0844('0x54')]({},_0x55ab70,_0xa8f968['options']);var _0x4e6c02={'where':_0x55ab70[_0x0844('0x53')]};return db[_0x0844('0x57')]['count'](_0x4e6c02)[_0x0844('0x3b')](function(_0x244b24){_0x29ee05[_0x0844('0x33')]=_0x244b24;if(_0xa8f968[_0x0844('0x47')][_0x0844('0x58')]){_0x55ab70['include']=[{'all':!![]}];}return db[_0x0844('0x57')][_0x0844('0x59')](_0x55ab70);})['then'](function(_0x561c26){_0x29ee05[_0x0844('0x5a')]=_0x561c26;return _0x29ee05;})[_0x0844('0x3b')](respondWithFilteredResult(_0x3a402a,_0x55ab70))[_0x0844('0x2f')](handleError(_0x3a402a,null));};exports[_0x0844('0x5b')]=function(_0x224588,_0x39cf69){var _0x1f8a6b={'raw':![],'where':{'id':_0x224588[_0x0844('0x5c')]['id']},'include':[{'model':db[_0x0844('0x40')],'as':_0x0844('0x41')}]},_0x25d3a0={};_0x25d3a0[_0x0844('0x46')]=_[_0x0844('0x48')](db[_0x0844('0x57')][_0x0844('0x43')]);_0x25d3a0['query']=_[_0x0844('0x48')](_0x224588[_0x0844('0x47')]);_0x25d3a0[_0x0844('0x51')]=_['intersection'](_0x25d3a0[_0x0844('0x46')],_0x25d3a0[_0x0844('0x47')]);_0x1f8a6b[_0x0844('0x49')]=_[_0x0844('0x4a')](_0x25d3a0['model'],qs['fields'](_0x224588['query'][_0x0844('0x4b')]));_0x1f8a6b['attributes']=_0x1f8a6b[_0x0844('0x49')][_0x0844('0x4c')]?_0x1f8a6b[_0x0844('0x49')]:_0x25d3a0[_0x0844('0x46')];if(_0x224588[_0x0844('0x47')]['includeAll']){_0x1f8a6b[_0x0844('0x5d')]=[{'all':!![]}];}_0x1f8a6b=_[_0x0844('0x54')]({},_0x1f8a6b,_0x224588[_0x0844('0x5e')]);return db[_0x0844('0x57')][_0x0844('0x5f')](_0x1f8a6b)[_0x0844('0x3b')](handleEntityNotFound(_0x39cf69,null))[_0x0844('0x3b')](respondWithResult(_0x39cf69,null))['catch'](handleError(_0x39cf69,null));};exports[_0x0844('0x60')]=function(_0x2b5ab4,_0x2f9c7b){return db['OpenchannelAccount']['create'](_0x2b5ab4[_0x0844('0x61')],{})[_0x0844('0x3b')](function(_0x29028b){var _0x519f04=_0x2b5ab4[_0x0844('0x62')]['get']({'plain':!![]});if(!_0x519f04)throw new Error(_0x0844('0x63'));if(_0x519f04['role']===_0x0844('0x62')){var _0x2d7f48=_0x29028b[_0x0844('0x64')]({'plain':!![]});var _0x57bdcd='OpenchannelAccounts';return db[_0x0844('0x65')][_0x0844('0x5f')]({'where':{'name':_0x57bdcd,'userProfileId':_0x519f04[_0x0844('0x66')]},'raw':!![]})[_0x0844('0x3b')](function(_0x41c008){if(_0x41c008&&_0x41c008['autoAssociation']===0x0){return db['UserProfileResource'][_0x0844('0x60')]({'name':_0x2d7f48[_0x0844('0x3e')],'resourceId':_0x2d7f48['id'],'type':_0x41c008['name'],'sectionId':_0x41c008['id']},{})['then'](function(){return _0x29028b;});}else{return _0x29028b;}})[_0x0844('0x2f')](function(_0x29a4f7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29a4f7);throw _0x29a4f7;});}return _0x29028b;})['then'](respondWithResult(_0x2f9c7b,0xc9))[_0x0844('0x2f')](handleError(_0x2f9c7b,null));};exports[_0x0844('0x39')]=function(_0x1dff8a,_0x2c7525){if(_0x1dff8a[_0x0844('0x61')]['id']){delete _0x1dff8a['body']['id'];}return db[_0x0844('0x57')]['find']({'where':{'id':_0x1dff8a[_0x0844('0x5c')]['id']},'include':[{'model':db[_0x0844('0x40')],'as':_0x0844('0x41')}]})[_0x0844('0x3b')](handleEntityNotFound(_0x2c7525,null))[_0x0844('0x3b')](saveUpdates(_0x1dff8a[_0x0844('0x61')],null))[_0x0844('0x3b')](respondWithResult(_0x2c7525,null))[_0x0844('0x2f')](handleError(_0x2c7525,null));};exports[_0x0844('0x3a')]=function(_0x10a8a4,_0x181af4){return db[_0x0844('0x57')][_0x0844('0x5f')]({'where':{'id':_0x10a8a4['params']['id']}})['then'](handleEntityNotFound(_0x181af4,null))[_0x0844('0x3b')](removeEntity(_0x181af4,null))[_0x0844('0x2f')](handleError(_0x181af4,null));};exports[_0x0844('0x67')]=function(_0x1b0342,_0x54395e){return db['OpenchannelAccount'][_0x0844('0x67')]()[_0x0844('0x3b')](respondWithResult(_0x54395e,null))[_0x0844('0x2f')](handleError(_0x54395e,null));};exports['addDisposition']=function(_0x1779c0,_0x597a15,_0xba5857){if(_0x1779c0[_0x0844('0x61')]['id']){delete _0x1779c0[_0x0844('0x61')]['id'];}return db[_0x0844('0x57')]['find']({'where':{'id':_0x1779c0['params']['id']}})['then'](handleEntityNotFound(_0x597a15,null))[_0x0844('0x3b')](function(_0x4c5e26){if(_0x4c5e26){_0x1779c0['body']['OpnechannelAccountId']=_0x4c5e26['id'];return db['Disposition'][_0x0844('0x60')](_0x1779c0[_0x0844('0x61')]);}})[_0x0844('0x3b')](respondWithResult(_0x597a15,null))[_0x0844('0x2f')](handleError(_0x597a15,null));};exports[_0x0844('0x68')]=function(_0x23c9ec,_0x3f5056,_0x276977){var _0x4ddbb5={'raw':![],'where':{}};var _0x11d3ca={};var _0x15b14a={'count':0x0,'rows':[]};return db[_0x0844('0x57')][_0x0844('0x69')]({'where':{'id':_0x23c9ec[_0x0844('0x5c')]['id']}})[_0x0844('0x3b')](handleEntityNotFound(_0x3f5056,null))[_0x0844('0x3b')](function(_0x301793){if(_0x301793){_0x11d3ca[_0x0844('0x46')]=_[_0x0844('0x48')](db[_0x0844('0x6a')][_0x0844('0x43')]);_0x11d3ca['query']=_['keys'](_0x23c9ec['query']);_0x11d3ca[_0x0844('0x51')]=_[_0x0844('0x4a')](_0x11d3ca[_0x0844('0x46')],_0x11d3ca[_0x0844('0x47')]);_0x4ddbb5['attributes']=_[_0x0844('0x4a')](_0x11d3ca[_0x0844('0x46')],qs[_0x0844('0x4b')](_0x23c9ec[_0x0844('0x47')][_0x0844('0x4b')]));_0x4ddbb5['attributes']=_0x4ddbb5[_0x0844('0x49')][_0x0844('0x4c')]?_0x4ddbb5['attributes']:_0x11d3ca[_0x0844('0x46')];if(!_0x23c9ec[_0x0844('0x47')]['hasOwnProperty'](_0x0844('0x4d'))){_0x4ddbb5[_0x0844('0x34')]=qs[_0x0844('0x34')](_0x23c9ec[_0x0844('0x47')][_0x0844('0x34')]);_0x4ddbb5['offset']=qs[_0x0844('0x4e')](_0x23c9ec[_0x0844('0x47')][_0x0844('0x4e')]);}_0x4ddbb5[_0x0844('0x4f')]=qs[_0x0844('0x50')](_0x23c9ec[_0x0844('0x47')]['sort']);_0x4ddbb5[_0x0844('0x53')]=qs[_0x0844('0x51')](_['pick'](_0x23c9ec[_0x0844('0x47')],_0x11d3ca['filters']));_0x4ddbb5[_0x0844('0x53')]['OpenchannelAccountId']=_0x301793['id'];if(_0x23c9ec[_0x0844('0x47')]['filter']){_0x4ddbb5[_0x0844('0x53')]=_['merge'](_0x4ddbb5[_0x0844('0x53')],{'$or':_[_0x0844('0x42')](_0x4ddbb5[_0x0844('0x49')],function(_0x49bfeb){var _0x216643={};_0x216643[_0x49bfeb]={'$like':'%'+_0x23c9ec[_0x0844('0x47')][_0x0844('0x52')]+'%'};return _0x216643;})});}_0x4ddbb5=_['merge']({},_0x4ddbb5,_0x23c9ec[_0x0844('0x5e')]);return db[_0x0844('0x6a')][_0x0844('0x33')]({'where':_0x4ddbb5['where']})[_0x0844('0x3b')](function(_0x24fdad){_0x15b14a['count']=_0x24fdad;if(_0x23c9ec[_0x0844('0x47')]['includeAll']){_0x4ddbb5[_0x0844('0x5d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4ddbb5);})[_0x0844('0x3b')](function(_0xc8d3c9){_0x15b14a[_0x0844('0x5a')]=_0xc8d3c9;return _0x15b14a;});}})[_0x0844('0x3b')](respondWithFilteredResult(_0x3f5056,_0x4ddbb5))[_0x0844('0x2f')](handleError(_0x3f5056,null));};exports[_0x0844('0x6b')]=function(_0x2cfa1a,_0xc2747d,_0x39c7aa){return db[_0x0844('0x57')][_0x0844('0x5f')]({'where':{'id':_0x2cfa1a[_0x0844('0x5c')]['id']}})['then'](handleEntityNotFound(_0xc2747d,null))[_0x0844('0x3b')](function(_0x7eeb97){if(_0x7eeb97){return _0x7eeb97[_0x0844('0x6b')](_0x2cfa1a[_0x0844('0x47')][_0x0844('0x6c')]);}})[_0x0844('0x3b')](respondWithStatusCode(_0xc2747d,null))['catch'](handleError(_0xc2747d,null));};exports[_0x0844('0x6d')]=function(_0xda98cf,_0x5b0b6e,_0x63b94f){if(_0xda98cf['body']['id']){delete _0xda98cf['body']['id'];}return db[_0x0844('0x57')][_0x0844('0x5f')]({'where':{'id':_0xda98cf[_0x0844('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5b0b6e,null))['then'](function(_0x74cd8e){if(_0x74cd8e){_0xda98cf[_0x0844('0x61')][_0x0844('0x6e')]=_0x74cd8e['id'];return db[_0x0844('0x6f')][_0x0844('0x60')](_0xda98cf['body']);}})[_0x0844('0x3b')](respondWithResult(_0x5b0b6e,null))['catch'](handleError(_0x5b0b6e,null));};exports[_0x0844('0x70')]=function(_0x34df7a,_0xb1613b,_0x4a65dd){var _0x5d36ac={'raw':![],'where':{}};var _0x3cae63={};var _0x4ae021={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0844('0x69')]({'where':{'id':_0x34df7a[_0x0844('0x5c')]['id']}})[_0x0844('0x3b')](handleEntityNotFound(_0xb1613b,null))[_0x0844('0x3b')](function(_0x4d4d3e){if(_0x4d4d3e){_0x3cae63['model']=_[_0x0844('0x48')](db['CannedAnswer'][_0x0844('0x43')]);_0x3cae63['query']=_[_0x0844('0x48')](_0x34df7a[_0x0844('0x47')]);_0x3cae63[_0x0844('0x51')]=_[_0x0844('0x4a')](_0x3cae63[_0x0844('0x46')],_0x3cae63[_0x0844('0x47')]);_0x5d36ac['attributes']=_[_0x0844('0x4a')](_0x3cae63[_0x0844('0x46')],qs[_0x0844('0x4b')](_0x34df7a['query'][_0x0844('0x4b')]));_0x5d36ac[_0x0844('0x49')]=_0x5d36ac[_0x0844('0x49')][_0x0844('0x4c')]?_0x5d36ac['attributes']:_0x3cae63[_0x0844('0x46')];if(!_0x34df7a[_0x0844('0x47')]['hasOwnProperty'](_0x0844('0x4d'))){_0x5d36ac[_0x0844('0x34')]=qs[_0x0844('0x34')](_0x34df7a[_0x0844('0x47')][_0x0844('0x34')]);_0x5d36ac[_0x0844('0x4e')]=qs[_0x0844('0x4e')](_0x34df7a[_0x0844('0x47')][_0x0844('0x4e')]);}_0x5d36ac['order']=qs[_0x0844('0x50')](_0x34df7a[_0x0844('0x47')]['sort']);_0x5d36ac['where']=qs['filters'](_[_0x0844('0x71')](_0x34df7a['query'],_0x3cae63[_0x0844('0x51')]));_0x5d36ac[_0x0844('0x53')][_0x0844('0x6e')]=_0x4d4d3e['id'];if(_0x34df7a[_0x0844('0x47')]['filter']){_0x5d36ac[_0x0844('0x53')]=_[_0x0844('0x54')](_0x5d36ac[_0x0844('0x53')],{'$or':_['map'](_0x5d36ac[_0x0844('0x49')],function(_0x30f621){var _0x1c0eae={};_0x1c0eae[_0x30f621]={'$like':'%'+_0x34df7a[_0x0844('0x47')][_0x0844('0x52')]+'%'};return _0x1c0eae;})});}_0x5d36ac=_[_0x0844('0x54')]({},_0x5d36ac,_0x34df7a['options']);return db[_0x0844('0x6f')][_0x0844('0x33')]({'where':_0x5d36ac[_0x0844('0x53')]})['then'](function(_0x4986f5){_0x4ae021[_0x0844('0x33')]=_0x4986f5;if(_0x34df7a['query'][_0x0844('0x58')]){_0x5d36ac[_0x0844('0x5d')]=[{'all':!![]}];}return db[_0x0844('0x6f')][_0x0844('0x59')](_0x5d36ac);})[_0x0844('0x3b')](function(_0x372e66){_0x4ae021['rows']=_0x372e66;return _0x4ae021;});}})[_0x0844('0x3b')](respondWithFilteredResult(_0xb1613b,_0x5d36ac))[_0x0844('0x2f')](handleError(_0xb1613b,null));};exports[_0x0844('0x72')]=function(_0x12eaf1,_0x21ab41,_0x365d28){return db['OpenchannelAccount'][_0x0844('0x5f')]({'where':{'id':_0x12eaf1[_0x0844('0x5c')]['id']}})['then'](handleEntityNotFound(_0x21ab41,null))['then'](function(_0x21e1b0){if(_0x21e1b0){return _0x21e1b0['removeAnswers'](_0x12eaf1['query'][_0x0844('0x6c')]);}})[_0x0844('0x3b')](respondWithStatusCode(_0x21ab41,null))[_0x0844('0x2f')](handleError(_0x21ab41,null));};exports['notify']=function(_0x2fd2c5,_0x2caef1,_0x2da9c6){var _0x22e508={'body':_0x2fd2c5[_0x0844('0x61')],'channel':'openchannel'};var _0x63a46f=[];var _0x5ada2a=[];var _0x16b8d9={};var _0x5a63cd=![];return db['CmContact'][_0x0844('0x67')]()[_0x0844('0x3b')](function(_0x1b0fcc){if(!_0x1b0fcc){throw new db[(_0x0844('0x21'))]['ValidationError'](_0x0844('0x73'));}_0x63a46f=_[_0x0844('0x74')](_['keys'](_0x1b0fcc),[_0x0844('0x75'),_0x0844('0x76')]);_0x5ada2a=_['difference'](_['keys'](_0x1b0fcc),[_0x0844('0x75'),'updatedAt','CompanyId',_0x0844('0x77')]);if(_0x2fd2c5[_0x0844('0x61')]['id']){delete _0x2fd2c5[_0x0844('0x61')]['id'];}if(_['isNil'](_0x2fd2c5['body'][_0x0844('0x78')])){throw new db['Sequelize'][(_0x0844('0x22'))](_0x0844('0x79'));}if(_[_0x0844('0x7a')](_0x2fd2c5[_0x0844('0x61')]['body'])||_0x2fd2c5[_0x0844('0x61')]['body']===''){throw new db[(_0x0844('0x21'))]['ValidationError'](_0x0844('0x7b'));}if(_['isNil'](_0x2fd2c5[_0x0844('0x61')]['mapKey'])){throw new db[(_0x0844('0x21'))][(_0x0844('0x22'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ada2a);}if(!_[_0x0844('0x7c')](_0x5ada2a,_0x2fd2c5[_0x0844('0x61')][_0x0844('0x7d')])){throw new db[(_0x0844('0x21'))][(_0x0844('0x22'))](_0x0844('0x7e')+_0x5ada2a);}_0x16b8d9[_0x2fd2c5[_0x0844('0x61')]['mapKey']]=_0x2fd2c5[_0x0844('0x61')][_0x0844('0x78')];})[_0x0844('0x3b')](function(){return db['OpenchannelAccount'][_0x0844('0x5f')]({'where':{'id':_0x2fd2c5[_0x0844('0x5c')]['id']},'include':[{'model':db[_0x0844('0x7f')],'as':_0x0844('0x80'),'include':[{'model':db[_0x0844('0x81')],'as':_0x0844('0x82'),'where':_0x16b8d9,'limit':0x1,'order':[[_0x0844('0x76'),_0x0844('0x83')]]}]},{'model':db[_0x0844('0x84')],'as':_0x0844('0x85')}]});})[_0x0844('0x3b')](handleEntityNotFound(_0x2caef1,null))[_0x0844('0x3b')](function(_0x3c5bb7){if(_0x3c5bb7&&_0x3c5bb7[_0x0844('0x80')]){_0x22e508[_0x0844('0x86')]=_0x3c5bb7;_0x22e508['applications']=_0x3c5bb7[_0x0844('0x85')];_0x22e508[_0x0844('0x87')]=_0x3c5bb7['List'];_0x22e508[_0x0844('0x88')]=_[_0x0844('0x89')](_0x22e508['applications'],[_0x0844('0x8a')],[_0x0844('0x8b')]);if(_0x22e508['account'][_0x0844('0x85')]){delete _0x22e508['account']['Applications'];}if(_0x22e508[_0x0844('0x86')][_0x0844('0x80')]&&_0x22e508[_0x0844('0x86')][_0x0844('0x80')][_0x0844('0x82')]['length']){return _0x22e508[_0x0844('0x86')][_0x0844('0x80')]['Contacts'][0x0];}var _0x5ced92=_['defaults'](_0x2fd2c5[_0x0844('0x61')],{'firstName':_0x2fd2c5[_0x0844('0x61')][_0x0844('0x78')],'ListId':_0x3c5bb7[_0x0844('0x77')]});_0x5ced92[_0x2fd2c5['body'][_0x0844('0x7d')]]=_0x2fd2c5[_0x0844('0x61')][_0x0844('0x78')];return db['CmContact'][_0x0844('0x60')](_0x5ced92,{'fields':_0x63a46f,'raw':!![]});}})[_0x0844('0x3b')](handleEntityNotFound(_0x2caef1,null))[_0x0844('0x3b')](function(_0x560153){_0x22e508[_0x0844('0x8c')]=_0x560153;if(_0x560153){var _0x2de1e8={'ContactId':_0x560153['id'],'OpenchannelAccountId':_0x2fd2c5['params']['id'],'from':(_0x560153['firstName']||'')+'\x20'+(_0x560153[_0x0844('0x8d')]||'')};var _0x597050={'OpenchannelAccountId':_0x2fd2c5[_0x0844('0x5c')]['id'],'closed':![]};if(_0x2fd2c5[_0x0844('0x61')][_0x0844('0x8e')]){_0x597050[_0x0844('0x8e')]=_0x2fd2c5['body']['threadId'];return db[_0x0844('0x8f')]['find']({'where':_0x597050})[_0x0844('0x3b')](function(_0x456201){if(_0x456201){return[_0x456201,![]];}_0x2de1e8[_0x0844('0x8e')]=_0x2fd2c5['body'][_0x0844('0x8e')];_0x2de1e8[_0x0844('0x90')]=_0x2fd2c5['body'][_0x0844('0x90')];return db['OpenchannelInteraction'][_0x0844('0x60')](_0x2de1e8)[_0x0844('0x3b')](function(_0x1f2bc6){return[_0x1f2bc6,!![]];});});}else{_0x597050[_0x0844('0x8e')]=null;}_0x597050['ContactId']=_0x560153['id'];return db['OpenchannelInteraction'][_0x0844('0x5f')]({'where':_0x597050})[_0x0844('0x3b')](function(_0x4e1fcb){if(_0x4e1fcb){return[_0x4e1fcb,![]];}return db['OpenchannelInteraction'][_0x0844('0x60')](_0x2de1e8)[_0x0844('0x3b')](function(_0x2e6c51){return[_0x2e6c51,!![]];});});}})['spread'](function(_0x5768e9,_0x3dcca9){if(_0x5768e9){_0x5a63cd=_0x3dcca9;if(!_0x3dcca9){var _0x12c184={'from':(_0x22e508['contact'][_0x0844('0x91')]||'')+'\x20'+(_0x22e508[_0x0844('0x8c')][_0x0844('0x8d')]||'')};if(_0x2fd2c5['body'][_0x0844('0x8e')]&&_0x2fd2c5['body']['messageId']&&_0x2fd2c5['body']['threadId']!=_0x2fd2c5['body'][_0x0844('0x92')]){_0x12c184['threadId']=_0x2fd2c5[_0x0844('0x61')][_0x0844('0x92')];}return _0x5768e9[_0x0844('0x39')](_0x12c184);}else{return _0x5768e9;}}})[_0x0844('0x3b')](function(_0xb5bdd){_0x22e508[_0x0844('0x93')]=_0xb5bdd['get']({'plain':!![]});_0x22e508['interaction'][_0x0844('0x94')]=_0x5a63cd;if(_0x22e508[_0x0844('0x93')][_0x0844('0x94')]){if(_0x22e508[_0x0844('0x86')][_0x0844('0x95')]){_0x22e508[_0x0844('0x88')][_0x0844('0x96')]({'id':0x0,'priority':_0x22e508[_0x0844('0x88')]['length']+0x1,'app':'close','appdata':_0x0844('0x97'),'interval':'*,*,*,*'});}}return db[_0x0844('0x98')]['create']({'body':_0x2fd2c5['body']['body'],'OpenchannelAccountId':_0x2fd2c5['params']['id'],'OpenchannelInteractionId':_0xb5bdd['id'],'direction':'in','ContactId':_0x22e508[_0x0844('0x8c')]['id'],'AttachmentId':_0x2fd2c5['body'][_0x0844('0x99')]});})[_0x0844('0x3b')](function(_0x450280){_0x22e508['message']=_0x450280;if(_0x22e508[_0x0844('0x93')]['UserId']){return db[_0x0844('0x9a')][_0x0844('0x5f')]({'attributes':['id',_0x0844('0x3e')],'where':{'id':_0x22e508[_0x0844('0x93')][_0x0844('0x9b')]}})[_0x0844('0x3b')](function(_0x49b813){if(_0x49b813){_0x22e508[_0x0844('0x88')][_0x0844('0x9c')]({'id':0x0,'priority':0x0,'app':_0x0844('0x9d'),'appdata':_0x49b813['name']+','+(_0x22e508['account'][_0x0844('0x9e')]||0xa),'interval':_0x0844('0x9f')});_0x22e508['forcedOwnership']=![];}return respondWithRpcPromise(_0x0844('0xa0'),_0x0844('0xa1'),_0x22e508);});}return respondWithRpcPromise(_0x0844('0xa0'),_0x0844('0xa1'),_0x22e508);})['then'](function(_0xbd52cc){respondWithRpcPromise(_0x0844('0xa2'),_0x0844('0xa2'),{'event':'notify','message':_0xbd52cc},client9002);return _0xbd52cc;})['then'](respondWithResult(_0x2caef1,null))['catch'](handleError(_0x2caef1,null));};exports['addApplications']=function(_0xbbb5ea,_0x5d8d1a,_0x1d392c){return db[_0x0844('0x57')][_0x0844('0x69')]({'where':{'id':_0xbbb5ea[_0x0844('0x5c')]['id']}})[_0x0844('0x3b')](handleEntityNotFound(_0x5d8d1a,null))[_0x0844('0x3b')](function(_0x2f24bf){if(_0x2f24bf){return db[_0x0844('0xa3')][_0x0844('0xa4')](function(_0x10f0a8){return db[_0x0844('0x84')][_0x0844('0x3a')]({'where':{'OpenchannelAccountId':_0xbbb5ea[_0x0844('0x5c')]['id']},'transaction':_0x10f0a8})[_0x0844('0x3b')](function(_0x461d2a){var _0x229c35=_[_0x0844('0x42')](_0xbbb5ea[_0x0844('0x61')],function(_0x9fdbdd){_0x9fdbdd[_0x0844('0x6e')]=_0xbbb5ea[_0x0844('0x5c')]['id'];return _0x9fdbdd;});return db[_0x0844('0x84')][_0x0844('0xa5')](_0x229c35,{'transaction':_0x10f0a8});});})[_0x0844('0x3b')](function(){return db[_0x0844('0x84')][_0x0844('0xa6')]({'where':{'OpenchannelAccountId':_0xbbb5ea[_0x0844('0x5c')]['id']},'order':_0x0844('0x8a')});});}})[_0x0844('0x3b')](respondWithResult(_0x5d8d1a,null))[_0x0844('0x2f')](handleError(_0x5d8d1a,null));};exports[_0x0844('0xa7')]=function(_0x37cabb,_0x3eff79,_0x3bb789){var _0x294aad={};var _0x1abd68={};var _0x25f030;var _0x25d117;return db[_0x0844('0x57')][_0x0844('0x69')]({'where':{'id':_0x37cabb[_0x0844('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3eff79,null))[_0x0844('0x3b')](function(_0x2e4322){if(_0x2e4322){_0x25f030=_0x2e4322;_0x1abd68[_0x0844('0x46')]=_[_0x0844('0x48')](db['OpenchannelApplication'][_0x0844('0x43')]);_0x1abd68[_0x0844('0x47')]=_['keys'](_0x37cabb[_0x0844('0x47')]);_0x1abd68[_0x0844('0x51')]=_['intersection'](_0x1abd68[_0x0844('0x46')],_0x1abd68[_0x0844('0x47')]);_0x294aad[_0x0844('0x49')]=_['intersection'](_0x1abd68[_0x0844('0x46')],qs[_0x0844('0x4b')](_0x37cabb[_0x0844('0x47')][_0x0844('0x4b')]));_0x294aad[_0x0844('0x49')]=_0x294aad[_0x0844('0x49')][_0x0844('0x4c')]?_0x294aad[_0x0844('0x49')]:_0x1abd68[_0x0844('0x46')];_0x294aad[_0x0844('0x4f')]=qs[_0x0844('0x50')](_0x37cabb[_0x0844('0x47')][_0x0844('0x50')]);_0x294aad[_0x0844('0x53')]=qs[_0x0844('0x51')](_['pick'](_0x37cabb[_0x0844('0x47')],_0x1abd68[_0x0844('0x51')]));if(_0x37cabb[_0x0844('0x47')][_0x0844('0x52')]){_0x294aad['where']=_[_0x0844('0x54')](_0x294aad['where'],{'$or':_[_0x0844('0x42')](_0x294aad[_0x0844('0x49')],function(_0x4f3248){var _0x39ec9d={};_0x39ec9d[_0x4f3248]={'$like':'%'+_0x37cabb[_0x0844('0x47')][_0x0844('0x52')]+'%'};return _0x39ec9d;})});}_0x294aad=_[_0x0844('0x54')]({},_0x294aad,_0x37cabb['options']);return _0x25f030['getApplications'](_0x294aad);}})['then'](function(_0x5b4a8e){if(_0x5b4a8e){_0x25d117=_0x5b4a8e[_0x0844('0x4c')];if(!_0x37cabb['query'][_0x0844('0xa8')](_0x0844('0x4d'))){_0x294aad[_0x0844('0x34')]=qs[_0x0844('0x34')](_0x37cabb[_0x0844('0x47')][_0x0844('0x34')]);_0x294aad['offset']=qs[_0x0844('0x4e')](_0x37cabb[_0x0844('0x47')][_0x0844('0x4e')]);}return _0x25f030[_0x0844('0xa7')](_0x294aad);}})[_0x0844('0x3b')](function(_0xdb3a78){if(_0xdb3a78){return _0xdb3a78?{'count':_0x25d117,'rows':_0xdb3a78}:null;}})[_0x0844('0x3b')](respondWithResult(_0x3eff79,null))[_0x0844('0x2f')](handleError(_0x3eff79,null));};exports[_0x0844('0xa9')]=function(_0x311b67,_0x154599,_0x3477b8){var _0x44b4b6={'raw':![],'where':{}};var _0x601601={};var _0x34e805={'count':0x0,'rows':[]};return db[_0x0844('0x57')][_0x0844('0x69')]({'where':{'id':_0x311b67[_0x0844('0x5c')]['id']}})[_0x0844('0x3b')](handleEntityNotFound(_0x154599,null))[_0x0844('0x3b')](function(_0x481446){if(_0x481446){_0x601601['model']=_[_0x0844('0x48')](db[_0x0844('0x8f')][_0x0844('0x43')]);_0x601601['query']=_[_0x0844('0x48')](_0x311b67[_0x0844('0x47')]);_0x601601[_0x0844('0x51')]=_['intersection'](_0x601601[_0x0844('0x46')],_0x601601[_0x0844('0x47')]);_0x44b4b6[_0x0844('0x49')]=_[_0x0844('0x4a')](_0x601601[_0x0844('0x46')],qs[_0x0844('0x4b')](_0x311b67[_0x0844('0x47')]['fields']));_0x44b4b6[_0x0844('0x49')]=_0x44b4b6[_0x0844('0x49')][_0x0844('0x4c')]?_0x44b4b6['attributes']:_0x601601['model'];if(!_0x311b67[_0x0844('0x47')][_0x0844('0xa8')](_0x0844('0x4d'))){_0x44b4b6[_0x0844('0x34')]=qs[_0x0844('0x34')](_0x311b67[_0x0844('0x47')][_0x0844('0x34')]);_0x44b4b6[_0x0844('0x4e')]=qs['offset'](_0x311b67[_0x0844('0x47')][_0x0844('0x4e')]);}_0x44b4b6[_0x0844('0x4f')]=qs[_0x0844('0x50')](_0x311b67[_0x0844('0x47')][_0x0844('0x50')]);_0x44b4b6['where']=qs['filters'](_[_0x0844('0x71')](_0x311b67[_0x0844('0x47')],_0x601601[_0x0844('0x51')]));_0x44b4b6[_0x0844('0x53')][_0x0844('0x6e')]=_0x481446['id'];if(_0x311b67['query'][_0x0844('0x52')]){_0x44b4b6[_0x0844('0x53')]=_['merge'](_0x44b4b6[_0x0844('0x53')],{'$or':_[_0x0844('0x42')](_0x44b4b6[_0x0844('0x49')],function(_0x13bcce){var _0x421267={};_0x421267[_0x13bcce]={'$like':'%'+_0x311b67[_0x0844('0x47')][_0x0844('0x52')]+'%'};return _0x421267;})});}_0x44b4b6=_['merge']({},_0x44b4b6,_0x311b67[_0x0844('0x5e')]);return db[_0x0844('0x8f')][_0x0844('0x33')]({'where':_0x44b4b6['where']})[_0x0844('0x3b')](function(_0x109d3e){_0x34e805[_0x0844('0x33')]=_0x109d3e;if(_0x311b67[_0x0844('0x47')][_0x0844('0x58')]){_0x44b4b6['include']=[{'model':db[_0x0844('0x81')],'as':_0x0844('0xaa'),'required':![]},{'model':db[_0x0844('0x9a')],'as':_0x0844('0xab'),'attributes':['name',_0x0844('0xac'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x0844('0xad'),'attributes':['id',_0x0844('0x3e'),_0x0844('0xae')],'where':_0x311b67[_0x0844('0x47')][_0x0844('0xaf')]?{'id':_0x311b67['query'][_0x0844('0xaf')]}:undefined,'required':_0x311b67['query'][_0x0844('0xaf')]?!![]:![]}];}return db[_0x0844('0x8f')]['findAll'](_0x44b4b6);})[_0x0844('0x3b')](function(_0xb7d9d5){_0x34e805[_0x0844('0x5a')]=_0xb7d9d5;return _0x34e805;});}})[_0x0844('0x3b')](respondWithFilteredResult(_0x154599,_0x44b4b6))[_0x0844('0x2f')](handleError(_0x154599,null));};exports['addAgents']=function(_0x44058a,_0x25c3a3,_0x5aa13a){return db[_0x0844('0x57')][_0x0844('0x5f')]({'where':{'id':_0x44058a[_0x0844('0x5c')]['id']}})[_0x0844('0x3b')](handleEntityNotFound(_0x25c3a3,null))[_0x0844('0x3b')](function(_0x464b1d){if(_0x464b1d){return _0x464b1d['addAgents'](_0x44058a['body'][_0x0844('0x6c')],_[_0x0844('0xb0')](_0x44058a[_0x0844('0x61')],[_0x0844('0x6c'),'id'])||{})[_0x0844('0xb1')](function(_0x465a3d){for(var _0x21795e=0x0;_0x21795e<_0x44058a[_0x0844('0x61')][_0x0844('0x6c')][_0x0844('0x4c')];_0x21795e+=0x1){socket['emit'](_0x0844('0xb2'),{'UserId':_0x44058a[_0x0844('0x61')][_0x0844('0x6c')][_0x21795e],'OpenchannelAccountId':_0x44058a[_0x0844('0x5c')]['id']});}return _0x465a3d;});}})[_0x0844('0x3b')](respondWithResult(_0x25c3a3,null))[_0x0844('0x2f')](handleError(_0x25c3a3,null));};exports[_0x0844('0xb3')]=function(_0x4aa052,_0xa27b98,_0x1600bc){return db[_0x0844('0x57')]['find']({'where':{'id':_0x4aa052['params']['id']}})['then'](handleEntityNotFound(_0xa27b98,null))[_0x0844('0x3b')](function(_0x52d313){if(_0x52d313){return _0x52d313[_0x0844('0xb3')](_0x4aa052[_0x0844('0x47')][_0x0844('0x6c')])[_0x0844('0x3b')](function(){if(_['isArray'](_0x4aa052[_0x0844('0x47')][_0x0844('0x6c')])){for(var _0x16b53a=0x0;_0x16b53a<_0x4aa052[_0x0844('0x47')][_0x0844('0x6c')][_0x0844('0x4c')];_0x16b53a+=0x1){socket[_0x0844('0xb4')](_0x0844('0xb5'),{'UserId':Number(_0x4aa052[_0x0844('0x47')][_0x0844('0x6c')][_0x16b53a]),'OpenchannelAccountId':Number(_0x4aa052[_0x0844('0x5c')]['id'])});}}else{socket[_0x0844('0xb4')](_0x0844('0xb5'),{'UserId':Number(_0x4aa052[_0x0844('0x47')][_0x0844('0x6c')]),'OpenchannelAccountId':Number(_0x4aa052[_0x0844('0x5c')]['id'])});}});}})[_0x0844('0x3b')](respondWithStatusCode(_0xa27b98,null))[_0x0844('0x2f')](handleError(_0xa27b98,null));};exports[_0x0844('0xb6')]=function(_0x147090,_0x3fac14,_0x294737){var _0x12d35a={};var _0x20cc3f={};var _0x19d508;var _0x4632e1;return db[_0x0844('0x57')][_0x0844('0x69')]({'where':{'id':_0x147090[_0x0844('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3fac14,null))[_0x0844('0x3b')](function(_0x350276){if(_0x350276){_0x19d508=_0x350276;_0x20cc3f[_0x0844('0x46')]=_[_0x0844('0x48')](db[_0x0844('0x9a')][_0x0844('0x43')]);_0x20cc3f[_0x0844('0x47')]=_[_0x0844('0x48')](_0x147090[_0x0844('0x47')]);_0x20cc3f[_0x0844('0x51')]=_[_0x0844('0x4a')](_0x20cc3f[_0x0844('0x46')],_0x20cc3f['query']);_0x12d35a[_0x0844('0x49')]=_['intersection'](_0x20cc3f[_0x0844('0x46')],qs[_0x0844('0x4b')](_0x147090[_0x0844('0x47')][_0x0844('0x4b')]));_0x12d35a[_0x0844('0x49')]=_0x12d35a[_0x0844('0x49')]['length']?_0x12d35a[_0x0844('0x49')]:_0x20cc3f[_0x0844('0x46')];_0x12d35a['order']=qs['sort'](_0x147090[_0x0844('0x47')][_0x0844('0x50')]);_0x12d35a[_0x0844('0x53')]=qs[_0x0844('0x51')](_['pick'](_0x147090['query'],_0x20cc3f[_0x0844('0x51')]));if(_0x147090[_0x0844('0x47')][_0x0844('0x52')]){_0x12d35a[_0x0844('0x53')]=_[_0x0844('0x54')](_0x12d35a[_0x0844('0x53')],{'$or':_['map'](_0x12d35a['attributes'],function(_0x2d544c){var _0x5c0fbb={};_0x5c0fbb[_0x2d544c]={'$like':'%'+_0x147090[_0x0844('0x47')]['filter']+'%'};return _0x5c0fbb;})});}_0x12d35a=_[_0x0844('0x54')]({},_0x12d35a,_0x147090[_0x0844('0x5e')]);return _0x19d508[_0x0844('0xb6')](_0x12d35a);}})[_0x0844('0x3b')](function(_0x45f59a){if(_0x45f59a){_0x4632e1=_0x45f59a['length'];if(!_0x147090[_0x0844('0x47')]['hasOwnProperty'](_0x0844('0x4d'))){_0x12d35a[_0x0844('0x34')]=qs[_0x0844('0x34')](_0x147090['query']['limit']);_0x12d35a[_0x0844('0x4e')]=qs[_0x0844('0x4e')](_0x147090[_0x0844('0x47')][_0x0844('0x4e')]);}return _0x19d508['getAgents'](_0x12d35a);}})[_0x0844('0x3b')](function(_0x113177){if(_0x113177){return _0x113177?{'count':_0x4632e1,'rows':_0x113177}:null;}})['then'](respondWithResult(_0x3fac14,null))[_0x0844('0x2f')](handleError(_0x3fac14,null));};exports['send']=function(_0x2253a1,_0x40bde9,_0x11a718){var _0x57cce8,_0x7917e,_0x375062;if(_[_0x0844('0x7a')](_0x2253a1[_0x0844('0x61')]['body'])||_0x2253a1[_0x0844('0x61')][_0x0844('0x61')]===''){throw new db[(_0x0844('0x21'))][(_0x0844('0x22'))](_0x0844('0x7b'));}if(_[_0x0844('0x7a')](_0x2253a1[_0x0844('0x61')]['to'])){}_0x57cce8=_0x2253a1['body']['to'];return db[_0x0844('0x57')][_0x0844('0x69')]({'where':{'id':_0x2253a1['params']['id']}})[_0x0844('0x3b')](handleEntityNotFound(_0x40bde9,null))[_0x0844('0x3b')](function(_0x2feb1f){if(_0x2feb1f){return db[_0x0844('0x57')]['find']({'where':{'id':_0x2feb1f['id']},'include':[{'model':db['CmList'],'as':_0x0844('0x80'),'include':[{'model':db[_0x0844('0x81')],'as':_0x0844('0x82'),'where':{[_0x2feb1f['mapKey']]:_0x57cce8},'limit':0x1,'order':[[_0x0844('0x76'),_0x0844('0x83')]]}]}]})[_0x0844('0x3b')](handleEntityNotFound(_0x40bde9,null))[_0x0844('0x3b')](function(_0x841db2){if(_0x841db2&&_0x841db2[_0x0844('0x80')]){_0x7917e=_0x841db2[_0x0844('0x64')]({'plain':!![]});if(_0x7917e['List']&&_0x7917e[_0x0844('0x80')][_0x0844('0x82')][_0x0844('0x4c')]){return _0x7917e[_0x0844('0x80')][_0x0844('0x82')][0x0];}return db[_0x0844('0x81')][_0x0844('0x60')](_[_0x0844('0xb7')](_0x2253a1['body'],{'firstName':_0x57cce8,[_0x841db2['mapKey']]:_0x57cce8,'phone':_0x57cce8,'ListId':_0x7917e[_0x0844('0x77')]}));}})[_0x0844('0x3b')](handleEntityNotFound(_0x40bde9,null))[_0x0844('0x3b')](function(_0x47764e){if(_0x47764e){_0x375062=_0x47764e;return db[_0x0844('0x8f')][_0x0844('0x5f')]({'where':{'ContactId':_0x375062['id'],'closed':![],'OpenchannelAccountId':_0x7917e['id']}})[_0x0844('0x3b')](function(_0x37716e){if(_0x37716e){return[_0x37716e,![]];}return db[_0x0844('0x8f')][_0x0844('0x60')]({'UserId':_0x2253a1[_0x0844('0x62')]['id'],'ContactId':_0x375062['id'],'OpenchannelAccountId':_0x7917e['id'],'lastMsgDirection':'out','Messages':[_[_0x0844('0x54')](_0x2253a1[_0x0844('0x61')],{'read':![],'body':_0x2253a1[_0x0844('0x61')]['body'],'OpenchannelAccountId':_0x7917e['id'],'UserId':_0x2253a1[_0x0844('0x62')]['id'],'ContactId':_0x375062['id']})]},{'include':[{'model':db[_0x0844('0x98')],'as':_0x0844('0xb8')}]})['then'](function(_0x1aa943){return[_0x1aa943,!![]];});});}})[_0x0844('0xb1')](function(_0xbdc64d,_0x18982f){if(_0x18982f){return _0xbdc64d;}return db['OpenchannelMessage'][_0x0844('0x60')](_['merge'](_0x2253a1[_0x0844('0x61')],{'read':![],'body':_0x2253a1[_0x0844('0x61')][_0x0844('0x61')],'OpenchannelAccountId':_0x7917e['id'],'OpenchannelInteractionId':_0xbdc64d['id'],'UserId':_0x2253a1[_0x0844('0x62')]['id'],'ContactId':_0x375062['id']}))[_0x0844('0x3b')](function(_0x325342){_0xbdc64d['dataValues']['Messages']=[];_0xbdc64d['dataValues'][_0x0844('0xb8')]['push'](_0x325342['dataValues']);return _0xbdc64d;});});}})[_0x0844('0x3b')](respondWithResult(_0x40bde9,null))['catch'](handleError(_0x40bde9,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a587623..94b3f06 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 _0x677a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x677a,0x7d));var _0xa677=function(_0x4932e3,_0x3bcbec){_0x4932e3=_0x4932e3-0x0;var _0xfccb07=_0x677a[_0x4932e3];return _0xfccb07;};'use strict';var EventEmitter=require(_0xa677('0x0'));var OpenchannelAccount=require(_0xa677('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa677('0x2')](0x0);var events={'afterCreate':_0xa677('0x3'),'afterUpdate':_0xa677('0x4'),'afterDestroy':_0xa677('0x5')};function emitEvent(_0xe7cbc2){return function(_0x3546e8,_0xb9acae,_0x1309b3){OpenchannelAccountEvents[_0xa677('0x6')](_0xe7cbc2+':'+_0x3546e8['id'],_0x3546e8);OpenchannelAccountEvents['emit'](_0xe7cbc2,_0x3546e8);_0x1309b3(null);};}for(var e in events){if(events[_0xa677('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa677('0x8')](e,emitEvent(event));}}module[_0xa677('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x5247=['update','emit','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x5247,0x1f3));var _0x7524=function(_0xe9623b,_0x195170){_0xe9623b=_0xe9623b-0x0;var _0x222b5c=_0x5247[_0xe9623b];return _0x222b5c;};'use strict';var EventEmitter=require(_0x7524('0x0'));var OpenchannelAccount=require(_0x7524('0x1'))['db'][_0x7524('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7524('0x3')](0x0);var events={'afterCreate':_0x7524('0x4'),'afterUpdate':_0x7524('0x5'),'afterDestroy':'remove'};function emitEvent(_0x473d1c){return function(_0x73183b,_0x9b232a,_0xf5bbdc){OpenchannelAccountEvents[_0x7524('0x6')](_0x473d1c+':'+_0x73183b['id'],_0x73183b);OpenchannelAccountEvents[_0x7524('0x6')](_0x473d1c,_0x73183b);_0xf5bbdc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x7524('0x7')](e,emitEvent(event));}}module[_0x7524('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 2e8eef8..1cbc0f9 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 _0x38a5=['path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','util','../../config/logger','request-promise'];(function(_0x4e33c0,_0x555fda){var _0x1f7aa3=function(_0x2b688b){while(--_0x2b688b){_0x4e33c0['push'](_0x4e33c0['shift']());}};_0x1f7aa3(++_0x555fda);}(_0x38a5,0x1aa));var _0x538a=function(_0x458d59,_0x201d8d){_0x458d59=_0x458d59-0x0;var _0x213c63=_0x38a5[_0x458d59];return _0x213c63;};'use strict';var _=require('lodash');var util=require(_0x538a('0x0'));var logger=require(_0x538a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x538a('0x2'));var fs=require('fs');var path=require(_0x538a('0x3'));var rimraf=require(_0x538a('0x4'));var config=require(_0x538a('0x5'));var attributes=require(_0x538a('0x6'));module[_0x538a('0x7')]=function(_0x46b81a,_0x3e816a){return _0x46b81a[_0x538a('0x8')](_0x538a('0x9'),attributes,{'tableName':_0x538a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe632=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','openchannel_accounts'];(function(_0x254abd,_0x1ab7f0){var _0x31bf1b=function(_0x447fd8){while(--_0x447fd8){_0x254abd['push'](_0x254abd['shift']());}};_0x31bf1b(++_0x1ab7f0);}(_0xe632,0x113));var _0x2e63=function(_0x2527d0,_0x57bace){_0x2527d0=_0x2527d0-0x0;var _0x48e377=_0xe632[_0x2527d0];return _0x48e377;};'use strict';var _=require(_0x2e63('0x0'));var util=require(_0x2e63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2e63('0x2'));var BPromise=require(_0x2e63('0x3'));var rp=require(_0x2e63('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e63('0x5'));var config=require(_0x2e63('0x6'));var attributes=require(_0x2e63('0x7'));module[_0x2e63('0x8')]=function(_0x51c349,_0xd15dd5){return _0x51c349[_0x2e63('0x9')]('OpenchannelAccount',attributes,{'tableName':_0x2e63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index fdb9361..7bf1764 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 _0x658b=['redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0xe004a9,_0x29eab9){var _0x3c097b=function(_0x2098f6){while(--_0x2098f6){_0xe004a9['push'](_0xe004a9['shift']());}};_0x3c097b(++_0x29eab9);}(_0x658b,0x11f));var _0xb658=function(_0xa25ebf,_0x5393f0){_0xa25ebf=_0xa25ebf-0x0;var _0x3d033d=_0x658b[_0xa25ebf];return _0x3d033d;};'use strict';var _=require(_0xb658('0x0'));var util=require(_0xb658('0x1'));var moment=require(_0xb658('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb658('0x3'));var db=require(_0xb658('0x4'))['db'];var utils=require(_0xb658('0x5'));var logger=require(_0xb658('0x6'))(_0xb658('0x7'));var config=require('../../config/environment');var jayson=require(_0xb658('0x8'));var client=jayson['client'][_0xb658('0x9')]({'port':0x232a});config[_0xb658('0xa')]=_[_0xb658('0xb')](config[_0xb658('0xa')],{'host':_0xb658('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb658('0xa')]));require(_0xb658('0xd'))[_0xb658('0xe')](socket);function respondWithRpcPromise(_0x2116d6,_0x1a728f,_0x4de14a){return new BPromise(function(_0x59a7f1,_0x2247e3){return client[_0xb658('0xf')](_0x2116d6,_0x4de14a)[_0xb658('0x10')](function(_0x52739e){logger[_0xb658('0x11')](_0xb658('0x12'),_0x1a728f,'request\x20sent');logger[_0xb658('0x13')](_0xb658('0x14'),_0x1a728f,_0xb658('0x15'),JSON[_0xb658('0x16')](_0x52739e));if(_0x52739e[_0xb658('0x17')]){if(_0x52739e[_0xb658('0x17')][_0xb658('0x18')]===0x1f4){logger[_0xb658('0x17')](_0xb658('0x12'),_0x1a728f,_0x52739e[_0xb658('0x17')][_0xb658('0x19')]);return _0x2247e3(_0x52739e['error'][_0xb658('0x19')]);}logger['error'](_0xb658('0x12'),_0x1a728f,_0x52739e[_0xb658('0x17')][_0xb658('0x19')]);return _0x59a7f1(_0x52739e[_0xb658('0x17')][_0xb658('0x19')]);}else{logger[_0xb658('0x11')](_0xb658('0x12'),_0x1a728f,_0xb658('0x15'));_0x59a7f1(_0x52739e[_0xb658('0x1a')][_0xb658('0x19')]);}})['catch'](function(_0x1ece11){logger[_0xb658('0x17')](_0xb658('0x12'),_0x1a728f,_0x1ece11);_0x2247e3(_0x1ece11);});});} \ No newline at end of file +var _0xe7c5=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xe7c5,0x162));var _0x5e7c=function(_0x2e9dba,_0x40b21e){_0x2e9dba=_0x2e9dba-0x0;var _0x3e24a3=_0xe7c5[_0x2e9dba];return _0x3e24a3;};'use strict';var _=require(_0x5e7c('0x0'));var util=require(_0x5e7c('0x1'));var moment=require(_0x5e7c('0x2'));var BPromise=require(_0x5e7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5e7c('0x5'))('rpc');var config=require(_0x5e7c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5e7c('0x7')]({'port':0x232a});config['redis']=_[_0x5e7c('0x8')](config[_0x5e7c('0x9')],{'host':_0x5e7c('0xa'),'port':0x18eb});var socket=require(_0x5e7c('0xb'))(new Redis(config[_0x5e7c('0x9')]));require(_0x5e7c('0xc'))[_0x5e7c('0xd')](socket);function respondWithRpcPromise(_0x14f5fe,_0x5294c5,_0x20ee48){return new BPromise(function(_0x53661b,_0x532728){return client[_0x5e7c('0xe')](_0x14f5fe,_0x20ee48)[_0x5e7c('0xf')](function(_0x187fa3){logger[_0x5e7c('0x10')](_0x5e7c('0x11'),_0x5294c5,_0x5e7c('0x12'));logger['debug'](_0x5e7c('0x13'),_0x5294c5,_0x5e7c('0x12'),JSON[_0x5e7c('0x14')](_0x187fa3));if(_0x187fa3[_0x5e7c('0x15')]){if(_0x187fa3['error'][_0x5e7c('0x16')]===0x1f4){logger['error'](_0x5e7c('0x11'),_0x5294c5,_0x187fa3[_0x5e7c('0x15')][_0x5e7c('0x17')]);return _0x532728(_0x187fa3['error'][_0x5e7c('0x17')]);}logger['error'](_0x5e7c('0x11'),_0x5294c5,_0x187fa3[_0x5e7c('0x15')]['message']);return _0x53661b(_0x187fa3[_0x5e7c('0x15')]['message']);}else{logger['info'](_0x5e7c('0x11'),_0x5294c5,_0x5e7c('0x12'));_0x53661b(_0x187fa3[_0x5e7c('0x18')][_0x5e7c('0x17')]);}})['catch'](function(_0x55dc4b){logger[_0x5e7c('0x15')](_0x5e7c('0x11'),_0x5294c5,_0x55dc4b);_0x532728(_0x55dc4b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e2d384f..a73b9f1 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 _0x93bb=['length','./openchannelAccount.events','save','remove','emit','removeListener','register'];(function(_0x6552e9,_0x232ad2){var _0x30d56b=function(_0x2d346f){while(--_0x2d346f){_0x6552e9['push'](_0x6552e9['shift']());}};_0x30d56b(++_0x232ad2);}(_0x93bb,0xe8));var _0xb93b=function(_0x394b59,_0x17eff0){_0x394b59=_0x394b59-0x0;var _0x10ccf7=_0x93bb[_0x394b59];return _0x10ccf7;};'use strict';var OpenchannelAccountEvents=require(_0xb93b('0x0'));var events=[_0xb93b('0x1'),_0xb93b('0x2'),'update'];function createListener(_0x5d641d,_0xfca273){return function(_0x4450c8){_0xfca273[_0xb93b('0x3')](_0x5d641d,_0x4450c8);};}function removeListener(_0x56f4b3,_0x540f91){return function(){OpenchannelAccountEvents[_0xb93b('0x4')](_0x56f4b3,_0x540f91);};}exports[_0xb93b('0x5')]=function(_0x3d0c6a){for(var _0x89406=0x0,_0x26fa91=events[_0xb93b('0x6')];_0x89406<_0x26fa91;_0x89406++){var _0x405c6a=events[_0x89406];var _0xc1290e=createListener('openchannelAccount:'+_0x405c6a,_0x3d0c6a);OpenchannelAccountEvents['on'](_0x405c6a,_0xc1290e);}}; \ No newline at end of file +var _0xe030=['remove','update','register','length','./openchannelAccount.events','save'];(function(_0xa49b00,_0x15dc38){var _0x17aeab=function(_0x15504c){while(--_0x15504c){_0xa49b00['push'](_0xa49b00['shift']());}};_0x17aeab(++_0x15dc38);}(_0xe030,0xdc));var _0x0e03=function(_0xd63b06,_0x34850f){_0xd63b06=_0xd63b06-0x0;var _0x343035=_0xe030[_0xd63b06];return _0x343035;};'use strict';var OpenchannelAccountEvents=require(_0x0e03('0x0'));var events=[_0x0e03('0x1'),_0x0e03('0x2'),_0x0e03('0x3')];function createListener(_0x4a99b9,_0x33a7a7){return function(_0x2f45f7){_0x33a7a7['emit'](_0x4a99b9,_0x2f45f7);};}function removeListener(_0x533429,_0x36fa8c){return function(){OpenchannelAccountEvents['removeListener'](_0x533429,_0x36fa8c);};}exports[_0x0e03('0x4')]=function(_0x5232d0){for(var _0x1cbb58=0x0,_0x57c33b=events[_0x0e03('0x5')];_0x1cbb58<_0x57c33b;_0x1cbb58++){var _0x26bf69=events[_0x1cbb58];var _0x394244=createListener('openchannelAccount:'+_0x26bf69,_0x5232d0);OpenchannelAccountEvents['on'](_0x26bf69,_0x394244);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3d43d95..712fff1 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 _0xb434=['post','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x4e2adf,_0x2c273){var _0x113d4f=function(_0x43c686){while(--_0x43c686){_0x4e2adf['push'](_0x4e2adf['shift']());}};_0x113d4f(++_0x2c273);}(_0xb434,0xe4));var _0x4b43=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0xb434[_0x6dfbaa];return _0xfbe02;};'use strict';var multer=require(_0x4b43('0x0'));var util=require(_0x4b43('0x1'));var path=require(_0x4b43('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b43('0x3'));var router=express['Router']();var auth=require(_0x4b43('0x4'));var interaction=require(_0x4b43('0x5'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x4b43('0x6')]('/',auth[_0x4b43('0x7')](),controller[_0x4b43('0x8')]);router[_0x4b43('0x6')](_0x4b43('0x9'),auth[_0x4b43('0x7')](),controller['show']);router[_0x4b43('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4b43('0x9'),auth[_0x4b43('0x7')](),controller['update']);router[_0x4b43('0xb')](_0x4b43('0x9'),auth[_0x4b43('0x7')](),controller[_0x4b43('0xc')]);module[_0x4b43('0xd')]=router; \ No newline at end of file +var _0x49b1=['delete','destroy','exports','util','path','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','show','post','put','/:id','update'];(function(_0x34cea1,_0x16d860){var _0x2d796a=function(_0x11e340){while(--_0x11e340){_0x34cea1['push'](_0x34cea1['shift']());}};_0x2d796a(++_0x16d860);}(_0x49b1,0x133));var _0x149b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49b1[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x149b('0x0'));var path=require(_0x149b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x149b('0x2'));var config=require(_0x149b('0x3'));var controller=require(_0x149b('0x4'));router[_0x149b('0x5')]('/',auth['isAuthenticated'](),controller[_0x149b('0x6')]);router['get']('/:id',auth[_0x149b('0x7')](),controller[_0x149b('0x8')]);router[_0x149b('0x9')]('/',auth[_0x149b('0x7')](),controller['create']);router[_0x149b('0xa')](_0x149b('0xb'),auth[_0x149b('0x7')](),controller[_0x149b('0xc')]);router[_0x149b('0xd')](_0x149b('0xb'),auth['isAuthenticated'](),controller[_0x149b('0xe')]);module[_0x149b('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 1ddb1e9..512d29f 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 _0xc988=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x4005e8,_0x52a3b5){var _0x2d2903=function(_0x21bac7){while(--_0x21bac7){_0x4005e8['push'](_0x4005e8['shift']());}};_0x2d2903(++_0x52a3b5);}(_0xc988,0x12f));var _0x8c98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc988[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x8c98('0x0'));module[_0x8c98('0x1')]={'priority':{'type':Sequelize[_0x8c98('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8c98('0x3')],'allowNull':![],'defaultValue':_0x8c98('0x4')},'appdata':{'type':Sequelize[_0x8c98('0x5')]()},'description':{'type':Sequelize[_0x8c98('0x3')]},'interval':{'type':Sequelize[_0x8c98('0x3')],'defaultValue':_0x8c98('0x6')}}; \ No newline at end of file +var _0x21a6=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x360f8f,_0x8868be){var _0x48aa7b=function(_0x38e332){while(--_0x38e332){_0x360f8f['push'](_0x360f8f['shift']());}};_0x48aa7b(++_0x8868be);}(_0x21a6,0xf0));var _0x621a=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x21a6[_0x4e1a49];return _0x136aae;};'use strict';var Sequelize=require(_0x621a('0x0'));module[_0x621a('0x1')]={'priority':{'type':Sequelize[_0x621a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x621a('0x3')],'allowNull':![],'defaultValue':_0x621a('0x4')},'appdata':{'type':Sequelize[_0x621a('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 047edaa..af41dbc 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 _0x7f1d=['sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','end','status','json','count','offset','limit','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x3990e6,_0x1091bc){var _0x12ed6d=function(_0x14e260){while(--_0x14e260){_0x3990e6['push'](_0x3990e6['shift']());}};_0x12ed6d(++_0x1091bc);}(_0x7f1d,0x8e));var _0xd7f1=function(_0x4454b2,_0x3f408b){_0x4454b2=_0x4454b2-0x0;var _0x50b8f1=_0x7f1d[_0x4454b2];return _0x50b8f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7f1('0x1'));var jsonpatch=require(_0xd7f1('0x2'));var rp=require(_0xd7f1('0x3'));var moment=require(_0xd7f1('0x4'));var BPromise=require(_0xd7f1('0x5'));var Mustache=require('mustache');var util=require(_0xd7f1('0x6'));var path=require(_0xd7f1('0x7'));var sox=require(_0xd7f1('0x8'));var csv=require(_0xd7f1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd7f1('0xa'));var crypto=require(_0xd7f1('0xb'));var jsforce=require(_0xd7f1('0xc'));var deskjs=require(_0xd7f1('0xd'));var toCsv=require(_0xd7f1('0x9'));var querystring=require('querystring');var Papa=require(_0xd7f1('0xe'));var Redis=require(_0xd7f1('0xf'));var authService=require(_0xd7f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd7f1('0x11'));var hardwareService=require(_0xd7f1('0x12'));var logger=require(_0xd7f1('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd7f1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e531c,_0x3bce4){_0x3bce4=_0x3bce4||0xcc;return function(_0x4993e0){if(_0x4993e0){return _0x2e531c['sendStatus'](_0x3bce4);}return _0x2e531c['status'](_0x3bce4)[_0xd7f1('0x15')]();};}function respondWithResult(_0x5224b1,_0x3f8994){_0x3f8994=_0x3f8994||0xc8;return function(_0x266297){if(_0x266297){return _0x5224b1[_0xd7f1('0x16')](_0x3f8994)[_0xd7f1('0x17')](_0x266297);}};}function respondWithFilteredResult(_0x24357b,_0x38e426){return function(_0x77de72){if(_0x77de72){var _0x9598e4=_0x77de72[_0xd7f1('0x18')],_0x40b99c=_0x38e426['offset'],_0xac5031=_0x38e426[_0xd7f1('0x19')]+_0x38e426[_0xd7f1('0x1a')],_0xb3932c;if(_0xac5031>=_0x9598e4){_0xac5031=_0x9598e4;_0xb3932c=0xc8;}else{_0xb3932c=0xce;}_0x24357b[_0xd7f1('0x16')](_0xb3932c);return _0x24357b['set']('Content-Range',_0x40b99c+'-'+_0xac5031+'/'+_0x9598e4)[_0xd7f1('0x17')](_0x77de72);}return null;};}function patchUpdates(_0x2b4bbe){return function(_0x5b1876){try{jsonpatch['apply'](_0x5b1876,_0x2b4bbe,!![]);}catch(_0x200c44){return BPromise[_0xd7f1('0x1b')](_0x200c44);}return _0x5b1876['save']();};}function saveUpdates(_0x39ec66,_0x46cb26){return function(_0x255ad8){if(_0x255ad8){return _0x255ad8[_0xd7f1('0x1c')](_0x39ec66)[_0xd7f1('0x1d')](function(_0x39787){return _0x39787;});}return null;};}function removeEntity(_0x2af644,_0x544f31){return function(_0x2af486){if(_0x2af486){return _0x2af486[_0xd7f1('0x1e')]()[_0xd7f1('0x1d')](function(){_0x2af644['status'](0xcc)[_0xd7f1('0x15')]();});}};}function handleEntityNotFound(_0x3d0496,_0x5d0f11){return function(_0x50b90e){if(!_0x50b90e){_0x3d0496[_0xd7f1('0x1f')](0x194);}return _0x50b90e;};}function handleError(_0x880681,_0x47ab4b){_0x47ab4b=_0x47ab4b||0x1f4;return function(_0x4f4c94){logger[_0xd7f1('0x20')](_0x4f4c94[_0xd7f1('0x21')]);if(_0x4f4c94[_0xd7f1('0x22')]){delete _0x4f4c94['name'];}_0x880681[_0xd7f1('0x16')](_0x47ab4b)[_0xd7f1('0x23')](_0x4f4c94);};}exports[_0xd7f1('0x24')]=function(_0x19a1c4,_0x734062){var _0x116335={},_0x1fc2df={},_0x60a768={'count':0x0,'rows':[]};var _0x48a1ab=_[_0xd7f1('0x25')](db[_0xd7f1('0x26')][_0xd7f1('0x27')],function(_0x44b226){return{'name':_0x44b226['fieldName'],'type':_0x44b226[_0xd7f1('0x28')][_0xd7f1('0x29')]};});_0x1fc2df[_0xd7f1('0x2a')]=_['map'](_0x48a1ab,_0xd7f1('0x22'));_0x1fc2df['query']=_[_0xd7f1('0x2b')](_0x19a1c4[_0xd7f1('0x2c')]);_0x1fc2df[_0xd7f1('0x2d')]=_[_0xd7f1('0x2e')](_0x1fc2df[_0xd7f1('0x2a')],_0x1fc2df[_0xd7f1('0x2c')]);_0x116335['attributes']=_[_0xd7f1('0x2e')](_0x1fc2df[_0xd7f1('0x2a')],qs[_0xd7f1('0x2f')](_0x19a1c4['query']['fields']));_0x116335[_0xd7f1('0x30')]=_0x116335['attributes']['length']?_0x116335[_0xd7f1('0x30')]:_0x1fc2df['model'];if(!_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x31')]('nolimit')){_0x116335[_0xd7f1('0x1a')]=qs['limit'](_0x19a1c4[_0xd7f1('0x2c')]['limit']);_0x116335[_0xd7f1('0x19')]=qs[_0xd7f1('0x19')](_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x19')]);}_0x116335['order']=qs[_0xd7f1('0x32')](_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x32')]);_0x116335[_0xd7f1('0x33')]=qs['filters'](_['pick'](_0x19a1c4[_0xd7f1('0x2c')],_0x1fc2df[_0xd7f1('0x2d')]),_0x48a1ab);if(_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x34')]){_0x116335[_0xd7f1('0x33')]=_[_0xd7f1('0x35')](_0x116335[_0xd7f1('0x33')],{'$or':_[_0xd7f1('0x25')](_0x48a1ab,function(_0x4d4a1f){if(_0x4d4a1f[_0xd7f1('0x28')]!==_0xd7f1('0x36')){var _0x518884={};_0x518884[_0x4d4a1f[_0xd7f1('0x22')]]={'$like':'%'+_0x19a1c4[_0xd7f1('0x2c')][_0xd7f1('0x34')]+'%'};return _0x518884;}})});}_0x116335=_[_0xd7f1('0x35')]({},_0x116335,_0x19a1c4[_0xd7f1('0x37')]);var _0x39cb34={'where':_0x116335[_0xd7f1('0x33')]};return db[_0xd7f1('0x26')][_0xd7f1('0x18')](_0x39cb34)['then'](function(_0x285250){_0x60a768[_0xd7f1('0x18')]=_0x285250;if(_0x19a1c4[_0xd7f1('0x2c')]['includeAll']){_0x116335[_0xd7f1('0x38')]=[{'all':!![]}];}return db[_0xd7f1('0x26')][_0xd7f1('0x39')](_0x116335);})['then'](function(_0xc390cf){_0x60a768[_0xd7f1('0x3a')]=_0xc390cf;return _0x60a768;})[_0xd7f1('0x1d')](respondWithFilteredResult(_0x734062,_0x116335))[_0xd7f1('0x3b')](handleError(_0x734062,null));};exports['show']=function(_0x52cba3,_0x5c0d7a){var _0xd2a423={'raw':!![],'where':{'id':_0x52cba3[_0xd7f1('0x3c')]['id']}},_0x478797={};_0x478797[_0xd7f1('0x2a')]=_[_0xd7f1('0x2b')](db['OpenchannelApplication'][_0xd7f1('0x27')]);_0x478797[_0xd7f1('0x2c')]=_['keys'](_0x52cba3[_0xd7f1('0x2c')]);_0x478797['filters']=_['intersection'](_0x478797[_0xd7f1('0x2a')],_0x478797[_0xd7f1('0x2c')]);_0xd2a423[_0xd7f1('0x30')]=_['intersection'](_0x478797[_0xd7f1('0x2a')],qs[_0xd7f1('0x2f')](_0x52cba3[_0xd7f1('0x2c')][_0xd7f1('0x2f')]));_0xd2a423[_0xd7f1('0x30')]=_0xd2a423['attributes']['length']?_0xd2a423[_0xd7f1('0x30')]:_0x478797[_0xd7f1('0x2a')];if(_0x52cba3[_0xd7f1('0x2c')][_0xd7f1('0x3d')]){_0xd2a423[_0xd7f1('0x38')]=[{'all':!![]}];}_0xd2a423=_['merge']({},_0xd2a423,_0x52cba3[_0xd7f1('0x37')]);return db['OpenchannelApplication'][_0xd7f1('0x3e')](_0xd2a423)[_0xd7f1('0x1d')](handleEntityNotFound(_0x5c0d7a,null))[_0xd7f1('0x1d')](respondWithResult(_0x5c0d7a,null))['catch'](handleError(_0x5c0d7a,null));};exports['create']=function(_0x5a36f9,_0x2146c3){return db[_0xd7f1('0x26')]['create'](_0x5a36f9[_0xd7f1('0x3f')],{})[_0xd7f1('0x1d')](respondWithResult(_0x2146c3,0xc9))[_0xd7f1('0x3b')](handleError(_0x2146c3,null));};exports[_0xd7f1('0x1c')]=function(_0x299fea,_0x14e570){if(_0x299fea[_0xd7f1('0x3f')]['id']){delete _0x299fea['body']['id'];}return db[_0xd7f1('0x26')][_0xd7f1('0x3e')]({'where':{'id':_0x299fea[_0xd7f1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x14e570,null))['then'](saveUpdates(_0x299fea[_0xd7f1('0x3f')],null))[_0xd7f1('0x1d')](respondWithResult(_0x14e570,null))[_0xd7f1('0x3b')](handleError(_0x14e570,null));};exports[_0xd7f1('0x1e')]=function(_0x4cd53d,_0x4d5aaf){return db[_0xd7f1('0x26')][_0xd7f1('0x3e')]({'where':{'id':_0x4cd53d[_0xd7f1('0x3c')]['id']}})[_0xd7f1('0x1d')](handleEntityNotFound(_0x4d5aaf,null))['then'](removeEntity(_0x4d5aaf,null))[_0xd7f1('0x3b')](handleError(_0x4d5aaf,null));}; \ No newline at end of file +var _0x5cae=['ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','intersection','merge','catch','create','body','find','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox'];(function(_0x3eed3f,_0x5253b5){var _0xd68fd8=function(_0x3395c4){while(--_0x3395c4){_0x3eed3f['push'](_0x3eed3f['shift']());}};_0xd68fd8(++_0x5253b5);}(_0x5cae,0x1b3));var _0xe5ca=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0x5cae[_0x118653];return _0xc11fa6;};'use strict';var pdf=require(_0xe5ca('0x0'));var emlformat=require(_0xe5ca('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe5ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5ca('0x3'));var moment=require(_0xe5ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe5ca('0x5'));var util=require(_0xe5ca('0x6'));var path=require(_0xe5ca('0x7'));var sox=require(_0xe5ca('0x8'));var csv=require('to-csv');var ejs=require(_0xe5ca('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe5ca('0xa'));var crypto=require(_0xe5ca('0xb'));var jsforce=require(_0xe5ca('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe5ca('0xd'));var querystring=require(_0xe5ca('0xe'));var Papa=require(_0xe5ca('0xf'));var Redis=require('ioredis');var authService=require(_0xe5ca('0x10'));var qs=require(_0xe5ca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5ca('0x12'));var logger=require(_0xe5ca('0x13'))('api');var utils=require(_0xe5ca('0x14'));var config=require(_0xe5ca('0x15'));var db=require(_0xe5ca('0x16'))['db'];function respondWithStatusCode(_0x12d267,_0x50ee70){_0x50ee70=_0x50ee70||0xcc;return function(_0x130a84){if(_0x130a84){return _0x12d267[_0xe5ca('0x17')](_0x50ee70);}return _0x12d267['status'](_0x50ee70)[_0xe5ca('0x18')]();};}function respondWithResult(_0x2803d6,_0x1ab9d9){_0x1ab9d9=_0x1ab9d9||0xc8;return function(_0x228aa2){if(_0x228aa2){return _0x2803d6[_0xe5ca('0x19')](_0x1ab9d9)[_0xe5ca('0x1a')](_0x228aa2);}};}function respondWithFilteredResult(_0x43d1f1,_0x4cf01b){return function(_0x468e0a){if(_0x468e0a){var _0x339c74=_0x468e0a[_0xe5ca('0x1b')],_0x2c4d2e=_0x4cf01b[_0xe5ca('0x1c')],_0xc34521=_0x4cf01b[_0xe5ca('0x1c')]+_0x4cf01b[_0xe5ca('0x1d')],_0x5cd788;if(_0xc34521>=_0x339c74){_0xc34521=_0x339c74;_0x5cd788=0xc8;}else{_0x5cd788=0xce;}_0x43d1f1[_0xe5ca('0x19')](_0x5cd788);return _0x43d1f1[_0xe5ca('0x1e')]('Content-Range',_0x2c4d2e+'-'+_0xc34521+'/'+_0x339c74)['json'](_0x468e0a);}return null;};}function patchUpdates(_0xebba10){return function(_0x33d67e){try{jsonpatch[_0xe5ca('0x1f')](_0x33d67e,_0xebba10,!![]);}catch(_0x3e6288){return BPromise[_0xe5ca('0x20')](_0x3e6288);}return _0x33d67e[_0xe5ca('0x21')]();};}function saveUpdates(_0x2af6fd,_0x44350e){return function(_0x34bd1c){if(_0x34bd1c){return _0x34bd1c[_0xe5ca('0x22')](_0x2af6fd)[_0xe5ca('0x23')](function(_0x433b9e){return _0x433b9e;});}return null;};}function removeEntity(_0x3bb03c,_0x3dcd7f){return function(_0x2a76a9){if(_0x2a76a9){return _0x2a76a9[_0xe5ca('0x24')]()[_0xe5ca('0x23')](function(){_0x3bb03c[_0xe5ca('0x19')](0xcc)[_0xe5ca('0x18')]();});}};}function handleEntityNotFound(_0x1c2345,_0xd4c64){return function(_0x3d91cb){if(!_0x3d91cb){_0x1c2345[_0xe5ca('0x17')](0x194);}return _0x3d91cb;};}function handleError(_0x266c6c,_0xcb92b5){_0xcb92b5=_0xcb92b5||0x1f4;return function(_0x377055){logger[_0xe5ca('0x25')](_0x377055[_0xe5ca('0x26')]);if(_0x377055['name']){delete _0x377055[_0xe5ca('0x27')];}_0x266c6c[_0xe5ca('0x19')](_0xcb92b5)[_0xe5ca('0x28')](_0x377055);};}exports[_0xe5ca('0x29')]=function(_0x112888,_0x5b3dfd){var _0x220b3c={},_0x2b1675={},_0x5cf6c5={'count':0x0,'rows':[]};var _0x12dae2=_[_0xe5ca('0x2a')](db[_0xe5ca('0x2b')]['rawAttributes'],function(_0x4895df){return{'name':_0x4895df[_0xe5ca('0x2c')],'type':_0x4895df[_0xe5ca('0x2d')][_0xe5ca('0x2e')]};});_0x2b1675[_0xe5ca('0x2f')]=_[_0xe5ca('0x2a')](_0x12dae2,_0xe5ca('0x27'));_0x2b1675[_0xe5ca('0x30')]=_[_0xe5ca('0x31')](_0x112888[_0xe5ca('0x30')]);_0x2b1675[_0xe5ca('0x32')]=_['intersection'](_0x2b1675[_0xe5ca('0x2f')],_0x2b1675[_0xe5ca('0x30')]);_0x220b3c[_0xe5ca('0x33')]=_['intersection'](_0x2b1675['model'],qs[_0xe5ca('0x34')](_0x112888['query'][_0xe5ca('0x34')]));_0x220b3c['attributes']=_0x220b3c[_0xe5ca('0x33')][_0xe5ca('0x35')]?_0x220b3c[_0xe5ca('0x33')]:_0x2b1675[_0xe5ca('0x2f')];if(!_0x112888[_0xe5ca('0x30')][_0xe5ca('0x36')](_0xe5ca('0x37'))){_0x220b3c[_0xe5ca('0x1d')]=qs[_0xe5ca('0x1d')](_0x112888[_0xe5ca('0x30')][_0xe5ca('0x1d')]);_0x220b3c[_0xe5ca('0x1c')]=qs[_0xe5ca('0x1c')](_0x112888[_0xe5ca('0x30')][_0xe5ca('0x1c')]);}_0x220b3c[_0xe5ca('0x38')]=qs[_0xe5ca('0x39')](_0x112888[_0xe5ca('0x30')]['sort']);_0x220b3c[_0xe5ca('0x3a')]=qs[_0xe5ca('0x32')](_['pick'](_0x112888[_0xe5ca('0x30')],_0x2b1675[_0xe5ca('0x32')]),_0x12dae2);if(_0x112888[_0xe5ca('0x30')]['filter']){_0x220b3c[_0xe5ca('0x3a')]=_['merge'](_0x220b3c[_0xe5ca('0x3a')],{'$or':_[_0xe5ca('0x2a')](_0x12dae2,function(_0x5c57de){if(_0x5c57de['type']!==_0xe5ca('0x3b')){var _0x68294={};_0x68294[_0x5c57de[_0xe5ca('0x27')]]={'$like':'%'+_0x112888[_0xe5ca('0x30')][_0xe5ca('0x3c')]+'%'};return _0x68294;}})});}_0x220b3c=_['merge']({},_0x220b3c,_0x112888[_0xe5ca('0x3d')]);var _0x1e05dd={'where':_0x220b3c[_0xe5ca('0x3a')]};return db[_0xe5ca('0x2b')][_0xe5ca('0x1b')](_0x1e05dd)[_0xe5ca('0x23')](function(_0x413ef5){_0x5cf6c5[_0xe5ca('0x1b')]=_0x413ef5;if(_0x112888[_0xe5ca('0x30')][_0xe5ca('0x3e')]){_0x220b3c[_0xe5ca('0x3f')]=[{'all':!![]}];}return db[_0xe5ca('0x2b')][_0xe5ca('0x40')](_0x220b3c);})['then'](function(_0x57f4d){_0x5cf6c5[_0xe5ca('0x41')]=_0x57f4d;return _0x5cf6c5;})[_0xe5ca('0x23')](respondWithFilteredResult(_0x5b3dfd,_0x220b3c))['catch'](handleError(_0x5b3dfd,null));};exports[_0xe5ca('0x42')]=function(_0x1ec8fa,_0x589947){var _0xc2a783={'raw':!![],'where':{'id':_0x1ec8fa[_0xe5ca('0x43')]['id']}},_0x337914={};_0x337914[_0xe5ca('0x2f')]=_[_0xe5ca('0x31')](db[_0xe5ca('0x2b')]['rawAttributes']);_0x337914[_0xe5ca('0x30')]=_['keys'](_0x1ec8fa['query']);_0x337914[_0xe5ca('0x32')]=_[_0xe5ca('0x44')](_0x337914[_0xe5ca('0x2f')],_0x337914[_0xe5ca('0x30')]);_0xc2a783['attributes']=_[_0xe5ca('0x44')](_0x337914[_0xe5ca('0x2f')],qs[_0xe5ca('0x34')](_0x1ec8fa['query']['fields']));_0xc2a783['attributes']=_0xc2a783[_0xe5ca('0x33')][_0xe5ca('0x35')]?_0xc2a783[_0xe5ca('0x33')]:_0x337914[_0xe5ca('0x2f')];if(_0x1ec8fa[_0xe5ca('0x30')]['includeAll']){_0xc2a783[_0xe5ca('0x3f')]=[{'all':!![]}];}_0xc2a783=_[_0xe5ca('0x45')]({},_0xc2a783,_0x1ec8fa[_0xe5ca('0x3d')]);return db['OpenchannelApplication']['find'](_0xc2a783)['then'](handleEntityNotFound(_0x589947,null))[_0xe5ca('0x23')](respondWithResult(_0x589947,null))[_0xe5ca('0x46')](handleError(_0x589947,null));};exports[_0xe5ca('0x47')]=function(_0x4cbd80,_0x40698c){return db[_0xe5ca('0x2b')][_0xe5ca('0x47')](_0x4cbd80[_0xe5ca('0x48')],{})[_0xe5ca('0x23')](respondWithResult(_0x40698c,0xc9))[_0xe5ca('0x46')](handleError(_0x40698c,null));};exports[_0xe5ca('0x22')]=function(_0xe07fbe,_0x38b2cd){if(_0xe07fbe[_0xe5ca('0x48')]['id']){delete _0xe07fbe[_0xe5ca('0x48')]['id'];}return db[_0xe5ca('0x2b')][_0xe5ca('0x49')]({'where':{'id':_0xe07fbe[_0xe5ca('0x43')]['id']}})['then'](handleEntityNotFound(_0x38b2cd,null))[_0xe5ca('0x23')](saveUpdates(_0xe07fbe['body'],null))[_0xe5ca('0x23')](respondWithResult(_0x38b2cd,null))[_0xe5ca('0x46')](handleError(_0x38b2cd,null));};exports[_0xe5ca('0x24')]=function(_0x4d2e5f,_0x549467){return db[_0xe5ca('0x2b')][_0xe5ca('0x49')]({'where':{'id':_0x4d2e5f[_0xe5ca('0x43')]['id']}})[_0xe5ca('0x23')](handleEntityNotFound(_0x549467,null))[_0xe5ca('0x23')](removeEntity(_0x549467,null))[_0xe5ca('0x46')](handleError(_0x549467,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0db8c0b..7d49e6a 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 _0x8b3c=['util','../../config/logger','api','moment','bluebird','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x6f89d4,_0xd0ce56){var _0x362e06=function(_0x5c0a82){while(--_0x5c0a82){_0x6f89d4['push'](_0x6f89d4['shift']());}};_0x362e06(++_0xd0ce56);}(_0x8b3c,0x1df));var _0xc8b3=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x8b3c[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0xc8b3('0x0'));var util=require(_0xc8b3('0x1'));var logger=require(_0xc8b3('0x2'))(_0xc8b3('0x3'));var moment=require(_0xc8b3('0x4'));var BPromise=require(_0xc8b3('0x5'));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(_0xc8b3('0x6'));module[_0xc8b3('0x7')]=function(_0x3cdee3,_0xd926d6){return _0x3cdee3[_0xc8b3('0x8')](_0xc8b3('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8b3('0xa'),'collate':_0xc8b3('0xb')});}; \ No newline at end of file +var _0x8e23=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8e23,0x101));var _0x38e2=function(_0x440fa6,_0x3e3950){_0x440fa6=_0x440fa6-0x0;var _0x4d678d=_0x8e23[_0x440fa6];return _0x4d678d;};'use strict';var _=require(_0x38e2('0x0'));var util=require(_0x38e2('0x1'));var logger=require(_0x38e2('0x2'))(_0x38e2('0x3'));var moment=require(_0x38e2('0x4'));var BPromise=require(_0x38e2('0x5'));var rp=require(_0x38e2('0x6'));var fs=require('fs');var path=require(_0x38e2('0x7'));var rimraf=require(_0x38e2('0x8'));var config=require('../../config/environment');var attributes=require(_0x38e2('0x9'));module[_0x38e2('0xa')]=function(_0x48df26,_0x3291b1){return _0x48df26[_0x38e2('0xb')](_0x38e2('0xc'),attributes,{'tableName':_0x38e2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1453e94..f666e46 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x4cb086,_0x4cc048){var _0x10d1af=function(_0x296e16){while(--_0x296e16){_0x4cb086['push'](_0x4cb086['shift']());}};_0x10d1af(++_0x4cc048);}(_0x5f2f,0x73));var _0xf5f2=function(_0xf6d992,_0x376473){_0xf6d992=_0xf6d992-0x0;var _0x5605b9=_0x5f2f[_0xf6d992];return _0x5605b9;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2bdb68,_0x83669a){var _0x3583e9=function(_0x46d5c8){while(--_0x46d5c8){_0x2bdb68['push'](_0x2bdb68['shift']());}};_0x3583e9(++_0x83669a);}(_0xb10b,0x12a));var _0xbb10=function(_0x43a939,_0x20c11a){_0x43a939=_0x43a939-0x0;var _0x8b5d30=_0xb10b[_0x43a939];return _0x8b5d30;};'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 0da5e33..5f230e4 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 _0x99d3=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags'];(function(_0x18852b,_0x12967e){var _0x32d48f=function(_0x276437){while(--_0x276437){_0x18852b['push'](_0x18852b['shift']());}};_0x32d48f(++_0x12967e);}(_0x99d3,0x133));var _0x399d=function(_0x3e53a7,_0x6e5223){_0x3e53a7=_0x3e53a7-0x0;var _0x8f86e0=_0x99d3[_0x3e53a7];return _0x8f86e0;};'use strict';var multer=require(_0x399d('0x0'));var util=require(_0x399d('0x1'));var path=require(_0x399d('0x2'));var timeout=require(_0x399d('0x3'));var express=require(_0x399d('0x4'));var router=express[_0x399d('0x5')]();var auth=require(_0x399d('0x6'));var interaction=require(_0x399d('0x7'));var config=require('../../config/environment');var controller=require(_0x399d('0x8'));router[_0x399d('0x9')]('/',auth[_0x399d('0xa')](),controller['index']);router[_0x399d('0x9')](_0x399d('0xb'),auth[_0x399d('0xa')](),controller[_0x399d('0xc')]);router[_0x399d('0x9')](_0x399d('0xd'),auth['isAuthenticated'](),controller[_0x399d('0xe')]);router[_0x399d('0x9')](_0x399d('0xf'),auth[_0x399d('0xa')](),controller[_0x399d('0x10')]);router[_0x399d('0x9')](_0x399d('0x11'),auth[_0x399d('0xa')](),controller[_0x399d('0x12')]);router['post']('/',auth[_0x399d('0xa')](),controller[_0x399d('0x13')]);router[_0x399d('0x14')]('/:id/messages',auth[_0x399d('0xa')](),controller[_0x399d('0x15')]);router[_0x399d('0x14')](_0x399d('0x16'),auth[_0x399d('0xa')](),interaction[_0x399d('0x17')](_0x399d('0x18'),_0x399d('0x19')),controller[_0x399d('0x1a')]);router['put'](_0x399d('0xd'),auth['isAuthenticated'](),interaction[_0x399d('0x17')](_0x399d('0x18'),_0x399d('0x1b')),controller[_0x399d('0x1c')]);router[_0x399d('0x1d')]('/:id',auth[_0x399d('0xa')](),interaction[_0x399d('0x17')](_0x399d('0x18'),_0x399d('0x1e')),controller[_0x399d('0x1f')]);router[_0x399d('0x1d')](_0x399d('0x16'),auth[_0x399d('0xa')](),controller[_0x399d('0x20')]);module[_0x399d('0x21')]=router; \ No newline at end of file +var _0x7db5=['isAuthenticated','index','/describe','describe','/:id','show','download','post','create','/:id/messages','addMessage','/:id/tags','openchannel','addTags','put','tracked','openchannelinteraction:update','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../config/environment','get'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x7db5,0x111));var _0x57db=function(_0x21f751,_0x4d5c7f){_0x21f751=_0x21f751-0x0;var _0x5616bf=_0x7db5[_0x21f751];return _0x5616bf;};'use strict';var multer=require(_0x57db('0x0'));var util=require(_0x57db('0x1'));var path=require(_0x57db('0x2'));var timeout=require(_0x57db('0x3'));var express=require(_0x57db('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57db('0x5'));var controller=require('./openchannelInteraction.controller');router[_0x57db('0x6')]('/',auth[_0x57db('0x7')](),controller[_0x57db('0x8')]);router[_0x57db('0x6')](_0x57db('0x9'),auth['isAuthenticated'](),controller[_0x57db('0xa')]);router[_0x57db('0x6')](_0x57db('0xb'),auth[_0x57db('0x7')](),controller[_0x57db('0xc')]);router['get']('/:id/messages',auth[_0x57db('0x7')](),controller['getMessages']);router[_0x57db('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x57db('0xd')]);router[_0x57db('0xe')]('/',auth[_0x57db('0x7')](),controller[_0x57db('0xf')]);router[_0x57db('0xe')](_0x57db('0x10'),auth[_0x57db('0x7')](),controller[_0x57db('0x11')]);router['post'](_0x57db('0x12'),auth[_0x57db('0x7')](),interaction['tracked'](_0x57db('0x13'),'openchannelinteraction:addtags'),controller[_0x57db('0x14')]);router[_0x57db('0x15')]('/:id',auth[_0x57db('0x7')](),interaction[_0x57db('0x16')]('openchannel',_0x57db('0x17')),controller['update']);router['delete'](_0x57db('0xb'),auth[_0x57db('0x7')](),interaction[_0x57db('0x16')](_0x57db('0x13'),_0x57db('0x18')),controller[_0x57db('0x19')]);router['delete']('/:id/tags',auth[_0x57db('0x7')](),controller[_0x57db('0x1a')]);module[_0x57db('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7e93ffd..9a20ebc 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 _0xe38c=['exports','BOOLEAN','DATE','STRING','ENUM','sequelize'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xe38c,0xd7));var _0xce38=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe38c[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xce38('0x0'));module[_0xce38('0x1')]={'closed':{'type':Sequelize[_0xce38('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce38('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xce38('0x4')]},'read1stAt':{'type':Sequelize[_0xce38('0x3')]},'threadId':{'type':Sequelize[_0xce38('0x4')]},'externalUrl':{'type':Sequelize[_0xce38('0x4')]},'lastMsgAt':{'type':Sequelize[_0xce38('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xce38('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb6e7=['BOOLEAN','DATE','STRING','out','exports'];(function(_0x157d39,_0x2d5444){var _0x39e9f0=function(_0x2f40cf){while(--_0x2f40cf){_0x157d39['push'](_0x157d39['shift']());}};_0x39e9f0(++_0x2d5444);}(_0xb6e7,0xa4));var _0x7b6e=function(_0xdabb4e,_0x444d77){_0xdabb4e=_0xdabb4e-0x0;var _0x163a15=_0xb6e7[_0xdabb4e];return _0x163a15;};'use strict';var Sequelize=require('sequelize');module[_0x7b6e('0x0')]={'closed':{'type':Sequelize[_0x7b6e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b6e('0x2')]},'disposition':{'type':Sequelize[_0x7b6e('0x3')]},'note':{'type':Sequelize[_0x7b6e('0x3')]},'read1stAt':{'type':Sequelize[_0x7b6e('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7b6e('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b6e('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7b6e('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 1015e30..079cb56 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 _0xfda3=['./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','push','catch','index','OpenchannelInteraction','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','field','color','select','u.fullname','ui.OpenchannelInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','rawAttributes','includeAll','include','params','describe','addMessage','OpenchannelMessage','omit','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','ids','spread','Tag','openchannelInteractionTags:save','removeTags','download','root','files','tmp','server','attachments','transcript-%d-%s.zip','join','fullname','CmContact','firstName','lastName','Messages','direction','OpenchannelAccount','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','YYYY-MM-DD','Openchannel','N.A.','closed','closedAt','basename','createReadStream','createWriteStream','Attachment','out','System','secret','renderFile','views','downloadInteraction.html','create','toFile','log','err','unlinkSync','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x1e945f,_0x3f24d2){var _0x189aa7=function(_0x15d561){while(--_0x15d561){_0x1e945f['push'](_0x1e945f['shift']());}};_0x189aa7(++_0x3f24d2);}(_0xfda3,0x1b7));var _0x3fda=function(_0x490d21,_0x45d3de){_0x490d21=_0x490d21-0x0;var _0x31f143=_0xfda3[_0x490d21];return _0x31f143;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3fda('0x0'));var jsonpatch=require(_0x3fda('0x1'));var rp=require('request-promise');var moment=require(_0x3fda('0x2'));var BPromise=require(_0x3fda('0x3'));var Mustache=require(_0x3fda('0x4'));var util=require(_0x3fda('0x5'));var path=require('path');var sox=require(_0x3fda('0x6'));var csv=require('to-csv');var ejs=require(_0x3fda('0x7'));var fs=require('fs');var _=require(_0x3fda('0x8'));var squel=require(_0x3fda('0x9'));var crypto=require(_0x3fda('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3fda('0xb'));var querystring=require('querystring');var Papa=require(_0x3fda('0xc'));var Redis=require(_0x3fda('0xd'));var authService=require(_0x3fda('0xe'));var qs=require(_0x3fda('0xf'));var as=require(_0x3fda('0x10'));var hardwareService=require(_0x3fda('0x11'));var logger=require(_0x3fda('0x12'))(_0x3fda('0x13'));var utils=require(_0x3fda('0x14'));var config=require(_0x3fda('0x15'));var db=require(_0x3fda('0x16'))['db'];config[_0x3fda('0x17')]=_['defaults'](config['redis'],{'host':_0x3fda('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fda('0x17')]));require(_0x3fda('0x19'))[_0x3fda('0x1a')](socket);function respondWithStatusCode(_0x779e6d,_0x350b65){_0x350b65=_0x350b65||0xcc;return function(_0x3a8a73){if(_0x3a8a73){return _0x779e6d[_0x3fda('0x1b')](_0x350b65);}return _0x779e6d[_0x3fda('0x1c')](_0x350b65)[_0x3fda('0x1d')]();};}function respondWithResult(_0x44b8e7,_0x1602ec){_0x1602ec=_0x1602ec||0xc8;return function(_0x184ff9){if(_0x184ff9){return _0x44b8e7[_0x3fda('0x1c')](_0x1602ec)[_0x3fda('0x1e')](_0x184ff9);}};}function respondWithFilteredResult(_0x3a1a7e,_0x2637e4){return function(_0x45828b){if(_0x45828b){var _0x4fa2d4=_0x45828b[_0x3fda('0x1f')],_0x219b5e=_0x2637e4[_0x3fda('0x20')],_0x300856=_0x2637e4[_0x3fda('0x20')]+_0x2637e4[_0x3fda('0x21')],_0x461919;if(_0x300856>=_0x4fa2d4){_0x300856=_0x4fa2d4;_0x461919=0xc8;}else{_0x461919=0xce;}_0x3a1a7e['status'](_0x461919);return _0x3a1a7e[_0x3fda('0x22')]('Content-Range',_0x219b5e+'-'+_0x300856+'/'+_0x4fa2d4)[_0x3fda('0x1e')](_0x45828b);}return null;};}function patchUpdates(_0x4902a3){return function(_0x2ad346){try{jsonpatch['apply'](_0x2ad346,_0x4902a3,!![]);}catch(_0x3476d4){return BPromise[_0x3fda('0x23')](_0x3476d4);}return _0x2ad346[_0x3fda('0x24')]();};}function saveUpdates(_0x44ab0f,_0x5e2946){return function(_0x443fb4){if(_0x443fb4){return _0x443fb4[_0x3fda('0x25')](_0x44ab0f)[_0x3fda('0x26')](function(_0x11d760){return _0x11d760;});}return null;};}function removeEntity(_0x9265ba,_0x4a4bd){return function(_0x4a36d3){if(_0x4a36d3){return _0x4a36d3[_0x3fda('0x27')]()[_0x3fda('0x26')](function(){_0x9265ba[_0x3fda('0x1c')](0xcc)[_0x3fda('0x1d')]();});}};}function handleEntityNotFound(_0x481d4b,_0x5d6cb9){return function(_0x1f40c3){if(!_0x1f40c3){_0x481d4b['sendStatus'](0x194);}return _0x1f40c3;};}function handleError(_0x12439d,_0x226c35){_0x226c35=_0x226c35||0x1f4;return function(_0x2effea){logger[_0x3fda('0x28')](_0x2effea[_0x3fda('0x29')]);if(_0x2effea[_0x3fda('0x2a')]){delete _0x2effea[_0x3fda('0x2a')];}_0x12439d[_0x3fda('0x1c')](_0x226c35)[_0x3fda('0x2b')](_0x2effea);};}function getInteractionUsers(_0x36bbb0,_0x5f15ca){return new BPromise(function(_0x432317,_0x53d97c){try{if(_0x5f15ca[_0x36bbb0['id']]){_0x36bbb0[_0x3fda('0x2c')]=_[_0x3fda('0x2d')](_0x5f15ca[_0x36bbb0['id']],function(_0x17139e){return{'id':_0x17139e['id'],'fullname':_0x17139e['fullname']};});}}catch(_0xb3f92e){_0x53d97c(_0xb3f92e);}_0x432317(_0x36bbb0);});}function getInteractionTags(_0x37f7ef,_0x97f099){return new BPromise(function(_0x23ec6d,_0x5f41e3){try{if(_0x37f7ef[_0x3fda('0x2e')]){_0x37f7ef[_0x3fda('0x2f')]=[];_0x37f7ef[_0x3fda('0x2e')][_0x3fda('0x30')](',')['forEach'](function(_0x5eff27){_0x37f7ef[_0x3fda('0x2f')][_0x3fda('0x31')](_0x97f099[_0x5eff27]);});}delete _0x37f7ef[_0x3fda('0x2e')];}catch(_0x1e0684){_0x5f41e3(_0x1e0684);}_0x23ec6d(_0x37f7ef);});}function updateOpenchannelInteraction(_0x5e8348,_0x212c91,_0x56642b){return new BPromise(function(_0x1679f4,_0xff5775){return getInteractionUsers(_0x5e8348,_0x56642b)[_0x3fda('0x26')](function(_0x544822){return getInteractionTags(_0x544822,_0x212c91);})['then'](function(_0x2da1ed){_0x1679f4(_0x2da1ed);})[_0x3fda('0x32')](function(_0x440c85){_0xff5775(_0x440c85);});});}exports[_0x3fda('0x33')]=function(_0x451251,_0x4fbca2){var _0x12f33a={},_0x427dba={},_0x14b203={'count':0x0,'rows':[]};var _0x5164e0=_[_0x3fda('0x2d')](db[_0x3fda('0x34')]['rawAttributes'],function(_0x36a18c){return{'name':_0x36a18c['fieldName'],'type':_0x36a18c['type']['key']};});_0x427dba[_0x3fda('0x35')]=_[_0x3fda('0x2d')](_0x5164e0,_0x3fda('0x2a'));_0x427dba[_0x3fda('0x36')]=_[_0x3fda('0x37')](_0x451251['query']);_0x427dba[_0x3fda('0x38')]=_[_0x3fda('0x39')](_0x427dba[_0x3fda('0x35')],_0x427dba['query']);_0x12f33a['attributes']=_[_0x3fda('0x39')](_0x427dba[_0x3fda('0x35')],qs[_0x3fda('0x3a')](_0x451251[_0x3fda('0x36')][_0x3fda('0x3a')]));_0x12f33a[_0x3fda('0x3b')]=_0x12f33a[_0x3fda('0x3b')][_0x3fda('0x3c')]?_0x12f33a[_0x3fda('0x3b')]:_0x427dba['model'];if(!_0x451251[_0x3fda('0x36')][_0x3fda('0x3d')]('nolimit')){_0x12f33a[_0x3fda('0x21')]=qs[_0x3fda('0x21')](_0x451251[_0x3fda('0x36')][_0x3fda('0x21')]);_0x12f33a['offset']=qs['offset'](_0x451251[_0x3fda('0x36')][_0x3fda('0x20')]);}_0x12f33a[_0x3fda('0x3e')]=qs[_0x3fda('0x3f')](_0x451251[_0x3fda('0x36')]['sort']);_0x12f33a[_0x3fda('0x40')]=qs[_0x3fda('0x38')](_[_0x3fda('0x41')](_0x451251['query'],_0x427dba[_0x3fda('0x38')]),_0x5164e0);var _0x261270=[];var _0x24b704=squel['select']()[_0x3fda('0x42')]('id')[_0x3fda('0x42')](_0x3fda('0x2a'))['field'](_0x3fda('0x43'))['from']('tools_tags');var _0x215a9e=squel[_0x3fda('0x44')]()[_0x3fda('0x42')]('u.id')[_0x3fda('0x42')](_0x3fda('0x45'))['field'](_0x3fda('0x46'))[_0x3fda('0x47')]('user_has_openchannel_interactions','ui')[_0x3fda('0x48')](_0x3fda('0x49'),'u',_0x3fda('0x4a'));var _0x2ab2bf=squel[_0x3fda('0x44')]()[_0x3fda('0x47')](_0x3fda('0x4b'),'i')[_0x3fda('0x48')](_0x3fda('0x4c'),'c',_0x3fda('0x4d'))['left_join'](_0x3fda('0x49'),'o',_0x3fda('0x4e'))[_0x3fda('0x48')](_0x3fda('0x4f'),'a',_0x3fda('0x50'))['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x3fda('0x48')](_0x3fda('0x51'),'it',_0x3fda('0x52'))[_0x3fda('0x48')](_0x3fda('0x53'),'t',_0x3fda('0x54'));var _0x22dff0=squel[_0x3fda('0x55')]();var _0xa0874a=[];var _0x23e9d8=squel['expr']();var _0x496846;if(_0x451251[_0x3fda('0x36')][_0x3fda('0x56')]){_0x496846=as['parseSearch'](_0x451251['query']['search']);var _0x524beb=_0x496846['sqlOperator'];for(var _0x51ad35=0x0;_0x51ad35<_0x496846[_0x3fda('0x57')][_0x3fda('0x3c')];_0x51ad35++){var _0x1228b1=_0x496846['conditions'][_0x51ad35];var _0x4fbcc5='i';var _0x1185ec=_[_0x3fda('0x58')](_0x5164e0,['name',_0x1228b1[_0x3fda('0x42')]]);if(!_0x1185ec){switch(_0x1228b1[_0x3fda('0x42')]){case _0x3fda('0x59'):if(_0x1228b1[_0x3fda('0x5a')]==0x1){_0x2ab2bf[_0x3fda('0x5b')]('`'+_0x1228b1[_0x3fda('0x42')]+'`\x20=\x200');}else{_0x2ab2bf[_0x3fda('0x5b')]('`'+_0x1228b1[_0x3fda('0x42')]+_0x3fda('0x5c'));}break;case _0x3fda('0x5d'):if(_0x1228b1[_0x3fda('0x5e')]===_0x3fda('0x5f')){if(_0x1228b1[_0x3fda('0x5a')][_0x3fda('0x30')]('\x20')[_0x3fda('0x3c')]>0x1){_0x22dff0[_0x524beb]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3fda('0x60')](_0x1228b1[_0x3fda('0x5a')]),null);}else{var _0x4d8ea9='%'+_0x1228b1[_0x3fda('0x5a')]+'%';_0x22dff0[_0x524beb](_0x3fda('0x61'),_0x4d8ea9,_0x4d8ea9,_0x4d8ea9);}}else{_0x1185ec=_[_0x3fda('0x58')](_0x5164e0,[_0x3fda('0x2a'),_0x3fda('0x62')]);_0x1228b1[_0x3fda('0x42')]=_0x3fda('0x62');_0x6a8ec0=as[_0x3fda('0x63')](_0x4fbcc5,_0x1185ec[_0x3fda('0x64')],_0x1228b1);_0x22dff0[_0x524beb](_0x6a8ec0[_0x3fda('0x65')],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x66')],_0x6a8ec0['value'][_0x3fda('0x1d')]);}break;case'Tag':var _0x3fe0d8=_0x1228b1[_0x3fda('0x5a')]['split'](',')[_0x3fda('0x2d')](function(_0x286df4){return Number(_0x286df4);});_0x3fe0d8[_0x3fda('0x67')](function(_0xf5fd4f){_0x23e9d8['or'](_0x3fda('0x68'),'%,'+_0xf5fd4f+',%');});_0xa0874a=_['union'](_0xa0874a,_0x3fe0d8);break;case _0x3fda('0x69'):if(_0x1228b1[_0x3fda('0x5e')]===_0x3fda('0x5f')){_0x22dff0[_0x524beb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1228b1[_0x3fda('0x5a')]+'%',null);}else{_0x1185ec=_[_0x3fda('0x58')](_0x5164e0,[_0x3fda('0x2a'),_0x3fda('0x6a')]);_0x1228b1[_0x3fda('0x42')]=_0x3fda('0x6a');_0x6a8ec0=as[_0x3fda('0x63')](_0x4fbcc5,_0x1185ec['type'],_0x1228b1);_0x22dff0[_0x524beb](_0x6a8ec0[_0x3fda('0x65')],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x66')],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x1d')]);}break;case _0x3fda('0x6b'):_0x6a8ec0=as[_0x3fda('0x63')]('me',null,_0x1228b1);_0x22dff0[_0x524beb](_0x6a8ec0['text'],_0x6a8ec0['value'][_0x3fda('0x66')],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x1d')]);break;}}else{var _0x6a8ec0=as[_0x3fda('0x63')](_0x4fbcc5,_0x1185ec[_0x3fda('0x64')],_0x1228b1);_0x22dff0[_0x524beb](_0x6a8ec0[_0x3fda('0x65')],_0x6a8ec0[_0x3fda('0x5a')]['start'],_0x6a8ec0[_0x3fda('0x5a')][_0x3fda('0x1d')]);}}}else{var _0x54899c=_(_0x451251[_0x3fda('0x36')])[_0x3fda('0x37')]()[_0x3fda('0x2d')](function(_0xb19ab9){return _[_0x3fda('0x6c')](_0x5164e0,[_0x3fda('0x2a'),_0xb19ab9])?_0xb19ab9:undefined;})[_0x3fda('0x6d')]()[_0x3fda('0x5a')]();if(!_[_0x3fda('0x6e')](_0x54899c)){_0x54899c['forEach'](function(_0x56b7a1){if(_0x56b7a1===_0x3fda('0x6f')){_0x2ab2bf[_0x3fda('0x40')](_0x3fda('0x70'),[][_0x3fda('0x71')](_0x451251[_0x3fda('0x36')][_0x56b7a1]));}else if(_0x56b7a1===_0x3fda('0x72')){var _0x4f0522=JSON['parse'](_0x451251['query'][_0x56b7a1])[_0x3fda('0x73')];var _0x363beb=JSON[_0x3fda('0x74')](_0x451251['query'][_0x56b7a1])[_0x3fda('0x75')];_0x2ab2bf[_0x3fda('0x40')](_0x3fda('0x76'),_0x4f0522,_0x363beb);}else{if(_0x451251[_0x3fda('0x36')][_0x56b7a1]===_0x3fda('0x77')){_0x2ab2bf['where']('i.'+_0x56b7a1+_0x3fda('0x78'));}else{_0x2ab2bf[_0x3fda('0x40')]('i.'+_0x56b7a1+_0x3fda('0x79'),_0x451251['query'][_0x56b7a1]);}}});}if(_0x451251[_0x3fda('0x36')][_0x3fda('0x7a')]){if(_0x451251['query'][_0x3fda('0x7a')]==0x1){_0x2ab2bf[_0x3fda('0x5b')]('`unreadMessages`\x20=\x200');}else{_0x2ab2bf[_0x3fda('0x5b')](_0x3fda('0x7b'));}}if(_0x451251[_0x3fda('0x36')][_0x3fda('0x7c')]){_0xa0874a=_[_0x3fda('0x7d')](_0x451251['query'][_0x3fda('0x7c')])?_0x451251[_0x3fda('0x36')][_0x3fda('0x7c')]:new Array(_0x451251['query'][_0x3fda('0x7c')]);_0xa0874a['forEach'](function(_0x2608f5){_0x23e9d8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2608f5+',%');});}if(_0x451251[_0x3fda('0x36')][_0x3fda('0x7e')]){var _0x201f4e=_0x451251[_0x3fda('0x36')][_0x3fda('0x7e')][_0x3fda('0x7f')]('\x5c','\x5c\x5c')[_0x3fda('0x7f')]('\x27\x27',_0x3fda('0x80'));if(qs[_0x3fda('0x81')](_0x201f4e)){_0x22dff0['or']('i.id\x20LIKE\x20?',_0x201f4e+'%');}else{_0x22dff0['or'](_0x3fda('0x82'),qs[_0x3fda('0x60')](_0x201f4e))['or'](_0x3fda('0x83'),_0x201f4e+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x201f4e+'%');}}}_0x2ab2bf[_0x3fda('0x40')](_0x22dff0);_0x2ab2bf[_0x3fda('0x84')](_0x3fda('0x85'));var _0x25a31d={'type':db[_0x3fda('0x86')][_0x3fda('0x87')]['SELECT'],'raw':!![]};var _0x167a7d=_0x2ab2bf[_0x3fda('0x88')]();_0x167a7d[_0x3fda('0x42')](_0x3fda('0x85'));_0x167a7d[_0x3fda('0x42')](_0x3fda('0x89'),'unreadMessages');if(_0x12f33a[_0x3fda('0x3e')]){_0x12f33a[_0x3fda('0x3e')]['forEach'](function(_0x414450){_0x2ab2bf[_0x3fda('0x3e')]('i.'+_0x414450[0x0],_0x414450[0x1]===_0x3fda('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0xa0874a)){_0x2ab2bf[_0x3fda('0x5b')](_0x23e9d8);_0x167a7d[_0x3fda('0x40')](_0x3fda('0x8b'),_0xa0874a);}BPromise['resolve']()[_0x3fda('0x26')](function(){if(!_0x496846){if(_0x451251['query'][_0x3fda('0x6f')]||_0x451251['query'][_0x3fda('0x8c')])return;_0x167a7d[_0x3fda('0x40')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2ab2bf['where'](_0x3fda('0x8d'));return;}return _0x451251[_0x3fda('0x8e')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x181d88){if(_[_0x3fda('0x6e')](_0x181d88)){_0x167a7d[_0x3fda('0x40')](_0x3fda('0x8f'));_0x2ab2bf[_0x3fda('0x40')](_0x3fda('0x8f'));}else{_0x167a7d['where'](_0x3fda('0x70'),_[_0x3fda('0x2d')](_0x181d88,'id'));_0x2ab2bf[_0x3fda('0x40')](_0x3fda('0x70'),_[_0x3fda('0x2d')](_0x181d88,'id'));}});})['then'](function(){db[_0x3fda('0x90')]['query'](_0x167a7d[_0x3fda('0x91')](),_0x25a31d)[_0x3fda('0x26')](function(_0x176a1f){_0x14b203[_0x3fda('0x1f')]=_0x176a1f[_0x3fda('0x3c')];if(_0x14b203['count']===0x0)return[];return db[_0x3fda('0x90')][_0x3fda('0x36')](_0x24b704[_0x3fda('0x91')](),_0x25a31d)[_0x3fda('0x26')](function(_0x446261){_0x261270=_['keyBy'](_0x446261,'id');_0x25a31d=_[_0x3fda('0x92')](_0x25a31d,{'model':db[_0x3fda('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x451251['query'][_0x3fda('0x3a')]){_0x12f33a['attributes'][_0x3fda('0x67')](function(_0x3e6452){_0x2ab2bf[_0x3fda('0x42')]('i.'+_0x3e6452);});}else{_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x89'),'unreadMessages');_0x2ab2bf[_0x3fda('0x42')]('a.key',_0x3fda('0x93'));_0x2ab2bf['field'](_0x3fda('0x94'),_0x3fda('0x95'));_0x2ab2bf['field'](_0x3fda('0x96'));_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x97'),_0x3fda('0x98'));_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x99'),_0x3fda('0x9a'));_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x9b'),_0x3fda('0x9c'));_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0x9d'),_0x3fda('0x9e'));_0x2ab2bf['field'](_0x3fda('0x9f'),'Contact.mobile');_0x2ab2bf[_0x3fda('0x42')]('c.fax',_0x3fda('0xa0'));_0x2ab2bf['field'](_0x3fda('0xa1'),_0x3fda('0xa2'));_0x2ab2bf[_0x3fda('0x42')]('o.internal','Owner.internal');_0x2ab2bf[_0x3fda('0x42')](_0x3fda('0xa3'),_0x3fda('0x2e'));}if(_0x12f33a[_0x3fda('0x21')])_0x2ab2bf[_0x3fda('0x21')](_0x12f33a[_0x3fda('0x21')]);if(_0x12f33a[_0x3fda('0x20')])_0x2ab2bf[_0x3fda('0x20')](_0x12f33a['offset']);return db[_0x3fda('0x90')][_0x3fda('0x36')](_0x2ab2bf[_0x3fda('0x91')](),_0x25a31d);})['then'](function(_0x37365a){_0x215a9e[_0x3fda('0x40')](_0x3fda('0xa4'),_[_0x3fda('0x2d')](_0x37365a,'id'));return db[_0x3fda('0x90')]['query'](_0x215a9e[_0x3fda('0x91')](),_0x25a31d)[_0x3fda('0x26')](function(_0x6f60f8){var _0x16221a=_[_0x3fda('0xa5')](_0x6f60f8,_0x3fda('0xa6'));var _0x344b85=[];_0x37365a[_0x3fda('0x67')](function(_0x251d15){_0x344b85[_0x3fda('0x31')](updateOpenchannelInteraction(_0x251d15,_0x261270,_0x16221a));});return BPromise[_0x3fda('0xa7')](_0x344b85);});});})[_0x3fda('0x26')](function(_0x189c14){_0x14b203[_0x3fda('0xa8')]=_0x189c14;return _0x14b203;})[_0x3fda('0x26')](respondWithFilteredResult(_0x4fbca2,_0x12f33a));})['catch'](handleError(_0x4fbca2,null));};exports[_0x3fda('0xa9')]=function(_0x853dbb,_0x2114ea){var _0x5a7636={'raw':![],'where':{'id':_0x853dbb['params']['id']}},_0x1c4deb={};_0x1c4deb['model']=_['keys'](db[_0x3fda('0x34')][_0x3fda('0xaa')]);_0x1c4deb[_0x3fda('0x36')]=_['keys'](_0x853dbb[_0x3fda('0x36')]);_0x1c4deb['filters']=_[_0x3fda('0x39')](_0x1c4deb['model'],_0x1c4deb[_0x3fda('0x36')]);_0x5a7636[_0x3fda('0x3b')]=_[_0x3fda('0x39')](_0x1c4deb['model'],qs[_0x3fda('0x3a')](_0x853dbb[_0x3fda('0x36')]['fields']));_0x5a7636[_0x3fda('0x3b')]=_0x5a7636[_0x3fda('0x3b')][_0x3fda('0x3c')]?_0x5a7636[_0x3fda('0x3b')]:_0x1c4deb[_0x3fda('0x35')];if(_0x853dbb[_0x3fda('0x36')][_0x3fda('0xab')]){_0x5a7636[_0x3fda('0xac')]=[{'all':!![]}];}_0x5a7636=_[_0x3fda('0x92')]({},_0x5a7636,_0x853dbb['options']);return db['OpenchannelInteraction'][_0x3fda('0x58')](_0x5a7636)[_0x3fda('0x26')](handleEntityNotFound(_0x2114ea,null))[_0x3fda('0x26')](respondWithResult(_0x2114ea,null))[_0x3fda('0x32')](handleError(_0x2114ea,null));};exports['create']=function(_0x2e2137,_0x374ce0){return db[_0x3fda('0x34')]['create'](_0x2e2137[_0x3fda('0x6b')],{})[_0x3fda('0x26')](respondWithResult(_0x374ce0,0xc9))[_0x3fda('0x32')](handleError(_0x374ce0,null));};exports[_0x3fda('0x25')]=function(_0x146af5,_0x35b406){if(_0x146af5[_0x3fda('0x6b')]['id']){delete _0x146af5['body']['id'];}return db[_0x3fda('0x34')][_0x3fda('0x58')]({'where':{'id':_0x146af5[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x35b406,null))[_0x3fda('0x26')](saveUpdates(_0x146af5[_0x3fda('0x6b')],null))[_0x3fda('0x26')](respondWithResult(_0x35b406,null))[_0x3fda('0x32')](handleError(_0x35b406,null));};exports[_0x3fda('0x27')]=function(_0x89de8a,_0x7f5198){return db['OpenchannelInteraction'][_0x3fda('0x58')]({'where':{'id':_0x89de8a[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x7f5198,null))[_0x3fda('0x26')](removeEntity(_0x7f5198,null))['catch'](handleError(_0x7f5198,null));};exports[_0x3fda('0xae')]=function(_0x648583,_0x518d5a){return db[_0x3fda('0x34')][_0x3fda('0xae')]()[_0x3fda('0x26')](respondWithResult(_0x518d5a,null))['catch'](handleError(_0x518d5a,null));};exports[_0x3fda('0xaf')]=function(_0x1b96a4,_0x25579e,_0x367a7f){return db[_0x3fda('0xb0')][_0x3fda('0x58')]({'where':{'id':_0x1b96a4['params']['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x25579e,null))[_0x3fda('0x26')](function(_0x58d2a6){if(_0x58d2a6){return _0x58d2a6[_0x3fda('0xaf')](_0x1b96a4['body']['ids'],_[_0x3fda('0xb1')](_0x1b96a4['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x25579e,null))[_0x3fda('0x32')](handleError(_0x25579e,null));};exports['getMessages']=function(_0x332fc2,_0x10b97b,_0x272621){var _0x366c8d={'raw':![],'where':{}};var _0x49741f={};var _0xf0e2ae={'count':0x0,'rows':[]};return db[_0x3fda('0x34')][_0x3fda('0xb2')]({'where':{'id':_0x332fc2[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x10b97b,null))[_0x3fda('0x26')](function(_0x474659){if(_0x474659){_0x49741f[_0x3fda('0x35')]=_[_0x3fda('0x37')](db['OpenchannelMessage'][_0x3fda('0xaa')]);_0x49741f[_0x3fda('0x36')]=_[_0x3fda('0x37')](_0x332fc2['query']);_0x49741f[_0x3fda('0x38')]=_['intersection'](_0x49741f['model'],_0x49741f['query']);_0x366c8d['attributes']=_[_0x3fda('0x39')](_0x49741f['model'],qs[_0x3fda('0x3a')](_0x332fc2[_0x3fda('0x36')]['fields']));_0x366c8d[_0x3fda('0x3b')]=_0x366c8d['attributes']['length']?_0x366c8d[_0x3fda('0x3b')]:_0x49741f['model'];if(!_0x332fc2[_0x3fda('0x36')]['hasOwnProperty'](_0x3fda('0xb3'))){_0x366c8d['limit']=qs[_0x3fda('0x21')](_0x332fc2['query'][_0x3fda('0x21')]);_0x366c8d[_0x3fda('0x20')]=qs[_0x3fda('0x20')](_0x332fc2[_0x3fda('0x36')][_0x3fda('0x20')]);}_0x366c8d['order']=qs['sort'](_0x332fc2[_0x3fda('0x36')][_0x3fda('0x3f')]);_0x366c8d[_0x3fda('0x40')]=qs['filters'](_[_0x3fda('0x41')](_0x332fc2['query'],_0x49741f[_0x3fda('0x38')]));_0x366c8d[_0x3fda('0x40')]['OpenchannelInteractionId']=_0x474659['id'];if(_0x332fc2[_0x3fda('0x36')][_0x3fda('0x7e')]){_0x366c8d[_0x3fda('0x40')]=_[_0x3fda('0x92')](_0x366c8d[_0x3fda('0x40')],{'$or':_[_0x3fda('0x2d')](_0x366c8d[_0x3fda('0x3b')],function(_0x3c4acf){var _0x45d6f0={};_0x45d6f0[_0x3c4acf]={'$like':'%'+_0x332fc2['query'][_0x3fda('0x7e')]+'%'};return _0x45d6f0;})});}if(_0x332fc2[_0x3fda('0x36')][_0x3fda('0x73')]){var _0x410f1b=_0x332fc2[_0x3fda('0x36')][_0x3fda('0x73')][_0x3fda('0x30')](',');var _0x4a3e67={};_0x4a3e67[_0x410f1b[0x0]]={'$gte':moment(_0x410f1b[0x1])[_0x3fda('0xb4')](_0x3fda('0xb5'))};_0x366c8d[_0x3fda('0x40')]=_[_0x3fda('0x92')](_0x366c8d[_0x3fda('0x40')],_0x4a3e67);}_0x366c8d=_[_0x3fda('0x92')]({},_0x366c8d,_0x332fc2[_0x3fda('0xb6')]);return db[_0x3fda('0xb0')]['count']({'where':_0x366c8d['where']})[_0x3fda('0x26')](function(_0x10fc71){_0xf0e2ae[_0x3fda('0x1f')]=_0x10fc71;if(_0x332fc2['query'][_0x3fda('0xab')]){_0x366c8d[_0x3fda('0xac')]=[{'all':!![]}];}return db[_0x3fda('0xb0')][_0x3fda('0xb7')](_0x366c8d);})[_0x3fda('0x26')](function(_0x5b274c){_0xf0e2ae['rows']=_0x5b274c;return _0xf0e2ae;});}})[_0x3fda('0x26')](respondWithFilteredResult(_0x10b97b,_0x366c8d))[_0x3fda('0x32')](handleError(_0x10b97b,null));};exports[_0x3fda('0xb8')]=function(_0x349d5e,_0x128f68,_0x2590fc){return db[_0x3fda('0x34')][_0x3fda('0x58')]({'where':{'id':_0x349d5e[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x128f68,null))[_0x3fda('0x26')](function(_0x595632){if(_0x595632){return _0x595632[_0x3fda('0xb9')](_0x349d5e[_0x3fda('0x6b')][_0x3fda('0xba')],_['omit'](_0x349d5e[_0x3fda('0x6b')],[_0x3fda('0xba'),'id'])||{})[_0x3fda('0xbb')](function(){return db[_0x3fda('0xbc')][_0x3fda('0xb7')]({'attributes':['id',_0x3fda('0x2a'),_0x3fda('0x43')],'where':{'id':_0x349d5e[_0x3fda('0x6b')]['ids']}});})[_0x3fda('0x26')](function(_0x207159){socket['emit'](_0x3fda('0xbd'),{'id':Number(_0x349d5e[_0x3fda('0xad')]['id']),'tags':_0x207159||[]});return{'id':Number(_0x349d5e[_0x3fda('0xad')]['id']),'tags':_0x207159||[]};});}})[_0x3fda('0x26')](respondWithResult(_0x128f68,null))[_0x3fda('0x32')](handleError(_0x128f68,null));};exports['removeTags']=function(_0x5a73ed,_0x291299,_0x4c06ed){return db[_0x3fda('0x34')][_0x3fda('0x58')]({'where':{'id':_0x5a73ed[_0x3fda('0xad')]['id']}})[_0x3fda('0x26')](handleEntityNotFound(_0x291299,null))[_0x3fda('0x26')](function(_0x45b58c){if(_0x45b58c){return _0x45b58c[_0x3fda('0xbe')](_0x5a73ed[_0x3fda('0x36')][_0x3fda('0xba')]);}})['then'](respondWithStatusCode(_0x291299,null))['catch'](handleError(_0x291299,null));};exports[_0x3fda('0xbf')]=function(_0x17b37c,_0x7113da){var _0x51fca2=moment()['unix']()[_0x3fda('0x91')]();var _0x4a7c54=path['join'](config[_0x3fda('0xc0')],'server',_0x3fda('0xc1'),_0x3fda('0xc2'));var _0xe86114=path['join'](config['root'],_0x3fda('0xc3'),_0x3fda('0xc1'),_0x3fda('0xc4'));var _0x6fb647=path['join'](_0x4a7c54,_0x51fca2);var _0x520206=util['format'](_0x3fda('0xc5'),_0x17b37c[_0x3fda('0xad')]['id'],_0x51fca2);var _0x3c81e6=path[_0x3fda('0xc6')](_0x4a7c54,_0x520206);var _0x2568e1=[];_0x2568e1[_0x3fda('0x31')]({'model':db['User'],'as':'User','attributes':['id',_0x3fda('0xc7')],'raw':!![]});_0x2568e1[_0x3fda('0x31')]({'model':db[_0x3fda('0xc8')],'as':_0x3fda('0x5d'),'attributes':['id',_0x3fda('0xc9'),_0x3fda('0xca')],'raw':!![]});if(_0x17b37c[_0x3fda('0x36')][_0x3fda('0xc4')]){_0x2568e1[_0x3fda('0x31')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x25e9ec=[{'model':db[_0x3fda('0xb0')],'as':_0x3fda('0xcb'),'attributes':['id',_0x3fda('0x6b'),_0x3fda('0x72'),_0x3fda('0xcc'),'secret',_0x3fda('0x7a')],'include':_0x2568e1}];_0x25e9ec['push']({'model':db[_0x3fda('0xcd')],'as':_0x3fda('0xce'),'attributes':['id',_0x3fda('0x2a')]});_0x25e9ec[_0x3fda('0x31')]({'model':db[_0x3fda('0x69')],'as':_0x3fda('0xcf'),'attributes':['id',_0x3fda('0xc7')]});return db[_0x3fda('0x34')][_0x3fda('0x58')]({'where':{'id':_0x17b37c[_0x3fda('0xad')]['id']},'include':_0x25e9ec})[_0x3fda('0x26')](handleEntityNotFound(_0x7113da,null))[_0x3fda('0x26')](function(_0x15a890){if(_0x15a890){var _0x1a095e=_0x15a890['get']({'plain':!![]});fs[_0x3fda('0xd0')](_0x6fb647);var _0x3a21c9={'format':'A4','border':_0x3fda('0xd1'),'header':{'height':_0x3fda('0xd2'),'contents':{'first':_0x3fda('0xd3')}},'footer':{'height':'30px','contents':{'default':util[_0x3fda('0xb4')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x3fda('0xb4')]('%s\x20#%d','Openchannel',_0x1a095e['id']),moment()[_0x3fda('0xb4')](_0x3fda('0xd4'))['toString']())}}};var _0x20c0c7={'channel':_0x3fda('0xd5'),'account':_0x1a095e[_0x3fda('0xce')][_0x3fda('0x2a')],'agent':_0x1a095e[_0x3fda('0xcf')]?_0x1a095e[_0x3fda('0xcf')][_0x3fda('0xc7')]:_0x3fda('0xd6'),'createdAt':moment(_0x1a095e['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3fda('0x91')](),'closedAt':_0x1a095e[_0x3fda('0xd7')]?moment(_0x1a095e[_0x3fda('0xd8')])[_0x3fda('0xb4')](_0x3fda('0xb5'))[_0x3fda('0x91')]():'','disposition':_0x1a095e['disposition'],'visibility':_0x1a095e['threadId']?'Public':'Private','messages':_(_0x1a095e['Messages'])[_0x3fda('0x7e')]({'secret':![]})[_0x3fda('0x2d')](function(_0x3a569c){if(_0x3a569c['Attachment']){var _0x500e44=path['join'](_0xe86114,_0x3a569c['Attachment'][_0x3fda('0xd9')]);if(fs['existsSync'](_0x500e44)){fs[_0x3fda('0xda')](_0x500e44)['pipe'](fs[_0x3fda('0xdb')](path['join'](_0x6fb647,_0x3a569c[_0x3fda('0xdc')]['basename'])));}}return{'date':moment(_0x3a569c[_0x3fda('0x72')])[_0x3fda('0xb4')](_0x3fda('0xb5'))['toString'](),'sender':_0x3a569c[_0x3fda('0xcc')]===_0x3fda('0xdd')?_0x3a569c['User']?_0x3a569c[_0x3fda('0x69')][_0x3fda('0xc7')]:_0x3fda('0xde'):_0x3a569c[_0x3fda('0x5d')]['firstName']+(_0x3a569c['Contact']['lastName']?'\x20'+_0x3a569c[_0x3fda('0x5d')][_0x3fda('0xca')]:''),'body':_0x3a569c['Attachment']?_0x3a569c[_0x3fda('0xdc')]['basename']:_0x3a569c[_0x3fda('0x6b')],'direction':_0x3a569c['direction']===_0x3fda('0xdd')?'A':'C','secret':_0x3a569c[_0x3fda('0xdf')],'read':_0x3a569c[_0x3fda('0x7a')],'attachment':_0x3a569c[_0x3fda('0xdc')]};})[_0x3fda('0x5a')]()};return ejs[_0x3fda('0xe0')](path[_0x3fda('0xc6')](config['root'],_0x3fda('0xc3'),_0x3fda('0xe1'),_0x3fda('0xe2')),{'interaction':_0x20c0c7})[_0x3fda('0x26')](function(_0x2aa212){return new BPromise(function(_0x84dfca,_0x1bc06a){pdf[_0x3fda('0xe3')](_0x2aa212,_0x3a21c9)[_0x3fda('0xe4')](path[_0x3fda('0xc6')](_0x6fb647,'transcript-'+_0x1a095e['id']+'-'+_0x51fca2+'.pdf'),function(_0x3d498a,_0x48c52d){if(_0x3d498a)return _0x1bc06a(_0x3d498a);_0x84dfca(_0x48c52d);});});})[_0x3fda('0x26')](function(){return new BPromise(function(_0x21ccde,_0x6f2cf7){zipdir(_0x6fb647,{'saveTo':_0x3c81e6},function(_0x5d44a9,_0x130cb1){if(_0x5d44a9)return _0x6f2cf7(_0x5d44a9);return _0x21ccde(_0x130cb1);});})[_0x3fda('0x26')](function(){return new BPromise(function(_0xb69b8b,_0x322eed){rimraf(_0x6fb647,function(_0x11accf){if(_0x11accf)_0x322eed(_0x11accf);return _0xb69b8b();});});})['then'](function(){return _0x7113da['download'](_0x3c81e6,_0x520206,function(_0x4dfc12){if(_0x4dfc12){console[_0x3fda('0xe5')](_0x3fda('0xe6'),_0x4dfc12);}else{fs[_0x3fda('0xe7')](_0x3c81e6);}});});});}else{return _0x7113da[_0x3fda('0x1b')](0xc8);}})[_0x3fda('0x32')](handleError(_0x7113da,null));}; \ No newline at end of file +var _0x0c48=['register','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','Users','fullname','TagIds','Tags','split','forEach','push','map','OpenchannelInteraction','fieldName','key','query','keys','filters','attributes','model','fields','length','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','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?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','type','text','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','rows','catch','params','rawAttributes','intersection','includeAll','include','options','create','describe','addMessage','omit','getMessages','OpenchannelMessage','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','ids','spread','emit','openchannelInteractionTags:save','removeTags','root','server','files','tmp','attachments','transcript-%d-%s.zip','join','CmContact','firstName','lastName','Attachment','Messages','direction','secret','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','format','%s\x20#%d','Openchannel','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','views','downloadInteraction.html','toFile','transcript-','.pdf','download','err','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket'];(function(_0x57b4a5,_0x23918e){var _0x4493a8=function(_0x451624){while(--_0x451624){_0x57b4a5['push'](_0x57b4a5['shift']());}};_0x4493a8(++_0x23918e);}(_0x0c48,0xd3));var _0x80c4=function(_0x3d1c06,_0x30f2e0){_0x3d1c06=_0x3d1c06-0x0;var _0x10c6e6=_0x0c48[_0x3d1c06];return _0x10c6e6;};'use strict';var pdf=require(_0x80c4('0x0'));var emlformat=require(_0x80c4('0x1'));var rimraf=require(_0x80c4('0x2'));var zipdir=require(_0x80c4('0x3'));var jsonpatch=require(_0x80c4('0x4'));var rp=require(_0x80c4('0x5'));var moment=require(_0x80c4('0x6'));var BPromise=require(_0x80c4('0x7'));var Mustache=require(_0x80c4('0x8'));var util=require('util');var path=require(_0x80c4('0x9'));var sox=require(_0x80c4('0xa'));var csv=require(_0x80c4('0xb'));var ejs=require(_0x80c4('0xc'));var fs=require('fs');var _=require(_0x80c4('0xd'));var squel=require(_0x80c4('0xe'));var crypto=require(_0x80c4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x80c4('0x10'));var toCsv=require(_0x80c4('0xb'));var querystring=require(_0x80c4('0x11'));var Papa=require('papaparse');var Redis=require(_0x80c4('0x12'));var authService=require(_0x80c4('0x13'));var qs=require(_0x80c4('0x14'));var as=require(_0x80c4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80c4('0x16'));var utils=require(_0x80c4('0x17'));var config=require(_0x80c4('0x18'));var db=require(_0x80c4('0x19'))['db'];config[_0x80c4('0x1a')]=_[_0x80c4('0x1b')](config[_0x80c4('0x1a')],{'host':_0x80c4('0x1c'),'port':0x18eb});var socket=require(_0x80c4('0x1d'))(new Redis(config['redis']));require(_0x80c4('0x1e'))[_0x80c4('0x1f')](socket);function respondWithStatusCode(_0x274bb3,_0x4521b1){_0x4521b1=_0x4521b1||0xcc;return function(_0x6237c6){if(_0x6237c6){return _0x274bb3['sendStatus'](_0x4521b1);}return _0x274bb3[_0x80c4('0x20')](_0x4521b1)[_0x80c4('0x21')]();};}function respondWithResult(_0x73c1f7,_0x65d753){_0x65d753=_0x65d753||0xc8;return function(_0x436c03){if(_0x436c03){return _0x73c1f7[_0x80c4('0x20')](_0x65d753)[_0x80c4('0x22')](_0x436c03);}};}function respondWithFilteredResult(_0x124391,_0x491e89){return function(_0x479fb9){if(_0x479fb9){var _0x927a19=_0x479fb9[_0x80c4('0x23')],_0x100335=_0x491e89[_0x80c4('0x24')],_0x36f604=_0x491e89[_0x80c4('0x24')]+_0x491e89[_0x80c4('0x25')],_0x3027a4;if(_0x36f604>=_0x927a19){_0x36f604=_0x927a19;_0x3027a4=0xc8;}else{_0x3027a4=0xce;}_0x124391[_0x80c4('0x20')](_0x3027a4);return _0x124391[_0x80c4('0x26')](_0x80c4('0x27'),_0x100335+'-'+_0x36f604+'/'+_0x927a19)[_0x80c4('0x22')](_0x479fb9);}return null;};}function patchUpdates(_0xa1df4b){return function(_0x3b9b84){try{jsonpatch['apply'](_0x3b9b84,_0xa1df4b,!![]);}catch(_0x61ea22){return BPromise[_0x80c4('0x28')](_0x61ea22);}return _0x3b9b84[_0x80c4('0x29')]();};}function saveUpdates(_0xb75a5c,_0x3d99db){return function(_0x48da8d){if(_0x48da8d){return _0x48da8d[_0x80c4('0x2a')](_0xb75a5c)[_0x80c4('0x2b')](function(_0x1a333f){return _0x1a333f;});}return null;};}function removeEntity(_0x136a93,_0x345095){return function(_0x1ac69b){if(_0x1ac69b){return _0x1ac69b[_0x80c4('0x2c')]()['then'](function(){_0x136a93[_0x80c4('0x20')](0xcc)[_0x80c4('0x21')]();});}};}function handleEntityNotFound(_0x20d7cc,_0x5bdbc4){return function(_0x5695c6){if(!_0x5695c6){_0x20d7cc['sendStatus'](0x194);}return _0x5695c6;};}function handleError(_0x885a2d,_0x5eddfe){_0x5eddfe=_0x5eddfe||0x1f4;return function(_0x37d797){logger[_0x80c4('0x2d')](_0x37d797['stack']);if(_0x37d797[_0x80c4('0x2e')]){delete _0x37d797[_0x80c4('0x2e')];}_0x885a2d[_0x80c4('0x20')](_0x5eddfe)[_0x80c4('0x2f')](_0x37d797);};}function getInteractionUsers(_0x3b4203,_0x4fa625){return new BPromise(function(_0x242d07,_0x53c21b){try{if(_0x4fa625[_0x3b4203['id']]){_0x3b4203[_0x80c4('0x30')]=_['map'](_0x4fa625[_0x3b4203['id']],function(_0x225876){return{'id':_0x225876['id'],'fullname':_0x225876[_0x80c4('0x31')]};});}}catch(_0x3846e6){_0x53c21b(_0x3846e6);}_0x242d07(_0x3b4203);});}function getInteractionTags(_0x12d389,_0x24e816){return new BPromise(function(_0x10f947,_0x424fad){try{if(_0x12d389[_0x80c4('0x32')]){_0x12d389[_0x80c4('0x33')]=[];_0x12d389[_0x80c4('0x32')][_0x80c4('0x34')](',')[_0x80c4('0x35')](function(_0x3843e7){_0x12d389[_0x80c4('0x33')][_0x80c4('0x36')](_0x24e816[_0x3843e7]);});}delete _0x12d389[_0x80c4('0x32')];}catch(_0x33c627){_0x424fad(_0x33c627);}_0x10f947(_0x12d389);});}function updateOpenchannelInteraction(_0x1ea016,_0x4eb53e,_0xd7ae5b){return new BPromise(function(_0x18f520,_0xdf9c3c){return getInteractionUsers(_0x1ea016,_0xd7ae5b)['then'](function(_0x530229){return getInteractionTags(_0x530229,_0x4eb53e);})[_0x80c4('0x2b')](function(_0x1e9660){_0x18f520(_0x1e9660);})['catch'](function(_0x2b5375){_0xdf9c3c(_0x2b5375);});});}exports['index']=function(_0x2db86a,_0x5a1379){var _0xa0a956={},_0x26b66a={},_0x41461d={'count':0x0,'rows':[]};var _0xf0ec7b=_[_0x80c4('0x37')](db[_0x80c4('0x38')]['rawAttributes'],function(_0x1f0fa3){return{'name':_0x1f0fa3[_0x80c4('0x39')],'type':_0x1f0fa3['type'][_0x80c4('0x3a')]};});_0x26b66a['model']=_['map'](_0xf0ec7b,_0x80c4('0x2e'));_0x26b66a[_0x80c4('0x3b')]=_[_0x80c4('0x3c')](_0x2db86a[_0x80c4('0x3b')]);_0x26b66a[_0x80c4('0x3d')]=_['intersection'](_0x26b66a['model'],_0x26b66a[_0x80c4('0x3b')]);_0xa0a956[_0x80c4('0x3e')]=_['intersection'](_0x26b66a[_0x80c4('0x3f')],qs[_0x80c4('0x40')](_0x2db86a[_0x80c4('0x3b')][_0x80c4('0x40')]));_0xa0a956['attributes']=_0xa0a956['attributes'][_0x80c4('0x41')]?_0xa0a956[_0x80c4('0x3e')]:_0x26b66a['model'];if(!_0x2db86a[_0x80c4('0x3b')]['hasOwnProperty'](_0x80c4('0x42'))){_0xa0a956['limit']=qs['limit'](_0x2db86a[_0x80c4('0x3b')]['limit']);_0xa0a956[_0x80c4('0x24')]=qs['offset'](_0x2db86a[_0x80c4('0x3b')]['offset']);}_0xa0a956['order']=qs[_0x80c4('0x43')](_0x2db86a[_0x80c4('0x3b')]['sort']);_0xa0a956[_0x80c4('0x44')]=qs[_0x80c4('0x3d')](_[_0x80c4('0x45')](_0x2db86a[_0x80c4('0x3b')],_0x26b66a[_0x80c4('0x3d')]),_0xf0ec7b);var _0x30ba8b=[];var _0x51a702=squel[_0x80c4('0x46')]()[_0x80c4('0x47')]('id')['field'](_0x80c4('0x2e'))['field'](_0x80c4('0x48'))[_0x80c4('0x49')](_0x80c4('0x4a'));var _0x420242=squel[_0x80c4('0x46')]()['field'](_0x80c4('0x4b'))['field'](_0x80c4('0x4c'))['field'](_0x80c4('0x4d'))[_0x80c4('0x49')](_0x80c4('0x4e'),'ui')[_0x80c4('0x4f')](_0x80c4('0x50'),'u',_0x80c4('0x51'));var _0x248bc2=squel[_0x80c4('0x46')]()[_0x80c4('0x49')](_0x80c4('0x52'),'i')[_0x80c4('0x4f')](_0x80c4('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x80c4('0x4f')](_0x80c4('0x50'),'o','o.id\x20=\x20i.UserId')[_0x80c4('0x4f')](_0x80c4('0x54'),'a',_0x80c4('0x55'))[_0x80c4('0x4f')](_0x80c4('0x56'),'me',_0x80c4('0x57'))[_0x80c4('0x4f')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x80c4('0x4a'),'t',_0x80c4('0x58'));var _0x336132=squel['expr']();var _0x46bd10=[];var _0x564e3f=squel[_0x80c4('0x59')]();var _0x398ec9;if(_0x2db86a[_0x80c4('0x3b')]['search']){_0x398ec9=as[_0x80c4('0x5a')](_0x2db86a[_0x80c4('0x3b')][_0x80c4('0x5b')]);var _0x5800a2=_0x398ec9[_0x80c4('0x5c')];for(var _0x3eef38=0x0;_0x3eef38<_0x398ec9[_0x80c4('0x5d')]['length'];_0x3eef38++){var _0x3ee5a5=_0x398ec9[_0x80c4('0x5d')][_0x3eef38];var _0x58cfe0='i';var _0x479fad=_['find'](_0xf0ec7b,[_0x80c4('0x2e'),_0x3ee5a5[_0x80c4('0x47')]]);if(!_0x479fad){switch(_0x3ee5a5['field']){case'unreadMessages':if(_0x3ee5a5['value']==0x1){_0x248bc2[_0x80c4('0x5e')]('`'+_0x3ee5a5[_0x80c4('0x47')]+_0x80c4('0x5f'));}else{_0x248bc2[_0x80c4('0x5e')]('`'+_0x3ee5a5[_0x80c4('0x47')]+_0x80c4('0x60'));}break;case _0x80c4('0x61'):if(_0x3ee5a5[_0x80c4('0x62')]==='$substring'){if(_0x3ee5a5[_0x80c4('0x63')]['split']('\x20')['length']>0x1){_0x336132[_0x5800a2]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x80c4('0x64')](_0x3ee5a5[_0x80c4('0x63')]),null);}else{var _0x1d5eec='%'+_0x3ee5a5[_0x80c4('0x63')]+'%';_0x336132[_0x5800a2](_0x80c4('0x65'),_0x1d5eec,_0x1d5eec,_0x1d5eec);}}else{_0x479fad=_['find'](_0xf0ec7b,[_0x80c4('0x2e'),_0x80c4('0x66')]);_0x3ee5a5[_0x80c4('0x47')]=_0x80c4('0x66');_0x212cfe=as[_0x80c4('0x67')](_0x58cfe0,_0x479fad['type'],_0x3ee5a5);_0x336132[_0x5800a2](_0x212cfe['text'],_0x212cfe[_0x80c4('0x63')][_0x80c4('0x68')],_0x212cfe[_0x80c4('0x63')][_0x80c4('0x21')]);}break;case _0x80c4('0x69'):var _0x1271a8=_0x3ee5a5[_0x80c4('0x63')]['split'](',')['map'](function(_0x5cd636){return Number(_0x5cd636);});_0x1271a8[_0x80c4('0x35')](function(_0x30eb9a){_0x564e3f['or'](_0x80c4('0x6a'),'%,'+_0x30eb9a+',%');});_0x46bd10=_[_0x80c4('0x6b')](_0x46bd10,_0x1271a8);break;case _0x80c4('0x6c'):if(_0x3ee5a5['operator']===_0x80c4('0x6d')){_0x336132[_0x5800a2](_0x80c4('0x6e'),'%'+_0x3ee5a5[_0x80c4('0x63')]+'%',null);}else{_0x479fad=_[_0x80c4('0x6f')](_0xf0ec7b,[_0x80c4('0x2e'),_0x80c4('0x70')]);_0x3ee5a5['field']=_0x80c4('0x70');_0x212cfe=as[_0x80c4('0x67')](_0x58cfe0,_0x479fad[_0x80c4('0x71')],_0x3ee5a5);_0x336132[_0x5800a2](_0x212cfe[_0x80c4('0x72')],_0x212cfe[_0x80c4('0x63')][_0x80c4('0x68')],_0x212cfe[_0x80c4('0x63')][_0x80c4('0x21')]);}break;case _0x80c4('0x73'):_0x212cfe=as['buildExpression']('me',null,_0x3ee5a5);_0x336132[_0x5800a2](_0x212cfe[_0x80c4('0x72')],_0x212cfe[_0x80c4('0x63')][_0x80c4('0x68')],_0x212cfe[_0x80c4('0x63')]['end']);break;}}else{var _0x212cfe=as['buildExpression'](_0x58cfe0,_0x479fad[_0x80c4('0x71')],_0x3ee5a5);_0x336132[_0x5800a2](_0x212cfe[_0x80c4('0x72')],_0x212cfe[_0x80c4('0x63')][_0x80c4('0x68')],_0x212cfe[_0x80c4('0x63')]['end']);}}}else{var _0x8489cc=_(_0x2db86a[_0x80c4('0x3b')])[_0x80c4('0x3c')]()[_0x80c4('0x37')](function(_0x4fb1ff){return _[_0x80c4('0x74')](_0xf0ec7b,[_0x80c4('0x2e'),_0x4fb1ff])?_0x4fb1ff:undefined;})[_0x80c4('0x75')]()['value']();if(!_['isEmpty'](_0x8489cc)){_0x8489cc[_0x80c4('0x35')](function(_0x4216f4){if(_0x4216f4===_0x80c4('0x76')){_0x248bc2['where'](_0x80c4('0x77'),[][_0x80c4('0x78')](_0x2db86a[_0x80c4('0x3b')][_0x4216f4]));}else if(_0x4216f4===_0x80c4('0x79')){var _0xef0905=JSON[_0x80c4('0x7a')](_0x2db86a[_0x80c4('0x3b')][_0x4216f4])[_0x80c4('0x7b')];var _0x29638b=JSON[_0x80c4('0x7a')](_0x2db86a['query'][_0x4216f4])[_0x80c4('0x7c')];_0x248bc2[_0x80c4('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xef0905,_0x29638b);}else{if(_0x2db86a[_0x80c4('0x3b')][_0x4216f4]===_0x80c4('0x7d')){_0x248bc2[_0x80c4('0x44')]('i.'+_0x4216f4+_0x80c4('0x7e'));}else{_0x248bc2[_0x80c4('0x44')]('i.'+_0x4216f4+_0x80c4('0x7f'),_0x2db86a['query'][_0x4216f4]);}}});}if(_0x2db86a['query'][_0x80c4('0x80')]){if(_0x2db86a[_0x80c4('0x3b')][_0x80c4('0x80')]==0x1){_0x248bc2['having'](_0x80c4('0x81'));}else{_0x248bc2['having'](_0x80c4('0x82'));}}if(_0x2db86a[_0x80c4('0x3b')][_0x80c4('0x83')]){_0x46bd10=_[_0x80c4('0x84')](_0x2db86a[_0x80c4('0x3b')][_0x80c4('0x83')])?_0x2db86a[_0x80c4('0x3b')]['tag']:new Array(_0x2db86a[_0x80c4('0x3b')][_0x80c4('0x83')]);_0x46bd10[_0x80c4('0x35')](function(_0x560530){_0x564e3f['or'](_0x80c4('0x6a'),'%,'+_0x560530+',%');});}if(_0x2db86a[_0x80c4('0x3b')]['filter']){var _0x1106dc=_0x2db86a[_0x80c4('0x3b')][_0x80c4('0x85')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x80c4('0x86'));if(qs[_0x80c4('0x87')](_0x1106dc)){_0x336132['or']('i.id\x20LIKE\x20?',_0x1106dc+'%');}else{_0x336132['or'](_0x80c4('0x88'),qs[_0x80c4('0x64')](_0x1106dc))['or'](_0x80c4('0x89'),_0x1106dc+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1106dc+'%');}}}_0x248bc2[_0x80c4('0x44')](_0x336132);_0x248bc2[_0x80c4('0x8a')](_0x80c4('0x8b'));var _0x10ebc3={'type':db[_0x80c4('0x8c')][_0x80c4('0x8d')][_0x80c4('0x8e')],'raw':!![]};var _0x3ec896=_0x248bc2[_0x80c4('0x8f')]();_0x3ec896[_0x80c4('0x47')]('i.id');_0x3ec896[_0x80c4('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x80c4('0x90'));if(_0xa0a956['order']){_0xa0a956[_0x80c4('0x91')][_0x80c4('0x35')](function(_0x40d96b){_0x248bc2['order']('i.'+_0x40d96b[0x0],_0x40d96b[0x1]===_0x80c4('0x92')?![]:!![]);});}if(!_[_0x80c4('0x93')](_0x46bd10)){_0x248bc2[_0x80c4('0x5e')](_0x564e3f);_0x3ec896[_0x80c4('0x44')](_0x80c4('0x94'),_0x46bd10);}BPromise[_0x80c4('0x95')]()[_0x80c4('0x2b')](function(){if(!_0x398ec9){if(_0x2db86a['query'][_0x80c4('0x76')]||_0x2db86a[_0x80c4('0x3b')]['journey'])return;_0x3ec896[_0x80c4('0x44')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x248bc2[_0x80c4('0x44')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x2db86a[_0x80c4('0x96')][_0x80c4('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b0951){if(_[_0x80c4('0x93')](_0x4b0951)){_0x3ec896[_0x80c4('0x44')](_0x80c4('0x98'));_0x248bc2[_0x80c4('0x44')](_0x80c4('0x98'));}else{_0x3ec896['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x80c4('0x37')](_0x4b0951,'id'));_0x248bc2[_0x80c4('0x44')](_0x80c4('0x77'),_[_0x80c4('0x37')](_0x4b0951,'id'));}});})[_0x80c4('0x2b')](function(){db['sequelize']['query'](_0x3ec896[_0x80c4('0x99')](),_0x10ebc3)[_0x80c4('0x2b')](function(_0x55fb5e){_0x41461d[_0x80c4('0x23')]=_0x55fb5e['length'];if(_0x41461d[_0x80c4('0x23')]===0x0)return[];return db[_0x80c4('0x9a')][_0x80c4('0x3b')](_0x51a702['toString'](),_0x10ebc3)[_0x80c4('0x2b')](function(_0x565bea){_0x30ba8b=_[_0x80c4('0x9b')](_0x565bea,'id');_0x10ebc3=_[_0x80c4('0x9c')](_0x10ebc3,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2db86a[_0x80c4('0x3b')][_0x80c4('0x40')]){_0xa0a956[_0x80c4('0x3e')][_0x80c4('0x35')](function(_0x267a05){_0x248bc2[_0x80c4('0x47')]('i.'+_0x267a05);});}else{_0x248bc2['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x80c4('0x90'));_0x248bc2[_0x80c4('0x47')](_0x80c4('0x9d'),_0x80c4('0x9e'));_0x248bc2[_0x80c4('0x47')](_0x80c4('0x9f'),'Account.mandatoryDisposition');_0x248bc2[_0x80c4('0x47')]('i.*');_0x248bc2[_0x80c4('0x47')](_0x80c4('0xa0'),_0x80c4('0xa1'));_0x248bc2[_0x80c4('0x47')](_0x80c4('0xa2'),'Contact.lastName');_0x248bc2['field'](_0x80c4('0xa3'),'Contact.email');_0x248bc2['field'](_0x80c4('0xa4'),_0x80c4('0xa5'));_0x248bc2[_0x80c4('0x47')]('c.mobile',_0x80c4('0xa6'));_0x248bc2['field'](_0x80c4('0xa7'),_0x80c4('0xa8'));_0x248bc2[_0x80c4('0x47')]('o.fullname',_0x80c4('0xa9'));_0x248bc2[_0x80c4('0x47')](_0x80c4('0xaa'),'Owner.internal');_0x248bc2['field'](_0x80c4('0xab'),_0x80c4('0x32'));}if(_0xa0a956[_0x80c4('0x25')])_0x248bc2['limit'](_0xa0a956['limit']);if(_0xa0a956[_0x80c4('0x24')])_0x248bc2['offset'](_0xa0a956['offset']);return db[_0x80c4('0x9a')][_0x80c4('0x3b')](_0x248bc2['toString'](),_0x10ebc3);})[_0x80c4('0x2b')](function(_0xfeb7af){_0x420242[_0x80c4('0x44')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x80c4('0x37')](_0xfeb7af,'id'));return db[_0x80c4('0x9a')]['query'](_0x420242[_0x80c4('0x99')](),_0x10ebc3)[_0x80c4('0x2b')](function(_0x208195){var _0x1744ef=_[_0x80c4('0xac')](_0x208195,_0x80c4('0xad'));var _0x4bd4c6=[];_0xfeb7af[_0x80c4('0x35')](function(_0x485efc){_0x4bd4c6[_0x80c4('0x36')](updateOpenchannelInteraction(_0x485efc,_0x30ba8b,_0x1744ef));});return BPromise['all'](_0x4bd4c6);});});})[_0x80c4('0x2b')](function(_0x3f7f6a){_0x41461d[_0x80c4('0xae')]=_0x3f7f6a;return _0x41461d;})[_0x80c4('0x2b')](respondWithFilteredResult(_0x5a1379,_0xa0a956));})[_0x80c4('0xaf')](handleError(_0x5a1379,null));};exports['show']=function(_0x23d294,_0x1aaa45){var _0x730502={'raw':![],'where':{'id':_0x23d294[_0x80c4('0xb0')]['id']}},_0x4f5b87={};_0x4f5b87[_0x80c4('0x3f')]=_[_0x80c4('0x3c')](db['OpenchannelInteraction'][_0x80c4('0xb1')]);_0x4f5b87[_0x80c4('0x3b')]=_['keys'](_0x23d294[_0x80c4('0x3b')]);_0x4f5b87[_0x80c4('0x3d')]=_[_0x80c4('0xb2')](_0x4f5b87[_0x80c4('0x3f')],_0x4f5b87[_0x80c4('0x3b')]);_0x730502[_0x80c4('0x3e')]=_[_0x80c4('0xb2')](_0x4f5b87[_0x80c4('0x3f')],qs[_0x80c4('0x40')](_0x23d294['query']['fields']));_0x730502[_0x80c4('0x3e')]=_0x730502[_0x80c4('0x3e')]['length']?_0x730502[_0x80c4('0x3e')]:_0x4f5b87[_0x80c4('0x3f')];if(_0x23d294[_0x80c4('0x3b')][_0x80c4('0xb3')]){_0x730502[_0x80c4('0xb4')]=[{'all':!![]}];}_0x730502=_[_0x80c4('0x9c')]({},_0x730502,_0x23d294[_0x80c4('0xb5')]);return db[_0x80c4('0x38')][_0x80c4('0x6f')](_0x730502)['then'](handleEntityNotFound(_0x1aaa45,null))['then'](respondWithResult(_0x1aaa45,null))[_0x80c4('0xaf')](handleError(_0x1aaa45,null));};exports[_0x80c4('0xb6')]=function(_0x13ba50,_0x54a294){return db[_0x80c4('0x38')][_0x80c4('0xb6')](_0x13ba50[_0x80c4('0x73')],{})['then'](respondWithResult(_0x54a294,0xc9))[_0x80c4('0xaf')](handleError(_0x54a294,null));};exports[_0x80c4('0x2a')]=function(_0x41fecf,_0x44b013){if(_0x41fecf[_0x80c4('0x73')]['id']){delete _0x41fecf[_0x80c4('0x73')]['id'];}return db[_0x80c4('0x38')][_0x80c4('0x6f')]({'where':{'id':_0x41fecf[_0x80c4('0xb0')]['id']}})[_0x80c4('0x2b')](handleEntityNotFound(_0x44b013,null))[_0x80c4('0x2b')](saveUpdates(_0x41fecf[_0x80c4('0x73')],null))[_0x80c4('0x2b')](respondWithResult(_0x44b013,null))['catch'](handleError(_0x44b013,null));};exports['destroy']=function(_0x44486b,_0x88abe5){return db[_0x80c4('0x38')][_0x80c4('0x6f')]({'where':{'id':_0x44486b[_0x80c4('0xb0')]['id']}})[_0x80c4('0x2b')](handleEntityNotFound(_0x88abe5,null))[_0x80c4('0x2b')](removeEntity(_0x88abe5,null))['catch'](handleError(_0x88abe5,null));};exports[_0x80c4('0xb7')]=function(_0x5b6b5f,_0x5f3454){return db[_0x80c4('0x38')][_0x80c4('0xb7')]()['then'](respondWithResult(_0x5f3454,null))[_0x80c4('0xaf')](handleError(_0x5f3454,null));};exports[_0x80c4('0xb8')]=function(_0x472cdd,_0x2d52c3,_0x31b882){return db['OpenchannelMessage'][_0x80c4('0x6f')]({'where':{'id':_0x472cdd['params']['id']}})['then'](handleEntityNotFound(_0x2d52c3,null))[_0x80c4('0x2b')](function(_0xa1b6e0){if(_0xa1b6e0){return _0xa1b6e0[_0x80c4('0xb8')](_0x472cdd[_0x80c4('0x73')]['ids'],_[_0x80c4('0xb9')](_0x472cdd[_0x80c4('0x73')],['ids','id'])||{});}})[_0x80c4('0x2b')](respondWithResult(_0x2d52c3,null))[_0x80c4('0xaf')](handleError(_0x2d52c3,null));};exports[_0x80c4('0xba')]=function(_0x13575d,_0x43823d,_0x12ad3b){var _0x5380b9={'raw':![],'where':{}};var _0x1564e3={};var _0x3058c1={'count':0x0,'rows':[]};return db[_0x80c4('0x38')]['findOne']({'where':{'id':_0x13575d[_0x80c4('0xb0')]['id']}})[_0x80c4('0x2b')](handleEntityNotFound(_0x43823d,null))[_0x80c4('0x2b')](function(_0x3c3b72){if(_0x3c3b72){_0x1564e3[_0x80c4('0x3f')]=_[_0x80c4('0x3c')](db[_0x80c4('0xbb')]['rawAttributes']);_0x1564e3[_0x80c4('0x3b')]=_[_0x80c4('0x3c')](_0x13575d[_0x80c4('0x3b')]);_0x1564e3['filters']=_['intersection'](_0x1564e3[_0x80c4('0x3f')],_0x1564e3[_0x80c4('0x3b')]);_0x5380b9[_0x80c4('0x3e')]=_[_0x80c4('0xb2')](_0x1564e3['model'],qs[_0x80c4('0x40')](_0x13575d[_0x80c4('0x3b')][_0x80c4('0x40')]));_0x5380b9[_0x80c4('0x3e')]=_0x5380b9[_0x80c4('0x3e')][_0x80c4('0x41')]?_0x5380b9[_0x80c4('0x3e')]:_0x1564e3['model'];if(!_0x13575d[_0x80c4('0x3b')][_0x80c4('0xbc')]('nolimit')){_0x5380b9['limit']=qs[_0x80c4('0x25')](_0x13575d['query'][_0x80c4('0x25')]);_0x5380b9['offset']=qs[_0x80c4('0x24')](_0x13575d['query'][_0x80c4('0x24')]);}_0x5380b9[_0x80c4('0x91')]=qs[_0x80c4('0x43')](_0x13575d[_0x80c4('0x3b')][_0x80c4('0x43')]);_0x5380b9['where']=qs[_0x80c4('0x3d')](_[_0x80c4('0x45')](_0x13575d[_0x80c4('0x3b')],_0x1564e3[_0x80c4('0x3d')]));_0x5380b9['where']['OpenchannelInteractionId']=_0x3c3b72['id'];if(_0x13575d['query'][_0x80c4('0x85')]){_0x5380b9['where']=_[_0x80c4('0x9c')](_0x5380b9['where'],{'$or':_[_0x80c4('0x37')](_0x5380b9[_0x80c4('0x3e')],function(_0x56c257){var _0x928379={};_0x928379[_0x56c257]={'$like':'%'+_0x13575d['query']['filter']+'%'};return _0x928379;})});}if(_0x13575d[_0x80c4('0x3b')]['$gte']){var _0x163a06=_0x13575d[_0x80c4('0x3b')][_0x80c4('0x7b')][_0x80c4('0x34')](',');var _0x2cb5bc={};_0x2cb5bc[_0x163a06[0x0]]={'$gte':moment(_0x163a06[0x1])['format'](_0x80c4('0xbd'))};_0x5380b9[_0x80c4('0x44')]=_[_0x80c4('0x9c')](_0x5380b9[_0x80c4('0x44')],_0x2cb5bc);}_0x5380b9=_[_0x80c4('0x9c')]({},_0x5380b9,_0x13575d[_0x80c4('0xb5')]);return db['OpenchannelMessage'][_0x80c4('0x23')]({'where':_0x5380b9['where']})[_0x80c4('0x2b')](function(_0x22e25f){_0x3058c1[_0x80c4('0x23')]=_0x22e25f;if(_0x13575d[_0x80c4('0x3b')][_0x80c4('0xb3')]){_0x5380b9['include']=[{'all':!![]}];}return db[_0x80c4('0xbb')][_0x80c4('0xbe')](_0x5380b9);})[_0x80c4('0x2b')](function(_0x2d07d5){_0x3058c1[_0x80c4('0xae')]=_0x2d07d5;return _0x3058c1;});}})['then'](respondWithFilteredResult(_0x43823d,_0x5380b9))[_0x80c4('0xaf')](handleError(_0x43823d,null));};exports[_0x80c4('0xbf')]=function(_0x3f97cc,_0x4f867a,_0x322c3c){return db[_0x80c4('0x38')]['find']({'where':{'id':_0x3f97cc[_0x80c4('0xb0')]['id']}})['then'](handleEntityNotFound(_0x4f867a,null))[_0x80c4('0x2b')](function(_0x10b1bf){if(_0x10b1bf){return _0x10b1bf['setTags'](_0x3f97cc[_0x80c4('0x73')]['ids'],_[_0x80c4('0xb9')](_0x3f97cc[_0x80c4('0x73')],[_0x80c4('0xc0'),'id'])||{})[_0x80c4('0xc1')](function(){return db[_0x80c4('0x69')][_0x80c4('0xbe')]({'attributes':['id',_0x80c4('0x2e'),_0x80c4('0x48')],'where':{'id':_0x3f97cc[_0x80c4('0x73')][_0x80c4('0xc0')]}});})[_0x80c4('0x2b')](function(_0x5b7dc7){socket[_0x80c4('0xc2')](_0x80c4('0xc3'),{'id':Number(_0x3f97cc[_0x80c4('0xb0')]['id']),'tags':_0x5b7dc7||[]});return{'id':Number(_0x3f97cc[_0x80c4('0xb0')]['id']),'tags':_0x5b7dc7||[]};});}})[_0x80c4('0x2b')](respondWithResult(_0x4f867a,null))[_0x80c4('0xaf')](handleError(_0x4f867a,null));};exports[_0x80c4('0xc4')]=function(_0x4b7ec5,_0x1eeb0f,_0x3fefb0){return db[_0x80c4('0x38')][_0x80c4('0x6f')]({'where':{'id':_0x4b7ec5[_0x80c4('0xb0')]['id']}})[_0x80c4('0x2b')](handleEntityNotFound(_0x1eeb0f,null))[_0x80c4('0x2b')](function(_0x2892de){if(_0x2892de){return _0x2892de['removeTags'](_0x4b7ec5[_0x80c4('0x3b')][_0x80c4('0xc0')]);}})['then'](respondWithStatusCode(_0x1eeb0f,null))[_0x80c4('0xaf')](handleError(_0x1eeb0f,null));};exports['download']=function(_0x5847f9,_0x9839f1){var _0x184933=moment()['unix']()['toString']();var _0x49b283=path['join'](config[_0x80c4('0xc5')],_0x80c4('0xc6'),_0x80c4('0xc7'),_0x80c4('0xc8'));var _0x33140d=path['join'](config[_0x80c4('0xc5')],_0x80c4('0xc6'),_0x80c4('0xc7'),_0x80c4('0xc9'));var _0x784b1=path['join'](_0x49b283,_0x184933);var _0x46b4fe=util['format'](_0x80c4('0xca'),_0x5847f9['params']['id'],_0x184933);var _0x11a959=path[_0x80c4('0xcb')](_0x49b283,_0x46b4fe);var _0x5da49c=[];_0x5da49c['push']({'model':db[_0x80c4('0x6c')],'as':_0x80c4('0x6c'),'attributes':['id',_0x80c4('0x31')],'raw':!![]});_0x5da49c['push']({'model':db[_0x80c4('0xcc')],'as':_0x80c4('0x61'),'attributes':['id',_0x80c4('0xcd'),_0x80c4('0xce')],'raw':!![]});if(_0x5847f9['query'][_0x80c4('0xc9')]){_0x5da49c[_0x80c4('0x36')]({'model':db[_0x80c4('0xcf')],'as':_0x80c4('0xcf'),'raw':!![]});}var _0x302d63=[{'model':db[_0x80c4('0xbb')],'as':_0x80c4('0xd0'),'attributes':['id',_0x80c4('0x73'),_0x80c4('0x79'),_0x80c4('0xd1'),_0x80c4('0xd2'),_0x80c4('0x80')],'include':_0x5da49c}];_0x302d63['push']({'model':db['OpenchannelAccount'],'as':_0x80c4('0xd3'),'attributes':['id','name']});_0x302d63[_0x80c4('0x36')]({'model':db['User'],'as':'Owner','attributes':['id',_0x80c4('0x31')]});return db[_0x80c4('0x38')][_0x80c4('0x6f')]({'where':{'id':_0x5847f9['params']['id']},'include':_0x302d63})[_0x80c4('0x2b')](handleEntityNotFound(_0x9839f1,null))['then'](function(_0x3aa1d0){if(_0x3aa1d0){var _0x25f9a2=_0x3aa1d0[_0x80c4('0xd4')]({'plain':!![]});fs[_0x80c4('0xd5')](_0x784b1);var _0x16acdc={'format':'A4','border':_0x80c4('0xd6'),'header':{'height':_0x80c4('0xd7'),'contents':{'first':_0x80c4('0xd8')}},'footer':{'height':_0x80c4('0xd9'),'contents':{'default':util[_0x80c4('0xda')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x80c4('0xda')](_0x80c4('0xdb'),_0x80c4('0xdc'),_0x25f9a2['id']),moment()[_0x80c4('0xda')](_0x80c4('0xdd'))[_0x80c4('0x99')]())}}};var _0xb7da08={'channel':_0x80c4('0xdc'),'account':_0x25f9a2[_0x80c4('0xd3')][_0x80c4('0x2e')],'agent':_0x25f9a2[_0x80c4('0xde')]?_0x25f9a2[_0x80c4('0xde')][_0x80c4('0x31')]:_0x80c4('0xdf'),'createdAt':moment(_0x25f9a2[_0x80c4('0x79')])['format'](_0x80c4('0xbd'))[_0x80c4('0x99')](),'closedAt':_0x25f9a2[_0x80c4('0xe0')]?moment(_0x25f9a2[_0x80c4('0xe1')])[_0x80c4('0xda')](_0x80c4('0xbd'))[_0x80c4('0x99')]():'','disposition':_0x25f9a2[_0x80c4('0xe2')],'visibility':_0x25f9a2[_0x80c4('0xe3')]?_0x80c4('0xe4'):_0x80c4('0xe5'),'messages':_(_0x25f9a2[_0x80c4('0xd0')])[_0x80c4('0x85')]({'secret':![]})[_0x80c4('0x37')](function(_0x452f38){if(_0x452f38[_0x80c4('0xcf')]){var _0x398798=path[_0x80c4('0xcb')](_0x33140d,_0x452f38[_0x80c4('0xcf')][_0x80c4('0xe6')]);if(fs[_0x80c4('0xe7')](_0x398798)){fs[_0x80c4('0xe8')](_0x398798)[_0x80c4('0xe9')](fs['createWriteStream'](path['join'](_0x784b1,_0x452f38[_0x80c4('0xcf')]['basename'])));}}return{'date':moment(_0x452f38['createdAt'])[_0x80c4('0xda')]('YYYY-MM-DD\x20HH:mm:ss')[_0x80c4('0x99')](),'sender':_0x452f38[_0x80c4('0xd1')]==='out'?_0x452f38[_0x80c4('0x6c')]?_0x452f38[_0x80c4('0x6c')]['fullname']:'System':_0x452f38[_0x80c4('0x61')][_0x80c4('0xcd')]+(_0x452f38['Contact'][_0x80c4('0xce')]?'\x20'+_0x452f38[_0x80c4('0x61')][_0x80c4('0xce')]:''),'body':_0x452f38[_0x80c4('0xcf')]?_0x452f38['Attachment'][_0x80c4('0xe6')]:_0x452f38[_0x80c4('0x73')],'direction':_0x452f38[_0x80c4('0xd1')]==='out'?'A':'C','secret':_0x452f38[_0x80c4('0xd2')],'read':_0x452f38[_0x80c4('0x80')],'attachment':_0x452f38['Attachment']};})[_0x80c4('0x63')]()};return ejs['renderFile'](path[_0x80c4('0xcb')](config['root'],_0x80c4('0xc6'),_0x80c4('0xea'),_0x80c4('0xeb')),{'interaction':_0xb7da08})[_0x80c4('0x2b')](function(_0x4e5fe7){return new BPromise(function(_0x33c46c,_0x123b62){pdf[_0x80c4('0xb6')](_0x4e5fe7,_0x16acdc)[_0x80c4('0xec')](path[_0x80c4('0xcb')](_0x784b1,_0x80c4('0xed')+_0x25f9a2['id']+'-'+_0x184933+_0x80c4('0xee')),function(_0xb1a18a,_0x5e1532){if(_0xb1a18a)return _0x123b62(_0xb1a18a);_0x33c46c(_0x5e1532);});});})[_0x80c4('0x2b')](function(){return new BPromise(function(_0x80f3a6,_0x5a5049){zipdir(_0x784b1,{'saveTo':_0x11a959},function(_0x214704,_0x20bb0c){if(_0x214704)return _0x5a5049(_0x214704);return _0x80f3a6(_0x20bb0c);});})[_0x80c4('0x2b')](function(){return new BPromise(function(_0xdb649e,_0x41951a){rimraf(_0x784b1,function(_0x284db1){if(_0x284db1)_0x41951a(_0x284db1);return _0xdb649e();});});})['then'](function(){return _0x9839f1[_0x80c4('0xef')](_0x11a959,_0x46b4fe,function(_0x356468){if(_0x356468){console['log'](_0x80c4('0xf0'),_0x356468);}else{fs['unlinkSync'](_0x11a959);}});});});}else{return _0x9839f1[_0x80c4('0xf1')](0xc8);}})[_0x80c4('0xaf')](handleError(_0x9839f1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 63b700e..341c63f 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 _0x6140=['remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0xb5287,_0x1ad847){var _0x37929c=function(_0x5eaaba){while(--_0x5eaaba){_0xb5287['push'](_0xb5287['shift']());}};_0x37929c(++_0x1ad847);}(_0x6140,0x84));var _0x0614=function(_0x4ee140,_0xddce08){_0x4ee140=_0x4ee140-0x0;var _0x1c14bd=_0x6140[_0x4ee140];return _0x1c14bd;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x0614('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x0614('0x0'))['db'][_0x0614('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0614('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0614('0x3')};function emitEvent(_0x5e4da4){return function(_0x3a831b,_0x318057,_0xd6395f){_0x3a831b['getUsers']({'attributes':['id'],'raw':!![]})[_0x0614('0x4')](function(_0x8ed401){_0x3a831b['setDataValue'](_0x0614('0x5'),_0x8ed401[_0x0614('0x6')](function(_0x5417c4){return{'id':_0x5417c4['id']};}));return OpenchannelMessage[_0x0614('0x7')]({'where':{'OpenchannelInteractionId':_0x3a831b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0614('0x4')](function(_0x204be9){_0x3a831b[_0x0614('0x8')](_0x0614('0x9'),_0x204be9[_0x0614('0xa')]);OpenchannelInteractionEvents[_0x0614('0xb')](_0x5e4da4+':'+_0x3a831b['id'],_0x3a831b);OpenchannelInteractionEvents[_0x0614('0xb')](_0x5e4da4,_0x3a831b);_0xd6395f(null);})[_0x0614('0xc')](_0xd6395f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x0614('0xd')](e,emitEvent(event));}}module[_0x0614('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2ca2=['setDataValue','Users','findAll','length','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','save','getUsers','then'];(function(_0xedc133,_0x39842c){var _0x58c7fb=function(_0x5ef1a5){while(--_0x5ef1a5){_0xedc133['push'](_0xedc133['shift']());}};_0x58c7fb(++_0x39842c);}(_0x2ca2,0xe4));var _0x22ca=function(_0x5bb14f,_0x106d44){_0x5bb14f=_0x5bb14f-0x0;var _0x219019=_0x2ca2[_0x5bb14f];return _0x219019;};'use strict';var EventEmitter=require(_0x22ca('0x0'));var OpenchannelInteraction=require(_0x22ca('0x1'))['db'][_0x22ca('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x22ca('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2997ad){return function(_0x148140,_0x36f157,_0x4ff236){_0x148140[_0x22ca('0x4')]({'attributes':['id'],'raw':!![]})[_0x22ca('0x5')](function(_0x165da8){_0x148140[_0x22ca('0x6')](_0x22ca('0x7'),_0x165da8['map'](function(_0x362654){return{'id':_0x362654['id']};}));return OpenchannelMessage[_0x22ca('0x8')]({'where':{'OpenchannelInteractionId':_0x148140['id'],'direction':'in','read':![]},'raw':!![]});})[_0x22ca('0x5')](function(_0x1e22cd){_0x148140[_0x22ca('0x6')]('unreadMessages',_0x1e22cd[_0x22ca('0x9')]);OpenchannelInteractionEvents['emit'](_0x2997ad+':'+_0x148140['id'],_0x148140);OpenchannelInteractionEvents['emit'](_0x2997ad,_0x148140);_0x4ff236(null);})['catch'](_0x4ff236(null));};}for(var e in events){if(events[_0x22ca('0xa')](e)){var event=events[e];OpenchannelInteraction[_0x22ca('0xb')](e,emitEvent(event));}}module[_0x22ca('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 212f80d..09f08f3 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 _0x6382=['changed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x46a5b4,_0x191e3e){var _0x4a356e=function(_0x34b4e6){while(--_0x34b4e6){_0x46a5b4['push'](_0x46a5b4['shift']());}};_0x4a356e(++_0x191e3e);}(_0x6382,0x116));var _0x2638=function(_0x3672bb,_0x1d2b24){_0x3672bb=_0x3672bb-0x0;var _0x46d02d=_0x6382[_0x3672bb];return _0x46d02d;};'use strict';var _=require('lodash');var util=require(_0x2638('0x0'));var logger=require('../../config/logger')(_0x2638('0x1'));var moment=require(_0x2638('0x2'));var BPromise=require(_0x2638('0x3'));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(_0x2638('0x4'));module[_0x2638('0x5')]=function(_0x3eeb1d,_0x2a8d47){return _0x3eeb1d[_0x2638('0x6')](_0x2638('0x7'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dc8d3,_0x53267d,_0x5558dd){if(_0x1dc8d3[_0x2638('0x8')]('closed')){_0x1dc8d3['closedAt']=moment()[_0x2638('0x9')](_0x2638('0xa'));}_0x5558dd(null,_0x1dc8d3);}}});}; \ No newline at end of file +var _0xb84e=['OpenchannelInteraction','openchannel_interactions','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x34bd11,_0x322433){var _0x2a4f5c=function(_0x3296e3){while(--_0x3296e3){_0x34bd11['push'](_0x34bd11['shift']());}};_0x2a4f5c(++_0x322433);}(_0xb84e,0x8b));var _0xeb84=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xb84e[_0x282a1f];return _0x296ea7;};'use strict';var _=require(_0xeb84('0x0'));var util=require(_0xeb84('0x1'));var logger=require(_0xeb84('0x2'))(_0xeb84('0x3'));var moment=require(_0xeb84('0x4'));var BPromise=require(_0xeb84('0x5'));var rp=require(_0xeb84('0x6'));var fs=require('fs');var path=require(_0xeb84('0x7'));var rimraf=require(_0xeb84('0x8'));var config=require(_0xeb84('0x9'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x3e80d0,_0x14c57a){return _0x3e80d0[_0xeb84('0xa')](_0xeb84('0xb'),attributes,{'tableName':_0xeb84('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x261de0,_0x3eec15,_0x41bef4){if(_0x261de0['changed'](_0xeb84('0xd'))){_0x261de0[_0xeb84('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x41bef4(null,_0x261de0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 18171f1..b4c69b3 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 _0x6d5b=['result','catch','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','omit','AddTags','stringify','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5edb51,_0x11dd47){var _0x1b10df=function(_0x167cf9){while(--_0x167cf9){_0x5edb51['push'](_0x5edb51['shift']());}};_0x1b10df(++_0x11dd47);}(_0x6d5b,0x1a1));var _0xb6d5=function(_0x49f118,_0x5138e4){_0x49f118=_0x49f118-0x0;var _0x3a0443=_0x6d5b[_0x49f118];return _0x3a0443;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb6d5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6d5('0x1'));var db=require(_0xb6d5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6d5('0x3'))(_0xb6d5('0x4'));var config=require(_0xb6d5('0x5'));var jayson=require(_0xb6d5('0x6'));var client=jayson[_0xb6d5('0x7')][_0xb6d5('0x8')]({'port':0x232a});config[_0xb6d5('0x9')]=_[_0xb6d5('0xa')](config[_0xb6d5('0x9')],{'host':_0xb6d5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb6d5('0xc'))[_0xb6d5('0xd')](socket);function respondWithRpcPromise(_0x376a44,_0x48fe7f,_0x2391e7){return new BPromise(function(_0x483ef4,_0x152306){return client[_0xb6d5('0xe')](_0x376a44,_0x2391e7)[_0xb6d5('0xf')](function(_0x4437b8){logger[_0xb6d5('0x10')](_0xb6d5('0x11'),_0x48fe7f,_0xb6d5('0x12'));logger[_0xb6d5('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x48fe7f,_0xb6d5('0x12'),JSON['stringify'](_0x4437b8));if(_0x4437b8[_0xb6d5('0x14')]){if(_0x4437b8[_0xb6d5('0x14')][_0xb6d5('0x15')]===0x1f4){logger[_0xb6d5('0x14')](_0xb6d5('0x11'),_0x48fe7f,_0x4437b8[_0xb6d5('0x14')][_0xb6d5('0x16')]);return _0x152306(_0x4437b8[_0xb6d5('0x14')][_0xb6d5('0x16')]);}logger[_0xb6d5('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x48fe7f,_0x4437b8[_0xb6d5('0x14')][_0xb6d5('0x16')]);return _0x483ef4(_0x4437b8[_0xb6d5('0x14')]['message']);}else{logger['info'](_0xb6d5('0x11'),_0x48fe7f,'request\x20sent');_0x483ef4(_0x4437b8[_0xb6d5('0x17')]['message']);}})[_0xb6d5('0x18')](function(_0x167aba){logger[_0xb6d5('0x14')](_0xb6d5('0x11'),_0x48fe7f,_0x167aba);_0x152306(_0x167aba);});});}exports['UpdateOpenchannelInteraction']=function(_0x480bcb){var _0x391172=this;return new Promise(function(_0x53937b,_0x11baaf){return db['OpenchannelInteraction'][_0xb6d5('0x19')](_0x480bcb[_0xb6d5('0x1a')],{'raw':_0x480bcb[_0xb6d5('0x1b')]?_0x480bcb[_0xb6d5('0x1b')][_0xb6d5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480bcb[_0xb6d5('0x1b')]?_0x480bcb[_0xb6d5('0x1b')]['where']||null:null,'attributes':_0x480bcb[_0xb6d5('0x1b')]?_0x480bcb[_0xb6d5('0x1b')][_0xb6d5('0x1d')]||null:null,'limit':_0x480bcb[_0xb6d5('0x1b')]?_0x480bcb['options'][_0xb6d5('0x1e')]||null:null})[_0xb6d5('0xf')](function(_0x4e06c6){logger[_0xb6d5('0x10')](_0xb6d5('0x1f'),_0x480bcb);logger[_0xb6d5('0x13')](_0xb6d5('0x1f'),_0x480bcb,JSON['stringify'](_0x4e06c6));_0x53937b(_0x4e06c6);})[_0xb6d5('0x18')](function(_0x2b8d53){logger[_0xb6d5('0x14')](_0xb6d5('0x1f'),_0x2b8d53[_0xb6d5('0x16')],_0x480bcb);_0x11baaf(_0x391172[_0xb6d5('0x14')](0x1f4,_0x2b8d53[_0xb6d5('0x16')]));});});};exports[_0xb6d5('0x20')]=function(_0x496ecb){return new Promise(function(_0x3914d3,_0x3577b4){return db[_0xb6d5('0x21')][_0xb6d5('0x22')]({'where':_0x496ecb[_0xb6d5('0x1b')]?_0x496ecb[_0xb6d5('0x1b')][_0xb6d5('0x23')]||null:null})[_0xb6d5('0xf')](function(_0x17281b){if(_0x17281b){return _0x17281b[_0xb6d5('0x24')](_0x496ecb[_0xb6d5('0x1a')]['ids'],_[_0xb6d5('0x25')](_0x496ecb[_0xb6d5('0x1a')],['ids','id'])||{});}})['spread'](function(_0x4f28ca){logger['info'](_0xb6d5('0x26'),_0x496ecb);logger[_0xb6d5('0x13')](_0xb6d5('0x26'),_0x496ecb,JSON[_0xb6d5('0x27')](_0x4f28ca));_0x3914d3(_0x4f28ca);})[_0xb6d5('0x18')](function(_0x45a06e){logger[_0xb6d5('0x14')](_0xb6d5('0x26'),_0x45a06e[_0xb6d5('0x16')],_0x496ecb);_0x3577b4(_this[_0xb6d5('0x14')](0x1f4,_0x45a06e['message']));});});}; \ No newline at end of file +var _0xc91d=['result','catch','UpdateOpenchannelInteraction','body','options','raw','limit','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','omit','ids','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xc91d,0xb0));var _0xdc91=function(_0x16f999,_0x185767){_0x16f999=_0x16f999-0x0;var _0x50e988=_0xc91d[_0x16f999];return _0x50e988;};'use strict';var _=require('lodash');var util=require(_0xdc91('0x0'));var moment=require(_0xdc91('0x1'));var BPromise=require(_0xdc91('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc91('0x3'));var db=require(_0xdc91('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc91('0x5'))(_0xdc91('0x6'));var config=require(_0xdc91('0x7'));var jayson=require(_0xdc91('0x8'));var client=jayson['client'][_0xdc91('0x9')]({'port':0x232a});config[_0xdc91('0xa')]=_['defaults'](config[_0xdc91('0xa')],{'host':_0xdc91('0xb'),'port':0x18eb});var socket=require(_0xdc91('0xc'))(new Redis(config[_0xdc91('0xa')]));require('./openchannelInteraction.socket')[_0xdc91('0xd')](socket);function respondWithRpcPromise(_0x176245,_0x45798a,_0x360ed4){return new BPromise(function(_0x275263,_0x4094de){return client[_0xdc91('0xe')](_0x176245,_0x360ed4)[_0xdc91('0xf')](function(_0x211a96){logger['info'](_0xdc91('0x10'),_0x45798a,_0xdc91('0x11'));logger['debug'](_0xdc91('0x12'),_0x45798a,_0xdc91('0x11'),JSON[_0xdc91('0x13')](_0x211a96));if(_0x211a96['error']){if(_0x211a96[_0xdc91('0x14')][_0xdc91('0x15')]===0x1f4){logger[_0xdc91('0x14')](_0xdc91('0x10'),_0x45798a,_0x211a96[_0xdc91('0x14')][_0xdc91('0x16')]);return _0x4094de(_0x211a96['error'][_0xdc91('0x16')]);}logger[_0xdc91('0x14')](_0xdc91('0x10'),_0x45798a,_0x211a96[_0xdc91('0x14')]['message']);return _0x275263(_0x211a96['error'][_0xdc91('0x16')]);}else{logger[_0xdc91('0x17')](_0xdc91('0x10'),_0x45798a,_0xdc91('0x11'));_0x275263(_0x211a96[_0xdc91('0x18')]['message']);}})[_0xdc91('0x19')](function(_0x28bdbd){logger[_0xdc91('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x45798a,_0x28bdbd);_0x4094de(_0x28bdbd);});});}exports[_0xdc91('0x1a')]=function(_0x2bd887){var _0x3e57e3=this;return new Promise(function(_0x3be250,_0x483f0b){return db['OpenchannelInteraction']['update'](_0x2bd887[_0xdc91('0x1b')],{'raw':_0x2bd887[_0xdc91('0x1c')]?_0x2bd887[_0xdc91('0x1c')][_0xdc91('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bd887['options']?_0x2bd887[_0xdc91('0x1c')]['where']||null:null,'attributes':_0x2bd887[_0xdc91('0x1c')]?_0x2bd887[_0xdc91('0x1c')]['attributes']||null:null,'limit':_0x2bd887[_0xdc91('0x1c')]?_0x2bd887[_0xdc91('0x1c')][_0xdc91('0x1e')]||null:null})[_0xdc91('0xf')](function(_0xd20550){logger[_0xdc91('0x17')](_0xdc91('0x1a'),_0x2bd887);logger[_0xdc91('0x1f')](_0xdc91('0x1a'),_0x2bd887,JSON[_0xdc91('0x13')](_0xd20550));_0x3be250(_0xd20550);})[_0xdc91('0x19')](function(_0x3131d9){logger[_0xdc91('0x14')](_0xdc91('0x1a'),_0x3131d9[_0xdc91('0x16')],_0x2bd887);_0x483f0b(_0x3e57e3[_0xdc91('0x14')](0x1f4,_0x3131d9['message']));});});};exports[_0xdc91('0x20')]=function(_0x273807){return new Promise(function(_0x31c67e,_0x9f0291){return db[_0xdc91('0x21')][_0xdc91('0x22')]({'where':_0x273807['options']?_0x273807[_0xdc91('0x1c')][_0xdc91('0x23')]||null:null})[_0xdc91('0xf')](function(_0x1c4b75){if(_0x1c4b75){return _0x1c4b75[_0xdc91('0x24')](_0x273807[_0xdc91('0x1b')]['ids'],_[_0xdc91('0x25')](_0x273807[_0xdc91('0x1b')],[_0xdc91('0x26'),'id'])||{});}})['spread'](function(_0x211c00){logger['info'](_0xdc91('0x27'),_0x273807);logger[_0xdc91('0x1f')]('AddTags',_0x273807,JSON[_0xdc91('0x13')](_0x211c00));_0x31c67e(_0x211c00);})[_0xdc91('0x19')](function(_0x3892ed){logger['error'](_0xdc91('0x27'),_0x3892ed[_0xdc91('0x16')],_0x273807);_0x9f0291(_this['error'](0x1f4,_0x3892ed[_0xdc91('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f83282c..0a76bbd 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 _0x92b4=['length','openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener','register'];(function(_0xbb0310,_0x240c6a){var _0x1e9b6e=function(_0x3c32fe){while(--_0x3c32fe){_0xbb0310['push'](_0xbb0310['shift']());}};_0x1e9b6e(++_0x240c6a);}(_0x92b4,0x92));var _0x492b=function(_0x3ad3ff,_0x2db04b){_0x3ad3ff=_0x3ad3ff-0x0;var _0x5eb8d0=_0x92b4[_0x3ad3ff];return _0x5eb8d0;};'use strict';var OpenchannelInteractionEvents=require(_0x492b('0x0'));var events=['save',_0x492b('0x1'),_0x492b('0x2')];function createListener(_0x5008fe,_0x4f0f37){return function(_0x5ac010){_0x4f0f37[_0x492b('0x3')](_0x5008fe,_0x5ac010);};}function removeListener(_0xda2505,_0x578d0e){return function(){OpenchannelInteractionEvents[_0x492b('0x4')](_0xda2505,_0x578d0e);};}exports[_0x492b('0x5')]=function(_0x438151){for(var _0x2420a5=0x0,_0x2388b7=events[_0x492b('0x6')];_0x2420a5<_0x2388b7;_0x2420a5++){var _0x2f7e22=events[_0x2420a5];var _0x162f26=createListener(_0x492b('0x7')+_0x2f7e22,_0x438151);OpenchannelInteractionEvents['on'](_0x2f7e22,_0x162f26);}}; \ No newline at end of file +var _0xc354=['./openchannelInteraction.events','save','remove','update','removeListener','register','length','openchannelInteraction:'];(function(_0x520927,_0x55ba28){var _0x28b7f6=function(_0x50afc0){while(--_0x50afc0){_0x520927['push'](_0x520927['shift']());}};_0x28b7f6(++_0x55ba28);}(_0xc354,0x98));var _0x4c35=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc354[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelInteractionEvents=require(_0x4c35('0x0'));var events=[_0x4c35('0x1'),_0x4c35('0x2'),_0x4c35('0x3')];function createListener(_0x317d7e,_0xbb238e){return function(_0x48e78f){_0xbb238e['emit'](_0x317d7e,_0x48e78f);};}function removeListener(_0x57599b,_0x5a6f76){return function(){OpenchannelInteractionEvents[_0x4c35('0x4')](_0x57599b,_0x5a6f76);};}exports[_0x4c35('0x5')]=function(_0x14ffc3){for(var _0x3c4cd1=0x0,_0x5cdee6=events[_0x4c35('0x6')];_0x3c4cd1<_0x5cdee6;_0x3c4cd1++){var _0x19edfe=events[_0x3c4cd1];var _0x8d9057=createListener(_0x4c35('0x7')+_0x19edfe,_0x14ffc3);OpenchannelInteractionEvents['on'](_0x19edfe,_0x8d9057);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 3ec314b..21f2b87 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 _0xda82=['post','tracked','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','/describe','describe','get','/:id','show'];(function(_0x358372,_0x5336fe){var _0x2e3eb3=function(_0x23ca11){while(--_0x23ca11){_0x358372['push'](_0x358372['shift']());}};_0x2e3eb3(++_0x5336fe);}(_0xda82,0xdb));var _0x2da8=function(_0x33e00b,_0x1b4863){_0x33e00b=_0x33e00b-0x0;var _0x393021=_0xda82[_0x33e00b];return _0x393021;};'use strict';var multer=require(_0x2da8('0x0'));var util=require(_0x2da8('0x1'));var path=require('path');var timeout=require(_0x2da8('0x2'));var express=require(_0x2da8('0x3'));var router=express[_0x2da8('0x4')]();var auth=require(_0x2da8('0x5'));var interaction=require(_0x2da8('0x6'));var config=require(_0x2da8('0x7'));var controller=require(_0x2da8('0x8'));router['get']('/',auth[_0x2da8('0x9')](),controller['index']);router['get'](_0x2da8('0xa'),auth[_0x2da8('0x9')](),controller[_0x2da8('0xb')]);router[_0x2da8('0xc')](_0x2da8('0xd'),auth[_0x2da8('0x9')](),controller[_0x2da8('0xe')]);router[_0x2da8('0xf')]('/',auth['isAuthenticated'](),interaction[_0x2da8('0x10')]('openchannel','openchannelmessage:create'),controller[_0x2da8('0x11')]);router['put'](_0x2da8('0xd'),auth['isAuthenticated'](),controller[_0x2da8('0x12')]);router[_0x2da8('0x13')](_0x2da8('0x14'),auth[_0x2da8('0x9')](),controller[_0x2da8('0x15')]);router[_0x2da8('0x13')](_0x2da8('0x16'),auth[_0x2da8('0x9')](),controller[_0x2da8('0x17')]);router[_0x2da8('0x18')](_0x2da8('0xd'),auth[_0x2da8('0x9')](),controller[_0x2da8('0x19')]);module['exports']=router; \ No newline at end of file +var _0x17ab=['show','openchannelmessage:create','create','/:id/accept','put','/:id/reject','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x17ab,0x65));var _0xb17a=function(_0x16e9bb,_0x2040e0){_0x16e9bb=_0x16e9bb-0x0;var _0x1c87fb=_0x17ab[_0x16e9bb];return _0x1c87fb;};'use strict';var multer=require('multer');var util=require(_0xb17a('0x0'));var path=require(_0xb17a('0x1'));var timeout=require('connect-timeout');var express=require(_0xb17a('0x2'));var router=express[_0xb17a('0x3')]();var auth=require(_0xb17a('0x4'));var interaction=require(_0xb17a('0x5'));var config=require(_0xb17a('0x6'));var controller=require(_0xb17a('0x7'));router[_0xb17a('0x8')]('/',auth[_0xb17a('0x9')](),controller[_0xb17a('0xa')]);router[_0xb17a('0x8')](_0xb17a('0xb'),auth['isAuthenticated'](),controller[_0xb17a('0xc')]);router[_0xb17a('0x8')](_0xb17a('0xd'),auth[_0xb17a('0x9')](),controller[_0xb17a('0xe')]);router['post']('/',auth[_0xb17a('0x9')](),interaction['tracked']('openchannel',_0xb17a('0xf')),controller[_0xb17a('0x10')]);router['put'](_0xb17a('0xd'),auth['isAuthenticated'](),controller['update']);router['put'](_0xb17a('0x11'),auth[_0xb17a('0x9')](),controller['accept']);router[_0xb17a('0x12')](_0xb17a('0x13'),auth[_0xb17a('0x9')](),controller['reject']);router[_0xb17a('0x14')](_0xb17a('0xd'),auth['isAuthenticated'](),controller[_0xb17a('0x15')]);module[_0xb17a('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 26ca3d4..bb27bc5 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 _0x9f13=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x9f13,0x1e9));var _0x39f1=function(_0x55cf47,_0x3d037b){_0x55cf47=_0x55cf47-0x0;var _0x42bf2b=_0x9f13[_0x55cf47];return _0x42bf2b;};'use strict';var Sequelize=require(_0x39f1('0x0'));module['exports']={'body':{'type':Sequelize[_0x39f1('0x1')](_0x39f1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x39f1('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x39f1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x39f1('0x4')]('in',_0x39f1('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x39f1('0x6')]}}; \ No newline at end of file +var _0x789f=['exports','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x4b1744,_0x3f3c39){var _0x5e4a6d=function(_0x594c61){while(--_0x594c61){_0x4b1744['push'](_0x4b1744['shift']());}};_0x5e4a6d(++_0x3f3c39);}(_0x789f,0x197));var _0xf789=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x789f[_0x31a576];return _0x30b1d3;};'use strict';var Sequelize=require(_0xf789('0x0'));module[_0xf789('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf789('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf789('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf789('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf789('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xf789('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f854342..993019b 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 _0x6a6a=['result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','send','index','OpenchannelMessage','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','params','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','agent','null','RejectMessage','rejectMessage','reject','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.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','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x1233d1,_0x15cf04){var _0x56ee5e=function(_0x470ed9){while(--_0x470ed9){_0x1233d1['push'](_0x1233d1['shift']());}};_0x56ee5e(++_0x15cf04);}(_0x6a6a,0xcb));var _0xa6a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6a6a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xa6a6('0x0'));var emlformat=require(_0xa6a6('0x1'));var rimraf=require(_0xa6a6('0x2'));var zipdir=require(_0xa6a6('0x3'));var jsonpatch=require(_0xa6a6('0x4'));var rp=require(_0xa6a6('0x5'));var moment=require(_0xa6a6('0x6'));var BPromise=require(_0xa6a6('0x7'));var Mustache=require(_0xa6a6('0x8'));var util=require(_0xa6a6('0x9'));var path=require('path');var sox=require(_0xa6a6('0xa'));var csv=require(_0xa6a6('0xb'));var ejs=require(_0xa6a6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa6a6('0xd'));var crypto=require(_0xa6a6('0xe'));var jsforce=require(_0xa6a6('0xf'));var deskjs=require(_0xa6a6('0x10'));var toCsv=require(_0xa6a6('0xb'));var querystring=require(_0xa6a6('0x11'));var Papa=require(_0xa6a6('0x12'));var Redis=require(_0xa6a6('0x13'));var authService=require(_0xa6a6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa6a6('0x15'));var hardwareService=require(_0xa6a6('0x16'));var logger=require(_0xa6a6('0x17'))(_0xa6a6('0x18'));var utils=require(_0xa6a6('0x19'));var config=require(_0xa6a6('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa6a6('0x1b')](config['redis'],{'host':_0xa6a6('0x1c'),'port':0x18eb});var socket=require(_0xa6a6('0x1d'))(new Redis(config[_0xa6a6('0x1e')]));require(_0xa6a6('0x1f'))[_0xa6a6('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa6a6('0x21')][_0xa6a6('0x22')]({'port':0x232c});var client9002=jayson[_0xa6a6('0x21')][_0xa6a6('0x22')]({'port':0x232a});function checkPasswordPattern(_0x232560,_0x27d6bc,_0x3d87c8){if(_0x3d87c8){var _0x3e4ae5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e4ae5[_0xa6a6('0x23')](_0x27d6bc)){return _0x232560;}else{throw new db[(_0xa6a6('0x24'))][(_0xa6a6('0x25'))](_0xa6a6('0x26'));}}else{return _0x232560;}}function respondWithRpcPromise(_0x174ba1,_0x2dc4f1,_0x378aa4,_0x5a343f){return new BPromise(function(_0x32f02c,_0x1f94da){var _0x44f0bb=_0x5a343f||client;return _0x44f0bb[_0xa6a6('0x27')](_0x174ba1,_0x378aa4)[_0xa6a6('0x28')](function(_0x2f0de2){logger[_0xa6a6('0x29')](_0xa6a6('0x2a'),_0x2dc4f1,'request\x20sent');logger[_0xa6a6('0x2b')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2dc4f1,_0xa6a6('0x2c'),JSON[_0xa6a6('0x2d')](_0x2f0de2));if(_0x2f0de2[_0xa6a6('0x2e')]){if(_0x2f0de2[_0xa6a6('0x2e')][_0xa6a6('0x2f')]===0x1f4){logger[_0xa6a6('0x2e')](_0xa6a6('0x2a'),_0x2dc4f1,_0x2f0de2['error'][_0xa6a6('0x30')]);return _0x1f94da(_0x2f0de2['error']['message']);}logger[_0xa6a6('0x2e')](_0xa6a6('0x2a'),_0x2dc4f1,_0x2f0de2['error']['message']);return _0x32f02c(_0x2f0de2[_0xa6a6('0x2e')][_0xa6a6('0x30')]);}else{logger[_0xa6a6('0x29')](_0xa6a6('0x2a'),_0x2dc4f1,_0xa6a6('0x2c'));_0x32f02c(_0x2f0de2[_0xa6a6('0x31')][_0xa6a6('0x30')]);}})['catch'](function(_0x5a6eb5){logger[_0xa6a6('0x2e')](_0xa6a6('0x2a'),_0x2dc4f1,_0x5a6eb5);_0x1f94da(_0x5a6eb5);});});}function respondWithStatusCode(_0xced51,_0x490ca1){_0x490ca1=_0x490ca1||0xcc;return function(_0x400f76){if(_0x400f76){return _0xced51[_0xa6a6('0x32')](_0x490ca1);}return _0xced51[_0xa6a6('0x33')](_0x490ca1)[_0xa6a6('0x34')]();};}function respondWithResult(_0x56877d,_0x22061a){_0x22061a=_0x22061a||0xc8;return function(_0x56b7f3){if(_0x56b7f3){return _0x56877d[_0xa6a6('0x33')](_0x22061a)[_0xa6a6('0x35')](_0x56b7f3);}};}function respondWithFilteredResult(_0x26715b,_0x42128b){return function(_0x2c3b9f){if(_0x2c3b9f){var _0x31f264=_0x2c3b9f[_0xa6a6('0x36')],_0x338750=_0x42128b[_0xa6a6('0x37')],_0x521f57=_0x42128b['offset']+_0x42128b[_0xa6a6('0x38')],_0x3e0131;if(_0x521f57>=_0x31f264){_0x521f57=_0x31f264;_0x3e0131=0xc8;}else{_0x3e0131=0xce;}_0x26715b[_0xa6a6('0x33')](_0x3e0131);return _0x26715b[_0xa6a6('0x39')](_0xa6a6('0x3a'),_0x338750+'-'+_0x521f57+'/'+_0x31f264)[_0xa6a6('0x35')](_0x2c3b9f);}return null;};}function patchUpdates(_0x5515be){return function(_0x448066){try{jsonpatch[_0xa6a6('0x3b')](_0x448066,_0x5515be,!![]);}catch(_0x18a709){return BPromise['reject'](_0x18a709);}return _0x448066['save']();};}function saveUpdates(_0x33b8d3,_0x49cac4){return function(_0x17061c){if(_0x17061c){return _0x17061c[_0xa6a6('0x3c')](_0x33b8d3)[_0xa6a6('0x28')](function(_0x5f1713){return _0x5f1713;});}return null;};}function removeEntity(_0x37e9a9,_0x302691){return function(_0x283478){if(_0x283478){return _0x283478['destroy']()[_0xa6a6('0x28')](function(){_0x37e9a9[_0xa6a6('0x33')](0xcc)[_0xa6a6('0x34')]();});}};}function handleEntityNotFound(_0x2314be,_0x1ee38b){return function(_0x13ce91){if(!_0x13ce91){_0x2314be['sendStatus'](0x194);}return _0x13ce91;};}function handleError(_0x1c0a18,_0x4677be){_0x4677be=_0x4677be||0x1f4;return function(_0x2dbd68){logger[_0xa6a6('0x2e')](_0x2dbd68['stack']);if(_0x2dbd68['name']){delete _0x2dbd68['name'];}_0x1c0a18[_0xa6a6('0x33')](_0x4677be)[_0xa6a6('0x3d')](_0x2dbd68);};}exports[_0xa6a6('0x3e')]=function(_0x57a980,_0x482c11){var _0x44ed76={},_0x1be0d7={},_0xa181c={'count':0x0,'rows':[]};var _0x5b5295=_['map'](db[_0xa6a6('0x3f')][_0xa6a6('0x40')],function(_0x4213f9){return{'name':_0x4213f9[_0xa6a6('0x41')],'type':_0x4213f9['type']['key']};});_0x1be0d7[_0xa6a6('0x42')]=_['map'](_0x5b5295,_0xa6a6('0x43'));_0x1be0d7[_0xa6a6('0x44')]=_[_0xa6a6('0x45')](_0x57a980[_0xa6a6('0x44')]);_0x1be0d7[_0xa6a6('0x46')]=_[_0xa6a6('0x47')](_0x1be0d7['model'],_0x1be0d7['query']);_0x44ed76[_0xa6a6('0x48')]=_[_0xa6a6('0x47')](_0x1be0d7[_0xa6a6('0x42')],qs[_0xa6a6('0x49')](_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x49')]));_0x44ed76[_0xa6a6('0x48')]=_0x44ed76[_0xa6a6('0x48')][_0xa6a6('0x4a')]?_0x44ed76[_0xa6a6('0x48')]:_0x1be0d7[_0xa6a6('0x42')];if(!_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x4b')](_0xa6a6('0x4c'))){_0x44ed76[_0xa6a6('0x38')]=qs['limit'](_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x38')]);_0x44ed76[_0xa6a6('0x37')]=qs[_0xa6a6('0x37')](_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x37')]);}_0x44ed76[_0xa6a6('0x4d')]=qs[_0xa6a6('0x4e')](_0x57a980['query'][_0xa6a6('0x4e')]);_0x44ed76[_0xa6a6('0x4f')]=qs[_0xa6a6('0x46')](_[_0xa6a6('0x50')](_0x57a980[_0xa6a6('0x44')],_0x1be0d7[_0xa6a6('0x46')]),_0x5b5295);if(_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x51')]){_0x44ed76[_0xa6a6('0x4f')]=_[_0xa6a6('0x52')](_0x44ed76[_0xa6a6('0x4f')],{'$or':_['map'](_0x5b5295,function(_0x5f2833){if(_0x5f2833[_0xa6a6('0x53')]!==_0xa6a6('0x54')){var _0x3a1200={};_0x3a1200[_0x5f2833[_0xa6a6('0x43')]]={'$like':'%'+_0x57a980[_0xa6a6('0x44')][_0xa6a6('0x51')]+'%'};return _0x3a1200;}})});}_0x44ed76=_[_0xa6a6('0x52')]({},_0x44ed76,_0x57a980[_0xa6a6('0x55')]);var _0x2afd72={'where':_0x44ed76[_0xa6a6('0x4f')]};return db[_0xa6a6('0x3f')]['count'](_0x2afd72)[_0xa6a6('0x28')](function(_0x4dae20){_0xa181c['count']=_0x4dae20;if(_0x57a980['query'][_0xa6a6('0x56')]){_0x44ed76[_0xa6a6('0x57')]=[{'all':!![]}];}return db[_0xa6a6('0x3f')][_0xa6a6('0x58')](_0x44ed76);})[_0xa6a6('0x28')](function(_0x4ff85f){_0xa181c[_0xa6a6('0x59')]=_0x4ff85f;return _0xa181c;})[_0xa6a6('0x28')](respondWithFilteredResult(_0x482c11,_0x44ed76))['catch'](handleError(_0x482c11,null));};exports[_0xa6a6('0x5a')]=function(_0xce2b85,_0x5cd72d){var _0x560410={'raw':!![],'where':{'id':_0xce2b85['params']['id']}},_0x3dae4c={};_0x3dae4c[_0xa6a6('0x42')]=_[_0xa6a6('0x45')](db['OpenchannelMessage']['rawAttributes']);_0x3dae4c[_0xa6a6('0x44')]=_[_0xa6a6('0x45')](_0xce2b85[_0xa6a6('0x44')]);_0x3dae4c[_0xa6a6('0x46')]=_[_0xa6a6('0x47')](_0x3dae4c[_0xa6a6('0x42')],_0x3dae4c[_0xa6a6('0x44')]);_0x560410['attributes']=_[_0xa6a6('0x47')](_0x3dae4c[_0xa6a6('0x42')],qs[_0xa6a6('0x49')](_0xce2b85[_0xa6a6('0x44')][_0xa6a6('0x49')]));_0x560410[_0xa6a6('0x48')]=_0x560410['attributes']['length']?_0x560410['attributes']:_0x3dae4c['model'];if(_0xce2b85[_0xa6a6('0x44')][_0xa6a6('0x56')]){_0x560410['include']=[{'all':!![]}];}_0x560410=_[_0xa6a6('0x52')]({},_0x560410,_0xce2b85[_0xa6a6('0x55')]);return db[_0xa6a6('0x3f')][_0xa6a6('0x5b')](_0x560410)['then'](handleEntityNotFound(_0x5cd72d,null))[_0xa6a6('0x28')](respondWithResult(_0x5cd72d,null))[_0xa6a6('0x5c')](handleError(_0x5cd72d,null));};exports[_0xa6a6('0x5d')]=function(_0x2c3963,_0x5181bc){return db[_0xa6a6('0x3f')][_0xa6a6('0x5d')](_0x2c3963[_0xa6a6('0x5e')],{})[_0xa6a6('0x28')](respondWithResult(_0x5181bc,0xc9))[_0xa6a6('0x5c')](handleError(_0x5181bc,null));};exports[_0xa6a6('0x3c')]=function(_0x540c05,_0x5d5190){if(_0x540c05[_0xa6a6('0x5e')]['id']){delete _0x540c05[_0xa6a6('0x5e')]['id'];}return db[_0xa6a6('0x3f')][_0xa6a6('0x5b')]({'where':{'id':_0x540c05['params']['id']}})[_0xa6a6('0x28')](handleEntityNotFound(_0x5d5190,null))[_0xa6a6('0x28')](saveUpdates(_0x540c05[_0xa6a6('0x5e')],null))[_0xa6a6('0x28')](respondWithResult(_0x5d5190,null))[_0xa6a6('0x5c')](handleError(_0x5d5190,null));};exports['destroy']=function(_0x3dc6ee,_0x4de7bb){return db[_0xa6a6('0x3f')]['find']({'where':{'id':_0x3dc6ee['params']['id']}})[_0xa6a6('0x28')](handleEntityNotFound(_0x4de7bb,null))['then'](removeEntity(_0x4de7bb,null))[_0xa6a6('0x5c')](handleError(_0x4de7bb,null));};exports[_0xa6a6('0x5f')]=function(_0x3b9f3a,_0x26d783){return db[_0xa6a6('0x3f')][_0xa6a6('0x5f')]()[_0xa6a6('0x28')](respondWithResult(_0x26d783,null))[_0xa6a6('0x5c')](handleError(_0x26d783,null));};var interaction_log=require(_0xa6a6('0x17'))(_0xa6a6('0x60'));exports[_0xa6a6('0x61')]=function(_0x8d38c9,_0x3ee1f4,_0x4f56f1){var _0x34ea65={'channel':_0xa6a6('0x62')};if(_0x8d38c9[_0xa6a6('0x5e')]['id']){delete _0x8d38c9[_0xa6a6('0x5e')]['id'];}_0x8d38c9[_0xa6a6('0x5e')]['read']=!![];_0x8d38c9[_0xa6a6('0x5e')]['readAt']=moment()[_0xa6a6('0x63')](_0xa6a6('0x64'));_0x8d38c9[_0xa6a6('0x5e')][_0xa6a6('0x65')]=_0x8d38c9[_0xa6a6('0x5e')]['UserId']||_0x8d38c9[_0xa6a6('0x66')]['id'];return db['OpenchannelMessage'][_0xa6a6('0x5b')]({'where':{'id':_0x8d38c9[_0xa6a6('0x67')]['id'],'UserId':null},'include':[{'model':db[_0xa6a6('0x68')],'as':_0xa6a6('0x69')}]})['then'](handleEntityNotFound(_0x3ee1f4,null))[_0xa6a6('0x28')](saveUpdates(_0x8d38c9[_0xa6a6('0x5e')],null))[_0xa6a6('0x28')](function(_0x2aeb19){if(_0x2aeb19){_0x34ea65[_0xa6a6('0x30')]=_0x2aeb19[_0xa6a6('0x6a')]({'plain':!![]});return db[_0xa6a6('0x6b')][_0xa6a6('0x5b')]({'where':{'id':_0x2aeb19[_0xa6a6('0x6c')]}});}return null;})[_0xa6a6('0x28')](handleEntityNotFound(_0x3ee1f4,null))[_0xa6a6('0x28')](function(_0x3e7b20){if(_0x3e7b20){return _0x3e7b20[_0xa6a6('0x3c')]({'UserId':_0x8d38c9[_0xa6a6('0x5e')]['UserId'],'read1stAt':_[_0xa6a6('0x6d')](_0x3e7b20['read1stAt'])?moment()['format'](_0xa6a6('0x64')):undefined});}return null;})[_0xa6a6('0x28')](function(_0x5c7e63){if(_0x5c7e63){_0x34ea65[_0xa6a6('0x6e')]=_0x5c7e63[_0xa6a6('0x6a')]({'plain':!![]});interaction_log[_0xa6a6('0x29')](_0xa6a6('0x6f'),_0x8d38c9[_0xa6a6('0x66')]['id'],_0x8d38c9[_0xa6a6('0x66')][_0xa6a6('0x43')],_0x8d38c9[_0xa6a6('0x66')][_0xa6a6('0x70')],_0x34ea65[_0xa6a6('0x6e')]['id'],_0x8d38c9[_0xa6a6('0x5e')]?JSON[_0xa6a6('0x2d')](_0x8d38c9[_0xa6a6('0x5e')]):'null');return respondWithRpcPromise(_0xa6a6('0x71'),_0xa6a6('0x72'),_0x34ea65);}return null;})[_0xa6a6('0x28')](function(_0x523a9e){if(_0x523a9e){if(_0x8d38c9['body']['manual']){_0x34ea65[_0xa6a6('0x30')][_0xa6a6('0x73')]=util[_0xa6a6('0x63')]('SIP/%s',_0x8d38c9[_0xa6a6('0x66')][_0xa6a6('0x43')]);_0x34ea65[_0xa6a6('0x30')]['channel']=_0x34ea65[_0xa6a6('0x74')];_0x34ea65[_0xa6a6('0x30')][_0xa6a6('0x75')]=_0xa6a6('0x61');return respondWithRpcPromise('EventManager',_0xa6a6('0x76'),{'event':_0xa6a6('0x77'),'message':_0x34ea65[_0xa6a6('0x30')]},client9002)[_0xa6a6('0x28')](function(){return _0x34ea65;});}return _0x34ea65;}return null;})[_0xa6a6('0x28')](respondWithResult(_0x3ee1f4,null))[_0xa6a6('0x5c')](handleError(_0x3ee1f4,null));};var interaction_log=require('../../config/logger')(_0xa6a6('0x60'));exports['reject']=function(_0x3394ba,_0x250987,_0x38a2a3){var _0x198d2={'agent':{},'channel':'openchannel'};if(_0x3394ba[_0xa6a6('0x5e')]['id']){delete _0x3394ba[_0xa6a6('0x5e')]['id'];}_0x3394ba[_0xa6a6('0x5e')]['UserId']=_0x3394ba[_0xa6a6('0x5e')][_0xa6a6('0x65')]||_0x3394ba[_0xa6a6('0x66')]['id'];_0x198d2[_0xa6a6('0x78')]['id']=_0x3394ba[_0xa6a6('0x5e')]['UserId'];return db['OpenchannelMessage'][_0xa6a6('0x5b')]({'where':{'id':_0x3394ba[_0xa6a6('0x67')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x250987,null))['then'](function(_0x5e0112){if(_0x5e0112){_0x198d2[_0xa6a6('0x30')]=_0x5e0112[_0xa6a6('0x6a')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa6a6('0x5b')]({'where':{'id':_0x5e0112[_0xa6a6('0x6c')]}});}return null;})[_0xa6a6('0x28')](handleEntityNotFound(_0x250987,null))[_0xa6a6('0x28')](function(_0x2552b5){if(_0x2552b5){_0x198d2['interaction']=_0x2552b5[_0xa6a6('0x6a')]({'plain':!![]});interaction_log[_0xa6a6('0x29')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3394ba[_0xa6a6('0x66')]['id'],_0x3394ba['user'][_0xa6a6('0x43')],_0x3394ba[_0xa6a6('0x66')]['role'],_0x198d2[_0xa6a6('0x6e')]['id'],_0x3394ba[_0xa6a6('0x5e')]?JSON[_0xa6a6('0x2d')](_0x3394ba[_0xa6a6('0x5e')]):_0xa6a6('0x79'));return respondWithRpcPromise(_0xa6a6('0x7a'),_0xa6a6('0x7b'),_0x198d2);}return null;})['then'](function(_0x33d345){if(_0x33d345){_0x33d345[_0xa6a6('0x30')][_0xa6a6('0x73')]=util[_0xa6a6('0x63')]('SIP/%s',_0x3394ba[_0xa6a6('0x66')][_0xa6a6('0x43')]);_0x33d345[_0xa6a6('0x30')][_0xa6a6('0x74')]=_0x198d2[_0xa6a6('0x74')];_0x33d345['message'][_0xa6a6('0x75')]=_0xa6a6('0x7c');respondWithRpcPromise('EventManager',_0xa6a6('0x76'),{'event':_0xa6a6('0x7d'),'message':_0x33d345['message']},client9002);return _0x198d2;}return null;})[_0xa6a6('0x28')](respondWithResult(_0x250987,null))[_0xa6a6('0x5c')](handleError(_0x250987,null));}; \ No newline at end of file +var _0xe7c2=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','body','update','describe','openchannel-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','read1stAt','interaction','role','null','AcceptMessage','interface','SIP/%s','channel','event','accept','EventManager','openchannel','agent','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectmessage','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','test','Sequelize','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','count','offset','limit','Content-Range','json','reject','save','destroy','end','sendStatus','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type'];(function(_0x13d363,_0x50b6e2){var _0x1ef624=function(_0xc30f3c){while(--_0xc30f3c){_0x13d363['push'](_0x13d363['shift']());}};_0x1ef624(++_0x50b6e2);}(_0xe7c2,0x1b8));var _0x2e7c=function(_0x41ebe6,_0x2398b9){_0x41ebe6=_0x41ebe6-0x0;var _0x4bdba3=_0xe7c2[_0x41ebe6];return _0x4bdba3;};'use strict';var pdf=require(_0x2e7c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2e7c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e7c('0x2'));var rp=require(_0x2e7c('0x3'));var moment=require(_0x2e7c('0x4'));var BPromise=require(_0x2e7c('0x5'));var Mustache=require(_0x2e7c('0x6'));var util=require(_0x2e7c('0x7'));var path=require(_0x2e7c('0x8'));var sox=require(_0x2e7c('0x9'));var csv=require(_0x2e7c('0xa'));var ejs=require(_0x2e7c('0xb'));var fs=require('fs');var _=require(_0x2e7c('0xc'));var squel=require(_0x2e7c('0xd'));var crypto=require(_0x2e7c('0xe'));var jsforce=require(_0x2e7c('0xf'));var deskjs=require(_0x2e7c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2e7c('0x11'));var Papa=require(_0x2e7c('0x12'));var Redis=require(_0x2e7c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2e7c('0x14'));var as=require(_0x2e7c('0x15'));var hardwareService=require(_0x2e7c('0x16'));var logger=require(_0x2e7c('0x17'))(_0x2e7c('0x18'));var utils=require(_0x2e7c('0x19'));var config=require('../../config/environment');var db=require(_0x2e7c('0x1a'))['db'];config[_0x2e7c('0x1b')]=_[_0x2e7c('0x1c')](config['redis'],{'host':_0x2e7c('0x1d'),'port':0x18eb});var socket=require(_0x2e7c('0x1e'))(new Redis(config[_0x2e7c('0x1b')]));require(_0x2e7c('0x1f'))['register'](socket);var jayson=require(_0x2e7c('0x20'));var client=jayson['client'][_0x2e7c('0x21')]({'port':0x232c});var client9002=jayson[_0x2e7c('0x22')][_0x2e7c('0x21')]({'port':0x232a});function checkPasswordPattern(_0x1ee155,_0x193a39,_0x255b52){if(_0x255b52){var _0x5994e3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5994e3[_0x2e7c('0x23')](_0x193a39)){return _0x1ee155;}else{throw new db[(_0x2e7c('0x24'))]['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 _0x1ee155;}}function respondWithRpcPromise(_0x5ddf44,_0x4b245e,_0x4693f3,_0x42976d){return new BPromise(function(_0x3d2744,_0x57585c){var _0x4c6685=_0x42976d||client;return _0x4c6685[_0x2e7c('0x25')](_0x5ddf44,_0x4693f3)[_0x2e7c('0x26')](function(_0x5159e7){logger[_0x2e7c('0x27')](_0x2e7c('0x28'),_0x4b245e,'request\x20sent');logger[_0x2e7c('0x29')](_0x2e7c('0x2a'),_0x4b245e,_0x2e7c('0x2b'),JSON['stringify'](_0x5159e7));if(_0x5159e7['error']){if(_0x5159e7[_0x2e7c('0x2c')][_0x2e7c('0x2d')]===0x1f4){logger[_0x2e7c('0x2c')](_0x2e7c('0x28'),_0x4b245e,_0x5159e7[_0x2e7c('0x2c')]['message']);return _0x57585c(_0x5159e7[_0x2e7c('0x2c')][_0x2e7c('0x2e')]);}logger[_0x2e7c('0x2c')](_0x2e7c('0x28'),_0x4b245e,_0x5159e7[_0x2e7c('0x2c')][_0x2e7c('0x2e')]);return _0x3d2744(_0x5159e7[_0x2e7c('0x2c')][_0x2e7c('0x2e')]);}else{logger[_0x2e7c('0x27')](_0x2e7c('0x28'),_0x4b245e,_0x2e7c('0x2b'));_0x3d2744(_0x5159e7[_0x2e7c('0x2f')][_0x2e7c('0x2e')]);}})[_0x2e7c('0x30')](function(_0x59d0c7){logger['error'](_0x2e7c('0x28'),_0x4b245e,_0x59d0c7);_0x57585c(_0x59d0c7);});});}function respondWithStatusCode(_0x2f0670,_0x4b30fd){_0x4b30fd=_0x4b30fd||0xcc;return function(_0x26a59b){if(_0x26a59b){return _0x2f0670['sendStatus'](_0x4b30fd);}return _0x2f0670[_0x2e7c('0x31')](_0x4b30fd)['end']();};}function respondWithResult(_0x171fbe,_0xbaba74){_0xbaba74=_0xbaba74||0xc8;return function(_0x332137){if(_0x332137){return _0x171fbe[_0x2e7c('0x31')](_0xbaba74)['json'](_0x332137);}};}function respondWithFilteredResult(_0x576c25,_0x232347){return function(_0x5d4f2e){if(_0x5d4f2e){var _0x7e43c8=_0x5d4f2e[_0x2e7c('0x32')],_0x5dcdfe=_0x232347['offset'],_0x9da822=_0x232347[_0x2e7c('0x33')]+_0x232347[_0x2e7c('0x34')],_0x124d86;if(_0x9da822>=_0x7e43c8){_0x9da822=_0x7e43c8;_0x124d86=0xc8;}else{_0x124d86=0xce;}_0x576c25['status'](_0x124d86);return _0x576c25['set'](_0x2e7c('0x35'),_0x5dcdfe+'-'+_0x9da822+'/'+_0x7e43c8)[_0x2e7c('0x36')](_0x5d4f2e);}return null;};}function patchUpdates(_0x46c0ff){return function(_0x441ecf){try{jsonpatch['apply'](_0x441ecf,_0x46c0ff,!![]);}catch(_0x205868){return BPromise[_0x2e7c('0x37')](_0x205868);}return _0x441ecf[_0x2e7c('0x38')]();};}function saveUpdates(_0x48ba43,_0x45f27d){return function(_0x24f8c7){if(_0x24f8c7){return _0x24f8c7['update'](_0x48ba43)['then'](function(_0x123c9a){return _0x123c9a;});}return null;};}function removeEntity(_0x5a1f6a,_0x2bbbf0){return function(_0x529e07){if(_0x529e07){return _0x529e07[_0x2e7c('0x39')]()[_0x2e7c('0x26')](function(){_0x5a1f6a[_0x2e7c('0x31')](0xcc)[_0x2e7c('0x3a')]();});}};}function handleEntityNotFound(_0x4b2119,_0x51afad){return function(_0x2c52be){if(!_0x2c52be){_0x4b2119[_0x2e7c('0x3b')](0x194);}return _0x2c52be;};}function handleError(_0x4734e8,_0x2edcfe){_0x2edcfe=_0x2edcfe||0x1f4;return function(_0x339bdd){logger[_0x2e7c('0x2c')](_0x339bdd[_0x2e7c('0x3c')]);if(_0x339bdd[_0x2e7c('0x3d')]){delete _0x339bdd[_0x2e7c('0x3d')];}_0x4734e8['status'](_0x2edcfe)['send'](_0x339bdd);};}exports[_0x2e7c('0x3e')]=function(_0x1abf67,_0x50b68a){var _0x2d245d={},_0x54e350={},_0x5a979c={'count':0x0,'rows':[]};var _0x29851a=_[_0x2e7c('0x3f')](db[_0x2e7c('0x40')][_0x2e7c('0x41')],function(_0x18a1e6){return{'name':_0x18a1e6[_0x2e7c('0x42')],'type':_0x18a1e6[_0x2e7c('0x43')][_0x2e7c('0x44')]};});_0x54e350[_0x2e7c('0x45')]=_[_0x2e7c('0x3f')](_0x29851a,_0x2e7c('0x3d'));_0x54e350[_0x2e7c('0x46')]=_[_0x2e7c('0x47')](_0x1abf67[_0x2e7c('0x46')]);_0x54e350[_0x2e7c('0x48')]=_[_0x2e7c('0x49')](_0x54e350[_0x2e7c('0x45')],_0x54e350[_0x2e7c('0x46')]);_0x2d245d['attributes']=_[_0x2e7c('0x49')](_0x54e350['model'],qs['fields'](_0x1abf67['query'][_0x2e7c('0x4a')]));_0x2d245d[_0x2e7c('0x4b')]=_0x2d245d['attributes']['length']?_0x2d245d[_0x2e7c('0x4b')]:_0x54e350['model'];if(!_0x1abf67[_0x2e7c('0x46')][_0x2e7c('0x4c')](_0x2e7c('0x4d'))){_0x2d245d[_0x2e7c('0x34')]=qs['limit'](_0x1abf67[_0x2e7c('0x46')][_0x2e7c('0x34')]);_0x2d245d[_0x2e7c('0x33')]=qs[_0x2e7c('0x33')](_0x1abf67[_0x2e7c('0x46')][_0x2e7c('0x33')]);}_0x2d245d[_0x2e7c('0x4e')]=qs[_0x2e7c('0x4f')](_0x1abf67[_0x2e7c('0x46')]['sort']);_0x2d245d[_0x2e7c('0x50')]=qs['filters'](_[_0x2e7c('0x51')](_0x1abf67[_0x2e7c('0x46')],_0x54e350['filters']),_0x29851a);if(_0x1abf67[_0x2e7c('0x46')]['filter']){_0x2d245d['where']=_[_0x2e7c('0x52')](_0x2d245d['where'],{'$or':_[_0x2e7c('0x3f')](_0x29851a,function(_0x34f394){if(_0x34f394['type']!==_0x2e7c('0x53')){var _0x170ebf={};_0x170ebf[_0x34f394[_0x2e7c('0x3d')]]={'$like':'%'+_0x1abf67[_0x2e7c('0x46')][_0x2e7c('0x54')]+'%'};return _0x170ebf;}})});}_0x2d245d=_['merge']({},_0x2d245d,_0x1abf67[_0x2e7c('0x55')]);var _0x160e52={'where':_0x2d245d[_0x2e7c('0x50')]};return db[_0x2e7c('0x40')][_0x2e7c('0x32')](_0x160e52)[_0x2e7c('0x26')](function(_0x12ad2e){_0x5a979c[_0x2e7c('0x32')]=_0x12ad2e;if(_0x1abf67['query'][_0x2e7c('0x56')]){_0x2d245d[_0x2e7c('0x57')]=[{'all':!![]}];}return db[_0x2e7c('0x40')][_0x2e7c('0x58')](_0x2d245d);})['then'](function(_0x499b32){_0x5a979c[_0x2e7c('0x59')]=_0x499b32;return _0x5a979c;})[_0x2e7c('0x26')](respondWithFilteredResult(_0x50b68a,_0x2d245d))[_0x2e7c('0x30')](handleError(_0x50b68a,null));};exports[_0x2e7c('0x5a')]=function(_0x1c0e37,_0x3254db){var _0x519dae={'raw':!![],'where':{'id':_0x1c0e37[_0x2e7c('0x5b')]['id']}},_0x354bcc={};_0x354bcc[_0x2e7c('0x45')]=_[_0x2e7c('0x47')](db[_0x2e7c('0x40')]['rawAttributes']);_0x354bcc[_0x2e7c('0x46')]=_[_0x2e7c('0x47')](_0x1c0e37['query']);_0x354bcc['filters']=_['intersection'](_0x354bcc[_0x2e7c('0x45')],_0x354bcc[_0x2e7c('0x46')]);_0x519dae[_0x2e7c('0x4b')]=_['intersection'](_0x354bcc[_0x2e7c('0x45')],qs['fields'](_0x1c0e37[_0x2e7c('0x46')][_0x2e7c('0x4a')]));_0x519dae[_0x2e7c('0x4b')]=_0x519dae[_0x2e7c('0x4b')][_0x2e7c('0x5c')]?_0x519dae[_0x2e7c('0x4b')]:_0x354bcc[_0x2e7c('0x45')];if(_0x1c0e37[_0x2e7c('0x46')]['includeAll']){_0x519dae['include']=[{'all':!![]}];}_0x519dae=_[_0x2e7c('0x52')]({},_0x519dae,_0x1c0e37['options']);return db[_0x2e7c('0x40')][_0x2e7c('0x5d')](_0x519dae)[_0x2e7c('0x26')](handleEntityNotFound(_0x3254db,null))['then'](respondWithResult(_0x3254db,null))['catch'](handleError(_0x3254db,null));};exports[_0x2e7c('0x5e')]=function(_0x35c4c6,_0x1be678){return db[_0x2e7c('0x40')][_0x2e7c('0x5e')](_0x35c4c6[_0x2e7c('0x5f')],{})['then'](respondWithResult(_0x1be678,0xc9))[_0x2e7c('0x30')](handleError(_0x1be678,null));};exports[_0x2e7c('0x60')]=function(_0x57192e,_0x11b8a4){if(_0x57192e[_0x2e7c('0x5f')]['id']){delete _0x57192e[_0x2e7c('0x5f')]['id'];}return db['OpenchannelMessage'][_0x2e7c('0x5d')]({'where':{'id':_0x57192e['params']['id']}})['then'](handleEntityNotFound(_0x11b8a4,null))[_0x2e7c('0x26')](saveUpdates(_0x57192e[_0x2e7c('0x5f')],null))[_0x2e7c('0x26')](respondWithResult(_0x11b8a4,null))[_0x2e7c('0x30')](handleError(_0x11b8a4,null));};exports[_0x2e7c('0x39')]=function(_0x220e00,_0x4cf251){return db[_0x2e7c('0x40')][_0x2e7c('0x5d')]({'where':{'id':_0x220e00[_0x2e7c('0x5b')]['id']}})[_0x2e7c('0x26')](handleEntityNotFound(_0x4cf251,null))['then'](removeEntity(_0x4cf251,null))[_0x2e7c('0x30')](handleError(_0x4cf251,null));};exports[_0x2e7c('0x61')]=function(_0xdf4be,_0x11bdba){return db['OpenchannelMessage'][_0x2e7c('0x61')]()[_0x2e7c('0x26')](respondWithResult(_0x11bdba,null))[_0x2e7c('0x30')](handleError(_0x11bdba,null));};var interaction_log=require(_0x2e7c('0x17'))(_0x2e7c('0x62'));exports['accept']=function(_0x455e82,_0x53cb75,_0x4048ca){var _0x1d5d0c={'channel':'openchannel'};if(_0x455e82[_0x2e7c('0x5f')]['id']){delete _0x455e82[_0x2e7c('0x5f')]['id'];}_0x455e82[_0x2e7c('0x5f')][_0x2e7c('0x63')]=!![];_0x455e82[_0x2e7c('0x5f')][_0x2e7c('0x64')]=moment()[_0x2e7c('0x65')](_0x2e7c('0x66'));_0x455e82[_0x2e7c('0x5f')][_0x2e7c('0x67')]=_0x455e82[_0x2e7c('0x5f')][_0x2e7c('0x67')]||_0x455e82[_0x2e7c('0x68')]['id'];return db[_0x2e7c('0x40')]['find']({'where':{'id':_0x455e82[_0x2e7c('0x5b')]['id'],'UserId':null},'include':[{'model':db[_0x2e7c('0x69')],'as':_0x2e7c('0x6a')}]})['then'](handleEntityNotFound(_0x53cb75,null))[_0x2e7c('0x26')](saveUpdates(_0x455e82[_0x2e7c('0x5f')],null))[_0x2e7c('0x26')](function(_0x460363){if(_0x460363){_0x1d5d0c['message']=_0x460363[_0x2e7c('0x6b')]({'plain':!![]});return db[_0x2e7c('0x6c')][_0x2e7c('0x5d')]({'where':{'id':_0x460363['OpenchannelInteractionId']}});}return null;})[_0x2e7c('0x26')](handleEntityNotFound(_0x53cb75,null))[_0x2e7c('0x26')](function(_0x5235ab){if(_0x5235ab){return _0x5235ab['update']({'UserId':_0x455e82[_0x2e7c('0x5f')][_0x2e7c('0x67')],'read1stAt':_['isNil'](_0x5235ab[_0x2e7c('0x6d')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3df3ea){if(_0x3df3ea){_0x1d5d0c[_0x2e7c('0x6e')]=_0x3df3ea[_0x2e7c('0x6b')]({'plain':!![]});interaction_log[_0x2e7c('0x27')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x455e82['user']['id'],_0x455e82['user'][_0x2e7c('0x3d')],_0x455e82[_0x2e7c('0x68')][_0x2e7c('0x6f')],_0x1d5d0c[_0x2e7c('0x6e')]['id'],_0x455e82[_0x2e7c('0x5f')]?JSON['stringify'](_0x455e82[_0x2e7c('0x5f')]):_0x2e7c('0x70'));return respondWithRpcPromise(_0x2e7c('0x71'),'acceptMessage',_0x1d5d0c);}return null;})[_0x2e7c('0x26')](function(_0x53c9bd){if(_0x53c9bd){if(_0x455e82[_0x2e7c('0x5f')]['manual']){_0x1d5d0c[_0x2e7c('0x2e')][_0x2e7c('0x72')]=util[_0x2e7c('0x65')](_0x2e7c('0x73'),_0x455e82['user'][_0x2e7c('0x3d')]);_0x1d5d0c[_0x2e7c('0x2e')][_0x2e7c('0x74')]=_0x1d5d0c[_0x2e7c('0x74')];_0x1d5d0c[_0x2e7c('0x2e')][_0x2e7c('0x75')]=_0x2e7c('0x76');return respondWithRpcPromise(_0x2e7c('0x77'),_0x2e7c('0x77'),{'event':'acceptmessage','message':_0x1d5d0c[_0x2e7c('0x2e')]},client9002)[_0x2e7c('0x26')](function(){return _0x1d5d0c;});}return _0x1d5d0c;}return null;})[_0x2e7c('0x26')](respondWithResult(_0x53cb75,null))[_0x2e7c('0x30')](handleError(_0x53cb75,null));};var interaction_log=require('../../config/logger')(_0x2e7c('0x62'));exports[_0x2e7c('0x37')]=function(_0x1b819e,_0x14af7f,_0x406582){var _0x51c70a={'agent':{},'channel':_0x2e7c('0x78')};if(_0x1b819e[_0x2e7c('0x5f')]['id']){delete _0x1b819e[_0x2e7c('0x5f')]['id'];}_0x1b819e[_0x2e7c('0x5f')][_0x2e7c('0x67')]=_0x1b819e['body'][_0x2e7c('0x67')]||_0x1b819e[_0x2e7c('0x68')]['id'];_0x51c70a[_0x2e7c('0x79')]['id']=_0x1b819e[_0x2e7c('0x5f')]['UserId'];return db[_0x2e7c('0x40')]['find']({'where':{'id':_0x1b819e[_0x2e7c('0x5b')]['id'],'UserId':null}})[_0x2e7c('0x26')](handleEntityNotFound(_0x14af7f,null))[_0x2e7c('0x26')](function(_0x5d8a81){if(_0x5d8a81){_0x51c70a[_0x2e7c('0x2e')]=_0x5d8a81['get']({'plain':!![]});return db[_0x2e7c('0x6c')][_0x2e7c('0x5d')]({'where':{'id':_0x5d8a81[_0x2e7c('0x7a')]}});}return null;})[_0x2e7c('0x26')](handleEntityNotFound(_0x14af7f,null))['then'](function(_0x2101de){if(_0x2101de){_0x51c70a['interaction']=_0x2101de[_0x2e7c('0x6b')]({'plain':!![]});interaction_log[_0x2e7c('0x27')](_0x2e7c('0x7b'),_0x1b819e[_0x2e7c('0x68')]['id'],_0x1b819e['user'][_0x2e7c('0x3d')],_0x1b819e[_0x2e7c('0x68')]['role'],_0x51c70a[_0x2e7c('0x6e')]['id'],_0x1b819e[_0x2e7c('0x5f')]?JSON[_0x2e7c('0x7c')](_0x1b819e[_0x2e7c('0x5f')]):_0x2e7c('0x70'));return respondWithRpcPromise(_0x2e7c('0x7d'),'rejectMessage',_0x51c70a);}return null;})[_0x2e7c('0x26')](function(_0x5b9560){if(_0x5b9560){_0x5b9560[_0x2e7c('0x2e')][_0x2e7c('0x72')]=util[_0x2e7c('0x65')](_0x2e7c('0x73'),_0x1b819e[_0x2e7c('0x68')][_0x2e7c('0x3d')]);_0x5b9560[_0x2e7c('0x2e')]['channel']=_0x51c70a[_0x2e7c('0x74')];_0x5b9560[_0x2e7c('0x2e')][_0x2e7c('0x75')]=_0x2e7c('0x37');respondWithRpcPromise('EventManager',_0x2e7c('0x77'),{'event':_0x2e7c('0x7e'),'message':_0x5b9560[_0x2e7c('0x2e')]},client9002);return _0x51c70a;}return null;})['then'](respondWithResult(_0x14af7f,null))[_0x2e7c('0x30')](handleError(_0x14af7f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 2d7755d..02147b0 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 _0xae02=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xae02,0x169));var _0x2ae0=function(_0x1c9940,_0x40fceb){_0x1c9940=_0x1c9940-0x0;var _0x536128=_0xae02[_0x1c9940];return _0x536128;};'use strict';var EventEmitter=require(_0x2ae0('0x0'));var OpenchannelMessage=require(_0x2ae0('0x1'))['db'][_0x2ae0('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2ae0('0x3')](0x0);var events={'afterCreate':_0x2ae0('0x4'),'afterUpdate':_0x2ae0('0x5'),'afterDestroy':_0x2ae0('0x6')};function emitEvent(_0xfcc335){return function(_0x545de6,_0x4e5644,_0x405c60){OpenchannelMessageEvents[_0x2ae0('0x7')](_0xfcc335+':'+_0x545de6['id'],_0x545de6);OpenchannelMessageEvents[_0x2ae0('0x7')](_0xfcc335,_0x545de6);_0x405c60(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x2ae0('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xa5f8=['OpenchannelMessage','setMaxListeners','save','emit','hook','exports','../../mysqldb'];(function(_0x4da6c6,_0x4c8aa5){var _0x2e39ac=function(_0x1845ca){while(--_0x1845ca){_0x4da6c6['push'](_0x4da6c6['shift']());}};_0x2e39ac(++_0x4c8aa5);}(_0xa5f8,0x133));var _0x8a5f=function(_0x3eaefd,_0x1ce0e3){_0x3eaefd=_0x3eaefd-0x0;var _0x168216=_0xa5f8[_0x3eaefd];return _0x168216;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8a5f('0x0'))['db'][_0x8a5f('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8a5f('0x2')](0x0);var events={'afterCreate':_0x8a5f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49d9cb){return function(_0x552fd3,_0x1ef38e,_0x66e4d1){OpenchannelMessageEvents['emit'](_0x49d9cb+':'+_0x552fd3['id'],_0x552fd3);OpenchannelMessageEvents[_0x8a5f('0x4')](_0x49d9cb,_0x552fd3);_0x66e4d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x8a5f('0x5')](e,emitEvent(event));}}module[_0x8a5f('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 0ebfa70..32b7846 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 _0xc92f=['inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Contact','POST','method','GET','Interaction','threadId','update'];(function(_0x4eda24,_0x407afa){var _0x5300cf=function(_0x3b3e6f){while(--_0x3b3e6f){_0x4eda24['push'](_0x4eda24['shift']());}};_0x5300cf(++_0x407afa);}(_0xc92f,0xf3));var _0xfc92=function(_0x147964,_0x1341b2){_0x147964=_0x147964-0x0;var _0x2992f1=_0xc92f[_0x147964];return _0x2992f1;};'use strict';var _=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var logger=require('../../config/logger')(_0xfc92('0x2'));var moment=require(_0xfc92('0x3'));var BPromise=require(_0xfc92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc92('0x5'));var rimraf=require(_0xfc92('0x6'));var config=require(_0xfc92('0x7'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x930bab,_0x47abee){return _0x930bab[_0xfc92('0x8')]('OpenchannelMessage',attributes,{'tableName':_0xfc92('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xfc92('0xa')],'type':_0xfc92('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fbe63,_0x4f37f2,_0x18a53b){var _0x379756=_0x930bab[_0xfc92('0xc')];var _0x552eab=_0x3fbe63[_0xfc92('0xd')]({'plain':!![]});if(_0x552eab[_0xfc92('0xe')][_0xfc92('0xf')]()==='in'||_0x552eab[_0xfc92('0xe')][_0xfc92('0xf')]()===_0xfc92('0x10')&&!_0x552eab[_0xfc92('0x11')]&&!_[_0xfc92('0x12')](_0x552eab[_0xfc92('0x13')])){_0x379756[_0xfc92('0x14')][_0xfc92('0x15')]({'where':{'id':_0x552eab[_0xfc92('0x16')]}})['then'](function(_0x55d532){if(_0x55d532){_0x55d532['update']({'lastMsgAt':_0x552eab[_0xfc92('0x17')],'lastMsgDirection':_0x552eab[_0xfc92('0xe')]['toLowerCase']()});}})[_0xfc92('0x18')](function(_0x15ee68){console[_0xfc92('0x19')](_0x15ee68);});}if(_0x552eab[_0xfc92('0xe')]===_0xfc92('0x10')&&!_0x552eab[_0xfc92('0x11')]){var _0x492d40;_0x379756[_0xfc92('0x1a')][_0xfc92('0x1b')]()[_0xfc92('0x1c')](function(_0xcb8866){return _0x379756['OpenchannelAccount']['find']({'where':{'id':_0x552eab[_0xfc92('0x1d')]},'include':[{'model':_0x379756[_0xfc92('0x14')],'as':'Interactions','where':{'id':_0x552eab[_0xfc92('0x16')]},'limit':0x1,'include':[{'model':_0x379756[_0xfc92('0x1a')],'as':'Contact','attributes':_[_0xfc92('0x1e')](_0xcb8866)}]}]});})['then'](function(_0x376551){_0x492d40=_0x376551[_0xfc92('0xd')]({'plain':!![]});if(_0x492d40&&_0x492d40[_0xfc92('0x1f')]){logger[_0xfc92('0x20')](_0xfc92('0x21'),_0xfc92('0x22'),util['format'](_0xfc92('0x23'),_0x552eab['id'],_0x492d40['replyUri']));if(_0x492d40[_0xfc92('0x24')]&&_0x492d40[_0xfc92('0x24')][_0xfc92('0x25')]){_0x552eab['Interaction']=_['omit'](_0x492d40['Interactions'][0x0],'Contact');_0x552eab[_0xfc92('0x26')]=_0x492d40[_0xfc92('0x24')][0x0][_0xfc92('0x26')];}var _0x4f37f2={'method':_0xfc92('0x27'),'uri':encodeURI(_0x492d40[_0xfc92('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4f37f2[_0xfc92('0x28')]){case _0xfc92('0x29'):_0x4f37f2['qs']=_0x552eab;break;case'POST':_0x4f37f2[_0xfc92('0xa')]=_0x552eab;break;}return rp(_0x4f37f2)[_0xfc92('0x1c')](function(_0x35cea1){logger['info'](_0xfc92('0x21'),_0xfc92('0x22'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x552eab['id'],_0x492d40[_0xfc92('0x1f')]));if(_0x35cea1[_0xfc92('0xa')]['threadId']&&_0x35cea1[_0xfc92('0xa')]['threadId']!=_0x552eab[_0xfc92('0x2a')][_0xfc92('0x2b')]){return _0x379756['OpenchannelInteraction'][_0xfc92('0x2c')]({'threadId':_0x35cea1[_0xfc92('0xa')][_0xfc92('0x2b')]},{'logging':!![],'where':{'id':_0x552eab[_0xfc92('0x2a')]['id']}});}else{return;}})[_0xfc92('0x1c')](function(){return _0x3fbe63[_0xfc92('0x2c')]({'read':!![]});})[_0xfc92('0x18')](function(_0x27c7ed){logger[_0xfc92('0x19')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xfc92('0x2d')](_0x27c7ed,{'showHidden':![],'depth':null}));_0x18a53b();});}else{_0x18a53b();}})['finally'](function(){_0x18a53b();});}else{_0x18a53b();}}},'charset':_0xfc92('0x2e'),'collate':_0xfc92('0x2f')});}; \ No newline at end of file +var _0x8781=['Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','omit','Contact','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','afterCreate','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','update','catch','out','secret','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','format'];(function(_0x2c9905,_0x3c017b){var _0x3ece98=function(_0x3d1424){while(--_0x3d1424){_0x2c9905['push'](_0x2c9905['shift']());}};_0x3ece98(++_0x3c017b);}(_0x8781,0x1c8));var _0x1878=function(_0x2dbf97,_0x1a0ed4){_0x2dbf97=_0x2dbf97-0x0;var _0x3915e4=_0x8781[_0x2dbf97];return _0x3915e4;};'use strict';var _=require(_0x1878('0x0'));var util=require(_0x1878('0x1'));var logger=require(_0x1878('0x2'))(_0x1878('0x3'));var moment=require(_0x1878('0x4'));var BPromise=require(_0x1878('0x5'));var rp=require(_0x1878('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1878('0x7'));var config=require(_0x1878('0x8'));var attributes=require(_0x1878('0x9'));module[_0x1878('0xa')]=function(_0x43d827,_0x1c52e8){return _0x43d827['define'](_0x1878('0xb'),attributes,{'tableName':_0x1878('0xc'),'paranoid':![],'indexes':[{'name':_0x1878('0xd'),'fields':[_0x1878('0xe')],'type':_0x1878('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e6c2f,_0x2756b4,_0x31008c){var _0x3f00a4=_0x43d827[_0x1878('0x10')];var _0x412d55=_0x2e6c2f['get']({'plain':!![]});if(_0x412d55[_0x1878('0x11')][_0x1878('0x12')]()==='in'||_0x412d55[_0x1878('0x11')][_0x1878('0x12')]()==='out'&&!_0x412d55['secret']&&!_[_0x1878('0x13')](_0x412d55[_0x1878('0x14')])){_0x3f00a4[_0x1878('0x15')][_0x1878('0x16')]({'where':{'id':_0x412d55['OpenchannelInteractionId']}})['then'](function(_0x19ffaa){if(_0x19ffaa){_0x19ffaa[_0x1878('0x17')]({'lastMsgAt':_0x412d55['createdAt'],'lastMsgDirection':_0x412d55[_0x1878('0x11')][_0x1878('0x12')]()});}})[_0x1878('0x18')](function(_0x4a5ba9){console['error'](_0x4a5ba9);});}if(_0x412d55[_0x1878('0x11')]===_0x1878('0x19')&&!_0x412d55[_0x1878('0x1a')]){var _0x43b85e;_0x3f00a4[_0x1878('0x1b')][_0x1878('0x1c')]()[_0x1878('0x1d')](function(_0x1642b3){return _0x3f00a4[_0x1878('0x1e')][_0x1878('0x1f')]({'where':{'id':_0x412d55[_0x1878('0x20')]},'include':[{'model':_0x3f00a4['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x412d55[_0x1878('0x21')]},'limit':0x1,'include':[{'model':_0x3f00a4[_0x1878('0x1b')],'as':'Contact','attributes':_[_0x1878('0x22')](_0x1642b3)}]}]});})[_0x1878('0x1d')](function(_0x1fae20){_0x43b85e=_0x1fae20[_0x1878('0x23')]({'plain':!![]});if(_0x43b85e&&_0x43b85e[_0x1878('0x24')]){logger['info'](_0x1878('0x25'),'afterCreate',util[_0x1878('0x26')](_0x1878('0x27'),_0x412d55['id'],_0x43b85e[_0x1878('0x24')]));if(_0x43b85e[_0x1878('0x28')]&&_0x43b85e[_0x1878('0x28')]['length']){_0x412d55[_0x1878('0x29')]=_[_0x1878('0x2a')](_0x43b85e[_0x1878('0x28')][0x0],_0x1878('0x2b'));_0x412d55[_0x1878('0x2b')]=_0x43b85e[_0x1878('0x28')][0x0][_0x1878('0x2b')];}var _0x2756b4={'method':_0x1878('0x2c'),'uri':encodeURI(_0x43b85e[_0x1878('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2756b4[_0x1878('0x2d')]){case _0x1878('0x2e'):_0x2756b4['qs']=_0x412d55;break;case _0x1878('0x2c'):_0x2756b4['body']=_0x412d55;break;}return rp(_0x2756b4)[_0x1878('0x1d')](function(_0x16410e){logger[_0x1878('0x2f')](_0x1878('0x25'),'afterCreate',util[_0x1878('0x26')](_0x1878('0x30'),_0x412d55['id'],_0x43b85e[_0x1878('0x24')]));if(_0x16410e[_0x1878('0xe')][_0x1878('0x31')]&&_0x16410e[_0x1878('0xe')]['threadId']!=_0x412d55[_0x1878('0x29')][_0x1878('0x31')]){return _0x3f00a4['OpenchannelInteraction']['update']({'threadId':_0x16410e[_0x1878('0xe')]['threadId']},{'logging':!![],'where':{'id':_0x412d55['Interaction']['id']}});}else{return;}})[_0x1878('0x1d')](function(){return _0x2e6c2f[_0x1878('0x17')]({'read':!![]});})[_0x1878('0x18')](function(_0x509fde){logger[_0x1878('0x32')](_0x1878('0x25'),_0x1878('0x33'),util[_0x1878('0x34')](_0x509fde,{'showHidden':![],'depth':null}));_0x31008c();});}else{_0x31008c();}})['finally'](function(){_0x31008c();});}else{_0x31008c();}}},'charset':_0x1878('0x35'),'collate':_0x1878('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f97680d..2cce68d 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 _0xee9c=['code','message','info','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','raw','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xee9c,0x1e6));var _0xcee9=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0xee9c[_0x217c2e];return _0x22b7d8;};'use strict';var _=require('lodash');var util=require(_0xcee9('0x0'));var moment=require(_0xcee9('0x1'));var BPromise=require(_0xcee9('0x2'));var rs=require(_0xcee9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcee9('0x4'));var logger=require(_0xcee9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcee9('0x6'));var client=jayson['client'][_0xcee9('0x7')]({'port':0x232a});config[_0xcee9('0x8')]=_[_0xcee9('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcee9('0xa'))(new Redis(config[_0xcee9('0x8')]));require('./openchannelMessage.socket')[_0xcee9('0xb')](socket);function respondWithRpcPromise(_0x3002cf,_0x3e08b2,_0x13d681){return new BPromise(function(_0x10f960,_0x430fbd){return client['request'](_0x3002cf,_0x13d681)[_0xcee9('0xc')](function(_0x3c28b6){logger['info'](_0xcee9('0xd'),_0x3e08b2,_0xcee9('0xe'));logger[_0xcee9('0xf')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3e08b2,_0xcee9('0xe'),JSON[_0xcee9('0x10')](_0x3c28b6));if(_0x3c28b6[_0xcee9('0x11')]){if(_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x12')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3e08b2,_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x13')]);return _0x430fbd(_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x13')]);}logger[_0xcee9('0x11')](_0xcee9('0xd'),_0x3e08b2,_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x13')]);return _0x10f960(_0x3c28b6[_0xcee9('0x11')][_0xcee9('0x13')]);}else{logger[_0xcee9('0x14')](_0xcee9('0xd'),_0x3e08b2,'request\x20sent');_0x10f960(_0x3c28b6[_0xcee9('0x15')][_0xcee9('0x13')]);}})[_0xcee9('0x16')](function(_0xb84710){logger[_0xcee9('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e08b2,_0xb84710);_0x430fbd(_0xb84710);});});}exports[_0xcee9('0x17')]=function(_0x16dfd1){var _0x3ff421=this;return new Promise(function(_0x961900,_0x580b06){return db[_0xcee9('0x18')][_0xcee9('0x19')](_0x16dfd1['body'],{'raw':_0x16dfd1['options']?_0x16dfd1[_0xcee9('0x1a')][_0xcee9('0x1b')]===undefined?!![]:![]:!![]})[_0xcee9('0xc')](function(_0x49afe8){logger[_0xcee9('0x14')](_0xcee9('0x17'),_0x16dfd1);logger[_0xcee9('0xf')]('CreateOpenchannelMessage',_0x16dfd1,JSON[_0xcee9('0x10')](_0x49afe8));_0x961900(_0x49afe8);})['catch'](function(_0x26c694){logger[_0xcee9('0x11')](_0xcee9('0x17'),_0x26c694[_0xcee9('0x13')],_0x16dfd1);_0x580b06(_0x3ff421[_0xcee9('0x11')](0x1f4,_0x26c694[_0xcee9('0x13')]));});});}; \ No newline at end of file +var _0x06ae=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug'];(function(_0x2da9e1,_0x100a48){var _0x5a479e=function(_0x51ad9c){while(--_0x51ad9c){_0x2da9e1['push'](_0x2da9e1['shift']());}};_0x5a479e(++_0x100a48);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var BPromise=require(_0xe06a('0x2'));var rs=require(_0xe06a('0x3'));var fs=require('fs');var Redis=require(_0xe06a('0x4'));var db=require(_0xe06a('0x5'))['db'];var utils=require(_0xe06a('0x6'));var logger=require(_0xe06a('0x7'))(_0xe06a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe06a('0x9')]({'port':0x232a});config[_0xe06a('0xa')]=_[_0xe06a('0xb')](config[_0xe06a('0xa')],{'host':_0xe06a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe06a('0xa')]));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1a9f4e,_0x4eedc5,_0x2212e2){return new BPromise(function(_0x48e52a,_0x521741){return client[_0xe06a('0xd')](_0x1a9f4e,_0x2212e2)[_0xe06a('0xe')](function(_0x574fd0){logger[_0xe06a('0xf')](_0xe06a('0x10'),_0x4eedc5,'request\x20sent');logger[_0xe06a('0x11')](_0xe06a('0x12'),_0x4eedc5,_0xe06a('0x13'),JSON['stringify'](_0x574fd0));if(_0x574fd0[_0xe06a('0x14')]){if(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x15')]===0x1f4){logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0['error'][_0xe06a('0x16')]);return _0x521741(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x16')]);}logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0[_0xe06a('0x14')]['message']);return _0x48e52a(_0x574fd0[_0xe06a('0x14')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4eedc5,_0xe06a('0x13'));_0x48e52a(_0x574fd0[_0xe06a('0x17')][_0xe06a('0x16')]);}})['catch'](function(_0x614743){logger[_0xe06a('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x4eedc5,_0x614743);_0x521741(_0x614743);});});}exports[_0xe06a('0x18')]=function(_0x5382a6){var _0x3003f8=this;return new Promise(function(_0x4a2681,_0x550ff8){return db[_0xe06a('0x19')][_0xe06a('0x1a')](_0x5382a6[_0xe06a('0x1b')],{'raw':_0x5382a6[_0xe06a('0x1c')]?_0x5382a6[_0xe06a('0x1c')][_0xe06a('0x1d')]===undefined?!![]:![]:!![]})[_0xe06a('0xe')](function(_0x2c30c7){logger[_0xe06a('0xf')](_0xe06a('0x18'),_0x5382a6);logger['debug'](_0xe06a('0x18'),_0x5382a6,JSON[_0xe06a('0x1e')](_0x2c30c7));_0x4a2681(_0x2c30c7);})[_0xe06a('0x1f')](function(_0x82ba72){logger[_0xe06a('0x14')](_0xe06a('0x18'),_0x82ba72[_0xe06a('0x16')],_0x5382a6);_0x550ff8(_0x3003f8[_0xe06a('0x14')](0x1f4,_0x82ba72[_0xe06a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 57e78ca..fb1b2c7 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 _0x54ef=['remove','emit','removeListener','length','./openchannelMessage.events','save'];(function(_0x5ed8ee,_0x21376e){var _0x3ed347=function(_0x4b5abe){while(--_0x4b5abe){_0x5ed8ee['push'](_0x5ed8ee['shift']());}};_0x3ed347(++_0x21376e);}(_0x54ef,0x112));var _0xf54e=function(_0x23afc9,_0x46df37){_0x23afc9=_0x23afc9-0x0;var _0x1b3eda=_0x54ef[_0x23afc9];return _0x1b3eda;};'use strict';var OpenchannelMessageEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){OpenchannelMessageEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('openchannelMessage:'+_0x561870,_0x55e611);OpenchannelMessageEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file +var _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index b0c620b..f080b1c 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 _0xbd10=['getAgents','post','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x1ce210,_0x43adb3){var _0x22fccf=function(_0x538f4f){while(--_0x538f4f){_0x1ce210['push'](_0x1ce210['shift']());}};_0x22fccf(++_0x43adb3);}(_0xbd10,0x85));var _0x0bd1=function(_0x358eff,_0x4ebd94){_0x358eff=_0x358eff-0x0;var _0x6901b6=_0xbd10[_0x358eff];return _0x6901b6;};'use strict';var multer=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var path=require(_0x0bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd1('0x3'));var router=express[_0x0bd1('0x4')]();var auth=require(_0x0bd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0bd1('0x6'));var controller=require(_0x0bd1('0x7'));router[_0x0bd1('0x8')]('/',auth[_0x0bd1('0x9')](),controller[_0x0bd1('0xa')]);router[_0x0bd1('0x8')]('/describe',auth[_0x0bd1('0x9')](),controller['describe']);router[_0x0bd1('0x8')](_0x0bd1('0xb'),auth[_0x0bd1('0x9')](),controller[_0x0bd1('0xc')]);router['get'](_0x0bd1('0xd'),auth[_0x0bd1('0x9')](),controller[_0x0bd1('0xe')]);router[_0x0bd1('0x8')](_0x0bd1('0xf'),auth[_0x0bd1('0x9')](),controller['getTeams']);router[_0x0bd1('0x8')](_0x0bd1('0x10'),auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x11')]);router[_0x0bd1('0x12')]('/',auth[_0x0bd1('0x9')](),controller['create']);router[_0x0bd1('0x12')](_0x0bd1('0xf'),auth[_0x0bd1('0x9')](),controller['addTeams']);router['post'](_0x0bd1('0x10'),auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x13')]);router['put']('/:id',auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x14')]);router[_0x0bd1('0x15')]('/:id',auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x16')]);router[_0x0bd1('0x15')](_0x0bd1('0xf'),auth['isAuthenticated'](),controller[_0x0bd1('0x17')]);router[_0x0bd1('0x15')]('/:id/users',auth[_0x0bd1('0x9')](),controller[_0x0bd1('0x18')]);module['exports']=router; \ No newline at end of file +var _0x5e0e=['isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller'];(function(_0x506db2,_0x1ab1f3){var _0x2a2ad3=function(_0x3d1b79){while(--_0x3d1b79){_0x506db2['push'](_0x506db2['shift']());}};_0x2a2ad3(++_0x1ab1f3);}(_0x5e0e,0x89));var _0xe5e0=function(_0x3025e0,_0xf2c52d){_0x3025e0=_0x3025e0-0x0;var _0x4ee7c5=_0x5e0e[_0x3025e0];return _0x4ee7c5;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require('path');var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var auth=require(_0xe5e0('0x5'));var interaction=require(_0xe5e0('0x6'));var config=require('../../config/environment');var controller=require(_0xe5e0('0x7'));router['get']('/',auth[_0xe5e0('0x8')](),controller[_0xe5e0('0x9')]);router[_0xe5e0('0xa')](_0xe5e0('0xb'),auth[_0xe5e0('0x8')](),controller[_0xe5e0('0xc')]);router['get'](_0xe5e0('0xd'),auth[_0xe5e0('0x8')](),controller['show']);router[_0xe5e0('0xa')](_0xe5e0('0xe'),auth[_0xe5e0('0x8')](),controller[_0xe5e0('0xf')]);router[_0xe5e0('0xa')](_0xe5e0('0x10'),auth[_0xe5e0('0x8')](),controller[_0xe5e0('0x11')]);router[_0xe5e0('0xa')](_0xe5e0('0x12'),auth[_0xe5e0('0x8')](),controller[_0xe5e0('0x13')]);router[_0xe5e0('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe5e0('0x14')](_0xe5e0('0x10'),auth[_0xe5e0('0x8')](),controller[_0xe5e0('0x15')]);router['post'](_0xe5e0('0x12'),auth[_0xe5e0('0x8')](),controller[_0xe5e0('0x16')]);router[_0xe5e0('0x17')](_0xe5e0('0xd'),auth[_0xe5e0('0x8')](),controller[_0xe5e0('0x18')]);router[_0xe5e0('0x19')](_0xe5e0('0xd'),auth['isAuthenticated'](),controller[_0xe5e0('0x1a')]);router['delete'](_0xe5e0('0x10'),auth['isAuthenticated'](),controller[_0xe5e0('0x1b')]);router[_0xe5e0('0x19')]('/:id/users',auth[_0xe5e0('0x8')](),controller['removeAgents']);module[_0xe5e0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9578a01..92b0012 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 _0xa6c7=['name','STRING','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa6c7,0x133));var _0x7a6c=function(_0x1f37d5,_0x102bb8){_0x1f37d5=_0x1f37d5-0x0;var _0x3bbd99=_0xa6c7[_0x1f37d5];return _0x3bbd99;};'use strict';var Sequelize=require('sequelize');module[_0x7a6c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7a6c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7a6c('0x2')]},'timeout':{'type':Sequelize[_0x7a6c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7a6c('0x4'),_0x7a6c('0x5'),_0x7a6c('0x6'))}}; \ No newline at end of file +var _0x4012=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x217372,_0x1822ce){var _0x2715a1=function(_0x5712db){while(--_0x5712db){_0x217372['push'](_0x217372['shift']());}};_0x2715a1(++_0x1822ce);}(_0x4012,0x1bf));var _0x2401=function(_0x8b97b4,_0x382038){_0x8b97b4=_0x8b97b4-0x0;var _0x2ed10e=_0x4012[_0x8b97b4];return _0x2ed10e;};'use strict';var Sequelize=require(_0x2401('0x0'));module[_0x2401('0x1')]={'name':{'type':Sequelize[_0x2401('0x2')],'unique':_0x2401('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2401('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2401('0x4')](_0x2401('0x5'),_0x2401('0x6'),_0x2401('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 503b76e..318952f 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 _0xf555=['userOpenchannelQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','error','describe','getMembers','findOne','length','sort','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','%s/%s','createdAt','getTeams','Team','addTeams','ids','online','interface','flatMap','sequelize','each','UserOpenchannelQueue','findOrCreate','forEach','emit','User','Agents','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','transaction','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit'];(function(_0x4de563,_0xf0e7e6){var _0x2034dc=function(_0x282d05){while(--_0x282d05){_0x4de563['push'](_0x4de563['shift']());}};_0x2034dc(++_0xf0e7e6);}(_0xf555,0x8f));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5f55('0x0'));var emlformat=require(_0x5f55('0x1'));var rimraf=require(_0x5f55('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5f55('0x3'));var moment=require(_0x5f55('0x4'));var BPromise=require(_0x5f55('0x5'));var Mustache=require(_0x5f55('0x6'));var util=require('util');var path=require(_0x5f55('0x7'));var sox=require('sox');var csv=require(_0x5f55('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5f55('0x9'));var squel=require(_0x5f55('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5f55('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5f55('0xc'));var Papa=require('papaparse');var Redis=require(_0x5f55('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5f55('0xe'));var as=require(_0x5f55('0xf'));var hardwareService=require(_0x5f55('0x10'));var logger=require(_0x5f55('0x11'))(_0x5f55('0x12'));var utils=require(_0x5f55('0x13'));var config=require(_0x5f55('0x14'));var db=require(_0x5f55('0x15'))['db'];config[_0x5f55('0x16')]=_['defaults'](config[_0x5f55('0x16')],{'host':_0x5f55('0x17'),'port':0x18eb});var socket=require(_0x5f55('0x18'))(new Redis(config['redis']));require(_0x5f55('0x19'))[_0x5f55('0x1a')](socket);function respondWithStatusCode(_0x22ddc2,_0x1b23bb){_0x1b23bb=_0x1b23bb||0xcc;return function(_0x5558f4){if(_0x5558f4){return _0x22ddc2['sendStatus'](_0x1b23bb);}return _0x22ddc2[_0x5f55('0x1b')](_0x1b23bb)[_0x5f55('0x1c')]();};}function respondWithResult(_0x4c0b03,_0x2e198c){_0x2e198c=_0x2e198c||0xc8;return function(_0x42ef66){if(_0x42ef66){return _0x4c0b03[_0x5f55('0x1b')](_0x2e198c)[_0x5f55('0x1d')](_0x42ef66);}};}function respondWithFilteredResult(_0x2e864a,_0x349d2e){return function(_0x3f2888){if(_0x3f2888){var _0xf60db9=_0x3f2888[_0x5f55('0x1e')],_0x16e001=_0x349d2e[_0x5f55('0x1f')],_0x5c4472=_0x349d2e[_0x5f55('0x1f')]+_0x349d2e[_0x5f55('0x20')],_0x3f4fa2;if(_0x5c4472>=_0xf60db9){_0x5c4472=_0xf60db9;_0x3f4fa2=0xc8;}else{_0x3f4fa2=0xce;}_0x2e864a[_0x5f55('0x1b')](_0x3f4fa2);return _0x2e864a[_0x5f55('0x21')](_0x5f55('0x22'),_0x16e001+'-'+_0x5c4472+'/'+_0xf60db9)[_0x5f55('0x1d')](_0x3f2888);}return null;};}function patchUpdates(_0x5c55df){return function(_0x5b1ffa){try{jsonpatch[_0x5f55('0x23')](_0x5b1ffa,_0x5c55df,!![]);}catch(_0x17c5ad){return BPromise['reject'](_0x17c5ad);}return _0x5b1ffa[_0x5f55('0x24')]();};}function saveUpdates(_0x4754d5,_0x3f8e94){return function(_0x12b128){if(_0x12b128){return _0x12b128[_0x5f55('0x25')](_0x4754d5)[_0x5f55('0x26')](function(_0x10039c){return _0x10039c;});}return null;};}function removeEntity(_0x18ef8a,_0x13c6c6){return function(_0x31ff5c){if(_0x31ff5c){return _0x31ff5c[_0x5f55('0x27')]()['then'](function(){var _0x4d4261=_0x31ff5c[_0x5f55('0x28')]({'plain':!![]});var _0x38d207='OpenchannelQueues';return db[_0x5f55('0x29')][_0x5f55('0x27')]({'where':{'type':_0x38d207,'resourceId':_0x4d4261['id']}})[_0x5f55('0x26')](function(){return _0x31ff5c;});})['then'](function(){_0x18ef8a[_0x5f55('0x1b')](0xcc)[_0x5f55('0x1c')]();});}};}function handleEntityNotFound(_0x46d334,_0x27f330){return function(_0x14d2b4){if(!_0x14d2b4){_0x46d334[_0x5f55('0x2a')](0x194);}return _0x14d2b4;};}function handleError(_0x5a52e8,_0x22f81d){_0x22f81d=_0x22f81d||0x1f4;return function(_0x335a5d){logger['error'](_0x335a5d['stack']);if(_0x335a5d['name']){delete _0x335a5d[_0x5f55('0x2b')];}_0x5a52e8[_0x5f55('0x1b')](_0x22f81d)['send'](_0x335a5d);};}exports[_0x5f55('0x2c')]=function(_0x5bb4c0,_0x2e2535){var _0x27f0f5={},_0x4f9599={},_0x6af5f1={'count':0x0,'rows':[]};var _0x3c2aa5=_[_0x5f55('0x2d')](db[_0x5f55('0x2e')][_0x5f55('0x2f')],function(_0x394829){return{'name':_0x394829[_0x5f55('0x30')],'type':_0x394829[_0x5f55('0x31')][_0x5f55('0x32')]};});_0x4f9599[_0x5f55('0x33')]=_[_0x5f55('0x2d')](_0x3c2aa5,_0x5f55('0x2b'));_0x4f9599['query']=_[_0x5f55('0x34')](_0x5bb4c0[_0x5f55('0x35')]);_0x4f9599[_0x5f55('0x36')]=_[_0x5f55('0x37')](_0x4f9599[_0x5f55('0x33')],_0x4f9599['query']);_0x27f0f5[_0x5f55('0x38')]=_[_0x5f55('0x37')](_0x4f9599[_0x5f55('0x33')],qs[_0x5f55('0x39')](_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x39')]));_0x27f0f5['attributes']=_0x27f0f5[_0x5f55('0x38')]['length']?_0x27f0f5[_0x5f55('0x38')]:_0x4f9599[_0x5f55('0x33')];if(!_0x5bb4c0['query'][_0x5f55('0x3a')](_0x5f55('0x3b'))){_0x27f0f5[_0x5f55('0x20')]=qs[_0x5f55('0x20')](_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x20')]);_0x27f0f5[_0x5f55('0x1f')]=qs['offset'](_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x1f')]);}_0x27f0f5[_0x5f55('0x3c')]=qs['sort'](_0x5bb4c0[_0x5f55('0x35')]['sort']);_0x27f0f5[_0x5f55('0x3d')]=qs[_0x5f55('0x36')](_[_0x5f55('0x3e')](_0x5bb4c0[_0x5f55('0x35')],_0x4f9599[_0x5f55('0x36')]),_0x3c2aa5);if(_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x3f')]){_0x27f0f5[_0x5f55('0x3d')]=_[_0x5f55('0x40')](_0x27f0f5['where'],{'$or':_[_0x5f55('0x2d')](_0x3c2aa5,function(_0xeb7cba){if(_0xeb7cba['type']!==_0x5f55('0x41')){var _0x553702={};_0x553702[_0xeb7cba[_0x5f55('0x2b')]]={'$like':'%'+_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x3f')]+'%'};return _0x553702;}})});}_0x27f0f5=_['merge']({},_0x27f0f5,_0x5bb4c0[_0x5f55('0x42')]);var _0x4bafa2={'where':_0x27f0f5[_0x5f55('0x3d')]};return db[_0x5f55('0x2e')][_0x5f55('0x1e')](_0x4bafa2)[_0x5f55('0x26')](function(_0x5b26ec){_0x6af5f1[_0x5f55('0x1e')]=_0x5b26ec;if(_0x5bb4c0[_0x5f55('0x35')][_0x5f55('0x43')]){_0x27f0f5['include']=[{'all':!![]}];}return db[_0x5f55('0x2e')][_0x5f55('0x44')](_0x27f0f5);})[_0x5f55('0x26')](function(_0x8f45b1){_0x6af5f1[_0x5f55('0x45')]=_0x8f45b1;return _0x6af5f1;})[_0x5f55('0x26')](respondWithFilteredResult(_0x2e2535,_0x27f0f5))[_0x5f55('0x46')](handleError(_0x2e2535,null));};exports[_0x5f55('0x47')]=function(_0x4907f0,_0x531b4f){var _0x5e8eb0={'raw':!![],'where':{'id':_0x4907f0[_0x5f55('0x48')]['id']}},_0x10c9ba={};_0x10c9ba[_0x5f55('0x33')]=_['keys'](db[_0x5f55('0x2e')][_0x5f55('0x2f')]);_0x10c9ba[_0x5f55('0x35')]=_['keys'](_0x4907f0[_0x5f55('0x35')]);_0x10c9ba[_0x5f55('0x36')]=_[_0x5f55('0x37')](_0x10c9ba[_0x5f55('0x33')],_0x10c9ba[_0x5f55('0x35')]);_0x5e8eb0['attributes']=_[_0x5f55('0x37')](_0x10c9ba[_0x5f55('0x33')],qs[_0x5f55('0x39')](_0x4907f0['query'][_0x5f55('0x39')]));_0x5e8eb0[_0x5f55('0x38')]=_0x5e8eb0['attributes']['length']?_0x5e8eb0['attributes']:_0x10c9ba['model'];if(_0x4907f0[_0x5f55('0x35')][_0x5f55('0x43')]){_0x5e8eb0[_0x5f55('0x49')]=[{'all':!![]}];}_0x5e8eb0=_['merge']({},_0x5e8eb0,_0x4907f0['options']);return db[_0x5f55('0x2e')]['find'](_0x5e8eb0)[_0x5f55('0x26')](handleEntityNotFound(_0x531b4f,null))['then'](respondWithResult(_0x531b4f,null))[_0x5f55('0x46')](handleError(_0x531b4f,null));};exports['create']=function(_0x2e0dcd,_0x4d8081){return db[_0x5f55('0x2e')][_0x5f55('0x4a')](_0x2e0dcd[_0x5f55('0x4b')],{})[_0x5f55('0x26')](function(_0x4d1d95){var _0x563a5e=_0x2e0dcd[_0x5f55('0x4c')][_0x5f55('0x28')]({'plain':!![]});if(!_0x563a5e)throw new Error(_0x5f55('0x4d'));if(_0x563a5e[_0x5f55('0x4e')]===_0x5f55('0x4c')){var _0x27429e=_0x4d1d95[_0x5f55('0x28')]({'plain':!![]});var _0x1ae994=_0x5f55('0x4f');return db[_0x5f55('0x50')][_0x5f55('0x51')]({'where':{'name':_0x1ae994,'userProfileId':_0x563a5e[_0x5f55('0x52')]},'raw':!![]})[_0x5f55('0x26')](function(_0x5eb3bf){if(_0x5eb3bf&&_0x5eb3bf[_0x5f55('0x53')]===0x0){return db[_0x5f55('0x29')][_0x5f55('0x4a')]({'name':_0x27429e[_0x5f55('0x2b')],'resourceId':_0x27429e['id'],'type':_0x5eb3bf[_0x5f55('0x2b')],'sectionId':_0x5eb3bf['id']},{})[_0x5f55('0x26')](function(){return _0x4d1d95;});}else{return _0x4d1d95;}})['catch'](function(_0x45a6b3){logger[_0x5f55('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45a6b3);throw _0x45a6b3;});}return _0x4d1d95;})[_0x5f55('0x26')](respondWithResult(_0x4d8081,0xc9))[_0x5f55('0x46')](handleError(_0x4d8081,null));};exports[_0x5f55('0x25')]=function(_0x1a4a44,_0x4d5feb){if(_0x1a4a44[_0x5f55('0x4b')]['id']){delete _0x1a4a44[_0x5f55('0x4b')]['id'];}return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x1a4a44[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x4d5feb,null))[_0x5f55('0x26')](saveUpdates(_0x1a4a44[_0x5f55('0x4b')],null))['then'](respondWithResult(_0x4d5feb,null))['catch'](handleError(_0x4d5feb,null));};exports[_0x5f55('0x27')]=function(_0x40da43,_0x528ecd){return db['OpenchannelQueue']['find']({'where':{'id':_0x40da43[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x528ecd,null))[_0x5f55('0x26')](removeEntity(_0x528ecd,null))[_0x5f55('0x46')](handleError(_0x528ecd,null));};exports['describe']=function(_0x2bcf3f,_0x2d602e){return db[_0x5f55('0x2e')][_0x5f55('0x55')]()[_0x5f55('0x26')](respondWithResult(_0x2d602e,null))[_0x5f55('0x46')](handleError(_0x2d602e,null));};exports[_0x5f55('0x56')]=function(_0x430bef,_0x314c64,_0x58f285){var _0x4e893b={'raw':!![],'where':{}},_0x8d833e={},_0x1ee164;return db[_0x5f55('0x2e')][_0x5f55('0x57')]({'where':{'id':_0x430bef[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x314c64,null))['then'](function(_0x54080a){if(_0x54080a){_0x1ee164=_0x54080a[_0x5f55('0x28')]({'plain':!![]});_0x8d833e['model']=_[_0x5f55('0x34')](db['UserOpenchannelQueue'][_0x5f55('0x2f')]);_0x8d833e[_0x5f55('0x35')]=_[_0x5f55('0x34')](_0x430bef['query']);_0x8d833e[_0x5f55('0x36')]=_['intersection'](_0x8d833e[_0x5f55('0x33')],_0x8d833e['query']);_0x4e893b[_0x5f55('0x38')]=_[_0x5f55('0x37')](_0x8d833e[_0x5f55('0x33')],qs[_0x5f55('0x39')](_0x430bef[_0x5f55('0x35')]['fields']));_0x4e893b[_0x5f55('0x38')]=_0x4e893b[_0x5f55('0x38')][_0x5f55('0x58')]?_0x4e893b[_0x5f55('0x38')]:_0x8d833e[_0x5f55('0x33')];if(!_0x430bef[_0x5f55('0x35')][_0x5f55('0x3a')](_0x5f55('0x3b'))){_0x4e893b[_0x5f55('0x20')]=qs['limit'](_0x430bef[_0x5f55('0x35')][_0x5f55('0x20')]);_0x4e893b[_0x5f55('0x1f')]=qs[_0x5f55('0x1f')](_0x430bef[_0x5f55('0x35')][_0x5f55('0x1f')]);}_0x4e893b[_0x5f55('0x3c')]=qs[_0x5f55('0x59')](_0x430bef['query'][_0x5f55('0x59')]);_0x4e893b[_0x5f55('0x3d')]=qs[_0x5f55('0x36')](_[_0x5f55('0x3e')](_0x430bef[_0x5f55('0x35')],_0x8d833e['filters']));_0x4e893b[_0x5f55('0x3d')][_0x5f55('0x5a')]=_0x54080a['id'];if(_0x430bef[_0x5f55('0x35')][_0x5f55('0x3f')]){_0x4e893b['where']=_[_0x5f55('0x40')](_0x4e893b[_0x5f55('0x3d')],{'$or':_[_0x5f55('0x2d')](_0x4e893b[_0x5f55('0x38')],function(_0x4c27df){var _0x1e4689={};_0x1e4689[_0x4c27df]={'$like':'%'+_0x430bef[_0x5f55('0x35')][_0x5f55('0x3f')]+'%'};return _0x1e4689;})});}_0x4e893b=_[_0x5f55('0x40')]({},_0x4e893b,_0x430bef[_0x5f55('0x42')]);return db['UserOpenchannelQueue']['findAll'](_0x4e893b);}})[_0x5f55('0x26')](function(_0x538b48){if(_0x538b48){return db['User'][_0x5f55('0x5b')]({'where':{'id':_['map'](_0x538b48,_0x5f55('0x5c')),'role':_0x5f55('0x5d')},'attributes':['id',_0x5f55('0x2b'),_0x5f55('0x5e'),_0x5f55('0x5f'),'createdAt']});}})[_0x5f55('0x26')](function(_0x255b0a){if(_0x255b0a){return{'count':_0x255b0a[_0x5f55('0x1e')],'rows':_[_0x5f55('0x2d')](_0x255b0a[_0x5f55('0x45')],function(_0x466ca8){return{'membername':_0x466ca8[_0x5f55('0x2b')],'UserId':_0x466ca8['id'],'queue_name':_0x1ee164[_0x5f55('0x2b')],'OpenchannelQueueId':_0x1ee164['id'],'interface':util['format'](_0x5f55('0x60'),'SIP',_0x466ca8['name']),'penalty':0x0,'paused':_0x466ca8[_0x5f55('0x5e')],'createdAt':_0x466ca8[_0x5f55('0x61')],'updatedAt':_0x466ca8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5f55('0x26')](respondWithFilteredResult(_0x314c64,_0x4e893b))[_0x5f55('0x46')](handleError(_0x314c64,null));};exports[_0x5f55('0x62')]=function(_0x55f306,_0x186247,_0x117e03){var _0x2d6496={};var _0x2f610c={};var _0x40f5da;var _0x2cce9a;return db['OpenchannelQueue'][_0x5f55('0x57')]({'where':{'id':_0x55f306[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x186247,null))['then'](function(_0x264082){if(_0x264082){_0x40f5da=_0x264082;_0x2f610c[_0x5f55('0x33')]=_[_0x5f55('0x34')](db[_0x5f55('0x63')]['rawAttributes']);_0x2f610c[_0x5f55('0x35')]=_[_0x5f55('0x34')](_0x55f306[_0x5f55('0x35')]);_0x2f610c[_0x5f55('0x36')]=_['intersection'](_0x2f610c[_0x5f55('0x33')],_0x2f610c[_0x5f55('0x35')]);_0x2d6496[_0x5f55('0x38')]=_[_0x5f55('0x37')](_0x2f610c[_0x5f55('0x33')],qs[_0x5f55('0x39')](_0x55f306[_0x5f55('0x35')][_0x5f55('0x39')]));_0x2d6496[_0x5f55('0x38')]=_0x2d6496[_0x5f55('0x38')][_0x5f55('0x58')]?_0x2d6496[_0x5f55('0x38')]:_0x2f610c[_0x5f55('0x33')];_0x2d6496[_0x5f55('0x3c')]=qs[_0x5f55('0x59')](_0x55f306[_0x5f55('0x35')]['sort']);_0x2d6496[_0x5f55('0x3d')]=qs[_0x5f55('0x36')](_[_0x5f55('0x3e')](_0x55f306['query'],_0x2f610c[_0x5f55('0x36')]));if(_0x55f306[_0x5f55('0x35')][_0x5f55('0x3f')]){_0x2d6496[_0x5f55('0x3d')]=_[_0x5f55('0x40')](_0x2d6496[_0x5f55('0x3d')],{'$or':_['map'](_0x2d6496['attributes'],function(_0x20ddcc){var _0x2896b6={};_0x2896b6[_0x20ddcc]={'$like':'%'+_0x55f306[_0x5f55('0x35')][_0x5f55('0x3f')]+'%'};return _0x2896b6;})});}_0x2d6496=_[_0x5f55('0x40')]({},_0x2d6496,_0x55f306[_0x5f55('0x42')]);return _0x40f5da[_0x5f55('0x62')](_0x2d6496);}})[_0x5f55('0x26')](function(_0x577c9b){if(_0x577c9b){_0x2cce9a=_0x577c9b[_0x5f55('0x58')];if(!_0x55f306[_0x5f55('0x35')]['hasOwnProperty']('nolimit')){_0x2d6496['limit']=qs['limit'](_0x55f306['query'][_0x5f55('0x20')]);_0x2d6496[_0x5f55('0x1f')]=qs[_0x5f55('0x1f')](_0x55f306['query']['offset']);}return _0x40f5da[_0x5f55('0x62')](_0x2d6496);}})[_0x5f55('0x26')](function(_0x4f0db8){if(_0x4f0db8){return _0x4f0db8?{'count':_0x2cce9a,'rows':_0x4f0db8}:null;}})['then'](respondWithResult(_0x186247,null))[_0x5f55('0x46')](handleError(_0x186247,null));};exports[_0x5f55('0x64')]=function(_0x24c3de,_0xd5d919,_0x548431){var _0x3c2c53=_0x24c3de['body'][_0x5f55('0x65')];return db[_0x5f55('0x63')]['findAll']({'where':{'id':_0x3c2c53},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5f55('0x2b'),_0x5f55('0x66'),'voicePause',_0x5f55('0x67')],'raw':!![]}]})[_0x5f55('0x26')](function(_0x48cd7c){if(_0x48cd7c){var _0x514551=_[_0x5f55('0x68')](_0x48cd7c,function(_0x298a98){var _0x25eea2=_0x298a98[_0x5f55('0x28')]({'plain':!![]});return _0x25eea2['Agents'];});return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x24c3de[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](function(_0x2cab18){return db[_0x5f55('0x69')]['transaction'](function(_0x432ac9){return _0x2cab18[_0x5f55('0x64')](_0x3c2c53,{'transaction':_0x432ac9})['then'](function(){return BPromise[_0x5f55('0x6a')](_0x514551,function(_0x23e221){return db[_0x5f55('0x6b')][_0x5f55('0x6c')]({'where':{'UserId':_0x23e221['id'],'OpenchannelQueueId':_0x24c3de[_0x5f55('0x48')]['id']},'transaction':_0x432ac9});});})[_0x5f55('0x26')](function(){_0x514551[_0x5f55('0x6d')](function(_0x477376){socket[_0x5f55('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x477376['id'],'OpenchannelQueueId':_0x2cab18['id']});});});});});}})[_0x5f55('0x26')](respondWithStatusCode(_0xd5d919,null))['catch'](handleError(_0xd5d919,null));};exports['removeTeams']=function(_0x369305,_0x40c1f7,_0x4738ae){return db[_0x5f55('0x63')][_0x5f55('0x44')]({'where':{'id':_0x369305[_0x5f55('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5f55('0x6f')],'as':_0x5f55('0x70'),'attributes':['id'],'raw':!![]}]})[_0x5f55('0x26')](handleEntityNotFound(_0x40c1f7,null))[_0x5f55('0x26')](function(_0x16f6d6){var _0xf1f7d0=_[_0x5f55('0x2d')](_0x16f6d6,'id');var _0x2a0deb=[];var _0x3a128e=[];var _0x1ef3e6=squel[_0x5f55('0x71')]();_0x1ef3e6[_0x5f55('0x72')](_0x5f55('0x73'))[_0x5f55('0x74')](_0x5f55('0x75'),'tq')[_0x5f55('0x76')](_0x5f55('0x77'),'ut',_0x5f55('0x78'))[_0x5f55('0x3d')]('OpenchannelQueueId\x20=\x20?',_0x369305[_0x5f55('0x48')]['id']);for(var _0x3f266f=0x0;_0x3f266f<_0x16f6d6[_0x5f55('0x58')];_0x3f266f+=0x1){let _0x5760b2=_0x16f6d6[_0x3f266f];for(var _0x45bc5c=0x0;_0x45bc5c<_0x5760b2[_0x5f55('0x70')][_0x5f55('0x58')];_0x45bc5c+=0x1){let _0x3c7177=_0x5760b2[_0x5f55('0x70')][_0x45bc5c];var _0x48d9c3=_0x1ef3e6[_0x5f55('0x79')]();_0x48d9c3[_0x5f55('0x3d')]('ut.UserId\x20=\x20?',_0x3c7177['id']);_0x3a128e['push'](db['sequelize'][_0x5f55('0x35')](_0x48d9c3[_0x5f55('0x7a')](),{'type':db[_0x5f55('0x69')][_0x5f55('0x7b')][_0x5f55('0x7c')]})[_0x5f55('0x26')](function(_0x438520){if(_0x438520[_0x5f55('0x58')]===0x1){return _0x3c7177['id'];}else{var _0x3d49da=_['every'](_['map'](_0x438520,_0x5f55('0x7d')),function(_0x382e1f){return _[_0x5f55('0x7e')](_0xf1f7d0,_0x382e1f);});if(_0x3d49da){return _0x3c7177['id'];}}}));}}return BPromise[_0x5f55('0x7f')](_0x3a128e)['then'](function(_0x4e3c20){_0x2a0deb=_(_0x2a0deb)['union'](_0x4e3c20)[_0x5f55('0x80')]()[_0x5f55('0x81')]();return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x369305[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](function(_0xd9ae9f){return db['sequelize'][_0x5f55('0x82')](function(_0x3352d2){return _0xd9ae9f[_0x5f55('0x83')](_0x369305[_0x5f55('0x35')][_0x5f55('0x65')],{'transaction':_0x3352d2})[_0x5f55('0x26')](function(){if(!_[_0x5f55('0x84')](_0x2a0deb)){return _0xd9ae9f[_0x5f55('0x85')](_0x2a0deb,{'transaction':_0x3352d2});}})[_0x5f55('0x26')](function(){_0x2a0deb[_0x5f55('0x6d')](function(_0x5006a3){socket[_0x5f55('0x6e')](_0x5f55('0x86'),{'UserId':_0x5006a3,'OpenchannelQueueId':_0xd9ae9f['id']});});});});});});})[_0x5f55('0x26')](respondWithStatusCode(_0x40c1f7,null))['catch'](handleError(_0x40c1f7,null));};exports[_0x5f55('0x87')]=function(_0x294b67,_0x2fc047,_0x1685f7){return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x294b67[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x2fc047,null))[_0x5f55('0x26')](function(_0x15b4b5){if(_0x15b4b5){return _0x15b4b5[_0x5f55('0x87')](_0x294b67['body']['ids'],_[_0x5f55('0x88')](_0x294b67['body'],[_0x5f55('0x65'),'id'])||{})['spread'](function(_0x2265d2){for(var _0xdc8877=0x0;_0xdc8877<_0x294b67['body'][_0x5f55('0x65')]['length'];_0xdc8877+=0x1){socket['emit'](_0x5f55('0x89'),{'UserId':_0x294b67[_0x5f55('0x4b')]['ids'][_0xdc8877],'OpenchannelQueueId':_0x294b67[_0x5f55('0x48')]['id']});}return _0x2265d2;});}})[_0x5f55('0x26')](respondWithResult(_0x2fc047,null))['catch'](handleError(_0x2fc047,null));};exports[_0x5f55('0x85')]=function(_0x5d1a84,_0xefca29,_0x15c927){return db[_0x5f55('0x2e')][_0x5f55('0x51')]({'where':{'id':_0x5d1a84[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0xefca29,null))[_0x5f55('0x26')](function(_0x2e327f){if(_0x2e327f){return _0x2e327f[_0x5f55('0x85')](_0x5d1a84['query']['ids'])[_0x5f55('0x26')](function(){if(_[_0x5f55('0x8a')](_0x5d1a84['query'][_0x5f55('0x65')])){for(var _0x406e4c=0x0;_0x406e4c<_0x5d1a84[_0x5f55('0x35')][_0x5f55('0x65')][_0x5f55('0x58')];_0x406e4c+=0x1){socket['emit'](_0x5f55('0x86'),{'UserId':Number(_0x5d1a84[_0x5f55('0x35')][_0x5f55('0x65')][_0x406e4c]),'OpenchannelQueueId':Number(_0x5d1a84[_0x5f55('0x48')]['id'])});}}else{socket[_0x5f55('0x6e')](_0x5f55('0x86'),{'UserId':Number(_0x5d1a84[_0x5f55('0x35')][_0x5f55('0x65')]),'OpenchannelQueueId':Number(_0x5d1a84[_0x5f55('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0xefca29,null))['catch'](handleError(_0xefca29,null));};exports['getAgents']=function(_0x387a17,_0x187f3b,_0x3de9bb){var _0x192078={};var _0x23c3e0={};var _0x26ee51;var _0x4bf9f8;return db[_0x5f55('0x2e')]['findOne']({'where':{'id':_0x387a17[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x187f3b,null))[_0x5f55('0x26')](function(_0x4a70d8){if(_0x4a70d8){_0x26ee51=_0x4a70d8;_0x23c3e0[_0x5f55('0x33')]=_[_0x5f55('0x34')](db[_0x5f55('0x6f')][_0x5f55('0x2f')]);_0x23c3e0[_0x5f55('0x35')]=_[_0x5f55('0x34')](_0x387a17[_0x5f55('0x35')]);_0x23c3e0['filters']=_[_0x5f55('0x37')](_0x23c3e0[_0x5f55('0x33')],_0x23c3e0[_0x5f55('0x35')]);_0x192078[_0x5f55('0x38')]=_[_0x5f55('0x37')](_0x23c3e0['model'],qs[_0x5f55('0x39')](_0x387a17[_0x5f55('0x35')][_0x5f55('0x39')]));_0x192078[_0x5f55('0x38')]=_0x192078['attributes'][_0x5f55('0x58')]?_0x192078[_0x5f55('0x38')]:_0x23c3e0[_0x5f55('0x33')];_0x192078[_0x5f55('0x3c')]=qs[_0x5f55('0x59')](_0x387a17['query'][_0x5f55('0x59')]);_0x192078['where']=qs[_0x5f55('0x36')](_[_0x5f55('0x3e')](_0x387a17[_0x5f55('0x35')],_0x23c3e0[_0x5f55('0x36')]));if(_0x387a17['query'][_0x5f55('0x3f')]){_0x192078[_0x5f55('0x3d')]=_[_0x5f55('0x40')](_0x192078[_0x5f55('0x3d')],{'$or':_['map'](_0x192078[_0x5f55('0x38')],function(_0x562a8e){var _0x1161df={};_0x1161df[_0x562a8e]={'$like':'%'+_0x387a17['query'][_0x5f55('0x3f')]+'%'};return _0x1161df;})});}_0x192078=_[_0x5f55('0x40')]({},_0x192078,_0x387a17[_0x5f55('0x42')]);return _0x26ee51[_0x5f55('0x8b')](_0x192078);}})[_0x5f55('0x26')](function(_0x141a66){if(_0x141a66){_0x4bf9f8=_0x141a66[_0x5f55('0x58')];if(!_0x387a17[_0x5f55('0x35')][_0x5f55('0x3a')](_0x5f55('0x3b'))){_0x192078['limit']=qs[_0x5f55('0x20')](_0x387a17[_0x5f55('0x35')]['limit']);_0x192078['offset']=qs[_0x5f55('0x1f')](_0x387a17[_0x5f55('0x35')][_0x5f55('0x1f')]);}return _0x26ee51['getAgents'](_0x192078);}})[_0x5f55('0x26')](function(_0x10fd26){if(_0x10fd26){return _0x10fd26?{'count':_0x4bf9f8,'rows':_0x10fd26}:null;}})['then'](respondWithResult(_0x187f3b,null))[_0x5f55('0x46')](handleError(_0x187f3b,null));}; \ No newline at end of file +var _0x5076=['addAgents','omit','spread','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send','index','OpenchannelQueue','fieldName','type','key','map','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','length','create','body','user','get','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','nolimit','order','OpenchannelQueueId','findAll','User','UserId','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','ids','tq.TeamId','from','team_has_openchannel_queues','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeTeams','isEmpty','removeAgents','forEach'];(function(_0x1a79f1,_0x2a4ae4){var _0x4d373c=function(_0x2841cb){while(--_0x2841cb){_0x1a79f1['push'](_0x1a79f1['shift']());}};_0x4d373c(++_0x2a4ae4);}(_0x5076,0x191));var _0x6507=function(_0x1b5a5a,_0x1c3b75){_0x1b5a5a=_0x1b5a5a-0x0;var _0x42b32d=_0x5076[_0x1b5a5a];return _0x42b32d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6507('0x0'));var rimraf=require(_0x6507('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6507('0x2'));var rp=require(_0x6507('0x3'));var moment=require('moment');var BPromise=require(_0x6507('0x4'));var Mustache=require(_0x6507('0x5'));var util=require(_0x6507('0x6'));var path=require(_0x6507('0x7'));var sox=require(_0x6507('0x8'));var csv=require(_0x6507('0x9'));var ejs=require(_0x6507('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6507('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6507('0x9'));var querystring=require(_0x6507('0xc'));var Papa=require(_0x6507('0xd'));var Redis=require(_0x6507('0xe'));var authService=require(_0x6507('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6507('0x10'));var utils=require('../../config/utils');var config=require(_0x6507('0x11'));var db=require(_0x6507('0x12'))['db'];config[_0x6507('0x13')]=_['defaults'](config[_0x6507('0x13')],{'host':_0x6507('0x14'),'port':0x18eb});var socket=require(_0x6507('0x15'))(new Redis(config[_0x6507('0x13')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x51a622,_0x4168fd){_0x4168fd=_0x4168fd||0xcc;return function(_0x4f01c6){if(_0x4f01c6){return _0x51a622[_0x6507('0x16')](_0x4168fd);}return _0x51a622[_0x6507('0x17')](_0x4168fd)[_0x6507('0x18')]();};}function respondWithResult(_0x3dc6f5,_0x3335ac){_0x3335ac=_0x3335ac||0xc8;return function(_0x24302a){if(_0x24302a){return _0x3dc6f5[_0x6507('0x17')](_0x3335ac)[_0x6507('0x19')](_0x24302a);}};}function respondWithFilteredResult(_0x37d4f3,_0x25b9c4){return function(_0x3e08d8){if(_0x3e08d8){var _0x4a98f6=_0x3e08d8[_0x6507('0x1a')],_0x12c1ea=_0x25b9c4[_0x6507('0x1b')],_0x1095b8=_0x25b9c4[_0x6507('0x1b')]+_0x25b9c4[_0x6507('0x1c')],_0x33d1e9;if(_0x1095b8>=_0x4a98f6){_0x1095b8=_0x4a98f6;_0x33d1e9=0xc8;}else{_0x33d1e9=0xce;}_0x37d4f3['status'](_0x33d1e9);return _0x37d4f3['set'](_0x6507('0x1d'),_0x12c1ea+'-'+_0x1095b8+'/'+_0x4a98f6)[_0x6507('0x19')](_0x3e08d8);}return null;};}function patchUpdates(_0x56f55b){return function(_0xc8d718){try{jsonpatch[_0x6507('0x1e')](_0xc8d718,_0x56f55b,!![]);}catch(_0x5d7127){return BPromise[_0x6507('0x1f')](_0x5d7127);}return _0xc8d718[_0x6507('0x20')]();};}function saveUpdates(_0x16f200,_0x564fe1){return function(_0x43cd21){if(_0x43cd21){return _0x43cd21[_0x6507('0x21')](_0x16f200)[_0x6507('0x22')](function(_0x593696){return _0x593696;});}return null;};}function removeEntity(_0x2ee5e2,_0x5b8ced){return function(_0x3eec77){if(_0x3eec77){return _0x3eec77[_0x6507('0x23')]()[_0x6507('0x22')](function(){var _0x299474=_0x3eec77['get']({'plain':!![]});var _0x5e21c4=_0x6507('0x24');return db[_0x6507('0x25')]['destroy']({'where':{'type':_0x5e21c4,'resourceId':_0x299474['id']}})[_0x6507('0x22')](function(){return _0x3eec77;});})[_0x6507('0x22')](function(){_0x2ee5e2[_0x6507('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d67f3,_0x4caf3d){return function(_0x59c1ea){if(!_0x59c1ea){_0x4d67f3[_0x6507('0x16')](0x194);}return _0x59c1ea;};}function handleError(_0x272eb7,_0x379f12){_0x379f12=_0x379f12||0x1f4;return function(_0x5748d2){logger['error'](_0x5748d2[_0x6507('0x26')]);if(_0x5748d2[_0x6507('0x27')]){delete _0x5748d2[_0x6507('0x27')];}_0x272eb7['status'](_0x379f12)[_0x6507('0x28')](_0x5748d2);};}exports[_0x6507('0x29')]=function(_0x288e4c,_0x174b54){var _0x17eebc={},_0xa1543f={},_0x5e19ae={'count':0x0,'rows':[]};var _0xbda099=_['map'](db[_0x6507('0x2a')]['rawAttributes'],function(_0x1c1c6b){return{'name':_0x1c1c6b[_0x6507('0x2b')],'type':_0x1c1c6b[_0x6507('0x2c')][_0x6507('0x2d')]};});_0xa1543f['model']=_[_0x6507('0x2e')](_0xbda099,_0x6507('0x27'));_0xa1543f['query']=_[_0x6507('0x2f')](_0x288e4c[_0x6507('0x30')]);_0xa1543f[_0x6507('0x31')]=_['intersection'](_0xa1543f[_0x6507('0x32')],_0xa1543f['query']);_0x17eebc['attributes']=_[_0x6507('0x33')](_0xa1543f[_0x6507('0x32')],qs['fields'](_0x288e4c[_0x6507('0x30')][_0x6507('0x34')]));_0x17eebc[_0x6507('0x35')]=_0x17eebc['attributes']['length']?_0x17eebc[_0x6507('0x35')]:_0xa1543f[_0x6507('0x32')];if(!_0x288e4c[_0x6507('0x30')][_0x6507('0x36')]('nolimit')){_0x17eebc['limit']=qs[_0x6507('0x1c')](_0x288e4c[_0x6507('0x30')][_0x6507('0x1c')]);_0x17eebc[_0x6507('0x1b')]=qs[_0x6507('0x1b')](_0x288e4c['query']['offset']);}_0x17eebc['order']=qs[_0x6507('0x37')](_0x288e4c['query'][_0x6507('0x37')]);_0x17eebc[_0x6507('0x38')]=qs['filters'](_[_0x6507('0x39')](_0x288e4c[_0x6507('0x30')],_0xa1543f[_0x6507('0x31')]),_0xbda099);if(_0x288e4c[_0x6507('0x30')][_0x6507('0x3a')]){_0x17eebc[_0x6507('0x38')]=_[_0x6507('0x3b')](_0x17eebc[_0x6507('0x38')],{'$or':_['map'](_0xbda099,function(_0x53c010){if(_0x53c010[_0x6507('0x2c')]!==_0x6507('0x3c')){var _0x47f7eb={};_0x47f7eb[_0x53c010[_0x6507('0x27')]]={'$like':'%'+_0x288e4c[_0x6507('0x30')][_0x6507('0x3a')]+'%'};return _0x47f7eb;}})});}_0x17eebc=_[_0x6507('0x3b')]({},_0x17eebc,_0x288e4c[_0x6507('0x3d')]);var _0x2200e5={'where':_0x17eebc[_0x6507('0x38')]};return db['OpenchannelQueue'][_0x6507('0x1a')](_0x2200e5)[_0x6507('0x22')](function(_0x28b579){_0x5e19ae['count']=_0x28b579;if(_0x288e4c[_0x6507('0x30')][_0x6507('0x3e')]){_0x17eebc[_0x6507('0x3f')]=[{'all':!![]}];}return db[_0x6507('0x2a')]['findAll'](_0x17eebc);})[_0x6507('0x22')](function(_0x158316){_0x5e19ae[_0x6507('0x40')]=_0x158316;return _0x5e19ae;})['then'](respondWithFilteredResult(_0x174b54,_0x17eebc))[_0x6507('0x41')](handleError(_0x174b54,null));};exports['show']=function(_0x4115fc,_0x32eba7){var _0x288c6a={'raw':!![],'where':{'id':_0x4115fc[_0x6507('0x42')]['id']}},_0xf41d06={};_0xf41d06[_0x6507('0x32')]=_[_0x6507('0x2f')](db[_0x6507('0x2a')][_0x6507('0x43')]);_0xf41d06[_0x6507('0x30')]=_[_0x6507('0x2f')](_0x4115fc[_0x6507('0x30')]);_0xf41d06[_0x6507('0x31')]=_[_0x6507('0x33')](_0xf41d06[_0x6507('0x32')],_0xf41d06[_0x6507('0x30')]);_0x288c6a[_0x6507('0x35')]=_[_0x6507('0x33')](_0xf41d06[_0x6507('0x32')],qs[_0x6507('0x34')](_0x4115fc[_0x6507('0x30')][_0x6507('0x34')]));_0x288c6a[_0x6507('0x35')]=_0x288c6a[_0x6507('0x35')][_0x6507('0x44')]?_0x288c6a[_0x6507('0x35')]:_0xf41d06[_0x6507('0x32')];if(_0x4115fc[_0x6507('0x30')][_0x6507('0x3e')]){_0x288c6a[_0x6507('0x3f')]=[{'all':!![]}];}_0x288c6a=_['merge']({},_0x288c6a,_0x4115fc[_0x6507('0x3d')]);return db['OpenchannelQueue']['find'](_0x288c6a)[_0x6507('0x22')](handleEntityNotFound(_0x32eba7,null))[_0x6507('0x22')](respondWithResult(_0x32eba7,null))[_0x6507('0x41')](handleError(_0x32eba7,null));};exports['create']=function(_0x256cef,_0x30edfb){return db[_0x6507('0x2a')][_0x6507('0x45')](_0x256cef[_0x6507('0x46')],{})[_0x6507('0x22')](function(_0x24230d){var _0x3358f8=_0x256cef[_0x6507('0x47')][_0x6507('0x48')]({'plain':!![]});if(!_0x3358f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3358f8[_0x6507('0x49')]===_0x6507('0x47')){var _0x1a5132=_0x24230d[_0x6507('0x48')]({'plain':!![]});var _0x5d059b=_0x6507('0x24');return db[_0x6507('0x4a')][_0x6507('0x4b')]({'where':{'name':_0x5d059b,'userProfileId':_0x3358f8['userProfileId']},'raw':!![]})[_0x6507('0x22')](function(_0x5e6322){if(_0x5e6322&&_0x5e6322[_0x6507('0x4c')]===0x0){return db[_0x6507('0x25')][_0x6507('0x45')]({'name':_0x1a5132[_0x6507('0x27')],'resourceId':_0x1a5132['id'],'type':_0x5e6322[_0x6507('0x27')],'sectionId':_0x5e6322['id']},{})[_0x6507('0x22')](function(){return _0x24230d;});}else{return _0x24230d;}})[_0x6507('0x41')](function(_0x408a09){logger[_0x6507('0x4d')](_0x6507('0x4e'),_0x408a09);throw _0x408a09;});}return _0x24230d;})[_0x6507('0x22')](respondWithResult(_0x30edfb,0xc9))[_0x6507('0x41')](handleError(_0x30edfb,null));};exports['update']=function(_0x550bfd,_0x5ac601){if(_0x550bfd[_0x6507('0x46')]['id']){delete _0x550bfd[_0x6507('0x46')]['id'];}return db[_0x6507('0x2a')]['find']({'where':{'id':_0x550bfd['params']['id']}})['then'](handleEntityNotFound(_0x5ac601,null))[_0x6507('0x22')](saveUpdates(_0x550bfd[_0x6507('0x46')],null))[_0x6507('0x22')](respondWithResult(_0x5ac601,null))[_0x6507('0x41')](handleError(_0x5ac601,null));};exports[_0x6507('0x23')]=function(_0x128d24,_0x42575c){return db[_0x6507('0x2a')][_0x6507('0x4b')]({'where':{'id':_0x128d24['params']['id']}})[_0x6507('0x22')](handleEntityNotFound(_0x42575c,null))[_0x6507('0x22')](removeEntity(_0x42575c,null))['catch'](handleError(_0x42575c,null));};exports[_0x6507('0x4f')]=function(_0x14ddb7,_0x1f8bf8){return db[_0x6507('0x2a')][_0x6507('0x4f')]()[_0x6507('0x22')](respondWithResult(_0x1f8bf8,null))[_0x6507('0x41')](handleError(_0x1f8bf8,null));};exports['getMembers']=function(_0xe84dac,_0x15eb34,_0x42e100){var _0x5bd500={'raw':!![],'where':{}},_0x200151={},_0x23a37f;return db[_0x6507('0x2a')][_0x6507('0x50')]({'where':{'id':_0xe84dac['params']['id']}})[_0x6507('0x22')](handleEntityNotFound(_0x15eb34,null))[_0x6507('0x22')](function(_0x8e85b7){if(_0x8e85b7){_0x23a37f=_0x8e85b7[_0x6507('0x48')]({'plain':!![]});_0x200151[_0x6507('0x32')]=_[_0x6507('0x2f')](db[_0x6507('0x51')][_0x6507('0x43')]);_0x200151[_0x6507('0x30')]=_[_0x6507('0x2f')](_0xe84dac[_0x6507('0x30')]);_0x200151[_0x6507('0x31')]=_[_0x6507('0x33')](_0x200151[_0x6507('0x32')],_0x200151[_0x6507('0x30')]);_0x5bd500[_0x6507('0x35')]=_[_0x6507('0x33')](_0x200151['model'],qs[_0x6507('0x34')](_0xe84dac[_0x6507('0x30')][_0x6507('0x34')]));_0x5bd500['attributes']=_0x5bd500[_0x6507('0x35')][_0x6507('0x44')]?_0x5bd500['attributes']:_0x200151[_0x6507('0x32')];if(!_0xe84dac['query'][_0x6507('0x36')](_0x6507('0x52'))){_0x5bd500[_0x6507('0x1c')]=qs[_0x6507('0x1c')](_0xe84dac['query'][_0x6507('0x1c')]);_0x5bd500['offset']=qs[_0x6507('0x1b')](_0xe84dac[_0x6507('0x30')][_0x6507('0x1b')]);}_0x5bd500[_0x6507('0x53')]=qs[_0x6507('0x37')](_0xe84dac['query'][_0x6507('0x37')]);_0x5bd500['where']=qs[_0x6507('0x31')](_[_0x6507('0x39')](_0xe84dac[_0x6507('0x30')],_0x200151['filters']));_0x5bd500['where'][_0x6507('0x54')]=_0x8e85b7['id'];if(_0xe84dac['query']['filter']){_0x5bd500['where']=_[_0x6507('0x3b')](_0x5bd500['where'],{'$or':_[_0x6507('0x2e')](_0x5bd500[_0x6507('0x35')],function(_0x1cf024){var _0x31270c={};_0x31270c[_0x1cf024]={'$like':'%'+_0xe84dac[_0x6507('0x30')][_0x6507('0x3a')]+'%'};return _0x31270c;})});}_0x5bd500=_[_0x6507('0x3b')]({},_0x5bd500,_0xe84dac[_0x6507('0x3d')]);return db[_0x6507('0x51')][_0x6507('0x55')](_0x5bd500);}})[_0x6507('0x22')](function(_0x28c052){if(_0x28c052){return db[_0x6507('0x56')]['findAndCountAll']({'where':{'id':_[_0x6507('0x2e')](_0x28c052,_0x6507('0x57')),'role':'agent'},'attributes':['id',_0x6507('0x27'),_0x6507('0x58'),_0x6507('0x59'),'createdAt']});}})[_0x6507('0x22')](function(_0x127d46){if(_0x127d46){return{'count':_0x127d46['count'],'rows':_[_0x6507('0x2e')](_0x127d46[_0x6507('0x40')],function(_0x77e649){return{'membername':_0x77e649[_0x6507('0x27')],'UserId':_0x77e649['id'],'queue_name':_0x23a37f['name'],'OpenchannelQueueId':_0x23a37f['id'],'interface':util[_0x6507('0x5a')](_0x6507('0x5b'),_0x6507('0x5c'),_0x77e649['name']),'penalty':0x0,'paused':_0x77e649[_0x6507('0x58')],'createdAt':_0x77e649[_0x6507('0x5d')],'updatedAt':_0x77e649[_0x6507('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x15eb34,_0x5bd500))[_0x6507('0x41')](handleError(_0x15eb34,null));};exports['getTeams']=function(_0x343daa,_0x137f9e,_0x95eff9){var _0x3dd184={};var _0x52fe9b={};var _0x3bd369;var _0x3cd45b;return db[_0x6507('0x2a')][_0x6507('0x50')]({'where':{'id':_0x343daa[_0x6507('0x42')]['id']}})[_0x6507('0x22')](handleEntityNotFound(_0x137f9e,null))['then'](function(_0x5e9e5f){if(_0x5e9e5f){_0x3bd369=_0x5e9e5f;_0x52fe9b['model']=_[_0x6507('0x2f')](db[_0x6507('0x5e')][_0x6507('0x43')]);_0x52fe9b[_0x6507('0x30')]=_[_0x6507('0x2f')](_0x343daa[_0x6507('0x30')]);_0x52fe9b['filters']=_[_0x6507('0x33')](_0x52fe9b[_0x6507('0x32')],_0x52fe9b[_0x6507('0x30')]);_0x3dd184['attributes']=_['intersection'](_0x52fe9b['model'],qs['fields'](_0x343daa['query']['fields']));_0x3dd184[_0x6507('0x35')]=_0x3dd184['attributes'][_0x6507('0x44')]?_0x3dd184[_0x6507('0x35')]:_0x52fe9b[_0x6507('0x32')];_0x3dd184[_0x6507('0x53')]=qs[_0x6507('0x37')](_0x343daa[_0x6507('0x30')][_0x6507('0x37')]);_0x3dd184[_0x6507('0x38')]=qs[_0x6507('0x31')](_[_0x6507('0x39')](_0x343daa[_0x6507('0x30')],_0x52fe9b[_0x6507('0x31')]));if(_0x343daa['query'][_0x6507('0x3a')]){_0x3dd184[_0x6507('0x38')]=_['merge'](_0x3dd184[_0x6507('0x38')],{'$or':_[_0x6507('0x2e')](_0x3dd184[_0x6507('0x35')],function(_0xc62e01){var _0x5f3061={};_0x5f3061[_0xc62e01]={'$like':'%'+_0x343daa[_0x6507('0x30')][_0x6507('0x3a')]+'%'};return _0x5f3061;})});}_0x3dd184=_[_0x6507('0x3b')]({},_0x3dd184,_0x343daa['options']);return _0x3bd369[_0x6507('0x5f')](_0x3dd184);}})[_0x6507('0x22')](function(_0x3c7f9f){if(_0x3c7f9f){_0x3cd45b=_0x3c7f9f[_0x6507('0x44')];if(!_0x343daa['query']['hasOwnProperty'](_0x6507('0x52'))){_0x3dd184[_0x6507('0x1c')]=qs[_0x6507('0x1c')](_0x343daa[_0x6507('0x30')]['limit']);_0x3dd184[_0x6507('0x1b')]=qs[_0x6507('0x1b')](_0x343daa[_0x6507('0x30')]['offset']);}return _0x3bd369[_0x6507('0x5f')](_0x3dd184);}})[_0x6507('0x22')](function(_0x2f62be){if(_0x2f62be){return _0x2f62be?{'count':_0x3cd45b,'rows':_0x2f62be}:null;}})[_0x6507('0x22')](respondWithResult(_0x137f9e,null))[_0x6507('0x41')](handleError(_0x137f9e,null));};exports[_0x6507('0x60')]=function(_0x45b6f5,_0x5a4178,_0x333c0f){var _0x562ddc=_0x45b6f5[_0x6507('0x46')]['ids'];return db[_0x6507('0x5e')][_0x6507('0x55')]({'where':{'id':_0x562ddc},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6507('0x61'),'attributes':['id',_0x6507('0x27'),_0x6507('0x62'),_0x6507('0x63'),_0x6507('0x64')],'raw':!![]}]})[_0x6507('0x22')](function(_0x420c3c){if(_0x420c3c){var _0xca2aa3=_[_0x6507('0x65')](_0x420c3c,function(_0x13d2c3){var _0x5b3216=_0x13d2c3['get']({'plain':!![]});return _0x5b3216[_0x6507('0x61')];});return db[_0x6507('0x2a')][_0x6507('0x4b')]({'where':{'id':_0x45b6f5['params']['id']}})[_0x6507('0x22')](function(_0x35b6f8){return db[_0x6507('0x66')][_0x6507('0x67')](function(_0x3c754a){return _0x35b6f8['addTeams'](_0x562ddc,{'transaction':_0x3c754a})['then'](function(){return BPromise[_0x6507('0x68')](_0xca2aa3,function(_0x154a78){return db[_0x6507('0x51')][_0x6507('0x69')]({'where':{'UserId':_0x154a78['id'],'OpenchannelQueueId':_0x45b6f5[_0x6507('0x42')]['id']},'transaction':_0x3c754a});});})[_0x6507('0x22')](function(){_0xca2aa3['forEach'](function(_0x4b736c){socket[_0x6507('0x6a')]('userOpenchannelQueue:save',{'UserId':_0x4b736c['id'],'OpenchannelQueueId':_0x35b6f8['id']});});});});});}})['then'](respondWithStatusCode(_0x5a4178,null))[_0x6507('0x41')](handleError(_0x5a4178,null));};exports['removeTeams']=function(_0x51df18,_0x2fa2a7,_0x5f400a){return db[_0x6507('0x5e')][_0x6507('0x55')]({'where':{'id':_0x51df18['query'][_0x6507('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x6507('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2fa2a7,null))['then'](function(_0x1c0c31){var _0x1f1208=_['map'](_0x1c0c31,'id');var _0x3bb106=[];var _0x32be86=[];var _0x2f416e=squel['select']();_0x2f416e['field'](_0x6507('0x6c'))[_0x6507('0x6d')](_0x6507('0x6e'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6507('0x38')](_0x6507('0x6f'),_0x51df18[_0x6507('0x42')]['id']);for(var _0x1c0a9e=0x0;_0x1c0a9e<_0x1c0c31['length'];_0x1c0a9e+=0x1){let _0x82e674=_0x1c0c31[_0x1c0a9e];for(var _0x43b658=0x0;_0x43b658<_0x82e674[_0x6507('0x61')][_0x6507('0x44')];_0x43b658+=0x1){let _0x527322=_0x82e674[_0x6507('0x61')][_0x43b658];var _0x4f1834=_0x2f416e[_0x6507('0x70')]();_0x4f1834['where'](_0x6507('0x71'),_0x527322['id']);_0x32be86[_0x6507('0x72')](db['sequelize'][_0x6507('0x30')](_0x4f1834[_0x6507('0x73')](),{'type':db[_0x6507('0x66')][_0x6507('0x74')][_0x6507('0x75')]})[_0x6507('0x22')](function(_0x2f3024){if(_0x2f3024[_0x6507('0x44')]===0x1){return _0x527322['id'];}else{var _0x58c8ef=_[_0x6507('0x76')](_[_0x6507('0x2e')](_0x2f3024,_0x6507('0x77')),function(_0x5bec52){return _[_0x6507('0x78')](_0x1f1208,_0x5bec52);});if(_0x58c8ef){return _0x527322['id'];}}}));}}return BPromise['all'](_0x32be86)[_0x6507('0x22')](function(_0x32003c){_0x3bb106=_(_0x3bb106)[_0x6507('0x79')](_0x32003c)[_0x6507('0x7a')]()['value']();return db[_0x6507('0x2a')][_0x6507('0x4b')]({'where':{'id':_0x51df18[_0x6507('0x42')]['id']}})[_0x6507('0x22')](function(_0x161200){return db[_0x6507('0x66')][_0x6507('0x67')](function(_0x1c8aa3){return _0x161200[_0x6507('0x7b')](_0x51df18[_0x6507('0x30')]['ids'],{'transaction':_0x1c8aa3})[_0x6507('0x22')](function(){if(!_[_0x6507('0x7c')](_0x3bb106)){return _0x161200[_0x6507('0x7d')](_0x3bb106,{'transaction':_0x1c8aa3});}})[_0x6507('0x22')](function(){_0x3bb106[_0x6507('0x7e')](function(_0x56b114){socket[_0x6507('0x6a')]('userOpenchannelQueue:remove',{'UserId':_0x56b114,'OpenchannelQueueId':_0x161200['id']});});});});});});})[_0x6507('0x22')](respondWithStatusCode(_0x2fa2a7,null))[_0x6507('0x41')](handleError(_0x2fa2a7,null));};exports[_0x6507('0x7f')]=function(_0x2d66bb,_0x43226c,_0x1eb329){return db[_0x6507('0x2a')][_0x6507('0x4b')]({'where':{'id':_0x2d66bb[_0x6507('0x42')]['id']}})[_0x6507('0x22')](handleEntityNotFound(_0x43226c,null))['then'](function(_0x1222fe){if(_0x1222fe){return _0x1222fe[_0x6507('0x7f')](_0x2d66bb[_0x6507('0x46')][_0x6507('0x6b')],_[_0x6507('0x80')](_0x2d66bb[_0x6507('0x46')],[_0x6507('0x6b'),'id'])||{})[_0x6507('0x81')](function(_0x4b5e3b){for(var _0x205d32=0x0;_0x205d32<_0x2d66bb[_0x6507('0x46')][_0x6507('0x6b')][_0x6507('0x44')];_0x205d32+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x2d66bb[_0x6507('0x46')][_0x6507('0x6b')][_0x205d32],'OpenchannelQueueId':_0x2d66bb[_0x6507('0x42')]['id']});}return _0x4b5e3b;});}})[_0x6507('0x22')](respondWithResult(_0x43226c,null))[_0x6507('0x41')](handleError(_0x43226c,null));};exports['removeAgents']=function(_0x578dfd,_0x4c8f1e,_0x151925){return db['OpenchannelQueue'][_0x6507('0x4b')]({'where':{'id':_0x578dfd['params']['id']}})[_0x6507('0x22')](handleEntityNotFound(_0x4c8f1e,null))[_0x6507('0x22')](function(_0x2c57aa){if(_0x2c57aa){return _0x2c57aa[_0x6507('0x7d')](_0x578dfd[_0x6507('0x30')][_0x6507('0x6b')])[_0x6507('0x22')](function(){if(_['isArray'](_0x578dfd[_0x6507('0x30')][_0x6507('0x6b')])){for(var _0x3ec6d5=0x0;_0x3ec6d5<_0x578dfd[_0x6507('0x30')][_0x6507('0x6b')][_0x6507('0x44')];_0x3ec6d5+=0x1){socket['emit'](_0x6507('0x82'),{'UserId':Number(_0x578dfd['query'][_0x6507('0x6b')][_0x3ec6d5]),'OpenchannelQueueId':Number(_0x578dfd['params']['id'])});}}else{socket[_0x6507('0x6a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x578dfd[_0x6507('0x30')][_0x6507('0x6b')]),'OpenchannelQueueId':Number(_0x578dfd[_0x6507('0x42')]['id'])});}});}})[_0x6507('0x22')](respondWithStatusCode(_0x4c8f1e,null))[_0x6507('0x41')](handleError(_0x4c8f1e,null));};exports[_0x6507('0x83')]=function(_0x4e27a6,_0x926a40,_0x1a2047){var _0x2384db={};var _0x102871={};var _0x2b46c9;var _0x5567a0;return db[_0x6507('0x2a')][_0x6507('0x50')]({'where':{'id':_0x4e27a6['params']['id']}})['then'](handleEntityNotFound(_0x926a40,null))['then'](function(_0xfbc014){if(_0xfbc014){_0x2b46c9=_0xfbc014;_0x102871['model']=_[_0x6507('0x2f')](db[_0x6507('0x56')][_0x6507('0x43')]);_0x102871['query']=_[_0x6507('0x2f')](_0x4e27a6[_0x6507('0x30')]);_0x102871[_0x6507('0x31')]=_[_0x6507('0x33')](_0x102871[_0x6507('0x32')],_0x102871['query']);_0x2384db[_0x6507('0x35')]=_[_0x6507('0x33')](_0x102871[_0x6507('0x32')],qs['fields'](_0x4e27a6[_0x6507('0x30')][_0x6507('0x34')]));_0x2384db[_0x6507('0x35')]=_0x2384db[_0x6507('0x35')][_0x6507('0x44')]?_0x2384db[_0x6507('0x35')]:_0x102871['model'];_0x2384db[_0x6507('0x53')]=qs[_0x6507('0x37')](_0x4e27a6[_0x6507('0x30')]['sort']);_0x2384db[_0x6507('0x38')]=qs[_0x6507('0x31')](_['pick'](_0x4e27a6['query'],_0x102871['filters']));if(_0x4e27a6['query']['filter']){_0x2384db[_0x6507('0x38')]=_[_0x6507('0x3b')](_0x2384db[_0x6507('0x38')],{'$or':_[_0x6507('0x2e')](_0x2384db[_0x6507('0x35')],function(_0x566524){var _0x1e5c97={};_0x1e5c97[_0x566524]={'$like':'%'+_0x4e27a6[_0x6507('0x30')]['filter']+'%'};return _0x1e5c97;})});}_0x2384db=_[_0x6507('0x3b')]({},_0x2384db,_0x4e27a6[_0x6507('0x3d')]);return _0x2b46c9['getAgents'](_0x2384db);}})['then'](function(_0x3ac387){if(_0x3ac387){_0x5567a0=_0x3ac387[_0x6507('0x44')];if(!_0x4e27a6[_0x6507('0x30')][_0x6507('0x36')](_0x6507('0x52'))){_0x2384db['limit']=qs[_0x6507('0x1c')](_0x4e27a6[_0x6507('0x30')]['limit']);_0x2384db[_0x6507('0x1b')]=qs[_0x6507('0x1b')](_0x4e27a6[_0x6507('0x30')][_0x6507('0x1b')]);}return _0x2b46c9[_0x6507('0x83')](_0x2384db);}})['then'](function(_0x2feae5){if(_0x2feae5){return _0x2feae5?{'count':_0x5567a0,'rows':_0x2feae5}:null;}})[_0x6507('0x22')](respondWithResult(_0x926a40,null))[_0x6507('0x41')](handleError(_0x926a40,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index e8cb441..c3ab9e8 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 _0x9bac=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x15d8ae,_0x29fe74){var _0x19598a=function(_0x46593c){while(--_0x46593c){_0x15d8ae['push'](_0x15d8ae['shift']());}};_0x19598a(++_0x29fe74);}(_0x9bac,0x6c));var _0xc9ba=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9bac[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xc9ba('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc9ba('0x1')](0x0);var events={'afterCreate':_0xc9ba('0x2'),'afterUpdate':_0xc9ba('0x3'),'afterDestroy':_0xc9ba('0x4')};function emitEvent(_0x575239){return function(_0x4b9de6,_0x16741d,_0x13dd12){OpenchannelQueueEvents['emit'](_0x575239+':'+_0x4b9de6['id'],_0x4b9de6);OpenchannelQueueEvents[_0xc9ba('0x5')](_0x575239,_0x4b9de6);_0x13dd12(null);};}for(var e in events){if(events[_0xc9ba('0x6')](e)){var event=events[e];OpenchannelQueue[_0xc9ba('0x7')](e,emitEvent(event));}}module[_0xc9ba('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x043e=['hook','exports','events','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3072f9,_0x547768){var _0x14d2df=function(_0x51984c){while(--_0x51984c){_0x3072f9['push'](_0x3072f9['shift']());}};_0x14d2df(++_0x547768);}(_0x043e,0x1b0));var _0xe043=function(_0x538025,_0x4c466b){_0x538025=_0x538025-0x0;var _0x5abffc=_0x043e[_0x538025];return _0x5abffc;};'use strict';var EventEmitter=require(_0xe043('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xe043('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe043('0x2')](0x0);var events={'afterCreate':_0xe043('0x3'),'afterUpdate':_0xe043('0x4'),'afterDestroy':_0xe043('0x5')};function emitEvent(_0x26633a){return function(_0x5c710a,_0x53d332,_0x50a6ed){OpenchannelQueueEvents[_0xe043('0x6')](_0x26633a+':'+_0x5c710a['id'],_0x5c710a);OpenchannelQueueEvents[_0xe043('0x6')](_0x26633a,_0x5c710a);_0x50a6ed(null);};}for(var e in events){if(events[_0xe043('0x7')](e)){var event=events[e];OpenchannelQueue[_0xe043('0x8')](e,emitEvent(event));}}module[_0xe043('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 2d3c1ab..e892fe8 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 _0xa6ff=['openchannel_queues','util','api','moment','bluebird','path','./openchannelQueue.attributes','define'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0xa6ff,0x109));var _0xfa6f=function(_0xfabe1,_0x263f08){_0xfabe1=_0xfabe1-0x0;var _0x1750f8=_0xa6ff[_0xfabe1];return _0x1750f8;};'use strict';var _=require('lodash');var util=require(_0xfa6f('0x0'));var logger=require('../../config/logger')(_0xfa6f('0x1'));var moment=require(_0xfa6f('0x2'));var BPromise=require(_0xfa6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa6f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa6f('0x5'));module['exports']=function(_0x557f9c,_0x5a6ddf){return _0x557f9c[_0xfa6f('0x6')]('OpenchannelQueue',attributes,{'tableName':_0xfa6f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15f6=['bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0xf8b747,_0x10e2c4){var _0x2ff996=function(_0x80fd12){while(--_0x80fd12){_0xf8b747['push'](_0xf8b747['shift']());}};_0x2ff996(++_0x10e2c4);}(_0x15f6,0x1d7));var _0x615f=function(_0x52930a,_0x50c6c0){_0x52930a=_0x52930a-0x0;var _0x2719be=_0x15f6[_0x52930a];return _0x2719be;};'use strict';var _=require(_0x615f('0x0'));var util=require(_0x615f('0x1'));var logger=require(_0x615f('0x2'))(_0x615f('0x3'));var moment=require(_0x615f('0x4'));var BPromise=require(_0x615f('0x5'));var rp=require(_0x615f('0x6'));var fs=require('fs');var path=require(_0x615f('0x7'));var rimraf=require(_0x615f('0x8'));var config=require('../../config/environment');var attributes=require(_0x615f('0x9'));module[_0x615f('0xa')]=function(_0x5a699b,_0x980ad1){return _0x5a699b[_0x615f('0xb')](_0x615f('0xc'),attributes,{'tableName':_0x615f('0xd'),'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 d4a1341..0407086 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 _0x4235=['socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','limit','map','include','model','attributes','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4235,0x18c));var _0x5423=function(_0x4e7b46,_0x1e5718){_0x4e7b46=_0x4e7b46-0x0;var _0x309599=_0x4235[_0x4e7b46];return _0x309599;};'use strict';var _=require(_0x5423('0x0'));var util=require(_0x5423('0x1'));var moment=require(_0x5423('0x2'));var BPromise=require(_0x5423('0x3'));var rs=require(_0x5423('0x4'));var fs=require('fs');var Redis=require(_0x5423('0x5'));var db=require(_0x5423('0x6'))['db'];var utils=require(_0x5423('0x7'));var logger=require(_0x5423('0x8'))(_0x5423('0x9'));var config=require(_0x5423('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5423('0xb')]=_[_0x5423('0xc')](config['redis'],{'host':_0x5423('0xd'),'port':0x18eb});var socket=require(_0x5423('0xe'))(new Redis(config['redis']));require(_0x5423('0xf'))[_0x5423('0x10')](socket);function respondWithRpcPromise(_0x2dbed3,_0x16b910,_0x17289a){return new BPromise(function(_0x5c9fe8,_0x22d32e){return client[_0x5423('0x11')](_0x2dbed3,_0x17289a)[_0x5423('0x12')](function(_0x4ffe6b){logger['info'](_0x5423('0x13'),_0x16b910,_0x5423('0x14'));logger[_0x5423('0x15')](_0x5423('0x16'),_0x16b910,_0x5423('0x14'),JSON[_0x5423('0x17')](_0x4ffe6b));if(_0x4ffe6b[_0x5423('0x18')]){if(_0x4ffe6b['error'][_0x5423('0x19')]===0x1f4){logger[_0x5423('0x18')](_0x5423('0x13'),_0x16b910,_0x4ffe6b[_0x5423('0x18')]['message']);return _0x22d32e(_0x4ffe6b[_0x5423('0x18')][_0x5423('0x1a')]);}logger['error'](_0x5423('0x13'),_0x16b910,_0x4ffe6b[_0x5423('0x18')][_0x5423('0x1a')]);return _0x5c9fe8(_0x4ffe6b[_0x5423('0x18')]['message']);}else{logger[_0x5423('0x1b')](_0x5423('0x13'),_0x16b910,_0x5423('0x14'));_0x5c9fe8(_0x4ffe6b['result'][_0x5423('0x1a')]);}})[_0x5423('0x1c')](function(_0x3d53bd){logger['error'](_0x5423('0x13'),_0x16b910,_0x3d53bd);_0x22d32e(_0x3d53bd);});});}exports[_0x5423('0x1d')]=function(_0x511ed8){var _0x599c08=this;return new Promise(function(_0x15c174,_0x49cb41){return db[_0x5423('0x1e')]['findAll']({'raw':_0x511ed8[_0x5423('0x1f')]?_0x511ed8[_0x5423('0x1f')][_0x5423('0x20')]===undefined?!![]:![]:!![],'where':_0x511ed8[_0x5423('0x1f')]?_0x511ed8[_0x5423('0x1f')][_0x5423('0x21')]||null:null,'attributes':_0x511ed8[_0x5423('0x1f')]?_0x511ed8[_0x5423('0x1f')]['attributes']||null:null,'limit':_0x511ed8[_0x5423('0x1f')]?_0x511ed8['options'][_0x5423('0x22')]||null:null,'include':_0x511ed8[_0x5423('0x1f')]?_0x511ed8[_0x5423('0x1f')]['include']?_[_0x5423('0x23')](_0x511ed8[_0x5423('0x1f')][_0x5423('0x24')],function(_0x37aed6){return{'model':db[_0x37aed6[_0x5423('0x25')]],'as':_0x37aed6['as'],'attributes':_0x37aed6[_0x5423('0x26')],'include':_0x37aed6[_0x5423('0x24')]?_['map'](_0x37aed6[_0x5423('0x24')],function(_0x26a7f2){return{'model':db[_0x26a7f2[_0x5423('0x25')]],'as':_0x26a7f2['as'],'attributes':_0x26a7f2[_0x5423('0x26')],'include':_0x26a7f2[_0x5423('0x24')]?_['map'](_0x26a7f2[_0x5423('0x24')],function(_0x2fef48){return{'model':db[_0x2fef48[_0x5423('0x25')]],'as':_0x2fef48['as'],'attributes':_0x2fef48[_0x5423('0x26')]};}):[]};}):[]};}):[]:[]})[_0x5423('0x12')](function(_0xa79dca){logger[_0x5423('0x1b')]('GetOpenchannelQueue',_0x511ed8);logger[_0x5423('0x15')](_0x5423('0x1d'),_0x511ed8,JSON[_0x5423('0x17')](_0xa79dca));_0x15c174(_0xa79dca);})['catch'](function(_0x756ed1){logger[_0x5423('0x18')](_0x5423('0x1d'),_0x756ed1[_0x5423('0x1a')],_0x511ed8);_0x49cb41(_0x599c08[_0x5423('0x18')](0x1f4,_0x756ed1[_0x5423('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x484169){var _0x12578e=this;return new Promise(function(_0x95cafc,_0x30f120){return db['OpenchannelQueue'][_0x5423('0x27')]({'raw':_0x484169['options']?_0x484169[_0x5423('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x484169['options']?_0x484169[_0x5423('0x1f')][_0x5423('0x21')]||null:null,'attributes':_0x484169['options']?_0x484169[_0x5423('0x1f')]['attributes']||null:null,'include':_0x484169['options']?_0x484169[_0x5423('0x1f')][_0x5423('0x24')]?_['map'](_0x484169['options'][_0x5423('0x24')],function(_0x5b221b){return{'model':db[_0x5b221b[_0x5423('0x25')]],'as':_0x5b221b['as'],'attributes':_0x5b221b[_0x5423('0x26')],'include':_0x5b221b[_0x5423('0x24')]?_[_0x5423('0x23')](_0x5b221b[_0x5423('0x24')],function(_0x3b4487){return{'model':db[_0x3b4487[_0x5423('0x25')]],'as':_0x3b4487['as'],'attributes':_0x3b4487['attributes'],'include':_0x3b4487[_0x5423('0x24')]?_[_0x5423('0x23')](_0x3b4487['include'],function(_0x74142){return{'model':db[_0x74142[_0x5423('0x25')]],'as':_0x74142['as'],'attributes':_0x74142[_0x5423('0x26')]};}):[]};}):[]};}):[]:[]})[_0x5423('0x12')](function(_0x57bd1f){logger[_0x5423('0x1b')](_0x5423('0x28'),_0x484169);logger[_0x5423('0x15')](_0x5423('0x28'),_0x484169,JSON['stringify'](_0x57bd1f));_0x95cafc(_0x57bd1f);})[_0x5423('0x1c')](function(_0x10844f){logger['error'](_0x5423('0x28'),_0x10844f['message'],_0x484169);_0x30f120(_0x12578e[_0x5423('0x18')](0x1f4,_0x10844f['message']));});});}; \ No newline at end of file +var _0xd225=['ShowOpenchannelQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find'];(function(_0x4be650,_0x290115){var _0x4650d1=function(_0x3cd833){while(--_0x3cd833){_0x4be650['push'](_0x4be650['shift']());}};_0x4650d1(++_0x290115);}(_0xd225,0xfd));var _0x5d22=function(_0x19b2e5,_0x3b833b){_0x19b2e5=_0x19b2e5-0x0;var _0x27c139=_0xd225[_0x19b2e5];return _0x27c139;};'use strict';var _=require(_0x5d22('0x0'));var util=require(_0x5d22('0x1'));var moment=require(_0x5d22('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d22('0x3'));var fs=require('fs');var Redis=require(_0x5d22('0x4'));var db=require(_0x5d22('0x5'))['db'];var utils=require(_0x5d22('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d22('0x7'));var jayson=require(_0x5d22('0x8'));var client=jayson[_0x5d22('0x9')][_0x5d22('0xa')]({'port':0x232a});config['redis']=_[_0x5d22('0xb')](config[_0x5d22('0xc')],{'host':_0x5d22('0xd'),'port':0x18eb});var socket=require(_0x5d22('0xe'))(new Redis(config['redis']));require(_0x5d22('0xf'))[_0x5d22('0x10')](socket);function respondWithRpcPromise(_0x65d957,_0x4067ab,_0xd9edae){return new BPromise(function(_0x56b97c,_0x28d67c){return client[_0x5d22('0x11')](_0x65d957,_0xd9edae)[_0x5d22('0x12')](function(_0x4056d9){logger['info'](_0x5d22('0x13'),_0x4067ab,_0x5d22('0x14'));logger[_0x5d22('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4067ab,'request\x20sent',JSON['stringify'](_0x4056d9));if(_0x4056d9[_0x5d22('0x16')]){if(_0x4056d9['error'][_0x5d22('0x17')]===0x1f4){logger[_0x5d22('0x16')](_0x5d22('0x13'),_0x4067ab,_0x4056d9['error']['message']);return _0x28d67c(_0x4056d9[_0x5d22('0x16')]['message']);}logger['error'](_0x5d22('0x13'),_0x4067ab,_0x4056d9[_0x5d22('0x16')][_0x5d22('0x18')]);return _0x56b97c(_0x4056d9[_0x5d22('0x16')][_0x5d22('0x18')]);}else{logger[_0x5d22('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4067ab,_0x5d22('0x14'));_0x56b97c(_0x4056d9[_0x5d22('0x1a')][_0x5d22('0x18')]);}})[_0x5d22('0x1b')](function(_0x1c9202){logger[_0x5d22('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x4067ab,_0x1c9202);_0x28d67c(_0x1c9202);});});}exports[_0x5d22('0x1c')]=function(_0x10b8f5){var _0x4da4ec=this;return new Promise(function(_0x359f0b,_0x8f0b8c){return db[_0x5d22('0x1d')][_0x5d22('0x1e')]({'raw':_0x10b8f5[_0x5d22('0x1f')]?_0x10b8f5[_0x5d22('0x1f')][_0x5d22('0x20')]===undefined?!![]:![]:!![],'where':_0x10b8f5['options']?_0x10b8f5['options'][_0x5d22('0x21')]||null:null,'attributes':_0x10b8f5['options']?_0x10b8f5[_0x5d22('0x1f')][_0x5d22('0x22')]||null:null,'limit':_0x10b8f5['options']?_0x10b8f5[_0x5d22('0x1f')][_0x5d22('0x23')]||null:null,'include':_0x10b8f5[_0x5d22('0x1f')]?_0x10b8f5[_0x5d22('0x1f')]['include']?_['map'](_0x10b8f5[_0x5d22('0x1f')][_0x5d22('0x24')],function(_0x52e54c){return{'model':db[_0x52e54c['model']],'as':_0x52e54c['as'],'attributes':_0x52e54c[_0x5d22('0x22')],'include':_0x52e54c['include']?_[_0x5d22('0x25')](_0x52e54c['include'],function(_0x6eefaa){return{'model':db[_0x6eefaa[_0x5d22('0x26')]],'as':_0x6eefaa['as'],'attributes':_0x6eefaa[_0x5d22('0x22')],'include':_0x6eefaa[_0x5d22('0x24')]?_[_0x5d22('0x25')](_0x6eefaa[_0x5d22('0x24')],function(_0x2baf70){return{'model':db[_0x2baf70['model']],'as':_0x2baf70['as'],'attributes':_0x2baf70[_0x5d22('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5d22('0x12')](function(_0x2e0962){logger[_0x5d22('0x19')](_0x5d22('0x1c'),_0x10b8f5);logger[_0x5d22('0x15')](_0x5d22('0x1c'),_0x10b8f5,JSON[_0x5d22('0x27')](_0x2e0962));_0x359f0b(_0x2e0962);})[_0x5d22('0x1b')](function(_0x3e3a58){logger[_0x5d22('0x16')](_0x5d22('0x1c'),_0x3e3a58[_0x5d22('0x18')],_0x10b8f5);_0x8f0b8c(_0x4da4ec['error'](0x1f4,_0x3e3a58[_0x5d22('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0x30bdae){var _0x157330=this;return new Promise(function(_0x4a4fba,_0x568524){return db[_0x5d22('0x1d')][_0x5d22('0x28')]({'raw':_0x30bdae['options']?_0x30bdae[_0x5d22('0x1f')][_0x5d22('0x20')]===undefined?!![]:![]:!![],'where':_0x30bdae['options']?_0x30bdae[_0x5d22('0x1f')]['where']||null:null,'attributes':_0x30bdae[_0x5d22('0x1f')]?_0x30bdae['options'][_0x5d22('0x22')]||null:null,'include':_0x30bdae[_0x5d22('0x1f')]?_0x30bdae[_0x5d22('0x1f')][_0x5d22('0x24')]?_[_0x5d22('0x25')](_0x30bdae['options'][_0x5d22('0x24')],function(_0x3992ca){return{'model':db[_0x3992ca[_0x5d22('0x26')]],'as':_0x3992ca['as'],'attributes':_0x3992ca[_0x5d22('0x22')],'include':_0x3992ca[_0x5d22('0x24')]?_[_0x5d22('0x25')](_0x3992ca['include'],function(_0x5322e4){return{'model':db[_0x5322e4[_0x5d22('0x26')]],'as':_0x5322e4['as'],'attributes':_0x5322e4['attributes'],'include':_0x5322e4[_0x5d22('0x24')]?_[_0x5d22('0x25')](_0x5322e4[_0x5d22('0x24')],function(_0x5cc171){return{'model':db[_0x5cc171['model']],'as':_0x5cc171['as'],'attributes':_0x5cc171[_0x5d22('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5d22('0x12')](function(_0x14bba6){logger[_0x5d22('0x19')](_0x5d22('0x29'),_0x30bdae);logger['debug'](_0x5d22('0x29'),_0x30bdae,JSON[_0x5d22('0x27')](_0x14bba6));_0x4a4fba(_0x14bba6);})['catch'](function(_0x3ff981){logger[_0x5d22('0x16')](_0x5d22('0x29'),_0x3ff981[_0x5d22('0x18')],_0x30bdae);_0x568524(_0x157330[_0x5d22('0x16')](0x1f4,_0x3ff981['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 33a1d09..e41f626 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 _0x2532=['register','length','openchannelQueue:','./openchannelQueue.events','remove','update','removeListener'];(function(_0x87bbee,_0x1304a3){var _0x7e262f=function(_0x4a4096){while(--_0x4a4096){_0x87bbee['push'](_0x87bbee['shift']());}};_0x7e262f(++_0x1304a3);}(_0x2532,0xc7));var _0x2253=function(_0x317d5a,_0x54a251){_0x317d5a=_0x317d5a-0x0;var _0x49bdcf=_0x2532[_0x317d5a];return _0x49bdcf;};'use strict';var OpenchannelQueueEvents=require(_0x2253('0x0'));var events=['save',_0x2253('0x1'),_0x2253('0x2')];function createListener(_0x341968,_0x43dcd3){return function(_0x3793ec){_0x43dcd3['emit'](_0x341968,_0x3793ec);};}function removeListener(_0x103c5b,_0xa3626d){return function(){OpenchannelQueueEvents[_0x2253('0x3')](_0x103c5b,_0xa3626d);};}exports[_0x2253('0x4')]=function(_0x310062){for(var _0x4cbbf0=0x0,_0x221225=events[_0x2253('0x5')];_0x4cbbf0<_0x221225;_0x4cbbf0++){var _0x1533be=events[_0x4cbbf0];var _0x4f43ee=createListener(_0x2253('0x6')+_0x1533be,_0x310062);OpenchannelQueueEvents['on'](_0x1533be,_0x4f43ee);}}; \ No newline at end of file +var _0x1d52=['length','openchannelQueue:','remove','update','emit','removeListener','register'];(function(_0x14682d,_0x375996){var _0x5b2046=function(_0x3792bb){while(--_0x3792bb){_0x14682d['push'](_0x14682d['shift']());}};_0x5b2046(++_0x375996);}(_0x1d52,0x19f));var _0x21d5=function(_0x1c31ec,_0x2347dc){_0x1c31ec=_0x1c31ec-0x0;var _0x53d08c=_0x1d52[_0x1c31ec];return _0x53d08c;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x21d5('0x0'),_0x21d5('0x1')];function createListener(_0xa6a9ac,_0x5b8a46){return function(_0x5abed5){_0x5b8a46[_0x21d5('0x2')](_0xa6a9ac,_0x5abed5);};}function removeListener(_0x59b9b6,_0x438542){return function(){OpenchannelQueueEvents[_0x21d5('0x3')](_0x59b9b6,_0x438542);};}exports[_0x21d5('0x4')]=function(_0x4ce3b8){for(var _0x53bd18=0x0,_0x10cbb8=events[_0x21d5('0x5')];_0x53bd18<_0x10cbb8;_0x53bd18++){var _0x25db48=events[_0x53bd18];var _0x5d4aaf=createListener(_0x21d5('0x6')+_0x25db48,_0x4ce3b8);OpenchannelQueueEvents['on'](_0x25db48,_0x5d4aaf);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 49ccb11..41486f5 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 _0x1ec5=['/:id','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x10f1ae,_0x5a9262){var _0xbdd5db=function(_0x39e3cb){while(--_0x39e3cb){_0x10f1ae['push'](_0x10f1ae['shift']());}};_0xbdd5db(++_0x5a9262);}(_0x1ec5,0xc4));var _0x51ec=function(_0x275025,_0x43ea6b){_0x275025=_0x275025-0x0;var _0x713d25=_0x1ec5[_0x275025];return _0x713d25;};'use strict';var multer=require(_0x51ec('0x0'));var util=require(_0x51ec('0x1'));var path=require('path');var timeout=require(_0x51ec('0x2'));var express=require(_0x51ec('0x3'));var router=express[_0x51ec('0x4')]();var auth=require(_0x51ec('0x5'));var interaction=require(_0x51ec('0x6'));var config=require(_0x51ec('0x7'));var controller=require(_0x51ec('0x8'));router[_0x51ec('0x9')]('/',auth[_0x51ec('0xa')](),controller[_0x51ec('0xb')]);router[_0x51ec('0x9')](_0x51ec('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x51ec('0x9')](_0x51ec('0xd'),auth[_0x51ec('0xa')](),controller['show']);router[_0x51ec('0xe')]('/',auth[_0x51ec('0xa')](),controller['create']);router[_0x51ec('0xf')](_0x51ec('0xd'),auth[_0x51ec('0xa')](),controller['update']);router[_0x51ec('0x10')]('/:id',auth[_0x51ec('0xa')](),controller[_0x51ec('0x11')]);module[_0x51ec('0x12')]=router; \ No newline at end of file +var _0x3539=['get','index','/describe','describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3da1f1,_0x209d10){var _0x394a66=function(_0x21c897){while(--_0x21c897){_0x3da1f1['push'](_0x3da1f1['shift']());}};_0x394a66(++_0x209d10);}(_0x3539,0x92));var _0x9353=function(_0x59ca39,_0x20ad2e){_0x59ca39=_0x59ca39-0x0;var _0x504c64=_0x3539[_0x59ca39];return _0x504c64;};'use strict';var multer=require(_0x9353('0x0'));var util=require(_0x9353('0x1'));var path=require('path');var timeout=require(_0x9353('0x2'));var express=require(_0x9353('0x3'));var router=express[_0x9353('0x4')]();var auth=require(_0x9353('0x5'));var interaction=require(_0x9353('0x6'));var config=require(_0x9353('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x9353('0x8')]('/',auth['isAuthenticated'](),controller[_0x9353('0x9')]);router[_0x9353('0x8')](_0x9353('0xa'),auth['isAuthenticated'](),controller[_0x9353('0xb')]);router[_0x9353('0x8')]('/:id',auth[_0x9353('0xc')](),controller[_0x9353('0xd')]);router[_0x9353('0xe')]('/',auth['isAuthenticated'](),controller[_0x9353('0xf')]);router[_0x9353('0x10')](_0x9353('0x11'),auth[_0x9353('0xc')](),controller[_0x9353('0x12')]);router[_0x9353('0x13')](_0x9353('0x11'),auth[_0x9353('0xc')](),controller[_0x9353('0x14')]);module[_0x9353('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 8bb7aad..c53e93c 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 _0x0aa6=['exports','STRING','DATE','moment','sequelize'];(function(_0x1ee093,_0x55a008){var _0x2485b8=function(_0x516a90){while(--_0x516a90){_0x1ee093['push'](_0x1ee093['shift']());}};_0x2485b8(++_0x55a008);}(_0x0aa6,0x116));var _0x60aa=function(_0x3ca375,_0x3807c8){_0x3ca375=_0x3ca375-0x0;var _0x28cec3=_0x0aa6[_0x3ca375];return _0x28cec3;};'use strict';var moment=require(_0x60aa('0x0'));var Sequelize=require(_0x60aa('0x1'));module[_0x60aa('0x2')]={'uniqueid':{'type':Sequelize[_0x60aa('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x60aa('0x4')]},'leaveAt':{'type':Sequelize[_0x60aa('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x60aa('0x3')]}}; \ No newline at end of file +var _0x67da=['DATE','STRING'];(function(_0x59a096,_0x4a7af7){var _0x5dee72=function(_0x55fa57){while(--_0x55fa57){_0x59a096['push'](_0x59a096['shift']());}};_0x5dee72(++_0x4a7af7);}(_0x67da,0x109));var _0xa67d=function(_0x1edb37,_0x3af3bc){_0x1edb37=_0x1edb37-0x0;var _0x59139e=_0x67da[_0x1edb37];return _0x59139e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa67d('0x0')]},'joinAt':{'type':Sequelize[_0xa67d('0x1')]},'leaveAt':{'type':Sequelize[_0xa67d('0x1')]},'acceptAt':{'type':Sequelize[_0xa67d('0x1')]},'exitAt':{'type':Sequelize[_0xa67d('0x1')]},'reason':{'type':Sequelize[_0xa67d('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 07bd09a..1be884e 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 _0xd48e=['catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0xfaa8b7,_0x56d200){var _0x363662=function(_0x35042d){while(--_0x35042d){_0xfaa8b7['push'](_0xfaa8b7['shift']());}};_0x363662(++_0x56d200);}(_0xd48e,0x93));var _0xed48=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd48e[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xed48('0x0'));var rimraf=require(_0xed48('0x1'));var zipdir=require(_0xed48('0x2'));var jsonpatch=require(_0xed48('0x3'));var rp=require(_0xed48('0x4'));var moment=require('moment');var BPromise=require(_0xed48('0x5'));var Mustache=require(_0xed48('0x6'));var util=require(_0xed48('0x7'));var path=require('path');var sox=require(_0xed48('0x8'));var csv=require(_0xed48('0x9'));var ejs=require(_0xed48('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xed48('0xb'));var crypto=require(_0xed48('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed48('0xd'));var Papa=require(_0xed48('0xe'));var Redis=require(_0xed48('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed48('0x10'));var hardwareService=require(_0xed48('0x11'));var logger=require(_0xed48('0x12'))('api');var utils=require(_0xed48('0x13'));var config=require(_0xed48('0x14'));var db=require(_0xed48('0x15'))['db'];function respondWithStatusCode(_0x2e07f5,_0x7ee238){_0x7ee238=_0x7ee238||0xcc;return function(_0xaf4b6d){if(_0xaf4b6d){return _0x2e07f5[_0xed48('0x16')](_0x7ee238);}return _0x2e07f5[_0xed48('0x17')](_0x7ee238)[_0xed48('0x18')]();};}function respondWithResult(_0x2eea4d,_0x408ce8){_0x408ce8=_0x408ce8||0xc8;return function(_0x24e67c){if(_0x24e67c){return _0x2eea4d[_0xed48('0x17')](_0x408ce8)['json'](_0x24e67c);}};}function respondWithFilteredResult(_0x2ca898,_0x4a0296){return function(_0x3bf0b7){if(_0x3bf0b7){var _0x4d23d9=_0x3bf0b7[_0xed48('0x19')],_0x4d896f=_0x4a0296[_0xed48('0x1a')],_0x36cf4f=_0x4a0296[_0xed48('0x1a')]+_0x4a0296['limit'],_0x443f35;if(_0x36cf4f>=_0x4d23d9){_0x36cf4f=_0x4d23d9;_0x443f35=0xc8;}else{_0x443f35=0xce;}_0x2ca898[_0xed48('0x17')](_0x443f35);return _0x2ca898['set'](_0xed48('0x1b'),_0x4d896f+'-'+_0x36cf4f+'/'+_0x4d23d9)['json'](_0x3bf0b7);}return null;};}function patchUpdates(_0x302530){return function(_0x2e494c){try{jsonpatch[_0xed48('0x1c')](_0x2e494c,_0x302530,!![]);}catch(_0x55eebb){return BPromise['reject'](_0x55eebb);}return _0x2e494c[_0xed48('0x1d')]();};}function saveUpdates(_0x3e2044,_0x225d0f){return function(_0x54288f){if(_0x54288f){return _0x54288f[_0xed48('0x1e')](_0x3e2044)[_0xed48('0x1f')](function(_0x19d897){return _0x19d897;});}return null;};}function removeEntity(_0x483396,_0x277efb){return function(_0x1bda45){if(_0x1bda45){return _0x1bda45[_0xed48('0x20')]()[_0xed48('0x1f')](function(){_0x483396[_0xed48('0x17')](0xcc)[_0xed48('0x18')]();});}};}function handleEntityNotFound(_0x4a6d93,_0x2683e4){return function(_0x4b829b){if(!_0x4b829b){_0x4a6d93[_0xed48('0x16')](0x194);}return _0x4b829b;};}function handleError(_0x3d3acc,_0x14e642){_0x14e642=_0x14e642||0x1f4;return function(_0x585709){logger['error'](_0x585709[_0xed48('0x21')]);if(_0x585709[_0xed48('0x22')]){delete _0x585709[_0xed48('0x22')];}_0x3d3acc[_0xed48('0x17')](_0x14e642)[_0xed48('0x23')](_0x585709);};}exports[_0xed48('0x24')]=function(_0x37ef54,_0x5a83bf){var _0x289060={},_0x3ce573={},_0x2d4ee2={'count':0x0,'rows':[]};var _0x5db1f3=_[_0xed48('0x25')](db[_0xed48('0x26')]['rawAttributes'],function(_0x2baff3){return{'name':_0x2baff3['fieldName'],'type':_0x2baff3['type'][_0xed48('0x27')]};});_0x3ce573['model']=_['map'](_0x5db1f3,_0xed48('0x22'));_0x3ce573[_0xed48('0x28')]=_[_0xed48('0x29')](_0x37ef54['query']);_0x3ce573[_0xed48('0x2a')]=_[_0xed48('0x2b')](_0x3ce573[_0xed48('0x2c')],_0x3ce573[_0xed48('0x28')]);_0x289060['attributes']=_['intersection'](_0x3ce573[_0xed48('0x2c')],qs['fields'](_0x37ef54[_0xed48('0x28')][_0xed48('0x2d')]));_0x289060[_0xed48('0x2e')]=_0x289060[_0xed48('0x2e')]['length']?_0x289060['attributes']:_0x3ce573[_0xed48('0x2c')];if(!_0x37ef54[_0xed48('0x28')][_0xed48('0x2f')](_0xed48('0x30'))){_0x289060[_0xed48('0x31')]=qs[_0xed48('0x31')](_0x37ef54[_0xed48('0x28')][_0xed48('0x31')]);_0x289060[_0xed48('0x1a')]=qs[_0xed48('0x1a')](_0x37ef54[_0xed48('0x28')][_0xed48('0x1a')]);}_0x289060['order']=qs[_0xed48('0x32')](_0x37ef54[_0xed48('0x28')][_0xed48('0x32')]);_0x289060[_0xed48('0x33')]=qs[_0xed48('0x2a')](_[_0xed48('0x34')](_0x37ef54[_0xed48('0x28')],_0x3ce573[_0xed48('0x2a')]),_0x5db1f3);if(_0x37ef54[_0xed48('0x28')][_0xed48('0x35')]){_0x289060['where']=_[_0xed48('0x36')](_0x289060[_0xed48('0x33')],{'$or':_[_0xed48('0x25')](_0x5db1f3,function(_0xa59e7c){if(_0xa59e7c['type']!==_0xed48('0x37')){var _0x22d20d={};_0x22d20d[_0xa59e7c['name']]={'$like':'%'+_0x37ef54[_0xed48('0x28')][_0xed48('0x35')]+'%'};return _0x22d20d;}})});}_0x289060=_[_0xed48('0x36')]({},_0x289060,_0x37ef54['options']);var _0x4b3aeb={'where':_0x289060[_0xed48('0x33')]};return db['OpenchannelQueueReport'][_0xed48('0x19')](_0x4b3aeb)[_0xed48('0x1f')](function(_0x360f55){_0x2d4ee2[_0xed48('0x19')]=_0x360f55;if(_0x37ef54[_0xed48('0x28')][_0xed48('0x38')]){_0x289060[_0xed48('0x39')]=[{'all':!![]}];}return db[_0xed48('0x26')][_0xed48('0x3a')](_0x289060);})['then'](function(_0x34bacd){_0x2d4ee2[_0xed48('0x3b')]=_0x34bacd;return _0x2d4ee2;})[_0xed48('0x1f')](respondWithFilteredResult(_0x5a83bf,_0x289060))[_0xed48('0x3c')](handleError(_0x5a83bf,null));};exports[_0xed48('0x3d')]=function(_0x5b75b7,_0x35042d){var _0x1af81d={'raw':!![],'where':{'id':_0x5b75b7[_0xed48('0x3e')]['id']}},_0x2f8712={};_0x2f8712[_0xed48('0x2c')]=_[_0xed48('0x29')](db[_0xed48('0x26')][_0xed48('0x3f')]);_0x2f8712[_0xed48('0x28')]=_[_0xed48('0x29')](_0x5b75b7[_0xed48('0x28')]);_0x2f8712[_0xed48('0x2a')]=_[_0xed48('0x2b')](_0x2f8712[_0xed48('0x2c')],_0x2f8712[_0xed48('0x28')]);_0x1af81d[_0xed48('0x2e')]=_[_0xed48('0x2b')](_0x2f8712[_0xed48('0x2c')],qs['fields'](_0x5b75b7[_0xed48('0x28')][_0xed48('0x2d')]));_0x1af81d[_0xed48('0x2e')]=_0x1af81d[_0xed48('0x2e')][_0xed48('0x40')]?_0x1af81d[_0xed48('0x2e')]:_0x2f8712['model'];if(_0x5b75b7[_0xed48('0x28')]['includeAll']){_0x1af81d[_0xed48('0x39')]=[{'all':!![]}];}_0x1af81d=_[_0xed48('0x36')]({},_0x1af81d,_0x5b75b7['options']);return db['OpenchannelQueueReport'][_0xed48('0x41')](_0x1af81d)['then'](handleEntityNotFound(_0x35042d,null))[_0xed48('0x1f')](respondWithResult(_0x35042d,null))['catch'](handleError(_0x35042d,null));};exports['create']=function(_0x58876a,_0x2565e5){return db[_0xed48('0x26')][_0xed48('0x42')](_0x58876a[_0xed48('0x43')],{})[_0xed48('0x1f')](respondWithResult(_0x2565e5,0xc9))[_0xed48('0x3c')](handleError(_0x2565e5,null));};exports['update']=function(_0x51d9d6,_0x1369c9){if(_0x51d9d6[_0xed48('0x43')]['id']){delete _0x51d9d6[_0xed48('0x43')]['id'];}return db[_0xed48('0x26')][_0xed48('0x41')]({'where':{'id':_0x51d9d6[_0xed48('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1369c9,null))[_0xed48('0x1f')](saveUpdates(_0x51d9d6['body'],null))['then'](respondWithResult(_0x1369c9,null))['catch'](handleError(_0x1369c9,null));};exports[_0xed48('0x20')]=function(_0x1be83e,_0x198213){return db[_0xed48('0x26')][_0xed48('0x41')]({'where':{'id':_0x1be83e[_0xed48('0x3e')]['id']}})[_0xed48('0x1f')](handleEntityNotFound(_0x198213,null))[_0xed48('0x1f')](removeEntity(_0x198213,null))[_0xed48('0x3c')](handleError(_0x198213,null));};exports[_0xed48('0x44')]=function(_0x2760ac,_0x20f92c){return db['OpenchannelQueueReport'][_0xed48('0x44')]()[_0xed48('0x1f')](respondWithResult(_0x20f92c,null))[_0xed48('0x3c')](handleError(_0x20f92c,null));}; \ No newline at end of file +var _0xa017=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','keys','rawAttributes','length','catch','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xa017,0x1f1));var _0x7a01=function(_0x1554e2,_0x4efeec){_0x1554e2=_0x1554e2-0x0;var _0x51aa70=_0xa017[_0x1554e2];return _0x51aa70;};'use strict';var pdf=require(_0x7a01('0x0'));var emlformat=require(_0x7a01('0x1'));var rimraf=require(_0x7a01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7a01('0x3'));var moment=require(_0x7a01('0x4'));var BPromise=require(_0x7a01('0x5'));var Mustache=require(_0x7a01('0x6'));var util=require(_0x7a01('0x7'));var path=require(_0x7a01('0x8'));var sox=require(_0x7a01('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a01('0xa'));var squel=require(_0x7a01('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a01('0xc'));var querystring=require('querystring');var Papa=require(_0x7a01('0xd'));var Redis=require(_0x7a01('0xe'));var authService=require(_0x7a01('0xf'));var qs=require(_0x7a01('0x10'));var as=require(_0x7a01('0x11'));var hardwareService=require(_0x7a01('0x12'));var logger=require(_0x7a01('0x13'))('api');var utils=require(_0x7a01('0x14'));var config=require('../../config/environment');var db=require(_0x7a01('0x15'))['db'];function respondWithStatusCode(_0x3821cd,_0x1fd634){_0x1fd634=_0x1fd634||0xcc;return function(_0x4e7728){if(_0x4e7728){return _0x3821cd[_0x7a01('0x16')](_0x1fd634);}return _0x3821cd[_0x7a01('0x17')](_0x1fd634)[_0x7a01('0x18')]();};}function respondWithResult(_0x505d46,_0x2781d6){_0x2781d6=_0x2781d6||0xc8;return function(_0xb68cd6){if(_0xb68cd6){return _0x505d46[_0x7a01('0x17')](_0x2781d6)[_0x7a01('0x19')](_0xb68cd6);}};}function respondWithFilteredResult(_0x460ce1,_0x177375){return function(_0x4416ab){if(_0x4416ab){var _0x26c0b2=_0x4416ab[_0x7a01('0x1a')],_0x558d65=_0x177375['offset'],_0x544248=_0x177375[_0x7a01('0x1b')]+_0x177375[_0x7a01('0x1c')],_0x5089df;if(_0x544248>=_0x26c0b2){_0x544248=_0x26c0b2;_0x5089df=0xc8;}else{_0x5089df=0xce;}_0x460ce1[_0x7a01('0x17')](_0x5089df);return _0x460ce1['set'](_0x7a01('0x1d'),_0x558d65+'-'+_0x544248+'/'+_0x26c0b2)[_0x7a01('0x19')](_0x4416ab);}return null;};}function patchUpdates(_0x1f013c){return function(_0x51cec3){try{jsonpatch[_0x7a01('0x1e')](_0x51cec3,_0x1f013c,!![]);}catch(_0x43ce2e){return BPromise[_0x7a01('0x1f')](_0x43ce2e);}return _0x51cec3[_0x7a01('0x20')]();};}function saveUpdates(_0x16238f,_0xba4c92){return function(_0x21571f){if(_0x21571f){return _0x21571f[_0x7a01('0x21')](_0x16238f)[_0x7a01('0x22')](function(_0x1fb08a){return _0x1fb08a;});}return null;};}function removeEntity(_0x9d2609,_0x2f1177){return function(_0x404cc1){if(_0x404cc1){return _0x404cc1[_0x7a01('0x23')]()[_0x7a01('0x22')](function(){_0x9d2609[_0x7a01('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2005bf,_0x5f04bd){return function(_0xb60cb2){if(!_0xb60cb2){_0x2005bf[_0x7a01('0x16')](0x194);}return _0xb60cb2;};}function handleError(_0x391526,_0x436087){_0x436087=_0x436087||0x1f4;return function(_0x5732f8){logger[_0x7a01('0x24')](_0x5732f8[_0x7a01('0x25')]);if(_0x5732f8[_0x7a01('0x26')]){delete _0x5732f8[_0x7a01('0x26')];}_0x391526[_0x7a01('0x17')](_0x436087)[_0x7a01('0x27')](_0x5732f8);};}exports[_0x7a01('0x28')]=function(_0x10d857,_0x2f519f){var _0x5cfb78={},_0x4d5374={},_0xb90835={'count':0x0,'rows':[]};var _0x27f09b=_[_0x7a01('0x29')](db[_0x7a01('0x2a')]['rawAttributes'],function(_0xb219a3){return{'name':_0xb219a3[_0x7a01('0x2b')],'type':_0xb219a3[_0x7a01('0x2c')][_0x7a01('0x2d')]};});_0x4d5374[_0x7a01('0x2e')]=_[_0x7a01('0x29')](_0x27f09b,'name');_0x4d5374[_0x7a01('0x2f')]=_['keys'](_0x10d857[_0x7a01('0x2f')]);_0x4d5374['filters']=_[_0x7a01('0x30')](_0x4d5374['model'],_0x4d5374[_0x7a01('0x2f')]);_0x5cfb78['attributes']=_[_0x7a01('0x30')](_0x4d5374['model'],qs['fields'](_0x10d857[_0x7a01('0x2f')][_0x7a01('0x31')]));_0x5cfb78[_0x7a01('0x32')]=_0x5cfb78[_0x7a01('0x32')]['length']?_0x5cfb78[_0x7a01('0x32')]:_0x4d5374[_0x7a01('0x2e')];if(!_0x10d857[_0x7a01('0x2f')][_0x7a01('0x33')](_0x7a01('0x34'))){_0x5cfb78[_0x7a01('0x1c')]=qs[_0x7a01('0x1c')](_0x10d857[_0x7a01('0x2f')][_0x7a01('0x1c')]);_0x5cfb78[_0x7a01('0x1b')]=qs[_0x7a01('0x1b')](_0x10d857[_0x7a01('0x2f')]['offset']);}_0x5cfb78[_0x7a01('0x35')]=qs[_0x7a01('0x36')](_0x10d857[_0x7a01('0x2f')][_0x7a01('0x36')]);_0x5cfb78[_0x7a01('0x37')]=qs['filters'](_[_0x7a01('0x38')](_0x10d857[_0x7a01('0x2f')],_0x4d5374[_0x7a01('0x39')]),_0x27f09b);if(_0x10d857[_0x7a01('0x2f')][_0x7a01('0x3a')]){_0x5cfb78[_0x7a01('0x37')]=_[_0x7a01('0x3b')](_0x5cfb78[_0x7a01('0x37')],{'$or':_['map'](_0x27f09b,function(_0x3afbbe){if(_0x3afbbe['type']!==_0x7a01('0x3c')){var _0x308ca4={};_0x308ca4[_0x3afbbe['name']]={'$like':'%'+_0x10d857[_0x7a01('0x2f')][_0x7a01('0x3a')]+'%'};return _0x308ca4;}})});}_0x5cfb78=_['merge']({},_0x5cfb78,_0x10d857[_0x7a01('0x3d')]);var _0x46b9ef={'where':_0x5cfb78[_0x7a01('0x37')]};return db[_0x7a01('0x2a')][_0x7a01('0x1a')](_0x46b9ef)[_0x7a01('0x22')](function(_0x109f9e){_0xb90835['count']=_0x109f9e;if(_0x10d857[_0x7a01('0x2f')][_0x7a01('0x3e')]){_0x5cfb78[_0x7a01('0x3f')]=[{'all':!![]}];}return db[_0x7a01('0x2a')][_0x7a01('0x40')](_0x5cfb78);})[_0x7a01('0x22')](function(_0x535df9){_0xb90835[_0x7a01('0x41')]=_0x535df9;return _0xb90835;})[_0x7a01('0x22')](respondWithFilteredResult(_0x2f519f,_0x5cfb78))['catch'](handleError(_0x2f519f,null));};exports['show']=function(_0x52cf9a,_0x1aedd5){var _0x9a0e85={'raw':!![],'where':{'id':_0x52cf9a['params']['id']}},_0x54001e={};_0x54001e[_0x7a01('0x2e')]=_[_0x7a01('0x42')](db['OpenchannelQueueReport'][_0x7a01('0x43')]);_0x54001e[_0x7a01('0x2f')]=_[_0x7a01('0x42')](_0x52cf9a[_0x7a01('0x2f')]);_0x54001e[_0x7a01('0x39')]=_[_0x7a01('0x30')](_0x54001e[_0x7a01('0x2e')],_0x54001e[_0x7a01('0x2f')]);_0x9a0e85[_0x7a01('0x32')]=_[_0x7a01('0x30')](_0x54001e[_0x7a01('0x2e')],qs[_0x7a01('0x31')](_0x52cf9a[_0x7a01('0x2f')][_0x7a01('0x31')]));_0x9a0e85[_0x7a01('0x32')]=_0x9a0e85['attributes'][_0x7a01('0x44')]?_0x9a0e85['attributes']:_0x54001e[_0x7a01('0x2e')];if(_0x52cf9a[_0x7a01('0x2f')][_0x7a01('0x3e')]){_0x9a0e85[_0x7a01('0x3f')]=[{'all':!![]}];}_0x9a0e85=_[_0x7a01('0x3b')]({},_0x9a0e85,_0x52cf9a[_0x7a01('0x3d')]);return db['OpenchannelQueueReport']['find'](_0x9a0e85)[_0x7a01('0x22')](handleEntityNotFound(_0x1aedd5,null))[_0x7a01('0x22')](respondWithResult(_0x1aedd5,null))[_0x7a01('0x45')](handleError(_0x1aedd5,null));};exports['create']=function(_0x539872,_0x358acb){return db[_0x7a01('0x2a')][_0x7a01('0x46')](_0x539872[_0x7a01('0x47')],{})[_0x7a01('0x22')](respondWithResult(_0x358acb,0xc9))['catch'](handleError(_0x358acb,null));};exports[_0x7a01('0x21')]=function(_0x537baa,_0x454abf){if(_0x537baa[_0x7a01('0x47')]['id']){delete _0x537baa[_0x7a01('0x47')]['id'];}return db[_0x7a01('0x2a')]['find']({'where':{'id':_0x537baa[_0x7a01('0x48')]['id']}})[_0x7a01('0x22')](handleEntityNotFound(_0x454abf,null))[_0x7a01('0x22')](saveUpdates(_0x537baa[_0x7a01('0x47')],null))[_0x7a01('0x22')](respondWithResult(_0x454abf,null))[_0x7a01('0x45')](handleError(_0x454abf,null));};exports['destroy']=function(_0x55ec87,_0x5ab710){return db[_0x7a01('0x2a')]['find']({'where':{'id':_0x55ec87[_0x7a01('0x48')]['id']}})[_0x7a01('0x22')](handleEntityNotFound(_0x5ab710,null))[_0x7a01('0x22')](removeEntity(_0x5ab710,null))[_0x7a01('0x45')](handleError(_0x5ab710,null));};exports[_0x7a01('0x49')]=function(_0x4d28e2,_0x7d427b){return db[_0x7a01('0x2a')][_0x7a01('0x49')]()['then'](respondWithResult(_0x7d427b,null))[_0x7a01('0x45')](handleError(_0x7d427b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4a80c83..e22ac50 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 _0xa562=['path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x308e66,_0x3f4d6b){var _0x1f70f9=function(_0x55fb51){while(--_0x55fb51){_0x308e66['push'](_0x308e66['shift']());}};_0x1f70f9(++_0x3f4d6b);}(_0xa562,0x1a9));var _0x2a56=function(_0x5c956b,_0xa87d11){_0x5c956b=_0x5c956b-0x0;var _0xaff46a=_0xa562[_0x5c956b];return _0xaff46a;};'use strict';var _=require(_0x2a56('0x0'));var util=require(_0x2a56('0x1'));var logger=require(_0x2a56('0x2'))(_0x2a56('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a56('0x4'));var rimraf=require(_0x2a56('0x5'));var config=require(_0x2a56('0x6'));var attributes=require(_0x2a56('0x7'));module['exports']=function(_0x319ef1,_0x5cd3f2){return _0x319ef1[_0x2a56('0x8')]('OpenchannelQueueReport',attributes,{'tableName':_0x2a56('0x9'),'paranoid':![],'indexes':[{'name':_0x2a56('0xa'),'fields':[_0x2a56('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4aa8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_openchannel_queue','uniqueid','../../config/logger'];(function(_0x44776c,_0xf68c35){var _0x590696=function(_0x45ac2b){while(--_0x45ac2b){_0x44776c['push'](_0x44776c['shift']());}};_0x590696(++_0xf68c35);}(_0x4aa8,0x1d3));var _0x84aa=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x4aa8[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x84aa('0x0'))(_0x84aa('0x1'));var moment=require(_0x84aa('0x2'));var BPromise=require(_0x84aa('0x3'));var rp=require(_0x84aa('0x4'));var fs=require('fs');var path=require(_0x84aa('0x5'));var rimraf=require(_0x84aa('0x6'));var config=require(_0x84aa('0x7'));var attributes=require('./openchannelQueueReport.attributes');module[_0x84aa('0x8')]=function(_0x296c02,_0x1fe909){return _0x296c02[_0x84aa('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0x84aa('0xa'),'paranoid':![],'indexes':[{'name':_0x84aa('0xb'),'fields':[_0x84aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index e81aab6..55e4485 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 _0x0137=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0137,0x1d8));var _0x7013=function(_0x23b85e,_0x39b209){_0x23b85e=_0x23b85e-0x0;var _0x329756=_0x0137[_0x23b85e];return _0x329756;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var moment=require(_0x7013('0x2'));var BPromise=require(_0x7013('0x3'));var rs=require(_0x7013('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7013('0x5'))['db'];var utils=require(_0x7013('0x6'));var logger=require(_0x7013('0x7'))(_0x7013('0x8'));var config=require(_0x7013('0x9'));var jayson=require(_0x7013('0xa'));var client=jayson['client'][_0x7013('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x346a4d,_0x4e2460,_0x16c0c8){return new BPromise(function(_0x16dae3,_0x1b748c){return client['request'](_0x346a4d,_0x16c0c8)[_0x7013('0xc')](function(_0x551b8a){logger[_0x7013('0xd')](_0x7013('0xe'),_0x4e2460,'request\x20sent');logger[_0x7013('0xf')](_0x7013('0x10'),_0x4e2460,_0x7013('0x11'),JSON[_0x7013('0x12')](_0x551b8a));if(_0x551b8a[_0x7013('0x13')]){if(_0x551b8a[_0x7013('0x13')]['code']===0x1f4){logger[_0x7013('0x13')](_0x7013('0xe'),_0x4e2460,_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);return _0x1b748c(_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);}logger[_0x7013('0x13')](_0x7013('0xe'),_0x4e2460,_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);return _0x16dae3(_0x551b8a[_0x7013('0x13')]['message']);}else{logger['info'](_0x7013('0xe'),_0x4e2460,_0x7013('0x11'));_0x16dae3(_0x551b8a[_0x7013('0x15')][_0x7013('0x14')]);}})[_0x7013('0x16')](function(_0x48614e){logger['error'](_0x7013('0xe'),_0x4e2460,_0x48614e);_0x1b748c(_0x48614e);});});}exports[_0x7013('0x17')]=function(_0x161a19){var _0x1b68b0=this;return new Promise(function(_0x363cbc,_0x4eee5e){return db[_0x7013('0x18')][_0x7013('0x19')](_0x161a19['body'],{'raw':_0x161a19['options']?_0x161a19[_0x7013('0x1a')][_0x7013('0x1b')]===undefined?!![]:![]:!![]})[_0x7013('0xc')](function(_0x5cf9c9){logger[_0x7013('0xd')]('CreateOpenchannelQueueReport',_0x161a19);logger[_0x7013('0xf')](_0x7013('0x17'),_0x161a19,JSON[_0x7013('0x12')](_0x5cf9c9));_0x363cbc(_0x5cf9c9);})[_0x7013('0x16')](function(_0x3bb319){logger[_0x7013('0x13')](_0x7013('0x17'),_0x3bb319[_0x7013('0x14')],_0x161a19);_0x4eee5e(_0x1b68b0[_0x7013('0x13')](0x1f4,_0x3bb319[_0x7013('0x14')]));});});};exports[_0x7013('0x1c')]=function(_0x99f13d){var _0x34811e=this;return new Promise(function(_0x18a137,_0x35653e){return db[_0x7013('0x18')][_0x7013('0x1d')](_0x99f13d[_0x7013('0x1e')],{'raw':_0x99f13d[_0x7013('0x1a')]?_0x99f13d[_0x7013('0x1a')][_0x7013('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x99f13d['options']?_0x99f13d[_0x7013('0x1a')][_0x7013('0x1f')]||null:null,'attributes':_0x99f13d[_0x7013('0x1a')]?_0x99f13d['options'][_0x7013('0x20')]||null:null,'limit':_0x99f13d['options']?_0x99f13d[_0x7013('0x1a')][_0x7013('0x21')]||null:null})['then'](function(_0x1511c0){logger['info'](_0x7013('0x1c'),_0x99f13d);logger[_0x7013('0xf')](_0x7013('0x1c'),_0x99f13d,JSON['stringify'](_0x1511c0));_0x18a137(_0x1511c0);})[_0x7013('0x16')](function(_0x182958){logger[_0x7013('0x13')](_0x7013('0x1c'),_0x182958['message'],_0x99f13d);_0x35653e(_0x34811e[_0x7013('0x13')](0x1f4,_0x182958[_0x7013('0x14')]));});});}; \ No newline at end of file +var _0xef66=['request\x20sent','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x51e067,_0x4cdb85){var _0x2b82c=function(_0x52d57f){while(--_0x52d57f){_0x51e067['push'](_0x51e067['shift']());}};_0x2b82c(++_0x4cdb85);}(_0xef66,0x1db));var _0x6ef6=function(_0x181514,_0x207e6c){_0x181514=_0x181514-0x0;var _0x1f8866=_0xef66[_0x181514];return _0x1f8866;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ef6('0x5'));var logger=require(_0x6ef6('0x6'))(_0x6ef6('0x7'));var config=require(_0x6ef6('0x8'));var jayson=require(_0x6ef6('0x9'));var client=jayson[_0x6ef6('0xa')][_0x6ef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830aa,_0x3755b5,_0x4f06b9){return new BPromise(function(_0x5a7c74,_0xc0d555){return client[_0x6ef6('0xc')](_0x1830aa,_0x4f06b9)[_0x6ef6('0xd')](function(_0x391e0e){logger[_0x6ef6('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'),JSON['stringify'](_0x391e0e));if(_0x391e0e[_0x6ef6('0x10')]){if(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x11')]===0x1f4){logger[_0x6ef6('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3755b5,_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0xc0d555(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);}logger['error'](_0x6ef6('0x13'),_0x3755b5,_0x391e0e['error'][_0x6ef6('0x12')]);return _0x5a7c74(_0x391e0e[_0x6ef6('0x10')]['message']);}else{logger[_0x6ef6('0xe')](_0x6ef6('0x13'),_0x3755b5,_0x6ef6('0xf'));_0x5a7c74(_0x391e0e[_0x6ef6('0x14')][_0x6ef6('0x12')]);}})[_0x6ef6('0x15')](function(_0x4ea222){logger[_0x6ef6('0x10')](_0x6ef6('0x13'),_0x3755b5,_0x4ea222);_0xc0d555(_0x4ea222);});});}exports[_0x6ef6('0x16')]=function(_0x53586d){var _0x3fc3d1=this;return new Promise(function(_0x2510be,_0x292af9){return db[_0x6ef6('0x17')][_0x6ef6('0x18')](_0x53586d[_0x6ef6('0x19')],{'raw':_0x53586d[_0x6ef6('0x1a')]?_0x53586d['options'][_0x6ef6('0x1b')]===undefined?!![]:![]:!![]})[_0x6ef6('0xd')](function(_0x2903ea){logger[_0x6ef6('0xe')]('CreateOpenchannelQueueReport',_0x53586d);logger[_0x6ef6('0x1c')](_0x6ef6('0x16'),_0x53586d,JSON[_0x6ef6('0x1d')](_0x2903ea));_0x2510be(_0x2903ea);})['catch'](function(_0x4257d8){logger[_0x6ef6('0x10')]('CreateOpenchannelQueueReport',_0x4257d8[_0x6ef6('0x12')],_0x53586d);_0x292af9(_0x3fc3d1[_0x6ef6('0x10')](0x1f4,_0x4257d8['message']));});});};exports[_0x6ef6('0x1e')]=function(_0xb1c6b0){var _0x2072a1=this;return new Promise(function(_0x414def,_0x43bb8d){return db[_0x6ef6('0x17')][_0x6ef6('0x1f')](_0xb1c6b0['body'],{'raw':_0xb1c6b0[_0x6ef6('0x1a')]?_0xb1c6b0['options'][_0x6ef6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb1c6b0[_0x6ef6('0x1a')]?_0xb1c6b0[_0x6ef6('0x1a')][_0x6ef6('0x20')]||null:null,'attributes':_0xb1c6b0[_0x6ef6('0x1a')]?_0xb1c6b0[_0x6ef6('0x1a')][_0x6ef6('0x21')]||null:null,'limit':_0xb1c6b0[_0x6ef6('0x1a')]?_0xb1c6b0[_0x6ef6('0x1a')][_0x6ef6('0x22')]||null:null})[_0x6ef6('0xd')](function(_0x2d87a8){logger[_0x6ef6('0xe')](_0x6ef6('0x1e'),_0xb1c6b0);logger[_0x6ef6('0x1c')](_0x6ef6('0x1e'),_0xb1c6b0,JSON[_0x6ef6('0x1d')](_0x2d87a8));_0x414def(_0x2d87a8);})[_0x6ef6('0x15')](function(_0x24eeae){logger[_0x6ef6('0x10')]('UpdateOpenchannelQueueReport',_0x24eeae[_0x6ef6('0x12')],_0xb1c6b0);_0x43bb8d(_0x2072a1['error'](0x1f4,_0x24eeae[_0x6ef6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 851ca68..e4bc659 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(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 3a1114d..193f8dc 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 _0x4e75=['queue','DATE','NOW','moment','ENUM'];(function(_0x72e965,_0x47af03){var _0x478929=function(_0x3cecdf){while(--_0x3cecdf){_0x72e965['push'](_0x72e965['shift']());}};_0x478929(++_0x47af03);}(_0x4e75,0xc6));var _0x54e7=function(_0x596549,_0x590c40){_0x596549=_0x596549-0x0;var _0x3f6209=_0x4e75[_0x596549];return _0x3f6209;};'use strict';var moment=require(_0x54e7('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x54e7('0x1')]('account','agent',_0x54e7('0x2')),'allowNull':![],'defaultValue':_0x54e7('0x2')},'transferredAt':{'type':Sequelize[_0x54e7('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x54e7('0x4')]}}; \ No newline at end of file +var _0xbc9f=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc9f,0x198));var _0xfbc9=function(_0x57f100,_0xa53aca){_0x57f100=_0x57f100-0x0;var _0x4cac01=_0xbc9f[_0x57f100];return _0x4cac01;};'use strict';var moment=require(_0xfbc9('0x0'));var Sequelize=require(_0xfbc9('0x1'));module[_0xfbc9('0x2')]={'uniqueid':{'type':Sequelize[_0xfbc9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xfbc9('0x4')](_0xfbc9('0x5'),_0xfbc9('0x6'),'queue'),'allowNull':![],'defaultValue':_0xfbc9('0x7')},'transferredAt':{'type':Sequelize[_0xfbc9('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xfbc9('0x9')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 43519af..5932322 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 _0x5160=['pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','model','keys','filters','intersection','attributes','fields','length','query','nolimit','limit','order','sort','where'];(function(_0x28b591,_0x587f9e){var _0x46700c=function(_0x3b28f6){while(--_0x3b28f6){_0x28b591['push'](_0x28b591['shift']());}};_0x46700c(++_0x587f9e);}(_0x5160,0x1cc));var _0x0516=function(_0x3db3d8,_0x4fae40){_0x3db3d8=_0x3db3d8-0x0;var _0x41f827=_0x5160[_0x3db3d8];return _0x41f827;};'use strict';var pdf=require(_0x0516('0x0'));var emlformat=require(_0x0516('0x1'));var rimraf=require(_0x0516('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0516('0x3'));var rp=require(_0x0516('0x4'));var moment=require(_0x0516('0x5'));var BPromise=require(_0x0516('0x6'));var Mustache=require(_0x0516('0x7'));var util=require(_0x0516('0x8'));var path=require(_0x0516('0x9'));var sox=require('sox');var csv=require(_0x0516('0xa'));var ejs=require(_0x0516('0xb'));var fs=require('fs');var _=require(_0x0516('0xc'));var squel=require(_0x0516('0xd'));var crypto=require(_0x0516('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0516('0xf'));var toCsv=require(_0x0516('0xa'));var querystring=require(_0x0516('0x10'));var Papa=require(_0x0516('0x11'));var Redis=require(_0x0516('0x12'));var authService=require(_0x0516('0x13'));var qs=require(_0x0516('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0516('0x15'));var logger=require(_0x0516('0x16'))('api');var utils=require(_0x0516('0x17'));var config=require(_0x0516('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a2bba,_0x34e692){_0x34e692=_0x34e692||0xcc;return function(_0x4e8b5d){if(_0x4e8b5d){return _0x2a2bba[_0x0516('0x19')](_0x34e692);}return _0x2a2bba[_0x0516('0x1a')](_0x34e692)[_0x0516('0x1b')]();};}function respondWithResult(_0x2876b4,_0x475076){_0x475076=_0x475076||0xc8;return function(_0x41849e){if(_0x41849e){return _0x2876b4[_0x0516('0x1a')](_0x475076)[_0x0516('0x1c')](_0x41849e);}};}function respondWithFilteredResult(_0x3af260,_0x3f08dd){return function(_0x52f5f0){if(_0x52f5f0){var _0x51f0d1=_0x52f5f0[_0x0516('0x1d')],_0x41e1d1=_0x3f08dd[_0x0516('0x1e')],_0x3f2364=_0x3f08dd[_0x0516('0x1e')]+_0x3f08dd['limit'],_0x473cca;if(_0x3f2364>=_0x51f0d1){_0x3f2364=_0x51f0d1;_0x473cca=0xc8;}else{_0x473cca=0xce;}_0x3af260[_0x0516('0x1a')](_0x473cca);return _0x3af260['set'](_0x0516('0x1f'),_0x41e1d1+'-'+_0x3f2364+'/'+_0x51f0d1)['json'](_0x52f5f0);}return null;};}function patchUpdates(_0x1e39e4){return function(_0x5b32f0){try{jsonpatch[_0x0516('0x20')](_0x5b32f0,_0x1e39e4,!![]);}catch(_0x25ef7b){return BPromise[_0x0516('0x21')](_0x25ef7b);}return _0x5b32f0[_0x0516('0x22')]();};}function saveUpdates(_0x4f8de1,_0x7ebb9a){return function(_0x24af59){if(_0x24af59){return _0x24af59[_0x0516('0x23')](_0x4f8de1)['then'](function(_0x81029c){return _0x81029c;});}return null;};}function removeEntity(_0x213348,_0x488c0f){return function(_0x4c0851){if(_0x4c0851){return _0x4c0851[_0x0516('0x24')]()['then'](function(){_0x213348[_0x0516('0x1a')](0xcc)[_0x0516('0x1b')]();});}};}function handleEntityNotFound(_0x29c8f1,_0x399ac8){return function(_0x8cb455){if(!_0x8cb455){_0x29c8f1[_0x0516('0x19')](0x194);}return _0x8cb455;};}function handleError(_0x286d73,_0x232ef2){_0x232ef2=_0x232ef2||0x1f4;return function(_0x3b4c21){logger[_0x0516('0x25')](_0x3b4c21[_0x0516('0x26')]);if(_0x3b4c21[_0x0516('0x27')]){delete _0x3b4c21[_0x0516('0x27')];}_0x286d73[_0x0516('0x1a')](_0x232ef2)[_0x0516('0x28')](_0x3b4c21);};}exports['index']=function(_0x4e6d84,_0x2abed6){var _0x479118={},_0x3dec81={},_0x29a97d={'count':0x0,'rows':[]};var _0x44b83f=_[_0x0516('0x29')](db[_0x0516('0x2a')][_0x0516('0x2b')],function(_0x1f15a2){return{'name':_0x1f15a2['fieldName'],'type':_0x1f15a2[_0x0516('0x2c')]['key']};});_0x3dec81[_0x0516('0x2d')]=_[_0x0516('0x29')](_0x44b83f,_0x0516('0x27'));_0x3dec81['query']=_[_0x0516('0x2e')](_0x4e6d84['query']);_0x3dec81[_0x0516('0x2f')]=_[_0x0516('0x30')](_0x3dec81[_0x0516('0x2d')],_0x3dec81['query']);_0x479118[_0x0516('0x31')]=_[_0x0516('0x30')](_0x3dec81['model'],qs[_0x0516('0x32')](_0x4e6d84['query'][_0x0516('0x32')]));_0x479118['attributes']=_0x479118[_0x0516('0x31')][_0x0516('0x33')]?_0x479118[_0x0516('0x31')]:_0x3dec81['model'];if(!_0x4e6d84[_0x0516('0x34')]['hasOwnProperty'](_0x0516('0x35'))){_0x479118[_0x0516('0x36')]=qs['limit'](_0x4e6d84[_0x0516('0x34')][_0x0516('0x36')]);_0x479118['offset']=qs[_0x0516('0x1e')](_0x4e6d84[_0x0516('0x34')][_0x0516('0x1e')]);}_0x479118[_0x0516('0x37')]=qs[_0x0516('0x38')](_0x4e6d84['query'][_0x0516('0x38')]);_0x479118[_0x0516('0x39')]=qs[_0x0516('0x2f')](_[_0x0516('0x3a')](_0x4e6d84[_0x0516('0x34')],_0x3dec81[_0x0516('0x2f')]),_0x44b83f);if(_0x4e6d84[_0x0516('0x34')][_0x0516('0x3b')]){_0x479118['where']=_[_0x0516('0x3c')](_0x479118[_0x0516('0x39')],{'$or':_[_0x0516('0x29')](_0x44b83f,function(_0xa81f7e){if(_0xa81f7e[_0x0516('0x2c')]!=='VIRTUAL'){var _0x2b5e17={};_0x2b5e17[_0xa81f7e[_0x0516('0x27')]]={'$like':'%'+_0x4e6d84['query'][_0x0516('0x3b')]+'%'};return _0x2b5e17;}})});}_0x479118=_[_0x0516('0x3c')]({},_0x479118,_0x4e6d84[_0x0516('0x3d')]);var _0x554f09={'where':_0x479118[_0x0516('0x39')]};return db[_0x0516('0x2a')][_0x0516('0x1d')](_0x554f09)[_0x0516('0x3e')](function(_0x7d8e12){_0x29a97d[_0x0516('0x1d')]=_0x7d8e12;if(_0x4e6d84['query'][_0x0516('0x3f')]){_0x479118[_0x0516('0x40')]=[{'all':!![]}];}return db[_0x0516('0x2a')][_0x0516('0x41')](_0x479118);})[_0x0516('0x3e')](function(_0x14a5ef){_0x29a97d[_0x0516('0x42')]=_0x14a5ef;return _0x29a97d;})[_0x0516('0x3e')](respondWithFilteredResult(_0x2abed6,_0x479118))[_0x0516('0x43')](handleError(_0x2abed6,null));};exports[_0x0516('0x44')]=function(_0x3c4493,_0x52227e){var _0x346f3c={'raw':!![],'where':{'id':_0x3c4493[_0x0516('0x45')]['id']}},_0x27ad5d={};_0x27ad5d['model']=_[_0x0516('0x2e')](db[_0x0516('0x2a')]['rawAttributes']);_0x27ad5d[_0x0516('0x34')]=_[_0x0516('0x2e')](_0x3c4493['query']);_0x27ad5d[_0x0516('0x2f')]=_['intersection'](_0x27ad5d['model'],_0x27ad5d[_0x0516('0x34')]);_0x346f3c['attributes']=_['intersection'](_0x27ad5d[_0x0516('0x2d')],qs[_0x0516('0x32')](_0x3c4493[_0x0516('0x34')]['fields']));_0x346f3c['attributes']=_0x346f3c[_0x0516('0x31')][_0x0516('0x33')]?_0x346f3c['attributes']:_0x27ad5d['model'];if(_0x3c4493[_0x0516('0x34')][_0x0516('0x3f')]){_0x346f3c[_0x0516('0x40')]=[{'all':!![]}];}_0x346f3c=_['merge']({},_0x346f3c,_0x3c4493[_0x0516('0x3d')]);return db[_0x0516('0x2a')][_0x0516('0x46')](_0x346f3c)[_0x0516('0x3e')](handleEntityNotFound(_0x52227e,null))[_0x0516('0x3e')](respondWithResult(_0x52227e,null))[_0x0516('0x43')](handleError(_0x52227e,null));};exports[_0x0516('0x47')]=function(_0x1902a7,_0x299bcd){return db[_0x0516('0x2a')][_0x0516('0x47')](_0x1902a7[_0x0516('0x48')],{})[_0x0516('0x3e')](respondWithResult(_0x299bcd,0xc9))[_0x0516('0x43')](handleError(_0x299bcd,null));};exports['update']=function(_0x4cb679,_0xa4b7ce){if(_0x4cb679[_0x0516('0x48')]['id']){delete _0x4cb679[_0x0516('0x48')]['id'];}return db[_0x0516('0x2a')][_0x0516('0x46')]({'where':{'id':_0x4cb679[_0x0516('0x45')]['id']}})['then'](handleEntityNotFound(_0xa4b7ce,null))[_0x0516('0x3e')](saveUpdates(_0x4cb679['body'],null))[_0x0516('0x3e')](respondWithResult(_0xa4b7ce,null))[_0x0516('0x43')](handleError(_0xa4b7ce,null));};exports[_0x0516('0x24')]=function(_0xdcf175,_0x3dc129){return db[_0x0516('0x2a')][_0x0516('0x46')]({'where':{'id':_0xdcf175[_0x0516('0x45')]['id']}})[_0x0516('0x3e')](handleEntityNotFound(_0x3dc129,null))[_0x0516('0x3e')](removeEntity(_0x3dc129,null))[_0x0516('0x43')](handleError(_0x3dc129,null));};exports[_0x0516('0x49')]=function(_0x3f1fff,_0x5cfff1){return db[_0x0516('0x2a')][_0x0516('0x49')]()['then'](respondWithResult(_0x5cfff1,null))[_0x0516('0x43')](handleError(_0x5cfff1,null));}; \ No newline at end of file +var _0x56f0=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','catch','show','keys','create','body','update','find','params','describe','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs'];(function(_0x28f6f3,_0x31b11e){var _0xd2273c=function(_0x1a0409){while(--_0x1a0409){_0x28f6f3['push'](_0x28f6f3['shift']());}};_0xd2273c(++_0x31b11e);}(_0x56f0,0x11c));var _0x056f=function(_0x5e32f3,_0x3386c1){_0x5e32f3=_0x5e32f3-0x0;var _0x4d4e03=_0x56f0[_0x5e32f3];return _0x4d4e03;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x056f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x056f('0x1'));var rp=require(_0x056f('0x2'));var moment=require(_0x056f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x056f('0x4'));var util=require('util');var path=require(_0x056f('0x5'));var sox=require('sox');var csv=require(_0x056f('0x6'));var ejs=require(_0x056f('0x7'));var fs=require('fs');var _=require(_0x056f('0x8'));var squel=require(_0x056f('0x9'));var crypto=require(_0x056f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x056f('0xb'));var toCsv=require(_0x056f('0x6'));var querystring=require('querystring');var Papa=require(_0x056f('0xc'));var Redis=require(_0x056f('0xd'));var authService=require(_0x056f('0xe'));var qs=require(_0x056f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x056f('0x10'));var logger=require(_0x056f('0x11'))(_0x056f('0x12'));var utils=require(_0x056f('0x13'));var config=require(_0x056f('0x14'));var db=require(_0x056f('0x15'))['db'];function respondWithStatusCode(_0x4d7c7b,_0x49ac1f){_0x49ac1f=_0x49ac1f||0xcc;return function(_0x3a176b){if(_0x3a176b){return _0x4d7c7b[_0x056f('0x16')](_0x49ac1f);}return _0x4d7c7b[_0x056f('0x17')](_0x49ac1f)[_0x056f('0x18')]();};}function respondWithResult(_0x5b2c54,_0x4cb8d5){_0x4cb8d5=_0x4cb8d5||0xc8;return function(_0x37df0c){if(_0x37df0c){return _0x5b2c54['status'](_0x4cb8d5)['json'](_0x37df0c);}};}function respondWithFilteredResult(_0x58aa66,_0x147066){return function(_0x3638d4){if(_0x3638d4){var _0x583415=_0x3638d4[_0x056f('0x19')],_0x22e954=_0x147066[_0x056f('0x1a')],_0x1eed90=_0x147066[_0x056f('0x1a')]+_0x147066[_0x056f('0x1b')],_0x5cf647;if(_0x1eed90>=_0x583415){_0x1eed90=_0x583415;_0x5cf647=0xc8;}else{_0x5cf647=0xce;}_0x58aa66[_0x056f('0x17')](_0x5cf647);return _0x58aa66[_0x056f('0x1c')](_0x056f('0x1d'),_0x22e954+'-'+_0x1eed90+'/'+_0x583415)['json'](_0x3638d4);}return null;};}function patchUpdates(_0x24c644){return function(_0x10e368){try{jsonpatch[_0x056f('0x1e')](_0x10e368,_0x24c644,!![]);}catch(_0x638c4d){return BPromise['reject'](_0x638c4d);}return _0x10e368[_0x056f('0x1f')]();};}function saveUpdates(_0x10fa9c,_0x333b7c){return function(_0x166ef6){if(_0x166ef6){return _0x166ef6['update'](_0x10fa9c)[_0x056f('0x20')](function(_0x5eefc7){return _0x5eefc7;});}return null;};}function removeEntity(_0x102173,_0x207c44){return function(_0x6cbbdd){if(_0x6cbbdd){return _0x6cbbdd[_0x056f('0x21')]()[_0x056f('0x20')](function(){_0x102173[_0x056f('0x17')](0xcc)[_0x056f('0x18')]();});}};}function handleEntityNotFound(_0x539a50,_0x4b5f39){return function(_0x36f272){if(!_0x36f272){_0x539a50[_0x056f('0x16')](0x194);}return _0x36f272;};}function handleError(_0x1e04f1,_0x123b3c){_0x123b3c=_0x123b3c||0x1f4;return function(_0x36b244){logger[_0x056f('0x22')](_0x36b244[_0x056f('0x23')]);if(_0x36b244['name']){delete _0x36b244[_0x056f('0x24')];}_0x1e04f1[_0x056f('0x17')](_0x123b3c)[_0x056f('0x25')](_0x36b244);};}exports[_0x056f('0x26')]=function(_0x51dd20,_0x284f37){var _0x3b84cf={},_0x39182c={},_0x41cd16={'count':0x0,'rows':[]};var _0x487c34=_[_0x056f('0x27')](db['OpenchannelTransferReport'][_0x056f('0x28')],function(_0x1520d2){return{'name':_0x1520d2[_0x056f('0x29')],'type':_0x1520d2[_0x056f('0x2a')][_0x056f('0x2b')]};});_0x39182c[_0x056f('0x2c')]=_[_0x056f('0x27')](_0x487c34,'name');_0x39182c[_0x056f('0x2d')]=_['keys'](_0x51dd20[_0x056f('0x2d')]);_0x39182c[_0x056f('0x2e')]=_['intersection'](_0x39182c['model'],_0x39182c['query']);_0x3b84cf[_0x056f('0x2f')]=_[_0x056f('0x30')](_0x39182c[_0x056f('0x2c')],qs[_0x056f('0x31')](_0x51dd20[_0x056f('0x2d')]['fields']));_0x3b84cf[_0x056f('0x2f')]=_0x3b84cf['attributes'][_0x056f('0x32')]?_0x3b84cf[_0x056f('0x2f')]:_0x39182c[_0x056f('0x2c')];if(!_0x51dd20[_0x056f('0x2d')][_0x056f('0x33')](_0x056f('0x34'))){_0x3b84cf['limit']=qs[_0x056f('0x1b')](_0x51dd20[_0x056f('0x2d')][_0x056f('0x1b')]);_0x3b84cf[_0x056f('0x1a')]=qs[_0x056f('0x1a')](_0x51dd20[_0x056f('0x2d')][_0x056f('0x1a')]);}_0x3b84cf[_0x056f('0x35')]=qs[_0x056f('0x36')](_0x51dd20[_0x056f('0x2d')][_0x056f('0x36')]);_0x3b84cf[_0x056f('0x37')]=qs['filters'](_['pick'](_0x51dd20[_0x056f('0x2d')],_0x39182c[_0x056f('0x2e')]),_0x487c34);if(_0x51dd20['query'][_0x056f('0x38')]){_0x3b84cf[_0x056f('0x37')]=_[_0x056f('0x39')](_0x3b84cf[_0x056f('0x37')],{'$or':_[_0x056f('0x27')](_0x487c34,function(_0x1d5712){if(_0x1d5712['type']!==_0x056f('0x3a')){var _0x3d6e23={};_0x3d6e23[_0x1d5712[_0x056f('0x24')]]={'$like':'%'+_0x51dd20[_0x056f('0x2d')]['filter']+'%'};return _0x3d6e23;}})});}_0x3b84cf=_[_0x056f('0x39')]({},_0x3b84cf,_0x51dd20[_0x056f('0x3b')]);var _0x572846={'where':_0x3b84cf['where']};return db[_0x056f('0x3c')][_0x056f('0x19')](_0x572846)[_0x056f('0x20')](function(_0x4eeb61){_0x41cd16[_0x056f('0x19')]=_0x4eeb61;if(_0x51dd20[_0x056f('0x2d')][_0x056f('0x3d')]){_0x3b84cf[_0x056f('0x3e')]=[{'all':!![]}];}return db[_0x056f('0x3c')][_0x056f('0x3f')](_0x3b84cf);})[_0x056f('0x20')](function(_0x290479){_0x41cd16['rows']=_0x290479;return _0x41cd16;})[_0x056f('0x20')](respondWithFilteredResult(_0x284f37,_0x3b84cf))[_0x056f('0x40')](handleError(_0x284f37,null));};exports[_0x056f('0x41')]=function(_0x2aec48,_0x180053){var _0xac2a9={'raw':!![],'where':{'id':_0x2aec48['params']['id']}},_0x2165f4={};_0x2165f4[_0x056f('0x2c')]=_[_0x056f('0x42')](db[_0x056f('0x3c')][_0x056f('0x28')]);_0x2165f4[_0x056f('0x2d')]=_['keys'](_0x2aec48[_0x056f('0x2d')]);_0x2165f4[_0x056f('0x2e')]=_[_0x056f('0x30')](_0x2165f4[_0x056f('0x2c')],_0x2165f4[_0x056f('0x2d')]);_0xac2a9[_0x056f('0x2f')]=_['intersection'](_0x2165f4[_0x056f('0x2c')],qs[_0x056f('0x31')](_0x2aec48['query'][_0x056f('0x31')]));_0xac2a9[_0x056f('0x2f')]=_0xac2a9[_0x056f('0x2f')][_0x056f('0x32')]?_0xac2a9[_0x056f('0x2f')]:_0x2165f4[_0x056f('0x2c')];if(_0x2aec48[_0x056f('0x2d')][_0x056f('0x3d')]){_0xac2a9[_0x056f('0x3e')]=[{'all':!![]}];}_0xac2a9=_[_0x056f('0x39')]({},_0xac2a9,_0x2aec48['options']);return db['OpenchannelTransferReport']['find'](_0xac2a9)[_0x056f('0x20')](handleEntityNotFound(_0x180053,null))['then'](respondWithResult(_0x180053,null))[_0x056f('0x40')](handleError(_0x180053,null));};exports['create']=function(_0x5ad046,_0x1c9b88){return db[_0x056f('0x3c')][_0x056f('0x43')](_0x5ad046[_0x056f('0x44')],{})[_0x056f('0x20')](respondWithResult(_0x1c9b88,0xc9))[_0x056f('0x40')](handleError(_0x1c9b88,null));};exports[_0x056f('0x45')]=function(_0x3ecf51,_0x27f6e2){if(_0x3ecf51['body']['id']){delete _0x3ecf51['body']['id'];}return db['OpenchannelTransferReport'][_0x056f('0x46')]({'where':{'id':_0x3ecf51[_0x056f('0x47')]['id']}})['then'](handleEntityNotFound(_0x27f6e2,null))[_0x056f('0x20')](saveUpdates(_0x3ecf51[_0x056f('0x44')],null))[_0x056f('0x20')](respondWithResult(_0x27f6e2,null))['catch'](handleError(_0x27f6e2,null));};exports[_0x056f('0x21')]=function(_0x47275c,_0x572c65){return db['OpenchannelTransferReport'][_0x056f('0x46')]({'where':{'id':_0x47275c[_0x056f('0x47')]['id']}})[_0x056f('0x20')](handleEntityNotFound(_0x572c65,null))[_0x056f('0x20')](removeEntity(_0x572c65,null))[_0x056f('0x40')](handleError(_0x572c65,null));};exports[_0x056f('0x48')]=function(_0xa68cc1,_0x313a0e){return db[_0x056f('0x3c')][_0x056f('0x48')]()['then'](respondWithResult(_0x313a0e,null))[_0x056f('0x40')](handleError(_0x313a0e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 76ddb26..740b2db 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 _0xe75a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','uniqueid','lodash','util','api'];(function(_0x5967c0,_0x452377){var _0x2ad249=function(_0x7eb26){while(--_0x7eb26){_0x5967c0['push'](_0x5967c0['shift']());}};_0x2ad249(++_0x452377);}(_0xe75a,0x1de));var _0xae75=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0xe75a[_0x4efd3d];return _0x1293f2;};'use strict';var _=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var logger=require('../../config/logger')(_0xae75('0x2'));var moment=require(_0xae75('0x3'));var BPromise=require(_0xae75('0x4'));var rp=require(_0xae75('0x5'));var fs=require('fs');var path=require(_0xae75('0x6'));var rimraf=require(_0xae75('0x7'));var config=require(_0xae75('0x8'));var attributes=require(_0xae75('0x9'));module[_0xae75('0xa')]=function(_0x7352d2,_0x4eb1bf){return _0x7352d2[_0xae75('0xb')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xae75('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd101=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd101,0xc1));var _0x1d10=function(_0x3f1625,_0x129be7){_0x3f1625=_0x3f1625-0x0;var _0x23c6b3=_0xd101[_0x3f1625];return _0x23c6b3;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x1d10('0x9')]=function(_0x203072,_0x2a4e2d){return _0x203072[_0x1d10('0xa')](_0x1d10('0xb'),attributes,{'tableName':_0x1d10('0xc'),'paranoid':![],'indexes':[{'name':_0x1d10('0xd'),'fields':[_0x1d10('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 a298475..69c2ff3 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 _0x572c=['rpc','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x33b6b3,_0x644e80){var _0x1e2d7a=function(_0x2aec35){while(--_0x2aec35){_0x33b6b3['push'](_0x33b6b3['shift']());}};_0x1e2d7a(++_0x644e80);}(_0x572c,0xc7));var _0xc572=function(_0x4b7d5f,_0x5abbe0){_0x4b7d5f=_0x4b7d5f-0x0;var _0x4e0a60=_0x572c[_0x4b7d5f];return _0x4e0a60;};'use strict';var _=require('lodash');var util=require(_0xc572('0x0'));var moment=require(_0xc572('0x1'));var BPromise=require(_0xc572('0x2'));var rs=require(_0xc572('0x3'));var fs=require('fs');var Redis=require(_0xc572('0x4'));var db=require(_0xc572('0x5'))['db'];var utils=require(_0xc572('0x6'));var logger=require(_0xc572('0x7'))(_0xc572('0x8'));var config=require('../../config/environment');var jayson=require(_0xc572('0x9'));var client=jayson[_0xc572('0xa')][_0xc572('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa604,_0x271fe8,_0x21ccdf){return new BPromise(function(_0x3a6caa,_0x593c16){return client[_0xc572('0xc')](_0x2fa604,_0x21ccdf)[_0xc572('0xd')](function(_0x2d16c4){logger[_0xc572('0xe')](_0xc572('0xf'),_0x271fe8,_0xc572('0x10'));logger[_0xc572('0x11')](_0xc572('0x12'),_0x271fe8,_0xc572('0x10'),JSON['stringify'](_0x2d16c4));if(_0x2d16c4[_0xc572('0x13')]){if(_0x2d16c4[_0xc572('0x13')]['code']===0x1f4){logger['error'](_0xc572('0xf'),_0x271fe8,_0x2d16c4[_0xc572('0x13')]['message']);return _0x593c16(_0x2d16c4['error'][_0xc572('0x14')]);}logger['error'](_0xc572('0xf'),_0x271fe8,_0x2d16c4[_0xc572('0x13')][_0xc572('0x14')]);return _0x3a6caa(_0x2d16c4[_0xc572('0x13')][_0xc572('0x14')]);}else{logger[_0xc572('0xe')](_0xc572('0xf'),_0x271fe8,_0xc572('0x10'));_0x3a6caa(_0x2d16c4[_0xc572('0x15')][_0xc572('0x14')]);}})[_0xc572('0x16')](function(_0x50f355){logger['error'](_0xc572('0xf'),_0x271fe8,_0x50f355);_0x593c16(_0x50f355);});});} \ No newline at end of file +var _0x49fe=['OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x1720e9,_0x2a58c3){var _0x3dd033=function(_0x113d0a){while(--_0x113d0a){_0x1720e9['push'](_0x1720e9['shift']());}};_0x3dd033(++_0x2a58c3);}(_0x49fe,0x100));var _0xe49f=function(_0x586ebd,_0x46ad6c){_0x586ebd=_0x586ebd-0x0;var _0x27d592=_0x49fe[_0x586ebd];return _0x27d592;};'use strict';var _=require(_0xe49f('0x0'));var util=require(_0xe49f('0x1'));var moment=require(_0xe49f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe49f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe49f('0x4'));var logger=require(_0xe49f('0x5'))(_0xe49f('0x6'));var config=require(_0xe49f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe49f('0x8')][_0xe49f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbef6f5,_0x26eac9,_0x4f9b1f){return new BPromise(function(_0x384c48,_0x18f791){return client[_0xe49f('0xa')](_0xbef6f5,_0x4f9b1f)[_0xe49f('0xb')](function(_0x826f00){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x26eac9,_0xe49f('0xc'));logger[_0xe49f('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x26eac9,'request\x20sent',JSON[_0xe49f('0xe')](_0x826f00));if(_0x826f00[_0xe49f('0xf')]){if(_0x826f00[_0xe49f('0xf')][_0xe49f('0x10')]===0x1f4){logger[_0xe49f('0xf')](_0xe49f('0x11'),_0x26eac9,_0x826f00['error']['message']);return _0x18f791(_0x826f00[_0xe49f('0xf')][_0xe49f('0x12')]);}logger[_0xe49f('0xf')](_0xe49f('0x11'),_0x26eac9,_0x826f00[_0xe49f('0xf')]['message']);return _0x384c48(_0x826f00[_0xe49f('0xf')][_0xe49f('0x12')]);}else{logger[_0xe49f('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x26eac9,_0xe49f('0xc'));_0x384c48(_0x826f00[_0xe49f('0x14')][_0xe49f('0x12')]);}})['catch'](function(_0xcb0d16){logger[_0xe49f('0xf')](_0xe49f('0x11'),_0x26eac9,_0xcb0d16);_0x18f791(_0xcb0d16);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a702351..74600d1 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 _0x7487=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','Router'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x7487,0x140));var _0x7748=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x7487[_0x121b1a];return _0x2d89a6;};'use strict';var multer=require(_0x7748('0x0'));var util=require(_0x7748('0x1'));var path=require('path');var timeout=require(_0x7748('0x2'));var express=require('express');var router=express[_0x7748('0x3')]();var auth=require(_0x7748('0x4'));var interaction=require(_0x7748('0x5'));var config=require(_0x7748('0x6'));var controller=require(_0x7748('0x7'));router[_0x7748('0x8')]('/',auth[_0x7748('0x9')](),controller[_0x7748('0xa')]);router[_0x7748('0x8')](_0x7748('0xb'),auth[_0x7748('0x9')](),controller[_0x7748('0xc')]);router[_0x7748('0xd')]('/',auth[_0x7748('0x9')](),controller[_0x7748('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7748('0xf')]);router[_0x7748('0x10')](_0x7748('0xb'),auth[_0x7748('0x9')](),controller['destroy']);module[_0x7748('0x11')]=router; \ No newline at end of file +var _0xd196=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xd196,0x185));var _0x6d19=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0xd196[_0x562faa];return _0xc70f59;};'use strict';var multer=require(_0x6d19('0x0'));var util=require(_0x6d19('0x1'));var path=require(_0x6d19('0x2'));var timeout=require(_0x6d19('0x3'));var express=require(_0x6d19('0x4'));var router=express[_0x6d19('0x5')]();var auth=require(_0x6d19('0x6'));var interaction=require(_0x6d19('0x7'));var config=require(_0x6d19('0x8'));var controller=require('./pause.controller');router[_0x6d19('0x9')]('/',auth[_0x6d19('0xa')](),controller[_0x6d19('0xb')]);router[_0x6d19('0x9')](_0x6d19('0xc'),auth[_0x6d19('0xa')](),controller[_0x6d19('0xd')]);router[_0x6d19('0xe')]('/',auth[_0x6d19('0xa')](),controller[_0x6d19('0xf')]);router[_0x6d19('0x10')](_0x6d19('0xc'),auth[_0x6d19('0xa')](),controller[_0x6d19('0x11')]);router[_0x6d19('0x12')]('/:id',auth[_0x6d19('0xa')](),controller[_0x6d19('0x13')]);module[_0x6d19('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index d5c8652..0cf2023 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 _0x35b6=['sequelize','STRING','name'];(function(_0x44e422,_0x2be343){var _0x13d7f5=function(_0x27fb50){while(--_0x27fb50){_0x44e422['push'](_0x44e422['shift']());}};_0x13d7f5(++_0x2be343);}(_0x35b6,0x15c));var _0x635b=function(_0x42fee7,_0x583a2d){_0x42fee7=_0x42fee7-0x0;var _0x5f2366=_0x35b6[_0x42fee7];return _0x5f2366;};'use strict';var Sequelize=require(_0x635b('0x0'));module['exports']={'name':{'type':Sequelize[_0x635b('0x1')],'unique':_0x635b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x635b('0x1')]}}; \ No newline at end of file +var _0xdcd0=['exports','STRING','name','sequelize'];(function(_0x11cb12,_0x47217b){var _0x1a5214=function(_0x576017){while(--_0x576017){_0x11cb12['push'](_0x11cb12['shift']());}};_0x1a5214(++_0x47217b);}(_0xdcd0,0xef));var _0x0dcd=function(_0x1f61bd,_0x533eb3){_0x1f61bd=_0x1f61bd-0x0;var _0xc1f48=_0xdcd0[_0x1f61bd];return _0xc1f48;};'use strict';var Sequelize=require(_0x0dcd('0x0'));module[_0x0dcd('0x1')]={'name':{'type':Sequelize[_0x0dcd('0x2')],'unique':_0x0dcd('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x0dcd('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 48a119e..ccb53b0 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 _0x5a8c=['moment','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','Pauses','destroy','end','sendStatus','stack','name','send','index','map','Pause','rawAttributes','model','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x32a779,_0x359c6b){var _0x1743e0=function(_0x196b71){while(--_0x196b71){_0x32a779['push'](_0x32a779['shift']());}};_0x1743e0(++_0x359c6b);}(_0x5a8c,0xe5));var _0xc5a8=function(_0x86794c,_0x5df4b0){_0x86794c=_0x86794c-0x0;var _0x2ea7a8=_0x5a8c[_0x86794c];return _0x2ea7a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc5a8('0x0'));var rimraf=require(_0xc5a8('0x1'));var zipdir=require(_0xc5a8('0x2'));var jsonpatch=require(_0xc5a8('0x3'));var rp=require(_0xc5a8('0x4'));var moment=require(_0xc5a8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc5a8('0x6'));var util=require(_0xc5a8('0x7'));var path=require(_0xc5a8('0x8'));var sox=require(_0xc5a8('0x9'));var csv=require(_0xc5a8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc5a8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5a8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc5a8('0xd'));var Papa=require(_0xc5a8('0xe'));var Redis=require('ioredis');var authService=require(_0xc5a8('0xf'));var qs=require(_0xc5a8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5a8('0x11'));var logger=require(_0xc5a8('0x12'))(_0xc5a8('0x13'));var utils=require(_0xc5a8('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25cb9d,_0x314c52){_0x314c52=_0x314c52||0xcc;return function(_0x57a006){if(_0x57a006){return _0x25cb9d['sendStatus'](_0x314c52);}return _0x25cb9d[_0xc5a8('0x15')](_0x314c52)['end']();};}function respondWithResult(_0x27a14a,_0x1c6ecf){_0x1c6ecf=_0x1c6ecf||0xc8;return function(_0x3b3b52){if(_0x3b3b52){return _0x27a14a['status'](_0x1c6ecf)[_0xc5a8('0x16')](_0x3b3b52);}};}function respondWithFilteredResult(_0x14db58,_0xd235fa){return function(_0x3cce3b){if(_0x3cce3b){var _0x499f8f=_0x3cce3b[_0xc5a8('0x17')],_0x30fd2b=_0xd235fa[_0xc5a8('0x18')],_0x3c7555=_0xd235fa[_0xc5a8('0x18')]+_0xd235fa[_0xc5a8('0x19')],_0x56f03a;if(_0x3c7555>=_0x499f8f){_0x3c7555=_0x499f8f;_0x56f03a=0xc8;}else{_0x56f03a=0xce;}_0x14db58[_0xc5a8('0x15')](_0x56f03a);return _0x14db58[_0xc5a8('0x1a')](_0xc5a8('0x1b'),_0x30fd2b+'-'+_0x3c7555+'/'+_0x499f8f)[_0xc5a8('0x16')](_0x3cce3b);}return null;};}function patchUpdates(_0x40b9e1){return function(_0x2ab8b1){try{jsonpatch[_0xc5a8('0x1c')](_0x2ab8b1,_0x40b9e1,!![]);}catch(_0x57b6c3){return BPromise[_0xc5a8('0x1d')](_0x57b6c3);}return _0x2ab8b1[_0xc5a8('0x1e')]();};}function saveUpdates(_0x49fc2a,_0x5f2852){return function(_0x5948b6){if(_0x5948b6){return _0x5948b6['update'](_0x49fc2a)[_0xc5a8('0x1f')](function(_0x14b143){return _0x14b143;});}return null;};}function removeEntity(_0x1fb93f,_0x3f58fd){return function(_0x369e0a){if(_0x369e0a){return _0x369e0a['destroy']()[_0xc5a8('0x1f')](function(){var _0x32af8f=_0x369e0a[_0xc5a8('0x20')]({'plain':!![]});var _0x123b31=_0xc5a8('0x21');return db['UserProfileResource'][_0xc5a8('0x22')]({'where':{'type':_0x123b31,'resourceId':_0x32af8f['id']}})[_0xc5a8('0x1f')](function(){return _0x369e0a;});})[_0xc5a8('0x1f')](function(){_0x1fb93f[_0xc5a8('0x15')](0xcc)[_0xc5a8('0x23')]();});}};}function handleEntityNotFound(_0x24168a,_0x129c1d){return function(_0x20c199){if(!_0x20c199){_0x24168a[_0xc5a8('0x24')](0x194);}return _0x20c199;};}function handleError(_0x171e01,_0x7b566c){_0x7b566c=_0x7b566c||0x1f4;return function(_0x58eb95){logger['error'](_0x58eb95[_0xc5a8('0x25')]);if(_0x58eb95[_0xc5a8('0x26')]){delete _0x58eb95[_0xc5a8('0x26')];}_0x171e01[_0xc5a8('0x15')](_0x7b566c)[_0xc5a8('0x27')](_0x58eb95);};}exports[_0xc5a8('0x28')]=function(_0x490bdf,_0x7dbe3e){var _0x1a15d6={},_0x3c4200={},_0x53e518={'count':0x0,'rows':[]};var _0x5a4203=_[_0xc5a8('0x29')](db[_0xc5a8('0x2a')][_0xc5a8('0x2b')],function(_0x19df06){return{'name':_0x19df06['fieldName'],'type':_0x19df06['type']['key']};});_0x3c4200[_0xc5a8('0x2c')]=_[_0xc5a8('0x29')](_0x5a4203,_0xc5a8('0x26'));_0x3c4200[_0xc5a8('0x2d')]=_['keys'](_0x490bdf[_0xc5a8('0x2d')]);_0x3c4200[_0xc5a8('0x2e')]=_[_0xc5a8('0x2f')](_0x3c4200['model'],_0x3c4200[_0xc5a8('0x2d')]);_0x1a15d6['attributes']=_[_0xc5a8('0x2f')](_0x3c4200[_0xc5a8('0x2c')],qs[_0xc5a8('0x30')](_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x30')]));_0x1a15d6[_0xc5a8('0x31')]=_0x1a15d6[_0xc5a8('0x31')]['length']?_0x1a15d6[_0xc5a8('0x31')]:_0x3c4200[_0xc5a8('0x2c')];if(!_0x490bdf[_0xc5a8('0x2d')]['hasOwnProperty']('nolimit')){_0x1a15d6['limit']=qs[_0xc5a8('0x19')](_0x490bdf[_0xc5a8('0x2d')]['limit']);_0x1a15d6[_0xc5a8('0x18')]=qs['offset'](_0x490bdf['query'][_0xc5a8('0x18')]);}_0x1a15d6[_0xc5a8('0x32')]=qs[_0xc5a8('0x33')](_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x33')]);_0x1a15d6[_0xc5a8('0x34')]=qs[_0xc5a8('0x2e')](_[_0xc5a8('0x35')](_0x490bdf[_0xc5a8('0x2d')],_0x3c4200['filters']),_0x5a4203);if(_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x36')]){_0x1a15d6[_0xc5a8('0x34')]=_['merge'](_0x1a15d6[_0xc5a8('0x34')],{'$or':_[_0xc5a8('0x29')](_0x5a4203,function(_0x22c698){if(_0x22c698[_0xc5a8('0x37')]!==_0xc5a8('0x38')){var _0x312f4c={};_0x312f4c[_0x22c698['name']]={'$like':'%'+_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x36')]+'%'};return _0x312f4c;}})});}_0x1a15d6=_['merge']({},_0x1a15d6,_0x490bdf['options']);var _0x15327b={'where':_0x1a15d6[_0xc5a8('0x34')]};return db[_0xc5a8('0x2a')][_0xc5a8('0x17')](_0x15327b)['then'](function(_0x2fb557){_0x53e518['count']=_0x2fb557;if(_0x490bdf[_0xc5a8('0x2d')][_0xc5a8('0x39')]){_0x1a15d6[_0xc5a8('0x3a')]=[{'all':!![]}];}return db['Pause'][_0xc5a8('0x3b')](_0x1a15d6);})['then'](function(_0x45f7fb){_0x53e518[_0xc5a8('0x3c')]=_0x45f7fb;return _0x53e518;})[_0xc5a8('0x1f')](respondWithFilteredResult(_0x7dbe3e,_0x1a15d6))[_0xc5a8('0x3d')](handleError(_0x7dbe3e,null));};exports[_0xc5a8('0x3e')]=function(_0x21edd6,_0x5d67a4){var _0x52d417={'raw':!![],'where':{'id':_0x21edd6[_0xc5a8('0x3f')]['id']}},_0x3cdc18={};_0x3cdc18[_0xc5a8('0x2c')]=_[_0xc5a8('0x40')](db['Pause'][_0xc5a8('0x2b')]);_0x3cdc18['query']=_[_0xc5a8('0x40')](_0x21edd6[_0xc5a8('0x2d')]);_0x3cdc18[_0xc5a8('0x2e')]=_[_0xc5a8('0x2f')](_0x3cdc18[_0xc5a8('0x2c')],_0x3cdc18[_0xc5a8('0x2d')]);_0x52d417[_0xc5a8('0x31')]=_[_0xc5a8('0x2f')](_0x3cdc18[_0xc5a8('0x2c')],qs[_0xc5a8('0x30')](_0x21edd6[_0xc5a8('0x2d')][_0xc5a8('0x30')]));_0x52d417[_0xc5a8('0x31')]=_0x52d417[_0xc5a8('0x31')][_0xc5a8('0x41')]?_0x52d417['attributes']:_0x3cdc18['model'];if(_0x21edd6[_0xc5a8('0x2d')][_0xc5a8('0x39')]){_0x52d417[_0xc5a8('0x3a')]=[{'all':!![]}];}_0x52d417=_[_0xc5a8('0x42')]({},_0x52d417,_0x21edd6[_0xc5a8('0x43')]);return db[_0xc5a8('0x2a')]['find'](_0x52d417)[_0xc5a8('0x1f')](handleEntityNotFound(_0x5d67a4,null))['then'](respondWithResult(_0x5d67a4,null))[_0xc5a8('0x3d')](handleError(_0x5d67a4,null));};exports[_0xc5a8('0x44')]=function(_0x5f59c7,_0x2f6918){return db[_0xc5a8('0x2a')][_0xc5a8('0x44')](_0x5f59c7[_0xc5a8('0x45')],{})[_0xc5a8('0x1f')](function(_0x3656d9){var _0x354065=_0x5f59c7[_0xc5a8('0x46')][_0xc5a8('0x20')]({'plain':!![]});if(!_0x354065)throw new Error(_0xc5a8('0x47'));if(_0x354065[_0xc5a8('0x48')]===_0xc5a8('0x46')){var _0x4592c9=_0x3656d9[_0xc5a8('0x20')]({'plain':!![]});var _0x2913a7=_0xc5a8('0x21');return db[_0xc5a8('0x49')][_0xc5a8('0x4a')]({'where':{'name':_0x2913a7,'userProfileId':_0x354065[_0xc5a8('0x4b')]},'raw':!![]})[_0xc5a8('0x1f')](function(_0x368c54){if(_0x368c54&&_0x368c54['autoAssociation']===0x0){return db['UserProfileResource'][_0xc5a8('0x44')]({'name':_0x4592c9['name'],'resourceId':_0x4592c9['id'],'type':_0x368c54['name'],'sectionId':_0x368c54['id']},{})[_0xc5a8('0x1f')](function(){return _0x3656d9;});}else{return _0x3656d9;}})[_0xc5a8('0x3d')](function(_0x136269){logger['error'](_0xc5a8('0x4c'),_0x136269);throw _0x136269;});}return _0x3656d9;})[_0xc5a8('0x1f')](respondWithResult(_0x2f6918,0xc9))[_0xc5a8('0x3d')](handleError(_0x2f6918,null));};exports[_0xc5a8('0x4d')]=function(_0x4ee81f,_0xdd4c4a){if(_0x4ee81f[_0xc5a8('0x45')]['id']){delete _0x4ee81f['body']['id'];}return db[_0xc5a8('0x2a')][_0xc5a8('0x4a')]({'where':{'id':_0x4ee81f[_0xc5a8('0x3f')]['id']}})[_0xc5a8('0x1f')](handleEntityNotFound(_0xdd4c4a,null))[_0xc5a8('0x1f')](saveUpdates(_0x4ee81f[_0xc5a8('0x45')],null))['then'](respondWithResult(_0xdd4c4a,null))[_0xc5a8('0x3d')](handleError(_0xdd4c4a,null));};exports['destroy']=function(_0x19cd28,_0x3680eb){return db[_0xc5a8('0x2a')]['find']({'where':{'id':_0x19cd28['params']['id']}})[_0xc5a8('0x1f')](handleEntityNotFound(_0x3680eb,null))['then'](removeEntity(_0x3680eb,null))[_0xc5a8('0x3d')](handleError(_0x3680eb,null));}; \ No newline at end of file +var _0xa34b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','Pauses','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','count','includeAll','Pause','findAll','rows','catch','show','params','fields','find','create','body','get','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','ioredis'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa34b,0x16e));var _0xba34=function(_0x2709da,_0x523807){_0x2709da=_0x2709da-0x0;var _0x3ad523=_0xa34b[_0x2709da];return _0x3ad523;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba34('0x1'));var jsonpatch=require(_0xba34('0x2'));var rp=require(_0xba34('0x3'));var moment=require(_0xba34('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xba34('0x5'));var util=require(_0xba34('0x6'));var path=require(_0xba34('0x7'));var sox=require('sox');var csv=require(_0xba34('0x8'));var ejs=require(_0xba34('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xba34('0xa'));var crypto=require(_0xba34('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xba34('0xc'));var toCsv=require(_0xba34('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba34('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xba34('0xe'));var as=require(_0xba34('0xf'));var hardwareService=require(_0xba34('0x10'));var logger=require(_0xba34('0x11'))('api');var utils=require(_0xba34('0x12'));var config=require(_0xba34('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d4cbf,_0x5e7958){_0x5e7958=_0x5e7958||0xcc;return function(_0x593d0b){if(_0x593d0b){return _0x1d4cbf[_0xba34('0x14')](_0x5e7958);}return _0x1d4cbf[_0xba34('0x15')](_0x5e7958)[_0xba34('0x16')]();};}function respondWithResult(_0x3acc54,_0x49cec1){_0x49cec1=_0x49cec1||0xc8;return function(_0x395e08){if(_0x395e08){return _0x3acc54[_0xba34('0x15')](_0x49cec1)[_0xba34('0x17')](_0x395e08);}};}function respondWithFilteredResult(_0x82cebc,_0x1573e5){return function(_0x6c24f7){if(_0x6c24f7){var _0x2db3b6=_0x6c24f7['count'],_0xd8070a=_0x1573e5['offset'],_0x36c364=_0x1573e5[_0xba34('0x18')]+_0x1573e5[_0xba34('0x19')],_0x5cac64;if(_0x36c364>=_0x2db3b6){_0x36c364=_0x2db3b6;_0x5cac64=0xc8;}else{_0x5cac64=0xce;}_0x82cebc['status'](_0x5cac64);return _0x82cebc[_0xba34('0x1a')](_0xba34('0x1b'),_0xd8070a+'-'+_0x36c364+'/'+_0x2db3b6)['json'](_0x6c24f7);}return null;};}function patchUpdates(_0x5e19ee){return function(_0x452af8){try{jsonpatch[_0xba34('0x1c')](_0x452af8,_0x5e19ee,!![]);}catch(_0xd8e8e0){return BPromise[_0xba34('0x1d')](_0xd8e8e0);}return _0x452af8[_0xba34('0x1e')]();};}function saveUpdates(_0x2db5bd,_0x45878){return function(_0x20165d){if(_0x20165d){return _0x20165d[_0xba34('0x1f')](_0x2db5bd)[_0xba34('0x20')](function(_0xa02c2e){return _0xa02c2e;});}return null;};}function removeEntity(_0x4a1ecf,_0x320b28){return function(_0x409923){if(_0x409923){return _0x409923['destroy']()[_0xba34('0x20')](function(){var _0x5d80a9=_0x409923['get']({'plain':!![]});var _0x2bca44=_0xba34('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x2bca44,'resourceId':_0x5d80a9['id']}})['then'](function(){return _0x409923;});})[_0xba34('0x20')](function(){_0x4a1ecf[_0xba34('0x15')](0xcc)[_0xba34('0x16')]();});}};}function handleEntityNotFound(_0x5efbe7,_0x2f099d){return function(_0x2baa73){if(!_0x2baa73){_0x5efbe7['sendStatus'](0x194);}return _0x2baa73;};}function handleError(_0x3934a2,_0x1d4e83){_0x1d4e83=_0x1d4e83||0x1f4;return function(_0x3eab91){logger[_0xba34('0x22')](_0x3eab91['stack']);if(_0x3eab91[_0xba34('0x23')]){delete _0x3eab91[_0xba34('0x23')];}_0x3934a2[_0xba34('0x15')](_0x1d4e83)[_0xba34('0x24')](_0x3eab91);};}exports[_0xba34('0x25')]=function(_0x23157e,_0x2de112){var _0xfd758f={},_0x2013cd={},_0x1f57bf={'count':0x0,'rows':[]};var _0x5c6742=_[_0xba34('0x26')](db['Pause'][_0xba34('0x27')],function(_0x645d7b){return{'name':_0x645d7b[_0xba34('0x28')],'type':_0x645d7b[_0xba34('0x29')]['key']};});_0x2013cd[_0xba34('0x2a')]=_[_0xba34('0x26')](_0x5c6742,'name');_0x2013cd[_0xba34('0x2b')]=_[_0xba34('0x2c')](_0x23157e[_0xba34('0x2b')]);_0x2013cd[_0xba34('0x2d')]=_[_0xba34('0x2e')](_0x2013cd[_0xba34('0x2a')],_0x2013cd[_0xba34('0x2b')]);_0xfd758f[_0xba34('0x2f')]=_[_0xba34('0x2e')](_0x2013cd[_0xba34('0x2a')],qs['fields'](_0x23157e[_0xba34('0x2b')]['fields']));_0xfd758f['attributes']=_0xfd758f[_0xba34('0x2f')][_0xba34('0x30')]?_0xfd758f[_0xba34('0x2f')]:_0x2013cd[_0xba34('0x2a')];if(!_0x23157e['query'][_0xba34('0x31')](_0xba34('0x32'))){_0xfd758f['limit']=qs[_0xba34('0x19')](_0x23157e[_0xba34('0x2b')][_0xba34('0x19')]);_0xfd758f[_0xba34('0x18')]=qs['offset'](_0x23157e[_0xba34('0x2b')]['offset']);}_0xfd758f[_0xba34('0x33')]=qs[_0xba34('0x34')](_0x23157e[_0xba34('0x2b')][_0xba34('0x34')]);_0xfd758f['where']=qs[_0xba34('0x2d')](_['pick'](_0x23157e[_0xba34('0x2b')],_0x2013cd[_0xba34('0x2d')]),_0x5c6742);if(_0x23157e[_0xba34('0x2b')][_0xba34('0x35')]){_0xfd758f['where']=_[_0xba34('0x36')](_0xfd758f[_0xba34('0x37')],{'$or':_[_0xba34('0x26')](_0x5c6742,function(_0x2270e7){if(_0x2270e7[_0xba34('0x29')]!=='VIRTUAL'){var _0x171f67={};_0x171f67[_0x2270e7[_0xba34('0x23')]]={'$like':'%'+_0x23157e[_0xba34('0x2b')][_0xba34('0x35')]+'%'};return _0x171f67;}})});}_0xfd758f=_['merge']({},_0xfd758f,_0x23157e[_0xba34('0x38')]);var _0x4527f9={'where':_0xfd758f[_0xba34('0x37')]};return db['Pause'][_0xba34('0x39')](_0x4527f9)[_0xba34('0x20')](function(_0x442c3f){_0x1f57bf[_0xba34('0x39')]=_0x442c3f;if(_0x23157e[_0xba34('0x2b')][_0xba34('0x3a')]){_0xfd758f['include']=[{'all':!![]}];}return db[_0xba34('0x3b')][_0xba34('0x3c')](_0xfd758f);})['then'](function(_0x4f3e8c){_0x1f57bf[_0xba34('0x3d')]=_0x4f3e8c;return _0x1f57bf;})['then'](respondWithFilteredResult(_0x2de112,_0xfd758f))[_0xba34('0x3e')](handleError(_0x2de112,null));};exports[_0xba34('0x3f')]=function(_0x6c5c9a,_0xb8a74d){var _0x39c57e={'raw':!![],'where':{'id':_0x6c5c9a[_0xba34('0x40')]['id']}},_0x4035d3={};_0x4035d3[_0xba34('0x2a')]=_[_0xba34('0x2c')](db[_0xba34('0x3b')][_0xba34('0x27')]);_0x4035d3[_0xba34('0x2b')]=_[_0xba34('0x2c')](_0x6c5c9a[_0xba34('0x2b')]);_0x4035d3[_0xba34('0x2d')]=_[_0xba34('0x2e')](_0x4035d3[_0xba34('0x2a')],_0x4035d3[_0xba34('0x2b')]);_0x39c57e['attributes']=_[_0xba34('0x2e')](_0x4035d3[_0xba34('0x2a')],qs[_0xba34('0x41')](_0x6c5c9a[_0xba34('0x2b')][_0xba34('0x41')]));_0x39c57e[_0xba34('0x2f')]=_0x39c57e[_0xba34('0x2f')][_0xba34('0x30')]?_0x39c57e[_0xba34('0x2f')]:_0x4035d3[_0xba34('0x2a')];if(_0x6c5c9a[_0xba34('0x2b')][_0xba34('0x3a')]){_0x39c57e['include']=[{'all':!![]}];}_0x39c57e=_[_0xba34('0x36')]({},_0x39c57e,_0x6c5c9a['options']);return db[_0xba34('0x3b')][_0xba34('0x42')](_0x39c57e)[_0xba34('0x20')](handleEntityNotFound(_0xb8a74d,null))[_0xba34('0x20')](respondWithResult(_0xb8a74d,null))[_0xba34('0x3e')](handleError(_0xb8a74d,null));};exports[_0xba34('0x43')]=function(_0x2a7213,_0x4e5715){return db[_0xba34('0x3b')][_0xba34('0x43')](_0x2a7213[_0xba34('0x44')],{})['then'](function(_0x2d5f1f){var _0x450350=_0x2a7213['user'][_0xba34('0x45')]({'plain':!![]});if(!_0x450350)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x450350['role']===_0xba34('0x46')){var _0x446b64=_0x2d5f1f['get']({'plain':!![]});var _0x133f9a=_0xba34('0x21');return db[_0xba34('0x47')][_0xba34('0x42')]({'where':{'name':_0x133f9a,'userProfileId':_0x450350[_0xba34('0x48')]},'raw':!![]})[_0xba34('0x20')](function(_0x546a77){if(_0x546a77&&_0x546a77['autoAssociation']===0x0){return db[_0xba34('0x49')][_0xba34('0x43')]({'name':_0x446b64[_0xba34('0x23')],'resourceId':_0x446b64['id'],'type':_0x546a77[_0xba34('0x23')],'sectionId':_0x546a77['id']},{})['then'](function(){return _0x2d5f1f;});}else{return _0x2d5f1f;}})[_0xba34('0x3e')](function(_0x394879){logger[_0xba34('0x22')](_0xba34('0x4a'),_0x394879);throw _0x394879;});}return _0x2d5f1f;})[_0xba34('0x20')](respondWithResult(_0x4e5715,0xc9))[_0xba34('0x3e')](handleError(_0x4e5715,null));};exports['update']=function(_0x18203d,_0x323af0){if(_0x18203d['body']['id']){delete _0x18203d['body']['id'];}return db[_0xba34('0x3b')][_0xba34('0x42')]({'where':{'id':_0x18203d[_0xba34('0x40')]['id']}})[_0xba34('0x20')](handleEntityNotFound(_0x323af0,null))[_0xba34('0x20')](saveUpdates(_0x18203d[_0xba34('0x44')],null))[_0xba34('0x20')](respondWithResult(_0x323af0,null))[_0xba34('0x3e')](handleError(_0x323af0,null));};exports[_0xba34('0x4b')]=function(_0x5a1a8e,_0x1eb316){return db[_0xba34('0x3b')]['find']({'where':{'id':_0x5a1a8e[_0xba34('0x40')]['id']}})['then'](handleEntityNotFound(_0x1eb316,null))['then'](removeEntity(_0x1eb316,null))[_0xba34('0x3e')](handleError(_0x1eb316,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 8084078..9792378 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 _0x85ef=['Pause','tools_pauses','lodash','api','request-promise','../../config/environment','exports','define'];(function(_0x4249f5,_0x949cd5){var _0x217990=function(_0x52fe01){while(--_0x52fe01){_0x4249f5['push'](_0x4249f5['shift']());}};_0x217990(++_0x949cd5);}(_0x85ef,0x162));var _0xf85e=function(_0x557c7f,_0x3de638){_0x557c7f=_0x557c7f-0x0;var _0x2e596b=_0x85ef[_0x557c7f];return _0x2e596b;};'use strict';var _=require(_0xf85e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf85e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf85e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf85e('0x3'));var attributes=require('./pause.attributes');module[_0xf85e('0x4')]=function(_0x3610aa,_0x864e22){return _0x3610aa[_0xf85e('0x5')](_0xf85e('0x6'),attributes,{'tableName':_0xf85e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4180=['request-promise','path','rimraf','exports','define','Pause','lodash','../../config/logger','api','bluebird'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x4180,0x7e));var _0x0418=function(_0x1e476b,_0x4ac7b3){_0x1e476b=_0x1e476b-0x0;var _0x4a75b2=_0x4180[_0x1e476b];return _0x4a75b2;};'use strict';var _=require(_0x0418('0x0'));var util=require('util');var logger=require(_0x0418('0x1'))(_0x0418('0x2'));var moment=require('moment');var BPromise=require(_0x0418('0x3'));var rp=require(_0x0418('0x4'));var fs=require('fs');var path=require(_0x0418('0x5'));var rimraf=require(_0x0418('0x6'));var config=require('../../config/environment');var attributes=require('./pause.attributes');module[_0x0418('0x7')]=function(_0x4a86f8,_0x5af629){return _0x4a86f8[_0x0418('0x8')](_0x0418('0x9'),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 cf6efde..342422f 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 _0x1fa7=['options','raw','where','attributes','map','model','include','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowPause','find'];(function(_0x2160d1,_0x10c2dc){var _0x1ed631=function(_0xb8bc73){while(--_0xb8bc73){_0x2160d1['push'](_0x2160d1['shift']());}};_0x1ed631(++_0x10c2dc);}(_0x1fa7,0x151));var _0x71fa=function(_0x424f1a,_0x5906bc){_0x424f1a=_0x424f1a-0x0;var _0x44cbf1=_0x1fa7[_0x424f1a];return _0x44cbf1;};'use strict';var _=require('lodash');var util=require(_0x71fa('0x0'));var moment=require(_0x71fa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71fa('0x2'));var db=require(_0x71fa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x71fa('0x4'))('rpc');var config=require(_0x71fa('0x5'));var jayson=require(_0x71fa('0x6'));var client=jayson[_0x71fa('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa06ae9,_0x442069,_0x37a87c){return new BPromise(function(_0x5bd4ed,_0x51e3f4){return client[_0x71fa('0x8')](_0xa06ae9,_0x37a87c)[_0x71fa('0x9')](function(_0x25da9d){logger[_0x71fa('0xa')](_0x71fa('0xb'),_0x442069,'request\x20sent');logger[_0x71fa('0xc')](_0x71fa('0xd'),_0x442069,_0x71fa('0xe'),JSON[_0x71fa('0xf')](_0x25da9d));if(_0x25da9d[_0x71fa('0x10')]){if(_0x25da9d['error'][_0x71fa('0x11')]===0x1f4){logger[_0x71fa('0x10')]('Pause,\x20%s,\x20%s',_0x442069,_0x25da9d[_0x71fa('0x10')][_0x71fa('0x12')]);return _0x51e3f4(_0x25da9d['error'][_0x71fa('0x12')]);}logger[_0x71fa('0x10')](_0x71fa('0xb'),_0x442069,_0x25da9d[_0x71fa('0x10')][_0x71fa('0x12')]);return _0x5bd4ed(_0x25da9d[_0x71fa('0x10')][_0x71fa('0x12')]);}else{logger[_0x71fa('0xa')]('Pause,\x20%s,\x20%s',_0x442069,_0x71fa('0xe'));_0x5bd4ed(_0x25da9d[_0x71fa('0x13')][_0x71fa('0x12')]);}})[_0x71fa('0x14')](function(_0x542e1a){logger['error'](_0x71fa('0xb'),_0x442069,_0x542e1a);_0x51e3f4(_0x542e1a);});});}exports[_0x71fa('0x15')]=function(_0x1f88b5){var _0x2e8d57=this;return new Promise(function(_0xa78e6a,_0x3ddb6b){return db['Pause'][_0x71fa('0x16')]({'raw':_0x1f88b5['options']?_0x1f88b5[_0x71fa('0x17')][_0x71fa('0x18')]===undefined?!![]:![]:!![],'where':_0x1f88b5[_0x71fa('0x17')]?_0x1f88b5[_0x71fa('0x17')][_0x71fa('0x19')]||null:null,'attributes':_0x1f88b5['options']?_0x1f88b5[_0x71fa('0x17')][_0x71fa('0x1a')]||null:null,'include':_0x1f88b5[_0x71fa('0x17')]?_0x1f88b5[_0x71fa('0x17')]['include']?_[_0x71fa('0x1b')](_0x1f88b5['options']['include'],function(_0x1c7041){return{'model':db[_0x1c7041[_0x71fa('0x1c')]],'as':_0x1c7041['as'],'attributes':_0x1c7041[_0x71fa('0x1a')],'include':_0x1c7041[_0x71fa('0x1d')]?_[_0x71fa('0x1b')](_0x1c7041[_0x71fa('0x1d')],function(_0x4490ed){return{'model':db[_0x4490ed[_0x71fa('0x1c')]],'as':_0x4490ed['as'],'attributes':_0x4490ed[_0x71fa('0x1a')],'include':_0x4490ed[_0x71fa('0x1d')]?_['map'](_0x4490ed[_0x71fa('0x1d')],function(_0x4ad521){return{'model':db[_0x4ad521[_0x71fa('0x1c')]],'as':_0x4ad521['as'],'attributes':_0x4ad521[_0x71fa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x71fa('0x9')](function(_0x24274c){logger['info']('ShowPause',_0x1f88b5);logger[_0x71fa('0xc')](_0x71fa('0x15'),_0x1f88b5,JSON[_0x71fa('0xf')](_0x24274c));_0xa78e6a(_0x24274c);})[_0x71fa('0x14')](function(_0x41b50f){logger[_0x71fa('0x10')](_0x71fa('0x15'),_0x41b50f[_0x71fa('0x12')],_0x1f88b5);_0x3ddb6b(_0x2e8d57[_0x71fa('0x10')](0x1f4,_0x41b50f[_0x71fa('0x12')]));});});}; \ No newline at end of file +var _0xebb1=['options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','Pause','find'];(function(_0xc944b8,_0x70f7e5){var _0x2d2f4c=function(_0x5eaca1){while(--_0x5eaca1){_0xc944b8['push'](_0xc944b8['shift']());}};_0x2d2f4c(++_0x70f7e5);}(_0xebb1,0x1d8));var _0x1ebb=function(_0x5bce5e,_0x54df30){_0x5bce5e=_0x5bce5e-0x0;var _0x4d205e=_0xebb1[_0x5bce5e];return _0x4d205e;};'use strict';var _=require(_0x1ebb('0x0'));var util=require(_0x1ebb('0x1'));var moment=require(_0x1ebb('0x2'));var BPromise=require(_0x1ebb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ebb('0x4'))['db'];var utils=require(_0x1ebb('0x5'));var logger=require('../../config/logger')(_0x1ebb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ebb('0x7')][_0x1ebb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e8e0a,_0x5cf79e,_0x4eaad1){return new BPromise(function(_0x2e957c,_0x14add6){return client['request'](_0x2e8e0a,_0x4eaad1)[_0x1ebb('0x9')](function(_0x2244fd){logger[_0x1ebb('0xa')](_0x1ebb('0xb'),_0x5cf79e,_0x1ebb('0xc'));logger[_0x1ebb('0xd')](_0x1ebb('0xe'),_0x5cf79e,_0x1ebb('0xc'),JSON[_0x1ebb('0xf')](_0x2244fd));if(_0x2244fd['error']){if(_0x2244fd[_0x1ebb('0x10')][_0x1ebb('0x11')]===0x1f4){logger[_0x1ebb('0x10')](_0x1ebb('0xb'),_0x5cf79e,_0x2244fd[_0x1ebb('0x10')][_0x1ebb('0x12')]);return _0x14add6(_0x2244fd[_0x1ebb('0x10')]['message']);}logger[_0x1ebb('0x10')]('Pause,\x20%s,\x20%s',_0x5cf79e,_0x2244fd[_0x1ebb('0x10')][_0x1ebb('0x12')]);return _0x2e957c(_0x2244fd['error'][_0x1ebb('0x12')]);}else{logger[_0x1ebb('0xa')](_0x1ebb('0xb'),_0x5cf79e,_0x1ebb('0xc'));_0x2e957c(_0x2244fd[_0x1ebb('0x13')][_0x1ebb('0x12')]);}})[_0x1ebb('0x14')](function(_0x2444e1){logger[_0x1ebb('0x10')](_0x1ebb('0xb'),_0x5cf79e,_0x2444e1);_0x14add6(_0x2444e1);});});}exports[_0x1ebb('0x15')]=function(_0x1dc441){var _0x3eb2fc=this;return new Promise(function(_0x5b82cb,_0x10b985){return db[_0x1ebb('0x16')][_0x1ebb('0x17')]({'raw':_0x1dc441[_0x1ebb('0x18')]?_0x1dc441[_0x1ebb('0x18')][_0x1ebb('0x19')]===undefined?!![]:![]:!![],'where':_0x1dc441[_0x1ebb('0x18')]?_0x1dc441[_0x1ebb('0x18')][_0x1ebb('0x1a')]||null:null,'attributes':_0x1dc441[_0x1ebb('0x18')]?_0x1dc441[_0x1ebb('0x18')][_0x1ebb('0x1b')]||null:null,'include':_0x1dc441[_0x1ebb('0x18')]?_0x1dc441[_0x1ebb('0x18')]['include']?_[_0x1ebb('0x1c')](_0x1dc441[_0x1ebb('0x18')][_0x1ebb('0x1d')],function(_0x5e2578){return{'model':db[_0x5e2578['model']],'as':_0x5e2578['as'],'attributes':_0x5e2578['attributes'],'include':_0x5e2578[_0x1ebb('0x1d')]?_[_0x1ebb('0x1c')](_0x5e2578['include'],function(_0x5eb6f){return{'model':db[_0x5eb6f[_0x1ebb('0x1e')]],'as':_0x5eb6f['as'],'attributes':_0x5eb6f['attributes'],'include':_0x5eb6f['include']?_[_0x1ebb('0x1c')](_0x5eb6f[_0x1ebb('0x1d')],function(_0x300c8c){return{'model':db[_0x300c8c[_0x1ebb('0x1e')]],'as':_0x300c8c['as'],'attributes':_0x300c8c[_0x1ebb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ebb('0x9')](function(_0x46f66f){logger['info'](_0x1ebb('0x15'),_0x1dc441);logger[_0x1ebb('0xd')]('ShowPause',_0x1dc441,JSON[_0x1ebb('0xf')](_0x46f66f));_0x5b82cb(_0x46f66f);})[_0x1ebb('0x14')](function(_0xdb1ebd){logger[_0x1ebb('0x10')]('ShowPause',_0xdb1ebd[_0x1ebb('0x12')],_0x1dc441);_0x10b985(_0x3eb2fc[_0x1ebb('0x10')](0x1f4,_0xdb1ebd['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 26ee6e5..3397837 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 _0x1631=['now','post','single','file','put','update','delete','exports','multer','path','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','root','originalname','format','basename','extname'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x1631,0x167));var _0x1163=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1631[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x1163('0x0'));var util=require('util');var path=require(_0x1163('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x1163('0x2'));var interaction=require(_0x1163('0x3'));var config=require('../../config/environment');var controller=require('./plugin.controller');router[_0x1163('0x4')]('/',auth[_0x1163('0x5')](),controller[_0x1163('0x6')]);router['get'](_0x1163('0x7'),controller[_0x1163('0x8')]);router[_0x1163('0x4')](_0x1163('0x9'),auth[_0x1163('0x5')](),controller['show']);router['get'](_0x1163('0xa'),auth[_0x1163('0x5')](),controller[_0x1163('0xb')]);var upload=multer({'storage':multer[_0x1163('0xc')]({'destination':function(_0x5a5a61,_0x23a3ff,_0x1f5571){_0x1f5571(null,path[_0x1163('0xd')](config[_0x1163('0xe')],'server/files/plugins'));},'filename':function(_0x387d6f,_0x3b2922,_0x30452d){_0x3b2922['originalname']=_0x3b2922[_0x1163('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x30452d(null,util[_0x1163('0x10')]('%s-%s%s',path[_0x1163('0x11')](_0x3b2922[_0x1163('0xf')],path[_0x1163('0x12')](_0x3b2922['originalname'])),Date[_0x1163('0x13')](),path[_0x1163('0x12')](_0x3b2922[_0x1163('0xf')])));}})});router[_0x1163('0x14')]('/',upload[_0x1163('0x15')](_0x1163('0x16')),controller['upload']);router[_0x1163('0x14')]('/webhook',controller['webhookPost']);router[_0x1163('0x17')](_0x1163('0x9'),auth['isAuthenticated'](),controller[_0x1163('0x18')]);router[_0x1163('0x19')](_0x1163('0x9'),auth['isAuthenticated'](),controller[_0x1163('0x19')]);module[_0x1163('0x1a')]=router; \ No newline at end of file +var _0x5abf=['extname','now','post','file','upload','webhookPost','put','update','delete','exports','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s'];(function(_0x599d3e,_0x25b9fa){var _0x48cd9e=function(_0x30e930){while(--_0x30e930){_0x599d3e['push'](_0x599d3e['shift']());}};_0x48cd9e(++_0x25b9fa);}(_0x5abf,0xd5));var _0xf5ab=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x5abf[_0x3cba93];return _0x4a2991;};'use strict';var multer=require('multer');var util=require(_0xf5ab('0x0'));var path=require(_0xf5ab('0x1'));var timeout=require(_0xf5ab('0x2'));var express=require('express');var router=express[_0xf5ab('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf5ab('0x4'));var controller=require('./plugin.controller');router[_0xf5ab('0x5')]('/',auth[_0xf5ab('0x6')](),controller['index']);router['get'](_0xf5ab('0x7'),controller['webhookGet']);router[_0xf5ab('0x5')](_0xf5ab('0x8'),auth['isAuthenticated'](),controller[_0xf5ab('0x9')]);router['get'](_0xf5ab('0xa'),auth[_0xf5ab('0x6')](),controller[_0xf5ab('0xb')]);var upload=multer({'storage':multer[_0xf5ab('0xc')]({'destination':function(_0x569723,_0x3c0408,_0x366745){_0x366745(null,path[_0xf5ab('0xd')](config[_0xf5ab('0xe')],_0xf5ab('0xf')));},'filename':function(_0x1fb069,_0x4bb7ab,_0x31983b){_0x4bb7ab['originalname']=_0x4bb7ab[_0xf5ab('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x31983b(null,util[_0xf5ab('0x11')](_0xf5ab('0x12'),path['basename'](_0x4bb7ab['originalname'],path[_0xf5ab('0x13')](_0x4bb7ab[_0xf5ab('0x10')])),Date[_0xf5ab('0x14')](),path[_0xf5ab('0x13')](_0x4bb7ab[_0xf5ab('0x10')])));}})});router[_0xf5ab('0x15')]('/',upload['single'](_0xf5ab('0x16')),controller[_0xf5ab('0x17')]);router[_0xf5ab('0x15')]('/webhook',controller[_0xf5ab('0x18')]);router[_0xf5ab('0x19')](_0xf5ab('0x8'),auth[_0xf5ab('0x6')](),controller[_0xf5ab('0x1a')]);router[_0xf5ab('0x1b')](_0xf5ab('0x8'),auth[_0xf5ab('0x6')](),controller[_0xf5ab('0x1b')]);module[_0xf5ab('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1cf0b07..274d19b 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 _0xa289=['agentOnly','never','always','sequelize','exports','ENUM','script','TEXT','STRING','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x4d3924,_0x327b56){var _0x844555=function(_0x387a6d){while(--_0x387a6d){_0x4d3924['push'](_0x4d3924['shift']());}};_0x844555(++_0x327b56);}(_0xa289,0x1ef));var _0x9a28=function(_0x530a60,_0x3709aa){_0x530a60=_0x530a60-0x0;var _0x2b0440=_0xa289[_0x530a60];return _0x2b0440;};'use strict';var Sequelize=require(_0x9a28('0x0'));module[_0x9a28('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9a28('0x2')]('html',_0x9a28('0x3'))},'description':{'type':Sequelize[_0x9a28('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x9a28('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x9a28('0x6')],'defaultValue':0x0,'comment':_0x9a28('0x7')},'sidebar':{'type':Sequelize[_0x9a28('0x2')](_0x9a28('0x8'),_0x9a28('0x9'),'always',_0x9a28('0xa')),'defaultValue':_0x9a28('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x9a28('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x9a28('0x5')]},'scriptName':{'type':Sequelize[_0x9a28('0x5')]},'scriptPath':{'type':Sequelize[_0x9a28('0x5')]}}; \ No newline at end of file +var _0x1864=['exports','ENUM','html','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','sequelize'];(function(_0x472ee2,_0x295444){var _0x18387b=function(_0x320611){while(--_0x320611){_0x472ee2['push'](_0x472ee2['shift']());}};_0x18387b(++_0x295444);}(_0x1864,0x17b));var _0x4186=function(_0x32a0e7,_0x3eb0be){_0x32a0e7=_0x32a0e7-0x0;var _0x57c651=_0x1864[_0x32a0e7];return _0x57c651;};'use strict';var Sequelize=require(_0x4186('0x0'));module[_0x4186('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4186('0x2')](_0x4186('0x3'),'script')},'description':{'type':Sequelize[_0x4186('0x4')]},'version':{'type':Sequelize[_0x4186('0x4')]},'path':{'type':Sequelize[_0x4186('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4186('0x6')},'sidebar':{'type':Sequelize[_0x4186('0x2')](_0x4186('0x7'),_0x4186('0x8'),'always','never'),'defaultValue':_0x4186('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x4186('0x5')]},'adminUrl':{'type':Sequelize[_0x4186('0x5')]},'agentUrl':{'type':Sequelize[_0x4186('0x5')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x4186('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 8095eae..2e44f8e 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 _0x8b2e=['existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','UserProfileSection','Plugins','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','set','endsWith','statusCode','webhookPost','content-type','html-pdf','eml-format','zip-dir','request-promise','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','./plugin.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','download','find','join','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','root','dirname','attachments/**/*','finalize','close'];(function(_0x2a23c1,_0x5d7fb3){var _0x8943d1=function(_0x416e13){while(--_0x416e13){_0x2a23c1['push'](_0x2a23c1['shift']());}};_0x8943d1(++_0x5d7fb3);}(_0x8b2e,0x1a5));var _0xe8b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b2e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe8b2('0x0'));var emlformat=require(_0xe8b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe8b2('0x4'));var sox=require('sox');var csv=require(_0xe8b2('0x5'));var ejs=require(_0xe8b2('0x6'));var fs=require('fs');var _=require(_0xe8b2('0x7'));var squel=require('squel');var crypto=require(_0xe8b2('0x8'));var jsforce=require(_0xe8b2('0x9'));var deskjs=require(_0xe8b2('0xa'));var toCsv=require(_0xe8b2('0x5'));var querystring=require(_0xe8b2('0xb'));var Papa=require(_0xe8b2('0xc'));var extract=require(_0xe8b2('0xd'));var rimraf=require('rimraf');var archiver=require(_0xe8b2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe8b2('0xf'));var as=require(_0xe8b2('0x10'));var hardwareService=require(_0xe8b2('0x11'));var logger=require(_0xe8b2('0x12'))(_0xe8b2('0x13'));var utils=require(_0xe8b2('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe8b2('0x15')]=_['defaults'](config['redis'],{'host':_0xe8b2('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8b2('0x15')]));require(_0xe8b2('0x17'))[_0xe8b2('0x18')](socket);function respondWithStatusCode(_0x3ab00c,_0x53fee7){_0x53fee7=_0x53fee7||0xcc;return function(_0x4f2f79){if(_0x4f2f79){return _0x3ab00c[_0xe8b2('0x19')](_0x53fee7);}return _0x3ab00c[_0xe8b2('0x1a')](_0x53fee7)[_0xe8b2('0x1b')]();};}function respondWithResult(_0x5cd4a5,_0x4403af){_0x4403af=_0x4403af||0xc8;return function(_0x165d67){if(_0x165d67){return _0x5cd4a5[_0xe8b2('0x1a')](_0x4403af)['json'](_0x165d67);}};}function respondWithFilteredResult(_0x1b36cd,_0x581bf2){return function(_0x2dd98d){if(_0x2dd98d){var _0x2677d0=_0x2dd98d[_0xe8b2('0x1c')],_0x40ad71=_0x581bf2['offset'],_0x4f75dc=_0x581bf2[_0xe8b2('0x1d')]+_0x581bf2[_0xe8b2('0x1e')],_0x39e0ae;if(_0x4f75dc>=_0x2677d0){_0x4f75dc=_0x2677d0;_0x39e0ae=0xc8;}else{_0x39e0ae=0xce;}_0x1b36cd['status'](_0x39e0ae);return _0x1b36cd['set'](_0xe8b2('0x1f'),_0x40ad71+'-'+_0x4f75dc+'/'+_0x2677d0)[_0xe8b2('0x20')](_0x2dd98d);}return null;};}function patchUpdates(_0x4810e3){return function(_0xa7ce7b){try{jsonpatch[_0xe8b2('0x21')](_0xa7ce7b,_0x4810e3,!![]);}catch(_0x6c99e9){return BPromise[_0xe8b2('0x22')](_0x6c99e9);}return _0xa7ce7b[_0xe8b2('0x23')]();};}function saveUpdates(_0x443418,_0x52afcf){return function(_0x5258b6){if(_0x5258b6){return _0x5258b6[_0xe8b2('0x24')](_0x443418)[_0xe8b2('0x25')](function(_0xdb2679){return _0xdb2679;});}return null;};}function removeEntity(_0x6b17a5,_0x587cfa){return function(_0x22ec75){if(_0x22ec75){return _0x22ec75['destroy']()[_0xe8b2('0x25')](function(){var _0x327761=_0x22ec75[_0xe8b2('0x26')]({'plain':!![]});var _0x3e39b4='Plugins';return db[_0xe8b2('0x27')][_0xe8b2('0x28')]({'where':{'type':_0x3e39b4,'resourceId':_0x327761['id']}})['then'](function(){return _0x22ec75;});})['then'](function(){_0x6b17a5[_0xe8b2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ef28,_0x5e8a5a){return function(_0x456fa6){if(!_0x456fa6){_0x47ef28[_0xe8b2('0x19')](0x194);}return _0x456fa6;};}function handleError(_0x42083b,_0x1e7cb3){_0x1e7cb3=_0x1e7cb3||0x1f4;return function(_0x3cbca5){logger[_0xe8b2('0x29')](_0x3cbca5[_0xe8b2('0x2a')]);if(_0x3cbca5['name']){delete _0x3cbca5[_0xe8b2('0x2b')];}_0x42083b[_0xe8b2('0x1a')](_0x1e7cb3)[_0xe8b2('0x2c')](_0x3cbca5);};}exports[_0xe8b2('0x2d')]=function(_0x1e5435,_0x2a17ba){var _0x3e533d={},_0x3e84cb={},_0x13438b={'count':0x0,'rows':[]};var _0x346ef9=_[_0xe8b2('0x2e')](db[_0xe8b2('0x2f')][_0xe8b2('0x30')],function(_0x1f13dc){return{'name':_0x1f13dc[_0xe8b2('0x31')],'type':_0x1f13dc['type'][_0xe8b2('0x32')]};});_0x3e84cb['model']=_['map'](_0x346ef9,_0xe8b2('0x2b'));_0x3e84cb[_0xe8b2('0x33')]=_[_0xe8b2('0x34')](_0x1e5435['query']);_0x3e84cb[_0xe8b2('0x35')]=_[_0xe8b2('0x36')](_0x3e84cb[_0xe8b2('0x37')],_0x3e84cb[_0xe8b2('0x33')]);_0x3e533d['attributes']=_['intersection'](_0x3e84cb[_0xe8b2('0x37')],qs[_0xe8b2('0x38')](_0x1e5435['query'][_0xe8b2('0x38')]));_0x3e533d['attributes']=_0x3e533d[_0xe8b2('0x39')]['length']?_0x3e533d[_0xe8b2('0x39')]:_0x3e84cb[_0xe8b2('0x37')];if(!_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x3a')](_0xe8b2('0x3b'))){_0x3e533d[_0xe8b2('0x1e')]=qs[_0xe8b2('0x1e')](_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x1e')]);_0x3e533d[_0xe8b2('0x1d')]=qs['offset'](_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x1d')]);}_0x3e533d[_0xe8b2('0x3c')]=qs[_0xe8b2('0x3d')](_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x3d')]);_0x3e533d[_0xe8b2('0x3e')]=qs[_0xe8b2('0x35')](_[_0xe8b2('0x3f')](_0x1e5435[_0xe8b2('0x33')],_0x3e84cb[_0xe8b2('0x35')]),_0x346ef9);if(_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x40')]){_0x3e533d[_0xe8b2('0x3e')]=_[_0xe8b2('0x41')](_0x3e533d['where'],{'$or':_['map'](_0x346ef9,function(_0x4605a4){if(_0x4605a4[_0xe8b2('0x42')]!==_0xe8b2('0x43')){var _0x449222={};_0x449222[_0x4605a4['name']]={'$like':'%'+_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x40')]+'%'};return _0x449222;}})});}_0x3e533d=_[_0xe8b2('0x41')]({},_0x3e533d,_0x1e5435[_0xe8b2('0x44')]);var _0x5fa104={'where':_0x3e533d[_0xe8b2('0x3e')]};return db[_0xe8b2('0x2f')]['count'](_0x5fa104)[_0xe8b2('0x25')](function(_0x303cfb){_0x13438b[_0xe8b2('0x1c')]=_0x303cfb;if(_0x1e5435[_0xe8b2('0x33')][_0xe8b2('0x45')]){_0x3e533d[_0xe8b2('0x46')]=[{'all':!![]}];}return db[_0xe8b2('0x2f')][_0xe8b2('0x47')](_0x3e533d);})[_0xe8b2('0x25')](function(_0x307f9c){_0x13438b[_0xe8b2('0x48')]=_0x307f9c;return _0x13438b;})['then'](respondWithFilteredResult(_0x2a17ba,_0x3e533d))[_0xe8b2('0x49')](handleError(_0x2a17ba,null));};exports[_0xe8b2('0x4a')]=function(_0x2b48f9,_0xa31d67){var _0x51899a={'raw':!![],'where':{'id':_0x2b48f9[_0xe8b2('0x4b')]['id']}},_0x4b6a67={};_0x4b6a67[_0xe8b2('0x37')]=_[_0xe8b2('0x34')](db[_0xe8b2('0x2f')][_0xe8b2('0x30')]);_0x4b6a67[_0xe8b2('0x33')]=_[_0xe8b2('0x34')](_0x2b48f9['query']);_0x4b6a67[_0xe8b2('0x35')]=_[_0xe8b2('0x36')](_0x4b6a67[_0xe8b2('0x37')],_0x4b6a67['query']);_0x51899a[_0xe8b2('0x39')]=_[_0xe8b2('0x36')](_0x4b6a67['model'],qs['fields'](_0x2b48f9[_0xe8b2('0x33')][_0xe8b2('0x38')]));_0x51899a[_0xe8b2('0x39')]=_0x51899a[_0xe8b2('0x39')][_0xe8b2('0x4c')]?_0x51899a[_0xe8b2('0x39')]:_0x4b6a67[_0xe8b2('0x37')];if(_0x2b48f9[_0xe8b2('0x33')][_0xe8b2('0x45')]){_0x51899a['include']=[{'all':!![]}];}_0x51899a=_['merge']({},_0x51899a,_0x2b48f9[_0xe8b2('0x44')]);return db['Plugin']['find'](_0x51899a)[_0xe8b2('0x25')](handleEntityNotFound(_0xa31d67,null))[_0xe8b2('0x25')](respondWithResult(_0xa31d67,null))[_0xe8b2('0x49')](handleError(_0xa31d67,null));};exports[_0xe8b2('0x4d')]=function(_0x963dde,_0x24ece9,_0x6fce3f){return db[_0xe8b2('0x2f')][_0xe8b2('0x4e')]({'where':{'id':_0x963dde[_0xe8b2('0x4b')]['id']},'attributes':[_0xe8b2('0x2b'),_0xe8b2('0x4')],'raw':!![]})[_0xe8b2('0x25')](handleEntityNotFound(_0x24ece9,null))['then'](function(_0x503d93){if(_0x503d93){var _0x4d56a4=path[_0xe8b2('0x4f')](config['root'],_0xe8b2('0x50'),util[_0xe8b2('0x51')](_0xe8b2('0x52'),path[_0xe8b2('0x53')](_0x503d93[_0xe8b2('0x4')])));var _0x300ec3=fs[_0xe8b2('0x54')](_0x4d56a4);var _0x4ac414=archiver('zip',{'zlib':{'level':0x9}});_0x4ac414['on'](_0xe8b2('0x55'),function(_0x14eeef){if(_0x14eeef[_0xe8b2('0x56')]===_0xe8b2('0x57')){logger[_0xe8b2('0x29')](_0x14eeef);}else{throw new db[(_0xe8b2('0x58'))][(_0xe8b2('0x59'))](_0xe8b2('0x5a'));}});_0x4ac414['on'](_0xe8b2('0x29'),function(_0x29b719){throw new db[(_0xe8b2('0x58'))][(_0xe8b2('0x59'))](_0xe8b2('0x5a'));});_0x4ac414['pipe'](_0x300ec3);_0x4ac414[_0xe8b2('0x5b')](_0xe8b2('0x5c'),{'cwd':path['join'](config[_0xe8b2('0x5d')],'server/files/plugins',path[_0xe8b2('0x5e')](_0x503d93['path'])),'ignore':[path['join'](path[_0xe8b2('0x53')](_0x503d93[_0xe8b2('0x4')]),'node_modules/**/*'),path['join'](path[_0xe8b2('0x53')](_0x503d93[_0xe8b2('0x4')]),_0xe8b2('0x5f'))],'nodir':!![]})[_0xe8b2('0x60')]();_0x300ec3['on'](_0xe8b2('0x61'),function(){if(!fs[_0xe8b2('0x62')](_0x4d56a4)){throw new db[(_0xe8b2('0x58'))][(_0xe8b2('0x59'))](_0xe8b2('0x63'));}return _0x24ece9[_0xe8b2('0x4d')](_0x4d56a4,util[_0xe8b2('0x51')](_0xe8b2('0x52'),path[_0xe8b2('0x53')](_0x503d93[_0xe8b2('0x4')])),function(_0xe22d6a){if(_0xe22d6a){throw new db[(_0xe8b2('0x58'))][(_0xe8b2('0x59'))](_0xe8b2('0x64'));}fs[_0xe8b2('0x65')](_0x4d56a4);logger[_0xe8b2('0x66')](_0xe8b2('0x67'));logger['info'](_0xe8b2('0x68'));});});}return null;})[_0xe8b2('0x49')](handleError(_0x24ece9,null));};exports[_0xe8b2('0x69')]=function(_0x132b8d,_0x5e49bb,_0x4c1510){var _0x41efd1=path['basename'](_0x132b8d[_0xe8b2('0x6a')]['filename'],path[_0xe8b2('0x6b')](_0x132b8d['file'][_0xe8b2('0x6c')]));var _0x3516be=path['join'](config[_0xe8b2('0x5d')],_0xe8b2('0x50'),_0x132b8d[_0xe8b2('0x6a')]['filename']);var _0x45b987=path[_0xe8b2('0x4f')](config['root'],_0xe8b2('0x50'),_0x41efd1);logger[_0xe8b2('0x66')](_0xe8b2('0x6d'),_0x3516be);logger['info'](_0xe8b2('0x6e'),_0x45b987);try{fs[_0xe8b2('0x6f')](_0x3516be,parseInt(_0xe8b2('0x70'),0x8));extract(_0x3516be,{'dir':_0x45b987},function(_0x4a3258){if(_0x4a3258){logger['error'](_0x4a3258);handleError(_0x4a3258,!![]);};var _0x27c9b6=fs[_0xe8b2('0x71')](_0x45b987);if(_0x27c9b6[_0xe8b2('0x4c')]>0x1){removeReferences(_0x3516be,_0x45b987);logger[_0xe8b2('0x29')](_0xe8b2('0x72'));return _0x4c1510(new Error(_0xe8b2('0x72')));}var _0x4868a6=fs[_0xe8b2('0x73')](path[_0xe8b2('0x4f')](_0x45b987,_0x27c9b6[0x0]));if(_0x4868a6[_0xe8b2('0x74')]()){removeReferences(_0x3516be,_0x45b987);logger[_0xe8b2('0x29')](_0xe8b2('0x72'));return _0x4c1510(new Error('Invalid\x20plugin\x20structure'));}if(_0x4868a6[_0xe8b2('0x75')]()){var _0x403af0=fs[_0xe8b2('0x71')](path[_0xe8b2('0x4f')](_0x45b987,_0x27c9b6[0x0]));if(_0x403af0['length']===0x0){removeReferences(_0x3516be,_0x45b987);logger[_0xe8b2('0x29')]('Invalid\x20plugin\x20structure');return _0x4c1510(new Error('Invalid\x20plugin\x20structure'));}var _0x43b595=_0x403af0[_0xe8b2('0x76')](function(_0x4e4b9e){return _0x4e4b9e===_0xe8b2('0x77');});if(!_0x43b595){return _0x4c1510(new Error(_0xe8b2('0x78')));}var _0x1b7574=fs['readFileSync'](path[_0xe8b2('0x4f')](_0x45b987,_0x27c9b6[0x0],_0xe8b2('0x77')));var _0x2edad0=JSON[_0xe8b2('0x79')](_0x1b7574);if(_0xe8b2('0x7a')==typeof _0x2edad0['name']){return _0x4c1510(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x2edad0[_0xe8b2('0x42')]){return _0x4c1510(new Error(_0xe8b2('0x7b')));}if(_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7c')]){return _0x4c1510(new Error(_0xe8b2('0x7d')));}if(_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7e')]){return _0x4c1510(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2edad0['type']==='html'){if('undefined'==typeof _0x2edad0['parameters']['views']){return _0x4c1510(new Error(_0xe8b2('0x7f')));}if(_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')]['admin']&&_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7e')]['views'][_0xe8b2('0x81')]){return _0x4c1510(new Error(_0xe8b2('0x82')));}}else if(_0x2edad0[_0xe8b2('0x42')]===_0xe8b2('0x83')){if(_0xe8b2('0x7a')==typeof _0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x84')]){return _0x4c1510(new Error(_0xe8b2('0x85')));}if(_0xe8b2('0x7a')==typeof _0x2edad0['parameters'][_0xe8b2('0x86')]){return _0x4c1510(new Error(_0xe8b2('0x87')));}}else{return _0x4c1510(new Error(_0xe8b2('0x88')));}var _0x59540b=_0x2edad0[_0xe8b2('0x2b')];var _0x12fc66=_0x2edad0[_0xe8b2('0x89')];var _0x58ab16=_0x2edad0['type'];var _0x43784e=_0x2edad0[_0xe8b2('0x8a')]?_0x2edad0[_0xe8b2('0x8a')]:_0xe8b2('0x8b');var _0x3d144a=_0x2edad0[_0xe8b2('0x8c')]?_0x2edad0[_0xe8b2('0x8c')]:'icon-apps';var _0x2dc45a='';var _0x5d5075='';var _0x25dba2='';var _0x1aa6aa='';var _0x4013b4=_0x2edad0[_0xe8b2('0x7c')];if(_0x58ab16===_0xe8b2('0x8d')){if('undefined'!=typeof _0x2edad0[_0xe8b2('0x7e')]['views'][_0xe8b2('0x8e')]){var _0x454210=_0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xe8b2('0x8f')](_0x454210)){_0x2dc45a=path[_0xe8b2('0x4f')](_0xe8b2('0x90'),_0x41efd1,_0x27c9b6[0x0],_0x454210);}else{_0x2dc45a=_0x454210;}}else{logger[_0xe8b2('0x66')](_0xe8b2('0x91'));}if(_0xe8b2('0x7a')!=typeof _0x2edad0[_0xe8b2('0x7e')]['views']['agent']){var _0x1eb344=_0x2edad0[_0xe8b2('0x7e')]['views'][_0xe8b2('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xe8b2('0x8f')](_0x1eb344)){_0x5d5075=path[_0xe8b2('0x4f')](_0xe8b2('0x90'),_0x41efd1,_0x27c9b6[0x0],_0x1eb344);}else{_0x5d5075=_0x1eb344;}}else{logger[_0xe8b2('0x66')](_0xe8b2('0x92'));}}else if(_0x58ab16===_0xe8b2('0x83')){_0x25dba2=_0x2edad0['parameters'][_0xe8b2('0x84')];_0x1aa6aa=_0x2edad0['parameters'][_0xe8b2('0x86')];if(_0xe8b2('0x7a')!=typeof _0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')]){if('undefined'!=typeof _0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')][_0xe8b2('0x8e')]){var _0x454210=_0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')][_0xe8b2('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xe8b2('0x8f')](_0x454210)){_0x2dc45a=path[_0xe8b2('0x4f')](_0xe8b2('0x90'),_0x41efd1,_0x27c9b6[0x0],_0x454210);}else{_0x2dc45a=_0x454210;}}if(_0xe8b2('0x7a')!=typeof _0x2edad0['parameters'][_0xe8b2('0x80')][_0xe8b2('0x81')]){var _0x1eb344=_0x2edad0[_0xe8b2('0x7e')][_0xe8b2('0x80')][_0xe8b2('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xe8b2('0x8f')](_0x1eb344)){_0x5d5075=path[_0xe8b2('0x4f')]('plugins',_0x41efd1,_0x27c9b6[0x0],_0x1eb344);}else{_0x5d5075=_0x1eb344;}}}}var _0x3b5e3f={'name':_0x59540b,'description':_0x12fc66,'path':path[_0xe8b2('0x4f')](_0x41efd1,_0x27c9b6[0x0]),'type':_0x58ab16,'sidebar':_0x43784e,'icon':_0x3d144a,'adminUrl':_0x2dc45a,'agentUrl':_0x5d5075,'scriptName':_0x25dba2,'scriptPath':_0x1aa6aa,'version':_0x4013b4};removeReferences(_0x3516be,null);return db[_0xe8b2('0x2f')][_0xe8b2('0x93')](_0x3b5e3f)[_0xe8b2('0x25')](function(_0x4b7bfc){var _0x4fdf6b={'role':_0x132b8d[_0xe8b2('0x94')]['role'],'userProfileId':_0x132b8d[_0xe8b2('0x94')]['userProfileId']};if(!_0x4fdf6b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fdf6b[_0xe8b2('0x95')]==='user'){var _0x2ac7c7=_0x4b7bfc['get']({'plain':!![]});return db[_0xe8b2('0x96')][_0xe8b2('0x4e')]({'where':{'name':_0xe8b2('0x97'),'userProfileId':_0x4fdf6b[_0xe8b2('0x98')]},'raw':!![]})[_0xe8b2('0x25')](function(_0x48c827){if(_0x48c827&&_0x48c827[_0xe8b2('0x99')]===0x0){return db[_0xe8b2('0x27')][_0xe8b2('0x93')]({'name':_0x2ac7c7['name'],'resourceId':_0x2ac7c7['id'],'type':_0x48c827[_0xe8b2('0x2b')],'sectionId':_0x48c827['id']},{})['then'](function(){return _0x4b7bfc;});}else{return _0x4b7bfc;}})[_0xe8b2('0x49')](function(_0x4b0622){logger[_0xe8b2('0x29')](_0xe8b2('0x9a'),_0x4b0622);throw _0x4b0622;});}return _0x4b7bfc;})['then'](respondWithResult(_0x5e49bb,null))[_0xe8b2('0x49')](handleError(_0x5e49bb,null));}});}catch(_0x3ca752){_0x5e49bb[_0xe8b2('0x1a')](0x1f4)[_0xe8b2('0x2c')](_0x3ca752);}};function removeReferences(_0x291227,_0x69b70d){try{if(_0x291227){fs[_0xe8b2('0x65')](_0x291227);logger[_0xe8b2('0x66')]('Zip\x20archive\x20removed');}if(_0x69b70d){rimraf(_0x69b70d,function(){});logger['info'](_0xe8b2('0x9b'));}}catch(_0x41fe67){logger[_0xe8b2('0x29')](_0x41fe67);}}exports['update']=function(_0x5700c5,_0x587b8a,_0x475c5b){return db['Plugin'][_0xe8b2('0x4e')]({'where':{'id':_0x5700c5[_0xe8b2('0x4b')]['id']}})[_0xe8b2('0x25')](handleEntityNotFound(_0x587b8a,null))[_0xe8b2('0x25')](saveUpdates(_0x5700c5[_0xe8b2('0x94')],null))[_0xe8b2('0x25')](respondWithResult(_0x587b8a,null))['catch'](handleError(_0x587b8a,null));};exports[_0xe8b2('0x9c')]=function(_0x4b25c4,_0x23a350,_0x1de0c3){return db[_0xe8b2('0x2f')][_0xe8b2('0x4e')]({'where':{'id':_0x4b25c4[_0xe8b2('0x4b')]['id']}})['then'](function(_0x5f12bd){if(_0x5f12bd){return _0x5f12bd[_0xe8b2('0x28')]();}})[_0xe8b2('0x25')](function(_0x1d1de1){rimraf(path[_0xe8b2('0x4f')](config[_0xe8b2('0x5d')],_0xe8b2('0x50'),path[_0xe8b2('0x5e')](_0x1d1de1[_0xe8b2('0x4')])),function(){});return _0x1d1de1;})[_0xe8b2('0x25')](handleEntityNotFound(_0x23a350,null))[_0xe8b2('0x25')](respondWithStatusCode(_0x23a350,null))[_0xe8b2('0x49')](handleError(_0x23a350,null));};exports[_0xe8b2('0x9d')]=function(_0x44d7b9,_0x5d011f,_0x10c5d3){return BPromise[_0xe8b2('0x9e')]()['then'](function(){if(!_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x4')]){throw new Error(_0xe8b2('0x9f'));}if(!_0x44d7b9['query'][_0xe8b2('0xa0')]){throw new Error(_0xe8b2('0xa1'));}var _0x1876f9=_0x44d7b9[_0xe8b2('0x33')]['hostname']?_0x44d7b9['query'][_0xe8b2('0xa2')]+':'+_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0xa0')]:_0xe8b2('0xa3')+_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0xa0')];var _0x230ae7=_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x20')]?_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x20')]:!![];var _0x4ef8ab=_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0xa4')]?_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0xa4')]:null;var _0x2cb1c7={'method':_0x44d7b9['method'],'uri':util[_0xe8b2('0x51')](_0xe8b2('0xa5'),_0x1876f9,_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x4')]),'json':_0x230ae7,'resolveWithFullResponse':!![],'encoding':_0x4ef8ab,'qs':_0x44d7b9['query']};if(_0x44d7b9[_0xe8b2('0xa6')]){_0x2cb1c7[_0xe8b2('0xa6')]=_0x44d7b9[_0xe8b2('0xa6')];if(_0x2cb1c7[_0xe8b2('0xa6')][_0xe8b2('0xa7')]){delete _0x2cb1c7[_0xe8b2('0xa6')]['content-length'];}}if(_0x2cb1c7[_0xe8b2('0xa6')]['content-type']){delete _0x2cb1c7[_0xe8b2('0xa6')]['content-type'];}return rp(_0x2cb1c7);})[_0xe8b2('0x25')](function(_0x47ab83){if(_0x47ab83){_0x5d011f[_0xe8b2('0xa8')](_0x47ab83[_0xe8b2('0xa6')]);logger[_0xe8b2('0x66')](_0x47ab83[_0xe8b2('0x94')]);if(_[_0xe8b2('0xa9')](_0x44d7b9[_0xe8b2('0x33')][_0xe8b2('0x4')],_0xe8b2('0x4d'))&&_0x47ab83[_0xe8b2('0xaa')]==0x1f4){return _0x5d011f['sendStatus'](_0x47ab83[_0xe8b2('0xaa')]);}else{return _0x5d011f['status'](_0x47ab83[_0xe8b2('0xaa')])['send'](_0x47ab83[_0xe8b2('0x94')]);}}else{return _0x5d011f[_0xe8b2('0x19')](0xc8);}})[_0xe8b2('0x49')](handleError(_0x5d011f,null));};exports[_0xe8b2('0xab')]=function(_0x3704d4,_0x4d02a5,_0x474b6a){return BPromise[_0xe8b2('0x9e')]()['then'](function(){if(!_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0x4')]){throw new Error(_0xe8b2('0x9f'));}if(!_0x3704d4[_0xe8b2('0x33')]['port']){throw new Error(_0xe8b2('0xa1'));}var _0x1b91dd=_0x3704d4[_0xe8b2('0x33')]['hostname']?_0x3704d4['query'][_0xe8b2('0xa2')]+':'+_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0xa0')]:_0xe8b2('0xa3')+_0x3704d4['query'][_0xe8b2('0xa0')];var _0x2c2ade=_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0x20')]?_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0x20')]:!![];var _0x573139=_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0xa4')]?_0x3704d4['query'][_0xe8b2('0xa4')]:null;var _0x7ca949={'method':_0x3704d4['method'],'uri':util['format'](_0xe8b2('0xa5'),_0x1b91dd,_0x3704d4[_0xe8b2('0x33')][_0xe8b2('0x4')]),'json':_0x2c2ade,'resolveWithFullResponse':!![],'encoding':_0x573139,'body':_0x3704d4[_0xe8b2('0x94')]};if(_0x3704d4[_0xe8b2('0xa6')]){_0x7ca949[_0xe8b2('0xa6')]=_0x3704d4[_0xe8b2('0xa6')];if(_0x7ca949[_0xe8b2('0xa6')][_0xe8b2('0xa7')]){delete _0x7ca949[_0xe8b2('0xa6')][_0xe8b2('0xa7')];}}if(_0x7ca949[_0xe8b2('0xa6')][_0xe8b2('0xac')]){delete _0x7ca949[_0xe8b2('0xa6')][_0xe8b2('0xac')];}return rp(_0x7ca949);})[_0xe8b2('0x25')](function(_0x1677db){if(_0x1677db){_0x4d02a5[_0xe8b2('0xa8')](_0x1677db[_0xe8b2('0xa6')]);logger[_0xe8b2('0x66')](_0x1677db[_0xe8b2('0x94')]);return _0x4d02a5[_0xe8b2('0x1a')](_0x1677db[_0xe8b2('0xaa')])[_0xe8b2('0x2c')](_0x1677db['body']);}else{return _0x4d02a5[_0xe8b2('0x19')](0xc8);}})[_0xe8b2('0x49')](handleError(_0x4d02a5,null));}; \ No newline at end of file +var _0x12fd=['../../config/environment','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','download','find','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils'];(function(_0x1e01d7,_0x517c3b){var _0x1a44a9=function(_0x3fa15a){while(--_0x3fa15a){_0x1e01d7['push'](_0x1e01d7['shift']());}};_0x1a44a9(++_0x517c3b);}(_0x12fd,0x143));var _0xd12f=function(_0x5c8770,_0x1a6190){_0x5c8770=_0x5c8770-0x0;var _0x365344=_0x12fd[_0x5c8770];return _0x365344;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd12f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd12f('0x1'));var jsonpatch=require(_0xd12f('0x2'));var rp=require(_0xd12f('0x3'));var moment=require(_0xd12f('0x4'));var BPromise=require(_0xd12f('0x5'));var Mustache=require(_0xd12f('0x6'));var util=require('util');var path=require(_0xd12f('0x7'));var sox=require(_0xd12f('0x8'));var csv=require(_0xd12f('0x9'));var ejs=require(_0xd12f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd12f('0xb'));var crypto=require('crypto');var jsforce=require(_0xd12f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd12f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xd12f('0xd'));var rimraf=require(_0xd12f('0xe'));var archiver=require(_0xd12f('0xf'));var Redis=require(_0xd12f('0x10'));var authService=require(_0xd12f('0x11'));var qs=require(_0xd12f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd12f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd12f('0x14'));var config=require(_0xd12f('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd12f('0x16')](config['redis'],{'host':_0xd12f('0x17'),'port':0x18eb});var socket=require(_0xd12f('0x18'))(new Redis(config[_0xd12f('0x19')]));require(_0xd12f('0x1a'))[_0xd12f('0x1b')](socket);function respondWithStatusCode(_0x3dc7bf,_0x224c31){_0x224c31=_0x224c31||0xcc;return function(_0x2188f0){if(_0x2188f0){return _0x3dc7bf[_0xd12f('0x1c')](_0x224c31);}return _0x3dc7bf[_0xd12f('0x1d')](_0x224c31)[_0xd12f('0x1e')]();};}function respondWithResult(_0x7058c,_0x307500){_0x307500=_0x307500||0xc8;return function(_0x4f24e6){if(_0x4f24e6){return _0x7058c[_0xd12f('0x1d')](_0x307500)[_0xd12f('0x1f')](_0x4f24e6);}};}function respondWithFilteredResult(_0x3d9506,_0xc3a388){return function(_0x325b9b){if(_0x325b9b){var _0x16c8dc=_0x325b9b[_0xd12f('0x20')],_0x80b3f2=_0xc3a388[_0xd12f('0x21')],_0x1c0225=_0xc3a388[_0xd12f('0x21')]+_0xc3a388[_0xd12f('0x22')],_0x3e7dd3;if(_0x1c0225>=_0x16c8dc){_0x1c0225=_0x16c8dc;_0x3e7dd3=0xc8;}else{_0x3e7dd3=0xce;}_0x3d9506[_0xd12f('0x1d')](_0x3e7dd3);return _0x3d9506[_0xd12f('0x23')](_0xd12f('0x24'),_0x80b3f2+'-'+_0x1c0225+'/'+_0x16c8dc)[_0xd12f('0x1f')](_0x325b9b);}return null;};}function patchUpdates(_0x365021){return function(_0x312e5b){try{jsonpatch['apply'](_0x312e5b,_0x365021,!![]);}catch(_0x90db71){return BPromise['reject'](_0x90db71);}return _0x312e5b[_0xd12f('0x25')]();};}function saveUpdates(_0x1d37e4,_0x34d6e2){return function(_0x128d32){if(_0x128d32){return _0x128d32[_0xd12f('0x26')](_0x1d37e4)[_0xd12f('0x27')](function(_0x141358){return _0x141358;});}return null;};}function removeEntity(_0x39e6d6,_0x5547b7){return function(_0x2de0f6){if(_0x2de0f6){return _0x2de0f6[_0xd12f('0x28')]()[_0xd12f('0x27')](function(){var _0x40a23f=_0x2de0f6[_0xd12f('0x29')]({'plain':!![]});var _0x40ef64='Plugins';return db[_0xd12f('0x2a')][_0xd12f('0x28')]({'where':{'type':_0x40ef64,'resourceId':_0x40a23f['id']}})['then'](function(){return _0x2de0f6;});})[_0xd12f('0x27')](function(){_0x39e6d6[_0xd12f('0x1d')](0xcc)[_0xd12f('0x1e')]();});}};}function handleEntityNotFound(_0x4f6654,_0x3fef34){return function(_0x134673){if(!_0x134673){_0x4f6654[_0xd12f('0x1c')](0x194);}return _0x134673;};}function handleError(_0x54c1e4,_0x5627eb){_0x5627eb=_0x5627eb||0x1f4;return function(_0x267912){logger[_0xd12f('0x2b')](_0x267912[_0xd12f('0x2c')]);if(_0x267912[_0xd12f('0x2d')]){delete _0x267912[_0xd12f('0x2d')];}_0x54c1e4['status'](_0x5627eb)['send'](_0x267912);};}exports['index']=function(_0x1e52e0,_0x4d0bbc){var _0x16d83c={},_0x3a7cf6={},_0x10f1c6={'count':0x0,'rows':[]};var _0x3aa4b5=_[_0xd12f('0x2e')](db[_0xd12f('0x2f')][_0xd12f('0x30')],function(_0x511814){return{'name':_0x511814[_0xd12f('0x31')],'type':_0x511814['type'][_0xd12f('0x32')]};});_0x3a7cf6[_0xd12f('0x33')]=_['map'](_0x3aa4b5,_0xd12f('0x2d'));_0x3a7cf6[_0xd12f('0x34')]=_[_0xd12f('0x35')](_0x1e52e0[_0xd12f('0x34')]);_0x3a7cf6[_0xd12f('0x36')]=_[_0xd12f('0x37')](_0x3a7cf6[_0xd12f('0x33')],_0x3a7cf6[_0xd12f('0x34')]);_0x16d83c[_0xd12f('0x38')]=_[_0xd12f('0x37')](_0x3a7cf6[_0xd12f('0x33')],qs[_0xd12f('0x39')](_0x1e52e0[_0xd12f('0x34')][_0xd12f('0x39')]));_0x16d83c[_0xd12f('0x38')]=_0x16d83c['attributes'][_0xd12f('0x3a')]?_0x16d83c[_0xd12f('0x38')]:_0x3a7cf6[_0xd12f('0x33')];if(!_0x1e52e0['query'][_0xd12f('0x3b')]('nolimit')){_0x16d83c[_0xd12f('0x22')]=qs[_0xd12f('0x22')](_0x1e52e0[_0xd12f('0x34')][_0xd12f('0x22')]);_0x16d83c[_0xd12f('0x21')]=qs[_0xd12f('0x21')](_0x1e52e0[_0xd12f('0x34')][_0xd12f('0x21')]);}_0x16d83c[_0xd12f('0x3c')]=qs['sort'](_0x1e52e0['query'][_0xd12f('0x3d')]);_0x16d83c[_0xd12f('0x3e')]=qs[_0xd12f('0x36')](_[_0xd12f('0x3f')](_0x1e52e0['query'],_0x3a7cf6[_0xd12f('0x36')]),_0x3aa4b5);if(_0x1e52e0[_0xd12f('0x34')][_0xd12f('0x40')]){_0x16d83c['where']=_[_0xd12f('0x41')](_0x16d83c['where'],{'$or':_['map'](_0x3aa4b5,function(_0x1de3b9){if(_0x1de3b9[_0xd12f('0x42')]!==_0xd12f('0x43')){var _0x5f5549={};_0x5f5549[_0x1de3b9[_0xd12f('0x2d')]]={'$like':'%'+_0x1e52e0[_0xd12f('0x34')]['filter']+'%'};return _0x5f5549;}})});}_0x16d83c=_[_0xd12f('0x41')]({},_0x16d83c,_0x1e52e0[_0xd12f('0x44')]);var _0x149819={'where':_0x16d83c['where']};return db[_0xd12f('0x2f')][_0xd12f('0x20')](_0x149819)['then'](function(_0x357e73){_0x10f1c6['count']=_0x357e73;if(_0x1e52e0[_0xd12f('0x34')][_0xd12f('0x45')]){_0x16d83c['include']=[{'all':!![]}];}return db[_0xd12f('0x2f')][_0xd12f('0x46')](_0x16d83c);})[_0xd12f('0x27')](function(_0x3f95db){_0x10f1c6[_0xd12f('0x47')]=_0x3f95db;return _0x10f1c6;})[_0xd12f('0x27')](respondWithFilteredResult(_0x4d0bbc,_0x16d83c))[_0xd12f('0x48')](handleError(_0x4d0bbc,null));};exports['show']=function(_0x1289b4,_0x45bbd8){var _0x466548={'raw':!![],'where':{'id':_0x1289b4['params']['id']}},_0x1701a7={};_0x1701a7[_0xd12f('0x33')]=_[_0xd12f('0x35')](db[_0xd12f('0x2f')]['rawAttributes']);_0x1701a7['query']=_[_0xd12f('0x35')](_0x1289b4['query']);_0x1701a7[_0xd12f('0x36')]=_[_0xd12f('0x37')](_0x1701a7[_0xd12f('0x33')],_0x1701a7['query']);_0x466548['attributes']=_[_0xd12f('0x37')](_0x1701a7['model'],qs[_0xd12f('0x39')](_0x1289b4[_0xd12f('0x34')][_0xd12f('0x39')]));_0x466548['attributes']=_0x466548[_0xd12f('0x38')][_0xd12f('0x3a')]?_0x466548['attributes']:_0x1701a7[_0xd12f('0x33')];if(_0x1289b4['query']['includeAll']){_0x466548['include']=[{'all':!![]}];}_0x466548=_[_0xd12f('0x41')]({},_0x466548,_0x1289b4[_0xd12f('0x44')]);return db[_0xd12f('0x2f')]['find'](_0x466548)[_0xd12f('0x27')](handleEntityNotFound(_0x45bbd8,null))['then'](respondWithResult(_0x45bbd8,null))['catch'](handleError(_0x45bbd8,null));};exports[_0xd12f('0x49')]=function(_0x59da19,_0x338197,_0x2b8dd8){return db[_0xd12f('0x2f')][_0xd12f('0x4a')]({'where':{'id':_0x59da19[_0xd12f('0x4b')]['id']},'attributes':[_0xd12f('0x2d'),_0xd12f('0x7')],'raw':!![]})[_0xd12f('0x27')](handleEntityNotFound(_0x338197,null))[_0xd12f('0x27')](function(_0x2add3f){if(_0x2add3f){var _0x1e7f34=path[_0xd12f('0x4c')](config[_0xd12f('0x4d')],_0xd12f('0x4e'),util[_0xd12f('0x4f')](_0xd12f('0x50'),path[_0xd12f('0x51')](_0x2add3f['path'])));var _0x4542ab=fs[_0xd12f('0x52')](_0x1e7f34);var _0x48c63e=archiver(_0xd12f('0x53'),{'zlib':{'level':0x9}});_0x48c63e['on'](_0xd12f('0x54'),function(_0x1bca7d){if(_0x1bca7d[_0xd12f('0x55')]==='ENOENT'){logger[_0xd12f('0x2b')](_0x1bca7d);}else{throw new db['Sequelize'][(_0xd12f('0x56'))](_0xd12f('0x57'));}});_0x48c63e['on'](_0xd12f('0x2b'),function(_0x4fafbd){throw new db[(_0xd12f('0x58'))]['Error'](_0xd12f('0x57'));});_0x48c63e[_0xd12f('0x59')](_0x4542ab);_0x48c63e[_0xd12f('0x5a')]('**/*',{'cwd':path[_0xd12f('0x4c')](config[_0xd12f('0x4d')],_0xd12f('0x4e'),path[_0xd12f('0x5b')](_0x2add3f['path'])),'ignore':[path[_0xd12f('0x4c')](path[_0xd12f('0x51')](_0x2add3f[_0xd12f('0x7')]),_0xd12f('0x5c')),path['join'](path[_0xd12f('0x51')](_0x2add3f[_0xd12f('0x7')]),_0xd12f('0x5d'))],'nodir':!![]})[_0xd12f('0x5e')]();_0x4542ab['on'](_0xd12f('0x5f'),function(){if(!fs[_0xd12f('0x60')](_0x1e7f34)){throw new db[(_0xd12f('0x58'))][(_0xd12f('0x56'))](_0xd12f('0x61'));}return _0x338197[_0xd12f('0x49')](_0x1e7f34,util[_0xd12f('0x4f')]('%s.zip',path[_0xd12f('0x51')](_0x2add3f[_0xd12f('0x7')])),function(_0x51e00a){if(_0x51e00a){throw new db['Sequelize'][(_0xd12f('0x56'))](_0xd12f('0x62'));}fs[_0xd12f('0x63')](_0x1e7f34);logger[_0xd12f('0x64')](_0xd12f('0x65'));logger[_0xd12f('0x64')](_0xd12f('0x66'));});});}return null;})[_0xd12f('0x48')](handleError(_0x338197,null));};exports[_0xd12f('0x67')]=function(_0x30bfb0,_0x2083b5,_0x5842db){var _0x419ee2=path['basename'](_0x30bfb0[_0xd12f('0x68')]['filename'],path[_0xd12f('0x69')](_0x30bfb0[_0xd12f('0x68')][_0xd12f('0x6a')]));var _0x8a6cbc=path[_0xd12f('0x4c')](config[_0xd12f('0x4d')],_0xd12f('0x4e'),_0x30bfb0[_0xd12f('0x68')][_0xd12f('0x6a')]);var _0x266788=path[_0xd12f('0x4c')](config['root'],_0xd12f('0x4e'),_0x419ee2);logger[_0xd12f('0x64')](_0xd12f('0x6b'),_0x8a6cbc);logger[_0xd12f('0x64')](_0xd12f('0x6c'),_0x266788);try{fs[_0xd12f('0x6d')](_0x8a6cbc,parseInt('0777',0x8));extract(_0x8a6cbc,{'dir':_0x266788},function(_0x22a23b){if(_0x22a23b){logger[_0xd12f('0x2b')](_0x22a23b);handleError(_0x22a23b,!![]);};var _0x2475c8=fs[_0xd12f('0x6e')](_0x266788);if(_0x2475c8[_0xd12f('0x3a')]>0x1){removeReferences(_0x8a6cbc,_0x266788);logger['error'](_0xd12f('0x6f'));return _0x5842db(new Error('Invalid\x20plugin\x20structure'));}var _0x40ea90=fs[_0xd12f('0x70')](path[_0xd12f('0x4c')](_0x266788,_0x2475c8[0x0]));if(_0x40ea90[_0xd12f('0x71')]()){removeReferences(_0x8a6cbc,_0x266788);logger[_0xd12f('0x2b')](_0xd12f('0x6f'));return _0x5842db(new Error('Invalid\x20plugin\x20structure'));}if(_0x40ea90[_0xd12f('0x72')]()){var _0x42be61=fs[_0xd12f('0x6e')](path[_0xd12f('0x4c')](_0x266788,_0x2475c8[0x0]));if(_0x42be61['length']===0x0){removeReferences(_0x8a6cbc,_0x266788);logger[_0xd12f('0x2b')](_0xd12f('0x6f'));return _0x5842db(new Error(_0xd12f('0x6f')));}var _0x589fb0=_0x42be61['some'](function(_0x4f34bd){return _0x4f34bd===_0xd12f('0x73');});if(!_0x589fb0){return _0x5842db(new Error(_0xd12f('0x74')));}var _0xc7617e=fs[_0xd12f('0x75')](path[_0xd12f('0x4c')](_0x266788,_0x2475c8[0x0],_0xd12f('0x73')));var _0x1cacb9=JSON[_0xd12f('0x76')](_0xc7617e);if(_0xd12f('0x77')==typeof _0x1cacb9[_0xd12f('0x2d')]){return _0x5842db(new Error(_0xd12f('0x78')));}if('undefined'==typeof _0x1cacb9[_0xd12f('0x42')]){return _0x5842db(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xd12f('0x77')==typeof _0x1cacb9[_0xd12f('0x79')]){return _0x5842db(new Error(_0xd12f('0x7a')));}if(_0xd12f('0x77')==typeof _0x1cacb9[_0xd12f('0x7b')]){return _0x5842db(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1cacb9[_0xd12f('0x42')]===_0xd12f('0x7c')){if(_0xd12f('0x77')==typeof _0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x7d')]){return _0x5842db(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xd12f('0x77')==typeof _0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x7d')][_0xd12f('0x7e')]&&_0xd12f('0x77')==typeof _0x1cacb9['parameters'][_0xd12f('0x7d')][_0xd12f('0x7f')]){return _0x5842db(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1cacb9['type']===_0xd12f('0x80')){if(_0xd12f('0x77')==typeof _0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x81')]){return _0x5842db(new Error(_0xd12f('0x82')));}if(_0xd12f('0x77')==typeof _0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x83')]){return _0x5842db(new Error(_0xd12f('0x84')));}}else{return _0x5842db(new Error(_0xd12f('0x85')));}var _0x307c63=_0x1cacb9[_0xd12f('0x2d')];var _0x28af00=_0x1cacb9[_0xd12f('0x86')];var _0xc7f617=_0x1cacb9[_0xd12f('0x42')];var _0x14485a=_0x1cacb9['sidebar']?_0x1cacb9['sidebar']:_0xd12f('0x87');var _0x140bed=_0x1cacb9[_0xd12f('0x88')]?_0x1cacb9[_0xd12f('0x88')]:_0xd12f('0x89');var _0x3c506f='';var _0x23ab77='';var _0x3dd7a8='';var _0x463295='';var _0x2bbd2f=_0x1cacb9[_0xd12f('0x79')];if(_0xc7f617===_0xd12f('0x7c')){if(_0xd12f('0x77')!=typeof _0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x7d')]['admin']){var _0x23186e=_0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x7d')][_0xd12f('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xd12f('0x8a')](_0x23186e)){_0x3c506f=path['join'](_0xd12f('0x8b'),_0x419ee2,_0x2475c8[0x0],_0x23186e);}else{_0x3c506f=_0x23186e;}}else{logger[_0xd12f('0x64')](_0xd12f('0x8c'));}if(_0xd12f('0x77')!=typeof _0x1cacb9[_0xd12f('0x7b')]['views'][_0xd12f('0x7f')]){var _0xbc7b0c=_0x1cacb9[_0xd12f('0x7b')]['views'][_0xd12f('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xd12f('0x8a')](_0xbc7b0c)){_0x23ab77=path[_0xd12f('0x4c')](_0xd12f('0x8b'),_0x419ee2,_0x2475c8[0x0],_0xbc7b0c);}else{_0x23ab77=_0xbc7b0c;}}else{logger[_0xd12f('0x64')](_0xd12f('0x8d'));}}else if(_0xc7f617===_0xd12f('0x80')){_0x3dd7a8=_0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x81')];_0x463295=_0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x83')];if(_0xd12f('0x77')!=typeof _0x1cacb9['parameters'][_0xd12f('0x7d')]){if(_0xd12f('0x77')!=typeof _0x1cacb9[_0xd12f('0x7b')]['views'][_0xd12f('0x7e')]){var _0x23186e=_0x1cacb9['parameters']['views'][_0xd12f('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xd12f('0x8a')](_0x23186e)){_0x3c506f=path[_0xd12f('0x4c')](_0xd12f('0x8b'),_0x419ee2,_0x2475c8[0x0],_0x23186e);}else{_0x3c506f=_0x23186e;}}if(_0xd12f('0x77')!=typeof _0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x7d')][_0xd12f('0x7f')]){var _0xbc7b0c=_0x1cacb9[_0xd12f('0x7b')][_0xd12f('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xd12f('0x8a')](_0xbc7b0c)){_0x23ab77=path[_0xd12f('0x4c')]('plugins',_0x419ee2,_0x2475c8[0x0],_0xbc7b0c);}else{_0x23ab77=_0xbc7b0c;}}}}var _0x4f1171={'name':_0x307c63,'description':_0x28af00,'path':path['join'](_0x419ee2,_0x2475c8[0x0]),'type':_0xc7f617,'sidebar':_0x14485a,'icon':_0x140bed,'adminUrl':_0x3c506f,'agentUrl':_0x23ab77,'scriptName':_0x3dd7a8,'scriptPath':_0x463295,'version':_0x2bbd2f};removeReferences(_0x8a6cbc,null);return db['Plugin']['create'](_0x4f1171)[_0xd12f('0x27')](function(_0x4e4b6e){var _0xc40c92={'role':_0x30bfb0[_0xd12f('0x8e')][_0xd12f('0x8f')],'userProfileId':_0x30bfb0[_0xd12f('0x8e')]['userProfileId']};if(!_0xc40c92)throw new Error(_0xd12f('0x90'));if(_0xc40c92[_0xd12f('0x8f')]===_0xd12f('0x91')){var _0x1bd5ad=_0x4e4b6e['get']({'plain':!![]});return db[_0xd12f('0x92')]['find']({'where':{'name':_0xd12f('0x93'),'userProfileId':_0xc40c92[_0xd12f('0x94')]},'raw':!![]})['then'](function(_0x188c47){if(_0x188c47&&_0x188c47[_0xd12f('0x95')]===0x0){return db[_0xd12f('0x2a')][_0xd12f('0x96')]({'name':_0x1bd5ad['name'],'resourceId':_0x1bd5ad['id'],'type':_0x188c47[_0xd12f('0x2d')],'sectionId':_0x188c47['id']},{})[_0xd12f('0x27')](function(){return _0x4e4b6e;});}else{return _0x4e4b6e;}})['catch'](function(_0xab4e8c){logger[_0xd12f('0x2b')](_0xd12f('0x97'),_0xab4e8c);throw _0xab4e8c;});}return _0x4e4b6e;})['then'](respondWithResult(_0x2083b5,null))['catch'](handleError(_0x2083b5,null));}});}catch(_0x511232){_0x2083b5['status'](0x1f4)['send'](_0x511232);}};function removeReferences(_0x4c3713,_0x1e4a4d){try{if(_0x4c3713){fs[_0xd12f('0x63')](_0x4c3713);logger[_0xd12f('0x64')](_0xd12f('0x98'));}if(_0x1e4a4d){rimraf(_0x1e4a4d,function(){});logger[_0xd12f('0x64')](_0xd12f('0x99'));}}catch(_0x337594){logger[_0xd12f('0x2b')](_0x337594);}}exports['update']=function(_0x5751b1,_0x564721,_0xa2c892){return db[_0xd12f('0x2f')][_0xd12f('0x4a')]({'where':{'id':_0x5751b1[_0xd12f('0x4b')]['id']}})[_0xd12f('0x27')](handleEntityNotFound(_0x564721,null))[_0xd12f('0x27')](saveUpdates(_0x5751b1[_0xd12f('0x8e')],null))[_0xd12f('0x27')](respondWithResult(_0x564721,null))['catch'](handleError(_0x564721,null));};exports[_0xd12f('0x9a')]=function(_0x5a6e14,_0x2aa50f,_0x227ba9){return db[_0xd12f('0x2f')][_0xd12f('0x4a')]({'where':{'id':_0x5a6e14[_0xd12f('0x4b')]['id']}})[_0xd12f('0x27')](function(_0xa01e87){if(_0xa01e87){return _0xa01e87['destroy']();}})['then'](function(_0x61d1ce){rimraf(path[_0xd12f('0x4c')](config[_0xd12f('0x4d')],_0xd12f('0x4e'),path['dirname'](_0x61d1ce[_0xd12f('0x7')])),function(){});return _0x61d1ce;})[_0xd12f('0x27')](handleEntityNotFound(_0x2aa50f,null))[_0xd12f('0x27')](respondWithStatusCode(_0x2aa50f,null))[_0xd12f('0x48')](handleError(_0x2aa50f,null));};exports[_0xd12f('0x9b')]=function(_0x21f4cf,_0x322f88,_0x49aeb6){return BPromise[_0xd12f('0x9c')]()[_0xd12f('0x27')](function(){if(!_0x21f4cf[_0xd12f('0x34')][_0xd12f('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x21f4cf[_0xd12f('0x34')][_0xd12f('0x9d')]){throw new Error(_0xd12f('0x9e'));}var _0x41407a=_0x21f4cf['query']['hostname']?_0x21f4cf[_0xd12f('0x34')][_0xd12f('0x9f')]+':'+_0x21f4cf[_0xd12f('0x34')][_0xd12f('0x9d')]:_0xd12f('0xa0')+_0x21f4cf['query'][_0xd12f('0x9d')];var _0x23bc35=_0x21f4cf[_0xd12f('0x34')][_0xd12f('0x1f')]?_0x21f4cf[_0xd12f('0x34')][_0xd12f('0x1f')]:!![];var _0x52dc7d=_0x21f4cf[_0xd12f('0x34')][_0xd12f('0xa1')]?_0x21f4cf[_0xd12f('0x34')]['encoding']:null;var _0x49f860={'method':_0x21f4cf[_0xd12f('0xa2')],'uri':util['format']('%s%s',_0x41407a,_0x21f4cf[_0xd12f('0x34')][_0xd12f('0x7')]),'json':_0x23bc35,'resolveWithFullResponse':!![],'encoding':_0x52dc7d,'qs':_0x21f4cf[_0xd12f('0x34')]};if(_0x21f4cf[_0xd12f('0xa3')]){_0x49f860[_0xd12f('0xa3')]=_0x21f4cf[_0xd12f('0xa3')];if(_0x49f860['headers'][_0xd12f('0xa4')]){delete _0x49f860[_0xd12f('0xa3')][_0xd12f('0xa4')];}}if(_0x49f860['headers'][_0xd12f('0xa5')]){delete _0x49f860['headers'][_0xd12f('0xa5')];}return rp(_0x49f860);})[_0xd12f('0x27')](function(_0x2cac77){if(_0x2cac77){_0x322f88['set'](_0x2cac77['headers']);logger[_0xd12f('0x64')](_0x2cac77[_0xd12f('0x8e')]);if(_[_0xd12f('0xa6')](_0x21f4cf[_0xd12f('0x34')][_0xd12f('0x7')],_0xd12f('0x49'))&&_0x2cac77[_0xd12f('0xa7')]==0x1f4){return _0x322f88['sendStatus'](_0x2cac77[_0xd12f('0xa7')]);}else{return _0x322f88[_0xd12f('0x1d')](_0x2cac77[_0xd12f('0xa7')])[_0xd12f('0xa8')](_0x2cac77[_0xd12f('0x8e')]);}}else{return _0x322f88[_0xd12f('0x1c')](0xc8);}})[_0xd12f('0x48')](handleError(_0x322f88,null));};exports[_0xd12f('0xa9')]=function(_0x4649af,_0xee73a7,_0x39fca5){return BPromise['resolve']()[_0xd12f('0x27')](function(){if(!_0x4649af[_0xd12f('0x34')][_0xd12f('0x7')]){throw new Error(_0xd12f('0xaa'));}if(!_0x4649af[_0xd12f('0x34')][_0xd12f('0x9d')]){throw new Error(_0xd12f('0x9e'));}var _0x29a697=_0x4649af[_0xd12f('0x34')][_0xd12f('0x9f')]?_0x4649af['query'][_0xd12f('0x9f')]+':'+_0x4649af[_0xd12f('0x34')]['port']:_0xd12f('0xa0')+_0x4649af[_0xd12f('0x34')][_0xd12f('0x9d')];var _0x38813d=_0x4649af[_0xd12f('0x34')][_0xd12f('0x1f')]?_0x4649af[_0xd12f('0x34')][_0xd12f('0x1f')]:!![];var _0x4547c9=_0x4649af[_0xd12f('0x34')][_0xd12f('0xa1')]?_0x4649af['query']['encoding']:null;var _0x5da755={'method':_0x4649af[_0xd12f('0xa2')],'uri':util[_0xd12f('0x4f')](_0xd12f('0xab'),_0x29a697,_0x4649af[_0xd12f('0x34')]['path']),'json':_0x38813d,'resolveWithFullResponse':!![],'encoding':_0x4547c9,'body':_0x4649af['body']};if(_0x4649af[_0xd12f('0xa3')]){_0x5da755['headers']=_0x4649af[_0xd12f('0xa3')];if(_0x5da755[_0xd12f('0xa3')][_0xd12f('0xa4')]){delete _0x5da755[_0xd12f('0xa3')][_0xd12f('0xa4')];}}if(_0x5da755[_0xd12f('0xa3')][_0xd12f('0xa5')]){delete _0x5da755['headers'][_0xd12f('0xa5')];}return rp(_0x5da755);})[_0xd12f('0x27')](function(_0x5efcf2){if(_0x5efcf2){_0xee73a7['set'](_0x5efcf2[_0xd12f('0xa3')]);logger[_0xd12f('0x64')](_0x5efcf2['body']);return _0xee73a7['status'](_0x5efcf2[_0xd12f('0xa7')])['send'](_0x5efcf2[_0xd12f('0x8e')]);}else{return _0xee73a7[_0xd12f('0x1c')](0xc8);}})[_0xd12f('0x48')](handleError(_0xee73a7,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b162647..a89d512 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 _0x2032=['exports','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x2032,0xd9));var _0x2203=function(_0x5e9139,_0x56a566){_0x5e9139=_0x5e9139-0x0;var _0x4a7d09=_0x2032[_0x5e9139];return _0x4a7d09;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){PluginEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);PluginEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Plugin[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=PluginEvents; \ No newline at end of file +var _0x0b0e=['Plugin','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x40ca4a,_0x4365fc){var _0x397d0c=function(_0xc61f77){while(--_0xc61f77){_0x40ca4a['push'](_0x40ca4a['shift']());}};_0x397d0c(++_0x4365fc);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x0b0e[_0x2261ce];return _0x524640;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var Plugin=require('../../mysqldb')['db'][_0xe0b0('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){PluginEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);PluginEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];Plugin[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 06b46b0..4465a54 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 _0xf85e=['plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x2596fa,_0x189c14){var _0x159184=function(_0x22a487){while(--_0x22a487){_0x2596fa['push'](_0x2596fa['shift']());}};_0x159184(++_0x189c14);}(_0xf85e,0x105));var _0xef85=function(_0x5a4266,_0x345330){_0x5a4266=_0x5a4266-0x0;var _0x16338a=_0xf85e[_0x5a4266];return _0x16338a;};'use strict';var _=require(_0xef85('0x0'));var util=require(_0xef85('0x1'));var logger=require(_0xef85('0x2'))('api');var moment=require(_0xef85('0x3'));var BPromise=require(_0xef85('0x4'));var rp=require(_0xef85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef85('0x6'));var config=require(_0xef85('0x7'));var attributes=require(_0xef85('0x8'));module[_0xef85('0x9')]=function(_0x19e1f1,_0x5c2348){return _0x19e1f1[_0xef85('0xa')](_0xef85('0xb'),attributes,{'tableName':_0xef85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5df0=['plugins','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./plugin.attributes','exports','define'];(function(_0xd6fc48,_0x49aa3b){var _0x5d7be9=function(_0x156515){while(--_0x156515){_0xd6fc48['push'](_0xd6fc48['shift']());}};_0x5d7be9(++_0x49aa3b);}(_0x5df0,0xa6));var _0x05df=function(_0x56ed86,_0x41e7f1){_0x56ed86=_0x56ed86-0x0;var _0xe6f9ac=_0x5df0[_0x56ed86];return _0xe6f9ac;};'use strict';var _=require('lodash');var util=require(_0x05df('0x0'));var logger=require(_0x05df('0x1'))(_0x05df('0x2'));var moment=require(_0x05df('0x3'));var BPromise=require('bluebird');var rp=require(_0x05df('0x4'));var fs=require('fs');var path=require(_0x05df('0x5'));var rimraf=require('rimraf');var config=require(_0x05df('0x6'));var attributes=require(_0x05df('0x7'));module[_0x05df('0x8')]=function(_0x43e43d,_0x2a78f5){return _0x43e43d[_0x05df('0x9')]('Plugin',attributes,{'tableName':_0x05df('0xa'),'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 bf092e9..0bce265 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 _0x67c7=['raw','debug','CreatePlugin','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','catch','Plugin','create','body','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67c7,0x14d));var _0x767c=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x67c7[_0x1e17eb];return _0x4de4c7;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var moment=require(_0x767c('0x2'));var BPromise=require(_0x767c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x767c('0x4'));var db=require(_0x767c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x767c('0x6'))(_0x767c('0x7'));var config=require('../../config/environment');var jayson=require(_0x767c('0x8'));var client=jayson[_0x767c('0x9')][_0x767c('0xa')]({'port':0x232a});config['redis']=_[_0x767c('0xb')](config[_0x767c('0xc')],{'host':_0x767c('0xd'),'port':0x18eb});var socket=require(_0x767c('0xe'))(new Redis(config[_0x767c('0xc')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x11eb52,_0x4987ee,_0x575101){return new BPromise(function(_0x56210e,_0x3826cc){return client['request'](_0x11eb52,_0x575101)[_0x767c('0xf')](function(_0x8636ce){logger[_0x767c('0x10')]('Plugin,\x20%s,\x20%s',_0x4987ee,_0x767c('0x11'));logger['debug'](_0x767c('0x12'),_0x4987ee,_0x767c('0x11'),JSON[_0x767c('0x13')](_0x8636ce));if(_0x8636ce[_0x767c('0x14')]){if(_0x8636ce['error'][_0x767c('0x15')]===0x1f4){logger[_0x767c('0x14')]('Plugin,\x20%s,\x20%s',_0x4987ee,_0x8636ce[_0x767c('0x14')][_0x767c('0x16')]);return _0x3826cc(_0x8636ce[_0x767c('0x14')][_0x767c('0x16')]);}logger[_0x767c('0x14')]('Plugin,\x20%s,\x20%s',_0x4987ee,_0x8636ce['error'][_0x767c('0x16')]);return _0x56210e(_0x8636ce['error'][_0x767c('0x16')]);}else{logger[_0x767c('0x10')](_0x767c('0x17'),_0x4987ee,_0x767c('0x11'));_0x56210e(_0x8636ce[_0x767c('0x18')][_0x767c('0x16')]);}})[_0x767c('0x19')](function(_0x48d3f7){logger[_0x767c('0x14')]('Plugin,\x20%s,\x20%s',_0x4987ee,_0x48d3f7);_0x3826cc(_0x48d3f7);});});}exports['CreatePlugin']=function(_0x56e32d){var _0x493e81=this;return new Promise(function(_0x1287aa,_0x31d14a){return db[_0x767c('0x1a')][_0x767c('0x1b')](_0x56e32d[_0x767c('0x1c')],{'raw':_0x56e32d[_0x767c('0x1d')]?_0x56e32d[_0x767c('0x1d')][_0x767c('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x3c7275){logger[_0x767c('0x10')]('CreatePlugin',_0x56e32d);logger[_0x767c('0x1f')](_0x767c('0x20'),_0x56e32d,JSON['stringify'](_0x3c7275));_0x1287aa(_0x3c7275);})['catch'](function(_0x409c17){logger['error'](_0x767c('0x20'),_0x409c17[_0x767c('0x16')],_0x56e32d);_0x31d14a(_0x493e81[_0x767c('0x14')](0x1f4,_0x409c17['message']));});});}; \ No newline at end of file +var _0x2786=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin','create','body','options','CreatePlugin','catch','lodash'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x2786,0x1d0));var _0x6278=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2786[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x6278('0x0'));var util=require('util');var moment=require(_0x6278('0x1'));var BPromise=require(_0x6278('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6278('0x3'));var db=require(_0x6278('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6278('0x5'))('rpc');var config=require(_0x6278('0x6'));var jayson=require(_0x6278('0x7'));var client=jayson[_0x6278('0x8')]['http']({'port':0x232a});config[_0x6278('0x9')]=_[_0x6278('0xa')](config[_0x6278('0x9')],{'host':_0x6278('0xb'),'port':0x18eb});var socket=require(_0x6278('0xc'))(new Redis(config['redis']));require(_0x6278('0xd'))['register'](socket);function respondWithRpcPromise(_0xef930d,_0x21658b,_0xf4b4ed){return new BPromise(function(_0xfb5e15,_0x5329da){return client[_0x6278('0xe')](_0xef930d,_0xf4b4ed)[_0x6278('0xf')](function(_0x13e877){logger[_0x6278('0x10')](_0x6278('0x11'),_0x21658b,_0x6278('0x12'));logger[_0x6278('0x13')](_0x6278('0x14'),_0x21658b,_0x6278('0x12'),JSON[_0x6278('0x15')](_0x13e877));if(_0x13e877[_0x6278('0x16')]){if(_0x13e877[_0x6278('0x16')][_0x6278('0x17')]===0x1f4){logger[_0x6278('0x16')](_0x6278('0x11'),_0x21658b,_0x13e877[_0x6278('0x16')][_0x6278('0x18')]);return _0x5329da(_0x13e877[_0x6278('0x16')][_0x6278('0x18')]);}logger[_0x6278('0x16')](_0x6278('0x11'),_0x21658b,_0x13e877['error'][_0x6278('0x18')]);return _0xfb5e15(_0x13e877[_0x6278('0x16')][_0x6278('0x18')]);}else{logger[_0x6278('0x10')](_0x6278('0x11'),_0x21658b,_0x6278('0x12'));_0xfb5e15(_0x13e877['result']['message']);}})['catch'](function(_0x39b725){logger['error'](_0x6278('0x11'),_0x21658b,_0x39b725);_0x5329da(_0x39b725);});});}exports['CreatePlugin']=function(_0x593b20){var _0x316848=this;return new Promise(function(_0x4ae7e5,_0x856135){return db[_0x6278('0x19')][_0x6278('0x1a')](_0x593b20[_0x6278('0x1b')],{'raw':_0x593b20[_0x6278('0x1c')]?_0x593b20['options']['raw']===undefined?!![]:![]:!![]})[_0x6278('0xf')](function(_0xd5e00b){logger['info'](_0x6278('0x1d'),_0x593b20);logger[_0x6278('0x13')](_0x6278('0x1d'),_0x593b20,JSON[_0x6278('0x15')](_0xd5e00b));_0x4ae7e5(_0xd5e00b);})[_0x6278('0x1e')](function(_0x4b1df9){logger['error'](_0x6278('0x1d'),_0x4b1df9['message'],_0x593b20);_0x856135(_0x316848['error'](0x1f4,_0x4b1df9[_0x6278('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0732348..5fd870d 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 _0x67a6=['save','remove','update','removeListener','register','length','plugin:','./plugin.events'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x67a6,0x137));var _0x667a=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x67a6[_0x30faec];return _0x29484f;};'use strict';var PluginEvents=require(_0x667a('0x0'));var events=[_0x667a('0x1'),_0x667a('0x2'),_0x667a('0x3')];function createListener(_0x27023f,_0x41a307){return function(_0x11e4db){_0x41a307['emit'](_0x27023f,_0x11e4db);};}function removeListener(_0x4acd11,_0x2ddb82){return function(){PluginEvents[_0x667a('0x4')](_0x4acd11,_0x2ddb82);};}exports[_0x667a('0x5')]=function(_0x13c304){for(var _0x2dfbba=0x0,_0x69cd32=events[_0x667a('0x6')];_0x2dfbba<_0x69cd32;_0x2dfbba++){var _0x44f6fc=events[_0x2dfbba];var _0xfc9da4=createListener(_0x667a('0x7')+_0x44f6fc,_0x13c304);PluginEvents['on'](_0x44f6fc,_0xfc9da4);}}; \ No newline at end of file +var _0x655c=['./plugin.events','save','update','removeListener','register','length','plugin:'];(function(_0x538542,_0x3456ed){var _0x1ad5ff=function(_0x20e0ba){while(--_0x20e0ba){_0x538542['push'](_0x538542['shift']());}};_0x1ad5ff(++_0x3456ed);}(_0x655c,0x15e));var _0xc655=function(_0x2f132e,_0x327f5d){_0x2f132e=_0x2f132e-0x0;var _0x117010=_0x655c[_0x2f132e];return _0x117010;};'use strict';var PluginEvents=require(_0xc655('0x0'));var events=[_0xc655('0x1'),'remove',_0xc655('0x2')];function createListener(_0x1603fa,_0xa532f4){return function(_0x19e62e){_0xa532f4['emit'](_0x1603fa,_0x19e62e);};}function removeListener(_0x380ab7,_0x27f4fe){return function(){PluginEvents[_0xc655('0x3')](_0x380ab7,_0x27f4fe);};}exports[_0xc655('0x4')]=function(_0x43f195){for(var _0x23af74=0x0,_0xc75a07=events[_0xc655('0x5')];_0x23af74<_0xc75a07;_0x23af74++){var _0xe154e1=events[_0x23af74];var _0xe5c2d6=createListener(_0xc655('0x6')+_0xe154e1,_0x43f195);PluginEvents['on'](_0xe154e1,_0xe5c2d6);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 575951a..7eac62f 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 _0x11c4=['put','update','delete','destroy','exports','express','get','isAuthenticated','index','/:id','show'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x11c4,0xec));var _0x411c=function(_0x4be1f0,_0x78c929){_0x4be1f0=_0x4be1f0-0x0;var _0x1d4bf4=_0x11c4[_0x4be1f0];return _0x1d4bf4;};'use strict';var express=require(_0x411c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x411c('0x1')]('/',auth[_0x411c('0x2')](),controller[_0x411c('0x3')]);router['get'](_0x411c('0x4'),auth[_0x411c('0x2')](),controller[_0x411c('0x5')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x411c('0x6')](_0x411c('0x4'),auth[_0x411c('0x2')](),controller[_0x411c('0x7')]);router[_0x411c('0x8')](_0x411c('0x4'),auth[_0x411c('0x2')](),controller[_0x411c('0x9')]);module[_0x411c('0xa')]=router; \ No newline at end of file +var _0xfeff=['create','put','update','delete','destroy','exports','express','Router','./pm2.controller','get','isAuthenticated','index','/:id','post'];(function(_0x13602f,_0x33369f){var _0x51e639=function(_0x392341){while(--_0x392341){_0x13602f['push'](_0x13602f['shift']());}};_0x51e639(++_0x33369f);}(_0xfeff,0x164));var _0xffef=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xfeff[_0x403c20];return _0x2b271a;};'use strict';var express=require(_0xffef('0x0'));var router=express[_0xffef('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xffef('0x2'));router[_0xffef('0x3')]('/',auth[_0xffef('0x4')](),controller[_0xffef('0x5')]);router[_0xffef('0x3')](_0xffef('0x6'),auth[_0xffef('0x4')](),controller['show']);router[_0xffef('0x7')]('/',auth[_0xffef('0x4')](),controller[_0xffef('0x8')]);router[_0xffef('0x9')](_0xffef('0x6'),auth['isAuthenticated'](),controller[_0xffef('0xa')]);router[_0xffef('0xb')](_0xffef('0x6'),auth['isAuthenticated'](),controller[_0xffef('0xc')]);module[_0xffef('0xd')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 63dbcd1..31fa883 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 _0x6dac=['then','catch','show','describe','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','path','bluebird','sendStatus','status','json','error','name','npm\x20install','info','index','list','reject','express','motion2','length'];(function(_0x34b3bb,_0x531597){var _0x430797=function(_0x3a1c6c){while(--_0x3a1c6c){_0x34b3bb['push'](_0x34b3bb['shift']());}};_0x430797(++_0x531597);}(_0x6dac,0x180));var _0xc6da=function(_0x376941,_0x2cec66){_0x376941=_0x376941-0x0;var _0x5ce95a=_0x6dac[_0x376941];return _0x5ce95a;};'use strict';var _=require(_0xc6da('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('api');var path=require(_0xc6da('0x1'));var exec=require('child_process')['exec'];var BPromise=require(_0xc6da('0x2'));function handleEntityNotFound(_0x445ad6,_0x2b0cfa){return function(_0x5d0011){if(!_0x5d0011){_0x445ad6[_0xc6da('0x3')](0x194);;}return _0x5d0011;};}function respondWithResult(_0x743123,_0x59985d){_0x59985d=_0x59985d||0xc8;return function(_0xe289a4){if(_0xe289a4){return _0x743123[_0xc6da('0x4')](_0x59985d)[_0xc6da('0x5')](_0xe289a4);}return null;};}function handleError(_0x5c233e,_0x16baec){_0x16baec=_0x16baec||0x1f4;return function(_0x33653c){logger[_0xc6da('0x6')](_0x33653c['stack']);if(_0x33653c[_0xc6da('0x7')]){delete _0x33653c[_0xc6da('0x7')];}_0x5c233e[_0xc6da('0x4')](_0x16baec)['send'](_0x33653c);};}function execChildProcess(){return new BPromise(function(_0x3a1bef,_0x4505dc){exec(_0xc6da('0x8'),function(_0x21dfa3,_0x1bb004,_0x315ccd){logger[_0xc6da('0x9')](_0x1bb004);logger['info'](_0x315ccd);if(_0x21dfa3){logger[_0xc6da('0x6')](_0x21dfa3);return _0x4505dc(_0x21dfa3);}return _0x3a1bef(_0x1bb004);});});}exports[_0xc6da('0xa')]=function(_0x1f4ee2,_0xc5fbf7){return pm2[_0xc6da('0xb')]()['then'](function(_0x950967){if(_0x950967){var _0x405afb=_[_0xc6da('0xc')](_0x950967,function(_0x4e28e5){return _0x4e28e5[_0xc6da('0x7')]===_0xc6da('0xd')||_0x4e28e5[_0xc6da('0x7')]===_0xc6da('0xe');});return{'rows':_0x405afb,'count':_0x405afb[_0xc6da('0xf')]};}return null;})[_0xc6da('0x10')](respondWithResult(_0xc5fbf7,null))[_0xc6da('0x11')](handleError(_0xc5fbf7,null));};exports[_0xc6da('0x12')]=function(_0x234e12,_0x5d8bc1){return pm2[_0xc6da('0x13')](_0x234e12['params']['id'])['then'](respondWithResult(_0x5d8bc1,null))['then'](handleEntityNotFound(_0x5d8bc1,null))['catch'](handleError(_0x5d8bc1,null));};exports[_0xc6da('0x14')]=function(_0x18603c,_0xe1b3b4){if(_0x18603c[_0xc6da('0x15')][_0xc6da('0x7')]&&_0x18603c['body']['script']){var _0x1d3b65=path[_0xc6da('0x16')](__dirname,_0xc6da('0x17'),_0x18603c[_0xc6da('0x15')][_0xc6da('0x18')]);var _0x36d6bb=process[_0xc6da('0x19')]();process[_0xc6da('0x1a')](path[_0xc6da('0x1b')](_0x1d3b65));return execChildProcess()[_0xc6da('0x10')](function(_0x50147b){process[_0xc6da('0x1a')](_0x36d6bb);return pm2[_0xc6da('0x1c')]({'name':_0x18603c[_0xc6da('0x15')]['name'],'script':_0x1d3b65});})[_0xc6da('0x10')](function(_0x2efb53){pm2[_0xc6da('0x1d')]();return _0x2efb53[0x0];})[_0xc6da('0x10')](respondWithResult(_0xe1b3b4,0xc9))[_0xc6da('0x11')](handleError(_0xe1b3b4,null));}else{return _0xe1b3b4[_0xc6da('0x4')](0x1f4)[_0xc6da('0x1e')]({'message':_0xc6da('0x1f')});}};exports[_0xc6da('0x20')]=function(_0x3da2ee,_0x182100){if(_0x3da2ee[_0xc6da('0x15')]['id']){delete _0x3da2ee[_0xc6da('0x15')]['id'];}var _0x42d3f2={'online':_0xc6da('0x21'),'stopped':_0xc6da('0x22')};if(_0x42d3f2['hasOwnProperty'](_0x3da2ee['body'][_0xc6da('0x4')])){return pm2[_0x42d3f2[_0x3da2ee[_0xc6da('0x15')][_0xc6da('0x4')]]](_0x3da2ee[_0xc6da('0x23')]['id'])[_0xc6da('0x10')](respondWithResult(_0x182100,0xc8))[_0xc6da('0x11')](handleError(_0x182100,null));}else{return _0x182100[_0xc6da('0x4')](0x1f4)['send']({'message':_0xc6da('0x24')});}};exports[_0xc6da('0x25')]=function(_0x108e9d,_0x7324d1){if(_0x108e9d['body']['id']){delete _0x108e9d[_0xc6da('0x15')]['id'];}if(_0x108e9d[_0xc6da('0x23')]['id']){return pm2[_0xc6da('0x26')](_0x108e9d['params']['id'])[_0xc6da('0x10')](function(_0xaac05a){pm2[_0xc6da('0x1d')]();return _0xaac05a[0x0];})['then'](respondWithResult(_0x7324d1,null))['catch'](handleError(_0x7324d1,null));}else{return _0x7324d1[_0xc6da('0x4')](0x1f4)[_0xc6da('0x1e')]({'message':_0xc6da('0x27')});}}; \ No newline at end of file +var _0x876c=['restart','stop','Unknown\x20status','delete','path','child_process','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x876c,0x19b));var _0xc876=function(_0x3ca849,_0x5f1d0d){_0x3ca849=_0x3ca849-0x0;var _0xf30069=_0x876c[_0x3ca849];return _0xf30069;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require('../../config/logger')('api');var path=require(_0xc876('0x0'));var exec=require(_0xc876('0x1'))['exec'];var BPromise=require(_0xc876('0x2'));function handleEntityNotFound(_0x59233f,_0x18d5b1){return function(_0x4adb3f){if(!_0x4adb3f){_0x59233f[_0xc876('0x3')](0x194);;}return _0x4adb3f;};}function respondWithResult(_0x18c4e0,_0x2c3dc2){_0x2c3dc2=_0x2c3dc2||0xc8;return function(_0x2a7dc9){if(_0x2a7dc9){return _0x18c4e0[_0xc876('0x4')](_0x2c3dc2)[_0xc876('0x5')](_0x2a7dc9);}return null;};}function handleError(_0x52acb0,_0x4d4b03){_0x4d4b03=_0x4d4b03||0x1f4;return function(_0x459129){logger[_0xc876('0x6')](_0x459129['stack']);if(_0x459129['name']){delete _0x459129[_0xc876('0x7')];}_0x52acb0[_0xc876('0x4')](_0x4d4b03)[_0xc876('0x8')](_0x459129);};}function execChildProcess(){return new BPromise(function(_0x11e590,_0x39a7af){exec(_0xc876('0x9'),function(_0x48d54c,_0x4c9945,_0x1a794b){logger['info'](_0x4c9945);logger[_0xc876('0xa')](_0x1a794b);if(_0x48d54c){logger[_0xc876('0x6')](_0x48d54c);return _0x39a7af(_0x48d54c);}return _0x11e590(_0x4c9945);});});}exports[_0xc876('0xb')]=function(_0x436a38,_0x12be8f){return pm2[_0xc876('0xc')]()[_0xc876('0xd')](function(_0x33917e){if(_0x33917e){var _0x2a3336=_[_0xc876('0xe')](_0x33917e,function(_0x3d88ec){return _0x3d88ec[_0xc876('0x7')]===_0xc876('0xf')||_0x3d88ec[_0xc876('0x7')]===_0xc876('0x10');});return{'rows':_0x2a3336,'count':_0x2a3336[_0xc876('0x11')]};}return null;})[_0xc876('0xd')](respondWithResult(_0x12be8f,null))[_0xc876('0x12')](handleError(_0x12be8f,null));};exports[_0xc876('0x13')]=function(_0x236020,_0x3dd8e5){return pm2[_0xc876('0x14')](_0x236020[_0xc876('0x15')]['id'])['then'](respondWithResult(_0x3dd8e5,null))[_0xc876('0xd')](handleEntityNotFound(_0x3dd8e5,null))[_0xc876('0x12')](handleError(_0x3dd8e5,null));};exports[_0xc876('0x16')]=function(_0x4ae33b,_0x8d22b4){if(_0x4ae33b[_0xc876('0x17')][_0xc876('0x7')]&&_0x4ae33b['body'][_0xc876('0x18')]){var _0x35bafa=path[_0xc876('0x19')](__dirname,_0xc876('0x1a'),_0x4ae33b[_0xc876('0x17')]['script']);var _0x596f1e=process[_0xc876('0x1b')]();process[_0xc876('0x1c')](path[_0xc876('0x1d')](_0x35bafa));return execChildProcess()[_0xc876('0xd')](function(_0x2f438f){process[_0xc876('0x1c')](_0x596f1e);return pm2[_0xc876('0x1e')]({'name':_0x4ae33b[_0xc876('0x17')][_0xc876('0x7')],'script':_0x35bafa});})['then'](function(_0x2f2110){pm2[_0xc876('0x1f')]();return _0x2f2110[0x0];})[_0xc876('0xd')](respondWithResult(_0x8d22b4,0xc9))[_0xc876('0x12')](handleError(_0x8d22b4,null));}else{return _0x8d22b4['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xc876('0x20')]=function(_0x59cc96,_0x5ab926){if(_0x59cc96['body']['id']){delete _0x59cc96[_0xc876('0x17')]['id'];}var _0x1426f1={'online':_0xc876('0x21'),'stopped':_0xc876('0x22')};if(_0x1426f1['hasOwnProperty'](_0x59cc96[_0xc876('0x17')][_0xc876('0x4')])){return pm2[_0x1426f1[_0x59cc96['body']['status']]](_0x59cc96[_0xc876('0x15')]['id'])[_0xc876('0xd')](respondWithResult(_0x5ab926,0xc8))[_0xc876('0x12')](handleError(_0x5ab926,null));}else{return _0x5ab926[_0xc876('0x4')](0x1f4)[_0xc876('0x8')]({'message':_0xc876('0x23')});}};exports['destroy']=function(_0x30b455,_0x1b012f){if(_0x30b455[_0xc876('0x17')]['id']){delete _0x30b455['body']['id'];}if(_0x30b455['params']['id']){return pm2[_0xc876('0x24')](_0x30b455[_0xc876('0x15')]['id'])['then'](function(_0x5988a8){pm2[_0xc876('0x1f')]();return _0x5988a8[0x0];})[_0xc876('0xd')](respondWithResult(_0x1b012f,null))[_0xc876('0x12')](handleError(_0x1b012f,null));}else{return _0x1b012f[_0xc876('0x4')](0x1f4)[_0xc876('0x8')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index dd663cc..d710483 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 _0x1445=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x1445,0xf5));var _0x5144=function(_0x1aebfe,_0x5a6e9a){_0x1aebfe=_0x1aebfe-0x0;var _0x5f382d=_0x1445[_0x1aebfe];return _0x5f382d;};'use strict';var multer=require(_0x5144('0x0'));var util=require(_0x5144('0x1'));var path=require(_0x5144('0x2'));var timeout=require(_0x5144('0x3'));var express=require(_0x5144('0x4'));var router=express[_0x5144('0x5')]();var auth=require(_0x5144('0x6'));var interaction=require(_0x5144('0x7'));var config=require('../../config/environment');module[_0x5144('0x8')]=router; \ No newline at end of file +var _0x972f=['path','connect-timeout','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x17e0ff,_0x4dbd1e){var _0x357979=function(_0x443276){while(--_0x443276){_0x17e0ff['push'](_0x17e0ff['shift']());}};_0x357979(++_0x4dbd1e);}(_0x972f,0x136));var _0xf972=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x972f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf972('0x0'));var util=require(_0xf972('0x1'));var path=require(_0xf972('0x2'));var timeout=require(_0xf972('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf972('0x4'));var config=require(_0xf972('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 1cea48d..3385fea 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 _0xc19a=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x1a809d,_0x23cfc5){var _0x501fea=function(_0xb7275f){while(--_0xb7275f){_0x1a809d['push'](_0x1a809d['shift']());}};_0x501fea(++_0x23cfc5);}(_0xc19a,0x181));var _0xac19=function(_0x176099,_0x50f74a){_0x176099=_0x176099-0x0;var _0x40c93f=_0xc19a[_0x176099];return _0x40c93f;};'use strict';var Sequelize=require(_0xac19('0x0'));module[_0xac19('0x1')]={'state':{'type':Sequelize[_0xac19('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xac19('0x3')]},'scheduledat':{'type':Sequelize[_0xac19('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xac19('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xac19('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xac19('0x3')]},'campaigntype':{'type':Sequelize[_0xac19('0x3')]},'membername':{'type':Sequelize[_0xac19('0x3')]}}; \ No newline at end of file +var _0x7727=['DATE','sequelize','exports','STRING'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x7727,0x129));var _0x7772=function(_0x3d7de8,_0x2a2ec4){_0x3d7de8=_0x3d7de8-0x0;var _0x5e9a0c=_0x7727[_0x3d7de8];return _0x5e9a0c;};'use strict';var Sequelize=require(_0x7772('0x0'));module[_0x7772('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x7772('0x2')]},'scheduledat':{'type':Sequelize[_0x7772('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7772('0x3')]},'responsetime':{'type':Sequelize[_0x7772('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7772('0x2')]},'campaigntype':{'type':Sequelize[_0x7772('0x2')]},'membername':{'type':Sequelize[_0x7772('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3a28f10..915baf9 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 _0xf077=['report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4b40dc,_0xd4cbc3){var _0x566fd7=function(_0x310c98){while(--_0x310c98){_0x4b40dc['push'](_0x4b40dc['shift']());}};_0x566fd7(++_0xd4cbc3);}(_0xf077,0xeb));var _0x7f07=function(_0x5e3902,_0x3d8c15){_0x5e3902=_0x5e3902-0x0;var _0x40fb78=_0xf077[_0x5e3902];return _0x40fb78;};'use strict';var _=require(_0x7f07('0x0'));var util=require(_0x7f07('0x1'));var logger=require(_0x7f07('0x2'))(_0x7f07('0x3'));var moment=require(_0x7f07('0x4'));var BPromise=require(_0x7f07('0x5'));var rp=require(_0x7f07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f07('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x4f1abc,_0x10809f){return _0x4f1abc['define']('ReportAgentPreview',attributes,{'tableName':_0x7f07('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a24=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x506666,_0xce2758){var _0x567a41=function(_0x26a160){while(--_0x26a160){_0x506666['push'](_0x506666['shift']());}};_0x567a41(++_0xce2758);}(_0x9a24,0x134));var _0x49a2=function(_0x5f2481,_0x313fd9){_0x5f2481=_0x5f2481-0x0;var _0x49f81f=_0x9a24[_0x5f2481];return _0x49f81f;};'use strict';var _=require('lodash');var util=require(_0x49a2('0x0'));var logger=require(_0x49a2('0x1'))(_0x49a2('0x2'));var moment=require(_0x49a2('0x3'));var BPromise=require('bluebird');var rp=require(_0x49a2('0x4'));var fs=require('fs');var path=require(_0x49a2('0x5'));var rimraf=require('rimraf');var config=require(_0x49a2('0x6'));var attributes=require(_0x49a2('0x7'));module[_0x49a2('0x8')]=function(_0x1c27a0,_0x1785ac){return _0x1c27a0[_0x49a2('0x9')](_0x49a2('0xa'),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 370ea0e..3ac3a1b 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 _0x2bda=['../../config/environment','request','then','info','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0x2bda,0x1d3));var _0xa2bd=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x2bda[_0x2f57b2];return _0x5ace77;};'use strict';var _=require(_0xa2bd('0x0'));var util=require('util');var moment=require(_0xa2bd('0x1'));var BPromise=require(_0xa2bd('0x2'));var rs=require(_0xa2bd('0x3'));var fs=require('fs');var Redis=require(_0xa2bd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2bd('0x5'));var logger=require(_0xa2bd('0x6'))(_0xa2bd('0x7'));var config=require(_0xa2bd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x417412,_0x586725,_0x598e92){return new BPromise(function(_0x259ce0,_0x2c8ad5){return client[_0xa2bd('0x9')](_0x417412,_0x598e92)[_0xa2bd('0xa')](function(_0x2779af){logger[_0xa2bd('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x586725,_0xa2bd('0xc'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x586725,_0xa2bd('0xc'),JSON[_0xa2bd('0xd')](_0x2779af));if(_0x2779af['error']){if(_0x2779af[_0xa2bd('0xe')][_0xa2bd('0xf')]===0x1f4){logger['error'](_0xa2bd('0x10'),_0x586725,_0x2779af[_0xa2bd('0xe')][_0xa2bd('0x11')]);return _0x2c8ad5(_0x2779af['error'][_0xa2bd('0x11')]);}logger[_0xa2bd('0xe')](_0xa2bd('0x10'),_0x586725,_0x2779af['error']['message']);return _0x259ce0(_0x2779af[_0xa2bd('0xe')]['message']);}else{logger[_0xa2bd('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x586725,_0xa2bd('0xc'));_0x259ce0(_0x2779af['result'][_0xa2bd('0x11')]);}})[_0xa2bd('0x12')](function(_0x3d3ebc){logger[_0xa2bd('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x586725,_0x3d3ebc);_0x2c8ad5(_0x3d3ebc);});});}exports[_0xa2bd('0x13')]=function(_0x28e283){var _0x212bdf=this;return new Promise(function(_0x256573,_0x3b149f){return db[_0xa2bd('0x14')][_0xa2bd('0x15')](_0x28e283[_0xa2bd('0x16')],{'raw':_0x28e283[_0xa2bd('0x17')]?_0x28e283[_0xa2bd('0x17')][_0xa2bd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x16be1b){logger[_0xa2bd('0xb')](_0xa2bd('0x13'),_0x28e283);logger['debug']('CreateReportAgentPreview',_0x28e283,JSON[_0xa2bd('0xd')](_0x16be1b));_0x256573(_0x16be1b);})[_0xa2bd('0x12')](function(_0x3547ec){logger[_0xa2bd('0xe')]('CreateReportAgentPreview',_0x3547ec[_0xa2bd('0x11')],_0x28e283);_0x3b149f(_0x212bdf[_0xa2bd('0xe')](0x1f4,_0x3547ec[_0xa2bd('0x11')]));});});}; \ No newline at end of file +var _0xc8f1=['CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4e4a09,_0xe4eac8){var _0x17a756=function(_0x23b5ef){while(--_0x23b5ef){_0x4e4a09['push'](_0x4e4a09['shift']());}};_0x17a756(++_0xe4eac8);}(_0xc8f1,0x72));var _0x1c8f=function(_0x49dcb0,_0x148c64){_0x49dcb0=_0x49dcb0-0x0;var _0xe43e30=_0xc8f1[_0x49dcb0];return _0xe43e30;};'use strict';var _=require(_0x1c8f('0x0'));var util=require(_0x1c8f('0x1'));var moment=require('moment');var BPromise=require(_0x1c8f('0x2'));var rs=require(_0x1c8f('0x3'));var fs=require('fs');var Redis=require(_0x1c8f('0x4'));var db=require(_0x1c8f('0x5'))['db'];var utils=require(_0x1c8f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1c8f('0x7'));var jayson=require(_0x1c8f('0x8'));var client=jayson[_0x1c8f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x154530,_0x13d08a,_0x125068){return new BPromise(function(_0x216a32,_0x1eee6e){return client[_0x1c8f('0xa')](_0x154530,_0x125068)[_0x1c8f('0xb')](function(_0x1b71e1){logger[_0x1c8f('0xc')](_0x1c8f('0xd'),_0x13d08a,_0x1c8f('0xe'));logger[_0x1c8f('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x13d08a,_0x1c8f('0xe'),JSON[_0x1c8f('0x10')](_0x1b71e1));if(_0x1b71e1[_0x1c8f('0x11')]){if(_0x1b71e1[_0x1c8f('0x11')][_0x1c8f('0x12')]===0x1f4){logger['error'](_0x1c8f('0xd'),_0x13d08a,_0x1b71e1[_0x1c8f('0x11')][_0x1c8f('0x13')]);return _0x1eee6e(_0x1b71e1[_0x1c8f('0x11')][_0x1c8f('0x13')]);}logger[_0x1c8f('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x13d08a,_0x1b71e1['error']['message']);return _0x216a32(_0x1b71e1[_0x1c8f('0x11')][_0x1c8f('0x13')]);}else{logger[_0x1c8f('0xc')](_0x1c8f('0xd'),_0x13d08a,_0x1c8f('0xe'));_0x216a32(_0x1b71e1[_0x1c8f('0x14')][_0x1c8f('0x13')]);}})['catch'](function(_0x2983c8){logger[_0x1c8f('0x11')](_0x1c8f('0xd'),_0x13d08a,_0x2983c8);_0x1eee6e(_0x2983c8);});});}exports[_0x1c8f('0x15')]=function(_0x133e10){var _0x4bee45=this;return new Promise(function(_0x2a4842,_0x185a45){return db[_0x1c8f('0x16')][_0x1c8f('0x17')](_0x133e10[_0x1c8f('0x18')],{'raw':_0x133e10[_0x1c8f('0x19')]?_0x133e10['options'][_0x1c8f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1cc61e){logger[_0x1c8f('0xc')](_0x1c8f('0x15'),_0x133e10);logger['debug'](_0x1c8f('0x15'),_0x133e10,JSON[_0x1c8f('0x10')](_0x1cc61e));_0x2a4842(_0x1cc61e);})['catch'](function(_0x130604){logger[_0x1c8f('0x11')](_0x1c8f('0x15'),_0x130604[_0x1c8f('0x13')],_0x133e10);_0x185a45(_0x4bee45[_0x1c8f('0x11')](0x1f4,_0x130604[_0x1c8f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 44180d3..a948d1f 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 _0x0994=['showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id'];(function(_0x15fce8,_0x7612b7){var _0x3f54aa=function(_0x4c1752){while(--_0x4c1752){_0x15fce8['push'](_0x15fce8['shift']());}};_0x3f54aa(++_0x7612b7);}(_0x0994,0x1af));var _0x4099=function(_0x1e7210,_0xa95b71){_0x1e7210=_0x1e7210-0x0;var _0xad8f6d=_0x0994[_0x1e7210];return _0xad8f6d;};'use strict';var multer=require(_0x4099('0x0'));var util=require(_0x4099('0x1'));var path=require(_0x4099('0x2'));var express=require('express');var router=express[_0x4099('0x3')]();var auth=require(_0x4099('0x4'));var controller=require(_0x4099('0x5'));router[_0x4099('0x6')](_0x4099('0x7'),auth['isAuthenticated'](),controller[_0x4099('0x8')]);router['get'](_0x4099('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x4099('0x6')](_0x4099('0xa'),auth[_0x4099('0xb')](),controller[_0x4099('0xc')]);router[_0x4099('0x6')](_0x4099('0xd'),auth['isAuthenticated'](),controller[_0x4099('0xe')]);router[_0x4099('0x6')](_0x4099('0xf'),auth[_0x4099('0xb')](),controller[_0x4099('0x10')]);router[_0x4099('0x6')](_0x4099('0x11'),auth[_0x4099('0xb')](),controller['mailQueues']);router['get'](_0x4099('0x12'),auth[_0x4099('0xb')](),controller[_0x4099('0x13')]);router[_0x4099('0x6')](_0x4099('0x14'),auth[_0x4099('0xb')](),controller[_0x4099('0x15')]);router[_0x4099('0x6')](_0x4099('0x16'),auth[_0x4099('0xb')](),controller[_0x4099('0x17')]);router['get'](_0x4099('0x18'),auth[_0x4099('0xb')](),controller['whatsappQueues']);router[_0x4099('0x6')](_0x4099('0x19'),auth[_0x4099('0xb')](),controller[_0x4099('0x1a')]);router[_0x4099('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x4099('0x1b')]);router['get'](_0x4099('0x1c'),auth[_0x4099('0xb')](),controller[_0x4099('0x1d')]);router['get'](_0x4099('0x1e'),auth[_0x4099('0xb')](),controller[_0x4099('0x1f')]);router[_0x4099('0x6')](_0x4099('0x20'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x4099('0x6')](_0x4099('0x21'),auth[_0x4099('0xb')](),controller['voiceQueuesChannelRedirect']);router[_0x4099('0x6')](_0x4099('0x22'),auth[_0x4099('0xb')](),controller['showVoiceQueues']);router[_0x4099('0x6')](_0x4099('0x23'),auth['isAuthenticated'](),controller[_0x4099('0x24')]);router[_0x4099('0x6')](_0x4099('0x25'),auth[_0x4099('0xb')](),controller[_0x4099('0x26')]);router[_0x4099('0x6')](_0x4099('0x27'),auth[_0x4099('0xb')](),controller[_0x4099('0x28')]);router[_0x4099('0x29')](_0x4099('0x2a'),auth['isAuthenticated'](),controller[_0x4099('0x2b')]);router['get'](_0x4099('0x2c'),auth['isAuthenticated'](),controller[_0x4099('0x2d')]);router[_0x4099('0x6')]('/trunks',auth[_0x4099('0xb')](),controller['trunks']);router['get'](_0x4099('0x2e'),auth[_0x4099('0xb')](),controller[_0x4099('0x2f')]);router[_0x4099('0x6')](_0x4099('0x30'),auth[_0x4099('0xb')](),controller[_0x4099('0x31')]);router[_0x4099('0x6')](_0x4099('0x32'),auth[_0x4099('0xb')](),controller[_0x4099('0x33')]);router[_0x4099('0x6')](_0x4099('0x34'),auth[_0x4099('0xb')](),controller[_0x4099('0x35')]);router[_0x4099('0x6')](_0x4099('0x36'),auth['isAuthenticated'](),controller[_0x4099('0x37')]);router[_0x4099('0x6')](_0x4099('0x38'),auth['isAuthenticated'](),controller[_0x4099('0x39')]);router[_0x4099('0x6')](_0x4099('0x3a'),auth[_0x4099('0xb')](),controller[_0x4099('0x3b')]);router[_0x4099('0x6')](_0x4099('0x3c'),auth['isAuthenticated'](),controller[_0x4099('0x3d')]);router[_0x4099('0x3e')]('/mail/queues/:id/notify',auth[_0x4099('0xb')](),controller[_0x4099('0x3f')](_0x4099('0x40')));router[_0x4099('0x6')](_0x4099('0x41'),auth['isAuthenticated'](),controller[_0x4099('0x42')]);router[_0x4099('0x3e')](_0x4099('0x43'),auth['isAuthenticated'](),controller[_0x4099('0x3f')](_0x4099('0x44')));router[_0x4099('0x6')](_0x4099('0x45'),auth[_0x4099('0xb')](),controller[_0x4099('0x46')]);router[_0x4099('0x3e')](_0x4099('0x47'),auth[_0x4099('0xb')](),controller[_0x4099('0x3f')]('fax'));router[_0x4099('0x6')](_0x4099('0x48'),auth[_0x4099('0xb')](),controller[_0x4099('0x49')]);router[_0x4099('0x3e')](_0x4099('0x4a'),auth[_0x4099('0xb')](),controller['queueNotify']('openchannel'));router['get'](_0x4099('0x4b'),auth[_0x4099('0xb')](),controller[_0x4099('0x4c')]);router[_0x4099('0x3e')]('/sms/queues/:id/notify',auth[_0x4099('0xb')](),controller['queueNotify']('sms'));router[_0x4099('0x3e')]('/whatsapp/queues/:id/notify',auth[_0x4099('0xb')](),controller[_0x4099('0x3f')](_0x4099('0x4d')));router[_0x4099('0x6')]('/sms/queues/:id',auth[_0x4099('0xb')](),controller[_0x4099('0x4e')]);router[_0x4099('0x6')](_0x4099('0x4f'),auth[_0x4099('0xb')](),controller[_0x4099('0x50')]);router[_0x4099('0x3e')](_0x4099('0x51'),auth[_0x4099('0xb')](),controller[_0x4099('0x52')]);module[_0x4099('0x53')]=router; \ No newline at end of file +var _0x88a4=['fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/:id','/outbound','outbound','/agents','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify'];(function(_0x5312ca,_0x1dd8f7){var _0x4b2505=function(_0xce6860){while(--_0xce6860){_0x5312ca['push'](_0x5312ca['shift']());}};_0x4b2505(++_0x1dd8f7);}(_0x88a4,0x12f));var _0x488a=function(_0x470cfd,_0x47c685){_0x470cfd=_0x470cfd-0x0;var _0x30d77c=_0x88a4[_0x470cfd];return _0x30d77c;};'use strict';var multer=require(_0x488a('0x0'));var util=require(_0x488a('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x488a('0x2'));var controller=require(_0x488a('0x3'));router['get'](_0x488a('0x4'),auth[_0x488a('0x5')](),controller[_0x488a('0x6')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x488a('0x5')](),controller[_0x488a('0x7')]);router[_0x488a('0x8')](_0x488a('0x9'),auth[_0x488a('0x5')](),controller['voiceChannelStopMixMonitor']);router[_0x488a('0x8')]('/voice/queues',auth[_0x488a('0x5')](),controller[_0x488a('0xa')]);router[_0x488a('0x8')](_0x488a('0xb'),auth[_0x488a('0x5')](),controller[_0x488a('0xc')]);router['get']('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x488a('0x8')](_0x488a('0xd'),auth[_0x488a('0x5')](),controller[_0x488a('0xe')]);router[_0x488a('0x8')](_0x488a('0xf'),auth['isAuthenticated'](),controller[_0x488a('0x10')]);router[_0x488a('0x8')]('/sms/queues',auth[_0x488a('0x5')](),controller[_0x488a('0x11')]);router[_0x488a('0x8')](_0x488a('0x12'),auth[_0x488a('0x5')](),controller['whatsappQueues']);router[_0x488a('0x8')](_0x488a('0x13'),auth[_0x488a('0x5')](),controller[_0x488a('0x14')]);router[_0x488a('0x8')](_0x488a('0x15'),auth[_0x488a('0x5')](),controller['voiceQueuesPreview']);router[_0x488a('0x8')]('/voice/queues/channels',auth[_0x488a('0x5')](),controller[_0x488a('0x16')]);router[_0x488a('0x8')](_0x488a('0x17'),auth[_0x488a('0x5')](),controller[_0x488a('0x18')]);router[_0x488a('0x8')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x488a('0x5')](),controller[_0x488a('0x19')]);router[_0x488a('0x8')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x488a('0x5')](),controller['voiceQueuesChannelRedirect']);router[_0x488a('0x8')](_0x488a('0x1a'),auth[_0x488a('0x5')](),controller['showVoiceQueues']);router['get'](_0x488a('0x1b'),auth[_0x488a('0x5')](),controller[_0x488a('0x1c')]);router[_0x488a('0x8')]('/outbound/channels',auth[_0x488a('0x5')](),controller['outboundChannels']);router[_0x488a('0x8')](_0x488a('0x1d'),auth['isAuthenticated'](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0x488a('0x5')](),controller['agentCapacity']);router['get'](_0x488a('0x1e'),auth[_0x488a('0x5')](),controller[_0x488a('0x1f')]);router[_0x488a('0x8')](_0x488a('0x20'),auth[_0x488a('0x5')](),controller[_0x488a('0x21')]);router[_0x488a('0x8')](_0x488a('0x22'),auth[_0x488a('0x5')](),controller[_0x488a('0x23')]);router[_0x488a('0x8')]('/fax/accounts',auth[_0x488a('0x5')](),controller[_0x488a('0x24')]);router[_0x488a('0x8')](_0x488a('0x25'),auth[_0x488a('0x5')](),controller[_0x488a('0x26')]);router[_0x488a('0x8')](_0x488a('0x27'),auth[_0x488a('0x5')](),controller[_0x488a('0x28')]);router['get'](_0x488a('0x29'),auth[_0x488a('0x5')](),controller[_0x488a('0x2a')]);router[_0x488a('0x8')]('/sms/queues/waitinginteractions',auth[_0x488a('0x5')](),controller[_0x488a('0x2b')]);router[_0x488a('0x8')](_0x488a('0x2c'),auth[_0x488a('0x5')](),controller[_0x488a('0x2d')]);router[_0x488a('0x8')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x488a('0x2e')]);router[_0x488a('0x2f')]('/mail/queues/:id/notify',auth[_0x488a('0x5')](),controller['queueNotify'](_0x488a('0x30')));router['get'](_0x488a('0x31'),auth[_0x488a('0x5')](),controller[_0x488a('0x32')]);router[_0x488a('0x2f')](_0x488a('0x33'),auth[_0x488a('0x5')](),controller[_0x488a('0x34')](_0x488a('0x35')));router['get'](_0x488a('0x36'),auth[_0x488a('0x5')](),controller[_0x488a('0x37')]);router[_0x488a('0x2f')](_0x488a('0x38'),auth[_0x488a('0x5')](),controller[_0x488a('0x34')](_0x488a('0x39')));router['get'](_0x488a('0x3a'),auth[_0x488a('0x5')](),controller['showFaxQueues']);router['post'](_0x488a('0x3b'),auth[_0x488a('0x5')](),controller[_0x488a('0x34')](_0x488a('0x3c')));router[_0x488a('0x8')](_0x488a('0x3d'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x488a('0x2f')](_0x488a('0x3e'),auth['isAuthenticated'](),controller[_0x488a('0x34')]('sms'));router['post'](_0x488a('0x3f'),auth['isAuthenticated'](),controller[_0x488a('0x34')](_0x488a('0x40')));router['get'](_0x488a('0x41'),auth[_0x488a('0x5')](),controller[_0x488a('0x42')]);router[_0x488a('0x8')](_0x488a('0x43'),auth[_0x488a('0x5')](),controller[_0x488a('0x44')]);router[_0x488a('0x2f')](_0x488a('0x45'),auth['isAuthenticated'](),controller[_0x488a('0x46')]);module[_0x488a('0x47')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e30974a..477ebfd 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 _0x066e=['Outbound','outboundChannels','OutboundChannels','agents','agentCapacity','body','interaction','hasOwnProperty','MemberReport','findAll','user','name','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','channel','Website','User','Agent\x20not\x20found','From','Start','agent','agentTransferTimeout','bluebird','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','send','isNil','rows','find','voiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x066e,0xca));var _0xe066=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x066e[_0x257642];return _0x3d813b;};'use strict';var BPromise=require(_0xe066('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0xe066('0x1'));var db=require(_0xe066('0x2'))['db'];var logger=require(_0xe066('0x3'))('api');var jayson=require(_0xe066('0x4'));var amiClient=jayson[_0xe066('0x5')]['http']({'port':0x232a});var mailClient=jayson['client'][_0xe066('0x6')]({'port':0x232b});var routingClient=jayson[_0xe066('0x5')][_0xe066('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x38aa87,_0x215dc4,_0x31ae4d){return new BPromise(function(_0x1e012b,_0x24219d){var _0x266fa2=_0x31ae4d?_0x31ae4d:amiClient;return _0x266fa2[_0xe066('0x7')](_0x38aa87,_0x215dc4)['then'](function(_0x2e81b5){if(_0x2e81b5[_0xe066('0x8')]){if(_0x2e81b5[_0xe066('0x8')][_0xe066('0x9')]===0x1f4){return _0x24219d(_0x2e81b5['error'][_0xe066('0xa')]);}return _0x1e012b(_0x2e81b5[_0xe066('0x8')]['message']);}else{_0x1e012b(_0x2e81b5['result']);}})['catch'](function(_0x13c98a){_0x24219d(_0x13c98a);});});}function respondWithResult(_0x1f2759,_0x4ee460){_0x4ee460=_0x4ee460||0xc8;return function(_0x59109e){if(_0x59109e){return _0x1f2759['status'](_0x4ee460)['json'](_0x59109e);}return _0x1f2759['sendStatus'](0x194);};}function handleError(_0xa0c67f,_0x57ce5b){_0x57ce5b=_0x57ce5b||0x1f4;return function(_0x4bc0f2){logger['error'](_0x4bc0f2['stack']);if(_0x4bc0f2['name']){delete _0x4bc0f2['name'];}_0xa0c67f['status'](_0x57ce5b)[_0xe066('0xb')](_0x4bc0f2);};}function findById(_0x4b05bc){return function(_0x3e5906){if(!_[_0xe066('0xc')](_0x4b05bc)&&!_[_0xe066('0xc')](_0x3e5906)&&!_[_0xe066('0xc')](_0x3e5906[_0xe066('0xd')])){return _[_0xe066('0xe')](_0x3e5906[_0xe066('0xd')],function(_0x4c498b){return _0x4c498b['id']==_0x4b05bc;});}return null;};}exports[_0xe066('0xf')]=function(_0x58a5cf,_0x2d567b){return respondWithRpcPromise('VoiceChannels',_0x58a5cf[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x2d567b,null))[_0xe066('0x12')](handleError(_0x2d567b,null));};exports[_0xe066('0x13')]=function(_0x33c91a,_0x4d0aa7){return respondWithRpcPromise(_0xe066('0x14'),_[_0xe066('0x15')](_0x33c91a[_0xe066('0x10')],_0x33c91a[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x4d0aa7,null))[_0xe066('0x12')](handleError(_0x4d0aa7,null));};exports['voiceChannelStopMixMonitor']=function(_0x18524f,_0x3e4911){return respondWithRpcPromise(_0xe066('0x17'),_['merge'](_0x18524f[_0xe066('0x10')],_0x18524f[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x3e4911,null))[_0xe066('0x12')](handleError(_0x3e4911,null));};exports[_0xe066('0x18')]=function(_0x51241a,_0x566ffd){return respondWithRpcPromise('VoiceQueues',_0x51241a[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x566ffd,null))[_0xe066('0x12')](handleError(_0x566ffd,null));};exports[_0xe066('0x19')]=function(_0x590893,_0x186d5a){return respondWithRpcPromise(_0xe066('0x1a'),_0x590893[_0xe066('0x10')])[_0xe066('0x11')](findById(_0x590893[_0xe066('0x16')]['id']))[_0xe066('0x11')](respondWithResult(_0x186d5a,null))['catch'](handleError(_0x186d5a,null));};exports[_0xe066('0x1b')]=function(_0x2a1e5c,_0x428183){return respondWithRpcPromise(_0xe066('0x1c'),_[_0xe066('0x15')](_0x2a1e5c[_0xe066('0x10')],_0x2a1e5c[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x428183,null))[_0xe066('0x12')](handleError(_0x428183,null));};exports[_0xe066('0x1d')]=function(_0x49e6e1,_0x2fc188){return respondWithRpcPromise(_0xe066('0x1e'),_0x49e6e1[_0xe066('0x10')])['then'](respondWithResult(_0x2fc188,null))[_0xe066('0x12')](handleError(_0x2fc188,null));};exports[_0xe066('0x1f')]=function(_0x819ef5,_0x207a78){return respondWithRpcPromise(_0xe066('0x20'),_['merge'](_0x819ef5[_0xe066('0x10')],_0x819ef5[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x207a78,null))[_0xe066('0x12')](handleError(_0x207a78,null));};exports[_0xe066('0x21')]=function(_0x531be1,_0x1f2d31){return respondWithRpcPromise(_0xe066('0x22'),_[_0xe066('0x15')](_0x531be1[_0xe066('0x10')],_0x531be1[_0xe066('0x16')]))[_0xe066('0x11')](respondWithResult(_0x1f2d31,null))[_0xe066('0x12')](handleError(_0x1f2d31,null));};exports[_0xe066('0x23')]=function(_0x2e6617,_0x428679){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xe066('0x15')](_0x2e6617[_0xe066('0x10')],_0x2e6617[_0xe066('0x16')]))['then'](respondWithResult(_0x428679,null))[_0xe066('0x12')](handleError(_0x428679,null));};exports['outbound']=function(_0x148891,_0x46eaf3){return respondWithRpcPromise(_0xe066('0x24'),_0x148891[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x46eaf3,null))[_0xe066('0x12')](handleError(_0x46eaf3,null));};exports[_0xe066('0x25')]=function(_0xd6bcc2,_0x3784b9){return respondWithRpcPromise(_0xe066('0x26'),_0xd6bcc2[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x3784b9,null))[_0xe066('0x12')](handleError(_0x3784b9,null));};exports[_0xe066('0x27')]=function(_0x16ee2d,_0x1e61d0){var _0x41f235;return respondWithRpcPromise('Agents',_0x16ee2d[_0xe066('0x10')])['then'](function(_0x4b0185){_0x41f235=_0x4b0185;return respondWithRpcPromise('Agents',_0x16ee2d[_0xe066('0x10')],routingClient);})[_0xe066('0x11')](function(_0x1b2f7f){return _[_0xe066('0x15')]({},_0x1b2f7f,_0x41f235);})[_0xe066('0x11')](respondWithResult(_0x1e61d0,null))['catch'](handleError(_0x1e61d0,null));};exports[_0xe066('0x28')]=function(_0x26498b,_0x6f6383){if(_0x26498b[_0xe066('0x29')]&&_0x26498b[_0xe066('0x29')][_0xe066('0x2a')]&&_0x26498b['user']&&_0x26498b['user']['name']){for(var _0x2a39ed in _0x26498b[_0xe066('0x29')]['interaction']){if(_0x26498b[_0xe066('0x29')][_0xe066('0x2a')][_0xe066('0x2b')](_0x2a39ed)){db[_0xe066('0x2c')][_0xe066('0x2d')]({'where':{'channel':_0x2a39ed,'membername':_0x26498b[_0xe066('0x2e')][_0xe066('0x2f')],'type':_0xe066('0x30'),'exitAt':null,'uniqueid':_0x26498b[_0xe066('0x29')]['interaction'][_0x2a39ed]&&_0x26498b[_0xe066('0x29')]['interaction'][_0x2a39ed][_0xe066('0x31')]?{'$notIn':_0x26498b[_0xe066('0x29')][_0xe066('0x2a')][_0x2a39ed]}:{'$ne':null}}})['then'](function(_0x25ad77){var _0x20b3a7=moment()[_0xe066('0x32')](_0xe066('0x33'));for(var _0x288080=0x0,_0x22d280=_0x25ad77[_0xe066('0x31')];_0x288080<_0x22d280;_0x288080+=0x1){_0x25ad77[_0x288080][_0xe066('0x34')]({'exitAt':_0x20b3a7});}});for(var _0x679353=0x0;_0x679353<_0x26498b['body'][_0xe066('0x2a')][_0x2a39ed]['length'];_0x679353+=0x1){db[_0xe066('0x2c')][_0xe066('0x35')]({'where':{'channel':_0x2a39ed,'membername':_0x26498b[_0xe066('0x2e')][_0xe066('0x2f')],'type':_0xe066('0x30'),'uniqueid':_0x26498b[_0xe066('0x29')][_0xe066('0x2a')][_0x2a39ed][_0x679353],'exitAt':null},'defaults':{'channel':_0x2a39ed,'membername':_0x26498b['user']['name'],'interface':_[_0xe066('0xc')](_0x26498b[_0xe066('0x2e')][_0xe066('0x36')])?util[_0xe066('0x32')](_0xe066('0x37'),_0x26498b[_0xe066('0x2e')][_0xe066('0x2f')]):_0x26498b[_0xe066('0x2e')][_0xe066('0x36')],'type':'INTERACTION','enterAt':moment()[_0xe066('0x32')](_0xe066('0x33')),'role':'agent','internal':_0x26498b[_0xe066('0x2e')]['internal'],'uniqueid':_0x26498b[_0xe066('0x29')][_0xe066('0x2a')][_0x2a39ed][_0x679353]}});}}}}return respondWithRpcPromise(_0xe066('0x38'),{'id':_0x26498b[_0xe066('0x16')]['id'],'capacity':_0x26498b[_0xe066('0x29')][_0xe066('0x39')]},routingClient)[_0xe066('0x11')](respondWithResult(_0x6f6383,null))['catch'](handleError(_0x6f6383,null));};exports[_0xe066('0x3a')]=function(_0x2ae5ac,_0x2921e4){return respondWithRpcPromise(_0xe066('0x3b'),_0x2ae5ac[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x2921e4,null))[_0xe066('0x12')](handleError(_0x2921e4,null));};exports[_0xe066('0x3c')]=function(_0x685ac5,_0x12bd03){return respondWithRpcPromise(_0xe066('0x3d'),_0x685ac5[_0xe066('0x10')])[_0xe066('0x11')](respondWithResult(_0x12bd03,null))[_0xe066('0x12')](handleError(_0x12bd03,null));};exports[_0xe066('0x3e')]=function(_0x246c54,_0x59e57d){return respondWithRpcPromise(_0xe066('0x3f'),_0x246c54[_0xe066('0x10')])['then'](respondWithResult(_0x59e57d,null))[_0xe066('0x12')](handleError(_0x59e57d,null));};exports[_0xe066('0x40')]=function(_0x1f03de,_0x30bf02){return respondWithRpcPromise('ChatQueues',_0x1f03de['query'],routingClient)['then'](respondWithResult(_0x30bf02,null))[_0xe066('0x12')](handleError(_0x30bf02,null));};exports[_0xe066('0x41')]=function(_0x10d5cd,_0x27a44f){return respondWithRpcPromise('ChatQueues',_0x10d5cd[_0xe066('0x10')],routingClient)[_0xe066('0x11')](findById(_0x10d5cd['params']['id']))[_0xe066('0x11')](respondWithResult(_0x27a44f,null))[_0xe066('0x12')](handleError(_0x27a44f,null));};exports[_0xe066('0x42')]=function(_0x591ac1,_0x30404d){return respondWithRpcPromise(_0xe066('0x43'),_0x591ac1[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x30404d,null))['catch'](handleError(_0x30404d,null));};exports[_0xe066('0x44')]=function(_0x3d0747,_0x1d0e8b){return respondWithRpcPromise('MailQueues',_0x3d0747[_0xe066('0x10')],routingClient)['then'](findById(_0x3d0747[_0xe066('0x16')]['id']))[_0xe066('0x11')](respondWithResult(_0x1d0e8b,null))['catch'](handleError(_0x1d0e8b,null));};exports[_0xe066('0x45')]=function(_0x291467,_0x3ce7d7){return respondWithRpcPromise('MailAccounts',_0x291467[_0xe066('0x10')],mailClient)[_0xe066('0x11')](respondWithResult(_0x3ce7d7,null))[_0xe066('0x12')](handleError(_0x3ce7d7,null));};exports[_0xe066('0x46')]=function(_0x38e3af,_0x33d4a4){return respondWithRpcPromise('OpenchannelQueues',_0x38e3af['query'],routingClient)['then'](respondWithResult(_0x33d4a4,null))[_0xe066('0x12')](handleError(_0x33d4a4,null));};exports['showOpenchannelQueues']=function(_0x1e49c1,_0x437575){return respondWithRpcPromise(_0xe066('0x47'),_0x1e49c1['query'],routingClient)['then'](findById(_0x1e49c1[_0xe066('0x16')]['id']))['then'](respondWithResult(_0x437575,null))[_0xe066('0x12')](handleError(_0x437575,null));};exports[_0xe066('0x48')]=function(_0xa78bd1,_0x585c32){return respondWithRpcPromise(_0xe066('0x49'),_0xa78bd1[_0xe066('0x10')],routingClient)['then'](respondWithResult(_0x585c32,null))[_0xe066('0x12')](handleError(_0x585c32,null));};exports[_0xe066('0x4a')]=function(_0x190d7e,_0x4f0868){return respondWithRpcPromise(_0xe066('0x49'),_0x190d7e[_0xe066('0x10')],routingClient)[_0xe066('0x11')](findById(_0x190d7e['params']['id']))['then'](respondWithResult(_0x4f0868,null))[_0xe066('0x12')](handleError(_0x4f0868,null));};exports[_0xe066('0x4b')]=function(_0x34cb84,_0x4db8b4){return respondWithRpcPromise(_0xe066('0x4c'),_0x34cb84[_0xe066('0x10')],routingClient)['then'](respondWithResult(_0x4db8b4,null))[_0xe066('0x12')](handleError(_0x4db8b4,null));};exports[_0xe066('0x4d')]=function(_0x363216,_0x51e7df){return respondWithRpcPromise('WhatsappQueues',_0x363216['query'],routingClient)[_0xe066('0x11')](findById(_0x363216['params']['id']))[_0xe066('0x11')](respondWithResult(_0x51e7df,null))[_0xe066('0x12')](handleError(_0x51e7df,null));};exports[_0xe066('0x4e')]=function(_0x59a80d,_0x258a0c){return respondWithRpcPromise(_0xe066('0x4f'),_0x59a80d['query'],routingClient)[_0xe066('0x11')](respondWithResult(_0x258a0c,null))['catch'](handleError(_0x258a0c,null));};exports[_0xe066('0x50')]=function(_0x4957a4,_0x192c24){return respondWithRpcPromise('FaxQueues',_0x4957a4[_0xe066('0x10')],routingClient)[_0xe066('0x11')](findById(_0x4957a4[_0xe066('0x16')]['id']))[_0xe066('0x11')](respondWithResult(_0x192c24,null))[_0xe066('0x12')](handleError(_0x192c24,null));};exports['faxAccounts']=function(_0x4d66e1,_0x1c2b89){return respondWithRpcPromise(_0xe066('0x51'),_0x4d66e1[_0xe066('0x10')])['then'](respondWithResult(_0x1c2b89,null))[_0xe066('0x12')](handleError(_0x1c2b89,null));};exports[_0xe066('0x52')]=function(_0x474ecd,_0x1ff452){return respondWithRpcPromise(_0xe066('0x53'),_0x474ecd[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x1ff452,null))['catch'](handleError(_0x1ff452,null));};exports['mailQueuesWaitingInteractions']=function(_0x3cb607,_0x43a91b){return respondWithRpcPromise(_0xe066('0x54'),_0x3cb607[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x43a91b,null))[_0xe066('0x12')](handleError(_0x43a91b,null));};exports[_0xe066('0x55')]=function(_0xcb01ca,_0x6544db){return respondWithRpcPromise(_0xe066('0x56'),_0xcb01ca[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x6544db,null))[_0xe066('0x12')](handleError(_0x6544db,null));};exports['smsQueuesWaitingInteractions']=function(_0x476151,_0x19a97d){return respondWithRpcPromise(_0xe066('0x57'),_0x476151[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x19a97d,null))['catch'](handleError(_0x19a97d,null));};exports[_0xe066('0x58')]=function(_0x10d550,_0x1a8f63){return respondWithRpcPromise(_0xe066('0x59'),_0x10d550['query'],routingClient)[_0xe066('0x11')](respondWithResult(_0x1a8f63,null))['catch'](handleError(_0x1a8f63,null));};exports[_0xe066('0x5a')]=function(_0x5b6e77,_0x5b109b){return respondWithRpcPromise(_0xe066('0x5b'),_0x5b6e77[_0xe066('0x10')],routingClient)[_0xe066('0x11')](respondWithResult(_0x5b109b,null))['catch'](handleError(_0x5b109b,null));};exports[_0xe066('0x5c')]=function(_0x5c6264){return function(_0x14d235,_0x95f83b){var _0x5004eb,_0x1bdd7b;var _0x1c78f9=_[_0xe066('0x5d')](_0x5c6264);var _0xe579c6=_0x5c6264===_0xe066('0x5e')?'Website':_0xe066('0x5f');return db[_0x1c78f9+_0xe066('0x60')][_0xe066('0x61')]({'raw':!![],'where':{'id':_0x14d235[_0xe066('0x16')]['id']}})[_0xe066('0x11')](function(_0x598df0){if(_[_0xe066('0xc')](_0x598df0)){throw new Error(_0x1c78f9+_0xe066('0x62'));}_0x5004eb=_0x598df0;return db[_0x1c78f9+_0xe066('0x63')][_0xe066('0x61')]({'where':{'id':_0x14d235['body']['messageId']},'include':[{'model':db[_0x1c78f9+_0xe066('0x64')],'as':_0xe066('0x64')},{'model':db[_0x1c78f9+_0xe579c6],'as':_0xe066('0x5f')}]});})['then'](function(_0x283c0e){if(_[_0xe066('0xc')](_0x283c0e)){throw new Error(_0x1c78f9+_0xe066('0x65'));}_0x1bdd7b=_0x283c0e;return _0x283c0e[_0xe066('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe066('0x11')](function(){var _0x54fff4={'uniqueid':_0x5c6264+'.'+_0x1bdd7b['id']+'.'+_0x1bdd7b[_0xe066('0x64')]['id'],'FromUserId':_0x14d235['user']['id'],'type':'queue'};_0x54fff4[_0x1c78f9+_0xe066('0x67')]=_0x1bdd7b['id'];_0x54fff4[_0x1c78f9+_0xe066('0x68')]=_0x1bdd7b[_0xe066('0x64')]['id'];_0x54fff4['From'+_0x1c78f9+_0xe579c6+'Id']=_0x1bdd7b[_0xe066('0x5f')]['id'];_0x54fff4['To'+_0x1c78f9+_0xe066('0x69')]=_0x5004eb['id'];return db[_0x1c78f9+_0xe066('0x6a')][_0xe066('0x6b')](_0x54fff4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5c6264,'interaction':_0x1bdd7b[_0xe066('0x64')],'message':_0x1bdd7b,'account':_0x1bdd7b[_0xe066('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe066('0x6c'),'appdata':_0x5004eb[_0xe066('0x2f')]+','+(_0x1bdd7b[_0xe066('0x5f')][_0xe066('0x6d')]||0x12c),'interval':_0xe066('0x6e')}]},routingClient);})[_0xe066('0x11')](respondWithResult(_0x95f83b,null))['catch'](handleError(_0x95f83b,null));};};exports['agentNotify']=function(_0x110b6a,_0x378616){var _0x27853a,_0xe9216b;if(_[_0xe066('0xc')](_0x110b6a[_0xe066('0x29')][_0xe066('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2e4624=_0x110b6a[_0xe066('0x29')][_0xe066('0x6f')];var _0x36baf1=_[_0xe066('0x5d')](_0x2e4624);var _0xf70a1b=_0x2e4624===_0xe066('0x5e')?_0xe066('0x70'):_0xe066('0x5f');return db[_0xe066('0x71')][_0xe066('0x61')]({'raw':!![],'where':{'id':_0x110b6a['params']['id'],'role':'agent'}})['then'](function(_0x14e572){if(_['isNil'](_0x14e572)){throw new Error(_0xe066('0x72'));}_0x27853a=_0x14e572;return db[_0x36baf1+_0xe066('0x63')]['findOne']({'where':{'id':_0x110b6a[_0xe066('0x29')]['messageId']},'include':[{'model':db[_0x36baf1+_0xe066('0x64')],'as':_0xe066('0x64')},{'model':db[_0x36baf1+_0xf70a1b],'as':_0xe066('0x5f')}]});})[_0xe066('0x11')](function(_0x422860){if(_[_0xe066('0xc')](_0x422860)){throw new Error(_0x36baf1+_0xe066('0x65'));}_0xe9216b=_0x422860;return _0x422860[_0xe066('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe066('0x11')](function(){var _0xa9e40c={'uniqueid':_0x2e4624+'.'+_0xe9216b['id']+'.'+_0xe9216b[_0xe066('0x64')]['id'],'FromUserId':_0x110b6a['user']['id'],'type':_0xe066('0x6c'),'ToUserId':_0x27853a['id']};_0xa9e40c[_0x36baf1+'MessageId']=_0xe9216b['id'];_0xa9e40c[_0x36baf1+_0xe066('0x68')]=_0xe9216b['Interaction']['id'];_0xa9e40c[_0xe066('0x73')+_0x36baf1+_0xf70a1b+'Id']=_0xe9216b['Account']['id'];return db[_0x36baf1+_0xe066('0x6a')][_0xe066('0x6b')](_0xa9e40c);})['then'](function(){return respondWithRpcPromise(_0xe066('0x74'),{'channel':_0x2e4624,'interaction':_0xe9216b['Interaction'],'message':_0xe9216b,'account':_0xe9216b[_0xe066('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe066('0x75'),'appdata':_0x27853a['name']+','+(_0xe9216b[_0xe066('0x5f')][_0xe066('0x76')]||0x12c),'interval':_0xe066('0x6e')}]},routingClient);})[_0xe066('0x11')](respondWithResult(_0x378616,null))[_0xe066('0x12')](handleError(_0x378616,null));}; \ No newline at end of file +var _0x2480=['result','catch','json','name','status','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','body','user','interaction','findAll','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','InteractionId','From','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','MessageId','create','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','http','client','request','then','error','message'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0x2480,0x1c9));var _0x0248=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2480[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0248('0x0'));var _=require(_0x0248('0x1'));var util=require(_0x0248('0x2'));var db=require(_0x0248('0x3'))['db'];var logger=require(_0x0248('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x0248('0x5')]({'port':0x232a});var mailClient=jayson[_0x0248('0x6')][_0x0248('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x0248('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x31c4e9,_0x50cd43,_0x422dbe){return new BPromise(function(_0x7b9b3,_0x257506){var _0x2ab025=_0x422dbe?_0x422dbe:amiClient;return _0x2ab025[_0x0248('0x7')](_0x31c4e9,_0x50cd43)[_0x0248('0x8')](function(_0x4e0772){if(_0x4e0772[_0x0248('0x9')]){if(_0x4e0772['error']['code']===0x1f4){return _0x257506(_0x4e0772['error'][_0x0248('0xa')]);}return _0x7b9b3(_0x4e0772[_0x0248('0x9')][_0x0248('0xa')]);}else{_0x7b9b3(_0x4e0772[_0x0248('0xb')]);}})[_0x0248('0xc')](function(_0x234663){_0x257506(_0x234663);});});}function respondWithResult(_0x480c1d,_0x1d1f40){_0x1d1f40=_0x1d1f40||0xc8;return function(_0x3b0539){if(_0x3b0539){return _0x480c1d['status'](_0x1d1f40)[_0x0248('0xd')](_0x3b0539);}return _0x480c1d['sendStatus'](0x194);};}function handleError(_0x412920,_0x17f98f){_0x17f98f=_0x17f98f||0x1f4;return function(_0x535776){logger[_0x0248('0x9')](_0x535776['stack']);if(_0x535776[_0x0248('0xe')]){delete _0x535776[_0x0248('0xe')];}_0x412920[_0x0248('0xf')](_0x17f98f)[_0x0248('0x10')](_0x535776);};}function findById(_0x4eb1c4){return function(_0x329f33){if(!_['isNil'](_0x4eb1c4)&&!_[_0x0248('0x11')](_0x329f33)&&!_['isNil'](_0x329f33[_0x0248('0x12')])){return _['find'](_0x329f33[_0x0248('0x12')],function(_0x57a94c){return _0x57a94c['id']==_0x4eb1c4;});}return null;};}exports[_0x0248('0x13')]=function(_0x2e9678,_0x457be0){return respondWithRpcPromise(_0x0248('0x14'),_0x2e9678[_0x0248('0x15')])[_0x0248('0x8')](respondWithResult(_0x457be0,null))[_0x0248('0xc')](handleError(_0x457be0,null));};exports[_0x0248('0x16')]=function(_0x452b50,_0x2e817a){return respondWithRpcPromise(_0x0248('0x17'),_[_0x0248('0x18')](_0x452b50[_0x0248('0x15')],_0x452b50[_0x0248('0x19')]))[_0x0248('0x8')](respondWithResult(_0x2e817a,null))['catch'](handleError(_0x2e817a,null));};exports[_0x0248('0x1a')]=function(_0x1cbcc9,_0x5b4c09){return respondWithRpcPromise(_0x0248('0x1b'),_['merge'](_0x1cbcc9[_0x0248('0x15')],_0x1cbcc9[_0x0248('0x19')]))[_0x0248('0x8')](respondWithResult(_0x5b4c09,null))[_0x0248('0xc')](handleError(_0x5b4c09,null));};exports[_0x0248('0x1c')]=function(_0x5395a6,_0x1a1e3f){return respondWithRpcPromise(_0x0248('0x1d'),_0x5395a6[_0x0248('0x15')])['then'](respondWithResult(_0x1a1e3f,null))[_0x0248('0xc')](handleError(_0x1a1e3f,null));};exports['showVoiceQueues']=function(_0xbd7d2a,_0x41fc4f){return respondWithRpcPromise(_0x0248('0x1d'),_0xbd7d2a[_0x0248('0x15')])[_0x0248('0x8')](findById(_0xbd7d2a['params']['id']))[_0x0248('0x8')](respondWithResult(_0x41fc4f,null))['catch'](handleError(_0x41fc4f,null));};exports[_0x0248('0x1e')]=function(_0x14ecfe,_0x3f8156){return respondWithRpcPromise(_0x0248('0x1f'),_['merge'](_0x14ecfe[_0x0248('0x15')],_0x14ecfe[_0x0248('0x19')]))[_0x0248('0x8')](respondWithResult(_0x3f8156,null))[_0x0248('0xc')](handleError(_0x3f8156,null));};exports[_0x0248('0x20')]=function(_0x497341,_0x130714){return respondWithRpcPromise(_0x0248('0x21'),_0x497341[_0x0248('0x15')])['then'](respondWithResult(_0x130714,null))[_0x0248('0xc')](handleError(_0x130714,null));};exports[_0x0248('0x22')]=function(_0x2b12f3,_0x204490){return respondWithRpcPromise(_0x0248('0x23'),_[_0x0248('0x18')](_0x2b12f3['query'],_0x2b12f3[_0x0248('0x19')]))[_0x0248('0x8')](respondWithResult(_0x204490,null))[_0x0248('0xc')](handleError(_0x204490,null));};exports[_0x0248('0x24')]=function(_0x5c992c,_0x2f08e7){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x0248('0x18')](_0x5c992c[_0x0248('0x15')],_0x5c992c[_0x0248('0x19')]))[_0x0248('0x8')](respondWithResult(_0x2f08e7,null))[_0x0248('0xc')](handleError(_0x2f08e7,null));};exports[_0x0248('0x25')]=function(_0x27c817,_0x142971){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x0248('0x18')](_0x27c817[_0x0248('0x15')],_0x27c817[_0x0248('0x19')]))[_0x0248('0x8')](respondWithResult(_0x142971,null))[_0x0248('0xc')](handleError(_0x142971,null));};exports[_0x0248('0x26')]=function(_0x4dcf14,_0x3ec7c9){return respondWithRpcPromise(_0x0248('0x27'),_0x4dcf14['query'])[_0x0248('0x8')](respondWithResult(_0x3ec7c9,null))[_0x0248('0xc')](handleError(_0x3ec7c9,null));};exports[_0x0248('0x28')]=function(_0x512ec9,_0x19c04a){return respondWithRpcPromise('OutboundChannels',_0x512ec9['query'])[_0x0248('0x8')](respondWithResult(_0x19c04a,null))['catch'](handleError(_0x19c04a,null));};exports[_0x0248('0x29')]=function(_0x378a1f,_0x3ff848){var _0x89ddca;return respondWithRpcPromise('Agents',_0x378a1f[_0x0248('0x15')])[_0x0248('0x8')](function(_0x493b42){_0x89ddca=_0x493b42;return respondWithRpcPromise(_0x0248('0x2a'),_0x378a1f[_0x0248('0x15')],routingClient);})[_0x0248('0x8')](function(_0x41ebea){return _[_0x0248('0x18')]({},_0x41ebea,_0x89ddca);})[_0x0248('0x8')](respondWithResult(_0x3ff848,null))['catch'](handleError(_0x3ff848,null));};exports['agentCapacity']=function(_0x57181e,_0x262af7){if(_0x57181e[_0x0248('0x2b')]&&_0x57181e['body']['interaction']&&_0x57181e[_0x0248('0x2c')]&&_0x57181e[_0x0248('0x2c')][_0x0248('0xe')]){for(var _0x47108f in _0x57181e[_0x0248('0x2b')][_0x0248('0x2d')]){if(_0x57181e[_0x0248('0x2b')][_0x0248('0x2d')]['hasOwnProperty'](_0x47108f)){db['MemberReport'][_0x0248('0x2e')]({'where':{'channel':_0x47108f,'membername':_0x57181e[_0x0248('0x2c')][_0x0248('0xe')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x57181e[_0x0248('0x2b')]['interaction'][_0x47108f]&&_0x57181e['body'][_0x0248('0x2d')][_0x47108f][_0x0248('0x2f')]?{'$notIn':_0x57181e[_0x0248('0x2b')][_0x0248('0x2d')][_0x47108f]}:{'$ne':null}}})['then'](function(_0x394499){var _0x3c51f7=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x333519=0x0,_0x407940=_0x394499[_0x0248('0x2f')];_0x333519<_0x407940;_0x333519+=0x1){_0x394499[_0x333519][_0x0248('0x30')]({'exitAt':_0x3c51f7});}});for(var _0x1bc32d=0x0;_0x1bc32d<_0x57181e['body'][_0x0248('0x2d')][_0x47108f][_0x0248('0x2f')];_0x1bc32d+=0x1){db[_0x0248('0x31')][_0x0248('0x32')]({'where':{'channel':_0x47108f,'membername':_0x57181e[_0x0248('0x2c')][_0x0248('0xe')],'type':_0x0248('0x33'),'uniqueid':_0x57181e[_0x0248('0x2b')][_0x0248('0x2d')][_0x47108f][_0x1bc32d],'exitAt':null},'defaults':{'channel':_0x47108f,'membername':_0x57181e[_0x0248('0x2c')][_0x0248('0xe')],'interface':_[_0x0248('0x11')](_0x57181e[_0x0248('0x2c')][_0x0248('0x34')])?util[_0x0248('0x35')]('SIP/%s',_0x57181e[_0x0248('0x2c')]['name']):_0x57181e[_0x0248('0x2c')][_0x0248('0x34')],'type':_0x0248('0x33'),'enterAt':moment()['format'](_0x0248('0x36')),'role':_0x0248('0x37'),'internal':_0x57181e[_0x0248('0x2c')][_0x0248('0x38')],'uniqueid':_0x57181e[_0x0248('0x2b')]['interaction'][_0x47108f][_0x1bc32d]}});}}}}return respondWithRpcPromise(_0x0248('0x39'),{'id':_0x57181e[_0x0248('0x19')]['id'],'capacity':_0x57181e[_0x0248('0x2b')][_0x0248('0x3a')]},routingClient)[_0x0248('0x8')](respondWithResult(_0x262af7,null))[_0x0248('0xc')](handleError(_0x262af7,null));};exports['telephones']=function(_0x4f7c5c,_0x2357fd){return respondWithRpcPromise('Telephones',_0x4f7c5c['query'])[_0x0248('0x8')](respondWithResult(_0x2357fd,null))[_0x0248('0xc')](handleError(_0x2357fd,null));};exports[_0x0248('0x3b')]=function(_0x1459d1,_0x3a93da){return respondWithRpcPromise('Trunks',_0x1459d1[_0x0248('0x15')])[_0x0248('0x8')](respondWithResult(_0x3a93da,null))[_0x0248('0xc')](handleError(_0x3a93da,null));};exports[_0x0248('0x3c')]=function(_0x279fb0,_0x42b48c){return respondWithRpcPromise(_0x0248('0x3d'),_0x279fb0[_0x0248('0x15')])['then'](respondWithResult(_0x42b48c,null))[_0x0248('0xc')](handleError(_0x42b48c,null));};exports[_0x0248('0x3e')]=function(_0x3c6857,_0x1336f8){return respondWithRpcPromise(_0x0248('0x3f'),_0x3c6857[_0x0248('0x15')],routingClient)[_0x0248('0x8')](respondWithResult(_0x1336f8,null))[_0x0248('0xc')](handleError(_0x1336f8,null));};exports[_0x0248('0x40')]=function(_0x1070c5,_0x5a55c8){return respondWithRpcPromise('ChatQueues',_0x1070c5[_0x0248('0x15')],routingClient)[_0x0248('0x8')](findById(_0x1070c5[_0x0248('0x19')]['id']))['then'](respondWithResult(_0x5a55c8,null))['catch'](handleError(_0x5a55c8,null));};exports[_0x0248('0x41')]=function(_0x362911,_0x1851fc){return respondWithRpcPromise('MailQueues',_0x362911[_0x0248('0x15')],routingClient)[_0x0248('0x8')](respondWithResult(_0x1851fc,null))['catch'](handleError(_0x1851fc,null));};exports[_0x0248('0x42')]=function(_0x4f9cef,_0x311eeb){return respondWithRpcPromise(_0x0248('0x43'),_0x4f9cef[_0x0248('0x15')],routingClient)['then'](findById(_0x4f9cef[_0x0248('0x19')]['id']))[_0x0248('0x8')](respondWithResult(_0x311eeb,null))[_0x0248('0xc')](handleError(_0x311eeb,null));};exports[_0x0248('0x44')]=function(_0x50773b,_0x21b625){return respondWithRpcPromise(_0x0248('0x45'),_0x50773b['query'],mailClient)[_0x0248('0x8')](respondWithResult(_0x21b625,null))[_0x0248('0xc')](handleError(_0x21b625,null));};exports['openchannelQueues']=function(_0xd4b6a,_0x4bead0){return respondWithRpcPromise(_0x0248('0x46'),_0xd4b6a[_0x0248('0x15')],routingClient)[_0x0248('0x8')](respondWithResult(_0x4bead0,null))[_0x0248('0xc')](handleError(_0x4bead0,null));};exports['showOpenchannelQueues']=function(_0x206096,_0x3da5ba){return respondWithRpcPromise(_0x0248('0x46'),_0x206096[_0x0248('0x15')],routingClient)[_0x0248('0x8')](findById(_0x206096[_0x0248('0x19')]['id']))['then'](respondWithResult(_0x3da5ba,null))[_0x0248('0xc')](handleError(_0x3da5ba,null));};exports['smsQueues']=function(_0x307170,_0x577d66){return respondWithRpcPromise(_0x0248('0x47'),_0x307170['query'],routingClient)[_0x0248('0x8')](respondWithResult(_0x577d66,null))['catch'](handleError(_0x577d66,null));};exports['showSmsQueues']=function(_0x27412a,_0x4a70dd){return respondWithRpcPromise(_0x0248('0x47'),_0x27412a[_0x0248('0x15')],routingClient)['then'](findById(_0x27412a[_0x0248('0x19')]['id']))[_0x0248('0x8')](respondWithResult(_0x4a70dd,null))['catch'](handleError(_0x4a70dd,null));};exports[_0x0248('0x48')]=function(_0x2c24f3,_0x42eb08){return respondWithRpcPromise(_0x0248('0x49'),_0x2c24f3['query'],routingClient)[_0x0248('0x8')](respondWithResult(_0x42eb08,null))[_0x0248('0xc')](handleError(_0x42eb08,null));};exports[_0x0248('0x4a')]=function(_0x4e6a12,_0x29289f){return respondWithRpcPromise(_0x0248('0x49'),_0x4e6a12[_0x0248('0x15')],routingClient)[_0x0248('0x8')](findById(_0x4e6a12[_0x0248('0x19')]['id']))[_0x0248('0x8')](respondWithResult(_0x29289f,null))[_0x0248('0xc')](handleError(_0x29289f,null));};exports[_0x0248('0x4b')]=function(_0x11749d,_0x547c48){return respondWithRpcPromise(_0x0248('0x4c'),_0x11749d['query'],routingClient)[_0x0248('0x8')](respondWithResult(_0x547c48,null))[_0x0248('0xc')](handleError(_0x547c48,null));};exports['showFaxQueues']=function(_0x4a0fb0,_0x457ea3){return respondWithRpcPromise(_0x0248('0x4c'),_0x4a0fb0['query'],routingClient)['then'](findById(_0x4a0fb0[_0x0248('0x19')]['id']))[_0x0248('0x8')](respondWithResult(_0x457ea3,null))[_0x0248('0xc')](handleError(_0x457ea3,null));};exports[_0x0248('0x4d')]=function(_0x5f260b,_0x214fd1){return respondWithRpcPromise(_0x0248('0x4e'),_0x5f260b[_0x0248('0x15')])[_0x0248('0x8')](respondWithResult(_0x214fd1,null))[_0x0248('0xc')](handleError(_0x214fd1,null));};exports[_0x0248('0x4f')]=function(_0x19e19c,_0x944d9d){return respondWithRpcPromise(_0x0248('0x50'),_0x19e19c[_0x0248('0x15')],routingClient)[_0x0248('0x8')](respondWithResult(_0x944d9d,null))[_0x0248('0xc')](handleError(_0x944d9d,null));};exports[_0x0248('0x51')]=function(_0x141a88,_0x1aeadf){return respondWithRpcPromise(_0x0248('0x52'),_0x141a88[_0x0248('0x15')],routingClient)[_0x0248('0x8')](respondWithResult(_0x1aeadf,null))[_0x0248('0xc')](handleError(_0x1aeadf,null));};exports[_0x0248('0x53')]=function(_0x4dfa75,_0x23f224){return respondWithRpcPromise(_0x0248('0x54'),_0x4dfa75['query'],routingClient)[_0x0248('0x8')](respondWithResult(_0x23f224,null))[_0x0248('0xc')](handleError(_0x23f224,null));};exports[_0x0248('0x55')]=function(_0x2af8b0,_0x1059fc){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2af8b0[_0x0248('0x15')],routingClient)['then'](respondWithResult(_0x1059fc,null))['catch'](handleError(_0x1059fc,null));};exports[_0x0248('0x56')]=function(_0x358c2d,_0x5d7aa1){return respondWithRpcPromise(_0x0248('0x57'),_0x358c2d['query'],routingClient)[_0x0248('0x8')](respondWithResult(_0x5d7aa1,null))[_0x0248('0xc')](handleError(_0x5d7aa1,null));};exports[_0x0248('0x58')]=function(_0x36c48,_0x3e15e2){return respondWithRpcPromise(_0x0248('0x59'),_0x36c48[_0x0248('0x15')],routingClient)[_0x0248('0x8')](respondWithResult(_0x3e15e2,null))['catch'](handleError(_0x3e15e2,null));};exports[_0x0248('0x5a')]=function(_0x56bd66){return function(_0xe77802,_0x3540e9){var _0x13448c,_0x5a2581;var _0x4840a9=_[_0x0248('0x5b')](_0x56bd66);var _0x3577f6=_0x56bd66===_0x0248('0x5c')?_0x0248('0x5d'):_0x0248('0x5e');return db[_0x4840a9+_0x0248('0x5f')][_0x0248('0x60')]({'raw':!![],'where':{'id':_0xe77802[_0x0248('0x19')]['id']}})[_0x0248('0x8')](function(_0x3e029b){if(_[_0x0248('0x11')](_0x3e029b)){throw new Error(_0x4840a9+_0x0248('0x61'));}_0x13448c=_0x3e029b;return db[_0x4840a9+_0x0248('0x62')]['findOne']({'where':{'id':_0xe77802[_0x0248('0x2b')][_0x0248('0x63')]},'include':[{'model':db[_0x4840a9+_0x0248('0x64')],'as':_0x0248('0x64')},{'model':db[_0x4840a9+_0x3577f6],'as':_0x0248('0x5e')}]});})[_0x0248('0x8')](function(_0x490f3b){if(_['isNil'](_0x490f3b)){throw new Error(_0x4840a9+_0x0248('0x65'));}_0x5a2581=_0x490f3b;return _0x490f3b[_0x0248('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0248('0x8')](function(){var _0x5874e5={'uniqueid':_0x56bd66+'.'+_0x5a2581['id']+'.'+_0x5a2581[_0x0248('0x64')]['id'],'FromUserId':_0xe77802[_0x0248('0x2c')]['id'],'type':'queue'};_0x5874e5[_0x4840a9+'MessageId']=_0x5a2581['id'];_0x5874e5[_0x4840a9+_0x0248('0x67')]=_0x5a2581[_0x0248('0x64')]['id'];_0x5874e5[_0x0248('0x68')+_0x4840a9+_0x3577f6+'Id']=_0x5a2581[_0x0248('0x5e')]['id'];_0x5874e5['To'+_0x4840a9+'QueueId']=_0x13448c['id'];return db[_0x4840a9+_0x0248('0x69')]['create'](_0x5874e5);})['then'](function(){return respondWithRpcPromise(_0x0248('0x6a'),{'channel':_0x56bd66,'interaction':_0x5a2581[_0x0248('0x64')],'message':_0x5a2581,'account':_0x5a2581['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x0248('0x6b'),'appdata':_0x13448c[_0x0248('0xe')]+','+(_0x5a2581[_0x0248('0x5e')][_0x0248('0x6c')]||0x12c),'interval':_0x0248('0x6d')}]},routingClient);})[_0x0248('0x8')](respondWithResult(_0x3540e9,null))[_0x0248('0xc')](handleError(_0x3540e9,null));};};exports[_0x0248('0x6e')]=function(_0x195e44,_0xa95088){var _0x2fa7f2,_0x5a9b02;if(_[_0x0248('0x11')](_0x195e44['body'][_0x0248('0x6f')])){throw new Error(_0x0248('0x70'));}var _0x111054=_0x195e44[_0x0248('0x2b')][_0x0248('0x6f')];var _0x3fb218=_[_0x0248('0x5b')](_0x111054);var _0x38c89b=_0x111054===_0x0248('0x5c')?_0x0248('0x5d'):_0x0248('0x5e');return db['User'][_0x0248('0x60')]({'raw':!![],'where':{'id':_0x195e44[_0x0248('0x19')]['id'],'role':_0x0248('0x37')}})['then'](function(_0x60d91a){if(_[_0x0248('0x11')](_0x60d91a)){throw new Error(_0x0248('0x71'));}_0x2fa7f2=_0x60d91a;return db[_0x3fb218+_0x0248('0x62')][_0x0248('0x60')]({'where':{'id':_0x195e44['body'][_0x0248('0x63')]},'include':[{'model':db[_0x3fb218+_0x0248('0x64')],'as':'Interaction'},{'model':db[_0x3fb218+_0x38c89b],'as':'Account'}]});})[_0x0248('0x8')](function(_0x465f71){if(_[_0x0248('0x11')](_0x465f71)){throw new Error(_0x3fb218+_0x0248('0x65'));}_0x5a9b02=_0x465f71;return _0x465f71['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0248('0x8')](function(){var _0x3b5685={'uniqueid':_0x111054+'.'+_0x5a9b02['id']+'.'+_0x5a9b02['Interaction']['id'],'FromUserId':_0x195e44[_0x0248('0x2c')]['id'],'type':_0x0248('0x6b'),'ToUserId':_0x2fa7f2['id']};_0x3b5685[_0x3fb218+_0x0248('0x72')]=_0x5a9b02['id'];_0x3b5685[_0x3fb218+_0x0248('0x67')]=_0x5a9b02[_0x0248('0x64')]['id'];_0x3b5685['From'+_0x3fb218+_0x38c89b+'Id']=_0x5a9b02[_0x0248('0x5e')]['id'];return db[_0x3fb218+'TransferReport'][_0x0248('0x73')](_0x3b5685);})[_0x0248('0x8')](function(){return respondWithRpcPromise(_0x0248('0x6a'),{'channel':_0x111054,'interaction':_0x5a9b02['Interaction'],'message':_0x5a9b02,'account':_0x5a9b02['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x0248('0x37'),'appdata':_0x2fa7f2[_0x0248('0xe')]+','+(_0x5a9b02['Account'][_0x0248('0x74')]||0x12c),'interval':_0x0248('0x6d')}]},routingClient);})[_0x0248('0x8')](respondWithResult(_0xa95088,null))[_0x0248('0xc')](handleError(_0xa95088,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9b4db9c..eb3f071 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 _0x1936=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id','show','/:id/run','isAuthenticated','post','create','put','delete','destroy','exports','multer','path'];(function(_0x157979,_0x3cc241){var _0x92417f=function(_0x877393){while(--_0x877393){_0x157979['push'](_0x157979['shift']());}};_0x92417f(++_0x3cc241);}(_0x1936,0x96));var _0x6193=function(_0x5841d3,_0x5bcb4c){_0x5841d3=_0x5841d3-0x0;var _0x25bfd2=_0x1936[_0x5841d3];return _0x25bfd2;};'use strict';var multer=require(_0x6193('0x0'));var util=require('util');var path=require(_0x6193('0x1'));var timeout=require(_0x6193('0x2'));var express=require(_0x6193('0x3'));var router=express[_0x6193('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6193('0x5'));var config=require(_0x6193('0x6'));var controller=require(_0x6193('0x7'));router[_0x6193('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6193('0x8')](_0x6193('0x9'),auth['isAuthenticated'](),controller[_0x6193('0xa')]);router[_0x6193('0x8')](_0x6193('0xb'),auth[_0x6193('0xc')](),controller['run']);router[_0x6193('0xd')]('/',auth[_0x6193('0xc')](),controller[_0x6193('0xe')]);router[_0x6193('0xf')]('/:id',auth[_0x6193('0xc')](),controller['update']);router[_0x6193('0x10')](_0x6193('0x9'),auth[_0x6193('0xc')](),controller[_0x6193('0x11')]);module[_0x6193('0x12')]=router; \ No newline at end of file +var _0x0e9c=['run','post','create','put','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x0e9c,0x15c));var _0xc0e9=function(_0x421303,_0x4691d3){_0x421303=_0x421303-0x0;var _0x181431=_0x0e9c[_0x421303];return _0x181431;};'use strict';var multer=require(_0xc0e9('0x0'));var util=require(_0xc0e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc0e9('0x2'));var router=express[_0xc0e9('0x3')]();var auth=require(_0xc0e9('0x4'));var interaction=require(_0xc0e9('0x5'));var config=require(_0xc0e9('0x6'));var controller=require(_0xc0e9('0x7'));router[_0xc0e9('0x8')]('/',auth[_0xc0e9('0x9')](),controller[_0xc0e9('0xa')]);router[_0xc0e9('0x8')](_0xc0e9('0xb'),auth[_0xc0e9('0x9')](),controller['show']);router['get'](_0xc0e9('0xc'),auth[_0xc0e9('0x9')](),controller[_0xc0e9('0xd')]);router[_0xc0e9('0xe')]('/',auth[_0xc0e9('0x9')](),controller[_0xc0e9('0xf')]);router[_0xc0e9('0x10')](_0xc0e9('0xb'),auth[_0xc0e9('0x9')](),controller['update']);router[_0xc0e9('0x11')](_0xc0e9('0xb'),auth[_0xc0e9('0x9')](),controller[_0xc0e9('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 46974c2..52ffd2e 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 _0x1c3b=['BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','pdf','xlsx','csv','custom','default','TEXT'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1c3b,0xab));var _0xb1c3=function(_0x27c35b,_0xc203d2){_0x27c35b=_0x27c35b-0x0;var _0x26bf35=_0x1c3b[_0x27c35b];return _0x26bf35;};'use strict';var Sequelize=require(_0xb1c3('0x0'));module[_0xb1c3('0x1')]={'name':{'type':Sequelize[_0xb1c3('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb1c3('0x2')],'allowNull':![],'defaultValue':_0xb1c3('0x3')},'startAt':{'type':Sequelize[_0xb1c3('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb1c3('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb1c3('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb1c3('0x6')]('years',_0xb1c3('0x7'),_0xb1c3('0x8'),_0xb1c3('0x9'),'days','hours','minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xb1c3('0x6')]('csv',_0xb1c3('0xa'),_0xb1c3('0xb')),'allowNull':![],'defaultValue':_0xb1c3('0xc')},'type':{'type':Sequelize['ENUM'](_0xb1c3('0xd'),_0xb1c3('0xe')),'allowNull':![],'defaultValue':_0xb1c3('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xb1c3('0x2')]},'cc':{'type':Sequelize[_0xb1c3('0xf')]},'bcc':{'type':Sequelize[_0xb1c3('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xb1c3('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6f47=['weeks','days','minutes','csv','pdf','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months'];(function(_0x4204f9,_0x2a5528){var _0x1f13ee=function(_0x1c7816){while(--_0x1c7816){_0x4204f9['push'](_0x4204f9['shift']());}};_0x1f13ee(++_0x2a5528);}(_0x6f47,0xc7));var _0x76f4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6f47[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x76f4('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x76f4('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x76f4('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x76f4('0x6')](_0x76f4('0x7'),'quarters',_0x76f4('0x8'),_0x76f4('0x9'),_0x76f4('0xa'),'hours',_0x76f4('0xb')),'allowNull':![],'defaultValue':_0x76f4('0xa')},'output':{'type':Sequelize[_0x76f4('0x6')](_0x76f4('0xc'),_0x76f4('0xd'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x76f4('0x6')](_0x76f4('0xe'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x76f4('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x76f4('0x1')]},'cc':{'type':Sequelize[_0x76f4('0xf')]},'bcc':{'type':Sequelize[_0x76f4('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x76f4('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 2aa7b6f..c830111 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 _0x815e=['catch','show','params','Schedule','intersection','merge','find','create','get','role','user','Scheduler','UserProfileSection','userProfileId','autoAssociation','update','body','run','../../config/schedule','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','keys','query','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows'];(function(_0x26c880,_0x465998){var _0x2e6c09=function(_0x5ab2b8){while(--_0x5ab2b8){_0x26c880['push'](_0x26c880['shift']());}};_0x2e6c09(++_0x465998);}(_0x815e,0xb9));var _0xe815=function(_0x36781b,_0x56e903){_0x36781b=_0x36781b-0x0;var _0x7a1bc6=_0x815e[_0x36781b];return _0x7a1bc6;};'use strict';var pdf=require(_0xe815('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe815('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe815('0x2'));var rp=require(_0xe815('0x3'));var moment=require(_0xe815('0x4'));var BPromise=require(_0xe815('0x5'));var Mustache=require(_0xe815('0x6'));var util=require(_0xe815('0x7'));var path=require(_0xe815('0x8'));var sox=require(_0xe815('0x9'));var csv=require(_0xe815('0xa'));var ejs=require(_0xe815('0xb'));var fs=require('fs');var _=require(_0xe815('0xc'));var squel=require('squel');var crypto=require(_0xe815('0xd'));var jsforce=require(_0xe815('0xe'));var deskjs=require(_0xe815('0xf'));var toCsv=require(_0xe815('0xa'));var querystring=require('querystring');var Papa=require(_0xe815('0x10'));var Redis=require(_0xe815('0x11'));var authService=require(_0xe815('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe815('0x13'));var hardwareService=require(_0xe815('0x14'));var logger=require(_0xe815('0x15'))(_0xe815('0x16'));var utils=require(_0xe815('0x17'));var config=require(_0xe815('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ddf1e,_0x1c6ab2){_0x1c6ab2=_0x1c6ab2||0xcc;return function(_0x55715b){if(_0x55715b){return _0x3ddf1e[_0xe815('0x19')](_0x1c6ab2);}return _0x3ddf1e[_0xe815('0x1a')](_0x1c6ab2)[_0xe815('0x1b')]();};}function respondWithResult(_0xf1ba12,_0x35c364){_0x35c364=_0x35c364||0xc8;return function(_0x22dea5){if(_0x22dea5){return _0xf1ba12[_0xe815('0x1a')](_0x35c364)[_0xe815('0x1c')](_0x22dea5);}};}function respondWithFilteredResult(_0x414f7d,_0x409972){return function(_0x5a2fc0){if(_0x5a2fc0){var _0x3b3026=_0x5a2fc0[_0xe815('0x1d')],_0x397a7b=_0x409972[_0xe815('0x1e')],_0x48a5e1=_0x409972['offset']+_0x409972[_0xe815('0x1f')],_0x423c99;if(_0x48a5e1>=_0x3b3026){_0x48a5e1=_0x3b3026;_0x423c99=0xc8;}else{_0x423c99=0xce;}_0x414f7d[_0xe815('0x1a')](_0x423c99);return _0x414f7d['set'](_0xe815('0x20'),_0x397a7b+'-'+_0x48a5e1+'/'+_0x3b3026)['json'](_0x5a2fc0);}return null;};}function patchUpdates(_0x2e807d){return function(_0x4feb93){try{jsonpatch[_0xe815('0x21')](_0x4feb93,_0x2e807d,!![]);}catch(_0x19966b){return BPromise['reject'](_0x19966b);}return _0x4feb93[_0xe815('0x22')]();};}function saveUpdates(_0x1254fa,_0x56d0e2){return function(_0x4ac04e){if(_0x4ac04e){return _0x4ac04e['update'](_0x1254fa)[_0xe815('0x23')](function(_0x5e1383){return _0x5e1383;});}return null;};}function removeEntity(_0x3040cc,_0x6abf3c){return function(_0x37c4fb){if(_0x37c4fb){return _0x37c4fb[_0xe815('0x24')]()[_0xe815('0x23')](function(){var _0x37ed74=_0x37c4fb['get']({'plain':!![]});var _0x437466='Scheduler';return db[_0xe815('0x25')][_0xe815('0x24')]({'where':{'type':_0x437466,'resourceId':_0x37ed74['id']}})[_0xe815('0x23')](function(){return _0x37c4fb;});})[_0xe815('0x23')](function(){_0x3040cc[_0xe815('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25213a,_0x567533){return function(_0xac4717){if(!_0xac4717){_0x25213a[_0xe815('0x19')](0x194);}return _0xac4717;};}function handleError(_0xa838a4,_0x270fe1){_0x270fe1=_0x270fe1||0x1f4;return function(_0x22d932){logger[_0xe815('0x26')](_0x22d932[_0xe815('0x27')]);if(_0x22d932['name']){delete _0x22d932['name'];}_0xa838a4[_0xe815('0x1a')](_0x270fe1)[_0xe815('0x28')](_0x22d932);};}exports[_0xe815('0x29')]=function(_0x204385,_0x465481){var _0x59a95f={},_0x249f3e={},_0x210d20={'count':0x0,'rows':[]};var _0x51102e=_[_0xe815('0x2a')](db['Schedule'][_0xe815('0x2b')],function(_0x439b6f){return{'name':_0x439b6f[_0xe815('0x2c')],'type':_0x439b6f['type'][_0xe815('0x2d')]};});_0x249f3e[_0xe815('0x2e')]=_[_0xe815('0x2a')](_0x51102e,_0xe815('0x2f'));_0x249f3e['query']=_[_0xe815('0x30')](_0x204385['query']);_0x249f3e['filters']=_['intersection'](_0x249f3e[_0xe815('0x2e')],_0x249f3e[_0xe815('0x31')]);_0x59a95f[_0xe815('0x32')]=_['intersection'](_0x249f3e[_0xe815('0x2e')],qs[_0xe815('0x33')](_0x204385[_0xe815('0x31')][_0xe815('0x33')]));_0x59a95f[_0xe815('0x32')]=_0x59a95f[_0xe815('0x32')][_0xe815('0x34')]?_0x59a95f['attributes']:_0x249f3e[_0xe815('0x2e')];if(!_0x204385[_0xe815('0x31')]['hasOwnProperty'](_0xe815('0x35'))){_0x59a95f[_0xe815('0x1f')]=qs[_0xe815('0x1f')](_0x204385[_0xe815('0x31')][_0xe815('0x1f')]);_0x59a95f[_0xe815('0x1e')]=qs[_0xe815('0x1e')](_0x204385[_0xe815('0x31')][_0xe815('0x1e')]);}_0x59a95f[_0xe815('0x36')]=qs[_0xe815('0x37')](_0x204385[_0xe815('0x31')][_0xe815('0x37')]);_0x59a95f[_0xe815('0x38')]=qs['filters'](_['pick'](_0x204385['query'],_0x249f3e[_0xe815('0x39')]),_0x51102e);if(_0x204385[_0xe815('0x31')][_0xe815('0x3a')]){_0x59a95f[_0xe815('0x38')]=_['merge'](_0x59a95f['where'],{'$or':_[_0xe815('0x2a')](_0x51102e,function(_0x62ef3f){if(_0x62ef3f['type']!==_0xe815('0x3b')){var _0x1c45bc={};_0x1c45bc[_0x62ef3f[_0xe815('0x2f')]]={'$like':'%'+_0x204385['query'][_0xe815('0x3a')]+'%'};return _0x1c45bc;}})});}_0x59a95f=_['merge']({},_0x59a95f,_0x204385[_0xe815('0x3c')]);var _0x223799={'where':_0x59a95f[_0xe815('0x38')]};return db['Schedule']['count'](_0x223799)['then'](function(_0x39beca){_0x210d20[_0xe815('0x1d')]=_0x39beca;if(_0x204385[_0xe815('0x31')][_0xe815('0x3d')]){_0x59a95f[_0xe815('0x3e')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x59a95f);})[_0xe815('0x23')](function(_0x123c21){_0x210d20[_0xe815('0x3f')]=_0x123c21;return _0x210d20;})['then'](respondWithFilteredResult(_0x465481,_0x59a95f))[_0xe815('0x40')](handleError(_0x465481,null));};exports[_0xe815('0x41')]=function(_0x243bb6,_0x3d671a){var _0x4fc708={'raw':![],'where':{'id':_0x243bb6[_0xe815('0x42')]['id']}},_0x3b28b5={};_0x3b28b5['model']=_[_0xe815('0x30')](db[_0xe815('0x43')]['rawAttributes']);_0x3b28b5['query']=_[_0xe815('0x30')](_0x243bb6[_0xe815('0x31')]);_0x3b28b5[_0xe815('0x39')]=_[_0xe815('0x44')](_0x3b28b5['model'],_0x3b28b5[_0xe815('0x31')]);_0x4fc708['attributes']=_[_0xe815('0x44')](_0x3b28b5[_0xe815('0x2e')],qs[_0xe815('0x33')](_0x243bb6[_0xe815('0x31')][_0xe815('0x33')]));_0x4fc708['attributes']=_0x4fc708['attributes']['length']?_0x4fc708[_0xe815('0x32')]:_0x3b28b5[_0xe815('0x2e')];if(_0x243bb6['query'][_0xe815('0x3d')]){_0x4fc708[_0xe815('0x3e')]=[{'all':!![]}];}_0x4fc708=_[_0xe815('0x45')]({},_0x4fc708,_0x243bb6[_0xe815('0x3c')]);return db['Schedule'][_0xe815('0x46')](_0x4fc708)[_0xe815('0x23')](handleEntityNotFound(_0x3d671a,null))[_0xe815('0x23')](respondWithResult(_0x3d671a,null))[_0xe815('0x40')](handleError(_0x3d671a,null));};exports[_0xe815('0x47')]=function(_0x2e13c9,_0x2bf5e0){return db[_0xe815('0x43')][_0xe815('0x47')](_0x2e13c9['body'],{})[_0xe815('0x23')](function(_0x1fe611){var _0x1a9ab2=_0x2e13c9['user'][_0xe815('0x48')]({'plain':!![]});if(!_0x1a9ab2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a9ab2[_0xe815('0x49')]===_0xe815('0x4a')){var _0x54d84f=_0x1fe611[_0xe815('0x48')]({'plain':!![]});var _0x173d6b=_0xe815('0x4b');return db[_0xe815('0x4c')][_0xe815('0x46')]({'where':{'name':_0x173d6b,'userProfileId':_0x1a9ab2[_0xe815('0x4d')]},'raw':!![]})['then'](function(_0x56aad6){if(_0x56aad6&&_0x56aad6[_0xe815('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x54d84f[_0xe815('0x2f')],'resourceId':_0x54d84f['id'],'type':_0x56aad6[_0xe815('0x2f')],'sectionId':_0x56aad6['id']},{})[_0xe815('0x23')](function(){return _0x1fe611;});}else{return _0x1fe611;}})['catch'](function(_0x2f0a23){logger[_0xe815('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f0a23);throw _0x2f0a23;});}return _0x1fe611;})[_0xe815('0x23')](respondWithResult(_0x2bf5e0,0xc9))['catch'](handleError(_0x2bf5e0,null));};exports[_0xe815('0x4f')]=function(_0x5c6d27,_0x54063e){if(_0x5c6d27['body']['id']){delete _0x5c6d27[_0xe815('0x50')]['id'];}return db[_0xe815('0x43')][_0xe815('0x46')]({'where':{'id':_0x5c6d27['params']['id']}})[_0xe815('0x23')](handleEntityNotFound(_0x54063e,null))[_0xe815('0x23')](saveUpdates(_0x5c6d27['body'],null))[_0xe815('0x23')](respondWithResult(_0x54063e,null))[_0xe815('0x40')](handleError(_0x54063e,null));};exports[_0xe815('0x24')]=function(_0x518caf,_0x507161){return db[_0xe815('0x43')]['find']({'where':{'id':_0x518caf[_0xe815('0x42')]['id']}})[_0xe815('0x23')](handleEntityNotFound(_0x507161,null))['then'](removeEntity(_0x507161,null))[_0xe815('0x40')](handleError(_0x507161,null));};exports[_0xe815('0x51')]=function(_0x61b77b,_0x51cfaa,_0x1b0c0a){var _0x429971=require(_0xe815('0x52'));return db[_0xe815('0x43')][_0xe815('0x46')]({'where':{'id':_0x61b77b[_0xe815('0x42')]['id']},'raw':!![]})[_0xe815('0x23')](handleEntityNotFound(_0x51cfaa,null))[_0xe815('0x23')](function(){_0x429971[_0xe815('0x51')](_0x61b77b['params']['id']);})[_0xe815('0x23')](respondWithStatusCode(_0x51cfaa,null))[_0xe815('0x40')](handleError(_0x51cfaa,null));}; \ No newline at end of file +var _0xd240=['pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','name','index','map','Schedule','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where'];(function(_0x14915a,_0x222f6b){var _0x2f683c=function(_0x28e694){while(--_0x28e694){_0x14915a['push'](_0x14915a['shift']());}};_0x2f683c(++_0x222f6b);}(_0xd240,0x168));var _0x0d24=function(_0x3939d3,_0x2c7e96){_0x3939d3=_0x3939d3-0x0;var _0x2ab170=_0xd240[_0x3939d3];return _0x2ab170;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d24('0x0'));var rimraf=require(_0x0d24('0x1'));var zipdir=require(_0x0d24('0x2'));var jsonpatch=require(_0x0d24('0x3'));var rp=require(_0x0d24('0x4'));var moment=require(_0x0d24('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d24('0x6'));var path=require(_0x0d24('0x7'));var sox=require('sox');var csv=require(_0x0d24('0x8'));var ejs=require(_0x0d24('0x9'));var fs=require('fs');var _=require(_0x0d24('0xa'));var squel=require('squel');var crypto=require(_0x0d24('0xb'));var jsforce=require(_0x0d24('0xc'));var deskjs=require(_0x0d24('0xd'));var toCsv=require(_0x0d24('0x8'));var querystring=require(_0x0d24('0xe'));var Papa=require(_0x0d24('0xf'));var Redis=require(_0x0d24('0x10'));var authService=require(_0x0d24('0x11'));var qs=require(_0x0d24('0x12'));var as=require(_0x0d24('0x13'));var hardwareService=require(_0x0d24('0x14'));var logger=require(_0x0d24('0x15'))('api');var utils=require(_0x0d24('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21fd45,_0x32c06c){_0x32c06c=_0x32c06c||0xcc;return function(_0x5581b7){if(_0x5581b7){return _0x21fd45['sendStatus'](_0x32c06c);}return _0x21fd45['status'](_0x32c06c)[_0x0d24('0x17')]();};}function respondWithResult(_0x59820c,_0x4d8a34){_0x4d8a34=_0x4d8a34||0xc8;return function(_0x4c1fdd){if(_0x4c1fdd){return _0x59820c['status'](_0x4d8a34)[_0x0d24('0x18')](_0x4c1fdd);}};}function respondWithFilteredResult(_0x51b29a,_0x133eeb){return function(_0x5daeb7){if(_0x5daeb7){var _0x1ce948=_0x5daeb7[_0x0d24('0x19')],_0x19d6a2=_0x133eeb['offset'],_0x13f2a3=_0x133eeb[_0x0d24('0x1a')]+_0x133eeb['limit'],_0x4cbb5f;if(_0x13f2a3>=_0x1ce948){_0x13f2a3=_0x1ce948;_0x4cbb5f=0xc8;}else{_0x4cbb5f=0xce;}_0x51b29a[_0x0d24('0x1b')](_0x4cbb5f);return _0x51b29a[_0x0d24('0x1c')](_0x0d24('0x1d'),_0x19d6a2+'-'+_0x13f2a3+'/'+_0x1ce948)[_0x0d24('0x18')](_0x5daeb7);}return null;};}function patchUpdates(_0x5793d2){return function(_0x491456){try{jsonpatch[_0x0d24('0x1e')](_0x491456,_0x5793d2,!![]);}catch(_0x68b241){return BPromise[_0x0d24('0x1f')](_0x68b241);}return _0x491456[_0x0d24('0x20')]();};}function saveUpdates(_0x47600c,_0x2f3294){return function(_0x375475){if(_0x375475){return _0x375475[_0x0d24('0x21')](_0x47600c)[_0x0d24('0x22')](function(_0xc8effd){return _0xc8effd;});}return null;};}function removeEntity(_0x1fda41,_0x5aa014){return function(_0xab6ce){if(_0xab6ce){return _0xab6ce[_0x0d24('0x23')]()[_0x0d24('0x22')](function(){var _0x1d30f5=_0xab6ce[_0x0d24('0x24')]({'plain':!![]});var _0x29447e=_0x0d24('0x25');return db[_0x0d24('0x26')]['destroy']({'where':{'type':_0x29447e,'resourceId':_0x1d30f5['id']}})[_0x0d24('0x22')](function(){return _0xab6ce;});})[_0x0d24('0x22')](function(){_0x1fda41['status'](0xcc)[_0x0d24('0x17')]();});}};}function handleEntityNotFound(_0x5da905,_0x2b0943){return function(_0x342b29){if(!_0x342b29){_0x5da905[_0x0d24('0x27')](0x194);}return _0x342b29;};}function handleError(_0x17d90a,_0x387e17){_0x387e17=_0x387e17||0x1f4;return function(_0x1c44d2){logger['error'](_0x1c44d2['stack']);if(_0x1c44d2['name']){delete _0x1c44d2[_0x0d24('0x28')];}_0x17d90a[_0x0d24('0x1b')](_0x387e17)['send'](_0x1c44d2);};}exports[_0x0d24('0x29')]=function(_0xe97728,_0x26b4b5){var _0x338d78={},_0x53490b={},_0x2b5f32={'count':0x0,'rows':[]};var _0x4430a4=_[_0x0d24('0x2a')](db[_0x0d24('0x2b')][_0x0d24('0x2c')],function(_0x3e8fbb){return{'name':_0x3e8fbb[_0x0d24('0x2d')],'type':_0x3e8fbb[_0x0d24('0x2e')][_0x0d24('0x2f')]};});_0x53490b['model']=_[_0x0d24('0x2a')](_0x4430a4,_0x0d24('0x28'));_0x53490b['query']=_['keys'](_0xe97728[_0x0d24('0x30')]);_0x53490b[_0x0d24('0x31')]=_[_0x0d24('0x32')](_0x53490b['model'],_0x53490b[_0x0d24('0x30')]);_0x338d78[_0x0d24('0x33')]=_['intersection'](_0x53490b[_0x0d24('0x34')],qs[_0x0d24('0x35')](_0xe97728[_0x0d24('0x30')][_0x0d24('0x35')]));_0x338d78[_0x0d24('0x33')]=_0x338d78['attributes'][_0x0d24('0x36')]?_0x338d78[_0x0d24('0x33')]:_0x53490b[_0x0d24('0x34')];if(!_0xe97728[_0x0d24('0x30')]['hasOwnProperty'](_0x0d24('0x37'))){_0x338d78['limit']=qs['limit'](_0xe97728[_0x0d24('0x30')][_0x0d24('0x38')]);_0x338d78['offset']=qs['offset'](_0xe97728[_0x0d24('0x30')][_0x0d24('0x1a')]);}_0x338d78[_0x0d24('0x39')]=qs['sort'](_0xe97728[_0x0d24('0x30')][_0x0d24('0x3a')]);_0x338d78[_0x0d24('0x3b')]=qs[_0x0d24('0x31')](_[_0x0d24('0x3c')](_0xe97728[_0x0d24('0x30')],_0x53490b[_0x0d24('0x31')]),_0x4430a4);if(_0xe97728['query'][_0x0d24('0x3d')]){_0x338d78['where']=_['merge'](_0x338d78[_0x0d24('0x3b')],{'$or':_[_0x0d24('0x2a')](_0x4430a4,function(_0x4d7cb9){if(_0x4d7cb9[_0x0d24('0x2e')]!==_0x0d24('0x3e')){var _0x501d9b={};_0x501d9b[_0x4d7cb9[_0x0d24('0x28')]]={'$like':'%'+_0xe97728['query'][_0x0d24('0x3d')]+'%'};return _0x501d9b;}})});}_0x338d78=_[_0x0d24('0x3f')]({},_0x338d78,_0xe97728['options']);var _0x3112ba={'where':_0x338d78[_0x0d24('0x3b')]};return db[_0x0d24('0x2b')][_0x0d24('0x19')](_0x3112ba)[_0x0d24('0x22')](function(_0x5ac0fe){_0x2b5f32[_0x0d24('0x19')]=_0x5ac0fe;if(_0xe97728['query'][_0x0d24('0x40')]){_0x338d78[_0x0d24('0x41')]=[{'all':!![]}];}return db[_0x0d24('0x2b')][_0x0d24('0x42')](_0x338d78);})[_0x0d24('0x22')](function(_0xd5f409){_0x2b5f32['rows']=_0xd5f409;return _0x2b5f32;})[_0x0d24('0x22')](respondWithFilteredResult(_0x26b4b5,_0x338d78))[_0x0d24('0x43')](handleError(_0x26b4b5,null));};exports[_0x0d24('0x44')]=function(_0x2053f9,_0x34e98e){var _0xf61d3a={'raw':![],'where':{'id':_0x2053f9[_0x0d24('0x45')]['id']}},_0x38a6a3={};_0x38a6a3[_0x0d24('0x34')]=_[_0x0d24('0x46')](db['Schedule'][_0x0d24('0x2c')]);_0x38a6a3[_0x0d24('0x30')]=_['keys'](_0x2053f9[_0x0d24('0x30')]);_0x38a6a3[_0x0d24('0x31')]=_[_0x0d24('0x32')](_0x38a6a3[_0x0d24('0x34')],_0x38a6a3[_0x0d24('0x30')]);_0xf61d3a[_0x0d24('0x33')]=_['intersection'](_0x38a6a3[_0x0d24('0x34')],qs[_0x0d24('0x35')](_0x2053f9[_0x0d24('0x30')][_0x0d24('0x35')]));_0xf61d3a[_0x0d24('0x33')]=_0xf61d3a[_0x0d24('0x33')][_0x0d24('0x36')]?_0xf61d3a[_0x0d24('0x33')]:_0x38a6a3['model'];if(_0x2053f9[_0x0d24('0x30')][_0x0d24('0x40')]){_0xf61d3a['include']=[{'all':!![]}];}_0xf61d3a=_[_0x0d24('0x3f')]({},_0xf61d3a,_0x2053f9[_0x0d24('0x47')]);return db[_0x0d24('0x2b')][_0x0d24('0x48')](_0xf61d3a)[_0x0d24('0x22')](handleEntityNotFound(_0x34e98e,null))['then'](respondWithResult(_0x34e98e,null))[_0x0d24('0x43')](handleError(_0x34e98e,null));};exports[_0x0d24('0x49')]=function(_0x3264e3,_0x5b9215){return db[_0x0d24('0x2b')][_0x0d24('0x49')](_0x3264e3[_0x0d24('0x4a')],{})[_0x0d24('0x22')](function(_0x2dadd1){var _0x352037=_0x3264e3[_0x0d24('0x4b')][_0x0d24('0x24')]({'plain':!![]});if(!_0x352037)throw new Error(_0x0d24('0x4c'));if(_0x352037['role']===_0x0d24('0x4b')){var _0xc4048=_0x2dadd1[_0x0d24('0x24')]({'plain':!![]});var _0x5c6ae9=_0x0d24('0x25');return db[_0x0d24('0x4d')][_0x0d24('0x48')]({'where':{'name':_0x5c6ae9,'userProfileId':_0x352037[_0x0d24('0x4e')]},'raw':!![]})[_0x0d24('0x22')](function(_0x55f8de){if(_0x55f8de&&_0x55f8de[_0x0d24('0x4f')]===0x0){return db[_0x0d24('0x26')][_0x0d24('0x49')]({'name':_0xc4048['name'],'resourceId':_0xc4048['id'],'type':_0x55f8de[_0x0d24('0x28')],'sectionId':_0x55f8de['id']},{})[_0x0d24('0x22')](function(){return _0x2dadd1;});}else{return _0x2dadd1;}})[_0x0d24('0x43')](function(_0x5d5609){logger[_0x0d24('0x50')](_0x0d24('0x51'),_0x5d5609);throw _0x5d5609;});}return _0x2dadd1;})[_0x0d24('0x22')](respondWithResult(_0x5b9215,0xc9))[_0x0d24('0x43')](handleError(_0x5b9215,null));};exports[_0x0d24('0x21')]=function(_0xe16258,_0x2adb6a){if(_0xe16258[_0x0d24('0x4a')]['id']){delete _0xe16258[_0x0d24('0x4a')]['id'];}return db[_0x0d24('0x2b')]['find']({'where':{'id':_0xe16258[_0x0d24('0x45')]['id']}})[_0x0d24('0x22')](handleEntityNotFound(_0x2adb6a,null))[_0x0d24('0x22')](saveUpdates(_0xe16258['body'],null))['then'](respondWithResult(_0x2adb6a,null))[_0x0d24('0x43')](handleError(_0x2adb6a,null));};exports[_0x0d24('0x23')]=function(_0x35637,_0x184bc3){return db[_0x0d24('0x2b')][_0x0d24('0x48')]({'where':{'id':_0x35637[_0x0d24('0x45')]['id']}})[_0x0d24('0x22')](handleEntityNotFound(_0x184bc3,null))[_0x0d24('0x22')](removeEntity(_0x184bc3,null))['catch'](handleError(_0x184bc3,null));};exports[_0x0d24('0x52')]=function(_0x2a4ee0,_0x595df8,_0x252b8b){var _0x1f0840=require(_0x0d24('0x53'));return db[_0x0d24('0x2b')]['find']({'where':{'id':_0x2a4ee0[_0x0d24('0x45')]['id']},'raw':!![]})[_0x0d24('0x22')](handleEntityNotFound(_0x595df8,null))['then'](function(){_0x1f0840[_0x0d24('0x52')](_0x2a4ee0['params']['id']);})[_0x0d24('0x22')](respondWithStatusCode(_0x595df8,null))[_0x0d24('0x43')](handleError(_0x595df8,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 73f30fa..89f6c24 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 _0x0956=['lodash','util','moment','rimraf','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0956,0x130));var _0x6095=function(_0x2922b3,_0x41ed49){_0x2922b3=_0x2922b3-0x0;var _0x3c17ad=_0x0956[_0x2922b3];return _0x3c17ad;};'use strict';var _=require(_0x6095('0x0'));var util=require(_0x6095('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6095('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6095('0x3'));var config=require('../../config/environment');var attributes=require(_0x6095('0x4'));module['exports']=function(_0x2cfbaa,_0x4be339){return _0x2cfbaa[_0x6095('0x5')](_0x6095('0x6'),attributes,{'tableName':_0x6095('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dfe=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash'];(function(_0x3c609d,_0x2edac5){var _0x42702d=function(_0x42f481){while(--_0x42f481){_0x3c609d['push'](_0x3c609d['shift']());}};_0x42702d(++_0x2edac5);}(_0x3dfe,0xcf));var _0xe3df=function(_0x13f900,_0x257137){_0x13f900=_0x13f900-0x0;var _0x3d2786=_0x3dfe[_0x13f900];return _0x3d2786;};'use strict';var _=require(_0xe3df('0x0'));var util=require(_0xe3df('0x1'));var logger=require(_0xe3df('0x2'))(_0xe3df('0x3'));var moment=require(_0xe3df('0x4'));var BPromise=require(_0xe3df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3df('0x6'));var rimraf=require('rimraf');var config=require(_0xe3df('0x7'));var attributes=require(_0xe3df('0x8'));module[_0xe3df('0x9')]=function(_0x57783d,_0x29b53a){return _0x57783d[_0xe3df('0xa')](_0xe3df('0xb'),attributes,{'tableName':_0xe3df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index cde1029..d32d24e 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 _0x1652=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x1652,0x102));var _0x2165=function(_0x1b01f6,_0x57d583){_0x1b01f6=_0x1b01f6-0x0;var _0x1f67af=_0x1652[_0x1b01f6];return _0x1f67af;};'use strict';var _=require(_0x2165('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2165('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x2165('0x2'));var logger=require(_0x2165('0x3'))('rpc');var config=require(_0x2165('0x4'));var jayson=require(_0x2165('0x5'));var client=jayson[_0x2165('0x6')][_0x2165('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43b74d,_0x1bc137,_0x3d64f7){return new BPromise(function(_0x1e50b0,_0xeae905){return client[_0x2165('0x8')](_0x43b74d,_0x3d64f7)[_0x2165('0x9')](function(_0x10d70b){logger[_0x2165('0xa')](_0x2165('0xb'),_0x1bc137,_0x2165('0xc'));logger[_0x2165('0xd')](_0x2165('0xe'),_0x1bc137,_0x2165('0xc'),JSON[_0x2165('0xf')](_0x10d70b));if(_0x10d70b[_0x2165('0x10')]){if(_0x10d70b['error']['code']===0x1f4){logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x10d70b['error'][_0x2165('0x11')]);return _0xeae905(_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);}logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);return _0x1e50b0(_0x10d70b[_0x2165('0x10')][_0x2165('0x11')]);}else{logger[_0x2165('0xa')](_0x2165('0xb'),_0x1bc137,_0x2165('0xc'));_0x1e50b0(_0x10d70b['result'][_0x2165('0x11')]);}})[_0x2165('0x12')](function(_0x4e38e0){logger[_0x2165('0x10')](_0x2165('0xb'),_0x1bc137,_0x4e38e0);_0xeae905(_0x4e38e0);});});} \ No newline at end of file +var _0x4172=['../../config/logger','rpc','client','request','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','util','bluebird','randomstring','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4172,0x1bc));var _0x2417=function(_0x5b32c5,_0x160e25){_0x5b32c5=_0x5b32c5-0x0;var _0x30e8e4=_0x4172[_0x5b32c5];return _0x30e8e4;};'use strict';var _=require('lodash');var util=require(_0x2417('0x0'));var moment=require('moment');var BPromise=require(_0x2417('0x1'));var rs=require(_0x2417('0x2'));var fs=require('fs');var Redis=require(_0x2417('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2417('0x4'))(_0x2417('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2417('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ccc3f,_0x12f82f,_0x448635){return new BPromise(function(_0x3cc2ef,_0x3845b0){return client[_0x2417('0x7')](_0x3ccc3f,_0x448635)['then'](function(_0x36327f){logger['info'](_0x2417('0x8'),_0x12f82f,'request\x20sent');logger[_0x2417('0x9')](_0x2417('0xa'),_0x12f82f,'request\x20sent',JSON['stringify'](_0x36327f));if(_0x36327f['error']){if(_0x36327f['error']['code']===0x1f4){logger[_0x2417('0xb')](_0x2417('0x8'),_0x12f82f,_0x36327f[_0x2417('0xb')]['message']);return _0x3845b0(_0x36327f[_0x2417('0xb')][_0x2417('0xc')]);}logger[_0x2417('0xb')](_0x2417('0x8'),_0x12f82f,_0x36327f[_0x2417('0xb')][_0x2417('0xc')]);return _0x3cc2ef(_0x36327f[_0x2417('0xb')][_0x2417('0xc')]);}else{logger[_0x2417('0xd')]('Schedule,\x20%s,\x20%s',_0x12f82f,_0x2417('0xe'));_0x3cc2ef(_0x36327f[_0x2417('0xf')][_0x2417('0xc')]);}})['catch'](function(_0x136cdf){logger['error']('Schedule,\x20%s,\x20%s',_0x12f82f,_0x136cdf);_0x3845b0(_0x136cdf);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c8adba2..3dee0ab 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 _0xc0b3=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','download','put'];(function(_0x5b98d6,_0x4e8ebf){var _0x36f2de=function(_0x36a342){while(--_0x36a342){_0x5b98d6['push'](_0x5b98d6['shift']());}};_0x36f2de(++_0x4e8ebf);}(_0xc0b3,0x17f));var _0x3c0b=function(_0x416ba8,_0x4f8b0e){_0x416ba8=_0x416ba8-0x0;var _0x30a759=_0xc0b3[_0x416ba8];return _0x30a759;};'use strict';var multer=require(_0x3c0b('0x0'));var util=require(_0x3c0b('0x1'));var path=require(_0x3c0b('0x2'));var timeout=require(_0x3c0b('0x3'));var express=require(_0x3c0b('0x4'));var router=express['Router']();var auth=require(_0x3c0b('0x5'));var interaction=require(_0x3c0b('0x6'));var config=require(_0x3c0b('0x7'));var controller=require(_0x3c0b('0x8'));router[_0x3c0b('0x9')]('/',auth[_0x3c0b('0xa')](),controller[_0x3c0b('0xb')]);router['get'](_0x3c0b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x3c0b('0x9')](_0x3c0b('0xd'),auth[_0x3c0b('0xa')](),controller['show']);router[_0x3c0b('0x9')]('/:id/download',auth[_0x3c0b('0xa')](),controller[_0x3c0b('0xe')]);router['post']('/',auth[_0x3c0b('0xa')](),controller['create']);router[_0x3c0b('0xf')]('/:id',auth[_0x3c0b('0xa')](),controller['update']);router[_0x3c0b('0x10')](_0x3c0b('0xd'),auth[_0x3c0b('0xa')](),controller[_0x3c0b('0x11')]);module[_0x3c0b('0x12')]=router; \ No newline at end of file +var _0x46fb=['isAuthenticated','index','/describe','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x2fc338,_0x43d279){var _0x316084=function(_0xe43e14){while(--_0xe43e14){_0x2fc338['push'](_0x2fc338['shift']());}};_0x316084(++_0x43d279);}(_0x46fb,0x13c));var _0xb46f=function(_0x4c4829,_0x397dc2){_0x4c4829=_0x4c4829-0x0;var _0x4cd664=_0x46fb[_0x4c4829];return _0x4cd664;};'use strict';var multer=require(_0xb46f('0x0'));var util=require('util');var path=require(_0xb46f('0x1'));var timeout=require(_0xb46f('0x2'));var express=require(_0xb46f('0x3'));var router=express[_0xb46f('0x4')]();var auth=require(_0xb46f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb46f('0x6'));var controller=require('./screenRecording.controller');router[_0xb46f('0x7')]('/',auth[_0xb46f('0x8')](),controller[_0xb46f('0x9')]);router[_0xb46f('0x7')](_0xb46f('0xa'),auth[_0xb46f('0x8')](),controller['describe']);router['get']('/:id',auth[_0xb46f('0x8')](),controller['show']);router[_0xb46f('0x7')]('/:id/download',auth[_0xb46f('0x8')](),controller['download']);router[_0xb46f('0xb')]('/',auth['isAuthenticated'](),controller[_0xb46f('0xc')]);router[_0xb46f('0xd')](_0xb46f('0xe'),auth[_0xb46f('0x8')](),controller[_0xb46f('0xf')]);router['delete'](_0xb46f('0xe'),auth['isAuthenticated'](),controller[_0xb46f('0x10')]);module[_0xb46f('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8209408..2fdaaa6 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 _0x84ab=['MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','closedAt'];(function(_0x44d54c,_0x21c7ff){var _0x287de2=function(_0x531f21){while(--_0x531f21){_0x44d54c['push'](_0x44d54c['shift']());}};_0x287de2(++_0x21c7ff);}(_0x84ab,0x12f));var _0xb84a=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x84ab[_0x1265ed];return _0x5ac459;};'use strict';var Sequelize=require(_0xb84a('0x0'));var moment=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var config=require(_0xb84a('0x3'));module[_0xb84a('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb84a('0x5')](_0xb84a('0x6'))?path['extname'](this[_0xb84a('0x5')](_0xb84a('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb84a('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x4dc496){var _0xd445b5=_0x4dc496['replace'](/\\/g,'/');this[_0xb84a('0x8')](_0xb84a('0x6'),_0xd445b5);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb84a('0x9')],'set':function(_0x525cb7){this[_0xb84a('0x8')](_0xb84a('0xa'),moment()[_0xb84a('0xb')](_0x525cb7,'ms'));this['setDataValue']('closedAt',moment());this['setDataValue'](_0xb84a('0xc'),_0x525cb7);}},'startedAt':{'type':Sequelize[_0xb84a('0xd')],'get':function(){return moment(this[_0xb84a('0x5')](_0xb84a('0xa')))[_0xb84a('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xb84a('0xf')]();}},'closedAt':{'type':Sequelize[_0xb84a('0xd')],'get':function(){return moment(this[_0xb84a('0x5')](_0xb84a('0x10')))[_0xb84a('0xe')](_0xb84a('0x11'))[_0xb84a('0xf')]();}},'createdAt':{'type':Sequelize[_0xb84a('0xd')],'get':function(){return moment(this[_0xb84a('0x5')](_0xb84a('0x12')))[_0xb84a('0xe')](_0xb84a('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xb84a('0xd')],'get':function(){return moment(this[_0xb84a('0x5')](_0xb84a('0x13')))[_0xb84a('0xe')](_0xb84a('0x11'))[_0xb84a('0xf')]();}}}; \ No newline at end of file +var _0x4bc3=['setDataValue','INTEGER','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','../../config/environment','exports','getDataValue','value','extname','STRING'];(function(_0x28c343,_0x19e9e5){var _0x481e0d=function(_0xa0344c){while(--_0xa0344c){_0x28c343['push'](_0x28c343['shift']());}};_0x481e0d(++_0x19e9e5);}(_0x4bc3,0x16e));var _0x34bc=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x4bc3[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x34bc('0x0'));var moment=require(_0x34bc('0x1'));var path=require('path');var config=require(_0x34bc('0x2'));module[_0x34bc('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x34bc('0x4')](_0x34bc('0x5'))?path[_0x34bc('0x6')](this[_0x34bc('0x4')](_0x34bc('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x34bc('0x7')]},'channel':{'type':Sequelize[_0x34bc('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x21451b){var _0x50320d=_0x21451b['replace'](/\\/g,'/');this[_0x34bc('0x8')](_0x34bc('0x5'),_0x50320d);}},'rating':{'type':Sequelize[_0x34bc('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x34bc('0x9')],'set':function(_0x409105){this[_0x34bc('0x8')]('startedAt',moment()['subtract'](_0x409105,'ms'));this[_0x34bc('0x8')](_0x34bc('0xa'),moment());this[_0x34bc('0x8')]('duration',_0x409105);}},'startedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xc')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xa')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x34bc('0x4')]('createdAt'))[_0x34bc('0xd')](_0x34bc('0xe'))[_0x34bc('0xf')]();}},'updatedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this[_0x34bc('0x4')](_0x34bc('0x10')))['format']('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 fd4f99d..7fc3bd9 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 _0xddf6=['keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','duration','createdAt','params','describe','download','../../components/encryptor','type','uniqueid','root','server/files/screen_recordings','value','format','existsSync','decryptFile','secrets','recording','join','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','query'];(function(_0xce26e0,_0x1f96ca){var _0x3fd222=function(_0x30e954){while(--_0x30e954){_0xce26e0['push'](_0xce26e0['shift']());}};_0x3fd222(++_0x1f96ca);}(_0xddf6,0xf7));var _0x6ddf=function(_0x29934d,_0xcdc14){_0x29934d=_0x29934d-0x0;var _0x184539=_0xddf6[_0x29934d];return _0x184539;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6ddf('0x0'));var rimraf=require(_0x6ddf('0x1'));var zipdir=require(_0x6ddf('0x2'));var jsonpatch=require(_0x6ddf('0x3'));var rp=require(_0x6ddf('0x4'));var moment=require(_0x6ddf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6ddf('0x6'));var sox=require('sox');var csv=require(_0x6ddf('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6ddf('0x8'));var squel=require(_0x6ddf('0x9'));var crypto=require('crypto');var jsforce=require(_0x6ddf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6ddf('0xb'));var Redis=require(_0x6ddf('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6ddf('0xd'));var as=require(_0x6ddf('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6ddf('0xf'));var utils=require(_0x6ddf('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x308472,_0x53cca5){_0x53cca5=_0x53cca5||0xcc;return function(_0x2a272e){if(_0x2a272e){return _0x308472[_0x6ddf('0x11')](_0x53cca5);}return _0x308472[_0x6ddf('0x12')](_0x53cca5)[_0x6ddf('0x13')]();};}function respondWithResult(_0x19d697,_0x4085a3){_0x4085a3=_0x4085a3||0xc8;return function(_0x877eca){if(_0x877eca){return _0x19d697[_0x6ddf('0x12')](_0x4085a3)['json'](_0x877eca);}};}function respondWithFilteredResult(_0x4e0d51,_0x257aab){return function(_0x3652e8){if(_0x3652e8){var _0x55d97c=_0x3652e8[_0x6ddf('0x14')],_0x5bad01=_0x257aab[_0x6ddf('0x15')],_0x475cbb=_0x257aab['offset']+_0x257aab[_0x6ddf('0x16')],_0x4bbe9b;if(_0x475cbb>=_0x55d97c){_0x475cbb=_0x55d97c;_0x4bbe9b=0xc8;}else{_0x4bbe9b=0xce;}_0x4e0d51[_0x6ddf('0x12')](_0x4bbe9b);return _0x4e0d51[_0x6ddf('0x17')](_0x6ddf('0x18'),_0x5bad01+'-'+_0x475cbb+'/'+_0x55d97c)[_0x6ddf('0x19')](_0x3652e8);}return null;};}function patchUpdates(_0x356383){return function(_0x19031f){try{jsonpatch[_0x6ddf('0x1a')](_0x19031f,_0x356383,!![]);}catch(_0x2b0b82){return BPromise[_0x6ddf('0x1b')](_0x2b0b82);}return _0x19031f['save']();};}function saveUpdates(_0x3f8c9a,_0x190fb9){return function(_0x3570f3){if(_0x3570f3){return _0x3570f3['update'](_0x3f8c9a)['then'](function(_0x45b844){return _0x45b844;});}return null;};}function removeEntity(_0x920ba4,_0x3717d7){return function(_0x3ebb9c){if(_0x3ebb9c){return _0x3ebb9c[_0x6ddf('0x1c')]()[_0x6ddf('0x1d')](function(){_0x920ba4[_0x6ddf('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x478bd9,_0x4897ba){return function(_0x12ffaa){if(!_0x12ffaa){_0x478bd9[_0x6ddf('0x11')](0x194);}return _0x12ffaa;};}function handleError(_0xd60db6,_0x412c4b){_0x412c4b=_0x412c4b||0x1f4;return function(_0x4bd7f8){logger[_0x6ddf('0x1e')](_0x4bd7f8['stack']);if(_0x4bd7f8[_0x6ddf('0x1f')]){delete _0x4bd7f8[_0x6ddf('0x1f')];}_0xd60db6[_0x6ddf('0x12')](_0x412c4b)['send'](_0x4bd7f8);};}exports[_0x6ddf('0x20')]=function(_0x530652,_0x3c2de9){var _0x48146a={},_0x3064b7={},_0x41a54f={'count':0x0,'rows':[]};var _0x1fc093=_[_0x6ddf('0x21')](db[_0x6ddf('0x22')][_0x6ddf('0x23')],function(_0x5a238b){return{'name':_0x5a238b[_0x6ddf('0x24')],'type':_0x5a238b['type'][_0x6ddf('0x25')]};});_0x3064b7[_0x6ddf('0x26')]=_[_0x6ddf('0x27')](_[_0x6ddf('0x21')](_0x1fc093,_0x6ddf('0x1f')),['format']);_0x3064b7[_0x6ddf('0x28')]=_[_0x6ddf('0x29')](_0x530652[_0x6ddf('0x28')]);_0x3064b7[_0x6ddf('0x2a')]=_[_0x6ddf('0x2b')](_0x3064b7[_0x6ddf('0x26')],_0x3064b7[_0x6ddf('0x28')]);_0x48146a[_0x6ddf('0x2c')]=_[_0x6ddf('0x2b')](_0x3064b7['model'],qs['fields'](_0x530652['query'][_0x6ddf('0x2d')]));_0x48146a[_0x6ddf('0x2c')]=_0x48146a[_0x6ddf('0x2c')][_0x6ddf('0x2e')]?_0x48146a['attributes']:_0x3064b7['model'];if(!_0x530652[_0x6ddf('0x28')]['hasOwnProperty'](_0x6ddf('0x2f'))){_0x48146a[_0x6ddf('0x16')]=qs[_0x6ddf('0x16')](_0x530652[_0x6ddf('0x28')]['limit']);_0x48146a[_0x6ddf('0x15')]=qs[_0x6ddf('0x15')](_0x530652['query'][_0x6ddf('0x15')]);}_0x48146a['order']=qs['sort'](_0x530652[_0x6ddf('0x28')][_0x6ddf('0x30')]);_0x48146a[_0x6ddf('0x31')]=qs[_0x6ddf('0x2a')](_[_0x6ddf('0x32')](_0x530652[_0x6ddf('0x28')],_0x3064b7[_0x6ddf('0x2a')]),_0x1fc093);if(_0x530652[_0x6ddf('0x28')][_0x6ddf('0x33')]){_0x48146a[_0x6ddf('0x31')]=_[_0x6ddf('0x34')](_0x48146a[_0x6ddf('0x31')],{'$or':_[_0x6ddf('0x21')](_0x1fc093,function(_0x4c618c){if(_0x4c618c['type']!=='VIRTUAL'){var _0x3ee674={};_0x3ee674[_0x4c618c['name']]={'$like':'%'+_0x530652[_0x6ddf('0x28')][_0x6ddf('0x33')]+'%'};return _0x3ee674;}})});}_0x48146a=_[_0x6ddf('0x34')]({},_0x48146a,_0x530652['options']);var _0x2153af={'where':_0x48146a[_0x6ddf('0x31')]};return db['ScreenRecording'][_0x6ddf('0x14')](_0x2153af)[_0x6ddf('0x1d')](function(_0x3a8065){_0x41a54f[_0x6ddf('0x14')]=_0x3a8065;if(_0x530652[_0x6ddf('0x28')][_0x6ddf('0x35')]){_0x48146a[_0x6ddf('0x36')]=[{'all':!![]}];}return db[_0x6ddf('0x22')][_0x6ddf('0x37')](_0x48146a);})['then'](function(_0x46d8e2){_0x41a54f[_0x6ddf('0x38')]=_0x46d8e2;return _0x41a54f;})[_0x6ddf('0x1d')](respondWithFilteredResult(_0x3c2de9,_0x48146a))[_0x6ddf('0x39')](handleError(_0x3c2de9,null));};exports[_0x6ddf('0x3a')]=function(_0x52c14c,_0x42b549){var _0x1aee6c={'raw':![],'where':{'id':_0x52c14c['params']['id']}},_0x212fa9={};_0x212fa9[_0x6ddf('0x26')]=_[_0x6ddf('0x29')](db[_0x6ddf('0x22')][_0x6ddf('0x23')]);_0x212fa9[_0x6ddf('0x28')]=_[_0x6ddf('0x29')](_0x52c14c[_0x6ddf('0x28')]);_0x212fa9['filters']=_[_0x6ddf('0x2b')](_0x212fa9[_0x6ddf('0x26')],_0x212fa9[_0x6ddf('0x28')]);_0x1aee6c['attributes']=_[_0x6ddf('0x2b')](_0x212fa9[_0x6ddf('0x26')],qs[_0x6ddf('0x2d')](_0x52c14c[_0x6ddf('0x28')]['fields']));_0x1aee6c['attributes']=_0x1aee6c[_0x6ddf('0x2c')][_0x6ddf('0x2e')]?_0x1aee6c[_0x6ddf('0x2c')]:_0x212fa9[_0x6ddf('0x26')];if(_0x52c14c[_0x6ddf('0x28')][_0x6ddf('0x35')]){_0x1aee6c[_0x6ddf('0x36')]=[{'all':!![]}];}_0x1aee6c=_[_0x6ddf('0x34')]({},_0x1aee6c,_0x52c14c[_0x6ddf('0x3b')]);return db[_0x6ddf('0x22')][_0x6ddf('0x3c')](_0x1aee6c)[_0x6ddf('0x1d')](handleEntityNotFound(_0x42b549,null))[_0x6ddf('0x1d')](respondWithResult(_0x42b549,null))['catch'](handleError(_0x42b549,null));};exports[_0x6ddf('0x3d')]=function(_0x18ef05,_0x1aaeb9){return db[_0x6ddf('0x22')][_0x6ddf('0x3d')](_0x18ef05[_0x6ddf('0x3e')],{})[_0x6ddf('0x1d')](respondWithResult(_0x1aaeb9,0xc9))[_0x6ddf('0x39')](handleError(_0x1aaeb9,null));};exports[_0x6ddf('0x3f')]=function(_0x588185,_0x462846){if(_0x588185['body']['id']){delete _0x588185[_0x6ddf('0x3e')]['id'];}delete _0x588185[_0x6ddf('0x3e')][_0x6ddf('0x40')];delete _0x588185[_0x6ddf('0x3e')][_0x6ddf('0x41')];delete _0x588185[_0x6ddf('0x3e')]['closedAt'];delete _0x588185[_0x6ddf('0x3e')]['value'];return db[_0x6ddf('0x22')]['find']({'where':{'id':_0x588185[_0x6ddf('0x42')]['id']}})['then'](handleEntityNotFound(_0x462846,null))[_0x6ddf('0x1d')](saveUpdates(_0x588185[_0x6ddf('0x3e')],null))[_0x6ddf('0x1d')](respondWithResult(_0x462846,null))[_0x6ddf('0x39')](handleError(_0x462846,null));};exports[_0x6ddf('0x43')]=function(_0x298f36,_0x3f34ef){return db['ScreenRecording'][_0x6ddf('0x43')]()[_0x6ddf('0x1d')](respondWithResult(_0x3f34ef,null))[_0x6ddf('0x39')](handleError(_0x3f34ef,null));};exports[_0x6ddf('0x44')]=function(_0x2fe2fe,_0x3b6309,_0x1af1c4){var _0x536d4d=require(_0x6ddf('0x45'));var _0x3fe62f=![];var _0x245d33={};if(_0x2fe2fe[_0x6ddf('0x28')]['type']&&_0x2fe2fe[_0x6ddf('0x28')][_0x6ddf('0x46')]==='uniqueid'){_0x245d33[_0x6ddf('0x47')]=_0x2fe2fe['params']['id'];}else{_0x245d33['id']=_0x2fe2fe[_0x6ddf('0x42')]['id'];}return db[_0x6ddf('0x22')][_0x6ddf('0x3c')]({'where':_0x245d33,'attributes':['id','value'],'raw':!![]})[_0x6ddf('0x1d')](handleEntityNotFound(_0x3b6309,null))[_0x6ddf('0x1d')](function(_0x3d511b){if(_0x3d511b){var _0xaea7c=path['join'](config[_0x6ddf('0x48')],_0x6ddf('0x49'),_0x3d511b[_0x6ddf('0x4a')]);var _0x34e6f8=util[_0x6ddf('0x4b')]('%s.cypher',_0xaea7c);if(fs[_0x6ddf('0x4c')](_0x34e6f8)){_0x3fe62f=!![];return _0x536d4d[_0x6ddf('0x4d')](_0x34e6f8,_0xaea7c,config[_0x6ddf('0x4e')][_0x6ddf('0x4f')])[_0x6ddf('0x1d')](function(){return _0x3d511b;});}return _0x3d511b;}})[_0x6ddf('0x1d')](function(_0x559025){if(_0x559025){var _0x54b258=path[_0x6ddf('0x50')](config[_0x6ddf('0x48')],_0x6ddf('0x49'),_0x559025[_0x6ddf('0x4a')]);if(!fs['existsSync'](_0x54b258)){throw new db['Sequelize'][(_0x6ddf('0x51'))]('ScreenRecording\x20not\x20found');}if(_0x559025[_0x6ddf('0x52')]){return _0x3b6309[_0x6ddf('0x44')](_0x54b258,_0x559025[_0x6ddf('0x52')]+path[_0x6ddf('0x53')](_0x54b258),function(){if(_0x3fe62f){fs['unlink'](_0x54b258);}});}else{return _0x3b6309[_0x6ddf('0x44')](_0x54b258,function(_0x277bbd){if(_0x3fe62f){fs[_0x6ddf('0x54')](_0x54b258);}});}}})[_0x6ddf('0x39')](function(_0x187b07){if(_0x187b07[_0x6ddf('0x55')]===_0x6ddf('0x56')){_0x3b6309[_0x6ddf('0x12')](0x194)[_0x6ddf('0x57')](_0x6ddf('0x58'));}else{return handleError(_0x3b6309,null);}});};exports[_0x6ddf('0x1c')]=function(_0x2e545f,_0x53a00a){return db[_0x6ddf('0x22')][_0x6ddf('0x3c')]({'where':{'id':_0x2e545f[_0x6ddf('0x42')]['id']}})['then'](function(_0x2e16f){if(!_0x2e16f)throw new ReferenceError(_0x6ddf('0x59'));return _0x2e16f;})['then'](function(_0x3fb4d2){var _0x19f69c=path[_0x6ddf('0x50')](config[_0x6ddf('0x48')],_0x6ddf('0x49'),_0x3fb4d2[_0x6ddf('0x4a')]);logger[_0x6ddf('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x19f69c);if(!_[_0x6ddf('0x5b')](_0x3fb4d2['value'])&&fs[_0x6ddf('0x4c')](_0x19f69c)){logger['info']('File:\x20\x22'+_0x19f69c+_0x6ddf('0x5c'));fs[_0x6ddf('0x5d')](_0x19f69c);}_0x19f69c=_0x19f69c+_0x6ddf('0x5e');if(!_[_0x6ddf('0x5b')](_0x3fb4d2[_0x6ddf('0x4a')])&&fs[_0x6ddf('0x4c')](_0x19f69c)){logger['info'](_0x6ddf('0x5f')+_0x19f69c+_0x6ddf('0x5c'));fs[_0x6ddf('0x5d')](_0x19f69c);}return _0x3fb4d2;})[_0x6ddf('0x1d')](function(_0x488c98){if(!_0x488c98)throw new InternalError();return _0x488c98[_0x6ddf('0x1c')]();})[_0x6ddf('0x1d')](function(){_0x53a00a[_0x6ddf('0x12')](0xcc)[_0x6ddf('0x13')]();})[_0x6ddf('0x39')](handleError(_0x53a00a,null));}; \ No newline at end of file +var _0x4ca8=['unlinkSync','.cypher','end','eml-format','rimraf','fast-json-patch','moment','bluebird','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','merge','find','catch','create','body','update','createdAt','value','describe','download','../../components/encryptor','uniqueid','params','join','root','format','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x4ca8,0x18f));var _0x84ca=function(_0x52715d,_0x58ff54){_0x52715d=_0x52715d-0x0;var _0x125509=_0x4ca8[_0x52715d];return _0x125509;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x84ca('0x0'));var rimraf=require(_0x84ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x84ca('0x2'));var rp=require('request-promise');var moment=require(_0x84ca('0x3'));var BPromise=require(_0x84ca('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x84ca('0x5'));var ejs=require(_0x84ca('0x6'));var fs=require('fs');var _=require(_0x84ca('0x7'));var squel=require(_0x84ca('0x8'));var crypto=require(_0x84ca('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x84ca('0xa'));var toCsv=require(_0x84ca('0x5'));var querystring=require(_0x84ca('0xb'));var Papa=require(_0x84ca('0xc'));var Redis=require(_0x84ca('0xd'));var authService=require(_0x84ca('0xe'));var qs=require(_0x84ca('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x84ca('0x10'))(_0x84ca('0x11'));var utils=require(_0x84ca('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56efd9,_0x2f70ce){_0x2f70ce=_0x2f70ce||0xcc;return function(_0x59ba3a){if(_0x59ba3a){return _0x56efd9[_0x84ca('0x13')](_0x2f70ce);}return _0x56efd9[_0x84ca('0x14')](_0x2f70ce)['end']();};}function respondWithResult(_0x106b4b,_0x33b419){_0x33b419=_0x33b419||0xc8;return function(_0x4cfbaf){if(_0x4cfbaf){return _0x106b4b[_0x84ca('0x14')](_0x33b419)['json'](_0x4cfbaf);}};}function respondWithFilteredResult(_0x49e96a,_0xe797f6){return function(_0x26a776){if(_0x26a776){var _0x389ae6=_0x26a776[_0x84ca('0x15')],_0x510177=_0xe797f6[_0x84ca('0x16')],_0x1865d5=_0xe797f6['offset']+_0xe797f6[_0x84ca('0x17')],_0x22b085;if(_0x1865d5>=_0x389ae6){_0x1865d5=_0x389ae6;_0x22b085=0xc8;}else{_0x22b085=0xce;}_0x49e96a['status'](_0x22b085);return _0x49e96a[_0x84ca('0x18')](_0x84ca('0x19'),_0x510177+'-'+_0x1865d5+'/'+_0x389ae6)[_0x84ca('0x1a')](_0x26a776);}return null;};}function patchUpdates(_0x5ba3d8){return function(_0x2d0fdc){try{jsonpatch[_0x84ca('0x1b')](_0x2d0fdc,_0x5ba3d8,!![]);}catch(_0x4fa625){return BPromise[_0x84ca('0x1c')](_0x4fa625);}return _0x2d0fdc['save']();};}function saveUpdates(_0x552146,_0x204bd8){return function(_0x4fd6f9){if(_0x4fd6f9){return _0x4fd6f9['update'](_0x552146)[_0x84ca('0x1d')](function(_0xfd241c){return _0xfd241c;});}return null;};}function removeEntity(_0x124c78,_0x176a84){return function(_0x41bc72){if(_0x41bc72){return _0x41bc72[_0x84ca('0x1e')]()[_0x84ca('0x1d')](function(){_0x124c78[_0x84ca('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x547291,_0x452904){return function(_0x3e0121){if(!_0x3e0121){_0x547291[_0x84ca('0x13')](0x194);}return _0x3e0121;};}function handleError(_0x4124c8,_0x144ddc){_0x144ddc=_0x144ddc||0x1f4;return function(_0xb473eb){logger[_0x84ca('0x1f')](_0xb473eb[_0x84ca('0x20')]);if(_0xb473eb['name']){delete _0xb473eb[_0x84ca('0x21')];}_0x4124c8[_0x84ca('0x14')](_0x144ddc)[_0x84ca('0x22')](_0xb473eb);};}exports['index']=function(_0x246ab8,_0x428412){var _0x1df5c7={},_0x44ea55={},_0x52384e={'count':0x0,'rows':[]};var _0x16a0d=_[_0x84ca('0x23')](db[_0x84ca('0x24')]['rawAttributes'],function(_0x666f20){return{'name':_0x666f20[_0x84ca('0x25')],'type':_0x666f20[_0x84ca('0x26')][_0x84ca('0x27')]};});_0x44ea55[_0x84ca('0x28')]=_['differenceBy'](_[_0x84ca('0x23')](_0x16a0d,_0x84ca('0x21')),['format']);_0x44ea55[_0x84ca('0x29')]=_[_0x84ca('0x2a')](_0x246ab8['query']);_0x44ea55[_0x84ca('0x2b')]=_[_0x84ca('0x2c')](_0x44ea55[_0x84ca('0x28')],_0x44ea55[_0x84ca('0x29')]);_0x1df5c7[_0x84ca('0x2d')]=_['intersection'](_0x44ea55[_0x84ca('0x28')],qs[_0x84ca('0x2e')](_0x246ab8['query'][_0x84ca('0x2e')]));_0x1df5c7['attributes']=_0x1df5c7[_0x84ca('0x2d')][_0x84ca('0x2f')]?_0x1df5c7[_0x84ca('0x2d')]:_0x44ea55['model'];if(!_0x246ab8['query'][_0x84ca('0x30')](_0x84ca('0x31'))){_0x1df5c7[_0x84ca('0x17')]=qs[_0x84ca('0x17')](_0x246ab8[_0x84ca('0x29')][_0x84ca('0x17')]);_0x1df5c7['offset']=qs['offset'](_0x246ab8[_0x84ca('0x29')]['offset']);}_0x1df5c7[_0x84ca('0x32')]=qs[_0x84ca('0x33')](_0x246ab8['query'][_0x84ca('0x33')]);_0x1df5c7['where']=qs['filters'](_[_0x84ca('0x34')](_0x246ab8[_0x84ca('0x29')],_0x44ea55['filters']),_0x16a0d);if(_0x246ab8['query'][_0x84ca('0x35')]){_0x1df5c7[_0x84ca('0x36')]=_['merge'](_0x1df5c7[_0x84ca('0x36')],{'$or':_[_0x84ca('0x23')](_0x16a0d,function(_0xf8428d){if(_0xf8428d[_0x84ca('0x26')]!==_0x84ca('0x37')){var _0x47a8d8={};_0x47a8d8[_0xf8428d[_0x84ca('0x21')]]={'$like':'%'+_0x246ab8[_0x84ca('0x29')][_0x84ca('0x35')]+'%'};return _0x47a8d8;}})});}_0x1df5c7=_['merge']({},_0x1df5c7,_0x246ab8[_0x84ca('0x38')]);var _0x1b8670={'where':_0x1df5c7[_0x84ca('0x36')]};return db['ScreenRecording'][_0x84ca('0x15')](_0x1b8670)[_0x84ca('0x1d')](function(_0x420d56){_0x52384e[_0x84ca('0x15')]=_0x420d56;if(_0x246ab8[_0x84ca('0x29')][_0x84ca('0x39')]){_0x1df5c7[_0x84ca('0x3a')]=[{'all':!![]}];}return db[_0x84ca('0x24')]['findAll'](_0x1df5c7);})[_0x84ca('0x1d')](function(_0x52307a){_0x52384e[_0x84ca('0x3b')]=_0x52307a;return _0x52384e;})[_0x84ca('0x1d')](respondWithFilteredResult(_0x428412,_0x1df5c7))['catch'](handleError(_0x428412,null));};exports[_0x84ca('0x3c')]=function(_0x18089e,_0x46b7e6){var _0x2d7944={'raw':![],'where':{'id':_0x18089e['params']['id']}},_0x1272aa={};_0x1272aa[_0x84ca('0x28')]=_[_0x84ca('0x2a')](db[_0x84ca('0x24')]['rawAttributes']);_0x1272aa[_0x84ca('0x29')]=_['keys'](_0x18089e[_0x84ca('0x29')]);_0x1272aa[_0x84ca('0x2b')]=_[_0x84ca('0x2c')](_0x1272aa['model'],_0x1272aa[_0x84ca('0x29')]);_0x2d7944[_0x84ca('0x2d')]=_[_0x84ca('0x2c')](_0x1272aa[_0x84ca('0x28')],qs['fields'](_0x18089e[_0x84ca('0x29')]['fields']));_0x2d7944[_0x84ca('0x2d')]=_0x2d7944[_0x84ca('0x2d')][_0x84ca('0x2f')]?_0x2d7944[_0x84ca('0x2d')]:_0x1272aa['model'];if(_0x18089e['query'][_0x84ca('0x39')]){_0x2d7944[_0x84ca('0x3a')]=[{'all':!![]}];}_0x2d7944=_[_0x84ca('0x3d')]({},_0x2d7944,_0x18089e[_0x84ca('0x38')]);return db[_0x84ca('0x24')][_0x84ca('0x3e')](_0x2d7944)[_0x84ca('0x1d')](handleEntityNotFound(_0x46b7e6,null))[_0x84ca('0x1d')](respondWithResult(_0x46b7e6,null))[_0x84ca('0x3f')](handleError(_0x46b7e6,null));};exports[_0x84ca('0x40')]=function(_0x121a88,_0x30a85a){return db[_0x84ca('0x24')][_0x84ca('0x40')](_0x121a88[_0x84ca('0x41')],{})['then'](respondWithResult(_0x30a85a,0xc9))[_0x84ca('0x3f')](handleError(_0x30a85a,null));};exports[_0x84ca('0x42')]=function(_0x4e6f87,_0x775dae){if(_0x4e6f87['body']['id']){delete _0x4e6f87[_0x84ca('0x41')]['id'];}delete _0x4e6f87[_0x84ca('0x41')]['duration'];delete _0x4e6f87[_0x84ca('0x41')][_0x84ca('0x43')];delete _0x4e6f87['body']['closedAt'];delete _0x4e6f87[_0x84ca('0x41')][_0x84ca('0x44')];return db['ScreenRecording']['find']({'where':{'id':_0x4e6f87['params']['id']}})[_0x84ca('0x1d')](handleEntityNotFound(_0x775dae,null))['then'](saveUpdates(_0x4e6f87['body'],null))[_0x84ca('0x1d')](respondWithResult(_0x775dae,null))[_0x84ca('0x3f')](handleError(_0x775dae,null));};exports[_0x84ca('0x45')]=function(_0xafcb6e,_0x3a2fbd){return db[_0x84ca('0x24')][_0x84ca('0x45')]()[_0x84ca('0x1d')](respondWithResult(_0x3a2fbd,null))[_0x84ca('0x3f')](handleError(_0x3a2fbd,null));};exports[_0x84ca('0x46')]=function(_0x528c60,_0x489ba5,_0x52a4aa){var _0x1f95bb=require(_0x84ca('0x47'));var _0xe37fc=![];var _0x2fcb42={};if(_0x528c60[_0x84ca('0x29')][_0x84ca('0x26')]&&_0x528c60[_0x84ca('0x29')][_0x84ca('0x26')]===_0x84ca('0x48')){_0x2fcb42['uniqueid']=_0x528c60[_0x84ca('0x49')]['id'];}else{_0x2fcb42['id']=_0x528c60[_0x84ca('0x49')]['id'];}return db[_0x84ca('0x24')][_0x84ca('0x3e')]({'where':_0x2fcb42,'attributes':['id','value'],'raw':!![]})[_0x84ca('0x1d')](handleEntityNotFound(_0x489ba5,null))[_0x84ca('0x1d')](function(_0x16398c){if(_0x16398c){var _0xf83495=path[_0x84ca('0x4a')](config[_0x84ca('0x4b')],'server/files/screen_recordings',_0x16398c[_0x84ca('0x44')]);var _0x8c2a6d=util[_0x84ca('0x4c')]('%s.cypher',_0xf83495);if(fs[_0x84ca('0x4d')](_0x8c2a6d)){_0xe37fc=!![];return _0x1f95bb[_0x84ca('0x4e')](_0x8c2a6d,_0xf83495,config[_0x84ca('0x4f')][_0x84ca('0x50')])[_0x84ca('0x1d')](function(){return _0x16398c;});}return _0x16398c;}})[_0x84ca('0x1d')](function(_0x196773){if(_0x196773){var _0x166f3a=path[_0x84ca('0x4a')](config['root'],_0x84ca('0x51'),_0x196773['value']);if(!fs[_0x84ca('0x4d')](_0x166f3a)){throw new db[(_0x84ca('0x52'))][(_0x84ca('0x53'))](_0x84ca('0x54'));}if(_0x196773[_0x84ca('0x55')]){return _0x489ba5[_0x84ca('0x46')](_0x166f3a,_0x196773[_0x84ca('0x55')]+path[_0x84ca('0x56')](_0x166f3a),function(){if(_0xe37fc){fs['unlink'](_0x166f3a);}});}else{return _0x489ba5[_0x84ca('0x46')](_0x166f3a,function(_0x1d32f){if(_0xe37fc){fs[_0x84ca('0x57')](_0x166f3a);}});}}})[_0x84ca('0x3f')](function(_0x12bf29){if(_0x12bf29[_0x84ca('0x58')]===_0x84ca('0x54')){_0x489ba5['status'](0x194)[_0x84ca('0x22')](_0x84ca('0x59'));}else{return handleError(_0x489ba5,null);}});};exports[_0x84ca('0x1e')]=function(_0x5b5289,_0x57e84b){return db[_0x84ca('0x24')][_0x84ca('0x3e')]({'where':{'id':_0x5b5289[_0x84ca('0x49')]['id']}})[_0x84ca('0x1d')](function(_0x1c05de){if(!_0x1c05de)throw new ReferenceError(_0x84ca('0x5a'));return _0x1c05de;})[_0x84ca('0x1d')](function(_0x2109de){var _0x46014e=path['join'](config[_0x84ca('0x4b')],_0x84ca('0x51'),_0x2109de[_0x84ca('0x44')]);logger['info'](_0x84ca('0x5b'),_0x46014e);if(!_[_0x84ca('0x5c')](_0x2109de['value'])&&fs['existsSync'](_0x46014e)){logger[_0x84ca('0x5d')](_0x84ca('0x5e')+_0x46014e+_0x84ca('0x5f'));fs[_0x84ca('0x60')](_0x46014e);}_0x46014e=_0x46014e+_0x84ca('0x61');if(!_[_0x84ca('0x5c')](_0x2109de[_0x84ca('0x44')])&&fs[_0x84ca('0x4d')](_0x46014e)){logger['info'](_0x84ca('0x5e')+_0x46014e+_0x84ca('0x5f'));fs[_0x84ca('0x60')](_0x46014e);}return _0x2109de;})[_0x84ca('0x1d')](function(_0x3d8142){if(!_0x3d8142)throw new InternalError();return _0x3d8142[_0x84ca('0x1e')]();})['then'](function(){_0x57e84b[_0x84ca('0x14')](0xcc)[_0x84ca('0x62')]();})[_0x84ca('0x3f')](handleError(_0x57e84b,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c2c520b..d853510 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 _0x9443=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid'];(function(_0x4ff0e4,_0x3e0f9f){var _0x18a93d=function(_0x4f98e8){while(--_0x4f98e8){_0x4ff0e4['push'](_0x4ff0e4['shift']());}};_0x18a93d(++_0x3e0f9f);}(_0x9443,0xc3));var _0x3944=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9443[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x3944('0x0'));var util=require(_0x3944('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3944('0x2'));var BPromise=require(_0x3944('0x3'));var rp=require(_0x3944('0x4'));var fs=require('fs');var path=require(_0x3944('0x5'));var rimraf=require(_0x3944('0x6'));var config=require(_0x3944('0x7'));var attributes=require(_0x3944('0x8'));module[_0x3944('0x9')]=function(_0x4d2f71,_0x14d2ee){return _0x4d2f71[_0x3944('0xa')]('ScreenRecording',attributes,{'tableName':_0x3944('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x3944('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa977=['bluebird','request-promise','path','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x50f9e5,_0x4f90d6){var _0x548d6b=function(_0x5404c7){while(--_0x5404c7){_0x50f9e5['push'](_0x50f9e5['shift']());}};_0x548d6b(++_0x4f90d6);}(_0xa977,0x7e));var _0x7a97=function(_0x5a9981,_0xa5d339){_0x5a9981=_0x5a9981-0x0;var _0x4ae80d=_0xa977[_0x5a9981];return _0x4ae80d;};'use strict';var _=require(_0x7a97('0x0'));var util=require(_0x7a97('0x1'));var logger=require(_0x7a97('0x2'))(_0x7a97('0x3'));var moment=require('moment');var BPromise=require(_0x7a97('0x4'));var rp=require(_0x7a97('0x5'));var fs=require('fs');var path=require(_0x7a97('0x6'));var rimraf=require('rimraf');var config=require(_0x7a97('0x7'));var attributes=require('./screenRecording.attributes');module[_0x7a97('0x8')]=function(_0x5260c4,_0x391bfc){return _0x5260c4[_0x7a97('0x9')](_0x7a97('0xa'),attributes,{'tableName':_0x7a97('0xb'),'paranoid':![],'indexes':[{'name':_0x7a97('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 013e22b..f7a0ece 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(_0x254d41,_0x276339){var _0x122685=function(_0xea2799){while(--_0xea2799){_0x254d41['push'](_0x254d41['shift']());}};_0x122685(++_0x276339);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x1e42a3,_0x1558fe){var _0xa2e0c=function(_0x4d4ac3){while(--_0x4d4ac3){_0x1e42a3['push'](_0x1e42a3['shift']());}};_0xa2e0c(++_0x1558fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 f805549..6d16307 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 _0xe16c=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','root','format','%s%s','logo','extname','post','single','addLogo','join','server/files/images/logos/','logologin','originalname','file','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','put','exports','multer','util','path','connect-timeout'];(function(_0x1f5171,_0x5dcc46){var _0x3bbaa0=function(_0x1ce899){while(--_0x1ce899){_0x1f5171['push'](_0x1f5171['shift']());}};_0x3bbaa0(++_0x5dcc46);}(_0xe16c,0x15b));var _0xce16=function(_0x5eecea,_0x6ac213){_0x5eecea=_0x5eecea-0x0;var _0x4669c3=_0xe16c[_0x5eecea];return _0x4669c3;};'use strict';var multer=require(_0xce16('0x0'));var util=require(_0xce16('0x1'));var path=require(_0xce16('0x2'));var timeout=require(_0xce16('0x3'));var express=require(_0xce16('0x4'));var router=express[_0xce16('0x5')]();var auth=require(_0xce16('0x6'));var interaction=require(_0xce16('0x7'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xce16('0x8')]('/',auth[_0xce16('0x9')](),controller[_0xce16('0xa')]);router[_0xce16('0x8')](_0xce16('0xb'),controller['show']);router['get'](_0xce16('0xc'),controller['getLogo']);router['get'](_0xce16('0xd'),controller['getLogoLogin']);router[_0xce16('0x8')](_0xce16('0xe'),controller[_0xce16('0xf')]);router[_0xce16('0x8')](_0xce16('0x10'),controller[_0xce16('0x11')]);router[_0xce16('0x8')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xce16('0x12')]({'destination':function(_0x52aaac,_0x461638,_0x82c1ad){_0x82c1ad(null,path['join'](config[_0xce16('0x13')],'server/files/images/logos/'));},'filename':function(_0x466ae,_0x311b15,_0x197fda){_0x197fda(null,util[_0xce16('0x14')](_0xce16('0x15'),_0xce16('0x16'),path[_0xce16('0x17')](_0x311b15['originalname'])));}})});router[_0xce16('0x18')](_0xce16('0xc'),upload[_0xce16('0x19')]('file'),controller[_0xce16('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x370009,_0x242fdb,_0x56d5e1){_0x56d5e1(null,path[_0xce16('0x1b')](config['root'],_0xce16('0x1c')));},'filename':function(_0x4dd8dc,_0x5b4dd4,_0x2e608b){_0x2e608b(null,util['format'](_0xce16('0x15'),_0xce16('0x1d'),path[_0xce16('0x17')](_0x5b4dd4[_0xce16('0x1e')])));}})});router[_0xce16('0x18')](_0xce16('0xd'),upload[_0xce16('0x19')](_0xce16('0x1f')),controller[_0xce16('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x159a8c,_0x42cbf6,_0x4c7c0e){_0x4c7c0e(null,path[_0xce16('0x1b')](config['root'],'server/files/images/logos/'));},'filename':function(_0x15d136,_0x45959a,_0x2dbe07){_0x2dbe07(null,util['format'](_0xce16('0x15'),_0xce16('0x21'),path[_0xce16('0x17')](_0x45959a[_0xce16('0x1e')])));}})});router[_0xce16('0x18')](_0xce16('0x10'),upload['single'](_0xce16('0x1f')),controller[_0xce16('0x22')]);var upload=multer({'storage':multer[_0xce16('0x12')]({'destination':function(_0x1bd781,_0x28d93d,_0x1283f7){_0x1283f7(null,path[_0xce16('0x1b')](config[_0xce16('0x13')],_0xce16('0x1c')));},'filename':function(_0x16f901,_0x2826ee,_0x5ac1a6){_0x5ac1a6(null,util[_0xce16('0x14')](_0xce16('0x15'),_0xce16('0x23'),path[_0xce16('0x17')](_0x2826ee[_0xce16('0x1e')])));}})});router[_0xce16('0x18')](_0xce16('0x24'),upload[_0xce16('0x19')]('file'),controller['addFavicon']);router[_0xce16('0x25')](_0xce16('0xb'),auth[_0xce16('0x9')](),controller['update']);module[_0xce16('0x26')]=router; \ No newline at end of file +var _0xfe79=['isAuthenticated','index','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','post','single','file','addLogo','%s%s','logologin','originalname','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get'];(function(_0x3c5ad6,_0x47b7bf){var _0x3154f2=function(_0x3a24de){while(--_0x3a24de){_0x3c5ad6['push'](_0x3c5ad6['shift']());}};_0x3154f2(++_0x47b7bf);}(_0xfe79,0x72));var _0x9fe7=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0xfe79[_0x1af5b2];return _0xf1aa2d;};'use strict';var multer=require('multer');var util=require(_0x9fe7('0x0'));var path=require(_0x9fe7('0x1'));var timeout=require(_0x9fe7('0x2'));var express=require(_0x9fe7('0x3'));var router=express[_0x9fe7('0x4')]();var auth=require(_0x9fe7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9fe7('0x6'));var controller=require(_0x9fe7('0x7'));router[_0x9fe7('0x8')]('/',auth[_0x9fe7('0x9')](),controller[_0x9fe7('0xa')]);router[_0x9fe7('0x8')](_0x9fe7('0xb'),controller[_0x9fe7('0xc')]);router[_0x9fe7('0x8')](_0x9fe7('0xd'),controller[_0x9fe7('0xe')]);router[_0x9fe7('0x8')]('/:id/logo_login',controller[_0x9fe7('0xf')]);router[_0x9fe7('0x8')](_0x9fe7('0x10'),controller[_0x9fe7('0x11')]);router[_0x9fe7('0x8')]('/:id/preferred',controller['getPreferred']);router['get'](_0x9fe7('0x12'),controller[_0x9fe7('0x13')]);var upload=multer({'storage':multer[_0x9fe7('0x14')]({'destination':function(_0x5c5499,_0x27ced5,_0x2599fc){_0x2599fc(null,path[_0x9fe7('0x15')](config[_0x9fe7('0x16')],_0x9fe7('0x17')));},'filename':function(_0xbeac1,_0x5b2db5,_0x48e9a3){_0x48e9a3(null,util[_0x9fe7('0x18')]('%s%s',_0x9fe7('0x19'),path[_0x9fe7('0x1a')](_0x5b2db5['originalname'])));}})});router[_0x9fe7('0x1b')](_0x9fe7('0xd'),upload[_0x9fe7('0x1c')](_0x9fe7('0x1d')),controller[_0x9fe7('0x1e')]);var upload=multer({'storage':multer[_0x9fe7('0x14')]({'destination':function(_0x5df83f,_0x1a6b15,_0x245bbf){_0x245bbf(null,path[_0x9fe7('0x15')](config[_0x9fe7('0x16')],_0x9fe7('0x17')));},'filename':function(_0x340a2d,_0x311bac,_0x4dbe8c){_0x4dbe8c(null,util[_0x9fe7('0x18')](_0x9fe7('0x1f'),_0x9fe7('0x20'),path['extname'](_0x311bac[_0x9fe7('0x21')])));}})});router[_0x9fe7('0x1b')]('/:id/logo_login',upload[_0x9fe7('0x1c')](_0x9fe7('0x1d')),controller[_0x9fe7('0x22')]);var upload=multer({'storage':multer[_0x9fe7('0x14')]({'destination':function(_0x622bf4,_0x140cc5,_0x3e4e81){_0x3e4e81(null,path[_0x9fe7('0x15')](config[_0x9fe7('0x16')],_0x9fe7('0x17')));},'filename':function(_0x238d8d,_0x278370,_0x12c2c2){_0x12c2c2(null,util[_0x9fe7('0x18')](_0x9fe7('0x1f'),_0x9fe7('0x23'),path[_0x9fe7('0x1a')](_0x278370[_0x9fe7('0x21')])));}})});router[_0x9fe7('0x1b')](_0x9fe7('0x24'),upload[_0x9fe7('0x1c')](_0x9fe7('0x1d')),controller[_0x9fe7('0x25')]);var upload=multer({'storage':multer[_0x9fe7('0x14')]({'destination':function(_0x157eb6,_0x3add02,_0x58a830){_0x58a830(null,path[_0x9fe7('0x15')](config['root'],_0x9fe7('0x17')));},'filename':function(_0x508a56,_0x399c45,_0xcc0a4a){_0xcc0a4a(null,util[_0x9fe7('0x18')](_0x9fe7('0x1f'),_0x9fe7('0x26'),path[_0x9fe7('0x1a')](_0x399c45[_0x9fe7('0x21')])));}})});router[_0x9fe7('0x1b')](_0x9fe7('0x12'),upload[_0x9fe7('0x1c')]('file'),controller[_0x9fe7('0x27')]);router[_0x9fe7('0x28')](_0x9fe7('0xb'),auth[_0x9fe7('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index adf2094..a178ab3 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 _0x47e3=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','sequelize','exports','INTEGER','min_internal'];(function(_0x1c81f4,_0x190357){var _0x4a4053=function(_0x24c79b){while(--_0x24c79b){_0x1c81f4['push'](_0x1c81f4['shift']());}};_0x4a4053(++_0x190357);}(_0x47e3,0x144));var _0x347e=function(_0x86f56c,_0x539f3f){_0x86f56c=_0x86f56c-0x0;var _0x29fd8d=_0x47e3[_0x86f56c];return _0x29fd8d;};'use strict';var Sequelize=require(_0x347e('0x0'));module[_0x347e('0x1')]={'min_internal':{'type':Sequelize[_0x347e('0x2')](0xb),'unique':_0x347e('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x347e('0x2')](0xb),'unique':_0x347e('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x347e('0x5')],'defaultValue':_0x347e('0x6')},'logo':{'type':Sequelize[_0x347e('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x347e('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x347e('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x347e('0x5')]},'turnaddr':{'type':Sequelize[_0x347e('0x5')]},'turnusername':{'type':Sequelize[_0x347e('0x5')]},'turnpassword':{'type':Sequelize[_0x347e('0x5')]},'pageTitle':{'type':Sequelize[_0x347e('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x347e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x347e('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x347e('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x347e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x347e('0x5')]},'defaultPreferred':{'type':Sequelize[_0x347e('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x347e('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x347e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x347e('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x347e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x347e('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x347e('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x347e('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x6818=['STRING','BOOLEAN','alternate','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1fda3c,_0xefd4cb){var _0x1a2d1e=function(_0x31a6c3){while(--_0x31a6c3){_0x1fda3c['push'](_0x1fda3c['shift']());}};_0x1a2d1e(++_0xefd4cb);}(_0x6818,0x9b));var _0x8681=function(_0x5af886,_0xec826d){_0x5af886=_0x5af886-0x0;var _0x4ff2f9=_0x6818[_0x5af886];return _0x4ff2f9;};'use strict';var Sequelize=require('sequelize');module[_0x8681('0x0')]={'min_internal':{'type':Sequelize[_0x8681('0x1')](0xb),'unique':_0x8681('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x8681('0x1')](0xb),'unique':_0x8681('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8681('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x8681('0x4')},'logo':{'type':Sequelize[_0x8681('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8681('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x8681('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x8681('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8681('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8681('0x5')]},'turnaddr':{'type':Sequelize[_0x8681('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x8681('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x8681('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x8681('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x8681('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8681('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8681('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x8681('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x8681('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8681('0x5')]},'defaultPreferred':{'type':Sequelize[_0x8681('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8681('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x8681('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8681('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x8681('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x8681('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8681('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x8681('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8681('0x1')]},'transcribeRegion':{'type':Sequelize[_0x8681('0x5')]},'sentiment':{'type':Sequelize[_0x8681('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x8681('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x8681('0x1')]},'sentimentRegion':{'type':Sequelize[_0x8681('0x5')]},'language':{'type':Sequelize[_0x8681('0x5')]},'bucket':{'type':Sequelize[_0x8681('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x8681('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6eceab4..66375a3 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 _0x8926=['existsSync','root','toLower','join','default_logo.svg','upperFirst','custom','ValidationError','\x20not\x20found','download','getLicense','default_loginLogo.svg','default','gdpr','getPreferred','defaultFavicon','default_preferred.png','default_favicon.ico','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','Setting,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','send','map','Setting','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','include','findAll','rows','show','params','options','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred'];(function(_0x5ec7f8,_0x5d5978){var _0x4cd2e1=function(_0x322023){while(--_0x322023){_0x5ec7f8['push'](_0x5ec7f8['shift']());}};_0x4cd2e1(++_0x5d5978);}(_0x8926,0x88));var _0x6892=function(_0x4ccc77,_0x28dde1){_0x4ccc77=_0x4ccc77-0x0;var _0x2db81c=_0x8926[_0x4ccc77];return _0x2db81c;};'use strict';var pdf=require(_0x6892('0x0'));var emlformat=require(_0x6892('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6892('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6892('0x3'));var moment=require('moment');var BPromise=require(_0x6892('0x4'));var Mustache=require(_0x6892('0x5'));var util=require(_0x6892('0x6'));var path=require(_0x6892('0x7'));var sox=require(_0x6892('0x8'));var csv=require('to-csv');var ejs=require(_0x6892('0x9'));var fs=require('fs');var _=require(_0x6892('0xa'));var squel=require(_0x6892('0xb'));var crypto=require(_0x6892('0xc'));var jsforce=require(_0x6892('0xd'));var deskjs=require(_0x6892('0xe'));var toCsv=require(_0x6892('0xf'));var querystring=require(_0x6892('0x10'));var Papa=require(_0x6892('0x11'));var Redis=require(_0x6892('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6892('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6892('0x14'));var logger=require(_0x6892('0x15'))(_0x6892('0x16'));var utils=require(_0x6892('0x17'));var config=require(_0x6892('0x18'));var db=require(_0x6892('0x19'))['db'];var jayson=require(_0x6892('0x1a'));var client=jayson[_0x6892('0x1b')][_0x6892('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x39a5ec,_0xb2c3e4,_0x1fc0dc){if(_0x1fc0dc){var _0xc10906=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc10906[_0x6892('0x1d')](_0xb2c3e4)){return _0x39a5ec;}else{throw new db[(_0x6892('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 _0x39a5ec;}}function respondWithRpcPromise(_0x4c86a1,_0x1e0ff6,_0x5e87a7,_0x599523){return new BPromise(function(_0x2b95bc,_0x18c760){var _0x576b04=_0x599523||client;return _0x576b04[_0x6892('0x1f')](_0x4c86a1,_0x5e87a7)['then'](function(_0x4c0fca){logger['info'](_0x6892('0x20'),_0x1e0ff6,_0x6892('0x21'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1e0ff6,_0x6892('0x21'),JSON['stringify'](_0x4c0fca));if(_0x4c0fca[_0x6892('0x22')]){if(_0x4c0fca[_0x6892('0x22')][_0x6892('0x23')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x1e0ff6,_0x4c0fca[_0x6892('0x22')][_0x6892('0x24')]);return _0x18c760(_0x4c0fca['error']['message']);}logger[_0x6892('0x22')](_0x6892('0x20'),_0x1e0ff6,_0x4c0fca[_0x6892('0x22')][_0x6892('0x24')]);return _0x2b95bc(_0x4c0fca['error'][_0x6892('0x24')]);}else{logger['info'](_0x6892('0x20'),_0x1e0ff6,_0x6892('0x21'));_0x2b95bc(_0x4c0fca[_0x6892('0x25')][_0x6892('0x24')]);}})[_0x6892('0x26')](function(_0x11d234){logger[_0x6892('0x22')](_0x6892('0x20'),_0x1e0ff6,_0x11d234);_0x18c760(_0x11d234);});});}function respondWithStatusCode(_0x54fbc2,_0x12a6b4){_0x12a6b4=_0x12a6b4||0xcc;return function(_0x43cd58){if(_0x43cd58){return _0x54fbc2['sendStatus'](_0x12a6b4);}return _0x54fbc2[_0x6892('0x27')](_0x12a6b4)[_0x6892('0x28')]();};}function respondWithResult(_0x108ba4,_0xd25433){_0xd25433=_0xd25433||0xc8;return function(_0x42bc3b){if(_0x42bc3b){return _0x108ba4[_0x6892('0x27')](_0xd25433)[_0x6892('0x29')](_0x42bc3b);}};}function respondWithFilteredResult(_0x2d656d,_0x446440){return function(_0x1142cf){if(_0x1142cf){var _0x5a8ae4=_0x1142cf['count'],_0x501f5e=_0x446440[_0x6892('0x2a')],_0x3b26a4=_0x446440['offset']+_0x446440[_0x6892('0x2b')],_0xf4acab;if(_0x3b26a4>=_0x5a8ae4){_0x3b26a4=_0x5a8ae4;_0xf4acab=0xc8;}else{_0xf4acab=0xce;}_0x2d656d[_0x6892('0x27')](_0xf4acab);return _0x2d656d[_0x6892('0x2c')](_0x6892('0x2d'),_0x501f5e+'-'+_0x3b26a4+'/'+_0x5a8ae4)[_0x6892('0x29')](_0x1142cf);}return null;};}function patchUpdates(_0x3bedd9){return function(_0x37e76f){try{jsonpatch[_0x6892('0x2e')](_0x37e76f,_0x3bedd9,!![]);}catch(_0x209ea4){return BPromise[_0x6892('0x2f')](_0x209ea4);}return _0x37e76f[_0x6892('0x30')]();};}function saveUpdates(_0x44d997,_0x1326fe){return function(_0x205ef0){if(_0x205ef0){return _0x205ef0['update'](_0x44d997)['then'](function(_0x3e30cc){return _0x3e30cc;});}return null;};}function removeEntity(_0x1227de,_0x1e5111){return function(_0x59f151){if(_0x59f151){return _0x59f151[_0x6892('0x31')]()[_0x6892('0x32')](function(){_0x1227de[_0x6892('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d39d0,_0x3b0b24){return function(_0x7986be){if(!_0x7986be){_0x1d39d0[_0x6892('0x33')](0x194);}return _0x7986be;};}function handleError(_0x12de1e,_0x2a6f74){_0x2a6f74=_0x2a6f74||0x1f4;return function(_0x111704){logger[_0x6892('0x22')](_0x111704[_0x6892('0x34')]);if(_0x111704[_0x6892('0x35')]){delete _0x111704[_0x6892('0x35')];}_0x12de1e['status'](_0x2a6f74)[_0x6892('0x36')](_0x111704);};}exports['index']=function(_0x862222,_0x1fc45a){var _0x1b2151={},_0x3c8151={},_0x5530cd={'count':0x0,'rows':[]};var _0x1581c2=_[_0x6892('0x37')](db[_0x6892('0x38')][_0x6892('0x39')],function(_0x57a014){return{'name':_0x57a014[_0x6892('0x3a')],'type':_0x57a014[_0x6892('0x3b')]['key']};});_0x3c8151['model']=_[_0x6892('0x37')](_0x1581c2,_0x6892('0x35'));_0x3c8151[_0x6892('0x3c')]=_[_0x6892('0x3d')](_0x862222['query']);_0x3c8151[_0x6892('0x3e')]=_['intersection'](_0x3c8151[_0x6892('0x3f')],_0x3c8151[_0x6892('0x3c')]);_0x1b2151['attributes']=_[_0x6892('0x40')](_0x3c8151[_0x6892('0x3f')],qs[_0x6892('0x41')](_0x862222['query'][_0x6892('0x41')]));_0x1b2151['attributes']=_0x1b2151['attributes']['length']?_0x1b2151[_0x6892('0x42')]:_0x3c8151['model'];if(!_0x862222[_0x6892('0x3c')][_0x6892('0x43')](_0x6892('0x44'))){_0x1b2151['limit']=qs['limit'](_0x862222[_0x6892('0x3c')][_0x6892('0x2b')]);_0x1b2151[_0x6892('0x2a')]=qs['offset'](_0x862222[_0x6892('0x3c')][_0x6892('0x2a')]);}_0x1b2151[_0x6892('0x45')]=qs[_0x6892('0x46')](_0x862222[_0x6892('0x3c')][_0x6892('0x46')]);_0x1b2151['where']=qs['filters'](_[_0x6892('0x47')](_0x862222[_0x6892('0x3c')],_0x3c8151[_0x6892('0x3e')]),_0x1581c2);if(_0x862222[_0x6892('0x3c')][_0x6892('0x48')]){_0x1b2151[_0x6892('0x49')]=_[_0x6892('0x4a')](_0x1b2151[_0x6892('0x49')],{'$or':_['map'](_0x1581c2,function(_0x4f829a){if(_0x4f829a[_0x6892('0x3b')]!==_0x6892('0x4b')){var _0x32c795={};_0x32c795[_0x4f829a[_0x6892('0x35')]]={'$like':'%'+_0x862222['query'][_0x6892('0x48')]+'%'};return _0x32c795;}})});}_0x1b2151=_[_0x6892('0x4a')]({},_0x1b2151,_0x862222['options']);var _0x40cfa4={'where':_0x1b2151['where']};return db[_0x6892('0x38')][_0x6892('0x4c')](_0x40cfa4)[_0x6892('0x32')](function(_0x2a89e7){_0x5530cd[_0x6892('0x4c')]=_0x2a89e7;if(_0x862222[_0x6892('0x3c')]['includeAll']){_0x1b2151[_0x6892('0x4d')]=[{'all':!![]}];}return db[_0x6892('0x38')][_0x6892('0x4e')](_0x1b2151);})[_0x6892('0x32')](function(_0x5bb1eb){_0x5530cd[_0x6892('0x4f')]=_0x5bb1eb;return _0x5530cd;})[_0x6892('0x32')](respondWithFilteredResult(_0x1fc45a,_0x1b2151))[_0x6892('0x26')](handleError(_0x1fc45a,null));};exports[_0x6892('0x50')]=function(_0x492a23,_0x4e361b){var _0x47ebc4={'raw':![],'where':{'id':_0x492a23[_0x6892('0x51')]['id']}},_0x19e74f={};_0x19e74f[_0x6892('0x3f')]=_[_0x6892('0x3d')](db['Setting'][_0x6892('0x39')]);_0x19e74f[_0x6892('0x3c')]=_[_0x6892('0x3d')](_0x492a23[_0x6892('0x3c')]);_0x19e74f[_0x6892('0x3e')]=_[_0x6892('0x40')](_0x19e74f[_0x6892('0x3f')],_0x19e74f['query']);_0x47ebc4[_0x6892('0x42')]=_[_0x6892('0x40')](_0x19e74f[_0x6892('0x3f')],qs[_0x6892('0x41')](_0x492a23[_0x6892('0x3c')]['fields']));_0x47ebc4[_0x6892('0x42')]=_0x47ebc4[_0x6892('0x42')]['length']?_0x47ebc4[_0x6892('0x42')]:_0x19e74f[_0x6892('0x3f')];if(_0x492a23[_0x6892('0x3c')]['includeAll']){_0x47ebc4[_0x6892('0x4d')]=[{'all':!![]}];}_0x47ebc4=_[_0x6892('0x4a')]({},_0x47ebc4,_0x492a23[_0x6892('0x52')]);return db['Setting'][_0x6892('0x53')](_0x47ebc4)['then'](handleEntityNotFound(_0x4e361b,null))[_0x6892('0x32')](respondWithResult(_0x4e361b,null))[_0x6892('0x26')](handleError(_0x4e361b,null));};exports[_0x6892('0x54')]=function(_0x47bc1f,_0x32470c){if(_0x47bc1f[_0x6892('0x55')]['id']){delete _0x47bc1f[_0x6892('0x55')]['id'];}return db[_0x6892('0x38')]['find']({'where':{'id':_0x47bc1f['params']['id']}})[_0x6892('0x32')](handleEntityNotFound(_0x32470c,null))['then'](saveUpdates(_0x47bc1f[_0x6892('0x55')],null))[_0x6892('0x32')](respondWithResult(_0x32470c,null))[_0x6892('0x26')](handleError(_0x32470c,null));};exports[_0x6892('0x56')]=function(_0x441d0a,_0x3dec5a,_0x320a63){if(_0x441d0a[_0x6892('0x57')]&&_0x441d0a[_0x6892('0x57')][_0x6892('0x58')]){_0x441d0a[_0x6892('0x55')]['logo']=_0x441d0a[_0x6892('0x57')][_0x6892('0x58')];}return db[_0x6892('0x38')]['find']({'where':{'id':_0x441d0a[_0x6892('0x51')]['id']}})[_0x6892('0x32')](handleEntityNotFound(_0x3dec5a,null))['then'](saveUpdates(_0x441d0a['body'],null))[_0x6892('0x32')](respondWithResult(_0x3dec5a,null))[_0x6892('0x26')](handleError(_0x3dec5a,null));};exports[_0x6892('0x59')]=function(_0x15b2a0,_0x3f2c18,_0x19ffdd){if(_0x15b2a0['file']&&_0x15b2a0[_0x6892('0x57')][_0x6892('0x58')]){_0x15b2a0[_0x6892('0x55')][_0x6892('0x5a')]=_0x15b2a0[_0x6892('0x57')][_0x6892('0x58')];}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x15b2a0[_0x6892('0x51')]['id']}})[_0x6892('0x32')](handleEntityNotFound(_0x3f2c18,null))[_0x6892('0x32')](saveUpdates(_0x15b2a0[_0x6892('0x55')],null))[_0x6892('0x32')](respondWithResult(_0x3f2c18,null))['catch'](handleError(_0x3f2c18,null));};var utilLicense=require(_0x6892('0x5b'));exports[_0x6892('0x5c')]=function(_0xe68e40,_0x186308,_0x3a4d11){var _0xfbf9a9=_0x6892('0x5d');var _0x4639fd={'custom':![]};return utilLicense['getLicense']()[_0x6892('0x32')](function(_0x3d2a10){if(_0x3d2a10){_0x4639fd=_0x3d2a10;}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0xe68e40[_0x6892('0x51')]['id']},'attributes':[_0x6892('0x5e'),'loginLogo',_0x6892('0x5f'),_0x6892('0x60'),_0x6892('0x61'),_0x6892('0x62'),_0x6892('0x63'),'defaultFavicon'],'raw':!![]});})[_0x6892('0x32')](handleEntityNotFound(_0x186308,null))['then'](function(_0x1a2b71){if(_0x1a2b71){var _0x35b43c=_0x1a2b71['logo']&&fs[_0x6892('0x64')](path['join'](config[_0x6892('0x65')],_0xfbf9a9,_['toLower'](_0x1a2b71[_0x6892('0x5e')])))?path['join'](config[_0x6892('0x65')],_0xfbf9a9,_[_0x6892('0x66')](_0x1a2b71[_0x6892('0x5e')])):path[_0x6892('0x67')](config['root'],_0xfbf9a9,_[_0x6892('0x66')](_0x6892('0x68')));var _0x2fc755='default'+_[_0x6892('0x69')](_0x6892('0x5e'));if(_0x1a2b71[_0x2fc755]||!_0x4639fd[_0x6892('0x6a')]){_0x35b43c=path['join'](config[_0x6892('0x65')],_0xfbf9a9,_[_0x6892('0x66')](_0x6892('0x68')));}if(!fs['existsSync'](_0x35b43c)){throw new db[(_0x6892('0x1e'))][(_0x6892('0x6b'))](_[_0x6892('0x69')]('logo')+_0x6892('0x6c'));}return _0x186308[_0x6892('0x6d')](_0x35b43c);}})['catch'](handleError(_0x186308,null));};var utilLicense=require(_0x6892('0x5b'));exports['getLogoLogin']=function(_0x423040,_0x1d01f6,_0x1ed82c){var _0x47699f=_0x6892('0x5d');var _0x320a93={'custom':![]};return utilLicense[_0x6892('0x6e')]()[_0x6892('0x32')](function(_0x51f5c5){if(_0x51f5c5){_0x320a93=_0x51f5c5;}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x423040['params']['id']},'attributes':['logo',_0x6892('0x5a'),'preferred','favicon',_0x6892('0x61'),_0x6892('0x62'),_0x6892('0x63'),'defaultFavicon'],'raw':!![]});})[_0x6892('0x32')](handleEntityNotFound(_0x1d01f6,null))['then'](function(_0x341997){if(_0x341997){var _0x33a3f6=_0x341997[_0x6892('0x5a')]&&fs[_0x6892('0x64')](path[_0x6892('0x67')](config[_0x6892('0x65')],_0x47699f,_[_0x6892('0x66')](_0x341997[_0x6892('0x5a')])))?path[_0x6892('0x67')](config[_0x6892('0x65')],_0x47699f,_[_0x6892('0x66')](_0x341997[_0x6892('0x5a')])):path['join'](config[_0x6892('0x65')],_0x47699f,_[_0x6892('0x66')](_0x6892('0x6f')));var _0x22e458=_0x6892('0x70')+_[_0x6892('0x69')](_0x6892('0x5a'));if(_0x341997[_0x22e458]||!_0x320a93['custom']){_0x33a3f6=path['join'](config[_0x6892('0x65')],_0x47699f,_[_0x6892('0x66')](_0x6892('0x6f')));}if(!fs['existsSync'](_0x33a3f6)){throw new db[(_0x6892('0x1e'))][(_0x6892('0x6b'))](_['upperFirst'](_0x6892('0x5a'))+_0x6892('0x6c'));}return _0x1d01f6[_0x6892('0x6d')](_0x33a3f6);}})[_0x6892('0x26')](handleError(_0x1d01f6,null));};exports[_0x6892('0x71')]=function(_0x251db2,_0x44b516){return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x251db2[_0x6892('0x51')]['id']},'attributes':['securePassword']})[_0x6892('0x32')](respondWithResult(_0x44b516,null))['catch'](handleError(_0x44b516,null));};exports['addPreferred']=function(_0x36e88d,_0x1173ce,_0x264a10){if(_0x36e88d[_0x6892('0x57')]&&_0x36e88d[_0x6892('0x57')]['filename']){_0x36e88d[_0x6892('0x55')][_0x6892('0x5f')]=_0x36e88d[_0x6892('0x57')][_0x6892('0x58')];}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x36e88d['params']['id']}})['then'](handleEntityNotFound(_0x1173ce,null))['then'](saveUpdates(_0x36e88d[_0x6892('0x55')],null))[_0x6892('0x32')](respondWithResult(_0x1173ce,null))['catch'](handleError(_0x1173ce,null));};var utilLicense=require(_0x6892('0x5b'));exports[_0x6892('0x72')]=function(_0x6553fe,_0x3d93ad,_0x3f63a8){var _0x3ff65b=_0x6892('0x5d');var _0x3c6723={'custom':![]};return utilLicense[_0x6892('0x6e')]()[_0x6892('0x32')](function(_0x56ca35){if(_0x56ca35){_0x3c6723=_0x56ca35;}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x6553fe[_0x6892('0x51')]['id']},'attributes':['logo',_0x6892('0x5a'),'preferred',_0x6892('0x60'),_0x6892('0x61'),_0x6892('0x62'),_0x6892('0x63'),_0x6892('0x73')],'raw':!![]});})[_0x6892('0x32')](handleEntityNotFound(_0x3d93ad,null))[_0x6892('0x32')](function(_0x2370e4){if(_0x2370e4){var _0x3bbdae=_0x2370e4[_0x6892('0x5f')]&&fs[_0x6892('0x64')](path[_0x6892('0x67')](config[_0x6892('0x65')],_0x3ff65b,_[_0x6892('0x66')](_0x2370e4[_0x6892('0x5f')])))?path['join'](config[_0x6892('0x65')],_0x3ff65b,_[_0x6892('0x66')](_0x2370e4['preferred'])):path['join'](config[_0x6892('0x65')],_0x3ff65b,_[_0x6892('0x66')](_0x6892('0x74')));var _0x11c5a3=_0x6892('0x70')+_['upperFirst'](_0x6892('0x5f'));if(_0x2370e4[_0x11c5a3]||!_0x3c6723[_0x6892('0x6a')]||!_0x3c6723[_0x6892('0x5f')]){_0x3bbdae=path[_0x6892('0x67')](config['root'],_0x3ff65b,_[_0x6892('0x66')]('default_preferred.png'));}if(!fs[_0x6892('0x64')](_0x3bbdae)){throw new db[(_0x6892('0x1e'))][(_0x6892('0x6b'))](_['upperFirst']('preferred')+_0x6892('0x6c'));}return _0x3d93ad[_0x6892('0x6d')](_0x3bbdae);}})[_0x6892('0x26')](handleError(_0x3d93ad,null));};exports['addFavicon']=function(_0x49b020,_0x282e9b,_0x18f272){if(_0x49b020[_0x6892('0x57')]&&_0x49b020[_0x6892('0x57')][_0x6892('0x58')]){_0x49b020[_0x6892('0x55')][_0x6892('0x60')]=_0x49b020['file'][_0x6892('0x58')];}return db['Setting'][_0x6892('0x53')]({'where':{'id':_0x49b020[_0x6892('0x51')]['id']}})['then'](handleEntityNotFound(_0x282e9b,null))[_0x6892('0x32')](saveUpdates(_0x49b020[_0x6892('0x55')],null))[_0x6892('0x32')](respondWithResult(_0x282e9b,null))['catch'](handleError(_0x282e9b,null));};var utilLicense=require(_0x6892('0x5b'));exports['getFavicon']=function(_0x18452e,_0x33a251,_0x4ffaac){var _0x522eb5=_0x6892('0x5d');var _0x287a0a={'custom':![]};return utilLicense[_0x6892('0x6e')]()[_0x6892('0x32')](function(_0x1037f0){if(_0x1037f0){_0x287a0a=_0x1037f0;}return db[_0x6892('0x38')][_0x6892('0x53')]({'where':{'id':_0x18452e['params']['id']},'attributes':[_0x6892('0x5e'),_0x6892('0x5a'),_0x6892('0x5f'),_0x6892('0x60'),_0x6892('0x61'),_0x6892('0x62'),'defaultPreferred',_0x6892('0x73')],'raw':!![]});})['then'](handleEntityNotFound(_0x33a251,null))[_0x6892('0x32')](function(_0x1a3a59){if(_0x1a3a59){var _0x539f18=_0x1a3a59['favicon']&&fs[_0x6892('0x64')](path['join'](config['root'],_0x522eb5,_[_0x6892('0x66')](_0x1a3a59['favicon'])))?path['join'](config[_0x6892('0x65')],_0x522eb5,_[_0x6892('0x66')](_0x1a3a59[_0x6892('0x60')])):path[_0x6892('0x67')](config['root'],_0x522eb5,_['toLower'](_0x6892('0x75')));var _0x4727fa=_0x6892('0x70')+_[_0x6892('0x69')]('favicon');if(_0x1a3a59[_0x4727fa]||!_0x287a0a[_0x6892('0x6a')]){_0x539f18=path[_0x6892('0x67')](config[_0x6892('0x65')],_0x522eb5,_[_0x6892('0x66')](_0x6892('0x75')));}if(!fs[_0x6892('0x64')](_0x539f18)){throw new db[(_0x6892('0x1e'))][(_0x6892('0x6b'))](_['upperFirst'](_0x6892('0x60'))+_0x6892('0x6c'));}return _0x33a251[_0x6892('0x6d')](_0x539f18);}})[_0x6892('0x26')](handleError(_0x33a251,null));}; \ No newline at end of file +var _0x11af=['download','../../config/license/util','getLogoLogin','server/files/images/logos','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','\x20not\x20found'];(function(_0xdd2d2d,_0x3326cd){var _0x37953e=function(_0x2c55ff){while(--_0x2c55ff){_0xdd2d2d['push'](_0xdd2d2d['shift']());}};_0x37953e(++_0x3326cd);}(_0x11af,0x82));var _0xf11a=function(_0x132da1,_0x3119ec){_0x132da1=_0x132da1-0x0;var _0x4d5c27=_0x11af[_0x132da1];return _0x4d5c27;};'use strict';var pdf=require(_0xf11a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf11a('0x1'));var zipdir=require(_0xf11a('0x2'));var jsonpatch=require(_0xf11a('0x3'));var rp=require(_0xf11a('0x4'));var moment=require(_0xf11a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf11a('0x6'));var util=require(_0xf11a('0x7'));var path=require(_0xf11a('0x8'));var sox=require('sox');var csv=require(_0xf11a('0x9'));var ejs=require(_0xf11a('0xa'));var fs=require('fs');var _=require(_0xf11a('0xb'));var squel=require(_0xf11a('0xc'));var crypto=require(_0xf11a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf11a('0xe'));var Redis=require(_0xf11a('0xf'));var authService=require(_0xf11a('0x10'));var qs=require(_0xf11a('0x11'));var as=require(_0xf11a('0x12'));var hardwareService=require(_0xf11a('0x13'));var logger=require('../../config/logger')(_0xf11a('0x14'));var utils=require(_0xf11a('0x15'));var config=require(_0xf11a('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf11a('0x17'));var client=jayson[_0xf11a('0x18')][_0xf11a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4644e8,_0x413778,_0x336292){if(_0x336292){var _0x29229f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29229f[_0xf11a('0x1a')](_0x413778)){return _0x4644e8;}else{throw new db[(_0xf11a('0x1b'))][(_0xf11a('0x1c'))](_0xf11a('0x1d'));}}else{return _0x4644e8;}}function respondWithRpcPromise(_0xccf9cf,_0x3b1554,_0x16a7d7,_0x1a11e7){return new BPromise(function(_0x460c46,_0x2537d3){var _0x1e0f91=_0x1a11e7||client;return _0x1e0f91['request'](_0xccf9cf,_0x16a7d7)[_0xf11a('0x1e')](function(_0x236ab4){logger['info'](_0xf11a('0x1f'),_0x3b1554,_0xf11a('0x20'));logger[_0xf11a('0x21')](_0xf11a('0x22'),_0x3b1554,_0xf11a('0x20'),JSON['stringify'](_0x236ab4));if(_0x236ab4['error']){if(_0x236ab4['error']['code']===0x1f4){logger['error'](_0xf11a('0x1f'),_0x3b1554,_0x236ab4[_0xf11a('0x23')][_0xf11a('0x24')]);return _0x2537d3(_0x236ab4[_0xf11a('0x23')][_0xf11a('0x24')]);}logger['error'](_0xf11a('0x1f'),_0x3b1554,_0x236ab4[_0xf11a('0x23')][_0xf11a('0x24')]);return _0x460c46(_0x236ab4[_0xf11a('0x23')][_0xf11a('0x24')]);}else{logger[_0xf11a('0x25')]('Setting,\x20%s,\x20%s',_0x3b1554,_0xf11a('0x20'));_0x460c46(_0x236ab4[_0xf11a('0x26')][_0xf11a('0x24')]);}})[_0xf11a('0x27')](function(_0x2251a6){logger['error']('Setting,\x20%s,\x20%s',_0x3b1554,_0x2251a6);_0x2537d3(_0x2251a6);});});}function respondWithStatusCode(_0x4dd82a,_0x57947b){_0x57947b=_0x57947b||0xcc;return function(_0x52c7e5){if(_0x52c7e5){return _0x4dd82a['sendStatus'](_0x57947b);}return _0x4dd82a[_0xf11a('0x28')](_0x57947b)[_0xf11a('0x29')]();};}function respondWithResult(_0x2791a1,_0x3e81b3){_0x3e81b3=_0x3e81b3||0xc8;return function(_0x41609f){if(_0x41609f){return _0x2791a1[_0xf11a('0x28')](_0x3e81b3)[_0xf11a('0x2a')](_0x41609f);}};}function respondWithFilteredResult(_0x289b68,_0x3de340){return function(_0x4ae7e6){if(_0x4ae7e6){var _0x448556=_0x4ae7e6[_0xf11a('0x2b')],_0x3e5454=_0x3de340[_0xf11a('0x2c')],_0x367d26=_0x3de340['offset']+_0x3de340[_0xf11a('0x2d')],_0x1a0e40;if(_0x367d26>=_0x448556){_0x367d26=_0x448556;_0x1a0e40=0xc8;}else{_0x1a0e40=0xce;}_0x289b68[_0xf11a('0x28')](_0x1a0e40);return _0x289b68['set'](_0xf11a('0x2e'),_0x3e5454+'-'+_0x367d26+'/'+_0x448556)[_0xf11a('0x2a')](_0x4ae7e6);}return null;};}function patchUpdates(_0x266167){return function(_0x206f71){try{jsonpatch[_0xf11a('0x2f')](_0x206f71,_0x266167,!![]);}catch(_0x54b640){return BPromise[_0xf11a('0x30')](_0x54b640);}return _0x206f71[_0xf11a('0x31')]();};}function saveUpdates(_0x23b804,_0x3fdc8c){return function(_0x157648){if(_0x157648){return _0x157648[_0xf11a('0x32')](_0x23b804)[_0xf11a('0x1e')](function(_0x2a1129){return _0x2a1129;});}return null;};}function removeEntity(_0x3dffbf,_0xe2a050){return function(_0x525ba9){if(_0x525ba9){return _0x525ba9['destroy']()[_0xf11a('0x1e')](function(){_0x3dffbf[_0xf11a('0x28')](0xcc)[_0xf11a('0x29')]();});}};}function handleEntityNotFound(_0x2f865c,_0x234446){return function(_0x1e4a36){if(!_0x1e4a36){_0x2f865c[_0xf11a('0x33')](0x194);}return _0x1e4a36;};}function handleError(_0x474c5e,_0x5b077c){_0x5b077c=_0x5b077c||0x1f4;return function(_0x50e448){logger['error'](_0x50e448[_0xf11a('0x34')]);if(_0x50e448[_0xf11a('0x35')]){delete _0x50e448[_0xf11a('0x35')];}_0x474c5e['status'](_0x5b077c)['send'](_0x50e448);};}exports['index']=function(_0x316a7a,_0x56bc35){var _0x6aab5b={},_0x4fa0b4={},_0x8c15e5={'count':0x0,'rows':[]};var _0x3e4478=_[_0xf11a('0x36')](db[_0xf11a('0x37')][_0xf11a('0x38')],function(_0x2447bd){return{'name':_0x2447bd[_0xf11a('0x39')],'type':_0x2447bd[_0xf11a('0x3a')][_0xf11a('0x3b')]};});_0x4fa0b4[_0xf11a('0x3c')]=_[_0xf11a('0x36')](_0x3e4478,_0xf11a('0x35'));_0x4fa0b4[_0xf11a('0x3d')]=_['keys'](_0x316a7a[_0xf11a('0x3d')]);_0x4fa0b4[_0xf11a('0x3e')]=_[_0xf11a('0x3f')](_0x4fa0b4[_0xf11a('0x3c')],_0x4fa0b4['query']);_0x6aab5b[_0xf11a('0x40')]=_['intersection'](_0x4fa0b4['model'],qs['fields'](_0x316a7a[_0xf11a('0x3d')][_0xf11a('0x41')]));_0x6aab5b['attributes']=_0x6aab5b[_0xf11a('0x40')][_0xf11a('0x42')]?_0x6aab5b['attributes']:_0x4fa0b4[_0xf11a('0x3c')];if(!_0x316a7a['query']['hasOwnProperty'](_0xf11a('0x43'))){_0x6aab5b[_0xf11a('0x2d')]=qs[_0xf11a('0x2d')](_0x316a7a[_0xf11a('0x3d')]['limit']);_0x6aab5b[_0xf11a('0x2c')]=qs[_0xf11a('0x2c')](_0x316a7a[_0xf11a('0x3d')][_0xf11a('0x2c')]);}_0x6aab5b['order']=qs[_0xf11a('0x44')](_0x316a7a['query'][_0xf11a('0x44')]);_0x6aab5b[_0xf11a('0x45')]=qs[_0xf11a('0x3e')](_[_0xf11a('0x46')](_0x316a7a['query'],_0x4fa0b4['filters']),_0x3e4478);if(_0x316a7a[_0xf11a('0x3d')][_0xf11a('0x47')]){_0x6aab5b['where']=_[_0xf11a('0x48')](_0x6aab5b[_0xf11a('0x45')],{'$or':_['map'](_0x3e4478,function(_0x531217){if(_0x531217[_0xf11a('0x3a')]!==_0xf11a('0x49')){var _0xd80023={};_0xd80023[_0x531217[_0xf11a('0x35')]]={'$like':'%'+_0x316a7a['query'][_0xf11a('0x47')]+'%'};return _0xd80023;}})});}_0x6aab5b=_[_0xf11a('0x48')]({},_0x6aab5b,_0x316a7a[_0xf11a('0x4a')]);var _0x205a4f={'where':_0x6aab5b[_0xf11a('0x45')]};return db[_0xf11a('0x37')][_0xf11a('0x2b')](_0x205a4f)['then'](function(_0x455581){_0x8c15e5[_0xf11a('0x2b')]=_0x455581;if(_0x316a7a['query'][_0xf11a('0x4b')]){_0x6aab5b[_0xf11a('0x4c')]=[{'all':!![]}];}return db[_0xf11a('0x37')][_0xf11a('0x4d')](_0x6aab5b);})[_0xf11a('0x1e')](function(_0x3a02de){_0x8c15e5[_0xf11a('0x4e')]=_0x3a02de;return _0x8c15e5;})['then'](respondWithFilteredResult(_0x56bc35,_0x6aab5b))[_0xf11a('0x27')](handleError(_0x56bc35,null));};exports['show']=function(_0x1f34f8,_0x5a4498){var _0x3171eb={'raw':![],'where':{'id':_0x1f34f8[_0xf11a('0x4f')]['id']}},_0x318d9d={};_0x318d9d[_0xf11a('0x3c')]=_['keys'](db[_0xf11a('0x37')][_0xf11a('0x38')]);_0x318d9d[_0xf11a('0x3d')]=_[_0xf11a('0x50')](_0x1f34f8[_0xf11a('0x3d')]);_0x318d9d[_0xf11a('0x3e')]=_[_0xf11a('0x3f')](_0x318d9d[_0xf11a('0x3c')],_0x318d9d[_0xf11a('0x3d')]);_0x3171eb[_0xf11a('0x40')]=_['intersection'](_0x318d9d[_0xf11a('0x3c')],qs[_0xf11a('0x41')](_0x1f34f8[_0xf11a('0x3d')][_0xf11a('0x41')]));_0x3171eb['attributes']=_0x3171eb[_0xf11a('0x40')][_0xf11a('0x42')]?_0x3171eb[_0xf11a('0x40')]:_0x318d9d[_0xf11a('0x3c')];if(_0x1f34f8[_0xf11a('0x3d')][_0xf11a('0x4b')]){_0x3171eb['include']=[{'all':!![]}];}_0x3171eb=_[_0xf11a('0x48')]({},_0x3171eb,_0x1f34f8[_0xf11a('0x4a')]);return db[_0xf11a('0x37')][_0xf11a('0x51')](_0x3171eb)[_0xf11a('0x1e')](handleEntityNotFound(_0x5a4498,null))[_0xf11a('0x1e')](respondWithResult(_0x5a4498,null))[_0xf11a('0x27')](handleError(_0x5a4498,null));};exports[_0xf11a('0x32')]=function(_0x492d00,_0x16b275){if(_0x492d00[_0xf11a('0x52')]['id']){delete _0x492d00[_0xf11a('0x52')]['id'];}return db[_0xf11a('0x37')][_0xf11a('0x51')]({'where':{'id':_0x492d00[_0xf11a('0x4f')]['id']}})[_0xf11a('0x1e')](handleEntityNotFound(_0x16b275,null))[_0xf11a('0x1e')](saveUpdates(_0x492d00[_0xf11a('0x52')],null))[_0xf11a('0x1e')](respondWithResult(_0x16b275,null))[_0xf11a('0x27')](handleError(_0x16b275,null));};exports[_0xf11a('0x53')]=function(_0x34f320,_0x39dce3,_0x1f8306){if(_0x34f320[_0xf11a('0x54')]&&_0x34f320[_0xf11a('0x54')][_0xf11a('0x55')]){_0x34f320[_0xf11a('0x52')][_0xf11a('0x56')]=_0x34f320[_0xf11a('0x54')]['filename'];}return db['Setting']['find']({'where':{'id':_0x34f320[_0xf11a('0x4f')]['id']}})[_0xf11a('0x1e')](handleEntityNotFound(_0x39dce3,null))[_0xf11a('0x1e')](saveUpdates(_0x34f320[_0xf11a('0x52')],null))[_0xf11a('0x1e')](respondWithResult(_0x39dce3,null))[_0xf11a('0x27')](handleError(_0x39dce3,null));};exports[_0xf11a('0x57')]=function(_0x3af1fe,_0x4690f8,_0x2c4a8f){if(_0x3af1fe['file']&&_0x3af1fe[_0xf11a('0x54')][_0xf11a('0x55')]){_0x3af1fe[_0xf11a('0x52')]['loginLogo']=_0x3af1fe['file'][_0xf11a('0x55')];}return db[_0xf11a('0x37')][_0xf11a('0x51')]({'where':{'id':_0x3af1fe[_0xf11a('0x4f')]['id']}})[_0xf11a('0x1e')](handleEntityNotFound(_0x4690f8,null))[_0xf11a('0x1e')](saveUpdates(_0x3af1fe[_0xf11a('0x52')],null))['then'](respondWithResult(_0x4690f8,null))[_0xf11a('0x27')](handleError(_0x4690f8,null));};var utilLicense=require('../../config/license/util');exports[_0xf11a('0x58')]=function(_0xc2995b,_0x2df2ea,_0x4f69ac){var _0x2c5f56='server/files/images/logos';var _0x25fd04={'custom':![]};return utilLicense[_0xf11a('0x59')]()['then'](function(_0x1f6054){if(_0x1f6054){_0x25fd04=_0x1f6054;}return db[_0xf11a('0x37')][_0xf11a('0x51')]({'where':{'id':_0xc2995b[_0xf11a('0x4f')]['id']},'attributes':[_0xf11a('0x56'),_0xf11a('0x5a'),_0xf11a('0x5b'),_0xf11a('0x5c'),_0xf11a('0x5d'),'defaultLoginLogo','defaultPreferred',_0xf11a('0x5e')],'raw':!![]});})[_0xf11a('0x1e')](handleEntityNotFound(_0x2df2ea,null))[_0xf11a('0x1e')](function(_0x534df7){if(_0x534df7){var _0x1c2961=_0x534df7[_0xf11a('0x56')]&&fs[_0xf11a('0x5f')](path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x2c5f56,_[_0xf11a('0x62')](_0x534df7[_0xf11a('0x56')])))?path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x2c5f56,_[_0xf11a('0x62')](_0x534df7[_0xf11a('0x56')])):path[_0xf11a('0x60')](config['root'],_0x2c5f56,_[_0xf11a('0x62')]('default_logo.svg'));var _0x16e4e3=_0xf11a('0x63')+_[_0xf11a('0x64')](_0xf11a('0x56'));if(_0x534df7[_0x16e4e3]||!_0x25fd04[_0xf11a('0x65')]){_0x1c2961=path['join'](config[_0xf11a('0x61')],_0x2c5f56,_[_0xf11a('0x62')](_0xf11a('0x66')));}if(!fs[_0xf11a('0x5f')](_0x1c2961)){throw new db[(_0xf11a('0x1b'))][(_0xf11a('0x1c'))](_[_0xf11a('0x64')]('logo')+_0xf11a('0x67'));}return _0x2df2ea[_0xf11a('0x68')](_0x1c2961);}})[_0xf11a('0x27')](handleError(_0x2df2ea,null));};var utilLicense=require(_0xf11a('0x69'));exports[_0xf11a('0x6a')]=function(_0x5e3def,_0x29eb62,_0x1bfa2e){var _0x463c39=_0xf11a('0x6b');var _0x24cce5={'custom':![]};return utilLicense[_0xf11a('0x59')]()[_0xf11a('0x1e')](function(_0x5c1a1e){if(_0x5c1a1e){_0x24cce5=_0x5c1a1e;}return db[_0xf11a('0x37')][_0xf11a('0x51')]({'where':{'id':_0x5e3def[_0xf11a('0x4f')]['id']},'attributes':['logo','loginLogo',_0xf11a('0x5b'),'favicon','defaultLogo',_0xf11a('0x6c'),_0xf11a('0x6d'),_0xf11a('0x5e')],'raw':!![]});})[_0xf11a('0x1e')](handleEntityNotFound(_0x29eb62,null))['then'](function(_0x441fc8){if(_0x441fc8){var _0x7ecd64=_0x441fc8[_0xf11a('0x5a')]&&fs['existsSync'](path['join'](config[_0xf11a('0x61')],_0x463c39,_[_0xf11a('0x62')](_0x441fc8[_0xf11a('0x5a')])))?path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x463c39,_[_0xf11a('0x62')](_0x441fc8[_0xf11a('0x5a')])):path[_0xf11a('0x60')](config['root'],_0x463c39,_[_0xf11a('0x62')](_0xf11a('0x6e')));var _0x464142=_0xf11a('0x63')+_[_0xf11a('0x64')](_0xf11a('0x5a'));if(_0x441fc8[_0x464142]||!_0x24cce5[_0xf11a('0x65')]){_0x7ecd64=path['join'](config[_0xf11a('0x61')],_0x463c39,_[_0xf11a('0x62')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x7ecd64)){throw new db['Sequelize'][(_0xf11a('0x1c'))](_[_0xf11a('0x64')](_0xf11a('0x5a'))+'\x20not\x20found');}return _0x29eb62[_0xf11a('0x68')](_0x7ecd64);}})['catch'](handleError(_0x29eb62,null));};exports['gdpr']=function(_0x494915,_0x457e10){return db[_0xf11a('0x37')][_0xf11a('0x51')]({'where':{'id':_0x494915[_0xf11a('0x4f')]['id']},'attributes':[_0xf11a('0x6f')]})['then'](respondWithResult(_0x457e10,null))['catch'](handleError(_0x457e10,null));};exports[_0xf11a('0x70')]=function(_0x128bb,_0x132143,_0x4bf2a3){if(_0x128bb[_0xf11a('0x54')]&&_0x128bb[_0xf11a('0x54')][_0xf11a('0x55')]){_0x128bb['body']['preferred']=_0x128bb['file'][_0xf11a('0x55')];}return db[_0xf11a('0x37')]['find']({'where':{'id':_0x128bb[_0xf11a('0x4f')]['id']}})[_0xf11a('0x1e')](handleEntityNotFound(_0x132143,null))[_0xf11a('0x1e')](saveUpdates(_0x128bb['body'],null))['then'](respondWithResult(_0x132143,null))[_0xf11a('0x27')](handleError(_0x132143,null));};var utilLicense=require(_0xf11a('0x69'));exports[_0xf11a('0x71')]=function(_0x2da230,_0x268771,_0x39e7d0){var _0x1bb375=_0xf11a('0x6b');var _0x518841={'custom':![]};return utilLicense['getLicense']()[_0xf11a('0x1e')](function(_0x3d1d40){if(_0x3d1d40){_0x518841=_0x3d1d40;}return db[_0xf11a('0x37')][_0xf11a('0x51')]({'where':{'id':_0x2da230[_0xf11a('0x4f')]['id']},'attributes':['logo',_0xf11a('0x5a'),_0xf11a('0x5b'),_0xf11a('0x5c'),_0xf11a('0x5d'),_0xf11a('0x6c'),'defaultPreferred',_0xf11a('0x5e')],'raw':!![]});})[_0xf11a('0x1e')](handleEntityNotFound(_0x268771,null))['then'](function(_0x4ed068){if(_0x4ed068){var _0x615e95=_0x4ed068[_0xf11a('0x5b')]&&fs['existsSync'](path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x1bb375,_[_0xf11a('0x62')](_0x4ed068[_0xf11a('0x5b')])))?path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x1bb375,_[_0xf11a('0x62')](_0x4ed068[_0xf11a('0x5b')])):path['join'](config[_0xf11a('0x61')],_0x1bb375,_['toLower'](_0xf11a('0x72')));var _0x5c52f5=_0xf11a('0x63')+_[_0xf11a('0x64')](_0xf11a('0x5b'));if(_0x4ed068[_0x5c52f5]||!_0x518841[_0xf11a('0x65')]||!_0x518841[_0xf11a('0x5b')]){_0x615e95=path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x1bb375,_[_0xf11a('0x62')](_0xf11a('0x72')));}if(!fs[_0xf11a('0x5f')](_0x615e95)){throw new db[(_0xf11a('0x1b'))][(_0xf11a('0x1c'))](_[_0xf11a('0x64')](_0xf11a('0x5b'))+_0xf11a('0x67'));}return _0x268771[_0xf11a('0x68')](_0x615e95);}})['catch'](handleError(_0x268771,null));};exports[_0xf11a('0x73')]=function(_0x472438,_0x3fb78a,_0x51845d){if(_0x472438[_0xf11a('0x54')]&&_0x472438[_0xf11a('0x54')][_0xf11a('0x55')]){_0x472438['body'][_0xf11a('0x5c')]=_0x472438[_0xf11a('0x54')][_0xf11a('0x55')];}return db[_0xf11a('0x37')]['find']({'where':{'id':_0x472438[_0xf11a('0x4f')]['id']}})[_0xf11a('0x1e')](handleEntityNotFound(_0x3fb78a,null))['then'](saveUpdates(_0x472438[_0xf11a('0x52')],null))[_0xf11a('0x1e')](respondWithResult(_0x3fb78a,null))[_0xf11a('0x27')](handleError(_0x3fb78a,null));};var utilLicense=require(_0xf11a('0x69'));exports['getFavicon']=function(_0x13be32,_0x3874bc,_0x2b6a9c){var _0x204e5c=_0xf11a('0x6b');var _0x4c7639={'custom':![]};return utilLicense[_0xf11a('0x59')]()[_0xf11a('0x1e')](function(_0x22fbfd){if(_0x22fbfd){_0x4c7639=_0x22fbfd;}return db[_0xf11a('0x37')][_0xf11a('0x51')]({'where':{'id':_0x13be32[_0xf11a('0x4f')]['id']},'attributes':[_0xf11a('0x56'),_0xf11a('0x5a'),_0xf11a('0x5b'),_0xf11a('0x5c'),_0xf11a('0x5d'),_0xf11a('0x6c'),_0xf11a('0x6d'),'defaultFavicon'],'raw':!![]});})[_0xf11a('0x1e')](handleEntityNotFound(_0x3874bc,null))[_0xf11a('0x1e')](function(_0x5af029){if(_0x5af029){var _0x469e33=_0x5af029['favicon']&&fs[_0xf11a('0x5f')](path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x204e5c,_[_0xf11a('0x62')](_0x5af029['favicon'])))?path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x204e5c,_['toLower'](_0x5af029[_0xf11a('0x5c')])):path[_0xf11a('0x60')](config[_0xf11a('0x61')],_0x204e5c,_[_0xf11a('0x62')](_0xf11a('0x74')));var _0x11ccfd='default'+_[_0xf11a('0x64')](_0xf11a('0x5c'));if(_0x5af029[_0x11ccfd]||!_0x4c7639[_0xf11a('0x65')]){_0x469e33=path['join'](config['root'],_0x204e5c,_[_0xf11a('0x62')]('default_favicon.ico'));}if(!fs[_0xf11a('0x5f')](_0x469e33)){throw new db['Sequelize']['ValidationError'](_[_0xf11a('0x64')](_0xf11a('0x5c'))+'\x20not\x20found');}return _0x3874bc[_0xf11a('0x68')](_0x469e33);}})[_0xf11a('0x27')](handleError(_0x3874bc,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f25560d..843291f 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 _0xcd24=['../../config/environment','define','Setting','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xc9c8ca,_0xbc7ae3){var _0x59fc76=function(_0x2b7f3f){while(--_0x2b7f3f){_0xc9c8ca['push'](_0xc9c8ca['shift']());}};_0x59fc76(++_0xbc7ae3);}(_0xcd24,0x193));var _0x4cd2=function(_0x25ab76,_0x596eae){_0x25ab76=_0x25ab76-0x0;var _0x235145=_0xcd24[_0x25ab76];return _0x235145;};'use strict';var _=require(_0x4cd2('0x0'));var util=require('util');var logger=require(_0x4cd2('0x1'))('api');var moment=require(_0x4cd2('0x2'));var BPromise=require(_0x4cd2('0x3'));var rp=require(_0x4cd2('0x4'));var fs=require('fs');var path=require(_0x4cd2('0x5'));var rimraf=require(_0x4cd2('0x6'));var config=require(_0x4cd2('0x7'));var attributes=require('./setting.attributes');module['exports']=function(_0x4a42df,_0x321c17){return _0x4a42df[_0x4cd2('0x8')](_0x4cd2('0x9'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x157e=['define','settings','lodash','util','../../config/logger','api','path','rimraf','./setting.attributes','exports'];(function(_0x2800c5,_0x57752f){var _0x505906=function(_0x5a503c){while(--_0x5a503c){_0x2800c5['push'](_0x2800c5['shift']());}};_0x505906(++_0x57752f);}(_0x157e,0x17e));var _0xe157=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x157e[_0x1acc2d];return _0xabfa6d;};'use strict';var _=require(_0xe157('0x0'));var util=require(_0xe157('0x1'));var logger=require(_0xe157('0x2'))(_0xe157('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe157('0x4'));var rimraf=require(_0xe157('0x5'));var config=require('../../config/environment');var attributes=require(_0xe157('0x6'));module[_0xe157('0x7')]=function(_0x189b22,_0x440914){return _0x189b22[_0xe157('0x8')]('Setting',attributes,{'tableName':_0xe157('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5e009f6..138ee0e 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 _0xd464=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x528a0c,_0x2bb697){var _0x565c7b=function(_0x50ea65){while(--_0x50ea65){_0x528a0c['push'](_0x528a0c['shift']());}};_0x565c7b(++_0x2bb697);}(_0xd464,0x97));var _0x4d46=function(_0x461547,_0x13632e){_0x461547=_0x461547-0x0;var _0x29eed2=_0xd464[_0x461547];return _0x29eed2;};'use strict';var _=require(_0x4d46('0x0'));var util=require(_0x4d46('0x1'));var moment=require('moment');var BPromise=require(_0x4d46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d46('0x3'));var db=require(_0x4d46('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d46('0x5'))(_0x4d46('0x6'));var config=require(_0x4d46('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d46('0x8')][_0x4d46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30b30b,_0x20c528,_0x1c1158){return new BPromise(function(_0x550594,_0xf35d17){return client[_0x4d46('0xa')](_0x30b30b,_0x1c1158)[_0x4d46('0xb')](function(_0x5f473f){logger[_0x4d46('0xc')](_0x4d46('0xd'),_0x20c528,_0x4d46('0xe'));logger[_0x4d46('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x20c528,_0x4d46('0xe'),JSON[_0x4d46('0x10')](_0x5f473f));if(_0x5f473f['error']){if(_0x5f473f[_0x4d46('0x11')][_0x4d46('0x12')]===0x1f4){logger['error'](_0x4d46('0xd'),_0x20c528,_0x5f473f[_0x4d46('0x11')][_0x4d46('0x13')]);return _0xf35d17(_0x5f473f[_0x4d46('0x11')]['message']);}logger['error'](_0x4d46('0xd'),_0x20c528,_0x5f473f[_0x4d46('0x11')][_0x4d46('0x13')]);return _0x550594(_0x5f473f['error'][_0x4d46('0x13')]);}else{logger[_0x4d46('0xc')](_0x4d46('0xd'),_0x20c528,_0x4d46('0xe'));_0x550594(_0x5f473f['result'][_0x4d46('0x13')]);}})['catch'](function(_0xe32fc6){logger[_0x4d46('0x11')](_0x4d46('0xd'),_0x20c528,_0xe32fc6);_0xf35d17(_0xe32fc6);});});} \ No newline at end of file +var _0x4763=['catch','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x406699,_0x1201fe){var _0x3d066e=function(_0x281ec6){while(--_0x281ec6){_0x406699['push'](_0x406699['shift']());}};_0x3d066e(++_0x1201fe);}(_0x4763,0x18d));var _0x3476=function(_0x1ba62e,_0xe7764){_0x1ba62e=_0x1ba62e-0x0;var _0x496db0=_0x4763[_0x1ba62e];return _0x496db0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3476('0x0'));var BPromise=require(_0x3476('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3476('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3476('0x3'))(_0x3476('0x4'));var config=require(_0x3476('0x5'));var jayson=require(_0x3476('0x6'));var client=jayson['client'][_0x3476('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x214d87,_0x3fbedc,_0x3b43b0){return new BPromise(function(_0x54cc91,_0x1fcc78){return client[_0x3476('0x8')](_0x214d87,_0x3b43b0)[_0x3476('0x9')](function(_0x4041e4){logger[_0x3476('0xa')](_0x3476('0xb'),_0x3fbedc,_0x3476('0xc'));logger['debug'](_0x3476('0xd'),_0x3fbedc,_0x3476('0xc'),JSON['stringify'](_0x4041e4));if(_0x4041e4[_0x3476('0xe')]){if(_0x4041e4[_0x3476('0xe')]['code']===0x1f4){logger[_0x3476('0xe')](_0x3476('0xb'),_0x3fbedc,_0x4041e4[_0x3476('0xe')][_0x3476('0xf')]);return _0x1fcc78(_0x4041e4[_0x3476('0xe')]['message']);}logger[_0x3476('0xe')](_0x3476('0xb'),_0x3fbedc,_0x4041e4['error'][_0x3476('0xf')]);return _0x54cc91(_0x4041e4[_0x3476('0xe')][_0x3476('0xf')]);}else{logger[_0x3476('0xa')](_0x3476('0xb'),_0x3fbedc,_0x3476('0xc'));_0x54cc91(_0x4041e4[_0x3476('0x10')][_0x3476('0xf')]);}})[_0x3476('0x11')](function(_0x977e49){logger[_0x3476('0xe')](_0x3476('0xb'),_0x3fbedc,_0x977e49);_0x1fcc78(_0x977e49);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3e23145..c838bda 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 _0x5aad=['destroy','removeAgents','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/canned_answers','addAnswer','/:id/notify','addApplications','/:id/send','status','/:id/users','addAgents','put','/:id','update','delete'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5aad,0x71));var _0xd5aa=function(_0x37c1ac,_0x17138d){_0x37c1ac=_0x37c1ac-0x0;var _0x59bc50=_0x5aad[_0x37c1ac];return _0x59bc50;};'use strict';var multer=require(_0xd5aa('0x0'));var util=require(_0xd5aa('0x1'));var path=require('path');var timeout=require(_0xd5aa('0x2'));var express=require(_0xd5aa('0x3'));var router=express['Router']();var auth=require(_0xd5aa('0x4'));var interaction=require(_0xd5aa('0x5'));var config=require('../../config/environment');var controller=require(_0xd5aa('0x6'));router[_0xd5aa('0x7')]('/',auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x9')]);router[_0xd5aa('0x7')](_0xd5aa('0xa'),auth[_0xd5aa('0x8')](),controller['describe']);router[_0xd5aa('0x7')]('/:id',auth[_0xd5aa('0x8')](),controller[_0xd5aa('0xb')]);router[_0xd5aa('0x7')](_0xd5aa('0xc'),auth[_0xd5aa('0x8')](),controller[_0xd5aa('0xd')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd5aa('0xe')]);router[_0xd5aa('0x7')](_0xd5aa('0xf'),auth['isAuthenticated'](),controller[_0xd5aa('0x10')]);router[_0xd5aa('0x7')](_0xd5aa('0x11'),auth['isAuthenticated'](),controller[_0xd5aa('0x12')]);router[_0xd5aa('0x7')](_0xd5aa('0x13'),controller[_0xd5aa('0x14')]);router[_0xd5aa('0x7')]('/:id/users',auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x15')]);router[_0xd5aa('0x16')]('/',auth[_0xd5aa('0x8')](),controller['create']);router['post'](_0xd5aa('0xc'),auth[_0xd5aa('0x8')](),controller['addDisposition']);router['post'](_0xd5aa('0x17'),auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x18')]);router['post'](_0xd5aa('0x19'),controller['notify']);router[_0xd5aa('0x16')](_0xd5aa('0xf'),auth['isAuthenticated'](),controller[_0xd5aa('0x1a')]);router[_0xd5aa('0x16')](_0xd5aa('0x1b'),auth[_0xd5aa('0x8')](),controller['send']);router[_0xd5aa('0x16')](_0xd5aa('0x13'),controller[_0xd5aa('0x1c')]);router[_0xd5aa('0x16')](_0xd5aa('0x1d'),auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x1e')]);router[_0xd5aa('0x1f')](_0xd5aa('0x20'),auth[_0xd5aa('0x8')](),controller[_0xd5aa('0x21')]);router[_0xd5aa('0x22')](_0xd5aa('0x20'),auth['isAuthenticated'](),controller[_0xd5aa('0x23')]);router[_0xd5aa('0x22')](_0xd5aa('0xc'),auth[_0xd5aa('0x8')](),controller['removeDispositions']);router[_0xd5aa('0x22')](_0xd5aa('0x17'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0xd5aa('0x1d'),auth['isAuthenticated'](),controller[_0xd5aa('0x24')]);module['exports']=router; \ No newline at end of file +var _0xd845=['/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','getInteractions','statusGet','getAgents','post','create','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','/:id/status','/:id/users','addAgents','put','delete','/:id','destroy','removeDispositions','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','show'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xd845,0x1e1));var _0x5d84=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xd845[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x5d84('0x0'));var util=require(_0x5d84('0x1'));var path=require(_0x5d84('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d84('0x3'));var router=express[_0x5d84('0x4')]();var auth=require(_0x5d84('0x5'));var interaction=require(_0x5d84('0x6'));var config=require('../../config/environment');var controller=require(_0x5d84('0x7'));router[_0x5d84('0x8')]('/',auth[_0x5d84('0x9')](),controller[_0x5d84('0xa')]);router[_0x5d84('0x8')](_0x5d84('0xb'),auth[_0x5d84('0x9')](),controller['describe']);router[_0x5d84('0x8')]('/:id',auth[_0x5d84('0x9')](),controller[_0x5d84('0xc')]);router[_0x5d84('0x8')](_0x5d84('0xd'),auth[_0x5d84('0x9')](),controller[_0x5d84('0xe')]);router[_0x5d84('0x8')](_0x5d84('0xf'),auth[_0x5d84('0x9')](),controller['getAnswers']);router[_0x5d84('0x8')]('/:id/applications',auth[_0x5d84('0x9')](),controller[_0x5d84('0x10')]);router[_0x5d84('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x5d84('0x11')]);router[_0x5d84('0x8')]('/:id/status',controller[_0x5d84('0x12')]);router[_0x5d84('0x8')]('/:id/users',auth[_0x5d84('0x9')](),controller[_0x5d84('0x13')]);router[_0x5d84('0x14')]('/',auth[_0x5d84('0x9')](),controller[_0x5d84('0x15')]);router[_0x5d84('0x14')](_0x5d84('0xd'),auth[_0x5d84('0x9')](),controller['addDisposition']);router[_0x5d84('0x14')](_0x5d84('0xf'),auth[_0x5d84('0x9')](),controller[_0x5d84('0x16')]);router[_0x5d84('0x14')](_0x5d84('0x17'),controller[_0x5d84('0x18')]);router[_0x5d84('0x14')](_0x5d84('0x19'),auth[_0x5d84('0x9')](),controller[_0x5d84('0x1a')]);router['post'](_0x5d84('0x1b'),auth[_0x5d84('0x9')](),controller[_0x5d84('0x1c')]);router[_0x5d84('0x14')](_0x5d84('0x1d'),controller['status']);router[_0x5d84('0x14')](_0x5d84('0x1e'),auth[_0x5d84('0x9')](),controller[_0x5d84('0x1f')]);router[_0x5d84('0x20')]('/:id',auth[_0x5d84('0x9')](),controller['update']);router[_0x5d84('0x21')](_0x5d84('0x22'),auth[_0x5d84('0x9')](),controller[_0x5d84('0x23')]);router[_0x5d84('0x21')]('/:id/dispositions',auth[_0x5d84('0x9')](),controller[_0x5d84('0x24')]);router['delete'](_0x5d84('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x5d84('0x21')](_0x5d84('0x1e'),auth['isAuthenticated'](),controller[_0x5d84('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 619cc20..384ea04 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 _0x19a2=['intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x19a2,0x126));var _0x219a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x19a2[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x219a('0x0'));var rs=require(_0x219a('0x1'));module[_0x219a('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x219a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x219a('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x219a('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x219a('0x4')]},'type':{'type':Sequelize[_0x219a('0x5')](_0x219a('0x6'),_0x219a('0x7'),_0x219a('0x8'),_0x219a('0x9'),_0x219a('0xa'),_0x219a('0xb'),_0x219a('0xc'),_0x219a('0xd'),_0x219a('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x219a('0x4')]},'authToken':{'type':Sequelize[_0x219a('0x4')]},'smsMethod':{'type':Sequelize[_0x219a('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x219a('0x4')]},'password':{'type':Sequelize[_0x219a('0x4')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x219a('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x219a('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x219a('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x219a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x219a('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x219a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x219a('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x219a('0xf')],'defaultValue':![],'comment':_0x219a('0x12'),'set':function(_0x40c5e5){if(!_0x40c5e5)this['setDataValue'](_0x219a('0x13'),null);this[_0x219a('0x14')](_0x219a('0x15'),_0x40c5e5);}}}; \ No newline at end of file +var _0xdb84=['name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x499325,_0x5988a7){var _0x1d81d5=function(_0x1f0e78){while(--_0x1f0e78){_0x499325['push'](_0x499325['shift']());}};_0x1d81d5(++_0x5988a7);}(_0xdb84,0xec));var _0x4db8=function(_0x249627,_0xe19704){_0x249627=_0x249627-0x0;var _0x17b190=_0xdb84[_0x249627];return _0x17b190;};'use strict';var Sequelize=require(_0x4db8('0x0'));var rs=require(_0x4db8('0x1'));module[_0x4db8('0x2')]={'name':{'type':Sequelize[_0x4db8('0x3')],'unique':_0x4db8('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4db8('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x4db8('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x4db8('0x3')],'defaultValue':function(){return rs[_0x4db8('0x5')]();}},'phone':{'type':Sequelize[_0x4db8('0x3')]},'type':{'type':Sequelize[_0x4db8('0x6')](_0x4db8('0x7'),_0x4db8('0x8'),_0x4db8('0x9'),_0x4db8('0xa'),_0x4db8('0xb'),_0x4db8('0xc'),_0x4db8('0xd'),_0x4db8('0xe'),_0x4db8('0xf'))},'accountSid':{'type':Sequelize[_0x4db8('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x4db8('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4db8('0x3')]},'password':{'type':Sequelize[_0x4db8('0x3')]},'apiKey':{'type':Sequelize[_0x4db8('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x4db8('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0x4db8('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4db8('0x11')],'defaultValue':function(){return _0x4db8('0x12');}},'notificationSound':{'type':Sequelize[_0x4db8('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4db8('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4db8('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4db8('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4db8('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4db8('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4db8('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4db8('0x13')],'comment':_0x4db8('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x495252){if(!_0x495252)this[_0x4db8('0x15')](_0x4db8('0x16'),null);this['setDataValue'](_0x4db8('0x17'),_0x495252);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 028321d..9972817 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(_0x7f4658,_0x53ee88){var _0x5b9264=function(_0x2d64ad){while(--_0x2d64ad){_0x7f4658['push'](_0x7f4658['shift']());}};_0x5b9264(++_0x53ee88);}(_0x7a54,0x106));var _0x47a5=function(_0x69322,_0x105c4e){_0x69322=_0x69322-0x0;var _0xcb795b=_0x7a54[_0x69322];return _0xcb795b;};'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(_0x239cac,_0x15a3b4){var _0x22befe=function(_0x5bc700){while(--_0x5bc700){_0x239cac['push'](_0x239cac['shift']());}};_0x22befe(++_0x15a3b4);}(_0x7a54,0x106));var _0x47a5=function(_0x33f307,_0x3e84d7){_0x33f307=_0x33f307-0x0;var _0x4ba2b2=_0x7a54[_0x33f307];return _0x4ba2b2;};'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 5c97ad7..822c633 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 _0xf5ef=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x2208f4,_0x2d5b22){var _0x4d0e5b=function(_0x56da93){while(--_0x56da93){_0x2208f4['push'](_0x2208f4['shift']());}};_0x4d0e5b(++_0x2d5b22);}(_0xf5ef,0xba));var _0xff5e=function(_0x40ebc3,_0x5b7f78){_0x40ebc3=_0x40ebc3-0x0;var _0x1d8b08=_0xf5ef[_0x40ebc3];return _0x1d8b08;};'use strict';var EventEmitter=require(_0xff5e('0x0'));var SmsAccount=require(_0xff5e('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xff5e('0x2')](0x0);var events={'afterCreate':_0xff5e('0x3'),'afterUpdate':'update','afterDestroy':_0xff5e('0x4')};function emitEvent(_0x1e871b){return function(_0x16851f,_0x54d6b6,_0x3d3fd6){SmsAccountEvents[_0xff5e('0x5')](_0x1e871b+':'+_0x16851f['id'],_0x16851f);SmsAccountEvents[_0xff5e('0x5')](_0x1e871b,_0x16851f);_0x3d3fd6(null);};}for(var e in events){if(events[_0xff5e('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xff5e('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x6017=['SmsAccount','setMaxListeners','save','update','remove','emit','exports'];(function(_0x45fcf7,_0x5cfb08){var _0x1b4a8e=function(_0x481e69){while(--_0x481e69){_0x45fcf7['push'](_0x45fcf7['shift']());}};_0x1b4a8e(++_0x5cfb08);}(_0x6017,0x12d));var _0x7601=function(_0x12d7b5,_0xe588d){_0x12d7b5=_0x12d7b5-0x0;var _0x27067d=_0x6017[_0x12d7b5];return _0x27067d;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x7601('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7601('0x1')](0x0);var events={'afterCreate':_0x7601('0x2'),'afterUpdate':_0x7601('0x3'),'afterDestroy':_0x7601('0x4')};function emitEvent(_0x2214cf){return function(_0x576a6f,_0x1f4b36,_0x51561f){SmsAccountEvents['emit'](_0x2214cf+':'+_0x576a6f['id'],_0x576a6f);SmsAccountEvents[_0x7601('0x5')](_0x2214cf,_0x576a6f);_0x51561f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x7601('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f287302..0b69d1c 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(_0x40458c,_0x3ff275){var _0x305216=function(_0x1ced2c){while(--_0x1ced2c){_0x40458c['push'](_0x40458c['shift']());}};_0x305216(++_0x3ff275);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x1df362,_0x1a2467){var _0x3697d1=function(_0x348c46){while(--_0x348c46){_0x1df362['push'](_0x1df362['shift']());}};_0x3697d1(++_0x1a2467);}(_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':'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 778a9a7..9fc62b4 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 _0xd20e=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','request\x20sent','debug'];(function(_0x1a077a,_0xe2bb6b){var _0x2d6e4c=function(_0x1a95db){while(--_0x1a95db){_0x1a077a['push'](_0x1a077a['shift']());}};_0x2d6e4c(++_0xe2bb6b);}(_0xd20e,0xbe));var _0xed20=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xd20e[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0xed20('0x0'));var moment=require(_0xed20('0x1'));var BPromise=require(_0xed20('0x2'));var rs=require(_0xed20('0x3'));var fs=require('fs');var Redis=require(_0xed20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed20('0x5'));var logger=require(_0xed20('0x6'))(_0xed20('0x7'));var config=require(_0xed20('0x8'));var jayson=require(_0xed20('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xed20('0xa')]=_[_0xed20('0xb')](config['redis'],{'host':_0xed20('0xc'),'port':0x18eb});var socket=require(_0xed20('0xd'))(new Redis(config[_0xed20('0xa')]));require(_0xed20('0xe'))[_0xed20('0xf')](socket);function respondWithRpcPromise(_0xc562cd,_0xfaa0f6,_0x175c6a){return new BPromise(function(_0x11eb1c,_0x157b21){return client['request'](_0xc562cd,_0x175c6a)[_0xed20('0x10')](function(_0x2e227d){logger[_0xed20('0x11')]('SmsAccount,\x20%s,\x20%s',_0xfaa0f6,_0xed20('0x12'));logger[_0xed20('0x13')](_0xed20('0x14'),_0xfaa0f6,_0xed20('0x12'),JSON[_0xed20('0x15')](_0x2e227d));if(_0x2e227d[_0xed20('0x16')]){if(_0x2e227d['error'][_0xed20('0x17')]===0x1f4){logger[_0xed20('0x16')]('SmsAccount,\x20%s,\x20%s',_0xfaa0f6,_0x2e227d[_0xed20('0x16')][_0xed20('0x18')]);return _0x157b21(_0x2e227d[_0xed20('0x16')]['message']);}logger[_0xed20('0x16')]('SmsAccount,\x20%s,\x20%s',_0xfaa0f6,_0x2e227d['error'][_0xed20('0x18')]);return _0x11eb1c(_0x2e227d[_0xed20('0x16')][_0xed20('0x18')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0xfaa0f6,_0xed20('0x12'));_0x11eb1c(_0x2e227d['result'][_0xed20('0x18')]);}})['catch'](function(_0x36428c){logger[_0xed20('0x16')](_0xed20('0x19'),_0xfaa0f6,_0x36428c);_0x157b21(_0x36428c);});});}exports[_0xed20('0x1a')]=function(_0x2fb68b){var _0x5f11a2=this;return new Promise(function(_0x5d697a,_0x178b37){return db[_0xed20('0x1b')]['find']({'raw':_0x2fb68b[_0xed20('0x1c')]?_0x2fb68b[_0xed20('0x1c')][_0xed20('0x1d')]===undefined?!![]:![]:!![],'where':_0x2fb68b[_0xed20('0x1c')]?_0x2fb68b['options'][_0xed20('0x1e')]||null:null,'attributes':_0x2fb68b['options']?_0x2fb68b['options'][_0xed20('0x1f')]||null:null,'include':_0x2fb68b[_0xed20('0x1c')]?_0x2fb68b[_0xed20('0x1c')]['include']?_[_0xed20('0x20')](_0x2fb68b['options'][_0xed20('0x21')],function(_0x17fd62){return{'model':db[_0x17fd62['model']],'as':_0x17fd62['as'],'attributes':_0x17fd62[_0xed20('0x1f')],'include':_0x17fd62['include']?_['map'](_0x17fd62[_0xed20('0x21')],function(_0x52ab53){return{'model':db[_0x52ab53['model']],'as':_0x52ab53['as'],'attributes':_0x52ab53[_0xed20('0x1f')],'include':_0x52ab53['include']?_[_0xed20('0x20')](_0x52ab53[_0xed20('0x21')],function(_0x3fa30f){return{'model':db[_0x3fa30f['model']],'as':_0x3fa30f['as'],'attributes':_0x3fa30f[_0xed20('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xed20('0x10')](function(_0x4bea82){logger[_0xed20('0x11')](_0xed20('0x1a'),_0x2fb68b);logger['debug'](_0xed20('0x1a'),_0x2fb68b,JSON[_0xed20('0x15')](_0x4bea82));_0x5d697a(_0x4bea82);})[_0xed20('0x22')](function(_0x17cebe){logger[_0xed20('0x16')]('ShowSmsAccount',_0x17cebe['message'],_0x2fb68b);_0x178b37(_0x5f11a2[_0xed20('0x16')](0x1f4,_0x17cebe['message']));});});}; \ No newline at end of file +var _0xf0c4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','ShowSmsAccount','options','raw','where','attributes','include','map','model','then','debug','catch','lodash','util','moment','bluebird'];(function(_0x49e8ce,_0x1870e5){var _0x24ed93=function(_0x31e460){while(--_0x31e460){_0x49e8ce['push'](_0x49e8ce['shift']());}};_0x24ed93(++_0x1870e5);}(_0xf0c4,0x164));var _0x4f0c=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xf0c4[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0x4f0c('0x0'));var util=require(_0x4f0c('0x1'));var moment=require(_0x4f0c('0x2'));var BPromise=require(_0x4f0c('0x3'));var rs=require(_0x4f0c('0x4'));var fs=require('fs');var Redis=require(_0x4f0c('0x5'));var db=require(_0x4f0c('0x6'))['db'];var utils=require(_0x4f0c('0x7'));var logger=require(_0x4f0c('0x8'))(_0x4f0c('0x9'));var config=require(_0x4f0c('0xa'));var jayson=require(_0x4f0c('0xb'));var client=jayson[_0x4f0c('0xc')][_0x4f0c('0xd')]({'port':0x232a});config[_0x4f0c('0xe')]=_[_0x4f0c('0xf')](config['redis'],{'host':_0x4f0c('0x10'),'port':0x18eb});var socket=require(_0x4f0c('0x11'))(new Redis(config[_0x4f0c('0xe')]));require(_0x4f0c('0x12'))[_0x4f0c('0x13')](socket);function respondWithRpcPromise(_0x4b6c38,_0x313a59,_0x31724b){return new BPromise(function(_0x2f36ba,_0x14f9e6){return client[_0x4f0c('0x14')](_0x4b6c38,_0x31724b)['then'](function(_0x12191f){logger['info']('SmsAccount,\x20%s,\x20%s',_0x313a59,_0x4f0c('0x15'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x313a59,_0x4f0c('0x15'),JSON[_0x4f0c('0x16')](_0x12191f));if(_0x12191f[_0x4f0c('0x17')]){if(_0x12191f['error'][_0x4f0c('0x18')]===0x1f4){logger['error'](_0x4f0c('0x19'),_0x313a59,_0x12191f[_0x4f0c('0x17')][_0x4f0c('0x1a')]);return _0x14f9e6(_0x12191f[_0x4f0c('0x17')][_0x4f0c('0x1a')]);}logger[_0x4f0c('0x17')]('SmsAccount,\x20%s,\x20%s',_0x313a59,_0x12191f[_0x4f0c('0x17')][_0x4f0c('0x1a')]);return _0x2f36ba(_0x12191f[_0x4f0c('0x17')]['message']);}else{logger[_0x4f0c('0x1b')](_0x4f0c('0x19'),_0x313a59,_0x4f0c('0x15'));_0x2f36ba(_0x12191f[_0x4f0c('0x1c')][_0x4f0c('0x1a')]);}})['catch'](function(_0x5355fd){logger[_0x4f0c('0x17')](_0x4f0c('0x19'),_0x313a59,_0x5355fd);_0x14f9e6(_0x5355fd);});});}exports[_0x4f0c('0x1d')]=function(_0x579e2d){var _0x4be262=this;return new Promise(function(_0xfdd236,_0x441632){return db['SmsAccount']['find']({'raw':_0x579e2d[_0x4f0c('0x1e')]?_0x579e2d[_0x4f0c('0x1e')][_0x4f0c('0x1f')]===undefined?!![]:![]:!![],'where':_0x579e2d[_0x4f0c('0x1e')]?_0x579e2d[_0x4f0c('0x1e')][_0x4f0c('0x20')]||null:null,'attributes':_0x579e2d[_0x4f0c('0x1e')]?_0x579e2d['options'][_0x4f0c('0x21')]||null:null,'include':_0x579e2d[_0x4f0c('0x1e')]?_0x579e2d[_0x4f0c('0x1e')][_0x4f0c('0x22')]?_[_0x4f0c('0x23')](_0x579e2d[_0x4f0c('0x1e')]['include'],function(_0x8417d9){return{'model':db[_0x8417d9[_0x4f0c('0x24')]],'as':_0x8417d9['as'],'attributes':_0x8417d9[_0x4f0c('0x21')],'include':_0x8417d9[_0x4f0c('0x22')]?_[_0x4f0c('0x23')](_0x8417d9[_0x4f0c('0x22')],function(_0x8c80cd){return{'model':db[_0x8c80cd[_0x4f0c('0x24')]],'as':_0x8c80cd['as'],'attributes':_0x8c80cd['attributes'],'include':_0x8c80cd[_0x4f0c('0x22')]?_['map'](_0x8c80cd[_0x4f0c('0x22')],function(_0x460d21){return{'model':db[_0x460d21[_0x4f0c('0x24')]],'as':_0x460d21['as'],'attributes':_0x460d21['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f0c('0x25')](function(_0x35d60a){logger[_0x4f0c('0x1b')]('ShowSmsAccount',_0x579e2d);logger[_0x4f0c('0x26')](_0x4f0c('0x1d'),_0x579e2d,JSON[_0x4f0c('0x16')](_0x35d60a));_0xfdd236(_0x35d60a);})[_0x4f0c('0x27')](function(_0x2a961e){logger[_0x4f0c('0x17')]('ShowSmsAccount',_0x2a961e['message'],_0x579e2d);_0x441632(_0x4be262[_0x4f0c('0x17')](0x1f4,_0x2a961e[_0x4f0c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index d3ee0f9..b57fb14 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 _0x9137=['update','register','length','smsAccount:','./smsAccount.events','save','remove'];(function(_0x16d3f8,_0x3f5dd3){var _0x49a172=function(_0x2f730d){while(--_0x2f730d){_0x16d3f8['push'](_0x16d3f8['shift']());}};_0x49a172(++_0x3f5dd3);}(_0x9137,0x7b));var _0x7913=function(_0x3b0e76,_0x239221){_0x3b0e76=_0x3b0e76-0x0;var _0x1e4af4=_0x9137[_0x3b0e76];return _0x1e4af4;};'use strict';var SmsAccountEvents=require(_0x7913('0x0'));var events=[_0x7913('0x1'),_0x7913('0x2'),_0x7913('0x3')];function createListener(_0x5eed68,_0x3580d7){return function(_0x1d4e46){_0x3580d7['emit'](_0x5eed68,_0x1d4e46);};}function removeListener(_0x443e95,_0x454252){return function(){SmsAccountEvents['removeListener'](_0x443e95,_0x454252);};}exports[_0x7913('0x4')]=function(_0x1ba461){for(var _0x37882a=0x0,_0x45e99c=events[_0x7913('0x5')];_0x37882a<_0x45e99c;_0x37882a++){var _0x37f46b=events[_0x37882a];var _0x479929=createListener(_0x7913('0x6')+_0x37f46b,_0x1ba461);SmsAccountEvents['on'](_0x37f46b,_0x479929);}}; \ No newline at end of file +var _0x5e1d=['remove','update','emit','removeListener','register','length','./smsAccount.events','save'];(function(_0x416876,_0x466503){var _0x2a0315=function(_0x33bc8a){while(--_0x33bc8a){_0x416876['push'](_0x416876['shift']());}};_0x2a0315(++_0x466503);}(_0x5e1d,0x1b6));var _0xd5e1=function(_0x25d5e9,_0x340fda){_0x25d5e9=_0x25d5e9-0x0;var _0xa351e2=_0x5e1d[_0x25d5e9];return _0xa351e2;};'use strict';var SmsAccountEvents=require(_0xd5e1('0x0'));var events=[_0xd5e1('0x1'),_0xd5e1('0x2'),_0xd5e1('0x3')];function createListener(_0x360a89,_0x7a6135){return function(_0x164b2e){_0x7a6135[_0xd5e1('0x4')](_0x360a89,_0x164b2e);};}function removeListener(_0x3c5d84,_0x249c0b){return function(){SmsAccountEvents[_0xd5e1('0x5')](_0x3c5d84,_0x249c0b);};}exports[_0xd5e1('0x6')]=function(_0xc9e6e9){for(var _0x360b64=0x0,_0x22259e=events[_0xd5e1('0x7')];_0x360b64<_0x22259e;_0x360b64++){var _0x204f43=events[_0x360b64];var _0x4d6e1b=createListener('smsAccount:'+_0x204f43,_0xc9e6e9);SmsAccountEvents['on'](_0x204f43,_0x4d6e1b);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 9fd50ae..a059bba 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 _0x23c2=['put','delete','destroy','exports','express','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x26bb15,_0x39b070){var _0x7aa58a=function(_0x25a1b6){while(--_0x25a1b6){_0x26bb15['push'](_0x26bb15['shift']());}};_0x7aa58a(++_0x39b070);}(_0x23c2,0x199));var _0x223c=function(_0x118d61,_0x2410d8){_0x118d61=_0x118d61-0x0;var _0x45c03c=_0x23c2[_0x118d61];return _0x45c03c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x223c('0x0'));var router=express[_0x223c('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x223c('0x2'));var config=require(_0x223c('0x3'));var controller=require(_0x223c('0x4'));router[_0x223c('0x5')]('/',auth[_0x223c('0x6')](),controller[_0x223c('0x7')]);router[_0x223c('0x5')](_0x223c('0x8'),auth[_0x223c('0x6')](),controller['show']);router[_0x223c('0x9')]('/',auth[_0x223c('0x6')](),controller[_0x223c('0xa')]);router[_0x223c('0xb')](_0x223c('0x8'),auth[_0x223c('0x6')](),controller['update']);router[_0x223c('0xc')](_0x223c('0x8'),auth[_0x223c('0x6')](),controller[_0x223c('0xd')]);module[_0x223c('0xe')]=router; \ No newline at end of file +var _0xb4b2=['get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated','index'];(function(_0x43dcbd,_0x4ba47){var _0x326cac=function(_0x37da95){while(--_0x37da95){_0x43dcbd['push'](_0x43dcbd['shift']());}};_0x326cac(++_0x4ba47);}(_0xb4b2,0x14a));var _0x2b4b=function(_0x511c13,_0x526f29){_0x511c13=_0x511c13-0x0;var _0x5ecb1d=_0xb4b2[_0x511c13];return _0x5ecb1d;};'use strict';var multer=require(_0x2b4b('0x0'));var util=require(_0x2b4b('0x1'));var path=require('path');var timeout=require(_0x2b4b('0x2'));var express=require('express');var router=express[_0x2b4b('0x3')]();var auth=require(_0x2b4b('0x4'));var interaction=require(_0x2b4b('0x5'));var config=require(_0x2b4b('0x6'));var controller=require(_0x2b4b('0x7'));router['get']('/',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x9')]);router[_0x2b4b('0xa')](_0x2b4b('0xb'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0xc')]);router[_0x2b4b('0xd')]('/',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0xe')]);router[_0x2b4b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2b4b('0x10')]);router[_0x2b4b('0x11')](_0x2b4b('0xb'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x12')]);module[_0x2b4b('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 0af8a94..c449401 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 _0x0715=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x479fa1,_0x3a89b8){var _0x342aca=function(_0xaa7a8c){while(--_0xaa7a8c){_0x479fa1['push'](_0x479fa1['shift']());}};_0x342aca(++_0x3a89b8);}(_0x0715,0x1f4));var _0x5071=function(_0x3fddf2,_0x110b15){_0x3fddf2=_0x3fddf2-0x0;var _0x539bf2=_0x0715[_0x3fddf2];return _0x539bf2;};'use strict';var Sequelize=require('sequelize');module[_0x5071('0x0')]={'priority':{'type':Sequelize[_0x5071('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5071('0x2')],'allowNull':![],'defaultValue':_0x5071('0x3')},'appdata':{'type':Sequelize[_0x5071('0x4')]()},'description':{'type':Sequelize[_0x5071('0x2')]},'interval':{'type':Sequelize[_0x5071('0x2')],'defaultValue':_0x5071('0x5')}}; \ No newline at end of file +var _0x84e6=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0x4ab560,_0x5e8fe2){var _0xfe1853=function(_0x154fa7){while(--_0x154fa7){_0x4ab560['push'](_0x4ab560['shift']());}};_0xfe1853(++_0x5e8fe2);}(_0x84e6,0x160));var _0x684e=function(_0x594600,_0x49f399){_0x594600=_0x594600-0x0;var _0x449c1a=_0x84e6[_0x594600];return _0x449c1a;};'use strict';var Sequelize=require('sequelize');module[_0x684e('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x684e('0x1')],'allowNull':![],'defaultValue':_0x684e('0x2')},'appdata':{'type':Sequelize[_0x684e('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x684e('0x1')],'defaultValue':_0x684e('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index aa64c91..5a310c7 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 _0xfcbb=['../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','then','end','sendStatus','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x2c515d,_0x420b13){_0x2c515d=_0x2c515d-0x0;var _0x17bd36=_0xfcbb[_0x2c515d];return _0x17bd36;};'use strict';var pdf=require(_0xbfcb('0x0'));var emlformat=require(_0xbfcb('0x1'));var rimraf=require(_0xbfcb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbfcb('0x3'));var moment=require(_0xbfcb('0x4'));var BPromise=require(_0xbfcb('0x5'));var Mustache=require(_0xbfcb('0x6'));var util=require(_0xbfcb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbfcb('0x8'));var ejs=require(_0xbfcb('0x9'));var fs=require('fs');var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var db=require(_0xbfcb('0x18'))['db'];function respondWithStatusCode(_0x583513,_0xb2f601){_0xb2f601=_0xb2f601||0xcc;return function(_0x2268da){if(_0x2268da){return _0x583513['sendStatus'](_0xb2f601);}return _0x583513[_0xbfcb('0x19')](_0xb2f601)['end']();};}function respondWithResult(_0x211a30,_0x1c52df){_0x1c52df=_0x1c52df||0xc8;return function(_0x44ad6c){if(_0x44ad6c){return _0x211a30[_0xbfcb('0x19')](_0x1c52df)[_0xbfcb('0x1a')](_0x44ad6c);}};}function respondWithFilteredResult(_0xe47707,_0x71304e){return function(_0x2d314a){if(_0x2d314a){var _0x90ed8c=_0x2d314a[_0xbfcb('0x1b')],_0x339347=_0x71304e[_0xbfcb('0x1c')],_0x2c4a85=_0x71304e[_0xbfcb('0x1c')]+_0x71304e[_0xbfcb('0x1d')],_0x3f847f;if(_0x2c4a85>=_0x90ed8c){_0x2c4a85=_0x90ed8c;_0x3f847f=0xc8;}else{_0x3f847f=0xce;}_0xe47707[_0xbfcb('0x19')](_0x3f847f);return _0xe47707[_0xbfcb('0x1e')](_0xbfcb('0x1f'),_0x339347+'-'+_0x2c4a85+'/'+_0x90ed8c)[_0xbfcb('0x1a')](_0x2d314a);}return null;};}function patchUpdates(_0xccd6ff){return function(_0x25afa3){try{jsonpatch['apply'](_0x25afa3,_0xccd6ff,!![]);}catch(_0x26451d){return BPromise[_0xbfcb('0x20')](_0x26451d);}return _0x25afa3['save']();};}function saveUpdates(_0xa3c089,_0x1a7225){return function(_0x48c3c8){if(_0x48c3c8){return _0x48c3c8['update'](_0xa3c089)[_0xbfcb('0x21')](function(_0x45f0a0){return _0x45f0a0;});}return null;};}function removeEntity(_0x2bd235,_0x45661a){return function(_0x1c5924){if(_0x1c5924){return _0x1c5924['destroy']()[_0xbfcb('0x21')](function(){_0x2bd235[_0xbfcb('0x19')](0xcc)[_0xbfcb('0x22')]();});}};}function handleEntityNotFound(_0xd4d29,_0x1651e5){return function(_0x19616c){if(!_0x19616c){_0xd4d29[_0xbfcb('0x23')](0x194);}return _0x19616c;};}function handleError(_0x14e43c,_0x11f6f7){_0x11f6f7=_0x11f6f7||0x1f4;return function(_0x13e101){logger[_0xbfcb('0x24')](_0x13e101[_0xbfcb('0x25')]);if(_0x13e101[_0xbfcb('0x26')]){delete _0x13e101[_0xbfcb('0x26')];}_0x14e43c[_0xbfcb('0x19')](_0x11f6f7)[_0xbfcb('0x27')](_0x13e101);};}exports['index']=function(_0x3465f5,_0x2881f8){var _0x4cf7ca={},_0x64a69={},_0x15197b={'count':0x0,'rows':[]};var _0x781773=_[_0xbfcb('0x28')](db[_0xbfcb('0x29')][_0xbfcb('0x2a')],function(_0x4069a7){return{'name':_0x4069a7[_0xbfcb('0x2b')],'type':_0x4069a7[_0xbfcb('0x2c')][_0xbfcb('0x2d')]};});_0x64a69['model']=_[_0xbfcb('0x28')](_0x781773,_0xbfcb('0x26'));_0x64a69[_0xbfcb('0x2e')]=_[_0xbfcb('0x2f')](_0x3465f5[_0xbfcb('0x2e')]);_0x64a69[_0xbfcb('0x30')]=_[_0xbfcb('0x31')](_0x64a69[_0xbfcb('0x32')],_0x64a69[_0xbfcb('0x2e')]);_0x4cf7ca['attributes']=_[_0xbfcb('0x31')](_0x64a69[_0xbfcb('0x32')],qs[_0xbfcb('0x33')](_0x3465f5[_0xbfcb('0x2e')]['fields']));_0x4cf7ca['attributes']=_0x4cf7ca[_0xbfcb('0x34')][_0xbfcb('0x35')]?_0x4cf7ca[_0xbfcb('0x34')]:_0x64a69[_0xbfcb('0x32')];if(!_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x36')](_0xbfcb('0x37'))){_0x4cf7ca['limit']=qs['limit'](_0x3465f5['query'][_0xbfcb('0x1d')]);_0x4cf7ca['offset']=qs[_0xbfcb('0x1c')](_0x3465f5[_0xbfcb('0x2e')]['offset']);}_0x4cf7ca['order']=qs[_0xbfcb('0x38')](_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x38')]);_0x4cf7ca[_0xbfcb('0x39')]=qs['filters'](_[_0xbfcb('0x3a')](_0x3465f5[_0xbfcb('0x2e')],_0x64a69['filters']),_0x781773);if(_0x3465f5['query'][_0xbfcb('0x3b')]){_0x4cf7ca['where']=_['merge'](_0x4cf7ca[_0xbfcb('0x39')],{'$or':_[_0xbfcb('0x28')](_0x781773,function(_0x43ec1b){if(_0x43ec1b[_0xbfcb('0x2c')]!=='VIRTUAL'){var _0x3b0a7a={};_0x3b0a7a[_0x43ec1b[_0xbfcb('0x26')]]={'$like':'%'+_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x3b')]+'%'};return _0x3b0a7a;}})});}_0x4cf7ca=_[_0xbfcb('0x3c')]({},_0x4cf7ca,_0x3465f5[_0xbfcb('0x3d')]);var _0x53111c={'where':_0x4cf7ca[_0xbfcb('0x39')]};return db['SmsApplication'][_0xbfcb('0x1b')](_0x53111c)['then'](function(_0x809fde){_0x15197b[_0xbfcb('0x1b')]=_0x809fde;if(_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x3e')]){_0x4cf7ca[_0xbfcb('0x3f')]=[{'all':!![]}];}return db[_0xbfcb('0x29')][_0xbfcb('0x40')](_0x4cf7ca);})[_0xbfcb('0x21')](function(_0x3a98e0){_0x15197b[_0xbfcb('0x41')]=_0x3a98e0;return _0x15197b;})['then'](respondWithFilteredResult(_0x2881f8,_0x4cf7ca))[_0xbfcb('0x42')](handleError(_0x2881f8,null));};exports[_0xbfcb('0x43')]=function(_0x49685f,_0x2f6f54){var _0x306ea4={'raw':!![],'where':{'id':_0x49685f[_0xbfcb('0x44')]['id']}},_0x269102={};_0x269102[_0xbfcb('0x32')]=_[_0xbfcb('0x2f')](db['SmsApplication'][_0xbfcb('0x2a')]);_0x269102[_0xbfcb('0x2e')]=_[_0xbfcb('0x2f')](_0x49685f['query']);_0x269102[_0xbfcb('0x30')]=_[_0xbfcb('0x31')](_0x269102[_0xbfcb('0x32')],_0x269102['query']);_0x306ea4[_0xbfcb('0x34')]=_[_0xbfcb('0x31')](_0x269102['model'],qs['fields'](_0x49685f[_0xbfcb('0x2e')][_0xbfcb('0x33')]));_0x306ea4['attributes']=_0x306ea4[_0xbfcb('0x34')][_0xbfcb('0x35')]?_0x306ea4['attributes']:_0x269102[_0xbfcb('0x32')];if(_0x49685f[_0xbfcb('0x2e')][_0xbfcb('0x3e')]){_0x306ea4[_0xbfcb('0x3f')]=[{'all':!![]}];}_0x306ea4=_[_0xbfcb('0x3c')]({},_0x306ea4,_0x49685f[_0xbfcb('0x3d')]);return db[_0xbfcb('0x29')][_0xbfcb('0x45')](_0x306ea4)[_0xbfcb('0x21')](handleEntityNotFound(_0x2f6f54,null))[_0xbfcb('0x21')](respondWithResult(_0x2f6f54,null))[_0xbfcb('0x42')](handleError(_0x2f6f54,null));};exports[_0xbfcb('0x46')]=function(_0x5f307b,_0x12889b){return db[_0xbfcb('0x29')][_0xbfcb('0x46')](_0x5f307b['body'],{})[_0xbfcb('0x21')](respondWithResult(_0x12889b,0xc9))['catch'](handleError(_0x12889b,null));};exports['update']=function(_0x2dcfb3,_0x20918c){if(_0x2dcfb3[_0xbfcb('0x47')]['id']){delete _0x2dcfb3['body']['id'];}return db[_0xbfcb('0x29')]['find']({'where':{'id':_0x2dcfb3['params']['id']}})[_0xbfcb('0x21')](handleEntityNotFound(_0x20918c,null))['then'](saveUpdates(_0x2dcfb3[_0xbfcb('0x47')],null))[_0xbfcb('0x21')](respondWithResult(_0x20918c,null))['catch'](handleError(_0x20918c,null));};exports[_0xbfcb('0x48')]=function(_0x5d942f,_0x8347be){return db['SmsApplication'][_0xbfcb('0x45')]({'where':{'id':_0x5d942f['params']['id']}})[_0xbfcb('0x21')](handleEntityNotFound(_0x8347be,null))[_0xbfcb('0x21')](removeEntity(_0x8347be,null))['catch'](handleError(_0x8347be,null));}; \ No newline at end of file +var _0x5423=['attributes','intersection','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','then','includeAll','catch','params','length','include','options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','reject','save','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','model','query','keys'];(function(_0x5896eb,_0x50a650){var _0x149c01=function(_0x237317){while(--_0x237317){_0x5896eb['push'](_0x5896eb['shift']());}};_0x149c01(++_0x50a650);}(_0x5423,0xe3));var _0x3542=function(_0xca02f2,_0x445a8e){_0xca02f2=_0xca02f2-0x0;var _0x1705f1=_0x5423[_0xca02f2];return _0x1705f1;};'use strict';var pdf=require(_0x3542('0x0'));var emlformat=require(_0x3542('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3542('0x2'));var jsonpatch=require(_0x3542('0x3'));var rp=require('request-promise');var moment=require(_0x3542('0x4'));var BPromise=require(_0x3542('0x5'));var Mustache=require(_0x3542('0x6'));var util=require(_0x3542('0x7'));var path=require('path');var sox=require(_0x3542('0x8'));var csv=require(_0x3542('0x9'));var ejs=require(_0x3542('0xa'));var fs=require('fs');var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x9'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var db=require(_0x3542('0x16'))['db'];function respondWithStatusCode(_0x3bb6a0,_0x1cf710){_0x1cf710=_0x1cf710||0xcc;return function(_0x43e977){if(_0x43e977){return _0x3bb6a0[_0x3542('0x17')](_0x1cf710);}return _0x3bb6a0[_0x3542('0x18')](_0x1cf710)[_0x3542('0x19')]();};}function respondWithResult(_0x14d7c3,_0x15863d){_0x15863d=_0x15863d||0xc8;return function(_0x4bac5b){if(_0x4bac5b){return _0x14d7c3[_0x3542('0x18')](_0x15863d)['json'](_0x4bac5b);}};}function respondWithFilteredResult(_0x3bfb33,_0x13fe0b){return function(_0xc33d42){if(_0xc33d42){var _0x546fbd=_0xc33d42['count'],_0x270312=_0x13fe0b[_0x3542('0x1a')],_0x177fb9=_0x13fe0b[_0x3542('0x1a')]+_0x13fe0b[_0x3542('0x1b')],_0x347ac8;if(_0x177fb9>=_0x546fbd){_0x177fb9=_0x546fbd;_0x347ac8=0xc8;}else{_0x347ac8=0xce;}_0x3bfb33[_0x3542('0x18')](_0x347ac8);return _0x3bfb33['set'](_0x3542('0x1c'),_0x270312+'-'+_0x177fb9+'/'+_0x546fbd)['json'](_0xc33d42);}return null;};}function patchUpdates(_0x2fa983){return function(_0x369e0c){try{jsonpatch['apply'](_0x369e0c,_0x2fa983,!![]);}catch(_0x1c6403){return BPromise[_0x3542('0x1d')](_0x1c6403);}return _0x369e0c[_0x3542('0x1e')]();};}function saveUpdates(_0x1302fb,_0x212950){return function(_0x4a7695){if(_0x4a7695){return _0x4a7695['update'](_0x1302fb)['then'](function(_0x17e3cf){return _0x17e3cf;});}return null;};}function removeEntity(_0x527222,_0x1d5488){return function(_0x551645){if(_0x551645){return _0x551645[_0x3542('0x1f')]()['then'](function(){_0x527222['status'](0xcc)[_0x3542('0x19')]();});}};}function handleEntityNotFound(_0xe3f983,_0x5ae097){return function(_0x5d05b2){if(!_0x5d05b2){_0xe3f983[_0x3542('0x17')](0x194);}return _0x5d05b2;};}function handleError(_0x5123f0,_0x160caa){_0x160caa=_0x160caa||0x1f4;return function(_0x367146){logger[_0x3542('0x20')](_0x367146[_0x3542('0x21')]);if(_0x367146[_0x3542('0x22')]){delete _0x367146[_0x3542('0x22')];}_0x5123f0[_0x3542('0x18')](_0x160caa)[_0x3542('0x23')](_0x367146);};}exports[_0x3542('0x24')]=function(_0x2841a1,_0xfdfe62){var _0x4462c4={},_0x220021={},_0x9d9ca4={'count':0x0,'rows':[]};var _0x1cab35=_[_0x3542('0x25')](db[_0x3542('0x26')][_0x3542('0x27')],function(_0x3bd666){return{'name':_0x3bd666['fieldName'],'type':_0x3bd666[_0x3542('0x28')][_0x3542('0x29')]};});_0x220021[_0x3542('0x2a')]=_['map'](_0x1cab35,_0x3542('0x22'));_0x220021[_0x3542('0x2b')]=_[_0x3542('0x2c')](_0x2841a1[_0x3542('0x2b')]);_0x220021['filters']=_['intersection'](_0x220021[_0x3542('0x2a')],_0x220021[_0x3542('0x2b')]);_0x4462c4[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x220021[_0x3542('0x2a')],qs[_0x3542('0x2f')](_0x2841a1[_0x3542('0x2b')]['fields']));_0x4462c4['attributes']=_0x4462c4[_0x3542('0x2d')]['length']?_0x4462c4['attributes']:_0x220021[_0x3542('0x2a')];if(!_0x2841a1['query']['hasOwnProperty'](_0x3542('0x30'))){_0x4462c4[_0x3542('0x1b')]=qs[_0x3542('0x1b')](_0x2841a1['query'][_0x3542('0x1b')]);_0x4462c4['offset']=qs[_0x3542('0x1a')](_0x2841a1[_0x3542('0x2b')]['offset']);}_0x4462c4[_0x3542('0x31')]=qs['sort'](_0x2841a1[_0x3542('0x2b')][_0x3542('0x32')]);_0x4462c4[_0x3542('0x33')]=qs['filters'](_[_0x3542('0x34')](_0x2841a1['query'],_0x220021[_0x3542('0x35')]),_0x1cab35);if(_0x2841a1[_0x3542('0x2b')][_0x3542('0x36')]){_0x4462c4[_0x3542('0x33')]=_[_0x3542('0x37')](_0x4462c4[_0x3542('0x33')],{'$or':_[_0x3542('0x25')](_0x1cab35,function(_0x1cbd5f){if(_0x1cbd5f[_0x3542('0x28')]!==_0x3542('0x38')){var _0x372fe0={};_0x372fe0[_0x1cbd5f[_0x3542('0x22')]]={'$like':'%'+_0x2841a1[_0x3542('0x2b')]['filter']+'%'};return _0x372fe0;}})});}_0x4462c4=_[_0x3542('0x37')]({},_0x4462c4,_0x2841a1['options']);var _0x5ee295={'where':_0x4462c4[_0x3542('0x33')]};return db[_0x3542('0x26')][_0x3542('0x39')](_0x5ee295)[_0x3542('0x3a')](function(_0xb83c25){_0x9d9ca4[_0x3542('0x39')]=_0xb83c25;if(_0x2841a1[_0x3542('0x2b')][_0x3542('0x3b')]){_0x4462c4['include']=[{'all':!![]}];}return db[_0x3542('0x26')]['findAll'](_0x4462c4);})[_0x3542('0x3a')](function(_0x2baa01){_0x9d9ca4['rows']=_0x2baa01;return _0x9d9ca4;})[_0x3542('0x3a')](respondWithFilteredResult(_0xfdfe62,_0x4462c4))[_0x3542('0x3c')](handleError(_0xfdfe62,null));};exports['show']=function(_0xc25e8,_0x39f5b0){var _0x5e1b29={'raw':!![],'where':{'id':_0xc25e8[_0x3542('0x3d')]['id']}},_0x2682d0={};_0x2682d0[_0x3542('0x2a')]=_[_0x3542('0x2c')](db[_0x3542('0x26')][_0x3542('0x27')]);_0x2682d0[_0x3542('0x2b')]=_['keys'](_0xc25e8['query']);_0x2682d0[_0x3542('0x35')]=_[_0x3542('0x2e')](_0x2682d0[_0x3542('0x2a')],_0x2682d0[_0x3542('0x2b')]);_0x5e1b29[_0x3542('0x2d')]=_['intersection'](_0x2682d0[_0x3542('0x2a')],qs['fields'](_0xc25e8[_0x3542('0x2b')][_0x3542('0x2f')]));_0x5e1b29[_0x3542('0x2d')]=_0x5e1b29['attributes'][_0x3542('0x3e')]?_0x5e1b29[_0x3542('0x2d')]:_0x2682d0['model'];if(_0xc25e8[_0x3542('0x2b')][_0x3542('0x3b')]){_0x5e1b29[_0x3542('0x3f')]=[{'all':!![]}];}_0x5e1b29=_[_0x3542('0x37')]({},_0x5e1b29,_0xc25e8[_0x3542('0x40')]);return db[_0x3542('0x26')][_0x3542('0x41')](_0x5e1b29)[_0x3542('0x3a')](handleEntityNotFound(_0x39f5b0,null))['then'](respondWithResult(_0x39f5b0,null))['catch'](handleError(_0x39f5b0,null));};exports['create']=function(_0x3b3719,_0x3b48a4){return db[_0x3542('0x26')][_0x3542('0x42')](_0x3b3719[_0x3542('0x43')],{})[_0x3542('0x3a')](respondWithResult(_0x3b48a4,0xc9))[_0x3542('0x3c')](handleError(_0x3b48a4,null));};exports['update']=function(_0x157683,_0x14b960){if(_0x157683[_0x3542('0x43')]['id']){delete _0x157683[_0x3542('0x43')]['id'];}return db['SmsApplication'][_0x3542('0x41')]({'where':{'id':_0x157683[_0x3542('0x3d')]['id']}})['then'](handleEntityNotFound(_0x14b960,null))['then'](saveUpdates(_0x157683[_0x3542('0x43')],null))[_0x3542('0x3a')](respondWithResult(_0x14b960,null))[_0x3542('0x3c')](handleError(_0x14b960,null));};exports[_0x3542('0x1f')]=function(_0x244f3a,_0x1a2ecf){return db[_0x3542('0x26')]['find']({'where':{'id':_0x244f3a[_0x3542('0x3d')]['id']}})[_0x3542('0x3a')](handleEntityNotFound(_0x1a2ecf,null))[_0x3542('0x3a')](removeEntity(_0x1a2ecf,null))[_0x3542('0x3c')](handleError(_0x1a2ecf,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a92a8b8..f3c5b53 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 _0x2846=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x223a3e,_0x2da798){var _0x582005=function(_0x4adba8){while(--_0x4adba8){_0x223a3e['push'](_0x223a3e['shift']());}};_0x582005(++_0x2da798);}(_0x2846,0x1a0));var _0x6284=function(_0x2f0829,_0x375d74){_0x2f0829=_0x2f0829-0x0;var _0xb45c6f=_0x2846[_0x2f0829];return _0xb45c6f;};'use strict';var _=require('lodash');var util=require(_0x6284('0x0'));var logger=require(_0x6284('0x1'))(_0x6284('0x2'));var moment=require(_0x6284('0x3'));var BPromise=require(_0x6284('0x4'));var rp=require(_0x6284('0x5'));var fs=require('fs');var path=require(_0x6284('0x6'));var rimraf=require(_0x6284('0x7'));var config=require(_0x6284('0x8'));var attributes=require(_0x6284('0x9'));module[_0x6284('0xa')]=function(_0xb63fbb,_0x5d3500){return _0xb63fbb[_0x6284('0xb')](_0x6284('0xc'),attributes,{'tableName':_0x6284('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6284('0xe'),'collate':_0x6284('0xf')});}; \ No newline at end of file +var _0xf0f8=['bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x12253a,_0x2727d4){var _0x4f88c3=function(_0x2f11bb){while(--_0x2f11bb){_0x12253a['push'](_0x12253a['shift']());}};_0x4f88c3(++_0x2727d4);}(_0xf0f8,0x87));var _0x8f0f=function(_0xcc8680,_0x2a9a62){_0xcc8680=_0xcc8680-0x0;var _0xe5136f=_0xf0f8[_0xcc8680];return _0xe5136f;};'use strict';var _=require(_0x8f0f('0x0'));var util=require(_0x8f0f('0x1'));var logger=require(_0x8f0f('0x2'))(_0x8f0f('0x3'));var moment=require(_0x8f0f('0x4'));var BPromise=require(_0x8f0f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f0f('0x6'));var rimraf=require(_0x8f0f('0x7'));var config=require(_0x8f0f('0x8'));var attributes=require(_0x8f0f('0x9'));module['exports']=function(_0x4264e5,_0x24140e){return _0x4264e5[_0x8f0f('0xa')](_0x8f0f('0xb'),attributes,{'tableName':_0x8f0f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8f0f('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f8d4be1..6af6fc6 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x38546e,_0x4a20f2){var _0x2d914a=function(_0x39490c){while(--_0x39490c){_0x38546e['push'](_0x38546e['shift']());}};_0x2d914a(++_0x4a20f2);}(_0xe14b,0x93));var _0xbe14=function(_0x3d1378,_0x509e8d){_0x3d1378=_0x3d1378-0x0;var _0x4c8ee4=_0xe14b[_0x3d1378];return _0x4c8ee4;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0xaab2=['jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3eb348,_0xecc0bf){var _0x1fccf3=function(_0x360d20){while(--_0x360d20){_0x3eb348['push'](_0x3eb348['shift']());}};_0x1fccf3(++_0xecc0bf);}(_0xaab2,0xca));var _0x2aab=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xaab2[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x2aab('0x0'));var moment=require(_0x2aab('0x1'));var BPromise=require(_0x2aab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2aab('0x3'));var db=require(_0x2aab('0x4'))['db'];var utils=require(_0x2aab('0x5'));var logger=require(_0x2aab('0x6'))(_0x2aab('0x7'));var config=require('../../config/environment');var jayson=require(_0x2aab('0x8'));var client=jayson['client'][_0x2aab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x276906,_0x4fe8a5,_0x2970cb){return new BPromise(function(_0x494216,_0xf6602a){return client[_0x2aab('0xa')](_0x276906,_0x2970cb)[_0x2aab('0xb')](function(_0x5d47ad){logger[_0x2aab('0xc')](_0x2aab('0xd'),_0x4fe8a5,'request\x20sent');logger['debug'](_0x2aab('0xe'),_0x4fe8a5,_0x2aab('0xf'),JSON['stringify'](_0x5d47ad));if(_0x5d47ad[_0x2aab('0x10')]){if(_0x5d47ad[_0x2aab('0x10')][_0x2aab('0x11')]===0x1f4){logger['error'](_0x2aab('0xd'),_0x4fe8a5,_0x5d47ad[_0x2aab('0x10')][_0x2aab('0x12')]);return _0xf6602a(_0x5d47ad[_0x2aab('0x10')][_0x2aab('0x12')]);}logger[_0x2aab('0x10')]('SmsApplication,\x20%s,\x20%s',_0x4fe8a5,_0x5d47ad['error'][_0x2aab('0x12')]);return _0x494216(_0x5d47ad['error']['message']);}else{logger[_0x2aab('0xc')](_0x2aab('0xd'),_0x4fe8a5,_0x2aab('0xf'));_0x494216(_0x5d47ad[_0x2aab('0x13')][_0x2aab('0x12')]);}})[_0x2aab('0x14')](function(_0x543ca0){logger[_0x2aab('0x10')]('SmsApplication,\x20%s,\x20%s',_0x4fe8a5,_0x543ca0);_0xf6602a(_0x543ca0);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index fd51bc4..6934654 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 _0xb199=['sms','smsinteraction:addtags','addTags','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','tracked'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb199,0xdc));var _0x9b19=function(_0x536712,_0x71206a){_0x536712=_0x536712-0x0;var _0x2cbf65=_0xb199[_0x536712];return _0x2cbf65;};'use strict';var multer=require('multer');var util=require(_0x9b19('0x0'));var path=require(_0x9b19('0x1'));var timeout=require(_0x9b19('0x2'));var express=require(_0x9b19('0x3'));var router=express['Router']();var auth=require(_0x9b19('0x4'));var interaction=require(_0x9b19('0x5'));var config=require(_0x9b19('0x6'));var controller=require(_0x9b19('0x7'));router[_0x9b19('0x8')]('/',auth[_0x9b19('0x9')](),controller[_0x9b19('0xa')]);router['get'](_0x9b19('0xb'),auth[_0x9b19('0x9')](),controller[_0x9b19('0xc')]);router[_0x9b19('0x8')](_0x9b19('0xd'),auth[_0x9b19('0x9')](),controller[_0x9b19('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x9b19('0xf')]);router['get']('/:id/download',auth[_0x9b19('0x9')](),controller[_0x9b19('0x10')]);router[_0x9b19('0x11')]('/',auth[_0x9b19('0x9')](),controller['create']);router[_0x9b19('0x11')](_0x9b19('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x9b19('0x11')]('/:id/tags',auth[_0x9b19('0x9')](),interaction[_0x9b19('0x13')](_0x9b19('0x14'),_0x9b19('0x15')),controller[_0x9b19('0x16')]);router['put']('/:id',auth[_0x9b19('0x9')](),interaction[_0x9b19('0x13')]('sms','smsinteraction:update'),controller[_0x9b19('0x17')]);router['delete'](_0x9b19('0xd'),auth['isAuthenticated'](),interaction[_0x9b19('0x13')](_0x9b19('0x14'),_0x9b19('0x18')),controller[_0x9b19('0x19')]);router[_0x9b19('0x1a')](_0x9b19('0x1b'),auth[_0x9b19('0x9')](),controller[_0x9b19('0x1c')]);module[_0x9b19('0x1d')]=router; \ No newline at end of file +var _0x1184=['smsinteraction:update','delete','destroy','removeTags','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','getMessages','download','/:id/messages','post','/:id/tags','sms','smsinteraction:addtags','addTags','/:id','tracked'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1184,0xa0));var _0x4118=function(_0x5e658f,_0x5e3925){_0x5e658f=_0x5e658f-0x0;var _0x1bf1c7=_0x1184[_0x5e658f];return _0x1bf1c7;};'use strict';var multer=require(_0x4118('0x0'));var util=require('util');var path=require(_0x4118('0x1'));var timeout=require(_0x4118('0x2'));var express=require('express');var router=express[_0x4118('0x3')]();var auth=require(_0x4118('0x4'));var interaction=require(_0x4118('0x5'));var config=require(_0x4118('0x6'));var controller=require('./smsInteraction.controller');router[_0x4118('0x7')]('/',auth[_0x4118('0x8')](),controller[_0x4118('0x9')]);router[_0x4118('0x7')]('/describe',auth[_0x4118('0x8')](),controller[_0x4118('0xa')]);router[_0x4118('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4118('0xb')]);router['get']('/:id/messages',auth[_0x4118('0x8')](),controller[_0x4118('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x4118('0xd')]);router['post']('/',auth[_0x4118('0x8')](),controller['create']);router['post'](_0x4118('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0x4118('0xf')](_0x4118('0x10'),auth[_0x4118('0x8')](),interaction['tracked'](_0x4118('0x11'),_0x4118('0x12')),controller[_0x4118('0x13')]);router['put'](_0x4118('0x14'),auth['isAuthenticated'](),interaction[_0x4118('0x15')](_0x4118('0x11'),_0x4118('0x16')),controller['update']);router[_0x4118('0x17')](_0x4118('0x14'),auth[_0x4118('0x8')](),interaction[_0x4118('0x15')](_0x4118('0x11'),'smsinteraction:destroy'),controller[_0x4118('0x18')]);router[_0x4118('0x17')](_0x4118('0x10'),auth[_0x4118('0x8')](),controller[_0x4118('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d97d246..6988858 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 _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x1b1604,_0x368535){var _0x57918d=function(_0x176c51){while(--_0x176c51){_0x1b1604['push'](_0x1b1604['shift']());}};_0x57918d(++_0x368535);}(_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 +var _0x0713=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'closed':{'type':Sequelize[_0x3071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3071('0x2')]},'disposition':{'type':Sequelize[_0x3071('0x3')]},'note':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3071('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 047f616..6b2b751 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 _0x3667=['end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','split','forEach','Tags','TagIds','catch','index','SmsInteraction','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','where','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','SmsAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','include','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','sort','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','spread','emit','download','unix','root','tmp','server','files','attachments','join','format','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Messages','direction','secret','Account','Owner','get','mkdirSync','10px','40px','30px','Sms','YYYY-MM-DD','closed','closedAt','disposition','System','Contact','out','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status'];(function(_0x3c30a4,_0x152fd6){var _0x4f3e14=function(_0x28d11e){while(--_0x28d11e){_0x3c30a4['push'](_0x3c30a4['shift']());}};_0x4f3e14(++_0x152fd6);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7366('0x0'));var emlformat=require(_0x7366('0x1'));var rimraf=require(_0x7366('0x2'));var zipdir=require(_0x7366('0x3'));var jsonpatch=require(_0x7366('0x4'));var rp=require('request-promise');var moment=require(_0x7366('0x5'));var BPromise=require(_0x7366('0x6'));var Mustache=require('mustache');var util=require(_0x7366('0x7'));var path=require(_0x7366('0x8'));var sox=require(_0x7366('0x9'));var csv=require(_0x7366('0xa'));var ejs=require(_0x7366('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7366('0xc'));var crypto=require(_0x7366('0xd'));var jsforce=require(_0x7366('0xe'));var deskjs=require(_0x7366('0xf'));var toCsv=require(_0x7366('0xa'));var querystring=require(_0x7366('0x10'));var Papa=require(_0x7366('0x11'));var Redis=require(_0x7366('0x12'));var authService=require(_0x7366('0x13'));var qs=require(_0x7366('0x14'));var as=require(_0x7366('0x15'));var hardwareService=require(_0x7366('0x16'));var logger=require(_0x7366('0x17'))(_0x7366('0x18'));var utils=require(_0x7366('0x19'));var config=require(_0x7366('0x1a'));var db=require(_0x7366('0x1b'))['db'];config[_0x7366('0x1c')]=_[_0x7366('0x1d')](config[_0x7366('0x1c')],{'host':_0x7366('0x1e'),'port':0x18eb});var socket=require(_0x7366('0x1f'))(new Redis(config[_0x7366('0x1c')]));require(_0x7366('0x20'))[_0x7366('0x21')](socket);function respondWithStatusCode(_0x27500c,_0x22562f){_0x22562f=_0x22562f||0xcc;return function(_0xf4114){if(_0xf4114){return _0x27500c['sendStatus'](_0x22562f);}return _0x27500c[_0x7366('0x22')](_0x22562f)[_0x7366('0x23')]();};}function respondWithResult(_0x338719,_0x2c0422){_0x2c0422=_0x2c0422||0xc8;return function(_0xe2c87b){if(_0xe2c87b){return _0x338719[_0x7366('0x22')](_0x2c0422)[_0x7366('0x24')](_0xe2c87b);}};}function respondWithFilteredResult(_0x22d348,_0x83e5d5){return function(_0x41113f){if(_0x41113f){var _0x1a71f5=_0x41113f[_0x7366('0x25')],_0x49e50b=_0x83e5d5[_0x7366('0x26')],_0x208ac8=_0x83e5d5[_0x7366('0x26')]+_0x83e5d5['limit'],_0x4ffbc7;if(_0x208ac8>=_0x1a71f5){_0x208ac8=_0x1a71f5;_0x4ffbc7=0xc8;}else{_0x4ffbc7=0xce;}_0x22d348[_0x7366('0x22')](_0x4ffbc7);return _0x22d348[_0x7366('0x27')](_0x7366('0x28'),_0x49e50b+'-'+_0x208ac8+'/'+_0x1a71f5)['json'](_0x41113f);}return null;};}function patchUpdates(_0x16e038){return function(_0x1946c6){try{jsonpatch['apply'](_0x1946c6,_0x16e038,!![]);}catch(_0x3bfbca){return BPromise[_0x7366('0x29')](_0x3bfbca);}return _0x1946c6[_0x7366('0x2a')]();};}function saveUpdates(_0x1a12d2,_0x3c30a2){return function(_0x1d3139){if(_0x1d3139){return _0x1d3139[_0x7366('0x2b')](_0x1a12d2)[_0x7366('0x2c')](function(_0x2095a1){return _0x2095a1;});}return null;};}function removeEntity(_0x301220,_0x12aed6){return function(_0x1dc875){if(_0x1dc875){return _0x1dc875[_0x7366('0x2d')]()['then'](function(){_0x301220[_0x7366('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x379146,_0x4ab987){return function(_0x5e30fb){if(!_0x5e30fb){_0x379146[_0x7366('0x2e')](0x194);}return _0x5e30fb;};}function handleError(_0x4d4cb5,_0x254374){_0x254374=_0x254374||0x1f4;return function(_0x4ac138){logger[_0x7366('0x2f')](_0x4ac138[_0x7366('0x30')]);if(_0x4ac138['name']){delete _0x4ac138[_0x7366('0x31')];}_0x4d4cb5['status'](_0x254374)[_0x7366('0x32')](_0x4ac138);};}function getInteractionUsers(_0x2b61af,_0x4a4e67){return new BPromise(function(_0x3cef4a,_0x507baf){try{if(_0x4a4e67[_0x2b61af['id']]){_0x2b61af[_0x7366('0x33')]=_[_0x7366('0x34')](_0x4a4e67[_0x2b61af['id']],function(_0x39d6ea){return{'id':_0x39d6ea['id'],'fullname':_0x39d6ea[_0x7366('0x35')]};});}}catch(_0x2dda4b){_0x507baf(_0x2dda4b);}_0x3cef4a(_0x2b61af);});}function getInteractionTags(_0x5e075c,_0x166628){return new BPromise(function(_0x447807,_0x538d42){try{if(_0x5e075c['TagIds']){_0x5e075c['Tags']=[];_0x5e075c['TagIds'][_0x7366('0x36')](',')[_0x7366('0x37')](function(_0x163a29){_0x5e075c[_0x7366('0x38')]['push'](_0x166628[_0x163a29]);});}delete _0x5e075c[_0x7366('0x39')];}catch(_0x2abf10){_0x538d42(_0x2abf10);}_0x447807(_0x5e075c);});}function updateSmsInteraction(_0xdaffd3,_0x21547f,_0x5214bc){return new BPromise(function(_0x3ab373,_0x311dab){return getInteractionUsers(_0xdaffd3,_0x5214bc)['then'](function(_0x2befc7){return getInteractionTags(_0x2befc7,_0x21547f);})[_0x7366('0x2c')](function(_0x1de991){_0x3ab373(_0x1de991);})[_0x7366('0x3a')](function(_0x7779c7){_0x311dab(_0x7779c7);});});}exports[_0x7366('0x3b')]=function(_0x3a69fa,_0x26858b){var _0x437713={},_0x59dead={},_0x45db2a={'count':0x0,'rows':[]};var _0x83b879=_['map'](db[_0x7366('0x3c')][_0x7366('0x3d')],function(_0x3ca8e9){return{'name':_0x3ca8e9['fieldName'],'type':_0x3ca8e9[_0x7366('0x3e')]['key']};});_0x59dead[_0x7366('0x3f')]=_['map'](_0x83b879,'name');_0x59dead[_0x7366('0x40')]=_['keys'](_0x3a69fa[_0x7366('0x40')]);_0x59dead[_0x7366('0x41')]=_['intersection'](_0x59dead[_0x7366('0x3f')],_0x59dead['query']);_0x437713[_0x7366('0x42')]=_[_0x7366('0x43')](_0x59dead[_0x7366('0x3f')],qs[_0x7366('0x44')](_0x3a69fa['query'][_0x7366('0x44')]));_0x437713[_0x7366('0x42')]=_0x437713[_0x7366('0x42')]['length']?_0x437713[_0x7366('0x42')]:_0x59dead[_0x7366('0x3f')];if(!_0x3a69fa[_0x7366('0x40')][_0x7366('0x45')](_0x7366('0x46'))){_0x437713[_0x7366('0x47')]=qs[_0x7366('0x47')](_0x3a69fa['query']['limit']);_0x437713[_0x7366('0x26')]=qs[_0x7366('0x26')](_0x3a69fa['query'][_0x7366('0x26')]);}_0x437713[_0x7366('0x48')]=qs['sort'](_0x3a69fa[_0x7366('0x40')]['sort']);_0x437713[_0x7366('0x49')]=qs[_0x7366('0x41')](_['pick'](_0x3a69fa['query'],_0x59dead[_0x7366('0x41')]),_0x83b879);var _0xedc3c7=[];var _0x2ac2e6=squel[_0x7366('0x4a')]()['field']('id')[_0x7366('0x4b')](_0x7366('0x31'))[_0x7366('0x4b')](_0x7366('0x4c'))[_0x7366('0x4d')](_0x7366('0x4e'));var _0x37fcd6=squel['select']()[_0x7366('0x4b')](_0x7366('0x4f'))[_0x7366('0x4b')]('u.fullname')[_0x7366('0x4b')](_0x7366('0x50'))['from'](_0x7366('0x51'),'ui')[_0x7366('0x52')](_0x7366('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x1909d4=squel[_0x7366('0x4a')]()[_0x7366('0x4d')]('sms_interactions','i')[_0x7366('0x52')](_0x7366('0x54'),'c',_0x7366('0x55'))['left_join'](_0x7366('0x53'),'o',_0x7366('0x56'))[_0x7366('0x52')](_0x7366('0x57'),'a','a.id\x20=\x20i.SmsAccountId')[_0x7366('0x52')](_0x7366('0x58'),'me',_0x7366('0x59'))[_0x7366('0x52')](_0x7366('0x5a'),'it',_0x7366('0x5b'))[_0x7366('0x52')](_0x7366('0x4e'),'t',_0x7366('0x5c'));var _0x59f078=squel[_0x7366('0x5d')]();var _0x1b8dcd=[];var _0x5db903=squel[_0x7366('0x5d')]();var _0x33a804;if(_0x3a69fa['query'][_0x7366('0x5e')]){_0x33a804=as['parseSearch'](_0x3a69fa[_0x7366('0x40')][_0x7366('0x5e')]);var _0x1295ca=_0x33a804[_0x7366('0x5f')];for(var _0x588b31=0x0;_0x588b31<_0x33a804[_0x7366('0x60')][_0x7366('0x61')];_0x588b31++){var _0x390bd7=_0x33a804[_0x7366('0x60')][_0x588b31];var _0x1de0a7='i';var _0x2146dc=_[_0x7366('0x62')](_0x83b879,[_0x7366('0x31'),_0x390bd7[_0x7366('0x4b')]]);if(!_0x2146dc){switch(_0x390bd7[_0x7366('0x4b')]){case _0x7366('0x63'):if(_0x390bd7[_0x7366('0x64')]==0x1){_0x1909d4['having']('`'+_0x390bd7[_0x7366('0x4b')]+'`\x20=\x200');}else{_0x1909d4['having']('`'+_0x390bd7[_0x7366('0x4b')]+_0x7366('0x65'));}break;case'Contact':if(_0x390bd7[_0x7366('0x66')]===_0x7366('0x67')){if(_0x390bd7['value']['split']('\x20')[_0x7366('0x61')]>0x1){_0x59f078[_0x1295ca]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7366('0x68')](_0x390bd7[_0x7366('0x64')]),null);}else{var _0x4ca4f7='%'+_0x390bd7[_0x7366('0x64')]+'%';_0x59f078[_0x1295ca](_0x7366('0x69'),_0x4ca4f7,_0x4ca4f7,_0x4ca4f7);}}else{_0x2146dc=_[_0x7366('0x62')](_0x83b879,['name',_0x7366('0x6a')]);_0x390bd7[_0x7366('0x4b')]=_0x7366('0x6a');_0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc['type'],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016[_0x7366('0x64')][_0x7366('0x6d')],_0x523016[_0x7366('0x64')][_0x7366('0x23')]);}break;case'Tag':var _0x1249a7=_0x390bd7[_0x7366('0x64')][_0x7366('0x36')](',')[_0x7366('0x34')](function(_0x54c117){return Number(_0x54c117);});_0x1249a7[_0x7366('0x37')](function(_0x5cbefc){_0x5db903['or'](_0x7366('0x6e'),'%,'+_0x5cbefc+',%');});_0x1b8dcd=_[_0x7366('0x6f')](_0x1b8dcd,_0x1249a7);break;case'User':if(_0x390bd7[_0x7366('0x66')]===_0x7366('0x67')){_0x59f078[_0x1295ca](_0x7366('0x70'),'%'+_0x390bd7[_0x7366('0x64')]+'%',null);}else{_0x2146dc=_['find'](_0x83b879,['name',_0x7366('0x71')]);_0x390bd7['field']=_0x7366('0x71');_0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc[_0x7366('0x3e')],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016[_0x7366('0x64')][_0x7366('0x6d')],_0x523016[_0x7366('0x64')][_0x7366('0x23')]);}break;case _0x7366('0x72'):_0x523016=as['buildExpression']('me',null,_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016['value']['start'],_0x523016['value'][_0x7366('0x23')]);break;}}else{var _0x523016=as[_0x7366('0x6b')](_0x1de0a7,_0x2146dc['type'],_0x390bd7);_0x59f078[_0x1295ca](_0x523016[_0x7366('0x6c')],_0x523016['value'][_0x7366('0x6d')],_0x523016[_0x7366('0x64')]['end']);}}}else{var _0x4793c6=_(_0x3a69fa[_0x7366('0x40')])[_0x7366('0x73')]()[_0x7366('0x34')](function(_0x37a599){return _['some'](_0x83b879,[_0x7366('0x31'),_0x37a599])?_0x37a599:undefined;})[_0x7366('0x74')]()[_0x7366('0x64')]();if(!_['isEmpty'](_0x4793c6)){_0x4793c6['forEach'](function(_0x26ab9b){if(_0x26ab9b===_0x7366('0x75')){_0x1909d4[_0x7366('0x49')]('i.SmsAccountId\x20IN\x20?',[][_0x7366('0x76')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b]));}else if(_0x26ab9b===_0x7366('0x77')){var _0x236180=JSON[_0x7366('0x78')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b])[_0x7366('0x79')];var _0x38c65b=JSON[_0x7366('0x78')](_0x3a69fa[_0x7366('0x40')][_0x26ab9b])[_0x7366('0x7a')];_0x1909d4['where'](_0x7366('0x7b'),_0x236180,_0x38c65b);}else{if(_0x3a69fa[_0x7366('0x40')][_0x26ab9b]==='null'){_0x1909d4[_0x7366('0x49')]('i.'+_0x26ab9b+'\x20IS\x20NULL');}else{_0x1909d4['where']('i.'+_0x26ab9b+_0x7366('0x7c'),_0x3a69fa[_0x7366('0x40')][_0x26ab9b]);}}});}if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x7d')]){if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x7d')]==0x1){_0x1909d4['having'](_0x7366('0x7e'));}else{_0x1909d4[_0x7366('0x7f')](_0x7366('0x80'));}}if(_0x3a69fa['query'][_0x7366('0x81')]){_0x1b8dcd=_['isArray'](_0x3a69fa['query'][_0x7366('0x81')])?_0x3a69fa['query'][_0x7366('0x81')]:new Array(_0x3a69fa[_0x7366('0x40')][_0x7366('0x81')]);_0x1b8dcd[_0x7366('0x37')](function(_0x4b9045){_0x5db903['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b9045+',%');});}if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x82')]){var _0x1a2c88=_0x3a69fa[_0x7366('0x40')]['filter'][_0x7366('0x83')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x7366('0x84')](_0x1a2c88)){_0x59f078['or'](_0x7366('0x85'),_0x1a2c88+'%')['or']('i.phone\x20LIKE\x20?',_0x1a2c88+'%');}else{_0x59f078['or'](_0x7366('0x86'),qs[_0x7366('0x68')](_0x1a2c88))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1a2c88+'%');}}}_0x1909d4[_0x7366('0x49')](_0x59f078);_0x1909d4[_0x7366('0x87')](_0x7366('0x88'));var _0x3cad9e={'type':db[_0x7366('0x89')][_0x7366('0x8a')][_0x7366('0x8b')],'raw':!![]};var _0x16b3a=_0x1909d4[_0x7366('0x8c')]();_0x16b3a[_0x7366('0x4b')]('i.id');_0x16b3a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7366('0x63'));if(_0x437713[_0x7366('0x48')]){_0x437713[_0x7366('0x48')]['forEach'](function(_0x2754ae){_0x1909d4[_0x7366('0x48')]('i.'+_0x2754ae[0x0],_0x2754ae[0x1]===_0x7366('0x8d')?![]:!![]);});}if(!_[_0x7366('0x8e')](_0x1b8dcd)){_0x1909d4[_0x7366('0x7f')](_0x5db903);_0x16b3a['where'](_0x7366('0x8f'),_0x1b8dcd);}BPromise[_0x7366('0x90')]()['then'](function(){if(!_0x33a804){if(_0x3a69fa[_0x7366('0x40')][_0x7366('0x75')]||_0x3a69fa[_0x7366('0x40')][_0x7366('0x91')])return;_0x16b3a[_0x7366('0x49')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x1909d4['where'](_0x7366('0x92'));return;}return _0x3a69fa[_0x7366('0x93')][_0x7366('0x94')]({'attributes':['id'],'raw':!![]})[_0x7366('0x2c')](function(_0x3bc663){if(_[_0x7366('0x8e')](_0x3bc663)){_0x16b3a[_0x7366('0x49')](_0x7366('0x95'));_0x1909d4[_0x7366('0x49')](_0x7366('0x95'));}else{_0x16b3a[_0x7366('0x49')](_0x7366('0x96'),_[_0x7366('0x34')](_0x3bc663,'id'));_0x1909d4[_0x7366('0x49')]('i.SmsAccountId\x20IN\x20?',_[_0x7366('0x34')](_0x3bc663,'id'));}});})['then'](function(){db[_0x7366('0x97')]['query'](_0x16b3a[_0x7366('0x98')](),_0x3cad9e)['then'](function(_0x313478){_0x45db2a[_0x7366('0x25')]=_0x313478['length'];if(_0x45db2a[_0x7366('0x25')]===0x0)return[];return db[_0x7366('0x97')]['query'](_0x2ac2e6['toString'](),_0x3cad9e)[_0x7366('0x2c')](function(_0x1821e1){_0xedc3c7=_['keyBy'](_0x1821e1,'id');_0x3cad9e=_[_0x7366('0x99')](_0x3cad9e,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a69fa[_0x7366('0x40')]['fields']){_0x437713['attributes'][_0x7366('0x37')](function(_0x40a7a3){_0x1909d4[_0x7366('0x4b')]('i.'+_0x40a7a3);});}else{_0x1909d4['field'](_0x7366('0x9a'),_0x7366('0x63'));_0x1909d4[_0x7366('0x4b')]('a.key',_0x7366('0x9b'));_0x1909d4[_0x7366('0x4b')](_0x7366('0x9c'),_0x7366('0x9d'));_0x1909d4[_0x7366('0x4b')](_0x7366('0x9e'));_0x1909d4['field'](_0x7366('0x9f'),_0x7366('0xa0'));_0x1909d4[_0x7366('0x4b')]('c.lastName',_0x7366('0xa1'));_0x1909d4['field'](_0x7366('0xa2'),_0x7366('0xa3'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa4'),_0x7366('0xa5'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa6'),_0x7366('0xa7'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xa8'),_0x7366('0xa9'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xaa'),'Owner.fullname');_0x1909d4[_0x7366('0x4b')](_0x7366('0xab'),_0x7366('0xac'));_0x1909d4[_0x7366('0x4b')](_0x7366('0xad'),'TagIds');}if(_0x437713[_0x7366('0x47')])_0x1909d4[_0x7366('0x47')](_0x437713['limit']);if(_0x437713[_0x7366('0x26')])_0x1909d4[_0x7366('0x26')](_0x437713[_0x7366('0x26')]);return db['sequelize'][_0x7366('0x40')](_0x1909d4['toString'](),_0x3cad9e);})['then'](function(_0x5d3a75){_0x37fcd6[_0x7366('0x49')](_0x7366('0xae'),_[_0x7366('0x34')](_0x5d3a75,'id'));return db[_0x7366('0x97')][_0x7366('0x40')](_0x37fcd6[_0x7366('0x98')](),_0x3cad9e)['then'](function(_0x506c11){var _0x133be0=_[_0x7366('0xaf')](_0x506c11,_0x7366('0xb0'));var _0xe26771=[];_0x5d3a75['forEach'](function(_0x2c69bf){_0xe26771[_0x7366('0xb1')](updateSmsInteraction(_0x2c69bf,_0xedc3c7,_0x133be0));});return BPromise[_0x7366('0xb2')](_0xe26771);});});})[_0x7366('0x2c')](function(_0x12b3e2){_0x45db2a[_0x7366('0xb3')]=_0x12b3e2;return _0x45db2a;})['then'](respondWithFilteredResult(_0x26858b,_0x437713));})[_0x7366('0x3a')](handleError(_0x26858b,null));};exports[_0x7366('0xb4')]=function(_0x2e52a7,_0x33ae81){var _0x108dba={'raw':![],'where':{'id':_0x2e52a7[_0x7366('0xb5')]['id']}},_0x123d0a={};_0x123d0a['model']=_[_0x7366('0x73')](db[_0x7366('0x3c')]['rawAttributes']);_0x123d0a[_0x7366('0x40')]=_[_0x7366('0x73')](_0x2e52a7[_0x7366('0x40')]);_0x123d0a[_0x7366('0x41')]=_[_0x7366('0x43')](_0x123d0a['model'],_0x123d0a['query']);_0x108dba['attributes']=_[_0x7366('0x43')](_0x123d0a[_0x7366('0x3f')],qs[_0x7366('0x44')](_0x2e52a7[_0x7366('0x40')][_0x7366('0x44')]));_0x108dba[_0x7366('0x42')]=_0x108dba[_0x7366('0x42')][_0x7366('0x61')]?_0x108dba['attributes']:_0x123d0a[_0x7366('0x3f')];if(_0x2e52a7[_0x7366('0x40')]['includeAll']){_0x108dba[_0x7366('0xb6')]=[{'all':!![]}];}_0x108dba=_['merge']({},_0x108dba,_0x2e52a7['options']);return db['SmsInteraction'][_0x7366('0x62')](_0x108dba)[_0x7366('0x2c')](handleEntityNotFound(_0x33ae81,null))[_0x7366('0x2c')](respondWithResult(_0x33ae81,null))[_0x7366('0x3a')](handleError(_0x33ae81,null));};exports[_0x7366('0xb7')]=function(_0x29640b,_0x313ea8){return db[_0x7366('0x3c')][_0x7366('0xb7')](_0x29640b[_0x7366('0x72')],{})['then'](respondWithResult(_0x313ea8,0xc9))[_0x7366('0x3a')](handleError(_0x313ea8,null));};exports[_0x7366('0x2b')]=function(_0x5e0556,_0x57df7b){if(_0x5e0556[_0x7366('0x72')]['id']){delete _0x5e0556[_0x7366('0x72')]['id'];}return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x5e0556[_0x7366('0xb5')]['id']}})['then'](handleEntityNotFound(_0x57df7b,null))[_0x7366('0x2c')](saveUpdates(_0x5e0556[_0x7366('0x72')],null))[_0x7366('0x2c')](respondWithResult(_0x57df7b,null))[_0x7366('0x3a')](handleError(_0x57df7b,null));};exports[_0x7366('0x2d')]=function(_0x57a6b7,_0x18c2bf){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x57a6b7[_0x7366('0xb5')]['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x18c2bf,null))[_0x7366('0x2c')](removeEntity(_0x18c2bf,null))[_0x7366('0x3a')](handleError(_0x18c2bf,null));};exports[_0x7366('0xb8')]=function(_0x5c1ec2,_0x544935){return db[_0x7366('0x3c')][_0x7366('0xb8')]()[_0x7366('0x2c')](respondWithResult(_0x544935,null))[_0x7366('0x3a')](handleError(_0x544935,null));};exports[_0x7366('0xb9')]=function(_0x36fdb0,_0x1844f8,_0x31138d){return db['SmsMessage'][_0x7366('0x62')]({'where':{'id':_0x36fdb0['params']['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x1844f8,null))[_0x7366('0x2c')](function(_0x172ee4){if(_0x172ee4){return _0x172ee4[_0x7366('0xb9')](_0x36fdb0[_0x7366('0x72')][_0x7366('0xba')],_[_0x7366('0xbb')](_0x36fdb0[_0x7366('0x72')],[_0x7366('0xba'),'id'])||{});}})[_0x7366('0x2c')](respondWithResult(_0x1844f8,null))[_0x7366('0x3a')](handleError(_0x1844f8,null));};exports[_0x7366('0xbc')]=function(_0x576751,_0x1acf3b,_0xd4246a){var _0x2ff830={'raw':![],'where':{}};var _0x145519={};var _0x3c36db={'count':0x0,'rows':[]};return db[_0x7366('0x3c')][_0x7366('0xbd')]({'where':{'id':_0x576751[_0x7366('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1acf3b,null))[_0x7366('0x2c')](function(_0x2e0ccb){if(_0x2e0ccb){_0x145519[_0x7366('0x3f')]=_[_0x7366('0x73')](db[_0x7366('0xbe')][_0x7366('0x3d')]);_0x145519[_0x7366('0x40')]=_[_0x7366('0x73')](_0x576751[_0x7366('0x40')]);_0x145519[_0x7366('0x41')]=_[_0x7366('0x43')](_0x145519[_0x7366('0x3f')],_0x145519[_0x7366('0x40')]);_0x2ff830['attributes']=_[_0x7366('0x43')](_0x145519[_0x7366('0x3f')],qs['fields'](_0x576751['query']['fields']));_0x2ff830['attributes']=_0x2ff830[_0x7366('0x42')]['length']?_0x2ff830[_0x7366('0x42')]:_0x145519[_0x7366('0x3f')];if(!_0x576751['query'][_0x7366('0x45')](_0x7366('0x46'))){_0x2ff830[_0x7366('0x47')]=qs['limit'](_0x576751[_0x7366('0x40')][_0x7366('0x47')]);_0x2ff830['offset']=qs[_0x7366('0x26')](_0x576751[_0x7366('0x40')][_0x7366('0x26')]);}_0x2ff830[_0x7366('0x48')]=qs[_0x7366('0xbf')](_0x576751[_0x7366('0x40')]['sort']);_0x2ff830[_0x7366('0x49')]=qs[_0x7366('0x41')](_['pick'](_0x576751[_0x7366('0x40')],_0x145519[_0x7366('0x41')]));_0x2ff830[_0x7366('0x49')]['SmsInteractionId']=_0x2e0ccb['id'];if(_0x576751[_0x7366('0x40')][_0x7366('0x82')]){_0x2ff830['where']=_[_0x7366('0x99')](_0x2ff830[_0x7366('0x49')],{'$or':_[_0x7366('0x34')](_0x2ff830[_0x7366('0x42')],function(_0x54d697){var _0x4aaba8={};_0x4aaba8[_0x54d697]={'$like':'%'+_0x576751[_0x7366('0x40')][_0x7366('0x82')]+'%'};return _0x4aaba8;})});}if(_0x576751['query']['$gte']){var _0x4f0e41=_0x576751[_0x7366('0x40')][_0x7366('0x79')]['split'](',');var _0x20930e={};_0x20930e[_0x4f0e41[0x0]]={'$gte':moment(_0x4f0e41[0x1])['format'](_0x7366('0xc0'))};_0x2ff830[_0x7366('0x49')]=_[_0x7366('0x99')](_0x2ff830['where'],_0x20930e);}_0x2ff830=_[_0x7366('0x99')]({},_0x2ff830,_0x576751[_0x7366('0xc1')]);return db[_0x7366('0xbe')]['count']({'where':_0x2ff830[_0x7366('0x49')]})[_0x7366('0x2c')](function(_0x20a10b){_0x3c36db[_0x7366('0x25')]=_0x20a10b;if(_0x576751[_0x7366('0x40')][_0x7366('0xc2')]){_0x2ff830[_0x7366('0xb6')]=[{'all':!![]}];}return db[_0x7366('0xbe')][_0x7366('0xc3')](_0x2ff830);})[_0x7366('0x2c')](function(_0x58a5b5){_0x3c36db[_0x7366('0xb3')]=_0x58a5b5;return _0x3c36db;});}})['then'](respondWithFilteredResult(_0x1acf3b,_0x2ff830))[_0x7366('0x3a')](handleError(_0x1acf3b,null));};exports[_0x7366('0xc4')]=function(_0x26ef04,_0x328b4a,_0x17b9e5){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x26ef04['params']['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x328b4a,null))[_0x7366('0x2c')](function(_0x540c12){if(_0x540c12){return _0x540c12[_0x7366('0xc5')](_0x26ef04[_0x7366('0x72')][_0x7366('0xba')],_[_0x7366('0xbb')](_0x26ef04[_0x7366('0x72')],[_0x7366('0xba'),'id'])||{})[_0x7366('0xc6')](function(){return db['Tag'][_0x7366('0xc3')]({'attributes':['id',_0x7366('0x31'),'color'],'where':{'id':_0x26ef04[_0x7366('0x72')][_0x7366('0xba')]}});})[_0x7366('0x2c')](function(_0x49139e){socket[_0x7366('0xc7')]('smsInteractionTags:save',{'id':Number(_0x26ef04[_0x7366('0xb5')]['id']),'tags':_0x49139e||[]});return{'id':Number(_0x26ef04[_0x7366('0xb5')]['id']),'tags':_0x49139e||[]};});}})[_0x7366('0x2c')](respondWithResult(_0x328b4a,null))['catch'](handleError(_0x328b4a,null));};exports['removeTags']=function(_0x19414f,_0x432daf,_0x1d5a79){return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x19414f[_0x7366('0xb5')]['id']}})[_0x7366('0x2c')](handleEntityNotFound(_0x432daf,null))[_0x7366('0x2c')](function(_0x433172){if(_0x433172){return _0x433172['removeTags'](_0x19414f[_0x7366('0x40')][_0x7366('0xba')]);}})[_0x7366('0x2c')](respondWithStatusCode(_0x432daf,null))['catch'](handleError(_0x432daf,null));};exports[_0x7366('0xc8')]=function(_0x1f21e7,_0x652bd2){var _0x4c42fa=moment()[_0x7366('0xc9')]()['toString']();var _0x3a9cdd=path['join'](config[_0x7366('0xca')],'server','files',_0x7366('0xcb'));var _0x368452=path['join'](config[_0x7366('0xca')],_0x7366('0xcc'),_0x7366('0xcd'),_0x7366('0xce'));var _0x3774be=path[_0x7366('0xcf')](_0x3a9cdd,_0x4c42fa);var _0x41d8ae=util[_0x7366('0xd0')](_0x7366('0xd1'),_0x1f21e7[_0x7366('0xb5')]['id'],_0x4c42fa);var _0xbeb315=path['join'](_0x3a9cdd,_0x41d8ae);var _0x3dd418=[];_0x3dd418['push']({'model':db[_0x7366('0xd2')],'as':_0x7366('0xd2'),'attributes':['id',_0x7366('0x35')],'raw':!![]});_0x3dd418[_0x7366('0xb1')]({'model':db[_0x7366('0xd3')],'as':'Contact','attributes':['id',_0x7366('0xd4'),_0x7366('0xd5')],'raw':!![]});var _0x237485=[{'model':db[_0x7366('0xbe')],'as':_0x7366('0xd6'),'attributes':['id',_0x7366('0x72'),_0x7366('0x77'),_0x7366('0xd7'),_0x7366('0xd8'),'read'],'include':_0x3dd418}];_0x237485['push']({'model':db['SmsAccount'],'as':_0x7366('0xd9'),'attributes':['id','name']});_0x237485['push']({'model':db[_0x7366('0xd2')],'as':_0x7366('0xda'),'attributes':['id',_0x7366('0x35')]});return db[_0x7366('0x3c')][_0x7366('0x62')]({'where':{'id':_0x1f21e7[_0x7366('0xb5')]['id']},'include':_0x237485})['then'](handleEntityNotFound(_0x652bd2,null))[_0x7366('0x2c')](function(_0x5ed9eb){if(_0x5ed9eb){var _0x4c6f72=_0x5ed9eb[_0x7366('0xdb')]({'plain':!![]});fs[_0x7366('0xdc')](_0x3774be);var _0x17571a={'format':'A4','border':_0x7366('0xdd'),'header':{'height':_0x7366('0xde'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x7366('0xdf'),'contents':{'default':util[_0x7366('0xd0')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x7366('0xd0')]('%s\x20#%d',_0x7366('0xe0'),_0x4c6f72['id']),moment()[_0x7366('0xd0')](_0x7366('0xe1'))[_0x7366('0x98')]())}}};var _0x402781={'channel':_0x7366('0xe0'),'account':_0x4c6f72[_0x7366('0xd9')]['name'],'agent':_0x4c6f72[_0x7366('0xda')]?_0x4c6f72[_0x7366('0xda')]['fullname']:'N.A.','createdAt':moment(_0x4c6f72[_0x7366('0x77')])[_0x7366('0xd0')](_0x7366('0xc0'))[_0x7366('0x98')](),'closedAt':_0x4c6f72[_0x7366('0xe2')]?moment(_0x4c6f72[_0x7366('0xe3')])['format'](_0x7366('0xc0'))[_0x7366('0x98')]():'','disposition':_0x4c6f72[_0x7366('0xe4')],'messages':_(_0x4c6f72[_0x7366('0xd6')])['filter']({'secret':![]})[_0x7366('0x34')](function(_0x33d651){return{'date':moment(_0x33d651[_0x7366('0x77')])[_0x7366('0xd0')](_0x7366('0xc0'))[_0x7366('0x98')](),'sender':_0x33d651[_0x7366('0xd7')]==='out'?_0x33d651[_0x7366('0xd2')]?_0x33d651['User']['fullname']:_0x7366('0xe5'):_0x33d651['Contact'][_0x7366('0xd4')]+(_0x33d651[_0x7366('0xe6')]['lastName']?'\x20'+_0x33d651[_0x7366('0xe6')][_0x7366('0xd5')]:''),'body':_0x33d651[_0x7366('0x72')],'direction':_0x33d651[_0x7366('0xd7')]===_0x7366('0xe7')?'A':'C','secret':_0x33d651['secret'],'read':_0x33d651['read']};})[_0x7366('0x64')]()};return ejs[_0x7366('0xe8')](path['join'](config['root'],_0x7366('0xcc'),_0x7366('0xe9'),_0x7366('0xea')),{'interaction':_0x402781})[_0x7366('0x2c')](function(_0x286bb4){return new BPromise(function(_0x5c264f,_0x2e9f64){pdf['create'](_0x286bb4,_0x17571a)[_0x7366('0xeb')](path[_0x7366('0xcf')](_0x3774be,_0x7366('0xec')+_0x4c6f72['id']+'-'+_0x4c42fa+'.pdf'),function(_0x28096d,_0x1d8808){if(_0x28096d)return _0x2e9f64(_0x28096d);_0x5c264f(_0x1d8808);});});})[_0x7366('0x2c')](function(){return new BPromise(function(_0x5660cf,_0x42e7ad){zipdir(_0x3774be,{'saveTo':_0xbeb315},function(_0x37c6b2,_0x56e058){if(_0x37c6b2)return _0x42e7ad(_0x37c6b2);return _0x5660cf(_0x56e058);});})[_0x7366('0x2c')](function(){return new BPromise(function(_0x581897,_0x3de2a6){rimraf(_0x3774be,function(_0x5073d9){if(_0x5073d9)_0x3de2a6(_0x5073d9);return _0x581897();});});})[_0x7366('0x2c')](function(){return _0x652bd2[_0x7366('0xc8')](_0xbeb315,_0x41d8ae,function(_0x35e024){if(_0x35e024){console[_0x7366('0xed')](_0x7366('0xee'),_0x35e024);}else{fs[_0x7366('0xef')](_0xbeb315);}});});});}else{return _0x652bd2[_0x7366('0x2e')](0xc8);}})[_0x7366('0x3a')](handleError(_0x652bd2,null));}; \ No newline at end of file +var _0xdb94=['type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','select','field','from','u.id','ui.SmsInteractionId','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','unreadMessages','value','having','`\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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','some','compact','isEmpty','SmsAccountId','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20>\x200','isArray','tag','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','merge','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','show','params','includeAll','include','options','create','destroy','describe','addMessage','SmsMessage','ids','omit','findOne','format','findAll','rows','addTags','setTags','spread','color','smsInteractionTags:save','removeTags','download','root','files','tmp','join','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Messages','secret','SmsAccount','Account','Owner','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','System','direction','renderFile','server','views','downloadInteraction.html','toFile','transcript-','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','register','end','status','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','SmsInteraction','rawAttributes'];(function(_0xae06d3,_0x572d98){var _0x284f15=function(_0x28c18a){while(--_0x28c18a){_0xae06d3['push'](_0xae06d3['shift']());}};_0x284f15(++_0x572d98);}(_0xdb94,0xab));var _0x4db9=function(_0x23fe6f,_0x52f60e){_0x23fe6f=_0x23fe6f-0x0;var _0x111a64=_0xdb94[_0x23fe6f];return _0x111a64;};'use strict';var pdf=require(_0x4db9('0x0'));var emlformat=require(_0x4db9('0x1'));var rimraf=require(_0x4db9('0x2'));var zipdir=require(_0x4db9('0x3'));var jsonpatch=require(_0x4db9('0x4'));var rp=require('request-promise');var moment=require(_0x4db9('0x5'));var BPromise=require(_0x4db9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4db9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4db9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4db9('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4db9('0x18'))(new Redis(config[_0x4db9('0x19')]));require('./smsInteraction.socket')[_0x4db9('0x1a')](socket);function respondWithStatusCode(_0x1f9638,_0x452896){_0x452896=_0x452896||0xcc;return function(_0x22667c){if(_0x22667c){return _0x1f9638['sendStatus'](_0x452896);}return _0x1f9638['status'](_0x452896)[_0x4db9('0x1b')]();};}function respondWithResult(_0x34de1a,_0x4a037f){_0x4a037f=_0x4a037f||0xc8;return function(_0xadc104){if(_0xadc104){return _0x34de1a[_0x4db9('0x1c')](_0x4a037f)['json'](_0xadc104);}};}function respondWithFilteredResult(_0x5a85c4,_0x250a80){return function(_0x143b88){if(_0x143b88){var _0x462af3=_0x143b88[_0x4db9('0x1d')],_0xa693c4=_0x250a80[_0x4db9('0x1e')],_0x1d3c33=_0x250a80[_0x4db9('0x1e')]+_0x250a80['limit'],_0x55494a;if(_0x1d3c33>=_0x462af3){_0x1d3c33=_0x462af3;_0x55494a=0xc8;}else{_0x55494a=0xce;}_0x5a85c4[_0x4db9('0x1c')](_0x55494a);return _0x5a85c4[_0x4db9('0x1f')](_0x4db9('0x20'),_0xa693c4+'-'+_0x1d3c33+'/'+_0x462af3)['json'](_0x143b88);}return null;};}function patchUpdates(_0x46b522){return function(_0x2e8f95){try{jsonpatch[_0x4db9('0x21')](_0x2e8f95,_0x46b522,!![]);}catch(_0x46fc3d){return BPromise[_0x4db9('0x22')](_0x46fc3d);}return _0x2e8f95[_0x4db9('0x23')]();};}function saveUpdates(_0x3585d5,_0x5aef3b){return function(_0x4ceb0c){if(_0x4ceb0c){return _0x4ceb0c[_0x4db9('0x24')](_0x3585d5)[_0x4db9('0x25')](function(_0x319475){return _0x319475;});}return null;};}function removeEntity(_0x4aaa84,_0x213daa){return function(_0xdac966){if(_0xdac966){return _0xdac966['destroy']()[_0x4db9('0x25')](function(){_0x4aaa84[_0x4db9('0x1c')](0xcc)[_0x4db9('0x1b')]();});}};}function handleEntityNotFound(_0x4dbb1b,_0x3c8237){return function(_0xd250c5){if(!_0xd250c5){_0x4dbb1b[_0x4db9('0x26')](0x194);}return _0xd250c5;};}function handleError(_0x2d330e,_0x3f9f7e){_0x3f9f7e=_0x3f9f7e||0x1f4;return function(_0x385e22){logger[_0x4db9('0x27')](_0x385e22[_0x4db9('0x28')]);if(_0x385e22[_0x4db9('0x29')]){delete _0x385e22[_0x4db9('0x29')];}_0x2d330e[_0x4db9('0x1c')](_0x3f9f7e)[_0x4db9('0x2a')](_0x385e22);};}function getInteractionUsers(_0x2d646d,_0x20f133){return new BPromise(function(_0x583861,_0x5031fe){try{if(_0x20f133[_0x2d646d['id']]){_0x2d646d[_0x4db9('0x2b')]=_[_0x4db9('0x2c')](_0x20f133[_0x2d646d['id']],function(_0x119371){return{'id':_0x119371['id'],'fullname':_0x119371[_0x4db9('0x2d')]};});}}catch(_0x2af884){_0x5031fe(_0x2af884);}_0x583861(_0x2d646d);});}function getInteractionTags(_0x459131,_0x4dc946){return new BPromise(function(_0x375834,_0x554eef){try{if(_0x459131[_0x4db9('0x2e')]){_0x459131[_0x4db9('0x2f')]=[];_0x459131[_0x4db9('0x2e')][_0x4db9('0x30')](',')[_0x4db9('0x31')](function(_0x515f3a){_0x459131['Tags'][_0x4db9('0x32')](_0x4dc946[_0x515f3a]);});}delete _0x459131['TagIds'];}catch(_0x337d74){_0x554eef(_0x337d74);}_0x375834(_0x459131);});}function updateSmsInteraction(_0xddc8b1,_0x4f5b57,_0x430711){return new BPromise(function(_0x3131ba,_0x32c12d){return getInteractionUsers(_0xddc8b1,_0x430711)['then'](function(_0x34f480){return getInteractionTags(_0x34f480,_0x4f5b57);})['then'](function(_0x40226c){_0x3131ba(_0x40226c);})[_0x4db9('0x33')](function(_0x1f4959){_0x32c12d(_0x1f4959);});});}exports['index']=function(_0x4f17a0,_0x2a9b6b){var _0x1494bc={},_0x12a208={},_0x3aec38={'count':0x0,'rows':[]};var _0x2dca24=_[_0x4db9('0x2c')](db[_0x4db9('0x34')][_0x4db9('0x35')],function(_0x4289f3){return{'name':_0x4289f3['fieldName'],'type':_0x4289f3[_0x4db9('0x36')][_0x4db9('0x37')]};});_0x12a208[_0x4db9('0x38')]=_[_0x4db9('0x2c')](_0x2dca24,'name');_0x12a208[_0x4db9('0x39')]=_[_0x4db9('0x3a')](_0x4f17a0[_0x4db9('0x39')]);_0x12a208['filters']=_[_0x4db9('0x3b')](_0x12a208[_0x4db9('0x38')],_0x12a208[_0x4db9('0x39')]);_0x1494bc[_0x4db9('0x3c')]=_['intersection'](_0x12a208['model'],qs[_0x4db9('0x3d')](_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x3d')]));_0x1494bc[_0x4db9('0x3c')]=_0x1494bc[_0x4db9('0x3c')]['length']?_0x1494bc[_0x4db9('0x3c')]:_0x12a208[_0x4db9('0x38')];if(!_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x3e')](_0x4db9('0x3f'))){_0x1494bc['limit']=qs[_0x4db9('0x40')](_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x40')]);_0x1494bc['offset']=qs[_0x4db9('0x1e')](_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x1e')]);}_0x1494bc[_0x4db9('0x41')]=qs[_0x4db9('0x42')](_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x42')]);_0x1494bc[_0x4db9('0x43')]=qs[_0x4db9('0x44')](_[_0x4db9('0x45')](_0x4f17a0['query'],_0x12a208['filters']),_0x2dca24);var _0x48aaf5=[];var _0x22a021=squel[_0x4db9('0x46')]()['field']('id')[_0x4db9('0x47')](_0x4db9('0x29'))['field']('color')[_0x4db9('0x48')]('tools_tags');var _0x16be76=squel[_0x4db9('0x46')]()['field'](_0x4db9('0x49'))[_0x4db9('0x47')]('u.fullname')[_0x4db9('0x47')](_0x4db9('0x4a'))[_0x4db9('0x48')]('user_has_sms_interactions','ui')['left_join'](_0x4db9('0x4b'),'u',_0x4db9('0x4c'));var _0x719001=squel[_0x4db9('0x46')]()[_0x4db9('0x48')](_0x4db9('0x4d'),'i')[_0x4db9('0x4e')](_0x4db9('0x4f'),'c',_0x4db9('0x50'))[_0x4db9('0x4e')](_0x4db9('0x4b'),'o',_0x4db9('0x51'))[_0x4db9('0x4e')]('sms_accounts','a',_0x4db9('0x52'))[_0x4db9('0x4e')](_0x4db9('0x53'),'me',_0x4db9('0x54'))[_0x4db9('0x4e')](_0x4db9('0x55'),'it',_0x4db9('0x56'))[_0x4db9('0x4e')](_0x4db9('0x57'),'t',_0x4db9('0x58'));var _0x10dccb=squel['expr']();var _0x4f2e54=[];var _0x36cd58=squel[_0x4db9('0x59')]();var _0x34b366;if(_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x5a')]){_0x34b366=as[_0x4db9('0x5b')](_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x5a')]);var _0x4f1e36=_0x34b366[_0x4db9('0x5c')];for(var _0xcb832e=0x0;_0xcb832e<_0x34b366[_0x4db9('0x5d')][_0x4db9('0x5e')];_0xcb832e++){var _0x3c1ad2=_0x34b366[_0x4db9('0x5d')][_0xcb832e];var _0x1226ea='i';var _0x3db087=_['find'](_0x2dca24,[_0x4db9('0x29'),_0x3c1ad2[_0x4db9('0x47')]]);if(!_0x3db087){switch(_0x3c1ad2[_0x4db9('0x47')]){case _0x4db9('0x5f'):if(_0x3c1ad2[_0x4db9('0x60')]==0x1){_0x719001[_0x4db9('0x61')]('`'+_0x3c1ad2['field']+_0x4db9('0x62'));}else{_0x719001['having']('`'+_0x3c1ad2[_0x4db9('0x47')]+'`\x20>\x200');}break;case'Contact':if(_0x3c1ad2[_0x4db9('0x63')]==='$substring'){if(_0x3c1ad2[_0x4db9('0x60')][_0x4db9('0x30')]('\x20')[_0x4db9('0x5e')]>0x1){_0x10dccb[_0x4f1e36](_0x4db9('0x64'),qs['getFullTextValue'](_0x3c1ad2[_0x4db9('0x60')]),null);}else{var _0x543301='%'+_0x3c1ad2[_0x4db9('0x60')]+'%';_0x10dccb[_0x4f1e36](_0x4db9('0x65'),_0x543301,_0x543301,_0x543301);}}else{_0x3db087=_['find'](_0x2dca24,[_0x4db9('0x29'),'ContactId']);_0x3c1ad2[_0x4db9('0x47')]=_0x4db9('0x66');_0x5bafe4=as[_0x4db9('0x67')](_0x1226ea,_0x3db087[_0x4db9('0x36')],_0x3c1ad2);_0x10dccb[_0x4f1e36](_0x5bafe4[_0x4db9('0x68')],_0x5bafe4[_0x4db9('0x60')][_0x4db9('0x69')],_0x5bafe4[_0x4db9('0x60')][_0x4db9('0x1b')]);}break;case _0x4db9('0x6a'):var _0x19649c=_0x3c1ad2[_0x4db9('0x60')][_0x4db9('0x30')](',')[_0x4db9('0x2c')](function(_0x125b69){return Number(_0x125b69);});_0x19649c['forEach'](function(_0x225382){_0x36cd58['or'](_0x4db9('0x6b'),'%,'+_0x225382+',%');});_0x4f2e54=_['union'](_0x4f2e54,_0x19649c);break;case _0x4db9('0x6c'):if(_0x3c1ad2[_0x4db9('0x63')]===_0x4db9('0x6d')){_0x10dccb[_0x4f1e36](_0x4db9('0x6e'),'%'+_0x3c1ad2[_0x4db9('0x60')]+'%',null);}else{_0x3db087=_[_0x4db9('0x6f')](_0x2dca24,[_0x4db9('0x29'),_0x4db9('0x70')]);_0x3c1ad2[_0x4db9('0x47')]='UserId';_0x5bafe4=as['buildExpression'](_0x1226ea,_0x3db087[_0x4db9('0x36')],_0x3c1ad2);_0x10dccb[_0x4f1e36](_0x5bafe4[_0x4db9('0x68')],_0x5bafe4[_0x4db9('0x60')][_0x4db9('0x69')],_0x5bafe4[_0x4db9('0x60')][_0x4db9('0x1b')]);}break;case _0x4db9('0x71'):_0x5bafe4=as[_0x4db9('0x67')]('me',null,_0x3c1ad2);_0x10dccb[_0x4f1e36](_0x5bafe4[_0x4db9('0x68')],_0x5bafe4[_0x4db9('0x60')]['start'],_0x5bafe4[_0x4db9('0x60')]['end']);break;}}else{var _0x5bafe4=as['buildExpression'](_0x1226ea,_0x3db087['type'],_0x3c1ad2);_0x10dccb[_0x4f1e36](_0x5bafe4[_0x4db9('0x68')],_0x5bafe4['value']['start'],_0x5bafe4[_0x4db9('0x60')][_0x4db9('0x1b')]);}}}else{var _0xf1e173=_(_0x4f17a0[_0x4db9('0x39')])[_0x4db9('0x3a')]()[_0x4db9('0x2c')](function(_0xaea8ff){return _[_0x4db9('0x72')](_0x2dca24,[_0x4db9('0x29'),_0xaea8ff])?_0xaea8ff:undefined;})[_0x4db9('0x73')]()[_0x4db9('0x60')]();if(!_[_0x4db9('0x74')](_0xf1e173)){_0xf1e173[_0x4db9('0x31')](function(_0x1080ab){if(_0x1080ab===_0x4db9('0x75')){_0x719001[_0x4db9('0x43')]('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x4f17a0['query'][_0x1080ab]));}else if(_0x1080ab===_0x4db9('0x76')){var _0x4de478=JSON[_0x4db9('0x77')](_0x4f17a0[_0x4db9('0x39')][_0x1080ab])[_0x4db9('0x78')];var _0x4ad693=JSON['parse'](_0x4f17a0[_0x4db9('0x39')][_0x1080ab])['$lte'];_0x719001[_0x4db9('0x43')](_0x4db9('0x79'),_0x4de478,_0x4ad693);}else{if(_0x4f17a0[_0x4db9('0x39')][_0x1080ab]===_0x4db9('0x7a')){_0x719001[_0x4db9('0x43')]('i.'+_0x1080ab+'\x20IS\x20NULL');}else{_0x719001[_0x4db9('0x43')]('i.'+_0x1080ab+'\x20=\x20?',_0x4f17a0[_0x4db9('0x39')][_0x1080ab]);}}});}if(_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x7b')]){if(_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x7b')]==0x1){_0x719001['having']('`unreadMessages`\x20=\x200');}else{_0x719001[_0x4db9('0x61')](_0x4db9('0x7c'));}}if(_0x4f17a0['query']['tag']){_0x4f2e54=_[_0x4db9('0x7d')](_0x4f17a0['query'][_0x4db9('0x7e')])?_0x4f17a0['query'][_0x4db9('0x7e')]:new Array(_0x4f17a0[_0x4db9('0x39')]['tag']);_0x4f2e54['forEach'](function(_0x3de95c){_0x36cd58['or'](_0x4db9('0x6b'),'%,'+_0x3de95c+',%');});}if(_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x7f')]){var _0x3e85aa=_0x4f17a0['query']['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x4db9('0x80'));if(qs[_0x4db9('0x81')](_0x3e85aa)){_0x10dccb['or'](_0x4db9('0x82'),_0x3e85aa+'%')['or'](_0x4db9('0x83'),_0x3e85aa+'%');}else{_0x10dccb['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4db9('0x84')](_0x3e85aa))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3e85aa+'%');}}}_0x719001[_0x4db9('0x43')](_0x10dccb);_0x719001[_0x4db9('0x85')](_0x4db9('0x86'));var _0x372573={'type':db[_0x4db9('0x87')][_0x4db9('0x88')][_0x4db9('0x89')],'raw':!![]};var _0x521622=_0x719001[_0x4db9('0x8a')]();_0x521622[_0x4db9('0x47')](_0x4db9('0x86'));_0x521622['field'](_0x4db9('0x8b'),_0x4db9('0x5f'));if(_0x1494bc['order']){_0x1494bc['order'][_0x4db9('0x31')](function(_0x5aa698){_0x719001['order']('i.'+_0x5aa698[0x0],_0x5aa698[0x1]===_0x4db9('0x8c')?![]:!![]);});}if(!_[_0x4db9('0x74')](_0x4f2e54)){_0x719001[_0x4db9('0x61')](_0x36cd58);_0x521622['where']('t.id\x20IN\x20?',_0x4f2e54);}BPromise['resolve']()['then'](function(){if(!_0x34b366){if(_0x4f17a0['query'][_0x4db9('0x75')]||_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x8d')])return;_0x521622[_0x4db9('0x43')](_0x4db9('0x8e'));_0x719001[_0x4db9('0x43')](_0x4db9('0x8e'));return;}return _0x4f17a0[_0x4db9('0x8f')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x4db9('0x25')](function(_0x427434){if(_[_0x4db9('0x74')](_0x427434)){_0x521622[_0x4db9('0x43')](_0x4db9('0x90'));_0x719001[_0x4db9('0x43')](_0x4db9('0x90'));}else{_0x521622[_0x4db9('0x43')]('i.SmsAccountId\x20IN\x20?',_[_0x4db9('0x2c')](_0x427434,'id'));_0x719001['where'](_0x4db9('0x91'),_[_0x4db9('0x2c')](_0x427434,'id'));}});})[_0x4db9('0x25')](function(){db[_0x4db9('0x92')]['query'](_0x521622['toString'](),_0x372573)[_0x4db9('0x25')](function(_0x5912c9){_0x3aec38[_0x4db9('0x1d')]=_0x5912c9[_0x4db9('0x5e')];if(_0x3aec38[_0x4db9('0x1d')]===0x0)return[];return db[_0x4db9('0x92')][_0x4db9('0x39')](_0x22a021[_0x4db9('0x93')](),_0x372573)[_0x4db9('0x25')](function(_0xdd8823){_0x48aaf5=_['keyBy'](_0xdd8823,'id');_0x372573=_[_0x4db9('0x94')](_0x372573,{'model':db[_0x4db9('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f17a0[_0x4db9('0x39')][_0x4db9('0x3d')]){_0x1494bc['attributes'][_0x4db9('0x31')](function(_0x18391e){_0x719001['field']('i.'+_0x18391e);});}else{_0x719001[_0x4db9('0x47')](_0x4db9('0x8b'),_0x4db9('0x5f'));_0x719001['field']('a.key',_0x4db9('0x95'));_0x719001[_0x4db9('0x47')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x719001[_0x4db9('0x47')](_0x4db9('0x96'));_0x719001[_0x4db9('0x47')](_0x4db9('0x97'),_0x4db9('0x98'));_0x719001[_0x4db9('0x47')](_0x4db9('0x99'),_0x4db9('0x9a'));_0x719001[_0x4db9('0x47')](_0x4db9('0x9b'),_0x4db9('0x9c'));_0x719001[_0x4db9('0x47')](_0x4db9('0x9d'),_0x4db9('0x9e'));_0x719001[_0x4db9('0x47')]('c.mobile',_0x4db9('0x9f'));_0x719001['field'](_0x4db9('0xa0'),'Contact.fax');_0x719001[_0x4db9('0x47')](_0x4db9('0xa1'),_0x4db9('0xa2'));_0x719001[_0x4db9('0x47')](_0x4db9('0xa3'),_0x4db9('0xa4'));_0x719001[_0x4db9('0x47')](_0x4db9('0xa5'),_0x4db9('0x2e'));}if(_0x1494bc[_0x4db9('0x40')])_0x719001[_0x4db9('0x40')](_0x1494bc[_0x4db9('0x40')]);if(_0x1494bc['offset'])_0x719001[_0x4db9('0x1e')](_0x1494bc[_0x4db9('0x1e')]);return db['sequelize'][_0x4db9('0x39')](_0x719001[_0x4db9('0x93')](),_0x372573);})[_0x4db9('0x25')](function(_0x29e429){_0x16be76['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x4db9('0x2c')](_0x29e429,'id'));return db['sequelize'][_0x4db9('0x39')](_0x16be76[_0x4db9('0x93')](),_0x372573)[_0x4db9('0x25')](function(_0x27eeca){var _0x44a9e8=_[_0x4db9('0xa6')](_0x27eeca,'SmsInteractionId');var _0xe17e8e=[];_0x29e429[_0x4db9('0x31')](function(_0x3d02c1){_0xe17e8e[_0x4db9('0x32')](updateSmsInteraction(_0x3d02c1,_0x48aaf5,_0x44a9e8));});return BPromise[_0x4db9('0xa7')](_0xe17e8e);});});})[_0x4db9('0x25')](function(_0x41bde3){_0x3aec38['rows']=_0x41bde3;return _0x3aec38;})[_0x4db9('0x25')](respondWithFilteredResult(_0x2a9b6b,_0x1494bc));})[_0x4db9('0x33')](handleError(_0x2a9b6b,null));};exports[_0x4db9('0xa8')]=function(_0x1e47b3,_0x5ed0fe){var _0x49594a={'raw':![],'where':{'id':_0x1e47b3[_0x4db9('0xa9')]['id']}},_0x564dcf={};_0x564dcf[_0x4db9('0x38')]=_[_0x4db9('0x3a')](db['SmsInteraction']['rawAttributes']);_0x564dcf[_0x4db9('0x39')]=_[_0x4db9('0x3a')](_0x1e47b3['query']);_0x564dcf['filters']=_[_0x4db9('0x3b')](_0x564dcf[_0x4db9('0x38')],_0x564dcf['query']);_0x49594a['attributes']=_[_0x4db9('0x3b')](_0x564dcf['model'],qs['fields'](_0x1e47b3[_0x4db9('0x39')][_0x4db9('0x3d')]));_0x49594a[_0x4db9('0x3c')]=_0x49594a['attributes'][_0x4db9('0x5e')]?_0x49594a['attributes']:_0x564dcf[_0x4db9('0x38')];if(_0x1e47b3['query'][_0x4db9('0xaa')]){_0x49594a[_0x4db9('0xab')]=[{'all':!![]}];}_0x49594a=_[_0x4db9('0x94')]({},_0x49594a,_0x1e47b3[_0x4db9('0xac')]);return db[_0x4db9('0x34')][_0x4db9('0x6f')](_0x49594a)[_0x4db9('0x25')](handleEntityNotFound(_0x5ed0fe,null))['then'](respondWithResult(_0x5ed0fe,null))['catch'](handleError(_0x5ed0fe,null));};exports['create']=function(_0x5dc771,_0x1de02e){return db['SmsInteraction'][_0x4db9('0xad')](_0x5dc771['body'],{})['then'](respondWithResult(_0x1de02e,0xc9))[_0x4db9('0x33')](handleError(_0x1de02e,null));};exports['update']=function(_0x47512a,_0x3495ec){if(_0x47512a[_0x4db9('0x71')]['id']){delete _0x47512a[_0x4db9('0x71')]['id'];}return db[_0x4db9('0x34')][_0x4db9('0x6f')]({'where':{'id':_0x47512a[_0x4db9('0xa9')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x3495ec,null))[_0x4db9('0x25')](saveUpdates(_0x47512a[_0x4db9('0x71')],null))[_0x4db9('0x25')](respondWithResult(_0x3495ec,null))[_0x4db9('0x33')](handleError(_0x3495ec,null));};exports[_0x4db9('0xae')]=function(_0x2f19a6,_0x2f1200){return db['SmsInteraction'][_0x4db9('0x6f')]({'where':{'id':_0x2f19a6[_0x4db9('0xa9')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x2f1200,null))[_0x4db9('0x25')](removeEntity(_0x2f1200,null))[_0x4db9('0x33')](handleError(_0x2f1200,null));};exports[_0x4db9('0xaf')]=function(_0x16f72f,_0x5dc000){return db[_0x4db9('0x34')][_0x4db9('0xaf')]()['then'](respondWithResult(_0x5dc000,null))[_0x4db9('0x33')](handleError(_0x5dc000,null));};exports[_0x4db9('0xb0')]=function(_0x43f030,_0x5e293f,_0x5059ed){return db[_0x4db9('0xb1')][_0x4db9('0x6f')]({'where':{'id':_0x43f030[_0x4db9('0xa9')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x5e293f,null))['then'](function(_0x11de91){if(_0x11de91){return _0x11de91[_0x4db9('0xb0')](_0x43f030[_0x4db9('0x71')][_0x4db9('0xb2')],_[_0x4db9('0xb3')](_0x43f030['body'],[_0x4db9('0xb2'),'id'])||{});}})[_0x4db9('0x25')](respondWithResult(_0x5e293f,null))[_0x4db9('0x33')](handleError(_0x5e293f,null));};exports['getMessages']=function(_0xcf3981,_0x518d8b,_0x5ddae1){var _0x25577b={'raw':![],'where':{}};var _0x22d686={};var _0x12a0c0={'count':0x0,'rows':[]};return db[_0x4db9('0x34')][_0x4db9('0xb4')]({'where':{'id':_0xcf3981[_0x4db9('0xa9')]['id']}})['then'](handleEntityNotFound(_0x518d8b,null))[_0x4db9('0x25')](function(_0x474fb0){if(_0x474fb0){_0x22d686['model']=_[_0x4db9('0x3a')](db[_0x4db9('0xb1')][_0x4db9('0x35')]);_0x22d686['query']=_[_0x4db9('0x3a')](_0xcf3981[_0x4db9('0x39')]);_0x22d686[_0x4db9('0x44')]=_[_0x4db9('0x3b')](_0x22d686[_0x4db9('0x38')],_0x22d686[_0x4db9('0x39')]);_0x25577b[_0x4db9('0x3c')]=_['intersection'](_0x22d686[_0x4db9('0x38')],qs[_0x4db9('0x3d')](_0xcf3981['query'][_0x4db9('0x3d')]));_0x25577b[_0x4db9('0x3c')]=_0x25577b[_0x4db9('0x3c')][_0x4db9('0x5e')]?_0x25577b[_0x4db9('0x3c')]:_0x22d686[_0x4db9('0x38')];if(!_0xcf3981['query']['hasOwnProperty'](_0x4db9('0x3f'))){_0x25577b[_0x4db9('0x40')]=qs[_0x4db9('0x40')](_0xcf3981[_0x4db9('0x39')][_0x4db9('0x40')]);_0x25577b['offset']=qs[_0x4db9('0x1e')](_0xcf3981[_0x4db9('0x39')][_0x4db9('0x1e')]);}_0x25577b['order']=qs[_0x4db9('0x42')](_0xcf3981[_0x4db9('0x39')]['sort']);_0x25577b[_0x4db9('0x43')]=qs[_0x4db9('0x44')](_['pick'](_0xcf3981[_0x4db9('0x39')],_0x22d686[_0x4db9('0x44')]));_0x25577b[_0x4db9('0x43')]['SmsInteractionId']=_0x474fb0['id'];if(_0xcf3981['query']['filter']){_0x25577b[_0x4db9('0x43')]=_[_0x4db9('0x94')](_0x25577b['where'],{'$or':_[_0x4db9('0x2c')](_0x25577b[_0x4db9('0x3c')],function(_0x6dc7ac){var _0x39c33a={};_0x39c33a[_0x6dc7ac]={'$like':'%'+_0xcf3981[_0x4db9('0x39')][_0x4db9('0x7f')]+'%'};return _0x39c33a;})});}if(_0xcf3981[_0x4db9('0x39')]['$gte']){var _0x22ba86=_0xcf3981['query']['$gte'][_0x4db9('0x30')](',');var _0x509b91={};_0x509b91[_0x22ba86[0x0]]={'$gte':moment(_0x22ba86[0x1])[_0x4db9('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x25577b['where']=_['merge'](_0x25577b['where'],_0x509b91);}_0x25577b=_[_0x4db9('0x94')]({},_0x25577b,_0xcf3981[_0x4db9('0xac')]);return db[_0x4db9('0xb1')][_0x4db9('0x1d')]({'where':_0x25577b['where']})[_0x4db9('0x25')](function(_0x28d14c){_0x12a0c0['count']=_0x28d14c;if(_0xcf3981[_0x4db9('0x39')][_0x4db9('0xaa')]){_0x25577b[_0x4db9('0xab')]=[{'all':!![]}];}return db[_0x4db9('0xb1')][_0x4db9('0xb6')](_0x25577b);})[_0x4db9('0x25')](function(_0x5c35f0){_0x12a0c0[_0x4db9('0xb7')]=_0x5c35f0;return _0x12a0c0;});}})[_0x4db9('0x25')](respondWithFilteredResult(_0x518d8b,_0x25577b))['catch'](handleError(_0x518d8b,null));};exports[_0x4db9('0xb8')]=function(_0x131e92,_0x2e89cb,_0x19e6be){return db[_0x4db9('0x34')][_0x4db9('0x6f')]({'where':{'id':_0x131e92[_0x4db9('0xa9')]['id']}})['then'](handleEntityNotFound(_0x2e89cb,null))[_0x4db9('0x25')](function(_0x1270f9){if(_0x1270f9){return _0x1270f9[_0x4db9('0xb9')](_0x131e92['body'][_0x4db9('0xb2')],_['omit'](_0x131e92[_0x4db9('0x71')],[_0x4db9('0xb2'),'id'])||{})[_0x4db9('0xba')](function(){return db[_0x4db9('0x6a')][_0x4db9('0xb6')]({'attributes':['id','name',_0x4db9('0xbb')],'where':{'id':_0x131e92[_0x4db9('0x71')]['ids']}});})[_0x4db9('0x25')](function(_0x5d5132){socket['emit'](_0x4db9('0xbc'),{'id':Number(_0x131e92[_0x4db9('0xa9')]['id']),'tags':_0x5d5132||[]});return{'id':Number(_0x131e92[_0x4db9('0xa9')]['id']),'tags':_0x5d5132||[]};});}})[_0x4db9('0x25')](respondWithResult(_0x2e89cb,null))[_0x4db9('0x33')](handleError(_0x2e89cb,null));};exports[_0x4db9('0xbd')]=function(_0x1a0de2,_0x3bebc3,_0x56de0e){return db[_0x4db9('0x34')][_0x4db9('0x6f')]({'where':{'id':_0x1a0de2[_0x4db9('0xa9')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x3bebc3,null))[_0x4db9('0x25')](function(_0x4bfe67){if(_0x4bfe67){return _0x4bfe67['removeTags'](_0x1a0de2['query'][_0x4db9('0xb2')]);}})['then'](respondWithStatusCode(_0x3bebc3,null))[_0x4db9('0x33')](handleError(_0x3bebc3,null));};exports[_0x4db9('0xbe')]=function(_0x3b7bdf,_0x5bba48){var _0x205751=moment()['unix']()[_0x4db9('0x93')]();var _0x10e60f=path['join'](config[_0x4db9('0xbf')],'server',_0x4db9('0xc0'),_0x4db9('0xc1'));var _0x30bde3=path[_0x4db9('0xc2')](config[_0x4db9('0xbf')],'server','files','attachments');var _0x2860d6=path[_0x4db9('0xc2')](_0x10e60f,_0x205751);var _0x3ac397=util[_0x4db9('0xb5')](_0x4db9('0xc3'),_0x3b7bdf[_0x4db9('0xa9')]['id'],_0x205751);var _0x3f36a0=path[_0x4db9('0xc2')](_0x10e60f,_0x3ac397);var _0x1d0751=[];_0x1d0751[_0x4db9('0x32')]({'model':db[_0x4db9('0x6c')],'as':_0x4db9('0x6c'),'attributes':['id',_0x4db9('0x2d')],'raw':!![]});_0x1d0751[_0x4db9('0x32')]({'model':db[_0x4db9('0xc4')],'as':_0x4db9('0xc5'),'attributes':['id',_0x4db9('0xc6'),_0x4db9('0xc7')],'raw':!![]});var _0x8a5442=[{'model':db[_0x4db9('0xb1')],'as':_0x4db9('0xc8'),'attributes':['id','body',_0x4db9('0x76'),'direction',_0x4db9('0xc9'),'read'],'include':_0x1d0751}];_0x8a5442[_0x4db9('0x32')]({'model':db[_0x4db9('0xca')],'as':_0x4db9('0xcb'),'attributes':['id',_0x4db9('0x29')]});_0x8a5442['push']({'model':db[_0x4db9('0x6c')],'as':_0x4db9('0xcc'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x4db9('0x6f')]({'where':{'id':_0x3b7bdf[_0x4db9('0xa9')]['id']},'include':_0x8a5442})[_0x4db9('0x25')](handleEntityNotFound(_0x5bba48,null))[_0x4db9('0x25')](function(_0x419cf1){if(_0x419cf1){var _0x161048=_0x419cf1['get']({'plain':!![]});fs[_0x4db9('0xcd')](_0x2860d6);var _0x15956b={'format':'A4','border':_0x4db9('0xce'),'header':{'height':'40px','contents':{'first':_0x4db9('0xcf')}},'footer':{'height':'30px','contents':{'default':util[_0x4db9('0xb5')](_0x4db9('0xd0'),util[_0x4db9('0xb5')](_0x4db9('0xd1'),_0x4db9('0xd2'),_0x161048['id']),moment()[_0x4db9('0xb5')](_0x4db9('0xd3'))[_0x4db9('0x93')]())}}};var _0x18ffad={'channel':_0x4db9('0xd2'),'account':_0x161048['Account'][_0x4db9('0x29')],'agent':_0x161048[_0x4db9('0xcc')]?_0x161048[_0x4db9('0xcc')][_0x4db9('0x2d')]:_0x4db9('0xd4'),'createdAt':moment(_0x161048[_0x4db9('0x76')])[_0x4db9('0xb5')](_0x4db9('0xd5'))['toString'](),'closedAt':_0x161048['closed']?moment(_0x161048['closedAt'])['format'](_0x4db9('0xd5'))['toString']():'','disposition':_0x161048[_0x4db9('0xd6')],'messages':_(_0x161048[_0x4db9('0xc8')])[_0x4db9('0x7f')]({'secret':![]})[_0x4db9('0x2c')](function(_0xae69a1){return{'date':moment(_0xae69a1[_0x4db9('0x76')])[_0x4db9('0xb5')](_0x4db9('0xd5'))[_0x4db9('0x93')](),'sender':_0xae69a1['direction']==='out'?_0xae69a1[_0x4db9('0x6c')]?_0xae69a1[_0x4db9('0x6c')][_0x4db9('0x2d')]:_0x4db9('0xd7'):_0xae69a1[_0x4db9('0xc5')][_0x4db9('0xc6')]+(_0xae69a1[_0x4db9('0xc5')][_0x4db9('0xc7')]?'\x20'+_0xae69a1[_0x4db9('0xc5')][_0x4db9('0xc7')]:''),'body':_0xae69a1[_0x4db9('0x71')],'direction':_0xae69a1[_0x4db9('0xd8')]==='out'?'A':'C','secret':_0xae69a1[_0x4db9('0xc9')],'read':_0xae69a1[_0x4db9('0x7b')]};})[_0x4db9('0x60')]()};return ejs[_0x4db9('0xd9')](path['join'](config['root'],_0x4db9('0xda'),_0x4db9('0xdb'),_0x4db9('0xdc')),{'interaction':_0x18ffad})['then'](function(_0x115964){return new BPromise(function(_0xde1699,_0x4ef644){pdf[_0x4db9('0xad')](_0x115964,_0x15956b)[_0x4db9('0xdd')](path['join'](_0x2860d6,_0x4db9('0xde')+_0x161048['id']+'-'+_0x205751+'.pdf'),function(_0x5750ab,_0x4ae593){if(_0x5750ab)return _0x4ef644(_0x5750ab);_0xde1699(_0x4ae593);});});})['then'](function(){return new BPromise(function(_0x2a8b0e,_0x78de3){zipdir(_0x2860d6,{'saveTo':_0x3f36a0},function(_0x2c5afb,_0x41b8b3){if(_0x2c5afb)return _0x78de3(_0x2c5afb);return _0x2a8b0e(_0x41b8b3);});})[_0x4db9('0x25')](function(){return new BPromise(function(_0x2527f5,_0x4754f3){rimraf(_0x2860d6,function(_0x35599b){if(_0x35599b)_0x4754f3(_0x35599b);return _0x2527f5();});});})[_0x4db9('0x25')](function(){return _0x5bba48['download'](_0x3f36a0,_0x3ac397,function(_0x4df2a7){if(_0x4df2a7){console[_0x4db9('0xdf')]('err',_0x4df2a7);}else{fs[_0x4db9('0xe0')](_0x3f36a0);}});});});}else{return _0x5bba48[_0x4db9('0x26')](0xc8);}})[_0x4db9('0x33')](handleError(_0x5bba48,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8a469ac..c38af7b 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 _0x9649=['remove','getUsers','then','setDataValue','map','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save'];(function(_0x59445d,_0x4bb626){var _0x5b820f=function(_0x54975){while(--_0x54975){_0x59445d['push'](_0x59445d['shift']());}};_0x5b820f(++_0x4bb626);}(_0x9649,0x19f));var _0x9964=function(_0x2de607,_0x4f6b43){_0x2de607=_0x2de607-0x0;var _0x132b0f=_0x9649[_0x2de607];return _0x132b0f;};'use strict';var EventEmitter=require(_0x9964('0x0'));var SmsInteraction=require(_0x9964('0x1'))['db'][_0x9964('0x2')];var SmsMessage=require(_0x9964('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9964('0x3')](0x0);var events={'afterCreate':_0x9964('0x4'),'afterUpdate':'update','afterDestroy':_0x9964('0x5')};function emitEvent(_0x4b5a66){return function(_0xa0afe,_0x32aeb4,_0x12dd14){_0xa0afe[_0x9964('0x6')]({'attributes':['id'],'raw':!![]})[_0x9964('0x7')](function(_0x1338e7){_0xa0afe[_0x9964('0x8')]('Users',_0x1338e7[_0x9964('0x9')](function(_0x67291b){return{'id':_0x67291b['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0xa0afe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9964('0x7')](function(_0x3fbce9){_0xa0afe['setDataValue']('unreadMessages',_0x3fbce9[_0x9964('0xa')]);SmsInteractionEvents[_0x9964('0xb')](_0x4b5a66+':'+_0xa0afe['id'],_0xa0afe);SmsInteractionEvents[_0x9964('0xb')](_0x4b5a66,_0xa0afe);_0x12dd14(null);})[_0x9964('0xc')](_0x12dd14(null));};}for(var e in events){if(events[_0x9964('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x9964('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xb647=['save','update','getUsers','then','setDataValue','Users','map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x50132c,_0x217229){var _0x1b094a=function(_0x11adfd){while(--_0x11adfd){_0x50132c['push'](_0x50132c['shift']());}};_0x1b094a(++_0x217229);}(_0xb647,0xdb));var _0x7b64=function(_0x2daf87,_0x19034e){_0x2daf87=_0x2daf87-0x0;var _0x20b943=_0xb647[_0x2daf87];return _0x20b943;};'use strict';var EventEmitter=require(_0x7b64('0x0'));var SmsInteraction=require(_0x7b64('0x1'))['db'][_0x7b64('0x2')];var SmsMessage=require(_0x7b64('0x1'))['db'][_0x7b64('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7b64('0x4')](0x0);var events={'afterCreate':_0x7b64('0x5'),'afterUpdate':_0x7b64('0x6'),'afterDestroy':'remove'};function emitEvent(_0x36ff12){return function(_0x4aaa21,_0x1daa28,_0x38ebf7){_0x4aaa21[_0x7b64('0x7')]({'attributes':['id'],'raw':!![]})[_0x7b64('0x8')](function(_0xcdec41){_0x4aaa21[_0x7b64('0x9')](_0x7b64('0xa'),_0xcdec41[_0x7b64('0xb')](function(_0x432ced){return{'id':_0x432ced['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4aaa21['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b64('0x8')](function(_0x49718f){_0x4aaa21[_0x7b64('0x9')]('unreadMessages',_0x49718f['length']);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12+':'+_0x4aaa21['id'],_0x4aaa21);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12,_0x4aaa21);_0x38ebf7(null);})['catch'](_0x38ebf7(null));};}for(var e in events){if(events[_0x7b64('0xd')](e)){var event=events[e];SmsInteraction[_0x7b64('0xe')](e,emitEvent(event));}}module[_0x7b64('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index bfb4984..cc9aaf1 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 _0x30cb=['api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0x30cb,0x1be));var _0xb30c=function(_0x103e8f,_0x786d03){_0x103e8f=_0x103e8f-0x0;var _0x2523f8=_0x30cb[_0x103e8f];return _0x2523f8;};'use strict';var _=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var logger=require('../../config/logger')(_0xb30c('0x2'));var moment=require(_0xb30c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb30c('0x4'));var fs=require('fs');var path=require(_0xb30c('0x5'));var rimraf=require(_0xb30c('0x6'));var config=require(_0xb30c('0x7'));var attributes=require(_0xb30c('0x8'));module[_0xb30c('0x9')]=function(_0x5a03b2,_0x3d1990){return _0x5a03b2['define'](_0xb30c('0xa'),attributes,{'tableName':_0xb30c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25f175,_0x609819,_0x2998b7){if(_0x25f175['changed']('closed')){_0x25f175['closedAt']=moment()[_0xb30c('0xc')](_0xb30c('0xd'));}_0x2998b7(null,_0x25f175);}}});}; \ No newline at end of file +var _0x3385=['define','sms_interactions','changed','closedAt','format','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x46889a,_0xa25854){var _0x6969a1=function(_0x51857d){while(--_0x51857d){_0x46889a['push'](_0x46889a['shift']());}};_0x6969a1(++_0xa25854);}(_0x3385,0x65));var _0x5338=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0x3385[_0x51d71a];return _0xff01f1;};'use strict';var _=require(_0x5338('0x0'));var util=require(_0x5338('0x1'));var logger=require('../../config/logger')(_0x5338('0x2'));var moment=require(_0x5338('0x3'));var BPromise=require(_0x5338('0x4'));var rp=require(_0x5338('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5338('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3138e0,_0x2dab81){return _0x3138e0[_0x5338('0x7')]('SmsInteraction',attributes,{'tableName':_0x5338('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f7019,_0x5ed6bd,_0x293f4e){if(_0x2f7019[_0x5338('0x9')]('closed')){_0x2f7019[_0x5338('0xa')]=moment()[_0x5338('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x293f4e(null,_0x2f7019);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d398a78..bf12734 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 _0xffd8=['error','code','SmsInteraction,\x20%s,\x20%s','message','result','SmsInteraction','update','body','options','where','limit','UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','addTags','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsInteraction.socket','register','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44ea17,_0x422059){var _0x1d8af1=function(_0x159a75){while(--_0x159a75){_0x44ea17['push'](_0x44ea17['shift']());}};_0x1d8af1(++_0x422059);}(_0xffd8,0x1e0));var _0x8ffd=function(_0x23eec2,_0x5c7253){_0x23eec2=_0x23eec2-0x0;var _0x419075=_0xffd8[_0x23eec2];return _0x419075;};'use strict';var _=require(_0x8ffd('0x0'));var util=require(_0x8ffd('0x1'));var moment=require(_0x8ffd('0x2'));var BPromise=require(_0x8ffd('0x3'));var rs=require(_0x8ffd('0x4'));var fs=require('fs');var Redis=require(_0x8ffd('0x5'));var db=require(_0x8ffd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ffd('0x7'))(_0x8ffd('0x8'));var config=require(_0x8ffd('0x9'));var jayson=require(_0x8ffd('0xa'));var client=jayson[_0x8ffd('0xb')][_0x8ffd('0xc')]({'port':0x232a});config['redis']=_[_0x8ffd('0xd')](config[_0x8ffd('0xe')],{'host':_0x8ffd('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ffd('0xe')]));require(_0x8ffd('0x10'))[_0x8ffd('0x11')](socket);function respondWithRpcPromise(_0x383668,_0xc0f86a,_0x2ed9ce){return new BPromise(function(_0x356e0b,_0x44ba49){return client['request'](_0x383668,_0x2ed9ce)[_0x8ffd('0x12')](function(_0x338f7d){logger[_0x8ffd('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xc0f86a,_0x8ffd('0x14'));logger[_0x8ffd('0x15')](_0x8ffd('0x16'),_0xc0f86a,_0x8ffd('0x14'),JSON[_0x8ffd('0x17')](_0x338f7d));if(_0x338f7d[_0x8ffd('0x18')]){if(_0x338f7d[_0x8ffd('0x18')][_0x8ffd('0x19')]===0x1f4){logger['error'](_0x8ffd('0x1a'),_0xc0f86a,_0x338f7d['error'][_0x8ffd('0x1b')]);return _0x44ba49(_0x338f7d[_0x8ffd('0x18')][_0x8ffd('0x1b')]);}logger[_0x8ffd('0x18')](_0x8ffd('0x1a'),_0xc0f86a,_0x338f7d[_0x8ffd('0x18')][_0x8ffd('0x1b')]);return _0x356e0b(_0x338f7d['error'][_0x8ffd('0x1b')]);}else{logger[_0x8ffd('0x13')](_0x8ffd('0x1a'),_0xc0f86a,_0x8ffd('0x14'));_0x356e0b(_0x338f7d[_0x8ffd('0x1c')][_0x8ffd('0x1b')]);}})['catch'](function(_0x496993){logger[_0x8ffd('0x18')](_0x8ffd('0x1a'),_0xc0f86a,_0x496993);_0x44ba49(_0x496993);});});}exports['UpdateSmsInteraction']=function(_0x51a5e1){var _0x22afc0=this;return new Promise(function(_0x161e3c,_0x116f00){return db[_0x8ffd('0x1d')][_0x8ffd('0x1e')](_0x51a5e1[_0x8ffd('0x1f')],{'raw':_0x51a5e1[_0x8ffd('0x20')]?_0x51a5e1[_0x8ffd('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51a5e1['options']?_0x51a5e1[_0x8ffd('0x20')][_0x8ffd('0x21')]||null:null,'attributes':_0x51a5e1['options']?_0x51a5e1[_0x8ffd('0x20')]['attributes']||null:null,'limit':_0x51a5e1[_0x8ffd('0x20')]?_0x51a5e1['options'][_0x8ffd('0x22')]||null:null})[_0x8ffd('0x12')](function(_0x522128){logger[_0x8ffd('0x13')](_0x8ffd('0x23'),_0x51a5e1);logger[_0x8ffd('0x15')](_0x8ffd('0x23'),_0x51a5e1,JSON[_0x8ffd('0x17')](_0x522128));_0x161e3c(_0x522128);})[_0x8ffd('0x24')](function(_0x46f61a){logger[_0x8ffd('0x18')]('UpdateSmsInteraction',_0x46f61a[_0x8ffd('0x1b')],_0x51a5e1);_0x116f00(_0x22afc0[_0x8ffd('0x18')](0x1f4,_0x46f61a['message']));});});};exports[_0x8ffd('0x25')]=function(_0x37b77c){return new Promise(function(_0xeea760,_0x680a13){return db[_0x8ffd('0x1d')][_0x8ffd('0x26')]({'where':_0x37b77c[_0x8ffd('0x20')]?_0x37b77c['options'][_0x8ffd('0x21')]||null:null})[_0x8ffd('0x12')](function(_0x32c259){if(_0x32c259){return _0x32c259[_0x8ffd('0x27')](_0x37b77c['body']['ids'],_[_0x8ffd('0x28')](_0x37b77c['body'],['ids','id'])||{});}})['spread'](function(_0xcac316){logger[_0x8ffd('0x13')](_0x8ffd('0x29'),_0x37b77c);logger[_0x8ffd('0x15')]('AddTags',_0x37b77c,JSON[_0x8ffd('0x17')](_0xcac316));_0xeea760(_0xcac316);})[_0x8ffd('0x24')](function(_0x3bbf5c){logger[_0x8ffd('0x18')](_0x8ffd('0x29'),_0x3bbf5c[_0x8ffd('0x1b')],_0x37b77c);_0x680a13(_this[_0x8ffd('0x18')](0x1f4,_0x3bbf5c[_0x8ffd('0x1b')]));});});}; \ No newline at end of file +var _0x903f=['body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags'];(function(_0x5a5b3c,_0x35ba42){var _0x463b09=function(_0x3d1cd9){while(--_0x3d1cd9){_0x5a5b3c['push'](_0x5a5b3c['shift']());}};_0x463b09(++_0x35ba42);}(_0x903f,0x8f));var _0xf903=function(_0xcd3dfc,_0x5710f0){_0xcd3dfc=_0xcd3dfc-0x0;var _0x41013e=_0x903f[_0xcd3dfc];return _0x41013e;};'use strict';var _=require(_0xf903('0x0'));var util=require(_0xf903('0x1'));var moment=require(_0xf903('0x2'));var BPromise=require(_0xf903('0x3'));var rs=require(_0xf903('0x4'));var fs=require('fs');var Redis=require(_0xf903('0x5'));var db=require(_0xf903('0x6'))['db'];var utils=require(_0xf903('0x7'));var logger=require(_0xf903('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf903('0x9'));var client=jayson['client'][_0xf903('0xa')]({'port':0x232a});config[_0xf903('0xb')]=_[_0xf903('0xc')](config[_0xf903('0xb')],{'host':_0xf903('0xd'),'port':0x18eb});var socket=require(_0xf903('0xe'))(new Redis(config['redis']));require(_0xf903('0xf'))[_0xf903('0x10')](socket);function respondWithRpcPromise(_0x529896,_0xf79aa4,_0x437298){return new BPromise(function(_0x27b772,_0x1a5967){return client[_0xf903('0x11')](_0x529896,_0x437298)[_0xf903('0x12')](function(_0x385aaf){logger[_0xf903('0x13')](_0xf903('0x14'),_0xf79aa4,_0xf903('0x15'));logger[_0xf903('0x16')](_0xf903('0x17'),_0xf79aa4,'request\x20sent',JSON[_0xf903('0x18')](_0x385aaf));if(_0x385aaf[_0xf903('0x19')]){if(_0x385aaf['error'][_0xf903('0x1a')]===0x1f4){logger[_0xf903('0x19')](_0xf903('0x14'),_0xf79aa4,_0x385aaf[_0xf903('0x19')][_0xf903('0x1b')]);return _0x1a5967(_0x385aaf[_0xf903('0x19')][_0xf903('0x1b')]);}logger[_0xf903('0x19')](_0xf903('0x14'),_0xf79aa4,_0x385aaf[_0xf903('0x19')][_0xf903('0x1b')]);return _0x27b772(_0x385aaf[_0xf903('0x19')]['message']);}else{logger[_0xf903('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xf79aa4,_0xf903('0x15'));_0x27b772(_0x385aaf[_0xf903('0x1c')][_0xf903('0x1b')]);}})[_0xf903('0x1d')](function(_0x4077f6){logger[_0xf903('0x19')](_0xf903('0x14'),_0xf79aa4,_0x4077f6);_0x1a5967(_0x4077f6);});});}exports[_0xf903('0x1e')]=function(_0x4e5fc){var _0x5a146a=this;return new Promise(function(_0x24e93b,_0x18ad74){return db[_0xf903('0x1f')][_0xf903('0x20')](_0x4e5fc['body'],{'raw':_0x4e5fc[_0xf903('0x21')]?_0x4e5fc['options'][_0xf903('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5fc[_0xf903('0x21')]?_0x4e5fc['options'][_0xf903('0x23')]||null:null,'attributes':_0x4e5fc[_0xf903('0x21')]?_0x4e5fc[_0xf903('0x21')][_0xf903('0x24')]||null:null,'limit':_0x4e5fc[_0xf903('0x21')]?_0x4e5fc[_0xf903('0x21')][_0xf903('0x25')]||null:null})[_0xf903('0x12')](function(_0xf65c48){logger[_0xf903('0x13')]('UpdateSmsInteraction',_0x4e5fc);logger[_0xf903('0x16')](_0xf903('0x1e'),_0x4e5fc,JSON[_0xf903('0x18')](_0xf65c48));_0x24e93b(_0xf65c48);})[_0xf903('0x1d')](function(_0x142e06){logger[_0xf903('0x19')](_0xf903('0x1e'),_0x142e06[_0xf903('0x1b')],_0x4e5fc);_0x18ad74(_0x5a146a[_0xf903('0x19')](0x1f4,_0x142e06['message']));});});};exports[_0xf903('0x26')]=function(_0x2c97c7){return new Promise(function(_0x4c6ce8,_0x34a093){return db[_0xf903('0x1f')][_0xf903('0x27')]({'where':_0x2c97c7[_0xf903('0x21')]?_0x2c97c7[_0xf903('0x21')][_0xf903('0x23')]||null:null})['then'](function(_0x2847bb){if(_0x2847bb){return _0x2847bb[_0xf903('0x28')](_0x2c97c7[_0xf903('0x29')][_0xf903('0x2a')],_[_0xf903('0x2b')](_0x2c97c7[_0xf903('0x29')],[_0xf903('0x2a'),'id'])||{});}})[_0xf903('0x2c')](function(_0x5699a9){logger[_0xf903('0x13')]('AddTags',_0x2c97c7);logger['debug']('AddTags',_0x2c97c7,JSON[_0xf903('0x18')](_0x5699a9));_0x4c6ce8(_0x5699a9);})[_0xf903('0x1d')](function(_0x5b6f61){logger[_0xf903('0x19')](_0xf903('0x2d'),_0x5b6f61['message'],_0x2c97c7);_0x34a093(_this[_0xf903('0x19')](0x1f4,_0x5b6f61[_0xf903('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index cae2213..8494ac4 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2032,0xd9));var _0x2203=function(_0x58ef54,_0x283ecc){_0x58ef54=_0x58ef54-0x0;var _0x1c7797=_0x2032[_0x58ef54];return _0x1c7797;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x240350,_0x210c35){var _0x46a33d=function(_0x13a9e7){while(--_0x13a9e7){_0x240350['push'](_0x240350['shift']());}};_0x46a33d(++_0x210c35);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4f954ce..f1455fb 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 _0x61ea=['smsmessage:create','create','post','/:id/status','put','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','tracked','sms'];(function(_0x39af25,_0x51187b){var _0x5a8ae2=function(_0x76e1e2){while(--_0x76e1e2){_0x39af25['push'](_0x39af25['shift']());}};_0x5a8ae2(++_0x51187b);}(_0x61ea,0x1d5));var _0xa61e=function(_0x342928,_0x1b8983){_0x342928=_0x342928-0x0;var _0x5d8a16=_0x61ea[_0x342928];return _0x5d8a16;};'use strict';var multer=require(_0xa61e('0x0'));var util=require(_0xa61e('0x1'));var path=require(_0xa61e('0x2'));var timeout=require(_0xa61e('0x3'));var express=require('express');var router=express[_0xa61e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa61e('0x5'));var controller=require('./smsMessage.controller');router[_0xa61e('0x6')]('/',auth[_0xa61e('0x7')](),controller[_0xa61e('0x8')]);router[_0xa61e('0x6')](_0xa61e('0x9'),auth[_0xa61e('0x7')](),controller[_0xa61e('0xa')]);router[_0xa61e('0x6')](_0xa61e('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa61e('0x7')](),interaction[_0xa61e('0xc')](_0xa61e('0xd'),_0xa61e('0xe')),controller[_0xa61e('0xf')]);router[_0xa61e('0x10')](_0xa61e('0x11'),controller['status']);router[_0xa61e('0x12')](_0xa61e('0xb'),auth[_0xa61e('0x7')](),controller['update']);router[_0xa61e('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0xa61e('0x13')]);router[_0xa61e('0x12')](_0xa61e('0x14'),auth[_0xa61e('0x7')](),controller[_0xa61e('0x15')]);router['delete'](_0xa61e('0xb'),auth[_0xa61e('0x7')](),controller['destroy']);module[_0xa61e('0x16')]=router; \ No newline at end of file +var _0x4f09=['/describe','isAuthenticated','describe','/:id','post','smsmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4f09,0x1d2));var _0x94f0=function(_0x276167,_0x21086e){_0x276167=_0x276167-0x0;var _0x27a866=_0x4f09[_0x276167];return _0x27a866;};'use strict';var multer=require(_0x94f0('0x0'));var util=require(_0x94f0('0x1'));var path=require(_0x94f0('0x2'));var timeout=require('connect-timeout');var express=require(_0x94f0('0x3'));var router=express['Router']();var auth=require(_0x94f0('0x4'));var interaction=require(_0x94f0('0x5'));var config=require(_0x94f0('0x6'));var controller=require(_0x94f0('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x94f0('0x8')](_0x94f0('0x9'),auth[_0x94f0('0xa')](),controller[_0x94f0('0xb')]);router[_0x94f0('0x8')](_0x94f0('0xc'),auth[_0x94f0('0xa')](),controller['show']);router[_0x94f0('0xd')]('/',auth[_0x94f0('0xa')](),interaction['tracked']('sms',_0x94f0('0xe')),controller[_0x94f0('0xf')]);router[_0x94f0('0xd')](_0x94f0('0x10'),controller[_0x94f0('0x11')]);router[_0x94f0('0x12')](_0x94f0('0xc'),auth[_0x94f0('0xa')](),controller[_0x94f0('0x13')]);router['put']('/:id/accept',auth[_0x94f0('0xa')](),controller[_0x94f0('0x14')]);router['put'](_0x94f0('0x15'),auth[_0x94f0('0xa')](),controller['reject']);router[_0x94f0('0x16')](_0x94f0('0xc'),auth[_0x94f0('0xa')](),controller[_0x94f0('0x17')]);module[_0x94f0('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 9896981..cd6f55f 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 _0x1b3e=['DATE','medium','ENUM','out','STRING'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x1b3e,0x128));var _0xe1b3=function(_0x19d672,_0x3b1afa){_0x19d672=_0x19d672-0x0;var _0x1a9916=_0x1b3e[_0x19d672];return _0x1a9916;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xe1b3('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe1b3('0x1')]('in','out'),'defaultValue':_0xe1b3('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe1b3('0x3')](0xbe)},'phone':{'type':Sequelize[_0xe1b3('0x3')]},'readAt':{'type':Sequelize[_0xe1b3('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x777d=['TEXT','medium','ENUM','out','DATE','exports'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x777d,0xe9));var _0xd777=function(_0x153846,_0x1227ad){_0x153846=_0x153846-0x0;var _0x3ee557=_0x777d[_0x153846];return _0x3ee557;};'use strict';var Sequelize=require('sequelize');module[_0xd777('0x0')]={'body':{'type':Sequelize[_0xd777('0x1')](_0xd777('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd777('0x3')]('in',_0xd777('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xd777('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 819dc0a..7d9de0f 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 _0x58d6=['get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','acceptMessage','manual','interface','channel','accept','EventManager','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','SmsMessage','include','findAll','show','params','keys','length','includeAll','find','create','body','describe','../../config/logger','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact'];(function(_0x1ac736,_0x5ea881){var _0x450b8c=function(_0x459556){while(--_0x459556){_0x1ac736['push'](_0x1ac736['shift']());}};_0x450b8c(++_0x5ea881);}(_0x58d6,0x1d3));var _0x658d=function(_0x3d2012,_0x3d02b9){_0x3d2012=_0x3d2012-0x0;var _0x53d542=_0x58d6[_0x3d2012];return _0x53d542;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x658d('0x0'));var rimraf=require(_0x658d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x658d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x658d('0x3'));var Mustache=require(_0x658d('0x4'));var util=require(_0x658d('0x5'));var path=require(_0x658d('0x6'));var sox=require('sox');var csv=require(_0x658d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x658d('0x8'));var squel=require(_0x658d('0x9'));var crypto=require(_0x658d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x658d('0xb'));var toCsv=require(_0x658d('0x7'));var querystring=require(_0x658d('0xc'));var Papa=require('papaparse');var Redis=require(_0x658d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x658d('0xe'));var as=require(_0x658d('0xf'));var hardwareService=require(_0x658d('0x10'));var logger=require('../../config/logger')(_0x658d('0x11'));var utils=require(_0x658d('0x12'));var config=require(_0x658d('0x13'));var db=require(_0x658d('0x14'))['db'];config[_0x658d('0x15')]=_[_0x658d('0x16')](config[_0x658d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x658d('0x17'))(new Redis(config[_0x658d('0x15')]));require(_0x658d('0x18'))[_0x658d('0x19')](socket);var jayson=require(_0x658d('0x1a'));var client=jayson[_0x658d('0x1b')][_0x658d('0x1c')]({'port':0x232c});var client9002=jayson[_0x658d('0x1b')][_0x658d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x17b20f,_0x284431,_0x42aae9){if(_0x42aae9){var _0x2d8968=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d8968['test'](_0x284431)){return _0x17b20f;}else{throw new db[(_0x658d('0x1d'))][(_0x658d('0x1e'))](_0x658d('0x1f'));}}else{return _0x17b20f;}}function respondWithRpcPromise(_0x61cfa6,_0x8bcf62,_0x25769e,_0x13aa47){return new BPromise(function(_0x3cdc74,_0x331750){var _0x50b4c3=_0x13aa47||client;return _0x50b4c3['request'](_0x61cfa6,_0x25769e)[_0x658d('0x20')](function(_0x2a45dc){logger[_0x658d('0x21')](_0x658d('0x22'),_0x8bcf62,_0x658d('0x23'));logger[_0x658d('0x24')](_0x658d('0x25'),_0x8bcf62,_0x658d('0x23'),JSON[_0x658d('0x26')](_0x2a45dc));if(_0x2a45dc['error']){if(_0x2a45dc['error'][_0x658d('0x27')]===0x1f4){logger[_0x658d('0x28')]('SmsMessage,\x20%s,\x20%s',_0x8bcf62,_0x2a45dc[_0x658d('0x28')][_0x658d('0x29')]);return _0x331750(_0x2a45dc[_0x658d('0x28')]['message']);}logger['error'](_0x658d('0x22'),_0x8bcf62,_0x2a45dc[_0x658d('0x28')]['message']);return _0x3cdc74(_0x2a45dc[_0x658d('0x28')][_0x658d('0x29')]);}else{logger['info'](_0x658d('0x22'),_0x8bcf62,_0x658d('0x23'));_0x3cdc74(_0x2a45dc[_0x658d('0x2a')]['message']);}})[_0x658d('0x2b')](function(_0x12107d){logger[_0x658d('0x28')](_0x658d('0x22'),_0x8bcf62,_0x12107d);_0x331750(_0x12107d);});});}function respondWithStatusCode(_0xb2f751,_0x160d77){_0x160d77=_0x160d77||0xcc;return function(_0x1924aa){if(_0x1924aa){return _0xb2f751[_0x658d('0x2c')](_0x160d77);}return _0xb2f751[_0x658d('0x2d')](_0x160d77)[_0x658d('0x2e')]();};}function respondWithResult(_0x38cd62,_0x323042){_0x323042=_0x323042||0xc8;return function(_0x4c5176){if(_0x4c5176){return _0x38cd62[_0x658d('0x2d')](_0x323042)[_0x658d('0x2f')](_0x4c5176);}};}function respondWithFilteredResult(_0x540303,_0x11c191){return function(_0xda355b){if(_0xda355b){var _0x17db1a=_0xda355b[_0x658d('0x30')],_0x1e189b=_0x11c191[_0x658d('0x31')],_0xc62d8=_0x11c191[_0x658d('0x31')]+_0x11c191['limit'],_0x9d8b62;if(_0xc62d8>=_0x17db1a){_0xc62d8=_0x17db1a;_0x9d8b62=0xc8;}else{_0x9d8b62=0xce;}_0x540303[_0x658d('0x2d')](_0x9d8b62);return _0x540303['set'](_0x658d('0x32'),_0x1e189b+'-'+_0xc62d8+'/'+_0x17db1a)[_0x658d('0x2f')](_0xda355b);}return null;};}function patchUpdates(_0x3aabaa){return function(_0x2565e){try{jsonpatch[_0x658d('0x33')](_0x2565e,_0x3aabaa,!![]);}catch(_0x1b1874){return BPromise[_0x658d('0x34')](_0x1b1874);}return _0x2565e[_0x658d('0x35')]();};}function saveUpdates(_0x3896c1,_0x40e20e){return function(_0x40f04f){if(_0x40f04f){return _0x40f04f[_0x658d('0x36')](_0x3896c1)[_0x658d('0x20')](function(_0x1eb131){return _0x1eb131;});}return null;};}function removeEntity(_0x1e56f8,_0xab3f2d){return function(_0x53f2a5){if(_0x53f2a5){return _0x53f2a5['destroy']()[_0x658d('0x20')](function(){_0x1e56f8['status'](0xcc)[_0x658d('0x2e')]();});}};}function handleEntityNotFound(_0x12852d,_0x2d30fd){return function(_0x11bf24){if(!_0x11bf24){_0x12852d[_0x658d('0x2c')](0x194);}return _0x11bf24;};}function handleError(_0x13d12a,_0x3b6812){_0x3b6812=_0x3b6812||0x1f4;return function(_0x1f4269){logger[_0x658d('0x28')](_0x1f4269['stack']);if(_0x1f4269['name']){delete _0x1f4269[_0x658d('0x37')];}_0x13d12a[_0x658d('0x2d')](_0x3b6812)[_0x658d('0x38')](_0x1f4269);};}exports[_0x658d('0x39')]=function(_0x2702e3,_0x13ad5e){var _0x118783={},_0x39ae42={},_0x47438a={'count':0x0,'rows':[]};var _0x3c0f8d=_[_0x658d('0x3a')](db['SmsMessage'][_0x658d('0x3b')],function(_0x2ac68c){return{'name':_0x2ac68c[_0x658d('0x3c')],'type':_0x2ac68c[_0x658d('0x3d')][_0x658d('0x3e')]};});_0x39ae42[_0x658d('0x3f')]=_[_0x658d('0x3a')](_0x3c0f8d,_0x658d('0x37'));_0x39ae42[_0x658d('0x40')]=_['keys'](_0x2702e3[_0x658d('0x40')]);_0x39ae42[_0x658d('0x41')]=_[_0x658d('0x42')](_0x39ae42[_0x658d('0x3f')],_0x39ae42[_0x658d('0x40')]);_0x118783[_0x658d('0x43')]=_[_0x658d('0x42')](_0x39ae42['model'],qs[_0x658d('0x44')](_0x2702e3[_0x658d('0x40')][_0x658d('0x44')]));_0x118783[_0x658d('0x43')]=_0x118783[_0x658d('0x43')]['length']?_0x118783[_0x658d('0x43')]:_0x39ae42['model'];if(!_0x2702e3['query'][_0x658d('0x45')](_0x658d('0x46'))){_0x118783[_0x658d('0x47')]=qs['limit'](_0x2702e3[_0x658d('0x40')]['limit']);_0x118783[_0x658d('0x31')]=qs[_0x658d('0x31')](_0x2702e3[_0x658d('0x40')]['offset']);}_0x118783[_0x658d('0x48')]=qs['sort'](_0x2702e3[_0x658d('0x40')][_0x658d('0x49')]);_0x118783[_0x658d('0x4a')]=qs[_0x658d('0x41')](_['pick'](_0x2702e3[_0x658d('0x40')],_0x39ae42['filters']),_0x3c0f8d);if(_0x2702e3[_0x658d('0x40')][_0x658d('0x4b')]){_0x118783['where']=_['merge'](_0x118783[_0x658d('0x4a')],{'$or':_[_0x658d('0x3a')](_0x3c0f8d,function(_0x545c0f){if(_0x545c0f[_0x658d('0x3d')]!==_0x658d('0x4c')){var _0x2b8dd8={};_0x2b8dd8[_0x545c0f[_0x658d('0x37')]]={'$like':'%'+_0x2702e3['query']['filter']+'%'};return _0x2b8dd8;}})});}_0x118783=_[_0x658d('0x4d')]({},_0x118783,_0x2702e3[_0x658d('0x4e')]);var _0x1ec5a7={'where':_0x118783[_0x658d('0x4a')]};return db[_0x658d('0x4f')][_0x658d('0x30')](_0x1ec5a7)['then'](function(_0x4ec428){_0x47438a[_0x658d('0x30')]=_0x4ec428;if(_0x2702e3[_0x658d('0x40')]['includeAll']){_0x118783[_0x658d('0x50')]=[{'all':!![]}];}return db[_0x658d('0x4f')][_0x658d('0x51')](_0x118783);})[_0x658d('0x20')](function(_0x5d19b3){_0x47438a['rows']=_0x5d19b3;return _0x47438a;})[_0x658d('0x20')](respondWithFilteredResult(_0x13ad5e,_0x118783))[_0x658d('0x2b')](handleError(_0x13ad5e,null));};exports[_0x658d('0x52')]=function(_0x24ecfc,_0x2ae11b){var _0x1447ac={'raw':!![],'where':{'id':_0x24ecfc[_0x658d('0x53')]['id']}},_0x386eff={};_0x386eff['model']=_[_0x658d('0x54')](db['SmsMessage'][_0x658d('0x3b')]);_0x386eff[_0x658d('0x40')]=_[_0x658d('0x54')](_0x24ecfc[_0x658d('0x40')]);_0x386eff[_0x658d('0x41')]=_[_0x658d('0x42')](_0x386eff[_0x658d('0x3f')],_0x386eff[_0x658d('0x40')]);_0x1447ac[_0x658d('0x43')]=_[_0x658d('0x42')](_0x386eff[_0x658d('0x3f')],qs['fields'](_0x24ecfc['query'][_0x658d('0x44')]));_0x1447ac[_0x658d('0x43')]=_0x1447ac['attributes'][_0x658d('0x55')]?_0x1447ac['attributes']:_0x386eff['model'];if(_0x24ecfc[_0x658d('0x40')][_0x658d('0x56')]){_0x1447ac[_0x658d('0x50')]=[{'all':!![]}];}_0x1447ac=_[_0x658d('0x4d')]({},_0x1447ac,_0x24ecfc[_0x658d('0x4e')]);return db[_0x658d('0x4f')][_0x658d('0x57')](_0x1447ac)[_0x658d('0x20')](handleEntityNotFound(_0x2ae11b,null))[_0x658d('0x20')](respondWithResult(_0x2ae11b,null))[_0x658d('0x2b')](handleError(_0x2ae11b,null));};exports[_0x658d('0x58')]=function(_0x3fe125,_0x26d7e8){return db[_0x658d('0x4f')][_0x658d('0x58')](_0x3fe125[_0x658d('0x59')],{})[_0x658d('0x20')](respondWithResult(_0x26d7e8,0xc9))[_0x658d('0x2b')](handleError(_0x26d7e8,null));};exports[_0x658d('0x36')]=function(_0x366a77,_0x1c1a14){if(_0x366a77[_0x658d('0x59')]['id']){delete _0x366a77[_0x658d('0x59')]['id'];}return db[_0x658d('0x4f')][_0x658d('0x57')]({'where':{'id':_0x366a77['params']['id']}})['then'](handleEntityNotFound(_0x1c1a14,null))[_0x658d('0x20')](saveUpdates(_0x366a77[_0x658d('0x59')],null))['then'](respondWithResult(_0x1c1a14,null))[_0x658d('0x2b')](handleError(_0x1c1a14,null));};exports['destroy']=function(_0xfdfcb,_0x2facfc){return db['SmsMessage']['find']({'where':{'id':_0xfdfcb[_0x658d('0x53')]['id']}})[_0x658d('0x20')](handleEntityNotFound(_0x2facfc,null))[_0x658d('0x20')](removeEntity(_0x2facfc,null))['catch'](handleError(_0x2facfc,null));};exports[_0x658d('0x5a')]=function(_0x12bf33,_0x128d31){return db['SmsMessage'][_0x658d('0x5a')]()[_0x658d('0x20')](respondWithResult(_0x128d31,null))['catch'](handleError(_0x128d31,null));};var interaction_log=require(_0x658d('0x5b'))(_0x658d('0x5c'));exports['accept']=function(_0x21af99,_0x53ccba,_0x1dd267){var _0x7c51dd={'channel':_0x658d('0x5d')};if(_0x21af99[_0x658d('0x59')]['id']){delete _0x21af99[_0x658d('0x59')]['id'];}_0x21af99['body'][_0x658d('0x5e')]=!![];_0x21af99[_0x658d('0x59')][_0x658d('0x5f')]=moment()[_0x658d('0x60')](_0x658d('0x61'));_0x21af99[_0x658d('0x59')][_0x658d('0x62')]=_0x21af99['body']['UserId']||_0x21af99['user']['id'];return db[_0x658d('0x4f')][_0x658d('0x57')]({'where':{'id':_0x21af99[_0x658d('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x658d('0x63')],'as':_0x658d('0x64')}]})[_0x658d('0x20')](handleEntityNotFound(_0x53ccba,null))[_0x658d('0x20')](saveUpdates(_0x21af99[_0x658d('0x59')],null))[_0x658d('0x20')](function(_0x3f70f7){if(_0x3f70f7){_0x7c51dd[_0x658d('0x29')]=_0x3f70f7[_0x658d('0x65')]({'plain':!![]});return db[_0x658d('0x66')][_0x658d('0x57')]({'where':{'id':_0x3f70f7[_0x658d('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x53ccba,null))[_0x658d('0x20')](function(_0x3651e5){if(_0x3651e5){return _0x3651e5[_0x658d('0x36')]({'UserId':_0x21af99['body'][_0x658d('0x62')],'read1stAt':_[_0x658d('0x68')](_0x3651e5[_0x658d('0x69')])?moment()[_0x658d('0x60')](_0x658d('0x61')):undefined});}return null;})[_0x658d('0x20')](function(_0x833d06){if(_0x833d06){_0x7c51dd[_0x658d('0x6a')]=_0x833d06['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x21af99['user']['id'],_0x21af99[_0x658d('0x6b')][_0x658d('0x37')],_0x21af99[_0x658d('0x6b')][_0x658d('0x6c')],_0x7c51dd[_0x658d('0x6a')]['id'],_0x21af99[_0x658d('0x59')]?JSON[_0x658d('0x26')](_0x21af99[_0x658d('0x59')]):_0x658d('0x6d'));return respondWithRpcPromise(_0x658d('0x6e'),_0x658d('0x6f'),_0x7c51dd);}return null;})['then'](function(_0xa9f87c){if(_0xa9f87c){if(_0x21af99[_0x658d('0x59')][_0x658d('0x70')]){_0x7c51dd[_0x658d('0x29')][_0x658d('0x71')]=util[_0x658d('0x60')]('SIP/%s',_0x21af99['user'][_0x658d('0x37')]);_0x7c51dd[_0x658d('0x29')][_0x658d('0x72')]=_0x7c51dd[_0x658d('0x72')];_0x7c51dd[_0x658d('0x29')]['event']=_0x658d('0x73');return respondWithRpcPromise(_0x658d('0x74'),'EventManager',{'event':'acceptmessage','message':_0x7c51dd[_0x658d('0x29')]},client9002)[_0x658d('0x20')](function(){return _0x7c51dd;});}return _0x7c51dd;}return null;})[_0x658d('0x20')](respondWithResult(_0x53ccba,null))[_0x658d('0x2b')](handleError(_0x53ccba,null));};var interaction_log=require(_0x658d('0x5b'))('sms-interactions');exports[_0x658d('0x34')]=function(_0xb00956,_0xa4385c,_0xb4886e){var _0x4702dc={'agent':{},'channel':_0x658d('0x5d')};if(_0xb00956[_0x658d('0x59')]['id']){delete _0xb00956['body']['id'];}_0xb00956['body'][_0x658d('0x62')]=_0xb00956[_0x658d('0x59')][_0x658d('0x62')]||_0xb00956[_0x658d('0x6b')]['id'];_0x4702dc[_0x658d('0x75')]['id']=_0xb00956[_0x658d('0x59')][_0x658d('0x62')];return db['SmsMessage'][_0x658d('0x57')]({'where':{'id':_0xb00956['params']['id'],'UserId':null}})[_0x658d('0x20')](handleEntityNotFound(_0xa4385c,null))[_0x658d('0x20')](function(_0x256e09){if(_0x256e09){_0x4702dc[_0x658d('0x29')]=_0x256e09[_0x658d('0x65')]({'plain':!![]});return db[_0x658d('0x66')][_0x658d('0x57')]({'where':{'id':_0x256e09[_0x658d('0x67')]}});}return null;})[_0x658d('0x20')](handleEntityNotFound(_0xa4385c,null))['then'](function(_0x413aca){if(_0x413aca){_0x4702dc['interaction']=_0x413aca['get']({'plain':!![]});interaction_log[_0x658d('0x21')](_0x658d('0x76'),_0xb00956['user']['id'],_0xb00956[_0x658d('0x6b')]['name'],_0xb00956[_0x658d('0x6b')][_0x658d('0x6c')],_0x4702dc[_0x658d('0x6a')]['id'],_0xb00956[_0x658d('0x59')]?JSON[_0x658d('0x26')](_0xb00956[_0x658d('0x59')]):_0x658d('0x6d'));return respondWithRpcPromise(_0x658d('0x77'),_0x658d('0x78'),_0x4702dc);}return null;})['then'](function(_0x210fee){if(_0x210fee){_0x210fee[_0x658d('0x29')][_0x658d('0x71')]=util[_0x658d('0x60')](_0x658d('0x79'),_0xb00956[_0x658d('0x6b')][_0x658d('0x37')]);_0x210fee[_0x658d('0x29')][_0x658d('0x72')]=_0x4702dc[_0x658d('0x72')];_0x210fee['message']['event']=_0x658d('0x34');respondWithRpcPromise(_0x658d('0x74'),'EventManager',{'event':_0x658d('0x7a'),'message':_0x210fee[_0x658d('0x29')]},client9002);return _0x4702dc;}return null;})['then'](respondWithResult(_0xa4385c,null))[_0x658d('0x2b')](handleError(_0xa4385c,null));};exports[_0x658d('0x2d')]=function(_0x3c456e,_0x32992c,_0x56637e){if(_0x3c456e['body']['id']){delete _0x3c456e[_0x658d('0x59')]['id'];}var _0x7e2310;return db[_0x658d('0x4f')][_0x658d('0x57')]({'where':{'id':_0x3c456e['params']['id']}})[_0x658d('0x20')](handleEntityNotFound(_0x32992c,null))['then'](function(_0x2b4c03){if(_0x2b4c03){_0x7e2310=_0x2b4c03;return db[_0x658d('0x7b')][_0x658d('0x57')]({'where':{'id':_0x2b4c03[_0x658d('0x7c')]}});}})['then'](handleEntityNotFound(_0x32992c,null))[_0x658d('0x20')](function(_0x4e92a4){if(_0x4e92a4){logger[_0x658d('0x24')](_0x658d('0x25'),_0x658d('0x2d'),_0x658d('0x7d'),_0x4e92a4[_0x658d('0x3d')],util[_0x658d('0x7e')](_0x3c456e[_0x658d('0x59')],{'showHidden':![],'depth':null}));switch(_0x4e92a4[_0x658d('0x3d')]){case _0x658d('0x7f'):if(_0x3c456e[_0x658d('0x59')][_0x658d('0x80')]&&_0x3c456e[_0x658d('0x59')][_0x658d('0x80')]===_0x7e2310[_0x658d('0x81')]){return _0x7e2310['update']({'read':!![]});}else{logger['error'](_0x658d('0x82'),_0x658d('0x2d'),_0x658d('0x7f'),util[_0x658d('0x7e')](_0x3c456e[_0x658d('0x59')],{'showHidden':![],'depth':null}));}break;case _0x658d('0x83'):if(_0x3c456e[_0x658d('0x59')][_0x658d('0x84')]&&_0x3c456e[_0x658d('0x59')][_0x658d('0x84')]===_0x7e2310[_0x658d('0x81')]&&_[_0x658d('0x85')]([_0x658d('0x86'),_0x658d('0x87')],_0x3c456e['body'][_0x658d('0x88')])>=0x0){return _0x7e2310[_0x658d('0x36')]({'read':!![]});}else{logger['error'](_0x658d('0x82'),'status',_0x658d('0x89'),util['inspect'](_0x3c456e[_0x658d('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3d7689=_0x3c456e[_0x658d('0x59')][_0x658d('0x8a')][0x0];if(_0x3d7689[_0x658d('0x2d')][_0x658d('0x8b')]===_0x658d('0x8c')){return _0x7e2310[_0x658d('0x36')]({'read':!![]});}else{logger[_0x658d('0x28')](_0x658d('0x82'),_0x658d('0x2d'),_0x658d('0x8d'),util[_0x658d('0x7e')](_0x3c456e[_0x658d('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x7e2310;}})['then'](respondWithResult(_0x32992c,null))[_0x658d('0x2b')](handleError(_0x32992c,null));}; \ No newline at end of file +var _0x24e9=['util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','Sequelize','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','length','options','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2137a0,_0x3fc562){var _0x17b245=function(_0x29d8eb){while(--_0x29d8eb){_0x2137a0['push'](_0x2137a0['shift']());}};_0x17b245(++_0x3fc562);}(_0x24e9,0x85));var _0x924e=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x24e9[_0x469a3c];return _0x968f4;};'use strict';var pdf=require(_0x924e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x924e('0x1'));var zipdir=require(_0x924e('0x2'));var jsonpatch=require(_0x924e('0x3'));var rp=require(_0x924e('0x4'));var moment=require(_0x924e('0x5'));var BPromise=require(_0x924e('0x6'));var Mustache=require(_0x924e('0x7'));var util=require(_0x924e('0x8'));var path=require('path');var sox=require(_0x924e('0x9'));var csv=require(_0x924e('0xa'));var ejs=require(_0x924e('0xb'));var fs=require('fs');var _=require(_0x924e('0xc'));var squel=require(_0x924e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x924e('0xe'));var toCsv=require(_0x924e('0xa'));var querystring=require(_0x924e('0xf'));var Papa=require(_0x924e('0x10'));var Redis=require('ioredis');var authService=require(_0x924e('0x11'));var qs=require(_0x924e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x924e('0x13'));var logger=require('../../config/logger')(_0x924e('0x14'));var utils=require(_0x924e('0x15'));var config=require(_0x924e('0x16'));var db=require(_0x924e('0x17'))['db'];config[_0x924e('0x18')]=_[_0x924e('0x19')](config[_0x924e('0x18')],{'host':_0x924e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x924e('0x18')]));require('./smsMessage.socket')[_0x924e('0x1b')](socket);var jayson=require(_0x924e('0x1c'));var client=jayson[_0x924e('0x1d')][_0x924e('0x1e')]({'port':0x232c});var client9002=jayson[_0x924e('0x1d')][_0x924e('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4dff17,_0x4df52c,_0x8328a5){if(_0x8328a5){var _0x463d18=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x463d18['test'](_0x4df52c)){return _0x4dff17;}else{throw new db[(_0x924e('0x1f'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4dff17;}}function respondWithRpcPromise(_0x1a04d7,_0x5abe8c,_0x50272c,_0x331cdc){return new BPromise(function(_0x4715f8,_0x1b6549){var _0x29bf41=_0x331cdc||client;return _0x29bf41[_0x924e('0x20')](_0x1a04d7,_0x50272c)['then'](function(_0x2ef3b2){logger[_0x924e('0x21')]('SmsMessage,\x20%s,\x20%s',_0x5abe8c,_0x924e('0x22'));logger[_0x924e('0x23')](_0x924e('0x24'),_0x5abe8c,_0x924e('0x22'),JSON['stringify'](_0x2ef3b2));if(_0x2ef3b2[_0x924e('0x25')]){if(_0x2ef3b2[_0x924e('0x25')]['code']===0x1f4){logger[_0x924e('0x25')](_0x924e('0x26'),_0x5abe8c,_0x2ef3b2['error'][_0x924e('0x27')]);return _0x1b6549(_0x2ef3b2[_0x924e('0x25')][_0x924e('0x27')]);}logger[_0x924e('0x25')](_0x924e('0x26'),_0x5abe8c,_0x2ef3b2[_0x924e('0x25')][_0x924e('0x27')]);return _0x4715f8(_0x2ef3b2[_0x924e('0x25')][_0x924e('0x27')]);}else{logger[_0x924e('0x21')]('SmsMessage,\x20%s,\x20%s',_0x5abe8c,'request\x20sent');_0x4715f8(_0x2ef3b2[_0x924e('0x28')]['message']);}})['catch'](function(_0x1ea892){logger[_0x924e('0x25')](_0x924e('0x26'),_0x5abe8c,_0x1ea892);_0x1b6549(_0x1ea892);});});}function respondWithStatusCode(_0x134622,_0x4c5fb6){_0x4c5fb6=_0x4c5fb6||0xcc;return function(_0x52d47d){if(_0x52d47d){return _0x134622[_0x924e('0x29')](_0x4c5fb6);}return _0x134622['status'](_0x4c5fb6)[_0x924e('0x2a')]();};}function respondWithResult(_0x4258e7,_0x1dc3fd){_0x1dc3fd=_0x1dc3fd||0xc8;return function(_0x352d42){if(_0x352d42){return _0x4258e7['status'](_0x1dc3fd)[_0x924e('0x2b')](_0x352d42);}};}function respondWithFilteredResult(_0x321246,_0x3d66b2){return function(_0x1b4e22){if(_0x1b4e22){var _0xb88fb5=_0x1b4e22[_0x924e('0x2c')],_0x31c053=_0x3d66b2[_0x924e('0x2d')],_0x25869c=_0x3d66b2[_0x924e('0x2d')]+_0x3d66b2[_0x924e('0x2e')],_0x22edd7;if(_0x25869c>=_0xb88fb5){_0x25869c=_0xb88fb5;_0x22edd7=0xc8;}else{_0x22edd7=0xce;}_0x321246[_0x924e('0x2f')](_0x22edd7);return _0x321246[_0x924e('0x30')](_0x924e('0x31'),_0x31c053+'-'+_0x25869c+'/'+_0xb88fb5)[_0x924e('0x2b')](_0x1b4e22);}return null;};}function patchUpdates(_0xb5b5ea){return function(_0x4d7f12){try{jsonpatch[_0x924e('0x32')](_0x4d7f12,_0xb5b5ea,!![]);}catch(_0x14d46e){return BPromise['reject'](_0x14d46e);}return _0x4d7f12[_0x924e('0x33')]();};}function saveUpdates(_0x59b53a,_0x12deb5){return function(_0xf9e19){if(_0xf9e19){return _0xf9e19[_0x924e('0x34')](_0x59b53a)[_0x924e('0x35')](function(_0x238301){return _0x238301;});}return null;};}function removeEntity(_0x4b76e9,_0x360bfa){return function(_0x319890){if(_0x319890){return _0x319890[_0x924e('0x36')]()[_0x924e('0x35')](function(){_0x4b76e9[_0x924e('0x2f')](0xcc)[_0x924e('0x2a')]();});}};}function handleEntityNotFound(_0x40ac90,_0x439495){return function(_0x43a969){if(!_0x43a969){_0x40ac90[_0x924e('0x29')](0x194);}return _0x43a969;};}function handleError(_0x145af5,_0x358f21){_0x358f21=_0x358f21||0x1f4;return function(_0x12174b){logger['error'](_0x12174b[_0x924e('0x37')]);if(_0x12174b['name']){delete _0x12174b[_0x924e('0x38')];}_0x145af5[_0x924e('0x2f')](_0x358f21)[_0x924e('0x39')](_0x12174b);};}exports[_0x924e('0x3a')]=function(_0x2f71d0,_0x30c1b9){var _0x12bb91={},_0x38b9ae={},_0x1794e2={'count':0x0,'rows':[]};var _0x221b86=_[_0x924e('0x3b')](db[_0x924e('0x3c')][_0x924e('0x3d')],function(_0x6d050c){return{'name':_0x6d050c['fieldName'],'type':_0x6d050c[_0x924e('0x3e')][_0x924e('0x3f')]};});_0x38b9ae['model']=_[_0x924e('0x3b')](_0x221b86,'name');_0x38b9ae[_0x924e('0x40')]=_[_0x924e('0x41')](_0x2f71d0[_0x924e('0x40')]);_0x38b9ae[_0x924e('0x42')]=_[_0x924e('0x43')](_0x38b9ae[_0x924e('0x44')],_0x38b9ae[_0x924e('0x40')]);_0x12bb91[_0x924e('0x45')]=_[_0x924e('0x43')](_0x38b9ae[_0x924e('0x44')],qs[_0x924e('0x46')](_0x2f71d0[_0x924e('0x40')][_0x924e('0x46')]));_0x12bb91[_0x924e('0x45')]=_0x12bb91[_0x924e('0x45')]['length']?_0x12bb91[_0x924e('0x45')]:_0x38b9ae[_0x924e('0x44')];if(!_0x2f71d0[_0x924e('0x40')][_0x924e('0x47')](_0x924e('0x48'))){_0x12bb91['limit']=qs[_0x924e('0x2e')](_0x2f71d0[_0x924e('0x40')][_0x924e('0x2e')]);_0x12bb91['offset']=qs[_0x924e('0x2d')](_0x2f71d0[_0x924e('0x40')]['offset']);}_0x12bb91['order']=qs['sort'](_0x2f71d0[_0x924e('0x40')][_0x924e('0x49')]);_0x12bb91[_0x924e('0x4a')]=qs[_0x924e('0x42')](_[_0x924e('0x4b')](_0x2f71d0[_0x924e('0x40')],_0x38b9ae[_0x924e('0x42')]),_0x221b86);if(_0x2f71d0[_0x924e('0x40')]['filter']){_0x12bb91[_0x924e('0x4a')]=_[_0x924e('0x4c')](_0x12bb91['where'],{'$or':_[_0x924e('0x3b')](_0x221b86,function(_0x232bad){if(_0x232bad[_0x924e('0x3e')]!==_0x924e('0x4d')){var _0x5de6b7={};_0x5de6b7[_0x232bad[_0x924e('0x38')]]={'$like':'%'+_0x2f71d0[_0x924e('0x40')][_0x924e('0x4e')]+'%'};return _0x5de6b7;}})});}_0x12bb91=_[_0x924e('0x4c')]({},_0x12bb91,_0x2f71d0['options']);var _0x5bff5c={'where':_0x12bb91[_0x924e('0x4a')]};return db[_0x924e('0x3c')][_0x924e('0x2c')](_0x5bff5c)[_0x924e('0x35')](function(_0x5213d8){_0x1794e2[_0x924e('0x2c')]=_0x5213d8;if(_0x2f71d0[_0x924e('0x40')][_0x924e('0x4f')]){_0x12bb91[_0x924e('0x50')]=[{'all':!![]}];}return db[_0x924e('0x3c')][_0x924e('0x51')](_0x12bb91);})[_0x924e('0x35')](function(_0x3ab3ce){_0x1794e2['rows']=_0x3ab3ce;return _0x1794e2;})[_0x924e('0x35')](respondWithFilteredResult(_0x30c1b9,_0x12bb91))[_0x924e('0x52')](handleError(_0x30c1b9,null));};exports[_0x924e('0x53')]=function(_0x18525c,_0x107035){var _0x301d1c={'raw':!![],'where':{'id':_0x18525c[_0x924e('0x54')]['id']}},_0xa8b1bd={};_0xa8b1bd['model']=_[_0x924e('0x41')](db[_0x924e('0x3c')][_0x924e('0x3d')]);_0xa8b1bd[_0x924e('0x40')]=_['keys'](_0x18525c['query']);_0xa8b1bd[_0x924e('0x42')]=_['intersection'](_0xa8b1bd[_0x924e('0x44')],_0xa8b1bd[_0x924e('0x40')]);_0x301d1c['attributes']=_[_0x924e('0x43')](_0xa8b1bd['model'],qs[_0x924e('0x46')](_0x18525c[_0x924e('0x40')][_0x924e('0x46')]));_0x301d1c['attributes']=_0x301d1c['attributes'][_0x924e('0x55')]?_0x301d1c[_0x924e('0x45')]:_0xa8b1bd[_0x924e('0x44')];if(_0x18525c['query'][_0x924e('0x4f')]){_0x301d1c[_0x924e('0x50')]=[{'all':!![]}];}_0x301d1c=_[_0x924e('0x4c')]({},_0x301d1c,_0x18525c[_0x924e('0x56')]);return db[_0x924e('0x3c')][_0x924e('0x57')](_0x301d1c)['then'](handleEntityNotFound(_0x107035,null))[_0x924e('0x35')](respondWithResult(_0x107035,null))['catch'](handleError(_0x107035,null));};exports[_0x924e('0x58')]=function(_0x3ce402,_0x18556b){return db[_0x924e('0x3c')][_0x924e('0x58')](_0x3ce402[_0x924e('0x59')],{})[_0x924e('0x35')](respondWithResult(_0x18556b,0xc9))['catch'](handleError(_0x18556b,null));};exports[_0x924e('0x34')]=function(_0x4fbedd,_0x46dffa){if(_0x4fbedd[_0x924e('0x59')]['id']){delete _0x4fbedd['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0x4fbedd[_0x924e('0x54')]['id']}})[_0x924e('0x35')](handleEntityNotFound(_0x46dffa,null))[_0x924e('0x35')](saveUpdates(_0x4fbedd[_0x924e('0x59')],null))[_0x924e('0x35')](respondWithResult(_0x46dffa,null))['catch'](handleError(_0x46dffa,null));};exports[_0x924e('0x36')]=function(_0x2e5756,_0x321a3c){return db['SmsMessage'][_0x924e('0x57')]({'where':{'id':_0x2e5756['params']['id']}})[_0x924e('0x35')](handleEntityNotFound(_0x321a3c,null))[_0x924e('0x35')](removeEntity(_0x321a3c,null))[_0x924e('0x52')](handleError(_0x321a3c,null));};exports[_0x924e('0x5a')]=function(_0x5862c9,_0x430198){return db[_0x924e('0x3c')][_0x924e('0x5a')]()[_0x924e('0x35')](respondWithResult(_0x430198,null))['catch'](handleError(_0x430198,null));};var interaction_log=require(_0x924e('0x5b'))(_0x924e('0x5c'));exports[_0x924e('0x5d')]=function(_0x1c9174,_0x4bc258,_0xb6de0e){var _0x42de64={'channel':_0x924e('0x5e')};if(_0x1c9174[_0x924e('0x59')]['id']){delete _0x1c9174[_0x924e('0x59')]['id'];}_0x1c9174['body']['read']=!![];_0x1c9174[_0x924e('0x59')][_0x924e('0x5f')]=moment()[_0x924e('0x60')](_0x924e('0x61'));_0x1c9174[_0x924e('0x59')]['UserId']=_0x1c9174[_0x924e('0x59')][_0x924e('0x62')]||_0x1c9174['user']['id'];return db['SmsMessage'][_0x924e('0x57')]({'where':{'id':_0x1c9174[_0x924e('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x924e('0x63')}]})['then'](handleEntityNotFound(_0x4bc258,null))[_0x924e('0x35')](saveUpdates(_0x1c9174[_0x924e('0x59')],null))[_0x924e('0x35')](function(_0x26a3bc){if(_0x26a3bc){_0x42de64[_0x924e('0x27')]=_0x26a3bc[_0x924e('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x924e('0x57')]({'where':{'id':_0x26a3bc[_0x924e('0x65')]}});}return null;})[_0x924e('0x35')](handleEntityNotFound(_0x4bc258,null))['then'](function(_0xb465ec){if(_0xb465ec){return _0xb465ec[_0x924e('0x34')]({'UserId':_0x1c9174[_0x924e('0x59')][_0x924e('0x62')],'read1stAt':_[_0x924e('0x66')](_0xb465ec[_0x924e('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x20640a){if(_0x20640a){_0x42de64[_0x924e('0x68')]=_0x20640a[_0x924e('0x64')]({'plain':!![]});interaction_log['info'](_0x924e('0x69'),_0x1c9174[_0x924e('0x6a')]['id'],_0x1c9174[_0x924e('0x6a')][_0x924e('0x38')],_0x1c9174['user'][_0x924e('0x6b')],_0x42de64[_0x924e('0x68')]['id'],_0x1c9174[_0x924e('0x59')]?JSON[_0x924e('0x6c')](_0x1c9174[_0x924e('0x59')]):_0x924e('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x924e('0x6e'),_0x42de64);}return null;})[_0x924e('0x35')](function(_0x5a2d53){if(_0x5a2d53){if(_0x1c9174[_0x924e('0x59')][_0x924e('0x6f')]){_0x42de64[_0x924e('0x27')]['interface']=util['format'](_0x924e('0x70'),_0x1c9174[_0x924e('0x6a')]['name']);_0x42de64[_0x924e('0x27')][_0x924e('0x71')]=_0x42de64[_0x924e('0x71')];_0x42de64[_0x924e('0x27')][_0x924e('0x72')]='accept';return respondWithRpcPromise(_0x924e('0x73'),'EventManager',{'event':_0x924e('0x74'),'message':_0x42de64['message']},client9002)['then'](function(){return _0x42de64;});}return _0x42de64;}return null;})[_0x924e('0x35')](respondWithResult(_0x4bc258,null))['catch'](handleError(_0x4bc258,null));};var interaction_log=require(_0x924e('0x5b'))(_0x924e('0x5c'));exports[_0x924e('0x75')]=function(_0x1ee350,_0x585282,_0x1ab506){var _0x304c5c={'agent':{},'channel':_0x924e('0x5e')};if(_0x1ee350[_0x924e('0x59')]['id']){delete _0x1ee350['body']['id'];}_0x1ee350['body'][_0x924e('0x62')]=_0x1ee350[_0x924e('0x59')][_0x924e('0x62')]||_0x1ee350['user']['id'];_0x304c5c[_0x924e('0x76')]['id']=_0x1ee350[_0x924e('0x59')][_0x924e('0x62')];return db[_0x924e('0x3c')][_0x924e('0x57')]({'where':{'id':_0x1ee350[_0x924e('0x54')]['id'],'UserId':null}})[_0x924e('0x35')](handleEntityNotFound(_0x585282,null))['then'](function(_0x17f8ca){if(_0x17f8ca){_0x304c5c[_0x924e('0x27')]=_0x17f8ca['get']({'plain':!![]});return db['SmsInteraction'][_0x924e('0x57')]({'where':{'id':_0x17f8ca[_0x924e('0x65')]}});}return null;})[_0x924e('0x35')](handleEntityNotFound(_0x585282,null))[_0x924e('0x35')](function(_0x425d45){if(_0x425d45){_0x304c5c[_0x924e('0x68')]=_0x425d45[_0x924e('0x64')]({'plain':!![]});interaction_log['info'](_0x924e('0x77'),_0x1ee350[_0x924e('0x6a')]['id'],_0x1ee350[_0x924e('0x6a')]['name'],_0x1ee350['user']['role'],_0x304c5c['interaction']['id'],_0x1ee350[_0x924e('0x59')]?JSON[_0x924e('0x6c')](_0x1ee350[_0x924e('0x59')]):_0x924e('0x6d'));return respondWithRpcPromise(_0x924e('0x78'),_0x924e('0x79'),_0x304c5c);}return null;})['then'](function(_0x273232){if(_0x273232){_0x273232[_0x924e('0x27')][_0x924e('0x7a')]=util['format']('SIP/%s',_0x1ee350[_0x924e('0x6a')][_0x924e('0x38')]);_0x273232[_0x924e('0x27')][_0x924e('0x71')]=_0x304c5c[_0x924e('0x71')];_0x273232[_0x924e('0x27')][_0x924e('0x72')]=_0x924e('0x75');respondWithRpcPromise(_0x924e('0x73'),_0x924e('0x73'),{'event':_0x924e('0x7b'),'message':_0x273232['message']},client9002);return _0x304c5c;}return null;})[_0x924e('0x35')](respondWithResult(_0x585282,null))[_0x924e('0x52')](handleError(_0x585282,null));};exports[_0x924e('0x2f')]=function(_0x49cb74,_0x5d04f5,_0x5ce9f5){if(_0x49cb74['body']['id']){delete _0x49cb74[_0x924e('0x59')]['id'];}var _0x12c7b4;return db[_0x924e('0x3c')]['find']({'where':{'id':_0x49cb74[_0x924e('0x54')]['id']}})[_0x924e('0x35')](handleEntityNotFound(_0x5d04f5,null))[_0x924e('0x35')](function(_0x5389b3){if(_0x5389b3){_0x12c7b4=_0x5389b3;return db[_0x924e('0x7c')][_0x924e('0x57')]({'where':{'id':_0x5389b3['SmsAccountId']}});}})[_0x924e('0x35')](handleEntityNotFound(_0x5d04f5,null))[_0x924e('0x35')](function(_0x706c75){if(_0x706c75){logger[_0x924e('0x23')](_0x924e('0x24'),_0x924e('0x2f'),_0x924e('0x7d'),_0x706c75[_0x924e('0x3e')],util['inspect'](_0x49cb74['body'],{'showHidden':![],'depth':null}));switch(_0x706c75[_0x924e('0x3e')]){case _0x924e('0x7e'):if(_0x49cb74[_0x924e('0x59')][_0x924e('0x7f')]&&_0x49cb74[_0x924e('0x59')][_0x924e('0x7f')]===_0x12c7b4[_0x924e('0x80')]){return _0x12c7b4[_0x924e('0x34')]({'read':!![]});}else{logger[_0x924e('0x25')](_0x924e('0x81'),'status',_0x924e('0x7e'),util[_0x924e('0x82')](_0x49cb74[_0x924e('0x59')],{'showHidden':![],'depth':null}));}break;case _0x924e('0x83'):if(_0x49cb74['body'][_0x924e('0x84')]&&_0x49cb74[_0x924e('0x59')]['MessageUUID']===_0x12c7b4[_0x924e('0x80')]&&_[_0x924e('0x85')](['sent',_0x924e('0x86')],_0x49cb74['body'][_0x924e('0x87')])>=0x0){return _0x12c7b4['update']({'read':!![]});}else{logger['error'](_0x924e('0x81'),_0x924e('0x2f'),_0x924e('0x88'),util[_0x924e('0x82')](_0x49cb74[_0x924e('0x59')],{'showHidden':![],'depth':null}));}break;case _0x924e('0x89'):var _0x3f3a36=_0x49cb74[_0x924e('0x59')][_0x924e('0x8a')][0x0];if(_0x3f3a36[_0x924e('0x2f')][_0x924e('0x8b')]===_0x924e('0x8c')){return _0x12c7b4[_0x924e('0x34')]({'read':!![]});}else{logger[_0x924e('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x924e('0x2f'),_0x924e('0x89'),util[_0x924e('0x82')](_0x49cb74[_0x924e('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x12c7b4;}})[_0x924e('0x35')](respondWithResult(_0x5d04f5,null))[_0x924e('0x52')](handleError(_0x5d04f5,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index eacc928..28f9cc0 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 _0x7caa=['SmsMessage','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x142a8f,_0x1ff9cd){var _0x2dade1=function(_0x1b1adb){while(--_0x1b1adb){_0x142a8f['push'](_0x142a8f['shift']());}};_0x2dade1(++_0x1ff9cd);}(_0x7caa,0x1db));var _0xa7ca=function(_0x1dbf78,_0x5ebf26){_0x1dbf78=_0x1dbf78-0x0;var _0x2d5f60=_0x7caa[_0x1dbf78];return _0x2d5f60;};'use strict';var EventEmitter=require(_0xa7ca('0x0'));var SmsMessage=require(_0xa7ca('0x1'))['db'][_0xa7ca('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7ca('0x3'),'afterUpdate':_0xa7ca('0x4'),'afterDestroy':_0xa7ca('0x5')};function emitEvent(_0x5aaeb8){return function(_0x568e42,_0x51dad1,_0xc44fd4){SmsMessageEvents[_0xa7ca('0x6')](_0x5aaeb8+':'+_0x568e42['id'],_0x568e42);SmsMessageEvents[_0xa7ca('0x6')](_0x5aaeb8,_0x568e42);_0xc44fd4(null);};}for(var e in events){if(events[_0xa7ca('0x7')](e)){var event=events[e];SmsMessage[_0xa7ca('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x1053=['hook','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0x1053,0x1e4));var _0x3105=function(_0x84dbc9,_0x804160){_0x84dbc9=_0x84dbc9-0x0;var _0x365eea=_0x1053[_0x84dbc9];return _0x365eea;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x3105('0x0'))['db'][_0x3105('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3105('0x2')](0x0);var events={'afterCreate':_0x3105('0x3'),'afterUpdate':_0x3105('0x4'),'afterDestroy':'remove'};function emitEvent(_0x9ffc30){return function(_0x47ce47,_0x5342b4,_0x366cbc){SmsMessageEvents[_0x3105('0x5')](_0x9ffc30+':'+_0x47ce47['id'],_0x47ce47);SmsMessageEvents[_0x3105('0x5')](_0x9ffc30,_0x47ce47);_0x366cbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x3105('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c290c3b..ac8c2b1 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 _0x79b7=['UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','refid','status','Token\x20not\x20received','finally','utf8mb4','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','UserId','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','messages','remote','/api/sms/messages/','token','then','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','username','split','sms','POST','user_key','session_key','total_sent','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','authToken','requestid','read','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','base64','http_code','data','queued_count','head','clickSend','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','toString','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','csc','crypto','apiKey','sort','length','md5','hex','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x79b7,0x1c4));var _0x779b=function(_0x5e7ec8,_0x6dae85){_0x5e7ec8=_0x5e7ec8-0x0;var _0x47bc80=_0x79b7[_0x5e7ec8];return _0x47bc80;};'use strict';var _=require('lodash');var util=require(_0x779b('0x0'));var logger=require('../../config/logger')(_0x779b('0x1'));var moment=require('moment');var BPromise=require(_0x779b('0x2'));var rp=require(_0x779b('0x3'));var fs=require('fs');var path=require(_0x779b('0x4'));var rimraf=require(_0x779b('0x5'));var config=require(_0x779b('0x6'));var attributes=require(_0x779b('0x7'));module[_0x779b('0x8')]=function(_0x2a0975,_0x4ac92e){return _0x2a0975[_0x779b('0x9')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x779b('0xa'),'fields':[_0x779b('0xa')]},{'name':_0x779b('0xb'),'fields':[_0x779b('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a5307,_0x3c54bd,_0x11f177){var _0x2f1463=_0x2a0975[_0x779b('0xd')];var _0x447545=_0x1a5307[_0x779b('0xe')]({'plain':!![]});if(_0x447545[_0x779b('0xf')][_0x779b('0x10')]()==='in'||_0x447545[_0x779b('0xf')]['toLowerCase']()===_0x779b('0x11')&&!_0x447545[_0x779b('0x12')]&&!_['isNil'](_0x447545[_0x779b('0x13')])){_0x2f1463['SmsInteraction'][_0x779b('0x14')]({'where':{'id':_0x447545[_0x779b('0x15')]}})['then'](function(_0x4847a5){if(_0x4847a5){_0x4847a5[_0x779b('0x16')]({'lastMsgAt':_0x447545[_0x779b('0x17')],'lastMsgDirection':_0x447545[_0x779b('0xf')][_0x779b('0x10')]()});}})[_0x779b('0x18')](function(_0x1e24ac){console[_0x779b('0x19')](_0x1e24ac);});}if(_0x447545[_0x779b('0xf')]===_0x779b('0x11')&&!_0x447545[_0x779b('0x12')]){var _0x3c678d;_0x2f1463[_0x779b('0x1a')][_0x779b('0x1b')]({'where':{'id':_0x447545[_0x779b('0x1c')]},'raw':!![]})['then'](function(_0x43fd14){_0x3c678d=_0x43fd14;if(_0x3c678d&&_0x3c678d[_0x779b('0x1d')]){switch(_0x3c678d[_0x779b('0x1d')]){case _0x779b('0x1e'):var _0x18f9c0=require('twilio');if(_0x3c678d[_0x779b('0x1f')]&&_0x3c678d['authToken']&&_0x3c678d[_0x779b('0x20')]){var _0x276da1=new _0x18f9c0(_0x3c678d['accountSid'],_0x3c678d['authToken']);_0x276da1[_0x779b('0x21')]['create']({'body':_0x447545['body'],'to':_0x447545[_0x779b('0x20')],'from':_0x3c678d['phone'],'statusCallback':_0x3c678d[_0x779b('0x22')]+_0x779b('0x23')+_0x447545['id']+'/status?token='+_0x3c678d[_0x779b('0x24')]})[_0x779b('0x25')](function(_0x2dadf9){if(_0x2dadf9[_0x779b('0x26')]){return _0x1a5307[_0x779b('0x16')]({'messageId':_0x2dadf9[_0x779b('0x26')]});}})[_0x779b('0x18')](function(_0x44c72c){logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x1e'),util[_0x779b('0x29')](_0x44c72c,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x779b('0x2a'):var _0x2d6af8=_0x779b('0x2b');if(_0x3c678d['username']&&_0x3c678d['password']){var _0x1b76f4={'recipient':[_0x447545[_0x779b('0x20')]],'message':_0x447545[_0x779b('0xc')],'message_type':_0x3c678d[_0x779b('0x2c')]};if(_0x3c678d[_0x779b('0x2c')]&&_0x3c678d['smsMethod']!=='SI'){_0x1b76f4[_0x779b('0x2d')]=_0x3c678d[_0x779b('0x20')];}var _0x3ea540={'url':_0x2d6af8+'login?username='+_0x3c678d[_0x779b('0x2e')]+'&password='+_0x3c678d['password'],'method':'GET'};rp(_0x3ea540)[_0x779b('0x25')](function(_0x5f0834){var _0x9416ce=_0x5f0834[_0x779b('0x2f')](';');var _0x279a4a={'user_key':_0x9416ce[0x0],'session_key':_0x9416ce[0x1]};_0x3ea540={'url':_0x2d6af8+_0x779b('0x30'),'method':_0x779b('0x31'),'headers':{'user_key':_0x279a4a[_0x779b('0x32')],'Session_key':_0x279a4a[_0x779b('0x33')]},'json':!![],'body':_0x1b76f4};return rp(_0x3ea540);})[_0x779b('0x25')](function(_0x1b8313){if(_0x1b8313[_0x779b('0x34')]>=0x1){var _0xbcd473={'messageId':_0x1b8313['internal_order_id']};if(_0x3c678d[_0x779b('0x2c')]!=='GP'||!_0x3c678d[_0x779b('0x35')]){_0xbcd473['read']=!![];}return _0x1a5307['update'](_0xbcd473);}else{return logger['error'](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x2a'),util[_0x779b('0x29')](_0x1b8313,{'showHidden':![],'depth':null}));}})[_0x779b('0x18')](function(_0x24ae36){return logger['error'](_0x779b('0x27'),'afterCreate',_0x779b('0x2a'),util['inspect'](_0x24ae36,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x2a'),_0x779b('0x36'));}break;case _0x779b('0x37'):if(_0x3c678d['authToken']){var _0x35868d={'recipient':_0x447545[_0x779b('0x20')],'message':_0x447545[_0x779b('0xc')],'sender':_0x3c678d['senderString']||_0x3c678d['phone'],'authorization':_0x3c678d[_0x779b('0x38')]};var _0x3c54bd={'method':_0x779b('0x31'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x35868d,'json':!![]};rp(_0x3c54bd)['then'](function(_0x126e35){var _0x455aab={'messageId':_0x126e35[_0x779b('0x39')]};if(!_0x3c678d['deliveryReport']){_0x455aab[_0x779b('0x3a')]=!![];}return _0x1a5307[_0x779b('0x16')](_0x455aab);})['catch'](function(_0x25ba90){logger[_0x779b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x779b('0x28'),_0x779b('0x37'),util[_0x779b('0x29')](_0x25ba90,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x37'),_0x779b('0x3b'));}break;case _0x779b('0x3c'):if(_0x3c678d[_0x779b('0x2e')]&&_0x3c678d[_0x779b('0x3d')]){var _0x35868d={'messages':[{'source':_0x779b('0x3e'),'to':_0x447545['phone'],'body':_0x447545['body'],'from':_0x3c678d[_0x779b('0x3f')]||_0x3c678d[_0x779b('0x20')]}]};var _0x375790=util[_0x779b('0x40')](_0x779b('0x41'),_0x3c678d[_0x779b('0x2e')],_0x3c678d['password']);var _0x3c54bd={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x35868d,'headers':{'Authorization':util[_0x779b('0x40')](_0x779b('0x42'),new Buffer(_0x375790)['toString'](_0x779b('0x43')))},'json':!![]};rp(_0x3c54bd)[_0x779b('0x25')](function(_0x2ef5a1){if(_0x2ef5a1[_0x779b('0x44')]>=0xc8&&_0x2ef5a1[_0x779b('0x44')]<=0xce){if(_0x2ef5a1[_0x779b('0x45')]&&_0x2ef5a1['data'][_0x779b('0x46')]>0x0){var _0x574c57=_[_0x779b('0x47')](_0x2ef5a1['data'][_0x779b('0x21')]);var _0x5385ab={'messageId':_0x574c57['message_id']};if(!_0x3c678d[_0x779b('0x35')]){_0x5385ab[_0x779b('0x3a')]=!![];}return _0x1a5307['update'](_0x5385ab);}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x48'),util[_0x779b('0x29')](_0x2ef5a1,{'showHidden':![],'depth':null}));}}else{logger[_0x779b('0x19')](_0x779b('0x27'),'afterCreate',_0x779b('0x48'),util['inspect'](_0x2ef5a1,{'showHidden':![],'depth':null}));}})[_0x779b('0x18')](function(_0x37e23b){logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x48'),util[_0x779b('0x29')](_0x37e23b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x779b('0x27'),'afterCreate',_0x779b('0x48'),_0x779b('0x36'));}break;case'plivo':if(_0x3c678d[_0x779b('0x49')]&&_0x3c678d[_0x779b('0x38')]){var _0x35868d={'dst':_0x447545[_0x779b('0x20')],'text':_0x447545[_0x779b('0xc')],'src':_0x3c678d['senderString']||_0x3c678d[_0x779b('0x20')],'url':_0x3c678d[_0x779b('0x22')]+'/api/sms/messages/'+_0x447545['id']+_0x779b('0x4a')+_0x3c678d[_0x779b('0x24')]};var _0x375790=util[_0x779b('0x40')](_0x779b('0x41'),_0x3c678d[_0x779b('0x49')],_0x3c678d['authToken']);var _0x3c54bd={'method':_0x779b('0x31'),'uri':util[_0x779b('0x40')](_0x779b('0x4b'),_0x3c678d[_0x779b('0x49')]),'body':_0x35868d,'headers':{'Authorization':util['format'](_0x779b('0x42'),new Buffer(_0x375790)[_0x779b('0x4c')](_0x779b('0x43')))},'json':!![]};rp(_0x3c54bd)[_0x779b('0x25')](function(_0xa2d116){var _0x2b3acf={'messageId':_0xa2d116['message_uuid'][0x0]};return _0x1a5307['update'](_0x2b3acf);})[_0x779b('0x18')](function(_0x5e98b7){logger['error'](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x4d'),util[_0x779b('0x29')](_0x5e98b7,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),'plivo',_0x779b('0x4e'));}break;case _0x779b('0x4f'):if(_0x3c678d[_0x779b('0x2e')]&&_0x3c678d[_0x779b('0x3d')]){if(_0x3c678d['baseUrl']){var _0x23b1db={'method':'POST','uri':_0x3c678d[_0x779b('0x50')]+_0x779b('0x51'),'body':{'username':_0x3c678d['username'],'password':_0x3c678d['password']},'json':!![]};return rp(_0x23b1db)[_0x779b('0x25')](function(_0x47c5ea){var _0x452d02={'method':_0x779b('0x31'),'uri':_0x3c678d[_0x779b('0x50')]+_0x779b('0x52'),'body':{'messages':[{'from':_0x3c678d[_0x779b('0x20')],'destinations':[{'to':_0x447545[_0x779b('0x20')]}],'text':_0x447545[_0x779b('0xc')],'notifyUrl':_0x3c678d[_0x779b('0x22')]+_0x779b('0x23')+_0x447545['id']+_0x779b('0x4a')+_0x3c678d['token'],'notifyContentType':'application/json','callbackData':_0x3c678d[_0x779b('0x20')]+';'+_0x447545['body']}]},'headers':{'Authorization':_0x779b('0x53')+_0x47c5ea[_0x779b('0x24')]},'json':!![]};return rp(_0x452d02)[_0x779b('0x25')](function(_0x4b80fb){if(_0x4b80fb[_0x779b('0x21')]){var _0x560469={'messageId':_0x4b80fb[_0x779b('0x21')][0x0][_0x779b('0xa')]};if(!_0x3c678d[_0x779b('0x35')]){_0x560469[_0x779b('0x3a')]=!![];}return _0x1a5307['update'](_0x560469);}else{return logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x4f'),util[_0x779b('0x29')](_0x4b80fb,{'showHidden':![],'depth':null}));}});})[_0x779b('0x18')](function(_0x556d50){return logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),'infobip',util[_0x779b('0x29')](_0x556d50,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x4f'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x779b('0x19')](_0x779b('0x27'),'afterCreate','infobip',_0x779b('0x36'));}break;case _0x779b('0x54'):var _0x69e3ea=require(_0x779b('0x55'));if(_0x3c678d[_0x779b('0x56')]){var _0x3efc0b={};_0x3efc0b['login']=_0x3c678d[_0x779b('0x2e')];_0x3efc0b[_0x779b('0x20')]=_0x447545[_0x779b('0x20')];_0x3efc0b[_0x779b('0x2d')]=_0x3c678d[_0x779b('0x20')];_0x3efc0b['text']=_0x447545[_0x779b('0xc')];_0x3efc0b['timestamp']=+new Date();var _0x580839='';var _0x136982='';var _0x60a86e=Object['keys'](_0x3efc0b);_0x60a86e[_0x779b('0x57')]();for(var _0x162eb0=0x0;_0x162eb0<_0x60a86e[_0x779b('0x58')];_0x162eb0++){if(_0x580839!=''){_0x580839+='&';}_0x580839+=_0x60a86e[_0x162eb0]+'='+encodeURIComponent(_0x3efc0b[_0x60a86e[_0x162eb0]]);_0x136982+=_0x3efc0b[_0x60a86e[_0x162eb0]];}_0x136982+=_0x3c678d['apiKey'];_0x136982=_0x69e3ea['createHash'](_0x779b('0x59'))[_0x779b('0x16')](_0x136982)['digest'](_0x779b('0x5a'));if(_0x580839!==''){_0x580839+='&';}_0x580839+='signature='+_0x136982;var _0x3ea540={'method':_0x779b('0x5b'),'uri':_0x3c678d[_0x779b('0x50')]+_0x779b('0x5c')+_0x580839,'json':!![]};return rp(_0x3ea540)[_0x779b('0x25')](function(_0x3dde5b){var _0x1860a5=Object['keys'](_0x3dde5b);if(_0x3dde5b[_0x1860a5[0x0]][_0x779b('0x19')]&&parseInt(_0x3dde5b[_0x1860a5[0x0]][_0x779b('0x19')])===0x0){var _0x2f53aa={'messageId':_0x3dde5b[_0x1860a5[0x0]][_0x779b('0x5d')]};if(!_0x3c678d[_0x779b('0x35')]){_0x2f53aa[_0x779b('0x3a')]=!![];}return _0x1a5307[_0x779b('0x16')](_0x2f53aa);}else{return logger['error'](_0x779b('0x27'),'afterCreate','csc',util['inspect'](_0x3dde5b['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e3463){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x779b('0x28'),'csc',util[_0x779b('0x29')](_0x4e3463,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x779b('0x28'),_0x779b('0x54'),_0x779b('0x5e'));}break;case _0x779b('0x5f'):if(_0x3c678d[_0x779b('0x56')]){var _0x6d353={'method':_0x779b('0x31'),'uri':_0x779b('0x60'),'headers':{'Authorization':_0x3c678d[_0x779b('0x56')]},'body':{'content':_0x447545[_0x779b('0xc')],'to':[_0x447545[_0x779b('0x20')]],'from':_0x3c678d[_0x779b('0x20')],'binary':![],'clientMessageId':_0x779b('0x61'),'charset':_0x779b('0x62')},'json':!![]};rp(_0x6d353)['then'](function(_0x479239){if(!_0x479239[_0x779b('0x19')]){var _0x113c1d={'messageId':_0x479239[_0x779b('0x21')][0x0][_0x779b('0x63')]};if(!_0x3c678d['deliveryReport']){_0x113c1d['read']=!![];}return _0x1a5307[_0x779b('0x16')](_0x113c1d);}else{return logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x5f'),util[_0x779b('0x29')](_0x479239[_0x779b('0x19')],{'showHidden':![],'depth':null}));}})[_0x779b('0x18')](function(_0x200045){return logger['error'](_0x779b('0x27'),_0x779b('0x28'),'clickatell',util['inspect'](_0x200045,{'showHidden':![],'depth':null}));});}else{logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x5f'),_0x779b('0x5e'));}break;case _0x779b('0x64'):if(_0x3c678d['apiKey']){var _0x4f4833={};var _0x3ea540={'method':_0x779b('0x31'),'uri':_0x779b('0x65'),'headers':{'Authorization':_0x779b('0x66')+_0x3c678d[_0x779b('0x56')],'Content-Type':_0x779b('0x67')},'body':{'from':_0x3c678d[_0x779b('0x20')],'to':_0x447545[_0x779b('0x20')],'text':_0x447545[_0x779b('0xc')]},'json':!![]};return rp(_0x3ea540)['then'](function(_0x5e58d2){if(_0x5e58d2['code']==0xca){_0x4f4833[_0x779b('0x68')]=_0x5e58d2;var _0x2090ec={'method':_0x779b('0x31'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x779b('0x66')+_0x3c678d['apiKey'],'Content-Type':_0x779b('0x67')},'body':{'refid':_0x4f4833['message'][_0x779b('0x69')]},'json':!![]};return rp(_0x2090ec)['then'](function(_0x75c7bf){_0x4f4833[_0x779b('0x6a')]=_0x75c7bf;var _0x2befc5={'messageId':_0x4f4833[_0x779b('0x68')][_0x779b('0x69')],'read':!![]};return _0x1a5307[_0x779b('0x16')](_0x2befc5);});}else{return logger[_0x779b('0x19')](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x64'),util['inspect'](_0x5e58d2,{'showHidden':![],'depth':null}));}})[_0x779b('0x18')](function(_0x5ab14d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x779b('0x28'),_0x779b('0x64'),util[_0x779b('0x29')](_0x5ab14d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x779b('0x27'),_0x779b('0x28'),_0x779b('0x64'),_0x779b('0x6b'));}break;}}})[_0x779b('0x6c')](function(){_0x11f177();});}else{_0x11f177();}}},'charset':_0x779b('0x6d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xca66=['SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','create','phone','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','user_key','session_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','senderString','POST','https://smsapi.connectel.se/api/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','/auth/1/session','application/json','Missing\x20parameters:\x20base_url','csc','login','sender','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','baseUrl','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','get','direction','toLowerCase','out','isNil','UserId'];(function(_0x1fc3ef,_0x2976f3){var _0x5f1e66=function(_0x172451){while(--_0x172451){_0x1fc3ef['push'](_0x1fc3ef['shift']());}};_0x5f1e66(++_0x2976f3);}(_0xca66,0x1d7));var _0x6ca6=function(_0x449dfe,_0x156cd4){_0x449dfe=_0x449dfe-0x0;var _0x2da103=_0xca66[_0x449dfe];return _0x2da103;};'use strict';var _=require(_0x6ca6('0x0'));var util=require(_0x6ca6('0x1'));var logger=require(_0x6ca6('0x2'))(_0x6ca6('0x3'));var moment=require('moment');var BPromise=require(_0x6ca6('0x4'));var rp=require(_0x6ca6('0x5'));var fs=require('fs');var path=require(_0x6ca6('0x6'));var rimraf=require(_0x6ca6('0x7'));var config=require('../../config/environment');var attributes=require(_0x6ca6('0x8'));module[_0x6ca6('0x9')]=function(_0x15f1ec,_0x25a267){return _0x15f1ec[_0x6ca6('0xa')](_0x6ca6('0xb'),attributes,{'tableName':_0x6ca6('0xc'),'paranoid':![],'indexes':[{'name':_0x6ca6('0xd'),'fields':[_0x6ca6('0xd')]},{'name':'fti_sms_messages','fields':[_0x6ca6('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14ace6,_0x3aa496,_0x567fcf){var _0x4c27b6=_0x15f1ec['models'];var _0x49c1ca=_0x14ace6[_0x6ca6('0xf')]({'plain':!![]});if(_0x49c1ca[_0x6ca6('0x10')]['toLowerCase']()==='in'||_0x49c1ca[_0x6ca6('0x10')][_0x6ca6('0x11')]()===_0x6ca6('0x12')&&!_0x49c1ca['secret']&&!_[_0x6ca6('0x13')](_0x49c1ca[_0x6ca6('0x14')])){_0x4c27b6[_0x6ca6('0x15')][_0x6ca6('0x16')]({'where':{'id':_0x49c1ca[_0x6ca6('0x17')]}})[_0x6ca6('0x18')](function(_0x4b6f59){if(_0x4b6f59){_0x4b6f59[_0x6ca6('0x19')]({'lastMsgAt':_0x49c1ca[_0x6ca6('0x1a')],'lastMsgDirection':_0x49c1ca[_0x6ca6('0x10')][_0x6ca6('0x11')]()});}})[_0x6ca6('0x1b')](function(_0x16f802){console[_0x6ca6('0x1c')](_0x16f802);});}if(_0x49c1ca['direction']===_0x6ca6('0x12')&&!_0x49c1ca[_0x6ca6('0x1d')]){var _0x133217;_0x4c27b6[_0x6ca6('0x1e')][_0x6ca6('0x1f')]({'where':{'id':_0x49c1ca[_0x6ca6('0x20')]},'raw':!![]})[_0x6ca6('0x18')](function(_0x47fed2){_0x133217=_0x47fed2;if(_0x133217&&_0x133217[_0x6ca6('0x21')]){switch(_0x133217['type']){case _0x6ca6('0x22'):var _0x4792ff=require(_0x6ca6('0x22'));if(_0x133217[_0x6ca6('0x23')]&&_0x133217[_0x6ca6('0x24')]&&_0x133217['phone']){var _0x310b9e=new _0x4792ff(_0x133217[_0x6ca6('0x23')],_0x133217['authToken']);_0x310b9e['messages'][_0x6ca6('0x25')]({'body':_0x49c1ca[_0x6ca6('0xe')],'to':_0x49c1ca['phone'],'from':_0x133217[_0x6ca6('0x26')],'statusCallback':_0x133217['remote']+'/api/sms/messages/'+_0x49c1ca['id']+_0x6ca6('0x27')+_0x133217[_0x6ca6('0x28')]})[_0x6ca6('0x18')](function(_0x353f53){if(_0x353f53[_0x6ca6('0x29')]){return _0x14ace6[_0x6ca6('0x19')]({'messageId':_0x353f53[_0x6ca6('0x29')]});}})[_0x6ca6('0x1b')](function(_0x59f388){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x2a'),'twilio',util[_0x6ca6('0x2b')](_0x59f388,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x22'),_0x6ca6('0x2d'));}break;case'skebby':var _0x21f04a=_0x6ca6('0x2e');if(_0x133217[_0x6ca6('0x2f')]&&_0x133217[_0x6ca6('0x30')]){var _0x5c366d={'recipient':[_0x49c1ca[_0x6ca6('0x26')]],'message':_0x49c1ca[_0x6ca6('0xe')],'message_type':_0x133217[_0x6ca6('0x31')]};if(_0x133217[_0x6ca6('0x31')]&&_0x133217[_0x6ca6('0x31')]!=='SI'){_0x5c366d['sender']=_0x133217[_0x6ca6('0x26')];}var _0x2325d1={'url':_0x21f04a+_0x6ca6('0x32')+_0x133217[_0x6ca6('0x2f')]+_0x6ca6('0x33')+_0x133217['password'],'method':_0x6ca6('0x34')};rp(_0x2325d1)['then'](function(_0x58611e){var _0x534f28=_0x58611e[_0x6ca6('0x35')](';');var _0x51c3e6={'user_key':_0x534f28[0x0],'session_key':_0x534f28[0x1]};_0x2325d1={'url':_0x21f04a+_0x6ca6('0x36'),'method':'POST','headers':{'user_key':_0x51c3e6[_0x6ca6('0x37')],'Session_key':_0x51c3e6[_0x6ca6('0x38')]},'json':!![],'body':_0x5c366d};return rp(_0x2325d1);})[_0x6ca6('0x18')](function(_0x2aea14){if(_0x2aea14['total_sent']>=0x1){var _0x218e89={'messageId':_0x2aea14[_0x6ca6('0x39')]};if(_0x133217[_0x6ca6('0x31')]!=='GP'||!_0x133217[_0x6ca6('0x3a')]){_0x218e89[_0x6ca6('0x3b')]=!![];}return _0x14ace6[_0x6ca6('0x19')](_0x218e89);}else{return logger[_0x6ca6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x2a'),_0x6ca6('0x3c'),util[_0x6ca6('0x2b')](_0x2aea14,{'showHidden':![],'depth':null}));}})[_0x6ca6('0x1b')](function(_0x3cbaf8){return logger[_0x6ca6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x2a'),'skebby',util['inspect'](_0x3cbaf8,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',_0x6ca6('0x3d'));}break;case'connectel':if(_0x133217[_0x6ca6('0x24')]){var _0x49f10b={'recipient':_0x49c1ca[_0x6ca6('0x26')],'message':_0x49c1ca[_0x6ca6('0xe')],'sender':_0x133217[_0x6ca6('0x3e')]||_0x133217[_0x6ca6('0x26')],'authorization':_0x133217[_0x6ca6('0x24')]};var _0x3aa496={'method':_0x6ca6('0x3f'),'uri':_0x6ca6('0x40'),'body':_0x49f10b,'json':!![]};rp(_0x3aa496)[_0x6ca6('0x18')](function(_0x481a73){var _0x521542={'messageId':_0x481a73['requestid']};if(!_0x133217[_0x6ca6('0x3a')]){_0x521542[_0x6ca6('0x3b')]=!![];}return _0x14ace6['update'](_0x521542);})['catch'](function(_0x3f78ac){logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),'connectel',util[_0x6ca6('0x2b')](_0x3f78ac,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),'connectel',_0x6ca6('0x41'));}break;case _0x6ca6('0x42'):if(_0x133217[_0x6ca6('0x2f')]&&_0x133217[_0x6ca6('0x30')]){var _0x49f10b={'messages':[{'source':_0x6ca6('0x43'),'to':_0x49c1ca[_0x6ca6('0x26')],'body':_0x49c1ca[_0x6ca6('0xe')],'from':_0x133217[_0x6ca6('0x3e')]||_0x133217[_0x6ca6('0x26')]}]};var _0x243cf3=util[_0x6ca6('0x44')]('%s:%s',_0x133217[_0x6ca6('0x2f')],_0x133217[_0x6ca6('0x30')]);var _0x3aa496={'method':_0x6ca6('0x3f'),'uri':_0x6ca6('0x45'),'body':_0x49f10b,'headers':{'Authorization':util[_0x6ca6('0x44')](_0x6ca6('0x46'),new Buffer(_0x243cf3)['toString'](_0x6ca6('0x47')))},'json':!![]};rp(_0x3aa496)[_0x6ca6('0x18')](function(_0x236245){if(_0x236245[_0x6ca6('0x48')]>=0xc8&&_0x236245['http_code']<=0xce){if(_0x236245[_0x6ca6('0x49')]&&_0x236245[_0x6ca6('0x49')][_0x6ca6('0x4a')]>0x0){var _0x5754ca=_[_0x6ca6('0x4b')](_0x236245[_0x6ca6('0x49')][_0x6ca6('0x4c')]);var _0x47392e={'messageId':_0x5754ca[_0x6ca6('0x4d')]};if(!_0x133217[_0x6ca6('0x3a')]){_0x47392e[_0x6ca6('0x3b')]=!![];}return _0x14ace6['update'](_0x47392e);}else{logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x4e'),util[_0x6ca6('0x2b')](_0x236245,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x4e'),util[_0x6ca6('0x2b')](_0x236245,{'showHidden':![],'depth':null}));}})['catch'](function(_0x481b26){logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x4e'),util[_0x6ca6('0x2b')](_0x481b26,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6ca6('0x4f'):if(_0x133217['authId']&&_0x133217[_0x6ca6('0x24')]){var _0x49f10b={'dst':_0x49c1ca[_0x6ca6('0x26')],'text':_0x49c1ca[_0x6ca6('0xe')],'src':_0x133217[_0x6ca6('0x3e')]||_0x133217[_0x6ca6('0x26')],'url':_0x133217['remote']+_0x6ca6('0x50')+_0x49c1ca['id']+_0x6ca6('0x27')+_0x133217['token']};var _0x243cf3=util[_0x6ca6('0x44')](_0x6ca6('0x51'),_0x133217['authId'],_0x133217[_0x6ca6('0x24')]);var _0x3aa496={'method':_0x6ca6('0x3f'),'uri':util[_0x6ca6('0x44')](_0x6ca6('0x52'),_0x133217['authId']),'body':_0x49f10b,'headers':{'Authorization':util[_0x6ca6('0x44')](_0x6ca6('0x46'),new Buffer(_0x243cf3)['toString'](_0x6ca6('0x47')))},'json':!![]};rp(_0x3aa496)['then'](function(_0x30c015){var _0x54a3ce={'messageId':_0x30c015[_0x6ca6('0x53')][0x0]};return _0x14ace6[_0x6ca6('0x19')](_0x54a3ce);})['catch'](function(_0xc4c029){logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x4f'),util['inspect'](_0xc4c029,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x4f'),_0x6ca6('0x54'));}break;case _0x6ca6('0x55'):if(_0x133217[_0x6ca6('0x2f')]&&_0x133217['password']){if(_0x133217['baseUrl']){var _0x4aa734={'method':'POST','uri':_0x133217['baseUrl']+_0x6ca6('0x56'),'body':{'username':_0x133217[_0x6ca6('0x2f')],'password':_0x133217[_0x6ca6('0x30')]},'json':!![]};return rp(_0x4aa734)[_0x6ca6('0x18')](function(_0x445030){var _0x496f2d={'method':_0x6ca6('0x3f'),'uri':_0x133217['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x133217[_0x6ca6('0x26')],'destinations':[{'to':_0x49c1ca[_0x6ca6('0x26')]}],'text':_0x49c1ca[_0x6ca6('0xe')],'notifyUrl':_0x133217['remote']+_0x6ca6('0x50')+_0x49c1ca['id']+_0x6ca6('0x27')+_0x133217['token'],'notifyContentType':_0x6ca6('0x57'),'callbackData':_0x133217['phone']+';'+_0x49c1ca['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x445030[_0x6ca6('0x28')]},'json':!![]};return rp(_0x496f2d)[_0x6ca6('0x18')](function(_0x4ea574){if(_0x4ea574[_0x6ca6('0x4c')]){var _0xe9fe9c={'messageId':_0x4ea574[_0x6ca6('0x4c')][0x0][_0x6ca6('0xd')]};if(!_0x133217[_0x6ca6('0x3a')]){_0xe9fe9c[_0x6ca6('0x3b')]=!![];}return _0x14ace6[_0x6ca6('0x19')](_0xe9fe9c);}else{return logger[_0x6ca6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ca6('0x55'),util[_0x6ca6('0x2b')](_0x4ea574,{'showHidden':![],'depth':null}));}});})[_0x6ca6('0x1b')](function(_0x590543){return logger[_0x6ca6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x2a'),_0x6ca6('0x55'),util[_0x6ca6('0x2b')](_0x590543,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ca6('0x2c'),'afterCreate','infobip',_0x6ca6('0x58'));}}else{logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x55'),_0x6ca6('0x3d'));}break;case _0x6ca6('0x59'):var _0x1ad3f5=require('crypto');if(_0x133217['apiKey']){var _0x3dfd3a={};_0x3dfd3a[_0x6ca6('0x5a')]=_0x133217[_0x6ca6('0x2f')];_0x3dfd3a[_0x6ca6('0x26')]=_0x49c1ca[_0x6ca6('0x26')];_0x3dfd3a[_0x6ca6('0x5b')]=_0x133217[_0x6ca6('0x26')];_0x3dfd3a[_0x6ca6('0x5c')]=_0x49c1ca['body'];_0x3dfd3a[_0x6ca6('0x5d')]=+new Date();var _0x1b27c6='';var _0xf9e3ef='';var _0x16bad4=Object[_0x6ca6('0x5e')](_0x3dfd3a);_0x16bad4[_0x6ca6('0x5f')]();for(var _0x288e01=0x0;_0x288e01<_0x16bad4['length'];_0x288e01++){if(_0x1b27c6!=''){_0x1b27c6+='&';}_0x1b27c6+=_0x16bad4[_0x288e01]+'='+encodeURIComponent(_0x3dfd3a[_0x16bad4[_0x288e01]]);_0xf9e3ef+=_0x3dfd3a[_0x16bad4[_0x288e01]];}_0xf9e3ef+=_0x133217['apiKey'];_0xf9e3ef=_0x1ad3f5[_0x6ca6('0x60')](_0x6ca6('0x61'))[_0x6ca6('0x19')](_0xf9e3ef)[_0x6ca6('0x62')](_0x6ca6('0x63'));if(_0x1b27c6!==''){_0x1b27c6+='&';}_0x1b27c6+=_0x6ca6('0x64')+_0xf9e3ef;var _0x2325d1={'method':_0x6ca6('0x34'),'uri':_0x133217[_0x6ca6('0x65')]+_0x6ca6('0x66')+_0x1b27c6,'json':!![]};return rp(_0x2325d1)['then'](function(_0x23d8cd){var _0x3a1e32=Object['keys'](_0x23d8cd);if(_0x23d8cd[_0x3a1e32[0x0]][_0x6ca6('0x1c')]&&parseInt(_0x23d8cd[_0x3a1e32[0x0]]['error'])===0x0){var _0x1fc670={'messageId':_0x23d8cd[_0x3a1e32[0x0]][_0x6ca6('0x67')]};if(!_0x133217[_0x6ca6('0x3a')]){_0x1fc670['read']=!![];}return _0x14ace6[_0x6ca6('0x19')](_0x1fc670);}else{return logger['error'](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x59'),util[_0x6ca6('0x2b')](_0x23d8cd[_0x6ca6('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x59b6dc){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ca6('0x59'),util[_0x6ca6('0x2b')](_0x59b6dc,{'showHidden':![],'depth':null}));});}else{logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),'csc',_0x6ca6('0x68'));}break;case _0x6ca6('0x69'):if(_0x133217[_0x6ca6('0x6a')]){var _0x5e3ad0={'method':'POST','uri':_0x6ca6('0x6b'),'headers':{'Authorization':_0x133217['apiKey']},'body':{'content':_0x49c1ca[_0x6ca6('0xe')],'to':[_0x49c1ca['phone']],'from':_0x133217[_0x6ca6('0x26')],'binary':![],'clientMessageId':_0x6ca6('0x6c'),'charset':_0x6ca6('0x6d')},'json':!![]};rp(_0x5e3ad0)[_0x6ca6('0x18')](function(_0x1becc0){if(!_0x1becc0['error']){var _0x1394ea={'messageId':_0x1becc0[_0x6ca6('0x4c')][0x0][_0x6ca6('0x6e')]};if(!_0x133217[_0x6ca6('0x3a')]){_0x1394ea[_0x6ca6('0x3b')]=!![];}return _0x14ace6[_0x6ca6('0x19')](_0x1394ea);}else{return logger[_0x6ca6('0x1c')](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x69'),util[_0x6ca6('0x2b')](_0x1becc0['error'],{'showHidden':![],'depth':null}));}})[_0x6ca6('0x1b')](function(_0x29a556){return logger[_0x6ca6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x2a'),'clickatell',util[_0x6ca6('0x2b')](_0x29a556,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x2a'),_0x6ca6('0x69'),_0x6ca6('0x68'));}break;case _0x6ca6('0x6f'):if(_0x133217[_0x6ca6('0x6a')]){var _0x2a21b6={};var _0x2325d1={'method':_0x6ca6('0x3f'),'uri':_0x6ca6('0x70'),'headers':{'Authorization':_0x6ca6('0x71')+_0x133217['apiKey'],'Content-Type':_0x6ca6('0x57')},'body':{'from':_0x133217[_0x6ca6('0x26')],'to':_0x49c1ca[_0x6ca6('0x26')],'text':_0x49c1ca[_0x6ca6('0xe')]},'json':!![]};return rp(_0x2325d1)[_0x6ca6('0x18')](function(_0x5dcc40){if(_0x5dcc40[_0x6ca6('0x72')]==0xca){_0x2a21b6[_0x6ca6('0x73')]=_0x5dcc40;var _0x375de0={'method':_0x6ca6('0x3f'),'uri':_0x6ca6('0x74'),'headers':{'Authorization':_0x6ca6('0x71')+_0x133217[_0x6ca6('0x6a')],'Content-Type':_0x6ca6('0x57')},'body':{'refid':_0x2a21b6[_0x6ca6('0x73')][_0x6ca6('0x75')]},'json':!![]};return rp(_0x375de0)[_0x6ca6('0x18')](function(_0x12162b){_0x2a21b6[_0x6ca6('0x76')]=_0x12162b;var _0xa8c684={'messageId':_0x2a21b6[_0x6ca6('0x73')][_0x6ca6('0x75')],'read':!![]};return _0x14ace6[_0x6ca6('0x19')](_0xa8c684);});}else{return logger['error'](_0x6ca6('0x2c'),_0x6ca6('0x2a'),_0x6ca6('0x6f'),util['inspect'](_0x5dcc40,{'showHidden':![],'depth':null}));}})[_0x6ca6('0x1b')](function(_0x5bfeab){return logger[_0x6ca6('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ca6('0x2a'),_0x6ca6('0x6f'),util[_0x6ca6('0x2b')](_0x5bfeab,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x6ca6('0x2c'),'afterCreate',_0x6ca6('0x6f'),_0x6ca6('0x77'));}break;}}})[_0x6ca6('0x78')](function(){_0x567fcf();});}else{_0x567fcf();}}},'charset':_0x6ca6('0x79'),'collate':_0x6ca6('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5aa2a24..45c1e24 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 _0xda2d=['body','options','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xda2d,0x102));var _0xdda2=function(_0x2aeed7,_0x4c16b5){_0x2aeed7=_0x2aeed7-0x0;var _0x59f5be=_0xda2d[_0x2aeed7];return _0x59f5be;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});}exports[_0xdda2('0x1c')]=function(_0x337b0b){var _0x312ef1=this;return new Promise(function(_0x6fdede,_0x4eed30){return db[_0xdda2('0x1d')]['create'](_0x337b0b[_0xdda2('0x1e')],{'raw':_0x337b0b[_0xdda2('0x1f')]?_0x337b0b[_0xdda2('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xdda2('0x11')](function(_0x5a9bb8){logger[_0xdda2('0x12')](_0xdda2('0x1c'),_0x337b0b);logger['debug'](_0xdda2('0x1c'),_0x337b0b,JSON[_0xdda2('0x15')](_0x5a9bb8));_0x6fdede(_0x5a9bb8);})[_0xdda2('0x1b')](function(_0x13b0f3){logger[_0xdda2('0x16')]('CreateSmsMessage',_0x13b0f3[_0xdda2('0x18')],_0x337b0b);_0x4eed30(_0x312ef1[_0xdda2('0x16')](0x1f4,_0x13b0f3[_0xdda2('0x18')]));});});}; \ No newline at end of file +var _0x4fc2=['message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x4fc2,0x111));var _0x24fc=function(_0x1d2a9e,_0x33fd9d){_0x1d2a9e=_0x1d2a9e-0x0;var _0x5e8a64=_0x4fc2[_0x1d2a9e];return _0x5e8a64;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});config['redis']=_[_0x24fc('0xb')](config[_0x24fc('0xc')],{'host':_0x24fc('0xd'),'port':0x18eb});var socket=require(_0x24fc('0xe'))(new Redis(config[_0x24fc('0xc')]));require(_0x24fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x44caca,_0x1819a5,_0x1a4462){return new BPromise(function(_0x133438,_0x24998d){return client[_0x24fc('0x10')](_0x44caca,_0x1a4462)[_0x24fc('0x11')](function(_0x9a1673){logger['info'](_0x24fc('0x12'),_0x1819a5,_0x24fc('0x13'));logger['debug'](_0x24fc('0x14'),_0x1819a5,_0x24fc('0x13'),JSON[_0x24fc('0x15')](_0x9a1673));if(_0x9a1673[_0x24fc('0x16')]){if(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x17')]===0x1f4){logger['error'](_0x24fc('0x12'),_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x24998d(_0x9a1673[_0x24fc('0x16')]['message']);}logger[_0x24fc('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x133438(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);}else{logger[_0x24fc('0x19')]('SmsMessage,\x20%s,\x20%s',_0x1819a5,_0x24fc('0x13'));_0x133438(_0x9a1673[_0x24fc('0x1a')][_0x24fc('0x18')]);}})[_0x24fc('0x1b')](function(_0x4c5a43){logger[_0x24fc('0x16')](_0x24fc('0x12'),_0x1819a5,_0x4c5a43);_0x24998d(_0x4c5a43);});});}exports[_0x24fc('0x1c')]=function(_0x5b0516){var _0x32a57d=this;return new Promise(function(_0x36a771,_0xbf1d6b){return db[_0x24fc('0x1d')]['create'](_0x5b0516[_0x24fc('0x1e')],{'raw':_0x5b0516['options']?_0x5b0516[_0x24fc('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x24fc('0x11')](function(_0x44c121){logger[_0x24fc('0x19')]('CreateSmsMessage',_0x5b0516);logger[_0x24fc('0x20')]('CreateSmsMessage',_0x5b0516,JSON[_0x24fc('0x15')](_0x44c121));_0x36a771(_0x44c121);})[_0x24fc('0x1b')](function(_0x36a9b4){logger[_0x24fc('0x16')](_0x24fc('0x1c'),_0x36a9b4[_0x24fc('0x18')],_0x5b0516);_0xbf1d6b(_0x32a57d[_0x24fc('0x16')](0x1f4,_0x36a9b4[_0x24fc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 4e17849..a434404 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 _0x73c1=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x73c1,0x1ad));var _0x173c=function(_0x9aad68,_0x45377){_0x9aad68=_0x9aad68-0x0;var _0x281340=_0x73c1[_0x9aad68];return _0x281340;};'use strict';var SmsMessageEvents=require(_0x173c('0x0'));var events=['save',_0x173c('0x1'),_0x173c('0x2')];function createListener(_0x437982,_0x23f64d){return function(_0x321f5b){_0x23f64d[_0x173c('0x3')](_0x437982,_0x321f5b);};}function removeListener(_0x219534,_0x388e16){return function(){SmsMessageEvents[_0x173c('0x4')](_0x219534,_0x388e16);};}exports[_0x173c('0x5')]=function(_0x51057c){for(var _0x102499=0x0,_0x5938d5=events[_0x173c('0x6')];_0x102499<_0x5938d5;_0x102499++){var _0x29802b=events[_0x102499];var _0x301229=createListener(_0x173c('0x7')+_0x29802b,_0x51057c);SmsMessageEvents['on'](_0x29802b,_0x301229);}}; \ No newline at end of file +var _0xe6ca=['update','register','smsMessage:','./smsMessage.events','save','remove'];(function(_0x43daa5,_0xc401f6){var _0x4e3463=function(_0x893019){while(--_0x893019){_0x43daa5['push'](_0x43daa5['shift']());}};_0x4e3463(++_0xc401f6);}(_0xe6ca,0x129));var _0xae6c=function(_0x48e5ba,_0x85a926){_0x48e5ba=_0x48e5ba-0x0;var _0x1e2771=_0xe6ca[_0x48e5ba];return _0x1e2771;};'use strict';var SmsMessageEvents=require(_0xae6c('0x0'));var events=[_0xae6c('0x1'),_0xae6c('0x2'),_0xae6c('0x3')];function createListener(_0x2c28e3,_0x1d3e5f){return function(_0x3dc3b8){_0x1d3e5f['emit'](_0x2c28e3,_0x3dc3b8);};}function removeListener(_0x3722fb,_0x3cb53){return function(){SmsMessageEvents['removeListener'](_0x3722fb,_0x3cb53);};}exports[_0xae6c('0x4')]=function(_0x39e7c9){for(var _0x321b70=0x0,_0x416208=events['length'];_0x321b70<_0x416208;_0x321b70++){var _0x333f65=events[_0x321b70];var _0x87fee3=createListener(_0xae6c('0x5')+_0x333f65,_0x39e7c9);SmsMessageEvents['on'](_0x333f65,_0x87fee3);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 278f87c..bcdebfa 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 _0xaf0d=['index','describe','/:id','isAuthenticated','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addAgents','delete','removeAgents','exports','util','path','../../config/environment','./smsQueue.controller','get'];(function(_0x399fb4,_0x3b9673){var _0x599673=function(_0x5f16a1){while(--_0x5f16a1){_0x399fb4['push'](_0x399fb4['shift']());}};_0x599673(++_0x3b9673);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x315624,_0x526a80){_0x315624=_0x315624-0x0;var _0x5a15c9=_0xaf0d[_0x315624];return _0x5a15c9;};'use strict';var multer=require('multer');var util=require(_0xdaf0('0x0'));var path=require(_0xdaf0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdaf0('0x2'));var controller=require(_0xdaf0('0x3'));router[_0xdaf0('0x4')]('/',auth['isAuthenticated'](),controller[_0xdaf0('0x5')]);router[_0xdaf0('0x4')]('/describe',auth['isAuthenticated'](),controller[_0xdaf0('0x6')]);router[_0xdaf0('0x4')](_0xdaf0('0x7'),auth[_0xdaf0('0x8')](),controller['show']);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xdaf0('0x9')]);router[_0xdaf0('0x4')]('/:id/teams',auth[_0xdaf0('0x8')](),controller[_0xdaf0('0xa')]);router[_0xdaf0('0x4')](_0xdaf0('0xb'),auth['isAuthenticated'](),controller[_0xdaf0('0xc')]);router[_0xdaf0('0xd')]('/',auth[_0xdaf0('0x8')](),controller['create']);router[_0xdaf0('0xd')](_0xdaf0('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xdaf0('0xf')]);router['put'](_0xdaf0('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xdaf0('0x10')](_0xdaf0('0x7'),auth[_0xdaf0('0x8')](),controller['destroy']);router[_0xdaf0('0x10')](_0xdaf0('0xe'),auth[_0xdaf0('0x8')](),controller['removeTeams']);router['delete'](_0xdaf0('0xb'),auth[_0xdaf0('0x8')](),controller[_0xdaf0('0x11')]);module[_0xdaf0('0x12')]=router; \ No newline at end of file +var _0x0a6b=['put','update','delete','destroy','removeTeams','removeAgents','exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x2076ef,_0xe0f939){var _0x280dfe=function(_0x3cd256){while(--_0x3cd256){_0x2076ef['push'](_0x2076ef['shift']());}};_0x280dfe(++_0xe0f939);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x2226c1,_0x2bed75){_0x2226c1=_0x2226c1-0x0;var _0x178716=_0x0a6b[_0x2226c1];return _0x178716;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var auth=require(_0xb0a6('0x2'));var interaction=require(_0xb0a6('0x3'));var config=require(_0xb0a6('0x4'));var controller=require('./smsQueue.controller');router[_0xb0a6('0x5')]('/',auth['isAuthenticated'](),controller[_0xb0a6('0x6')]);router[_0xb0a6('0x5')]('/describe',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x8')]);router[_0xb0a6('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb0a6('0x5')](_0xb0a6('0x9'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xa')]);router['get'](_0xb0a6('0xb'),auth[_0xb0a6('0x7')](),controller['getTeams']);router[_0xb0a6('0x5')](_0xb0a6('0xc'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xd')]);router[_0xb0a6('0xe')]('/',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xf')]);router[_0xb0a6('0xe')](_0xb0a6('0xb'),auth[_0xb0a6('0x7')](),controller['addTeams']);router[_0xb0a6('0xe')]('/:id/users',auth[_0xb0a6('0x7')](),controller['addAgents']);router[_0xb0a6('0x10')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x11')]);router[_0xb0a6('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb0a6('0x13')]);router[_0xb0a6('0x12')](_0xb0a6('0xb'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x14')]);router[_0xb0a6('0x12')]('/:id/users',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x15')]);module[_0xb0a6('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 436752a..f887dd0 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 _0x8c34=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1c0a25,_0x227201){var _0x4ddd7e=function(_0x59f4ac){while(--_0x59f4ac){_0x1c0a25['push'](_0x1c0a25['shift']());}};_0x4ddd7e(++_0x227201);}(_0x8c34,0x181));var _0x48c3=function(_0x2615b4,_0x535f59){_0x2615b4=_0x2615b4-0x0;var _0x471ae3=_0x8c34[_0x2615b4];return _0x471ae3;};'use strict';var Sequelize=require('sequelize');module[_0x48c3('0x0')]={'name':{'type':Sequelize[_0x48c3('0x1')],'unique':_0x48c3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x48c3('0x1')]},'timeout':{'type':Sequelize[_0x48c3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48c3('0x4')](_0x48c3('0x5'),_0x48c3('0x6'),_0x48c3('0x7'))}}; \ No newline at end of file +var _0x733c=['STRING','name','ENUM','beepall','roundrobin','sequelize'];(function(_0x4b9806,_0x1517c0){var _0x12f4d4=function(_0x2f0984){while(--_0x2f0984){_0x4b9806['push'](_0x4b9806['shift']());}};_0x12f4d4(++_0x1517c0);}(_0x733c,0xdd));var _0xc733=function(_0x53d4ae,_0x2df89d){_0x53d4ae=_0x53d4ae-0x0;var _0x1a2741=_0x733c[_0x53d4ae];return _0x1a2741;};'use strict';var Sequelize=require(_0xc733('0x0'));module['exports']={'name':{'type':Sequelize[_0xc733('0x1')],'unique':_0xc733('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc733('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc733('0x3')]('rrmemory',_0xc733('0x4'),_0xc733('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 44a9b10..adc0d1f 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 _0x240c=['socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','keys','UserSmsQueue','pick','SmsQueueId','options','UserId','updatedAt','createdAt','SIP','smsPause','findOne','Team','getTeams','hasOwnProperty','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x240c,0xf8));var _0xc240=function(_0x5f3c15,_0x155cf5){_0x5f3c15=_0x5f3c15-0x0;var _0x6e7001=_0x240c[_0x5f3c15];return _0x6e7001;};'use strict';var pdf=require(_0xc240('0x0'));var emlformat=require(_0xc240('0x1'));var rimraf=require(_0xc240('0x2'));var zipdir=require(_0xc240('0x3'));var jsonpatch=require(_0xc240('0x4'));var rp=require(_0xc240('0x5'));var moment=require('moment');var BPromise=require(_0xc240('0x6'));var Mustache=require('mustache');var util=require(_0xc240('0x7'));var path=require(_0xc240('0x8'));var sox=require(_0xc240('0x9'));var csv=require(_0xc240('0xa'));var ejs=require(_0xc240('0xb'));var fs=require('fs');var _=require(_0xc240('0xc'));var squel=require(_0xc240('0xd'));var crypto=require(_0xc240('0xe'));var jsforce=require(_0xc240('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc240('0xa'));var querystring=require(_0xc240('0x10'));var Papa=require(_0xc240('0x11'));var Redis=require('ioredis');var authService=require(_0xc240('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc240('0x13'));var hardwareService=require(_0xc240('0x14'));var logger=require(_0xc240('0x15'))(_0xc240('0x16'));var utils=require('../../config/utils');var config=require(_0xc240('0x17'));var db=require('../../mysqldb')['db'];config[_0xc240('0x18')]=_[_0xc240('0x19')](config[_0xc240('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc240('0x1a'))(new Redis(config[_0xc240('0x18')]));require(_0xc240('0x1b'))[_0xc240('0x1c')](socket);function respondWithStatusCode(_0xfb2520,_0x365fc6){_0x365fc6=_0x365fc6||0xcc;return function(_0x25c283){if(_0x25c283){return _0xfb2520[_0xc240('0x1d')](_0x365fc6);}return _0xfb2520['status'](_0x365fc6)[_0xc240('0x1e')]();};}function respondWithResult(_0x9e759b,_0x12e414){_0x12e414=_0x12e414||0xc8;return function(_0x28f066){if(_0x28f066){return _0x9e759b[_0xc240('0x1f')](_0x12e414)[_0xc240('0x20')](_0x28f066);}};}function respondWithFilteredResult(_0x16d534,_0x106a03){return function(_0x279552){if(_0x279552){var _0x14bfba=_0x279552[_0xc240('0x21')],_0x1b663e=_0x106a03['offset'],_0x5550f2=_0x106a03[_0xc240('0x22')]+_0x106a03[_0xc240('0x23')],_0x77f462;if(_0x5550f2>=_0x14bfba){_0x5550f2=_0x14bfba;_0x77f462=0xc8;}else{_0x77f462=0xce;}_0x16d534[_0xc240('0x1f')](_0x77f462);return _0x16d534[_0xc240('0x24')](_0xc240('0x25'),_0x1b663e+'-'+_0x5550f2+'/'+_0x14bfba)[_0xc240('0x20')](_0x279552);}return null;};}function patchUpdates(_0x105e1f){return function(_0x58b703){try{jsonpatch['apply'](_0x58b703,_0x105e1f,!![]);}catch(_0x4e8909){return BPromise['reject'](_0x4e8909);}return _0x58b703['save']();};}function saveUpdates(_0x435bc1,_0x12376c){return function(_0x1ae538){if(_0x1ae538){return _0x1ae538['update'](_0x435bc1)[_0xc240('0x26')](function(_0x44c203){return _0x44c203;});}return null;};}function removeEntity(_0x1fe8f4,_0x231893){return function(_0x537f57){if(_0x537f57){return _0x537f57['destroy']()['then'](function(){var _0x4f5e5c=_0x537f57[_0xc240('0x27')]({'plain':!![]});var _0x112fd4=_0xc240('0x28');return db[_0xc240('0x29')][_0xc240('0x2a')]({'where':{'type':_0x112fd4,'resourceId':_0x4f5e5c['id']}})[_0xc240('0x26')](function(){return _0x537f57;});})[_0xc240('0x26')](function(){_0x1fe8f4['status'](0xcc)[_0xc240('0x1e')]();});}};}function handleEntityNotFound(_0x5ca1d7,_0x13764f){return function(_0x11dc88){if(!_0x11dc88){_0x5ca1d7[_0xc240('0x1d')](0x194);}return _0x11dc88;};}function handleError(_0x22279c,_0x290f18){_0x290f18=_0x290f18||0x1f4;return function(_0x3b4fd8){logger[_0xc240('0x2b')](_0x3b4fd8[_0xc240('0x2c')]);if(_0x3b4fd8[_0xc240('0x2d')]){delete _0x3b4fd8[_0xc240('0x2d')];}_0x22279c[_0xc240('0x1f')](_0x290f18)[_0xc240('0x2e')](_0x3b4fd8);};}exports[_0xc240('0x2f')]=function(_0x58727d,_0x202f8f){var _0x13b3f2={},_0x48a9db={},_0x4f8026={'count':0x0,'rows':[]};var _0x1925e7=_[_0xc240('0x30')](db[_0xc240('0x31')][_0xc240('0x32')],function(_0x125a1e){return{'name':_0x125a1e[_0xc240('0x33')],'type':_0x125a1e[_0xc240('0x34')][_0xc240('0x35')]};});_0x48a9db[_0xc240('0x36')]=_[_0xc240('0x30')](_0x1925e7,'name');_0x48a9db[_0xc240('0x37')]=_['keys'](_0x58727d[_0xc240('0x37')]);_0x48a9db[_0xc240('0x38')]=_[_0xc240('0x39')](_0x48a9db[_0xc240('0x36')],_0x48a9db[_0xc240('0x37')]);_0x13b3f2[_0xc240('0x3a')]=_[_0xc240('0x39')](_0x48a9db[_0xc240('0x36')],qs[_0xc240('0x3b')](_0x58727d['query'][_0xc240('0x3b')]));_0x13b3f2[_0xc240('0x3a')]=_0x13b3f2[_0xc240('0x3a')][_0xc240('0x3c')]?_0x13b3f2['attributes']:_0x48a9db[_0xc240('0x36')];if(!_0x58727d[_0xc240('0x37')]['hasOwnProperty'](_0xc240('0x3d'))){_0x13b3f2[_0xc240('0x23')]=qs['limit'](_0x58727d[_0xc240('0x37')]['limit']);_0x13b3f2[_0xc240('0x22')]=qs['offset'](_0x58727d[_0xc240('0x37')][_0xc240('0x22')]);}_0x13b3f2[_0xc240('0x3e')]=qs[_0xc240('0x3f')](_0x58727d[_0xc240('0x37')][_0xc240('0x3f')]);_0x13b3f2[_0xc240('0x40')]=qs[_0xc240('0x38')](_['pick'](_0x58727d['query'],_0x48a9db['filters']),_0x1925e7);if(_0x58727d['query'][_0xc240('0x41')]){_0x13b3f2[_0xc240('0x40')]=_[_0xc240('0x42')](_0x13b3f2[_0xc240('0x40')],{'$or':_[_0xc240('0x30')](_0x1925e7,function(_0x2ae099){if(_0x2ae099[_0xc240('0x34')]!=='VIRTUAL'){var _0x478437={};_0x478437[_0x2ae099[_0xc240('0x2d')]]={'$like':'%'+_0x58727d[_0xc240('0x37')][_0xc240('0x41')]+'%'};return _0x478437;}})});}_0x13b3f2=_['merge']({},_0x13b3f2,_0x58727d['options']);var _0x4ef12a={'where':_0x13b3f2[_0xc240('0x40')]};return db[_0xc240('0x31')][_0xc240('0x21')](_0x4ef12a)[_0xc240('0x26')](function(_0x2b401e){_0x4f8026[_0xc240('0x21')]=_0x2b401e;if(_0x58727d['query'][_0xc240('0x43')]){_0x13b3f2[_0xc240('0x44')]=[{'all':!![]}];}return db[_0xc240('0x31')][_0xc240('0x45')](_0x13b3f2);})['then'](function(_0x519a64){_0x4f8026[_0xc240('0x46')]=_0x519a64;return _0x4f8026;})[_0xc240('0x26')](respondWithFilteredResult(_0x202f8f,_0x13b3f2))[_0xc240('0x47')](handleError(_0x202f8f,null));};exports[_0xc240('0x48')]=function(_0x1f24da,_0x551092){var _0xc63644={'raw':!![],'where':{'id':_0x1f24da[_0xc240('0x49')]['id']}},_0x5c7179={};_0x5c7179[_0xc240('0x36')]=_['keys'](db[_0xc240('0x31')][_0xc240('0x32')]);_0x5c7179[_0xc240('0x37')]=_['keys'](_0x1f24da[_0xc240('0x37')]);_0x5c7179['filters']=_[_0xc240('0x39')](_0x5c7179[_0xc240('0x36')],_0x5c7179[_0xc240('0x37')]);_0xc63644[_0xc240('0x3a')]=_[_0xc240('0x39')](_0x5c7179[_0xc240('0x36')],qs[_0xc240('0x3b')](_0x1f24da[_0xc240('0x37')][_0xc240('0x3b')]));_0xc63644[_0xc240('0x3a')]=_0xc63644[_0xc240('0x3a')][_0xc240('0x3c')]?_0xc63644['attributes']:_0x5c7179[_0xc240('0x36')];if(_0x1f24da['query']['includeAll']){_0xc63644[_0xc240('0x44')]=[{'all':!![]}];}_0xc63644=_['merge']({},_0xc63644,_0x1f24da['options']);return db[_0xc240('0x31')][_0xc240('0x4a')](_0xc63644)['then'](handleEntityNotFound(_0x551092,null))[_0xc240('0x26')](respondWithResult(_0x551092,null))[_0xc240('0x47')](handleError(_0x551092,null));};exports[_0xc240('0x4b')]=function(_0x30f6fe,_0x105a2b){return db['SmsQueue']['create'](_0x30f6fe[_0xc240('0x4c')],{})[_0xc240('0x26')](function(_0x56cc82){var _0xdaaafb=_0x30f6fe[_0xc240('0x4d')][_0xc240('0x27')]({'plain':!![]});if(!_0xdaaafb)throw new Error(_0xc240('0x4e'));if(_0xdaaafb[_0xc240('0x4f')]==='user'){var _0x5c38f0=_0x56cc82[_0xc240('0x27')]({'plain':!![]});var _0x4bb747=_0xc240('0x28');return db[_0xc240('0x50')][_0xc240('0x4a')]({'where':{'name':_0x4bb747,'userProfileId':_0xdaaafb[_0xc240('0x51')]},'raw':!![]})[_0xc240('0x26')](function(_0xdb00fa){if(_0xdb00fa&&_0xdb00fa[_0xc240('0x52')]===0x0){return db[_0xc240('0x29')]['create']({'name':_0x5c38f0[_0xc240('0x2d')],'resourceId':_0x5c38f0['id'],'type':_0xdb00fa[_0xc240('0x2d')],'sectionId':_0xdb00fa['id']},{})[_0xc240('0x26')](function(){return _0x56cc82;});}else{return _0x56cc82;}})[_0xc240('0x47')](function(_0x16a644){logger[_0xc240('0x2b')](_0xc240('0x53'),_0x16a644);throw _0x16a644;});}return _0x56cc82;})['then'](respondWithResult(_0x105a2b,0xc9))[_0xc240('0x47')](handleError(_0x105a2b,null));};exports[_0xc240('0x54')]=function(_0x43f7de,_0x4a07d7){if(_0x43f7de[_0xc240('0x4c')]['id']){delete _0x43f7de['body']['id'];}return db[_0xc240('0x31')][_0xc240('0x4a')]({'where':{'id':_0x43f7de['params']['id']}})[_0xc240('0x26')](handleEntityNotFound(_0x4a07d7,null))[_0xc240('0x26')](saveUpdates(_0x43f7de[_0xc240('0x4c')],null))[_0xc240('0x26')](respondWithResult(_0x4a07d7,null))['catch'](handleError(_0x4a07d7,null));};exports[_0xc240('0x2a')]=function(_0x2473db,_0x195d27){return db[_0xc240('0x31')][_0xc240('0x4a')]({'where':{'id':_0x2473db[_0xc240('0x49')]['id']}})[_0xc240('0x26')](handleEntityNotFound(_0x195d27,null))['then'](removeEntity(_0x195d27,null))[_0xc240('0x47')](handleError(_0x195d27,null));};exports[_0xc240('0x55')]=function(_0x3abbf,_0x1935ff){return db['SmsQueue'][_0xc240('0x55')]()[_0xc240('0x26')](respondWithResult(_0x1935ff,null))['catch'](handleError(_0x1935ff,null));};exports[_0xc240('0x56')]=function(_0x677ab8,_0x492089,_0x2840a8){var _0x769705={'raw':!![],'where':{}},_0x4abfa8={},_0x57714f;return db[_0xc240('0x31')]['findOne']({'where':{'id':_0x677ab8[_0xc240('0x49')]['id']}})[_0xc240('0x26')](handleEntityNotFound(_0x492089,null))['then'](function(_0xef2104){if(_0xef2104){_0x57714f=_0xef2104[_0xc240('0x27')]({'plain':!![]});_0x4abfa8[_0xc240('0x36')]=_[_0xc240('0x57')](db[_0xc240('0x58')][_0xc240('0x32')]);_0x4abfa8['query']=_[_0xc240('0x57')](_0x677ab8[_0xc240('0x37')]);_0x4abfa8[_0xc240('0x38')]=_[_0xc240('0x39')](_0x4abfa8['model'],_0x4abfa8['query']);_0x769705['attributes']=_['intersection'](_0x4abfa8[_0xc240('0x36')],qs['fields'](_0x677ab8[_0xc240('0x37')][_0xc240('0x3b')]));_0x769705['attributes']=_0x769705['attributes']['length']?_0x769705[_0xc240('0x3a')]:_0x4abfa8[_0xc240('0x36')];if(!_0x677ab8[_0xc240('0x37')]['hasOwnProperty'](_0xc240('0x3d'))){_0x769705[_0xc240('0x23')]=qs[_0xc240('0x23')](_0x677ab8[_0xc240('0x37')][_0xc240('0x23')]);_0x769705[_0xc240('0x22')]=qs[_0xc240('0x22')](_0x677ab8[_0xc240('0x37')][_0xc240('0x22')]);}_0x769705[_0xc240('0x3e')]=qs[_0xc240('0x3f')](_0x677ab8[_0xc240('0x37')]['sort']);_0x769705[_0xc240('0x40')]=qs[_0xc240('0x38')](_[_0xc240('0x59')](_0x677ab8[_0xc240('0x37')],_0x4abfa8[_0xc240('0x38')]));_0x769705['where'][_0xc240('0x5a')]=_0xef2104['id'];if(_0x677ab8[_0xc240('0x37')][_0xc240('0x41')]){_0x769705['where']=_[_0xc240('0x42')](_0x769705[_0xc240('0x40')],{'$or':_['map'](_0x769705['attributes'],function(_0x26dce9){var _0x54c1b1={};_0x54c1b1[_0x26dce9]={'$like':'%'+_0x677ab8['query'][_0xc240('0x41')]+'%'};return _0x54c1b1;})});}_0x769705=_[_0xc240('0x42')]({},_0x769705,_0x677ab8[_0xc240('0x5b')]);return db[_0xc240('0x58')][_0xc240('0x45')](_0x769705);}})[_0xc240('0x26')](function(_0x278893){if(_0x278893){return db['User']['findAndCountAll']({'where':{'id':_[_0xc240('0x30')](_0x278893,_0xc240('0x5c')),'role':'agent'},'attributes':['id',_0xc240('0x2d'),'smsPause',_0xc240('0x5d'),_0xc240('0x5e')]});}})[_0xc240('0x26')](function(_0x50d82a){if(_0x50d82a){return{'count':_0x50d82a[_0xc240('0x21')],'rows':_['map'](_0x50d82a[_0xc240('0x46')],function(_0x39a3dc){return{'membername':_0x39a3dc[_0xc240('0x2d')],'UserId':_0x39a3dc['id'],'queue_name':_0x57714f[_0xc240('0x2d')],'SmsQueueId':_0x57714f['id'],'interface':util['format']('%s/%s',_0xc240('0x5f'),_0x39a3dc[_0xc240('0x2d')]),'penalty':0x0,'paused':_0x39a3dc[_0xc240('0x60')],'createdAt':_0x39a3dc['createdAt'],'updatedAt':_0x39a3dc[_0xc240('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc240('0x26')](respondWithFilteredResult(_0x492089,_0x769705))[_0xc240('0x47')](handleError(_0x492089,null));};exports['getTeams']=function(_0x205561,_0x5882cd,_0x20dd2d){var _0x362ada={};var _0x51acdd={};var _0xf07bcb;var _0x45f043;return db[_0xc240('0x31')][_0xc240('0x61')]({'where':{'id':_0x205561[_0xc240('0x49')]['id']}})['then'](handleEntityNotFound(_0x5882cd,null))[_0xc240('0x26')](function(_0x250326){if(_0x250326){_0xf07bcb=_0x250326;_0x51acdd[_0xc240('0x36')]=_['keys'](db[_0xc240('0x62')][_0xc240('0x32')]);_0x51acdd[_0xc240('0x37')]=_[_0xc240('0x57')](_0x205561[_0xc240('0x37')]);_0x51acdd[_0xc240('0x38')]=_[_0xc240('0x39')](_0x51acdd['model'],_0x51acdd['query']);_0x362ada[_0xc240('0x3a')]=_[_0xc240('0x39')](_0x51acdd['model'],qs['fields'](_0x205561[_0xc240('0x37')][_0xc240('0x3b')]));_0x362ada[_0xc240('0x3a')]=_0x362ada[_0xc240('0x3a')][_0xc240('0x3c')]?_0x362ada[_0xc240('0x3a')]:_0x51acdd[_0xc240('0x36')];_0x362ada[_0xc240('0x3e')]=qs[_0xc240('0x3f')](_0x205561['query']['sort']);_0x362ada['where']=qs[_0xc240('0x38')](_[_0xc240('0x59')](_0x205561['query'],_0x51acdd[_0xc240('0x38')]));if(_0x205561['query'][_0xc240('0x41')]){_0x362ada['where']=_[_0xc240('0x42')](_0x362ada[_0xc240('0x40')],{'$or':_[_0xc240('0x30')](_0x362ada[_0xc240('0x3a')],function(_0x31a83a){var _0x194cb1={};_0x194cb1[_0x31a83a]={'$like':'%'+_0x205561[_0xc240('0x37')][_0xc240('0x41')]+'%'};return _0x194cb1;})});}_0x362ada=_[_0xc240('0x42')]({},_0x362ada,_0x205561[_0xc240('0x5b')]);return _0xf07bcb[_0xc240('0x63')](_0x362ada);}})[_0xc240('0x26')](function(_0x58796a){if(_0x58796a){_0x45f043=_0x58796a[_0xc240('0x3c')];if(!_0x205561[_0xc240('0x37')][_0xc240('0x64')](_0xc240('0x3d'))){_0x362ada[_0xc240('0x23')]=qs['limit'](_0x205561[_0xc240('0x37')]['limit']);_0x362ada['offset']=qs[_0xc240('0x22')](_0x205561[_0xc240('0x37')][_0xc240('0x22')]);}return _0xf07bcb['getTeams'](_0x362ada);}})[_0xc240('0x26')](function(_0x365fa7){if(_0x365fa7){return _0x365fa7?{'count':_0x45f043,'rows':_0x365fa7}:null;}})['then'](respondWithResult(_0x5882cd,null))[_0xc240('0x47')](handleError(_0x5882cd,null));};exports[_0xc240('0x65')]=function(_0x433656,_0x5c87d9,_0x323dd1){var _0xbdb03c=_0x433656[_0xc240('0x4c')][_0xc240('0x66')];return db[_0xc240('0x62')]['findAll']({'where':{'id':_0xbdb03c},'attributes':['id'],'include':[{'model':db[_0xc240('0x67')],'as':_0xc240('0x68'),'attributes':['id',_0xc240('0x2d'),_0xc240('0x69'),_0xc240('0x6a'),_0xc240('0x6b')],'raw':!![]}]})['then'](function(_0x1cf53b){if(_0x1cf53b){var _0x2b0cbe=_[_0xc240('0x6c')](_0x1cf53b,function(_0x357c2f){var _0x430906=_0x357c2f[_0xc240('0x27')]({'plain':!![]});return _0x430906['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x433656['params']['id']}})[_0xc240('0x26')](function(_0x4a0c2e){return db[_0xc240('0x6d')][_0xc240('0x6e')](function(_0x4e5cd2){return _0x4a0c2e[_0xc240('0x65')](_0xbdb03c,{'transaction':_0x4e5cd2})[_0xc240('0x26')](function(){return BPromise[_0xc240('0x6f')](_0x2b0cbe,function(_0x486ecd){return db[_0xc240('0x58')][_0xc240('0x70')]({'where':{'UserId':_0x486ecd['id'],'SmsQueueId':_0x433656[_0xc240('0x49')]['id']},'transaction':_0x4e5cd2});});})['then'](function(){_0x2b0cbe['forEach'](function(_0x6d0219){socket[_0xc240('0x71')](_0xc240('0x72'),{'UserId':_0x6d0219['id'],'SmsQueueId':_0x4a0c2e['id']});});});});});}})['then'](respondWithStatusCode(_0x5c87d9,null))[_0xc240('0x47')](handleError(_0x5c87d9,null));};exports[_0xc240('0x73')]=function(_0x59d2a9,_0x53d4e4,_0x1a85a6){return db[_0xc240('0x62')]['findAll']({'where':{'id':_0x59d2a9[_0xc240('0x37')][_0xc240('0x66')]},'attributes':['id'],'include':[{'model':db[_0xc240('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc240('0x26')](handleEntityNotFound(_0x53d4e4,null))[_0xc240('0x26')](function(_0x4f2d66){var _0x2da884=_[_0xc240('0x30')](_0x4f2d66,'id');var _0x3f5bd5=[];var _0x468500=[];var _0x3ebf9a=squel['select']();_0x3ebf9a[_0xc240('0x74')](_0xc240('0x75'))[_0xc240('0x76')](_0xc240('0x77'),'tq')[_0xc240('0x78')]('user_has_teams','ut',_0xc240('0x79'))['where'](_0xc240('0x7a'),_0x59d2a9[_0xc240('0x49')]['id']);for(var _0x9eaf3f=0x0;_0x9eaf3f<_0x4f2d66[_0xc240('0x3c')];_0x9eaf3f+=0x1){let _0x2cd294=_0x4f2d66[_0x9eaf3f];for(var _0x52e7e7=0x0;_0x52e7e7<_0x2cd294[_0xc240('0x68')][_0xc240('0x3c')];_0x52e7e7+=0x1){let _0x3fde3c=_0x2cd294[_0xc240('0x68')][_0x52e7e7];var _0x6bb648=_0x3ebf9a['clone']();_0x6bb648[_0xc240('0x40')]('ut.UserId\x20=\x20?',_0x3fde3c['id']);_0x468500['push'](db[_0xc240('0x6d')][_0xc240('0x37')](_0x6bb648[_0xc240('0x7b')](),{'type':db['sequelize']['QueryTypes'][_0xc240('0x7c')]})[_0xc240('0x26')](function(_0x4f30a2){if(_0x4f30a2['length']===0x1){return _0x3fde3c['id'];}else{var _0x53d55b=_['every'](_[_0xc240('0x30')](_0x4f30a2,_0xc240('0x7d')),function(_0x5103f3){return _[_0xc240('0x7e')](_0x2da884,_0x5103f3);});if(_0x53d55b){return _0x3fde3c['id'];}}}));}}return BPromise[_0xc240('0x7f')](_0x468500)[_0xc240('0x26')](function(_0x4d5a39){_0x3f5bd5=_(_0x3f5bd5)[_0xc240('0x80')](_0x4d5a39)[_0xc240('0x81')]()[_0xc240('0x82')]();return db[_0xc240('0x31')][_0xc240('0x4a')]({'where':{'id':_0x59d2a9['params']['id']}})[_0xc240('0x26')](function(_0x223edc){return db['sequelize'][_0xc240('0x6e')](function(_0x32a3aa){return _0x223edc['removeTeams'](_0x59d2a9[_0xc240('0x37')][_0xc240('0x66')],{'transaction':_0x32a3aa})[_0xc240('0x26')](function(){if(!_[_0xc240('0x83')](_0x3f5bd5)){return _0x223edc[_0xc240('0x84')](_0x3f5bd5,{'transaction':_0x32a3aa});}})[_0xc240('0x26')](function(){_0x3f5bd5['forEach'](function(_0x33803d){socket[_0xc240('0x71')](_0xc240('0x85'),{'UserId':_0x33803d,'SmsQueueId':_0x223edc['id']});});});});});});})[_0xc240('0x26')](respondWithStatusCode(_0x53d4e4,null))[_0xc240('0x47')](handleError(_0x53d4e4,null));};exports[_0xc240('0x86')]=function(_0x24650c,_0x5951bb,_0x3fe951){return db[_0xc240('0x31')][_0xc240('0x4a')]({'where':{'id':_0x24650c[_0xc240('0x49')]['id']}})['then'](handleEntityNotFound(_0x5951bb,null))[_0xc240('0x26')](function(_0x58fac6){if(_0x58fac6){return _0x58fac6['addAgents'](_0x24650c['body'][_0xc240('0x66')],_[_0xc240('0x87')](_0x24650c[_0xc240('0x4c')],['ids','id'])||{})['spread'](function(_0x152d13){for(var _0x1ad27e=0x0;_0x1ad27e<_0x24650c[_0xc240('0x4c')][_0xc240('0x66')][_0xc240('0x3c')];_0x1ad27e+=0x1){socket[_0xc240('0x71')]('userSmsQueue:save',{'UserId':_0x24650c[_0xc240('0x4c')][_0xc240('0x66')][_0x1ad27e],'SmsQueueId':_0x24650c[_0xc240('0x49')]['id']});}return _0x152d13;});}})[_0xc240('0x26')](respondWithResult(_0x5951bb,null))[_0xc240('0x47')](handleError(_0x5951bb,null));};exports[_0xc240('0x84')]=function(_0x4fcc69,_0x345b76,_0xecb3e6){return db['SmsQueue'][_0xc240('0x4a')]({'where':{'id':_0x4fcc69['params']['id']}})[_0xc240('0x26')](handleEntityNotFound(_0x345b76,null))[_0xc240('0x26')](function(_0x35af5e){if(_0x35af5e){return _0x35af5e[_0xc240('0x84')](_0x4fcc69[_0xc240('0x37')][_0xc240('0x66')])[_0xc240('0x26')](function(){if(_['isArray'](_0x4fcc69[_0xc240('0x37')]['ids'])){for(var _0x208519=0x0;_0x208519<_0x4fcc69[_0xc240('0x37')]['ids'][_0xc240('0x3c')];_0x208519+=0x1){socket[_0xc240('0x71')](_0xc240('0x85'),{'UserId':Number(_0x4fcc69[_0xc240('0x37')][_0xc240('0x66')][_0x208519]),'SmsQueueId':Number(_0x4fcc69[_0xc240('0x49')]['id'])});}}else{socket[_0xc240('0x71')](_0xc240('0x85'),{'UserId':Number(_0x4fcc69[_0xc240('0x37')][_0xc240('0x66')]),'SmsQueueId':Number(_0x4fcc69[_0xc240('0x49')]['id'])});}});}})[_0xc240('0x26')](respondWithStatusCode(_0x345b76,null))[_0xc240('0x47')](handleError(_0x345b76,null));};exports[_0xc240('0x88')]=function(_0x162563,_0x1960f2,_0x5f1a52){var _0x9a4eae={};var _0x2d624d={};var _0x555e89;var _0x34c974;return db['SmsQueue'][_0xc240('0x61')]({'where':{'id':_0x162563['params']['id']}})['then'](handleEntityNotFound(_0x1960f2,null))[_0xc240('0x26')](function(_0x2758c9){if(_0x2758c9){_0x555e89=_0x2758c9;_0x2d624d[_0xc240('0x36')]=_[_0xc240('0x57')](db[_0xc240('0x67')][_0xc240('0x32')]);_0x2d624d[_0xc240('0x37')]=_[_0xc240('0x57')](_0x162563[_0xc240('0x37')]);_0x2d624d[_0xc240('0x38')]=_[_0xc240('0x39')](_0x2d624d['model'],_0x2d624d[_0xc240('0x37')]);_0x9a4eae[_0xc240('0x3a')]=_[_0xc240('0x39')](_0x2d624d['model'],qs[_0xc240('0x3b')](_0x162563[_0xc240('0x37')][_0xc240('0x3b')]));_0x9a4eae['attributes']=_0x9a4eae[_0xc240('0x3a')][_0xc240('0x3c')]?_0x9a4eae[_0xc240('0x3a')]:_0x2d624d[_0xc240('0x36')];_0x9a4eae[_0xc240('0x3e')]=qs[_0xc240('0x3f')](_0x162563[_0xc240('0x37')][_0xc240('0x3f')]);_0x9a4eae[_0xc240('0x40')]=qs[_0xc240('0x38')](_['pick'](_0x162563[_0xc240('0x37')],_0x2d624d['filters']));if(_0x162563['query'][_0xc240('0x41')]){_0x9a4eae[_0xc240('0x40')]=_[_0xc240('0x42')](_0x9a4eae[_0xc240('0x40')],{'$or':_['map'](_0x9a4eae[_0xc240('0x3a')],function(_0x4e1fe6){var _0x465868={};_0x465868[_0x4e1fe6]={'$like':'%'+_0x162563[_0xc240('0x37')][_0xc240('0x41')]+'%'};return _0x465868;})});}_0x9a4eae=_['merge']({},_0x9a4eae,_0x162563[_0xc240('0x5b')]);return _0x555e89[_0xc240('0x88')](_0x9a4eae);}})['then'](function(_0x1ca48a){if(_0x1ca48a){_0x34c974=_0x1ca48a[_0xc240('0x3c')];if(!_0x162563[_0xc240('0x37')][_0xc240('0x64')]('nolimit')){_0x9a4eae['limit']=qs['limit'](_0x162563['query'][_0xc240('0x23')]);_0x9a4eae['offset']=qs[_0xc240('0x22')](_0x162563[_0xc240('0x37')][_0xc240('0x22')]);}return _0x555e89['getAgents'](_0x9a4eae);}})[_0xc240('0x26')](function(_0x1fc475){if(_0x1fc475){return _0x1fc475?{'count':_0x34c974,'rows':_0x1fc475}:null;}})[_0xc240('0x26')](respondWithResult(_0x1960f2,null))['catch'](handleError(_0x1960f2,null));}; \ No newline at end of file +var _0xf5ab=['../../mysqldb','defaults','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','SmsQueues','UserProfileResource','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','include','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','error','body','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','value','transaction','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment'];(function(_0x2948bb,_0x3756a7){var _0x9bd815=function(_0x1ab480){while(--_0x1ab480){_0x2948bb['push'](_0x2948bb['shift']());}};_0x9bd815(++_0x3756a7);}(_0xf5ab,0x100));var _0xbf5a=function(_0xa4471d,_0x30dc1c){_0xa4471d=_0xa4471d-0x0;var _0x50f1e1=_0xf5ab[_0xa4471d];return _0x50f1e1;};'use strict';var pdf=require(_0xbf5a('0x0'));var emlformat=require(_0xbf5a('0x1'));var rimraf=require(_0xbf5a('0x2'));var zipdir=require(_0xbf5a('0x3'));var jsonpatch=require(_0xbf5a('0x4'));var rp=require(_0xbf5a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf5a('0x6'));var util=require(_0xbf5a('0x7'));var path=require('path');var sox=require(_0xbf5a('0x8'));var csv=require(_0xbf5a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf5a('0xa'));var squel=require(_0xbf5a('0xb'));var crypto=require(_0xbf5a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbf5a('0xd'));var toCsv=require(_0xbf5a('0x9'));var querystring=require(_0xbf5a('0xe'));var Papa=require(_0xbf5a('0xf'));var Redis=require(_0xbf5a('0x10'));var authService=require(_0xbf5a('0x11'));var qs=require(_0xbf5a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf5a('0x13'))('api');var utils=require(_0xbf5a('0x14'));var config=require(_0xbf5a('0x15'));var db=require(_0xbf5a('0x16'))['db'];config['redis']=_[_0xbf5a('0x17')](config[_0xbf5a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf5a('0x19'))(new Redis(config['redis']));require(_0xbf5a('0x1a'))[_0xbf5a('0x1b')](socket);function respondWithStatusCode(_0x12a8be,_0x3c566f){_0x3c566f=_0x3c566f||0xcc;return function(_0x2558cf){if(_0x2558cf){return _0x12a8be[_0xbf5a('0x1c')](_0x3c566f);}return _0x12a8be[_0xbf5a('0x1d')](_0x3c566f)[_0xbf5a('0x1e')]();};}function respondWithResult(_0x394447,_0x13b101){_0x13b101=_0x13b101||0xc8;return function(_0x4c6ff4){if(_0x4c6ff4){return _0x394447['status'](_0x13b101)[_0xbf5a('0x1f')](_0x4c6ff4);}};}function respondWithFilteredResult(_0x8756f2,_0x2f1644){return function(_0x501a69){if(_0x501a69){var _0x52f69c=_0x501a69[_0xbf5a('0x20')],_0x46d41a=_0x2f1644['offset'],_0x5f56b4=_0x2f1644[_0xbf5a('0x21')]+_0x2f1644[_0xbf5a('0x22')],_0x4a5668;if(_0x5f56b4>=_0x52f69c){_0x5f56b4=_0x52f69c;_0x4a5668=0xc8;}else{_0x4a5668=0xce;}_0x8756f2[_0xbf5a('0x1d')](_0x4a5668);return _0x8756f2[_0xbf5a('0x23')](_0xbf5a('0x24'),_0x46d41a+'-'+_0x5f56b4+'/'+_0x52f69c)[_0xbf5a('0x1f')](_0x501a69);}return null;};}function patchUpdates(_0x11f191){return function(_0xd2efb2){try{jsonpatch[_0xbf5a('0x25')](_0xd2efb2,_0x11f191,!![]);}catch(_0x1da121){return BPromise[_0xbf5a('0x26')](_0x1da121);}return _0xd2efb2['save']();};}function saveUpdates(_0x409c27,_0x23f17c){return function(_0x3ab582){if(_0x3ab582){return _0x3ab582[_0xbf5a('0x27')](_0x409c27)[_0xbf5a('0x28')](function(_0x3c3fe4){return _0x3c3fe4;});}return null;};}function removeEntity(_0x23e7d4,_0x26e04d){return function(_0x26140d){if(_0x26140d){return _0x26140d[_0xbf5a('0x29')]()[_0xbf5a('0x28')](function(){var _0x39dda4=_0x26140d['get']({'plain':!![]});var _0x24286e=_0xbf5a('0x2a');return db[_0xbf5a('0x2b')][_0xbf5a('0x29')]({'where':{'type':_0x24286e,'resourceId':_0x39dda4['id']}})[_0xbf5a('0x28')](function(){return _0x26140d;});})[_0xbf5a('0x28')](function(){_0x23e7d4[_0xbf5a('0x1d')](0xcc)[_0xbf5a('0x1e')]();});}};}function handleEntityNotFound(_0xfbd2e2,_0x1d6a73){return function(_0x2ee837){if(!_0x2ee837){_0xfbd2e2['sendStatus'](0x194);}return _0x2ee837;};}function handleError(_0x6b9eb5,_0x45ef60){_0x45ef60=_0x45ef60||0x1f4;return function(_0x1711b2){logger['error'](_0x1711b2[_0xbf5a('0x2c')]);if(_0x1711b2[_0xbf5a('0x2d')]){delete _0x1711b2[_0xbf5a('0x2d')];}_0x6b9eb5[_0xbf5a('0x1d')](_0x45ef60)[_0xbf5a('0x2e')](_0x1711b2);};}exports[_0xbf5a('0x2f')]=function(_0x59e18a,_0x1cf167){var _0x1e1edb={},_0x4631f7={},_0x15deea={'count':0x0,'rows':[]};var _0x1ff49e=_[_0xbf5a('0x30')](db[_0xbf5a('0x31')][_0xbf5a('0x32')],function(_0x182e62){return{'name':_0x182e62[_0xbf5a('0x33')],'type':_0x182e62[_0xbf5a('0x34')][_0xbf5a('0x35')]};});_0x4631f7[_0xbf5a('0x36')]=_['map'](_0x1ff49e,_0xbf5a('0x2d'));_0x4631f7[_0xbf5a('0x37')]=_[_0xbf5a('0x38')](_0x59e18a[_0xbf5a('0x37')]);_0x4631f7[_0xbf5a('0x39')]=_[_0xbf5a('0x3a')](_0x4631f7[_0xbf5a('0x36')],_0x4631f7[_0xbf5a('0x37')]);_0x1e1edb[_0xbf5a('0x3b')]=_[_0xbf5a('0x3a')](_0x4631f7[_0xbf5a('0x36')],qs['fields'](_0x59e18a[_0xbf5a('0x37')][_0xbf5a('0x3c')]));_0x1e1edb[_0xbf5a('0x3b')]=_0x1e1edb[_0xbf5a('0x3b')][_0xbf5a('0x3d')]?_0x1e1edb[_0xbf5a('0x3b')]:_0x4631f7[_0xbf5a('0x36')];if(!_0x59e18a[_0xbf5a('0x37')][_0xbf5a('0x3e')]('nolimit')){_0x1e1edb[_0xbf5a('0x22')]=qs[_0xbf5a('0x22')](_0x59e18a['query'][_0xbf5a('0x22')]);_0x1e1edb[_0xbf5a('0x21')]=qs[_0xbf5a('0x21')](_0x59e18a[_0xbf5a('0x37')][_0xbf5a('0x21')]);}_0x1e1edb[_0xbf5a('0x3f')]=qs[_0xbf5a('0x40')](_0x59e18a[_0xbf5a('0x37')][_0xbf5a('0x40')]);_0x1e1edb[_0xbf5a('0x41')]=qs[_0xbf5a('0x39')](_['pick'](_0x59e18a[_0xbf5a('0x37')],_0x4631f7[_0xbf5a('0x39')]),_0x1ff49e);if(_0x59e18a[_0xbf5a('0x37')]['filter']){_0x1e1edb['where']=_[_0xbf5a('0x42')](_0x1e1edb[_0xbf5a('0x41')],{'$or':_[_0xbf5a('0x30')](_0x1ff49e,function(_0x2052ca){if(_0x2052ca[_0xbf5a('0x34')]!=='VIRTUAL'){var _0x3d18c1={};_0x3d18c1[_0x2052ca['name']]={'$like':'%'+_0x59e18a[_0xbf5a('0x37')][_0xbf5a('0x43')]+'%'};return _0x3d18c1;}})});}_0x1e1edb=_[_0xbf5a('0x42')]({},_0x1e1edb,_0x59e18a[_0xbf5a('0x44')]);var _0x1dfb23={'where':_0x1e1edb[_0xbf5a('0x41')]};return db[_0xbf5a('0x31')][_0xbf5a('0x20')](_0x1dfb23)[_0xbf5a('0x28')](function(_0x47621e){_0x15deea[_0xbf5a('0x20')]=_0x47621e;if(_0x59e18a['query'][_0xbf5a('0x45')]){_0x1e1edb[_0xbf5a('0x46')]=[{'all':!![]}];}return db[_0xbf5a('0x31')]['findAll'](_0x1e1edb);})[_0xbf5a('0x28')](function(_0x336e89){_0x15deea[_0xbf5a('0x47')]=_0x336e89;return _0x15deea;})[_0xbf5a('0x28')](respondWithFilteredResult(_0x1cf167,_0x1e1edb))[_0xbf5a('0x48')](handleError(_0x1cf167,null));};exports['show']=function(_0x45699f,_0x92c13d){var _0x4a4c9a={'raw':!![],'where':{'id':_0x45699f[_0xbf5a('0x49')]['id']}},_0x1c0a55={};_0x1c0a55[_0xbf5a('0x36')]=_[_0xbf5a('0x38')](db[_0xbf5a('0x31')][_0xbf5a('0x32')]);_0x1c0a55[_0xbf5a('0x37')]=_['keys'](_0x45699f[_0xbf5a('0x37')]);_0x1c0a55[_0xbf5a('0x39')]=_[_0xbf5a('0x3a')](_0x1c0a55['model'],_0x1c0a55[_0xbf5a('0x37')]);_0x4a4c9a['attributes']=_[_0xbf5a('0x3a')](_0x1c0a55['model'],qs[_0xbf5a('0x3c')](_0x45699f[_0xbf5a('0x37')][_0xbf5a('0x3c')]));_0x4a4c9a[_0xbf5a('0x3b')]=_0x4a4c9a['attributes'][_0xbf5a('0x3d')]?_0x4a4c9a['attributes']:_0x1c0a55[_0xbf5a('0x36')];if(_0x45699f['query'][_0xbf5a('0x45')]){_0x4a4c9a[_0xbf5a('0x46')]=[{'all':!![]}];}_0x4a4c9a=_['merge']({},_0x4a4c9a,_0x45699f[_0xbf5a('0x44')]);return db[_0xbf5a('0x31')][_0xbf5a('0x4a')](_0x4a4c9a)[_0xbf5a('0x28')](handleEntityNotFound(_0x92c13d,null))['then'](respondWithResult(_0x92c13d,null))[_0xbf5a('0x48')](handleError(_0x92c13d,null));};exports[_0xbf5a('0x4b')]=function(_0x1cfd2e,_0x1bb094){return db[_0xbf5a('0x31')]['create'](_0x1cfd2e['body'],{})[_0xbf5a('0x28')](function(_0x3ce00c){var _0x326a8a=_0x1cfd2e['user']['get']({'plain':!![]});if(!_0x326a8a)throw new Error(_0xbf5a('0x4c'));if(_0x326a8a[_0xbf5a('0x4d')]===_0xbf5a('0x4e')){var _0xb54221=_0x3ce00c[_0xbf5a('0x4f')]({'plain':!![]});var _0x159a74=_0xbf5a('0x2a');return db['UserProfileSection'][_0xbf5a('0x4a')]({'where':{'name':_0x159a74,'userProfileId':_0x326a8a['userProfileId']},'raw':!![]})[_0xbf5a('0x28')](function(_0x43e905){if(_0x43e905&&_0x43e905['autoAssociation']===0x0){return db[_0xbf5a('0x2b')][_0xbf5a('0x4b')]({'name':_0xb54221[_0xbf5a('0x2d')],'resourceId':_0xb54221['id'],'type':_0x43e905[_0xbf5a('0x2d')],'sectionId':_0x43e905['id']},{})[_0xbf5a('0x28')](function(){return _0x3ce00c;});}else{return _0x3ce00c;}})[_0xbf5a('0x48')](function(_0x3355e1){logger[_0xbf5a('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3355e1);throw _0x3355e1;});}return _0x3ce00c;})['then'](respondWithResult(_0x1bb094,0xc9))['catch'](handleError(_0x1bb094,null));};exports[_0xbf5a('0x27')]=function(_0x4773ce,_0x562704){if(_0x4773ce['body']['id']){delete _0x4773ce[_0xbf5a('0x51')]['id'];}return db['SmsQueue'][_0xbf5a('0x4a')]({'where':{'id':_0x4773ce[_0xbf5a('0x49')]['id']}})[_0xbf5a('0x28')](handleEntityNotFound(_0x562704,null))[_0xbf5a('0x28')](saveUpdates(_0x4773ce[_0xbf5a('0x51')],null))[_0xbf5a('0x28')](respondWithResult(_0x562704,null))[_0xbf5a('0x48')](handleError(_0x562704,null));};exports[_0xbf5a('0x29')]=function(_0x3c3986,_0x1f66b1){return db[_0xbf5a('0x31')][_0xbf5a('0x4a')]({'where':{'id':_0x3c3986[_0xbf5a('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f66b1,null))[_0xbf5a('0x28')](removeEntity(_0x1f66b1,null))[_0xbf5a('0x48')](handleError(_0x1f66b1,null));};exports[_0xbf5a('0x52')]=function(_0x68e209,_0x609307){return db['SmsQueue']['describe']()[_0xbf5a('0x28')](respondWithResult(_0x609307,null))[_0xbf5a('0x48')](handleError(_0x609307,null));};exports[_0xbf5a('0x53')]=function(_0xcc56a7,_0x47cf9c,_0x409281){var _0x78cebf={'raw':!![],'where':{}},_0x452fcd={},_0x2c3958;return db['SmsQueue'][_0xbf5a('0x54')]({'where':{'id':_0xcc56a7['params']['id']}})[_0xbf5a('0x28')](handleEntityNotFound(_0x47cf9c,null))['then'](function(_0x94699f){if(_0x94699f){_0x2c3958=_0x94699f['get']({'plain':!![]});_0x452fcd[_0xbf5a('0x36')]=_[_0xbf5a('0x38')](db[_0xbf5a('0x55')][_0xbf5a('0x32')]);_0x452fcd[_0xbf5a('0x37')]=_[_0xbf5a('0x38')](_0xcc56a7[_0xbf5a('0x37')]);_0x452fcd[_0xbf5a('0x39')]=_[_0xbf5a('0x3a')](_0x452fcd[_0xbf5a('0x36')],_0x452fcd[_0xbf5a('0x37')]);_0x78cebf[_0xbf5a('0x3b')]=_[_0xbf5a('0x3a')](_0x452fcd['model'],qs[_0xbf5a('0x3c')](_0xcc56a7['query'][_0xbf5a('0x3c')]));_0x78cebf[_0xbf5a('0x3b')]=_0x78cebf['attributes'][_0xbf5a('0x3d')]?_0x78cebf[_0xbf5a('0x3b')]:_0x452fcd['model'];if(!_0xcc56a7[_0xbf5a('0x37')][_0xbf5a('0x3e')]('nolimit')){_0x78cebf[_0xbf5a('0x22')]=qs[_0xbf5a('0x22')](_0xcc56a7[_0xbf5a('0x37')]['limit']);_0x78cebf[_0xbf5a('0x21')]=qs[_0xbf5a('0x21')](_0xcc56a7[_0xbf5a('0x37')][_0xbf5a('0x21')]);}_0x78cebf['order']=qs[_0xbf5a('0x40')](_0xcc56a7[_0xbf5a('0x37')][_0xbf5a('0x40')]);_0x78cebf[_0xbf5a('0x41')]=qs[_0xbf5a('0x39')](_[_0xbf5a('0x56')](_0xcc56a7['query'],_0x452fcd[_0xbf5a('0x39')]));_0x78cebf[_0xbf5a('0x41')][_0xbf5a('0x57')]=_0x94699f['id'];if(_0xcc56a7[_0xbf5a('0x37')][_0xbf5a('0x43')]){_0x78cebf[_0xbf5a('0x41')]=_[_0xbf5a('0x42')](_0x78cebf[_0xbf5a('0x41')],{'$or':_['map'](_0x78cebf[_0xbf5a('0x3b')],function(_0x316e05){var _0x4a0f45={};_0x4a0f45[_0x316e05]={'$like':'%'+_0xcc56a7['query'][_0xbf5a('0x43')]+'%'};return _0x4a0f45;})});}_0x78cebf=_[_0xbf5a('0x42')]({},_0x78cebf,_0xcc56a7[_0xbf5a('0x44')]);return db[_0xbf5a('0x55')][_0xbf5a('0x58')](_0x78cebf);}})[_0xbf5a('0x28')](function(_0x210a0c){if(_0x210a0c){return db[_0xbf5a('0x59')][_0xbf5a('0x5a')]({'where':{'id':_[_0xbf5a('0x30')](_0x210a0c,_0xbf5a('0x5b')),'role':_0xbf5a('0x5c')},'attributes':['id',_0xbf5a('0x2d'),'smsPause',_0xbf5a('0x5d'),_0xbf5a('0x5e')]});}})[_0xbf5a('0x28')](function(_0x31c2fd){if(_0x31c2fd){return{'count':_0x31c2fd[_0xbf5a('0x20')],'rows':_[_0xbf5a('0x30')](_0x31c2fd['rows'],function(_0x14ffb1){return{'membername':_0x14ffb1[_0xbf5a('0x2d')],'UserId':_0x14ffb1['id'],'queue_name':_0x2c3958[_0xbf5a('0x2d')],'SmsQueueId':_0x2c3958['id'],'interface':util[_0xbf5a('0x5f')](_0xbf5a('0x60'),_0xbf5a('0x61'),_0x14ffb1[_0xbf5a('0x2d')]),'penalty':0x0,'paused':_0x14ffb1['smsPause'],'createdAt':_0x14ffb1[_0xbf5a('0x5e')],'updatedAt':_0x14ffb1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbf5a('0x28')](respondWithFilteredResult(_0x47cf9c,_0x78cebf))[_0xbf5a('0x48')](handleError(_0x47cf9c,null));};exports[_0xbf5a('0x62')]=function(_0x44381b,_0x204bf6,_0x900273){var _0x4cce9c={};var _0x7b1c4e={};var _0x8fc83b;var _0x206f04;return db[_0xbf5a('0x31')][_0xbf5a('0x54')]({'where':{'id':_0x44381b[_0xbf5a('0x49')]['id']}})['then'](handleEntityNotFound(_0x204bf6,null))['then'](function(_0x551f47){if(_0x551f47){_0x8fc83b=_0x551f47;_0x7b1c4e[_0xbf5a('0x36')]=_[_0xbf5a('0x38')](db[_0xbf5a('0x63')][_0xbf5a('0x32')]);_0x7b1c4e['query']=_[_0xbf5a('0x38')](_0x44381b[_0xbf5a('0x37')]);_0x7b1c4e[_0xbf5a('0x39')]=_[_0xbf5a('0x3a')](_0x7b1c4e[_0xbf5a('0x36')],_0x7b1c4e[_0xbf5a('0x37')]);_0x4cce9c['attributes']=_[_0xbf5a('0x3a')](_0x7b1c4e[_0xbf5a('0x36')],qs['fields'](_0x44381b[_0xbf5a('0x37')]['fields']));_0x4cce9c[_0xbf5a('0x3b')]=_0x4cce9c[_0xbf5a('0x3b')][_0xbf5a('0x3d')]?_0x4cce9c['attributes']:_0x7b1c4e[_0xbf5a('0x36')];_0x4cce9c['order']=qs[_0xbf5a('0x40')](_0x44381b[_0xbf5a('0x37')][_0xbf5a('0x40')]);_0x4cce9c[_0xbf5a('0x41')]=qs[_0xbf5a('0x39')](_['pick'](_0x44381b[_0xbf5a('0x37')],_0x7b1c4e[_0xbf5a('0x39')]));if(_0x44381b['query'][_0xbf5a('0x43')]){_0x4cce9c[_0xbf5a('0x41')]=_[_0xbf5a('0x42')](_0x4cce9c[_0xbf5a('0x41')],{'$or':_[_0xbf5a('0x30')](_0x4cce9c[_0xbf5a('0x3b')],function(_0x25fff1){var _0x13f54c={};_0x13f54c[_0x25fff1]={'$like':'%'+_0x44381b['query'][_0xbf5a('0x43')]+'%'};return _0x13f54c;})});}_0x4cce9c=_['merge']({},_0x4cce9c,_0x44381b[_0xbf5a('0x44')]);return _0x8fc83b[_0xbf5a('0x62')](_0x4cce9c);}})[_0xbf5a('0x28')](function(_0x3d4b98){if(_0x3d4b98){_0x206f04=_0x3d4b98['length'];if(!_0x44381b[_0xbf5a('0x37')]['hasOwnProperty']('nolimit')){_0x4cce9c['limit']=qs[_0xbf5a('0x22')](_0x44381b[_0xbf5a('0x37')][_0xbf5a('0x22')]);_0x4cce9c[_0xbf5a('0x21')]=qs[_0xbf5a('0x21')](_0x44381b[_0xbf5a('0x37')][_0xbf5a('0x21')]);}return _0x8fc83b[_0xbf5a('0x62')](_0x4cce9c);}})['then'](function(_0x1bee56){if(_0x1bee56){return _0x1bee56?{'count':_0x206f04,'rows':_0x1bee56}:null;}})[_0xbf5a('0x28')](respondWithResult(_0x204bf6,null))[_0xbf5a('0x48')](handleError(_0x204bf6,null));};exports[_0xbf5a('0x64')]=function(_0x3d23ab,_0x22b241,_0x1025a1){var _0x16b4a1=_0x3d23ab[_0xbf5a('0x51')][_0xbf5a('0x65')];return db[_0xbf5a('0x63')][_0xbf5a('0x58')]({'where':{'id':_0x16b4a1},'attributes':['id'],'include':[{'model':db[_0xbf5a('0x59')],'as':_0xbf5a('0x66'),'attributes':['id','name',_0xbf5a('0x67'),_0xbf5a('0x68'),_0xbf5a('0x69')],'raw':!![]}]})[_0xbf5a('0x28')](function(_0x5bb5c9){if(_0x5bb5c9){var _0x290ef2=_[_0xbf5a('0x6a')](_0x5bb5c9,function(_0x3cf5f9){var _0x28e99f=_0x3cf5f9[_0xbf5a('0x4f')]({'plain':!![]});return _0x28e99f['Agents'];});return db[_0xbf5a('0x31')][_0xbf5a('0x4a')]({'where':{'id':_0x3d23ab[_0xbf5a('0x49')]['id']}})[_0xbf5a('0x28')](function(_0x2f9983){return db[_0xbf5a('0x6b')]['transaction'](function(_0x19f6b1){return _0x2f9983['addTeams'](_0x16b4a1,{'transaction':_0x19f6b1})[_0xbf5a('0x28')](function(){return BPromise[_0xbf5a('0x6c')](_0x290ef2,function(_0x28e912){return db['UserSmsQueue'][_0xbf5a('0x6d')]({'where':{'UserId':_0x28e912['id'],'SmsQueueId':_0x3d23ab['params']['id']},'transaction':_0x19f6b1});});})[_0xbf5a('0x28')](function(){_0x290ef2[_0xbf5a('0x6e')](function(_0xc5db87){socket[_0xbf5a('0x6f')](_0xbf5a('0x70'),{'UserId':_0xc5db87['id'],'SmsQueueId':_0x2f9983['id']});});});});});}})[_0xbf5a('0x28')](respondWithStatusCode(_0x22b241,null))[_0xbf5a('0x48')](handleError(_0x22b241,null));};exports['removeTeams']=function(_0x150046,_0x398213,_0x38dab){return db[_0xbf5a('0x63')][_0xbf5a('0x58')]({'where':{'id':_0x150046['query'][_0xbf5a('0x65')]},'attributes':['id'],'include':[{'model':db[_0xbf5a('0x59')],'as':_0xbf5a('0x66'),'attributes':['id'],'raw':!![]}]})[_0xbf5a('0x28')](handleEntityNotFound(_0x398213,null))[_0xbf5a('0x28')](function(_0x2b5550){var _0x5496ea=_[_0xbf5a('0x30')](_0x2b5550,'id');var _0x29a39a=[];var _0x5ccf8d=[];var _0x4834b2=squel[_0xbf5a('0x71')]();_0x4834b2[_0xbf5a('0x72')](_0xbf5a('0x73'))[_0xbf5a('0x74')](_0xbf5a('0x75'),'tq')['join'](_0xbf5a('0x76'),'ut',_0xbf5a('0x77'))[_0xbf5a('0x41')](_0xbf5a('0x78'),_0x150046[_0xbf5a('0x49')]['id']);for(var _0x5a2b94=0x0;_0x5a2b94<_0x2b5550['length'];_0x5a2b94+=0x1){let _0x395926=_0x2b5550[_0x5a2b94];for(var _0x5019a1=0x0;_0x5019a1<_0x395926[_0xbf5a('0x66')]['length'];_0x5019a1+=0x1){let _0x723d22=_0x395926['Agents'][_0x5019a1];var _0x26c741=_0x4834b2['clone']();_0x26c741[_0xbf5a('0x41')](_0xbf5a('0x79'),_0x723d22['id']);_0x5ccf8d[_0xbf5a('0x7a')](db[_0xbf5a('0x6b')][_0xbf5a('0x37')](_0x26c741[_0xbf5a('0x7b')](),{'type':db[_0xbf5a('0x6b')][_0xbf5a('0x7c')]['SELECT']})[_0xbf5a('0x28')](function(_0x4e0987){if(_0x4e0987[_0xbf5a('0x3d')]===0x1){return _0x723d22['id'];}else{var _0x1e6376=_[_0xbf5a('0x7d')](_[_0xbf5a('0x30')](_0x4e0987,_0xbf5a('0x7e')),function(_0x4b23a5){return _[_0xbf5a('0x7f')](_0x5496ea,_0x4b23a5);});if(_0x1e6376){return _0x723d22['id'];}}}));}}return BPromise['all'](_0x5ccf8d)['then'](function(_0x439811){_0x29a39a=_(_0x29a39a)['union'](_0x439811)['compact']()[_0xbf5a('0x80')]();return db[_0xbf5a('0x31')]['find']({'where':{'id':_0x150046[_0xbf5a('0x49')]['id']}})[_0xbf5a('0x28')](function(_0x39da44){return db[_0xbf5a('0x6b')][_0xbf5a('0x81')](function(_0x308337){return _0x39da44[_0xbf5a('0x82')](_0x150046[_0xbf5a('0x37')][_0xbf5a('0x65')],{'transaction':_0x308337})[_0xbf5a('0x28')](function(){if(!_[_0xbf5a('0x83')](_0x29a39a)){return _0x39da44[_0xbf5a('0x84')](_0x29a39a,{'transaction':_0x308337});}})[_0xbf5a('0x28')](function(){_0x29a39a[_0xbf5a('0x6e')](function(_0x4613fc){socket[_0xbf5a('0x6f')](_0xbf5a('0x85'),{'UserId':_0x4613fc,'SmsQueueId':_0x39da44['id']});});});});});});})[_0xbf5a('0x28')](respondWithStatusCode(_0x398213,null))[_0xbf5a('0x48')](handleError(_0x398213,null));};exports[_0xbf5a('0x86')]=function(_0x11d1f6,_0x2cfbfe,_0x50d50d){return db[_0xbf5a('0x31')][_0xbf5a('0x4a')]({'where':{'id':_0x11d1f6[_0xbf5a('0x49')]['id']}})[_0xbf5a('0x28')](handleEntityNotFound(_0x2cfbfe,null))[_0xbf5a('0x28')](function(_0x59caab){if(_0x59caab){return _0x59caab[_0xbf5a('0x86')](_0x11d1f6['body'][_0xbf5a('0x65')],_[_0xbf5a('0x87')](_0x11d1f6[_0xbf5a('0x51')],[_0xbf5a('0x65'),'id'])||{})[_0xbf5a('0x88')](function(_0x2f73e3){for(var _0x259afb=0x0;_0x259afb<_0x11d1f6[_0xbf5a('0x51')][_0xbf5a('0x65')][_0xbf5a('0x3d')];_0x259afb+=0x1){socket[_0xbf5a('0x6f')](_0xbf5a('0x70'),{'UserId':_0x11d1f6['body'][_0xbf5a('0x65')][_0x259afb],'SmsQueueId':_0x11d1f6[_0xbf5a('0x49')]['id']});}return _0x2f73e3;});}})[_0xbf5a('0x28')](respondWithResult(_0x2cfbfe,null))[_0xbf5a('0x48')](handleError(_0x2cfbfe,null));};exports[_0xbf5a('0x84')]=function(_0x2c2a8b,_0x45b478,_0x7bb32e){return db[_0xbf5a('0x31')][_0xbf5a('0x4a')]({'where':{'id':_0x2c2a8b['params']['id']}})[_0xbf5a('0x28')](handleEntityNotFound(_0x45b478,null))[_0xbf5a('0x28')](function(_0xc1d707){if(_0xc1d707){return _0xc1d707[_0xbf5a('0x84')](_0x2c2a8b[_0xbf5a('0x37')][_0xbf5a('0x65')])['then'](function(){if(_[_0xbf5a('0x89')](_0x2c2a8b[_0xbf5a('0x37')]['ids'])){for(var _0x108546=0x0;_0x108546<_0x2c2a8b['query'][_0xbf5a('0x65')][_0xbf5a('0x3d')];_0x108546+=0x1){socket[_0xbf5a('0x6f')](_0xbf5a('0x85'),{'UserId':Number(_0x2c2a8b[_0xbf5a('0x37')][_0xbf5a('0x65')][_0x108546]),'SmsQueueId':Number(_0x2c2a8b['params']['id'])});}}else{socket[_0xbf5a('0x6f')](_0xbf5a('0x85'),{'UserId':Number(_0x2c2a8b[_0xbf5a('0x37')][_0xbf5a('0x65')]),'SmsQueueId':Number(_0x2c2a8b[_0xbf5a('0x49')]['id'])});}});}})[_0xbf5a('0x28')](respondWithStatusCode(_0x45b478,null))[_0xbf5a('0x48')](handleError(_0x45b478,null));};exports[_0xbf5a('0x8a')]=function(_0x5acc80,_0x47ef22,_0x61961){var _0x224a22={};var _0xb24e69={};var _0x82ef45;var _0x5d5728;return db[_0xbf5a('0x31')]['findOne']({'where':{'id':_0x5acc80['params']['id']}})[_0xbf5a('0x28')](handleEntityNotFound(_0x47ef22,null))[_0xbf5a('0x28')](function(_0x483e8e){if(_0x483e8e){_0x82ef45=_0x483e8e;_0xb24e69[_0xbf5a('0x36')]=_[_0xbf5a('0x38')](db[_0xbf5a('0x59')]['rawAttributes']);_0xb24e69[_0xbf5a('0x37')]=_[_0xbf5a('0x38')](_0x5acc80['query']);_0xb24e69[_0xbf5a('0x39')]=_[_0xbf5a('0x3a')](_0xb24e69['model'],_0xb24e69['query']);_0x224a22[_0xbf5a('0x3b')]=_['intersection'](_0xb24e69[_0xbf5a('0x36')],qs[_0xbf5a('0x3c')](_0x5acc80['query'][_0xbf5a('0x3c')]));_0x224a22[_0xbf5a('0x3b')]=_0x224a22[_0xbf5a('0x3b')][_0xbf5a('0x3d')]?_0x224a22[_0xbf5a('0x3b')]:_0xb24e69[_0xbf5a('0x36')];_0x224a22[_0xbf5a('0x3f')]=qs['sort'](_0x5acc80[_0xbf5a('0x37')]['sort']);_0x224a22[_0xbf5a('0x41')]=qs['filters'](_[_0xbf5a('0x56')](_0x5acc80[_0xbf5a('0x37')],_0xb24e69[_0xbf5a('0x39')]));if(_0x5acc80[_0xbf5a('0x37')]['filter']){_0x224a22['where']=_[_0xbf5a('0x42')](_0x224a22['where'],{'$or':_[_0xbf5a('0x30')](_0x224a22[_0xbf5a('0x3b')],function(_0x5490fd){var _0x15a99c={};_0x15a99c[_0x5490fd]={'$like':'%'+_0x5acc80[_0xbf5a('0x37')][_0xbf5a('0x43')]+'%'};return _0x15a99c;})});}_0x224a22=_[_0xbf5a('0x42')]({},_0x224a22,_0x5acc80[_0xbf5a('0x44')]);return _0x82ef45[_0xbf5a('0x8a')](_0x224a22);}})[_0xbf5a('0x28')](function(_0x4aa230){if(_0x4aa230){_0x5d5728=_0x4aa230[_0xbf5a('0x3d')];if(!_0x5acc80[_0xbf5a('0x37')][_0xbf5a('0x3e')]('nolimit')){_0x224a22[_0xbf5a('0x22')]=qs[_0xbf5a('0x22')](_0x5acc80['query'][_0xbf5a('0x22')]);_0x224a22[_0xbf5a('0x21')]=qs[_0xbf5a('0x21')](_0x5acc80[_0xbf5a('0x37')][_0xbf5a('0x21')]);}return _0x82ef45['getAgents'](_0x224a22);}})['then'](function(_0x4ead9d){if(_0x4ead9d){return _0x4ead9d?{'count':_0x5d5728,'rows':_0x4ead9d}:null;}})[_0xbf5a('0x28')](respondWithResult(_0x47ef22,null))[_0xbf5a('0x48')](handleError(_0x47ef22,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 90c06df..e001235 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 _0xa4e9=['../../mysqldb','save','remove','exports','events'];(function(_0x609412,_0x30d278){var _0xad208b=function(_0x3503cd){while(--_0x3503cd){_0x609412['push'](_0x609412['shift']());}};_0xad208b(++_0x30d278);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0x5fd5f,_0x33d044){_0x5fd5f=_0x5fd5f-0x0;var _0x17c12a=_0xa4e9[_0x5fd5f];return _0x17c12a;};'use strict';var EventEmitter=require(_0x9a4e('0x0'));var SmsQueue=require(_0x9a4e('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a4e('0x2'),'afterUpdate':'update','afterDestroy':_0x9a4e('0x3')};function emitEvent(_0x4a4961){return function(_0x5f1f63,_0x95b20d,_0x413db6){SmsQueueEvents['emit'](_0x4a4961+':'+_0x5f1f63['id'],_0x5f1f63);SmsQueueEvents['emit'](_0x4a4961,_0x5f1f63);_0x413db6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x9a4e('0x4')]=SmsQueueEvents; \ No newline at end of file +var _0xb77c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb77c,0x101));var _0xcb77=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb77c[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0xcb77('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xcb77('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xcb77('0x2')](0x0);var events={'afterCreate':_0xcb77('0x3'),'afterUpdate':_0xcb77('0x4'),'afterDestroy':_0xcb77('0x5')};function emitEvent(_0x2cd4ab){return function(_0x422238,_0x4c156a,_0x3e124a){SmsQueueEvents[_0xcb77('0x6')](_0x2cd4ab+':'+_0x422238['id'],_0x422238);SmsQueueEvents[_0xcb77('0x6')](_0x2cd4ab,_0x422238);_0x3e124a(null);};}for(var e in events){if(events[_0xcb77('0x7')](e)){var event=events[e];SmsQueue[_0xcb77('0x8')](e,emitEvent(event));}}module[_0xcb77('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 58defe2..516518d 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 _0x0fc2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0xcb093d,_0x1e5834){var _0x43baa5=function(_0x554c9d){while(--_0x554c9d){_0xcb093d['push'](_0xcb093d['shift']());}};_0x43baa5(++_0x1e5834);}(_0x0fc2,0x6e));var _0x20fc=function(_0x550faf,_0x262443){_0x550faf=_0x550faf-0x0;var _0x16dd4e=_0x0fc2[_0x550faf];return _0x16dd4e;};'use strict';var _=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var logger=require(_0x20fc('0x2'))(_0x20fc('0x3'));var moment=require('moment');var BPromise=require(_0x20fc('0x4'));var rp=require(_0x20fc('0x5'));var fs=require('fs');var path=require(_0x20fc('0x6'));var rimraf=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var attributes=require(_0x20fc('0x9'));module[_0x20fc('0xa')]=function(_0x13f2d5,_0x10f6ad){return _0x13f2d5[_0x20fc('0xb')](_0x20fc('0xc'),attributes,{'tableName':_0x20fc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x544a=['util','../../config/logger','bluebird','path','rimraf','./smsQueue.attributes','exports','define','sms_queues','lodash'];(function(_0x4729f1,_0x1c7f0e){var _0x75481b=function(_0x192664){while(--_0x192664){_0x4729f1['push'](_0x4729f1['shift']());}};_0x75481b(++_0x1c7f0e);}(_0x544a,0xbd));var _0xa544=function(_0xfef794,_0x21db68){_0xfef794=_0xfef794-0x0;var _0xf1cffa=_0x544a[_0xfef794];return _0xf1cffa;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var logger=require(_0xa544('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa544('0x4'));var rimraf=require(_0xa544('0x5'));var config=require('../../config/environment');var attributes=require(_0xa544('0x6'));module[_0xa544('0x7')]=function(_0x2f5992,_0x15a604){return _0x2f5992[_0xa544('0x8')]('SmsQueue',attributes,{'tableName':_0xa544('0x9'),'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 86d178d..9b67fda 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 _0xb7fa=['model','attributes','stringify','ShowSmsQueue','SmsQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSmsQueue','findAll','options','where','limit','include','map'];(function(_0x5b1394,_0x17f08d){var _0x483150=function(_0x1d9539){while(--_0x1d9539){_0x5b1394['push'](_0x5b1394['shift']());}};_0x483150(++_0x17f08d);}(_0xb7fa,0x18d));var _0xab7f=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0xb7fa[_0x38c699];return _0x3b1ded;};'use strict';var _=require(_0xab7f('0x0'));var util=require(_0xab7f('0x1'));var moment=require(_0xab7f('0x2'));var BPromise=require('bluebird');var rs=require(_0xab7f('0x3'));var fs=require('fs');var Redis=require(_0xab7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab7f('0x5'))(_0xab7f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xab7f('0x7')][_0xab7f('0x8')]({'port':0x232a});config['redis']=_[_0xab7f('0x9')](config[_0xab7f('0xa')],{'host':_0xab7f('0xb'),'port':0x18eb});var socket=require(_0xab7f('0xc'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xab7f('0xd')](socket);function respondWithRpcPromise(_0x95ca43,_0x5981de,_0x1e3307){return new BPromise(function(_0x50ffd6,_0xfb45d0){return client[_0xab7f('0xe')](_0x95ca43,_0x1e3307)[_0xab7f('0xf')](function(_0x222483){logger[_0xab7f('0x10')](_0xab7f('0x11'),_0x5981de,_0xab7f('0x12'));logger[_0xab7f('0x13')](_0xab7f('0x14'),_0x5981de,_0xab7f('0x12'),JSON['stringify'](_0x222483));if(_0x222483[_0xab7f('0x15')]){if(_0x222483[_0xab7f('0x15')]['code']===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x5981de,_0x222483[_0xab7f('0x15')][_0xab7f('0x16')]);return _0xfb45d0(_0x222483[_0xab7f('0x15')]['message']);}logger[_0xab7f('0x15')]('SmsQueue,\x20%s,\x20%s',_0x5981de,_0x222483[_0xab7f('0x15')][_0xab7f('0x16')]);return _0x50ffd6(_0x222483[_0xab7f('0x15')]['message']);}else{logger[_0xab7f('0x10')]('SmsQueue,\x20%s,\x20%s',_0x5981de,_0xab7f('0x12'));_0x50ffd6(_0x222483[_0xab7f('0x17')][_0xab7f('0x16')]);}})[_0xab7f('0x18')](function(_0xb5a5ff){logger[_0xab7f('0x15')](_0xab7f('0x11'),_0x5981de,_0xb5a5ff);_0xfb45d0(_0xb5a5ff);});});}exports[_0xab7f('0x19')]=function(_0x219973){var _0x21a015=this;return new Promise(function(_0x1f63f4,_0x311b58){return db['SmsQueue'][_0xab7f('0x1a')]({'raw':_0x219973[_0xab7f('0x1b')]?_0x219973[_0xab7f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x219973[_0xab7f('0x1b')]?_0x219973['options'][_0xab7f('0x1c')]||null:null,'attributes':_0x219973[_0xab7f('0x1b')]?_0x219973[_0xab7f('0x1b')]['attributes']||null:null,'limit':_0x219973['options']?_0x219973[_0xab7f('0x1b')][_0xab7f('0x1d')]||null:null,'include':_0x219973['options']?_0x219973[_0xab7f('0x1b')][_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x219973['options'][_0xab7f('0x1e')],function(_0x4c1914){return{'model':db[_0x4c1914[_0xab7f('0x20')]],'as':_0x4c1914['as'],'attributes':_0x4c1914[_0xab7f('0x21')],'include':_0x4c1914[_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x4c1914[_0xab7f('0x1e')],function(_0x4b4ff4){return{'model':db[_0x4b4ff4['model']],'as':_0x4b4ff4['as'],'attributes':_0x4b4ff4[_0xab7f('0x21')],'include':_0x4b4ff4[_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x4b4ff4[_0xab7f('0x1e')],function(_0x6cee65){return{'model':db[_0x6cee65['model']],'as':_0x6cee65['as'],'attributes':_0x6cee65['attributes']};}):[]};}):[]};}):[]:[]})[_0xab7f('0xf')](function(_0x462918){logger[_0xab7f('0x10')](_0xab7f('0x19'),_0x219973);logger[_0xab7f('0x13')](_0xab7f('0x19'),_0x219973,JSON[_0xab7f('0x22')](_0x462918));_0x1f63f4(_0x462918);})[_0xab7f('0x18')](function(_0x68874e){logger[_0xab7f('0x15')]('GetSmsQueue',_0x68874e[_0xab7f('0x16')],_0x219973);_0x311b58(_0x21a015[_0xab7f('0x15')](0x1f4,_0x68874e[_0xab7f('0x16')]));});});};exports[_0xab7f('0x23')]=function(_0x2643a2){var _0x484dfb=this;return new Promise(function(_0x4c87d3,_0x1f6d78){return db[_0xab7f('0x24')][_0xab7f('0x25')]({'raw':_0x2643a2['options']?_0x2643a2['options'][_0xab7f('0x26')]===undefined?!![]:![]:!![],'where':_0x2643a2[_0xab7f('0x1b')]?_0x2643a2[_0xab7f('0x1b')][_0xab7f('0x1c')]||null:null,'attributes':_0x2643a2[_0xab7f('0x1b')]?_0x2643a2[_0xab7f('0x1b')][_0xab7f('0x21')]||null:null,'include':_0x2643a2[_0xab7f('0x1b')]?_0x2643a2[_0xab7f('0x1b')][_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x2643a2[_0xab7f('0x1b')][_0xab7f('0x1e')],function(_0x38e26a){return{'model':db[_0x38e26a['model']],'as':_0x38e26a['as'],'attributes':_0x38e26a[_0xab7f('0x21')],'include':_0x38e26a[_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x38e26a[_0xab7f('0x1e')],function(_0x2351ff){return{'model':db[_0x2351ff['model']],'as':_0x2351ff['as'],'attributes':_0x2351ff[_0xab7f('0x21')],'include':_0x2351ff[_0xab7f('0x1e')]?_[_0xab7f('0x1f')](_0x2351ff[_0xab7f('0x1e')],function(_0x501ba2){return{'model':db[_0x501ba2[_0xab7f('0x20')]],'as':_0x501ba2['as'],'attributes':_0x501ba2[_0xab7f('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x275c4f){logger[_0xab7f('0x10')](_0xab7f('0x23'),_0x2643a2);logger['debug'](_0xab7f('0x23'),_0x2643a2,JSON[_0xab7f('0x22')](_0x275c4f));_0x4c87d3(_0x275c4f);})['catch'](function(_0x174e6a){logger[_0xab7f('0x15')](_0xab7f('0x23'),_0x174e6a[_0xab7f('0x16')],_0x2643a2);_0x1f6d78(_0x484dfb[_0xab7f('0x15')](0x1f4,_0x174e6a['message']));});});}; \ No newline at end of file +var _0xb3d8=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowSmsQueue','find','lodash'];(function(_0x467213,_0x2aaf37){var _0x31042d=function(_0x61ec7b){while(--_0x61ec7b){_0x467213['push'](_0x467213['shift']());}};_0x31042d(++_0x2aaf37);}(_0xb3d8,0x7a));var _0x8b3d=function(_0x3ceceb,_0x37c377){_0x3ceceb=_0x3ceceb-0x0;var _0x5007ae=_0xb3d8[_0x3ceceb];return _0x5007ae;};'use strict';var _=require(_0x8b3d('0x0'));var util=require('util');var moment=require(_0x8b3d('0x1'));var BPromise=require(_0x8b3d('0x2'));var rs=require(_0x8b3d('0x3'));var fs=require('fs');var Redis=require(_0x8b3d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b3d('0x5'));var logger=require(_0x8b3d('0x6'))(_0x8b3d('0x7'));var config=require(_0x8b3d('0x8'));var jayson=require(_0x8b3d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x8b3d('0xa')]=_[_0x8b3d('0xb')](config[_0x8b3d('0xa')],{'host':_0x8b3d('0xc'),'port':0x18eb});var socket=require(_0x8b3d('0xd'))(new Redis(config[_0x8b3d('0xa')]));require(_0x8b3d('0xe'))[_0x8b3d('0xf')](socket);function respondWithRpcPromise(_0xe20c73,_0x2d9623,_0x3c2a8b){return new BPromise(function(_0x5b94e0,_0x5cdf49){return client[_0x8b3d('0x10')](_0xe20c73,_0x3c2a8b)[_0x8b3d('0x11')](function(_0x4352f8){logger['info'](_0x8b3d('0x12'),_0x2d9623,_0x8b3d('0x13'));logger[_0x8b3d('0x14')](_0x8b3d('0x15'),_0x2d9623,_0x8b3d('0x13'),JSON['stringify'](_0x4352f8));if(_0x4352f8[_0x8b3d('0x16')]){if(_0x4352f8['error'][_0x8b3d('0x17')]===0x1f4){logger['error'](_0x8b3d('0x12'),_0x2d9623,_0x4352f8[_0x8b3d('0x16')][_0x8b3d('0x18')]);return _0x5cdf49(_0x4352f8['error'][_0x8b3d('0x18')]);}logger['error'](_0x8b3d('0x12'),_0x2d9623,_0x4352f8['error'][_0x8b3d('0x18')]);return _0x5b94e0(_0x4352f8[_0x8b3d('0x16')]['message']);}else{logger[_0x8b3d('0x19')](_0x8b3d('0x12'),_0x2d9623,'request\x20sent');_0x5b94e0(_0x4352f8['result'][_0x8b3d('0x18')]);}})[_0x8b3d('0x1a')](function(_0x1b7b6f){logger[_0x8b3d('0x16')](_0x8b3d('0x12'),_0x2d9623,_0x1b7b6f);_0x5cdf49(_0x1b7b6f);});});}exports[_0x8b3d('0x1b')]=function(_0x1ef45b){var _0x19b30f=this;return new Promise(function(_0x51b560,_0x2683e7){return db[_0x8b3d('0x1c')][_0x8b3d('0x1d')]({'raw':_0x1ef45b['options']?_0x1ef45b[_0x8b3d('0x1e')][_0x8b3d('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ef45b[_0x8b3d('0x1e')]?_0x1ef45b[_0x8b3d('0x1e')][_0x8b3d('0x20')]||null:null,'attributes':_0x1ef45b[_0x8b3d('0x1e')]?_0x1ef45b[_0x8b3d('0x1e')][_0x8b3d('0x21')]||null:null,'limit':_0x1ef45b['options']?_0x1ef45b['options'][_0x8b3d('0x22')]||null:null,'include':_0x1ef45b['options']?_0x1ef45b[_0x8b3d('0x1e')]['include']?_[_0x8b3d('0x23')](_0x1ef45b[_0x8b3d('0x1e')]['include'],function(_0x52a9fc){return{'model':db[_0x52a9fc['model']],'as':_0x52a9fc['as'],'attributes':_0x52a9fc['attributes'],'include':_0x52a9fc[_0x8b3d('0x24')]?_['map'](_0x52a9fc[_0x8b3d('0x24')],function(_0x239edc){return{'model':db[_0x239edc[_0x8b3d('0x25')]],'as':_0x239edc['as'],'attributes':_0x239edc['attributes'],'include':_0x239edc[_0x8b3d('0x24')]?_[_0x8b3d('0x23')](_0x239edc[_0x8b3d('0x24')],function(_0x3d35ff){return{'model':db[_0x3d35ff['model']],'as':_0x3d35ff['as'],'attributes':_0x3d35ff['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b3d('0x11')](function(_0x473cda){logger['info'](_0x8b3d('0x1b'),_0x1ef45b);logger['debug'](_0x8b3d('0x1b'),_0x1ef45b,JSON[_0x8b3d('0x26')](_0x473cda));_0x51b560(_0x473cda);})[_0x8b3d('0x1a')](function(_0x4e1c34){logger[_0x8b3d('0x16')]('GetSmsQueue',_0x4e1c34[_0x8b3d('0x18')],_0x1ef45b);_0x2683e7(_0x19b30f[_0x8b3d('0x16')](0x1f4,_0x4e1c34[_0x8b3d('0x18')]));});});};exports[_0x8b3d('0x27')]=function(_0x12ef44){var _0x197d06=this;return new Promise(function(_0x5c65a4,_0x58acaa){return db[_0x8b3d('0x1c')][_0x8b3d('0x28')]({'raw':_0x12ef44['options']?_0x12ef44[_0x8b3d('0x1e')][_0x8b3d('0x1f')]===undefined?!![]:![]:!![],'where':_0x12ef44['options']?_0x12ef44[_0x8b3d('0x1e')][_0x8b3d('0x20')]||null:null,'attributes':_0x12ef44[_0x8b3d('0x1e')]?_0x12ef44[_0x8b3d('0x1e')][_0x8b3d('0x21')]||null:null,'include':_0x12ef44[_0x8b3d('0x1e')]?_0x12ef44[_0x8b3d('0x1e')][_0x8b3d('0x24')]?_[_0x8b3d('0x23')](_0x12ef44[_0x8b3d('0x1e')]['include'],function(_0x359225){return{'model':db[_0x359225['model']],'as':_0x359225['as'],'attributes':_0x359225[_0x8b3d('0x21')],'include':_0x359225[_0x8b3d('0x24')]?_['map'](_0x359225[_0x8b3d('0x24')],function(_0x58cf3a){return{'model':db[_0x58cf3a[_0x8b3d('0x25')]],'as':_0x58cf3a['as'],'attributes':_0x58cf3a[_0x8b3d('0x21')],'include':_0x58cf3a[_0x8b3d('0x24')]?_[_0x8b3d('0x23')](_0x58cf3a[_0x8b3d('0x24')],function(_0x3fdd10){return{'model':db[_0x3fdd10[_0x8b3d('0x25')]],'as':_0x3fdd10['as'],'attributes':_0x3fdd10['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b3d('0x11')](function(_0x311415){logger[_0x8b3d('0x19')](_0x8b3d('0x27'),_0x12ef44);logger[_0x8b3d('0x14')](_0x8b3d('0x27'),_0x12ef44,JSON['stringify'](_0x311415));_0x5c65a4(_0x311415);})[_0x8b3d('0x1a')](function(_0x494ba6){logger['error'](_0x8b3d('0x27'),_0x494ba6[_0x8b3d('0x18')],_0x12ef44);_0x58acaa(_0x197d06[_0x8b3d('0x16')](0x1f4,_0x494ba6[_0x8b3d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 89bdf98..f8a502e 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 _0x8c02=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x8c02,0x13f));var _0x28c0=function(_0x194c34,_0x11e2dd){_0x194c34=_0x194c34-0x0;var _0xaadd57=_0x8c02[_0x194c34];return _0xaadd57;};'use strict';var SmsQueueEvents=require(_0x28c0('0x0'));var events=[_0x28c0('0x1'),_0x28c0('0x2'),_0x28c0('0x3')];function createListener(_0x4022e2,_0x3e44f5){return function(_0x213ee8){_0x3e44f5[_0x28c0('0x4')](_0x4022e2,_0x213ee8);};}function removeListener(_0x17ca8b,_0x3d5edc){return function(){SmsQueueEvents[_0x28c0('0x5')](_0x17ca8b,_0x3d5edc);};}exports[_0x28c0('0x6')]=function(_0x372e6e){for(var _0x36fed8=0x0,_0x2a2768=events[_0x28c0('0x7')];_0x36fed8<_0x2a2768;_0x36fed8++){var _0x57288f=events[_0x36fed8];var _0x9ba02b=createListener(_0x28c0('0x8')+_0x57288f,_0x372e6e);SmsQueueEvents['on'](_0x57288f,_0x9ba02b);}}; \ No newline at end of file +var _0x0a56=['./smsQueue.events','remove','removeListener','register','smsQueue:'];(function(_0x493a97,_0x50a93e){var _0x51f171=function(_0x26a0bb){while(--_0x26a0bb){_0x493a97['push'](_0x493a97['shift']());}};_0x51f171(++_0x50a93e);}(_0x0a56,0xb9));var _0x60a5=function(_0x454c4f,_0x332429){_0x454c4f=_0x454c4f-0x0;var _0x5336bf=_0x0a56[_0x454c4f];return _0x5336bf;};'use strict';var SmsQueueEvents=require(_0x60a5('0x0'));var events=['save',_0x60a5('0x1'),'update'];function createListener(_0x4f7543,_0x41e2d9){return function(_0x18e725){_0x41e2d9['emit'](_0x4f7543,_0x18e725);};}function removeListener(_0x42a6c8,_0x5be80b){return function(){SmsQueueEvents[_0x60a5('0x2')](_0x42a6c8,_0x5be80b);};}exports[_0x60a5('0x3')]=function(_0x4e65cc){for(var _0x353189=0x0,_0xf6d45e=events['length'];_0x353189<_0xf6d45e;_0x353189++){var _0x339aba=events[_0x353189];var _0x2766a7=createListener(_0x60a5('0x4')+_0x339aba,_0x4e65cc);SmsQueueEvents['on'](_0x339aba,_0x2766a7);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d707c10..1bd36fd 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 _0x1d5f=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x1d5f,0xbf));var _0xf1d5=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x1d5f[_0x3a0863];return _0x85c557;};'use strict';var multer=require(_0xf1d5('0x0'));var util=require(_0xf1d5('0x1'));var path=require(_0xf1d5('0x2'));var timeout=require(_0xf1d5('0x3'));var express=require('express');var router=express[_0xf1d5('0x4')]();var auth=require(_0xf1d5('0x5'));var interaction=require(_0xf1d5('0x6'));var config=require('../../config/environment');var controller=require(_0xf1d5('0x7'));router[_0xf1d5('0x8')]('/',auth[_0xf1d5('0x9')](),controller[_0xf1d5('0xa')]);router['get'](_0xf1d5('0xb'),auth[_0xf1d5('0x9')](),controller[_0xf1d5('0xc')]);router[_0xf1d5('0x8')](_0xf1d5('0xd'),auth[_0xf1d5('0x9')](),controller[_0xf1d5('0xe')]);router[_0xf1d5('0xf')]('/',auth['isAuthenticated'](),controller[_0xf1d5('0x10')]);router[_0xf1d5('0x11')](_0xf1d5('0xd'),auth[_0xf1d5('0x9')](),controller['update']);router[_0xf1d5('0x12')](_0xf1d5('0xd'),auth[_0xf1d5('0x9')](),controller[_0xf1d5('0x13')]);module[_0xf1d5('0x14')]=router; \ No newline at end of file +var _0xfcd4=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','put','/:id','delete','destroy','exports','multer','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfcd4,0x141));var _0x4fcd=function(_0x52ac6b,_0xb00fc8){_0x52ac6b=_0x52ac6b-0x0;var _0x2473af=_0xfcd4[_0x52ac6b];return _0x2473af;};'use strict';var multer=require(_0x4fcd('0x0'));var util=require(_0x4fcd('0x1'));var path=require(_0x4fcd('0x2'));var timeout=require(_0x4fcd('0x3'));var express=require(_0x4fcd('0x4'));var router=express[_0x4fcd('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4fcd('0x6'));var config=require(_0x4fcd('0x7'));var controller=require('./smsQueueReport.controller');router[_0x4fcd('0x8')]('/',auth[_0x4fcd('0x9')](),controller['index']);router[_0x4fcd('0x8')](_0x4fcd('0xa'),auth[_0x4fcd('0x9')](),controller[_0x4fcd('0xb')]);router[_0x4fcd('0x8')]('/:id',auth[_0x4fcd('0x9')](),controller[_0x4fcd('0xc')]);router[_0x4fcd('0xd')]('/',auth[_0x4fcd('0x9')](),controller['create']);router[_0x4fcd('0xe')](_0x4fcd('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4fcd('0x10')](_0x4fcd('0xf'),auth[_0x4fcd('0x9')](),controller[_0x4fcd('0x11')]);module[_0x4fcd('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 04cff8c..f98f2da 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 _0x2e30=['moment','sequelize','STRING','DATE'];(function(_0x45edfb,_0x14a39f){var _0x1d0976=function(_0x5b8262){while(--_0x5b8262){_0x45edfb['push'](_0x45edfb['shift']());}};_0x1d0976(++_0x14a39f);}(_0x2e30,0xe0));var _0x02e3=function(_0x36e52e,_0x82e900){_0x36e52e=_0x36e52e-0x0;var _0xab13eb=_0x2e30[_0x36e52e];return _0xab13eb;};'use strict';var moment=require(_0x02e3('0x0'));var Sequelize=require(_0x02e3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x02e3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x02e3('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x02e3('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x02e3('0x3')]},'reason':{'type':Sequelize[_0x02e3('0x2')]}}; \ No newline at end of file +var _0x7326=['exports','DATE','STRING','moment','sequelize'];(function(_0x2cb6a1,_0x189341){var _0x97f446=function(_0x2ebb49){while(--_0x2ebb49){_0x2cb6a1['push'](_0x2cb6a1['shift']());}};_0x97f446(++_0x189341);}(_0x7326,0x1e3));var _0x6732=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7326[_0x5447fd];return _0x15b28a;};'use strict';var moment=require(_0x6732('0x0'));var Sequelize=require(_0x6732('0x1'));module[_0x6732('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6732('0x3')]},'leaveAt':{'type':Sequelize[_0x6732('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6732('0x3')]},'reason':{'type':Sequelize[_0x6732('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index bdab937..8e51e57 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 _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x211c0a,_0x54f209){var _0x26f1a1=function(_0x13b0cd){while(--_0x13b0cd){_0x211c0a['push'](_0x211c0a['shift']());}};_0x26f1a1(++_0x54f209);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,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(_0x5df5e1,_0x3e0305){var _0x2fffd3=function(_0x532a7c){while(--_0x532a7c){_0x5df5e1['push'](_0x5df5e1['shift']());}};_0x2fffd3(++_0x3e0305);}(_0x814b,0x1a2));var _0xb814=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0x814b[_0x3d1996];return _0x550afd;};'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 4b816c5..4239b7a 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 _0x6f2c=['request-promise','../../config/environment','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x41a76d,_0x59c60a){var _0x25d915=function(_0x4a1c6f){while(--_0x4a1c6f){_0x41a76d['push'](_0x41a76d['shift']());}};_0x25d915(++_0x59c60a);}(_0x6f2c,0x14c));var _0xc6f2=function(_0x1eeaf4,_0x3302fa){_0x1eeaf4=_0x1eeaf4-0x0;var _0x1fe081=_0x6f2c[_0x1eeaf4];return _0x1fe081;};'use strict';var _=require(_0xc6f2('0x0'));var util=require(_0xc6f2('0x1'));var logger=require(_0xc6f2('0x2'))(_0xc6f2('0x3'));var moment=require(_0xc6f2('0x4'));var BPromise=require(_0xc6f2('0x5'));var rp=require(_0xc6f2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6f2('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0xc6f2('0x8')]=function(_0x2faff3,_0x537839){return _0x2faff3[_0xc6f2('0x9')](_0xc6f2('0xa'),attributes,{'tableName':_0xc6f2('0xb'),'paranoid':![],'indexes':[{'name':_0xc6f2('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0000=['path','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3c99b1,_0x5aef54){var _0x4f8a11=function(_0x135a55){while(--_0x135a55){_0x3c99b1['push'](_0x3c99b1['shift']());}};_0x4f8a11(++_0x5aef54);}(_0x0000,0xad));var _0x0000=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0000[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0000('0x0'));var util=require(_0x0000('0x1'));var logger=require(_0x0000('0x2'))(_0x0000('0x3'));var moment=require(_0x0000('0x4'));var BPromise=require(_0x0000('0x5'));var rp=require(_0x0000('0x6'));var fs=require('fs');var path=require(_0x0000('0x7'));var rimraf=require(_0x0000('0x8'));var config=require(_0x0000('0x9'));var attributes=require(_0x0000('0xa'));module['exports']=function(_0x1a4d13,_0x58e52e){return _0x1a4d13[_0x0000('0xb')](_0x0000('0xc'),attributes,{'tableName':_0x0000('0xd'),'paranoid':![],'indexes':[{'name':_0x0000('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4cdd253..99fc9bf 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 _0x755c=['jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x54e594,_0xb5dc9c){var _0x4a14c3=function(_0x141d5b){while(--_0x141d5b){_0x54e594['push'](_0x54e594['shift']());}};_0x4a14c3(++_0xb5dc9c);}(_0x755c,0x10e));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc755('0x0'));var util=require(_0xc755('0x1'));var moment=require(_0xc755('0x2'));var BPromise=require('bluebird');var rs=require(_0xc755('0x3'));var fs=require('fs');var Redis=require(_0xc755('0x4'));var db=require(_0xc755('0x5'))['db'];var utils=require(_0xc755('0x6'));var logger=require(_0xc755('0x7'))(_0xc755('0x8'));var config=require(_0xc755('0x9'));var jayson=require(_0xc755('0xa'));var client=jayson['client'][_0xc755('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43d095,_0x5e76da,_0x15d80f){return new BPromise(function(_0x288bb3,_0x44f05b){return client[_0xc755('0xc')](_0x43d095,_0x15d80f)['then'](function(_0x589ceb){logger[_0xc755('0xd')](_0xc755('0xe'),_0x5e76da,_0xc755('0xf'));logger[_0xc755('0x10')](_0xc755('0x11'),_0x5e76da,_0xc755('0xf'),JSON[_0xc755('0x12')](_0x589ceb));if(_0x589ceb['error']){if(_0x589ceb[_0xc755('0x13')][_0xc755('0x14')]===0x1f4){logger[_0xc755('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x5e76da,_0x589ceb[_0xc755('0x13')][_0xc755('0x15')]);return _0x44f05b(_0x589ceb['error']['message']);}logger[_0xc755('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x5e76da,_0x589ceb[_0xc755('0x13')][_0xc755('0x15')]);return _0x288bb3(_0x589ceb['error'][_0xc755('0x15')]);}else{logger[_0xc755('0xd')](_0xc755('0xe'),_0x5e76da,_0xc755('0xf'));_0x288bb3(_0x589ceb[_0xc755('0x16')][_0xc755('0x15')]);}})[_0xc755('0x17')](function(_0x3f6d86){logger[_0xc755('0x13')](_0xc755('0xe'),_0x5e76da,_0x3f6d86);_0x44f05b(_0x3f6d86);});});}exports[_0xc755('0x18')]=function(_0x54e3ca){var _0x1e8587=this;return new Promise(function(_0x3c480d,_0x158f22){return db[_0xc755('0x19')][_0xc755('0x1a')](_0x54e3ca[_0xc755('0x1b')],{'raw':_0x54e3ca[_0xc755('0x1c')]?_0x54e3ca['options'][_0xc755('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x42406c){logger['info']('CreateSmsQueueReport',_0x54e3ca);logger[_0xc755('0x10')]('CreateSmsQueueReport',_0x54e3ca,JSON[_0xc755('0x12')](_0x42406c));_0x3c480d(_0x42406c);})['catch'](function(_0x527090){logger[_0xc755('0x13')]('CreateSmsQueueReport',_0x527090[_0xc755('0x15')],_0x54e3ca);_0x158f22(_0x1e8587[_0xc755('0x13')](0x1f4,_0x527090[_0xc755('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x4cda2d){var _0x29a4f7=this;return new Promise(function(_0x49dbc3,_0x28c991){return db[_0xc755('0x19')][_0xc755('0x1e')](_0x4cda2d[_0xc755('0x1b')],{'raw':_0x4cda2d['options']?_0x4cda2d['options'][_0xc755('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cda2d[_0xc755('0x1c')]?_0x4cda2d[_0xc755('0x1c')][_0xc755('0x1f')]||null:null,'attributes':_0x4cda2d[_0xc755('0x1c')]?_0x4cda2d['options'][_0xc755('0x20')]||null:null,'limit':_0x4cda2d['options']?_0x4cda2d[_0xc755('0x1c')][_0xc755('0x21')]||null:null})['then'](function(_0x578d77){logger[_0xc755('0xd')](_0xc755('0x22'),_0x4cda2d);logger[_0xc755('0x10')](_0xc755('0x22'),_0x4cda2d,JSON[_0xc755('0x12')](_0x578d77));_0x49dbc3(_0x578d77);})['catch'](function(_0x5897d0){logger[_0xc755('0x13')](_0xc755('0x22'),_0x5897d0[_0xc755('0x15')],_0x4cda2d);_0x28c991(_0x29a4f7[_0xc755('0x13')](0x1f4,_0x5897d0['message']));});});}; \ No newline at end of file +var _0x64fc=['stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x1f8335,_0x5ecc10){var _0x2d7e31=function(_0x1ccc5a){while(--_0x1ccc5a){_0x1f8335['push'](_0x1f8335['shift']());}};_0x2d7e31(++_0x5ecc10);}(_0x64fc,0xe9));var _0xc64f=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x64fc[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xc64f('0x0'));var util=require(_0xc64f('0x1'));var moment=require(_0xc64f('0x2'));var BPromise=require(_0xc64f('0x3'));var rs=require(_0xc64f('0x4'));var fs=require('fs');var Redis=require(_0xc64f('0x5'));var db=require(_0xc64f('0x6'))['db'];var utils=require(_0xc64f('0x7'));var logger=require(_0xc64f('0x8'))(_0xc64f('0x9'));var config=require(_0xc64f('0xa'));var jayson=require(_0xc64f('0xb'));var client=jayson[_0xc64f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2892b5,_0x18a4f9,_0x1b6acc){return new BPromise(function(_0xd8e6eb,_0xa4347){return client[_0xc64f('0xd')](_0x2892b5,_0x1b6acc)[_0xc64f('0xe')](function(_0x2ae10b){logger[_0xc64f('0xf')](_0xc64f('0x10'),_0x18a4f9,_0xc64f('0x11'));logger['debug'](_0xc64f('0x12'),_0x18a4f9,_0xc64f('0x11'),JSON[_0xc64f('0x13')](_0x2ae10b));if(_0x2ae10b['error']){if(_0x2ae10b[_0xc64f('0x14')][_0xc64f('0x15')]===0x1f4){logger[_0xc64f('0x14')](_0xc64f('0x10'),_0x18a4f9,_0x2ae10b[_0xc64f('0x14')]['message']);return _0xa4347(_0x2ae10b[_0xc64f('0x14')]['message']);}logger['error'](_0xc64f('0x10'),_0x18a4f9,_0x2ae10b[_0xc64f('0x14')][_0xc64f('0x16')]);return _0xd8e6eb(_0x2ae10b[_0xc64f('0x14')][_0xc64f('0x16')]);}else{logger[_0xc64f('0xf')](_0xc64f('0x10'),_0x18a4f9,_0xc64f('0x11'));_0xd8e6eb(_0x2ae10b['result'][_0xc64f('0x16')]);}})[_0xc64f('0x17')](function(_0x43e3c5){logger[_0xc64f('0x14')](_0xc64f('0x10'),_0x18a4f9,_0x43e3c5);_0xa4347(_0x43e3c5);});});}exports[_0xc64f('0x18')]=function(_0xc26330){var _0x5709fc=this;return new Promise(function(_0x12829e,_0x1eeaf0){return db[_0xc64f('0x19')][_0xc64f('0x1a')](_0xc26330[_0xc64f('0x1b')],{'raw':_0xc26330[_0xc64f('0x1c')]?_0xc26330['options'][_0xc64f('0x1d')]===undefined?!![]:![]:!![]})[_0xc64f('0xe')](function(_0x2a2148){logger[_0xc64f('0xf')](_0xc64f('0x18'),_0xc26330);logger[_0xc64f('0x1e')](_0xc64f('0x18'),_0xc26330,JSON[_0xc64f('0x13')](_0x2a2148));_0x12829e(_0x2a2148);})['catch'](function(_0x272951){logger[_0xc64f('0x14')]('CreateSmsQueueReport',_0x272951['message'],_0xc26330);_0x1eeaf0(_0x5709fc[_0xc64f('0x14')](0x1f4,_0x272951['message']));});});};exports['UpdateSmsQueueReport']=function(_0x1c2fc6){var _0x33df3a=this;return new Promise(function(_0x402b24,_0x77f831){return db[_0xc64f('0x19')][_0xc64f('0x1f')](_0x1c2fc6[_0xc64f('0x1b')],{'raw':_0x1c2fc6[_0xc64f('0x1c')]?_0x1c2fc6[_0xc64f('0x1c')][_0xc64f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c2fc6[_0xc64f('0x1c')]?_0x1c2fc6[_0xc64f('0x1c')][_0xc64f('0x20')]||null:null,'attributes':_0x1c2fc6[_0xc64f('0x1c')]?_0x1c2fc6[_0xc64f('0x1c')][_0xc64f('0x21')]||null:null,'limit':_0x1c2fc6[_0xc64f('0x1c')]?_0x1c2fc6['options'][_0xc64f('0x22')]||null:null})[_0xc64f('0xe')](function(_0x43f8d9){logger[_0xc64f('0xf')](_0xc64f('0x23'),_0x1c2fc6);logger[_0xc64f('0x1e')]('UpdateSmsQueueReport',_0x1c2fc6,JSON[_0xc64f('0x13')](_0x43f8d9));_0x402b24(_0x43f8d9);})[_0xc64f('0x17')](function(_0x159055){logger[_0xc64f('0x14')](_0xc64f('0x23'),_0x159055[_0xc64f('0x16')],_0x1c2fc6);_0x77f831(_0x33df3a['error'](0x1f4,_0x159055['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1997413..0cbc8d7 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 _0xa74f=['post','create','delete','destroy','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3a10b6,_0x3181f0){var _0x463dc3=function(_0x5e37f2){while(--_0x5e37f2){_0x3a10b6['push'](_0x3a10b6['shift']());}};_0x463dc3(++_0x3181f0);}(_0xa74f,0x9a));var _0xfa74=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xa74f[_0x5e6ea3];return _0x4048b5;};'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('./smsTransferReport.controller');router[_0xfa74('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa74('0x5')](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x8')]);router[_0xfa74('0x5')](_0xfa74('0x9'),auth['isAuthenticated'](),controller[_0xfa74('0xa')]);router[_0xfa74('0xb')]('/',auth[_0xfa74('0x7')](),controller[_0xfa74('0xc')]);router['put'](_0xfa74('0x9'),auth[_0xfa74('0x7')](),controller['update']);router[_0xfa74('0xd')](_0xfa74('0x9'),auth[_0xfa74('0x7')](),controller[_0xfa74('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd7d1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1beac8,_0xd2736c){_0x1beac8=_0x1beac8-0x0;var _0x2e41d0=_0xd7d1[_0x1beac8];return _0x2e41d0;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var auth=require(_0x1d7d('0x6'));var interaction=require(_0x1d7d('0x7'));var config=require(_0x1d7d('0x8'));var controller=require(_0x1d7d('0x9'));router[_0x1d7d('0xa')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xc')]);router['get'](_0x1d7d('0xd'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xa')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0x13')]('/:id',auth[_0x1d7d('0xb')](),controller['update']);router[_0x1d7d('0x14')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index b99c0f9..2e37113 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 _0xe2fb=['STRING','ENUM','account','queue','NOW','moment','sequelize'];(function(_0x5dd98d,_0xedac2c){var _0x3e010f=function(_0x19f645){while(--_0x19f645){_0x5dd98d['push'](_0x5dd98d['shift']());}};_0x3e010f(++_0xedac2c);}(_0xe2fb,0x124));var _0xbe2f=function(_0x4257fe,_0x18cdc3){_0x4257fe=_0x4257fe-0x0;var _0x559c17=_0xe2fb[_0x4257fe];return _0x559c17;};'use strict';var moment=require(_0xbe2f('0x0'));var Sequelize=require(_0xbe2f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbe2f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbe2f('0x3')](_0xbe2f('0x4'),'agent',_0xbe2f('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xbe2f('0x6')]}}; \ No newline at end of file +var _0x7d2b=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE','moment'];(function(_0x1e63f1,_0xe3c3cc){var _0x5bc880=function(_0x106961){while(--_0x106961){_0x1e63f1['push'](_0x1e63f1['shift']());}};_0x5bc880(++_0xe3c3cc);}(_0x7d2b,0x194));var _0xb7d2=function(_0x1f7d92,_0x4dfc15){_0x1f7d92=_0x1f7d92-0x0;var _0x397aea=_0x7d2b[_0x1f7d92];return _0x397aea;};'use strict';var moment=require(_0xb7d2('0x0'));var Sequelize=require(_0xb7d2('0x1'));module[_0xb7d2('0x2')]={'uniqueid':{'type':Sequelize[_0xb7d2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb7d2('0x4')](_0xb7d2('0x5'),_0xb7d2('0x6'),_0xb7d2('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb7d2('0x8')],'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 e95f57b..607e5da 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 _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','SmsTransferReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0x2bea0c,_0x9d2212){var _0x124b8f=function(_0x9f2bc2){while(--_0x9f2bc2){_0x2bea0c['push'](_0x2bea0c['shift']());}};_0x124b8f(++_0x9d2212);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['SmsTransferReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['SmsTransferReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['SmsTransferReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['SmsTransferReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file +var _0x9c44=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','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','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x32eb9c,_0x527a9f){var _0x45864c=function(_0x2c01c5){while(--_0x2c01c5){_0x32eb9c['push'](_0x32eb9c['shift']());}};_0x45864c(++_0x527a9f);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'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(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['index']=function(_0x543ea2,_0x449960){var _0x53c199={},_0x3800b7={},_0x3852b2={'count':0x0,'rows':[]};var _0x3f1708=_[_0x49c4('0x24')](db['SmsTransferReport'][_0x49c4('0x25')],function(_0x2b2793){return{'name':_0x2b2793[_0x49c4('0x26')],'type':_0x2b2793[_0x49c4('0x27')][_0x49c4('0x28')]};});_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x24')](_0x3f1708,_0x49c4('0x22'));_0x3800b7[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x543ea2[_0x49c4('0x2a')]);_0x3800b7['filters']=_['intersection'](_0x3800b7['model'],_0x3800b7[_0x49c4('0x2a')]);_0x53c199[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x3800b7[_0x49c4('0x29')],qs[_0x49c4('0x2e')](_0x543ea2['query'][_0x49c4('0x2e')]));_0x53c199[_0x49c4('0x2c')]=_0x53c199[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0x53c199['attributes']:_0x3800b7['model'];if(!_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x30')](_0x49c4('0x31'))){_0x53c199[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x543ea2['query'][_0x49c4('0x1a')]);_0x53c199[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x543ea2['query']['offset']);}_0x53c199[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x33')]);_0x53c199[_0x49c4('0x34')]=qs[_0x49c4('0x35')](_[_0x49c4('0x36')](_0x543ea2[_0x49c4('0x2a')],_0x3800b7[_0x49c4('0x35')]),_0x3f1708);if(_0x543ea2['query'][_0x49c4('0x37')]){_0x53c199['where']=_[_0x49c4('0x38')](_0x53c199[_0x49c4('0x34')],{'$or':_[_0x49c4('0x24')](_0x3f1708,function(_0x1c2830){if(_0x1c2830['type']!==_0x49c4('0x39')){var _0x31f3ff={};_0x31f3ff[_0x1c2830[_0x49c4('0x22')]]={'$like':'%'+_0x543ea2['query'][_0x49c4('0x37')]+'%'};return _0x31f3ff;}})});}_0x53c199=_[_0x49c4('0x38')]({},_0x53c199,_0x543ea2[_0x49c4('0x3a')]);var _0x5e5366={'where':_0x53c199[_0x49c4('0x34')]};return db[_0x49c4('0x3b')][_0x49c4('0x18')](_0x5e5366)[_0x49c4('0x20')](function(_0x70e552){_0x3852b2[_0x49c4('0x18')]=_0x70e552;if(_0x543ea2[_0x49c4('0x2a')]['includeAll']){_0x53c199[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x3b')][_0x49c4('0x3d')](_0x53c199);})[_0x49c4('0x20')](function(_0x41ad28){_0x3852b2[_0x49c4('0x3e')]=_0x41ad28;return _0x3852b2;})[_0x49c4('0x20')](respondWithFilteredResult(_0x449960,_0x53c199))[_0x49c4('0x3f')](handleError(_0x449960,null));};exports[_0x49c4('0x40')]=function(_0x2668ed,_0x2dffb4){var _0xa3d59e={'raw':!![],'where':{'id':_0x2668ed['params']['id']}},_0x326142={};_0x326142[_0x49c4('0x29')]=_['keys'](db[_0x49c4('0x3b')][_0x49c4('0x25')]);_0x326142[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x2668ed[_0x49c4('0x2a')]);_0x326142[_0x49c4('0x35')]=_['intersection'](_0x326142['model'],_0x326142[_0x49c4('0x2a')]);_0xa3d59e[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x326142[_0x49c4('0x29')],qs['fields'](_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x2e')]));_0xa3d59e[_0x49c4('0x2c')]=_0xa3d59e[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0xa3d59e[_0x49c4('0x2c')]:_0x326142[_0x49c4('0x29')];if(_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x41')]){_0xa3d59e['include']=[{'all':!![]}];}_0xa3d59e=_[_0x49c4('0x38')]({},_0xa3d59e,_0x2668ed['options']);return db[_0x49c4('0x3b')][_0x49c4('0x42')](_0xa3d59e)[_0x49c4('0x20')](handleEntityNotFound(_0x2dffb4,null))[_0x49c4('0x20')](respondWithResult(_0x2dffb4,null))[_0x49c4('0x3f')](handleError(_0x2dffb4,null));};exports['create']=function(_0x592e8e,_0x15b674){return db[_0x49c4('0x3b')][_0x49c4('0x43')](_0x592e8e[_0x49c4('0x44')],{})[_0x49c4('0x20')](respondWithResult(_0x15b674,0xc9))[_0x49c4('0x3f')](handleError(_0x15b674,null));};exports['update']=function(_0x3bac1b,_0x5cfff9){if(_0x3bac1b[_0x49c4('0x44')]['id']){delete _0x3bac1b[_0x49c4('0x44')]['id'];}return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x3bac1b[_0x49c4('0x45')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x5cfff9,null))[_0x49c4('0x20')](saveUpdates(_0x3bac1b['body'],null))[_0x49c4('0x20')](respondWithResult(_0x5cfff9,null))[_0x49c4('0x3f')](handleError(_0x5cfff9,null));};exports['destroy']=function(_0x1e1ac4,_0xaece5f){return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x1e1ac4['params']['id']}})['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x20')](removeEntity(_0xaece5f,null))['catch'](handleError(_0xaece5f,null));};exports[_0x49c4('0x46')]=function(_0x1f941f,_0x3811b2){return db[_0x49c4('0x3b')][_0x49c4('0x46')]()[_0x49c4('0x20')](respondWithResult(_0x3811b2,null))[_0x49c4('0x3f')](handleError(_0x3811b2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 96d8e2b..a397f3f 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 _0x4aef=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x4aef,0x1e6));var _0xf4ae=function(_0x597e38,_0x551ac2){_0x597e38=_0x597e38-0x0;var _0x5305d2=_0x4aef[_0x597e38];return _0x5305d2;};'use strict';var _=require('lodash');var util=require(_0xf4ae('0x0'));var logger=require(_0xf4ae('0x1'))(_0xf4ae('0x2'));var moment=require('moment');var BPromise=require(_0xf4ae('0x3'));var rp=require(_0xf4ae('0x4'));var fs=require('fs');var path=require(_0xf4ae('0x5'));var rimraf=require('rimraf');var config=require(_0xf4ae('0x6'));var attributes=require(_0xf4ae('0x7'));module[_0xf4ae('0x8')]=function(_0x212968,_0x38faee){return _0x212968[_0xf4ae('0x9')](_0xf4ae('0xa'),attributes,{'tableName':_0xf4ae('0xb'),'paranoid':![],'indexes':[{'name':_0xf4ae('0xc'),'fields':[_0xf4ae('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd65e=['SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd65e,0x91));var _0xed65=function(_0x32fef5,_0x16b595){_0x32fef5=_0x32fef5-0x0;var _0x2a6980=_0xd65e[_0x32fef5];return _0x2a6980;};'use strict';var _=require(_0xed65('0x0'));var util=require(_0xed65('0x1'));var logger=require(_0xed65('0x2'))(_0xed65('0x3'));var moment=require(_0xed65('0x4'));var BPromise=require(_0xed65('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed65('0x6'));var config=require(_0xed65('0x7'));var attributes=require(_0xed65('0x8'));module['exports']=function(_0x109571,_0x3dd68f){return _0x109571['define'](_0xed65('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xed65('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 7218faf..6a661d6 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 _0x865d=['SmsTransferReport,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x41b10b,_0x39e294){var _0x314242=function(_0xe0f3bc){while(--_0xe0f3bc){_0x41b10b['push'](_0x41b10b['shift']());}};_0x314242(++_0x39e294);}(_0x865d,0x157));var _0xd865=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x865d[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xd865('0x0'));var util=require('util');var moment=require(_0xd865('0x1'));var BPromise=require(_0xd865('0x2'));var rs=require(_0xd865('0x3'));var fs=require('fs');var Redis=require(_0xd865('0x4'));var db=require(_0xd865('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd865('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd865('0x7'));var client=jayson[_0xd865('0x8')][_0xd865('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30d06e,_0xdd8a15,_0x8ded2d){return new BPromise(function(_0x5292b7,_0x16a6fd){return client[_0xd865('0xa')](_0x30d06e,_0x8ded2d)[_0xd865('0xb')](function(_0x5c0419){logger[_0xd865('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0xdd8a15,_0xd865('0xd'));logger['debug'](_0xd865('0xe'),_0xdd8a15,_0xd865('0xd'),JSON['stringify'](_0x5c0419));if(_0x5c0419['error']){if(_0x5c0419[_0xd865('0xf')][_0xd865('0x10')]===0x1f4){logger[_0xd865('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0xdd8a15,_0x5c0419[_0xd865('0xf')][_0xd865('0x11')]);return _0x16a6fd(_0x5c0419[_0xd865('0xf')][_0xd865('0x11')]);}logger[_0xd865('0xf')](_0xd865('0x12'),_0xdd8a15,_0x5c0419[_0xd865('0xf')][_0xd865('0x11')]);return _0x5292b7(_0x5c0419[_0xd865('0xf')][_0xd865('0x11')]);}else{logger['info'](_0xd865('0x12'),_0xdd8a15,_0xd865('0xd'));_0x5292b7(_0x5c0419['result'][_0xd865('0x11')]);}})['catch'](function(_0x3f22e1){logger[_0xd865('0xf')](_0xd865('0x12'),_0xdd8a15,_0x3f22e1);_0x16a6fd(_0x3f22e1);});});} \ No newline at end of file +var _0x2bdb=['jayson/promise','client','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x56c351,_0x19e28e){var _0x57d687=function(_0x37a13f){while(--_0x37a13f){_0x56c351['push'](_0x56c351['shift']());}};_0x57d687(++_0x19e28e);}(_0x2bdb,0x6f));var _0xb2bd=function(_0x549829,_0x3b5bd5){_0x549829=_0x549829-0x0;var _0x554e92=_0x2bdb[_0x549829];return _0x554e92;};'use strict';var _=require(_0xb2bd('0x0'));var util=require(_0xb2bd('0x1'));var moment=require(_0xb2bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xb2bd('0x3'));var fs=require('fs');var Redis=require(_0xb2bd('0x4'));var db=require(_0xb2bd('0x5'))['db'];var utils=require(_0xb2bd('0x6'));var logger=require('../../config/logger')(_0xb2bd('0x7'));var config=require(_0xb2bd('0x8'));var jayson=require(_0xb2bd('0x9'));var client=jayson[_0xb2bd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b3cab,_0x9aaed4,_0x3e8b6a){return new BPromise(function(_0x4429ea,_0x22628d){return client[_0xb2bd('0xb')](_0x3b3cab,_0x3e8b6a)['then'](function(_0x5a6e8b){logger[_0xb2bd('0xc')](_0xb2bd('0xd'),_0x9aaed4,_0xb2bd('0xe'));logger[_0xb2bd('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x9aaed4,_0xb2bd('0xe'),JSON['stringify'](_0x5a6e8b));if(_0x5a6e8b[_0xb2bd('0x10')]){if(_0x5a6e8b['error'][_0xb2bd('0x11')]===0x1f4){logger['error'](_0xb2bd('0xd'),_0x9aaed4,_0x5a6e8b[_0xb2bd('0x10')]['message']);return _0x22628d(_0x5a6e8b[_0xb2bd('0x10')][_0xb2bd('0x12')]);}logger[_0xb2bd('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x9aaed4,_0x5a6e8b[_0xb2bd('0x10')][_0xb2bd('0x12')]);return _0x4429ea(_0x5a6e8b[_0xb2bd('0x10')][_0xb2bd('0x12')]);}else{logger['info'](_0xb2bd('0xd'),_0x9aaed4,_0xb2bd('0xe'));_0x4429ea(_0x5a6e8b[_0xb2bd('0x13')][_0xb2bd('0x12')]);}})['catch'](function(_0x547e87){logger[_0xb2bd('0x10')](_0xb2bd('0xd'),_0x9aaed4,_0x547e87);_0x22628d(_0x547e87);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9707fc1..8b81296 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 _0xc2f2=['basename','now','extname','post','file','put','update','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2f2,0x134));var _0x2c2f=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xc2f2[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x2c2f('0x0'));var util=require(_0x2c2f('0x1'));var path=require(_0x2c2f('0x2'));var timeout=require(_0x2c2f('0x3'));var express=require('express');var router=express[_0x2c2f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2c2f('0x5'));var config=require(_0x2c2f('0x6'));var controller=require(_0x2c2f('0x7'));router['get']('/',auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x9')]);router[_0x2c2f('0xa')](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0xc')]);router['get'](_0x2c2f('0xd'),auth['isAuthenticated'](),controller[_0x2c2f('0xe')]);var upload=multer({'storage':multer[_0x2c2f('0xf')]({'destination':function(_0x284052,_0x2ac2cb,_0xb67485){_0xb67485(null,path['join'](config[_0x2c2f('0x10')],_0x2c2f('0x11')));},'filename':function(_0x3bbb1e,_0xd5fd1a,_0x2f730b){_0xd5fd1a[_0x2c2f('0x12')]=_0xd5fd1a[_0x2c2f('0x12')][_0x2c2f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f730b(null,util[_0x2c2f('0x14')](_0x2c2f('0x15'),path[_0x2c2f('0x16')](_0xd5fd1a['originalname'],path['extname'](_0xd5fd1a[_0x2c2f('0x12')])),Date[_0x2c2f('0x17')](),path[_0x2c2f('0x18')](_0xd5fd1a[_0x2c2f('0x12')])));}})});router[_0x2c2f('0x19')]('/',upload['single'](_0x2c2f('0x1a')),controller['create']);router[_0x2c2f('0x1b')](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x1c')]);router['delete'](_0x2c2f('0xb'),auth[_0x2c2f('0x8')](),controller[_0x2c2f('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xcb5c=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','create','put','update'];(function(_0x5d1a48,_0x2837b9){var _0x46c88e=function(_0x245c9e){while(--_0x245c9e){_0x5d1a48['push'](_0x5d1a48['shift']());}};_0x46c88e(++_0x2837b9);}(_0xcb5c,0x137));var _0xccb5=function(_0x12341e,_0x2830e1){_0x12341e=_0x12341e-0x0;var _0x51d848=_0xcb5c[_0x12341e];return _0x51d848;};'use strict';var multer=require(_0xccb5('0x0'));var util=require(_0xccb5('0x1'));var path=require(_0xccb5('0x2'));var timeout=require(_0xccb5('0x3'));var express=require(_0xccb5('0x4'));var router=express[_0xccb5('0x5')]();var auth=require(_0xccb5('0x6'));var interaction=require(_0xccb5('0x7'));var config=require('../../config/environment');var controller=require(_0xccb5('0x8'));router[_0xccb5('0x9')]('/',auth[_0xccb5('0xa')](),controller['index']);router[_0xccb5('0x9')](_0xccb5('0xb'),auth[_0xccb5('0xa')](),controller[_0xccb5('0xc')]);router[_0xccb5('0x9')](_0xccb5('0xd'),auth[_0xccb5('0xa')](),controller[_0xccb5('0xe')]);var upload=multer({'storage':multer[_0xccb5('0xf')]({'destination':function(_0x48d5f5,_0x3b3053,_0x6080ed){_0x6080ed(null,path[_0xccb5('0x10')](config['root'],_0xccb5('0x11')));},'filename':function(_0x497a12,_0x57ae2f,_0x273c45){_0x57ae2f[_0xccb5('0x12')]=_0x57ae2f[_0xccb5('0x12')][_0xccb5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x273c45(null,util[_0xccb5('0x14')](_0xccb5('0x15'),path[_0xccb5('0x16')](_0x57ae2f[_0xccb5('0x12')],path[_0xccb5('0x17')](_0x57ae2f[_0xccb5('0x12')])),Date[_0xccb5('0x18')](),path['extname'](_0x57ae2f[_0xccb5('0x12')])));}})});router['post']('/',upload[_0xccb5('0x19')](_0xccb5('0x1a')),controller[_0xccb5('0x1b')]);router[_0xccb5('0x1c')](_0xccb5('0xb'),auth[_0xccb5('0xa')](),controller[_0xccb5('0x1d')]);router['delete']('/:id',auth[_0xccb5('0xa')](),controller['delete']);module[_0xccb5('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1a3bfa3..2cfe1a6 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 _0x7507=['FLOAT','BIGINT','INTEGER','exports','STRING','name'];(function(_0x2bdf29,_0x40cab0){var _0x60cb83=function(_0x4bc761){while(--_0x4bc761){_0x2bdf29['push'](_0x2bdf29['shift']());}};_0x60cb83(++_0x40cab0);}(_0x7507,0x1d7));var _0x7750=function(_0x138a2e,_0xc7013d){_0x138a2e=_0x138a2e-0x0;var _0xa0452f=_0x7507[_0x138a2e];return _0xa0452f;};'use strict';var Sequelize=require('sequelize');module[_0x7750('0x0')]={'name':{'type':Sequelize[_0x7750('0x1')],'unique':_0x7750('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7750('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x7750('0x1')]},'original_format':{'type':Sequelize[_0x7750('0x1')]},'original_duration':{'type':Sequelize[_0x7750('0x3')]},'original_sampleCount':{'type':Sequelize[_0x7750('0x4')]},'original_channelCount':{'type':Sequelize[_0x7750('0x5')]},'original_bitRate':{'type':Sequelize[_0x7750('0x4')]},'original_sampleRate':{'type':Sequelize[_0x7750('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7750('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x7750('0x4')]},'converted_channelCount':{'type':Sequelize[_0x7750('0x5')]},'converted_bitRate':{'type':Sequelize[_0x7750('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x7750('0x5')]}}; \ No newline at end of file +var _0xbc6c=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbc6c,0x1df));var _0xcbc6=function(_0x334259,_0x190ab9){_0x334259=_0x334259-0x0;var _0x5940ed=_0xbc6c[_0x334259];return _0x5940ed;};'use strict';var Sequelize=require(_0xcbc6('0x0'));module[_0xcbc6('0x1')]={'name':{'type':Sequelize[_0xcbc6('0x2')],'unique':_0xcbc6('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcbc6('0x2')]},'display_name':{'type':Sequelize[_0xcbc6('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xcbc6('0x2')]},'original_format':{'type':Sequelize[_0xcbc6('0x2')]},'original_duration':{'type':Sequelize[_0xcbc6('0x4')]},'original_sampleCount':{'type':Sequelize[_0xcbc6('0x5')]},'original_channelCount':{'type':Sequelize[_0xcbc6('0x6')]},'original_bitRate':{'type':Sequelize[_0xcbc6('0x5')]},'original_sampleRate':{'type':Sequelize[_0xcbc6('0x6')]},'converted_format':{'type':Sequelize[_0xcbc6('0x2')]},'converted_duration':{'type':Sequelize[_0xcbc6('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xcbc6('0x5')]},'converted_channelCount':{'type':Sequelize[_0xcbc6('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xcbc6('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index afd2d64..62601e0 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 _0x9200=['VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','download','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','file','extname','originalname','basename','filename','substring','wav','server/files/sounds/original','converted_format','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_channelCount','converted_bitRate','converted_sampleRate','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','description','delete','original_format','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','name','send','index','map','Sound','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x321c24,_0x5e939a){var _0x1754b8=function(_0xd95c80){while(--_0xd95c80){_0x321c24['push'](_0x321c24['shift']());}};_0x1754b8(++_0x5e939a);}(_0x9200,0xbc));var _0x0920=function(_0x4d36bf,_0xa9bc82){_0x4d36bf=_0x4d36bf-0x0;var _0x5507d8=_0x9200[_0x4d36bf];return _0x5507d8;};'use strict';var pdf=require(_0x0920('0x0'));var emlformat=require(_0x0920('0x1'));var rimraf=require(_0x0920('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0920('0x3'));var rp=require('request-promise');var moment=require(_0x0920('0x4'));var BPromise=require(_0x0920('0x5'));var Mustache=require(_0x0920('0x6'));var util=require(_0x0920('0x7'));var path=require(_0x0920('0x8'));var sox=require('sox');var csv=require(_0x0920('0x9'));var ejs=require(_0x0920('0xa'));var fs=require('fs');var _=require(_0x0920('0xb'));var squel=require('squel');var crypto=require(_0x0920('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0920('0xd'));var toCsv=require(_0x0920('0x9'));var querystring=require(_0x0920('0xe'));var Papa=require(_0x0920('0xf'));var Redis=require('ioredis');var authService=require(_0x0920('0x10'));var qs=require(_0x0920('0x11'));var as=require(_0x0920('0x12'));var hardwareService=require(_0x0920('0x13'));var logger=require(_0x0920('0x14'))(_0x0920('0x15'));var utils=require(_0x0920('0x16'));var config=require(_0x0920('0x17'));var db=require(_0x0920('0x18'))['db'];function respondWithStatusCode(_0x171925,_0x21e245){_0x21e245=_0x21e245||0xcc;return function(_0x528d74){if(_0x528d74){return _0x171925[_0x0920('0x19')](_0x21e245);}return _0x171925[_0x0920('0x1a')](_0x21e245)[_0x0920('0x1b')]();};}function respondWithResult(_0x352d1d,_0x39e1dc){_0x39e1dc=_0x39e1dc||0xc8;return function(_0x1dea7f){if(_0x1dea7f){return _0x352d1d[_0x0920('0x1a')](_0x39e1dc)['json'](_0x1dea7f);}};}function respondWithFilteredResult(_0x106cf5,_0x11431d){return function(_0x43b761){if(_0x43b761){var _0x144beb=_0x43b761['count'],_0x1c32b8=_0x11431d[_0x0920('0x1c')],_0x7a5a9d=_0x11431d['offset']+_0x11431d[_0x0920('0x1d')],_0x25ec32;if(_0x7a5a9d>=_0x144beb){_0x7a5a9d=_0x144beb;_0x25ec32=0xc8;}else{_0x25ec32=0xce;}_0x106cf5['status'](_0x25ec32);return _0x106cf5[_0x0920('0x1e')]('Content-Range',_0x1c32b8+'-'+_0x7a5a9d+'/'+_0x144beb)[_0x0920('0x1f')](_0x43b761);}return null;};}function patchUpdates(_0x697c83){return function(_0x153723){try{jsonpatch['apply'](_0x153723,_0x697c83,!![]);}catch(_0xa09af){return BPromise[_0x0920('0x20')](_0xa09af);}return _0x153723[_0x0920('0x21')]();};}function saveUpdates(_0x391e9d,_0xa047b2){return function(_0xb2860a){if(_0xb2860a){return _0xb2860a[_0x0920('0x22')](_0x391e9d)['then'](function(_0x3d716d){return _0x3d716d;});}return null;};}function removeEntity(_0x51d44d,_0x1d2655){return function(_0x5ce6c2){if(_0x5ce6c2){return _0x5ce6c2[_0x0920('0x23')]()[_0x0920('0x24')](function(){var _0x578764=_0x5ce6c2[_0x0920('0x25')]({'plain':!![]});var _0x2a61f3=_0x0920('0x26');return db[_0x0920('0x27')]['destroy']({'where':{'type':_0x2a61f3,'resourceId':_0x578764['id']}})[_0x0920('0x24')](function(){return _0x5ce6c2;});})['then'](function(){_0x51d44d[_0x0920('0x1a')](0xcc)[_0x0920('0x1b')]();});}};}function handleEntityNotFound(_0x5f12c8,_0x3e6d1f){return function(_0x37f2d2){if(!_0x37f2d2){_0x5f12c8[_0x0920('0x19')](0x194);}return _0x37f2d2;};}function handleError(_0x36b7d2,_0x2b6b9c){_0x2b6b9c=_0x2b6b9c||0x1f4;return function(_0x149a46){logger[_0x0920('0x28')](_0x149a46['stack']);if(_0x149a46[_0x0920('0x29')]){delete _0x149a46['name'];}_0x36b7d2[_0x0920('0x1a')](_0x2b6b9c)[_0x0920('0x2a')](_0x149a46);};}exports[_0x0920('0x2b')]=function(_0x36b1ff,_0x8fc001){var _0xbb70ad={},_0x178348={},_0x4ceb79={'count':0x0,'rows':[]};var _0x59acf0=_[_0x0920('0x2c')](db[_0x0920('0x2d')]['rawAttributes'],function(_0x32bb6d){return{'name':_0x32bb6d['fieldName'],'type':_0x32bb6d[_0x0920('0x2e')]['key']};});_0x178348[_0x0920('0x2f')]=_[_0x0920('0x2c')](_0x59acf0,_0x0920('0x29'));_0x178348[_0x0920('0x30')]=_['keys'](_0x36b1ff[_0x0920('0x30')]);_0x178348[_0x0920('0x31')]=_[_0x0920('0x32')](_0x178348['model'],_0x178348[_0x0920('0x30')]);_0xbb70ad[_0x0920('0x33')]=_['intersection'](_0x178348[_0x0920('0x2f')],qs[_0x0920('0x34')](_0x36b1ff[_0x0920('0x30')][_0x0920('0x34')]));_0xbb70ad[_0x0920('0x33')]=_0xbb70ad[_0x0920('0x33')][_0x0920('0x35')]?_0xbb70ad[_0x0920('0x33')]:_0x178348[_0x0920('0x2f')];if(!_0x36b1ff[_0x0920('0x30')]['hasOwnProperty'](_0x0920('0x36'))){_0xbb70ad[_0x0920('0x1d')]=qs[_0x0920('0x1d')](_0x36b1ff[_0x0920('0x30')][_0x0920('0x1d')]);_0xbb70ad[_0x0920('0x1c')]=qs[_0x0920('0x1c')](_0x36b1ff[_0x0920('0x30')][_0x0920('0x1c')]);}_0xbb70ad[_0x0920('0x37')]=qs['sort'](_0x36b1ff[_0x0920('0x30')][_0x0920('0x38')]);_0xbb70ad[_0x0920('0x39')]=qs[_0x0920('0x31')](_[_0x0920('0x3a')](_0x36b1ff[_0x0920('0x30')],_0x178348['filters']),_0x59acf0);if(_0x36b1ff['query'][_0x0920('0x3b')]){_0xbb70ad[_0x0920('0x39')]=_['merge'](_0xbb70ad[_0x0920('0x39')],{'$or':_['map'](_0x59acf0,function(_0x86a952){if(_0x86a952[_0x0920('0x2e')]!==_0x0920('0x3c')){var _0x52bda3={};_0x52bda3[_0x86a952[_0x0920('0x29')]]={'$like':'%'+_0x36b1ff[_0x0920('0x30')][_0x0920('0x3b')]+'%'};return _0x52bda3;}})});}_0xbb70ad=_[_0x0920('0x3d')]({},_0xbb70ad,_0x36b1ff['options']);var _0x130e48={'where':_0xbb70ad[_0x0920('0x39')]};return db[_0x0920('0x2d')][_0x0920('0x3e')](_0x130e48)[_0x0920('0x24')](function(_0x173c40){_0x4ceb79[_0x0920('0x3e')]=_0x173c40;if(_0x36b1ff[_0x0920('0x30')][_0x0920('0x3f')]){_0xbb70ad[_0x0920('0x40')]=[{'all':!![]}];}return db['Sound'][_0x0920('0x41')](_0xbb70ad);})['then'](function(_0x22ef6a){_0x4ceb79[_0x0920('0x42')]=_0x22ef6a;return _0x4ceb79;})[_0x0920('0x24')](respondWithFilteredResult(_0x8fc001,_0xbb70ad))[_0x0920('0x43')](handleError(_0x8fc001,null));};exports[_0x0920('0x44')]=function(_0x391aae,_0x302df4){var _0x51e37a={'raw':!![],'where':{'id':_0x391aae[_0x0920('0x45')]['id']}},_0x423607={};_0x423607[_0x0920('0x2f')]=_[_0x0920('0x46')](db[_0x0920('0x2d')]['rawAttributes']);_0x423607[_0x0920('0x30')]=_['keys'](_0x391aae['query']);_0x423607[_0x0920('0x31')]=_['intersection'](_0x423607[_0x0920('0x2f')],_0x423607[_0x0920('0x30')]);_0x51e37a[_0x0920('0x33')]=_[_0x0920('0x32')](_0x423607[_0x0920('0x2f')],qs[_0x0920('0x34')](_0x391aae['query']['fields']));_0x51e37a[_0x0920('0x33')]=_0x51e37a['attributes']['length']?_0x51e37a[_0x0920('0x33')]:_0x423607[_0x0920('0x2f')];if(_0x391aae['query']['includeAll']){_0x51e37a[_0x0920('0x40')]=[{'all':!![]}];}_0x51e37a=_[_0x0920('0x3d')]({},_0x51e37a,_0x391aae[_0x0920('0x47')]);return db[_0x0920('0x2d')][_0x0920('0x48')](_0x51e37a)[_0x0920('0x24')](handleEntityNotFound(_0x302df4,null))[_0x0920('0x24')](respondWithResult(_0x302df4,null))[_0x0920('0x43')](handleError(_0x302df4,null));};exports[_0x0920('0x49')]=function(_0xcc72f0,_0x2d98f1,_0x3e8bed){return db['Sound']['find']({'where':{'id':_0xcc72f0[_0x0920('0x45')]['id']},'attributes':[_0x0920('0x29'),'save_name','converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x2d98f1,null))[_0x0920('0x24')](function(_0x449ace){if(_0x449ace){if(!fs[_0x0920('0x4a')](path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x4d'),_0x449ace[_0x0920('0x4e')]+'.'+_0x449ace['converted_format']))){throw new db[(_0x0920('0x4f'))][(_0x0920('0x50'))](_0x0920('0x51'));}return _0x2d98f1[_0x0920('0x49')](path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x4d'),util[_0x0920('0x52')](_0x0920('0x53'),_0x449ace[_0x0920('0x4e')],_0x449ace['converted_format'])),util[_0x0920('0x52')](_0x0920('0x53'),_0x449ace[_0x0920('0x29')],_0x449ace['converted_format']));}return null;})['catch'](handleError(_0x2d98f1,null));};exports['create']=function(_0x573755,_0x73cac2,_0x571412){var _0x2e68a1={'name':path['basename'](_0x573755[_0x0920('0x54')]['originalname'],path[_0x0920('0x55')](_0x573755['file'][_0x0920('0x56')])),'save_name':path[_0x0920('0x57')](_0x573755[_0x0920('0x54')][_0x0920('0x58')],path[_0x0920('0x55')](_0x573755['file']['filename'])),'original_format':path[_0x0920('0x55')](_0x573755[_0x0920('0x54')][_0x0920('0x56')])[_0x0920('0x59')](0x1),'converted_format':_0x0920('0x5a')};var _0x14c3d7=path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x5b'),_0x573755[_0x0920('0x54')]['filename']);var _0x5902d6=path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x4d'),util['format'](_0x0920('0x53'),path[_0x0920('0x57')](_0x573755[_0x0920('0x54')]['filename'],path[_0x0920('0x55')](_0x573755[_0x0920('0x54')][_0x0920('0x58')])),_0x2e68a1[_0x0920('0x5c')]));logger['info'](_0x0920('0x5d'),_0x14c3d7);logger['info'](_0x0920('0x5e'),_0x5902d6);try{fs[_0x0920('0x5f')](_0x14c3d7,parseInt(_0x0920('0x60'),0x8));var _0xa6887a=sox['transcode'](_0x14c3d7,_0x5902d6,{'sampleRate':0x1f40,'format':_0x0920('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa6887a['on'](_0x0920('0x28'),function(_0x54d020){fs[_0x0920('0x61')](_0x14c3d7);_0x73cac2[_0x0920('0x1a')](0x1f4)[_0x0920('0x2a')](_0x54d020);});_0xa6887a['on'](_0x0920('0x62'),function(_0x58c3e0){_0x2e68a1['original_duration']=isNaN(_0x58c3e0['duration'])?null:_0x58c3e0['duration']*0x3e8;_0x2e68a1[_0x0920('0x63')]=isNaN(_0x58c3e0[_0x0920('0x64')])?null:_0x58c3e0[_0x0920('0x64')];_0x2e68a1[_0x0920('0x65')]=isNaN(_0x58c3e0[_0x0920('0x66')])?null:_0x58c3e0[_0x0920('0x66')];_0x2e68a1['original_bitRate']=isNaN(_0x58c3e0['bitRate'])?null:_0x58c3e0[_0x0920('0x67')];_0x2e68a1[_0x0920('0x68')]=isNaN(_0x58c3e0[_0x0920('0x69')])?null:_0x58c3e0['sampleRate'];});_0xa6887a['on'](_0x0920('0x6a'),function(_0x6ee24a){_0x2e68a1[_0x0920('0x6b')]=isNaN(_0x6ee24a[_0x0920('0x6c')])?null:_0x6ee24a[_0x0920('0x6c')]*0x3e8;_0x2e68a1['converted_sampleCount']=isNaN(_0x6ee24a['sampleCount'])?null:_0x6ee24a['sampleCount'];_0x2e68a1[_0x0920('0x6d')]=isNaN(_0x6ee24a[_0x0920('0x66')])?null:_0x6ee24a[_0x0920('0x66')];_0x2e68a1[_0x0920('0x6e')]=isNaN(_0x6ee24a[_0x0920('0x67')])?null:_0x6ee24a[_0x0920('0x67')];_0x2e68a1[_0x0920('0x6f')]=isNaN(_0x6ee24a[_0x0920('0x69')])?null:_0x6ee24a[_0x0920('0x69')];});_0xa6887a['on'](_0x0920('0x1b'),function(){fs['chmodSync'](_0x5902d6,parseInt(_0x0920('0x60'),0x8));return db[_0x0920('0x2d')]['create'](_0x2e68a1)[_0x0920('0x24')](function(_0x598a42){var _0x3c750f={'role':_0x573755['body'][_0x0920('0x70')],'userProfileId':_0x573755['body']['userProfileId']};if(!_0x3c750f)throw new Error(_0x0920('0x71'));if(_0x3c750f[_0x0920('0x70')]===_0x0920('0x72')){var _0x3a100d=_0x598a42['get']({'plain':!![]});return db[_0x0920('0x73')]['find']({'where':{'name':_0x0920('0x26'),'userProfileId':_0x3c750f[_0x0920('0x74')]},'raw':!![]})['then'](function(_0x76c2a9){if(_0x76c2a9&&_0x76c2a9[_0x0920('0x75')]===0x0){return db['UserProfileResource'][_0x0920('0x76')]({'name':_0x3a100d[_0x0920('0x29')],'resourceId':_0x3a100d['id'],'type':_0x76c2a9[_0x0920('0x29')],'sectionId':_0x76c2a9['id']},{})[_0x0920('0x24')](function(){return _0x598a42;});}else{return _0x598a42;}})[_0x0920('0x43')](function(_0xdef5c5){logger['error'](_0x0920('0x77'),_0xdef5c5);throw _0xdef5c5;});}return _0x598a42;})['then'](respondWithResult(_0x73cac2,null))[_0x0920('0x43')](handleError(_0x73cac2,null));});_0xa6887a['start']();}catch(_0x788847){_0x73cac2['status'](0x1f4)[_0x0920('0x2a')](_0x788847);}};exports[_0x0920('0x22')]=function(_0x5f0219,_0x1561d0,_0x34d880){return db['Sound'][_0x0920('0x48')]({'where':{'id':_0x5f0219['params']['id']}})[_0x0920('0x24')](handleEntityNotFound(_0x1561d0,null))['then'](saveUpdates(_[_0x0920('0x3a')](_0x5f0219[_0x0920('0x78')],['name',_0x0920('0x79')]),null))[_0x0920('0x24')](respondWithResult(_0x1561d0,null))[_0x0920('0x43')](handleError(_0x1561d0,null));};exports[_0x0920('0x7a')]=function(_0x59201e,_0x14de97,_0x412935){return db[_0x0920('0x2d')][_0x0920('0x48')]({'where':{'id':_0x59201e[_0x0920('0x45')]['id']}})[_0x0920('0x24')](function(_0x2d6e5f){if(_0x2d6e5f){return _0x2d6e5f['destroy']();}})[_0x0920('0x24')](function(_0x58208c){var _0x545d49=path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x5b'),util['format'](_0x0920('0x53'),_0x58208c['save_name'],_0x58208c[_0x0920('0x7b')]));var _0xe846f2=path[_0x0920('0x4b')](config[_0x0920('0x4c')],_0x0920('0x4d'),util['format'](_0x0920('0x53'),_0x58208c['save_name'],_0x58208c[_0x0920('0x5c')]));fs[_0x0920('0x61')](_0x545d49);fs['unlinkSync'](_0xe846f2);return _0x58208c;})[_0x0920('0x24')](function(_0x54609c){if(_0x54609c){return _0x14de97[_0x0920('0x1a')](0xcc)[_0x0920('0x1b')]();}})[_0x0920('0x24')](handleEntityNotFound(_0x14de97,null))['catch'](handleError(_0x14de97,null));}; \ No newline at end of file +var _0xb701=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Sound','count','include','findAll','show','find','catch','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Sounds','UserProfileResource','then','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xb701,0x1c6));var _0x1b70=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb701[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x1b70('0x0'));var emlformat=require(_0x1b70('0x1'));var rimraf=require(_0x1b70('0x2'));var zipdir=require(_0x1b70('0x3'));var jsonpatch=require(_0x1b70('0x4'));var rp=require(_0x1b70('0x5'));var moment=require(_0x1b70('0x6'));var BPromise=require(_0x1b70('0x7'));var Mustache=require(_0x1b70('0x8'));var util=require(_0x1b70('0x9'));var path=require(_0x1b70('0xa'));var sox=require('sox');var csv=require(_0x1b70('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1b70('0xc'));var crypto=require(_0x1b70('0xd'));var jsforce=require(_0x1b70('0xe'));var deskjs=require(_0x1b70('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1b70('0x10'));var Papa=require(_0x1b70('0x11'));var Redis=require(_0x1b70('0x12'));var authService=require(_0x1b70('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1b70('0x14'));var hardwareService=require(_0x1b70('0x15'));var logger=require('../../config/logger')(_0x1b70('0x16'));var utils=require(_0x1b70('0x17'));var config=require(_0x1b70('0x18'));var db=require(_0x1b70('0x19'))['db'];function respondWithStatusCode(_0x2cee82,_0x252222){_0x252222=_0x252222||0xcc;return function(_0x3c78b2){if(_0x3c78b2){return _0x2cee82[_0x1b70('0x1a')](_0x252222);}return _0x2cee82[_0x1b70('0x1b')](_0x252222)[_0x1b70('0x1c')]();};}function respondWithResult(_0x13c413,_0x475932){_0x475932=_0x475932||0xc8;return function(_0x572972){if(_0x572972){return _0x13c413[_0x1b70('0x1b')](_0x475932)[_0x1b70('0x1d')](_0x572972);}};}function respondWithFilteredResult(_0xe386c8,_0x847339){return function(_0x401c01){if(_0x401c01){var _0x291622=_0x401c01['count'],_0x4f90d5=_0x847339['offset'],_0x3b3b39=_0x847339[_0x1b70('0x1e')]+_0x847339[_0x1b70('0x1f')],_0x38f301;if(_0x3b3b39>=_0x291622){_0x3b3b39=_0x291622;_0x38f301=0xc8;}else{_0x38f301=0xce;}_0xe386c8[_0x1b70('0x1b')](_0x38f301);return _0xe386c8[_0x1b70('0x20')](_0x1b70('0x21'),_0x4f90d5+'-'+_0x3b3b39+'/'+_0x291622)[_0x1b70('0x1d')](_0x401c01);}return null;};}function patchUpdates(_0x55cf73){return function(_0x40c271){try{jsonpatch[_0x1b70('0x22')](_0x40c271,_0x55cf73,!![]);}catch(_0x35e6d5){return BPromise[_0x1b70('0x23')](_0x35e6d5);}return _0x40c271[_0x1b70('0x24')]();};}function saveUpdates(_0x25d282,_0x20a64c){return function(_0x4261d5){if(_0x4261d5){return _0x4261d5['update'](_0x25d282)['then'](function(_0x57abe2){return _0x57abe2;});}return null;};}function removeEntity(_0x2b1e08,_0x522256){return function(_0x595802){if(_0x595802){return _0x595802[_0x1b70('0x25')]()['then'](function(){var _0x415cb2=_0x595802[_0x1b70('0x26')]({'plain':!![]});var _0x1fecea=_0x1b70('0x27');return db[_0x1b70('0x28')][_0x1b70('0x25')]({'where':{'type':_0x1fecea,'resourceId':_0x415cb2['id']}})[_0x1b70('0x29')](function(){return _0x595802;});})['then'](function(){_0x2b1e08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c0e70,_0x5f5120){return function(_0x557ae8){if(!_0x557ae8){_0x4c0e70[_0x1b70('0x1a')](0x194);}return _0x557ae8;};}function handleError(_0x35c340,_0xc63698){_0xc63698=_0xc63698||0x1f4;return function(_0x43d8e6){logger[_0x1b70('0x2a')](_0x43d8e6['stack']);if(_0x43d8e6[_0x1b70('0x2b')]){delete _0x43d8e6[_0x1b70('0x2b')];}_0x35c340[_0x1b70('0x1b')](_0xc63698)[_0x1b70('0x2c')](_0x43d8e6);};}exports[_0x1b70('0x2d')]=function(_0x5bf6fb,_0x3b74f6){var _0x42e9bc={},_0xe46b7={},_0x592d28={'count':0x0,'rows':[]};var _0x6f6ef6=_[_0x1b70('0x2e')](db['Sound'][_0x1b70('0x2f')],function(_0x14cb63){return{'name':_0x14cb63[_0x1b70('0x30')],'type':_0x14cb63[_0x1b70('0x31')][_0x1b70('0x32')]};});_0xe46b7[_0x1b70('0x33')]=_['map'](_0x6f6ef6,_0x1b70('0x2b'));_0xe46b7[_0x1b70('0x34')]=_[_0x1b70('0x35')](_0x5bf6fb[_0x1b70('0x34')]);_0xe46b7[_0x1b70('0x36')]=_[_0x1b70('0x37')](_0xe46b7[_0x1b70('0x33')],_0xe46b7['query']);_0x42e9bc[_0x1b70('0x38')]=_[_0x1b70('0x37')](_0xe46b7[_0x1b70('0x33')],qs[_0x1b70('0x39')](_0x5bf6fb[_0x1b70('0x34')]['fields']));_0x42e9bc[_0x1b70('0x38')]=_0x42e9bc[_0x1b70('0x38')][_0x1b70('0x3a')]?_0x42e9bc[_0x1b70('0x38')]:_0xe46b7[_0x1b70('0x33')];if(!_0x5bf6fb['query'][_0x1b70('0x3b')](_0x1b70('0x3c'))){_0x42e9bc[_0x1b70('0x1f')]=qs[_0x1b70('0x1f')](_0x5bf6fb[_0x1b70('0x34')][_0x1b70('0x1f')]);_0x42e9bc['offset']=qs[_0x1b70('0x1e')](_0x5bf6fb['query']['offset']);}_0x42e9bc[_0x1b70('0x3d')]=qs[_0x1b70('0x3e')](_0x5bf6fb[_0x1b70('0x34')][_0x1b70('0x3e')]);_0x42e9bc[_0x1b70('0x3f')]=qs[_0x1b70('0x36')](_[_0x1b70('0x40')](_0x5bf6fb['query'],_0xe46b7['filters']),_0x6f6ef6);if(_0x5bf6fb[_0x1b70('0x34')]['filter']){_0x42e9bc[_0x1b70('0x3f')]=_[_0x1b70('0x41')](_0x42e9bc[_0x1b70('0x3f')],{'$or':_['map'](_0x6f6ef6,function(_0x3b3fad){if(_0x3b3fad[_0x1b70('0x31')]!==_0x1b70('0x42')){var _0x12cb30={};_0x12cb30[_0x3b3fad[_0x1b70('0x2b')]]={'$like':'%'+_0x5bf6fb['query'][_0x1b70('0x43')]+'%'};return _0x12cb30;}})});}_0x42e9bc=_[_0x1b70('0x41')]({},_0x42e9bc,_0x5bf6fb[_0x1b70('0x44')]);var _0x2b5daf={'where':_0x42e9bc[_0x1b70('0x3f')]};return db[_0x1b70('0x45')]['count'](_0x2b5daf)['then'](function(_0x1c166e){_0x592d28[_0x1b70('0x46')]=_0x1c166e;if(_0x5bf6fb[_0x1b70('0x34')]['includeAll']){_0x42e9bc[_0x1b70('0x47')]=[{'all':!![]}];}return db[_0x1b70('0x45')][_0x1b70('0x48')](_0x42e9bc);})[_0x1b70('0x29')](function(_0x274bb4){_0x592d28['rows']=_0x274bb4;return _0x592d28;})[_0x1b70('0x29')](respondWithFilteredResult(_0x3b74f6,_0x42e9bc))['catch'](handleError(_0x3b74f6,null));};exports[_0x1b70('0x49')]=function(_0xa4c06e,_0x33c79f){var _0xa2ea47={'raw':!![],'where':{'id':_0xa4c06e['params']['id']}},_0x5a88b8={};_0x5a88b8[_0x1b70('0x33')]=_[_0x1b70('0x35')](db[_0x1b70('0x45')]['rawAttributes']);_0x5a88b8[_0x1b70('0x34')]=_[_0x1b70('0x35')](_0xa4c06e[_0x1b70('0x34')]);_0x5a88b8['filters']=_[_0x1b70('0x37')](_0x5a88b8[_0x1b70('0x33')],_0x5a88b8[_0x1b70('0x34')]);_0xa2ea47[_0x1b70('0x38')]=_[_0x1b70('0x37')](_0x5a88b8[_0x1b70('0x33')],qs[_0x1b70('0x39')](_0xa4c06e[_0x1b70('0x34')]['fields']));_0xa2ea47[_0x1b70('0x38')]=_0xa2ea47[_0x1b70('0x38')]['length']?_0xa2ea47['attributes']:_0x5a88b8['model'];if(_0xa4c06e['query']['includeAll']){_0xa2ea47[_0x1b70('0x47')]=[{'all':!![]}];}_0xa2ea47=_[_0x1b70('0x41')]({},_0xa2ea47,_0xa4c06e[_0x1b70('0x44')]);return db[_0x1b70('0x45')][_0x1b70('0x4a')](_0xa2ea47)[_0x1b70('0x29')](handleEntityNotFound(_0x33c79f,null))['then'](respondWithResult(_0x33c79f,null))[_0x1b70('0x4b')](handleError(_0x33c79f,null));};exports[_0x1b70('0x4c')]=function(_0xffc2d6,_0x4b26be,_0x1beb12){return db[_0x1b70('0x45')]['find']({'where':{'id':_0xffc2d6[_0x1b70('0x4d')]['id']},'attributes':[_0x1b70('0x2b'),_0x1b70('0x4e'),_0x1b70('0x4f')],'raw':!![]})[_0x1b70('0x29')](handleEntityNotFound(_0x4b26be,null))['then'](function(_0x1d11e3){if(_0x1d11e3){if(!fs[_0x1b70('0x50')](path[_0x1b70('0x51')](config[_0x1b70('0x52')],_0x1b70('0x53'),_0x1d11e3[_0x1b70('0x4e')]+'.'+_0x1d11e3[_0x1b70('0x4f')]))){throw new db[(_0x1b70('0x54'))]['ValidationError'](_0x1b70('0x55'));}return _0x4b26be[_0x1b70('0x4c')](path[_0x1b70('0x51')](config[_0x1b70('0x52')],_0x1b70('0x53'),util[_0x1b70('0x56')](_0x1b70('0x57'),_0x1d11e3[_0x1b70('0x4e')],_0x1d11e3[_0x1b70('0x4f')])),util['format'](_0x1b70('0x57'),_0x1d11e3[_0x1b70('0x2b')],_0x1d11e3[_0x1b70('0x4f')]));}return null;})[_0x1b70('0x4b')](handleError(_0x4b26be,null));};exports[_0x1b70('0x58')]=function(_0x59b91e,_0x2657ec,_0x3259c9){var _0x408425={'name':path[_0x1b70('0x59')](_0x59b91e[_0x1b70('0x5a')][_0x1b70('0x5b')],path[_0x1b70('0x5c')](_0x59b91e[_0x1b70('0x5a')][_0x1b70('0x5b')])),'save_name':path[_0x1b70('0x59')](_0x59b91e[_0x1b70('0x5a')]['filename'],path[_0x1b70('0x5c')](_0x59b91e[_0x1b70('0x5a')][_0x1b70('0x5d')])),'original_format':path[_0x1b70('0x5c')](_0x59b91e[_0x1b70('0x5a')][_0x1b70('0x5b')])['substring'](0x1),'converted_format':_0x1b70('0x5e')};var _0x6d1dd=path['join'](config[_0x1b70('0x52')],_0x1b70('0x5f'),_0x59b91e['file']['filename']);var _0x19b839=path[_0x1b70('0x51')](config[_0x1b70('0x52')],_0x1b70('0x53'),util['format'](_0x1b70('0x57'),path[_0x1b70('0x59')](_0x59b91e[_0x1b70('0x5a')][_0x1b70('0x5d')],path['extname'](_0x59b91e[_0x1b70('0x5a')][_0x1b70('0x5d')])),_0x408425[_0x1b70('0x4f')]));logger[_0x1b70('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x6d1dd);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x19b839);try{fs[_0x1b70('0x61')](_0x6d1dd,parseInt(_0x1b70('0x62'),0x8));var _0x4d47f8=sox[_0x1b70('0x63')](_0x6d1dd,_0x19b839,{'sampleRate':0x1f40,'format':_0x1b70('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d47f8['on'](_0x1b70('0x2a'),function(_0x3c65f9){fs[_0x1b70('0x64')](_0x6d1dd);_0x2657ec[_0x1b70('0x1b')](0x1f4)[_0x1b70('0x2c')](_0x3c65f9);});_0x4d47f8['on'](_0x1b70('0x65'),function(_0x5de1f8){_0x408425['original_duration']=isNaN(_0x5de1f8[_0x1b70('0x66')])?null:_0x5de1f8[_0x1b70('0x66')]*0x3e8;_0x408425[_0x1b70('0x67')]=isNaN(_0x5de1f8['sampleCount'])?null:_0x5de1f8[_0x1b70('0x68')];_0x408425[_0x1b70('0x69')]=isNaN(_0x5de1f8['channelCount'])?null:_0x5de1f8[_0x1b70('0x6a')];_0x408425[_0x1b70('0x6b')]=isNaN(_0x5de1f8[_0x1b70('0x6c')])?null:_0x5de1f8[_0x1b70('0x6c')];_0x408425['original_sampleRate']=isNaN(_0x5de1f8[_0x1b70('0x6d')])?null:_0x5de1f8[_0x1b70('0x6d')];});_0x4d47f8['on'](_0x1b70('0x6e'),function(_0x5e1482){_0x408425[_0x1b70('0x6f')]=isNaN(_0x5e1482['duration'])?null:_0x5e1482['duration']*0x3e8;_0x408425['converted_sampleCount']=isNaN(_0x5e1482[_0x1b70('0x68')])?null:_0x5e1482[_0x1b70('0x68')];_0x408425[_0x1b70('0x70')]=isNaN(_0x5e1482['channelCount'])?null:_0x5e1482[_0x1b70('0x6a')];_0x408425[_0x1b70('0x71')]=isNaN(_0x5e1482[_0x1b70('0x6c')])?null:_0x5e1482[_0x1b70('0x6c')];_0x408425[_0x1b70('0x72')]=isNaN(_0x5e1482[_0x1b70('0x6d')])?null:_0x5e1482[_0x1b70('0x6d')];});_0x4d47f8['on'](_0x1b70('0x1c'),function(){fs[_0x1b70('0x61')](_0x19b839,parseInt('0777',0x8));return db[_0x1b70('0x45')][_0x1b70('0x58')](_0x408425)[_0x1b70('0x29')](function(_0x3aca7b){var _0x448501={'role':_0x59b91e[_0x1b70('0x73')][_0x1b70('0x74')],'userProfileId':_0x59b91e['body'][_0x1b70('0x75')]};if(!_0x448501)throw new Error(_0x1b70('0x76'));if(_0x448501[_0x1b70('0x74')]===_0x1b70('0x77')){var _0x4e2322=_0x3aca7b['get']({'plain':!![]});return db['UserProfileSection'][_0x1b70('0x4a')]({'where':{'name':_0x1b70('0x27'),'userProfileId':_0x448501[_0x1b70('0x75')]},'raw':!![]})['then'](function(_0x414423){if(_0x414423&&_0x414423[_0x1b70('0x78')]===0x0){return db[_0x1b70('0x28')]['create']({'name':_0x4e2322[_0x1b70('0x2b')],'resourceId':_0x4e2322['id'],'type':_0x414423[_0x1b70('0x2b')],'sectionId':_0x414423['id']},{})[_0x1b70('0x29')](function(){return _0x3aca7b;});}else{return _0x3aca7b;}})['catch'](function(_0x218c58){logger['error'](_0x1b70('0x79'),_0x218c58);throw _0x218c58;});}return _0x3aca7b;})[_0x1b70('0x29')](respondWithResult(_0x2657ec,null))['catch'](handleError(_0x2657ec,null));});_0x4d47f8[_0x1b70('0x7a')]();}catch(_0xf82dfe){_0x2657ec[_0x1b70('0x1b')](0x1f4)['send'](_0xf82dfe);}};exports[_0x1b70('0x7b')]=function(_0xcf840e,_0xd8e238,_0x3a5437){return db[_0x1b70('0x45')]['find']({'where':{'id':_0xcf840e[_0x1b70('0x4d')]['id']}})[_0x1b70('0x29')](handleEntityNotFound(_0xd8e238,null))[_0x1b70('0x29')](saveUpdates(_[_0x1b70('0x40')](_0xcf840e[_0x1b70('0x73')],[_0x1b70('0x2b'),'description']),null))[_0x1b70('0x29')](respondWithResult(_0xd8e238,null))[_0x1b70('0x4b')](handleError(_0xd8e238,null));};exports[_0x1b70('0x7c')]=function(_0x303a32,_0x53088d,_0x1cfa94){return db[_0x1b70('0x45')][_0x1b70('0x4a')]({'where':{'id':_0x303a32[_0x1b70('0x4d')]['id']}})[_0x1b70('0x29')](function(_0x5cd24c){if(_0x5cd24c){return _0x5cd24c[_0x1b70('0x25')]();}})[_0x1b70('0x29')](function(_0x3ef814){var _0x4a9808=path[_0x1b70('0x51')](config[_0x1b70('0x52')],_0x1b70('0x5f'),util[_0x1b70('0x56')](_0x1b70('0x57'),_0x3ef814[_0x1b70('0x4e')],_0x3ef814[_0x1b70('0x7d')]));var _0x25d73e=path[_0x1b70('0x51')](config[_0x1b70('0x52')],_0x1b70('0x53'),util[_0x1b70('0x56')](_0x1b70('0x57'),_0x3ef814[_0x1b70('0x4e')],_0x3ef814['converted_format']));fs[_0x1b70('0x64')](_0x4a9808);fs[_0x1b70('0x64')](_0x25d73e);return _0x3ef814;})[_0x1b70('0x29')](function(_0x2544b9){if(_0x2544b9){return _0x53088d[_0x1b70('0x1b')](0xcc)[_0x1b70('0x1c')]();}})[_0x1b70('0x29')](handleEntityNotFound(_0x53088d,null))[_0x1b70('0x4b')](handleError(_0x53088d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 9c50fd0..a2597c5 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 _0x6e5a=['tools_sounds','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6e5a,0x7a));var _0xa6e5=function(_0x46b79a,_0x52f896){_0x46b79a=_0x46b79a-0x0;var _0x54c14b=_0x6e5a[_0x46b79a];return _0x54c14b;};'use strict';var _=require(_0xa6e5('0x0'));var util=require(_0xa6e5('0x1'));var logger=require('../../config/logger')(_0xa6e5('0x2'));var moment=require(_0xa6e5('0x3'));var BPromise=require(_0xa6e5('0x4'));var rp=require(_0xa6e5('0x5'));var fs=require('fs');var path=require(_0xa6e5('0x6'));var rimraf=require(_0xa6e5('0x7'));var config=require('../../config/environment');var attributes=require(_0xa6e5('0x8'));module[_0xa6e5('0x9')]=function(_0x1818e7,_0x3e6f3a){return _0x1818e7['define']('Sound',attributes,{'tableName':_0xa6e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x060c=['util','moment','request-promise','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x060c,0xd0));var _0xc060=function(_0x1d5f3b,_0x41961c){_0x1d5f3b=_0x1d5f3b-0x0;var _0x27d1af=_0x060c[_0x1d5f3b];return _0x27d1af;};'use strict';var _=require(_0xc060('0x0'));var util=require(_0xc060('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc060('0x2'));var BPromise=require('bluebird');var rp=require(_0xc060('0x3'));var fs=require('fs');var path=require(_0xc060('0x4'));var rimraf=require(_0xc060('0x5'));var config=require('../../config/environment');var attributes=require(_0xc060('0x6'));module[_0xc060('0x7')]=function(_0x5ab3da,_0x24e48f){return _0x5ab3da[_0xc060('0x8')](_0xc060('0x9'),attributes,{'tableName':_0xc060('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 bea8390..701848c 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 _0xc1c1=['Sound','options','raw','where','map','include','attributes','debug','stringify','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','error','message','catch','ShowSound'];(function(_0x115f4e,_0x85c81){var _0x36e666=function(_0x4c42ca){while(--_0x4c42ca){_0x115f4e['push'](_0x115f4e['shift']());}};_0x36e666(++_0x85c81);}(_0xc1c1,0x19e));var _0x1c1c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc1c1[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1c1c('0x0'));var rs=require(_0x1c1c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1c1c('0x2'));var logger=require(_0x1c1c('0x3'))(_0x1c1c('0x4'));var config=require(_0x1c1c('0x5'));var jayson=require(_0x1c1c('0x6'));var client=jayson[_0x1c1c('0x7')][_0x1c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40d035,_0x24937d,_0x1b6218){return new BPromise(function(_0x2e80db,_0x244730){return client[_0x1c1c('0x9')](_0x40d035,_0x1b6218)[_0x1c1c('0xa')](function(_0x6b05fd){logger[_0x1c1c('0xb')](_0x1c1c('0xc'),_0x24937d,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x24937d,_0x1c1c('0xd'),JSON['stringify'](_0x6b05fd));if(_0x6b05fd[_0x1c1c('0xe')]){if(_0x6b05fd[_0x1c1c('0xe')]['code']===0x1f4){logger[_0x1c1c('0xe')](_0x1c1c('0xc'),_0x24937d,_0x6b05fd['error'][_0x1c1c('0xf')]);return _0x244730(_0x6b05fd[_0x1c1c('0xe')]['message']);}logger[_0x1c1c('0xe')]('Sound,\x20%s,\x20%s',_0x24937d,_0x6b05fd[_0x1c1c('0xe')][_0x1c1c('0xf')]);return _0x2e80db(_0x6b05fd[_0x1c1c('0xe')][_0x1c1c('0xf')]);}else{logger[_0x1c1c('0xb')](_0x1c1c('0xc'),_0x24937d,_0x1c1c('0xd'));_0x2e80db(_0x6b05fd['result'][_0x1c1c('0xf')]);}})[_0x1c1c('0x10')](function(_0x165b8a){logger[_0x1c1c('0xe')](_0x1c1c('0xc'),_0x24937d,_0x165b8a);_0x244730(_0x165b8a);});});}exports[_0x1c1c('0x11')]=function(_0x4e30c4){var _0x5c917e=this;return new Promise(function(_0x268e3e,_0x28bbc0){return db[_0x1c1c('0x12')]['find']({'raw':_0x4e30c4['options']?_0x4e30c4[_0x1c1c('0x13')][_0x1c1c('0x14')]===undefined?!![]:![]:!![],'where':_0x4e30c4['options']?_0x4e30c4[_0x1c1c('0x13')][_0x1c1c('0x15')]||null:null,'attributes':_0x4e30c4[_0x1c1c('0x13')]?_0x4e30c4[_0x1c1c('0x13')]['attributes']||null:null,'include':_0x4e30c4[_0x1c1c('0x13')]?_0x4e30c4[_0x1c1c('0x13')]['include']?_[_0x1c1c('0x16')](_0x4e30c4[_0x1c1c('0x13')][_0x1c1c('0x17')],function(_0x54679c){return{'model':db[_0x54679c['model']],'as':_0x54679c['as'],'attributes':_0x54679c['attributes'],'include':_0x54679c['include']?_[_0x1c1c('0x16')](_0x54679c[_0x1c1c('0x17')],function(_0x5c0a3b){return{'model':db[_0x5c0a3b['model']],'as':_0x5c0a3b['as'],'attributes':_0x5c0a3b[_0x1c1c('0x18')],'include':_0x5c0a3b[_0x1c1c('0x17')]?_[_0x1c1c('0x16')](_0x5c0a3b[_0x1c1c('0x17')],function(_0x1e6217){return{'model':db[_0x1e6217['model']],'as':_0x1e6217['as'],'attributes':_0x1e6217['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c1c('0xa')](function(_0x2afa03){logger[_0x1c1c('0xb')](_0x1c1c('0x11'),_0x4e30c4);logger[_0x1c1c('0x19')](_0x1c1c('0x11'),_0x4e30c4,JSON[_0x1c1c('0x1a')](_0x2afa03));_0x268e3e(_0x2afa03);})[_0x1c1c('0x10')](function(_0x4c25c3){logger[_0x1c1c('0xe')](_0x1c1c('0x11'),_0x4c25c3['message'],_0x4e30c4);_0x28bbc0(_0x5c917e[_0x1c1c('0xe')](0x1f4,_0x4c25c3[_0x1c1c('0xf')]));});});}; \ No newline at end of file +var _0x743b=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','lodash','util','moment'];(function(_0x4d5d8c,_0x9a68bd){var _0x24bb52=function(_0x244e4a){while(--_0x244e4a){_0x4d5d8c['push'](_0x4d5d8c['shift']());}};_0x24bb52(++_0x9a68bd);}(_0x743b,0x189));var _0xb743=function(_0x35b89a,_0x1e3622){_0x35b89a=_0x35b89a-0x0;var _0x3be55f=_0x743b[_0x35b89a];return _0x3be55f;};'use strict';var _=require(_0xb743('0x0'));var util=require(_0xb743('0x1'));var moment=require(_0xb743('0x2'));var BPromise=require(_0xb743('0x3'));var rs=require(_0xb743('0x4'));var fs=require('fs');var Redis=require(_0xb743('0x5'));var db=require(_0xb743('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb743('0x7'));var config=require(_0xb743('0x8'));var jayson=require(_0xb743('0x9'));var client=jayson[_0xb743('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d6618,_0x132ab5,_0x394d51){return new BPromise(function(_0x3290b1,_0x24b525){return client[_0xb743('0xb')](_0x5d6618,_0x394d51)[_0xb743('0xc')](function(_0x50b4fc){logger[_0xb743('0xd')](_0xb743('0xe'),_0x132ab5,'request\x20sent');logger[_0xb743('0xf')](_0xb743('0x10'),_0x132ab5,'request\x20sent',JSON[_0xb743('0x11')](_0x50b4fc));if(_0x50b4fc[_0xb743('0x12')]){if(_0x50b4fc['error'][_0xb743('0x13')]===0x1f4){logger[_0xb743('0x12')](_0xb743('0xe'),_0x132ab5,_0x50b4fc[_0xb743('0x12')][_0xb743('0x14')]);return _0x24b525(_0x50b4fc[_0xb743('0x12')][_0xb743('0x14')]);}logger[_0xb743('0x12')](_0xb743('0xe'),_0x132ab5,_0x50b4fc[_0xb743('0x12')]['message']);return _0x3290b1(_0x50b4fc[_0xb743('0x12')][_0xb743('0x14')]);}else{logger[_0xb743('0xd')]('Sound,\x20%s,\x20%s',_0x132ab5,'request\x20sent');_0x3290b1(_0x50b4fc[_0xb743('0x15')][_0xb743('0x14')]);}})[_0xb743('0x16')](function(_0x5b56c8){logger[_0xb743('0x12')](_0xb743('0xe'),_0x132ab5,_0x5b56c8);_0x24b525(_0x5b56c8);});});}exports[_0xb743('0x17')]=function(_0x1159d6){var _0x1a686b=this;return new Promise(function(_0x148535,_0x337b44){return db[_0xb743('0x18')][_0xb743('0x19')]({'raw':_0x1159d6[_0xb743('0x1a')]?_0x1159d6['options'][_0xb743('0x1b')]===undefined?!![]:![]:!![],'where':_0x1159d6[_0xb743('0x1a')]?_0x1159d6[_0xb743('0x1a')][_0xb743('0x1c')]||null:null,'attributes':_0x1159d6['options']?_0x1159d6[_0xb743('0x1a')][_0xb743('0x1d')]||null:null,'include':_0x1159d6[_0xb743('0x1a')]?_0x1159d6[_0xb743('0x1a')]['include']?_[_0xb743('0x1e')](_0x1159d6['options'][_0xb743('0x1f')],function(_0x20d109){return{'model':db[_0x20d109[_0xb743('0x20')]],'as':_0x20d109['as'],'attributes':_0x20d109[_0xb743('0x1d')],'include':_0x20d109[_0xb743('0x1f')]?_['map'](_0x20d109[_0xb743('0x1f')],function(_0x1dcc3b){return{'model':db[_0x1dcc3b[_0xb743('0x20')]],'as':_0x1dcc3b['as'],'attributes':_0x1dcc3b[_0xb743('0x1d')],'include':_0x1dcc3b[_0xb743('0x1f')]?_[_0xb743('0x1e')](_0x1dcc3b['include'],function(_0x1d3a98){return{'model':db[_0x1d3a98[_0xb743('0x20')]],'as':_0x1d3a98['as'],'attributes':_0x1d3a98[_0xb743('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb743('0xc')](function(_0x4b0852){logger[_0xb743('0xd')](_0xb743('0x17'),_0x1159d6);logger[_0xb743('0xf')](_0xb743('0x17'),_0x1159d6,JSON['stringify'](_0x4b0852));_0x148535(_0x4b0852);})[_0xb743('0x16')](function(_0x2028e2){logger[_0xb743('0x12')](_0xb743('0x17'),_0x2028e2['message'],_0x1159d6);_0x337b44(_0x1a686b[_0xb743('0x12')](0x1f4,_0x2028e2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a92fa97..8844a81 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 _0xbe09=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0xbe09,0xcb));var _0x9be0=function(_0xd747d9,_0x53e805){_0xd747d9=_0xd747d9-0x0;var _0x3fc4b0=_0xbe09[_0xd747d9];return _0x3fc4b0;};'use strict';var multer=require(_0x9be0('0x0'));var util=require(_0x9be0('0x1'));var path=require(_0x9be0('0x2'));var timeout=require('connect-timeout');var express=require(_0x9be0('0x3'));var router=express[_0x9be0('0x4')]();var auth=require(_0x9be0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9be0('0x6'));router[_0x9be0('0x7')]('/',auth[_0x9be0('0x8')](),controller[_0x9be0('0x9')]);router['get'](_0x9be0('0xa'),auth[_0x9be0('0x8')](),controller['show']);router[_0x9be0('0xb')]('/',auth['isAuthenticated'](),controller[_0x9be0('0xc')]);router[_0x9be0('0xd')](_0x9be0('0xa'),auth[_0x9be0('0x8')](),controller[_0x9be0('0xe')]);router[_0x9be0('0xf')](_0x9be0('0xa'),auth[_0x9be0('0x8')](),controller[_0x9be0('0x10')]);module[_0x9be0('0x11')]=router; \ No newline at end of file +var _0x611f=['get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller'];(function(_0x437910,_0x38287c){var _0x29afbc=function(_0x5c0312){while(--_0x5c0312){_0x437910['push'](_0x437910['shift']());}};_0x29afbc(++_0x38287c);}(_0x611f,0x1c4));var _0xf611=function(_0x23cc84,_0xb537ca){_0x23cc84=_0x23cc84-0x0;var _0x321ba4=_0x611f[_0x23cc84];return _0x321ba4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf611('0x0'));var timeout=require(_0xf611('0x1'));var express=require('express');var router=express[_0xf611('0x2')]();var auth=require(_0xf611('0x3'));var interaction=require(_0xf611('0x4'));var config=require(_0xf611('0x5'));var controller=require(_0xf611('0x6'));router[_0xf611('0x7')]('/',auth[_0xf611('0x8')](),controller[_0xf611('0x9')]);router[_0xf611('0x7')](_0xf611('0xa'),auth['isAuthenticated'](),controller[_0xf611('0xb')]);router[_0xf611('0xc')]('/',auth[_0xf611('0x8')](),controller['create']);router[_0xf611('0xd')](_0xf611('0xa'),auth['isAuthenticated'](),controller[_0xf611('0xe')]);router['delete'](_0xf611('0xa'),auth[_0xf611('0x8')](),controller[_0xf611('0xf')]);module[_0xf611('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4801015..ecd5ca9 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 _0xcb06=['medium','ENUM','out','sequelize','exports','STRING'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xcb06,0x1c5));var _0x6cb0=function(_0x140357,_0x6670bd){_0x140357=_0x140357-0x0;var _0x4fdf00=_0xcb06[_0x140357];return _0x4fdf00;};'use strict';var Sequelize=require(_0x6cb0('0x0'));module[_0x6cb0('0x1')]={'uniqueid':{'type':Sequelize[_0x6cb0('0x2')]},'body':{'type':Sequelize['TEXT'](_0x6cb0('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6cb0('0x4')]('in',_0x6cb0('0x5')),'defaultValue':_0x6cb0('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x3243=['ENUM','out','STRING','TEXT','medium'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3243,0x115));var _0x3324=function(_0x3d8790,_0xb14aef){_0x3d8790=_0x3d8790-0x0;var _0x4b66d9=_0x3243[_0x3d8790];return _0x4b66d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3324('0x0')]},'body':{'type':Sequelize[_0x3324('0x1')](_0x3324('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x3324('0x3')]('in',_0x3324('0x4')),'defaultValue':_0x3324('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 ae0b385..d81366f 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 _0x0cd0=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','Content-Range','apply','reject','update','then','error','name','send','index','map','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','options','SquareMessage','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0x0cd0,0x19a));var _0x00cd=function(_0x12d549,_0x215a80){_0x12d549=_0x12d549-0x0;var _0x4d0fee=_0x0cd0[_0x12d549];return _0x4d0fee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x00cd('0x0'));var rimraf=require(_0x00cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00cd('0x2'));var rp=require(_0x00cd('0x3'));var moment=require(_0x00cd('0x4'));var BPromise=require(_0x00cd('0x5'));var Mustache=require(_0x00cd('0x6'));var util=require(_0x00cd('0x7'));var path=require(_0x00cd('0x8'));var sox=require(_0x00cd('0x9'));var csv=require('to-csv');var ejs=require(_0x00cd('0xa'));var fs=require('fs');var _=require(_0x00cd('0xb'));var squel=require(_0x00cd('0xc'));var crypto=require('crypto');var jsforce=require(_0x00cd('0xd'));var deskjs=require(_0x00cd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x00cd('0xf'));var Papa=require(_0x00cd('0x10'));var Redis=require(_0x00cd('0x11'));var authService=require(_0x00cd('0x12'));var qs=require(_0x00cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00cd('0x14'));var logger=require(_0x00cd('0x15'))(_0x00cd('0x16'));var utils=require(_0x00cd('0x17'));var config=require(_0x00cd('0x18'));var db=require(_0x00cd('0x19'))['db'];function respondWithStatusCode(_0x11e6a4,_0x21310e){_0x21310e=_0x21310e||0xcc;return function(_0x59f07d){if(_0x59f07d){return _0x11e6a4['sendStatus'](_0x21310e);}return _0x11e6a4['status'](_0x21310e)[_0x00cd('0x1a')]();};}function respondWithResult(_0x559a64,_0x53a0a9){_0x53a0a9=_0x53a0a9||0xc8;return function(_0x2ef4f8){if(_0x2ef4f8){return _0x559a64[_0x00cd('0x1b')](_0x53a0a9)[_0x00cd('0x1c')](_0x2ef4f8);}};}function respondWithFilteredResult(_0x26da68,_0x5108df){return function(_0x394068){if(_0x394068){var _0x11ca3f=_0x394068[_0x00cd('0x1d')],_0x5bfe05=_0x5108df[_0x00cd('0x1e')],_0x212c82=_0x5108df[_0x00cd('0x1e')]+_0x5108df['limit'],_0x9b434d;if(_0x212c82>=_0x11ca3f){_0x212c82=_0x11ca3f;_0x9b434d=0xc8;}else{_0x9b434d=0xce;}_0x26da68[_0x00cd('0x1b')](_0x9b434d);return _0x26da68['set'](_0x00cd('0x1f'),_0x5bfe05+'-'+_0x212c82+'/'+_0x11ca3f)[_0x00cd('0x1c')](_0x394068);}return null;};}function patchUpdates(_0x467e1f){return function(_0x26f7d6){try{jsonpatch[_0x00cd('0x20')](_0x26f7d6,_0x467e1f,!![]);}catch(_0x3636a3){return BPromise[_0x00cd('0x21')](_0x3636a3);}return _0x26f7d6['save']();};}function saveUpdates(_0x3d2d4c,_0x6e904b){return function(_0x2a2c03){if(_0x2a2c03){return _0x2a2c03[_0x00cd('0x22')](_0x3d2d4c)['then'](function(_0x52a10b){return _0x52a10b;});}return null;};}function removeEntity(_0x2fdf11,_0x405212){return function(_0x4c96fb){if(_0x4c96fb){return _0x4c96fb['destroy']()[_0x00cd('0x23')](function(){_0x2fdf11[_0x00cd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f0f85,_0x5d0810){return function(_0x24f7b7){if(!_0x24f7b7){_0x1f0f85['sendStatus'](0x194);}return _0x24f7b7;};}function handleError(_0x3d5f73,_0x4bcb9d){_0x4bcb9d=_0x4bcb9d||0x1f4;return function(_0xb2f790){logger[_0x00cd('0x24')](_0xb2f790['stack']);if(_0xb2f790['name']){delete _0xb2f790[_0x00cd('0x25')];}_0x3d5f73[_0x00cd('0x1b')](_0x4bcb9d)[_0x00cd('0x26')](_0xb2f790);};}exports[_0x00cd('0x27')]=function(_0x69e7fa,_0x7d8011){var _0x47ff7e={},_0x2d3a60={},_0xc4afc8={'count':0x0,'rows':[]};var _0x29b5ca=_[_0x00cd('0x28')](db['SquareMessage']['rawAttributes'],function(_0x3b2e64){return{'name':_0x3b2e64[_0x00cd('0x29')],'type':_0x3b2e64['type'][_0x00cd('0x2a')]};});_0x2d3a60['model']=_[_0x00cd('0x28')](_0x29b5ca,_0x00cd('0x25'));_0x2d3a60[_0x00cd('0x2b')]=_[_0x00cd('0x2c')](_0x69e7fa[_0x00cd('0x2b')]);_0x2d3a60[_0x00cd('0x2d')]=_[_0x00cd('0x2e')](_0x2d3a60['model'],_0x2d3a60[_0x00cd('0x2b')]);_0x47ff7e[_0x00cd('0x2f')]=_['intersection'](_0x2d3a60[_0x00cd('0x30')],qs['fields'](_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x31')]));_0x47ff7e['attributes']=_0x47ff7e[_0x00cd('0x2f')]['length']?_0x47ff7e['attributes']:_0x2d3a60['model'];if(!_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x32')]('nolimit')){_0x47ff7e[_0x00cd('0x33')]=qs[_0x00cd('0x33')](_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x33')]);_0x47ff7e[_0x00cd('0x1e')]=qs['offset'](_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x1e')]);}_0x47ff7e['order']=qs[_0x00cd('0x34')](_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x34')]);_0x47ff7e[_0x00cd('0x35')]=qs['filters'](_[_0x00cd('0x36')](_0x69e7fa[_0x00cd('0x2b')],_0x2d3a60[_0x00cd('0x2d')]),_0x29b5ca);if(_0x69e7fa['query']['filter']){_0x47ff7e[_0x00cd('0x35')]=_[_0x00cd('0x37')](_0x47ff7e[_0x00cd('0x35')],{'$or':_[_0x00cd('0x28')](_0x29b5ca,function(_0x340811){if(_0x340811['type']!==_0x00cd('0x38')){var _0x32c2b5={};_0x32c2b5[_0x340811[_0x00cd('0x25')]]={'$like':'%'+_0x69e7fa[_0x00cd('0x2b')][_0x00cd('0x39')]+'%'};return _0x32c2b5;}})});}_0x47ff7e=_['merge']({},_0x47ff7e,_0x69e7fa[_0x00cd('0x3a')]);var _0x35001f={'where':_0x47ff7e[_0x00cd('0x35')]};return db[_0x00cd('0x3b')]['count'](_0x35001f)['then'](function(_0x3adf34){_0xc4afc8[_0x00cd('0x1d')]=_0x3adf34;if(_0x69e7fa['query'][_0x00cd('0x3c')]){_0x47ff7e[_0x00cd('0x3d')]=[{'all':!![]}];}return db[_0x00cd('0x3b')][_0x00cd('0x3e')](_0x47ff7e);})[_0x00cd('0x23')](function(_0x24c692){_0xc4afc8[_0x00cd('0x3f')]=_0x24c692;return _0xc4afc8;})[_0x00cd('0x23')](respondWithFilteredResult(_0x7d8011,_0x47ff7e))[_0x00cd('0x40')](handleError(_0x7d8011,null));};exports[_0x00cd('0x41')]=function(_0x13034e,_0x7fa72){var _0x2fdb9d={'raw':!![],'where':{'id':_0x13034e[_0x00cd('0x42')]['id']}},_0x1b8168={};_0x1b8168['model']=_[_0x00cd('0x2c')](db['SquareMessage']['rawAttributes']);_0x1b8168[_0x00cd('0x2b')]=_[_0x00cd('0x2c')](_0x13034e['query']);_0x1b8168[_0x00cd('0x2d')]=_[_0x00cd('0x2e')](_0x1b8168[_0x00cd('0x30')],_0x1b8168['query']);_0x2fdb9d[_0x00cd('0x2f')]=_[_0x00cd('0x2e')](_0x1b8168['model'],qs[_0x00cd('0x31')](_0x13034e[_0x00cd('0x2b')]['fields']));_0x2fdb9d[_0x00cd('0x2f')]=_0x2fdb9d[_0x00cd('0x2f')][_0x00cd('0x43')]?_0x2fdb9d[_0x00cd('0x2f')]:_0x1b8168[_0x00cd('0x30')];if(_0x13034e[_0x00cd('0x2b')][_0x00cd('0x3c')]){_0x2fdb9d[_0x00cd('0x3d')]=[{'all':!![]}];}_0x2fdb9d=_['merge']({},_0x2fdb9d,_0x13034e[_0x00cd('0x3a')]);return db[_0x00cd('0x3b')][_0x00cd('0x44')](_0x2fdb9d)[_0x00cd('0x23')](handleEntityNotFound(_0x7fa72,null))[_0x00cd('0x23')](respondWithResult(_0x7fa72,null))[_0x00cd('0x40')](handleError(_0x7fa72,null));};exports[_0x00cd('0x45')]=function(_0x18aff4,_0x1c0308){return db[_0x00cd('0x3b')][_0x00cd('0x45')](_0x18aff4[_0x00cd('0x46')],{})[_0x00cd('0x23')](respondWithResult(_0x1c0308,0xc9))[_0x00cd('0x40')](handleError(_0x1c0308,null));};exports[_0x00cd('0x22')]=function(_0x50687c,_0x283773){if(_0x50687c[_0x00cd('0x46')]['id']){delete _0x50687c[_0x00cd('0x46')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x50687c['params']['id']}})[_0x00cd('0x23')](handleEntityNotFound(_0x283773,null))[_0x00cd('0x23')](saveUpdates(_0x50687c[_0x00cd('0x46')],null))[_0x00cd('0x23')](respondWithResult(_0x283773,null))[_0x00cd('0x40')](handleError(_0x283773,null));};exports['destroy']=function(_0x47ebc0,_0x204092){return db[_0x00cd('0x3b')][_0x00cd('0x44')]({'where':{'id':_0x47ebc0[_0x00cd('0x42')]['id']}})[_0x00cd('0x23')](handleEntityNotFound(_0x204092,null))['then'](removeEntity(_0x204092,null))['catch'](handleError(_0x204092,null));}; \ No newline at end of file +var _0x80b1=['end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','params','SquareMessage','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0x80b1,0xc5));var _0x180b=function(_0x466dd0,_0xca4783){_0x466dd0=_0x466dd0-0x0;var _0x4c452a=_0x80b1[_0x466dd0];return _0x4c452a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x180b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x180b('0x1'));var jsonpatch=require(_0x180b('0x2'));var rp=require(_0x180b('0x3'));var moment=require(_0x180b('0x4'));var BPromise=require(_0x180b('0x5'));var Mustache=require(_0x180b('0x6'));var util=require(_0x180b('0x7'));var path=require(_0x180b('0x8'));var sox=require(_0x180b('0x9'));var csv=require(_0x180b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x180b('0xb'));var squel=require('squel');var crypto=require(_0x180b('0xc'));var jsforce=require(_0x180b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x180b('0xe'));var Papa=require(_0x180b('0xf'));var Redis=require(_0x180b('0x10'));var authService=require(_0x180b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x180b('0x12'));var hardwareService=require(_0x180b('0x13'));var logger=require(_0x180b('0x14'))('api');var utils=require(_0x180b('0x15'));var config=require('../../config/environment');var db=require(_0x180b('0x16'))['db'];function respondWithStatusCode(_0x90af1,_0x366d10){_0x366d10=_0x366d10||0xcc;return function(_0x5bfe00){if(_0x5bfe00){return _0x90af1[_0x180b('0x17')](_0x366d10);}return _0x90af1[_0x180b('0x18')](_0x366d10)[_0x180b('0x19')]();};}function respondWithResult(_0x661c8c,_0x3ebd5c){_0x3ebd5c=_0x3ebd5c||0xc8;return function(_0x1f3e69){if(_0x1f3e69){return _0x661c8c['status'](_0x3ebd5c)['json'](_0x1f3e69);}};}function respondWithFilteredResult(_0x332770,_0x1fff4e){return function(_0x1620b3){if(_0x1620b3){var _0x5971d2=_0x1620b3['count'],_0x589ca7=_0x1fff4e[_0x180b('0x1a')],_0x1e6686=_0x1fff4e['offset']+_0x1fff4e[_0x180b('0x1b')],_0x2de686;if(_0x1e6686>=_0x5971d2){_0x1e6686=_0x5971d2;_0x2de686=0xc8;}else{_0x2de686=0xce;}_0x332770[_0x180b('0x18')](_0x2de686);return _0x332770[_0x180b('0x1c')](_0x180b('0x1d'),_0x589ca7+'-'+_0x1e6686+'/'+_0x5971d2)['json'](_0x1620b3);}return null;};}function patchUpdates(_0x4e123b){return function(_0x1f2dae){try{jsonpatch[_0x180b('0x1e')](_0x1f2dae,_0x4e123b,!![]);}catch(_0x1ee25b){return BPromise[_0x180b('0x1f')](_0x1ee25b);}return _0x1f2dae[_0x180b('0x20')]();};}function saveUpdates(_0x139592,_0x6415de){return function(_0x10274a){if(_0x10274a){return _0x10274a[_0x180b('0x21')](_0x139592)[_0x180b('0x22')](function(_0x35f968){return _0x35f968;});}return null;};}function removeEntity(_0x53eac1,_0x5dc85c){return function(_0x51c284){if(_0x51c284){return _0x51c284[_0x180b('0x23')]()[_0x180b('0x22')](function(){_0x53eac1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d30bd,_0x2370ae){return function(_0x9dee82){if(!_0x9dee82){_0x5d30bd[_0x180b('0x17')](0x194);}return _0x9dee82;};}function handleError(_0x415fe0,_0x2700ce){_0x2700ce=_0x2700ce||0x1f4;return function(_0x2dcbb4){logger[_0x180b('0x24')](_0x2dcbb4[_0x180b('0x25')]);if(_0x2dcbb4[_0x180b('0x26')]){delete _0x2dcbb4[_0x180b('0x26')];}_0x415fe0[_0x180b('0x18')](_0x2700ce)[_0x180b('0x27')](_0x2dcbb4);};}exports[_0x180b('0x28')]=function(_0x41446d,_0x90a01e){var _0x5c735c={},_0x4d6fe6={},_0x111e90={'count':0x0,'rows':[]};var _0x4b6c72=_[_0x180b('0x29')](db['SquareMessage'][_0x180b('0x2a')],function(_0x44e2b0){return{'name':_0x44e2b0[_0x180b('0x2b')],'type':_0x44e2b0['type'][_0x180b('0x2c')]};});_0x4d6fe6[_0x180b('0x2d')]=_[_0x180b('0x29')](_0x4b6c72,'name');_0x4d6fe6[_0x180b('0x2e')]=_[_0x180b('0x2f')](_0x41446d[_0x180b('0x2e')]);_0x4d6fe6[_0x180b('0x30')]=_[_0x180b('0x31')](_0x4d6fe6['model'],_0x4d6fe6[_0x180b('0x2e')]);_0x5c735c['attributes']=_[_0x180b('0x31')](_0x4d6fe6[_0x180b('0x2d')],qs[_0x180b('0x32')](_0x41446d[_0x180b('0x2e')][_0x180b('0x32')]));_0x5c735c[_0x180b('0x33')]=_0x5c735c[_0x180b('0x33')][_0x180b('0x34')]?_0x5c735c['attributes']:_0x4d6fe6[_0x180b('0x2d')];if(!_0x41446d[_0x180b('0x2e')][_0x180b('0x35')](_0x180b('0x36'))){_0x5c735c[_0x180b('0x1b')]=qs[_0x180b('0x1b')](_0x41446d['query']['limit']);_0x5c735c[_0x180b('0x1a')]=qs[_0x180b('0x1a')](_0x41446d[_0x180b('0x2e')][_0x180b('0x1a')]);}_0x5c735c[_0x180b('0x37')]=qs[_0x180b('0x38')](_0x41446d[_0x180b('0x2e')][_0x180b('0x38')]);_0x5c735c['where']=qs[_0x180b('0x30')](_[_0x180b('0x39')](_0x41446d[_0x180b('0x2e')],_0x4d6fe6[_0x180b('0x30')]),_0x4b6c72);if(_0x41446d['query']['filter']){_0x5c735c[_0x180b('0x3a')]=_[_0x180b('0x3b')](_0x5c735c['where'],{'$or':_['map'](_0x4b6c72,function(_0x3a9f2f){if(_0x3a9f2f[_0x180b('0x3c')]!==_0x180b('0x3d')){var _0x48b0c9={};_0x48b0c9[_0x3a9f2f[_0x180b('0x26')]]={'$like':'%'+_0x41446d['query'][_0x180b('0x3e')]+'%'};return _0x48b0c9;}})});}_0x5c735c=_[_0x180b('0x3b')]({},_0x5c735c,_0x41446d[_0x180b('0x3f')]);var _0x4cea01={'where':_0x5c735c[_0x180b('0x3a')]};return db['SquareMessage'][_0x180b('0x40')](_0x4cea01)[_0x180b('0x22')](function(_0x4d4227){_0x111e90[_0x180b('0x40')]=_0x4d4227;if(_0x41446d[_0x180b('0x2e')][_0x180b('0x41')]){_0x5c735c[_0x180b('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x180b('0x43')](_0x5c735c);})['then'](function(_0x202293){_0x111e90['rows']=_0x202293;return _0x111e90;})[_0x180b('0x22')](respondWithFilteredResult(_0x90a01e,_0x5c735c))[_0x180b('0x44')](handleError(_0x90a01e,null));};exports['show']=function(_0x174605,_0x4ca008){var _0x412c4a={'raw':!![],'where':{'id':_0x174605[_0x180b('0x45')]['id']}},_0x1a1c47={};_0x1a1c47[_0x180b('0x2d')]=_[_0x180b('0x2f')](db[_0x180b('0x46')][_0x180b('0x2a')]);_0x1a1c47[_0x180b('0x2e')]=_['keys'](_0x174605[_0x180b('0x2e')]);_0x1a1c47[_0x180b('0x30')]=_[_0x180b('0x31')](_0x1a1c47['model'],_0x1a1c47[_0x180b('0x2e')]);_0x412c4a['attributes']=_[_0x180b('0x31')](_0x1a1c47[_0x180b('0x2d')],qs[_0x180b('0x32')](_0x174605[_0x180b('0x2e')][_0x180b('0x32')]));_0x412c4a['attributes']=_0x412c4a[_0x180b('0x33')][_0x180b('0x34')]?_0x412c4a[_0x180b('0x33')]:_0x1a1c47['model'];if(_0x174605[_0x180b('0x2e')]['includeAll']){_0x412c4a['include']=[{'all':!![]}];}_0x412c4a=_['merge']({},_0x412c4a,_0x174605[_0x180b('0x3f')]);return db[_0x180b('0x46')][_0x180b('0x47')](_0x412c4a)[_0x180b('0x22')](handleEntityNotFound(_0x4ca008,null))['then'](respondWithResult(_0x4ca008,null))['catch'](handleError(_0x4ca008,null));};exports[_0x180b('0x48')]=function(_0x18af4d,_0x1cc8b4){return db[_0x180b('0x46')][_0x180b('0x48')](_0x18af4d['body'],{})[_0x180b('0x22')](respondWithResult(_0x1cc8b4,0xc9))['catch'](handleError(_0x1cc8b4,null));};exports[_0x180b('0x21')]=function(_0x110c7a,_0xad17da){if(_0x110c7a['body']['id']){delete _0x110c7a[_0x180b('0x49')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x110c7a[_0x180b('0x45')]['id']}})[_0x180b('0x22')](handleEntityNotFound(_0xad17da,null))[_0x180b('0x22')](saveUpdates(_0x110c7a[_0x180b('0x49')],null))[_0x180b('0x22')](respondWithResult(_0xad17da,null))['catch'](handleError(_0xad17da,null));};exports[_0x180b('0x23')]=function(_0x23abf0,_0x51ad1e){return db[_0x180b('0x46')][_0x180b('0x47')]({'where':{'id':_0x23abf0[_0x180b('0x45')]['id']}})[_0x180b('0x22')](handleEntityNotFound(_0x51ad1e,null))['then'](removeEntity(_0x51ad1e,null))[_0x180b('0x44')](handleError(_0x51ad1e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9c4bdca..bdbe74c 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 _0x814b=['define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x14b8ab,_0x382dc0){var _0x34b6e1=function(_0x495de3){while(--_0x495de3){_0x14b8ab['push'](_0x14b8ab['shift']());}};_0x34b6e1(++_0x382dc0);}(_0x814b,0x1a2));var _0xb814=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x814b[_0x360739];return _0x3e23a1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./squareMessage.attributes','define','square_messages','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4de3fe,_0x5dc460){var _0x3759eb=function(_0x504572){while(--_0x504572){_0x4de3fe['push'](_0x4de3fe['shift']());}};_0x3759eb(++_0x5dc460);}(_0x31f0,0xb7));var _0x031f=function(_0x33a5b8,_0x3fb2eb){_0x33a5b8=_0x33a5b8-0x0;var _0x26985e=_0x31f0[_0x33a5b8];return _0x26985e;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('SquareMessage',attributes,{'tableName':_0x031f('0x9'),'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 9c6773e..a087e0d 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 _0x46ed=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','create','body','options','raw','CreateSquareMessage','catch','lodash','util','bluebird','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x46ed,0x168));var _0xd46e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x46ed[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('SquareMessage,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});}exports['CreateSquareMessage']=function(_0x5ddd04){var _0x2e8f6d=this;return new Promise(function(_0x1bd574,_0x488690){return db['SquareMessage'][_0xd46e('0x16')](_0x5ddd04[_0xd46e('0x17')],{'raw':_0x5ddd04[_0xd46e('0x18')]?_0x5ddd04[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![]})[_0xd46e('0xc')](function(_0x3b5fa4){logger[_0xd46e('0xd')](_0xd46e('0x1a'),_0x5ddd04);logger[_0xd46e('0xf')](_0xd46e('0x1a'),_0x5ddd04,JSON['stringify'](_0x3b5fa4));_0x1bd574(_0x3b5fa4);})[_0xd46e('0x1b')](function(_0x1c83fa){logger[_0xd46e('0x13')](_0xd46e('0x1a'),_0x1c83fa[_0xd46e('0x14')],_0x5ddd04);_0x488690(_0x2e8f6d[_0xd46e('0x13')](0x1f4,_0x1c83fa[_0xd46e('0x14')]));});});}; \ No newline at end of file +var _0x27a0=['moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateSquareMessage','SquareMessage','options','raw','catch','util'];(function(_0x1fbf00,_0x13db44){var _0x32b3e9=function(_0x5a941d){while(--_0x5a941d){_0x1fbf00['push'](_0x1fbf00['shift']());}};_0x32b3e9(++_0x13db44);}(_0x27a0,0xbf));var _0x027a=function(_0x4578fc,_0x43756c){_0x4578fc=_0x4578fc-0x0;var _0xbe02f4=_0x27a0[_0x4578fc];return _0xbe02f4;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var moment=require(_0x027a('0x1'));var BPromise=require(_0x027a('0x2'));var rs=require(_0x027a('0x3'));var fs=require('fs');var Redis=require(_0x027a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x027a('0x5'));var jayson=require(_0x027a('0x6'));var client=jayson[_0x027a('0x7')][_0x027a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe233ed,_0x3c7d67,_0x550fbb){return new BPromise(function(_0x3d1429,_0x271dfe){return client[_0x027a('0x9')](_0xe233ed,_0x550fbb)['then'](function(_0x44c56a){logger[_0x027a('0xa')](_0x027a('0xb'),_0x3c7d67,'request\x20sent');logger[_0x027a('0xc')](_0x027a('0xd'),_0x3c7d67,_0x027a('0xe'),JSON[_0x027a('0xf')](_0x44c56a));if(_0x44c56a[_0x027a('0x10')]){if(_0x44c56a[_0x027a('0x10')][_0x027a('0x11')]===0x1f4){logger[_0x027a('0x10')](_0x027a('0xb'),_0x3c7d67,_0x44c56a[_0x027a('0x10')][_0x027a('0x12')]);return _0x271dfe(_0x44c56a['error'][_0x027a('0x12')]);}logger[_0x027a('0x10')](_0x027a('0xb'),_0x3c7d67,_0x44c56a[_0x027a('0x10')][_0x027a('0x12')]);return _0x3d1429(_0x44c56a['error']['message']);}else{logger[_0x027a('0xa')]('SquareMessage,\x20%s,\x20%s',_0x3c7d67,_0x027a('0xe'));_0x3d1429(_0x44c56a['result'][_0x027a('0x12')]);}})['catch'](function(_0x4dc3ab){logger['error'](_0x027a('0xb'),_0x3c7d67,_0x4dc3ab);_0x271dfe(_0x4dc3ab);});});}exports[_0x027a('0x13')]=function(_0x826d19){var _0x1fb40b=this;return new Promise(function(_0x52125e,_0x282e70){return db[_0x027a('0x14')]['create'](_0x826d19['body'],{'raw':_0x826d19[_0x027a('0x15')]?_0x826d19['options'][_0x027a('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x59511c){logger['info']('CreateSquareMessage',_0x826d19);logger[_0x027a('0xc')](_0x027a('0x13'),_0x826d19,JSON[_0x027a('0xf')](_0x59511c));_0x52125e(_0x59511c);})[_0x027a('0x17')](function(_0x51b870){logger[_0x027a('0x10')](_0x027a('0x13'),_0x51b870[_0x027a('0x12')],_0x826d19);_0x282e70(_0x1fb40b[_0x027a('0x10')](0x1f4,_0x51b870[_0x027a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index bbdab5f..36af315 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 _0x7e35=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','post','update','delete'];(function(_0x380d79,_0x316022){var _0x45116d=function(_0x38ebcc){while(--_0x38ebcc){_0x380d79['push'](_0x380d79['shift']());}};_0x45116d(++_0x316022);}(_0x7e35,0xc9));var _0x57e3=function(_0x21e1eb,_0x3f0a9e){_0x21e1eb=_0x21e1eb-0x0;var _0x4f1206=_0x7e35[_0x21e1eb];return _0x4f1206;};'use strict';var multer=require(_0x57e3('0x0'));var util=require(_0x57e3('0x1'));var path=require(_0x57e3('0x2'));var timeout=require(_0x57e3('0x3'));var express=require(_0x57e3('0x4'));var router=express[_0x57e3('0x5')]();var auth=require(_0x57e3('0x6'));var interaction=require(_0x57e3('0x7'));var config=require(_0x57e3('0x8'));var controller=require(_0x57e3('0x9'));router[_0x57e3('0xa')]('/',auth[_0x57e3('0xb')](),controller['index']);router[_0x57e3('0xa')](_0x57e3('0xc'),auth[_0x57e3('0xb')](),controller[_0x57e3('0xd')]);router['get'](_0x57e3('0xe'),auth[_0x57e3('0xb')](),timeout(_0x57e3('0xf')),controller['test']);router[_0x57e3('0x10')]('/',auth[_0x57e3('0xb')](),controller['create']);router['put'](_0x57e3('0xc'),auth[_0x57e3('0xb')](),controller[_0x57e3('0x11')]);router[_0x57e3('0x12')](_0x57e3('0xc'),auth[_0x57e3('0xb')](),controller[_0x57e3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3e25=['../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x43666b,_0x36e883){var _0x4a0f79=function(_0x5a9ae9){while(--_0x5a9ae9){_0x43666b['push'](_0x43666b['shift']());}};_0x4a0f79(++_0x36e883);}(_0x3e25,0x14f));var _0x53e2=function(_0x33748e,_0x60cf5){_0x33748e=_0x33748e-0x0;var _0x3383bd=_0x3e25[_0x33748e];return _0x3383bd;};'use strict';var multer=require(_0x53e2('0x0'));var util=require(_0x53e2('0x1'));var path=require(_0x53e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x53e2('0x3'));var router=express['Router']();var auth=require(_0x53e2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53e2('0x5'));var controller=require(_0x53e2('0x6'));router[_0x53e2('0x7')]('/',auth[_0x53e2('0x8')](),controller[_0x53e2('0x9')]);router[_0x53e2('0x7')](_0x53e2('0xa'),auth[_0x53e2('0x8')](),controller[_0x53e2('0xb')]);router[_0x53e2('0x7')](_0x53e2('0xc'),auth[_0x53e2('0x8')](),timeout(_0x53e2('0xd')),controller[_0x53e2('0xe')]);router[_0x53e2('0xf')]('/',auth[_0x53e2('0x8')](),controller[_0x53e2('0x10')]);router[_0x53e2('0x11')]('/:id',auth[_0x53e2('0x8')](),controller['update']);router['delete']('/:id',auth[_0x53e2('0x8')](),controller[_0x53e2('0x12')]);module[_0x53e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 7c85aea..85502af 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 _0xabb3=['sequelize','exports','STRING'];(function(_0x48cc0e,_0x22d4ed){var _0x1144e6=function(_0x55b224){while(--_0x55b224){_0x48cc0e['push'](_0x48cc0e['shift']());}};_0x1144e6(++_0x22d4ed);}(_0xabb3,0xe1));var _0x3abb=function(_0x35d823,_0x212793){_0x35d823=_0x35d823-0x0;var _0x518ac5=_0xabb3[_0x35d823];return _0x518ac5;};'use strict';var Sequelize=require(_0x3abb('0x0'));module[_0x3abb('0x1')]={'name':{'type':Sequelize[_0x3abb('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3abb('0x2')]}}; \ No newline at end of file +var _0x3b4a=['name','sequelize','exports','STRING'];(function(_0x4ae874,_0x33b4e2){var _0x4156f7=function(_0x3b6e22){while(--_0x3b6e22){_0x4ae874['push'](_0x4ae874['shift']());}};_0x4156f7(++_0x33b4e2);}(_0x3b4a,0x105));var _0xa3b4=function(_0x53bef4,_0x3faddf){_0x53bef4=_0x53bef4-0x0;var _0xc5c4f0=_0x3b4a[_0x53bef4];return _0xc5c4f0;};'use strict';var Sequelize=require(_0xa3b4('0x0'));module[_0xa3b4('0x1')]={'name':{'type':Sequelize[_0xa3b4('0x2')],'unique':_0xa3b4('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa3b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index cd46741..b0d7919 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 _0x7a23=['send','index','map','SquareOdbc','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','dsn','openSync','closeSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name'];(function(_0x26e6fb,_0x3551ca){var _0x10fde8=function(_0x592948){while(--_0x592948){_0x26e6fb['push'](_0x26e6fb['shift']());}};_0x10fde8(++_0x3551ca);}(_0x7a23,0xd2));var _0x37a2=function(_0x5bc59a,_0x397c97){_0x5bc59a=_0x5bc59a-0x0;var _0x3d5447=_0x7a23[_0x5bc59a];return _0x3d5447;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x37a2('0x0'));var jsonpatch=require(_0x37a2('0x1'));var rp=require(_0x37a2('0x2'));var moment=require(_0x37a2('0x3'));var BPromise=require(_0x37a2('0x4'));var Mustache=require(_0x37a2('0x5'));var util=require(_0x37a2('0x6'));var path=require(_0x37a2('0x7'));var sox=require(_0x37a2('0x8'));var csv=require(_0x37a2('0x9'));var ejs=require(_0x37a2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x37a2('0xb'));var crypto=require('crypto');var jsforce=require(_0x37a2('0xc'));var deskjs=require(_0x37a2('0xd'));var toCsv=require(_0x37a2('0x9'));var querystring=require(_0x37a2('0xe'));var Papa=require('papaparse');var Redis=require(_0x37a2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x37a2('0x10'));var hardwareService=require(_0x37a2('0x11'));var logger=require(_0x37a2('0x12'))(_0x37a2('0x13'));var utils=require(_0x37a2('0x14'));var config=require(_0x37a2('0x15'));var db=require(_0x37a2('0x16'))['db'];function respondWithStatusCode(_0x2307dd,_0x542222){_0x542222=_0x542222||0xcc;return function(_0x21d560){if(_0x21d560){return _0x2307dd[_0x37a2('0x17')](_0x542222);}return _0x2307dd[_0x37a2('0x18')](_0x542222)[_0x37a2('0x19')]();};}function respondWithResult(_0x3e6992,_0x3b61c2){_0x3b61c2=_0x3b61c2||0xc8;return function(_0x236411){if(_0x236411){return _0x3e6992['status'](_0x3b61c2)[_0x37a2('0x1a')](_0x236411);}};}function respondWithFilteredResult(_0x3f7032,_0x2e4baa){return function(_0x4b2d51){if(_0x4b2d51){var _0x25be47=_0x4b2d51[_0x37a2('0x1b')],_0x3d6e71=_0x2e4baa['offset'],_0x123589=_0x2e4baa['offset']+_0x2e4baa[_0x37a2('0x1c')],_0x383b4c;if(_0x123589>=_0x25be47){_0x123589=_0x25be47;_0x383b4c=0xc8;}else{_0x383b4c=0xce;}_0x3f7032[_0x37a2('0x18')](_0x383b4c);return _0x3f7032[_0x37a2('0x1d')](_0x37a2('0x1e'),_0x3d6e71+'-'+_0x123589+'/'+_0x25be47)[_0x37a2('0x1a')](_0x4b2d51);}return null;};}function patchUpdates(_0x2fa319){return function(_0x18c94c){try{jsonpatch[_0x37a2('0x1f')](_0x18c94c,_0x2fa319,!![]);}catch(_0xd38f1){return BPromise[_0x37a2('0x20')](_0xd38f1);}return _0x18c94c[_0x37a2('0x21')]();};}function saveUpdates(_0x132384,_0x4dcace){return function(_0x2c9894){if(_0x2c9894){return _0x2c9894['update'](_0x132384)[_0x37a2('0x22')](function(_0x4072ae){return _0x4072ae;});}return null;};}function removeEntity(_0x35713c,_0x18cecd){return function(_0x2d9f36){if(_0x2d9f36){return _0x2d9f36[_0x37a2('0x23')]()['then'](function(){var _0x52fe21=_0x2d9f36[_0x37a2('0x24')]({'plain':!![]});var _0x2722aa=_0x37a2('0x25');return db[_0x37a2('0x26')]['destroy']({'where':{'type':_0x2722aa,'resourceId':_0x52fe21['id']}})[_0x37a2('0x22')](function(){return _0x2d9f36;});})[_0x37a2('0x22')](function(){_0x35713c[_0x37a2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x566107,_0xfa915c){return function(_0x3d831b){if(!_0x3d831b){_0x566107['sendStatus'](0x194);}return _0x3d831b;};}function handleError(_0x241f29,_0x3b1d86){_0x3b1d86=_0x3b1d86||0x1f4;return function(_0xb33e7d){logger[_0x37a2('0x27')](_0xb33e7d[_0x37a2('0x28')]);if(_0xb33e7d['name']){delete _0xb33e7d[_0x37a2('0x29')];}_0x241f29[_0x37a2('0x18')](_0x3b1d86)[_0x37a2('0x2a')](_0xb33e7d);};}exports[_0x37a2('0x2b')]=function(_0x42987a,_0x15ee1c){var _0x36cf1b={},_0x35d400={},_0x25b2e1={'count':0x0,'rows':[]};var _0x7e62e5=_[_0x37a2('0x2c')](db[_0x37a2('0x2d')][_0x37a2('0x2e')],function(_0x44bfd4){return{'name':_0x44bfd4['fieldName'],'type':_0x44bfd4['type'][_0x37a2('0x2f')]};});_0x35d400[_0x37a2('0x30')]=_[_0x37a2('0x2c')](_0x7e62e5,_0x37a2('0x29'));_0x35d400[_0x37a2('0x31')]=_['keys'](_0x42987a[_0x37a2('0x31')]);_0x35d400[_0x37a2('0x32')]=_[_0x37a2('0x33')](_0x35d400[_0x37a2('0x30')],_0x35d400['query']);_0x36cf1b[_0x37a2('0x34')]=_['intersection'](_0x35d400[_0x37a2('0x30')],qs[_0x37a2('0x35')](_0x42987a[_0x37a2('0x31')][_0x37a2('0x35')]));_0x36cf1b[_0x37a2('0x34')]=_0x36cf1b[_0x37a2('0x34')][_0x37a2('0x36')]?_0x36cf1b[_0x37a2('0x34')]:_0x35d400[_0x37a2('0x30')];if(!_0x42987a['query'][_0x37a2('0x37')]('nolimit')){_0x36cf1b[_0x37a2('0x1c')]=qs[_0x37a2('0x1c')](_0x42987a[_0x37a2('0x31')][_0x37a2('0x1c')]);_0x36cf1b[_0x37a2('0x38')]=qs[_0x37a2('0x38')](_0x42987a['query']['offset']);}_0x36cf1b[_0x37a2('0x39')]=qs['sort'](_0x42987a[_0x37a2('0x31')][_0x37a2('0x3a')]);_0x36cf1b[_0x37a2('0x3b')]=qs[_0x37a2('0x32')](_[_0x37a2('0x3c')](_0x42987a[_0x37a2('0x31')],_0x35d400['filters']),_0x7e62e5);if(_0x42987a['query']['filter']){_0x36cf1b[_0x37a2('0x3b')]=_['merge'](_0x36cf1b[_0x37a2('0x3b')],{'$or':_['map'](_0x7e62e5,function(_0x1d9db9){if(_0x1d9db9[_0x37a2('0x3d')]!=='VIRTUAL'){var _0xa07fc8={};_0xa07fc8[_0x1d9db9[_0x37a2('0x29')]]={'$like':'%'+_0x42987a['query'][_0x37a2('0x3e')]+'%'};return _0xa07fc8;}})});}_0x36cf1b=_[_0x37a2('0x3f')]({},_0x36cf1b,_0x42987a[_0x37a2('0x40')]);var _0x903e98={'where':_0x36cf1b[_0x37a2('0x3b')]};return db[_0x37a2('0x2d')][_0x37a2('0x1b')](_0x903e98)[_0x37a2('0x22')](function(_0x46a351){_0x25b2e1[_0x37a2('0x1b')]=_0x46a351;if(_0x42987a[_0x37a2('0x31')][_0x37a2('0x41')]){_0x36cf1b[_0x37a2('0x42')]=[{'all':!![]}];}return db[_0x37a2('0x2d')][_0x37a2('0x43')](_0x36cf1b);})['then'](function(_0x504f33){_0x25b2e1[_0x37a2('0x44')]=_0x504f33;return _0x25b2e1;})[_0x37a2('0x22')](respondWithFilteredResult(_0x15ee1c,_0x36cf1b))[_0x37a2('0x45')](handleError(_0x15ee1c,null));};exports['show']=function(_0x231973,_0x381ae5){var _0x8744df={'raw':!![],'where':{'id':_0x231973[_0x37a2('0x46')]['id']}},_0x550a61={};_0x550a61['model']=_[_0x37a2('0x47')](db[_0x37a2('0x2d')][_0x37a2('0x2e')]);_0x550a61[_0x37a2('0x31')]=_[_0x37a2('0x47')](_0x231973[_0x37a2('0x31')]);_0x550a61['filters']=_[_0x37a2('0x33')](_0x550a61['model'],_0x550a61[_0x37a2('0x31')]);_0x8744df['attributes']=_[_0x37a2('0x33')](_0x550a61[_0x37a2('0x30')],qs[_0x37a2('0x35')](_0x231973[_0x37a2('0x31')]['fields']));_0x8744df[_0x37a2('0x34')]=_0x8744df[_0x37a2('0x34')][_0x37a2('0x36')]?_0x8744df['attributes']:_0x550a61[_0x37a2('0x30')];if(_0x231973[_0x37a2('0x31')]['includeAll']){_0x8744df[_0x37a2('0x42')]=[{'all':!![]}];}_0x8744df=_[_0x37a2('0x3f')]({},_0x8744df,_0x231973['options']);return db['SquareOdbc'][_0x37a2('0x48')](_0x8744df)[_0x37a2('0x22')](handleEntityNotFound(_0x381ae5,null))['then'](respondWithResult(_0x381ae5,null))[_0x37a2('0x45')](handleError(_0x381ae5,null));};exports[_0x37a2('0x49')]=function(_0x25d85b,_0x4055f5){return db[_0x37a2('0x2d')]['create'](_0x25d85b['body'],{})[_0x37a2('0x22')](function(_0x40a9c6){var _0x57f97f=_0x25d85b['user'][_0x37a2('0x24')]({'plain':!![]});if(!_0x57f97f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57f97f[_0x37a2('0x4a')]===_0x37a2('0x4b')){var _0x117a91=_0x40a9c6[_0x37a2('0x24')]({'plain':!![]});var _0xa21c23=_0x37a2('0x25');return db[_0x37a2('0x4c')][_0x37a2('0x48')]({'where':{'name':_0xa21c23,'userProfileId':_0x57f97f[_0x37a2('0x4d')]},'raw':!![]})[_0x37a2('0x22')](function(_0x39490c){if(_0x39490c&&_0x39490c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x117a91[_0x37a2('0x29')],'resourceId':_0x117a91['id'],'type':_0x39490c[_0x37a2('0x29')],'sectionId':_0x39490c['id']},{})[_0x37a2('0x22')](function(){return _0x40a9c6;});}else{return _0x40a9c6;}})[_0x37a2('0x45')](function(_0x3c1e22){logger[_0x37a2('0x27')](_0x37a2('0x4e'),_0x3c1e22);throw _0x3c1e22;});}return _0x40a9c6;})[_0x37a2('0x22')](respondWithResult(_0x4055f5,0xc9))[_0x37a2('0x45')](handleError(_0x4055f5,null));};exports[_0x37a2('0x4f')]=function(_0x248780,_0x313e13){if(_0x248780[_0x37a2('0x50')]['id']){delete _0x248780[_0x37a2('0x50')]['id'];}return db[_0x37a2('0x2d')][_0x37a2('0x48')]({'where':{'id':_0x248780[_0x37a2('0x46')]['id']}})[_0x37a2('0x22')](handleEntityNotFound(_0x313e13,null))['then'](saveUpdates(_0x248780[_0x37a2('0x50')],null))['then'](respondWithResult(_0x313e13,null))['catch'](handleError(_0x313e13,null));};exports[_0x37a2('0x23')]=function(_0x417d34,_0x181fa6){return db[_0x37a2('0x2d')][_0x37a2('0x48')]({'where':{'id':_0x417d34[_0x37a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x181fa6,null))[_0x37a2('0x22')](removeEntity(_0x181fa6,null))[_0x37a2('0x45')](handleError(_0x181fa6,null));};exports['test']=function(_0x54df88,_0x165bda,_0x32798a){var _0x2e2705;return db['SquareOdbc'][_0x37a2('0x48')]({'where':{'id':_0x54df88[_0x37a2('0x46')]['id']},'attributes':['id',_0x37a2('0x51')]})['then'](handleEntityNotFound(_0x165bda,null))[_0x37a2('0x22')](function(_0x4b1e21){if(_0x4b1e21){var _0x5c0db7=require('odbc')();_0x5c0db7[_0x37a2('0x52')](_0x4b1e21[_0x37a2('0x51')]);_0x5c0db7[_0x37a2('0x53')]();return _0x4b1e21;}})[_0x37a2('0x22')](respondWithResult(_0x165bda,null))[_0x37a2('0x45')](handleError(_0x165bda,null));}; \ No newline at end of file +var _0xbf5c=['ioredis','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','send','map','SquareOdbc','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse'];(function(_0x23a173,_0x4c4dbf){var _0x2b80cd=function(_0x250d54){while(--_0x250d54){_0x23a173['push'](_0x23a173['shift']());}};_0x2b80cd(++_0x4c4dbf);}(_0xbf5c,0xf2));var _0xcbf5=function(_0x4b60c8,_0x39577c){_0x4b60c8=_0x4b60c8-0x0;var _0x23036f=_0xbf5c[_0x4b60c8];return _0x23036f;};'use strict';var pdf=require(_0xcbf5('0x0'));var emlformat=require(_0xcbf5('0x1'));var rimraf=require(_0xcbf5('0x2'));var zipdir=require(_0xcbf5('0x3'));var jsonpatch=require(_0xcbf5('0x4'));var rp=require(_0xcbf5('0x5'));var moment=require(_0xcbf5('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xcbf5('0x7'));var util=require('util');var path=require(_0xcbf5('0x8'));var sox=require(_0xcbf5('0x9'));var csv=require(_0xcbf5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcbf5('0xb'));var squel=require('squel');var crypto=require(_0xcbf5('0xc'));var jsforce=require(_0xcbf5('0xd'));var deskjs=require(_0xcbf5('0xe'));var toCsv=require(_0xcbf5('0xa'));var querystring=require('querystring');var Papa=require(_0xcbf5('0xf'));var Redis=require(_0xcbf5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcbf5('0x11'));var logger=require(_0xcbf5('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcbf5('0x13'))['db'];function respondWithStatusCode(_0x2aa5d1,_0x1228f7){_0x1228f7=_0x1228f7||0xcc;return function(_0xf87311){if(_0xf87311){return _0x2aa5d1[_0xcbf5('0x14')](_0x1228f7);}return _0x2aa5d1[_0xcbf5('0x15')](_0x1228f7)[_0xcbf5('0x16')]();};}function respondWithResult(_0x1c36ab,_0x1e80f1){_0x1e80f1=_0x1e80f1||0xc8;return function(_0x2ed848){if(_0x2ed848){return _0x1c36ab['status'](_0x1e80f1)['json'](_0x2ed848);}};}function respondWithFilteredResult(_0x25f3e6,_0xa03917){return function(_0x436f7f){if(_0x436f7f){var _0x181fb0=_0x436f7f[_0xcbf5('0x17')],_0x4b9da8=_0xa03917[_0xcbf5('0x18')],_0x23dd15=_0xa03917[_0xcbf5('0x18')]+_0xa03917[_0xcbf5('0x19')],_0x4cad9b;if(_0x23dd15>=_0x181fb0){_0x23dd15=_0x181fb0;_0x4cad9b=0xc8;}else{_0x4cad9b=0xce;}_0x25f3e6['status'](_0x4cad9b);return _0x25f3e6[_0xcbf5('0x1a')](_0xcbf5('0x1b'),_0x4b9da8+'-'+_0x23dd15+'/'+_0x181fb0)[_0xcbf5('0x1c')](_0x436f7f);}return null;};}function patchUpdates(_0x3a4a00){return function(_0x264b9d){try{jsonpatch[_0xcbf5('0x1d')](_0x264b9d,_0x3a4a00,!![]);}catch(_0x45df05){return BPromise['reject'](_0x45df05);}return _0x264b9d[_0xcbf5('0x1e')]();};}function saveUpdates(_0x52071d,_0x40e7e7){return function(_0x27c12d){if(_0x27c12d){return _0x27c12d[_0xcbf5('0x1f')](_0x52071d)[_0xcbf5('0x20')](function(_0x8e62b0){return _0x8e62b0;});}return null;};}function removeEntity(_0x305ecf,_0x3487e5){return function(_0x6a2567){if(_0x6a2567){return _0x6a2567[_0xcbf5('0x21')]()[_0xcbf5('0x20')](function(){var _0x3ad5b9=_0x6a2567[_0xcbf5('0x22')]({'plain':!![]});var _0x5705d8=_0xcbf5('0x23');return db[_0xcbf5('0x24')][_0xcbf5('0x21')]({'where':{'type':_0x5705d8,'resourceId':_0x3ad5b9['id']}})[_0xcbf5('0x20')](function(){return _0x6a2567;});})[_0xcbf5('0x20')](function(){_0x305ecf['status'](0xcc)[_0xcbf5('0x16')]();});}};}function handleEntityNotFound(_0x3ab67b,_0x472f7a){return function(_0x37c5ff){if(!_0x37c5ff){_0x3ab67b[_0xcbf5('0x14')](0x194);}return _0x37c5ff;};}function handleError(_0x49b016,_0x57ddd4){_0x57ddd4=_0x57ddd4||0x1f4;return function(_0x1b8bec){logger[_0xcbf5('0x25')](_0x1b8bec[_0xcbf5('0x26')]);if(_0x1b8bec['name']){delete _0x1b8bec['name'];}_0x49b016[_0xcbf5('0x15')](_0x57ddd4)[_0xcbf5('0x27')](_0x1b8bec);};}exports['index']=function(_0xe257d4,_0x6de7b){var _0x10b5ca={},_0xf8fc5e={},_0x583183={'count':0x0,'rows':[]};var _0x26f2d0=_[_0xcbf5('0x28')](db[_0xcbf5('0x29')]['rawAttributes'],function(_0x39a291){return{'name':_0x39a291[_0xcbf5('0x2a')],'type':_0x39a291[_0xcbf5('0x2b')][_0xcbf5('0x2c')]};});_0xf8fc5e[_0xcbf5('0x2d')]=_[_0xcbf5('0x28')](_0x26f2d0,_0xcbf5('0x2e'));_0xf8fc5e[_0xcbf5('0x2f')]=_[_0xcbf5('0x30')](_0xe257d4[_0xcbf5('0x2f')]);_0xf8fc5e[_0xcbf5('0x31')]=_[_0xcbf5('0x32')](_0xf8fc5e[_0xcbf5('0x2d')],_0xf8fc5e[_0xcbf5('0x2f')]);_0x10b5ca[_0xcbf5('0x33')]=_['intersection'](_0xf8fc5e[_0xcbf5('0x2d')],qs['fields'](_0xe257d4['query']['fields']));_0x10b5ca[_0xcbf5('0x33')]=_0x10b5ca[_0xcbf5('0x33')][_0xcbf5('0x34')]?_0x10b5ca['attributes']:_0xf8fc5e[_0xcbf5('0x2d')];if(!_0xe257d4[_0xcbf5('0x2f')][_0xcbf5('0x35')](_0xcbf5('0x36'))){_0x10b5ca[_0xcbf5('0x19')]=qs[_0xcbf5('0x19')](_0xe257d4['query'][_0xcbf5('0x19')]);_0x10b5ca[_0xcbf5('0x18')]=qs[_0xcbf5('0x18')](_0xe257d4[_0xcbf5('0x2f')]['offset']);}_0x10b5ca[_0xcbf5('0x37')]=qs['sort'](_0xe257d4[_0xcbf5('0x2f')][_0xcbf5('0x38')]);_0x10b5ca[_0xcbf5('0x39')]=qs[_0xcbf5('0x31')](_[_0xcbf5('0x3a')](_0xe257d4[_0xcbf5('0x2f')],_0xf8fc5e['filters']),_0x26f2d0);if(_0xe257d4['query']['filter']){_0x10b5ca[_0xcbf5('0x39')]=_[_0xcbf5('0x3b')](_0x10b5ca['where'],{'$or':_[_0xcbf5('0x28')](_0x26f2d0,function(_0x1dae8a){if(_0x1dae8a['type']!==_0xcbf5('0x3c')){var _0xb25bc={};_0xb25bc[_0x1dae8a[_0xcbf5('0x2e')]]={'$like':'%'+_0xe257d4[_0xcbf5('0x2f')][_0xcbf5('0x3d')]+'%'};return _0xb25bc;}})});}_0x10b5ca=_[_0xcbf5('0x3b')]({},_0x10b5ca,_0xe257d4[_0xcbf5('0x3e')]);var _0x31c85c={'where':_0x10b5ca[_0xcbf5('0x39')]};return db[_0xcbf5('0x29')]['count'](_0x31c85c)['then'](function(_0x1a6071){_0x583183[_0xcbf5('0x17')]=_0x1a6071;if(_0xe257d4[_0xcbf5('0x2f')][_0xcbf5('0x3f')]){_0x10b5ca[_0xcbf5('0x40')]=[{'all':!![]}];}return db[_0xcbf5('0x29')][_0xcbf5('0x41')](_0x10b5ca);})['then'](function(_0x2de14a){_0x583183[_0xcbf5('0x42')]=_0x2de14a;return _0x583183;})[_0xcbf5('0x20')](respondWithFilteredResult(_0x6de7b,_0x10b5ca))['catch'](handleError(_0x6de7b,null));};exports[_0xcbf5('0x43')]=function(_0x23dc65,_0x30c528){var _0x4a92ba={'raw':!![],'where':{'id':_0x23dc65[_0xcbf5('0x44')]['id']}},_0x3a12ac={};_0x3a12ac[_0xcbf5('0x2d')]=_['keys'](db[_0xcbf5('0x29')][_0xcbf5('0x45')]);_0x3a12ac[_0xcbf5('0x2f')]=_[_0xcbf5('0x30')](_0x23dc65['query']);_0x3a12ac[_0xcbf5('0x31')]=_[_0xcbf5('0x32')](_0x3a12ac[_0xcbf5('0x2d')],_0x3a12ac['query']);_0x4a92ba[_0xcbf5('0x33')]=_[_0xcbf5('0x32')](_0x3a12ac[_0xcbf5('0x2d')],qs['fields'](_0x23dc65[_0xcbf5('0x2f')][_0xcbf5('0x46')]));_0x4a92ba['attributes']=_0x4a92ba[_0xcbf5('0x33')][_0xcbf5('0x34')]?_0x4a92ba[_0xcbf5('0x33')]:_0x3a12ac[_0xcbf5('0x2d')];if(_0x23dc65[_0xcbf5('0x2f')]['includeAll']){_0x4a92ba[_0xcbf5('0x40')]=[{'all':!![]}];}_0x4a92ba=_[_0xcbf5('0x3b')]({},_0x4a92ba,_0x23dc65[_0xcbf5('0x3e')]);return db['SquareOdbc'][_0xcbf5('0x47')](_0x4a92ba)[_0xcbf5('0x20')](handleEntityNotFound(_0x30c528,null))['then'](respondWithResult(_0x30c528,null))[_0xcbf5('0x48')](handleError(_0x30c528,null));};exports[_0xcbf5('0x49')]=function(_0x393a89,_0x31e0c5){return db[_0xcbf5('0x29')][_0xcbf5('0x49')](_0x393a89[_0xcbf5('0x4a')],{})[_0xcbf5('0x20')](function(_0x2ae599){var _0x1c8694=_0x393a89[_0xcbf5('0x4b')][_0xcbf5('0x22')]({'plain':!![]});if(!_0x1c8694)throw new Error(_0xcbf5('0x4c'));if(_0x1c8694[_0xcbf5('0x4d')]==='user'){var _0x3412f2=_0x2ae599[_0xcbf5('0x22')]({'plain':!![]});var _0x5d4796=_0xcbf5('0x23');return db[_0xcbf5('0x4e')]['find']({'where':{'name':_0x5d4796,'userProfileId':_0x1c8694['userProfileId']},'raw':!![]})[_0xcbf5('0x20')](function(_0xe7ed51){if(_0xe7ed51&&_0xe7ed51[_0xcbf5('0x4f')]===0x0){return db[_0xcbf5('0x24')]['create']({'name':_0x3412f2[_0xcbf5('0x2e')],'resourceId':_0x3412f2['id'],'type':_0xe7ed51[_0xcbf5('0x2e')],'sectionId':_0xe7ed51['id']},{})['then'](function(){return _0x2ae599;});}else{return _0x2ae599;}})[_0xcbf5('0x48')](function(_0x472d3f){logger[_0xcbf5('0x25')](_0xcbf5('0x50'),_0x472d3f);throw _0x472d3f;});}return _0x2ae599;})[_0xcbf5('0x20')](respondWithResult(_0x31e0c5,0xc9))['catch'](handleError(_0x31e0c5,null));};exports[_0xcbf5('0x1f')]=function(_0xb13ba3,_0xf6cdb8){if(_0xb13ba3['body']['id']){delete _0xb13ba3['body']['id'];}return db[_0xcbf5('0x29')][_0xcbf5('0x47')]({'where':{'id':_0xb13ba3[_0xcbf5('0x44')]['id']}})[_0xcbf5('0x20')](handleEntityNotFound(_0xf6cdb8,null))[_0xcbf5('0x20')](saveUpdates(_0xb13ba3[_0xcbf5('0x4a')],null))['then'](respondWithResult(_0xf6cdb8,null))[_0xcbf5('0x48')](handleError(_0xf6cdb8,null));};exports[_0xcbf5('0x21')]=function(_0x52dd38,_0xae85d0){return db[_0xcbf5('0x29')]['find']({'where':{'id':_0x52dd38['params']['id']}})[_0xcbf5('0x20')](handleEntityNotFound(_0xae85d0,null))['then'](removeEntity(_0xae85d0,null))[_0xcbf5('0x48')](handleError(_0xae85d0,null));};exports[_0xcbf5('0x51')]=function(_0xcc1a47,_0x32f7a1,_0x1d2fde){var _0x45a8a3;return db[_0xcbf5('0x29')][_0xcbf5('0x47')]({'where':{'id':_0xcc1a47['params']['id']},'attributes':['id',_0xcbf5('0x52')]})['then'](handleEntityNotFound(_0x32f7a1,null))[_0xcbf5('0x20')](function(_0x2351a9){if(_0x2351a9){var _0x2cdf83=require(_0xcbf5('0x53'))();_0x2cdf83[_0xcbf5('0x54')](_0x2351a9[_0xcbf5('0x52')]);_0x2cdf83[_0xcbf5('0x55')]();return _0x2351a9;}})[_0xcbf5('0x20')](respondWithResult(_0x32f7a1,null))[_0xcbf5('0x48')](handleError(_0x32f7a1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4d6163d..247936e 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 _0xf4e7=['path','rimraf','./squareOdbc.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x185d1e,_0x5ad33b){var _0x211a49=function(_0x4903ac){while(--_0x4903ac){_0x185d1e['push'](_0x185d1e['shift']());}};_0x211a49(++_0x5ad33b);}(_0xf4e7,0x139));var _0x7f4e=function(_0x28de54,_0x5ea11a){_0x28de54=_0x28de54-0x0;var _0x3b59d8=_0xf4e7[_0x28de54];return _0x3b59d8;};'use strict';var _=require(_0x7f4e('0x0'));var util=require(_0x7f4e('0x1'));var logger=require(_0x7f4e('0x2'))(_0x7f4e('0x3'));var moment=require(_0x7f4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x7f4e('0x5'));var fs=require('fs');var path=require(_0x7f4e('0x6'));var rimraf=require(_0x7f4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7f4e('0x8'));module[_0x7f4e('0x9')]=function(_0x5d989d,_0x41666d){return _0x5d989d[_0x7f4e('0xa')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf65=['request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','api','bluebird'];(function(_0x4d02c0,_0x432cc6){var _0x5660f6=function(_0xa177aa){while(--_0xa177aa){_0x4d02c0['push'](_0x4d02c0['shift']());}};_0x5660f6(++_0x432cc6);}(_0xbf65,0x158));var _0x5bf6=function(_0x3bbb66,_0x280aa2){_0x3bbb66=_0x3bbb66-0x0;var _0x872225=_0xbf65[_0x3bbb66];return _0x872225;};'use strict';var _=require(_0x5bf6('0x0'));var util=require(_0x5bf6('0x1'));var logger=require('../../config/logger')(_0x5bf6('0x2'));var moment=require('moment');var BPromise=require(_0x5bf6('0x3'));var rp=require(_0x5bf6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bf6('0x5'));var config=require(_0x5bf6('0x6'));var attributes=require(_0x5bf6('0x7'));module[_0x5bf6('0x8')]=function(_0x3853b9,_0xe20271){return _0x3853b9[_0x5bf6('0x9')](_0x5bf6('0xa'),attributes,{'tableName':_0x5bf6('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 670e9ed..bacea86 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1624f5,_0xa2f147){var _0x23b431=function(_0x5393d4){while(--_0x5393d4){_0x1624f5['push'](_0x1624f5['shift']());}};_0x23b431(++_0xa2f147);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x5fc3[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x5fc3,0xa8));var _0x35fc=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x5fc3[_0xa8883];return _0x479426;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9b72e66..c539168 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 _0x96cc=['index','/:id','show','/:id/users','getUsers','create','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated'];(function(_0x40b046,_0x27857f){var _0x1558d4=function(_0xbfd78f){while(--_0xbfd78f){_0x40b046['push'](_0x40b046['shift']());}};_0x1558d4(++_0x27857f);}(_0x96cc,0x16c));var _0xc96c=function(_0x18d50f,_0x124aff){_0x18d50f=_0x18d50f-0x0;var _0x8ce385=_0x96cc[_0x18d50f];return _0x8ce385;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var auth=require(_0xc96c('0x4'));var interaction=require(_0xc96c('0x5'));var config=require(_0xc96c('0x6'));var controller=require(_0xc96c('0x7'));router[_0xc96c('0x8')]('/',auth[_0xc96c('0x9')](),controller[_0xc96c('0xa')]);router['get'](_0xc96c('0xb'),auth[_0xc96c('0x9')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x8')](_0xc96c('0xd'),auth[_0xc96c('0x9')](),controller[_0xc96c('0xe')]);router['post']('/',auth[_0xc96c('0x9')](),controller[_0xc96c('0xf')]);router[_0xc96c('0x10')]('/:id/users',auth[_0xc96c('0x9')](),controller['addUsers']);router[_0xc96c('0x11')]('/:id',auth[_0xc96c('0x9')](),controller[_0xc96c('0x12')]);router[_0xc96c('0x13')](_0xc96c('0xb'),auth['isAuthenticated'](),controller[_0xc96c('0x14')]);router[_0xc96c('0x13')](_0xc96c('0xd'),auth[_0xc96c('0x9')](),controller['removeUsers']);module[_0xc96c('0x15')]=router; \ No newline at end of file +var _0x7916=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','getUsers','post','create','/:id/users','addUsers','put','/:id','update','delete'];(function(_0x1998bb,_0x1f1da1){var _0x4ae4c9=function(_0x4741e8){while(--_0x4741e8){_0x1998bb['push'](_0x1998bb['shift']());}};_0x4ae4c9(++_0x1f1da1);}(_0x7916,0x128));var _0x6791=function(_0x4630c9,_0xd229d3){_0x4630c9=_0x4630c9-0x0;var _0x10b8bd=_0x7916[_0x4630c9];return _0x10b8bd;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var auth=require(_0x6791('0x4'));var interaction=require(_0x6791('0x5'));var config=require(_0x6791('0x6'));var controller=require('./squareProject.controller');router[_0x6791('0x7')]('/',auth['isAuthenticated'](),controller[_0x6791('0x8')]);router[_0x6791('0x7')]('/:id',auth[_0x6791('0x9')](),controller['show']);router[_0x6791('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x6791('0xa')]);router[_0x6791('0xb')]('/',auth['isAuthenticated'](),controller[_0x6791('0xc')]);router[_0x6791('0xb')](_0x6791('0xd'),auth['isAuthenticated'](),controller[_0x6791('0xe')]);router[_0x6791('0xf')](_0x6791('0x10'),auth[_0x6791('0x9')](),controller[_0x6791('0x11')]);router[_0x6791('0x12')](_0x6791('0x10'),auth[_0x6791('0x9')](),controller[_0x6791('0x13')]);router[_0x6791('0x12')](_0x6791('0xd'),auth['isAuthenticated'](),controller['removeUsers']);module[_0x6791('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 201c378..584483d 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 _0xdc96=['exports','name','TEXT','BLOB','getDataValue','preproduction','utf8','long','production'];(function(_0x36de71,_0x148629){var _0x304290=function(_0x217b19){while(--_0x217b19){_0x36de71['push'](_0x36de71['shift']());}};_0x304290(++_0x148629);}(_0xdc96,0x1b0));var _0x6dc9=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xdc96[_0x45d3f0];return _0x314b79;};'use strict';var Sequelize=require('sequelize');module[_0x6dc9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6dc9('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x6dc9('0x2')]},'preproduction':{'type':Sequelize[_0x6dc9('0x3')]('long'),'get':function(){if(this[_0x6dc9('0x4')]('preproduction')){return this[_0x6dc9('0x4')](_0x6dc9('0x5'))['toString'](_0x6dc9('0x6'));}}},'production':{'type':Sequelize[_0x6dc9('0x3')](_0x6dc9('0x7')),'get':function(){if(this[_0x6dc9('0x4')]('production')){return this['getDataValue'](_0x6dc9('0x8'))['toString'](_0x6dc9('0x6'));}}}}; \ No newline at end of file +var _0x04fc=['toString','utf8','production','sequelize','STRING','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x404a07,_0x115023){var _0xfb1c31=function(_0x22fb5f){while(--_0x22fb5f){_0x404a07['push'](_0x404a07['shift']());}};_0xfb1c31(++_0x115023);}(_0x04fc,0xb7));var _0xc04f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x04fc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc04f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc04f('0x1')]},'notes':{'type':Sequelize[_0xc04f('0x2')]},'preproduction':{'type':Sequelize[_0xc04f('0x3')](_0xc04f('0x4')),'get':function(){if(this[_0xc04f('0x5')](_0xc04f('0x6'))){return this['getDataValue'](_0xc04f('0x6'))[_0xc04f('0x7')](_0xc04f('0x8'));}}},'production':{'type':Sequelize[_0xc04f('0x3')]('long'),'get':function(){if(this[_0xc04f('0x5')](_0xc04f('0x9'))){return this[_0xc04f('0x5')]('production')['toString'](_0xc04f('0x8'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 7b64603..239ad0a 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 _0x4775=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','fields','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','ids','omit','removeUsers','isArray','emit','getUsers','findOne','User','options','html-pdf','rimraf','zip-dir','moment','bluebird','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','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x4775,0x8b));var _0x5477=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0x4775[_0x2390bd];return _0x3a969d;};'use strict';var pdf=require(_0x5477('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5477('0x1'));var zipdir=require(_0x5477('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5477('0x3'));var BPromise=require(_0x5477('0x4'));var Mustache=require(_0x5477('0x5'));var util=require(_0x5477('0x6'));var path=require(_0x5477('0x7'));var sox=require(_0x5477('0x8'));var csv=require(_0x5477('0x9'));var ejs=require(_0x5477('0xa'));var fs=require('fs');var _=require(_0x5477('0xb'));var squel=require(_0x5477('0xc'));var crypto=require(_0x5477('0xd'));var jsforce=require(_0x5477('0xe'));var deskjs=require(_0x5477('0xf'));var toCsv=require(_0x5477('0x9'));var querystring=require(_0x5477('0x10'));var Papa=require(_0x5477('0x11'));var Redis=require('ioredis');var authService=require(_0x5477('0x12'));var qs=require(_0x5477('0x13'));var as=require(_0x5477('0x14'));var hardwareService=require(_0x5477('0x15'));var logger=require(_0x5477('0x16'))('api');var utils=require(_0x5477('0x17'));var config=require(_0x5477('0x18'));var db=require(_0x5477('0x19'))['db'];config[_0x5477('0x1a')]=_[_0x5477('0x1b')](config[_0x5477('0x1a')],{'host':_0x5477('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5477('0x1a')]));require(_0x5477('0x1d'))[_0x5477('0x1e')](socket);function respondWithStatusCode(_0x598be1,_0x3b8cea){_0x3b8cea=_0x3b8cea||0xcc;return function(_0xfe5ac9){if(_0xfe5ac9){return _0x598be1[_0x5477('0x1f')](_0x3b8cea);}return _0x598be1[_0x5477('0x20')](_0x3b8cea)[_0x5477('0x21')]();};}function respondWithResult(_0x3afae8,_0xcce307){_0xcce307=_0xcce307||0xc8;return function(_0x52d748){if(_0x52d748){return _0x3afae8[_0x5477('0x20')](_0xcce307)['json'](_0x52d748);}};}function respondWithFilteredResult(_0x4d9426,_0x251f68){return function(_0x55519f){if(_0x55519f){var _0x48b26c=_0x55519f[_0x5477('0x22')],_0x3d0ade=_0x251f68[_0x5477('0x23')],_0x4e538c=_0x251f68[_0x5477('0x23')]+_0x251f68[_0x5477('0x24')],_0x2095b1;if(_0x4e538c>=_0x48b26c){_0x4e538c=_0x48b26c;_0x2095b1=0xc8;}else{_0x2095b1=0xce;}_0x4d9426[_0x5477('0x20')](_0x2095b1);return _0x4d9426[_0x5477('0x25')](_0x5477('0x26'),_0x3d0ade+'-'+_0x4e538c+'/'+_0x48b26c)[_0x5477('0x27')](_0x55519f);}return null;};}function patchUpdates(_0x33af1c){return function(_0x3a9546){try{jsonpatch[_0x5477('0x28')](_0x3a9546,_0x33af1c,!![]);}catch(_0x2f1a9e){return BPromise[_0x5477('0x29')](_0x2f1a9e);}return _0x3a9546['save']();};}function saveUpdates(_0xba0113,_0x1054e7){return function(_0xdb458e){if(_0xdb458e){return _0xdb458e['update'](_0xba0113)[_0x5477('0x2a')](function(_0x5e8614){return _0x5e8614;});}return null;};}function removeEntity(_0xb1095,_0x38d5b7){return function(_0x21af31){if(_0x21af31){return _0x21af31[_0x5477('0x2b')]()[_0x5477('0x2a')](function(){var _0x45f112=_0x21af31[_0x5477('0x2c')]({'plain':!![]});var _0x6cd965=_0x5477('0x2d');return db[_0x5477('0x2e')][_0x5477('0x2b')]({'where':{'type':_0x6cd965,'resourceId':_0x45f112['id']}})[_0x5477('0x2a')](function(){return _0x21af31;});})['then'](function(){_0xb1095[_0x5477('0x20')](0xcc)[_0x5477('0x21')]();});}};}function handleEntityNotFound(_0x1bfc5c,_0x45f071){return function(_0x460656){if(!_0x460656){_0x1bfc5c[_0x5477('0x1f')](0x194);}return _0x460656;};}function handleError(_0x33d9cb,_0x430109){_0x430109=_0x430109||0x1f4;return function(_0x136391){logger[_0x5477('0x2f')](_0x136391[_0x5477('0x30')]);if(_0x136391[_0x5477('0x31')]){delete _0x136391[_0x5477('0x31')];}_0x33d9cb[_0x5477('0x20')](_0x430109)['send'](_0x136391);};}exports[_0x5477('0x32')]=function(_0x1f614f,_0x4e0004){var _0x3a16a1={},_0x50db94={},_0x48633c={'count':0x0,'rows':[]};var _0x3814f2=_[_0x5477('0x33')](db[_0x5477('0x34')][_0x5477('0x35')],function(_0x92a5f9){return{'name':_0x92a5f9[_0x5477('0x36')],'type':_0x92a5f9[_0x5477('0x37')]['key']};});_0x50db94[_0x5477('0x38')]=_[_0x5477('0x33')](_0x3814f2,_0x5477('0x31'));_0x50db94[_0x5477('0x39')]=_[_0x5477('0x3a')](_0x1f614f['query']);_0x50db94[_0x5477('0x3b')]=_[_0x5477('0x3c')](_0x50db94[_0x5477('0x38')],_0x50db94[_0x5477('0x39')]);_0x3a16a1['attributes']=_[_0x5477('0x3c')](_0x50db94['model'],qs['fields'](_0x1f614f['query']['fields']));_0x3a16a1[_0x5477('0x3d')]=_0x3a16a1['attributes'][_0x5477('0x3e')]?_0x3a16a1[_0x5477('0x3d')]:_0x50db94[_0x5477('0x38')];if(!_0x1f614f[_0x5477('0x39')][_0x5477('0x3f')](_0x5477('0x40'))){_0x3a16a1[_0x5477('0x24')]=qs['limit'](_0x1f614f['query'][_0x5477('0x24')]);_0x3a16a1['offset']=qs[_0x5477('0x23')](_0x1f614f[_0x5477('0x39')][_0x5477('0x23')]);}_0x3a16a1[_0x5477('0x41')]=qs[_0x5477('0x42')](_0x1f614f[_0x5477('0x39')][_0x5477('0x42')]);_0x3a16a1['where']=qs[_0x5477('0x3b')](_[_0x5477('0x43')](_0x1f614f[_0x5477('0x39')],_0x50db94[_0x5477('0x3b')]),_0x3814f2);if(_0x1f614f[_0x5477('0x39')][_0x5477('0x44')]){_0x3a16a1[_0x5477('0x45')]=_[_0x5477('0x46')](_0x3a16a1['where'],{'$or':_['map'](_0x3814f2,function(_0x253ecc){if(_0x253ecc[_0x5477('0x37')]!==_0x5477('0x47')){var _0x1f29f1={};_0x1f29f1[_0x253ecc[_0x5477('0x31')]]={'$like':'%'+_0x1f614f[_0x5477('0x39')][_0x5477('0x44')]+'%'};return _0x1f29f1;}})});}_0x3a16a1=_[_0x5477('0x46')]({},_0x3a16a1,_0x1f614f['options']);var _0xf383a9={'where':_0x3a16a1['where']};return db['SquareProject'][_0x5477('0x22')](_0xf383a9)[_0x5477('0x2a')](function(_0x31e5b4){_0x48633c['count']=_0x31e5b4;if(_0x1f614f['query'][_0x5477('0x48')]){_0x3a16a1[_0x5477('0x49')]=[{'all':!![]}];}return db['SquareProject'][_0x5477('0x4a')](_0x3a16a1);})[_0x5477('0x2a')](function(_0x47bd68){_0x48633c[_0x5477('0x4b')]=_0x47bd68;return _0x48633c;})[_0x5477('0x2a')](respondWithFilteredResult(_0x4e0004,_0x3a16a1))['catch'](handleError(_0x4e0004,null));};exports['show']=function(_0x7a4b29,_0x5870b5){var _0xe3eddc={'raw':![],'where':{'id':_0x7a4b29[_0x5477('0x4c')]['id']}},_0x10f4d9={};_0x10f4d9[_0x5477('0x38')]=_[_0x5477('0x3a')](db[_0x5477('0x34')][_0x5477('0x35')]);_0x10f4d9[_0x5477('0x39')]=_[_0x5477('0x3a')](_0x7a4b29['query']);_0x10f4d9[_0x5477('0x3b')]=_['intersection'](_0x10f4d9['model'],_0x10f4d9[_0x5477('0x39')]);_0xe3eddc[_0x5477('0x3d')]=_['intersection'](_0x10f4d9[_0x5477('0x38')],qs[_0x5477('0x4d')](_0x7a4b29[_0x5477('0x39')][_0x5477('0x4d')]));_0xe3eddc[_0x5477('0x3d')]=_0xe3eddc['attributes'][_0x5477('0x3e')]?_0xe3eddc[_0x5477('0x3d')]:_0x10f4d9[_0x5477('0x38')];if(_0x7a4b29[_0x5477('0x39')][_0x5477('0x48')]){_0xe3eddc[_0x5477('0x49')]=[{'all':!![]}];}_0xe3eddc=_[_0x5477('0x46')]({},_0xe3eddc,_0x7a4b29['options']);return db[_0x5477('0x34')][_0x5477('0x4e')](_0xe3eddc)[_0x5477('0x2a')](handleEntityNotFound(_0x5870b5,null))[_0x5477('0x2a')](respondWithResult(_0x5870b5,null))[_0x5477('0x4f')](handleError(_0x5870b5,null));};exports[_0x5477('0x50')]=function(_0x46bba8,_0x447bcd){return db[_0x5477('0x34')][_0x5477('0x50')](_0x46bba8['body'],{})['then'](function(_0x35f80e){var _0x3a995b=_0x46bba8['user'][_0x5477('0x2c')]({'plain':!![]});if(!_0x3a995b)throw new Error(_0x5477('0x51'));if(_0x3a995b[_0x5477('0x52')]===_0x5477('0x53')){var _0x10c55f=_0x35f80e['get']({'plain':!![]});var _0x3c6a73=_0x5477('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x3c6a73,'userProfileId':_0x3a995b[_0x5477('0x54')]},'raw':!![]})[_0x5477('0x2a')](function(_0x2e75c6){if(_0x2e75c6&&_0x2e75c6[_0x5477('0x55')]===0x0){return db[_0x5477('0x2e')][_0x5477('0x50')]({'name':_0x10c55f[_0x5477('0x31')],'resourceId':_0x10c55f['id'],'type':_0x2e75c6['name'],'sectionId':_0x2e75c6['id']},{})['then'](function(){return _0x35f80e;});}else{return _0x35f80e;}})['catch'](function(_0x43a225){logger[_0x5477('0x2f')](_0x5477('0x56'),_0x43a225);throw _0x43a225;});}return _0x35f80e;})[_0x5477('0x2a')](respondWithResult(_0x447bcd,0xc9))[_0x5477('0x4f')](handleError(_0x447bcd,null));};exports[_0x5477('0x57')]=function(_0x5e0cf1,_0x104cf){if(_0x5e0cf1[_0x5477('0x58')]['id']){delete _0x5e0cf1[_0x5477('0x58')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x5e0cf1[_0x5477('0x4c')]['id']}})[_0x5477('0x2a')](handleEntityNotFound(_0x104cf,null))[_0x5477('0x2a')](saveUpdates(_0x5e0cf1[_0x5477('0x58')],null))[_0x5477('0x2a')](respondWithResult(_0x104cf,null))['catch'](handleError(_0x104cf,null));};exports[_0x5477('0x2b')]=function(_0x12c20d,_0x2112c5){return db[_0x5477('0x34')]['find']({'where':{'id':_0x12c20d['params']['id']}})[_0x5477('0x2a')](handleEntityNotFound(_0x2112c5,null))[_0x5477('0x2a')](removeEntity(_0x2112c5,null))[_0x5477('0x4f')](handleError(_0x2112c5,null));};exports['addUsers']=function(_0xb7b913,_0x252862,_0x2888cb){return db[_0x5477('0x34')]['find']({'where':{'id':_0xb7b913[_0x5477('0x4c')]['id']}})['then'](handleEntityNotFound(_0x252862,null))[_0x5477('0x2a')](function(_0x4e5835){if(_0x4e5835){return _0x4e5835[_0x5477('0x59')](_0xb7b913['body'][_0x5477('0x5a')],_[_0x5477('0x5b')](_0xb7b913[_0x5477('0x58')],['ids','id'])||{});}})[_0x5477('0x2a')](respondWithResult(_0x252862,null))[_0x5477('0x4f')](handleError(_0x252862,null));};exports[_0x5477('0x5c')]=function(_0x2f255f,_0x46d137,_0x3d671c){return db[_0x5477('0x34')][_0x5477('0x4e')]({'where':{'id':_0x2f255f[_0x5477('0x4c')]['id']}})[_0x5477('0x2a')](handleEntityNotFound(_0x46d137,null))[_0x5477('0x2a')](function(_0x2bcc51){if(_0x2bcc51){return _0x2bcc51[_0x5477('0x5c')](_0x2f255f[_0x5477('0x39')][_0x5477('0x5a')])[_0x5477('0x2a')](function(){if(_[_0x5477('0x5d')](_0x2f255f[_0x5477('0x39')][_0x5477('0x5a')])){for(var _0x145ff2=0x0;_0x145ff2<_0x2f255f[_0x5477('0x39')][_0x5477('0x5a')][_0x5477('0x3e')];_0x145ff2+=0x1){socket[_0x5477('0x5e')]('userSquareProject:remove',{'UserId':Number(_0x2f255f[_0x5477('0x39')][_0x5477('0x5a')][_0x145ff2]),'SquareProjectId':Number(_0x2f255f[_0x5477('0x4c')]['id'])});}}else{socket[_0x5477('0x5e')]('userSquareProject:remove',{'UserId':Number(_0x2f255f['query'][_0x5477('0x5a')]),'SquareProjectId':Number(_0x2f255f[_0x5477('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x46d137,null))[_0x5477('0x4f')](handleError(_0x46d137,null));};exports[_0x5477('0x5f')]=function(_0x4edc8e,_0x385dd2,_0x326b06){var _0x1fcc82={};var _0x32f181={};var _0x3c1cab;var _0x52a277;return db['SquareProject'][_0x5477('0x60')]({'where':{'id':_0x4edc8e[_0x5477('0x4c')]['id']}})[_0x5477('0x2a')](handleEntityNotFound(_0x385dd2,null))[_0x5477('0x2a')](function(_0x27ff52){if(_0x27ff52){_0x3c1cab=_0x27ff52;_0x32f181[_0x5477('0x38')]=_[_0x5477('0x3a')](db[_0x5477('0x61')][_0x5477('0x35')]);_0x32f181[_0x5477('0x39')]=_[_0x5477('0x3a')](_0x4edc8e[_0x5477('0x39')]);_0x32f181[_0x5477('0x3b')]=_[_0x5477('0x3c')](_0x32f181[_0x5477('0x38')],_0x32f181[_0x5477('0x39')]);_0x1fcc82[_0x5477('0x3d')]=_[_0x5477('0x3c')](_0x32f181[_0x5477('0x38')],qs['fields'](_0x4edc8e[_0x5477('0x39')][_0x5477('0x4d')]));_0x1fcc82[_0x5477('0x3d')]=_0x1fcc82['attributes']['length']?_0x1fcc82['attributes']:_0x32f181['model'];_0x1fcc82[_0x5477('0x41')]=qs[_0x5477('0x42')](_0x4edc8e[_0x5477('0x39')]['sort']);_0x1fcc82[_0x5477('0x45')]=qs[_0x5477('0x3b')](_[_0x5477('0x43')](_0x4edc8e[_0x5477('0x39')],_0x32f181[_0x5477('0x3b')]));if(_0x4edc8e[_0x5477('0x39')]['filter']){_0x1fcc82[_0x5477('0x45')]=_['merge'](_0x1fcc82[_0x5477('0x45')],{'$or':_[_0x5477('0x33')](_0x1fcc82['attributes'],function(_0x1cbc62){var _0x2c2dda={};_0x2c2dda[_0x1cbc62]={'$like':'%'+_0x4edc8e['query'][_0x5477('0x44')]+'%'};return _0x2c2dda;})});}_0x1fcc82=_[_0x5477('0x46')]({},_0x1fcc82,_0x4edc8e[_0x5477('0x62')]);return _0x3c1cab[_0x5477('0x5f')](_0x1fcc82);}})[_0x5477('0x2a')](function(_0xa8a72c){if(_0xa8a72c){_0x52a277=_0xa8a72c[_0x5477('0x3e')];if(!_0x4edc8e[_0x5477('0x39')][_0x5477('0x3f')](_0x5477('0x40'))){_0x1fcc82[_0x5477('0x24')]=qs[_0x5477('0x24')](_0x4edc8e[_0x5477('0x39')]['limit']);_0x1fcc82[_0x5477('0x23')]=qs[_0x5477('0x23')](_0x4edc8e[_0x5477('0x39')][_0x5477('0x23')]);}return _0x3c1cab[_0x5477('0x5f')](_0x1fcc82);}})[_0x5477('0x2a')](function(_0xcb0900){if(_0xcb0900){return _0xcb0900?{'count':_0x52a277,'rows':_0xcb0900}:null;}})[_0x5477('0x2a')](respondWithResult(_0x385dd2,null))['catch'](handleError(_0x385dd2,null));}; \ No newline at end of file +var _0x2f3c=['index','map','SquareProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','where','options','include','rows','catch','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','get','destroy','then','error','stack','name','send'];(function(_0x259f97,_0x2a17ac){var _0x26b146=function(_0x20612f){while(--_0x20612f){_0x259f97['push'](_0x259f97['shift']());}};_0x26b146(++_0x2a17ac);}(_0x2f3c,0x1b0));var _0xc2f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f3c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc2f3('0x0'));var emlformat=require(_0xc2f3('0x1'));var rimraf=require(_0xc2f3('0x2'));var zipdir=require(_0xc2f3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc2f3('0x4'));var BPromise=require(_0xc2f3('0x5'));var Mustache=require('mustache');var util=require(_0xc2f3('0x6'));var path=require(_0xc2f3('0x7'));var sox=require(_0xc2f3('0x8'));var csv=require('to-csv');var ejs=require(_0xc2f3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2f3('0xa'));var jsforce=require(_0xc2f3('0xb'));var deskjs=require(_0xc2f3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc2f3('0xd'));var Redis=require(_0xc2f3('0xe'));var authService=require(_0xc2f3('0xf'));var qs=require(_0xc2f3('0x10'));var as=require(_0xc2f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2f3('0x12'))(_0xc2f3('0x13'));var utils=require(_0xc2f3('0x14'));var config=require('../../config/environment');var db=require(_0xc2f3('0x15'))['db'];config[_0xc2f3('0x16')]=_[_0xc2f3('0x17')](config[_0xc2f3('0x16')],{'host':_0xc2f3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')[_0xc2f3('0x19')](socket);function respondWithStatusCode(_0x43ec57,_0x5510f1){_0x5510f1=_0x5510f1||0xcc;return function(_0x41173d){if(_0x41173d){return _0x43ec57[_0xc2f3('0x1a')](_0x5510f1);}return _0x43ec57[_0xc2f3('0x1b')](_0x5510f1)[_0xc2f3('0x1c')]();};}function respondWithResult(_0x100f1b,_0xb00073){_0xb00073=_0xb00073||0xc8;return function(_0x475c41){if(_0x475c41){return _0x100f1b[_0xc2f3('0x1b')](_0xb00073)[_0xc2f3('0x1d')](_0x475c41);}};}function respondWithFilteredResult(_0x32005c,_0x40d752){return function(_0x4b574c){if(_0x4b574c){var _0x59d9b5=_0x4b574c[_0xc2f3('0x1e')],_0x22c4aa=_0x40d752['offset'],_0xabb27c=_0x40d752[_0xc2f3('0x1f')]+_0x40d752['limit'],_0x5ea253;if(_0xabb27c>=_0x59d9b5){_0xabb27c=_0x59d9b5;_0x5ea253=0xc8;}else{_0x5ea253=0xce;}_0x32005c[_0xc2f3('0x1b')](_0x5ea253);return _0x32005c['set'](_0xc2f3('0x20'),_0x22c4aa+'-'+_0xabb27c+'/'+_0x59d9b5)[_0xc2f3('0x1d')](_0x4b574c);}return null;};}function patchUpdates(_0x40a01d){return function(_0x17d8fa){try{jsonpatch[_0xc2f3('0x21')](_0x17d8fa,_0x40a01d,!![]);}catch(_0x17bd38){return BPromise[_0xc2f3('0x22')](_0x17bd38);}return _0x17d8fa[_0xc2f3('0x23')]();};}function saveUpdates(_0x23aaa4,_0x5a7a1b){return function(_0x13eb2e){if(_0x13eb2e){return _0x13eb2e['update'](_0x23aaa4)['then'](function(_0x717b63){return _0x717b63;});}return null;};}function removeEntity(_0x5d18fc,_0x2d127a){return function(_0x20ae1d){if(_0x20ae1d){return _0x20ae1d['destroy']()['then'](function(){var _0x531ead=_0x20ae1d[_0xc2f3('0x24')]({'plain':!![]});var _0x3f47c2='SquareProjects';return db['UserProfileResource'][_0xc2f3('0x25')]({'where':{'type':_0x3f47c2,'resourceId':_0x531ead['id']}})[_0xc2f3('0x26')](function(){return _0x20ae1d;});})[_0xc2f3('0x26')](function(){_0x5d18fc[_0xc2f3('0x1b')](0xcc)[_0xc2f3('0x1c')]();});}};}function handleEntityNotFound(_0x54eb72,_0xfec034){return function(_0x45102c){if(!_0x45102c){_0x54eb72[_0xc2f3('0x1a')](0x194);}return _0x45102c;};}function handleError(_0x30f70d,_0x12940b){_0x12940b=_0x12940b||0x1f4;return function(_0x5325d4){logger[_0xc2f3('0x27')](_0x5325d4[_0xc2f3('0x28')]);if(_0x5325d4[_0xc2f3('0x29')]){delete _0x5325d4[_0xc2f3('0x29')];}_0x30f70d[_0xc2f3('0x1b')](_0x12940b)[_0xc2f3('0x2a')](_0x5325d4);};}exports[_0xc2f3('0x2b')]=function(_0x1d4463,_0x3f6918){var _0x485ab4={},_0xaae420={},_0xf0f98f={'count':0x0,'rows':[]};var _0x20ab72=_[_0xc2f3('0x2c')](db[_0xc2f3('0x2d')][_0xc2f3('0x2e')],function(_0x255f34){return{'name':_0x255f34['fieldName'],'type':_0x255f34[_0xc2f3('0x2f')][_0xc2f3('0x30')]};});_0xaae420[_0xc2f3('0x31')]=_[_0xc2f3('0x2c')](_0x20ab72,_0xc2f3('0x29'));_0xaae420['query']=_['keys'](_0x1d4463[_0xc2f3('0x32')]);_0xaae420[_0xc2f3('0x33')]=_[_0xc2f3('0x34')](_0xaae420[_0xc2f3('0x31')],_0xaae420[_0xc2f3('0x32')]);_0x485ab4[_0xc2f3('0x35')]=_[_0xc2f3('0x34')](_0xaae420['model'],qs[_0xc2f3('0x36')](_0x1d4463[_0xc2f3('0x32')]['fields']));_0x485ab4[_0xc2f3('0x35')]=_0x485ab4['attributes'][_0xc2f3('0x37')]?_0x485ab4['attributes']:_0xaae420[_0xc2f3('0x31')];if(!_0x1d4463[_0xc2f3('0x32')][_0xc2f3('0x38')]('nolimit')){_0x485ab4['limit']=qs[_0xc2f3('0x39')](_0x1d4463[_0xc2f3('0x32')]['limit']);_0x485ab4['offset']=qs[_0xc2f3('0x1f')](_0x1d4463[_0xc2f3('0x32')][_0xc2f3('0x1f')]);}_0x485ab4[_0xc2f3('0x3a')]=qs[_0xc2f3('0x3b')](_0x1d4463[_0xc2f3('0x32')][_0xc2f3('0x3b')]);_0x485ab4['where']=qs[_0xc2f3('0x33')](_[_0xc2f3('0x3c')](_0x1d4463[_0xc2f3('0x32')],_0xaae420[_0xc2f3('0x33')]),_0x20ab72);if(_0x1d4463[_0xc2f3('0x32')][_0xc2f3('0x3d')]){_0x485ab4['where']=_[_0xc2f3('0x3e')](_0x485ab4[_0xc2f3('0x3f')],{'$or':_[_0xc2f3('0x2c')](_0x20ab72,function(_0x4127bc){if(_0x4127bc[_0xc2f3('0x2f')]!=='VIRTUAL'){var _0x2129d9={};_0x2129d9[_0x4127bc['name']]={'$like':'%'+_0x1d4463['query'][_0xc2f3('0x3d')]+'%'};return _0x2129d9;}})});}_0x485ab4=_[_0xc2f3('0x3e')]({},_0x485ab4,_0x1d4463[_0xc2f3('0x40')]);var _0x279518={'where':_0x485ab4['where']};return db['SquareProject'][_0xc2f3('0x1e')](_0x279518)['then'](function(_0x547f8b){_0xf0f98f[_0xc2f3('0x1e')]=_0x547f8b;if(_0x1d4463[_0xc2f3('0x32')]['includeAll']){_0x485ab4[_0xc2f3('0x41')]=[{'all':!![]}];}return db[_0xc2f3('0x2d')]['findAll'](_0x485ab4);})[_0xc2f3('0x26')](function(_0x58bc29){_0xf0f98f[_0xc2f3('0x42')]=_0x58bc29;return _0xf0f98f;})[_0xc2f3('0x26')](respondWithFilteredResult(_0x3f6918,_0x485ab4))[_0xc2f3('0x43')](handleError(_0x3f6918,null));};exports[_0xc2f3('0x44')]=function(_0x2d8694,_0x590dc2){var _0x299425={'raw':![],'where':{'id':_0x2d8694['params']['id']}},_0x2f29a1={};_0x2f29a1[_0xc2f3('0x31')]=_[_0xc2f3('0x45')](db[_0xc2f3('0x2d')]['rawAttributes']);_0x2f29a1[_0xc2f3('0x32')]=_['keys'](_0x2d8694[_0xc2f3('0x32')]);_0x2f29a1[_0xc2f3('0x33')]=_[_0xc2f3('0x34')](_0x2f29a1['model'],_0x2f29a1['query']);_0x299425['attributes']=_[_0xc2f3('0x34')](_0x2f29a1[_0xc2f3('0x31')],qs[_0xc2f3('0x36')](_0x2d8694[_0xc2f3('0x32')]['fields']));_0x299425[_0xc2f3('0x35')]=_0x299425['attributes'][_0xc2f3('0x37')]?_0x299425[_0xc2f3('0x35')]:_0x2f29a1['model'];if(_0x2d8694[_0xc2f3('0x32')][_0xc2f3('0x46')]){_0x299425['include']=[{'all':!![]}];}_0x299425=_[_0xc2f3('0x3e')]({},_0x299425,_0x2d8694[_0xc2f3('0x40')]);return db[_0xc2f3('0x2d')]['find'](_0x299425)[_0xc2f3('0x26')](handleEntityNotFound(_0x590dc2,null))['then'](respondWithResult(_0x590dc2,null))[_0xc2f3('0x43')](handleError(_0x590dc2,null));};exports[_0xc2f3('0x47')]=function(_0x5c9d4a,_0x2e82d1){return db[_0xc2f3('0x2d')][_0xc2f3('0x47')](_0x5c9d4a[_0xc2f3('0x48')],{})[_0xc2f3('0x26')](function(_0x504a4b){var _0x3cc6e2=_0x5c9d4a[_0xc2f3('0x49')][_0xc2f3('0x24')]({'plain':!![]});if(!_0x3cc6e2)throw new Error(_0xc2f3('0x4a'));if(_0x3cc6e2['role']==='user'){var _0x42a7af=_0x504a4b[_0xc2f3('0x24')]({'plain':!![]});var _0x20e777=_0xc2f3('0x4b');return db[_0xc2f3('0x4c')][_0xc2f3('0x4d')]({'where':{'name':_0x20e777,'userProfileId':_0x3cc6e2[_0xc2f3('0x4e')]},'raw':!![]})[_0xc2f3('0x26')](function(_0x5008b0){if(_0x5008b0&&_0x5008b0[_0xc2f3('0x4f')]===0x0){return db[_0xc2f3('0x50')][_0xc2f3('0x47')]({'name':_0x42a7af[_0xc2f3('0x29')],'resourceId':_0x42a7af['id'],'type':_0x5008b0[_0xc2f3('0x29')],'sectionId':_0x5008b0['id']},{})[_0xc2f3('0x26')](function(){return _0x504a4b;});}else{return _0x504a4b;}})[_0xc2f3('0x43')](function(_0x416cd9){logger['error'](_0xc2f3('0x51'),_0x416cd9);throw _0x416cd9;});}return _0x504a4b;})[_0xc2f3('0x26')](respondWithResult(_0x2e82d1,0xc9))[_0xc2f3('0x43')](handleError(_0x2e82d1,null));};exports[_0xc2f3('0x52')]=function(_0x2ad0fa,_0x4bd91a){if(_0x2ad0fa[_0xc2f3('0x48')]['id']){delete _0x2ad0fa[_0xc2f3('0x48')]['id'];}return db['SquareProject'][_0xc2f3('0x4d')]({'where':{'id':_0x2ad0fa[_0xc2f3('0x53')]['id']}})[_0xc2f3('0x26')](handleEntityNotFound(_0x4bd91a,null))['then'](saveUpdates(_0x2ad0fa[_0xc2f3('0x48')],null))[_0xc2f3('0x26')](respondWithResult(_0x4bd91a,null))[_0xc2f3('0x43')](handleError(_0x4bd91a,null));};exports[_0xc2f3('0x25')]=function(_0x19bfa6,_0x41fb86){return db[_0xc2f3('0x2d')][_0xc2f3('0x4d')]({'where':{'id':_0x19bfa6[_0xc2f3('0x53')]['id']}})[_0xc2f3('0x26')](handleEntityNotFound(_0x41fb86,null))[_0xc2f3('0x26')](removeEntity(_0x41fb86,null))['catch'](handleError(_0x41fb86,null));};exports[_0xc2f3('0x54')]=function(_0x1cd1fa,_0x3c7e2d,_0x5998ab){return db[_0xc2f3('0x2d')][_0xc2f3('0x4d')]({'where':{'id':_0x1cd1fa[_0xc2f3('0x53')]['id']}})[_0xc2f3('0x26')](handleEntityNotFound(_0x3c7e2d,null))[_0xc2f3('0x26')](function(_0x110f80){if(_0x110f80){return _0x110f80['addUsers'](_0x1cd1fa[_0xc2f3('0x48')][_0xc2f3('0x55')],_[_0xc2f3('0x56')](_0x1cd1fa[_0xc2f3('0x48')],[_0xc2f3('0x55'),'id'])||{});}})[_0xc2f3('0x26')](respondWithResult(_0x3c7e2d,null))['catch'](handleError(_0x3c7e2d,null));};exports['removeUsers']=function(_0x17714a,_0x3c289d,_0x40bc54){return db['SquareProject'][_0xc2f3('0x4d')]({'where':{'id':_0x17714a[_0xc2f3('0x53')]['id']}})[_0xc2f3('0x26')](handleEntityNotFound(_0x3c289d,null))[_0xc2f3('0x26')](function(_0x39c789){if(_0x39c789){return _0x39c789[_0xc2f3('0x57')](_0x17714a[_0xc2f3('0x32')][_0xc2f3('0x55')])[_0xc2f3('0x26')](function(){if(_[_0xc2f3('0x58')](_0x17714a[_0xc2f3('0x32')][_0xc2f3('0x55')])){for(var _0x40ecac=0x0;_0x40ecac<_0x17714a['query'][_0xc2f3('0x55')][_0xc2f3('0x37')];_0x40ecac+=0x1){socket[_0xc2f3('0x59')](_0xc2f3('0x5a'),{'UserId':Number(_0x17714a['query']['ids'][_0x40ecac]),'SquareProjectId':Number(_0x17714a['params']['id'])});}}else{socket['emit'](_0xc2f3('0x5a'),{'UserId':Number(_0x17714a[_0xc2f3('0x32')][_0xc2f3('0x55')]),'SquareProjectId':Number(_0x17714a[_0xc2f3('0x53')]['id'])});}});}})[_0xc2f3('0x26')](respondWithStatusCode(_0x3c289d,null))['catch'](handleError(_0x3c289d,null));};exports[_0xc2f3('0x5b')]=function(_0x529e00,_0x4dc2fa,_0x517ad1){var _0x179bb6={};var _0x32ac5e={};var _0xba8c3a;var _0x39d50f;return db[_0xc2f3('0x2d')][_0xc2f3('0x5c')]({'where':{'id':_0x529e00[_0xc2f3('0x53')]['id']}})[_0xc2f3('0x26')](handleEntityNotFound(_0x4dc2fa,null))[_0xc2f3('0x26')](function(_0x2f9677){if(_0x2f9677){_0xba8c3a=_0x2f9677;_0x32ac5e[_0xc2f3('0x31')]=_['keys'](db[_0xc2f3('0x5d')][_0xc2f3('0x2e')]);_0x32ac5e[_0xc2f3('0x32')]=_[_0xc2f3('0x45')](_0x529e00['query']);_0x32ac5e[_0xc2f3('0x33')]=_[_0xc2f3('0x34')](_0x32ac5e[_0xc2f3('0x31')],_0x32ac5e['query']);_0x179bb6[_0xc2f3('0x35')]=_['intersection'](_0x32ac5e[_0xc2f3('0x31')],qs[_0xc2f3('0x36')](_0x529e00[_0xc2f3('0x32')]['fields']));_0x179bb6['attributes']=_0x179bb6[_0xc2f3('0x35')][_0xc2f3('0x37')]?_0x179bb6[_0xc2f3('0x35')]:_0x32ac5e['model'];_0x179bb6[_0xc2f3('0x3a')]=qs[_0xc2f3('0x3b')](_0x529e00['query'][_0xc2f3('0x3b')]);_0x179bb6[_0xc2f3('0x3f')]=qs[_0xc2f3('0x33')](_['pick'](_0x529e00[_0xc2f3('0x32')],_0x32ac5e['filters']));if(_0x529e00['query'][_0xc2f3('0x3d')]){_0x179bb6['where']=_[_0xc2f3('0x3e')](_0x179bb6[_0xc2f3('0x3f')],{'$or':_['map'](_0x179bb6[_0xc2f3('0x35')],function(_0x50c647){var _0x225605={};_0x225605[_0x50c647]={'$like':'%'+_0x529e00['query'][_0xc2f3('0x3d')]+'%'};return _0x225605;})});}_0x179bb6=_[_0xc2f3('0x3e')]({},_0x179bb6,_0x529e00['options']);return _0xba8c3a['getUsers'](_0x179bb6);}})['then'](function(_0x54bcbb){if(_0x54bcbb){_0x39d50f=_0x54bcbb[_0xc2f3('0x37')];if(!_0x529e00[_0xc2f3('0x32')][_0xc2f3('0x38')](_0xc2f3('0x5e'))){_0x179bb6['limit']=qs[_0xc2f3('0x39')](_0x529e00[_0xc2f3('0x32')][_0xc2f3('0x39')]);_0x179bb6[_0xc2f3('0x1f')]=qs[_0xc2f3('0x1f')](_0x529e00[_0xc2f3('0x32')]['offset']);}return _0xba8c3a[_0xc2f3('0x5b')](_0x179bb6);}})[_0xc2f3('0x26')](function(_0x196326){if(_0x196326){return _0x196326?{'count':_0x39d50f,'rows':_0x196326}:null;}})[_0xc2f3('0x26')](respondWithResult(_0x4dc2fa,null))['catch'](handleError(_0x4dc2fa,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fe10296..a2e26ea 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 _0x8bfe=['../../mysqldb','SquareProject','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8bfe,0x1a6));var _0xe8bf=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x8bfe[_0xb5fc3e];return _0x2efc3c;};'use strict';var EventEmitter=require(_0xe8bf('0x0'));var SquareProject=require(_0xe8bf('0x1'))['db'][_0xe8bf('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe8bf('0x3'),'afterUpdate':_0xe8bf('0x4'),'afterDestroy':_0xe8bf('0x5')};function emitEvent(_0x4bdabd){return function(_0xcbba86,_0x50ba82,_0x13135a){SquareProjectEvents[_0xe8bf('0x6')](_0x4bdabd+':'+_0xcbba86['id'],_0xcbba86);SquareProjectEvents['emit'](_0x4bdabd,_0xcbba86);_0x13135a(null);};}for(var e in events){if(events[_0xe8bf('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xe8bf('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xfd36=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x269fe2,_0x553e2c){var _0x1c5586=function(_0x16420b){while(--_0x16420b){_0x269fe2['push'](_0x269fe2['shift']());}};_0x1c5586(++_0x553e2c);}(_0xfd36,0xc4));var _0x6fd3=function(_0x2e5660,_0x3a3bac){_0x2e5660=_0x2e5660-0x0;var _0x4a2adc=_0xfd36[_0x2e5660];return _0x4a2adc;};'use strict';var EventEmitter=require(_0x6fd3('0x0'));var SquareProject=require(_0x6fd3('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6fd3('0x2')](0x0);var events={'afterCreate':_0x6fd3('0x3'),'afterUpdate':_0x6fd3('0x4'),'afterDestroy':_0x6fd3('0x5')};function emitEvent(_0x44923a){return function(_0x24facf,_0x441d43,_0x136c8d){SquareProjectEvents[_0x6fd3('0x6')](_0x44923a+':'+_0x24facf['id'],_0x24facf);SquareProjectEvents['emit'](_0x44923a,_0x24facf);_0x136c8d(null);};}for(var e in events){if(events[_0x6fd3('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x6fd3('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 25f2331..f410a61 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(_0x4c0df6,_0x102c54){var _0x475448=function(_0x1be1c0){while(--_0x1be1c0){_0x4c0df6['push'](_0x4c0df6['shift']());}};_0x475448(++_0x102c54);}(_0x2ef3,0xba));var _0x32ef=function(_0x2739d8,_0x1477af){_0x2739d8=_0x2739d8-0x0;var _0x55530e=_0x2ef3[_0x2739d8];return _0x55530e;};'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 _0x2032=['square_projects','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x3b851d,_0x2452c3){var _0xe96a9c=function(_0x287b80){while(--_0x287b80){_0x3b851d['push'](_0x3b851d['shift']());}};_0xe96a9c(++_0x2452c3);}(_0x2032,0xd9));var _0x2203=function(_0x48210c,_0x527dbe){_0x48210c=_0x48210c-0x0;var _0x59dfe1=_0x2032[_0x48210c];return _0x59dfe1;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3ae43dc..a47fe49 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 _0x1483=['options','where','include','map','model','attributes','then','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','SquareProject,\x20%s,\x20%s','result','ShowSquareProject','SquareProject','find'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x1483,0x171));var _0x3148=function(_0x25ba6a,_0x4422d6){_0x25ba6a=_0x25ba6a-0x0;var _0x1be09a=_0x1483[_0x25ba6a];return _0x1be09a;};'use strict';var _=require(_0x3148('0x0'));var util=require('util');var moment=require(_0x3148('0x1'));var BPromise=require(_0x3148('0x2'));var rs=require(_0x3148('0x3'));var fs=require('fs');var Redis=require(_0x3148('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3148('0x5'))(_0x3148('0x6'));var config=require(_0x3148('0x7'));var jayson=require(_0x3148('0x8'));var client=jayson['client'][_0x3148('0x9')]({'port':0x232a});config[_0x3148('0xa')]=_[_0x3148('0xb')](config[_0x3148('0xa')],{'host':_0x3148('0xc'),'port':0x18eb});var socket=require(_0x3148('0xd'))(new Redis(config[_0x3148('0xa')]));require('./squareProject.socket')[_0x3148('0xe')](socket);function respondWithRpcPromise(_0x39e7b6,_0x4e072a,_0x2e24c1){return new BPromise(function(_0x572a8f,_0x168327){return client[_0x3148('0xf')](_0x39e7b6,_0x2e24c1)['then'](function(_0x1ec15a){logger[_0x3148('0x10')]('SquareProject,\x20%s,\x20%s',_0x4e072a,'request\x20sent');logger[_0x3148('0x11')](_0x3148('0x12'),_0x4e072a,_0x3148('0x13'),JSON['stringify'](_0x1ec15a));if(_0x1ec15a['error']){if(_0x1ec15a[_0x3148('0x14')]['code']===0x1f4){logger[_0x3148('0x14')]('SquareProject,\x20%s,\x20%s',_0x4e072a,_0x1ec15a[_0x3148('0x14')][_0x3148('0x15')]);return _0x168327(_0x1ec15a['error'][_0x3148('0x15')]);}logger[_0x3148('0x14')](_0x3148('0x16'),_0x4e072a,_0x1ec15a[_0x3148('0x14')]['message']);return _0x572a8f(_0x1ec15a[_0x3148('0x14')][_0x3148('0x15')]);}else{logger[_0x3148('0x10')](_0x3148('0x16'),_0x4e072a,_0x3148('0x13'));_0x572a8f(_0x1ec15a[_0x3148('0x17')][_0x3148('0x15')]);}})['catch'](function(_0x2aea57){logger[_0x3148('0x14')](_0x3148('0x16'),_0x4e072a,_0x2aea57);_0x168327(_0x2aea57);});});}exports[_0x3148('0x18')]=function(_0x525985){var _0x371b84=this;return new Promise(function(_0x4faf28,_0x4d3907){return db[_0x3148('0x19')][_0x3148('0x1a')]({'raw':_0x525985[_0x3148('0x1b')]?_0x525985[_0x3148('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x525985[_0x3148('0x1b')]?_0x525985['options'][_0x3148('0x1c')]||null:null,'attributes':_0x525985[_0x3148('0x1b')]?_0x525985[_0x3148('0x1b')]['attributes']||null:null,'include':_0x525985[_0x3148('0x1b')]?_0x525985[_0x3148('0x1b')][_0x3148('0x1d')]?_[_0x3148('0x1e')](_0x525985['options'][_0x3148('0x1d')],function(_0x1690d6){return{'model':db[_0x1690d6[_0x3148('0x1f')]],'as':_0x1690d6['as'],'attributes':_0x1690d6[_0x3148('0x20')],'include':_0x1690d6['include']?_['map'](_0x1690d6[_0x3148('0x1d')],function(_0x1fc92c){return{'model':db[_0x1fc92c[_0x3148('0x1f')]],'as':_0x1fc92c['as'],'attributes':_0x1fc92c[_0x3148('0x20')],'include':_0x1fc92c['include']?_[_0x3148('0x1e')](_0x1fc92c[_0x3148('0x1d')],function(_0x8cfecd){return{'model':db[_0x8cfecd[_0x3148('0x1f')]],'as':_0x8cfecd['as'],'attributes':_0x8cfecd[_0x3148('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3148('0x21')](function(_0x4aa342){logger[_0x3148('0x10')](_0x3148('0x18'),_0x525985);logger['debug'](_0x3148('0x18'),_0x525985,JSON[_0x3148('0x22')](_0x4aa342));_0x4faf28(_0x4aa342);})[_0x3148('0x23')](function(_0x4c4ba9){logger['error'](_0x3148('0x18'),_0x4c4ba9[_0x3148('0x15')],_0x525985);_0x4d3907(_0x371b84[_0x3148('0x14')](0x1f4,_0x4c4ba9['message']));});});}; \ No newline at end of file +var _0x67ba=['ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x456db4,_0x3657eb){var _0x19c03d=function(_0x30d22e){while(--_0x30d22e){_0x456db4['push'](_0x456db4['shift']());}};_0x19c03d(++_0x3657eb);}(_0x67ba,0x1a1));var _0xa67b=function(_0x15d554,_0x2dade6){_0x15d554=_0x15d554-0x0;var _0x1e3580=_0x67ba[_0x15d554];return _0x1e3580;};'use strict';var _=require(_0xa67b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa67b('0x1'));var rs=require(_0xa67b('0x2'));var fs=require('fs');var Redis=require(_0xa67b('0x3'));var db=require(_0xa67b('0x4'))['db'];var utils=require(_0xa67b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa67b('0x6'));var jayson=require(_0xa67b('0x7'));var client=jayson[_0xa67b('0x8')][_0xa67b('0x9')]({'port':0x232a});config[_0xa67b('0xa')]=_[_0xa67b('0xb')](config[_0xa67b('0xa')],{'host':_0xa67b('0xc'),'port':0x18eb});var socket=require(_0xa67b('0xd'))(new Redis(config[_0xa67b('0xa')]));require(_0xa67b('0xe'))[_0xa67b('0xf')](socket);function respondWithRpcPromise(_0x5ffc23,_0x47ceae,_0x1e942b){return new BPromise(function(_0x27899c,_0xc1c177){return client['request'](_0x5ffc23,_0x1e942b)[_0xa67b('0x10')](function(_0x4077b0){logger['info'](_0xa67b('0x11'),_0x47ceae,_0xa67b('0x12'));logger[_0xa67b('0x13')](_0xa67b('0x14'),_0x47ceae,_0xa67b('0x12'),JSON[_0xa67b('0x15')](_0x4077b0));if(_0x4077b0[_0xa67b('0x16')]){if(_0x4077b0[_0xa67b('0x16')][_0xa67b('0x17')]===0x1f4){logger[_0xa67b('0x16')](_0xa67b('0x11'),_0x47ceae,_0x4077b0[_0xa67b('0x16')][_0xa67b('0x18')]);return _0xc1c177(_0x4077b0[_0xa67b('0x16')][_0xa67b('0x18')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x47ceae,_0x4077b0[_0xa67b('0x16')][_0xa67b('0x18')]);return _0x27899c(_0x4077b0[_0xa67b('0x16')]['message']);}else{logger[_0xa67b('0x19')](_0xa67b('0x11'),_0x47ceae,_0xa67b('0x12'));_0x27899c(_0x4077b0['result'][_0xa67b('0x18')]);}})[_0xa67b('0x1a')](function(_0x4b6084){logger[_0xa67b('0x16')](_0xa67b('0x11'),_0x47ceae,_0x4b6084);_0xc1c177(_0x4b6084);});});}exports[_0xa67b('0x1b')]=function(_0x12392b){var _0x1d672d=this;return new Promise(function(_0x4b4b19,_0x1c7617){return db[_0xa67b('0x1c')][_0xa67b('0x1d')]({'raw':_0x12392b[_0xa67b('0x1e')]?_0x12392b[_0xa67b('0x1e')][_0xa67b('0x1f')]===undefined?!![]:![]:!![],'where':_0x12392b['options']?_0x12392b[_0xa67b('0x1e')][_0xa67b('0x20')]||null:null,'attributes':_0x12392b[_0xa67b('0x1e')]?_0x12392b[_0xa67b('0x1e')][_0xa67b('0x21')]||null:null,'include':_0x12392b[_0xa67b('0x1e')]?_0x12392b[_0xa67b('0x1e')][_0xa67b('0x22')]?_[_0xa67b('0x23')](_0x12392b[_0xa67b('0x1e')][_0xa67b('0x22')],function(_0x5eb600){return{'model':db[_0x5eb600[_0xa67b('0x24')]],'as':_0x5eb600['as'],'attributes':_0x5eb600[_0xa67b('0x21')],'include':_0x5eb600[_0xa67b('0x22')]?_[_0xa67b('0x23')](_0x5eb600[_0xa67b('0x22')],function(_0xfc873f){return{'model':db[_0xfc873f['model']],'as':_0xfc873f['as'],'attributes':_0xfc873f[_0xa67b('0x21')],'include':_0xfc873f['include']?_[_0xa67b('0x23')](_0xfc873f[_0xa67b('0x22')],function(_0x195099){return{'model':db[_0x195099[_0xa67b('0x24')]],'as':_0x195099['as'],'attributes':_0x195099[_0xa67b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa67b('0x10')](function(_0x1050fb){logger['info'](_0xa67b('0x1b'),_0x12392b);logger[_0xa67b('0x13')](_0xa67b('0x1b'),_0x12392b,JSON['stringify'](_0x1050fb));_0x4b4b19(_0x1050fb);})['catch'](function(_0xc2274c){logger[_0xa67b('0x16')]('ShowSquareProject',_0xc2274c['message'],_0x12392b);_0x1c7617(_0x1d672d[_0xa67b('0x16')](0x1f4,_0xc2274c[_0xa67b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fd1e9cb..367cf0b 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['emit','removeListener','register','length','./squareProject.events','save','update'];(function(_0x2051bd,_0x4b1e3e){var _0x512fcf=function(_0x264db4){while(--_0x264db4){_0x2051bd['push'](_0x2051bd['shift']());}};_0x512fcf(++_0x4b1e3e);}(_0x5fab,0x177));var _0xb5fa=function(_0x3a196b,_0x1a03c4){_0x3a196b=_0x3a196b-0x0;var _0x192dd8=_0x5fab[_0x3a196b];return _0x192dd8;};'use strict';var SquareProjectEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){SquareProjectEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('squareProject:'+_0x1aec3e,_0x44df89);SquareProjectEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x5d58=['register'];(function(_0x48036f,_0x34d2e5){var _0x11ee74=function(_0x320d6c){while(--_0x320d6c){_0x48036f['push'](_0x48036f['shift']());}};_0x11ee74(++_0x34d2e5);}(_0x5d58,0x187));var _0x85d5=function(_0x46e231,_0x3c0e59){_0x46e231=_0x46e231-0x0;var _0x22f1d6=_0x5d58[_0x46e231];return _0x22f1d6;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove','update'];function createListener(_0x501631,_0x64d32c){return function(_0x1eff3b){_0x64d32c['emit'](_0x501631,_0x1eff3b);};}function removeListener(_0x1469fc,_0x30bfe8){return function(){SquareProjectEvents['removeListener'](_0x1469fc,_0x30bfe8);};}exports[_0x85d5('0x0')]=function(_0x2d457a){for(var _0x578fad=0x0,_0x46e7b4=events['length'];_0x578fad<_0x46e7b4;_0x578fad++){var _0x98c963=events[_0x578fad];var _0x3fecca=createListener('squareProject:'+_0x98c963,_0x2d457a);SquareProjectEvents['on'](_0x98c963,_0x3fecca);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f1c3a32..ce68f58 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 _0xb05a=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','create','update','delete','/:id/delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x183259,_0x1d01ba){var _0x13fc5e=function(_0x5cbbe9){while(--_0x5cbbe9){_0x183259['push'](_0x183259['shift']());}};_0x13fc5e(++_0x1d01ba);}(_0xb05a,0x67));var _0xab05=function(_0x4d7b67,_0x5b3c9f){_0x4d7b67=_0x4d7b67-0x0;var _0x2d85e6=_0xb05a[_0x4d7b67];return _0x2d85e6;};'use strict';var multer=require('multer');var util=require(_0xab05('0x0'));var path=require(_0xab05('0x1'));var timeout=require(_0xab05('0x2'));var express=require(_0xab05('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xab05('0x4'));var config=require(_0xab05('0x5'));var controller=require(_0xab05('0x6'));router[_0xab05('0x7')]('/',auth[_0xab05('0x8')](),controller[_0xab05('0x9')]);router[_0xab05('0x7')](_0xab05('0xa'),auth[_0xab05('0x8')](),controller['show']);router[_0xab05('0x7')](_0xab05('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xab05('0xc')]);router['put'](_0xab05('0xa'),auth['isAuthenticated'](),controller[_0xab05('0xd')]);router[_0xab05('0xe')](_0xab05('0xf'),auth[_0xab05('0x8')](),controller[_0xab05('0x10')]);module[_0xab05('0x11')]=router; \ No newline at end of file +var _0xd7da=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','post','create','put','update','delete','/:id/delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7da,0x8e));var _0xad7d=function(_0xc20f22,_0x49698f){_0xc20f22=_0xc20f22-0x0;var _0x1535d5=_0xd7da[_0xc20f22];return _0x1535d5;};'use strict';var multer=require('multer');var util=require(_0xad7d('0x0'));var path=require(_0xad7d('0x1'));var timeout=require(_0xad7d('0x2'));var express=require(_0xad7d('0x3'));var router=express[_0xad7d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xad7d('0x5'));var config=require('../../config/environment');var controller=require(_0xad7d('0x6'));router[_0xad7d('0x7')]('/',auth[_0xad7d('0x8')](),controller[_0xad7d('0x9')]);router[_0xad7d('0x7')](_0xad7d('0xa'),auth[_0xad7d('0x8')](),controller['show']);router[_0xad7d('0x7')](_0xad7d('0xb'),auth[_0xad7d('0x8')](),controller['download']);router[_0xad7d('0xc')]('/',auth['isAuthenticated'](),controller[_0xad7d('0xd')]);router[_0xad7d('0xe')]('/:id',auth[_0xad7d('0x8')](),controller[_0xad7d('0xf')]);router[_0xad7d('0x10')](_0xad7d('0x11'),auth[_0xad7d('0x8')](),controller[_0xad7d('0x12')]);module[_0xad7d('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a0dc572..37bb3ea 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 _0x323d=['VIRTUAL','getDataValue','substring','exports','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x323d,0x12f));var _0xd323=function(_0x28a471,_0x80beab){_0x28a471=_0x28a471-0x0;var _0x59c413=_0x323d[_0x28a471];return _0x59c413;};'use strict';var Sequelize=require('sequelize');module[_0xd323('0x0')]={'uniqueid':{'type':Sequelize[_0xd323('0x1')]},'callerid':{'type':Sequelize[_0xd323('0x1')]},'calleridname':{'type':Sequelize[_0xd323('0x1')]},'context':{'type':Sequelize[_0xd323('0x1')]},'extension':{'type':Sequelize[_0xd323('0x1')]},'priority':{'type':Sequelize[_0xd323('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd323('0x1')]},'saveName':{'type':Sequelize[_0xd323('0x1')]},'filename':{'type':Sequelize[_0xd323('0x1')]},'savePath':{'type':Sequelize[_0xd323('0x1')]},'format':{'type':Sequelize[_0xd323('0x2')],'get':function(){var _0x3afb55='';var _0x5d6fad=this[_0xd323('0x3')]('savePath');if(_0x5d6fad){_0x3afb55=_0x5d6fad[_0xd323('0x4')](_0x5d6fad['lastIndexOf']('.'));}return _0x3afb55;}}}; \ No newline at end of file +var _0x9264=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4926('0x0'));module[_0x4926('0x1')]={'uniqueid':{'type':Sequelize[_0x4926('0x2')]},'callerid':{'type':Sequelize[_0x4926('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4926('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x4926('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x4926('0x2')]},'format':{'type':Sequelize[_0x4926('0x3')],'get':function(){var _0x57c13c='';var _0x1299c8=this[_0x4926('0x4')]('savePath');if(_0x1299c8){_0x57c13c=_0x1299c8[_0x4926('0x5')](_0x1299c8[_0x4926('0x6')]('.'));}return _0x57c13c;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ded358c..0aa2d49 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 _0x6a0d=['sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection','create','body','download','../../components/encryptor','uniqueid','find','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','order'];(function(_0x402a07,_0xf894){var _0x49563b=function(_0x2b857e){while(--_0x2b857e){_0x402a07['push'](_0x402a07['shift']());}};_0x49563b(++_0xf894);}(_0x6a0d,0x14a));var _0xd6a0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6a0d[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0xd6a0('0x0'));var emlformat=require(_0xd6a0('0x1'));var rimraf=require(_0xd6a0('0x2'));var zipdir=require(_0xd6a0('0x3'));var jsonpatch=require(_0xd6a0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd6a0('0x5'));var Mustache=require('mustache');var util=require(_0xd6a0('0x6'));var path=require(_0xd6a0('0x7'));var sox=require('sox');var csv=require(_0xd6a0('0x8'));var ejs=require(_0xd6a0('0x9'));var fs=require('fs');var _=require(_0xd6a0('0xa'));var squel=require(_0xd6a0('0xb'));var crypto=require('crypto');var jsforce=require(_0xd6a0('0xc'));var deskjs=require(_0xd6a0('0xd'));var toCsv=require(_0xd6a0('0x8'));var querystring=require(_0xd6a0('0xe'));var Papa=require(_0xd6a0('0xf'));var Redis=require('ioredis');var authService=require(_0xd6a0('0x10'));var qs=require(_0xd6a0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6a0('0x12'))(_0xd6a0('0x13'));var utils=require(_0xd6a0('0x14'));var config=require(_0xd6a0('0x15'));var db=require(_0xd6a0('0x16'))['db'];function respondWithStatusCode(_0x5313ab,_0x1f9153){_0x1f9153=_0x1f9153||0xcc;return function(_0x50a853){if(_0x50a853){return _0x5313ab[_0xd6a0('0x17')](_0x1f9153);}return _0x5313ab['status'](_0x1f9153)[_0xd6a0('0x18')]();};}function respondWithResult(_0x472205,_0x1f62ef){_0x1f62ef=_0x1f62ef||0xc8;return function(_0x2171ed){if(_0x2171ed){return _0x472205[_0xd6a0('0x19')](_0x1f62ef)[_0xd6a0('0x1a')](_0x2171ed);}};}function respondWithFilteredResult(_0x87459d,_0x55820e){return function(_0x15b8ed){if(_0x15b8ed){var _0x31ddff=_0x15b8ed['count'],_0x2e2472=_0x55820e[_0xd6a0('0x1b')],_0x601d11=_0x55820e[_0xd6a0('0x1b')]+_0x55820e[_0xd6a0('0x1c')],_0x36c2b0;if(_0x601d11>=_0x31ddff){_0x601d11=_0x31ddff;_0x36c2b0=0xc8;}else{_0x36c2b0=0xce;}_0x87459d[_0xd6a0('0x19')](_0x36c2b0);return _0x87459d[_0xd6a0('0x1d')](_0xd6a0('0x1e'),_0x2e2472+'-'+_0x601d11+'/'+_0x31ddff)['json'](_0x15b8ed);}return null;};}function patchUpdates(_0x3c2539){return function(_0x41581d){try{jsonpatch[_0xd6a0('0x1f')](_0x41581d,_0x3c2539,!![]);}catch(_0x743212){return BPromise[_0xd6a0('0x20')](_0x743212);}return _0x41581d['save']();};}function saveUpdates(_0x4de857,_0x2d7c4d){return function(_0x1bb904){if(_0x1bb904){return _0x1bb904[_0xd6a0('0x21')](_0x4de857)[_0xd6a0('0x22')](function(_0x12b8d5){return _0x12b8d5;});}return null;};}function removeEntity(_0x419232,_0x58a5c2){return function(_0x684681){if(_0x684681){return _0x684681[_0xd6a0('0x23')]()['then'](function(){_0x419232[_0xd6a0('0x19')](0xcc)[_0xd6a0('0x18')]();});}};}function handleEntityNotFound(_0x31a9a3,_0x4b3a33){return function(_0x10480a){if(!_0x10480a){_0x31a9a3[_0xd6a0('0x17')](0x194);}return _0x10480a;};}function handleError(_0x12a6ef,_0x304d9a){_0x304d9a=_0x304d9a||0x1f4;return function(_0x3d4602){logger[_0xd6a0('0x24')](_0x3d4602[_0xd6a0('0x25')]);if(_0x3d4602[_0xd6a0('0x26')]){delete _0x3d4602[_0xd6a0('0x26')];}_0x12a6ef[_0xd6a0('0x19')](_0x304d9a)[_0xd6a0('0x27')](_0x3d4602);};}exports[_0xd6a0('0x28')]=function(_0x513c54,_0x4a0571){var _0x2e9aaa={},_0x1260c8={},_0x1ec36f={'count':0x0,'rows':[]};var _0x486fe9=_[_0xd6a0('0x29')](db[_0xd6a0('0x2a')][_0xd6a0('0x2b')],function(_0x3d1003){return{'name':_0x3d1003[_0xd6a0('0x2c')],'type':_0x3d1003[_0xd6a0('0x2d')][_0xd6a0('0x2e')]};});_0x1260c8[_0xd6a0('0x2f')]=_['map'](_0x486fe9,'name');_0x1260c8[_0xd6a0('0x30')]=_[_0xd6a0('0x31')](_0x513c54['query']);_0x1260c8['filters']=_['intersection'](_0x1260c8[_0xd6a0('0x2f')],_0x1260c8[_0xd6a0('0x30')]);_0x2e9aaa[_0xd6a0('0x32')]=_['intersection'](_0x1260c8[_0xd6a0('0x2f')],qs[_0xd6a0('0x33')](_0x513c54['query'][_0xd6a0('0x33')]));_0x2e9aaa[_0xd6a0('0x32')]=_0x2e9aaa[_0xd6a0('0x32')][_0xd6a0('0x34')]?_0x2e9aaa['attributes']:_0x1260c8[_0xd6a0('0x2f')];if(!_0x513c54[_0xd6a0('0x30')]['hasOwnProperty']('nolimit')){_0x2e9aaa[_0xd6a0('0x1c')]=qs[_0xd6a0('0x1c')](_0x513c54[_0xd6a0('0x30')][_0xd6a0('0x1c')]);_0x2e9aaa[_0xd6a0('0x1b')]=qs[_0xd6a0('0x1b')](_0x513c54[_0xd6a0('0x30')][_0xd6a0('0x1b')]);}_0x2e9aaa[_0xd6a0('0x35')]=qs[_0xd6a0('0x36')](_0x513c54[_0xd6a0('0x30')]['sort']);_0x2e9aaa[_0xd6a0('0x37')]=qs[_0xd6a0('0x38')](_[_0xd6a0('0x39')](_0x513c54['query'],_0x1260c8[_0xd6a0('0x38')]),_0x486fe9);if(_0x513c54['query'][_0xd6a0('0x3a')]){_0x2e9aaa[_0xd6a0('0x37')]=_[_0xd6a0('0x3b')](_0x2e9aaa[_0xd6a0('0x37')],{'$or':_['map'](_0x486fe9,function(_0x42d8e3){if(_0x42d8e3[_0xd6a0('0x2d')]!==_0xd6a0('0x3c')){var _0x5ec24b={};_0x5ec24b[_0x42d8e3[_0xd6a0('0x26')]]={'$like':'%'+_0x513c54['query'][_0xd6a0('0x3a')]+'%'};return _0x5ec24b;}})});}_0x2e9aaa=_[_0xd6a0('0x3b')]({},_0x2e9aaa,_0x513c54[_0xd6a0('0x3d')]);var _0x4fb474={'where':_0x2e9aaa['where']};return db[_0xd6a0('0x2a')][_0xd6a0('0x3e')](_0x4fb474)['then'](function(_0x1d0d6c){_0x1ec36f['count']=_0x1d0d6c;if(_0x513c54[_0xd6a0('0x30')][_0xd6a0('0x3f')]){_0x2e9aaa[_0xd6a0('0x40')]=[{'all':!![]}];}return db[_0xd6a0('0x2a')][_0xd6a0('0x41')](_0x2e9aaa);})[_0xd6a0('0x22')](function(_0x407c9f){_0x1ec36f[_0xd6a0('0x42')]=_0x407c9f;return _0x1ec36f;})[_0xd6a0('0x22')](respondWithFilteredResult(_0x4a0571,_0x2e9aaa))[_0xd6a0('0x43')](handleError(_0x4a0571,null));};exports['show']=function(_0x878014,_0x110fb5){var _0x315a0e={'raw':!![],'where':{'id':_0x878014[_0xd6a0('0x44')]['id']}},_0x8f8348={};_0x8f8348[_0xd6a0('0x2f')]=_['keys'](db[_0xd6a0('0x2a')][_0xd6a0('0x2b')]);_0x8f8348['query']=_[_0xd6a0('0x31')](_0x878014[_0xd6a0('0x30')]);_0x8f8348[_0xd6a0('0x38')]=_['intersection'](_0x8f8348[_0xd6a0('0x2f')],_0x8f8348['query']);_0x315a0e[_0xd6a0('0x32')]=_[_0xd6a0('0x45')](_0x8f8348[_0xd6a0('0x2f')],qs[_0xd6a0('0x33')](_0x878014['query'][_0xd6a0('0x33')]));_0x315a0e[_0xd6a0('0x32')]=_0x315a0e[_0xd6a0('0x32')][_0xd6a0('0x34')]?_0x315a0e[_0xd6a0('0x32')]:_0x8f8348[_0xd6a0('0x2f')];if(_0x878014[_0xd6a0('0x30')][_0xd6a0('0x3f')]){_0x315a0e[_0xd6a0('0x40')]=[{'all':!![]}];}_0x315a0e=_[_0xd6a0('0x3b')]({},_0x315a0e,_0x878014[_0xd6a0('0x3d')]);return db[_0xd6a0('0x2a')]['find'](_0x315a0e)[_0xd6a0('0x22')](handleEntityNotFound(_0x110fb5,null))['then'](respondWithResult(_0x110fb5,null))[_0xd6a0('0x43')](handleError(_0x110fb5,null));};exports[_0xd6a0('0x46')]=function(_0x290ccb,_0x3570ba){return db['SquareRecording']['create'](_0x290ccb[_0xd6a0('0x47')],{})['then'](respondWithResult(_0x3570ba,0xc9))[_0xd6a0('0x43')](handleError(_0x3570ba,null));};exports[_0xd6a0('0x21')]=function(_0x4e2745,_0x66a817){if(_0x4e2745[_0xd6a0('0x47')]['id']){delete _0x4e2745['body']['id'];}return db[_0xd6a0('0x2a')]['find']({'where':{'id':_0x4e2745['params']['id']}})[_0xd6a0('0x22')](handleEntityNotFound(_0x66a817,null))['then'](saveUpdates(_0x4e2745[_0xd6a0('0x47')],null))['then'](respondWithResult(_0x66a817,null))['catch'](handleError(_0x66a817,null));};exports[_0xd6a0('0x48')]=function(_0x19a3a0,_0x9f3fb7,_0x1350a6){var _0x5d12e4=require(_0xd6a0('0x49'));var _0x559199=![];var _0x361111={};if(_0x19a3a0[_0xd6a0('0x30')][_0xd6a0('0x2d')]&&_0x19a3a0[_0xd6a0('0x30')]['type']===_0xd6a0('0x4a')){_0x361111['uniqueid']=_0x19a3a0['params']['id'];}else{_0x361111['id']=_0x19a3a0['params']['id'];}return db[_0xd6a0('0x2a')][_0xd6a0('0x4b')]({'where':_0x361111,'attributes':['id',_0xd6a0('0x4c'),_0xd6a0('0x4d')],'raw':!![]})[_0xd6a0('0x22')](handleEntityNotFound(_0x9f3fb7,null))[_0xd6a0('0x22')](function(_0x59fb21){if(_0x59fb21){var _0x4e8d4d=_0x59fb21[_0xd6a0('0x4c')];var _0x41f611=util[_0xd6a0('0x4e')](_0xd6a0('0x4f'),_0x4e8d4d);if(fs[_0xd6a0('0x50')](_0x41f611)){_0x559199=!![];return _0x5d12e4[_0xd6a0('0x51')](_0x41f611,_0x4e8d4d,config[_0xd6a0('0x52')][_0xd6a0('0x53')])[_0xd6a0('0x22')](function(){return _0x59fb21;});}return _0x59fb21;}})[_0xd6a0('0x22')](function(_0x23dfa3){if(_0x23dfa3){var _0x130d39=_0x23dfa3[_0xd6a0('0x4c')];if(!fs[_0xd6a0('0x50')](_0x130d39)){throw new db['Sequelize'][(_0xd6a0('0x54'))](_0xd6a0('0x55'));}if(_0x23dfa3[_0xd6a0('0x4d')]){return _0x9f3fb7[_0xd6a0('0x48')](_0x130d39,_0x23dfa3[_0xd6a0('0x4d')]+path[_0xd6a0('0x56')](_0x130d39),function(){if(_0x559199){fs['unlink'](_0x130d39);}});}else{return _0x9f3fb7['download'](_0x130d39,function(_0x4437ac){if(_0x559199){fs[_0xd6a0('0x57')](_0x130d39);}});}}})[_0xd6a0('0x43')](function(_0x1c3a87){if(_0x1c3a87[_0xd6a0('0x58')]==='SquareRecording\x20not\x20found'){_0x9f3fb7[_0xd6a0('0x19')](0x194)[_0xd6a0('0x27')](_0xd6a0('0x59'));}else{return handleError(_0x9f3fb7,null);}});};exports[_0xd6a0('0x23')]=function(_0x4b590d,_0x2e8808){return db[_0xd6a0('0x2a')]['find']({'where':{'id':_0x4b590d[_0xd6a0('0x44')]['id']}})[_0xd6a0('0x22')](function(_0x6eeb03){if(!_0x6eeb03)throw new ReferenceError(_0xd6a0('0x5a'));return _0x6eeb03;})[_0xd6a0('0x22')](function(_0x46ce0e){var _0x4adde8=_0x46ce0e[_0xd6a0('0x4c')];logger[_0xd6a0('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x4adde8);if(!_['isNil'](_0x46ce0e[_0xd6a0('0x4c')])&&fs[_0xd6a0('0x50')](_0x4adde8)){logger[_0xd6a0('0x5b')](_0xd6a0('0x5c')+_0x4adde8+_0xd6a0('0x5d'));fs[_0xd6a0('0x5e')](_0x4adde8);}_0x4adde8=_0x4adde8+'.cypher';if(!_[_0xd6a0('0x5f')](_0x46ce0e[_0xd6a0('0x4c')])&&fs['existsSync'](_0x4adde8)){logger[_0xd6a0('0x5b')](_0xd6a0('0x5c')+_0x4adde8+_0xd6a0('0x5d'));fs[_0xd6a0('0x5e')](_0x4adde8);}return _0x46ce0e;})[_0xd6a0('0x22')](function(_0x374303){if(!_0x374303)throw new InternalError();return _0x374303[_0xd6a0('0x23')]();})['then'](function(){_0x2e8808[_0xd6a0('0x19')](0xcc)[_0xd6a0('0x18')]();})['catch'](handleError(_0x2e8808,null));}; \ No newline at end of file +var _0x4d6a=['pick','filter','merge','findAll','rows','catch','params','includeAll','include','options','find','create','body','download','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','then','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x38a685,_0x55f482){var _0x1fd0f9=function(_0x523844){while(--_0x523844){_0x38a685['push'](_0x38a685['shift']());}};_0x1fd0f9(++_0x55f482);}(_0x4d6a,0x83));var _0xa4d6=function(_0x3ee54f,_0x2e7cdd){_0x3ee54f=_0x3ee54f-0x0;var _0x3bed47=_0x4d6a[_0x3ee54f];return _0x3bed47;};'use strict';var pdf=require(_0xa4d6('0x0'));var emlformat=require(_0xa4d6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa4d6('0x2'));var jsonpatch=require(_0xa4d6('0x3'));var rp=require('request-promise');var moment=require(_0xa4d6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4d6('0x5'));var path=require(_0xa4d6('0x6'));var sox=require(_0xa4d6('0x7'));var csv=require('to-csv');var ejs=require(_0xa4d6('0x8'));var fs=require('fs');var _=require(_0xa4d6('0x9'));var squel=require(_0xa4d6('0xa'));var crypto=require(_0xa4d6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa4d6('0xc'));var toCsv=require(_0xa4d6('0xd'));var querystring=require('querystring');var Papa=require(_0xa4d6('0xe'));var Redis=require(_0xa4d6('0xf'));var authService=require(_0xa4d6('0x10'));var qs=require(_0xa4d6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4d6('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa4d6('0x13'));var db=require(_0xa4d6('0x14'))['db'];function respondWithStatusCode(_0x551c48,_0x14cb0d){_0x14cb0d=_0x14cb0d||0xcc;return function(_0x4947f3){if(_0x4947f3){return _0x551c48[_0xa4d6('0x15')](_0x14cb0d);}return _0x551c48['status'](_0x14cb0d)[_0xa4d6('0x16')]();};}function respondWithResult(_0x21c36c,_0x2d7e10){_0x2d7e10=_0x2d7e10||0xc8;return function(_0x2efc33){if(_0x2efc33){return _0x21c36c[_0xa4d6('0x17')](_0x2d7e10)[_0xa4d6('0x18')](_0x2efc33);}};}function respondWithFilteredResult(_0x3a6b47,_0x5c919a){return function(_0x4e3708){if(_0x4e3708){var _0x5c588e=_0x4e3708[_0xa4d6('0x19')],_0x2b407c=_0x5c919a[_0xa4d6('0x1a')],_0x45a4b4=_0x5c919a['offset']+_0x5c919a[_0xa4d6('0x1b')],_0x589a35;if(_0x45a4b4>=_0x5c588e){_0x45a4b4=_0x5c588e;_0x589a35=0xc8;}else{_0x589a35=0xce;}_0x3a6b47[_0xa4d6('0x17')](_0x589a35);return _0x3a6b47['set'](_0xa4d6('0x1c'),_0x2b407c+'-'+_0x45a4b4+'/'+_0x5c588e)[_0xa4d6('0x18')](_0x4e3708);}return null;};}function patchUpdates(_0x40d5f9){return function(_0x2893d2){try{jsonpatch['apply'](_0x2893d2,_0x40d5f9,!![]);}catch(_0x19a3ae){return BPromise[_0xa4d6('0x1d')](_0x19a3ae);}return _0x2893d2[_0xa4d6('0x1e')]();};}function saveUpdates(_0x27b46f,_0x6cec1e){return function(_0x58e3fe){if(_0x58e3fe){return _0x58e3fe[_0xa4d6('0x1f')](_0x27b46f)[_0xa4d6('0x20')](function(_0x24416a){return _0x24416a;});}return null;};}function removeEntity(_0x3d6d07,_0x88494f){return function(_0x451cd3){if(_0x451cd3){return _0x451cd3['destroy']()['then'](function(){_0x3d6d07[_0xa4d6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5500ff,_0x387e13){return function(_0xcb6978){if(!_0xcb6978){_0x5500ff[_0xa4d6('0x15')](0x194);}return _0xcb6978;};}function handleError(_0x5a0973,_0x12cad5){_0x12cad5=_0x12cad5||0x1f4;return function(_0x2dd227){logger['error'](_0x2dd227[_0xa4d6('0x21')]);if(_0x2dd227[_0xa4d6('0x22')]){delete _0x2dd227[_0xa4d6('0x22')];}_0x5a0973['status'](_0x12cad5)[_0xa4d6('0x23')](_0x2dd227);};}exports[_0xa4d6('0x24')]=function(_0x1c88c7,_0x35e0bd){var _0x25a06b={},_0x2a3a49={},_0x222272={'count':0x0,'rows':[]};var _0x8f604e=_[_0xa4d6('0x25')](db[_0xa4d6('0x26')][_0xa4d6('0x27')],function(_0x27aae5){return{'name':_0x27aae5['fieldName'],'type':_0x27aae5[_0xa4d6('0x28')][_0xa4d6('0x29')]};});_0x2a3a49[_0xa4d6('0x2a')]=_['map'](_0x8f604e,_0xa4d6('0x22'));_0x2a3a49[_0xa4d6('0x2b')]=_[_0xa4d6('0x2c')](_0x1c88c7[_0xa4d6('0x2b')]);_0x2a3a49[_0xa4d6('0x2d')]=_[_0xa4d6('0x2e')](_0x2a3a49['model'],_0x2a3a49['query']);_0x25a06b[_0xa4d6('0x2f')]=_[_0xa4d6('0x2e')](_0x2a3a49[_0xa4d6('0x2a')],qs[_0xa4d6('0x30')](_0x1c88c7['query'][_0xa4d6('0x30')]));_0x25a06b[_0xa4d6('0x2f')]=_0x25a06b[_0xa4d6('0x2f')][_0xa4d6('0x31')]?_0x25a06b[_0xa4d6('0x2f')]:_0x2a3a49[_0xa4d6('0x2a')];if(!_0x1c88c7[_0xa4d6('0x2b')][_0xa4d6('0x32')](_0xa4d6('0x33'))){_0x25a06b[_0xa4d6('0x1b')]=qs['limit'](_0x1c88c7[_0xa4d6('0x2b')][_0xa4d6('0x1b')]);_0x25a06b[_0xa4d6('0x1a')]=qs[_0xa4d6('0x1a')](_0x1c88c7['query'][_0xa4d6('0x1a')]);}_0x25a06b[_0xa4d6('0x34')]=qs[_0xa4d6('0x35')](_0x1c88c7[_0xa4d6('0x2b')][_0xa4d6('0x35')]);_0x25a06b[_0xa4d6('0x36')]=qs[_0xa4d6('0x2d')](_[_0xa4d6('0x37')](_0x1c88c7[_0xa4d6('0x2b')],_0x2a3a49['filters']),_0x8f604e);if(_0x1c88c7[_0xa4d6('0x2b')][_0xa4d6('0x38')]){_0x25a06b[_0xa4d6('0x36')]=_['merge'](_0x25a06b[_0xa4d6('0x36')],{'$or':_[_0xa4d6('0x25')](_0x8f604e,function(_0x259521){if(_0x259521['type']!=='VIRTUAL'){var _0x5c2b90={};_0x5c2b90[_0x259521[_0xa4d6('0x22')]]={'$like':'%'+_0x1c88c7['query'][_0xa4d6('0x38')]+'%'};return _0x5c2b90;}})});}_0x25a06b=_[_0xa4d6('0x39')]({},_0x25a06b,_0x1c88c7['options']);var _0x47c0e0={'where':_0x25a06b['where']};return db[_0xa4d6('0x26')][_0xa4d6('0x19')](_0x47c0e0)[_0xa4d6('0x20')](function(_0x313f41){_0x222272[_0xa4d6('0x19')]=_0x313f41;if(_0x1c88c7['query']['includeAll']){_0x25a06b['include']=[{'all':!![]}];}return db[_0xa4d6('0x26')][_0xa4d6('0x3a')](_0x25a06b);})['then'](function(_0x2b7716){_0x222272[_0xa4d6('0x3b')]=_0x2b7716;return _0x222272;})[_0xa4d6('0x20')](respondWithFilteredResult(_0x35e0bd,_0x25a06b))[_0xa4d6('0x3c')](handleError(_0x35e0bd,null));};exports['show']=function(_0x98c0ff,_0x4bfccf){var _0x430dec={'raw':!![],'where':{'id':_0x98c0ff[_0xa4d6('0x3d')]['id']}},_0x1ae00d={};_0x1ae00d[_0xa4d6('0x2a')]=_[_0xa4d6('0x2c')](db[_0xa4d6('0x26')][_0xa4d6('0x27')]);_0x1ae00d[_0xa4d6('0x2b')]=_[_0xa4d6('0x2c')](_0x98c0ff['query']);_0x1ae00d[_0xa4d6('0x2d')]=_[_0xa4d6('0x2e')](_0x1ae00d['model'],_0x1ae00d[_0xa4d6('0x2b')]);_0x430dec[_0xa4d6('0x2f')]=_[_0xa4d6('0x2e')](_0x1ae00d['model'],qs[_0xa4d6('0x30')](_0x98c0ff[_0xa4d6('0x2b')][_0xa4d6('0x30')]));_0x430dec[_0xa4d6('0x2f')]=_0x430dec[_0xa4d6('0x2f')][_0xa4d6('0x31')]?_0x430dec[_0xa4d6('0x2f')]:_0x1ae00d[_0xa4d6('0x2a')];if(_0x98c0ff[_0xa4d6('0x2b')][_0xa4d6('0x3e')]){_0x430dec[_0xa4d6('0x3f')]=[{'all':!![]}];}_0x430dec=_[_0xa4d6('0x39')]({},_0x430dec,_0x98c0ff[_0xa4d6('0x40')]);return db[_0xa4d6('0x26')][_0xa4d6('0x41')](_0x430dec)[_0xa4d6('0x20')](handleEntityNotFound(_0x4bfccf,null))['then'](respondWithResult(_0x4bfccf,null))[_0xa4d6('0x3c')](handleError(_0x4bfccf,null));};exports[_0xa4d6('0x42')]=function(_0x3905d3,_0xabd609){return db[_0xa4d6('0x26')][_0xa4d6('0x42')](_0x3905d3[_0xa4d6('0x43')],{})['then'](respondWithResult(_0xabd609,0xc9))['catch'](handleError(_0xabd609,null));};exports[_0xa4d6('0x1f')]=function(_0x10a4e3,_0x2d49d7){if(_0x10a4e3[_0xa4d6('0x43')]['id']){delete _0x10a4e3[_0xa4d6('0x43')]['id'];}return db[_0xa4d6('0x26')][_0xa4d6('0x41')]({'where':{'id':_0x10a4e3[_0xa4d6('0x3d')]['id']}})[_0xa4d6('0x20')](handleEntityNotFound(_0x2d49d7,null))[_0xa4d6('0x20')](saveUpdates(_0x10a4e3['body'],null))[_0xa4d6('0x20')](respondWithResult(_0x2d49d7,null))[_0xa4d6('0x3c')](handleError(_0x2d49d7,null));};exports[_0xa4d6('0x44')]=function(_0x5cd15c,_0x5ec11d,_0x2f83cf){var _0x1f25ba=require('../../components/encryptor');var _0x5a8252=![];var _0x23a91e={};if(_0x5cd15c['query']['type']&&_0x5cd15c[_0xa4d6('0x2b')][_0xa4d6('0x28')]===_0xa4d6('0x45')){_0x23a91e['uniqueid']=_0x5cd15c[_0xa4d6('0x3d')]['id'];}else{_0x23a91e['id']=_0x5cd15c[_0xa4d6('0x3d')]['id'];}return db[_0xa4d6('0x26')][_0xa4d6('0x41')]({'where':_0x23a91e,'attributes':['id',_0xa4d6('0x46'),'filename'],'raw':!![]})[_0xa4d6('0x20')](handleEntityNotFound(_0x5ec11d,null))[_0xa4d6('0x20')](function(_0x29d255){if(_0x29d255){var _0x2fb956=_0x29d255[_0xa4d6('0x46')];var _0x5da52f=util[_0xa4d6('0x47')](_0xa4d6('0x48'),_0x2fb956);if(fs['existsSync'](_0x5da52f)){_0x5a8252=!![];return _0x1f25ba[_0xa4d6('0x49')](_0x5da52f,_0x2fb956,config[_0xa4d6('0x4a')][_0xa4d6('0x4b')])[_0xa4d6('0x20')](function(){return _0x29d255;});}return _0x29d255;}})[_0xa4d6('0x20')](function(_0x5c9c8e){if(_0x5c9c8e){var _0x593ba4=_0x5c9c8e[_0xa4d6('0x46')];if(!fs[_0xa4d6('0x4c')](_0x593ba4)){throw new db[(_0xa4d6('0x4d'))]['ValidationError'](_0xa4d6('0x4e'));}if(_0x5c9c8e[_0xa4d6('0x4f')]){return _0x5ec11d[_0xa4d6('0x44')](_0x593ba4,_0x5c9c8e[_0xa4d6('0x4f')]+path[_0xa4d6('0x50')](_0x593ba4),function(){if(_0x5a8252){fs[_0xa4d6('0x51')](_0x593ba4);}});}else{return _0x5ec11d['download'](_0x593ba4,function(_0x3867b7){if(_0x5a8252){fs[_0xa4d6('0x51')](_0x593ba4);}});}}})[_0xa4d6('0x3c')](function(_0x517fac){if(_0x517fac[_0xa4d6('0x52')]===_0xa4d6('0x4e')){_0x5ec11d[_0xa4d6('0x17')](0x194)[_0xa4d6('0x23')](_0xa4d6('0x53'));}else{return handleError(_0x5ec11d,null);}});};exports[_0xa4d6('0x54')]=function(_0x422b3a,_0x42dec3){return db[_0xa4d6('0x26')][_0xa4d6('0x41')]({'where':{'id':_0x422b3a[_0xa4d6('0x3d')]['id']}})[_0xa4d6('0x20')](function(_0x2b5fce){if(!_0x2b5fce)throw new ReferenceError(_0xa4d6('0x55'));return _0x2b5fce;})[_0xa4d6('0x20')](function(_0x52442b){var _0x2f2767=_0x52442b[_0xa4d6('0x46')];logger[_0xa4d6('0x56')](_0xa4d6('0x57'),_0x2f2767);if(!_[_0xa4d6('0x58')](_0x52442b[_0xa4d6('0x46')])&&fs['existsSync'](_0x2f2767)){logger[_0xa4d6('0x56')](_0xa4d6('0x59')+_0x2f2767+_0xa4d6('0x5a'));fs[_0xa4d6('0x5b')](_0x2f2767);}_0x2f2767=_0x2f2767+_0xa4d6('0x5c');if(!_[_0xa4d6('0x58')](_0x52442b[_0xa4d6('0x46')])&&fs['existsSync'](_0x2f2767)){logger[_0xa4d6('0x56')]('File:\x20\x22'+_0x2f2767+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa4d6('0x5b')](_0x2f2767);}return _0x52442b;})[_0xa4d6('0x20')](function(_0x4df01b){if(!_0x4df01b)throw new InternalError();return _0x4df01b[_0xa4d6('0x54')]();})['then'](function(){_0x42dec3[_0xa4d6('0x17')](0xcc)[_0xa4d6('0x16')]();})['catch'](handleError(_0x42dec3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8e641fc..b841fb1 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 _0x53b3=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53b3,0x1b5));var _0x353b=function(_0x5efbf8,_0x334430){_0x5efbf8=_0x5efbf8-0x0;var _0x57f96e=_0x53b3[_0x5efbf8];return _0x57f96e;};'use strict';var _=require(_0x353b('0x0'));var util=require(_0x353b('0x1'));var logger=require(_0x353b('0x2'))(_0x353b('0x3'));var moment=require('moment');var BPromise=require(_0x353b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x353b('0x5'));var rimraf=require(_0x353b('0x6'));var config=require(_0x353b('0x7'));var attributes=require(_0x353b('0x8'));module[_0x353b('0x9')]=function(_0x414518,_0x294738){return _0x414518[_0x353b('0xa')](_0x353b('0xb'),attributes,{'tableName':_0x353b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee3c=['lodash','util','moment','request-promise','path','rimraf','exports','define','SquareRecording','square_recordings'];(function(_0x3c9f6a,_0x50f33c){var _0x1f679b=function(_0x373871){while(--_0x373871){_0x3c9f6a['push'](_0x3c9f6a['shift']());}};_0x1f679b(++_0x50f33c);}(_0xee3c,0x1a4));var _0xcee3=function(_0xa4ff0e,_0x577247){_0xa4ff0e=_0xa4ff0e-0x0;var _0x397ab=_0xee3c[_0xa4ff0e];return _0x397ab;};'use strict';var _=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcee3('0x2'));var BPromise=require('bluebird');var rp=require(_0xcee3('0x3'));var fs=require('fs');var path=require(_0xcee3('0x4'));var rimraf=require(_0xcee3('0x5'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xcee3('0x6')]=function(_0x4aa568,_0x5ceb51){return _0x4aa568[_0xcee3('0x7')](_0xcee3('0x8'),attributes,{'tableName':_0xcee3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 98f6209..aa04d04 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 _0x4fbc=['client','http','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2f3999,_0x5eab0f){var _0x58776b=function(_0x2745f3){while(--_0x2745f3){_0x2f3999['push'](_0x2f3999['shift']());}};_0x58776b(++_0x5eab0f);}(_0x4fbc,0x1df));var _0xc4fb=function(_0x20b809,_0x148d71){_0x20b809=_0x20b809-0x0;var _0x381d38=_0x4fbc[_0x20b809];return _0x381d38;};'use strict';var _=require(_0xc4fb('0x0'));var util=require(_0xc4fb('0x1'));var moment=require(_0xc4fb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4fb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4fb('0x4'))(_0xc4fb('0x5'));var config=require(_0xc4fb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc4fb('0x7')][_0xc4fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3cbea7,_0x5e8284,_0x5cd7ae){return new BPromise(function(_0x28759b,_0x5c13fc){return client[_0xc4fb('0x9')](_0x3cbea7,_0x5cd7ae)[_0xc4fb('0xa')](function(_0x406325){logger['info'](_0xc4fb('0xb'),_0x5e8284,'request\x20sent');logger[_0xc4fb('0xc')](_0xc4fb('0xd'),_0x5e8284,_0xc4fb('0xe'),JSON[_0xc4fb('0xf')](_0x406325));if(_0x406325['error']){if(_0x406325[_0xc4fb('0x10')][_0xc4fb('0x11')]===0x1f4){logger['error'](_0xc4fb('0xb'),_0x5e8284,_0x406325[_0xc4fb('0x10')][_0xc4fb('0x12')]);return _0x5c13fc(_0x406325[_0xc4fb('0x10')][_0xc4fb('0x12')]);}logger[_0xc4fb('0x10')](_0xc4fb('0xb'),_0x5e8284,_0x406325[_0xc4fb('0x10')][_0xc4fb('0x12')]);return _0x28759b(_0x406325[_0xc4fb('0x10')][_0xc4fb('0x12')]);}else{logger[_0xc4fb('0x13')](_0xc4fb('0xb'),_0x5e8284,_0xc4fb('0xe'));_0x28759b(_0x406325[_0xc4fb('0x14')][_0xc4fb('0x12')]);}})[_0xc4fb('0x15')](function(_0x56cb1e){logger[_0xc4fb('0x10')]('SquareRecording,\x20%s,\x20%s',_0x5e8284,_0x56cb1e);_0x5c13fc(_0x56cb1e);});});}exports[_0xc4fb('0x16')]=function(_0x48e4dd){var _0x4c7279=this;return new Promise(function(_0x5ac870,_0x59ba3d){return db[_0xc4fb('0x17')]['create'](_0x48e4dd[_0xc4fb('0x18')],{'raw':_0x48e4dd[_0xc4fb('0x19')]?_0x48e4dd['options'][_0xc4fb('0x1a')]===undefined?!![]:![]:!![]})[_0xc4fb('0xa')](function(_0x182658){logger[_0xc4fb('0x13')](_0xc4fb('0x16'),_0x48e4dd);logger['debug'](_0xc4fb('0x16'),_0x48e4dd,JSON[_0xc4fb('0xf')](_0x182658));_0x5ac870(_0x182658);})['catch'](function(_0x4e8779){logger['error'](_0xc4fb('0x16'),_0x4e8779[_0xc4fb('0x12')],_0x48e4dd);_0x59ba3d(_0x4c7279[_0xc4fb('0x10')](0x1f4,_0x4e8779[_0xc4fb('0x12')]));});});}; \ No newline at end of file +var _0x2045=['create','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','SquareRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','CreateSquareRecording','SquareRecording'];(function(_0x5d967b,_0x32b32b){var _0x319e03=function(_0x2d014e){while(--_0x2d014e){_0x5d967b['push'](_0x5d967b['shift']());}};_0x319e03(++_0x32b32b);}(_0x2045,0x189));var _0x5204=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2045[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5204('0x0'));var util=require(_0x5204('0x1'));var moment=require(_0x5204('0x2'));var BPromise=require(_0x5204('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5204('0x4'));var db=require(_0x5204('0x5'))['db'];var utils=require(_0x5204('0x6'));var logger=require('../../config/logger')(_0x5204('0x7'));var config=require(_0x5204('0x8'));var jayson=require(_0x5204('0x9'));var client=jayson[_0x5204('0xa')][_0x5204('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x257084,_0x28d783,_0x24769a){return new BPromise(function(_0x98fe3a,_0x4d1d20){return client['request'](_0x257084,_0x24769a)['then'](function(_0x250c02){logger[_0x5204('0xc')](_0x5204('0xd'),_0x28d783,'request\x20sent');logger[_0x5204('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x28d783,'request\x20sent',JSON[_0x5204('0xf')](_0x250c02));if(_0x250c02[_0x5204('0x10')]){if(_0x250c02['error'][_0x5204('0x11')]===0x1f4){logger['error'](_0x5204('0xd'),_0x28d783,_0x250c02[_0x5204('0x10')][_0x5204('0x12')]);return _0x4d1d20(_0x250c02[_0x5204('0x10')][_0x5204('0x12')]);}logger[_0x5204('0x10')](_0x5204('0xd'),_0x28d783,_0x250c02[_0x5204('0x10')][_0x5204('0x12')]);return _0x98fe3a(_0x250c02[_0x5204('0x10')][_0x5204('0x12')]);}else{logger[_0x5204('0xc')](_0x5204('0xd'),_0x28d783,_0x5204('0x13'));_0x98fe3a(_0x250c02['result'][_0x5204('0x12')]);}})[_0x5204('0x14')](function(_0x124020){logger[_0x5204('0x10')](_0x5204('0xd'),_0x28d783,_0x124020);_0x4d1d20(_0x124020);});});}exports[_0x5204('0x15')]=function(_0x2ed7f3){var _0x5ed8be=this;return new Promise(function(_0x561568,_0x57db55){return db[_0x5204('0x16')][_0x5204('0x17')](_0x2ed7f3['body'],{'raw':_0x2ed7f3[_0x5204('0x18')]?_0x2ed7f3['options'][_0x5204('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x50926f){logger['info'](_0x5204('0x15'),_0x2ed7f3);logger[_0x5204('0xe')](_0x5204('0x15'),_0x2ed7f3,JSON[_0x5204('0xf')](_0x50926f));_0x561568(_0x50926f);})[_0x5204('0x14')](function(_0x2b79e8){logger[_0x5204('0x10')]('CreateSquareRecording',_0x2b79e8[_0x5204('0x12')],_0x2ed7f3);_0x57db55(_0x5ed8be[_0x5204('0x10')](0x1f4,_0x2b79e8[_0x5204('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 89b2943..4439f5f 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 _0xe162=['create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareReport.controller','/describe','isAuthenticated','describe','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe162,0x95));var _0x2e16=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe162[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x2e16('0x0'));var util=require(_0x2e16('0x1'));var path=require(_0x2e16('0x2'));var timeout=require(_0x2e16('0x3'));var express=require(_0x2e16('0x4'));var router=express['Router']();var auth=require(_0x2e16('0x5'));var interaction=require(_0x2e16('0x6'));var config=require('../../config/environment');var controller=require(_0x2e16('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2e16('0x8'),auth[_0x2e16('0x9')](),controller[_0x2e16('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2e16('0xb')]);router[_0x2e16('0xc')]('/',auth['isAuthenticated'](),controller[_0x2e16('0xd')]);router[_0x2e16('0xe')](_0x2e16('0xf'),auth[_0x2e16('0x9')](),controller[_0x2e16('0x10')]);router['delete'](_0x2e16('0xf'),auth[_0x2e16('0x9')](),controller[_0x2e16('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0ffd=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','exports','multer','path','connect-timeout'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x0ffd,0x153));var _0xd0ff=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0ffd[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0xd0ff('0x0'));var util=require('util');var path=require(_0xd0ff('0x1'));var timeout=require(_0xd0ff('0x2'));var express=require('express');var router=express[_0xd0ff('0x3')]();var auth=require(_0xd0ff('0x4'));var interaction=require(_0xd0ff('0x5'));var config=require(_0xd0ff('0x6'));var controller=require(_0xd0ff('0x7'));router[_0xd0ff('0x8')]('/',auth[_0xd0ff('0x9')](),controller[_0xd0ff('0xa')]);router[_0xd0ff('0x8')](_0xd0ff('0xb'),auth['isAuthenticated'](),controller[_0xd0ff('0xc')]);router[_0xd0ff('0x8')](_0xd0ff('0xd'),auth[_0xd0ff('0x9')](),controller[_0xd0ff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd0ff('0xf')](_0xd0ff('0xd'),auth['isAuthenticated'](),controller[_0xd0ff('0x10')]);router['delete'](_0xd0ff('0xd'),auth[_0xd0ff('0x9')](),controller['destroy']);module[_0xd0ff('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 14eb6ef..6a21040 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 _0x3b9a=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3b9a,0x1d5));var _0xa3b9=function(_0x45e9b4,_0x4133e3){_0x45e9b4=_0x45e9b4-0x0;var _0xdcf7fd=_0x3b9a[_0x45e9b4];return _0xdcf7fd;};'use strict';var Sequelize=require(_0xa3b9('0x0'));module[_0xa3b9('0x1')]={'network':{'type':Sequelize[_0xa3b9('0x2')]},'network_script':{'type':Sequelize[_0xa3b9('0x2')]},'request':{'type':Sequelize[_0xa3b9('0x2')]},'channel':{'type':Sequelize[_0xa3b9('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xa3b9('0x2')]},'callerid':{'type':Sequelize[_0xa3b9('0x2')]},'calleridname':{'type':Sequelize[_0xa3b9('0x2')]},'callingpres':{'type':Sequelize[_0xa3b9('0x2')]},'callingani2':{'type':Sequelize[_0xa3b9('0x2')]},'callington':{'type':Sequelize[_0xa3b9('0x2')]},'callingtns':{'type':Sequelize[_0xa3b9('0x2')]},'dnid':{'type':Sequelize[_0xa3b9('0x2')]},'rdnis':{'type':Sequelize[_0xa3b9('0x2')]},'context':{'type':Sequelize[_0xa3b9('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa3b9('0x2')]},'enhanced':{'type':Sequelize[_0xa3b9('0x2')]},'accountcode':{'type':Sequelize[_0xa3b9('0x2')]},'threadid':{'type':Sequelize[_0xa3b9('0x2')]},'project_name':{'type':Sequelize[_0xa3b9('0x2')]},'joinAt':{'type':Sequelize[_0xa3b9('0x3')]},'leaveAt':{'type':Sequelize[_0xa3b9('0x3')]},'bot':{'type':Sequelize[_0xa3b9('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x1297=['STRING','DATE','BOOLEAN','exports'];(function(_0x13b230,_0x5c16e4){var _0x1b8ce2=function(_0x536630){while(--_0x536630){_0x13b230['push'](_0x13b230['shift']());}};_0x1b8ce2(++_0x5c16e4);}(_0x1297,0x17f));var _0x7129=function(_0x32feeb,_0x2a65bd){_0x32feeb=_0x32feeb-0x0;var _0x52b366=_0x1297[_0x32feeb];return _0x52b366;};'use strict';var Sequelize=require('sequelize');module[_0x7129('0x0')]={'network':{'type':Sequelize[_0x7129('0x1')]},'network_script':{'type':Sequelize[_0x7129('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7129('0x1')]},'language':{'type':Sequelize[_0x7129('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x7129('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7129('0x1')]},'callingpres':{'type':Sequelize[_0x7129('0x1')]},'callingani2':{'type':Sequelize[_0x7129('0x1')]},'callington':{'type':Sequelize[_0x7129('0x1')]},'callingtns':{'type':Sequelize[_0x7129('0x1')]},'dnid':{'type':Sequelize[_0x7129('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7129('0x1')]},'extension':{'type':Sequelize[_0x7129('0x1')]},'priority':{'type':Sequelize[_0x7129('0x1')]},'enhanced':{'type':Sequelize[_0x7129('0x1')]},'accountcode':{'type':Sequelize[_0x7129('0x1')]},'threadid':{'type':Sequelize[_0x7129('0x1')]},'project_name':{'type':Sequelize[_0x7129('0x1')]},'joinAt':{'type':Sequelize[_0x7129('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x7129('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 2cbd87b..2081da5 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 _0xc35c=['options','count','includeAll','include','rows','catch','merge','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','SquareReport','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','type','VIRTUAL'];(function(_0x5edae6,_0x3b4a19){var _0x1490a2=function(_0x16a961){while(--_0x16a961){_0x5edae6['push'](_0x5edae6['shift']());}};_0x1490a2(++_0x3b4a19);}(_0xc35c,0xa0));var _0xcc35=function(_0x337804,_0x490a9a){_0x337804=_0x337804-0x0;var _0x30e983=_0xc35c[_0x337804];return _0x30e983;};'use strict';var pdf=require(_0xcc35('0x0'));var emlformat=require(_0xcc35('0x1'));var rimraf=require(_0xcc35('0x2'));var zipdir=require(_0xcc35('0x3'));var jsonpatch=require(_0xcc35('0x4'));var rp=require(_0xcc35('0x5'));var moment=require(_0xcc35('0x6'));var BPromise=require(_0xcc35('0x7'));var Mustache=require(_0xcc35('0x8'));var util=require(_0xcc35('0x9'));var path=require(_0xcc35('0xa'));var sox=require('sox');var csv=require(_0xcc35('0xb'));var ejs=require(_0xcc35('0xc'));var fs=require('fs');var _=require(_0xcc35('0xd'));var squel=require('squel');var crypto=require(_0xcc35('0xe'));var jsforce=require(_0xcc35('0xf'));var deskjs=require(_0xcc35('0x10'));var toCsv=require(_0xcc35('0xb'));var querystring=require(_0xcc35('0x11'));var Papa=require(_0xcc35('0x12'));var Redis=require(_0xcc35('0x13'));var authService=require(_0xcc35('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc35('0x15'));var logger=require(_0xcc35('0x16'))(_0xcc35('0x17'));var utils=require('../../config/utils');var config=require(_0xcc35('0x18'));var db=require(_0xcc35('0x19'))['db'];function respondWithStatusCode(_0x39ffe1,_0x1ac351){_0x1ac351=_0x1ac351||0xcc;return function(_0x25b558){if(_0x25b558){return _0x39ffe1['sendStatus'](_0x1ac351);}return _0x39ffe1['status'](_0x1ac351)[_0xcc35('0x1a')]();};}function respondWithResult(_0x2d9271,_0x9ca248){_0x9ca248=_0x9ca248||0xc8;return function(_0x1216f3){if(_0x1216f3){return _0x2d9271['status'](_0x9ca248)['json'](_0x1216f3);}};}function respondWithFilteredResult(_0x29730a,_0x49f3c2){return function(_0x7ed919){if(_0x7ed919){var _0x2d8fc8=_0x7ed919['count'],_0x39423c=_0x49f3c2['offset'],_0x475cb4=_0x49f3c2[_0xcc35('0x1b')]+_0x49f3c2['limit'],_0x368c73;if(_0x475cb4>=_0x2d8fc8){_0x475cb4=_0x2d8fc8;_0x368c73=0xc8;}else{_0x368c73=0xce;}_0x29730a[_0xcc35('0x1c')](_0x368c73);return _0x29730a[_0xcc35('0x1d')](_0xcc35('0x1e'),_0x39423c+'-'+_0x475cb4+'/'+_0x2d8fc8)[_0xcc35('0x1f')](_0x7ed919);}return null;};}function patchUpdates(_0x167aad){return function(_0x1ff161){try{jsonpatch[_0xcc35('0x20')](_0x1ff161,_0x167aad,!![]);}catch(_0x5e0498){return BPromise[_0xcc35('0x21')](_0x5e0498);}return _0x1ff161[_0xcc35('0x22')]();};}function saveUpdates(_0xb396a9,_0x142509){return function(_0x54df94){if(_0x54df94){return _0x54df94[_0xcc35('0x23')](_0xb396a9)[_0xcc35('0x24')](function(_0x6638c4){return _0x6638c4;});}return null;};}function removeEntity(_0x283182,_0x5b1df7){return function(_0x217cb9){if(_0x217cb9){return _0x217cb9[_0xcc35('0x25')]()[_0xcc35('0x24')](function(){_0x283182[_0xcc35('0x1c')](0xcc)[_0xcc35('0x1a')]();});}};}function handleEntityNotFound(_0x4c7af8,_0x55bcbb){return function(_0x26e21d){if(!_0x26e21d){_0x4c7af8[_0xcc35('0x26')](0x194);}return _0x26e21d;};}function handleError(_0x185467,_0x4b6eb7){_0x4b6eb7=_0x4b6eb7||0x1f4;return function(_0x1c149e){logger['error'](_0x1c149e['stack']);if(_0x1c149e[_0xcc35('0x27')]){delete _0x1c149e[_0xcc35('0x27')];}_0x185467[_0xcc35('0x1c')](_0x4b6eb7)[_0xcc35('0x28')](_0x1c149e);};}exports[_0xcc35('0x29')]=function(_0x409689,_0x1d9a89){var _0x545bd2={},_0x480476={},_0x2aeeab={'count':0x0,'rows':[]};var _0x408a9f=_['map'](db[_0xcc35('0x2a')][_0xcc35('0x2b')],function(_0x39dce9){return{'name':_0x39dce9[_0xcc35('0x2c')],'type':_0x39dce9['type']['key']};});_0x480476[_0xcc35('0x2d')]=_[_0xcc35('0x2e')](_0x408a9f,_0xcc35('0x27'));_0x480476[_0xcc35('0x2f')]=_[_0xcc35('0x30')](_0x409689[_0xcc35('0x2f')]);_0x480476['filters']=_[_0xcc35('0x31')](_0x480476['model'],_0x480476[_0xcc35('0x2f')]);_0x545bd2[_0xcc35('0x32')]=_[_0xcc35('0x31')](_0x480476['model'],qs[_0xcc35('0x33')](_0x409689[_0xcc35('0x2f')][_0xcc35('0x33')]));_0x545bd2[_0xcc35('0x32')]=_0x545bd2[_0xcc35('0x32')][_0xcc35('0x34')]?_0x545bd2[_0xcc35('0x32')]:_0x480476['model'];if(!_0x409689[_0xcc35('0x2f')][_0xcc35('0x35')](_0xcc35('0x36'))){_0x545bd2[_0xcc35('0x37')]=qs[_0xcc35('0x37')](_0x409689['query'][_0xcc35('0x37')]);_0x545bd2['offset']=qs[_0xcc35('0x1b')](_0x409689['query'][_0xcc35('0x1b')]);}_0x545bd2['order']=qs['sort'](_0x409689[_0xcc35('0x2f')][_0xcc35('0x38')]);_0x545bd2[_0xcc35('0x39')]=qs[_0xcc35('0x3a')](_['pick'](_0x409689[_0xcc35('0x2f')],_0x480476['filters']),_0x408a9f);if(_0x409689[_0xcc35('0x2f')][_0xcc35('0x3b')]){_0x545bd2[_0xcc35('0x39')]=_['merge'](_0x545bd2[_0xcc35('0x39')],{'$or':_[_0xcc35('0x2e')](_0x408a9f,function(_0x758090){if(_0x758090[_0xcc35('0x3c')]!==_0xcc35('0x3d')){var _0x2974bc={};_0x2974bc[_0x758090[_0xcc35('0x27')]]={'$like':'%'+_0x409689[_0xcc35('0x2f')]['filter']+'%'};return _0x2974bc;}})});}_0x545bd2=_['merge']({},_0x545bd2,_0x409689[_0xcc35('0x3e')]);var _0x1e3d26={'where':_0x545bd2['where']};return db['SquareReport'][_0xcc35('0x3f')](_0x1e3d26)[_0xcc35('0x24')](function(_0x188f01){_0x2aeeab['count']=_0x188f01;if(_0x409689[_0xcc35('0x2f')][_0xcc35('0x40')]){_0x545bd2[_0xcc35('0x41')]=[{'all':!![]}];}return db[_0xcc35('0x2a')]['findAll'](_0x545bd2);})[_0xcc35('0x24')](function(_0x41e8aa){_0x2aeeab[_0xcc35('0x42')]=_0x41e8aa;return _0x2aeeab;})[_0xcc35('0x24')](respondWithFilteredResult(_0x1d9a89,_0x545bd2))[_0xcc35('0x43')](handleError(_0x1d9a89,null));};exports['show']=function(_0x56f05a,_0x33cabc){var _0x3ba05={'raw':!![],'where':{'id':_0x56f05a['params']['id']}},_0xffe9da={};_0xffe9da[_0xcc35('0x2d')]=_['keys'](db[_0xcc35('0x2a')][_0xcc35('0x2b')]);_0xffe9da['query']=_[_0xcc35('0x30')](_0x56f05a[_0xcc35('0x2f')]);_0xffe9da[_0xcc35('0x3a')]=_[_0xcc35('0x31')](_0xffe9da[_0xcc35('0x2d')],_0xffe9da[_0xcc35('0x2f')]);_0x3ba05['attributes']=_[_0xcc35('0x31')](_0xffe9da[_0xcc35('0x2d')],qs[_0xcc35('0x33')](_0x56f05a['query'][_0xcc35('0x33')]));_0x3ba05[_0xcc35('0x32')]=_0x3ba05[_0xcc35('0x32')][_0xcc35('0x34')]?_0x3ba05[_0xcc35('0x32')]:_0xffe9da[_0xcc35('0x2d')];if(_0x56f05a[_0xcc35('0x2f')][_0xcc35('0x40')]){_0x3ba05[_0xcc35('0x41')]=[{'all':!![]}];}_0x3ba05=_[_0xcc35('0x44')]({},_0x3ba05,_0x56f05a[_0xcc35('0x3e')]);return db[_0xcc35('0x2a')][_0xcc35('0x45')](_0x3ba05)[_0xcc35('0x24')](handleEntityNotFound(_0x33cabc,null))[_0xcc35('0x24')](respondWithResult(_0x33cabc,null))[_0xcc35('0x43')](handleError(_0x33cabc,null));};exports[_0xcc35('0x46')]=function(_0x447a8a,_0x33d35f){return db['SquareReport'][_0xcc35('0x46')](_0x447a8a[_0xcc35('0x47')],{})['then'](respondWithResult(_0x33d35f,0xc9))[_0xcc35('0x43')](handleError(_0x33d35f,null));};exports[_0xcc35('0x23')]=function(_0x155bc8,_0x517b4b){if(_0x155bc8[_0xcc35('0x47')]['id']){delete _0x155bc8[_0xcc35('0x47')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x155bc8[_0xcc35('0x48')]['id']}})[_0xcc35('0x24')](handleEntityNotFound(_0x517b4b,null))['then'](saveUpdates(_0x155bc8[_0xcc35('0x47')],null))[_0xcc35('0x24')](respondWithResult(_0x517b4b,null))['catch'](handleError(_0x517b4b,null));};exports[_0xcc35('0x25')]=function(_0x391159,_0x2b04bb){return db[_0xcc35('0x2a')]['find']({'where':{'id':_0x391159[_0xcc35('0x48')]['id']}})[_0xcc35('0x24')](handleEntityNotFound(_0x2b04bb,null))[_0xcc35('0x24')](removeEntity(_0x2b04bb,null))[_0xcc35('0x43')](handleError(_0x2b04bb,null));};exports[_0xcc35('0x49')]=function(_0x26c165,_0x1cf9df){return db[_0xcc35('0x2a')][_0xcc35('0x49')]()[_0xcc35('0x24')](respondWithResult(_0x1cf9df,null))[_0xcc35('0x43')](handleError(_0x1cf9df,null));}; \ No newline at end of file +var _0x356e=['index','map','SquareReport','rawAttributes','key','name','query','keys','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','params','length','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','count','offset','limit','set','Content-Range','json','apply','save','destroy','then','sendStatus','error','stack'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x356e,0x1d2));var _0xe356=function(_0x4e7987,_0x2b665b){_0x4e7987=_0x4e7987-0x0;var _0x153cbe=_0x356e[_0x4e7987];return _0x153cbe;};'use strict';var pdf=require(_0xe356('0x0'));var emlformat=require(_0xe356('0x1'));var rimraf=require(_0xe356('0x2'));var zipdir=require(_0xe356('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe356('0x4'));var moment=require('moment');var BPromise=require(_0xe356('0x5'));var Mustache=require(_0xe356('0x6'));var util=require(_0xe356('0x7'));var path=require(_0xe356('0x8'));var sox=require(_0xe356('0x9'));var csv=require(_0xe356('0xa'));var ejs=require(_0xe356('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe356('0xc'));var crypto=require(_0xe356('0xd'));var jsforce=require(_0xe356('0xe'));var deskjs=require(_0xe356('0xf'));var toCsv=require(_0xe356('0xa'));var querystring=require(_0xe356('0x10'));var Papa=require(_0xe356('0x11'));var Redis=require(_0xe356('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe356('0x13'));var as=require(_0xe356('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe356('0x15'))(_0xe356('0x16'));var utils=require(_0xe356('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10dde7,_0x27a819){_0x27a819=_0x27a819||0xcc;return function(_0x1f068c){if(_0x1f068c){return _0x10dde7['sendStatus'](_0x27a819);}return _0x10dde7[_0xe356('0x18')](_0x27a819)['end']();};}function respondWithResult(_0x4aae00,_0x2f0d19){_0x2f0d19=_0x2f0d19||0xc8;return function(_0x1a4b2c){if(_0x1a4b2c){return _0x4aae00['status'](_0x2f0d19)['json'](_0x1a4b2c);}};}function respondWithFilteredResult(_0x3b3c93,_0xc7ebed){return function(_0x3a7ab5){if(_0x3a7ab5){var _0x33b6dc=_0x3a7ab5[_0xe356('0x19')],_0xce9a7c=_0xc7ebed[_0xe356('0x1a')],_0x359cd7=_0xc7ebed['offset']+_0xc7ebed[_0xe356('0x1b')],_0x18f7e5;if(_0x359cd7>=_0x33b6dc){_0x359cd7=_0x33b6dc;_0x18f7e5=0xc8;}else{_0x18f7e5=0xce;}_0x3b3c93['status'](_0x18f7e5);return _0x3b3c93[_0xe356('0x1c')](_0xe356('0x1d'),_0xce9a7c+'-'+_0x359cd7+'/'+_0x33b6dc)[_0xe356('0x1e')](_0x3a7ab5);}return null;};}function patchUpdates(_0x40b74b){return function(_0x1b14a8){try{jsonpatch[_0xe356('0x1f')](_0x1b14a8,_0x40b74b,!![]);}catch(_0x67753a){return BPromise['reject'](_0x67753a);}return _0x1b14a8[_0xe356('0x20')]();};}function saveUpdates(_0x18af38,_0x1fa892){return function(_0x21360d){if(_0x21360d){return _0x21360d['update'](_0x18af38)['then'](function(_0x7beaaa){return _0x7beaaa;});}return null;};}function removeEntity(_0x37d261,_0x37c7fd){return function(_0x489ccd){if(_0x489ccd){return _0x489ccd[_0xe356('0x21')]()[_0xe356('0x22')](function(){_0x37d261[_0xe356('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20ea2a,_0x244e9d){return function(_0x1c03e2){if(!_0x1c03e2){_0x20ea2a[_0xe356('0x23')](0x194);}return _0x1c03e2;};}function handleError(_0x4caf5a,_0x3eccee){_0x3eccee=_0x3eccee||0x1f4;return function(_0x4779fc){logger[_0xe356('0x24')](_0x4779fc[_0xe356('0x25')]);if(_0x4779fc['name']){delete _0x4779fc['name'];}_0x4caf5a[_0xe356('0x18')](_0x3eccee)['send'](_0x4779fc);};}exports[_0xe356('0x26')]=function(_0xd10d25,_0x8aa094){var _0xa6f906={},_0x4481b9={},_0x569afd={'count':0x0,'rows':[]};var _0xc5abee=_[_0xe356('0x27')](db[_0xe356('0x28')][_0xe356('0x29')],function(_0x4eab73){return{'name':_0x4eab73['fieldName'],'type':_0x4eab73['type'][_0xe356('0x2a')]};});_0x4481b9['model']=_[_0xe356('0x27')](_0xc5abee,_0xe356('0x2b'));_0x4481b9[_0xe356('0x2c')]=_[_0xe356('0x2d')](_0xd10d25[_0xe356('0x2c')]);_0x4481b9[_0xe356('0x2e')]=_['intersection'](_0x4481b9['model'],_0x4481b9[_0xe356('0x2c')]);_0xa6f906[_0xe356('0x2f')]=_[_0xe356('0x30')](_0x4481b9['model'],qs[_0xe356('0x31')](_0xd10d25[_0xe356('0x2c')]['fields']));_0xa6f906['attributes']=_0xa6f906[_0xe356('0x2f')]['length']?_0xa6f906[_0xe356('0x2f')]:_0x4481b9[_0xe356('0x32')];if(!_0xd10d25['query'][_0xe356('0x33')](_0xe356('0x34'))){_0xa6f906[_0xe356('0x1b')]=qs[_0xe356('0x1b')](_0xd10d25[_0xe356('0x2c')][_0xe356('0x1b')]);_0xa6f906['offset']=qs['offset'](_0xd10d25['query'][_0xe356('0x1a')]);}_0xa6f906[_0xe356('0x35')]=qs[_0xe356('0x36')](_0xd10d25[_0xe356('0x2c')]['sort']);_0xa6f906[_0xe356('0x37')]=qs['filters'](_['pick'](_0xd10d25[_0xe356('0x2c')],_0x4481b9[_0xe356('0x2e')]),_0xc5abee);if(_0xd10d25['query']['filter']){_0xa6f906[_0xe356('0x37')]=_[_0xe356('0x38')](_0xa6f906[_0xe356('0x37')],{'$or':_[_0xe356('0x27')](_0xc5abee,function(_0x575007){if(_0x575007[_0xe356('0x39')]!==_0xe356('0x3a')){var _0x4b7ff5={};_0x4b7ff5[_0x575007[_0xe356('0x2b')]]={'$like':'%'+_0xd10d25[_0xe356('0x2c')][_0xe356('0x3b')]+'%'};return _0x4b7ff5;}})});}_0xa6f906=_['merge']({},_0xa6f906,_0xd10d25['options']);var _0x36b11e={'where':_0xa6f906[_0xe356('0x37')]};return db[_0xe356('0x28')][_0xe356('0x19')](_0x36b11e)[_0xe356('0x22')](function(_0x4b24e6){_0x569afd['count']=_0x4b24e6;if(_0xd10d25[_0xe356('0x2c')][_0xe356('0x3c')]){_0xa6f906[_0xe356('0x3d')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0xa6f906);})['then'](function(_0x16d908){_0x569afd[_0xe356('0x3e')]=_0x16d908;return _0x569afd;})['then'](respondWithFilteredResult(_0x8aa094,_0xa6f906))[_0xe356('0x3f')](handleError(_0x8aa094,null));};exports['show']=function(_0x886c4b,_0x4ef68c){var _0x4e0f79={'raw':!![],'where':{'id':_0x886c4b[_0xe356('0x40')]['id']}},_0x5be087={};_0x5be087[_0xe356('0x32')]=_[_0xe356('0x2d')](db[_0xe356('0x28')]['rawAttributes']);_0x5be087['query']=_[_0xe356('0x2d')](_0x886c4b[_0xe356('0x2c')]);_0x5be087[_0xe356('0x2e')]=_[_0xe356('0x30')](_0x5be087[_0xe356('0x32')],_0x5be087['query']);_0x4e0f79['attributes']=_[_0xe356('0x30')](_0x5be087[_0xe356('0x32')],qs[_0xe356('0x31')](_0x886c4b[_0xe356('0x2c')][_0xe356('0x31')]));_0x4e0f79[_0xe356('0x2f')]=_0x4e0f79[_0xe356('0x2f')][_0xe356('0x41')]?_0x4e0f79[_0xe356('0x2f')]:_0x5be087[_0xe356('0x32')];if(_0x886c4b[_0xe356('0x2c')][_0xe356('0x3c')]){_0x4e0f79[_0xe356('0x3d')]=[{'all':!![]}];}_0x4e0f79=_[_0xe356('0x38')]({},_0x4e0f79,_0x886c4b[_0xe356('0x42')]);return db[_0xe356('0x28')][_0xe356('0x43')](_0x4e0f79)[_0xe356('0x22')](handleEntityNotFound(_0x4ef68c,null))[_0xe356('0x22')](respondWithResult(_0x4ef68c,null))[_0xe356('0x3f')](handleError(_0x4ef68c,null));};exports[_0xe356('0x44')]=function(_0x6a4771,_0x25e9b7){return db['SquareReport'][_0xe356('0x44')](_0x6a4771[_0xe356('0x45')],{})[_0xe356('0x22')](respondWithResult(_0x25e9b7,0xc9))[_0xe356('0x3f')](handleError(_0x25e9b7,null));};exports[_0xe356('0x46')]=function(_0x39f360,_0x118d51){if(_0x39f360['body']['id']){delete _0x39f360[_0xe356('0x45')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x39f360[_0xe356('0x40')]['id']}})[_0xe356('0x22')](handleEntityNotFound(_0x118d51,null))[_0xe356('0x22')](saveUpdates(_0x39f360[_0xe356('0x45')],null))[_0xe356('0x22')](respondWithResult(_0x118d51,null))[_0xe356('0x3f')](handleError(_0x118d51,null));};exports['destroy']=function(_0x3d4142,_0xc95dd9){return db[_0xe356('0x28')]['find']({'where':{'id':_0x3d4142[_0xe356('0x40')]['id']}})[_0xe356('0x22')](handleEntityNotFound(_0xc95dd9,null))[_0xe356('0x22')](removeEntity(_0xc95dd9,null))['catch'](handleError(_0xc95dd9,null));};exports[_0xe356('0x47')]=function(_0x313de0,_0x17c018){return db['SquareReport'][_0xe356('0x47')]()[_0xe356('0x22')](respondWithResult(_0x17c018,null))[_0xe356('0x3f')](handleError(_0x17c018,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index eab2c3e..5997955 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 _0xdddd=['rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fcdc4,_0x23a840){var _0x45b3d0=function(_0x234247){while(--_0x234247){_0x4fcdc4['push'](_0x4fcdc4['shift']());}};_0x45b3d0(++_0x23a840);}(_0xdddd,0x17a));var _0xdddd=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xdddd[_0x398294];return _0x2a872d;};'use strict';var _=require(_0xdddd('0x0'));var util=require('util');var logger=require(_0xdddd('0x1'))(_0xdddd('0x2'));var moment=require(_0xdddd('0x3'));var BPromise=require(_0xdddd('0x4'));var rp=require(_0xdddd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdddd('0x6'));var config=require(_0xdddd('0x7'));var attributes=require(_0xdddd('0x8'));module[_0xdddd('0x9')]=function(_0x511df9,_0x518fc8){return _0x511df9[_0xdddd('0xa')](_0xdddd('0xb'),attributes,{'tableName':_0xdddd('0xc'),'paranoid':![],'indexes':[{'name':_0xdddd('0xd'),'fields':['uniqueid',_0xdddd('0xe')]},{'name':_0xdddd('0xf'),'fields':[_0xdddd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x910c=['path','rimraf','../../config/environment','./squareReport.attributes','exports','define','uniqueid','project_name','leaveAt','lodash','util','moment'];(function(_0x5d967b,_0x32b32b){var _0x319e03=function(_0x2d014e){while(--_0x2d014e){_0x5d967b['push'](_0x5d967b['shift']());}};_0x319e03(++_0x32b32b);}(_0x910c,0xa5));var _0xc910=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x910c[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0xc910('0x0'));var util=require(_0xc910('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc910('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc910('0x3'));var rimraf=require(_0xc910('0x4'));var config=require(_0xc910('0x5'));var attributes=require(_0xc910('0x6'));module[_0xc910('0x7')]=function(_0x31462a,_0x35a77f){return _0x31462a[_0xc910('0x8')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xc910('0x9'),_0xc910('0xa')]},{'name':_0xc910('0xb'),'fields':[_0xc910('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 7adf62f..14b7bc7 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 _0x360a=['client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3764c5,_0x526b87){var _0x3b5133=function(_0x3f870d){while(--_0x3f870d){_0x3764c5['push'](_0x3764c5['shift']());}};_0x3b5133(++_0x526b87);}(_0x360a,0x6d));var _0xa360=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x360a[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xa360('0x0'));var util=require('util');var moment=require(_0xa360('0x1'));var BPromise=require(_0xa360('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa360('0x3'));var db=require(_0xa360('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa360('0x5'))(_0xa360('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa360('0x7')][_0xa360('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c0da8,_0x28b8e8,_0x1e2744){return new BPromise(function(_0x34084d,_0x2ec2f9){return client[_0xa360('0x9')](_0x2c0da8,_0x1e2744)[_0xa360('0xa')](function(_0x5d12b3){logger['info'](_0xa360('0xb'),_0x28b8e8,_0xa360('0xc'));logger[_0xa360('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x28b8e8,_0xa360('0xc'),JSON[_0xa360('0xe')](_0x5d12b3));if(_0x5d12b3[_0xa360('0xf')]){if(_0x5d12b3['error'][_0xa360('0x10')]===0x1f4){logger['error'](_0xa360('0xb'),_0x28b8e8,_0x5d12b3[_0xa360('0xf')][_0xa360('0x11')]);return _0x2ec2f9(_0x5d12b3[_0xa360('0xf')]['message']);}logger['error'](_0xa360('0xb'),_0x28b8e8,_0x5d12b3[_0xa360('0xf')][_0xa360('0x11')]);return _0x34084d(_0x5d12b3['error'][_0xa360('0x11')]);}else{logger[_0xa360('0x12')]('SquareReport,\x20%s,\x20%s',_0x28b8e8,_0xa360('0xc'));_0x34084d(_0x5d12b3['result'][_0xa360('0x11')]);}})[_0xa360('0x13')](function(_0x51e208){logger['error'](_0xa360('0xb'),_0x28b8e8,_0x51e208);_0x2ec2f9(_0x51e208);});});}exports[_0xa360('0x14')]=function(_0x57e569){var _0x259725=this;return new Promise(function(_0x4db9c7,_0xc16229){return db['SquareReport'][_0xa360('0x15')](_0x57e569[_0xa360('0x16')],{'raw':_0x57e569[_0xa360('0x17')]?_0x57e569[_0xa360('0x17')][_0xa360('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x6bc61b){logger['info'](_0xa360('0x14'),_0x57e569);logger['debug']('CreateSquareReport',_0x57e569,JSON[_0xa360('0xe')](_0x6bc61b));_0x4db9c7(_0x6bc61b);})['catch'](function(_0xffdf5c){logger[_0xa360('0xf')](_0xa360('0x14'),_0xffdf5c[_0xa360('0x11')],_0x57e569);_0xc16229(_0x259725[_0xa360('0xf')](0x1f4,_0xffdf5c[_0xa360('0x11')]));});});};exports[_0xa360('0x19')]=function(_0x1d994e){var _0x35ed88=this;return new Promise(function(_0x270ab9,_0x212c84){return db[_0xa360('0x1a')][_0xa360('0x1b')](_0x1d994e[_0xa360('0x16')],{'raw':_0x1d994e['options']?_0x1d994e[_0xa360('0x17')][_0xa360('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d994e[_0xa360('0x17')]?_0x1d994e[_0xa360('0x17')]['where']||null:null,'attributes':_0x1d994e[_0xa360('0x17')]?_0x1d994e[_0xa360('0x17')][_0xa360('0x1c')]||null:null,'limit':_0x1d994e[_0xa360('0x17')]?_0x1d994e[_0xa360('0x17')]['limit']||null:null})[_0xa360('0xa')](function(_0x501f56){logger[_0xa360('0x12')](_0xa360('0x19'),_0x1d994e);logger[_0xa360('0xd')](_0xa360('0x19'),_0x1d994e,JSON[_0xa360('0xe')](_0x501f56));_0x270ab9(_0x501f56);})[_0xa360('0x13')](function(_0x4c2bbf){logger[_0xa360('0xf')]('UpdateSquareReport',_0x4c2bbf[_0xa360('0x11')],_0x1d994e);_0x212c84(_0x35ed88[_0xa360('0xf')](0x1f4,_0x4c2bbf[_0xa360('0x11')]));});});}; \ No newline at end of file +var _0x9eab=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','body','options','then','CreateSquareReport','update','where','attributes','limit','UpdateSquareReport','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x9eab,0x185));var _0xb9ea=function(_0x4780c6,_0xda74ff){_0x4780c6=_0x4780c6-0x0;var _0x1a4182=_0x9eab[_0x4780c6];return _0x1a4182;};'use strict';var _=require('lodash');var util=require(_0xb9ea('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb9ea('0x1'));var fs=require('fs');var Redis=require(_0xb9ea('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9ea('0x3'));var logger=require(_0xb9ea('0x4'))(_0xb9ea('0x5'));var config=require('../../config/environment');var jayson=require(_0xb9ea('0x6'));var client=jayson[_0xb9ea('0x7')][_0xb9ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e3edc,_0x4beafb,_0x322ae4){return new BPromise(function(_0x26b1f5,_0x3b756c){return client[_0xb9ea('0x9')](_0x5e3edc,_0x322ae4)['then'](function(_0x32b6e2){logger[_0xb9ea('0xa')](_0xb9ea('0xb'),_0x4beafb,_0xb9ea('0xc'));logger[_0xb9ea('0xd')](_0xb9ea('0xe'),_0x4beafb,_0xb9ea('0xc'),JSON[_0xb9ea('0xf')](_0x32b6e2));if(_0x32b6e2['error']){if(_0x32b6e2[_0xb9ea('0x10')][_0xb9ea('0x11')]===0x1f4){logger[_0xb9ea('0x10')](_0xb9ea('0xb'),_0x4beafb,_0x32b6e2['error'][_0xb9ea('0x12')]);return _0x3b756c(_0x32b6e2[_0xb9ea('0x10')][_0xb9ea('0x12')]);}logger[_0xb9ea('0x10')](_0xb9ea('0xb'),_0x4beafb,_0x32b6e2[_0xb9ea('0x10')]['message']);return _0x26b1f5(_0x32b6e2[_0xb9ea('0x10')][_0xb9ea('0x12')]);}else{logger[_0xb9ea('0xa')](_0xb9ea('0xb'),_0x4beafb,_0xb9ea('0xc'));_0x26b1f5(_0x32b6e2[_0xb9ea('0x13')]['message']);}})[_0xb9ea('0x14')](function(_0x21e106){logger['error'](_0xb9ea('0xb'),_0x4beafb,_0x21e106);_0x3b756c(_0x21e106);});});}exports['CreateSquareReport']=function(_0x418b6b){var _0x489e75=this;return new Promise(function(_0x2b5561,_0x4a5338){return db[_0xb9ea('0x15')]['create'](_0x418b6b[_0xb9ea('0x16')],{'raw':_0x418b6b[_0xb9ea('0x17')]?_0x418b6b[_0xb9ea('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xb9ea('0x18')](function(_0x303f55){logger[_0xb9ea('0xa')](_0xb9ea('0x19'),_0x418b6b);logger[_0xb9ea('0xd')]('CreateSquareReport',_0x418b6b,JSON[_0xb9ea('0xf')](_0x303f55));_0x2b5561(_0x303f55);})[_0xb9ea('0x14')](function(_0x1bac17){logger[_0xb9ea('0x10')](_0xb9ea('0x19'),_0x1bac17[_0xb9ea('0x12')],_0x418b6b);_0x4a5338(_0x489e75[_0xb9ea('0x10')](0x1f4,_0x1bac17['message']));});});};exports['UpdateSquareReport']=function(_0x3f5234){var _0x2e1a7a=this;return new Promise(function(_0x4ec7c7,_0x24c1e4){return db['SquareReport'][_0xb9ea('0x1a')](_0x3f5234[_0xb9ea('0x16')],{'raw':_0x3f5234['options']?_0x3f5234['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f5234[_0xb9ea('0x17')]?_0x3f5234[_0xb9ea('0x17')][_0xb9ea('0x1b')]||null:null,'attributes':_0x3f5234[_0xb9ea('0x17')]?_0x3f5234[_0xb9ea('0x17')][_0xb9ea('0x1c')]||null:null,'limit':_0x3f5234[_0xb9ea('0x17')]?_0x3f5234[_0xb9ea('0x17')][_0xb9ea('0x1d')]||null:null})[_0xb9ea('0x18')](function(_0x13e736){logger[_0xb9ea('0xa')]('UpdateSquareReport',_0x3f5234);logger[_0xb9ea('0xd')](_0xb9ea('0x1e'),_0x3f5234,JSON[_0xb9ea('0xf')](_0x13e736));_0x4ec7c7(_0x13e736);})['catch'](function(_0x4b17a2){logger[_0xb9ea('0x10')](_0xb9ea('0x1e'),_0x4b17a2['message'],_0x3f5234);_0x24c1e4(_0x2e1a7a[_0xb9ea('0x10')](0x1f4,_0x4b17a2[_0xb9ea('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 832955a..cccdb5a 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 _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(_0x5cb1a4,_0x31feaa){var _0x466c0b=function(_0x471b29){while(--_0x471b29){_0x5cb1a4['push'](_0x5cb1a4['shift']());}};_0x466c0b(++_0x31feaa);}(_0x5f2f,0x73));var _0xf5f2=function(_0x252085,_0x9b7770){_0x252085=_0x252085-0x0;var _0x5bf7ef=_0x5f2f[_0x252085];return _0x5bf7ef;};'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 +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x814b,0x1a2));var _0xb814=function(_0x42d1c8,_0xc13c44){_0x42d1c8=_0x42d1c8-0x0;var _0x22f990=_0x814b[_0x42d1c8];return _0x22f990;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 05043d7..5ba5fd0 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 _0x21c8=['exports','STRING','TEXT','sequelize'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x21c8,0x1e3));var _0x821c=function(_0x2b72ef,_0x574981){_0x2b72ef=_0x2b72ef-0x0;var _0x56a161=_0x21c8[_0x2b72ef];return _0x56a161;};'use strict';var Sequelize=require(_0x821c('0x0'));module[_0x821c('0x1')]={'uniqueid':{'type':Sequelize[_0x821c('0x2')]},'node':{'type':Sequelize[_0x821c('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x821c('0x3')]},'project_name':{'type':Sequelize[_0x821c('0x2')]},'callerid':{'type':Sequelize[_0x821c('0x2')]}}; \ No newline at end of file +var _0xf7d9=['exports','STRING','sequelize'];(function(_0x302601,_0x5e65f8){var _0x526400=function(_0x1d1e8f){while(--_0x1d1e8f){_0x302601['push'](_0x302601['shift']());}};_0x526400(++_0x5e65f8);}(_0xf7d9,0xd4));var _0x9f7d=function(_0x4495ea,_0x2cad8f){_0x4495ea=_0x4495ea-0x0;var _0x58a19d=_0xf7d9[_0x4495ea];return _0x58a19d;};'use strict';var Sequelize=require(_0x9f7d('0x0'));module[_0x9f7d('0x1')]={'uniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'node':{'type':Sequelize[_0x9f7d('0x2')]},'application':{'type':Sequelize[_0x9f7d('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x9f7d('0x2')]},'callerid':{'type':Sequelize[_0x9f7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index ba803b4..055768b 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 _0x004e=['Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','status','end','json','offset','limit','set'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x004e,0x112));var _0xe004=function(_0x254276,_0x368672){_0x254276=_0x254276-0x0;var _0x1d098d=_0x004e[_0x254276];return _0x1d098d;};'use strict';var pdf=require(_0xe004('0x0'));var emlformat=require(_0xe004('0x1'));var rimraf=require(_0xe004('0x2'));var zipdir=require(_0xe004('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe004('0x4'));var moment=require(_0xe004('0x5'));var BPromise=require(_0xe004('0x6'));var Mustache=require(_0xe004('0x7'));var util=require(_0xe004('0x8'));var path=require(_0xe004('0x9'));var sox=require(_0xe004('0xa'));var csv=require('to-csv');var ejs=require(_0xe004('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe004('0xc'));var crypto=require(_0xe004('0xd'));var jsforce=require(_0xe004('0xe'));var deskjs=require(_0xe004('0xf'));var toCsv=require(_0xe004('0x10'));var querystring=require(_0xe004('0x11'));var Papa=require(_0xe004('0x12'));var Redis=require('ioredis');var authService=require(_0xe004('0x13'));var qs=require(_0xe004('0x14'));var as=require(_0xe004('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe004('0x16'));var config=require(_0xe004('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2061ec,_0x57f1c9){_0x57f1c9=_0x57f1c9||0xcc;return function(_0x4f8624){if(_0x4f8624){return _0x2061ec['sendStatus'](_0x57f1c9);}return _0x2061ec[_0xe004('0x18')](_0x57f1c9)[_0xe004('0x19')]();};}function respondWithResult(_0x1f8b11,_0x2ad92b){_0x2ad92b=_0x2ad92b||0xc8;return function(_0x418a7c){if(_0x418a7c){return _0x1f8b11['status'](_0x2ad92b)[_0xe004('0x1a')](_0x418a7c);}};}function respondWithFilteredResult(_0x5259a6,_0x4c1cad){return function(_0xf0eff9){if(_0xf0eff9){var _0x12a3d6=_0xf0eff9['count'],_0x19a14b=_0x4c1cad[_0xe004('0x1b')],_0x146f31=_0x4c1cad[_0xe004('0x1b')]+_0x4c1cad[_0xe004('0x1c')],_0x423bd7;if(_0x146f31>=_0x12a3d6){_0x146f31=_0x12a3d6;_0x423bd7=0xc8;}else{_0x423bd7=0xce;}_0x5259a6['status'](_0x423bd7);return _0x5259a6[_0xe004('0x1d')](_0xe004('0x1e'),_0x19a14b+'-'+_0x146f31+'/'+_0x12a3d6)[_0xe004('0x1a')](_0xf0eff9);}return null;};}function patchUpdates(_0x22bc8f){return function(_0x265fe7){try{jsonpatch[_0xe004('0x1f')](_0x265fe7,_0x22bc8f,!![]);}catch(_0x52e38b){return BPromise[_0xe004('0x20')](_0x52e38b);}return _0x265fe7['save']();};}function saveUpdates(_0x2b5e97,_0x4b904a){return function(_0x4ee641){if(_0x4ee641){return _0x4ee641[_0xe004('0x21')](_0x2b5e97)[_0xe004('0x22')](function(_0x39d905){return _0x39d905;});}return null;};}function removeEntity(_0x31dc81,_0x149e25){return function(_0x42e81a){if(_0x42e81a){return _0x42e81a[_0xe004('0x23')]()[_0xe004('0x22')](function(){_0x31dc81[_0xe004('0x18')](0xcc)[_0xe004('0x19')]();});}};}function handleEntityNotFound(_0x1f88f8,_0xd11c92){return function(_0x53d0c2){if(!_0x53d0c2){_0x1f88f8[_0xe004('0x24')](0x194);}return _0x53d0c2;};}function handleError(_0x3d9b21,_0x95e580){_0x95e580=_0x95e580||0x1f4;return function(_0x4296d7){logger[_0xe004('0x25')](_0x4296d7['stack']);if(_0x4296d7[_0xe004('0x26')]){delete _0x4296d7['name'];}_0x3d9b21[_0xe004('0x18')](_0x95e580)[_0xe004('0x27')](_0x4296d7);};}exports[_0xe004('0x28')]=function(_0x531e23,_0x391862){var _0x1c4836={},_0x5d8f37={},_0xd6b891={'count':0x0,'rows':[]};var _0x4b115b=_[_0xe004('0x29')](db[_0xe004('0x2a')][_0xe004('0x2b')],function(_0xc72f98){return{'name':_0xc72f98[_0xe004('0x2c')],'type':_0xc72f98[_0xe004('0x2d')][_0xe004('0x2e')]};});_0x5d8f37[_0xe004('0x2f')]=_[_0xe004('0x29')](_0x4b115b,_0xe004('0x26'));_0x5d8f37[_0xe004('0x30')]=_[_0xe004('0x31')](_0x531e23[_0xe004('0x30')]);_0x5d8f37[_0xe004('0x32')]=_[_0xe004('0x33')](_0x5d8f37['model'],_0x5d8f37[_0xe004('0x30')]);_0x1c4836[_0xe004('0x34')]=_[_0xe004('0x33')](_0x5d8f37[_0xe004('0x2f')],qs[_0xe004('0x35')](_0x531e23[_0xe004('0x30')]['fields']));_0x1c4836[_0xe004('0x34')]=_0x1c4836[_0xe004('0x34')][_0xe004('0x36')]?_0x1c4836[_0xe004('0x34')]:_0x5d8f37[_0xe004('0x2f')];if(!_0x531e23[_0xe004('0x30')]['hasOwnProperty'](_0xe004('0x37'))){_0x1c4836['limit']=qs[_0xe004('0x1c')](_0x531e23[_0xe004('0x30')][_0xe004('0x1c')]);_0x1c4836[_0xe004('0x1b')]=qs[_0xe004('0x1b')](_0x531e23[_0xe004('0x30')][_0xe004('0x1b')]);}_0x1c4836[_0xe004('0x38')]=qs[_0xe004('0x39')](_0x531e23['query'][_0xe004('0x39')]);_0x1c4836[_0xe004('0x3a')]=qs[_0xe004('0x32')](_[_0xe004('0x3b')](_0x531e23[_0xe004('0x30')],_0x5d8f37[_0xe004('0x32')]),_0x4b115b);if(_0x531e23['query'][_0xe004('0x3c')]){_0x1c4836[_0xe004('0x3a')]=_[_0xe004('0x3d')](_0x1c4836[_0xe004('0x3a')],{'$or':_[_0xe004('0x29')](_0x4b115b,function(_0x411959){if(_0x411959[_0xe004('0x2d')]!==_0xe004('0x3e')){var _0x416bec={};_0x416bec[_0x411959['name']]={'$like':'%'+_0x531e23[_0xe004('0x30')][_0xe004('0x3c')]+'%'};return _0x416bec;}})});}_0x1c4836=_[_0xe004('0x3d')]({},_0x1c4836,_0x531e23[_0xe004('0x3f')]);var _0x1de834={'where':_0x1c4836['where']};return db[_0xe004('0x2a')][_0xe004('0x40')](_0x1de834)[_0xe004('0x22')](function(_0x4bdade){_0xd6b891['count']=_0x4bdade;if(_0x531e23[_0xe004('0x30')][_0xe004('0x41')]){_0x1c4836[_0xe004('0x42')]=[{'all':!![]}];}return db[_0xe004('0x2a')][_0xe004('0x43')](_0x1c4836);})['then'](function(_0x22ee9d){_0xd6b891[_0xe004('0x44')]=_0x22ee9d;return _0xd6b891;})[_0xe004('0x22')](respondWithFilteredResult(_0x391862,_0x1c4836))[_0xe004('0x45')](handleError(_0x391862,null));};exports[_0xe004('0x46')]=function(_0x38bfb2,_0x2d6f68){var _0x482835={'raw':!![],'where':{'id':_0x38bfb2[_0xe004('0x47')]['id']}},_0x5ee5cf={};_0x5ee5cf['model']=_[_0xe004('0x31')](db[_0xe004('0x2a')][_0xe004('0x2b')]);_0x5ee5cf[_0xe004('0x30')]=_[_0xe004('0x31')](_0x38bfb2[_0xe004('0x30')]);_0x5ee5cf[_0xe004('0x32')]=_[_0xe004('0x33')](_0x5ee5cf['model'],_0x5ee5cf[_0xe004('0x30')]);_0x482835[_0xe004('0x34')]=_[_0xe004('0x33')](_0x5ee5cf[_0xe004('0x2f')],qs[_0xe004('0x35')](_0x38bfb2[_0xe004('0x30')][_0xe004('0x35')]));_0x482835['attributes']=_0x482835[_0xe004('0x34')][_0xe004('0x36')]?_0x482835['attributes']:_0x5ee5cf[_0xe004('0x2f')];if(_0x38bfb2[_0xe004('0x30')][_0xe004('0x41')]){_0x482835[_0xe004('0x42')]=[{'all':!![]}];}_0x482835=_['merge']({},_0x482835,_0x38bfb2[_0xe004('0x3f')]);return db[_0xe004('0x2a')][_0xe004('0x48')](_0x482835)[_0xe004('0x22')](handleEntityNotFound(_0x2d6f68,null))[_0xe004('0x22')](respondWithResult(_0x2d6f68,null))[_0xe004('0x45')](handleError(_0x2d6f68,null));};exports[_0xe004('0x49')]=function(_0x4fb436,_0x590c50){return db[_0xe004('0x2a')][_0xe004('0x49')](_0x4fb436['body'],{})['then'](respondWithResult(_0x590c50,0xc9))[_0xe004('0x45')](handleError(_0x590c50,null));};exports[_0xe004('0x21')]=function(_0x469dba,_0x4b5c4d){if(_0x469dba[_0xe004('0x4a')]['id']){delete _0x469dba[_0xe004('0x4a')]['id'];}return db[_0xe004('0x2a')]['find']({'where':{'id':_0x469dba[_0xe004('0x47')]['id']}})[_0xe004('0x22')](handleEntityNotFound(_0x4b5c4d,null))[_0xe004('0x22')](saveUpdates(_0x469dba[_0xe004('0x4a')],null))['then'](respondWithResult(_0x4b5c4d,null))[_0xe004('0x45')](handleError(_0x4b5c4d,null));};exports[_0xe004('0x23')]=function(_0x3b01a6,_0x12f1c5){return db[_0xe004('0x2a')][_0xe004('0x48')]({'where':{'id':_0x3b01a6[_0xe004('0x47')]['id']}})['then'](handleEntityNotFound(_0x12f1c5,null))[_0xe004('0x22')](removeEntity(_0x12f1c5,null))[_0xe004('0x45')](handleError(_0x12f1c5,null));};exports[_0xe004('0x4b')]=function(_0x4f3448,_0x355683){return db[_0xe004('0x2a')]['describe']()[_0xe004('0x22')](respondWithResult(_0x355683,null))[_0xe004('0x45')](handleError(_0x355683,null));}; \ No newline at end of file +var _0x06f0=['where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','request-promise','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/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','reject','then','end','error','stack','name','send','map','SquareDetailsReport','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1bee73,_0x5b8829){var _0x1abf52=function(_0x38e606){while(--_0x38e606){_0x1bee73['push'](_0x1bee73['shift']());}};_0x1abf52(++_0x5b8829);}(_0x06f0,0x132));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x006f('0x0'));var rimraf=require(_0x006f('0x1'));var zipdir=require(_0x006f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x006f('0x3'));var moment=require('moment');var BPromise=require(_0x006f('0x4'));var Mustache=require(_0x006f('0x5'));var util=require(_0x006f('0x6'));var path=require(_0x006f('0x7'));var sox=require(_0x006f('0x8'));var csv=require(_0x006f('0x9'));var ejs=require(_0x006f('0xa'));var fs=require('fs');var _=require(_0x006f('0xb'));var squel=require(_0x006f('0xc'));var crypto=require(_0x006f('0xd'));var jsforce=require(_0x006f('0xe'));var deskjs=require(_0x006f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x006f('0x10'));var Papa=require('papaparse');var Redis=require(_0x006f('0x11'));var authService=require(_0x006f('0x12'));var qs=require(_0x006f('0x13'));var as=require(_0x006f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x006f('0x15'))(_0x006f('0x16'));var utils=require(_0x006f('0x17'));var config=require(_0x006f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x290be8,_0x2308df){_0x2308df=_0x2308df||0xcc;return function(_0x370945){if(_0x370945){return _0x290be8[_0x006f('0x19')](_0x2308df);}return _0x290be8[_0x006f('0x1a')](_0x2308df)['end']();};}function respondWithResult(_0x2b709c,_0x3c33d7){_0x3c33d7=_0x3c33d7||0xc8;return function(_0x58bd47){if(_0x58bd47){return _0x2b709c[_0x006f('0x1a')](_0x3c33d7)[_0x006f('0x1b')](_0x58bd47);}};}function respondWithFilteredResult(_0x224bb0,_0x36ae31){return function(_0x3a3ba9){if(_0x3a3ba9){var _0x2bd20d=_0x3a3ba9[_0x006f('0x1c')],_0x5ef450=_0x36ae31[_0x006f('0x1d')],_0x477053=_0x36ae31['offset']+_0x36ae31[_0x006f('0x1e')],_0x1c7dbf;if(_0x477053>=_0x2bd20d){_0x477053=_0x2bd20d;_0x1c7dbf=0xc8;}else{_0x1c7dbf=0xce;}_0x224bb0[_0x006f('0x1a')](_0x1c7dbf);return _0x224bb0['set'](_0x006f('0x1f'),_0x5ef450+'-'+_0x477053+'/'+_0x2bd20d)[_0x006f('0x1b')](_0x3a3ba9);}return null;};}function patchUpdates(_0x3066e5){return function(_0x34b35d){try{jsonpatch['apply'](_0x34b35d,_0x3066e5,!![]);}catch(_0x3d7505){return BPromise[_0x006f('0x20')](_0x3d7505);}return _0x34b35d['save']();};}function saveUpdates(_0x42f652,_0x275645){return function(_0x477588){if(_0x477588){return _0x477588['update'](_0x42f652)[_0x006f('0x21')](function(_0x36fba8){return _0x36fba8;});}return null;};}function removeEntity(_0x3e464b,_0x4d673b){return function(_0x58c627){if(_0x58c627){return _0x58c627['destroy']()[_0x006f('0x21')](function(){_0x3e464b[_0x006f('0x1a')](0xcc)[_0x006f('0x22')]();});}};}function handleEntityNotFound(_0x32b468,_0x1eeaf2){return function(_0x17488c){if(!_0x17488c){_0x32b468[_0x006f('0x19')](0x194);}return _0x17488c;};}function handleError(_0x27b3a9,_0x4533aa){_0x4533aa=_0x4533aa||0x1f4;return function(_0x4224b4){logger[_0x006f('0x23')](_0x4224b4[_0x006f('0x24')]);if(_0x4224b4[_0x006f('0x25')]){delete _0x4224b4[_0x006f('0x25')];}_0x27b3a9['status'](_0x4533aa)[_0x006f('0x26')](_0x4224b4);};}exports['index']=function(_0x34583f,_0x28b6d7){var _0x192862={},_0x3dfb42={},_0x569b19={'count':0x0,'rows':[]};var _0x497e77=_[_0x006f('0x27')](db[_0x006f('0x28')]['rawAttributes'],function(_0x371405){return{'name':_0x371405['fieldName'],'type':_0x371405[_0x006f('0x29')][_0x006f('0x2a')]};});_0x3dfb42[_0x006f('0x2b')]=_[_0x006f('0x27')](_0x497e77,_0x006f('0x25'));_0x3dfb42[_0x006f('0x2c')]=_['keys'](_0x34583f[_0x006f('0x2c')]);_0x3dfb42[_0x006f('0x2d')]=_['intersection'](_0x3dfb42['model'],_0x3dfb42[_0x006f('0x2c')]);_0x192862[_0x006f('0x2e')]=_[_0x006f('0x2f')](_0x3dfb42[_0x006f('0x2b')],qs[_0x006f('0x30')](_0x34583f[_0x006f('0x2c')]['fields']));_0x192862[_0x006f('0x2e')]=_0x192862[_0x006f('0x2e')][_0x006f('0x31')]?_0x192862[_0x006f('0x2e')]:_0x3dfb42['model'];if(!_0x34583f[_0x006f('0x2c')][_0x006f('0x32')](_0x006f('0x33'))){_0x192862[_0x006f('0x1e')]=qs[_0x006f('0x1e')](_0x34583f['query'][_0x006f('0x1e')]);_0x192862[_0x006f('0x1d')]=qs[_0x006f('0x1d')](_0x34583f['query']['offset']);}_0x192862[_0x006f('0x34')]=qs[_0x006f('0x35')](_0x34583f[_0x006f('0x2c')][_0x006f('0x35')]);_0x192862[_0x006f('0x36')]=qs[_0x006f('0x2d')](_[_0x006f('0x37')](_0x34583f[_0x006f('0x2c')],_0x3dfb42[_0x006f('0x2d')]),_0x497e77);if(_0x34583f['query'][_0x006f('0x38')]){_0x192862['where']=_[_0x006f('0x39')](_0x192862[_0x006f('0x36')],{'$or':_[_0x006f('0x27')](_0x497e77,function(_0x1b21ff){if(_0x1b21ff[_0x006f('0x29')]!==_0x006f('0x3a')){var _0x2a761b={};_0x2a761b[_0x1b21ff[_0x006f('0x25')]]={'$like':'%'+_0x34583f[_0x006f('0x2c')][_0x006f('0x38')]+'%'};return _0x2a761b;}})});}_0x192862=_['merge']({},_0x192862,_0x34583f[_0x006f('0x3b')]);var _0xceef31={'where':_0x192862['where']};return db[_0x006f('0x28')][_0x006f('0x1c')](_0xceef31)[_0x006f('0x21')](function(_0x54556e){_0x569b19['count']=_0x54556e;if(_0x34583f['query']['includeAll']){_0x192862[_0x006f('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x192862);})[_0x006f('0x21')](function(_0x26434e){_0x569b19[_0x006f('0x3d')]=_0x26434e;return _0x569b19;})[_0x006f('0x21')](respondWithFilteredResult(_0x28b6d7,_0x192862))[_0x006f('0x3e')](handleError(_0x28b6d7,null));};exports[_0x006f('0x3f')]=function(_0x437c1e,_0x18d0b0){var _0xbb8071={'raw':!![],'where':{'id':_0x437c1e[_0x006f('0x40')]['id']}},_0x2868dd={};_0x2868dd[_0x006f('0x2b')]=_[_0x006f('0x41')](db['SquareDetailsReport']['rawAttributes']);_0x2868dd[_0x006f('0x2c')]=_[_0x006f('0x41')](_0x437c1e[_0x006f('0x2c')]);_0x2868dd[_0x006f('0x2d')]=_[_0x006f('0x2f')](_0x2868dd['model'],_0x2868dd[_0x006f('0x2c')]);_0xbb8071['attributes']=_[_0x006f('0x2f')](_0x2868dd[_0x006f('0x2b')],qs['fields'](_0x437c1e['query'][_0x006f('0x30')]));_0xbb8071[_0x006f('0x2e')]=_0xbb8071['attributes'][_0x006f('0x31')]?_0xbb8071[_0x006f('0x2e')]:_0x2868dd['model'];if(_0x437c1e[_0x006f('0x2c')]['includeAll']){_0xbb8071[_0x006f('0x3c')]=[{'all':!![]}];}_0xbb8071=_['merge']({},_0xbb8071,_0x437c1e[_0x006f('0x3b')]);return db['SquareDetailsReport'][_0x006f('0x42')](_0xbb8071)[_0x006f('0x21')](handleEntityNotFound(_0x18d0b0,null))['then'](respondWithResult(_0x18d0b0,null))[_0x006f('0x3e')](handleError(_0x18d0b0,null));};exports[_0x006f('0x43')]=function(_0x855c95,_0x448a50){return db[_0x006f('0x28')]['create'](_0x855c95[_0x006f('0x44')],{})['then'](respondWithResult(_0x448a50,0xc9))[_0x006f('0x3e')](handleError(_0x448a50,null));};exports[_0x006f('0x45')]=function(_0x4857b0,_0xa0f4cb){if(_0x4857b0[_0x006f('0x44')]['id']){delete _0x4857b0['body']['id'];}return db['SquareDetailsReport'][_0x006f('0x42')]({'where':{'id':_0x4857b0['params']['id']}})[_0x006f('0x21')](handleEntityNotFound(_0xa0f4cb,null))[_0x006f('0x21')](saveUpdates(_0x4857b0[_0x006f('0x44')],null))[_0x006f('0x21')](respondWithResult(_0xa0f4cb,null))['catch'](handleError(_0xa0f4cb,null));};exports[_0x006f('0x46')]=function(_0x59d964,_0x3a169e){return db['SquareDetailsReport'][_0x006f('0x42')]({'where':{'id':_0x59d964[_0x006f('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a169e,null))[_0x006f('0x21')](removeEntity(_0x3a169e,null))[_0x006f('0x3e')](handleError(_0x3a169e,null));};exports[_0x006f('0x47')]=function(_0x445c45,_0x27ef95){return db['SquareDetailsReport'][_0x006f('0x47')]()[_0x006f('0x21')](respondWithResult(_0x27ef95,null))[_0x006f('0x3e')](handleError(_0x27ef95,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 8c05801..50a02f8 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 _0xa27d=['../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1e8476,_0x1935ab){var _0x4ea133=function(_0x3f4a84){while(--_0x3f4a84){_0x1e8476['push'](_0x1e8476['shift']());}};_0x4ea133(++_0x1935ab);}(_0xa27d,0x89));var _0xda27=function(_0x29c2a4,_0x3a839c){_0x29c2a4=_0x29c2a4-0x0;var _0x2d69fa=_0xa27d[_0x29c2a4];return _0x2d69fa;};'use strict';var _=require(_0xda27('0x0'));var util=require(_0xda27('0x1'));var logger=require(_0xda27('0x2'))('api');var moment=require('moment');var BPromise=require(_0xda27('0x3'));var rp=require(_0xda27('0x4'));var fs=require('fs');var path=require(_0xda27('0x5'));var rimraf=require('rimraf');var config=require(_0xda27('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0xda27('0x7')]=function(_0x2d746a,_0x5220ce){return _0x2d746a[_0xda27('0x8')](_0xda27('0x9'),attributes,{'tableName':_0xda27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf121=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api'];(function(_0x21b888,_0x437537){var _0x2267ca=function(_0x308d4e){while(--_0x308d4e){_0x21b888['push'](_0x21b888['shift']());}};_0x2267ca(++_0x437537);}(_0xf121,0x134));var _0x1f12=function(_0x5817a2,_0x1057ba){_0x5817a2=_0x5817a2-0x0;var _0x45fbe5=_0xf121[_0x5817a2];return _0x45fbe5;};'use strict';var _=require(_0x1f12('0x0'));var util=require(_0x1f12('0x1'));var logger=require(_0x1f12('0x2'))(_0x1f12('0x3'));var moment=require('moment');var BPromise=require(_0x1f12('0x4'));var rp=require(_0x1f12('0x5'));var fs=require('fs');var path=require(_0x1f12('0x6'));var rimraf=require(_0x1f12('0x7'));var config=require(_0x1f12('0x8'));var attributes=require(_0x1f12('0x9'));module[_0x1f12('0xa')]=function(_0x4511e8,_0x16ef3f){return _0x4511e8[_0x1f12('0xb')](_0x1f12('0xc'),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 64d0041..1ee3a96 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 _0x9785=['body','options','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x436749,_0x1dd59){var _0x35c8bb=function(_0x47ed47){while(--_0x47ed47){_0x436749['push'](_0x436749['shift']());}};_0x35c8bb(++_0x1dd59);}(_0x9785,0x17e));var _0x5978=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9785[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x5978('0x0'));var util=require('util');var moment=require(_0x5978('0x1'));var BPromise=require(_0x5978('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5978('0x3'));var db=require(_0x5978('0x4'))['db'];var utils=require(_0x5978('0x5'));var logger=require('../../config/logger')(_0x5978('0x6'));var config=require(_0x5978('0x7'));var jayson=require(_0x5978('0x8'));var client=jayson[_0x5978('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45efef,_0x2bc055,_0xddb846){return new BPromise(function(_0x174535,_0xd6a1ee){return client[_0x5978('0xa')](_0x45efef,_0xddb846)[_0x5978('0xb')](function(_0x446a0a){logger[_0x5978('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2bc055,_0x5978('0xd'));logger['debug'](_0x5978('0xe'),_0x2bc055,_0x5978('0xd'),JSON[_0x5978('0xf')](_0x446a0a));if(_0x446a0a[_0x5978('0x10')]){if(_0x446a0a[_0x5978('0x10')]['code']===0x1f4){logger[_0x5978('0x10')](_0x5978('0x11'),_0x2bc055,_0x446a0a[_0x5978('0x10')]['message']);return _0xd6a1ee(_0x446a0a[_0x5978('0x10')][_0x5978('0x12')]);}logger[_0x5978('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2bc055,_0x446a0a[_0x5978('0x10')][_0x5978('0x12')]);return _0x174535(_0x446a0a[_0x5978('0x10')][_0x5978('0x12')]);}else{logger[_0x5978('0xc')](_0x5978('0x11'),_0x2bc055,_0x5978('0xd'));_0x174535(_0x446a0a[_0x5978('0x13')][_0x5978('0x12')]);}})[_0x5978('0x14')](function(_0x3debea){logger[_0x5978('0x10')](_0x5978('0x11'),_0x2bc055,_0x3debea);_0xd6a1ee(_0x3debea);});});}exports[_0x5978('0x15')]=function(_0x3034b9){var _0x337a06=this;return new Promise(function(_0x1b38a3,_0x4e1a54){return db[_0x5978('0x16')]['create'](_0x3034b9[_0x5978('0x17')],{'raw':_0x3034b9[_0x5978('0x18')]?_0x3034b9[_0x5978('0x18')][_0x5978('0x19')]===undefined?!![]:![]:!![]})[_0x5978('0xb')](function(_0x56e2fd){logger[_0x5978('0xc')](_0x5978('0x15'),_0x3034b9);logger[_0x5978('0x1a')]('CreateSquareDetailsReport',_0x3034b9,JSON[_0x5978('0xf')](_0x56e2fd));_0x1b38a3(_0x56e2fd);})[_0x5978('0x14')](function(_0x674750){logger['error'](_0x5978('0x15'),_0x674750[_0x5978('0x12')],_0x3034b9);_0x4e1a54(_0x337a06[_0x5978('0x10')](0x1f4,_0x674750[_0x5978('0x12')]));});});}; \ No newline at end of file +var _0xf647=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x382d98,_0x2b92f3){var _0xc7ec28=function(_0x3a3661){while(--_0x3a3661){_0x382d98['push'](_0x382d98['shift']());}};_0xc7ec28(++_0x2b92f3);}(_0xf647,0x1e7));var _0x7f64=function(_0xfd2d14,_0x3baca2){_0xfd2d14=_0xfd2d14-0x0;var _0x3477cc=_0xf647[_0xfd2d14];return _0x3477cc;};'use strict';var _=require(_0x7f64('0x0'));var util=require(_0x7f64('0x1'));var moment=require(_0x7f64('0x2'));var BPromise=require(_0x7f64('0x3'));var rs=require(_0x7f64('0x4'));var fs=require('fs');var Redis=require(_0x7f64('0x5'));var db=require(_0x7f64('0x6'))['db'];var utils=require(_0x7f64('0x7'));var logger=require(_0x7f64('0x8'))(_0x7f64('0x9'));var config=require(_0x7f64('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7f64('0xb')][_0x7f64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d85a0,_0x49c4a7,_0x2d9a02){return new BPromise(function(_0x2b8689,_0x17cf75){return client['request'](_0x5d85a0,_0x2d9a02)['then'](function(_0x42c611){logger[_0x7f64('0xd')](_0x7f64('0xe'),_0x49c4a7,_0x7f64('0xf'));logger[_0x7f64('0x10')](_0x7f64('0x11'),_0x49c4a7,_0x7f64('0xf'),JSON['stringify'](_0x42c611));if(_0x42c611[_0x7f64('0x12')]){if(_0x42c611[_0x7f64('0x12')][_0x7f64('0x13')]===0x1f4){logger[_0x7f64('0x12')](_0x7f64('0xe'),_0x49c4a7,_0x42c611[_0x7f64('0x12')][_0x7f64('0x14')]);return _0x17cf75(_0x42c611[_0x7f64('0x12')][_0x7f64('0x14')]);}logger[_0x7f64('0x12')](_0x7f64('0xe'),_0x49c4a7,_0x42c611[_0x7f64('0x12')][_0x7f64('0x14')]);return _0x2b8689(_0x42c611['error']['message']);}else{logger[_0x7f64('0xd')](_0x7f64('0xe'),_0x49c4a7,_0x7f64('0xf'));_0x2b8689(_0x42c611['result'][_0x7f64('0x14')]);}})['catch'](function(_0xebc95f){logger[_0x7f64('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x49c4a7,_0xebc95f);_0x17cf75(_0xebc95f);});});}exports[_0x7f64('0x15')]=function(_0x47f814){var _0x3270d1=this;return new Promise(function(_0x11b576,_0x428f40){return db[_0x7f64('0x16')][_0x7f64('0x17')](_0x47f814[_0x7f64('0x18')],{'raw':_0x47f814[_0x7f64('0x19')]?_0x47f814[_0x7f64('0x19')][_0x7f64('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1e706f){logger[_0x7f64('0xd')](_0x7f64('0x15'),_0x47f814);logger[_0x7f64('0x10')]('CreateSquareDetailsReport',_0x47f814,JSON[_0x7f64('0x1b')](_0x1e706f));_0x11b576(_0x1e706f);})[_0x7f64('0x1c')](function(_0x2c1fcd){logger[_0x7f64('0x12')](_0x7f64('0x15'),_0x2c1fcd[_0x7f64('0x14')],_0x47f814);_0x428f40(_0x3270d1['error'](0x1f4,_0x2c1fcd['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ac9041b..f5004d7 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 _0xe808=['killProcess','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x4d661a,_0x524d8b){var _0x36a3c3=function(_0x5f4923){while(--_0x5f4923){_0x4d661a['push'](_0x4d661a['shift']());}};_0x36a3c3(++_0x524d8b);}(_0xe808,0x1e1));var _0x8e80=function(_0x1d35a5,_0xb694c0){_0x1d35a5=_0x1d35a5-0x0;var _0x120704=_0xe808[_0x1d35a5];return _0x120704;};'use strict';var express=require(_0x8e80('0x0'));var router=express[_0x8e80('0x1')]();var auth=require(_0x8e80('0x2'));var controller=require(_0x8e80('0x3'));router[_0x8e80('0x4')]('/',auth[_0x8e80('0x5')](),controller['index']);router[_0x8e80('0x4')](_0x8e80('0x6'),auth[_0x8e80('0x5')](),controller[_0x8e80('0x7')]);module['exports']=router; \ No newline at end of file +var _0x6d65=['../../components/auth/service','./system.controller','get','index','killProcess','exports','express','Router'];(function(_0x8a6f3f,_0x5ed954){var _0x5804ac=function(_0x465d75){while(--_0x465d75){_0x8a6f3f['push'](_0x8a6f3f['shift']());}};_0x5804ac(++_0x5ed954);}(_0x6d65,0x1de));var _0x56d6=function(_0x5f17ae,_0x58d378){_0x5f17ae=_0x5f17ae-0x0;var _0x5114ab=_0x6d65[_0x5f17ae];return _0x5114ab;};'use strict';var express=require(_0x56d6('0x0'));var router=express[_0x56d6('0x1')]();var auth=require(_0x56d6('0x2'));var controller=require(_0x56d6('0x3'));router[_0x56d6('0x4')]('/',auth['isAuthenticated'](),controller[_0x56d6('0x5')]);router[_0x56d6('0x4')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x56d6('0x6')]);module[_0x56d6('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 35adb41..019a888 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 _0xba0d=['indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','bluebird','inspect','name','status','send','then','catch','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xba0d,0x8e));var _0xdba0=function(_0x349d3f,_0xb3132c){_0x349d3f=_0x349d3f-0x0;var _0x328153=_0xba0d[_0x349d3f];return _0x328153;};'use strict';var info=require(_0xdba0('0x0'));var exec=require('child_process')[_0xdba0('0x1')];var logger=require(_0xdba0('0x2'))(_0xdba0('0x3'));var util=require('util');var BPromise=require(_0xdba0('0x4'));var _=require('lodash');function handleError(_0xebb600,_0x426cac,_0x6a96ad){_0x426cac=_0x426cac||0x1f4;return function(_0x8b0331){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x6a96ad,_0x426cac,util[_0xdba0('0x5')](_0x8b0331,{'showHidden':![],'depth':null}));delete _0x8b0331[_0xdba0('0x6')];_0xebb600[_0xdba0('0x7')](_0x426cac)[_0xdba0('0x8')](_0x8b0331);};}exports['index']=function(_0x3db492,_0x5d2ac2){return info['getAllData']()[_0xdba0('0x9')](function(_0x4d01a9){return _0x5d2ac2[_0xdba0('0x7')](0xc8)['json'](_0x4d01a9);})[_0xdba0('0xa')](function(_0x357072){return _0x5d2ac2[_0xdba0('0x7')](0x1f4)[_0xdba0('0xb')](_0x357072);});};exports[_0xdba0('0xc')]=function(_0x5da0ca,_0x24bf36){var _0x43ae3a=['components/import/cm'];return new BPromise(function(_0x49e581,_0x158cdf){return exec(util[_0xdba0('0xd')](_0xdba0('0xe'),_0x5da0ca[_0xdba0('0xf')][_0xdba0('0x10')]),function(_0x28da4c,_0x1077c2,_0x563983){if(_0x28da4c){return _0x158cdf(_0x28da4c);}return _0x49e581(_0x1077c2);});})[_0xdba0('0x9')](function(_0x722955){var _0x3e47da=![];var _0xb0ffc4=_0x722955[_0xdba0('0x11')](/\n/);for(var _0x1aee2d=0x0,_0x316a23=_0x43ae3a[_0xdba0('0x12')];_0x1aee2d<_0x316a23,_0x3e47da===![];_0x1aee2d+=0x1){if(_0x722955[_0xdba0('0x13')](_0x43ae3a[_0x1aee2d])>=0x0){_0x3e47da=!![];}}if(!_0x3e47da){throw new Error(util[_0xdba0('0xd')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5da0ca[_0xdba0('0xf')]['pid']));}process[_0xdba0('0x14')](_0x5da0ca[_0xdba0('0xf')][_0xdba0('0x10')],_0xdba0('0x15'));return _0x24bf36['status'](0xc8)['json']({'message':util[_0xdba0('0xd')](_0xdba0('0x16'),_0x5da0ca['params'][_0xdba0('0x10')])});})[_0xdba0('0xa')](handleError(_0x24bf36,null,_0xdba0('0xc')));}; \ No newline at end of file +var _0x97db=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','../../config/logger','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','json','catch','components/import/cm','format','params','pid','split','length','indexOf'];(function(_0x8b2208,_0x268679){var _0x2d1b39=function(_0x2cc02a){while(--_0x2cc02a){_0x8b2208['push'](_0x8b2208['shift']());}};_0x2d1b39(++_0x268679);}(_0x97db,0x18a));var _0xb97d=function(_0x31e89b,_0x17514f){_0x31e89b=_0x31e89b-0x0;var _0x1d2beb=_0x97db[_0x31e89b];return _0x1d2beb;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xb97d('0x0')];var logger=require(_0xb97d('0x1'))('api');var util=require(_0xb97d('0x2'));var BPromise=require(_0xb97d('0x3'));var _=require('lodash');function handleError(_0x51f9e4,_0x9e0944,_0x4e575c){_0x9e0944=_0x9e0944||0x1f4;return function(_0x1a4360){logger[_0xb97d('0x4')](_0xb97d('0x5'),_0x4e575c,_0x9e0944,util['inspect'](_0x1a4360,{'showHidden':![],'depth':null}));delete _0x1a4360[_0xb97d('0x6')];_0x51f9e4[_0xb97d('0x7')](_0x9e0944)[_0xb97d('0x8')](_0x1a4360);};}exports[_0xb97d('0x9')]=function(_0x361f6a,_0x1ebc2c){return info['getAllData']()[_0xb97d('0xa')](function(_0x3deb3c){return _0x1ebc2c[_0xb97d('0x7')](0xc8)[_0xb97d('0xb')](_0x3deb3c);})[_0xb97d('0xc')](function(_0x42349f){return _0x1ebc2c[_0xb97d('0x7')](0x1f4)['json'](_0x42349f);});};exports['killProcess']=function(_0x1764f1,_0x593db8){var _0x22976f=[_0xb97d('0xd')];return new BPromise(function(_0x5c44f6,_0x2fbf97){return exec(util[_0xb97d('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1764f1[_0xb97d('0xf')][_0xb97d('0x10')]),function(_0x30ce7e,_0x230450,_0x464a43){if(_0x30ce7e){return _0x2fbf97(_0x30ce7e);}return _0x5c44f6(_0x230450);});})['then'](function(_0x32f216){var _0xa361fd=![];var _0x5563db=_0x32f216[_0xb97d('0x11')](/\n/);for(var _0x28a639=0x0,_0x5aa31b=_0x22976f[_0xb97d('0x12')];_0x28a639<_0x5aa31b,_0xa361fd===![];_0x28a639+=0x1){if(_0x32f216[_0xb97d('0x13')](_0x22976f[_0x28a639])>=0x0){_0xa361fd=!![];}}if(!_0xa361fd){throw new Error(util[_0xb97d('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1764f1[_0xb97d('0xf')]['pid']));}process[_0xb97d('0x14')](_0x1764f1[_0xb97d('0xf')][_0xb97d('0x10')],'SIGINT');return _0x593db8[_0xb97d('0x7')](0xc8)[_0xb97d('0xb')]({'message':util['format'](_0xb97d('0x15'),_0x1764f1['params'][_0xb97d('0x10')])});})[_0xb97d('0xc')](handleError(_0x593db8,null,_0xb97d('0x16')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1738370..b3363a6 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 _0xdace=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','exports','multer'];(function(_0x35f53a,_0x2b8b76){var _0x50ea70=function(_0x5b7d99){while(--_0x5b7d99){_0x35f53a['push'](_0x35f53a['shift']());}};_0x50ea70(++_0x2b8b76);}(_0xdace,0xc5));var _0xedac=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xdace[_0x1ed116];return _0x574066;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var auth=require(_0xedac('0x4'));var interaction=require(_0xedac('0x5'));var config=require(_0xedac('0x6'));var controller=require(_0xedac('0x7'));router['get']('/',auth[_0xedac('0x8')](),controller[_0xedac('0x9')]);router[_0xedac('0xa')]('/:id',auth[_0xedac('0x8')](),controller[_0xedac('0xb')]);router[_0xedac('0xc')]('/',auth['isAuthenticated'](),controller[_0xedac('0xd')]);router[_0xedac('0xe')](_0xedac('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xedac('0x10')](_0xedac('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xedac('0x11')]=router; \ No newline at end of file +var _0x1339=['./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33c808,_0x1d206b){var _0xdbd11c=function(_0x23f18c){while(--_0x23f18c){_0x33c808['push'](_0x33c808['shift']());}};_0xdbd11c(++_0x1d206b);}(_0x1339,0x1ed));var _0x9133=function(_0x3d1d7a,_0x49004f){_0x3d1d7a=_0x3d1d7a-0x0;var _0x15250b=_0x1339[_0x3d1d7a];return _0x15250b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var auth=require(_0x9133('0x4'));var interaction=require(_0x9133('0x5'));var config=require(_0x9133('0x6'));var controller=require(_0x9133('0x7'));router['get']('/',auth[_0x9133('0x8')](),controller[_0x9133('0x9')]);router[_0x9133('0xa')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0xb')]);router[_0x9133('0xc')]('/',auth[_0x9133('0x8')](),controller[_0x9133('0xd')]);router[_0x9133('0xe')](_0x9133('0xf'),auth[_0x9133('0x8')](),controller[_0x9133('0x10')]);router[_0x9133('0x11')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0x12')]);module[_0x9133('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ca43875..84bcfea 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 _0x087b=['sequelize','exports','STRING'];(function(_0x2d9ce8,_0xe8e638){var _0x243f38=function(_0x17d62e){while(--_0x17d62e){_0x2d9ce8['push'](_0x2d9ce8['shift']());}};_0x243f38(++_0xe8e638);}(_0x087b,0x11a));var _0xb087=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x087b[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb087('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb087('0x2')]}}; \ No newline at end of file +var _0x0713=['#0091EA','STRING','name'];(function(_0x3a5bdb,_0x2816ca){var _0x574e0d=function(_0x526fe2){while(--_0x526fe2){_0x3a5bdb['push'](_0x3a5bdb['shift']());}};_0x574e0d(++_0x2816ca);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'unique':_0x3071('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e280101..0955b28 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 _0xa748=['then','get','destroy','error','send','index','Tag','rawAttributes','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','name','options','includeAll','rows','catch','show','params','keys','filters','include','find','create','body','user','role','Tags','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa748,0x73));var _0x8a74=function(_0x255fa4,_0xa3b664){_0x255fa4=_0x255fa4-0x0;var _0x12be17=_0xa748[_0x255fa4];return _0x12be17;};'use strict';var pdf=require(_0x8a74('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a74('0x1'));var jsonpatch=require(_0x8a74('0x2'));var rp=require(_0x8a74('0x3'));var moment=require(_0x8a74('0x4'));var BPromise=require(_0x8a74('0x5'));var Mustache=require(_0x8a74('0x6'));var util=require(_0x8a74('0x7'));var path=require('path');var sox=require(_0x8a74('0x8'));var csv=require('to-csv');var ejs=require(_0x8a74('0x9'));var fs=require('fs');var _=require(_0x8a74('0xa'));var squel=require(_0x8a74('0xb'));var crypto=require('crypto');var jsforce=require(_0x8a74('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a74('0xd'));var Papa=require(_0x8a74('0xe'));var Redis=require(_0x8a74('0xf'));var authService=require(_0x8a74('0x10'));var qs=require(_0x8a74('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a74('0x12'))('api');var utils=require(_0x8a74('0x13'));var config=require('../../config/environment');var db=require(_0x8a74('0x14'))['db'];function respondWithStatusCode(_0x101043,_0x1a5ea5){_0x1a5ea5=_0x1a5ea5||0xcc;return function(_0x48e261){if(_0x48e261){return _0x101043[_0x8a74('0x15')](_0x1a5ea5);}return _0x101043[_0x8a74('0x16')](_0x1a5ea5)[_0x8a74('0x17')]();};}function respondWithResult(_0xa9ce1,_0x2302c3){_0x2302c3=_0x2302c3||0xc8;return function(_0x561c29){if(_0x561c29){return _0xa9ce1[_0x8a74('0x16')](_0x2302c3)[_0x8a74('0x18')](_0x561c29);}};}function respondWithFilteredResult(_0x456f77,_0x558360){return function(_0x5373e3){if(_0x5373e3){var _0x31df4b=_0x5373e3[_0x8a74('0x19')],_0x5e22f4=_0x558360[_0x8a74('0x1a')],_0x212ad5=_0x558360[_0x8a74('0x1a')]+_0x558360[_0x8a74('0x1b')],_0x3300ee;if(_0x212ad5>=_0x31df4b){_0x212ad5=_0x31df4b;_0x3300ee=0xc8;}else{_0x3300ee=0xce;}_0x456f77[_0x8a74('0x16')](_0x3300ee);return _0x456f77['set']('Content-Range',_0x5e22f4+'-'+_0x212ad5+'/'+_0x31df4b)[_0x8a74('0x18')](_0x5373e3);}return null;};}function patchUpdates(_0x4819d2){return function(_0xfac6d1){try{jsonpatch[_0x8a74('0x1c')](_0xfac6d1,_0x4819d2,!![]);}catch(_0x2adebf){return BPromise[_0x8a74('0x1d')](_0x2adebf);}return _0xfac6d1[_0x8a74('0x1e')]();};}function saveUpdates(_0x444e93,_0x10b8f0){return function(_0x3b966b){if(_0x3b966b){return _0x3b966b['update'](_0x444e93)[_0x8a74('0x1f')](function(_0x31959b){return _0x31959b;});}return null;};}function removeEntity(_0x3a9362,_0x2d0741){return function(_0x3c8a88){if(_0x3c8a88){return _0x3c8a88['destroy']()[_0x8a74('0x1f')](function(){var _0x3ac96a=_0x3c8a88[_0x8a74('0x20')]({'plain':!![]});var _0x1dcabb='Tags';return db['UserProfileResource'][_0x8a74('0x21')]({'where':{'type':_0x1dcabb,'resourceId':_0x3ac96a['id']}})[_0x8a74('0x1f')](function(){return _0x3c8a88;});})[_0x8a74('0x1f')](function(){_0x3a9362['status'](0xcc)[_0x8a74('0x17')]();});}};}function handleEntityNotFound(_0xbf632b,_0x5ece8b){return function(_0x4387dd){if(!_0x4387dd){_0xbf632b[_0x8a74('0x15')](0x194);}return _0x4387dd;};}function handleError(_0x26fbf4,_0x57309e){_0x57309e=_0x57309e||0x1f4;return function(_0x59aec6){logger[_0x8a74('0x22')](_0x59aec6['stack']);if(_0x59aec6['name']){delete _0x59aec6['name'];}_0x26fbf4[_0x8a74('0x16')](_0x57309e)[_0x8a74('0x23')](_0x59aec6);};}exports[_0x8a74('0x24')]=function(_0x22a498,_0x112e99){var _0x7e6840={},_0x3ae984={},_0x45be5a={'count':0x0,'rows':[]};var _0x26e36d=_['map'](db[_0x8a74('0x25')][_0x8a74('0x26')],function(_0x3bf586){return{'name':_0x3bf586['fieldName'],'type':_0x3bf586[_0x8a74('0x27')]['key']};});_0x3ae984[_0x8a74('0x28')]=_[_0x8a74('0x29')](_0x26e36d,'name');_0x3ae984[_0x8a74('0x2a')]=_['keys'](_0x22a498[_0x8a74('0x2a')]);_0x3ae984['filters']=_[_0x8a74('0x2b')](_0x3ae984['model'],_0x3ae984['query']);_0x7e6840[_0x8a74('0x2c')]=_[_0x8a74('0x2b')](_0x3ae984[_0x8a74('0x28')],qs['fields'](_0x22a498['query'][_0x8a74('0x2d')]));_0x7e6840['attributes']=_0x7e6840[_0x8a74('0x2c')][_0x8a74('0x2e')]?_0x7e6840[_0x8a74('0x2c')]:_0x3ae984['model'];if(!_0x22a498['query']['hasOwnProperty'](_0x8a74('0x2f'))){_0x7e6840['limit']=qs[_0x8a74('0x1b')](_0x22a498['query'][_0x8a74('0x1b')]);_0x7e6840[_0x8a74('0x1a')]=qs[_0x8a74('0x1a')](_0x22a498[_0x8a74('0x2a')][_0x8a74('0x1a')]);}_0x7e6840['order']=qs[_0x8a74('0x30')](_0x22a498[_0x8a74('0x2a')][_0x8a74('0x30')]);_0x7e6840['where']=qs['filters'](_['pick'](_0x22a498[_0x8a74('0x2a')],_0x3ae984['filters']),_0x26e36d);if(_0x22a498[_0x8a74('0x2a')][_0x8a74('0x31')]){_0x7e6840['where']=_[_0x8a74('0x32')](_0x7e6840[_0x8a74('0x33')],{'$or':_['map'](_0x26e36d,function(_0x31d525){if(_0x31d525[_0x8a74('0x27')]!==_0x8a74('0x34')){var _0x2bd664={};_0x2bd664[_0x31d525[_0x8a74('0x35')]]={'$like':'%'+_0x22a498[_0x8a74('0x2a')][_0x8a74('0x31')]+'%'};return _0x2bd664;}})});}_0x7e6840=_[_0x8a74('0x32')]({},_0x7e6840,_0x22a498[_0x8a74('0x36')]);var _0x4bdab9={'where':_0x7e6840[_0x8a74('0x33')]};return db['Tag']['count'](_0x4bdab9)[_0x8a74('0x1f')](function(_0x5940dd){_0x45be5a[_0x8a74('0x19')]=_0x5940dd;if(_0x22a498[_0x8a74('0x2a')][_0x8a74('0x37')]){_0x7e6840['include']=[{'all':!![]}];}return db[_0x8a74('0x25')]['findAll'](_0x7e6840);})['then'](function(_0x500c10){_0x45be5a[_0x8a74('0x38')]=_0x500c10;return _0x45be5a;})['then'](respondWithFilteredResult(_0x112e99,_0x7e6840))[_0x8a74('0x39')](handleError(_0x112e99,null));};exports[_0x8a74('0x3a')]=function(_0x5cc4ad,_0x354dd1){var _0x37b0a6={'raw':!![],'where':{'id':_0x5cc4ad[_0x8a74('0x3b')]['id']}},_0x26d5be={};_0x26d5be[_0x8a74('0x28')]=_['keys'](db['Tag'][_0x8a74('0x26')]);_0x26d5be[_0x8a74('0x2a')]=_[_0x8a74('0x3c')](_0x5cc4ad[_0x8a74('0x2a')]);_0x26d5be[_0x8a74('0x3d')]=_[_0x8a74('0x2b')](_0x26d5be[_0x8a74('0x28')],_0x26d5be[_0x8a74('0x2a')]);_0x37b0a6[_0x8a74('0x2c')]=_[_0x8a74('0x2b')](_0x26d5be['model'],qs['fields'](_0x5cc4ad[_0x8a74('0x2a')][_0x8a74('0x2d')]));_0x37b0a6[_0x8a74('0x2c')]=_0x37b0a6[_0x8a74('0x2c')][_0x8a74('0x2e')]?_0x37b0a6[_0x8a74('0x2c')]:_0x26d5be[_0x8a74('0x28')];if(_0x5cc4ad['query'][_0x8a74('0x37')]){_0x37b0a6[_0x8a74('0x3e')]=[{'all':!![]}];}_0x37b0a6=_['merge']({},_0x37b0a6,_0x5cc4ad['options']);return db['Tag'][_0x8a74('0x3f')](_0x37b0a6)['then'](handleEntityNotFound(_0x354dd1,null))[_0x8a74('0x1f')](respondWithResult(_0x354dd1,null))[_0x8a74('0x39')](handleError(_0x354dd1,null));};exports[_0x8a74('0x40')]=function(_0x1111f1,_0x40d264){return db[_0x8a74('0x25')][_0x8a74('0x40')](_0x1111f1[_0x8a74('0x41')],{})[_0x8a74('0x1f')](function(_0x1b5014){var _0x4b12b6=_0x1111f1[_0x8a74('0x42')]['get']({'plain':!![]});if(!_0x4b12b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b12b6[_0x8a74('0x43')]===_0x8a74('0x42')){var _0x2b5c66=_0x1b5014['get']({'plain':!![]});var _0x363b32=_0x8a74('0x44');return db[_0x8a74('0x45')][_0x8a74('0x3f')]({'where':{'name':_0x363b32,'userProfileId':_0x4b12b6[_0x8a74('0x46')]},'raw':!![]})[_0x8a74('0x1f')](function(_0x31cf0c){if(_0x31cf0c&&_0x31cf0c[_0x8a74('0x47')]===0x0){return db['UserProfileResource'][_0x8a74('0x40')]({'name':_0x2b5c66[_0x8a74('0x35')],'resourceId':_0x2b5c66['id'],'type':_0x31cf0c[_0x8a74('0x35')],'sectionId':_0x31cf0c['id']},{})[_0x8a74('0x1f')](function(){return _0x1b5014;});}else{return _0x1b5014;}})['catch'](function(_0x17466f){logger[_0x8a74('0x22')](_0x8a74('0x48'),_0x17466f);throw _0x17466f;});}return _0x1b5014;})[_0x8a74('0x1f')](respondWithResult(_0x40d264,0xc9))['catch'](handleError(_0x40d264,null));};exports['update']=function(_0x4dc15e,_0x2ba8dc){if(_0x4dc15e[_0x8a74('0x41')]['id']){delete _0x4dc15e[_0x8a74('0x41')]['id'];}return db[_0x8a74('0x25')]['find']({'where':{'id':_0x4dc15e[_0x8a74('0x3b')]['id']}})[_0x8a74('0x1f')](handleEntityNotFound(_0x2ba8dc,null))[_0x8a74('0x1f')](saveUpdates(_0x4dc15e['body'],null))[_0x8a74('0x1f')](respondWithResult(_0x2ba8dc,null))[_0x8a74('0x39')](handleError(_0x2ba8dc,null));};exports[_0x8a74('0x21')]=function(_0x24d947,_0x1578c3){return db[_0x8a74('0x25')][_0x8a74('0x3f')]({'where':{'id':_0x24d947[_0x8a74('0x3b')]['id']}})[_0x8a74('0x1f')](handleEntityNotFound(_0x1578c3,null))[_0x8a74('0x1f')](removeEntity(_0x1578c3,null))[_0x8a74('0x39')](handleError(_0x1578c3,null));}; \ No newline at end of file +var _0xd3cc=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','Tag','rawAttributes','fieldName','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','type','filter','count','includeAll','include','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','crypto','jsforce'];(function(_0xf145ca,_0x3401ee){var _0x4dffc2=function(_0x587156){while(--_0x587156){_0xf145ca['push'](_0xf145ca['shift']());}};_0x4dffc2(++_0x3401ee);}(_0xd3cc,0x8d));var _0xcd3c=function(_0x9d05ad,_0xb0ab3c){_0x9d05ad=_0x9d05ad-0x0;var _0xff824f=_0xd3cc[_0x9d05ad];return _0xff824f;};'use strict';var pdf=require(_0xcd3c('0x0'));var emlformat=require(_0xcd3c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcd3c('0x2'));var jsonpatch=require(_0xcd3c('0x3'));var rp=require(_0xcd3c('0x4'));var moment=require(_0xcd3c('0x5'));var BPromise=require(_0xcd3c('0x6'));var Mustache=require('mustache');var util=require(_0xcd3c('0x7'));var path=require('path');var sox=require(_0xcd3c('0x8'));var csv=require(_0xcd3c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd3c('0xa'));var squel=require('squel');var crypto=require(_0xcd3c('0xb'));var jsforce=require(_0xcd3c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcd3c('0x9'));var querystring=require(_0xcd3c('0xd'));var Papa=require('papaparse');var Redis=require(_0xcd3c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcd3c('0xf'));var as=require(_0xcd3c('0x10'));var hardwareService=require(_0xcd3c('0x11'));var logger=require(_0xcd3c('0x12'))(_0xcd3c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcd3c('0x14'))['db'];function respondWithStatusCode(_0x1f28b1,_0x29be34){_0x29be34=_0x29be34||0xcc;return function(_0x51e8c8){if(_0x51e8c8){return _0x1f28b1[_0xcd3c('0x15')](_0x29be34);}return _0x1f28b1[_0xcd3c('0x16')](_0x29be34)[_0xcd3c('0x17')]();};}function respondWithResult(_0x23c984,_0x2e3414){_0x2e3414=_0x2e3414||0xc8;return function(_0x3ba435){if(_0x3ba435){return _0x23c984[_0xcd3c('0x16')](_0x2e3414)[_0xcd3c('0x18')](_0x3ba435);}};}function respondWithFilteredResult(_0x4b1343,_0x2deb7a){return function(_0x894df5){if(_0x894df5){var _0x3ae8fc=_0x894df5['count'],_0x2e200b=_0x2deb7a[_0xcd3c('0x19')],_0x241182=_0x2deb7a['offset']+_0x2deb7a[_0xcd3c('0x1a')],_0x4b2988;if(_0x241182>=_0x3ae8fc){_0x241182=_0x3ae8fc;_0x4b2988=0xc8;}else{_0x4b2988=0xce;}_0x4b1343[_0xcd3c('0x16')](_0x4b2988);return _0x4b1343[_0xcd3c('0x1b')](_0xcd3c('0x1c'),_0x2e200b+'-'+_0x241182+'/'+_0x3ae8fc)[_0xcd3c('0x18')](_0x894df5);}return null;};}function patchUpdates(_0x3d67fa){return function(_0x2cbe9f){try{jsonpatch['apply'](_0x2cbe9f,_0x3d67fa,!![]);}catch(_0xafc52f){return BPromise[_0xcd3c('0x1d')](_0xafc52f);}return _0x2cbe9f[_0xcd3c('0x1e')]();};}function saveUpdates(_0x206aca,_0x508439){return function(_0x5c8bd5){if(_0x5c8bd5){return _0x5c8bd5['update'](_0x206aca)['then'](function(_0x4687a0){return _0x4687a0;});}return null;};}function removeEntity(_0x24a812,_0x2c0a73){return function(_0x159ab5){if(_0x159ab5){return _0x159ab5['destroy']()[_0xcd3c('0x1f')](function(){var _0x68a86c=_0x159ab5[_0xcd3c('0x20')]({'plain':!![]});var _0x28260a='Tags';return db[_0xcd3c('0x21')][_0xcd3c('0x22')]({'where':{'type':_0x28260a,'resourceId':_0x68a86c['id']}})['then'](function(){return _0x159ab5;});})[_0xcd3c('0x1f')](function(){_0x24a812[_0xcd3c('0x16')](0xcc)[_0xcd3c('0x17')]();});}};}function handleEntityNotFound(_0x435f9e,_0x609999){return function(_0x51a506){if(!_0x51a506){_0x435f9e[_0xcd3c('0x15')](0x194);}return _0x51a506;};}function handleError(_0x3bf2f7,_0x439645){_0x439645=_0x439645||0x1f4;return function(_0x520d64){logger[_0xcd3c('0x23')](_0x520d64[_0xcd3c('0x24')]);if(_0x520d64[_0xcd3c('0x25')]){delete _0x520d64[_0xcd3c('0x25')];}_0x3bf2f7['status'](_0x439645)[_0xcd3c('0x26')](_0x520d64);};}exports[_0xcd3c('0x27')]=function(_0x175a2b,_0x540211){var _0x2d6348={},_0xe45fb2={},_0x4db3c2={'count':0x0,'rows':[]};var _0x3d78b5=_['map'](db[_0xcd3c('0x28')][_0xcd3c('0x29')],function(_0xa0678d){return{'name':_0xa0678d[_0xcd3c('0x2a')],'type':_0xa0678d['type'][_0xcd3c('0x2b')]};});_0xe45fb2['model']=_[_0xcd3c('0x2c')](_0x3d78b5,_0xcd3c('0x25'));_0xe45fb2[_0xcd3c('0x2d')]=_[_0xcd3c('0x2e')](_0x175a2b[_0xcd3c('0x2d')]);_0xe45fb2['filters']=_[_0xcd3c('0x2f')](_0xe45fb2['model'],_0xe45fb2['query']);_0x2d6348[_0xcd3c('0x30')]=_[_0xcd3c('0x2f')](_0xe45fb2[_0xcd3c('0x31')],qs[_0xcd3c('0x32')](_0x175a2b['query'][_0xcd3c('0x32')]));_0x2d6348[_0xcd3c('0x30')]=_0x2d6348[_0xcd3c('0x30')][_0xcd3c('0x33')]?_0x2d6348[_0xcd3c('0x30')]:_0xe45fb2['model'];if(!_0x175a2b[_0xcd3c('0x2d')][_0xcd3c('0x34')]('nolimit')){_0x2d6348[_0xcd3c('0x1a')]=qs['limit'](_0x175a2b[_0xcd3c('0x2d')][_0xcd3c('0x1a')]);_0x2d6348[_0xcd3c('0x19')]=qs[_0xcd3c('0x19')](_0x175a2b[_0xcd3c('0x2d')][_0xcd3c('0x19')]);}_0x2d6348[_0xcd3c('0x35')]=qs[_0xcd3c('0x36')](_0x175a2b[_0xcd3c('0x2d')][_0xcd3c('0x36')]);_0x2d6348['where']=qs[_0xcd3c('0x37')](_[_0xcd3c('0x38')](_0x175a2b['query'],_0xe45fb2[_0xcd3c('0x37')]),_0x3d78b5);if(_0x175a2b[_0xcd3c('0x2d')]['filter']){_0x2d6348[_0xcd3c('0x39')]=_[_0xcd3c('0x3a')](_0x2d6348['where'],{'$or':_[_0xcd3c('0x2c')](_0x3d78b5,function(_0x52d43b){if(_0x52d43b[_0xcd3c('0x3b')]!=='VIRTUAL'){var _0x18f557={};_0x18f557[_0x52d43b[_0xcd3c('0x25')]]={'$like':'%'+_0x175a2b[_0xcd3c('0x2d')][_0xcd3c('0x3c')]+'%'};return _0x18f557;}})});}_0x2d6348=_['merge']({},_0x2d6348,_0x175a2b['options']);var _0x36ac97={'where':_0x2d6348['where']};return db[_0xcd3c('0x28')][_0xcd3c('0x3d')](_0x36ac97)['then'](function(_0x4b1e10){_0x4db3c2[_0xcd3c('0x3d')]=_0x4b1e10;if(_0x175a2b[_0xcd3c('0x2d')][_0xcd3c('0x3e')]){_0x2d6348[_0xcd3c('0x3f')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2d6348);})['then'](function(_0x100afe){_0x4db3c2['rows']=_0x100afe;return _0x4db3c2;})[_0xcd3c('0x1f')](respondWithFilteredResult(_0x540211,_0x2d6348))[_0xcd3c('0x40')](handleError(_0x540211,null));};exports[_0xcd3c('0x41')]=function(_0x413228,_0x1a953a){var _0x131947={'raw':!![],'where':{'id':_0x413228['params']['id']}},_0x4e80b8={};_0x4e80b8[_0xcd3c('0x31')]=_[_0xcd3c('0x2e')](db['Tag'][_0xcd3c('0x29')]);_0x4e80b8['query']=_[_0xcd3c('0x2e')](_0x413228[_0xcd3c('0x2d')]);_0x4e80b8[_0xcd3c('0x37')]=_[_0xcd3c('0x2f')](_0x4e80b8[_0xcd3c('0x31')],_0x4e80b8[_0xcd3c('0x2d')]);_0x131947[_0xcd3c('0x30')]=_['intersection'](_0x4e80b8[_0xcd3c('0x31')],qs[_0xcd3c('0x32')](_0x413228[_0xcd3c('0x2d')]['fields']));_0x131947['attributes']=_0x131947[_0xcd3c('0x30')]['length']?_0x131947[_0xcd3c('0x30')]:_0x4e80b8[_0xcd3c('0x31')];if(_0x413228[_0xcd3c('0x2d')][_0xcd3c('0x3e')]){_0x131947[_0xcd3c('0x3f')]=[{'all':!![]}];}_0x131947=_['merge']({},_0x131947,_0x413228['options']);return db['Tag'][_0xcd3c('0x42')](_0x131947)['then'](handleEntityNotFound(_0x1a953a,null))['then'](respondWithResult(_0x1a953a,null))['catch'](handleError(_0x1a953a,null));};exports[_0xcd3c('0x43')]=function(_0x151f59,_0x13953c){return db[_0xcd3c('0x28')][_0xcd3c('0x43')](_0x151f59['body'],{})[_0xcd3c('0x1f')](function(_0x32790d){var _0x4ec6e5=_0x151f59['user'][_0xcd3c('0x20')]({'plain':!![]});if(!_0x4ec6e5)throw new Error(_0xcd3c('0x44'));if(_0x4ec6e5[_0xcd3c('0x45')]==='user'){var _0x4781a2=_0x32790d[_0xcd3c('0x20')]({'plain':!![]});var _0x490a64='Tags';return db[_0xcd3c('0x46')][_0xcd3c('0x42')]({'where':{'name':_0x490a64,'userProfileId':_0x4ec6e5[_0xcd3c('0x47')]},'raw':!![]})[_0xcd3c('0x1f')](function(_0x4b0274){if(_0x4b0274&&_0x4b0274[_0xcd3c('0x48')]===0x0){return db['UserProfileResource'][_0xcd3c('0x43')]({'name':_0x4781a2[_0xcd3c('0x25')],'resourceId':_0x4781a2['id'],'type':_0x4b0274[_0xcd3c('0x25')],'sectionId':_0x4b0274['id']},{})[_0xcd3c('0x1f')](function(){return _0x32790d;});}else{return _0x32790d;}})[_0xcd3c('0x40')](function(_0x36ff28){logger[_0xcd3c('0x23')](_0xcd3c('0x49'),_0x36ff28);throw _0x36ff28;});}return _0x32790d;})[_0xcd3c('0x1f')](respondWithResult(_0x13953c,0xc9))[_0xcd3c('0x40')](handleError(_0x13953c,null));};exports[_0xcd3c('0x4a')]=function(_0x4bd7d1,_0x4a738d){if(_0x4bd7d1['body']['id']){delete _0x4bd7d1[_0xcd3c('0x4b')]['id'];}return db['Tag'][_0xcd3c('0x42')]({'where':{'id':_0x4bd7d1[_0xcd3c('0x4c')]['id']}})[_0xcd3c('0x1f')](handleEntityNotFound(_0x4a738d,null))[_0xcd3c('0x1f')](saveUpdates(_0x4bd7d1[_0xcd3c('0x4b')],null))[_0xcd3c('0x1f')](respondWithResult(_0x4a738d,null))[_0xcd3c('0x40')](handleError(_0x4a738d,null));};exports[_0xcd3c('0x22')]=function(_0xac393,_0x52566c){return db['Tag'][_0xcd3c('0x42')]({'where':{'id':_0xac393['params']['id']}})[_0xcd3c('0x1f')](handleEntityNotFound(_0x52566c,null))[_0xcd3c('0x1f')](removeEntity(_0x52566c,null))['catch'](handleError(_0x52566c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 3e4e9d3..2191c7f 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 _0xc9eb=['Tag','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./tag.attributes','define'];(function(_0x54a1a5,_0x330d60){var _0x2d07c2=function(_0x5d931f){while(--_0x5d931f){_0x54a1a5['push'](_0x54a1a5['shift']());}};_0x2d07c2(++_0x330d60);}(_0xc9eb,0x199));var _0xbc9e=function(_0x5e2b26,_0x3a9b9a){_0x5e2b26=_0x5e2b26-0x0;var _0x41f745=_0xc9eb[_0x5e2b26];return _0x41f745;};'use strict';var _=require(_0xbc9e('0x0'));var util=require(_0xbc9e('0x1'));var logger=require(_0xbc9e('0x2'))(_0xbc9e('0x3'));var moment=require(_0xbc9e('0x4'));var BPromise=require(_0xbc9e('0x5'));var rp=require(_0xbc9e('0x6'));var fs=require('fs');var path=require(_0xbc9e('0x7'));var rimraf=require('rimraf');var config=require(_0xbc9e('0x8'));var attributes=require(_0xbc9e('0x9'));module['exports']=function(_0xaee339,_0x5b7c1d){return _0xaee339[_0xbc9e('0xa')](_0xbc9e('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71c6=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','bluebird'];(function(_0x239837,_0x138cd6){var _0x3eb5c8=function(_0x495bba){while(--_0x495bba){_0x239837['push'](_0x239837['shift']());}};_0x3eb5c8(++_0x138cd6);}(_0x71c6,0x1dc));var _0x671c=function(_0x203e63,_0xa0af57){_0x203e63=_0x203e63-0x0;var _0x9baecd=_0x71c6[_0x203e63];return _0x9baecd;};'use strict';var _=require(_0x671c('0x0'));var util=require(_0x671c('0x1'));var logger=require(_0x671c('0x2'))(_0x671c('0x3'));var moment=require('moment');var BPromise=require(_0x671c('0x4'));var rp=require(_0x671c('0x5'));var fs=require('fs');var path=require(_0x671c('0x6'));var rimraf=require(_0x671c('0x7'));var config=require(_0x671c('0x8'));var attributes=require(_0x671c('0x9'));module[_0x671c('0xa')]=function(_0x3192a9,_0x4db48c){return _0x3192a9['define'](_0x671c('0xb'),attributes,{'tableName':_0x671c('0xc'),'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 93b226b..63886aa 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 _0xc6d8=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x7789fb,_0x2efc99){var _0x1753a8=function(_0x3f65eb){while(--_0x3f65eb){_0x7789fb['push'](_0x7789fb['shift']());}};_0x1753a8(++_0x2efc99);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x18a01c,_0xd1a13a){_0x18a01c=_0x18a01c-0x0;var _0x2b0cd6=_0xc6d8[_0x18a01c];return _0x2b0cd6;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('Tag,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});} \ No newline at end of file +var _0xa74f=['result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x2c3c23,_0x3609b5){var _0x24e0ee=function(_0x510410){while(--_0x510410){_0x2c3c23['push'](_0x2c3c23['shift']());}};_0x24e0ee(++_0x3609b5);}(_0xa74f,0x9a));var _0xfa74=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xa74f[_0x402c8f];return _0x11e809;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 751517b..27d6d13 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 _0x939f=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents','exports'];(function(_0x3ea291,_0x3ac8c3){var _0x278591=function(_0x28a057){while(--_0x28a057){_0x3ea291['push'](_0x3ea291['shift']());}};_0x278591(++_0x3ac8c3);}(_0x939f,0xd0));var _0xf939=function(_0x4c7892,_0x1c2cb0){_0x4c7892=_0x4c7892-0x0;var _0x2a79c8=_0x939f[_0x4c7892];return _0x2a79c8;};'use strict';var multer=require('multer');var util=require(_0xf939('0x0'));var path=require('path');var timeout=require(_0xf939('0x1'));var express=require(_0xf939('0x2'));var router=express[_0xf939('0x3')]();var auth=require(_0xf939('0x4'));var interaction=require(_0xf939('0x5'));var config=require(_0xf939('0x6'));var controller=require(_0xf939('0x7'));router[_0xf939('0x8')]('/',auth[_0xf939('0x9')](),controller[_0xf939('0xa')]);router[_0xf939('0x8')](_0xf939('0xb'),auth[_0xf939('0x9')](),controller[_0xf939('0xc')]);router[_0xf939('0x8')](_0xf939('0xd'),auth[_0xf939('0x9')](),controller[_0xf939('0xe')]);router[_0xf939('0x8')](_0xf939('0xf'),auth[_0xf939('0x9')](),controller[_0xf939('0x10')]);router[_0xf939('0x11')]('/',auth[_0xf939('0x9')](),controller[_0xf939('0x12')]);router['post']('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);router[_0xf939('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0xf939('0x13')]);router[_0xf939('0x14')]('/:id',auth[_0xf939('0x9')](),controller[_0xf939('0x15')]);router['delete'](_0xf939('0xb'),auth['isAuthenticated'](),controller[_0xf939('0x16')]);router[_0xf939('0x17')](_0xf939('0xd'),auth[_0xf939('0x9')](),controller['removeQueues']);router[_0xf939('0x17')]('/:id/users',auth[_0xf939('0x9')](),controller[_0xf939('0x18')]);module[_0xf939('0x19')]=router; \ No newline at end of file +var _0xe9f8=['getQueues','getAgents','post','/:id/users','addAgents','put','/:id','update','delete','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','/:id/queues'];(function(_0x57b1c7,_0x1a9018){var _0x2b26a4=function(_0x4c91da){while(--_0x4c91da){_0x57b1c7['push'](_0x57b1c7['shift']());}};_0x2b26a4(++_0x1a9018);}(_0xe9f8,0xbe));var _0x8e9f=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xe9f8[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0x8e9f('0x0'));var util=require(_0x8e9f('0x1'));var path=require(_0x8e9f('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e9f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8e9f('0x4'));var config=require(_0x8e9f('0x5'));var controller=require(_0x8e9f('0x6'));router[_0x8e9f('0x7')]('/',auth[_0x8e9f('0x8')](),controller['index']);router[_0x8e9f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8e9f('0x7')](_0x8e9f('0x9'),auth[_0x8e9f('0x8')](),controller[_0x8e9f('0xa')]);router[_0x8e9f('0x7')]('/:id/users',auth[_0x8e9f('0x8')](),controller[_0x8e9f('0xb')]);router[_0x8e9f('0xc')]('/',auth[_0x8e9f('0x8')](),controller['create']);router[_0x8e9f('0xc')]('/:id/queues',auth[_0x8e9f('0x8')](),controller['addQueues']);router[_0x8e9f('0xc')](_0x8e9f('0xd'),auth['isAuthenticated'](),controller[_0x8e9f('0xe')]);router[_0x8e9f('0xf')](_0x8e9f('0x10'),auth[_0x8e9f('0x8')](),controller[_0x8e9f('0x11')]);router[_0x8e9f('0x12')](_0x8e9f('0x10'),auth[_0x8e9f('0x8')](),controller['destroy']);router[_0x8e9f('0x12')](_0x8e9f('0x9'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x8e9f('0x12')](_0x8e9f('0xd'),auth[_0x8e9f('0x8')](),controller['removeAgents']);module[_0x8e9f('0x13')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index f8b2512..880f4c3 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 _0xa0c8=['exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa0c8,0x168));var _0x8a0c=function(_0x3dfa3e,_0x293558){_0x3dfa3e=_0x3dfa3e-0x0;var _0x3ff9ed=_0xa0c8[_0x3dfa3e];return _0x3ff9ed;};'use strict';var Sequelize=require('sequelize');module[_0x8a0c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x8a0c('0x1')]}}; \ No newline at end of file +var _0x5fbc=['exports','STRING','sequelize'];(function(_0x1f954d,_0x26cb29){var _0x512984=function(_0x1801b1){while(--_0x1801b1){_0x1f954d['push'](_0x1f954d['shift']());}};_0x512984(++_0x26cb29);}(_0x5fbc,0x8f));var _0xc5fb=function(_0x33018d,_0x2be566){_0x33018d=_0x33018d-0x0;var _0x2f9d4f=_0x5fbc[_0x33018d];return _0x2f9d4f;};'use strict';var Sequelize=require(_0xc5fb('0x0'));module[_0xc5fb('0x1')]={'name':{'type':Sequelize[_0xc5fb('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xc5fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c81e60b..38aeef5 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 _0xa906=['localhost','./team.socket','register','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Team','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','keys','intersection','includeAll','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','channel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','findOne','ValidationError','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','spread','emit','chat','mail','sms','openchannel','whatsapp','removeAgents','userTeam:remove','getAgents','html-pdf','rimraf','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x273d2b,_0x4b6f61){var _0x2b6238=function(_0x11c7df){while(--_0x11c7df){_0x273d2b['push'](_0x273d2b['shift']());}};_0x2b6238(++_0x4b6f61);}(_0xa906,0x1e3));var _0x6a90=function(_0x244510,_0x548c6c){_0x244510=_0x244510-0x0;var _0x2b4a7b=_0xa906[_0x244510];return _0x2b4a7b;};'use strict';var pdf=require(_0x6a90('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a90('0x2'));var moment=require(_0x6a90('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6a90('0x4'));var path=require(_0x6a90('0x5'));var sox=require('sox');var csv=require(_0x6a90('0x6'));var ejs=require(_0x6a90('0x7'));var fs=require('fs');var _=require(_0x6a90('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6a90('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a90('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a90('0xb'));var qs=require(_0x6a90('0xc'));var as=require(_0x6a90('0xd'));var hardwareService=require(_0x6a90('0xe'));var logger=require(_0x6a90('0xf'))(_0x6a90('0x10'));var utils=require('../../config/utils');var config=require(_0x6a90('0x11'));var db=require(_0x6a90('0x12'))['db'];config['redis']=_[_0x6a90('0x13')](config[_0x6a90('0x14')],{'host':_0x6a90('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a90('0x14')]));require(_0x6a90('0x16'))[_0x6a90('0x17')](socket);function respondWithStatusCode(_0xa054b7,_0x16cf2b){_0x16cf2b=_0x16cf2b||0xcc;return function(_0x3234ff){if(_0x3234ff){return _0xa054b7[_0x6a90('0x18')](_0x16cf2b);}return _0xa054b7[_0x6a90('0x19')](_0x16cf2b)[_0x6a90('0x1a')]();};}function respondWithResult(_0x5f433a,_0xf0c0ac){_0xf0c0ac=_0xf0c0ac||0xc8;return function(_0x850e32){if(_0x850e32){return _0x5f433a[_0x6a90('0x19')](_0xf0c0ac)[_0x6a90('0x1b')](_0x850e32);}};}function respondWithFilteredResult(_0x38be60,_0x310974){return function(_0x86b510){if(_0x86b510){var _0xec500e=_0x86b510['count'],_0x5f3de5=_0x310974[_0x6a90('0x1c')],_0x4d70e3=_0x310974[_0x6a90('0x1c')]+_0x310974['limit'],_0x64494c;if(_0x4d70e3>=_0xec500e){_0x4d70e3=_0xec500e;_0x64494c=0xc8;}else{_0x64494c=0xce;}_0x38be60[_0x6a90('0x19')](_0x64494c);return _0x38be60[_0x6a90('0x1d')]('Content-Range',_0x5f3de5+'-'+_0x4d70e3+'/'+_0xec500e)[_0x6a90('0x1b')](_0x86b510);}return null;};}function patchUpdates(_0x27b489){return function(_0x1948aa){try{jsonpatch[_0x6a90('0x1e')](_0x1948aa,_0x27b489,!![]);}catch(_0x3b950c){return BPromise[_0x6a90('0x1f')](_0x3b950c);}return _0x1948aa[_0x6a90('0x20')]();};}function saveUpdates(_0x3236fe,_0xc9e627){return function(_0x414944){if(_0x414944){return _0x414944[_0x6a90('0x21')](_0x3236fe)[_0x6a90('0x22')](function(_0x2339cd){return _0x2339cd;});}return null;};}function removeEntity(_0x1bfdbc,_0x16a86f){return function(_0x175497){if(_0x175497){return _0x175497[_0x6a90('0x23')]()[_0x6a90('0x22')](function(){var _0x4cf74e=_0x175497[_0x6a90('0x24')]({'plain':!![]});var _0x5d02ec='Teams';return db[_0x6a90('0x25')][_0x6a90('0x23')]({'where':{'type':_0x5d02ec,'resourceId':_0x4cf74e['id']}})[_0x6a90('0x22')](function(){return _0x175497;});})['then'](function(){_0x1bfdbc[_0x6a90('0x19')](0xcc)[_0x6a90('0x1a')]();});}};}function handleEntityNotFound(_0x22c4da,_0x54fbf5){return function(_0x4f120a){if(!_0x4f120a){_0x22c4da[_0x6a90('0x18')](0x194);}return _0x4f120a;};}function handleError(_0x3da95d,_0x11f752){_0x11f752=_0x11f752||0x1f4;return function(_0x57c12e){logger[_0x6a90('0x26')](_0x57c12e[_0x6a90('0x27')]);if(_0x57c12e[_0x6a90('0x28')]){delete _0x57c12e[_0x6a90('0x28')];}_0x3da95d[_0x6a90('0x19')](_0x11f752)['send'](_0x57c12e);};}exports['index']=function(_0x38d527,_0x73fa59){var _0x2de257={},_0x3ea311={},_0x1ec6ac={'count':0x0,'rows':[]};var _0x4f2937=_[_0x6a90('0x29')](db[_0x6a90('0x2a')][_0x6a90('0x2b')],function(_0x5895e7){return{'name':_0x5895e7[_0x6a90('0x2c')],'type':_0x5895e7[_0x6a90('0x2d')][_0x6a90('0x2e')]};});_0x3ea311[_0x6a90('0x2f')]=_[_0x6a90('0x29')](_0x4f2937,_0x6a90('0x28'));_0x3ea311[_0x6a90('0x30')]=_['keys'](_0x38d527[_0x6a90('0x30')]);_0x3ea311[_0x6a90('0x31')]=_['intersection'](_0x3ea311['model'],_0x3ea311[_0x6a90('0x30')]);_0x2de257['attributes']=_['intersection'](_0x3ea311['model'],qs[_0x6a90('0x32')](_0x38d527[_0x6a90('0x30')]['fields']));_0x2de257['attributes']=_0x2de257[_0x6a90('0x33')][_0x6a90('0x34')]?_0x2de257[_0x6a90('0x33')]:_0x3ea311[_0x6a90('0x2f')];if(!_0x38d527['query'][_0x6a90('0x35')](_0x6a90('0x36'))){_0x2de257[_0x6a90('0x37')]=qs[_0x6a90('0x37')](_0x38d527[_0x6a90('0x30')]['limit']);_0x2de257[_0x6a90('0x1c')]=qs[_0x6a90('0x1c')](_0x38d527[_0x6a90('0x30')]['offset']);}_0x2de257[_0x6a90('0x38')]=qs[_0x6a90('0x39')](_0x38d527['query'][_0x6a90('0x39')]);_0x2de257[_0x6a90('0x3a')]=qs[_0x6a90('0x31')](_[_0x6a90('0x3b')](_0x38d527[_0x6a90('0x30')],_0x3ea311[_0x6a90('0x31')]),_0x4f2937);if(_0x38d527[_0x6a90('0x30')][_0x6a90('0x3c')]){_0x2de257[_0x6a90('0x3a')]=_[_0x6a90('0x3d')](_0x2de257[_0x6a90('0x3a')],{'$or':_[_0x6a90('0x29')](_0x4f2937,function(_0x443476){if(_0x443476['type']!==_0x6a90('0x3e')){var _0x4e0bd7={};_0x4e0bd7[_0x443476[_0x6a90('0x28')]]={'$like':'%'+_0x38d527[_0x6a90('0x30')]['filter']+'%'};return _0x4e0bd7;}})});}_0x2de257=_[_0x6a90('0x3d')]({},_0x2de257,_0x38d527['options']);var _0x36642f={'where':_0x2de257[_0x6a90('0x3a')]};return db[_0x6a90('0x2a')][_0x6a90('0x3f')](_0x36642f)['then'](function(_0x4a5e5e){_0x1ec6ac[_0x6a90('0x3f')]=_0x4a5e5e;if(_0x38d527['query']['includeAll']){_0x2de257[_0x6a90('0x40')]=[{'all':!![]}];}return db[_0x6a90('0x2a')][_0x6a90('0x41')](_0x2de257);})[_0x6a90('0x22')](function(_0x2ee087){_0x1ec6ac[_0x6a90('0x42')]=_0x2ee087;return _0x1ec6ac;})[_0x6a90('0x22')](respondWithFilteredResult(_0x73fa59,_0x2de257))[_0x6a90('0x43')](handleError(_0x73fa59,null));};exports[_0x6a90('0x44')]=function(_0x34edb0,_0x429500){var _0x34e152={'raw':![],'where':{'id':_0x34edb0['params']['id']}},_0x39b1de={};_0x39b1de['model']=_[_0x6a90('0x45')](db[_0x6a90('0x2a')][_0x6a90('0x2b')]);_0x39b1de['query']=_[_0x6a90('0x45')](_0x34edb0[_0x6a90('0x30')]);_0x39b1de[_0x6a90('0x31')]=_[_0x6a90('0x46')](_0x39b1de[_0x6a90('0x2f')],_0x39b1de['query']);_0x34e152[_0x6a90('0x33')]=_[_0x6a90('0x46')](_0x39b1de[_0x6a90('0x2f')],qs[_0x6a90('0x32')](_0x34edb0[_0x6a90('0x30')][_0x6a90('0x32')]));_0x34e152[_0x6a90('0x33')]=_0x34e152['attributes']['length']?_0x34e152['attributes']:_0x39b1de[_0x6a90('0x2f')];if(_0x34edb0[_0x6a90('0x30')][_0x6a90('0x47')]){_0x34e152[_0x6a90('0x40')]=[{'all':!![]}];}_0x34e152=_[_0x6a90('0x3d')]({},_0x34e152,_0x34edb0[_0x6a90('0x48')]);return db[_0x6a90('0x2a')][_0x6a90('0x49')](_0x34e152)['then'](handleEntityNotFound(_0x429500,null))[_0x6a90('0x22')](respondWithResult(_0x429500,null))[_0x6a90('0x43')](handleError(_0x429500,null));};exports['create']=function(_0x107148,_0x14e3ec){return db[_0x6a90('0x2a')]['create'](_0x107148[_0x6a90('0x4a')],{})[_0x6a90('0x22')](function(_0x28c430){var _0x5b6ce6=_0x107148[_0x6a90('0x4b')][_0x6a90('0x24')]({'plain':!![]});if(!_0x5b6ce6)throw new Error(_0x6a90('0x4c'));if(_0x5b6ce6[_0x6a90('0x4d')]==='user'){var _0x337b3a=_0x28c430[_0x6a90('0x24')]({'plain':!![]});var _0x3a4300=_0x6a90('0x4e');return db[_0x6a90('0x4f')]['find']({'where':{'name':_0x3a4300,'userProfileId':_0x5b6ce6['userProfileId']},'raw':!![]})['then'](function(_0xf75112){if(_0xf75112&&_0xf75112[_0x6a90('0x50')]===0x0){return db[_0x6a90('0x25')][_0x6a90('0x51')]({'name':_0x337b3a['name'],'resourceId':_0x337b3a['id'],'type':_0xf75112[_0x6a90('0x28')],'sectionId':_0xf75112['id']},{})['then'](function(){return _0x28c430;});}else{return _0x28c430;}})[_0x6a90('0x43')](function(_0x3bc7e5){logger[_0x6a90('0x26')](_0x6a90('0x52'),_0x3bc7e5);throw _0x3bc7e5;});}return _0x28c430;})['then'](respondWithResult(_0x14e3ec,0xc9))['catch'](handleError(_0x14e3ec,null));};exports[_0x6a90('0x21')]=function(_0x2ff7c6,_0x321c5d){if(_0x2ff7c6[_0x6a90('0x4a')]['id']){delete _0x2ff7c6[_0x6a90('0x4a')]['id'];}return db[_0x6a90('0x2a')][_0x6a90('0x49')]({'where':{'id':_0x2ff7c6[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](handleEntityNotFound(_0x321c5d,null))[_0x6a90('0x22')](saveUpdates(_0x2ff7c6[_0x6a90('0x4a')],null))[_0x6a90('0x22')](respondWithResult(_0x321c5d,null))[_0x6a90('0x43')](handleError(_0x321c5d,null));};exports[_0x6a90('0x23')]=function(_0x368735,_0x3f6652){return db[_0x6a90('0x2a')][_0x6a90('0x49')]({'where':{'id':_0x368735[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](handleEntityNotFound(_0x3f6652,null))[_0x6a90('0x22')](removeEntity(_0x3f6652,null))[_0x6a90('0x43')](handleError(_0x3f6652,null));};exports[_0x6a90('0x54')]=function(_0x1347ec,_0x349d1c,_0x525c26){return db[_0x6a90('0x2a')]['findOne']({'where':{'id':_0x1347ec[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](handleEntityNotFound(_0x349d1c,null))[_0x6a90('0x22')](function(_0x5cd408){if(!_0x1347ec[_0x6a90('0x30')][_0x6a90('0x55')]||!utils['isValidChannel'](_0x1347ec['query'][_0x6a90('0x55')])){throw new db[(_0x6a90('0x56'))]['ValidationError'](_0x6a90('0x57'));}var _0x2d3659={};var _0x331b4d={};_0x331b4d[_0x6a90('0x2f')]=_[_0x6a90('0x45')](db[_[_0x6a90('0x58')](_0x1347ec[_0x6a90('0x30')][_0x6a90('0x55')][_0x6a90('0x59')]())+_0x6a90('0x5a')][_0x6a90('0x2b')]);_0x331b4d[_0x6a90('0x30')]=_[_0x6a90('0x45')](_0x1347ec[_0x6a90('0x30')]);_0x331b4d[_0x6a90('0x31')]=_[_0x6a90('0x46')](_0x331b4d['model'],_0x331b4d[_0x6a90('0x30')]);_0x2d3659[_0x6a90('0x33')]=_[_0x6a90('0x46')](_0x331b4d['model'],qs['fields'](_0x1347ec[_0x6a90('0x30')]['fields']));_0x2d3659[_0x6a90('0x33')]=_0x2d3659[_0x6a90('0x33')][_0x6a90('0x34')]?_0x2d3659[_0x6a90('0x33')]:_0x331b4d[_0x6a90('0x2f')];_0x2d3659[_0x6a90('0x37')]=qs[_0x6a90('0x37')](_0x1347ec[_0x6a90('0x30')][_0x6a90('0x37')]);_0x2d3659['offset']=qs['offset'](_0x1347ec[_0x6a90('0x30')][_0x6a90('0x1c')]);_0x2d3659['order']=qs[_0x6a90('0x39')](_0x1347ec[_0x6a90('0x30')][_0x6a90('0x39')]);_0x2d3659['where']=qs['filters'](_['pick'](_0x1347ec['query'],_0x331b4d[_0x6a90('0x31')]));_0x2d3659=_['merge']({},_0x2d3659,_0x1347ec[_0x6a90('0x48')]);return _0x5cd408[_0x6a90('0x24')+_[_0x6a90('0x58')](_0x1347ec['query']['channel']['toLowerCase']())+'Queues'](_0x2d3659);})[_0x6a90('0x22')](respondWithResult(_0x349d1c,null))[_0x6a90('0x43')](handleError(_0x349d1c,null));};exports[_0x6a90('0x5b')]=function(_0x1ee771,_0x25871c,_0x4234ec){return db[_0x6a90('0x2a')][_0x6a90('0x5c')]({'where':{'id':_0x1ee771[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](function(_0x529e96){if(_0x529e96){if(!_0x1ee771[_0x6a90('0x4a')][_0x6a90('0x55')]||!utils['isValidChannel'](_0x1ee771[_0x6a90('0x4a')][_0x6a90('0x55')])){throw new db[(_0x6a90('0x56'))][(_0x6a90('0x5d'))](_0x6a90('0x57'));}return _0x529e96[_0x6a90('0x5e')+_[_0x6a90('0x58')](_0x1ee771[_0x6a90('0x4a')]['channel'][_0x6a90('0x59')]())+_0x6a90('0x5f')](_0x1ee771[_0x6a90('0x4a')][_0x6a90('0x60')]);}return null;})[_0x6a90('0x22')](handleEntityNotFound(_0x25871c,null))['then'](respondWithStatusCode(_0x25871c,null))[_0x6a90('0x43')](handleError(_0x25871c,null));};exports[_0x6a90('0x61')]=function(_0x18861b,_0x5a3a86,_0x229744){return db['Team'][_0x6a90('0x5c')]({'where':{'id':_0x18861b[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](function(_0x28aa96){if(_0x28aa96){if(!_0x18861b['query']['channel']||!utils['isValidChannel'](_0x18861b[_0x6a90('0x30')][_0x6a90('0x55')])){throw new db[(_0x6a90('0x56'))][(_0x6a90('0x5d'))]('Unknown\x20channel');}return _0x28aa96[_0x6a90('0x62')+_['capitalize'](_0x18861b[_0x6a90('0x30')]['channel'][_0x6a90('0x59')]())+'Queues'](_0x18861b[_0x6a90('0x30')][_0x6a90('0x60')]);}return null;})['then'](handleEntityNotFound(_0x5a3a86,null))['then'](respondWithStatusCode(_0x5a3a86,null))['catch'](handleError(_0x5a3a86,null));};exports[_0x6a90('0x63')]=function(_0x18ff37,_0x366fc4,_0x2bfc15){return db[_0x6a90('0x2a')][_0x6a90('0x49')]({'where':{'id':_0x18ff37[_0x6a90('0x53')]['id']}})[_0x6a90('0x22')](handleEntityNotFound(_0x366fc4,null))[_0x6a90('0x22')](function(_0x2e58f9){if(_0x2e58f9){var _0x1fe3da=[_0x6a90('0x64'),_0x6a90('0x65'),_0x6a90('0x66'),_0x6a90('0x67'),_0x6a90('0x68'),_0x6a90('0x69'),_0x6a90('0x6a')];return BPromise[_0x6a90('0x6b')](_0x1fe3da,function(_0xbf8d19){return _0x2e58f9[_0x6a90('0x24')+_0xbf8d19+_0x6a90('0x5f')]({'attributes':['id','name']})[_0x6a90('0x22')](function(_0x5b0e3d){return BPromise[_0x6a90('0x6b')](_0x5b0e3d,function(_0x3dc63c){return _0x3dc63c[_0x6a90('0x63')](_0x18ff37[_0x6a90('0x4a')][_0x6a90('0x60')])[_0x6a90('0x22')](function(){if(_0xbf8d19==='Voice'){return db[_0x6a90('0x6c')]['findAll']({'where':{'id':_0x18ff37[_0x6a90('0x4a')][_0x6a90('0x60')]},'attributes':['id',_0x6a90('0x28'),'online',_0x6a90('0x6d'),_0x6a90('0x6e')],'raw':!![]})[_0x6a90('0x22')](function(_0x528c62){return BPromise['each'](_[_0x6a90('0x3c')](_0x528c62,{'online':0x1}),function(_0x2b33cc){return db[_0x6a90('0x6f')][_0x6a90('0x70')]({'membername':_0x2b33cc['name'],'UserId':_0x2b33cc['id'],'queue_name':_0x3dc63c['name'],'VoiceQueueId':_0x3dc63c['id'],'interface':_[_0x6a90('0x71')](_0x2b33cc[_0x6a90('0x6e')])?util[_0x6a90('0x72')](_0x6a90('0x73'),_0x2b33cc[_0x6a90('0x28')]):_0x2b33cc[_0x6a90('0x6e')],'paused':_0x2b33cc['voicePause']||![],'penalty':0x0});});});}});});})[_0x6a90('0x22')](function(){return _0x2e58f9;});})[_0x6a90('0x22')](function(){return _0x2e58f9;});}})[_0x6a90('0x22')](function(_0x1d89c9){if(_0x1d89c9){return _0x1d89c9[_0x6a90('0x63')](_0x18ff37[_0x6a90('0x4a')]['ids'],_['omit'](_0x18ff37[_0x6a90('0x4a')],[_0x6a90('0x60'),'id'])||{})[_0x6a90('0x74')](function(_0x51832d){for(var _0x2cd601=0x0;_0x2cd601<_0x18ff37['body']['ids'][_0x6a90('0x34')];_0x2cd601+=0x1){socket[_0x6a90('0x75')]('userTeam:save',{'UserId':_0x18ff37['body'][_0x6a90('0x60')][_0x2cd601],'TeamId':_0x18ff37[_0x6a90('0x53')]['id']});}return _0x51832d;});}})[_0x6a90('0x22')](respondWithResult(_0x366fc4,null))[_0x6a90('0x43')](handleError(_0x366fc4,null));};exports['removeAgents']=function(_0x363878,_0x117a4d,_0x385832){return db[_0x6a90('0x2a')][_0x6a90('0x49')]({'where':{'id':_0x363878[_0x6a90('0x53')]['id']}})['then'](handleEntityNotFound(_0x117a4d,null))[_0x6a90('0x22')](function(_0x17e6cd){if(_0x17e6cd){return BPromise[_0x6a90('0x6b')](['voice',_0x6a90('0x76'),_0x6a90('0x77'),_0x6a90('0x78'),'fax',_0x6a90('0x79'),_0x6a90('0x7a')],function(_0x52317b){return _0x17e6cd[_0x6a90('0x24')+_[_0x6a90('0x58')](_0x52317b)+_0x6a90('0x5f')]({'attributes':['id',_0x6a90('0x28')]})['then'](function(_0x5bd714){return BPromise[_0x6a90('0x6b')](_0x5bd714,function(_0x1ad38b){return _0x1ad38b[_0x6a90('0x7b')](_0x363878[_0x6a90('0x30')][_0x6a90('0x60')])['then'](function(){if(_0x52317b==='voice'){return db[_0x6a90('0x6f')][_0x6a90('0x23')]({'where':{'VoiceQueueId':_0x1ad38b['id'],'UserId':_0x363878[_0x6a90('0x30')][_0x6a90('0x60')]}});}});});})['then'](function(){return _0x17e6cd;});})[_0x6a90('0x22')](function(){return _0x17e6cd;});}})['then'](function(_0x570ac1){if(_0x570ac1){return _0x570ac1['removeAgents'](_0x363878[_0x6a90('0x30')][_0x6a90('0x60')])['then'](function(){if(_['isArray'](_0x363878[_0x6a90('0x30')][_0x6a90('0x60')])){for(var _0x281f15=0x0;_0x281f15<_0x363878[_0x6a90('0x30')]['ids'][_0x6a90('0x34')];_0x281f15+=0x1){socket['emit'](_0x6a90('0x7c'),{'UserId':Number(_0x363878[_0x6a90('0x30')][_0x6a90('0x60')][_0x281f15]),'TeamId':Number(_0x363878[_0x6a90('0x53')]['id'])});}}else{socket[_0x6a90('0x75')](_0x6a90('0x7c'),{'UserId':Number(_0x363878['query'][_0x6a90('0x60')]),'TeamId':Number(_0x363878[_0x6a90('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x117a4d,null))[_0x6a90('0x43')](handleError(_0x117a4d,null));};exports[_0x6a90('0x7d')]=function(_0x27d7a0,_0x1df446,_0x45f48f){var _0x30cd9d={};var _0x45a720={};var _0x2195fa;var _0x3d6ee1;return db[_0x6a90('0x2a')][_0x6a90('0x5c')]({'where':{'id':_0x27d7a0[_0x6a90('0x53')]['id']}})['then'](handleEntityNotFound(_0x1df446,null))[_0x6a90('0x22')](function(_0x18c830){if(_0x18c830){_0x2195fa=_0x18c830;_0x45a720[_0x6a90('0x2f')]=_[_0x6a90('0x45')](db[_0x6a90('0x6c')][_0x6a90('0x2b')]);_0x45a720['query']=_[_0x6a90('0x45')](_0x27d7a0['query']);_0x45a720[_0x6a90('0x31')]=_['intersection'](_0x45a720[_0x6a90('0x2f')],_0x45a720['query']);_0x30cd9d[_0x6a90('0x33')]=_[_0x6a90('0x46')](_0x45a720[_0x6a90('0x2f')],qs[_0x6a90('0x32')](_0x27d7a0['query'][_0x6a90('0x32')]));_0x30cd9d[_0x6a90('0x33')]=_0x30cd9d[_0x6a90('0x33')][_0x6a90('0x34')]?_0x30cd9d['attributes']:_0x45a720['model'];_0x30cd9d['order']=qs[_0x6a90('0x39')](_0x27d7a0[_0x6a90('0x30')][_0x6a90('0x39')]);_0x30cd9d[_0x6a90('0x3a')]=qs[_0x6a90('0x31')](_[_0x6a90('0x3b')](_0x27d7a0['query'],_0x45a720['filters']));if(_0x27d7a0[_0x6a90('0x30')]['filter']){_0x30cd9d['where']=_[_0x6a90('0x3d')](_0x30cd9d['where'],{'$or':_[_0x6a90('0x29')](_0x30cd9d[_0x6a90('0x33')],function(_0x2d2e31){var _0x2546e0={};_0x2546e0[_0x2d2e31]={'$like':'%'+_0x27d7a0['query'][_0x6a90('0x3c')]+'%'};return _0x2546e0;})});}_0x30cd9d=_[_0x6a90('0x3d')]({},_0x30cd9d,_0x27d7a0[_0x6a90('0x48')]);return _0x2195fa[_0x6a90('0x7d')](_0x30cd9d);}})[_0x6a90('0x22')](function(_0x21a068){if(_0x21a068){_0x3d6ee1=_0x21a068[_0x6a90('0x34')];if(!_0x27d7a0[_0x6a90('0x30')][_0x6a90('0x35')](_0x6a90('0x36'))){_0x30cd9d['limit']=qs[_0x6a90('0x37')](_0x27d7a0[_0x6a90('0x30')][_0x6a90('0x37')]);_0x30cd9d[_0x6a90('0x1c')]=qs[_0x6a90('0x1c')](_0x27d7a0[_0x6a90('0x30')]['offset']);}return _0x2195fa[_0x6a90('0x7d')](_0x30cd9d);}})[_0x6a90('0x22')](function(_0x3c572b){if(_0x3c572b){return _0x3c572b?{'count':_0x3d6ee1,'rows':_0x3c572b}:null;}})[_0x6a90('0x22')](respondWithResult(_0x1df446,null))[_0x6a90('0x43')](handleError(_0x1df446,null));}; \ No newline at end of file +var _0x2787=['error','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','Team','findAll','catch','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','ids','removeQueues','remove','addAgents','Mail','Sms','Fax','Openchannel','Whatsapp','each','Voice','online','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','voicePause','spread','emit','removeAgents','voice','chat','sms','fax','openchannel','whatsapp','isArray','userTeam:remove','getAgents','User','nolimit','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','./team.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource'];(function(_0x26c904,_0x1b7db6){var _0x505d76=function(_0x2123cd){while(--_0x2123cd){_0x26c904['push'](_0x26c904['shift']());}};_0x505d76(++_0x1b7db6);}(_0x2787,0x15e));var _0x7278=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2787[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x7278('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7278('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7278('0x2'));var rp=require(_0x7278('0x3'));var moment=require(_0x7278('0x4'));var BPromise=require(_0x7278('0x5'));var Mustache=require(_0x7278('0x6'));var util=require(_0x7278('0x7'));var path=require('path');var sox=require(_0x7278('0x8'));var csv=require(_0x7278('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7278('0xa'));var squel=require(_0x7278('0xb'));var crypto=require('crypto');var jsforce=require(_0x7278('0xc'));var deskjs=require(_0x7278('0xd'));var toCsv=require(_0x7278('0x9'));var querystring=require(_0x7278('0xe'));var Papa=require(_0x7278('0xf'));var Redis=require(_0x7278('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7278('0x11'));var as=require(_0x7278('0x12'));var hardwareService=require(_0x7278('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7278('0x14'));var config=require('../../config/environment');var db=require(_0x7278('0x15'))['db'];config[_0x7278('0x16')]=_['defaults'](config[_0x7278('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7278('0x17'))[_0x7278('0x18')](socket);function respondWithStatusCode(_0x1c2728,_0x77fab4){_0x77fab4=_0x77fab4||0xcc;return function(_0x553b07){if(_0x553b07){return _0x1c2728[_0x7278('0x19')](_0x77fab4);}return _0x1c2728[_0x7278('0x1a')](_0x77fab4)[_0x7278('0x1b')]();};}function respondWithResult(_0x3b883c,_0x5f1839){_0x5f1839=_0x5f1839||0xc8;return function(_0x271604){if(_0x271604){return _0x3b883c[_0x7278('0x1a')](_0x5f1839)[_0x7278('0x1c')](_0x271604);}};}function respondWithFilteredResult(_0x271a51,_0x12a521){return function(_0x280bc3){if(_0x280bc3){var _0x5f2e1a=_0x280bc3['count'],_0x41d83b=_0x12a521[_0x7278('0x1d')],_0x366fec=_0x12a521[_0x7278('0x1d')]+_0x12a521[_0x7278('0x1e')],_0x2e0216;if(_0x366fec>=_0x5f2e1a){_0x366fec=_0x5f2e1a;_0x2e0216=0xc8;}else{_0x2e0216=0xce;}_0x271a51[_0x7278('0x1a')](_0x2e0216);return _0x271a51[_0x7278('0x1f')](_0x7278('0x20'),_0x41d83b+'-'+_0x366fec+'/'+_0x5f2e1a)['json'](_0x280bc3);}return null;};}function patchUpdates(_0x1aef38){return function(_0x5f2b05){try{jsonpatch[_0x7278('0x21')](_0x5f2b05,_0x1aef38,!![]);}catch(_0x35fa24){return BPromise[_0x7278('0x22')](_0x35fa24);}return _0x5f2b05[_0x7278('0x23')]();};}function saveUpdates(_0x523b02,_0x2b2743){return function(_0xb038d){if(_0xb038d){return _0xb038d['update'](_0x523b02)['then'](function(_0x4beeee){return _0x4beeee;});}return null;};}function removeEntity(_0x4e307b,_0x597670){return function(_0x38b90f){if(_0x38b90f){return _0x38b90f[_0x7278('0x24')]()[_0x7278('0x25')](function(){var _0x4123ad=_0x38b90f[_0x7278('0x26')]({'plain':!![]});var _0x12e4ca='Teams';return db[_0x7278('0x27')]['destroy']({'where':{'type':_0x12e4ca,'resourceId':_0x4123ad['id']}})[_0x7278('0x25')](function(){return _0x38b90f;});})[_0x7278('0x25')](function(){_0x4e307b[_0x7278('0x1a')](0xcc)[_0x7278('0x1b')]();});}};}function handleEntityNotFound(_0xb21818,_0x56ecb7){return function(_0xbe3221){if(!_0xbe3221){_0xb21818[_0x7278('0x19')](0x194);}return _0xbe3221;};}function handleError(_0x1b9098,_0x239e44){_0x239e44=_0x239e44||0x1f4;return function(_0x2e8195){logger[_0x7278('0x28')](_0x2e8195[_0x7278('0x29')]);if(_0x2e8195[_0x7278('0x2a')]){delete _0x2e8195[_0x7278('0x2a')];}_0x1b9098[_0x7278('0x1a')](_0x239e44)[_0x7278('0x2b')](_0x2e8195);};}exports['index']=function(_0xaedfae,_0x3b204a){var _0x566dbb={},_0x5f0125={},_0x701173={'count':0x0,'rows':[]};var _0x3a693b=_['map'](db['Team'][_0x7278('0x2c')],function(_0x265c57){return{'name':_0x265c57[_0x7278('0x2d')],'type':_0x265c57[_0x7278('0x2e')][_0x7278('0x2f')]};});_0x5f0125[_0x7278('0x30')]=_['map'](_0x3a693b,_0x7278('0x2a'));_0x5f0125[_0x7278('0x31')]=_[_0x7278('0x32')](_0xaedfae['query']);_0x5f0125['filters']=_[_0x7278('0x33')](_0x5f0125[_0x7278('0x30')],_0x5f0125[_0x7278('0x31')]);_0x566dbb[_0x7278('0x34')]=_[_0x7278('0x33')](_0x5f0125[_0x7278('0x30')],qs[_0x7278('0x35')](_0xaedfae[_0x7278('0x31')][_0x7278('0x35')]));_0x566dbb['attributes']=_0x566dbb[_0x7278('0x34')][_0x7278('0x36')]?_0x566dbb[_0x7278('0x34')]:_0x5f0125[_0x7278('0x30')];if(!_0xaedfae[_0x7278('0x31')][_0x7278('0x37')]('nolimit')){_0x566dbb['limit']=qs[_0x7278('0x1e')](_0xaedfae['query']['limit']);_0x566dbb['offset']=qs[_0x7278('0x1d')](_0xaedfae[_0x7278('0x31')][_0x7278('0x1d')]);}_0x566dbb[_0x7278('0x38')]=qs[_0x7278('0x39')](_0xaedfae[_0x7278('0x31')][_0x7278('0x39')]);_0x566dbb[_0x7278('0x3a')]=qs[_0x7278('0x3b')](_[_0x7278('0x3c')](_0xaedfae[_0x7278('0x31')],_0x5f0125['filters']),_0x3a693b);if(_0xaedfae[_0x7278('0x31')][_0x7278('0x3d')]){_0x566dbb[_0x7278('0x3a')]=_[_0x7278('0x3e')](_0x566dbb[_0x7278('0x3a')],{'$or':_[_0x7278('0x3f')](_0x3a693b,function(_0x1c944b){if(_0x1c944b[_0x7278('0x2e')]!==_0x7278('0x40')){var _0x386fbc={};_0x386fbc[_0x1c944b[_0x7278('0x2a')]]={'$like':'%'+_0xaedfae['query'][_0x7278('0x3d')]+'%'};return _0x386fbc;}})});}_0x566dbb=_['merge']({},_0x566dbb,_0xaedfae[_0x7278('0x41')]);var _0x1f855b={'where':_0x566dbb[_0x7278('0x3a')]};return db['Team']['count'](_0x1f855b)['then'](function(_0x2d1a3e){_0x701173[_0x7278('0x42')]=_0x2d1a3e;if(_0xaedfae[_0x7278('0x31')][_0x7278('0x43')]){_0x566dbb['include']=[{'all':!![]}];}return db[_0x7278('0x44')][_0x7278('0x45')](_0x566dbb);})['then'](function(_0x56a919){_0x701173['rows']=_0x56a919;return _0x701173;})[_0x7278('0x25')](respondWithFilteredResult(_0x3b204a,_0x566dbb))[_0x7278('0x46')](handleError(_0x3b204a,null));};exports['show']=function(_0x445883,_0x2b353c){var _0x2fd8ee={'raw':![],'where':{'id':_0x445883[_0x7278('0x47')]['id']}},_0x2504dd={};_0x2504dd['model']=_[_0x7278('0x32')](db[_0x7278('0x44')][_0x7278('0x2c')]);_0x2504dd[_0x7278('0x31')]=_['keys'](_0x445883[_0x7278('0x31')]);_0x2504dd[_0x7278('0x3b')]=_['intersection'](_0x2504dd[_0x7278('0x30')],_0x2504dd[_0x7278('0x31')]);_0x2fd8ee[_0x7278('0x34')]=_[_0x7278('0x33')](_0x2504dd[_0x7278('0x30')],qs['fields'](_0x445883[_0x7278('0x31')]['fields']));_0x2fd8ee[_0x7278('0x34')]=_0x2fd8ee[_0x7278('0x34')][_0x7278('0x36')]?_0x2fd8ee[_0x7278('0x34')]:_0x2504dd['model'];if(_0x445883[_0x7278('0x31')][_0x7278('0x43')]){_0x2fd8ee[_0x7278('0x48')]=[{'all':!![]}];}_0x2fd8ee=_['merge']({},_0x2fd8ee,_0x445883['options']);return db[_0x7278('0x44')]['find'](_0x2fd8ee)[_0x7278('0x25')](handleEntityNotFound(_0x2b353c,null))[_0x7278('0x25')](respondWithResult(_0x2b353c,null))[_0x7278('0x46')](handleError(_0x2b353c,null));};exports[_0x7278('0x49')]=function(_0x2c3990,_0x28e4b9){return db['Team']['create'](_0x2c3990['body'],{})[_0x7278('0x25')](function(_0x198d53){var _0x3d90cd=_0x2c3990[_0x7278('0x4a')][_0x7278('0x26')]({'plain':!![]});if(!_0x3d90cd)throw new Error(_0x7278('0x4b'));if(_0x3d90cd[_0x7278('0x4c')]===_0x7278('0x4a')){var _0xbbc78e=_0x198d53[_0x7278('0x26')]({'plain':!![]});var _0x491068=_0x7278('0x4d');return db[_0x7278('0x4e')][_0x7278('0x4f')]({'where':{'name':_0x491068,'userProfileId':_0x3d90cd[_0x7278('0x50')]},'raw':!![]})['then'](function(_0x8db8b1){if(_0x8db8b1&&_0x8db8b1[_0x7278('0x51')]===0x0){return db[_0x7278('0x27')][_0x7278('0x49')]({'name':_0xbbc78e['name'],'resourceId':_0xbbc78e['id'],'type':_0x8db8b1[_0x7278('0x2a')],'sectionId':_0x8db8b1['id']},{})[_0x7278('0x25')](function(){return _0x198d53;});}else{return _0x198d53;}})[_0x7278('0x46')](function(_0x230c0e){logger[_0x7278('0x28')](_0x7278('0x52'),_0x230c0e);throw _0x230c0e;});}return _0x198d53;})[_0x7278('0x25')](respondWithResult(_0x28e4b9,0xc9))['catch'](handleError(_0x28e4b9,null));};exports[_0x7278('0x53')]=function(_0x5275c1,_0x432963){if(_0x5275c1[_0x7278('0x54')]['id']){delete _0x5275c1[_0x7278('0x54')]['id'];}return db[_0x7278('0x44')][_0x7278('0x4f')]({'where':{'id':_0x5275c1['params']['id']}})[_0x7278('0x25')](handleEntityNotFound(_0x432963,null))['then'](saveUpdates(_0x5275c1['body'],null))[_0x7278('0x25')](respondWithResult(_0x432963,null))[_0x7278('0x46')](handleError(_0x432963,null));};exports['destroy']=function(_0x41c5ad,_0x5c0204){return db[_0x7278('0x44')][_0x7278('0x4f')]({'where':{'id':_0x41c5ad[_0x7278('0x47')]['id']}})[_0x7278('0x25')](handleEntityNotFound(_0x5c0204,null))[_0x7278('0x25')](removeEntity(_0x5c0204,null))['catch'](handleError(_0x5c0204,null));};exports[_0x7278('0x55')]=function(_0x337f72,_0x4bfbc9,_0x20b293){return db['Team'][_0x7278('0x56')]({'where':{'id':_0x337f72['params']['id']}})[_0x7278('0x25')](handleEntityNotFound(_0x4bfbc9,null))[_0x7278('0x25')](function(_0x9709b7){if(!_0x337f72[_0x7278('0x31')][_0x7278('0x57')]||!utils[_0x7278('0x58')](_0x337f72[_0x7278('0x31')]['channel'])){throw new db[(_0x7278('0x59'))][(_0x7278('0x5a'))](_0x7278('0x5b'));}var _0x5b2ead={};var _0xad5a76={};_0xad5a76['model']=_['keys'](db[_[_0x7278('0x5c')](_0x337f72[_0x7278('0x31')][_0x7278('0x57')]['toLowerCase']())+_0x7278('0x5d')][_0x7278('0x2c')]);_0xad5a76[_0x7278('0x31')]=_[_0x7278('0x32')](_0x337f72[_0x7278('0x31')]);_0xad5a76[_0x7278('0x3b')]=_[_0x7278('0x33')](_0xad5a76[_0x7278('0x30')],_0xad5a76['query']);_0x5b2ead[_0x7278('0x34')]=_[_0x7278('0x33')](_0xad5a76[_0x7278('0x30')],qs[_0x7278('0x35')](_0x337f72[_0x7278('0x31')][_0x7278('0x35')]));_0x5b2ead[_0x7278('0x34')]=_0x5b2ead['attributes']['length']?_0x5b2ead[_0x7278('0x34')]:_0xad5a76[_0x7278('0x30')];_0x5b2ead['limit']=qs[_0x7278('0x1e')](_0x337f72[_0x7278('0x31')][_0x7278('0x1e')]);_0x5b2ead[_0x7278('0x1d')]=qs['offset'](_0x337f72[_0x7278('0x31')][_0x7278('0x1d')]);_0x5b2ead[_0x7278('0x38')]=qs['sort'](_0x337f72[_0x7278('0x31')][_0x7278('0x39')]);_0x5b2ead[_0x7278('0x3a')]=qs['filters'](_[_0x7278('0x3c')](_0x337f72[_0x7278('0x31')],_0xad5a76[_0x7278('0x3b')]));_0x5b2ead=_['merge']({},_0x5b2ead,_0x337f72[_0x7278('0x41')]);return _0x9709b7[_0x7278('0x26')+_[_0x7278('0x5c')](_0x337f72['query'][_0x7278('0x57')][_0x7278('0x5e')]())+_0x7278('0x5f')](_0x5b2ead);})[_0x7278('0x25')](respondWithResult(_0x4bfbc9,null))[_0x7278('0x46')](handleError(_0x4bfbc9,null));};exports[_0x7278('0x60')]=function(_0x461fb1,_0x39d0fb,_0x2658fb){return db[_0x7278('0x44')][_0x7278('0x56')]({'where':{'id':_0x461fb1[_0x7278('0x47')]['id']}})[_0x7278('0x25')](function(_0x58a444){if(_0x58a444){if(!_0x461fb1[_0x7278('0x54')][_0x7278('0x57')]||!utils[_0x7278('0x58')](_0x461fb1['body']['channel'])){throw new db[(_0x7278('0x59'))][(_0x7278('0x5a'))]('Unknown\x20channel');}return _0x58a444['add'+_[_0x7278('0x5c')](_0x461fb1[_0x7278('0x54')]['channel'][_0x7278('0x5e')]())+_0x7278('0x5f')](_0x461fb1[_0x7278('0x54')][_0x7278('0x61')]);}return null;})[_0x7278('0x25')](handleEntityNotFound(_0x39d0fb,null))[_0x7278('0x25')](respondWithStatusCode(_0x39d0fb,null))['catch'](handleError(_0x39d0fb,null));};exports[_0x7278('0x62')]=function(_0x25af22,_0x5dfe78,_0x24426f){return db[_0x7278('0x44')]['findOne']({'where':{'id':_0x25af22[_0x7278('0x47')]['id']}})[_0x7278('0x25')](function(_0x1b21f8){if(_0x1b21f8){if(!_0x25af22['query'][_0x7278('0x57')]||!utils['isValidChannel'](_0x25af22[_0x7278('0x31')][_0x7278('0x57')])){throw new db[(_0x7278('0x59'))][(_0x7278('0x5a'))](_0x7278('0x5b'));}return _0x1b21f8[_0x7278('0x63')+_[_0x7278('0x5c')](_0x25af22[_0x7278('0x31')][_0x7278('0x57')][_0x7278('0x5e')]())+'Queues'](_0x25af22[_0x7278('0x31')]['ids']);}return null;})[_0x7278('0x25')](handleEntityNotFound(_0x5dfe78,null))[_0x7278('0x25')](respondWithStatusCode(_0x5dfe78,null))[_0x7278('0x46')](handleError(_0x5dfe78,null));};exports[_0x7278('0x64')]=function(_0x2d11ab,_0x5a91fc,_0x1fa6c1){return db[_0x7278('0x44')]['find']({'where':{'id':_0x2d11ab[_0x7278('0x47')]['id']}})[_0x7278('0x25')](handleEntityNotFound(_0x5a91fc,null))[_0x7278('0x25')](function(_0x513836){if(_0x513836){var _0x14ffed=['Voice','Chat',_0x7278('0x65'),_0x7278('0x66'),_0x7278('0x67'),_0x7278('0x68'),_0x7278('0x69')];return BPromise[_0x7278('0x6a')](_0x14ffed,function(_0x4a8af1){return _0x513836['get'+_0x4a8af1+_0x7278('0x5f')]({'attributes':['id',_0x7278('0x2a')]})[_0x7278('0x25')](function(_0x3e70b6){return BPromise[_0x7278('0x6a')](_0x3e70b6,function(_0x1bd72c){return _0x1bd72c[_0x7278('0x64')](_0x2d11ab[_0x7278('0x54')][_0x7278('0x61')])['then'](function(){if(_0x4a8af1===_0x7278('0x6b')){return db['User'][_0x7278('0x45')]({'where':{'id':_0x2d11ab[_0x7278('0x54')]['ids']},'attributes':['id','name',_0x7278('0x6c'),'voicePause','interface'],'raw':!![]})[_0x7278('0x25')](function(_0x2ddee7){return BPromise[_0x7278('0x6a')](_[_0x7278('0x3d')](_0x2ddee7,{'online':0x1}),function(_0x5a85c2){return db[_0x7278('0x6d')][_0x7278('0x6e')]({'membername':_0x5a85c2[_0x7278('0x2a')],'UserId':_0x5a85c2['id'],'queue_name':_0x1bd72c[_0x7278('0x2a')],'VoiceQueueId':_0x1bd72c['id'],'interface':_[_0x7278('0x6f')](_0x5a85c2[_0x7278('0x70')])?util[_0x7278('0x71')](_0x7278('0x72'),_0x5a85c2[_0x7278('0x2a')]):_0x5a85c2['interface'],'paused':_0x5a85c2[_0x7278('0x73')]||![],'penalty':0x0});});});}});});})[_0x7278('0x25')](function(){return _0x513836;});})[_0x7278('0x25')](function(){return _0x513836;});}})[_0x7278('0x25')](function(_0x3f5303){if(_0x3f5303){return _0x3f5303['addAgents'](_0x2d11ab[_0x7278('0x54')][_0x7278('0x61')],_['omit'](_0x2d11ab[_0x7278('0x54')],[_0x7278('0x61'),'id'])||{})[_0x7278('0x74')](function(_0x1c1b57){for(var _0x238e74=0x0;_0x238e74<_0x2d11ab[_0x7278('0x54')][_0x7278('0x61')][_0x7278('0x36')];_0x238e74+=0x1){socket[_0x7278('0x75')]('userTeam:save',{'UserId':_0x2d11ab['body']['ids'][_0x238e74],'TeamId':_0x2d11ab[_0x7278('0x47')]['id']});}return _0x1c1b57;});}})[_0x7278('0x25')](respondWithResult(_0x5a91fc,null))['catch'](handleError(_0x5a91fc,null));};exports[_0x7278('0x76')]=function(_0x3dc95a,_0x4079bd,_0x3a3aab){return db[_0x7278('0x44')][_0x7278('0x4f')]({'where':{'id':_0x3dc95a['params']['id']}})[_0x7278('0x25')](handleEntityNotFound(_0x4079bd,null))[_0x7278('0x25')](function(_0xd1b951){if(_0xd1b951){return BPromise[_0x7278('0x6a')]([_0x7278('0x77'),_0x7278('0x78'),'mail',_0x7278('0x79'),_0x7278('0x7a'),_0x7278('0x7b'),_0x7278('0x7c')],function(_0x289915){return _0xd1b951['get'+_[_0x7278('0x5c')](_0x289915)+_0x7278('0x5f')]({'attributes':['id','name']})[_0x7278('0x25')](function(_0x1713e7){return BPromise['each'](_0x1713e7,function(_0x1b7b0b){return _0x1b7b0b[_0x7278('0x76')](_0x3dc95a[_0x7278('0x31')]['ids'])[_0x7278('0x25')](function(){if(_0x289915===_0x7278('0x77')){return db[_0x7278('0x6d')][_0x7278('0x24')]({'where':{'VoiceQueueId':_0x1b7b0b['id'],'UserId':_0x3dc95a[_0x7278('0x31')][_0x7278('0x61')]}});}});});})['then'](function(){return _0xd1b951;});})['then'](function(){return _0xd1b951;});}})[_0x7278('0x25')](function(_0x194c97){if(_0x194c97){return _0x194c97[_0x7278('0x76')](_0x3dc95a[_0x7278('0x31')][_0x7278('0x61')])['then'](function(){if(_[_0x7278('0x7d')](_0x3dc95a['query']['ids'])){for(var _0x476ad6=0x0;_0x476ad6<_0x3dc95a[_0x7278('0x31')][_0x7278('0x61')][_0x7278('0x36')];_0x476ad6+=0x1){socket['emit'](_0x7278('0x7e'),{'UserId':Number(_0x3dc95a[_0x7278('0x31')][_0x7278('0x61')][_0x476ad6]),'TeamId':Number(_0x3dc95a[_0x7278('0x47')]['id'])});}}else{socket['emit'](_0x7278('0x7e'),{'UserId':Number(_0x3dc95a[_0x7278('0x31')]['ids']),'TeamId':Number(_0x3dc95a[_0x7278('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x4079bd,null))['catch'](handleError(_0x4079bd,null));};exports[_0x7278('0x7f')]=function(_0x311fc4,_0x1ccb08,_0x241752){var _0x9f9ae={};var _0x25e1be={};var _0xf85baa;var _0x404bc2;return db[_0x7278('0x44')][_0x7278('0x56')]({'where':{'id':_0x311fc4[_0x7278('0x47')]['id']}})[_0x7278('0x25')](handleEntityNotFound(_0x1ccb08,null))[_0x7278('0x25')](function(_0x48a4ac){if(_0x48a4ac){_0xf85baa=_0x48a4ac;_0x25e1be[_0x7278('0x30')]=_[_0x7278('0x32')](db[_0x7278('0x80')][_0x7278('0x2c')]);_0x25e1be[_0x7278('0x31')]=_[_0x7278('0x32')](_0x311fc4[_0x7278('0x31')]);_0x25e1be[_0x7278('0x3b')]=_[_0x7278('0x33')](_0x25e1be[_0x7278('0x30')],_0x25e1be[_0x7278('0x31')]);_0x9f9ae['attributes']=_[_0x7278('0x33')](_0x25e1be['model'],qs[_0x7278('0x35')](_0x311fc4[_0x7278('0x31')]['fields']));_0x9f9ae[_0x7278('0x34')]=_0x9f9ae['attributes'][_0x7278('0x36')]?_0x9f9ae[_0x7278('0x34')]:_0x25e1be['model'];_0x9f9ae['order']=qs['sort'](_0x311fc4[_0x7278('0x31')][_0x7278('0x39')]);_0x9f9ae[_0x7278('0x3a')]=qs[_0x7278('0x3b')](_[_0x7278('0x3c')](_0x311fc4[_0x7278('0x31')],_0x25e1be[_0x7278('0x3b')]));if(_0x311fc4[_0x7278('0x31')]['filter']){_0x9f9ae[_0x7278('0x3a')]=_[_0x7278('0x3e')](_0x9f9ae['where'],{'$or':_['map'](_0x9f9ae[_0x7278('0x34')],function(_0x1ca4c5){var _0x1b476d={};_0x1b476d[_0x1ca4c5]={'$like':'%'+_0x311fc4[_0x7278('0x31')][_0x7278('0x3d')]+'%'};return _0x1b476d;})});}_0x9f9ae=_[_0x7278('0x3e')]({},_0x9f9ae,_0x311fc4[_0x7278('0x41')]);return _0xf85baa['getAgents'](_0x9f9ae);}})[_0x7278('0x25')](function(_0x4f7d54){if(_0x4f7d54){_0x404bc2=_0x4f7d54['length'];if(!_0x311fc4[_0x7278('0x31')][_0x7278('0x37')](_0x7278('0x81'))){_0x9f9ae[_0x7278('0x1e')]=qs[_0x7278('0x1e')](_0x311fc4['query'][_0x7278('0x1e')]);_0x9f9ae[_0x7278('0x1d')]=qs[_0x7278('0x1d')](_0x311fc4[_0x7278('0x31')][_0x7278('0x1d')]);}return _0xf85baa['getAgents'](_0x9f9ae);}})['then'](function(_0x18dc8e){if(_0x18dc8e){return _0x18dc8e?{'count':_0x404bc2,'rows':_0x18dc8e}:null;}})[_0x7278('0x25')](respondWithResult(_0x1ccb08,null))[_0x7278('0x46')](handleError(_0x1ccb08,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 61f4fd5..13b48f7 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 _0x5cd8=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Team','setMaxListeners','save'];(function(_0x2b4210,_0x521514){var _0x5b5b93=function(_0x2a3140){while(--_0x2a3140){_0x2b4210['push'](_0x2b4210['shift']());}};_0x5b5b93(++_0x521514);}(_0x5cd8,0x13c));var _0x85cd=function(_0x38a67a,_0x248684){_0x38a67a=_0x38a67a-0x0;var _0x2f933e=_0x5cd8[_0x38a67a];return _0x2f933e;};'use strict';var EventEmitter=require('events');var Team=require(_0x85cd('0x0'))['db'][_0x85cd('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x85cd('0x2')](0x0);var events={'afterCreate':_0x85cd('0x3'),'afterUpdate':_0x85cd('0x4'),'afterDestroy':_0x85cd('0x5')};function emitEvent(_0x279bdc){return function(_0x37ded8,_0xb64f38,_0x2ad293){TeamEvents['emit'](_0x279bdc+':'+_0x37ded8['id'],_0x37ded8);TeamEvents[_0x85cd('0x6')](_0x279bdc,_0x37ded8);_0x2ad293(null);};}for(var e in events){if(events[_0x85cd('0x7')](e)){var event=events[e];Team[_0x85cd('0x8')](e,emitEvent(event));}}module[_0x85cd('0x9')]=TeamEvents; \ No newline at end of file +var _0xdfd5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x5f2edf,_0x5cb8fb){var _0x546962=function(_0x1ca619){while(--_0x1ca619){_0x5f2edf['push'](_0x5f2edf['shift']());}};_0x546962(++_0x5cb8fb);}(_0xdfd5,0x1ee));var _0x5dfd=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xdfd5[_0x51c819];return _0x15c5d2;};'use strict';var EventEmitter=require(_0x5dfd('0x0'));var Team=require(_0x5dfd('0x1'))['db'][_0x5dfd('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x5dfd('0x3')](0x0);var events={'afterCreate':_0x5dfd('0x4'),'afterUpdate':_0x5dfd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x430b23){return function(_0x23519e,_0x5b6b8e,_0x5a8abf){TeamEvents[_0x5dfd('0x6')](_0x430b23+':'+_0x23519e['id'],_0x23519e);TeamEvents[_0x5dfd('0x6')](_0x430b23,_0x23519e);_0x5a8abf(null);};}for(var e in events){if(events[_0x5dfd('0x7')](e)){var event=events[e];Team[_0x5dfd('0x8')](e,emitEvent(event));}}module[_0x5dfd('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 3c3b0f7..178da3d 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 _0x5b5f=['rimraf','./team.attributes','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x5b5f,0x157));var _0xf5b5=function(_0x2dc735,_0x5b3890){_0x2dc735=_0x2dc735-0x0;var _0x1c3693=_0x5b5f[_0x2dc735];return _0x1c3693;};'use strict';var _=require(_0xf5b5('0x0'));var util=require('util');var logger=require(_0xf5b5('0x1'))(_0xf5b5('0x2'));var moment=require(_0xf5b5('0x3'));var BPromise=require(_0xf5b5('0x4'));var rp=require(_0xf5b5('0x5'));var fs=require('fs');var path=require(_0xf5b5('0x6'));var rimraf=require(_0xf5b5('0x7'));var config=require('../../config/environment');var attributes=require(_0xf5b5('0x8'));module['exports']=function(_0x11d8cd,_0x59c99f){return _0x11d8cd[_0xf5b5('0x9')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcefd=['Team','teams','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x358fb5,_0x4407b8){var _0x4abfeb=function(_0x55c45d){while(--_0x55c45d){_0x358fb5['push'](_0x358fb5['shift']());}};_0x4abfeb(++_0x4407b8);}(_0xcefd,0x120));var _0xdcef=function(_0x43a12f,_0x3d0108){_0x43a12f=_0x43a12f-0x0;var _0x36994d=_0xcefd[_0x43a12f];return _0x36994d;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var logger=require('../../config/logger')(_0xdcef('0x2'));var moment=require(_0xdcef('0x3'));var BPromise=require(_0xdcef('0x4'));var rp=require(_0xdcef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcef('0x6'));var config=require(_0xdcef('0x7'));var attributes=require('./team.attributes');module[_0xdcef('0x8')]=function(_0x1caa2b,_0x241e13){return _0x1caa2b['define'](_0xdcef('0x9'),attributes,{'tableName':_0xdcef('0xa'),'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 0a32f2f..371395f 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 _0x910f=['Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','./team.socket','register','request','info'];(function(_0x38df8f,_0x41d61d){var _0x2a98e9=function(_0x2ea1b5){while(--_0x2ea1b5){_0x38df8f['push'](_0x38df8f['shift']());}};_0x2a98e9(++_0x41d61d);}(_0x910f,0x19a));var _0xf910=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x910f[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0xf910('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf910('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf910('0x2'));var db=require(_0xf910('0x3'))['db'];var utils=require(_0xf910('0x4'));var logger=require(_0xf910('0x5'))('rpc');var config=require(_0xf910('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf910('0x7')]['http']({'port':0x232a});config[_0xf910('0x8')]=_[_0xf910('0x9')](config[_0xf910('0x8')],{'host':_0xf910('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf910('0x8')]));require(_0xf910('0xb'))[_0xf910('0xc')](socket);function respondWithRpcPromise(_0x5c9e7e,_0x149cf1,_0x291e6e){return new BPromise(function(_0x1512db,_0x12e129){return client[_0xf910('0xd')](_0x5c9e7e,_0x291e6e)['then'](function(_0x3537da){logger[_0xf910('0xe')](_0xf910('0xf'),_0x149cf1,'request\x20sent');logger[_0xf910('0x10')](_0xf910('0x11'),_0x149cf1,_0xf910('0x12'),JSON[_0xf910('0x13')](_0x3537da));if(_0x3537da[_0xf910('0x14')]){if(_0x3537da[_0xf910('0x14')][_0xf910('0x15')]===0x1f4){logger[_0xf910('0x14')](_0xf910('0xf'),_0x149cf1,_0x3537da[_0xf910('0x14')]['message']);return _0x12e129(_0x3537da[_0xf910('0x14')][_0xf910('0x16')]);}logger['error'](_0xf910('0xf'),_0x149cf1,_0x3537da[_0xf910('0x14')]['message']);return _0x1512db(_0x3537da['error'][_0xf910('0x16')]);}else{logger[_0xf910('0xe')](_0xf910('0xf'),_0x149cf1,'request\x20sent');_0x1512db(_0x3537da[_0xf910('0x17')][_0xf910('0x16')]);}})[_0xf910('0x18')](function(_0x4c1dbf){logger[_0xf910('0x14')]('Team,\x20%s,\x20%s',_0x149cf1,_0x4c1dbf);_0x12e129(_0x4c1dbf);});});} \ No newline at end of file +var _0xebd6=['localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0xebd6,0x1d1));var _0x6ebd=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xebd6[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6ebd('0x0'));var rs=require(_0x6ebd('0x1'));var fs=require('fs');var Redis=require(_0x6ebd('0x2'));var db=require(_0x6ebd('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6ebd('0x4'));var jayson=require(_0x6ebd('0x5'));var client=jayson[_0x6ebd('0x6')][_0x6ebd('0x7')]({'port':0x232a});config[_0x6ebd('0x8')]=_[_0x6ebd('0x9')](config[_0x6ebd('0x8')],{'host':_0x6ebd('0xa'),'port':0x18eb});var socket=require(_0x6ebd('0xb'))(new Redis(config[_0x6ebd('0x8')]));require(_0x6ebd('0xc'))[_0x6ebd('0xd')](socket);function respondWithRpcPromise(_0x272ee4,_0x17c97f,_0x2d7c86){return new BPromise(function(_0x385d6e,_0x3a0952){return client[_0x6ebd('0xe')](_0x272ee4,_0x2d7c86)[_0x6ebd('0xf')](function(_0x217cf9){logger[_0x6ebd('0x10')](_0x6ebd('0x11'),_0x17c97f,_0x6ebd('0x12'));logger[_0x6ebd('0x13')](_0x6ebd('0x14'),_0x17c97f,_0x6ebd('0x12'),JSON['stringify'](_0x217cf9));if(_0x217cf9['error']){if(_0x217cf9['error']['code']===0x1f4){logger[_0x6ebd('0x15')](_0x6ebd('0x11'),_0x17c97f,_0x217cf9[_0x6ebd('0x15')][_0x6ebd('0x16')]);return _0x3a0952(_0x217cf9[_0x6ebd('0x15')][_0x6ebd('0x16')]);}logger['error'](_0x6ebd('0x11'),_0x17c97f,_0x217cf9[_0x6ebd('0x15')][_0x6ebd('0x16')]);return _0x385d6e(_0x217cf9[_0x6ebd('0x15')][_0x6ebd('0x16')]);}else{logger['info'](_0x6ebd('0x11'),_0x17c97f,_0x6ebd('0x12'));_0x385d6e(_0x217cf9[_0x6ebd('0x17')]['message']);}})[_0x6ebd('0x18')](function(_0x474b0b){logger[_0x6ebd('0x15')](_0x6ebd('0x11'),_0x17c97f,_0x474b0b);_0x3a0952(_0x474b0b);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 192ec57..0cab2c8 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 _0xd8fb=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x19741a,_0x279473){var _0x3fc644=function(_0x5e6195){while(--_0x5e6195){_0x19741a['push'](_0x19741a['shift']());}};_0x3fc644(++_0x279473);}(_0xd8fb,0x99));var _0xbd8f=function(_0x55dc50,_0x1797c8){_0x55dc50=_0x55dc50-0x0;var _0x39221d=_0xd8fb[_0x55dc50];return _0x39221d;};'use strict';var TeamEvents=require(_0xbd8f('0x0'));var events=[_0xbd8f('0x1'),_0xbd8f('0x2'),_0xbd8f('0x3')];function createListener(_0x52724c,_0x5ea933){return function(_0x4e9545){_0x5ea933[_0xbd8f('0x4')](_0x52724c,_0x4e9545);};}function removeListener(_0x43d177,_0x53cccc){return function(){TeamEvents[_0xbd8f('0x5')](_0x43d177,_0x53cccc);};}exports[_0xbd8f('0x6')]=function(_0x5543b2){for(var _0x33d541=0x0,_0x4e97cf=events[_0xbd8f('0x7')];_0x33d541<_0x4e97cf;_0x33d541++){var _0x578499=events[_0x33d541];var _0x197827=createListener(_0xbd8f('0x8')+_0x578499,_0x5543b2);TeamEvents['on'](_0x578499,_0x197827);}}; \ No newline at end of file +var _0x8ace=['emit','removeListener','register','length','./team.events','save','remove','update'];(function(_0x3efa94,_0x3530c2){var _0x3363f8=function(_0x5178bc){while(--_0x5178bc){_0x3efa94['push'](_0x3efa94['shift']());}};_0x3363f8(++_0x3530c2);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x12ed67,_0x1a5083){_0x12ed67=_0x12ed67-0x0;var _0x197263=_0x8ace[_0x12ed67];return _0x197263;};'use strict';var TeamEvents=require(_0xe8ac('0x0'));var events=[_0xe8ac('0x1'),_0xe8ac('0x2'),_0xe8ac('0x3')];function createListener(_0x3896f9,_0x142625){return function(_0x2dd17e){_0x142625[_0xe8ac('0x4')](_0x3896f9,_0x2dd17e);};}function removeListener(_0x114351,_0xf6af00){return function(){TeamEvents[_0xe8ac('0x5')](_0x114351,_0xf6af00);};}exports[_0xe8ac('0x6')]=function(_0x170e14){for(var _0x2b48ec=0x0,_0x4eb087=events[_0xe8ac('0x7')];_0x2b48ec<_0x4eb087;_0x2b48ec++){var _0x1357ed=events[_0x2b48ec];var _0x4f9233=createListener('team:'+_0x1357ed,_0x170e14);TeamEvents['on'](_0x1357ed,_0x4f9233);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b618eda..0e97602 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 _0xe28a=['update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x1677ea,_0x4eb263){var _0x4968f7=function(_0x121a74){while(--_0x121a74){_0x1677ea['push'](_0x1677ea['shift']());}};_0x4968f7(++_0x4eb263);}(_0xe28a,0x103));var _0xae28=function(_0x221381,_0x16c3bc){_0x221381=_0x221381-0x0;var _0x42d046=_0xe28a[_0x221381];return _0x42d046;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xae28('0x0'));var express=require(_0xae28('0x1'));var router=express[_0xae28('0x2')]();var auth=require(_0xae28('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xae28('0x4'));var controller=require(_0xae28('0x5'));router['get']('/',auth[_0xae28('0x6')](),controller[_0xae28('0x7')]);router['get']('/:id',auth[_0xae28('0x6')](),controller[_0xae28('0x8')]);router[_0xae28('0x9')]('/',auth['isAuthenticated'](),controller[_0xae28('0xa')]);router[_0xae28('0xb')](_0xae28('0xc'),auth[_0xae28('0x6')](),controller[_0xae28('0xd')]);router[_0xae28('0xe')](_0xae28('0xc'),auth[_0xae28('0x6')](),controller['destroy']);module[_0xae28('0xf')]=router; \ No newline at end of file +var _0x8c2e=['index','get','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x8c2e,0x1d6));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe8c2('0x0'));var util=require('util');var path=require(_0xe8c2('0x1'));var timeout=require(_0xe8c2('0x2'));var express=require(_0xe8c2('0x3'));var router=express[_0xe8c2('0x4')]();var auth=require(_0xe8c2('0x5'));var interaction=require(_0xe8c2('0x6'));var config=require(_0xe8c2('0x7'));var controller=require(_0xe8c2('0x8'));router['get']('/',auth[_0xe8c2('0x9')](),controller[_0xe8c2('0xa')]);router[_0xe8c2('0xb')](_0xe8c2('0xc'),auth[_0xe8c2('0x9')](),controller[_0xe8c2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe8c2('0xe')]);router[_0xe8c2('0xf')]('/:id',auth[_0xe8c2('0x9')](),controller[_0xe8c2('0x10')]);router[_0xe8c2('0x11')](_0xe8c2('0xc'),auth[_0xe8c2('0x9')](),controller[_0xe8c2('0x12')]);module[_0xe8c2('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c4596eb..7a0b4a4 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 _0xc2f2=['STRING','TEXT','sequelize'];(function(_0x5827dd,_0x40b061){var _0x6195bb=function(_0x113aef){while(--_0x113aef){_0x5827dd['push'](_0x5827dd['shift']());}};_0x6195bb(++_0x40b061);}(_0xc2f2,0xb9));var _0x2c2f=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xc2f2[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x2c2f('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c2f('0x1')]},'description':{'type':Sequelize[_0x2c2f('0x1')]},'html':{'type':Sequelize[_0x2c2f('0x2')]}}; \ No newline at end of file +var _0x8116=['sequelize','exports','STRING','TEXT'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0x8116,0x1ec));var _0x6811=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8116[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x6811('0x0'));module[_0x6811('0x1')]={'name':{'type':Sequelize[_0x6811('0x2')]},'description':{'type':Sequelize[_0x6811('0x2')]},'html':{'type':Sequelize[_0x6811('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 443595a..07be150 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 _0x7282=['intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','json','count','offset','limit','apply','reject','save','update','destroy','then','get','Templates','sendStatus','error','stack','name','send','index','map','Template','fieldName','type','keys','query','filters','model'];(function(_0x27cee6,_0x517bde){var _0x3736fa=function(_0x365e73){while(--_0x365e73){_0x27cee6['push'](_0x27cee6['shift']());}};_0x3736fa(++_0x517bde);}(_0x7282,0xba));var _0x2728=function(_0x2c396c,_0x4db177){_0x2c396c=_0x2c396c-0x0;var _0x26219b=_0x7282[_0x2c396c];return _0x26219b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2728('0x0'));var rimraf=require(_0x2728('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2728('0x2'));var rp=require('request-promise');var moment=require(_0x2728('0x3'));var BPromise=require(_0x2728('0x4'));var Mustache=require(_0x2728('0x5'));var util=require(_0x2728('0x6'));var path=require(_0x2728('0x7'));var sox=require(_0x2728('0x8'));var csv=require(_0x2728('0x9'));var ejs=require(_0x2728('0xa'));var fs=require('fs');var _=require(_0x2728('0xb'));var squel=require(_0x2728('0xc'));var crypto=require(_0x2728('0xd'));var jsforce=require(_0x2728('0xe'));var deskjs=require(_0x2728('0xf'));var toCsv=require(_0x2728('0x9'));var querystring=require(_0x2728('0x10'));var Papa=require(_0x2728('0x11'));var Redis=require(_0x2728('0x12'));var authService=require(_0x2728('0x13'));var qs=require(_0x2728('0x14'));var as=require(_0x2728('0x15'));var hardwareService=require(_0x2728('0x16'));var logger=require(_0x2728('0x17'))(_0x2728('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2728('0x19'))['db'];function respondWithStatusCode(_0x3c8664,_0x5eb18e){_0x5eb18e=_0x5eb18e||0xcc;return function(_0x4b420e){if(_0x4b420e){return _0x3c8664['sendStatus'](_0x5eb18e);}return _0x3c8664['status'](_0x5eb18e)[_0x2728('0x1a')]();};}function respondWithResult(_0x23034d,_0x5a497b){_0x5a497b=_0x5a497b||0xc8;return function(_0x54e519){if(_0x54e519){return _0x23034d[_0x2728('0x1b')](_0x5a497b)[_0x2728('0x1c')](_0x54e519);}};}function respondWithFilteredResult(_0x1e8046,_0x86fcd9){return function(_0xf4adcd){if(_0xf4adcd){var _0x5307ee=_0xf4adcd[_0x2728('0x1d')],_0x20687a=_0x86fcd9[_0x2728('0x1e')],_0x2131ba=_0x86fcd9[_0x2728('0x1e')]+_0x86fcd9[_0x2728('0x1f')],_0x377213;if(_0x2131ba>=_0x5307ee){_0x2131ba=_0x5307ee;_0x377213=0xc8;}else{_0x377213=0xce;}_0x1e8046[_0x2728('0x1b')](_0x377213);return _0x1e8046['set']('Content-Range',_0x20687a+'-'+_0x2131ba+'/'+_0x5307ee)['json'](_0xf4adcd);}return null;};}function patchUpdates(_0x1767e2){return function(_0x36b31a){try{jsonpatch[_0x2728('0x20')](_0x36b31a,_0x1767e2,!![]);}catch(_0x3f8ba6){return BPromise[_0x2728('0x21')](_0x3f8ba6);}return _0x36b31a[_0x2728('0x22')]();};}function saveUpdates(_0x115a4e,_0x372816){return function(_0x53a574){if(_0x53a574){return _0x53a574[_0x2728('0x23')](_0x115a4e)['then'](function(_0x171c23){return _0x171c23;});}return null;};}function removeEntity(_0xbfd495,_0x54692f){return function(_0x33d2cd){if(_0x33d2cd){return _0x33d2cd[_0x2728('0x24')]()[_0x2728('0x25')](function(){var _0x5bfc60=_0x33d2cd[_0x2728('0x26')]({'plain':!![]});var _0x232495=_0x2728('0x27');return db['UserProfileResource'][_0x2728('0x24')]({'where':{'type':_0x232495,'resourceId':_0x5bfc60['id']}})[_0x2728('0x25')](function(){return _0x33d2cd;});})['then'](function(){_0xbfd495[_0x2728('0x1b')](0xcc)[_0x2728('0x1a')]();});}};}function handleEntityNotFound(_0x353078,_0x33da7a){return function(_0x4e3b8a){if(!_0x4e3b8a){_0x353078[_0x2728('0x28')](0x194);}return _0x4e3b8a;};}function handleError(_0x514bfe,_0x45f6fc){_0x45f6fc=_0x45f6fc||0x1f4;return function(_0x4d9de3){logger[_0x2728('0x29')](_0x4d9de3[_0x2728('0x2a')]);if(_0x4d9de3[_0x2728('0x2b')]){delete _0x4d9de3[_0x2728('0x2b')];}_0x514bfe[_0x2728('0x1b')](_0x45f6fc)[_0x2728('0x2c')](_0x4d9de3);};}exports[_0x2728('0x2d')]=function(_0x505902,_0x49d09a){var _0x1a6bc2={},_0x525fd5={},_0x383f31={'count':0x0,'rows':[]};var _0x29d8d1=_[_0x2728('0x2e')](db[_0x2728('0x2f')]['rawAttributes'],function(_0x5dabd7){return{'name':_0x5dabd7[_0x2728('0x30')],'type':_0x5dabd7[_0x2728('0x31')]['key']};});_0x525fd5['model']=_['map'](_0x29d8d1,'name');_0x525fd5['query']=_[_0x2728('0x32')](_0x505902[_0x2728('0x33')]);_0x525fd5[_0x2728('0x34')]=_['intersection'](_0x525fd5[_0x2728('0x35')],_0x525fd5[_0x2728('0x33')]);_0x1a6bc2['attributes']=_[_0x2728('0x36')](_0x525fd5['model'],qs[_0x2728('0x37')](_0x505902['query']['fields']));_0x1a6bc2[_0x2728('0x38')]=_0x1a6bc2['attributes'][_0x2728('0x39')]?_0x1a6bc2['attributes']:_0x525fd5[_0x2728('0x35')];if(!_0x505902[_0x2728('0x33')][_0x2728('0x3a')]('nolimit')){_0x1a6bc2[_0x2728('0x1f')]=qs[_0x2728('0x1f')](_0x505902['query'][_0x2728('0x1f')]);_0x1a6bc2[_0x2728('0x1e')]=qs['offset'](_0x505902[_0x2728('0x33')][_0x2728('0x1e')]);}_0x1a6bc2['order']=qs['sort'](_0x505902[_0x2728('0x33')]['sort']);_0x1a6bc2[_0x2728('0x3b')]=qs[_0x2728('0x34')](_[_0x2728('0x3c')](_0x505902[_0x2728('0x33')],_0x525fd5[_0x2728('0x34')]),_0x29d8d1);if(_0x505902[_0x2728('0x33')][_0x2728('0x3d')]){_0x1a6bc2[_0x2728('0x3b')]=_[_0x2728('0x3e')](_0x1a6bc2[_0x2728('0x3b')],{'$or':_[_0x2728('0x2e')](_0x29d8d1,function(_0x5d5881){if(_0x5d5881[_0x2728('0x31')]!==_0x2728('0x3f')){var _0x31f61f={};_0x31f61f[_0x5d5881['name']]={'$like':'%'+_0x505902[_0x2728('0x33')][_0x2728('0x3d')]+'%'};return _0x31f61f;}})});}_0x1a6bc2=_[_0x2728('0x3e')]({},_0x1a6bc2,_0x505902[_0x2728('0x40')]);var _0x59c533={'where':_0x1a6bc2['where']};return db[_0x2728('0x2f')][_0x2728('0x1d')](_0x59c533)['then'](function(_0x326757){_0x383f31[_0x2728('0x1d')]=_0x326757;if(_0x505902[_0x2728('0x33')]['includeAll']){_0x1a6bc2[_0x2728('0x41')]=[{'all':!![]}];}return db['Template'][_0x2728('0x42')](_0x1a6bc2);})[_0x2728('0x25')](function(_0x104eb7){_0x383f31['rows']=_0x104eb7;return _0x383f31;})[_0x2728('0x25')](respondWithFilteredResult(_0x49d09a,_0x1a6bc2))[_0x2728('0x43')](handleError(_0x49d09a,null));};exports[_0x2728('0x44')]=function(_0x535d8c,_0x39aa97){var _0x8f400d={'raw':!![],'where':{'id':_0x535d8c[_0x2728('0x45')]['id']}},_0x2e9cd0={};_0x2e9cd0[_0x2728('0x35')]=_[_0x2728('0x32')](db['Template'][_0x2728('0x46')]);_0x2e9cd0[_0x2728('0x33')]=_[_0x2728('0x32')](_0x535d8c['query']);_0x2e9cd0[_0x2728('0x34')]=_[_0x2728('0x36')](_0x2e9cd0[_0x2728('0x35')],_0x2e9cd0[_0x2728('0x33')]);_0x8f400d[_0x2728('0x38')]=_['intersection'](_0x2e9cd0[_0x2728('0x35')],qs[_0x2728('0x37')](_0x535d8c[_0x2728('0x33')][_0x2728('0x37')]));_0x8f400d['attributes']=_0x8f400d[_0x2728('0x38')][_0x2728('0x39')]?_0x8f400d[_0x2728('0x38')]:_0x2e9cd0[_0x2728('0x35')];if(_0x535d8c[_0x2728('0x33')]['includeAll']){_0x8f400d['include']=[{'all':!![]}];}_0x8f400d=_[_0x2728('0x3e')]({},_0x8f400d,_0x535d8c[_0x2728('0x40')]);return db['Template']['find'](_0x8f400d)[_0x2728('0x25')](handleEntityNotFound(_0x39aa97,null))[_0x2728('0x25')](respondWithResult(_0x39aa97,null))[_0x2728('0x43')](handleError(_0x39aa97,null));};exports[_0x2728('0x47')]=function(_0x339ded,_0x7c6635){return db[_0x2728('0x2f')][_0x2728('0x47')](_0x339ded[_0x2728('0x48')],{})['then'](function(_0x114efb){var _0x2927ed=_0x339ded['user'][_0x2728('0x26')]({'plain':!![]});if(!_0x2927ed)throw new Error(_0x2728('0x49'));if(_0x2927ed['role']==='user'){var _0x3a58a2=_0x114efb[_0x2728('0x26')]({'plain':!![]});var _0x593773=_0x2728('0x27');return db[_0x2728('0x4a')][_0x2728('0x4b')]({'where':{'name':_0x593773,'userProfileId':_0x2927ed[_0x2728('0x4c')]},'raw':!![]})[_0x2728('0x25')](function(_0x244e61){if(_0x244e61&&_0x244e61[_0x2728('0x4d')]===0x0){return db[_0x2728('0x4e')][_0x2728('0x47')]({'name':_0x3a58a2[_0x2728('0x2b')],'resourceId':_0x3a58a2['id'],'type':_0x244e61[_0x2728('0x2b')],'sectionId':_0x244e61['id']},{})['then'](function(){return _0x114efb;});}else{return _0x114efb;}})[_0x2728('0x43')](function(_0x4e416d){logger[_0x2728('0x29')](_0x2728('0x4f'),_0x4e416d);throw _0x4e416d;});}return _0x114efb;})[_0x2728('0x25')](respondWithResult(_0x7c6635,0xc9))['catch'](handleError(_0x7c6635,null));};exports[_0x2728('0x23')]=function(_0x56ebad,_0x39ee41){if(_0x56ebad['body']['id']){delete _0x56ebad['body']['id'];}return db['Template'][_0x2728('0x4b')]({'where':{'id':_0x56ebad['params']['id']}})['then'](handleEntityNotFound(_0x39ee41,null))[_0x2728('0x25')](saveUpdates(_0x56ebad[_0x2728('0x48')],null))[_0x2728('0x25')](respondWithResult(_0x39ee41,null))['catch'](handleError(_0x39ee41,null));};exports[_0x2728('0x24')]=function(_0x509d4f,_0xe15564){return db[_0x2728('0x2f')][_0x2728('0x4b')]({'where':{'id':_0x509d4f['params']['id']}})[_0x2728('0x25')](handleEntityNotFound(_0xe15564,null))[_0x2728('0x25')](removeEntity(_0xe15564,null))['catch'](handleError(_0xe15564,null));}; \ No newline at end of file +var _0xdc4b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','include','findAll','rows','show','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse'];(function(_0x43f097,_0x39e6f6){var _0x374992=function(_0x578d56){while(--_0x578d56){_0x43f097['push'](_0x43f097['shift']());}};_0x374992(++_0x39e6f6);}(_0xdc4b,0x194));var _0xbdc4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdc4b[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0xbdc4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbdc4('0x1'));var zipdir=require(_0xbdc4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdc4('0x3'));var moment=require(_0xbdc4('0x4'));var BPromise=require(_0xbdc4('0x5'));var Mustache=require(_0xbdc4('0x6'));var util=require(_0xbdc4('0x7'));var path=require('path');var sox=require(_0xbdc4('0x8'));var csv=require('to-csv');var ejs=require(_0xbdc4('0x9'));var fs=require('fs');var _=require(_0xbdc4('0xa'));var squel=require(_0xbdc4('0xb'));var crypto=require(_0xbdc4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbdc4('0xd'));var querystring=require(_0xbdc4('0xe'));var Papa=require(_0xbdc4('0xf'));var Redis=require(_0xbdc4('0x10'));var authService=require(_0xbdc4('0x11'));var qs=require(_0xbdc4('0x12'));var as=require(_0xbdc4('0x13'));var hardwareService=require(_0xbdc4('0x14'));var logger=require(_0xbdc4('0x15'))(_0xbdc4('0x16'));var utils=require('../../config/utils');var config=require(_0xbdc4('0x17'));var db=require(_0xbdc4('0x18'))['db'];function respondWithStatusCode(_0x205799,_0x5a4966){_0x5a4966=_0x5a4966||0xcc;return function(_0x515eeb){if(_0x515eeb){return _0x205799[_0xbdc4('0x19')](_0x5a4966);}return _0x205799[_0xbdc4('0x1a')](_0x5a4966)[_0xbdc4('0x1b')]();};}function respondWithResult(_0x47fdc0,_0x133edb){_0x133edb=_0x133edb||0xc8;return function(_0x4b1e0a){if(_0x4b1e0a){return _0x47fdc0[_0xbdc4('0x1a')](_0x133edb)[_0xbdc4('0x1c')](_0x4b1e0a);}};}function respondWithFilteredResult(_0x2b4df9,_0x2a1a69){return function(_0xffffa2){if(_0xffffa2){var _0x1ff73=_0xffffa2[_0xbdc4('0x1d')],_0x35b8cc=_0x2a1a69[_0xbdc4('0x1e')],_0x1d1fb4=_0x2a1a69['offset']+_0x2a1a69[_0xbdc4('0x1f')],_0x140fa5;if(_0x1d1fb4>=_0x1ff73){_0x1d1fb4=_0x1ff73;_0x140fa5=0xc8;}else{_0x140fa5=0xce;}_0x2b4df9[_0xbdc4('0x1a')](_0x140fa5);return _0x2b4df9['set'](_0xbdc4('0x20'),_0x35b8cc+'-'+_0x1d1fb4+'/'+_0x1ff73)[_0xbdc4('0x1c')](_0xffffa2);}return null;};}function patchUpdates(_0x4b0e67){return function(_0x2dc2a8){try{jsonpatch['apply'](_0x2dc2a8,_0x4b0e67,!![]);}catch(_0x32cbe9){return BPromise[_0xbdc4('0x21')](_0x32cbe9);}return _0x2dc2a8[_0xbdc4('0x22')]();};}function saveUpdates(_0x5ec6b5,_0x1951f6){return function(_0x5bc2e2){if(_0x5bc2e2){return _0x5bc2e2[_0xbdc4('0x23')](_0x5ec6b5)[_0xbdc4('0x24')](function(_0x33f066){return _0x33f066;});}return null;};}function removeEntity(_0x462e3e,_0x150974){return function(_0x113e2b){if(_0x113e2b){return _0x113e2b[_0xbdc4('0x25')]()[_0xbdc4('0x24')](function(){var _0x2e2d59=_0x113e2b[_0xbdc4('0x26')]({'plain':!![]});var _0x241d9c=_0xbdc4('0x27');return db[_0xbdc4('0x28')][_0xbdc4('0x25')]({'where':{'type':_0x241d9c,'resourceId':_0x2e2d59['id']}})[_0xbdc4('0x24')](function(){return _0x113e2b;});})[_0xbdc4('0x24')](function(){_0x462e3e[_0xbdc4('0x1a')](0xcc)[_0xbdc4('0x1b')]();});}};}function handleEntityNotFound(_0x4209bc,_0x82a50f){return function(_0x43887a){if(!_0x43887a){_0x4209bc[_0xbdc4('0x19')](0x194);}return _0x43887a;};}function handleError(_0x24fd66,_0x45831c){_0x45831c=_0x45831c||0x1f4;return function(_0x3e12c8){logger[_0xbdc4('0x29')](_0x3e12c8[_0xbdc4('0x2a')]);if(_0x3e12c8[_0xbdc4('0x2b')]){delete _0x3e12c8[_0xbdc4('0x2b')];}_0x24fd66['status'](_0x45831c)[_0xbdc4('0x2c')](_0x3e12c8);};}exports[_0xbdc4('0x2d')]=function(_0x22b927,_0x5e51f2){var _0x2b9ebe={},_0x386ecb={},_0x4ac284={'count':0x0,'rows':[]};var _0x250d84=_[_0xbdc4('0x2e')](db[_0xbdc4('0x2f')][_0xbdc4('0x30')],function(_0x798991){return{'name':_0x798991[_0xbdc4('0x31')],'type':_0x798991[_0xbdc4('0x32')]['key']};});_0x386ecb[_0xbdc4('0x33')]=_[_0xbdc4('0x2e')](_0x250d84,_0xbdc4('0x2b'));_0x386ecb[_0xbdc4('0x34')]=_[_0xbdc4('0x35')](_0x22b927[_0xbdc4('0x34')]);_0x386ecb['filters']=_['intersection'](_0x386ecb[_0xbdc4('0x33')],_0x386ecb[_0xbdc4('0x34')]);_0x2b9ebe[_0xbdc4('0x36')]=_[_0xbdc4('0x37')](_0x386ecb[_0xbdc4('0x33')],qs[_0xbdc4('0x38')](_0x22b927[_0xbdc4('0x34')][_0xbdc4('0x38')]));_0x2b9ebe['attributes']=_0x2b9ebe['attributes'][_0xbdc4('0x39')]?_0x2b9ebe[_0xbdc4('0x36')]:_0x386ecb['model'];if(!_0x22b927[_0xbdc4('0x34')][_0xbdc4('0x3a')](_0xbdc4('0x3b'))){_0x2b9ebe[_0xbdc4('0x1f')]=qs[_0xbdc4('0x1f')](_0x22b927['query']['limit']);_0x2b9ebe[_0xbdc4('0x1e')]=qs[_0xbdc4('0x1e')](_0x22b927['query'][_0xbdc4('0x1e')]);}_0x2b9ebe[_0xbdc4('0x3c')]=qs[_0xbdc4('0x3d')](_0x22b927[_0xbdc4('0x34')][_0xbdc4('0x3d')]);_0x2b9ebe[_0xbdc4('0x3e')]=qs[_0xbdc4('0x3f')](_['pick'](_0x22b927[_0xbdc4('0x34')],_0x386ecb[_0xbdc4('0x3f')]),_0x250d84);if(_0x22b927[_0xbdc4('0x34')]['filter']){_0x2b9ebe['where']=_[_0xbdc4('0x40')](_0x2b9ebe[_0xbdc4('0x3e')],{'$or':_[_0xbdc4('0x2e')](_0x250d84,function(_0x42efa8){if(_0x42efa8[_0xbdc4('0x32')]!==_0xbdc4('0x41')){var _0x3ac5a5={};_0x3ac5a5[_0x42efa8[_0xbdc4('0x2b')]]={'$like':'%'+_0x22b927[_0xbdc4('0x34')][_0xbdc4('0x42')]+'%'};return _0x3ac5a5;}})});}_0x2b9ebe=_[_0xbdc4('0x40')]({},_0x2b9ebe,_0x22b927['options']);var _0x3a5a9c={'where':_0x2b9ebe['where']};return db[_0xbdc4('0x2f')][_0xbdc4('0x1d')](_0x3a5a9c)[_0xbdc4('0x24')](function(_0x416acb){_0x4ac284[_0xbdc4('0x1d')]=_0x416acb;if(_0x22b927[_0xbdc4('0x34')]['includeAll']){_0x2b9ebe[_0xbdc4('0x43')]=[{'all':!![]}];}return db[_0xbdc4('0x2f')][_0xbdc4('0x44')](_0x2b9ebe);})[_0xbdc4('0x24')](function(_0x59b188){_0x4ac284[_0xbdc4('0x45')]=_0x59b188;return _0x4ac284;})['then'](respondWithFilteredResult(_0x5e51f2,_0x2b9ebe))['catch'](handleError(_0x5e51f2,null));};exports[_0xbdc4('0x46')]=function(_0x3d7682,_0x371c36){var _0x2b5ff2={'raw':!![],'where':{'id':_0x3d7682['params']['id']}},_0x13e98a={};_0x13e98a[_0xbdc4('0x33')]=_[_0xbdc4('0x35')](db[_0xbdc4('0x2f')][_0xbdc4('0x30')]);_0x13e98a[_0xbdc4('0x34')]=_[_0xbdc4('0x35')](_0x3d7682[_0xbdc4('0x34')]);_0x13e98a[_0xbdc4('0x3f')]=_['intersection'](_0x13e98a[_0xbdc4('0x33')],_0x13e98a[_0xbdc4('0x34')]);_0x2b5ff2[_0xbdc4('0x36')]=_[_0xbdc4('0x37')](_0x13e98a[_0xbdc4('0x33')],qs[_0xbdc4('0x38')](_0x3d7682[_0xbdc4('0x34')]['fields']));_0x2b5ff2[_0xbdc4('0x36')]=_0x2b5ff2[_0xbdc4('0x36')]['length']?_0x2b5ff2[_0xbdc4('0x36')]:_0x13e98a[_0xbdc4('0x33')];if(_0x3d7682[_0xbdc4('0x34')][_0xbdc4('0x47')]){_0x2b5ff2[_0xbdc4('0x43')]=[{'all':!![]}];}_0x2b5ff2=_[_0xbdc4('0x40')]({},_0x2b5ff2,_0x3d7682[_0xbdc4('0x48')]);return db['Template'][_0xbdc4('0x49')](_0x2b5ff2)[_0xbdc4('0x24')](handleEntityNotFound(_0x371c36,null))['then'](respondWithResult(_0x371c36,null))['catch'](handleError(_0x371c36,null));};exports[_0xbdc4('0x4a')]=function(_0x1d63a1,_0x35c80b){return db['Template'][_0xbdc4('0x4a')](_0x1d63a1['body'],{})[_0xbdc4('0x24')](function(_0x479e54){var _0x486d55=_0x1d63a1[_0xbdc4('0x4b')][_0xbdc4('0x26')]({'plain':!![]});if(!_0x486d55)throw new Error(_0xbdc4('0x4c'));if(_0x486d55[_0xbdc4('0x4d')]==='user'){var _0x54fd63=_0x479e54['get']({'plain':!![]});var _0x1e5538='Templates';return db[_0xbdc4('0x4e')][_0xbdc4('0x49')]({'where':{'name':_0x1e5538,'userProfileId':_0x486d55[_0xbdc4('0x4f')]},'raw':!![]})['then'](function(_0x3bbd8c){if(_0x3bbd8c&&_0x3bbd8c[_0xbdc4('0x50')]===0x0){return db[_0xbdc4('0x28')][_0xbdc4('0x4a')]({'name':_0x54fd63[_0xbdc4('0x2b')],'resourceId':_0x54fd63['id'],'type':_0x3bbd8c['name'],'sectionId':_0x3bbd8c['id']},{})[_0xbdc4('0x24')](function(){return _0x479e54;});}else{return _0x479e54;}})['catch'](function(_0x47ede5){logger[_0xbdc4('0x29')](_0xbdc4('0x51'),_0x47ede5);throw _0x47ede5;});}return _0x479e54;})['then'](respondWithResult(_0x35c80b,0xc9))[_0xbdc4('0x52')](handleError(_0x35c80b,null));};exports['update']=function(_0x5259ef,_0x1b7744){if(_0x5259ef['body']['id']){delete _0x5259ef['body']['id'];}return db[_0xbdc4('0x2f')][_0xbdc4('0x49')]({'where':{'id':_0x5259ef[_0xbdc4('0x53')]['id']}})[_0xbdc4('0x24')](handleEntityNotFound(_0x1b7744,null))['then'](saveUpdates(_0x5259ef['body'],null))['then'](respondWithResult(_0x1b7744,null))[_0xbdc4('0x52')](handleError(_0x1b7744,null));};exports[_0xbdc4('0x25')]=function(_0x3a6e82,_0xa8c2ac){return db[_0xbdc4('0x2f')][_0xbdc4('0x49')]({'where':{'id':_0x3a6e82[_0xbdc4('0x53')]['id']}})['then'](handleEntityNotFound(_0xa8c2ac,null))[_0xbdc4('0x24')](removeEntity(_0xa8c2ac,null))[_0xbdc4('0x52')](handleError(_0xa8c2ac,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ec692ca..b4dc77c 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 _0x207e=['define','Template','tools_templates','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x207e,0x1e7));var _0xe207=function(_0x21e022,_0xb2e734){_0x21e022=_0x21e022-0x0;var _0x4abc93=_0x207e[_0x21e022];return _0x4abc93;};'use strict';var _=require(_0xe207('0x0'));var util=require(_0xe207('0x1'));var logger=require(_0xe207('0x2'))('api');var moment=require(_0xe207('0x3'));var BPromise=require(_0xe207('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe207('0x5'));var rimraf=require('rimraf');var config=require(_0xe207('0x6'));var attributes=require('./template.attributes');module[_0xe207('0x7')]=function(_0x399cb4,_0x2abac3){return _0x399cb4[_0xe207('0x8')](_0xe207('0x9'),attributes,{'tableName':_0xe207('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x247c=['define','Template','tools_templates','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports'];(function(_0x3a4acc,_0x1de058){var _0x52f597=function(_0x68eef2){while(--_0x68eef2){_0x3a4acc['push'](_0x3a4acc['shift']());}};_0x52f597(++_0x1de058);}(_0x247c,0x162));var _0xc247=function(_0x1658af,_0x5dbcab){_0x1658af=_0x1658af-0x0;var _0x30d065=_0x247c[_0x1658af];return _0x30d065;};'use strict';var _=require('lodash');var util=require(_0xc247('0x0'));var logger=require('../../config/logger')(_0xc247('0x1'));var moment=require(_0xc247('0x2'));var BPromise=require(_0xc247('0x3'));var rp=require(_0xc247('0x4'));var fs=require('fs');var path=require(_0xc247('0x5'));var rimraf=require(_0xc247('0x6'));var config=require(_0xc247('0x7'));var attributes=require(_0xc247('0x8'));module[_0xc247('0x9')]=function(_0x38289c,_0x43b5b3){return _0x38289c[_0xc247('0xa')](_0xc247('0xb'),attributes,{'tableName':_0xc247('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 efcc267..28d17e7 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 _0x14fa=['attributes','include','map','model','then','stringify','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetTemplate','Template','findAll','options','raw'];(function(_0x50f363,_0x492cab){var _0x6e0047=function(_0x4c9901){while(--_0x4c9901){_0x50f363['push'](_0x50f363['shift']());}};_0x6e0047(++_0x492cab);}(_0x14fa,0x11d));var _0xa14f=function(_0x4122b6,_0x452e47){_0x4122b6=_0x4122b6-0x0;var _0x293102=_0x14fa[_0x4122b6];return _0x293102;};'use strict';var _=require('lodash');var util=require(_0xa14f('0x0'));var moment=require('moment');var BPromise=require(_0xa14f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa14f('0x2'))['db'];var utils=require(_0xa14f('0x3'));var logger=require(_0xa14f('0x4'))(_0xa14f('0x5'));var config=require(_0xa14f('0x6'));var jayson=require(_0xa14f('0x7'));var client=jayson[_0xa14f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x559af7,_0x3fe630,_0xdee673){return new BPromise(function(_0x2d8c20,_0xb52d7d){return client[_0xa14f('0x9')](_0x559af7,_0xdee673)['then'](function(_0x52708d){logger['info'](_0xa14f('0xa'),_0x3fe630,_0xa14f('0xb'));logger[_0xa14f('0xc')](_0xa14f('0xd'),_0x3fe630,_0xa14f('0xb'),JSON['stringify'](_0x52708d));if(_0x52708d['error']){if(_0x52708d[_0xa14f('0xe')][_0xa14f('0xf')]===0x1f4){logger[_0xa14f('0xe')]('Template,\x20%s,\x20%s',_0x3fe630,_0x52708d[_0xa14f('0xe')][_0xa14f('0x10')]);return _0xb52d7d(_0x52708d[_0xa14f('0xe')][_0xa14f('0x10')]);}logger[_0xa14f('0xe')](_0xa14f('0xa'),_0x3fe630,_0x52708d[_0xa14f('0xe')][_0xa14f('0x10')]);return _0x2d8c20(_0x52708d['error'][_0xa14f('0x10')]);}else{logger[_0xa14f('0x11')](_0xa14f('0xa'),_0x3fe630,_0xa14f('0xb'));_0x2d8c20(_0x52708d[_0xa14f('0x12')][_0xa14f('0x10')]);}})[_0xa14f('0x13')](function(_0x4fbb7b){logger[_0xa14f('0xe')](_0xa14f('0xa'),_0x3fe630,_0x4fbb7b);_0xb52d7d(_0x4fbb7b);});});}exports[_0xa14f('0x14')]=function(_0x2804fe){var _0x4748bb=this;return new Promise(function(_0x1cef71,_0x485f8b){return db[_0xa14f('0x15')][_0xa14f('0x16')]({'raw':_0x2804fe[_0xa14f('0x17')]?_0x2804fe[_0xa14f('0x17')][_0xa14f('0x18')]===undefined?!![]:![]:!![],'where':_0x2804fe[_0xa14f('0x17')]?_0x2804fe[_0xa14f('0x17')]['where']||null:null,'attributes':_0x2804fe['options']?_0x2804fe[_0xa14f('0x17')][_0xa14f('0x19')]||null:null,'limit':_0x2804fe[_0xa14f('0x17')]?_0x2804fe[_0xa14f('0x17')]['limit']||null:null,'include':_0x2804fe['options']?_0x2804fe[_0xa14f('0x17')][_0xa14f('0x1a')]?_[_0xa14f('0x1b')](_0x2804fe[_0xa14f('0x17')][_0xa14f('0x1a')],function(_0x40ce68){return{'model':db[_0x40ce68[_0xa14f('0x1c')]],'as':_0x40ce68['as'],'attributes':_0x40ce68[_0xa14f('0x19')],'include':_0x40ce68[_0xa14f('0x1a')]?_[_0xa14f('0x1b')](_0x40ce68[_0xa14f('0x1a')],function(_0x45fde0){return{'model':db[_0x45fde0['model']],'as':_0x45fde0['as'],'attributes':_0x45fde0[_0xa14f('0x19')],'include':_0x45fde0[_0xa14f('0x1a')]?_[_0xa14f('0x1b')](_0x45fde0[_0xa14f('0x1a')],function(_0x46ea3e){return{'model':db[_0x46ea3e[_0xa14f('0x1c')]],'as':_0x46ea3e['as'],'attributes':_0x46ea3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa14f('0x1d')](function(_0x1c268a){logger[_0xa14f('0x11')](_0xa14f('0x14'),_0x2804fe);logger[_0xa14f('0xc')](_0xa14f('0x14'),_0x2804fe,JSON[_0xa14f('0x1e')](_0x1c268a));_0x1cef71(_0x1c268a);})[_0xa14f('0x13')](function(_0x4cddff){logger[_0xa14f('0xe')]('GetTemplate',_0x4cddff[_0xa14f('0x10')],_0x2804fe);_0x485f8b(_0x4748bb[_0xa14f('0xe')](0x1f4,_0x4cddff[_0xa14f('0x10')]));});});}; \ No newline at end of file +var _0x2407=['message','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x2407,0x16a));var _0x7240=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x2407[_0x34f701];return _0x3e2429;};'use strict';var _=require(_0x7240('0x0'));var util=require(_0x7240('0x1'));var moment=require(_0x7240('0x2'));var BPromise=require(_0x7240('0x3'));var rs=require(_0x7240('0x4'));var fs=require('fs');var Redis=require(_0x7240('0x5'));var db=require(_0x7240('0x6'))['db'];var utils=require(_0x7240('0x7'));var logger=require(_0x7240('0x8'))(_0x7240('0x9'));var config=require(_0x7240('0xa'));var jayson=require(_0x7240('0xb'));var client=jayson[_0x7240('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1affcb,_0x3a815d,_0x18aa30){return new BPromise(function(_0x7d7b31,_0x40ec57){return client[_0x7240('0xd')](_0x1affcb,_0x18aa30)[_0x7240('0xe')](function(_0x1d6a34){logger[_0x7240('0xf')]('Template,\x20%s,\x20%s',_0x3a815d,_0x7240('0x10'));logger[_0x7240('0x11')](_0x7240('0x12'),_0x3a815d,_0x7240('0x10'),JSON[_0x7240('0x13')](_0x1d6a34));if(_0x1d6a34[_0x7240('0x14')]){if(_0x1d6a34[_0x7240('0x14')][_0x7240('0x15')]===0x1f4){logger[_0x7240('0x14')](_0x7240('0x16'),_0x3a815d,_0x1d6a34[_0x7240('0x14')][_0x7240('0x17')]);return _0x40ec57(_0x1d6a34['error']['message']);}logger[_0x7240('0x14')](_0x7240('0x16'),_0x3a815d,_0x1d6a34[_0x7240('0x14')][_0x7240('0x17')]);return _0x7d7b31(_0x1d6a34['error']['message']);}else{logger[_0x7240('0xf')]('Template,\x20%s,\x20%s',_0x3a815d,_0x7240('0x10'));_0x7d7b31(_0x1d6a34['result'][_0x7240('0x17')]);}})[_0x7240('0x18')](function(_0x42b6dd){logger[_0x7240('0x14')](_0x7240('0x16'),_0x3a815d,_0x42b6dd);_0x40ec57(_0x42b6dd);});});}exports[_0x7240('0x19')]=function(_0x1abfff){var _0x1aea06=this;return new Promise(function(_0x219597,_0x57dec1){return db[_0x7240('0x1a')]['findAll']({'raw':_0x1abfff[_0x7240('0x1b')]?_0x1abfff[_0x7240('0x1b')][_0x7240('0x1c')]===undefined?!![]:![]:!![],'where':_0x1abfff['options']?_0x1abfff[_0x7240('0x1b')][_0x7240('0x1d')]||null:null,'attributes':_0x1abfff[_0x7240('0x1b')]?_0x1abfff[_0x7240('0x1b')][_0x7240('0x1e')]||null:null,'limit':_0x1abfff['options']?_0x1abfff[_0x7240('0x1b')][_0x7240('0x1f')]||null:null,'include':_0x1abfff[_0x7240('0x1b')]?_0x1abfff[_0x7240('0x1b')][_0x7240('0x20')]?_[_0x7240('0x21')](_0x1abfff[_0x7240('0x1b')]['include'],function(_0x514191){return{'model':db[_0x514191[_0x7240('0x22')]],'as':_0x514191['as'],'attributes':_0x514191[_0x7240('0x1e')],'include':_0x514191[_0x7240('0x20')]?_['map'](_0x514191[_0x7240('0x20')],function(_0x4371c9){return{'model':db[_0x4371c9[_0x7240('0x22')]],'as':_0x4371c9['as'],'attributes':_0x4371c9[_0x7240('0x1e')],'include':_0x4371c9[_0x7240('0x20')]?_[_0x7240('0x21')](_0x4371c9['include'],function(_0x228e3b){return{'model':db[_0x228e3b[_0x7240('0x22')]],'as':_0x228e3b['as'],'attributes':_0x228e3b[_0x7240('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7240('0xe')](function(_0x3e72b4){logger[_0x7240('0xf')](_0x7240('0x19'),_0x1abfff);logger[_0x7240('0x11')](_0x7240('0x19'),_0x1abfff,JSON['stringify'](_0x3e72b4));_0x219597(_0x3e72b4);})[_0x7240('0x18')](function(_0x496542){logger[_0x7240('0x14')]('GetTemplate',_0x496542[_0x7240('0x17')],_0x1abfff);_0x57dec1(_0x1aea06[_0x7240('0x14')](0x1f4,_0x496542[_0x7240('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3bfec9b..99c0ae1 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 _0x87d1=['../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','/:id','show','get','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service'];(function(_0x30f59d,_0xccf80e){var _0x35afc6=function(_0x7affdb){while(--_0x7affdb){_0x30f59d['push'](_0x30f59d['shift']());}};_0x35afc6(++_0xccf80e);}(_0x87d1,0xb2));var _0x187d=function(_0x4c8073,_0x2ae9a9){_0x4c8073=_0x4c8073-0x0;var _0x3a62ac=_0x87d1[_0x4c8073];return _0x3a62ac;};'use strict';var multer=require('multer');var util=require(_0x187d('0x0'));var path=require('path');var timeout=require(_0x187d('0x1'));var express=require(_0x187d('0x2'));var router=express['Router']();var auth=require(_0x187d('0x3'));var interaction=require(_0x187d('0x4'));var config=require(_0x187d('0x5'));var controller=require(_0x187d('0x6'));router['get']('/',auth[_0x187d('0x7')](),controller['index']);router['get'](_0x187d('0x8'),auth[_0x187d('0x7')](),controller[_0x187d('0x9')]);router[_0x187d('0xa')](_0x187d('0xb'),auth[_0x187d('0x7')](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0x187d('0x7')](),controller[_0x187d('0xc')]);router['get'](_0x187d('0xd'),auth[_0x187d('0x7')](),controller[_0x187d('0xe')]);router[_0x187d('0xf')]('/',auth[_0x187d('0x7')](),controller[_0x187d('0x10')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x187d('0x11')]);router[_0x187d('0xf')](_0x187d('0x12'),auth[_0x187d('0x7')](),controller[_0x187d('0x13')]);router[_0x187d('0xf')](_0x187d('0xd'),auth['isAuthenticated'](),controller[_0x187d('0x14')]);router[_0x187d('0x15')]('/:id',auth[_0x187d('0x7')](),controller[_0x187d('0x16')]);router[_0x187d('0x17')](_0x187d('0x8'),auth[_0x187d('0x7')](),controller[_0x187d('0x18')]);module[_0x187d('0x19')]=router; \ No newline at end of file +var _0x5f8e=['getActions','post','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','util','path','express','Router','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/any_conditions','getAnyConditions','/:id/actions'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5f8e,0x1a3));var _0xe5f8=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x5f8e[_0x3712e2];return _0x1faff4;};'use strict';var multer=require('multer');var util=require(_0xe5f8('0x0'));var path=require(_0xe5f8('0x1'));var timeout=require('connect-timeout');var express=require(_0xe5f8('0x2'));var router=express[_0xe5f8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe5f8('0x4'));var controller=require(_0xe5f8('0x5'));router[_0xe5f8('0x6')]('/',auth[_0xe5f8('0x7')](),controller[_0xe5f8('0x8')]);router[_0xe5f8('0x6')](_0xe5f8('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router['get'](_0xe5f8('0xa'),auth[_0xe5f8('0x7')](),controller[_0xe5f8('0xb')]);router[_0xe5f8('0x6')](_0xe5f8('0xc'),auth['isAuthenticated'](),controller[_0xe5f8('0xd')]);router[_0xe5f8('0xe')]('/',auth[_0xe5f8('0x7')](),controller['create']);router['post'](_0xe5f8('0xf'),auth[_0xe5f8('0x7')](),controller[_0xe5f8('0x10')]);router[_0xe5f8('0xe')](_0xe5f8('0xa'),auth['isAuthenticated'](),controller[_0xe5f8('0x11')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0xe5f8('0x12')]);router[_0xe5f8('0x13')](_0xe5f8('0x9'),auth['isAuthenticated'](),controller[_0xe5f8('0x14')]);router[_0xe5f8('0x15')](_0xe5f8('0x9'),auth[_0xe5f8('0x7')](),controller[_0xe5f8('0x16')]);module[_0xe5f8('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 203af10..568c3d9 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 _0x2079=['exports','STRING','BOOLEAN'];(function(_0x48d189,_0x1cf3aa){var _0x3ce62e=function(_0x5dd206){while(--_0x5dd206){_0x48d189['push'](_0x48d189['shift']());}};_0x3ce62e(++_0x1cf3aa);}(_0x2079,0x198));var _0x9207=function(_0x235054,_0x4d0ed0){_0x235054=_0x235054-0x0;var _0x463470=_0x2079[_0x235054];return _0x463470;};'use strict';var Sequelize=require('sequelize');module[_0x9207('0x0')]={'name':{'type':Sequelize[_0x9207('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9207('0x1')]},'status':{'type':Sequelize[_0x9207('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0b9d=['BOOLEAN','sequelize','exports','STRING'];(function(_0xee68ea,_0x3ba428){var _0x24e34a=function(_0x2c212a){while(--_0x2c212a){_0xee68ea['push'](_0xee68ea['shift']());}};_0x24e34a(++_0x3ba428);}(_0x0b9d,0x145));var _0xd0b9=function(_0xddf898,_0x505284){_0xddf898=_0xddf898-0x0;var _0x1017c3=_0x0b9d[_0xddf898];return _0x1017c3;};'use strict';var Sequelize=require(_0xd0b9('0x0'));module[_0xd0b9('0x1')]={'name':{'type':Sequelize[_0xd0b9('0x2')]},'channel':{'type':Sequelize[_0xd0b9('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd0b9('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 2f54ae2..911d887 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 _0x937f=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','role','user'];(function(_0x17cf11,_0x365d9b){var _0x3ce625=function(_0x282e07){while(--_0x282e07){_0x17cf11['push'](_0x17cf11['shift']());}};_0x3ce625(++_0x365d9b);}(_0x937f,0x179));var _0xf937=function(_0x3030a9,_0x3e7be2){_0x3030a9=_0x3030a9-0x0;var _0x5e6b29=_0x937f[_0x3030a9];return _0x5e6b29;};'use strict';var pdf=require(_0xf937('0x0'));var emlformat=require(_0xf937('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf937('0x2'));var jsonpatch=require(_0xf937('0x3'));var rp=require(_0xf937('0x4'));var moment=require(_0xf937('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf937('0x6'));var util=require(_0xf937('0x7'));var path=require(_0xf937('0x8'));var sox=require(_0xf937('0x9'));var csv=require(_0xf937('0xa'));var ejs=require(_0xf937('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf937('0xc'));var crypto=require(_0xf937('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf937('0xe'));var toCsv=require(_0xf937('0xa'));var querystring=require(_0xf937('0xf'));var Papa=require(_0xf937('0x10'));var Redis=require(_0xf937('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf937('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf937('0x13'));var logger=require('../../config/logger')(_0xf937('0x14'));var utils=require('../../config/utils');var config=require(_0xf937('0x15'));var db=require(_0xf937('0x16'))['db'];function respondWithStatusCode(_0x27d845,_0x57f664){_0x57f664=_0x57f664||0xcc;return function(_0x570af5){if(_0x570af5){return _0x27d845[_0xf937('0x17')](_0x57f664);}return _0x27d845[_0xf937('0x18')](_0x57f664)['end']();};}function respondWithResult(_0x311d8f,_0x18be40){_0x18be40=_0x18be40||0xc8;return function(_0x12486f){if(_0x12486f){return _0x311d8f['status'](_0x18be40)[_0xf937('0x19')](_0x12486f);}};}function respondWithFilteredResult(_0x166e99,_0x36c8e2){return function(_0x20a609){if(_0x20a609){var _0x3dca1a=_0x20a609[_0xf937('0x1a')],_0x106fe1=_0x36c8e2[_0xf937('0x1b')],_0x403a46=_0x36c8e2[_0xf937('0x1b')]+_0x36c8e2[_0xf937('0x1c')],_0x3d675b;if(_0x403a46>=_0x3dca1a){_0x403a46=_0x3dca1a;_0x3d675b=0xc8;}else{_0x3d675b=0xce;}_0x166e99[_0xf937('0x18')](_0x3d675b);return _0x166e99[_0xf937('0x1d')]('Content-Range',_0x106fe1+'-'+_0x403a46+'/'+_0x3dca1a)['json'](_0x20a609);}return null;};}function patchUpdates(_0x3f4234){return function(_0x136a64){try{jsonpatch['apply'](_0x136a64,_0x3f4234,!![]);}catch(_0x5e98e0){return BPromise['reject'](_0x5e98e0);}return _0x136a64['save']();};}function saveUpdates(_0x513958,_0x14b88e){return function(_0x43d852){if(_0x43d852){return _0x43d852[_0xf937('0x1e')](_0x513958)[_0xf937('0x1f')](function(_0x535e6c){return _0x535e6c;});}return null;};}function removeEntity(_0x26c4f3,_0x438a57){return function(_0x479411){if(_0x479411){return _0x479411[_0xf937('0x20')]()[_0xf937('0x1f')](function(){var _0x4f62f0=_0x479411[_0xf937('0x21')]({'plain':!![]});var _0x1698dd=_0xf937('0x22');return db[_0xf937('0x23')][_0xf937('0x20')]({'where':{'type':_0x1698dd,'resourceId':_0x4f62f0['id']}})[_0xf937('0x1f')](function(){return _0x479411;});})[_0xf937('0x1f')](function(){_0x26c4f3[_0xf937('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14066d,_0x5689f5){return function(_0x3d5d0b){if(!_0x3d5d0b){_0x14066d['sendStatus'](0x194);}return _0x3d5d0b;};}function handleError(_0x534ccd,_0x19368f){_0x19368f=_0x19368f||0x1f4;return function(_0x3c0273){logger[_0xf937('0x24')](_0x3c0273['stack']);if(_0x3c0273[_0xf937('0x25')]){delete _0x3c0273[_0xf937('0x25')];}_0x534ccd['status'](_0x19368f)[_0xf937('0x26')](_0x3c0273);};}exports[_0xf937('0x27')]=function(_0x48767f,_0x3fa2aa){var _0x19a7c8={},_0x40ee80={},_0x3abf53={'count':0x0,'rows':[]};var _0xb9da57=_[_0xf937('0x28')](db[_0xf937('0x29')][_0xf937('0x2a')],function(_0x318a65){return{'name':_0x318a65[_0xf937('0x2b')],'type':_0x318a65[_0xf937('0x2c')][_0xf937('0x2d')]};});_0x40ee80[_0xf937('0x2e')]=_['map'](_0xb9da57,_0xf937('0x25'));_0x40ee80['query']=_[_0xf937('0x2f')](_0x48767f[_0xf937('0x30')]);_0x40ee80[_0xf937('0x31')]=_[_0xf937('0x32')](_0x40ee80['model'],_0x40ee80[_0xf937('0x30')]);_0x19a7c8[_0xf937('0x33')]=_[_0xf937('0x32')](_0x40ee80['model'],qs['fields'](_0x48767f[_0xf937('0x30')][_0xf937('0x34')]));_0x19a7c8[_0xf937('0x33')]=_0x19a7c8[_0xf937('0x33')]['length']?_0x19a7c8[_0xf937('0x33')]:_0x40ee80[_0xf937('0x2e')];if(!_0x48767f[_0xf937('0x30')][_0xf937('0x35')](_0xf937('0x36'))){_0x19a7c8[_0xf937('0x1c')]=qs[_0xf937('0x1c')](_0x48767f[_0xf937('0x30')][_0xf937('0x1c')]);_0x19a7c8[_0xf937('0x1b')]=qs['offset'](_0x48767f[_0xf937('0x30')][_0xf937('0x1b')]);}_0x19a7c8['order']=qs['sort'](_0x48767f[_0xf937('0x30')][_0xf937('0x37')]);_0x19a7c8[_0xf937('0x38')]=qs[_0xf937('0x31')](_[_0xf937('0x39')](_0x48767f['query'],_0x40ee80[_0xf937('0x31')]),_0xb9da57);if(_0x48767f[_0xf937('0x30')][_0xf937('0x3a')]){_0x19a7c8[_0xf937('0x38')]=_[_0xf937('0x3b')](_0x19a7c8[_0xf937('0x38')],{'$or':_[_0xf937('0x28')](_0xb9da57,function(_0x16e79a){if(_0x16e79a[_0xf937('0x2c')]!=='VIRTUAL'){var _0x50126e={};_0x50126e[_0x16e79a['name']]={'$like':'%'+_0x48767f[_0xf937('0x30')][_0xf937('0x3a')]+'%'};return _0x50126e;}})});}_0x19a7c8=_[_0xf937('0x3b')]({},_0x19a7c8,_0x48767f[_0xf937('0x3c')]);var _0x155f33={'where':_0x19a7c8['where']};return db['Trigger'][_0xf937('0x1a')](_0x155f33)[_0xf937('0x1f')](function(_0x34bc38){_0x3abf53[_0xf937('0x1a')]=_0x34bc38;if(_0x48767f[_0xf937('0x30')][_0xf937('0x3d')]){_0x19a7c8[_0xf937('0x3e')]=[{'all':!![]}];}return db[_0xf937('0x29')][_0xf937('0x3f')](_0x19a7c8);})[_0xf937('0x1f')](function(_0x38cb05){_0x3abf53[_0xf937('0x40')]=_0x38cb05;return _0x3abf53;})[_0xf937('0x1f')](respondWithFilteredResult(_0x3fa2aa,_0x19a7c8))[_0xf937('0x41')](handleError(_0x3fa2aa,null));};exports['show']=function(_0x3e2f2b,_0x35502f){var _0x3f2af1={'raw':![],'where':{'id':_0x3e2f2b[_0xf937('0x42')]['id']}},_0x2d9b6d={};_0x2d9b6d[_0xf937('0x2e')]=_['keys'](db[_0xf937('0x29')][_0xf937('0x2a')]);_0x2d9b6d['query']=_[_0xf937('0x2f')](_0x3e2f2b[_0xf937('0x30')]);_0x2d9b6d[_0xf937('0x31')]=_[_0xf937('0x32')](_0x2d9b6d[_0xf937('0x2e')],_0x2d9b6d[_0xf937('0x30')]);_0x3f2af1[_0xf937('0x33')]=_[_0xf937('0x32')](_0x2d9b6d[_0xf937('0x2e')],qs[_0xf937('0x34')](_0x3e2f2b[_0xf937('0x30')][_0xf937('0x34')]));_0x3f2af1['attributes']=_0x3f2af1['attributes'][_0xf937('0x43')]?_0x3f2af1[_0xf937('0x33')]:_0x2d9b6d[_0xf937('0x2e')];if(_0x3e2f2b[_0xf937('0x30')][_0xf937('0x3d')]){_0x3f2af1[_0xf937('0x3e')]=[{'all':!![]}];}_0x3f2af1=_[_0xf937('0x3b')]({},_0x3f2af1,_0x3e2f2b[_0xf937('0x3c')]);return db[_0xf937('0x29')][_0xf937('0x44')](_0x3f2af1)[_0xf937('0x1f')](handleEntityNotFound(_0x35502f,null))[_0xf937('0x1f')](respondWithResult(_0x35502f,null))[_0xf937('0x41')](handleError(_0x35502f,null));};exports[_0xf937('0x45')]=function(_0x13d9f7,_0x15e980){return db[_0xf937('0x29')]['create'](_0x13d9f7[_0xf937('0x46')],{})[_0xf937('0x1f')](function(_0x480304){var _0x1109b=_0x13d9f7['user'][_0xf937('0x21')]({'plain':!![]});if(!_0x1109b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1109b[_0xf937('0x47')]===_0xf937('0x48')){var _0x194851=_0x480304['get']({'plain':!![]});var _0x385f5e=_0xf937('0x22');return db[_0xf937('0x49')]['find']({'where':{'name':_0x385f5e,'userProfileId':_0x1109b[_0xf937('0x4a')]},'raw':!![]})[_0xf937('0x1f')](function(_0x4f4b79){if(_0x4f4b79&&_0x4f4b79[_0xf937('0x4b')]===0x0){return db[_0xf937('0x23')][_0xf937('0x45')]({'name':_0x194851[_0xf937('0x25')],'resourceId':_0x194851['id'],'type':_0x4f4b79['name'],'sectionId':_0x4f4b79['id']},{})[_0xf937('0x1f')](function(){return _0x480304;});}else{return _0x480304;}})['catch'](function(_0x41694b){logger[_0xf937('0x24')](_0xf937('0x4c'),_0x41694b);throw _0x41694b;});}return _0x480304;})[_0xf937('0x1f')](respondWithResult(_0x15e980,0xc9))[_0xf937('0x41')](handleError(_0x15e980,null));};exports[_0xf937('0x1e')]=function(_0xf9218c,_0x57b9b1){if(_0xf9218c['body']['id']){delete _0xf9218c['body']['id'];}return db[_0xf937('0x29')][_0xf937('0x44')]({'where':{'id':_0xf9218c['params']['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x57b9b1,null))[_0xf937('0x1f')](saveUpdates(_0xf9218c[_0xf937('0x46')],null))[_0xf937('0x1f')](respondWithResult(_0x57b9b1,null))[_0xf937('0x41')](handleError(_0x57b9b1,null));};exports[_0xf937('0x20')]=function(_0x33312c,_0xa06629){return db['Trigger'][_0xf937('0x44')]({'where':{'id':_0x33312c['params']['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0xa06629,null))[_0xf937('0x1f')](removeEntity(_0xa06629,null))[_0xf937('0x41')](handleError(_0xa06629,null));};exports[_0xf937('0x4d')]=function(_0x20985c,_0x3a4026,_0x1d10b9){if(_0x20985c[_0xf937('0x46')]['id']){delete _0x20985c['body']['id'];}return db[_0xf937('0x29')][_0xf937('0x44')]({'where':{'id':_0x20985c[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x3a4026,null))[_0xf937('0x1f')](function(_0x1065a7){if(_0x1065a7){_0x20985c['body'][_0xf937('0x4e')]=_0x1065a7['id'];return db[_0xf937('0x4f')]['create'](_0x20985c[_0xf937('0x46')]);}})[_0xf937('0x1f')](respondWithResult(_0x3a4026,null))[_0xf937('0x41')](handleError(_0x3a4026,null));};exports[_0xf937('0x50')]=function(_0x57cea9,_0x42fc99,_0x2b44f7){if(_0x57cea9[_0xf937('0x46')]['id']){delete _0x57cea9['body']['id'];}return db[_0xf937('0x29')][_0xf937('0x44')]({'where':{'id':_0x57cea9[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x42fc99,null))[_0xf937('0x1f')](function(_0x1c3023){if(_0x1c3023){_0x57cea9[_0xf937('0x46')][_0xf937('0x51')]=_0x1c3023['id'];return db[_0xf937('0x4f')][_0xf937('0x45')](_0x57cea9[_0xf937('0x46')]);}})[_0xf937('0x1f')](respondWithResult(_0x42fc99,null))['catch'](handleError(_0x42fc99,null));};exports[_0xf937('0x52')]=function(_0x4e0089,_0x531c3f,_0x148eb7){var _0x3832d2={};var _0x34b1bb={};var _0x483f3b;var _0x3b797f;return db[_0xf937('0x29')][_0xf937('0x53')]({'where':{'id':_0x4e0089['params']['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x531c3f,null))[_0xf937('0x1f')](function(_0x1fc400){if(_0x1fc400){_0x483f3b=_0x1fc400;_0x34b1bb[_0xf937('0x2e')]=_[_0xf937('0x2f')](db[_0xf937('0x4f')][_0xf937('0x2a')]);_0x34b1bb[_0xf937('0x30')]=_['keys'](_0x4e0089[_0xf937('0x30')]);_0x34b1bb[_0xf937('0x31')]=_[_0xf937('0x32')](_0x34b1bb[_0xf937('0x2e')],_0x34b1bb[_0xf937('0x30')]);_0x3832d2[_0xf937('0x33')]=_['intersection'](_0x34b1bb[_0xf937('0x2e')],qs['fields'](_0x4e0089[_0xf937('0x30')][_0xf937('0x34')]));_0x3832d2[_0xf937('0x33')]=_0x3832d2[_0xf937('0x33')][_0xf937('0x43')]?_0x3832d2[_0xf937('0x33')]:_0x34b1bb[_0xf937('0x2e')];_0x3832d2[_0xf937('0x54')]=qs[_0xf937('0x37')](_0x4e0089['query']['sort']);_0x3832d2[_0xf937('0x38')]=qs[_0xf937('0x31')](_[_0xf937('0x39')](_0x4e0089[_0xf937('0x30')],_0x34b1bb[_0xf937('0x31')]));if(_0x4e0089['query'][_0xf937('0x3a')]){_0x3832d2[_0xf937('0x38')]=_[_0xf937('0x3b')](_0x3832d2[_0xf937('0x38')],{'$or':_[_0xf937('0x28')](_0x3832d2[_0xf937('0x33')],function(_0x3c5017){var _0x5cd533={};_0x5cd533[_0x3c5017]={'$like':'%'+_0x4e0089[_0xf937('0x30')][_0xf937('0x3a')]+'%'};return _0x5cd533;})});}_0x3832d2=_[_0xf937('0x3b')]({},_0x3832d2,_0x4e0089[_0xf937('0x3c')]);return _0x483f3b[_0xf937('0x52')](_0x3832d2);}})['then'](function(_0x3a8d7f){if(_0x3a8d7f){_0x3b797f=_0x3a8d7f[_0xf937('0x43')];if(!_0x4e0089[_0xf937('0x30')]['hasOwnProperty'](_0xf937('0x36'))){_0x3832d2[_0xf937('0x1c')]=qs[_0xf937('0x1c')](_0x4e0089[_0xf937('0x30')]['limit']);_0x3832d2[_0xf937('0x1b')]=qs[_0xf937('0x1b')](_0x4e0089['query'][_0xf937('0x1b')]);}return _0x483f3b['getAllConditions'](_0x3832d2);}})[_0xf937('0x1f')](function(_0x2b806b){if(_0x2b806b){return _0x2b806b?{'count':_0x3b797f,'rows':_0x2b806b}:null;}})['then'](respondWithResult(_0x531c3f,null))['catch'](handleError(_0x531c3f,null));};exports[_0xf937('0x55')]=function(_0x41cde6,_0x542c2e,_0x4b4e25){var _0x519ba2={};var _0x5b7c76={};var _0x359fd6;var _0x34592f;return db[_0xf937('0x29')][_0xf937('0x53')]({'where':{'id':_0x41cde6[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x542c2e,null))['then'](function(_0x1852c6){if(_0x1852c6){_0x359fd6=_0x1852c6;_0x5b7c76[_0xf937('0x2e')]=_['keys'](db[_0xf937('0x4f')][_0xf937('0x2a')]);_0x5b7c76['query']=_['keys'](_0x41cde6[_0xf937('0x30')]);_0x5b7c76[_0xf937('0x31')]=_[_0xf937('0x32')](_0x5b7c76['model'],_0x5b7c76[_0xf937('0x30')]);_0x519ba2[_0xf937('0x33')]=_[_0xf937('0x32')](_0x5b7c76[_0xf937('0x2e')],qs[_0xf937('0x34')](_0x41cde6[_0xf937('0x30')][_0xf937('0x34')]));_0x519ba2['attributes']=_0x519ba2[_0xf937('0x33')][_0xf937('0x43')]?_0x519ba2[_0xf937('0x33')]:_0x5b7c76['model'];_0x519ba2[_0xf937('0x54')]=qs['sort'](_0x41cde6[_0xf937('0x30')]['sort']);_0x519ba2[_0xf937('0x38')]=qs['filters'](_[_0xf937('0x39')](_0x41cde6[_0xf937('0x30')],_0x5b7c76[_0xf937('0x31')]));if(_0x41cde6[_0xf937('0x30')][_0xf937('0x3a')]){_0x519ba2[_0xf937('0x38')]=_[_0xf937('0x3b')](_0x519ba2[_0xf937('0x38')],{'$or':_[_0xf937('0x28')](_0x519ba2[_0xf937('0x33')],function(_0x33b2f9){var _0x5c07be={};_0x5c07be[_0x33b2f9]={'$like':'%'+_0x41cde6[_0xf937('0x30')][_0xf937('0x3a')]+'%'};return _0x5c07be;})});}_0x519ba2=_[_0xf937('0x3b')]({},_0x519ba2,_0x41cde6[_0xf937('0x3c')]);return _0x359fd6[_0xf937('0x55')](_0x519ba2);}})[_0xf937('0x1f')](function(_0x36fe3c){if(_0x36fe3c){_0x34592f=_0x36fe3c['length'];if(!_0x41cde6[_0xf937('0x30')][_0xf937('0x35')](_0xf937('0x36'))){_0x519ba2['limit']=qs[_0xf937('0x1c')](_0x41cde6['query'][_0xf937('0x1c')]);_0x519ba2[_0xf937('0x1b')]=qs[_0xf937('0x1b')](_0x41cde6[_0xf937('0x30')][_0xf937('0x1b')]);}return _0x359fd6['getAnyConditions'](_0x519ba2);}})['then'](function(_0x41c580){if(_0x41c580){return _0x41c580?{'count':_0x34592f,'rows':_0x41c580}:null;}})[_0xf937('0x1f')](respondWithResult(_0x542c2e,null))[_0xf937('0x41')](handleError(_0x542c2e,null));};exports[_0xf937('0x56')]=function(_0x26eac8,_0x2437eb,_0xa1e28c){if(_0x26eac8['body']['id']){delete _0x26eac8['body']['id'];}return db[_0xf937('0x29')][_0xf937('0x44')]({'where':{'id':_0x26eac8[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x2437eb,null))[_0xf937('0x1f')](function(_0x4eb064){if(_0x4eb064){_0x26eac8['body'][_0xf937('0x57')]=_0x4eb064['id'];return db[_0xf937('0x58')][_0xf937('0x45')](_0x26eac8['body']);}})['then'](respondWithResult(_0x2437eb,null))[_0xf937('0x41')](handleError(_0x2437eb,null));};exports[_0xf937('0x59')]=function(_0xc6f914,_0x19db88,_0x2efe6d){var _0x184661={};var _0x316dd1={};var _0x258e40;var _0x2cff69;return db[_0xf937('0x29')][_0xf937('0x53')]({'where':{'id':_0xc6f914[_0xf937('0x42')]['id']}})[_0xf937('0x1f')](handleEntityNotFound(_0x19db88,null))[_0xf937('0x1f')](function(_0x29123a){if(_0x29123a){_0x258e40=_0x29123a;_0x316dd1['model']=_['keys'](db['Action'][_0xf937('0x2a')]);_0x316dd1[_0xf937('0x30')]=_[_0xf937('0x2f')](_0xc6f914[_0xf937('0x30')]);_0x316dd1[_0xf937('0x31')]=_[_0xf937('0x32')](_0x316dd1['model'],_0x316dd1['query']);_0x184661[_0xf937('0x33')]=_[_0xf937('0x32')](_0x316dd1['model'],qs[_0xf937('0x34')](_0xc6f914[_0xf937('0x30')][_0xf937('0x34')]));_0x184661[_0xf937('0x33')]=_0x184661[_0xf937('0x33')][_0xf937('0x43')]?_0x184661[_0xf937('0x33')]:_0x316dd1[_0xf937('0x2e')];_0x184661[_0xf937('0x54')]=qs[_0xf937('0x37')](_0xc6f914['query'][_0xf937('0x37')]);_0x184661[_0xf937('0x38')]=qs[_0xf937('0x31')](_[_0xf937('0x39')](_0xc6f914[_0xf937('0x30')],_0x316dd1['filters']));if(_0xc6f914[_0xf937('0x30')][_0xf937('0x3a')]){_0x184661['where']=_['merge'](_0x184661[_0xf937('0x38')],{'$or':_[_0xf937('0x28')](_0x184661[_0xf937('0x33')],function(_0x1e7035){var _0x1c029d={};_0x1c029d[_0x1e7035]={'$like':'%'+_0xc6f914[_0xf937('0x30')][_0xf937('0x3a')]+'%'};return _0x1c029d;})});}_0x184661=_[_0xf937('0x3b')]({},_0x184661,_0xc6f914[_0xf937('0x3c')]);return _0x258e40[_0xf937('0x59')](_0x184661);}})[_0xf937('0x1f')](function(_0x557041){if(_0x557041){_0x2cff69=_0x557041[_0xf937('0x43')];if(!_0xc6f914[_0xf937('0x30')]['hasOwnProperty'](_0xf937('0x36'))){_0x184661[_0xf937('0x1c')]=qs[_0xf937('0x1c')](_0xc6f914[_0xf937('0x30')][_0xf937('0x1c')]);_0x184661[_0xf937('0x1b')]=qs[_0xf937('0x1b')](_0xc6f914[_0xf937('0x30')][_0xf937('0x1b')]);}return _0x258e40['getActions'](_0x184661);}})[_0xf937('0x1f')](function(_0x23dc3a){if(_0x23dc3a){return _0x23dc3a?{'count':_0x2cff69,'rows':_0x23dc3a}:null;}})[_0xf937('0x1f')](respondWithResult(_0x19db88,null))['catch'](handleError(_0x19db88,null));}; \ No newline at end of file +var _0x3bbd=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','Content-Range','json','apply','reject','save','update','then','Triggers','UserProfileResource','destroy','stack','name','send','map','Trigger','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','count','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3bbd,0xce));var _0xd3bb=function(_0x3b83d4,_0x1938c8){_0x3b83d4=_0x3b83d4-0x0;var _0x479130=_0x3bbd[_0x3b83d4];return _0x479130;};'use strict';var pdf=require(_0xd3bb('0x0'));var emlformat=require(_0xd3bb('0x1'));var rimraf=require(_0xd3bb('0x2'));var zipdir=require(_0xd3bb('0x3'));var jsonpatch=require(_0xd3bb('0x4'));var rp=require(_0xd3bb('0x5'));var moment=require(_0xd3bb('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd3bb('0x7'));var util=require('util');var path=require(_0xd3bb('0x8'));var sox=require(_0xd3bb('0x9'));var csv=require(_0xd3bb('0xa'));var ejs=require(_0xd3bb('0xb'));var fs=require('fs');var _=require(_0xd3bb('0xc'));var squel=require(_0xd3bb('0xd'));var crypto=require('crypto');var jsforce=require(_0xd3bb('0xe'));var deskjs=require(_0xd3bb('0xf'));var toCsv=require(_0xd3bb('0xa'));var querystring=require(_0xd3bb('0x10'));var Papa=require(_0xd3bb('0x11'));var Redis=require(_0xd3bb('0x12'));var authService=require(_0xd3bb('0x13'));var qs=require(_0xd3bb('0x14'));var as=require(_0xd3bb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3bb('0x16'))(_0xd3bb('0x17'));var utils=require(_0xd3bb('0x18'));var config=require(_0xd3bb('0x19'));var db=require(_0xd3bb('0x1a'))['db'];function respondWithStatusCode(_0x53cc1c,_0x5c982a){_0x5c982a=_0x5c982a||0xcc;return function(_0x114d86){if(_0x114d86){return _0x53cc1c[_0xd3bb('0x1b')](_0x5c982a);}return _0x53cc1c['status'](_0x5c982a)[_0xd3bb('0x1c')]();};}function respondWithResult(_0x1a22e6,_0x54c11e){_0x54c11e=_0x54c11e||0xc8;return function(_0x3bf44e){if(_0x3bf44e){return _0x1a22e6[_0xd3bb('0x1d')](_0x54c11e)['json'](_0x3bf44e);}};}function respondWithFilteredResult(_0x4f668d,_0x51c674){return function(_0x4dd8c3){if(_0x4dd8c3){var _0x589a8d=_0x4dd8c3['count'],_0x4b0b72=_0x51c674['offset'],_0x28b100=_0x51c674[_0xd3bb('0x1e')]+_0x51c674[_0xd3bb('0x1f')],_0x905665;if(_0x28b100>=_0x589a8d){_0x28b100=_0x589a8d;_0x905665=0xc8;}else{_0x905665=0xce;}_0x4f668d['status'](_0x905665);return _0x4f668d['set'](_0xd3bb('0x20'),_0x4b0b72+'-'+_0x28b100+'/'+_0x589a8d)[_0xd3bb('0x21')](_0x4dd8c3);}return null;};}function patchUpdates(_0x20d6b0){return function(_0x31c19b){try{jsonpatch[_0xd3bb('0x22')](_0x31c19b,_0x20d6b0,!![]);}catch(_0x45d8a6){return BPromise[_0xd3bb('0x23')](_0x45d8a6);}return _0x31c19b[_0xd3bb('0x24')]();};}function saveUpdates(_0x303e2d,_0x167a3f){return function(_0xd7e998){if(_0xd7e998){return _0xd7e998[_0xd3bb('0x25')](_0x303e2d)[_0xd3bb('0x26')](function(_0x57015b){return _0x57015b;});}return null;};}function removeEntity(_0x467e9c,_0x577280){return function(_0x977807){if(_0x977807){return _0x977807['destroy']()[_0xd3bb('0x26')](function(){var _0x3eb066=_0x977807['get']({'plain':!![]});var _0x81c487=_0xd3bb('0x27');return db[_0xd3bb('0x28')][_0xd3bb('0x29')]({'where':{'type':_0x81c487,'resourceId':_0x3eb066['id']}})[_0xd3bb('0x26')](function(){return _0x977807;});})[_0xd3bb('0x26')](function(){_0x467e9c[_0xd3bb('0x1d')](0xcc)[_0xd3bb('0x1c')]();});}};}function handleEntityNotFound(_0xae3585,_0x4c6734){return function(_0x44b597){if(!_0x44b597){_0xae3585[_0xd3bb('0x1b')](0x194);}return _0x44b597;};}function handleError(_0x1b03a8,_0x4ee524){_0x4ee524=_0x4ee524||0x1f4;return function(_0x149e0b){logger['error'](_0x149e0b[_0xd3bb('0x2a')]);if(_0x149e0b[_0xd3bb('0x2b')]){delete _0x149e0b['name'];}_0x1b03a8[_0xd3bb('0x1d')](_0x4ee524)[_0xd3bb('0x2c')](_0x149e0b);};}exports['index']=function(_0xe98e5b,_0x1de4eb){var _0x1024b6={},_0x71b03b={},_0x20b7e8={'count':0x0,'rows':[]};var _0x3c964b=_[_0xd3bb('0x2d')](db[_0xd3bb('0x2e')][_0xd3bb('0x2f')],function(_0x1498de){return{'name':_0x1498de[_0xd3bb('0x30')],'type':_0x1498de['type'][_0xd3bb('0x31')]};});_0x71b03b[_0xd3bb('0x32')]=_[_0xd3bb('0x2d')](_0x3c964b,_0xd3bb('0x2b'));_0x71b03b[_0xd3bb('0x33')]=_[_0xd3bb('0x34')](_0xe98e5b[_0xd3bb('0x33')]);_0x71b03b[_0xd3bb('0x35')]=_[_0xd3bb('0x36')](_0x71b03b[_0xd3bb('0x32')],_0x71b03b[_0xd3bb('0x33')]);_0x1024b6[_0xd3bb('0x37')]=_[_0xd3bb('0x36')](_0x71b03b[_0xd3bb('0x32')],qs['fields'](_0xe98e5b[_0xd3bb('0x33')]['fields']));_0x1024b6[_0xd3bb('0x37')]=_0x1024b6[_0xd3bb('0x37')][_0xd3bb('0x38')]?_0x1024b6[_0xd3bb('0x37')]:_0x71b03b[_0xd3bb('0x32')];if(!_0xe98e5b[_0xd3bb('0x33')][_0xd3bb('0x39')](_0xd3bb('0x3a'))){_0x1024b6[_0xd3bb('0x1f')]=qs[_0xd3bb('0x1f')](_0xe98e5b['query'][_0xd3bb('0x1f')]);_0x1024b6['offset']=qs['offset'](_0xe98e5b[_0xd3bb('0x33')][_0xd3bb('0x1e')]);}_0x1024b6[_0xd3bb('0x3b')]=qs[_0xd3bb('0x3c')](_0xe98e5b['query']['sort']);_0x1024b6[_0xd3bb('0x3d')]=qs['filters'](_[_0xd3bb('0x3e')](_0xe98e5b[_0xd3bb('0x33')],_0x71b03b[_0xd3bb('0x35')]),_0x3c964b);if(_0xe98e5b[_0xd3bb('0x33')][_0xd3bb('0x3f')]){_0x1024b6[_0xd3bb('0x3d')]=_[_0xd3bb('0x40')](_0x1024b6['where'],{'$or':_[_0xd3bb('0x2d')](_0x3c964b,function(_0x2acf0b){if(_0x2acf0b[_0xd3bb('0x41')]!=='VIRTUAL'){var _0x1163f9={};_0x1163f9[_0x2acf0b[_0xd3bb('0x2b')]]={'$like':'%'+_0xe98e5b[_0xd3bb('0x33')][_0xd3bb('0x3f')]+'%'};return _0x1163f9;}})});}_0x1024b6=_[_0xd3bb('0x40')]({},_0x1024b6,_0xe98e5b['options']);var _0x16f324={'where':_0x1024b6[_0xd3bb('0x3d')]};return db[_0xd3bb('0x2e')][_0xd3bb('0x42')](_0x16f324)[_0xd3bb('0x26')](function(_0x561689){_0x20b7e8[_0xd3bb('0x42')]=_0x561689;if(_0xe98e5b[_0xd3bb('0x33')][_0xd3bb('0x43')]){_0x1024b6[_0xd3bb('0x44')]=[{'all':!![]}];}return db['Trigger'][_0xd3bb('0x45')](_0x1024b6);})['then'](function(_0x588dd5){_0x20b7e8[_0xd3bb('0x46')]=_0x588dd5;return _0x20b7e8;})['then'](respondWithFilteredResult(_0x1de4eb,_0x1024b6))[_0xd3bb('0x47')](handleError(_0x1de4eb,null));};exports[_0xd3bb('0x48')]=function(_0xcc9d3,_0x4daa20){var _0x2c983d={'raw':![],'where':{'id':_0xcc9d3[_0xd3bb('0x49')]['id']}},_0x313b84={};_0x313b84[_0xd3bb('0x32')]=_[_0xd3bb('0x34')](db[_0xd3bb('0x2e')][_0xd3bb('0x2f')]);_0x313b84[_0xd3bb('0x33')]=_[_0xd3bb('0x34')](_0xcc9d3[_0xd3bb('0x33')]);_0x313b84['filters']=_[_0xd3bb('0x36')](_0x313b84[_0xd3bb('0x32')],_0x313b84[_0xd3bb('0x33')]);_0x2c983d[_0xd3bb('0x37')]=_[_0xd3bb('0x36')](_0x313b84[_0xd3bb('0x32')],qs[_0xd3bb('0x4a')](_0xcc9d3[_0xd3bb('0x33')][_0xd3bb('0x4a')]));_0x2c983d[_0xd3bb('0x37')]=_0x2c983d[_0xd3bb('0x37')][_0xd3bb('0x38')]?_0x2c983d[_0xd3bb('0x37')]:_0x313b84[_0xd3bb('0x32')];if(_0xcc9d3[_0xd3bb('0x33')][_0xd3bb('0x43')]){_0x2c983d['include']=[{'all':!![]}];}_0x2c983d=_[_0xd3bb('0x40')]({},_0x2c983d,_0xcc9d3[_0xd3bb('0x4b')]);return db[_0xd3bb('0x2e')][_0xd3bb('0x4c')](_0x2c983d)['then'](handleEntityNotFound(_0x4daa20,null))[_0xd3bb('0x26')](respondWithResult(_0x4daa20,null))[_0xd3bb('0x47')](handleError(_0x4daa20,null));};exports[_0xd3bb('0x4d')]=function(_0x23a349,_0x2a3bfe){return db[_0xd3bb('0x2e')][_0xd3bb('0x4d')](_0x23a349['body'],{})[_0xd3bb('0x26')](function(_0x2c1c7e){var _0x1544f2=_0x23a349[_0xd3bb('0x4e')][_0xd3bb('0x4f')]({'plain':!![]});if(!_0x1544f2)throw new Error(_0xd3bb('0x50'));if(_0x1544f2[_0xd3bb('0x51')]===_0xd3bb('0x4e')){var _0x242fcc=_0x2c1c7e['get']({'plain':!![]});var _0x10e633=_0xd3bb('0x27');return db[_0xd3bb('0x52')][_0xd3bb('0x4c')]({'where':{'name':_0x10e633,'userProfileId':_0x1544f2[_0xd3bb('0x53')]},'raw':!![]})[_0xd3bb('0x26')](function(_0x129098){if(_0x129098&&_0x129098[_0xd3bb('0x54')]===0x0){return db[_0xd3bb('0x28')][_0xd3bb('0x4d')]({'name':_0x242fcc[_0xd3bb('0x2b')],'resourceId':_0x242fcc['id'],'type':_0x129098[_0xd3bb('0x2b')],'sectionId':_0x129098['id']},{})['then'](function(){return _0x2c1c7e;});}else{return _0x2c1c7e;}})['catch'](function(_0x4a97d9){logger['error'](_0xd3bb('0x55'),_0x4a97d9);throw _0x4a97d9;});}return _0x2c1c7e;})[_0xd3bb('0x26')](respondWithResult(_0x2a3bfe,0xc9))[_0xd3bb('0x47')](handleError(_0x2a3bfe,null));};exports[_0xd3bb('0x25')]=function(_0x188cff,_0x22812c){if(_0x188cff[_0xd3bb('0x56')]['id']){delete _0x188cff['body']['id'];}return db[_0xd3bb('0x2e')][_0xd3bb('0x4c')]({'where':{'id':_0x188cff[_0xd3bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x22812c,null))[_0xd3bb('0x26')](saveUpdates(_0x188cff[_0xd3bb('0x56')],null))[_0xd3bb('0x26')](respondWithResult(_0x22812c,null))['catch'](handleError(_0x22812c,null));};exports['destroy']=function(_0x4bc7a0,_0x16fd76){return db[_0xd3bb('0x2e')][_0xd3bb('0x4c')]({'where':{'id':_0x4bc7a0[_0xd3bb('0x49')]['id']}})[_0xd3bb('0x26')](handleEntityNotFound(_0x16fd76,null))[_0xd3bb('0x26')](removeEntity(_0x16fd76,null))[_0xd3bb('0x47')](handleError(_0x16fd76,null));};exports['addAllCondition']=function(_0x2c3500,_0x25fd13,_0x4f99e1){if(_0x2c3500['body']['id']){delete _0x2c3500['body']['id'];}return db[_0xd3bb('0x2e')][_0xd3bb('0x4c')]({'where':{'id':_0x2c3500[_0xd3bb('0x49')]['id']}})[_0xd3bb('0x26')](handleEntityNotFound(_0x25fd13,null))[_0xd3bb('0x26')](function(_0x3dc5ca){if(_0x3dc5ca){_0x2c3500[_0xd3bb('0x56')][_0xd3bb('0x57')]=_0x3dc5ca['id'];return db[_0xd3bb('0x58')]['create'](_0x2c3500[_0xd3bb('0x56')]);}})[_0xd3bb('0x26')](respondWithResult(_0x25fd13,null))[_0xd3bb('0x47')](handleError(_0x25fd13,null));};exports[_0xd3bb('0x59')]=function(_0x5b9844,_0x2cb142,_0x6e96ad){if(_0x5b9844[_0xd3bb('0x56')]['id']){delete _0x5b9844['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x5b9844[_0xd3bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cb142,null))[_0xd3bb('0x26')](function(_0x3fb13a){if(_0x3fb13a){_0x5b9844[_0xd3bb('0x56')]['TriggerAnyId']=_0x3fb13a['id'];return db['Condition'][_0xd3bb('0x4d')](_0x5b9844['body']);}})[_0xd3bb('0x26')](respondWithResult(_0x2cb142,null))['catch'](handleError(_0x2cb142,null));};exports['getAllConditions']=function(_0x360a84,_0x4020ca,_0x6a7294){var _0x1c3bbd={};var _0x26802d={};var _0x40ae30;var _0x59f2c0;return db[_0xd3bb('0x2e')]['findOne']({'where':{'id':_0x360a84[_0xd3bb('0x49')]['id']}})[_0xd3bb('0x26')](handleEntityNotFound(_0x4020ca,null))[_0xd3bb('0x26')](function(_0x2c86f2){if(_0x2c86f2){_0x40ae30=_0x2c86f2;_0x26802d['model']=_[_0xd3bb('0x34')](db[_0xd3bb('0x58')][_0xd3bb('0x2f')]);_0x26802d[_0xd3bb('0x33')]=_['keys'](_0x360a84[_0xd3bb('0x33')]);_0x26802d[_0xd3bb('0x35')]=_[_0xd3bb('0x36')](_0x26802d[_0xd3bb('0x32')],_0x26802d[_0xd3bb('0x33')]);_0x1c3bbd['attributes']=_[_0xd3bb('0x36')](_0x26802d[_0xd3bb('0x32')],qs['fields'](_0x360a84[_0xd3bb('0x33')][_0xd3bb('0x4a')]));_0x1c3bbd[_0xd3bb('0x37')]=_0x1c3bbd[_0xd3bb('0x37')][_0xd3bb('0x38')]?_0x1c3bbd['attributes']:_0x26802d[_0xd3bb('0x32')];_0x1c3bbd[_0xd3bb('0x3b')]=qs[_0xd3bb('0x3c')](_0x360a84[_0xd3bb('0x33')]['sort']);_0x1c3bbd[_0xd3bb('0x3d')]=qs[_0xd3bb('0x35')](_['pick'](_0x360a84[_0xd3bb('0x33')],_0x26802d[_0xd3bb('0x35')]));if(_0x360a84[_0xd3bb('0x33')]['filter']){_0x1c3bbd[_0xd3bb('0x3d')]=_['merge'](_0x1c3bbd[_0xd3bb('0x3d')],{'$or':_[_0xd3bb('0x2d')](_0x1c3bbd[_0xd3bb('0x37')],function(_0x15c310){var _0x580b55={};_0x580b55[_0x15c310]={'$like':'%'+_0x360a84[_0xd3bb('0x33')][_0xd3bb('0x3f')]+'%'};return _0x580b55;})});}_0x1c3bbd=_[_0xd3bb('0x40')]({},_0x1c3bbd,_0x360a84[_0xd3bb('0x4b')]);return _0x40ae30[_0xd3bb('0x5a')](_0x1c3bbd);}})['then'](function(_0x43e466){if(_0x43e466){_0x59f2c0=_0x43e466[_0xd3bb('0x38')];if(!_0x360a84[_0xd3bb('0x33')]['hasOwnProperty']('nolimit')){_0x1c3bbd[_0xd3bb('0x1f')]=qs[_0xd3bb('0x1f')](_0x360a84['query'][_0xd3bb('0x1f')]);_0x1c3bbd['offset']=qs[_0xd3bb('0x1e')](_0x360a84['query']['offset']);}return _0x40ae30['getAllConditions'](_0x1c3bbd);}})[_0xd3bb('0x26')](function(_0x3b5189){if(_0x3b5189){return _0x3b5189?{'count':_0x59f2c0,'rows':_0x3b5189}:null;}})[_0xd3bb('0x26')](respondWithResult(_0x4020ca,null))[_0xd3bb('0x47')](handleError(_0x4020ca,null));};exports['getAnyConditions']=function(_0xfe6222,_0xe5de64,_0x1f3341){var _0x1c3647={};var _0x372685={};var _0x24bff8;var _0x3ef6dc;return db[_0xd3bb('0x2e')][_0xd3bb('0x5b')]({'where':{'id':_0xfe6222[_0xd3bb('0x49')]['id']}})[_0xd3bb('0x26')](handleEntityNotFound(_0xe5de64,null))[_0xd3bb('0x26')](function(_0x480243){if(_0x480243){_0x24bff8=_0x480243;_0x372685[_0xd3bb('0x32')]=_[_0xd3bb('0x34')](db[_0xd3bb('0x58')][_0xd3bb('0x2f')]);_0x372685['query']=_['keys'](_0xfe6222[_0xd3bb('0x33')]);_0x372685['filters']=_[_0xd3bb('0x36')](_0x372685[_0xd3bb('0x32')],_0x372685[_0xd3bb('0x33')]);_0x1c3647[_0xd3bb('0x37')]=_['intersection'](_0x372685['model'],qs[_0xd3bb('0x4a')](_0xfe6222[_0xd3bb('0x33')][_0xd3bb('0x4a')]));_0x1c3647[_0xd3bb('0x37')]=_0x1c3647['attributes']['length']?_0x1c3647[_0xd3bb('0x37')]:_0x372685['model'];_0x1c3647[_0xd3bb('0x3b')]=qs[_0xd3bb('0x3c')](_0xfe6222[_0xd3bb('0x33')][_0xd3bb('0x3c')]);_0x1c3647[_0xd3bb('0x3d')]=qs[_0xd3bb('0x35')](_[_0xd3bb('0x3e')](_0xfe6222[_0xd3bb('0x33')],_0x372685[_0xd3bb('0x35')]));if(_0xfe6222['query']['filter']){_0x1c3647['where']=_['merge'](_0x1c3647[_0xd3bb('0x3d')],{'$or':_[_0xd3bb('0x2d')](_0x1c3647[_0xd3bb('0x37')],function(_0x5a1376){var _0xc0f9d1={};_0xc0f9d1[_0x5a1376]={'$like':'%'+_0xfe6222[_0xd3bb('0x33')]['filter']+'%'};return _0xc0f9d1;})});}_0x1c3647=_[_0xd3bb('0x40')]({},_0x1c3647,_0xfe6222[_0xd3bb('0x4b')]);return _0x24bff8[_0xd3bb('0x5c')](_0x1c3647);}})[_0xd3bb('0x26')](function(_0x2a53b7){if(_0x2a53b7){_0x3ef6dc=_0x2a53b7[_0xd3bb('0x38')];if(!_0xfe6222[_0xd3bb('0x33')]['hasOwnProperty'](_0xd3bb('0x3a'))){_0x1c3647[_0xd3bb('0x1f')]=qs[_0xd3bb('0x1f')](_0xfe6222[_0xd3bb('0x33')]['limit']);_0x1c3647[_0xd3bb('0x1e')]=qs['offset'](_0xfe6222[_0xd3bb('0x33')]['offset']);}return _0x24bff8['getAnyConditions'](_0x1c3647);}})[_0xd3bb('0x26')](function(_0x532d1e){if(_0x532d1e){return _0x532d1e?{'count':_0x3ef6dc,'rows':_0x532d1e}:null;}})['then'](respondWithResult(_0xe5de64,null))[_0xd3bb('0x47')](handleError(_0xe5de64,null));};exports[_0xd3bb('0x5d')]=function(_0x4223d6,_0x1ea5fc,_0x35c6a7){if(_0x4223d6['body']['id']){delete _0x4223d6[_0xd3bb('0x56')]['id'];}return db[_0xd3bb('0x2e')][_0xd3bb('0x4c')]({'where':{'id':_0x4223d6[_0xd3bb('0x49')]['id']}})[_0xd3bb('0x26')](handleEntityNotFound(_0x1ea5fc,null))[_0xd3bb('0x26')](function(_0xe3bd0e){if(_0xe3bd0e){_0x4223d6[_0xd3bb('0x56')]['TriggerId']=_0xe3bd0e['id'];return db[_0xd3bb('0x5e')]['create'](_0x4223d6[_0xd3bb('0x56')]);}})[_0xd3bb('0x26')](respondWithResult(_0x1ea5fc,null))[_0xd3bb('0x47')](handleError(_0x1ea5fc,null));};exports[_0xd3bb('0x5f')]=function(_0x838f4e,_0x56d790,_0x4ac4e2){var _0x4f3753={};var _0x4d1e94={};var _0x5a60df;var _0xf25d89;return db['Trigger'][_0xd3bb('0x5b')]({'where':{'id':_0x838f4e['params']['id']}})[_0xd3bb('0x26')](handleEntityNotFound(_0x56d790,null))[_0xd3bb('0x26')](function(_0x303557){if(_0x303557){_0x5a60df=_0x303557;_0x4d1e94['model']=_[_0xd3bb('0x34')](db[_0xd3bb('0x5e')][_0xd3bb('0x2f')]);_0x4d1e94[_0xd3bb('0x33')]=_['keys'](_0x838f4e[_0xd3bb('0x33')]);_0x4d1e94[_0xd3bb('0x35')]=_['intersection'](_0x4d1e94[_0xd3bb('0x32')],_0x4d1e94['query']);_0x4f3753[_0xd3bb('0x37')]=_[_0xd3bb('0x36')](_0x4d1e94[_0xd3bb('0x32')],qs[_0xd3bb('0x4a')](_0x838f4e['query'][_0xd3bb('0x4a')]));_0x4f3753[_0xd3bb('0x37')]=_0x4f3753[_0xd3bb('0x37')]['length']?_0x4f3753['attributes']:_0x4d1e94[_0xd3bb('0x32')];_0x4f3753[_0xd3bb('0x3b')]=qs['sort'](_0x838f4e['query'][_0xd3bb('0x3c')]);_0x4f3753[_0xd3bb('0x3d')]=qs[_0xd3bb('0x35')](_[_0xd3bb('0x3e')](_0x838f4e[_0xd3bb('0x33')],_0x4d1e94[_0xd3bb('0x35')]));if(_0x838f4e[_0xd3bb('0x33')]['filter']){_0x4f3753[_0xd3bb('0x3d')]=_[_0xd3bb('0x40')](_0x4f3753[_0xd3bb('0x3d')],{'$or':_['map'](_0x4f3753[_0xd3bb('0x37')],function(_0x2a2d01){var _0x2b89e6={};_0x2b89e6[_0x2a2d01]={'$like':'%'+_0x838f4e[_0xd3bb('0x33')][_0xd3bb('0x3f')]+'%'};return _0x2b89e6;})});}_0x4f3753=_[_0xd3bb('0x40')]({},_0x4f3753,_0x838f4e[_0xd3bb('0x4b')]);return _0x5a60df[_0xd3bb('0x5f')](_0x4f3753);}})[_0xd3bb('0x26')](function(_0x15751e){if(_0x15751e){_0xf25d89=_0x15751e[_0xd3bb('0x38')];if(!_0x838f4e[_0xd3bb('0x33')]['hasOwnProperty'](_0xd3bb('0x3a'))){_0x4f3753[_0xd3bb('0x1f')]=qs[_0xd3bb('0x1f')](_0x838f4e[_0xd3bb('0x33')][_0xd3bb('0x1f')]);_0x4f3753[_0xd3bb('0x1e')]=qs[_0xd3bb('0x1e')](_0x838f4e[_0xd3bb('0x33')][_0xd3bb('0x1e')]);}return _0x5a60df['getActions'](_0x4f3753);}})[_0xd3bb('0x26')](function(_0x4fef5e){if(_0x4fef5e){return _0x4fef5e?{'count':_0xf25d89,'rows':_0x4fef5e}:null;}})[_0xd3bb('0x26')](respondWithResult(_0x56d790,null))[_0xd3bb('0x47')](handleError(_0x56d790,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index dcf61b8..f701258 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 _0x0b0e=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5cdb19,_0x43b3e6){var _0x5656a7=function(_0x5b9f58){while(--_0x5b9f58){_0x5cdb19['push'](_0x5cdb19['shift']());}};_0x5656a7(++_0x43b3e6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e6cbb,_0x3450f0){_0x4e6cbb=_0x4e6cbb-0x0;var _0x15ced4=_0x0b0e[_0x4e6cbb];return _0x15ced4;};'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')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./trigger.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 5812f43..ed65c16 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 _0x8f4c=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','map','include','model','ShowTrigger','find','lodash','util','moment','bluebird','randomstring'];(function(_0x534d4f,_0x22d038){var _0x4ea1b0=function(_0x389d0b){while(--_0x389d0b){_0x534d4f['push'](_0x534d4f['shift']());}};_0x4ea1b0(++_0x22d038);}(_0x8f4c,0x113));var _0xc8f4=function(_0x4e8c47,_0x94ee2d){_0x4e8c47=_0x4e8c47-0x0;var _0x6c119=_0x8f4c[_0x4e8c47];return _0x6c119;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')]({'raw':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')]['where']||null:null,'attributes':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1c')]||null:null,'limit':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1d')]||null:null,'include':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')]['include']?_[_0xc8f4('0x1e')](_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1f')],function(_0x1d159e){return{'model':db[_0x1d159e['model']],'as':_0x1d159e['as'],'attributes':_0x1d159e[_0xc8f4('0x1c')],'include':_0x1d159e['include']?_[_0xc8f4('0x1e')](_0x1d159e['include'],function(_0x177a44){return{'model':db[_0x177a44[_0xc8f4('0x20')]],'as':_0x177a44['as'],'attributes':_0x177a44['attributes'],'include':_0x177a44[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x177a44[_0xc8f4('0x1f')],function(_0x2fa052){return{'model':db[_0x2fa052['model']],'as':_0x2fa052['as'],'attributes':_0x2fa052[_0xc8f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc8f4('0xb')](function(_0x5db666){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5db666));_0x4763c1(_0x5db666);})[_0xc8f4('0x16')](function(_0x4a25da){logger[_0xc8f4('0x11')](_0xc8f4('0x17'),_0x4a25da[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973['error'](0x1f4,_0x4a25da[_0xc8f4('0x13')]));});});};exports[_0xc8f4('0x21')]=function(_0x5ab6cb){var _0x56ec4b=this;return new Promise(function(_0x4d6c43,_0x2717ff){return db[_0xc8f4('0x18')][_0xc8f4('0x22')]({'raw':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')]['where']||null:null,'attributes':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1c')]||null:null,'include':_0x5ab6cb['options']?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1f')]?_['map'](_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1f')],function(_0x36f24f){return{'model':db[_0x36f24f['model']],'as':_0x36f24f['as'],'attributes':_0x36f24f[_0xc8f4('0x1c')],'include':_0x36f24f[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x36f24f['include'],function(_0x1c9d57){return{'model':db[_0x1c9d57[_0xc8f4('0x20')]],'as':_0x1c9d57['as'],'attributes':_0x1c9d57[_0xc8f4('0x1c')],'include':_0x1c9d57[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x1c9d57[_0xc8f4('0x1f')],function(_0xeacb80){return{'model':db[_0xeacb80[_0xc8f4('0x20')]],'as':_0xeacb80['as'],'attributes':_0xeacb80[_0xc8f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc8f4('0xb')](function(_0x35b516){logger[_0xc8f4('0x14')](_0xc8f4('0x21'),_0x5ab6cb);logger[_0xc8f4('0xe')](_0xc8f4('0x21'),_0x5ab6cb,JSON[_0xc8f4('0x10')](_0x35b516));_0x4d6c43(_0x35b516);})['catch'](function(_0x3a8cac){logger['error'](_0xc8f4('0x21'),_0x3a8cac['message'],_0x5ab6cb);_0x2717ff(_0x56ec4b[_0xc8f4('0x11')](0x1f4,_0x3a8cac[_0xc8f4('0x13')]));});});}; \ No newline at end of file +var _0xb58b=['model','map','debug','catch','ShowTrigger','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xb58b,0x1f1));var _0xbb58=function(_0x3befd3,_0x45bd8a){_0x3befd3=_0x3befd3-0x0;var _0x1218bf=_0xb58b[_0x3befd3];return _0x1218bf;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('Trigger,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')]({'raw':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')]['where']||null:null,'attributes':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'limit':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1a')]||null:null,'include':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x3134ea[_0xbb58('0x17')]['include'],function(_0x21964d){return{'model':db[_0x21964d[_0xbb58('0x1c')]],'as':_0x21964d['as'],'attributes':_0x21964d[_0xbb58('0x19')],'include':_0x21964d[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x21964d[_0xbb58('0x1b')],function(_0x2d556a){return{'model':db[_0x2d556a[_0xbb58('0x1c')]],'as':_0x2d556a['as'],'attributes':_0x2d556a['attributes'],'include':_0x2d556a[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x2d556a[_0xbb58('0x1b')],function(_0x129094){return{'model':db[_0x129094[_0xbb58('0x1c')]],'as':_0x129094['as'],'attributes':_0x129094[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbb58('0xa')](function(_0x2ce7c3){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1e')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x2ce7c3));_0xbee66(_0x2ce7c3);})[_0xbb58('0x1f')](function(_0x3559b6){logger['error'](_0xbb58('0x14'),_0x3559b6[_0xbb58('0x12')],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x3559b6[_0xbb58('0x12')]));});});};exports[_0xbb58('0x20')]=function(_0x9d379f){var _0x1ba526=this;return new Promise(function(_0x643e0e,_0x3f8db3){return db['Trigger'][_0xbb58('0x21')]({'raw':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x22')]||null:null,'attributes':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'include':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x9d379f['options']['include'],function(_0x1def9f){return{'model':db[_0x1def9f[_0xbb58('0x1c')]],'as':_0x1def9f['as'],'attributes':_0x1def9f[_0xbb58('0x19')],'include':_0x1def9f[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x1def9f[_0xbb58('0x1b')],function(_0x3093bf){return{'model':db[_0x3093bf[_0xbb58('0x1c')]],'as':_0x3093bf['as'],'attributes':_0x3093bf['attributes'],'include':_0x3093bf[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x3093bf['include'],function(_0x33ec68){return{'model':db[_0x33ec68['model']],'as':_0x33ec68['as'],'attributes':_0x33ec68[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x86372e){logger[_0xbb58('0xb')]('ShowTrigger',_0x9d379f);logger[_0xbb58('0x1e')](_0xbb58('0x20'),_0x9d379f,JSON[_0xbb58('0xf')](_0x86372e));_0x643e0e(_0x86372e);})[_0xbb58('0x1f')](function(_0x1b86a6){logger[_0xbb58('0x10')](_0xbb58('0x20'),_0x1b86a6[_0xbb58('0x12')],_0x9d379f);_0x3f8db3(_0x1ba526['error'](0x1f4,_0x1b86a6[_0xbb58('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 9b8969c..fabf174 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 _0x7da7=['post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','/:id','show'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7da7,0x10d));var _0x77da=function(_0x48c2ae,_0x4cea90){_0x48c2ae=_0x48c2ae-0x0;var _0x8f7531=_0x7da7[_0x48c2ae];return _0x8f7531;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0xd')]);router['post']('/',auth[_0x77da('0x7')](),controller[_0x77da('0xe')]);router[_0x77da('0xf')]('/:id',auth[_0x77da('0x7')](),controller[_0x77da('0x10')]);router[_0x77da('0x11')](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0x12')]);module[_0x77da('0x13')]=router; \ No newline at end of file +var _0x54ef=['isAuthenticated','post','clone','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','/:id'];(function(_0x46ab67,_0x302f5f){var _0x42cf9b=function(_0x3aaa3d){while(--_0x3aaa3d){_0x46ab67['push'](_0x46ab67['shift']());}};_0x42cf9b(++_0x302f5f);}(_0x54ef,0x112));var _0xf54e=function(_0x1f5a54,_0xc5af01){_0x1f5a54=_0x1f5a54-0x0;var _0x4954e4=_0x54ef[_0x1f5a54];return _0x4954e4;};'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')]('/:id/clone',auth[_0xf54e('0xb')](),controller[_0xf54e('0xd')]);router['post']('/',auth[_0xf54e('0xb')](),controller[_0xf54e('0xe')]);router[_0xf54e('0xf')](_0xf54e('0xa'),auth['isAuthenticated'](),controller[_0xf54e('0x10')]);router[_0xf54e('0x11')](_0xf54e('0xa'),auth[_0xf54e('0xb')](),controller['destroy']);module[_0xf54e('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index fb1c110..1f6b858 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 _0x8426=['never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'];(function(_0x4c5181,_0x6a51e){var _0x252a33=function(_0x18daf3){while(--_0x18daf3){_0x4c5181['push'](_0x4c5181['shift']());}};_0x252a33(++_0x6a51e);}(_0x8426,0x1b9));var _0x6842=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8426[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require('sequelize');module[_0x6842('0x0')]={'name':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'unique':_0x6842('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6842('0x3')]('friend',_0x6842('0x4'),'peer'),'allowNull':![],'defaultValue':_0x6842('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6842('0x6')},'callingpres':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x7'),_0x6842('0x8'),_0x6842('0x9'),_0x6842('0xa'),_0x6842('0xb'),'PROHIB_PASSED_SCREEN',_0x6842('0xc'),_0x6842('0xd'))},'deny':{'type':Sequelize[_0x6842('0x1')]},'permit':{'type':Sequelize[_0x6842('0x1')]},'secret':{'type':Sequelize[_0x6842('0x1')]},'md5secret':{'type':Sequelize[_0x6842('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'udp','set':function(_0x1cef15){this[_0x6842('0xe')](_0x6842('0xf'),_0x1cef15?_0x1cef15[_0x6842('0x10')](','):null);},'get':function(){return this[_0x6842('0x11')]('transport')?this[_0x6842('0x11')](_0x6842('0xf'))[_0x6842('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x6842('0x13'),_0x6842('0x14'),_0x6842('0x15'),_0x6842('0x16'),_0x6842('0x17')),'defaultValue':_0x6842('0x13')},'directmedia':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no',_0x6842('0x19'),_0x6842('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x6842('0x1')]},'nat':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x1b'),'set':function(_0x52c08e){this[_0x6842('0xe')](_0x6842('0x1c'),_0x52c08e?_0x52c08e[_0x6842('0x10')](','):null);},'get':function(){return this[_0x6842('0x11')](_0x6842('0x1c'))?this[_0x6842('0x11')](_0x6842('0x1c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x6842('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6842('0x1')]},'pickupgroup':{'type':Sequelize[_0x6842('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6842('0x1')]},'language':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6842('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x1d')},'allow':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'defaultValue':_0x6842('0x1e'),'set':function(_0x316b45){this[_0x6842('0xe')](_0x6842('0x1f'),_0x316b45?_0x316b45[_0x6842('0x10')](';'):_0x6842('0x1e'));},'get':function(){return this[_0x6842('0x11')](_0x6842('0x1f'))?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x6842('0x20')},'autoframing':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'insecure':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x21'),'set':function(_0x14a9cd){this[_0x6842('0xe')](_0x6842('0x22'),_0x14a9cd?_0x14a9cd[_0x6842('0x10')](','):null);},'get':function(){return this[_0x6842('0x11')](_0x6842('0x22'))?this['getDataValue'](_0x6842('0x22'))[_0x6842('0x12')](','):null;},'comment':_0x6842('0x23')},'trustrpid':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6842('0x3')]('yes','no',_0x6842('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x25')},'amaflags':{'type':Sequelize[_0x6842('0x1')]},'callcounter':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':_0x6842('0x18')},'busylevel':{'type':Sequelize[_0x6842('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x6842('0x1')]},'videosupport':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no',_0x6842('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'mailbox':{'type':Sequelize[_0x6842('0x1')]},'session_timers':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x28'),_0x6842('0x29'),_0x6842('0x2a'))},'session_expires':{'type':Sequelize[_0x6842('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x6842('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x2b'),_0x6842('0x2c')),'defaultValue':_0x6842('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x6842('0x1')]},'regexten':{'type':Sequelize[_0x6842('0x1')]},'fromdomain':{'type':Sequelize[_0x6842('0x1')]},'fromuser':{'type':Sequelize[_0x6842('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':_0x6842('0x18')},'keepalive':{'type':Sequelize[_0x6842('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x6842('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6842('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no',_0x6842('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6842('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x6842('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x6842('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x6842('0x1')]},'contactacl':{'type':Sequelize[_0x6842('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6842('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x6842('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'force_avp':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no',_0x6842('0x2e'),_0x6842('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x6842('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6842('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x6842('0x1')]},'dtlscipher':{'type':Sequelize[_0x6842('0x1')]},'dtlscafile':{'type':Sequelize[_0x6842('0x1')]},'dtlscapath':{'type':Sequelize[_0x6842('0x1')]},'dtlssetup':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x30'),'passive',_0x6842('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x6842('0x1')]},'call_limit':{'type':Sequelize[_0x6842('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x6842('0x3')](_0x6842('0x18'),'no')},'vmexten':{'type':Sequelize[_0x6842('0x1')]},'mohinterpret':{'type':Sequelize[_0x6842('0x1')]},'mohsuggest':{'type':Sequelize[_0x6842('0x1')]},'parkinglot':{'type':Sequelize[_0x6842('0x1')]},'description':{'type':Sequelize[_0x6842('0x1')]},'host':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0x6842('0x18'),'no','nonat','update',_0x6842('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x6842('0x1')]},'active':{'type':Sequelize[_0x6842('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xd9c7=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','accept','refuse','originate','uac','uas','pai','fingerprint','active','actpass','dynamic','sequelize','exports','name','ENUM','friend','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure'];(function(_0x5bbbe1,_0x12bbc4){var _0xc27b6f=function(_0x181891){while(--_0x181891){_0x5bbbe1['push'](_0x5bbbe1['shift']());}};_0xc27b6f(++_0x12bbc4);}(_0xd9c7,0xcb));var _0x7d9c=function(_0x24c8fe,_0x436a94){_0x24c8fe=_0x24c8fe-0x0;var _0x55c496=_0xd9c7[_0x24c8fe];return _0x55c496;};'use strict';var Sequelize=require(_0x7d9c('0x0'));module[_0x7d9c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7d9c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x4'),'user',_0x7d9c('0x5')),'allowNull':![],'defaultValue':_0x7d9c('0x4')},'context':{'type':Sequelize[_0x7d9c('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x7d9c('0x7'),_0x7d9c('0x8'),_0x7d9c('0x9'),'ALLOWED',_0x7d9c('0xa'),'PROHIB_PASSED_SCREEN',_0x7d9c('0xb'),_0x7d9c('0xc'))},'deny':{'type':Sequelize[_0x7d9c('0x6')]},'permit':{'type':Sequelize[_0x7d9c('0x6')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7d9c('0x6')]},'remotesecret':{'type':Sequelize[_0x7d9c('0x6')]},'transport':{'type':Sequelize[_0x7d9c('0x6')],'defaultValue':_0x7d9c('0xd'),'set':function(_0x5d7701){this[_0x7d9c('0xe')](_0x7d9c('0xf'),_0x5d7701?_0x5d7701[_0x7d9c('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x7d9c('0xf'))?this[_0x7d9c('0x11')](_0x7d9c('0xf'))[_0x7d9c('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x13'),'info',_0x7d9c('0x14'),'inband','auto'),'defaultValue':_0x7d9c('0x13')},'directmedia':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no',_0x7d9c('0x16'),_0x7d9c('0x17'),_0x7d9c('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7d9c('0x6')]},'directmediadeny':{'type':Sequelize[_0x7d9c('0x6')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x7d9c('0x19'),'set':function(_0x3a9adb){this['setDataValue'](_0x7d9c('0x1a'),_0x3a9adb?_0x3a9adb[_0x7d9c('0x10')](','):null);},'get':function(){return this[_0x7d9c('0x11')](_0x7d9c('0x1a'))?this[_0x7d9c('0x11')](_0x7d9c('0x1a'))[_0x7d9c('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7d9c('0x6')]},'namedcallgroup':{'type':Sequelize[_0x7d9c('0x6')]},'pickupgroup':{'type':Sequelize[_0x7d9c('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x7d9c('0x6')]},'language':{'type':Sequelize[_0x7d9c('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7d9c('0x6')],'defaultValue':_0x7d9c('0x1b')},'allow':{'type':Sequelize[_0x7d9c('0x6')],'allowNull':![],'defaultValue':_0x7d9c('0x1c'),'set':function(_0x559967){this[_0x7d9c('0xe')]('allow',_0x559967?_0x559967['join'](';'):_0x7d9c('0x1c'));},'get':function(){return this[_0x7d9c('0x11')]('allow')?this[_0x7d9c('0x11')](_0x7d9c('0x1d'))[_0x7d9c('0x12')](';'):null;},'comment':_0x7d9c('0x1e')},'autoframing':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x243984){this['setDataValue']('insecure',_0x243984?_0x243984[_0x7d9c('0x10')](','):null);},'get':function(){return this[_0x7d9c('0x11')](_0x7d9c('0x1f'))?this['getDataValue'](_0x7d9c('0x1f'))['split'](','):null;},'comment':_0x7d9c('0x20')},'trustrpid':{'type':Sequelize['ENUM'](_0x7d9c('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x7d9c('0x15'),'no',_0x7d9c('0x21'))},'promiscredir':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x7d9c('0x6')]},'callerid':{'type':Sequelize[_0x7d9c('0x6')],'defaultValue':_0x7d9c('0x22')},'amaflags':{'type':Sequelize[_0x7d9c('0x6')]},'callcounter':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no'),'defaultValue':_0x7d9c('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x7d9c('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x7d9c('0x15'),'no',_0x7d9c('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7d9c('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'mailbox':{'type':Sequelize[_0x7d9c('0x6')]},'session_timers':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x25'),_0x7d9c('0x26'),_0x7d9c('0x27'))},'session_expires':{'type':Sequelize[_0x7d9c('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x7d9c('0x28'),_0x7d9c('0x29')),'defaultValue':_0x7d9c('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x7d9c('0x6')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7d9c('0x6')]},'fromuser':{'type':Sequelize[_0x7d9c('0x6')]},'port':{'type':Sequelize[_0x7d9c('0x24')](0x5)},'qualify':{'type':Sequelize[_0x7d9c('0x3')]('yes','no'),'defaultValue':_0x7d9c('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x7d9c('0x6')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7d9c('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no',_0x7d9c('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7d9c('0x6')]},'callbackextension':{'type':Sequelize[_0x7d9c('0x6')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x7d9c('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7d9c('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x7d9c('0x6')]},'contactdeny':{'type':Sequelize[_0x7d9c('0x6')]},'contactacl':{'type':Sequelize[_0x7d9c('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x7d9c('0x6')]},'use_q850_reason':{'type':Sequelize[_0x7d9c('0x6')]},'maxforwards':{'type':Sequelize[_0x7d9c('0x24')](0xb)},'encryption':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'force_avp':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'icesupport':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x7d9c('0x3')]('yes','no',_0x7d9c('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x7d9c('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7d9c('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x7d9c('0x6')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7d9c('0x6')]},'dtlssetup':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x2c'),'passive',_0x7d9c('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7d9c('0x6')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x7d9c('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x7d9c('0x3')](_0x7d9c('0x15'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x7d9c('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7d9c('0x6')],'defaultValue':_0x7d9c('0x2e')},'canreinvite':{'type':Sequelize[_0x7d9c('0x3')]('yes','no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7d9c('0x6')]},'otherFields':{'type':Sequelize[_0x7d9c('0x6')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7d9c('0x6')],'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 dcac586..0a59f08 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 _0x578c=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Trunk','count','includeAll','include','rows','params','rawAttributes','find','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','findAll','root','server/files/templates/trunk.ejs','utf8','readFileSync','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x1a17dd,_0x46f57d){var _0x54a08f=function(_0x35ebca){while(--_0x35ebca){_0x1a17dd['push'](_0x1a17dd['shift']());}};_0x54a08f(++_0x46f57d);}(_0x578c,0x158));var _0xc578=function(_0x2e2795,_0x3865b2){_0x2e2795=_0x2e2795-0x0;var _0x3c7b99=_0x578c[_0x2e2795];return _0x3c7b99;};'use strict';var pdf=require(_0xc578('0x0'));var emlformat=require(_0xc578('0x1'));var rimraf=require(_0xc578('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc578('0x3'));var rp=require(_0xc578('0x4'));var moment=require(_0xc578('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc578('0x6'));var util=require(_0xc578('0x7'));var path=require(_0xc578('0x8'));var sox=require(_0xc578('0x9'));var csv=require(_0xc578('0xa'));var ejs=require(_0xc578('0xb'));var fs=require('fs');var _=require(_0xc578('0xc'));var squel=require(_0xc578('0xd'));var crypto=require(_0xc578('0xe'));var jsforce=require(_0xc578('0xf'));var deskjs=require(_0xc578('0x10'));var toCsv=require(_0xc578('0xa'));var querystring=require(_0xc578('0x11'));var Papa=require(_0xc578('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc578('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc578('0x14'));var logger=require(_0xc578('0x15'))(_0xc578('0x16'));var utils=require('../../config/utils');var config=require(_0xc578('0x17'));var db=require(_0xc578('0x18'))['db'];var jayson=require(_0xc578('0x19'));var client=jayson['client'][_0xc578('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3dbda8,_0x335415,_0x191ab2){if(_0x191ab2){var _0x1e28b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e28b9['test'](_0x335415)){return _0x3dbda8;}else{throw new db[(_0xc578('0x1b'))][(_0xc578('0x1c'))](_0xc578('0x1d'));}}else{return _0x3dbda8;}}function respondWithRpcPromise(_0x251007,_0x2ce76d,_0x1c7078,_0x3294f8){return new BPromise(function(_0x13b6d4,_0x109756){var _0x3f6f18=_0x3294f8||client;return _0x3f6f18[_0xc578('0x1e')](_0x251007,_0x1c7078)[_0xc578('0x1f')](function(_0x45e527){logger[_0xc578('0x20')](_0xc578('0x21'),_0x2ce76d,_0xc578('0x22'));logger[_0xc578('0x23')](_0xc578('0x24'),_0x2ce76d,'request\x20sent',JSON[_0xc578('0x25')](_0x45e527));if(_0x45e527[_0xc578('0x26')]){if(_0x45e527[_0xc578('0x26')][_0xc578('0x27')]===0x1f4){logger['error'](_0xc578('0x21'),_0x2ce76d,_0x45e527[_0xc578('0x26')][_0xc578('0x28')]);return _0x109756(_0x45e527['error']['message']);}logger['error'](_0xc578('0x21'),_0x2ce76d,_0x45e527[_0xc578('0x26')][_0xc578('0x28')]);return _0x13b6d4(_0x45e527[_0xc578('0x26')][_0xc578('0x28')]);}else{logger['info'](_0xc578('0x21'),_0x2ce76d,_0xc578('0x22'));_0x13b6d4(_0x45e527[_0xc578('0x29')]['message']);}})[_0xc578('0x2a')](function(_0x54388f){logger['error'](_0xc578('0x21'),_0x2ce76d,_0x54388f);_0x109756(_0x54388f);});});}function respondWithStatusCode(_0xbf3f05,_0xf4090e){_0xf4090e=_0xf4090e||0xcc;return function(_0x431638){if(_0x431638){return _0xbf3f05['sendStatus'](_0xf4090e);}return _0xbf3f05[_0xc578('0x2b')](_0xf4090e)[_0xc578('0x2c')]();};}function respondWithResult(_0x5c1a03,_0x2b3a2f){_0x2b3a2f=_0x2b3a2f||0xc8;return function(_0x2762d9){if(_0x2762d9){return _0x5c1a03['status'](_0x2b3a2f)[_0xc578('0x2d')](_0x2762d9);}};}function respondWithFilteredResult(_0x5141ac,_0x1622d1){return function(_0x56d9e1){if(_0x56d9e1){var _0x1e4623=_0x56d9e1['count'],_0x9474f7=_0x1622d1[_0xc578('0x2e')],_0x5398f7=_0x1622d1[_0xc578('0x2e')]+_0x1622d1[_0xc578('0x2f')],_0x5d0023;if(_0x5398f7>=_0x1e4623){_0x5398f7=_0x1e4623;_0x5d0023=0xc8;}else{_0x5d0023=0xce;}_0x5141ac['status'](_0x5d0023);return _0x5141ac['set'](_0xc578('0x30'),_0x9474f7+'-'+_0x5398f7+'/'+_0x1e4623)[_0xc578('0x2d')](_0x56d9e1);}return null;};}function patchUpdates(_0x3c3690){return function(_0x169586){try{jsonpatch[_0xc578('0x31')](_0x169586,_0x3c3690,!![]);}catch(_0x313c01){return BPromise[_0xc578('0x32')](_0x313c01);}return _0x169586['save']();};}function saveUpdates(_0x3781a8,_0x30357d){return function(_0x1bb6cb){if(_0x1bb6cb){return _0x1bb6cb[_0xc578('0x33')](_0x3781a8)[_0xc578('0x1f')](function(_0x472e38){return _0x472e38;});}return null;};}function removeEntity(_0x83799d,_0x235e08){return function(_0x227dc9){if(_0x227dc9){return _0x227dc9[_0xc578('0x34')]()[_0xc578('0x1f')](function(){var _0x3ac265=_0x227dc9[_0xc578('0x35')]({'plain':!![]});var _0x3ac4c1=_0xc578('0x36');return db[_0xc578('0x37')][_0xc578('0x34')]({'where':{'type':_0x3ac4c1,'resourceId':_0x3ac265['id']}})[_0xc578('0x1f')](function(){return _0x227dc9;});})[_0xc578('0x1f')](function(){_0x83799d['status'](0xcc)[_0xc578('0x2c')]();});}};}function handleEntityNotFound(_0x2428c7,_0x2c5abf){return function(_0x1cf2fe){if(!_0x1cf2fe){_0x2428c7[_0xc578('0x38')](0x194);}return _0x1cf2fe;};}function handleError(_0x1d4c1a,_0x2f60ec){_0x2f60ec=_0x2f60ec||0x1f4;return function(_0x45aed0){logger[_0xc578('0x26')](_0x45aed0[_0xc578('0x39')]);if(_0x45aed0['name']){delete _0x45aed0[_0xc578('0x3a')];}_0x1d4c1a[_0xc578('0x2b')](_0x2f60ec)[_0xc578('0x3b')](_0x45aed0);};}exports[_0xc578('0x3c')]=function(_0x16b0b6,_0x4c93b4){var _0x29e20d={},_0x51767d={},_0x37c9a4={'count':0x0,'rows':[]};var _0x1f32c6=_[_0xc578('0x3d')](db['Trunk']['rawAttributes'],function(_0x5e3d16){return{'name':_0x5e3d16[_0xc578('0x3e')],'type':_0x5e3d16[_0xc578('0x3f')][_0xc578('0x40')]};});_0x51767d[_0xc578('0x41')]=_[_0xc578('0x3d')](_0x1f32c6,_0xc578('0x3a'));_0x51767d['query']=_[_0xc578('0x42')](_0x16b0b6[_0xc578('0x43')]);_0x51767d[_0xc578('0x44')]=_[_0xc578('0x45')](_0x51767d[_0xc578('0x41')],_0x51767d[_0xc578('0x43')]);_0x29e20d[_0xc578('0x46')]=_[_0xc578('0x45')](_0x51767d['model'],qs[_0xc578('0x47')](_0x16b0b6['query'][_0xc578('0x47')]));_0x29e20d['attributes']=_0x29e20d[_0xc578('0x46')][_0xc578('0x48')]?_0x29e20d[_0xc578('0x46')]:_0x51767d['model'];if(!_0x16b0b6['query'][_0xc578('0x49')](_0xc578('0x4a'))){_0x29e20d[_0xc578('0x2f')]=qs['limit'](_0x16b0b6['query'][_0xc578('0x2f')]);_0x29e20d[_0xc578('0x2e')]=qs['offset'](_0x16b0b6[_0xc578('0x43')][_0xc578('0x2e')]);}_0x29e20d[_0xc578('0x4b')]=qs[_0xc578('0x4c')](_0x16b0b6[_0xc578('0x43')][_0xc578('0x4c')]);_0x29e20d[_0xc578('0x4d')]=qs[_0xc578('0x44')](_[_0xc578('0x4e')](_0x16b0b6[_0xc578('0x43')],_0x51767d[_0xc578('0x44')]),_0x1f32c6);if(_0x16b0b6['query'][_0xc578('0x4f')]){_0x29e20d['where']=_[_0xc578('0x50')](_0x29e20d[_0xc578('0x4d')],{'$or':_[_0xc578('0x3d')](_0x1f32c6,function(_0x332384){if(_0x332384[_0xc578('0x3f')]!=='VIRTUAL'){var _0x1bfb5b={};_0x1bfb5b[_0x332384['name']]={'$like':'%'+_0x16b0b6[_0xc578('0x43')][_0xc578('0x4f')]+'%'};return _0x1bfb5b;}})});}_0x29e20d=_[_0xc578('0x50')]({},_0x29e20d,_0x16b0b6[_0xc578('0x51')]);var _0x576435={'where':_0x29e20d[_0xc578('0x4d')]};return db[_0xc578('0x52')][_0xc578('0x53')](_0x576435)[_0xc578('0x1f')](function(_0x41cb81){_0x37c9a4[_0xc578('0x53')]=_0x41cb81;if(_0x16b0b6['query'][_0xc578('0x54')]){_0x29e20d[_0xc578('0x55')]=[{'all':!![]}];}return db[_0xc578('0x52')]['findAll'](_0x29e20d);})[_0xc578('0x1f')](function(_0x233b76){_0x37c9a4[_0xc578('0x56')]=_0x233b76;return _0x37c9a4;})[_0xc578('0x1f')](respondWithFilteredResult(_0x4c93b4,_0x29e20d))[_0xc578('0x2a')](handleError(_0x4c93b4,null));};exports['show']=function(_0x2b88d9,_0x3cc17c){var _0x5b5932={'raw':![],'where':{'id':_0x2b88d9[_0xc578('0x57')]['id']}},_0x7108a1={};_0x7108a1[_0xc578('0x41')]=_[_0xc578('0x42')](db[_0xc578('0x52')][_0xc578('0x58')]);_0x7108a1[_0xc578('0x43')]=_['keys'](_0x2b88d9[_0xc578('0x43')]);_0x7108a1[_0xc578('0x44')]=_[_0xc578('0x45')](_0x7108a1[_0xc578('0x41')],_0x7108a1[_0xc578('0x43')]);_0x5b5932['attributes']=_[_0xc578('0x45')](_0x7108a1['model'],qs[_0xc578('0x47')](_0x2b88d9[_0xc578('0x43')][_0xc578('0x47')]));_0x5b5932['attributes']=_0x5b5932[_0xc578('0x46')][_0xc578('0x48')]?_0x5b5932[_0xc578('0x46')]:_0x7108a1[_0xc578('0x41')];if(_0x2b88d9[_0xc578('0x43')][_0xc578('0x54')]){_0x5b5932[_0xc578('0x55')]=[{'all':!![]}];}_0x5b5932=_['merge']({},_0x5b5932,_0x2b88d9[_0xc578('0x51')]);return db['Trunk']['find'](_0x5b5932)[_0xc578('0x1f')](handleEntityNotFound(_0x3cc17c,null))[_0xc578('0x1f')](respondWithResult(_0x3cc17c,null))[_0xc578('0x2a')](handleError(_0x3cc17c,null));};exports['clone']=function(_0x2dc099,_0x5e5b7b){var _0x32d93a={'where':{'id':_0x2dc099[_0xc578('0x57')]['id']}},_0x22150a={};_0x22150a[_0xc578('0x41')]=_[_0xc578('0x42')](db[_0xc578('0x52')]['rawAttributes']);_0x32d93a[_0xc578('0x46')]=_['intersection'](_0x22150a[_0xc578('0x41')],qs[_0xc578('0x47')](_0x2dc099['query'][_0xc578('0x47')]));_0x32d93a['attributes']=_0x32d93a[_0xc578('0x46')][_0xc578('0x48')]?_0x32d93a[_0xc578('0x46')]:_0x22150a['model'];if(_0x2dc099['query'][_0xc578('0x54')]){_0x32d93a[_0xc578('0x55')]=[{'all':!![]}];}_0x32d93a=_[_0xc578('0x50')]({},_0x32d93a,_0x2dc099[_0xc578('0x51')]);return db[_0xc578('0x52')][_0xc578('0x59')](_0x32d93a)[_0xc578('0x1f')](handleEntityNotFound(_0x5e5b7b,null))[_0xc578('0x1f')](function(_0x1e7d8f){if(_0x1e7d8f){var _0x1a2976=_0x1e7d8f['get']({'plain':!![]});_0x1a2976=qs[_0xc578('0x5a')](_0x1a2976,['id',_0xc578('0x5b'),_0xc578('0x5c')]);_0x2dc099[_0xc578('0x5d')]=_[_0xc578('0x5a')](_0x2dc099['body'],['id',_0xc578('0x5b'),_0xc578('0x5c')]);return db[_0xc578('0x52')]['create'](_['merge'](_0x1a2976,_0x2dc099[_0xc578('0x5d')]),{'include':_0x2dc099['query'][_0xc578('0x54')]?[{'all':!![]}]:undefined})[_0xc578('0x1f')](function(_0x2d25a4){var _0x5c572d=_0x2dc099[_0xc578('0x5e')][_0xc578('0x35')]({'plain':!![]});if(!_0x5c572d)throw new Error(_0xc578('0x5f'));if(_0x5c572d[_0xc578('0x60')]==='user'){var _0x267f86=_0x2d25a4[_0xc578('0x35')]({'plain':!![]});var _0x367e02=_0xc578('0x36');return db[_0xc578('0x61')]['find']({'where':{'name':_0x367e02,'userProfileId':_0x5c572d[_0xc578('0x62')]},'raw':!![]})[_0xc578('0x1f')](function(_0x5cea0d){if(_0x5cea0d&&_0x5cea0d[_0xc578('0x63')]===0x0){return db[_0xc578('0x37')]['create']({'name':_0x267f86[_0xc578('0x3a')],'resourceId':_0x267f86['id'],'type':_0x5cea0d['name'],'sectionId':_0x5cea0d['id']},{})[_0xc578('0x1f')](function(){return _0x2d25a4;});}else{return _0x2d25a4;}})['catch'](function(_0x9aa020){logger[_0xc578('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9aa020);throw _0x9aa020;});}return _0x2d25a4;});}})['then'](respondWithResult(_0x5e5b7b,0xc9))[_0xc578('0x2a')](handleError(_0x5e5b7b,null));};exports[_0xc578('0x64')]=function(_0xeb731f,_0x48f8e0,_0x37ffcc){var _0x432a21;return db['Trunk'][_0xc578('0x64')](_0xeb731f['body'],{'raw':!![]})[_0xc578('0x1f')](function(_0x194344){_0x432a21=_0x194344;return db['Trunk'][_0xc578('0x65')]({'raw':!![]});})[_0xc578('0x1f')](function(_0x3bcfd1){var _0x43553c=fs['readFileSync'](path['join'](config[_0xc578('0x66')],_0xc578('0x67')),_0xc578('0x68'));var _0x19de7e=fs[_0xc578('0x69')](path[_0xc578('0x6a')](config[_0xc578('0x66')],_0xc578('0x6b')),_0xc578('0x68'));var _0x13e98e=ejs[_0xc578('0x6c')](_0x43553c,{'trunks':_0x3bcfd1||[]});fs[_0xc578('0x6d')](_0xc578('0x6e'),_0x13e98e);if(_0x432a21[_0xc578('0x6f')]){var _0x164254=ejs[_0xc578('0x6c')](_0x19de7e,{'trunks':_0x3bcfd1||[]});fs[_0xc578('0x6d')](_0xc578('0x70'),_0x164254);}})[_0xc578('0x1f')](function(){return respondWithRpcPromise('Reload',_0xc578('0x64'),{'module':_0xc578('0x71')});})[_0xc578('0x1f')](function(){var _0x4616b5=_0xeb731f[_0xc578('0x5e')][_0xc578('0x35')]({'plain':!![]});if(!_0x4616b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4616b5['role']==='user'){var _0x2dc023=_0x432a21[_0xc578('0x35')]({'plain':!![]});return db[_0xc578('0x61')][_0xc578('0x59')]({'where':{'name':_0xc578('0x36'),'userProfileId':_0x4616b5['userProfileId']},'raw':!![]})[_0xc578('0x1f')](function(_0x21059c){if(_0x21059c&&_0x21059c['autoAssociation']===0x0){return db[_0xc578('0x37')][_0xc578('0x64')]({'name':_0x2dc023[_0xc578('0x3a')],'resourceId':_0x2dc023['id'],'type':_0x21059c[_0xc578('0x3a')],'sectionId':_0x21059c['id']},{})[_0xc578('0x1f')](function(){return _0x432a21;});}else{return _0x432a21;}})[_0xc578('0x2a')](function(_0x4410f9){logger['error'](_0xc578('0x72'),_0x4410f9);throw _0x4410f9;});}return _0x432a21;})[_0xc578('0x1f')](respondWithResult(_0x48f8e0,0xc9))[_0xc578('0x2a')](handleError(_0x48f8e0,null));};exports['update']=function(_0x58ba22,_0x5f038e,_0x4021cf){var _0x59b110;return db[_0xc578('0x52')][_0xc578('0x59')]({'where':{'id':_0x58ba22[_0xc578('0x57')]['id']}})[_0xc578('0x1f')](handleEntityNotFound(_0x5f038e,null))[_0xc578('0x1f')](saveUpdates(_0x58ba22[_0xc578('0x5d')],null))[_0xc578('0x1f')](function(_0x33b337){if(_0x33b337){_0x59b110=_0x33b337;return db[_0xc578('0x52')]['findAll']({'raw':!![]});}})[_0xc578('0x1f')](function(_0x549d08){if(_0x549d08){var _0x1b5dfe=fs[_0xc578('0x69')](path['join'](config[_0xc578('0x66')],_0xc578('0x67')),_0xc578('0x68'));var _0x1088ee=fs['readFileSync'](path[_0xc578('0x6a')](config[_0xc578('0x66')],_0xc578('0x6b')),'utf8');var _0x3414a9=ejs[_0xc578('0x6c')](_0x1b5dfe,{'trunks':_0x549d08||[]});fs[_0xc578('0x6d')](_0xc578('0x6e'),_0x3414a9);var _0x3d7a75=ejs[_0xc578('0x6c')](_0x1088ee,{'trunks':_0x549d08||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3d7a75);return respondWithRpcPromise(_0xc578('0x73'),_0xc578('0x33'),{'module':_0xc578('0x71')});}return null;})['then'](function(_0x2b7685){if(_0x2b7685){return _0x59b110;}})[_0xc578('0x1f')](respondWithResult(_0x5f038e,null))['catch'](handleError(_0x5f038e,null));};exports[_0xc578('0x34')]=function(_0x47ec61,_0x33d133,_0x3eeb70){var _0x41ead7;return db[_0xc578('0x52')][_0xc578('0x59')]({'where':{'id':_0x47ec61['params']['id']}})[_0xc578('0x1f')](handleEntityNotFound(_0x33d133,null))[_0xc578('0x1f')](removeEntity(_0x33d133,null))[_0xc578('0x1f')](function(){return db[_0xc578('0x52')][_0xc578('0x65')]({'raw':!![]});})[_0xc578('0x1f')](function(_0x1b5fe0){var _0x777dae=fs[_0xc578('0x69')](path['join'](config[_0xc578('0x66')],_0xc578('0x67')),_0xc578('0x68'));var _0x2ae2af=fs[_0xc578('0x69')](path[_0xc578('0x6a')](config['root'],_0xc578('0x6b')),'utf8');var _0x32fba8=ejs[_0xc578('0x6c')](_0x777dae,{'trunks':_0x1b5fe0});var _0x5aaace=ejs[_0xc578('0x6c')](_0x2ae2af,{'trunks':_0x1b5fe0});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x32fba8);fs[_0xc578('0x6d')](_0xc578('0x70'),_0x5aaace);return respondWithRpcPromise(_0xc578('0x73'),_0xc578('0x34'),{'module':_0xc578('0x71')});})[_0xc578('0x2a')](handleError(_0x33d133,null));}; \ No newline at end of file +var _0x9434=['where','filter','merge','options','Trunk','includeAll','include','catch','params','clone','find','omit','createdAt','updatedAt','body','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','utf8','server/files/templates/registry.ejs','render','writeFileSync','registry','Reload','chan_sip.so','findAll','root','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','Trunks','UserProfileResource','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x427e6a,_0x2557dc){var _0x15b818=function(_0x31f517){while(--_0x31f517){_0x427e6a['push'](_0x427e6a['shift']());}};_0x15b818(++_0x2557dc);}(_0x9434,0x168));var _0x4943=function(_0x87dc57,_0x3660cb){_0x87dc57=_0x87dc57-0x0;var _0x705d02=_0x9434[_0x87dc57];return _0x705d02;};'use strict';var pdf=require(_0x4943('0x0'));var emlformat=require(_0x4943('0x1'));var rimraf=require(_0x4943('0x2'));var zipdir=require(_0x4943('0x3'));var jsonpatch=require(_0x4943('0x4'));var rp=require(_0x4943('0x5'));var moment=require('moment');var BPromise=require(_0x4943('0x6'));var Mustache=require(_0x4943('0x7'));var util=require('util');var path=require(_0x4943('0x8'));var sox=require(_0x4943('0x9'));var csv=require('to-csv');var ejs=require(_0x4943('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0xe'));var querystring=require(_0x4943('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0x10'));var qs=require(_0x4943('0x11'));var as=require(_0x4943('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x13'))(_0x4943('0x14'));var utils=require('../../config/utils');var config=require(_0x4943('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x4943('0x16')][_0x4943('0x17')]({'port':0x232a});function checkPasswordPattern(_0x33fd73,_0x37a0f2,_0x2763cb){if(_0x2763cb){var _0x24bdd7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24bdd7[_0x4943('0x18')](_0x37a0f2)){return _0x33fd73;}else{throw new db['Sequelize'][(_0x4943('0x19'))](_0x4943('0x1a'));}}else{return _0x33fd73;}}function respondWithRpcPromise(_0x2ae9b5,_0x13d758,_0x37c843,_0x39b4e3){return new BPromise(function(_0x4b075e,_0x26b707){var _0x407485=_0x39b4e3||client;return _0x407485[_0x4943('0x1b')](_0x2ae9b5,_0x37c843)['then'](function(_0x53377c){logger[_0x4943('0x1c')]('Trunk,\x20%s,\x20%s',_0x13d758,_0x4943('0x1d'));logger[_0x4943('0x1e')]('Trunk,\x20%s,\x20%s,\x20%s',_0x13d758,_0x4943('0x1d'),JSON[_0x4943('0x1f')](_0x53377c));if(_0x53377c[_0x4943('0x20')]){if(_0x53377c['error'][_0x4943('0x21')]===0x1f4){logger['error'](_0x4943('0x22'),_0x13d758,_0x53377c[_0x4943('0x20')][_0x4943('0x23')]);return _0x26b707(_0x53377c[_0x4943('0x20')][_0x4943('0x23')]);}logger[_0x4943('0x20')]('Trunk,\x20%s,\x20%s',_0x13d758,_0x53377c[_0x4943('0x20')][_0x4943('0x23')]);return _0x4b075e(_0x53377c[_0x4943('0x20')][_0x4943('0x23')]);}else{logger[_0x4943('0x1c')](_0x4943('0x22'),_0x13d758,_0x4943('0x1d'));_0x4b075e(_0x53377c[_0x4943('0x24')]['message']);}})['catch'](function(_0x315c7f){logger[_0x4943('0x20')](_0x4943('0x22'),_0x13d758,_0x315c7f);_0x26b707(_0x315c7f);});});}function respondWithStatusCode(_0x5d8cbe,_0x41f98d){_0x41f98d=_0x41f98d||0xcc;return function(_0xd49582){if(_0xd49582){return _0x5d8cbe['sendStatus'](_0x41f98d);}return _0x5d8cbe[_0x4943('0x25')](_0x41f98d)[_0x4943('0x26')]();};}function respondWithResult(_0x43cbfe,_0x24e6e1){_0x24e6e1=_0x24e6e1||0xc8;return function(_0x35f393){if(_0x35f393){return _0x43cbfe[_0x4943('0x25')](_0x24e6e1)[_0x4943('0x27')](_0x35f393);}};}function respondWithFilteredResult(_0x169ced,_0x3c1c15){return function(_0x3443ca){if(_0x3443ca){var _0x170e78=_0x3443ca[_0x4943('0x28')],_0x3b733f=_0x3c1c15[_0x4943('0x29')],_0xa71fec=_0x3c1c15[_0x4943('0x29')]+_0x3c1c15[_0x4943('0x2a')],_0x83bbd8;if(_0xa71fec>=_0x170e78){_0xa71fec=_0x170e78;_0x83bbd8=0xc8;}else{_0x83bbd8=0xce;}_0x169ced['status'](_0x83bbd8);return _0x169ced[_0x4943('0x2b')]('Content-Range',_0x3b733f+'-'+_0xa71fec+'/'+_0x170e78)[_0x4943('0x27')](_0x3443ca);}return null;};}function patchUpdates(_0x36999c){return function(_0x2957d2){try{jsonpatch[_0x4943('0x2c')](_0x2957d2,_0x36999c,!![]);}catch(_0x3b7788){return BPromise[_0x4943('0x2d')](_0x3b7788);}return _0x2957d2[_0x4943('0x2e')]();};}function saveUpdates(_0x315581,_0x571df7){return function(_0x322a94){if(_0x322a94){return _0x322a94[_0x4943('0x2f')](_0x315581)['then'](function(_0x267dd5){return _0x267dd5;});}return null;};}function removeEntity(_0x32558f,_0x50b275){return function(_0x45a5e0){if(_0x45a5e0){return _0x45a5e0[_0x4943('0x30')]()[_0x4943('0x31')](function(){var _0x4f0076=_0x45a5e0[_0x4943('0x32')]({'plain':!![]});var _0x181860=_0x4943('0x33');return db[_0x4943('0x34')][_0x4943('0x30')]({'where':{'type':_0x181860,'resourceId':_0x4f0076['id']}})['then'](function(){return _0x45a5e0;});})[_0x4943('0x31')](function(){_0x32558f[_0x4943('0x25')](0xcc)[_0x4943('0x26')]();});}};}function handleEntityNotFound(_0x70e36,_0x178cc9){return function(_0x1e7e7a){if(!_0x1e7e7a){_0x70e36[_0x4943('0x35')](0x194);}return _0x1e7e7a;};}function handleError(_0x33b12f,_0xe5f46b){_0xe5f46b=_0xe5f46b||0x1f4;return function(_0x221ea6){logger[_0x4943('0x20')](_0x221ea6['stack']);if(_0x221ea6[_0x4943('0x36')]){delete _0x221ea6[_0x4943('0x36')];}_0x33b12f[_0x4943('0x25')](_0xe5f46b)[_0x4943('0x37')](_0x221ea6);};}exports[_0x4943('0x38')]=function(_0x4d63b3,_0x51cd0f){var _0x4ac894={},_0x3bd2a9={},_0x2c7647={'count':0x0,'rows':[]};var _0x5876f6=_[_0x4943('0x39')](db['Trunk'][_0x4943('0x3a')],function(_0x2e9a00){return{'name':_0x2e9a00[_0x4943('0x3b')],'type':_0x2e9a00[_0x4943('0x3c')][_0x4943('0x3d')]};});_0x3bd2a9[_0x4943('0x3e')]=_[_0x4943('0x39')](_0x5876f6,_0x4943('0x36'));_0x3bd2a9[_0x4943('0x3f')]=_[_0x4943('0x40')](_0x4d63b3[_0x4943('0x3f')]);_0x3bd2a9[_0x4943('0x41')]=_[_0x4943('0x42')](_0x3bd2a9[_0x4943('0x3e')],_0x3bd2a9[_0x4943('0x3f')]);_0x4ac894[_0x4943('0x43')]=_[_0x4943('0x42')](_0x3bd2a9[_0x4943('0x3e')],qs[_0x4943('0x44')](_0x4d63b3[_0x4943('0x3f')][_0x4943('0x44')]));_0x4ac894[_0x4943('0x43')]=_0x4ac894[_0x4943('0x43')][_0x4943('0x45')]?_0x4ac894[_0x4943('0x43')]:_0x3bd2a9[_0x4943('0x3e')];if(!_0x4d63b3[_0x4943('0x3f')]['hasOwnProperty'](_0x4943('0x46'))){_0x4ac894[_0x4943('0x2a')]=qs['limit'](_0x4d63b3['query'][_0x4943('0x2a')]);_0x4ac894['offset']=qs[_0x4943('0x29')](_0x4d63b3['query'][_0x4943('0x29')]);}_0x4ac894['order']=qs[_0x4943('0x47')](_0x4d63b3['query'][_0x4943('0x47')]);_0x4ac894[_0x4943('0x48')]=qs[_0x4943('0x41')](_['pick'](_0x4d63b3['query'],_0x3bd2a9[_0x4943('0x41')]),_0x5876f6);if(_0x4d63b3['query'][_0x4943('0x49')]){_0x4ac894['where']=_[_0x4943('0x4a')](_0x4ac894[_0x4943('0x48')],{'$or':_[_0x4943('0x39')](_0x5876f6,function(_0x3235b6){if(_0x3235b6['type']!=='VIRTUAL'){var _0x4021b0={};_0x4021b0[_0x3235b6['name']]={'$like':'%'+_0x4d63b3['query'][_0x4943('0x49')]+'%'};return _0x4021b0;}})});}_0x4ac894=_[_0x4943('0x4a')]({},_0x4ac894,_0x4d63b3[_0x4943('0x4b')]);var _0x4586c6={'where':_0x4ac894[_0x4943('0x48')]};return db[_0x4943('0x4c')][_0x4943('0x28')](_0x4586c6)['then'](function(_0x207fcb){_0x2c7647[_0x4943('0x28')]=_0x207fcb;if(_0x4d63b3['query'][_0x4943('0x4d')]){_0x4ac894[_0x4943('0x4e')]=[{'all':!![]}];}return db[_0x4943('0x4c')]['findAll'](_0x4ac894);})[_0x4943('0x31')](function(_0x31aa3c){_0x2c7647['rows']=_0x31aa3c;return _0x2c7647;})[_0x4943('0x31')](respondWithFilteredResult(_0x51cd0f,_0x4ac894))[_0x4943('0x4f')](handleError(_0x51cd0f,null));};exports['show']=function(_0x445908,_0x346a6d){var _0x289af4={'raw':![],'where':{'id':_0x445908[_0x4943('0x50')]['id']}},_0x52f4a6={};_0x52f4a6['model']=_['keys'](db[_0x4943('0x4c')][_0x4943('0x3a')]);_0x52f4a6[_0x4943('0x3f')]=_['keys'](_0x445908['query']);_0x52f4a6['filters']=_[_0x4943('0x42')](_0x52f4a6['model'],_0x52f4a6['query']);_0x289af4[_0x4943('0x43')]=_['intersection'](_0x52f4a6['model'],qs['fields'](_0x445908[_0x4943('0x3f')][_0x4943('0x44')]));_0x289af4[_0x4943('0x43')]=_0x289af4['attributes'][_0x4943('0x45')]?_0x289af4[_0x4943('0x43')]:_0x52f4a6[_0x4943('0x3e')];if(_0x445908['query'][_0x4943('0x4d')]){_0x289af4[_0x4943('0x4e')]=[{'all':!![]}];}_0x289af4=_['merge']({},_0x289af4,_0x445908['options']);return db['Trunk']['find'](_0x289af4)[_0x4943('0x31')](handleEntityNotFound(_0x346a6d,null))[_0x4943('0x31')](respondWithResult(_0x346a6d,null))[_0x4943('0x4f')](handleError(_0x346a6d,null));};exports[_0x4943('0x51')]=function(_0x490a65,_0x10f06b){var _0x558de8={'where':{'id':_0x490a65[_0x4943('0x50')]['id']}},_0x574e4b={};_0x574e4b[_0x4943('0x3e')]=_[_0x4943('0x40')](db['Trunk'][_0x4943('0x3a')]);_0x558de8[_0x4943('0x43')]=_[_0x4943('0x42')](_0x574e4b[_0x4943('0x3e')],qs[_0x4943('0x44')](_0x490a65['query'][_0x4943('0x44')]));_0x558de8[_0x4943('0x43')]=_0x558de8[_0x4943('0x43')][_0x4943('0x45')]?_0x558de8['attributes']:_0x574e4b['model'];if(_0x490a65[_0x4943('0x3f')][_0x4943('0x4d')]){_0x558de8[_0x4943('0x4e')]=[{'all':!![]}];}_0x558de8=_['merge']({},_0x558de8,_0x490a65[_0x4943('0x4b')]);return db[_0x4943('0x4c')][_0x4943('0x52')](_0x558de8)[_0x4943('0x31')](handleEntityNotFound(_0x10f06b,null))[_0x4943('0x31')](function(_0x2b8a57){if(_0x2b8a57){var _0x4c70b9=_0x2b8a57[_0x4943('0x32')]({'plain':!![]});_0x4c70b9=qs[_0x4943('0x53')](_0x4c70b9,['id',_0x4943('0x54'),_0x4943('0x55')]);_0x490a65[_0x4943('0x56')]=_[_0x4943('0x53')](_0x490a65[_0x4943('0x56')],['id',_0x4943('0x54'),_0x4943('0x55')]);return db['Trunk']['create'](_[_0x4943('0x4a')](_0x4c70b9,_0x490a65['body']),{'include':_0x490a65[_0x4943('0x3f')][_0x4943('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x31df2d){var _0x5b958f=_0x490a65['user']['get']({'plain':!![]});if(!_0x5b958f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b958f[_0x4943('0x57')]===_0x4943('0x58')){var _0x421f65=_0x31df2d[_0x4943('0x32')]({'plain':!![]});var _0x2b7583=_0x4943('0x33');return db[_0x4943('0x59')][_0x4943('0x52')]({'where':{'name':_0x2b7583,'userProfileId':_0x5b958f[_0x4943('0x5a')]},'raw':!![]})[_0x4943('0x31')](function(_0x272627){if(_0x272627&&_0x272627[_0x4943('0x5b')]===0x0){return db[_0x4943('0x34')][_0x4943('0x5c')]({'name':_0x421f65[_0x4943('0x36')],'resourceId':_0x421f65['id'],'type':_0x272627[_0x4943('0x36')],'sectionId':_0x272627['id']},{})[_0x4943('0x31')](function(){return _0x31df2d;});}else{return _0x31df2d;}})[_0x4943('0x4f')](function(_0x32ea69){logger['error'](_0x4943('0x5d'),_0x32ea69);throw _0x32ea69;});}return _0x31df2d;});}})[_0x4943('0x31')](respondWithResult(_0x10f06b,0xc9))[_0x4943('0x4f')](handleError(_0x10f06b,null));};exports[_0x4943('0x5c')]=function(_0x1d0f31,_0x3ac03a,_0x53e8cd){var _0x57fc09;return db[_0x4943('0x4c')][_0x4943('0x5c')](_0x1d0f31[_0x4943('0x56')],{'raw':!![]})[_0x4943('0x31')](function(_0x2b2ae9){_0x57fc09=_0x2b2ae9;return db[_0x4943('0x4c')]['findAll']({'raw':!![]});})[_0x4943('0x31')](function(_0x21ebf4){var _0x48cea8=fs[_0x4943('0x5e')](path[_0x4943('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x4943('0x60'));var _0x1681d1=fs['readFileSync'](path[_0x4943('0x5f')](config['root'],_0x4943('0x61')),_0x4943('0x60'));var _0x403ba7=ejs[_0x4943('0x62')](_0x48cea8,{'trunks':_0x21ebf4||[]});fs[_0x4943('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x403ba7);if(_0x57fc09[_0x4943('0x64')]){var _0xf109bf=ejs[_0x4943('0x62')](_0x1681d1,{'trunks':_0x21ebf4||[]});fs[_0x4943('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0xf109bf);}})[_0x4943('0x31')](function(){return respondWithRpcPromise(_0x4943('0x65'),'create',{'module':_0x4943('0x66')});})[_0x4943('0x31')](function(){var _0x55822d=_0x1d0f31[_0x4943('0x58')][_0x4943('0x32')]({'plain':!![]});if(!_0x55822d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55822d['role']==='user'){var _0x588ef6=_0x57fc09[_0x4943('0x32')]({'plain':!![]});return db[_0x4943('0x59')][_0x4943('0x52')]({'where':{'name':'Trunks','userProfileId':_0x55822d[_0x4943('0x5a')]},'raw':!![]})['then'](function(_0x106240){if(_0x106240&&_0x106240[_0x4943('0x5b')]===0x0){return db[_0x4943('0x34')]['create']({'name':_0x588ef6['name'],'resourceId':_0x588ef6['id'],'type':_0x106240['name'],'sectionId':_0x106240['id']},{})[_0x4943('0x31')](function(){return _0x57fc09;});}else{return _0x57fc09;}})[_0x4943('0x4f')](function(_0x4e424a){logger[_0x4943('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e424a);throw _0x4e424a;});}return _0x57fc09;})[_0x4943('0x31')](respondWithResult(_0x3ac03a,0xc9))[_0x4943('0x4f')](handleError(_0x3ac03a,null));};exports[_0x4943('0x2f')]=function(_0x55ffa7,_0x2e15ae,_0x15eaeb){var _0x208687;return db[_0x4943('0x4c')]['find']({'where':{'id':_0x55ffa7['params']['id']}})['then'](handleEntityNotFound(_0x2e15ae,null))['then'](saveUpdates(_0x55ffa7[_0x4943('0x56')],null))[_0x4943('0x31')](function(_0x888a9a){if(_0x888a9a){_0x208687=_0x888a9a;return db['Trunk'][_0x4943('0x67')]({'raw':!![]});}})['then'](function(_0x271844){if(_0x271844){var _0x180a85=fs[_0x4943('0x5e')](path[_0x4943('0x5f')](config[_0x4943('0x68')],_0x4943('0x69')),_0x4943('0x60'));var _0x5281a3=fs[_0x4943('0x5e')](path[_0x4943('0x5f')](config[_0x4943('0x68')],_0x4943('0x61')),_0x4943('0x60'));var _0x2846ad=ejs[_0x4943('0x62')](_0x180a85,{'trunks':_0x271844||[]});fs[_0x4943('0x63')](_0x4943('0x6a'),_0x2846ad);var _0x52d96e=ejs['render'](_0x5281a3,{'trunks':_0x271844||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x52d96e);return respondWithRpcPromise(_0x4943('0x65'),'update',{'module':'chan_sip.so'});}return null;})['then'](function(_0x47ce2a){if(_0x47ce2a){return _0x208687;}})['then'](respondWithResult(_0x2e15ae,null))[_0x4943('0x4f')](handleError(_0x2e15ae,null));};exports[_0x4943('0x30')]=function(_0x27a1b8,_0x4ae248,_0x1eaf2f){var _0x2f2580;return db[_0x4943('0x4c')][_0x4943('0x52')]({'where':{'id':_0x27a1b8['params']['id']}})[_0x4943('0x31')](handleEntityNotFound(_0x4ae248,null))[_0x4943('0x31')](removeEntity(_0x4ae248,null))[_0x4943('0x31')](function(){return db['Trunk'][_0x4943('0x67')]({'raw':!![]});})[_0x4943('0x31')](function(_0x46000f){var _0xd23b93=fs[_0x4943('0x5e')](path[_0x4943('0x5f')](config[_0x4943('0x68')],_0x4943('0x69')),'utf8');var _0x6d85f4=fs[_0x4943('0x5e')](path['join'](config[_0x4943('0x68')],'server/files/templates/registry.ejs'),'utf8');var _0x5117d3=ejs[_0x4943('0x62')](_0xd23b93,{'trunks':_0x46000f});var _0x5d6e4d=ejs[_0x4943('0x62')](_0x6d85f4,{'trunks':_0x46000f});fs[_0x4943('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5117d3);fs[_0x4943('0x63')](_0x4943('0x6b'),_0x5d6e4d);return respondWithRpcPromise(_0x4943('0x65'),_0x4943('0x30'),{'module':_0x4943('0x66')});})[_0x4943('0x4f')](handleError(_0x4ae248,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b2507fb..cf61e50 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 _0x0a3d=['rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x213dcf,_0xe4d1ca){var _0x35c1c1=function(_0x389305){while(--_0x389305){_0x213dcf['push'](_0x213dcf['shift']());}};_0x35c1c1(++_0xe4d1ca);}(_0x0a3d,0xe3));var _0xd0a3=function(_0x93de14,_0x3b5298){_0x93de14=_0x93de14-0x0;var _0x3c613b=_0x0a3d[_0x93de14];return _0x3c613b;};'use strict';var _=require(_0xd0a3('0x0'));var util=require(_0xd0a3('0x1'));var logger=require(_0xd0a3('0x2'))(_0xd0a3('0x3'));var moment=require('moment');var BPromise=require(_0xd0a3('0x4'));var rp=require(_0xd0a3('0x5'));var fs=require('fs');var path=require(_0xd0a3('0x6'));var rimraf=require(_0xd0a3('0x7'));var config=require(_0xd0a3('0x8'));var attributes=require(_0xd0a3('0x9'));module['exports']=function(_0x2a5dc3,_0x2abcf8){return _0x2a5dc3[_0xd0a3('0xa')](_0xd0a3('0xb'),attributes,{'tableName':_0xd0a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65f1=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x8355ea,_0x5bb62e){var _0x51d1f4=function(_0x245419){while(--_0x245419){_0x8355ea['push'](_0x8355ea['shift']());}};_0x51d1f4(++_0x5bb62e);}(_0x65f1,0xde));var _0x165f=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x65f1[_0x540133];return _0x26b6e9;};'use strict';var _=require(_0x165f('0x0'));var util=require(_0x165f('0x1'));var logger=require(_0x165f('0x2'))(_0x165f('0x3'));var moment=require(_0x165f('0x4'));var BPromise=require(_0x165f('0x5'));var rp=require(_0x165f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x165f('0x7'));var config=require(_0x165f('0x8'));var attributes=require(_0x165f('0x9'));module[_0x165f('0xa')]=function(_0x3b3fdb,_0x174c7c){return _0x3b3fdb[_0x165f('0xb')](_0x165f('0xc'),attributes,{'tableName':_0x165f('0xd'),'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 b273703..c4a512f 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 _0xb7e7=['request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map','model','ShowTrunk','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0xeee00e,_0x33de55){var _0x1c12af=function(_0x132aa1){while(--_0x132aa1){_0xeee00e['push'](_0xeee00e['shift']());}};_0x1c12af(++_0x33de55);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xb7e7[_0x9aada2];return _0x196dff;};'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')]('Trunk,\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']('GetTrunk',_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['Trunk'][_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')]('ShowTrunk',_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 _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(_0x5f5946,_0x244557){var _0x48a655=function(_0x38853a){while(--_0x38853a){_0x5f5946['push'](_0x5f5946['shift']());}};_0x48a655(++_0x244557);}(_0x757a,0xde));var _0xa757=function(_0x5d3517,_0x23480c){_0x5d3517=_0x5d3517-0x0;var _0x4d40ea=_0x757a[_0x5d3517];return _0x4d40ea;};'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 a965176..4c81740 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 _0xa21c=['getAvatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','post','bulkCreate','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','/:id/password','changePassword','delete','removeTeams','destroy','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','/:id/mail_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','/whoami','whoami','show','/:id/avatar'];(function(_0x1f73c3,_0xa8af11){var _0x20450e=function(_0x2f30fb){while(--_0x2f30fb){_0x1f73c3['push'](_0x1f73c3['shift']());}};_0x20450e(++_0xa8af11);}(_0xa21c,0xd2));var _0xca21=function(_0x5ba853,_0x14af4c){_0x5ba853=_0x5ba853-0x0;var _0x22d3b5=_0xa21c[_0x5ba853];return _0x22d3b5;};'use strict';var multer=require('multer');var util=require(_0xca21('0x0'));var path=require(_0xca21('0x1'));var timeout=require(_0xca21('0x2'));var express=require(_0xca21('0x3'));var router=express['Router']();var auth=require(_0xca21('0x4'));var interaction=require(_0xca21('0x5'));var config=require(_0xca21('0x6'));var controller=require(_0xca21('0x7'));router['get']('/',auth[_0xca21('0x8')](),controller[_0xca21('0x9')]);router[_0xca21('0xa')](_0xca21('0xb'),auth[_0xca21('0x8')](),controller['describe']);router[_0xca21('0xa')](_0xca21('0xc'),auth['isAuthenticated'](),controller[_0xca21('0xd')]);router[_0xca21('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xca21('0xe')]);router[_0xca21('0xa')](_0xca21('0xf'),controller[_0xca21('0x10')]);router[_0xca21('0xa')](_0xca21('0x11'),auth[_0xca21('0x8')](),controller['getContacts']);router[_0xca21('0xa')](_0xca21('0x12'),auth['isAuthenticated'](),controller[_0xca21('0x13')]);router[_0xca21('0xa')]('/:id/queues_rt',auth[_0xca21('0x8')](),controller[_0xca21('0x14')]);router['get'](_0xca21('0x15'),auth[_0xca21('0x8')](),controller[_0xca21('0x16')]);router[_0xca21('0xa')](_0xca21('0x17'),auth['isAuthenticated'](),controller[_0xca21('0x18')]);router[_0xca21('0xa')](_0xca21('0x19'),auth['isAuthenticated'](),controller['getScreenRecordings']);router['get'](_0xca21('0x1a'),auth[_0xca21('0x8')](),controller[_0xca21('0x1b')]);router[_0xca21('0xa')](_0xca21('0x1c'),auth['isAuthenticated'](),controller[_0xca21('0x1d')]);router[_0xca21('0xa')](_0xca21('0x1e'),auth[_0xca21('0x8')](),controller[_0xca21('0x1f')]);router[_0xca21('0xa')](_0xca21('0x20'),auth[_0xca21('0x8')](),controller['getSmsInteractions']);router['get'](_0xca21('0x21'),auth['isAuthenticated'](),controller[_0xca21('0x22')]);router[_0xca21('0xa')](_0xca21('0x23'),auth['isAuthenticated'](),controller[_0xca21('0x24')]);router['get'](_0xca21('0x25'),auth[_0xca21('0x8')](),controller[_0xca21('0x26')]);router[_0xca21('0xa')]('/:id/lists',auth[_0xca21('0x8')](),controller[_0xca21('0x27')]);router[_0xca21('0xa')](_0xca21('0x28'),auth[_0xca21('0x8')](),controller['getAgents']);router[_0xca21('0xa')](_0xca21('0x29'),auth['isAuthenticated'](),controller[_0xca21('0x2a')]);router['get']('/:id/fax_accounts',auth[_0xca21('0x8')](),controller[_0xca21('0x2b')]);router[_0xca21('0xa')]('/:id/mail_accounts',auth[_0xca21('0x8')](),controller[_0xca21('0x2c')]);router[_0xca21('0xa')](_0xca21('0x2d'),auth[_0xca21('0x8')](),controller[_0xca21('0x2e')]);router[_0xca21('0xa')](_0xca21('0x2f'),auth[_0xca21('0x8')](),controller[_0xca21('0x30')]);router['get'](_0xca21('0x31'),auth['isAuthenticated'](),controller[_0xca21('0x32')]);router[_0xca21('0xa')](_0xca21('0x33'),auth[_0xca21('0x8')](),controller[_0xca21('0x34')]);router['get'](_0xca21('0x35'),auth[_0xca21('0x8')](),controller['getSquareProjects']);router[_0xca21('0xa')](_0xca21('0x36'),auth[_0xca21('0x8')](),controller['getScheduledCalls']);router[_0xca21('0xa')](_0xca21('0x37'),auth[_0xca21('0x8')](),controller['getApiKey']);router[_0xca21('0x38')]('/create_many',auth[_0xca21('0x8')](),controller[_0xca21('0x39')]);router[_0xca21('0x38')](_0xca21('0x11'),auth['isAuthenticated'](),controller[_0xca21('0x3a')]);router[_0xca21('0x38')]('/',auth['isAuthenticated'](),controller[_0xca21('0x3b')]);router[_0xca21('0x38')](_0xca21('0x12'),auth[_0xca21('0x8')](),controller[_0xca21('0x3c')]);var upload=multer({'storage':multer[_0xca21('0x3d')]({'destination':function(_0x32c80f,_0x1b21f2,_0x1c3db9){_0x1c3db9(null,path[_0xca21('0x3e')](config[_0xca21('0x3f')],_0xca21('0x40')));},'filename':function(_0x10c436,_0x3867aa,_0x142469){_0x142469(null,util[_0xca21('0x41')](_0xca21('0x42'),Date[_0xca21('0x43')](),_0x3867aa['originalname']));}})});router[_0xca21('0x38')](_0xca21('0xf'),upload[_0xca21('0x44')]('file'),controller[_0xca21('0x45')]);router[_0xca21('0x38')](_0xca21('0x46'),auth[_0xca21('0x8')](),controller[_0xca21('0x47')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0xca21('0x48')]);router['post'](_0xca21('0x49'),auth[_0xca21('0x8')](),controller[_0xca21('0x4a')]);router['post'](_0xca21('0x4b'),auth[_0xca21('0x8')](),controller[_0xca21('0x4c')]);router[_0xca21('0x38')](_0xca21('0x25'),auth[_0xca21('0x8')](),controller['addTeams']);router[_0xca21('0x38')](_0xca21('0x4d'),auth['isAuthenticated'](),controller[_0xca21('0x4e')]);router['post'](_0xca21('0x4f'),auth[_0xca21('0x8')](),controller[_0xca21('0x50')]);router['post']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xca21('0x51')]);router[_0xca21('0x38')](_0xca21('0x52'),auth['isAuthenticated'](),controller[_0xca21('0x53')]);router[_0xca21('0x38')](_0xca21('0x54'),auth['isAuthenticated'](),controller[_0xca21('0x55')]);router[_0xca21('0x38')](_0xca21('0x56'),auth[_0xca21('0x8')](),controller[_0xca21('0x57')]);router[_0xca21('0x38')](_0xca21('0x58'),auth[_0xca21('0x8')](),controller[_0xca21('0x59')]);router[_0xca21('0x38')]('/:id/mail_accounts',auth[_0xca21('0x8')](),controller['addMailAccounts']);router['post'](_0xca21('0x2d'),auth[_0xca21('0x8')](),controller[_0xca21('0x5a')]);router[_0xca21('0x38')](_0xca21('0x2f'),auth[_0xca21('0x8')](),controller[_0xca21('0x5b')]);router[_0xca21('0x38')]('/:id/chat_websites',auth[_0xca21('0x8')](),controller[_0xca21('0x5c')]);router[_0xca21('0x38')](_0xca21('0x33'),auth[_0xca21('0x8')](),controller[_0xca21('0x5d')]);router[_0xca21('0x38')](_0xca21('0x35'),auth[_0xca21('0x8')](),controller[_0xca21('0x5e')]);router[_0xca21('0x38')](_0xca21('0x37'),auth[_0xca21('0x8')](),controller[_0xca21('0x5f')]);router[_0xca21('0x60')](_0xca21('0x61'),auth[_0xca21('0x8')](),controller['update']);router[_0xca21('0x60')](_0xca21('0x62'),auth[_0xca21('0x8')](),controller[_0xca21('0x63')]);router[_0xca21('0x64')](_0xca21('0x12'),auth[_0xca21('0x8')](),controller['removeQueues']);router[_0xca21('0x64')](_0xca21('0x25'),auth[_0xca21('0x8')](),controller[_0xca21('0x65')]);router['delete'](_0xca21('0x61'),auth[_0xca21('0x8')](),controller[_0xca21('0x66')]);router[_0xca21('0x64')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete'](_0xca21('0x4f'),auth[_0xca21('0x8')](),controller[_0xca21('0x67')]);router[_0xca21('0x64')](_0xca21('0x68'),auth[_0xca21('0x8')](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0xca21('0x8')](),controller[_0xca21('0x69')]);router['delete'](_0xca21('0x54'),auth[_0xca21('0x8')](),controller[_0xca21('0x6a')]);router[_0xca21('0x64')](_0xca21('0x56'),auth[_0xca21('0x8')](),controller['removeWhatsappInteractions']);router['delete'](_0xca21('0x58'),auth[_0xca21('0x8')](),controller[_0xca21('0x6b')]);router[_0xca21('0x64')](_0xca21('0x6c'),auth[_0xca21('0x8')](),controller['removeMailAccounts']);router[_0xca21('0x64')](_0xca21('0x2d'),auth[_0xca21('0x8')](),controller[_0xca21('0x6d')]);router[_0xca21('0x64')](_0xca21('0x2f'),auth[_0xca21('0x8')](),controller[_0xca21('0x6e')]);router[_0xca21('0x64')](_0xca21('0x31'),auth[_0xca21('0x8')](),controller[_0xca21('0x6f')]);router[_0xca21('0x64')](_0xca21('0x33'),auth[_0xca21('0x8')](),controller['removeWhatsappAccounts']);router[_0xca21('0x64')]('/:id/square_projects',auth[_0xca21('0x8')](),controller['removeSquareProjects']);router['delete'](_0xca21('0x37'),auth['isAuthenticated'](),controller[_0xca21('0x70')]);module['exports']=router; \ No newline at end of file +var _0xfa3e=['/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','/:id','show','getAvatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','server/files/images/','format','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addSmsAccounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xfa3e,0x156));var _0xefa3=function(_0x26fae2,_0x145c68){_0x26fae2=_0x26fae2-0x0;var _0x57d487=_0xfa3e[_0x26fae2];return _0x57d487;};'use strict';var multer=require(_0xefa3('0x0'));var util=require(_0xefa3('0x1'));var path=require(_0xefa3('0x2'));var timeout=require('connect-timeout');var express=require(_0xefa3('0x3'));var router=express[_0xefa3('0x4')]();var auth=require(_0xefa3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xefa3('0x6'));var controller=require(_0xefa3('0x7'));router['get']('/',auth[_0xefa3('0x8')](),controller[_0xefa3('0x9')]);router[_0xefa3('0xa')](_0xefa3('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xefa3('0xa')]('/whoami',auth[_0xefa3('0x8')](),controller['whoami']);router[_0xefa3('0xa')](_0xefa3('0xc'),auth[_0xefa3('0x8')](),controller[_0xefa3('0xd')]);router[_0xefa3('0xa')]('/:id/avatar',controller[_0xefa3('0xe')]);router['get'](_0xefa3('0xf'),auth[_0xefa3('0x8')](),controller['getContacts']);router[_0xefa3('0xa')](_0xefa3('0x10'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x11')]);router[_0xefa3('0xa')](_0xefa3('0x12'),auth[_0xefa3('0x8')](),controller['getVoiceQueuesRt']);router[_0xefa3('0xa')](_0xefa3('0x13'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x14')]);router[_0xefa3('0xa')](_0xefa3('0x15'),auth[_0xefa3('0x8')](),controller['getRecordings']);router[_0xefa3('0xa')](_0xefa3('0x16'),auth[_0xefa3('0x8')](),controller['getScreenRecordings']);router[_0xefa3('0xa')](_0xefa3('0x17'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x18')]);router[_0xefa3('0xa')](_0xefa3('0x19'),auth['isAuthenticated'](),controller[_0xefa3('0x1a')]);router[_0xefa3('0xa')](_0xefa3('0x1b'),auth[_0xefa3('0x8')](),controller['getMailInteractions']);router[_0xefa3('0xa')](_0xefa3('0x1c'),auth['isAuthenticated'](),controller[_0xefa3('0x1d')]);router[_0xefa3('0xa')]('/:id/fax/interactions',auth[_0xefa3('0x8')](),controller['getFaxInteractions']);router[_0xefa3('0xa')]('/:id/whatsapp/interactions',auth[_0xefa3('0x8')](),controller[_0xefa3('0x1e')]);router[_0xefa3('0xa')](_0xefa3('0x1f'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x20')]);router[_0xefa3('0xa')](_0xefa3('0x21'),auth[_0xefa3('0x8')](),controller['getLists']);router[_0xefa3('0xa')]('/:id/agents',auth[_0xefa3('0x8')](),controller[_0xefa3('0x22')]);router[_0xefa3('0xa')](_0xefa3('0x23'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xefa3('0xa')]('/:id/fax_accounts',auth[_0xefa3('0x8')](),controller[_0xefa3('0x24')]);router[_0xefa3('0xa')](_0xefa3('0x25'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x26')]);router[_0xefa3('0xa')](_0xefa3('0x27'),auth[_0xefa3('0x8')](),controller['getOpenchannelAccounts']);router[_0xefa3('0xa')](_0xefa3('0x28'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x29')]);router[_0xefa3('0xa')](_0xefa3('0x2a'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xefa3('0xa')](_0xefa3('0x2b'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x2c')]);router['get']('/:id/square_projects',auth[_0xefa3('0x8')](),controller[_0xefa3('0x2d')]);router[_0xefa3('0xa')](_0xefa3('0x2e'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x2f')]);router['get'](_0xefa3('0x30'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x31')]);router[_0xefa3('0x32')](_0xefa3('0x33'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x34')]);router[_0xefa3('0x32')](_0xefa3('0xf'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x35')]);router['post']('/',auth['isAuthenticated'](),controller[_0xefa3('0x36')]);router[_0xefa3('0x32')](_0xefa3('0x10'),auth['isAuthenticated'](),controller[_0xefa3('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f4c01,_0x564909,_0x3a7db7){_0x3a7db7(null,path['join'](config['root'],_0xefa3('0x38')));},'filename':function(_0x22a3d8,_0x5c83c3,_0x1f0223){_0x1f0223(null,util[_0xefa3('0x39')]('%s-%s',Date[_0xefa3('0x3a')](),_0x5c83c3[_0xefa3('0x3b')]));}})});router[_0xefa3('0x32')](_0xefa3('0x3c'),upload[_0xefa3('0x3d')](_0xefa3('0x3e')),controller[_0xefa3('0x3f')]);router[_0xefa3('0x32')](_0xefa3('0x40'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x41')]);router['post'](_0xefa3('0x42'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x43')]);router[_0xefa3('0x32')](_0xefa3('0x44'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x45')]);router[_0xefa3('0x32')](_0xefa3('0x46'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x47')]);router[_0xefa3('0x32')](_0xefa3('0x1f'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x48')]);router[_0xefa3('0x32')](_0xefa3('0x49'),auth[_0xefa3('0x8')](),controller['addChatInteractions']);router[_0xefa3('0x32')](_0xefa3('0x4a'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x4b')]);router[_0xefa3('0x32')](_0xefa3('0x4c'),auth[_0xefa3('0x8')](),controller['addFaxInteractions']);router[_0xefa3('0x32')](_0xefa3('0x4d'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xefa3('0x32')](_0xefa3('0x4e'),auth[_0xefa3('0x8')](),controller['addOpenchannelInteractions']);router[_0xefa3('0x32')]('/:id/whatsapp_interactions',auth[_0xefa3('0x8')](),controller[_0xefa3('0x4f')]);router[_0xefa3('0x32')](_0xefa3('0x50'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x51')]);router['post'](_0xefa3('0x25'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x52')]);router[_0xefa3('0x32')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xefa3('0x32')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xefa3('0x53')]);router['post'](_0xefa3('0x2a'),auth[_0xefa3('0x8')](),controller['addChatWebsites']);router[_0xefa3('0x32')](_0xefa3('0x2b'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x54')]);router[_0xefa3('0x32')](_0xefa3('0x55'),auth['isAuthenticated'](),controller[_0xefa3('0x56')]);router[_0xefa3('0x32')](_0xefa3('0x30'),auth['isAuthenticated'](),controller[_0xefa3('0x57')]);router[_0xefa3('0x58')](_0xefa3('0xc'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x59')]);router[_0xefa3('0x58')](_0xefa3('0x5a'),auth[_0xefa3('0x8')](),controller['changePassword']);router[_0xefa3('0x5b')]('/:id/queues',auth['isAuthenticated'](),controller[_0xefa3('0x5c')]);router[_0xefa3('0x5b')](_0xefa3('0x1f'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x5d')]);router[_0xefa3('0x5b')](_0xefa3('0xc'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x5e')]);router[_0xefa3('0x5b')]('/:id/chat_interactions',auth[_0xefa3('0x8')](),controller[_0xefa3('0x5f')]);router[_0xefa3('0x5b')](_0xefa3('0x4a'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x60')]);router[_0xefa3('0x5b')](_0xefa3('0x4c'),auth['isAuthenticated'](),controller[_0xefa3('0x61')]);router[_0xefa3('0x5b')](_0xefa3('0x4d'),auth[_0xefa3('0x8')](),controller['removeSmsInteractions']);router[_0xefa3('0x5b')](_0xefa3('0x4e'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x62')]);router[_0xefa3('0x5b')]('/:id/whatsapp_interactions',auth[_0xefa3('0x8')](),controller[_0xefa3('0x63')]);router['delete'](_0xefa3('0x50'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x64')]);router[_0xefa3('0x5b')]('/:id/mail_accounts',auth[_0xefa3('0x8')](),controller[_0xefa3('0x65')]);router[_0xefa3('0x5b')](_0xefa3('0x27'),auth[_0xefa3('0x8')](),controller[_0xefa3('0x66')]);router[_0xefa3('0x5b')](_0xefa3('0x28'),auth['isAuthenticated'](),controller[_0xefa3('0x67')]);router[_0xefa3('0x5b')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xefa3('0x68')]);router['delete'](_0xefa3('0x2b'),auth[_0xefa3('0x8')](),controller['removeWhatsappAccounts']);router[_0xefa3('0x5b')](_0xefa3('0x55'),auth['isAuthenticated'](),controller[_0xefa3('0x69')]);router['delete'](_0xefa3('0x30'),auth['isAuthenticated'](),controller[_0xefa3('0x6a')]);module[_0xefa3('0x6b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 3879b88..5ae1f90 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 _0x1575=['fingerprint','certificate','active','passive','actpass','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','user','agent','local','INTEGER','fullname','BOOLEAN','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas'];(function(_0x692463,_0x2c1ebc){var _0x14dbc2=function(_0x2c2b53){while(--_0x2c2b53){_0x692463['push'](_0x692463['shift']());}};_0x14dbc2(++_0x2c1ebc);}(_0x1575,0x186));var _0x5157=function(_0x5eb7c4,_0xa4a571){_0x5eb7c4=_0x5eb7c4-0x0;var _0x55df44=_0x1575[_0x5eb7c4];return _0x55df44;};'use strict';var Sequelize=require(_0x5157('0x0'));var moment=require(_0x5157('0x1'));var util=require(_0x5157('0x2'));var _=require(_0x5157('0x3'));module[_0x5157('0x4')]={'name':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'unique':_0x5157('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x24f13a){this[_0x5157('0x7')](_0x5157('0x6'),_0x24f13a);this[_0x5157('0x7')](_0x5157('0x8'),_0x24f13a);},'comment':_0x5157('0x9')},'fullname':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'set':function(_0x545391){this[_0x5157('0x7')]('fullname',_0x545391);this[_0x5157('0x7')](_0x5157('0xa'),util[_0x5157('0xb')](_0x5157('0xc'),_0x545391,this[_0x5157('0xd')](_0x5157('0xe'))));}},'alias':{'type':Sequelize[_0x5157('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5157('0xf'),'validate':{'isEmail':!![]},'set':function(_0x14369e){if(_0x14369e){this[_0x5157('0x7')](_0x5157('0xf'),_0x14369e['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x5157('0x10'),_0x5157('0x11'),_0x5157('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5157('0x5')],'defaultValue':_0x5157('0x13')},'internal':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2df8b9){this[_0x5157('0x7')](_0x5157('0xe'),_0x2df8b9);this['setDataValue']('accountcode',_0x2df8b9);this[_0x5157('0x7')](_0x5157('0xa'),util[_0x5157('0xb')](_0x5157('0xc'),this[_0x5157('0xd')](_0x5157('0x15')),_0x2df8b9));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5157('0x5')]},'mobile':{'type':Sequelize[_0x5157('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x5157('0x5')]},'userpic':{'type':Sequelize[_0x5157('0x5')]},'city':{'type':Sequelize[_0x5157('0x5')]},'country':{'type':Sequelize[_0x5157('0x5')]},'online':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5157('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5157('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5157('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x17')},'ipaddr':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x5157('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x19'),_0x5157('0x11'),_0x5157('0x1a')),'allowNull':!![],'defaultValue':_0x5157('0x19')},'context':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x1b')},'callingpres':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x1c'),'ALLOWED_PASSED_SCREEN',_0x5157('0x1d'),_0x5157('0x1e'),_0x5157('0x1f'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x20'),'set':function(_0x4d59d7){this[_0x5157('0x7')](_0x5157('0x21'),_0x4d59d7?_0x4d59d7['join'](','):null);},'get':function(){return this['getDataValue'](_0x5157('0x21'))?this[_0x5157('0xd')]('transport')[_0x5157('0x22')](','):null;},'comment':_0x5157('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x5157('0x24'),_0x5157('0x25'),_0x5157('0x26'),_0x5157('0x27'),_0x5157('0x28')),'allowNull':!![],'defaultValue':_0x5157('0x24')},'directmedia':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no',_0x5157('0x2a'),_0x5157('0x2b'),_0x5157('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x2d'),'set':function(_0x4faf7d){this[_0x5157('0x7')](_0x5157('0x2e'),_0x4faf7d?_0x4faf7d[_0x5157('0x2f')](','):null);},'get':function(){return this[_0x5157('0xd')](_0x5157('0x2e'))?this[_0x5157('0xd')](_0x5157('0x2e'))[_0x5157('0x22')](','):null;},'comment':_0x5157('0x30')},'callgroup':{'type':Sequelize[_0x5157('0x5')]},'namedcallgroup':{'type':Sequelize[_0x5157('0x5')]},'pickupgroup':{'type':Sequelize[_0x5157('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x5157('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x5157('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x6a987d){this[_0x5157('0x7')](_0x5157('0x31'),_0x6a987d?_0x6a987d[_0x5157('0x2f')](';'):_0x5157('0x32'));},'get':function(){return this['getDataValue']('allow')?this[_0x5157('0xd')](_0x5157('0x31'))[_0x5157('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'set':function(_0x143488){this[_0x5157('0x7')](_0x5157('0x33'),_0x143488?_0x143488[_0x5157('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0x5157('0x33'))?this[_0x5157('0xd')](_0x5157('0x33'))[_0x5157('0x22')](','):null;},'comment':_0x5157('0x34')},'trustrpid':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no',_0x5157('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![],'defaultValue':_0x5157('0x36')},'amaflags':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':_0x5157('0x29')},'busylevel':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no',_0x5157('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x38'),'refuse',_0x5157('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x5157('0x3a'),_0x5157('0x3b')),'allowNull':!![],'defaultValue':_0x5157('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':_0x5157('0x29')},'keepalive':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x5157('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no',_0x5157('0x3c'),_0x5157('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5157('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x3e'),_0x5157('0x3f'),_0x5157('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5157('0x18')](_0x5157('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no',_0x5157('0x2a'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x5157('0x41')]},'showWebBar':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0,'set':function(_0x4e98a8){this[_0x5157('0x7')](_0x5157('0x42'),_0x4e98a8);var _0x4a7429=this[_0x5157('0x43')]({'plain':!![]});switch(_0x4e98a8){case 0x0:case 0x1:var _0x41f02a=_0x4a7429[_0x5157('0x21')]?_[_0x5157('0x44')](_0x4a7429[_0x5157('0x21')])?_0x4a7429[_0x5157('0x21')][_0x5157('0x2f')]():_0x4a7429[_0x5157('0x21')]:_0x5157('0x20');if(_0x41f02a===_0x5157('0x45')){_0x41f02a=_0x5157('0x20');}this[_0x5157('0x7')](_0x5157('0x21'),_0x41f02a);this['setDataValue'](_0x5157('0x46'),'no');this[_0x5157('0x7')]('avpf',null);this[_0x5157('0x7')](_0x5157('0x47'),null);this['setDataValue'](_0x5157('0x48'),null);this[_0x5157('0x7')](_0x5157('0x49'),null);this['setDataValue'](_0x5157('0x4a'),null);this[_0x5157('0x7')]('dtlssetup',null);this[_0x5157('0x7')](_0x5157('0x4b'),null);this[_0x5157('0x7')](_0x5157('0x4c'),null);this[_0x5157('0x7')](_0x5157('0x4d'),'no');break;case 0x2:this[_0x5157('0x7')](_0x5157('0x21'),'wss');this[_0x5157('0x7')](_0x5157('0x46'),'yes');this[_0x5157('0x7')]('avpf',_0x5157('0x29'));this['setDataValue'](_0x5157('0x47'),_0x5157('0x29'));this['setDataValue'](_0x5157('0x48'),_0x5157('0x29'));this[_0x5157('0x7')]('dtlsenable',_0x5157('0x29'));this[_0x5157('0x7')](_0x5157('0x4a'),'no');this[_0x5157('0x7')]('dtlssetup',_0x5157('0x40'));this[_0x5157('0x7')]('dtlscertfile',_0x4a7429[_0x5157('0x4b')]||_0x5157('0x4e'));this[_0x5157('0x7')]('dtlsprivatekey',_0x4a7429['dtlsprivatekey']||_0x5157('0x4f'));this[_0x5157('0x7')](_0x5157('0x4d'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x866345){this[_0x5157('0x7')]('permissions',_0x866345?_0x866345[_0x5157('0x2f')](','):[]);},'get':function(){return this['getDataValue'](_0x5157('0x50'))?_[_0x5157('0x51')](this[_0x5157('0xd')]('permissions')['split'](','),function(_0x5c9dee){return parseInt(_0x5c9dee,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5157('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x5157('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5157('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5157('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x5157('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5157('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x5157('0x5')]},'passwordResetAt':{'type':Sequelize[_0x5157('0x41')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5157('0x52')],'get':function(){return this[_0x5157('0xd')](_0x5157('0x53'))?this[_0x5157('0xd')](_0x5157('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5157('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x30fe85){if(typeof _0x30fe85===_0x5157('0x54')){var _0x3da7f0=_0x30fe85==='1'?!![]:_0x30fe85==='0'?![]:_0x30fe85===_0x5157('0x55')?!![]:_0x30fe85===_0x5157('0x56')?![]:![];this[_0x5157('0x7')](_0x5157('0x57'),_0x3da7f0);}else{this[_0x5157('0x7')](_0x5157('0x57'),_0x30fe85);}}},'blocked':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![],'set':function(_0x3e735f){this[_0x5157('0x7')](_0x5157('0x58'),_0x3e735f);if(_0x3e735f===!![]){this['setDataValue']('blockedAt',moment());this[_0x5157('0x7')]('loginAttempts',0x0);}else{this[_0x5157('0x7')](_0x5157('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x5157('0x41')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5157('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5157('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x50b4=['avpf','force_avp','dtlssetup','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','admin','user','agent','telephone','INTEGER','accountcode','BOOLEAN','DATE','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','transport','join','split','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','active','passive','actpass','update,nonat','showWebBar','get','isArray','encryption','icesupport','dtlsenable','dtlscertfile','rtcp_mux','wss'];(function(_0x70ef92,_0x402685){var _0x54b65b=function(_0x26c96b){while(--_0x26c96b){_0x70ef92['push'](_0x70ef92['shift']());}};_0x54b65b(++_0x402685);}(_0x50b4,0x1b3));var _0x450b=function(_0xa6050a,_0x368a6b){_0xa6050a=_0xa6050a-0x0;var _0x542b24=_0x50b4[_0xa6050a];return _0x542b24;};'use strict';var Sequelize=require(_0x450b('0x0'));var moment=require(_0x450b('0x1'));var util=require(_0x450b('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x450b('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2deac3){this[_0x450b('0x4')]('name',_0x2deac3);this[_0x450b('0x4')](_0x450b('0x5'),_0x2deac3);},'comment':_0x450b('0x6')},'fullname':{'type':Sequelize[_0x450b('0x3')],'allowNull':![],'set':function(_0x4ac7b8){this['setDataValue'](_0x450b('0x7'),_0x4ac7b8);this[_0x450b('0x4')](_0x450b('0x8'),util[_0x450b('0x9')](_0x450b('0xa'),_0x4ac7b8,this[_0x450b('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x450b('0x3')]},'email':{'type':Sequelize[_0x450b('0x3')],'allowNull':![],'unique':_0x450b('0xc'),'validate':{'isEmail':!![]},'set':function(_0x4aaa8b){if(_0x4aaa8b){this['setDataValue']('email',_0x4aaa8b['toLowerCase']());}}},'role':{'type':Sequelize[_0x450b('0xd')](_0x450b('0xe'),_0x450b('0xf'),_0x450b('0x10'),_0x450b('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x450b('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x450b('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x1b9a8a){this[_0x450b('0x4')]('internal',_0x1b9a8a);this[_0x450b('0x4')](_0x450b('0x13'),_0x1b9a8a);this[_0x450b('0x4')](_0x450b('0x8'),util[_0x450b('0x9')](_0x450b('0xa'),this['getDataValue'](_0x450b('0x7')),_0x1b9a8a));}},'salt':{'type':Sequelize[_0x450b('0x3')]},'phone':{'type':Sequelize[_0x450b('0x3')]},'mobile':{'type':Sequelize[_0x450b('0x3')]},'address':{'type':Sequelize[_0x450b('0x3')]},'zipcode':{'type':Sequelize[_0x450b('0x3')]},'userpic':{'type':Sequelize[_0x450b('0x3')]},'city':{'type':Sequelize[_0x450b('0x3')]},'country':{'type':Sequelize[_0x450b('0x3')]},'online':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x450b('0x15')]},'voicePause':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x450b('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x450b('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x450b('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x450b('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x450b('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x450b('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x450b('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x450b('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x450b('0xd')]('friend','user',_0x450b('0x16')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![],'defaultValue':_0x450b('0x17')},'callingpres':{'type':Sequelize[_0x450b('0xd')]('ALLOWED_NOT_SCREENED',_0x450b('0x18'),_0x450b('0x19'),_0x450b('0x1a'),_0x450b('0x1b'),_0x450b('0x1c'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![],'defaultValue':_0x450b('0x1d'),'set':function(_0xba9983){this[_0x450b('0x4')](_0x450b('0x1e'),_0xba9983?_0xba9983[_0x450b('0x1f')](','):null);},'get':function(){return this[_0x450b('0xb')](_0x450b('0x1e'))?this[_0x450b('0xb')]('transport')[_0x450b('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x21'),_0x450b('0x22'),_0x450b('0x23'),_0x450b('0x24'),'auto'),'allowNull':!![],'defaultValue':_0x450b('0x21')},'directmedia':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no',_0x450b('0x26'),_0x450b('0x27'),_0x450b('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x44ba21){this[_0x450b('0x4')](_0x450b('0x29'),_0x44ba21?_0x44ba21[_0x450b('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0x450b('0x29'))?this[_0x450b('0xb')](_0x450b('0x29'))[_0x450b('0x20')](','):null;},'comment':_0x450b('0x2a')},'callgroup':{'type':Sequelize[_0x450b('0x3')]},'namedcallgroup':{'type':Sequelize[_0x450b('0x3')]},'pickupgroup':{'type':Sequelize[_0x450b('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x450b('0x3')]},'language':{'type':Sequelize[_0x450b('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x450b('0x3')]},'disallow':{'type':Sequelize[_0x450b('0x3')],'allowNull':![],'defaultValue':_0x450b('0x2b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x450b('0x2c'),'set':function(_0x55fa38){this[_0x450b('0x4')](_0x450b('0x2d'),_0x55fa38?_0x55fa38[_0x450b('0x1f')](';'):_0x450b('0x2c'));},'get':function(){return this[_0x450b('0xb')](_0x450b('0x2d'))?this[_0x450b('0xb')](_0x450b('0x2d'))[_0x450b('0x20')](';'):null;},'comment':_0x450b('0x2e')},'autoframing':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x23dd6e){this[_0x450b('0x4')](_0x450b('0x2f'),_0x23dd6e?_0x23dd6e[_0x450b('0x1f')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')['split'](','):null;},'comment':_0x450b('0x30')},'trustrpid':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no',_0x450b('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x450b('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x450b('0x32')},'amaflags':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x450b('0x25'),'no'),'allowNull':!![],'defaultValue':_0x450b('0x25')},'busylevel':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x450b('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x450b('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x450b('0x25'),'no',_0x450b('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x450b('0xd')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x34'),_0x450b('0x35'),_0x450b('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x450b('0xd')]('uac','uas'),'allowNull':!![],'defaultValue':_0x450b('0x37')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![],'defaultValue':_0x450b('0x25')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x450b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x450b('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x450b('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x450b('0xd')]('yes','no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x38'),_0x450b('0x39'),_0x450b('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x450b('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x450b('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no',_0x450b('0x26'),'update',_0x450b('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x450b('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x450b('0x15')]},'showWebBar':{'type':Sequelize[_0x450b('0x12')],'defaultValue':0x0,'set':function(_0x293c5a){this[_0x450b('0x4')](_0x450b('0x3c'),_0x293c5a);var _0x3e94ab=this[_0x450b('0x3d')]({'plain':!![]});switch(_0x293c5a){case 0x0:case 0x1:var _0x4fff7e=_0x3e94ab[_0x450b('0x1e')]?_[_0x450b('0x3e')](_0x3e94ab[_0x450b('0x1e')])?_0x3e94ab[_0x450b('0x1e')][_0x450b('0x1f')]():_0x3e94ab[_0x450b('0x1e')]:_0x450b('0x1d');if(_0x4fff7e==='wss'){_0x4fff7e=_0x450b('0x1d');}this[_0x450b('0x4')]('transport',_0x4fff7e);this[_0x450b('0x4')](_0x450b('0x3f'),'no');this[_0x450b('0x4')]('avpf',null);this[_0x450b('0x4')]('force_avp',null);this[_0x450b('0x4')](_0x450b('0x40'),null);this[_0x450b('0x4')](_0x450b('0x41'),null);this['setDataValue']('dtlsverify',null);this[_0x450b('0x4')]('dtlssetup',null);this[_0x450b('0x4')](_0x450b('0x42'),null);this[_0x450b('0x4')]('dtlsprivatekey',null);this[_0x450b('0x4')](_0x450b('0x43'),'no');break;case 0x2:this['setDataValue']('transport',_0x450b('0x44'));this[_0x450b('0x4')](_0x450b('0x3f'),_0x450b('0x25'));this['setDataValue'](_0x450b('0x45'),'yes');this[_0x450b('0x4')](_0x450b('0x46'),'yes');this['setDataValue']('icesupport','yes');this[_0x450b('0x4')](_0x450b('0x41'),_0x450b('0x25'));this[_0x450b('0x4')]('dtlsverify','no');this['setDataValue'](_0x450b('0x47'),_0x450b('0x3a'));this[_0x450b('0x4')](_0x450b('0x42'),_0x3e94ab[_0x450b('0x42')]||_0x450b('0x48'));this[_0x450b('0x4')]('dtlsprivatekey',_0x3e94ab[_0x450b('0x49')]||_0x450b('0x4a'));this[_0x450b('0x4')]('rtcp_mux',_0x450b('0x25'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x127fb2){this[_0x450b('0x4')](_0x450b('0x4b'),_0x127fb2?_0x127fb2['join'](','):[]);},'get':function(){return this[_0x450b('0xb')](_0x450b('0x4b'))?_[_0x450b('0x4c')](this[_0x450b('0xb')](_0x450b('0x4b'))[_0x450b('0x20')](','),function(_0x3a58dc){return parseInt(_0x3a58dc,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x450b('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x450b('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x450b('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x450b('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x450b('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x450b('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x450b('0xd')](_0x450b('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x450b('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x450b('0x3')]},'passwordResetAt':{'type':Sequelize[_0x450b('0x15')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x450b('0x4d')],'get':function(){return this[_0x450b('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x450b('0xb')](_0x450b('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x450b('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x450b('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![],'set':function(_0x11c4c0){if(typeof _0x11c4c0==='string'){var _0x9b584b=_0x11c4c0==='1'?!![]:_0x11c4c0==='0'?![]:_0x11c4c0===_0x450b('0x4f')?!![]:_0x11c4c0==='false'?![]:![];this[_0x450b('0x4')](_0x450b('0x50'),_0x9b584b);}else{this['setDataValue']('screenrecording',_0x11c4c0);}}},'blocked':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![],'set':function(_0xbf68fa){this[_0x450b('0x4')](_0x450b('0x51'),_0xbf68fa);if(_0xbf68fa===!![]){this[_0x450b('0x4')](_0x450b('0x52'),moment());this[_0x450b('0x4')](_0x450b('0x53'),0x0);}else{this[_0x450b('0x4')](_0x450b('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0x450b('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x450b('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x450b('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 10de0d2..e542a43 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 _0x3377=['$eq','$not','$between','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./user.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','Users','user','Agents','telephone','ignore','value','role','find','name','UserProfileResource','stack','map','rawAttributes','fieldName','type','key','model','password','salt','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','sequelize','lower','col','options','User','findAll','differenceBy','keys','includeAll','include','bulkCreate','body','describe','params','addContacts','omit','ids','agent','agent\x20role','admin','../../config/license/util','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','internal','Setting','findById','securePassword','min_internal','max','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','104','105','106','107','108','100','111','114','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','oldPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','QueueId','emit','toLowerCase','voice','SIP/%s','removeQueues','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','download','server/files/images/','getContacts','CmContact','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getGroups','getRecordings','VoiceRecording','UserId','rows','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','remoteAddress','socket','connection','getVoiceQueues','push','UserVoiceQueue.penalty','each','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','whatsapppause','lastPauseAt','mail','chat','fax','sms','whatsapp','openchannel','%s%s','Pause','manual','getTeams','Team','addTeams','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','getFaxQueues','flatten','transaction','Voice','getDataValue','removeTeams','Sms','Whatsapp','getOpenchannelQueues','Openchannel','getLists','send','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3377,0x192));var _0x7337=function(_0x9cbd26,_0x3ab640){_0x9cbd26=_0x9cbd26-0x0;var _0x4cdaec=_0x3377[_0x9cbd26];return _0x4cdaec;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7337('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7337('0x1'));var jsonpatch=require(_0x7337('0x2'));var rp=require(_0x7337('0x3'));var moment=require(_0x7337('0x4'));var BPromise=require(_0x7337('0x5'));var Mustache=require(_0x7337('0x6'));var util=require(_0x7337('0x7'));var path=require('path');var sox=require(_0x7337('0x8'));var csv=require(_0x7337('0x9'));var ejs=require(_0x7337('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7337('0xb'));var crypto=require(_0x7337('0xc'));var jsforce=require(_0x7337('0xd'));var deskjs=require(_0x7337('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7337('0xf'));var Papa=require(_0x7337('0x10'));var Redis=require(_0x7337('0x11'));var authService=require(_0x7337('0x12'));var qs=require(_0x7337('0x13'));var as=require(_0x7337('0x14'));var hardwareService=require(_0x7337('0x15'));var logger=require(_0x7337('0x16'))(_0x7337('0x17'));var utils=require(_0x7337('0x18'));var config=require(_0x7337('0x19'));var db=require(_0x7337('0x1a'))['db'];config['redis']=_[_0x7337('0x1b')](config[_0x7337('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x7337('0x1d'))(new Redis(config[_0x7337('0x1c')]));require(_0x7337('0x1e'))[_0x7337('0x1f')](socket);var jayson=require(_0x7337('0x20'));var client=jayson[_0x7337('0x21')][_0x7337('0x22')]({'port':0x232a});function checkPasswordPattern(_0x36a226,_0x567e2a,_0x4ce6fe){if(_0x4ce6fe){var _0x3b3452=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b3452[_0x7337('0x23')](_0x567e2a)){return _0x36a226;}else{throw new db[(_0x7337('0x24'))]['ValidationError'](_0x7337('0x25'));}}else{return _0x36a226;}}function respondWithRpcPromise(_0x482a2a,_0x5a3a60,_0x4f88db,_0x4f2afb){return new BPromise(function(_0x328cdd,_0x2631c0){var _0x2c2891=_0x4f2afb||client;return _0x2c2891[_0x7337('0x26')](_0x482a2a,_0x4f88db)[_0x7337('0x27')](function(_0xf28a6b){logger[_0x7337('0x28')](_0x7337('0x29'),_0x5a3a60,_0x7337('0x2a'));logger[_0x7337('0x2b')](_0x7337('0x2c'),_0x5a3a60,_0x7337('0x2a'),JSON[_0x7337('0x2d')](_0xf28a6b));if(_0xf28a6b[_0x7337('0x2e')]){if(_0xf28a6b[_0x7337('0x2e')][_0x7337('0x2f')]===0x1f4){logger[_0x7337('0x2e')]('User,\x20%s,\x20%s',_0x5a3a60,_0xf28a6b[_0x7337('0x2e')]['message']);return _0x2631c0(_0xf28a6b[_0x7337('0x2e')][_0x7337('0x30')]);}logger[_0x7337('0x2e')](_0x7337('0x29'),_0x5a3a60,_0xf28a6b[_0x7337('0x2e')][_0x7337('0x30')]);return _0x328cdd(_0xf28a6b[_0x7337('0x2e')][_0x7337('0x30')]);}else{logger[_0x7337('0x28')](_0x7337('0x29'),_0x5a3a60,'request\x20sent');_0x328cdd(_0xf28a6b['result'][_0x7337('0x30')]);}})[_0x7337('0x31')](function(_0x240456){logger[_0x7337('0x2e')](_0x7337('0x29'),_0x5a3a60,_0x240456);_0x2631c0(_0x240456);});});}function respondWithStatusCode(_0x3b6a30,_0x3b2e6c){_0x3b2e6c=_0x3b2e6c||0xcc;return function(_0x55247b){if(_0x55247b){return _0x3b6a30[_0x7337('0x32')](_0x3b2e6c);}return _0x3b6a30[_0x7337('0x33')](_0x3b2e6c)[_0x7337('0x34')]();};}function respondWithResult(_0xc34194,_0x3932e6){_0x3932e6=_0x3932e6||0xc8;return function(_0x306b34){if(_0x306b34){return _0xc34194['status'](_0x3932e6)[_0x7337('0x35')](_0x306b34);}};}function respondWithFilteredResult(_0x2a1093,_0x28fc60){return function(_0x477c6d){if(_0x477c6d){var _0x490160=_0x477c6d[_0x7337('0x36')],_0x2187cd=_0x28fc60[_0x7337('0x37')],_0x46fbc3=_0x28fc60[_0x7337('0x37')]+_0x28fc60[_0x7337('0x38')],_0x588976;if(_0x46fbc3>=_0x490160){_0x46fbc3=_0x490160;_0x588976=0xc8;}else{_0x588976=0xce;}_0x2a1093[_0x7337('0x33')](_0x588976);return _0x2a1093['set'](_0x7337('0x39'),_0x2187cd+'-'+_0x46fbc3+'/'+_0x490160)[_0x7337('0x35')](_0x477c6d);}return null;};}function patchUpdates(_0x187026){return function(_0xbdb762){try{jsonpatch[_0x7337('0x3a')](_0xbdb762,_0x187026,!![]);}catch(_0xe85361){return BPromise['reject'](_0xe85361);}return _0xbdb762[_0x7337('0x3b')]();};}function saveUpdates(_0x5e9c21,_0x583eef){return function(_0x207c4f){if(_0x207c4f){return _0x207c4f[_0x7337('0x3c')](_0x5e9c21)[_0x7337('0x27')](function(_0x3c9f31){return _0x3c9f31;});}return null;};}function removeEntity(_0x1f061b,_0x38bacd){return function(_0x70abb6){if(_0x70abb6){return _0x70abb6[_0x7337('0x3d')]()[_0x7337('0x27')](function(){var _0x67d257=_0x70abb6[_0x7337('0x3e')]({'plain':!![]});var _0x5d3f83=[{'name':_0x7337('0x3f'),'value':_0x7337('0x40'),'ignore':!![]},{'name':_0x7337('0x41'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x7337('0x42'),'ignore':![]}];var _0x12cfb8=_(_0x5d3f83)['filter'](_0x7337('0x43'))['map'](_0x7337('0x44'))[_0x7337('0x44')]();if(_['includes'](_0x12cfb8,_0x67d257[_0x7337('0x45')])){return;}var _0x4ebdc7=_[_0x7337('0x46')](_0x5d3f83,[_0x7337('0x44'),_0x67d257[_0x7337('0x45')]])[_0x7337('0x47')];return db[_0x7337('0x48')][_0x7337('0x3d')]({'where':{'type':_0x4ebdc7,'resourceId':_0x67d257['id']}})[_0x7337('0x27')](function(){return _0x70abb6;});})[_0x7337('0x27')](function(){_0x1f061b[_0x7337('0x33')](0xcc)[_0x7337('0x34')]();});}};}function handleEntityNotFound(_0x77008f,_0x5cae20){return function(_0x505937){if(!_0x505937){_0x77008f['sendStatus'](0x194);}return _0x505937;};}function handleError(_0xa3d4c4,_0x141908){_0x141908=_0x141908||0x1f4;return function(_0x3bb4e3){logger[_0x7337('0x2e')](_0x3bb4e3[_0x7337('0x49')]);if(_0x3bb4e3[_0x7337('0x47')]){delete _0x3bb4e3['name'];}_0xa3d4c4[_0x7337('0x33')](_0x141908)['send'](_0x3bb4e3);};}exports['index']=function(_0x463aae,_0x12fd46){var _0x1b36e8={},_0x11f663={},_0x56d973={'count':0x0,'rows':[]};var _0x3a3009=_[_0x7337('0x4a')](db['User'][_0x7337('0x4b')],function(_0x1501b6){return{'name':_0x1501b6[_0x7337('0x4c')],'type':_0x1501b6[_0x7337('0x4d')][_0x7337('0x4e')]};});_0x11f663[_0x7337('0x4f')]=_['differenceBy'](_[_0x7337('0x4a')](_0x3a3009,'name'),[_0x7337('0x50'),_0x7337('0x51')]);_0x11f663[_0x7337('0x52')]=_['keys'](_0x463aae[_0x7337('0x52')]);_0x11f663[_0x7337('0x53')]=_[_0x7337('0x54')](_0x11f663['model'],_0x11f663['query']);_0x1b36e8[_0x7337('0x55')]=_[_0x7337('0x54')](_0x11f663[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x463aae[_0x7337('0x52')][_0x7337('0x56')]));_0x1b36e8[_0x7337('0x55')]=_0x1b36e8[_0x7337('0x55')][_0x7337('0x57')]?_0x1b36e8[_0x7337('0x55')]:_0x11f663[_0x7337('0x4f')];if(!_0x463aae[_0x7337('0x52')][_0x7337('0x58')]('nolimit')){_0x1b36e8[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x463aae[_0x7337('0x52')]['limit']);_0x1b36e8['offset']=qs[_0x7337('0x37')](_0x463aae['query']['offset']);}_0x1b36e8[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x463aae[_0x7337('0x52')][_0x7337('0x5a')]);_0x1b36e8[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x463aae['query'],_0x11f663[_0x7337('0x53')]),_0x3a3009);if(_0x463aae[_0x7337('0x52')][_0x7337('0x5d')]){_0x1b36e8[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x1b36e8['where'],{'$or':_['map'](_0x3a3009,function(_0x34a373){if(_0x34a373[_0x7337('0x4d')]!==_0x7337('0x5f')){return db[_0x7337('0x60')][_0x7337('0x5b')](db[_0x7337('0x60')]['fn'](_0x7337('0x61'),db[_0x7337('0x60')][_0x7337('0x62')](_0x34a373[_0x7337('0x47')])),{'$like':db['sequelize']['fn'](_0x7337('0x61'),'%'+_0x463aae['query'][_0x7337('0x5d')]+'%')});}})});}_0x1b36e8=_[_0x7337('0x5e')]({},_0x1b36e8,_0x463aae[_0x7337('0x63')]);var _0x5d175e={'where':_0x1b36e8[_0x7337('0x5b')]};return db[_0x7337('0x64')]['count'](_0x5d175e)[_0x7337('0x27')](function(_0x35cf4e){_0x56d973[_0x7337('0x36')]=_0x35cf4e;if(_0x463aae[_0x7337('0x52')]['includeAll']){_0x1b36e8['include']=[{'all':!![]}];}return db['User'][_0x7337('0x65')](_0x1b36e8);})[_0x7337('0x27')](function(_0x37a5a8){_0x56d973['rows']=_0x37a5a8;return _0x56d973;})['then'](respondWithFilteredResult(_0x12fd46,_0x1b36e8))[_0x7337('0x31')](handleError(_0x12fd46,null));};exports['show']=function(_0x8b9a03,_0x3d0fcb){var _0x245ce1={'raw':![],'where':{'id':_0x8b9a03['params']['id']}},_0x5d3c18={};_0x5d3c18['model']=_[_0x7337('0x66')](_[_0x7337('0x67')](db[_0x7337('0x64')][_0x7337('0x4b')]),['password',_0x7337('0x51')]);_0x5d3c18['query']=_[_0x7337('0x67')](_0x8b9a03[_0x7337('0x52')]);_0x5d3c18[_0x7337('0x53')]=_[_0x7337('0x54')](_0x5d3c18['model'],_0x5d3c18['query']);_0x245ce1[_0x7337('0x55')]=_['intersection'](_0x5d3c18[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x8b9a03[_0x7337('0x52')][_0x7337('0x56')]));_0x245ce1[_0x7337('0x55')]=_0x245ce1[_0x7337('0x55')][_0x7337('0x57')]?_0x245ce1[_0x7337('0x55')]:_0x5d3c18[_0x7337('0x4f')];if(_0x8b9a03['query'][_0x7337('0x68')]){_0x245ce1[_0x7337('0x69')]=[{'all':!![]}];}_0x245ce1=_[_0x7337('0x5e')]({},_0x245ce1,_0x8b9a03[_0x7337('0x63')]);return db[_0x7337('0x64')]['find'](_0x245ce1)[_0x7337('0x27')](handleEntityNotFound(_0x3d0fcb,null))[_0x7337('0x27')](respondWithResult(_0x3d0fcb,null))[_0x7337('0x31')](handleError(_0x3d0fcb,null));};exports['bulkCreate']=function(_0x5341ed,_0x20edbb){return db[_0x7337('0x64')][_0x7337('0x6a')](_0x5341ed['body'],{'raw':![],'individualHooks':!![]})[_0x7337('0x27')](respondWithResult(_0x20edbb,0xc9))[_0x7337('0x31')](handleError(_0x20edbb,null));};exports[_0x7337('0x3c')]=function(_0x122c94,_0x3c3f02){if(_0x122c94[_0x7337('0x6b')]['id']){delete _0x122c94[_0x7337('0x6b')]['id'];}delete _0x122c94[_0x7337('0x6b')][_0x7337('0x45')];return db[_0x7337('0x64')]['find']({'where':{'id':_0x122c94['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x3c3f02,null))['then'](saveUpdates(_0x122c94['body'],null))[_0x7337('0x27')](respondWithResult(_0x3c3f02,null))[_0x7337('0x31')](handleError(_0x3c3f02,null));};exports[_0x7337('0x6c')]=function(_0x19df21,_0x46f0a7){return db[_0x7337('0x64')]['describe']()['then'](respondWithResult(_0x46f0a7,null))[_0x7337('0x31')](handleError(_0x46f0a7,null));};exports['addContacts']=function(_0x11cdd7,_0x3ea0f9,_0x50febb){return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x11cdd7[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x3ea0f9,null))['then'](function(_0x5c978f){if(_0x5c978f){return _0x5c978f[_0x7337('0x6e')](_0x11cdd7[_0x7337('0x6b')]['ids'],_[_0x7337('0x6f')](_0x11cdd7[_0x7337('0x6b')],[_0x7337('0x70'),'id'])||{});}})[_0x7337('0x27')](respondWithResult(_0x3ea0f9,null))[_0x7337('0x31')](handleError(_0x3ea0f9,null));};var getLicense=function(_0x56160a){return new BPromise(function(_0x4f5899,_0xfd7f2d){var _0x3231e7=0x0;_0x56160a[_0x7337('0x6b')][_0x7337('0x45')]===_0x7337('0x71')&&_0x4f5899(_0x7337('0x72'));return db[_0x7337('0x64')][_0x7337('0x36')]({'where':{'$or':[{'role':_0x56160a[_0x7337('0x6b')]['role']===_0x7337('0x42')?'telephone':[_0x7337('0x73'),_0x7337('0x40')]}]}})[_0x7337('0x27')](function(_0x4be810){_0x3231e7=_0x4be810;return require(_0x7337('0x74'))['getLicense']();})[_0x7337('0x27')](function(_0x98bbd0){var _0xdda792=_0x56160a[_0x7337('0x6b')][_0x7337('0x45')]===_0x7337('0x42')?'telephones':'users';if(!_[_0x7337('0x75')](_0x98bbd0[_0xdda792])&&_0x3231e7>=_0x98bbd0[_0xdda792]){return _0xfd7f2d({'message':_0x7337('0x76')});}return _0x4f5899(util[_0x7337('0x77')](_0x7337('0x78'),_0xdda792,_0x3231e7));})[_0x7337('0x31')](function(_0x4486a2){return _0xfd7f2d(_0x4486a2);});});};exports['create']=function(_0x4bc775,_0x569ea1){return getLicense(_0x4bc775)[_0x7337('0x27')](function(_0x4ff0b6){if(!_0x4bc775[_0x7337('0x6b')][_0x7337('0x79')]){var _0x3f20b3;return db[_0x7337('0x7a')][_0x7337('0x7b')](0x1)['then'](function(_0x576f84){return checkPasswordPattern(_0x576f84,_0x4bc775[_0x7337('0x6b')][_0x7337('0x50')],_0x576f84[_0x7337('0x7c')]);})['then'](function(_0x3b5c1d){_0x3f20b3=_0x3b5c1d[_0x7337('0x7d')];return db[_0x7337('0x64')][_0x7337('0x7e')](_0x7337('0x79'));})[_0x7337('0x27')](function(_0x2b09f5){if(_[_0x7337('0x75')](_0x2b09f5)){if(_0x3f20b3){_0x4bc775[_0x7337('0x6b')]['internal']=_0x3f20b3;}else{_0x4bc775['body']['internal']=0x1;}}else{if(_['isNil'](_0x3f20b3)||_0x3f20b3==_0x2b09f5){_0x4bc775['body'][_0x7337('0x79')]=_0x2b09f5+0x1;}else if(_0x3f20b3>_0x2b09f5){_0x4bc775['body'][_0x7337('0x79')]=_0x3f20b3;}else{return db[_0x7337('0x60')][_0x7337('0x52')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x7337('0x60')][_0x7337('0x7f')][_0x7337('0x80')]})[_0x7337('0x27')](function(_0x25c021){if(_0x25c021&&_0x25c021[_0x7337('0x57')]){for(var _0x8c9db1=0x0,_0x5215cf=_0x25c021[_0x7337('0x57')];_0x8c9db1<_0x5215cf&&_[_0x7337('0x75')](_0x4bc775[_0x7337('0x6b')]['internal']);_0x8c9db1++){if(_0x3f20b3<=_0x25c021[_0x8c9db1][_0x7337('0x81')]){_0x4bc775[_0x7337('0x6b')][_0x7337('0x79')]=_0x25c021[_0x8c9db1][_0x7337('0x81')];}else if(_0x3f20b3>_0x25c021[_0x8c9db1][_0x7337('0x81')]&&_0x3f20b3<=_0x25c021[_0x8c9db1]['to']){_0x4bc775[_0x7337('0x6b')]['internal']=_0x3f20b3;}}}if(_[_0x7337('0x75')](_0x4bc775['body'][_0x7337('0x79')])){_0x4bc775[_0x7337('0x6b')]['internal']=_0x2b09f5+0x1;}});}}});}})['then'](function(){if(_0x4bc775[_0x7337('0x6b')][_0x7337('0x82')]){_0x4bc775[_0x7337('0x6b')][_0x7337('0x83')]=_0x4bc775['body'][_0x7337('0x79')];_0x4bc775['body'][_0x7337('0x84')]={'mailbox':_0x4bc775[_0x7337('0x6b')]['internal'],'password':_0x4bc775[_0x7337('0x6b')]['password'],'fullname':_0x4bc775[_0x7337('0x6b')][_0x7337('0x85')],'email':_0x4bc775[_0x7337('0x6b')][_0x7337('0x86')]};}if(_0x4bc775[_0x7337('0x6b')]&&_0x4bc775[_0x7337('0x6b')]['role']===_0x7337('0x71')){if(!_0x4bc775[_0x7337('0x6b')][_0x7337('0x87')]){_0x4bc775[_0x7337('0x6b')][_0x7337('0x87')]=[_0x7337('0x88'),_0x7337('0x89'),_0x7337('0x8a'),_0x7337('0x8b'),_0x7337('0x8c'),_0x7337('0x8d'),_0x7337('0x8e'),_0x7337('0x8f'),_0x7337('0x90'),_0x7337('0x91'),'109',_0x7337('0x92'),_0x7337('0x93'),_0x7337('0x94')];}}return db[_0x7337('0x64')][_0x7337('0x95')](_0x4bc775['body'],{'include':[{'model':db['VoiceMail'],'as':_0x7337('0x84')}]});})[_0x7337('0x27')](function(_0x139fe3){if(_0x4bc775[_0x7337('0x6b')][_0x7337('0x45')]===_0x7337('0x40'))return _0x139fe3;var _0x1fbcd6=_0x4bc775[_0x7337('0x40')][_0x7337('0x3e')]({'plain':!![]});if(!_0x1fbcd6)throw new Error(_0x7337('0x96'));if(_0x1fbcd6[_0x7337('0x45')]==='user'){var _0x76ed76=_0x139fe3[_0x7337('0x3e')]({'plain':!![]});var _0x18e0d1=[{'name':_0x7337('0x41'),'value':_0x7337('0x71')},{'name':_0x7337('0x97'),'value':_0x7337('0x42')}];var _0x18d9e9=_[_0x7337('0x46')](_0x18e0d1,[_0x7337('0x44'),_0x76ed76[_0x7337('0x45')]])[_0x7337('0x47')];return db['UserProfileSection'][_0x7337('0x46')]({'where':{'name':_0x18d9e9,'userProfileId':_0x1fbcd6['userProfileId']},'raw':!![]})[_0x7337('0x27')](function(_0x6d5f61){if(_0x6d5f61&&_0x6d5f61[_0x7337('0x98')]===0x0){return db[_0x7337('0x48')]['create']({'name':_0x76ed76[_0x7337('0x47')],'resourceId':_0x76ed76['id'],'type':_0x6d5f61[_0x7337('0x47')],'sectionId':_0x6d5f61['id']},{})[_0x7337('0x27')](function(){return _0x139fe3;});}else{return _0x139fe3;}})[_0x7337('0x31')](function(_0x4bfffc){logger[_0x7337('0x2e')](_0x7337('0x99'),_0x4bfffc);throw _0x4bfffc;});}return _0x139fe3;})[_0x7337('0x27')](respondWithResult(_0x569ea1,0xc9))[_0x7337('0x31')](handleError(_0x569ea1,null));};exports[_0x7337('0x9a')]=function(_0x29c939,_0x58a6c4,_0x2bea90){var _0x52ecac=![];if(_0x29c939[_0x7337('0x6b')]['id']){delete _0x29c939['body']['id'];}return db['Setting'][_0x7337('0x9b')]({'attributes':['id',_0x7337('0x7c')]})['then'](function(_0x205280){_0x52ecac=_0x205280['securePassword'];return db[_0x7337('0x64')]['find']({'where':{'id':_0x29c939[_0x7337('0x6d')]['id']}});})['then'](function(_0x57f409){if(_0x57f409){if(_0x57f409['id']==_0x29c939[_0x7337('0x40')]['id']){if(!_0x29c939[_0x7337('0x6b')][_0x7337('0x9c')]||!_0x29c939[_0x7337('0x6b')]['newPassword']){throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0x9e'));}if(!_0x57f409['authenticate'](_0x29c939['body'][_0x7337('0x9c')])){throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0x9f'));}if(_0x29c939[_0x7337('0x6b')][_0x7337('0x9c')]==_0x29c939[_0x7337('0x6b')][_0x7337('0xa0')]){throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0xa1'));}return _0x57f409;}else if(_0x29c939[_0x7337('0x40')]['role']==_0x7337('0x73')){if(!_0x29c939[_0x7337('0x6b')]['newPassword']){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x57f409;}else if(_0x29c939[_0x7337('0x40')]['role']==_0x7337('0x40')){if(!_0x29c939[_0x7337('0x6b')]['newPassword']){throw new db[(_0x7337('0x24'))]['ValidationError'](_0x7337('0xa2'));}if(_0x57f409[_0x7337('0x45')]!=_0x7337('0x71')){throw new db[(_0x7337('0x24'))][(_0x7337('0x9d'))]('Unauthorized');}return _0x57f409;}else{throw new db[(_0x7337('0x24'))][(_0x7337('0x9d'))](_0x7337('0xa3'));}}return null;})[_0x7337('0x27')](handleEntityNotFound(_0x58a6c4,null))[_0x7337('0x27')](function(_0x40add5){return checkPasswordPattern(_0x40add5,_0x29c939['body']['newPassword'],_0x52ecac);})[_0x7337('0x27')](saveUpdates({'password':_0x29c939['body'][_0x7337('0xa0')],'passwordResetAt':_0x29c939[_0x7337('0x40')]['id']==_0x29c939[_0x7337('0x6d')]['id']?moment():null},null))['then'](respondWithResult(_0x58a6c4,null))[_0x7337('0x31')](handleError(_0x58a6c4,null));};exports[_0x7337('0xa4')]=function(_0x11a1a2,_0x527fba,_0x3cdf13){var _0x37b2f5=_0x11a1a2[_0x7337('0x6b')][_0x7337('0xa5')];return db[_0x7337('0x64')]['find']({'where':{'id':_0x11a1a2[_0x7337('0x6d')]['id']},'attributes':['id',_0x7337('0x47'),_0x7337('0x45'),_0x7337('0xa6'),_0x7337('0xa7'),_0x7337('0xa8'),_0x7337('0xa9')]})[_0x7337('0x27')](handleEntityNotFound(_0x527fba,null))['then'](function(_0x13f122){if(_0x13f122){if(!utils[_0x7337('0xaa')](_0x37b2f5)){throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0xab'));}return _0x13f122[_0x7337('0xac')+_[_0x7337('0xad')](_0x37b2f5['toLowerCase']())+_0x7337('0xae')](_0x11a1a2['body'][_0x7337('0x70')],{'penalty':_0x11a1a2[_0x7337('0x6b')][_0x7337('0xaf')]||0x0})[_0x7337('0xb0')](function(_0x40a712){for(var _0x45692f=0x0;_0x45692f<_0x11a1a2[_0x7337('0x6b')][_0x7337('0x70')][_0x7337('0x57')];_0x45692f+=0x1){var _0x219aea={'UserId':_0x11a1a2[_0x7337('0x6d')]['id']};_0x219aea[_['capitalize'](_0x37b2f5['toLowerCase']())+_0x7337('0xb1')]=_0x11a1a2[_0x7337('0x6b')]['ids'][_0x45692f];socket[_0x7337('0xb2')](_0x7337('0x40')+_[_0x7337('0xad')](_0x37b2f5[_0x7337('0xb3')]())+'Queue:save',_0x219aea);}return _0x40a712;})['then'](function(){if(_0x37b2f5===_0x7337('0xb4')){return db['VoiceQueue'][_0x7337('0x65')]({'where':{'id':_0x11a1a2[_0x7337('0x6b')][_0x7337('0x70')]||[]},'raw':!![],'attributes':['id',_0x7337('0x47')]});}})[_0x7337('0x27')](function(_0x5676ba){var _0x1d0b6f=_0x13f122[_0x7337('0x3e')]({'plain':!![]});var _0x7cc338=[];if(_0x37b2f5==='voice'&&_0x1d0b6f[_0x7337('0x45')]==='agent'&&_0x1d0b6f[_0x7337('0xa6')]){for(var _0x10013e=0x0;_0x10013e<_0x5676ba[_0x7337('0x57')];_0x10013e+=0x1){_0x7cc338['push']({'membername':_0x1d0b6f[_0x7337('0x47')],'UserId':_0x1d0b6f['id'],'queue_name':_0x5676ba[_0x10013e]['name'],'VoiceQueueId':_0x5676ba[_0x10013e]['id'],'interface':_[_0x7337('0x75')](_0x1d0b6f['interface'])?util[_0x7337('0x77')](_0x7337('0xb5'),_0x1d0b6f['name']):_0x1d0b6f[_0x7337('0xa9')],'paused':_0x1d0b6f['voicePause']||![],'penalty':_0x11a1a2[_0x7337('0x6b')][_0x7337('0xaf')]||0x0});}return BPromise['each'](_0x7cc338,function(_0x3c9a2a){return db['UserVoiceQueueRt']['upsert'](_0x3c9a2a);});}return _0x13f122;});}})[_0x7337('0x27')](respondWithStatusCode(_0x527fba,null))['catch'](handleError(_0x527fba,null));};exports[_0x7337('0xb6')]=function(_0x9570a1,_0x1ffdd0,_0x5247e0){var _0x3d306e;return db['User'][_0x7337('0x46')]({'where':{'id':_0x9570a1[_0x7337('0x6d')]['id']},'attributes':['id',_0x7337('0x47'),'role']})[_0x7337('0x27')](handleEntityNotFound(_0x1ffdd0,null))[_0x7337('0x27')](function(_0x39f73b){if(_0x39f73b){_0x3d306e=_0x39f73b;if(!_0x9570a1[_0x7337('0x52')]['channel']||!utils[_0x7337('0xaa')](_0x9570a1[_0x7337('0x52')]['channel'])){throw new db['Sequelize'][(_0x7337('0x9d'))]('Unknown\x20channel');}return _0x39f73b['remove'+_[_0x7337('0xad')](_0x9570a1['query']['channel'][_0x7337('0xb3')]())+_0x7337('0xae')](_0x9570a1[_0x7337('0x52')][_0x7337('0x70')]);}})[_0x7337('0x27')](function(_0x493eb0){for(var _0x29d1c9=0x0;_0x29d1c9<_0x9570a1[_0x7337('0x52')][_0x7337('0x70')][_0x7337('0x57')];_0x29d1c9+=0x1){var _0x2248f0={'UserId':_0x9570a1[_0x7337('0x6d')]['id']};_0x2248f0[_[_0x7337('0xad')](_0x9570a1[_0x7337('0x52')][_0x7337('0xa5')][_0x7337('0xb3')]())+_0x7337('0xb1')]=_0x9570a1[_0x7337('0x52')][_0x7337('0x70')][_0x29d1c9];socket['emit'](_0x7337('0x40')+_[_0x7337('0xad')](_0x9570a1[_0x7337('0x52')]['channel'][_0x7337('0xb3')]())+_0x7337('0xb7'),_0x2248f0);}return _0x493eb0;})['then'](function(){if(_0x9570a1['query']['channel']==='voice'){return db[_0x7337('0xb8')][_0x7337('0x3d')]({'where':{'UserId':_0x9570a1[_0x7337('0x6d')]['id'],'VoiceQueueId':_0x9570a1[_0x7337('0x52')][_0x7337('0x70')]},'individualHooks':!![]})[_0x7337('0x27')](function(){return _0x3d306e;});}return _0x3d306e;})[_0x7337('0x27')](respondWithStatusCode(_0x1ffdd0,null))[_0x7337('0x31')](handleError(_0x1ffdd0,null));};exports[_0x7337('0xb9')]=function(_0x5cf75a,_0x4a3246,_0x244099){_0x5cf75a[_0x7337('0x6b')][_0x7337('0xba')]=_0x5cf75a[_0x7337('0xbb')][_0x7337('0xbc')];return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x5cf75a['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x4a3246,null))[_0x7337('0x27')](saveUpdates(_0x5cf75a['body'],null))['then'](respondWithResult(_0x4a3246,null))[_0x7337('0x31')](handleError(_0x4a3246,null));};exports[_0x7337('0xbd')]=function(_0x45dda8,_0x2a96c8,_0x3b1c05){var _0x40a357=path[_0x7337('0xbe')](config[_0x7337('0xbf')],_0x7337('0xc0'));return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x45dda8[_0x7337('0x6d')]['id']},'attributes':['id',_0x7337('0xba')],'raw':!![]})[_0x7337('0x27')](handleEntityNotFound(_0x2a96c8,null))['then'](function(_0x195830){if(_0x195830){if(_[_0x7337('0x75')](_0x195830[_0x7337('0xba')])){return _0x2a96c8['download'](_0x40a357);}else{if(!fs[_0x7337('0xc1')](path['join'](config[_0x7337('0xbf')],'server/files/images/',_0x195830['userpic']))){return _0x2a96c8['download'](_0x40a357);}return _0x2a96c8[_0x7337('0xc2')](path[_0x7337('0xbe')](config['root'],_0x7337('0xc3'),_0x195830[_0x7337('0xba')]));}}})[_0x7337('0x31')](handleError(_0x2a96c8,null));};exports[_0x7337('0xc4')]=function(_0x4cf190,_0x445b1c,_0x2b961d){var _0x29b428={};var _0x584349={};var _0x57d378;var _0x3b2ad7;return db['User'][_0x7337('0x9b')]({'where':{'id':_0x4cf190[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x445b1c,null))['then'](function(_0x10f07c){if(_0x10f07c){_0x57d378=_0x10f07c;_0x584349[_0x7337('0x4f')]=_['keys'](db[_0x7337('0xc5')][_0x7337('0x4b')]);_0x584349[_0x7337('0x52')]=_[_0x7337('0x67')](_0x4cf190['query']);_0x584349[_0x7337('0x53')]=_[_0x7337('0x54')](_0x584349[_0x7337('0x4f')],_0x584349[_0x7337('0x52')]);_0x29b428[_0x7337('0x55')]=_[_0x7337('0x54')](_0x584349[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x4cf190[_0x7337('0x52')][_0x7337('0x56')]));_0x29b428[_0x7337('0x55')]=_0x29b428['attributes'][_0x7337('0x57')]?_0x29b428['attributes']:_0x584349[_0x7337('0x4f')];_0x29b428[_0x7337('0x59')]=qs['sort'](_0x4cf190[_0x7337('0x52')][_0x7337('0x5a')]);_0x29b428[_0x7337('0x5b')]=qs[_0x7337('0x53')](_['pick'](_0x4cf190[_0x7337('0x52')],_0x584349[_0x7337('0x53')]));if(_0x4cf190['query'][_0x7337('0x5d')]){_0x29b428[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x29b428[_0x7337('0x5b')],{'$or':_['map'](_0x29b428[_0x7337('0x55')],function(_0x24a57a){var _0x15d677={};_0x15d677[_0x24a57a]={'$like':'%'+_0x4cf190[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x15d677;})});}_0x29b428=_[_0x7337('0x5e')]({},_0x29b428,_0x4cf190[_0x7337('0x63')]);return _0x57d378[_0x7337('0xc4')](_0x29b428);}})[_0x7337('0x27')](function(_0x1d677a){if(_0x1d677a){_0x3b2ad7=_0x1d677a[_0x7337('0x57')];if(_0x4cf190[_0x7337('0x52')][_0x7337('0x58')]('includeAll')){_0x29b428[_0x7337('0x69')]=[{'model':db[_0x7337('0xc6')],'as':_0x7337('0xc7'),'required':![]},{'model':db[_0x7337('0xc8')],'as':_0x7337('0xc9'),'attributes':['id','name',_0x7337('0xca')],'where':_0x4cf190[_0x7337('0x52')][_0x7337('0xcb')]?{'id':_0x4cf190[_0x7337('0x52')][_0x7337('0xcb')]}:undefined,'required':_0x4cf190[_0x7337('0x52')][_0x7337('0xcb')]?!![]:![]}];}if(!_0x4cf190[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x29b428[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x4cf190[_0x7337('0x52')]['limit']);_0x29b428[_0x7337('0x37')]=qs['offset'](_0x4cf190['query'][_0x7337('0x37')]);}return _0x57d378[_0x7337('0xc4')](_0x29b428);}})['then'](function(_0x226393){if(_0x226393){return _0x226393?{'count':_0x3b2ad7,'rows':_0x226393}:null;}})[_0x7337('0x27')](respondWithResult(_0x445b1c,null))[_0x7337('0x31')](handleError(_0x445b1c,null));};exports[_0x7337('0xcd')]=function(_0x235723,_0x315c93,_0x1e52d1){var _0x40062c;var _0x49c06c;var _0x5ac505={};var _0x41c60b;return db[_0x7337('0x64')]['findOne']({'where':{'id':_0x235723['params']['id']},'attributes':['id',_0x7337('0x47'),_0x7337('0x45')]})[_0x7337('0x27')](handleEntityNotFound(_0x315c93,null))[_0x7337('0x27')](function(_0x21d9ac){if(!utils[_0x7337('0xaa')](_0x235723[_0x7337('0x52')][_0x7337('0xa5')])){throw new db[(_0x7337('0x24'))][(_0x7337('0x9d'))]('Unknown\x20channel');}_0x40062c=_0x21d9ac;var _0x2ed30e={};_0x2ed30e[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_[_0x7337('0xad')](_0x235723[_0x7337('0x52')]['channel'])+_0x7337('0xce')][_0x7337('0x4b')]);_0x2ed30e[_0x7337('0x52')]=_['keys'](_0x235723['query']);_0x2ed30e[_0x7337('0x53')]=_['intersection'](_0x2ed30e[_0x7337('0x4f')],_0x2ed30e[_0x7337('0x52')]);_0x5ac505[_0x7337('0x55')]=_[_0x7337('0x54')](_0x2ed30e[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x235723[_0x7337('0x52')][_0x7337('0x56')]));_0x5ac505[_0x7337('0x55')]=_0x5ac505[_0x7337('0x55')][_0x7337('0x57')]?_0x5ac505[_0x7337('0x55')]:_0x2ed30e[_0x7337('0x4f')];_0x5ac505[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x235723[_0x7337('0x52')]['sort']);_0x5ac505[_0x7337('0x5b')]=qs['filters'](_[_0x7337('0x5c')](_0x235723[_0x7337('0x52')],_0x2ed30e[_0x7337('0x53')]));if(_0x235723[_0x7337('0x52')]['filter']){_0x5ac505[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x5ac505[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x5ac505[_0x7337('0x55')],function(_0xfb2e4){var _0x30cf={};_0x30cf[_0xfb2e4]={'$like':'%'+_0x235723[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x30cf;})});}_0x5ac505=_['merge']({},_0x5ac505,_0x235723[_0x7337('0x63')]);switch(_0x40062c[_0x7337('0x45')]){case _0x7337('0x73'):return db[_[_0x7337('0xad')](_0x235723[_0x7337('0x52')][_0x7337('0xa5')])+_0x7337('0xce')][_0x7337('0x65')](_0x5ac505);case _0x7337('0x40'):case _0x7337('0x71'):return _0x40062c[_0x7337('0x3e')+_[_0x7337('0xad')](_0x235723[_0x7337('0x52')][_0x7337('0xa5')])+_0x7337('0xae')](_0x5ac505);default:throw new db['Sequelize'][(_0x7337('0x9d'))](_0x7337('0xcf'));}})[_0x7337('0x27')](function(_0x3e37e9){_0x41c60b=_0x3e37e9[_0x7337('0x57')];if(!_0x235723['query'][_0x7337('0x58')](_0x7337('0xcc'))){_0x5ac505['limit']=qs[_0x7337('0x38')](_0x235723[_0x7337('0x52')][_0x7337('0x38')]);_0x5ac505[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x235723[_0x7337('0x52')][_0x7337('0x37')]);}switch(_0x40062c[_0x7337('0x45')]){case _0x7337('0x73'):return db[_[_0x7337('0xad')](_0x235723[_0x7337('0x52')][_0x7337('0xa5')])+_0x7337('0xce')][_0x7337('0x65')](_0x5ac505);case'user':case'agent':return _0x40062c['get'+_[_0x7337('0xad')](_0x235723[_0x7337('0x52')]['channel'])+_0x7337('0xae')](_0x5ac505);}})[_0x7337('0x27')](function(_0x278b52){return{'count':_0x41c60b,'rows':_0x278b52};})[_0x7337('0x27')](respondWithResult(_0x315c93,null))['catch'](handleError(_0x315c93,null));};exports['getVoiceQueuesRt']=function(_0x33baa4,_0x4371ec,_0x583c9e){var _0x31740f={};var _0x57df1e={};var _0x25cde4;var _0x5d7c6e;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x33baa4[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x4371ec,null))[_0x7337('0x27')](function(_0xde870){if(_0xde870){_0x25cde4=_0xde870;_0x57df1e[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_0x7337('0xb8')][_0x7337('0x4b')]);_0x57df1e[_0x7337('0x52')]=_['keys'](_0x33baa4[_0x7337('0x52')]);_0x57df1e[_0x7337('0x53')]=_[_0x7337('0x54')](_0x57df1e[_0x7337('0x4f')],_0x57df1e[_0x7337('0x52')]);_0x31740f[_0x7337('0x55')]=_[_0x7337('0x54')](_0x57df1e['model'],qs[_0x7337('0x56')](_0x33baa4[_0x7337('0x52')][_0x7337('0x56')]));_0x31740f[_0x7337('0x55')]=_0x31740f['attributes'][_0x7337('0x57')]?_0x31740f[_0x7337('0x55')]:_0x57df1e['model'];_0x31740f[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x33baa4[_0x7337('0x52')][_0x7337('0x5a')]);_0x31740f['where']=qs[_0x7337('0x53')](_['pick'](_0x33baa4[_0x7337('0x52')],_0x57df1e[_0x7337('0x53')]));if(_0x33baa4['query'][_0x7337('0x5d')]){_0x31740f['where']=_['merge'](_0x31740f[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x31740f[_0x7337('0x55')],function(_0x83241e){var _0x12ae68={};_0x12ae68[_0x83241e]={'$like':'%'+_0x33baa4[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x12ae68;})});}_0x31740f=_['merge']({},_0x31740f,_0x33baa4[_0x7337('0x63')]);return _0x25cde4['getVoiceQueuesRt'](_0x31740f);}})['then'](function(_0xf8c26b){if(_0xf8c26b){_0x5d7c6e=_0xf8c26b['length'];if(!_0x33baa4[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x31740f['limit']=qs[_0x7337('0x38')](_0x33baa4[_0x7337('0x52')][_0x7337('0x38')]);_0x31740f['offset']=qs[_0x7337('0x37')](_0x33baa4[_0x7337('0x52')][_0x7337('0x37')]);}return _0x25cde4['getVoiceQueuesRt'](_0x31740f);}})[_0x7337('0x27')](function(_0x5a4fde){if(_0x5a4fde){return _0x5a4fde?{'count':_0x5d7c6e,'rows':_0x5a4fde}:null;}})[_0x7337('0x27')](respondWithResult(_0x4371ec,null))[_0x7337('0x31')](handleError(_0x4371ec,null));};exports[_0x7337('0xd0')]=function(_0x1c3b68,_0x236275,_0x29dc4c){var _0x2c19c7={};var _0x30c880={};var _0x43e207;var _0x5ed7a6;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x1c3b68[_0x7337('0x6d')]['id']}})['then'](handleEntityNotFound(_0x236275,null))[_0x7337('0x27')](function(_0x49c84c){if(_0x49c84c){_0x43e207=_0x49c84c;_0x30c880[_0x7337('0x4f')]=_['keys'](db['ChatGroup'][_0x7337('0x4b')]);_0x30c880[_0x7337('0x52')]=_[_0x7337('0x67')](_0x1c3b68[_0x7337('0x52')]);_0x30c880[_0x7337('0x53')]=_[_0x7337('0x54')](_0x30c880['model'],_0x30c880[_0x7337('0x52')]);_0x2c19c7[_0x7337('0x55')]=_['intersection'](_0x30c880[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x1c3b68['query'][_0x7337('0x56')]));_0x2c19c7[_0x7337('0x55')]=_0x2c19c7[_0x7337('0x55')]['length']?_0x2c19c7[_0x7337('0x55')]:_0x30c880[_0x7337('0x4f')];_0x2c19c7[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x1c3b68[_0x7337('0x52')]['sort']);_0x2c19c7['where']=qs['filters'](_['pick'](_0x1c3b68[_0x7337('0x52')],_0x30c880[_0x7337('0x53')]));if(_0x1c3b68['query'][_0x7337('0x5d')]){_0x2c19c7['where']=_[_0x7337('0x5e')](_0x2c19c7['where'],{'$or':_[_0x7337('0x4a')](_0x2c19c7[_0x7337('0x55')],function(_0x54f18a){var _0x5a4a4d={};_0x5a4a4d[_0x54f18a]={'$like':'%'+_0x1c3b68[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x5a4a4d;})});}_0x2c19c7=_['merge']({},_0x2c19c7,_0x1c3b68[_0x7337('0x63')]);return _0x43e207[_0x7337('0xd0')](_0x2c19c7);}})[_0x7337('0x27')](function(_0x3569e2){if(_0x3569e2){_0x5ed7a6=_0x3569e2[_0x7337('0x57')];if(!_0x1c3b68[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x2c19c7['limit']=qs[_0x7337('0x38')](_0x1c3b68[_0x7337('0x52')][_0x7337('0x38')]);_0x2c19c7[_0x7337('0x37')]=qs['offset'](_0x1c3b68[_0x7337('0x52')][_0x7337('0x37')]);}return _0x43e207[_0x7337('0xd0')](_0x2c19c7);}})['then'](function(_0x304d90){if(_0x304d90){return _0x304d90?{'count':_0x5ed7a6,'rows':_0x304d90}:null;}})[_0x7337('0x27')](respondWithResult(_0x236275,null))[_0x7337('0x31')](handleError(_0x236275,null));};exports[_0x7337('0xd1')]=function(_0x3b0fd2,_0x4a2cf8,_0x2c49cc){var _0x149ad1={'raw':!![],'where':{}};var _0x1ed748={};var _0xb29f92={'count':0x0,'rows':[]};return db['User'][_0x7337('0x9b')]({'where':{'id':_0x3b0fd2['params']['id']}})['then'](handleEntityNotFound(_0x4a2cf8,null))[_0x7337('0x27')](function(_0x3b5eb8){if(_0x3b5eb8){_0x1ed748[_0x7337('0x4f')]=_['keys'](db[_0x7337('0xd2')][_0x7337('0x4b')]);_0x1ed748[_0x7337('0x52')]=_[_0x7337('0x67')](_0x3b0fd2['query']);_0x1ed748[_0x7337('0x53')]=_[_0x7337('0x54')](_0x1ed748[_0x7337('0x4f')],_0x1ed748[_0x7337('0x52')]);_0x149ad1[_0x7337('0x55')]=_[_0x7337('0x54')](_0x1ed748[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x3b0fd2['query'][_0x7337('0x56')]));_0x149ad1[_0x7337('0x55')]=_0x149ad1['attributes'][_0x7337('0x57')]?_0x149ad1[_0x7337('0x55')]:_0x1ed748[_0x7337('0x4f')];if(!_0x3b0fd2['query'][_0x7337('0x58')]('nolimit')){_0x149ad1[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x3b0fd2[_0x7337('0x52')][_0x7337('0x38')]);_0x149ad1[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x3b0fd2[_0x7337('0x52')]['offset']);}_0x149ad1['order']=qs[_0x7337('0x5a')](_0x3b0fd2[_0x7337('0x52')][_0x7337('0x5a')]);_0x149ad1[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x3b0fd2[_0x7337('0x52')],_0x1ed748[_0x7337('0x53')]));_0x149ad1['where'][_0x7337('0xd3')]=_0x3b5eb8['id'];if(_0x3b0fd2[_0x7337('0x52')][_0x7337('0x5d')]){_0x149ad1[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x149ad1['where'],{'$or':_['map'](_0x149ad1['attributes'],function(_0x5970eb){var _0x254932={};_0x254932[_0x5970eb]={'$like':'%'+_0x3b0fd2[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x254932;})});}_0x149ad1=_[_0x7337('0x5e')]({},_0x149ad1,_0x3b0fd2[_0x7337('0x63')]);return db['VoiceRecording'][_0x7337('0x36')]({'where':_0x149ad1['where']})[_0x7337('0x27')](function(_0x227f92){_0xb29f92['count']=_0x227f92;if(_0x3b0fd2[_0x7337('0x52')][_0x7337('0x68')]){_0x149ad1['include']=[{'all':!![]}];}return db[_0x7337('0xd2')][_0x7337('0x65')](_0x149ad1);})[_0x7337('0x27')](function(_0x17d1c4){_0xb29f92[_0x7337('0xd4')]=_0x17d1c4;return _0xb29f92;});}})[_0x7337('0x27')](respondWithFilteredResult(_0x4a2cf8,_0x149ad1))['catch'](handleError(_0x4a2cf8,null));};exports[_0x7337('0xd5')]=function(_0x250969,_0x381754,_0x5817b3){var _0x329125={'raw':!![],'where':{}};var _0x451bae={};var _0x1adcde={'count':0x0,'rows':[]};return db['User'][_0x7337('0x9b')]({'where':{'id':_0x250969['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x381754,null))[_0x7337('0x27')](function(_0x22febe){if(_0x22febe){_0x451bae[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_0x7337('0xd6')]['rawAttributes']);_0x451bae[_0x7337('0x52')]=_['keys'](_0x250969[_0x7337('0x52')]);_0x451bae[_0x7337('0x53')]=_['intersection'](_0x451bae[_0x7337('0x4f')],_0x451bae[_0x7337('0x52')]);_0x329125[_0x7337('0x55')]=_['intersection'](_0x451bae[_0x7337('0x4f')],qs['fields'](_0x250969[_0x7337('0x52')][_0x7337('0x56')]));_0x329125['attributes']=_0x329125[_0x7337('0x55')][_0x7337('0x57')]?_0x329125['attributes']:_0x451bae[_0x7337('0x4f')];if(!_0x250969['query'][_0x7337('0x58')](_0x7337('0xcc'))){_0x329125['limit']=qs[_0x7337('0x38')](_0x250969[_0x7337('0x52')][_0x7337('0x38')]);_0x329125['offset']=qs['offset'](_0x250969[_0x7337('0x52')][_0x7337('0x37')]);}_0x329125['order']=qs[_0x7337('0x5a')](_0x250969[_0x7337('0x52')][_0x7337('0x5a')]);_0x329125[_0x7337('0x5b')]=qs['filters'](_[_0x7337('0x5c')](_0x250969[_0x7337('0x52')],_0x451bae[_0x7337('0x53')]));_0x329125[_0x7337('0x5b')][_0x7337('0xd3')]=_0x22febe['id'];if(_0x250969[_0x7337('0x52')][_0x7337('0x5d')]){_0x329125[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x329125[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x329125[_0x7337('0x55')],function(_0xf1bc12){var _0x4215d4={};_0x4215d4[_0xf1bc12]={'$like':'%'+_0x250969['query'][_0x7337('0x5d')]+'%'};return _0x4215d4;})});}_0x329125=_['merge']({},_0x329125,_0x250969['options']);return db[_0x7337('0xd6')]['count']({'where':_0x329125[_0x7337('0x5b')]})[_0x7337('0x27')](function(_0x4098e5){_0x1adcde[_0x7337('0x36')]=_0x4098e5;if(_0x250969[_0x7337('0x52')][_0x7337('0x68')]){_0x329125[_0x7337('0x69')]=[{'all':!![]}];}return db['ScreenRecording'][_0x7337('0x65')](_0x329125);})[_0x7337('0x27')](function(_0x1b1509){_0x1adcde[_0x7337('0xd4')]=_0x1b1509;return _0x1adcde;});}})[_0x7337('0x27')](respondWithFilteredResult(_0x381754,_0x329125))[_0x7337('0x31')](handleError(_0x381754,null));};exports[_0x7337('0xd7')]=function(_0x5ab6af,_0x146e7f,_0x2b059a){var _0x3a24e1={};var _0x327e13={};var _0x451154;var _0x315aa1;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x5ab6af[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x146e7f,null))['then'](function(_0x37c51e){if(_0x37c51e){_0x451154=_0x37c51e;_0x327e13['model']=_['keys'](db[_0x7337('0xd8')][_0x7337('0x4b')]);_0x327e13[_0x7337('0x52')]=_['keys'](_0x5ab6af[_0x7337('0x52')]);_0x327e13[_0x7337('0x53')]=_['intersection'](_0x327e13['model'],_0x327e13[_0x7337('0x52')]);_0x3a24e1[_0x7337('0x55')]=_[_0x7337('0x54')](_0x327e13['model'],qs['fields'](_0x5ab6af[_0x7337('0x52')][_0x7337('0x56')]));_0x3a24e1[_0x7337('0x55')]=_0x3a24e1[_0x7337('0x55')][_0x7337('0x57')]?_0x3a24e1[_0x7337('0x55')]:_0x327e13[_0x7337('0x4f')];_0x3a24e1[_0x7337('0x59')]=qs['sort'](_0x5ab6af[_0x7337('0x52')][_0x7337('0x5a')]);_0x3a24e1[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x5ab6af[_0x7337('0x52')],_0x327e13[_0x7337('0x53')]));if(_0x5ab6af[_0x7337('0x52')][_0x7337('0x5d')]){_0x3a24e1[_0x7337('0x5b')]=_['merge'](_0x3a24e1[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x3a24e1['attributes'],function(_0x3de5b6){var _0x40dc22={};_0x40dc22[_0x3de5b6]={'$like':'%'+_0x5ab6af[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x40dc22;})});}_0x3a24e1=_[_0x7337('0x5e')]({},_0x3a24e1,_0x5ab6af[_0x7337('0x63')]);return _0x451154[_0x7337('0xd7')](_0x3a24e1);}})[_0x7337('0x27')](function(_0x575b9f){if(_0x575b9f){_0x315aa1=_0x575b9f[_0x7337('0x57')];if(!_0x5ab6af[_0x7337('0x52')][_0x7337('0x58')]('nolimit')){_0x3a24e1[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x5ab6af[_0x7337('0x52')][_0x7337('0x38')]);_0x3a24e1[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x5ab6af['query'][_0x7337('0x37')]);}return _0x451154['getChatInteractions'](_0x3a24e1);}})[_0x7337('0x27')](function(_0x58233b){if(_0x58233b){return _0x58233b?{'count':_0x315aa1,'rows':_0x58233b}:null;}})[_0x7337('0x27')](respondWithResult(_0x146e7f,null))['catch'](handleError(_0x146e7f,null));};exports[_0x7337('0xd9')]=function(_0x4ccba0,_0x23be77,_0x4f1347){var _0xdb8a05={};var _0x2696a9={};var _0x46f861;var _0x28b815;return db[_0x7337('0x64')]['findOne']({'where':{'id':_0x4ccba0[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x23be77,null))[_0x7337('0x27')](function(_0x3d37a4){if(_0x3d37a4){_0x46f861=_0x3d37a4;_0x2696a9[_0x7337('0x4f')]=_['keys'](db[_0x7337('0xda')][_0x7337('0x4b')]);_0x2696a9['query']=_[_0x7337('0x67')](_0x4ccba0['query']);_0x2696a9[_0x7337('0x53')]=_[_0x7337('0x54')](_0x2696a9['model'],_0x2696a9[_0x7337('0x52')]);_0xdb8a05[_0x7337('0x55')]=_[_0x7337('0x54')](_0x2696a9['model'],qs['fields'](_0x4ccba0[_0x7337('0x52')][_0x7337('0x56')]));_0xdb8a05[_0x7337('0x55')]=_0xdb8a05['attributes'][_0x7337('0x57')]?_0xdb8a05[_0x7337('0x55')]:_0x2696a9[_0x7337('0x4f')];_0xdb8a05[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x4ccba0[_0x7337('0x52')][_0x7337('0x5a')]);_0xdb8a05['where']=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x4ccba0[_0x7337('0x52')],_0x2696a9[_0x7337('0x53')]));if(_0x4ccba0[_0x7337('0x52')][_0x7337('0x5d')]){_0xdb8a05[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0xdb8a05['where'],{'$or':_[_0x7337('0x4a')](_0xdb8a05[_0x7337('0x55')],function(_0x43adc6){var _0x11ed73={};_0x11ed73[_0x43adc6]={'$like':'%'+_0x4ccba0[_0x7337('0x52')]['filter']+'%'};return _0x11ed73;})});}_0xdb8a05=_[_0x7337('0x5e')]({},_0xdb8a05,_0x4ccba0[_0x7337('0x63')]);return _0x46f861['getOpenchannelInteractions'](_0xdb8a05);}})['then'](function(_0x228fd9){if(_0x228fd9){_0x28b815=_0x228fd9[_0x7337('0x57')];if(!_0x4ccba0[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0xdb8a05[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x4ccba0['query']['limit']);_0xdb8a05[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x4ccba0[_0x7337('0x52')]['offset']);}return _0x46f861[_0x7337('0xd9')](_0xdb8a05);}})['then'](function(_0x53d3c4){if(_0x53d3c4){return _0x53d3c4?{'count':_0x28b815,'rows':_0x53d3c4}:null;}})[_0x7337('0x27')](respondWithResult(_0x23be77,null))[_0x7337('0x31')](handleError(_0x23be77,null));};exports['getMailInteractions']=function(_0x274db1,_0x2226c2,_0x176b42){var _0x44af85={'raw':!![],'where':{}};var _0x44ff9d={};var _0xaecd2a={'count':0x0,'rows':[]};return db['User'][_0x7337('0x9b')]({'where':{'id':_0x274db1['params']['id']}})['then'](handleEntityNotFound(_0x2226c2,null))[_0x7337('0x27')](function(_0x1fbcd2){if(_0x1fbcd2){_0x44ff9d[_0x7337('0x4f')]=_['keys'](db[_0x7337('0xdb')][_0x7337('0x4b')]);_0x44ff9d[_0x7337('0x52')]=_[_0x7337('0x67')](_0x274db1[_0x7337('0x52')]);_0x44ff9d[_0x7337('0x53')]=_[_0x7337('0x54')](_0x44ff9d[_0x7337('0x4f')],_0x44ff9d[_0x7337('0x52')]);_0x44af85[_0x7337('0x55')]=_['intersection'](_0x44ff9d['model'],qs[_0x7337('0x56')](_0x274db1[_0x7337('0x52')][_0x7337('0x56')]));_0x44af85[_0x7337('0x55')]=_0x44af85[_0x7337('0x55')][_0x7337('0x57')]?_0x44af85[_0x7337('0x55')]:_0x44ff9d[_0x7337('0x4f')];if(!_0x274db1['query'][_0x7337('0x58')](_0x7337('0xcc'))){_0x44af85[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x274db1['query'][_0x7337('0x38')]);_0x44af85[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x274db1[_0x7337('0x52')]['offset']);}_0x44af85[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x274db1[_0x7337('0x52')][_0x7337('0x5a')]);_0x44af85[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x274db1['query'],_0x44ff9d['filters']));_0x44af85[_0x7337('0x5b')][_0x7337('0xd3')]=_0x1fbcd2['id'];if(_0x274db1[_0x7337('0x52')]['filter']){_0x44af85[_0x7337('0x5b')]=_['merge'](_0x44af85[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x44af85[_0x7337('0x55')],function(_0x350a8a){var _0x3f3f33={};_0x3f3f33[_0x350a8a]={'$like':'%'+_0x274db1[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x3f3f33;})});}_0x44af85=_[_0x7337('0x5e')]({},_0x44af85,_0x274db1[_0x7337('0x63')]);return db['MailInteraction']['count']({'where':_0x44af85[_0x7337('0x5b')]})[_0x7337('0x27')](function(_0x18d1d5){_0xaecd2a[_0x7337('0x36')]=_0x18d1d5;if(_0x274db1[_0x7337('0x52')][_0x7337('0x68')]){_0x44af85['include']=[{'all':!![]}];}return db[_0x7337('0xdb')][_0x7337('0x65')](_0x44af85);})[_0x7337('0x27')](function(_0x1d79ff){_0xaecd2a['rows']=_0x1d79ff;return _0xaecd2a;});}})[_0x7337('0x27')](respondWithFilteredResult(_0x2226c2,_0x44af85))[_0x7337('0x31')](handleError(_0x2226c2,null));};exports[_0x7337('0xdc')]=function(_0x343aaa,_0x1d5a44,_0x59452e){var _0xf9c3e7={};var _0x1531c0={};var _0xcf9315;var _0x2386f7;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x343aaa[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x1d5a44,null))[_0x7337('0x27')](function(_0x138b65){if(_0x138b65){_0xcf9315=_0x138b65;_0x1531c0[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_0x7337('0xdd')][_0x7337('0x4b')]);_0x1531c0[_0x7337('0x52')]=_[_0x7337('0x67')](_0x343aaa[_0x7337('0x52')]);_0x1531c0[_0x7337('0x53')]=_[_0x7337('0x54')](_0x1531c0[_0x7337('0x4f')],_0x1531c0[_0x7337('0x52')]);_0xf9c3e7[_0x7337('0x55')]=_[_0x7337('0x54')](_0x1531c0[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x343aaa[_0x7337('0x52')][_0x7337('0x56')]));_0xf9c3e7[_0x7337('0x55')]=_0xf9c3e7[_0x7337('0x55')][_0x7337('0x57')]?_0xf9c3e7[_0x7337('0x55')]:_0x1531c0[_0x7337('0x4f')];_0xf9c3e7[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x343aaa[_0x7337('0x52')][_0x7337('0x5a')]);_0xf9c3e7['where']=qs[_0x7337('0x53')](_['pick'](_0x343aaa[_0x7337('0x52')],_0x1531c0[_0x7337('0x53')]));if(_0x343aaa['query']['filter']){_0xf9c3e7[_0x7337('0x5b')]=_['merge'](_0xf9c3e7[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0xf9c3e7[_0x7337('0x55')],function(_0x2baeb5){var _0x2c40ec={};_0x2c40ec[_0x2baeb5]={'$like':'%'+_0x343aaa[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x2c40ec;})});}_0xf9c3e7=_[_0x7337('0x5e')]({},_0xf9c3e7,_0x343aaa[_0x7337('0x63')]);return _0xcf9315[_0x7337('0xdc')](_0xf9c3e7);}})[_0x7337('0x27')](function(_0x505746){if(_0x505746){_0x2386f7=_0x505746['length'];if(!_0x343aaa[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0xf9c3e7[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x343aaa[_0x7337('0x52')][_0x7337('0x38')]);_0xf9c3e7[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x343aaa[_0x7337('0x52')]['offset']);}return _0xcf9315['getSmsInteractions'](_0xf9c3e7);}})['then'](function(_0x5f3fb6){if(_0x5f3fb6){return _0x5f3fb6?{'count':_0x2386f7,'rows':_0x5f3fb6}:null;}})[_0x7337('0x27')](respondWithResult(_0x1d5a44,null))[_0x7337('0x31')](handleError(_0x1d5a44,null));};exports[_0x7337('0xde')]=function(_0x3d824b,_0x47bc6c,_0x2c4461){var _0x1fce05={};var _0xc5a0b7={};var _0x214dac;var _0x14ec56;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x3d824b['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x47bc6c,null))[_0x7337('0x27')](function(_0x37904f){if(_0x37904f){_0x214dac=_0x37904f;_0xc5a0b7['model']=_[_0x7337('0x67')](db['FaxInteraction'][_0x7337('0x4b')]);_0xc5a0b7['query']=_[_0x7337('0x67')](_0x3d824b['query']);_0xc5a0b7[_0x7337('0x53')]=_[_0x7337('0x54')](_0xc5a0b7[_0x7337('0x4f')],_0xc5a0b7['query']);_0x1fce05['attributes']=_[_0x7337('0x54')](_0xc5a0b7[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x3d824b[_0x7337('0x52')][_0x7337('0x56')]));_0x1fce05[_0x7337('0x55')]=_0x1fce05['attributes'][_0x7337('0x57')]?_0x1fce05[_0x7337('0x55')]:_0xc5a0b7[_0x7337('0x4f')];_0x1fce05[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x3d824b[_0x7337('0x52')][_0x7337('0x5a')]);_0x1fce05[_0x7337('0x5b')]=qs['filters'](_[_0x7337('0x5c')](_0x3d824b[_0x7337('0x52')],_0xc5a0b7[_0x7337('0x53')]));if(_0x3d824b[_0x7337('0x52')]['filter']){_0x1fce05[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x1fce05[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x1fce05[_0x7337('0x55')],function(_0x8ce464){var _0x5b75a6={};_0x5b75a6[_0x8ce464]={'$like':'%'+_0x3d824b['query'][_0x7337('0x5d')]+'%'};return _0x5b75a6;})});}_0x1fce05=_[_0x7337('0x5e')]({},_0x1fce05,_0x3d824b[_0x7337('0x63')]);return _0x214dac[_0x7337('0xde')](_0x1fce05);}})[_0x7337('0x27')](function(_0x19f7cf){if(_0x19f7cf){_0x14ec56=_0x19f7cf[_0x7337('0x57')];if(!_0x3d824b[_0x7337('0x52')][_0x7337('0x58')]('nolimit')){_0x1fce05['limit']=qs[_0x7337('0x38')](_0x3d824b[_0x7337('0x52')]['limit']);_0x1fce05[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x3d824b['query'][_0x7337('0x37')]);}return _0x214dac['getFaxInteractions'](_0x1fce05);}})[_0x7337('0x27')](function(_0x4b2bb5){if(_0x4b2bb5){return _0x4b2bb5?{'count':_0x14ec56,'rows':_0x4b2bb5}:null;}})[_0x7337('0x27')](respondWithResult(_0x47bc6c,null))['catch'](handleError(_0x47bc6c,null));};exports[_0x7337('0xdf')]=function(_0x48f857,_0x219d95,_0x1a6c23){var _0x2e2caf={};var _0x251326={};var _0x3256ca;var _0x28443f;return db['User'][_0x7337('0x9b')]({'where':{'id':_0x48f857[_0x7337('0x6d')]['id']}})['then'](handleEntityNotFound(_0x219d95,null))['then'](function(_0x28f582){if(_0x28f582){_0x3256ca=_0x28f582;_0x251326[_0x7337('0x4f')]=_[_0x7337('0x67')](db[_0x7337('0xe0')]['rawAttributes']);_0x251326[_0x7337('0x52')]=_[_0x7337('0x67')](_0x48f857[_0x7337('0x52')]);_0x251326[_0x7337('0x53')]=_[_0x7337('0x54')](_0x251326[_0x7337('0x4f')],_0x251326[_0x7337('0x52')]);_0x2e2caf['attributes']=_['intersection'](_0x251326[_0x7337('0x4f')],qs[_0x7337('0x56')](_0x48f857['query'][_0x7337('0x56')]));_0x2e2caf[_0x7337('0x55')]=_0x2e2caf['attributes']['length']?_0x2e2caf['attributes']:_0x251326[_0x7337('0x4f')];_0x2e2caf[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x48f857[_0x7337('0x52')][_0x7337('0x5a')]);_0x2e2caf['where']=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0x48f857[_0x7337('0x52')],_0x251326[_0x7337('0x53')]));if(_0x48f857[_0x7337('0x52')]['filter']){_0x2e2caf[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x2e2caf[_0x7337('0x5b')],{'$or':_['map'](_0x2e2caf[_0x7337('0x55')],function(_0x191905){var _0x1f2ece={};_0x1f2ece[_0x191905]={'$like':'%'+_0x48f857['query'][_0x7337('0x5d')]+'%'};return _0x1f2ece;})});}_0x2e2caf=_[_0x7337('0x5e')]({},_0x2e2caf,_0x48f857['options']);return _0x3256ca[_0x7337('0xdf')](_0x2e2caf);}})[_0x7337('0x27')](function(_0x5e202a){if(_0x5e202a){_0x28443f=_0x5e202a[_0x7337('0x57')];if(!_0x48f857[_0x7337('0x52')]['hasOwnProperty'](_0x7337('0xcc'))){_0x2e2caf[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x48f857[_0x7337('0x52')][_0x7337('0x38')]);_0x2e2caf['offset']=qs[_0x7337('0x37')](_0x48f857['query'][_0x7337('0x37')]);}return _0x3256ca[_0x7337('0xdf')](_0x2e2caf);}})['then'](function(_0x31a23d){if(_0x31a23d){return _0x31a23d?{'count':_0x28443f,'rows':_0x31a23d}:null;}})['then'](respondWithResult(_0x219d95,null))['catch'](handleError(_0x219d95,null));};exports[_0x7337('0xe1')]=function(_0xbbe45d,_0x3e1ee6,_0x1d33ed){var _0xcd1d30;var _0x146ee1;var _0x5142aa;var _0x1296d6=!_[_0x7337('0x75')](_0xbbe45d['params']['id'])?_0xbbe45d[_0x7337('0x6d')]['id']:!_[_0x7337('0x75')](_0xbbe45d[_0x7337('0x40')]['id'])?_0xbbe45d[_0x7337('0x40')]['id']:null;return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x1296d6,'role':{'$or':['admin',_0x7337('0x40'),_0x7337('0x71')]}},'attributes':['id','name',_0x7337('0xe2'),_0x7337('0xe3'),_0x7337('0x45'),_0x7337('0x79'),_0x7337('0xa7')]})[_0x7337('0x27')](function(_0x2328d0){if(_0x2328d0){if(_0x2328d0[_0x7337('0x45')]===_0x7337('0x71')){_0xcd1d30=_0x2328d0;if(_0xbbe45d['body'][_0x7337('0xa9')]){_0x5142aa=util[_0x7337('0x77')](_0x7337('0xe4'),_0xcd1d30[_0xbbe45d['body'][_0x7337('0xa9')]]);}else if(_0xbbe45d['body'][_0x7337('0xe5')]){_0x5142aa=util[_0x7337('0x77')]('SIP/%s',_0xbbe45d[_0x7337('0x6b')]['intrf']);}else{_0x5142aa=util[_0x7337('0x77')](_0x7337('0xb5'),_0xcd1d30[_0x7337('0x47')]);}socket['to'](util['format'](_0x7337('0xe6'),_0xcd1d30[_0x7337('0x47')]))[_0x7337('0xb2')]('user:forcelogout',{'ip':_0xbbe45d[_0x7337('0xe7')]['x-forwarded-for']||_0xbbe45d['connection'][_0x7337('0xe8')]||_0xbbe45d[_0x7337('0xe9')][_0x7337('0xe8')]||_0xbbe45d[_0x7337('0xea')][_0x7337('0xe9')]['remoteAddress']});return db[_0x7337('0xb8')][_0x7337('0x3d')]({'where':{'membername':_0xcd1d30[_0x7337('0x47')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x7337('0x9d'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x7337('0x27')](function(){if(_0xcd1d30){return _0xcd1d30[_0x7337('0xeb')]({'raw':!![]});}})['then'](function(_0x10b8c3){if(_0xcd1d30){var _0x1fe2d8=[];if(_0x10b8c3){_0x146ee1=_0x10b8c3;if(_0x146ee1[_0x7337('0x57')]){for(var _0xb4cd6=0x0;_0xb4cd6<_0x146ee1[_0x7337('0x57')];_0xb4cd6++){_0x1fe2d8[_0x7337('0xec')]({'membername':_0xcd1d30[_0x7337('0x47')],'UserId':_0xcd1d30['id'],'queue_name':_0x146ee1[_0xb4cd6][_0x7337('0x47')],'VoiceQueueId':_0x146ee1[_0xb4cd6]['id'],'interface':_0x5142aa,'paused':_0xcd1d30[_0x7337('0xa7')]||![],'penalty':_0x146ee1[_0xb4cd6][_0x7337('0xed')]||0x0});}return BPromise[_0x7337('0xee')](_0x1fe2d8,function(_0x1fc443){return db[_0x7337('0xb8')][_0x7337('0xef')](_0x1fc443);});}}}})['then'](function(){if(_0xcd1d30){return db[_0x7337('0xf0')][_0x7337('0x65')]({'where':{'membername':_0xcd1d30[_0x7337('0x47')],'exitAt':null}});}})[_0x7337('0x27')](function(_0x1550e0){if(_0xcd1d30){var _0xc818a6=[];_0x1550e0[_0x7337('0xf1')](function(_0x5dd828){_0xc818a6[_0x7337('0xec')](_0x5dd828[_0x7337('0x3c')]({'exitAt':moment()['format'](_0x7337('0xf2'))}));});return BPromise[_0x7337('0xf3')](_0xc818a6);}})['then'](function(){if(_0xcd1d30){var _0x39cee9=[];var _0x70ce1=[];var _0x431f54=utils[_0x7337('0xf4')]();var _0x41ddef={'membername':_0xcd1d30['name'],'interface':_0x5142aa,'enterAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'role':_0xcd1d30[_0x7337('0x45')],'internal':_0xcd1d30[_0x7337('0x79')]};_0x431f54['forEach'](function(_0x4ab5f8){_0x39cee9[_0x7337('0xec')](_['merge']({'channel':_0x4ab5f8,'type':_0x7337('0xf5'),'data1':_0xbbe45d['body'][_0x7337('0xf6')],'data2':_0x5142aa},_0x41ddef));if(_0xcd1d30['loginInPause']){_0x70ce1['push'](_[_0x7337('0x5e')]({'channel':_0x4ab5f8,'type':_0x7337('0xf7'),'data1':_0x7337('0xf8')},_0x41ddef));}});return db[_0x7337('0xf0')][_0x7337('0x6a')](_0x39cee9[_0x7337('0xf9')](_0x70ce1),{'individualHooks':!![]});}})['then'](function(){if(_0xcd1d30){return _0xcd1d30[_0x7337('0x3c')]({'online':!![],'lastLoginAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'voicePause':_0xcd1d30[_0x7337('0xa7')]||![],'mailPause':_0xcd1d30[_0x7337('0xa7')]||![],'chatPause':_0xcd1d30[_0x7337('0xa7')]||![],'faxPause':_0xcd1d30[_0x7337('0xa7')]||![],'smsPause':_0xcd1d30[_0x7337('0xa7')]||![],'openchannelPause':_0xcd1d30[_0x7337('0xa7')]||![],'whatsappPause':_0xcd1d30[_0x7337('0xa7')]||![],'pauseType':_0xcd1d30[_0x7337('0xa7')]?_0x7337('0xf8'):null,'interface':_0x5142aa,'lastPauseAt':moment()[_0x7337('0x77')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x7337('0x27')](function(_0x243c98){if(_0xbbe45d[_0x7337('0xfa')]){return _0x1d33ed();}else{return BPromise[_0x7337('0xfb')](_0x243c98)[_0x7337('0x27')](respondWithResult(_0x3e1ee6,null));}})['catch'](handleError(_0x3e1ee6,null));};exports[_0x7337('0xfc')]=function(_0x1bf776,_0x179dda,_0x50cd8a){var _0x5429b2;return db['User'][_0x7337('0x46')]({'where':{'id':_0x1bf776['params']['id'],'role':_0x7337('0x71')},'attributes':['id',_0x7337('0x47'),_0x7337('0x45')]})['then'](handleEntityNotFound(_0x179dda,null))['then'](function(_0x83b61c){if(_0x83b61c){_0x5429b2=_0x83b61c;return db[_0x7337('0xb8')][_0x7337('0x3d')]({'where':{'membername':_0x5429b2[_0x7337('0x47')]},'individualHooks':!![]});}})[_0x7337('0x27')](function(){return db[_0x7337('0xf0')][_0x7337('0x65')]({'where':{'membername':_0x5429b2[_0x7337('0x47')],'exitAt':null}});})[_0x7337('0x27')](function(_0x523aa9){var _0x1e9d65=[];_0x523aa9[_0x7337('0xf1')](function(_0x5db948){_0x1e9d65[_0x7337('0xec')](_0x5db948[_0x7337('0x3c')]({'exitAt':moment()[_0x7337('0x77')](_0x7337('0xf2'))}));});return BPromise[_0x7337('0xf3')](_0x1e9d65);})[_0x7337('0x27')](function(){return _0x5429b2[_0x7337('0x3c')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x7337('0x27')](respondWithResult(_0x179dda,null))['catch'](handleError(_0x179dda,null));};exports['pause']=function(_0x90ea6a,_0x1230aa,_0x6c7648){var _0x691f5c;return db[_0x7337('0xb8')]['update']({'paused':0x1},{'where':{'UserId':_0x90ea6a[_0x7337('0x6d')]['id']},'individualHooks':!![]})[_0x7337('0x27')](function(){return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x90ea6a[_0x7337('0x6d')]['id'],'role':_0x7337('0x71')},'attributes':['id',_0x7337('0x47'),_0x7337('0x45'),_0x7337('0x79'),_0x7337('0xa9')]});})[_0x7337('0x27')](handleEntityNotFound(_0x1230aa,null))[_0x7337('0x27')](function(_0x42c209){if(_0x42c209){_0x691f5c=_0x42c209;return respondWithRpcPromise(_0x7337('0xfd'),_0x7337('0xfe'),{'id':_0x691f5c['id'],'name':_0x691f5c[_0x7337('0x47')],'pause':!![]});}})[_0x7337('0x27')](function(){if(_0x691f5c){return db[_0x7337('0xf0')][_0x7337('0x65')]({'where':{'membername':_0x691f5c[_0x7337('0x47')],'type':_0x7337('0xf7'),'exitAt':null}});}})[_0x7337('0x27')](function(_0x5eb676){if(_0x5eb676[_0x7337('0x57')]){var _0x183dcf=moment()['format'](_0x7337('0xf2'));for(var _0x2aca76=0x0,_0xdd5c1b=_0x5eb676[_0x7337('0x57')];_0x2aca76<_0xdd5c1b;_0x2aca76++){_0x5eb676[_0x2aca76][_0x7337('0xff')]({'exitAt':_0x183dcf});}}})[_0x7337('0x27')](function(){var _0x59f90b=[];var _0x1589e0=utils['getChannels']();_0x1589e0[_0x7337('0xf1')](function(_0x540a24){_0x59f90b[_0x7337('0xec')]({'channel':_0x540a24,'membername':_0x691f5c[_0x7337('0x47')],'interface':_[_0x7337('0x75')](_0x691f5c[_0x7337('0xa9')])?util['format']('SIP/%s',_0x691f5c[_0x7337('0x47')]):_0x691f5c[_0x7337('0xa9')],'type':_0x7337('0xf7'),'enterAt':moment()[_0x7337('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x90ea6a[_0x7337('0x6b')]['type']||_0x7337('0x100'),'role':_0x691f5c[_0x7337('0x45')],'internal':_0x691f5c[_0x7337('0x79')]});});return db[_0x7337('0xf0')][_0x7337('0x6a')](_0x59f90b,{'individualHooks':!![]});})[_0x7337('0x27')](function(){return _0x691f5c[_0x7337('0x3c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x90ea6a[_0x7337('0x6b')][_0x7337('0x4d')]||_0x7337('0x100'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x1230aa,null))['catch'](handleError(_0x1230aa,null));};exports[_0x7337('0x101')]=function(_0x3e0f4d,_0x40ab47,_0x19dc3b){var _0x87ff60;return db[_0x7337('0x64')][_0x7337('0x46')]({'where':{'id':_0x3e0f4d[_0x7337('0x6d')]['id']},'attributes':['id',_0x7337('0x47'),'role',_0x7337('0xa8'),_0x7337('0x102'),_0x7337('0x103'),_0x7337('0x104'),'openchannelPause','smsPause',_0x7337('0x105'),'pauseType',_0x7337('0x106')]})[_0x7337('0x27')](handleEntityNotFound(_0x40ab47,null))[_0x7337('0x27')](function(_0x33ba96){if(_0x33ba96){_0x87ff60=_0x33ba96;if(_0x3e0f4d['body'][_0x7337('0xa5')]&&!utils[_0x7337('0xaa')](_0x3e0f4d[_0x7337('0x6b')][_0x7337('0xa5')])){throw new db[(_0x7337('0x24'))][(_0x7337('0x9d'))](_0x7337('0xab'));}switch(_0x3e0f4d[_0x7337('0x6b')][_0x7337('0xa5')]){case _0x7337('0xb4'):return respondWithRpcPromise(_0x7337('0xfd'),_0x7337('0x101'),{'id':_0x87ff60['id'],'name':_0x87ff60[_0x7337('0x47')],'pause':![]})[_0x7337('0x27')](function(){return db[_0x7337('0xb8')]['update']({'paused':0x0},{'where':{'UserId':_0x87ff60['id']},'individualHooks':!![]});})[_0x7337('0x27')](function(){return db[_0x7337('0xf0')]['find']({'where':{'channel':_0x3e0f4d[_0x7337('0x6b')][_0x7337('0xa5')],'membername':_0x87ff60[_0x7337('0x47')],'type':_0x7337('0xf7'),'exitAt':null}});})['then'](function(_0x5733fe){if(_0x5733fe){return _0x5733fe[_0x7337('0x3c')]({'exitAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x7337('0x27')](function(){return _0x87ff60[_0x7337('0x3c')]({'voicePause':![]});});case _0x7337('0x107'):case _0x7337('0x108'):case _0x7337('0x109'):case _0x7337('0x10a'):case _0x7337('0x10b'):case _0x7337('0x10c'):return db[_0x7337('0xf0')]['find']({'where':{'channel':_0x3e0f4d[_0x7337('0x6b')][_0x7337('0xa5')],'membername':_0x87ff60['name'],'type':'PAUSE','exitAt':null}})['then'](function(_0x59bab1){if(_0x59bab1){return _0x59bab1[_0x7337('0x3c')]({'exitAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x7337('0x27')](function(){var _0x168697={};_['set'](_0x168697,util[_0x7337('0x77')](_0x7337('0x10d'),_0x3e0f4d['body'][_0x7337('0xa5')],_0x7337('0x10e')),![]);return _0x87ff60[_0x7337('0x3c')](_0x168697);});default:return respondWithRpcPromise(_0x7337('0xfd'),_0x7337('0x101'),{'id':_0x87ff60['id'],'name':_0x87ff60[_0x7337('0x47')],'pause':![]})[_0x7337('0x27')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x87ff60['id']}});})['then'](function(){return db[_0x7337('0xf0')][_0x7337('0x65')]({'where':{'membername':_0x87ff60[_0x7337('0x47')],'type':_0x7337('0xf7'),'exitAt':null}});})[_0x7337('0x27')](function(_0x380695){var _0x339a6e=[];_0x380695[_0x7337('0xf1')](function(_0x509267){_0x339a6e[_0x7337('0xec')](_0x509267[_0x7337('0x3c')]({'exitAt':moment()[_0x7337('0x77')](_0x7337('0xf2')),'data2':_0x7337('0x10f')}));});return BPromise[_0x7337('0xf3')](_0x339a6e);})[_0x7337('0x27')](function(){return _0x87ff60['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x40ab47,null))[_0x7337('0x31')](handleError(_0x40ab47,null));};exports[_0x7337('0x110')]=function(_0x49448c,_0x428348,_0x4c30f0){var _0x171438={};var _0x5e7a11={};var _0x11d490;var _0xa2b820;return db['User'][_0x7337('0x9b')]({'where':{'id':_0x49448c[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x428348,null))['then'](function(_0x501e56){if(_0x501e56){_0x11d490=_0x501e56;_0x5e7a11[_0x7337('0x4f')]=_['keys'](db[_0x7337('0x111')][_0x7337('0x4b')]);_0x5e7a11[_0x7337('0x52')]=_['keys'](_0x49448c['query']);_0x5e7a11[_0x7337('0x53')]=_[_0x7337('0x54')](_0x5e7a11[_0x7337('0x4f')],_0x5e7a11[_0x7337('0x52')]);_0x171438['attributes']=_[_0x7337('0x54')](_0x5e7a11['model'],qs[_0x7337('0x56')](_0x49448c[_0x7337('0x52')]['fields']));_0x171438[_0x7337('0x55')]=_0x171438[_0x7337('0x55')][_0x7337('0x57')]?_0x171438[_0x7337('0x55')]:_0x5e7a11['model'];_0x171438[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0x49448c['query'][_0x7337('0x5a')]);_0x171438['where']=qs[_0x7337('0x53')](_['pick'](_0x49448c[_0x7337('0x52')],_0x5e7a11[_0x7337('0x53')]));if(_0x49448c[_0x7337('0x52')][_0x7337('0x5d')]){_0x171438[_0x7337('0x5b')]=_[_0x7337('0x5e')](_0x171438[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x171438[_0x7337('0x55')],function(_0x5e9852){var _0xadeefb={};_0xadeefb[_0x5e9852]={'$like':'%'+_0x49448c[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0xadeefb;})});}_0x171438=_['merge']({},_0x171438,_0x49448c[_0x7337('0x63')]);return _0x11d490[_0x7337('0x110')](_0x171438);}})[_0x7337('0x27')](function(_0x594323){if(_0x594323){_0xa2b820=_0x594323['length'];if(!_0x49448c[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x171438[_0x7337('0x38')]=qs[_0x7337('0x38')](_0x49448c[_0x7337('0x52')][_0x7337('0x38')]);_0x171438[_0x7337('0x37')]=qs['offset'](_0x49448c[_0x7337('0x52')][_0x7337('0x37')]);}return _0x11d490[_0x7337('0x110')](_0x171438);}})[_0x7337('0x27')](function(_0x3f340b){if(_0x3f340b){return _0x3f340b?{'count':_0xa2b820,'rows':_0x3f340b}:null;}})[_0x7337('0x27')](respondWithResult(_0x428348,null))[_0x7337('0x31')](handleError(_0x428348,null));};exports[_0x7337('0x112')]=function(_0x25ab12,_0x1bf78b){return db[_0x7337('0x64')]['find']({'where':{'id':_0x25ab12['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x1bf78b,null))[_0x7337('0x27')](function(_0x53c52d){if(_0x53c52d){var _0x45221c=_0x53c52d[_0x7337('0x3e')]({'plain':!![]});return _0x53c52d[_0x7337('0x112')](_0x25ab12[_0x7337('0x6b')][_0x7337('0x70')],_[_0x7337('0x6f')](_0x25ab12[_0x7337('0x6b')],[_0x7337('0x70'),'id'])||{})[_0x7337('0x27')](function(){for(var _0x2d6bea=0x0;_0x2d6bea<_0x25ab12[_0x7337('0x6b')][_0x7337('0x70')][_0x7337('0x57')];_0x2d6bea++){var _0x49623f=[];db['Team'][_0x7337('0x9b')]({'where':{'id':_0x25ab12[_0x7337('0x6b')][_0x7337('0x70')][_0x2d6bea]}})[_0x7337('0x27')](function(_0x2a3d30){_0x49623f[_0x7337('0xec')](_0x2a3d30['getVoiceQueues']()['then'](function(_0x23c118){for(var _0x44db83=0x0;_0x44db83<_0x23c118[_0x7337('0x57')];_0x44db83++){_0x23c118[_0x44db83][_0x7337('0x113')](_0x7337('0xa5'),'Voice');}return _0x23c118;}));_0x49623f['push'](_0x2a3d30[_0x7337('0x114')]()['then'](function(_0x202704){for(var _0x3ee45b=0x0;_0x3ee45b<_0x202704[_0x7337('0x57')];_0x3ee45b++){_0x202704[_0x3ee45b][_0x7337('0x113')](_0x7337('0xa5'),_0x7337('0x115'));}return _0x202704;}));_0x49623f[_0x7337('0xec')](_0x2a3d30[_0x7337('0x116')]()['then'](function(_0x1e7e70){for(var _0x9737be=0x0;_0x9737be<_0x1e7e70[_0x7337('0x57')];_0x9737be++){_0x1e7e70[_0x9737be][_0x7337('0x113')](_0x7337('0xa5'),_0x7337('0x117'));}return _0x1e7e70;}));_0x49623f[_0x7337('0xec')](_0x2a3d30[_0x7337('0x118')]()['then'](function(_0x37248c){for(var _0x8e193=0x0;_0x8e193<_0x37248c['length'];_0x8e193++){_0x37248c[_0x8e193][_0x7337('0x113')](_0x7337('0xa5'),'Sms');}return _0x37248c;}));_0x49623f[_0x7337('0xec')](_0x2a3d30[_0x7337('0x119')]()[_0x7337('0x27')](function(_0x5cc4f3){for(var _0x32e7d6=0x0;_0x32e7d6<_0x5cc4f3[_0x7337('0x57')];_0x32e7d6++){_0x5cc4f3[_0x32e7d6][_0x7337('0x113')]('channel','Whatsapp');}return _0x5cc4f3;}));_0x49623f[_0x7337('0xec')](_0x2a3d30[_0x7337('0x11a')]()['then'](function(_0x1f04cb){for(var _0x2c9a92=0x0;_0x2c9a92<_0x1f04cb['length'];_0x2c9a92++){_0x1f04cb[_0x2c9a92][_0x7337('0x113')](_0x7337('0xa5'),'Fax');}return _0x1f04cb;}));_0x49623f[_0x7337('0xec')](_0x2a3d30['getOpenchannelQueues']()[_0x7337('0x27')](function(_0x41b604){for(var _0x50e353=0x0;_0x50e353<_0x41b604[_0x7337('0x57')];_0x50e353++){_0x41b604[_0x50e353]['setDataValue'](_0x7337('0xa5'),'Openchannel');}return _0x41b604;}));return BPromise['all'](_0x49623f);})[_0x7337('0x27')](function(_0x3085bf){var _0x359e29=_[_0x7337('0x11b')](_0x3085bf);_0x49623f=[];return db[_0x7337('0x60')][_0x7337('0x11c')](function(_0x5bc3a6){for(var _0x519dbf=0x0;_0x519dbf<_0x359e29[_0x7337('0x57')];_0x519dbf++){_0x49623f[_0x7337('0xec')](_0x359e29[_0x519dbf]['addAgent'](_0x45221c['id']),{'transaction':_0x5bc3a6});}return BPromise[_0x7337('0xf3')](_0x49623f)['then'](function(){if(_0x45221c[_0x7337('0xa6')]){return BPromise[_0x7337('0xee')](_[_0x7337('0x5d')](_0x359e29,function(_0x47256a){return _0x47256a['getDataValue'](_0x7337('0xa5'))===_0x7337('0x11d');}),function(_0x3b87b0){return db[_0x7337('0xb8')]['upsert']({'membername':_0x45221c[_0x7337('0x47')],'UserId':_0x45221c['id'],'queue_name':_0x3b87b0['name'],'VoiceQueueId':_0x3b87b0['id'],'interface':_[_0x7337('0x75')](_0x45221c[_0x7337('0xa9')])?util[_0x7337('0x77')](_0x7337('0xb5'),_0x45221c[_0x7337('0x47')]):_0x45221c[_0x7337('0xa9')],'paused':_0x45221c[_0x7337('0xa8')]||![],'penalty':_0x45221c[_0x7337('0xaf')]},{'transaction':_0x5bc3a6});});}else{return;}})[_0x7337('0x27')](function(){for(var _0x14e6f2=0x0;_0x14e6f2<_0x359e29[_0x7337('0x57')];_0x14e6f2++){var _0x2b47f4=_0x359e29[_0x14e6f2][_0x7337('0x11e')](_0x7337('0xa5'));var _0x1d7ebf=_0x2b47f4+'QueueId';socket[_0x7337('0xb2')](_0x7337('0x40')+_0x2b47f4+'Queue:save',{'UserId':_0x45221c['id'],['queueField']:_0x359e29[_0x14e6f2]['id']});}});});});}});}})[_0x7337('0x27')](respondWithStatusCode(_0x1bf78b,null))[_0x7337('0x31')](handleError(_0x1bf78b,null));};exports[_0x7337('0x11f')]=function(_0x5373db,_0x542a8a){return db[_0x7337('0x64')]['findOne']({'where':{'id':_0x5373db[_0x7337('0x6d')]['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x542a8a,null))[_0x7337('0x27')](function(_0x2671e4){if(_0x2671e4){var _0xbfa377=_0x2671e4[_0x7337('0x3e')]({'plain':!![]});var _0xa6af33=_0x5373db[_0x7337('0x52')][_0x7337('0x70')];return _0x2671e4[_0x7337('0x11f')](_0xa6af33)[_0x7337('0x27')](function(){for(var _0x39140f=0x0;_0x39140f<_0xa6af33['length'];_0x39140f++){var _0x3ec030=[];db[_0x7337('0x111')][_0x7337('0x9b')]({'where':{'id':_0xa6af33[_0x39140f]}})[_0x7337('0x27')](function(_0x32d970){_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0xeb')]()[_0x7337('0x27')](function(_0x191212){for(var _0x3583a1=0x0;_0x3583a1<_0x191212['length'];_0x3583a1++){_0x191212[_0x3583a1][_0x7337('0x113')](_0x7337('0xa5'),_0x7337('0x11d'));}return _0x191212;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x114')]()[_0x7337('0x27')](function(_0x107d72){for(var _0x5d45a8=0x0;_0x5d45a8<_0x107d72[_0x7337('0x57')];_0x5d45a8++){_0x107d72[_0x5d45a8]['setDataValue']('channel',_0x7337('0x115'));}return _0x107d72;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x116')]()['then'](function(_0x139641){for(var _0x2998f6=0x0;_0x2998f6<_0x139641[_0x7337('0x57')];_0x2998f6++){_0x139641[_0x2998f6][_0x7337('0x113')]('channel',_0x7337('0x117'));}return _0x139641;}));_0x3ec030[_0x7337('0xec')](_0x32d970['getSmsQueues']()['then'](function(_0xebae75){for(var _0x5e24e8=0x0;_0x5e24e8<_0xebae75[_0x7337('0x57')];_0x5e24e8++){_0xebae75[_0x5e24e8]['setDataValue'](_0x7337('0xa5'),_0x7337('0x120'));}return _0xebae75;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x119')]()[_0x7337('0x27')](function(_0x5e4025){for(var _0xfb7643=0x0;_0xfb7643<_0x5e4025[_0x7337('0x57')];_0xfb7643++){_0x5e4025[_0xfb7643][_0x7337('0x113')](_0x7337('0xa5'),_0x7337('0x121'));}return _0x5e4025;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x11a')]()['then'](function(_0x33c33b){for(var _0x563222=0x0;_0x563222<_0x33c33b[_0x7337('0x57')];_0x563222++){_0x33c33b[_0x563222][_0x7337('0x113')](_0x7337('0xa5'),'Fax');}return _0x33c33b;}));_0x3ec030[_0x7337('0xec')](_0x32d970[_0x7337('0x122')]()[_0x7337('0x27')](function(_0x1206b4){for(var _0x276d56=0x0;_0x276d56<_0x1206b4['length'];_0x276d56++){_0x1206b4[_0x276d56][_0x7337('0x113')]('channel',_0x7337('0x123'));}return _0x1206b4;}));return BPromise[_0x7337('0xf3')](_0x3ec030);})[_0x7337('0x27')](function(_0x2b091f){var _0x4e37b7=_['flatten'](_0x2b091f);_0x3ec030=[];return db[_0x7337('0x60')][_0x7337('0x11c')](function(_0x3aa290){for(var _0x3dbd9d=0x0;_0x3dbd9d<_0x4e37b7[_0x7337('0x57')];_0x3dbd9d++){_0x3ec030[_0x7337('0xec')](_0x4e37b7[_0x3dbd9d]['removeAgent'](_0xbfa377['id']),{'transaction':_0x3aa290});}return BPromise[_0x7337('0xf3')](_0x3ec030)[_0x7337('0x27')](function(){if(_0xbfa377[_0x7337('0xa6')]){return BPromise['each'](_['filter'](_0x4e37b7,function(_0x275333){return _0x275333[_0x7337('0x11e')](_0x7337('0xa5'))===_0x7337('0x11d');}),function(_0x2ad0e2){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2ad0e2['id'],'UserId':_0xbfa377['id']},'transaction':_0x3aa290});});}else{return;}})[_0x7337('0x27')](function(){for(var _0x1264ba=0x0;_0x1264ba<_0x4e37b7[_0x7337('0x57')];_0x1264ba++){var _0x4ad75b=_0x4e37b7[_0x1264ba][_0x7337('0x11e')](_0x7337('0xa5'));var _0xda40d3=_0x4ad75b+_0x7337('0xb1');socket[_0x7337('0xb2')](_0x7337('0x40')+_0x4ad75b+_0x7337('0xb7'),{'UserId':_0xbfa377['id'],['queueField']:_0x4e37b7[_0x1264ba]['id']});}});});});}});}})[_0x7337('0x27')](respondWithStatusCode(_0x542a8a,null))['catch'](handleError(_0x542a8a,null));};exports[_0x7337('0x124')]=function(_0x3cd2e9,_0x5ecb4c,_0x5ed38d){var _0x3a370a={};var _0x15a77c={};var _0x2df378;var _0x1d6f3c;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0x3cd2e9[_0x7337('0x6d')]['id']}})['then'](handleEntityNotFound(_0x5ecb4c,null))[_0x7337('0x27')](function(_0x2bef47){if(_0x2bef47){_0x2df378=_0x2bef47;_0x15a77c[_0x7337('0x4f')]=_[_0x7337('0x67')](db['CmList'][_0x7337('0x4b')]);_0x15a77c[_0x7337('0x52')]=_[_0x7337('0x67')](_0x3cd2e9[_0x7337('0x52')]);_0x15a77c['filters']=_[_0x7337('0x54')](_0x15a77c[_0x7337('0x4f')],_0x15a77c[_0x7337('0x52')]);_0x3a370a[_0x7337('0x55')]=_[_0x7337('0x54')](_0x15a77c['model'],qs[_0x7337('0x56')](_0x3cd2e9[_0x7337('0x52')][_0x7337('0x56')]));_0x3a370a[_0x7337('0x55')]=_0x3a370a['attributes'][_0x7337('0x57')]?_0x3a370a['attributes']:_0x15a77c[_0x7337('0x4f')];_0x3a370a['order']=qs['sort'](_0x3cd2e9[_0x7337('0x52')][_0x7337('0x5a')]);_0x3a370a[_0x7337('0x5b')]=qs['filters'](_[_0x7337('0x5c')](_0x3cd2e9[_0x7337('0x52')],_0x15a77c['filters']));if(_0x3cd2e9[_0x7337('0x52')][_0x7337('0x5d')]){_0x3a370a['where']=_[_0x7337('0x5e')](_0x3a370a[_0x7337('0x5b')],{'$or':_[_0x7337('0x4a')](_0x3a370a['attributes'],function(_0x1bb5df){var _0x5078b8={};_0x5078b8[_0x1bb5df]={'$like':'%'+_0x3cd2e9[_0x7337('0x52')]['filter']+'%'};return _0x5078b8;})});}_0x3a370a=_['merge']({},_0x3a370a,_0x3cd2e9[_0x7337('0x63')]);return _0x2df378[_0x7337('0x124')](_0x3a370a);}})['then'](function(_0x1f95c5){if(_0x1f95c5){_0x1d6f3c=_0x1f95c5[_0x7337('0x57')];if(!_0x3cd2e9[_0x7337('0x52')][_0x7337('0x58')](_0x7337('0xcc'))){_0x3a370a['limit']=qs['limit'](_0x3cd2e9[_0x7337('0x52')][_0x7337('0x38')]);_0x3a370a[_0x7337('0x37')]=qs[_0x7337('0x37')](_0x3cd2e9[_0x7337('0x52')][_0x7337('0x37')]);}return _0x2df378['getLists'](_0x3a370a);}})[_0x7337('0x27')](function(_0x43675e){if(_0x43675e){return _0x43675e?{'count':_0x1d6f3c,'rows':_0x43675e}:null;}})[_0x7337('0x27')](respondWithResult(_0x5ecb4c,null))[_0x7337('0x31')](handleError(_0x5ecb4c,null));};exports['getAgents']=function(_0xd77795,_0x4a5506,_0x138395){var _0x38c7c5={};var _0x5dd131={};var _0x2ca5f5;var _0x49e60d;return db[_0x7337('0x64')][_0x7337('0x9b')]({'where':{'id':_0xd77795['params']['id']}})[_0x7337('0x27')](handleEntityNotFound(_0x4a5506,null))[_0x7337('0x27')](function(_0x12ba54){if(_0x12ba54){_0x2ca5f5=_0x12ba54;_0x5dd131['model']=_[_0x7337('0x67')](db[_0x7337('0x64')][_0x7337('0x4b')]);_0x5dd131[_0x7337('0x52')]=_['keys'](_0xd77795[_0x7337('0x52')]);_0x5dd131[_0x7337('0x53')]=_[_0x7337('0x54')](_0x5dd131[_0x7337('0x4f')],_0x5dd131[_0x7337('0x52')]);_0x38c7c5[_0x7337('0x55')]=_[_0x7337('0x54')](_0x5dd131[_0x7337('0x4f')],qs['fields'](_0xd77795[_0x7337('0x52')][_0x7337('0x56')]));_0x38c7c5[_0x7337('0x55')]=_0x38c7c5['attributes'][_0x7337('0x57')]?_0x38c7c5[_0x7337('0x55')]:_0x5dd131['model'];_0x38c7c5[_0x7337('0x59')]=qs[_0x7337('0x5a')](_0xd77795[_0x7337('0x52')][_0x7337('0x5a')]);_0x38c7c5[_0x7337('0x5b')]=qs[_0x7337('0x53')](_[_0x7337('0x5c')](_0xd77795[_0x7337('0x52')],_0x5dd131[_0x7337('0x53')]));if(_0xd77795[_0x7337('0x52')][_0x7337('0x5d')]){_0x38c7c5[_0x7337('0x5b')]=_['merge'](_0x38c7c5['where'],{'$or':_['map'](_0x38c7c5[_0x7337('0x55')],function(_0x450000){var _0x5e65a6={};_0x5e65a6[_0x450000]={'$like':'%'+_0xd77795[_0x7337('0x52')][_0x7337('0x5d')]+'%'};return _0x5e65a6;})});}_0x38c7c5[_0x7337('0x4f')]=db['User'];_0x38c7c5['as']=_0x7337('0x41');_0x38c7c5=_[_0x7337('0x5e')]({},_0x38c7c5,_0xd77795[_0x7337('0x63')]);return _0x2ca5f5[_0x7337('0xeb')]({'include':[_0x38c7c5]});}})[_0x7337('0x27')](function(_0x3667e7){if(_0x3667e7){var _0x4d3654={},_0x24d41b=[],_0x2a4df2=0x0;for(var _0x250180=0x0;_0x250180<_0x3667e7[_0x7337('0x57')];_0x250180+=0x1){for(var _0x53567c=0x0,_0x366b7c;_0x53567c<_0x3667e7[_0x250180][_0x7337('0x41')]['length'];_0x53567c+=0x1){_0x366b7c=_0x3667e7[_0x250180]['Agents'][_0x53567c][_0x7337('0x3e')]({'plain':!![]});_0x4d3654[_0x366b7c['id']]=_0x366b7c;}}_0x4d3654=_['values'](_0x4d3654);for(var _0x578128=qs[_0x7337('0x37')](_0xd77795[_0x7337('0x52')][_0x7337('0x37')]);_0x578128<_0x4d3654[_0x7337('0x57')]&&_0x24d41b[_0x7337('0x57')]=_0x57f227){_0x3a9345=_0x57f227;_0x3c4948=0xc8;}else{_0x3c4948=0xce;}_0x2505a3[_0x0af3('0x30')](_0x3c4948);return _0x2505a3[_0x0af3('0x35')](_0x0af3('0x36'),_0x439a4c+'-'+_0x3a9345+'/'+_0x57f227)[_0x0af3('0x31')](_0x32a025);}return null;};}function patchUpdates(_0xba63db){return function(_0x14da02){try{jsonpatch['apply'](_0x14da02,_0xba63db,!![]);}catch(_0x18f4d5){return BPromise['reject'](_0x18f4d5);}return _0x14da02['save']();};}function saveUpdates(_0x2ff405,_0x420828){return function(_0xd0730){if(_0xd0730){return _0xd0730[_0x0af3('0x37')](_0x2ff405)[_0x0af3('0x38')](function(_0x4cf978){return _0x4cf978;});}return null;};}function removeEntity(_0x3e0420,_0x412ecb){return function(_0x545583){if(_0x545583){return _0x545583[_0x0af3('0x39')]()[_0x0af3('0x38')](function(){var _0x190941=_0x545583['get']({'plain':!![]});var _0x25475c=[{'name':'Users','value':_0x0af3('0x3a'),'ignore':!![]},{'name':'Agents','value':_0x0af3('0x3b'),'ignore':![]},{'name':_0x0af3('0x3c'),'value':'telephone','ignore':![]}];var _0xd802f7=_(_0x25475c)[_0x0af3('0x3d')](_0x0af3('0x3e'))[_0x0af3('0x3f')]('value')[_0x0af3('0x40')]();if(_['includes'](_0xd802f7,_0x190941[_0x0af3('0x41')])){return;}var _0x1ceb61=_['find'](_0x25475c,['value',_0x190941['role']])[_0x0af3('0x42')];return db[_0x0af3('0x43')][_0x0af3('0x39')]({'where':{'type':_0x1ceb61,'resourceId':_0x190941['id']}})[_0x0af3('0x38')](function(){return _0x545583;});})[_0x0af3('0x38')](function(){_0x3e0420[_0x0af3('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x352b09,_0x47e1cc){return function(_0xc538d){if(!_0xc538d){_0x352b09[_0x0af3('0x2f')](0x194);}return _0xc538d;};}function handleError(_0x101a08,_0x57d608){_0x57d608=_0x57d608||0x1f4;return function(_0x3b3ca4){logger['error'](_0x3b3ca4[_0x0af3('0x44')]);if(_0x3b3ca4[_0x0af3('0x42')]){delete _0x3b3ca4['name'];}_0x101a08['status'](_0x57d608)[_0x0af3('0x45')](_0x3b3ca4);};}exports[_0x0af3('0x46')]=function(_0x283e4f,_0x4452ff){var _0x282b21={},_0x3fa016={},_0x5acb52={'count':0x0,'rows':[]};var _0x1d8283=_['map'](db[_0x0af3('0x47')][_0x0af3('0x48')],function(_0x2a2be0){return{'name':_0x2a2be0[_0x0af3('0x49')],'type':_0x2a2be0[_0x0af3('0x4a')][_0x0af3('0x4b')]};});_0x3fa016[_0x0af3('0x4c')]=_[_0x0af3('0x4d')](_[_0x0af3('0x3f')](_0x1d8283,_0x0af3('0x42')),['password',_0x0af3('0x4e')]);_0x3fa016[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x283e4f[_0x0af3('0x4f')]);_0x3fa016['filters']=_[_0x0af3('0x51')](_0x3fa016[_0x0af3('0x4c')],_0x3fa016[_0x0af3('0x4f')]);_0x282b21[_0x0af3('0x52')]=_['intersection'](_0x3fa016['model'],qs[_0x0af3('0x53')](_0x283e4f[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x282b21['attributes']=_0x282b21[_0x0af3('0x52')][_0x0af3('0x54')]?_0x282b21[_0x0af3('0x52')]:_0x3fa016[_0x0af3('0x4c')];if(!_0x283e4f[_0x0af3('0x4f')]['hasOwnProperty'](_0x0af3('0x55'))){_0x282b21['limit']=qs[_0x0af3('0x34')](_0x283e4f[_0x0af3('0x4f')][_0x0af3('0x34')]);_0x282b21[_0x0af3('0x33')]=qs['offset'](_0x283e4f[_0x0af3('0x4f')][_0x0af3('0x33')]);}_0x282b21[_0x0af3('0x56')]=qs['sort'](_0x283e4f[_0x0af3('0x4f')]['sort']);_0x282b21[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_['pick'](_0x283e4f[_0x0af3('0x4f')],_0x3fa016[_0x0af3('0x58')]),_0x1d8283);if(_0x283e4f['query'][_0x0af3('0x3d')]){_0x282b21['where']=_['merge'](_0x282b21['where'],{'$or':_[_0x0af3('0x3f')](_0x1d8283,function(_0x492cfa){if(_0x492cfa[_0x0af3('0x4a')]!==_0x0af3('0x59')){return db[_0x0af3('0x5a')]['where'](db['sequelize']['fn'](_0x0af3('0x5b'),db[_0x0af3('0x5a')][_0x0af3('0x5c')](_0x492cfa['name'])),{'$like':db['sequelize']['fn'](_0x0af3('0x5b'),'%'+_0x283e4f[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%')});}})});}_0x282b21=_[_0x0af3('0x5d')]({},_0x282b21,_0x283e4f[_0x0af3('0x5e')]);var _0x460ef6={'where':_0x282b21[_0x0af3('0x57')]};return db[_0x0af3('0x47')][_0x0af3('0x32')](_0x460ef6)[_0x0af3('0x38')](function(_0x17729e){_0x5acb52[_0x0af3('0x32')]=_0x17729e;if(_0x283e4f[_0x0af3('0x4f')][_0x0af3('0x5f')]){_0x282b21[_0x0af3('0x60')]=[{'all':!![]}];}return db[_0x0af3('0x47')][_0x0af3('0x61')](_0x282b21);})['then'](function(_0xefb90a){_0x5acb52[_0x0af3('0x62')]=_0xefb90a;return _0x5acb52;})['then'](respondWithFilteredResult(_0x4452ff,_0x282b21))[_0x0af3('0x2e')](handleError(_0x4452ff,null));};exports[_0x0af3('0x63')]=function(_0x353c96,_0x51e8e5){var _0x2280cd={'raw':![],'where':{'id':_0x353c96['params']['id']}},_0x5c8eef={};_0x5c8eef[_0x0af3('0x4c')]=_[_0x0af3('0x4d')](_[_0x0af3('0x50')](db['User'][_0x0af3('0x48')]),[_0x0af3('0x64'),_0x0af3('0x4e')]);_0x5c8eef['query']=_[_0x0af3('0x50')](_0x353c96['query']);_0x5c8eef[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x5c8eef[_0x0af3('0x4c')],_0x5c8eef['query']);_0x2280cd['attributes']=_[_0x0af3('0x51')](_0x5c8eef['model'],qs[_0x0af3('0x53')](_0x353c96[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x2280cd[_0x0af3('0x52')]=_0x2280cd['attributes'][_0x0af3('0x54')]?_0x2280cd[_0x0af3('0x52')]:_0x5c8eef[_0x0af3('0x4c')];if(_0x353c96['query'][_0x0af3('0x5f')]){_0x2280cd['include']=[{'all':!![]}];}_0x2280cd=_['merge']({},_0x2280cd,_0x353c96[_0x0af3('0x5e')]);return db['User'][_0x0af3('0x65')](_0x2280cd)[_0x0af3('0x38')](handleEntityNotFound(_0x51e8e5,null))['then'](respondWithResult(_0x51e8e5,null))[_0x0af3('0x2e')](handleError(_0x51e8e5,null));};exports['bulkCreate']=function(_0x3e0a01,_0x3d6919){return db[_0x0af3('0x47')][_0x0af3('0x66')](_0x3e0a01[_0x0af3('0x67')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3d6919,0xc9))['catch'](handleError(_0x3d6919,null));};exports[_0x0af3('0x37')]=function(_0x396dd7,_0x5a274c){if(_0x396dd7[_0x0af3('0x67')]['id']){delete _0x396dd7[_0x0af3('0x67')]['id'];}delete _0x396dd7[_0x0af3('0x67')][_0x0af3('0x41')];return db['User'][_0x0af3('0x65')]({'where':{'id':_0x396dd7[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x5a274c,null))[_0x0af3('0x38')](saveUpdates(_0x396dd7['body'],null))[_0x0af3('0x38')](respondWithResult(_0x5a274c,null))[_0x0af3('0x2e')](handleError(_0x5a274c,null));};exports[_0x0af3('0x69')]=function(_0x1b7f1e,_0x2db26f){return db['User']['describe']()[_0x0af3('0x38')](respondWithResult(_0x2db26f,null))['catch'](handleError(_0x2db26f,null));};exports[_0x0af3('0x6a')]=function(_0x18b843,_0x5dff89,_0x3a6ff7){return db[_0x0af3('0x47')][_0x0af3('0x65')]({'where':{'id':_0x18b843[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x5dff89,null))[_0x0af3('0x38')](function(_0x1f2a3c){if(_0x1f2a3c){return _0x1f2a3c[_0x0af3('0x6a')](_0x18b843[_0x0af3('0x67')]['ids'],_[_0x0af3('0x6b')](_0x18b843[_0x0af3('0x67')],['ids','id'])||{});}})[_0x0af3('0x38')](respondWithResult(_0x5dff89,null))[_0x0af3('0x2e')](handleError(_0x5dff89,null));};var getLicense=function(_0x59152c){return new BPromise(function(_0x2f8969,_0x39b9bc){var _0x2d43bd=0x0;_0x59152c['body'][_0x0af3('0x41')]===_0x0af3('0x3b')&&_0x2f8969('agent\x20role');return db[_0x0af3('0x47')]['count']({'where':{'$or':[{'role':_0x59152c[_0x0af3('0x67')][_0x0af3('0x41')]===_0x0af3('0x6c')?_0x0af3('0x6c'):[_0x0af3('0x6d'),'user']}]}})[_0x0af3('0x38')](function(_0x5a9a94){_0x2d43bd=_0x5a9a94;return require(_0x0af3('0x6e'))[_0x0af3('0x6f')]();})[_0x0af3('0x38')](function(_0x28bec8){var _0x158627=_0x59152c[_0x0af3('0x67')][_0x0af3('0x41')]==='telephone'?'telephones':_0x0af3('0x70');if(!_[_0x0af3('0x71')](_0x28bec8[_0x158627])&&_0x2d43bd>=_0x28bec8[_0x158627]){return _0x39b9bc({'message':_0x0af3('0x72')});}return _0x2f8969(util['format']('count\x20%s:\x20%s',_0x158627,_0x2d43bd));})[_0x0af3('0x2e')](function(_0x6be2fa){return _0x39b9bc(_0x6be2fa);});});};exports[_0x0af3('0x73')]=function(_0x54dd68,_0x4367ad){return getLicense(_0x54dd68)[_0x0af3('0x38')](function(_0x43fcf9){if(!_0x54dd68[_0x0af3('0x67')][_0x0af3('0x74')]){var _0x214313;return db['Setting'][_0x0af3('0x75')](0x1)[_0x0af3('0x38')](function(_0x439dc6){return checkPasswordPattern(_0x439dc6,_0x54dd68[_0x0af3('0x67')]['password'],_0x439dc6['securePassword']);})['then'](function(_0x49c6b0){_0x214313=_0x49c6b0[_0x0af3('0x76')];return db[_0x0af3('0x47')][_0x0af3('0x77')](_0x0af3('0x74'));})[_0x0af3('0x38')](function(_0x428919){if(_[_0x0af3('0x71')](_0x428919)){if(_0x214313){_0x54dd68[_0x0af3('0x67')][_0x0af3('0x74')]=_0x214313;}else{_0x54dd68[_0x0af3('0x67')][_0x0af3('0x74')]=0x1;}}else{if(_['isNil'](_0x214313)||_0x214313==_0x428919){_0x54dd68[_0x0af3('0x67')]['internal']=_0x428919+0x1;}else if(_0x214313>_0x428919){_0x54dd68[_0x0af3('0x67')][_0x0af3('0x74')]=_0x214313;}else{return db['sequelize'][_0x0af3('0x4f')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x0af3('0x5a')][_0x0af3('0x78')][_0x0af3('0x79')]})[_0x0af3('0x38')](function(_0x885294){if(_0x885294&&_0x885294['length']){for(var _0x4120c2=0x0,_0xbf3e34=_0x885294[_0x0af3('0x54')];_0x4120c2<_0xbf3e34&&_[_0x0af3('0x71')](_0x54dd68[_0x0af3('0x67')]['internal']);_0x4120c2++){if(_0x214313<=_0x885294[_0x4120c2][_0x0af3('0x7a')]){_0x54dd68['body'][_0x0af3('0x74')]=_0x885294[_0x4120c2]['from'];}else if(_0x214313>_0x885294[_0x4120c2]['from']&&_0x214313<=_0x885294[_0x4120c2]['to']){_0x54dd68[_0x0af3('0x67')][_0x0af3('0x74')]=_0x214313;}}}if(_[_0x0af3('0x71')](_0x54dd68[_0x0af3('0x67')]['internal'])){_0x54dd68[_0x0af3('0x67')]['internal']=_0x428919+0x1;}});}}});}})[_0x0af3('0x38')](function(){if(_0x54dd68[_0x0af3('0x67')][_0x0af3('0x7b')]){_0x54dd68[_0x0af3('0x67')][_0x0af3('0x7c')]=_0x54dd68['body'][_0x0af3('0x74')];_0x54dd68[_0x0af3('0x67')][_0x0af3('0x7d')]={'mailbox':_0x54dd68[_0x0af3('0x67')][_0x0af3('0x74')],'password':_0x54dd68[_0x0af3('0x67')][_0x0af3('0x64')],'fullname':_0x54dd68[_0x0af3('0x67')][_0x0af3('0x7e')],'email':_0x54dd68[_0x0af3('0x67')][_0x0af3('0x7f')]};}if(_0x54dd68[_0x0af3('0x67')]&&_0x54dd68['body'][_0x0af3('0x41')]===_0x0af3('0x3b')){if(!_0x54dd68[_0x0af3('0x67')]['permissions']){_0x54dd68[_0x0af3('0x67')][_0x0af3('0x80')]=[_0x0af3('0x81'),_0x0af3('0x82'),_0x0af3('0x83'),_0x0af3('0x84'),_0x0af3('0x85'),'104','105',_0x0af3('0x86'),_0x0af3('0x87'),_0x0af3('0x88'),_0x0af3('0x89'),'100',_0x0af3('0x8a'),_0x0af3('0x8b')];}}return db[_0x0af3('0x47')][_0x0af3('0x73')](_0x54dd68[_0x0af3('0x67')],{'include':[{'model':db['VoiceMail'],'as':_0x0af3('0x7d')}]});})['then'](function(_0x1b91fb){if(_0x54dd68['body'][_0x0af3('0x41')]==='user')return _0x1b91fb;var _0x1d25c7=_0x54dd68['user'][_0x0af3('0x8c')]({'plain':!![]});if(!_0x1d25c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d25c7[_0x0af3('0x41')]===_0x0af3('0x3a')){var _0x1ce049=_0x1b91fb[_0x0af3('0x8c')]({'plain':!![]});var _0x3dd31f=[{'name':_0x0af3('0x8d'),'value':_0x0af3('0x3b')},{'name':_0x0af3('0x3c'),'value':_0x0af3('0x6c')}];var _0x1db7fb=_[_0x0af3('0x65')](_0x3dd31f,['value',_0x1ce049[_0x0af3('0x41')]])[_0x0af3('0x42')];return db[_0x0af3('0x8e')][_0x0af3('0x65')]({'where':{'name':_0x1db7fb,'userProfileId':_0x1d25c7[_0x0af3('0x8f')]},'raw':!![]})['then'](function(_0x5da2bc){if(_0x5da2bc&&_0x5da2bc[_0x0af3('0x90')]===0x0){return db[_0x0af3('0x43')]['create']({'name':_0x1ce049[_0x0af3('0x42')],'resourceId':_0x1ce049['id'],'type':_0x5da2bc[_0x0af3('0x42')],'sectionId':_0x5da2bc['id']},{})[_0x0af3('0x38')](function(){return _0x1b91fb;});}else{return _0x1b91fb;}})['catch'](function(_0x51bb9a){logger[_0x0af3('0x2a')](_0x0af3('0x91'),_0x51bb9a);throw _0x51bb9a;});}return _0x1b91fb;})[_0x0af3('0x38')](respondWithResult(_0x4367ad,0xc9))['catch'](handleError(_0x4367ad,null));};exports[_0x0af3('0x92')]=function(_0x2f62d4,_0x664caf,_0x3f55d3){var _0x4f0107=![];if(_0x2f62d4[_0x0af3('0x67')]['id']){delete _0x2f62d4['body']['id'];}return db[_0x0af3('0x93')][_0x0af3('0x94')]({'attributes':['id',_0x0af3('0x95')]})['then'](function(_0x2d1195){_0x4f0107=_0x2d1195[_0x0af3('0x95')];return db['User']['find']({'where':{'id':_0x2f62d4['params']['id']}});})[_0x0af3('0x38')](function(_0xef39f8){if(_0xef39f8){if(_0xef39f8['id']==_0x2f62d4[_0x0af3('0x3a')]['id']){if(!_0x2f62d4[_0x0af3('0x67')][_0x0af3('0x96')]||!_0x2f62d4[_0x0af3('0x67')][_0x0af3('0x97')]){throw new db['Sequelize'][(_0x0af3('0x21'))](_0x0af3('0x98'));}if(!_0xef39f8[_0x0af3('0x99')](_0x2f62d4[_0x0af3('0x67')]['oldPassword'])){throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))](_0x0af3('0x9a'));}if(_0x2f62d4[_0x0af3('0x67')][_0x0af3('0x96')]==_0x2f62d4[_0x0af3('0x67')][_0x0af3('0x97')]){throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))](_0x0af3('0x9b'));}return _0xef39f8;}else if(_0x2f62d4[_0x0af3('0x3a')]['role']=='admin'){if(!_0x2f62d4['body']['newPassword']){throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))](_0x0af3('0x9c'));}return _0xef39f8;}else if(_0x2f62d4[_0x0af3('0x3a')][_0x0af3('0x41')]==_0x0af3('0x3a')){if(!_0x2f62d4[_0x0af3('0x67')][_0x0af3('0x97')]){throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))](_0x0af3('0x9c'));}if(_0xef39f8[_0x0af3('0x41')]!=_0x0af3('0x3b')){throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))](_0x0af3('0x9d'));}return _0xef39f8;}else{throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))](_0x0af3('0x9d'));}}return null;})['then'](handleEntityNotFound(_0x664caf,null))[_0x0af3('0x38')](function(_0x4c7266){return checkPasswordPattern(_0x4c7266,_0x2f62d4[_0x0af3('0x67')][_0x0af3('0x97')],_0x4f0107);})[_0x0af3('0x38')](saveUpdates({'password':_0x2f62d4[_0x0af3('0x67')]['newPassword'],'passwordResetAt':_0x2f62d4[_0x0af3('0x3a')]['id']==_0x2f62d4[_0x0af3('0x68')]['id']?moment():null},null))[_0x0af3('0x38')](respondWithResult(_0x664caf,null))[_0x0af3('0x2e')](handleError(_0x664caf,null));};exports['addQueues']=function(_0x1607cb,_0x54cd31,_0x23e8d4){var _0xf37f32=_0x1607cb['body'][_0x0af3('0x9e')];return db['User'][_0x0af3('0x65')]({'where':{'id':_0x1607cb[_0x0af3('0x68')]['id']},'attributes':['id',_0x0af3('0x42'),'role',_0x0af3('0x9f'),_0x0af3('0xa0'),_0x0af3('0xa1'),'interface']})['then'](handleEntityNotFound(_0x54cd31,null))['then'](function(_0x29e34d){if(_0x29e34d){if(!utils[_0x0af3('0xa2')](_0xf37f32)){throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))](_0x0af3('0xa3'));}return _0x29e34d[_0x0af3('0xa4')+_[_0x0af3('0xa5')](_0xf37f32[_0x0af3('0xa6')]())+'Queues'](_0x1607cb['body'][_0x0af3('0xa7')],{'penalty':_0x1607cb[_0x0af3('0x67')][_0x0af3('0xa8')]||0x0})[_0x0af3('0xa9')](function(_0x3a50b8){for(var _0x251c8e=0x0;_0x251c8e<_0x1607cb[_0x0af3('0x67')]['ids']['length'];_0x251c8e+=0x1){var _0x3c41ad={'UserId':_0x1607cb[_0x0af3('0x68')]['id']};_0x3c41ad[_['capitalize'](_0xf37f32['toLowerCase']())+_0x0af3('0xaa')]=_0x1607cb[_0x0af3('0x67')]['ids'][_0x251c8e];socket[_0x0af3('0xab')](_0x0af3('0x3a')+_[_0x0af3('0xa5')](_0xf37f32['toLowerCase']())+_0x0af3('0xac'),_0x3c41ad);}return _0x3a50b8;})['then'](function(){if(_0xf37f32===_0x0af3('0xad')){return db['VoiceQueue']['findAll']({'where':{'id':_0x1607cb[_0x0af3('0x67')]['ids']||[]},'raw':!![],'attributes':['id',_0x0af3('0x42')]});}})['then'](function(_0x56357f){var _0xc806fe=_0x29e34d[_0x0af3('0x8c')]({'plain':!![]});var _0x109cda=[];if(_0xf37f32===_0x0af3('0xad')&&_0xc806fe[_0x0af3('0x41')]===_0x0af3('0x3b')&&_0xc806fe[_0x0af3('0x9f')]){for(var _0x18fe32=0x0;_0x18fe32<_0x56357f[_0x0af3('0x54')];_0x18fe32+=0x1){_0x109cda[_0x0af3('0xae')]({'membername':_0xc806fe[_0x0af3('0x42')],'UserId':_0xc806fe['id'],'queue_name':_0x56357f[_0x18fe32][_0x0af3('0x42')],'VoiceQueueId':_0x56357f[_0x18fe32]['id'],'interface':_[_0x0af3('0x71')](_0xc806fe[_0x0af3('0xaf')])?util[_0x0af3('0xb0')](_0x0af3('0xb1'),_0xc806fe[_0x0af3('0x42')]):_0xc806fe[_0x0af3('0xaf')],'paused':_0xc806fe['voicePause']||![],'penalty':_0x1607cb[_0x0af3('0x67')][_0x0af3('0xa8')]||0x0});}return BPromise[_0x0af3('0xb2')](_0x109cda,function(_0x814ae8){return db['UserVoiceQueueRt'][_0x0af3('0xb3')](_0x814ae8);});}return _0x29e34d;});}})['then'](respondWithStatusCode(_0x54cd31,null))[_0x0af3('0x2e')](handleError(_0x54cd31,null));};exports[_0x0af3('0xb4')]=function(_0x3c76d9,_0x2d3576,_0x3eb9dc){var _0x1e86d0;return db[_0x0af3('0x47')]['find']({'where':{'id':_0x3c76d9[_0x0af3('0x68')]['id']},'attributes':['id',_0x0af3('0x42'),_0x0af3('0x41')]})['then'](handleEntityNotFound(_0x2d3576,null))['then'](function(_0x15cd15){if(_0x15cd15){_0x1e86d0=_0x15cd15;if(!_0x3c76d9[_0x0af3('0x4f')][_0x0af3('0x9e')]||!utils['isValidChannel'](_0x3c76d9[_0x0af3('0x4f')][_0x0af3('0x9e')])){throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))]('Unknown\x20channel');}return _0x15cd15[_0x0af3('0xb5')+_['capitalize'](_0x3c76d9['query'][_0x0af3('0x9e')]['toLowerCase']())+_0x0af3('0xb6')](_0x3c76d9['query']['ids']);}})[_0x0af3('0x38')](function(_0x473230){for(var _0x598ac4=0x0;_0x598ac4<_0x3c76d9[_0x0af3('0x4f')][_0x0af3('0xa7')]['length'];_0x598ac4+=0x1){var _0x2d56cf={'UserId':_0x3c76d9['params']['id']};_0x2d56cf[_[_0x0af3('0xa5')](_0x3c76d9['query'][_0x0af3('0x9e')][_0x0af3('0xa6')]())+'QueueId']=_0x3c76d9[_0x0af3('0x4f')]['ids'][_0x598ac4];socket[_0x0af3('0xab')](_0x0af3('0x3a')+_[_0x0af3('0xa5')](_0x3c76d9[_0x0af3('0x4f')][_0x0af3('0x9e')][_0x0af3('0xa6')]())+'Queue:remove',_0x2d56cf);}return _0x473230;})['then'](function(){if(_0x3c76d9['query'][_0x0af3('0x9e')]==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x3c76d9['params']['id'],'VoiceQueueId':_0x3c76d9[_0x0af3('0x4f')]['ids']},'individualHooks':!![]})[_0x0af3('0x38')](function(){return _0x1e86d0;});}return _0x1e86d0;})[_0x0af3('0x38')](respondWithStatusCode(_0x2d3576,null))[_0x0af3('0x2e')](handleError(_0x2d3576,null));};exports['addAvatar']=function(_0x587c6c,_0x2dd743,_0x31a442){_0x587c6c[_0x0af3('0x67')][_0x0af3('0xb7')]=_0x587c6c[_0x0af3('0xb8')]['filename'];return db[_0x0af3('0x47')][_0x0af3('0x65')]({'where':{'id':_0x587c6c[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x2dd743,null))['then'](saveUpdates(_0x587c6c[_0x0af3('0x67')],null))[_0x0af3('0x38')](respondWithResult(_0x2dd743,null))['catch'](handleError(_0x2dd743,null));};exports[_0x0af3('0xb9')]=function(_0x5bde16,_0x5aef6e,_0x33772e){var _0x2cf59a=path[_0x0af3('0xba')](config[_0x0af3('0xbb')],_0x0af3('0xbc'));return db[_0x0af3('0x47')]['find']({'where':{'id':_0x5bde16[_0x0af3('0x68')]['id']},'attributes':['id',_0x0af3('0xb7')],'raw':!![]})[_0x0af3('0x38')](handleEntityNotFound(_0x5aef6e,null))[_0x0af3('0x38')](function(_0x2bd77a){if(_0x2bd77a){if(_[_0x0af3('0x71')](_0x2bd77a[_0x0af3('0xb7')])){return _0x5aef6e[_0x0af3('0xbd')](_0x2cf59a);}else{if(!fs['existsSync'](path[_0x0af3('0xba')](config[_0x0af3('0xbb')],'server/files/images/',_0x2bd77a[_0x0af3('0xb7')]))){return _0x5aef6e[_0x0af3('0xbd')](_0x2cf59a);}return _0x5aef6e[_0x0af3('0xbd')](path[_0x0af3('0xba')](config[_0x0af3('0xbb')],_0x0af3('0xbe'),_0x2bd77a[_0x0af3('0xb7')]));}}})[_0x0af3('0x2e')](handleError(_0x5aef6e,null));};exports[_0x0af3('0xbf')]=function(_0x3718b4,_0x1be3e4,_0x359fef){var _0x3d3a97={};var _0x1bae92={};var _0x3492e5;var _0x3db448;return db[_0x0af3('0x47')][_0x0af3('0x94')]({'where':{'id':_0x3718b4[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x1be3e4,null))[_0x0af3('0x38')](function(_0x76dea1){if(_0x76dea1){_0x3492e5=_0x76dea1;_0x1bae92['model']=_[_0x0af3('0x50')](db[_0x0af3('0xc0')][_0x0af3('0x48')]);_0x1bae92[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x3718b4['query']);_0x1bae92[_0x0af3('0x58')]=_['intersection'](_0x1bae92[_0x0af3('0x4c')],_0x1bae92[_0x0af3('0x4f')]);_0x3d3a97[_0x0af3('0x52')]=_['intersection'](_0x1bae92[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x3718b4['query'][_0x0af3('0x53')]));_0x3d3a97[_0x0af3('0x52')]=_0x3d3a97[_0x0af3('0x52')][_0x0af3('0x54')]?_0x3d3a97[_0x0af3('0x52')]:_0x1bae92[_0x0af3('0x4c')];_0x3d3a97[_0x0af3('0x56')]=qs[_0x0af3('0xc1')](_0x3718b4[_0x0af3('0x4f')][_0x0af3('0xc1')]);_0x3d3a97[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_['pick'](_0x3718b4[_0x0af3('0x4f')],_0x1bae92['filters']));if(_0x3718b4[_0x0af3('0x4f')]['filter']){_0x3d3a97[_0x0af3('0x57')]=_['merge'](_0x3d3a97[_0x0af3('0x57')],{'$or':_[_0x0af3('0x3f')](_0x3d3a97[_0x0af3('0x52')],function(_0x23d2ca){var _0x55e9ea={};_0x55e9ea[_0x23d2ca]={'$like':'%'+_0x3718b4[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%'};return _0x55e9ea;})});}_0x3d3a97=_['merge']({},_0x3d3a97,_0x3718b4[_0x0af3('0x5e')]);return _0x3492e5['getContacts'](_0x3d3a97);}})[_0x0af3('0x38')](function(_0x1e2dcc){if(_0x1e2dcc){_0x3db448=_0x1e2dcc[_0x0af3('0x54')];if(_0x3718b4[_0x0af3('0x4f')]['hasOwnProperty'](_0x0af3('0x5f'))){_0x3d3a97['include']=[{'model':db[_0x0af3('0xc2')],'as':_0x0af3('0xc3'),'required':![]},{'model':db[_0x0af3('0xc4')],'as':_0x0af3('0xc5'),'attributes':['id',_0x0af3('0x42'),_0x0af3('0xc6')],'where':_0x3718b4[_0x0af3('0x4f')][_0x0af3('0xc7')]?{'id':_0x3718b4['query'][_0x0af3('0xc7')]}:undefined,'required':_0x3718b4['query'][_0x0af3('0xc7')]?!![]:![]}];}if(!_0x3718b4[_0x0af3('0x4f')]['hasOwnProperty'](_0x0af3('0x55'))){_0x3d3a97[_0x0af3('0x34')]=qs[_0x0af3('0x34')](_0x3718b4['query'][_0x0af3('0x34')]);_0x3d3a97[_0x0af3('0x33')]=qs[_0x0af3('0x33')](_0x3718b4[_0x0af3('0x4f')][_0x0af3('0x33')]);}return _0x3492e5[_0x0af3('0xbf')](_0x3d3a97);}})['then'](function(_0x5c2390){if(_0x5c2390){return _0x5c2390?{'count':_0x3db448,'rows':_0x5c2390}:null;}})[_0x0af3('0x38')](respondWithResult(_0x1be3e4,null))[_0x0af3('0x2e')](handleError(_0x1be3e4,null));};exports[_0x0af3('0xc8')]=function(_0x17be8e,_0x5bd0eb,_0xd364c){var _0x4ff05f;var _0x2f7875;var _0x26e440={};var _0x5f0a7a;return db['User'][_0x0af3('0x94')]({'where':{'id':_0x17be8e[_0x0af3('0x68')]['id']},'attributes':['id','name',_0x0af3('0x41')]})[_0x0af3('0x38')](handleEntityNotFound(_0x5bd0eb,null))[_0x0af3('0x38')](function(_0x24d7d4){if(!utils[_0x0af3('0xa2')](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x9e')])){throw new db[(_0x0af3('0x20'))][(_0x0af3('0x21'))](_0x0af3('0xa3'));}_0x4ff05f=_0x24d7d4;var _0x4c1536={};_0x4c1536[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_[_0x0af3('0xa5')](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x9e')])+'Queue'][_0x0af3('0x48')]);_0x4c1536[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x17be8e['query']);_0x4c1536[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x4c1536['model'],_0x4c1536['query']);_0x26e440['attributes']=_[_0x0af3('0x51')](_0x4c1536['model'],qs[_0x0af3('0x53')](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x26e440[_0x0af3('0x52')]=_0x26e440[_0x0af3('0x52')][_0x0af3('0x54')]?_0x26e440['attributes']:_0x4c1536['model'];_0x26e440[_0x0af3('0x56')]=qs['sort'](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0xc1')]);_0x26e440['where']=qs[_0x0af3('0x58')](_[_0x0af3('0xc9')](_0x17be8e[_0x0af3('0x4f')],_0x4c1536['filters']));if(_0x17be8e[_0x0af3('0x4f')]['filter']){_0x26e440[_0x0af3('0x57')]=_['merge'](_0x26e440['where'],{'$or':_['map'](_0x26e440[_0x0af3('0x52')],function(_0x13e8ca){var _0x3ec246={};_0x3ec246[_0x13e8ca]={'$like':'%'+_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%'};return _0x3ec246;})});}_0x26e440=_[_0x0af3('0x5d')]({},_0x26e440,_0x17be8e[_0x0af3('0x5e')]);switch(_0x4ff05f[_0x0af3('0x41')]){case'admin':return db[_['capitalize'](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x9e')])+_0x0af3('0xca')][_0x0af3('0x61')](_0x26e440);case _0x0af3('0x3a'):case _0x0af3('0x3b'):return _0x4ff05f[_0x0af3('0x8c')+_['capitalize'](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x9e')])+'Queues'](_0x26e440);default:throw new db[(_0x0af3('0x20'))]['ValidationError'](_0x0af3('0xcb'));}})['then'](function(_0x4838ac){_0x5f0a7a=_0x4838ac['length'];if(!_0x17be8e[_0x0af3('0x4f')][_0x0af3('0xcc')](_0x0af3('0x55'))){_0x26e440[_0x0af3('0x34')]=qs[_0x0af3('0x34')](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x34')]);_0x26e440['offset']=qs[_0x0af3('0x33')](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x33')]);}switch(_0x4ff05f[_0x0af3('0x41')]){case _0x0af3('0x6d'):return db[_[_0x0af3('0xa5')](_0x17be8e[_0x0af3('0x4f')]['channel'])+_0x0af3('0xca')]['findAll'](_0x26e440);case _0x0af3('0x3a'):case _0x0af3('0x3b'):return _0x4ff05f[_0x0af3('0x8c')+_[_0x0af3('0xa5')](_0x17be8e[_0x0af3('0x4f')][_0x0af3('0x9e')])+_0x0af3('0xb6')](_0x26e440);}})[_0x0af3('0x38')](function(_0x1b4ef9){return{'count':_0x5f0a7a,'rows':_0x1b4ef9};})['then'](respondWithResult(_0x5bd0eb,null))[_0x0af3('0x2e')](handleError(_0x5bd0eb,null));};exports['getVoiceQueuesRt']=function(_0x28aed0,_0xf252f7,_0x151947){var _0x13c513={};var _0x33dca8={};var _0x248b6a;var _0x25609b;return db[_0x0af3('0x47')][_0x0af3('0x94')]({'where':{'id':_0x28aed0['params']['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0xf252f7,null))[_0x0af3('0x38')](function(_0x11d915){if(_0x11d915){_0x248b6a=_0x11d915;_0x33dca8[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0xcd')]['rawAttributes']);_0x33dca8[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x28aed0[_0x0af3('0x4f')]);_0x33dca8[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x33dca8['model'],_0x33dca8[_0x0af3('0x4f')]);_0x13c513[_0x0af3('0x52')]=_['intersection'](_0x33dca8[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x28aed0[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x13c513['attributes']=_0x13c513['attributes'][_0x0af3('0x54')]?_0x13c513[_0x0af3('0x52')]:_0x33dca8[_0x0af3('0x4c')];_0x13c513['order']=qs[_0x0af3('0xc1')](_0x28aed0['query']['sort']);_0x13c513[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_[_0x0af3('0xc9')](_0x28aed0[_0x0af3('0x4f')],_0x33dca8['filters']));if(_0x28aed0[_0x0af3('0x4f')]['filter']){_0x13c513[_0x0af3('0x57')]=_[_0x0af3('0x5d')](_0x13c513[_0x0af3('0x57')],{'$or':_['map'](_0x13c513[_0x0af3('0x52')],function(_0x3b06e0){var _0x28b497={};_0x28b497[_0x3b06e0]={'$like':'%'+_0x28aed0[_0x0af3('0x4f')]['filter']+'%'};return _0x28b497;})});}_0x13c513=_[_0x0af3('0x5d')]({},_0x13c513,_0x28aed0[_0x0af3('0x5e')]);return _0x248b6a[_0x0af3('0xce')](_0x13c513);}})[_0x0af3('0x38')](function(_0x4d9ce8){if(_0x4d9ce8){_0x25609b=_0x4d9ce8[_0x0af3('0x54')];if(!_0x28aed0[_0x0af3('0x4f')]['hasOwnProperty']('nolimit')){_0x13c513['limit']=qs[_0x0af3('0x34')](_0x28aed0[_0x0af3('0x4f')][_0x0af3('0x34')]);_0x13c513[_0x0af3('0x33')]=qs[_0x0af3('0x33')](_0x28aed0['query'][_0x0af3('0x33')]);}return _0x248b6a[_0x0af3('0xce')](_0x13c513);}})['then'](function(_0x28a79b){if(_0x28a79b){return _0x28a79b?{'count':_0x25609b,'rows':_0x28a79b}:null;}})[_0x0af3('0x38')](respondWithResult(_0xf252f7,null))[_0x0af3('0x2e')](handleError(_0xf252f7,null));};exports[_0x0af3('0xcf')]=function(_0x4a65b7,_0x436a63,_0x24e110){var _0xd38de6={};var _0x130f0c={};var _0x58afca;var _0x42d2de;return db[_0x0af3('0x47')]['findOne']({'where':{'id':_0x4a65b7[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x436a63,null))[_0x0af3('0x38')](function(_0x383fec){if(_0x383fec){_0x58afca=_0x383fec;_0x130f0c[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db['ChatGroup'][_0x0af3('0x48')]);_0x130f0c['query']=_['keys'](_0x4a65b7[_0x0af3('0x4f')]);_0x130f0c[_0x0af3('0x58')]=_['intersection'](_0x130f0c[_0x0af3('0x4c')],_0x130f0c[_0x0af3('0x4f')]);_0xd38de6[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x130f0c[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x4a65b7[_0x0af3('0x4f')][_0x0af3('0x53')]));_0xd38de6[_0x0af3('0x52')]=_0xd38de6[_0x0af3('0x52')][_0x0af3('0x54')]?_0xd38de6['attributes']:_0x130f0c[_0x0af3('0x4c')];_0xd38de6[_0x0af3('0x56')]=qs[_0x0af3('0xc1')](_0x4a65b7[_0x0af3('0x4f')][_0x0af3('0xc1')]);_0xd38de6[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_['pick'](_0x4a65b7[_0x0af3('0x4f')],_0x130f0c['filters']));if(_0x4a65b7[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0xd38de6[_0x0af3('0x57')]=_[_0x0af3('0x5d')](_0xd38de6['where'],{'$or':_[_0x0af3('0x3f')](_0xd38de6[_0x0af3('0x52')],function(_0x51c6ba){var _0xf65ce={};_0xf65ce[_0x51c6ba]={'$like':'%'+_0x4a65b7['query']['filter']+'%'};return _0xf65ce;})});}_0xd38de6=_['merge']({},_0xd38de6,_0x4a65b7['options']);return _0x58afca[_0x0af3('0xcf')](_0xd38de6);}})[_0x0af3('0x38')](function(_0x1b3c81){if(_0x1b3c81){_0x42d2de=_0x1b3c81['length'];if(!_0x4a65b7[_0x0af3('0x4f')][_0x0af3('0xcc')](_0x0af3('0x55'))){_0xd38de6['limit']=qs[_0x0af3('0x34')](_0x4a65b7[_0x0af3('0x4f')][_0x0af3('0x34')]);_0xd38de6[_0x0af3('0x33')]=qs['offset'](_0x4a65b7[_0x0af3('0x4f')]['offset']);}return _0x58afca[_0x0af3('0xcf')](_0xd38de6);}})['then'](function(_0x106067){if(_0x106067){return _0x106067?{'count':_0x42d2de,'rows':_0x106067}:null;}})[_0x0af3('0x38')](respondWithResult(_0x436a63,null))[_0x0af3('0x2e')](handleError(_0x436a63,null));};exports['getRecordings']=function(_0x3e99ca,_0x40976c,_0x5a322c){var _0x38f6df={'raw':!![],'where':{}};var _0x2dd8b8={};var _0x363756={'count':0x0,'rows':[]};return db[_0x0af3('0x47')][_0x0af3('0x94')]({'where':{'id':_0x3e99ca[_0x0af3('0x68')]['id']}})['then'](handleEntityNotFound(_0x40976c,null))[_0x0af3('0x38')](function(_0x207e01){if(_0x207e01){_0x2dd8b8[_0x0af3('0x4c')]=_['keys'](db[_0x0af3('0xd0')][_0x0af3('0x48')]);_0x2dd8b8[_0x0af3('0x4f')]=_['keys'](_0x3e99ca[_0x0af3('0x4f')]);_0x2dd8b8['filters']=_['intersection'](_0x2dd8b8['model'],_0x2dd8b8[_0x0af3('0x4f')]);_0x38f6df[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x2dd8b8[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x3e99ca['query']['fields']));_0x38f6df[_0x0af3('0x52')]=_0x38f6df['attributes'][_0x0af3('0x54')]?_0x38f6df[_0x0af3('0x52')]:_0x2dd8b8[_0x0af3('0x4c')];if(!_0x3e99ca[_0x0af3('0x4f')][_0x0af3('0xcc')](_0x0af3('0x55'))){_0x38f6df[_0x0af3('0x34')]=qs[_0x0af3('0x34')](_0x3e99ca['query'][_0x0af3('0x34')]);_0x38f6df[_0x0af3('0x33')]=qs[_0x0af3('0x33')](_0x3e99ca['query']['offset']);}_0x38f6df[_0x0af3('0x56')]=qs[_0x0af3('0xc1')](_0x3e99ca['query']['sort']);_0x38f6df[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_[_0x0af3('0xc9')](_0x3e99ca['query'],_0x2dd8b8['filters']));_0x38f6df[_0x0af3('0x57')][_0x0af3('0xd1')]=_0x207e01['id'];if(_0x3e99ca[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0x38f6df[_0x0af3('0x57')]=_[_0x0af3('0x5d')](_0x38f6df[_0x0af3('0x57')],{'$or':_[_0x0af3('0x3f')](_0x38f6df[_0x0af3('0x52')],function(_0xa8af23){var _0x3c1d7e={};_0x3c1d7e[_0xa8af23]={'$like':'%'+_0x3e99ca[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%'};return _0x3c1d7e;})});}_0x38f6df=_[_0x0af3('0x5d')]({},_0x38f6df,_0x3e99ca['options']);return db[_0x0af3('0xd0')][_0x0af3('0x32')]({'where':_0x38f6df[_0x0af3('0x57')]})['then'](function(_0x5e736a){_0x363756[_0x0af3('0x32')]=_0x5e736a;if(_0x3e99ca[_0x0af3('0x4f')][_0x0af3('0x5f')]){_0x38f6df['include']=[{'all':!![]}];}return db[_0x0af3('0xd0')][_0x0af3('0x61')](_0x38f6df);})['then'](function(_0x3bc018){_0x363756[_0x0af3('0x62')]=_0x3bc018;return _0x363756;});}})[_0x0af3('0x38')](respondWithFilteredResult(_0x40976c,_0x38f6df))['catch'](handleError(_0x40976c,null));};exports[_0x0af3('0xd2')]=function(_0x5d04b4,_0x1f1ef8,_0x156df1){var _0x530180={'raw':!![],'where':{}};var _0x4cef19={};var _0x4abaa5={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x5d04b4[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x1f1ef8,null))[_0x0af3('0x38')](function(_0x204567){if(_0x204567){_0x4cef19[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0xd3')][_0x0af3('0x48')]);_0x4cef19[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x5d04b4[_0x0af3('0x4f')]);_0x4cef19[_0x0af3('0x58')]=_['intersection'](_0x4cef19[_0x0af3('0x4c')],_0x4cef19['query']);_0x530180[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x4cef19['model'],qs[_0x0af3('0x53')](_0x5d04b4[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x530180['attributes']=_0x530180[_0x0af3('0x52')]['length']?_0x530180['attributes']:_0x4cef19['model'];if(!_0x5d04b4[_0x0af3('0x4f')]['hasOwnProperty'](_0x0af3('0x55'))){_0x530180[_0x0af3('0x34')]=qs[_0x0af3('0x34')](_0x5d04b4['query']['limit']);_0x530180['offset']=qs['offset'](_0x5d04b4['query'][_0x0af3('0x33')]);}_0x530180[_0x0af3('0x56')]=qs[_0x0af3('0xc1')](_0x5d04b4[_0x0af3('0x4f')][_0x0af3('0xc1')]);_0x530180[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_[_0x0af3('0xc9')](_0x5d04b4[_0x0af3('0x4f')],_0x4cef19[_0x0af3('0x58')]));_0x530180[_0x0af3('0x57')][_0x0af3('0xd1')]=_0x204567['id'];if(_0x5d04b4[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0x530180['where']=_[_0x0af3('0x5d')](_0x530180[_0x0af3('0x57')],{'$or':_[_0x0af3('0x3f')](_0x530180[_0x0af3('0x52')],function(_0x42c54d){var _0x30bc3f={};_0x30bc3f[_0x42c54d]={'$like':'%'+_0x5d04b4[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%'};return _0x30bc3f;})});}_0x530180=_[_0x0af3('0x5d')]({},_0x530180,_0x5d04b4[_0x0af3('0x5e')]);return db[_0x0af3('0xd3')][_0x0af3('0x32')]({'where':_0x530180[_0x0af3('0x57')]})['then'](function(_0x1744ae){_0x4abaa5[_0x0af3('0x32')]=_0x1744ae;if(_0x5d04b4[_0x0af3('0x4f')][_0x0af3('0x5f')]){_0x530180[_0x0af3('0x60')]=[{'all':!![]}];}return db[_0x0af3('0xd3')][_0x0af3('0x61')](_0x530180);})[_0x0af3('0x38')](function(_0x3e20f5){_0x4abaa5[_0x0af3('0x62')]=_0x3e20f5;return _0x4abaa5;});}})[_0x0af3('0x38')](respondWithFilteredResult(_0x1f1ef8,_0x530180))['catch'](handleError(_0x1f1ef8,null));};exports[_0x0af3('0xd4')]=function(_0xaf6125,_0x308d15,_0x489753){var _0x20a397={};var _0x1e66d2={};var _0x4b7eba;var _0xb60543;return db['User'][_0x0af3('0x94')]({'where':{'id':_0xaf6125[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x308d15,null))[_0x0af3('0x38')](function(_0x255af0){if(_0x255af0){_0x4b7eba=_0x255af0;_0x1e66d2[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0xd5')][_0x0af3('0x48')]);_0x1e66d2[_0x0af3('0x4f')]=_['keys'](_0xaf6125['query']);_0x1e66d2[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x1e66d2[_0x0af3('0x4c')],_0x1e66d2[_0x0af3('0x4f')]);_0x20a397[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x1e66d2['model'],qs[_0x0af3('0x53')](_0xaf6125[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x20a397['attributes']=_0x20a397[_0x0af3('0x52')]['length']?_0x20a397[_0x0af3('0x52')]:_0x1e66d2[_0x0af3('0x4c')];_0x20a397['order']=qs[_0x0af3('0xc1')](_0xaf6125['query'][_0x0af3('0xc1')]);_0x20a397[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_[_0x0af3('0xc9')](_0xaf6125[_0x0af3('0x4f')],_0x1e66d2['filters']));if(_0xaf6125[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0x20a397[_0x0af3('0x57')]=_[_0x0af3('0x5d')](_0x20a397[_0x0af3('0x57')],{'$or':_[_0x0af3('0x3f')](_0x20a397[_0x0af3('0x52')],function(_0x4c110f){var _0xb918af={};_0xb918af[_0x4c110f]={'$like':'%'+_0xaf6125['query']['filter']+'%'};return _0xb918af;})});}_0x20a397=_[_0x0af3('0x5d')]({},_0x20a397,_0xaf6125[_0x0af3('0x5e')]);return _0x4b7eba[_0x0af3('0xd4')](_0x20a397);}})[_0x0af3('0x38')](function(_0x2a7817){if(_0x2a7817){_0xb60543=_0x2a7817[_0x0af3('0x54')];if(!_0xaf6125[_0x0af3('0x4f')][_0x0af3('0xcc')](_0x0af3('0x55'))){_0x20a397['limit']=qs[_0x0af3('0x34')](_0xaf6125[_0x0af3('0x4f')]['limit']);_0x20a397[_0x0af3('0x33')]=qs[_0x0af3('0x33')](_0xaf6125[_0x0af3('0x4f')]['offset']);}return _0x4b7eba[_0x0af3('0xd4')](_0x20a397);}})[_0x0af3('0x38')](function(_0x543c16){if(_0x543c16){return _0x543c16?{'count':_0xb60543,'rows':_0x543c16}:null;}})[_0x0af3('0x38')](respondWithResult(_0x308d15,null))['catch'](handleError(_0x308d15,null));};exports[_0x0af3('0xd6')]=function(_0x325052,_0x460466,_0x1288df){var _0xf56e7d={};var _0x2736e5={};var _0x497a65;var _0x499143;return db[_0x0af3('0x47')][_0x0af3('0x94')]({'where':{'id':_0x325052[_0x0af3('0x68')]['id']}})['then'](handleEntityNotFound(_0x460466,null))[_0x0af3('0x38')](function(_0x437fbd){if(_0x437fbd){_0x497a65=_0x437fbd;_0x2736e5[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0xd7')][_0x0af3('0x48')]);_0x2736e5[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x325052['query']);_0x2736e5[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x2736e5['model'],_0x2736e5[_0x0af3('0x4f')]);_0xf56e7d['attributes']=_[_0x0af3('0x51')](_0x2736e5[_0x0af3('0x4c')],qs['fields'](_0x325052['query'][_0x0af3('0x53')]));_0xf56e7d['attributes']=_0xf56e7d[_0x0af3('0x52')]['length']?_0xf56e7d[_0x0af3('0x52')]:_0x2736e5[_0x0af3('0x4c')];_0xf56e7d[_0x0af3('0x56')]=qs[_0x0af3('0xc1')](_0x325052[_0x0af3('0x4f')][_0x0af3('0xc1')]);_0xf56e7d[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_[_0x0af3('0xc9')](_0x325052[_0x0af3('0x4f')],_0x2736e5[_0x0af3('0x58')]));if(_0x325052[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0xf56e7d[_0x0af3('0x57')]=_[_0x0af3('0x5d')](_0xf56e7d['where'],{'$or':_[_0x0af3('0x3f')](_0xf56e7d[_0x0af3('0x52')],function(_0x576fe1){var _0xf35cd8={};_0xf35cd8[_0x576fe1]={'$like':'%'+_0x325052[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%'};return _0xf35cd8;})});}_0xf56e7d=_[_0x0af3('0x5d')]({},_0xf56e7d,_0x325052[_0x0af3('0x5e')]);return _0x497a65[_0x0af3('0xd6')](_0xf56e7d);}})[_0x0af3('0x38')](function(_0x272c1a){if(_0x272c1a){_0x499143=_0x272c1a['length'];if(!_0x325052[_0x0af3('0x4f')][_0x0af3('0xcc')]('nolimit')){_0xf56e7d[_0x0af3('0x34')]=qs[_0x0af3('0x34')](_0x325052['query'][_0x0af3('0x34')]);_0xf56e7d[_0x0af3('0x33')]=qs[_0x0af3('0x33')](_0x325052[_0x0af3('0x4f')][_0x0af3('0x33')]);}return _0x497a65[_0x0af3('0xd6')](_0xf56e7d);}})[_0x0af3('0x38')](function(_0x1443b2){if(_0x1443b2){return _0x1443b2?{'count':_0x499143,'rows':_0x1443b2}:null;}})['then'](respondWithResult(_0x460466,null))[_0x0af3('0x2e')](handleError(_0x460466,null));};exports[_0x0af3('0xd8')]=function(_0x20c713,_0x4a72db,_0x5a1054){var _0x5ba79b={'raw':!![],'where':{}};var _0x5b7a7b={};var _0x1510d1={'count':0x0,'rows':[]};return db[_0x0af3('0x47')]['findOne']({'where':{'id':_0x20c713[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x4a72db,null))[_0x0af3('0x38')](function(_0x1883ce){if(_0x1883ce){_0x5b7a7b[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0xd9')][_0x0af3('0x48')]);_0x5b7a7b['query']=_[_0x0af3('0x50')](_0x20c713[_0x0af3('0x4f')]);_0x5b7a7b[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x5b7a7b[_0x0af3('0x4c')],_0x5b7a7b[_0x0af3('0x4f')]);_0x5ba79b[_0x0af3('0x52')]=_['intersection'](_0x5b7a7b[_0x0af3('0x4c')],qs['fields'](_0x20c713[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x5ba79b['attributes']=_0x5ba79b[_0x0af3('0x52')]['length']?_0x5ba79b[_0x0af3('0x52')]:_0x5b7a7b['model'];if(!_0x20c713[_0x0af3('0x4f')][_0x0af3('0xcc')](_0x0af3('0x55'))){_0x5ba79b['limit']=qs[_0x0af3('0x34')](_0x20c713['query'][_0x0af3('0x34')]);_0x5ba79b['offset']=qs[_0x0af3('0x33')](_0x20c713[_0x0af3('0x4f')][_0x0af3('0x33')]);}_0x5ba79b['order']=qs[_0x0af3('0xc1')](_0x20c713[_0x0af3('0x4f')]['sort']);_0x5ba79b[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_[_0x0af3('0xc9')](_0x20c713[_0x0af3('0x4f')],_0x5b7a7b[_0x0af3('0x58')]));_0x5ba79b[_0x0af3('0x57')]['UserId']=_0x1883ce['id'];if(_0x20c713[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0x5ba79b[_0x0af3('0x57')]=_['merge'](_0x5ba79b[_0x0af3('0x57')],{'$or':_['map'](_0x5ba79b['attributes'],function(_0x15ff9a){var _0x20172f={};_0x20172f[_0x15ff9a]={'$like':'%'+_0x20c713['query'][_0x0af3('0x3d')]+'%'};return _0x20172f;})});}_0x5ba79b=_[_0x0af3('0x5d')]({},_0x5ba79b,_0x20c713[_0x0af3('0x5e')]);return db[_0x0af3('0xd9')]['count']({'where':_0x5ba79b[_0x0af3('0x57')]})['then'](function(_0x51c269){_0x1510d1[_0x0af3('0x32')]=_0x51c269;if(_0x20c713[_0x0af3('0x4f')][_0x0af3('0x5f')]){_0x5ba79b[_0x0af3('0x60')]=[{'all':!![]}];}return db[_0x0af3('0xd9')][_0x0af3('0x61')](_0x5ba79b);})[_0x0af3('0x38')](function(_0x1c9595){_0x1510d1['rows']=_0x1c9595;return _0x1510d1;});}})[_0x0af3('0x38')](respondWithFilteredResult(_0x4a72db,_0x5ba79b))[_0x0af3('0x2e')](handleError(_0x4a72db,null));};exports[_0x0af3('0xda')]=function(_0x38846d,_0x3dab65,_0x84c4dc){var _0x224cad={};var _0x36f853={};var _0x1ab35a;var _0x367914;return db[_0x0af3('0x47')][_0x0af3('0x94')]({'where':{'id':_0x38846d['params']['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x3dab65,null))['then'](function(_0x37c413){if(_0x37c413){_0x1ab35a=_0x37c413;_0x36f853[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0xdb')][_0x0af3('0x48')]);_0x36f853[_0x0af3('0x4f')]=_['keys'](_0x38846d['query']);_0x36f853[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x36f853[_0x0af3('0x4c')],_0x36f853[_0x0af3('0x4f')]);_0x224cad[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x36f853[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x38846d[_0x0af3('0x4f')]['fields']));_0x224cad[_0x0af3('0x52')]=_0x224cad[_0x0af3('0x52')][_0x0af3('0x54')]?_0x224cad['attributes']:_0x36f853[_0x0af3('0x4c')];_0x224cad[_0x0af3('0x56')]=qs[_0x0af3('0xc1')](_0x38846d[_0x0af3('0x4f')]['sort']);_0x224cad[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_['pick'](_0x38846d[_0x0af3('0x4f')],_0x36f853['filters']));if(_0x38846d[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0x224cad[_0x0af3('0x57')]=_[_0x0af3('0x5d')](_0x224cad[_0x0af3('0x57')],{'$or':_[_0x0af3('0x3f')](_0x224cad[_0x0af3('0x52')],function(_0x1869db){var _0x5412b4={};_0x5412b4[_0x1869db]={'$like':'%'+_0x38846d[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%'};return _0x5412b4;})});}_0x224cad=_[_0x0af3('0x5d')]({},_0x224cad,_0x38846d[_0x0af3('0x5e')]);return _0x1ab35a[_0x0af3('0xda')](_0x224cad);}})['then'](function(_0x4e4ae4){if(_0x4e4ae4){_0x367914=_0x4e4ae4[_0x0af3('0x54')];if(!_0x38846d[_0x0af3('0x4f')][_0x0af3('0xcc')](_0x0af3('0x55'))){_0x224cad['limit']=qs[_0x0af3('0x34')](_0x38846d[_0x0af3('0x4f')][_0x0af3('0x34')]);_0x224cad[_0x0af3('0x33')]=qs['offset'](_0x38846d[_0x0af3('0x4f')]['offset']);}return _0x1ab35a[_0x0af3('0xda')](_0x224cad);}})['then'](function(_0xc8540c){if(_0xc8540c){return _0xc8540c?{'count':_0x367914,'rows':_0xc8540c}:null;}})[_0x0af3('0x38')](respondWithResult(_0x3dab65,null))[_0x0af3('0x2e')](handleError(_0x3dab65,null));};exports[_0x0af3('0xdc')]=function(_0x862d6c,_0x2029d8,_0x370fae){var _0x262148={};var _0x288bdd={};var _0x399779;var _0x433ead;return db[_0x0af3('0x47')]['findOne']({'where':{'id':_0x862d6c[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x2029d8,null))[_0x0af3('0x38')](function(_0xec1f3b){if(_0xec1f3b){_0x399779=_0xec1f3b;_0x288bdd[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0xdd')]['rawAttributes']);_0x288bdd[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x862d6c[_0x0af3('0x4f')]);_0x288bdd[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x288bdd[_0x0af3('0x4c')],_0x288bdd['query']);_0x262148[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x288bdd[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x862d6c[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x262148['attributes']=_0x262148['attributes']['length']?_0x262148[_0x0af3('0x52')]:_0x288bdd['model'];_0x262148[_0x0af3('0x56')]=qs[_0x0af3('0xc1')](_0x862d6c['query']['sort']);_0x262148[_0x0af3('0x57')]=qs['filters'](_[_0x0af3('0xc9')](_0x862d6c['query'],_0x288bdd[_0x0af3('0x58')]));if(_0x862d6c[_0x0af3('0x4f')]['filter']){_0x262148['where']=_[_0x0af3('0x5d')](_0x262148[_0x0af3('0x57')],{'$or':_['map'](_0x262148['attributes'],function(_0x2a992f){var _0x287452={};_0x287452[_0x2a992f]={'$like':'%'+_0x862d6c['query'][_0x0af3('0x3d')]+'%'};return _0x287452;})});}_0x262148=_[_0x0af3('0x5d')]({},_0x262148,_0x862d6c['options']);return _0x399779[_0x0af3('0xdc')](_0x262148);}})[_0x0af3('0x38')](function(_0x15e440){if(_0x15e440){_0x433ead=_0x15e440[_0x0af3('0x54')];if(!_0x862d6c[_0x0af3('0x4f')][_0x0af3('0xcc')](_0x0af3('0x55'))){_0x262148['limit']=qs[_0x0af3('0x34')](_0x862d6c['query'][_0x0af3('0x34')]);_0x262148['offset']=qs[_0x0af3('0x33')](_0x862d6c[_0x0af3('0x4f')][_0x0af3('0x33')]);}return _0x399779[_0x0af3('0xdc')](_0x262148);}})[_0x0af3('0x38')](function(_0x5e10e2){if(_0x5e10e2){return _0x5e10e2?{'count':_0x433ead,'rows':_0x5e10e2}:null;}})['then'](respondWithResult(_0x2029d8,null))[_0x0af3('0x2e')](handleError(_0x2029d8,null));};exports[_0x0af3('0xde')]=function(_0xad6c57,_0x207dbd,_0x3d0267){var _0x30d6b1={};var _0x2e099f={};var _0x22f9de;var _0x7380cd;return db[_0x0af3('0x47')]['findOne']({'where':{'id':_0xad6c57[_0x0af3('0x68')]['id']}})['then'](handleEntityNotFound(_0x207dbd,null))['then'](function(_0x4080b5){if(_0x4080b5){_0x22f9de=_0x4080b5;_0x2e099f['model']=_[_0x0af3('0x50')](db[_0x0af3('0xdf')][_0x0af3('0x48')]);_0x2e099f['query']=_[_0x0af3('0x50')](_0xad6c57[_0x0af3('0x4f')]);_0x2e099f['filters']=_[_0x0af3('0x51')](_0x2e099f[_0x0af3('0x4c')],_0x2e099f[_0x0af3('0x4f')]);_0x30d6b1[_0x0af3('0x52')]=_['intersection'](_0x2e099f[_0x0af3('0x4c')],qs['fields'](_0xad6c57['query']['fields']));_0x30d6b1[_0x0af3('0x52')]=_0x30d6b1[_0x0af3('0x52')][_0x0af3('0x54')]?_0x30d6b1[_0x0af3('0x52')]:_0x2e099f[_0x0af3('0x4c')];_0x30d6b1[_0x0af3('0x56')]=qs['sort'](_0xad6c57[_0x0af3('0x4f')][_0x0af3('0xc1')]);_0x30d6b1[_0x0af3('0x57')]=qs['filters'](_[_0x0af3('0xc9')](_0xad6c57['query'],_0x2e099f[_0x0af3('0x58')]));if(_0xad6c57[_0x0af3('0x4f')]['filter']){_0x30d6b1['where']=_[_0x0af3('0x5d')](_0x30d6b1['where'],{'$or':_['map'](_0x30d6b1['attributes'],function(_0x2bc07a){var _0x365f2c={};_0x365f2c[_0x2bc07a]={'$like':'%'+_0xad6c57['query']['filter']+'%'};return _0x365f2c;})});}_0x30d6b1=_[_0x0af3('0x5d')]({},_0x30d6b1,_0xad6c57[_0x0af3('0x5e')]);return _0x22f9de['getWhatsappInteractions'](_0x30d6b1);}})[_0x0af3('0x38')](function(_0x2b011b){if(_0x2b011b){_0x7380cd=_0x2b011b[_0x0af3('0x54')];if(!_0xad6c57['query']['hasOwnProperty']('nolimit')){_0x30d6b1['limit']=qs['limit'](_0xad6c57[_0x0af3('0x4f')][_0x0af3('0x34')]);_0x30d6b1['offset']=qs['offset'](_0xad6c57[_0x0af3('0x4f')][_0x0af3('0x33')]);}return _0x22f9de[_0x0af3('0xde')](_0x30d6b1);}})[_0x0af3('0x38')](function(_0x55bc5b){if(_0x55bc5b){return _0x55bc5b?{'count':_0x7380cd,'rows':_0x55bc5b}:null;}})[_0x0af3('0x38')](respondWithResult(_0x207dbd,null))[_0x0af3('0x2e')](handleError(_0x207dbd,null));};exports['login']=function(_0x2056ea,_0xb62e95,_0x1f3e21){var _0x2ecf2e;var _0x356c52;var _0x4ffff0;var _0x6793cb=!_[_0x0af3('0x71')](_0x2056ea[_0x0af3('0x68')]['id'])?_0x2056ea['params']['id']:!_[_0x0af3('0x71')](_0x2056ea[_0x0af3('0x3a')]['id'])?_0x2056ea[_0x0af3('0x3a')]['id']:null;return db[_0x0af3('0x47')]['find']({'where':{'id':_0x6793cb,'role':{'$or':['admin',_0x0af3('0x3a'),_0x0af3('0x3b')]}},'attributes':['id',_0x0af3('0x42'),_0x0af3('0xe0'),_0x0af3('0xe1'),_0x0af3('0x41'),'internal','loginInPause']})[_0x0af3('0x38')](function(_0x3f562b){if(_0x3f562b){if(_0x3f562b[_0x0af3('0x41')]===_0x0af3('0x3b')){_0x2ecf2e=_0x3f562b;if(_0x2056ea[_0x0af3('0x67')][_0x0af3('0xaf')]){_0x4ffff0=util['format'](_0x0af3('0xe2'),_0x2ecf2e[_0x2056ea[_0x0af3('0x67')][_0x0af3('0xaf')]]);}else if(_0x2056ea[_0x0af3('0x67')][_0x0af3('0xe3')]){_0x4ffff0=util[_0x0af3('0xb0')](_0x0af3('0xb1'),_0x2056ea[_0x0af3('0x67')][_0x0af3('0xe3')]);}else{_0x4ffff0=util[_0x0af3('0xb0')](_0x0af3('0xb1'),_0x2ecf2e['name']);}socket['to'](util['format'](_0x0af3('0xe4'),_0x2ecf2e[_0x0af3('0x42')]))[_0x0af3('0xab')](_0x0af3('0xe5'),{'ip':_0x2056ea[_0x0af3('0xe6')]['x-forwarded-for']||_0x2056ea[_0x0af3('0xe7')]['remoteAddress']||_0x2056ea[_0x0af3('0xe8')]['remoteAddress']||_0x2056ea[_0x0af3('0xe7')]['socket'][_0x0af3('0xe9')]});return db['UserVoiceQueueRt'][_0x0af3('0x39')]({'where':{'membername':_0x2ecf2e[_0x0af3('0x42')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x0af3('0x21'))](_0x0af3('0xea'));}})[_0x0af3('0x38')](function(){if(_0x2ecf2e){return _0x2ecf2e['getVoiceQueues']({'raw':!![]});}})[_0x0af3('0x38')](function(_0x2b694c){if(_0x2ecf2e){var _0x59eb36=[];if(_0x2b694c){_0x356c52=_0x2b694c;if(_0x356c52[_0x0af3('0x54')]){for(var _0x1abbe2=0x0;_0x1abbe2<_0x356c52[_0x0af3('0x54')];_0x1abbe2++){_0x59eb36[_0x0af3('0xae')]({'membername':_0x2ecf2e[_0x0af3('0x42')],'UserId':_0x2ecf2e['id'],'queue_name':_0x356c52[_0x1abbe2][_0x0af3('0x42')],'VoiceQueueId':_0x356c52[_0x1abbe2]['id'],'interface':_0x4ffff0,'paused':_0x2ecf2e['loginInPause']||![],'penalty':_0x356c52[_0x1abbe2][_0x0af3('0xeb')]||0x0});}return BPromise[_0x0af3('0xb2')](_0x59eb36,function(_0x515a5c){return db[_0x0af3('0xcd')][_0x0af3('0xb3')](_0x515a5c);});}}}})[_0x0af3('0x38')](function(){if(_0x2ecf2e){return db[_0x0af3('0xec')][_0x0af3('0x61')]({'where':{'membername':_0x2ecf2e[_0x0af3('0x42')],'exitAt':null}});}})['then'](function(_0x46ecc5){if(_0x2ecf2e){var _0x590aa0=[];_0x46ecc5['forEach'](function(_0x280b61){_0x590aa0[_0x0af3('0xae')](_0x280b61['update']({'exitAt':moment()[_0x0af3('0xb0')](_0x0af3('0xed'))}));});return BPromise[_0x0af3('0xee')](_0x590aa0);}})[_0x0af3('0x38')](function(){if(_0x2ecf2e){var _0xd4fb42=[];var _0x1942ee=[];var _0x56c4c2=utils[_0x0af3('0xef')]();var _0x23b41={'membername':_0x2ecf2e['name'],'interface':_0x4ffff0,'enterAt':moment()['format'](_0x0af3('0xed')),'role':_0x2ecf2e['role'],'internal':_0x2ecf2e[_0x0af3('0x74')]};_0x56c4c2[_0x0af3('0xf0')](function(_0x2ed523){_0xd4fb42[_0x0af3('0xae')](_[_0x0af3('0x5d')]({'channel':_0x2ed523,'type':'LOGIN','data1':_0x2056ea['body'][_0x0af3('0xf1')],'data2':_0x4ffff0},_0x23b41));if(_0x2ecf2e[_0x0af3('0xa0')]){_0x1942ee[_0x0af3('0xae')](_[_0x0af3('0x5d')]({'channel':_0x2ed523,'type':'PAUSE','data1':_0x0af3('0xf2')},_0x23b41));}});return db['MemberReport'][_0x0af3('0x66')](_0xd4fb42['concat'](_0x1942ee),{'individualHooks':!![]});}})['then'](function(){if(_0x2ecf2e){return _0x2ecf2e[_0x0af3('0x37')]({'online':!![],'lastLoginAt':moment()[_0x0af3('0xb0')](_0x0af3('0xed')),'voicePause':_0x2ecf2e[_0x0af3('0xa0')]||![],'mailPause':_0x2ecf2e[_0x0af3('0xa0')]||![],'chatPause':_0x2ecf2e[_0x0af3('0xa0')]||![],'faxPause':_0x2ecf2e[_0x0af3('0xa0')]||![],'smsPause':_0x2ecf2e[_0x0af3('0xa0')]||![],'openchannelPause':_0x2ecf2e[_0x0af3('0xa0')]||![],'whatsappPause':_0x2ecf2e['loginInPause']||![],'pauseType':_0x2ecf2e[_0x0af3('0xa0')]?'LOGININPAUSE':null,'interface':_0x4ffff0,'lastPauseAt':moment()[_0x0af3('0xb0')](_0x0af3('0xed'))});}})[_0x0af3('0x38')](function(_0x3d3877){if(_0x2056ea[_0x0af3('0xf3')]){return _0x1f3e21();}else{return BPromise[_0x0af3('0xf4')](_0x3d3877)['then'](respondWithResult(_0xb62e95,null));}})[_0x0af3('0x2e')](handleError(_0xb62e95,null));};exports[_0x0af3('0xf5')]=function(_0x470fcc,_0x24c7b3,_0x3df766){var _0x25e549;return db[_0x0af3('0x47')][_0x0af3('0x65')]({'where':{'id':_0x470fcc[_0x0af3('0x68')]['id'],'role':_0x0af3('0x3b')},'attributes':['id',_0x0af3('0x42'),_0x0af3('0x41')]})[_0x0af3('0x38')](handleEntityNotFound(_0x24c7b3,null))[_0x0af3('0x38')](function(_0x3c1297){if(_0x3c1297){_0x25e549=_0x3c1297;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x25e549[_0x0af3('0x42')]},'individualHooks':!![]});}})[_0x0af3('0x38')](function(){return db[_0x0af3('0xec')]['findAll']({'where':{'membername':_0x25e549[_0x0af3('0x42')],'exitAt':null}});})[_0x0af3('0x38')](function(_0x181221){var _0x1a8642=[];_0x181221[_0x0af3('0xf0')](function(_0x27f2b1){_0x1a8642[_0x0af3('0xae')](_0x27f2b1['update']({'exitAt':moment()['format'](_0x0af3('0xed'))}));});return BPromise[_0x0af3('0xee')](_0x1a8642);})[_0x0af3('0x38')](function(){return _0x25e549[_0x0af3('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0af3('0x38')](respondWithResult(_0x24c7b3,null))[_0x0af3('0x2e')](handleError(_0x24c7b3,null));};exports[_0x0af3('0xf6')]=function(_0x575436,_0x14bef3,_0x1e5ffb){var _0x18e349;return db[_0x0af3('0xcd')][_0x0af3('0x37')]({'paused':0x1},{'where':{'UserId':_0x575436['params']['id']},'individualHooks':!![]})[_0x0af3('0x38')](function(){return db[_0x0af3('0x47')]['find']({'where':{'id':_0x575436[_0x0af3('0x68')]['id'],'role':_0x0af3('0x3b')},'attributes':['id',_0x0af3('0x42'),_0x0af3('0x41'),_0x0af3('0x74'),_0x0af3('0xaf')]});})[_0x0af3('0x38')](handleEntityNotFound(_0x14bef3,null))[_0x0af3('0x38')](function(_0x128b71){if(_0x128b71){_0x18e349=_0x128b71;return respondWithRpcPromise(_0x0af3('0xf7'),'pause',{'id':_0x18e349['id'],'name':_0x18e349[_0x0af3('0x42')],'pause':!![]});}})[_0x0af3('0x38')](function(){if(_0x18e349){return db[_0x0af3('0xec')]['findAll']({'where':{'membername':_0x18e349['name'],'type':'PAUSE','exitAt':null}});}})[_0x0af3('0x38')](function(_0x4abc70){if(_0x4abc70[_0x0af3('0x54')]){var _0x376765=moment()[_0x0af3('0xb0')](_0x0af3('0xed'));for(var _0x629b91=0x0,_0x2c6bdf=_0x4abc70['length'];_0x629b91<_0x2c6bdf;_0x629b91++){_0x4abc70[_0x629b91][_0x0af3('0xf8')]({'exitAt':_0x376765});}}})[_0x0af3('0x38')](function(){var _0x5789ae=[];var _0x10f8f7=utils['getChannels']();_0x10f8f7['forEach'](function(_0x297fdb){_0x5789ae['push']({'channel':_0x297fdb,'membername':_0x18e349['name'],'interface':_[_0x0af3('0x71')](_0x18e349[_0x0af3('0xaf')])?util[_0x0af3('0xb0')](_0x0af3('0xb1'),_0x18e349['name']):_0x18e349[_0x0af3('0xaf')],'type':_0x0af3('0xf9'),'enterAt':moment()[_0x0af3('0xb0')](_0x0af3('0xed')),'data1':_0x575436[_0x0af3('0x67')][_0x0af3('0x4a')]||_0x0af3('0xfa'),'role':_0x18e349['role'],'internal':_0x18e349[_0x0af3('0x74')]});});return db[_0x0af3('0xec')][_0x0af3('0x66')](_0x5789ae,{'individualHooks':!![]});})[_0x0af3('0x38')](function(){return _0x18e349[_0x0af3('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x575436['body'][_0x0af3('0x4a')]||_0x0af3('0xfa'),'lastPauseAt':moment()['format'](_0x0af3('0xed'))});})[_0x0af3('0x38')](respondWithResult(_0x14bef3,null))[_0x0af3('0x2e')](handleError(_0x14bef3,null));};exports[_0x0af3('0xfb')]=function(_0x2ac43d,_0x553464,_0x39c386){var _0x922378;return db[_0x0af3('0x47')][_0x0af3('0x65')]({'where':{'id':_0x2ac43d[_0x0af3('0x68')]['id']},'attributes':['id','name',_0x0af3('0x41'),'voicePause',_0x0af3('0xfc'),_0x0af3('0xfd'),_0x0af3('0xfe'),_0x0af3('0xff'),_0x0af3('0x100'),_0x0af3('0x101'),_0x0af3('0x102'),_0x0af3('0x103')]})[_0x0af3('0x38')](handleEntityNotFound(_0x553464,null))['then'](function(_0x5f3865){if(_0x5f3865){_0x922378=_0x5f3865;if(_0x2ac43d[_0x0af3('0x67')][_0x0af3('0x9e')]&&!utils[_0x0af3('0xa2')](_0x2ac43d[_0x0af3('0x67')][_0x0af3('0x9e')])){throw new db[(_0x0af3('0x20'))]['ValidationError']('Unknown\x20channel');}switch(_0x2ac43d[_0x0af3('0x67')][_0x0af3('0x9e')]){case _0x0af3('0xad'):return respondWithRpcPromise(_0x0af3('0xf7'),_0x0af3('0xfb'),{'id':_0x922378['id'],'name':_0x922378[_0x0af3('0x42')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x0af3('0x37')]({'paused':0x0},{'where':{'UserId':_0x922378['id']},'individualHooks':!![]});})[_0x0af3('0x38')](function(){return db[_0x0af3('0xec')]['find']({'where':{'channel':_0x2ac43d[_0x0af3('0x67')][_0x0af3('0x9e')],'membername':_0x922378['name'],'type':_0x0af3('0xf9'),'exitAt':null}});})[_0x0af3('0x38')](function(_0x4ad8ea){if(_0x4ad8ea){return _0x4ad8ea[_0x0af3('0x37')]({'exitAt':moment()[_0x0af3('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0af3('0x104')},{'individualHooks':!![]});}return null;})[_0x0af3('0x38')](function(){return _0x922378[_0x0af3('0x37')]({'voicePause':![]});});case _0x0af3('0x105'):case _0x0af3('0x106'):case _0x0af3('0x107'):case _0x0af3('0x108'):case _0x0af3('0x109'):case'openchannel':return db[_0x0af3('0xec')]['find']({'where':{'channel':_0x2ac43d['body']['channel'],'membername':_0x922378[_0x0af3('0x42')],'type':'PAUSE','exitAt':null}})[_0x0af3('0x38')](function(_0x25156c){if(_0x25156c){return _0x25156c['update']({'exitAt':moment()[_0x0af3('0xb0')](_0x0af3('0xed')),'data2':_0x0af3('0x104')},{'individualHooks':!![]});}return null;})[_0x0af3('0x38')](function(){var _0xb0d323={};_[_0x0af3('0x35')](_0xb0d323,util['format']('%s%s',_0x2ac43d[_0x0af3('0x67')][_0x0af3('0x9e')],_0x0af3('0x10a')),![]);return _0x922378[_0x0af3('0x37')](_0xb0d323);});default:return respondWithRpcPromise(_0x0af3('0xf7'),_0x0af3('0xfb'),{'id':_0x922378['id'],'name':_0x922378[_0x0af3('0x42')],'pause':![]})['then'](function(){return db[_0x0af3('0xcd')][_0x0af3('0x37')]({'paused':0x0},{'where':{'UserId':_0x922378['id']}});})[_0x0af3('0x38')](function(){return db['MemberReport'][_0x0af3('0x61')]({'where':{'membername':_0x922378['name'],'type':_0x0af3('0xf9'),'exitAt':null}});})[_0x0af3('0x38')](function(_0x169a40){var _0x4e0bb6=[];_0x169a40[_0x0af3('0xf0')](function(_0x47409){_0x4e0bb6['push'](_0x47409['update']({'exitAt':moment()['format'](_0x0af3('0xed')),'data2':_0x0af3('0x104')}));});return BPromise['all'](_0x4e0bb6);})[_0x0af3('0x38')](function(){return _0x922378[_0x0af3('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0af3('0x38')](respondWithResult(_0x553464,null))['catch'](handleError(_0x553464,null));};exports[_0x0af3('0x10b')]=function(_0x43ad61,_0x5ec30d,_0x26730b){var _0x351ca7={};var _0x224e7e={};var _0x5d8d9b;var _0x549254;return db[_0x0af3('0x47')][_0x0af3('0x94')]({'where':{'id':_0x43ad61['params']['id']}})['then'](handleEntityNotFound(_0x5ec30d,null))[_0x0af3('0x38')](function(_0x1f080f){if(_0x1f080f){_0x5d8d9b=_0x1f080f;_0x224e7e[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0x10c')]['rawAttributes']);_0x224e7e['query']=_['keys'](_0x43ad61['query']);_0x224e7e[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x224e7e['model'],_0x224e7e[_0x0af3('0x4f')]);_0x351ca7[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x224e7e[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x43ad61[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x351ca7['attributes']=_0x351ca7['attributes']['length']?_0x351ca7['attributes']:_0x224e7e[_0x0af3('0x4c')];_0x351ca7['order']=qs[_0x0af3('0xc1')](_0x43ad61['query']['sort']);_0x351ca7[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_['pick'](_0x43ad61[_0x0af3('0x4f')],_0x224e7e[_0x0af3('0x58')]));if(_0x43ad61[_0x0af3('0x4f')]['filter']){_0x351ca7[_0x0af3('0x57')]=_[_0x0af3('0x5d')](_0x351ca7[_0x0af3('0x57')],{'$or':_[_0x0af3('0x3f')](_0x351ca7['attributes'],function(_0x1c6a82){var _0x3e4e39={};_0x3e4e39[_0x1c6a82]={'$like':'%'+_0x43ad61[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%'};return _0x3e4e39;})});}_0x351ca7=_[_0x0af3('0x5d')]({},_0x351ca7,_0x43ad61[_0x0af3('0x5e')]);return _0x5d8d9b[_0x0af3('0x10b')](_0x351ca7);}})[_0x0af3('0x38')](function(_0x42667c){if(_0x42667c){_0x549254=_0x42667c[_0x0af3('0x54')];if(!_0x43ad61['query'][_0x0af3('0xcc')](_0x0af3('0x55'))){_0x351ca7['limit']=qs[_0x0af3('0x34')](_0x43ad61[_0x0af3('0x4f')][_0x0af3('0x34')]);_0x351ca7['offset']=qs[_0x0af3('0x33')](_0x43ad61['query']['offset']);}return _0x5d8d9b['getTeams'](_0x351ca7);}})[_0x0af3('0x38')](function(_0x56c587){if(_0x56c587){return _0x56c587?{'count':_0x549254,'rows':_0x56c587}:null;}})[_0x0af3('0x38')](respondWithResult(_0x5ec30d,null))[_0x0af3('0x2e')](handleError(_0x5ec30d,null));};exports[_0x0af3('0x10d')]=function(_0x5245e4,_0x491b07){return db['User']['find']({'where':{'id':_0x5245e4['params']['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x491b07,null))[_0x0af3('0x38')](function(_0x126ae2){if(_0x126ae2){var _0x5ab442=_0x126ae2['get']({'plain':!![]});return _0x126ae2[_0x0af3('0x10d')](_0x5245e4[_0x0af3('0x67')][_0x0af3('0xa7')],_['omit'](_0x5245e4[_0x0af3('0x67')],[_0x0af3('0xa7'),'id'])||{})[_0x0af3('0x38')](function(){for(var _0x553a03=0x0;_0x553a03<_0x5245e4[_0x0af3('0x67')][_0x0af3('0xa7')][_0x0af3('0x54')];_0x553a03++){var _0x5d4f8f=[];db['Team']['findOne']({'where':{'id':_0x5245e4[_0x0af3('0x67')][_0x0af3('0xa7')][_0x553a03]}})['then'](function(_0x2c042c){_0x5d4f8f[_0x0af3('0xae')](_0x2c042c[_0x0af3('0x10e')]()['then'](function(_0xc55184){for(var _0x107ecd=0x0;_0x107ecd<_0xc55184['length'];_0x107ecd++){_0xc55184[_0x107ecd][_0x0af3('0x10f')](_0x0af3('0x9e'),_0x0af3('0x110'));}return _0xc55184;}));_0x5d4f8f['push'](_0x2c042c[_0x0af3('0x111')]()[_0x0af3('0x38')](function(_0x1f6dab){for(var _0x464045=0x0;_0x464045<_0x1f6dab[_0x0af3('0x54')];_0x464045++){_0x1f6dab[_0x464045][_0x0af3('0x10f')]('channel',_0x0af3('0x112'));}return _0x1f6dab;}));_0x5d4f8f[_0x0af3('0xae')](_0x2c042c[_0x0af3('0x113')]()[_0x0af3('0x38')](function(_0x3d3598){for(var _0x3215cf=0x0;_0x3215cf<_0x3d3598[_0x0af3('0x54')];_0x3215cf++){_0x3d3598[_0x3215cf][_0x0af3('0x10f')](_0x0af3('0x9e'),_0x0af3('0x114'));}return _0x3d3598;}));_0x5d4f8f['push'](_0x2c042c[_0x0af3('0x115')]()[_0x0af3('0x38')](function(_0x21abca){for(var _0x206b44=0x0;_0x206b44<_0x21abca[_0x0af3('0x54')];_0x206b44++){_0x21abca[_0x206b44]['setDataValue'](_0x0af3('0x9e'),'Sms');}return _0x21abca;}));_0x5d4f8f['push'](_0x2c042c[_0x0af3('0x116')]()[_0x0af3('0x38')](function(_0xe02b6b){for(var _0x6c7e11=0x0;_0x6c7e11<_0xe02b6b['length'];_0x6c7e11++){_0xe02b6b[_0x6c7e11][_0x0af3('0x10f')]('channel','Whatsapp');}return _0xe02b6b;}));_0x5d4f8f['push'](_0x2c042c[_0x0af3('0x117')]()[_0x0af3('0x38')](function(_0xb8af58){for(var _0x500dd0=0x0;_0x500dd0<_0xb8af58[_0x0af3('0x54')];_0x500dd0++){_0xb8af58[_0x500dd0][_0x0af3('0x10f')](_0x0af3('0x9e'),'Fax');}return _0xb8af58;}));_0x5d4f8f[_0x0af3('0xae')](_0x2c042c['getOpenchannelQueues']()[_0x0af3('0x38')](function(_0x534e88){for(var _0xc7acc=0x0;_0xc7acc<_0x534e88['length'];_0xc7acc++){_0x534e88[_0xc7acc]['setDataValue'](_0x0af3('0x9e'),_0x0af3('0x118'));}return _0x534e88;}));return BPromise[_0x0af3('0xee')](_0x5d4f8f);})[_0x0af3('0x38')](function(_0x358245){var _0x4fedbf=_[_0x0af3('0x119')](_0x358245);_0x5d4f8f=[];return db[_0x0af3('0x5a')][_0x0af3('0x11a')](function(_0x31c085){for(var _0x2ce1e9=0x0;_0x2ce1e9<_0x4fedbf['length'];_0x2ce1e9++){_0x5d4f8f[_0x0af3('0xae')](_0x4fedbf[_0x2ce1e9]['addAgent'](_0x5ab442['id']),{'transaction':_0x31c085});}return BPromise['all'](_0x5d4f8f)[_0x0af3('0x38')](function(){if(_0x5ab442[_0x0af3('0x9f')]){return BPromise[_0x0af3('0xb2')](_[_0x0af3('0x3d')](_0x4fedbf,function(_0x5c7d29){return _0x5c7d29['getDataValue'](_0x0af3('0x9e'))===_0x0af3('0x110');}),function(_0x1d3f29){return db[_0x0af3('0xcd')]['upsert']({'membername':_0x5ab442['name'],'UserId':_0x5ab442['id'],'queue_name':_0x1d3f29[_0x0af3('0x42')],'VoiceQueueId':_0x1d3f29['id'],'interface':_['isNil'](_0x5ab442[_0x0af3('0xaf')])?util[_0x0af3('0xb0')]('SIP/%s',_0x5ab442[_0x0af3('0x42')]):_0x5ab442[_0x0af3('0xaf')],'paused':_0x5ab442['voicePause']||![],'penalty':_0x5ab442[_0x0af3('0xa8')]},{'transaction':_0x31c085});});}else{return;}})[_0x0af3('0x38')](function(){for(var _0x2f1967=0x0;_0x2f1967<_0x4fedbf[_0x0af3('0x54')];_0x2f1967++){var _0x20d232=_0x4fedbf[_0x2f1967][_0x0af3('0x11b')](_0x0af3('0x9e'));var _0x32300d=_0x20d232+_0x0af3('0xaa');socket[_0x0af3('0xab')](_0x0af3('0x3a')+_0x20d232+_0x0af3('0xac'),{'UserId':_0x5ab442['id'],['queueField']:_0x4fedbf[_0x2f1967]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x491b07,null))['catch'](handleError(_0x491b07,null));};exports[_0x0af3('0x11c')]=function(_0x26b821,_0x5e6428){return db['User'][_0x0af3('0x94')]({'where':{'id':_0x26b821[_0x0af3('0x68')]['id']}})[_0x0af3('0x38')](handleEntityNotFound(_0x5e6428,null))[_0x0af3('0x38')](function(_0x117c27){if(_0x117c27){var _0x58d58b=_0x117c27[_0x0af3('0x8c')]({'plain':!![]});var _0xbbaadb=_0x26b821['query'][_0x0af3('0xa7')];return _0x117c27[_0x0af3('0x11c')](_0xbbaadb)[_0x0af3('0x38')](function(){for(var _0x47491d=0x0;_0x47491d<_0xbbaadb['length'];_0x47491d++){var _0x50764d=[];db[_0x0af3('0x10c')][_0x0af3('0x94')]({'where':{'id':_0xbbaadb[_0x47491d]}})['then'](function(_0x1f27f4){_0x50764d['push'](_0x1f27f4['getVoiceQueues']()[_0x0af3('0x38')](function(_0x1d520a){for(var _0x567a04=0x0;_0x567a04<_0x1d520a[_0x0af3('0x54')];_0x567a04++){_0x1d520a[_0x567a04][_0x0af3('0x10f')]('channel',_0x0af3('0x110'));}return _0x1d520a;}));_0x50764d[_0x0af3('0xae')](_0x1f27f4[_0x0af3('0x111')]()[_0x0af3('0x38')](function(_0x13c00a){for(var _0x3dcf49=0x0;_0x3dcf49<_0x13c00a[_0x0af3('0x54')];_0x3dcf49++){_0x13c00a[_0x3dcf49]['setDataValue'](_0x0af3('0x9e'),_0x0af3('0x112'));}return _0x13c00a;}));_0x50764d['push'](_0x1f27f4[_0x0af3('0x113')]()[_0x0af3('0x38')](function(_0x3ce6c2){for(var _0x19cbf1=0x0;_0x19cbf1<_0x3ce6c2[_0x0af3('0x54')];_0x19cbf1++){_0x3ce6c2[_0x19cbf1][_0x0af3('0x10f')]('channel','Mail');}return _0x3ce6c2;}));_0x50764d[_0x0af3('0xae')](_0x1f27f4[_0x0af3('0x115')]()[_0x0af3('0x38')](function(_0x25d8f7){for(var _0x2f4a0f=0x0;_0x2f4a0f<_0x25d8f7[_0x0af3('0x54')];_0x2f4a0f++){_0x25d8f7[_0x2f4a0f]['setDataValue'](_0x0af3('0x9e'),_0x0af3('0x11d'));}return _0x25d8f7;}));_0x50764d['push'](_0x1f27f4[_0x0af3('0x116')]()['then'](function(_0x2f92fc){for(var _0x44366f=0x0;_0x44366f<_0x2f92fc[_0x0af3('0x54')];_0x44366f++){_0x2f92fc[_0x44366f][_0x0af3('0x10f')](_0x0af3('0x9e'),_0x0af3('0x11e'));}return _0x2f92fc;}));_0x50764d[_0x0af3('0xae')](_0x1f27f4['getFaxQueues']()[_0x0af3('0x38')](function(_0x574d81){for(var _0x37f8ca=0x0;_0x37f8ca<_0x574d81[_0x0af3('0x54')];_0x37f8ca++){_0x574d81[_0x37f8ca][_0x0af3('0x10f')](_0x0af3('0x9e'),_0x0af3('0x11f'));}return _0x574d81;}));_0x50764d[_0x0af3('0xae')](_0x1f27f4['getOpenchannelQueues']()['then'](function(_0x401369){for(var _0x410420=0x0;_0x410420<_0x401369['length'];_0x410420++){_0x401369[_0x410420][_0x0af3('0x10f')](_0x0af3('0x9e'),_0x0af3('0x118'));}return _0x401369;}));return BPromise[_0x0af3('0xee')](_0x50764d);})[_0x0af3('0x38')](function(_0x48e167){var _0x197348=_[_0x0af3('0x119')](_0x48e167);_0x50764d=[];return db['sequelize'][_0x0af3('0x11a')](function(_0x27479b){for(var _0x11c3db=0x0;_0x11c3db<_0x197348['length'];_0x11c3db++){_0x50764d[_0x0af3('0xae')](_0x197348[_0x11c3db][_0x0af3('0x120')](_0x58d58b['id']),{'transaction':_0x27479b});}return BPromise[_0x0af3('0xee')](_0x50764d)[_0x0af3('0x38')](function(){if(_0x58d58b[_0x0af3('0x9f')]){return BPromise['each'](_[_0x0af3('0x3d')](_0x197348,function(_0x2b2673){return _0x2b2673['getDataValue'](_0x0af3('0x9e'))==='Voice';}),function(_0x5627f3){return db['UserVoiceQueueRt'][_0x0af3('0x39')]({'where':{'VoiceQueueId':_0x5627f3['id'],'UserId':_0x58d58b['id']},'transaction':_0x27479b});});}else{return;}})['then'](function(){for(var _0x4b7dfa=0x0;_0x4b7dfa<_0x197348['length'];_0x4b7dfa++){var _0xa4d96f=_0x197348[_0x4b7dfa]['getDataValue'](_0x0af3('0x9e'));var _0x102af2=_0xa4d96f+_0x0af3('0xaa');socket[_0x0af3('0xab')]('user'+_0xa4d96f+_0x0af3('0x121'),{'UserId':_0x58d58b['id'],['queueField']:_0x197348[_0x4b7dfa]['id']});}});});});}});}})[_0x0af3('0x38')](respondWithStatusCode(_0x5e6428,null))[_0x0af3('0x2e')](handleError(_0x5e6428,null));};exports[_0x0af3('0x122')]=function(_0x377053,_0x1637c9,_0x1cd24e){var _0x5e4934={};var _0x198053={};var _0xb82bd;var _0xb2a9eb;return db['User'][_0x0af3('0x94')]({'where':{'id':_0x377053[_0x0af3('0x68')]['id']}})['then'](handleEntityNotFound(_0x1637c9,null))[_0x0af3('0x38')](function(_0x236081){if(_0x236081){_0xb82bd=_0x236081;_0x198053[_0x0af3('0x4c')]=_['keys'](db[_0x0af3('0xc2')][_0x0af3('0x48')]);_0x198053[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x377053[_0x0af3('0x4f')]);_0x198053[_0x0af3('0x58')]=_[_0x0af3('0x51')](_0x198053[_0x0af3('0x4c')],_0x198053['query']);_0x5e4934[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x198053[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x377053['query'][_0x0af3('0x53')]));_0x5e4934[_0x0af3('0x52')]=_0x5e4934[_0x0af3('0x52')][_0x0af3('0x54')]?_0x5e4934[_0x0af3('0x52')]:_0x198053[_0x0af3('0x4c')];_0x5e4934[_0x0af3('0x56')]=qs[_0x0af3('0xc1')](_0x377053[_0x0af3('0x4f')]['sort']);_0x5e4934[_0x0af3('0x57')]=qs['filters'](_['pick'](_0x377053['query'],_0x198053['filters']));if(_0x377053[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0x5e4934[_0x0af3('0x57')]=_[_0x0af3('0x5d')](_0x5e4934['where'],{'$or':_[_0x0af3('0x3f')](_0x5e4934['attributes'],function(_0x3b82d7){var _0x3c7d25={};_0x3c7d25[_0x3b82d7]={'$like':'%'+_0x377053[_0x0af3('0x4f')][_0x0af3('0x3d')]+'%'};return _0x3c7d25;})});}_0x5e4934=_[_0x0af3('0x5d')]({},_0x5e4934,_0x377053[_0x0af3('0x5e')]);return _0xb82bd['getLists'](_0x5e4934);}})[_0x0af3('0x38')](function(_0x5381fc){if(_0x5381fc){_0xb2a9eb=_0x5381fc['length'];if(!_0x377053[_0x0af3('0x4f')][_0x0af3('0xcc')](_0x0af3('0x55'))){_0x5e4934[_0x0af3('0x34')]=qs['limit'](_0x377053[_0x0af3('0x4f')]['limit']);_0x5e4934['offset']=qs[_0x0af3('0x33')](_0x377053[_0x0af3('0x4f')][_0x0af3('0x33')]);}return _0xb82bd[_0x0af3('0x122')](_0x5e4934);}})[_0x0af3('0x38')](function(_0x136f5d){if(_0x136f5d){return _0x136f5d?{'count':_0xb2a9eb,'rows':_0x136f5d}:null;}})['then'](respondWithResult(_0x1637c9,null))[_0x0af3('0x2e')](handleError(_0x1637c9,null));};exports[_0x0af3('0x123')]=function(_0x6a76e4,_0x13e387,_0x3f79f2){var _0x5b81b7={};var _0x4432fc={};var _0x60ff7a;var _0x5a4713;return db[_0x0af3('0x47')][_0x0af3('0x94')]({'where':{'id':_0x6a76e4[_0x0af3('0x68')]['id']}})['then'](handleEntityNotFound(_0x13e387,null))[_0x0af3('0x38')](function(_0x4b43c7){if(_0x4b43c7){_0x60ff7a=_0x4b43c7;_0x4432fc[_0x0af3('0x4c')]=_[_0x0af3('0x50')](db[_0x0af3('0x47')][_0x0af3('0x48')]);_0x4432fc[_0x0af3('0x4f')]=_[_0x0af3('0x50')](_0x6a76e4[_0x0af3('0x4f')]);_0x4432fc[_0x0af3('0x58')]=_['intersection'](_0x4432fc[_0x0af3('0x4c')],_0x4432fc[_0x0af3('0x4f')]);_0x5b81b7[_0x0af3('0x52')]=_[_0x0af3('0x51')](_0x4432fc[_0x0af3('0x4c')],qs[_0x0af3('0x53')](_0x6a76e4[_0x0af3('0x4f')][_0x0af3('0x53')]));_0x5b81b7['attributes']=_0x5b81b7[_0x0af3('0x52')][_0x0af3('0x54')]?_0x5b81b7[_0x0af3('0x52')]:_0x4432fc[_0x0af3('0x4c')];_0x5b81b7[_0x0af3('0x56')]=qs['sort'](_0x6a76e4[_0x0af3('0x4f')]['sort']);_0x5b81b7[_0x0af3('0x57')]=qs[_0x0af3('0x58')](_['pick'](_0x6a76e4['query'],_0x4432fc[_0x0af3('0x58')]));if(_0x6a76e4[_0x0af3('0x4f')][_0x0af3('0x3d')]){_0x5b81b7['where']=_[_0x0af3('0x5d')](_0x5b81b7[_0x0af3('0x57')],{'$or':_[_0x0af3('0x3f')](_0x5b81b7[_0x0af3('0x52')],function(_0x5cabbb){var _0x43dcfe={};_0x43dcfe[_0x5cabbb]={'$like':'%'+_0x6a76e4['query'][_0x0af3('0x3d')]+'%'};return _0x43dcfe;})});}_0x5b81b7[_0x0af3('0x4c')]=db['User'];_0x5b81b7['as']=_0x0af3('0x8d');_0x5b81b7=_[_0x0af3('0x5d')]({},_0x5b81b7,_0x6a76e4['options']);return _0x60ff7a['getVoiceQueues']({'include':[_0x5b81b7]});}})['then'](function(_0x6233a0){if(_0x6233a0){var _0x3b83b7={},_0x2df586=[],_0x5409e9=0x0;for(var _0x293f1b=0x0;_0x293f1b<_0x6233a0[_0x0af3('0x54')];_0x293f1b+=0x1){for(var _0x2bdf79=0x0,_0x56f4f9;_0x2bdf79<_0x6233a0[_0x293f1b][_0x0af3('0x8d')][_0x0af3('0x54')];_0x2bdf79+=0x1){_0x56f4f9=_0x6233a0[_0x293f1b][_0x0af3('0x8d')][_0x2bdf79][_0x0af3('0x8c')]({'plain':!![]});_0x3b83b7[_0x56f4f9['id']]=_0x56f4f9;}}_0x3b83b7=_[_0x0af3('0x124')](_0x3b83b7);for(var _0x6ef96c=qs[_0x0af3('0x33')](_0x6a76e4['query'][_0x0af3('0x33')]);_0x6ef96c<_0x3b83b7[_0x0af3('0x54')]&&_0x2df586[_0x0af3('0x54')]=_0x54a676[_0xdb00('0x4f')]){throw new Error(_0xdb00('0x50'));}})['then'](function(){if(_0x40f5e7){return db[_0xdb00('0x28')][_0xdb00('0x47')]({'where':{'membername':_0x40f5e7['name']},'individualHooks':!![]});}})[_0xdb00('0xe')](function(){if(_0x40f5e7){return _0x40f5e7[_0xdb00('0x51')]({'raw':!![]});}})[_0xdb00('0xe')](function(_0x557a5e){if(_0x40f5e7){if(_0x557a5e){var _0x32712b=[];_0x2c0a47=_0x557a5e;if(_0x2c0a47[_0xdb00('0x2d')]){for(var _0x29047c=0x0;_0x29047c<_0x2c0a47['length'];_0x29047c++){_0x32712b[_0xdb00('0x33')](db[_0xdb00('0x28')][_0xdb00('0x52')]({'membername':_0x40f5e7[_0xdb00('0x34')],'UserId':_0x40f5e7['id'],'queue_name':_0x2c0a47[_0x29047c][_0xdb00('0x34')],'VoiceQueueId':_0x2c0a47[_0x29047c]['id'],'interface':_0x2c5a87,'paused':_0x40f5e7['loginInPause']||![],'penalty':_0x2c0a47[_0x29047c][_0xdb00('0x53')]||0x0}));}return BPromise['all'](_0x32712b);}}}})['then'](function(){if(_0x40f5e7){return db[_0xdb00('0x2a')]['findAll']({'where':{'membername':_0x40f5e7[_0xdb00('0x34')],'exitAt':null}});}})[_0xdb00('0xe')](function(_0x198508){if(_0x40f5e7){if(_0x198508&&_0x198508[_0xdb00('0x2d')]){var _0x537566=[];_0x198508[_0xdb00('0x32')](function(_0x58d314){_0x537566['push'](_0x58d314[_0xdb00('0x29')]({'exitAt':moment()[_0xdb00('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x537566);}}})[_0xdb00('0xe')](function(_0x246248){if(_0x40f5e7){var _0x2bb924=[];var _0x3e837c=[];var _0x4da3f7=utils[_0xdb00('0x31')]();var _0x32dbc0={'membername':_0x40f5e7['name'],'interface':_0x2c5a87,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x40f5e7['role'],'internal':_0x40f5e7[_0xdb00('0x26')]};_0x4da3f7[_0xdb00('0x32')](function(_0x2ec4d7){_0x2bb924[_0xdb00('0x33')](_[_0xdb00('0x54')]({'channel':_0x2ec4d7,'type':_0xdb00('0x55'),'data1':'callysquare','data2':_0x2c5a87},_0x32dbc0));if(_0x40f5e7['loginInPause']){_0x3e837c[_0xdb00('0x33')](_[_0xdb00('0x54')]({'channel':_0x2ec4d7,'type':'PAUSE','data1':'LOGININPAUSE'},_0x32dbc0));}});return db[_0xdb00('0x2a')][_0xdb00('0x56')](_0x2bb924[_0xdb00('0x57')](_0x3e837c),{'individualHooks':!![]});}})[_0xdb00('0xe')](function(){if(_0x40f5e7){return _0x40f5e7['update']({'online':!![],'lastLoginAt':moment()['format'](_0xdb00('0x2f')),'voicePause':_0x40f5e7['loginInPause']||![],'mailPause':_0x40f5e7[_0xdb00('0x4a')]||![],'chatPause':_0x40f5e7['loginInPause']||![],'faxPause':_0x40f5e7[_0xdb00('0x4a')]||![],'smsPause':_0x40f5e7[_0xdb00('0x4a')]||![],'openchannelPause':_0x40f5e7[_0xdb00('0x4a')]||![],'pauseType':_0x40f5e7['loginInPause']?_0xdb00('0x58'):null,'lastPauseAt':moment()[_0xdb00('0x2e')](_0xdb00('0x2f')),'interface':_0x2c5a87});}})['then'](function(_0x14ee0c){_0x5d6c6f(_0x14ee0c);})['catch'](function(_0x166d56){_0x22de5(_0x2ce6cc[_0xdb00('0x14')](0x1f4,_0x166d56['message']));});});}; \ No newline at end of file +var _0xd35d=['then','catch','ShowUser','raw','PauseUser','find','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','bulkCreate','findOne','channel','isValidChannel','voice','mail','chat','sms','openchannel','system','set','%s%s','all','LogoutUser','destroy','mobile','phone','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','loginInPause','UserVoiceQueue.penalty','LOGIN','merge','LOGININPAUSE','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./user.socket','register','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','GetUser','User','findAll','options','where','limit','include','model','map','attributes'];(function(_0x1b2dad,_0x35d87f){var _0x33b376=function(_0x266d2f){while(--_0x266d2f){_0x1b2dad['push'](_0x1b2dad['shift']());}};_0x33b376(++_0x35d87f);}(_0xd35d,0xe2));var _0xdd35=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0xd35d[_0x311f44];return _0x46f1e6;};'use strict';var _=require(_0xdd35('0x0'));var util=require('util');var moment=require(_0xdd35('0x1'));var BPromise=require(_0xdd35('0x2'));var rs=require(_0xdd35('0x3'));var fs=require('fs');var Redis=require(_0xdd35('0x4'));var db=require(_0xdd35('0x5'))['db'];var utils=require(_0xdd35('0x6'));var logger=require(_0xdd35('0x7'))('rpc');var config=require(_0xdd35('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdd35('0x9')][_0xdd35('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdd35('0xb')],{'host':_0xdd35('0xc'),'port':0x18eb});var socket=require(_0xdd35('0xd'))(new Redis(config[_0xdd35('0xb')]));require(_0xdd35('0xe'))[_0xdd35('0xf')](socket);function respondWithRpcPromise(_0x296568,_0x3668d6,_0x357a03){return new BPromise(function(_0x1bf934,_0x213ccf){return client['request'](_0x296568,_0x357a03)['then'](function(_0x26524e){logger['info'](_0xdd35('0x10'),_0x3668d6,_0xdd35('0x11'));logger[_0xdd35('0x12')](_0xdd35('0x13'),_0x3668d6,'request\x20sent',JSON[_0xdd35('0x14')](_0x26524e));if(_0x26524e['error']){if(_0x26524e['error'][_0xdd35('0x15')]===0x1f4){logger[_0xdd35('0x16')](_0xdd35('0x10'),_0x3668d6,_0x26524e[_0xdd35('0x16')][_0xdd35('0x17')]);return _0x213ccf(_0x26524e[_0xdd35('0x16')][_0xdd35('0x17')]);}logger[_0xdd35('0x16')](_0xdd35('0x10'),_0x3668d6,_0x26524e[_0xdd35('0x16')]['message']);return _0x1bf934(_0x26524e[_0xdd35('0x16')][_0xdd35('0x17')]);}else{logger[_0xdd35('0x18')](_0xdd35('0x10'),_0x3668d6,_0xdd35('0x11'));_0x1bf934(_0x26524e['result'][_0xdd35('0x17')]);}})['catch'](function(_0x41d84c){logger[_0xdd35('0x16')](_0xdd35('0x10'),_0x3668d6,_0x41d84c);_0x213ccf(_0x41d84c);});});}exports[_0xdd35('0x19')]=function(_0x4a8c3f){var _0x5ed7fe=this;return new Promise(function(_0x2d00d2,_0x4bcf9b){return db[_0xdd35('0x1a')][_0xdd35('0x1b')]({'raw':_0x4a8c3f[_0xdd35('0x1c')]?_0x4a8c3f[_0xdd35('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4a8c3f[_0xdd35('0x1c')]?_0x4a8c3f[_0xdd35('0x1c')][_0xdd35('0x1d')]||null:null,'attributes':_0x4a8c3f[_0xdd35('0x1c')]?_0x4a8c3f['options']['attributes']||null:null,'limit':_0x4a8c3f[_0xdd35('0x1c')]?_0x4a8c3f['options'][_0xdd35('0x1e')]||null:null,'include':_0x4a8c3f['options']?_0x4a8c3f[_0xdd35('0x1c')][_0xdd35('0x1f')]?_['map'](_0x4a8c3f[_0xdd35('0x1c')]['include'],function(_0x385a69){return{'model':db[_0x385a69[_0xdd35('0x20')]],'as':_0x385a69['as'],'attributes':_0x385a69['attributes'],'include':_0x385a69[_0xdd35('0x1f')]?_[_0xdd35('0x21')](_0x385a69[_0xdd35('0x1f')],function(_0x22b68d){return{'model':db[_0x22b68d[_0xdd35('0x20')]],'as':_0x22b68d['as'],'attributes':_0x22b68d[_0xdd35('0x22')],'include':_0x22b68d[_0xdd35('0x1f')]?_[_0xdd35('0x21')](_0x22b68d[_0xdd35('0x1f')],function(_0x39842b){return{'model':db[_0x39842b[_0xdd35('0x20')]],'as':_0x39842b['as'],'attributes':_0x39842b[_0xdd35('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdd35('0x23')](function(_0x31f50a){logger[_0xdd35('0x18')](_0xdd35('0x19'),_0x4a8c3f);logger[_0xdd35('0x12')](_0xdd35('0x19'),_0x4a8c3f,JSON[_0xdd35('0x14')](_0x31f50a));_0x2d00d2(_0x31f50a);})[_0xdd35('0x24')](function(_0x590fbc){logger['error'](_0xdd35('0x19'),_0x590fbc['message'],_0x4a8c3f);_0x4bcf9b(_0x5ed7fe[_0xdd35('0x16')](0x1f4,_0x590fbc[_0xdd35('0x17')]));});});};exports[_0xdd35('0x25')]=function(_0x417a5b){var _0x184813=this;return new Promise(function(_0x593eaf,_0x5b2fac){return db[_0xdd35('0x1a')]['find']({'raw':_0x417a5b[_0xdd35('0x1c')]?_0x417a5b[_0xdd35('0x1c')][_0xdd35('0x26')]===undefined?!![]:![]:!![],'where':_0x417a5b[_0xdd35('0x1c')]?_0x417a5b['options'][_0xdd35('0x1d')]||null:null,'attributes':_0x417a5b[_0xdd35('0x1c')]?_0x417a5b[_0xdd35('0x1c')][_0xdd35('0x22')]||null:null,'include':_0x417a5b[_0xdd35('0x1c')]?_0x417a5b[_0xdd35('0x1c')][_0xdd35('0x1f')]?_[_0xdd35('0x21')](_0x417a5b[_0xdd35('0x1c')][_0xdd35('0x1f')],function(_0x40b24b){return{'model':db[_0x40b24b[_0xdd35('0x20')]],'as':_0x40b24b['as'],'attributes':_0x40b24b['attributes'],'include':_0x40b24b[_0xdd35('0x1f')]?_[_0xdd35('0x21')](_0x40b24b['include'],function(_0x3dcba0){return{'model':db[_0x3dcba0[_0xdd35('0x20')]],'as':_0x3dcba0['as'],'attributes':_0x3dcba0[_0xdd35('0x22')],'include':_0x3dcba0[_0xdd35('0x1f')]?_['map'](_0x3dcba0['include'],function(_0x389473){return{'model':db[_0x389473[_0xdd35('0x20')]],'as':_0x389473['as'],'attributes':_0x389473[_0xdd35('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdd35('0x23')](function(_0x8a78ea){logger[_0xdd35('0x18')](_0xdd35('0x25'),_0x417a5b);logger[_0xdd35('0x12')](_0xdd35('0x25'),_0x417a5b,JSON['stringify'](_0x8a78ea));_0x593eaf(_0x8a78ea);})[_0xdd35('0x24')](function(_0x4496f5){logger['error'](_0xdd35('0x25'),_0x4496f5[_0xdd35('0x17')],_0x417a5b);_0x5b2fac(_0x184813[_0xdd35('0x16')](0x1f4,_0x4496f5[_0xdd35('0x17')]));});});};exports[_0xdd35('0x27')]=function(_0x3c62d0){var _0x51c9cb=this;return new Promise(function(_0xbd060a,_0x21b65b){var _0x1f3940;return db[_0xdd35('0x1a')][_0xdd35('0x28')]({'where':_0x3c62d0[_0xdd35('0x1c')][_0xdd35('0x1d')]||{},'attributes':['id',_0xdd35('0x29'),_0xdd35('0x2a'),_0xdd35('0x2b'),_0xdd35('0x2c')]})[_0xdd35('0x23')](function(_0x14997f){if(_0x14997f){_0x1f3940=_0x14997f;return db[_0xdd35('0x2d')][_0xdd35('0x2e')]({'paused':0x1},{'where':{'UserId':_0x1f3940['id']},'individualHooks':!![]});}})[_0xdd35('0x23')](function(){if(_0x1f3940){return db[_0xdd35('0x2f')]['findAll']({'where':{'membername':_0x1f3940[_0xdd35('0x29')],'type':_0xdd35('0x30'),'exitAt':null}});}})[_0xdd35('0x23')](function(_0x38c6af){if(_0x1f3940){if(_0x38c6af&&_0x38c6af[_0xdd35('0x31')]){var _0x5e6057=moment()[_0xdd35('0x32')](_0xdd35('0x33'));for(var _0x4cf237=0x0,_0xbe0a4e=_0x38c6af[_0xdd35('0x31')];_0x4cf237<_0xbe0a4e;_0x4cf237++){_0x38c6af[_0x4cf237][_0xdd35('0x34')]({'exitAt':_0x5e6057});}}}})[_0xdd35('0x23')](function(){if(_0x1f3940){var _0x392be7=[];var _0xf6b057=utils[_0xdd35('0x35')]();_0xf6b057[_0xdd35('0x36')](function(_0x11bb14){_0x392be7[_0xdd35('0x37')]({'channel':_0x11bb14,'membername':_0x1f3940[_0xdd35('0x29')],'interface':_[_0xdd35('0x38')](_0x1f3940[_0xdd35('0x2c')])?util[_0xdd35('0x32')]('SIP/%s',_0x1f3940[_0xdd35('0x29')]):_0x1f3940[_0xdd35('0x2c')],'type':_0xdd35('0x30'),'enterAt':moment()[_0xdd35('0x32')](_0xdd35('0x33')),'data1':_0x3c62d0[_0xdd35('0x39')][_0xdd35('0x3a')]||_0xdd35('0x3b'),'role':_0x1f3940['role'],'internal':_0x1f3940[_0xdd35('0x2b')],'uniqueid':_0x3c62d0[_0xdd35('0x39')]['uniqueid']||null});});return db[_0xdd35('0x2f')][_0xdd35('0x3c')](_0x392be7,{'individualHooks':!![]});}})[_0xdd35('0x23')](function(){if(_0x1f3940){return _0x1f3940[_0xdd35('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x3c62d0['body']['type']||_0xdd35('0x3b'),'lastPauseAt':moment()[_0xdd35('0x32')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xdd35('0x23')](function(_0x2d60dc){_0xbd060a(_0x2d60dc);})[_0xdd35('0x24')](function(_0x720dc7){_0x21b65b(_0x51c9cb[_0xdd35('0x16')](0x1f4,_0x720dc7[_0xdd35('0x17')]));});});};exports['UnpauseUser']=function(_0x3a979a){var _0x37ba10=this;return new Promise(function(_0x2bc8ac,_0x5759d4){var _0x4ee04e;return db[_0xdd35('0x1a')][_0xdd35('0x3d')]({'where':_0x3a979a['options'][_0xdd35('0x1d')]||{},'attributes':['id',_0xdd35('0x29')]})[_0xdd35('0x23')](function(_0x2aaf8c){if(_0x2aaf8c){_0x4ee04e=_0x2aaf8c;if(_0x3a979a['body'][_0xdd35('0x3e')]&&!utils[_0xdd35('0x3f')](_0x3a979a[_0xdd35('0x39')][_0xdd35('0x3e')])){throw new Error('Unknown\x20channel');}switch(_0x3a979a['body'][_0xdd35('0x3e')]){case _0xdd35('0x40'):return db[_0xdd35('0x2d')][_0xdd35('0x2e')]({'paused':0x0},{'where':{'UserId':_0x4ee04e['id']}})[_0xdd35('0x23')](function(){return db[_0xdd35('0x2f')][_0xdd35('0x28')]({'where':{'channel':_0x3a979a[_0xdd35('0x39')][_0xdd35('0x3e')],'membername':_0x4ee04e[_0xdd35('0x29')],'type':_0xdd35('0x30'),'exitAt':null}});})[_0xdd35('0x23')](function(_0x1be66a){if(_0x1be66a){return _0x1be66a[_0xdd35('0x2e')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xdd35('0x23')](function(){return _0x4ee04e[_0xdd35('0x2e')]({'voicePause':![]});});case _0xdd35('0x41'):case _0xdd35('0x42'):case'fax':case _0xdd35('0x43'):case _0xdd35('0x44'):return db[_0xdd35('0x2f')][_0xdd35('0x28')]({'where':{'channel':_0x3a979a[_0xdd35('0x39')][_0xdd35('0x3e')],'membername':_0x4ee04e[_0xdd35('0x29')],'type':_0xdd35('0x30'),'exitAt':null}})['then'](function(_0x42e6c3){return _0x42e6c3[_0xdd35('0x2e')]({'exitAt':moment()[_0xdd35('0x32')](_0xdd35('0x33')),'data2':_0xdd35('0x45')},{'individualHooks':!![]});})['then'](function(){var _0x2af3af={};_[_0xdd35('0x46')](_0x2af3af,util['format'](_0xdd35('0x47'),_0x3a979a[_0xdd35('0x39')]['channel'],'Pause'),![]);return _0x4ee04e[_0xdd35('0x2e')](_0x2af3af);});default:return db[_0xdd35('0x2d')][_0xdd35('0x2e')]({'paused':0x0},{'where':{'UserId':_0x4ee04e['id']}})[_0xdd35('0x23')](function(){return db[_0xdd35('0x2f')][_0xdd35('0x1b')]({'where':{'membername':_0x4ee04e['name'],'type':_0xdd35('0x30'),'exitAt':null}});})[_0xdd35('0x23')](function(_0x9b71e3){var _0x303c96=[];_0x9b71e3[_0xdd35('0x36')](function(_0xb0db3a){_0x303c96['push'](_0xb0db3a['update']({'exitAt':moment()[_0xdd35('0x32')](_0xdd35('0x33')),'data2':_0xdd35('0x45')}));});return BPromise[_0xdd35('0x48')](_0x303c96);})[_0xdd35('0x23')](function(){return _0x4ee04e['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0x5909e4){_0x2bc8ac(_0x5909e4);})[_0xdd35('0x24')](function(_0x4f3ce2){_0x5759d4(_0x37ba10['error'](0x1f4,_0x4f3ce2[_0xdd35('0x17')]));});});};exports[_0xdd35('0x49')]=function(_0x42efaf){var _0x531792=this;return new Promise(function(_0x4171f6,_0x50bc07){var _0x4d2102;return db[_0xdd35('0x1a')][_0xdd35('0x3d')]({'where':_0x42efaf[_0xdd35('0x1c')][_0xdd35('0x1d')]||{},'attributes':['id',_0xdd35('0x29')]})['then'](function(_0x4cb04e){if(_0x4cb04e){_0x4d2102=_0x4cb04e;return db[_0xdd35('0x2d')][_0xdd35('0x4a')]({'where':{'membername':_0x4d2102[_0xdd35('0x29')]},'individualHooks':!![]});}})[_0xdd35('0x23')](function(){if(_0x4d2102){return db[_0xdd35('0x2f')]['findAll']({'where':{'membername':_0x4d2102[_0xdd35('0x29')],'exitAt':null}});}})['then'](function(_0x447be3){if(_0x4d2102){if(_0x447be3&&_0x447be3[_0xdd35('0x31')]){var _0x4ba39b=[];_0x447be3[_0xdd35('0x36')](function(_0x50d0a3){_0x4ba39b[_0xdd35('0x37')](_0x50d0a3['update']({'exitAt':moment()[_0xdd35('0x32')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xdd35('0x48')](_0x4ba39b);}}})[_0xdd35('0x23')](function(){if(_0x4d2102){return _0x4d2102[_0xdd35('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xdd35('0x23')](function(_0x1f0c9b){_0x4171f6(_0x1f0c9b);})[_0xdd35('0x24')](function(_0x314dc1){_0x50bc07(_0x531792[_0xdd35('0x16')](0x1f4,_0x314dc1[_0xdd35('0x17')]));});});};exports['LoginUser']=function(_0x1d565e){var _0x52f9ff=this;return new Promise(function(_0x2ad568,_0x73bc7b){var _0x1f1b0f;var _0xa2659d;var _0x1aa50b;var _0x5e65bb;return db['User'][_0xdd35('0x3d')]({'where':_0x1d565e[_0xdd35('0x1c')][_0xdd35('0x1d')]||{},'attributes':['id',_0xdd35('0x29'),_0xdd35('0x2a'),_0xdd35('0x4b'),_0xdd35('0x4c'),_0xdd35('0x2b'),'loginInPause',_0xdd35('0x2c')]})[_0xdd35('0x23')](function(_0x468433){if(_0x468433){_0x1f1b0f=_0x468433;_0x5e65bb=_0x1d565e['body'][_0xdd35('0x2c')]?_0x1d565e['body'][_0xdd35('0x2c')]:util[_0xdd35('0x32')]('SIP/%s',_0x1f1b0f[_0xdd35('0x29')]);return db[_0xdd35('0x1a')][_0xdd35('0x4d')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1f1b0f['id']}}});}})['then'](function(_0x563262){if(_0x563262){_0x1aa50b=_0x563262;return require(_0xdd35('0x4e'))[_0xdd35('0x4f')]();}})['then'](function(_0x4f4a99){if(_0x4f4a99&&_0x4f4a99[_0xdd35('0x50')]&&_0x1aa50b>=_0x4f4a99[_0xdd35('0x50')]){throw new Error(_0xdd35('0x51'));}})[_0xdd35('0x23')](function(){if(_0x1f1b0f){return db['UserVoiceQueueRt'][_0xdd35('0x4a')]({'where':{'membername':_0x1f1b0f['name']},'individualHooks':!![]});}})[_0xdd35('0x23')](function(){if(_0x1f1b0f){return _0x1f1b0f['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x27268c){if(_0x1f1b0f){if(_0x27268c){var _0x43f73a=[];_0xa2659d=_0x27268c;if(_0xa2659d['length']){for(var _0xa69dd5=0x0;_0xa69dd5<_0xa2659d[_0xdd35('0x31')];_0xa69dd5++){_0x43f73a[_0xdd35('0x37')](db[_0xdd35('0x2d')]['upsert']({'membername':_0x1f1b0f[_0xdd35('0x29')],'UserId':_0x1f1b0f['id'],'queue_name':_0xa2659d[_0xa69dd5][_0xdd35('0x29')],'VoiceQueueId':_0xa2659d[_0xa69dd5]['id'],'interface':_0x5e65bb,'paused':_0x1f1b0f[_0xdd35('0x52')]||![],'penalty':_0xa2659d[_0xa69dd5][_0xdd35('0x53')]||0x0}));}return BPromise[_0xdd35('0x48')](_0x43f73a);}}}})['then'](function(){if(_0x1f1b0f){return db[_0xdd35('0x2f')][_0xdd35('0x1b')]({'where':{'membername':_0x1f1b0f[_0xdd35('0x29')],'exitAt':null}});}})[_0xdd35('0x23')](function(_0x3cf1eb){if(_0x1f1b0f){if(_0x3cf1eb&&_0x3cf1eb[_0xdd35('0x31')]){var _0x4287e6=[];_0x3cf1eb[_0xdd35('0x36')](function(_0x1cb4ac){_0x4287e6['push'](_0x1cb4ac[_0xdd35('0x2e')]({'exitAt':moment()[_0xdd35('0x32')](_0xdd35('0x33'))}));});return BPromise[_0xdd35('0x48')](_0x4287e6);}}})[_0xdd35('0x23')](function(_0x1694ba){if(_0x1f1b0f){var _0x9bc8d5=[];var _0x3dbbfd=[];var _0x521730=utils[_0xdd35('0x35')]();var _0x3c9fb6={'membername':_0x1f1b0f[_0xdd35('0x29')],'interface':_0x5e65bb,'enterAt':moment()[_0xdd35('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1f1b0f[_0xdd35('0x2a')],'internal':_0x1f1b0f[_0xdd35('0x2b')]};_0x521730[_0xdd35('0x36')](function(_0x27faee){_0x9bc8d5[_0xdd35('0x37')](_['merge']({'channel':_0x27faee,'type':_0xdd35('0x54'),'data1':'callysquare','data2':_0x5e65bb},_0x3c9fb6));if(_0x1f1b0f['loginInPause']){_0x3dbbfd[_0xdd35('0x37')](_[_0xdd35('0x55')]({'channel':_0x27faee,'type':_0xdd35('0x30'),'data1':_0xdd35('0x56')},_0x3c9fb6));}});return db[_0xdd35('0x2f')][_0xdd35('0x3c')](_0x9bc8d5['concat'](_0x3dbbfd),{'individualHooks':!![]});}})[_0xdd35('0x23')](function(){if(_0x1f1b0f){return _0x1f1b0f[_0xdd35('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xdd35('0x32')](_0xdd35('0x33')),'voicePause':_0x1f1b0f[_0xdd35('0x52')]||![],'mailPause':_0x1f1b0f[_0xdd35('0x52')]||![],'chatPause':_0x1f1b0f[_0xdd35('0x52')]||![],'faxPause':_0x1f1b0f[_0xdd35('0x52')]||![],'smsPause':_0x1f1b0f['loginInPause']||![],'openchannelPause':_0x1f1b0f[_0xdd35('0x52')]||![],'pauseType':_0x1f1b0f[_0xdd35('0x52')]?_0xdd35('0x56'):null,'lastPauseAt':moment()[_0xdd35('0x32')](_0xdd35('0x33')),'interface':_0x5e65bb});}})['then'](function(_0x2a01fb){_0x2ad568(_0x2a01fb);})[_0xdd35('0x24')](function(_0x32dbdb){_0x73bc7b(_0x52f9ff[_0xdd35('0x16')](0x1f4,_0x32dbdb['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 459aa3d..9ba89c8 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 _0x30b4=['register','./user.events','save','remove','emit','removeListener'];(function(_0x3c963f,_0x277ba6){var _0x5995af=function(_0x1a02c1){while(--_0x1a02c1){_0x3c963f['push'](_0x3c963f['shift']());}};_0x5995af(++_0x277ba6);}(_0x30b4,0x1e1));var _0x430b=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0x30b4[_0x1b664d];return _0x43af6b;};'use strict';var UserEvents=require(_0x430b('0x0'));var events=[_0x430b('0x1'),_0x430b('0x2'),'update'];function createListener(_0x5decbc,_0x585a77){return function(_0x423a01){_0x585a77[_0x430b('0x3')](_0x5decbc,_0x423a01);};}function removeListener(_0x27f8df,_0x3178d3){return function(){UserEvents[_0x430b('0x4')](_0x27f8df,_0x3178d3);};}exports[_0x430b('0x5')]=function(_0x33a2ce){for(var _0x3a6377=0x0,_0x2d04db=events['length'];_0x3a6377<_0x2d04db;_0x3a6377++){var _0x4af45c=events[_0x3a6377];var _0x4bd1e3=createListener('user:'+_0x4af45c,_0x33a2ce);UserEvents['on'](_0x4af45c,_0x4bd1e3);}}; \ No newline at end of file +var _0x5074=['update','emit','length','user:','./user.events','save','remove'];(function(_0x408e21,_0x407fcd){var _0x162aec=function(_0x52632f){while(--_0x52632f){_0x408e21['push'](_0x408e21['shift']());}};_0x162aec(++_0x407fcd);}(_0x5074,0xdd));var _0x4507=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0x5074[_0x1a3e23];return _0x5ee0d8;};'use strict';var UserEvents=require(_0x4507('0x0'));var events=[_0x4507('0x1'),_0x4507('0x2'),_0x4507('0x3')];function createListener(_0x4b36e3,_0x47fe6d){return function(_0x26a47a){_0x47fe6d[_0x4507('0x4')](_0x4b36e3,_0x26a47a);};}function removeListener(_0x4e2462,_0x5e2490){return function(){UserEvents['removeListener'](_0x4e2462,_0x5e2490);};}exports['register']=function(_0x5a117a){for(var _0x53f911=0x0,_0x1ac65f=events[_0x4507('0x5')];_0x53f911<_0x1ac65f;_0x53f911++){var _0x405ef7=events[_0x53f911];var _0x29d721=createListener(_0x4507('0x6')+_0x405ef7,_0x5a117a);UserEvents['on'](_0x405ef7,_0x29d721);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index bf051f9..d43885f 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 _0x4400=['util','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x469c14,_0x2f43eb){var _0x4e5129=function(_0x1453d9){while(--_0x1453d9){_0x469c14['push'](_0x469c14['shift']());}};_0x4e5129(++_0x2f43eb);}(_0x4400,0xf4));var _0x0440=function(_0x2d3308,_0x288134){_0x2d3308=_0x2d3308-0x0;var _0x562e33=_0x4400[_0x2d3308];return _0x562e33;};'use strict';var multer=require(_0x0440('0x0'));var util=require(_0x0440('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0440('0x2'));var router=express[_0x0440('0x3')]();var auth=require(_0x0440('0x4'));var interaction=require(_0x0440('0x5'));var config=require('../../config/environment');module[_0x0440('0x6')]=router; \ No newline at end of file +var _0xa26e=['util','path','express','Router','../../components/interaction/service','../../config/environment','multer'];(function(_0x4af45e,_0xa921ff){var _0x20e6da=function(_0x502525){while(--_0x502525){_0x4af45e['push'](_0x4af45e['shift']());}};_0x20e6da(++_0xa921ff);}(_0xa26e,0x11e));var _0xea26=function(_0x2a5d91,_0x1ab2be){_0x2a5d91=_0x2a5d91-0x0;var _0x174723=_0xa26e[_0x2a5d91];return _0x174723;};'use strict';var multer=require(_0xea26('0x0'));var util=require(_0xea26('0x1'));var path=require(_0xea26('0x2'));var timeout=require('connect-timeout');var express=require(_0xea26('0x3'));var router=express[_0xea26('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xea26('0x5'));var config=require(_0xea26('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 67c8f07..702a964 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(_0x327edf,_0x4143a1){var _0x31df9d=function(_0x41a767){while(--_0x41a767){_0x327edf['push'](_0x327edf['shift']());}};_0x31df9d(++_0x4143a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x42456d,_0x3c719a){var _0x55c359=function(_0x58b95b){while(--_0x58b95b){_0x42456d['push'](_0x42456d['shift']());}};_0x55c359(++_0x3c719a);}(_0xe706,0xa3));var _0x6e70=function(_0x3b6d96,_0x5d3241){_0x3b6d96=_0x3b6d96-0x0;var _0x1e6b1c=_0xe706[_0x3b6d96];return _0x1e6b1c;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index a3aecc6..1737c11 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 _0x4114=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x3c3ddc,_0x1408d5){var _0x1c9a42=function(_0x57e824){while(--_0x57e824){_0x3c3ddc['push'](_0x3c3ddc['shift']());}};_0x1c9a42(++_0x1408d5);}(_0x4114,0x1aa));var _0x4411=function(_0x2bc057,_0x357822){_0x2bc057=_0x2bc057-0x0;var _0x18dff1=_0x4114[_0x2bc057];return _0x18dff1;};'use strict';var _=require(_0x4411('0x0'));var util=require(_0x4411('0x1'));var logger=require(_0x4411('0x2'))('api');var moment=require(_0x4411('0x3'));var BPromise=require(_0x4411('0x4'));var rp=require(_0x4411('0x5'));var fs=require('fs');var path=require(_0x4411('0x6'));var rimraf=require(_0x4411('0x7'));var config=require(_0x4411('0x8'));var attributes=require('./userChatQueue.attributes');module[_0x4411('0x9')]=function(_0x62c89b,_0x58fcbe){return _0x62c89b[_0x4411('0xa')](_0x4411('0xb'),attributes,{'tableName':_0x4411('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c62=['user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x1c62,0xb5));var _0x21c6=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x1c62[_0xc82d1a];return _0x32fad2;};'use strict';var _=require(_0x21c6('0x0'));var util=require(_0x21c6('0x1'));var logger=require(_0x21c6('0x2'))(_0x21c6('0x3'));var moment=require('moment');var BPromise=require(_0x21c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x21c6('0x5'));var config=require(_0x21c6('0x6'));var attributes=require(_0x21c6('0x7'));module[_0x21c6('0x8')]=function(_0x3dd8fd,_0x24d477){return _0x3dd8fd[_0x21c6('0x9')](_0x21c6('0xa'),attributes,{'tableName':_0x21c6('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 d85adc4..16514b6 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 _0x4d77=['stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x4d77,0x1e9));var _0x74d7=function(_0x323fd6,_0x23231a){_0x323fd6=_0x323fd6-0x0;var _0x2df4e2=_0x4d77[_0x323fd6];return _0x2df4e2;};'use strict';var _=require(_0x74d7('0x0'));var util=require(_0x74d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74d7('0x3'))['db'];var utils=require(_0x74d7('0x4'));var logger=require(_0x74d7('0x5'))(_0x74d7('0x6'));var config=require(_0x74d7('0x7'));var jayson=require(_0x74d7('0x8'));var client=jayson[_0x74d7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257de2,_0x57bf6c,_0x5a0710){return new BPromise(function(_0x3b0cd8,_0x589b10){return client['request'](_0x257de2,_0x5a0710)[_0x74d7('0xa')](function(_0x2ce486){logger[_0x74d7('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x57bf6c,'request\x20sent');logger[_0x74d7('0xc')](_0x74d7('0xd'),_0x57bf6c,_0x74d7('0xe'),JSON[_0x74d7('0xf')](_0x2ce486));if(_0x2ce486[_0x74d7('0x10')]){if(_0x2ce486[_0x74d7('0x10')][_0x74d7('0x11')]===0x1f4){logger[_0x74d7('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x57bf6c,_0x2ce486[_0x74d7('0x10')][_0x74d7('0x12')]);return _0x589b10(_0x2ce486['error'][_0x74d7('0x12')]);}logger[_0x74d7('0x10')](_0x74d7('0x13'),_0x57bf6c,_0x2ce486[_0x74d7('0x10')]['message']);return _0x3b0cd8(_0x2ce486[_0x74d7('0x10')][_0x74d7('0x12')]);}else{logger[_0x74d7('0xb')](_0x74d7('0x13'),_0x57bf6c,_0x74d7('0xe'));_0x3b0cd8(_0x2ce486['result'][_0x74d7('0x12')]);}})[_0x74d7('0x14')](function(_0x87a5b3){logger[_0x74d7('0x10')](_0x74d7('0x13'),_0x57bf6c,_0x87a5b3);_0x589b10(_0x87a5b3);});});} \ No newline at end of file +var _0x907a=['stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1b65fa,_0x525365){var _0x2e3e6b=function(_0x2affef){while(--_0x2affef){_0x1b65fa['push'](_0x1b65fa['shift']());}};_0x2e3e6b(++_0x525365);}(_0x907a,0xb6));var _0xa907=function(_0x36c9fa,_0x26d8fd){_0x36c9fa=_0x36c9fa-0x0;var _0x44a286=_0x907a[_0x36c9fa];return _0x44a286;};'use strict';var _=require('lodash');var util=require(_0xa907('0x0'));var moment=require(_0xa907('0x1'));var BPromise=require(_0xa907('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa907('0x3'));var db=require(_0xa907('0x4'))['db'];var utils=require(_0xa907('0x5'));var logger=require(_0xa907('0x6'))(_0xa907('0x7'));var config=require(_0xa907('0x8'));var jayson=require(_0xa907('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x254762,_0x6d3ed5,_0x37e673){return new BPromise(function(_0x38a036,_0x31a1e9){return client[_0xa907('0xa')](_0x254762,_0x37e673)[_0xa907('0xb')](function(_0x33f53b){logger['info'](_0xa907('0xc'),_0x6d3ed5,_0xa907('0xd'));logger[_0xa907('0xe')](_0xa907('0xf'),_0x6d3ed5,'request\x20sent',JSON[_0xa907('0x10')](_0x33f53b));if(_0x33f53b[_0xa907('0x11')]){if(_0x33f53b[_0xa907('0x11')]['code']===0x1f4){logger[_0xa907('0x11')](_0xa907('0xc'),_0x6d3ed5,_0x33f53b[_0xa907('0x11')][_0xa907('0x12')]);return _0x31a1e9(_0x33f53b['error'][_0xa907('0x12')]);}logger[_0xa907('0x11')](_0xa907('0xc'),_0x6d3ed5,_0x33f53b[_0xa907('0x11')][_0xa907('0x12')]);return _0x38a036(_0x33f53b[_0xa907('0x11')][_0xa907('0x12')]);}else{logger[_0xa907('0x13')](_0xa907('0xc'),_0x6d3ed5,_0xa907('0xd'));_0x38a036(_0x33f53b[_0xa907('0x14')][_0xa907('0x12')]);}})[_0xa907('0x15')](function(_0xe41a90){logger[_0xa907('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x6d3ed5,_0xe41a90);_0x31a1e9(_0xe41a90);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 721cf2e..d409f16 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 _0x1021=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x54fc23,_0x13657e){var _0x1948e5=function(_0x3c3c69){while(--_0x3c3c69){_0x54fc23['push'](_0x54fc23['shift']());}};_0x1948e5(++_0x13657e);}(_0x1021,0x124));var _0x1102=function(_0x1e0d89,_0x4e0482){_0x1e0d89=_0x1e0d89-0x0;var _0x140d15=_0x1021[_0x1e0d89];return _0x140d15;};'use strict';var multer=require(_0x1102('0x0'));var util=require(_0x1102('0x1'));var path=require(_0x1102('0x2'));var timeout=require(_0x1102('0x3'));var express=require(_0x1102('0x4'));var router=express[_0x1102('0x5')]();var auth=require(_0x1102('0x6'));var interaction=require(_0x1102('0x7'));var config=require(_0x1102('0x8'));module[_0x1102('0x9')]=router; \ No newline at end of file +var _0x75c7=['connect-timeout','express','Router','../../components/auth/service','exports','multer','util','path'];(function(_0x3fa53a,_0x2f7c6a){var _0x470a3a=function(_0x4dcbfd){while(--_0x4dcbfd){_0x3fa53a['push'](_0x3fa53a['shift']());}};_0x470a3a(++_0x2f7c6a);}(_0x75c7,0x155));var _0x775c=function(_0x4f0da6,_0xe671a1){_0x4f0da6=_0x4f0da6-0x0;var _0x4dd88f=_0x75c7[_0x4f0da6];return _0x4dd88f;};'use strict';var multer=require(_0x775c('0x0'));var util=require(_0x775c('0x1'));var path=require(_0x775c('0x2'));var timeout=require(_0x775c('0x3'));var express=require(_0x775c('0x4'));var router=express[_0x775c('0x5')]();var auth=require(_0x775c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x775c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 385f93a..3614753 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefda=['sequelize','INTEGER','STRING'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xefda,0x96));var _0xaefd=function(_0x54fc91,_0x30f519){_0x54fc91=_0x54fc91-0x0;var _0x1a0c37=_0xefda[_0x54fc91];return _0x1a0c37;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaefd('0x2')]}}; \ No newline at end of file +var _0xb62e=['INTEGER','sequelize','exports'];(function(_0x2508c1,_0x2c8c3a){var _0x32c5f7=function(_0x165271){while(--_0x165271){_0x2508c1['push'](_0x2508c1['shift']());}};_0x32c5f7(++_0x2c8c3a);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'penalty':{'type':Sequelize[_0xeb62('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeb62('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f962edd..d163516 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(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xb10b,0x12a));var _0xbb10=function(_0x2199f1,_0x10c734){_0x2199f1=_0x2199f1-0x0;var _0x43436b=_0xb10b[_0x2199f1];return _0x43436b;};'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 _0x5f2f=['bluebird','request-promise','path','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment'];(function(_0x1e9930,_0x343df5){var _0xe769fd=function(_0x26588f){while(--_0x26588f){_0x1e9930['push'](_0x1e9930['shift']());}};_0xe769fd(++_0x343df5);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc91b5c,_0x3468c4){_0xc91b5c=_0xc91b5c-0x0;var _0x43352c=_0x5f2f[_0xc91b5c];return _0x43352c;};'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':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 5e31d56..60c9b98 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 _0x8807=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x35de68,_0x165ef8){var _0xf70815=function(_0x731b8e){while(--_0x731b8e){_0x35de68['push'](_0x35de68['shift']());}};_0xf70815(++_0x165ef8);}(_0x8807,0xac));var _0x7880=function(_0x1c0a25,_0x227201){_0x1c0a25=_0x1c0a25-0x0;var _0x4ddd7e=_0x8807[_0x1c0a25];return _0x4ddd7e;};'use strict';var _=require('lodash');var util=require(_0x7880('0x0'));var moment=require(_0x7880('0x1'));var BPromise=require(_0x7880('0x2'));var rs=require(_0x7880('0x3'));var fs=require('fs');var Redis=require(_0x7880('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7880('0x5'));var logger=require('../../config/logger')(_0x7880('0x6'));var config=require(_0x7880('0x7'));var jayson=require(_0x7880('0x8'));var client=jayson[_0x7880('0x9')][_0x7880('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20a358,_0x1c5da6,_0x5dd3d4){return new BPromise(function(_0x483193,_0x3b7fd6){return client['request'](_0x20a358,_0x5dd3d4)['then'](function(_0x40f3ed){logger['info'](_0x7880('0xb'),_0x1c5da6,_0x7880('0xc'));logger[_0x7880('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1c5da6,_0x7880('0xc'),JSON[_0x7880('0xe')](_0x40f3ed));if(_0x40f3ed[_0x7880('0xf')]){if(_0x40f3ed[_0x7880('0xf')]['code']===0x1f4){logger[_0x7880('0xf')](_0x7880('0xb'),_0x1c5da6,_0x40f3ed[_0x7880('0xf')]['message']);return _0x3b7fd6(_0x40f3ed[_0x7880('0xf')][_0x7880('0x10')]);}logger[_0x7880('0xf')](_0x7880('0xb'),_0x1c5da6,_0x40f3ed['error'][_0x7880('0x10')]);return _0x483193(_0x40f3ed[_0x7880('0xf')]['message']);}else{logger[_0x7880('0x11')](_0x7880('0xb'),_0x1c5da6,_0x7880('0xc'));_0x483193(_0x40f3ed['result'][_0x7880('0x10')]);}})[_0x7880('0x12')](function(_0x35b044){logger[_0x7880('0xf')](_0x7880('0xb'),_0x1c5da6,_0x35b044);_0x3b7fd6(_0x35b044);});});} \ No newline at end of file +var _0x8102=['message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8102,0x9c));var _0x2810=function(_0x402475,_0x4a0afc){_0x402475=_0x402475-0x0;var _0x21b5a4=_0x8102[_0x402475];return _0x21b5a4;};'use strict';var _=require(_0x2810('0x0'));var util=require(_0x2810('0x1'));var moment=require('moment');var BPromise=require(_0x2810('0x2'));var rs=require(_0x2810('0x3'));var fs=require('fs');var Redis=require(_0x2810('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2810('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2810('0x6'));var client=jayson[_0x2810('0x7')][_0x2810('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c3bee,_0xcb3add,_0x3a8290){return new BPromise(function(_0x54ed2d,_0x2e5fff){return client[_0x2810('0x9')](_0x5c3bee,_0x3a8290)[_0x2810('0xa')](function(_0x8e33e0){logger[_0x2810('0xb')](_0x2810('0xc'),_0xcb3add,'request\x20sent');logger[_0x2810('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0xcb3add,'request\x20sent',JSON['stringify'](_0x8e33e0));if(_0x8e33e0[_0x2810('0xe')]){if(_0x8e33e0['error']['code']===0x1f4){logger['error'](_0x2810('0xc'),_0xcb3add,_0x8e33e0['error'][_0x2810('0xf')]);return _0x2e5fff(_0x8e33e0[_0x2810('0xe')][_0x2810('0xf')]);}logger[_0x2810('0xe')](_0x2810('0xc'),_0xcb3add,_0x8e33e0[_0x2810('0xe')][_0x2810('0xf')]);return _0x54ed2d(_0x8e33e0['error']['message']);}else{logger[_0x2810('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0xcb3add,_0x2810('0x10'));_0x54ed2d(_0x8e33e0[_0x2810('0x11')][_0x2810('0xf')]);}})[_0x2810('0x12')](function(_0x5a72b1){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0xcb3add,_0x5a72b1);_0x2e5fff(_0x5a72b1);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ee0905d..b450efe 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 _0xc727=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc727,0x16c));var _0x7c72=function(_0x236174,_0x202c44){_0x236174=_0x236174-0x0;var _0x465a51=_0xc727[_0x236174];return _0x465a51;};'use strict';var multer=require(_0x7c72('0x0'));var util=require(_0x7c72('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7c72('0x2'));var router=express[_0x7c72('0x3')]();var auth=require(_0x7c72('0x4'));var interaction=require(_0x7c72('0x5'));var config=require(_0x7c72('0x6'));module['exports']=router; \ No newline at end of file +var _0xa7f4=['express','Router','../../components/auth/service','exports','multer','connect-timeout'];(function(_0x5856be,_0x2c2b1e){var _0x5a4af6=function(_0x263a97){while(--_0x263a97){_0x5856be['push'](_0x5856be['shift']());}};_0x5a4af6(++_0x2c2b1e);}(_0xa7f4,0xb2));var _0x4a7f=function(_0x577749,_0x3499aa){_0x577749=_0x577749-0x0;var _0x4d406f=_0xa7f4[_0x577749];return _0x4d406f;};'use strict';var multer=require(_0x4a7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4a7f('0x1'));var express=require(_0x4a7f('0x2'));var router=express[_0x4a7f('0x3')]();var auth=require(_0x4a7f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4a7f('0x5')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 91d7f4f..fe9c3f7 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 _0xbaf0=['exports','INTEGER'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3dd92b,_0x4d1139){var _0x5e1d23=function(_0x5d866f){while(--_0x5d866f){_0x3dd92b['push'](_0x3dd92b['shift']());}};_0x5e1d23(++_0x4d1139);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 7297f8d..9ee39e6 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(_0x320227,_0x2a6dca){var _0x39be31=function(_0x25aae9){while(--_0x25aae9){_0x320227['push'](_0x320227['shift']());}};_0x39be31(++_0x2a6dca);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x30a4e1,_0x3e4acf){var _0x42a2c6=function(_0x1cefdf){while(--_0x1cefdf){_0x30a4e1['push'](_0x30a4e1['shift']());}};_0x42a2c6(++_0x3e4acf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 187e0b5..3196c7c 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 _0x9a96=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a96,0xd0));var _0x69a9=function(_0x22af50,_0x321323){_0x22af50=_0x22af50-0x0;var _0x1f81ee=_0x9a96[_0x22af50];return _0x1f81ee;};'use strict';var _=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var moment=require(_0x69a9('0x2'));var BPromise=require(_0x69a9('0x3'));var rs=require(_0x69a9('0x4'));var fs=require('fs');var Redis=require(_0x69a9('0x5'));var db=require(_0x69a9('0x6'))['db'];var utils=require(_0x69a9('0x7'));var logger=require(_0x69a9('0x8'))(_0x69a9('0x9'));var config=require(_0x69a9('0xa'));var jayson=require(_0x69a9('0xb'));var client=jayson['client'][_0x69a9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x260fd3,_0xca335e,_0x2306b8){return new BPromise(function(_0x49125f,_0x371fd0){return client[_0x69a9('0xd')](_0x260fd3,_0x2306b8)[_0x69a9('0xe')](function(_0x2587ef){logger[_0x69a9('0xf')](_0x69a9('0x10'),_0xca335e,_0x69a9('0x11'));logger['debug'](_0x69a9('0x12'),_0xca335e,'request\x20sent',JSON[_0x69a9('0x13')](_0x2587ef));if(_0x2587ef[_0x69a9('0x14')]){if(_0x2587ef[_0x69a9('0x14')]['code']===0x1f4){logger[_0x69a9('0x14')](_0x69a9('0x10'),_0xca335e,_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);return _0x371fd0(_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);}logger[_0x69a9('0x14')](_0x69a9('0x10'),_0xca335e,_0x2587ef['error'][_0x69a9('0x15')]);return _0x49125f(_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);}else{logger[_0x69a9('0xf')](_0x69a9('0x10'),_0xca335e,_0x69a9('0x11'));_0x49125f(_0x2587ef['result']['message']);}})[_0x69a9('0x16')](function(_0x2061e4){logger[_0x69a9('0x14')]('UserMailQueue,\x20%s,\x20%s',_0xca335e,_0x2061e4);_0x371fd0(_0x2061e4);});});} \ No newline at end of file +var _0x2f74=['http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2ca482,_0x96795a){var _0x3caff5=function(_0x40f539){while(--_0x40f539){_0x2ca482['push'](_0x2ca482['shift']());}};_0x3caff5(++_0x96795a);}(_0x2f74,0x7b));var _0x42f7=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x2f74[_0x351b46];return _0x1515df;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var moment=require(_0x42f7('0x1'));var BPromise=require(_0x42f7('0x2'));var rs=require(_0x42f7('0x3'));var fs=require('fs');var Redis=require(_0x42f7('0x4'));var db=require(_0x42f7('0x5'))['db'];var utils=require(_0x42f7('0x6'));var logger=require(_0x42f7('0x7'))(_0x42f7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x42f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cb6e0,_0x20ff46,_0x36b55e){return new BPromise(function(_0x2c64b2,_0x28fc83){return client[_0x42f7('0xa')](_0x1cb6e0,_0x36b55e)[_0x42f7('0xb')](function(_0x5772a8){logger[_0x42f7('0xc')](_0x42f7('0xd'),_0x20ff46,_0x42f7('0xe'));logger[_0x42f7('0xf')](_0x42f7('0x10'),_0x20ff46,_0x42f7('0xe'),JSON['stringify'](_0x5772a8));if(_0x5772a8[_0x42f7('0x11')]){if(_0x5772a8[_0x42f7('0x11')][_0x42f7('0x12')]===0x1f4){logger[_0x42f7('0x11')](_0x42f7('0xd'),_0x20ff46,_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);return _0x28fc83(_0x5772a8[_0x42f7('0x11')]['message']);}logger['error'](_0x42f7('0xd'),_0x20ff46,_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);return _0x2c64b2(_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);}else{logger['info'](_0x42f7('0xd'),_0x20ff46,'request\x20sent');_0x2c64b2(_0x5772a8[_0x42f7('0x14')][_0x42f7('0x13')]);}})[_0x42f7('0x15')](function(_0x19eff3){logger[_0x42f7('0x11')](_0x42f7('0xd'),_0x20ff46,_0x19eff3);_0x28fc83(_0x19eff3);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c852616..9104aa9 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 _0xe535=['../../config/environment','multer','util','path','Router','../../components/auth/service'];(function(_0x183dc1,_0x12b97c){var _0x551e45=function(_0x5a2fb4){while(--_0x5a2fb4){_0x183dc1['push'](_0x183dc1['shift']());}};_0x551e45(++_0x12b97c);}(_0xe535,0x109));var _0x5e53=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xe535[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x5e53('0x0'));var util=require(_0x5e53('0x1'));var path=require(_0x5e53('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e53('0x3')]();var auth=require(_0x5e53('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5e53('0x5'));module['exports']=router; \ No newline at end of file +var _0x5e2f=['exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x164d16,_0x2f39a9){var _0x2cff6b=function(_0x32f3c7){while(--_0x32f3c7){_0x164d16['push'](_0x164d16['shift']());}};_0x2cff6b(++_0x2f39a9);}(_0x5e2f,0x14b));var _0xf5e2=function(_0x31603f,_0x5240f3){_0x31603f=_0x31603f-0x0;var _0x4d0d60=_0x5e2f[_0x31603f];return _0x4d0d60;};'use strict';var multer=require(_0xf5e2('0x0'));var util=require('util');var path=require(_0xf5e2('0x1'));var timeout=require(_0xf5e2('0x2'));var express=require(_0xf5e2('0x3'));var router=express['Router']();var auth=require(_0xf5e2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xf5e2('0x5')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index fa93ebc..ab0bd25 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(_0x2a7210,_0x2f3d23){var _0x460766=function(_0xd575dd){while(--_0xd575dd){_0x2a7210['push'](_0x2a7210['shift']());}};_0x460766(++_0x2f3d23);}(_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(_0x5a4154,_0x55dfd8){var _0x1f4746=function(_0x559225){while(--_0x559225){_0x5a4154['push'](_0x5a4154['shift']());}};_0x1f4746(++_0x55dfd8);}(_0xe706,0xa3));var _0x6e70=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xe706[_0xd0cd0b];return _0x59cced;};'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 9a1f1b8..11878cf 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 _0x4783=['./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x348472,_0x133d9d){var _0x55251e=function(_0x416d17){while(--_0x416d17){_0x348472['push'](_0x348472['shift']());}};_0x55251e(++_0x133d9d);}(_0x4783,0xd0));var _0x3478=function(_0x2d28b1,_0x1fa19c){_0x2d28b1=_0x2d28b1-0x0;var _0xf1657c=_0x4783[_0x2d28b1];return _0xf1657c;};'use strict';var _=require(_0x3478('0x0'));var util=require('util');var logger=require(_0x3478('0x1'))(_0x3478('0x2'));var moment=require(_0x3478('0x3'));var BPromise=require(_0x3478('0x4'));var rp=require(_0x3478('0x5'));var fs=require('fs');var path=require(_0x3478('0x6'));var rimraf=require(_0x3478('0x7'));var config=require('../../config/environment');var attributes=require(_0x3478('0x8'));module[_0x3478('0x9')]=function(_0x5a5301,_0x72ad4a){return _0x5a5301[_0x3478('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x3478('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76f6=['api','moment','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','lodash','util'];(function(_0x92d83a,_0x13ce86){var _0x416fdd=function(_0x33e4f6){while(--_0x33e4f6){_0x92d83a['push'](_0x92d83a['shift']());}};_0x416fdd(++_0x13ce86);}(_0x76f6,0x1b7));var _0x676f=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x76f6[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x676f('0x0'));var util=require(_0x676f('0x1'));var logger=require('../../config/logger')(_0x676f('0x2'));var moment=require(_0x676f('0x3'));var BPromise=require(_0x676f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x676f('0x5'));var config=require(_0x676f('0x6'));var attributes=require(_0x676f('0x7'));module[_0x676f('0x8')]=function(_0x2f6e05,_0x5de28a){return _0x2f6e05['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 6617712..7c5e1cb 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 _0x164b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x164b,0x12d));var _0xb164=function(_0x2bb0fa,_0x2b3066){_0x2bb0fa=_0x2bb0fa-0x0;var _0x469f7b=_0x164b[_0x2bb0fa];return _0x469f7b;};'use strict';var _=require(_0xb164('0x0'));var util=require(_0xb164('0x1'));var moment=require(_0xb164('0x2'));var BPromise=require(_0xb164('0x3'));var rs=require(_0xb164('0x4'));var fs=require('fs');var Redis=require(_0xb164('0x5'));var db=require(_0xb164('0x6'))['db'];var utils=require(_0xb164('0x7'));var logger=require(_0xb164('0x8'))('rpc');var config=require(_0xb164('0x9'));var jayson=require(_0xb164('0xa'));var client=jayson[_0xb164('0xb')][_0xb164('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x540f36,_0x3c46e9,_0x5973c6){return new BPromise(function(_0x160e53,_0x1ce4b8){return client[_0xb164('0xd')](_0x540f36,_0x5973c6)[_0xb164('0xe')](function(_0x458acf){logger['info'](_0xb164('0xf'),_0x3c46e9,'request\x20sent');logger[_0xb164('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3c46e9,_0xb164('0x11'),JSON['stringify'](_0x458acf));if(_0x458acf[_0xb164('0x12')]){if(_0x458acf[_0xb164('0x12')][_0xb164('0x13')]===0x1f4){logger['error'](_0xb164('0xf'),_0x3c46e9,_0x458acf[_0xb164('0x12')][_0xb164('0x14')]);return _0x1ce4b8(_0x458acf[_0xb164('0x12')][_0xb164('0x14')]);}logger['error'](_0xb164('0xf'),_0x3c46e9,_0x458acf[_0xb164('0x12')][_0xb164('0x14')]);return _0x160e53(_0x458acf[_0xb164('0x12')][_0xb164('0x14')]);}else{logger['info'](_0xb164('0xf'),_0x3c46e9,_0xb164('0x11'));_0x160e53(_0x458acf[_0xb164('0x15')]['message']);}})['catch'](function(_0x1d62ef){logger[_0xb164('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3c46e9,_0x1d62ef);_0x1ce4b8(_0x1d62ef);});});} \ No newline at end of file +var _0x94f4=['jayson/promise','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x94f4,0xa7));var _0x494f=function(_0x11f49a,_0x321122){_0x11f49a=_0x11f49a-0x0;var _0x34054e=_0x94f4[_0x11f49a];return _0x34054e;};'use strict';var _=require(_0x494f('0x0'));var util=require(_0x494f('0x1'));var moment=require('moment');var BPromise=require(_0x494f('0x2'));var rs=require(_0x494f('0x3'));var fs=require('fs');var Redis=require(_0x494f('0x4'));var db=require(_0x494f('0x5'))['db'];var utils=require(_0x494f('0x6'));var logger=require(_0x494f('0x7'))('rpc');var config=require(_0x494f('0x8'));var jayson=require(_0x494f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e5c16,_0x1f698b,_0x45c7a6){return new BPromise(function(_0x44f80d,_0x467fd9){return client[_0x494f('0xa')](_0x3e5c16,_0x45c7a6)[_0x494f('0xb')](function(_0x296efb){logger[_0x494f('0xc')](_0x494f('0xd'),_0x1f698b,'request\x20sent');logger[_0x494f('0xe')](_0x494f('0xf'),_0x1f698b,_0x494f('0x10'),JSON[_0x494f('0x11')](_0x296efb));if(_0x296efb[_0x494f('0x12')]){if(_0x296efb['error']['code']===0x1f4){logger[_0x494f('0x12')](_0x494f('0xd'),_0x1f698b,_0x296efb[_0x494f('0x12')]['message']);return _0x467fd9(_0x296efb[_0x494f('0x12')]['message']);}logger[_0x494f('0x12')](_0x494f('0xd'),_0x1f698b,_0x296efb[_0x494f('0x12')][_0x494f('0x13')]);return _0x44f80d(_0x296efb[_0x494f('0x12')]['message']);}else{logger[_0x494f('0xc')](_0x494f('0xd'),_0x1f698b,_0x494f('0x10'));_0x44f80d(_0x296efb[_0x494f('0x14')][_0x494f('0x13')]);}})[_0x494f('0x15')](function(_0x161317){logger[_0x494f('0x12')](_0x494f('0xd'),_0x1f698b,_0x161317);_0x467fd9(_0x161317);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7880332..10d52fe 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 _0x783b=['clone','addSections','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone'];(function(_0x5b2728,_0x27c28a){var _0x505960=function(_0x1460db){while(--_0x1460db){_0x5b2728['push'](_0x5b2728['shift']());}};_0x505960(++_0x27c28a);}(_0x783b,0xab));var _0xb783=function(_0x417dcb,_0x2c71da){_0x417dcb=_0x417dcb-0x0;var _0x27cbca=_0x783b[_0x417dcb];return _0x27cbca;};'use strict';var multer=require(_0xb783('0x0'));var util=require(_0xb783('0x1'));var path=require(_0xb783('0x2'));var timeout=require(_0xb783('0x3'));var express=require('express');var router=express[_0xb783('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb783('0x5'));var config=require(_0xb783('0x6'));var controller=require(_0xb783('0x7'));router[_0xb783('0x8')]('/',auth['isAuthenticated'](),controller[_0xb783('0x9')]);router[_0xb783('0x8')](_0xb783('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb783('0x8')](_0xb783('0xb'),auth[_0xb783('0xc')](),controller[_0xb783('0xd')]);router['get'](_0xb783('0xe'),auth[_0xb783('0xc')](),controller[_0xb783('0xf')]);router[_0xb783('0x8')](_0xb783('0x10'),auth[_0xb783('0xc')](),controller[_0xb783('0x11')]);router[_0xb783('0x12')]('/',auth['isAuthenticated'](),controller[_0xb783('0x13')]);router[_0xb783('0x12')](_0xb783('0x14'),auth[_0xb783('0xc')](),controller[_0xb783('0x15')]);router[_0xb783('0x12')](_0xb783('0xe'),auth[_0xb783('0xc')](),controller[_0xb783('0x16')]);router[_0xb783('0x12')]('/:id/resources',auth[_0xb783('0xc')](),controller['addResources']);router['put'](_0xb783('0xb'),auth[_0xb783('0xc')](),controller['update']);router[_0xb783('0x17')]('/:id',auth[_0xb783('0xc')](),controller['destroy']);router[_0xb783('0x17')](_0xb783('0xe'),auth[_0xb783('0xc')](),controller['removeSections']);router[_0xb783('0x17')]('/:id/resources',auth[_0xb783('0xc')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0xa331=['/describe','describe','/:id','isAuthenticated','show','/:id/sections','getSections','/:id/resources','post','addSections','addResources','put','update','delete','destroy','removeSections','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','index','get'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa331,0x1eb));var _0x1a33=function(_0x37f0ef,_0x4911c9){_0x37f0ef=_0x37f0ef-0x0;var _0x452c30=_0xa331[_0x37f0ef];return _0x452c30;};'use strict';var multer=require(_0x1a33('0x0'));var util=require('util');var path=require(_0x1a33('0x1'));var timeout=require(_0x1a33('0x2'));var express=require(_0x1a33('0x3'));var router=express['Router']();var auth=require(_0x1a33('0x4'));var interaction=require(_0x1a33('0x5'));var config=require('../../config/environment');var controller=require(_0x1a33('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1a33('0x7')]);router[_0x1a33('0x8')](_0x1a33('0x9'),auth['isAuthenticated'](),controller[_0x1a33('0xa')]);router[_0x1a33('0x8')](_0x1a33('0xb'),auth[_0x1a33('0xc')](),controller[_0x1a33('0xd')]);router['get'](_0x1a33('0xe'),auth[_0x1a33('0xc')](),controller[_0x1a33('0xf')]);router[_0x1a33('0x8')](_0x1a33('0x10'),auth[_0x1a33('0xc')](),controller['getResources']);router[_0x1a33('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a33('0x11')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router['post'](_0x1a33('0xe'),auth[_0x1a33('0xc')](),controller[_0x1a33('0x12')]);router[_0x1a33('0x11')](_0x1a33('0x10'),auth[_0x1a33('0xc')](),controller[_0x1a33('0x13')]);router[_0x1a33('0x14')](_0x1a33('0xb'),auth[_0x1a33('0xc')](),controller[_0x1a33('0x15')]);router[_0x1a33('0x16')](_0x1a33('0xb'),auth['isAuthenticated'](),controller[_0x1a33('0x17')]);router[_0x1a33('0x16')]('/:id/sections',auth['isAuthenticated'](),controller[_0x1a33('0x18')]);router[_0x1a33('0x16')](_0x1a33('0x10'),auth[_0x1a33('0xc')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 67a5bdb..f384118 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 _0x809a=['sequelize','exports','STRING','name','crudPermissions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x809a,0x186));var _0xa809=function(_0x30f98c,_0x11a7f3){_0x30f98c=_0x30f98c-0x0;var _0x2fc8b0=_0x809a[_0x30f98c];return _0x2fc8b0;};'use strict';var Sequelize=require(_0xa809('0x0'));module[_0xa809('0x1')]={'name':{'type':Sequelize[_0xa809('0x2')],'allowNull':![],'unique':_0xa809('0x3')},'crudPermissions':{'type':Sequelize[_0xa809('0x2')],'set':function(_0x4a33df){this['setDataValue']('crudPermissions',_0x4a33df?_0x4a33df['join'](''):[]);},'get':function(){return this['getDataValue'](_0xa809('0x4'))?this['getDataValue'](_0xa809('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa809('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3609=['crudPermissions','sequelize','exports','STRING','name','setDataValue','join','getDataValue'];(function(_0x2e25db,_0x16e096){var _0x4e5253=function(_0x2d2e61){while(--_0x2d2e61){_0x2e25db['push'](_0x2e25db['shift']());}};_0x4e5253(++_0x16e096);}(_0x3609,0x101));var _0x9360=function(_0x1a2f00,_0x431624){_0x1a2f00=_0x1a2f00-0x0;var _0x41c560=_0x3609[_0x1a2f00];return _0x41c560;};'use strict';var Sequelize=require(_0x9360('0x0'));module[_0x9360('0x1')]={'name':{'type':Sequelize[_0x9360('0x2')],'allowNull':![],'unique':_0x9360('0x3')},'crudPermissions':{'type':Sequelize[_0x9360('0x2')],'set':function(_0x42aad5){this[_0x9360('0x4')]('crudPermissions',_0x42aad5?_0x42aad5[_0x9360('0x5')](''):[]);},'get':function(){return this[_0x9360('0x6')](_0x9360('0x7'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9360('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d72bdc0..032f531 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 _0xaf84=['membername','User','Telephones','telephone','VoiceQueues','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','OpenchannelQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','QueueCampaigns','users','agents','Users','role','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','Pause','Schedule','sounds','Template','triggers','Trigger','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','clone','find','get','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','userProfileId','Resources','destroy','describe','sectionId','push','removeSections','ids','enabled','includes','subsections','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','ignore','union','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','CmContact','Tag','Tags','color','tag','ThroughTags','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xaf84,0x12f));var _0x4af8=function(_0x292fbe,_0x1148ec){_0x292fbe=_0x292fbe-0x0;var _0x53ddce=_0xaf84[_0x292fbe];return _0x53ddce;};'use strict';var pdf=require(_0x4af8('0x0'));var emlformat=require(_0x4af8('0x1'));var rimraf=require(_0x4af8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4af8('0x3'));var rp=require(_0x4af8('0x4'));var moment=require(_0x4af8('0x5'));var BPromise=require(_0x4af8('0x6'));var Mustache=require(_0x4af8('0x7'));var util=require(_0x4af8('0x8'));var path=require(_0x4af8('0x9'));var sox=require(_0x4af8('0xa'));var csv=require(_0x4af8('0xb'));var ejs=require(_0x4af8('0xc'));var fs=require('fs');var _=require(_0x4af8('0xd'));var squel=require(_0x4af8('0xe'));var crypto=require(_0x4af8('0xf'));var jsforce=require(_0x4af8('0x10'));var deskjs=require(_0x4af8('0x11'));var toCsv=require(_0x4af8('0xb'));var querystring=require(_0x4af8('0x12'));var Papa=require('papaparse');var Redis=require(_0x4af8('0x13'));var authService=require(_0x4af8('0x14'));var qs=require(_0x4af8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4af8('0x16'));var logger=require(_0x4af8('0x17'))('api');var utils=require(_0x4af8('0x18'));var config=require(_0x4af8('0x19'));var db=require(_0x4af8('0x1a'))['db'];config[_0x4af8('0x1b')]=_[_0x4af8('0x1c')](config[_0x4af8('0x1b')],{'host':_0x4af8('0x1d'),'port':0x18eb});var socket=require(_0x4af8('0x1e'))(new Redis(config['redis']));require(_0x4af8('0x1f'))['register'](socket);function respondWithStatusCode(_0x473947,_0x63fd28){_0x63fd28=_0x63fd28||0xcc;return function(_0x3e7a38){if(_0x3e7a38){return _0x473947[_0x4af8('0x20')](_0x63fd28);}return _0x473947['status'](_0x63fd28)[_0x4af8('0x21')]();};}function respondWithResult(_0x5cbe11,_0x3f168f){_0x3f168f=_0x3f168f||0xc8;return function(_0x1d2179){if(_0x1d2179){return _0x5cbe11['status'](_0x3f168f)['json'](_0x1d2179);}};}function respondWithFilteredResult(_0x3fd882,_0x555f8e){return function(_0x13af6e){if(_0x13af6e){var _0x72fd7e=_0x13af6e[_0x4af8('0x22')],_0x319a6a=_0x555f8e['offset'],_0x5cbd8e=_0x555f8e[_0x4af8('0x23')]+_0x555f8e[_0x4af8('0x24')],_0x353f35;if(_0x5cbd8e>=_0x72fd7e){_0x5cbd8e=_0x72fd7e;_0x353f35=0xc8;}else{_0x353f35=0xce;}_0x3fd882[_0x4af8('0x25')](_0x353f35);return _0x3fd882[_0x4af8('0x26')](_0x4af8('0x27'),_0x319a6a+'-'+_0x5cbd8e+'/'+_0x72fd7e)[_0x4af8('0x28')](_0x13af6e);}return null;};}function patchUpdates(_0x461f7d){return function(_0x344304){try{jsonpatch['apply'](_0x344304,_0x461f7d,!![]);}catch(_0x510faa){return BPromise[_0x4af8('0x29')](_0x510faa);}return _0x344304[_0x4af8('0x2a')]();};}function saveUpdates(_0x270fc0,_0x3b4d05){return function(_0x2d9ef3){if(_0x2d9ef3){return _0x2d9ef3[_0x4af8('0x2b')](_0x270fc0)['then'](function(_0x3d4aa6){return _0x3d4aa6;});}return null;};}function removeEntity(_0x387b22,_0x59642e){return function(_0x126567){if(_0x126567){return _0x126567['destroy']()[_0x4af8('0x2c')](function(){_0x387b22[_0x4af8('0x25')](0xcc)[_0x4af8('0x21')]();});}};}function handleEntityNotFound(_0x2bb749,_0x59af60){return function(_0x4b30a8){if(!_0x4b30a8){_0x2bb749[_0x4af8('0x20')](0x194);}return _0x4b30a8;};}function handleError(_0x3c8fae,_0x214dde){_0x214dde=_0x214dde||0x1f4;return function(_0x566125){logger['error'](_0x566125[_0x4af8('0x2d')]);if(_0x566125[_0x4af8('0x2e')]){delete _0x566125[_0x4af8('0x2e')];}_0x3c8fae[_0x4af8('0x25')](_0x214dde)[_0x4af8('0x2f')](_0x566125);};}exports[_0x4af8('0x30')]=function(_0x278873,_0x56ce5f){var _0x2a78a3={},_0x42f786={},_0x1f36ba={'count':0x0,'rows':[]};var _0x26e701=_[_0x4af8('0x31')](db[_0x4af8('0x32')][_0x4af8('0x33')],function(_0x35ed4f){return{'name':_0x35ed4f[_0x4af8('0x34')],'type':_0x35ed4f['type'][_0x4af8('0x35')]};});_0x42f786[_0x4af8('0x36')]=_[_0x4af8('0x31')](_0x26e701,_0x4af8('0x2e'));_0x42f786['query']=_[_0x4af8('0x37')](_0x278873[_0x4af8('0x38')]);_0x42f786[_0x4af8('0x39')]=_[_0x4af8('0x3a')](_0x42f786[_0x4af8('0x36')],_0x42f786['query']);_0x2a78a3['attributes']=_['intersection'](_0x42f786[_0x4af8('0x36')],qs[_0x4af8('0x3b')](_0x278873[_0x4af8('0x38')][_0x4af8('0x3b')]));_0x2a78a3[_0x4af8('0x3c')]=_0x2a78a3[_0x4af8('0x3c')][_0x4af8('0x3d')]?_0x2a78a3[_0x4af8('0x3c')]:_0x42f786['model'];if(!_0x278873['query'][_0x4af8('0x3e')](_0x4af8('0x3f'))){_0x2a78a3['limit']=qs[_0x4af8('0x24')](_0x278873[_0x4af8('0x38')][_0x4af8('0x24')]);_0x2a78a3['offset']=qs[_0x4af8('0x23')](_0x278873[_0x4af8('0x38')]['offset']);}_0x2a78a3[_0x4af8('0x40')]=qs[_0x4af8('0x41')](_0x278873[_0x4af8('0x38')]['sort']);_0x2a78a3[_0x4af8('0x42')]=qs[_0x4af8('0x39')](_[_0x4af8('0x43')](_0x278873['query'],_0x42f786[_0x4af8('0x39')]),_0x26e701);if(_0x278873[_0x4af8('0x38')][_0x4af8('0x44')]){_0x2a78a3[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x2a78a3[_0x4af8('0x42')],{'$or':_[_0x4af8('0x31')](_0x26e701,function(_0x6b314d){if(_0x6b314d[_0x4af8('0x46')]!==_0x4af8('0x47')){var _0x33772f={};_0x33772f[_0x6b314d['name']]={'$like':'%'+_0x278873['query'][_0x4af8('0x44')]+'%'};return _0x33772f;}})});}_0x2a78a3=_[_0x4af8('0x45')]({},_0x2a78a3,_0x278873['options']);var _0x3c66dc={'where':_0x2a78a3['where']};return db[_0x4af8('0x32')][_0x4af8('0x22')](_0x3c66dc)['then'](function(_0x46d58d){_0x1f36ba[_0x4af8('0x22')]=_0x46d58d;if(_0x278873[_0x4af8('0x38')][_0x4af8('0x48')]){_0x2a78a3[_0x4af8('0x49')]=[{'all':!![]}];}return db[_0x4af8('0x32')][_0x4af8('0x4a')](_0x2a78a3);})[_0x4af8('0x2c')](function(_0x1e98d2){_0x1f36ba[_0x4af8('0x4b')]=_0x1e98d2;return _0x1f36ba;})['then'](respondWithFilteredResult(_0x56ce5f,_0x2a78a3))['catch'](handleError(_0x56ce5f,null));};exports[_0x4af8('0x4c')]=function(_0x2b1c32,_0x2e6348){var _0x3ea7ef={'raw':![],'where':{'id':_0x2b1c32[_0x4af8('0x4d')]['id']}},_0x5d6a8d={};_0x5d6a8d[_0x4af8('0x36')]=_[_0x4af8('0x37')](db[_0x4af8('0x32')][_0x4af8('0x33')]);_0x5d6a8d[_0x4af8('0x38')]=_[_0x4af8('0x37')](_0x2b1c32['query']);_0x5d6a8d[_0x4af8('0x39')]=_[_0x4af8('0x3a')](_0x5d6a8d[_0x4af8('0x36')],_0x5d6a8d['query']);_0x3ea7ef[_0x4af8('0x3c')]=_[_0x4af8('0x3a')](_0x5d6a8d[_0x4af8('0x36')],qs[_0x4af8('0x3b')](_0x2b1c32[_0x4af8('0x38')]['fields']));_0x3ea7ef[_0x4af8('0x3c')]=_0x3ea7ef[_0x4af8('0x3c')][_0x4af8('0x3d')]?_0x3ea7ef[_0x4af8('0x3c')]:_0x5d6a8d[_0x4af8('0x36')];if(_0x2b1c32[_0x4af8('0x38')]['includeAll']){_0x3ea7ef[_0x4af8('0x49')]=[{'all':!![]}];}_0x3ea7ef=_['merge']({},_0x3ea7ef,_0x2b1c32[_0x4af8('0x4e')]);return db[_0x4af8('0x32')]['find'](_0x3ea7ef)['then'](handleEntityNotFound(_0x2e6348,null))['then'](respondWithResult(_0x2e6348,null))[_0x4af8('0x4f')](handleError(_0x2e6348,null));};exports[_0x4af8('0x50')]=function(_0x470666,_0x2a4aec){return db[_0x4af8('0x32')][_0x4af8('0x50')](_0x470666['body'],{})[_0x4af8('0x2c')](respondWithResult(_0x2a4aec,0xc9))[_0x4af8('0x4f')](handleError(_0x2a4aec,null));};exports[_0x4af8('0x51')]=function(_0x46d1db,_0x18fd47){var _0x35dfe7={'where':{'id':_0x46d1db['params']['id']}},_0x319d7f={};_0x319d7f[_0x4af8('0x36')]=_['keys'](db['UserProfile'][_0x4af8('0x33')]);_0x35dfe7[_0x4af8('0x3c')]=_['intersection'](_0x319d7f[_0x4af8('0x36')],qs[_0x4af8('0x3b')](_0x46d1db['query'][_0x4af8('0x3b')]));_0x35dfe7[_0x4af8('0x3c')]=_0x35dfe7[_0x4af8('0x3c')]['length']?_0x35dfe7[_0x4af8('0x3c')]:_0x319d7f[_0x4af8('0x36')];if(_0x46d1db['query'][_0x4af8('0x48')]){_0x35dfe7['include']=[{'all':!![]}];}_0x35dfe7=_[_0x4af8('0x45')]({},_0x35dfe7,_0x46d1db[_0x4af8('0x4e')]);return db[_0x4af8('0x32')][_0x4af8('0x52')](_0x35dfe7)[_0x4af8('0x2c')](handleEntityNotFound(_0x18fd47,null))[_0x4af8('0x2c')](function(_0x49bb73){if(_0x49bb73){var _0x21b6e6=_0x49bb73[_0x4af8('0x53')]({'plain':!![]});_0x21b6e6=qs['omit'](_0x21b6e6,['id',_0x4af8('0x54'),_0x4af8('0x55'),_0x4af8('0x56')]);_0x46d1db['body']=_['omit'](_0x46d1db[_0x4af8('0x57')],['id',_0x4af8('0x54'),'updatedAt']);return db[_0x4af8('0x58')][_0x4af8('0x59')](function(_0x401e3d){return db[_0x4af8('0x32')][_0x4af8('0x50')](_['merge'](_0x21b6e6,_0x46d1db['body']),{'include':_0x46d1db[_0x4af8('0x38')][_0x4af8('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x401e3d})['then'](function(_0x2077ab){var _0x14d321=_0x2077ab['get']({'plain':!![]});return db[_0x4af8('0x5a')][_0x4af8('0x4a')]({'where':{'userProfileId':_0x46d1db['params']['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0x46df51){if(_0x46df51){return BPromise[_0x4af8('0x5b')](_0x46df51,function(_0x312cdb){return new BPromise(function(_0x541d0d,_0x7c9108){if(_0x312cdb[_0x4af8('0x5c')]===null||_0x312cdb[_0x4af8('0x5c')]===0x1)_0x541d0d(null);return db[_0x4af8('0x5d')]['findAll']({'where':{'sectionId':_0x312cdb['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0xb109d5){var _0xed93f4=_[_0x4af8('0x31')](_0xb109d5,function(_0x131a49){return qs['omit'](_0x131a49,['id','createdAt',_0x4af8('0x55'),'sectionId']);});_0x541d0d(_0xed93f4);})[_0x4af8('0x4f')](function(_0x3f9c86){_0x7c9108(_0x3f9c86);});})[_0x4af8('0x2c')](function(_0x18d13e){var _0x50300e=qs[_0x4af8('0x5e')](_0x312cdb,['id',_0x4af8('0x54'),_0x4af8('0x55')]);_0x50300e[_0x4af8('0x5f')]=_0x14d321['id'];if(_0x18d13e)_0x50300e['Resources']=_0x18d13e;return _0x50300e;})[_0x4af8('0x2c')](function(_0x1e94fd){return db['UserProfileSection']['create'](_0x1e94fd,{'include':[{'model':db['UserProfileResource'],'as':_0x4af8('0x60')}],'raw':!![],'transaction':_0x401e3d});});})[_0x4af8('0x2c')](function(){return _0x14d321;});}});});});}})[_0x4af8('0x2c')](respondWithResult(_0x18fd47,0xc9))[_0x4af8('0x4f')](handleError(_0x18fd47,null));};exports[_0x4af8('0x2b')]=function(_0x2a9b7d,_0x3a8b7b){if(_0x2a9b7d[_0x4af8('0x57')]['id']){delete _0x2a9b7d[_0x4af8('0x57')]['id'];}return db['UserProfile'][_0x4af8('0x52')]({'where':{'id':_0x2a9b7d[_0x4af8('0x4d')]['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x3a8b7b,null))['then'](saveUpdates(_0x2a9b7d['body'],null))[_0x4af8('0x2c')](respondWithResult(_0x3a8b7b,null))['catch'](handleError(_0x3a8b7b,null));};exports[_0x4af8('0x61')]=function(_0x1814ce,_0x517f4d){return db[_0x4af8('0x32')]['find']({'where':{'id':_0x1814ce['params']['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x517f4d,null))[_0x4af8('0x2c')](removeEntity(_0x517f4d,null))['catch'](handleError(_0x517f4d,null));};exports[_0x4af8('0x62')]=function(_0x5d6ac6,_0x333b87){return db[_0x4af8('0x32')][_0x4af8('0x62')]()['then'](respondWithResult(_0x333b87,null))[_0x4af8('0x4f')](handleError(_0x333b87,null));};exports['addSections']=function(_0x5e774d,_0x301eb1){var _0x1dc929=_0x5e774d[_0x4af8('0x57')];return db['UserProfile'][_0x4af8('0x52')]({'where':{'id':_0x5e774d[_0x4af8('0x4d')]['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x301eb1,null))[_0x4af8('0x2c')](function(_0x57b5bb){if(_0x57b5bb){return db['sequelize'][_0x4af8('0x59')](function(_0x37d830){return db['UserProfileSection'][_0x4af8('0x61')]({'where':{'userProfileId':_0x5e774d[_0x4af8('0x4d')]['id'],'sectionId':_['map'](_0x1dc929,function(_0x2e81b7){return _0x2e81b7[_0x4af8('0x63')];})},'transaction':_0x37d830})[_0x4af8('0x2c')](function(){var _0x3eeb4b=_['map'](_0x1dc929,function(_0x213751){_0x213751['userProfileId']=_0x5e774d[_0x4af8('0x4d')]['id'];return _0x213751;});var _0x2d34c3=[];return BPromise[_0x4af8('0x5b')](_0x3eeb4b,function(_0x8d860c){return db[_0x4af8('0x5a')][_0x4af8('0x50')](_0x8d860c,{'include':[{'model':db[_0x4af8('0x5d')],'as':_0x4af8('0x60')}],'raw':!![],'transaction':_0x37d830})[_0x4af8('0x2c')](function(_0x38bb37){_0x2d34c3[_0x4af8('0x64')](_0x38bb37[_0x4af8('0x53')]({'plain':!![]}));});})[_0x4af8('0x2c')](function(){return _0x2d34c3;});});});}})[_0x4af8('0x2c')](function(_0x5daf29){return _0x5daf29;})[_0x4af8('0x2c')](respondWithResult(_0x301eb1,null))[_0x4af8('0x4f')](handleError(_0x301eb1,null));};exports[_0x4af8('0x65')]=function(_0x455e1f,_0x595d8c){var _0x18d397;return db[_0x4af8('0x32')][_0x4af8('0x52')]({'where':{'id':_0x455e1f[_0x4af8('0x4d')]['id']},'attributes':['id',_0x4af8('0x2e')]})[_0x4af8('0x2c')](handleEntityNotFound(_0x595d8c,null))[_0x4af8('0x2c')](function(_0x2b5f89){if(_0x2b5f89){_0x18d397=_0x2b5f89;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x455e1f[_0x4af8('0x4d')]['id'],'sectionId':_0x455e1f[_0x4af8('0x38')][_0x4af8('0x66')]}});}})[_0x4af8('0x2c')](function(){return _0x18d397;})[_0x4af8('0x2c')](respondWithStatusCode(_0x595d8c,null))[_0x4af8('0x4f')](handleError(_0x595d8c,null));};exports['getSections']=function(_0x16af53,_0x5951fe){var _0x164f53=[];var _0x14b5cc=[];return db[_0x4af8('0x5a')][_0x4af8('0x4a')]({'where':{'userProfileId':_0x16af53[_0x4af8('0x4d')]['id']},'raw':!![]})['then'](function(_0x96c3b6){_0x164f53=_[_0x4af8('0x44')](_0x96c3b6,function(_0x2a39b8){return _0x2a39b8[_0x4af8('0x67')]===0x1||_[_0x4af8('0x68')]([0x3eb,0x709],_0x2a39b8[_0x4af8('0x63')]);});if(!_['isEmpty'](_0x164f53)){return _[_0x4af8('0x31')](_0x164f53,function(_0xd967fd){return _0xd967fd[_0x4af8('0x63')];});}else{return;}})['then'](function(_0x4eaaee){if(_0x4eaaee)_0x14b5cc=_0x4eaaee;if(_[_0x4af8('0x68')](_0x14b5cc,0x64)){var _0x3b9614=_[_0x4af8('0x52')](_0x164f53,{'sectionId':0x64});return hasDefaultDashboard(_0x3b9614)[_0x4af8('0x2c')](function(_0xa0a3f3){return _[_0x4af8('0x31')](_0x164f53,function(_0x3ab21a){if(_0x3ab21a['sectionId']===0x64){_0x3ab21a[_0x4af8('0x69')]=_0xa0a3f3;}return _0x3ab21a;});});}else{return;}})['then'](function(_0x3f6d02){if(_0x3f6d02)_0x164f53=_0x3f6d02;if(_[_0x4af8('0x68')](_0x14b5cc,0x3eb)){var _0x1eaac0=_['find'](_0x164f53,{'sectionId':0x3eb});return getCustomDashboards(_0x1eaac0)[_0x4af8('0x2c')](function(_0x4ddc5d){return _[_0x4af8('0x31')](_0x164f53,function(_0x18faaf){if(_0x1eaac0[_0x4af8('0x67')]){if(_0x18faaf[_0x4af8('0x63')]===0x3eb){_0x18faaf[_0x4af8('0x69')]=_0x4ddc5d;}}else{if(_0x18faaf[_0x4af8('0x63')]===0x64){_0x18faaf[_0x4af8('0x69')]=_0x4ddc5d;}}return _0x18faaf;});});}else{return;}})[_0x4af8('0x2c')](function(_0x2d7998){if(_0x2d7998)_0x164f53=_0x2d7998;if(_[_0x4af8('0x68')](_0x14b5cc,0x709)){var _0x19ac55=_[_0x4af8('0x52')](_0x164f53,{'sectionId':0x709});return getPlugins(_0x19ac55)[_0x4af8('0x2c')](function(_0x407549){if(_0x19ac55[_0x4af8('0x67')]){return _[_0x4af8('0x31')](_0x164f53,function(_0x1467ac){if(_0x1467ac[_0x4af8('0x63')]===0x709){_0x1467ac[_0x4af8('0x69')]=_0x407549;}return _0x1467ac;});}else{var _0xff00b7={'sectionId':0x76c,'enabled':0x1,'subsections':_0x407549};var _0x21ef77=_['map'](_0x164f53);_0x21ef77['push'](_0xff00b7);return _0x21ef77;}});}else{return;}})[_0x4af8('0x2c')](function(_0x4f2518){if(_0x4f2518)_0x164f53=_0x4f2518;return _[_0x4af8('0x44')](_0x164f53,[_0x4af8('0x67'),0x1]);})[_0x4af8('0x2c')](respondWithResult(_0x5951fe,null))[_0x4af8('0x4f')](handleError(_0x5951fe,null));};function hasDefaultDashboard(_0x37152e){var _0x5cdf8b=[0x65];return new BPromise(function(_0x2c5410,_0x157a9a){try{if(_0x37152e[_0x4af8('0x5c')]){_0x2c5410(_0x5cdf8b);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x37152e['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0x269bff){_0x269bff?_0x2c5410(_0x5cdf8b):_0x2c5410();});}}catch(_0x1c860e){_0x157a9a(_0x1c860e);}});}function getCustomDashboards(_0xb0598c){var _0x140023=[];return new BPromise(function(_0x27cf09,_0x472eae){try{if(_0xb0598c['autoAssociation']){return db['Dashboard'][_0x4af8('0x4a')]({'raw':!![]})[_0x4af8('0x2c')](function(_0x4ba43b){_0x4ba43b[_0x4af8('0x6a')](function(_0x49776a){_0x140023['push'](_0x49776a['id']+0x1869f);});_0x27cf09(_0x140023);});}else{return db[_0x4af8('0x5d')][_0x4af8('0x4a')]({'where':{'sectionId':_0xb0598c['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0x4ce7d5){_0x4ce7d5[_0x4af8('0x6a')](function(_0xa4c32e){_0x140023[_0x4af8('0x64')](_0xa4c32e['resourceId']+0x1869f);});_0x27cf09(_0x140023);});}}catch(_0x221f46){_0x472eae(_0x221f46);}});}function getPlugins(_0x2b9141){var _0x2d6757=[];return new BPromise(function(_0x57bbc9,_0x22703d){try{if(_0x2b9141[_0x4af8('0x5c')]){return db[_0x4af8('0x6b')][_0x4af8('0x4a')]({'raw':!![]})[_0x4af8('0x2c')](function(_0x46a55c){_0x46a55c[_0x4af8('0x6a')](function(_0xc34403){_0x2d6757[_0x4af8('0x64')](_0xc34403['id']+0x15b38);});_0x57bbc9(_0x2d6757);});}else{return db['UserProfileResource'][_0x4af8('0x4a')]({'where':{'sectionId':_0x2b9141['id']},'raw':!![]})['then'](function(_0x18a103){_0x18a103[_0x4af8('0x6a')](function(_0x2d89aa){_0x2d6757['push'](_0x2d89aa[_0x4af8('0x6c')]+0x15b38);});_0x57bbc9(_0x2d6757);});}}catch(_0x25f59a){_0x22703d(_0x25f59a);}});}exports['addResources']=function(_0x1302c1,_0x2df69e){return db[_0x4af8('0x32')][_0x4af8('0x52')]({'where':{'id':_0x1302c1['params']['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x2df69e,null))[_0x4af8('0x2c')](function(_0xfa64de){if(_0xfa64de){return db[_0x4af8('0x58')][_0x4af8('0x59')](function(_0x882a11){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1302c1[_0x4af8('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x4af8('0x2c')](function(_0xc1bf0){if(_0xc1bf0){return db[_0x4af8('0x5a')][_0x4af8('0x61')]({'where':{'userProfileId':_0x1302c1[_0x4af8('0x4d')]['id'],'id':_[_0x4af8('0x31')](_0xc1bf0,function(_0x57eab3){return _0x57eab3['id'];})},'transaction':_0x882a11});}})[_0x4af8('0x2c')](function(_0x2660cb){var _0x463a0d=_[_0x4af8('0x31')](_0x1302c1[_0x4af8('0x57')],function(_0xddb878){_0xddb878[_0x4af8('0x5f')]=_0x1302c1['params']['id'];return _0xddb878;});return db[_0x4af8('0x5a')][_0x4af8('0x6d')](_0x463a0d,{'raw':!![],'transaction':_0x882a11});})[_0x4af8('0x2c')](function(_0x376e99){var _0x24c4d8=_[_0x4af8('0x44')](_['map'](_0x376e99,function(_0x4e8df8){return _0x4e8df8[_0x4af8('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x24c4d8){return db['UserProfileSection'][_0x4af8('0x4a')]({'where':{'userProfileId':_0x1302c1[_0x4af8('0x4d')]['id'],'sectionId':_[_0x4af8('0x31')](_0x24c4d8,function(_0x4b3b97){return _0x4b3b97[_0x4af8('0x63')];})},'attributes':['id',_0x4af8('0x63')],'raw':!![]})[_0x4af8('0x2c')](function(_0x145f30){var _0x1ed1a5=_['map'](_0x1302c1[_0x4af8('0x57')],function(_0x541b01){_0x541b01['userProfileId']=_0x1302c1['params']['id'];return _0x541b01;});return db[_0x4af8('0x5d')]['bulkCreate'](_0x1ed1a5,{'raw':!![],'transaction':_0x882a11});});}})[_0x4af8('0x4f')](handleError(_0x2df69e,null));});}})[_0x4af8('0x2c')](function(_0xde17b8){var _0x50f42a=_[_0x4af8('0x31')](_0xde17b8,function(_0x35eb5a){return _0x35eb5a[_0x4af8('0x53')]({'plain':!![]});});})[_0x4af8('0x2c')](respondWithResult(_0x2df69e,null))['catch'](handleError(_0x2df69e,null));};exports['removeResources']=function(_0x2f556b,_0x8455f3,_0x173fe7){return db['UserProfile'][_0x4af8('0x52')]({'where':{'id':_0x2f556b[_0x4af8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8455f3,null))[_0x4af8('0x2c')](function(_0x242319){if(_0x242319){return _0x242319[_0x4af8('0x6e')](_0x2f556b[_0x4af8('0x38')][_0x4af8('0x66')]);}})[_0x4af8('0x2c')](respondWithStatusCode(_0x8455f3,null))[_0x4af8('0x4f')](handleError(_0x8455f3,null));};exports[_0x4af8('0x6f')]=function(_0x5c0275,_0x20623e){var _0x122737={'raw':![],'where':{}};var _0x2a1a6b={};var _0x442fbe={'count':0x0,'rows':[]};var _0x2569ae=_0x5c0275[_0x4af8('0x38')]['section'];if(typeof _0x2569ae===_0x4af8('0x70')){throw new db[(_0x4af8('0x71'))][(_0x4af8('0x72'))](_0x4af8('0x73'));}var _0x2476cf=_0x5c0275[_0x4af8('0x38')][_0x4af8('0x74')]||![];var _0x3d3083=getQueryModels(_0x2569ae,_0x2476cf);if(typeof _0x3d3083[_0x4af8('0x75')]===_0x4af8('0x70')){throw new db['Sequelize'][(_0x4af8('0x72'))](_0x4af8('0x76')+_0x2569ae+'\x27');}var _0x57b939=[];if(!_[_0x4af8('0x77')](_0x3d3083[_0x4af8('0x78')])){_0x57b939=_0x3d3083[_0x4af8('0x78')];}else{_0x57b939=[{'name':_0x2569ae}];}return db[_0x4af8('0x32')][_0x4af8('0x79')]({'where':{'id':_0x5c0275[_0x4af8('0x4d')]['id']}})[_0x4af8('0x2c')](handleEntityNotFound(_0x20623e,null))[_0x4af8('0x2c')](function(_0x2d48cd){if(_0x2d48cd){var _0x4284b5=[];for(var _0x531814=0x0;_0x531814<_0x57b939[_0x4af8('0x3d')];_0x531814++){_0x4284b5['push'](db[_0x4af8('0x5a')]['findOne']({'where':{'userProfileId':_0x2d48cd['id'],'name':_0x57b939[_0x531814][_0x4af8('0x2e')]},'raw':!![]}));}return BPromise[_0x4af8('0x7a')](_0x4284b5);}})[_0x4af8('0x2c')](function(_0x287b36){var _0x23c221=_[_0x4af8('0x44')](_0x287b36,function(_0xee27e5){return _0xee27e5?_0xee27e5:undefined;});var _0x1a4f43=_['filter'](_0x57b939,[_0x4af8('0x7b'),!![]]);var _0x5b18d1=_['isEmpty'](_0x23c221)&&_[_0x4af8('0x77')](_0x1a4f43)?null:_[_0x4af8('0x7c')](_0x1a4f43,_0x23c221);if(_0x5b18d1){var _0x4fa2f8=[];for(var _0x177a3c=0x0;_0x177a3c<_0x5b18d1[_0x4af8('0x3d')];_0x177a3c++){var _0x170b65=_[_0x4af8('0x52')](_0x57b939,function(_0x1ebebf){return _0x5b18d1[_0x177a3c]?_0x1ebebf[_0x4af8('0x2e')]===_0x5b18d1[_0x177a3c][_0x4af8('0x2e')]:null;});if(_0x170b65){if(_0x5b18d1[_0x177a3c][_0x4af8('0x7b')]){_0x4fa2f8[_0x4af8('0x64')](getAllResources(_0x3d3083['childModel'],_0x5b18d1[_0x177a3c]));}else{if(!_0x5b18d1[_0x177a3c][_0x4af8('0x5c')]){_0x4fa2f8[_0x4af8('0x64')](getAllowedResources(_0x170b65,_0x5b18d1[_0x177a3c],_0x3d3083['childModel']));}else{if(_0x170b65['model']){_0x4fa2f8['push'](getAllFilteredResources(_0x170b65,_0x5b18d1[_0x177a3c]));}}}}}return BPromise['all'](_0x4fa2f8);}else{return null;}})[_0x4af8('0x2c')](function(_0x5a7aae){var _0x531349=_0x5a7aae;var _0x32fcd6=null;if(_0x531349){_0x32fcd6=_0x531349[_0x4af8('0x3d')]===0x1?_0x531349[0x0]:null;}if(_0x32fcd6||_0x531349){var _0x4596e7=db[_0x3d3083[_0x4af8('0x75')]]['rawAttributes'];_0x2a1a6b['model']=_[_0x4af8('0x37')](_0x4596e7);_0x2a1a6b['query']=_['keys'](_0x5c0275[_0x4af8('0x38')]);_0x2a1a6b[_0x4af8('0x39')]=_['intersection'](_0x2a1a6b[_0x4af8('0x36')],_0x2a1a6b[_0x4af8('0x38')]);_0x122737['attributes']=_[_0x4af8('0x3a')](_0x2a1a6b[_0x4af8('0x36')],qs[_0x4af8('0x3b')](_0x5c0275[_0x4af8('0x38')][_0x4af8('0x3b')]));_0x122737[_0x4af8('0x3c')]=_0x122737['attributes'][_0x4af8('0x3d')]?_0x122737[_0x4af8('0x3c')]:_0x2a1a6b[_0x4af8('0x36')];if(!_0x5c0275[_0x4af8('0x38')]['hasOwnProperty'](_0x4af8('0x3f'))){_0x122737[_0x4af8('0x24')]=qs[_0x4af8('0x24')](_0x5c0275['query'][_0x4af8('0x24')]);_0x122737[_0x4af8('0x23')]=qs[_0x4af8('0x23')](_0x5c0275[_0x4af8('0x38')][_0x4af8('0x23')]);}_0x122737[_0x4af8('0x40')]=qs[_0x4af8('0x41')](_0x5c0275[_0x4af8('0x38')][_0x4af8('0x41')]);_0x122737[_0x4af8('0x42')]=qs[_0x4af8('0x39')](_[_0x4af8('0x43')](_0x5c0275[_0x4af8('0x38')],_0x2a1a6b[_0x4af8('0x39')]));if(_0x5c0275[_0x4af8('0x38')]['filter']){_0x122737[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x122737[_0x4af8('0x42')],{'$or':_[_0x4af8('0x31')](_0x4596e7,function(_0x307c18){if(_0x307c18[_0x4af8('0x46')][_0x4af8('0x35')]!==_0x4af8('0x47')){var _0x19e9d0={};_0x19e9d0[_0x307c18[_0x4af8('0x7d')]]={'$like':'%'+_0x5c0275[_0x4af8('0x38')][_0x4af8('0x44')]+'%'};return _0x19e9d0;}})});}var _0x4560b3=[];if(_0x32fcd6){var _0x44f547=_['find'](_0x57b939,[_0x4af8('0x2e'),_0x32fcd6[_0x4af8('0x2e')]]);if(_0x44f547[_0x4af8('0x7d')]){var _0x27e8b4={};if(_0x3d3083['childModel']===_0x4af8('0x7e')){_0x27e8b4[_0x44f547[_0x4af8('0x7f')]]=_[_0x4af8('0x31')](_0x32fcd6[_0x4af8('0x80')],'id');}else{_0x27e8b4[_0x44f547[_0x4af8('0x7f')]]=_0x32fcd6[_0x4af8('0x80')];}_0x4560b3[_0x4af8('0x64')](_0x27e8b4);}else{_0x122737[_0x4af8('0x42')]['id']=_0x32fcd6[_0x4af8('0x80')];}}else{for(var _0xc0c9aa=0x0;_0xc0c9aa<_0x531349[_0x4af8('0x3d')];_0xc0c9aa++){var _0x44f547=_[_0x4af8('0x52')](_0x57b939,[_0x4af8('0x2e'),_0x531349[_0xc0c9aa][_0x4af8('0x2e')]]);if(_0x44f547[_0x4af8('0x7d')]){var _0x27e8b4={};_0x27e8b4[_0x44f547[_0x4af8('0x7f')]]=_0x531349[_0xc0c9aa][_0x4af8('0x80')];_0x4560b3[_0x4af8('0x64')](_0x27e8b4);}else{if(!_0x122737[_0x4af8('0x42')]['id'])_0x122737['where']['id']=[];_0x531349[_0xc0c9aa]['associatedResources'][_0x4af8('0x6a')](function(_0x15a3bd){_0x122737['where']['id'][_0x4af8('0x64')](_0x15a3bd);});}}}if(!_['isEmpty'](_0x4560b3)){_0x122737[_0x4af8('0x42')]=_[_0x4af8('0x45')](_0x122737[_0x4af8('0x42')],{'$and':{'$or':_0x4560b3}});}_0x122737=_[_0x4af8('0x45')]({},_0x122737,_0x5c0275[_0x4af8('0x4e')]);if(_0x32fcd6&&!_0x32fcd6[_0x4af8('0x5c')]&&_0x3d3083[_0x4af8('0x75')]===_0x4af8('0x7e')){if(_0x5c0275[_0x4af8('0x38')]['includeAll']){_0x122737[_0x4af8('0x49')]=[{'all':!![]}];}return db[_0x3d3083[_0x4af8('0x75')]][_0x4af8('0x4a')](_0x122737)[_0x4af8('0x2c')](function(_0x5f22cd){var _0x33d675=[];_0x5f22cd[_0x4af8('0x6a')](function(_0x5d8814){var _0x55da4d;switch(_0x5d8814[_0x4af8('0x81')]){case _0x4af8('0x82'):_0x55da4d=_[_0x4af8('0x52')](_0x32fcd6[_0x4af8('0x80')],function(_0x8f6f2f){return _0x8f6f2f['id']===_0x5d8814['reportId']&&_0x8f6f2f[_0x4af8('0x46')]===_0x4af8('0x83');});break;case _0x4af8('0x84'):_0x55da4d=_[_0x4af8('0x52')](_0x32fcd6[_0x4af8('0x80')],function(_0x3e3df0){return _0x3e3df0['id']===_0x5d8814[_0x4af8('0x85')]&&_0x3e3df0['type']==='CustomReports';});break;}if(_0x55da4d)_0x33d675['push'](_0x5d8814);});_0x442fbe[_0x4af8('0x22')]=_0x33d675[_0x4af8('0x3d')];_0x442fbe[_0x4af8('0x4b')]=_0x33d675;return _0x442fbe;});}else{return db[_0x3d3083[_0x4af8('0x75')]][_0x4af8('0x22')]({'where':_0x122737[_0x4af8('0x42')]})['then'](function(_0x5723c7){_0x442fbe['count']=_0x5723c7;if(_0x5c0275[_0x4af8('0x38')][_0x4af8('0x48')]){if(_0x3d3083[_0x4af8('0x75')]===_0x4af8('0x86')){_0x122737[_0x4af8('0x49')]=[{'model':db[_0x4af8('0x87')],'as':_0x4af8('0x88'),'attributes':['id',_0x4af8('0x2e'),_0x4af8('0x89')],'required':_0x5c0275[_0x4af8('0x38')][_0x4af8('0x8a')]?!![]:![]},{'model':db[_0x4af8('0x87')],'as':_0x4af8('0x8b'),'attributes':['id',_0x4af8('0x2e'),'color'],'through':_0x5c0275[_0x4af8('0x38')][_0x4af8('0x8a')]?{'attributes':[],'where':{'TagId':_0x5c0275[_0x4af8('0x38')]['tag']||undefined}}:{},'required':_0x5c0275[_0x4af8('0x38')]['tag']?!![]:![]}];}else{_0x122737[_0x4af8('0x49')]=[{'all':!![]}];}}return db[_0x3d3083[_0x4af8('0x75')]][_0x4af8('0x4a')](_0x122737);})[_0x4af8('0x2c')](function(_0x3bca31){_0x442fbe[_0x4af8('0x4b')]=_0x3bca31;return _0x442fbe;});}}else{return _0x442fbe;}})[_0x4af8('0x2c')](respondWithFilteredResult(_0x20623e,_0x122737))['catch'](handleError(_0x20623e,null));};function getAllResources(_0x483525,_0x2dcae7){return new BPromise(function(_0x511b88,_0x34a61f){if(_0x2dcae7){var _0x4f69a6=_0x2dcae7[_0x4af8('0x44')]?{[_0x2dcae7['filter'][_0x4af8('0x7d')]]:_0x2dcae7[_0x4af8('0x44')]['value']}:undefined;return db[_0x483525]['findAll']({'where':_0x4f69a6,'raw':!![]})['then'](function(_0x2ae2a2){_0x2dcae7[_0x4af8('0x80')]=_[_0x4af8('0x31')](_0x2ae2a2,'id');_0x511b88(_0x2dcae7);})[_0x4af8('0x4f')](function(_0x3434ee){_0x34a61f(_0x3434ee);});}else{_0x511b88(null);}});}function getAllFilteredResources(_0x357d36,_0x2d16bb){return new BPromise(function(_0x51dc9e,_0x1205b6){var _0x1810dc=_0x357d36[_0x4af8('0x44')]?{[_0x357d36[_0x4af8('0x44')]['field']]:_0x357d36['filter']['value']}:undefined;return db[_0x357d36['model']][_0x4af8('0x4a')]({'where':_0x1810dc,'raw':!![]})[_0x4af8('0x2c')](function(_0x17ada9){_0x2d16bb['associatedResources']=_[_0x4af8('0x31')](_0x17ada9,function(_0x5368a2){return _0x5368a2[_0x4af8('0x2e')];});_0x51dc9e(_0x2d16bb);})[_0x4af8('0x4f')](function(_0x2ebac0){_0x1205b6(_0x2ebac0);});});}function getAllowedResources(_0x4bea97,_0x17a876,_0x5059ec){return new BPromise(function(_0x513a7d,_0x517d44){if(_0x17a876){return db['UserProfileResource'][_0x4af8('0x4a')]({'where':{'sectionId':_0x17a876['id']},'raw':!![]})[_0x4af8('0x2c')](function(_0x93de6e){if(_0x4bea97[_0x4af8('0x7d')]&&_0x4bea97[_0x4af8('0x7d')]!=='id'){_0x17a876[_0x4af8('0x80')]=_[_0x4af8('0x31')](_0x93de6e,function(_0x3d0509){return _0x3d0509[_0x4bea97[_0x4af8('0x7d')]];});}else{if(_0x5059ec===_0x4af8('0x7e')){_0x17a876[_0x4af8('0x80')]=_[_0x4af8('0x31')](_0x93de6e,function(_0x938196){return{'id':_0x938196['resourceId'],'type':_0x938196[_0x4af8('0x46')]};});}else{_0x17a876[_0x4af8('0x80')]=_[_0x4af8('0x31')](_0x93de6e,function(_0x288af8){return _0x288af8[_0x4af8('0x6c')];});}}_0x513a7d(_0x17a876);})[_0x4af8('0x4f')](function(_0x31b0b3){_0x517d44(_0x31b0b3);});}else{_0x513a7d(null);}});}function getQueryModels(_0x222be4,_0x59b5ab){var _0x1787e4=_0x222be4[_0x4af8('0x8c')]();var _0xc2dccd={'childModel':undefined,'parentSections':[]};switch(_0x1787e4){case _0x4af8('0x8d'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x8e');break;case'odbc':_0xc2dccd['childModel']=_0x4af8('0x8f');break;case _0x4af8('0x90'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x91');_0xc2dccd[_0x4af8('0x78')]=[{'name':'SquareProjects','field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0x92')}];break;case _0x4af8('0x93'):_0xc2dccd['childModel']='JscriptyProject';break;case'contacts':_0xc2dccd[_0x4af8('0x75')]='CmContact';_0xc2dccd[_0x4af8('0x78')]=[{'name':_0x4af8('0x94'),'field':'id','foreignKey':_0x4af8('0x95')}];break;case _0x4af8('0x96'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x97');break;case _0x4af8('0x98'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x99');break;case _0x4af8('0x9a'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x9b');break;case _0x4af8('0x9c'):_0xc2dccd['childModel']=_0x4af8('0x9d');break;case'chatwebsites':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x9e');break;case'faxqueues':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x9f');break;case _0x4af8('0xa0'):_0xc2dccd['childModel']=_0x4af8('0xa1');break;case'inboundroutes':case _0x4af8('0xa2'):case _0x4af8('0xa3'):_0xc2dccd['childModel']=_0x4af8('0xa4');break;case'contexts':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xa5');break;case'voicemails':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xa6');break;case _0x4af8('0xa7'):_0xc2dccd['childModel']=_0x4af8('0xa8');_0xc2dccd[_0x4af8('0x78')]=[{'name':'Agents','field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0xa9'),'model':_0x4af8('0xaa'),'filter':{'field':'role','value':['agent']}},{'name':_0x4af8('0xab'),'field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0xa9'),'model':'User','filter':{'field':'role','value':[_0x4af8('0xac')]}},{'name':_0x4af8('0xad'),'field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0xae'),'model':_0x4af8('0xaf'),'filter':{'field':_0x4af8('0x46'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x4af8('0x2e'),'foreignKey':_0x4af8('0xae'),'model':_0x4af8('0xaf'),'filter':{'field':_0x4af8('0x46'),'value':[_0x4af8('0xb0')]}}];break;case _0x4af8('0xb1'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xb2');break;case _0x4af8('0xb3'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xb4');break;case _0x4af8('0xb5'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xb6');break;case _0x4af8('0xb7'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xb8');break;case _0x4af8('0xb9'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xba');break;case _0x4af8('0xbb'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xbc');break;case'mailsubstatuses':_0xc2dccd[_0x4af8('0x75')]='MailSubstatus';break;case'openchannelqueues':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xbd');break;case'openchannelaccounts':_0xc2dccd['childModel']='OpenchannelAccount';break;case'smsqueues':_0xc2dccd[_0x4af8('0x75')]='SmsQueue';break;case _0x4af8('0xbe'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xbf');break;case _0x4af8('0xc0'):_0xc2dccd['childModel']=_0x4af8('0xc1');break;case _0x4af8('0xc2'):_0xc2dccd[_0x4af8('0x75')]='WhatsappAccount';break;case'teams':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xc3');break;case'voicequeues':case'queuecampaigns':_0xc2dccd['childModel']=_0x4af8('0xaf');if(_0x59b5ab){_0xc2dccd['parentSections']=[{'name':_0x4af8('0xad')},{'name':_0x4af8('0xc4')}];}break;case _0x4af8('0xc5'):case _0x4af8('0xc6'):case'telephones':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xaa');if(_0x59b5ab){_0xc2dccd[_0x4af8('0x78')]=[{'name':_0x4af8('0xc7'),'filter':{'field':_0x4af8('0xc8'),'value':[_0x4af8('0xc9'),_0x4af8('0xca')]},'ignore':!![]},{'name':_0x4af8('0xcb')},{'name':_0x4af8('0xab')}];}break;case _0x4af8('0xcc'):_0xc2dccd['childModel']=_0x4af8('0xcd');break;case _0x4af8('0xce'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xcf');break;case _0x4af8('0xd0'):_0xc2dccd[_0x4af8('0x75')]='FreshdeskAccount';break;case _0x4af8('0xd1'):_0xc2dccd[_0x4af8('0x75')]='SugarcrmAccount';break;case _0x4af8('0xd2'):_0xc2dccd[_0x4af8('0x75')]='DeskAccount';break;case _0x4af8('0xd3'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xd4');break;case _0x4af8('0xd5'):_0xc2dccd['childModel']=_0x4af8('0xaa');break;case _0x4af8('0xd6'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xd7');break;case _0x4af8('0xd8'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xd9');break;case _0x4af8('0xda'):_0xc2dccd[_0x4af8('0x75')]='Dashboard';break;case _0x4af8('0xdb'):_0xc2dccd['childModel']='Interval';break;case _0x4af8('0xdc'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xdd');break;case'scheduler':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xde');break;case _0x4af8('0xdf'):_0xc2dccd['childModel']='Sound';break;case'tags':_0xc2dccd['childModel']=_0x4af8('0x87');break;case'templates':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xe0');break;case _0x4af8('0xe1'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xe2');break;case'trunks':_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xe3');break;case _0x4af8('0xe4'):_0xc2dccd['childModel']=_0x4af8('0xe5');break;case _0x4af8('0xe6'):_0xc2dccd['childModel']=_0x4af8('0x6b');break;case _0x4af8('0xe7'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0x7e');_0xc2dccd[_0x4af8('0x78')]=[{'name':_0x4af8('0xe8'),'field':'id','foreignKey':_0x4af8('0x85')}];break;case _0x4af8('0xe9'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xea');break;case _0x4af8('0xc2'):_0xc2dccd[_0x4af8('0x75')]=_0x4af8('0xeb');break;default:return _0xc2dccd;}return _0xc2dccd;} \ No newline at end of file +var _0x98e8=['ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','Pause','sounds','Sound','tags','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','UserProfile','includeAll','include','findAll','catch','show','params','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','each','autoAssociation','sectionId','userProfileId','UserProfileSection','UserProfileResource','Resources','find','describe','sequelize','transaction','push','removeSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','hasOwnProperty','order','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','CmContact','Tags','color','tag','Tag','rows','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','voicemails','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts'];(function(_0x33e738,_0x4746e7){var _0x2e5d3a=function(_0x114da4){while(--_0x114da4){_0x33e738['push'](_0x33e738['shift']());}};_0x2e5d3a(++_0x4746e7);}(_0x98e8,0x109));var _0x898e=function(_0x3c1f25,_0x295d40){_0x3c1f25=_0x3c1f25-0x0;var _0x403fc2=_0x98e8[_0x3c1f25];return _0x403fc2;};'use strict';var pdf=require(_0x898e('0x0'));var emlformat=require(_0x898e('0x1'));var rimraf=require(_0x898e('0x2'));var zipdir=require(_0x898e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x898e('0x4'));var moment=require(_0x898e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x898e('0x6'));var path=require('path');var sox=require(_0x898e('0x7'));var csv=require(_0x898e('0x8'));var ejs=require(_0x898e('0x9'));var fs=require('fs');var _=require(_0x898e('0xa'));var squel=require(_0x898e('0xb'));var crypto=require(_0x898e('0xc'));var jsforce=require(_0x898e('0xd'));var deskjs=require(_0x898e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x898e('0xf'));var Papa=require(_0x898e('0x10'));var Redis=require(_0x898e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x898e('0x12'));var as=require(_0x898e('0x13'));var hardwareService=require(_0x898e('0x14'));var logger=require(_0x898e('0x15'))(_0x898e('0x16'));var utils=require(_0x898e('0x17'));var config=require('../../config/environment');var db=require(_0x898e('0x18'))['db'];config['redis']=_['defaults'](config[_0x898e('0x19')],{'host':_0x898e('0x1a'),'port':0x18eb});var socket=require(_0x898e('0x1b'))(new Redis(config[_0x898e('0x19')]));require(_0x898e('0x1c'))['register'](socket);function respondWithStatusCode(_0x2dff71,_0x494838){_0x494838=_0x494838||0xcc;return function(_0x21761d){if(_0x21761d){return _0x2dff71[_0x898e('0x1d')](_0x494838);}return _0x2dff71[_0x898e('0x1e')](_0x494838)[_0x898e('0x1f')]();};}function respondWithResult(_0x3b7afb,_0x44ac32){_0x44ac32=_0x44ac32||0xc8;return function(_0x1952d0){if(_0x1952d0){return _0x3b7afb[_0x898e('0x1e')](_0x44ac32)[_0x898e('0x20')](_0x1952d0);}};}function respondWithFilteredResult(_0x101344,_0x364bf7){return function(_0x5c8470){if(_0x5c8470){var _0xcd9dd6=_0x5c8470[_0x898e('0x21')],_0x6c3f71=_0x364bf7[_0x898e('0x22')],_0x28cdbb=_0x364bf7['offset']+_0x364bf7[_0x898e('0x23')],_0x139d8a;if(_0x28cdbb>=_0xcd9dd6){_0x28cdbb=_0xcd9dd6;_0x139d8a=0xc8;}else{_0x139d8a=0xce;}_0x101344[_0x898e('0x1e')](_0x139d8a);return _0x101344[_0x898e('0x24')](_0x898e('0x25'),_0x6c3f71+'-'+_0x28cdbb+'/'+_0xcd9dd6)[_0x898e('0x20')](_0x5c8470);}return null;};}function patchUpdates(_0x28a602){return function(_0x1937e9){try{jsonpatch[_0x898e('0x26')](_0x1937e9,_0x28a602,!![]);}catch(_0x135695){return BPromise['reject'](_0x135695);}return _0x1937e9[_0x898e('0x27')]();};}function saveUpdates(_0x1d766d,_0x518407){return function(_0x5d1618){if(_0x5d1618){return _0x5d1618[_0x898e('0x28')](_0x1d766d)[_0x898e('0x29')](function(_0x40dfc2){return _0x40dfc2;});}return null;};}function removeEntity(_0x4db6db,_0x374e4d){return function(_0x43980a){if(_0x43980a){return _0x43980a[_0x898e('0x2a')]()['then'](function(){_0x4db6db['status'](0xcc)[_0x898e('0x1f')]();});}};}function handleEntityNotFound(_0x265702,_0x3f2ee1){return function(_0x2a4ab2){if(!_0x2a4ab2){_0x265702['sendStatus'](0x194);}return _0x2a4ab2;};}function handleError(_0x15eb19,_0x3eba7f){_0x3eba7f=_0x3eba7f||0x1f4;return function(_0xb99b1c){logger[_0x898e('0x2b')](_0xb99b1c['stack']);if(_0xb99b1c[_0x898e('0x2c')]){delete _0xb99b1c[_0x898e('0x2c')];}_0x15eb19[_0x898e('0x1e')](_0x3eba7f)[_0x898e('0x2d')](_0xb99b1c);};}exports[_0x898e('0x2e')]=function(_0x5b87ef,_0x44a93c){var _0x4af1f7={},_0xabb3e1={},_0x1129ee={'count':0x0,'rows':[]};var _0x1300be=_[_0x898e('0x2f')](db['UserProfile'][_0x898e('0x30')],function(_0x5592bb){return{'name':_0x5592bb['fieldName'],'type':_0x5592bb['type']['key']};});_0xabb3e1[_0x898e('0x31')]=_[_0x898e('0x2f')](_0x1300be,'name');_0xabb3e1[_0x898e('0x32')]=_[_0x898e('0x33')](_0x5b87ef['query']);_0xabb3e1[_0x898e('0x34')]=_['intersection'](_0xabb3e1[_0x898e('0x31')],_0xabb3e1[_0x898e('0x32')]);_0x4af1f7[_0x898e('0x35')]=_[_0x898e('0x36')](_0xabb3e1[_0x898e('0x31')],qs[_0x898e('0x37')](_0x5b87ef[_0x898e('0x32')][_0x898e('0x37')]));_0x4af1f7[_0x898e('0x35')]=_0x4af1f7[_0x898e('0x35')][_0x898e('0x38')]?_0x4af1f7[_0x898e('0x35')]:_0xabb3e1[_0x898e('0x31')];if(!_0x5b87ef[_0x898e('0x32')]['hasOwnProperty'](_0x898e('0x39'))){_0x4af1f7[_0x898e('0x23')]=qs[_0x898e('0x23')](_0x5b87ef[_0x898e('0x32')][_0x898e('0x23')]);_0x4af1f7[_0x898e('0x22')]=qs[_0x898e('0x22')](_0x5b87ef[_0x898e('0x32')][_0x898e('0x22')]);}_0x4af1f7['order']=qs[_0x898e('0x3a')](_0x5b87ef[_0x898e('0x32')][_0x898e('0x3a')]);_0x4af1f7[_0x898e('0x3b')]=qs['filters'](_[_0x898e('0x3c')](_0x5b87ef[_0x898e('0x32')],_0xabb3e1[_0x898e('0x34')]),_0x1300be);if(_0x5b87ef[_0x898e('0x32')][_0x898e('0x3d')]){_0x4af1f7[_0x898e('0x3b')]=_['merge'](_0x4af1f7[_0x898e('0x3b')],{'$or':_[_0x898e('0x2f')](_0x1300be,function(_0x45418e){if(_0x45418e[_0x898e('0x3e')]!==_0x898e('0x3f')){var _0x5f7d8c={};_0x5f7d8c[_0x45418e[_0x898e('0x2c')]]={'$like':'%'+_0x5b87ef[_0x898e('0x32')]['filter']+'%'};return _0x5f7d8c;}})});}_0x4af1f7=_[_0x898e('0x40')]({},_0x4af1f7,_0x5b87ef[_0x898e('0x41')]);var _0x35e169={'where':_0x4af1f7['where']};return db[_0x898e('0x42')][_0x898e('0x21')](_0x35e169)['then'](function(_0x3ac703){_0x1129ee['count']=_0x3ac703;if(_0x5b87ef[_0x898e('0x32')][_0x898e('0x43')]){_0x4af1f7[_0x898e('0x44')]=[{'all':!![]}];}return db[_0x898e('0x42')][_0x898e('0x45')](_0x4af1f7);})['then'](function(_0x2ca3de){_0x1129ee['rows']=_0x2ca3de;return _0x1129ee;})['then'](respondWithFilteredResult(_0x44a93c,_0x4af1f7))[_0x898e('0x46')](handleError(_0x44a93c,null));};exports[_0x898e('0x47')]=function(_0x283653,_0x46a53b){var _0x2601f2={'raw':![],'where':{'id':_0x283653[_0x898e('0x48')]['id']}},_0x5e26a2={};_0x5e26a2['model']=_['keys'](db[_0x898e('0x42')]['rawAttributes']);_0x5e26a2[_0x898e('0x32')]=_[_0x898e('0x33')](_0x283653[_0x898e('0x32')]);_0x5e26a2[_0x898e('0x34')]=_['intersection'](_0x5e26a2['model'],_0x5e26a2[_0x898e('0x32')]);_0x2601f2[_0x898e('0x35')]=_[_0x898e('0x36')](_0x5e26a2[_0x898e('0x31')],qs[_0x898e('0x37')](_0x283653[_0x898e('0x32')]['fields']));_0x2601f2[_0x898e('0x35')]=_0x2601f2['attributes'][_0x898e('0x38')]?_0x2601f2[_0x898e('0x35')]:_0x5e26a2[_0x898e('0x31')];if(_0x283653['query']['includeAll']){_0x2601f2['include']=[{'all':!![]}];}_0x2601f2=_[_0x898e('0x40')]({},_0x2601f2,_0x283653['options']);return db['UserProfile']['find'](_0x2601f2)[_0x898e('0x29')](handleEntityNotFound(_0x46a53b,null))['then'](respondWithResult(_0x46a53b,null))[_0x898e('0x46')](handleError(_0x46a53b,null));};exports[_0x898e('0x49')]=function(_0x596ec0,_0x547b41){return db[_0x898e('0x42')][_0x898e('0x49')](_0x596ec0[_0x898e('0x4a')],{})[_0x898e('0x29')](respondWithResult(_0x547b41,0xc9))[_0x898e('0x46')](handleError(_0x547b41,null));};exports[_0x898e('0x4b')]=function(_0x549163,_0x39e5b7){var _0x3bd80e={'where':{'id':_0x549163[_0x898e('0x48')]['id']}},_0x23cdbd={};_0x23cdbd[_0x898e('0x31')]=_[_0x898e('0x33')](db['UserProfile'][_0x898e('0x30')]);_0x3bd80e[_0x898e('0x35')]=_[_0x898e('0x36')](_0x23cdbd[_0x898e('0x31')],qs['fields'](_0x549163[_0x898e('0x32')][_0x898e('0x37')]));_0x3bd80e['attributes']=_0x3bd80e[_0x898e('0x35')][_0x898e('0x38')]?_0x3bd80e[_0x898e('0x35')]:_0x23cdbd[_0x898e('0x31')];if(_0x549163[_0x898e('0x32')][_0x898e('0x43')]){_0x3bd80e[_0x898e('0x44')]=[{'all':!![]}];}_0x3bd80e=_[_0x898e('0x40')]({},_0x3bd80e,_0x549163['options']);return db['UserProfile']['find'](_0x3bd80e)[_0x898e('0x29')](handleEntityNotFound(_0x39e5b7,null))[_0x898e('0x29')](function(_0x315207){if(_0x315207){var _0x17e10a=_0x315207[_0x898e('0x4c')]({'plain':!![]});_0x17e10a=qs[_0x898e('0x4d')](_0x17e10a,['id',_0x898e('0x4e'),_0x898e('0x4f'),_0x898e('0x50')]);_0x549163[_0x898e('0x4a')]=_[_0x898e('0x4d')](_0x549163[_0x898e('0x4a')],['id',_0x898e('0x4e'),_0x898e('0x4f')]);return db['sequelize']['transaction'](function(_0x24d0bb){return db[_0x898e('0x42')][_0x898e('0x49')](_[_0x898e('0x40')](_0x17e10a,_0x549163[_0x898e('0x4a')]),{'include':_0x549163[_0x898e('0x32')][_0x898e('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x24d0bb})['then'](function(_0x4679c1){var _0x3e76fe=_0x4679c1[_0x898e('0x4c')]({'plain':!![]});return db['UserProfileSection'][_0x898e('0x45')]({'where':{'userProfileId':_0x549163[_0x898e('0x48')]['id']},'raw':!![]})['then'](function(_0x23d14e){if(_0x23d14e){return BPromise[_0x898e('0x51')](_0x23d14e,function(_0x19f0a5){return new BPromise(function(_0x12ab4e,_0x6e3b1){if(_0x19f0a5[_0x898e('0x52')]===null||_0x19f0a5[_0x898e('0x52')]===0x1)_0x12ab4e(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x19f0a5['id']},'raw':!![]})['then'](function(_0x16f32d){var _0x1c182b=_[_0x898e('0x2f')](_0x16f32d,function(_0x3a4cc8){return qs['omit'](_0x3a4cc8,['id',_0x898e('0x4e'),_0x898e('0x4f'),_0x898e('0x53')]);});_0x12ab4e(_0x1c182b);})[_0x898e('0x46')](function(_0x1aada9){_0x6e3b1(_0x1aada9);});})[_0x898e('0x29')](function(_0x35cff1){var _0x18340e=qs['omit'](_0x19f0a5,['id','createdAt',_0x898e('0x4f')]);_0x18340e[_0x898e('0x54')]=_0x3e76fe['id'];if(_0x35cff1)_0x18340e['Resources']=_0x35cff1;return _0x18340e;})[_0x898e('0x29')](function(_0x41d8d7){return db[_0x898e('0x55')][_0x898e('0x49')](_0x41d8d7,{'include':[{'model':db[_0x898e('0x56')],'as':_0x898e('0x57')}],'raw':!![],'transaction':_0x24d0bb});});})[_0x898e('0x29')](function(){return _0x3e76fe;});}});});});}})['then'](respondWithResult(_0x39e5b7,0xc9))[_0x898e('0x46')](handleError(_0x39e5b7,null));};exports[_0x898e('0x28')]=function(_0xc9a20c,_0x185787){if(_0xc9a20c['body']['id']){delete _0xc9a20c[_0x898e('0x4a')]['id'];}return db[_0x898e('0x42')][_0x898e('0x58')]({'where':{'id':_0xc9a20c[_0x898e('0x48')]['id']}})[_0x898e('0x29')](handleEntityNotFound(_0x185787,null))['then'](saveUpdates(_0xc9a20c[_0x898e('0x4a')],null))['then'](respondWithResult(_0x185787,null))[_0x898e('0x46')](handleError(_0x185787,null));};exports[_0x898e('0x2a')]=function(_0x28155f,_0x3b1ece){return db[_0x898e('0x42')][_0x898e('0x58')]({'where':{'id':_0x28155f['params']['id']}})[_0x898e('0x29')](handleEntityNotFound(_0x3b1ece,null))['then'](removeEntity(_0x3b1ece,null))[_0x898e('0x46')](handleError(_0x3b1ece,null));};exports[_0x898e('0x59')]=function(_0x2ba1c6,_0x5d44e3){return db[_0x898e('0x42')][_0x898e('0x59')]()[_0x898e('0x29')](respondWithResult(_0x5d44e3,null))['catch'](handleError(_0x5d44e3,null));};exports['addSections']=function(_0xf9bf52,_0x2197eb){var _0x2d5323=_0xf9bf52[_0x898e('0x4a')];return db[_0x898e('0x42')][_0x898e('0x58')]({'where':{'id':_0xf9bf52[_0x898e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2197eb,null))[_0x898e('0x29')](function(_0xeb813){if(_0xeb813){return db[_0x898e('0x5a')][_0x898e('0x5b')](function(_0x24358a){return db[_0x898e('0x55')]['destroy']({'where':{'userProfileId':_0xf9bf52['params']['id'],'sectionId':_[_0x898e('0x2f')](_0x2d5323,function(_0x3f512c){return _0x3f512c[_0x898e('0x53')];})},'transaction':_0x24358a})['then'](function(){var _0x57d246=_[_0x898e('0x2f')](_0x2d5323,function(_0x3a4da8){_0x3a4da8[_0x898e('0x54')]=_0xf9bf52[_0x898e('0x48')]['id'];return _0x3a4da8;});var _0x2ba5c2=[];return BPromise[_0x898e('0x51')](_0x57d246,function(_0x394cc8){return db[_0x898e('0x55')]['create'](_0x394cc8,{'include':[{'model':db[_0x898e('0x56')],'as':_0x898e('0x57')}],'raw':!![],'transaction':_0x24358a})[_0x898e('0x29')](function(_0xf9b63d){_0x2ba5c2[_0x898e('0x5c')](_0xf9b63d['get']({'plain':!![]}));});})[_0x898e('0x29')](function(){return _0x2ba5c2;});});});}})[_0x898e('0x29')](function(_0x39c625){return _0x39c625;})['then'](respondWithResult(_0x2197eb,null))[_0x898e('0x46')](handleError(_0x2197eb,null));};exports[_0x898e('0x5d')]=function(_0x207458,_0x290a1f){var _0x455876;return db[_0x898e('0x42')][_0x898e('0x58')]({'where':{'id':_0x207458[_0x898e('0x48')]['id']},'attributes':['id',_0x898e('0x2c')]})[_0x898e('0x29')](handleEntityNotFound(_0x290a1f,null))['then'](function(_0x2fb1cb){if(_0x2fb1cb){_0x455876=_0x2fb1cb;return db[_0x898e('0x55')]['destroy']({'where':{'userProfileId':_0x207458[_0x898e('0x48')]['id'],'sectionId':_0x207458[_0x898e('0x32')]['ids']}});}})[_0x898e('0x29')](function(){return _0x455876;})[_0x898e('0x29')](respondWithStatusCode(_0x290a1f,null))[_0x898e('0x46')](handleError(_0x290a1f,null));};exports['getSections']=function(_0x504a75,_0x7c0c74){var _0x465d65=[];var _0x4a44a7=[];return db['UserProfileSection'][_0x898e('0x45')]({'where':{'userProfileId':_0x504a75[_0x898e('0x48')]['id']},'raw':!![]})['then'](function(_0x25173c){_0x465d65=_[_0x898e('0x3d')](_0x25173c,function(_0x29cf3a){return _0x29cf3a[_0x898e('0x5e')]===0x1||_[_0x898e('0x5f')]([0x3eb,0x709],_0x29cf3a['sectionId']);});if(!_[_0x898e('0x60')](_0x465d65)){return _[_0x898e('0x2f')](_0x465d65,function(_0x548bd1){return _0x548bd1[_0x898e('0x53')];});}else{return;}})[_0x898e('0x29')](function(_0x2d69ae){if(_0x2d69ae)_0x4a44a7=_0x2d69ae;if(_[_0x898e('0x5f')](_0x4a44a7,0x64)){var _0x610c23=_[_0x898e('0x58')](_0x465d65,{'sectionId':0x64});return hasDefaultDashboard(_0x610c23)['then'](function(_0x505878){return _[_0x898e('0x2f')](_0x465d65,function(_0x2b1b09){if(_0x2b1b09[_0x898e('0x53')]===0x64){_0x2b1b09[_0x898e('0x61')]=_0x505878;}return _0x2b1b09;});});}else{return;}})['then'](function(_0x57b545){if(_0x57b545)_0x465d65=_0x57b545;if(_[_0x898e('0x5f')](_0x4a44a7,0x3eb)){var _0x2f305c=_[_0x898e('0x58')](_0x465d65,{'sectionId':0x3eb});return getCustomDashboards(_0x2f305c)['then'](function(_0x2aeeb1){return _[_0x898e('0x2f')](_0x465d65,function(_0x254ef3){if(_0x2f305c['enabled']){if(_0x254ef3[_0x898e('0x53')]===0x3eb){_0x254ef3[_0x898e('0x61')]=_0x2aeeb1;}}else{if(_0x254ef3[_0x898e('0x53')]===0x64){_0x254ef3[_0x898e('0x61')]=_0x2aeeb1;}}return _0x254ef3;});});}else{return;}})[_0x898e('0x29')](function(_0x23fff4){if(_0x23fff4)_0x465d65=_0x23fff4;if(_[_0x898e('0x5f')](_0x4a44a7,0x709)){var _0x27b05f=_[_0x898e('0x58')](_0x465d65,{'sectionId':0x709});return getPlugins(_0x27b05f)['then'](function(_0x40ec20){if(_0x27b05f[_0x898e('0x5e')]){return _[_0x898e('0x2f')](_0x465d65,function(_0x239a6e){if(_0x239a6e[_0x898e('0x53')]===0x709){_0x239a6e[_0x898e('0x61')]=_0x40ec20;}return _0x239a6e;});}else{var _0x432646={'sectionId':0x76c,'enabled':0x1,'subsections':_0x40ec20};var _0x44678a=_[_0x898e('0x2f')](_0x465d65);_0x44678a[_0x898e('0x5c')](_0x432646);return _0x44678a;}});}else{return;}})[_0x898e('0x29')](function(_0x5c47d6){if(_0x5c47d6)_0x465d65=_0x5c47d6;return _['filter'](_0x465d65,['enabled',0x1]);})[_0x898e('0x29')](respondWithResult(_0x7c0c74,null))[_0x898e('0x46')](handleError(_0x7c0c74,null));};function hasDefaultDashboard(_0x591d84){var _0x1ee618=[0x65];return new BPromise(function(_0x2d763e,_0x257702){try{if(_0x591d84[_0x898e('0x52')]){_0x2d763e(_0x1ee618);}else{return db[_0x898e('0x56')][_0x898e('0x62')]({'where':{'sectionId':_0x591d84['id']},'raw':!![]})[_0x898e('0x29')](function(_0x50bbeb){_0x50bbeb?_0x2d763e(_0x1ee618):_0x2d763e();});}}catch(_0xafbdb1){_0x257702(_0xafbdb1);}});}function getCustomDashboards(_0x24027e){var _0x133a56=[];return new BPromise(function(_0x169ec3,_0x50cab9){try{if(_0x24027e[_0x898e('0x52')]){return db[_0x898e('0x63')][_0x898e('0x45')]({'raw':!![]})[_0x898e('0x29')](function(_0x32f259){_0x32f259['forEach'](function(_0x3773e8){_0x133a56[_0x898e('0x5c')](_0x3773e8['id']+0x1869f);});_0x169ec3(_0x133a56);});}else{return db['UserProfileResource'][_0x898e('0x45')]({'where':{'sectionId':_0x24027e['id']},'raw':!![]})[_0x898e('0x29')](function(_0x1a7ae1){_0x1a7ae1[_0x898e('0x64')](function(_0x18e3ea){_0x133a56[_0x898e('0x5c')](_0x18e3ea['resourceId']+0x1869f);});_0x169ec3(_0x133a56);});}}catch(_0x3b75c7){_0x50cab9(_0x3b75c7);}});}function getPlugins(_0x27a785){var _0xc66409=[];return new BPromise(function(_0x22fe59,_0xe53506){try{if(_0x27a785[_0x898e('0x52')]){return db[_0x898e('0x65')][_0x898e('0x45')]({'raw':!![]})[_0x898e('0x29')](function(_0x32a0ec){_0x32a0ec[_0x898e('0x64')](function(_0x5a8645){_0xc66409[_0x898e('0x5c')](_0x5a8645['id']+0x15b38);});_0x22fe59(_0xc66409);});}else{return db[_0x898e('0x56')][_0x898e('0x45')]({'where':{'sectionId':_0x27a785['id']},'raw':!![]})[_0x898e('0x29')](function(_0x2e34de){_0x2e34de[_0x898e('0x64')](function(_0x1c4ed1){_0xc66409[_0x898e('0x5c')](_0x1c4ed1[_0x898e('0x66')]+0x15b38);});_0x22fe59(_0xc66409);});}}catch(_0x39418c){_0xe53506(_0x39418c);}});}exports[_0x898e('0x67')]=function(_0x3c4aa1,_0x4321b5){return db[_0x898e('0x42')][_0x898e('0x58')]({'where':{'id':_0x3c4aa1[_0x898e('0x48')]['id']}})[_0x898e('0x29')](handleEntityNotFound(_0x4321b5,null))['then'](function(_0xf2a2fa){if(_0xf2a2fa){return db[_0x898e('0x5a')][_0x898e('0x5b')](function(_0x5d26b0){return db[_0x898e('0x55')][_0x898e('0x45')]({'where':{'userProfileId':_0x3c4aa1['params']['id']},'attributes':['id'],'raw':!![]})[_0x898e('0x29')](function(_0x407f4c){if(_0x407f4c){return db[_0x898e('0x55')][_0x898e('0x2a')]({'where':{'userProfileId':_0x3c4aa1[_0x898e('0x48')]['id'],'id':_['map'](_0x407f4c,function(_0xd640d9){return _0xd640d9['id'];})},'transaction':_0x5d26b0});}})[_0x898e('0x29')](function(_0x56415f){var _0x3de71b=_['map'](_0x3c4aa1[_0x898e('0x4a')],function(_0xbe6110){_0xbe6110[_0x898e('0x54')]=_0x3c4aa1[_0x898e('0x48')]['id'];return _0xbe6110;});return db[_0x898e('0x55')][_0x898e('0x68')](_0x3de71b,{'raw':!![],'transaction':_0x5d26b0});})[_0x898e('0x29')](function(_0x1a46d3){var _0x2fe7e5=_['filter'](_['map'](_0x1a46d3,function(_0x23c72c){return _0x23c72c['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2fe7e5){return db[_0x898e('0x55')]['findAll']({'where':{'userProfileId':_0x3c4aa1[_0x898e('0x48')]['id'],'sectionId':_['map'](_0x2fe7e5,function(_0x226b47){return _0x226b47[_0x898e('0x53')];})},'attributes':['id',_0x898e('0x53')],'raw':!![]})[_0x898e('0x29')](function(_0x47cbc6){var _0x163bef=_[_0x898e('0x2f')](_0x3c4aa1[_0x898e('0x4a')],function(_0x4170b3){_0x4170b3['userProfileId']=_0x3c4aa1[_0x898e('0x48')]['id'];return _0x4170b3;});return db['UserProfileResource']['bulkCreate'](_0x163bef,{'raw':!![],'transaction':_0x5d26b0});});}})[_0x898e('0x46')](handleError(_0x4321b5,null));});}})[_0x898e('0x29')](function(_0x2a2ca0){var _0x1d8baa=_[_0x898e('0x2f')](_0x2a2ca0,function(_0x199c09){return _0x199c09[_0x898e('0x4c')]({'plain':!![]});});})[_0x898e('0x29')](respondWithResult(_0x4321b5,null))[_0x898e('0x46')](handleError(_0x4321b5,null));};exports[_0x898e('0x69')]=function(_0xd8d265,_0x219637,_0x4de4b8){return db[_0x898e('0x42')]['find']({'where':{'id':_0xd8d265[_0x898e('0x48')]['id']}})['then'](handleEntityNotFound(_0x219637,null))[_0x898e('0x29')](function(_0x298d12){if(_0x298d12){return _0x298d12['removeResources'](_0xd8d265[_0x898e('0x32')][_0x898e('0x6a')]);}})[_0x898e('0x29')](respondWithStatusCode(_0x219637,null))['catch'](handleError(_0x219637,null));};exports[_0x898e('0x6b')]=function(_0x1d7817,_0x47ab64){var _0x556120={'raw':![],'where':{}};var _0x2c847a={};var _0x35c624={'count':0x0,'rows':[]};var _0x507323=_0x1d7817[_0x898e('0x32')][_0x898e('0x6c')];if(typeof _0x507323===_0x898e('0x6d')){throw new db[(_0x898e('0x6e'))][(_0x898e('0x6f'))](_0x898e('0x70'));}var _0x19c9de=_0x1d7817[_0x898e('0x32')][_0x898e('0x71')]||![];var _0xebaec1=getQueryModels(_0x507323,_0x19c9de);if(typeof _0xebaec1[_0x898e('0x72')]===_0x898e('0x6d')){throw new db[(_0x898e('0x6e'))][(_0x898e('0x6f'))](_0x898e('0x73')+_0x507323+'\x27');}var _0x478f87=[];if(!_[_0x898e('0x60')](_0xebaec1[_0x898e('0x74')])){_0x478f87=_0xebaec1[_0x898e('0x74')];}else{_0x478f87=[{'name':_0x507323}];}return db[_0x898e('0x42')][_0x898e('0x62')]({'where':{'id':_0x1d7817[_0x898e('0x48')]['id']}})[_0x898e('0x29')](handleEntityNotFound(_0x47ab64,null))[_0x898e('0x29')](function(_0x1638be){if(_0x1638be){var _0x138819=[];for(var _0x6c96c9=0x0;_0x6c96c9<_0x478f87[_0x898e('0x38')];_0x6c96c9++){_0x138819['push'](db['UserProfileSection'][_0x898e('0x62')]({'where':{'userProfileId':_0x1638be['id'],'name':_0x478f87[_0x6c96c9][_0x898e('0x2c')]},'raw':!![]}));}return BPromise[_0x898e('0x75')](_0x138819);}})[_0x898e('0x29')](function(_0x564ea2){var _0x1aff35=_[_0x898e('0x3d')](_0x564ea2,function(_0x2635aa){return _0x2635aa?_0x2635aa:undefined;});var _0x8e80e6=_[_0x898e('0x3d')](_0x478f87,[_0x898e('0x76'),!![]]);var _0x2fe4e9=_[_0x898e('0x60')](_0x1aff35)&&_['isEmpty'](_0x8e80e6)?null:_[_0x898e('0x77')](_0x8e80e6,_0x1aff35);if(_0x2fe4e9){var _0x4fd66d=[];for(var _0x147614=0x0;_0x147614<_0x2fe4e9[_0x898e('0x38')];_0x147614++){var _0x5bcc4=_[_0x898e('0x58')](_0x478f87,function(_0x54ee37){return _0x2fe4e9[_0x147614]?_0x54ee37['name']===_0x2fe4e9[_0x147614][_0x898e('0x2c')]:null;});if(_0x5bcc4){if(_0x2fe4e9[_0x147614]['ignore']){_0x4fd66d[_0x898e('0x5c')](getAllResources(_0xebaec1[_0x898e('0x72')],_0x2fe4e9[_0x147614]));}else{if(!_0x2fe4e9[_0x147614][_0x898e('0x52')]){_0x4fd66d[_0x898e('0x5c')](getAllowedResources(_0x5bcc4,_0x2fe4e9[_0x147614],_0xebaec1[_0x898e('0x72')]));}else{if(_0x5bcc4['model']){_0x4fd66d[_0x898e('0x5c')](getAllFilteredResources(_0x5bcc4,_0x2fe4e9[_0x147614]));}}}}}return BPromise[_0x898e('0x75')](_0x4fd66d);}else{return null;}})[_0x898e('0x29')](function(_0x432efd){var _0xbe144b=_0x432efd;var _0x501676=null;if(_0xbe144b){_0x501676=_0xbe144b[_0x898e('0x38')]===0x1?_0xbe144b[0x0]:null;}if(_0x501676||_0xbe144b){var _0xa39fd=db[_0xebaec1[_0x898e('0x72')]]['rawAttributes'];_0x2c847a[_0x898e('0x31')]=_[_0x898e('0x33')](_0xa39fd);_0x2c847a[_0x898e('0x32')]=_[_0x898e('0x33')](_0x1d7817[_0x898e('0x32')]);_0x2c847a[_0x898e('0x34')]=_[_0x898e('0x36')](_0x2c847a['model'],_0x2c847a[_0x898e('0x32')]);_0x556120['attributes']=_[_0x898e('0x36')](_0x2c847a[_0x898e('0x31')],qs['fields'](_0x1d7817[_0x898e('0x32')][_0x898e('0x37')]));_0x556120[_0x898e('0x35')]=_0x556120['attributes'][_0x898e('0x38')]?_0x556120[_0x898e('0x35')]:_0x2c847a[_0x898e('0x31')];if(!_0x1d7817['query'][_0x898e('0x78')](_0x898e('0x39'))){_0x556120[_0x898e('0x23')]=qs[_0x898e('0x23')](_0x1d7817[_0x898e('0x32')][_0x898e('0x23')]);_0x556120[_0x898e('0x22')]=qs[_0x898e('0x22')](_0x1d7817['query']['offset']);}_0x556120[_0x898e('0x79')]=qs['sort'](_0x1d7817['query'][_0x898e('0x3a')]);_0x556120[_0x898e('0x3b')]=qs[_0x898e('0x34')](_['pick'](_0x1d7817[_0x898e('0x32')],_0x2c847a[_0x898e('0x34')]));if(_0x1d7817[_0x898e('0x32')][_0x898e('0x3d')]){_0x556120['where']=_[_0x898e('0x40')](_0x556120[_0x898e('0x3b')],{'$or':_[_0x898e('0x2f')](_0xa39fd,function(_0x3e256f){if(_0x3e256f[_0x898e('0x3e')]['key']!==_0x898e('0x3f')){var _0x276831={};_0x276831[_0x3e256f['field']]={'$like':'%'+_0x1d7817[_0x898e('0x32')][_0x898e('0x3d')]+'%'};return _0x276831;}})});}var _0x2b57ee=[];if(_0x501676){var _0x114456=_[_0x898e('0x58')](_0x478f87,[_0x898e('0x2c'),_0x501676[_0x898e('0x2c')]]);if(_0x114456[_0x898e('0x7a')]){var _0x3c1539={};if(_0xebaec1[_0x898e('0x72')]===_0x898e('0x7b')){_0x3c1539[_0x114456[_0x898e('0x7c')]]=_['map'](_0x501676[_0x898e('0x7d')],'id');}else{_0x3c1539[_0x114456[_0x898e('0x7c')]]=_0x501676[_0x898e('0x7d')];}_0x2b57ee['push'](_0x3c1539);}else{_0x556120['where']['id']=_0x501676[_0x898e('0x7d')];}}else{for(var _0x2761f6=0x0;_0x2761f6<_0xbe144b[_0x898e('0x38')];_0x2761f6++){var _0x114456=_[_0x898e('0x58')](_0x478f87,['name',_0xbe144b[_0x2761f6][_0x898e('0x2c')]]);if(_0x114456[_0x898e('0x7a')]){var _0x3c1539={};_0x3c1539[_0x114456[_0x898e('0x7c')]]=_0xbe144b[_0x2761f6]['associatedResources'];_0x2b57ee[_0x898e('0x5c')](_0x3c1539);}else{if(!_0x556120[_0x898e('0x3b')]['id'])_0x556120[_0x898e('0x3b')]['id']=[];_0xbe144b[_0x2761f6]['associatedResources']['forEach'](function(_0x4993b3){_0x556120[_0x898e('0x3b')]['id'][_0x898e('0x5c')](_0x4993b3);});}}}if(!_['isEmpty'](_0x2b57ee)){_0x556120['where']=_[_0x898e('0x40')](_0x556120[_0x898e('0x3b')],{'$and':{'$or':_0x2b57ee}});}_0x556120=_[_0x898e('0x40')]({},_0x556120,_0x1d7817['options']);if(_0x501676&&!_0x501676[_0x898e('0x52')]&&_0xebaec1[_0x898e('0x72')]===_0x898e('0x7b')){if(_0x1d7817[_0x898e('0x32')][_0x898e('0x43')]){_0x556120['include']=[{'all':!![]}];}return db[_0xebaec1[_0x898e('0x72')]][_0x898e('0x45')](_0x556120)['then'](function(_0x279a95){var _0x3b09a4=[];_0x279a95['forEach'](function(_0x610c71){var _0x224906;switch(_0x610c71[_0x898e('0x7e')]){case _0x898e('0x7f'):_0x224906=_['find'](_0x501676[_0x898e('0x7d')],function(_0x315876){return _0x315876['id']===_0x610c71[_0x898e('0x80')]&&_0x315876[_0x898e('0x3e')]===_0x898e('0x81');});break;case'custom':_0x224906=_[_0x898e('0x58')](_0x501676[_0x898e('0x7d')],function(_0x32f44b){return _0x32f44b['id']===_0x610c71[_0x898e('0x80')]&&_0x32f44b[_0x898e('0x3e')]===_0x898e('0x82');});break;}if(_0x224906)_0x3b09a4[_0x898e('0x5c')](_0x610c71);});_0x35c624[_0x898e('0x21')]=_0x3b09a4[_0x898e('0x38')];_0x35c624['rows']=_0x3b09a4;return _0x35c624;});}else{return db[_0xebaec1[_0x898e('0x72')]]['count']({'where':_0x556120[_0x898e('0x3b')]})[_0x898e('0x29')](function(_0x585cc3){_0x35c624['count']=_0x585cc3;if(_0x1d7817['query'][_0x898e('0x43')]){if(_0xebaec1[_0x898e('0x72')]===_0x898e('0x83')){_0x556120['include']=[{'model':db['Tag'],'as':_0x898e('0x84'),'attributes':['id',_0x898e('0x2c'),_0x898e('0x85')],'required':_0x1d7817[_0x898e('0x32')][_0x898e('0x86')]?!![]:![]},{'model':db[_0x898e('0x87')],'as':'ThroughTags','attributes':['id',_0x898e('0x2c'),'color'],'through':_0x1d7817[_0x898e('0x32')][_0x898e('0x86')]?{'attributes':[],'where':{'TagId':_0x1d7817[_0x898e('0x32')]['tag']||undefined}}:{},'required':_0x1d7817[_0x898e('0x32')]['tag']?!![]:![]}];}else{_0x556120[_0x898e('0x44')]=[{'all':!![]}];}}return db[_0xebaec1[_0x898e('0x72')]]['findAll'](_0x556120);})[_0x898e('0x29')](function(_0x436422){_0x35c624[_0x898e('0x88')]=_0x436422;return _0x35c624;});}}else{return _0x35c624;}})['then'](respondWithFilteredResult(_0x47ab64,_0x556120))[_0x898e('0x46')](handleError(_0x47ab64,null));};function getAllResources(_0x4cf7a4,_0x17ce92){return new BPromise(function(_0x46819,_0x24ea5f){if(_0x17ce92){var _0x30fd73=_0x17ce92['filter']?{[_0x17ce92[_0x898e('0x3d')][_0x898e('0x7a')]]:_0x17ce92[_0x898e('0x3d')][_0x898e('0x89')]}:undefined;return db[_0x4cf7a4][_0x898e('0x45')]({'where':_0x30fd73,'raw':!![]})[_0x898e('0x29')](function(_0x485117){_0x17ce92[_0x898e('0x7d')]=_[_0x898e('0x2f')](_0x485117,'id');_0x46819(_0x17ce92);})[_0x898e('0x46')](function(_0x568e27){_0x24ea5f(_0x568e27);});}else{_0x46819(null);}});}function getAllFilteredResources(_0x2d43ae,_0x52440e){return new BPromise(function(_0x5bb7f5,_0x9400e5){var _0x12421d=_0x2d43ae[_0x898e('0x3d')]?{[_0x2d43ae['filter']['field']]:_0x2d43ae[_0x898e('0x3d')]['value']}:undefined;return db[_0x2d43ae[_0x898e('0x31')]]['findAll']({'where':_0x12421d,'raw':!![]})['then'](function(_0xb17657){_0x52440e[_0x898e('0x7d')]=_[_0x898e('0x2f')](_0xb17657,function(_0x4c898c){return _0x4c898c[_0x898e('0x2c')];});_0x5bb7f5(_0x52440e);})[_0x898e('0x46')](function(_0x5862a1){_0x9400e5(_0x5862a1);});});}function getAllowedResources(_0x1c96a8,_0x403dd6,_0x49c316){return new BPromise(function(_0x3d7a36,_0x4dcdbc){if(_0x403dd6){return db[_0x898e('0x56')][_0x898e('0x45')]({'where':{'sectionId':_0x403dd6['id']},'raw':!![]})['then'](function(_0x1f6557){if(_0x1c96a8[_0x898e('0x7a')]&&_0x1c96a8[_0x898e('0x7a')]!=='id'){_0x403dd6[_0x898e('0x7d')]=_[_0x898e('0x2f')](_0x1f6557,function(_0x48a95a){return _0x48a95a[_0x1c96a8[_0x898e('0x7a')]];});}else{if(_0x49c316==='AnalyticExtractedReport'){_0x403dd6[_0x898e('0x7d')]=_['map'](_0x1f6557,function(_0xcb1ce4){return{'id':_0xcb1ce4[_0x898e('0x66')],'type':_0xcb1ce4[_0x898e('0x3e')]};});}else{_0x403dd6[_0x898e('0x7d')]=_[_0x898e('0x2f')](_0x1f6557,function(_0x2eadb1){return _0x2eadb1[_0x898e('0x66')];});}}_0x3d7a36(_0x403dd6);})[_0x898e('0x46')](function(_0x551e7c){_0x4dcdbc(_0x551e7c);});}else{_0x3d7a36(null);}});}function getQueryModels(_0x522757,_0x253a5f){var _0x7dcb40=_0x522757[_0x898e('0x8a')]();var _0x49745d={'childModel':undefined,'parentSections':[]};switch(_0x7dcb40){case _0x898e('0x8b'):_0x49745d[_0x898e('0x72')]=_0x898e('0x8c');break;case _0x898e('0x8d'):_0x49745d[_0x898e('0x72')]=_0x898e('0x8e');break;case _0x898e('0x8f'):_0x49745d[_0x898e('0x72')]=_0x898e('0x90');_0x49745d[_0x898e('0x74')]=[{'name':_0x898e('0x91'),'field':_0x898e('0x2c'),'foreignKey':_0x898e('0x92')}];break;case _0x898e('0x93'):_0x49745d['childModel']=_0x898e('0x94');break;case _0x898e('0x95'):_0x49745d[_0x898e('0x72')]=_0x898e('0x83');_0x49745d[_0x898e('0x74')]=[{'name':_0x898e('0x96'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x49745d[_0x898e('0x72')]='CmList';break;case _0x898e('0x97'):_0x49745d[_0x898e('0x72')]=_0x898e('0x98');break;case _0x898e('0x99'):_0x49745d['childModel']=_0x898e('0x9a');break;case'chatqueues':_0x49745d[_0x898e('0x72')]=_0x898e('0x9b');break;case _0x898e('0x9c'):_0x49745d[_0x898e('0x72')]='ChatWebsite';break;case _0x898e('0x9d'):_0x49745d['childModel']='FaxQueue';break;case _0x898e('0x9e'):_0x49745d[_0x898e('0x72')]=_0x898e('0x9f');break;case _0x898e('0xa0'):case'internalroutes':case'outboundroutes':_0x49745d[_0x898e('0x72')]=_0x898e('0xa1');break;case'contexts':_0x49745d[_0x898e('0x72')]='VoiceContext';break;case _0x898e('0xa2'):_0x49745d[_0x898e('0x72')]='VoiceMail';break;case'voicerecordings':_0x49745d[_0x898e('0x72')]=_0x898e('0xa3');_0x49745d[_0x898e('0x74')]=[{'name':_0x898e('0xa4'),'field':_0x898e('0x2c'),'foreignKey':_0x898e('0xa5'),'model':_0x898e('0xa6'),'filter':{'field':_0x898e('0xa7'),'value':[_0x898e('0xa8')]}},{'name':_0x898e('0xa9'),'field':_0x898e('0x2c'),'foreignKey':_0x898e('0xa5'),'model':_0x898e('0xa6'),'filter':{'field':'role','value':[_0x898e('0xaa')]}},{'name':_0x898e('0xab'),'field':'name','foreignKey':'queue','model':_0x898e('0xac'),'filter':{'field':'type','value':['inbound']}},{'name':_0x898e('0xad'),'field':_0x898e('0x2c'),'foreignKey':_0x898e('0xae'),'model':_0x898e('0xac'),'filter':{'field':_0x898e('0x3e'),'value':[_0x898e('0xaf')]}}];break;case'musiconholds':_0x49745d[_0x898e('0x72')]=_0x898e('0xb0');break;case _0x898e('0xb1'):_0x49745d['childModel']=_0x898e('0xb2');break;case'voiceprefixes':_0x49745d[_0x898e('0x72')]=_0x898e('0xb3');break;case _0x898e('0xb4'):_0x49745d[_0x898e('0x72')]=_0x898e('0xb5');break;case _0x898e('0xb6'):_0x49745d[_0x898e('0x72')]=_0x898e('0xb7');break;case'mailaccounts':_0x49745d[_0x898e('0x72')]=_0x898e('0xb8');break;case _0x898e('0xb9'):_0x49745d['childModel']='MailSubstatus';break;case'openchannelqueues':_0x49745d[_0x898e('0x72')]=_0x898e('0xba');break;case'openchannelaccounts':_0x49745d[_0x898e('0x72')]=_0x898e('0xbb');break;case _0x898e('0xbc'):_0x49745d[_0x898e('0x72')]='SmsQueue';break;case _0x898e('0xbd'):_0x49745d[_0x898e('0x72')]=_0x898e('0xbe');break;case'whatsappqueues':_0x49745d[_0x898e('0x72')]=_0x898e('0xbf');break;case _0x898e('0xc0'):_0x49745d['childModel']='WhatsappAccount';break;case _0x898e('0xc1'):_0x49745d['childModel']=_0x898e('0xc2');break;case _0x898e('0xc3'):case _0x898e('0xc4'):_0x49745d[_0x898e('0x72')]=_0x898e('0xac');if(_0x253a5f){_0x49745d[_0x898e('0x74')]=[{'name':_0x898e('0xab')},{'name':'QueueCampaigns'}];}break;case _0x898e('0xc5'):case _0x898e('0xc6'):case _0x898e('0xc7'):_0x49745d['childModel']=_0x898e('0xa6');if(_0x253a5f){_0x49745d[_0x898e('0x74')]=[{'name':'Users','filter':{'field':_0x898e('0xa7'),'value':[_0x898e('0xc8'),_0x898e('0xc9')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x898e('0xca'):_0x49745d['childModel']=_0x898e('0xcb');break;case _0x898e('0xcc'):_0x49745d[_0x898e('0x72')]=_0x898e('0xcd');break;case _0x898e('0xce'):_0x49745d[_0x898e('0x72')]=_0x898e('0xcf');break;case'sugarcrmaccounts':_0x49745d[_0x898e('0x72')]=_0x898e('0xd0');break;case'deskaccounts':_0x49745d[_0x898e('0x72')]=_0x898e('0xd1');break;case _0x898e('0xd2'):_0x49745d[_0x898e('0x72')]=_0x898e('0xd3');break;case _0x898e('0xd4'):_0x49745d['childModel']='User';break;case _0x898e('0xd5'):_0x49745d['childModel']=_0x898e('0xd6');break;case _0x898e('0xd7'):_0x49745d[_0x898e('0x72')]=_0x898e('0xd8');break;case _0x898e('0xd9'):_0x49745d['childModel']='Dashboard';break;case'intervals':_0x49745d[_0x898e('0x72')]=_0x898e('0xda');break;case _0x898e('0xdb'):_0x49745d[_0x898e('0x72')]=_0x898e('0xdc');break;case'scheduler':_0x49745d['childModel']='Schedule';break;case _0x898e('0xdd'):_0x49745d[_0x898e('0x72')]=_0x898e('0xde');break;case _0x898e('0xdf'):_0x49745d[_0x898e('0x72')]='Tag';break;case'templates':_0x49745d[_0x898e('0x72')]='Template';break;case _0x898e('0xe0'):_0x49745d[_0x898e('0x72')]=_0x898e('0xe1');break;case _0x898e('0xe2'):_0x49745d[_0x898e('0x72')]=_0x898e('0xe3');break;case _0x898e('0xe4'):_0x49745d[_0x898e('0x72')]=_0x898e('0xe5');break;case _0x898e('0xe6'):_0x49745d['childModel']=_0x898e('0x65');break;case _0x898e('0xe7'):_0x49745d['childModel']='AnalyticExtractedReport';_0x49745d[_0x898e('0x74')]=[{'name':_0x898e('0xe8'),'field':'id','foreignKey':_0x898e('0x80')}];break;case _0x898e('0xe9'):_0x49745d['childModel']='AnalyticMetric';break;case _0x898e('0xc0'):_0x49745d[_0x898e('0x72')]='WhatsappAccount';break;default:return _0x49745d;}return _0x49745d;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 45ab4fb..cac1d0e 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 _0x3ad6=['hasOwnProperty','hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x26ddc0,_0x573b35){var _0x68651b=function(_0x173ef1){while(--_0x173ef1){_0x26ddc0['push'](_0x26ddc0['shift']());}};_0x68651b(++_0x573b35);}(_0x3ad6,0xb6));var _0x63ad=function(_0x311a70,_0xc12dbb){_0x311a70=_0x311a70-0x0;var _0x2a4abb=_0x3ad6[_0x311a70];return _0x2a4abb;};'use strict';var EventEmitter=require(_0x63ad('0x0'));var UserProfile=require(_0x63ad('0x1'))['db'][_0x63ad('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x63ad('0x3')](0x0);var events={'afterCreate':_0x63ad('0x4'),'afterUpdate':_0x63ad('0x5'),'afterDestroy':_0x63ad('0x6')};function emitEvent(_0x29a439){return function(_0x2f5d54,_0x4331a1,_0x57d1bb){UserProfileEvents[_0x63ad('0x7')](_0x29a439+':'+_0x2f5d54['id'],_0x2f5d54);UserProfileEvents['emit'](_0x29a439,_0x2f5d54);_0x57d1bb(null);};}for(var e in events){if(events[_0x63ad('0x8')](e)){var event=events[e];UserProfile[_0x63ad('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xc13c=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x4cdfbf,_0x3c58fa){var _0x22e845=function(_0x3a48fc){while(--_0x3a48fc){_0x4cdfbf['push'](_0x4cdfbf['shift']());}};_0x22e845(++_0x3c58fa);}(_0xc13c,0x71));var _0xcc13=function(_0x1a8770,_0x344224){_0x1a8770=_0x1a8770-0x0;var _0x1528ef=_0xc13c[_0x1a8770];return _0x1528ef;};'use strict';var EventEmitter=require(_0xcc13('0x0'));var UserProfile=require(_0xcc13('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc13('0x2'),'afterUpdate':_0xcc13('0x3'),'afterDestroy':_0xcc13('0x4')};function emitEvent(_0x174360){return function(_0x225427,_0x3641e1,_0x487e66){UserProfileEvents[_0xcc13('0x5')](_0x174360+':'+_0x225427['id'],_0x225427);UserProfileEvents[_0xcc13('0x5')](_0x174360,_0x225427);_0x487e66(null);};}for(var e in events){if(events[_0xcc13('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xcc13('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 8e40fa3..8df7c8d 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 _0xead5=['rimraf','./userProfile.attributes','define','UserProfile','user_profiles','lodash','../../config/logger','api','moment'];(function(_0x44ffa0,_0x35f9fe){var _0x19cf56=function(_0x3b5542){while(--_0x3b5542){_0x44ffa0['push'](_0x44ffa0['shift']());}};_0x19cf56(++_0x35f9fe);}(_0xead5,0xef));var _0x5ead=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0xead5[_0x56fb33];return _0x435ee4;};'use strict';var _=require(_0x5ead('0x0'));var util=require('util');var logger=require(_0x5ead('0x1'))(_0x5ead('0x2'));var moment=require(_0x5ead('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ead('0x4'));var config=require('../../config/environment');var attributes=require(_0x5ead('0x5'));module['exports']=function(_0x4fef74,_0x517641){return _0x4fef74[_0x5ead('0x6')](_0x5ead('0x7'),attributes,{'tableName':_0x5ead('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cc8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x3cc8,0x164));var _0x83cc=function(_0x107426,_0x7af5cc){_0x107426=_0x107426-0x0;var _0x21f9f0=_0x3cc8[_0x107426];return _0x21f9f0;};'use strict';var _=require(_0x83cc('0x0'));var util=require(_0x83cc('0x1'));var logger=require(_0x83cc('0x2'))(_0x83cc('0x3'));var moment=require(_0x83cc('0x4'));var BPromise=require(_0x83cc('0x5'));var rp=require(_0x83cc('0x6'));var fs=require('fs');var path=require(_0x83cc('0x7'));var rimraf=require(_0x83cc('0x8'));var config=require(_0x83cc('0x9'));var attributes=require(_0x83cc('0xa'));module[_0x83cc('0xb')]=function(_0x2b83f6,_0x2add67){return _0x2b83f6[_0x83cc('0xc')](_0x83cc('0xd'),attributes,{'tableName':_0x83cc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f0f23d1..709276e 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 _0x46ed=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','stringify','code','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x4b9e79,_0x2c5857){var _0x4c07eb=function(_0x387b72){while(--_0x387b72){_0x4b9e79['push'](_0x4b9e79['shift']());}};_0x4c07eb(++_0x2c5857);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});config[_0xd46e('0xb')]=_[_0xd46e('0xc')](config[_0xd46e('0xb')],{'host':_0xd46e('0xd'),'port':0x18eb});var socket=require(_0xd46e('0xe'))(new Redis(config[_0xd46e('0xb')]));require(_0xd46e('0xf'))['register'](socket);function respondWithRpcPromise(_0x7b2d69,_0x81235b,_0x50ccd3){return new BPromise(function(_0x3585e7,_0x15b5cb){return client[_0xd46e('0x10')](_0x7b2d69,_0x50ccd3)[_0xd46e('0x11')](function(_0x1ad723){logger[_0xd46e('0x12')]('UserProfile,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'),JSON[_0xd46e('0x14')](_0x1ad723));if(_0x1ad723['error']){if(_0x1ad723['error'][_0xd46e('0x15')]===0x1f4){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x15b5cb(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x3585e7(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}else{logger[_0xd46e('0x12')]('UserProfile,\x20%s,\x20%s',_0x81235b,'request\x20sent');_0x3585e7(_0x1ad723[_0xd46e('0x19')][_0xd46e('0x18')]);}})['catch'](function(_0x4fd1f2){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x4fd1f2);_0x15b5cb(_0x4fd1f2);});});} \ No newline at end of file +var _0x71ab=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','stringify','error','message','UserProfile,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x30a512,_0x2779ac){var _0xd668f=function(_0x2b0a45){while(--_0x2b0a45){_0x30a512['push'](_0x30a512['shift']());}};_0xd668f(++_0x2779ac);}(_0x71ab,0x64));var _0xb71a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x71ab[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});config[_0xb71a('0xb')]=_[_0xb71a('0xc')](config[_0xb71a('0xb')],{'host':_0xb71a('0xd'),'port':0x18eb});var socket=require(_0xb71a('0xe'))(new Redis(config[_0xb71a('0xb')]));require(_0xb71a('0xf'))[_0xb71a('0x10')](socket);function respondWithRpcPromise(_0x2e8883,_0x517eed,_0xfec897){return new BPromise(function(_0x58956d,_0x3d7bd7){return client[_0xb71a('0x11')](_0x2e8883,_0xfec897)[_0xb71a('0x12')](function(_0x591311){logger[_0xb71a('0x13')]('UserProfile,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'),JSON[_0xb71a('0x15')](_0x591311));if(_0x591311[_0xb71a('0x16')]){if(_0x591311[_0xb71a('0x16')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x3d7bd7(_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);}logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x58956d(_0x591311[_0xb71a('0x16')]['message']);}else{logger[_0xb71a('0x13')](_0xb71a('0x18'),_0x517eed,_0xb71a('0x14'));_0x58956d(_0x591311[_0xb71a('0x19')][_0xb71a('0x17')]);}})[_0xb71a('0x1a')](function(_0x349de1){logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x349de1);_0x3d7bd7(_0x349de1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fd7f938..aa702fb 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 _0x86b0=['removeListener','register','userProfile:','save','update','emit'];(function(_0x361762,_0x466f6e){var _0x2bf5c1=function(_0x253c7f){while(--_0x253c7f){_0x361762['push'](_0x361762['shift']());}};_0x2bf5c1(++_0x466f6e);}(_0x86b0,0x15f));var _0x086b=function(_0x3b78bc,_0x44fc89){_0x3b78bc=_0x3b78bc-0x0;var _0x4ac63a=_0x86b0[_0x3b78bc];return _0x4ac63a;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x086b('0x0'),'remove',_0x086b('0x1')];function createListener(_0x4a50c2,_0x36beae){return function(_0x22bb23){_0x36beae[_0x086b('0x2')](_0x4a50c2,_0x22bb23);};}function removeListener(_0x4de36f,_0x751856){return function(){UserProfileEvents[_0x086b('0x3')](_0x4de36f,_0x751856);};}exports[_0x086b('0x4')]=function(_0x4741a7){for(var _0x57b2ea=0x0,_0xe4d31d=events['length'];_0x57b2ea<_0xe4d31d;_0x57b2ea++){var _0x56d0e6=events[_0x57b2ea];var _0x5acd58=createListener(_0x086b('0x5')+_0x56d0e6,_0x4741a7);UserProfileEvents['on'](_0x56d0e6,_0x5acd58);}}; \ No newline at end of file +var _0xf64e=['register','length','./userProfile.events','save','remove','update','emit','removeListener'];(function(_0xc5b411,_0x32de1d){var _0xffa167=function(_0x2d6ec0){while(--_0x2d6ec0){_0xc5b411['push'](_0xc5b411['shift']());}};_0xffa167(++_0x32de1d);}(_0xf64e,0xf2));var _0xef64=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf64e[_0x57b54c];return _0x59cc19;};'use strict';var UserProfileEvents=require(_0xef64('0x0'));var events=[_0xef64('0x1'),_0xef64('0x2'),_0xef64('0x3')];function createListener(_0x183004,_0x213220){return function(_0x39f290){_0x213220[_0xef64('0x4')](_0x183004,_0x39f290);};}function removeListener(_0x9b598,_0x551fc3){return function(){UserProfileEvents[_0xef64('0x5')](_0x9b598,_0x551fc3);};}exports[_0xef64('0x6')]=function(_0x3ba2cd){for(var _0xe46bbd=0x0,_0x6aebf8=events[_0xef64('0x7')];_0xe46bbd<_0x6aebf8;_0xe46bbd++){var _0xbbb9e1=events[_0xe46bbd];var _0xd745db=createListener('userProfile:'+_0xbbb9e1,_0x3ba2cd);UserProfileEvents['on'](_0xbbb9e1,_0xd745db);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d9484ea..88f4ecf 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 _0x9ffd=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer'];(function(_0x3a93ff,_0x2cca55){var _0x3af771=function(_0x13fd79){while(--_0x13fd79){_0x3a93ff['push'](_0x3a93ff['shift']());}};_0x3af771(++_0x2cca55);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2ab617,_0x4b0576){_0x2ab617=_0x2ab617-0x0;var _0xdead2e=_0x9ffd[_0x2ab617];return _0xdead2e;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0x8')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0x10')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0x60d7=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x2baa0f,_0x8c18bd){var _0x46d1b0=function(_0x573864){while(--_0x573864){_0x2baa0f['push'](_0x2baa0f['shift']());}};_0x46d1b0(++_0x8c18bd);}(_0x60d7,0x149));var _0x760d=function(_0x119f8f,_0x3a3ddc){_0x119f8f=_0x119f8f-0x0;var _0x3759c9=_0x60d7[_0x119f8f];return _0x3759c9;};'use strict';var multer=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var path=require(_0x760d('0x2'));var timeout=require(_0x760d('0x3'));var express=require(_0x760d('0x4'));var router=express[_0x760d('0x5')]();var auth=require(_0x760d('0x6'));var interaction=require(_0x760d('0x7'));var config=require(_0x760d('0x8'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0x760d('0x9')](),controller[_0x760d('0xa')]);router[_0x760d('0xb')](_0x760d('0xc'),auth[_0x760d('0x9')](),controller[_0x760d('0xd')]);router[_0x760d('0xb')](_0x760d('0xe'),auth[_0x760d('0x9')](),controller[_0x760d('0xf')]);router[_0x760d('0x10')]('/',auth[_0x760d('0x9')](),controller[_0x760d('0x11')]);router['put'](_0x760d('0xe'),auth[_0x760d('0x9')](),controller[_0x760d('0x12')]);router[_0x760d('0x13')](_0x760d('0xe'),auth['isAuthenticated'](),controller[_0x760d('0x14')]);module[_0x760d('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 782a1bd..fa7e7c5 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 _0x0cad=['STRING','INTEGER','sequelize'];(function(_0x207061,_0xe38cda){var _0x4a2833=function(_0x16906e){while(--_0x16906e){_0x207061['push'](_0x207061['shift']());}};_0x4a2833(++_0xe38cda);}(_0x0cad,0xf8));var _0xd0ca=function(_0x6470a2,_0x3b5f44){_0x6470a2=_0x6470a2-0x0;var _0x24ac61=_0x0cad[_0x6470a2];return _0x24ac61;};'use strict';var Sequelize=require(_0xd0ca('0x0'));module['exports']={'name':{'type':Sequelize[_0xd0ca('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd0ca('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd0ca('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc6f0=['STRING','sequelize','exports'];(function(_0x93b766,_0x20896e){var _0x4e4302=function(_0x3299a4){while(--_0x3299a4){_0x93b766['push'](_0x93b766['shift']());}};_0x4e4302(++_0x20896e);}(_0xc6f0,0x7f));var _0x0c6f=function(_0x2c417e,_0x191875){_0x2c417e=_0x2c417e-0x0;var _0x21d476=_0xc6f0[_0x2c417e];return _0x21d476;};'use strict';var Sequelize=require(_0x0c6f('0x0'));module[_0x0c6f('0x1')]={'name':{'type':Sequelize[_0x0c6f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x0c6f('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 3d0c75b..31bd2f0 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 _0x008c=['sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','UserProfileResource','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x17b20b,_0x4c3299){var _0x107f0b=function(_0x3488ad){while(--_0x3488ad){_0x17b20b['push'](_0x17b20b['shift']());}};_0x107f0b(++_0x4c3299);}(_0x008c,0x188));var _0xc008=function(_0x5bce33,_0x4a4b06){_0x5bce33=_0x5bce33-0x0;var _0x15bc20=_0x008c[_0x5bce33];return _0x15bc20;};'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'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));};exports['show']=function(_0x2c4964,_0x15396b){var _0xc8cb91={'raw':![],'where':{'id':_0x2c4964[_0xc008('0x3b')]['id']}},_0x36e7ae={};_0x36e7ae['model']=_[_0xc008('0x3c')](db[_0xc008('0x23')][_0xc008('0x3d')]);_0x36e7ae[_0xc008('0x2a')]=_[_0xc008('0x3c')](_0x2c4964['query']);_0x36e7ae[_0xc008('0x27')]=_[_0xc008('0x28')](_0x36e7ae[_0xc008('0x29')],_0x36e7ae[_0xc008('0x2a')]);_0xc8cb91['attributes']=_[_0xc008('0x28')](_0x36e7ae[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x2c4964['query'][_0xc008('0x2c')]));_0xc8cb91['attributes']=_0xc8cb91[_0xc008('0x2b')]['length']?_0xc8cb91[_0xc008('0x2b')]:_0x36e7ae[_0xc008('0x29')];if(_0x2c4964['query'][_0xc008('0x36')]){_0xc8cb91[_0xc008('0x37')]=[{'all':!![]}];}_0xc8cb91=_[_0xc008('0x34')]({},_0xc8cb91,_0x2c4964['options']);return db[_0xc008('0x23')][_0xc008('0x3e')](_0xc8cb91)[_0xc008('0x1e')](handleEntityNotFound(_0x15396b,null))[_0xc008('0x1e')](respondWithResult(_0x15396b,null))[_0xc008('0x3a')](handleError(_0x15396b,null));};exports[_0xc008('0x3f')]=function(_0x59ca2b,_0x47cafa){return db['UserProfileResource'][_0xc008('0x3f')](_0x59ca2b[_0xc008('0x40')],{})[_0xc008('0x1e')](respondWithResult(_0x47cafa,0xc9))[_0xc008('0x3a')](handleError(_0x47cafa,null));};exports[_0xc008('0x41')]=function(_0x24f6a4,_0x2cf641){if(_0x24f6a4[_0xc008('0x40')]['id']){delete _0x24f6a4['body']['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x24f6a4[_0xc008('0x3b')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x2cf641,null))[_0xc008('0x1e')](saveUpdates(_0x24f6a4['body'],null))[_0xc008('0x1e')](respondWithResult(_0x2cf641,null))[_0xc008('0x3a')](handleError(_0x2cf641,null));};exports[_0xc008('0x1d')]=function(_0x1c2c50,_0x4981b4){return db[_0xc008('0x23')][_0xc008('0x3e')]({'where':{'id':_0x1c2c50[_0xc008('0x3b')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1e')](removeEntity(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports['describe']=function(_0x223056,_0x51cb14){return db[_0xc008('0x23')][_0xc008('0x42')]()[_0xc008('0x1e')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));}; \ No newline at end of file +var _0x008c=['sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','UserProfileResource','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x11c052,_0x5163a1){var _0x9af51b=function(_0x461c50){while(--_0x461c50){_0x11c052['push'](_0x11c052['shift']());}};_0x9af51b(++_0x5163a1);}(_0x008c,0x188));var _0xc008=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x008c[_0x43c8b8];return _0x413be3;};'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'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));};exports['show']=function(_0x2c4964,_0x15396b){var _0xc8cb91={'raw':![],'where':{'id':_0x2c4964[_0xc008('0x3b')]['id']}},_0x36e7ae={};_0x36e7ae['model']=_[_0xc008('0x3c')](db[_0xc008('0x23')][_0xc008('0x3d')]);_0x36e7ae[_0xc008('0x2a')]=_[_0xc008('0x3c')](_0x2c4964['query']);_0x36e7ae[_0xc008('0x27')]=_[_0xc008('0x28')](_0x36e7ae[_0xc008('0x29')],_0x36e7ae[_0xc008('0x2a')]);_0xc8cb91['attributes']=_[_0xc008('0x28')](_0x36e7ae[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x2c4964['query'][_0xc008('0x2c')]));_0xc8cb91['attributes']=_0xc8cb91[_0xc008('0x2b')]['length']?_0xc8cb91[_0xc008('0x2b')]:_0x36e7ae[_0xc008('0x29')];if(_0x2c4964['query'][_0xc008('0x36')]){_0xc8cb91[_0xc008('0x37')]=[{'all':!![]}];}_0xc8cb91=_[_0xc008('0x34')]({},_0xc8cb91,_0x2c4964['options']);return db[_0xc008('0x23')][_0xc008('0x3e')](_0xc8cb91)[_0xc008('0x1e')](handleEntityNotFound(_0x15396b,null))[_0xc008('0x1e')](respondWithResult(_0x15396b,null))[_0xc008('0x3a')](handleError(_0x15396b,null));};exports[_0xc008('0x3f')]=function(_0x59ca2b,_0x47cafa){return db['UserProfileResource'][_0xc008('0x3f')](_0x59ca2b[_0xc008('0x40')],{})[_0xc008('0x1e')](respondWithResult(_0x47cafa,0xc9))[_0xc008('0x3a')](handleError(_0x47cafa,null));};exports[_0xc008('0x41')]=function(_0x24f6a4,_0x2cf641){if(_0x24f6a4[_0xc008('0x40')]['id']){delete _0x24f6a4['body']['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x24f6a4[_0xc008('0x3b')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x2cf641,null))[_0xc008('0x1e')](saveUpdates(_0x24f6a4['body'],null))[_0xc008('0x1e')](respondWithResult(_0x2cf641,null))[_0xc008('0x3a')](handleError(_0x2cf641,null));};exports[_0xc008('0x1d')]=function(_0x1c2c50,_0x4981b4){return db[_0xc008('0x23')][_0xc008('0x3e')]({'where':{'id':_0x1c2c50[_0xc008('0x3b')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1e')](removeEntity(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports['describe']=function(_0x223056,_0x51cb14){return db[_0xc008('0x23')][_0xc008('0x42')]()[_0xc008('0x1e')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f484b4e..8d5be88 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 _0x6f7a=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x526ad6,_0x30a50a){_0x526ad6=_0x526ad6-0x0;var _0x2a327e=_0x6f7a[_0x526ad6];return _0x2a327e;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xa6f7('0xd'),_0xa6f7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe605=['exports','define','user_profile_has_resources','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x404c35,_0xedfe89){var _0x28c900=function(_0x2dc0ab){while(--_0x2dc0ab){_0x404c35['push'](_0x404c35['shift']());}};_0x28c900(++_0xedfe89);}(_0xe605,0x92));var _0x5e60=function(_0x3cea53,_0x10ef54){_0x3cea53=_0x3cea53-0x0;var _0x3aba53=_0xe605[_0x3cea53];return _0x3aba53;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var logger=require('../../config/logger')(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var BPromise=require(_0x5e60('0x4'));var rp=require(_0x5e60('0x5'));var fs=require('fs');var path=require(_0x5e60('0x6'));var rimraf=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var attributes=require(_0x5e60('0x9'));module[_0x5e60('0xa')]=function(_0xc41535,_0x1d4a08){return _0xc41535[_0x5e60('0xb')]('UserProfileResource',attributes,{'tableName':_0x5e60('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index f0e897c..632f693 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 _0xabbe=['http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabbe,0x70));var _0xeabb=function(_0x245250,_0x9a88e4){_0x245250=_0x245250-0x0;var _0x47f0ff=_0xabbe[_0x245250];return _0x47f0ff;};'use strict';var _=require(_0xeabb('0x0'));var util=require('util');var moment=require(_0xeabb('0x1'));var BPromise=require('bluebird');var rs=require(_0xeabb('0x2'));var fs=require('fs');var Redis=require(_0xeabb('0x3'));var db=require(_0xeabb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeabb('0x5'));var config=require(_0xeabb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeabb('0x7')][_0xeabb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x534e4d,_0x3867b5,_0x17386a){return new BPromise(function(_0xe64536,_0x3a7a9c){return client[_0xeabb('0x9')](_0x534e4d,_0x17386a)['then'](function(_0x5ea9c9){logger[_0xeabb('0xa')](_0xeabb('0xb'),_0x3867b5,_0xeabb('0xc'));logger['debug'](_0xeabb('0xd'),_0x3867b5,_0xeabb('0xc'),JSON[_0xeabb('0xe')](_0x5ea9c9));if(_0x5ea9c9[_0xeabb('0xf')]){if(_0x5ea9c9[_0xeabb('0xf')][_0xeabb('0x10')]===0x1f4){logger['error'](_0xeabb('0xb'),_0x3867b5,_0x5ea9c9['error'][_0xeabb('0x11')]);return _0x3a7a9c(_0x5ea9c9[_0xeabb('0xf')][_0xeabb('0x11')]);}logger[_0xeabb('0xf')](_0xeabb('0xb'),_0x3867b5,_0x5ea9c9[_0xeabb('0xf')][_0xeabb('0x11')]);return _0xe64536(_0x5ea9c9['error'][_0xeabb('0x11')]);}else{logger['info'](_0xeabb('0xb'),_0x3867b5,'request\x20sent');_0xe64536(_0x5ea9c9[_0xeabb('0x12')][_0xeabb('0x11')]);}})[_0xeabb('0x13')](function(_0x3a5879){logger[_0xeabb('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x3867b5,_0x3a5879);_0x3a7a9c(_0x3a5879);});});} \ No newline at end of file +var _0xd014=['../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','../../config/logger'];(function(_0xe56865,_0x125547){var _0x3376ae=function(_0x50df30){while(--_0x50df30){_0xe56865['push'](_0xe56865['shift']());}};_0x3376ae(++_0x125547);}(_0xd014,0x188));var _0x4d01=function(_0x154389,_0x15397f){_0x154389=_0x154389-0x0;var _0x16dd13=_0xd014[_0x154389];return _0x16dd13;};'use strict';var _=require(_0x4d01('0x0'));var util=require(_0x4d01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d01('0x3'))('rpc');var config=require(_0x4d01('0x4'));var jayson=require(_0x4d01('0x5'));var client=jayson[_0x4d01('0x6')][_0x4d01('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f93df,_0x5c4320,_0x363b35){return new BPromise(function(_0x1ea857,_0x18d670){return client['request'](_0x4f93df,_0x363b35)[_0x4d01('0x8')](function(_0x4672a1){logger[_0x4d01('0x9')](_0x4d01('0xa'),_0x5c4320,_0x4d01('0xb'));logger[_0x4d01('0xc')](_0x4d01('0xd'),_0x5c4320,_0x4d01('0xb'),JSON[_0x4d01('0xe')](_0x4672a1));if(_0x4672a1[_0x4d01('0xf')]){if(_0x4672a1['error']['code']===0x1f4){logger['error'](_0x4d01('0xa'),_0x5c4320,_0x4672a1['error'][_0x4d01('0x10')]);return _0x18d670(_0x4672a1[_0x4d01('0xf')]['message']);}logger[_0x4d01('0xf')](_0x4d01('0xa'),_0x5c4320,_0x4672a1[_0x4d01('0xf')][_0x4d01('0x10')]);return _0x1ea857(_0x4672a1[_0x4d01('0xf')][_0x4d01('0x10')]);}else{logger[_0x4d01('0x9')](_0x4d01('0xa'),_0x5c4320,'request\x20sent');_0x1ea857(_0x4672a1['result'][_0x4d01('0x10')]);}})[_0x4d01('0x11')](function(_0x2e61c7){logger[_0x4d01('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x5c4320,_0x2e61c7);_0x18d670(_0x2e61c7);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 1742297..f7f93cc 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 _0xfe72=['../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5d8c1d,_0xe2218e){var _0xe18d8f=function(_0x3f9270){while(--_0x3f9270){_0x5d8c1d['push'](_0x5d8c1d['shift']());}};_0xe18d8f(++_0xe2218e);}(_0xfe72,0x1a3));var _0x2fe7=function(_0x24b9e9,_0x4edca9){_0x24b9e9=_0x24b9e9-0x0;var _0x3e495d=_0xfe72[_0x24b9e9];return _0x3e495d;};'use strict';var multer=require(_0x2fe7('0x0'));var util=require(_0x2fe7('0x1'));var path=require(_0x2fe7('0x2'));var timeout=require(_0x2fe7('0x3'));var express=require(_0x2fe7('0x4'));var router=express[_0x2fe7('0x5')]();var auth=require(_0x2fe7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x2fe7('0x7')]('/',auth[_0x2fe7('0x8')](),controller['index']);router[_0x2fe7('0x7')](_0x2fe7('0x9'),auth[_0x2fe7('0x8')](),controller[_0x2fe7('0xa')]);router[_0x2fe7('0x7')](_0x2fe7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2fe7('0xc')]('/',auth[_0x2fe7('0x8')](),controller[_0x2fe7('0xd')]);router['put'](_0x2fe7('0xb'),auth[_0x2fe7('0x8')](),controller['update']);router[_0x2fe7('0xe')](_0x2fe7('0xb'),auth[_0x2fe7('0x8')](),controller[_0x2fe7('0xf')]);module[_0x2fe7('0x10')]=router; \ No newline at end of file +var _0xf864=['connect-timeout','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','path'];(function(_0x14a5af,_0x59c3c0){var _0x52c808=function(_0x500b91){while(--_0x500b91){_0x14a5af['push'](_0x14a5af['shift']());}};_0x52c808(++_0x59c3c0);}(_0xf864,0x11f));var _0x4f86=function(_0x1808e2,_0x1b308d){_0x1808e2=_0x1808e2-0x0;var _0x2d9c4f=_0xf864[_0x1808e2];return _0x2d9c4f;};'use strict';var multer=require(_0x4f86('0x0'));var util=require('util');var path=require(_0x4f86('0x1'));var timeout=require(_0x4f86('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f86('0x3'));var config=require(_0x4f86('0x4'));var controller=require(_0x4f86('0x5'));router[_0x4f86('0x6')]('/',auth[_0x4f86('0x7')](),controller[_0x4f86('0x8')]);router[_0x4f86('0x6')](_0x4f86('0x9'),auth[_0x4f86('0x7')](),controller['describe']);router[_0x4f86('0x6')]('/:id',auth[_0x4f86('0x7')](),controller[_0x4f86('0xa')]);router[_0x4f86('0xb')]('/',auth[_0x4f86('0x7')](),controller[_0x4f86('0xc')]);router[_0x4f86('0xd')](_0x4f86('0xe'),auth[_0x4f86('0x7')](),controller[_0x4f86('0xf')]);router['delete'](_0x4f86('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f86('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index fe4b8bf..9a7966c 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 _0x8da5=['crudPermissions','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue'];(function(_0x16ec32,_0x4a61c8){var _0xcc8578=function(_0x35cb76){while(--_0x35cb76){_0x16ec32['push'](_0x16ec32['shift']());}};_0xcc8578(++_0x4a61c8);}(_0x8da5,0x71));var _0x58da=function(_0x32cfd9,_0x16347b){_0x32cfd9=_0x32cfd9-0x0;var _0x26c6e2=_0x8da5[_0x32cfd9];return _0x26c6e2;};'use strict';var Sequelize=require(_0x58da('0x0'));module['exports']={'name':{'type':Sequelize[_0x58da('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x58da('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x58da('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x58da('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x58da('0x1')],'set':function(_0x17670a){this[_0x58da('0x4')]('crudPermissions',_0x17670a?_0x17670a[_0x58da('0x5')](''):[]);},'get':function(){return this[_0x58da('0x6')](_0x58da('0x7'))?this[_0x58da('0x6')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0x97ed=['exports','INTEGER','BOOLEAN','STRING','setDataValue','crudPermissions','getDataValue','sequelize'];(function(_0x3adf4e,_0x26d25f){var _0x4dc28b=function(_0x38d031){while(--_0x38d031){_0x3adf4e['push'](_0x3adf4e['shift']());}};_0x4dc28b(++_0x26d25f);}(_0x97ed,0x1e7));var _0xd97e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x97ed[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xd97e('0x0'));module[_0xd97e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd97e('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd97e('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd97e('0x4')],'set':function(_0x27b80c){this[_0xd97e('0x5')](_0xd97e('0x6'),_0x27b80c?_0x27b80c['join'](''):[]);},'get':function(){return this[_0xd97e('0x7')](_0xd97e('0x6'))?this['getDataValue'](_0xd97e('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 944b8cb..b10535c 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 _0xd9f1=['index','map','UserProfileSection','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name'];(function(_0x283f12,_0x580caa){var _0x144858=function(_0x29936f){while(--_0x29936f){_0x283f12['push'](_0x283f12['shift']());}};_0x144858(++_0x580caa);}(_0xd9f1,0x1df));var _0x1d9f=function(_0x406227,_0x3ab53e){_0x406227=_0x406227-0x0;var _0x12c759=_0xd9f1[_0x406227];return _0x12c759;};'use strict';var pdf=require(_0x1d9f('0x0'));var emlformat=require(_0x1d9f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1d9f('0x2'));var jsonpatch=require(_0x1d9f('0x3'));var rp=require(_0x1d9f('0x4'));var moment=require(_0x1d9f('0x5'));var BPromise=require(_0x1d9f('0x6'));var Mustache=require(_0x1d9f('0x7'));var util=require(_0x1d9f('0x8'));var path=require('path');var sox=require(_0x1d9f('0x9'));var csv=require(_0x1d9f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d9f('0xb'));var squel=require(_0x1d9f('0xc'));var crypto=require('crypto');var jsforce=require(_0x1d9f('0xd'));var deskjs=require(_0x1d9f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d9f('0xf'));var Redis=require(_0x1d9f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1d9f('0x11'));var as=require(_0x1d9f('0x12'));var hardwareService=require(_0x1d9f('0x13'));var logger=require(_0x1d9f('0x14'))(_0x1d9f('0x15'));var utils=require(_0x1d9f('0x16'));var config=require(_0x1d9f('0x17'));var db=require(_0x1d9f('0x18'))['db'];function respondWithStatusCode(_0x39a54e,_0x34d72d){_0x34d72d=_0x34d72d||0xcc;return function(_0x4a3842){if(_0x4a3842){return _0x39a54e['sendStatus'](_0x34d72d);}return _0x39a54e[_0x1d9f('0x19')](_0x34d72d)['end']();};}function respondWithResult(_0x1dec83,_0x4998ce){_0x4998ce=_0x4998ce||0xc8;return function(_0x4f13bb){if(_0x4f13bb){return _0x1dec83[_0x1d9f('0x19')](_0x4998ce)[_0x1d9f('0x1a')](_0x4f13bb);}};}function respondWithFilteredResult(_0x4bc52a,_0x3750cf){return function(_0x56e7ef){if(_0x56e7ef){var _0x4afd57=_0x56e7ef['count'],_0x43cf1c=_0x3750cf[_0x1d9f('0x1b')],_0xb7ad6=_0x3750cf[_0x1d9f('0x1b')]+_0x3750cf[_0x1d9f('0x1c')],_0x54ba8e;if(_0xb7ad6>=_0x4afd57){_0xb7ad6=_0x4afd57;_0x54ba8e=0xc8;}else{_0x54ba8e=0xce;}_0x4bc52a[_0x1d9f('0x19')](_0x54ba8e);return _0x4bc52a['set'](_0x1d9f('0x1d'),_0x43cf1c+'-'+_0xb7ad6+'/'+_0x4afd57)['json'](_0x56e7ef);}return null;};}function patchUpdates(_0x1f7c85){return function(_0x5d37ef){try{jsonpatch[_0x1d9f('0x1e')](_0x5d37ef,_0x1f7c85,!![]);}catch(_0x5c2e89){return BPromise[_0x1d9f('0x1f')](_0x5c2e89);}return _0x5d37ef[_0x1d9f('0x20')]();};}function saveUpdates(_0x28a1fd,_0x274ced){return function(_0x2abdda){if(_0x2abdda){return _0x2abdda['update'](_0x28a1fd)[_0x1d9f('0x21')](function(_0x5953fa){return _0x5953fa;});}return null;};}function removeEntity(_0x389e2b,_0x4ac0cd){return function(_0x2c5447){if(_0x2c5447){return _0x2c5447['destroy']()['then'](function(){_0x389e2b[_0x1d9f('0x19')](0xcc)[_0x1d9f('0x22')]();});}};}function handleEntityNotFound(_0x25d8da,_0x6d6509){return function(_0x283eaa){if(!_0x283eaa){_0x25d8da[_0x1d9f('0x23')](0x194);}return _0x283eaa;};}function handleError(_0x2c1fc7,_0xde160){_0xde160=_0xde160||0x1f4;return function(_0x4f494b){logger[_0x1d9f('0x24')](_0x4f494b[_0x1d9f('0x25')]);if(_0x4f494b[_0x1d9f('0x26')]){delete _0x4f494b[_0x1d9f('0x26')];}_0x2c1fc7['status'](_0xde160)['send'](_0x4f494b);};}exports[_0x1d9f('0x27')]=function(_0x9da85a,_0x2cf22f){var _0x3a2cdd={},_0x5ba8a7={},_0x31ee68={'count':0x0,'rows':[]};var _0x3c7236=_[_0x1d9f('0x28')](db[_0x1d9f('0x29')][_0x1d9f('0x2a')],function(_0x318bf8){return{'name':_0x318bf8[_0x1d9f('0x2b')],'type':_0x318bf8[_0x1d9f('0x2c')]['key']};});_0x5ba8a7['model']=_[_0x1d9f('0x28')](_0x3c7236,_0x1d9f('0x26'));_0x5ba8a7['query']=_[_0x1d9f('0x2d')](_0x9da85a[_0x1d9f('0x2e')]);_0x5ba8a7[_0x1d9f('0x2f')]=_[_0x1d9f('0x30')](_0x5ba8a7[_0x1d9f('0x31')],_0x5ba8a7[_0x1d9f('0x2e')]);_0x3a2cdd[_0x1d9f('0x32')]=_['intersection'](_0x5ba8a7[_0x1d9f('0x31')],qs[_0x1d9f('0x33')](_0x9da85a[_0x1d9f('0x2e')][_0x1d9f('0x33')]));_0x3a2cdd[_0x1d9f('0x32')]=_0x3a2cdd[_0x1d9f('0x32')][_0x1d9f('0x34')]?_0x3a2cdd[_0x1d9f('0x32')]:_0x5ba8a7[_0x1d9f('0x31')];if(!_0x9da85a[_0x1d9f('0x2e')][_0x1d9f('0x35')](_0x1d9f('0x36'))){_0x3a2cdd[_0x1d9f('0x1c')]=qs[_0x1d9f('0x1c')](_0x9da85a['query']['limit']);_0x3a2cdd['offset']=qs['offset'](_0x9da85a[_0x1d9f('0x2e')][_0x1d9f('0x1b')]);}_0x3a2cdd[_0x1d9f('0x37')]=qs[_0x1d9f('0x38')](_0x9da85a[_0x1d9f('0x2e')][_0x1d9f('0x38')]);_0x3a2cdd[_0x1d9f('0x39')]=qs[_0x1d9f('0x2f')](_[_0x1d9f('0x3a')](_0x9da85a['query'],_0x5ba8a7[_0x1d9f('0x2f')]),_0x3c7236);if(_0x9da85a[_0x1d9f('0x2e')]['filter']){_0x3a2cdd[_0x1d9f('0x39')]=_['merge'](_0x3a2cdd[_0x1d9f('0x39')],{'$or':_['map'](_0x3c7236,function(_0x238665){if(_0x238665[_0x1d9f('0x2c')]!=='VIRTUAL'){var _0x285b57={};_0x285b57[_0x238665[_0x1d9f('0x26')]]={'$like':'%'+_0x9da85a['query'][_0x1d9f('0x3b')]+'%'};return _0x285b57;}})});}_0x3a2cdd=_[_0x1d9f('0x3c')]({},_0x3a2cdd,_0x9da85a[_0x1d9f('0x3d')]);var _0x4333a9={'where':_0x3a2cdd['where']};return db['UserProfileSection']['count'](_0x4333a9)['then'](function(_0x3e5aaa){_0x31ee68['count']=_0x3e5aaa;if(_0x9da85a['query'][_0x1d9f('0x3e')]){_0x3a2cdd[_0x1d9f('0x3f')]=[{'all':!![]}];}return db[_0x1d9f('0x29')][_0x1d9f('0x40')](_0x3a2cdd);})['then'](function(_0x276cf8){_0x31ee68[_0x1d9f('0x41')]=_0x276cf8;return _0x31ee68;})[_0x1d9f('0x21')](respondWithFilteredResult(_0x2cf22f,_0x3a2cdd))[_0x1d9f('0x42')](handleError(_0x2cf22f,null));};exports[_0x1d9f('0x43')]=function(_0x321509,_0x6ee385){var _0x2e4f40={'raw':![],'where':{'id':_0x321509[_0x1d9f('0x44')]['id']}},_0x4679cd={};_0x4679cd['model']=_[_0x1d9f('0x2d')](db[_0x1d9f('0x29')][_0x1d9f('0x2a')]);_0x4679cd[_0x1d9f('0x2e')]=_[_0x1d9f('0x2d')](_0x321509[_0x1d9f('0x2e')]);_0x4679cd['filters']=_[_0x1d9f('0x30')](_0x4679cd['model'],_0x4679cd[_0x1d9f('0x2e')]);_0x2e4f40[_0x1d9f('0x32')]=_[_0x1d9f('0x30')](_0x4679cd[_0x1d9f('0x31')],qs['fields'](_0x321509[_0x1d9f('0x2e')]['fields']));_0x2e4f40['attributes']=_0x2e4f40[_0x1d9f('0x32')][_0x1d9f('0x34')]?_0x2e4f40[_0x1d9f('0x32')]:_0x4679cd[_0x1d9f('0x31')];if(_0x321509[_0x1d9f('0x2e')]['includeAll']){_0x2e4f40[_0x1d9f('0x3f')]=[{'all':!![]}];}_0x2e4f40=_[_0x1d9f('0x3c')]({},_0x2e4f40,_0x321509[_0x1d9f('0x3d')]);return db[_0x1d9f('0x29')][_0x1d9f('0x45')](_0x2e4f40)[_0x1d9f('0x21')](handleEntityNotFound(_0x6ee385,null))[_0x1d9f('0x21')](respondWithResult(_0x6ee385,null))[_0x1d9f('0x42')](handleError(_0x6ee385,null));};exports[_0x1d9f('0x46')]=function(_0x35f7cf,_0x394117){return db[_0x1d9f('0x29')][_0x1d9f('0x46')](_0x35f7cf[_0x1d9f('0x47')],{})['then'](respondWithResult(_0x394117,0xc9))[_0x1d9f('0x42')](handleError(_0x394117,null));};exports['update']=function(_0x2f16d6,_0x1fbacc){if(_0x2f16d6[_0x1d9f('0x47')]['id']){delete _0x2f16d6['body']['id'];}return db[_0x1d9f('0x29')][_0x1d9f('0x45')]({'where':{'id':_0x2f16d6[_0x1d9f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fbacc,null))['then'](saveUpdates(_0x2f16d6[_0x1d9f('0x47')],null))[_0x1d9f('0x21')](respondWithResult(_0x1fbacc,null))[_0x1d9f('0x42')](handleError(_0x1fbacc,null));};exports[_0x1d9f('0x48')]=function(_0x53fc91,_0x3e5a20){return db['UserProfileSection']['find']({'where':{'id':_0x53fc91[_0x1d9f('0x44')]['id']}})[_0x1d9f('0x21')](handleEntityNotFound(_0x3e5a20,null))['then'](removeEntity(_0x3e5a20,null))[_0x1d9f('0x42')](handleError(_0x3e5a20,null));};exports['describe']=function(_0x28d473,_0x21d668){return db['UserProfileSection'][_0x1d9f('0x49')]()[_0x1d9f('0x21')](respondWithResult(_0x21d668,null))[_0x1d9f('0x42')](handleError(_0x21d668,null));}; \ No newline at end of file +var _0xab05=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','catch','params','keys','find','create','update','body','describe','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'];(function(_0x28b088,_0xddb75e){var _0x4b329e=function(_0x1944bb){while(--_0x1944bb){_0x28b088['push'](_0x28b088['shift']());}};_0x4b329e(++_0xddb75e);}(_0xab05,0x1b6));var _0x5ab0=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xab05[_0x4e9628];return _0x27bc8c;};'use strict';var pdf=require(_0x5ab0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5ab0('0x1'));var zipdir=require(_0x5ab0('0x2'));var jsonpatch=require(_0x5ab0('0x3'));var rp=require(_0x5ab0('0x4'));var moment=require(_0x5ab0('0x5'));var BPromise=require(_0x5ab0('0x6'));var Mustache=require(_0x5ab0('0x7'));var util=require(_0x5ab0('0x8'));var path=require(_0x5ab0('0x9'));var sox=require(_0x5ab0('0xa'));var csv=require(_0x5ab0('0xb'));var ejs=require(_0x5ab0('0xc'));var fs=require('fs');var _=require(_0x5ab0('0xd'));var squel=require(_0x5ab0('0xe'));var crypto=require(_0x5ab0('0xf'));var jsforce=require(_0x5ab0('0x10'));var deskjs=require(_0x5ab0('0x11'));var toCsv=require(_0x5ab0('0xb'));var querystring=require(_0x5ab0('0x12'));var Papa=require(_0x5ab0('0x13'));var Redis=require('ioredis');var authService=require(_0x5ab0('0x14'));var qs=require(_0x5ab0('0x15'));var as=require(_0x5ab0('0x16'));var hardwareService=require(_0x5ab0('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5ab0('0x18'))['db'];function respondWithStatusCode(_0x29886e,_0x202815){_0x202815=_0x202815||0xcc;return function(_0x3e2817){if(_0x3e2817){return _0x29886e[_0x5ab0('0x19')](_0x202815);}return _0x29886e[_0x5ab0('0x1a')](_0x202815)[_0x5ab0('0x1b')]();};}function respondWithResult(_0x4c80c9,_0x58f239){_0x58f239=_0x58f239||0xc8;return function(_0x2378f8){if(_0x2378f8){return _0x4c80c9['status'](_0x58f239)[_0x5ab0('0x1c')](_0x2378f8);}};}function respondWithFilteredResult(_0x3a210c,_0x55b0b5){return function(_0x42e500){if(_0x42e500){var _0x2a382d=_0x42e500[_0x5ab0('0x1d')],_0x475b82=_0x55b0b5['offset'],_0x54a1fc=_0x55b0b5['offset']+_0x55b0b5['limit'],_0xbc3efa;if(_0x54a1fc>=_0x2a382d){_0x54a1fc=_0x2a382d;_0xbc3efa=0xc8;}else{_0xbc3efa=0xce;}_0x3a210c[_0x5ab0('0x1a')](_0xbc3efa);return _0x3a210c[_0x5ab0('0x1e')](_0x5ab0('0x1f'),_0x475b82+'-'+_0x54a1fc+'/'+_0x2a382d)[_0x5ab0('0x1c')](_0x42e500);}return null;};}function patchUpdates(_0xdc2607){return function(_0x23d784){try{jsonpatch['apply'](_0x23d784,_0xdc2607,!![]);}catch(_0x4795ec){return BPromise[_0x5ab0('0x20')](_0x4795ec);}return _0x23d784['save']();};}function saveUpdates(_0x41b971,_0x2b3e67){return function(_0x350682){if(_0x350682){return _0x350682['update'](_0x41b971)[_0x5ab0('0x21')](function(_0x4a583a){return _0x4a583a;});}return null;};}function removeEntity(_0x3fce1b,_0x3d3762){return function(_0x7ae3fa){if(_0x7ae3fa){return _0x7ae3fa[_0x5ab0('0x22')]()[_0x5ab0('0x21')](function(){_0x3fce1b[_0x5ab0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4cf6,_0x549841){return function(_0x48ef57){if(!_0x48ef57){_0x2f4cf6[_0x5ab0('0x19')](0x194);}return _0x48ef57;};}function handleError(_0x4081e1,_0x4a473a){_0x4a473a=_0x4a473a||0x1f4;return function(_0x3628a6){logger[_0x5ab0('0x23')](_0x3628a6[_0x5ab0('0x24')]);if(_0x3628a6[_0x5ab0('0x25')]){delete _0x3628a6[_0x5ab0('0x25')];}_0x4081e1[_0x5ab0('0x1a')](_0x4a473a)[_0x5ab0('0x26')](_0x3628a6);};}exports[_0x5ab0('0x27')]=function(_0x5e0b03,_0x29b146){var _0x458c9b={},_0x291e82={},_0x94fa1={'count':0x0,'rows':[]};var _0x39d000=_[_0x5ab0('0x28')](db['UserProfileSection'][_0x5ab0('0x29')],function(_0x4985be){return{'name':_0x4985be[_0x5ab0('0x2a')],'type':_0x4985be[_0x5ab0('0x2b')][_0x5ab0('0x2c')]};});_0x291e82[_0x5ab0('0x2d')]=_[_0x5ab0('0x28')](_0x39d000,_0x5ab0('0x25'));_0x291e82[_0x5ab0('0x2e')]=_['keys'](_0x5e0b03[_0x5ab0('0x2e')]);_0x291e82[_0x5ab0('0x2f')]=_[_0x5ab0('0x30')](_0x291e82[_0x5ab0('0x2d')],_0x291e82['query']);_0x458c9b[_0x5ab0('0x31')]=_[_0x5ab0('0x30')](_0x291e82['model'],qs['fields'](_0x5e0b03[_0x5ab0('0x2e')][_0x5ab0('0x32')]));_0x458c9b[_0x5ab0('0x31')]=_0x458c9b['attributes'][_0x5ab0('0x33')]?_0x458c9b[_0x5ab0('0x31')]:_0x291e82['model'];if(!_0x5e0b03[_0x5ab0('0x2e')][_0x5ab0('0x34')](_0x5ab0('0x35'))){_0x458c9b[_0x5ab0('0x36')]=qs[_0x5ab0('0x36')](_0x5e0b03[_0x5ab0('0x2e')][_0x5ab0('0x36')]);_0x458c9b['offset']=qs[_0x5ab0('0x37')](_0x5e0b03[_0x5ab0('0x2e')][_0x5ab0('0x37')]);}_0x458c9b[_0x5ab0('0x38')]=qs[_0x5ab0('0x39')](_0x5e0b03['query'][_0x5ab0('0x39')]);_0x458c9b['where']=qs[_0x5ab0('0x2f')](_[_0x5ab0('0x3a')](_0x5e0b03[_0x5ab0('0x2e')],_0x291e82[_0x5ab0('0x2f')]),_0x39d000);if(_0x5e0b03[_0x5ab0('0x2e')][_0x5ab0('0x3b')]){_0x458c9b[_0x5ab0('0x3c')]=_[_0x5ab0('0x3d')](_0x458c9b[_0x5ab0('0x3c')],{'$or':_[_0x5ab0('0x28')](_0x39d000,function(_0x2426f1){if(_0x2426f1['type']!==_0x5ab0('0x3e')){var _0x130f93={};_0x130f93[_0x2426f1[_0x5ab0('0x25')]]={'$like':'%'+_0x5e0b03[_0x5ab0('0x2e')][_0x5ab0('0x3b')]+'%'};return _0x130f93;}})});}_0x458c9b=_[_0x5ab0('0x3d')]({},_0x458c9b,_0x5e0b03[_0x5ab0('0x3f')]);var _0x53d218={'where':_0x458c9b[_0x5ab0('0x3c')]};return db[_0x5ab0('0x40')][_0x5ab0('0x1d')](_0x53d218)[_0x5ab0('0x21')](function(_0x5372d5){_0x94fa1[_0x5ab0('0x1d')]=_0x5372d5;if(_0x5e0b03[_0x5ab0('0x2e')][_0x5ab0('0x41')]){_0x458c9b[_0x5ab0('0x42')]=[{'all':!![]}];}return db['UserProfileSection'][_0x5ab0('0x43')](_0x458c9b);})['then'](function(_0x4e8b2a){_0x94fa1['rows']=_0x4e8b2a;return _0x94fa1;})[_0x5ab0('0x21')](respondWithFilteredResult(_0x29b146,_0x458c9b))[_0x5ab0('0x44')](handleError(_0x29b146,null));};exports['show']=function(_0x306e86,_0xeb9624){var _0x17e115={'raw':![],'where':{'id':_0x306e86[_0x5ab0('0x45')]['id']}},_0x2e54c4={};_0x2e54c4[_0x5ab0('0x2d')]=_[_0x5ab0('0x46')](db[_0x5ab0('0x40')][_0x5ab0('0x29')]);_0x2e54c4[_0x5ab0('0x2e')]=_[_0x5ab0('0x46')](_0x306e86[_0x5ab0('0x2e')]);_0x2e54c4[_0x5ab0('0x2f')]=_[_0x5ab0('0x30')](_0x2e54c4[_0x5ab0('0x2d')],_0x2e54c4['query']);_0x17e115[_0x5ab0('0x31')]=_[_0x5ab0('0x30')](_0x2e54c4[_0x5ab0('0x2d')],qs[_0x5ab0('0x32')](_0x306e86[_0x5ab0('0x2e')][_0x5ab0('0x32')]));_0x17e115[_0x5ab0('0x31')]=_0x17e115[_0x5ab0('0x31')]['length']?_0x17e115[_0x5ab0('0x31')]:_0x2e54c4[_0x5ab0('0x2d')];if(_0x306e86[_0x5ab0('0x2e')]['includeAll']){_0x17e115[_0x5ab0('0x42')]=[{'all':!![]}];}_0x17e115=_['merge']({},_0x17e115,_0x306e86[_0x5ab0('0x3f')]);return db[_0x5ab0('0x40')][_0x5ab0('0x47')](_0x17e115)[_0x5ab0('0x21')](handleEntityNotFound(_0xeb9624,null))['then'](respondWithResult(_0xeb9624,null))[_0x5ab0('0x44')](handleError(_0xeb9624,null));};exports['create']=function(_0x27add1,_0x3c5de2){return db[_0x5ab0('0x40')][_0x5ab0('0x48')](_0x27add1['body'],{})['then'](respondWithResult(_0x3c5de2,0xc9))[_0x5ab0('0x44')](handleError(_0x3c5de2,null));};exports[_0x5ab0('0x49')]=function(_0xa617ca,_0x2dd043){if(_0xa617ca[_0x5ab0('0x4a')]['id']){delete _0xa617ca[_0x5ab0('0x4a')]['id'];}return db[_0x5ab0('0x40')][_0x5ab0('0x47')]({'where':{'id':_0xa617ca[_0x5ab0('0x45')]['id']}})[_0x5ab0('0x21')](handleEntityNotFound(_0x2dd043,null))['then'](saveUpdates(_0xa617ca['body'],null))['then'](respondWithResult(_0x2dd043,null))[_0x5ab0('0x44')](handleError(_0x2dd043,null));};exports[_0x5ab0('0x22')]=function(_0x1dc63d,_0x3771b6){return db[_0x5ab0('0x40')][_0x5ab0('0x47')]({'where':{'id':_0x1dc63d['params']['id']}})[_0x5ab0('0x21')](handleEntityNotFound(_0x3771b6,null))['then'](removeEntity(_0x3771b6,null))[_0x5ab0('0x44')](handleError(_0x3771b6,null));};exports[_0x5ab0('0x4b')]=function(_0xf6bdc3,_0x57cc7d){return db[_0x5ab0('0x40')][_0x5ab0('0x4b')]()[_0x5ab0('0x21')](respondWithResult(_0x57cc7d,null))[_0x5ab0('0x44')](handleError(_0x57cc7d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 72c1408..7f70b10 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 _0x7530=['user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger','moment','bluebird','rimraf','UserProfileSection'];(function(_0x107836,_0x255ebc){var _0x6946d2=function(_0x220ab6){while(--_0x220ab6){_0x107836['push'](_0x107836['shift']());}};_0x6946d2(++_0x255ebc);}(_0x7530,0x162));var _0x0753=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0x7530[_0x1ee62e];return _0x27c6c8;};'use strict';var _=require('lodash');var util=require(_0x0753('0x0'));var logger=require(_0x0753('0x1'))('api');var moment=require(_0x0753('0x2'));var BPromise=require(_0x0753('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0753('0x4'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x21e6f5,_0x5a724e){return _0x21e6f5['define'](_0x0753('0x5'),attributes,{'tableName':_0x0753('0x6'),'paranoid':![],'indexes':[{'name':_0x0753('0x7'),'fields':[_0x0753('0x8'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1da9=['moment','bluebird','request-promise','rimraf','../../config/environment','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api'];(function(_0x48912a,_0x3466bd){var _0x360c2c=function(_0x4759f9){while(--_0x4759f9){_0x48912a['push'](_0x48912a['shift']());}};_0x360c2c(++_0x3466bd);}(_0x1da9,0xea));var _0x91da=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1da9[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x91da('0x0'));var util=require(_0x91da('0x1'));var logger=require(_0x91da('0x2'))(_0x91da('0x3'));var moment=require(_0x91da('0x4'));var BPromise=require(_0x91da('0x5'));var rp=require(_0x91da('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91da('0x7'));var config=require(_0x91da('0x8'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x3fad9d,_0x1571c3){return _0x3fad9d['define'](_0x91da('0x9'),attributes,{'tableName':_0x91da('0xa'),'paranoid':![],'indexes':[{'name':_0x91da('0xb'),'fields':[_0x91da('0xc'),_0x91da('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e182afa..f86efc0 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 _0x6c5b=['client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xdc5a81,_0xcfb8c3){var _0x96ec2=function(_0x2e38b8){while(--_0x2e38b8){_0xdc5a81['push'](_0xdc5a81['shift']());}};_0x96ec2(++_0xcfb8c3);}(_0x6c5b,0x1c4));var _0xb6c5=function(_0xe85064,_0x274bc3){_0xe85064=_0xe85064-0x0;var _0x43428e=_0x6c5b[_0xe85064];return _0x43428e;};'use strict';var _=require(_0xb6c5('0x0'));var util=require(_0xb6c5('0x1'));var moment=require(_0xb6c5('0x2'));var BPromise=require(_0xb6c5('0x3'));var rs=require(_0xb6c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6c5('0x5'))['db'];var utils=require(_0xb6c5('0x6'));var logger=require(_0xb6c5('0x7'))(_0xb6c5('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6c5('0x9'));var client=jayson[_0xb6c5('0xa')][_0xb6c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x131413,_0x4d6ef7,_0x35bbea){return new BPromise(function(_0x27fab3,_0x4ce0a3){return client[_0xb6c5('0xc')](_0x131413,_0x35bbea)['then'](function(_0x1f638f){logger[_0xb6c5('0xd')](_0xb6c5('0xe'),_0x4d6ef7,_0xb6c5('0xf'));logger['debug'](_0xb6c5('0x10'),_0x4d6ef7,_0xb6c5('0xf'),JSON['stringify'](_0x1f638f));if(_0x1f638f['error']){if(_0x1f638f[_0xb6c5('0x11')][_0xb6c5('0x12')]===0x1f4){logger[_0xb6c5('0x11')](_0xb6c5('0xe'),_0x4d6ef7,_0x1f638f[_0xb6c5('0x11')][_0xb6c5('0x13')]);return _0x4ce0a3(_0x1f638f[_0xb6c5('0x11')][_0xb6c5('0x13')]);}logger[_0xb6c5('0x11')](_0xb6c5('0xe'),_0x4d6ef7,_0x1f638f['error']['message']);return _0x27fab3(_0x1f638f[_0xb6c5('0x11')][_0xb6c5('0x13')]);}else{logger['info'](_0xb6c5('0xe'),_0x4d6ef7,_0xb6c5('0xf'));_0x27fab3(_0x1f638f['result'][_0xb6c5('0x13')]);}})[_0xb6c5('0x14')](function(_0x4a0501){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4d6ef7,_0x4a0501);_0x4ce0a3(_0x4a0501);});});} \ No newline at end of file +var _0xf078=['request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3d4a6b,_0x20dbcb){var _0x55d64a=function(_0x220a50){while(--_0x220a50){_0x3d4a6b['push'](_0x3d4a6b['shift']());}};_0x55d64a(++_0x20dbcb);}(_0xf078,0xda));var _0x8f07=function(_0x2fec29,_0x151f71){_0x2fec29=_0x2fec29-0x0;var _0x35c66a=_0xf078[_0x2fec29];return _0x35c66a;};'use strict';var _=require(_0x8f07('0x0'));var util=require('util');var moment=require(_0x8f07('0x1'));var BPromise=require(_0x8f07('0x2'));var rs=require(_0x8f07('0x3'));var fs=require('fs');var Redis=require(_0x8f07('0x4'));var db=require(_0x8f07('0x5'))['db'];var utils=require(_0x8f07('0x6'));var logger=require(_0x8f07('0x7'))(_0x8f07('0x8'));var config=require(_0x8f07('0x9'));var jayson=require(_0x8f07('0xa'));var client=jayson[_0x8f07('0xb')][_0x8f07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x322237,_0x484cc4,_0x2e367f){return new BPromise(function(_0x54d72f,_0x5835d3){return client[_0x8f07('0xd')](_0x322237,_0x2e367f)[_0x8f07('0xe')](function(_0x62c740){logger[_0x8f07('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x484cc4,_0x8f07('0x10'));logger[_0x8f07('0x11')](_0x8f07('0x12'),_0x484cc4,_0x8f07('0x10'),JSON[_0x8f07('0x13')](_0x62c740));if(_0x62c740[_0x8f07('0x14')]){if(_0x62c740[_0x8f07('0x14')][_0x8f07('0x15')]===0x1f4){logger[_0x8f07('0x14')](_0x8f07('0x16'),_0x484cc4,_0x62c740[_0x8f07('0x14')][_0x8f07('0x17')]);return _0x5835d3(_0x62c740['error']['message']);}logger['error'](_0x8f07('0x16'),_0x484cc4,_0x62c740[_0x8f07('0x14')][_0x8f07('0x17')]);return _0x54d72f(_0x62c740['error'][_0x8f07('0x17')]);}else{logger[_0x8f07('0xf')](_0x8f07('0x16'),_0x484cc4,'request\x20sent');_0x54d72f(_0x62c740[_0x8f07('0x18')][_0x8f07('0x17')]);}})[_0x8f07('0x19')](function(_0x145dc8){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x484cc4,_0x145dc8);_0x5835d3(_0x145dc8);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9138b3c..a31c5e1 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 _0x76c1=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x76c1,0x75));var _0x176c=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x76c1[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require(_0x176c('0x0'));var util=require(_0x176c('0x1'));var path=require(_0x176c('0x2'));var timeout=require('connect-timeout');var express=require(_0x176c('0x3'));var router=express[_0x176c('0x4')]();var auth=require(_0x176c('0x5'));var interaction=require(_0x176c('0x6'));var config=require(_0x176c('0x7'));module[_0x176c('0x8')]=router; \ No newline at end of file +var _0xcb0f=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','exports','util'];(function(_0x735da9,_0x38b186){var _0x39160b=function(_0x5cb870){while(--_0x5cb870){_0x735da9['push'](_0x735da9['shift']());}};_0x39160b(++_0x38b186);}(_0xcb0f,0x1d9));var _0xfcb0=function(_0x1e7634,_0x37d8e2){_0x1e7634=_0x1e7634-0x0;var _0x50a829=_0xcb0f[_0x1e7634];return _0x50a829;};'use strict';var multer=require('multer');var util=require(_0xfcb0('0x0'));var path=require('path');var timeout=require(_0xfcb0('0x1'));var express=require('express');var router=express[_0xfcb0('0x2')]();var auth=require(_0xfcb0('0x3'));var interaction=require(_0xfcb0('0x4'));var config=require('../../config/environment');module[_0xfcb0('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7a145b6..6dc8228 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x46b14d,_0x2129e2){var _0x1df69e=function(_0x512661){while(--_0x512661){_0x46b14d['push'](_0x46b14d['shift']());}};_0x1df69e(++_0x2129e2);}(_0xe706,0xa3));var _0x6e70=function(_0x3f47bd,_0xa1b88c){_0x3f47bd=_0x3f47bd-0x0;var _0x133064=_0xe706[_0x3f47bd];return _0x133064;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x4e5421,_0x2f0eca){var _0x277430=function(_0x449164){while(--_0x449164){_0x4e5421['push'](_0x4e5421['shift']());}};_0x277430(++_0x2f0eca);}(_0xb10b,0x12a));var _0xbb10=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xb10b[_0x58547b];return _0x1d3fd2;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index cd69757..11767c8 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 _0x2ec8=['bluebird','rimraf','./userSmsQueue.attributes','exports','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x2ec8,0x188));var _0x82ec=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2ec8[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x82ec('0x0'));var util=require(_0x82ec('0x1'));var logger=require(_0x82ec('0x2'))(_0x82ec('0x3'));var moment=require('moment');var BPromise=require(_0x82ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x82ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x82ec('0x6'));module[_0x82ec('0x7')]=function(_0x528e26,_0x4c9400){return _0x528e26['define']('UserSmsQueue',attributes,{'tableName':_0x82ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb945=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','moment'];(function(_0x4ba999,_0xe41814){var _0x2e226d=function(_0x4a93b4){while(--_0x4a93b4){_0x4ba999['push'](_0x4ba999['shift']());}};_0x2e226d(++_0xe41814);}(_0xb945,0x97));var _0x5b94=function(_0x3c2d1f,_0x404906){_0x3c2d1f=_0x3c2d1f-0x0;var _0x412a38=_0xb945[_0x3c2d1f];return _0x412a38;};'use strict';var _=require(_0x5b94('0x0'));var util=require('util');var logger=require(_0x5b94('0x1'))('api');var moment=require(_0x5b94('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b94('0x3'));var rimraf=require(_0x5b94('0x4'));var config=require(_0x5b94('0x5'));var attributes=require(_0x5b94('0x6'));module[_0x5b94('0x7')]=function(_0x4bef06,_0x492388){return _0x4bef06[_0x5b94('0x8')](_0x5b94('0x9'),attributes,{'tableName':_0x5b94('0xa'),'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 0cc5b8b..54e8185 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 _0x7fe4=['debug','stringify','error','code','message','result','catch','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4e1219,_0x4f88ac){var _0x5b2e94=function(_0x31bdd7){while(--_0x31bdd7){_0x4e1219['push'](_0x4e1219['shift']());}};_0x5b2e94(++_0x4f88ac);}(_0x7fe4,0x14a));var _0x47fe=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7fe4[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47fe('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0x47fe('0x1'));var logger=require('../../config/logger')(_0x47fe('0x2'));var config=require(_0x47fe('0x3'));var jayson=require(_0x47fe('0x4'));var client=jayson[_0x47fe('0x5')][_0x47fe('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x433448,_0x132a97,_0x288e4d){return new BPromise(function(_0xe923b5,_0x3b3301){return client[_0x47fe('0x7')](_0x433448,_0x288e4d)[_0x47fe('0x8')](function(_0x33af69){logger[_0x47fe('0x9')](_0x47fe('0xa'),_0x132a97,_0x47fe('0xb'));logger[_0x47fe('0xc')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x132a97,_0x47fe('0xb'),JSON[_0x47fe('0xd')](_0x33af69));if(_0x33af69[_0x47fe('0xe')]){if(_0x33af69[_0x47fe('0xe')][_0x47fe('0xf')]===0x1f4){logger[_0x47fe('0xe')](_0x47fe('0xa'),_0x132a97,_0x33af69[_0x47fe('0xe')][_0x47fe('0x10')]);return _0x3b3301(_0x33af69[_0x47fe('0xe')][_0x47fe('0x10')]);}logger[_0x47fe('0xe')](_0x47fe('0xa'),_0x132a97,_0x33af69[_0x47fe('0xe')][_0x47fe('0x10')]);return _0xe923b5(_0x33af69[_0x47fe('0xe')][_0x47fe('0x10')]);}else{logger[_0x47fe('0x9')](_0x47fe('0xa'),_0x132a97,_0x47fe('0xb'));_0xe923b5(_0x33af69[_0x47fe('0x11')][_0x47fe('0x10')]);}})[_0x47fe('0x12')](function(_0x30cbd0){logger[_0x47fe('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x132a97,_0x30cbd0);_0x3b3301(_0x30cbd0);});});} \ No newline at end of file +var _0x2a0c=['debug','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2a0c,0x64));var _0xc2a0=function(_0x19be12,_0x53c296){_0x19be12=_0x19be12-0x0;var _0x2b41db=_0x2a0c[_0x19be12];return _0x2b41db;};'use strict';var _=require('lodash');var util=require(_0xc2a0('0x0'));var moment=require(_0xc2a0('0x1'));var BPromise=require(_0xc2a0('0x2'));var rs=require(_0xc2a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2a0('0x4'))['db'];var utils=require(_0xc2a0('0x5'));var logger=require(_0xc2a0('0x6'))(_0xc2a0('0x7'));var config=require(_0xc2a0('0x8'));var jayson=require(_0xc2a0('0x9'));var client=jayson['client'][_0xc2a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14444f,_0x5f05ab,_0x115070){return new BPromise(function(_0xb594d2,_0x204f6f){return client[_0xc2a0('0xb')](_0x14444f,_0x115070)[_0xc2a0('0xc')](function(_0x79288d){logger[_0xc2a0('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x5f05ab,_0xc2a0('0xe'));logger[_0xc2a0('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x5f05ab,_0xc2a0('0xe'),JSON[_0xc2a0('0x10')](_0x79288d));if(_0x79288d[_0xc2a0('0x11')]){if(_0x79288d[_0xc2a0('0x11')][_0xc2a0('0x12')]===0x1f4){logger[_0xc2a0('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x5f05ab,_0x79288d[_0xc2a0('0x11')][_0xc2a0('0x13')]);return _0x204f6f(_0x79288d[_0xc2a0('0x11')]['message']);}logger['error'](_0xc2a0('0x14'),_0x5f05ab,_0x79288d[_0xc2a0('0x11')][_0xc2a0('0x13')]);return _0xb594d2(_0x79288d['error'][_0xc2a0('0x13')]);}else{logger[_0xc2a0('0xd')](_0xc2a0('0x14'),_0x5f05ab,'request\x20sent');_0xb594d2(_0x79288d[_0xc2a0('0x15')][_0xc2a0('0x13')]);}})[_0xc2a0('0x16')](function(_0x56a925){logger[_0xc2a0('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x5f05ab,_0x56a925);_0x204f6f(_0x56a925);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 7cc7bb9..f526c75 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 _0x5e61=['path','connect-timeout','express','../../components/auth/service','../../config/environment','exports'];(function(_0x53633a,_0x466e14){var _0x5f4d14=function(_0x4ae6d6){while(--_0x4ae6d6){_0x53633a['push'](_0x53633a['shift']());}};_0x5f4d14(++_0x466e14);}(_0x5e61,0x84));var _0x15e6=function(_0x4aa3fa,_0x2e0d9c){_0x4aa3fa=_0x4aa3fa-0x0;var _0x3b4988=_0x5e61[_0x4aa3fa];return _0x3b4988;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x15e6('0x0'));var timeout=require(_0x15e6('0x1'));var express=require(_0x15e6('0x2'));var router=express['Router']();var auth=require(_0x15e6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x15e6('0x4'));module[_0x15e6('0x5')]=router; \ No newline at end of file +var _0xa861=['../../config/environment','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1a2ee0,_0x23814f){var _0x5172c1=function(_0x4dbd66){while(--_0x4dbd66){_0x1a2ee0['push'](_0x1a2ee0['shift']());}};_0x5172c1(++_0x23814f);}(_0xa861,0x1c4));var _0x1a86=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xa861[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0x1a86('0x0'));var util=require(_0x1a86('0x1'));var path=require(_0x1a86('0x2'));var timeout=require('connect-timeout');var express=require(_0x1a86('0x3'));var router=express[_0x1a86('0x4')]();var auth=require(_0x1a86('0x5'));var interaction=require(_0x1a86('0x6'));var config=require(_0x1a86('0x7'));module[_0x1a86('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index a56c8d4..6d8bfe3 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x358145,_0x49a096){var _0x36a7ac=function(_0x5ca63e){while(--_0x5ca63e){_0x358145['push'](_0x358145['shift']());}};_0x36a7ac(++_0x49a096);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x138b2c,_0x142181){var _0xa8b921=function(_0xc1799e){while(--_0xc1799e){_0x138b2c['push'](_0x138b2c['shift']());}};_0xa8b921(++_0x142181);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 06e1634..9492092 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 _0x89f2=['UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x89f2,0xf9));var _0x289f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x89f2[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x289f('0x0'));var util=require(_0x289f('0x1'));var logger=require('../../config/logger')(_0x289f('0x2'));var moment=require(_0x289f('0x3'));var BPromise=require(_0x289f('0x4'));var rp=require(_0x289f('0x5'));var fs=require('fs');var path=require(_0x289f('0x6'));var rimraf=require(_0x289f('0x7'));var config=require('../../config/environment');var attributes=require(_0x289f('0x8'));module[_0x289f('0x9')]=function(_0x1b3c10,_0x207dea){return _0x1b3c10[_0x289f('0xa')](_0x289f('0xb'),attributes,{'tableName':_0x289f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb751=['exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x4c8d2a,_0x5416b0){var _0x1034d6=function(_0x110d19){while(--_0x110d19){_0x4c8d2a['push'](_0x4c8d2a['shift']());}};_0x1034d6(++_0x5416b0);}(_0xb751,0x1d8));var _0x1b75=function(_0x3afe68,_0x40add6){_0x3afe68=_0x3afe68-0x0;var _0x5bf75e=_0xb751[_0x3afe68];return _0x5bf75e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b75('0x0'))(_0x1b75('0x1'));var moment=require('moment');var BPromise=require(_0x1b75('0x2'));var rp=require(_0x1b75('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b75('0x4'));var attributes=require('./userVoiceQueue.attributes');module[_0x1b75('0x5')]=function(_0x45a962,_0x51aa01){return _0x45a962[_0x1b75('0x6')](_0x1b75('0x7'),attributes,{'tableName':_0x1b75('0x8'),'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 bed7ac1..f566016 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 _0x961b=['message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x341a13,_0x35a03d){var _0x58a08a=function(_0x427523){while(--_0x427523){_0x341a13['push'](_0x341a13['shift']());}};_0x58a08a(++_0x35a03d);}(_0x961b,0x115));var _0xb961=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x961b[_0x541ea6];return _0x3c3e84;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb961('0x0'));var rs=require(_0xb961('0x1'));var fs=require('fs');var Redis=require(_0xb961('0x2'));var db=require(_0xb961('0x3'))['db'];var utils=require(_0xb961('0x4'));var logger=require('../../config/logger')(_0xb961('0x5'));var config=require('../../config/environment');var jayson=require(_0xb961('0x6'));var client=jayson[_0xb961('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5961db,_0x2729a3,_0x261467){return new BPromise(function(_0x5d2b1d,_0x1f170c){return client[_0xb961('0x8')](_0x5961db,_0x261467)[_0xb961('0x9')](function(_0xc224b4){logger['info'](_0xb961('0xa'),_0x2729a3,_0xb961('0xb'));logger[_0xb961('0xc')](_0xb961('0xd'),_0x2729a3,_0xb961('0xb'),JSON[_0xb961('0xe')](_0xc224b4));if(_0xc224b4[_0xb961('0xf')]){if(_0xc224b4[_0xb961('0xf')][_0xb961('0x10')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2729a3,_0xc224b4[_0xb961('0xf')][_0xb961('0x11')]);return _0x1f170c(_0xc224b4[_0xb961('0xf')]['message']);}logger[_0xb961('0xf')](_0xb961('0xa'),_0x2729a3,_0xc224b4['error'][_0xb961('0x11')]);return _0x5d2b1d(_0xc224b4['error'][_0xb961('0x11')]);}else{logger[_0xb961('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x2729a3,'request\x20sent');_0x5d2b1d(_0xc224b4[_0xb961('0x13')][_0xb961('0x11')]);}})[_0xb961('0x14')](function(_0x140cf4){logger[_0xb961('0xf')](_0xb961('0xa'),_0x2729a3,_0x140cf4);_0x1f170c(_0x140cf4);});});} \ No newline at end of file +var _0x52f4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xcc9dee,_0x1e7aaf){var _0x2123ba=function(_0x640a70){while(--_0x640a70){_0xcc9dee['push'](_0xcc9dee['shift']());}};_0x2123ba(++_0x1e7aaf);}(_0x52f4,0x69));var _0x452f=function(_0x3c3793,_0x50e7fd){_0x3c3793=_0x3c3793-0x0;var _0x3e7872=_0x52f4[_0x3c3793];return _0x3e7872;};'use strict';var _=require(_0x452f('0x0'));var util=require('util');var moment=require(_0x452f('0x1'));var BPromise=require(_0x452f('0x2'));var rs=require(_0x452f('0x3'));var fs=require('fs');var Redis=require(_0x452f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x452f('0x5'));var logger=require(_0x452f('0x6'))(_0x452f('0x7'));var config=require(_0x452f('0x8'));var jayson=require(_0x452f('0x9'));var client=jayson[_0x452f('0xa')][_0x452f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e82fe,_0x2593e4,_0x1654ce){return new BPromise(function(_0x516c77,_0x3eaa90){return client[_0x452f('0xc')](_0x3e82fe,_0x1654ce)[_0x452f('0xd')](function(_0x336f3f){logger[_0x452f('0xe')](_0x452f('0xf'),_0x2593e4,_0x452f('0x10'));logger['debug'](_0x452f('0x11'),_0x2593e4,_0x452f('0x10'),JSON['stringify'](_0x336f3f));if(_0x336f3f['error']){if(_0x336f3f['error'][_0x452f('0x12')]===0x1f4){logger['error'](_0x452f('0xf'),_0x2593e4,_0x336f3f['error']['message']);return _0x3eaa90(_0x336f3f[_0x452f('0x13')]['message']);}logger[_0x452f('0x13')](_0x452f('0xf'),_0x2593e4,_0x336f3f[_0x452f('0x13')][_0x452f('0x14')]);return _0x516c77(_0x336f3f[_0x452f('0x13')][_0x452f('0x14')]);}else{logger[_0x452f('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x2593e4,_0x452f('0x10'));_0x516c77(_0x336f3f[_0x452f('0x15')][_0x452f('0x14')]);}})['catch'](function(_0x3f096d){logger[_0x452f('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x2593e4,_0x3f096d);_0x3eaa90(_0x3f096d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 1f1e19c..310eb4d 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 _0xaee6=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xaee6,0x187));var _0x6aee=function(_0x1010b0,_0x2c6b0d){_0x1010b0=_0x1010b0-0x0;var _0x29a1d8=_0xaee6[_0x1010b0];return _0x29a1d8;};'use strict';var multer=require(_0x6aee('0x0'));var util=require(_0x6aee('0x1'));var path=require(_0x6aee('0x2'));var timeout=require(_0x6aee('0x3'));var express=require(_0x6aee('0x4'));var router=express[_0x6aee('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6aee('0x6'));var config=require(_0x6aee('0x7'));module[_0x6aee('0x8')]=router; \ No newline at end of file +var _0x1e81=['../../components/auth/service','exports','util','path','express','Router'];(function(_0x2daad9,_0x35277d){var _0x524553=function(_0xb99dc2){while(--_0xb99dc2){_0x2daad9['push'](_0x2daad9['shift']());}};_0x524553(++_0x35277d);}(_0x1e81,0x16a));var _0x11e8=function(_0x5425f3,_0x579060){_0x5425f3=_0x5425f3-0x0;var _0x2293fc=_0x1e81[_0x5425f3];return _0x2293fc;};'use strict';var multer=require('multer');var util=require(_0x11e8('0x0'));var path=require(_0x11e8('0x1'));var timeout=require('connect-timeout');var express=require(_0x11e8('0x2'));var router=express[_0x11e8('0x3')]();var auth=require(_0x11e8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x11e8('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 03dc7a3..74a18f5 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 _0xd2f5=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x20398a,_0x897b80){var _0x349ba9=function(_0x5e696a){while(--_0x5e696a){_0x20398a['push'](_0x20398a['shift']());}};_0x349ba9(++_0x897b80);}(_0xd2f5,0xbf));var _0x5d2f=function(_0x1232a9,_0xd60081){_0x1232a9=_0x1232a9-0x0;var _0x3fb7e1=_0xd2f5[_0x1232a9];return _0x3fb7e1;};'use strict';var Sequelize=require(_0x5d2f('0x0'));module[_0x5d2f('0x1')]={'uniqueid':{'type':Sequelize[_0x5d2f('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5d2f('0x3')},'membername':{'type':Sequelize[_0x5d2f('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x5d2f('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5d2f('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5d2f('0x5'),'comment':_0x5d2f('0x3')},'penalty':{'type':Sequelize[_0x5d2f('0x2')](0xb),'defaultValue':0x0,'comment':_0x5d2f('0x3')},'paused':{'type':Sequelize[_0x5d2f('0x2')](0xb),'defaultValue':0x0,'comment':_0x5d2f('0x3')}}; \ No newline at end of file +var _0x7eb0=['STRING','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x7eb0,0x155));var _0x07eb=function(_0x3e382d,_0x28224d){_0x3e382d=_0x3e382d-0x0;var _0x21cf3e=_0x7eb0[_0x3e382d];return _0x21cf3e;};'use strict';var Sequelize=require(_0x07eb('0x0'));module[_0x07eb('0x1')]={'uniqueid':{'type':Sequelize[_0x07eb('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x07eb('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x07eb('0x3')},'UserId':{'type':Sequelize[_0x07eb('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x07eb('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x07eb('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x07eb('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x07eb('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x07eb('0x3')},'paused':{'type':Sequelize[_0x07eb('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 86d421c..aaa7f7c 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 _0x21ab=['events','setMaxListeners','save','update','remove','emit','exports'];(function(_0x4b259b,_0x24da46){var _0x541c44=function(_0x1b6508){while(--_0x1b6508){_0x4b259b['push'](_0x4b259b['shift']());}};_0x541c44(++_0x24da46);}(_0x21ab,0x173));var _0xb21a=function(_0x54faff,_0x9a3b5e){_0x54faff=_0x54faff-0x0;var _0x5a784c=_0x21ab[_0x54faff];return _0x5a784c;};'use strict';var EventEmitter=require(_0xb21a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb21a('0x1')](0x0);var events={'afterCreate':_0xb21a('0x2'),'afterUpdate':_0xb21a('0x3'),'afterDestroy':_0xb21a('0x4')};function emitEvent(_0x25b75c){return function(_0x52e1fa,_0x524615,_0x5a36ef){UserVoiceQueueRtEvents[_0xb21a('0x5')](_0x25b75c+':'+_0x52e1fa['id'],_0x52e1fa);UserVoiceQueueRtEvents[_0xb21a('0x5')](_0x25b75c,_0x52e1fa);_0x5a36ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb21a('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd6e6=['update','remove','emit','hook','events','UserVoiceQueueRt','setMaxListeners','save'];(function(_0xaa97cd,_0x4543f4){var _0x248972=function(_0x79e00a){while(--_0x79e00a){_0xaa97cd['push'](_0xaa97cd['shift']());}};_0x248972(++_0x4543f4);}(_0xd6e6,0xcc));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x6d6e('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x6d6e('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6d6e('0x2')](0x0);var events={'afterCreate':_0x6d6e('0x3'),'afterUpdate':_0x6d6e('0x4'),'afterDestroy':_0x6d6e('0x5')};function emitEvent(_0x32e471){return function(_0x459307,_0x572643,_0x435bb7){UserVoiceQueueRtEvents[_0x6d6e('0x6')](_0x32e471+':'+_0x459307['id'],_0x459307);UserVoiceQueueRtEvents[_0x6d6e('0x6')](_0x32e471,_0x459307);_0x435bb7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x6d6e('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index e8ab1cc..a9400ee 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 _0x4e77=['exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x126229,_0x4215ad){var _0x2c4b48=function(_0x5b15ae){while(--_0x5b15ae){_0x126229['push'](_0x126229['shift']());}};_0x2c4b48(++_0x4215ad);}(_0x4e77,0x177));var _0x74e7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4e77[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x74e7('0x0'));var util=require(_0x74e7('0x1'));var logger=require(_0x74e7('0x2'))('api');var moment=require(_0x74e7('0x3'));var BPromise=require('bluebird');var rp=require(_0x74e7('0x4'));var fs=require('fs');var path=require(_0x74e7('0x5'));var rimraf=require(_0x74e7('0x6'));var config=require(_0x74e7('0x7'));var attributes=require(_0x74e7('0x8'));module[_0x74e7('0x9')]=function(_0x1efed8,_0x5648ae){return _0x1efed8[_0x74e7('0xa')](_0x74e7('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcd3=['UserVoiceQueueRt','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x121408,_0x584344){var _0x3d5573=function(_0x41a00a){while(--_0x41a00a){_0x121408['push'](_0x121408['shift']());}};_0x3d5573(++_0x584344);}(_0xdcd3,0x105));var _0x3dcd=function(_0x30c30c,_0x35466c){_0x30c30c=_0x30c30c-0x0;var _0x2c9a91=_0xdcd3[_0x30c30c];return _0x2c9a91;};'use strict';var _=require(_0x3dcd('0x0'));var util=require(_0x3dcd('0x1'));var logger=require(_0x3dcd('0x2'))(_0x3dcd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3dcd('0x4'));var fs=require('fs');var path=require(_0x3dcd('0x5'));var rimraf=require(_0x3dcd('0x6'));var config=require(_0x3dcd('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x3dcd('0x8')]=function(_0x28f0b4,_0x4c0650){return _0x28f0b4['define'](_0x3dcd('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index e1d6d05..b6575ce 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 _0xd0c1=['options','where','sequelize','COUNT','literal','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','findAll'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xd0c1,0xab));var _0x1d0c=function(_0x47d295,_0x53014d){_0x47d295=_0x47d295-0x0;var _0x503761=_0xd0c1[_0x47d295];return _0x503761;};'use strict';var _=require(_0x1d0c('0x0'));var util=require(_0x1d0c('0x1'));var moment=require(_0x1d0c('0x2'));var BPromise=require(_0x1d0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d0c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d0c('0x5'))(_0x1d0c('0x6'));var config=require(_0x1d0c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d0c('0x8')][_0x1d0c('0x9')]({'port':0x232a});config[_0x1d0c('0xa')]=_[_0x1d0c('0xb')](config['redis'],{'host':_0x1d0c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1d0c('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a39b2,_0x5a1656,_0x1a4068){return new BPromise(function(_0x298ea9,_0x5a789d){return client[_0x1d0c('0xe')](_0x5a39b2,_0x1a4068)[_0x1d0c('0xf')](function(_0x1e893d){logger[_0x1d0c('0x10')](_0x1d0c('0x11'),_0x5a1656,_0x1d0c('0x12'));logger['debug'](_0x1d0c('0x13'),_0x5a1656,'request\x20sent',JSON[_0x1d0c('0x14')](_0x1e893d));if(_0x1e893d['error']){if(_0x1e893d['error']['code']===0x1f4){logger[_0x1d0c('0x15')](_0x1d0c('0x11'),_0x5a1656,_0x1e893d[_0x1d0c('0x15')][_0x1d0c('0x16')]);return _0x5a789d(_0x1e893d['error'][_0x1d0c('0x16')]);}logger[_0x1d0c('0x15')](_0x1d0c('0x11'),_0x5a1656,_0x1e893d['error'][_0x1d0c('0x16')]);return _0x298ea9(_0x1e893d[_0x1d0c('0x15')][_0x1d0c('0x16')]);}else{logger[_0x1d0c('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5a1656,'request\x20sent');_0x298ea9(_0x1e893d[_0x1d0c('0x17')][_0x1d0c('0x16')]);}})[_0x1d0c('0x18')](function(_0x1ec483){logger[_0x1d0c('0x15')](_0x1d0c('0x11'),_0x5a1656,_0x1ec483);_0x5a789d(_0x1ec483);});});}exports[_0x1d0c('0x19')]=function(_0x40fb3e){var _0x359b37=this;return new Promise(function(_0x900f9c,_0x52c4e4){return db['UserVoiceQueueRt'][_0x1d0c('0x1a')]({'raw':_0x40fb3e[_0x1d0c('0x1b')]?_0x40fb3e[_0x1d0c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x40fb3e[_0x1d0c('0x1b')]?_0x40fb3e[_0x1d0c('0x1b')][_0x1d0c('0x1c')]||null:null,'attributes':[[db[_0x1d0c('0x1d')]['fn'](_0x1d0c('0x1e'),db['sequelize']['fn']('IF',db[_0x1d0c('0x1d')][_0x1d0c('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x1d0c('0xf')](function(_0x1c3276){logger['info'](_0x1d0c('0x19'),_0x40fb3e);logger[_0x1d0c('0x20')](_0x1d0c('0x19'),_0x40fb3e,JSON[_0x1d0c('0x14')](_0x1c3276));_0x900f9c(_0x1c3276);})[_0x1d0c('0x18')](function(_0x26d597){logger[_0x1d0c('0x15')](_0x1d0c('0x19'),_0x26d597[_0x1d0c('0x16')],_0x40fb3e);_0x52c4e4(_0x359b37[_0x1d0c('0x15')](0x1f4,_0x26d597[_0x1d0c('0x16')]));});});}; \ No newline at end of file +var _0xdecb=['then','info','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request'];(function(_0x144626,_0xb87c16){var _0x73c7d9=function(_0x1b5d84){while(--_0x1b5d84){_0x144626['push'](_0x144626['shift']());}};_0x73c7d9(++_0xb87c16);}(_0xdecb,0x134));var _0xbdec=function(_0x5ae313,_0x46d22d){_0x5ae313=_0x5ae313-0x0;var _0x29c112=_0xdecb[_0x5ae313];return _0x29c112;};'use strict';var _=require(_0xbdec('0x0'));var util=require(_0xbdec('0x1'));var moment=require(_0xbdec('0x2'));var BPromise=require(_0xbdec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdec('0x4'));var db=require(_0xbdec('0x5'))['db'];var utils=require(_0xbdec('0x6'));var logger=require(_0xbdec('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbdec('0x8'));var client=jayson[_0xbdec('0x9')][_0xbdec('0xa')]({'port':0x232a});config[_0xbdec('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbdec('0xc'))(new Redis(config[_0xbdec('0xb')]));require(_0xbdec('0xd'))[_0xbdec('0xe')](socket);function respondWithRpcPromise(_0x62e3c1,_0x456ed7,_0x317ae8){return new BPromise(function(_0x362c8c,_0x54dcef){return client[_0xbdec('0xf')](_0x62e3c1,_0x317ae8)[_0xbdec('0x10')](function(_0x40588a){logger[_0xbdec('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x456ed7,'request\x20sent');logger['debug'](_0xbdec('0x12'),_0x456ed7,_0xbdec('0x13'),JSON['stringify'](_0x40588a));if(_0x40588a[_0xbdec('0x14')]){if(_0x40588a['error'][_0xbdec('0x15')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x456ed7,_0x40588a['error']['message']);return _0x54dcef(_0x40588a[_0xbdec('0x14')][_0xbdec('0x16')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x456ed7,_0x40588a['error'][_0xbdec('0x16')]);return _0x362c8c(_0x40588a[_0xbdec('0x14')][_0xbdec('0x16')]);}else{logger['info'](_0xbdec('0x17'),_0x456ed7,_0xbdec('0x13'));_0x362c8c(_0x40588a[_0xbdec('0x18')]['message']);}})[_0xbdec('0x19')](function(_0x5d726e){logger['error'](_0xbdec('0x17'),_0x456ed7,_0x5d726e);_0x54dcef(_0x5d726e);});});}exports[_0xbdec('0x1a')]=function(_0x9c402e){var _0x3defdf=this;return new Promise(function(_0x366884,_0x1721b1){return db[_0xbdec('0x1b')][_0xbdec('0x1c')]({'raw':_0x9c402e[_0xbdec('0x1d')]?_0x9c402e[_0xbdec('0x1d')][_0xbdec('0x1e')]===undefined?!![]:![]:!![],'where':_0x9c402e[_0xbdec('0x1d')]?_0x9c402e['options'][_0xbdec('0x1f')]||null:null,'attributes':[[db[_0xbdec('0x20')]['fn'](_0xbdec('0x21'),db[_0xbdec('0x20')]['fn']('IF',db[_0xbdec('0x20')][_0xbdec('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})['then'](function(_0x3939ac){logger[_0xbdec('0x11')](_0xbdec('0x1a'),_0x9c402e);logger['debug'](_0xbdec('0x1a'),_0x9c402e,JSON[_0xbdec('0x23')](_0x3939ac));_0x366884(_0x3939ac);})[_0xbdec('0x19')](function(_0x7bc676){logger[_0xbdec('0x14')](_0xbdec('0x1a'),_0x7bc676[_0xbdec('0x16')],_0x9c402e);_0x1721b1(_0x3defdf[_0xbdec('0x14')](0x1f4,_0x7bc676[_0xbdec('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 80403be..bddbc7e 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 _0xcbe7=['./userVoiceQueueRt.events','save','remove','update','removeListener','length','userVoiceQueueRt:'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xcbe7,0x1c7));var _0x7cbe=function(_0x3a19cd,_0x57c331){_0x3a19cd=_0x3a19cd-0x0;var _0x372764=_0xcbe7[_0x3a19cd];return _0x372764;};'use strict';var UserVoiceQueueRtEvents=require(_0x7cbe('0x0'));var events=[_0x7cbe('0x1'),_0x7cbe('0x2'),_0x7cbe('0x3')];function createListener(_0x277228,_0x11b7bd){return function(_0x3a3f70){_0x11b7bd['emit'](_0x277228,_0x3a3f70);};}function removeListener(_0x304584,_0x3fa1ca){return function(){UserVoiceQueueRtEvents[_0x7cbe('0x4')](_0x304584,_0x3fa1ca);};}exports['register']=function(_0x3e5cd3){for(var _0x2c20a5=0x0,_0x3b755e=events[_0x7cbe('0x5')];_0x2c20a5<_0x3b755e;_0x2c20a5++){var _0x19baec=events[_0x2c20a5];var _0x5f0ffa=createListener(_0x7cbe('0x6')+_0x19baec,_0x3e5cd3);UserVoiceQueueRtEvents['on'](_0x19baec,_0x5f0ffa);}}; \ No newline at end of file +var _0x66ea=['save','remove','update','emit','register','length','userVoiceQueueRt:'];(function(_0x2df91e,_0x578877){var _0x567737=function(_0x36ae6a){while(--_0x36ae6a){_0x2df91e['push'](_0x2df91e['shift']());}};_0x567737(++_0x578877);}(_0x66ea,0x1dc));var _0xa66e=function(_0x18084e,_0x1556c8){_0x18084e=_0x18084e-0x0;var _0x47905c=_0x66ea[_0x18084e];return _0x47905c;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa66e('0x0'),_0xa66e('0x1'),_0xa66e('0x2')];function createListener(_0x55b438,_0x3c09f1){return function(_0x86438b){_0x3c09f1[_0xa66e('0x3')](_0x55b438,_0x86438b);};}function removeListener(_0x2944e2,_0x10dff0){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2944e2,_0x10dff0);};}exports[_0xa66e('0x4')]=function(_0x30c2ef){for(var _0x9a05e1=0x0,_0x51601d=events[_0xa66e('0x5')];_0x9a05e1<_0x51601d;_0x9a05e1++){var _0x4a8874=events[_0x9a05e1];var _0x30c99c=createListener(_0xa66e('0x6')+_0x4a8874,_0x30c2ef);UserVoiceQueueRtEvents['on'](_0x4a8874,_0x30c99c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d11ddd7..ee74d0a 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 _0xd813=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','exports'];(function(_0x3aee37,_0x4a4dfa){var _0x4e1a6b=function(_0x275238){while(--_0x275238){_0x3aee37['push'](_0x3aee37['shift']());}};_0x4e1a6b(++_0x4a4dfa);}(_0xd813,0x1c8));var _0x3d81=function(_0x58d61e,_0x11153d){_0x58d61e=_0x58d61e-0x0;var _0x54b06b=_0xd813[_0x58d61e];return _0x54b06b;};'use strict';var multer=require(_0x3d81('0x0'));var util=require(_0x3d81('0x1'));var path=require(_0x3d81('0x2'));var timeout=require(_0x3d81('0x3'));var express=require(_0x3d81('0x4'));var router=express['Router']();var auth=require(_0x3d81('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d81('0x6'));module[_0x3d81('0x7')]=router; \ No newline at end of file +var _0xf2c7=['multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x525093,_0x36c946){var _0x3cb674=function(_0x1211c9){while(--_0x1211c9){_0x525093['push'](_0x525093['shift']());}};_0x3cb674(++_0x36c946);}(_0xf2c7,0x168));var _0x7f2c=function(_0x218ca4,_0x41cc40){_0x218ca4=_0x218ca4-0x0;var _0x1b3ff9=_0xf2c7[_0x218ca4];return _0x1b3ff9;};'use strict';var multer=require(_0x7f2c('0x0'));var util=require(_0x7f2c('0x1'));var path=require(_0x7f2c('0x2'));var timeout=require(_0x7f2c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7f2c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7f2c('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6caf080..6402aa3 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 _0xb10b=['sequelize','INTEGER'];(function(_0x21c3da,_0x551beb){var _0x28ac07=function(_0x17803d){while(--_0x17803d){_0x21c3da['push'](_0x21c3da['shift']());}};_0x28ac07(++_0x551beb);}(_0xb10b,0x12a));var _0xbb10=function(_0x17d76b,_0x54345b){_0x17d76b=_0x17d76b-0x0;var _0x16f3ac=_0xb10b[_0x17d76b];return _0x16f3ac;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x33f269,_0x5998a3){var _0x4e94ff=function(_0x3d8c95){while(--_0x3d8c95){_0x33f269['push'](_0x33f269['shift']());}};_0x4e94ff(++_0x5998a3);}(_0xe706,0xa3));var _0x6e70=function(_0x1c44d7,_0x21dafd){_0x1c44d7=_0x1c44d7-0x0;var _0xc485e5=_0xe706[_0x1c44d7];return _0xc485e5;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index a0fbcfc..6aaedf3 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 _0x75f0=['lodash','util','api','request-promise','path','exports','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x75f0,0xe8));var _0x075f=function(_0x13b110,_0xaed0f2){_0x13b110=_0x13b110-0x0;var _0xd52387=_0x75f0[_0x13b110];return _0xd52387;};'use strict';var _=require(_0x075f('0x0'));var util=require(_0x075f('0x1'));var logger=require('../../config/logger')(_0x075f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x075f('0x3'));var fs=require('fs');var path=require(_0x075f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x075f('0x5')]=function(_0x3d2c3a,_0x269f7f){return _0x3d2c3a['define'](_0x075f('0x6'),attributes,{'tableName':_0x075f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x918b=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserWhatsappQueue','lodash'];(function(_0x29fb70,_0x2d1ad9){var _0x5f55fb=function(_0x490f62){while(--_0x490f62){_0x29fb70['push'](_0x29fb70['shift']());}};_0x5f55fb(++_0x2d1ad9);}(_0x918b,0x8e));var _0xb918=function(_0x5a4a1e,_0x5f014c){_0x5a4a1e=_0x5a4a1e-0x0;var _0x13b91d=_0x918b[_0x5a4a1e];return _0x13b91d;};'use strict';var _=require(_0xb918('0x0'));var util=require(_0xb918('0x1'));var logger=require(_0xb918('0x2'))('api');var moment=require(_0xb918('0x3'));var BPromise=require(_0xb918('0x4'));var rp=require(_0xb918('0x5'));var fs=require('fs');var path=require(_0xb918('0x6'));var rimraf=require(_0xb918('0x7'));var config=require(_0xb918('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0xb918('0x9')]=function(_0x24ed1d,_0x376a58){return _0x24ed1d['define'](_0xb918('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','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 fbeca6e..95df59f 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(_0x8acdc0,_0x57386b){var _0x4b6340=function(_0x58964d){while(--_0x58964d){_0x8acdc0['push'](_0x8acdc0['shift']());}};_0x4b6340(++_0x57386b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x62186b,_0x273f46){var _0x2bab2a=function(_0x296f61){while(--_0x296f61){_0x62186b['push'](_0x62186b['shift']());}};_0x2bab2a(++_0x273f46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 41b14ba..02c6181 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 _0x6753=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./variable.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer'];(function(_0xdf4058,_0x3d913d){var _0x141888=function(_0x52b935){while(--_0x52b935){_0xdf4058['push'](_0xdf4058['shift']());}};_0x141888(++_0x3d913d);}(_0x6753,0xa1));var _0x3675=function(_0x5d8e90,_0x4ffac5){_0x5d8e90=_0x5d8e90-0x0;var _0x56968c=_0x6753[_0x5d8e90];return _0x56968c;};'use strict';var multer=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var path=require(_0x3675('0x2'));var timeout=require(_0x3675('0x3'));var express=require('express');var router=express[_0x3675('0x4')]();var auth=require(_0x3675('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3675('0x6'));var controller=require(_0x3675('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3675('0x8')](_0x3675('0x9'),auth[_0x3675('0xa')](),controller[_0x3675('0xb')]);router[_0x3675('0xc')]('/',auth[_0x3675('0xa')](),controller[_0x3675('0xd')]);router[_0x3675('0xe')](_0x3675('0x9'),auth[_0x3675('0xa')](),controller[_0x3675('0xf')]);router[_0x3675('0x10')](_0x3675('0x9'),auth[_0x3675('0xa')](),controller['destroy']);module[_0x3675('0x11')]=router; \ No newline at end of file +var _0xae7d=['./variable.controller','isAuthenticated','index','get','create','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x3c9487,_0x1316d5){var _0x1149c0=function(_0xda3e3f){while(--_0xda3e3f){_0x3c9487['push'](_0x3c9487['shift']());}};_0x1149c0(++_0x1316d5);}(_0xae7d,0x19f));var _0xdae7=function(_0xfeb2ca,_0x4ca7a4){_0xfeb2ca=_0xfeb2ca-0x0;var _0xb50fa9=_0xae7d[_0xfeb2ca];return _0xb50fa9;};'use strict';var multer=require(_0xdae7('0x0'));var util=require('util');var path=require(_0xdae7('0x1'));var timeout=require(_0xdae7('0x2'));var express=require('express');var router=express[_0xdae7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xdae7('0x4'));var config=require('../../config/environment');var controller=require(_0xdae7('0x5'));router['get']('/',auth[_0xdae7('0x6')](),controller[_0xdae7('0x7')]);router[_0xdae7('0x8')]('/:id',auth[_0xdae7('0x6')](),controller['show']);router['post']('/',auth[_0xdae7('0x6')](),controller[_0xdae7('0x9')]);router[_0xdae7('0xa')]('/:id',auth[_0xdae7('0x6')](),controller[_0xdae7('0xb')]);router[_0xdae7('0xc')]('/:id',auth[_0xdae7('0x6')](),controller[_0xdae7('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3a15551..b1e0f28 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 _0x9969=['sequelize','STRING','name'];(function(_0x40e1be,_0x553cd6){var _0x59908d=function(_0x1e3d12){while(--_0x1e3d12){_0x40e1be['push'](_0x40e1be['shift']());}};_0x59908d(++_0x553cd6);}(_0x9969,0x7b));var _0x9996=function(_0x3e6656,_0xb89a20){_0x3e6656=_0x3e6656-0x0;var _0x59882b=_0x9969[_0x3e6656];return _0x59882b;};'use strict';var Sequelize=require(_0x9996('0x0'));module['exports']={'name':{'type':Sequelize[_0x9996('0x1')],'unique':_0x9996('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9996('0x1')]}}; \ No newline at end of file +var _0x06f8=['name','exports','STRING'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x06f8,0xbe));var _0x806f=function(_0x2a4212,_0x2fbd11){_0x2a4212=_0x2a4212-0x0;var _0x122547=_0x06f8[_0x2a4212];return _0x122547;};'use strict';var Sequelize=require('sequelize');module[_0x806f('0x0')]={'name':{'type':Sequelize[_0x806f('0x1')],'unique':_0x806f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x806f('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2fcb3b2..ccb52ec 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 _0xa968=['status','json','count','limit','Content-Range','apply','reject','update','then','destroy','get','Variables','end','error','stack','name','send','index','Variable','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','util','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','../../mysqldb','sendStatus'];(function(_0x35cd69,_0x12289e){var _0x21df7e=function(_0x2f8e15){while(--_0x2f8e15){_0x35cd69['push'](_0x35cd69['shift']());}};_0x21df7e(++_0x12289e);}(_0xa968,0x1c2));var _0x8a96=function(_0x3969ae,_0x3bb56f){_0x3969ae=_0x3969ae-0x0;var _0x2050d2=_0xa968[_0x3969ae];return _0x2050d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a96('0x0'));var rimraf=require(_0x8a96('0x1'));var zipdir=require(_0x8a96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a96('0x3'));var moment=require(_0x8a96('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8a96('0x5'));var path=require('path');var sox=require(_0x8a96('0x6'));var csv=require(_0x8a96('0x7'));var ejs=require(_0x8a96('0x8'));var fs=require('fs');var _=require(_0x8a96('0x9'));var squel=require(_0x8a96('0xa'));var crypto=require(_0x8a96('0xb'));var jsforce=require(_0x8a96('0xc'));var deskjs=require(_0x8a96('0xd'));var toCsv=require(_0x8a96('0x7'));var querystring=require('querystring');var Papa=require(_0x8a96('0xe'));var Redis=require(_0x8a96('0xf'));var authService=require(_0x8a96('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8a96('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a96('0x12'))(_0x8a96('0x13'));var utils=require(_0x8a96('0x14'));var config=require(_0x8a96('0x15'));var db=require(_0x8a96('0x16'))['db'];function respondWithStatusCode(_0x47da00,_0x13e056){_0x13e056=_0x13e056||0xcc;return function(_0x13d91d){if(_0x13d91d){return _0x47da00[_0x8a96('0x17')](_0x13e056);}return _0x47da00['status'](_0x13e056)['end']();};}function respondWithResult(_0x326764,_0x13ad04){_0x13ad04=_0x13ad04||0xc8;return function(_0x29f2b8){if(_0x29f2b8){return _0x326764[_0x8a96('0x18')](_0x13ad04)[_0x8a96('0x19')](_0x29f2b8);}};}function respondWithFilteredResult(_0x2b3361,_0x4ab6da){return function(_0xf69e6e){if(_0xf69e6e){var _0x3e2428=_0xf69e6e[_0x8a96('0x1a')],_0x581aa2=_0x4ab6da['offset'],_0xb80da4=_0x4ab6da['offset']+_0x4ab6da[_0x8a96('0x1b')],_0x51254b;if(_0xb80da4>=_0x3e2428){_0xb80da4=_0x3e2428;_0x51254b=0xc8;}else{_0x51254b=0xce;}_0x2b3361[_0x8a96('0x18')](_0x51254b);return _0x2b3361['set'](_0x8a96('0x1c'),_0x581aa2+'-'+_0xb80da4+'/'+_0x3e2428)[_0x8a96('0x19')](_0xf69e6e);}return null;};}function patchUpdates(_0x1a175d){return function(_0x50f783){try{jsonpatch[_0x8a96('0x1d')](_0x50f783,_0x1a175d,!![]);}catch(_0x461dd8){return BPromise[_0x8a96('0x1e')](_0x461dd8);}return _0x50f783['save']();};}function saveUpdates(_0x1808a1,_0x5f1b9c){return function(_0x53154c){if(_0x53154c){return _0x53154c[_0x8a96('0x1f')](_0x1808a1)[_0x8a96('0x20')](function(_0x121ddc){return _0x121ddc;});}return null;};}function removeEntity(_0x3fe751,_0x518e67){return function(_0x314f86){if(_0x314f86){return _0x314f86[_0x8a96('0x21')]()[_0x8a96('0x20')](function(){var _0x270845=_0x314f86[_0x8a96('0x22')]({'plain':!![]});var _0x36c926=_0x8a96('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x36c926,'resourceId':_0x270845['id']}})[_0x8a96('0x20')](function(){return _0x314f86;});})['then'](function(){_0x3fe751['status'](0xcc)[_0x8a96('0x24')]();});}};}function handleEntityNotFound(_0x588e67,_0x3a3a9e){return function(_0x64f15c){if(!_0x64f15c){_0x588e67[_0x8a96('0x17')](0x194);}return _0x64f15c;};}function handleError(_0x3a87bd,_0x4fdfa1){_0x4fdfa1=_0x4fdfa1||0x1f4;return function(_0x2d2b99){logger[_0x8a96('0x25')](_0x2d2b99[_0x8a96('0x26')]);if(_0x2d2b99[_0x8a96('0x27')]){delete _0x2d2b99[_0x8a96('0x27')];}_0x3a87bd['status'](_0x4fdfa1)[_0x8a96('0x28')](_0x2d2b99);};}exports[_0x8a96('0x29')]=function(_0x15c373,_0x5f3880){var _0x30c776={},_0x6340c4={},_0x44e9de={'count':0x0,'rows':[]};var _0x34d69e=_['map'](db[_0x8a96('0x2a')]['rawAttributes'],function(_0x154a13){return{'name':_0x154a13[_0x8a96('0x2b')],'type':_0x154a13['type']['key']};});_0x6340c4[_0x8a96('0x2c')]=_[_0x8a96('0x2d')](_0x34d69e,_0x8a96('0x27'));_0x6340c4['query']=_[_0x8a96('0x2e')](_0x15c373[_0x8a96('0x2f')]);_0x6340c4[_0x8a96('0x30')]=_[_0x8a96('0x31')](_0x6340c4[_0x8a96('0x2c')],_0x6340c4[_0x8a96('0x2f')]);_0x30c776[_0x8a96('0x32')]=_[_0x8a96('0x31')](_0x6340c4[_0x8a96('0x2c')],qs[_0x8a96('0x33')](_0x15c373[_0x8a96('0x2f')]['fields']));_0x30c776[_0x8a96('0x32')]=_0x30c776[_0x8a96('0x32')][_0x8a96('0x34')]?_0x30c776['attributes']:_0x6340c4['model'];if(!_0x15c373['query'][_0x8a96('0x35')](_0x8a96('0x36'))){_0x30c776[_0x8a96('0x1b')]=qs[_0x8a96('0x1b')](_0x15c373[_0x8a96('0x2f')][_0x8a96('0x1b')]);_0x30c776[_0x8a96('0x37')]=qs[_0x8a96('0x37')](_0x15c373['query'][_0x8a96('0x37')]);}_0x30c776[_0x8a96('0x38')]=qs[_0x8a96('0x39')](_0x15c373['query']['sort']);_0x30c776[_0x8a96('0x3a')]=qs[_0x8a96('0x30')](_[_0x8a96('0x3b')](_0x15c373[_0x8a96('0x2f')],_0x6340c4[_0x8a96('0x30')]),_0x34d69e);if(_0x15c373['query'][_0x8a96('0x3c')]){_0x30c776[_0x8a96('0x3a')]=_[_0x8a96('0x3d')](_0x30c776[_0x8a96('0x3a')],{'$or':_[_0x8a96('0x2d')](_0x34d69e,function(_0x4e0fc2){if(_0x4e0fc2['type']!==_0x8a96('0x3e')){var _0x213666={};_0x213666[_0x4e0fc2[_0x8a96('0x27')]]={'$like':'%'+_0x15c373[_0x8a96('0x2f')][_0x8a96('0x3c')]+'%'};return _0x213666;}})});}_0x30c776=_[_0x8a96('0x3d')]({},_0x30c776,_0x15c373[_0x8a96('0x3f')]);var _0x1d3c04={'where':_0x30c776['where']};return db[_0x8a96('0x2a')][_0x8a96('0x1a')](_0x1d3c04)[_0x8a96('0x20')](function(_0xb88e85){_0x44e9de['count']=_0xb88e85;if(_0x15c373[_0x8a96('0x2f')][_0x8a96('0x40')]){_0x30c776[_0x8a96('0x41')]=[{'all':!![]}];}return db[_0x8a96('0x2a')][_0x8a96('0x42')](_0x30c776);})[_0x8a96('0x20')](function(_0xaf7832){_0x44e9de[_0x8a96('0x43')]=_0xaf7832;return _0x44e9de;})[_0x8a96('0x20')](respondWithFilteredResult(_0x5f3880,_0x30c776))[_0x8a96('0x44')](handleError(_0x5f3880,null));};exports['show']=function(_0x46e273,_0x292bb6){var _0x3b4fc1={'raw':!![],'where':{'id':_0x46e273[_0x8a96('0x45')]['id']}},_0x161475={};_0x161475[_0x8a96('0x2c')]=_[_0x8a96('0x2e')](db[_0x8a96('0x2a')]['rawAttributes']);_0x161475[_0x8a96('0x2f')]=_[_0x8a96('0x2e')](_0x46e273['query']);_0x161475[_0x8a96('0x30')]=_[_0x8a96('0x31')](_0x161475[_0x8a96('0x2c')],_0x161475[_0x8a96('0x2f')]);_0x3b4fc1[_0x8a96('0x32')]=_['intersection'](_0x161475['model'],qs[_0x8a96('0x33')](_0x46e273['query'][_0x8a96('0x33')]));_0x3b4fc1[_0x8a96('0x32')]=_0x3b4fc1['attributes'][_0x8a96('0x34')]?_0x3b4fc1['attributes']:_0x161475[_0x8a96('0x2c')];if(_0x46e273[_0x8a96('0x2f')][_0x8a96('0x40')]){_0x3b4fc1['include']=[{'all':!![]}];}_0x3b4fc1=_['merge']({},_0x3b4fc1,_0x46e273['options']);return db[_0x8a96('0x2a')][_0x8a96('0x46')](_0x3b4fc1)['then'](handleEntityNotFound(_0x292bb6,null))[_0x8a96('0x20')](respondWithResult(_0x292bb6,null))[_0x8a96('0x44')](handleError(_0x292bb6,null));};exports['create']=function(_0x482ac0,_0x254482){return db[_0x8a96('0x2a')]['create'](_0x482ac0[_0x8a96('0x47')],{})['then'](function(_0x340abf){var _0x5a0353=_0x482ac0[_0x8a96('0x48')][_0x8a96('0x22')]({'plain':!![]});if(!_0x5a0353)throw new Error(_0x8a96('0x49'));if(_0x5a0353[_0x8a96('0x4a')]===_0x8a96('0x48')){var _0x477e36=_0x340abf[_0x8a96('0x22')]({'plain':!![]});var _0x58fd3f='Variables';return db[_0x8a96('0x4b')][_0x8a96('0x46')]({'where':{'name':_0x58fd3f,'userProfileId':_0x5a0353[_0x8a96('0x4c')]},'raw':!![]})['then'](function(_0x5a8c6c){if(_0x5a8c6c&&_0x5a8c6c['autoAssociation']===0x0){return db['UserProfileResource'][_0x8a96('0x4d')]({'name':_0x477e36[_0x8a96('0x27')],'resourceId':_0x477e36['id'],'type':_0x5a8c6c['name'],'sectionId':_0x5a8c6c['id']},{})[_0x8a96('0x20')](function(){return _0x340abf;});}else{return _0x340abf;}})[_0x8a96('0x44')](function(_0x31cde8){logger[_0x8a96('0x25')](_0x8a96('0x4e'),_0x31cde8);throw _0x31cde8;});}return _0x340abf;})[_0x8a96('0x20')](respondWithResult(_0x254482,0xc9))['catch'](handleError(_0x254482,null));};exports['update']=function(_0x1b814e,_0x5aa155){if(_0x1b814e[_0x8a96('0x47')]['id']){delete _0x1b814e[_0x8a96('0x47')]['id'];}return db[_0x8a96('0x2a')][_0x8a96('0x46')]({'where':{'id':_0x1b814e[_0x8a96('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aa155,null))['then'](saveUpdates(_0x1b814e[_0x8a96('0x47')],null))[_0x8a96('0x20')](respondWithResult(_0x5aa155,null))[_0x8a96('0x44')](handleError(_0x5aa155,null));};exports['destroy']=function(_0x32c685,_0x392f2a){return db[_0x8a96('0x2a')][_0x8a96('0x46')]({'where':{'id':_0x32c685[_0x8a96('0x45')]['id']}})[_0x8a96('0x20')](handleEntityNotFound(_0x392f2a,null))[_0x8a96('0x20')](removeEntity(_0x392f2a,null))[_0x8a96('0x44')](handleError(_0x392f2a,null));}; \ No newline at end of file +var _0xfc6e=['squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Variables','destroy','error','name','send','index','Variable','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','map','VIRTUAL','count','includeAll','findAll','rows','show','params','keys','include','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfc6e,0x17c));var _0xefc6=function(_0x56a69f,_0x1bf698){_0x56a69f=_0x56a69f-0x0;var _0x1cb629=_0xfc6e[_0x56a69f];return _0x1cb629;};'use strict';var pdf=require(_0xefc6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xefc6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefc6('0x2'));var moment=require(_0xefc6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xefc6('0x4'));var util=require(_0xefc6('0x5'));var path=require(_0xefc6('0x6'));var sox=require('sox');var csv=require(_0xefc6('0x7'));var ejs=require(_0xefc6('0x8'));var fs=require('fs');var _=require(_0xefc6('0x9'));var squel=require(_0xefc6('0xa'));var crypto=require('crypto');var jsforce=require(_0xefc6('0xb'));var deskjs=require(_0xefc6('0xc'));var toCsv=require(_0xefc6('0x7'));var querystring=require(_0xefc6('0xd'));var Papa=require(_0xefc6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xefc6('0xf'));var as=require(_0xefc6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xefc6('0x11'))('api');var utils=require(_0xefc6('0x12'));var config=require(_0xefc6('0x13'));var db=require(_0xefc6('0x14'))['db'];function respondWithStatusCode(_0x2491b3,_0x244146){_0x244146=_0x244146||0xcc;return function(_0x36ee13){if(_0x36ee13){return _0x2491b3[_0xefc6('0x15')](_0x244146);}return _0x2491b3[_0xefc6('0x16')](_0x244146)['end']();};}function respondWithResult(_0x5bc94c,_0x4f3498){_0x4f3498=_0x4f3498||0xc8;return function(_0x1eaa49){if(_0x1eaa49){return _0x5bc94c[_0xefc6('0x16')](_0x4f3498)[_0xefc6('0x17')](_0x1eaa49);}};}function respondWithFilteredResult(_0x37e7d7,_0x44b0f1){return function(_0x37223a){if(_0x37223a){var _0x112b6f=_0x37223a['count'],_0x2abeae=_0x44b0f1[_0xefc6('0x18')],_0x2c6302=_0x44b0f1[_0xefc6('0x18')]+_0x44b0f1[_0xefc6('0x19')],_0x7da3db;if(_0x2c6302>=_0x112b6f){_0x2c6302=_0x112b6f;_0x7da3db=0xc8;}else{_0x7da3db=0xce;}_0x37e7d7[_0xefc6('0x16')](_0x7da3db);return _0x37e7d7[_0xefc6('0x1a')](_0xefc6('0x1b'),_0x2abeae+'-'+_0x2c6302+'/'+_0x112b6f)[_0xefc6('0x17')](_0x37223a);}return null;};}function patchUpdates(_0x5a0f8b){return function(_0x4ca6ad){try{jsonpatch[_0xefc6('0x1c')](_0x4ca6ad,_0x5a0f8b,!![]);}catch(_0x7fa412){return BPromise[_0xefc6('0x1d')](_0x7fa412);}return _0x4ca6ad[_0xefc6('0x1e')]();};}function saveUpdates(_0x4706f1,_0x25f9e3){return function(_0x3c7fcb){if(_0x3c7fcb){return _0x3c7fcb[_0xefc6('0x1f')](_0x4706f1)['then'](function(_0x49c1a2){return _0x49c1a2;});}return null;};}function removeEntity(_0x4d3ea7,_0xfb4065){return function(_0x5b981d){if(_0x5b981d){return _0x5b981d['destroy']()[_0xefc6('0x20')](function(){var _0x231799=_0x5b981d[_0xefc6('0x21')]({'plain':!![]});var _0xa4cd15=_0xefc6('0x22');return db['UserProfileResource'][_0xefc6('0x23')]({'where':{'type':_0xa4cd15,'resourceId':_0x231799['id']}})[_0xefc6('0x20')](function(){return _0x5b981d;});})['then'](function(){_0x4d3ea7[_0xefc6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fd485,_0x3f26be){return function(_0x5c895d){if(!_0x5c895d){_0x3fd485[_0xefc6('0x15')](0x194);}return _0x5c895d;};}function handleError(_0x8b8194,_0x283b4e){_0x283b4e=_0x283b4e||0x1f4;return function(_0x29053f){logger[_0xefc6('0x24')](_0x29053f['stack']);if(_0x29053f[_0xefc6('0x25')]){delete _0x29053f['name'];}_0x8b8194[_0xefc6('0x16')](_0x283b4e)[_0xefc6('0x26')](_0x29053f);};}exports[_0xefc6('0x27')]=function(_0x2ccfa0,_0x5d0859){var _0x5dd8e7={},_0x1e446d={},_0x3c9dc9={'count':0x0,'rows':[]};var _0x84a415=_['map'](db[_0xefc6('0x28')][_0xefc6('0x29')],function(_0x41f426){return{'name':_0x41f426[_0xefc6('0x2a')],'type':_0x41f426[_0xefc6('0x2b')][_0xefc6('0x2c')]};});_0x1e446d[_0xefc6('0x2d')]=_['map'](_0x84a415,_0xefc6('0x25'));_0x1e446d[_0xefc6('0x2e')]=_['keys'](_0x2ccfa0[_0xefc6('0x2e')]);_0x1e446d[_0xefc6('0x2f')]=_[_0xefc6('0x30')](_0x1e446d[_0xefc6('0x2d')],_0x1e446d[_0xefc6('0x2e')]);_0x5dd8e7['attributes']=_[_0xefc6('0x30')](_0x1e446d['model'],qs[_0xefc6('0x31')](_0x2ccfa0['query'][_0xefc6('0x31')]));_0x5dd8e7[_0xefc6('0x32')]=_0x5dd8e7[_0xefc6('0x32')][_0xefc6('0x33')]?_0x5dd8e7[_0xefc6('0x32')]:_0x1e446d[_0xefc6('0x2d')];if(!_0x2ccfa0[_0xefc6('0x2e')][_0xefc6('0x34')]('nolimit')){_0x5dd8e7[_0xefc6('0x19')]=qs['limit'](_0x2ccfa0[_0xefc6('0x2e')][_0xefc6('0x19')]);_0x5dd8e7['offset']=qs['offset'](_0x2ccfa0[_0xefc6('0x2e')][_0xefc6('0x18')]);}_0x5dd8e7[_0xefc6('0x35')]=qs['sort'](_0x2ccfa0[_0xefc6('0x2e')]['sort']);_0x5dd8e7[_0xefc6('0x36')]=qs['filters'](_[_0xefc6('0x37')](_0x2ccfa0[_0xefc6('0x2e')],_0x1e446d[_0xefc6('0x2f')]),_0x84a415);if(_0x2ccfa0['query'][_0xefc6('0x38')]){_0x5dd8e7[_0xefc6('0x36')]=_[_0xefc6('0x39')](_0x5dd8e7[_0xefc6('0x36')],{'$or':_[_0xefc6('0x3a')](_0x84a415,function(_0x101373){if(_0x101373['type']!==_0xefc6('0x3b')){var _0x6fcfe={};_0x6fcfe[_0x101373[_0xefc6('0x25')]]={'$like':'%'+_0x2ccfa0[_0xefc6('0x2e')][_0xefc6('0x38')]+'%'};return _0x6fcfe;}})});}_0x5dd8e7=_['merge']({},_0x5dd8e7,_0x2ccfa0['options']);var _0x1c63fa={'where':_0x5dd8e7[_0xefc6('0x36')]};return db[_0xefc6('0x28')][_0xefc6('0x3c')](_0x1c63fa)['then'](function(_0x32b825){_0x3c9dc9[_0xefc6('0x3c')]=_0x32b825;if(_0x2ccfa0['query'][_0xefc6('0x3d')]){_0x5dd8e7['include']=[{'all':!![]}];}return db[_0xefc6('0x28')][_0xefc6('0x3e')](_0x5dd8e7);})[_0xefc6('0x20')](function(_0x2baf77){_0x3c9dc9[_0xefc6('0x3f')]=_0x2baf77;return _0x3c9dc9;})[_0xefc6('0x20')](respondWithFilteredResult(_0x5d0859,_0x5dd8e7))['catch'](handleError(_0x5d0859,null));};exports[_0xefc6('0x40')]=function(_0x546a85,_0x227ec2){var _0x1d00f6={'raw':!![],'where':{'id':_0x546a85[_0xefc6('0x41')]['id']}},_0x1516fe={};_0x1516fe[_0xefc6('0x2d')]=_[_0xefc6('0x42')](db[_0xefc6('0x28')]['rawAttributes']);_0x1516fe['query']=_['keys'](_0x546a85[_0xefc6('0x2e')]);_0x1516fe[_0xefc6('0x2f')]=_[_0xefc6('0x30')](_0x1516fe[_0xefc6('0x2d')],_0x1516fe[_0xefc6('0x2e')]);_0x1d00f6[_0xefc6('0x32')]=_['intersection'](_0x1516fe[_0xefc6('0x2d')],qs[_0xefc6('0x31')](_0x546a85[_0xefc6('0x2e')]['fields']));_0x1d00f6['attributes']=_0x1d00f6[_0xefc6('0x32')]['length']?_0x1d00f6['attributes']:_0x1516fe['model'];if(_0x546a85['query'][_0xefc6('0x3d')]){_0x1d00f6[_0xefc6('0x43')]=[{'all':!![]}];}_0x1d00f6=_[_0xefc6('0x39')]({},_0x1d00f6,_0x546a85[_0xefc6('0x44')]);return db[_0xefc6('0x28')][_0xefc6('0x45')](_0x1d00f6)[_0xefc6('0x20')](handleEntityNotFound(_0x227ec2,null))[_0xefc6('0x20')](respondWithResult(_0x227ec2,null))[_0xefc6('0x46')](handleError(_0x227ec2,null));};exports[_0xefc6('0x47')]=function(_0x391b81,_0x175026){return db[_0xefc6('0x28')]['create'](_0x391b81['body'],{})[_0xefc6('0x20')](function(_0x4bb303){var _0x414d3b=_0x391b81[_0xefc6('0x48')][_0xefc6('0x21')]({'plain':!![]});if(!_0x414d3b)throw new Error(_0xefc6('0x49'));if(_0x414d3b[_0xefc6('0x4a')]===_0xefc6('0x48')){var _0xae5100=_0x4bb303[_0xefc6('0x21')]({'plain':!![]});var _0x53c1c3='Variables';return db[_0xefc6('0x4b')][_0xefc6('0x45')]({'where':{'name':_0x53c1c3,'userProfileId':_0x414d3b['userProfileId']},'raw':!![]})[_0xefc6('0x20')](function(_0x3a35d8){if(_0x3a35d8&&_0x3a35d8['autoAssociation']===0x0){return db['UserProfileResource'][_0xefc6('0x47')]({'name':_0xae5100[_0xefc6('0x25')],'resourceId':_0xae5100['id'],'type':_0x3a35d8[_0xefc6('0x25')],'sectionId':_0x3a35d8['id']},{})[_0xefc6('0x20')](function(){return _0x4bb303;});}else{return _0x4bb303;}})[_0xefc6('0x46')](function(_0x3c2fa3){logger['error'](_0xefc6('0x4c'),_0x3c2fa3);throw _0x3c2fa3;});}return _0x4bb303;})[_0xefc6('0x20')](respondWithResult(_0x175026,0xc9))['catch'](handleError(_0x175026,null));};exports[_0xefc6('0x1f')]=function(_0x6b4d3a,_0x35d951){if(_0x6b4d3a[_0xefc6('0x4d')]['id']){delete _0x6b4d3a[_0xefc6('0x4d')]['id'];}return db[_0xefc6('0x28')][_0xefc6('0x45')]({'where':{'id':_0x6b4d3a['params']['id']}})[_0xefc6('0x20')](handleEntityNotFound(_0x35d951,null))['then'](saveUpdates(_0x6b4d3a[_0xefc6('0x4d')],null))[_0xefc6('0x20')](respondWithResult(_0x35d951,null))['catch'](handleError(_0x35d951,null));};exports['destroy']=function(_0x4757b1,_0x56bc12){return db[_0xefc6('0x28')][_0xefc6('0x45')]({'where':{'id':_0x4757b1['params']['id']}})[_0xefc6('0x20')](handleEntityNotFound(_0x56bc12,null))[_0xefc6('0x20')](removeEntity(_0x56bc12,null))['catch'](handleError(_0x56bc12,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a0099ef..381f7ec 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 _0x8e23=['util','../../config/logger','moment','bluebird','request-promise','path','./variable.attributes','exports','define','tools_variables'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0x8e23,0x136));var _0x38e2=function(_0x7a9761,_0x164166){_0x7a9761=_0x7a9761-0x0;var _0x3658f7=_0x8e23[_0x7a9761];return _0x3658f7;};'use strict';var _=require('lodash');var util=require(_0x38e2('0x0'));var logger=require(_0x38e2('0x1'))('api');var moment=require(_0x38e2('0x2'));var BPromise=require(_0x38e2('0x3'));var rp=require(_0x38e2('0x4'));var fs=require('fs');var path=require(_0x38e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x38e2('0x6'));module[_0x38e2('0x7')]=function(_0x174e56,_0x57063e){return _0x174e56[_0x38e2('0x8')]('Variable',attributes,{'tableName':_0x38e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2718=['api','moment','path','rimraf','exports','define','Variable','lodash','util','../../config/logger'];(function(_0x2ce222,_0x3bea45){var _0x4ad63c=function(_0x1a151a){while(--_0x1a151a){_0x2ce222['push'](_0x2ce222['shift']());}};_0x4ad63c(++_0x3bea45);}(_0x2718,0x129));var _0x8271=function(_0x26eb3b,_0x4a900b){_0x26eb3b=_0x26eb3b-0x0;var _0x25eaa1=_0x2718[_0x26eb3b];return _0x25eaa1;};'use strict';var _=require(_0x8271('0x0'));var util=require(_0x8271('0x1'));var logger=require(_0x8271('0x2'))(_0x8271('0x3'));var moment=require(_0x8271('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8271('0x5'));var rimraf=require(_0x8271('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x8271('0x7')]=function(_0x283083,_0x2dcbeb){return _0x283083[_0x8271('0x8')](_0x8271('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 7e67c0b..4f4788f 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 _0xf81f=['options','raw','where','attributes','include','model','map','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowVariable','Variable'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf81f,0x128));var _0xff81=function(_0x15aec1,_0x527e84){_0x15aec1=_0x15aec1-0x0;var _0x37a89d=_0xf81f[_0x15aec1];return _0x37a89d;};'use strict';var _=require('lodash');var util=require(_0xff81('0x0'));var moment=require(_0xff81('0x1'));var BPromise=require(_0xff81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff81('0x3'));var db=require(_0xff81('0x4'))['db'];var utils=require(_0xff81('0x5'));var logger=require(_0xff81('0x6'))(_0xff81('0x7'));var config=require(_0xff81('0x8'));var jayson=require(_0xff81('0x9'));var client=jayson[_0xff81('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4090,_0x42ea89,_0x5763a7){return new BPromise(function(_0x31f2cc,_0x30738f){return client[_0xff81('0xb')](_0x1d4090,_0x5763a7)[_0xff81('0xc')](function(_0x482ef3){logger[_0xff81('0xd')](_0xff81('0xe'),_0x42ea89,'request\x20sent');logger[_0xff81('0xf')](_0xff81('0x10'),_0x42ea89,_0xff81('0x11'),JSON[_0xff81('0x12')](_0x482ef3));if(_0x482ef3[_0xff81('0x13')]){if(_0x482ef3['error']['code']===0x1f4){logger[_0xff81('0x13')]('Variable,\x20%s,\x20%s',_0x42ea89,_0x482ef3[_0xff81('0x13')][_0xff81('0x14')]);return _0x30738f(_0x482ef3[_0xff81('0x13')][_0xff81('0x14')]);}logger[_0xff81('0x13')](_0xff81('0xe'),_0x42ea89,_0x482ef3['error'][_0xff81('0x14')]);return _0x31f2cc(_0x482ef3[_0xff81('0x13')][_0xff81('0x14')]);}else{logger[_0xff81('0xd')]('Variable,\x20%s,\x20%s',_0x42ea89,_0xff81('0x11'));_0x31f2cc(_0x482ef3[_0xff81('0x15')][_0xff81('0x14')]);}})['catch'](function(_0x2e9e6f){logger[_0xff81('0x13')]('Variable,\x20%s,\x20%s',_0x42ea89,_0x2e9e6f);_0x30738f(_0x2e9e6f);});});}exports[_0xff81('0x16')]=function(_0x39ffdd){var _0x39e54a=this;return new Promise(function(_0x39e4a2,_0x1a6968){return db[_0xff81('0x17')]['find']({'raw':_0x39ffdd[_0xff81('0x18')]?_0x39ffdd[_0xff81('0x18')][_0xff81('0x19')]===undefined?!![]:![]:!![],'where':_0x39ffdd[_0xff81('0x18')]?_0x39ffdd[_0xff81('0x18')][_0xff81('0x1a')]||null:null,'attributes':_0x39ffdd['options']?_0x39ffdd[_0xff81('0x18')][_0xff81('0x1b')]||null:null,'include':_0x39ffdd[_0xff81('0x18')]?_0x39ffdd['options'][_0xff81('0x1c')]?_['map'](_0x39ffdd[_0xff81('0x18')][_0xff81('0x1c')],function(_0x1e48d7){return{'model':db[_0x1e48d7[_0xff81('0x1d')]],'as':_0x1e48d7['as'],'attributes':_0x1e48d7['attributes'],'include':_0x1e48d7[_0xff81('0x1c')]?_[_0xff81('0x1e')](_0x1e48d7[_0xff81('0x1c')],function(_0x114b74){return{'model':db[_0x114b74[_0xff81('0x1d')]],'as':_0x114b74['as'],'attributes':_0x114b74[_0xff81('0x1b')],'include':_0x114b74[_0xff81('0x1c')]?_['map'](_0x114b74[_0xff81('0x1c')],function(_0xc45fc0){return{'model':db[_0xc45fc0[_0xff81('0x1d')]],'as':_0xc45fc0['as'],'attributes':_0xc45fc0[_0xff81('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x135600){logger[_0xff81('0xd')](_0xff81('0x16'),_0x39ffdd);logger['debug'](_0xff81('0x16'),_0x39ffdd,JSON[_0xff81('0x12')](_0x135600));_0x39e4a2(_0x135600);})[_0xff81('0x1f')](function(_0x5a6c10){logger[_0xff81('0x13')](_0xff81('0x16'),_0x5a6c10[_0xff81('0x14')],_0x39ffdd);_0x1a6968(_0x39e54a['error'](0x1f4,_0x5a6c10[_0xff81('0x14')]));});});}; \ No newline at end of file +var _0x9475=['result','ShowVariable','Variable','options','raw','where','attributes','include','map','model','then','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Variable,\x20%s,\x20%s'];(function(_0x39887a,_0x5835ca){var _0x1f8468=function(_0x43032f){while(--_0x43032f){_0x39887a['push'](_0x39887a['shift']());}};_0x1f8468(++_0x5835ca);}(_0x9475,0x1da));var _0x5947=function(_0x515c6f,_0x27d76f){_0x515c6f=_0x515c6f-0x0;var _0x5b5fa0=_0x9475[_0x515c6f];return _0x5b5fa0;};'use strict';var _=require(_0x5947('0x0'));var util=require(_0x5947('0x1'));var moment=require(_0x5947('0x2'));var BPromise=require('bluebird');var rs=require(_0x5947('0x3'));var fs=require('fs');var Redis=require(_0x5947('0x4'));var db=require(_0x5947('0x5'))['db'];var utils=require(_0x5947('0x6'));var logger=require('../../config/logger')(_0x5947('0x7'));var config=require(_0x5947('0x8'));var jayson=require(_0x5947('0x9'));var client=jayson[_0x5947('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a6762,_0x4deee3,_0x3d6677){return new BPromise(function(_0x3d3121,_0x47cbbc){return client[_0x5947('0xb')](_0x5a6762,_0x3d6677)['then'](function(_0x1a5b1d){logger[_0x5947('0xc')]('Variable,\x20%s,\x20%s',_0x4deee3,'request\x20sent');logger[_0x5947('0xd')](_0x5947('0xe'),_0x4deee3,_0x5947('0xf'),JSON[_0x5947('0x10')](_0x1a5b1d));if(_0x1a5b1d[_0x5947('0x11')]){if(_0x1a5b1d[_0x5947('0x11')][_0x5947('0x12')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x4deee3,_0x1a5b1d[_0x5947('0x11')][_0x5947('0x13')]);return _0x47cbbc(_0x1a5b1d[_0x5947('0x11')][_0x5947('0x13')]);}logger['error'](_0x5947('0x14'),_0x4deee3,_0x1a5b1d[_0x5947('0x11')][_0x5947('0x13')]);return _0x3d3121(_0x1a5b1d[_0x5947('0x11')][_0x5947('0x13')]);}else{logger[_0x5947('0xc')](_0x5947('0x14'),_0x4deee3,'request\x20sent');_0x3d3121(_0x1a5b1d[_0x5947('0x15')]['message']);}})['catch'](function(_0x1adf35){logger[_0x5947('0x11')](_0x5947('0x14'),_0x4deee3,_0x1adf35);_0x47cbbc(_0x1adf35);});});}exports[_0x5947('0x16')]=function(_0x558f59){var _0x4568fe=this;return new Promise(function(_0x52e489,_0x17522b){return db[_0x5947('0x17')]['find']({'raw':_0x558f59[_0x5947('0x18')]?_0x558f59[_0x5947('0x18')][_0x5947('0x19')]===undefined?!![]:![]:!![],'where':_0x558f59[_0x5947('0x18')]?_0x558f59[_0x5947('0x18')][_0x5947('0x1a')]||null:null,'attributes':_0x558f59['options']?_0x558f59['options'][_0x5947('0x1b')]||null:null,'include':_0x558f59[_0x5947('0x18')]?_0x558f59['options'][_0x5947('0x1c')]?_[_0x5947('0x1d')](_0x558f59['options'][_0x5947('0x1c')],function(_0x42a13e){return{'model':db[_0x42a13e[_0x5947('0x1e')]],'as':_0x42a13e['as'],'attributes':_0x42a13e['attributes'],'include':_0x42a13e['include']?_['map'](_0x42a13e['include'],function(_0x15f926){return{'model':db[_0x15f926[_0x5947('0x1e')]],'as':_0x15f926['as'],'attributes':_0x15f926['attributes'],'include':_0x15f926[_0x5947('0x1c')]?_[_0x5947('0x1d')](_0x15f926[_0x5947('0x1c')],function(_0x349694){return{'model':db[_0x349694[_0x5947('0x1e')]],'as':_0x349694['as'],'attributes':_0x349694[_0x5947('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5947('0x1f')](function(_0x487334){logger[_0x5947('0xc')](_0x5947('0x16'),_0x558f59);logger[_0x5947('0xd')](_0x5947('0x16'),_0x558f59,JSON[_0x5947('0x10')](_0x487334));_0x52e489(_0x487334);})[_0x5947('0x20')](function(_0x477b09){logger['error'](_0x5947('0x16'),_0x477b09['message'],_0x558f59);_0x17522b(_0x4568fe[_0x5947('0x11')](0x1f4,_0x477b09[_0x5947('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 82b45c9..ed93049 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 _0xfa09=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','./version.controller','get'];(function(_0x23ed26,_0x1d2ff4){var _0x545502=function(_0x5bd921){while(--_0x5bd921){_0x23ed26['push'](_0x23ed26['shift']());}};_0x545502(++_0x1d2ff4);}(_0xfa09,0x10a));var _0x9fa0=function(_0x45a1b8,_0xdea5ee){_0x45a1b8=_0x45a1b8-0x0;var _0x50e3d6=_0xfa09[_0x45a1b8];return _0x50e3d6;};'use strict';var express=require(_0x9fa0('0x0'));var router=express[_0x9fa0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9fa0('0x2'));router[_0x9fa0('0x3')]('/',controller[_0x9fa0('0x4')]);router[_0x9fa0('0x3')](_0x9fa0('0x5'),auth[_0x9fa0('0x6')](),auth[_0x9fa0('0x7')](),controller[_0x9fa0('0x8')]);router['get'](_0x9fa0('0x9'),auth['isAuthenticated'](),auth[_0x9fa0('0x7')](),controller[_0x9fa0('0xa')]);router[_0x9fa0('0x3')](_0x9fa0('0xb'),auth[_0x9fa0('0x6')](),auth['canUpdate'](),controller[_0x9fa0('0xc')]);router[_0x9fa0('0x3')](_0x9fa0('0xd'),auth[_0x9fa0('0x6')](),controller[_0x9fa0('0xe')]);router[_0x9fa0('0x3')](_0x9fa0('0xf'),controller[_0x9fa0('0x10')]);module[_0x9fa0('0x11')]=router; \ No newline at end of file +var _0x046f=['get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','migrations','express','Router'];(function(_0x335840,_0xd1b8de){var _0x5e133f=function(_0x1015ee){while(--_0x1015ee){_0x335840['push'](_0x335840['shift']());}};_0x5e133f(++_0xd1b8de);}(_0x046f,0x1a2));var _0xf046=function(_0x5e0f19,_0x456bc0){_0x5e0f19=_0x5e0f19-0x0;var _0x354649=_0x046f[_0x5e0f19];return _0x354649;};'use strict';var express=require(_0xf046('0x0'));var router=express[_0xf046('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xf046('0x2')]('/',controller[_0xf046('0x3')]);router[_0xf046('0x2')](_0xf046('0x4'),auth[_0xf046('0x5')](),auth[_0xf046('0x6')](),controller[_0xf046('0x7')]);router[_0xf046('0x2')](_0xf046('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xf046('0x9')]);router['get'](_0xf046('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xf046('0xb')]);router[_0xf046('0x2')](_0xf046('0xc'),auth[_0xf046('0x5')](),controller['restart']);router[_0xf046('0x2')](_0xf046('0xd'),controller[_0xf046('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 88aa148..2f563ae 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 _0x6bfc=['git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','\x20to\x20','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','compare-versions','exec','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch','--hard','FETCH_HEAD'];(function(_0x9c6c1c,_0x21ead9){var _0x594c42=function(_0x27764b){while(--_0x27764b){_0x9c6c1c['push'](_0x9c6c1c['shift']());}};_0x594c42(++_0x21ead9);}(_0x6bfc,0x159));var _0xc6bf=function(_0x474095,_0x1608e2){_0x474095=_0x474095-0x0;var _0x58c58a=_0x6bfc[_0x474095];return _0x58c58a;};'use strict';var Umzug=require('umzug');var path=require(_0xc6bf('0x0'));var fs=require('fs');var _=require(_0xc6bf('0x1'));var pkginfo=require(_0xc6bf('0x2'))(module,'version');var compareVersions=require(_0xc6bf('0x3'));var exec=require('child_process')[_0xc6bf('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0xc6bf('0x5'));var pm2=require(_0xc6bf('0x6'));var logger=require(_0xc6bf('0x7'))('update');var git=require(_0xc6bf('0x8'))(config[_0xc6bf('0x9')]);exports[_0xc6bf('0xa')]=function(_0x28d218,_0x250311){var _0x3b2815={'current':module[_0xc6bf('0xb')][_0xc6bf('0xc')],'phonebar':0x2};if(_0x28d218['query']&&_0x28d218[_0xc6bf('0xd')][_0xc6bf('0xe')]){return git[_0xc6bf('0xf')]()[_0xc6bf('0x10')](function(_0x5f2f8f,_0x5ad559){_0x3b2815[_0xc6bf('0xe')]=(_0x5f2f8f?module[_0xc6bf('0xb')]['version']:_0x5ad559['latest'])||_0xc6bf('0x11');return _0x250311[_0xc6bf('0x12')](0xc8)['json'](_0x3b2815);});}else{return _0x250311[_0xc6bf('0x12')](0xc8)[_0xc6bf('0x13')](_0x3b2815);}};exports[_0xc6bf('0xf')]=function(_0x34420d,_0x42e25e){return git['fetch'](['origin',_0xc6bf('0x14')],function(_0x391117){if(_0x391117){logger[_0xc6bf('0x15')](_0x391117);return _0x42e25e[_0xc6bf('0x12')](0x1f4)[_0xc6bf('0x13')](_0x391117);}logger[_0xc6bf('0x16')](_0xc6bf('0x17'));return _0x42e25e['status'](0xc8)[_0xc6bf('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x195c3f,_0x23a9e9){return git['reset']([_0xc6bf('0x18'),_0xc6bf('0x19')],function(_0x498c02){if(_0x498c02){logger[_0xc6bf('0x15')](_0x498c02);return _0x23a9e9['status'](0x1f4)['json'](_0x498c02);}logger['info'](_0xc6bf('0x1a'));return _0x23a9e9[_0xc6bf('0x12')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0xc6bf('0x1b')]=function(_0x2e47ce,_0x5ca782){exec(_0xc6bf('0x1c'),function(_0x41ca5a,_0x1e2110,_0x56e899){logger['info'](_0x1e2110);logger[_0xc6bf('0x16')](_0x56e899);if(_0x41ca5a){logger[_0xc6bf('0x15')](_0x41ca5a);return _0x5ca782[_0xc6bf('0x12')](0x1f4)[_0xc6bf('0x13')](_0x41ca5a);}return _0x5ca782[_0xc6bf('0x12')](0xc8)[_0xc6bf('0x13')]({'output':_0x1e2110});});};exports[_0xc6bf('0x1d')]=function(_0x1cf65d,_0x5a5d51){return pm2[_0xc6bf('0x1d')](_0xc6bf('0x1e'))[_0xc6bf('0x1f')](function(_0x532bc1){logger[_0xc6bf('0x16')](_0xc6bf('0x20'),_0x532bc1);return _0x5a5d51[_0xc6bf('0x12')](0xc8)[_0xc6bf('0x13')]({'output':_0xc6bf('0x21')});})[_0xc6bf('0x22')](function(_0x5abf52){logger['error'](_0x5abf52);return _0x5a5d51[_0xc6bf('0x12')](0x1f4)['json'](_0x5abf52);});};exports[_0xc6bf('0x23')]=function(_0x48adb6,_0x54fb9a){var _0x2806e6=fs[_0xc6bf('0x24')](path[_0xc6bf('0x25')](config[_0xc6bf('0x9')],'server','migrations'));var _0x543ad5=[];for(var _0x4f0234=0x0;_0x4f0234<_0x2806e6[_0xc6bf('0x26')];_0x4f0234++){var _0xf49ed7=_0x2806e6[_0x4f0234][_0xc6bf('0x27')](_0xc6bf('0x28'),'');if(compareVersions(module[_0xc6bf('0xb')][_0xc6bf('0xc')],_0xf49ed7)===-0x1){_0x543ad5[_0xc6bf('0x29')](_0xf49ed7);}}if(_0x543ad5[_0xc6bf('0x26')]){var _0x14146e=_0x543ad5[_0xc6bf('0x2a')](compareVersions);var _0x2ec79e=new Umzug({'storage':_0xc6bf('0x2b'),'storageOptions':{'model':db[_0xc6bf('0x2c')],'modelName':_0xc6bf('0x2c'),'columnName':_0xc6bf('0xc')},'migrations':{'params':[db['sequelize'][_0xc6bf('0x2d')](),db[_0xc6bf('0x2b')][_0xc6bf('0x2e')],function(){throw new Error(_0xc6bf('0x2f'));}],'path':path['join'](config['root'],_0xc6bf('0x30'),_0xc6bf('0x23')),'pattern':/\.js$/}});_0x2ec79e['up']({'migrations':_[_0xc6bf('0x31')](_0x14146e,function(_0x3e3d15){return _0x3e3d15+_0xc6bf('0x28');})})['then'](function(){return _0x54fb9a[_0xc6bf('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xc6bf('0xb')][_0xc6bf('0xc')]+_0xc6bf('0x32')+_[_0xc6bf('0x33')](_0x14146e),'migrations':_[_0xc6bf('0x25')](_0x14146e)});})['catch'](function(_0x1f64d5){if(_0x1f64d5 instanceof db[_0xc6bf('0x2b')]['UniqueConstraintError']){return _0x54fb9a[_0xc6bf('0x12')](0xc8)[_0xc6bf('0x13')]({'output':_0xc6bf('0x34')});}else{return _0x54fb9a['status'](0x1f4)['json'](_0x1f64d5);}});}else{return _0x54fb9a['status'](0xc8)[_0xc6bf('0x13')]({'output':_0xc6bf('0x34')});}}; \ No newline at end of file +var _0xf643=['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','last','catch','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','fetch','tags','latest','2.0.0','status','json','origin','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','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','length','replace','push'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xf643,0x122));var _0x3f64=function(_0xa01eea,_0x12e531){_0xa01eea=_0xa01eea-0x0;var _0x47c05e=_0xf643[_0xa01eea];return _0x47c05e;};'use strict';var Umzug=require(_0x3f64('0x0'));var path=require(_0x3f64('0x1'));var fs=require('fs');var _=require(_0x3f64('0x2'));var pkginfo=require(_0x3f64('0x3'))(module,'version');var compareVersions=require(_0x3f64('0x4'));var exec=require(_0x3f64('0x5'))['exec'];var db=require(_0x3f64('0x6'))['db'];var config=require(_0x3f64('0x7'));var pm2=require(_0x3f64('0x8'));var logger=require(_0x3f64('0x9'))(_0x3f64('0xa'));var git=require(_0x3f64('0xb'))(config[_0x3f64('0xc')]);exports[_0x3f64('0xd')]=function(_0x40b245,_0x2a7c90){var _0x219dcb={'current':module[_0x3f64('0xe')][_0x3f64('0xf')],'phonebar':0x2};if(_0x40b245[_0x3f64('0x10')]&&_0x40b245[_0x3f64('0x10')]['latest']){return git[_0x3f64('0x11')]()[_0x3f64('0x12')](function(_0x8aa885,_0x506f2a){_0x219dcb[_0x3f64('0x13')]=(_0x8aa885?module[_0x3f64('0xe')][_0x3f64('0xf')]:_0x506f2a[_0x3f64('0x13')])||_0x3f64('0x14');return _0x2a7c90[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')](_0x219dcb);});}else{return _0x2a7c90[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')](_0x219dcb);}};exports[_0x3f64('0x11')]=function(_0x4b77e1,_0x3165b6){return git['fetch']([_0x3f64('0x17'),_0x3f64('0x18')],function(_0x3fb0bd){if(_0x3fb0bd){logger[_0x3f64('0x19')](_0x3fb0bd);return _0x3165b6['status'](0x1f4)[_0x3f64('0x16')](_0x3fb0bd);}logger[_0x3f64('0x1a')](_0x3f64('0x1b'));return _0x3165b6[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x1c')});});};exports[_0x3f64('0x1d')]=function(_0x5ac514,_0xbcf1aa){return git[_0x3f64('0x1d')]([_0x3f64('0x1e'),'FETCH_HEAD'],function(_0x628b59){if(_0x628b59){logger['error'](_0x628b59);return _0xbcf1aa['status'](0x1f4)[_0x3f64('0x16')](_0x628b59);}logger[_0x3f64('0x1a')](_0x3f64('0x1f'));return _0xbcf1aa['status'](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x20')});});};exports[_0x3f64('0x21')]=function(_0x5f5507,_0x16b3fd){exec(_0x3f64('0x22'),function(_0x4c725c,_0xc72655,_0x3faf46){logger['info'](_0xc72655);logger['info'](_0x3faf46);if(_0x4c725c){logger['error'](_0x4c725c);return _0x16b3fd[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x4c725c);}return _0x16b3fd[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0xc72655});});};exports[_0x3f64('0x23')]=function(_0x48be0c,_0x222097){return pm2[_0x3f64('0x23')](_0x3f64('0x24'))[_0x3f64('0x25')](function(_0x383780){logger[_0x3f64('0x1a')](_0x3f64('0x26'),_0x383780);return _0x222097[_0x3f64('0x15')](0xc8)['json']({'output':_0x3f64('0x27')});})['catch'](function(_0x473b46){logger[_0x3f64('0x19')](_0x473b46);return _0x222097[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x473b46);});};exports[_0x3f64('0x28')]=function(_0x307efc,_0x286b2a){var _0x1bcefe=fs[_0x3f64('0x29')](path[_0x3f64('0x2a')](config['root'],'server',_0x3f64('0x28')));var _0x5a03a8=[];for(var _0x34e8cc=0x0;_0x34e8cc<_0x1bcefe[_0x3f64('0x2b')];_0x34e8cc++){var _0x211da2=_0x1bcefe[_0x34e8cc][_0x3f64('0x2c')]('.js','');if(compareVersions(module['exports'][_0x3f64('0xf')],_0x211da2)===-0x1){_0x5a03a8[_0x3f64('0x2d')](_0x211da2);}}if(_0x5a03a8[_0x3f64('0x2b')]){var _0x2a2579=_0x5a03a8['sort'](compareVersions);var _0x1ee952=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x3f64('0xf')},'migrations':{'params':[db['sequelize'][_0x3f64('0x2e')](),db['sequelize'][_0x3f64('0x2f')],function(){throw new Error(_0x3f64('0x30'));}],'path':path[_0x3f64('0x2a')](config[_0x3f64('0xc')],'server',_0x3f64('0x28')),'pattern':/\.js$/}});_0x1ee952['up']({'migrations':_[_0x3f64('0x31')](_0x2a2579,function(_0x2fe6b5){return _0x2fe6b5+'.js';})})['then'](function(){return _0x286b2a[_0x3f64('0x15')](0xc8)['json']({'output':_0x3f64('0x32')+module[_0x3f64('0xe')][_0x3f64('0xf')]+'\x20to\x20'+_[_0x3f64('0x33')](_0x2a2579),'migrations':_[_0x3f64('0x2a')](_0x2a2579)});})[_0x3f64('0x34')](function(_0x4210c6){if(_0x4210c6 instanceof db[_0x3f64('0x35')][_0x3f64('0x36')]){return _0x286b2a[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x37')});}else{return _0x286b2a[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x4210c6);}});}else{return _0x286b2a[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7f3d758..0c9db2b 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 _0x1bf3=['Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0x1bf3,0xcd));var _0x31bf=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1bf3[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x31bf('0x0'));var util=require(_0x31bf('0x1'));var path=require(_0x31bf('0x2'));var timeout=require(_0x31bf('0x3'));var express=require(_0x31bf('0x4'));var router=express[_0x31bf('0x5')]();var auth=require(_0x31bf('0x6'));var interaction=require(_0x31bf('0x7'));var config=require('../../config/environment');var controller=require(_0x31bf('0x8'));router[_0x31bf('0x9')]('/',auth[_0x31bf('0xa')](),controller['index']);router[_0x31bf('0x9')](_0x31bf('0xb'),auth[_0x31bf('0xa')](),controller[_0x31bf('0xc')]);router[_0x31bf('0x9')](_0x31bf('0xd'),auth[_0x31bf('0xa')](),controller[_0x31bf('0xe')]);router[_0x31bf('0xf')]('/',auth['isAuthenticated'](),controller[_0x31bf('0x10')]);router[_0x31bf('0x11')](_0x31bf('0xd'),auth[_0x31bf('0xa')](),controller[_0x31bf('0x12')]);router[_0x31bf('0x13')](_0x31bf('0xd'),auth[_0x31bf('0xa')](),controller['destroy']);module[_0x31bf('0x14')]=router; \ No newline at end of file +var _0xe06c=['create','put','/:id','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','index','get','/describe','isAuthenticated','describe','post'];(function(_0x24b605,_0x13fdcb){var _0x27e13d=function(_0x2b7716){while(--_0x2b7716){_0x24b605['push'](_0x24b605['shift']());}};_0x27e13d(++_0x13fdcb);}(_0xe06c,0xe9));var _0xce06=function(_0x30c70f,_0x3d7f8c){_0x30c70f=_0x30c70f-0x0;var _0x4b2165=_0xe06c[_0x30c70f];return _0x4b2165;};'use strict';var multer=require('multer');var util=require(_0xce06('0x0'));var path=require(_0xce06('0x1'));var timeout=require(_0xce06('0x2'));var express=require(_0xce06('0x3'));var router=express[_0xce06('0x4')]();var auth=require(_0xce06('0x5'));var interaction=require(_0xce06('0x6'));var config=require('../../config/environment');var controller=require(_0xce06('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xce06('0x8')]);router[_0xce06('0x9')](_0xce06('0xa'),auth[_0xce06('0xb')](),controller[_0xce06('0xc')]);router[_0xce06('0x9')]('/:id',auth[_0xce06('0xb')](),controller['show']);router[_0xce06('0xd')]('/',auth['isAuthenticated'](),controller[_0xce06('0xe')]);router[_0xce06('0xf')](_0xce06('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xce06('0x11')]('/:id',auth[_0xce06('0xb')](),controller[_0xce06('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index e1b9c44..7f30073 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 _0xeda8=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xeda8,0x104));var _0x8eda=function(_0x214d3f,_0x2b96b0){_0x214d3f=_0x214d3f-0x0;var _0x352131=_0xeda8[_0x214d3f];return _0x352131;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eda('0x2')]},'calleridnum':{'type':Sequelize[_0x8eda('0x2')]},'calleridname':{'type':Sequelize[_0x8eda('0x2')]},'queue':{'type':Sequelize[_0x8eda('0x2')]},'interface':{'type':Sequelize[_0x8eda('0x2')]},'membername':{'type':Sequelize[_0x8eda('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eda('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eda('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8eda('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8eda('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eda('0x3')]},'holdtime':{'type':Sequelize[_0x8eda('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eda('0x4')]},'agentacw':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x8eda('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8eda('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eda('0x2')]},'exten':{'type':Sequelize[_0x8eda('0x2')]},'priority':{'type':Sequelize[_0x8eda('0x2')]},'destchannel':{'type':Sequelize[_0x8eda('0x2')]},'destchannelstate':{'type':Sequelize[_0x8eda('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eda('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eda('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eda('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8eda('0x2')]},'destpriority':{'type':Sequelize[_0x8eda('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eda('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x8eda('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eda('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x8eda('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x8eda('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7dfd=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x514078,_0x3ab9f3){var _0x31b7fc=function(_0x26906d){while(--_0x26906d){_0x514078['push'](_0x514078['shift']());}};_0x31b7fc(++_0x3ab9f3);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'type':{'type':Sequelize[_0xd7df('0x2')]},'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'calleridnum':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'queue':{'type':Sequelize[_0xd7df('0x2')]},'interface':{'type':Sequelize[_0xd7df('0x2')]},'membername':{'type':Sequelize[_0xd7df('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd7df('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd7df('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd7df('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd7df('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd7df('0x3')]},'holdtime':{'type':Sequelize[_0xd7df('0x4')]},'agentcomplete':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd7df('0x4')]},'agentacw':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd7df('0x4')]},'reason':{'type':Sequelize[_0xd7df('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd7df('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd7df('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd7df('0x2')]},'language':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'exten':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'destchannel':{'type':Sequelize[_0xd7df('0x2')]},'destchannelstate':{'type':Sequelize[_0xd7df('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd7df('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd7df('0x2')]},'destcalleridname':{'type':Sequelize[_0xd7df('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd7df('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd7df('0x2')]},'destlanguage':{'type':Sequelize[_0xd7df('0x2')]},'destaccountcode':{'type':Sequelize[_0xd7df('0x2')]},'destcontext':{'type':Sequelize[_0xd7df('0x2')]},'destexten':{'type':Sequelize[_0xd7df('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd7df('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd7df('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd7df('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd7df('0x2')]},'agententerreason':{'type':Sequelize[_0xd7df('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index ec94a84..45212f3 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 _0x9c6a=['util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceAgentReport','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x4b2366,_0x2bc6e4){var _0x3dbcd9=function(_0x2ea496){while(--_0x2ea496){_0x4b2366['push'](_0x4b2366['shift']());}};_0x3dbcd9(++_0x2bc6e4);}(_0x9c6a,0x1c2));var _0xa9c6=function(_0x288264,_0x28bd9a){_0x288264=_0x288264-0x0;var _0x213964=_0x9c6a[_0x288264];return _0x213964;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa9c6('0x0'));var rimraf=require(_0xa9c6('0x1'));var zipdir=require(_0xa9c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9c6('0x3'));var moment=require(_0xa9c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa9c6('0x5'));var util=require(_0xa9c6('0x6'));var path=require(_0xa9c6('0x7'));var sox=require(_0xa9c6('0x8'));var csv=require(_0xa9c6('0x9'));var ejs=require(_0xa9c6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa9c6('0xb'));var crypto=require(_0xa9c6('0xc'));var jsforce=require(_0xa9c6('0xd'));var deskjs=require(_0xa9c6('0xe'));var toCsv=require(_0xa9c6('0x9'));var querystring=require(_0xa9c6('0xf'));var Papa=require(_0xa9c6('0x10'));var Redis=require(_0xa9c6('0x11'));var authService=require(_0xa9c6('0x12'));var qs=require(_0xa9c6('0x13'));var as=require(_0xa9c6('0x14'));var hardwareService=require(_0xa9c6('0x15'));var logger=require(_0xa9c6('0x16'))(_0xa9c6('0x17'));var utils=require(_0xa9c6('0x18'));var config=require(_0xa9c6('0x19'));var db=require(_0xa9c6('0x1a'))['db'];function respondWithStatusCode(_0x192518,_0x333456){_0x333456=_0x333456||0xcc;return function(_0x5dff33){if(_0x5dff33){return _0x192518['sendStatus'](_0x333456);}return _0x192518[_0xa9c6('0x1b')](_0x333456)['end']();};}function respondWithResult(_0x39ad63,_0x3b4ffc){_0x3b4ffc=_0x3b4ffc||0xc8;return function(_0x938472){if(_0x938472){return _0x39ad63['status'](_0x3b4ffc)[_0xa9c6('0x1c')](_0x938472);}};}function respondWithFilteredResult(_0xd371c4,_0x5edd3a){return function(_0xf42125){if(_0xf42125){var _0x237e2a=_0xf42125[_0xa9c6('0x1d')],_0x2d5ae7=_0x5edd3a[_0xa9c6('0x1e')],_0x1905a4=_0x5edd3a['offset']+_0x5edd3a[_0xa9c6('0x1f')],_0xdfcad6;if(_0x1905a4>=_0x237e2a){_0x1905a4=_0x237e2a;_0xdfcad6=0xc8;}else{_0xdfcad6=0xce;}_0xd371c4[_0xa9c6('0x1b')](_0xdfcad6);return _0xd371c4[_0xa9c6('0x20')]('Content-Range',_0x2d5ae7+'-'+_0x1905a4+'/'+_0x237e2a)[_0xa9c6('0x1c')](_0xf42125);}return null;};}function patchUpdates(_0x3bb3ac){return function(_0x42ae4d){try{jsonpatch[_0xa9c6('0x21')](_0x42ae4d,_0x3bb3ac,!![]);}catch(_0x44efc7){return BPromise[_0xa9c6('0x22')](_0x44efc7);}return _0x42ae4d[_0xa9c6('0x23')]();};}function saveUpdates(_0x5a8913,_0x770503){return function(_0xdffb2b){if(_0xdffb2b){return _0xdffb2b[_0xa9c6('0x24')](_0x5a8913)[_0xa9c6('0x25')](function(_0x52f3cb){return _0x52f3cb;});}return null;};}function removeEntity(_0x587402,_0x2942d3){return function(_0x1e0efb){if(_0x1e0efb){return _0x1e0efb[_0xa9c6('0x26')]()[_0xa9c6('0x25')](function(){_0x587402[_0xa9c6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a301,_0x599ab6){return function(_0x3b92a6){if(!_0x3b92a6){_0x54a301['sendStatus'](0x194);}return _0x3b92a6;};}function handleError(_0x193940,_0x2e46cc){_0x2e46cc=_0x2e46cc||0x1f4;return function(_0x34f48e){logger[_0xa9c6('0x27')](_0x34f48e[_0xa9c6('0x28')]);if(_0x34f48e['name']){delete _0x34f48e[_0xa9c6('0x29')];}_0x193940['status'](_0x2e46cc)[_0xa9c6('0x2a')](_0x34f48e);};}exports[_0xa9c6('0x2b')]=function(_0x154d9c,_0x23e2a9){var _0x484465={},_0x1574c7={},_0x3d3a3c={'count':0x0,'rows':[]};var _0x524e4d=_[_0xa9c6('0x2c')](db[_0xa9c6('0x2d')]['rawAttributes'],function(_0x4d1525){return{'name':_0x4d1525[_0xa9c6('0x2e')],'type':_0x4d1525[_0xa9c6('0x2f')][_0xa9c6('0x30')]};});_0x1574c7[_0xa9c6('0x31')]=_['map'](_0x524e4d,_0xa9c6('0x29'));_0x1574c7['query']=_[_0xa9c6('0x32')](_0x154d9c['query']);_0x1574c7[_0xa9c6('0x33')]=_['intersection'](_0x1574c7['model'],_0x1574c7[_0xa9c6('0x34')]);_0x484465[_0xa9c6('0x35')]=_[_0xa9c6('0x36')](_0x1574c7['model'],qs[_0xa9c6('0x37')](_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x37')]));_0x484465[_0xa9c6('0x35')]=_0x484465[_0xa9c6('0x35')][_0xa9c6('0x38')]?_0x484465['attributes']:_0x1574c7[_0xa9c6('0x31')];if(!_0x154d9c[_0xa9c6('0x34')]['hasOwnProperty'](_0xa9c6('0x39'))){_0x484465[_0xa9c6('0x1f')]=qs[_0xa9c6('0x1f')](_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x1f')]);_0x484465['offset']=qs['offset'](_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x1e')]);}_0x484465['order']=qs[_0xa9c6('0x3a')](_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x3a')]);_0x484465[_0xa9c6('0x3b')]=qs[_0xa9c6('0x33')](_[_0xa9c6('0x3c')](_0x154d9c[_0xa9c6('0x34')],_0x1574c7[_0xa9c6('0x33')]),_0x524e4d);if(_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x3d')]){_0x484465[_0xa9c6('0x3b')]=_[_0xa9c6('0x3e')](_0x484465['where'],{'$or':_[_0xa9c6('0x2c')](_0x524e4d,function(_0x2467b4){if(_0x2467b4['type']!=='VIRTUAL'){var _0xaa412a={};_0xaa412a[_0x2467b4[_0xa9c6('0x29')]]={'$like':'%'+_0x154d9c[_0xa9c6('0x34')][_0xa9c6('0x3d')]+'%'};return _0xaa412a;}})});}_0x484465=_[_0xa9c6('0x3e')]({},_0x484465,_0x154d9c[_0xa9c6('0x3f')]);var _0x26e8e={'where':_0x484465[_0xa9c6('0x3b')]};return db['VoiceAgentReport'][_0xa9c6('0x1d')](_0x26e8e)[_0xa9c6('0x25')](function(_0x483b79){_0x3d3a3c['count']=_0x483b79;if(_0x154d9c['query'][_0xa9c6('0x40')]){_0x484465[_0xa9c6('0x41')]=[{'all':!![]}];}return db[_0xa9c6('0x2d')][_0xa9c6('0x42')](_0x484465);})[_0xa9c6('0x25')](function(_0x26e26f){_0x3d3a3c[_0xa9c6('0x43')]=_0x26e26f;return _0x3d3a3c;})[_0xa9c6('0x25')](respondWithFilteredResult(_0x23e2a9,_0x484465))[_0xa9c6('0x44')](handleError(_0x23e2a9,null));};exports[_0xa9c6('0x45')]=function(_0x3410dd,_0x559a04){var _0x35546b={'raw':![],'where':{'id':_0x3410dd[_0xa9c6('0x46')]['id']}},_0x31ae99={};_0x31ae99[_0xa9c6('0x31')]=_['keys'](db[_0xa9c6('0x2d')][_0xa9c6('0x47')]);_0x31ae99['query']=_[_0xa9c6('0x32')](_0x3410dd[_0xa9c6('0x34')]);_0x31ae99[_0xa9c6('0x33')]=_[_0xa9c6('0x36')](_0x31ae99[_0xa9c6('0x31')],_0x31ae99['query']);_0x35546b[_0xa9c6('0x35')]=_['intersection'](_0x31ae99[_0xa9c6('0x31')],qs[_0xa9c6('0x37')](_0x3410dd[_0xa9c6('0x34')][_0xa9c6('0x37')]));_0x35546b[_0xa9c6('0x35')]=_0x35546b['attributes'][_0xa9c6('0x38')]?_0x35546b[_0xa9c6('0x35')]:_0x31ae99[_0xa9c6('0x31')];if(_0x3410dd[_0xa9c6('0x34')][_0xa9c6('0x40')]){_0x35546b['include']=[{'all':!![]}];}_0x35546b=_[_0xa9c6('0x3e')]({},_0x35546b,_0x3410dd['options']);return db[_0xa9c6('0x2d')][_0xa9c6('0x48')](_0x35546b)[_0xa9c6('0x25')](handleEntityNotFound(_0x559a04,null))['then'](respondWithResult(_0x559a04,null))[_0xa9c6('0x44')](handleError(_0x559a04,null));};exports['create']=function(_0x5c3ed2,_0x4c76ab){return db['VoiceAgentReport'][_0xa9c6('0x49')](_0x5c3ed2[_0xa9c6('0x4a')],{})['then'](respondWithResult(_0x4c76ab,0xc9))[_0xa9c6('0x44')](handleError(_0x4c76ab,null));};exports[_0xa9c6('0x24')]=function(_0x39c1e0,_0x43ee40){if(_0x39c1e0['body']['id']){delete _0x39c1e0[_0xa9c6('0x4a')]['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x39c1e0['params']['id']}})['then'](handleEntityNotFound(_0x43ee40,null))[_0xa9c6('0x25')](saveUpdates(_0x39c1e0[_0xa9c6('0x4a')],null))[_0xa9c6('0x25')](respondWithResult(_0x43ee40,null))[_0xa9c6('0x44')](handleError(_0x43ee40,null));};exports[_0xa9c6('0x26')]=function(_0x14b0ed,_0x5012e4){return db[_0xa9c6('0x2d')]['find']({'where':{'id':_0x14b0ed[_0xa9c6('0x46')]['id']}})[_0xa9c6('0x25')](handleEntityNotFound(_0x5012e4,null))[_0xa9c6('0x25')](removeEntity(_0x5012e4,null))[_0xa9c6('0x44')](handleError(_0x5012e4,null));};exports[_0xa9c6('0x4b')]=function(_0x312ca2,_0x537e4b){return db['VoiceAgentReport'][_0xa9c6('0x4b')]()[_0xa9c6('0x25')](respondWithResult(_0x537e4b,null))[_0xa9c6('0x44')](handleError(_0x537e4b,null));}; \ No newline at end of file +var _0x5e04=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','VoiceAgentReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x29ed7c,_0x1e04c9){var _0x3c20ab=function(_0x1d94f8){while(--_0x1d94f8){_0x29ed7c['push'](_0x29ed7c['shift']());}};_0x3c20ab(++_0x1e04c9);}(_0x5e04,0xd2));var _0x45e0=function(_0xdc4996,_0x15bedc){_0xdc4996=_0xdc4996-0x0;var _0x20fbb9=_0x5e04[_0xdc4996];return _0x20fbb9;};'use strict';var pdf=require(_0x45e0('0x0'));var emlformat=require(_0x45e0('0x1'));var rimraf=require(_0x45e0('0x2'));var zipdir=require(_0x45e0('0x3'));var jsonpatch=require(_0x45e0('0x4'));var rp=require(_0x45e0('0x5'));var moment=require(_0x45e0('0x6'));var BPromise=require(_0x45e0('0x7'));var Mustache=require(_0x45e0('0x8'));var util=require('util');var path=require(_0x45e0('0x9'));var sox=require(_0x45e0('0xa'));var csv=require(_0x45e0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x45e0('0xc'));var squel=require(_0x45e0('0xd'));var crypto=require(_0x45e0('0xe'));var jsforce=require(_0x45e0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x45e0('0xb'));var querystring=require(_0x45e0('0x10'));var Papa=require(_0x45e0('0x11'));var Redis=require(_0x45e0('0x12'));var authService=require(_0x45e0('0x13'));var qs=require(_0x45e0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45e0('0x15'));var logger=require(_0x45e0('0x16'))('api');var utils=require(_0x45e0('0x17'));var config=require(_0x45e0('0x18'));var db=require(_0x45e0('0x19'))['db'];function respondWithStatusCode(_0x272801,_0x23bd09){_0x23bd09=_0x23bd09||0xcc;return function(_0x10f3ac){if(_0x10f3ac){return _0x272801['sendStatus'](_0x23bd09);}return _0x272801[_0x45e0('0x1a')](_0x23bd09)[_0x45e0('0x1b')]();};}function respondWithResult(_0x531653,_0x51ceff){_0x51ceff=_0x51ceff||0xc8;return function(_0x537506){if(_0x537506){return _0x531653[_0x45e0('0x1a')](_0x51ceff)[_0x45e0('0x1c')](_0x537506);}};}function respondWithFilteredResult(_0x5b54f0,_0x22b637){return function(_0x59e955){if(_0x59e955){var _0x30f638=_0x59e955['count'],_0x542a58=_0x22b637[_0x45e0('0x1d')],_0xd68be3=_0x22b637[_0x45e0('0x1d')]+_0x22b637[_0x45e0('0x1e')],_0x5d63e1;if(_0xd68be3>=_0x30f638){_0xd68be3=_0x30f638;_0x5d63e1=0xc8;}else{_0x5d63e1=0xce;}_0x5b54f0[_0x45e0('0x1a')](_0x5d63e1);return _0x5b54f0[_0x45e0('0x1f')](_0x45e0('0x20'),_0x542a58+'-'+_0xd68be3+'/'+_0x30f638)[_0x45e0('0x1c')](_0x59e955);}return null;};}function patchUpdates(_0x569ee1){return function(_0x591c38){try{jsonpatch[_0x45e0('0x21')](_0x591c38,_0x569ee1,!![]);}catch(_0x53fc5b){return BPromise[_0x45e0('0x22')](_0x53fc5b);}return _0x591c38[_0x45e0('0x23')]();};}function saveUpdates(_0x48dc55,_0x513df6){return function(_0x104724){if(_0x104724){return _0x104724[_0x45e0('0x24')](_0x48dc55)[_0x45e0('0x25')](function(_0x546dfe){return _0x546dfe;});}return null;};}function removeEntity(_0x416918,_0xbc2482){return function(_0x1a81ee){if(_0x1a81ee){return _0x1a81ee[_0x45e0('0x26')]()[_0x45e0('0x25')](function(){_0x416918['status'](0xcc)[_0x45e0('0x1b')]();});}};}function handleEntityNotFound(_0x9a3926,_0x2b4350){return function(_0x3e3b2d){if(!_0x3e3b2d){_0x9a3926[_0x45e0('0x27')](0x194);}return _0x3e3b2d;};}function handleError(_0x297ffc,_0x1f9474){_0x1f9474=_0x1f9474||0x1f4;return function(_0x15b21a){logger['error'](_0x15b21a['stack']);if(_0x15b21a[_0x45e0('0x28')]){delete _0x15b21a[_0x45e0('0x28')];}_0x297ffc[_0x45e0('0x1a')](_0x1f9474)[_0x45e0('0x29')](_0x15b21a);};}exports[_0x45e0('0x2a')]=function(_0x42b445,_0x188137){var _0x320cbc={},_0x13f94c={},_0x4664f8={'count':0x0,'rows':[]};var _0x4e225a=_['map'](db[_0x45e0('0x2b')][_0x45e0('0x2c')],function(_0x22211e){return{'name':_0x22211e[_0x45e0('0x2d')],'type':_0x22211e[_0x45e0('0x2e')][_0x45e0('0x2f')]};});_0x13f94c[_0x45e0('0x30')]=_[_0x45e0('0x31')](_0x4e225a,_0x45e0('0x28'));_0x13f94c['query']=_[_0x45e0('0x32')](_0x42b445[_0x45e0('0x33')]);_0x13f94c[_0x45e0('0x34')]=_[_0x45e0('0x35')](_0x13f94c[_0x45e0('0x30')],_0x13f94c['query']);_0x320cbc['attributes']=_[_0x45e0('0x35')](_0x13f94c[_0x45e0('0x30')],qs[_0x45e0('0x36')](_0x42b445[_0x45e0('0x33')][_0x45e0('0x36')]));_0x320cbc[_0x45e0('0x37')]=_0x320cbc[_0x45e0('0x37')][_0x45e0('0x38')]?_0x320cbc[_0x45e0('0x37')]:_0x13f94c[_0x45e0('0x30')];if(!_0x42b445['query']['hasOwnProperty'](_0x45e0('0x39'))){_0x320cbc[_0x45e0('0x1e')]=qs[_0x45e0('0x1e')](_0x42b445[_0x45e0('0x33')][_0x45e0('0x1e')]);_0x320cbc[_0x45e0('0x1d')]=qs[_0x45e0('0x1d')](_0x42b445[_0x45e0('0x33')]['offset']);}_0x320cbc[_0x45e0('0x3a')]=qs[_0x45e0('0x3b')](_0x42b445[_0x45e0('0x33')]['sort']);_0x320cbc['where']=qs[_0x45e0('0x34')](_[_0x45e0('0x3c')](_0x42b445['query'],_0x13f94c[_0x45e0('0x34')]),_0x4e225a);if(_0x42b445[_0x45e0('0x33')][_0x45e0('0x3d')]){_0x320cbc[_0x45e0('0x3e')]=_[_0x45e0('0x3f')](_0x320cbc[_0x45e0('0x3e')],{'$or':_[_0x45e0('0x31')](_0x4e225a,function(_0xaa0eab){if(_0xaa0eab[_0x45e0('0x2e')]!==_0x45e0('0x40')){var _0x352c2f={};_0x352c2f[_0xaa0eab[_0x45e0('0x28')]]={'$like':'%'+_0x42b445['query'][_0x45e0('0x3d')]+'%'};return _0x352c2f;}})});}_0x320cbc=_[_0x45e0('0x3f')]({},_0x320cbc,_0x42b445['options']);var _0x6c99ec={'where':_0x320cbc[_0x45e0('0x3e')]};return db[_0x45e0('0x2b')][_0x45e0('0x41')](_0x6c99ec)['then'](function(_0x1170b1){_0x4664f8[_0x45e0('0x41')]=_0x1170b1;if(_0x42b445['query'][_0x45e0('0x42')]){_0x320cbc[_0x45e0('0x43')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x45e0('0x44')](_0x320cbc);})[_0x45e0('0x25')](function(_0x343c52){_0x4664f8['rows']=_0x343c52;return _0x4664f8;})[_0x45e0('0x25')](respondWithFilteredResult(_0x188137,_0x320cbc))[_0x45e0('0x45')](handleError(_0x188137,null));};exports[_0x45e0('0x46')]=function(_0x549624,_0x3fc587){var _0x5be72f={'raw':![],'where':{'id':_0x549624[_0x45e0('0x47')]['id']}},_0x492f20={};_0x492f20[_0x45e0('0x30')]=_[_0x45e0('0x32')](db[_0x45e0('0x2b')]['rawAttributes']);_0x492f20[_0x45e0('0x33')]=_[_0x45e0('0x32')](_0x549624[_0x45e0('0x33')]);_0x492f20[_0x45e0('0x34')]=_['intersection'](_0x492f20[_0x45e0('0x30')],_0x492f20['query']);_0x5be72f[_0x45e0('0x37')]=_[_0x45e0('0x35')](_0x492f20[_0x45e0('0x30')],qs['fields'](_0x549624[_0x45e0('0x33')][_0x45e0('0x36')]));_0x5be72f[_0x45e0('0x37')]=_0x5be72f['attributes'][_0x45e0('0x38')]?_0x5be72f['attributes']:_0x492f20[_0x45e0('0x30')];if(_0x549624[_0x45e0('0x33')][_0x45e0('0x42')]){_0x5be72f[_0x45e0('0x43')]=[{'all':!![]}];}_0x5be72f=_['merge']({},_0x5be72f,_0x549624[_0x45e0('0x48')]);return db['VoiceAgentReport'][_0x45e0('0x49')](_0x5be72f)[_0x45e0('0x25')](handleEntityNotFound(_0x3fc587,null))['then'](respondWithResult(_0x3fc587,null))[_0x45e0('0x45')](handleError(_0x3fc587,null));};exports[_0x45e0('0x4a')]=function(_0x21c136,_0xb33521){return db[_0x45e0('0x2b')]['create'](_0x21c136[_0x45e0('0x4b')],{})[_0x45e0('0x25')](respondWithResult(_0xb33521,0xc9))[_0x45e0('0x45')](handleError(_0xb33521,null));};exports[_0x45e0('0x24')]=function(_0x4d1dfe,_0x275fe2){if(_0x4d1dfe['body']['id']){delete _0x4d1dfe['body']['id'];}return db[_0x45e0('0x2b')]['find']({'where':{'id':_0x4d1dfe['params']['id']}})[_0x45e0('0x25')](handleEntityNotFound(_0x275fe2,null))[_0x45e0('0x25')](saveUpdates(_0x4d1dfe[_0x45e0('0x4b')],null))[_0x45e0('0x25')](respondWithResult(_0x275fe2,null))[_0x45e0('0x45')](handleError(_0x275fe2,null));};exports[_0x45e0('0x26')]=function(_0x3514ca,_0x23780c){return db[_0x45e0('0x2b')][_0x45e0('0x49')]({'where':{'id':_0x3514ca['params']['id']}})[_0x45e0('0x25')](handleEntityNotFound(_0x23780c,null))[_0x45e0('0x25')](removeEntity(_0x23780c,null))['catch'](handleError(_0x23780c,null));};exports[_0x45e0('0x4c')]=function(_0x16a022,_0x2ce465){return db['VoiceAgentReport'][_0x45e0('0x4c')]()[_0x45e0('0x25')](respondWithResult(_0x2ce465,null))['catch'](handleError(_0x2ce465,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 1ae7d25..31552e6 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 _0x0713=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3071('0xc'),_0x3071('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x413f1e,_0x2ed046){var _0x319bd2=function(_0x28411c){while(--_0x28411c){_0x413f1e['push'](_0x413f1e['shift']());}};_0x319bd2(++_0x2ed046);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xcb91[_0x4c7935];return _0x30651d;};'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')]('VoiceAgentReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb9('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 053b524..a0afd51 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 _0xebbe=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','update','raw','where','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x260893,_0x49810e){var _0x30f503=function(_0x31dd49){while(--_0x31dd49){_0x260893['push'](_0x260893['shift']());}};_0x30f503(++_0x49810e);}(_0xebbe,0xe3));var _0xeebb=function(_0x8dcbad,_0x1b6c41){_0x8dcbad=_0x8dcbad-0x0;var _0x44921d=_0xebbe[_0x8dcbad];return _0x44921d;};'use strict';var _=require('lodash');var util=require(_0xeebb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeebb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeebb('0x2'));var logger=require(_0xeebb('0x3'))(_0xeebb('0x4'));var config=require(_0xeebb('0x5'));var jayson=require(_0xeebb('0x6'));var client=jayson['client'][_0xeebb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f2513,_0x463b08,_0x5d1a94){return new BPromise(function(_0x3fbda6,_0x1d8e96){return client[_0xeebb('0x8')](_0x5f2513,_0x5d1a94)[_0xeebb('0x9')](function(_0x126bfb){logger[_0xeebb('0xa')](_0xeebb('0xb'),_0x463b08,_0xeebb('0xc'));logger['debug'](_0xeebb('0xd'),_0x463b08,'request\x20sent',JSON[_0xeebb('0xe')](_0x126bfb));if(_0x126bfb['error']){if(_0x126bfb['error'][_0xeebb('0xf')]===0x1f4){logger[_0xeebb('0x10')](_0xeebb('0xb'),_0x463b08,_0x126bfb[_0xeebb('0x10')][_0xeebb('0x11')]);return _0x1d8e96(_0x126bfb[_0xeebb('0x10')][_0xeebb('0x11')]);}logger[_0xeebb('0x10')](_0xeebb('0xb'),_0x463b08,_0x126bfb['error']['message']);return _0x3fbda6(_0x126bfb[_0xeebb('0x10')][_0xeebb('0x11')]);}else{logger[_0xeebb('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x463b08,'request\x20sent');_0x3fbda6(_0x126bfb[_0xeebb('0x12')][_0xeebb('0x11')]);}})[_0xeebb('0x13')](function(_0x39ba6a){logger[_0xeebb('0x10')](_0xeebb('0xb'),_0x463b08,_0x39ba6a);_0x1d8e96(_0x39ba6a);});});}exports['CreateVoiceAgentReport']=function(_0x399e9a){var _0xf21076=this;return new Promise(function(_0x505c54,_0x5af9da){return db[_0xeebb('0x14')][_0xeebb('0x15')](_0x399e9a[_0xeebb('0x16')],{'raw':_0x399e9a[_0xeebb('0x17')]?_0x399e9a[_0xeebb('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xeebb('0x9')](function(_0x45bfcb){logger[_0xeebb('0xa')](_0xeebb('0x18'),_0x399e9a);logger[_0xeebb('0x19')](_0xeebb('0x18'),_0x399e9a,JSON[_0xeebb('0xe')](_0x45bfcb));_0x505c54(_0x45bfcb);})['catch'](function(_0x5b7a16){logger[_0xeebb('0x10')](_0xeebb('0x18'),_0x5b7a16[_0xeebb('0x11')],_0x399e9a);_0x5af9da(_0xf21076['error'](0x1f4,_0x5b7a16[_0xeebb('0x11')]));});});};exports[_0xeebb('0x1a')]=function(_0x3972ca){var _0x4be21a=this;return new Promise(function(_0x422d7a,_0x2b5556){return db[_0xeebb('0x14')][_0xeebb('0x1b')](_0x3972ca[_0xeebb('0x16')],{'raw':_0x3972ca[_0xeebb('0x17')]?_0x3972ca[_0xeebb('0x17')][_0xeebb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3972ca[_0xeebb('0x17')]?_0x3972ca[_0xeebb('0x17')][_0xeebb('0x1d')]||null:null,'attributes':_0x3972ca['options']?_0x3972ca[_0xeebb('0x17')]['attributes']||null:null,'limit':_0x3972ca[_0xeebb('0x17')]?_0x3972ca[_0xeebb('0x17')]['limit']||null:null})[_0xeebb('0x9')](function(_0x483c6){logger['info']('UpdateVoiceAgentReport',_0x3972ca);logger[_0xeebb('0x19')]('UpdateVoiceAgentReport',_0x3972ca,JSON['stringify'](_0x483c6));_0x422d7a(_0x483c6);})[_0xeebb('0x13')](function(_0x424a9e){logger[_0xeebb('0x10')](_0xeebb('0x1a'),_0x424a9e[_0xeebb('0x11')],_0x3972ca);_0x2b5556(_0x4be21a['error'](0x1f4,_0x424a9e[_0xeebb('0x11')]));});});}; \ No newline at end of file +var _0x4788=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x4788,0x13e));var _0x8478=function(_0x208218,_0x3fc62e){_0x208218=_0x208218-0x0;var _0x4ecec8=_0x4788[_0x208218];return _0x4ecec8;};'use strict';var _=require(_0x8478('0x0'));var util=require(_0x8478('0x1'));var moment=require(_0x8478('0x2'));var BPromise=require('bluebird');var rs=require(_0x8478('0x3'));var fs=require('fs');var Redis=require(_0x8478('0x4'));var db=require(_0x8478('0x5'))['db'];var utils=require(_0x8478('0x6'));var logger=require(_0x8478('0x7'))(_0x8478('0x8'));var config=require(_0x8478('0x9'));var jayson=require(_0x8478('0xa'));var client=jayson[_0x8478('0xb')][_0x8478('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dd28c,_0x42570d,_0xe93107){return new BPromise(function(_0x24ebd5,_0x903882){return client[_0x8478('0xd')](_0x5dd28c,_0xe93107)['then'](function(_0x3b00cd){logger[_0x8478('0xe')](_0x8478('0xf'),_0x42570d,_0x8478('0x10'));logger[_0x8478('0x11')](_0x8478('0x12'),_0x42570d,_0x8478('0x10'),JSON[_0x8478('0x13')](_0x3b00cd));if(_0x3b00cd[_0x8478('0x14')]){if(_0x3b00cd[_0x8478('0x14')][_0x8478('0x15')]===0x1f4){logger[_0x8478('0x14')](_0x8478('0xf'),_0x42570d,_0x3b00cd[_0x8478('0x14')][_0x8478('0x16')]);return _0x903882(_0x3b00cd[_0x8478('0x14')][_0x8478('0x16')]);}logger[_0x8478('0x14')](_0x8478('0xf'),_0x42570d,_0x3b00cd[_0x8478('0x14')][_0x8478('0x16')]);return _0x24ebd5(_0x3b00cd[_0x8478('0x14')][_0x8478('0x16')]);}else{logger['info'](_0x8478('0xf'),_0x42570d,_0x8478('0x10'));_0x24ebd5(_0x3b00cd[_0x8478('0x17')][_0x8478('0x16')]);}})[_0x8478('0x18')](function(_0x461384){logger[_0x8478('0x14')](_0x8478('0xf'),_0x42570d,_0x461384);_0x903882(_0x461384);});});}exports[_0x8478('0x19')]=function(_0x47a7ca){var _0x1f2299=this;return new Promise(function(_0x398675,_0x106475){return db[_0x8478('0x1a')][_0x8478('0x1b')](_0x47a7ca[_0x8478('0x1c')],{'raw':_0x47a7ca[_0x8478('0x1d')]?_0x47a7ca['options'][_0x8478('0x1e')]===undefined?!![]:![]:!![]})[_0x8478('0x1f')](function(_0x177454){logger['info'](_0x8478('0x19'),_0x47a7ca);logger[_0x8478('0x11')](_0x8478('0x19'),_0x47a7ca,JSON[_0x8478('0x13')](_0x177454));_0x398675(_0x177454);})[_0x8478('0x18')](function(_0x362bac){logger[_0x8478('0x14')](_0x8478('0x19'),_0x362bac[_0x8478('0x16')],_0x47a7ca);_0x106475(_0x1f2299[_0x8478('0x14')](0x1f4,_0x362bac['message']));});});};exports[_0x8478('0x20')]=function(_0x37efe6){var _0x55051d=this;return new Promise(function(_0x4e8a00,_0x210ff8){return db['VoiceAgentReport'][_0x8478('0x21')](_0x37efe6[_0x8478('0x1c')],{'raw':_0x37efe6[_0x8478('0x1d')]?_0x37efe6[_0x8478('0x1d')][_0x8478('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37efe6['options']?_0x37efe6[_0x8478('0x1d')][_0x8478('0x22')]||null:null,'attributes':_0x37efe6[_0x8478('0x1d')]?_0x37efe6[_0x8478('0x1d')][_0x8478('0x23')]||null:null,'limit':_0x37efe6[_0x8478('0x1d')]?_0x37efe6[_0x8478('0x1d')][_0x8478('0x24')]||null:null})[_0x8478('0x1f')](function(_0x1239a3){logger[_0x8478('0xe')](_0x8478('0x20'),_0x37efe6);logger['debug'](_0x8478('0x20'),_0x37efe6,JSON[_0x8478('0x13')](_0x1239a3));_0x4e8a00(_0x1239a3);})[_0x8478('0x18')](function(_0x178145){logger['error']('UpdateVoiceAgentReport',_0x178145[_0x8478('0x16')],_0x37efe6);_0x210ff8(_0x55051d[_0x8478('0x14')](0x1f4,_0x178145[_0x8478('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d18561f..84ba008 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 _0x7ba4=['create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','post'];(function(_0x38182b,_0x5dbf8b){var _0x3d6a8c=function(_0x5ee16f){while(--_0x5ee16f){_0x38182b['push'](_0x38182b['shift']());}};_0x3d6a8c(++_0x5dbf8b);}(_0x7ba4,0x104));var _0x47ba=function(_0x3b79f0,_0x455fc5){_0x3b79f0=_0x3b79f0-0x0;var _0x51bb97=_0x7ba4[_0x3b79f0];return _0x51bb97;};'use strict';var multer=require(_0x47ba('0x0'));var util=require('util');var path=require(_0x47ba('0x1'));var timeout=require(_0x47ba('0x2'));var express=require('express');var router=express[_0x47ba('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x47ba('0x4'));var config=require(_0x47ba('0x5'));var controller=require(_0x47ba('0x6'));router[_0x47ba('0x7')]('/',auth[_0x47ba('0x8')](),controller[_0x47ba('0x9')]);router['get']('/describe',auth[_0x47ba('0x8')](),controller[_0x47ba('0xa')]);router[_0x47ba('0x7')]('/:id',auth[_0x47ba('0x8')](),controller['show']);router[_0x47ba('0xb')]('/',auth[_0x47ba('0x8')](),controller[_0x47ba('0xc')]);router[_0x47ba('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x47ba('0xe')]);router[_0x47ba('0xf')]('/:id',auth[_0x47ba('0x8')](),controller['destroy']);module[_0x47ba('0x10')]=router; \ No newline at end of file +var _0xe21b=['describe','/:id','show','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated'];(function(_0x3352ec,_0x419090){var _0x6ed0cc=function(_0x46f52e){while(--_0x46f52e){_0x3352ec['push'](_0x3352ec['shift']());}};_0x6ed0cc(++_0x419090);}(_0xe21b,0x105));var _0xbe21=function(_0x8fde1,_0x469626){_0x8fde1=_0x8fde1-0x0;var _0x3bf22c=_0xe21b[_0x8fde1];return _0x3bf22c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbe21('0x0'));var timeout=require(_0xbe21('0x1'));var express=require(_0xbe21('0x2'));var router=express[_0xbe21('0x3')]();var auth=require(_0xbe21('0x4'));var interaction=require(_0xbe21('0x5'));var config=require(_0xbe21('0x6'));var controller=require(_0xbe21('0x7'));router[_0xbe21('0x8')]('/',auth['isAuthenticated'](),controller[_0xbe21('0x9')]);router[_0xbe21('0x8')](_0xbe21('0xa'),auth[_0xbe21('0xb')](),controller[_0xbe21('0xc')]);router[_0xbe21('0x8')](_0xbe21('0xd'),auth[_0xbe21('0xb')](),controller[_0xbe21('0xe')]);router[_0xbe21('0xf')]('/',auth[_0xbe21('0xb')](),controller[_0xbe21('0x10')]);router[_0xbe21('0x11')](_0xbe21('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbe21('0x12')](_0xbe21('0xd'),auth[_0xbe21('0xb')](),controller[_0xbe21('0x13')]);module[_0xbe21('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index bcd18bf..eb25584 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(_0x1561b0,_0xec68c3){var _0x11c88e=function(_0x2a9b07){while(--_0x2a9b07){_0x1561b0['push'](_0x1561b0['shift']());}};_0x11c88e(++_0xec68c3);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x90b357,_0x7779ba){var _0x2b86d9=function(_0x9abe3){while(--_0x9abe3){_0x90b357['push'](_0x90b357['shift']());}};_0x2b86d9(++_0x7779ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index f06efb6..b1fd7d1 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 _0x0f98=['to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceCallReport','key','model','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','options','count','include','fullname','alias','User','findAll','rows','show','params','rawAttributes','intersection','includeAll','find','catch','create','describe','body','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x44bc14,_0x43d4cb){var _0x6cd15a=function(_0x3641da){while(--_0x3641da){_0x44bc14['push'](_0x44bc14['shift']());}};_0x6cd15a(++_0x43d4cb);}(_0x0f98,0x171));var _0x80f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f98[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x80f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x80f9('0x1'));var zipdir=require(_0x80f9('0x2'));var jsonpatch=require(_0x80f9('0x3'));var rp=require(_0x80f9('0x4'));var moment=require(_0x80f9('0x5'));var BPromise=require(_0x80f9('0x6'));var Mustache=require(_0x80f9('0x7'));var util=require(_0x80f9('0x8'));var path=require(_0x80f9('0x9'));var sox=require(_0x80f9('0xa'));var csv=require(_0x80f9('0xb'));var ejs=require(_0x80f9('0xc'));var fs=require('fs');var _=require(_0x80f9('0xd'));var squel=require(_0x80f9('0xe'));var crypto=require('crypto');var jsforce=require(_0x80f9('0xf'));var deskjs=require(_0x80f9('0x10'));var toCsv=require(_0x80f9('0xb'));var querystring=require('querystring');var Papa=require(_0x80f9('0x11'));var Redis=require(_0x80f9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x80f9('0x13'));var hardwareService=require(_0x80f9('0x14'));var logger=require(_0x80f9('0x15'))(_0x80f9('0x16'));var utils=require('../../config/utils');var config=require(_0x80f9('0x17'));var db=require(_0x80f9('0x18'))['db'];function respondWithStatusCode(_0xa505bb,_0x52f0ea){_0x52f0ea=_0x52f0ea||0xcc;return function(_0x48e9af){if(_0x48e9af){return _0xa505bb[_0x80f9('0x19')](_0x52f0ea);}return _0xa505bb[_0x80f9('0x1a')](_0x52f0ea)[_0x80f9('0x1b')]();};}function respondWithResult(_0xed0f55,_0x2c628d){_0x2c628d=_0x2c628d||0xc8;return function(_0x16b37b){if(_0x16b37b){return _0xed0f55[_0x80f9('0x1a')](_0x2c628d)['json'](_0x16b37b);}};}function respondWithFilteredResult(_0x41707e,_0xfd637d){return function(_0x195895){if(_0x195895){var _0x3a1cbd=_0x195895['count'],_0x3a9078=_0xfd637d[_0x80f9('0x1c')],_0x2676df=_0xfd637d[_0x80f9('0x1c')]+_0xfd637d[_0x80f9('0x1d')],_0x28e5ff;if(_0x2676df>=_0x3a1cbd){_0x2676df=_0x3a1cbd;_0x28e5ff=0xc8;}else{_0x28e5ff=0xce;}_0x41707e[_0x80f9('0x1a')](_0x28e5ff);return _0x41707e['set'](_0x80f9('0x1e'),_0x3a9078+'-'+_0x2676df+'/'+_0x3a1cbd)['json'](_0x195895);}return null;};}function patchUpdates(_0x21a3ec){return function(_0x523d5d){try{jsonpatch[_0x80f9('0x1f')](_0x523d5d,_0x21a3ec,!![]);}catch(_0x517275){return BPromise[_0x80f9('0x20')](_0x517275);}return _0x523d5d[_0x80f9('0x21')]();};}function saveUpdates(_0x547dd,_0x3849e4){return function(_0x8a0101){if(_0x8a0101){return _0x8a0101[_0x80f9('0x22')](_0x547dd)['then'](function(_0x39a468){return _0x39a468;});}return null;};}function removeEntity(_0x2d17fb,_0x4b6ddf){return function(_0x3e639c){if(_0x3e639c){return _0x3e639c[_0x80f9('0x23')]()[_0x80f9('0x24')](function(){_0x2d17fb['status'](0xcc)[_0x80f9('0x1b')]();});}};}function handleEntityNotFound(_0x1b955a,_0x3f6471){return function(_0x597c18){if(!_0x597c18){_0x1b955a[_0x80f9('0x19')](0x194);}return _0x597c18;};}function handleError(_0xc623f2,_0x4d48a6){_0x4d48a6=_0x4d48a6||0x1f4;return function(_0x29bbd8){logger[_0x80f9('0x25')](_0x29bbd8[_0x80f9('0x26')]);if(_0x29bbd8[_0x80f9('0x27')]){delete _0x29bbd8[_0x80f9('0x27')];}_0xc623f2[_0x80f9('0x1a')](_0x4d48a6)[_0x80f9('0x28')](_0x29bbd8);};}exports['index']=function(_0x374da3,_0xfb6273){var _0x307765={},_0x3c8940={},_0x4a8e30={'count':0x0,'rows':[]};var _0x1297c3=_[_0x80f9('0x29')](db[_0x80f9('0x2a')]['rawAttributes'],function(_0x23724b){return{'name':_0x23724b['fieldName'],'type':_0x23724b['type'][_0x80f9('0x2b')]};});_0x3c8940[_0x80f9('0x2c')]=_[_0x80f9('0x29')](_0x1297c3,_0x80f9('0x27'));_0x3c8940[_0x80f9('0x2d')]=_[_0x80f9('0x2e')](_0x374da3[_0x80f9('0x2d')]);_0x3c8940['filters']=_['intersection'](_0x3c8940[_0x80f9('0x2c')],_0x3c8940[_0x80f9('0x2d')]);_0x307765[_0x80f9('0x2f')]=_['intersection'](_0x3c8940[_0x80f9('0x2c')],qs[_0x80f9('0x30')](_0x374da3['query']['fields']));_0x307765[_0x80f9('0x2f')]=_0x307765['attributes'][_0x80f9('0x31')]?_0x307765[_0x80f9('0x2f')]:_0x3c8940[_0x80f9('0x2c')];if(!_0x374da3[_0x80f9('0x2d')][_0x80f9('0x32')]('nolimit')){_0x307765[_0x80f9('0x1d')]=qs['limit'](_0x374da3[_0x80f9('0x2d')][_0x80f9('0x1d')]);_0x307765[_0x80f9('0x1c')]=qs[_0x80f9('0x1c')](_0x374da3['query'][_0x80f9('0x1c')]);}_0x307765['order']=qs[_0x80f9('0x33')](_0x374da3[_0x80f9('0x2d')][_0x80f9('0x33')]);_0x307765[_0x80f9('0x34')]=qs['filters'](_['pick'](_0x374da3[_0x80f9('0x2d')],_0x3c8940['filters']),_0x1297c3);if(_0x374da3['query'][_0x80f9('0x35')]){_0x307765[_0x80f9('0x34')]=_['merge'](_0x307765['where'],{'$or':_['map'](_0x1297c3,function(_0x56373c){if(_0x56373c[_0x80f9('0x36')]!==_0x80f9('0x37')){var _0x113a4c={};_0x113a4c[_0x56373c[_0x80f9('0x27')]]={'$like':'%'+_0x374da3[_0x80f9('0x2d')][_0x80f9('0x35')]+'%'};return _0x113a4c;}})});}_0x307765=_[_0x80f9('0x38')]({},_0x307765,_0x374da3[_0x80f9('0x39')]);var _0x41aef6={'where':_0x307765[_0x80f9('0x34')]};return db[_0x80f9('0x2a')][_0x80f9('0x3a')](_0x41aef6)[_0x80f9('0x24')](function(_0x2f4365){_0x4a8e30[_0x80f9('0x3a')]=_0x2f4365;if(_0x374da3[_0x80f9('0x2d')]['includeAll']){_0x307765[_0x80f9('0x3b')]=[{'attributes':['id',_0x80f9('0x27'),_0x80f9('0x3c'),_0x80f9('0x3d')],'model':db['User'],'as':_0x80f9('0x3e')}];}return db[_0x80f9('0x2a')][_0x80f9('0x3f')](_0x307765);})[_0x80f9('0x24')](function(_0x3b4085){_0x4a8e30[_0x80f9('0x40')]=_0x3b4085;return _0x4a8e30;})[_0x80f9('0x24')](respondWithFilteredResult(_0xfb6273,_0x307765))['catch'](handleError(_0xfb6273,null));};exports[_0x80f9('0x41')]=function(_0x2cf59e,_0x397fba){var _0x36a032={'raw':!![],'where':{'id':_0x2cf59e[_0x80f9('0x42')]['id']}},_0x19c4e0={};_0x19c4e0[_0x80f9('0x2c')]=_['keys'](db[_0x80f9('0x2a')][_0x80f9('0x43')]);_0x19c4e0['query']=_[_0x80f9('0x2e')](_0x2cf59e[_0x80f9('0x2d')]);_0x19c4e0['filters']=_[_0x80f9('0x44')](_0x19c4e0[_0x80f9('0x2c')],_0x19c4e0[_0x80f9('0x2d')]);_0x36a032[_0x80f9('0x2f')]=_[_0x80f9('0x44')](_0x19c4e0[_0x80f9('0x2c')],qs[_0x80f9('0x30')](_0x2cf59e['query']['fields']));_0x36a032[_0x80f9('0x2f')]=_0x36a032['attributes'][_0x80f9('0x31')]?_0x36a032[_0x80f9('0x2f')]:_0x19c4e0[_0x80f9('0x2c')];if(_0x2cf59e[_0x80f9('0x2d')][_0x80f9('0x45')]){_0x36a032['include']=[{'all':!![]}];}_0x36a032=_[_0x80f9('0x38')]({},_0x36a032,_0x2cf59e[_0x80f9('0x39')]);return db['VoiceCallReport'][_0x80f9('0x46')](_0x36a032)[_0x80f9('0x24')](handleEntityNotFound(_0x397fba,null))['then'](respondWithResult(_0x397fba,null))[_0x80f9('0x47')](handleError(_0x397fba,null));};exports[_0x80f9('0x48')]=function(_0x740c14,_0x1744a8){return db[_0x80f9('0x2a')]['create'](_0x740c14['body'],{})[_0x80f9('0x24')](respondWithResult(_0x1744a8,0xc9))[_0x80f9('0x47')](handleError(_0x1744a8,null));};exports['destroy']=function(_0x4f2e58,_0x349238){return db['VoiceCallReport'][_0x80f9('0x46')]({'where':{'id':_0x4f2e58[_0x80f9('0x42')]['id']}})[_0x80f9('0x24')](handleEntityNotFound(_0x349238,null))[_0x80f9('0x24')](removeEntity(_0x349238,null))[_0x80f9('0x47')](handleError(_0x349238,null));};exports['describe']=function(_0x5abe42,_0x16d996){return db[_0x80f9('0x2a')][_0x80f9('0x49')]()[_0x80f9('0x24')](respondWithResult(_0x16d996,null))['catch'](handleError(_0x16d996,null));};exports[_0x80f9('0x22')]=function(_0xcb687e,_0x200e33){if(_0xcb687e[_0x80f9('0x4a')][_0x80f9('0x4b')]){delete _0xcb687e[_0x80f9('0x4a')][_0x80f9('0x4b')];}return db[_0x80f9('0x2a')][_0x80f9('0x46')]({'where':{'uniqueid':_0xcb687e['params']['id'],'UserId':{'$or':[null,_0xcb687e['user']['id']]}}})[_0x80f9('0x24')](handleEntityNotFound(_0x200e33,null))['then'](saveUpdates(_0xcb687e[_0x80f9('0x4a')],null))[_0x80f9('0x24')](respondWithResult(_0x200e33,null))[_0x80f9('0x47')](handleError(_0x200e33,null));}; \ No newline at end of file +var _0xb469=['merge','VIRTUAL','options','includeAll','include','User','findAll','rows','show','params','rawAttributes','keys','create','catch','describe','uniqueid','body','find','user','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','model','map','query','filters','intersection','fields','length','attributes','nolimit','offset','order','sort','where','pick','filter'];(function(_0x284eb1,_0x47c046){var _0x379df6=function(_0x95b200){while(--_0x95b200){_0x284eb1['push'](_0x284eb1['shift']());}};_0x379df6(++_0x47c046);}(_0xb469,0x64));var _0x9b46=function(_0x5a98ab,_0x106ec2){_0x5a98ab=_0x5a98ab-0x0;var _0x3fe136=_0xb469[_0x5a98ab];return _0x3fe136;};'use strict';var pdf=require(_0x9b46('0x0'));var emlformat=require(_0x9b46('0x1'));var rimraf=require(_0x9b46('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b46('0x3'));var rp=require(_0x9b46('0x4'));var moment=require('moment');var BPromise=require(_0x9b46('0x5'));var Mustache=require(_0x9b46('0x6'));var util=require(_0x9b46('0x7'));var path=require(_0x9b46('0x8'));var sox=require(_0x9b46('0x9'));var csv=require(_0x9b46('0xa'));var ejs=require(_0x9b46('0xb'));var fs=require('fs');var _=require(_0x9b46('0xc'));var squel=require(_0x9b46('0xd'));var crypto=require(_0x9b46('0xe'));var jsforce=require(_0x9b46('0xf'));var deskjs=require(_0x9b46('0x10'));var toCsv=require(_0x9b46('0xa'));var querystring=require('querystring');var Papa=require(_0x9b46('0x11'));var Redis=require(_0x9b46('0x12'));var authService=require(_0x9b46('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b46('0x14'));var logger=require(_0x9b46('0x15'))(_0x9b46('0x16'));var utils=require(_0x9b46('0x17'));var config=require(_0x9b46('0x18'));var db=require(_0x9b46('0x19'))['db'];function respondWithStatusCode(_0x2ec49b,_0xeedbc5){_0xeedbc5=_0xeedbc5||0xcc;return function(_0x5f0ea7){if(_0x5f0ea7){return _0x2ec49b[_0x9b46('0x1a')](_0xeedbc5);}return _0x2ec49b[_0x9b46('0x1b')](_0xeedbc5)[_0x9b46('0x1c')]();};}function respondWithResult(_0x39cdea,_0x2e31b3){_0x2e31b3=_0x2e31b3||0xc8;return function(_0x1c427e){if(_0x1c427e){return _0x39cdea[_0x9b46('0x1b')](_0x2e31b3)[_0x9b46('0x1d')](_0x1c427e);}};}function respondWithFilteredResult(_0x46ca3c,_0x16d20c){return function(_0x5eedd2){if(_0x5eedd2){var _0x2dc423=_0x5eedd2[_0x9b46('0x1e')],_0xd5d72e=_0x16d20c['offset'],_0x2fccb0=_0x16d20c['offset']+_0x16d20c[_0x9b46('0x1f')],_0x4dcbda;if(_0x2fccb0>=_0x2dc423){_0x2fccb0=_0x2dc423;_0x4dcbda=0xc8;}else{_0x4dcbda=0xce;}_0x46ca3c['status'](_0x4dcbda);return _0x46ca3c[_0x9b46('0x20')](_0x9b46('0x21'),_0xd5d72e+'-'+_0x2fccb0+'/'+_0x2dc423)[_0x9b46('0x1d')](_0x5eedd2);}return null;};}function patchUpdates(_0x4558d6){return function(_0x13ae1a){try{jsonpatch[_0x9b46('0x22')](_0x13ae1a,_0x4558d6,!![]);}catch(_0x56a211){return BPromise['reject'](_0x56a211);}return _0x13ae1a[_0x9b46('0x23')]();};}function saveUpdates(_0x209fc0,_0x1e8d79){return function(_0x8ed24e){if(_0x8ed24e){return _0x8ed24e['update'](_0x209fc0)[_0x9b46('0x24')](function(_0x54d386){return _0x54d386;});}return null;};}function removeEntity(_0x5eb8c7,_0x115439){return function(_0xc99e28){if(_0xc99e28){return _0xc99e28[_0x9b46('0x25')]()[_0x9b46('0x24')](function(){_0x5eb8c7[_0x9b46('0x1b')](0xcc)[_0x9b46('0x1c')]();});}};}function handleEntityNotFound(_0x4bd7c7,_0x4eca86){return function(_0x53f245){if(!_0x53f245){_0x4bd7c7['sendStatus'](0x194);}return _0x53f245;};}function handleError(_0x40487a,_0x58488a){_0x58488a=_0x58488a||0x1f4;return function(_0x4d35f7){logger[_0x9b46('0x26')](_0x4d35f7[_0x9b46('0x27')]);if(_0x4d35f7[_0x9b46('0x28')]){delete _0x4d35f7[_0x9b46('0x28')];}_0x40487a['status'](_0x58488a)[_0x9b46('0x29')](_0x4d35f7);};}exports[_0x9b46('0x2a')]=function(_0x159cb8,_0x1ffe4e){var _0x212f09={},_0xb86f32={},_0x139673={'count':0x0,'rows':[]};var _0xf6cfe2=_['map'](db[_0x9b46('0x2b')]['rawAttributes'],function(_0x17d4ba){return{'name':_0x17d4ba[_0x9b46('0x2c')],'type':_0x17d4ba[_0x9b46('0x2d')][_0x9b46('0x2e')]};});_0xb86f32[_0x9b46('0x2f')]=_[_0x9b46('0x30')](_0xf6cfe2,_0x9b46('0x28'));_0xb86f32[_0x9b46('0x31')]=_['keys'](_0x159cb8['query']);_0xb86f32[_0x9b46('0x32')]=_[_0x9b46('0x33')](_0xb86f32[_0x9b46('0x2f')],_0xb86f32['query']);_0x212f09['attributes']=_[_0x9b46('0x33')](_0xb86f32[_0x9b46('0x2f')],qs[_0x9b46('0x34')](_0x159cb8[_0x9b46('0x31')][_0x9b46('0x34')]));_0x212f09['attributes']=_0x212f09['attributes'][_0x9b46('0x35')]?_0x212f09[_0x9b46('0x36')]:_0xb86f32[_0x9b46('0x2f')];if(!_0x159cb8[_0x9b46('0x31')]['hasOwnProperty'](_0x9b46('0x37'))){_0x212f09[_0x9b46('0x1f')]=qs['limit'](_0x159cb8[_0x9b46('0x31')][_0x9b46('0x1f')]);_0x212f09[_0x9b46('0x38')]=qs[_0x9b46('0x38')](_0x159cb8[_0x9b46('0x31')][_0x9b46('0x38')]);}_0x212f09[_0x9b46('0x39')]=qs[_0x9b46('0x3a')](_0x159cb8[_0x9b46('0x31')][_0x9b46('0x3a')]);_0x212f09[_0x9b46('0x3b')]=qs[_0x9b46('0x32')](_[_0x9b46('0x3c')](_0x159cb8[_0x9b46('0x31')],_0xb86f32[_0x9b46('0x32')]),_0xf6cfe2);if(_0x159cb8[_0x9b46('0x31')][_0x9b46('0x3d')]){_0x212f09[_0x9b46('0x3b')]=_[_0x9b46('0x3e')](_0x212f09['where'],{'$or':_[_0x9b46('0x30')](_0xf6cfe2,function(_0x4f64a4){if(_0x4f64a4[_0x9b46('0x2d')]!==_0x9b46('0x3f')){var _0x4d4de0={};_0x4d4de0[_0x4f64a4[_0x9b46('0x28')]]={'$like':'%'+_0x159cb8['query'][_0x9b46('0x3d')]+'%'};return _0x4d4de0;}})});}_0x212f09=_[_0x9b46('0x3e')]({},_0x212f09,_0x159cb8[_0x9b46('0x40')]);var _0x1f1a5a={'where':_0x212f09[_0x9b46('0x3b')]};return db['VoiceCallReport'][_0x9b46('0x1e')](_0x1f1a5a)[_0x9b46('0x24')](function(_0xee7bfc){_0x139673['count']=_0xee7bfc;if(_0x159cb8[_0x9b46('0x31')][_0x9b46('0x41')]){_0x212f09[_0x9b46('0x42')]=[{'attributes':['id',_0x9b46('0x28'),'fullname','alias'],'model':db[_0x9b46('0x43')],'as':'User'}];}return db[_0x9b46('0x2b')][_0x9b46('0x44')](_0x212f09);})[_0x9b46('0x24')](function(_0x5059ba){_0x139673[_0x9b46('0x45')]=_0x5059ba;return _0x139673;})[_0x9b46('0x24')](respondWithFilteredResult(_0x1ffe4e,_0x212f09))['catch'](handleError(_0x1ffe4e,null));};exports[_0x9b46('0x46')]=function(_0x14ea98,_0x3b8fd0){var _0x400e70={'raw':!![],'where':{'id':_0x14ea98[_0x9b46('0x47')]['id']}},_0xc79917={};_0xc79917[_0x9b46('0x2f')]=_['keys'](db['VoiceCallReport'][_0x9b46('0x48')]);_0xc79917[_0x9b46('0x31')]=_[_0x9b46('0x49')](_0x14ea98['query']);_0xc79917[_0x9b46('0x32')]=_['intersection'](_0xc79917[_0x9b46('0x2f')],_0xc79917[_0x9b46('0x31')]);_0x400e70['attributes']=_[_0x9b46('0x33')](_0xc79917[_0x9b46('0x2f')],qs[_0x9b46('0x34')](_0x14ea98[_0x9b46('0x31')][_0x9b46('0x34')]));_0x400e70['attributes']=_0x400e70[_0x9b46('0x36')][_0x9b46('0x35')]?_0x400e70['attributes']:_0xc79917['model'];if(_0x14ea98[_0x9b46('0x31')]['includeAll']){_0x400e70[_0x9b46('0x42')]=[{'all':!![]}];}_0x400e70=_[_0x9b46('0x3e')]({},_0x400e70,_0x14ea98[_0x9b46('0x40')]);return db[_0x9b46('0x2b')]['find'](_0x400e70)[_0x9b46('0x24')](handleEntityNotFound(_0x3b8fd0,null))[_0x9b46('0x24')](respondWithResult(_0x3b8fd0,null))['catch'](handleError(_0x3b8fd0,null));};exports[_0x9b46('0x4a')]=function(_0x3f7575,_0xc60189){return db[_0x9b46('0x2b')][_0x9b46('0x4a')](_0x3f7575['body'],{})['then'](respondWithResult(_0xc60189,0xc9))['catch'](handleError(_0xc60189,null));};exports['destroy']=function(_0x31af66,_0x164145){return db[_0x9b46('0x2b')]['find']({'where':{'id':_0x31af66['params']['id']}})['then'](handleEntityNotFound(_0x164145,null))[_0x9b46('0x24')](removeEntity(_0x164145,null))[_0x9b46('0x4b')](handleError(_0x164145,null));};exports['describe']=function(_0x2cd7cc,_0xecd4b8){return db['VoiceCallReport'][_0x9b46('0x4c')]()[_0x9b46('0x24')](respondWithResult(_0xecd4b8,null))[_0x9b46('0x4b')](handleError(_0xecd4b8,null));};exports['update']=function(_0x562894,_0x97173d){if(_0x562894['body'][_0x9b46('0x4d')]){delete _0x562894[_0x9b46('0x4e')][_0x9b46('0x4d')];}return db['VoiceCallReport'][_0x9b46('0x4f')]({'where':{'uniqueid':_0x562894[_0x9b46('0x47')]['id'],'UserId':{'$or':[null,_0x562894[_0x9b46('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x97173d,null))[_0x9b46('0x24')](saveUpdates(_0x562894[_0x9b46('0x4e')],null))[_0x9b46('0x24')](respondWithResult(_0x97173d,null))[_0x9b46('0x4b')](handleError(_0x97173d,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e4ce0b1..9f51314 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 _0xe0b4=['define','VoiceCallReport','report_call','uniqueid','lodash','util','moment','bluebird','request-promise','path','./voiceCallReport.attributes','exports'];(function(_0x14f947,_0x69eef1){var _0x226553=function(_0x32d6da){while(--_0x32d6da){_0x14f947['push'](_0x14f947['shift']());}};_0x226553(++_0x69eef1);}(_0xe0b4,0x190));var _0x4e0b=function(_0x419672,_0x8387b3){_0x419672=_0x419672-0x0;var _0x5ea7ed=_0xe0b4[_0x419672];return _0x5ea7ed;};'use strict';var _=require(_0x4e0b('0x0'));var util=require(_0x4e0b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4e0b('0x2'));var BPromise=require(_0x4e0b('0x3'));var rp=require(_0x4e0b('0x4'));var fs=require('fs');var path=require(_0x4e0b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e0b('0x6'));module[_0x4e0b('0x7')]=function(_0x1c6ebb,_0x632ee){return _0x1c6ebb[_0x4e0b('0x8')](_0x4e0b('0x9'),attributes,{'tableName':_0x4e0b('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4e0b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe919=['moment','bluebird','path','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4df7a5,_0x1a2c38){var _0x493b96=function(_0x1fb436){while(--_0x1fb436){_0x4df7a5['push'](_0x4df7a5['shift']());}};_0x493b96(++_0x1a2c38);}(_0xe919,0xec));var _0x9e91=function(_0x1d1f80,_0x2c87c0){_0x1d1f80=_0x1d1f80-0x0;var _0x380d8b=_0xe919[_0x1d1f80];return _0x380d8b;};'use strict';var _=require(_0x9e91('0x0'));var util=require(_0x9e91('0x1'));var logger=require(_0x9e91('0x2'))(_0x9e91('0x3'));var moment=require(_0x9e91('0x4'));var BPromise=require(_0x9e91('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e91('0x7'));module[_0x9e91('0x8')]=function(_0x42be85,_0x284ba2){return _0x42be85[_0x9e91('0x9')](_0x9e91('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x9e91('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ad292fe..999436d 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 _0x3671=['ioredis','../../mysqldb','../../config/logger','rpc','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','where','attributes','limit','include','map','model','then','CreateVoiceCallReport','VoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util'];(function(_0x46f595,_0x390c14){var _0x5a69a2=function(_0x28f66d){while(--_0x28f66d){_0x46f595['push'](_0x46f595['shift']());}};_0x5a69a2(++_0x390c14);}(_0x3671,0x10e));var _0x1367=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x3671[_0x49aa7d];return _0xdd0d26;};'use strict';var _=require(_0x1367('0x0'));var util=require(_0x1367('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1367('0x2'));var db=require(_0x1367('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1367('0x4'))(_0x1367('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2164f1,_0x3bb9c2,_0x367811){return new BPromise(function(_0xa529b2,_0x778690){return client['request'](_0x2164f1,_0x367811)['then'](function(_0x81db0f){logger[_0x1367('0x6')](_0x1367('0x7'),_0x3bb9c2,_0x1367('0x8'));logger[_0x1367('0x9')](_0x1367('0xa'),_0x3bb9c2,_0x1367('0x8'),JSON[_0x1367('0xb')](_0x81db0f));if(_0x81db0f[_0x1367('0xc')]){if(_0x81db0f['error'][_0x1367('0xd')]===0x1f4){logger['error'](_0x1367('0x7'),_0x3bb9c2,_0x81db0f[_0x1367('0xc')][_0x1367('0xe')]);return _0x778690(_0x81db0f[_0x1367('0xc')][_0x1367('0xe')]);}logger[_0x1367('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3bb9c2,_0x81db0f[_0x1367('0xc')][_0x1367('0xe')]);return _0xa529b2(_0x81db0f[_0x1367('0xc')]['message']);}else{logger[_0x1367('0x6')](_0x1367('0x7'),_0x3bb9c2,_0x1367('0x8'));_0xa529b2(_0x81db0f[_0x1367('0xf')][_0x1367('0xe')]);}})[_0x1367('0x10')](function(_0x338328){logger[_0x1367('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3bb9c2,_0x338328);_0x778690(_0x338328);});});}exports[_0x1367('0x11')]=function(_0x2bc2ff){var _0x350414=this;return new Promise(function(_0x2138e6,_0x1ea05a){return db['VoiceCallReport'][_0x1367('0x12')]({'raw':_0x2bc2ff[_0x1367('0x13')]?_0x2bc2ff[_0x1367('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc2ff[_0x1367('0x13')]?_0x2bc2ff[_0x1367('0x13')][_0x1367('0x14')]||null:null,'attributes':_0x2bc2ff['options']?_0x2bc2ff[_0x1367('0x13')][_0x1367('0x15')]||null:null,'limit':_0x2bc2ff['options']?_0x2bc2ff[_0x1367('0x13')][_0x1367('0x16')]||null:null,'include':_0x2bc2ff[_0x1367('0x13')]?_0x2bc2ff[_0x1367('0x13')][_0x1367('0x17')]?_[_0x1367('0x18')](_0x2bc2ff[_0x1367('0x13')][_0x1367('0x17')],function(_0x59d4fc){return{'model':db[_0x59d4fc[_0x1367('0x19')]],'as':_0x59d4fc['as'],'attributes':_0x59d4fc['attributes'],'include':_0x59d4fc[_0x1367('0x17')]?_[_0x1367('0x18')](_0x59d4fc[_0x1367('0x17')],function(_0x5df446){return{'model':db[_0x5df446[_0x1367('0x19')]],'as':_0x5df446['as'],'attributes':_0x5df446[_0x1367('0x15')],'include':_0x5df446['include']?_['map'](_0x5df446[_0x1367('0x17')],function(_0x55363c){return{'model':db[_0x55363c[_0x1367('0x19')]],'as':_0x55363c['as'],'attributes':_0x55363c[_0x1367('0x15')]};}):[]};}):[]};}):[]:[]})[_0x1367('0x1a')](function(_0x5c2bd7){logger['info'](_0x1367('0x11'),_0x2bc2ff);logger[_0x1367('0x9')](_0x1367('0x11'),_0x2bc2ff,JSON['stringify'](_0x5c2bd7));_0x2138e6(_0x5c2bd7);})[_0x1367('0x10')](function(_0x51fe0f){logger['error']('GetVoiceCallReport',_0x51fe0f[_0x1367('0xe')],_0x2bc2ff);_0x1ea05a(_0x350414[_0x1367('0xc')](0x1f4,_0x51fe0f['message']));});});};exports[_0x1367('0x1b')]=function(_0x1f280b){var _0x3b9463=this;return new Promise(function(_0x5ae499,_0x323b5d){return db[_0x1367('0x1c')][_0x1367('0x1d')](_0x1f280b[_0x1367('0x1e')],{'raw':_0x1f280b['options']?_0x1f280b[_0x1367('0x13')][_0x1367('0x1f')]===undefined?!![]:![]:!![]})[_0x1367('0x1a')](function(_0x21d4a0){logger['info']('CreateVoiceCallReport',_0x1f280b);logger[_0x1367('0x9')](_0x1367('0x1b'),_0x1f280b,JSON[_0x1367('0xb')](_0x21d4a0));_0x5ae499(_0x21d4a0);})[_0x1367('0x10')](function(_0x471233){logger[_0x1367('0xc')]('CreateVoiceCallReport',_0x471233['message'],_0x1f280b);_0x323b5d(_0x3b9463[_0x1367('0xc')](0x1f4,_0x471233[_0x1367('0xe')]));});});};exports[_0x1367('0x20')]=function(_0x2a657a){var _0x685c17=this;return new Promise(function(_0x102907,_0x354467){return db[_0x1367('0x1c')][_0x1367('0x21')](_0x2a657a[_0x1367('0x1e')],{'raw':_0x2a657a['options']?_0x2a657a[_0x1367('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a657a[_0x1367('0x13')]?_0x2a657a[_0x1367('0x13')][_0x1367('0x14')]||null:null,'attributes':_0x2a657a['options']?_0x2a657a[_0x1367('0x13')][_0x1367('0x15')]||null:null,'limit':_0x2a657a[_0x1367('0x13')]?_0x2a657a['options'][_0x1367('0x16')]||null:null})[_0x1367('0x1a')](function(_0x4a2217){logger[_0x1367('0x6')](_0x1367('0x20'),_0x2a657a);logger[_0x1367('0x9')](_0x1367('0x20'),_0x2a657a,JSON[_0x1367('0xb')](_0x4a2217));_0x102907(_0x4a2217);})[_0x1367('0x10')](function(_0x3532c5){logger[_0x1367('0xc')]('UpdateVoiceCallReport',_0x3532c5[_0x1367('0xe')],_0x2a657a);_0x354467(_0x685c17[_0x1367('0xc')](0x1f4,_0x3532c5[_0x1367('0xe')]));});});}; \ No newline at end of file +var _0x7d04=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','raw','options','where','limit','include','map','model','attributes','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xf02334,_0x486b5e){var _0x235e23=function(_0x18eb5a){while(--_0x18eb5a){_0xf02334['push'](_0xf02334['shift']());}};_0x235e23(++_0x486b5e);}(_0x7d04,0x1ed));var _0x47d0=function(_0x506912,_0x221002){_0x506912=_0x506912-0x0;var _0x23d3eb=_0x7d04[_0x506912];return _0x23d3eb;};'use strict';var _=require(_0x47d0('0x0'));var util=require(_0x47d0('0x1'));var moment=require(_0x47d0('0x2'));var BPromise=require(_0x47d0('0x3'));var rs=require(_0x47d0('0x4'));var fs=require('fs');var Redis=require(_0x47d0('0x5'));var db=require(_0x47d0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47d0('0x7'))(_0x47d0('0x8'));var config=require('../../config/environment');var jayson=require(_0x47d0('0x9'));var client=jayson[_0x47d0('0xa')][_0x47d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42067b,_0x26dabd,_0x18f75b){return new BPromise(function(_0x4214c4,_0x4d1eb4){return client[_0x47d0('0xc')](_0x42067b,_0x18f75b)[_0x47d0('0xd')](function(_0x292433){logger[_0x47d0('0xe')](_0x47d0('0xf'),_0x26dabd,_0x47d0('0x10'));logger[_0x47d0('0x11')](_0x47d0('0x12'),_0x26dabd,_0x47d0('0x10'),JSON[_0x47d0('0x13')](_0x292433));if(_0x292433[_0x47d0('0x14')]){if(_0x292433['error']['code']===0x1f4){logger['error'](_0x47d0('0xf'),_0x26dabd,_0x292433[_0x47d0('0x14')][_0x47d0('0x15')]);return _0x4d1eb4(_0x292433[_0x47d0('0x14')][_0x47d0('0x15')]);}logger[_0x47d0('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x26dabd,_0x292433[_0x47d0('0x14')][_0x47d0('0x15')]);return _0x4214c4(_0x292433['error']['message']);}else{logger[_0x47d0('0xe')](_0x47d0('0xf'),_0x26dabd,_0x47d0('0x10'));_0x4214c4(_0x292433[_0x47d0('0x16')][_0x47d0('0x15')]);}})[_0x47d0('0x17')](function(_0x122552){logger['error'](_0x47d0('0xf'),_0x26dabd,_0x122552);_0x4d1eb4(_0x122552);});});}exports[_0x47d0('0x18')]=function(_0x5628fe){var _0x3b3984=this;return new Promise(function(_0x3587f4,_0xb0244f){return db[_0x47d0('0x19')]['findAll']({'raw':_0x5628fe['options']?_0x5628fe['options'][_0x47d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x5628fe[_0x47d0('0x1b')]?_0x5628fe[_0x47d0('0x1b')][_0x47d0('0x1c')]||null:null,'attributes':_0x5628fe['options']?_0x5628fe['options']['attributes']||null:null,'limit':_0x5628fe[_0x47d0('0x1b')]?_0x5628fe[_0x47d0('0x1b')][_0x47d0('0x1d')]||null:null,'include':_0x5628fe[_0x47d0('0x1b')]?_0x5628fe[_0x47d0('0x1b')][_0x47d0('0x1e')]?_[_0x47d0('0x1f')](_0x5628fe[_0x47d0('0x1b')][_0x47d0('0x1e')],function(_0x186d05){return{'model':db[_0x186d05[_0x47d0('0x20')]],'as':_0x186d05['as'],'attributes':_0x186d05[_0x47d0('0x21')],'include':_0x186d05[_0x47d0('0x1e')]?_[_0x47d0('0x1f')](_0x186d05[_0x47d0('0x1e')],function(_0x5d46bb){return{'model':db[_0x5d46bb[_0x47d0('0x20')]],'as':_0x5d46bb['as'],'attributes':_0x5d46bb[_0x47d0('0x21')],'include':_0x5d46bb[_0x47d0('0x1e')]?_[_0x47d0('0x1f')](_0x5d46bb[_0x47d0('0x1e')],function(_0xd1ce84){return{'model':db[_0xd1ce84[_0x47d0('0x20')]],'as':_0xd1ce84['as'],'attributes':_0xd1ce84[_0x47d0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x47d0('0xd')](function(_0x49d79a){logger[_0x47d0('0xe')](_0x47d0('0x18'),_0x5628fe);logger[_0x47d0('0x11')]('GetVoiceCallReport',_0x5628fe,JSON[_0x47d0('0x13')](_0x49d79a));_0x3587f4(_0x49d79a);})[_0x47d0('0x17')](function(_0x1c90df){logger[_0x47d0('0x14')](_0x47d0('0x18'),_0x1c90df[_0x47d0('0x15')],_0x5628fe);_0xb0244f(_0x3b3984[_0x47d0('0x14')](0x1f4,_0x1c90df['message']));});});};exports[_0x47d0('0x22')]=function(_0x260ea3){var _0x757a17=this;return new Promise(function(_0xc92629,_0x5c259b){return db[_0x47d0('0x19')][_0x47d0('0x23')](_0x260ea3[_0x47d0('0x24')],{'raw':_0x260ea3[_0x47d0('0x1b')]?_0x260ea3['options'][_0x47d0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2bb4b1){logger['info']('CreateVoiceCallReport',_0x260ea3);logger[_0x47d0('0x11')](_0x47d0('0x22'),_0x260ea3,JSON['stringify'](_0x2bb4b1));_0xc92629(_0x2bb4b1);})[_0x47d0('0x17')](function(_0x44da78){logger[_0x47d0('0x14')](_0x47d0('0x22'),_0x44da78[_0x47d0('0x15')],_0x260ea3);_0x5c259b(_0x757a17[_0x47d0('0x14')](0x1f4,_0x44da78[_0x47d0('0x15')]));});});};exports[_0x47d0('0x25')]=function(_0x424740){var _0x588721=this;return new Promise(function(_0x20fae5,_0x1ac11e){return db['VoiceCallReport'][_0x47d0('0x26')](_0x424740['body'],{'raw':_0x424740[_0x47d0('0x1b')]?_0x424740[_0x47d0('0x1b')][_0x47d0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x424740[_0x47d0('0x1b')]?_0x424740[_0x47d0('0x1b')][_0x47d0('0x1c')]||null:null,'attributes':_0x424740['options']?_0x424740[_0x47d0('0x1b')]['attributes']||null:null,'limit':_0x424740[_0x47d0('0x1b')]?_0x424740[_0x47d0('0x1b')][_0x47d0('0x1d')]||null:null})[_0x47d0('0xd')](function(_0x47cf55){logger[_0x47d0('0xe')](_0x47d0('0x25'),_0x424740);logger['debug']('UpdateVoiceCallReport',_0x424740,JSON['stringify'](_0x47cf55));_0x20fae5(_0x47cf55);})[_0x47d0('0x17')](function(_0x4d9d53){logger[_0x47d0('0x14')](_0x47d0('0x25'),_0x4d9d53[_0x47d0('0x15')],_0x424740);_0x1ac11e(_0x588721[_0x47d0('0x14')](0x1f4,_0x4d9d53[_0x47d0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index f4c1c4b..2607fd6 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 _0xc2d6=['/:id','show','isAuthenticated','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc2d6,0x171));var _0x6c2d=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xc2d6[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require('multer');var util=require(_0x6c2d('0x0'));var path=require(_0x6c2d('0x1'));var timeout=require(_0x6c2d('0x2'));var express=require(_0x6c2d('0x3'));var router=express[_0x6c2d('0x4')]();var auth=require(_0x6c2d('0x5'));var interaction=require(_0x6c2d('0x6'));var config=require(_0x6c2d('0x7'));var controller=require(_0x6c2d('0x8'));router[_0x6c2d('0x9')]('/',auth['isAuthenticated'](),controller[_0x6c2d('0xa')]);router[_0x6c2d('0x9')](_0x6c2d('0xb'),auth['isAuthenticated'](),controller[_0x6c2d('0xc')]);router['post']('/',auth[_0x6c2d('0xd')](),controller[_0x6c2d('0xe')]);router[_0x6c2d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6c2d('0x10')]);router[_0x6c2d('0x11')](_0x6c2d('0xb'),auth[_0x6c2d('0xd')](),controller['destroy']);module[_0x6c2d('0x12')]=router; \ No newline at end of file +var _0x5f4a=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','../../config/environment'];(function(_0x55d0fd,_0x1b1bdd){var _0x40ce6f=function(_0x282df9){while(--_0x282df9){_0x55d0fd['push'](_0x55d0fd['shift']());}};_0x40ce6f(++_0x1b1bdd);}(_0x5f4a,0x1bc));var _0xa5f4=function(_0x233efd,_0x10c29a){_0x233efd=_0x233efd-0x0;var _0x26d821=_0x5f4a[_0x233efd];return _0x26d821;};'use strict';var multer=require(_0xa5f4('0x0'));var util=require(_0xa5f4('0x1'));var path=require('path');var timeout=require(_0xa5f4('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa5f4('0x3'));var controller=require(_0xa5f4('0x4'));router[_0xa5f4('0x5')]('/',auth[_0xa5f4('0x6')](),controller[_0xa5f4('0x7')]);router[_0xa5f4('0x5')](_0xa5f4('0x8'),auth[_0xa5f4('0x6')](),controller[_0xa5f4('0x9')]);router[_0xa5f4('0xa')]('/',auth[_0xa5f4('0x6')](),controller[_0xa5f4('0xb')]);router['put'](_0xa5f4('0x8'),auth[_0xa5f4('0x6')](),controller[_0xa5f4('0xc')]);router[_0xa5f4('0xd')](_0xa5f4('0x8'),auth['isAuthenticated'](),controller[_0xa5f4('0xe')]);module[_0xa5f4('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c58e31a..6c94219 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 _0x81aa=['getDataValue','BOOLEAN','exports','STRING','options','join'];(function(_0x595d76,_0x28cd7e){var _0xd352c5=function(_0x531493){while(--_0x531493){_0x595d76['push'](_0x595d76['shift']());}};_0xd352c5(++_0x28cd7e);}(_0x81aa,0xec));var _0xa81a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x81aa[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0xa81a('0x0')]={'name':{'type':Sequelize[_0xa81a('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xa81a('0x1')],'set':function(_0x3a6e68){this['setDataValue'](_0xa81a('0x2'),_0x3a6e68?_0x3a6e68[_0xa81a('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xa81a('0x2'))?this[_0xa81a('0x4')](_0xa81a('0x2'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xa81a('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa81a('0x1')]}}; \ No newline at end of file +var _0x489a=['STRING','name','join','getDataValue','options','split','sequelize','exports'];(function(_0x53f90a,_0x2bb140){var _0x1106c4=function(_0x3be148){while(--_0x3be148){_0x53f90a['push'](_0x53f90a['shift']());}};_0x1106c4(++_0x2bb140);}(_0x489a,0x66));var _0xa489=function(_0x5a2b99,_0xb0e62){_0x5a2b99=_0x5a2b99-0x0;var _0x46b640=_0x489a[_0x5a2b99];return _0x46b640;};'use strict';var Sequelize=require(_0xa489('0x0'));module[_0xa489('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xa489('0x2')],'unique':_0xa489('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xa489('0x2')],'set':function(_0x178628){this['setDataValue']('options',_0x178628?_0x178628[_0xa489('0x4')](''):[]);},'get':function(){return this[_0xa489('0x5')](_0xa489('0x6'))?this['getDataValue'](_0xa489('0x6'))[_0xa489('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa489('0x2')]},'description':{'type':Sequelize[_0xa489('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a52ef40..93f7fb0 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 _0x83d9=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','update','destroy','then','get','UserProfileResource','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','error','html-pdf'];(function(_0x5e2c02,_0x490707){var _0x4f0194=function(_0x27651b){while(--_0x27651b){_0x5e2c02['push'](_0x5e2c02['shift']());}};_0x4f0194(++_0x490707);}(_0x83d9,0xe0));var _0x983d=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x83d9[_0x1b828b];return _0x98da1a;};'use strict';var pdf=require(_0x983d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x983d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x983d('0x2'));var rp=require(_0x983d('0x3'));var moment=require(_0x983d('0x4'));var BPromise=require(_0x983d('0x5'));var Mustache=require(_0x983d('0x6'));var util=require('util');var path=require(_0x983d('0x7'));var sox=require(_0x983d('0x8'));var csv=require(_0x983d('0x9'));var ejs=require(_0x983d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x983d('0xb'));var crypto=require(_0x983d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x983d('0xd'));var toCsv=require(_0x983d('0x9'));var querystring=require(_0x983d('0xe'));var Papa=require(_0x983d('0xf'));var Redis=require('ioredis');var authService=require(_0x983d('0x10'));var qs=require(_0x983d('0x11'));var as=require(_0x983d('0x12'));var hardwareService=require(_0x983d('0x13'));var logger=require('../../config/logger')(_0x983d('0x14'));var utils=require(_0x983d('0x15'));var config=require('../../config/environment');var db=require(_0x983d('0x16'))['db'];function respondWithStatusCode(_0x519683,_0x8344d6){_0x8344d6=_0x8344d6||0xcc;return function(_0x35d635){if(_0x35d635){return _0x519683[_0x983d('0x17')](_0x8344d6);}return _0x519683[_0x983d('0x18')](_0x8344d6)[_0x983d('0x19')]();};}function respondWithResult(_0x55041f,_0x1aa73c){_0x1aa73c=_0x1aa73c||0xc8;return function(_0x2bd2fb){if(_0x2bd2fb){return _0x55041f[_0x983d('0x18')](_0x1aa73c)[_0x983d('0x1a')](_0x2bd2fb);}};}function respondWithFilteredResult(_0x1c6c55,_0x24ed47){return function(_0x4e01f2){if(_0x4e01f2){var _0xfdaf88=_0x4e01f2[_0x983d('0x1b')],_0x34eee1=_0x24ed47[_0x983d('0x1c')],_0x45a10c=_0x24ed47[_0x983d('0x1c')]+_0x24ed47['limit'],_0x1fd670;if(_0x45a10c>=_0xfdaf88){_0x45a10c=_0xfdaf88;_0x1fd670=0xc8;}else{_0x1fd670=0xce;}_0x1c6c55[_0x983d('0x18')](_0x1fd670);return _0x1c6c55['set'](_0x983d('0x1d'),_0x34eee1+'-'+_0x45a10c+'/'+_0xfdaf88)['json'](_0x4e01f2);}return null;};}function patchUpdates(_0x5a6651){return function(_0x301b59){try{jsonpatch['apply'](_0x301b59,_0x5a6651,!![]);}catch(_0x4c62dc){return BPromise['reject'](_0x4c62dc);}return _0x301b59['save']();};}function saveUpdates(_0x4466e6,_0x517437){return function(_0x4d0cfd){if(_0x4d0cfd){return _0x4d0cfd[_0x983d('0x1e')](_0x4466e6)['then'](function(_0x52c0b5){return _0x52c0b5;});}return null;};}function removeEntity(_0x1bf4f2,_0x26b5d0){return function(_0x15466b){if(_0x15466b){return _0x15466b[_0x983d('0x1f')]()[_0x983d('0x20')](function(){var _0x2be4ed=_0x15466b[_0x983d('0x21')]({'plain':!![]});var _0x406530='ChanSpies';return db[_0x983d('0x22')][_0x983d('0x1f')]({'where':{'type':_0x406530,'resourceId':_0x2be4ed['id']}})['then'](function(){return _0x15466b;});})[_0x983d('0x20')](function(){_0x1bf4f2[_0x983d('0x18')](0xcc)[_0x983d('0x19')]();});}};}function handleEntityNotFound(_0x60ac42,_0x5f680a){return function(_0x2e6549){if(!_0x2e6549){_0x60ac42['sendStatus'](0x194);}return _0x2e6549;};}function handleError(_0x379c6f,_0x540e07){_0x540e07=_0x540e07||0x1f4;return function(_0x3d5ff1){logger['error'](_0x3d5ff1['stack']);if(_0x3d5ff1[_0x983d('0x23')]){delete _0x3d5ff1[_0x983d('0x23')];}_0x379c6f['status'](_0x540e07)[_0x983d('0x24')](_0x3d5ff1);};}exports['index']=function(_0x5d42fb,_0x4b139a){var _0x410a47={},_0x1390a8={},_0x4fa00a={'count':0x0,'rows':[]};var _0x47ed68=_[_0x983d('0x25')](db[_0x983d('0x26')][_0x983d('0x27')],function(_0xb40ff8){return{'name':_0xb40ff8[_0x983d('0x28')],'type':_0xb40ff8['type'][_0x983d('0x29')]};});_0x1390a8['model']=_[_0x983d('0x25')](_0x47ed68,'name');_0x1390a8['query']=_['keys'](_0x5d42fb[_0x983d('0x2a')]);_0x1390a8[_0x983d('0x2b')]=_['intersection'](_0x1390a8['model'],_0x1390a8[_0x983d('0x2a')]);_0x410a47[_0x983d('0x2c')]=_[_0x983d('0x2d')](_0x1390a8[_0x983d('0x2e')],qs['fields'](_0x5d42fb[_0x983d('0x2a')][_0x983d('0x2f')]));_0x410a47[_0x983d('0x2c')]=_0x410a47[_0x983d('0x2c')][_0x983d('0x30')]?_0x410a47['attributes']:_0x1390a8[_0x983d('0x2e')];if(!_0x5d42fb[_0x983d('0x2a')][_0x983d('0x31')]('nolimit')){_0x410a47[_0x983d('0x32')]=qs[_0x983d('0x32')](_0x5d42fb[_0x983d('0x2a')][_0x983d('0x32')]);_0x410a47[_0x983d('0x1c')]=qs[_0x983d('0x1c')](_0x5d42fb['query'][_0x983d('0x1c')]);}_0x410a47[_0x983d('0x33')]=qs[_0x983d('0x34')](_0x5d42fb[_0x983d('0x2a')][_0x983d('0x34')]);_0x410a47[_0x983d('0x35')]=qs[_0x983d('0x2b')](_['pick'](_0x5d42fb[_0x983d('0x2a')],_0x1390a8[_0x983d('0x2b')]),_0x47ed68);if(_0x5d42fb['query']['filter']){_0x410a47[_0x983d('0x35')]=_[_0x983d('0x36')](_0x410a47[_0x983d('0x35')],{'$or':_[_0x983d('0x25')](_0x47ed68,function(_0x565681){if(_0x565681[_0x983d('0x37')]!=='VIRTUAL'){var _0x1bdfd4={};_0x1bdfd4[_0x565681[_0x983d('0x23')]]={'$like':'%'+_0x5d42fb[_0x983d('0x2a')][_0x983d('0x38')]+'%'};return _0x1bdfd4;}})});}_0x410a47=_[_0x983d('0x36')]({},_0x410a47,_0x5d42fb[_0x983d('0x39')]);var _0x1c6588={'where':_0x410a47['where']};return db['VoiceChanSpy']['count'](_0x1c6588)[_0x983d('0x20')](function(_0x53026b){_0x4fa00a[_0x983d('0x1b')]=_0x53026b;if(_0x5d42fb[_0x983d('0x2a')][_0x983d('0x3a')]){_0x410a47[_0x983d('0x3b')]=[{'all':!![]}];}return db[_0x983d('0x26')][_0x983d('0x3c')](_0x410a47);})['then'](function(_0x2d10ad){_0x4fa00a[_0x983d('0x3d')]=_0x2d10ad;return _0x4fa00a;})['then'](respondWithFilteredResult(_0x4b139a,_0x410a47))['catch'](handleError(_0x4b139a,null));};exports[_0x983d('0x3e')]=function(_0x471b7f,_0xdf833d){var _0x4e915e={'raw':![],'where':{'id':_0x471b7f[_0x983d('0x3f')]['id']}},_0x3f41b0={};_0x3f41b0['model']=_[_0x983d('0x40')](db[_0x983d('0x26')][_0x983d('0x27')]);_0x3f41b0[_0x983d('0x2a')]=_[_0x983d('0x40')](_0x471b7f[_0x983d('0x2a')]);_0x3f41b0[_0x983d('0x2b')]=_['intersection'](_0x3f41b0[_0x983d('0x2e')],_0x3f41b0['query']);_0x4e915e[_0x983d('0x2c')]=_[_0x983d('0x2d')](_0x3f41b0['model'],qs[_0x983d('0x2f')](_0x471b7f[_0x983d('0x2a')][_0x983d('0x2f')]));_0x4e915e[_0x983d('0x2c')]=_0x4e915e[_0x983d('0x2c')][_0x983d('0x30')]?_0x4e915e[_0x983d('0x2c')]:_0x3f41b0[_0x983d('0x2e')];if(_0x471b7f[_0x983d('0x2a')][_0x983d('0x3a')]){_0x4e915e[_0x983d('0x3b')]=[{'all':!![]}];}_0x4e915e=_['merge']({},_0x4e915e,_0x471b7f[_0x983d('0x39')]);return db[_0x983d('0x26')][_0x983d('0x41')](_0x4e915e)[_0x983d('0x20')](handleEntityNotFound(_0xdf833d,null))[_0x983d('0x20')](respondWithResult(_0xdf833d,null))[_0x983d('0x42')](handleError(_0xdf833d,null));};exports[_0x983d('0x43')]=function(_0x25b2a9,_0x31e20b){return db[_0x983d('0x26')][_0x983d('0x43')](_0x25b2a9['body'],{})[_0x983d('0x20')](function(_0x2ead1e){var _0x3efae5=_0x25b2a9['user']['get']({'plain':!![]});if(!_0x3efae5)throw new Error(_0x983d('0x44'));if(_0x3efae5[_0x983d('0x45')]===_0x983d('0x46')){var _0x5b0922=_0x2ead1e['get']({'plain':!![]});var _0x7bf7ef=_0x983d('0x47');return db[_0x983d('0x48')][_0x983d('0x41')]({'where':{'name':_0x7bf7ef,'userProfileId':_0x3efae5[_0x983d('0x49')]},'raw':!![]})[_0x983d('0x20')](function(_0x2f156e){if(_0x2f156e&&_0x2f156e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5b0922[_0x983d('0x23')],'resourceId':_0x5b0922['id'],'type':_0x2f156e['name'],'sectionId':_0x2f156e['id']},{})['then'](function(){return _0x2ead1e;});}else{return _0x2ead1e;}})['catch'](function(_0x369acd){logger[_0x983d('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x369acd);throw _0x369acd;});}return _0x2ead1e;})[_0x983d('0x20')](respondWithResult(_0x31e20b,0xc9))[_0x983d('0x42')](handleError(_0x31e20b,null));};exports[_0x983d('0x1e')]=function(_0x3d73f5,_0x5d749d){if(_0x3d73f5['body']['id']){delete _0x3d73f5['body']['id'];}return db[_0x983d('0x26')][_0x983d('0x41')]({'where':{'id':_0x3d73f5['params']['id']}})[_0x983d('0x20')](handleEntityNotFound(_0x5d749d,null))[_0x983d('0x20')](saveUpdates(_0x3d73f5['body'],null))[_0x983d('0x20')](respondWithResult(_0x5d749d,null))[_0x983d('0x42')](handleError(_0x5d749d,null));};exports[_0x983d('0x1f')]=function(_0x18d204,_0x140016){return db[_0x983d('0x26')][_0x983d('0x41')]({'where':{'id':_0x18d204[_0x983d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x140016,null))['then'](removeEntity(_0x140016,null))[_0x983d('0x42')](handleError(_0x140016,null));}; \ No newline at end of file +var _0x9baa=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','get','ChanSpies','UserProfileResource','destroy','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model'];(function(_0x1a3c9b,_0x3eb0cb){var _0x57f1d8=function(_0x53662d){while(--_0x53662d){_0x1a3c9b['push'](_0x1a3c9b['shift']());}};_0x57f1d8(++_0x3eb0cb);}(_0x9baa,0x1a9));var _0xa9ba=function(_0xb36adc,_0x1ed5cd){_0xb36adc=_0xb36adc-0x0;var _0x1dedd7=_0x9baa[_0xb36adc];return _0x1dedd7;};'use strict';var pdf=require(_0xa9ba('0x0'));var emlformat=require(_0xa9ba('0x1'));var rimraf=require(_0xa9ba('0x2'));var zipdir=require(_0xa9ba('0x3'));var jsonpatch=require(_0xa9ba('0x4'));var rp=require(_0xa9ba('0x5'));var moment=require(_0xa9ba('0x6'));var BPromise=require(_0xa9ba('0x7'));var Mustache=require(_0xa9ba('0x8'));var util=require(_0xa9ba('0x9'));var path=require(_0xa9ba('0xa'));var sox=require(_0xa9ba('0xb'));var csv=require(_0xa9ba('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa9ba('0xd'));var squel=require(_0xa9ba('0xe'));var crypto=require(_0xa9ba('0xf'));var jsforce=require(_0xa9ba('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa9ba('0xc'));var querystring=require(_0xa9ba('0x11'));var Papa=require(_0xa9ba('0x12'));var Redis=require('ioredis');var authService=require(_0xa9ba('0x13'));var qs=require(_0xa9ba('0x14'));var as=require(_0xa9ba('0x15'));var hardwareService=require(_0xa9ba('0x16'));var logger=require(_0xa9ba('0x17'))(_0xa9ba('0x18'));var utils=require(_0xa9ba('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2737d6,_0x466ff6){_0x466ff6=_0x466ff6||0xcc;return function(_0x253feb){if(_0x253feb){return _0x2737d6[_0xa9ba('0x1a')](_0x466ff6);}return _0x2737d6[_0xa9ba('0x1b')](_0x466ff6)['end']();};}function respondWithResult(_0x1f5899,_0x34f9a4){_0x34f9a4=_0x34f9a4||0xc8;return function(_0x24bbe5){if(_0x24bbe5){return _0x1f5899[_0xa9ba('0x1b')](_0x34f9a4)[_0xa9ba('0x1c')](_0x24bbe5);}};}function respondWithFilteredResult(_0x434c00,_0x5a0b4a){return function(_0x2d9429){if(_0x2d9429){var _0x8c80fd=_0x2d9429[_0xa9ba('0x1d')],_0x116216=_0x5a0b4a['offset'],_0x437fe0=_0x5a0b4a[_0xa9ba('0x1e')]+_0x5a0b4a[_0xa9ba('0x1f')],_0x1ef176;if(_0x437fe0>=_0x8c80fd){_0x437fe0=_0x8c80fd;_0x1ef176=0xc8;}else{_0x1ef176=0xce;}_0x434c00['status'](_0x1ef176);return _0x434c00[_0xa9ba('0x20')](_0xa9ba('0x21'),_0x116216+'-'+_0x437fe0+'/'+_0x8c80fd)['json'](_0x2d9429);}return null;};}function patchUpdates(_0xe145bb){return function(_0x29e557){try{jsonpatch['apply'](_0x29e557,_0xe145bb,!![]);}catch(_0x5d0de1){return BPromise[_0xa9ba('0x22')](_0x5d0de1);}return _0x29e557['save']();};}function saveUpdates(_0x24a897,_0x5e8064){return function(_0x1bdcc2){if(_0x1bdcc2){return _0x1bdcc2[_0xa9ba('0x23')](_0x24a897)[_0xa9ba('0x24')](function(_0x56d60e){return _0x56d60e;});}return null;};}function removeEntity(_0xa38c16,_0x437ac5){return function(_0x2491c2){if(_0x2491c2){return _0x2491c2['destroy']()[_0xa9ba('0x24')](function(){var _0x344303=_0x2491c2[_0xa9ba('0x25')]({'plain':!![]});var _0xe283c2=_0xa9ba('0x26');return db[_0xa9ba('0x27')][_0xa9ba('0x28')]({'where':{'type':_0xe283c2,'resourceId':_0x344303['id']}})['then'](function(){return _0x2491c2;});})[_0xa9ba('0x24')](function(){_0xa38c16[_0xa9ba('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc189c7,_0xf0972d){return function(_0xbda073){if(!_0xbda073){_0xc189c7[_0xa9ba('0x1a')](0x194);}return _0xbda073;};}function handleError(_0x2d0463,_0x4cb829){_0x4cb829=_0x4cb829||0x1f4;return function(_0x88ac36){logger['error'](_0x88ac36['stack']);if(_0x88ac36[_0xa9ba('0x29')]){delete _0x88ac36[_0xa9ba('0x29')];}_0x2d0463[_0xa9ba('0x1b')](_0x4cb829)['send'](_0x88ac36);};}exports[_0xa9ba('0x2a')]=function(_0x5b2a0a,_0x41baa8){var _0x5175c6={},_0x186f14={},_0x40fd80={'count':0x0,'rows':[]};var _0x4b8c5b=_[_0xa9ba('0x2b')](db[_0xa9ba('0x2c')][_0xa9ba('0x2d')],function(_0x88c9af){return{'name':_0x88c9af[_0xa9ba('0x2e')],'type':_0x88c9af[_0xa9ba('0x2f')]['key']};});_0x186f14[_0xa9ba('0x30')]=_['map'](_0x4b8c5b,_0xa9ba('0x29'));_0x186f14[_0xa9ba('0x31')]=_[_0xa9ba('0x32')](_0x5b2a0a['query']);_0x186f14['filters']=_[_0xa9ba('0x33')](_0x186f14['model'],_0x186f14[_0xa9ba('0x31')]);_0x5175c6[_0xa9ba('0x34')]=_['intersection'](_0x186f14[_0xa9ba('0x30')],qs[_0xa9ba('0x35')](_0x5b2a0a[_0xa9ba('0x31')]['fields']));_0x5175c6[_0xa9ba('0x34')]=_0x5175c6['attributes'][_0xa9ba('0x36')]?_0x5175c6['attributes']:_0x186f14[_0xa9ba('0x30')];if(!_0x5b2a0a[_0xa9ba('0x31')][_0xa9ba('0x37')](_0xa9ba('0x38'))){_0x5175c6[_0xa9ba('0x1f')]=qs[_0xa9ba('0x1f')](_0x5b2a0a[_0xa9ba('0x31')][_0xa9ba('0x1f')]);_0x5175c6[_0xa9ba('0x1e')]=qs[_0xa9ba('0x1e')](_0x5b2a0a['query'][_0xa9ba('0x1e')]);}_0x5175c6[_0xa9ba('0x39')]=qs[_0xa9ba('0x3a')](_0x5b2a0a['query']['sort']);_0x5175c6[_0xa9ba('0x3b')]=qs[_0xa9ba('0x3c')](_[_0xa9ba('0x3d')](_0x5b2a0a['query'],_0x186f14['filters']),_0x4b8c5b);if(_0x5b2a0a['query']['filter']){_0x5175c6[_0xa9ba('0x3b')]=_[_0xa9ba('0x3e')](_0x5175c6[_0xa9ba('0x3b')],{'$or':_[_0xa9ba('0x2b')](_0x4b8c5b,function(_0x37e2e0){if(_0x37e2e0['type']!==_0xa9ba('0x3f')){var _0x1360fb={};_0x1360fb[_0x37e2e0[_0xa9ba('0x29')]]={'$like':'%'+_0x5b2a0a[_0xa9ba('0x31')]['filter']+'%'};return _0x1360fb;}})});}_0x5175c6=_[_0xa9ba('0x3e')]({},_0x5175c6,_0x5b2a0a[_0xa9ba('0x40')]);var _0x2cdf21={'where':_0x5175c6[_0xa9ba('0x3b')]};return db['VoiceChanSpy']['count'](_0x2cdf21)[_0xa9ba('0x24')](function(_0x59158a){_0x40fd80[_0xa9ba('0x1d')]=_0x59158a;if(_0x5b2a0a['query'][_0xa9ba('0x41')]){_0x5175c6[_0xa9ba('0x42')]=[{'all':!![]}];}return db[_0xa9ba('0x2c')][_0xa9ba('0x43')](_0x5175c6);})['then'](function(_0x159573){_0x40fd80[_0xa9ba('0x44')]=_0x159573;return _0x40fd80;})['then'](respondWithFilteredResult(_0x41baa8,_0x5175c6))[_0xa9ba('0x45')](handleError(_0x41baa8,null));};exports[_0xa9ba('0x46')]=function(_0x13bbdd,_0x1f6f3a){var _0x4a7ccc={'raw':![],'where':{'id':_0x13bbdd[_0xa9ba('0x47')]['id']}},_0x150d49={};_0x150d49[_0xa9ba('0x30')]=_[_0xa9ba('0x32')](db[_0xa9ba('0x2c')]['rawAttributes']);_0x150d49[_0xa9ba('0x31')]=_[_0xa9ba('0x32')](_0x13bbdd[_0xa9ba('0x31')]);_0x150d49[_0xa9ba('0x3c')]=_[_0xa9ba('0x33')](_0x150d49[_0xa9ba('0x30')],_0x150d49[_0xa9ba('0x31')]);_0x4a7ccc[_0xa9ba('0x34')]=_['intersection'](_0x150d49['model'],qs[_0xa9ba('0x35')](_0x13bbdd[_0xa9ba('0x31')][_0xa9ba('0x35')]));_0x4a7ccc[_0xa9ba('0x34')]=_0x4a7ccc[_0xa9ba('0x34')][_0xa9ba('0x36')]?_0x4a7ccc[_0xa9ba('0x34')]:_0x150d49['model'];if(_0x13bbdd[_0xa9ba('0x31')][_0xa9ba('0x41')]){_0x4a7ccc[_0xa9ba('0x42')]=[{'all':!![]}];}_0x4a7ccc=_['merge']({},_0x4a7ccc,_0x13bbdd[_0xa9ba('0x40')]);return db[_0xa9ba('0x2c')][_0xa9ba('0x48')](_0x4a7ccc)[_0xa9ba('0x24')](handleEntityNotFound(_0x1f6f3a,null))['then'](respondWithResult(_0x1f6f3a,null))[_0xa9ba('0x45')](handleError(_0x1f6f3a,null));};exports[_0xa9ba('0x49')]=function(_0x4e6292,_0x17a6ca){return db['VoiceChanSpy'][_0xa9ba('0x49')](_0x4e6292[_0xa9ba('0x4a')],{})[_0xa9ba('0x24')](function(_0x2b38d9){var _0x482fc1=_0x4e6292[_0xa9ba('0x4b')][_0xa9ba('0x25')]({'plain':!![]});if(!_0x482fc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482fc1[_0xa9ba('0x4c')]===_0xa9ba('0x4b')){var _0x3ad2be=_0x2b38d9[_0xa9ba('0x25')]({'plain':!![]});var _0x22b098=_0xa9ba('0x26');return db['UserProfileSection'][_0xa9ba('0x48')]({'where':{'name':_0x22b098,'userProfileId':_0x482fc1['userProfileId']},'raw':!![]})[_0xa9ba('0x24')](function(_0x4b34f8){if(_0x4b34f8&&_0x4b34f8[_0xa9ba('0x4d')]===0x0){return db['UserProfileResource'][_0xa9ba('0x49')]({'name':_0x3ad2be[_0xa9ba('0x29')],'resourceId':_0x3ad2be['id'],'type':_0x4b34f8[_0xa9ba('0x29')],'sectionId':_0x4b34f8['id']},{})[_0xa9ba('0x24')](function(){return _0x2b38d9;});}else{return _0x2b38d9;}})['catch'](function(_0x3feec3){logger['error'](_0xa9ba('0x4e'),_0x3feec3);throw _0x3feec3;});}return _0x2b38d9;})['then'](respondWithResult(_0x17a6ca,0xc9))['catch'](handleError(_0x17a6ca,null));};exports[_0xa9ba('0x23')]=function(_0x2e8b48,_0x10eef1){if(_0x2e8b48['body']['id']){delete _0x2e8b48[_0xa9ba('0x4a')]['id'];}return db[_0xa9ba('0x2c')][_0xa9ba('0x48')]({'where':{'id':_0x2e8b48['params']['id']}})[_0xa9ba('0x24')](handleEntityNotFound(_0x10eef1,null))[_0xa9ba('0x24')](saveUpdates(_0x2e8b48[_0xa9ba('0x4a')],null))['then'](respondWithResult(_0x10eef1,null))[_0xa9ba('0x45')](handleError(_0x10eef1,null));};exports[_0xa9ba('0x28')]=function(_0x521f7f,_0x3d7cdc){return db[_0xa9ba('0x2c')][_0xa9ba('0x48')]({'where':{'id':_0x521f7f['params']['id']}})['then'](handleEntityNotFound(_0x3d7cdc,null))[_0xa9ba('0x24')](removeEntity(_0x3d7cdc,null))['catch'](handleError(_0x3d7cdc,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 64bfda8..fc9a79c 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 _0xcdd2=['internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy','record','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat'];(function(_0x21fec0,_0x2f9a99){var _0xcf272e=function(_0x18e35d){while(--_0x18e35d){_0x21fec0['push'](_0x21fec0['shift']());}};_0xcf272e(++_0x2f9a99);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var BPromise=require('bluebird');var attributes=require(_0x2cdd('0x2'));var getUserApplications=function(_0x5b038f,_0x1b37f3,_0xc57eca){var _0x37512a=0x1;var _0x5ceaca=[];var _0x2738d6={'context':_0x1b37f3[_0x2cdd('0x3')]||_0x2cdd('0x4'),'exten':util[_0x2cdd('0x5')](_0x2cdd('0x6'),_0x5b038f[_0x2cdd('0x7')],_0xc57eca),'type':_0x2cdd('0x8'),'isApp':![],'ChanSpyId':_0x5b038f['id'],'UserId':_0x1b37f3['id']};_0x5ceaca[_0x2cdd('0x9')](_[_0x2cdd('0xa')]({'app':_0x2cdd('0xb'),'appdata':util['format']('CDR(type)=%s',_0x2cdd('0xc')),'priority':_0x37512a++},_0x2738d6));if(_0x5b038f[_0x2cdd('0xd')]){_0x5ceaca[_0x2cdd('0x9')](_[_0x2cdd('0xa')]({'app':'MixMonitor','appdata':util['format'](_0x2cdd('0xe'),_0x5b038f['recordingFormat']),'priority':_0x37512a++},_0x2738d6));}if(_0x5b038f[_0x2cdd('0xf')]){_0x5ceaca[_0x2cdd('0x9')](_[_0x2cdd('0xa')]({'app':_0x2cdd('0x10'),'appdata':_0x5b038f[_0x2cdd('0x11')],'priority':_0x37512a++},_0x2738d6));}_0x5ceaca[_0x2cdd('0x9')](_[_0x2cdd('0xa')]({'app':_0x2cdd('0x12'),'appdata':util[_0x2cdd('0x5')](_0x2cdd('0x13'),_0x1b37f3[_0x2cdd('0x14')],_0x5b038f[_0x2cdd('0x15')]?_0x5b038f[_0x2cdd('0x15')]['join'](''):''),'priority':_0x37512a++},_0x2738d6));if(_0x5b038f[_0x2cdd('0xd')]){_0x5ceaca['push'](_[_0x2cdd('0xa')]({'app':_0x2cdd('0x16'),'priority':_0x37512a++},_0x2738d6));}return _0x5ceaca;};var getChanSpyApplications=function(_0x2321d8,_0x35a5ff){var _0x19bbae=[];for(var _0x7ae468=0x0,_0x25e3c0=0x1;_0x7ae468<_0x35a5ff[_0x2cdd('0x17')];_0x7ae468++,_0x25e3c0=0x1){_0x19bbae=_0x19bbae[_0x2cdd('0x18')](getUserApplications(_0x2321d8,_0x35a5ff[_0x7ae468],_0x35a5ff[_0x7ae468][_0x2cdd('0x19')]));if(_0x35a5ff[_0x7ae468]['internal']!=_0x35a5ff[_0x7ae468][_0x2cdd('0x14')]){_0x19bbae=_0x19bbae[_0x2cdd('0x18')](getUserApplications(_0x2321d8,_0x35a5ff[_0x7ae468],_0x35a5ff[_0x7ae468][_0x2cdd('0x14')]));}}return _0x19bbae;};var getChanSpyPromise=function(_0xb661ed,_0x16cef1){return new BPromise(function(_0x28bcd5,_0xaac9be){return _0xb661ed['User'][_0x2cdd('0x1a')]({'attributes':['id',_0x2cdd('0x14'),'internal'],'where':{'role':_0x2cdd('0x1b'),'chanspy':!![]},'raw':!![]})[_0x2cdd('0x1c')](function(_0x54061a){if(_0x54061a){return _0x28bcd5(getChanSpyApplications(_0x16cef1,_0x54061a));}return _0x28bcd5([]);})[_0x2cdd('0x1d')](function(_0x4a5370){_0xaac9be(_0x4a5370);});});};module[_0x2cdd('0x1e')]=function(_0x29f6f9,_0x4be912){var _0x386387=_0x29f6f9[_0x2cdd('0x1f')];return _0x29f6f9[_0x2cdd('0x20')](_0x2cdd('0x21'),attributes,{'tableName':_0x2cdd('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x61bd27,_0x12648d,_0x38e90f){return getChanSpyPromise(_0x386387,_0x61bd27)['then'](function(_0x16b1d4){if(_0x16b1d4&&_0x16b1d4[_0x2cdd('0x17')]){return _0x386387[_0x2cdd('0x23')][_0x2cdd('0x24')](_0x16b1d4);}})[_0x2cdd('0x1c')](function(){_0x38e90f();})[_0x2cdd('0x1d')](function(_0x5d8b47){_0x38e90f(_0x5d8b47);});},'afterUpdate':function(_0x170488,_0xc62821,_0x16552f){return _0x386387[_0x2cdd('0x23')][_0x2cdd('0x25')]({'where':{'ChanSpyId':_0x170488['id']}})['then'](function(){return getChanSpyPromise(_0x386387,_0x170488);})[_0x2cdd('0x1c')](function(_0x2f9827){if(_0x2f9827&&_0x2f9827[_0x2cdd('0x17')]){return _0x386387[_0x2cdd('0x23')]['bulkCreate'](_0x2f9827);}})[_0x2cdd('0x1c')](function(){_0x16552f();})[_0x2cdd('0x1d')](function(_0x377082){_0x16552f(_0x377082);});},'afterDestroy':function(_0x1f357e,_0x4112f7,_0x363f19){return _0x386387[_0x2cdd('0x23')]['destroy']({'where':{'ChanSpyId':_0x1f357e['id']}})['then'](function(){_0x363f19();})['catch'](function(_0x371081){_0x363f19(_0x371081);});}}});}; \ No newline at end of file +var _0xcf75=['Authenticate','password','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','format','${UNIQUEID}.%s,a','auth'];(function(_0x1891e6,_0x1e6527){var _0x48ddbf=function(_0x1ab9ca){while(--_0x1ab9ca){_0x1891e6['push'](_0x1891e6['shift']());}};_0x48ddbf(++_0x1e6527);}(_0xcf75,0x83));var _0x5cf7=function(_0x257b5a,_0x360f51){_0x257b5a=_0x257b5a-0x0;var _0x5828f3=_0xcf75[_0x257b5a];return _0x5828f3;};'use strict';var _=require('lodash');var util=require(_0x5cf7('0x0'));var BPromise=require(_0x5cf7('0x1'));var attributes=require(_0x5cf7('0x2'));var getUserApplications=function(_0x50a52c,_0x49518b,_0x38652e){var _0x33c651=0x1;var _0x5ef72f=[];var _0x4e4b1e={'context':_0x49518b[_0x5cf7('0x3')]||_0x5cf7('0x4'),'exten':util['format'](_0x5cf7('0x5'),_0x50a52c[_0x5cf7('0x6')],_0x38652e),'type':'system','isApp':![],'ChanSpyId':_0x50a52c['id'],'UserId':_0x49518b['id']};_0x5ef72f[_0x5cf7('0x7')](_[_0x5cf7('0x8')]({'app':_0x5cf7('0x9'),'appdata':util['format'](_0x5cf7('0xa'),_0x5cf7('0xb')),'priority':_0x33c651++},_0x4e4b1e));if(_0x50a52c[_0x5cf7('0xc')]){_0x5ef72f[_0x5cf7('0x7')](_['merge']({'app':_0x5cf7('0xd'),'appdata':util[_0x5cf7('0xe')](_0x5cf7('0xf'),_0x50a52c['recordingFormat']),'priority':_0x33c651++},_0x4e4b1e));}if(_0x50a52c[_0x5cf7('0x10')]){_0x5ef72f[_0x5cf7('0x7')](_[_0x5cf7('0x8')]({'app':_0x5cf7('0x11'),'appdata':_0x50a52c[_0x5cf7('0x12')],'priority':_0x33c651++},_0x4e4b1e));}_0x5ef72f[_0x5cf7('0x7')](_[_0x5cf7('0x8')]({'app':'ChanSpy','appdata':util[_0x5cf7('0xe')]('SIP/%s,%s',_0x49518b[_0x5cf7('0x13')],_0x50a52c[_0x5cf7('0x14')]?_0x50a52c['options'][_0x5cf7('0x15')](''):''),'priority':_0x33c651++},_0x4e4b1e));if(_0x50a52c[_0x5cf7('0xc')]){_0x5ef72f[_0x5cf7('0x7')](_['merge']({'app':_0x5cf7('0x16'),'priority':_0x33c651++},_0x4e4b1e));}return _0x5ef72f;};var getChanSpyApplications=function(_0x173334,_0x203307){var _0x166469=[];for(var _0x43d644=0x0,_0x15657f=0x1;_0x43d644<_0x203307[_0x5cf7('0x17')];_0x43d644++,_0x15657f=0x1){_0x166469=_0x166469[_0x5cf7('0x18')](getUserApplications(_0x173334,_0x203307[_0x43d644],_0x203307[_0x43d644][_0x5cf7('0x19')]));if(_0x203307[_0x43d644][_0x5cf7('0x19')]!=_0x203307[_0x43d644][_0x5cf7('0x13')]){_0x166469=_0x166469['concat'](getUserApplications(_0x173334,_0x203307[_0x43d644],_0x203307[_0x43d644][_0x5cf7('0x13')]));}}return _0x166469;};var getChanSpyPromise=function(_0x1543ee,_0x5751d4){return new BPromise(function(_0x12c654,_0x2d5a14){return _0x1543ee[_0x5cf7('0x1a')][_0x5cf7('0x1b')]({'attributes':['id',_0x5cf7('0x13'),'internal'],'where':{'role':_0x5cf7('0x1c'),'chanspy':!![]},'raw':!![]})[_0x5cf7('0x1d')](function(_0x24065d){if(_0x24065d){return _0x12c654(getChanSpyApplications(_0x5751d4,_0x24065d));}return _0x12c654([]);})[_0x5cf7('0x1e')](function(_0x12bda3){_0x2d5a14(_0x12bda3);});});};module['exports']=function(_0x1f6435,_0x1867cb){var _0x1d92dc=_0x1f6435['models'];return _0x1f6435[_0x5cf7('0x1f')](_0x5cf7('0x20'),attributes,{'tableName':_0x5cf7('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fd3aa,_0x30f4ce,_0x3c357d){return getChanSpyPromise(_0x1d92dc,_0x1fd3aa)['then'](function(_0x3ba3aa){if(_0x3ba3aa&&_0x3ba3aa[_0x5cf7('0x17')]){return _0x1d92dc[_0x5cf7('0x22')][_0x5cf7('0x23')](_0x3ba3aa);}})[_0x5cf7('0x1d')](function(){_0x3c357d();})[_0x5cf7('0x1e')](function(_0x3fec44){_0x3c357d(_0x3fec44);});},'afterUpdate':function(_0x5b94dd,_0x8f77f1,_0x38f7fa){return _0x1d92dc['VoiceExtension'][_0x5cf7('0x24')]({'where':{'ChanSpyId':_0x5b94dd['id']}})['then'](function(){return getChanSpyPromise(_0x1d92dc,_0x5b94dd);})['then'](function(_0x3abf5e){if(_0x3abf5e&&_0x3abf5e[_0x5cf7('0x17')]){return _0x1d92dc[_0x5cf7('0x22')]['bulkCreate'](_0x3abf5e);}})[_0x5cf7('0x1d')](function(){_0x38f7fa();})['catch'](function(_0x206426){_0x38f7fa(_0x206426);});},'afterDestroy':function(_0xf02208,_0x5dd808,_0x58277f){return _0x1d92dc[_0x5cf7('0x22')]['destroy']({'where':{'ChanSpyId':_0xf02208['id']}})[_0x5cf7('0x1d')](function(){_0x58277f();})[_0x5cf7('0x1e')](function(_0x45c423){_0x58277f(_0x45c423);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8a462a0..c0ad3f2 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 _0x2b2a=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b5266,_0xb3e42f){var _0x51da62=function(_0x5b6e09){while(--_0x5b6e09){_0x4b5266['push'](_0x4b5266['shift']());}};_0x51da62(++_0xb3e42f);}(_0x2b2a,0xdd));var _0xa2b2=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x2b2a[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0xa2b2('0x0'));var util=require(_0xa2b2('0x1'));var moment=require(_0xa2b2('0x2'));var BPromise=require(_0xa2b2('0x3'));var rs=require(_0xa2b2('0x4'));var fs=require('fs');var Redis=require(_0xa2b2('0x5'));var db=require(_0xa2b2('0x6'))['db'];var utils=require(_0xa2b2('0x7'));var logger=require(_0xa2b2('0x8'))(_0xa2b2('0x9'));var config=require(_0xa2b2('0xa'));var jayson=require(_0xa2b2('0xb'));var client=jayson['client'][_0xa2b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x237b90,_0x4f267e,_0x36031a){return new BPromise(function(_0x461358,_0x185a97){return client[_0xa2b2('0xd')](_0x237b90,_0x36031a)[_0xa2b2('0xe')](function(_0x51d42d){logger[_0xa2b2('0xf')](_0xa2b2('0x10'),_0x4f267e,'request\x20sent');logger[_0xa2b2('0x11')](_0xa2b2('0x12'),_0x4f267e,_0xa2b2('0x13'),JSON[_0xa2b2('0x14')](_0x51d42d));if(_0x51d42d[_0xa2b2('0x15')]){if(_0x51d42d[_0xa2b2('0x15')]['code']===0x1f4){logger[_0xa2b2('0x15')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f267e,_0x51d42d[_0xa2b2('0x15')]['message']);return _0x185a97(_0x51d42d[_0xa2b2('0x15')]['message']);}logger['error'](_0xa2b2('0x10'),_0x4f267e,_0x51d42d[_0xa2b2('0x15')][_0xa2b2('0x16')]);return _0x461358(_0x51d42d['error'][_0xa2b2('0x16')]);}else{logger[_0xa2b2('0xf')](_0xa2b2('0x10'),_0x4f267e,_0xa2b2('0x13'));_0x461358(_0x51d42d['result'][_0xa2b2('0x16')]);}})['catch'](function(_0x4fcf67){logger[_0xa2b2('0x15')](_0xa2b2('0x10'),_0x4f267e,_0x4fcf67);_0x185a97(_0x4fcf67);});});} \ No newline at end of file +var _0x388b=['moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x388b,0x109));var _0xb388=function(_0x1146f7,_0x475356){_0x1146f7=_0x1146f7-0x0;var _0x2e5725=_0x388b[_0x1146f7];return _0x2e5725;};'use strict';var _=require('lodash');var util=require(_0xb388('0x0'));var moment=require(_0xb388('0x1'));var BPromise=require(_0xb388('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb388('0x3'));var db=require(_0xb388('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb388('0x5'));var config=require(_0xb388('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb388('0x7')][_0xb388('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15eec6,_0x2abd58,_0xa2ea83){return new BPromise(function(_0x580774,_0x17f324){return client['request'](_0x15eec6,_0xa2ea83)[_0xb388('0x9')](function(_0x28aeb8){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x2abd58,'request\x20sent');logger['debug'](_0xb388('0xa'),_0x2abd58,_0xb388('0xb'),JSON[_0xb388('0xc')](_0x28aeb8));if(_0x28aeb8['error']){if(_0x28aeb8['error'][_0xb388('0xd')]===0x1f4){logger[_0xb388('0xe')](_0xb388('0xf'),_0x2abd58,_0x28aeb8[_0xb388('0xe')][_0xb388('0x10')]);return _0x17f324(_0x28aeb8[_0xb388('0xe')]['message']);}logger[_0xb388('0xe')](_0xb388('0xf'),_0x2abd58,_0x28aeb8[_0xb388('0xe')][_0xb388('0x10')]);return _0x580774(_0x28aeb8[_0xb388('0xe')][_0xb388('0x10')]);}else{logger['info'](_0xb388('0xf'),_0x2abd58,'request\x20sent');_0x580774(_0x28aeb8[_0xb388('0x11')][_0xb388('0x10')]);}})[_0xb388('0x12')](function(_0x128d82){logger['error'](_0xb388('0xf'),_0x2abd58,_0x128d82);_0x17f324(_0x128d82);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8a9e094..d3652c0 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 _0x9a8c=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','/:id','update','delete'];(function(_0x20d254,_0xed3703){var _0x383069=function(_0x441fa4){while(--_0x441fa4){_0x20d254['push'](_0x20d254['shift']());}};_0x383069(++_0xed3703);}(_0x9a8c,0x80));var _0xc9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc9a8('0x0'));var util=require(_0xc9a8('0x1'));var path=require('path');var timeout=require(_0xc9a8('0x2'));var express=require('express');var router=express[_0xc9a8('0x3')]();var auth=require(_0xc9a8('0x4'));var interaction=require(_0xc9a8('0x5'));var config=require(_0xc9a8('0x6'));var controller=require('./voiceContext.controller');router[_0xc9a8('0x7')]('/',auth[_0xc9a8('0x8')](),controller[_0xc9a8('0x9')]);router['get']('/:id',auth[_0xc9a8('0x8')](),controller[_0xc9a8('0xa')]);router[_0xc9a8('0xb')]('/',auth[_0xc9a8('0x8')](),controller[_0xc9a8('0xc')]);router['put'](_0xc9a8('0xd'),auth[_0xc9a8('0x8')](),controller[_0xc9a8('0xe')]);router[_0xc9a8('0xf')]('/:id',auth[_0xc9a8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd80b=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x5d324b,_0x315e3b){var _0x564188=function(_0x5ca3ce){while(--_0x5ca3ce){_0x5d324b['push'](_0x5d324b['shift']());}};_0x564188(++_0x315e3b);}(_0xd80b,0x130));var _0xbd80=function(_0x5839e1,_0x25ee11){_0x5839e1=_0x5839e1-0x0;var _0x85a8b8=_0xd80b[_0x5839e1];return _0x85a8b8;};'use strict';var multer=require(_0xbd80('0x0'));var util=require('util');var path=require(_0xbd80('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd80('0x2'));var router=express[_0xbd80('0x3')]();var auth=require(_0xbd80('0x4'));var interaction=require(_0xbd80('0x5'));var config=require(_0xbd80('0x6'));var controller=require(_0xbd80('0x7'));router[_0xbd80('0x8')]('/',auth['isAuthenticated'](),controller[_0xbd80('0x9')]);router[_0xbd80('0x8')]('/:id',auth[_0xbd80('0xa')](),controller[_0xbd80('0xb')]);router[_0xbd80('0xc')]('/',auth[_0xbd80('0xa')](),controller[_0xbd80('0xd')]);router[_0xbd80('0xe')](_0xbd80('0xf'),auth[_0xbd80('0xa')](),controller['update']);router[_0xbd80('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xbd80('0x11')]);module[_0xbd80('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 9a521bf..221cf0e 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(_0x6ea8a2,_0x561d6c){var _0x4fe938=function(_0x1efa6c){while(--_0x1efa6c){_0x6ea8a2['push'](_0x6ea8a2['shift']());}};_0x4fe938(++_0x561d6c);}(_0x3e74,0x175));var _0x43e7=function(_0x3c46dc,_0x1e81e5){_0x3c46dc=_0x3c46dc-0x0;var _0x5da97e=_0x3e74[_0x3c46dc];return _0x5da97e;};'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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x180b93,_0x55d306){var _0x102f51=function(_0xb7074d){while(--_0xb7074d){_0x180b93['push'](_0x180b93['shift']());}};_0x102f51(++_0x55d306);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 8d87e29..50d40e0 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 _0x7217=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','get','Contexts','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','show','params','length','options','find','create','body','join','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','root','server/files/templates/context.ejs','utf8','chan_sip.so','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'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];var jayson=require(_0x7721('0x1b'));var client=jayson['client'][_0x7721('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x199930,_0x57ff6d,_0x109900){if(_0x109900){var _0x30da54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30da54[_0x7721('0x1d')](_0x57ff6d)){return _0x199930;}else{throw new db[(_0x7721('0x1e'))]['ValidationError'](_0x7721('0x1f'));}}else{return _0x199930;}}function respondWithRpcPromise(_0x25b1c0,_0x534f1b,_0x4e199a,_0x4b183e){return new BPromise(function(_0x5ed54,_0x25a628){var _0x3cc909=_0x4b183e||client;return _0x3cc909[_0x7721('0x20')](_0x25b1c0,_0x4e199a)['then'](function(_0x20f669){logger['info'](_0x7721('0x21'),_0x534f1b,'request\x20sent');logger[_0x7721('0x22')](_0x7721('0x23'),_0x534f1b,_0x7721('0x24'),JSON[_0x7721('0x25')](_0x20f669));if(_0x20f669[_0x7721('0x26')]){if(_0x20f669[_0x7721('0x26')][_0x7721('0x27')]===0x1f4){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669[_0x7721('0x26')]['message']);return _0x25a628(_0x20f669[_0x7721('0x26')][_0x7721('0x28')]);}logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669['error'][_0x7721('0x28')]);return _0x5ed54(_0x20f669['error'][_0x7721('0x28')]);}else{logger[_0x7721('0x29')](_0x7721('0x21'),_0x534f1b,_0x7721('0x24'));_0x5ed54(_0x20f669[_0x7721('0x2a')][_0x7721('0x28')]);}})[_0x7721('0x2b')](function(_0x5b4d74){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x5b4d74);_0x25a628(_0x5b4d74);});});}function respondWithStatusCode(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xcc;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x2c')](_0x1f67c7);}return _0x125564[_0x7721('0x2d')](_0x1f67c7)[_0x7721('0x2e')]();};}function respondWithResult(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0xc8;return function(_0x258ddf){if(_0x258ddf){return _0x40f367['status'](_0x52316e)['json'](_0x258ddf);}};}function respondWithFilteredResult(_0x315202,_0x343c19){return function(_0x53c904){if(_0x53c904){var _0x158d98=_0x53c904[_0x7721('0x2f')],_0x1ea4d=_0x343c19['offset'],_0x37b9f0=_0x343c19[_0x7721('0x30')]+_0x343c19[_0x7721('0x31')],_0xd7d703;if(_0x37b9f0>=_0x158d98){_0x37b9f0=_0x158d98;_0xd7d703=0xc8;}else{_0xd7d703=0xce;}_0x315202['status'](_0xd7d703);return _0x315202['set'](_0x7721('0x32'),_0x1ea4d+'-'+_0x37b9f0+'/'+_0x158d98)[_0x7721('0x33')](_0x53c904);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x34')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x35')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x36')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x37')]()[_0x7721('0x38')](function(){var _0x498654=_0x5c5b33[_0x7721('0x39')]({'plain':!![]});var _0x5ce026=_0x7721('0x3a');return db[_0x7721('0x3b')][_0x7721('0x37')]({'where':{'type':_0x5ce026,'resourceId':_0x498654['id']}})[_0x7721('0x38')](function(){return _0x5c5b33;});})[_0x7721('0x38')](function(){_0x3e4e56[_0x7721('0x2d')](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x15545a,_0x25bdd9){return function(_0x3a2eb7){if(!_0x3a2eb7){_0x15545a[_0x7721('0x2c')](0x194);}return _0x3a2eb7;};}function handleError(_0x5c806d,_0xd1df68){_0xd1df68=_0xd1df68||0x1f4;return function(_0x5e6663){logger[_0x7721('0x26')](_0x5e6663[_0x7721('0x3c')]);if(_0x5e6663[_0x7721('0x3d')]){delete _0x5e6663[_0x7721('0x3d')];}_0x5c806d[_0x7721('0x2d')](_0xd1df68)[_0x7721('0x3e')](_0x5e6663);};}exports['index']=function(_0x557c34,_0x4cadef){var _0x539560={},_0x18001c={},_0x1b3f8d={'count':0x0,'rows':[]};var _0x1acc72=_[_0x7721('0x3f')](db['VoiceContext'][_0x7721('0x40')],function(_0x4cf659){return{'name':_0x4cf659[_0x7721('0x41')],'type':_0x4cf659[_0x7721('0x42')]['key']};});_0x18001c[_0x7721('0x43')]=_[_0x7721('0x3f')](_0x1acc72,'name');_0x18001c['query']=_[_0x7721('0x44')](_0x557c34[_0x7721('0x45')]);_0x18001c[_0x7721('0x46')]=_[_0x7721('0x47')](_0x18001c['model'],_0x18001c[_0x7721('0x45')]);_0x539560[_0x7721('0x48')]=_[_0x7721('0x47')](_0x18001c[_0x7721('0x43')],qs[_0x7721('0x49')](_0x557c34['query'][_0x7721('0x49')]));_0x539560['attributes']=_0x539560[_0x7721('0x48')]['length']?_0x539560[_0x7721('0x48')]:_0x18001c[_0x7721('0x43')];if(!_0x557c34[_0x7721('0x45')]['hasOwnProperty'](_0x7721('0x4a'))){_0x539560[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x557c34['query'][_0x7721('0x31')]);_0x539560[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x557c34[_0x7721('0x45')][_0x7721('0x30')]);}_0x539560[_0x7721('0x4b')]=qs[_0x7721('0x4c')](_0x557c34['query']['sort']);_0x539560[_0x7721('0x4d')]=qs[_0x7721('0x46')](_[_0x7721('0x4e')](_0x557c34[_0x7721('0x45')],_0x18001c[_0x7721('0x46')]),_0x1acc72);if(_0x557c34[_0x7721('0x45')][_0x7721('0x4f')]){_0x539560[_0x7721('0x4d')]=_[_0x7721('0x50')](_0x539560[_0x7721('0x4d')],{'$or':_['map'](_0x1acc72,function(_0x578867){if(_0x578867[_0x7721('0x42')]!==_0x7721('0x51')){var _0x151f69={};_0x151f69[_0x578867[_0x7721('0x3d')]]={'$like':'%'+_0x557c34['query'][_0x7721('0x4f')]+'%'};return _0x151f69;}})});}_0x539560=_[_0x7721('0x50')]({},_0x539560,_0x557c34['options']);var _0x330fac={'where':_0x539560['where']};return db[_0x7721('0x52')]['count'](_0x330fac)[_0x7721('0x38')](function(_0x196be4){_0x1b3f8d[_0x7721('0x2f')]=_0x196be4;if(_0x557c34['query'][_0x7721('0x53')]){_0x539560[_0x7721('0x54')]=[{'all':!![]}];}return db['VoiceContext'][_0x7721('0x55')](_0x539560);})[_0x7721('0x38')](function(_0xf88e8c){_0x1b3f8d['rows']=_0xf88e8c;return _0x1b3f8d;})[_0x7721('0x38')](respondWithFilteredResult(_0x4cadef,_0x539560))['catch'](handleError(_0x4cadef,null));};exports[_0x7721('0x56')]=function(_0x310549,_0x4738ef){var _0x443503={'raw':![],'where':{'id':_0x310549[_0x7721('0x57')]['id']}},_0x1c95d8={};_0x1c95d8[_0x7721('0x43')]=_[_0x7721('0x44')](db[_0x7721('0x52')][_0x7721('0x40')]);_0x1c95d8[_0x7721('0x45')]=_[_0x7721('0x44')](_0x310549[_0x7721('0x45')]);_0x1c95d8[_0x7721('0x46')]=_[_0x7721('0x47')](_0x1c95d8['model'],_0x1c95d8[_0x7721('0x45')]);_0x443503[_0x7721('0x48')]=_[_0x7721('0x47')](_0x1c95d8[_0x7721('0x43')],qs[_0x7721('0x49')](_0x310549[_0x7721('0x45')][_0x7721('0x49')]));_0x443503['attributes']=_0x443503[_0x7721('0x48')][_0x7721('0x58')]?_0x443503[_0x7721('0x48')]:_0x1c95d8[_0x7721('0x43')];if(_0x310549[_0x7721('0x45')][_0x7721('0x53')]){_0x443503[_0x7721('0x54')]=[{'all':!![]}];}_0x443503=_[_0x7721('0x50')]({},_0x443503,_0x310549[_0x7721('0x59')]);return db[_0x7721('0x52')][_0x7721('0x5a')](_0x443503)['then'](handleEntityNotFound(_0x4738ef,null))[_0x7721('0x38')](respondWithResult(_0x4738ef,null))[_0x7721('0x2b')](handleError(_0x4738ef,null));};exports[_0x7721('0x5b')]=function(_0x2ee3c0,_0x15ed3b,_0x3e7918){var _0x41644f;return db[_0x7721('0x52')][_0x7721('0x5b')](_0x2ee3c0[_0x7721('0x5c')],{'raw':!![]})[_0x7721('0x38')](function(_0x2e5c28){_0x41644f=_0x2e5c28;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});})[_0x7721('0x38')](function(_0x577f47){var _0x50e9e9=fs['readFileSync'](path[_0x7721('0x5d')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x5d7036=ejs[_0x7721('0x5e')](_0x50e9e9,{'contexts':_0x577f47||[]});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x5d7036);})['then'](function(){return respondWithRpcPromise(_0x7721('0x61'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x24d1dc=_0x2ee3c0['user']['get']({'plain':!![]});if(!_0x24d1dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d1dc[_0x7721('0x62')]===_0x7721('0x63')){var _0x1ff090=_0x41644f['get']({'plain':!![]});return db[_0x7721('0x64')][_0x7721('0x5a')]({'where':{'name':_0x7721('0x3a'),'userProfileId':_0x24d1dc[_0x7721('0x65')]},'raw':!![]})[_0x7721('0x38')](function(_0x16e80b){if(_0x16e80b&&_0x16e80b[_0x7721('0x66')]===0x0){return db[_0x7721('0x3b')][_0x7721('0x5b')]({'name':_0x1ff090[_0x7721('0x3d')],'resourceId':_0x1ff090['id'],'type':_0x16e80b[_0x7721('0x3d')],'sectionId':_0x16e80b['id']},{})[_0x7721('0x38')](function(){return _0x41644f;});}else{return _0x41644f;}})[_0x7721('0x2b')](function(_0x211d27){logger[_0x7721('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211d27);throw _0x211d27;});}return _0x41644f;})[_0x7721('0x38')](respondWithResult(_0x15ed3b,0xc9))[_0x7721('0x2b')](handleError(_0x15ed3b,null));};exports[_0x7721('0x36')]=function(_0xb6db23,_0x542e30,_0x103009){var _0x104f05;return db['VoiceContext'][_0x7721('0x5a')]({'where':{'id':_0xb6db23['params']['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x542e30,null))[_0x7721('0x38')](saveUpdates(_0xb6db23[_0x7721('0x5c')],null))[_0x7721('0x38')](function(_0x3d2b7d){if(_0x3d2b7d){_0x104f05=_0x3d2b7d;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});}})[_0x7721('0x38')](function(_0x4727b0){var _0x57759a=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),_0x7721('0x6a'));var _0x3ed425=ejs[_0x7721('0x5e')](_0x57759a,{'contexts':_0x4727b0||[]});fs['writeFileSync'](_0x7721('0x60'),_0x3ed425);})[_0x7721('0x38')](function(){return respondWithRpcPromise('Reload',_0x7721('0x36'),{'module':'chan_sip.so'});})[_0x7721('0x38')](function(){return _0x104f05;})[_0x7721('0x38')](respondWithResult(_0x542e30,null))[_0x7721('0x2b')](handleError(_0x542e30,null));};exports[_0x7721('0x37')]=function(_0x1e2436,_0x2bab14,_0x258c57){var _0x5dca04;return db[_0x7721('0x52')][_0x7721('0x5a')]({'where':{'id':_0x1e2436[_0x7721('0x57')]['id']}})['then'](handleEntityNotFound(_0x2bab14,null))['then'](removeEntity(_0x2bab14,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x7721('0x38')](function(_0x2645dd){var _0x580473=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),'utf8');var _0x275b25=ejs[_0x7721('0x5e')](_0x580473,{'contexts':_0x2645dd});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x275b25);return respondWithRpcPromise(_0x7721('0x61'),'destroy',{'module':_0x7721('0x6b')});})[_0x7721('0x2b')](handleError(_0x2bab14,null));}; \ No newline at end of file +var _0xedd9=['VoiceContext','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','readFileSync','join','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','update','params','root','utf8','writeFileSync','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','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','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index'];(function(_0x4ef849,_0x32516c){var _0xe59988=function(_0x56b10c){while(--_0x56b10c){_0x4ef849['push'](_0x4ef849['shift']());}};_0xe59988(++_0x32516c);}(_0xedd9,0xfc));var _0x9edd=function(_0x456392,_0x1b2b72){_0x456392=_0x456392-0x0;var _0x4a8c6b=_0xedd9[_0x456392];return _0x4a8c6b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];var jayson=require(_0x9edd('0x17'));var client=jayson[_0x9edd('0x18')][_0x9edd('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3a7b84,_0xfca576,_0xef5498){if(_0xef5498){var _0x47eb64=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47eb64[_0x9edd('0x1a')](_0xfca576)){return _0x3a7b84;}else{throw new db[(_0x9edd('0x1b'))][(_0x9edd('0x1c'))](_0x9edd('0x1d'));}}else{return _0x3a7b84;}}function respondWithRpcPromise(_0x13b6b6,_0x338f3c,_0x1042aa,_0x75a4ab){return new BPromise(function(_0x4ea60f,_0x5f5bf4){var _0x448996=_0x75a4ab||client;return _0x448996[_0x9edd('0x1e')](_0x13b6b6,_0x1042aa)['then'](function(_0x1b54c0){logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,'request\x20sent');logger[_0x9edd('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x338f3c,_0x9edd('0x22'),JSON[_0x9edd('0x23')](_0x1b54c0));if(_0x1b54c0['error']){if(_0x1b54c0['error'][_0x9edd('0x24')]===0x1f4){logger['error'](_0x9edd('0x20'),_0x338f3c,_0x1b54c0['error']['message']);return _0x5f5bf4(_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x338f3c,_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);return _0x4ea60f(_0x1b54c0[_0x9edd('0x25')]['message']);}else{logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,_0x9edd('0x22'));_0x4ea60f(_0x1b54c0[_0x9edd('0x27')][_0x9edd('0x26')]);}})['catch'](function(_0x46c383){logger[_0x9edd('0x25')](_0x9edd('0x20'),_0x338f3c,_0x46c383);_0x5f5bf4(_0x46c383);});});}function respondWithStatusCode(_0x2f9f86,_0x310a4d){_0x310a4d=_0x310a4d||0xcc;return function(_0x4d507f){if(_0x4d507f){return _0x2f9f86['sendStatus'](_0x310a4d);}return _0x2f9f86[_0x9edd('0x28')](_0x310a4d)[_0x9edd('0x29')]();};}function respondWithResult(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0xc8;return function(_0x3c2227){if(_0x3c2227){return _0x8d67aa['status'](_0x25e135)['json'](_0x3c2227);}};}function respondWithFilteredResult(_0x214d0a,_0x257a26){return function(_0x1c762c){if(_0x1c762c){var _0x52746a=_0x1c762c[_0x9edd('0x2a')],_0x238b22=_0x257a26['offset'],_0x28cfae=_0x257a26[_0x9edd('0x2b')]+_0x257a26[_0x9edd('0x2c')],_0x2ae8dd;if(_0x28cfae>=_0x52746a){_0x28cfae=_0x52746a;_0x2ae8dd=0xc8;}else{_0x2ae8dd=0xce;}_0x214d0a[_0x9edd('0x28')](_0x2ae8dd);return _0x214d0a[_0x9edd('0x2d')](_0x9edd('0x2e'),_0x238b22+'-'+_0x28cfae+'/'+_0x52746a)[_0x9edd('0x2f')](_0x1c762c);}return null;};}function patchUpdates(_0x209aba){return function(_0x1fba7b){try{jsonpatch[_0x9edd('0x30')](_0x1fba7b,_0x209aba,!![]);}catch(_0x1c2e2b){return BPromise[_0x9edd('0x31')](_0x1c2e2b);}return _0x1fba7b[_0x9edd('0x32')]();};}function saveUpdates(_0x6907a5,_0xa55906){return function(_0x1a6c23){if(_0x1a6c23){return _0x1a6c23['update'](_0x6907a5)[_0x9edd('0x33')](function(_0x259259){return _0x259259;});}return null;};}function removeEntity(_0x267c74,_0x5d1707){return function(_0x2d2f88){if(_0x2d2f88){return _0x2d2f88[_0x9edd('0x34')]()[_0x9edd('0x33')](function(){var _0x38a7be=_0x2d2f88[_0x9edd('0x35')]({'plain':!![]});var _0x2bc4ed=_0x9edd('0x36');return db[_0x9edd('0x37')][_0x9edd('0x34')]({'where':{'type':_0x2bc4ed,'resourceId':_0x38a7be['id']}})[_0x9edd('0x33')](function(){return _0x2d2f88;});})[_0x9edd('0x33')](function(){_0x267c74[_0x9edd('0x28')](0xcc)[_0x9edd('0x29')]();});}};}function handleEntityNotFound(_0x14f780,_0x5757fc){return function(_0x37fcb2){if(!_0x37fcb2){_0x14f780['sendStatus'](0x194);}return _0x37fcb2;};}function handleError(_0x968303,_0x148630){_0x148630=_0x148630||0x1f4;return function(_0x10d6fd){logger[_0x9edd('0x25')](_0x10d6fd[_0x9edd('0x38')]);if(_0x10d6fd['name']){delete _0x10d6fd[_0x9edd('0x39')];}_0x968303[_0x9edd('0x28')](_0x148630)[_0x9edd('0x3a')](_0x10d6fd);};}exports[_0x9edd('0x3b')]=function(_0x1be77f,_0x337e6c){var _0x5c0627={},_0x1cbbac={},_0x1ccee8={'count':0x0,'rows':[]};var _0x35c16f=_['map'](db[_0x9edd('0x3c')]['rawAttributes'],function(_0x3ef1d5){return{'name':_0x3ef1d5['fieldName'],'type':_0x3ef1d5[_0x9edd('0x3d')][_0x9edd('0x3e')]};});_0x1cbbac[_0x9edd('0x3f')]=_['map'](_0x35c16f,_0x9edd('0x39'));_0x1cbbac[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x1be77f['query']);_0x1cbbac[_0x9edd('0x42')]=_['intersection'](_0x1cbbac[_0x9edd('0x3f')],_0x1cbbac[_0x9edd('0x40')]);_0x5c0627['attributes']=_[_0x9edd('0x43')](_0x1cbbac[_0x9edd('0x3f')],qs[_0x9edd('0x44')](_0x1be77f[_0x9edd('0x40')]['fields']));_0x5c0627[_0x9edd('0x45')]=_0x5c0627['attributes'][_0x9edd('0x46')]?_0x5c0627[_0x9edd('0x45')]:_0x1cbbac['model'];if(!_0x1be77f[_0x9edd('0x40')]['hasOwnProperty']('nolimit')){_0x5c0627[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2c')]);_0x5c0627[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2b')]);}_0x5c0627[_0x9edd('0x47')]=qs[_0x9edd('0x48')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x48')]);_0x5c0627[_0x9edd('0x49')]=qs[_0x9edd('0x42')](_[_0x9edd('0x4a')](_0x1be77f['query'],_0x1cbbac[_0x9edd('0x42')]),_0x35c16f);if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]){_0x5c0627[_0x9edd('0x49')]=_[_0x9edd('0x4c')](_0x5c0627[_0x9edd('0x49')],{'$or':_[_0x9edd('0x4d')](_0x35c16f,function(_0x4e9ad1){if(_0x4e9ad1['type']!=='VIRTUAL'){var _0x4a7dc9={};_0x4a7dc9[_0x4e9ad1['name']]={'$like':'%'+_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]+'%'};return _0x4a7dc9;}})});}_0x5c0627=_[_0x9edd('0x4c')]({},_0x5c0627,_0x1be77f[_0x9edd('0x4e')]);var _0x367791={'where':_0x5c0627['where']};return db[_0x9edd('0x3c')][_0x9edd('0x2a')](_0x367791)[_0x9edd('0x33')](function(_0x4a89ae){_0x1ccee8[_0x9edd('0x2a')]=_0x4a89ae;if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x5c0627[_0x9edd('0x50')]=[{'all':!![]}];}return db[_0x9edd('0x3c')][_0x9edd('0x51')](_0x5c0627);})['then'](function(_0x441e4a){_0x1ccee8[_0x9edd('0x52')]=_0x441e4a;return _0x1ccee8;})['then'](respondWithFilteredResult(_0x337e6c,_0x5c0627))[_0x9edd('0x53')](handleError(_0x337e6c,null));};exports[_0x9edd('0x54')]=function(_0x4bb324,_0x2bd089){var _0x8134cd={'raw':![],'where':{'id':_0x4bb324['params']['id']}},_0x468239={};_0x468239[_0x9edd('0x3f')]=_[_0x9edd('0x41')](db[_0x9edd('0x3c')][_0x9edd('0x55')]);_0x468239['query']=_[_0x9edd('0x41')](_0x4bb324[_0x9edd('0x40')]);_0x468239[_0x9edd('0x42')]=_['intersection'](_0x468239[_0x9edd('0x3f')],_0x468239[_0x9edd('0x40')]);_0x8134cd['attributes']=_[_0x9edd('0x43')](_0x468239['model'],qs[_0x9edd('0x44')](_0x4bb324[_0x9edd('0x40')][_0x9edd('0x44')]));_0x8134cd[_0x9edd('0x45')]=_0x8134cd[_0x9edd('0x45')][_0x9edd('0x46')]?_0x8134cd[_0x9edd('0x45')]:_0x468239[_0x9edd('0x3f')];if(_0x4bb324[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x8134cd[_0x9edd('0x50')]=[{'all':!![]}];}_0x8134cd=_['merge']({},_0x8134cd,_0x4bb324[_0x9edd('0x4e')]);return db[_0x9edd('0x3c')][_0x9edd('0x56')](_0x8134cd)['then'](handleEntityNotFound(_0x2bd089,null))[_0x9edd('0x33')](respondWithResult(_0x2bd089,null))['catch'](handleError(_0x2bd089,null));};exports['create']=function(_0x54ecfa,_0x1348a7,_0x45f47c){var _0x366316;return db[_0x9edd('0x3c')]['create'](_0x54ecfa['body'],{'raw':!![]})['then'](function(_0x71820f){_0x366316=_0x71820f;return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x2e2920){var _0x41ec97=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],_0x9edd('0x59')),'utf8');var _0x421e82=ejs[_0x9edd('0x5a')](_0x41ec97,{'contexts':_0x2e2920||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x421e82);})[_0x9edd('0x33')](function(){return respondWithRpcPromise(_0x9edd('0x5c'),'create',{'module':_0x9edd('0x5d')});})[_0x9edd('0x33')](function(){var _0x430eb4=_0x54ecfa[_0x9edd('0x5e')][_0x9edd('0x35')]({'plain':!![]});if(!_0x430eb4)throw new Error(_0x9edd('0x5f'));if(_0x430eb4['role']==='user'){var _0x452ca5=_0x366316['get']({'plain':!![]});return db[_0x9edd('0x60')][_0x9edd('0x56')]({'where':{'name':_0x9edd('0x36'),'userProfileId':_0x430eb4[_0x9edd('0x61')]},'raw':!![]})['then'](function(_0x21ead2){if(_0x21ead2&&_0x21ead2['autoAssociation']===0x0){return db[_0x9edd('0x37')][_0x9edd('0x62')]({'name':_0x452ca5[_0x9edd('0x39')],'resourceId':_0x452ca5['id'],'type':_0x21ead2['name'],'sectionId':_0x21ead2['id']},{})[_0x9edd('0x33')](function(){return _0x366316;});}else{return _0x366316;}})['catch'](function(_0x37e603){logger[_0x9edd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e603);throw _0x37e603;});}return _0x366316;})[_0x9edd('0x33')](respondWithResult(_0x1348a7,0xc9))['catch'](handleError(_0x1348a7,null));};exports[_0x9edd('0x63')]=function(_0x134c9c,_0x307a61,_0x50f4fc){var _0x4181b9;return db[_0x9edd('0x3c')][_0x9edd('0x56')]({'where':{'id':_0x134c9c[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x307a61,null))['then'](saveUpdates(_0x134c9c['body'],null))[_0x9edd('0x33')](function(_0x211526){if(_0x211526){_0x4181b9=_0x211526;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x1bc89b){var _0x4e003a=fs['readFileSync'](path[_0x9edd('0x58')](config[_0x9edd('0x65')],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x11e082=ejs[_0x9edd('0x5a')](_0x4e003a,{'contexts':_0x1bc89b||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x11e082);})['then'](function(){return respondWithRpcPromise(_0x9edd('0x5c'),_0x9edd('0x63'),{'module':'chan_sip.so'});})[_0x9edd('0x33')](function(){return _0x4181b9;})[_0x9edd('0x33')](respondWithResult(_0x307a61,null))['catch'](handleError(_0x307a61,null));};exports[_0x9edd('0x34')]=function(_0x475dc3,_0x460a92,_0x1d9536){var _0x5ce70b;return db[_0x9edd('0x3c')]['find']({'where':{'id':_0x475dc3[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x460a92,null))[_0x9edd('0x33')](removeEntity(_0x460a92,null))['then'](function(){return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x383cb9){var _0x25626a=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x3c7874=ejs[_0x9edd('0x5a')](_0x25626a,{'contexts':_0x383cb9});fs[_0x9edd('0x67')](_0x9edd('0x5b'),_0x3c7874);return respondWithRpcPromise('Reload',_0x9edd('0x34'),{'module':_0x9edd('0x5d')});})[_0x9edd('0x53')](handleError(_0x460a92,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 69eb195..5cf550a 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 _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 +var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3ed8df,_0x5e0047){var _0x2858cd=function(_0x1b0111){while(--_0x1b0111){_0x3ed8df['push'](_0x3ed8df['shift']());}};_0x2858cd(++_0x5e0047);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 591b7f8..40a3035 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 _0x1c72=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','util','moment','bluebird'];(function(_0x49cbfe,_0x1e6a12){var _0xa22a0c=function(_0x3bab8e){while(--_0x3bab8e){_0x49cbfe['push'](_0x49cbfe['shift']());}};_0xa22a0c(++_0x1e6a12);}(_0x1c72,0x13f));var _0x21c7=function(_0x502852,_0xd575cb){_0x502852=_0x502852-0x0;var _0x5096e3=_0x1c72[_0x502852];return _0x5096e3;};'use strict';var _=require('lodash');var util=require(_0x21c7('0x0'));var moment=require(_0x21c7('0x1'));var BPromise=require(_0x21c7('0x2'));var rs=require(_0x21c7('0x3'));var fs=require('fs');var Redis=require(_0x21c7('0x4'));var db=require(_0x21c7('0x5'))['db'];var utils=require(_0x21c7('0x6'));var logger=require('../../config/logger')(_0x21c7('0x7'));var config=require(_0x21c7('0x8'));var jayson=require(_0x21c7('0x9'));var client=jayson[_0x21c7('0xa')][_0x21c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa36eb4,_0x5677a3,_0x313a85){return new BPromise(function(_0x1ada36,_0x40ba0e){return client[_0x21c7('0xc')](_0xa36eb4,_0x313a85)[_0x21c7('0xd')](function(_0xdc00ba){logger[_0x21c7('0xe')](_0x21c7('0xf'),_0x5677a3,'request\x20sent');logger['debug'](_0x21c7('0x10'),_0x5677a3,_0x21c7('0x11'),JSON[_0x21c7('0x12')](_0xdc00ba));if(_0xdc00ba['error']){if(_0xdc00ba['error'][_0x21c7('0x13')]===0x1f4){logger['error'](_0x21c7('0xf'),_0x5677a3,_0xdc00ba[_0x21c7('0x14')][_0x21c7('0x15')]);return _0x40ba0e(_0xdc00ba[_0x21c7('0x14')]['message']);}logger[_0x21c7('0x14')](_0x21c7('0xf'),_0x5677a3,_0xdc00ba['error'][_0x21c7('0x15')]);return _0x1ada36(_0xdc00ba[_0x21c7('0x14')][_0x21c7('0x15')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x5677a3,_0x21c7('0x11'));_0x1ada36(_0xdc00ba['result'][_0x21c7('0x15')]);}})[_0x21c7('0x16')](function(_0x30a528){logger[_0x21c7('0x14')](_0x21c7('0xf'),_0x5677a3,_0x30a528);_0x40ba0e(_0x30a528);});});} \ No newline at end of file +var _0x6480=['message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c5708,_0x34b1f9){var _0x37fa9b=function(_0x534dc4){while(--_0x534dc4){_0x4c5708['push'](_0x4c5708['shift']());}};_0x37fa9b(++_0x34b1f9);}(_0x6480,0x1e7));var _0x0648=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6480[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0648('0x0'));var rs=require(_0x0648('0x1'));var fs=require('fs');var Redis=require(_0x0648('0x2'));var db=require(_0x0648('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0648('0x4'))('rpc');var config=require(_0x0648('0x5'));var jayson=require(_0x0648('0x6'));var client=jayson[_0x0648('0x7')][_0x0648('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d2c18,_0x3b63a1,_0x297b96){return new BPromise(function(_0x288d9e,_0x2e8fff){return client[_0x0648('0x9')](_0x4d2c18,_0x297b96)[_0x0648('0xa')](function(_0x1ba4a1){logger[_0x0648('0xb')](_0x0648('0xc'),_0x3b63a1,_0x0648('0xd'));logger[_0x0648('0xe')](_0x0648('0xf'),_0x3b63a1,_0x0648('0xd'),JSON[_0x0648('0x10')](_0x1ba4a1));if(_0x1ba4a1[_0x0648('0x11')]){if(_0x1ba4a1[_0x0648('0x11')][_0x0648('0x12')]===0x1f4){logger[_0x0648('0x11')]('VoiceContext,\x20%s,\x20%s',_0x3b63a1,_0x1ba4a1[_0x0648('0x11')][_0x0648('0x13')]);return _0x2e8fff(_0x1ba4a1[_0x0648('0x11')][_0x0648('0x13')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x3b63a1,_0x1ba4a1[_0x0648('0x11')][_0x0648('0x13')]);return _0x288d9e(_0x1ba4a1[_0x0648('0x11')][_0x0648('0x13')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3b63a1,_0x0648('0xd'));_0x288d9e(_0x1ba4a1[_0x0648('0x14')][_0x0648('0x13')]);}})[_0x0648('0x15')](function(_0x5567e9){logger[_0x0648('0x11')]('VoiceContext,\x20%s,\x20%s',_0x3b63a1,_0x5567e9);_0x2e8fff(_0x5567e9);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index fadcd61..456cf3c 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 _0xd7d6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xd7d6,0x1cb));var _0x6d7d=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0xd7d6[_0x36c6eb];return _0x30675b;};'use strict';var multer=require(_0x6d7d('0x0'));var util=require('util');var path=require(_0x6d7d('0x1'));var timeout=require(_0x6d7d('0x2'));var express=require(_0x6d7d('0x3'));var router=express[_0x6d7d('0x4')]();var auth=require(_0x6d7d('0x5'));var interaction=require(_0x6d7d('0x6'));var config=require(_0x6d7d('0x7'));var controller=require(_0x6d7d('0x8'));router[_0x6d7d('0x9')]('/',auth[_0x6d7d('0xa')](),controller[_0x6d7d('0xb')]);router[_0x6d7d('0x9')](_0x6d7d('0xc'),auth[_0x6d7d('0xa')](),controller[_0x6d7d('0xd')]);router[_0x6d7d('0x9')](_0x6d7d('0xe'),auth[_0x6d7d('0xa')](),controller[_0x6d7d('0xf')]);router[_0x6d7d('0x10')]('/',auth[_0x6d7d('0xa')](),controller[_0x6d7d('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d7d('0x12')]);router['delete']('/:id',auth[_0x6d7d('0xa')](),controller[_0x6d7d('0x13')]);module[_0x6d7d('0x14')]=router; \ No newline at end of file +var _0x183e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','create','/:id'];(function(_0x4167d0,_0x56d592){var _0x33cc61=function(_0x3801fc){while(--_0x3801fc){_0x4167d0['push'](_0x4167d0['shift']());}};_0x33cc61(++_0x56d592);}(_0x183e,0x186));var _0xe183=function(_0x420458,_0x55bbb8){_0x420458=_0x420458-0x0;var _0x4da7bf=_0x183e[_0x420458];return _0x4da7bf;};'use strict';var multer=require(_0xe183('0x0'));var util=require('util');var path=require(_0xe183('0x1'));var timeout=require('connect-timeout');var express=require(_0xe183('0x2'));var router=express[_0xe183('0x3')]();var auth=require(_0xe183('0x4'));var interaction=require(_0xe183('0x5'));var config=require('../../config/environment');var controller=require(_0xe183('0x6'));router[_0xe183('0x7')]('/',auth[_0xe183('0x8')](),controller[_0xe183('0x9')]);router[_0xe183('0x7')](_0xe183('0xa'),auth[_0xe183('0x8')](),controller['describe']);router['get']('/:id',auth[_0xe183('0x8')](),controller['show']);router['post']('/',auth[_0xe183('0x8')](),controller[_0xe183('0xb')]);router['put'](_0xe183('0xc'),auth[_0xe183('0x8')](),controller['update']);router['delete']('/:id',auth[_0xe183('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8992151..bedb796 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 _0x440e=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3ef70c,_0x73d40e){var _0x36e5a8=function(_0x4020fe){while(--_0x4020fe){_0x3ef70c['push'](_0x3ef70c['shift']());}};_0x36e5a8(++_0x73d40e);}(_0x440e,0xaf));var _0xe440=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0x440e[_0x369a98];return _0x29565c;};'use strict';var Sequelize=require(_0xe440('0x0'));module[_0xe440('0x1')]={'privilege':{'type':Sequelize[_0xe440('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe440('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe440('0x2')]},'calleridnum':{'type':Sequelize[_0xe440('0x2')]},'calleridname':{'type':Sequelize[_0xe440('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe440('0x2')]},'language':{'type':Sequelize[_0xe440('0x2')]},'accountcode':{'type':Sequelize[_0xe440('0x2')]},'context':{'type':Sequelize[_0xe440('0x2')]},'exten':{'type':Sequelize[_0xe440('0x2')]},'priority':{'type':Sequelize[_0xe440('0x3')]},'uniqueid':{'type':Sequelize[_0xe440('0x2')]},'linkedid':{'type':Sequelize[_0xe440('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe440('0x2')]},'destcalleridname':{'type':Sequelize[_0xe440('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe440('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe440('0x2')]},'destlanguage':{'type':Sequelize[_0xe440('0x2')]},'destaccountcode':{'type':Sequelize[_0xe440('0x2')]},'destcontext':{'type':Sequelize[_0xe440('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe440('0x3')]},'destuniqueid':{'type':Sequelize[_0xe440('0x2')]},'destlinkedid':{'type':Sequelize[_0xe440('0x2')]},'dialstring':{'type':Sequelize[_0xe440('0x2')]},'dialstatus':{'type':Sequelize[_0xe440('0x2')]},'starttime':{'type':Sequelize[_0xe440('0x4')]},'answertime':{'type':Sequelize[_0xe440('0x4')]},'endtime':{'type':Sequelize[_0xe440('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe440('0x5')},'routeId':{'type':Sequelize[_0xe440('0x3')]},'duration':{'type':Sequelize[_0xe440('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0d27=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x420c89,_0x30fd57){var _0x4a4fb7=function(_0x1c84b1){while(--_0x1c84b1){_0x420c89['push'](_0x420c89['shift']());}};_0x4a4fb7(++_0x30fd57);}(_0x0d27,0x82));var _0x70d2=function(_0x23cd88,_0x40573a){_0x23cd88=_0x23cd88-0x0;var _0x264636=_0x0d27[_0x23cd88];return _0x264636;};'use strict';var Sequelize=require(_0x70d2('0x0'));module[_0x70d2('0x1')]={'privilege':{'type':Sequelize[_0x70d2('0x2')]},'channel':{'type':Sequelize[_0x70d2('0x2')]},'channelstate':{'type':Sequelize[_0x70d2('0x3')]},'channelstatedesc':{'type':Sequelize[_0x70d2('0x2')]},'calleridnum':{'type':Sequelize[_0x70d2('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x70d2('0x2')]},'connectedlinename':{'type':Sequelize[_0x70d2('0x2')]},'language':{'type':Sequelize[_0x70d2('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x70d2('0x2')]},'exten':{'type':Sequelize[_0x70d2('0x2')]},'priority':{'type':Sequelize[_0x70d2('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x70d2('0x2')]},'destchannel':{'type':Sequelize[_0x70d2('0x2')]},'destchannelstate':{'type':Sequelize[_0x70d2('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x70d2('0x2')]},'destcalleridnum':{'type':Sequelize[_0x70d2('0x2')]},'destcalleridname':{'type':Sequelize[_0x70d2('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x70d2('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x70d2('0x2')]},'destlanguage':{'type':Sequelize[_0x70d2('0x2')]},'destaccountcode':{'type':Sequelize[_0x70d2('0x2')]},'destcontext':{'type':Sequelize[_0x70d2('0x2')]},'destexten':{'type':Sequelize[_0x70d2('0x2')]},'destpriority':{'type':Sequelize[_0x70d2('0x3')]},'destuniqueid':{'type':Sequelize[_0x70d2('0x2')]},'destlinkedid':{'type':Sequelize[_0x70d2('0x2')]},'dialstring':{'type':Sequelize[_0x70d2('0x2')]},'dialstatus':{'type':Sequelize[_0x70d2('0x2')]},'starttime':{'type':Sequelize[_0x70d2('0x4')]},'answertime':{'type':Sequelize[_0x70d2('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x70d2('0x2')],'comment':_0x70d2('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x70d2('0x3')]},'holdtime':{'type':Sequelize[_0x70d2('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 57cb3d1..a9f39da 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 _0x7917=['send','index','map','VoiceDialReport','rawAttributes','fieldName','type','keys','query','model','intersection','fields','attributes','order','where','pick','filters','filter','VIRTUAL','name','merge','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error'];(function(_0x31e961,_0x4b5ec9){var _0x24801e=function(_0x21c750){while(--_0x21c750){_0x31e961['push'](_0x31e961['shift']());}};_0x24801e(++_0x4b5ec9);}(_0x7917,0x131));var _0x7791=function(_0x5bd3dd,_0x1f5096){_0x5bd3dd=_0x5bd3dd-0x0;var _0x8daec3=_0x7917[_0x5bd3dd];return _0x8daec3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7791('0x0'));var zipdir=require(_0x7791('0x1'));var jsonpatch=require(_0x7791('0x2'));var rp=require(_0x7791('0x3'));var moment=require(_0x7791('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7791('0x5'));var util=require(_0x7791('0x6'));var path=require(_0x7791('0x7'));var sox=require(_0x7791('0x8'));var csv=require(_0x7791('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7791('0xa'));var squel=require('squel');var crypto=require(_0x7791('0xb'));var jsforce=require(_0x7791('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7791('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7791('0xe'));var as=require(_0x7791('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7791('0x10'))(_0x7791('0x11'));var utils=require(_0x7791('0x12'));var config=require('../../config/environment');var db=require(_0x7791('0x13'))['db'];function respondWithStatusCode(_0x2c0677,_0x449d63){_0x449d63=_0x449d63||0xcc;return function(_0x1d7a35){if(_0x1d7a35){return _0x2c0677[_0x7791('0x14')](_0x449d63);}return _0x2c0677[_0x7791('0x15')](_0x449d63)[_0x7791('0x16')]();};}function respondWithResult(_0x1f601a,_0x2ecb8f){_0x2ecb8f=_0x2ecb8f||0xc8;return function(_0x6c71bc){if(_0x6c71bc){return _0x1f601a[_0x7791('0x15')](_0x2ecb8f)['json'](_0x6c71bc);}};}function respondWithFilteredResult(_0x12903e,_0x5bf3ed){return function(_0x5b23a9){if(_0x5b23a9){var _0x487a21=_0x5b23a9[_0x7791('0x17')],_0x82ec37=_0x5bf3ed['offset'],_0x129a9a=_0x5bf3ed[_0x7791('0x18')]+_0x5bf3ed[_0x7791('0x19')],_0x121033;if(_0x129a9a>=_0x487a21){_0x129a9a=_0x487a21;_0x121033=0xc8;}else{_0x121033=0xce;}_0x12903e[_0x7791('0x15')](_0x121033);return _0x12903e['set'](_0x7791('0x1a'),_0x82ec37+'-'+_0x129a9a+'/'+_0x487a21)[_0x7791('0x1b')](_0x5b23a9);}return null;};}function patchUpdates(_0x4bb5aa){return function(_0x5566b2){try{jsonpatch[_0x7791('0x1c')](_0x5566b2,_0x4bb5aa,!![]);}catch(_0x31dcd8){return BPromise[_0x7791('0x1d')](_0x31dcd8);}return _0x5566b2[_0x7791('0x1e')]();};}function saveUpdates(_0x1d29c9,_0x62f552){return function(_0x250a90){if(_0x250a90){return _0x250a90[_0x7791('0x1f')](_0x1d29c9)[_0x7791('0x20')](function(_0x4651a0){return _0x4651a0;});}return null;};}function removeEntity(_0x2c2954,_0x898c65){return function(_0x3104c3){if(_0x3104c3){return _0x3104c3[_0x7791('0x21')]()[_0x7791('0x20')](function(){_0x2c2954['status'](0xcc)[_0x7791('0x16')]();});}};}function handleEntityNotFound(_0x3dcdaf,_0x35e9d0){return function(_0x4c9296){if(!_0x4c9296){_0x3dcdaf['sendStatus'](0x194);}return _0x4c9296;};}function handleError(_0x5f7703,_0x3f6483){_0x3f6483=_0x3f6483||0x1f4;return function(_0x9f9b06){logger[_0x7791('0x22')](_0x9f9b06['stack']);if(_0x9f9b06['name']){delete _0x9f9b06['name'];}_0x5f7703['status'](_0x3f6483)[_0x7791('0x23')](_0x9f9b06);};}exports[_0x7791('0x24')]=function(_0x4077a7,_0x2b390b){var _0x5c9096={},_0x54cce8={},_0x337310={'count':0x0,'rows':[]};var _0x3e2203=_[_0x7791('0x25')](db[_0x7791('0x26')][_0x7791('0x27')],function(_0x4356a0){return{'name':_0x4356a0[_0x7791('0x28')],'type':_0x4356a0[_0x7791('0x29')]['key']};});_0x54cce8['model']=_[_0x7791('0x25')](_0x3e2203,'name');_0x54cce8['query']=_[_0x7791('0x2a')](_0x4077a7[_0x7791('0x2b')]);_0x54cce8['filters']=_['intersection'](_0x54cce8[_0x7791('0x2c')],_0x54cce8[_0x7791('0x2b')]);_0x5c9096['attributes']=_[_0x7791('0x2d')](_0x54cce8[_0x7791('0x2c')],qs[_0x7791('0x2e')](_0x4077a7['query'][_0x7791('0x2e')]));_0x5c9096[_0x7791('0x2f')]=_0x5c9096['attributes']['length']?_0x5c9096[_0x7791('0x2f')]:_0x54cce8[_0x7791('0x2c')];if(!_0x4077a7[_0x7791('0x2b')]['hasOwnProperty']('nolimit')){_0x5c9096[_0x7791('0x19')]=qs[_0x7791('0x19')](_0x4077a7[_0x7791('0x2b')][_0x7791('0x19')]);_0x5c9096['offset']=qs['offset'](_0x4077a7['query'][_0x7791('0x18')]);}_0x5c9096[_0x7791('0x30')]=qs['sort'](_0x4077a7['query']['sort']);_0x5c9096[_0x7791('0x31')]=qs['filters'](_[_0x7791('0x32')](_0x4077a7['query'],_0x54cce8[_0x7791('0x33')]),_0x3e2203);if(_0x4077a7['query'][_0x7791('0x34')]){_0x5c9096[_0x7791('0x31')]=_['merge'](_0x5c9096[_0x7791('0x31')],{'$or':_[_0x7791('0x25')](_0x3e2203,function(_0x205f5d){if(_0x205f5d['type']!==_0x7791('0x35')){var _0x1f901f={};_0x1f901f[_0x205f5d[_0x7791('0x36')]]={'$like':'%'+_0x4077a7[_0x7791('0x2b')]['filter']+'%'};return _0x1f901f;}})});}_0x5c9096=_[_0x7791('0x37')]({},_0x5c9096,_0x4077a7[_0x7791('0x38')]);var _0x45c28f={'where':_0x5c9096[_0x7791('0x31')]};return db[_0x7791('0x26')][_0x7791('0x17')](_0x45c28f)[_0x7791('0x20')](function(_0x5bf3a7){_0x337310[_0x7791('0x17')]=_0x5bf3a7;if(_0x4077a7[_0x7791('0x2b')][_0x7791('0x39')]){_0x5c9096['include']=[{'all':!![]}];}return db[_0x7791('0x26')][_0x7791('0x3a')](_0x5c9096);})[_0x7791('0x20')](function(_0x466e3b){_0x337310[_0x7791('0x3b')]=_0x466e3b;return _0x337310;})[_0x7791('0x20')](respondWithFilteredResult(_0x2b390b,_0x5c9096))[_0x7791('0x3c')](handleError(_0x2b390b,null));};exports[_0x7791('0x3d')]=function(_0x4b6cef,_0x3de62e){var _0x17c0d6={'raw':!![],'where':{'id':_0x4b6cef[_0x7791('0x3e')]['id']}},_0x1f9a3f={};_0x1f9a3f[_0x7791('0x2c')]=_['keys'](db[_0x7791('0x26')]['rawAttributes']);_0x1f9a3f[_0x7791('0x2b')]=_['keys'](_0x4b6cef[_0x7791('0x2b')]);_0x1f9a3f['filters']=_[_0x7791('0x2d')](_0x1f9a3f['model'],_0x1f9a3f[_0x7791('0x2b')]);_0x17c0d6['attributes']=_[_0x7791('0x2d')](_0x1f9a3f[_0x7791('0x2c')],qs[_0x7791('0x2e')](_0x4b6cef['query'][_0x7791('0x2e')]));_0x17c0d6[_0x7791('0x2f')]=_0x17c0d6[_0x7791('0x2f')][_0x7791('0x3f')]?_0x17c0d6[_0x7791('0x2f')]:_0x1f9a3f[_0x7791('0x2c')];if(_0x4b6cef[_0x7791('0x2b')][_0x7791('0x39')]){_0x17c0d6['include']=[{'all':!![]}];}_0x17c0d6=_[_0x7791('0x37')]({},_0x17c0d6,_0x4b6cef[_0x7791('0x38')]);return db[_0x7791('0x26')][_0x7791('0x40')](_0x17c0d6)[_0x7791('0x20')](handleEntityNotFound(_0x3de62e,null))[_0x7791('0x20')](respondWithResult(_0x3de62e,null))[_0x7791('0x3c')](handleError(_0x3de62e,null));};exports[_0x7791('0x41')]=function(_0x22083f,_0x8f8d56){return db[_0x7791('0x26')][_0x7791('0x41')](_0x22083f[_0x7791('0x42')],{})[_0x7791('0x20')](respondWithResult(_0x8f8d56,0xc9))[_0x7791('0x3c')](handleError(_0x8f8d56,null));};exports[_0x7791('0x1f')]=function(_0x4f332b,_0x57fa93){if(_0x4f332b[_0x7791('0x42')]['id']){delete _0x4f332b[_0x7791('0x42')]['id'];}return db[_0x7791('0x26')]['find']({'where':{'id':_0x4f332b[_0x7791('0x3e')]['id']}})[_0x7791('0x20')](handleEntityNotFound(_0x57fa93,null))['then'](saveUpdates(_0x4f332b[_0x7791('0x42')],null))[_0x7791('0x20')](respondWithResult(_0x57fa93,null))['catch'](handleError(_0x57fa93,null));};exports['destroy']=function(_0x4c6ef8,_0x7709f2){return db['VoiceDialReport'][_0x7791('0x40')]({'where':{'id':_0x4c6ef8[_0x7791('0x3e')]['id']}})[_0x7791('0x20')](handleEntityNotFound(_0x7709f2,null))[_0x7791('0x20')](removeEntity(_0x7709f2,null))['catch'](handleError(_0x7709f2,null));};exports[_0x7791('0x43')]=function(_0x466f5a,_0x585eff){return db[_0x7791('0x26')][_0x7791('0x43')]()[_0x7791('0x20')](respondWithResult(_0x585eff,null))['catch'](handleError(_0x585eff,null));}; \ No newline at end of file +var _0x64d9=['where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','html-pdf','eml-format','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','limit','set','save','update','then','sendStatus','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x64d9,0x1d9));var _0x964d=function(_0x373abd,_0x22ee01){_0x373abd=_0x373abd-0x0;var _0x7a9421=_0x64d9[_0x373abd];return _0x7a9421;};'use strict';var pdf=require(_0x964d('0x0'));var emlformat=require(_0x964d('0x1'));var rimraf=require(_0x964d('0x2'));var zipdir=require(_0x964d('0x3'));var jsonpatch=require(_0x964d('0x4'));var rp=require('request-promise');var moment=require(_0x964d('0x5'));var BPromise=require(_0x964d('0x6'));var Mustache=require(_0x964d('0x7'));var util=require(_0x964d('0x8'));var path=require(_0x964d('0x9'));var sox=require(_0x964d('0xa'));var csv=require('to-csv');var ejs=require(_0x964d('0xb'));var fs=require('fs');var _=require(_0x964d('0xc'));var squel=require('squel');var crypto=require(_0x964d('0xd'));var jsforce=require(_0x964d('0xe'));var deskjs=require(_0x964d('0xf'));var toCsv=require(_0x964d('0x10'));var querystring=require(_0x964d('0x11'));var Papa=require(_0x964d('0x12'));var Redis=require(_0x964d('0x13'));var authService=require(_0x964d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x964d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x964d('0x16'))(_0x964d('0x17'));var utils=require(_0x964d('0x18'));var config=require(_0x964d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a223f,_0x37496d){_0x37496d=_0x37496d||0xcc;return function(_0x5eed6d){if(_0x5eed6d){return _0x2a223f['sendStatus'](_0x37496d);}return _0x2a223f[_0x964d('0x1a')](_0x37496d)[_0x964d('0x1b')]();};}function respondWithResult(_0x42ca54,_0x580786){_0x580786=_0x580786||0xc8;return function(_0x3f3a6d){if(_0x3f3a6d){return _0x42ca54['status'](_0x580786)[_0x964d('0x1c')](_0x3f3a6d);}};}function respondWithFilteredResult(_0x3fb4de,_0x222361){return function(_0x3e0971){if(_0x3e0971){var _0x4c929d=_0x3e0971[_0x964d('0x1d')],_0x4aef26=_0x222361['offset'],_0x27d5c8=_0x222361['offset']+_0x222361[_0x964d('0x1e')],_0x53fe3c;if(_0x27d5c8>=_0x4c929d){_0x27d5c8=_0x4c929d;_0x53fe3c=0xc8;}else{_0x53fe3c=0xce;}_0x3fb4de['status'](_0x53fe3c);return _0x3fb4de[_0x964d('0x1f')]('Content-Range',_0x4aef26+'-'+_0x27d5c8+'/'+_0x4c929d)[_0x964d('0x1c')](_0x3e0971);}return null;};}function patchUpdates(_0x5cf880){return function(_0x433f20){try{jsonpatch['apply'](_0x433f20,_0x5cf880,!![]);}catch(_0x443f96){return BPromise['reject'](_0x443f96);}return _0x433f20[_0x964d('0x20')]();};}function saveUpdates(_0x4fd82a,_0x1fb440){return function(_0x48d84d){if(_0x48d84d){return _0x48d84d[_0x964d('0x21')](_0x4fd82a)[_0x964d('0x22')](function(_0x5cb717){return _0x5cb717;});}return null;};}function removeEntity(_0x2d2a69,_0x22e357){return function(_0x21e509){if(_0x21e509){return _0x21e509['destroy']()['then'](function(){_0x2d2a69[_0x964d('0x1a')](0xcc)[_0x964d('0x1b')]();});}};}function handleEntityNotFound(_0x2ac3db,_0x677b0d){return function(_0x5d7048){if(!_0x5d7048){_0x2ac3db[_0x964d('0x23')](0x194);}return _0x5d7048;};}function handleError(_0x4f971e,_0xf14bee){_0xf14bee=_0xf14bee||0x1f4;return function(_0x3d06ec){logger[_0x964d('0x24')](_0x3d06ec[_0x964d('0x25')]);if(_0x3d06ec[_0x964d('0x26')]){delete _0x3d06ec[_0x964d('0x26')];}_0x4f971e[_0x964d('0x1a')](_0xf14bee)[_0x964d('0x27')](_0x3d06ec);};}exports['index']=function(_0x2da5a0,_0x23dfb6){var _0x54c67c={},_0x4d2377={},_0x31fc1c={'count':0x0,'rows':[]};var _0x5dbb5c=_[_0x964d('0x28')](db[_0x964d('0x29')][_0x964d('0x2a')],function(_0x5c7471){return{'name':_0x5c7471[_0x964d('0x2b')],'type':_0x5c7471['type'][_0x964d('0x2c')]};});_0x4d2377[_0x964d('0x2d')]=_[_0x964d('0x28')](_0x5dbb5c,'name');_0x4d2377[_0x964d('0x2e')]=_[_0x964d('0x2f')](_0x2da5a0[_0x964d('0x2e')]);_0x4d2377[_0x964d('0x30')]=_['intersection'](_0x4d2377[_0x964d('0x2d')],_0x4d2377['query']);_0x54c67c[_0x964d('0x31')]=_[_0x964d('0x32')](_0x4d2377['model'],qs[_0x964d('0x33')](_0x2da5a0[_0x964d('0x2e')]['fields']));_0x54c67c[_0x964d('0x31')]=_0x54c67c['attributes']['length']?_0x54c67c[_0x964d('0x31')]:_0x4d2377[_0x964d('0x2d')];if(!_0x2da5a0['query'][_0x964d('0x34')](_0x964d('0x35'))){_0x54c67c['limit']=qs[_0x964d('0x1e')](_0x2da5a0[_0x964d('0x2e')][_0x964d('0x1e')]);_0x54c67c[_0x964d('0x36')]=qs[_0x964d('0x36')](_0x2da5a0[_0x964d('0x2e')][_0x964d('0x36')]);}_0x54c67c[_0x964d('0x37')]=qs[_0x964d('0x38')](_0x2da5a0['query'][_0x964d('0x38')]);_0x54c67c['where']=qs[_0x964d('0x30')](_[_0x964d('0x39')](_0x2da5a0[_0x964d('0x2e')],_0x4d2377[_0x964d('0x30')]),_0x5dbb5c);if(_0x2da5a0[_0x964d('0x2e')][_0x964d('0x3a')]){_0x54c67c[_0x964d('0x3b')]=_[_0x964d('0x3c')](_0x54c67c[_0x964d('0x3b')],{'$or':_['map'](_0x5dbb5c,function(_0x19154b){if(_0x19154b[_0x964d('0x3d')]!==_0x964d('0x3e')){var _0x595803={};_0x595803[_0x19154b[_0x964d('0x26')]]={'$like':'%'+_0x2da5a0[_0x964d('0x2e')][_0x964d('0x3a')]+'%'};return _0x595803;}})});}_0x54c67c=_[_0x964d('0x3c')]({},_0x54c67c,_0x2da5a0[_0x964d('0x3f')]);var _0x512ab0={'where':_0x54c67c[_0x964d('0x3b')]};return db[_0x964d('0x29')][_0x964d('0x1d')](_0x512ab0)[_0x964d('0x22')](function(_0x410833){_0x31fc1c[_0x964d('0x1d')]=_0x410833;if(_0x2da5a0[_0x964d('0x2e')]['includeAll']){_0x54c67c[_0x964d('0x40')]=[{'all':!![]}];}return db[_0x964d('0x29')][_0x964d('0x41')](_0x54c67c);})[_0x964d('0x22')](function(_0x2d2d9c){_0x31fc1c[_0x964d('0x42')]=_0x2d2d9c;return _0x31fc1c;})['then'](respondWithFilteredResult(_0x23dfb6,_0x54c67c))[_0x964d('0x43')](handleError(_0x23dfb6,null));};exports[_0x964d('0x44')]=function(_0x241c95,_0x4bd8b5){var _0x300a9b={'raw':!![],'where':{'id':_0x241c95[_0x964d('0x45')]['id']}},_0xbeb515={};_0xbeb515[_0x964d('0x2d')]=_[_0x964d('0x2f')](db[_0x964d('0x29')][_0x964d('0x2a')]);_0xbeb515[_0x964d('0x2e')]=_['keys'](_0x241c95[_0x964d('0x2e')]);_0xbeb515[_0x964d('0x30')]=_['intersection'](_0xbeb515[_0x964d('0x2d')],_0xbeb515[_0x964d('0x2e')]);_0x300a9b[_0x964d('0x31')]=_[_0x964d('0x32')](_0xbeb515[_0x964d('0x2d')],qs['fields'](_0x241c95[_0x964d('0x2e')][_0x964d('0x33')]));_0x300a9b[_0x964d('0x31')]=_0x300a9b[_0x964d('0x31')][_0x964d('0x46')]?_0x300a9b['attributes']:_0xbeb515[_0x964d('0x2d')];if(_0x241c95[_0x964d('0x2e')]['includeAll']){_0x300a9b[_0x964d('0x40')]=[{'all':!![]}];}_0x300a9b=_[_0x964d('0x3c')]({},_0x300a9b,_0x241c95[_0x964d('0x3f')]);return db[_0x964d('0x29')][_0x964d('0x47')](_0x300a9b)[_0x964d('0x22')](handleEntityNotFound(_0x4bd8b5,null))[_0x964d('0x22')](respondWithResult(_0x4bd8b5,null))[_0x964d('0x43')](handleError(_0x4bd8b5,null));};exports[_0x964d('0x48')]=function(_0x29f752,_0x106df2){return db[_0x964d('0x29')][_0x964d('0x48')](_0x29f752['body'],{})[_0x964d('0x22')](respondWithResult(_0x106df2,0xc9))[_0x964d('0x43')](handleError(_0x106df2,null));};exports[_0x964d('0x21')]=function(_0x226f61,_0x42e453){if(_0x226f61['body']['id']){delete _0x226f61[_0x964d('0x49')]['id'];}return db[_0x964d('0x29')][_0x964d('0x47')]({'where':{'id':_0x226f61['params']['id']}})[_0x964d('0x22')](handleEntityNotFound(_0x42e453,null))[_0x964d('0x22')](saveUpdates(_0x226f61[_0x964d('0x49')],null))['then'](respondWithResult(_0x42e453,null))[_0x964d('0x43')](handleError(_0x42e453,null));};exports[_0x964d('0x4a')]=function(_0x46a974,_0x1da12f){return db[_0x964d('0x29')][_0x964d('0x47')]({'where':{'id':_0x46a974[_0x964d('0x45')]['id']}})['then'](handleEntityNotFound(_0x1da12f,null))[_0x964d('0x22')](removeEntity(_0x1da12f,null))[_0x964d('0x43')](handleError(_0x1da12f,null));};exports[_0x964d('0x4b')]=function(_0x5a8b0d,_0x2af82d){return db[_0x964d('0x29')][_0x964d('0x4b')]()['then'](respondWithResult(_0x2af82d,null))['catch'](handleError(_0x2af82d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 75c7019..807e2b9 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 _0xa8ed=['exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceDialReport.attributes'];(function(_0x5f5093,_0x28585f){var _0x4a6dd1=function(_0x2af025){while(--_0x2af025){_0x5f5093['push'](_0x5f5093['shift']());}};_0x4a6dd1(++_0x28585f);}(_0xa8ed,0x12f));var _0xda8e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa8ed[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xda8e('0x0'));var util=require(_0xda8e('0x1'));var logger=require(_0xda8e('0x2'))(_0xda8e('0x3'));var moment=require(_0xda8e('0x4'));var BPromise=require(_0xda8e('0x5'));var rp=require(_0xda8e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda8e('0x7'));var config=require('../../config/environment');var attributes=require(_0xda8e('0x8'));module[_0xda8e('0x9')]=function(_0x5d5385,_0x16bed4){return _0x5d5385['define'](_0xda8e('0xa'),attributes,{'tableName':_0xda8e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xda8e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf85f=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x251e59,_0x1f1371){var _0x1bc6d1=function(_0x2e1597){while(--_0x2e1597){_0x251e59['push'](_0x251e59['shift']());}};_0x1bc6d1(++_0x1f1371);}(_0xf85f,0x1ea));var _0xff85=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xf85f[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xff85('0x0'));var util=require(_0xff85('0x1'));var logger=require(_0xff85('0x2'))(_0xff85('0x3'));var moment=require(_0xff85('0x4'));var BPromise=require('bluebird');var rp=require(_0xff85('0x5'));var fs=require('fs');var path=require(_0xff85('0x6'));var rimraf=require(_0xff85('0x7'));var config=require(_0xff85('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0xff85('0x9')]=function(_0x34793d,_0x87bb50){return _0x34793d[_0xff85('0xa')](_0xff85('0xb'),attributes,{'tableName':_0xff85('0xc'),'paranoid':![],'indexes':[{'fields':[_0xff85('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8b6005d..3c1e6cd 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 _0x0884=['error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','update','raw','where','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4088('0x0'));var util=require(_0x4088('0x1'));var moment=require(_0x4088('0x2'));var BPromise=require(_0x4088('0x3'));var rs=require(_0x4088('0x4'));var fs=require('fs');var Redis=require(_0x4088('0x5'));var db=require(_0x4088('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4088('0x7'))(_0x4088('0x8'));var config=require(_0x4088('0x9'));var jayson=require(_0x4088('0xa'));var client=jayson[_0x4088('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d68aa,_0x42b2c3,_0x52baff){return new BPromise(function(_0x680227,_0x8f007c){return client[_0x4088('0xc')](_0x4d68aa,_0x52baff)[_0x4088('0xd')](function(_0x32fbb6){logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));logger[_0x4088('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x42b2c3,_0x4088('0x10'),JSON[_0x4088('0x12')](_0x32fbb6));if(_0x32fbb6[_0x4088('0x13')]){if(_0x32fbb6['error'][_0x4088('0x14')]===0x1f4){logger[_0x4088('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x8f007c(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}logger[_0x4088('0x13')](_0x4088('0xf'),_0x42b2c3,_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);return _0x680227(_0x32fbb6[_0x4088('0x13')][_0x4088('0x15')]);}else{logger[_0x4088('0xe')](_0x4088('0xf'),_0x42b2c3,_0x4088('0x10'));_0x680227(_0x32fbb6[_0x4088('0x16')][_0x4088('0x15')]);}})[_0x4088('0x17')](function(_0x38c6d6){logger[_0x4088('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x42b2c3,_0x38c6d6);_0x8f007c(_0x38c6d6);});});}exports[_0x4088('0x18')]=function(_0x24fe84){var _0xc7fc8e=this;return new Promise(function(_0xf21ee7,_0x40bea5){return db[_0x4088('0x19')][_0x4088('0x1a')](_0x24fe84[_0x4088('0x1b')],{'raw':_0x24fe84[_0x4088('0x1c')]?_0x24fe84[_0x4088('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4088('0xd')](function(_0x4b887e){logger['info']('CreateVoiceDialReport',_0x24fe84);logger['debug'](_0x4088('0x18'),_0x24fe84,JSON[_0x4088('0x12')](_0x4b887e));_0xf21ee7(_0x4b887e);})[_0x4088('0x17')](function(_0x31f333){logger['error'](_0x4088('0x18'),_0x31f333[_0x4088('0x15')],_0x24fe84);_0x40bea5(_0xc7fc8e[_0x4088('0x13')](0x1f4,_0x31f333['message']));});});};exports['UpdateVoiceDialReport']=function(_0x27ee8e){var _0xdca2c0=this;return new Promise(function(_0x3ae908,_0x159158){return db[_0x4088('0x19')][_0x4088('0x1d')](_0x27ee8e['body'],{'raw':_0x27ee8e['options']?_0x27ee8e[_0x4088('0x1c')][_0x4088('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e[_0x4088('0x1c')][_0x4088('0x1f')]||null:null,'attributes':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e[_0x4088('0x1c')]['attributes']||null:null,'limit':_0x27ee8e[_0x4088('0x1c')]?_0x27ee8e['options']['limit']||null:null})[_0x4088('0xd')](function(_0x5b8137){logger[_0x4088('0xe')]('UpdateVoiceDialReport',_0x27ee8e);logger[_0x4088('0x11')](_0x4088('0x20'),_0x27ee8e,JSON[_0x4088('0x12')](_0x5b8137));_0x3ae908(_0x5b8137);})['catch'](function(_0x3338fa){logger['error']('UpdateVoiceDialReport',_0x3338fa[_0x4088('0x15')],_0x27ee8e);_0x159158(_0xdca2c0[_0x4088('0x13')](0x1f4,_0x3338fa['message']));});});}; \ No newline at end of file +var _0x35aa=['info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','update','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x329709,_0x462041){var _0x42a910=function(_0x57ffb5){while(--_0x57ffb5){_0x329709['push'](_0x329709['shift']());}};_0x42a910(++_0x462041);}(_0x35aa,0xbe));var _0xa35a=function(_0x2211d4,_0x592254){_0x2211d4=_0x2211d4-0x0;var _0x565b56=_0x35aa[_0x2211d4];return _0x565b56;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var moment=require(_0xa35a('0x1'));var BPromise=require(_0xa35a('0x2'));var rs=require(_0xa35a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa35a('0x4'))['db'];var utils=require(_0xa35a('0x5'));var logger=require(_0xa35a('0x6'))(_0xa35a('0x7'));var config=require(_0xa35a('0x8'));var jayson=require(_0xa35a('0x9'));var client=jayson[_0xa35a('0xa')][_0xa35a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x563deb,_0x4053fb,_0x4e5d71){return new BPromise(function(_0x476134,_0xe2919c){return client[_0xa35a('0xc')](_0x563deb,_0x4e5d71)[_0xa35a('0xd')](function(_0x42ec44){logger[_0xa35a('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x4053fb,_0xa35a('0xf'));logger[_0xa35a('0x10')](_0xa35a('0x11'),_0x4053fb,_0xa35a('0xf'),JSON['stringify'](_0x42ec44));if(_0x42ec44[_0xa35a('0x12')]){if(_0x42ec44[_0xa35a('0x12')]['code']===0x1f4){logger[_0xa35a('0x12')](_0xa35a('0x13'),_0x4053fb,_0x42ec44[_0xa35a('0x12')][_0xa35a('0x14')]);return _0xe2919c(_0x42ec44[_0xa35a('0x12')][_0xa35a('0x14')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x4053fb,_0x42ec44[_0xa35a('0x12')]['message']);return _0x476134(_0x42ec44[_0xa35a('0x12')][_0xa35a('0x14')]);}else{logger['info'](_0xa35a('0x13'),_0x4053fb,_0xa35a('0xf'));_0x476134(_0x42ec44['result']['message']);}})[_0xa35a('0x15')](function(_0x41c38a){logger[_0xa35a('0x12')](_0xa35a('0x13'),_0x4053fb,_0x41c38a);_0xe2919c(_0x41c38a);});});}exports[_0xa35a('0x16')]=function(_0x223b82){var _0x474cbd=this;return new Promise(function(_0x4fd3e3,_0xdfc2){return db[_0xa35a('0x17')][_0xa35a('0x18')](_0x223b82[_0xa35a('0x19')],{'raw':_0x223b82[_0xa35a('0x1a')]?_0x223b82[_0xa35a('0x1a')][_0xa35a('0x1b')]===undefined?!![]:![]:!![]})[_0xa35a('0xd')](function(_0x8c8b91){logger[_0xa35a('0xe')](_0xa35a('0x16'),_0x223b82);logger[_0xa35a('0x10')]('CreateVoiceDialReport',_0x223b82,JSON[_0xa35a('0x1c')](_0x8c8b91));_0x4fd3e3(_0x8c8b91);})[_0xa35a('0x15')](function(_0x5269e9){logger['error'](_0xa35a('0x16'),_0x5269e9['message'],_0x223b82);_0xdfc2(_0x474cbd[_0xa35a('0x12')](0x1f4,_0x5269e9['message']));});});};exports[_0xa35a('0x1d')]=function(_0x31610f){var _0x454e45=this;return new Promise(function(_0x496ad4,_0x29ae08){return db[_0xa35a('0x17')][_0xa35a('0x1e')](_0x31610f[_0xa35a('0x19')],{'raw':_0x31610f['options']?_0x31610f['options'][_0xa35a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31610f[_0xa35a('0x1a')]?_0x31610f[_0xa35a('0x1a')][_0xa35a('0x1f')]||null:null,'attributes':_0x31610f[_0xa35a('0x1a')]?_0x31610f[_0xa35a('0x1a')][_0xa35a('0x20')]||null:null,'limit':_0x31610f['options']?_0x31610f[_0xa35a('0x1a')][_0xa35a('0x21')]||null:null})[_0xa35a('0xd')](function(_0x3e8a68){logger['info']('UpdateVoiceDialReport',_0x31610f);logger[_0xa35a('0x10')](_0xa35a('0x1d'),_0x31610f,JSON[_0xa35a('0x1c')](_0x3e8a68));_0x496ad4(_0x3e8a68);})[_0xa35a('0x15')](function(_0x431934){logger[_0xa35a('0x12')](_0xa35a('0x1d'),_0x431934[_0xa35a('0x14')],_0x31610f);_0x29ae08(_0x454e45[_0xa35a('0x12')](0x1f4,_0x431934[_0xa35a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 747695f..b1e19bf 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 _0xeb7e=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x35e536,_0x31a95e){var _0x2c6f85=function(_0x4beb0e){while(--_0x4beb0e){_0x35e536['push'](_0x35e536['shift']());}};_0x2c6f85(++_0x31a95e);}(_0xeb7e,0x1f2));var _0xeeb7=function(_0xf254d9,_0x5bdee8){_0xf254d9=_0xf254d9-0x0;var _0x2b4575=_0xeb7e[_0xf254d9];return _0x2b4575;};'use strict';var multer=require(_0xeeb7('0x0'));var util=require(_0xeeb7('0x1'));var path=require(_0xeeb7('0x2'));var timeout=require(_0xeeb7('0x3'));var express=require(_0xeeb7('0x4'));var router=express[_0xeeb7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeeb7('0x6'));var config=require(_0xeeb7('0x7'));var controller=require(_0xeeb7('0x8'));router[_0xeeb7('0x9')]('/',auth[_0xeeb7('0xa')](),controller[_0xeeb7('0xb')]);router[_0xeeb7('0x9')](_0xeeb7('0xc'),auth['isAuthenticated'](),controller[_0xeeb7('0xd')]);router[_0xeeb7('0xe')]('/',auth['isAuthenticated'](),controller[_0xeeb7('0xf')]);router['post'](_0xeeb7('0x10'),auth['isAuthenticated'](),controller['addApplications']);router['put'](_0xeeb7('0xc'),auth[_0xeeb7('0xa')](),controller[_0xeeb7('0x11')]);router[_0xeeb7('0x12')](_0xeeb7('0xc'),auth['isAuthenticated'](),controller[_0xeeb7('0x13')]);module[_0xeeb7('0x14')]=router; \ No newline at end of file +var _0x5b3c=['index','/:id','post','create','/:id/applications','addApplications','exports','multer','util','path','../../components/auth/service','./voiceExtension.controller','get','isAuthenticated'];(function(_0x241760,_0x3b4a1f){var _0x1a1d7f=function(_0x5cd96f){while(--_0x5cd96f){_0x241760['push'](_0x241760['shift']());}};_0x1a1d7f(++_0x3b4a1f);}(_0x5b3c,0xcb));var _0xc5b3=function(_0x5af97f,_0x4be6a2){_0x5af97f=_0x5af97f-0x0;var _0x1e1495=_0x5b3c[_0x5af97f];return _0x1e1495;};'use strict';var multer=require(_0xc5b3('0x0'));var util=require(_0xc5b3('0x1'));var path=require(_0xc5b3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xc5b3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc5b3('0x4'));router[_0xc5b3('0x5')]('/',auth[_0xc5b3('0x6')](),controller[_0xc5b3('0x7')]);router['get'](_0xc5b3('0x8'),auth[_0xc5b3('0x6')](),controller['show']);router[_0xc5b3('0x9')]('/',auth['isAuthenticated'](),controller[_0xc5b3('0xa')]);router[_0xc5b3('0x9')](_0xc5b3('0xb'),auth['isAuthenticated'](),controller[_0xc5b3('0xc')]);router['put'](_0xc5b3('0x8'),auth[_0xc5b3('0x6')](),controller['update']);router['delete']('/:id',auth[_0xc5b3('0x6')](),controller['destroy']);module[_0xc5b3('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 96237be..b36219e 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(_0x5e776c,_0x55c6a4){var _0x5c9a62=function(_0x39bdce){while(--_0x39bdce){_0x5e776c['push'](_0x5e776c['shift']());}};_0x5c9a62(++_0x55c6a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x169374,_0x26c937){var _0x1c2d16=function(_0x370ff1){while(--_0x370ff1){_0x169374['push'](_0x169374['shift']());}};_0x1c2d16(++_0x26c937);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index e1bd42e..c7e3853 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 _0x1967=['name','error','stack','send','VoiceExtension','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','keys','includeAll','options','find','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','count','offset','reject','save','update','then','destroy','get','InboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type'];(function(_0x1089f1,_0x5afbb0){var _0x1329a3=function(_0x378ecd){while(--_0x378ecd){_0x1089f1['push'](_0x1089f1['shift']());}};_0x1329a3(++_0x5afbb0);}(_0x1967,0x173));var _0x7196=function(_0x538b24,_0x459f62){_0x538b24=_0x538b24-0x0;var _0x36625f=_0x1967[_0x538b24];return _0x36625f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7196('0x0'));var rimraf=require(_0x7196('0x1'));var zipdir=require(_0x7196('0x2'));var jsonpatch=require(_0x7196('0x3'));var rp=require(_0x7196('0x4'));var moment=require(_0x7196('0x5'));var BPromise=require(_0x7196('0x6'));var Mustache=require(_0x7196('0x7'));var util=require(_0x7196('0x8'));var path=require(_0x7196('0x9'));var sox=require('sox');var csv=require(_0x7196('0xa'));var ejs=require(_0x7196('0xb'));var fs=require('fs');var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0xa'));var querystring=require(_0x7196('0x10'));var Papa=require(_0x7196('0x11'));var Redis=require(_0x7196('0x12'));var authService=require(_0x7196('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x14'));var logger=require(_0x7196('0x15'))(_0x7196('0x16'));var utils=require(_0x7196('0x17'));var config=require(_0x7196('0x18'));var db=require(_0x7196('0x19'))['db'];config[_0x7196('0x1a')]=_[_0x7196('0x1b')](config[_0x7196('0x1a')],{'host':_0x7196('0x1c'),'port':0x18eb});var socket=require(_0x7196('0x1d'))(new Redis(config['redis']));require(_0x7196('0x1e'))[_0x7196('0x1f')](socket);function respondWithStatusCode(_0x3545aa,_0xf098c1){_0xf098c1=_0xf098c1||0xcc;return function(_0x511aa1){if(_0x511aa1){return _0x3545aa[_0x7196('0x20')](_0xf098c1);}return _0x3545aa['status'](_0xf098c1)[_0x7196('0x21')]();};}function respondWithResult(_0x2590a6,_0xf7e97){_0xf7e97=_0xf7e97||0xc8;return function(_0x3ed1ad){if(_0x3ed1ad){return _0x2590a6[_0x7196('0x22')](_0xf7e97)[_0x7196('0x23')](_0x3ed1ad);}};}function respondWithFilteredResult(_0x22bd62,_0x1ed296){return function(_0x3e4e69){if(_0x3e4e69){var _0x32fe2b=_0x3e4e69[_0x7196('0x24')],_0x385f2d=_0x1ed296[_0x7196('0x25')],_0x5b716a=_0x1ed296[_0x7196('0x25')]+_0x1ed296['limit'],_0x4c4f91;if(_0x5b716a>=_0x32fe2b){_0x5b716a=_0x32fe2b;_0x4c4f91=0xc8;}else{_0x4c4f91=0xce;}_0x22bd62[_0x7196('0x22')](_0x4c4f91);return _0x22bd62['set']('Content-Range',_0x385f2d+'-'+_0x5b716a+'/'+_0x32fe2b)[_0x7196('0x23')](_0x3e4e69);}return null;};}function patchUpdates(_0x627223){return function(_0x8dee9d){try{jsonpatch['apply'](_0x8dee9d,_0x627223,!![]);}catch(_0x57c390){return BPromise[_0x7196('0x26')](_0x57c390);}return _0x8dee9d[_0x7196('0x27')]();};}function saveUpdates(_0x598a26,_0x18649b){return function(_0x27ff84){if(_0x27ff84){return _0x27ff84[_0x7196('0x28')](_0x598a26)[_0x7196('0x29')](function(_0x38b3d6){return _0x38b3d6;});}return null;};}function removeEntity(_0x549f34,_0x3f8178){return function(_0x520d01){if(_0x520d01){return _0x520d01[_0x7196('0x2a')]()[_0x7196('0x29')](function(){var _0x2e15c7=_0x520d01[_0x7196('0x2b')]({'plain':!![]});var _0x70aa65=[{'name':_0x7196('0x2c'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x7196('0x2d'),'ignore':![]},{'name':_0x7196('0x2e'),'value':_0x7196('0x2f'),'ignore':![]}];var _0x4e878f=_(_0x70aa65)['filter'](_0x7196('0x30'))[_0x7196('0x31')](_0x7196('0x32'))['value']();if(_[_0x7196('0x33')](_0x4e878f,_0x2e15c7['type'])){return;}var _0x4fd339=_['find'](_0x70aa65,[_0x7196('0x32'),_0x2e15c7[_0x7196('0x34')]])[_0x7196('0x35')];return db['UserProfileResource'][_0x7196('0x2a')]({'where':{'type':_0x4fd339,'resourceId':_0x2e15c7['id']}})[_0x7196('0x29')](function(){return _0x520d01;});})[_0x7196('0x29')](function(){_0x549f34[_0x7196('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39710d,_0x429160){return function(_0xd07f22){if(!_0xd07f22){_0x39710d[_0x7196('0x20')](0x194);}return _0xd07f22;};}function handleError(_0x4780e1,_0x2786f3){_0x2786f3=_0x2786f3||0x1f4;return function(_0x15c5f0){logger[_0x7196('0x36')](_0x15c5f0[_0x7196('0x37')]);if(_0x15c5f0[_0x7196('0x35')]){delete _0x15c5f0[_0x7196('0x35')];}_0x4780e1['status'](_0x2786f3)[_0x7196('0x38')](_0x15c5f0);};}exports['index']=function(_0x2452f6,_0x4c3365){var _0x372ddc={},_0x25fa11={},_0x5616ed={'count':0x0,'rows':[]};var _0x628e7d=_[_0x7196('0x31')](db[_0x7196('0x39')][_0x7196('0x3a')],function(_0x7547cf){return{'name':_0x7547cf['fieldName'],'type':_0x7547cf[_0x7196('0x34')][_0x7196('0x3b')]};});_0x25fa11[_0x7196('0x3c')]=_[_0x7196('0x31')](_0x628e7d,_0x7196('0x35'));_0x25fa11[_0x7196('0x3d')]=_['keys'](_0x2452f6[_0x7196('0x3d')]);_0x25fa11[_0x7196('0x3e')]=_[_0x7196('0x3f')](_0x25fa11['model'],_0x25fa11[_0x7196('0x3d')]);_0x372ddc[_0x7196('0x40')]=_[_0x7196('0x3f')](_0x25fa11[_0x7196('0x3c')],qs[_0x7196('0x41')](_0x2452f6[_0x7196('0x3d')][_0x7196('0x41')]));_0x372ddc[_0x7196('0x40')]=_0x372ddc[_0x7196('0x40')][_0x7196('0x42')]?_0x372ddc['attributes']:_0x25fa11[_0x7196('0x3c')];if(!_0x2452f6[_0x7196('0x3d')]['hasOwnProperty'](_0x7196('0x43'))){_0x372ddc['limit']=qs['limit'](_0x2452f6[_0x7196('0x3d')][_0x7196('0x44')]);_0x372ddc['offset']=qs['offset'](_0x2452f6[_0x7196('0x3d')][_0x7196('0x25')]);}_0x372ddc[_0x7196('0x45')]=qs['sort'](_0x2452f6[_0x7196('0x3d')][_0x7196('0x46')]);_0x372ddc[_0x7196('0x47')]=qs[_0x7196('0x3e')](_[_0x7196('0x48')](_0x2452f6[_0x7196('0x3d')],_0x25fa11[_0x7196('0x3e')]),_0x628e7d);if(_0x2452f6[_0x7196('0x3d')]['filter']){_0x372ddc[_0x7196('0x47')]=_[_0x7196('0x49')](_0x372ddc['where'],{'$or':_[_0x7196('0x31')](_0x628e7d,function(_0x43d4c0){if(_0x43d4c0['type']!==_0x7196('0x4a')){var _0x471bb2={};_0x471bb2[_0x43d4c0[_0x7196('0x35')]]={'$like':'%'+_0x2452f6['query'][_0x7196('0x4b')]+'%'};return _0x471bb2;}})});}_0x372ddc=_[_0x7196('0x49')]({},_0x372ddc,_0x2452f6['options']);var _0xcd287c={'where':_0x372ddc[_0x7196('0x47')]};return db['VoiceExtension'][_0x7196('0x24')](_0xcd287c)['then'](function(_0x55f308){_0x5616ed['count']=_0x55f308;if(_0x2452f6['query']['includeAll']){_0x372ddc[_0x7196('0x4c')]=[{'all':!![]}];}return db['VoiceExtension'][_0x7196('0x4d')](_0x372ddc);})[_0x7196('0x29')](function(_0x780275){_0x5616ed[_0x7196('0x4e')]=_0x780275;return _0x5616ed;})['then'](respondWithFilteredResult(_0x4c3365,_0x372ddc))[_0x7196('0x4f')](handleError(_0x4c3365,null));};exports['show']=function(_0x12ee76,_0x1703fc){var _0x2ca1a0={'raw':![],'where':{'id':_0x12ee76[_0x7196('0x50')]['id']}},_0x5e34e8={};_0x5e34e8[_0x7196('0x3c')]=_[_0x7196('0x51')](db['VoiceExtension']['rawAttributes']);_0x5e34e8[_0x7196('0x3d')]=_['keys'](_0x12ee76[_0x7196('0x3d')]);_0x5e34e8['filters']=_['intersection'](_0x5e34e8[_0x7196('0x3c')],_0x5e34e8['query']);_0x2ca1a0['attributes']=_['intersection'](_0x5e34e8[_0x7196('0x3c')],qs['fields'](_0x12ee76['query'][_0x7196('0x41')]));_0x2ca1a0[_0x7196('0x40')]=_0x2ca1a0[_0x7196('0x40')][_0x7196('0x42')]?_0x2ca1a0['attributes']:_0x5e34e8[_0x7196('0x3c')];if(_0x12ee76['query'][_0x7196('0x52')]){_0x2ca1a0[_0x7196('0x4c')]=[{'all':!![]}];}_0x2ca1a0=_['merge']({},_0x2ca1a0,_0x12ee76[_0x7196('0x53')]);return db[_0x7196('0x39')][_0x7196('0x54')](_0x2ca1a0)['then'](handleEntityNotFound(_0x1703fc,null))[_0x7196('0x29')](respondWithResult(_0x1703fc,null))['catch'](handleError(_0x1703fc,null));};exports[_0x7196('0x2a')]=function(_0x9fa0d3,_0x179815){return db[_0x7196('0x39')][_0x7196('0x54')]({'where':{'id':_0x9fa0d3[_0x7196('0x50')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x179815,null))[_0x7196('0x29')](removeEntity(_0x179815,null))['catch'](handleError(_0x179815,null));};exports['create']=function(_0x24d81a,_0x191c80){if(_0x24d81a[_0x7196('0x55')][_0x7196('0x34')]==='outbound'&&!_[_0x7196('0x56')](_0x24d81a[_0x7196('0x55')][_0x7196('0x57')],'_')){_0x24d81a[_0x7196('0x55')][_0x7196('0x57')]='_'[_0x7196('0x58')](_0x24d81a[_0x7196('0x55')][_0x7196('0x57')]);}return db[_0x7196('0x39')][_0x7196('0x59')](_0x24d81a[_0x7196('0x55')],{'raw':![]})['then'](function(_0x741e67){var _0x6b65c1=_0x24d81a[_0x7196('0x5a')]['get']({'plain':!![]});if(!_0x6b65c1)throw new Error(_0x7196('0x5b'));if(_0x6b65c1['role']===_0x7196('0x5a')){var _0x1b71b3=_0x741e67[_0x7196('0x2b')]({'plain':!![]});var _0x3e74ef=[{'name':_0x7196('0x2c'),'value':'inbound'},{'name':_0x7196('0x5c'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x1bc358=_[_0x7196('0x54')](_0x3e74ef,[_0x7196('0x32'),_0x1b71b3[_0x7196('0x34')]])[_0x7196('0x35')];return db[_0x7196('0x5d')][_0x7196('0x54')]({'where':{'name':_0x1bc358,'userProfileId':_0x6b65c1['userProfileId']},'raw':!![]})[_0x7196('0x29')](function(_0x14dc43){if(_0x14dc43&&_0x14dc43[_0x7196('0x5e')]===0x0){return db[_0x7196('0x5f')][_0x7196('0x59')]({'name':_0x1b71b3['name'],'resourceId':_0x1b71b3['id'],'type':_0x14dc43['name'],'sectionId':_0x14dc43['id']},{})[_0x7196('0x29')](function(){return _0x741e67;});}else{return _0x741e67;}})[_0x7196('0x4f')](function(_0xeb7e6e){logger[_0x7196('0x36')](_0x7196('0x60'),_0xeb7e6e);throw _0xeb7e6e;});}return _0x741e67;})[_0x7196('0x29')](respondWithResult(_0x191c80,0xc9))[_0x7196('0x4f')](handleError(_0x191c80,null));};exports[_0x7196('0x28')]=function(_0x13e9d0,_0x2caadd){if(_0x13e9d0[_0x7196('0x55')]['id']){delete _0x13e9d0['body']['id'];}return db[_0x7196('0x39')][_0x7196('0x54')]({'where':{'id':_0x13e9d0[_0x7196('0x50')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x2caadd,null))['then'](function(_0x4bd0f3){if(_0x4bd0f3){return db[_0x7196('0x39')][_0x7196('0x28')](_[_0x7196('0x48')](_0x13e9d0[_0x7196('0x55')],[_0x7196('0x57'),_0x7196('0x61'),'description',_0x7196('0x62'),_0x7196('0x63'),_0x7196('0x64')]),{'where':{'context':_0x4bd0f3[_0x7196('0x61')],'exten':_0x4bd0f3['exten']},'individualHooks':!![]})[_0x7196('0x29')](function(_0x3809c4){return _0x3809c4;});}return null;})[_0x7196('0x29')](respondWithStatusCode(_0x2caadd,null))[_0x7196('0x4f')](handleError(_0x2caadd,null));};exports[_0x7196('0x65')]=function(_0x37c6be,_0x57065,_0x517dfb){return db['VoiceExtension']['findOne']({'where':{'id':_0x37c6be[_0x7196('0x50')]['id']}})['then'](handleEntityNotFound(_0x57065,null))[_0x7196('0x29')](function(_0x432a38){if(_0x432a38){return db[_0x7196('0x66')][_0x7196('0x67')](function(_0x1f4f0a){return db[_0x7196('0x39')][_0x7196('0x2a')]({'where':{'VoiceExtensionId':_0x37c6be[_0x7196('0x50')]['id']},'transaction':_0x1f4f0a})[_0x7196('0x29')](function(_0x52ab69){var _0x5c001a=_[_0x7196('0x31')](_0x37c6be[_0x7196('0x55')],function(_0x13e53b){_0x13e53b[_0x7196('0x68')]=_0x37c6be[_0x7196('0x50')]['id'];return _0x13e53b;});return db[_0x7196('0x39')][_0x7196('0x69')](_0x5c001a,{'transaction':_0x1f4f0a});});})[_0x7196('0x29')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x37c6be[_0x7196('0x50')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x7196('0x29')](respondWithResult(_0x57065,null))['catch'](handleError(_0x57065,null));}; \ No newline at end of file +var _0x1261=['includeAll','include','rows','params','catch','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','recordingFormat','mandatoryDisposition','transaction','VoiceExtensionId','cast(priority\x20as\x20unsigned)','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','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','set','Content-Range','reject','save','update','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','map','value','includes','type','find','UserProfileResource','error','stack','name','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','count'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1261,0x144));var _0x1126=function(_0x55bd12,_0x3ccb52){_0x55bd12=_0x55bd12-0x0;var _0x1941dd=_0x1261[_0x55bd12];return _0x1941dd;};'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'];config[_0x1126('0x17')]=_[_0x1126('0x18')](config[_0x1126('0x17')],{'host':_0x1126('0x19'),'port':0x18eb});var socket=require(_0x1126('0x1a'))(new Redis(config[_0x1126('0x17')]));require(_0x1126('0x1b'))[_0x1126('0x1c')](socket);function respondWithStatusCode(_0x53a8f0,_0x5de9a7){_0x5de9a7=_0x5de9a7||0xcc;return function(_0x1af673){if(_0x1af673){return _0x53a8f0[_0x1126('0x1d')](_0x5de9a7);}return _0x53a8f0[_0x1126('0x1e')](_0x5de9a7)['end']();};}function respondWithResult(_0x45149c,_0x4794a7){_0x4794a7=_0x4794a7||0xc8;return function(_0x35fe9f){if(_0x35fe9f){return _0x45149c[_0x1126('0x1e')](_0x4794a7)[_0x1126('0x1f')](_0x35fe9f);}};}function respondWithFilteredResult(_0x4e1c97,_0x245cd7){return function(_0x1695f6){if(_0x1695f6){var _0x4a7b49=_0x1695f6['count'],_0x4d2b38=_0x245cd7['offset'],_0x22ae0b=_0x245cd7[_0x1126('0x20')]+_0x245cd7['limit'],_0x2b2487;if(_0x22ae0b>=_0x4a7b49){_0x22ae0b=_0x4a7b49;_0x2b2487=0xc8;}else{_0x2b2487=0xce;}_0x4e1c97[_0x1126('0x1e')](_0x2b2487);return _0x4e1c97[_0x1126('0x21')](_0x1126('0x22'),_0x4d2b38+'-'+_0x22ae0b+'/'+_0x4a7b49)['json'](_0x1695f6);}return null;};}function patchUpdates(_0x2a08ba){return function(_0x49d209){try{jsonpatch['apply'](_0x49d209,_0x2a08ba,!![]);}catch(_0x30f6b3){return BPromise[_0x1126('0x23')](_0x30f6b3);}return _0x49d209[_0x1126('0x24')]();};}function saveUpdates(_0x36d254,_0x526ca1){return function(_0x29ab60){if(_0x29ab60){return _0x29ab60[_0x1126('0x25')](_0x36d254)['then'](function(_0x2175fa){return _0x2175fa;});}return null;};}function removeEntity(_0x59cd8e,_0x529dd9){return function(_0x4b57ab){if(_0x4b57ab){return _0x4b57ab[_0x1126('0x26')]()[_0x1126('0x27')](function(){var _0x329914=_0x4b57ab[_0x1126('0x28')]({'plain':!![]});var _0x566c09=[{'name':_0x1126('0x29'),'value':_0x1126('0x2a'),'ignore':![]},{'name':_0x1126('0x2b'),'value':'outbound','ignore':![]},{'name':_0x1126('0x2c'),'value':_0x1126('0x2d'),'ignore':![]}];var _0xa293f4=_(_0x566c09)['filter']('ignore')[_0x1126('0x2e')](_0x1126('0x2f'))['value']();if(_[_0x1126('0x30')](_0xa293f4,_0x329914[_0x1126('0x31')])){return;}var _0x4a334a=_[_0x1126('0x32')](_0x566c09,['value',_0x329914[_0x1126('0x31')]])['name'];return db[_0x1126('0x33')]['destroy']({'where':{'type':_0x4a334a,'resourceId':_0x329914['id']}})[_0x1126('0x27')](function(){return _0x4b57ab;});})['then'](function(){_0x59cd8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17646e,_0xa8906d){return function(_0x1cef48){if(!_0x1cef48){_0x17646e['sendStatus'](0x194);}return _0x1cef48;};}function handleError(_0x2a3055,_0x226afb){_0x226afb=_0x226afb||0x1f4;return function(_0x56f7f8){logger[_0x1126('0x34')](_0x56f7f8[_0x1126('0x35')]);if(_0x56f7f8[_0x1126('0x36')]){delete _0x56f7f8[_0x1126('0x36')];}_0x2a3055['status'](_0x226afb)['send'](_0x56f7f8);};}exports[_0x1126('0x37')]=function(_0x19e6e4,_0x2d9bd2){var _0x2c67eb={},_0x55244a={},_0x145314={'count':0x0,'rows':[]};var _0x6f4312=_[_0x1126('0x2e')](db[_0x1126('0x38')][_0x1126('0x39')],function(_0x5df232){return{'name':_0x5df232[_0x1126('0x3a')],'type':_0x5df232[_0x1126('0x31')][_0x1126('0x3b')]};});_0x55244a[_0x1126('0x3c')]=_['map'](_0x6f4312,'name');_0x55244a[_0x1126('0x3d')]=_[_0x1126('0x3e')](_0x19e6e4['query']);_0x55244a[_0x1126('0x3f')]=_[_0x1126('0x40')](_0x55244a[_0x1126('0x3c')],_0x55244a['query']);_0x2c67eb['attributes']=_[_0x1126('0x40')](_0x55244a[_0x1126('0x3c')],qs[_0x1126('0x41')](_0x19e6e4[_0x1126('0x3d')]['fields']));_0x2c67eb[_0x1126('0x42')]=_0x2c67eb['attributes'][_0x1126('0x43')]?_0x2c67eb[_0x1126('0x42')]:_0x55244a[_0x1126('0x3c')];if(!_0x19e6e4[_0x1126('0x3d')][_0x1126('0x44')]('nolimit')){_0x2c67eb[_0x1126('0x45')]=qs[_0x1126('0x45')](_0x19e6e4[_0x1126('0x3d')][_0x1126('0x45')]);_0x2c67eb[_0x1126('0x20')]=qs[_0x1126('0x20')](_0x19e6e4[_0x1126('0x3d')]['offset']);}_0x2c67eb[_0x1126('0x46')]=qs[_0x1126('0x47')](_0x19e6e4[_0x1126('0x3d')][_0x1126('0x47')]);_0x2c67eb[_0x1126('0x48')]=qs['filters'](_['pick'](_0x19e6e4[_0x1126('0x3d')],_0x55244a[_0x1126('0x3f')]),_0x6f4312);if(_0x19e6e4[_0x1126('0x3d')][_0x1126('0x49')]){_0x2c67eb[_0x1126('0x48')]=_[_0x1126('0x4a')](_0x2c67eb['where'],{'$or':_['map'](_0x6f4312,function(_0x4cb1db){if(_0x4cb1db[_0x1126('0x31')]!=='VIRTUAL'){var _0xf84005={};_0xf84005[_0x4cb1db[_0x1126('0x36')]]={'$like':'%'+_0x19e6e4[_0x1126('0x3d')][_0x1126('0x49')]+'%'};return _0xf84005;}})});}_0x2c67eb=_['merge']({},_0x2c67eb,_0x19e6e4['options']);var _0x353042={'where':_0x2c67eb[_0x1126('0x48')]};return db[_0x1126('0x38')]['count'](_0x353042)[_0x1126('0x27')](function(_0x5f35fa){_0x145314[_0x1126('0x4b')]=_0x5f35fa;if(_0x19e6e4['query'][_0x1126('0x4c')]){_0x2c67eb[_0x1126('0x4d')]=[{'all':!![]}];}return db[_0x1126('0x38')]['findAll'](_0x2c67eb);})[_0x1126('0x27')](function(_0x2ffccc){_0x145314[_0x1126('0x4e')]=_0x2ffccc;return _0x145314;})['then'](respondWithFilteredResult(_0x2d9bd2,_0x2c67eb))['catch'](handleError(_0x2d9bd2,null));};exports['show']=function(_0x6e78cf,_0x520b62){var _0x1e197e={'raw':![],'where':{'id':_0x6e78cf[_0x1126('0x4f')]['id']}},_0x507568={};_0x507568[_0x1126('0x3c')]=_[_0x1126('0x3e')](db[_0x1126('0x38')][_0x1126('0x39')]);_0x507568['query']=_[_0x1126('0x3e')](_0x6e78cf[_0x1126('0x3d')]);_0x507568['filters']=_[_0x1126('0x40')](_0x507568[_0x1126('0x3c')],_0x507568['query']);_0x1e197e[_0x1126('0x42')]=_[_0x1126('0x40')](_0x507568['model'],qs[_0x1126('0x41')](_0x6e78cf[_0x1126('0x3d')][_0x1126('0x41')]));_0x1e197e['attributes']=_0x1e197e[_0x1126('0x42')][_0x1126('0x43')]?_0x1e197e[_0x1126('0x42')]:_0x507568[_0x1126('0x3c')];if(_0x6e78cf[_0x1126('0x3d')][_0x1126('0x4c')]){_0x1e197e[_0x1126('0x4d')]=[{'all':!![]}];}_0x1e197e=_[_0x1126('0x4a')]({},_0x1e197e,_0x6e78cf['options']);return db[_0x1126('0x38')]['find'](_0x1e197e)[_0x1126('0x27')](handleEntityNotFound(_0x520b62,null))[_0x1126('0x27')](respondWithResult(_0x520b62,null))['catch'](handleError(_0x520b62,null));};exports['destroy']=function(_0x324995,_0x3c1d16){return db[_0x1126('0x38')]['find']({'where':{'id':_0x324995[_0x1126('0x4f')]['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x3c1d16,null))[_0x1126('0x27')](removeEntity(_0x3c1d16,null))[_0x1126('0x50')](handleError(_0x3c1d16,null));};exports['create']=function(_0x30d1b3,_0x46551f){if(_0x30d1b3['body']['type']==='outbound'&&!_['startsWith'](_0x30d1b3[_0x1126('0x51')][_0x1126('0x52')],'_')){_0x30d1b3['body'][_0x1126('0x52')]='_'[_0x1126('0x53')](_0x30d1b3[_0x1126('0x51')][_0x1126('0x52')]);}return db[_0x1126('0x38')]['create'](_0x30d1b3[_0x1126('0x51')],{'raw':![]})[_0x1126('0x27')](function(_0x5d6414){var _0x322016=_0x30d1b3[_0x1126('0x54')][_0x1126('0x28')]({'plain':!![]});if(!_0x322016)throw new Error(_0x1126('0x55'));if(_0x322016[_0x1126('0x56')]==='user'){var _0x673c09=_0x5d6414['get']({'plain':!![]});var _0x868b2c=[{'name':_0x1126('0x29'),'value':_0x1126('0x2a')},{'name':'OutboundRoutes','value':_0x1126('0x57')},{'name':_0x1126('0x2c'),'value':'internal'}];var _0x30812d=_[_0x1126('0x32')](_0x868b2c,[_0x1126('0x2f'),_0x673c09['type']])[_0x1126('0x36')];return db[_0x1126('0x58')][_0x1126('0x32')]({'where':{'name':_0x30812d,'userProfileId':_0x322016[_0x1126('0x59')]},'raw':!![]})[_0x1126('0x27')](function(_0x26949c){if(_0x26949c&&_0x26949c[_0x1126('0x5a')]===0x0){return db[_0x1126('0x33')]['create']({'name':_0x673c09[_0x1126('0x36')],'resourceId':_0x673c09['id'],'type':_0x26949c[_0x1126('0x36')],'sectionId':_0x26949c['id']},{})[_0x1126('0x27')](function(){return _0x5d6414;});}else{return _0x5d6414;}})[_0x1126('0x50')](function(_0x425193){logger['error'](_0x1126('0x5b'),_0x425193);throw _0x425193;});}return _0x5d6414;})[_0x1126('0x27')](respondWithResult(_0x46551f,0xc9))['catch'](handleError(_0x46551f,null));};exports[_0x1126('0x25')]=function(_0x5246aa,_0x272274){if(_0x5246aa[_0x1126('0x51')]['id']){delete _0x5246aa['body']['id'];}return db[_0x1126('0x38')][_0x1126('0x32')]({'where':{'id':_0x5246aa[_0x1126('0x4f')]['id']}})['then'](handleEntityNotFound(_0x272274,null))[_0x1126('0x27')](function(_0x4c1384){if(_0x4c1384){return db['VoiceExtension'][_0x1126('0x25')](_[_0x1126('0x5c')](_0x5246aa[_0x1126('0x51')],[_0x1126('0x52'),_0x1126('0x5d'),_0x1126('0x5e'),_0x1126('0x5f'),'cutdigits',_0x1126('0x60')]),{'where':{'context':_0x4c1384[_0x1126('0x5d')],'exten':_0x4c1384[_0x1126('0x52')]},'individualHooks':!![]})[_0x1126('0x27')](function(_0x3f87aa){return _0x3f87aa;});}return null;})[_0x1126('0x27')](respondWithStatusCode(_0x272274,null))['catch'](handleError(_0x272274,null));};exports['addApplications']=function(_0x16a343,_0x3921c2,_0x4bf2b3){return db['VoiceExtension']['findOne']({'where':{'id':_0x16a343['params']['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x3921c2,null))[_0x1126('0x27')](function(_0x3440c5){if(_0x3440c5){return db['sequelize'][_0x1126('0x61')](function(_0x45c782){return db[_0x1126('0x38')][_0x1126('0x26')]({'where':{'VoiceExtensionId':_0x16a343[_0x1126('0x4f')]['id']},'transaction':_0x45c782})[_0x1126('0x27')](function(_0x131056){var _0x49a0a3=_[_0x1126('0x2e')](_0x16a343[_0x1126('0x51')],function(_0x43bd70){_0x43bd70[_0x1126('0x62')]=_0x16a343[_0x1126('0x4f')]['id'];return _0x43bd70;});return db['VoiceExtension']['bulkCreate'](_0x49a0a3,{'transaction':_0x45c782});});})[_0x1126('0x27')](function(){return db[_0x1126('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x16a343[_0x1126('0x4f')]['id']},'order':_0x1126('0x63')});});}})[_0x1126('0x27')](respondWithResult(_0x3921c2,null))[_0x1126('0x50')](handleError(_0x3921c2,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9bb4e78..c45d11e 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 _0x677c=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','VoiceExtension'];(function(_0x34acae,_0x1472d8){var _0x2d475f=function(_0x23d47){while(--_0x23d47){_0x34acae['push'](_0x34acae['shift']());}};_0x2d475f(++_0x1472d8);}(_0x677c,0x187));var _0xc677=function(_0x2d4ac2,_0x38a9de){_0x2d4ac2=_0x2d4ac2-0x0;var _0x227bc6=_0x677c[_0x2d4ac2];return _0x227bc6;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xc677('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc677('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc677('0x2'),'afterDestroy':_0xc677('0x3')};function emitEvent(_0x20a0e8){return function(_0x444e7e,_0x577e6b,_0x13f450){VoiceExtensionEvents[_0xc677('0x4')](_0x20a0e8+':'+_0x444e7e['id'],_0x444e7e);VoiceExtensionEvents[_0xc677('0x4')](_0x20a0e8,_0x444e7e);_0x13f450(null);};}for(var e in events){if(events[_0xc677('0x5')](e)){var event=events[e];VoiceExtension[_0xc677('0x6')](e,emitEvent(event));}}module[_0xc677('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0d91=['hasOwnProperty','hook','exports','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x1b91f5,_0x4717a4){var _0x3c20e1=function(_0x4b86b0){while(--_0x4b86b0){_0x1b91f5['push'](_0x1b91f5['shift']());}};_0x3c20e1(++_0x4717a4);}(_0x0d91,0x1f2));var _0x10d9=function(_0x14a34a,_0x424129){_0x14a34a=_0x14a34a-0x0;var _0x4d921e=_0x0d91[_0x14a34a];return _0x4d921e;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x10d9('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x10d9('0x1')](0x0);var events={'afterCreate':_0x10d9('0x2'),'afterUpdate':_0x10d9('0x3'),'afterDestroy':_0x10d9('0x4')};function emitEvent(_0x24a66a){return function(_0x54eb95,_0x3dc5bb,_0x5787e5){VoiceExtensionEvents['emit'](_0x24a66a+':'+_0x54eb95['id'],_0x54eb95);VoiceExtensionEvents[_0x10d9('0x5')](_0x24a66a,_0x54eb95);_0x5787e5(null);};}for(var e in events){if(events[_0x10d9('0x6')](e)){var event=events[e];VoiceExtension[_0x10d9('0x7')](e,emitEvent(event));}}module[_0x10d9('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 8ea7885..2125ffb 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 _0x2ef3=['exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceExtension.attributes'];(function(_0x1d4667,_0x179c04){var _0x4f6cf4=function(_0x3761ea){while(--_0x3761ea){_0x1d4667['push'](_0x1d4667['shift']());}};_0x4f6cf4(++_0x179c04);}(_0x2ef3,0xba));var _0x32ef=function(_0x77efc7,_0x1b2312){_0x77efc7=_0x77efc7-0x0;var _0x5d1561=_0x2ef3[_0x77efc7];return _0x5d1561;};'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 _0x4975=['./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x49eba0,_0x56f747){var _0x7bda6c=function(_0x7cb572){while(--_0x7cb572){_0x49eba0['push'](_0x49eba0['shift']());}};_0x7bda6c(++_0x56f747);}(_0x4975,0x86));var _0x5497=function(_0x5a25e1,_0x6a17e8){_0x5a25e1=_0x5a25e1-0x0;var _0x5e76c7=_0x4975[_0x5a25e1];return _0x5e76c7;};'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 diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3d21508..d998c60 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 _0x81eb=['client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','info','message','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceExtension','debug','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x459c75,_0x4d3740){var _0xd11734=function(_0x5445d5){while(--_0x5445d5){_0x459c75['push'](_0x459c75['shift']());}};_0xd11734(++_0x4d3740);}(_0x81eb,0x101));var _0xb81e=function(_0x4691d7,_0x2a6a2c){_0x4691d7=_0x4691d7-0x0;var _0x15aa16=_0x81eb[_0x4691d7];return _0x15aa16;};'use strict';var _=require('lodash');var util=require(_0xb81e('0x0'));var moment=require(_0xb81e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb81e('0x2'));var db=require(_0xb81e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb81e('0x4'))(_0xb81e('0x5'));var config=require(_0xb81e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb81e('0x7')][_0xb81e('0x8')]({'port':0x232a});config[_0xb81e('0x9')]=_['defaults'](config[_0xb81e('0x9')],{'host':_0xb81e('0xa'),'port':0x18eb});var socket=require(_0xb81e('0xb'))(new Redis(config[_0xb81e('0x9')]));require(_0xb81e('0xc'))['register'](socket);function respondWithRpcPromise(_0x5c071e,_0x7232c,_0x4fd398){return new BPromise(function(_0x499e5e,_0x3e6837){return client[_0xb81e('0xd')](_0x5c071e,_0x4fd398)['then'](function(_0xdd61de){logger['info'](_0xb81e('0xe'),_0x7232c,_0xb81e('0xf'));logger['debug'](_0xb81e('0x10'),_0x7232c,_0xb81e('0xf'),JSON[_0xb81e('0x11')](_0xdd61de));if(_0xdd61de['error']){if(_0xdd61de['error'][_0xb81e('0x12')]===0x1f4){logger[_0xb81e('0x13')](_0xb81e('0xe'),_0x7232c,_0xdd61de[_0xb81e('0x13')]['message']);return _0x3e6837(_0xdd61de[_0xb81e('0x13')]['message']);}logger[_0xb81e('0x13')](_0xb81e('0xe'),_0x7232c,_0xdd61de['error']['message']);return _0x499e5e(_0xdd61de['error']['message']);}else{logger[_0xb81e('0x14')](_0xb81e('0xe'),_0x7232c,_0xb81e('0xf'));_0x499e5e(_0xdd61de['result'][_0xb81e('0x15')]);}})[_0xb81e('0x16')](function(_0x1b82eb){logger[_0xb81e('0x13')](_0xb81e('0xe'),_0x7232c,_0x1b82eb);_0x3e6837(_0x1b82eb);});});}exports['GetVoiceExtension']=function(_0xc4b11a){var _0x179607=this;return new Promise(function(_0x16a594,_0x46622c){return db['VoiceExtension'][_0xb81e('0x17')]({'raw':_0xc4b11a[_0xb81e('0x18')]?_0xc4b11a[_0xb81e('0x18')][_0xb81e('0x19')]===undefined?!![]:![]:!![],'where':_0xc4b11a['options']?_0xc4b11a['options'][_0xb81e('0x1a')]||null:null,'attributes':_0xc4b11a[_0xb81e('0x18')]?_0xc4b11a[_0xb81e('0x18')][_0xb81e('0x1b')]||null:null,'limit':_0xc4b11a[_0xb81e('0x18')]?_0xc4b11a['options']['limit']||null:null,'include':_0xc4b11a[_0xb81e('0x18')]?_0xc4b11a[_0xb81e('0x18')][_0xb81e('0x1c')]?_[_0xb81e('0x1d')](_0xc4b11a[_0xb81e('0x18')][_0xb81e('0x1c')],function(_0x31e19d){return{'model':db[_0x31e19d[_0xb81e('0x1e')]],'as':_0x31e19d['as'],'attributes':_0x31e19d[_0xb81e('0x1b')],'include':_0x31e19d[_0xb81e('0x1c')]?_[_0xb81e('0x1d')](_0x31e19d[_0xb81e('0x1c')],function(_0xb7f2a5){return{'model':db[_0xb7f2a5[_0xb81e('0x1e')]],'as':_0xb7f2a5['as'],'attributes':_0xb7f2a5[_0xb81e('0x1b')],'include':_0xb7f2a5[_0xb81e('0x1c')]?_[_0xb81e('0x1d')](_0xb7f2a5['include'],function(_0x31bc00){return{'model':db[_0x31bc00[_0xb81e('0x1e')]],'as':_0x31bc00['as'],'attributes':_0x31bc00['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f39aa){logger['info'](_0xb81e('0x1f'),_0xc4b11a);logger[_0xb81e('0x20')](_0xb81e('0x1f'),_0xc4b11a,JSON[_0xb81e('0x11')](_0x4f39aa));_0x16a594(_0x4f39aa);})[_0xb81e('0x16')](function(_0x1afbde){logger['error'](_0xb81e('0x1f'),_0x1afbde[_0xb81e('0x15')],_0xc4b11a);_0x46622c(_0x179607['error'](0x1f4,_0x1afbde[_0xb81e('0x15')]));});});}; \ No newline at end of file +var _0x37e7=['raw','where','limit','include','map','model','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','redis','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x1661d7,_0x1316fe){var _0x1cd427=function(_0xc4aed){while(--_0xc4aed){_0x1661d7['push'](_0x1661d7['shift']());}};_0x1cd427(++_0x1316fe);}(_0x37e7,0x73));var _0x737e=function(_0x425022,_0x428c9b){_0x425022=_0x425022-0x0;var _0x4bb839=_0x37e7[_0x425022];return _0x4bb839;};'use strict';var _=require('lodash');var util=require(_0x737e('0x0'));var moment=require(_0x737e('0x1'));var BPromise=require(_0x737e('0x2'));var rs=require(_0x737e('0x3'));var fs=require('fs');var Redis=require(_0x737e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x737e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x737e('0x6'));var jayson=require(_0x737e('0x7'));var client=jayson['client'][_0x737e('0x8')]({'port':0x232a});config['redis']=_[_0x737e('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x737e('0xa'))(new Redis(config[_0x737e('0xb')]));require(_0x737e('0xc'))['register'](socket);function respondWithRpcPromise(_0x41ae48,_0x351c87,_0x40e852){return new BPromise(function(_0x39323b,_0x190a56){return client['request'](_0x41ae48,_0x40e852)[_0x737e('0xd')](function(_0x36aea5){logger[_0x737e('0xe')](_0x737e('0xf'),_0x351c87,_0x737e('0x10'));logger[_0x737e('0x11')](_0x737e('0x12'),_0x351c87,'request\x20sent',JSON[_0x737e('0x13')](_0x36aea5));if(_0x36aea5[_0x737e('0x14')]){if(_0x36aea5[_0x737e('0x14')][_0x737e('0x15')]===0x1f4){logger[_0x737e('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x351c87,_0x36aea5['error']['message']);return _0x190a56(_0x36aea5[_0x737e('0x14')]['message']);}logger[_0x737e('0x14')](_0x737e('0xf'),_0x351c87,_0x36aea5['error'][_0x737e('0x16')]);return _0x39323b(_0x36aea5[_0x737e('0x14')][_0x737e('0x16')]);}else{logger[_0x737e('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x351c87,_0x737e('0x10'));_0x39323b(_0x36aea5[_0x737e('0x17')][_0x737e('0x16')]);}})[_0x737e('0x18')](function(_0x1f36bb){logger[_0x737e('0x14')](_0x737e('0xf'),_0x351c87,_0x1f36bb);_0x190a56(_0x1f36bb);});});}exports[_0x737e('0x19')]=function(_0x2f9283){var _0x79ec94=this;return new Promise(function(_0x41399f,_0xe90855){return db[_0x737e('0x1a')][_0x737e('0x1b')]({'raw':_0x2f9283['options']?_0x2f9283[_0x737e('0x1c')][_0x737e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2f9283[_0x737e('0x1c')]?_0x2f9283['options'][_0x737e('0x1e')]||null:null,'attributes':_0x2f9283['options']?_0x2f9283[_0x737e('0x1c')]['attributes']||null:null,'limit':_0x2f9283[_0x737e('0x1c')]?_0x2f9283[_0x737e('0x1c')][_0x737e('0x1f')]||null:null,'include':_0x2f9283[_0x737e('0x1c')]?_0x2f9283[_0x737e('0x1c')][_0x737e('0x20')]?_[_0x737e('0x21')](_0x2f9283[_0x737e('0x1c')][_0x737e('0x20')],function(_0x4d44e3){return{'model':db[_0x4d44e3[_0x737e('0x22')]],'as':_0x4d44e3['as'],'attributes':_0x4d44e3[_0x737e('0x23')],'include':_0x4d44e3[_0x737e('0x20')]?_['map'](_0x4d44e3['include'],function(_0x41ef9a){return{'model':db[_0x41ef9a[_0x737e('0x22')]],'as':_0x41ef9a['as'],'attributes':_0x41ef9a[_0x737e('0x23')],'include':_0x41ef9a[_0x737e('0x20')]?_[_0x737e('0x21')](_0x41ef9a[_0x737e('0x20')],function(_0x5889b6){return{'model':db[_0x5889b6[_0x737e('0x22')]],'as':_0x5889b6['as'],'attributes':_0x5889b6[_0x737e('0x23')]};}):[]};}):[]};}):[]:[]})[_0x737e('0xd')](function(_0x135c1c){logger[_0x737e('0xe')](_0x737e('0x19'),_0x2f9283);logger[_0x737e('0x11')](_0x737e('0x19'),_0x2f9283,JSON[_0x737e('0x13')](_0x135c1c));_0x41399f(_0x135c1c);})[_0x737e('0x18')](function(_0x16e9fc){logger[_0x737e('0x14')](_0x737e('0x19'),_0x16e9fc[_0x737e('0x16')],_0x2f9283);_0xe90855(_0x79ec94[_0x737e('0x14')](0x1f4,_0x16e9fc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c83f397..fdef4f0 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 _0x4ceb=['./voiceExtension.events','save','remove','emit','removeListener','register','length'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x4ceb,0x69));var _0xb4ce=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x4ceb[_0x31e29a];return _0x32d892;};'use strict';var VoiceExtensionEvents=require(_0xb4ce('0x0'));var events=[_0xb4ce('0x1'),_0xb4ce('0x2'),'update'];function createListener(_0x3cddc7,_0xc2e04b){return function(_0x52a718){_0xc2e04b[_0xb4ce('0x3')](_0x3cddc7,_0x52a718);};}function removeListener(_0x4c61dc,_0x558a3e){return function(){VoiceExtensionEvents[_0xb4ce('0x4')](_0x4c61dc,_0x558a3e);};}exports[_0xb4ce('0x5')]=function(_0x430b55){for(var _0x2694a0=0x0,_0x1641cb=events[_0xb4ce('0x6')];_0x2694a0<_0x1641cb;_0x2694a0++){var _0x118a43=events[_0x2694a0];var _0x4f51a6=createListener('voiceExtension:'+_0x118a43,_0x430b55);VoiceExtensionEvents['on'](_0x118a43,_0x4f51a6);}}; \ No newline at end of file +var _0x5a85=['voiceExtension:','./voiceExtension.events','save','remove','update','register','length'];(function(_0x4dd695,_0x3ef4c9){var _0x3ac72b=function(_0x48864b){while(--_0x48864b){_0x4dd695['push'](_0x4dd695['shift']());}};_0x3ac72b(++_0x3ef4c9);}(_0x5a85,0xbe));var _0x55a8=function(_0x24e447,_0x9b1441){_0x24e447=_0x24e447-0x0;var _0x46f26f=_0x5a85[_0x24e447];return _0x46f26f;};'use strict';var VoiceExtensionEvents=require(_0x55a8('0x0'));var events=[_0x55a8('0x1'),_0x55a8('0x2'),_0x55a8('0x3')];function createListener(_0xe4472f,_0x4743d4){return function(_0x6a5ae0){_0x4743d4['emit'](_0xe4472f,_0x6a5ae0);};}function removeListener(_0x31512a,_0x2d9512){return function(){VoiceExtensionEvents['removeListener'](_0x31512a,_0x2d9512);};}exports[_0x55a8('0x4')]=function(_0x2c0690){for(var _0x2584fb=0x0,_0x39fdc5=events[_0x55a8('0x5')];_0x2584fb<_0x39fdc5;_0x2584fb++){var _0xc944d=events[_0x2584fb];var _0xdfde1d=createListener(_0x55a8('0x6')+_0xc944d,_0x2c0690);VoiceExtensionEvents['on'](_0xc944d,_0xdfde1d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3c124f1..d729a59 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 _0xbab2=['post','put','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbab2,0x17f));var _0x2bab=function(_0x770f61,_0x56fa5c){_0x770f61=_0x770f61-0x0;var _0xe7fc09=_0xbab2[_0x770f61];return _0xe7fc09;};'use strict';var multer=require(_0x2bab('0x0'));var util=require(_0x2bab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2bab('0x2'));var interaction=require(_0x2bab('0x3'));var config=require(_0x2bab('0x4'));var controller=require(_0x2bab('0x5'));router['get']('/',auth[_0x2bab('0x6')](),controller[_0x2bab('0x7')]);router[_0x2bab('0x8')](_0x2bab('0x9'),auth[_0x2bab('0x6')](),controller[_0x2bab('0xa')]);router[_0x2bab('0x8')](_0x2bab('0xb'),auth['isAuthenticated'](),controller[_0x2bab('0xc')]);router[_0x2bab('0xd')]('/',auth[_0x2bab('0x6')](),controller['create']);router[_0x2bab('0xe')](_0x2bab('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x2bab('0xf')](_0x2bab('0x9'),auth['isAuthenticated'](),controller[_0x2bab('0x10')]);module[_0x2bab('0x11')]=router; \ No newline at end of file +var _0xab7d=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages','post','put','update','delete'];(function(_0x488cc5,_0x48b79a){var _0x3a0371=function(_0xe8b2d0){while(--_0xe8b2d0){_0x488cc5['push'](_0x488cc5['shift']());}};_0x3a0371(++_0x48b79a);}(_0xab7d,0xea));var _0xdab7=function(_0x5de75e,_0x150b5a){_0x5de75e=_0x5de75e-0x0;var _0x2448b5=_0xab7d[_0x5de75e];return _0x2448b5;};'use strict';var multer=require(_0xdab7('0x0'));var util=require(_0xdab7('0x1'));var path=require('path');var timeout=require(_0xdab7('0x2'));var express=require(_0xdab7('0x3'));var router=express[_0xdab7('0x4')]();var auth=require(_0xdab7('0x5'));var interaction=require(_0xdab7('0x6'));var config=require(_0xdab7('0x7'));var controller=require(_0xdab7('0x8'));router[_0xdab7('0x9')]('/',auth[_0xdab7('0xa')](),controller[_0xdab7('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdab7('0xc')]);router['get'](_0xdab7('0xd'),auth[_0xdab7('0xa')](),controller['getMessages']);router[_0xdab7('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdab7('0xf')]('/:id',auth[_0xdab7('0xa')](),controller[_0xdab7('0x10')]);router[_0xdab7('0x11')](_0xdab7('0x12'),auth[_0xdab7('0xa')](),controller[_0xdab7('0x13')]);module[_0xdab7('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ab86eaa..eba9d26 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 _0xda3f=['fullname','\x20-\x20','exports','STRING','setDataValue','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x264d72,_0x3e81b5){var _0x3cfabf=function(_0x423eb4){while(--_0x423eb4){_0x264d72['push'](_0x264d72['shift']());}};_0x3cfabf(++_0x3e81b5);}(_0xda3f,0xec));var _0xfda3=function(_0x32f1b9,_0x592306){_0x32f1b9=_0x32f1b9-0x0;var _0x3184f7=_0xda3f[_0x32f1b9];return _0x3184f7;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'customer_id':{'type':Sequelize[_0xfda3('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfda3('0x1')]},'fullname':{'type':Sequelize[_0xfda3('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x42bd74){this[_0xfda3('0x2')]('email',typeof _0x42bd74==='string'&&_0x42bd74[_0xfda3('0x3')]()?_0x42bd74[_0xfda3('0x3')]():null);}},'pager':{'type':Sequelize[_0xfda3('0x1')]},'tz':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':_0xfda3('0x4')},'attach':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfda3('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfda3('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'stamp':{'type':_0xfda3('0x8')},'emailsubject':{'type':Sequelize[_0xfda3('0x1')]},'emailbody':{'type':Sequelize[_0xfda3('0x1')]},'maxsecs':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfda3('0xa')](_0xfda3('0xb'))+_0xfda3('0xc')+this[_0xfda3('0xa')]('mailbox');}}}; \ No newline at end of file +var _0x6cb4=['fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0x198a68,_0x3cca6b){var _0x20278a=function(_0x2e91ec){while(--_0x2e91ec){_0x198a68['push'](_0x198a68['shift']());}};_0x20278a(++_0x3cca6b);}(_0x6cb4,0xff));var _0x46cb=function(_0x1dace3,_0xd80764){_0x1dace3=_0x1dace3-0x0;var _0x381c29=_0x6cb4[_0x1dace3];return _0x381c29;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'customer_id':{'type':Sequelize[_0x46cb('0x2')]},'context':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':_0x46cb('0x3'),'unique':_0x46cb('0x4')},'mailbox':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':'','allowNull':![],'unique':_0x46cb('0x4')},'password':{'type':Sequelize[_0x46cb('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x46cb('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5cb9a4){this[_0x46cb('0x5')]('email',typeof _0x5cb9a4===_0x46cb('0x6')&&_0x5cb9a4[_0x46cb('0x7')]()?_0x5cb9a4[_0x46cb('0x7')]():null);}},'pager':{'type':Sequelize[_0x46cb('0x2')]},'tz':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':_0x46cb('0x8')},'attach':{'type':Sequelize['ENUM'](_0x46cb('0x9'),'no'),'defaultValue':_0x46cb('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x46cb('0x9'),'no'),'defaultValue':_0x46cb('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x46cb('0x2')]},'review':{'type':Sequelize[_0x46cb('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':_0x46cb('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x46cb('0xa')](_0x46cb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x46cb('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x46cb('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x46cb('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x46cb('0xd')],'get':function(){return this[_0x46cb('0xe')](_0x46cb('0xf'))+_0x46cb('0x10')+this[_0x46cb('0xe')](_0x46cb('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 8587ed2..5c061fe 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 _0x6d94=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','userProfileId','autoAssociation','update','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x4ae3e4,_0x97d8e7){var _0x4b1571=function(_0x48786d){while(--_0x48786d){_0x4ae3e4['push'](_0x4ae3e4['shift']());}};_0x4b1571(++_0x97d8e7);}(_0x6d94,0xa0));var _0x46d9=function(_0x20e923,_0x2ef7b6){_0x20e923=_0x20e923-0x0;var _0x4edf3a=_0x6d94[_0x20e923];return _0x4edf3a;};'use strict';var pdf=require(_0x46d9('0x0'));var emlformat=require(_0x46d9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x46d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x46d9('0x3'));var moment=require(_0x46d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x46d9('0x5'));var util=require(_0x46d9('0x6'));var path=require(_0x46d9('0x7'));var sox=require(_0x46d9('0x8'));var csv=require(_0x46d9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x46d9('0xa'));var crypto=require(_0x46d9('0xb'));var jsforce=require(_0x46d9('0xc'));var deskjs=require(_0x46d9('0xd'));var toCsv=require(_0x46d9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46d9('0xe'));var authService=require(_0x46d9('0xf'));var qs=require(_0x46d9('0x10'));var as=require(_0x46d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46d9('0x12'))(_0x46d9('0x13'));var utils=require(_0x46d9('0x14'));var config=require(_0x46d9('0x15'));var db=require(_0x46d9('0x16'))['db'];function respondWithStatusCode(_0x2dfd1e,_0x4ef43f){_0x4ef43f=_0x4ef43f||0xcc;return function(_0x7bcf64){if(_0x7bcf64){return _0x2dfd1e[_0x46d9('0x17')](_0x4ef43f);}return _0x2dfd1e[_0x46d9('0x18')](_0x4ef43f)[_0x46d9('0x19')]();};}function respondWithResult(_0x28267d,_0x595c3e){_0x595c3e=_0x595c3e||0xc8;return function(_0x1217e1){if(_0x1217e1){return _0x28267d[_0x46d9('0x18')](_0x595c3e)[_0x46d9('0x1a')](_0x1217e1);}};}function respondWithFilteredResult(_0x518dc6,_0x32197b){return function(_0x4a47d9){if(_0x4a47d9){var _0x7005=_0x4a47d9[_0x46d9('0x1b')],_0x283c38=_0x32197b[_0x46d9('0x1c')],_0x52bf07=_0x32197b[_0x46d9('0x1c')]+_0x32197b[_0x46d9('0x1d')],_0x40b44b;if(_0x52bf07>=_0x7005){_0x52bf07=_0x7005;_0x40b44b=0xc8;}else{_0x40b44b=0xce;}_0x518dc6[_0x46d9('0x18')](_0x40b44b);return _0x518dc6['set'](_0x46d9('0x1e'),_0x283c38+'-'+_0x52bf07+'/'+_0x7005)[_0x46d9('0x1a')](_0x4a47d9);}return null;};}function patchUpdates(_0xa3d25d){return function(_0x5a3d9a){try{jsonpatch[_0x46d9('0x1f')](_0x5a3d9a,_0xa3d25d,!![]);}catch(_0x11f9a6){return BPromise[_0x46d9('0x20')](_0x11f9a6);}return _0x5a3d9a[_0x46d9('0x21')]();};}function saveUpdates(_0x2800bd,_0x4161b1){return function(_0x1c6207){if(_0x1c6207){return _0x1c6207['update'](_0x2800bd)[_0x46d9('0x22')](function(_0x4ae8cf){return _0x4ae8cf;});}return null;};}function removeEntity(_0x3dc9ba,_0x463e6e){return function(_0x853b7f){if(_0x853b7f){return _0x853b7f[_0x46d9('0x23')]()[_0x46d9('0x22')](function(){var _0x2b68dd=_0x853b7f[_0x46d9('0x24')]({'plain':!![]});var _0x4a8d83=_0x46d9('0x25');return db[_0x46d9('0x26')]['destroy']({'where':{'type':_0x4a8d83,'resourceId':_0x2b68dd['id']}})[_0x46d9('0x22')](function(){return _0x853b7f;});})[_0x46d9('0x22')](function(){_0x3dc9ba[_0x46d9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44863d,_0xc59d85){return function(_0x4aa1a3){if(!_0x4aa1a3){_0x44863d[_0x46d9('0x17')](0x194);}return _0x4aa1a3;};}function handleError(_0x16e334,_0x5500a8){_0x5500a8=_0x5500a8||0x1f4;return function(_0x3721f6){logger[_0x46d9('0x27')](_0x3721f6[_0x46d9('0x28')]);if(_0x3721f6[_0x46d9('0x29')]){delete _0x3721f6[_0x46d9('0x29')];}_0x16e334[_0x46d9('0x18')](_0x5500a8)[_0x46d9('0x2a')](_0x3721f6);};}exports[_0x46d9('0x2b')]=function(_0x12c3c5,_0x4d3b5f){var _0x6afc93={},_0x5e3a64={},_0x1bc797={'count':0x0,'rows':[]};var _0x1503ba=_[_0x46d9('0x2c')](db['VoiceMail'][_0x46d9('0x2d')],function(_0x16c33a){return{'name':_0x16c33a[_0x46d9('0x2e')],'type':_0x16c33a[_0x46d9('0x2f')][_0x46d9('0x30')]};});_0x5e3a64[_0x46d9('0x31')]=_[_0x46d9('0x2c')](_0x1503ba,_0x46d9('0x29'));_0x5e3a64['query']=_[_0x46d9('0x32')](_0x12c3c5[_0x46d9('0x33')]);_0x5e3a64[_0x46d9('0x34')]=_[_0x46d9('0x35')](_0x5e3a64[_0x46d9('0x31')],_0x5e3a64[_0x46d9('0x33')]);_0x6afc93[_0x46d9('0x36')]=_[_0x46d9('0x35')](_0x5e3a64[_0x46d9('0x31')],qs[_0x46d9('0x37')](_0x12c3c5['query'][_0x46d9('0x37')]));_0x6afc93['attributes']=_0x6afc93['attributes'][_0x46d9('0x38')]?_0x6afc93[_0x46d9('0x36')]:_0x5e3a64[_0x46d9('0x31')];if(!_0x12c3c5['query'][_0x46d9('0x39')](_0x46d9('0x3a'))){_0x6afc93[_0x46d9('0x1d')]=qs[_0x46d9('0x1d')](_0x12c3c5[_0x46d9('0x33')][_0x46d9('0x1d')]);_0x6afc93[_0x46d9('0x1c')]=qs[_0x46d9('0x1c')](_0x12c3c5[_0x46d9('0x33')][_0x46d9('0x1c')]);}_0x6afc93['order']=qs[_0x46d9('0x3b')](_0x12c3c5[_0x46d9('0x33')][_0x46d9('0x3b')]);_0x6afc93[_0x46d9('0x3c')]=qs[_0x46d9('0x34')](_[_0x46d9('0x3d')](_0x12c3c5[_0x46d9('0x33')],_0x5e3a64[_0x46d9('0x34')]),_0x1503ba);if(_0x12c3c5['query'][_0x46d9('0x3e')]){_0x6afc93['where']=_['merge'](_0x6afc93[_0x46d9('0x3c')],{'$or':_['map'](_0x1503ba,function(_0x341c91){if(_0x341c91[_0x46d9('0x2f')]!=='VIRTUAL'){var _0x53eb45={};_0x53eb45[_0x341c91['name']]={'$like':'%'+_0x12c3c5[_0x46d9('0x33')][_0x46d9('0x3e')]+'%'};return _0x53eb45;}})});}_0x6afc93=_[_0x46d9('0x3f')]({},_0x6afc93,_0x12c3c5[_0x46d9('0x40')]);var _0x967b8={'where':_0x6afc93[_0x46d9('0x3c')]};return db[_0x46d9('0x41')]['count'](_0x967b8)[_0x46d9('0x22')](function(_0x1288c3){_0x1bc797[_0x46d9('0x1b')]=_0x1288c3;if(_0x12c3c5['query'][_0x46d9('0x42')]){_0x6afc93[_0x46d9('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x46d9('0x44')](_0x6afc93);})['then'](function(_0x5e50e7){_0x1bc797[_0x46d9('0x45')]=_0x5e50e7;return _0x1bc797;})[_0x46d9('0x22')](respondWithFilteredResult(_0x4d3b5f,_0x6afc93))[_0x46d9('0x46')](handleError(_0x4d3b5f,null));};exports[_0x46d9('0x47')]=function(_0x3d8dcc,_0x43e838){var _0x5a6a2d={'raw':!![],'where':{'id':_0x3d8dcc[_0x46d9('0x48')]['id']}},_0x3af4c0={};_0x3af4c0[_0x46d9('0x31')]=_[_0x46d9('0x32')](db[_0x46d9('0x41')][_0x46d9('0x2d')]);_0x3af4c0[_0x46d9('0x33')]=_[_0x46d9('0x32')](_0x3d8dcc['query']);_0x3af4c0[_0x46d9('0x34')]=_[_0x46d9('0x35')](_0x3af4c0[_0x46d9('0x31')],_0x3af4c0[_0x46d9('0x33')]);_0x5a6a2d['attributes']=_[_0x46d9('0x35')](_0x3af4c0[_0x46d9('0x31')],qs[_0x46d9('0x37')](_0x3d8dcc[_0x46d9('0x33')]['fields']));_0x5a6a2d[_0x46d9('0x36')]=_0x5a6a2d[_0x46d9('0x36')][_0x46d9('0x38')]?_0x5a6a2d[_0x46d9('0x36')]:_0x3af4c0[_0x46d9('0x31')];if(_0x3d8dcc[_0x46d9('0x33')]['includeAll']){_0x5a6a2d[_0x46d9('0x43')]=[{'all':!![]}];}_0x5a6a2d=_[_0x46d9('0x3f')]({},_0x5a6a2d,_0x3d8dcc[_0x46d9('0x40')]);return db[_0x46d9('0x41')][_0x46d9('0x49')](_0x5a6a2d)[_0x46d9('0x22')](handleEntityNotFound(_0x43e838,null))[_0x46d9('0x22')](respondWithResult(_0x43e838,null))[_0x46d9('0x46')](handleError(_0x43e838,null));};exports[_0x46d9('0x4a')]=function(_0x552454,_0x3e1be6){return db[_0x46d9('0x41')][_0x46d9('0x4a')](_0x552454[_0x46d9('0x4b')],{})[_0x46d9('0x22')](function(_0x5acd30){var _0xf5711a=_0x552454[_0x46d9('0x4c')][_0x46d9('0x24')]({'plain':!![]});if(!_0xf5711a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf5711a['role']===_0x46d9('0x4c')){var _0x1c60f2=_0x5acd30[_0x46d9('0x24')]({'plain':!![]});var _0x5b7215=_0x46d9('0x25');return db['UserProfileSection'][_0x46d9('0x49')]({'where':{'name':_0x5b7215,'userProfileId':_0xf5711a[_0x46d9('0x4d')]},'raw':!![]})[_0x46d9('0x22')](function(_0x34b3b7){if(_0x34b3b7&&_0x34b3b7[_0x46d9('0x4e')]===0x0){return db[_0x46d9('0x26')]['create']({'name':_0x1c60f2[_0x46d9('0x29')],'resourceId':_0x1c60f2['id'],'type':_0x34b3b7[_0x46d9('0x29')],'sectionId':_0x34b3b7['id']},{})[_0x46d9('0x22')](function(){return _0x5acd30;});}else{return _0x5acd30;}})[_0x46d9('0x46')](function(_0x1a5f0c){logger[_0x46d9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a5f0c);throw _0x1a5f0c;});}return _0x5acd30;})[_0x46d9('0x22')](respondWithResult(_0x3e1be6,0xc9))[_0x46d9('0x46')](handleError(_0x3e1be6,null));};exports[_0x46d9('0x4f')]=function(_0x202994,_0x3a980a){if(_0x202994['body']['id']){delete _0x202994['body']['id'];}return db[_0x46d9('0x41')][_0x46d9('0x49')]({'where':{'id':_0x202994['params']['id']}})['then'](handleEntityNotFound(_0x3a980a,null))[_0x46d9('0x22')](saveUpdates(_0x202994['body'],null))[_0x46d9('0x22')](respondWithResult(_0x3a980a,null))[_0x46d9('0x46')](handleError(_0x3a980a,null));};exports[_0x46d9('0x23')]=function(_0x33c9aa,_0x275408){return db[_0x46d9('0x41')]['find']({'where':{'id':_0x33c9aa[_0x46d9('0x48')]['id']}})[_0x46d9('0x22')](handleEntityNotFound(_0x275408,null))[_0x46d9('0x22')](removeEntity(_0x275408,null))['catch'](handleError(_0x275408,null));};exports['getMessages']=function(_0x76b7be,_0x451beb,_0x396669){return db[_0x46d9('0x41')][_0x46d9('0x50')]({'where':{'id':_0x76b7be[_0x46d9('0x48')]['id']}})[_0x46d9('0x22')](handleEntityNotFound(_0x451beb,null))[_0x46d9('0x22')](function(_0x287e37){var _0x9bd947;var _0x3548ca={},_0x259d87={};_0x259d87[_0x46d9('0x31')]=_[_0x46d9('0x32')](db[_0x46d9('0x51')]['rawAttributes']);_0x259d87[_0x46d9('0x33')]=_[_0x46d9('0x32')](_0x76b7be[_0x46d9('0x33')]);_0x259d87[_0x46d9('0x34')]=_[_0x46d9('0x35')](_0x259d87['model'],_0x259d87[_0x46d9('0x33')]);_0x3548ca[_0x46d9('0x36')]=_[_0x46d9('0x35')](_0x259d87[_0x46d9('0x31')],qs[_0x46d9('0x37')](_0x76b7be[_0x46d9('0x33')][_0x46d9('0x37')]));_0x3548ca[_0x46d9('0x36')]=_0x3548ca[_0x46d9('0x36')][_0x46d9('0x38')]?_0x3548ca[_0x46d9('0x36')]:_0x259d87['model'];if(!_0x76b7be['query']['hasOwnProperty'](_0x46d9('0x3a'))){_0x3548ca[_0x46d9('0x1d')]=qs['limit'](_0x76b7be[_0x46d9('0x33')][_0x46d9('0x1d')]);_0x3548ca[_0x46d9('0x1c')]=qs['offset'](_0x76b7be[_0x46d9('0x33')][_0x46d9('0x1c')]);}_0x3548ca[_0x46d9('0x52')]=qs[_0x46d9('0x3b')](_0x76b7be[_0x46d9('0x33')][_0x46d9('0x3b')]);_0x3548ca['where']=qs[_0x46d9('0x34')](_[_0x46d9('0x3d')](_0x76b7be['query'],_0x259d87[_0x46d9('0x34')]));if(_0x76b7be['query'][_0x46d9('0x3e')]){_0x3548ca[_0x46d9('0x3c')]=_[_0x46d9('0x3f')](_0x3548ca[_0x46d9('0x3c')],{'$or':_[_0x46d9('0x2c')](_0x3548ca[_0x46d9('0x36')],function(_0x521039){var _0x1ac96f={};_0x1ac96f[_0x521039]={'$like':'%'+_0x76b7be[_0x46d9('0x33')][_0x46d9('0x3e')]+'%'};return _0x1ac96f;})});}_0x3548ca[_0x46d9('0x3c')]=_[_0x46d9('0x3f')](_0x3548ca[_0x46d9('0x3c')],{'mailboxuser':_0x287e37[_0x46d9('0x53')]});_0x3548ca=_[_0x46d9('0x3f')]({},_0x3548ca,_0x76b7be[_0x46d9('0x40')]);return db[_0x46d9('0x51')][_0x46d9('0x54')](_0x3548ca)['then'](respondWithFilteredResult(_0x451beb,_0x3548ca));})['catch'](handleError(_0x451beb,null));}; \ No newline at end of file +var _0x42af=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','name','options','count','includeAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','order','mailbox','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x58273d,_0x2fefaf){var _0x8708b=function(_0x44088e){while(--_0x44088e){_0x58273d['push'](_0x58273d['shift']());}};_0x8708b(++_0x2fefaf);}(_0x42af,0x103));var _0xf42a=function(_0x21b367,_0x4b3024){_0x21b367=_0x21b367-0x0;var _0x45f247=_0x42af[_0x21b367];return _0x45f247;};'use strict';var pdf=require(_0xf42a('0x0'));var emlformat=require(_0xf42a('0x1'));var rimraf=require(_0xf42a('0x2'));var zipdir=require(_0xf42a('0x3'));var jsonpatch=require(_0xf42a('0x4'));var rp=require(_0xf42a('0x5'));var moment=require('moment');var BPromise=require(_0xf42a('0x6'));var Mustache=require(_0xf42a('0x7'));var util=require(_0xf42a('0x8'));var path=require(_0xf42a('0x9'));var sox=require(_0xf42a('0xa'));var csv=require(_0xf42a('0xb'));var ejs=require(_0xf42a('0xc'));var fs=require('fs');var _=require(_0xf42a('0xd'));var squel=require(_0xf42a('0xe'));var crypto=require(_0xf42a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf42a('0x10'));var toCsv=require(_0xf42a('0xb'));var querystring=require(_0xf42a('0x11'));var Papa=require('papaparse');var Redis=require(_0xf42a('0x12'));var authService=require(_0xf42a('0x13'));var qs=require(_0xf42a('0x14'));var as=require(_0xf42a('0x15'));var hardwareService=require(_0xf42a('0x16'));var logger=require(_0xf42a('0x17'))(_0xf42a('0x18'));var utils=require(_0xf42a('0x19'));var config=require(_0xf42a('0x1a'));var db=require(_0xf42a('0x1b'))['db'];function respondWithStatusCode(_0x653903,_0x130d44){_0x130d44=_0x130d44||0xcc;return function(_0x603c14){if(_0x603c14){return _0x653903[_0xf42a('0x1c')](_0x130d44);}return _0x653903[_0xf42a('0x1d')](_0x130d44)[_0xf42a('0x1e')]();};}function respondWithResult(_0x221ad2,_0x10a305){_0x10a305=_0x10a305||0xc8;return function(_0x55ec8d){if(_0x55ec8d){return _0x221ad2[_0xf42a('0x1d')](_0x10a305)[_0xf42a('0x1f')](_0x55ec8d);}};}function respondWithFilteredResult(_0xd0df5c,_0x22501f){return function(_0x44c750){if(_0x44c750){var _0x52f2d1=_0x44c750['count'],_0x67bb20=_0x22501f[_0xf42a('0x20')],_0x2a4aa9=_0x22501f[_0xf42a('0x20')]+_0x22501f[_0xf42a('0x21')],_0x19011f;if(_0x2a4aa9>=_0x52f2d1){_0x2a4aa9=_0x52f2d1;_0x19011f=0xc8;}else{_0x19011f=0xce;}_0xd0df5c[_0xf42a('0x1d')](_0x19011f);return _0xd0df5c['set']('Content-Range',_0x67bb20+'-'+_0x2a4aa9+'/'+_0x52f2d1)[_0xf42a('0x1f')](_0x44c750);}return null;};}function patchUpdates(_0x2f5c94){return function(_0x24a072){try{jsonpatch[_0xf42a('0x22')](_0x24a072,_0x2f5c94,!![]);}catch(_0x43a56f){return BPromise[_0xf42a('0x23')](_0x43a56f);}return _0x24a072[_0xf42a('0x24')]();};}function saveUpdates(_0x580f2e,_0x33dccd){return function(_0xccb521){if(_0xccb521){return _0xccb521[_0xf42a('0x25')](_0x580f2e)['then'](function(_0x446d17){return _0x446d17;});}return null;};}function removeEntity(_0x5878aa,_0x27d045){return function(_0x24d560){if(_0x24d560){return _0x24d560['destroy']()[_0xf42a('0x26')](function(){var _0x1b2c96=_0x24d560[_0xf42a('0x27')]({'plain':!![]});var _0x7d249e=_0xf42a('0x28');return db[_0xf42a('0x29')][_0xf42a('0x2a')]({'where':{'type':_0x7d249e,'resourceId':_0x1b2c96['id']}})[_0xf42a('0x26')](function(){return _0x24d560;});})[_0xf42a('0x26')](function(){_0x5878aa[_0xf42a('0x1d')](0xcc)[_0xf42a('0x1e')]();});}};}function handleEntityNotFound(_0x550d42,_0x5633be){return function(_0x1d8206){if(!_0x1d8206){_0x550d42[_0xf42a('0x1c')](0x194);}return _0x1d8206;};}function handleError(_0x21cb80,_0x5acb7f){_0x5acb7f=_0x5acb7f||0x1f4;return function(_0x16debf){logger[_0xf42a('0x2b')](_0x16debf[_0xf42a('0x2c')]);if(_0x16debf['name']){delete _0x16debf['name'];}_0x21cb80[_0xf42a('0x1d')](_0x5acb7f)[_0xf42a('0x2d')](_0x16debf);};}exports[_0xf42a('0x2e')]=function(_0x593e34,_0x53593c){var _0x566560={},_0x2567f={},_0x4f1a44={'count':0x0,'rows':[]};var _0x5cef7b=_[_0xf42a('0x2f')](db[_0xf42a('0x30')][_0xf42a('0x31')],function(_0x20b526){return{'name':_0x20b526[_0xf42a('0x32')],'type':_0x20b526[_0xf42a('0x33')][_0xf42a('0x34')]};});_0x2567f[_0xf42a('0x35')]=_[_0xf42a('0x2f')](_0x5cef7b,'name');_0x2567f[_0xf42a('0x36')]=_[_0xf42a('0x37')](_0x593e34[_0xf42a('0x36')]);_0x2567f[_0xf42a('0x38')]=_[_0xf42a('0x39')](_0x2567f[_0xf42a('0x35')],_0x2567f['query']);_0x566560[_0xf42a('0x3a')]=_['intersection'](_0x2567f[_0xf42a('0x35')],qs[_0xf42a('0x3b')](_0x593e34[_0xf42a('0x36')]['fields']));_0x566560['attributes']=_0x566560[_0xf42a('0x3a')][_0xf42a('0x3c')]?_0x566560['attributes']:_0x2567f[_0xf42a('0x35')];if(!_0x593e34['query'][_0xf42a('0x3d')](_0xf42a('0x3e'))){_0x566560[_0xf42a('0x21')]=qs[_0xf42a('0x21')](_0x593e34[_0xf42a('0x36')][_0xf42a('0x21')]);_0x566560[_0xf42a('0x20')]=qs[_0xf42a('0x20')](_0x593e34[_0xf42a('0x36')][_0xf42a('0x20')]);}_0x566560['order']=qs['sort'](_0x593e34[_0xf42a('0x36')][_0xf42a('0x3f')]);_0x566560['where']=qs[_0xf42a('0x38')](_[_0xf42a('0x40')](_0x593e34['query'],_0x2567f[_0xf42a('0x38')]),_0x5cef7b);if(_0x593e34[_0xf42a('0x36')][_0xf42a('0x41')]){_0x566560[_0xf42a('0x42')]=_[_0xf42a('0x43')](_0x566560['where'],{'$or':_[_0xf42a('0x2f')](_0x5cef7b,function(_0x8693be){if(_0x8693be[_0xf42a('0x33')]!=='VIRTUAL'){var _0x6a9171={};_0x6a9171[_0x8693be[_0xf42a('0x44')]]={'$like':'%'+_0x593e34[_0xf42a('0x36')][_0xf42a('0x41')]+'%'};return _0x6a9171;}})});}_0x566560=_[_0xf42a('0x43')]({},_0x566560,_0x593e34[_0xf42a('0x45')]);var _0x98c8e8={'where':_0x566560[_0xf42a('0x42')]};return db['VoiceMail'][_0xf42a('0x46')](_0x98c8e8)[_0xf42a('0x26')](function(_0x12c687){_0x4f1a44[_0xf42a('0x46')]=_0x12c687;if(_0x593e34['query'][_0xf42a('0x47')]){_0x566560['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x566560);})[_0xf42a('0x26')](function(_0x4331ea){_0x4f1a44['rows']=_0x4331ea;return _0x4f1a44;})[_0xf42a('0x26')](respondWithFilteredResult(_0x53593c,_0x566560))[_0xf42a('0x48')](handleError(_0x53593c,null));};exports[_0xf42a('0x49')]=function(_0x2b5343,_0x33a8ef){var _0x36a78d={'raw':!![],'where':{'id':_0x2b5343[_0xf42a('0x4a')]['id']}},_0x2bd8b9={};_0x2bd8b9[_0xf42a('0x35')]=_[_0xf42a('0x37')](db[_0xf42a('0x30')][_0xf42a('0x31')]);_0x2bd8b9['query']=_[_0xf42a('0x37')](_0x2b5343['query']);_0x2bd8b9[_0xf42a('0x38')]=_['intersection'](_0x2bd8b9[_0xf42a('0x35')],_0x2bd8b9[_0xf42a('0x36')]);_0x36a78d[_0xf42a('0x3a')]=_[_0xf42a('0x39')](_0x2bd8b9[_0xf42a('0x35')],qs[_0xf42a('0x3b')](_0x2b5343[_0xf42a('0x36')][_0xf42a('0x3b')]));_0x36a78d[_0xf42a('0x3a')]=_0x36a78d['attributes'][_0xf42a('0x3c')]?_0x36a78d[_0xf42a('0x3a')]:_0x2bd8b9[_0xf42a('0x35')];if(_0x2b5343[_0xf42a('0x36')]['includeAll']){_0x36a78d[_0xf42a('0x4b')]=[{'all':!![]}];}_0x36a78d=_[_0xf42a('0x43')]({},_0x36a78d,_0x2b5343[_0xf42a('0x45')]);return db[_0xf42a('0x30')][_0xf42a('0x4c')](_0x36a78d)[_0xf42a('0x26')](handleEntityNotFound(_0x33a8ef,null))['then'](respondWithResult(_0x33a8ef,null))[_0xf42a('0x48')](handleError(_0x33a8ef,null));};exports[_0xf42a('0x4d')]=function(_0x98dd8f,_0x5ccbb0){return db[_0xf42a('0x30')][_0xf42a('0x4d')](_0x98dd8f[_0xf42a('0x4e')],{})['then'](function(_0x3aef08){var _0x577f67=_0x98dd8f[_0xf42a('0x4f')][_0xf42a('0x27')]({'plain':!![]});if(!_0x577f67)throw new Error(_0xf42a('0x50'));if(_0x577f67[_0xf42a('0x51')]==='user'){var _0x4d0bbe=_0x3aef08[_0xf42a('0x27')]({'plain':!![]});var _0x51e2e2=_0xf42a('0x28');return db[_0xf42a('0x52')][_0xf42a('0x4c')]({'where':{'name':_0x51e2e2,'userProfileId':_0x577f67['userProfileId']},'raw':!![]})['then'](function(_0x20d02f){if(_0x20d02f&&_0x20d02f['autoAssociation']===0x0){return db[_0xf42a('0x29')][_0xf42a('0x4d')]({'name':_0x4d0bbe[_0xf42a('0x44')],'resourceId':_0x4d0bbe['id'],'type':_0x20d02f[_0xf42a('0x44')],'sectionId':_0x20d02f['id']},{})[_0xf42a('0x26')](function(){return _0x3aef08;});}else{return _0x3aef08;}})[_0xf42a('0x48')](function(_0x547aed){logger[_0xf42a('0x2b')](_0xf42a('0x53'),_0x547aed);throw _0x547aed;});}return _0x3aef08;})[_0xf42a('0x26')](respondWithResult(_0x5ccbb0,0xc9))['catch'](handleError(_0x5ccbb0,null));};exports[_0xf42a('0x25')]=function(_0x53eae0,_0x450822){if(_0x53eae0[_0xf42a('0x4e')]['id']){delete _0x53eae0[_0xf42a('0x4e')]['id'];}return db[_0xf42a('0x30')][_0xf42a('0x4c')]({'where':{'id':_0x53eae0['params']['id']}})['then'](handleEntityNotFound(_0x450822,null))['then'](saveUpdates(_0x53eae0[_0xf42a('0x4e')],null))[_0xf42a('0x26')](respondWithResult(_0x450822,null))[_0xf42a('0x48')](handleError(_0x450822,null));};exports[_0xf42a('0x2a')]=function(_0xdf6be0,_0x133cd8){return db['VoiceMail'][_0xf42a('0x4c')]({'where':{'id':_0xdf6be0[_0xf42a('0x4a')]['id']}})[_0xf42a('0x26')](handleEntityNotFound(_0x133cd8,null))[_0xf42a('0x26')](removeEntity(_0x133cd8,null))[_0xf42a('0x48')](handleError(_0x133cd8,null));};exports[_0xf42a('0x54')]=function(_0x2dbc10,_0x2991a3,_0x4d8f81){return db[_0xf42a('0x30')][_0xf42a('0x55')]({'where':{'id':_0x2dbc10[_0xf42a('0x4a')]['id']}})[_0xf42a('0x26')](handleEntityNotFound(_0x2991a3,null))[_0xf42a('0x26')](function(_0x27aa00){var _0x334371;var _0x277cca={},_0x5144b7={};_0x5144b7[_0xf42a('0x35')]=_['keys'](db['VoiceMailMessage'][_0xf42a('0x31')]);_0x5144b7[_0xf42a('0x36')]=_[_0xf42a('0x37')](_0x2dbc10['query']);_0x5144b7[_0xf42a('0x38')]=_['intersection'](_0x5144b7[_0xf42a('0x35')],_0x5144b7['query']);_0x277cca[_0xf42a('0x3a')]=_[_0xf42a('0x39')](_0x5144b7[_0xf42a('0x35')],qs[_0xf42a('0x3b')](_0x2dbc10[_0xf42a('0x36')][_0xf42a('0x3b')]));_0x277cca[_0xf42a('0x3a')]=_0x277cca['attributes'][_0xf42a('0x3c')]?_0x277cca[_0xf42a('0x3a')]:_0x5144b7[_0xf42a('0x35')];if(!_0x2dbc10[_0xf42a('0x36')][_0xf42a('0x3d')](_0xf42a('0x3e'))){_0x277cca[_0xf42a('0x21')]=qs[_0xf42a('0x21')](_0x2dbc10[_0xf42a('0x36')][_0xf42a('0x21')]);_0x277cca[_0xf42a('0x20')]=qs[_0xf42a('0x20')](_0x2dbc10[_0xf42a('0x36')][_0xf42a('0x20')]);}_0x277cca[_0xf42a('0x56')]=qs['sort'](_0x2dbc10[_0xf42a('0x36')]['sort']);_0x277cca[_0xf42a('0x42')]=qs[_0xf42a('0x38')](_[_0xf42a('0x40')](_0x2dbc10['query'],_0x5144b7['filters']));if(_0x2dbc10[_0xf42a('0x36')][_0xf42a('0x41')]){_0x277cca[_0xf42a('0x42')]=_[_0xf42a('0x43')](_0x277cca[_0xf42a('0x42')],{'$or':_[_0xf42a('0x2f')](_0x277cca['attributes'],function(_0x1092e2){var _0x34e5dc={};_0x34e5dc[_0x1092e2]={'$like':'%'+_0x2dbc10[_0xf42a('0x36')][_0xf42a('0x41')]+'%'};return _0x34e5dc;})});}_0x277cca[_0xf42a('0x42')]=_[_0xf42a('0x43')](_0x277cca['where'],{'mailboxuser':_0x27aa00[_0xf42a('0x57')]});_0x277cca=_['merge']({},_0x277cca,_0x2dbc10[_0xf42a('0x45')]);return db[_0xf42a('0x58')][_0xf42a('0x59')](_0x277cca)['then'](respondWithFilteredResult(_0x2991a3,_0x277cca));})[_0xf42a('0x48')](handleError(_0x2991a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 569cf57..79f135b 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 _0xf06b=['context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x350281,_0x6e5133){var _0x1eb3e6=function(_0x573d61){while(--_0x573d61){_0x350281['push'](_0x350281['shift']());}};_0x1eb3e6(++_0x6e5133);}(_0xf06b,0x166));var _0xbf06=function(_0x2d13f0,_0x1385d4){_0x2d13f0=_0x2d13f0-0x0;var _0x1e9c78=_0xf06b[_0x2d13f0];return _0x1e9c78;};'use strict';var _=require(_0xbf06('0x0'));var util=require(_0xbf06('0x1'));var logger=require(_0xbf06('0x2'))(_0xbf06('0x3'));var moment=require(_0xbf06('0x4'));var BPromise=require(_0xbf06('0x5'));var rp=require(_0xbf06('0x6'));var fs=require('fs');var path=require(_0xbf06('0x7'));var rimraf=require(_0xbf06('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf06('0x9'));module[_0xbf06('0xa')]=function(_0x286a8c,_0xc028f2){return _0x286a8c[_0xbf06('0xb')](_0xbf06('0xc'),attributes,{'tableName':_0xbf06('0xd'),'paranoid':![],'indexes':[{'name':_0xbf06('0xe'),'fields':[_0xbf06('0xf'),_0xbf06('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4254=['../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4254,0x13c));var _0x4425=function(_0x130c7b,_0x4a29cb){_0x130c7b=_0x130c7b-0x0;var _0x735554=_0x4254[_0x130c7b];return _0x735554;};'use strict';var _=require(_0x4425('0x0'));var util=require(_0x4425('0x1'));var logger=require(_0x4425('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4425('0x3'));var rp=require(_0x4425('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4425('0x5'));var config=require(_0x4425('0x6'));var attributes=require(_0x4425('0x7'));module[_0x4425('0x8')]=function(_0x113f98,_0x4c5b86){return _0x113f98[_0x4425('0x9')]('VoiceMail',attributes,{'tableName':_0x4425('0xa'),'paranoid':![],'indexes':[{'name':_0x4425('0xb'),'fields':[_0x4425('0xc'),_0x4425('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a1bae56..3588b73 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 _0xc541=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment'];(function(_0x5067c6,_0x3f1e9e){var _0xb5daa3=function(_0x45337e){while(--_0x45337e){_0x5067c6['push'](_0x5067c6['shift']());}};_0xb5daa3(++_0x3f1e9e);}(_0xc541,0x166));var _0x1c54=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0xc541[_0x1d930e];return _0x5bbd66;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var moment=require(_0x1c54('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c54('0x2'));var fs=require('fs');var Redis=require(_0x1c54('0x3'));var db=require(_0x1c54('0x4'))['db'];var utils=require(_0x1c54('0x5'));var logger=require('../../config/logger')(_0x1c54('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c54('0x7'));var client=jayson[_0x1c54('0x8')][_0x1c54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e676e,_0x4da624,_0x2d04a2){return new BPromise(function(_0x1ddfa3,_0x231813){return client['request'](_0x2e676e,_0x2d04a2)[_0x1c54('0xa')](function(_0x23dadc){logger['info'](_0x1c54('0xb'),_0x4da624,_0x1c54('0xc'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4da624,_0x1c54('0xc'),JSON[_0x1c54('0xd')](_0x23dadc));if(_0x23dadc[_0x1c54('0xe')]){if(_0x23dadc[_0x1c54('0xe')][_0x1c54('0xf')]===0x1f4){logger['error'](_0x1c54('0xb'),_0x4da624,_0x23dadc['error'][_0x1c54('0x10')]);return _0x231813(_0x23dadc['error'][_0x1c54('0x10')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x4da624,_0x23dadc[_0x1c54('0xe')][_0x1c54('0x10')]);return _0x1ddfa3(_0x23dadc[_0x1c54('0xe')]['message']);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x4da624,_0x1c54('0xc'));_0x1ddfa3(_0x23dadc['result']['message']);}})[_0x1c54('0x11')](function(_0x706025){logger[_0x1c54('0xe')](_0x1c54('0xb'),_0x4da624,_0x706025);_0x231813(_0x706025);});});} \ No newline at end of file +var _0xc931=['info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceMail,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x56805a,_0xa665c8){var _0x5d6a4e=function(_0x56ac92){while(--_0x56ac92){_0x56805a['push'](_0x56805a['shift']());}};_0x5d6a4e(++_0xa665c8);}(_0xc931,0x80));var _0x1c93=function(_0x163776,_0x336cf7){_0x163776=_0x163776-0x0;var _0x240470=_0xc931[_0x163776];return _0x240470;};'use strict';var _=require(_0x1c93('0x0'));var util=require(_0x1c93('0x1'));var moment=require(_0x1c93('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c93('0x3'));var fs=require('fs');var Redis=require(_0x1c93('0x4'));var db=require(_0x1c93('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c93('0x6'))(_0x1c93('0x7'));var config=require(_0x1c93('0x8'));var jayson=require(_0x1c93('0x9'));var client=jayson['client'][_0x1c93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ceff3,_0x5b08c9,_0x4dd859){return new BPromise(function(_0x532fc4,_0x573df0){return client[_0x1c93('0xb')](_0x3ceff3,_0x4dd859)['then'](function(_0x57e960){logger[_0x1c93('0xc')]('VoiceMail,\x20%s,\x20%s',_0x5b08c9,_0x1c93('0xd'));logger[_0x1c93('0xe')](_0x1c93('0xf'),_0x5b08c9,'request\x20sent',JSON[_0x1c93('0x10')](_0x57e960));if(_0x57e960[_0x1c93('0x11')]){if(_0x57e960[_0x1c93('0x11')]['code']===0x1f4){logger[_0x1c93('0x11')]('VoiceMail,\x20%s,\x20%s',_0x5b08c9,_0x57e960[_0x1c93('0x11')][_0x1c93('0x12')]);return _0x573df0(_0x57e960[_0x1c93('0x11')]['message']);}logger[_0x1c93('0x11')]('VoiceMail,\x20%s,\x20%s',_0x5b08c9,_0x57e960[_0x1c93('0x11')][_0x1c93('0x12')]);return _0x532fc4(_0x57e960[_0x1c93('0x11')][_0x1c93('0x12')]);}else{logger['info'](_0x1c93('0x13'),_0x5b08c9,_0x1c93('0xd'));_0x532fc4(_0x57e960['result'][_0x1c93('0x12')]);}})['catch'](function(_0x292828){logger[_0x1c93('0x11')]('VoiceMail,\x20%s,\x20%s',_0x5b08c9,_0x292828);_0x573df0(_0x292828);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 17c8fb2..b0b87dc 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 _0xe2fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','get','download','create','delete','exports','multer'];(function(_0x2511c6,_0x5859ca){var _0x10a803=function(_0x3fb3a2){while(--_0x3fb3a2){_0x2511c6['push'](_0x2511c6['shift']());}};_0x10a803(++_0x5859ca);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0x8')]);router['get'](_0xee2f('0x9'),auth[_0xee2f('0x7')](),controller['show']);router[_0xee2f('0xa')]('/:id/download',auth[_0xee2f('0x7')](),controller[_0xee2f('0xb')]);router['post']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xee2f('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xee2f('0xe')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/:id/download',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/',auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router['delete'](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d5d9ae7..79180a1 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 _0xa0d5=['STRING','BLOB','TIMESTAMP','exports','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0d5,0x1a2));var _0x5a0d=function(_0x3ba335,_0x33b0fb){_0x3ba335=_0x3ba335-0x0;var _0x5dd44a=_0xa0d5[_0x3ba335];return _0x5dd44a;};'use strict';var Sequelize=require('sequelize');module[_0x5a0d('0x0')]={'name':{'type':Sequelize[_0x5a0d('0x1')],'get':function(_0x3485ca){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x5a0d('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5a0d('0x2')],'defaultValue':''},'stamp':{'type':_0x5a0d('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0x88af=['INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x1fa287,_0xb138f3){var _0x39c533=function(_0x436c8d){while(--_0x436c8d){_0x1fa287['push'](_0x1fa287['shift']());}};_0x39c533(++_0xb138f3);}(_0x88af,0x125));var _0xf88a=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0x88af[_0x541a67];return _0x45da2a;};'use strict';var Sequelize=require(_0xf88a('0x0'));module['exports']={'name':{'type':Sequelize[_0xf88a('0x1')],'get':function(_0x482764){return this[_0xf88a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf88a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf88a('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf88a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf88a('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf88a('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xf88a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf88a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf88a('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xf88a('0x5')](_0xf88a('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xf88a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xf88a('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 d216c78..53b0fac 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 _0x85b5=['VoiceMailMessage','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','then','includeAll','include','findAll','catch','show','find','create','body','update','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','set','html-pdf','eml-format','zip-dir','request-promise','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','destroy','error','stack','name','send','index','map'];(function(_0x50922d,_0x175758){var _0x26051c=function(_0x5277a1){while(--_0x5277a1){_0x50922d['push'](_0x50922d['shift']());}};_0x26051c(++_0x175758);}(_0x85b5,0x7f));var _0x585b=function(_0x368a45,_0x5067a2){_0x368a45=_0x368a45-0x0;var _0x45f804=_0x85b5[_0x368a45];return _0x45f804;};'use strict';var pdf=require(_0x585b('0x0'));var emlformat=require(_0x585b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x585b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x585b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x585b('0x4'));var util=require('util');var path=require(_0x585b('0x5'));var sox=require(_0x585b('0x6'));var csv=require(_0x585b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x585b('0x8'));var squel=require('squel');var crypto=require(_0x585b('0x9'));var jsforce=require(_0x585b('0xa'));var deskjs=require(_0x585b('0xb'));var toCsv=require(_0x585b('0x7'));var querystring=require('querystring');var Papa=require(_0x585b('0xc'));var Redis=require(_0x585b('0xd'));var authService=require(_0x585b('0xe'));var qs=require(_0x585b('0xf'));var as=require(_0x585b('0x10'));var hardwareService=require(_0x585b('0x11'));var logger=require(_0x585b('0x12'))('api');var utils=require(_0x585b('0x13'));var config=require('../../config/environment');var db=require(_0x585b('0x14'))['db'];function respondWithStatusCode(_0x479304,_0x16d608){_0x16d608=_0x16d608||0xcc;return function(_0x35bda0){if(_0x35bda0){return _0x479304[_0x585b('0x15')](_0x16d608);}return _0x479304['status'](_0x16d608)[_0x585b('0x16')]();};}function respondWithResult(_0x8f10b4,_0x3d15ed){_0x3d15ed=_0x3d15ed||0xc8;return function(_0x299ee4){if(_0x299ee4){return _0x8f10b4[_0x585b('0x17')](_0x3d15ed)[_0x585b('0x18')](_0x299ee4);}};}function respondWithFilteredResult(_0x394361,_0x5ebc1a){return function(_0x2f827f){if(_0x2f827f){var _0x41f50d=_0x2f827f['count'],_0x4c094e=_0x5ebc1a['offset'],_0x4e2a41=_0x5ebc1a[_0x585b('0x19')]+_0x5ebc1a[_0x585b('0x1a')],_0xd53614;if(_0x4e2a41>=_0x41f50d){_0x4e2a41=_0x41f50d;_0xd53614=0xc8;}else{_0xd53614=0xce;}_0x394361[_0x585b('0x17')](_0xd53614);return _0x394361['set'](_0x585b('0x1b'),_0x4c094e+'-'+_0x4e2a41+'/'+_0x41f50d)[_0x585b('0x18')](_0x2f827f);}return null;};}function patchUpdates(_0x326a4e){return function(_0x31f5c2){try{jsonpatch['apply'](_0x31f5c2,_0x326a4e,!![]);}catch(_0xec725d){return BPromise[_0x585b('0x1c')](_0xec725d);}return _0x31f5c2[_0x585b('0x1d')]();};}function saveUpdates(_0x5dd006,_0x5200ec){return function(_0x6bea29){if(_0x6bea29){return _0x6bea29['update'](_0x5dd006)['then'](function(_0x29e033){return _0x29e033;});}return null;};}function removeEntity(_0xb8b33a,_0x48d9f8){return function(_0x183308){if(_0x183308){return _0x183308[_0x585b('0x1e')]()['then'](function(){_0xb8b33a[_0x585b('0x17')](0xcc)[_0x585b('0x16')]();});}};}function handleEntityNotFound(_0x2122e0,_0x5bf9e4){return function(_0x1c8a7b){if(!_0x1c8a7b){_0x2122e0['sendStatus'](0x194);}return _0x1c8a7b;};}function handleError(_0x3c861c,_0x10dd42){_0x10dd42=_0x10dd42||0x1f4;return function(_0x1a3935){logger[_0x585b('0x1f')](_0x1a3935[_0x585b('0x20')]);if(_0x1a3935[_0x585b('0x21')]){delete _0x1a3935[_0x585b('0x21')];}_0x3c861c[_0x585b('0x17')](_0x10dd42)[_0x585b('0x22')](_0x1a3935);};}exports[_0x585b('0x23')]=function(_0x7d8984,_0x35075c){var _0x11dc56={},_0x476ed9={},_0x183e75={'count':0x0,'rows':[]};var _0x554099=_[_0x585b('0x24')](db[_0x585b('0x25')][_0x585b('0x26')],function(_0x2cf48a){return{'name':_0x2cf48a['fieldName'],'type':_0x2cf48a['type'][_0x585b('0x27')]};});_0x476ed9[_0x585b('0x28')]=_['differenceBy'](_[_0x585b('0x24')](_0x554099,_0x585b('0x21')),['name']);_0x476ed9[_0x585b('0x29')]=_[_0x585b('0x2a')](_0x7d8984[_0x585b('0x29')]);_0x476ed9[_0x585b('0x2b')]=_[_0x585b('0x2c')](_0x476ed9[_0x585b('0x28')],_0x476ed9[_0x585b('0x29')]);_0x11dc56[_0x585b('0x2d')]=_[_0x585b('0x2c')](_0x476ed9[_0x585b('0x28')],qs['fields'](_0x7d8984[_0x585b('0x29')][_0x585b('0x2e')]));_0x11dc56[_0x585b('0x2d')]=_0x11dc56['attributes'][_0x585b('0x2f')]?_0x11dc56[_0x585b('0x2d')]:_0x476ed9[_0x585b('0x28')];if(!_0x7d8984['query'][_0x585b('0x30')](_0x585b('0x31'))){_0x11dc56[_0x585b('0x1a')]=qs[_0x585b('0x1a')](_0x7d8984['query']['limit']);_0x11dc56[_0x585b('0x19')]=qs[_0x585b('0x19')](_0x7d8984[_0x585b('0x29')][_0x585b('0x19')]);}_0x11dc56[_0x585b('0x32')]=qs['sort'](_0x7d8984[_0x585b('0x29')][_0x585b('0x33')]);_0x11dc56[_0x585b('0x34')]=qs[_0x585b('0x2b')](_[_0x585b('0x35')](_0x7d8984['query'],_0x476ed9['filters']),_0x554099);if(_0x7d8984['query'][_0x585b('0x36')]){_0x11dc56[_0x585b('0x34')]=_[_0x585b('0x37')](_0x11dc56[_0x585b('0x34')],{'$or':_[_0x585b('0x24')](_0x554099,function(_0x2d2414){if(_0x2d2414[_0x585b('0x38')]!==_0x585b('0x39')){var _0x6cec28={};_0x6cec28[_0x2d2414['name']]={'$like':'%'+_0x7d8984[_0x585b('0x29')][_0x585b('0x36')]+'%'};return _0x6cec28;}})});}_0x11dc56=_['merge']({},_0x11dc56,_0x7d8984[_0x585b('0x3a')]);var _0x3bf1bd={'where':_0x11dc56[_0x585b('0x34')]};return db[_0x585b('0x25')][_0x585b('0x3b')](_0x3bf1bd)[_0x585b('0x3c')](function(_0x58bf4c){_0x183e75[_0x585b('0x3b')]=_0x58bf4c;if(_0x7d8984[_0x585b('0x29')][_0x585b('0x3d')]){_0x11dc56[_0x585b('0x3e')]=[{'all':!![]}];}return db[_0x585b('0x25')][_0x585b('0x3f')](_0x11dc56);})[_0x585b('0x3c')](function(_0xc543ca){_0x183e75['rows']=_0xc543ca;return _0x183e75;})[_0x585b('0x3c')](respondWithFilteredResult(_0x35075c,_0x11dc56))[_0x585b('0x40')](handleError(_0x35075c,null));};exports[_0x585b('0x41')]=function(_0x4c5a14,_0x402334){var _0x698a0f={'raw':!![],'where':{'id':_0x4c5a14['params']['id']}},_0x2b6b1b={};_0x2b6b1b[_0x585b('0x28')]=_[_0x585b('0x2a')](db['VoiceMailMessage']['rawAttributes']);_0x2b6b1b[_0x585b('0x29')]=_['keys'](_0x4c5a14[_0x585b('0x29')]);_0x2b6b1b['filters']=_[_0x585b('0x2c')](_0x2b6b1b[_0x585b('0x28')],_0x2b6b1b['query']);_0x698a0f[_0x585b('0x2d')]=_['intersection'](_0x2b6b1b['model'],qs['fields'](_0x4c5a14[_0x585b('0x29')]['fields']));_0x698a0f[_0x585b('0x2d')]=_0x698a0f[_0x585b('0x2d')]['length']?_0x698a0f[_0x585b('0x2d')]:_0x2b6b1b[_0x585b('0x28')];if(_0x4c5a14[_0x585b('0x29')]['includeAll']){_0x698a0f['include']=[{'all':!![]}];}_0x698a0f=_['merge']({},_0x698a0f,_0x4c5a14[_0x585b('0x3a')]);return db[_0x585b('0x25')][_0x585b('0x42')](_0x698a0f)[_0x585b('0x3c')](handleEntityNotFound(_0x402334,null))['then'](respondWithResult(_0x402334,null))[_0x585b('0x40')](handleError(_0x402334,null));};exports[_0x585b('0x43')]=function(_0x30bf1c,_0x3a7fe2){return db['VoiceMailMessage'][_0x585b('0x43')](_0x30bf1c[_0x585b('0x44')],{})[_0x585b('0x3c')](respondWithResult(_0x3a7fe2,0xc9))[_0x585b('0x40')](handleError(_0x3a7fe2,null));};exports[_0x585b('0x45')]=function(_0x5ca83d,_0x492f3f){if(_0x5ca83d['body']['id']){delete _0x5ca83d[_0x585b('0x44')]['id'];}return db['VoiceMailMessage'][_0x585b('0x42')]({'where':{'id':_0x5ca83d['params']['id']}})['then'](handleEntityNotFound(_0x492f3f,null))['then'](saveUpdates(_0x5ca83d[_0x585b('0x44')],null))[_0x585b('0x3c')](respondWithResult(_0x492f3f,null))['catch'](handleError(_0x492f3f,null));};exports['destroy']=function(_0x2d6d70,_0x40dd9f){return db[_0x585b('0x25')]['find']({'where':{'id':_0x2d6d70[_0x585b('0x46')]['id']}})['then'](handleEntityNotFound(_0x40dd9f,null))[_0x585b('0x3c')](removeEntity(_0x40dd9f,null))['catch'](handleError(_0x40dd9f,null));};exports[_0x585b('0x47')]=function(_0x5a2034,_0x3b96db,_0x53c543){return db[_0x585b('0x25')][_0x585b('0x42')]({'where':{'id':_0x5a2034[_0x585b('0x46')]['id']},'attributes':['id',_0x585b('0x48'),_0x585b('0x49')]})['then'](handleEntityNotFound(_0x3b96db,null))[_0x585b('0x3c')](function(_0x2ef157){if(_0x2ef157){if(!_0x2ef157[_0x585b('0x48')]){throw new db[(_0x585b('0x4a'))][(_0x585b('0x4b'))](_0x585b('0x4c'));}var _0x5d7f10={'Content-Type':_0x585b('0x4d'),'Content-Disposition':_0x585b('0x4e')};if(_0x2ef157[_0x585b('0x49')]){_0x5d7f10[_0x585b('0x4f')]='attachment;\x20filename=\x22'+_0x2ef157[_0x585b('0x49')]+_0x585b('0x50');}_0x3b96db[_0x585b('0x51')](_0x5d7f10);return _0x3b96db['send'](new Buffer(_0x2ef157['recording']));}})['catch'](handleError(_0x3b96db,null));}; \ No newline at end of file +var _0x777d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMailMessage','count','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','lodash','desk.js','querystring'];(function(_0x527387,_0x331638){var _0x22032f=function(_0x48fa3c){while(--_0x48fa3c){_0x527387['push'](_0x527387['shift']());}};_0x22032f(++_0x331638);}(_0x777d,0xe9));var _0xd777=function(_0x46d8b2,_0x3829c4){_0x46d8b2=_0x46d8b2-0x0;var _0x1a351f=_0x777d[_0x46d8b2];return _0x1a351f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd777('0x0'));var rimraf=require(_0xd777('0x1'));var zipdir=require(_0xd777('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd777('0x3'));var moment=require(_0xd777('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd777('0x5'));var sox=require('sox');var csv=require(_0xd777('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd777('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd777('0x8'));var toCsv=require(_0xd777('0x6'));var querystring=require(_0xd777('0x9'));var Papa=require(_0xd777('0xa'));var Redis=require(_0xd777('0xb'));var authService=require(_0xd777('0xc'));var qs=require(_0xd777('0xd'));var as=require(_0xd777('0xe'));var hardwareService=require(_0xd777('0xf'));var logger=require(_0xd777('0x10'))(_0xd777('0x11'));var utils=require(_0xd777('0x12'));var config=require(_0xd777('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59dc27,_0x25f574){_0x25f574=_0x25f574||0xcc;return function(_0x560778){if(_0x560778){return _0x59dc27[_0xd777('0x14')](_0x25f574);}return _0x59dc27[_0xd777('0x15')](_0x25f574)[_0xd777('0x16')]();};}function respondWithResult(_0x2f310c,_0x2ac82f){_0x2ac82f=_0x2ac82f||0xc8;return function(_0x5d0ded){if(_0x5d0ded){return _0x2f310c[_0xd777('0x15')](_0x2ac82f)['json'](_0x5d0ded);}};}function respondWithFilteredResult(_0x23b61a,_0x2cd014){return function(_0x1e5ecb){if(_0x1e5ecb){var _0x1ef016=_0x1e5ecb['count'],_0x25e3f2=_0x2cd014[_0xd777('0x17')],_0x4f4af5=_0x2cd014['offset']+_0x2cd014[_0xd777('0x18')],_0x24cd59;if(_0x4f4af5>=_0x1ef016){_0x4f4af5=_0x1ef016;_0x24cd59=0xc8;}else{_0x24cd59=0xce;}_0x23b61a[_0xd777('0x15')](_0x24cd59);return _0x23b61a[_0xd777('0x19')](_0xd777('0x1a'),_0x25e3f2+'-'+_0x4f4af5+'/'+_0x1ef016)[_0xd777('0x1b')](_0x1e5ecb);}return null;};}function patchUpdates(_0x201175){return function(_0x48d5f0){try{jsonpatch['apply'](_0x48d5f0,_0x201175,!![]);}catch(_0x20ffde){return BPromise['reject'](_0x20ffde);}return _0x48d5f0[_0xd777('0x1c')]();};}function saveUpdates(_0x560121,_0x58a079){return function(_0x5b2204){if(_0x5b2204){return _0x5b2204[_0xd777('0x1d')](_0x560121)['then'](function(_0x4cb07a){return _0x4cb07a;});}return null;};}function removeEntity(_0x49d7fa,_0x48d18c){return function(_0x55b975){if(_0x55b975){return _0x55b975[_0xd777('0x1e')]()[_0xd777('0x1f')](function(){_0x49d7fa[_0xd777('0x15')](0xcc)[_0xd777('0x16')]();});}};}function handleEntityNotFound(_0xfebc2f,_0x33c3d4){return function(_0x2ff8d3){if(!_0x2ff8d3){_0xfebc2f[_0xd777('0x14')](0x194);}return _0x2ff8d3;};}function handleError(_0x188a3a,_0x3e637a){_0x3e637a=_0x3e637a||0x1f4;return function(_0x1ff306){logger['error'](_0x1ff306[_0xd777('0x20')]);if(_0x1ff306[_0xd777('0x21')]){delete _0x1ff306[_0xd777('0x21')];}_0x188a3a[_0xd777('0x15')](_0x3e637a)[_0xd777('0x22')](_0x1ff306);};}exports['index']=function(_0x141e68,_0x5e752b){var _0x482ad1={},_0x2ff04b={},_0x21e38c={'count':0x0,'rows':[]};var _0x2dae46=_[_0xd777('0x23')](db['VoiceMailMessage'][_0xd777('0x24')],function(_0x141baa){return{'name':_0x141baa[_0xd777('0x25')],'type':_0x141baa[_0xd777('0x26')][_0xd777('0x27')]};});_0x2ff04b[_0xd777('0x28')]=_[_0xd777('0x29')](_[_0xd777('0x23')](_0x2dae46,'name'),[_0xd777('0x21')]);_0x2ff04b['query']=_['keys'](_0x141e68[_0xd777('0x2a')]);_0x2ff04b[_0xd777('0x2b')]=_[_0xd777('0x2c')](_0x2ff04b[_0xd777('0x28')],_0x2ff04b['query']);_0x482ad1['attributes']=_[_0xd777('0x2c')](_0x2ff04b[_0xd777('0x28')],qs[_0xd777('0x2d')](_0x141e68[_0xd777('0x2a')][_0xd777('0x2d')]));_0x482ad1[_0xd777('0x2e')]=_0x482ad1['attributes']['length']?_0x482ad1[_0xd777('0x2e')]:_0x2ff04b[_0xd777('0x28')];if(!_0x141e68[_0xd777('0x2a')][_0xd777('0x2f')](_0xd777('0x30'))){_0x482ad1[_0xd777('0x18')]=qs[_0xd777('0x18')](_0x141e68[_0xd777('0x2a')]['limit']);_0x482ad1['offset']=qs[_0xd777('0x17')](_0x141e68['query'][_0xd777('0x17')]);}_0x482ad1[_0xd777('0x31')]=qs[_0xd777('0x32')](_0x141e68[_0xd777('0x2a')]['sort']);_0x482ad1[_0xd777('0x33')]=qs['filters'](_[_0xd777('0x34')](_0x141e68['query'],_0x2ff04b['filters']),_0x2dae46);if(_0x141e68['query']['filter']){_0x482ad1[_0xd777('0x33')]=_[_0xd777('0x35')](_0x482ad1[_0xd777('0x33')],{'$or':_['map'](_0x2dae46,function(_0x51adbd){if(_0x51adbd['type']!==_0xd777('0x36')){var _0x21466={};_0x21466[_0x51adbd[_0xd777('0x21')]]={'$like':'%'+_0x141e68[_0xd777('0x2a')][_0xd777('0x37')]+'%'};return _0x21466;}})});}_0x482ad1=_[_0xd777('0x35')]({},_0x482ad1,_0x141e68[_0xd777('0x38')]);var _0x22b014={'where':_0x482ad1[_0xd777('0x33')]};return db[_0xd777('0x39')]['count'](_0x22b014)[_0xd777('0x1f')](function(_0x11a5f7){_0x21e38c[_0xd777('0x3a')]=_0x11a5f7;if(_0x141e68[_0xd777('0x2a')][_0xd777('0x3b')]){_0x482ad1[_0xd777('0x3c')]=[{'all':!![]}];}return db[_0xd777('0x39')][_0xd777('0x3d')](_0x482ad1);})[_0xd777('0x1f')](function(_0x34381b){_0x21e38c[_0xd777('0x3e')]=_0x34381b;return _0x21e38c;})[_0xd777('0x1f')](respondWithFilteredResult(_0x5e752b,_0x482ad1))['catch'](handleError(_0x5e752b,null));};exports[_0xd777('0x3f')]=function(_0x52b3d0,_0x45e831){var _0x30c9ec={'raw':!![],'where':{'id':_0x52b3d0[_0xd777('0x40')]['id']}},_0xc6297b={};_0xc6297b[_0xd777('0x28')]=_[_0xd777('0x41')](db['VoiceMailMessage'][_0xd777('0x24')]);_0xc6297b[_0xd777('0x2a')]=_[_0xd777('0x41')](_0x52b3d0['query']);_0xc6297b[_0xd777('0x2b')]=_[_0xd777('0x2c')](_0xc6297b[_0xd777('0x28')],_0xc6297b[_0xd777('0x2a')]);_0x30c9ec[_0xd777('0x2e')]=_[_0xd777('0x2c')](_0xc6297b[_0xd777('0x28')],qs['fields'](_0x52b3d0[_0xd777('0x2a')][_0xd777('0x2d')]));_0x30c9ec['attributes']=_0x30c9ec['attributes'][_0xd777('0x42')]?_0x30c9ec[_0xd777('0x2e')]:_0xc6297b[_0xd777('0x28')];if(_0x52b3d0[_0xd777('0x2a')][_0xd777('0x3b')]){_0x30c9ec[_0xd777('0x3c')]=[{'all':!![]}];}_0x30c9ec=_[_0xd777('0x35')]({},_0x30c9ec,_0x52b3d0[_0xd777('0x38')]);return db[_0xd777('0x39')][_0xd777('0x43')](_0x30c9ec)[_0xd777('0x1f')](handleEntityNotFound(_0x45e831,null))['then'](respondWithResult(_0x45e831,null))[_0xd777('0x44')](handleError(_0x45e831,null));};exports[_0xd777('0x45')]=function(_0x56c8e5,_0x478ae2){return db['VoiceMailMessage'][_0xd777('0x45')](_0x56c8e5[_0xd777('0x46')],{})[_0xd777('0x1f')](respondWithResult(_0x478ae2,0xc9))[_0xd777('0x44')](handleError(_0x478ae2,null));};exports[_0xd777('0x1d')]=function(_0x305c1c,_0x477626){if(_0x305c1c[_0xd777('0x46')]['id']){delete _0x305c1c['body']['id'];}return db[_0xd777('0x39')]['find']({'where':{'id':_0x305c1c['params']['id']}})[_0xd777('0x1f')](handleEntityNotFound(_0x477626,null))[_0xd777('0x1f')](saveUpdates(_0x305c1c['body'],null))[_0xd777('0x1f')](respondWithResult(_0x477626,null))[_0xd777('0x44')](handleError(_0x477626,null));};exports[_0xd777('0x1e')]=function(_0x25486b,_0x47efa6){return db['VoiceMailMessage'][_0xd777('0x43')]({'where':{'id':_0x25486b['params']['id']}})[_0xd777('0x1f')](handleEntityNotFound(_0x47efa6,null))[_0xd777('0x1f')](removeEntity(_0x47efa6,null))[_0xd777('0x44')](handleError(_0x47efa6,null));};exports[_0xd777('0x47')]=function(_0x22a472,_0x57113d,_0x19204f){return db[_0xd777('0x39')][_0xd777('0x43')]({'where':{'id':_0x22a472['params']['id']},'attributes':['id',_0xd777('0x48'),_0xd777('0x49')]})['then'](handleEntityNotFound(_0x57113d,null))[_0xd777('0x1f')](function(_0x2d2848){if(_0x2d2848){if(!_0x2d2848[_0xd777('0x48')]){throw new db['Sequelize'][(_0xd777('0x4a'))](_0xd777('0x4b'));}var _0x2c5c08={'Content-Type':_0xd777('0x4c'),'Content-Disposition':_0xd777('0x4d')};if(_0x2d2848[_0xd777('0x49')]){_0x2c5c08[_0xd777('0x4e')]=_0xd777('0x4f')+_0x2d2848[_0xd777('0x49')]+_0xd777('0x50');}_0x57113d[_0xd777('0x19')](_0x2c5c08);return _0x57113d[_0xd777('0x22')](new Buffer(_0x2d2848[_0xd777('0x48')]));}})[_0xd777('0x44')](handleError(_0x57113d,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1883f24..d8ac70a 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 _0x0c6b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0xe59eee,_0x4205f6){_0xe59eee=_0xe59eee-0x0;var _0x424589=_0x0c6b[_0xe59eee];return _0x424589;};'use strict';var _=require(_0xb0c6('0x0'));var util=require('util');var logger=require(_0xb0c6('0x1'))(_0xb0c6('0x2'));var moment=require(_0xb0c6('0x3'));var BPromise=require(_0xb0c6('0x4'));var rp=require(_0xb0c6('0x5'));var fs=require('fs');var path=require(_0xb0c6('0x6'));var rimraf=require(_0xb0c6('0x7'));var config=require(_0xb0c6('0x8'));var attributes=require(_0xb0c6('0x9'));module[_0xb0c6('0xa')]=function(_0xc26f64,_0x56c7c9){return _0xc26f64['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xb0c6('0xb'),'fields':[_0xb0c6('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x75ea=['path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','request-promise'];(function(_0x1c0a51,_0x57c225){var _0x13ac3c=function(_0x39ffb6){while(--_0x39ffb6){_0x1c0a51['push'](_0x1c0a51['shift']());}};_0x13ac3c(++_0x57c225);}(_0x75ea,0x7d));var _0xa75e=function(_0x8a57dc,_0x20fa26){_0x8a57dc=_0x8a57dc-0x0;var _0x4e8f22=_0x75ea[_0x8a57dc];return _0x4e8f22;};'use strict';var _=require(_0xa75e('0x0'));var util=require(_0xa75e('0x1'));var logger=require('../../config/logger')(_0xa75e('0x2'));var moment=require(_0xa75e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa75e('0x4'));var fs=require('fs');var path=require(_0xa75e('0x5'));var rimraf=require(_0xa75e('0x6'));var config=require(_0xa75e('0x7'));var attributes=require(_0xa75e('0x8'));module['exports']=function(_0x2a3364,_0x1f9627){return _0x2a3364[_0xa75e('0x9')](_0xa75e('0xa'),attributes,{'tableName':_0xa75e('0xb'),'paranoid':![],'indexes':[{'name':_0xa75e('0xc'),'fields':[_0xa75e('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 198401d..a8704c6 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x33199e,_0x428ded){var _0x2eef3c=function(_0x41a97a){while(--_0x41a97a){_0x33199e['push'](_0x33199e['shift']());}};_0x2eef3c(++_0x428ded);}(_0x14a0,0x8e));var _0x014a=function(_0x5150b1,_0x1eeec2){_0x5150b1=_0x5150b1-0x0;var _0x5c0639=_0x14a0[_0x5150b1];return _0x5c0639;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x4975,0x86));var _0x5497=function(_0x5ba866,_0x529606){_0x5ba866=_0x5ba866-0x0;var _0x597ed2=_0x4975[_0x5ba866];return _0x597ed2;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f756245..6386365 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 _0x5614=['update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound','put'];(function(_0x32f850,_0x6ba444){var _0x38e424=function(_0x14e281){while(--_0x14e281){_0x32f850['push'](_0x32f850['shift']());}};_0x38e424(++_0x6ba444);}(_0x5614,0x82));var _0x4561=function(_0x1936db,_0x110df7){_0x1936db=_0x1936db-0x0;var _0x43b5c2=_0x5614[_0x1936db];return _0x43b5c2;};'use strict';var multer=require(_0x4561('0x0'));var util=require(_0x4561('0x1'));var path=require(_0x4561('0x2'));var timeout=require(_0x4561('0x3'));var express=require(_0x4561('0x4'));var router=express[_0x4561('0x5')]();var auth=require(_0x4561('0x6'));var interaction=require(_0x4561('0x7'));var config=require(_0x4561('0x8'));var controller=require(_0x4561('0x9'));router[_0x4561('0xa')]('/',auth[_0x4561('0xb')](),controller['index']);router['get'](_0x4561('0xc'),auth['isAuthenticated'](),controller[_0x4561('0xd')]);router[_0x4561('0xa')](_0x4561('0xe'),auth[_0x4561('0xb')](),controller[_0x4561('0xf')]);router[_0x4561('0x10')]('/',auth[_0x4561('0xb')](),controller[_0x4561('0x11')]);router[_0x4561('0x10')]('/:id/sounds',auth[_0x4561('0xb')](),controller[_0x4561('0x12')]);router[_0x4561('0x13')](_0x4561('0xc'),auth[_0x4561('0xb')](),controller[_0x4561('0x14')]);router[_0x4561('0x15')](_0x4561('0xc'),auth[_0x4561('0xb')](),controller[_0x4561('0x16')]);router[_0x4561('0x15')](_0x4561('0x17'),auth['isAuthenticated'](),controller['removeSound']);module[_0x4561('0x18')]=router; \ No newline at end of file +var _0xefb0=['post','create','/:id/sounds','addSound','delete','destroy','/:id/sounds/:id2','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','show','isAuthenticated','getSounds'];(function(_0x56d67e,_0x2a6d3e){var _0x3d52f0=function(_0x5ebabb){while(--_0x5ebabb){_0x56d67e['push'](_0x56d67e['shift']());}};_0x3d52f0(++_0x2a6d3e);}(_0xefb0,0x143));var _0x0efb=function(_0x118f56,_0x16bf9c){_0x118f56=_0x118f56-0x0;var _0x5a23ec=_0xefb0[_0x118f56];return _0x5a23ec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0efb('0x0'));var timeout=require(_0x0efb('0x1'));var express=require(_0x0efb('0x2'));var router=express['Router']();var auth=require(_0x0efb('0x3'));var interaction=require(_0x0efb('0x4'));var config=require(_0x0efb('0x5'));var controller=require(_0x0efb('0x6'));router[_0x0efb('0x7')]('/',auth['isAuthenticated'](),controller[_0x0efb('0x8')]);router['get'](_0x0efb('0x9'),auth['isAuthenticated'](),controller[_0x0efb('0xa')]);router[_0x0efb('0x7')]('/:id/sounds',auth[_0x0efb('0xb')](),controller[_0x0efb('0xc')]);router[_0x0efb('0xd')]('/',auth[_0x0efb('0xb')](),controller[_0x0efb('0xe')]);router[_0x0efb('0xd')](_0x0efb('0xf'),auth[_0x0efb('0xb')](),controller[_0x0efb('0x10')]);router['put'](_0x0efb('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x0efb('0x11')](_0x0efb('0x9'),auth[_0x0efb('0xb')](),controller[_0x0efb('0x12')]);router[_0x0efb('0x11')](_0x0efb('0x13'),auth[_0x0efb('0xb')](),controller['removeSound']);module[_0x0efb('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index dc509d9..efa2630 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 _0x51c2=['STRING','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','exports'];(function(_0x36bf46,_0x3d8db9){var _0x1d0a72=function(_0x328e8d){while(--_0x328e8d){_0x36bf46['push'](_0x36bf46['shift']());}};_0x1d0a72(++_0x3d8db9);}(_0x51c2,0xfc));var _0x251c=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x51c2[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require('sequelize');module[_0x251c('0x0')]={'name':{'type':Sequelize[_0x251c('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x251c('0x2')](_0x251c('0x3'),_0x251c('0x4'),_0x251c('0x5'),_0x251c('0x6'),_0x251c('0x7'),_0x251c('0x8')),'allowNull':!![],'defaultValue':_0x251c('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x251c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x251c('0x1')],'allowNull':!![],'defaultValue':_0x251c('0x9')},'format':{'type':Sequelize[_0x251c('0x1')],'allowNull':!![]},'stamp':{'type':_0x251c('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5242=['sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','mp3','alpha','BOOLEAN'];(function(_0x5183aa,_0x54277c){var _0x73ac67=function(_0x14759c){while(--_0x14759c){_0x5183aa['push'](_0x5183aa['shift']());}};_0x73ac67(++_0x54277c);}(_0x5242,0x1a4));var _0x2524=function(_0x534314,_0x22687e){_0x534314=_0x534314-0x0;var _0x5866e4=_0x5242[_0x534314];return _0x5866e4;};'use strict';var Sequelize=require(_0x2524('0x0'));module[_0x2524('0x1')]={'name':{'type':Sequelize[_0x2524('0x2')],'allowNull':![],'unique':_0x2524('0x3')},'mode':{'type':Sequelize[_0x2524('0x4')](_0x2524('0x5'),_0x2524('0x6'),_0x2524('0x7'),_0x2524('0x8'),'quietmp3',_0x2524('0x9')),'allowNull':!![],'defaultValue':_0x2524('0x6')},'directory':{'type':Sequelize[_0x2524('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x2524('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2524('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2524('0xa')},'format':{'type':Sequelize[_0x2524('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x2524('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 7be1389..e205592 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 _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x108966,_0x3b30c1){var _0x9a536c=function(_0xba5cc8){while(--_0xba5cc8){_0x108966['push'](_0x108966['shift']());}};_0x9a536c(++_0x3b30c1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file +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(_0x5ac99a,_0x3fd986){var _0x2af49b=function(_0x41c082){while(--_0x41c082){_0x5ac99a['push'](_0x5ac99a['shift']());}};_0x2af49b(++_0x3fd986);}(_0xb10b,0x12a));var _0xbb10=function(_0x36f5ae,_0x53960b){_0x36f5ae=_0x36f5ae-0x0;var _0x10c86c=_0xb10b[_0x36f5ae];return _0x10c86c;};'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 b795c63..444ed5a 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 _0xa751=['moment','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','voice_musiconhold','lodash','../../config/logger','api'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0xa751,0x1ec));var _0x1a75=function(_0x351c01,_0x508367){_0x351c01=_0x351c01-0x0;var _0x1b2e1d=_0xa751[_0x351c01];return _0x1b2e1d;};'use strict';var _=require(_0x1a75('0x0'));var util=require('util');var logger=require(_0x1a75('0x1'))(_0x1a75('0x2'));var moment=require(_0x1a75('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a75('0x4'));var rimraf=require(_0x1a75('0x5'));var config=require(_0x1a75('0x6'));var attributes=require(_0x1a75('0x7'));module['exports']=function(_0x3b8128,_0x5110b9){return _0x3b8128['define']('VoiceMusicOnHold',attributes,{'tableName':_0x1a75('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f75=['VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfcbf57,_0x4b05fd){var _0x1078fa=function(_0xb65856){while(--_0xb65856){_0xfcbf57['push'](_0xfcbf57['shift']());}};_0x1078fa(++_0x4b05fd);}(_0x4f75,0x1e6));var _0x54f7=function(_0x2ff497,_0x5a1137){_0x2ff497=_0x2ff497-0x0;var _0x95778a=_0x4f75[_0x2ff497];return _0x95778a;};'use strict';var _=require(_0x54f7('0x0'));var util=require(_0x54f7('0x1'));var logger=require('../../config/logger')(_0x54f7('0x2'));var moment=require(_0x54f7('0x3'));var BPromise=require(_0x54f7('0x4'));var rp=require(_0x54f7('0x5'));var fs=require('fs');var path=require(_0x54f7('0x6'));var rimraf=require(_0x54f7('0x7'));var config=require(_0x54f7('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x261095,_0x510358){return _0x261095['define'](_0x54f7('0x9'),attributes,{'tableName':_0x54f7('0xa'),'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 4099448..7a4868d 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 _0xb975=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0xa4a3dd,_0x4ed169){var _0x10fb35=function(_0x5f2252){while(--_0x5f2252){_0xa4a3dd['push'](_0xa4a3dd['shift']());}};_0x10fb35(++_0x4ed169);}(_0xb975,0x14e));var _0x5b97=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xb975[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x5b97('0x0'));var util=require(_0x5b97('0x1'));var moment=require(_0x5b97('0x2'));var BPromise=require(_0x5b97('0x3'));var rs=require(_0x5b97('0x4'));var fs=require('fs');var Redis=require(_0x5b97('0x5'));var db=require(_0x5b97('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b97('0x7'))(_0x5b97('0x8'));var config=require(_0x5b97('0x9'));var jayson=require(_0x5b97('0xa'));var client=jayson[_0x5b97('0xb')][_0x5b97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14d49b,_0x3011d1,_0x30c118){return new BPromise(function(_0x47d558,_0x3589d0){return client[_0x5b97('0xd')](_0x14d49b,_0x30c118)[_0x5b97('0xe')](function(_0x291e9f){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3011d1,'request\x20sent');logger[_0x5b97('0xf')](_0x5b97('0x10'),_0x3011d1,_0x5b97('0x11'),JSON[_0x5b97('0x12')](_0x291e9f));if(_0x291e9f[_0x5b97('0x13')]){if(_0x291e9f[_0x5b97('0x13')][_0x5b97('0x14')]===0x1f4){logger[_0x5b97('0x13')](_0x5b97('0x15'),_0x3011d1,_0x291e9f[_0x5b97('0x13')][_0x5b97('0x16')]);return _0x3589d0(_0x291e9f[_0x5b97('0x13')][_0x5b97('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3011d1,_0x291e9f[_0x5b97('0x13')][_0x5b97('0x16')]);return _0x47d558(_0x291e9f['error']['message']);}else{logger[_0x5b97('0x17')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3011d1,_0x5b97('0x11'));_0x47d558(_0x291e9f[_0x5b97('0x18')]['message']);}})[_0x5b97('0x19')](function(_0x58d84){logger[_0x5b97('0x13')](_0x5b97('0x15'),_0x3011d1,_0x58d84);_0x3589d0(_0x58d84);});});} \ No newline at end of file +var _0x4237=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceMusicOnHold,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4237,0x1b3));var _0x7423=function(_0x4a8a92,_0x4d3a85){_0x4a8a92=_0x4a8a92-0x0;var _0x30585f=_0x4237[_0x4a8a92];return _0x30585f;};'use strict';var _=require(_0x7423('0x0'));var util=require('util');var moment=require(_0x7423('0x1'));var BPromise=require(_0x7423('0x2'));var rs=require(_0x7423('0x3'));var fs=require('fs');var Redis=require(_0x7423('0x4'));var db=require(_0x7423('0x5'))['db'];var utils=require(_0x7423('0x6'));var logger=require(_0x7423('0x7'))(_0x7423('0x8'));var config=require(_0x7423('0x9'));var jayson=require(_0x7423('0xa'));var client=jayson[_0x7423('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28f073,_0x146857,_0x512732){return new BPromise(function(_0x42b947,_0x3150dc){return client[_0x7423('0xc')](_0x28f073,_0x512732)['then'](function(_0x28b82c){logger['info'](_0x7423('0xd'),_0x146857,'request\x20sent');logger[_0x7423('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x146857,'request\x20sent',JSON[_0x7423('0xf')](_0x28b82c));if(_0x28b82c[_0x7423('0x10')]){if(_0x28b82c['error'][_0x7423('0x11')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x146857,_0x28b82c[_0x7423('0x10')][_0x7423('0x12')]);return _0x3150dc(_0x28b82c[_0x7423('0x10')][_0x7423('0x12')]);}logger[_0x7423('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x146857,_0x28b82c[_0x7423('0x10')][_0x7423('0x12')]);return _0x42b947(_0x28b82c[_0x7423('0x10')][_0x7423('0x12')]);}else{logger[_0x7423('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x146857,'request\x20sent');_0x42b947(_0x28b82c['result'][_0x7423('0x12')]);}})[_0x7423('0x14')](function(_0x1540ff){logger[_0x7423('0x10')](_0x7423('0xd'),_0x146857,_0x1540ff);_0x3150dc(_0x1540ff);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b63126a..77f6455 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 _0xe542=['post','addAgents','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/users','getAgents'];(function(_0x22d1ef,_0x4a5152){var _0x47c5a3=function(_0x9a2c48){while(--_0x9a2c48){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x47c5a3(++_0x4a5152);}(_0xe542,0xa0));var _0x2e54=function(_0x40e442,_0x3f5f5e){_0x40e442=_0x40e442-0x0;var _0x1e3687=_0xe542[_0x40e442];return _0x1e3687;};'use strict';var multer=require(_0x2e54('0x0'));var util=require(_0x2e54('0x1'));var path=require(_0x2e54('0x2'));var timeout=require(_0x2e54('0x3'));var express=require('express');var router=express[_0x2e54('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2e54('0x5'));var config=require(_0x2e54('0x6'));var controller=require(_0x2e54('0x7'));router[_0x2e54('0x8')]('/',auth[_0x2e54('0x9')](),controller[_0x2e54('0xa')]);router['get'](_0x2e54('0xb'),auth['isAuthenticated'](),controller[_0x2e54('0xc')]);router['get'](_0x2e54('0xd'),auth[_0x2e54('0x9')](),controller['show']);router[_0x2e54('0x8')](_0x2e54('0xe'),auth['isAuthenticated'](),controller[_0x2e54('0xf')]);router['post']('/',auth[_0x2e54('0x9')](),controller['create']);router[_0x2e54('0x10')](_0x2e54('0xe'),auth[_0x2e54('0x9')](),controller[_0x2e54('0x11')]);router[_0x2e54('0x12')](_0x2e54('0xd'),auth[_0x2e54('0x9')](),controller[_0x2e54('0x13')]);router[_0x2e54('0x14')](_0x2e54('0xd'),auth[_0x2e54('0x9')](),controller['destroy']);router['delete'](_0x2e54('0xe'),auth[_0x2e54('0x9')](),controller['removeAgents']);module[_0x2e54('0x15')]=router; \ No newline at end of file +var _0x598d=['/describe','describe','show','/:id/users','create','post','/:id','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index'];(function(_0x29f95e,_0x5b5277){var _0x187daf=function(_0x5b8bd4){while(--_0x5b8bd4){_0x29f95e['push'](_0x29f95e['shift']());}};_0x187daf(++_0x5b5277);}(_0x598d,0x1c3));var _0xd598=function(_0xd2f750,_0x143f2a){_0xd2f750=_0xd2f750-0x0;var _0x515863=_0x598d[_0xd2f750];return _0x515863;};'use strict';var multer=require(_0xd598('0x0'));var util=require(_0xd598('0x1'));var path=require('path');var timeout=require(_0xd598('0x2'));var express=require(_0xd598('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd598('0x4'));var controller=require(_0xd598('0x5'));router[_0xd598('0x6')]('/',auth[_0xd598('0x7')](),controller[_0xd598('0x8')]);router[_0xd598('0x6')](_0xd598('0x9'),auth[_0xd598('0x7')](),controller[_0xd598('0xa')]);router[_0xd598('0x6')]('/:id',auth[_0xd598('0x7')](),controller[_0xd598('0xb')]);router[_0xd598('0x6')](_0xd598('0xc'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xd598('0x7')](),controller[_0xd598('0xd')]);router[_0xd598('0xe')](_0xd598('0xc'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xd598('0xf'),auth[_0xd598('0x7')](),controller['update']);router[_0xd598('0x10')](_0xd598('0xf'),auth[_0xd598('0x7')](),controller[_0xd598('0x11')]);router[_0xd598('0x10')]('/:id/users',auth[_0xd598('0x7')](),controller[_0xd598('0x12')]);module[_0xd598('0x13')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ee8b521..73945a3 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 _0x6400=['STRING','system-','getDataValue','name','sequelize'];(function(_0x1e0363,_0x5822a1){var _0x3bfe65=function(_0x177d9e){while(--_0x177d9e){_0x1e0363['push'](_0x1e0363['shift']());}};_0x3bfe65(++_0x5822a1);}(_0x6400,0x1ee));var _0x0640=function(_0x36d05c,_0x1cb82f){_0x36d05c=_0x36d05c-0x0;var _0x35773c=_0x6400[_0x36d05c];return _0x35773c;};'use strict';var Sequelize=require(_0x0640('0x0'));module['exports']={'name':{'type':Sequelize[_0x0640('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2095ef){return _0x0640('0x2')+this[_0x0640('0x3')](_0x0640('0x4'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x0640('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xcd26=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0xcd26,0x106));var _0x6cd2=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0xcd26[_0x4a7843];return _0x2c57fe;};'use strict';var Sequelize=require(_0x6cd2('0x0'));module[_0x6cd2('0x1')]={'name':{'type':Sequelize[_0x6cd2('0x2')],'allowNull':![],'unique':_0x6cd2('0x3')},'prefix':{'type':Sequelize[_0x6cd2('0x4')],'get':function(_0x178c95){return _0x6cd2('0x5')+this[_0x6cd2('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x6cd2('0x2')]},'callerIdAll':{'type':Sequelize[_0x6cd2('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x6cd2('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 34e398d..8713df5 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 _0x5fdd=['userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','findOne','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','params','describe','create','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','context','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','transaction','findById','addAgents','ids','omit','spread'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x5fdd,0x105));var _0xd5fd=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0x5fdd[_0x3da707];return _0x342ee7;};'use strict';var pdf=require(_0xd5fd('0x0'));var emlformat=require(_0xd5fd('0x1'));var rimraf=require(_0xd5fd('0x2'));var zipdir=require(_0xd5fd('0x3'));var jsonpatch=require(_0xd5fd('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd5fd('0x5'));var util=require('util');var path=require(_0xd5fd('0x6'));var sox=require(_0xd5fd('0x7'));var csv=require('to-csv');var ejs=require(_0xd5fd('0x8'));var fs=require('fs');var _=require(_0xd5fd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd5fd('0xa'));var toCsv=require(_0xd5fd('0xb'));var querystring=require(_0xd5fd('0xc'));var Papa=require(_0xd5fd('0xd'));var Redis=require(_0xd5fd('0xe'));var authService=require(_0xd5fd('0xf'));var qs=require(_0xd5fd('0x10'));var as=require(_0xd5fd('0x11'));var hardwareService=require(_0xd5fd('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd5fd('0x13'));var config=require(_0xd5fd('0x14'));var db=require(_0xd5fd('0x15'))['db'];config[_0xd5fd('0x16')]=_[_0xd5fd('0x17')](config[_0xd5fd('0x16')],{'host':_0xd5fd('0x18'),'port':0x18eb});var socket=require(_0xd5fd('0x19'))(new Redis(config[_0xd5fd('0x16')]));require(_0xd5fd('0x1a'))['register'](socket);function respondWithStatusCode(_0x101e7c,_0x70552a){_0x70552a=_0x70552a||0xcc;return function(_0x35b4ef){if(_0x35b4ef){return _0x101e7c['sendStatus'](_0x70552a);}return _0x101e7c[_0xd5fd('0x1b')](_0x70552a)[_0xd5fd('0x1c')]();};}function respondWithResult(_0x46cf72,_0x57b7e5){_0x57b7e5=_0x57b7e5||0xc8;return function(_0x360dd1){if(_0x360dd1){return _0x46cf72[_0xd5fd('0x1b')](_0x57b7e5)[_0xd5fd('0x1d')](_0x360dd1);}};}function respondWithFilteredResult(_0x2bbe59,_0x1a9816){return function(_0x209625){if(_0x209625){var _0x3171a2=_0x209625[_0xd5fd('0x1e')],_0x3d32d3=_0x1a9816[_0xd5fd('0x1f')],_0x2169dd=_0x1a9816[_0xd5fd('0x1f')]+_0x1a9816['limit'],_0x5c52ff;if(_0x2169dd>=_0x3171a2){_0x2169dd=_0x3171a2;_0x5c52ff=0xc8;}else{_0x5c52ff=0xce;}_0x2bbe59[_0xd5fd('0x1b')](_0x5c52ff);return _0x2bbe59[_0xd5fd('0x20')](_0xd5fd('0x21'),_0x3d32d3+'-'+_0x2169dd+'/'+_0x3171a2)[_0xd5fd('0x1d')](_0x209625);}return null;};}function patchUpdates(_0x393a4a){return function(_0x5d636b){try{jsonpatch[_0xd5fd('0x22')](_0x5d636b,_0x393a4a,!![]);}catch(_0x3adac0){return BPromise[_0xd5fd('0x23')](_0x3adac0);}return _0x5d636b[_0xd5fd('0x24')]();};}function saveUpdates(_0x387fe0,_0x2eadd9){return function(_0x40ef47){if(_0x40ef47){return _0x40ef47[_0xd5fd('0x25')](_0x387fe0)[_0xd5fd('0x26')](function(_0x224a5c){return _0x224a5c;});}return null;};}function removeEntity(_0x20a445,_0x20a5e8){return function(_0x87919b){if(_0x87919b){return _0x87919b[_0xd5fd('0x27')]()['then'](function(){var _0x375edd=_0x87919b[_0xd5fd('0x28')]({'plain':!![]});var _0x5e4cb8=_0xd5fd('0x29');return db[_0xd5fd('0x2a')][_0xd5fd('0x27')]({'where':{'type':_0x5e4cb8,'resourceId':_0x375edd['id']}})[_0xd5fd('0x26')](function(){return _0x87919b;});})[_0xd5fd('0x26')](function(){_0x20a445['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x354f27,_0x33861c){return function(_0x2a0850){if(!_0x2a0850){_0x354f27[_0xd5fd('0x2b')](0x194);}return _0x2a0850;};}function handleError(_0x39a97a,_0x30b293){_0x30b293=_0x30b293||0x1f4;return function(_0x37bfde){logger[_0xd5fd('0x2c')](_0x37bfde[_0xd5fd('0x2d')]);if(_0x37bfde['name']){delete _0x37bfde[_0xd5fd('0x2e')];}_0x39a97a[_0xd5fd('0x1b')](_0x30b293)[_0xd5fd('0x2f')](_0x37bfde);};}exports[_0xd5fd('0x30')]=function(_0x3cee8f,_0x46796a){var _0x2a2e57={},_0x374e5b={},_0x370d3b={'count':0x0,'rows':[]};var _0x133450=_['map'](db[_0xd5fd('0x31')][_0xd5fd('0x32')],function(_0x2a9f94){return{'name':_0x2a9f94[_0xd5fd('0x33')],'type':_0x2a9f94[_0xd5fd('0x34')][_0xd5fd('0x35')]};});_0x374e5b[_0xd5fd('0x36')]=_['map'](_0x133450,_0xd5fd('0x2e'));_0x374e5b[_0xd5fd('0x37')]=_[_0xd5fd('0x38')](_0x3cee8f[_0xd5fd('0x37')]);_0x374e5b[_0xd5fd('0x39')]=_['intersection'](_0x374e5b[_0xd5fd('0x36')],_0x374e5b['query']);_0x2a2e57[_0xd5fd('0x3a')]=_[_0xd5fd('0x3b')](_0x374e5b[_0xd5fd('0x36')],qs[_0xd5fd('0x3c')](_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x3c')]));_0x2a2e57[_0xd5fd('0x3a')]=_0x2a2e57['attributes']['length']?_0x2a2e57[_0xd5fd('0x3a')]:_0x374e5b[_0xd5fd('0x36')];if(!_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x3d')](_0xd5fd('0x3e'))){_0x2a2e57[_0xd5fd('0x3f')]=qs[_0xd5fd('0x3f')](_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x3f')]);_0x2a2e57[_0xd5fd('0x1f')]=qs[_0xd5fd('0x1f')](_0x3cee8f['query'][_0xd5fd('0x1f')]);}_0x2a2e57[_0xd5fd('0x40')]=qs[_0xd5fd('0x41')](_0x3cee8f['query'][_0xd5fd('0x41')]);_0x2a2e57['where']=qs[_0xd5fd('0x39')](_[_0xd5fd('0x42')](_0x3cee8f[_0xd5fd('0x37')],_0x374e5b[_0xd5fd('0x39')]),_0x133450);if(_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x43')]){_0x2a2e57[_0xd5fd('0x44')]=_[_0xd5fd('0x45')](_0x2a2e57[_0xd5fd('0x44')],{'$or':_[_0xd5fd('0x46')](_0x133450,function(_0xef38d4){if(_0xef38d4['type']!==_0xd5fd('0x47')){var _0xae1248={};_0xae1248[_0xef38d4[_0xd5fd('0x2e')]]={'$like':'%'+_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x43')]+'%'};return _0xae1248;}})});}_0x2a2e57=_[_0xd5fd('0x45')]({},_0x2a2e57,_0x3cee8f[_0xd5fd('0x48')]);var _0x16aa54={'where':_0x2a2e57[_0xd5fd('0x44')]};return db[_0xd5fd('0x31')][_0xd5fd('0x1e')](_0x16aa54)['then'](function(_0x31d1eb){_0x370d3b[_0xd5fd('0x1e')]=_0x31d1eb;if(_0x3cee8f[_0xd5fd('0x37')][_0xd5fd('0x49')]){_0x2a2e57[_0xd5fd('0x4a')]=[{'all':!![]}];}return db['VoicePrefix'][_0xd5fd('0x4b')](_0x2a2e57);})[_0xd5fd('0x26')](function(_0x319c0b){_0x370d3b[_0xd5fd('0x4c')]=_0x319c0b;return _0x370d3b;})[_0xd5fd('0x26')](respondWithFilteredResult(_0x46796a,_0x2a2e57))[_0xd5fd('0x4d')](handleError(_0x46796a,null));};exports[_0xd5fd('0x4e')]=function(_0x12d826,_0x1b39d2){var _0x3af64e={'raw':![],'where':{'id':_0x12d826['params']['id']}},_0xaa5bd1={};_0xaa5bd1[_0xd5fd('0x36')]=_[_0xd5fd('0x38')](db['VoicePrefix'][_0xd5fd('0x32')]);_0xaa5bd1[_0xd5fd('0x37')]=_[_0xd5fd('0x38')](_0x12d826[_0xd5fd('0x37')]);_0xaa5bd1['filters']=_[_0xd5fd('0x3b')](_0xaa5bd1[_0xd5fd('0x36')],_0xaa5bd1[_0xd5fd('0x37')]);_0x3af64e[_0xd5fd('0x3a')]=_[_0xd5fd('0x3b')](_0xaa5bd1[_0xd5fd('0x36')],qs['fields'](_0x12d826[_0xd5fd('0x37')][_0xd5fd('0x3c')]));_0x3af64e[_0xd5fd('0x3a')]=_0x3af64e[_0xd5fd('0x3a')][_0xd5fd('0x4f')]?_0x3af64e['attributes']:_0xaa5bd1[_0xd5fd('0x36')];if(_0x12d826[_0xd5fd('0x37')][_0xd5fd('0x49')]){_0x3af64e[_0xd5fd('0x4a')]=[{'all':!![]}];}_0x3af64e=_[_0xd5fd('0x45')]({},_0x3af64e,_0x12d826['options']);return db[_0xd5fd('0x31')]['find'](_0x3af64e)[_0xd5fd('0x26')](handleEntityNotFound(_0x1b39d2,null))[_0xd5fd('0x26')](respondWithResult(_0x1b39d2,null))[_0xd5fd('0x4d')](handleError(_0x1b39d2,null));};exports[_0xd5fd('0x27')]=function(_0x1c4a07,_0x201c24){return db[_0xd5fd('0x31')][_0xd5fd('0x50')]({'where':{'id':_0x1c4a07[_0xd5fd('0x51')]['id']}})[_0xd5fd('0x26')](handleEntityNotFound(_0x201c24,null))[_0xd5fd('0x26')](removeEntity(_0x201c24,null))[_0xd5fd('0x4d')](handleError(_0x201c24,null));};exports[_0xd5fd('0x52')]=function(_0x21dc13,_0x1bee4c){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x1bee4c,null))[_0xd5fd('0x4d')](handleError(_0x1bee4c,null));};exports[_0xd5fd('0x53')]=function(_0x32db52,_0x2a0a28){var _0x464e31;return db['sequelize']['transaction'](function(_0xd3da7f){return db[_0xd5fd('0x31')][_0xd5fd('0x53')](_0x32db52[_0xd5fd('0x54')],{'transaction':_0xd3da7f})[_0xd5fd('0x26')](function(_0x62cbe3){_0x464e31=_0x62cbe3[_0xd5fd('0x28')]({'plain':!![]});return db[_0xd5fd('0x55')][_0xd5fd('0x50')]({'where':{'id':_0x464e31['VoiceExtensionId']},'raw':!![]})['then'](function(_0xcbb68f){return createVoicePrefixExtensions(_0x464e31,_0xcbb68f,_0xd3da7f);});});})['then'](function(){var _0x1ea628=_0x32db52['user']['get']({'plain':!![]});if(!_0x1ea628)throw new Error(_0xd5fd('0x56'));if(_0x1ea628[_0xd5fd('0x57')]===_0xd5fd('0x58')){var _0x44ee16=_0x464e31;return db['UserProfileSection']['find']({'where':{'name':_0xd5fd('0x29'),'userProfileId':_0x1ea628['userProfileId']},'raw':!![]})[_0xd5fd('0x26')](function(_0x24fe8f){if(_0x24fe8f&&_0x24fe8f[_0xd5fd('0x59')]===0x0){return db[_0xd5fd('0x2a')][_0xd5fd('0x53')]({'name':_0x44ee16[_0xd5fd('0x2e')],'resourceId':_0x44ee16['id'],'type':_0x24fe8f[_0xd5fd('0x2e')],'sectionId':_0x24fe8f['id']},{})[_0xd5fd('0x26')](function(){return _0x464e31;});}else{return _0x464e31;}})[_0xd5fd('0x4d')](function(_0x23793a){logger[_0xd5fd('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23793a);throw _0x23793a;});}return _0x464e31;})[_0xd5fd('0x26')](respondWithResult(_0x2a0a28,null))[_0xd5fd('0x4d')](handleError(_0x2a0a28,null));};function Extension(_0x42c41d,_0x367f8f,_0x211cae,_0x36f735){this[_0xd5fd('0x5a')]='from-sip';this[_0xd5fd('0x5b')]=_0x42c41d;this['app']=_0x211cae;this[_0xd5fd('0x34')]=_0xd5fd('0x5c');this[_0xd5fd('0x5d')]=_0xd5fd('0x5e');this[_0xd5fd('0x5f')]=_0x367f8f;this[_0xd5fd('0x60')]=_0x36f735;}function createVoicePrefixExtensions(_0x40ea21,_0x2e36c0,_0x5d6d66){return new BPromise(function(_0x455fd4,_0x569e0f){var _0x4bba62=new Extension(formatPrefixName(_0x40ea21['prefix']),0x1,_0xd5fd('0x61'),_0xd5fd('0x62'));_0x4bba62[_0xd5fd('0x63')]=_0x40ea21['id'];return db['VoiceExtension'][_0xd5fd('0x53')](_0x4bba62,{'transaction':_0x5d6d66})[_0xd5fd('0x26')](function(_0x38af37){var _0x7f94a2=_0x38af37['get']({'plain':!![]});var _0x1232e3=_[_0xd5fd('0x46')](addVoicePrefixExtensions(_0x40ea21,_0x2e36c0),function(_0x3779d4){_0x3779d4[_0xd5fd('0x64')]=_0x7f94a2['id'];_0x3779d4[_0xd5fd('0x63')]=_0x40ea21['id'];return _0x3779d4;});return db[_0xd5fd('0x55')][_0xd5fd('0x65')](_0x1232e3,{'transaction':_0x5d6d66})[_0xd5fd('0x26')](function(_0x3b8b09){if(!_0x3b8b09){return _0x569e0f(_0xd5fd('0x66'));}else{return _0x455fd4(_0x3b8b09);}})[_0xd5fd('0x4d')](function(_0xa2cecc){return _0x569e0f(_0xa2cecc);});});;});};function addVoicePrefixExtensions(_0x51f5b8,_0x307cfa){var _0x4bc281=[];var _0x5ceaf3=formatPrefixName(_0x51f5b8[_0xd5fd('0x67')]);_0x4bc281[_0xd5fd('0x68')](new Extension(_0x5ceaf3,0x2,_0xd5fd('0x69'),'CDR(prefix)='+_0x51f5b8[_0xd5fd('0x2e')]));if(_0x51f5b8[_0xd5fd('0x6a')]){_0x4bc281[_0xd5fd('0x68')](new Extension(_0x5ceaf3,0x3,_0xd5fd('0x69'),_0xd5fd('0x6b')+_0x51f5b8[_0xd5fd('0x6a')]));}else{_0x4bc281[_0xd5fd('0x68')](new Extension(_0x5ceaf3,0x3,'NoOp',_0xd5fd('0x6c')));}_0x4bc281[_0xd5fd('0x68')](new Extension(_0x5ceaf3,0x4,_0xd5fd('0x6d'),_0x307cfa[_0xd5fd('0x5a')]+','+_0xd5fd('0x6e')+(0x8+_0x51f5b8[_0xd5fd('0x2e')][_0xd5fd('0x4f')])+'}'+','+0x1));return _0x4bc281;}function formatPrefixName(_0xc4b21b){var _0x4c7617='_';for(var _0xf202d5=0x0;_0xf202d5<_0xc4b21b[_0xd5fd('0x4f')];_0xf202d5++){if(_0xc4b21b[_0xd5fd('0x6f')](_0xf202d5)=='-'){_0x4c7617+=_0xc4b21b[_0xd5fd('0x6f')](_0xf202d5);}else{_0x4c7617+='['+_0xc4b21b[_0xd5fd('0x6f')](_0xf202d5)+']';}}_0x4c7617+='.';return _0x4c7617;}exports[_0xd5fd('0x25')]=function(_0x5615a0,_0x34ba2e,_0x20691e){var _0x5d0db6=_0x5615a0[_0xd5fd('0x54')];_0x5d0db6['prefix']=_0xd5fd('0x70')+_0x5d0db6[_0xd5fd('0x2e')]+'-';return db[_0xd5fd('0x71')][_0xd5fd('0x72')](function(_0x330b1f){return db[_0xd5fd('0x31')]['update'](_0x5d0db6,{'where':{'id':_0x5d0db6['id']},'transaction':_0x330b1f})[_0xd5fd('0x26')](function(){return db['VoiceExtension'][_0xd5fd('0x27')]({'where':{'VoicePrefixId':_0x5d0db6['id']},'transaction':_0x330b1f})[_0xd5fd('0x26')](function(){return db[_0xd5fd('0x55')][_0xd5fd('0x50')]({'where':{'id':_0x5d0db6['VoiceExtensionId']},'raw':!![]})[_0xd5fd('0x26')](function(_0x3ae5f5){return createVoicePrefixExtensions(_0x5d0db6,_0x3ae5f5,_0x330b1f);});});});})[_0xd5fd('0x26')](function(){return db[_0xd5fd('0x31')][_0xd5fd('0x73')](_0x5d0db6['id']);})[_0xd5fd('0x26')](respondWithResult(_0x34ba2e,null))[_0xd5fd('0x4d')](handleError(_0x34ba2e,null));};exports[_0xd5fd('0x74')]=function(_0x3a14b2,_0x4b49ae,_0x1c5651){return db[_0xd5fd('0x31')]['find']({'where':{'id':_0x3a14b2['params']['id']}})[_0xd5fd('0x26')](handleEntityNotFound(_0x4b49ae,null))[_0xd5fd('0x26')](function(_0x17d176){if(_0x17d176){return _0x17d176[_0xd5fd('0x74')](_0x3a14b2[_0xd5fd('0x54')][_0xd5fd('0x75')],_[_0xd5fd('0x76')](_0x3a14b2[_0xd5fd('0x54')],[_0xd5fd('0x75'),'id'])||{})[_0xd5fd('0x77')](function(_0x2f7b20){for(var _0x22e471=0x0;_0x22e471<_0x3a14b2[_0xd5fd('0x54')][_0xd5fd('0x75')]['length'];_0x22e471+=0x1){socket['emit'](_0xd5fd('0x78'),{'UserId':_0x3a14b2[_0xd5fd('0x54')]['ids'][_0x22e471],'VoicePrefixId':_0x3a14b2[_0xd5fd('0x51')]['id']});}return _0x2f7b20;});}})[_0xd5fd('0x26')](respondWithResult(_0x4b49ae,null))[_0xd5fd('0x4d')](handleError(_0x4b49ae,null));};exports[_0xd5fd('0x79')]=function(_0x29d22b,_0x33affb,_0x44a8b4){return db[_0xd5fd('0x31')][_0xd5fd('0x50')]({'where':{'id':_0x29d22b[_0xd5fd('0x51')]['id']}})['then'](handleEntityNotFound(_0x33affb,null))['then'](function(_0x5015f5){if(_0x5015f5){return _0x5015f5[_0xd5fd('0x79')](_0x29d22b[_0xd5fd('0x37')][_0xd5fd('0x75')])[_0xd5fd('0x26')](function(){if(_['isArray'](_0x29d22b[_0xd5fd('0x37')][_0xd5fd('0x75')])){for(var _0x5c51d8=0x0;_0x5c51d8<_0x29d22b[_0xd5fd('0x37')]['ids'][_0xd5fd('0x4f')];_0x5c51d8+=0x1){socket[_0xd5fd('0x7a')](_0xd5fd('0x7b'),{'UserId':Number(_0x29d22b[_0xd5fd('0x37')][_0xd5fd('0x75')][_0x5c51d8]),'VoicePrefixId':Number(_0x29d22b[_0xd5fd('0x51')]['id'])});}}else{socket['emit'](_0xd5fd('0x7b'),{'UserId':Number(_0x29d22b[_0xd5fd('0x37')][_0xd5fd('0x75')]),'VoicePrefixId':Number(_0x29d22b[_0xd5fd('0x51')]['id'])});}});}})[_0xd5fd('0x26')](respondWithStatusCode(_0x33affb,null))[_0xd5fd('0x4d')](handleError(_0x33affb,null));};exports['getAgents']=function(_0x46f9d6,_0x28b83c,_0x3833d9){var _0x492770={};var _0x449084={};var _0x2d2f8f;var _0x5c7daf;return db[_0xd5fd('0x31')][_0xd5fd('0x7c')]({'where':{'id':_0x46f9d6[_0xd5fd('0x51')]['id']}})[_0xd5fd('0x26')](handleEntityNotFound(_0x28b83c,null))[_0xd5fd('0x26')](function(_0x4a7939){if(_0x4a7939){_0x2d2f8f=_0x4a7939;_0x449084[_0xd5fd('0x36')]=_[_0xd5fd('0x38')](db[_0xd5fd('0x7d')]['rawAttributes']);_0x449084[_0xd5fd('0x37')]=_[_0xd5fd('0x38')](_0x46f9d6[_0xd5fd('0x37')]);_0x449084[_0xd5fd('0x39')]=_[_0xd5fd('0x3b')](_0x449084[_0xd5fd('0x36')],_0x449084['query']);_0x492770[_0xd5fd('0x3a')]=_[_0xd5fd('0x3b')](_0x449084[_0xd5fd('0x36')],qs[_0xd5fd('0x3c')](_0x46f9d6['query'][_0xd5fd('0x3c')]));_0x492770['attributes']=_0x492770[_0xd5fd('0x3a')][_0xd5fd('0x4f')]?_0x492770[_0xd5fd('0x3a')]:_0x449084[_0xd5fd('0x36')];_0x492770[_0xd5fd('0x40')]=qs[_0xd5fd('0x41')](_0x46f9d6['query']['sort']);_0x492770[_0xd5fd('0x44')]=qs['filters'](_[_0xd5fd('0x42')](_0x46f9d6['query'],_0x449084[_0xd5fd('0x39')]));if(_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x43')]){_0x492770[_0xd5fd('0x44')]=_[_0xd5fd('0x45')](_0x492770[_0xd5fd('0x44')],{'$or':_['map'](_0x492770[_0xd5fd('0x3a')],function(_0x11f721){var _0x5cf5af={};_0x5cf5af[_0x11f721]={'$like':'%'+_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x43')]+'%'};return _0x5cf5af;})});}_0x492770=_[_0xd5fd('0x45')]({},_0x492770,_0x46f9d6[_0xd5fd('0x48')]);return _0x2d2f8f[_0xd5fd('0x7e')](_0x492770);}})[_0xd5fd('0x26')](function(_0x23e87b){if(_0x23e87b){_0x5c7daf=_0x23e87b[_0xd5fd('0x4f')];if(!_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x3d')](_0xd5fd('0x3e'))){_0x492770[_0xd5fd('0x3f')]=qs[_0xd5fd('0x3f')](_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x3f')]);_0x492770['offset']=qs[_0xd5fd('0x1f')](_0x46f9d6[_0xd5fd('0x37')][_0xd5fd('0x1f')]);}return _0x2d2f8f['getAgents'](_0x492770);}})[_0xd5fd('0x26')](function(_0x38f342){if(_0x38f342){return _0x38f342?{'count':_0x5c7daf,'rows':_0x38f342}:null;}})[_0xd5fd('0x26')](respondWithResult(_0x28b83c,null))[_0xd5fd('0x4d')](handleError(_0x28b83c,null));}; \ No newline at end of file +var _0x0132=['pick','merge','type','VIRTUAL','options','VoicePrefix','count','include','findAll','catch','params','keys','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','length','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','order','filter','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','defaults','redis','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','sort','where'];(function(_0x7e544f,_0x111b3a){var _0x2c628c=function(_0x35ef8a){while(--_0x35ef8a){_0x7e544f['push'](_0x7e544f['shift']());}};_0x2c628c(++_0x111b3a);}(_0x0132,0x1ba));var _0x2013=function(_0x3ba642,_0x5a1f17){_0x3ba642=_0x3ba642-0x0;var _0x296bb6=_0x0132[_0x3ba642];return _0x296bb6;};'use strict';var pdf=require(_0x2013('0x0'));var emlformat=require(_0x2013('0x1'));var rimraf=require(_0x2013('0x2'));var zipdir=require(_0x2013('0x3'));var jsonpatch=require(_0x2013('0x4'));var rp=require(_0x2013('0x5'));var moment=require(_0x2013('0x6'));var BPromise=require(_0x2013('0x7'));var Mustache=require(_0x2013('0x8'));var util=require('util');var path=require(_0x2013('0x9'));var sox=require(_0x2013('0xa'));var csv=require(_0x2013('0xb'));var ejs=require(_0x2013('0xc'));var fs=require('fs');var _=require(_0x2013('0xd'));var squel=require('squel');var crypto=require(_0x2013('0xe'));var jsforce=require(_0x2013('0xf'));var deskjs=require(_0x2013('0x10'));var toCsv=require(_0x2013('0xb'));var querystring=require(_0x2013('0x11'));var Papa=require(_0x2013('0x12'));var Redis=require(_0x2013('0x13'));var authService=require(_0x2013('0x14'));var qs=require(_0x2013('0x15'));var as=require(_0x2013('0x16'));var hardwareService=require(_0x2013('0x17'));var logger=require(_0x2013('0x18'))(_0x2013('0x19'));var utils=require('../../config/utils');var config=require(_0x2013('0x1a'));var db=require(_0x2013('0x1b'))['db'];config['redis']=_[_0x2013('0x1c')](config[_0x2013('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x2013('0x1e'))(new Redis(config['redis']));require(_0x2013('0x1f'))['register'](socket);function respondWithStatusCode(_0x1f1c30,_0x3ab4ee){_0x3ab4ee=_0x3ab4ee||0xcc;return function(_0xcfd3a6){if(_0xcfd3a6){return _0x1f1c30[_0x2013('0x20')](_0x3ab4ee);}return _0x1f1c30[_0x2013('0x21')](_0x3ab4ee)[_0x2013('0x22')]();};}function respondWithResult(_0x23d5f0,_0x164f4c){_0x164f4c=_0x164f4c||0xc8;return function(_0x4c06e7){if(_0x4c06e7){return _0x23d5f0[_0x2013('0x21')](_0x164f4c)[_0x2013('0x23')](_0x4c06e7);}};}function respondWithFilteredResult(_0x2db740,_0x1a0c47){return function(_0x4ece1a){if(_0x4ece1a){var _0x553599=_0x4ece1a['count'],_0x1e50a7=_0x1a0c47['offset'],_0x444b34=_0x1a0c47['offset']+_0x1a0c47[_0x2013('0x24')],_0x3b85db;if(_0x444b34>=_0x553599){_0x444b34=_0x553599;_0x3b85db=0xc8;}else{_0x3b85db=0xce;}_0x2db740[_0x2013('0x21')](_0x3b85db);return _0x2db740['set'](_0x2013('0x25'),_0x1e50a7+'-'+_0x444b34+'/'+_0x553599)[_0x2013('0x23')](_0x4ece1a);}return null;};}function patchUpdates(_0x2109c1){return function(_0x4ce84c){try{jsonpatch[_0x2013('0x26')](_0x4ce84c,_0x2109c1,!![]);}catch(_0x3ba15c){return BPromise[_0x2013('0x27')](_0x3ba15c);}return _0x4ce84c[_0x2013('0x28')]();};}function saveUpdates(_0x5d05e9,_0x3ef1b6){return function(_0x2986f7){if(_0x2986f7){return _0x2986f7[_0x2013('0x29')](_0x5d05e9)[_0x2013('0x2a')](function(_0x3ba5fc){return _0x3ba5fc;});}return null;};}function removeEntity(_0x27b3e8,_0x2a49c8){return function(_0x5ac771){if(_0x5ac771){return _0x5ac771[_0x2013('0x2b')]()[_0x2013('0x2a')](function(){var _0x18c501=_0x5ac771[_0x2013('0x2c')]({'plain':!![]});var _0x3cabeb=_0x2013('0x2d');return db[_0x2013('0x2e')][_0x2013('0x2b')]({'where':{'type':_0x3cabeb,'resourceId':_0x18c501['id']}})['then'](function(){return _0x5ac771;});})['then'](function(){_0x27b3e8['status'](0xcc)[_0x2013('0x22')]();});}};}function handleEntityNotFound(_0x50bcc6,_0x463d88){return function(_0x469290){if(!_0x469290){_0x50bcc6[_0x2013('0x20')](0x194);}return _0x469290;};}function handleError(_0x5a4491,_0x20864c){_0x20864c=_0x20864c||0x1f4;return function(_0xf898d8){logger[_0x2013('0x2f')](_0xf898d8[_0x2013('0x30')]);if(_0xf898d8[_0x2013('0x31')]){delete _0xf898d8['name'];}_0x5a4491[_0x2013('0x21')](_0x20864c)['send'](_0xf898d8);};}exports[_0x2013('0x32')]=function(_0x43526b,_0x3ca397){var _0x4f4959={},_0x414e42={},_0x2aca9b={'count':0x0,'rows':[]};var _0xd721e1=_[_0x2013('0x33')](db['VoicePrefix'][_0x2013('0x34')],function(_0x19488c){return{'name':_0x19488c[_0x2013('0x35')],'type':_0x19488c['type'][_0x2013('0x36')]};});_0x414e42[_0x2013('0x37')]=_['map'](_0xd721e1,_0x2013('0x31'));_0x414e42[_0x2013('0x38')]=_['keys'](_0x43526b[_0x2013('0x38')]);_0x414e42[_0x2013('0x39')]=_['intersection'](_0x414e42[_0x2013('0x37')],_0x414e42[_0x2013('0x38')]);_0x4f4959[_0x2013('0x3a')]=_[_0x2013('0x3b')](_0x414e42[_0x2013('0x37')],qs[_0x2013('0x3c')](_0x43526b[_0x2013('0x38')][_0x2013('0x3c')]));_0x4f4959[_0x2013('0x3a')]=_0x4f4959[_0x2013('0x3a')]['length']?_0x4f4959[_0x2013('0x3a')]:_0x414e42['model'];if(!_0x43526b['query'][_0x2013('0x3d')](_0x2013('0x3e'))){_0x4f4959[_0x2013('0x24')]=qs[_0x2013('0x24')](_0x43526b['query'][_0x2013('0x24')]);_0x4f4959[_0x2013('0x3f')]=qs['offset'](_0x43526b[_0x2013('0x38')][_0x2013('0x3f')]);}_0x4f4959['order']=qs[_0x2013('0x40')](_0x43526b[_0x2013('0x38')][_0x2013('0x40')]);_0x4f4959[_0x2013('0x41')]=qs['filters'](_[_0x2013('0x42')](_0x43526b['query'],_0x414e42[_0x2013('0x39')]),_0xd721e1);if(_0x43526b['query']['filter']){_0x4f4959[_0x2013('0x41')]=_[_0x2013('0x43')](_0x4f4959['where'],{'$or':_[_0x2013('0x33')](_0xd721e1,function(_0x4a7950){if(_0x4a7950[_0x2013('0x44')]!==_0x2013('0x45')){var _0x5509e7={};_0x5509e7[_0x4a7950[_0x2013('0x31')]]={'$like':'%'+_0x43526b['query']['filter']+'%'};return _0x5509e7;}})});}_0x4f4959=_[_0x2013('0x43')]({},_0x4f4959,_0x43526b[_0x2013('0x46')]);var _0x563f43={'where':_0x4f4959[_0x2013('0x41')]};return db[_0x2013('0x47')][_0x2013('0x48')](_0x563f43)[_0x2013('0x2a')](function(_0xd826f9){_0x2aca9b[_0x2013('0x48')]=_0xd826f9;if(_0x43526b['query']['includeAll']){_0x4f4959[_0x2013('0x49')]=[{'all':!![]}];}return db[_0x2013('0x47')][_0x2013('0x4a')](_0x4f4959);})[_0x2013('0x2a')](function(_0x44422a){_0x2aca9b['rows']=_0x44422a;return _0x2aca9b;})[_0x2013('0x2a')](respondWithFilteredResult(_0x3ca397,_0x4f4959))[_0x2013('0x4b')](handleError(_0x3ca397,null));};exports['show']=function(_0x421489,_0x40c760){var _0x2c6e5d={'raw':![],'where':{'id':_0x421489[_0x2013('0x4c')]['id']}},_0x55f013={};_0x55f013[_0x2013('0x37')]=_[_0x2013('0x4d')](db[_0x2013('0x47')][_0x2013('0x34')]);_0x55f013['query']=_['keys'](_0x421489[_0x2013('0x38')]);_0x55f013['filters']=_[_0x2013('0x3b')](_0x55f013[_0x2013('0x37')],_0x55f013['query']);_0x2c6e5d[_0x2013('0x3a')]=_['intersection'](_0x55f013[_0x2013('0x37')],qs['fields'](_0x421489[_0x2013('0x38')]['fields']));_0x2c6e5d[_0x2013('0x3a')]=_0x2c6e5d[_0x2013('0x3a')]['length']?_0x2c6e5d[_0x2013('0x3a')]:_0x55f013['model'];if(_0x421489[_0x2013('0x38')][_0x2013('0x4e')]){_0x2c6e5d[_0x2013('0x49')]=[{'all':!![]}];}_0x2c6e5d=_['merge']({},_0x2c6e5d,_0x421489['options']);return db[_0x2013('0x47')][_0x2013('0x4f')](_0x2c6e5d)[_0x2013('0x2a')](handleEntityNotFound(_0x40c760,null))[_0x2013('0x2a')](respondWithResult(_0x40c760,null))[_0x2013('0x4b')](handleError(_0x40c760,null));};exports['destroy']=function(_0x5add00,_0x4e99db){return db[_0x2013('0x47')][_0x2013('0x4f')]({'where':{'id':_0x5add00[_0x2013('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e99db,null))[_0x2013('0x2a')](removeEntity(_0x4e99db,null))[_0x2013('0x4b')](handleError(_0x4e99db,null));};exports[_0x2013('0x50')]=function(_0x328bc2,_0x11b7c3){return db[_0x2013('0x47')][_0x2013('0x50')]()[_0x2013('0x2a')](respondWithResult(_0x11b7c3,null))['catch'](handleError(_0x11b7c3,null));};exports[_0x2013('0x51')]=function(_0x5a1b40,_0x243dc5){var _0x16adf8;return db[_0x2013('0x52')][_0x2013('0x53')](function(_0x50fb9a){return db[_0x2013('0x47')][_0x2013('0x51')](_0x5a1b40[_0x2013('0x54')],{'transaction':_0x50fb9a})[_0x2013('0x2a')](function(_0x150371){_0x16adf8=_0x150371[_0x2013('0x2c')]({'plain':!![]});return db[_0x2013('0x55')][_0x2013('0x4f')]({'where':{'id':_0x16adf8[_0x2013('0x56')]},'raw':!![]})['then'](function(_0x47200a){return createVoicePrefixExtensions(_0x16adf8,_0x47200a,_0x50fb9a);});});})[_0x2013('0x2a')](function(){var _0x3e49bb=_0x5a1b40['user']['get']({'plain':!![]});if(!_0x3e49bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e49bb[_0x2013('0x57')]===_0x2013('0x58')){var _0x246b4f=_0x16adf8;return db[_0x2013('0x59')]['find']({'where':{'name':_0x2013('0x2d'),'userProfileId':_0x3e49bb[_0x2013('0x5a')]},'raw':!![]})[_0x2013('0x2a')](function(_0x5dc881){if(_0x5dc881&&_0x5dc881[_0x2013('0x5b')]===0x0){return db[_0x2013('0x2e')][_0x2013('0x51')]({'name':_0x246b4f['name'],'resourceId':_0x246b4f['id'],'type':_0x5dc881[_0x2013('0x31')],'sectionId':_0x5dc881['id']},{})[_0x2013('0x2a')](function(){return _0x16adf8;});}else{return _0x16adf8;}})['catch'](function(_0x3db572){logger[_0x2013('0x2f')](_0x2013('0x5c'),_0x3db572);throw _0x3db572;});}return _0x16adf8;})[_0x2013('0x2a')](respondWithResult(_0x243dc5,null))['catch'](handleError(_0x243dc5,null));};function Extension(_0x156b56,_0x4836f4,_0x32876f,_0x5828d3){this[_0x2013('0x5d')]=_0x2013('0x5e');this[_0x2013('0x5f')]=_0x156b56;this[_0x2013('0x60')]=_0x32876f;this[_0x2013('0x44')]='system';this['description']=_0x2013('0x61');this[_0x2013('0x62')]=_0x4836f4;this[_0x2013('0x63')]=_0x5828d3;}function createVoicePrefixExtensions(_0x1e8b61,_0xfefcc2,_0x14e155){return new BPromise(function(_0xcbb22f,_0x457c23){var _0x4f0794=new Extension(formatPrefixName(_0x1e8b61[_0x2013('0x64')]),0x1,_0x2013('0x65'),_0x2013('0x66'));_0x4f0794['VoicePrefixId']=_0x1e8b61['id'];return db[_0x2013('0x55')][_0x2013('0x51')](_0x4f0794,{'transaction':_0x14e155})['then'](function(_0x42ce2e){var _0x5b9348=_0x42ce2e[_0x2013('0x2c')]({'plain':!![]});var _0x19c392=_[_0x2013('0x33')](addVoicePrefixExtensions(_0x1e8b61,_0xfefcc2),function(_0x2342ae){_0x2342ae[_0x2013('0x56')]=_0x5b9348['id'];_0x2342ae[_0x2013('0x67')]=_0x1e8b61['id'];return _0x2342ae;});return db[_0x2013('0x55')][_0x2013('0x68')](_0x19c392,{'transaction':_0x14e155})[_0x2013('0x2a')](function(_0x1e88f8){if(!_0x1e88f8){return _0x457c23(_0x2013('0x69'));}else{return _0xcbb22f(_0x1e88f8);}})[_0x2013('0x4b')](function(_0x108db3){return _0x457c23(_0x108db3);});});;});};function addVoicePrefixExtensions(_0x52adb6,_0x3fa2e2){var _0x55c7f3=[];var _0xb9801=formatPrefixName(_0x52adb6['prefix']);_0x55c7f3[_0x2013('0x6a')](new Extension(_0xb9801,0x2,_0x2013('0x6b'),'CDR(prefix)='+_0x52adb6[_0x2013('0x31')]));if(_0x52adb6[_0x2013('0x6c')]){_0x55c7f3[_0x2013('0x6a')](new Extension(_0xb9801,0x3,'Set',_0x2013('0x6d')+_0x52adb6[_0x2013('0x6c')]));}else{_0x55c7f3[_0x2013('0x6a')](new Extension(_0xb9801,0x3,'NoOp',_0x2013('0x6e')));}_0x55c7f3['push'](new Extension(_0xb9801,0x4,_0x2013('0x6f'),_0x3fa2e2[_0x2013('0x5d')]+','+'${EXTEN:'+(0x8+_0x52adb6[_0x2013('0x31')][_0x2013('0x70')])+'}'+','+0x1));return _0x55c7f3;}function formatPrefixName(_0x5ec90b){var _0x60c4bf='_';for(var _0x21cacb=0x0;_0x21cacb<_0x5ec90b[_0x2013('0x70')];_0x21cacb++){if(_0x5ec90b['charAt'](_0x21cacb)=='-'){_0x60c4bf+=_0x5ec90b[_0x2013('0x71')](_0x21cacb);}else{_0x60c4bf+='['+_0x5ec90b[_0x2013('0x71')](_0x21cacb)+']';}}_0x60c4bf+='.';return _0x60c4bf;}exports['update']=function(_0x30c955,_0x3a66db,_0x563ff0){var _0x3d2e1a=_0x30c955['body'];_0x3d2e1a[_0x2013('0x64')]=_0x2013('0x72')+_0x3d2e1a[_0x2013('0x31')]+'-';return db[_0x2013('0x52')][_0x2013('0x53')](function(_0x1a6f59){return db[_0x2013('0x47')]['update'](_0x3d2e1a,{'where':{'id':_0x3d2e1a['id']},'transaction':_0x1a6f59})[_0x2013('0x2a')](function(){return db[_0x2013('0x55')][_0x2013('0x2b')]({'where':{'VoicePrefixId':_0x3d2e1a['id']},'transaction':_0x1a6f59})['then'](function(){return db[_0x2013('0x55')]['find']({'where':{'id':_0x3d2e1a['VoiceExtensionId']},'raw':!![]})[_0x2013('0x2a')](function(_0x1bbfa5){return createVoicePrefixExtensions(_0x3d2e1a,_0x1bbfa5,_0x1a6f59);});});});})['then'](function(){return db[_0x2013('0x47')][_0x2013('0x73')](_0x3d2e1a['id']);})[_0x2013('0x2a')](respondWithResult(_0x3a66db,null))[_0x2013('0x4b')](handleError(_0x3a66db,null));};exports[_0x2013('0x74')]=function(_0x4ceccd,_0x6fe59e,_0x291092){return db['VoicePrefix'][_0x2013('0x4f')]({'where':{'id':_0x4ceccd[_0x2013('0x4c')]['id']}})[_0x2013('0x2a')](handleEntityNotFound(_0x6fe59e,null))[_0x2013('0x2a')](function(_0x25fcfb){if(_0x25fcfb){return _0x25fcfb['addAgents'](_0x4ceccd['body']['ids'],_['omit'](_0x4ceccd[_0x2013('0x54')],[_0x2013('0x75'),'id'])||{})[_0x2013('0x76')](function(_0x741643){for(var _0x2f3929=0x0;_0x2f3929<_0x4ceccd['body'][_0x2013('0x75')][_0x2013('0x70')];_0x2f3929+=0x1){socket[_0x2013('0x77')](_0x2013('0x78'),{'UserId':_0x4ceccd[_0x2013('0x54')][_0x2013('0x75')][_0x2f3929],'VoicePrefixId':_0x4ceccd[_0x2013('0x4c')]['id']});}return _0x741643;});}})[_0x2013('0x2a')](respondWithResult(_0x6fe59e,null))[_0x2013('0x4b')](handleError(_0x6fe59e,null));};exports[_0x2013('0x79')]=function(_0x2836f6,_0x1754e3,_0x599d74){return db[_0x2013('0x47')][_0x2013('0x4f')]({'where':{'id':_0x2836f6[_0x2013('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1754e3,null))[_0x2013('0x2a')](function(_0x17f1e0){if(_0x17f1e0){return _0x17f1e0[_0x2013('0x79')](_0x2836f6[_0x2013('0x38')]['ids'])[_0x2013('0x2a')](function(){if(_['isArray'](_0x2836f6[_0x2013('0x38')][_0x2013('0x75')])){for(var _0xa0b564=0x0;_0xa0b564<_0x2836f6[_0x2013('0x38')]['ids'][_0x2013('0x70')];_0xa0b564+=0x1){socket[_0x2013('0x77')](_0x2013('0x7a'),{'UserId':Number(_0x2836f6['query'][_0x2013('0x75')][_0xa0b564]),'VoicePrefixId':Number(_0x2836f6[_0x2013('0x4c')]['id'])});}}else{socket[_0x2013('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x2836f6[_0x2013('0x38')][_0x2013('0x75')]),'VoicePrefixId':Number(_0x2836f6[_0x2013('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1754e3,null))[_0x2013('0x4b')](handleError(_0x1754e3,null));};exports[_0x2013('0x7b')]=function(_0x2cd88b,_0x63e238,_0x320b00){var _0x4be745={};var _0x372357={};var _0x1272dc;var _0x3edebf;return db[_0x2013('0x47')][_0x2013('0x7c')]({'where':{'id':_0x2cd88b['params']['id']}})[_0x2013('0x2a')](handleEntityNotFound(_0x63e238,null))['then'](function(_0x32aa13){if(_0x32aa13){_0x1272dc=_0x32aa13;_0x372357[_0x2013('0x37')]=_[_0x2013('0x4d')](db['User'][_0x2013('0x34')]);_0x372357[_0x2013('0x38')]=_['keys'](_0x2cd88b['query']);_0x372357[_0x2013('0x39')]=_['intersection'](_0x372357[_0x2013('0x37')],_0x372357[_0x2013('0x38')]);_0x4be745[_0x2013('0x3a')]=_[_0x2013('0x3b')](_0x372357[_0x2013('0x37')],qs['fields'](_0x2cd88b[_0x2013('0x38')][_0x2013('0x3c')]));_0x4be745[_0x2013('0x3a')]=_0x4be745['attributes']['length']?_0x4be745[_0x2013('0x3a')]:_0x372357[_0x2013('0x37')];_0x4be745[_0x2013('0x7d')]=qs[_0x2013('0x40')](_0x2cd88b[_0x2013('0x38')][_0x2013('0x40')]);_0x4be745[_0x2013('0x41')]=qs[_0x2013('0x39')](_[_0x2013('0x42')](_0x2cd88b[_0x2013('0x38')],_0x372357[_0x2013('0x39')]));if(_0x2cd88b[_0x2013('0x38')][_0x2013('0x7e')]){_0x4be745[_0x2013('0x41')]=_['merge'](_0x4be745[_0x2013('0x41')],{'$or':_[_0x2013('0x33')](_0x4be745[_0x2013('0x3a')],function(_0x23c7b5){var _0x4f968c={};_0x4f968c[_0x23c7b5]={'$like':'%'+_0x2cd88b[_0x2013('0x38')][_0x2013('0x7e')]+'%'};return _0x4f968c;})});}_0x4be745=_[_0x2013('0x43')]({},_0x4be745,_0x2cd88b[_0x2013('0x46')]);return _0x1272dc[_0x2013('0x7b')](_0x4be745);}})['then'](function(_0x2e5b60){if(_0x2e5b60){_0x3edebf=_0x2e5b60[_0x2013('0x70')];if(!_0x2cd88b['query'][_0x2013('0x3d')](_0x2013('0x3e'))){_0x4be745[_0x2013('0x24')]=qs['limit'](_0x2cd88b[_0x2013('0x38')][_0x2013('0x24')]);_0x4be745[_0x2013('0x3f')]=qs[_0x2013('0x3f')](_0x2cd88b[_0x2013('0x38')]['offset']);}return _0x1272dc[_0x2013('0x7b')](_0x4be745);}})[_0x2013('0x2a')](function(_0x1741b8){if(_0x1741b8){return _0x1741b8?{'count':_0x3edebf,'rows':_0x1741b8}:null;}})[_0x2013('0x2a')](respondWithResult(_0x63e238,null))[_0x2013('0x4b')](handleError(_0x63e238,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 27f822a..4eab708 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x2482ba,_0x564210){var _0x409a90=function(_0xa47d7e){while(--_0xa47d7e){_0x2482ba['push'](_0x2482ba['shift']());}};_0x409a90(++_0x564210);}(_0x008c,0x188));var _0xc008=function(_0x3a4203,_0xa6ff2e){_0x3a4203=_0x3a4203-0x0;var _0x1a5661=_0x008c[_0x3a4203];return _0x1a5661;};'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 +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x34e8,0x12c));var _0x834e=function(_0x56005e,_0x2a3626){_0x56005e=_0x56005e-0x0;var _0x1780ae=_0x34e8[_0x56005e];return _0x1780ae;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 29618c3..ecc5678 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 _0xa64f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xa64f,0x84));var _0xfa64=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa64f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfa64('0x0'));var util=require(_0xfa64('0x1'));var logger=require(_0xfa64('0x2'))(_0xfa64('0x3'));var moment=require('moment');var BPromise=require(_0xfa64('0x4'));var rp=require(_0xfa64('0x5'));var fs=require('fs');var path=require(_0xfa64('0x6'));var rimraf=require(_0xfa64('0x7'));var config=require(_0xfa64('0x8'));var attributes=require(_0xfa64('0x9'));module['exports']=function(_0x451900,_0xa7ac8a){return _0x451900[_0xfa64('0xa')]('VoicePrefix',attributes,{'tableName':_0xfa64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbe3=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcbe3,0xae));var _0x3cbe=function(_0x266b0f,_0x1535a9){_0x266b0f=_0x266b0f-0x0;var _0x3aeebc=_0xcbe3[_0x266b0f];return _0x3aeebc;};'use strict';var _=require(_0x3cbe('0x0'));var util=require(_0x3cbe('0x1'));var logger=require(_0x3cbe('0x2'))(_0x3cbe('0x3'));var moment=require(_0x3cbe('0x4'));var BPromise=require(_0x3cbe('0x5'));var rp=require(_0x3cbe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cbe('0x7'));var attributes=require(_0x3cbe('0x8'));module['exports']=function(_0xfb8b52,_0x27e5f5){return _0xfb8b52[_0x3cbe('0x9')](_0x3cbe('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 1de885c..e5aa53b 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 _0xf3a3=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voicePrefix.socket','register','request','then'];(function(_0x168001,_0x37e3a1){var _0x141e86=function(_0x11556c){while(--_0x11556c){_0x168001['push'](_0x168001['shift']());}};_0x141e86(++_0x37e3a1);}(_0xf3a3,0x18f));var _0x3f3a=function(_0x21b49a,_0x4a930c){_0x21b49a=_0x21b49a-0x0;var _0x2e0492=_0xf3a3[_0x21b49a];return _0x2e0492;};'use strict';var _=require(_0x3f3a('0x0'));var util=require(_0x3f3a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3f3a('0x2'));var fs=require('fs');var Redis=require(_0x3f3a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f3a('0x4'));var logger=require(_0x3f3a('0x5'))(_0x3f3a('0x6'));var config=require(_0x3f3a('0x7'));var jayson=require(_0x3f3a('0x8'));var client=jayson[_0x3f3a('0x9')][_0x3f3a('0xa')]({'port':0x232a});config[_0x3f3a('0xb')]=_['defaults'](config[_0x3f3a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f3a('0xc'))(new Redis(config['redis']));require(_0x3f3a('0xd'))[_0x3f3a('0xe')](socket);function respondWithRpcPromise(_0x58ec9c,_0x2d5a44,_0x3ca538){return new BPromise(function(_0x3d2680,_0x5ea839){return client[_0x3f3a('0xf')](_0x58ec9c,_0x3ca538)[_0x3f3a('0x10')](function(_0x277364){logger[_0x3f3a('0x11')](_0x3f3a('0x12'),_0x2d5a44,_0x3f3a('0x13'));logger[_0x3f3a('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2d5a44,_0x3f3a('0x13'),JSON['stringify'](_0x277364));if(_0x277364[_0x3f3a('0x15')]){if(_0x277364[_0x3f3a('0x15')][_0x3f3a('0x16')]===0x1f4){logger['error'](_0x3f3a('0x12'),_0x2d5a44,_0x277364['error'][_0x3f3a('0x17')]);return _0x5ea839(_0x277364['error']['message']);}logger[_0x3f3a('0x15')](_0x3f3a('0x12'),_0x2d5a44,_0x277364['error']['message']);return _0x3d2680(_0x277364[_0x3f3a('0x15')][_0x3f3a('0x17')]);}else{logger[_0x3f3a('0x11')](_0x3f3a('0x12'),_0x2d5a44,_0x3f3a('0x13'));_0x3d2680(_0x277364[_0x3f3a('0x18')]['message']);}})[_0x3f3a('0x19')](function(_0x42f801){logger['error'](_0x3f3a('0x12'),_0x2d5a44,_0x42f801);_0x5ea839(_0x42f801);});});} \ No newline at end of file +var _0x4fd6=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3d1807,_0x4fabc2){var _0x2b15c0=function(_0x15311e){while(--_0x15311e){_0x3d1807['push'](_0x3d1807['shift']());}};_0x2b15c0(++_0x4fabc2);}(_0x4fd6,0x84));var _0x64fd=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x4fd6[_0x57add2];return _0x4e3670;};'use strict';var _=require(_0x64fd('0x0'));var util=require(_0x64fd('0x1'));var moment=require(_0x64fd('0x2'));var BPromise=require('bluebird');var rs=require(_0x64fd('0x3'));var fs=require('fs');var Redis=require(_0x64fd('0x4'));var db=require(_0x64fd('0x5'))['db'];var utils=require(_0x64fd('0x6'));var logger=require(_0x64fd('0x7'))(_0x64fd('0x8'));var config=require(_0x64fd('0x9'));var jayson=require(_0x64fd('0xa'));var client=jayson[_0x64fd('0xb')][_0x64fd('0xc')]({'port':0x232a});config[_0x64fd('0xd')]=_[_0x64fd('0xe')](config['redis'],{'host':_0x64fd('0xf'),'port':0x18eb});var socket=require(_0x64fd('0x10'))(new Redis(config['redis']));require(_0x64fd('0x11'))['register'](socket);function respondWithRpcPromise(_0x3519db,_0x98b249,_0x434146){return new BPromise(function(_0x1ddb9a,_0x3a6850){return client[_0x64fd('0x12')](_0x3519db,_0x434146)['then'](function(_0x1c305c){logger[_0x64fd('0x13')](_0x64fd('0x14'),_0x98b249,_0x64fd('0x15'));logger[_0x64fd('0x16')](_0x64fd('0x17'),_0x98b249,_0x64fd('0x15'),JSON[_0x64fd('0x18')](_0x1c305c));if(_0x1c305c[_0x64fd('0x19')]){if(_0x1c305c['error'][_0x64fd('0x1a')]===0x1f4){logger['error'](_0x64fd('0x14'),_0x98b249,_0x1c305c['error'][_0x64fd('0x1b')]);return _0x3a6850(_0x1c305c[_0x64fd('0x19')][_0x64fd('0x1b')]);}logger[_0x64fd('0x19')](_0x64fd('0x14'),_0x98b249,_0x1c305c[_0x64fd('0x19')][_0x64fd('0x1b')]);return _0x1ddb9a(_0x1c305c['error'][_0x64fd('0x1b')]);}else{logger[_0x64fd('0x13')](_0x64fd('0x14'),_0x98b249,_0x64fd('0x15'));_0x1ddb9a(_0x1c305c['result'][_0x64fd('0x1b')]);}})[_0x64fd('0x1c')](function(_0x591129){logger[_0x64fd('0x19')](_0x64fd('0x14'),_0x98b249,_0x591129);_0x3a6850(_0x591129);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index bda17ad..de7bf12 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 _0x5eff=['removeListener','register','length','voicePrefix:','remove','update'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0x5eff,0x106));var _0xf5ef=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x5eff[_0x11005e];return _0x29338f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xf5ef('0x0'),_0xf5ef('0x1')];function createListener(_0xc018e9,_0x552c4b){return function(_0x9d0a1b){_0x552c4b['emit'](_0xc018e9,_0x9d0a1b);};}function removeListener(_0x583177,_0xca3b29){return function(){VoicePrefixEvents[_0xf5ef('0x2')](_0x583177,_0xca3b29);};}exports[_0xf5ef('0x3')]=function(_0x1520a6){for(var _0x744ff3=0x0,_0x2eb2c3=events[_0xf5ef('0x4')];_0x744ff3<_0x2eb2c3;_0x744ff3++){var _0x2e8df8=events[_0x744ff3];var _0xf0e159=createListener(_0xf5ef('0x5')+_0x2e8df8,_0x1520a6);VoicePrefixEvents['on'](_0x2e8df8,_0xf0e159);}}; \ No newline at end of file +var _0x654a=['save','remove','emit','register','length','voicePrefix:'];(function(_0x17b16c,_0xa9b1a2){var _0x218e8c=function(_0xeb1b25){while(--_0xeb1b25){_0x17b16c['push'](_0x17b16c['shift']());}};_0x218e8c(++_0xa9b1a2);}(_0x654a,0x1d4));var _0xa654=function(_0x3ee5df,_0x583073){_0x3ee5df=_0x3ee5df-0x0;var _0x446d24=_0x654a[_0x3ee5df];return _0x446d24;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xa654('0x0'),_0xa654('0x1'),'update'];function createListener(_0x1b79e0,_0x463187){return function(_0x41b6a1){_0x463187[_0xa654('0x2')](_0x1b79e0,_0x41b6a1);};}function removeListener(_0x49abea,_0x3d404c){return function(){VoicePrefixEvents['removeListener'](_0x49abea,_0x3d404c);};}exports[_0xa654('0x3')]=function(_0x53d1e1){for(var _0x5671c3=0x0,_0x39542d=events[_0xa654('0x4')];_0x5671c3<_0x39542d;_0x5671c3++){var _0x8e688a=events[_0x5671c3];var _0x3b0d5c=createListener(_0xa654('0x5')+_0x8e688a,_0x53d1e1);VoicePrefixEvents['on'](_0x8e688a,_0x3b0d5c);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e13ff98..b7535b6 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 _0xe5f3=['addTeams','addAgents','addLists','addBlackLists','put','delete','destroy','removeAgents','removeLists','multer','path','express','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone'];(function(_0x414110,_0x45a41b){var _0x55cc70=function(_0x24154f){while(--_0x24154f){_0x414110['push'](_0x414110['shift']());}};_0x55cc70(++_0x45a41b);}(_0xe5f3,0xb8));var _0x3e5f=function(_0x11e607,_0x17bbce){_0x11e607=_0x11e607-0x0;var _0x5778b5=_0xe5f3[_0x11e607];return _0x5778b5;};'use strict';var multer=require(_0x3e5f('0x0'));var util=require('util');var path=require(_0x3e5f('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e5f('0x2'));var router=express['Router']();var auth=require(_0x3e5f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3e5f('0x4'));var controller=require(_0x3e5f('0x5'));router[_0x3e5f('0x6')]('/',auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x8')]);router[_0x3e5f('0x6')](_0x3e5f('0x9'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0xa')]);router[_0x3e5f('0x6')](_0x3e5f('0xb'),auth[_0x3e5f('0x7')](),controller['getHoppers']);router[_0x3e5f('0x6')](_0x3e5f('0xc'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0xd')]);router[_0x3e5f('0x6')](_0x3e5f('0xe'),auth[_0x3e5f('0x7')](),controller['getHopperFinals']);router['get'](_0x3e5f('0xf'),auth['isAuthenticated'](),controller[_0x3e5f('0x10')]);router['get'](_0x3e5f('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3e5f('0x6')](_0x3e5f('0x12'),auth[_0x3e5f('0x7')](),controller['getAgents']);router[_0x3e5f('0x6')]('/:id/members',auth[_0x3e5f('0x7')](),controller['getMembers']);router['get'](_0x3e5f('0x13'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x14')]);router[_0x3e5f('0x6')](_0x3e5f('0x15'),auth[_0x3e5f('0x7')](),controller['getBlackLists']);router[_0x3e5f('0x16')]('/',auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x17')]);router['post'](_0x3e5f('0x18'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x19')]);router[_0x3e5f('0x16')](_0x3e5f('0x11'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x1a')]);router[_0x3e5f('0x16')](_0x3e5f('0x12'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x1b')]);router[_0x3e5f('0x16')](_0x3e5f('0x13'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x1c')]);router[_0x3e5f('0x16')](_0x3e5f('0x15'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x1d')]);router[_0x3e5f('0x1e')]('/:id',auth[_0x3e5f('0x7')](),controller['update']);router[_0x3e5f('0x1f')](_0x3e5f('0x9'),auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x20')]);router['delete'](_0x3e5f('0x11'),auth[_0x3e5f('0x7')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x3e5f('0x7')](),controller[_0x3e5f('0x21')]);router[_0x3e5f('0x1f')](_0x3e5f('0x13'),auth['isAuthenticated'](),controller[_0x3e5f('0x22')]);router[_0x3e5f('0x1f')](_0x3e5f('0x15'),auth[_0x3e5f('0x7')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x83ae=['/:id/teams','getTeams','/:id/users','/:id/members','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','delete','destroy','removeTeams','removeAgents','removeLists','/:id/blacklists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/hopper_black'];(function(_0x2f278a,_0x46ba22){var _0x4e13b1=function(_0x4c1ce8){while(--_0x4c1ce8){_0x2f278a['push'](_0x2f278a['shift']());}};_0x4e13b1(++_0x46ba22);}(_0x83ae,0x192));var _0xe83a=function(_0x6d7b48,_0x344d5e){_0x6d7b48=_0x6d7b48-0x0;var _0x5d38f9=_0x83ae[_0x6d7b48];return _0x5d38f9;};'use strict';var multer=require(_0xe83a('0x0'));var util=require('util');var path=require(_0xe83a('0x1'));var timeout=require(_0xe83a('0x2'));var express=require(_0xe83a('0x3'));var router=express[_0xe83a('0x4')]();var auth=require(_0xe83a('0x5'));var interaction=require(_0xe83a('0x6'));var config=require(_0xe83a('0x7'));var controller=require(_0xe83a('0x8'));router[_0xe83a('0x9')]('/',auth['isAuthenticated'](),controller[_0xe83a('0xa')]);router[_0xe83a('0x9')]('/:id',auth[_0xe83a('0xb')](),controller[_0xe83a('0xc')]);router['get'](_0xe83a('0xd'),auth['isAuthenticated'](),controller[_0xe83a('0xe')]);router['get']('/:id/hopper_histories',auth[_0xe83a('0xb')](),controller[_0xe83a('0xf')]);router['get']('/:id/hopper_finals',auth[_0xe83a('0xb')](),controller[_0xe83a('0x10')]);router[_0xe83a('0x9')](_0xe83a('0x11'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xe83a('0x9')](_0xe83a('0x12'),auth[_0xe83a('0xb')](),controller[_0xe83a('0x13')]);router[_0xe83a('0x9')](_0xe83a('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe83a('0x9')](_0xe83a('0x15'),auth[_0xe83a('0xb')](),controller['getMembers']);router[_0xe83a('0x9')](_0xe83a('0x16'),auth[_0xe83a('0xb')](),controller[_0xe83a('0x17')]);router[_0xe83a('0x9')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xe83a('0x18')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe83a('0x19')]);router[_0xe83a('0x1a')](_0xe83a('0x1b'),auth[_0xe83a('0xb')](),controller['clone']);router[_0xe83a('0x1a')](_0xe83a('0x12'),auth[_0xe83a('0xb')](),controller[_0xe83a('0x1c')]);router[_0xe83a('0x1a')](_0xe83a('0x14'),auth[_0xe83a('0xb')](),controller[_0xe83a('0x1d')]);router['post'](_0xe83a('0x16'),auth['isAuthenticated'](),controller[_0xe83a('0x1e')]);router[_0xe83a('0x1a')]('/:id/blacklists',auth[_0xe83a('0xb')](),controller[_0xe83a('0x1f')]);router[_0xe83a('0x20')](_0xe83a('0x21'),auth['isAuthenticated'](),controller['update']);router[_0xe83a('0x22')](_0xe83a('0x21'),auth[_0xe83a('0xb')](),controller[_0xe83a('0x23')]);router[_0xe83a('0x22')]('/:id/teams',auth[_0xe83a('0xb')](),controller[_0xe83a('0x24')]);router[_0xe83a('0x22')](_0xe83a('0x14'),auth[_0xe83a('0xb')](),controller[_0xe83a('0x25')]);router[_0xe83a('0x22')](_0xe83a('0x16'),auth[_0xe83a('0xb')](),controller[_0xe83a('0x26')]);router[_0xe83a('0x22')](_0xe83a('0x27'),auth['isAuthenticated'](),controller[_0xe83a('0x28')]);module[_0xe83a('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 21c0481..7745d90 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(_0x160cbc,_0x3025a6){var _0x4ac8c6=function(_0x27e1d3){while(--_0x27e1d3){_0x160cbc['push'](_0x160cbc['shift']());}};_0x4ac8c6(++_0x3025a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x59ab65,_0x410a52){var _0x57db9b=function(_0x19dc31){while(--_0x19dc31){_0x59ab65['push'](_0x59ab65['shift']());}};_0x57db9b(++_0x410a52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 c87128e..fac64cb 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 _0x2219=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','VoiceQueueId','options','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','interface','flatMap','penalty','Agents','sequelize','UserVoiceQueue','each','upsert','isNil','SIP/%s','voicePause','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','compact','transaction','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','omit','spread','format','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','insert','cm_contacts','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','includes','type','find','value','name','UserProfileResource','sendStatus','error','send','index','map','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation'];(function(_0x4dab97,_0x19bbcc){var _0x100e4e=function(_0x581a33){while(--_0x581a33){_0x4dab97['push'](_0x4dab97['shift']());}};_0x100e4e(++_0x19bbcc);}(_0x2219,0x115));var _0x9221=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x2219[_0x75ce5b];return _0x22195e;};'use strict';var pdf=require(_0x9221('0x0'));var emlformat=require(_0x9221('0x1'));var rimraf=require(_0x9221('0x2'));var zipdir=require(_0x9221('0x3'));var jsonpatch=require(_0x9221('0x4'));var rp=require('request-promise');var moment=require(_0x9221('0x5'));var BPromise=require(_0x9221('0x6'));var Mustache=require(_0x9221('0x7'));var util=require('util');var path=require(_0x9221('0x8'));var sox=require(_0x9221('0x9'));var csv=require('to-csv');var ejs=require(_0x9221('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9221('0xb'));var crypto=require(_0x9221('0xc'));var jsforce=require(_0x9221('0xd'));var deskjs=require(_0x9221('0xe'));var toCsv=require(_0x9221('0xf'));var querystring=require('querystring');var Papa=require(_0x9221('0x10'));var Redis=require('ioredis');var authService=require(_0x9221('0x11'));var qs=require(_0x9221('0x12'));var as=require(_0x9221('0x13'));var hardwareService=require(_0x9221('0x14'));var logger=require(_0x9221('0x15'))(_0x9221('0x16'));var utils=require(_0x9221('0x17'));var config=require(_0x9221('0x18'));var db=require(_0x9221('0x19'))['db'];config[_0x9221('0x1a')]=_[_0x9221('0x1b')](config[_0x9221('0x1a')],{'host':_0x9221('0x1c'),'port':0x18eb});var socket=require(_0x9221('0x1d'))(new Redis(config[_0x9221('0x1a')]));require(_0x9221('0x1e'))['register'](socket);function respondWithStatusCode(_0x5919f9,_0xbab095){_0xbab095=_0xbab095||0xcc;return function(_0x1f3e07){if(_0x1f3e07){return _0x5919f9['sendStatus'](_0xbab095);}return _0x5919f9[_0x9221('0x1f')](_0xbab095)[_0x9221('0x20')]();};}function respondWithResult(_0x2a0609,_0x5f23a5){_0x5f23a5=_0x5f23a5||0xc8;return function(_0x88677a){if(_0x88677a){return _0x2a0609[_0x9221('0x1f')](_0x5f23a5)[_0x9221('0x21')](_0x88677a);}};}function respondWithFilteredResult(_0x215f37,_0x446302){return function(_0x557534){if(_0x557534){var _0x58fbe8=_0x557534['count'],_0x51460b=_0x446302[_0x9221('0x22')],_0x207ecc=_0x446302[_0x9221('0x22')]+_0x446302[_0x9221('0x23')],_0x2fa4af;if(_0x207ecc>=_0x58fbe8){_0x207ecc=_0x58fbe8;_0x2fa4af=0xc8;}else{_0x2fa4af=0xce;}_0x215f37[_0x9221('0x1f')](_0x2fa4af);return _0x215f37[_0x9221('0x24')](_0x9221('0x25'),_0x51460b+'-'+_0x207ecc+'/'+_0x58fbe8)[_0x9221('0x21')](_0x557534);}return null;};}function patchUpdates(_0x1545a2){return function(_0x198e85){try{jsonpatch['apply'](_0x198e85,_0x1545a2,!![]);}catch(_0xdeec8d){return BPromise[_0x9221('0x26')](_0xdeec8d);}return _0x198e85[_0x9221('0x27')]();};}function saveUpdates(_0x73cc2b,_0x5b3251){return function(_0xde204d){if(_0xde204d){return _0xde204d[_0x9221('0x28')](_0x73cc2b)[_0x9221('0x29')](function(_0x6aa86a){return _0x6aa86a;});}return null;};}function removeEntity(_0x57c9e7,_0x13b787){return function(_0x70cbb4){if(_0x70cbb4){return _0x70cbb4[_0x9221('0x2a')]()[_0x9221('0x29')](function(){var _0x2a7391=_0x70cbb4[_0x9221('0x2b')]({'plain':!![]});var _0x3e710d=[{'name':_0x9221('0x2c'),'value':'inbound','ignore':![]},{'name':_0x9221('0x2d'),'value':_0x9221('0x2e'),'ignore':![]}];var _0x1b9810=_(_0x3e710d)[_0x9221('0x2f')](_0x9221('0x30'))['map']('value')['value']();if(_[_0x9221('0x31')](_0x1b9810,_0x2a7391[_0x9221('0x32')])){return;}var _0x2674e3=_[_0x9221('0x33')](_0x3e710d,[_0x9221('0x34'),_0x2a7391[_0x9221('0x32')]])[_0x9221('0x35')];return db[_0x9221('0x36')]['destroy']({'where':{'type':_0x2674e3,'resourceId':_0x2a7391['id']}})[_0x9221('0x29')](function(){return _0x70cbb4;});})[_0x9221('0x29')](function(){_0x57c9e7[_0x9221('0x1f')](0xcc)[_0x9221('0x20')]();});}};}function handleEntityNotFound(_0xe6177,_0x5e3813){return function(_0x26fa7d){if(!_0x26fa7d){_0xe6177[_0x9221('0x37')](0x194);}return _0x26fa7d;};}function handleError(_0x36f31d,_0x18fefb){_0x18fefb=_0x18fefb||0x1f4;return function(_0x36e89d){logger[_0x9221('0x38')](_0x36e89d['stack']);if(_0x36e89d[_0x9221('0x35')]){delete _0x36e89d['name'];}_0x36f31d[_0x9221('0x1f')](_0x18fefb)[_0x9221('0x39')](_0x36e89d);};}exports[_0x9221('0x3a')]=function(_0x14969a,_0x48a0ed){var _0x126185={},_0x2e7a26={},_0x1f7e37={'count':0x0,'rows':[]};var _0x4fdcc2=_[_0x9221('0x3b')](db[_0x9221('0x3c')][_0x9221('0x3d')],function(_0x41ef5f){return{'name':_0x41ef5f[_0x9221('0x3e')],'type':_0x41ef5f[_0x9221('0x32')][_0x9221('0x3f')]};});_0x2e7a26['model']=_[_0x9221('0x3b')](_0x4fdcc2,'name');_0x2e7a26[_0x9221('0x40')]=_[_0x9221('0x41')](_0x14969a[_0x9221('0x40')]);_0x2e7a26[_0x9221('0x42')]=_['intersection'](_0x2e7a26[_0x9221('0x43')],_0x2e7a26[_0x9221('0x40')]);_0x126185['attributes']=_[_0x9221('0x44')](_0x2e7a26[_0x9221('0x43')],qs[_0x9221('0x45')](_0x14969a[_0x9221('0x40')][_0x9221('0x45')]));_0x126185['attributes']=_0x126185[_0x9221('0x46')][_0x9221('0x47')]?_0x126185[_0x9221('0x46')]:_0x2e7a26['model'];if(!_0x14969a[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x126185['limit']=qs[_0x9221('0x23')](_0x14969a[_0x9221('0x40')]['limit']);_0x126185[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x14969a[_0x9221('0x40')][_0x9221('0x22')]);}_0x126185[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x14969a[_0x9221('0x40')][_0x9221('0x4b')]);_0x126185[_0x9221('0x4c')]=qs['filters'](_[_0x9221('0x4d')](_0x14969a[_0x9221('0x40')],_0x2e7a26[_0x9221('0x42')]),_0x4fdcc2);if(_0x14969a['query'][_0x9221('0x2f')]){_0x126185['where']=_[_0x9221('0x4e')](_0x126185[_0x9221('0x4c')],{'$or':_['map'](_0x4fdcc2,function(_0x1cc8aa){if(_0x1cc8aa[_0x9221('0x32')]!==_0x9221('0x4f')){var _0x3633cf={};_0x3633cf[_0x1cc8aa['name']]={'$like':'%'+_0x14969a[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x3633cf;}})});}_0x126185=_[_0x9221('0x4e')]({},_0x126185,_0x14969a['options']);var _0x5bd72e={'where':_0x126185[_0x9221('0x4c')]};return db[_0x9221('0x3c')][_0x9221('0x50')](_0x5bd72e)['then'](function(_0x24056a){_0x1f7e37['count']=_0x24056a;if(_0x14969a[_0x9221('0x40')][_0x9221('0x51')]){_0x126185[_0x9221('0x52')]=[{'all':!![]}];}return db['VoiceQueue'][_0x9221('0x53')](_0x126185);})[_0x9221('0x29')](function(_0x52eea2){_0x1f7e37['rows']=_0x52eea2;return _0x1f7e37;})[_0x9221('0x29')](respondWithFilteredResult(_0x48a0ed,_0x126185))[_0x9221('0x54')](handleError(_0x48a0ed,null));};exports[_0x9221('0x55')]=function(_0x4156db,_0x567f3c){var _0x4d1667={'raw':![],'where':{'id':_0x4156db[_0x9221('0x56')]['id']}},_0x49806c={};_0x49806c[_0x9221('0x43')]=_[_0x9221('0x41')](db['VoiceQueue'][_0x9221('0x3d')]);_0x49806c[_0x9221('0x40')]=_['keys'](_0x4156db[_0x9221('0x40')]);_0x49806c['filters']=_['intersection'](_0x49806c[_0x9221('0x43')],_0x49806c['query']);_0x4d1667[_0x9221('0x46')]=_[_0x9221('0x44')](_0x49806c[_0x9221('0x43')],qs[_0x9221('0x45')](_0x4156db[_0x9221('0x40')][_0x9221('0x45')]));_0x4d1667[_0x9221('0x46')]=_0x4d1667[_0x9221('0x46')][_0x9221('0x47')]?_0x4d1667['attributes']:_0x49806c[_0x9221('0x43')];if(_0x4156db[_0x9221('0x40')][_0x9221('0x51')]){_0x4d1667['include']=[{'all':!![]}];}_0x4d1667=_[_0x9221('0x4e')]({},_0x4d1667,_0x4156db['options']);return db[_0x9221('0x3c')][_0x9221('0x33')](_0x4d1667)[_0x9221('0x29')](handleEntityNotFound(_0x567f3c,null))['then'](respondWithResult(_0x567f3c,null))[_0x9221('0x54')](handleError(_0x567f3c,null));};exports['create']=function(_0x2b7c66,_0x24381b){return db['VoiceQueue'][_0x9221('0x57')](_0x2b7c66[_0x9221('0x58')],{})[_0x9221('0x29')](function(_0x1c5ea3){var _0x2f89c7=_0x2b7c66[_0x9221('0x59')][_0x9221('0x2b')]({'plain':!![]});if(!_0x2f89c7)throw new Error(_0x9221('0x5a'));if(_0x2f89c7[_0x9221('0x5b')]===_0x9221('0x59')){var _0x1e83ae=_0x1c5ea3['get']({'plain':!![]});var _0x23e5d0=[{'name':_0x9221('0x2c'),'value':_0x9221('0x5c')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5733b4=_[_0x9221('0x33')](_0x23e5d0,[_0x9221('0x34'),_0x1e83ae[_0x9221('0x32')]])[_0x9221('0x35')];return db['UserProfileSection'][_0x9221('0x33')]({'where':{'name':_0x5733b4,'userProfileId':_0x2f89c7[_0x9221('0x5d')]},'raw':!![]})[_0x9221('0x29')](function(_0x5de5bc){if(_0x5de5bc&&_0x5de5bc[_0x9221('0x5e')]===0x0){return db[_0x9221('0x36')][_0x9221('0x57')]({'name':_0x1e83ae['name'],'resourceId':_0x1e83ae['id'],'type':_0x5de5bc[_0x9221('0x35')],'sectionId':_0x5de5bc['id']},{})[_0x9221('0x29')](function(){return _0x1c5ea3;});}else{return _0x1c5ea3;}})[_0x9221('0x54')](function(_0x229d49){logger['error'](_0x9221('0x5f'),_0x229d49);throw _0x229d49;});}return _0x1c5ea3;})['then'](respondWithResult(_0x24381b,0xc9))['catch'](handleError(_0x24381b,null));};exports[_0x9221('0x60')]=function(_0x163861,_0x335dd3){var _0x5b7c02={'where':{'id':_0x163861[_0x9221('0x56')]['id']}},_0xa5a697={};_0xa5a697[_0x9221('0x43')]=_[_0x9221('0x41')](db[_0x9221('0x3c')][_0x9221('0x3d')]);_0x5b7c02['attributes']=_[_0x9221('0x44')](_0xa5a697['model'],qs['fields'](_0x163861['query']['fields']));_0x5b7c02[_0x9221('0x46')]=_0x5b7c02[_0x9221('0x46')][_0x9221('0x47')]?_0x5b7c02[_0x9221('0x46')]:_0xa5a697['model'];if(_0x163861[_0x9221('0x40')][_0x9221('0x51')]){_0x5b7c02['include']=[{'all':!![]}];}_0x5b7c02=_[_0x9221('0x4e')]({},_0x5b7c02,_0x163861['options']);return db[_0x9221('0x3c')]['find'](_0x5b7c02)[_0x9221('0x29')](handleEntityNotFound(_0x335dd3,null))['then'](function(_0x220cdc){if(_0x220cdc){var _0x1f3f36=_0x220cdc[_0x9221('0x2b')]({'plain':!![]});_0x1f3f36=qs['omit'](_0x1f3f36,['id',_0x9221('0x61'),'updatedAt']);_0x163861[_0x9221('0x58')]=_['omit'](_0x163861[_0x9221('0x58')],['id',_0x9221('0x61'),_0x9221('0x62')]);return db['VoiceQueue'][_0x9221('0x57')](_[_0x9221('0x4e')](_0x1f3f36,_0x163861['body']),{'include':_0x163861['query'][_0x9221('0x51')]?[{'all':!![]}]:undefined})[_0x9221('0x29')](function(_0x517245){var _0x567227=_0x163861[_0x9221('0x59')][_0x9221('0x2b')]({'plain':!![]});if(!_0x567227)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x567227[_0x9221('0x5b')]==='user'){var _0x4d754d=_0x517245['get']({'plain':!![]});var _0x3e110f=[{'name':_0x9221('0x2c'),'value':'inbound'},{'name':_0x9221('0x2d'),'value':_0x9221('0x2e')}];var _0x18f530=_[_0x9221('0x33')](_0x3e110f,['value',_0x4d754d[_0x9221('0x32')]])['name'];return db[_0x9221('0x63')][_0x9221('0x33')]({'where':{'name':_0x18f530,'userProfileId':_0x567227[_0x9221('0x5d')]},'raw':!![]})[_0x9221('0x29')](function(_0x3a05b1){if(_0x3a05b1&&_0x3a05b1['autoAssociation']===0x0){return db[_0x9221('0x36')][_0x9221('0x57')]({'name':_0x4d754d[_0x9221('0x35')],'resourceId':_0x4d754d['id'],'type':_0x3a05b1[_0x9221('0x35')],'sectionId':_0x3a05b1['id']},{})[_0x9221('0x29')](function(){return _0x517245;});}else{return _0x517245;}})[_0x9221('0x54')](function(_0x4f9c70){logger[_0x9221('0x38')](_0x9221('0x5f'),_0x4f9c70);throw _0x4f9c70;});}return _0x517245;});}})[_0x9221('0x29')](respondWithResult(_0x335dd3,0xc9))[_0x9221('0x54')](handleError(_0x335dd3,null));};exports['update']=function(_0x37eed1,_0x149db7){if(_0x37eed1[_0x9221('0x58')]['id']){delete _0x37eed1[_0x9221('0x58')]['id'];}return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x37eed1[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x149db7,null))['then'](saveUpdates(_0x37eed1[_0x9221('0x58')],null))[_0x9221('0x29')](respondWithResult(_0x149db7,null))[_0x9221('0x54')](handleError(_0x149db7,null));};exports[_0x9221('0x2a')]=function(_0x162354,_0x3c30fe){return db[_0x9221('0x3c')]['find']({'where':{'id':_0x162354[_0x9221('0x56')]['id']}})['then'](handleEntityNotFound(_0x3c30fe,null))['then'](removeEntity(_0x3c30fe,null))[_0x9221('0x54')](handleError(_0x3c30fe,null));};exports[_0x9221('0x64')]=function(_0x1a447b,_0x1d9313,_0x261c91){var _0xf578e={'raw':![],'where':{}};var _0x4fff23={};var _0x59b0c7={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9221('0x65')]({'where':{'id':_0x1a447b[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x1d9313,null))[_0x9221('0x29')](function(_0xe2625e){if(_0xe2625e){_0x4fff23['model']=_[_0x9221('0x41')](db[_0x9221('0x66')][_0x9221('0x3d')]);_0x4fff23['query']=_['keys'](_0x1a447b[_0x9221('0x40')]);_0x4fff23['filters']=_[_0x9221('0x44')](_0x4fff23['model'],_0x4fff23[_0x9221('0x40')]);_0xf578e[_0x9221('0x46')]=_['intersection'](_0x4fff23[_0x9221('0x43')],qs[_0x9221('0x45')](_0x1a447b[_0x9221('0x40')][_0x9221('0x45')]));_0xf578e[_0x9221('0x46')]=_0xf578e[_0x9221('0x46')][_0x9221('0x47')]?_0xf578e[_0x9221('0x46')]:_0x4fff23[_0x9221('0x43')];if(!_0x1a447b[_0x9221('0x40')][_0x9221('0x48')]('nolimit')){_0xf578e[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x1a447b[_0x9221('0x40')][_0x9221('0x23')]);_0xf578e[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x1a447b[_0x9221('0x40')][_0x9221('0x22')]);}_0xf578e[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x1a447b[_0x9221('0x40')]['sort']);_0xf578e['where']=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x1a447b['query'],_0x4fff23[_0x9221('0x42')]));_0xf578e['where'][_0x9221('0x67')]=_0xe2625e['id'];if(_0x1a447b['query'][_0x9221('0x2f')]){_0xf578e[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0xf578e[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0xf578e['attributes'],function(_0x15451d){var _0x67cb46={};_0x67cb46[_0x15451d]={'$like':'%'+_0x1a447b['query'][_0x9221('0x2f')]+'%'};return _0x67cb46;})});}_0xf578e=_['merge']({},_0xf578e,_0x1a447b[_0x9221('0x68')]);return db[_0x9221('0x66')][_0x9221('0x50')]({'where':_0xf578e[_0x9221('0x4c')]})[_0x9221('0x29')](function(_0x8e0ceb){_0x59b0c7[_0x9221('0x50')]=_0x8e0ceb;if(_0x1a447b[_0x9221('0x40')][_0x9221('0x51')]){_0xf578e[_0x9221('0x52')]=[{'all':!![]}];}return db[_0x9221('0x66')][_0x9221('0x53')](_0xf578e);})[_0x9221('0x29')](function(_0x6a2a38){_0x59b0c7[_0x9221('0x69')]=_0x6a2a38;return _0x59b0c7;});}})[_0x9221('0x29')](respondWithFilteredResult(_0x1d9313,_0xf578e))[_0x9221('0x54')](handleError(_0x1d9313,null));};exports['getHopperHistories']=function(_0x191f3a,_0x459c0e,_0x103412){var _0x11fe58={'raw':!![],'where':{}};var _0xb4df0d={};var _0x324b93={'count':0x0,'rows':[]};return db[_0x9221('0x3c')]['findOne']({'where':{'id':_0x191f3a[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x459c0e,null))[_0x9221('0x29')](function(_0x5d9938){if(_0x5d9938){_0xb4df0d[_0x9221('0x43')]=_[_0x9221('0x41')](db[_0x9221('0x6a')][_0x9221('0x3d')]);_0xb4df0d['query']=_[_0x9221('0x41')](_0x191f3a['query']);_0xb4df0d[_0x9221('0x42')]=_[_0x9221('0x44')](_0xb4df0d['model'],_0xb4df0d[_0x9221('0x40')]);_0x11fe58[_0x9221('0x46')]=_['intersection'](_0xb4df0d[_0x9221('0x43')],qs['fields'](_0x191f3a[_0x9221('0x40')]['fields']));_0x11fe58[_0x9221('0x46')]=_0x11fe58[_0x9221('0x46')][_0x9221('0x47')]?_0x11fe58['attributes']:_0xb4df0d['model'];if(!_0x191f3a[_0x9221('0x40')]['hasOwnProperty'](_0x9221('0x49'))){_0x11fe58['limit']=qs[_0x9221('0x23')](_0x191f3a[_0x9221('0x40')][_0x9221('0x23')]);_0x11fe58['offset']=qs[_0x9221('0x22')](_0x191f3a['query'][_0x9221('0x22')]);}_0x11fe58[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x191f3a['query'][_0x9221('0x4b')]);_0x11fe58['where']=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x191f3a[_0x9221('0x40')],_0xb4df0d[_0x9221('0x42')]));_0x11fe58['where'][_0x9221('0x67')]=_0x5d9938['id'];if(_0x191f3a[_0x9221('0x40')]['filter']){_0x11fe58[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0x11fe58[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x11fe58['attributes'],function(_0x53d363){var _0x94d612={};_0x94d612[_0x53d363]={'$like':'%'+_0x191f3a[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x94d612;})});}_0x11fe58=_['merge']({},_0x11fe58,_0x191f3a[_0x9221('0x68')]);return db[_0x9221('0x6a')][_0x9221('0x50')]({'where':_0x11fe58[_0x9221('0x4c')]})[_0x9221('0x29')](function(_0x4be159){_0x324b93[_0x9221('0x50')]=_0x4be159;if(_0x191f3a['query']['includeAll']){_0x11fe58['include']=[{'all':!![]}];}return db[_0x9221('0x6a')]['findAll'](_0x11fe58);})[_0x9221('0x29')](function(_0x1c36e3){_0x324b93[_0x9221('0x69')]=_0x1c36e3;return _0x324b93;});}})[_0x9221('0x29')](respondWithFilteredResult(_0x459c0e,_0x11fe58))[_0x9221('0x54')](handleError(_0x459c0e,null));};exports[_0x9221('0x6b')]=function(_0x558655,_0xd555e5,_0xaba25d){var _0x6063bc={'raw':!![],'where':{}};var _0x2ad2d4={};var _0x2e391a={'count':0x0,'rows':[]};return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x558655[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0xd555e5,null))[_0x9221('0x29')](function(_0x2315d9){if(_0x2315d9){_0x2ad2d4[_0x9221('0x43')]=_[_0x9221('0x41')](db[_0x9221('0x6c')]['rawAttributes']);_0x2ad2d4[_0x9221('0x40')]=_[_0x9221('0x41')](_0x558655[_0x9221('0x40')]);_0x2ad2d4[_0x9221('0x42')]=_[_0x9221('0x44')](_0x2ad2d4[_0x9221('0x43')],_0x2ad2d4[_0x9221('0x40')]);_0x6063bc[_0x9221('0x46')]=_[_0x9221('0x44')](_0x2ad2d4['model'],qs[_0x9221('0x45')](_0x558655['query']['fields']));_0x6063bc[_0x9221('0x46')]=_0x6063bc[_0x9221('0x46')][_0x9221('0x47')]?_0x6063bc[_0x9221('0x46')]:_0x2ad2d4['model'];if(!_0x558655[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x6063bc[_0x9221('0x23')]=qs['limit'](_0x558655[_0x9221('0x40')]['limit']);_0x6063bc[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x558655[_0x9221('0x40')][_0x9221('0x22')]);}_0x6063bc[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x558655[_0x9221('0x40')][_0x9221('0x4b')]);_0x6063bc[_0x9221('0x4c')]=qs['filters'](_[_0x9221('0x4d')](_0x558655['query'],_0x2ad2d4[_0x9221('0x42')]));_0x6063bc['where'][_0x9221('0x67')]=_0x2315d9['id'];if(_0x558655['query'][_0x9221('0x2f')]){_0x6063bc[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0x6063bc[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x6063bc[_0x9221('0x46')],function(_0x3f8538){var _0x561c0c={};_0x561c0c[_0x3f8538]={'$like':'%'+_0x558655['query'][_0x9221('0x2f')]+'%'};return _0x561c0c;})});}_0x6063bc=_[_0x9221('0x4e')]({},_0x6063bc,_0x558655['options']);return db['CmHopperFinal'][_0x9221('0x50')]({'where':_0x6063bc[_0x9221('0x4c')]})[_0x9221('0x29')](function(_0x2c501b){_0x2e391a[_0x9221('0x50')]=_0x2c501b;if(_0x558655['query'][_0x9221('0x51')]){_0x6063bc['include']=[{'all':!![]}];}return db[_0x9221('0x6c')][_0x9221('0x53')](_0x6063bc);})[_0x9221('0x29')](function(_0x3af7d3){_0x2e391a[_0x9221('0x69')]=_0x3af7d3;return _0x2e391a;});}})[_0x9221('0x29')](respondWithFilteredResult(_0xd555e5,_0x6063bc))[_0x9221('0x54')](handleError(_0xd555e5,null));};exports[_0x9221('0x6d')]=function(_0x4fd9f6,_0x4ed298,_0x18e23a){var _0x5c9094={'raw':!![],'where':{}};var _0xc11929={};var _0x583878={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9221('0x65')]({'where':{'id':_0x4fd9f6[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x4ed298,null))[_0x9221('0x29')](function(_0x22501f){if(_0x22501f){_0xc11929['model']=_[_0x9221('0x41')](db[_0x9221('0x6e')][_0x9221('0x3d')]);_0xc11929[_0x9221('0x40')]=_[_0x9221('0x41')](_0x4fd9f6[_0x9221('0x40')]);_0xc11929[_0x9221('0x42')]=_[_0x9221('0x44')](_0xc11929[_0x9221('0x43')],_0xc11929['query']);_0x5c9094[_0x9221('0x46')]=_[_0x9221('0x44')](_0xc11929[_0x9221('0x43')],qs[_0x9221('0x45')](_0x4fd9f6['query'][_0x9221('0x45')]));_0x5c9094['attributes']=_0x5c9094[_0x9221('0x46')][_0x9221('0x47')]?_0x5c9094[_0x9221('0x46')]:_0xc11929['model'];if(!_0x4fd9f6[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x5c9094[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x4fd9f6[_0x9221('0x40')][_0x9221('0x23')]);_0x5c9094[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x4fd9f6[_0x9221('0x40')]['offset']);}_0x5c9094[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x4fd9f6[_0x9221('0x40')][_0x9221('0x4b')]);_0x5c9094[_0x9221('0x4c')]=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x4fd9f6['query'],_0xc11929[_0x9221('0x42')]));_0x5c9094[_0x9221('0x4c')][_0x9221('0x67')]=_0x22501f['id'];if(_0x4fd9f6[_0x9221('0x40')][_0x9221('0x2f')]){_0x5c9094['where']=_[_0x9221('0x4e')](_0x5c9094['where'],{'$or':_['map'](_0x5c9094[_0x9221('0x46')],function(_0x40edaa){var _0x5de5bb={};_0x5de5bb[_0x40edaa]={'$like':'%'+_0x4fd9f6['query'][_0x9221('0x2f')]+'%'};return _0x5de5bb;})});}_0x5c9094=_['merge']({},_0x5c9094,_0x4fd9f6['options']);return db['CmHopperBlack']['count']({'where':_0x5c9094[_0x9221('0x4c')]})['then'](function(_0x1aca39){_0x583878[_0x9221('0x50')]=_0x1aca39;if(_0x4fd9f6[_0x9221('0x40')]['includeAll']){_0x5c9094[_0x9221('0x52')]=[{'all':!![]}];}return db[_0x9221('0x6e')][_0x9221('0x53')](_0x5c9094);})[_0x9221('0x29')](function(_0x3d4663){_0x583878[_0x9221('0x69')]=_0x3d4663;return _0x583878;});}})[_0x9221('0x29')](respondWithFilteredResult(_0x4ed298,_0x5c9094))[_0x9221('0x54')](handleError(_0x4ed298,null));};exports[_0x9221('0x6f')]=function(_0x534cfc,_0x18b526,_0xad7014){var _0x36a04d={};var _0xa4d816={};var _0x10d38e;var _0x27ac7e;return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x534cfc['params']['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x18b526,null))[_0x9221('0x29')](function(_0x3ffba7){if(_0x3ffba7){_0x10d38e=_0x3ffba7;_0xa4d816[_0x9221('0x43')]=_['keys'](db[_0x9221('0x70')][_0x9221('0x3d')]);_0xa4d816[_0x9221('0x40')]=_['keys'](_0x534cfc['query']);_0xa4d816[_0x9221('0x42')]=_[_0x9221('0x44')](_0xa4d816[_0x9221('0x43')],_0xa4d816[_0x9221('0x40')]);_0x36a04d['attributes']=_[_0x9221('0x44')](_0xa4d816['model'],qs[_0x9221('0x45')](_0x534cfc['query'][_0x9221('0x45')]));_0x36a04d[_0x9221('0x46')]=_0x36a04d['attributes'][_0x9221('0x47')]?_0x36a04d[_0x9221('0x46')]:_0xa4d816[_0x9221('0x43')];_0x36a04d['order']=qs[_0x9221('0x4b')](_0x534cfc['query'][_0x9221('0x4b')]);_0x36a04d['where']=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x534cfc[_0x9221('0x40')],_0xa4d816['filters']));if(_0x534cfc['query'][_0x9221('0x2f')]){_0x36a04d[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0x36a04d[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x36a04d['attributes'],function(_0x84e4d2){var _0x373b4d={};_0x373b4d[_0x84e4d2]={'$like':'%'+_0x534cfc[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x373b4d;})});}_0x36a04d=_[_0x9221('0x4e')]({},_0x36a04d,_0x534cfc[_0x9221('0x68')]);return _0x10d38e[_0x9221('0x6f')](_0x36a04d);}})['then'](function(_0x3fb027){if(_0x3fb027){_0x27ac7e=_0x3fb027[_0x9221('0x47')];if(!_0x534cfc[_0x9221('0x40')]['hasOwnProperty'](_0x9221('0x49'))){_0x36a04d[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x534cfc[_0x9221('0x40')][_0x9221('0x23')]);_0x36a04d['offset']=qs[_0x9221('0x22')](_0x534cfc[_0x9221('0x40')][_0x9221('0x22')]);}return _0x10d38e['getTeams'](_0x36a04d);}})[_0x9221('0x29')](function(_0x493e7e){if(_0x493e7e){return _0x493e7e?{'count':_0x27ac7e,'rows':_0x493e7e}:null;}})['then'](respondWithResult(_0x18b526,null))[_0x9221('0x54')](handleError(_0x18b526,null));};exports[_0x9221('0x71')]=function(_0x5d3239,_0x15fa4e,_0x125d23){var _0x248f13=_0x5d3239[_0x9221('0x58')][_0x9221('0x72')];var _0x111f89=_[_0x9221('0x3b')](_0x248f13,'id');return db['Team'][_0x9221('0x53')]({'where':{'id':_0x111f89},'attributes':['id'],'include':[{'model':db[_0x9221('0x73')],'as':'Agents','attributes':['id','name',_0x9221('0x74'),'voicePause',_0x9221('0x75')],'raw':!![]}]})['then'](function(_0x1fa9da){if(_0x1fa9da){var _0x41c6b5=_[_0x9221('0x76')](_0x1fa9da,function(_0x29f6cf){var _0x5b9c02=_0x29f6cf[_0x9221('0x2b')]({'plain':!![]});_0x5b9c02['Agents']['forEach'](function(_0x2e7453){_0x2e7453[_0x9221('0x77')]=_[_0x9221('0x33')](_0x248f13,{'id':_0x5b9c02['id']})[_0x9221('0x77')];});return _0x5b9c02[_0x9221('0x78')];});return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x5d3239[_0x9221('0x56')]['id']}})[_0x9221('0x29')](function(_0x3116b3){return db[_0x9221('0x79')]['transaction'](function(_0x3c0aa7){return _0x3116b3[_0x9221('0x71')](_0x111f89,{'transaction':_0x3c0aa7})[_0x9221('0x29')](function(){return BPromise['each'](_0x41c6b5,function(_0x8c0d45){return db[_0x9221('0x7a')]['findOrCreate']({'where':{'UserId':_0x8c0d45['id'],'VoiceQueueId':_0x5d3239['params']['id']},'defaults':{'penalty':_0x8c0d45[_0x9221('0x77')]},'transaction':_0x3c0aa7});});})[_0x9221('0x29')](function(){return BPromise[_0x9221('0x7b')](_[_0x9221('0x2f')](_0x41c6b5,{'online':!![]}),function(_0x39f41a){return db['UserVoiceQueueRt'][_0x9221('0x7c')]({'membername':_0x39f41a['name'],'UserId':_0x39f41a['id'],'queue_name':_0x3116b3[_0x9221('0x35')],'VoiceQueueId':_0x3116b3['id'],'interface':_[_0x9221('0x7d')](_0x39f41a['interface'])?util['format'](_0x9221('0x7e'),_0x39f41a['name']):_0x39f41a[_0x9221('0x75')],'paused':_0x39f41a[_0x9221('0x7f')]||![],'penalty':_0x39f41a[_0x9221('0x77')]},{'transaction':_0x3c0aa7});});})[_0x9221('0x29')](function(){_0x41c6b5[_0x9221('0x80')](function(_0x4debd7){socket[_0x9221('0x81')](_0x9221('0x82'),{'UserId':_0x4debd7['id'],'VoiceQueueId':_0x3116b3['id']});});});});});}})[_0x9221('0x29')](respondWithStatusCode(_0x15fa4e,null))[_0x9221('0x54')](handleError(_0x15fa4e,null));};exports[_0x9221('0x83')]=function(_0x7457aa,_0x1b52f2,_0x1551af){return db['Team'][_0x9221('0x53')]({'where':{'id':_0x7457aa['query'][_0x9221('0x84')]},'attributes':['id'],'include':[{'model':db[_0x9221('0x73')],'as':_0x9221('0x78'),'attributes':['id'],'raw':!![]}]})[_0x9221('0x29')](handleEntityNotFound(_0x1b52f2,null))[_0x9221('0x29')](function(_0x5d2fe7){var _0xe5a115=_['map'](_0x5d2fe7,'id');var _0x4e7196=[];var _0x54ceb9=[];var _0x2b2428=squel[_0x9221('0x85')]();_0x2b2428[_0x9221('0x86')]('tq.TeamId')[_0x9221('0x87')](_0x9221('0x88'),'tq')[_0x9221('0x89')]('user_has_teams','ut',_0x9221('0x8a'))['where'](_0x9221('0x8b'),_0x7457aa['params']['id']);for(var _0x2eb381=0x0;_0x2eb381<_0x5d2fe7[_0x9221('0x47')];_0x2eb381+=0x1){let _0x5da259=_0x5d2fe7[_0x2eb381];for(var _0x22c58e=0x0;_0x22c58e<_0x5da259[_0x9221('0x78')][_0x9221('0x47')];_0x22c58e+=0x1){let _0x3b98f8=_0x5da259[_0x9221('0x78')][_0x22c58e];var _0x118731=_0x2b2428[_0x9221('0x60')]();_0x118731[_0x9221('0x4c')](_0x9221('0x8c'),_0x3b98f8['id']);_0x54ceb9[_0x9221('0x8d')](db[_0x9221('0x79')]['query'](_0x118731[_0x9221('0x8e')](),{'type':db['sequelize'][_0x9221('0x8f')][_0x9221('0x90')]})[_0x9221('0x29')](function(_0x34c133){if(_0x34c133['length']===0x1){return _0x3b98f8['id'];}else{var _0x38d0fe=_[_0x9221('0x91')](_['map'](_0x34c133,'TeamId'),function(_0x7dbd97){return _[_0x9221('0x31')](_0xe5a115,_0x7dbd97);});if(_0x38d0fe){return _0x3b98f8['id'];}}}));}}return BPromise[_0x9221('0x92')](_0x54ceb9)[_0x9221('0x29')](function(_0xd1d047){_0x4e7196=_(_0x4e7196)['union'](_0xd1d047)[_0x9221('0x93')]()[_0x9221('0x34')]();return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x7457aa[_0x9221('0x56')]['id']}})[_0x9221('0x29')](function(_0x1b6c52){return db[_0x9221('0x79')][_0x9221('0x94')](function(_0x3082c9){return _0x1b6c52['removeTeams'](_0x7457aa[_0x9221('0x40')][_0x9221('0x84')],{'transaction':_0x3082c9})[_0x9221('0x29')](function(){if(!_[_0x9221('0x95')](_0x4e7196)){return _0x1b6c52[_0x9221('0x96')](_0x4e7196,{'transaction':_0x3082c9})['then'](function(){return db[_0x9221('0x97')][_0x9221('0x2a')]({'where':{'VoiceQueueId':_0x7457aa[_0x9221('0x56')]['id'],'UserId':_0x4e7196},'transaction':_0x3082c9});});}})['then'](function(){_0x4e7196[_0x9221('0x80')](function(_0x52610c){socket[_0x9221('0x81')](_0x9221('0x98'),{'UserId':_0x52610c,'VoiceQueueId':_0x1b6c52['id']});});});});});});})['then'](respondWithStatusCode(_0x1b52f2,null))[_0x9221('0x54')](handleError(_0x1b52f2,null));};exports['addAgents']=function(_0xc3a214,_0x5af18d,_0x3dc398){var _0x39cb09,_0x1dab38;return db['VoiceQueue'][_0x9221('0x33')]({'where':{'id':_0xc3a214[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x5af18d,null))[_0x9221('0x29')](function(_0x1f6ce7){if(_0x1f6ce7){_0x1dab38=_0x1f6ce7;return _0x1f6ce7['addAgents'](_0xc3a214[_0x9221('0x58')][_0x9221('0x84')],_[_0x9221('0x99')](_0xc3a214[_0x9221('0x58')],[_0x9221('0x84'),'id'])||{})[_0x9221('0x9a')](function(_0x2d9928){for(var _0x3bbfb7=0x0;_0x3bbfb7<_0xc3a214['body'][_0x9221('0x84')][_0x9221('0x47')];_0x3bbfb7+=0x1){socket[_0x9221('0x81')](_0x9221('0x82'),{'UserId':_0xc3a214[_0x9221('0x58')][_0x9221('0x84')][_0x3bbfb7],'VoiceQueueId':_0xc3a214['params']['id']});}return _0x2d9928;});}})['then'](function(_0x26b9d6){_0x39cb09=_0x26b9d6||[];if(_0x1dab38){return db['User'][_0x9221('0x53')]({'where':{'id':_0xc3a214[_0x9221('0x58')][_0x9221('0x84')]},'attributes':['id',_0x9221('0x35'),'online',_0x9221('0x7f'),_0x9221('0x75')],'raw':!![]});}})['then'](function(_0x1c500b){if(!_[_0x9221('0x95')](_0x1c500b)){var _0x49c0b4=[];for(var _0x487393=0x0;_0x487393<_0x1c500b[_0x9221('0x47')];_0x487393++){if(_0x1c500b[_0x487393][_0x9221('0x74')]){_0x49c0b4[_0x9221('0x8d')](db[_0x9221('0x97')]['upsert']({'membername':_0x1c500b[_0x487393][_0x9221('0x35')],'UserId':_0x1c500b[_0x487393]['id'],'queue_name':_0x1dab38[_0x9221('0x35')],'VoiceQueueId':_0x1dab38['id'],'interface':_[_0x9221('0x7d')](_0x1c500b[_0x487393][_0x9221('0x75')])?util[_0x9221('0x9b')](_0x9221('0x7e'),_0x1c500b[_0x487393]['name']):_0x1c500b[_0x487393][_0x9221('0x75')],'paused':_0x1c500b[_0x487393][_0x9221('0x7f')]||![],'penalty':_0xc3a214['body'][_0x9221('0x77')]||0x0}));}}return BPromise[_0x9221('0x92')](_0x49c0b4);}})[_0x9221('0x29')](function(){return _0x39cb09;})[_0x9221('0x29')](respondWithResult(_0x5af18d,null))[_0x9221('0x54')](handleError(_0x5af18d,null));};exports[_0x9221('0x96')]=function(_0x1497f8,_0x20aa05,_0x48a636){return db['VoiceQueue'][_0x9221('0x33')]({'where':{'id':_0x1497f8['params']['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x20aa05,null))[_0x9221('0x29')](function(_0x16c06d){if(_0x16c06d){return _0x16c06d[_0x9221('0x96')](_0x1497f8['query'][_0x9221('0x84')])[_0x9221('0x29')](function(){if(_['isArray'](_0x1497f8[_0x9221('0x40')][_0x9221('0x84')])){for(var _0x25ffe0=0x0;_0x25ffe0<_0x1497f8[_0x9221('0x40')][_0x9221('0x84')]['length'];_0x25ffe0+=0x1){socket['emit'](_0x9221('0x98'),{'UserId':Number(_0x1497f8['query'][_0x9221('0x84')][_0x25ffe0]),'VoiceQueueId':Number(_0x1497f8[_0x9221('0x56')]['id'])});}}else{socket[_0x9221('0x81')](_0x9221('0x98'),{'UserId':Number(_0x1497f8[_0x9221('0x40')]['ids']),'VoiceQueueId':Number(_0x1497f8[_0x9221('0x56')]['id'])});}});}})[_0x9221('0x29')](function(_0x1abd59){return db['UserVoiceQueueRt'][_0x9221('0x2a')]({'where':{'VoiceQueueId':_0x1497f8['params']['id'],'UserId':_0x1497f8['query']['ids']}})[_0x9221('0x29')](function(){return _0x1abd59;});})['then'](respondWithStatusCode(_0x20aa05,null))['catch'](handleError(_0x20aa05,null));};exports[_0x9221('0x9c')]=function(_0x10921b,_0x10d836,_0x5e3cc1){var _0x4fe9bf={};var _0x3fdf8b={};var _0x1cda16;var _0x46f24b;return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x10921b[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x10d836,null))[_0x9221('0x29')](function(_0x33647d){if(_0x33647d){_0x1cda16=_0x33647d;_0x3fdf8b[_0x9221('0x43')]=_['keys'](db['User'][_0x9221('0x3d')]);_0x3fdf8b[_0x9221('0x40')]=_[_0x9221('0x41')](_0x10921b['query']);_0x3fdf8b['filters']=_['intersection'](_0x3fdf8b['model'],_0x3fdf8b[_0x9221('0x40')]);_0x4fe9bf['attributes']=_[_0x9221('0x44')](_0x3fdf8b['model'],qs[_0x9221('0x45')](_0x10921b[_0x9221('0x40')][_0x9221('0x45')]));_0x4fe9bf[_0x9221('0x46')]=_0x4fe9bf[_0x9221('0x46')][_0x9221('0x47')]?_0x4fe9bf[_0x9221('0x46')]:_0x3fdf8b[_0x9221('0x43')];_0x4fe9bf[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x10921b['query'][_0x9221('0x4b')]);_0x4fe9bf[_0x9221('0x4c')]=qs[_0x9221('0x42')](_[_0x9221('0x4d')](_0x10921b[_0x9221('0x40')],_0x3fdf8b[_0x9221('0x42')]));if(_0x10921b[_0x9221('0x40')]['filter']){_0x4fe9bf[_0x9221('0x4c')]=_['merge'](_0x4fe9bf['where'],{'$or':_[_0x9221('0x3b')](_0x4fe9bf[_0x9221('0x46')],function(_0x53fb7a){var _0xef7587={};_0xef7587[_0x53fb7a]={'$like':'%'+_0x10921b['query']['filter']+'%'};return _0xef7587;})});}_0x4fe9bf=_[_0x9221('0x4e')]({},_0x4fe9bf,_0x10921b[_0x9221('0x68')]);return _0x1cda16[_0x9221('0x9c')](_0x4fe9bf);}})['then'](function(_0x3e56da){if(_0x3e56da){_0x46f24b=_0x3e56da[_0x9221('0x47')];if(!_0x10921b[_0x9221('0x40')]['hasOwnProperty'](_0x9221('0x49'))){_0x4fe9bf[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x10921b[_0x9221('0x40')][_0x9221('0x23')]);_0x4fe9bf[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x10921b['query']['offset']);}return _0x1cda16['getAgents'](_0x4fe9bf);}})[_0x9221('0x29')](function(_0x47ef9f){if(_0x47ef9f){return _0x47ef9f?{'count':_0x46f24b,'rows':_0x47ef9f}:null;}})['then'](respondWithResult(_0x10d836,null))['catch'](handleError(_0x10d836,null));};exports['getMembers']=function(_0x575299,_0x42df6a,_0x5f1b4c){var _0x3f31a7={};var _0x430c43={};var _0x13f716;var _0x5f1700;return db['VoiceQueue']['findOne']({'where':{'id':_0x575299['params']['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x42df6a,null))[_0x9221('0x29')](function(_0x3feddb){if(_0x3feddb){_0x13f716=_0x3feddb;_0x430c43['model']=_[_0x9221('0x41')](db['UserVoiceQueueRt']['rawAttributes']);_0x430c43[_0x9221('0x40')]=_['keys'](_0x575299[_0x9221('0x40')]);_0x430c43['filters']=_[_0x9221('0x44')](_0x430c43[_0x9221('0x43')],_0x430c43[_0x9221('0x40')]);_0x3f31a7[_0x9221('0x46')]=_[_0x9221('0x44')](_0x430c43[_0x9221('0x43')],qs[_0x9221('0x45')](_0x575299[_0x9221('0x40')]['fields']));_0x3f31a7[_0x9221('0x46')]=_0x3f31a7[_0x9221('0x46')][_0x9221('0x47')]?_0x3f31a7['attributes']:_0x430c43['model'];_0x3f31a7[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x575299[_0x9221('0x40')]['sort']);_0x3f31a7['where']=qs[_0x9221('0x42')](_['pick'](_0x575299['query'],_0x430c43[_0x9221('0x42')]));if(_0x575299[_0x9221('0x40')][_0x9221('0x2f')]){_0x3f31a7['where']=_[_0x9221('0x4e')](_0x3f31a7[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x3f31a7[_0x9221('0x46')],function(_0x5b40b0){var _0x275f22={};_0x275f22[_0x5b40b0]={'$like':'%'+_0x575299[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x275f22;})});}_0x3f31a7=_[_0x9221('0x4e')]({},_0x3f31a7,_0x575299['options']);return _0x13f716[_0x9221('0x9d')](_0x3f31a7);}})[_0x9221('0x29')](function(_0x12d87f){if(_0x12d87f){_0x5f1700=_0x12d87f[_0x9221('0x47')];if(!_0x575299['query'][_0x9221('0x48')]('nolimit')){_0x3f31a7[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x575299[_0x9221('0x40')][_0x9221('0x23')]);_0x3f31a7[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x575299[_0x9221('0x40')][_0x9221('0x22')]);}return _0x13f716[_0x9221('0x9d')](_0x3f31a7);}})[_0x9221('0x29')](function(_0x5e6540){return _0x5e6540?{'count':_0x5f1700,'rows':_0x5e6540}:null;})[_0x9221('0x29')](respondWithResult(_0x42df6a,null))[_0x9221('0x54')](handleError(_0x42df6a,null));};exports[_0x9221('0x9e')]=function(_0x361dfc,_0x3d90ca,_0x7f792e){var _0x593a93={};var _0x569b5b={};var _0x4bba30;var _0x2e2a4e;return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x361dfc['params']['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x3d90ca,null))[_0x9221('0x29')](function(_0x2e9a00){if(_0x2e9a00){_0x4bba30=_0x2e9a00;_0x569b5b[_0x9221('0x43')]=_[_0x9221('0x41')](db['CmList'][_0x9221('0x3d')]);_0x569b5b[_0x9221('0x40')]=_[_0x9221('0x41')](_0x361dfc[_0x9221('0x40')]);_0x569b5b['filters']=_['intersection'](_0x569b5b['model'],_0x569b5b[_0x9221('0x40')]);_0x593a93['attributes']=_[_0x9221('0x44')](_0x569b5b[_0x9221('0x43')],qs['fields'](_0x361dfc[_0x9221('0x40')][_0x9221('0x45')]));_0x593a93[_0x9221('0x46')]=_0x593a93[_0x9221('0x46')][_0x9221('0x47')]?_0x593a93[_0x9221('0x46')]:_0x569b5b[_0x9221('0x43')];_0x593a93[_0x9221('0x4a')]=qs['sort'](_0x361dfc[_0x9221('0x40')][_0x9221('0x4b')]);_0x593a93[_0x9221('0x4c')]=qs['filters'](_[_0x9221('0x4d')](_0x361dfc[_0x9221('0x40')],_0x569b5b[_0x9221('0x42')]));if(_0x361dfc['query'][_0x9221('0x2f')]){_0x593a93[_0x9221('0x4c')]=_[_0x9221('0x4e')](_0x593a93[_0x9221('0x4c')],{'$or':_[_0x9221('0x3b')](_0x593a93['attributes'],function(_0x42abc6){var _0x48aa7f={};_0x48aa7f[_0x42abc6]={'$like':'%'+_0x361dfc[_0x9221('0x40')]['filter']+'%'};return _0x48aa7f;})});}_0x593a93=_[_0x9221('0x4e')]({},_0x593a93,_0x361dfc[_0x9221('0x68')]);return _0x4bba30[_0x9221('0x9e')](_0x593a93);}})[_0x9221('0x29')](function(_0x1defbe){if(_0x1defbe){_0x2e2a4e=_0x1defbe[_0x9221('0x47')];if(!_0x361dfc[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x593a93[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x361dfc[_0x9221('0x40')][_0x9221('0x23')]);_0x593a93[_0x9221('0x22')]=qs[_0x9221('0x22')](_0x361dfc[_0x9221('0x40')]['offset']);}return _0x4bba30[_0x9221('0x9e')](_0x593a93);}})[_0x9221('0x29')](function(_0x2c6cb8){if(_0x2c6cb8){return _0x2c6cb8?{'count':_0x2e2a4e,'rows':_0x2c6cb8}:null;}})[_0x9221('0x29')](respondWithResult(_0x3d90ca,null))['catch'](handleError(_0x3d90ca,null));};exports[_0x9221('0x9f')]=function(_0x41d3d9,_0x4dd2c9,_0x415bf6){var _0x26d7d5,_0x2796aa;return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x41d3d9[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x4dd2c9,null))[_0x9221('0x29')](function(_0x3aa890){if(_0x3aa890){_0x2796aa=_0x3aa890;return _0x3aa890[_0x9221('0x9f')](_0x41d3d9[_0x9221('0x58')]['ids'],_['omit'](_0x41d3d9[_0x9221('0x58')],[_0x9221('0x84'),'id'])||{});}return null;})[_0x9221('0x9a')](function(_0x5e3fbb){var _0x3f3835;_0x26d7d5=_0x5e3fbb||[];var _0x2d6805=[];if(_0x5e3fbb){for(var _0x222954=0x0;_0x222954<_0x5e3fbb[_0x9221('0x47')];_0x222954+=0x1){var _0x3efa80=_0x5e3fbb[_0x222954][_0x9221('0x2b')]({'plain':!![]});_0x2796aa[_0x9221('0xa0')]=_0x41d3d9[_0x9221('0x58')][_0x9221('0xa0')]?_0x41d3d9[_0x9221('0x58')]['dialCheckDuplicateType']:_0x2796aa['dialCheckDuplicateType'];switch(_0x2796aa[_0x9221('0xa0')]){case _0x9221('0xa1'):_0x3f3835=squel['insert']()[_0x9221('0xa2')](_0x9221('0xa3'))[_0x9221('0xa4')]([_0x9221('0xa5'),_0x9221('0xa6'),_0x9221('0xa7'),'ListId',_0x9221('0x67'),_0x9221('0x61'),_0x9221('0x62')],squel[_0x9221('0x85')]()[_0x9221('0x86')](_0x9221('0xa5'),_0x9221('0xa5'))[_0x9221('0x86')]('NOW()',_0x9221('0xa6'))['field']('id',_0x9221('0xa7'))['field'](_0x3efa80['CmListId'][_0x9221('0x8e')](),_0x9221('0xa8'))[_0x9221('0x86')](_0x41d3d9[_0x9221('0x56')]['id']['toString'](),_0x9221('0x67'))[_0x9221('0x86')](_0x9221('0xa9'),'createdAt')[_0x9221('0x86')](_0x9221('0xa9'),_0x9221('0x62'))[_0x9221('0x87')]('cm_contacts')[_0x9221('0x4c')](_0x9221('0xaa'))[_0x9221('0x4c')](_0x9221('0xab'),_0x3efa80[_0x9221('0xac')][_0x9221('0x8e')]())[_0x9221('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x9221('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9221('0x85')]()[_0x9221('0x86')]('COALESCE(calleridnum,\x27\x27)')[_0x9221('0x87')](_0x9221('0xad'))['where'](_0x9221('0x8b'),_0x41d3d9[_0x9221('0x56')]['id'][_0x9221('0x8e')]()))[_0x9221('0x4c')](_0x9221('0xae'),squel['select']()[_0x9221('0x86')]('COALESCE(phone,\x27\x27)')[_0x9221('0x87')]('cm_hopper')['where'](_0x9221('0x8b'),_0x41d3d9['params']['id'][_0x9221('0x8e')]())))[_0x9221('0x8e')]();break;case _0x9221('0xaf'):_0x3f3835=squel[_0x9221('0xb0')]()[_0x9221('0xa2')]('cm_hopper')[_0x9221('0xa4')](['phone',_0x9221('0xa6'),'ContactId',_0x9221('0xa8'),_0x9221('0x67'),_0x9221('0x61'),_0x9221('0x62')],squel[_0x9221('0x85')]()[_0x9221('0x86')]('phone',_0x9221('0xa5'))['field'](_0x9221('0xa9'),_0x9221('0xa6'))[_0x9221('0x86')]('id',_0x9221('0xa7'))[_0x9221('0x86')](_0x3efa80['CmListId'][_0x9221('0x8e')](),_0x9221('0xa8'))[_0x9221('0x86')](_0x41d3d9['params']['id'][_0x9221('0x8e')](),_0x9221('0x67'))[_0x9221('0x86')](_0x9221('0xa9'),_0x9221('0x61'))['field'](_0x9221('0xa9'),_0x9221('0x62'))[_0x9221('0x87')](_0x9221('0xb1'))[_0x9221('0x4c')]('deletedAt\x20IS\x20NULL')[_0x9221('0x4c')]('ListId\x20=\x20?',_0x3efa80['CmListId']['toString']())[_0x9221('0x4c')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x9221('0x85')]()[_0x9221('0x86')](_0x9221('0xb2'))[_0x9221('0x87')](_0x9221('0xa3'))[_0x9221('0x4c')](_0x9221('0x8b'),_0x41d3d9[_0x9221('0x56')]['id'][_0x9221('0x8e')]())))['toString']();break;default:_0x3f3835=squel[_0x9221('0xb0')]()['into'](_0x9221('0xa3'))[_0x9221('0xa4')]([_0x9221('0xa5'),'scheduledAt',_0x9221('0xa7'),_0x9221('0xa8'),_0x9221('0x67'),_0x9221('0x61'),'updatedAt'],squel['select']()['field'](_0x9221('0xa5'),_0x9221('0xa5'))[_0x9221('0x86')](_0x9221('0xa9'),_0x9221('0xa6'))[_0x9221('0x86')]('id',_0x9221('0xa7'))[_0x9221('0x86')](_0x3efa80[_0x9221('0xac')]['toString'](),_0x9221('0xa8'))[_0x9221('0x86')](_0x41d3d9[_0x9221('0x56')]['id'][_0x9221('0x8e')](),'VoiceQueueId')[_0x9221('0x86')](_0x9221('0xa9'),'createdAt')[_0x9221('0x86')]('NOW()',_0x9221('0x62'))['from'](_0x9221('0xb1'))['where']('deletedAt\x20IS\x20NULL')[_0x9221('0x4c')](_0x9221('0xab'),_0x3efa80[_0x9221('0xac')][_0x9221('0x8e')]())[_0x9221('0x4c')](_0x9221('0xb3')))[_0x9221('0x8e')]();}_0x2d6805[_0x9221('0x8d')](db[_0x9221('0x79')][_0x9221('0x40')](_0x3f3835));}return BPromise[_0x9221('0x92')](_0x2d6805);}})[_0x9221('0x29')](function(){return _0x26d7d5;})[_0x9221('0x29')](respondWithResult(_0x4dd2c9,null))[_0x9221('0x54')](handleError(_0x4dd2c9,null));};exports[_0x9221('0xb4')]=function(_0x4fca68,_0x338672,_0x19eb53){return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x4fca68['params']['id']}})['then'](handleEntityNotFound(_0x338672,null))[_0x9221('0x29')](function(_0x10e90f){if(_0x10e90f){return _0x10e90f[_0x9221('0xb4')](_0x4fca68['query'][_0x9221('0x84')]);}})[_0x9221('0x29')](function(_0x507584){if(_0x507584){return db[_0x9221('0x66')][_0x9221('0x2a')]({'where':{'ListId':_0x4fca68['query']['ids'],'VoiceQueueId':_0x4fca68[_0x9221('0x56')]['id']}})[_0x9221('0x29')](function(){return _0x507584;});}})['then'](respondWithStatusCode(_0x338672,null))[_0x9221('0x54')](handleError(_0x338672,null));};exports['getBlackLists']=function(_0x501b2d,_0x58e7ec,_0x122eb1){var _0x152bcd={};var _0x562f67={};var _0x2b2302;var _0x116d3e;return db[_0x9221('0x3c')][_0x9221('0x65')]({'where':{'id':_0x501b2d['params']['id']}})['then'](handleEntityNotFound(_0x58e7ec,null))[_0x9221('0x29')](function(_0x5f54a8){if(_0x5f54a8){_0x2b2302=_0x5f54a8;_0x562f67[_0x9221('0x43')]=_[_0x9221('0x41')](db[_0x9221('0xb5')][_0x9221('0x3d')]);_0x562f67['query']=_[_0x9221('0x41')](_0x501b2d[_0x9221('0x40')]);_0x562f67['filters']=_[_0x9221('0x44')](_0x562f67[_0x9221('0x43')],_0x562f67[_0x9221('0x40')]);_0x152bcd[_0x9221('0x46')]=_['intersection'](_0x562f67['model'],qs[_0x9221('0x45')](_0x501b2d[_0x9221('0x40')][_0x9221('0x45')]));_0x152bcd[_0x9221('0x46')]=_0x152bcd[_0x9221('0x46')][_0x9221('0x47')]?_0x152bcd['attributes']:_0x562f67[_0x9221('0x43')];_0x152bcd[_0x9221('0x4a')]=qs[_0x9221('0x4b')](_0x501b2d[_0x9221('0x40')][_0x9221('0x4b')]);_0x152bcd['where']=qs['filters'](_[_0x9221('0x4d')](_0x501b2d['query'],_0x562f67[_0x9221('0x42')]));if(_0x501b2d['query'][_0x9221('0x2f')]){_0x152bcd['where']=_[_0x9221('0x4e')](_0x152bcd['where'],{'$or':_[_0x9221('0x3b')](_0x152bcd['attributes'],function(_0x2f0a77){var _0x50fc19={};_0x50fc19[_0x2f0a77]={'$like':'%'+_0x501b2d[_0x9221('0x40')][_0x9221('0x2f')]+'%'};return _0x50fc19;})});}_0x152bcd=_[_0x9221('0x4e')]({},_0x152bcd,_0x501b2d['options']);return _0x2b2302['getBlackLists'](_0x152bcd);}})[_0x9221('0x29')](function(_0x3ab46b){if(_0x3ab46b){_0x116d3e=_0x3ab46b[_0x9221('0x47')];if(!_0x501b2d[_0x9221('0x40')][_0x9221('0x48')](_0x9221('0x49'))){_0x152bcd[_0x9221('0x23')]=qs[_0x9221('0x23')](_0x501b2d[_0x9221('0x40')]['limit']);_0x152bcd[_0x9221('0x22')]=qs['offset'](_0x501b2d[_0x9221('0x40')][_0x9221('0x22')]);}return _0x2b2302[_0x9221('0xb6')](_0x152bcd);}})[_0x9221('0x29')](function(_0x4e75d9){if(_0x4e75d9){return _0x4e75d9?{'count':_0x116d3e,'rows':_0x4e75d9}:null;}})[_0x9221('0x29')](respondWithResult(_0x58e7ec,null))[_0x9221('0x54')](handleError(_0x58e7ec,null));};exports[_0x9221('0xb7')]=function(_0x2fcf77,_0x16484c,_0x58ca4f){var _0x18617d,_0x3c3a5f;return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x2fcf77[_0x9221('0x56')]['id']}})['then'](handleEntityNotFound(_0x16484c,null))[_0x9221('0x29')](function(_0x5578c5){if(_0x5578c5){_0x3c3a5f=_0x5578c5;return _0x5578c5[_0x9221('0xb7')](_0x2fcf77[_0x9221('0x58')][_0x9221('0x84')],_['omit'](_0x2fcf77['body'],['ids','id'])||{});}return null;})[_0x9221('0x9a')](function(_0x8c9ec8){var _0x4b01a2;_0x18617d=_0x8c9ec8||[];var _0x15374d=[];if(_0x8c9ec8){for(var _0x3d1b0d=0x0;_0x3d1b0d<_0x8c9ec8['length'];_0x3d1b0d+=0x1){var _0x360a92=_0x8c9ec8[_0x3d1b0d]['get']({'plain':!![]});_0x4b01a2=squel[_0x9221('0xb0')]()[_0x9221('0xa2')](_0x9221('0xb8'))[_0x9221('0xa4')](['phone',_0x9221('0xa7'),_0x9221('0xa8'),_0x9221('0x67'),_0x9221('0x61'),_0x9221('0x62')],squel[_0x9221('0x85')]()[_0x9221('0x86')](_0x9221('0xa5'),_0x9221('0xa5'))[_0x9221('0x86')]('id',_0x9221('0xa7'))[_0x9221('0x86')](_0x360a92[_0x9221('0xac')][_0x9221('0x8e')](),_0x9221('0xa8'))[_0x9221('0x86')](_0x2fcf77['params']['id'][_0x9221('0x8e')](),_0x9221('0x67'))[_0x9221('0x86')]('NOW()',_0x9221('0x61'))[_0x9221('0x86')](_0x9221('0xa9'),_0x9221('0x62'))['from'](_0x9221('0xb1'))[_0x9221('0x4c')](_0x9221('0xaa'))['where']('ListId\x20=\x20?',_0x360a92['CmListId'][_0x9221('0x8e')]())[_0x9221('0x4c')](_0x9221('0xb3')))['toString']();_0x15374d['push'](db[_0x9221('0x79')][_0x9221('0x40')](_0x4b01a2));}return BPromise[_0x9221('0x92')](_0x15374d);}})[_0x9221('0x29')](function(){return _0x18617d;})['then'](respondWithResult(_0x16484c,null))['catch'](handleError(_0x16484c,null));};exports[_0x9221('0xb9')]=function(_0x301ac5,_0x48d1ef,_0xdae68d){return db[_0x9221('0x3c')][_0x9221('0x33')]({'where':{'id':_0x301ac5[_0x9221('0x56')]['id']}})[_0x9221('0x29')](handleEntityNotFound(_0x48d1ef,null))[_0x9221('0x29')](function(_0x5b4d42){if(_0x5b4d42){return _0x5b4d42[_0x9221('0xb9')](_0x301ac5['query'][_0x9221('0x84')]);}})[_0x9221('0x29')](function(_0xa4de67){if(_0xa4de67){return db[_0x9221('0x6e')][_0x9221('0x2a')]({'where':{'ListId':_0x301ac5[_0x9221('0x40')]['ids'],'VoiceQueueId':_0x301ac5[_0x9221('0x56')]['id']}})[_0x9221('0x29')](function(){return _0xa4de67;});}})[_0x9221('0x29')](respondWithStatusCode(_0x48d1ef,null))[_0x9221('0x54')](handleError(_0x48d1ef,null));}; \ No newline at end of file +var _0x88c7=['ContactId','field','CmListId','ListId','NOW()','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','autoAssociation','getHoppers','findOne','CmHopper','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','ids','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','removeTeams','isEmpty','addAgents','spread','all','removeAgents','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt'];(function(_0x965b4f,_0x304fe9){var _0x57f071=function(_0x52b82e){while(--_0x52b82e){_0x965b4f['push'](_0x965b4f['shift']());}};_0x57f071(++_0x304fe9);}(_0x88c7,0x185));var _0x788c=function(_0x3ee1d4,_0x4029b7){_0x3ee1d4=_0x3ee1d4-0x0;var _0x578206=_0x88c7[_0x3ee1d4];return _0x578206;};'use strict';var pdf=require(_0x788c('0x0'));var emlformat=require(_0x788c('0x1'));var rimraf=require(_0x788c('0x2'));var zipdir=require(_0x788c('0x3'));var jsonpatch=require(_0x788c('0x4'));var rp=require(_0x788c('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x788c('0x6'));var util=require(_0x788c('0x7'));var path=require(_0x788c('0x8'));var sox=require('sox');var csv=require(_0x788c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x788c('0xa'));var crypto=require(_0x788c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x788c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x788c('0xd'));var Papa=require(_0x788c('0xe'));var Redis=require(_0x788c('0xf'));var authService=require(_0x788c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x788c('0x11'));var hardwareService=require(_0x788c('0x12'));var logger=require(_0x788c('0x13'))(_0x788c('0x14'));var utils=require(_0x788c('0x15'));var config=require('../../config/environment');var db=require(_0x788c('0x16'))['db'];config[_0x788c('0x17')]=_[_0x788c('0x18')](config[_0x788c('0x17')],{'host':_0x788c('0x19'),'port':0x18eb});var socket=require(_0x788c('0x1a'))(new Redis(config[_0x788c('0x17')]));require('./voiceQueue.socket')[_0x788c('0x1b')](socket);function respondWithStatusCode(_0x3e68ed,_0x1c0bc1){_0x1c0bc1=_0x1c0bc1||0xcc;return function(_0x1d6b99){if(_0x1d6b99){return _0x3e68ed[_0x788c('0x1c')](_0x1c0bc1);}return _0x3e68ed[_0x788c('0x1d')](_0x1c0bc1)['end']();};}function respondWithResult(_0x4b320f,_0x10acf1){_0x10acf1=_0x10acf1||0xc8;return function(_0xbbf263){if(_0xbbf263){return _0x4b320f[_0x788c('0x1d')](_0x10acf1)[_0x788c('0x1e')](_0xbbf263);}};}function respondWithFilteredResult(_0x2826bd,_0x41fb6d){return function(_0x93f738){if(_0x93f738){var _0x46470c=_0x93f738[_0x788c('0x1f')],_0x5bbdb6=_0x41fb6d[_0x788c('0x20')],_0x193e89=_0x41fb6d[_0x788c('0x20')]+_0x41fb6d[_0x788c('0x21')],_0x2ed83a;if(_0x193e89>=_0x46470c){_0x193e89=_0x46470c;_0x2ed83a=0xc8;}else{_0x2ed83a=0xce;}_0x2826bd[_0x788c('0x1d')](_0x2ed83a);return _0x2826bd['set'](_0x788c('0x22'),_0x5bbdb6+'-'+_0x193e89+'/'+_0x46470c)[_0x788c('0x1e')](_0x93f738);}return null;};}function patchUpdates(_0xa75f1c){return function(_0x301207){try{jsonpatch[_0x788c('0x23')](_0x301207,_0xa75f1c,!![]);}catch(_0xef764){return BPromise[_0x788c('0x24')](_0xef764);}return _0x301207['save']();};}function saveUpdates(_0x308ea8,_0x1e104f){return function(_0xf2ba15){if(_0xf2ba15){return _0xf2ba15[_0x788c('0x25')](_0x308ea8)[_0x788c('0x26')](function(_0x58dbb4){return _0x58dbb4;});}return null;};}function removeEntity(_0x20d3b0,_0x48f7cd){return function(_0x3d3831){if(_0x3d3831){return _0x3d3831[_0x788c('0x27')]()[_0x788c('0x26')](function(){var _0x1a69e3=_0x3d3831['get']({'plain':!![]});var _0x195bba=[{'name':'VoiceQueues','value':_0x788c('0x28'),'ignore':![]},{'name':_0x788c('0x29'),'value':_0x788c('0x2a'),'ignore':![]}];var _0x4d72b5=_(_0x195bba)[_0x788c('0x2b')](_0x788c('0x2c'))[_0x788c('0x2d')](_0x788c('0x2e'))[_0x788c('0x2e')]();if(_['includes'](_0x4d72b5,_0x1a69e3[_0x788c('0x2f')])){return;}var _0x6431a6=_[_0x788c('0x30')](_0x195bba,['value',_0x1a69e3[_0x788c('0x2f')]])['name'];return db[_0x788c('0x31')][_0x788c('0x27')]({'where':{'type':_0x6431a6,'resourceId':_0x1a69e3['id']}})[_0x788c('0x26')](function(){return _0x3d3831;});})[_0x788c('0x26')](function(){_0x20d3b0['status'](0xcc)[_0x788c('0x32')]();});}};}function handleEntityNotFound(_0x31c523,_0x564d7e){return function(_0x8843a1){if(!_0x8843a1){_0x31c523['sendStatus'](0x194);}return _0x8843a1;};}function handleError(_0x2e08f8,_0x174ae7){_0x174ae7=_0x174ae7||0x1f4;return function(_0x5d9092){logger[_0x788c('0x33')](_0x5d9092['stack']);if(_0x5d9092[_0x788c('0x34')]){delete _0x5d9092['name'];}_0x2e08f8[_0x788c('0x1d')](_0x174ae7)[_0x788c('0x35')](_0x5d9092);};}exports[_0x788c('0x36')]=function(_0x3bd4e9,_0x15ec56){var _0x3d9e7a={},_0x42accd={},_0x5ce618={'count':0x0,'rows':[]};var _0xf50eec=_[_0x788c('0x2d')](db['VoiceQueue'][_0x788c('0x37')],function(_0x110455){return{'name':_0x110455[_0x788c('0x38')],'type':_0x110455[_0x788c('0x2f')][_0x788c('0x39')]};});_0x42accd[_0x788c('0x3a')]=_[_0x788c('0x2d')](_0xf50eec,_0x788c('0x34'));_0x42accd[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x3bd4e9[_0x788c('0x3b')]);_0x42accd[_0x788c('0x3d')]=_[_0x788c('0x3e')](_0x42accd[_0x788c('0x3a')],_0x42accd[_0x788c('0x3b')]);_0x3d9e7a[_0x788c('0x3f')]=_[_0x788c('0x3e')](_0x42accd[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x3bd4e9[_0x788c('0x3b')]['fields']));_0x3d9e7a['attributes']=_0x3d9e7a[_0x788c('0x3f')][_0x788c('0x41')]?_0x3d9e7a['attributes']:_0x42accd[_0x788c('0x3a')];if(!_0x3bd4e9['query'][_0x788c('0x42')](_0x788c('0x43'))){_0x3d9e7a[_0x788c('0x21')]=qs[_0x788c('0x21')](_0x3bd4e9[_0x788c('0x3b')][_0x788c('0x21')]);_0x3d9e7a['offset']=qs[_0x788c('0x20')](_0x3bd4e9[_0x788c('0x3b')][_0x788c('0x20')]);}_0x3d9e7a[_0x788c('0x44')]=qs['sort'](_0x3bd4e9[_0x788c('0x3b')][_0x788c('0x45')]);_0x3d9e7a[_0x788c('0x46')]=qs[_0x788c('0x3d')](_[_0x788c('0x47')](_0x3bd4e9[_0x788c('0x3b')],_0x42accd[_0x788c('0x3d')]),_0xf50eec);if(_0x3bd4e9[_0x788c('0x3b')][_0x788c('0x2b')]){_0x3d9e7a['where']=_[_0x788c('0x48')](_0x3d9e7a['where'],{'$or':_[_0x788c('0x2d')](_0xf50eec,function(_0x144ec9){if(_0x144ec9[_0x788c('0x2f')]!==_0x788c('0x49')){var _0x35a1cb={};_0x35a1cb[_0x144ec9['name']]={'$like':'%'+_0x3bd4e9[_0x788c('0x3b')][_0x788c('0x2b')]+'%'};return _0x35a1cb;}})});}_0x3d9e7a=_['merge']({},_0x3d9e7a,_0x3bd4e9['options']);var _0x546a62={'where':_0x3d9e7a[_0x788c('0x46')]};return db[_0x788c('0x4a')][_0x788c('0x1f')](_0x546a62)[_0x788c('0x26')](function(_0x1930c3){_0x5ce618[_0x788c('0x1f')]=_0x1930c3;if(_0x3bd4e9['query'][_0x788c('0x4b')]){_0x3d9e7a[_0x788c('0x4c')]=[{'all':!![]}];}return db[_0x788c('0x4a')][_0x788c('0x4d')](_0x3d9e7a);})[_0x788c('0x26')](function(_0x2eea70){_0x5ce618[_0x788c('0x4e')]=_0x2eea70;return _0x5ce618;})[_0x788c('0x26')](respondWithFilteredResult(_0x15ec56,_0x3d9e7a))[_0x788c('0x4f')](handleError(_0x15ec56,null));};exports[_0x788c('0x50')]=function(_0x34dc3f,_0x1d05a){var _0x759417={'raw':![],'where':{'id':_0x34dc3f[_0x788c('0x51')]['id']}},_0x164d42={};_0x164d42[_0x788c('0x3a')]=_[_0x788c('0x3c')](db[_0x788c('0x4a')][_0x788c('0x37')]);_0x164d42[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x34dc3f[_0x788c('0x3b')]);_0x164d42[_0x788c('0x3d')]=_[_0x788c('0x3e')](_0x164d42[_0x788c('0x3a')],_0x164d42[_0x788c('0x3b')]);_0x759417['attributes']=_[_0x788c('0x3e')](_0x164d42[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x34dc3f[_0x788c('0x3b')]['fields']));_0x759417[_0x788c('0x3f')]=_0x759417['attributes']['length']?_0x759417[_0x788c('0x3f')]:_0x164d42[_0x788c('0x3a')];if(_0x34dc3f[_0x788c('0x3b')][_0x788c('0x4b')]){_0x759417['include']=[{'all':!![]}];}_0x759417=_[_0x788c('0x48')]({},_0x759417,_0x34dc3f[_0x788c('0x52')]);return db['VoiceQueue'][_0x788c('0x30')](_0x759417)['then'](handleEntityNotFound(_0x1d05a,null))[_0x788c('0x26')](respondWithResult(_0x1d05a,null))[_0x788c('0x4f')](handleError(_0x1d05a,null));};exports['create']=function(_0x4066dc,_0x49a869){return db[_0x788c('0x4a')][_0x788c('0x53')](_0x4066dc[_0x788c('0x54')],{})[_0x788c('0x26')](function(_0x176efd){var _0x119ac2=_0x4066dc[_0x788c('0x55')][_0x788c('0x56')]({'plain':!![]});if(!_0x119ac2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x119ac2[_0x788c('0x57')]==='user'){var _0x5708c5=_0x176efd[_0x788c('0x56')]({'plain':!![]});var _0x333f26=[{'name':'VoiceQueues','value':_0x788c('0x28')},{'name':_0x788c('0x29'),'value':'outbound'}];var _0x3c9b4c=_[_0x788c('0x30')](_0x333f26,[_0x788c('0x2e'),_0x5708c5[_0x788c('0x2f')]])['name'];return db[_0x788c('0x58')][_0x788c('0x30')]({'where':{'name':_0x3c9b4c,'userProfileId':_0x119ac2[_0x788c('0x59')]},'raw':!![]})[_0x788c('0x26')](function(_0x320aeb){if(_0x320aeb&&_0x320aeb['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5708c5[_0x788c('0x34')],'resourceId':_0x5708c5['id'],'type':_0x320aeb[_0x788c('0x34')],'sectionId':_0x320aeb['id']},{})[_0x788c('0x26')](function(){return _0x176efd;});}else{return _0x176efd;}})[_0x788c('0x4f')](function(_0x5ee41c){logger[_0x788c('0x33')](_0x788c('0x5a'),_0x5ee41c);throw _0x5ee41c;});}return _0x176efd;})[_0x788c('0x26')](respondWithResult(_0x49a869,0xc9))[_0x788c('0x4f')](handleError(_0x49a869,null));};exports['clone']=function(_0x5dbe4f,_0x47b7e6){var _0x4d1fa4={'where':{'id':_0x5dbe4f[_0x788c('0x51')]['id']}},_0x25b0d3={};_0x25b0d3[_0x788c('0x3a')]=_['keys'](db[_0x788c('0x4a')][_0x788c('0x37')]);_0x4d1fa4['attributes']=_[_0x788c('0x3e')](_0x25b0d3[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x5dbe4f[_0x788c('0x3b')][_0x788c('0x40')]));_0x4d1fa4[_0x788c('0x3f')]=_0x4d1fa4[_0x788c('0x3f')][_0x788c('0x41')]?_0x4d1fa4[_0x788c('0x3f')]:_0x25b0d3[_0x788c('0x3a')];if(_0x5dbe4f['query'][_0x788c('0x4b')]){_0x4d1fa4[_0x788c('0x4c')]=[{'all':!![]}];}_0x4d1fa4=_[_0x788c('0x48')]({},_0x4d1fa4,_0x5dbe4f[_0x788c('0x52')]);return db[_0x788c('0x4a')][_0x788c('0x30')](_0x4d1fa4)['then'](handleEntityNotFound(_0x47b7e6,null))[_0x788c('0x26')](function(_0x4651bd){if(_0x4651bd){var _0x5d082c=_0x4651bd[_0x788c('0x56')]({'plain':!![]});_0x5d082c=qs[_0x788c('0x5b')](_0x5d082c,['id',_0x788c('0x5c'),_0x788c('0x5d')]);_0x5dbe4f[_0x788c('0x54')]=_[_0x788c('0x5b')](_0x5dbe4f[_0x788c('0x54')],['id',_0x788c('0x5c'),_0x788c('0x5d')]);return db[_0x788c('0x4a')][_0x788c('0x53')](_[_0x788c('0x48')](_0x5d082c,_0x5dbe4f['body']),{'include':_0x5dbe4f[_0x788c('0x3b')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x173ec0){var _0x50a164=_0x5dbe4f['user'][_0x788c('0x56')]({'plain':!![]});if(!_0x50a164)throw new Error(_0x788c('0x5e'));if(_0x50a164[_0x788c('0x57')]===_0x788c('0x55')){var _0x3c6ca5=_0x173ec0[_0x788c('0x56')]({'plain':!![]});var _0x36c0aa=[{'name':_0x788c('0x5f'),'value':_0x788c('0x28')},{'name':_0x788c('0x29'),'value':'outbound'}];var _0x3cd66e=_[_0x788c('0x30')](_0x36c0aa,[_0x788c('0x2e'),_0x3c6ca5[_0x788c('0x2f')]])[_0x788c('0x34')];return db[_0x788c('0x58')]['find']({'where':{'name':_0x3cd66e,'userProfileId':_0x50a164[_0x788c('0x59')]},'raw':!![]})['then'](function(_0x114634){if(_0x114634&&_0x114634[_0x788c('0x60')]===0x0){return db['UserProfileResource'][_0x788c('0x53')]({'name':_0x3c6ca5[_0x788c('0x34')],'resourceId':_0x3c6ca5['id'],'type':_0x114634[_0x788c('0x34')],'sectionId':_0x114634['id']},{})[_0x788c('0x26')](function(){return _0x173ec0;});}else{return _0x173ec0;}})[_0x788c('0x4f')](function(_0x21cde2){logger[_0x788c('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21cde2);throw _0x21cde2;});}return _0x173ec0;});}})[_0x788c('0x26')](respondWithResult(_0x47b7e6,0xc9))['catch'](handleError(_0x47b7e6,null));};exports[_0x788c('0x25')]=function(_0x26d53c,_0xd601c5){if(_0x26d53c[_0x788c('0x54')]['id']){delete _0x26d53c['body']['id'];}return db[_0x788c('0x4a')][_0x788c('0x30')]({'where':{'id':_0x26d53c[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0xd601c5,null))['then'](saveUpdates(_0x26d53c[_0x788c('0x54')],null))[_0x788c('0x26')](respondWithResult(_0xd601c5,null))[_0x788c('0x4f')](handleError(_0xd601c5,null));};exports[_0x788c('0x27')]=function(_0x5c86fe,_0x360572){return db[_0x788c('0x4a')]['find']({'where':{'id':_0x5c86fe[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x360572,null))[_0x788c('0x26')](removeEntity(_0x360572,null))[_0x788c('0x4f')](handleError(_0x360572,null));};exports[_0x788c('0x61')]=function(_0x1b791f,_0xe7b87a,_0x3e31fc){var _0x269758={'raw':![],'where':{}};var _0x151455={};var _0x215c71={'count':0x0,'rows':[]};return db[_0x788c('0x4a')][_0x788c('0x62')]({'where':{'id':_0x1b791f['params']['id']}})['then'](handleEntityNotFound(_0xe7b87a,null))[_0x788c('0x26')](function(_0x4695a2){if(_0x4695a2){_0x151455['model']=_['keys'](db[_0x788c('0x63')]['rawAttributes']);_0x151455[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x1b791f[_0x788c('0x3b')]);_0x151455[_0x788c('0x3d')]=_['intersection'](_0x151455[_0x788c('0x3a')],_0x151455[_0x788c('0x3b')]);_0x269758[_0x788c('0x3f')]=_[_0x788c('0x3e')](_0x151455[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x1b791f['query'][_0x788c('0x40')]));_0x269758[_0x788c('0x3f')]=_0x269758[_0x788c('0x3f')]['length']?_0x269758[_0x788c('0x3f')]:_0x151455[_0x788c('0x3a')];if(!_0x1b791f[_0x788c('0x3b')][_0x788c('0x42')](_0x788c('0x43'))){_0x269758[_0x788c('0x21')]=qs['limit'](_0x1b791f[_0x788c('0x3b')][_0x788c('0x21')]);_0x269758[_0x788c('0x20')]=qs[_0x788c('0x20')](_0x1b791f[_0x788c('0x3b')]['offset']);}_0x269758['order']=qs[_0x788c('0x45')](_0x1b791f[_0x788c('0x3b')]['sort']);_0x269758[_0x788c('0x46')]=qs[_0x788c('0x3d')](_[_0x788c('0x47')](_0x1b791f[_0x788c('0x3b')],_0x151455[_0x788c('0x3d')]));_0x269758[_0x788c('0x46')][_0x788c('0x64')]=_0x4695a2['id'];if(_0x1b791f['query']['filter']){_0x269758['where']=_[_0x788c('0x48')](_0x269758[_0x788c('0x46')],{'$or':_[_0x788c('0x2d')](_0x269758['attributes'],function(_0x117a1f){var _0x2122b1={};_0x2122b1[_0x117a1f]={'$like':'%'+_0x1b791f['query'][_0x788c('0x2b')]+'%'};return _0x2122b1;})});}_0x269758=_[_0x788c('0x48')]({},_0x269758,_0x1b791f['options']);return db[_0x788c('0x63')][_0x788c('0x1f')]({'where':_0x269758[_0x788c('0x46')]})[_0x788c('0x26')](function(_0x383186){_0x215c71[_0x788c('0x1f')]=_0x383186;if(_0x1b791f[_0x788c('0x3b')]['includeAll']){_0x269758[_0x788c('0x4c')]=[{'all':!![]}];}return db[_0x788c('0x63')][_0x788c('0x4d')](_0x269758);})['then'](function(_0x4a981e){_0x215c71[_0x788c('0x4e')]=_0x4a981e;return _0x215c71;});}})[_0x788c('0x26')](respondWithFilteredResult(_0xe7b87a,_0x269758))[_0x788c('0x4f')](handleError(_0xe7b87a,null));};exports['getHopperHistories']=function(_0x2ca145,_0x5e640b,_0x4152a6){var _0x308d9a={'raw':!![],'where':{}};var _0x5e4f0e={};var _0x1f77ab={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x788c('0x62')]({'where':{'id':_0x2ca145[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x5e640b,null))[_0x788c('0x26')](function(_0x17c4b3){if(_0x17c4b3){_0x5e4f0e[_0x788c('0x3a')]=_[_0x788c('0x3c')](db[_0x788c('0x65')][_0x788c('0x37')]);_0x5e4f0e[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x2ca145[_0x788c('0x3b')]);_0x5e4f0e[_0x788c('0x3d')]=_[_0x788c('0x3e')](_0x5e4f0e[_0x788c('0x3a')],_0x5e4f0e[_0x788c('0x3b')]);_0x308d9a[_0x788c('0x3f')]=_[_0x788c('0x3e')](_0x5e4f0e['model'],qs[_0x788c('0x40')](_0x2ca145[_0x788c('0x3b')][_0x788c('0x40')]));_0x308d9a[_0x788c('0x3f')]=_0x308d9a[_0x788c('0x3f')][_0x788c('0x41')]?_0x308d9a['attributes']:_0x5e4f0e[_0x788c('0x3a')];if(!_0x2ca145[_0x788c('0x3b')][_0x788c('0x42')](_0x788c('0x43'))){_0x308d9a[_0x788c('0x21')]=qs[_0x788c('0x21')](_0x2ca145[_0x788c('0x3b')][_0x788c('0x21')]);_0x308d9a[_0x788c('0x20')]=qs[_0x788c('0x20')](_0x2ca145[_0x788c('0x3b')][_0x788c('0x20')]);}_0x308d9a[_0x788c('0x44')]=qs[_0x788c('0x45')](_0x2ca145[_0x788c('0x3b')]['sort']);_0x308d9a[_0x788c('0x46')]=qs[_0x788c('0x3d')](_['pick'](_0x2ca145[_0x788c('0x3b')],_0x5e4f0e[_0x788c('0x3d')]));_0x308d9a[_0x788c('0x46')][_0x788c('0x64')]=_0x17c4b3['id'];if(_0x2ca145[_0x788c('0x3b')][_0x788c('0x2b')]){_0x308d9a[_0x788c('0x46')]=_[_0x788c('0x48')](_0x308d9a[_0x788c('0x46')],{'$or':_[_0x788c('0x2d')](_0x308d9a['attributes'],function(_0x3bc4f9){var _0x26ea64={};_0x26ea64[_0x3bc4f9]={'$like':'%'+_0x2ca145[_0x788c('0x3b')][_0x788c('0x2b')]+'%'};return _0x26ea64;})});}_0x308d9a=_[_0x788c('0x48')]({},_0x308d9a,_0x2ca145['options']);return db[_0x788c('0x65')][_0x788c('0x1f')]({'where':_0x308d9a[_0x788c('0x46')]})[_0x788c('0x26')](function(_0x5075c3){_0x1f77ab['count']=_0x5075c3;if(_0x2ca145[_0x788c('0x3b')][_0x788c('0x4b')]){_0x308d9a[_0x788c('0x4c')]=[{'all':!![]}];}return db[_0x788c('0x65')][_0x788c('0x4d')](_0x308d9a);})[_0x788c('0x26')](function(_0x4818c3){_0x1f77ab[_0x788c('0x4e')]=_0x4818c3;return _0x1f77ab;});}})[_0x788c('0x26')](respondWithFilteredResult(_0x5e640b,_0x308d9a))[_0x788c('0x4f')](handleError(_0x5e640b,null));};exports[_0x788c('0x66')]=function(_0x2b6dba,_0x477332,_0x36e873){var _0x72be80={'raw':!![],'where':{}};var _0x35bfee={};var _0x3a0e7d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2b6dba[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x477332,null))[_0x788c('0x26')](function(_0x32953d){if(_0x32953d){_0x35bfee[_0x788c('0x3a')]=_[_0x788c('0x3c')](db[_0x788c('0x67')][_0x788c('0x37')]);_0x35bfee[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x2b6dba[_0x788c('0x3b')]);_0x35bfee[_0x788c('0x3d')]=_[_0x788c('0x3e')](_0x35bfee[_0x788c('0x3a')],_0x35bfee[_0x788c('0x3b')]);_0x72be80[_0x788c('0x3f')]=_[_0x788c('0x3e')](_0x35bfee[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x2b6dba[_0x788c('0x3b')][_0x788c('0x40')]));_0x72be80[_0x788c('0x3f')]=_0x72be80[_0x788c('0x3f')][_0x788c('0x41')]?_0x72be80[_0x788c('0x3f')]:_0x35bfee[_0x788c('0x3a')];if(!_0x2b6dba[_0x788c('0x3b')][_0x788c('0x42')](_0x788c('0x43'))){_0x72be80[_0x788c('0x21')]=qs[_0x788c('0x21')](_0x2b6dba['query'][_0x788c('0x21')]);_0x72be80[_0x788c('0x20')]=qs[_0x788c('0x20')](_0x2b6dba[_0x788c('0x3b')][_0x788c('0x20')]);}_0x72be80['order']=qs[_0x788c('0x45')](_0x2b6dba[_0x788c('0x3b')]['sort']);_0x72be80[_0x788c('0x46')]=qs[_0x788c('0x3d')](_[_0x788c('0x47')](_0x2b6dba[_0x788c('0x3b')],_0x35bfee[_0x788c('0x3d')]));_0x72be80[_0x788c('0x46')][_0x788c('0x64')]=_0x32953d['id'];if(_0x2b6dba[_0x788c('0x3b')][_0x788c('0x2b')]){_0x72be80[_0x788c('0x46')]=_[_0x788c('0x48')](_0x72be80[_0x788c('0x46')],{'$or':_[_0x788c('0x2d')](_0x72be80['attributes'],function(_0x1363ba){var _0x1e9a3d={};_0x1e9a3d[_0x1363ba]={'$like':'%'+_0x2b6dba[_0x788c('0x3b')]['filter']+'%'};return _0x1e9a3d;})});}_0x72be80=_['merge']({},_0x72be80,_0x2b6dba[_0x788c('0x52')]);return db[_0x788c('0x67')][_0x788c('0x1f')]({'where':_0x72be80[_0x788c('0x46')]})[_0x788c('0x26')](function(_0x3af27a){_0x3a0e7d[_0x788c('0x1f')]=_0x3af27a;if(_0x2b6dba[_0x788c('0x3b')]['includeAll']){_0x72be80[_0x788c('0x4c')]=[{'all':!![]}];}return db[_0x788c('0x67')][_0x788c('0x4d')](_0x72be80);})['then'](function(_0x426103){_0x3a0e7d[_0x788c('0x4e')]=_0x426103;return _0x3a0e7d;});}})[_0x788c('0x26')](respondWithFilteredResult(_0x477332,_0x72be80))[_0x788c('0x4f')](handleError(_0x477332,null));};exports[_0x788c('0x68')]=function(_0x25a83d,_0x1181f8,_0x4e4745){var _0xc9aa4b={'raw':!![],'where':{}};var _0x2dc214={};var _0x5b185e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x25a83d['params']['id']}})['then'](handleEntityNotFound(_0x1181f8,null))[_0x788c('0x26')](function(_0x2e4dd6){if(_0x2e4dd6){_0x2dc214[_0x788c('0x3a')]=_[_0x788c('0x3c')](db[_0x788c('0x69')][_0x788c('0x37')]);_0x2dc214[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x25a83d[_0x788c('0x3b')]);_0x2dc214[_0x788c('0x3d')]=_[_0x788c('0x3e')](_0x2dc214['model'],_0x2dc214['query']);_0xc9aa4b[_0x788c('0x3f')]=_[_0x788c('0x3e')](_0x2dc214[_0x788c('0x3a')],qs['fields'](_0x25a83d['query'][_0x788c('0x40')]));_0xc9aa4b['attributes']=_0xc9aa4b[_0x788c('0x3f')][_0x788c('0x41')]?_0xc9aa4b['attributes']:_0x2dc214['model'];if(!_0x25a83d['query'][_0x788c('0x42')]('nolimit')){_0xc9aa4b[_0x788c('0x21')]=qs['limit'](_0x25a83d['query']['limit']);_0xc9aa4b[_0x788c('0x20')]=qs[_0x788c('0x20')](_0x25a83d[_0x788c('0x3b')][_0x788c('0x20')]);}_0xc9aa4b[_0x788c('0x44')]=qs[_0x788c('0x45')](_0x25a83d['query']['sort']);_0xc9aa4b[_0x788c('0x46')]=qs[_0x788c('0x3d')](_[_0x788c('0x47')](_0x25a83d[_0x788c('0x3b')],_0x2dc214[_0x788c('0x3d')]));_0xc9aa4b[_0x788c('0x46')][_0x788c('0x64')]=_0x2e4dd6['id'];if(_0x25a83d[_0x788c('0x3b')][_0x788c('0x2b')]){_0xc9aa4b[_0x788c('0x46')]=_['merge'](_0xc9aa4b[_0x788c('0x46')],{'$or':_[_0x788c('0x2d')](_0xc9aa4b[_0x788c('0x3f')],function(_0x5c2ca1){var _0x46b5b5={};_0x46b5b5[_0x5c2ca1]={'$like':'%'+_0x25a83d[_0x788c('0x3b')][_0x788c('0x2b')]+'%'};return _0x46b5b5;})});}_0xc9aa4b=_[_0x788c('0x48')]({},_0xc9aa4b,_0x25a83d[_0x788c('0x52')]);return db[_0x788c('0x69')][_0x788c('0x1f')]({'where':_0xc9aa4b[_0x788c('0x46')]})[_0x788c('0x26')](function(_0x2f6733){_0x5b185e['count']=_0x2f6733;if(_0x25a83d[_0x788c('0x3b')]['includeAll']){_0xc9aa4b[_0x788c('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x788c('0x4d')](_0xc9aa4b);})[_0x788c('0x26')](function(_0x20d467){_0x5b185e[_0x788c('0x4e')]=_0x20d467;return _0x5b185e;});}})[_0x788c('0x26')](respondWithFilteredResult(_0x1181f8,_0xc9aa4b))[_0x788c('0x4f')](handleError(_0x1181f8,null));};exports[_0x788c('0x6a')]=function(_0x434bc7,_0x3ff88d,_0x473990){var _0x1c0b82={};var _0x54cbf8={};var _0x1f6bbd;var _0x4553ee;return db[_0x788c('0x4a')][_0x788c('0x62')]({'where':{'id':_0x434bc7[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x3ff88d,null))[_0x788c('0x26')](function(_0x4733e8){if(_0x4733e8){_0x1f6bbd=_0x4733e8;_0x54cbf8[_0x788c('0x3a')]=_[_0x788c('0x3c')](db[_0x788c('0x6b')][_0x788c('0x37')]);_0x54cbf8[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x434bc7[_0x788c('0x3b')]);_0x54cbf8['filters']=_[_0x788c('0x3e')](_0x54cbf8[_0x788c('0x3a')],_0x54cbf8['query']);_0x1c0b82[_0x788c('0x3f')]=_['intersection'](_0x54cbf8[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x434bc7[_0x788c('0x3b')][_0x788c('0x40')]));_0x1c0b82[_0x788c('0x3f')]=_0x1c0b82[_0x788c('0x3f')][_0x788c('0x41')]?_0x1c0b82[_0x788c('0x3f')]:_0x54cbf8[_0x788c('0x3a')];_0x1c0b82[_0x788c('0x44')]=qs['sort'](_0x434bc7[_0x788c('0x3b')][_0x788c('0x45')]);_0x1c0b82['where']=qs[_0x788c('0x3d')](_[_0x788c('0x47')](_0x434bc7['query'],_0x54cbf8['filters']));if(_0x434bc7[_0x788c('0x3b')][_0x788c('0x2b')]){_0x1c0b82[_0x788c('0x46')]=_[_0x788c('0x48')](_0x1c0b82['where'],{'$or':_[_0x788c('0x2d')](_0x1c0b82[_0x788c('0x3f')],function(_0x43e51d){var _0x1a1929={};_0x1a1929[_0x43e51d]={'$like':'%'+_0x434bc7[_0x788c('0x3b')]['filter']+'%'};return _0x1a1929;})});}_0x1c0b82=_[_0x788c('0x48')]({},_0x1c0b82,_0x434bc7[_0x788c('0x52')]);return _0x1f6bbd['getTeams'](_0x1c0b82);}})[_0x788c('0x26')](function(_0x206cd2){if(_0x206cd2){_0x4553ee=_0x206cd2['length'];if(!_0x434bc7[_0x788c('0x3b')][_0x788c('0x42')](_0x788c('0x43'))){_0x1c0b82['limit']=qs[_0x788c('0x21')](_0x434bc7[_0x788c('0x3b')][_0x788c('0x21')]);_0x1c0b82[_0x788c('0x20')]=qs[_0x788c('0x20')](_0x434bc7[_0x788c('0x3b')]['offset']);}return _0x1f6bbd[_0x788c('0x6a')](_0x1c0b82);}})['then'](function(_0x50f6f4){if(_0x50f6f4){return _0x50f6f4?{'count':_0x4553ee,'rows':_0x50f6f4}:null;}})[_0x788c('0x26')](respondWithResult(_0x3ff88d,null))['catch'](handleError(_0x3ff88d,null));};exports[_0x788c('0x6c')]=function(_0x558b5d,_0x1a1e23,_0x14ec29){var _0x250b00=_0x558b5d[_0x788c('0x54')][_0x788c('0x6d')];var _0x3def38=_[_0x788c('0x2d')](_0x250b00,'id');return db[_0x788c('0x6b')][_0x788c('0x4d')]({'where':{'id':_0x3def38},'attributes':['id'],'include':[{'model':db[_0x788c('0x6e')],'as':_0x788c('0x6f'),'attributes':['id',_0x788c('0x34'),_0x788c('0x70'),_0x788c('0x71'),_0x788c('0x72')],'raw':!![]}]})[_0x788c('0x26')](function(_0x3fab76){if(_0x3fab76){var _0x380915=_[_0x788c('0x73')](_0x3fab76,function(_0x231028){var _0x5200d2=_0x231028[_0x788c('0x56')]({'plain':!![]});_0x5200d2[_0x788c('0x6f')][_0x788c('0x74')](function(_0x3a81d8){_0x3a81d8['penalty']=_[_0x788c('0x30')](_0x250b00,{'id':_0x5200d2['id']})[_0x788c('0x75')];});return _0x5200d2[_0x788c('0x6f')];});return db[_0x788c('0x4a')][_0x788c('0x30')]({'where':{'id':_0x558b5d[_0x788c('0x51')]['id']}})[_0x788c('0x26')](function(_0x30352e){return db[_0x788c('0x76')][_0x788c('0x77')](function(_0x4e757d){return _0x30352e[_0x788c('0x6c')](_0x3def38,{'transaction':_0x4e757d})[_0x788c('0x26')](function(){return BPromise[_0x788c('0x78')](_0x380915,function(_0x1c9eab){return db[_0x788c('0x79')]['findOrCreate']({'where':{'UserId':_0x1c9eab['id'],'VoiceQueueId':_0x558b5d[_0x788c('0x51')]['id']},'defaults':{'penalty':_0x1c9eab[_0x788c('0x75')]},'transaction':_0x4e757d});});})[_0x788c('0x26')](function(){return BPromise[_0x788c('0x78')](_[_0x788c('0x2b')](_0x380915,{'online':!![]}),function(_0x1542ae){return db[_0x788c('0x7a')][_0x788c('0x7b')]({'membername':_0x1542ae[_0x788c('0x34')],'UserId':_0x1542ae['id'],'queue_name':_0x30352e[_0x788c('0x34')],'VoiceQueueId':_0x30352e['id'],'interface':_[_0x788c('0x7c')](_0x1542ae['interface'])?util[_0x788c('0x7d')](_0x788c('0x7e'),_0x1542ae['name']):_0x1542ae[_0x788c('0x72')],'paused':_0x1542ae[_0x788c('0x71')]||![],'penalty':_0x1542ae[_0x788c('0x75')]},{'transaction':_0x4e757d});});})[_0x788c('0x26')](function(){_0x380915['forEach'](function(_0x4b9ffb){socket[_0x788c('0x7f')]('userVoiceQueue:save',{'UserId':_0x4b9ffb['id'],'VoiceQueueId':_0x30352e['id']});});});});});}})['then'](respondWithStatusCode(_0x1a1e23,null))[_0x788c('0x4f')](handleError(_0x1a1e23,null));};exports['removeTeams']=function(_0x333ab4,_0x444744,_0x211e14){return db[_0x788c('0x6b')][_0x788c('0x4d')]({'where':{'id':_0x333ab4[_0x788c('0x3b')][_0x788c('0x80')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x788c('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x788c('0x26')](handleEntityNotFound(_0x444744,null))['then'](function(_0x22af88){var _0x32f726=_[_0x788c('0x2d')](_0x22af88,'id');var _0x402705=[];var _0x39ec2a=[];var _0x13148a=squel[_0x788c('0x81')]();_0x13148a['field'](_0x788c('0x82'))[_0x788c('0x83')](_0x788c('0x84'),'tq')[_0x788c('0x85')](_0x788c('0x86'),'ut',_0x788c('0x87'))[_0x788c('0x46')](_0x788c('0x88'),_0x333ab4[_0x788c('0x51')]['id']);for(var _0x34bb55=0x0;_0x34bb55<_0x22af88[_0x788c('0x41')];_0x34bb55+=0x1){let _0x1814ca=_0x22af88[_0x34bb55];for(var _0x23073b=0x0;_0x23073b<_0x1814ca[_0x788c('0x6f')][_0x788c('0x41')];_0x23073b+=0x1){let _0x60adc0=_0x1814ca[_0x788c('0x6f')][_0x23073b];var _0x13e2f5=_0x13148a[_0x788c('0x89')]();_0x13e2f5[_0x788c('0x46')](_0x788c('0x8a'),_0x60adc0['id']);_0x39ec2a[_0x788c('0x8b')](db['sequelize'][_0x788c('0x3b')](_0x13e2f5[_0x788c('0x8c')](),{'type':db[_0x788c('0x76')][_0x788c('0x8d')][_0x788c('0x8e')]})[_0x788c('0x26')](function(_0x436654){if(_0x436654[_0x788c('0x41')]===0x1){return _0x60adc0['id'];}else{var _0x2449bd=_['every'](_[_0x788c('0x2d')](_0x436654,_0x788c('0x8f')),function(_0x2ec097){return _[_0x788c('0x90')](_0x32f726,_0x2ec097);});if(_0x2449bd){return _0x60adc0['id'];}}}));}}return BPromise['all'](_0x39ec2a)[_0x788c('0x26')](function(_0x20d641){_0x402705=_(_0x402705)[_0x788c('0x91')](_0x20d641)[_0x788c('0x92')]()[_0x788c('0x2e')]();return db[_0x788c('0x4a')][_0x788c('0x30')]({'where':{'id':_0x333ab4[_0x788c('0x51')]['id']}})[_0x788c('0x26')](function(_0x1879ee){return db[_0x788c('0x76')][_0x788c('0x77')](function(_0x3a1ee2){return _0x1879ee[_0x788c('0x93')](_0x333ab4['query'][_0x788c('0x80')],{'transaction':_0x3a1ee2})['then'](function(){if(!_[_0x788c('0x94')](_0x402705)){return _0x1879ee['removeAgents'](_0x402705,{'transaction':_0x3a1ee2})['then'](function(){return db[_0x788c('0x7a')][_0x788c('0x27')]({'where':{'VoiceQueueId':_0x333ab4[_0x788c('0x51')]['id'],'UserId':_0x402705},'transaction':_0x3a1ee2});});}})[_0x788c('0x26')](function(){_0x402705[_0x788c('0x74')](function(_0x107fab){socket[_0x788c('0x7f')]('userVoiceQueue:remove',{'UserId':_0x107fab,'VoiceQueueId':_0x1879ee['id']});});});});});});})['then'](respondWithStatusCode(_0x444744,null))[_0x788c('0x4f')](handleError(_0x444744,null));};exports['addAgents']=function(_0x41433f,_0x29b1a4,_0x2ae74e){var _0x52120,_0x4d92ff;return db[_0x788c('0x4a')][_0x788c('0x30')]({'where':{'id':_0x41433f['params']['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x29b1a4,null))[_0x788c('0x26')](function(_0x150733){if(_0x150733){_0x4d92ff=_0x150733;return _0x150733[_0x788c('0x95')](_0x41433f[_0x788c('0x54')][_0x788c('0x80')],_[_0x788c('0x5b')](_0x41433f[_0x788c('0x54')],['ids','id'])||{})[_0x788c('0x96')](function(_0x3aecd2){for(var _0x3312d8=0x0;_0x3312d8<_0x41433f[_0x788c('0x54')]['ids']['length'];_0x3312d8+=0x1){socket[_0x788c('0x7f')]('userVoiceQueue:save',{'UserId':_0x41433f[_0x788c('0x54')][_0x788c('0x80')][_0x3312d8],'VoiceQueueId':_0x41433f[_0x788c('0x51')]['id']});}return _0x3aecd2;});}})[_0x788c('0x26')](function(_0x57d36e){_0x52120=_0x57d36e||[];if(_0x4d92ff){return db[_0x788c('0x6e')][_0x788c('0x4d')]({'where':{'id':_0x41433f[_0x788c('0x54')][_0x788c('0x80')]},'attributes':['id',_0x788c('0x34'),_0x788c('0x70'),_0x788c('0x71'),_0x788c('0x72')],'raw':!![]});}})[_0x788c('0x26')](function(_0x52a618){if(!_['isEmpty'](_0x52a618)){var _0x87c2ee=[];for(var _0x8d3484=0x0;_0x8d3484<_0x52a618[_0x788c('0x41')];_0x8d3484++){if(_0x52a618[_0x8d3484]['online']){_0x87c2ee[_0x788c('0x8b')](db[_0x788c('0x7a')][_0x788c('0x7b')]({'membername':_0x52a618[_0x8d3484][_0x788c('0x34')],'UserId':_0x52a618[_0x8d3484]['id'],'queue_name':_0x4d92ff['name'],'VoiceQueueId':_0x4d92ff['id'],'interface':_[_0x788c('0x7c')](_0x52a618[_0x8d3484][_0x788c('0x72')])?util['format'](_0x788c('0x7e'),_0x52a618[_0x8d3484][_0x788c('0x34')]):_0x52a618[_0x8d3484][_0x788c('0x72')],'paused':_0x52a618[_0x8d3484]['voicePause']||![],'penalty':_0x41433f['body'][_0x788c('0x75')]||0x0}));}}return BPromise[_0x788c('0x97')](_0x87c2ee);}})[_0x788c('0x26')](function(){return _0x52120;})[_0x788c('0x26')](respondWithResult(_0x29b1a4,null))[_0x788c('0x4f')](handleError(_0x29b1a4,null));};exports[_0x788c('0x98')]=function(_0x3bfbdd,_0x28194a,_0x341902){return db[_0x788c('0x4a')][_0x788c('0x30')]({'where':{'id':_0x3bfbdd['params']['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x28194a,null))[_0x788c('0x26')](function(_0x516ed5){if(_0x516ed5){return _0x516ed5[_0x788c('0x98')](_0x3bfbdd[_0x788c('0x3b')][_0x788c('0x80')])[_0x788c('0x26')](function(){if(_['isArray'](_0x3bfbdd[_0x788c('0x3b')][_0x788c('0x80')])){for(var _0x492b0c=0x0;_0x492b0c<_0x3bfbdd[_0x788c('0x3b')][_0x788c('0x80')][_0x788c('0x41')];_0x492b0c+=0x1){socket['emit'](_0x788c('0x99'),{'UserId':Number(_0x3bfbdd['query']['ids'][_0x492b0c]),'VoiceQueueId':Number(_0x3bfbdd[_0x788c('0x51')]['id'])});}}else{socket['emit'](_0x788c('0x99'),{'UserId':Number(_0x3bfbdd[_0x788c('0x3b')]['ids']),'VoiceQueueId':Number(_0x3bfbdd[_0x788c('0x51')]['id'])});}});}})['then'](function(_0x3e3cd3){return db[_0x788c('0x7a')]['destroy']({'where':{'VoiceQueueId':_0x3bfbdd['params']['id'],'UserId':_0x3bfbdd[_0x788c('0x3b')][_0x788c('0x80')]}})[_0x788c('0x26')](function(){return _0x3e3cd3;});})[_0x788c('0x26')](respondWithStatusCode(_0x28194a,null))[_0x788c('0x4f')](handleError(_0x28194a,null));};exports[_0x788c('0x9a')]=function(_0x54936c,_0x470b3a,_0x4d0046){var _0x41c804={};var _0x2c534e={};var _0xeb81ee;var _0x24a699;return db[_0x788c('0x4a')][_0x788c('0x62')]({'where':{'id':_0x54936c[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x470b3a,null))['then'](function(_0x35633f){if(_0x35633f){_0xeb81ee=_0x35633f;_0x2c534e[_0x788c('0x3a')]=_[_0x788c('0x3c')](db[_0x788c('0x6e')][_0x788c('0x37')]);_0x2c534e[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x54936c[_0x788c('0x3b')]);_0x2c534e['filters']=_['intersection'](_0x2c534e[_0x788c('0x3a')],_0x2c534e[_0x788c('0x3b')]);_0x41c804['attributes']=_[_0x788c('0x3e')](_0x2c534e[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x54936c[_0x788c('0x3b')]['fields']));_0x41c804[_0x788c('0x3f')]=_0x41c804[_0x788c('0x3f')][_0x788c('0x41')]?_0x41c804[_0x788c('0x3f')]:_0x2c534e[_0x788c('0x3a')];_0x41c804[_0x788c('0x44')]=qs[_0x788c('0x45')](_0x54936c[_0x788c('0x3b')][_0x788c('0x45')]);_0x41c804[_0x788c('0x46')]=qs['filters'](_[_0x788c('0x47')](_0x54936c[_0x788c('0x3b')],_0x2c534e[_0x788c('0x3d')]));if(_0x54936c[_0x788c('0x3b')][_0x788c('0x2b')]){_0x41c804[_0x788c('0x46')]=_[_0x788c('0x48')](_0x41c804[_0x788c('0x46')],{'$or':_[_0x788c('0x2d')](_0x41c804[_0x788c('0x3f')],function(_0x18b6b6){var _0x104616={};_0x104616[_0x18b6b6]={'$like':'%'+_0x54936c[_0x788c('0x3b')]['filter']+'%'};return _0x104616;})});}_0x41c804=_[_0x788c('0x48')]({},_0x41c804,_0x54936c[_0x788c('0x52')]);return _0xeb81ee[_0x788c('0x9a')](_0x41c804);}})[_0x788c('0x26')](function(_0x3fb6d2){if(_0x3fb6d2){_0x24a699=_0x3fb6d2[_0x788c('0x41')];if(!_0x54936c[_0x788c('0x3b')][_0x788c('0x42')](_0x788c('0x43'))){_0x41c804[_0x788c('0x21')]=qs[_0x788c('0x21')](_0x54936c[_0x788c('0x3b')]['limit']);_0x41c804[_0x788c('0x20')]=qs[_0x788c('0x20')](_0x54936c[_0x788c('0x3b')][_0x788c('0x20')]);}return _0xeb81ee['getAgents'](_0x41c804);}})['then'](function(_0x53db51){if(_0x53db51){return _0x53db51?{'count':_0x24a699,'rows':_0x53db51}:null;}})[_0x788c('0x26')](respondWithResult(_0x470b3a,null))['catch'](handleError(_0x470b3a,null));};exports['getMembers']=function(_0x3f5dc1,_0x416be3,_0x267313){var _0x59e4ec={};var _0x4105c3={};var _0x9cd95c;var _0x2cddba;return db['VoiceQueue'][_0x788c('0x62')]({'where':{'id':_0x3f5dc1[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x416be3,null))['then'](function(_0x52e22e){if(_0x52e22e){_0x9cd95c=_0x52e22e;_0x4105c3[_0x788c('0x3a')]=_[_0x788c('0x3c')](db[_0x788c('0x7a')][_0x788c('0x37')]);_0x4105c3['query']=_[_0x788c('0x3c')](_0x3f5dc1['query']);_0x4105c3[_0x788c('0x3d')]=_[_0x788c('0x3e')](_0x4105c3[_0x788c('0x3a')],_0x4105c3[_0x788c('0x3b')]);_0x59e4ec['attributes']=_[_0x788c('0x3e')](_0x4105c3[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x3f5dc1[_0x788c('0x3b')][_0x788c('0x40')]));_0x59e4ec['attributes']=_0x59e4ec['attributes'][_0x788c('0x41')]?_0x59e4ec['attributes']:_0x4105c3[_0x788c('0x3a')];_0x59e4ec[_0x788c('0x44')]=qs['sort'](_0x3f5dc1[_0x788c('0x3b')][_0x788c('0x45')]);_0x59e4ec[_0x788c('0x46')]=qs['filters'](_['pick'](_0x3f5dc1[_0x788c('0x3b')],_0x4105c3[_0x788c('0x3d')]));if(_0x3f5dc1[_0x788c('0x3b')][_0x788c('0x2b')]){_0x59e4ec[_0x788c('0x46')]=_['merge'](_0x59e4ec[_0x788c('0x46')],{'$or':_[_0x788c('0x2d')](_0x59e4ec[_0x788c('0x3f')],function(_0x1a933a){var _0x261b39={};_0x261b39[_0x1a933a]={'$like':'%'+_0x3f5dc1[_0x788c('0x3b')][_0x788c('0x2b')]+'%'};return _0x261b39;})});}_0x59e4ec=_['merge']({},_0x59e4ec,_0x3f5dc1[_0x788c('0x52')]);return _0x9cd95c[_0x788c('0x9b')](_0x59e4ec);}})['then'](function(_0x3bc037){if(_0x3bc037){_0x2cddba=_0x3bc037['length'];if(!_0x3f5dc1['query'][_0x788c('0x42')]('nolimit')){_0x59e4ec[_0x788c('0x21')]=qs['limit'](_0x3f5dc1[_0x788c('0x3b')][_0x788c('0x21')]);_0x59e4ec[_0x788c('0x20')]=qs[_0x788c('0x20')](_0x3f5dc1['query']['offset']);}return _0x9cd95c[_0x788c('0x9b')](_0x59e4ec);}})[_0x788c('0x26')](function(_0x3f224e){return _0x3f224e?{'count':_0x2cddba,'rows':_0x3f224e}:null;})[_0x788c('0x26')](respondWithResult(_0x416be3,null))['catch'](handleError(_0x416be3,null));};exports[_0x788c('0x9c')]=function(_0x210ea9,_0x136c0a,_0x1ebd22){var _0x4bc143={};var _0x5da1d1={};var _0x55a737;var _0x36eccc;return db[_0x788c('0x4a')]['findOne']({'where':{'id':_0x210ea9[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x136c0a,null))[_0x788c('0x26')](function(_0x476c8d){if(_0x476c8d){_0x55a737=_0x476c8d;_0x5da1d1[_0x788c('0x3a')]=_['keys'](db[_0x788c('0x9d')][_0x788c('0x37')]);_0x5da1d1[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x210ea9[_0x788c('0x3b')]);_0x5da1d1[_0x788c('0x3d')]=_[_0x788c('0x3e')](_0x5da1d1['model'],_0x5da1d1[_0x788c('0x3b')]);_0x4bc143[_0x788c('0x3f')]=_[_0x788c('0x3e')](_0x5da1d1['model'],qs[_0x788c('0x40')](_0x210ea9[_0x788c('0x3b')][_0x788c('0x40')]));_0x4bc143[_0x788c('0x3f')]=_0x4bc143[_0x788c('0x3f')][_0x788c('0x41')]?_0x4bc143['attributes']:_0x5da1d1[_0x788c('0x3a')];_0x4bc143[_0x788c('0x44')]=qs[_0x788c('0x45')](_0x210ea9[_0x788c('0x3b')][_0x788c('0x45')]);_0x4bc143[_0x788c('0x46')]=qs[_0x788c('0x3d')](_[_0x788c('0x47')](_0x210ea9['query'],_0x5da1d1[_0x788c('0x3d')]));if(_0x210ea9['query']['filter']){_0x4bc143[_0x788c('0x46')]=_[_0x788c('0x48')](_0x4bc143['where'],{'$or':_[_0x788c('0x2d')](_0x4bc143[_0x788c('0x3f')],function(_0x3e6812){var _0x2f2317={};_0x2f2317[_0x3e6812]={'$like':'%'+_0x210ea9[_0x788c('0x3b')][_0x788c('0x2b')]+'%'};return _0x2f2317;})});}_0x4bc143=_[_0x788c('0x48')]({},_0x4bc143,_0x210ea9[_0x788c('0x52')]);return _0x55a737['getLists'](_0x4bc143);}})[_0x788c('0x26')](function(_0x2a9ac5){if(_0x2a9ac5){_0x36eccc=_0x2a9ac5['length'];if(!_0x210ea9[_0x788c('0x3b')]['hasOwnProperty']('nolimit')){_0x4bc143[_0x788c('0x21')]=qs[_0x788c('0x21')](_0x210ea9[_0x788c('0x3b')]['limit']);_0x4bc143[_0x788c('0x20')]=qs[_0x788c('0x20')](_0x210ea9['query'][_0x788c('0x20')]);}return _0x55a737[_0x788c('0x9c')](_0x4bc143);}})['then'](function(_0x2f7a1c){if(_0x2f7a1c){return _0x2f7a1c?{'count':_0x36eccc,'rows':_0x2f7a1c}:null;}})[_0x788c('0x26')](respondWithResult(_0x136c0a,null))[_0x788c('0x4f')](handleError(_0x136c0a,null));};exports[_0x788c('0x9e')]=function(_0x2ef77f,_0x330215,_0x2e5f86){var _0x2e9ff0,_0x4a88ea;return db['VoiceQueue']['find']({'where':{'id':_0x2ef77f[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x330215,null))[_0x788c('0x26')](function(_0x2ea80b){if(_0x2ea80b){_0x4a88ea=_0x2ea80b;return _0x2ea80b['addLists'](_0x2ef77f[_0x788c('0x54')][_0x788c('0x80')],_[_0x788c('0x5b')](_0x2ef77f[_0x788c('0x54')],['ids','id'])||{});}return null;})[_0x788c('0x96')](function(_0x1a0f09){var _0xb414d4;_0x2e9ff0=_0x1a0f09||[];var _0xb14bd9=[];if(_0x1a0f09){for(var _0x43c655=0x0;_0x43c655<_0x1a0f09[_0x788c('0x41')];_0x43c655+=0x1){var _0x980bc8=_0x1a0f09[_0x43c655][_0x788c('0x56')]({'plain':!![]});_0x4a88ea[_0x788c('0x9f')]=_0x2ef77f[_0x788c('0x54')]['dialCheckDuplicateType']?_0x2ef77f[_0x788c('0x54')]['dialCheckDuplicateType']:_0x4a88ea['dialCheckDuplicateType'];switch(_0x4a88ea[_0x788c('0x9f')]){case _0x788c('0xa0'):_0xb414d4=squel[_0x788c('0xa1')]()['into'](_0x788c('0xa2'))[_0x788c('0xa3')]([_0x788c('0xa4'),_0x788c('0xa5'),_0x788c('0xa6'),'ListId',_0x788c('0x64'),_0x788c('0x5c'),'updatedAt'],squel['select']()[_0x788c('0xa7')](_0x788c('0xa4'),_0x788c('0xa4'))['field']('NOW()',_0x788c('0xa5'))['field']('id',_0x788c('0xa6'))['field'](_0x980bc8[_0x788c('0xa8')][_0x788c('0x8c')](),_0x788c('0xa9'))[_0x788c('0xa7')](_0x2ef77f[_0x788c('0x51')]['id'][_0x788c('0x8c')](),_0x788c('0x64'))[_0x788c('0xa7')]('NOW()',_0x788c('0x5c'))[_0x788c('0xa7')](_0x788c('0xaa'),'updatedAt')[_0x788c('0x83')](_0x788c('0xab'))[_0x788c('0x46')]('deletedAt\x20IS\x20NULL')[_0x788c('0x46')](_0x788c('0xac'),_0x980bc8[_0x788c('0xa8')][_0x788c('0x8c')]())[_0x788c('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x788c('0x46')](_0x788c('0xad'),squel['select']()[_0x788c('0xa7')](_0x788c('0xae'))[_0x788c('0x83')](_0x788c('0xaf'))[_0x788c('0x46')]('VoiceQueueId\x20=\x20?',_0x2ef77f[_0x788c('0x51')]['id'][_0x788c('0x8c')]()))[_0x788c('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x788c('0x81')]()[_0x788c('0xa7')](_0x788c('0xb0'))['from'](_0x788c('0xa2'))[_0x788c('0x46')](_0x788c('0x88'),_0x2ef77f[_0x788c('0x51')]['id'][_0x788c('0x8c')]())))[_0x788c('0x8c')]();break;case _0x788c('0xb1'):_0xb414d4=squel[_0x788c('0xa1')]()[_0x788c('0xb2')](_0x788c('0xa2'))[_0x788c('0xa3')]([_0x788c('0xa4'),_0x788c('0xa5'),_0x788c('0xa6'),_0x788c('0xa9'),'VoiceQueueId',_0x788c('0x5c'),'updatedAt'],squel[_0x788c('0x81')]()[_0x788c('0xa7')]('phone',_0x788c('0xa4'))[_0x788c('0xa7')]('NOW()',_0x788c('0xa5'))['field']('id',_0x788c('0xa6'))[_0x788c('0xa7')](_0x980bc8[_0x788c('0xa8')][_0x788c('0x8c')](),_0x788c('0xa9'))['field'](_0x2ef77f[_0x788c('0x51')]['id'][_0x788c('0x8c')](),_0x788c('0x64'))[_0x788c('0xa7')]('NOW()',_0x788c('0x5c'))[_0x788c('0xa7')](_0x788c('0xaa'),'updatedAt')[_0x788c('0x83')](_0x788c('0xab'))[_0x788c('0x46')](_0x788c('0xb3'))['where'](_0x788c('0xac'),_0x980bc8['CmListId'][_0x788c('0x8c')]())[_0x788c('0x46')](_0x788c('0xb4'))[_0x788c('0x46')](_0x788c('0xad'),squel[_0x788c('0x81')]()[_0x788c('0xa7')](_0x788c('0xb0'))['from']('cm_hopper')[_0x788c('0x46')]('VoiceQueueId\x20=\x20?',_0x2ef77f['params']['id']['toString']())))[_0x788c('0x8c')]();break;default:_0xb414d4=squel[_0x788c('0xa1')]()[_0x788c('0xb2')](_0x788c('0xa2'))[_0x788c('0xa3')]([_0x788c('0xa4'),_0x788c('0xa5'),'ContactId','ListId',_0x788c('0x64'),'createdAt','updatedAt'],squel[_0x788c('0x81')]()[_0x788c('0xa7')](_0x788c('0xa4'),_0x788c('0xa4'))['field'](_0x788c('0xaa'),_0x788c('0xa5'))['field']('id',_0x788c('0xa6'))['field'](_0x980bc8[_0x788c('0xa8')][_0x788c('0x8c')](),_0x788c('0xa9'))[_0x788c('0xa7')](_0x2ef77f['params']['id'][_0x788c('0x8c')](),'VoiceQueueId')[_0x788c('0xa7')](_0x788c('0xaa'),_0x788c('0x5c'))['field'](_0x788c('0xaa'),_0x788c('0x5d'))[_0x788c('0x83')](_0x788c('0xab'))[_0x788c('0x46')]('deletedAt\x20IS\x20NULL')[_0x788c('0x46')](_0x788c('0xac'),_0x980bc8['CmListId'][_0x788c('0x8c')]())[_0x788c('0x46')](_0x788c('0xb4')))[_0x788c('0x8c')]();}_0xb14bd9[_0x788c('0x8b')](db[_0x788c('0x76')]['query'](_0xb414d4));}return BPromise[_0x788c('0x97')](_0xb14bd9);}})[_0x788c('0x26')](function(){return _0x2e9ff0;})['then'](respondWithResult(_0x330215,null))[_0x788c('0x4f')](handleError(_0x330215,null));};exports['removeLists']=function(_0x2fa610,_0x5aa8f5,_0x3086b8){return db[_0x788c('0x4a')][_0x788c('0x30')]({'where':{'id':_0x2fa610['params']['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x5aa8f5,null))[_0x788c('0x26')](function(_0x2526a8){if(_0x2526a8){return _0x2526a8[_0x788c('0xb5')](_0x2fa610[_0x788c('0x3b')][_0x788c('0x80')]);}})['then'](function(_0x46fc63){if(_0x46fc63){return db[_0x788c('0x63')][_0x788c('0x27')]({'where':{'ListId':_0x2fa610[_0x788c('0x3b')][_0x788c('0x80')],'VoiceQueueId':_0x2fa610[_0x788c('0x51')]['id']}})[_0x788c('0x26')](function(){return _0x46fc63;});}})[_0x788c('0x26')](respondWithStatusCode(_0x5aa8f5,null))[_0x788c('0x4f')](handleError(_0x5aa8f5,null));};exports[_0x788c('0xb6')]=function(_0x49a5ad,_0x433a6d,_0x1e664c){var _0x3cada1={};var _0xebcb6={};var _0x29fa30;var _0x1d7a1f;return db[_0x788c('0x4a')][_0x788c('0x62')]({'where':{'id':_0x49a5ad[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x433a6d,null))[_0x788c('0x26')](function(_0x28899){if(_0x28899){_0x29fa30=_0x28899;_0xebcb6[_0x788c('0x3a')]=_['keys'](db[_0x788c('0x9d')]['rawAttributes']);_0xebcb6[_0x788c('0x3b')]=_[_0x788c('0x3c')](_0x49a5ad[_0x788c('0x3b')]);_0xebcb6['filters']=_[_0x788c('0x3e')](_0xebcb6[_0x788c('0x3a')],_0xebcb6[_0x788c('0x3b')]);_0x3cada1[_0x788c('0x3f')]=_['intersection'](_0xebcb6[_0x788c('0x3a')],qs[_0x788c('0x40')](_0x49a5ad[_0x788c('0x3b')]['fields']));_0x3cada1[_0x788c('0x3f')]=_0x3cada1[_0x788c('0x3f')][_0x788c('0x41')]?_0x3cada1['attributes']:_0xebcb6[_0x788c('0x3a')];_0x3cada1[_0x788c('0x44')]=qs[_0x788c('0x45')](_0x49a5ad[_0x788c('0x3b')][_0x788c('0x45')]);_0x3cada1[_0x788c('0x46')]=qs[_0x788c('0x3d')](_[_0x788c('0x47')](_0x49a5ad[_0x788c('0x3b')],_0xebcb6[_0x788c('0x3d')]));if(_0x49a5ad['query']['filter']){_0x3cada1['where']=_['merge'](_0x3cada1[_0x788c('0x46')],{'$or':_[_0x788c('0x2d')](_0x3cada1[_0x788c('0x3f')],function(_0x3c2cc7){var _0x4992f6={};_0x4992f6[_0x3c2cc7]={'$like':'%'+_0x49a5ad[_0x788c('0x3b')][_0x788c('0x2b')]+'%'};return _0x4992f6;})});}_0x3cada1=_[_0x788c('0x48')]({},_0x3cada1,_0x49a5ad['options']);return _0x29fa30['getBlackLists'](_0x3cada1);}})[_0x788c('0x26')](function(_0x160ac2){if(_0x160ac2){_0x1d7a1f=_0x160ac2[_0x788c('0x41')];if(!_0x49a5ad[_0x788c('0x3b')]['hasOwnProperty'](_0x788c('0x43'))){_0x3cada1[_0x788c('0x21')]=qs[_0x788c('0x21')](_0x49a5ad['query'][_0x788c('0x21')]);_0x3cada1['offset']=qs[_0x788c('0x20')](_0x49a5ad['query']['offset']);}return _0x29fa30[_0x788c('0xb6')](_0x3cada1);}})['then'](function(_0x30f627){if(_0x30f627){return _0x30f627?{'count':_0x1d7a1f,'rows':_0x30f627}:null;}})[_0x788c('0x26')](respondWithResult(_0x433a6d,null))[_0x788c('0x4f')](handleError(_0x433a6d,null));};exports[_0x788c('0xb7')]=function(_0x7ad92,_0x3cb295,_0x4d56bf){var _0x528e29,_0x18b6bc;return db[_0x788c('0x4a')][_0x788c('0x30')]({'where':{'id':_0x7ad92[_0x788c('0x51')]['id']}})[_0x788c('0x26')](handleEntityNotFound(_0x3cb295,null))[_0x788c('0x26')](function(_0x23d6a2){if(_0x23d6a2){_0x18b6bc=_0x23d6a2;return _0x23d6a2[_0x788c('0xb7')](_0x7ad92[_0x788c('0x54')][_0x788c('0x80')],_[_0x788c('0x5b')](_0x7ad92[_0x788c('0x54')],[_0x788c('0x80'),'id'])||{});}return null;})[_0x788c('0x96')](function(_0x140a8c){var _0x79113d;_0x528e29=_0x140a8c||[];var _0x5ab90e=[];if(_0x140a8c){for(var _0x299826=0x0;_0x299826<_0x140a8c['length'];_0x299826+=0x1){var _0x145409=_0x140a8c[_0x299826][_0x788c('0x56')]({'plain':!![]});_0x79113d=squel['insert']()[_0x788c('0xb2')]('cm_hopper_black')['fromQuery']([_0x788c('0xa4'),_0x788c('0xa6'),'ListId','VoiceQueueId',_0x788c('0x5c'),_0x788c('0x5d')],squel['select']()[_0x788c('0xa7')](_0x788c('0xa4'),_0x788c('0xa4'))[_0x788c('0xa7')]('id','ContactId')[_0x788c('0xa7')](_0x145409[_0x788c('0xa8')][_0x788c('0x8c')](),_0x788c('0xa9'))['field'](_0x7ad92['params']['id'][_0x788c('0x8c')](),_0x788c('0x64'))[_0x788c('0xa7')]('NOW()',_0x788c('0x5c'))[_0x788c('0xa7')](_0x788c('0xaa'),_0x788c('0x5d'))[_0x788c('0x83')](_0x788c('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0x788c('0x46')](_0x788c('0xac'),_0x145409['CmListId'][_0x788c('0x8c')]())[_0x788c('0x46')](_0x788c('0xb4')))[_0x788c('0x8c')]();_0x5ab90e[_0x788c('0x8b')](db[_0x788c('0x76')][_0x788c('0x3b')](_0x79113d));}return BPromise[_0x788c('0x97')](_0x5ab90e);}})[_0x788c('0x26')](function(){return _0x528e29;})[_0x788c('0x26')](respondWithResult(_0x3cb295,null))[_0x788c('0x4f')](handleError(_0x3cb295,null));};exports['removeBlackLists']=function(_0x1bb962,_0x40b522,_0x42750e){return db[_0x788c('0x4a')][_0x788c('0x30')]({'where':{'id':_0x1bb962['params']['id']}})['then'](handleEntityNotFound(_0x40b522,null))[_0x788c('0x26')](function(_0x58d138){if(_0x58d138){return _0x58d138[_0x788c('0xb8')](_0x1bb962['query']['ids']);}})[_0x788c('0x26')](function(_0x5bfe9a){if(_0x5bfe9a){return db[_0x788c('0x69')][_0x788c('0x27')]({'where':{'ListId':_0x1bb962[_0x788c('0x3b')][_0x788c('0x80')],'VoiceQueueId':_0x1bb962[_0x788c('0x51')]['id']}})[_0x788c('0x26')](function(){return _0x5bfe9a;});}})[_0x788c('0x26')](respondWithStatusCode(_0x40b522,null))[_0x788c('0x4f')](handleError(_0x40b522,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2d7fcfb..c8785e1 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 _0xc647=['VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xc647,0x152));var _0x7c64=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xc647[_0x581af1];return _0x54c22e;};'use strict';var EventEmitter=require(_0x7c64('0x0'));var VoiceQueue=require(_0x7c64('0x1'))['db'][_0x7c64('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7c64('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c64('0x4'),'afterDestroy':_0x7c64('0x5')};function emitEvent(_0x4e24e6){return function(_0x11caa1,_0x6e837b,_0x291b81){VoiceQueueEvents[_0x7c64('0x6')](_0x4e24e6+':'+_0x11caa1['id'],_0x11caa1);VoiceQueueEvents[_0x7c64('0x6')](_0x4e24e6,_0x11caa1);_0x291b81(null);};}for(var e in events){if(events[_0x7c64('0x7')](e)){var event=events[e];VoiceQueue[_0x7c64('0x8')](e,emitEvent(event));}}module[_0x7c64('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x98cb=['setMaxListeners','update','remove','emit','hook','events','VoiceQueue'];(function(_0x158df0,_0x3b5e6c){var _0x5af4c1=function(_0x537074){while(--_0x537074){_0x158df0['push'](_0x158df0['shift']());}};_0x5af4c1(++_0x3b5e6c);}(_0x98cb,0x8a));var _0xb98c=function(_0xe68bb7,_0x16c6c7){_0xe68bb7=_0xe68bb7-0x0;var _0x254b6f=_0x98cb[_0xe68bb7];return _0x254b6f;};'use strict';var EventEmitter=require(_0xb98c('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xb98c('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb98c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb98c('0x3'),'afterDestroy':_0xb98c('0x4')};function emitEvent(_0x21be33){return function(_0x5a6c20,_0x5aed3e,_0x3dd0fd){VoiceQueueEvents['emit'](_0x21be33+':'+_0x5a6c20['id'],_0x5a6c20);VoiceQueueEvents[_0xb98c('0x5')](_0x21be33,_0x5a6c20);_0x3dd0fd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xb98c('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index df5f1bf..b56a1d3 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 _0xa754=['rimraf','../../config/environment','VoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x50090b,_0x5eac92){var _0x5cb5ee=function(_0xa2f639){while(--_0xa2f639){_0x50090b['push'](_0x50090b['shift']());}};_0x5cb5ee(++_0x5eac92);}(_0xa754,0x16b));var _0x4a75=function(_0x2ddb23,_0x33a83b){_0x2ddb23=_0x2ddb23-0x0;var _0x59671c=_0xa754[_0x2ddb23];return _0x59671c;};'use strict';var _=require(_0x4a75('0x0'));var util=require(_0x4a75('0x1'));var logger=require(_0x4a75('0x2'))(_0x4a75('0x3'));var moment=require(_0x4a75('0x4'));var BPromise=require(_0x4a75('0x5'));var rp=require(_0x4a75('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a75('0x7'));var config=require(_0x4a75('0x8'));var attributes=require('./voiceQueue.attributes');module['exports']=function(_0xef1740,_0x187874){return _0xef1740['define'](_0x4a75('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa73f=['./voiceQueue.attributes','define','util','api','bluebird','request-promise','rimraf'];(function(_0x2a029e,_0x487180){var _0x28daa2=function(_0x2d5f3f){while(--_0x2d5f3f){_0x2a029e['push'](_0x2a029e['shift']());}};_0x28daa2(++_0x487180);}(_0xa73f,0x1b4));var _0xfa73=function(_0x3dad74,_0x4a2a83){_0x3dad74=_0x3dad74-0x0;var _0x1ad290=_0xa73f[_0x3dad74];return _0x1ad290;};'use strict';var _=require('lodash');var util=require(_0xfa73('0x0'));var logger=require('../../config/logger')(_0xfa73('0x1'));var moment=require('moment');var BPromise=require(_0xfa73('0x2'));var rp=require(_0xfa73('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa73('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa73('0x5'));module['exports']=function(_0x3966cf,_0x3417d9){return _0x3966cf[_0xfa73('0x6')]('VoiceQueue',attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 2386d6a..6078e7f 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 _0xd8f6=['rpc','jayson/promise','client','redis','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','map','model','stringify','find','raw','ShowVoiceQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xd8f6,0x1b5));var _0x6d8f=function(_0x1f3430,_0x5f0338){_0x1f3430=_0x1f3430-0x0;var _0x21f17c=_0xd8f6[_0x1f3430];return _0x21f17c;};'use strict';var _=require(_0x6d8f('0x0'));var util=require(_0x6d8f('0x1'));var moment=require('moment');var BPromise=require(_0x6d8f('0x2'));var rs=require(_0x6d8f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d8f('0x4'))['db'];var utils=require(_0x6d8f('0x5'));var logger=require(_0x6d8f('0x6'))(_0x6d8f('0x7'));var config=require('../../config/environment');var jayson=require(_0x6d8f('0x8'));var client=jayson[_0x6d8f('0x9')]['http']({'port':0x232a});config[_0x6d8f('0xa')]=_['defaults'](config[_0x6d8f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d8f('0xb'))(new Redis(config[_0x6d8f('0xa')]));require(_0x6d8f('0xc'))[_0x6d8f('0xd')](socket);function respondWithRpcPromise(_0x47191b,_0x5b4785,_0x518121){return new BPromise(function(_0x38a0c8,_0x23dc5e){return client['request'](_0x47191b,_0x518121)[_0x6d8f('0xe')](function(_0x244400){logger[_0x6d8f('0xf')](_0x6d8f('0x10'),_0x5b4785,_0x6d8f('0x11'));logger[_0x6d8f('0x12')](_0x6d8f('0x13'),_0x5b4785,_0x6d8f('0x11'),JSON['stringify'](_0x244400));if(_0x244400[_0x6d8f('0x14')]){if(_0x244400[_0x6d8f('0x14')][_0x6d8f('0x15')]===0x1f4){logger['error'](_0x6d8f('0x10'),_0x5b4785,_0x244400[_0x6d8f('0x14')]['message']);return _0x23dc5e(_0x244400[_0x6d8f('0x14')][_0x6d8f('0x16')]);}logger[_0x6d8f('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x5b4785,_0x244400[_0x6d8f('0x14')][_0x6d8f('0x16')]);return _0x38a0c8(_0x244400[_0x6d8f('0x14')]['message']);}else{logger[_0x6d8f('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x5b4785,_0x6d8f('0x11'));_0x38a0c8(_0x244400['result'][_0x6d8f('0x16')]);}})[_0x6d8f('0x17')](function(_0x222228){logger['error'](_0x6d8f('0x10'),_0x5b4785,_0x222228);_0x23dc5e(_0x222228);});});}exports[_0x6d8f('0x18')]=function(_0x4930f0){var _0x305dd7=this;return new Promise(function(_0x37d3f5,_0x37765e){return db[_0x6d8f('0x19')]['findAll']({'raw':_0x4930f0[_0x6d8f('0x1a')]?_0x4930f0[_0x6d8f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4930f0[_0x6d8f('0x1a')]?_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1b')]||null:null,'attributes':_0x4930f0['options']?_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1c')]||null:null,'limit':_0x4930f0[_0x6d8f('0x1a')]?_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1d')]||null:null,'include':_0x4930f0['options']?_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1e')]?_[_0x6d8f('0x1f')](_0x4930f0[_0x6d8f('0x1a')][_0x6d8f('0x1e')],function(_0x32f9d4){return{'model':db[_0x32f9d4[_0x6d8f('0x20')]],'as':_0x32f9d4['as'],'attributes':_0x32f9d4[_0x6d8f('0x1c')],'include':_0x32f9d4[_0x6d8f('0x1e')]?_[_0x6d8f('0x1f')](_0x32f9d4[_0x6d8f('0x1e')],function(_0x465e1e){return{'model':db[_0x465e1e[_0x6d8f('0x20')]],'as':_0x465e1e['as'],'attributes':_0x465e1e[_0x6d8f('0x1c')],'include':_0x465e1e['include']?_[_0x6d8f('0x1f')](_0x465e1e[_0x6d8f('0x1e')],function(_0x5b5b0a){return{'model':db[_0x5b5b0a['model']],'as':_0x5b5b0a['as'],'attributes':_0x5b5b0a[_0x6d8f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6d8f('0xe')](function(_0x5d62ef){logger[_0x6d8f('0xf')](_0x6d8f('0x18'),_0x4930f0);logger[_0x6d8f('0x12')](_0x6d8f('0x18'),_0x4930f0,JSON[_0x6d8f('0x21')](_0x5d62ef));_0x37d3f5(_0x5d62ef);})[_0x6d8f('0x17')](function(_0x50d11d){logger[_0x6d8f('0x14')](_0x6d8f('0x18'),_0x50d11d['message'],_0x4930f0);_0x37765e(_0x305dd7['error'](0x1f4,_0x50d11d[_0x6d8f('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x2b0fd9){var _0x14c89b=this;return new Promise(function(_0x5f05e6,_0x45dc7b){return db[_0x6d8f('0x19')][_0x6d8f('0x22')]({'raw':_0x2b0fd9[_0x6d8f('0x1a')]?_0x2b0fd9[_0x6d8f('0x1a')][_0x6d8f('0x23')]===undefined?!![]:![]:!![],'where':_0x2b0fd9[_0x6d8f('0x1a')]?_0x2b0fd9[_0x6d8f('0x1a')][_0x6d8f('0x1b')]||null:null,'attributes':_0x2b0fd9[_0x6d8f('0x1a')]?_0x2b0fd9['options'][_0x6d8f('0x1c')]||null:null,'include':_0x2b0fd9[_0x6d8f('0x1a')]?_0x2b0fd9['options'][_0x6d8f('0x1e')]?_[_0x6d8f('0x1f')](_0x2b0fd9[_0x6d8f('0x1a')][_0x6d8f('0x1e')],function(_0x2b2aea){return{'model':db[_0x2b2aea[_0x6d8f('0x20')]],'as':_0x2b2aea['as'],'attributes':_0x2b2aea[_0x6d8f('0x1c')],'include':_0x2b2aea[_0x6d8f('0x1e')]?_[_0x6d8f('0x1f')](_0x2b2aea[_0x6d8f('0x1e')],function(_0x28329c){return{'model':db[_0x28329c['model']],'as':_0x28329c['as'],'attributes':_0x28329c[_0x6d8f('0x1c')],'include':_0x28329c[_0x6d8f('0x1e')]?_['map'](_0x28329c[_0x6d8f('0x1e')],function(_0xb69219){return{'model':db[_0xb69219[_0x6d8f('0x20')]],'as':_0xb69219['as'],'attributes':_0xb69219[_0x6d8f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6d8f('0xe')](function(_0x522e87){logger['info']('ShowVoiceQueue',_0x2b0fd9);logger['debug'](_0x6d8f('0x24'),_0x2b0fd9,JSON[_0x6d8f('0x21')](_0x522e87));_0x5f05e6(_0x522e87);})[_0x6d8f('0x17')](function(_0x2cced7){logger['error']('ShowVoiceQueue',_0x2cced7[_0x6d8f('0x16')],_0x2b0fd9);_0x45dc7b(_0x14c89b['error'](0x1f4,_0x2cced7[_0x6d8f('0x16')]));});});}; \ No newline at end of file +var _0x2b7d=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','options','raw','where','include','model','attributes','map','GetVoiceQueue','stringify','debug','ShowVoiceQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2b7d,0x1b6));var _0xd2b7=function(_0x236f1a,_0x3e03c4){_0x236f1a=_0x236f1a-0x0;var _0x4e3071=_0x2b7d[_0x236f1a];return _0x4e3071;};'use strict';var _=require('lodash');var util=require(_0xd2b7('0x0'));var moment=require(_0xd2b7('0x1'));var BPromise=require(_0xd2b7('0x2'));var rs=require(_0xd2b7('0x3'));var fs=require('fs');var Redis=require(_0xd2b7('0x4'));var db=require(_0xd2b7('0x5'))['db'];var utils=require(_0xd2b7('0x6'));var logger=require(_0xd2b7('0x7'))('rpc');var config=require(_0xd2b7('0x8'));var jayson=require(_0xd2b7('0x9'));var client=jayson['client'][_0xd2b7('0xa')]({'port':0x232a});config[_0xd2b7('0xb')]=_['defaults'](config['redis'],{'host':_0xd2b7('0xc'),'port':0x18eb});var socket=require(_0xd2b7('0xd'))(new Redis(config[_0xd2b7('0xb')]));require('./voiceQueue.socket')[_0xd2b7('0xe')](socket);function respondWithRpcPromise(_0x5cde5b,_0x3bfc1e,_0x274ae1){return new BPromise(function(_0x28ad39,_0xfde217){return client[_0xd2b7('0xf')](_0x5cde5b,_0x274ae1)[_0xd2b7('0x10')](function(_0x3e8d3e){logger[_0xd2b7('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x3bfc1e,_0xd2b7('0x12'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3bfc1e,'request\x20sent',JSON['stringify'](_0x3e8d3e));if(_0x3e8d3e[_0xd2b7('0x13')]){if(_0x3e8d3e[_0xd2b7('0x13')][_0xd2b7('0x14')]===0x1f4){logger[_0xd2b7('0x13')](_0xd2b7('0x15'),_0x3bfc1e,_0x3e8d3e[_0xd2b7('0x13')][_0xd2b7('0x16')]);return _0xfde217(_0x3e8d3e[_0xd2b7('0x13')][_0xd2b7('0x16')]);}logger[_0xd2b7('0x13')](_0xd2b7('0x15'),_0x3bfc1e,_0x3e8d3e[_0xd2b7('0x13')]['message']);return _0x28ad39(_0x3e8d3e[_0xd2b7('0x13')][_0xd2b7('0x16')]);}else{logger['info'](_0xd2b7('0x15'),_0x3bfc1e,_0xd2b7('0x12'));_0x28ad39(_0x3e8d3e[_0xd2b7('0x17')][_0xd2b7('0x16')]);}})[_0xd2b7('0x18')](function(_0x5909c7){logger[_0xd2b7('0x13')](_0xd2b7('0x15'),_0x3bfc1e,_0x5909c7);_0xfde217(_0x5909c7);});});}exports['GetVoiceQueue']=function(_0x46f8c3){var _0xa28459=this;return new Promise(function(_0x50c54f,_0x313955){return db[_0xd2b7('0x19')]['findAll']({'raw':_0x46f8c3['options']?_0x46f8c3[_0xd2b7('0x1a')][_0xd2b7('0x1b')]===undefined?!![]:![]:!![],'where':_0x46f8c3[_0xd2b7('0x1a')]?_0x46f8c3[_0xd2b7('0x1a')][_0xd2b7('0x1c')]||null:null,'attributes':_0x46f8c3[_0xd2b7('0x1a')]?_0x46f8c3[_0xd2b7('0x1a')]['attributes']||null:null,'limit':_0x46f8c3[_0xd2b7('0x1a')]?_0x46f8c3[_0xd2b7('0x1a')]['limit']||null:null,'include':_0x46f8c3[_0xd2b7('0x1a')]?_0x46f8c3[_0xd2b7('0x1a')][_0xd2b7('0x1d')]?_['map'](_0x46f8c3['options'][_0xd2b7('0x1d')],function(_0x43506f){return{'model':db[_0x43506f[_0xd2b7('0x1e')]],'as':_0x43506f['as'],'attributes':_0x43506f['attributes'],'include':_0x43506f['include']?_['map'](_0x43506f[_0xd2b7('0x1d')],function(_0x5b0737){return{'model':db[_0x5b0737[_0xd2b7('0x1e')]],'as':_0x5b0737['as'],'attributes':_0x5b0737[_0xd2b7('0x1f')],'include':_0x5b0737[_0xd2b7('0x1d')]?_[_0xd2b7('0x20')](_0x5b0737[_0xd2b7('0x1d')],function(_0xa4bdc6){return{'model':db[_0xa4bdc6[_0xd2b7('0x1e')]],'as':_0xa4bdc6['as'],'attributes':_0xa4bdc6[_0xd2b7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec798){logger[_0xd2b7('0x11')](_0xd2b7('0x21'),_0x46f8c3);logger['debug'](_0xd2b7('0x21'),_0x46f8c3,JSON[_0xd2b7('0x22')](_0x2ec798));_0x50c54f(_0x2ec798);})[_0xd2b7('0x18')](function(_0x25d939){logger[_0xd2b7('0x13')](_0xd2b7('0x21'),_0x25d939['message'],_0x46f8c3);_0x313955(_0xa28459[_0xd2b7('0x13')](0x1f4,_0x25d939[_0xd2b7('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x14a254){var _0x1e4676=this;return new Promise(function(_0x507b54,_0x4c7f9e){return db[_0xd2b7('0x19')]['find']({'raw':_0x14a254['options']?_0x14a254[_0xd2b7('0x1a')][_0xd2b7('0x1b')]===undefined?!![]:![]:!![],'where':_0x14a254[_0xd2b7('0x1a')]?_0x14a254[_0xd2b7('0x1a')][_0xd2b7('0x1c')]||null:null,'attributes':_0x14a254[_0xd2b7('0x1a')]?_0x14a254[_0xd2b7('0x1a')][_0xd2b7('0x1f')]||null:null,'include':_0x14a254[_0xd2b7('0x1a')]?_0x14a254['options'][_0xd2b7('0x1d')]?_['map'](_0x14a254[_0xd2b7('0x1a')][_0xd2b7('0x1d')],function(_0x4b2930){return{'model':db[_0x4b2930[_0xd2b7('0x1e')]],'as':_0x4b2930['as'],'attributes':_0x4b2930[_0xd2b7('0x1f')],'include':_0x4b2930[_0xd2b7('0x1d')]?_[_0xd2b7('0x20')](_0x4b2930[_0xd2b7('0x1d')],function(_0x56d28b){return{'model':db[_0x56d28b['model']],'as':_0x56d28b['as'],'attributes':_0x56d28b[_0xd2b7('0x1f')],'include':_0x56d28b[_0xd2b7('0x1d')]?_[_0xd2b7('0x20')](_0x56d28b[_0xd2b7('0x1d')],function(_0x358f5e){return{'model':db[_0x358f5e[_0xd2b7('0x1e')]],'as':_0x358f5e['as'],'attributes':_0x358f5e[_0xd2b7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd2b7('0x10')](function(_0x4fdc65){logger[_0xd2b7('0x11')]('ShowVoiceQueue',_0x14a254);logger[_0xd2b7('0x23')]('ShowVoiceQueue',_0x14a254,JSON[_0xd2b7('0x22')](_0x4fdc65));_0x507b54(_0x4fdc65);})[_0xd2b7('0x18')](function(_0x2727c6){logger['error'](_0xd2b7('0x24'),_0x2727c6[_0xd2b7('0x16')],_0x14a254);_0x4c7f9e(_0x1e4676[_0xd2b7('0x13')](0x1f4,_0x2727c6[_0xd2b7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 72a61bf..7655923 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 _0x2deb=['remove','update','removeListener','register','length','./voiceQueue.events'];(function(_0x3a1718,_0x45d6f6){var _0x4d9789=function(_0x1bb123){while(--_0x1bb123){_0x3a1718['push'](_0x3a1718['shift']());}};_0x4d9789(++_0x45d6f6);}(_0x2deb,0xef));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var VoiceQueueEvents=require(_0xb2de('0x0'));var events=['save',_0xb2de('0x1'),_0xb2de('0x2')];function createListener(_0x1aa2fe,_0x4576e9){return function(_0x1c257f){_0x4576e9['emit'](_0x1aa2fe,_0x1c257f);};}function removeListener(_0x4388f2,_0x53f9f8){return function(){VoiceQueueEvents[_0xb2de('0x3')](_0x4388f2,_0x53f9f8);};}exports[_0xb2de('0x4')]=function(_0x4847d9){for(var _0x325653=0x0,_0x55a85e=events[_0xb2de('0x5')];_0x325653<_0x55a85e;_0x325653++){var _0x3cf403=events[_0x325653];var _0x2d704a=createListener('voiceQueue:'+_0x3cf403,_0x4847d9);VoiceQueueEvents['on'](_0x3cf403,_0x2d704a);}}; \ No newline at end of file +var _0x8bf7=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x8bf7,0x139));var _0x78bf=function(_0x35895c,_0x74e456){_0x35895c=_0x35895c-0x0;var _0x1a1c8e=_0x8bf7[_0x35895c];return _0x1a1c8e;};'use strict';var VoiceQueueEvents=require(_0x78bf('0x0'));var events=[_0x78bf('0x1'),_0x78bf('0x2'),'update'];function createListener(_0x25975b,_0xaf9f0f){return function(_0x382157){_0xaf9f0f[_0x78bf('0x3')](_0x25975b,_0x382157);};}function removeListener(_0x3ea947,_0x3e93c7){return function(){VoiceQueueEvents[_0x78bf('0x4')](_0x3ea947,_0x3e93c7);};}exports[_0x78bf('0x5')]=function(_0x2d8b0a){for(var _0x85fc98=0x0,_0x2d4cf9=events[_0x78bf('0x6')];_0x85fc98<_0x2d4cf9;_0x85fc98++){var _0x20c683=events[_0x85fc98];var _0x29ec01=createListener(_0x78bf('0x7')+_0x20c683,_0x2d8b0a);VoiceQueueEvents['on'](_0x20c683,_0x29ec01);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 6866e9a..432726f 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 _0xf2e3=['describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x42fee0,_0x49a55d){var _0x2ebd12=function(_0x44bee6){while(--_0x44bee6){_0x42fee0['push'](_0x42fee0['shift']());}};_0x2ebd12(++_0x49a55d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf2e3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var auth=require(_0x3f2e('0x5'));var interaction=require(_0x3f2e('0x6'));var config=require(_0x3f2e('0x7'));var controller=require(_0x3f2e('0x8'));router[_0x3f2e('0x9')]('/',auth['isAuthenticated'](),controller[_0x3f2e('0xa')]);router[_0x3f2e('0x9')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xd')]);router[_0x3f2e('0x9')](_0x3f2e('0xe'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xf')]);router[_0x3f2e('0x9')](_0x3f2e('0x10'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x11')]);router[_0x3f2e('0x12')]('/',auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x13')]);router[_0x3f2e('0x14')](_0x3f2e('0x10'),auth[_0x3f2e('0xc')](),controller['update']);router[_0x3f2e('0x15')](_0x3f2e('0x10'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file +var _0xe944=['../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x25f057,_0x55d359){var _0x52a865=function(_0x38e96f){while(--_0x38e96f){_0x25f057['push'](_0x25f057['shift']());}};_0x52a865(++_0x55d359);}(_0xe944,0x174));var _0x4e94=function(_0x2fe74b,_0x10c52c){_0x2fe74b=_0x2fe74b-0x0;var _0x5798f8=_0xe944[_0x2fe74b];return _0x5798f8;};'use strict';var multer=require(_0x4e94('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e94('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x4e94('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4e94('0x3'));router[_0x4e94('0x4')]('/',auth[_0x4e94('0x5')](),controller[_0x4e94('0x6')]);router['get'](_0x4e94('0x7'),auth[_0x4e94('0x5')](),controller[_0x4e94('0x8')]);router[_0x4e94('0x4')]('/index',auth[_0x4e94('0x5')](),controller['getVoiceQueuesReport']);router[_0x4e94('0x4')](_0x4e94('0x9'),auth[_0x4e94('0x5')](),controller[_0x4e94('0xa')]);router['post']('/',auth[_0x4e94('0x5')](),controller[_0x4e94('0xb')]);router[_0x4e94('0xc')](_0x4e94('0x9'),auth[_0x4e94('0x5')](),controller[_0x4e94('0xd')]);router[_0x4e94('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4e94('0xf')]);module[_0x4e94('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index c743af1..39f69ea 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 _0xa212=['DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xa212,0xec));var _0x2a21=function(_0x10bdb3,_0x245233){_0x10bdb3=_0x10bdb3-0x0;var _0x39a57b=_0xa212[_0x10bdb3];return _0x39a57b;};'use strict';var Sequelize=require(_0x2a21('0x0'));var moment=require(_0x2a21('0x1'));module[_0x2a21('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2a21('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x2a21('0x4')],'set':function(_0x671038){var _0x67e8ac=moment(_0x671038);var _0x322f16=moment(this[_0x2a21('0x5')]('queuecallerjoinAt'))[_0x2a21('0x6')](_0x2a21('0x7'));var _0x519ee3=_0x67e8ac['diff'](_0x322f16,_0x2a21('0x8'));this[_0x2a21('0x9')](_0x2a21('0xa'),_0x671038);this['setDataValue'](_0x2a21('0xb'),_0x519ee3||null);}},'position':{'type':Sequelize[_0x2a21('0xc')]},'count':{'type':Sequelize[_0x2a21('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x2a21('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2a21('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2a21('0x4')]},'queuecallerexit':{'type':Sequelize[_0x2a21('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2a21('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x2a21('0x3')],'comment':_0x2a21('0xe')},'originalposition':{'type':Sequelize[_0x2a21('0xc')]},'channel':{'type':Sequelize[_0x2a21('0x3')]},'connectedlinenum':{'type':Sequelize[_0x2a21('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2a21('0x3')]},'context':{'type':Sequelize[_0x2a21('0x3')]},'exten':{'type':Sequelize[_0x2a21('0x3')]},'priority':{'type':Sequelize[_0x2a21('0x3')]},'holdtime':{'type':Sequelize[_0x2a21('0xc')]},'mohtime':{'type':Sequelize[_0x2a21('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2a21('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2a21('0x3')]},'transfer':{'type':Sequelize[_0x2a21('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2a21('0x3')],'comment':_0x2a21('0xf')},'transferexten':{'type':Sequelize[_0x2a21('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x2a21('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x2a21('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c63=['DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0x1c63,0xdc));var _0x31c6=function(_0x2a0dc9,_0x3802f4){_0x2a0dc9=_0x2a0dc9-0x0;var _0x198be1=_0x1c63[_0x2a0dc9];return _0x198be1;};'use strict';var Sequelize=require(_0x31c6('0x0'));var moment=require(_0x31c6('0x1'));module[_0x31c6('0x2')]={'type':{'type':Sequelize[_0x31c6('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x31c6('0x3')]},'calleridname':{'type':Sequelize[_0x31c6('0x3')]},'queue':{'type':Sequelize[_0x31c6('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x31c6('0x4')],'set':function(_0x3c1288){var _0x472d52=moment(_0x3c1288);var _0x1f4994=moment(this[_0x31c6('0x5')]('queuecallerjoinAt'))['format'](_0x31c6('0x6'));var _0x184d7d=_0x472d52[_0x31c6('0x7')](_0x1f4994,_0x31c6('0x8'));this[_0x31c6('0x9')]('queuecallerleaveAt',_0x3c1288);this[_0x31c6('0x9')](_0x31c6('0xa'),_0x184d7d||null);}},'position':{'type':Sequelize[_0x31c6('0xb')]},'count':{'type':Sequelize[_0x31c6('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x31c6('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x31c6('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x31c6('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x31c6('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x31c6('0xd')},'originalposition':{'type':Sequelize[_0x31c6('0xb')]},'channel':{'type':Sequelize[_0x31c6('0x3')]},'connectedlinenum':{'type':Sequelize[_0x31c6('0x3')]},'connectedlinename':{'type':Sequelize[_0x31c6('0x3')]},'accountcode':{'type':Sequelize[_0x31c6('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x31c6('0x3')]},'priority':{'type':Sequelize[_0x31c6('0x3')]},'holdtime':{'type':Sequelize[_0x31c6('0xb')]},'mohtime':{'type':Sequelize[_0x31c6('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x31c6('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x31c6('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x31c6('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x31c6('0xb')],'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 76d83d4..8f20cb1 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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x7a54,0x106));var _0x47a5=function(_0x19375f,_0x25dde9){_0x19375f=_0x19375f-0x0;var _0x5c24f7=_0x7a54[_0x19375f];return _0x5c24f7;};'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(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 4902501..57df95d 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 _0x3579=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x5c0023,_0x5447d7){var _0x47fadf=function(_0x2507e5){while(--_0x2507e5){_0x5c0023['push'](_0x5c0023['shift']());}};_0x47fadf(++_0x5447d7);}(_0x3579,0x90));var _0x9357=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x3579[_0x122096];return _0x3d1966;};'use strict';var EventEmitter=require(_0x9357('0x0'));var VoiceQueueReport=require(_0x9357('0x1'))['db'][_0x9357('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9357('0x3')](0x0);var events={'afterCreate':_0x9357('0x4'),'afterUpdate':_0x9357('0x5'),'afterDestroy':'remove'};function emitEvent(_0x43b8d6){return function(_0x3ffd0e,_0x19c40f,_0x1f8cd5){VoiceQueueReportEvents[_0x9357('0x6')](_0x43b8d6+':'+_0x3ffd0e['id'],_0x3ffd0e);VoiceQueueReportEvents['emit'](_0x43b8d6,_0x3ffd0e);_0x1f8cd5(null);};}for(var e in events){if(events[_0x9357('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x9357('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x52e1=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x30d114,_0x425e94){var _0x5a1229=function(_0x990ae4){while(--_0x990ae4){_0x30d114['push'](_0x30d114['shift']());}};_0x5a1229(++_0x425e94);}(_0x52e1,0xad));var _0x152e=function(_0x44769c,_0x4b2cc6){_0x44769c=_0x44769c-0x0;var _0x216eb5=_0x52e1[_0x44769c];return _0x216eb5;};'use strict';var EventEmitter=require(_0x152e('0x0'));var VoiceQueueReport=require(_0x152e('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x152e('0x2')](0x0);var events={'afterCreate':_0x152e('0x3'),'afterUpdate':_0x152e('0x4'),'afterDestroy':_0x152e('0x5')};function emitEvent(_0x24d058){return function(_0x31b16e,_0x25ee4b,_0x4b6747){VoiceQueueReportEvents[_0x152e('0x6')](_0x24d058+':'+_0x31b16e['id'],_0x31b16e);VoiceQueueReportEvents[_0x152e('0x6')](_0x24d058,_0x31b16e);_0x4b6747(null);};}for(var e in events){if(events[_0x152e('0x7')](e)){var event=events[e];VoiceQueueReport[_0x152e('0x8')](e,emitEvent(event));}}module[_0x152e('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 41720dc..eb40b12 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 _0x836b=['api','moment','bluebird','request-promise','rimraf','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','../../config/logger'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0x836b,0xdb));var _0xb836=function(_0x1f4d45,_0x6e1e25){_0x1f4d45=_0x1f4d45-0x0;var _0x5e3bf5=_0x836b[_0x1f4d45];return _0x5e3bf5;};'use strict';var _=require(_0xb836('0x0'));var util=require('util');var logger=require(_0xb836('0x1'))(_0xb836('0x2'));var moment=require(_0xb836('0x3'));var BPromise=require(_0xb836('0x4'));var rp=require(_0xb836('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb836('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xb836('0x7')]=function(_0xd19e7e,_0x5658d4){return _0xd19e7e[_0xb836('0x8')](_0xb836('0x9'),attributes,{'tableName':_0xb836('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb836('0xb')]},{'fields':[_0xb836('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf79d=['./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x59ba26,_0xe68a46){var _0x2e731a=function(_0x4e2b39){while(--_0x4e2b39){_0x59ba26['push'](_0x59ba26['shift']());}};_0x2e731a(++_0xe68a46);}(_0xf79d,0x1e6));var _0xdf79=function(_0xfcdeaf,_0x411ae8){_0xfcdeaf=_0xfcdeaf-0x0;var _0x19b8b0=_0xf79d[_0xfcdeaf];return _0x19b8b0;};'use strict';var _=require('lodash');var util=require(_0xdf79('0x0'));var logger=require(_0xdf79('0x1'))(_0xdf79('0x2'));var moment=require('moment');var BPromise=require(_0xdf79('0x3'));var rp=require(_0xdf79('0x4'));var fs=require('fs');var path=require(_0xdf79('0x5'));var rimraf=require(_0xdf79('0x6'));var config=require(_0xdf79('0x7'));var attributes=require(_0xdf79('0x8'));module[_0xdf79('0x9')]=function(_0x5e8c27,_0x1abaf3){return _0x5e8c27['define'](_0xdf79('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xdf79('0xb')]},{'fields':[_0xdf79('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 f71030d..7bc94f2 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 _0x3077=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','model','map','then','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3077,0xc6));var _0x7307=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x3077[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x7307('0x0'));var util=require(_0x7307('0x1'));var moment=require(_0x7307('0x2'));var BPromise=require(_0x7307('0x3'));var rs=require(_0x7307('0x4'));var fs=require('fs');var Redis=require(_0x7307('0x5'));var db=require(_0x7307('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7307('0x7'));var config=require(_0x7307('0x8'));var jayson=require(_0x7307('0x9'));var client=jayson[_0x7307('0xa')][_0x7307('0xb')]({'port':0x232a});config['redis']=_[_0x7307('0xc')](config[_0x7307('0xd')],{'host':_0x7307('0xe'),'port':0x18eb});var socket=require(_0x7307('0xf'))(new Redis(config[_0x7307('0xd')]));require(_0x7307('0x10'))['register'](socket);function respondWithRpcPromise(_0x40227f,_0x276ff4,_0x3690b9){return new BPromise(function(_0xe67d5e,_0x5a7f43){return client[_0x7307('0x11')](_0x40227f,_0x3690b9)['then'](function(_0x549585){logger[_0x7307('0x12')](_0x7307('0x13'),_0x276ff4,_0x7307('0x14'));logger[_0x7307('0x15')](_0x7307('0x16'),_0x276ff4,'request\x20sent',JSON['stringify'](_0x549585));if(_0x549585[_0x7307('0x17')]){if(_0x549585[_0x7307('0x17')][_0x7307('0x18')]===0x1f4){logger[_0x7307('0x17')](_0x7307('0x13'),_0x276ff4,_0x549585['error'][_0x7307('0x19')]);return _0x5a7f43(_0x549585['error']['message']);}logger['error'](_0x7307('0x13'),_0x276ff4,_0x549585[_0x7307('0x17')][_0x7307('0x19')]);return _0xe67d5e(_0x549585[_0x7307('0x17')][_0x7307('0x19')]);}else{logger['info'](_0x7307('0x13'),_0x276ff4,_0x7307('0x14'));_0xe67d5e(_0x549585['result'][_0x7307('0x19')]);}})[_0x7307('0x1a')](function(_0x12236d){logger[_0x7307('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x276ff4,_0x12236d);_0x5a7f43(_0x12236d);});});}exports[_0x7307('0x1b')]=function(_0x2ddf9e){var _0x3c09ef=this;return new Promise(function(_0x4f59a5,_0x5045e3){return db[_0x7307('0x1c')][_0x7307('0x1d')]({'raw':_0x2ddf9e[_0x7307('0x1e')]?_0x2ddf9e[_0x7307('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2ddf9e[_0x7307('0x1e')]?_0x2ddf9e['options'][_0x7307('0x1f')]||null:null,'attributes':_0x2ddf9e['options']?_0x2ddf9e[_0x7307('0x1e')][_0x7307('0x20')]||null:null,'limit':_0x2ddf9e[_0x7307('0x1e')]?_0x2ddf9e['options'][_0x7307('0x21')]||null:null,'include':_0x2ddf9e['options']?_0x2ddf9e[_0x7307('0x1e')][_0x7307('0x22')]?_['map'](_0x2ddf9e[_0x7307('0x1e')][_0x7307('0x22')],function(_0x2f53aa){return{'model':db[_0x2f53aa[_0x7307('0x23')]],'as':_0x2f53aa['as'],'attributes':_0x2f53aa[_0x7307('0x20')],'include':_0x2f53aa[_0x7307('0x22')]?_[_0x7307('0x24')](_0x2f53aa[_0x7307('0x22')],function(_0x4e2b27){return{'model':db[_0x4e2b27[_0x7307('0x23')]],'as':_0x4e2b27['as'],'attributes':_0x4e2b27['attributes'],'include':_0x4e2b27['include']?_[_0x7307('0x24')](_0x4e2b27['include'],function(_0x4a671b){return{'model':db[_0x4a671b[_0x7307('0x23')]],'as':_0x4a671b['as'],'attributes':_0x4a671b[_0x7307('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7307('0x25')](function(_0x512d26){logger[_0x7307('0x12')](_0x7307('0x1b'),_0x2ddf9e);logger[_0x7307('0x15')](_0x7307('0x1b'),_0x2ddf9e,JSON['stringify'](_0x512d26));_0x4f59a5(_0x512d26);})['catch'](function(_0x42a0f6){logger[_0x7307('0x17')](_0x7307('0x1b'),_0x42a0f6[_0x7307('0x19')],_0x2ddf9e);_0x5045e3(_0x3c09ef[_0x7307('0x17')](0x1f4,_0x42a0f6[_0x7307('0x19')]));});});};exports[_0x7307('0x26')]=function(_0x5a956b){var _0x1043b0=this;return new Promise(function(_0x4d801e,_0x1eea8e){return db[_0x7307('0x1c')][_0x7307('0x27')](_0x5a956b[_0x7307('0x28')],{'raw':_0x5a956b[_0x7307('0x1e')]?_0x5a956b[_0x7307('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x7307('0x25')](function(_0x33e3e9){logger[_0x7307('0x12')](_0x7307('0x26'),_0x5a956b);logger[_0x7307('0x15')]('CreateVoiceQueueReport',_0x5a956b,JSON[_0x7307('0x29')](_0x33e3e9));_0x4d801e(_0x33e3e9);})[_0x7307('0x1a')](function(_0x5b4c00){logger[_0x7307('0x17')](_0x7307('0x26'),_0x5b4c00[_0x7307('0x19')],_0x5a956b);_0x1eea8e(_0x1043b0[_0x7307('0x17')](0x1f4,_0x5b4c00[_0x7307('0x19')]));});});};exports[_0x7307('0x2a')]=function(_0x3dd6b0){var _0x185e1c=this;return new Promise(function(_0x1e4ba2,_0x46ac2d){return db[_0x7307('0x1c')][_0x7307('0x2b')](_0x3dd6b0[_0x7307('0x28')],{'raw':_0x3dd6b0[_0x7307('0x1e')]?_0x3dd6b0[_0x7307('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dd6b0['options']?_0x3dd6b0[_0x7307('0x1e')][_0x7307('0x1f')]||null:null,'attributes':_0x3dd6b0[_0x7307('0x1e')]?_0x3dd6b0[_0x7307('0x1e')]['attributes']||null:null,'limit':_0x3dd6b0[_0x7307('0x1e')]?_0x3dd6b0[_0x7307('0x1e')][_0x7307('0x21')]||null:null})['then'](function(_0xdc3e3a){logger['info'](_0x7307('0x2a'),_0x3dd6b0);logger[_0x7307('0x15')](_0x7307('0x2a'),_0x3dd6b0,JSON[_0x7307('0x29')](_0xdc3e3a));_0x1e4ba2(_0xdc3e3a);})[_0x7307('0x1a')](function(_0x274c1e){logger['error'](_0x7307('0x2a'),_0x274c1e[_0x7307('0x19')],_0x3dd6b0);_0x46ac2d(_0x185e1c[_0x7307('0x17')](0x1f4,_0x274c1e['message']));});});}; \ No newline at end of file +var _0x4a1f=['UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateVoiceQueueReport','VoiceQueueReport','create','body'];(function(_0xc99259,_0x1fd7ab){var _0x4339b5=function(_0x2b4187){while(--_0x2b4187){_0xc99259['push'](_0xc99259['shift']());}};_0x4339b5(++_0x1fd7ab);}(_0x4a1f,0x1e5));var _0xf4a1=function(_0x40a0a4,_0x4269e1){_0x40a0a4=_0x40a0a4-0x0;var _0x115c37=_0x4a1f[_0x40a0a4];return _0x115c37;};'use strict';var _=require(_0xf4a1('0x0'));var util=require(_0xf4a1('0x1'));var moment=require(_0xf4a1('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4a1('0x3'));var fs=require('fs');var Redis=require(_0xf4a1('0x4'));var db=require(_0xf4a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4a1('0x6'))(_0xf4a1('0x7'));var config=require(_0xf4a1('0x8'));var jayson=require(_0xf4a1('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xf4a1('0xa')]=_[_0xf4a1('0xb')](config[_0xf4a1('0xa')],{'host':_0xf4a1('0xc'),'port':0x18eb});var socket=require(_0xf4a1('0xd'))(new Redis(config[_0xf4a1('0xa')]));require(_0xf4a1('0xe'))[_0xf4a1('0xf')](socket);function respondWithRpcPromise(_0x53c716,_0x4bfe3c,_0x4ef4fc){return new BPromise(function(_0x2c664b,_0x8e1255){return client[_0xf4a1('0x10')](_0x53c716,_0x4ef4fc)[_0xf4a1('0x11')](function(_0x284451){logger['info'](_0xf4a1('0x12'),_0x4bfe3c,_0xf4a1('0x13'));logger[_0xf4a1('0x14')](_0xf4a1('0x15'),_0x4bfe3c,'request\x20sent',JSON[_0xf4a1('0x16')](_0x284451));if(_0x284451['error']){if(_0x284451[_0xf4a1('0x17')][_0xf4a1('0x18')]===0x1f4){logger[_0xf4a1('0x17')](_0xf4a1('0x12'),_0x4bfe3c,_0x284451['error'][_0xf4a1('0x19')]);return _0x8e1255(_0x284451[_0xf4a1('0x17')][_0xf4a1('0x19')]);}logger['error'](_0xf4a1('0x12'),_0x4bfe3c,_0x284451[_0xf4a1('0x17')][_0xf4a1('0x19')]);return _0x2c664b(_0x284451[_0xf4a1('0x17')]['message']);}else{logger[_0xf4a1('0x1a')](_0xf4a1('0x12'),_0x4bfe3c,_0xf4a1('0x13'));_0x2c664b(_0x284451[_0xf4a1('0x1b')]['message']);}})[_0xf4a1('0x1c')](function(_0x553bdf){logger[_0xf4a1('0x17')](_0xf4a1('0x12'),_0x4bfe3c,_0x553bdf);_0x8e1255(_0x553bdf);});});}exports[_0xf4a1('0x1d')]=function(_0x1a2d77){var _0x172473=this;return new Promise(function(_0x5ccf45,_0x48f3e6){return db['VoiceQueueReport'][_0xf4a1('0x1e')]({'raw':_0x1a2d77['options']?_0x1a2d77[_0xf4a1('0x1f')][_0xf4a1('0x20')]===undefined?!![]:![]:!![],'where':_0x1a2d77[_0xf4a1('0x1f')]?_0x1a2d77[_0xf4a1('0x1f')][_0xf4a1('0x21')]||null:null,'attributes':_0x1a2d77[_0xf4a1('0x1f')]?_0x1a2d77[_0xf4a1('0x1f')][_0xf4a1('0x22')]||null:null,'limit':_0x1a2d77[_0xf4a1('0x1f')]?_0x1a2d77[_0xf4a1('0x1f')][_0xf4a1('0x23')]||null:null,'include':_0x1a2d77[_0xf4a1('0x1f')]?_0x1a2d77['options']['include']?_[_0xf4a1('0x24')](_0x1a2d77['options'][_0xf4a1('0x25')],function(_0x21b971){return{'model':db[_0x21b971[_0xf4a1('0x26')]],'as':_0x21b971['as'],'attributes':_0x21b971[_0xf4a1('0x22')],'include':_0x21b971['include']?_[_0xf4a1('0x24')](_0x21b971[_0xf4a1('0x25')],function(_0x1e7069){return{'model':db[_0x1e7069[_0xf4a1('0x26')]],'as':_0x1e7069['as'],'attributes':_0x1e7069[_0xf4a1('0x22')],'include':_0x1e7069['include']?_[_0xf4a1('0x24')](_0x1e7069[_0xf4a1('0x25')],function(_0x4f7d31){return{'model':db[_0x4f7d31[_0xf4a1('0x26')]],'as':_0x4f7d31['as'],'attributes':_0x4f7d31[_0xf4a1('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b1ca2){logger['info'](_0xf4a1('0x1d'),_0x1a2d77);logger[_0xf4a1('0x14')]('GetVoiceQueueReport',_0x1a2d77,JSON['stringify'](_0x3b1ca2));_0x5ccf45(_0x3b1ca2);})[_0xf4a1('0x1c')](function(_0x42fd08){logger[_0xf4a1('0x17')](_0xf4a1('0x1d'),_0x42fd08[_0xf4a1('0x19')],_0x1a2d77);_0x48f3e6(_0x172473[_0xf4a1('0x17')](0x1f4,_0x42fd08[_0xf4a1('0x19')]));});});};exports[_0xf4a1('0x27')]=function(_0x275586){var _0x5491fd=this;return new Promise(function(_0x1d9fe8,_0x8e0a4a){return db[_0xf4a1('0x28')][_0xf4a1('0x29')](_0x275586['body'],{'raw':_0x275586[_0xf4a1('0x1f')]?_0x275586[_0xf4a1('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2bf86b){logger[_0xf4a1('0x1a')](_0xf4a1('0x27'),_0x275586);logger['debug'](_0xf4a1('0x27'),_0x275586,JSON['stringify'](_0x2bf86b));_0x1d9fe8(_0x2bf86b);})[_0xf4a1('0x1c')](function(_0x35c350){logger[_0xf4a1('0x17')](_0xf4a1('0x27'),_0x35c350[_0xf4a1('0x19')],_0x275586);_0x8e0a4a(_0x5491fd['error'](0x1f4,_0x35c350[_0xf4a1('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x2f71aa){var _0xa9bf58=this;return new Promise(function(_0x9c14c3,_0x342929){return db[_0xf4a1('0x28')]['update'](_0x2f71aa[_0xf4a1('0x2a')],{'raw':_0x2f71aa['options']?_0x2f71aa[_0xf4a1('0x1f')][_0xf4a1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f71aa[_0xf4a1('0x1f')]?_0x2f71aa[_0xf4a1('0x1f')][_0xf4a1('0x21')]||null:null,'attributes':_0x2f71aa[_0xf4a1('0x1f')]?_0x2f71aa['options'][_0xf4a1('0x22')]||null:null,'limit':_0x2f71aa[_0xf4a1('0x1f')]?_0x2f71aa[_0xf4a1('0x1f')]['limit']||null:null})[_0xf4a1('0x11')](function(_0x3228ce){logger[_0xf4a1('0x1a')](_0xf4a1('0x2b'),_0x2f71aa);logger[_0xf4a1('0x14')]('UpdateVoiceQueueReport',_0x2f71aa,JSON[_0xf4a1('0x16')](_0x3228ce));_0x9c14c3(_0x3228ce);})['catch'](function(_0x30fb70){logger[_0xf4a1('0x17')](_0xf4a1('0x2b'),_0x30fb70[_0xf4a1('0x19')],_0x2f71aa);_0x342929(_0xa9bf58[_0xf4a1('0x17')](0x1f4,_0x30fb70[_0xf4a1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 54a52e3..d054d04 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 _0xdeb2=['save','remove','update','emit','removeListener','register','./voiceQueueReport.events'];(function(_0x23197e,_0x4e1aae){var _0x23fbb5=function(_0x35dd6e){while(--_0x35dd6e){_0x23197e['push'](_0x23197e['shift']());}};_0x23fbb5(++_0x4e1aae);}(_0xdeb2,0xca));var _0x2deb=function(_0xcc3979,_0x343b85){_0xcc3979=_0xcc3979-0x0;var _0x25dccd=_0xdeb2[_0xcc3979];return _0x25dccd;};'use strict';var VoiceQueueReportEvents=require(_0x2deb('0x0'));var events=[_0x2deb('0x1'),_0x2deb('0x2'),_0x2deb('0x3')];function createListener(_0x2effeb,_0x314fc2){return function(_0x5cc437){_0x314fc2[_0x2deb('0x4')](_0x2effeb,_0x5cc437);};}function removeListener(_0x57d0f7,_0x4045f3){return function(){VoiceQueueReportEvents[_0x2deb('0x5')](_0x57d0f7,_0x4045f3);};}exports[_0x2deb('0x6')]=function(_0x5363ae){for(var _0x2d2c50=0x0,_0x1340f9=events['length'];_0x2d2c50<_0x1340f9;_0x2d2c50++){var _0x13c396=events[_0x2d2c50];var _0x3cf2b5=createListener('voiceQueueReport:'+_0x13c396,_0x5363ae);VoiceQueueReportEvents['on'](_0x13c396,_0x3cf2b5);}}; \ No newline at end of file +var _0xbe40=['remove','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x351e57,_0x6f6f4b){var _0x3698a5=function(_0x39ca2b){while(--_0x39ca2b){_0x351e57['push'](_0x351e57['shift']());}};_0x3698a5(++_0x6f6f4b);}(_0xbe40,0x96));var _0x0be4=function(_0x4bddde,_0x4fa378){_0x4bddde=_0x4bddde-0x0;var _0x18b46d=_0xbe40[_0x4bddde];return _0x18b46d;};'use strict';var VoiceQueueReportEvents=require(_0x0be4('0x0'));var events=[_0x0be4('0x1'),_0x0be4('0x2'),'update'];function createListener(_0x3c6792,_0x4d5099){return function(_0x267188){_0x4d5099[_0x0be4('0x3')](_0x3c6792,_0x267188);};}function removeListener(_0x4772c5,_0xaf2e08){return function(){VoiceQueueReportEvents[_0x0be4('0x4')](_0x4772c5,_0xaf2e08);};}exports[_0x0be4('0x5')]=function(_0x38fb11){for(var _0x419cfb=0x0,_0x49aab9=events[_0x0be4('0x6')];_0x419cfb<_0x49aab9;_0x419cfb++){var _0x12c5a8=events[_0x419cfb];var _0x329d4e=createListener(_0x0be4('0x7')+_0x12c5a8,_0x38fb11);VoiceQueueReportEvents['on'](_0x12c5a8,_0x329d4e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 51aa19d..cd9974a 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 _0x69ec=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x48c957,_0x45143a){var _0x4ed80c=function(_0x136f83){while(--_0x136f83){_0x48c957['push'](_0x48c957['shift']());}};_0x4ed80c(++_0x45143a);}(_0x69ec,0x14c));var _0xc69e=function(_0x241c5d,_0x4f087e){_0x241c5d=_0x241c5d-0x0;var _0x41cd50=_0x69ec[_0x241c5d];return _0x41cd50;};'use strict';var multer=require(_0xc69e('0x0'));var util=require(_0xc69e('0x1'));var path=require(_0xc69e('0x2'));var timeout=require(_0xc69e('0x3'));var express=require(_0xc69e('0x4'));var router=express[_0xc69e('0x5')]();var auth=require(_0xc69e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc69e('0x7'));var controller=require(_0xc69e('0x8'));router[_0xc69e('0x9')]('/',auth[_0xc69e('0xa')](),controller['index']);router[_0xc69e('0x9')](_0xc69e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc69e('0xc')]('/',auth[_0xc69e('0xa')](),controller[_0xc69e('0xd')]);router[_0xc69e('0xe')]('/:id',auth[_0xc69e('0xa')](),controller[_0xc69e('0xf')]);router[_0xc69e('0x10')]('/:id',auth[_0xc69e('0xa')](),controller[_0xc69e('0x11')]);module[_0xc69e('0x12')]=router; \ No newline at end of file +var _0x02ac=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer'];(function(_0xde2ad9,_0x450285){var _0x3760be=function(_0x12c274){while(--_0x12c274){_0xde2ad9['push'](_0xde2ad9['shift']());}};_0x3760be(++_0x450285);}(_0x02ac,0x1ed));var _0xc02a=function(_0x5b36f2,_0x194e22){_0x5b36f2=_0x5b36f2-0x0;var _0x3de420=_0x02ac[_0x5b36f2];return _0x3de420;};'use strict';var multer=require(_0xc02a('0x0'));var util=require('util');var path=require(_0xc02a('0x1'));var timeout=require(_0xc02a('0x2'));var express=require(_0xc02a('0x3'));var router=express[_0xc02a('0x4')]();var auth=require(_0xc02a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc02a('0x6'));var controller=require(_0xc02a('0x7'));router[_0xc02a('0x8')]('/',auth['isAuthenticated'](),controller[_0xc02a('0x9')]);router[_0xc02a('0x8')](_0xc02a('0xa'),auth[_0xc02a('0xb')](),controller[_0xc02a('0xc')]);router[_0xc02a('0xd')]('/',auth['isAuthenticated'](),controller[_0xc02a('0xe')]);router[_0xc02a('0xf')](_0xc02a('0xa'),auth[_0xc02a('0xb')](),controller[_0xc02a('0x10')]);router[_0xc02a('0x11')](_0xc02a('0xa'),auth[_0xc02a('0xb')](),controller['destroy']);module[_0xc02a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 2a21f9f..ee33ffd 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 _0x58d1=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0xf174bf,_0x1003c3){var _0xf5a82a=function(_0x300cc7){while(--_0x300cc7){_0xf174bf['push'](_0xf174bf['shift']());}};_0xf5a82a(++_0x1003c3);}(_0x58d1,0x8d));var _0x158d=function(_0x165360,_0x5ca20b){_0x165360=_0x165360-0x0;var _0x5acc59=_0x58d1[_0x165360];return _0x5acc59;};'use strict';var Sequelize=require(_0x158d('0x0'));var moment=require(_0x158d('0x1'));module[_0x158d('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x158d('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x158d('0x4')],'allowNull':![],'defaultValue':moment()[_0x158d('0x5')](_0x158d('0x6'))}}; \ No newline at end of file +var _0x2f32=['format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x2f32,0xe3));var _0x22f3=function(_0x53010e,_0x5ef6ed){_0x53010e=_0x53010e-0x0;var _0x10b322=_0x2f32[_0x53010e];return _0x10b322;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x22f3('0x0'));module[_0x22f3('0x1')]={'time':{'type':Sequelize[_0x22f3('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x22f3('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x22f3('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x22f3('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x22f3('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x22f3('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x22f3('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x22f3('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x22f3('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x22f3('0x3')](_0x22f3('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1e19851..7cf3518 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 _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(_0x12fcf7,_0x2fa120){var _0x398c34=function(_0x5cae2e){while(--_0x5cae2e){_0x12fcf7['push'](_0x12fcf7['shift']());}};_0x398c34(++_0x2fa120);}(_0xb10b,0x12a));var _0xbb10=function(_0x283ce1,_0x52f230){_0x283ce1=_0x283ce1-0x0;var _0xda31d8=_0xb10b[_0x283ce1];return _0xda31d8;};'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 +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(_0x55d97b,_0xb3cac0){var _0x4d4ce1=function(_0x2a3297){while(--_0x2a3297){_0x55d97b['push'](_0x55d97b['shift']());}};_0x4d4ce1(++_0xb3cac0);}(_0xb10b,0x12a));var _0xbb10=function(_0x2199f1,_0x10c734){_0x2199f1=_0x2199f1-0x0;var _0x43436b=_0xb10b[_0x2199f1];return _0x43436b;};'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 08e5326..0f078dc 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 _0x9fd4=['voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x4e11d9,_0x453c5c){var _0x2811f9=function(_0x420f0f){while(--_0x420f0f){_0x4e11d9['push'](_0x4e11d9['shift']());}};_0x2811f9(++_0x453c5c);}(_0x9fd4,0x16c));var _0x49fd=function(_0x48c19b,_0x3a1721){_0x48c19b=_0x48c19b-0x0;var _0x7b88f=_0x9fd4[_0x48c19b];return _0x7b88f;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[{'name':_0x49fd('0xc'),'fields':[_0x49fd('0xd'),_0x49fd('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x81c6=['../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event','dtm','util','bluebird','request-promise','path'];(function(_0x592d58,_0xf0c3da){var _0x4ac596=function(_0x4d0732){while(--_0x4d0732){_0x592d58['push'](_0x592d58['shift']());}};_0x4ac596(++_0xf0c3da);}(_0x81c6,0x1d5));var _0x681c=function(_0x25c398,_0x13284b){_0x25c398=_0x25c398-0x0;var _0x3311bc=_0x81c6[_0x25c398];return _0x3311bc;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x681c('0x9'),_0x681c('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 260e4c5..18f6e10 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 _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x4a7b83,_0x16bf83){var _0x5cf2db=function(_0x41fea4){while(--_0x41fea4){_0x4a7b83['push'](_0x4a7b83['shift']());}};_0x5cf2db(++_0x16bf83);}(_0x96cc,0x16c));var _0xc96c=function(_0x4005e8,_0x52a3b5){_0x4005e8=_0x4005e8-0x0;var _0x2d2903=_0x96cc[_0x4005e8];return _0x2d2903;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file +var _0xd7a0=['message','VoiceQueuesLog,\x20%s,\x20%s','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xd7a0,0x163));var _0x0d7a=function(_0xe0033b,_0x5114bc){_0xe0033b=_0xe0033b-0x0;var _0x1b42d1=_0xd7a0[_0xe0033b];return _0x1b42d1;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var moment=require('moment');var BPromise=require(_0x0d7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d7a('0x3'));var db=require(_0x0d7a('0x4'))['db'];var utils=require(_0x0d7a('0x5'));var logger=require(_0x0d7a('0x6'))(_0x0d7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d7a('0x8'));var client=jayson[_0x0d7a('0x9')][_0x0d7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16461e,_0x22b404,_0x371b7d){return new BPromise(function(_0x1514ae,_0x55d585){return client[_0x0d7a('0xb')](_0x16461e,_0x371b7d)[_0x0d7a('0xc')](function(_0x450d42){logger[_0x0d7a('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'));logger[_0x0d7a('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'),JSON[_0x0d7a('0x10')](_0x450d42));if(_0x450d42[_0x0d7a('0x11')]){if(_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x12')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x22b404,_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x13')]);return _0x55d585(_0x450d42[_0x0d7a('0x11')]['message']);}logger[_0x0d7a('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x22b404,_0x450d42['error'][_0x0d7a('0x13')]);return _0x1514ae(_0x450d42['error'][_0x0d7a('0x13')]);}else{logger[_0x0d7a('0xd')](_0x0d7a('0x14'),_0x22b404,_0x0d7a('0xe'));_0x1514ae(_0x450d42['result'][_0x0d7a('0x13')]);}})[_0x0d7a('0x15')](function(_0x497cbb){logger[_0x0d7a('0x11')](_0x0d7a('0x14'),_0x22b404,_0x497cbb);_0x55d585(_0x497cbb);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 3789bc4..c79b6a0 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(_0x452fda,_0x2dd516){var _0xa173d6=function(_0x5b98da){while(--_0x5b98da){_0x452fda['push'](_0x452fda['shift']());}};_0xa173d6(++_0x2dd516);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x2c95ce,_0x11032){var _0x5c8041=function(_0x174db4){while(--_0x174db4){_0x2c95ce['push'](_0x2c95ce['shift']());}};_0x5c8041(++_0x11032);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 4da419b..1bcfeae 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 _0x8a9a=['setDataValue','channel','split','TEXT','NEW','FLOAT','DATE','format','toString','MM-DD-YYYY\x20HH:mm','sequelize','path','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x18bf17,_0x32626e){var _0x7c4e02=function(_0x4afbbe){while(--_0x4afbbe){_0x18bf17['push'](_0x18bf17['shift']());}};_0x7c4e02(++_0x32626e);}(_0x8a9a,0xe7));var _0xa8a9=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x8a9a[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0xa8a9('0x0'));var moment=require('moment');var path=require(_0xa8a9('0x1'));module[_0xa8a9('0x2')]={'format':{'type':Sequelize[_0xa8a9('0x3')],'get':function(){return this[_0xa8a9('0x4')](_0xa8a9('0x5'))?path['extname'](this[_0xa8a9('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xa8a9('0x6')]},'channel':{'type':Sequelize[_0xa8a9('0x6')],'set':function(_0x19d739){if(_0x19d739){this[_0xa8a9('0x7')](_0xa8a9('0x8'),_0x19d739);this[_0xa8a9('0x7')]('membername',_0x19d739[_0xa8a9('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa8a9('0x6')]},'calleridname':{'type':Sequelize[_0xa8a9('0x6')]},'connectedlinenum':{'type':Sequelize[_0xa8a9('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa8a9('0x6')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa8a9('0x6')]},'type':{'type':Sequelize[_0xa8a9('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa8a9('0x6')]},'userDisposition':{'type':Sequelize[_0xa8a9('0x6')]},'location':{'type':Sequelize[_0xa8a9('0xa')]},'transcribeName':{'type':Sequelize[_0xa8a9('0x6')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xa8a9('0xb')},'fileUri':{'type':Sequelize[_0xa8a9('0xa')]},'fileText':{'type':Sequelize[_0xa8a9('0xa')]},'failureReason':{'type':Sequelize[_0xa8a9('0xa')]},'sentiment':{'type':Sequelize[_0xa8a9('0x6')]},'sPositive':{'type':Sequelize[_0xa8a9('0xc')]},'sNegative':{'type':Sequelize[_0xa8a9('0xc')]},'sNeutral':{'type':Sequelize[_0xa8a9('0xc')]},'sMixed':{'type':Sequelize[_0xa8a9('0xc')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xa8a9('0xd')],'get':function(){return moment(this[_0xa8a9('0x4')]('createdAt'))[_0xa8a9('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xa8a9('0xf')]();}},'updatedAt':{'type':Sequelize[_0xa8a9('0xd')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xa8a9('0xe')](_0xa8a9('0x10'))[_0xa8a9('0xf')]();}}}; \ No newline at end of file +var _0xca1c=['extname','STRING','setDataValue','channel','membername','split','NEW','TEXT','FLOAT','BOOLEAN','DATE','format','MM-DD-YYYY\x20HH:mm','toString','moment','path','getDataValue','value'];(function(_0xd584dd,_0x1bb3ed){var _0x41c667=function(_0x10ef17){while(--_0x10ef17){_0xd584dd['push'](_0xd584dd['shift']());}};_0x41c667(++_0x1bb3ed);}(_0xca1c,0x1be));var _0xcca1=function(_0x243c54,_0x520f37){_0x243c54=_0x243c54-0x0;var _0xcd69fc=_0xca1c[_0x243c54];return _0xcd69fc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcca1('0x0'));var path=require(_0xcca1('0x1'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xcca1('0x2')](_0xcca1('0x3'))?path[_0xcca1('0x4')](this[_0xcca1('0x2')](_0xcca1('0x3'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcca1('0x5')],'set':function(_0x7a350b){if(_0x7a350b){this[_0xcca1('0x6')](_0xcca1('0x7'),_0x7a350b);this[_0xcca1('0x6')](_0xcca1('0x8'),_0x7a350b[_0xcca1('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xcca1('0x5')]},'calleridnum':{'type':Sequelize[_0xcca1('0x5')]},'calleridname':{'type':Sequelize[_0xcca1('0x5')]},'connectedlinenum':{'type':Sequelize[_0xcca1('0x5')]},'connectedlinename':{'type':Sequelize[_0xcca1('0x5')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcca1('0x5')]},'exten':{'type':Sequelize[_0xcca1('0x5')]},'value':{'type':Sequelize[_0xcca1('0x5')]},'type':{'type':Sequelize[_0xcca1('0x5')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xcca1('0x5')]},'userDisposition':{'type':Sequelize[_0xcca1('0x5')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0xcca1('0x5')]},'transcribeStatus':{'type':Sequelize[_0xcca1('0x5')],'defaultValue':_0xcca1('0xa')},'fileUri':{'type':Sequelize[_0xcca1('0xb')]},'fileText':{'type':Sequelize[_0xcca1('0xb')]},'failureReason':{'type':Sequelize[_0xcca1('0xb')]},'sentiment':{'type':Sequelize[_0xcca1('0x5')]},'sPositive':{'type':Sequelize[_0xcca1('0xc')]},'sNegative':{'type':Sequelize[_0xcca1('0xc')]},'sNeutral':{'type':Sequelize[_0xcca1('0xc')]},'sMixed':{'type':Sequelize[_0xcca1('0xc')]},'tempSentiment':{'type':Sequelize[_0xcca1('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xcca1('0xe')],'get':function(){return moment(this[_0xcca1('0x2')]('createdAt'))[_0xcca1('0xf')](_0xcca1('0x10'))[_0xcca1('0x11')]();}},'updatedAt':{'type':Sequelize[_0xcca1('0xe')],'get':function(){return moment(this[_0xcca1('0x2')]('updatedAt'))[_0xcca1('0xf')](_0xcca1('0x10'))[_0xcca1('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index be1aafa..e4640dc 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 _0x6cc3=['papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','status','end','count','offset','limit','Content-Range','json','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','VIRTUAL','merge','VoiceRecording','includeAll','findAll','rows','show','params','find','create','body','catch','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','push','recording','Sequelize','extname','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js'];(function(_0x5881d0,_0xe8cc44){var _0x3e4211=function(_0x3bfc6e){while(--_0x3bfc6e){_0x5881d0['push'](_0x5881d0['shift']());}};_0x3e4211(++_0xe8cc44);}(_0x6cc3,0x7c));var _0x36cc=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x6cc3[_0x1fc122];return _0xa2cb13;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x36cc('0x0'));var rimraf=require(_0x36cc('0x1'));var zipdir=require(_0x36cc('0x2'));var jsonpatch=require(_0x36cc('0x3'));var rp=require('request-promise');var moment=require(_0x36cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36cc('0x5'));var util=require(_0x36cc('0x6'));var path=require(_0x36cc('0x7'));var sox=require(_0x36cc('0x8'));var csv=require(_0x36cc('0x9'));var ejs=require(_0x36cc('0xa'));var fs=require('fs');var _=require(_0x36cc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36cc('0xc'));var deskjs=require(_0x36cc('0xd'));var toCsv=require(_0x36cc('0x9'));var querystring=require('querystring');var Papa=require(_0x36cc('0xe'));var AWS=require(_0x36cc('0xf'));var uuidv4=require(_0x36cc('0x10'));var Redis=require(_0x36cc('0x11'));var authService=require(_0x36cc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x36cc('0x13'));var hardwareService=require(_0x36cc('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x36cc('0x15'))['db'];function respondWithStatusCode(_0x4629bb,_0x1da447){_0x1da447=_0x1da447||0xcc;return function(_0x45e7b3){if(_0x45e7b3){return _0x4629bb['sendStatus'](_0x1da447);}return _0x4629bb[_0x36cc('0x16')](_0x1da447)[_0x36cc('0x17')]();};}function respondWithResult(_0x4641dd,_0x4f3c88){_0x4f3c88=_0x4f3c88||0xc8;return function(_0x34e1af){if(_0x34e1af){return _0x4641dd[_0x36cc('0x16')](_0x4f3c88)['json'](_0x34e1af);}};}function respondWithFilteredResult(_0x4f2cbe,_0x3f326c){return function(_0x2ccd17){if(_0x2ccd17){var _0x290cbd=_0x2ccd17[_0x36cc('0x18')],_0x5313ea=_0x3f326c[_0x36cc('0x19')],_0x1b0ef9=_0x3f326c[_0x36cc('0x19')]+_0x3f326c[_0x36cc('0x1a')],_0x1ba204;if(_0x1b0ef9>=_0x290cbd){_0x1b0ef9=_0x290cbd;_0x1ba204=0xc8;}else{_0x1ba204=0xce;}_0x4f2cbe[_0x36cc('0x16')](_0x1ba204);return _0x4f2cbe['set'](_0x36cc('0x1b'),_0x5313ea+'-'+_0x1b0ef9+'/'+_0x290cbd)[_0x36cc('0x1c')](_0x2ccd17);}return null;};}function patchUpdates(_0x29793f){return function(_0xa36395){try{jsonpatch['apply'](_0xa36395,_0x29793f,!![]);}catch(_0x5482d6){return BPromise['reject'](_0x5482d6);}return _0xa36395[_0x36cc('0x1d')]();};}function saveUpdates(_0xcefa72,_0x346dc3){return function(_0x831525){if(_0x831525){return _0x831525[_0x36cc('0x1e')](_0xcefa72)[_0x36cc('0x1f')](function(_0x8ffbe){return _0x8ffbe;});}return null;};}function removeEntity(_0x9025ea,_0x370b1d){return function(_0x33025e){if(_0x33025e){return _0x33025e['destroy']()[_0x36cc('0x1f')](function(){_0x9025ea[_0x36cc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1464ed,_0x36a6a8){return function(_0x4697fe){if(!_0x4697fe){_0x1464ed[_0x36cc('0x20')](0x194);}return _0x4697fe;};}function handleError(_0x56a31d,_0x1ec145){_0x1ec145=_0x1ec145||0x1f4;return function(_0x1b2dec){logger[_0x36cc('0x21')](_0x1b2dec[_0x36cc('0x22')]);if(_0x1b2dec[_0x36cc('0x23')]){delete _0x1b2dec[_0x36cc('0x23')];}_0x56a31d[_0x36cc('0x16')](_0x1ec145)[_0x36cc('0x24')](_0x1b2dec);};}exports[_0x36cc('0x25')]=function(_0x2f703f,_0x5e6a7a){var _0x60d425={},_0x30b087={},_0x2dfa02={'count':0x0,'rows':[]};var _0x4967c2=_[_0x36cc('0x26')](db['VoiceRecording'][_0x36cc('0x27')],function(_0x499aef){return{'name':_0x499aef[_0x36cc('0x28')],'type':_0x499aef[_0x36cc('0x29')][_0x36cc('0x2a')]};});_0x30b087[_0x36cc('0x2b')]=_[_0x36cc('0x2c')](_[_0x36cc('0x26')](_0x4967c2,_0x36cc('0x23')),[_0x36cc('0x2d')]);_0x30b087[_0x36cc('0x2e')]=_[_0x36cc('0x2f')](_0x2f703f[_0x36cc('0x2e')]);_0x30b087['filters']=_[_0x36cc('0x30')](_0x30b087[_0x36cc('0x2b')],_0x30b087[_0x36cc('0x2e')]);_0x60d425[_0x36cc('0x31')]=_['intersection'](_0x30b087[_0x36cc('0x2b')],qs[_0x36cc('0x32')](_0x2f703f[_0x36cc('0x2e')][_0x36cc('0x32')]));_0x60d425['attributes']=_0x60d425[_0x36cc('0x31')][_0x36cc('0x33')]?_0x60d425[_0x36cc('0x31')]:_0x30b087[_0x36cc('0x2b')];if(!_0x2f703f[_0x36cc('0x2e')][_0x36cc('0x34')]('nolimit')){_0x60d425['limit']=qs[_0x36cc('0x1a')](_0x2f703f['query'][_0x36cc('0x1a')]);_0x60d425[_0x36cc('0x19')]=qs[_0x36cc('0x19')](_0x2f703f['query'][_0x36cc('0x19')]);}_0x60d425[_0x36cc('0x35')]=qs[_0x36cc('0x36')](_0x2f703f[_0x36cc('0x2e')]['sort']);_0x60d425['where']=qs[_0x36cc('0x37')](_['pick'](_0x2f703f[_0x36cc('0x2e')],_0x30b087[_0x36cc('0x37')]),_0x4967c2);if(_0x2f703f[_0x36cc('0x2e')][_0x36cc('0x38')]){_0x60d425['where']=_['merge'](_0x60d425[_0x36cc('0x39')],{'$or':_[_0x36cc('0x26')](_0x4967c2,function(_0x5b4385){if(_0x5b4385[_0x36cc('0x29')]!==_0x36cc('0x3a')){var _0x1834c0={};_0x1834c0[_0x5b4385[_0x36cc('0x23')]]={'$like':'%'+_0x2f703f[_0x36cc('0x2e')][_0x36cc('0x38')]+'%'};return _0x1834c0;}})});}_0x60d425=_[_0x36cc('0x3b')]({},_0x60d425,_0x2f703f['options']);var _0x16fdd5={'where':_0x60d425[_0x36cc('0x39')]};return db[_0x36cc('0x3c')]['count'](_0x16fdd5)[_0x36cc('0x1f')](function(_0xc71f49){_0x2dfa02['count']=_0xc71f49;if(_0x2f703f['query'][_0x36cc('0x3d')]){_0x60d425['include']=[{'all':!![]}];}return db[_0x36cc('0x3c')][_0x36cc('0x3e')](_0x60d425);})['then'](function(_0x4bd5a9){_0x2dfa02[_0x36cc('0x3f')]=_0x4bd5a9;return _0x2dfa02;})[_0x36cc('0x1f')](respondWithFilteredResult(_0x5e6a7a,_0x60d425))['catch'](handleError(_0x5e6a7a,null));};exports[_0x36cc('0x40')]=function(_0x98d799,_0x34b204){var _0x1ca00c={'raw':![],'where':{'id':_0x98d799[_0x36cc('0x41')]['id']}},_0x37addf={};_0x37addf[_0x36cc('0x2b')]=_[_0x36cc('0x2f')](db[_0x36cc('0x3c')][_0x36cc('0x27')]);_0x37addf[_0x36cc('0x2e')]=_[_0x36cc('0x2f')](_0x98d799[_0x36cc('0x2e')]);_0x37addf['filters']=_[_0x36cc('0x30')](_0x37addf[_0x36cc('0x2b')],_0x37addf[_0x36cc('0x2e')]);_0x1ca00c[_0x36cc('0x31')]=_['intersection'](_0x37addf[_0x36cc('0x2b')],qs[_0x36cc('0x32')](_0x98d799[_0x36cc('0x2e')][_0x36cc('0x32')]));_0x1ca00c[_0x36cc('0x31')]=_0x1ca00c[_0x36cc('0x31')][_0x36cc('0x33')]?_0x1ca00c[_0x36cc('0x31')]:_0x37addf[_0x36cc('0x2b')];if(_0x98d799['query'][_0x36cc('0x3d')]){_0x1ca00c['include']=[{'all':!![]}];}_0x1ca00c=_[_0x36cc('0x3b')]({},_0x1ca00c,_0x98d799['options']);return db[_0x36cc('0x3c')][_0x36cc('0x42')](_0x1ca00c)['then'](handleEntityNotFound(_0x34b204,null))[_0x36cc('0x1f')](respondWithResult(_0x34b204,null))['catch'](handleError(_0x34b204,null));};exports[_0x36cc('0x43')]=function(_0x1bb970,_0x105cec){return db[_0x36cc('0x3c')][_0x36cc('0x43')](_0x1bb970[_0x36cc('0x44')],{})[_0x36cc('0x1f')](respondWithResult(_0x105cec,0xc9))[_0x36cc('0x45')](handleError(_0x105cec,null));};exports[_0x36cc('0x1e')]=function(_0x4656f7,_0x294ffe){if(_0x4656f7[_0x36cc('0x44')]['id']){delete _0x4656f7['body']['id'];}return db['VoiceRecording'][_0x36cc('0x42')]({'where':{'id':_0x4656f7[_0x36cc('0x41')]['id']}})[_0x36cc('0x1f')](handleEntityNotFound(_0x294ffe,null))['then'](saveUpdates(_0x4656f7['body'],null))[_0x36cc('0x1f')](respondWithResult(_0x294ffe,null))[_0x36cc('0x45')](handleError(_0x294ffe,null));};exports[_0x36cc('0x46')]=function(_0x4c09f3,_0x1a0fb3){return db[_0x36cc('0x3c')][_0x36cc('0x46')]()[_0x36cc('0x1f')](respondWithResult(_0x1a0fb3,null))[_0x36cc('0x45')](handleError(_0x1a0fb3,null));};exports[_0x36cc('0x47')]=function(_0x21dda7,_0x3a8131,_0x2ba101){var _0x1cc4a8=require('../../components/encryptor');var _0xa73bc0=![];var _0x6ac83={};if(_0x21dda7[_0x36cc('0x2e')][_0x36cc('0x29')]&&_0x21dda7[_0x36cc('0x2e')][_0x36cc('0x29')]===_0x36cc('0x48')){_0x6ac83['uniqueid']=_0x21dda7['params']['id'];}else{_0x6ac83['id']=_0x21dda7[_0x36cc('0x41')]['id'];}return db[_0x36cc('0x3c')][_0x36cc('0x42')]({'where':_0x6ac83,'attributes':['id',_0x36cc('0x49')],'raw':!![]})[_0x36cc('0x1f')](handleEntityNotFound(_0x3a8131,null))['then'](function(_0x1f4c94){if(_0x1f4c94){var _0x684b1a=_0x1f4c94[_0x36cc('0x49')];var _0x238d80=util[_0x36cc('0x2d')](_0x36cc('0x4a'),_0x684b1a);if(fs[_0x36cc('0x4b')](_0x238d80)){_0xa73bc0=!![];return _0x1cc4a8[_0x36cc('0x4c')](_0x238d80,_0x684b1a,config[_0x36cc('0x4d')]['recording'])[_0x36cc('0x1f')](function(){return _0x1f4c94;});}return _0x1f4c94;}})[_0x36cc('0x1f')](function(_0x419169){if(_0x419169){var _0x5be852=_0x419169['value'];if(!fs['existsSync'](_0x5be852)){throw new db['Sequelize'][(_0x36cc('0x4e'))](_0x36cc('0x4f'));}if(_0x419169[_0x36cc('0x50')]){return _0x3a8131[_0x36cc('0x47')](_0x5be852,_0x419169[_0x36cc('0x50')]+path['extname'](_0x5be852),function(){if(_0xa73bc0){fs[_0x36cc('0x51')](_0x5be852);}});}else{return _0x3a8131[_0x36cc('0x47')](_0x5be852,function(_0x250766){if(_0xa73bc0){fs[_0x36cc('0x51')](_0x5be852);}});}}})[_0x36cc('0x45')](function(_0x2015f0){if(_0x2015f0[_0x36cc('0x52')]===_0x36cc('0x4f')){_0x3a8131[_0x36cc('0x16')](0x194)['send'](_0x36cc('0x53'));}else{return handleError(_0x3a8131,null);}});};exports[_0x36cc('0x54')]=function(_0x595818,_0x3b4f19,_0x3b57e4){var _0x35bbfc=require(_0x36cc('0x55'));var _0x4cbc0d=![];var _0xc65104={'$and':[db[_0x36cc('0x56')]['where'](db[_0x36cc('0x56')]['fn'](_0x36cc('0x57'),db[_0x36cc('0x56')]['col'](_0x36cc('0x48'))),_0x595818['query'][_0x36cc('0x58')])]};if(_0x595818['query'][_0x36cc('0x29')]&&_0x595818[_0x36cc('0x2e')]['type']===_0x36cc('0x48')){_0xc65104['$and'][_0x36cc('0x59')]({'uniqueid':_0x595818[_0x36cc('0x41')]['id']});}else{_0xc65104['$and'][_0x36cc('0x59')]({'id':_0x595818[_0x36cc('0x41')]['id']});}return db['VoiceRecording'][_0x36cc('0x42')]({'where':_0xc65104,'attributes':['id','value'],'raw':!![]})[_0x36cc('0x1f')](handleEntityNotFound(_0x3b4f19,null))[_0x36cc('0x1f')](function(_0x9baf68){if(_0x9baf68){var _0x70058f=util[_0x36cc('0x2d')](_0x36cc('0x4a'),_0x9baf68[_0x36cc('0x49')]);if(fs[_0x36cc('0x4b')](_0x70058f)){_0x4cbc0d=!![];return _0x35bbfc[_0x36cc('0x4c')](_0x70058f,_0x9baf68[_0x36cc('0x49')],config['secrets'][_0x36cc('0x5a')])[_0x36cc('0x1f')](function(){return _0x9baf68;});}return _0x9baf68;}})['then'](function(_0x2b7454){if(_0x2b7454){if(!fs[_0x36cc('0x4b')](_0x2b7454[_0x36cc('0x49')])){throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))]('VoiceRecording\x20not\x20found');}if(_0x2b7454[_0x36cc('0x50')]){return _0x3b4f19[_0x36cc('0x47')](_0x2b7454['value'],_0x2b7454['filename']+path[_0x36cc('0x5c')](_0x2b7454[_0x36cc('0x49')]),function(){if(_0x4cbc0d){fs['unlink'](_0x2b7454[_0x36cc('0x49')]);}});}else{return _0x3b4f19[_0x36cc('0x47')](_0x2b7454[_0x36cc('0x49')],function(_0x481c89){if(_0x4cbc0d){fs[_0x36cc('0x51')](_0x2b7454[_0x36cc('0x49')]);}});}}})[_0x36cc('0x45')](handleError(_0x3b4f19,null));};exports['destroy']=function(_0x25dfda,_0x4c187a){return db[_0x36cc('0x3c')][_0x36cc('0x42')]({'where':{'id':_0x25dfda['params']['id']}})[_0x36cc('0x1f')](function(_0xc1e13e){if(!_0xc1e13e)throw new ReferenceError(_0x36cc('0x5d'));return _0xc1e13e;})[_0x36cc('0x1f')](function(_0x3205e5){var _0x4822d5=_0x3205e5[_0x36cc('0x49')];logger[_0x36cc('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x4822d5);if(!_[_0x36cc('0x5f')](_0x3205e5[_0x36cc('0x49')])&&fs[_0x36cc('0x4b')](_0x4822d5)){logger[_0x36cc('0x5e')](_0x36cc('0x60')+_0x4822d5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x36cc('0x61')](_0x4822d5);}_0x4822d5=_0x4822d5+_0x36cc('0x62');if(!_[_0x36cc('0x5f')](_0x3205e5[_0x36cc('0x49')])&&fs[_0x36cc('0x4b')](_0x4822d5)){logger[_0x36cc('0x5e')]('File:\x20\x22'+_0x4822d5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x36cc('0x61')](_0x4822d5);}return _0x3205e5;})['then'](function(_0xeff54e){if(!_0xeff54e)throw new InternalError();return _0xeff54e['destroy']();})[_0x36cc('0x1f')](function(){_0x4c187a[_0x36cc('0x16')](0xcc)[_0x36cc('0x17')]();})[_0x36cc('0x45')](handleError(_0x4c187a,null));};function getBucketslist(_0x25c1fc,_0x52894e,_0x2da13d){return new Promise(function(_0x3725f6,_0x1423b6){var _0x431c4e=new AWS['S3']({'accessKeyId':_0x52894e,'secretAccessKey':_0x25c1fc,'region':_0x2da13d});_0x431c4e['listBuckets']({},function(_0x5e2254,_0x3f9d29){if(_0x5e2254){return _0x1423b6(_0x5e2254);}else{return _0x3725f6(_0x3f9d29);}});});}function createBucket(_0x1779e1,_0x5774cc,_0x5b5395,_0x1c3f47){return new Promise(function(_0x5ac6e5,_0x590b59){var _0x5920d0=new AWS['S3']({'accessKeyId':_0x5774cc,'secretAccessKey':_0x1779e1,'region':_0x5b5395});_0x5920d0[_0x36cc('0x63')]({'Bucket':_0x1c3f47},function(_0x40bdf6,_0x68a053){if(_0x40bdf6){return _0x590b59(_0x40bdf6);}else{return _0x5ac6e5(_0x68a053);}});});}function uploadFile(_0x516980,_0x14c398,_0x44e6c8,_0x1e68e8,_0x512246,_0x8c56b5){return new Promise(function(_0x41c17e,_0x455963){var _0x830b21=new AWS['S3']({'accessKeyId':_0x14c398,'secretAccessKey':_0x516980,'region':_0x44e6c8});_0x830b21['upload']({'Bucket':_0x1e68e8,'Key':_0x512246,'Body':_0x8c56b5},function(_0x4553c1,_0x27bb1c){if(_0x4553c1){return _0x455963(_0x4553c1);}else{return _0x41c17e(_0x27bb1c);}});});}function startTranscribe(_0x920987,_0x2f0ffe,_0x25fbdc,_0x369498,_0x1cae4b,_0x3ffce5){return new Promise(function(_0xa41ed6,_0x465e27){var _0x4ca48c=new AWS['TranscribeService']({'accessKeyId':_0x2f0ffe,'secretAccessKey':_0x920987,'region':_0x25fbdc});_0x4ca48c[_0x36cc('0x64')]({'TranscriptionJobName':_0x369498,'LanguageCode':_0x1cae4b,'Media':{'MediaFileUri':_0x3ffce5}},function(_0x49143d,_0x12a061){if(_0x49143d){return _0x465e27(_0x49143d);}else{return _0xa41ed6(_0x12a061);}});});}function transcribe(_0x400e80,_0x5b9c78,_0x245a00,_0xa8cab6,_0x3cbf9e,_0x30cad2,_0x4017e5){return new Promise(function(_0x877c50,_0x4052ec){var _0x5b68cf={};logger[_0x36cc('0x5e')](util[_0x36cc('0x2d')](_0x36cc('0x65'),_0x400e80,_0x3cbf9e));return uploadFile(_0x5b9c78,_0x245a00,_0xa8cab6,_0x3cbf9e,path[_0x36cc('0x66')](_0x30cad2),fs['readFileSync'](_0x30cad2))[_0x36cc('0x1f')](function(_0x574d4d){logger[_0x36cc('0x5e')](util[_0x36cc('0x2d')](_0x36cc('0x67'),_0x400e80,_0x3cbf9e,_0x574d4d[_0x36cc('0x68')]));_0x5b68cf[_0x36cc('0x69')]=_0x574d4d['Bucket'];_0x5b68cf[_0x36cc('0x6a')]=_0x574d4d['Location'];logger[_0x36cc('0x5e')](util['format'](_0x36cc('0x6b'),_0x400e80));return startTranscribe(_0x5b9c78,_0x245a00,_0xa8cab6,uuidv4(),_0x4017e5,_0x574d4d[_0x36cc('0x68')]);})[_0x36cc('0x1f')](function(_0x51c50a){logger[_0x36cc('0x5e')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x400e80,_0x51c50a[_0x36cc('0x6c')][_0x36cc('0x6d')]));_0x5b68cf['transcribeName']=_0x51c50a[_0x36cc('0x6c')]['TranscriptionJobName'];_0x5b68cf[_0x36cc('0x6e')]=_0x51c50a['TranscriptionJob'][_0x36cc('0x6f')];return _0x877c50(_0x5b68cf);})[_0x36cc('0x45')](function(_0x178260){return _0x4052ec(_0x178260);});});}exports[_0x36cc('0x70')]=function(_0x54bec5,_0x1ee73b,_0x3cbe4e){var _0x20859;var _0x3f6533;var _0x52c546;var _0x5e4453=require(_0x36cc('0x55'));return db['VoiceRecording']['findOne']({'where':{'id':_0x54bec5[_0x36cc('0x41')]['id']}})[_0x36cc('0x1f')](function(_0x45d298){if(_0x45d298){var _0x4b3e00=util['format'](_0x36cc('0x4a'),_0x45d298[_0x36cc('0x49')]);if(fs['existsSync'](_0x4b3e00)){cypher=!![];return _0x5e4453[_0x36cc('0x4c')](_0x4b3e00,_0x45d298['value'],config[_0x36cc('0x4d')][_0x36cc('0x5a')])[_0x36cc('0x1f')](function(){return _0x45d298;});}return _0x45d298;}})['then'](function(_0x2c0f49){if(!_0x2c0f49){throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))](_0x36cc('0x71'));}_0x3f6533=_0x2c0f49;return db['Setting'][_0x36cc('0x72')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1ee73b,null))['then'](function(_0x5f346c){if(_0x5f346c){_0x20859=_0x5f346c;if(!_0x20859[_0x36cc('0x73')]||!_0x20859[_0x36cc('0x74')]||!_0x20859[_0x36cc('0x75')]||!_0x20859[_0x36cc('0x76')]||!_0x20859[_0x36cc('0x69')]){throw new db[(_0x36cc('0x5b'))]['ValidationError'](_0x36cc('0x77'));}if(_0x54bec5['body'][_0x36cc('0x78')]&&(!_0x20859[_0x36cc('0x79')]||!_0x20859[_0x36cc('0x7a')]||!_0x20859[_0x36cc('0x7b')]||!_0x20859[_0x36cc('0x76')]||!_0x20859[_0x36cc('0x69')])){throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))](_0x36cc('0x7c'));}return db['CloudProvider'][_0x36cc('0x72')]({'where':{'id':_0x20859['transcribeAccountId']}});}})[_0x36cc('0x1f')](function(_0x4197c9){if(!_0x4197c9){throw new db[(_0x36cc('0x5b'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4197c9['data1']||!_0x4197c9['data2']){throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))](_0x36cc('0x7d'));}_0x52c546=_0x4197c9;return getBucketslist(_0x52c546[_0x36cc('0x7e')],_0x52c546[_0x36cc('0x7f')],_0x20859[_0x36cc('0x75')]);})[_0x36cc('0x1f')](function(_0xd10f0c){if(_0xd10f0c&&_0xd10f0c[_0x36cc('0x80')]){var _0x155fb1=_[_0x36cc('0x42')](_0xd10f0c[_0x36cc('0x80')],function(_0x124a5d){return _0x124a5d[_0x36cc('0x81')]===_0x20859[_0x36cc('0x69')];});if(!_0x155fb1){logger[_0x36cc('0x5e')](util[_0x36cc('0x2d')](_0x36cc('0x82'),_0x54bec5[_0x36cc('0x41')]['id'],_0x20859[_0x36cc('0x69')]));return createBucket(_0x52c546['data1'],_0x52c546[_0x36cc('0x7f')],_0x20859[_0x36cc('0x75')],_0x20859[_0x36cc('0x69')]);}logger[_0x36cc('0x5e')](util[_0x36cc('0x2d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x54bec5[_0x36cc('0x41')]['id'],_0x20859[_0x36cc('0x69')]));return;}})[_0x36cc('0x1f')](function(_0x278c96){if(_0x3f6533['transcribeStatus']===_0x36cc('0x83')){return transcribe(_0x54bec5[_0x36cc('0x41')]['id'],_0x52c546['data1'],_0x52c546[_0x36cc('0x7f')],_0x20859[_0x36cc('0x75')],_0x20859['bucket'],_0x3f6533['value'],_0x20859['language']);}else{logger[_0x36cc('0x5e')](util['format'](_0x36cc('0x84'),_0x54bec5[_0x36cc('0x41')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x36cc('0x1f')](function(_0x19a898){if(_0x19a898){_0x19a898['tempSentiment']=_0x54bec5['body']['runSentiment'];return _0x3f6533[_0x36cc('0x85')](_0x19a898);}})[_0x36cc('0x1f')](respondWithResult(_0x1ee73b,null))[_0x36cc('0x45')](handleError(_0x1ee73b,null));};function writeFile(_0x547918,_0x4bf52c){return new Promise(function(_0x5852d4,_0x57c26b){fs[_0x36cc('0x86')](_0x4bf52c,_0x547918,function(_0x23194e,_0x54950e){if(_0x23194e){return _0x57c26b(_0x23194e);}else{return _0x5852d4(_0x54950e);}});});}exports['downloadTranscribe']=function(_0x783110,_0x1a5d7f,_0x451b16){return db[_0x36cc('0x3c')][_0x36cc('0x72')]({'where':{'id':_0x783110[_0x36cc('0x41')]['id']}})[_0x36cc('0x1f')](handleEntityNotFound(_0x1a5d7f))[_0x36cc('0x1f')](function(_0x1dafa8){if(_0x1dafa8&&_0x1dafa8[_0x36cc('0x87')]){var _0x2675b5=_0x1dafa8[_0x36cc('0x87')];var _0x5bd16b=config[_0x36cc('0x88')]+'/server/files/transcribes/transcribe_'+_0x1dafa8['id']+'.txt';if(fs[_0x36cc('0x4b')](_0x5bd16b)){return _0x5bd16b;}return writeFile(_0x2675b5,_0x5bd16b)[_0x36cc('0x1f')](function(){return _0x5bd16b;});}else{throw new db[(_0x36cc('0x5b'))][(_0x36cc('0x4e'))](_0x36cc('0x89'));}})[_0x36cc('0x1f')](function(_0x513e44){return _0x1a5d7f[_0x36cc('0x47')](_0x513e44);})[_0x36cc('0x45')](handleError(_0x1a5d7f));}; \ No newline at end of file +var _0x0fa7=['reject','save','update','then','destroy','sendStatus','error','send','index','map','VoiceRecording','rawAttributes','fieldName','model','differenceBy','name','format','query','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','keys','find','create','body','params','describe','download','uniqueid','value','%s.cypher','existsSync','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','push','$and','decryptFile','secrets','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','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','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','apply'];(function(_0x4a8f67,_0x4f59a6){var _0x371d22=function(_0x49ab24){while(--_0x49ab24){_0x4a8f67['push'](_0x4a8f67['shift']());}};_0x371d22(++_0x4f59a6);}(_0x0fa7,0x1b3));var _0x70fa=function(_0x3ea46d,_0x56e75f){_0x3ea46d=_0x3ea46d-0x0;var _0x49f9c8=_0x0fa7[_0x3ea46d];return _0x49f9c8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70fa('0x0'));var rimraf=require(_0x70fa('0x1'));var zipdir=require(_0x70fa('0x2'));var jsonpatch=require(_0x70fa('0x3'));var rp=require(_0x70fa('0x4'));var moment=require('moment');var BPromise=require(_0x70fa('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x70fa('0x6'));var sox=require(_0x70fa('0x7'));var csv=require('to-csv');var ejs=require(_0x70fa('0x8'));var fs=require('fs');var _=require(_0x70fa('0x9'));var squel=require(_0x70fa('0xa'));var crypto=require(_0x70fa('0xb'));var jsforce=require(_0x70fa('0xc'));var deskjs=require(_0x70fa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x70fa('0xe'));var Papa=require(_0x70fa('0xf'));var AWS=require(_0x70fa('0x10'));var uuidv4=require(_0x70fa('0x11'));var Redis=require(_0x70fa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x70fa('0x13'));var as=require(_0x70fa('0x14'));var hardwareService=require(_0x70fa('0x15'));var logger=require(_0x70fa('0x16'))('api');var utils=require(_0x70fa('0x17'));var config=require(_0x70fa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a19d7,_0x35eb69){_0x35eb69=_0x35eb69||0xcc;return function(_0x42c003){if(_0x42c003){return _0x4a19d7['sendStatus'](_0x35eb69);}return _0x4a19d7[_0x70fa('0x19')](_0x35eb69)[_0x70fa('0x1a')]();};}function respondWithResult(_0x52c631,_0x14324a){_0x14324a=_0x14324a||0xc8;return function(_0x15bbb7){if(_0x15bbb7){return _0x52c631[_0x70fa('0x19')](_0x14324a)[_0x70fa('0x1b')](_0x15bbb7);}};}function respondWithFilteredResult(_0x18e323,_0x4861d2){return function(_0x178aa8){if(_0x178aa8){var _0x50a183=_0x178aa8[_0x70fa('0x1c')],_0x4b9cfb=_0x4861d2['offset'],_0x55d02a=_0x4861d2[_0x70fa('0x1d')]+_0x4861d2[_0x70fa('0x1e')],_0x263912;if(_0x55d02a>=_0x50a183){_0x55d02a=_0x50a183;_0x263912=0xc8;}else{_0x263912=0xce;}_0x18e323[_0x70fa('0x19')](_0x263912);return _0x18e323[_0x70fa('0x1f')]('Content-Range',_0x4b9cfb+'-'+_0x55d02a+'/'+_0x50a183)[_0x70fa('0x1b')](_0x178aa8);}return null;};}function patchUpdates(_0x59a90e){return function(_0x37d8ee){try{jsonpatch[_0x70fa('0x20')](_0x37d8ee,_0x59a90e,!![]);}catch(_0x3e2ba5){return BPromise[_0x70fa('0x21')](_0x3e2ba5);}return _0x37d8ee[_0x70fa('0x22')]();};}function saveUpdates(_0x266242,_0x209796){return function(_0xe8b514){if(_0xe8b514){return _0xe8b514[_0x70fa('0x23')](_0x266242)[_0x70fa('0x24')](function(_0x4d3fd6){return _0x4d3fd6;});}return null;};}function removeEntity(_0xc7a899,_0x562162){return function(_0x5e7597){if(_0x5e7597){return _0x5e7597[_0x70fa('0x25')]()[_0x70fa('0x24')](function(){_0xc7a899[_0x70fa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5533d6,_0x59ae87){return function(_0xcf032a){if(!_0xcf032a){_0x5533d6[_0x70fa('0x26')](0x194);}return _0xcf032a;};}function handleError(_0x128992,_0x32170c){_0x32170c=_0x32170c||0x1f4;return function(_0x4ee88d){logger[_0x70fa('0x27')](_0x4ee88d['stack']);if(_0x4ee88d['name']){delete _0x4ee88d['name'];}_0x128992[_0x70fa('0x19')](_0x32170c)[_0x70fa('0x28')](_0x4ee88d);};}exports[_0x70fa('0x29')]=function(_0x19dfdd,_0x423ee6){var _0x3032f3={},_0x3a17f0={},_0x52cb96={'count':0x0,'rows':[]};var _0x3b651c=_[_0x70fa('0x2a')](db[_0x70fa('0x2b')][_0x70fa('0x2c')],function(_0x4a3c32){return{'name':_0x4a3c32[_0x70fa('0x2d')],'type':_0x4a3c32['type']['key']};});_0x3a17f0[_0x70fa('0x2e')]=_[_0x70fa('0x2f')](_[_0x70fa('0x2a')](_0x3b651c,_0x70fa('0x30')),[_0x70fa('0x31')]);_0x3a17f0[_0x70fa('0x32')]=_['keys'](_0x19dfdd[_0x70fa('0x32')]);_0x3a17f0[_0x70fa('0x33')]=_['intersection'](_0x3a17f0[_0x70fa('0x2e')],_0x3a17f0[_0x70fa('0x32')]);_0x3032f3[_0x70fa('0x34')]=_[_0x70fa('0x35')](_0x3a17f0['model'],qs[_0x70fa('0x36')](_0x19dfdd[_0x70fa('0x32')][_0x70fa('0x36')]));_0x3032f3[_0x70fa('0x34')]=_0x3032f3[_0x70fa('0x34')][_0x70fa('0x37')]?_0x3032f3['attributes']:_0x3a17f0[_0x70fa('0x2e')];if(!_0x19dfdd['query']['hasOwnProperty']('nolimit')){_0x3032f3['limit']=qs['limit'](_0x19dfdd[_0x70fa('0x32')]['limit']);_0x3032f3[_0x70fa('0x1d')]=qs[_0x70fa('0x1d')](_0x19dfdd[_0x70fa('0x32')][_0x70fa('0x1d')]);}_0x3032f3['order']=qs[_0x70fa('0x38')](_0x19dfdd[_0x70fa('0x32')]['sort']);_0x3032f3[_0x70fa('0x39')]=qs[_0x70fa('0x33')](_[_0x70fa('0x3a')](_0x19dfdd[_0x70fa('0x32')],_0x3a17f0[_0x70fa('0x33')]),_0x3b651c);if(_0x19dfdd[_0x70fa('0x32')][_0x70fa('0x3b')]){_0x3032f3[_0x70fa('0x39')]=_[_0x70fa('0x3c')](_0x3032f3[_0x70fa('0x39')],{'$or':_['map'](_0x3b651c,function(_0x13da14){if(_0x13da14[_0x70fa('0x3d')]!==_0x70fa('0x3e')){var _0x231861={};_0x231861[_0x13da14[_0x70fa('0x30')]]={'$like':'%'+_0x19dfdd[_0x70fa('0x32')]['filter']+'%'};return _0x231861;}})});}_0x3032f3=_[_0x70fa('0x3c')]({},_0x3032f3,_0x19dfdd[_0x70fa('0x3f')]);var _0x119c29={'where':_0x3032f3[_0x70fa('0x39')]};return db[_0x70fa('0x2b')][_0x70fa('0x1c')](_0x119c29)['then'](function(_0x158b3d){_0x52cb96[_0x70fa('0x1c')]=_0x158b3d;if(_0x19dfdd[_0x70fa('0x32')][_0x70fa('0x40')]){_0x3032f3[_0x70fa('0x41')]=[{'all':!![]}];}return db[_0x70fa('0x2b')][_0x70fa('0x42')](_0x3032f3);})[_0x70fa('0x24')](function(_0x1ddcf1){_0x52cb96['rows']=_0x1ddcf1;return _0x52cb96;})['then'](respondWithFilteredResult(_0x423ee6,_0x3032f3))[_0x70fa('0x43')](handleError(_0x423ee6,null));};exports['show']=function(_0x6fbba7,_0x95fb1d){var _0xa91a93={'raw':![],'where':{'id':_0x6fbba7['params']['id']}},_0x4a74e8={};_0x4a74e8[_0x70fa('0x2e')]=_[_0x70fa('0x44')](db[_0x70fa('0x2b')][_0x70fa('0x2c')]);_0x4a74e8[_0x70fa('0x32')]=_[_0x70fa('0x44')](_0x6fbba7[_0x70fa('0x32')]);_0x4a74e8[_0x70fa('0x33')]=_[_0x70fa('0x35')](_0x4a74e8['model'],_0x4a74e8[_0x70fa('0x32')]);_0xa91a93['attributes']=_[_0x70fa('0x35')](_0x4a74e8[_0x70fa('0x2e')],qs['fields'](_0x6fbba7[_0x70fa('0x32')][_0x70fa('0x36')]));_0xa91a93[_0x70fa('0x34')]=_0xa91a93[_0x70fa('0x34')][_0x70fa('0x37')]?_0xa91a93[_0x70fa('0x34')]:_0x4a74e8['model'];if(_0x6fbba7[_0x70fa('0x32')][_0x70fa('0x40')]){_0xa91a93[_0x70fa('0x41')]=[{'all':!![]}];}_0xa91a93=_[_0x70fa('0x3c')]({},_0xa91a93,_0x6fbba7[_0x70fa('0x3f')]);return db['VoiceRecording'][_0x70fa('0x45')](_0xa91a93)['then'](handleEntityNotFound(_0x95fb1d,null))[_0x70fa('0x24')](respondWithResult(_0x95fb1d,null))[_0x70fa('0x43')](handleError(_0x95fb1d,null));};exports[_0x70fa('0x46')]=function(_0x24e5f3,_0xf6f4e5){return db[_0x70fa('0x2b')][_0x70fa('0x46')](_0x24e5f3[_0x70fa('0x47')],{})[_0x70fa('0x24')](respondWithResult(_0xf6f4e5,0xc9))[_0x70fa('0x43')](handleError(_0xf6f4e5,null));};exports[_0x70fa('0x23')]=function(_0x5f16e0,_0x50fa0a){if(_0x5f16e0[_0x70fa('0x47')]['id']){delete _0x5f16e0[_0x70fa('0x47')]['id'];}return db['VoiceRecording'][_0x70fa('0x45')]({'where':{'id':_0x5f16e0[_0x70fa('0x48')]['id']}})[_0x70fa('0x24')](handleEntityNotFound(_0x50fa0a,null))['then'](saveUpdates(_0x5f16e0[_0x70fa('0x47')],null))[_0x70fa('0x24')](respondWithResult(_0x50fa0a,null))[_0x70fa('0x43')](handleError(_0x50fa0a,null));};exports[_0x70fa('0x49')]=function(_0x507a5a,_0x5c6309){return db[_0x70fa('0x2b')][_0x70fa('0x49')]()[_0x70fa('0x24')](respondWithResult(_0x5c6309,null))[_0x70fa('0x43')](handleError(_0x5c6309,null));};exports[_0x70fa('0x4a')]=function(_0x1774d3,_0x5c43af,_0x574d0c){var _0x522063=require('../../components/encryptor');var _0x5a6a89=![];var _0x3565ad={};if(_0x1774d3[_0x70fa('0x32')][_0x70fa('0x3d')]&&_0x1774d3[_0x70fa('0x32')]['type']===_0x70fa('0x4b')){_0x3565ad[_0x70fa('0x4b')]=_0x1774d3[_0x70fa('0x48')]['id'];}else{_0x3565ad['id']=_0x1774d3[_0x70fa('0x48')]['id'];}return db[_0x70fa('0x2b')][_0x70fa('0x45')]({'where':_0x3565ad,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5c43af,null))[_0x70fa('0x24')](function(_0x2e68f1){if(_0x2e68f1){var _0x558e54=_0x2e68f1[_0x70fa('0x4c')];var _0x141e9d=util['format'](_0x70fa('0x4d'),_0x558e54);if(fs[_0x70fa('0x4e')](_0x141e9d)){_0x5a6a89=!![];return _0x522063['decryptFile'](_0x141e9d,_0x558e54,config['secrets'][_0x70fa('0x4f')])[_0x70fa('0x24')](function(){return _0x2e68f1;});}return _0x2e68f1;}})['then'](function(_0x53dcad){if(_0x53dcad){var _0x9cbf06=_0x53dcad[_0x70fa('0x4c')];if(!fs[_0x70fa('0x4e')](_0x9cbf06)){throw new db['Sequelize'][(_0x70fa('0x50'))](_0x70fa('0x51'));}if(_0x53dcad[_0x70fa('0x52')]){return _0x5c43af[_0x70fa('0x4a')](_0x9cbf06,_0x53dcad[_0x70fa('0x52')]+path[_0x70fa('0x53')](_0x9cbf06),function(){if(_0x5a6a89){fs[_0x70fa('0x54')](_0x9cbf06);}});}else{return _0x5c43af[_0x70fa('0x4a')](_0x9cbf06,function(_0x575bcf){if(_0x5a6a89){fs[_0x70fa('0x54')](_0x9cbf06);}});}}})[_0x70fa('0x43')](function(_0x20993c){if(_0x20993c[_0x70fa('0x55')]==='VoiceRecording\x20not\x20found'){_0x5c43af[_0x70fa('0x19')](0x194)[_0x70fa('0x28')]('Not\x20found');}else{return handleError(_0x5c43af,null);}});};exports[_0x70fa('0x56')]=function(_0x43efc7,_0x69d6fd,_0x2e9e7e){var _0x3e5311=require('../../components/encryptor');var _0x24e975=![];var _0x3a23b9={'$and':[db['sequelize'][_0x70fa('0x39')](db[_0x70fa('0x57')]['fn'](_0x70fa('0x58'),db['sequelize'][_0x70fa('0x59')]('uniqueid')),_0x43efc7['query'][_0x70fa('0x5a')])]};if(_0x43efc7[_0x70fa('0x32')]['type']&&_0x43efc7[_0x70fa('0x32')]['type']===_0x70fa('0x4b')){_0x3a23b9['$and'][_0x70fa('0x5b')]({'uniqueid':_0x43efc7[_0x70fa('0x48')]['id']});}else{_0x3a23b9[_0x70fa('0x5c')][_0x70fa('0x5b')]({'id':_0x43efc7[_0x70fa('0x48')]['id']});}return db['VoiceRecording'][_0x70fa('0x45')]({'where':_0x3a23b9,'attributes':['id',_0x70fa('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x69d6fd,null))[_0x70fa('0x24')](function(_0x5bab66){if(_0x5bab66){var _0x2f8c23=util[_0x70fa('0x31')](_0x70fa('0x4d'),_0x5bab66[_0x70fa('0x4c')]);if(fs[_0x70fa('0x4e')](_0x2f8c23)){_0x24e975=!![];return _0x3e5311[_0x70fa('0x5d')](_0x2f8c23,_0x5bab66['value'],config[_0x70fa('0x5e')][_0x70fa('0x4f')])['then'](function(){return _0x5bab66;});}return _0x5bab66;}})[_0x70fa('0x24')](function(_0x384b07){if(_0x384b07){if(!fs['existsSync'](_0x384b07[_0x70fa('0x4c')])){throw new db[(_0x70fa('0x5f'))][(_0x70fa('0x50'))](_0x70fa('0x51'));}if(_0x384b07[_0x70fa('0x52')]){return _0x69d6fd[_0x70fa('0x4a')](_0x384b07[_0x70fa('0x4c')],_0x384b07[_0x70fa('0x52')]+path[_0x70fa('0x53')](_0x384b07[_0x70fa('0x4c')]),function(){if(_0x24e975){fs[_0x70fa('0x54')](_0x384b07[_0x70fa('0x4c')]);}});}else{return _0x69d6fd[_0x70fa('0x4a')](_0x384b07[_0x70fa('0x4c')],function(_0x59f0c5){if(_0x24e975){fs[_0x70fa('0x54')](_0x384b07[_0x70fa('0x4c')]);}});}}})['catch'](handleError(_0x69d6fd,null));};exports[_0x70fa('0x25')]=function(_0x2dd560,_0xbc8661){return db[_0x70fa('0x2b')]['find']({'where':{'id':_0x2dd560[_0x70fa('0x48')]['id']}})[_0x70fa('0x24')](function(_0x48ff06){if(!_0x48ff06)throw new ReferenceError(_0x70fa('0x60'));return _0x48ff06;})[_0x70fa('0x24')](function(_0xc88478){var _0x3c9b36=_0xc88478[_0x70fa('0x4c')];logger[_0x70fa('0x61')](_0x70fa('0x62'),_0x3c9b36);if(!_[_0x70fa('0x63')](_0xc88478[_0x70fa('0x4c')])&&fs['existsSync'](_0x3c9b36)){logger['info'](_0x70fa('0x64')+_0x3c9b36+_0x70fa('0x65'));fs['unlinkSync'](_0x3c9b36);}_0x3c9b36=_0x3c9b36+_0x70fa('0x66');if(!_[_0x70fa('0x63')](_0xc88478[_0x70fa('0x4c')])&&fs[_0x70fa('0x4e')](_0x3c9b36)){logger[_0x70fa('0x61')](_0x70fa('0x64')+_0x3c9b36+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x70fa('0x67')](_0x3c9b36);}return _0xc88478;})[_0x70fa('0x24')](function(_0x3d9055){if(!_0x3d9055)throw new InternalError();return _0x3d9055[_0x70fa('0x25')]();})[_0x70fa('0x24')](function(){_0xbc8661[_0x70fa('0x19')](0xcc)['end']();})['catch'](handleError(_0xbc8661,null));};function getBucketslist(_0x40d8aa,_0x27320d,_0x5f084a){return new Promise(function(_0x3cb611,_0x2b3e51){var _0x329ff7=new AWS['S3']({'accessKeyId':_0x27320d,'secretAccessKey':_0x40d8aa,'region':_0x5f084a});_0x329ff7[_0x70fa('0x68')]({},function(_0x405049,_0x7ca97f){if(_0x405049){return _0x2b3e51(_0x405049);}else{return _0x3cb611(_0x7ca97f);}});});}function createBucket(_0x561d46,_0x4819fe,_0x4d4d89,_0x2840de){return new Promise(function(_0x8d6640,_0x4d4b9e){var _0x426a24=new AWS['S3']({'accessKeyId':_0x4819fe,'secretAccessKey':_0x561d46,'region':_0x4d4d89});_0x426a24[_0x70fa('0x69')]({'Bucket':_0x2840de},function(_0x4fa1ce,_0x5dc87c){if(_0x4fa1ce){return _0x4d4b9e(_0x4fa1ce);}else{return _0x8d6640(_0x5dc87c);}});});}function uploadFile(_0x1f5c46,_0x100ceb,_0x3af50f,_0x2fe693,_0x308a38,_0x4b714b){return new Promise(function(_0x70d7a9,_0xd40948){var _0xe7e6e2=new AWS['S3']({'accessKeyId':_0x100ceb,'secretAccessKey':_0x1f5c46,'region':_0x3af50f});_0xe7e6e2[_0x70fa('0x6a')]({'Bucket':_0x2fe693,'Key':_0x308a38,'Body':_0x4b714b},function(_0x54bb47,_0x368d0d){if(_0x54bb47){return _0xd40948(_0x54bb47);}else{return _0x70d7a9(_0x368d0d);}});});}function startTranscribe(_0x2427fd,_0x40a627,_0x21db21,_0x599a30,_0x52b0fd,_0x4e0743){return new Promise(function(_0xea9ae0,_0x53a56e){var _0x68e748=new AWS[(_0x70fa('0x6b'))]({'accessKeyId':_0x40a627,'secretAccessKey':_0x2427fd,'region':_0x21db21});_0x68e748[_0x70fa('0x6c')]({'TranscriptionJobName':_0x599a30,'LanguageCode':_0x52b0fd,'Media':{'MediaFileUri':_0x4e0743}},function(_0x1c32be,_0x376c0c){if(_0x1c32be){return _0x53a56e(_0x1c32be);}else{return _0xea9ae0(_0x376c0c);}});});}function transcribe(_0x5ec140,_0x1e9824,_0x738ad4,_0x4a7d69,_0x354d8e,_0x173e15,_0x7668ad){return new Promise(function(_0x251967,_0x6271d7){var _0x3b4864={};logger[_0x70fa('0x61')](util[_0x70fa('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x5ec140,_0x354d8e));return uploadFile(_0x1e9824,_0x738ad4,_0x4a7d69,_0x354d8e,path[_0x70fa('0x6d')](_0x173e15),fs['readFileSync'](_0x173e15))[_0x70fa('0x24')](function(_0x4775db){logger[_0x70fa('0x61')](util[_0x70fa('0x31')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x5ec140,_0x354d8e,_0x4775db[_0x70fa('0x6e')]));_0x3b4864[_0x70fa('0x6f')]=_0x4775db[_0x70fa('0x70')];_0x3b4864['location']=_0x4775db['Location'];logger['info'](util['format'](_0x70fa('0x71'),_0x5ec140));return startTranscribe(_0x1e9824,_0x738ad4,_0x4a7d69,uuidv4(),_0x7668ad,_0x4775db[_0x70fa('0x6e')]);})[_0x70fa('0x24')](function(_0x430be1){logger[_0x70fa('0x61')](util[_0x70fa('0x31')](_0x70fa('0x72'),_0x5ec140,_0x430be1[_0x70fa('0x73')]['TranscriptionJobName']));_0x3b4864[_0x70fa('0x74')]=_0x430be1['TranscriptionJob'][_0x70fa('0x75')];_0x3b4864[_0x70fa('0x76')]=_0x430be1[_0x70fa('0x73')][_0x70fa('0x77')];return _0x251967(_0x3b4864);})[_0x70fa('0x43')](function(_0x1771b5){return _0x6271d7(_0x1771b5);});});}exports[_0x70fa('0x78')]=function(_0x741386,_0x566bd2,_0x3c9211){var _0x2067ac;var _0x39a1ea;var _0x249813;var _0x4bb685=require(_0x70fa('0x79'));return db['VoiceRecording'][_0x70fa('0x7a')]({'where':{'id':_0x741386[_0x70fa('0x48')]['id']}})['then'](function(_0x201dae){if(_0x201dae){var _0x1d15c7=util[_0x70fa('0x31')](_0x70fa('0x4d'),_0x201dae[_0x70fa('0x4c')]);if(fs[_0x70fa('0x4e')](_0x1d15c7)){cypher=!![];return _0x4bb685[_0x70fa('0x5d')](_0x1d15c7,_0x201dae[_0x70fa('0x4c')],config[_0x70fa('0x5e')][_0x70fa('0x4f')])['then'](function(){return _0x201dae;});}return _0x201dae;}})[_0x70fa('0x24')](function(_0x5db4e2){if(!_0x5db4e2){throw new db['Sequelize'][(_0x70fa('0x50'))](_0x70fa('0x7b'));}_0x39a1ea=_0x5db4e2;return db[_0x70fa('0x7c')][_0x70fa('0x7a')]({'where':{'id':0x1}});})[_0x70fa('0x24')](handleEntityNotFound(_0x566bd2,null))[_0x70fa('0x24')](function(_0x5c54dd){if(_0x5c54dd){_0x2067ac=_0x5c54dd;if(!_0x2067ac[_0x70fa('0x7d')]||!_0x2067ac['transcribeAccountId']||!_0x2067ac[_0x70fa('0x7e')]||!_0x2067ac[_0x70fa('0x7f')]||!_0x2067ac['bucket']){throw new db[(_0x70fa('0x5f'))][(_0x70fa('0x50'))](_0x70fa('0x80'));}if(_0x741386[_0x70fa('0x47')]['runSentiment']&&(!_0x2067ac[_0x70fa('0x81')]||!_0x2067ac[_0x70fa('0x82')]||!_0x2067ac[_0x70fa('0x83')]||!_0x2067ac[_0x70fa('0x7f')]||!_0x2067ac['bucket'])){throw new db['Sequelize'][(_0x70fa('0x50'))](_0x70fa('0x84'));}return db[_0x70fa('0x85')]['findOne']({'where':{'id':_0x2067ac[_0x70fa('0x86')]}});}})[_0x70fa('0x24')](function(_0x377285){if(!_0x377285){throw new db['Sequelize'][(_0x70fa('0x50'))](_0x70fa('0x87'));}if(!_0x377285[_0x70fa('0x88')]||!_0x377285['data2']){throw new db['Sequelize'][(_0x70fa('0x50'))](_0x70fa('0x89'));}_0x249813=_0x377285;return getBucketslist(_0x249813['data1'],_0x249813[_0x70fa('0x8a')],_0x2067ac[_0x70fa('0x7e')]);})[_0x70fa('0x24')](function(_0x2938e9){if(_0x2938e9&&_0x2938e9[_0x70fa('0x8b')]){var _0x210039=_[_0x70fa('0x45')](_0x2938e9[_0x70fa('0x8b')],function(_0x28cb4e){return _0x28cb4e[_0x70fa('0x8c')]===_0x2067ac[_0x70fa('0x6f')];});if(!_0x210039){logger[_0x70fa('0x61')](util[_0x70fa('0x31')](_0x70fa('0x8d'),_0x741386['params']['id'],_0x2067ac['bucket']));return createBucket(_0x249813['data1'],_0x249813[_0x70fa('0x8a')],_0x2067ac[_0x70fa('0x7e')],_0x2067ac[_0x70fa('0x6f')]);}logger[_0x70fa('0x61')](util['format'](_0x70fa('0x8e'),_0x741386[_0x70fa('0x48')]['id'],_0x2067ac['bucket']));return;}})[_0x70fa('0x24')](function(_0x5582b7){if(_0x39a1ea['transcribeStatus']===_0x70fa('0x8f')){return transcribe(_0x741386[_0x70fa('0x48')]['id'],_0x249813['data1'],_0x249813[_0x70fa('0x8a')],_0x2067ac[_0x70fa('0x7e')],_0x2067ac['bucket'],_0x39a1ea[_0x70fa('0x4c')],_0x2067ac[_0x70fa('0x7f')]);}else{logger[_0x70fa('0x61')](util['format'](_0x70fa('0x90'),_0x741386[_0x70fa('0x48')]['id']));return{'transcribeStatus':_0x70fa('0x91')};}})[_0x70fa('0x24')](function(_0x86a418){if(_0x86a418){_0x86a418[_0x70fa('0x92')]=_0x741386[_0x70fa('0x47')][_0x70fa('0x93')];return _0x39a1ea[_0x70fa('0x94')](_0x86a418);}})[_0x70fa('0x24')](respondWithResult(_0x566bd2,null))[_0x70fa('0x43')](handleError(_0x566bd2,null));};function writeFile(_0x12fbb7,_0x2ae964){return new Promise(function(_0x5bf615,_0x3b0d6c){fs[_0x70fa('0x95')](_0x2ae964,_0x12fbb7,function(_0x21133e,_0x5dca44){if(_0x21133e){return _0x3b0d6c(_0x21133e);}else{return _0x5bf615(_0x5dca44);}});});}exports[_0x70fa('0x96')]=function(_0x4871b5,_0xc6f141,_0x17be3e){return db['VoiceRecording']['findOne']({'where':{'id':_0x4871b5[_0x70fa('0x48')]['id']}})['then'](handleEntityNotFound(_0xc6f141))['then'](function(_0xea4065){if(_0xea4065&&_0xea4065[_0x70fa('0x97')]){var _0x1f2166=_0xea4065[_0x70fa('0x97')];var _0x531524=config[_0x70fa('0x98')]+_0x70fa('0x99')+_0xea4065['id']+_0x70fa('0x9a');if(fs[_0x70fa('0x4e')](_0x531524)){return _0x531524;}return writeFile(_0x1f2166,_0x531524)[_0x70fa('0x24')](function(){return _0x531524;});}else{throw new db['Sequelize']['ValidationError'](_0x70fa('0x9b'));}})['then'](function(_0x57ed21){return _0xc6f141[_0x70fa('0x4a')](_0x57ed21);})[_0x70fa('0x43')](handleError(_0xc6f141));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0946811..2c1bc10 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 _0x677a=['define','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x356e4f,_0x167f66){var _0x42d2fe=function(_0x30eb7c){while(--_0x30eb7c){_0x356e4f['push'](_0x356e4f['shift']());}};_0x42d2fe(++_0x167f66);}(_0x677a,0xd6));var _0xa677=function(_0x67f485,_0x3ee0c2){_0x67f485=_0x67f485-0x0;var _0x3cd539=_0x677a[_0x67f485];return _0x3cd539;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var logger=require(_0xa677('0x1'))(_0xa677('0x2'));var moment=require(_0xa677('0x3'));var BPromise=require(_0xa677('0x4'));var rp=require(_0xa677('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa677('0x6'));var config=require(_0xa677('0x7'));var attributes=require(_0xa677('0x8'));module[_0xa677('0x9')]=function(_0x24576c,_0x5127c1){return _0x24576c[_0xa677('0xa')](_0xa677('0xb'),attributes,{'tableName':_0xa677('0xc'),'paranoid':![],'indexes':[{'name':_0xa677('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf98=['VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xdf98,0xcf));var _0x8df9=function(_0x417b1a,_0x3cfce5){_0x417b1a=_0x417b1a-0x0;var _0x1e41af=_0xdf98[_0x417b1a];return _0x1e41af;};'use strict';var _=require(_0x8df9('0x0'));var util=require('util');var logger=require(_0x8df9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8df9('0x2'));var rp=require(_0x8df9('0x3'));var fs=require('fs');var path=require(_0x8df9('0x4'));var rimraf=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var attributes=require(_0x8df9('0x7'));module[_0x8df9('0x8')]=function(_0x158424,_0x20b677){return _0x158424['define'](_0x8df9('0x9'),attributes,{'tableName':_0x8df9('0xa'),'paranoid':![],'indexes':[{'name':_0x8df9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 75395c1..486416c 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(_0x50d326,_0x1fc7e2){var _0x10f473=function(_0x2588fd){while(--_0x2588fd){_0x50d326['push'](_0x50d326['shift']());}};_0x10f473(++_0x1fc7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x498789,_0x465536){var _0x3f8b64=function(_0x47b635){while(--_0x47b635){_0x498789['push'](_0x498789['shift']());}};_0x3f8b64(++_0x465536);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 6b16cc7..33d9da2 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 _0x5d17=['../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','exports','multer','util','express','Router'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x5d17,0x114));var _0x75d1=function(_0x2383c3,_0x4fd9de){_0x2383c3=_0x2383c3-0x0;var _0x2cadbc=_0x5d17[_0x2383c3];return _0x2cadbc;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x8')](),controller[_0x75d1('0xc')]);router['put']('/:id',auth[_0x75d1('0x8')](),controller['update']);router['delete'](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller['destroy']);module[_0x75d1('0xd')]=router; \ No newline at end of file +var _0xd8fb=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','multer'];(function(_0x422127,_0x3674d5){var _0x12b194=function(_0x5d6c19){while(--_0x5d6c19){_0x422127['push'](_0x422127['shift']());}};_0x12b194(++_0x3674d5);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1232ab,_0x1c8c07){_0x1232ab=_0x1232ab-0x0;var _0x6c9cae=_0xd8fb[_0x1232ab];return _0x6c9cae;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd8f('0x4'));var config=require(_0xbd8f('0x5'));var controller=require('./voiceTransferReport.controller');router[_0xbd8f('0x6')]('/',auth[_0xbd8f('0x7')](),controller['index']);router[_0xbd8f('0x6')]('/:id',auth[_0xbd8f('0x7')](),controller['show']);router[_0xbd8f('0x8')]('/',auth[_0xbd8f('0x7')](),controller['create']);router['put'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller[_0xbd8f('0xa')]);router['delete'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 9f85de5..6523316 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 _0x6e34=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0xd6dfe7,_0x54b698){var _0x2deade=function(_0x1a1e61){while(--_0x1a1e61){_0xd6dfe7['push'](_0xd6dfe7['shift']());}};_0x2deade(++_0x54b698);}(_0x6e34,0x191));var _0x46e3=function(_0x26b8a2,_0xd0d5d4){_0x26b8a2=_0x26b8a2-0x0;var _0x52fee6=_0x6e34[_0x26b8a2];return _0x52fee6;};'use strict';var Sequelize=require(_0x46e3('0x0'));var moment=require(_0x46e3('0x1'));module[_0x46e3('0x2')]={'type':{'type':Sequelize[_0x46e3('0x3')](_0x46e3('0x4'),_0x46e3('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x46e3('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x46e3('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x46e3('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x46e3('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x46e3('0x6')]},'transferercontext':{'type':Sequelize[_0x46e3('0x6')]},'transfererexten':{'type':Sequelize[_0x46e3('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x46e3('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x46e3('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x46e3('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x46e3('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x46e3('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x46e3('0x6')]},'transfereecontext':{'type':Sequelize[_0x46e3('0x6')]},'transfereeexten':{'type':Sequelize[_0x46e3('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x46e3('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x46e3('0x7'),'No')},'context':{'type':Sequelize[_0x46e3('0x6')]},'extension':{'type':Sequelize[_0x46e3('0x6')]}}; \ No newline at end of file +var _0xeb9b=['Yes','moment','exports','blind','attended','STRING','ENUM'];(function(_0x1e8673,_0x2dc01a){var _0x10472c=function(_0x106f85){while(--_0x106f85){_0x1e8673['push'](_0x1e8673['shift']());}};_0x10472c(++_0x2dc01a);}(_0xeb9b,0x1cf));var _0xbeb9=function(_0xc69fda,_0x367f93){_0xc69fda=_0xc69fda-0x0;var _0x721842=_0xeb9b[_0xc69fda];return _0x721842;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbeb9('0x0'));module[_0xbeb9('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbeb9('0x2'),_0xbeb9('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xbeb9('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xbeb9('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xbeb9('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xbeb9('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xbeb9('0x4')]},'transfereechannel':{'type':Sequelize[_0xbeb9('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xbeb9('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xbeb9('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbeb9('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbeb9('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xbeb9('0x4')]},'transfereecontext':{'type':Sequelize[_0xbeb9('0x4')]},'transfereeexten':{'type':Sequelize[_0xbeb9('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xbeb9('0x4')]},'isexternal':{'type':Sequelize[_0xbeb9('0x5')](_0xbeb9('0x6'),'No')},'context':{'type':Sequelize[_0xbeb9('0x4')]},'extension':{'type':Sequelize[_0xbeb9('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 12561b2..e1f227d 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 _0xf694=['bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','options','where','then','include','findAll','show','length','includeAll','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','moment'];(function(_0x3cadbd,_0x12bc43){var _0x296da9=function(_0x3b15fc){while(--_0x3b15fc){_0x3cadbd['push'](_0x3cadbd['shift']());}};_0x296da9(++_0x12bc43);}(_0xf694,0x1a6));var _0x4f69=function(_0x404739,_0x1c4f4c){_0x404739=_0x404739-0x0;var _0x358c98=_0xf694[_0x404739];return _0x358c98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f69('0x0'));var rimraf=require(_0x4f69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f69('0x2'));var rp=require('request-promise');var moment=require(_0x4f69('0x3'));var BPromise=require(_0x4f69('0x4'));var Mustache=require('mustache');var util=require(_0x4f69('0x5'));var path=require(_0x4f69('0x6'));var sox=require(_0x4f69('0x7'));var csv=require(_0x4f69('0x8'));var ejs=require(_0x4f69('0x9'));var fs=require('fs');var _=require(_0x4f69('0xa'));var squel=require('squel');var crypto=require(_0x4f69('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4f69('0xc'));var toCsv=require(_0x4f69('0x8'));var querystring=require('querystring');var Papa=require(_0x4f69('0xd'));var Redis=require(_0x4f69('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f69('0xf'));var hardwareService=require(_0x4f69('0x10'));var logger=require(_0x4f69('0x11'))(_0x4f69('0x12'));var utils=require(_0x4f69('0x13'));var config=require(_0x4f69('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4411,_0x124e63){_0x124e63=_0x124e63||0xcc;return function(_0x39b5c5){if(_0x39b5c5){return _0x4a4411[_0x4f69('0x15')](_0x124e63);}return _0x4a4411[_0x4f69('0x16')](_0x124e63)[_0x4f69('0x17')]();};}function respondWithResult(_0x5b8e6e,_0x26dea7){_0x26dea7=_0x26dea7||0xc8;return function(_0x424a31){if(_0x424a31){return _0x5b8e6e[_0x4f69('0x16')](_0x26dea7)[_0x4f69('0x18')](_0x424a31);}};}function respondWithFilteredResult(_0x52fdd3,_0x1e8adc){return function(_0x2362c2){if(_0x2362c2){var _0x589b12=_0x2362c2[_0x4f69('0x19')],_0x3258e7=_0x1e8adc['offset'],_0xa46244=_0x1e8adc['offset']+_0x1e8adc[_0x4f69('0x1a')],_0x1b9167;if(_0xa46244>=_0x589b12){_0xa46244=_0x589b12;_0x1b9167=0xc8;}else{_0x1b9167=0xce;}_0x52fdd3[_0x4f69('0x16')](_0x1b9167);return _0x52fdd3[_0x4f69('0x1b')](_0x4f69('0x1c'),_0x3258e7+'-'+_0xa46244+'/'+_0x589b12)[_0x4f69('0x18')](_0x2362c2);}return null;};}function patchUpdates(_0x2acddb){return function(_0x3c2d0f){try{jsonpatch[_0x4f69('0x1d')](_0x3c2d0f,_0x2acddb,!![]);}catch(_0x525096){return BPromise[_0x4f69('0x1e')](_0x525096);}return _0x3c2d0f['save']();};}function saveUpdates(_0x160d51,_0xb2a0d9){return function(_0x4edb52){if(_0x4edb52){return _0x4edb52[_0x4f69('0x1f')](_0x160d51)['then'](function(_0x33fd52){return _0x33fd52;});}return null;};}function removeEntity(_0x22c426,_0x20aa7f){return function(_0x3e070d){if(_0x3e070d){return _0x3e070d[_0x4f69('0x20')]()['then'](function(){_0x22c426['status'](0xcc)[_0x4f69('0x17')]();});}};}function handleEntityNotFound(_0x17e543,_0x2c3b4f){return function(_0x3b0ead){if(!_0x3b0ead){_0x17e543[_0x4f69('0x15')](0x194);}return _0x3b0ead;};}function handleError(_0xab4e90,_0x3d80f3){_0x3d80f3=_0x3d80f3||0x1f4;return function(_0x6e4e8d){logger['error'](_0x6e4e8d[_0x4f69('0x21')]);if(_0x6e4e8d[_0x4f69('0x22')]){delete _0x6e4e8d['name'];}_0xab4e90[_0x4f69('0x16')](_0x3d80f3)[_0x4f69('0x23')](_0x6e4e8d);};}exports[_0x4f69('0x24')]=function(_0x377098,_0x2f195e){var _0x20e95b={},_0x56672a={},_0x3b6cde={'count':0x0,'rows':[]};var _0x374705=_[_0x4f69('0x25')](db[_0x4f69('0x26')][_0x4f69('0x27')],function(_0x36acde){return{'name':_0x36acde[_0x4f69('0x28')],'type':_0x36acde[_0x4f69('0x29')][_0x4f69('0x2a')]};});_0x56672a[_0x4f69('0x2b')]=_[_0x4f69('0x25')](_0x374705,_0x4f69('0x22'));_0x56672a[_0x4f69('0x2c')]=_[_0x4f69('0x2d')](_0x377098[_0x4f69('0x2c')]);_0x56672a[_0x4f69('0x2e')]=_[_0x4f69('0x2f')](_0x56672a[_0x4f69('0x2b')],_0x56672a[_0x4f69('0x2c')]);_0x20e95b[_0x4f69('0x30')]=_[_0x4f69('0x2f')](_0x56672a[_0x4f69('0x2b')],qs[_0x4f69('0x31')](_0x377098[_0x4f69('0x2c')][_0x4f69('0x31')]));_0x20e95b[_0x4f69('0x30')]=_0x20e95b[_0x4f69('0x30')]['length']?_0x20e95b[_0x4f69('0x30')]:_0x56672a['model'];if(!_0x377098[_0x4f69('0x2c')][_0x4f69('0x32')](_0x4f69('0x33'))){_0x20e95b['limit']=qs[_0x4f69('0x1a')](_0x377098[_0x4f69('0x2c')]['limit']);_0x20e95b[_0x4f69('0x34')]=qs[_0x4f69('0x34')](_0x377098['query']['offset']);}_0x20e95b[_0x4f69('0x35')]=qs[_0x4f69('0x36')](_0x377098[_0x4f69('0x2c')][_0x4f69('0x36')]);_0x20e95b['where']=qs['filters'](_[_0x4f69('0x37')](_0x377098[_0x4f69('0x2c')],_0x56672a[_0x4f69('0x2e')]),_0x374705);if(_0x377098[_0x4f69('0x2c')][_0x4f69('0x38')]){_0x20e95b['where']=_['merge'](_0x20e95b['where'],{'$or':_[_0x4f69('0x25')](_0x374705,function(_0x259259){if(_0x259259[_0x4f69('0x29')]!=='VIRTUAL'){var _0x4f9db1={};_0x4f9db1[_0x259259[_0x4f69('0x22')]]={'$like':'%'+_0x377098[_0x4f69('0x2c')]['filter']+'%'};return _0x4f9db1;}})});}_0x20e95b=_[_0x4f69('0x39')]({},_0x20e95b,_0x377098[_0x4f69('0x3a')]);var _0x4da76c={'where':_0x20e95b[_0x4f69('0x3b')]};return db[_0x4f69('0x26')][_0x4f69('0x19')](_0x4da76c)[_0x4f69('0x3c')](function(_0xeccdee){_0x3b6cde['count']=_0xeccdee;if(_0x377098[_0x4f69('0x2c')]['includeAll']){_0x20e95b[_0x4f69('0x3d')]=[{'all':!![]}];}return db[_0x4f69('0x26')][_0x4f69('0x3e')](_0x20e95b);})[_0x4f69('0x3c')](function(_0x1c5a44){_0x3b6cde['rows']=_0x1c5a44;return _0x3b6cde;})[_0x4f69('0x3c')](respondWithFilteredResult(_0x2f195e,_0x20e95b))['catch'](handleError(_0x2f195e,null));};exports[_0x4f69('0x3f')]=function(_0x434dda,_0x118fc8){var _0x5e83ea={'raw':!![],'where':{'id':_0x434dda['params']['id']}},_0x579e66={};_0x579e66['model']=_[_0x4f69('0x2d')](db[_0x4f69('0x26')]['rawAttributes']);_0x579e66[_0x4f69('0x2c')]=_[_0x4f69('0x2d')](_0x434dda['query']);_0x579e66[_0x4f69('0x2e')]=_[_0x4f69('0x2f')](_0x579e66[_0x4f69('0x2b')],_0x579e66['query']);_0x5e83ea[_0x4f69('0x30')]=_[_0x4f69('0x2f')](_0x579e66[_0x4f69('0x2b')],qs[_0x4f69('0x31')](_0x434dda[_0x4f69('0x2c')][_0x4f69('0x31')]));_0x5e83ea[_0x4f69('0x30')]=_0x5e83ea['attributes'][_0x4f69('0x40')]?_0x5e83ea['attributes']:_0x579e66['model'];if(_0x434dda[_0x4f69('0x2c')][_0x4f69('0x41')]){_0x5e83ea[_0x4f69('0x3d')]=[{'all':!![]}];}_0x5e83ea=_[_0x4f69('0x39')]({},_0x5e83ea,_0x434dda['options']);return db['VoiceTransferReport'][_0x4f69('0x42')](_0x5e83ea)['then'](handleEntityNotFound(_0x118fc8,null))['then'](respondWithResult(_0x118fc8,null))[_0x4f69('0x43')](handleError(_0x118fc8,null));};exports[_0x4f69('0x44')]=function(_0x504ac9,_0x45085f){return db[_0x4f69('0x26')]['create'](_0x504ac9['body'],{})[_0x4f69('0x3c')](respondWithResult(_0x45085f,0xc9))[_0x4f69('0x43')](handleError(_0x45085f,null));};exports[_0x4f69('0x1f')]=function(_0x48729a,_0x522e9a){if(_0x48729a[_0x4f69('0x45')]['id']){delete _0x48729a[_0x4f69('0x45')]['id'];}return db[_0x4f69('0x26')][_0x4f69('0x42')]({'where':{'id':_0x48729a[_0x4f69('0x46')]['id']}})['then'](handleEntityNotFound(_0x522e9a,null))[_0x4f69('0x3c')](saveUpdates(_0x48729a['body'],null))[_0x4f69('0x3c')](respondWithResult(_0x522e9a,null))[_0x4f69('0x43')](handleError(_0x522e9a,null));};exports[_0x4f69('0x20')]=function(_0x5b383a,_0xe93be0){return db[_0x4f69('0x26')][_0x4f69('0x42')]({'where':{'id':_0x5b383a[_0x4f69('0x46')]['id']}})[_0x4f69('0x3c')](handleEntityNotFound(_0xe93be0,null))['then'](removeEntity(_0xe93be0,null))[_0x4f69('0x43')](handleError(_0xe93be0,null));}; \ No newline at end of file +var _0x8f2f=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x8f2f,0x1b6));var _0xf8f2=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x8f2f[_0x273c39];return _0x46d6b5;};'use strict';var pdf=require(_0xf8f2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf8f2('0x1'));var jsonpatch=require(_0xf8f2('0x2'));var rp=require(_0xf8f2('0x3'));var moment=require(_0xf8f2('0x4'));var BPromise=require(_0xf8f2('0x5'));var Mustache=require('mustache');var util=require(_0xf8f2('0x6'));var path=require('path');var sox=require(_0xf8f2('0x7'));var csv=require(_0xf8f2('0x8'));var ejs=require(_0xf8f2('0x9'));var fs=require('fs');var _=require(_0xf8f2('0xa'));var squel=require('squel');var crypto=require(_0xf8f2('0xb'));var jsforce=require(_0xf8f2('0xc'));var deskjs=require(_0xf8f2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf8f2('0xe'));var Papa=require(_0xf8f2('0xf'));var Redis=require(_0xf8f2('0x10'));var authService=require(_0xf8f2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8f2('0x12'));var logger=require(_0xf8f2('0x13'))(_0xf8f2('0x14'));var utils=require(_0xf8f2('0x15'));var config=require(_0xf8f2('0x16'));var db=require(_0xf8f2('0x17'))['db'];function respondWithStatusCode(_0x382957,_0x2c38e6){_0x2c38e6=_0x2c38e6||0xcc;return function(_0x235f23){if(_0x235f23){return _0x382957['sendStatus'](_0x2c38e6);}return _0x382957[_0xf8f2('0x18')](_0x2c38e6)[_0xf8f2('0x19')]();};}function respondWithResult(_0x427d9e,_0x1f5fe1){_0x1f5fe1=_0x1f5fe1||0xc8;return function(_0x4c4455){if(_0x4c4455){return _0x427d9e[_0xf8f2('0x18')](_0x1f5fe1)[_0xf8f2('0x1a')](_0x4c4455);}};}function respondWithFilteredResult(_0xc216fc,_0x25618d){return function(_0x335cb4){if(_0x335cb4){var _0x2c65aa=_0x335cb4[_0xf8f2('0x1b')],_0x57974b=_0x25618d[_0xf8f2('0x1c')],_0x16b8f3=_0x25618d[_0xf8f2('0x1c')]+_0x25618d[_0xf8f2('0x1d')],_0x15765b;if(_0x16b8f3>=_0x2c65aa){_0x16b8f3=_0x2c65aa;_0x15765b=0xc8;}else{_0x15765b=0xce;}_0xc216fc[_0xf8f2('0x18')](_0x15765b);return _0xc216fc[_0xf8f2('0x1e')](_0xf8f2('0x1f'),_0x57974b+'-'+_0x16b8f3+'/'+_0x2c65aa)[_0xf8f2('0x1a')](_0x335cb4);}return null;};}function patchUpdates(_0x278e70){return function(_0x2b5840){try{jsonpatch[_0xf8f2('0x20')](_0x2b5840,_0x278e70,!![]);}catch(_0x124b58){return BPromise[_0xf8f2('0x21')](_0x124b58);}return _0x2b5840['save']();};}function saveUpdates(_0x46102d,_0x52b228){return function(_0x231f74){if(_0x231f74){return _0x231f74[_0xf8f2('0x22')](_0x46102d)[_0xf8f2('0x23')](function(_0x2b7fa1){return _0x2b7fa1;});}return null;};}function removeEntity(_0xec841,_0x3a2688){return function(_0x4ba90f){if(_0x4ba90f){return _0x4ba90f[_0xf8f2('0x24')]()['then'](function(){_0xec841[_0xf8f2('0x18')](0xcc)[_0xf8f2('0x19')]();});}};}function handleEntityNotFound(_0x4d6c48,_0xda70ae){return function(_0x43d3f4){if(!_0x43d3f4){_0x4d6c48['sendStatus'](0x194);}return _0x43d3f4;};}function handleError(_0x470028,_0x24f35e){_0x24f35e=_0x24f35e||0x1f4;return function(_0xf135d){logger[_0xf8f2('0x25')](_0xf135d[_0xf8f2('0x26')]);if(_0xf135d[_0xf8f2('0x27')]){delete _0xf135d['name'];}_0x470028[_0xf8f2('0x18')](_0x24f35e)[_0xf8f2('0x28')](_0xf135d);};}exports[_0xf8f2('0x29')]=function(_0x329d28,_0x2b93f6){var _0x2307d0={},_0x58d4af={},_0x1cfe2b={'count':0x0,'rows':[]};var _0xfaccc4=_[_0xf8f2('0x2a')](db[_0xf8f2('0x2b')]['rawAttributes'],function(_0x4f124e){return{'name':_0x4f124e[_0xf8f2('0x2c')],'type':_0x4f124e[_0xf8f2('0x2d')][_0xf8f2('0x2e')]};});_0x58d4af[_0xf8f2('0x2f')]=_[_0xf8f2('0x2a')](_0xfaccc4,_0xf8f2('0x27'));_0x58d4af[_0xf8f2('0x30')]=_[_0xf8f2('0x31')](_0x329d28['query']);_0x58d4af[_0xf8f2('0x32')]=_[_0xf8f2('0x33')](_0x58d4af[_0xf8f2('0x2f')],_0x58d4af[_0xf8f2('0x30')]);_0x2307d0[_0xf8f2('0x34')]=_[_0xf8f2('0x33')](_0x58d4af[_0xf8f2('0x2f')],qs['fields'](_0x329d28[_0xf8f2('0x30')][_0xf8f2('0x35')]));_0x2307d0[_0xf8f2('0x34')]=_0x2307d0[_0xf8f2('0x34')][_0xf8f2('0x36')]?_0x2307d0[_0xf8f2('0x34')]:_0x58d4af['model'];if(!_0x329d28[_0xf8f2('0x30')][_0xf8f2('0x37')](_0xf8f2('0x38'))){_0x2307d0['limit']=qs[_0xf8f2('0x1d')](_0x329d28[_0xf8f2('0x30')][_0xf8f2('0x1d')]);_0x2307d0['offset']=qs['offset'](_0x329d28[_0xf8f2('0x30')][_0xf8f2('0x1c')]);}_0x2307d0[_0xf8f2('0x39')]=qs[_0xf8f2('0x3a')](_0x329d28[_0xf8f2('0x30')][_0xf8f2('0x3a')]);_0x2307d0[_0xf8f2('0x3b')]=qs['filters'](_[_0xf8f2('0x3c')](_0x329d28[_0xf8f2('0x30')],_0x58d4af[_0xf8f2('0x32')]),_0xfaccc4);if(_0x329d28[_0xf8f2('0x30')][_0xf8f2('0x3d')]){_0x2307d0[_0xf8f2('0x3b')]=_[_0xf8f2('0x3e')](_0x2307d0[_0xf8f2('0x3b')],{'$or':_[_0xf8f2('0x2a')](_0xfaccc4,function(_0xc50645){if(_0xc50645[_0xf8f2('0x2d')]!==_0xf8f2('0x3f')){var _0x2666a9={};_0x2666a9[_0xc50645['name']]={'$like':'%'+_0x329d28[_0xf8f2('0x30')][_0xf8f2('0x3d')]+'%'};return _0x2666a9;}})});}_0x2307d0=_['merge']({},_0x2307d0,_0x329d28[_0xf8f2('0x40')]);var _0x2fcaa6={'where':_0x2307d0['where']};return db[_0xf8f2('0x2b')][_0xf8f2('0x1b')](_0x2fcaa6)['then'](function(_0x48710d){_0x1cfe2b[_0xf8f2('0x1b')]=_0x48710d;if(_0x329d28[_0xf8f2('0x30')][_0xf8f2('0x41')]){_0x2307d0[_0xf8f2('0x42')]=[{'all':!![]}];}return db[_0xf8f2('0x2b')]['findAll'](_0x2307d0);})[_0xf8f2('0x23')](function(_0x221b16){_0x1cfe2b[_0xf8f2('0x43')]=_0x221b16;return _0x1cfe2b;})[_0xf8f2('0x23')](respondWithFilteredResult(_0x2b93f6,_0x2307d0))[_0xf8f2('0x44')](handleError(_0x2b93f6,null));};exports[_0xf8f2('0x45')]=function(_0x12cc42,_0x30e365){var _0x1b15b5={'raw':!![],'where':{'id':_0x12cc42[_0xf8f2('0x46')]['id']}},_0x10d730={};_0x10d730[_0xf8f2('0x2f')]=_['keys'](db[_0xf8f2('0x2b')][_0xf8f2('0x47')]);_0x10d730[_0xf8f2('0x30')]=_[_0xf8f2('0x31')](_0x12cc42[_0xf8f2('0x30')]);_0x10d730[_0xf8f2('0x32')]=_['intersection'](_0x10d730[_0xf8f2('0x2f')],_0x10d730[_0xf8f2('0x30')]);_0x1b15b5[_0xf8f2('0x34')]=_['intersection'](_0x10d730['model'],qs[_0xf8f2('0x35')](_0x12cc42[_0xf8f2('0x30')][_0xf8f2('0x35')]));_0x1b15b5['attributes']=_0x1b15b5[_0xf8f2('0x34')][_0xf8f2('0x36')]?_0x1b15b5[_0xf8f2('0x34')]:_0x10d730[_0xf8f2('0x2f')];if(_0x12cc42['query'][_0xf8f2('0x41')]){_0x1b15b5[_0xf8f2('0x42')]=[{'all':!![]}];}_0x1b15b5=_[_0xf8f2('0x3e')]({},_0x1b15b5,_0x12cc42[_0xf8f2('0x40')]);return db[_0xf8f2('0x2b')][_0xf8f2('0x48')](_0x1b15b5)['then'](handleEntityNotFound(_0x30e365,null))[_0xf8f2('0x23')](respondWithResult(_0x30e365,null))[_0xf8f2('0x44')](handleError(_0x30e365,null));};exports['create']=function(_0x1fcfa2,_0x43ac5b){return db[_0xf8f2('0x2b')][_0xf8f2('0x49')](_0x1fcfa2['body'],{})[_0xf8f2('0x23')](respondWithResult(_0x43ac5b,0xc9))[_0xf8f2('0x44')](handleError(_0x43ac5b,null));};exports[_0xf8f2('0x22')]=function(_0x5e4b9e,_0xa48dce){if(_0x5e4b9e['body']['id']){delete _0x5e4b9e[_0xf8f2('0x4a')]['id'];}return db[_0xf8f2('0x2b')]['find']({'where':{'id':_0x5e4b9e['params']['id']}})[_0xf8f2('0x23')](handleEntityNotFound(_0xa48dce,null))[_0xf8f2('0x23')](saveUpdates(_0x5e4b9e[_0xf8f2('0x4a')],null))['then'](respondWithResult(_0xa48dce,null))[_0xf8f2('0x44')](handleError(_0xa48dce,null));};exports['destroy']=function(_0x41e702,_0x14c5b3){return db['VoiceTransferReport'][_0xf8f2('0x48')]({'where':{'id':_0x41e702[_0xf8f2('0x46')]['id']}})['then'](handleEntityNotFound(_0x14c5b3,null))[_0xf8f2('0x23')](removeEntity(_0x14c5b3,null))[_0xf8f2('0x44')](handleError(_0x14c5b3,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1107fb0..e05444c 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 _0x3a95=['request-promise','path','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','lodash','util','../../config/logger','api','moment'];(function(_0x21c6f5,_0x2ca46d){var _0x5451df=function(_0x35b06c){while(--_0x35b06c){_0x21c6f5['push'](_0x21c6f5['shift']());}};_0x5451df(++_0x2ca46d);}(_0x3a95,0xc1));var _0x53a9=function(_0x3fa715,_0xb42eba){_0x3fa715=_0x3fa715-0x0;var _0x112000=_0x3a95[_0x3fa715];return _0x112000;};'use strict';var _=require(_0x53a9('0x0'));var util=require(_0x53a9('0x1'));var logger=require(_0x53a9('0x2'))(_0x53a9('0x3'));var moment=require(_0x53a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x53a9('0x5'));var fs=require('fs');var path=require(_0x53a9('0x6'));var rimraf=require(_0x53a9('0x7'));var config=require('../../config/environment');var attributes=require(_0x53a9('0x8'));module[_0x53a9('0x9')]=function(_0x13dc6f,_0x33df82){return _0x13dc6f['define'](_0x53a9('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e2=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x35daf1,_0x346d71){var _0x311911=function(_0x12e626){while(--_0x12e626){_0x35daf1['push'](_0x35daf1['shift']());}};_0x311911(++_0x346d71);}(_0xe4e2,0x155));var _0x2e4e=function(_0x36fe63,_0x13af61){_0x36fe63=_0x36fe63-0x0;var _0x33841c=_0xe4e2[_0x36fe63];return _0x33841c;};'use strict';var _=require(_0x2e4e('0x0'));var util=require(_0x2e4e('0x1'));var logger=require('../../config/logger')(_0x2e4e('0x2'));var moment=require(_0x2e4e('0x3'));var BPromise=require(_0x2e4e('0x4'));var rp=require(_0x2e4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2e4e('0x6'));var attributes=require(_0x2e4e('0x7'));module[_0x2e4e('0x8')]=function(_0x2b503c,_0x173da3){return _0x2b503c[_0x2e4e('0x9')](_0x2e4e('0xa'),attributes,{'tableName':_0x2e4e('0xb'),'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 962aeb2..8d1492b 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 _0x082e=['../../config/utils','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3b72e2,_0x302813){var _0x243f37=function(_0x589413){while(--_0x589413){_0x3b72e2['push'](_0x3b72e2['shift']());}};_0x243f37(++_0x302813);}(_0x082e,0x14b));var _0xe082=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x082e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe082('0x0'));var util=require('util');var moment=require(_0xe082('0x1'));var BPromise=require('bluebird');var rs=require(_0xe082('0x2'));var fs=require('fs');var Redis=require(_0xe082('0x3'));var db=require(_0xe082('0x4'))['db'];var utils=require(_0xe082('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe082('0x6'));var jayson=require(_0xe082('0x7'));var client=jayson[_0xe082('0x8')][_0xe082('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x582078,_0x43eb6f,_0x43acc8){return new BPromise(function(_0x41ac96,_0x291f0b){return client['request'](_0x582078,_0x43acc8)['then'](function(_0xdbcbb3){logger[_0xe082('0xa')](_0xe082('0xb'),_0x43eb6f,'request\x20sent');logger[_0xe082('0xc')](_0xe082('0xd'),_0x43eb6f,_0xe082('0xe'),JSON[_0xe082('0xf')](_0xdbcbb3));if(_0xdbcbb3[_0xe082('0x10')]){if(_0xdbcbb3['error'][_0xe082('0x11')]===0x1f4){logger[_0xe082('0x10')](_0xe082('0xb'),_0x43eb6f,_0xdbcbb3[_0xe082('0x10')][_0xe082('0x12')]);return _0x291f0b(_0xdbcbb3[_0xe082('0x10')]['message']);}logger[_0xe082('0x10')](_0xe082('0xb'),_0x43eb6f,_0xdbcbb3['error'][_0xe082('0x12')]);return _0x41ac96(_0xdbcbb3['error'][_0xe082('0x12')]);}else{logger[_0xe082('0xa')](_0xe082('0xb'),_0x43eb6f,_0xe082('0xe'));_0x41ac96(_0xdbcbb3[_0xe082('0x13')][_0xe082('0x12')]);}})[_0xe082('0x14')](function(_0x47382b){logger[_0xe082('0x10')](_0xe082('0xb'),_0x43eb6f,_0x47382b);_0x291f0b(_0x47382b);});});}exports[_0xe082('0x15')]=function(_0x202de8){var _0x257996=this;return new Promise(function(_0x48b597,_0x3c7e1e){return db[_0xe082('0x16')][_0xe082('0x17')](_0x202de8[_0xe082('0x18')],{'raw':_0x202de8[_0xe082('0x19')]?_0x202de8['options'][_0xe082('0x1a')]===undefined?!![]:![]:!![]})[_0xe082('0x1b')](function(_0xcb593f){logger[_0xe082('0xa')](_0xe082('0x15'),_0x202de8);logger[_0xe082('0xc')]('CreateVoiceTransferReport',_0x202de8,JSON['stringify'](_0xcb593f));_0x48b597(_0xcb593f);})['catch'](function(_0x507ab1){logger[_0xe082('0x10')](_0xe082('0x15'),_0x507ab1[_0xe082('0x12')],_0x202de8);_0x3c7e1e(_0x257996['error'](0x1f4,_0x507ab1[_0xe082('0x12')]));});});}; \ No newline at end of file +var _0xe961=['message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x541786,_0x496f28){var _0x5c0159=function(_0x319bc5){while(--_0x319bc5){_0x541786['push'](_0x541786['shift']());}};_0x5c0159(++_0x496f28);}(_0xe961,0xd3));var _0x1e96=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xe961[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x1e96('0x0'));var util=require(_0x1e96('0x1'));var moment=require(_0x1e96('0x2'));var BPromise=require(_0x1e96('0x3'));var rs=require(_0x1e96('0x4'));var fs=require('fs');var Redis=require(_0x1e96('0x5'));var db=require(_0x1e96('0x6'))['db'];var utils=require(_0x1e96('0x7'));var logger=require('../../config/logger')(_0x1e96('0x8'));var config=require(_0x1e96('0x9'));var jayson=require(_0x1e96('0xa'));var client=jayson[_0x1e96('0xb')][_0x1e96('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e518f,_0x38f013,_0x59062c){return new BPromise(function(_0x5575e8,_0x22dc95){return client[_0x1e96('0xd')](_0x2e518f,_0x59062c)[_0x1e96('0xe')](function(_0x3a744a){logger[_0x1e96('0xf')](_0x1e96('0x10'),_0x38f013,_0x1e96('0x11'));logger[_0x1e96('0x12')](_0x1e96('0x13'),_0x38f013,_0x1e96('0x11'),JSON['stringify'](_0x3a744a));if(_0x3a744a[_0x1e96('0x14')]){if(_0x3a744a[_0x1e96('0x14')]['code']===0x1f4){logger[_0x1e96('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x38f013,_0x3a744a[_0x1e96('0x14')]['message']);return _0x22dc95(_0x3a744a[_0x1e96('0x14')]['message']);}logger['error'](_0x1e96('0x10'),_0x38f013,_0x3a744a['error'][_0x1e96('0x15')]);return _0x5575e8(_0x3a744a[_0x1e96('0x14')][_0x1e96('0x15')]);}else{logger[_0x1e96('0xf')](_0x1e96('0x10'),_0x38f013,_0x1e96('0x11'));_0x5575e8(_0x3a744a[_0x1e96('0x16')][_0x1e96('0x15')]);}})[_0x1e96('0x17')](function(_0x506cd1){logger[_0x1e96('0x14')](_0x1e96('0x10'),_0x38f013,_0x506cd1);_0x22dc95(_0x506cd1);});});}exports[_0x1e96('0x18')]=function(_0x2a81f6){var _0x4a6c5d=this;return new Promise(function(_0x1fdb7b,_0x37ca9f){return db[_0x1e96('0x19')][_0x1e96('0x1a')](_0x2a81f6[_0x1e96('0x1b')],{'raw':_0x2a81f6['options']?_0x2a81f6['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3144a2){logger[_0x1e96('0xf')](_0x1e96('0x18'),_0x2a81f6);logger[_0x1e96('0x12')](_0x1e96('0x18'),_0x2a81f6,JSON[_0x1e96('0x1c')](_0x3144a2));_0x1fdb7b(_0x3144a2);})[_0x1e96('0x17')](function(_0x121fb8){logger[_0x1e96('0x14')](_0x1e96('0x18'),_0x121fb8[_0x1e96('0x15')],_0x2a81f6);_0x37ca9f(_0x4a6c5d[_0x1e96('0x14')](0x1f4,_0x121fb8[_0x1e96('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index fee5bbb..82350c4 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 _0xbbb8=['hold','/unhold','unhold','calls','/transfer','transfer','express','Router','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','answer','/hold'];(function(_0x598a75,_0x100c5e){var _0x121173=function(_0x4ca5e1){while(--_0x4ca5e1){_0x598a75['push'](_0x598a75['shift']());}};_0x121173(++_0x100c5e);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x521c64,_0x2167fc){_0x521c64=_0x521c64-0x0;var _0x5c091d=_0xbbb8[_0x521c64];return _0x5c091d;};'use strict';var express=require(_0x8bbb('0x0'));var router=express[_0x8bbb('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x8bbb('0x2'));router[_0x8bbb('0x3')]('/originate',auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0x6')]);router[_0x8bbb('0x3')](_0x8bbb('0x7'),auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0x8')]);router[_0x8bbb('0x3')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x8bbb('0x9')]);router[_0x8bbb('0x3')](_0x8bbb('0xa'),auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0xb')]);router[_0x8bbb('0x3')](_0x8bbb('0xc'),auth['isAuthenticated'](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0xd')]);router[_0x8bbb('0x3')]('/calls',auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0xe')]);router['post'](_0x8bbb('0xf'),auth[_0x8bbb('0x4')](),auth[_0x8bbb('0x5')](),controller[_0x8bbb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8a9c=['./webbar.controller','post','isAuthenticated','canUpdate','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xc8a9('0x0'));var router=express[_0xc8a9('0x1')]();var auth=require(_0xc8a9('0x2'));var controller=require(_0xc8a9('0x3'));router[_0xc8a9('0x4')]('/originate',auth[_0xc8a9('0x5')](),auth[_0xc8a9('0x6')](),controller['originate']);router[_0xc8a9('0x4')](_0xc8a9('0x7'),auth[_0xc8a9('0x5')](),auth['canUpdate'](),controller[_0xc8a9('0x8')]);router[_0xc8a9('0x4')](_0xc8a9('0x9'),auth[_0xc8a9('0x5')](),auth[_0xc8a9('0x6')](),controller[_0xc8a9('0xa')]);router[_0xc8a9('0x4')](_0xc8a9('0xb'),auth[_0xc8a9('0x5')](),auth['canUpdate'](),controller['hold']);router[_0xc8a9('0x4')](_0xc8a9('0xc'),auth['isAuthenticated'](),auth[_0xc8a9('0x6')](),controller['unhold']);router[_0xc8a9('0x4')](_0xc8a9('0xd'),auth['isAuthenticated'](),auth[_0xc8a9('0x6')](),controller['calls']);router[_0xc8a9('0x4')](_0xc8a9('0xe'),auth[_0xc8a9('0x5')](),auth[_0xc8a9('0x6')](),controller[_0xc8a9('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index cc39ec2..dce0d45 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 _0xc99a=['code','message','result','User','findOne','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callerId','format','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','entityFound:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','log','handleError:','error','stack','name','send','status','request','then'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0xc99a,0x7c));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xac99('0x0'));var fs=require('fs');var _=require(_0xac99('0x1'));var db=require(_0xac99('0x2'))['db'];var config=require(_0xac99('0x3'));var util=require(_0xac99('0x4'));var BPromise=require(_0xac99('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xac99('0x6')][_0xac99('0x7')]({'port':0x232a});var logger=require(_0xac99('0x8'))(_0xac99('0x9'));var Redis=require(_0xac99('0xa'));config[_0xac99('0xb')]=_[_0xac99('0xc')](config[_0xac99('0xb')],{'host':_0xac99('0xd'),'port':0x18eb});var io=require(_0xac99('0xe'))(new Redis(config[_0xac99('0xb')]));var Schema=require(_0xac99('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xac99('0x10')]},'callNumber':{'type':_0xac99('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xac99('0x11')},'callbackUrl':{'type':_0xac99('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],_0xac99('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],_0xac99('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xac99('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xac99('0x11'),'required':[!![],_0xac99('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],_0xac99('0x10')]},'sessionId':{'type':_0xac99('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xac99('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xac99('0x12'),'required':[!![],_0xac99('0x10')]}});function emit(_0x5cd3fd,_0x3ff09c,_0x3be7d3){logger[_0xac99('0x14')](_0x5cd3fd,_0x3ff09c,JSON['stringify'](_0x3be7d3));io['to'](_0x5cd3fd)['emit'](_0x3ff09c,_0x3be7d3);}function handleError(_0x8a45d3){return function(_0x2d5a20){console[_0xac99('0x15')](_0xac99('0x16'),_0x2d5a20,_0x2d5a20 instanceof RangeError);logger[_0xac99('0x17')](_0x2d5a20[_0xac99('0x18')]);if(_0x2d5a20 instanceof RangeError){if(_0x2d5a20[_0xac99('0x19')]){delete _0x2d5a20['name'];}_0x8a45d3['status'](0x194)[_0xac99('0x1a')](_0x2d5a20);}else{if(_0x2d5a20[_0xac99('0x19')]){delete _0x2d5a20['name'];}_0x8a45d3[_0xac99('0x1b')](0x1f4)[_0xac99('0x1a')](_0x2d5a20);}};}function checkError(){return function(_0x4f9889){if(!_0x4f9889){throw new RangeError('NotFound');}return _0x4f9889;};}function respondWithRpcPromise(_0x42af82,_0x3d057c){return new BPromise(function(_0x38917d,_0x154f4b){var _0x2b7e52=amiClient;return _0x2b7e52[_0xac99('0x1c')](_0x42af82,_0x3d057c)[_0xac99('0x1d')](function(_0x1a39fd){if(_0x1a39fd[_0xac99('0x17')]){if(_0x1a39fd['error'][_0xac99('0x1e')]===0x1f4){return _0x154f4b(_0x1a39fd[_0xac99('0x17')][_0xac99('0x1f')]);}return _0x38917d(_0x1a39fd[_0xac99('0x17')][_0xac99('0x1f')]);}else{_0x38917d(_0x1a39fd[_0xac99('0x20')]);}})['catch'](function(_0xb8e570){_0x154f4b(_0xb8e570);});});}function getAgent(_0x4480fb){return db[_0xac99('0x21')][_0xac99('0x22')]({'where':{'id':_0x4480fb,'role':'agent'}})[_0xac99('0x1d')](checkError());}function getAgentCheckSession(_0x599ebc,_0x3649d1){return new BPromise(function(_0x2423fc,_0x44ee40){var _0x597063=respondWithRpcPromise('VoiceChannels');var _0x353630=getAgent(_0x599ebc);Promise['all']([_0x597063,_0x353630])['then'](function(_0xa4b35e){var _0x38ff85=_0xa4b35e[0x0];var _0x599f62=_0xa4b35e[0x1];var _0x5b6f60=_['filter'](_0x38ff85['rows'],function(_0x44fa13){return _0x44fa13[_0xac99('0x23')]==_0x599f62['id']&&_0x44fa13[_0xac99('0x24')]==_0x3649d1;});if(_0x5b6f60['length']==0x1){_0x2423fc(_0x599f62);}else{_0x44ee40(new RangeError('sessionId\x20'+_0x3649d1+_0xac99('0x25')));}});});}exports[_0xac99('0x26')]=function(_0x47d8d4,_0x271770){logger[_0xac99('0x14')](_0xac99('0x27'),_0x47d8d4[_0xac99('0x28')]);var _0x319ef3=originateValidation[_0xac99('0xf')](_0x47d8d4[_0xac99('0x28')]);if(_0x319ef3[_0xac99('0x29')]>0x0){return _0x271770['status'](0x190)[_0xac99('0x2a')](_0x319ef3);}var _0x59048e=_0x47d8d4[_0xac99('0x28')][_0xac99('0x2b')];var _0x149c23=_0x47d8d4[_0xac99('0x28')]['callNumber'];var _0x112544=_0x47d8d4['body'][_0xac99('0x2c')];var _0x24ec5c=_0x47d8d4[_0xac99('0x28')]['callbackUrl'];return getAgent(_0x59048e)[_0xac99('0x1d')](function(_0x2b4d83){logger[_0xac99('0x14')]('entityFound:',_0x2b4d83['name']);emit(util[_0xac99('0x2d')]('user:%s',_0x2b4d83[_0xac99('0x19')]),_0xac99('0x2e'),{'callNumber':_0x149c23,'callerId':_0x112544,'callbackUrl':_0x24ec5c});return _0x271770[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'error':![],'message':_0xac99('0x2f')});})[_0xac99('0x30')](handleError(_0x271770));};exports[_0xac99('0x31')]=function(_0x3de54e,_0x4ddecf){logger[_0xac99('0x14')](_0xac99('0x32'),_0x3de54e['body']);var _0x5c385c=hangupValidation[_0xac99('0xf')](_0x3de54e[_0xac99('0x28')]);if(_0x5c385c[_0xac99('0x29')]>0x0){return _0x4ddecf[_0xac99('0x1b')](0x190)[_0xac99('0x2a')](_0x5c385c);}var _0x427c60=_0x3de54e[_0xac99('0x28')][_0xac99('0x2b')];var _0x18e88c=_0x3de54e[_0xac99('0x28')][_0xac99('0x24')];return getAgent(_0x427c60)[_0xac99('0x1d')](function(_0x18ad46){logger[_0xac99('0x14')](_0xac99('0x33'),_0x18ad46[_0xac99('0x19')]);emit(util[_0xac99('0x2d')](_0xac99('0x34'),_0x18ad46['name']),_0xac99('0x35'),{'sessionId':_0x18e88c});return _0x4ddecf[_0xac99('0x1b')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x4ddecf));};exports[_0xac99('0x36')]=function(_0x1bea17,_0x28aaea){logger[_0xac99('0x14')](_0xac99('0x37'),_0x1bea17[_0xac99('0x28')]);var _0x48d5e8=answerValidation['validate'](_0x1bea17[_0xac99('0x28')]);if(_0x48d5e8[_0xac99('0x29')]>0x0){return _0x28aaea['status'](0x190)[_0xac99('0x2a')](_0x48d5e8);}var _0x3bdce6=_0x1bea17[_0xac99('0x28')]['userId'];var _0x172f1a=_0x1bea17[_0xac99('0x28')][_0xac99('0x24')];return getAgent(_0x3bdce6)[_0xac99('0x1d')](function(_0x1144ef){logger['info'](_0xac99('0x33'),_0x1144ef[_0xac99('0x19')]);emit(util['format']('user:%s',_0x1144ef['name']),_0xac99('0x38'),{'sessionId':_0x172f1a});return _0x28aaea['status'](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0xac99('0x30')](handleError(_0x28aaea));};exports[_0xac99('0x39')]=function(_0x35ae24,_0xe4003e){logger['info'](_0xac99('0x3a'),_0x35ae24['body']);var _0x382cc8=holdValidation['validate'](_0x35ae24[_0xac99('0x28')]);if(_0x382cc8['length']>0x0){return _0xe4003e['status'](0x190)[_0xac99('0x2a')](_0x382cc8);}var _0x5c6254=_0x35ae24['body'][_0xac99('0x2b')];var _0x5a7de6=_0x35ae24[_0xac99('0x28')][_0xac99('0x24')];return getAgent(_0x5c6254)[_0xac99('0x1d')](function(_0x3df087){logger['info']('entityFound:',_0x3df087[_0xac99('0x19')]);emit(util[_0xac99('0x2d')](_0xac99('0x34'),_0x3df087[_0xac99('0x19')]),_0xac99('0x3b'),{'sessionId':_0x5a7de6});return _0xe4003e[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'error':![],'message':_0xac99('0x3c')});})[_0xac99('0x30')](handleError(_0xe4003e));};exports['unhold']=function(_0x5c14fb,_0x47dcb1){logger[_0xac99('0x14')](_0xac99('0x3d'),_0x5c14fb[_0xac99('0x28')]);var _0x2f257f=unholdValidation[_0xac99('0xf')](_0x5c14fb[_0xac99('0x28')]);if(_0x2f257f[_0xac99('0x29')]>0x0){return _0x47dcb1[_0xac99('0x1b')](0x190)[_0xac99('0x2a')](_0x2f257f);}var _0x4cd670=_0x5c14fb[_0xac99('0x28')][_0xac99('0x2b')];var _0x586f70=_0x5c14fb[_0xac99('0x28')]['sessionId'];return getAgent(_0x4cd670)[_0xac99('0x1d')](function(_0x45ae39){logger[_0xac99('0x14')]('entityFound:',_0x45ae39[_0xac99('0x19')]);emit(util['format']('user:%s',_0x45ae39[_0xac99('0x19')]),_0xac99('0x3e'),{'sessionId':_0x586f70});return _0x47dcb1[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'error':![],'message':_0xac99('0x3f')});})[_0xac99('0x30')](handleError(_0x47dcb1));};exports[_0xac99('0x40')]=function(_0x53f0dc,_0x138750){logger[_0xac99('0x14')](_0xac99('0x41'),_0x138750[_0xac99('0x28')]);var _0x17389b=callsValidation[_0xac99('0xf')](_0x53f0dc['body']);if(_0x17389b[_0xac99('0x29')]>0x0){return _0x138750['status'](0x190)[_0xac99('0x2a')](_0x17389b);}var _0x5df7a3=_0x53f0dc[_0xac99('0x28')][_0xac99('0x2b')];var _0x1afce0=respondWithRpcPromise(_0xac99('0x42'));var _0x28c3cf=getAgent(_0x5df7a3);return Promise[_0xac99('0x43')]([_0x1afce0,_0x28c3cf])[_0xac99('0x1d')](function(_0x88891f){var _0x4009b3=_0x88891f[0x0];var _0x3aad46=_0x88891f[0x1];var _0x4614ac=_['filter'](_0x4009b3[_0xac99('0x44')],function(_0x3fb91d){return _0x3fb91d['UserId']==_0x3aad46['id'];});return _0x138750[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'count':_0x4614ac['length'],'rows':_0x4614ac});})[_0xac99('0x30')](handleError(_0x138750));};exports[_0xac99('0x45')]=function(_0x2ada9d,_0x3d989c){logger[_0xac99('0x14')](_0xac99('0x46'),_0x2ada9d[_0xac99('0x28')]);var _0x5768dc=conferenceValidation['validate'](_0x2ada9d[_0xac99('0x28')]);if(_0x5768dc[_0xac99('0x29')]>0x0){return _0x3d989c[_0xac99('0x1b')](0x190)[_0xac99('0x2a')](_0x5768dc);}var _0x21b2af=_0x2ada9d[_0xac99('0x28')][_0xac99('0x2b')];return getAgent(_0x21b2af)['then'](function(_0x73fa6){logger[_0xac99('0x14')](_0xac99('0x33'),_0x73fa6[_0xac99('0x19')]);emit(util['format'](_0xac99('0x34'),_0x73fa6[_0xac99('0x19')]),_0xac99('0x47'));return _0x3d989c[_0xac99('0x1b')](0xc8)['json']({'error':![],'message':_0xac99('0x48')});})['catch'](handleError(_0x3d989c));};exports[_0xac99('0x49')]=function(_0x39f9ea,_0x3d3462){logger[_0xac99('0x14')](_0xac99('0x4a'),_0x39f9ea[_0xac99('0x28')]);var _0x3a9fa5=transferValidation[_0xac99('0xf')](_0x39f9ea[_0xac99('0x28')]);if(_0x3a9fa5[_0xac99('0x29')]>0x0){return _0x3d3462[_0xac99('0x1b')](0x190)[_0xac99('0x2a')](_0x3a9fa5);}var _0x36efb5=_0x39f9ea[_0xac99('0x28')][_0xac99('0x2b')];var _0x2b022b=_0x39f9ea[_0xac99('0x28')][_0xac99('0x24')];var _0x4d274e=_0x39f9ea[_0xac99('0x28')][_0xac99('0x4b')];return getAgent(_0x36efb5)['then'](function(_0x4bcffa){logger['info'](_0xac99('0x33'),_0x4bcffa['name']);emit(util[_0xac99('0x2d')](_0xac99('0x34'),_0x4bcffa[_0xac99('0x19')]),'webbar:transfer',{'sessionId':_0x2b022b,'transferNumber':_0x4d274e});return _0x3d3462[_0xac99('0x1b')](0xc8)[_0xac99('0x2a')]({'error':![],'message':_0xac99('0x4c')});})[_0xac99('0x30')](handleError(_0x3d3462));}; \ No newline at end of file +var _0x03cf=['entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transfer\x20executed!','lodash','../../mysqldb','bluebird','client','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','log','error','stack','name','send','status','NotFound','message','result','User','findOne','agent','then','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','length','json','userId','callNumber'];(function(_0x570c85,_0x18d065){var _0x2055e5=function(_0xf49b21){while(--_0xf49b21){_0x570c85['push'](_0x570c85['shift']());}};_0x2055e5(++_0x18d065);}(_0x03cf,0x64));var _0xf03c=function(_0x262e6b,_0x2bd4c7){_0x262e6b=_0x262e6b-0x0;var _0x3c5fea=_0x03cf[_0x262e6b];return _0x3c5fea;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf03c('0x0'));var db=require(_0xf03c('0x1'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xf03c('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0xf03c('0x3')]['http']({'port':0x232a});var logger=require(_0xf03c('0x4'))(_0xf03c('0x5'));var Redis=require(_0xf03c('0x6'));config['redis']=_[_0xf03c('0x7')](config[_0xf03c('0x8')],{'host':_0xf03c('0x9'),'port':0x18eb});var io=require(_0xf03c('0xa'))(new Redis(config[_0xf03c('0x8')]));var Schema=require(_0xf03c('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf03c('0xc')]},'callNumber':{'type':_0xf03c('0xd'),'required':[!![],_0xf03c('0xe')]},'callerId':{'type':_0xf03c('0xd')},'callbackUrl':{'type':_0xf03c('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xf03c('0xf'),'required':[!![],_0xf03c('0xc')]},'sessionId':{'type':_0xf03c('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf03c('0xf'),'required':[!![],_0xf03c('0xc')]},'sessionId':{'type':_0xf03c('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf03c('0xf'),'required':[!![],_0xf03c('0xc')]},'sessionId':{'type':'string','required':[!![],_0xf03c('0x10')]},'transferNumber':{'type':_0xf03c('0xd'),'required':[!![],_0xf03c('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf03c('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf03c('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf03c('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf03c('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf03c('0xf'),'required':[!![],_0xf03c('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf03c('0xc')]}});function emit(_0x4d0994,_0x30c66e,_0x10545f){logger['info'](_0x4d0994,_0x30c66e,JSON['stringify'](_0x10545f));io['to'](_0x4d0994)['emit'](_0x30c66e,_0x10545f);}function handleError(_0x30de55){return function(_0x1fafb3){console[_0xf03c('0x12')]('handleError:',_0x1fafb3,_0x1fafb3 instanceof RangeError);logger[_0xf03c('0x13')](_0x1fafb3[_0xf03c('0x14')]);if(_0x1fafb3 instanceof RangeError){if(_0x1fafb3[_0xf03c('0x15')]){delete _0x1fafb3[_0xf03c('0x15')];}_0x30de55['status'](0x194)[_0xf03c('0x16')](_0x1fafb3);}else{if(_0x1fafb3[_0xf03c('0x15')]){delete _0x1fafb3[_0xf03c('0x15')];}_0x30de55[_0xf03c('0x17')](0x1f4)[_0xf03c('0x16')](_0x1fafb3);}};}function checkError(){return function(_0x48007b){if(!_0x48007b){throw new RangeError(_0xf03c('0x18'));}return _0x48007b;};}function respondWithRpcPromise(_0x418e5c,_0x57b153){return new BPromise(function(_0x5953bb,_0x22e4b6){var _0x2474da=amiClient;return _0x2474da['request'](_0x418e5c,_0x57b153)['then'](function(_0x5e76f4){if(_0x5e76f4['error']){if(_0x5e76f4[_0xf03c('0x13')]['code']===0x1f4){return _0x22e4b6(_0x5e76f4[_0xf03c('0x13')][_0xf03c('0x19')]);}return _0x5953bb(_0x5e76f4[_0xf03c('0x13')][_0xf03c('0x19')]);}else{_0x5953bb(_0x5e76f4[_0xf03c('0x1a')]);}})['catch'](function(_0x272408){_0x22e4b6(_0x272408);});});}function getAgent(_0x44da09){return db[_0xf03c('0x1b')][_0xf03c('0x1c')]({'where':{'id':_0x44da09,'role':_0xf03c('0x1d')}})[_0xf03c('0x1e')](checkError());}function getAgentCheckSession(_0x4ae35d,_0x5ba510){return new BPromise(function(_0xb671e2,_0x4671e3){var _0x44795c=respondWithRpcPromise(_0xf03c('0x1f'));var _0x343222=getAgent(_0x4ae35d);Promise[_0xf03c('0x20')]([_0x44795c,_0x343222])[_0xf03c('0x1e')](function(_0x4353b0){var _0x2a6885=_0x4353b0[0x0];var _0x5b2d59=_0x4353b0[0x1];var _0x1df90f=_[_0xf03c('0x21')](_0x2a6885['rows'],function(_0x258e37){return _0x258e37[_0xf03c('0x22')]==_0x5b2d59['id']&&_0x258e37[_0xf03c('0x23')]==_0x5ba510;});if(_0x1df90f['length']==0x1){_0xb671e2(_0x5b2d59);}else{_0x4671e3(new RangeError(_0xf03c('0x24')+_0x5ba510+_0xf03c('0x25')));}});});}exports[_0xf03c('0x26')]=function(_0x53d5ae,_0x306511){logger[_0xf03c('0x27')](_0xf03c('0x28'),_0x53d5ae['body']);var _0x5dda04=originateValidation[_0xf03c('0xb')](_0x53d5ae[_0xf03c('0x29')]);if(_0x5dda04[_0xf03c('0x2a')]>0x0){return _0x306511[_0xf03c('0x17')](0x190)[_0xf03c('0x2b')](_0x5dda04);}var _0x1e4076=_0x53d5ae['body'][_0xf03c('0x2c')];var _0xb155e0=_0x53d5ae['body'][_0xf03c('0x2d')];var _0xd095dc=_0x53d5ae[_0xf03c('0x29')]['callerId'];var _0x57bd41=_0x53d5ae[_0xf03c('0x29')]['callbackUrl'];return getAgent(_0x1e4076)[_0xf03c('0x1e')](function(_0x4465f7){logger[_0xf03c('0x27')](_0xf03c('0x2e'),_0x4465f7[_0xf03c('0x15')]);emit(util[_0xf03c('0x2f')](_0xf03c('0x30'),_0x4465f7['name']),_0xf03c('0x31'),{'callNumber':_0xb155e0,'callerId':_0xd095dc,'callbackUrl':_0x57bd41});return _0x306511[_0xf03c('0x17')](0xc8)[_0xf03c('0x2b')]({'error':![],'message':_0xf03c('0x32')});})[_0xf03c('0x33')](handleError(_0x306511));};exports[_0xf03c('0x34')]=function(_0x2cec14,_0x4dadbc){logger[_0xf03c('0x27')]('hangup\x20fired:',_0x2cec14[_0xf03c('0x29')]);var _0x2bc026=hangupValidation[_0xf03c('0xb')](_0x2cec14['body']);if(_0x2bc026[_0xf03c('0x2a')]>0x0){return _0x4dadbc[_0xf03c('0x17')](0x190)[_0xf03c('0x2b')](_0x2bc026);}var _0x2cfcd8=_0x2cec14['body'][_0xf03c('0x2c')];var _0x3f0817=_0x2cec14[_0xf03c('0x29')][_0xf03c('0x23')];return getAgent(_0x2cfcd8)[_0xf03c('0x1e')](function(_0x5c7f89){logger['info']('entityFound:',_0x5c7f89['name']);emit(util[_0xf03c('0x2f')](_0xf03c('0x30'),_0x5c7f89[_0xf03c('0x15')]),'webbar:hangup',{'sessionId':_0x3f0817});return _0x4dadbc[_0xf03c('0x17')](0xc8)[_0xf03c('0x2b')]({'error':![],'message':_0xf03c('0x35')});})[_0xf03c('0x33')](handleError(_0x4dadbc));};exports[_0xf03c('0x36')]=function(_0x8054d,_0x256742){logger['info'](_0xf03c('0x37'),_0x8054d[_0xf03c('0x29')]);var _0x3669aa=answerValidation[_0xf03c('0xb')](_0x8054d[_0xf03c('0x29')]);if(_0x3669aa[_0xf03c('0x2a')]>0x0){return _0x256742[_0xf03c('0x17')](0x190)['json'](_0x3669aa);}var _0x2603c8=_0x8054d[_0xf03c('0x29')][_0xf03c('0x2c')];var _0x246a5e=_0x8054d['body'][_0xf03c('0x23')];return getAgent(_0x2603c8)[_0xf03c('0x1e')](function(_0xf84b26){logger[_0xf03c('0x27')](_0xf03c('0x2e'),_0xf84b26[_0xf03c('0x15')]);emit(util[_0xf03c('0x2f')](_0xf03c('0x30'),_0xf84b26[_0xf03c('0x15')]),_0xf03c('0x38'),{'sessionId':_0x246a5e});return _0x256742[_0xf03c('0x17')](0xc8)[_0xf03c('0x2b')]({'error':![],'message':_0xf03c('0x39')});})[_0xf03c('0x33')](handleError(_0x256742));};exports[_0xf03c('0x3a')]=function(_0x11342d,_0x15356c){logger['info']('hold\x20fired:',_0x11342d[_0xf03c('0x29')]);var _0x4ebc52=holdValidation['validate'](_0x11342d[_0xf03c('0x29')]);if(_0x4ebc52['length']>0x0){return _0x15356c[_0xf03c('0x17')](0x190)['json'](_0x4ebc52);}var _0x1bd628=_0x11342d['body'][_0xf03c('0x2c')];var _0x38af6f=_0x11342d[_0xf03c('0x29')][_0xf03c('0x23')];return getAgent(_0x1bd628)[_0xf03c('0x1e')](function(_0x47eb40){logger[_0xf03c('0x27')](_0xf03c('0x2e'),_0x47eb40[_0xf03c('0x15')]);emit(util[_0xf03c('0x2f')]('user:%s',_0x47eb40[_0xf03c('0x15')]),_0xf03c('0x3b'),{'sessionId':_0x38af6f});return _0x15356c['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0xf03c('0x33')](handleError(_0x15356c));};exports[_0xf03c('0x3c')]=function(_0x144d3a,_0x68047a){logger[_0xf03c('0x27')](_0xf03c('0x3d'),_0x144d3a[_0xf03c('0x29')]);var _0x22695c=unholdValidation[_0xf03c('0xb')](_0x144d3a[_0xf03c('0x29')]);if(_0x22695c[_0xf03c('0x2a')]>0x0){return _0x68047a['status'](0x190)[_0xf03c('0x2b')](_0x22695c);}var _0x45e707=_0x144d3a['body']['userId'];var _0x16c2d2=_0x144d3a[_0xf03c('0x29')][_0xf03c('0x23')];return getAgent(_0x45e707)['then'](function(_0xea7430){logger[_0xf03c('0x27')]('entityFound:',_0xea7430[_0xf03c('0x15')]);emit(util[_0xf03c('0x2f')](_0xf03c('0x30'),_0xea7430[_0xf03c('0x15')]),'webbar:unhold',{'sessionId':_0x16c2d2});return _0x68047a[_0xf03c('0x17')](0xc8)[_0xf03c('0x2b')]({'error':![],'message':_0xf03c('0x3e')});})['catch'](handleError(_0x68047a));};exports[_0xf03c('0x3f')]=function(_0x356c16,_0x1c9226){logger[_0xf03c('0x27')](_0xf03c('0x40'),_0x1c9226['body']);var _0x3766e3=callsValidation[_0xf03c('0xb')](_0x356c16['body']);if(_0x3766e3[_0xf03c('0x2a')]>0x0){return _0x1c9226[_0xf03c('0x17')](0x190)[_0xf03c('0x2b')](_0x3766e3);}var _0x3c3d6e=_0x356c16[_0xf03c('0x29')]['userId'];var _0x29b325=respondWithRpcPromise(_0xf03c('0x1f'));var _0x1429fa=getAgent(_0x3c3d6e);return Promise[_0xf03c('0x20')]([_0x29b325,_0x1429fa])[_0xf03c('0x1e')](function(_0x529171){var _0x25da2d=_0x529171[0x0];var _0x578c4e=_0x529171[0x1];var _0x26f339=_[_0xf03c('0x21')](_0x25da2d[_0xf03c('0x41')],function(_0x388a7e){return _0x388a7e[_0xf03c('0x22')]==_0x578c4e['id'];});return _0x1c9226[_0xf03c('0x17')](0xc8)[_0xf03c('0x2b')]({'count':_0x26f339['length'],'rows':_0x26f339});})[_0xf03c('0x33')](handleError(_0x1c9226));};exports[_0xf03c('0x42')]=function(_0x74d560,_0x2b3083){logger[_0xf03c('0x27')](_0xf03c('0x43'),_0x74d560[_0xf03c('0x29')]);var _0x59f165=conferenceValidation['validate'](_0x74d560[_0xf03c('0x29')]);if(_0x59f165[_0xf03c('0x2a')]>0x0){return _0x2b3083[_0xf03c('0x17')](0x190)[_0xf03c('0x2b')](_0x59f165);}var _0x41ed5b=_0x74d560[_0xf03c('0x29')][_0xf03c('0x2c')];return getAgent(_0x41ed5b)[_0xf03c('0x1e')](function(_0x19acd5){logger[_0xf03c('0x27')](_0xf03c('0x2e'),_0x19acd5[_0xf03c('0x15')]);emit(util[_0xf03c('0x2f')](_0xf03c('0x30'),_0x19acd5['name']),_0xf03c('0x44'));return _0x2b3083[_0xf03c('0x17')](0xc8)[_0xf03c('0x2b')]({'error':![],'message':_0xf03c('0x45')});})[_0xf03c('0x33')](handleError(_0x2b3083));};exports[_0xf03c('0x46')]=function(_0x4b9bbd,_0x5d38b2){logger[_0xf03c('0x27')](_0xf03c('0x47'),_0x4b9bbd[_0xf03c('0x29')]);var _0x5162a2=transferValidation[_0xf03c('0xb')](_0x4b9bbd[_0xf03c('0x29')]);if(_0x5162a2[_0xf03c('0x2a')]>0x0){return _0x5d38b2[_0xf03c('0x17')](0x190)[_0xf03c('0x2b')](_0x5162a2);}var _0x1954d3=_0x4b9bbd[_0xf03c('0x29')][_0xf03c('0x2c')];var _0x3e143a=_0x4b9bbd[_0xf03c('0x29')][_0xf03c('0x23')];var _0x553abd=_0x4b9bbd[_0xf03c('0x29')]['transferNumber'];return getAgent(_0x1954d3)['then'](function(_0x478869){logger[_0xf03c('0x27')](_0xf03c('0x2e'),_0x478869[_0xf03c('0x15')]);emit(util[_0xf03c('0x2f')](_0xf03c('0x30'),_0x478869[_0xf03c('0x15')]),'webbar:transfer',{'sessionId':_0x3e143a,'transferNumber':_0x553abd});return _0x5d38b2[_0xf03c('0x17')](0xc8)['json']({'error':![],'message':_0xf03c('0x48')});})[_0xf03c('0x33')](handleError(_0x5d38b2));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7879981..6ed0974 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 _0xdae5=['show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','create','post','addDisposition','addApplications','notify','send','destroy','delete','removeAnswers','/:id/users','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4b043a,_0x268f80){var _0x2bc97a=function(_0x3e6d2a){while(--_0x3e6d2a){_0x4b043a['push'](_0x4b043a['shift']());}};_0x2bc97a(++_0x268f80);}(_0xdae5,0xf8));var _0x5dae=function(_0x19cdc8,_0x1ea53c){_0x19cdc8=_0x19cdc8-0x0;var _0x22fecc=_0xdae5[_0x19cdc8];return _0x22fecc;};'use strict';var multer=require(_0x5dae('0x0'));var util=require(_0x5dae('0x1'));var path=require(_0x5dae('0x2'));var timeout=require(_0x5dae('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5dae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5dae('0x5'));var controller=require(_0x5dae('0x6'));router[_0x5dae('0x7')]('/',auth[_0x5dae('0x8')](),controller[_0x5dae('0x9')]);router[_0x5dae('0x7')](_0x5dae('0xa'),auth[_0x5dae('0x8')](),controller[_0x5dae('0xb')]);router[_0x5dae('0x7')](_0x5dae('0xc'),auth[_0x5dae('0x8')](),controller[_0x5dae('0xd')]);router['get'](_0x5dae('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x5dae('0x7')](_0x5dae('0xf'),auth[_0x5dae('0x8')](),controller[_0x5dae('0x10')]);router[_0x5dae('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x5dae('0x7')](_0x5dae('0x11'),auth[_0x5dae('0x8')](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller[_0x5dae('0x12')]);router[_0x5dae('0x13')](_0x5dae('0xe'),auth[_0x5dae('0x8')](),controller[_0x5dae('0x14')]);router[_0x5dae('0x13')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x5dae('0x13')]('/:id/users',auth[_0x5dae('0x8')](),controller['addAgents']);router[_0x5dae('0x13')]('/:id/applications',auth[_0x5dae('0x8')](),controller[_0x5dae('0x15')]);router['post']('/:id/notify',controller[_0x5dae('0x16')]);router[_0x5dae('0x13')]('/:id/send',auth[_0x5dae('0x8')](),controller[_0x5dae('0x17')]);router['put'](_0x5dae('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5dae('0xc'),auth[_0x5dae('0x8')](),controller[_0x5dae('0x18')]);router['delete'](_0x5dae('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5dae('0x19')]('/:id/canned_answers',auth[_0x5dae('0x8')](),controller[_0x5dae('0x1a')]);router[_0x5dae('0x19')](_0x5dae('0x1b'),auth[_0x5dae('0x8')](),controller['removeAgents']);module[_0x5dae('0x1c')]=router; \ No newline at end of file +var _0xd713=['../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/notify','/:id/send','put','update','delete','destroy','removeAnswers','removeAgents','connect-timeout','express','../../components/auth/service'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd713,0xf5));var _0x3d71=function(_0x583517,_0x43f182){_0x583517=_0x583517-0x0;var _0x503f7b=_0xd713[_0x583517];return _0x503f7b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3d71('0x0'));var express=require(_0x3d71('0x1'));var router=express['Router']();var auth=require(_0x3d71('0x2'));var interaction=require(_0x3d71('0x3'));var config=require(_0x3d71('0x4'));var controller=require(_0x3d71('0x5'));router[_0x3d71('0x6')]('/',auth[_0x3d71('0x7')](),controller[_0x3d71('0x8')]);router[_0x3d71('0x6')](_0x3d71('0x9'),auth[_0x3d71('0x7')](),controller[_0x3d71('0xa')]);router[_0x3d71('0x6')](_0x3d71('0xb'),auth['isAuthenticated'](),controller[_0x3d71('0xc')]);router[_0x3d71('0x6')](_0x3d71('0xd'),auth['isAuthenticated'](),controller[_0x3d71('0xe')]);router[_0x3d71('0x6')](_0x3d71('0xf'),auth[_0x3d71('0x7')](),controller[_0x3d71('0x10')]);router['get'](_0x3d71('0x11'),auth[_0x3d71('0x7')](),controller['getAgents']);router['get'](_0x3d71('0x12'),auth[_0x3d71('0x7')](),controller[_0x3d71('0x13')]);router['post']('/',auth[_0x3d71('0x7')](),controller['create']);router[_0x3d71('0x14')](_0x3d71('0xd'),auth['isAuthenticated'](),controller[_0x3d71('0x15')]);router[_0x3d71('0x14')](_0x3d71('0xf'),auth[_0x3d71('0x7')](),controller[_0x3d71('0x16')]);router[_0x3d71('0x14')](_0x3d71('0x11'),auth[_0x3d71('0x7')](),controller['addAgents']);router['post'](_0x3d71('0x12'),auth['isAuthenticated'](),controller['addApplications']);router[_0x3d71('0x14')](_0x3d71('0x17'),controller['notify']);router['post'](_0x3d71('0x18'),auth['isAuthenticated'](),controller['send']);router[_0x3d71('0x19')](_0x3d71('0xb'),auth[_0x3d71('0x7')](),controller[_0x3d71('0x1a')]);router[_0x3d71('0x1b')](_0x3d71('0xb'),auth['isAuthenticated'](),controller[_0x3d71('0x1c')]);router[_0x3d71('0x1b')](_0x3d71('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x3d71('0xf'),auth[_0x3d71('0x7')](),controller[_0x3d71('0x1d')]);router['delete']('/:id/users',auth[_0x3d71('0x7')](),controller[_0x3d71('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 14a5335..91de111 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 _0x2520=['generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','STRING','name'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2520,0x175));var _0x0252=function(_0x1986b7,_0x2186bf){_0x1986b7=_0x1986b7-0x0;var _0x49d5d8=_0x2520[_0x1986b7];return _0x49d5d8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0252('0x0'));module[_0x0252('0x1')]={'name':{'type':Sequelize[_0x0252('0x2')],'unique':_0x0252('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0252('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0252('0x2')],'defaultValue':function(){return rs[_0x0252('0x4')]();}},'phone':{'type':Sequelize[_0x0252('0x2')]},'type':{'type':Sequelize[_0x0252('0x5')](_0x0252('0x6'))},'accountSid':{'type':Sequelize[_0x0252('0x2')]},'authToken':{'type':Sequelize[_0x0252('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0252('0x7')],'defaultValue':function(){return _0x0252('0x8');}},'notificationSound':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0252('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0252('0x9')],'defaultValue':![],'comment':_0x0252('0xb'),'set':function(_0x28467a){if(!_0x28467a){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x0252('0xc'),_0x28467a);}},'description':{'type':Sequelize[_0x0252('0x2')]}}; \ No newline at end of file +var _0x6961=['exports','STRING','name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x18b39e,_0x63c3e5){var _0x1f69ec=function(_0x36f809){while(--_0x36f809){_0x18b39e['push'](_0x18b39e['shift']());}};_0x1f69ec(++_0x63c3e5);}(_0x6961,0x1ce));var _0x1696=function(_0xd6a74,_0x3b878a){_0xd6a74=_0xd6a74-0x0;var _0x4ed128=_0x6961[_0xd6a74];return _0x4ed128;};'use strict';var Sequelize=require(_0x1696('0x0'));var rs=require(_0x1696('0x1'));module[_0x1696('0x2')]={'name':{'type':Sequelize[_0x1696('0x3')],'unique':_0x1696('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x1696('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x1696('0x3')],'defaultValue':function(){return rs[_0x1696('0x5')]();}},'phone':{'type':Sequelize[_0x1696('0x3')]},'type':{'type':Sequelize['ENUM'](_0x1696('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1696('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1696('0x7')],'defaultValue':function(){return _0x1696('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1696('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1696('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1696('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1696('0xa')],'comment':_0x1696('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x1696('0x9')],'defaultValue':![],'comment':_0x1696('0xc'),'set':function(_0x1735f4){if(!_0x1735f4){this['setDataValue'](_0x1696('0xd'),null);}this[_0x1696('0xe')](_0x1696('0xf'),_0x1735f4);}},'description':{'type':Sequelize[_0x1696('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8b72b9c..b399f7f 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 _0x5ec6=['destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','WhatsappAccountId','filter','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','account','orderBy','priority','asc','Applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','applications','push','*,*,*,*','WhatsappMessage','ContactId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource'];(function(_0xe3fdab,_0x1baca5){var _0x588894=function(_0x525c66){while(--_0x525c66){_0xe3fdab['push'](_0xe3fdab['shift']());}};_0x588894(++_0x1baca5);}(_0x5ec6,0x7f));var _0x65ec=function(_0x44424e,_0x2879a9){_0x44424e=_0x44424e-0x0;var _0x55842c=_0x5ec6[_0x44424e];return _0x55842c;};'use strict';var pdf=require(_0x65ec('0x0'));var emlformat=require(_0x65ec('0x1'));var rimraf=require(_0x65ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65ec('0x3'));var rp=require('request-promise');var moment=require(_0x65ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65ec('0x5'));var util=require('util');var path=require(_0x65ec('0x6'));var sox=require('sox');var csv=require(_0x65ec('0x7'));var ejs=require(_0x65ec('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0x7'));var querystring=require(_0x65ec('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xe'));var hardwareService=require(_0x65ec('0xf'));var logger=require('../../config/logger')(_0x65ec('0x10'));var utils=require(_0x65ec('0x11'));var config=require('../../config/environment');var db=require(_0x65ec('0x12'))['db'];config[_0x65ec('0x13')]=_['defaults'](config[_0x65ec('0x13')],{'host':_0x65ec('0x14'),'port':0x18eb});var socket=require(_0x65ec('0x15'))(new Redis(config[_0x65ec('0x13')]));require(_0x65ec('0x16'))[_0x65ec('0x17')](socket);var jayson=require(_0x65ec('0x18'));var client=jayson[_0x65ec('0x19')]['http']({'port':0x232c});function checkPasswordPattern(_0x28be8b,_0x3ed6f7,_0x35d06b){if(_0x35d06b){var _0x4bbe88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bbe88['test'](_0x3ed6f7)){return _0x28be8b;}else{throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x1c'));}}else{return _0x28be8b;}}function respondWithRpcPromise(_0x4f2c63,_0x25dae7,_0x286eac,_0x1254f8){return new BPromise(function(_0xb4ed90,_0x29ebc4){var _0xd81ed3=_0x1254f8||client;return _0xd81ed3[_0x65ec('0x1d')](_0x4f2c63,_0x286eac)[_0x65ec('0x1e')](function(_0x2127e2){logger[_0x65ec('0x1f')](_0x65ec('0x20'),_0x25dae7,_0x65ec('0x21'));logger[_0x65ec('0x22')](_0x65ec('0x23'),_0x25dae7,_0x65ec('0x21'),JSON[_0x65ec('0x24')](_0x2127e2));if(_0x2127e2[_0x65ec('0x25')]){if(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x26')]===0x1f4){logger['error'](_0x65ec('0x20'),_0x25dae7,_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);return _0x29ebc4(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);}logger[_0x65ec('0x25')](_0x65ec('0x20'),_0x25dae7,_0x2127e2['error'][_0x65ec('0x27')]);return _0xb4ed90(_0x2127e2[_0x65ec('0x25')][_0x65ec('0x27')]);}else{logger[_0x65ec('0x1f')](_0x65ec('0x20'),_0x25dae7,_0x65ec('0x21'));_0xb4ed90(_0x2127e2[_0x65ec('0x28')][_0x65ec('0x27')]);}})[_0x65ec('0x29')](function(_0x4c846b){logger[_0x65ec('0x25')](_0x65ec('0x20'),_0x25dae7,_0x4c846b);_0x29ebc4(_0x4c846b);});});}function respondWithStatusCode(_0x251831,_0x23b1a3){_0x23b1a3=_0x23b1a3||0xcc;return function(_0x4de451){if(_0x4de451){return _0x251831[_0x65ec('0x2a')](_0x23b1a3);}return _0x251831['status'](_0x23b1a3)[_0x65ec('0x2b')]();};}function respondWithResult(_0x1ada47,_0x1d0b5c){_0x1d0b5c=_0x1d0b5c||0xc8;return function(_0x30366c){if(_0x30366c){return _0x1ada47[_0x65ec('0x2c')](_0x1d0b5c)[_0x65ec('0x2d')](_0x30366c);}};}function respondWithFilteredResult(_0x46bf66,_0x39410f){return function(_0x984a82){if(_0x984a82){var _0xeec5d4=_0x984a82[_0x65ec('0x2e')],_0x3c97e2=_0x39410f['offset'],_0x4b435c=_0x39410f[_0x65ec('0x2f')]+_0x39410f[_0x65ec('0x30')],_0x50d81f;if(_0x4b435c>=_0xeec5d4){_0x4b435c=_0xeec5d4;_0x50d81f=0xc8;}else{_0x50d81f=0xce;}_0x46bf66['status'](_0x50d81f);return _0x46bf66[_0x65ec('0x31')](_0x65ec('0x32'),_0x3c97e2+'-'+_0x4b435c+'/'+_0xeec5d4)[_0x65ec('0x2d')](_0x984a82);}return null;};}function patchUpdates(_0x3c8dd7){return function(_0x491dc6){try{jsonpatch[_0x65ec('0x33')](_0x491dc6,_0x3c8dd7,!![]);}catch(_0x3b9dcb){return BPromise[_0x65ec('0x34')](_0x3b9dcb);}return _0x491dc6[_0x65ec('0x35')]();};}function saveUpdates(_0x3e4f4f,_0x3826fa){return function(_0x38dea3){if(_0x38dea3){return _0x38dea3[_0x65ec('0x36')](_0x3e4f4f)[_0x65ec('0x1e')](function(_0xff3f3c){return _0xff3f3c;});}return null;};}function removeEntity(_0x50db17,_0x6a5861){return function(_0x1e20c4){if(_0x1e20c4){return _0x1e20c4['destroy']()[_0x65ec('0x1e')](function(){var _0x24a242=_0x1e20c4[_0x65ec('0x37')]({'plain':!![]});var _0x2b8aca=_0x65ec('0x38');return db[_0x65ec('0x39')][_0x65ec('0x3a')]({'where':{'type':_0x2b8aca,'resourceId':_0x24a242['id']}})['then'](function(){return _0x1e20c4;});})[_0x65ec('0x1e')](function(){_0x50db17[_0x65ec('0x2c')](0xcc)[_0x65ec('0x2b')]();});}};}function handleEntityNotFound(_0x185447,_0x5028e3){return function(_0x5d8458){if(!_0x5d8458){_0x185447[_0x65ec('0x2a')](0x194);}return _0x5d8458;};}function handleError(_0x398edd,_0x940f13){_0x940f13=_0x940f13||0x1f4;return function(_0x55ac61){logger['error'](_0x55ac61[_0x65ec('0x3b')]);if(_0x55ac61['name']){delete _0x55ac61[_0x65ec('0x3c')];}_0x398edd[_0x65ec('0x2c')](_0x940f13)['send'](_0x55ac61);};}exports[_0x65ec('0x3d')]=function(_0x1fbc2b,_0x13aa56){var _0x5357bf={'include':[{'model':db[_0x65ec('0x3e')],'as':_0x65ec('0x3f')}]},_0x3cffbf={},_0x3b72cf={'count':0x0,'rows':[]};var _0x470bb3=_[_0x65ec('0x40')](db[_0x65ec('0x41')]['rawAttributes'],function(_0x28653a){return{'name':_0x28653a['fieldName'],'type':_0x28653a[_0x65ec('0x42')][_0x65ec('0x43')]};});_0x3cffbf[_0x65ec('0x44')]=_[_0x65ec('0x40')](_0x470bb3,_0x65ec('0x3c'));_0x3cffbf[_0x65ec('0x45')]=_['keys'](_0x1fbc2b[_0x65ec('0x45')]);_0x3cffbf['filters']=_['intersection'](_0x3cffbf[_0x65ec('0x44')],_0x3cffbf[_0x65ec('0x45')]);_0x5357bf[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x3cffbf[_0x65ec('0x44')],qs['fields'](_0x1fbc2b['query'][_0x65ec('0x48')]));_0x5357bf[_0x65ec('0x46')]=_0x5357bf[_0x65ec('0x46')][_0x65ec('0x49')]?_0x5357bf[_0x65ec('0x46')]:_0x3cffbf['model'];if(!_0x1fbc2b['query'][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x5357bf[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x30')]);_0x5357bf[_0x65ec('0x2f')]=qs['offset'](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x2f')]);}_0x5357bf[_0x65ec('0x4c')]=qs['sort'](_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x5357bf['where']=qs[_0x65ec('0x4e')](_[_0x65ec('0x4f')](_0x1fbc2b[_0x65ec('0x45')],_0x3cffbf[_0x65ec('0x4e')]),_0x470bb3);if(_0x1fbc2b[_0x65ec('0x45')]['filter']){_0x5357bf[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x5357bf[_0x65ec('0x50')],{'$or':_[_0x65ec('0x40')](_0x470bb3,function(_0x59c182){if(_0x59c182[_0x65ec('0x42')]!=='VIRTUAL'){var _0x1ed0f9={};_0x1ed0f9[_0x59c182[_0x65ec('0x3c')]]={'$like':'%'+_0x1fbc2b[_0x65ec('0x45')]['filter']+'%'};return _0x1ed0f9;}})});}_0x5357bf=_['merge']({},_0x5357bf,_0x1fbc2b[_0x65ec('0x52')]);var _0x45d2bc={'where':_0x5357bf[_0x65ec('0x50')]};return db[_0x65ec('0x41')][_0x65ec('0x2e')](_0x45d2bc)[_0x65ec('0x1e')](function(_0x1c546c){_0x3b72cf[_0x65ec('0x2e')]=_0x1c546c;if(_0x1fbc2b[_0x65ec('0x45')][_0x65ec('0x53')]){_0x5357bf[_0x65ec('0x54')]=[{'all':!![]}];}return db[_0x65ec('0x41')][_0x65ec('0x55')](_0x5357bf);})[_0x65ec('0x1e')](function(_0x11d2d6){_0x3b72cf[_0x65ec('0x56')]=_0x11d2d6;return _0x3b72cf;})[_0x65ec('0x1e')](respondWithFilteredResult(_0x13aa56,_0x5357bf))['catch'](handleError(_0x13aa56,null));};exports[_0x65ec('0x57')]=function(_0x2814f3,_0x4e0da8){var _0x3a474c={'raw':![],'where':{'id':_0x2814f3[_0x65ec('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x65ec('0x3f')}]},_0x7add40={};_0x7add40[_0x65ec('0x44')]=_[_0x65ec('0x59')](db['WhatsappAccount'][_0x65ec('0x5a')]);_0x7add40['query']=_['keys'](_0x2814f3[_0x65ec('0x45')]);_0x7add40[_0x65ec('0x4e')]=_[_0x65ec('0x47')](_0x7add40['model'],_0x7add40[_0x65ec('0x45')]);_0x3a474c[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x7add40[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x2814f3[_0x65ec('0x45')][_0x65ec('0x48')]));_0x3a474c[_0x65ec('0x46')]=_0x3a474c[_0x65ec('0x46')]['length']?_0x3a474c['attributes']:_0x7add40[_0x65ec('0x44')];if(_0x2814f3['query'][_0x65ec('0x53')]){_0x3a474c['include']=[{'all':!![]}];}_0x3a474c=_[_0x65ec('0x51')]({},_0x3a474c,_0x2814f3[_0x65ec('0x52')]);return db[_0x65ec('0x41')][_0x65ec('0x5b')](_0x3a474c)[_0x65ec('0x1e')](handleEntityNotFound(_0x4e0da8,null))[_0x65ec('0x1e')](respondWithResult(_0x4e0da8,null))[_0x65ec('0x29')](handleError(_0x4e0da8,null));};exports['create']=function(_0x2c7657,_0x474bc0){return db[_0x65ec('0x41')][_0x65ec('0x5c')](_0x2c7657[_0x65ec('0x5d')],{})['then'](function(_0x20f60f){var _0x318be3=_0x2c7657[_0x65ec('0x5e')][_0x65ec('0x37')]({'plain':!![]});if(!_0x318be3)throw new Error(_0x65ec('0x5f'));if(_0x318be3[_0x65ec('0x60')]===_0x65ec('0x5e')){var _0x2e81ea=_0x20f60f['get']({'plain':!![]});var _0x311e78=_0x65ec('0x38');return db[_0x65ec('0x61')][_0x65ec('0x5b')]({'where':{'name':_0x311e78,'userProfileId':_0x318be3[_0x65ec('0x62')]},'raw':!![]})[_0x65ec('0x1e')](function(_0x192055){if(_0x192055&&_0x192055['autoAssociation']===0x0){return db['UserProfileResource'][_0x65ec('0x5c')]({'name':_0x2e81ea['name'],'resourceId':_0x2e81ea['id'],'type':_0x192055[_0x65ec('0x3c')],'sectionId':_0x192055['id']},{})[_0x65ec('0x1e')](function(){return _0x20f60f;});}else{return _0x20f60f;}})['catch'](function(_0x1baa17){logger[_0x65ec('0x25')](_0x65ec('0x63'),_0x1baa17);throw _0x1baa17;});}return _0x20f60f;})[_0x65ec('0x1e')](respondWithResult(_0x474bc0,0xc9))[_0x65ec('0x29')](handleError(_0x474bc0,null));};exports[_0x65ec('0x36')]=function(_0x2279ff,_0x5df65c){if(_0x2279ff['body']['id']){delete _0x2279ff[_0x65ec('0x5d')]['id'];}return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2279ff['params']['id']},'include':[{'model':db[_0x65ec('0x3e')],'as':_0x65ec('0x3f')}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5df65c,null))[_0x65ec('0x1e')](saveUpdates(_0x2279ff[_0x65ec('0x5d')],null))[_0x65ec('0x1e')](respondWithResult(_0x5df65c,null))[_0x65ec('0x29')](handleError(_0x5df65c,null));};exports['destroy']=function(_0x464f67,_0x1e2731){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x464f67[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x1e2731,null))[_0x65ec('0x1e')](removeEntity(_0x1e2731,null))[_0x65ec('0x29')](handleError(_0x1e2731,null));};exports[_0x65ec('0x64')]=function(_0x584811,_0x59a690){return db[_0x65ec('0x41')]['describe']()['then'](respondWithResult(_0x59a690,null))[_0x65ec('0x29')](handleError(_0x59a690,null));};exports[_0x65ec('0x65')]=function(_0x39d0ce,_0x547057,_0x501775){if(_0x39d0ce[_0x65ec('0x5d')]['id']){delete _0x39d0ce['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x39d0ce[_0x65ec('0x58')]['id']}})['then'](handleEntityNotFound(_0x547057,null))[_0x65ec('0x1e')](function(_0x1e101c){if(_0x1e101c){_0x39d0ce[_0x65ec('0x5d')]['WhatsappAccountId']=_0x1e101c['id'];return db['Disposition'][_0x65ec('0x5c')](_0x39d0ce['body']);}})[_0x65ec('0x1e')](respondWithResult(_0x547057,null))[_0x65ec('0x29')](handleError(_0x547057,null));};exports[_0x65ec('0x66')]=function(_0x290c68,_0xc47b30,_0x2874ea){var _0xefa74d={'raw':![],'where':{}};var _0x572b15={};var _0x275a42={'count':0x0,'rows':[]};return db[_0x65ec('0x41')]['findOne']({'where':{'id':_0x290c68[_0x65ec('0x58')]['id']}})['then'](handleEntityNotFound(_0xc47b30,null))[_0x65ec('0x1e')](function(_0xf4dbce){if(_0xf4dbce){_0x572b15[_0x65ec('0x44')]=_[_0x65ec('0x59')](db['Disposition'][_0x65ec('0x5a')]);_0x572b15['query']=_[_0x65ec('0x59')](_0x290c68[_0x65ec('0x45')]);_0x572b15[_0x65ec('0x4e')]=_[_0x65ec('0x47')](_0x572b15['model'],_0x572b15['query']);_0xefa74d['attributes']=_[_0x65ec('0x47')](_0x572b15[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x48')]));_0xefa74d[_0x65ec('0x46')]=_0xefa74d[_0x65ec('0x46')][_0x65ec('0x49')]?_0xefa74d[_0x65ec('0x46')]:_0x572b15[_0x65ec('0x44')];if(!_0x290c68[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0xefa74d['limit']=qs[_0x65ec('0x30')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x30')]);_0xefa74d[_0x65ec('0x2f')]=qs[_0x65ec('0x2f')](_0x290c68[_0x65ec('0x45')][_0x65ec('0x2f')]);}_0xefa74d[_0x65ec('0x4c')]=qs[_0x65ec('0x4d')](_0x290c68[_0x65ec('0x45')]['sort']);_0xefa74d[_0x65ec('0x50')]=qs['filters'](_['pick'](_0x290c68[_0x65ec('0x45')],_0x572b15[_0x65ec('0x4e')]));_0xefa74d[_0x65ec('0x50')][_0x65ec('0x67')]=_0xf4dbce['id'];if(_0x290c68[_0x65ec('0x45')][_0x65ec('0x68')]){_0xefa74d[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0xefa74d['where'],{'$or':_[_0x65ec('0x40')](_0xefa74d['attributes'],function(_0x3850fd){var _0x1cad36={};_0x1cad36[_0x3850fd]={'$like':'%'+_0x290c68[_0x65ec('0x45')]['filter']+'%'};return _0x1cad36;})});}_0xefa74d=_[_0x65ec('0x51')]({},_0xefa74d,_0x290c68[_0x65ec('0x52')]);return db[_0x65ec('0x69')][_0x65ec('0x2e')]({'where':_0xefa74d[_0x65ec('0x50')]})[_0x65ec('0x1e')](function(_0x1172f3){_0x275a42['count']=_0x1172f3;if(_0x290c68[_0x65ec('0x45')][_0x65ec('0x53')]){_0xefa74d[_0x65ec('0x54')]=[{'all':!![]}];}return db[_0x65ec('0x69')]['findAll'](_0xefa74d);})['then'](function(_0x419e33){_0x275a42[_0x65ec('0x56')]=_0x419e33;return _0x275a42;});}})[_0x65ec('0x1e')](respondWithFilteredResult(_0xc47b30,_0xefa74d))[_0x65ec('0x29')](handleError(_0xc47b30,null));};exports[_0x65ec('0x6a')]=function(_0x277499,_0x5a171c,_0x3b0318){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x277499[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5a171c,null))[_0x65ec('0x1e')](function(_0x44b4e6){if(_0x44b4e6){return _0x44b4e6[_0x65ec('0x6a')](_0x277499['query'][_0x65ec('0x6b')]);}})[_0x65ec('0x1e')](respondWithStatusCode(_0x5a171c,null))['catch'](handleError(_0x5a171c,null));};exports[_0x65ec('0x6c')]=function(_0x2ca85,_0x28731c,_0x2606ea){if(_0x2ca85[_0x65ec('0x5d')]['id']){delete _0x2ca85[_0x65ec('0x5d')]['id'];}return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2ca85[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x28731c,null))['then'](function(_0x5030f6){if(_0x5030f6){_0x2ca85[_0x65ec('0x5d')][_0x65ec('0x67')]=_0x5030f6['id'];return db[_0x65ec('0x6d')]['create'](_0x2ca85[_0x65ec('0x5d')]);}})[_0x65ec('0x1e')](respondWithResult(_0x28731c,null))[_0x65ec('0x29')](handleError(_0x28731c,null));};exports[_0x65ec('0x6e')]=function(_0x3d79a8,_0x386eba,_0x1ff60f){var _0x3f9105={'raw':![],'where':{}};var _0x27d5d5={};var _0x4f5e10={'count':0x0,'rows':[]};return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x3d79a8[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x386eba,null))[_0x65ec('0x1e')](function(_0xba5894){if(_0xba5894){_0x27d5d5['model']=_[_0x65ec('0x59')](db[_0x65ec('0x6d')][_0x65ec('0x5a')]);_0x27d5d5[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x3d79a8['query']);_0x27d5d5['filters']=_[_0x65ec('0x47')](_0x27d5d5[_0x65ec('0x44')],_0x27d5d5[_0x65ec('0x45')]);_0x3f9105[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x27d5d5[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x48')]));_0x3f9105[_0x65ec('0x46')]=_0x3f9105[_0x65ec('0x46')]['length']?_0x3f9105[_0x65ec('0x46')]:_0x27d5d5['model'];if(!_0x3d79a8['query'][_0x65ec('0x4a')]('nolimit')){_0x3f9105[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x3d79a8['query']['limit']);_0x3f9105[_0x65ec('0x2f')]=qs[_0x65ec('0x2f')](_0x3d79a8['query'][_0x65ec('0x2f')]);}_0x3f9105[_0x65ec('0x4c')]=qs['sort'](_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x3f9105[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_['pick'](_0x3d79a8[_0x65ec('0x45')],_0x27d5d5[_0x65ec('0x4e')]));_0x3f9105['where'][_0x65ec('0x67')]=_0xba5894['id'];if(_0x3d79a8['query'][_0x65ec('0x68')]){_0x3f9105[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x3f9105['where'],{'$or':_['map'](_0x3f9105[_0x65ec('0x46')],function(_0x5b26b3){var _0x460044={};_0x460044[_0x5b26b3]={'$like':'%'+_0x3d79a8[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x460044;})});}_0x3f9105=_['merge']({},_0x3f9105,_0x3d79a8[_0x65ec('0x52')]);return db['CannedAnswer']['count']({'where':_0x3f9105[_0x65ec('0x50')]})['then'](function(_0x102e66){_0x4f5e10[_0x65ec('0x2e')]=_0x102e66;if(_0x3d79a8['query']['includeAll']){_0x3f9105['include']=[{'all':!![]}];}return db[_0x65ec('0x6d')][_0x65ec('0x55')](_0x3f9105);})[_0x65ec('0x1e')](function(_0x596f1c){_0x4f5e10['rows']=_0x596f1c;return _0x4f5e10;});}})['then'](respondWithFilteredResult(_0x386eba,_0x3f9105))[_0x65ec('0x29')](handleError(_0x386eba,null));};exports[_0x65ec('0x70')]=function(_0xc908a7,_0x1c8cd1,_0x1df337){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0xc908a7[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x1c8cd1,null))[_0x65ec('0x1e')](function(_0x309341){if(_0x309341){return _0x309341['removeAnswers'](_0xc908a7[_0x65ec('0x45')][_0x65ec('0x6b')]);}})[_0x65ec('0x1e')](respondWithStatusCode(_0x1c8cd1,null))[_0x65ec('0x29')](handleError(_0x1c8cd1,null));};exports[_0x65ec('0x71')]=function(_0x47cf0c,_0x5c6a76,_0x44d1a7){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x47cf0c['params']['id']}})['then'](handleEntityNotFound(_0x5c6a76,null))[_0x65ec('0x1e')](function(_0x3ccb0f){if(_0x3ccb0f){return _0x3ccb0f[_0x65ec('0x71')](_0x47cf0c[_0x65ec('0x5d')][_0x65ec('0x6b')],_[_0x65ec('0x72')](_0x47cf0c[_0x65ec('0x5d')],[_0x65ec('0x6b'),'id'])||{})['spread'](function(_0x6c71a){for(var _0x2d78f4=0x0;_0x2d78f4<_0x47cf0c[_0x65ec('0x5d')][_0x65ec('0x6b')][_0x65ec('0x49')];_0x2d78f4+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x47cf0c['body'][_0x65ec('0x6b')][_0x2d78f4],'WhatsappAccountId':_0x47cf0c[_0x65ec('0x58')]['id']});}return _0x6c71a;});}})[_0x65ec('0x1e')](respondWithResult(_0x5c6a76,null))[_0x65ec('0x29')](handleError(_0x5c6a76,null));};exports[_0x65ec('0x73')]=function(_0x2a065e,_0x5ef5b8,_0x20481e){return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x2a065e['params']['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ef5b8,null))[_0x65ec('0x1e')](function(_0x172697){if(_0x172697){return _0x172697[_0x65ec('0x73')](_0x2a065e['query'][_0x65ec('0x6b')])[_0x65ec('0x1e')](function(){if(_[_0x65ec('0x74')](_0x2a065e[_0x65ec('0x45')][_0x65ec('0x6b')])){for(var _0x11e8fe=0x0;_0x11e8fe<_0x2a065e['query'][_0x65ec('0x6b')][_0x65ec('0x49')];_0x11e8fe+=0x1){socket[_0x65ec('0x75')](_0x65ec('0x76'),{'UserId':Number(_0x2a065e[_0x65ec('0x45')][_0x65ec('0x6b')][_0x11e8fe]),'WhatsappAccountId':Number(_0x2a065e[_0x65ec('0x58')]['id'])});}}else{socket[_0x65ec('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x2a065e['query'][_0x65ec('0x6b')]),'WhatsappAccountId':Number(_0x2a065e[_0x65ec('0x58')]['id'])});}});}})[_0x65ec('0x1e')](respondWithStatusCode(_0x5ef5b8,null))['catch'](handleError(_0x5ef5b8,null));};exports[_0x65ec('0x77')]=function(_0x152af1,_0x41daf9,_0x50953a){var _0x437d98={};var _0x2e4efe={};var _0x49a6a2;var _0x4848cc;return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x152af1[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x41daf9,null))[_0x65ec('0x1e')](function(_0x4587ea){if(_0x4587ea){_0x49a6a2=_0x4587ea;_0x2e4efe[_0x65ec('0x44')]=_['keys'](db['User'][_0x65ec('0x5a')]);_0x2e4efe[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x152af1[_0x65ec('0x45')]);_0x2e4efe[_0x65ec('0x4e')]=_['intersection'](_0x2e4efe['model'],_0x2e4efe['query']);_0x437d98[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x2e4efe[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x152af1['query'][_0x65ec('0x48')]));_0x437d98[_0x65ec('0x46')]=_0x437d98[_0x65ec('0x46')][_0x65ec('0x49')]?_0x437d98[_0x65ec('0x46')]:_0x2e4efe[_0x65ec('0x44')];_0x437d98['order']=qs[_0x65ec('0x4d')](_0x152af1[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x437d98[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_[_0x65ec('0x4f')](_0x152af1[_0x65ec('0x45')],_0x2e4efe['filters']));if(_0x152af1[_0x65ec('0x45')][_0x65ec('0x68')]){_0x437d98[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x437d98[_0x65ec('0x50')],{'$or':_['map'](_0x437d98[_0x65ec('0x46')],function(_0x561a3d){var _0x36af99={};_0x36af99[_0x561a3d]={'$like':'%'+_0x152af1[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x36af99;})});}_0x437d98=_[_0x65ec('0x51')]({},_0x437d98,_0x152af1[_0x65ec('0x52')]);return _0x49a6a2['getAgents'](_0x437d98);}})[_0x65ec('0x1e')](function(_0x23878c){if(_0x23878c){_0x4848cc=_0x23878c[_0x65ec('0x49')];if(!_0x152af1[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x437d98[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x152af1['query'][_0x65ec('0x30')]);_0x437d98[_0x65ec('0x2f')]=qs['offset'](_0x152af1['query'][_0x65ec('0x2f')]);}return _0x49a6a2['getAgents'](_0x437d98);}})[_0x65ec('0x1e')](function(_0x23afc6){if(_0x23afc6){return _0x23afc6?{'count':_0x4848cc,'rows':_0x23afc6}:null;}})[_0x65ec('0x1e')](respondWithResult(_0x41daf9,null))['catch'](handleError(_0x41daf9,null));};exports[_0x65ec('0x78')]=function(_0x297db5,_0x4786be,_0x2203a6){return db[_0x65ec('0x41')][_0x65ec('0x6f')]({'where':{'id':_0x297db5[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x4786be,null))[_0x65ec('0x1e')](function(_0x586546){if(_0x586546){return db[_0x65ec('0x79')]['transaction'](function(_0x30c1d3){return db[_0x65ec('0x7a')][_0x65ec('0x3a')]({'where':{'WhatsappAccountId':_0x297db5['params']['id']},'transaction':_0x30c1d3})['then'](function(_0x361aa1){var _0x50407d=_['map'](_0x297db5['body'],function(_0x43c177){_0x43c177['WhatsappAccountId']=_0x297db5[_0x65ec('0x58')]['id'];return _0x43c177;});return db[_0x65ec('0x7a')][_0x65ec('0x7b')](_0x50407d,{'transaction':_0x30c1d3});});})[_0x65ec('0x1e')](function(){return db['WhatsappApplication'][_0x65ec('0x7c')]({'where':{'WhatsappAccountId':_0x297db5[_0x65ec('0x58')]['id']},'order':'priority'});});}})[_0x65ec('0x1e')](respondWithResult(_0x4786be,null))['catch'](handleError(_0x4786be,null));};exports[_0x65ec('0x7d')]=function(_0x3bb9df,_0x211085,_0xd1f1d1){var _0x2f3855={};var _0x39e285={};var _0x2f70c3;var _0x39ddfa;return db[_0x65ec('0x41')]['findOne']({'where':{'id':_0x3bb9df[_0x65ec('0x58')]['id']}})[_0x65ec('0x1e')](handleEntityNotFound(_0x211085,null))[_0x65ec('0x1e')](function(_0x7bfdae){if(_0x7bfdae){_0x2f70c3=_0x7bfdae;_0x39e285['model']=_[_0x65ec('0x59')](db[_0x65ec('0x7a')][_0x65ec('0x5a')]);_0x39e285[_0x65ec('0x45')]=_[_0x65ec('0x59')](_0x3bb9df[_0x65ec('0x45')]);_0x39e285[_0x65ec('0x4e')]=_['intersection'](_0x39e285['model'],_0x39e285[_0x65ec('0x45')]);_0x2f3855[_0x65ec('0x46')]=_[_0x65ec('0x47')](_0x39e285[_0x65ec('0x44')],qs[_0x65ec('0x48')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x48')]));_0x2f3855[_0x65ec('0x46')]=_0x2f3855[_0x65ec('0x46')]['length']?_0x2f3855[_0x65ec('0x46')]:_0x39e285[_0x65ec('0x44')];_0x2f3855[_0x65ec('0x4c')]=qs[_0x65ec('0x4d')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x4d')]);_0x2f3855[_0x65ec('0x50')]=qs[_0x65ec('0x4e')](_['pick'](_0x3bb9df[_0x65ec('0x45')],_0x39e285['filters']));if(_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x68')]){_0x2f3855[_0x65ec('0x50')]=_[_0x65ec('0x51')](_0x2f3855[_0x65ec('0x50')],{'$or':_[_0x65ec('0x40')](_0x2f3855[_0x65ec('0x46')],function(_0x1aa45c){var _0x133d19={};_0x133d19[_0x1aa45c]={'$like':'%'+_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x68')]+'%'};return _0x133d19;})});}_0x2f3855=_[_0x65ec('0x51')]({},_0x2f3855,_0x3bb9df[_0x65ec('0x52')]);return _0x2f70c3[_0x65ec('0x7d')](_0x2f3855);}})[_0x65ec('0x1e')](function(_0xed5827){if(_0xed5827){_0x39ddfa=_0xed5827[_0x65ec('0x49')];if(!_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x4a')](_0x65ec('0x4b'))){_0x2f3855[_0x65ec('0x30')]=qs[_0x65ec('0x30')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x30')]);_0x2f3855['offset']=qs[_0x65ec('0x2f')](_0x3bb9df[_0x65ec('0x45')][_0x65ec('0x2f')]);}return _0x2f70c3[_0x65ec('0x7d')](_0x2f3855);}})[_0x65ec('0x1e')](function(_0xc2ad21){if(_0xc2ad21){return _0xc2ad21?{'count':_0x39ddfa,'rows':_0xc2ad21}:null;}})['then'](respondWithResult(_0x211085,null))[_0x65ec('0x29')](handleError(_0x211085,null));};exports[_0x65ec('0x7e')]=function(_0x2577d2,_0x5cb76d,_0x1b2340){var _0x120933={'channel':_0x65ec('0x7f')};var _0x4e5a41=[];var _0x1cdddf=[];var _0x326cc7={};return db[_0x65ec('0x41')]['find']({'where':{'id':_0x2577d2[_0x65ec('0x58')]['id']},'include':[{'model':db[_0x65ec('0x7a')],'as':'Applications'}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x25ecfc){_0x120933[_0x65ec('0x80')]=_0x25ecfc;_0x120933['applications']=_[_0x65ec('0x81')](_0x25ecfc['Applications'],[_0x65ec('0x82')],[_0x65ec('0x83')]);if(_0x120933[_0x65ec('0x80')][_0x65ec('0x84')]){delete _0x120933[_0x65ec('0x80')]['Applications'];}return db[_0x65ec('0x85')][_0x65ec('0x64')]();})[_0x65ec('0x1e')](function(_0x2f60cb){if(!_0x2f60cb){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x86'));}_0x4e5a41=_[_0x65ec('0x87')](_[_0x65ec('0x59')](_0x2f60cb),[_0x65ec('0x88'),_0x65ec('0x89')]);_0x1cdddf=_[_0x65ec('0x87')](_[_0x65ec('0x59')](_0x2f60cb),[_0x65ec('0x88'),_0x65ec('0x89'),_0x65ec('0x8a'),'ListId']);_0x120933['body']={'mapKey':'mobile'};if(_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]&&_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]===_0x65ec('0x8b')){_0x120933['body'][_0x65ec('0x8c')]=_0x2577d2['body'][_0x65ec('0x8d')]['replace'](_0x65ec('0x8e'),'');_0x120933['body'][_0x65ec('0x5d')]=_0x2577d2['body'][_0x65ec('0x8f')];_0x120933['body'][_0x65ec('0x90')]=_0x2577d2[_0x65ec('0x5d')]['MessageSid'];}if(_0x120933[_0x65ec('0x5d')]['id']){delete _0x120933[_0x65ec('0x5d')]['id'];}if(_[_0x65ec('0x91')](_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x92'));}if(_[_0x65ec('0x91')](_0x120933['body'][_0x65ec('0x5d')])||_0x120933[_0x65ec('0x5d')]['body']===''){throw new db['Sequelize'][(_0x65ec('0x1b'))](_0x65ec('0x93'));}if(_[_0x65ec('0x91')](_0x120933[_0x65ec('0x5d')]['mapKey'])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x94')+_0x1cdddf);}if(!_[_0x65ec('0x95')](_0x1cdddf,_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0x97')+_0x1cdddf);}_0x326cc7[_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')]]=_0x120933['body'][_0x65ec('0x8c')];return db[_0x65ec('0x98')][_0x65ec('0x5b')]({'where':{'id':_0x120933[_0x65ec('0x80')][_0x65ec('0x99')]},'include':[{'model':db[_0x65ec('0x85')],'as':_0x65ec('0x9a'),'where':_0x326cc7,'limit':0x1,'order':[[_0x65ec('0x89'),_0x65ec('0x9b')]]}]});})[_0x65ec('0x1e')](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x18991a){if(_0x18991a){_0x120933[_0x65ec('0x9c')]=_[_0x65ec('0x72')](_0x18991a,['Contacts']);if(_0x18991a[_0x65ec('0x9a')][_0x65ec('0x49')]){return _0x18991a[_0x65ec('0x9a')][0x0];}var _0x36cbef=_['defaults'](_0x120933['body'],{'firstName':_0x120933['body']['from'],'ListId':_0x18991a['id']});_0x36cbef[_0x120933[_0x65ec('0x5d')][_0x65ec('0x96')]]=_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')];return db['CmContact'][_0x65ec('0x5c')](_0x36cbef,{'fields':_0x4e5a41,'raw':!![]});}})['then'](handleEntityNotFound(_0x5cb76d,null))[_0x65ec('0x1e')](function(_0x4c7cbb){if(_0x4c7cbb){_0x120933[_0x65ec('0x9d')]=_0x4c7cbb;var _0x4da116={'ContactId':_0x4c7cbb['id'],'phone':_0x120933['body']['from'],'WhatsappAccountId':_0x2577d2['params']['id']};var _0x58bf37={'ContactId':_0x4c7cbb['id'],'WhatsappAccountId':_0x2577d2['params']['id'],'closed':![]};return db[_0x65ec('0x9e')][_0x65ec('0x5b')]({'where':_0x58bf37})[_0x65ec('0x1e')](function(_0x569650){if(_0x569650){return[_0x569650,![]];}return db[_0x65ec('0x9e')][_0x65ec('0x5c')](_0x4da116)['then'](function(_0x285b77){return[_0x285b77,!![]];});});}})[_0x65ec('0x9f')](function(_0x56b3e4,_0x5a1b64){_0x120933[_0x65ec('0xa0')]=_0x56b3e4[_0x65ec('0x37')]({'plain':!![]});_0x120933[_0x65ec('0xa0')][_0x65ec('0xa1')]=![];if(_0x5a1b64){if(_0x120933[_0x65ec('0x80')]['autoclose']){_0x120933[_0x65ec('0xa2')][_0x65ec('0xa3')]({'id':0x0,'priority':_0x120933['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x65ec('0xa4')});}_0x120933[_0x65ec('0xa0')][_0x65ec('0xa1')]=!![];}return db[_0x65ec('0xa5')][_0x65ec('0x5c')]({'phone':_0x120933[_0x65ec('0x5d')][_0x65ec('0x8c')],'messageId':_0x120933[_0x65ec('0x5d')][_0x65ec('0x90')],'body':_0x120933[_0x65ec('0x5d')][_0x65ec('0x5d')],'WhatsappAccountId':_0x2577d2[_0x65ec('0x58')]['id'],'WhatsappInteractionId':_0x56b3e4['id'],'direction':'in','ContactId':_0x56b3e4[_0x65ec('0xa6')],'AttachmentId':_0x120933[_0x65ec('0x5d')]['AttachmentId']});})[_0x65ec('0x1e')](function(_0x1e3b53){_0x120933[_0x65ec('0x27')]=_0x1e3b53;if(_0x120933[_0x65ec('0xa0')]['UserId']){return db[_0x65ec('0xa7')][_0x65ec('0x5b')]({'attributes':['id','name'],'where':{'id':_0x120933['interaction']['UserId']}})[_0x65ec('0x1e')](function(_0x27c361){if(_0x27c361){_0x120933[_0x65ec('0xa2')][_0x65ec('0xa8')]({'id':0x0,'priority':0x0,'app':_0x65ec('0xa9'),'appdata':_0x27c361['name']+','+(_0x120933[_0x65ec('0x80')][_0x65ec('0xaa')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x65ec('0xab'),_0x65ec('0xac'),_0x120933);});}return respondWithRpcPromise(_0x65ec('0xab'),_0x65ec('0xac'),_0x120933);})['then'](function(_0x886c4e){if(_0x886c4e){var _0x235157=0xc8;var _0x1ba87c=_0x65ec('0xad');logger[_0x65ec('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1ba87c,_0x235157,_0x65ec('0xae'));logger['debug'](_0x65ec('0xaf'),_0x1ba87c,_0x235157,_0x65ec('0xae'),JSON[_0x65ec('0x24')](_0x886c4e));if(_0x120933[_0x65ec('0x80')][_0x65ec('0x42')]===_0x65ec('0x8b')){return _0x5cb76d[_0x65ec('0x2c')](_0x235157)[_0x65ec('0x31')](_0x65ec('0xb0'),'text/xml')[_0x65ec('0xb1')](_0x65ec('0xb2'));}else{return _0x5cb76d[_0x65ec('0x2c')](_0x235157)[_0x65ec('0x2d')](_0x886c4e);}}})[_0x65ec('0x29')](handleError(_0x5cb76d,null));};exports['send']=function(_0x36381a,_0x5ac2b0,_0x2fa462){var _0x22528e,_0x1929c7,_0x3af098;if(_[_0x65ec('0x91')](_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')])||_0x36381a['body'][_0x65ec('0x5d')]===''){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x65ec('0x91')](_0x36381a[_0x65ec('0x5d')]['to'])){throw new db[(_0x65ec('0x1a'))][(_0x65ec('0x1b'))](_0x65ec('0xb3'));}_0x22528e=_0x36381a['body']['to'];return db[_0x65ec('0x41')][_0x65ec('0x5b')]({'where':{'id':_0x36381a[_0x65ec('0x58')]['id']},'include':[{'model':db[_0x65ec('0x98')],'as':_0x65ec('0xb4'),'include':[{'model':db[_0x65ec('0x85')],'as':_0x65ec('0x9a'),'where':{'mobile':_0x22528e},'limit':0x1,'order':[[_0x65ec('0x89'),_0x65ec('0x9b')]]}]}]})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ac2b0,null))['then'](function(_0x4998a){if(_0x4998a&&_0x4998a[_0x65ec('0xb4')]){_0x1929c7=_0x4998a[_0x65ec('0x37')]({'plain':!![]});if(_0x1929c7[_0x65ec('0xb4')]&&_0x1929c7[_0x65ec('0xb4')][_0x65ec('0x9a')]['length']){return _0x1929c7[_0x65ec('0xb4')]['Contacts'][0x0];}return db[_0x65ec('0x85')][_0x65ec('0x5c')](_[_0x65ec('0xb5')](_0x36381a[_0x65ec('0x5d')],{'firstName':_0x22528e,'mobile':_0x22528e,'phone':_0x22528e,'ListId':_0x1929c7[_0x65ec('0x99')]}));}})[_0x65ec('0x1e')](handleEntityNotFound(_0x5ac2b0,null))[_0x65ec('0x1e')](function(_0x205916){if(_0x205916){_0x3af098=_0x205916;return db[_0x65ec('0x9e')][_0x65ec('0x5b')]({'where':{'ContactId':_0x3af098['id'],'closed':![],'WhatsappAccountId':_0x1929c7['id']}})['then'](function(_0x1cb25d){if(_0x1cb25d){return[_0x1cb25d,![]];}return db[_0x65ec('0x9e')][_0x65ec('0x5c')]({'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id'],'WhatsappAccountId':_0x1929c7['id'],'phone':_0x22528e,'firstMsgDirection':_0x65ec('0xb6'),'Messages':[_['merge'](_0x36381a[_0x65ec('0x5d')],{'read':![],'body':_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')],'phone':_0x22528e,'WhatsappAccountId':_0x1929c7['id'],'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id']})]},{'include':[{'model':db[_0x65ec('0xa5')],'as':_0x65ec('0xb7')}]})[_0x65ec('0x1e')](function(_0x422bd2){return[_0x422bd2,!![]];});});}})[_0x65ec('0x9f')](function(_0x506ccf,_0x16eded){if(_0x16eded){return _0x506ccf;}return db[_0x65ec('0xa5')]['create'](_[_0x65ec('0x51')](_0x36381a['body'],{'read':![],'body':_0x36381a[_0x65ec('0x5d')][_0x65ec('0x5d')],'phone':_0x22528e,'WhatsappAccountId':_0x1929c7['id'],'WhatsappInteractionId':_0x506ccf['id'],'UserId':_0x36381a[_0x65ec('0x5e')]['id'],'ContactId':_0x3af098['id']}))[_0x65ec('0x1e')](function(_0x566320){_0x506ccf[_0x65ec('0xb8')][_0x65ec('0xb7')]=[];_0x506ccf[_0x65ec('0xb8')][_0x65ec('0xb7')]['push'](_0x566320['dataValues']);return _0x506ccf;});})[_0x65ec('0x1e')](respondWithResult(_0x5ac2b0,null))['catch'](handleError(_0x5ac2b0,null));}; \ No newline at end of file +var _0x70e0=['startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','List','out','Messages','dataValues','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','http','test','Sequelize','ValidationError','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','keys','rawAttributes','fields','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','order','map','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','orderBy','asc','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','unshift','waitForTheAssignedAgent','Start'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x70e0,0x17b));var _0x070e=function(_0x575211,_0x3b9204){_0x575211=_0x575211-0x0;var _0x65d09a=_0x70e0[_0x575211];return _0x65d09a;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];config[_0x070e('0x16')]=_[_0x070e('0x17')](config[_0x070e('0x16')],{'host':_0x070e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x070e('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x14c3fd,_0x51d14d,_0x5d3a38){if(_0x5d3a38){var _0x373d86=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x373d86[_0x070e('0x1b')](_0x51d14d)){return _0x14c3fd;}else{throw new db[(_0x070e('0x1c'))][(_0x070e('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 _0x14c3fd;}}function respondWithRpcPromise(_0x49861b,_0x17e2e4,_0x2bd937,_0x38f6e6){return new BPromise(function(_0x2060cc,_0x364b3f){var _0x5037eb=_0x38f6e6||client;return _0x5037eb[_0x070e('0x1e')](_0x49861b,_0x2bd937)[_0x070e('0x1f')](function(_0x1ad3de){logger[_0x070e('0x20')](_0x070e('0x21'),_0x17e2e4,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x17e2e4,_0x070e('0x22'),JSON[_0x070e('0x23')](_0x1ad3de));if(_0x1ad3de[_0x070e('0x24')]){if(_0x1ad3de['error'][_0x070e('0x25')]===0x1f4){logger['error'](_0x070e('0x21'),_0x17e2e4,_0x1ad3de[_0x070e('0x24')][_0x070e('0x26')]);return _0x364b3f(_0x1ad3de[_0x070e('0x24')][_0x070e('0x26')]);}logger[_0x070e('0x24')](_0x070e('0x21'),_0x17e2e4,_0x1ad3de[_0x070e('0x24')]['message']);return _0x2060cc(_0x1ad3de[_0x070e('0x24')][_0x070e('0x26')]);}else{logger[_0x070e('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x17e2e4,_0x070e('0x22'));_0x2060cc(_0x1ad3de['result']['message']);}})[_0x070e('0x27')](function(_0x25f6e){logger[_0x070e('0x24')](_0x070e('0x21'),_0x17e2e4,_0x25f6e);_0x364b3f(_0x25f6e);});});}function respondWithStatusCode(_0x4763c6,_0x497f58){_0x497f58=_0x497f58||0xcc;return function(_0x374c54){if(_0x374c54){return _0x4763c6[_0x070e('0x28')](_0x497f58);}return _0x4763c6[_0x070e('0x29')](_0x497f58)[_0x070e('0x2a')]();};}function respondWithResult(_0x43dd96,_0x28d7f2){_0x28d7f2=_0x28d7f2||0xc8;return function(_0x1a1892){if(_0x1a1892){return _0x43dd96[_0x070e('0x29')](_0x28d7f2)['json'](_0x1a1892);}};}function respondWithFilteredResult(_0x282344,_0x351641){return function(_0x3a16d0){if(_0x3a16d0){var _0x56fc12=_0x3a16d0[_0x070e('0x2b')],_0x5c5f0d=_0x351641['offset'],_0x13097f=_0x351641[_0x070e('0x2c')]+_0x351641[_0x070e('0x2d')],_0x46065c;if(_0x13097f>=_0x56fc12){_0x13097f=_0x56fc12;_0x46065c=0xc8;}else{_0x46065c=0xce;}_0x282344[_0x070e('0x29')](_0x46065c);return _0x282344[_0x070e('0x2e')]('Content-Range',_0x5c5f0d+'-'+_0x13097f+'/'+_0x56fc12)['json'](_0x3a16d0);}return null;};}function patchUpdates(_0x523b75){return function(_0x59c5b4){try{jsonpatch[_0x070e('0x2f')](_0x59c5b4,_0x523b75,!![]);}catch(_0x4e0a7d){return BPromise[_0x070e('0x30')](_0x4e0a7d);}return _0x59c5b4[_0x070e('0x31')]();};}function saveUpdates(_0x4f8130,_0x47a739){return function(_0x699739){if(_0x699739){return _0x699739[_0x070e('0x32')](_0x4f8130)['then'](function(_0x546a16){return _0x546a16;});}return null;};}function removeEntity(_0x41ade4,_0x27dd1f){return function(_0x444d02){if(_0x444d02){return _0x444d02[_0x070e('0x33')]()[_0x070e('0x1f')](function(){var _0x5f530d=_0x444d02['get']({'plain':!![]});var _0x24d17d=_0x070e('0x34');return db[_0x070e('0x35')][_0x070e('0x33')]({'where':{'type':_0x24d17d,'resourceId':_0x5f530d['id']}})[_0x070e('0x1f')](function(){return _0x444d02;});})['then'](function(){_0x41ade4[_0x070e('0x29')](0xcc)[_0x070e('0x2a')]();});}};}function handleEntityNotFound(_0x534150,_0x2d6bb6){return function(_0x34746e){if(!_0x34746e){_0x534150['sendStatus'](0x194);}return _0x34746e;};}function handleError(_0x4d4ee8,_0x5ddbe9){_0x5ddbe9=_0x5ddbe9||0x1f4;return function(_0x363bff){logger[_0x070e('0x24')](_0x363bff[_0x070e('0x36')]);if(_0x363bff[_0x070e('0x37')]){delete _0x363bff[_0x070e('0x37')];}_0x4d4ee8['status'](_0x5ddbe9)[_0x070e('0x38')](_0x363bff);};}exports[_0x070e('0x39')]=function(_0xb53332,_0x487276){var _0x268c5d={'include':[{'model':db['Pause'],'as':_0x070e('0x3a')}]},_0x72cbc7={},_0x165c16={'count':0x0,'rows':[]};var _0x348092=_['map'](db[_0x070e('0x3b')]['rawAttributes'],function(_0x18dae9){return{'name':_0x18dae9[_0x070e('0x3c')],'type':_0x18dae9[_0x070e('0x3d')][_0x070e('0x3e')]};});_0x72cbc7[_0x070e('0x3f')]=_['map'](_0x348092,_0x070e('0x37'));_0x72cbc7['query']=_['keys'](_0xb53332[_0x070e('0x40')]);_0x72cbc7[_0x070e('0x41')]=_[_0x070e('0x42')](_0x72cbc7['model'],_0x72cbc7[_0x070e('0x40')]);_0x268c5d[_0x070e('0x43')]=_[_0x070e('0x42')](_0x72cbc7[_0x070e('0x3f')],qs['fields'](_0xb53332[_0x070e('0x40')]['fields']));_0x268c5d['attributes']=_0x268c5d['attributes'][_0x070e('0x44')]?_0x268c5d[_0x070e('0x43')]:_0x72cbc7[_0x070e('0x3f')];if(!_0xb53332[_0x070e('0x40')][_0x070e('0x45')]('nolimit')){_0x268c5d[_0x070e('0x2d')]=qs['limit'](_0xb53332[_0x070e('0x40')][_0x070e('0x2d')]);_0x268c5d[_0x070e('0x2c')]=qs['offset'](_0xb53332['query'][_0x070e('0x2c')]);}_0x268c5d['order']=qs[_0x070e('0x46')](_0xb53332[_0x070e('0x40')][_0x070e('0x46')]);_0x268c5d['where']=qs[_0x070e('0x41')](_[_0x070e('0x47')](_0xb53332['query'],_0x72cbc7['filters']),_0x348092);if(_0xb53332[_0x070e('0x40')][_0x070e('0x48')]){_0x268c5d[_0x070e('0x49')]=_[_0x070e('0x4a')](_0x268c5d[_0x070e('0x49')],{'$or':_['map'](_0x348092,function(_0x20b80e){if(_0x20b80e[_0x070e('0x3d')]!==_0x070e('0x4b')){var _0x391dee={};_0x391dee[_0x20b80e[_0x070e('0x37')]]={'$like':'%'+_0xb53332[_0x070e('0x40')][_0x070e('0x48')]+'%'};return _0x391dee;}})});}_0x268c5d=_[_0x070e('0x4a')]({},_0x268c5d,_0xb53332[_0x070e('0x4c')]);var _0x66a3f3={'where':_0x268c5d[_0x070e('0x49')]};return db[_0x070e('0x3b')][_0x070e('0x2b')](_0x66a3f3)[_0x070e('0x1f')](function(_0x402c82){_0x165c16['count']=_0x402c82;if(_0xb53332[_0x070e('0x40')][_0x070e('0x4d')]){_0x268c5d[_0x070e('0x4e')]=[{'all':!![]}];}return db[_0x070e('0x3b')][_0x070e('0x4f')](_0x268c5d);})[_0x070e('0x1f')](function(_0x3f0763){_0x165c16[_0x070e('0x50')]=_0x3f0763;return _0x165c16;})[_0x070e('0x1f')](respondWithFilteredResult(_0x487276,_0x268c5d))['catch'](handleError(_0x487276,null));};exports[_0x070e('0x51')]=function(_0x4c22da,_0x1acddb){var _0x2be643={'raw':![],'where':{'id':_0x4c22da[_0x070e('0x52')]['id']},'include':[{'model':db[_0x070e('0x53')],'as':_0x070e('0x3a')}]},_0x4abbe9={};_0x4abbe9[_0x070e('0x3f')]=_[_0x070e('0x54')](db[_0x070e('0x3b')][_0x070e('0x55')]);_0x4abbe9['query']=_[_0x070e('0x54')](_0x4c22da['query']);_0x4abbe9['filters']=_[_0x070e('0x42')](_0x4abbe9[_0x070e('0x3f')],_0x4abbe9[_0x070e('0x40')]);_0x2be643[_0x070e('0x43')]=_[_0x070e('0x42')](_0x4abbe9[_0x070e('0x3f')],qs[_0x070e('0x56')](_0x4c22da[_0x070e('0x40')]['fields']));_0x2be643[_0x070e('0x43')]=_0x2be643['attributes']['length']?_0x2be643[_0x070e('0x43')]:_0x4abbe9[_0x070e('0x3f')];if(_0x4c22da['query'][_0x070e('0x4d')]){_0x2be643[_0x070e('0x4e')]=[{'all':!![]}];}_0x2be643=_[_0x070e('0x4a')]({},_0x2be643,_0x4c22da[_0x070e('0x4c')]);return db[_0x070e('0x3b')][_0x070e('0x57')](_0x2be643)[_0x070e('0x1f')](handleEntityNotFound(_0x1acddb,null))['then'](respondWithResult(_0x1acddb,null))['catch'](handleError(_0x1acddb,null));};exports['create']=function(_0x3087e5,_0x1948a5){return db[_0x070e('0x3b')][_0x070e('0x58')](_0x3087e5['body'],{})[_0x070e('0x1f')](function(_0x5d3c3a){var _0x212710=_0x3087e5[_0x070e('0x59')][_0x070e('0x5a')]({'plain':!![]});if(!_0x212710)throw new Error(_0x070e('0x5b'));if(_0x212710[_0x070e('0x5c')]===_0x070e('0x59')){var _0x5561ed=_0x5d3c3a[_0x070e('0x5a')]({'plain':!![]});var _0x18e8d0=_0x070e('0x34');return db['UserProfileSection'][_0x070e('0x57')]({'where':{'name':_0x18e8d0,'userProfileId':_0x212710[_0x070e('0x5d')]},'raw':!![]})['then'](function(_0x1f1df5){if(_0x1f1df5&&_0x1f1df5['autoAssociation']===0x0){return db[_0x070e('0x35')]['create']({'name':_0x5561ed['name'],'resourceId':_0x5561ed['id'],'type':_0x1f1df5['name'],'sectionId':_0x1f1df5['id']},{})[_0x070e('0x1f')](function(){return _0x5d3c3a;});}else{return _0x5d3c3a;}})[_0x070e('0x27')](function(_0x1100d8){logger[_0x070e('0x24')](_0x070e('0x5e'),_0x1100d8);throw _0x1100d8;});}return _0x5d3c3a;})[_0x070e('0x1f')](respondWithResult(_0x1948a5,0xc9))['catch'](handleError(_0x1948a5,null));};exports[_0x070e('0x32')]=function(_0x54d4f9,_0xae78a4){if(_0x54d4f9['body']['id']){delete _0x54d4f9[_0x070e('0x5f')]['id'];}return db[_0x070e('0x3b')]['find']({'where':{'id':_0x54d4f9[_0x070e('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x070e('0x3a')}]})[_0x070e('0x1f')](handleEntityNotFound(_0xae78a4,null))[_0x070e('0x1f')](saveUpdates(_0x54d4f9[_0x070e('0x5f')],null))[_0x070e('0x1f')](respondWithResult(_0xae78a4,null))[_0x070e('0x27')](handleError(_0xae78a4,null));};exports[_0x070e('0x33')]=function(_0x148f1d,_0x3ef9cc){return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x148f1d[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x3ef9cc,null))[_0x070e('0x1f')](removeEntity(_0x3ef9cc,null))['catch'](handleError(_0x3ef9cc,null));};exports[_0x070e('0x60')]=function(_0x19d78c,_0x381c83){return db[_0x070e('0x3b')]['describe']()[_0x070e('0x1f')](respondWithResult(_0x381c83,null))[_0x070e('0x27')](handleError(_0x381c83,null));};exports[_0x070e('0x61')]=function(_0x5625a9,_0x2a7b5d,_0x12a58f){if(_0x5625a9['body']['id']){delete _0x5625a9[_0x070e('0x5f')]['id'];}return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x5625a9[_0x070e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2a7b5d,null))[_0x070e('0x1f')](function(_0x52804d){if(_0x52804d){_0x5625a9[_0x070e('0x5f')][_0x070e('0x62')]=_0x52804d['id'];return db[_0x070e('0x63')][_0x070e('0x58')](_0x5625a9[_0x070e('0x5f')]);}})['then'](respondWithResult(_0x2a7b5d,null))[_0x070e('0x27')](handleError(_0x2a7b5d,null));};exports[_0x070e('0x64')]=function(_0x8cc913,_0x114bcf,_0x5591dd){var _0x26b2c0={'raw':![],'where':{}};var _0x5cadcf={};var _0x399055={'count':0x0,'rows':[]};return db[_0x070e('0x3b')][_0x070e('0x65')]({'where':{'id':_0x8cc913['params']['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x114bcf,null))['then'](function(_0x1e6e6a){if(_0x1e6e6a){_0x5cadcf['model']=_[_0x070e('0x54')](db[_0x070e('0x63')]['rawAttributes']);_0x5cadcf[_0x070e('0x40')]=_['keys'](_0x8cc913[_0x070e('0x40')]);_0x5cadcf[_0x070e('0x41')]=_['intersection'](_0x5cadcf['model'],_0x5cadcf[_0x070e('0x40')]);_0x26b2c0[_0x070e('0x43')]=_[_0x070e('0x42')](_0x5cadcf[_0x070e('0x3f')],qs[_0x070e('0x56')](_0x8cc913[_0x070e('0x40')][_0x070e('0x56')]));_0x26b2c0[_0x070e('0x43')]=_0x26b2c0[_0x070e('0x43')][_0x070e('0x44')]?_0x26b2c0[_0x070e('0x43')]:_0x5cadcf[_0x070e('0x3f')];if(!_0x8cc913[_0x070e('0x40')]['hasOwnProperty'](_0x070e('0x66'))){_0x26b2c0[_0x070e('0x2d')]=qs['limit'](_0x8cc913['query'][_0x070e('0x2d')]);_0x26b2c0[_0x070e('0x2c')]=qs[_0x070e('0x2c')](_0x8cc913[_0x070e('0x40')][_0x070e('0x2c')]);}_0x26b2c0[_0x070e('0x67')]=qs[_0x070e('0x46')](_0x8cc913[_0x070e('0x40')][_0x070e('0x46')]);_0x26b2c0[_0x070e('0x49')]=qs[_0x070e('0x41')](_[_0x070e('0x47')](_0x8cc913[_0x070e('0x40')],_0x5cadcf['filters']));_0x26b2c0['where']['WhatsappAccountId']=_0x1e6e6a['id'];if(_0x8cc913[_0x070e('0x40')][_0x070e('0x48')]){_0x26b2c0[_0x070e('0x49')]=_[_0x070e('0x4a')](_0x26b2c0['where'],{'$or':_[_0x070e('0x68')](_0x26b2c0[_0x070e('0x43')],function(_0x416dde){var _0xd74f9c={};_0xd74f9c[_0x416dde]={'$like':'%'+_0x8cc913[_0x070e('0x40')][_0x070e('0x48')]+'%'};return _0xd74f9c;})});}_0x26b2c0=_['merge']({},_0x26b2c0,_0x8cc913[_0x070e('0x4c')]);return db['Disposition'][_0x070e('0x2b')]({'where':_0x26b2c0[_0x070e('0x49')]})[_0x070e('0x1f')](function(_0x3aa620){_0x399055[_0x070e('0x2b')]=_0x3aa620;if(_0x8cc913['query'][_0x070e('0x4d')]){_0x26b2c0[_0x070e('0x4e')]=[{'all':!![]}];}return db['Disposition'][_0x070e('0x4f')](_0x26b2c0);})[_0x070e('0x1f')](function(_0x553ea1){_0x399055[_0x070e('0x50')]=_0x553ea1;return _0x399055;});}})[_0x070e('0x1f')](respondWithFilteredResult(_0x114bcf,_0x26b2c0))[_0x070e('0x27')](handleError(_0x114bcf,null));};exports['removeDispositions']=function(_0x40d7e6,_0xe8c476,_0x134b72){return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x40d7e6[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0xe8c476,null))[_0x070e('0x1f')](function(_0x206b97){if(_0x206b97){return _0x206b97[_0x070e('0x69')](_0x40d7e6[_0x070e('0x40')][_0x070e('0x6a')]);}})[_0x070e('0x1f')](respondWithStatusCode(_0xe8c476,null))['catch'](handleError(_0xe8c476,null));};exports[_0x070e('0x6b')]=function(_0x2df184,_0x392c45,_0x1b71dd){if(_0x2df184[_0x070e('0x5f')]['id']){delete _0x2df184[_0x070e('0x5f')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2df184['params']['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x392c45,null))[_0x070e('0x1f')](function(_0x39cd65){if(_0x39cd65){_0x2df184[_0x070e('0x5f')]['WhatsappAccountId']=_0x39cd65['id'];return db[_0x070e('0x6c')][_0x070e('0x58')](_0x2df184[_0x070e('0x5f')]);}})['then'](respondWithResult(_0x392c45,null))[_0x070e('0x27')](handleError(_0x392c45,null));};exports['getAnswers']=function(_0x237e3b,_0x396902,_0x59e6e5){var _0x59fe3e={'raw':![],'where':{}};var _0x2048e9={};var _0x1fa499={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x070e('0x65')]({'where':{'id':_0x237e3b['params']['id']}})['then'](handleEntityNotFound(_0x396902,null))['then'](function(_0x15480c){if(_0x15480c){_0x2048e9[_0x070e('0x3f')]=_[_0x070e('0x54')](db[_0x070e('0x6c')][_0x070e('0x55')]);_0x2048e9[_0x070e('0x40')]=_[_0x070e('0x54')](_0x237e3b[_0x070e('0x40')]);_0x2048e9[_0x070e('0x41')]=_[_0x070e('0x42')](_0x2048e9[_0x070e('0x3f')],_0x2048e9[_0x070e('0x40')]);_0x59fe3e[_0x070e('0x43')]=_[_0x070e('0x42')](_0x2048e9[_0x070e('0x3f')],qs[_0x070e('0x56')](_0x237e3b[_0x070e('0x40')][_0x070e('0x56')]));_0x59fe3e[_0x070e('0x43')]=_0x59fe3e[_0x070e('0x43')][_0x070e('0x44')]?_0x59fe3e[_0x070e('0x43')]:_0x2048e9['model'];if(!_0x237e3b[_0x070e('0x40')][_0x070e('0x45')](_0x070e('0x66'))){_0x59fe3e[_0x070e('0x2d')]=qs['limit'](_0x237e3b[_0x070e('0x40')][_0x070e('0x2d')]);_0x59fe3e[_0x070e('0x2c')]=qs[_0x070e('0x2c')](_0x237e3b[_0x070e('0x40')][_0x070e('0x2c')]);}_0x59fe3e['order']=qs['sort'](_0x237e3b['query'][_0x070e('0x46')]);_0x59fe3e['where']=qs[_0x070e('0x41')](_[_0x070e('0x47')](_0x237e3b['query'],_0x2048e9[_0x070e('0x41')]));_0x59fe3e[_0x070e('0x49')]['WhatsappAccountId']=_0x15480c['id'];if(_0x237e3b['query'][_0x070e('0x48')]){_0x59fe3e[_0x070e('0x49')]=_[_0x070e('0x4a')](_0x59fe3e[_0x070e('0x49')],{'$or':_[_0x070e('0x68')](_0x59fe3e['attributes'],function(_0x3aba7a){var _0x56e3da={};_0x56e3da[_0x3aba7a]={'$like':'%'+_0x237e3b[_0x070e('0x40')][_0x070e('0x48')]+'%'};return _0x56e3da;})});}_0x59fe3e=_['merge']({},_0x59fe3e,_0x237e3b[_0x070e('0x4c')]);return db[_0x070e('0x6c')][_0x070e('0x2b')]({'where':_0x59fe3e[_0x070e('0x49')]})[_0x070e('0x1f')](function(_0x32b286){_0x1fa499['count']=_0x32b286;if(_0x237e3b[_0x070e('0x40')][_0x070e('0x4d')]){_0x59fe3e[_0x070e('0x4e')]=[{'all':!![]}];}return db[_0x070e('0x6c')][_0x070e('0x4f')](_0x59fe3e);})['then'](function(_0x2531f7){_0x1fa499[_0x070e('0x50')]=_0x2531f7;return _0x1fa499;});}})[_0x070e('0x1f')](respondWithFilteredResult(_0x396902,_0x59fe3e))[_0x070e('0x27')](handleError(_0x396902,null));};exports[_0x070e('0x6d')]=function(_0x31ceee,_0x248347,_0x4546eb){return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x31ceee[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x248347,null))[_0x070e('0x1f')](function(_0xf1edc1){if(_0xf1edc1){return _0xf1edc1[_0x070e('0x6d')](_0x31ceee[_0x070e('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x248347,null))[_0x070e('0x27')](handleError(_0x248347,null));};exports[_0x070e('0x6e')]=function(_0x4ceba3,_0x5d8c9f,_0x5d8f66){return db['WhatsappAccount'][_0x070e('0x57')]({'where':{'id':_0x4ceba3[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x5d8c9f,null))[_0x070e('0x1f')](function(_0x409811){if(_0x409811){return _0x409811[_0x070e('0x6e')](_0x4ceba3[_0x070e('0x5f')][_0x070e('0x6a')],_[_0x070e('0x6f')](_0x4ceba3[_0x070e('0x5f')],['ids','id'])||{})[_0x070e('0x70')](function(_0x36cfe2){for(var _0x49c66a=0x0;_0x49c66a<_0x4ceba3[_0x070e('0x5f')][_0x070e('0x6a')][_0x070e('0x44')];_0x49c66a+=0x1){socket[_0x070e('0x71')]('userWhatsappAccount:save',{'UserId':_0x4ceba3[_0x070e('0x5f')][_0x070e('0x6a')][_0x49c66a],'WhatsappAccountId':_0x4ceba3[_0x070e('0x52')]['id']});}return _0x36cfe2;});}})[_0x070e('0x1f')](respondWithResult(_0x5d8c9f,null))['catch'](handleError(_0x5d8c9f,null));};exports[_0x070e('0x72')]=function(_0x14a769,_0xfb9cec,_0xebbb53){return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x14a769[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0xfb9cec,null))[_0x070e('0x1f')](function(_0x1a41f2){if(_0x1a41f2){return _0x1a41f2[_0x070e('0x72')](_0x14a769['query'][_0x070e('0x6a')])[_0x070e('0x1f')](function(){if(_['isArray'](_0x14a769['query'][_0x070e('0x6a')])){for(var _0x53f6e7=0x0;_0x53f6e7<_0x14a769[_0x070e('0x40')][_0x070e('0x6a')][_0x070e('0x44')];_0x53f6e7+=0x1){socket[_0x070e('0x71')](_0x070e('0x73'),{'UserId':Number(_0x14a769[_0x070e('0x40')][_0x070e('0x6a')][_0x53f6e7]),'WhatsappAccountId':Number(_0x14a769['params']['id'])});}}else{socket[_0x070e('0x71')](_0x070e('0x73'),{'UserId':Number(_0x14a769[_0x070e('0x40')][_0x070e('0x6a')]),'WhatsappAccountId':Number(_0x14a769['params']['id'])});}});}})['then'](respondWithStatusCode(_0xfb9cec,null))[_0x070e('0x27')](handleError(_0xfb9cec,null));};exports[_0x070e('0x74')]=function(_0x2e92f0,_0x5b727f,_0x101bfc){var _0xf5b732={};var _0x4e795d={};var _0x2e9808;var _0x344289;return db[_0x070e('0x3b')][_0x070e('0x65')]({'where':{'id':_0x2e92f0[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x5b727f,null))['then'](function(_0x58c3d7){if(_0x58c3d7){_0x2e9808=_0x58c3d7;_0x4e795d[_0x070e('0x3f')]=_['keys'](db[_0x070e('0x75')][_0x070e('0x55')]);_0x4e795d['query']=_[_0x070e('0x54')](_0x2e92f0['query']);_0x4e795d[_0x070e('0x41')]=_[_0x070e('0x42')](_0x4e795d[_0x070e('0x3f')],_0x4e795d[_0x070e('0x40')]);_0xf5b732[_0x070e('0x43')]=_[_0x070e('0x42')](_0x4e795d['model'],qs[_0x070e('0x56')](_0x2e92f0[_0x070e('0x40')]['fields']));_0xf5b732['attributes']=_0xf5b732[_0x070e('0x43')][_0x070e('0x44')]?_0xf5b732[_0x070e('0x43')]:_0x4e795d[_0x070e('0x3f')];_0xf5b732[_0x070e('0x67')]=qs[_0x070e('0x46')](_0x2e92f0[_0x070e('0x40')][_0x070e('0x46')]);_0xf5b732['where']=qs[_0x070e('0x41')](_[_0x070e('0x47')](_0x2e92f0[_0x070e('0x40')],_0x4e795d[_0x070e('0x41')]));if(_0x2e92f0[_0x070e('0x40')][_0x070e('0x48')]){_0xf5b732[_0x070e('0x49')]=_[_0x070e('0x4a')](_0xf5b732['where'],{'$or':_[_0x070e('0x68')](_0xf5b732[_0x070e('0x43')],function(_0x40532a){var _0xbc61f2={};_0xbc61f2[_0x40532a]={'$like':'%'+_0x2e92f0[_0x070e('0x40')][_0x070e('0x48')]+'%'};return _0xbc61f2;})});}_0xf5b732=_[_0x070e('0x4a')]({},_0xf5b732,_0x2e92f0[_0x070e('0x4c')]);return _0x2e9808[_0x070e('0x74')](_0xf5b732);}})[_0x070e('0x1f')](function(_0x5b259e){if(_0x5b259e){_0x344289=_0x5b259e['length'];if(!_0x2e92f0[_0x070e('0x40')][_0x070e('0x45')](_0x070e('0x66'))){_0xf5b732['limit']=qs[_0x070e('0x2d')](_0x2e92f0[_0x070e('0x40')]['limit']);_0xf5b732[_0x070e('0x2c')]=qs[_0x070e('0x2c')](_0x2e92f0[_0x070e('0x40')][_0x070e('0x2c')]);}return _0x2e9808[_0x070e('0x74')](_0xf5b732);}})[_0x070e('0x1f')](function(_0x4cd349){if(_0x4cd349){return _0x4cd349?{'count':_0x344289,'rows':_0x4cd349}:null;}})['then'](respondWithResult(_0x5b727f,null))[_0x070e('0x27')](handleError(_0x5b727f,null));};exports[_0x070e('0x76')]=function(_0x532f83,_0x4055ba,_0x1ba1d3){return db[_0x070e('0x3b')][_0x070e('0x65')]({'where':{'id':_0x532f83[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x4055ba,null))['then'](function(_0xb7866f){if(_0xb7866f){return db[_0x070e('0x77')]['transaction'](function(_0x44ab7c){return db[_0x070e('0x78')][_0x070e('0x33')]({'where':{'WhatsappAccountId':_0x532f83[_0x070e('0x52')]['id']},'transaction':_0x44ab7c})['then'](function(_0x4c621a){var _0x2c2585=_[_0x070e('0x68')](_0x532f83[_0x070e('0x5f')],function(_0x326948){_0x326948[_0x070e('0x62')]=_0x532f83[_0x070e('0x52')]['id'];return _0x326948;});return db[_0x070e('0x78')][_0x070e('0x79')](_0x2c2585,{'transaction':_0x44ab7c});});})[_0x070e('0x1f')](function(){return db[_0x070e('0x78')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x532f83[_0x070e('0x52')]['id']},'order':_0x070e('0x7a')});});}})[_0x070e('0x1f')](respondWithResult(_0x4055ba,null))[_0x070e('0x27')](handleError(_0x4055ba,null));};exports['getApplications']=function(_0x8c79df,_0x35ddab,_0x510bce){var _0x4b559b={};var _0x27c346={};var _0x4684c7;var _0x1abf03;return db['WhatsappAccount'][_0x070e('0x65')]({'where':{'id':_0x8c79df[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x35ddab,null))[_0x070e('0x1f')](function(_0x34b5ae){if(_0x34b5ae){_0x4684c7=_0x34b5ae;_0x27c346['model']=_[_0x070e('0x54')](db[_0x070e('0x78')]['rawAttributes']);_0x27c346[_0x070e('0x40')]=_['keys'](_0x8c79df['query']);_0x27c346['filters']=_[_0x070e('0x42')](_0x27c346[_0x070e('0x3f')],_0x27c346[_0x070e('0x40')]);_0x4b559b[_0x070e('0x43')]=_['intersection'](_0x27c346[_0x070e('0x3f')],qs[_0x070e('0x56')](_0x8c79df['query'][_0x070e('0x56')]));_0x4b559b[_0x070e('0x43')]=_0x4b559b[_0x070e('0x43')][_0x070e('0x44')]?_0x4b559b[_0x070e('0x43')]:_0x27c346[_0x070e('0x3f')];_0x4b559b['order']=qs[_0x070e('0x46')](_0x8c79df['query'][_0x070e('0x46')]);_0x4b559b[_0x070e('0x49')]=qs[_0x070e('0x41')](_['pick'](_0x8c79df[_0x070e('0x40')],_0x27c346[_0x070e('0x41')]));if(_0x8c79df[_0x070e('0x40')]['filter']){_0x4b559b[_0x070e('0x49')]=_[_0x070e('0x4a')](_0x4b559b['where'],{'$or':_[_0x070e('0x68')](_0x4b559b[_0x070e('0x43')],function(_0x478e5b){var _0x56ec32={};_0x56ec32[_0x478e5b]={'$like':'%'+_0x8c79df['query']['filter']+'%'};return _0x56ec32;})});}_0x4b559b=_[_0x070e('0x4a')]({},_0x4b559b,_0x8c79df[_0x070e('0x4c')]);return _0x4684c7[_0x070e('0x7b')](_0x4b559b);}})[_0x070e('0x1f')](function(_0x1204d7){if(_0x1204d7){_0x1abf03=_0x1204d7[_0x070e('0x44')];if(!_0x8c79df[_0x070e('0x40')][_0x070e('0x45')]('nolimit')){_0x4b559b['limit']=qs['limit'](_0x8c79df['query'][_0x070e('0x2d')]);_0x4b559b[_0x070e('0x2c')]=qs[_0x070e('0x2c')](_0x8c79df[_0x070e('0x40')][_0x070e('0x2c')]);}return _0x4684c7['getApplications'](_0x4b559b);}})['then'](function(_0x1644c2){if(_0x1644c2){return _0x1644c2?{'count':_0x1abf03,'rows':_0x1644c2}:null;}})[_0x070e('0x1f')](respondWithResult(_0x35ddab,null))['catch'](handleError(_0x35ddab,null));};exports[_0x070e('0x7c')]=function(_0x46e19f,_0x239385,_0x75ea53){var _0x38b0e1={'channel':_0x070e('0x7d')};var _0x5e71ab=[];var _0x202ebf=[];var _0x1d48a9={};return db[_0x070e('0x3b')]['find']({'where':{'id':_0x46e19f[_0x070e('0x52')]['id']},'include':[{'model':db[_0x070e('0x78')],'as':_0x070e('0x7e')}]})[_0x070e('0x1f')](handleEntityNotFound(_0x239385,null))['then'](function(_0x4175b9){_0x38b0e1[_0x070e('0x7f')]=_0x4175b9;_0x38b0e1['applications']=_[_0x070e('0x80')](_0x4175b9[_0x070e('0x7e')],['priority'],[_0x070e('0x81')]);if(_0x38b0e1['account'][_0x070e('0x7e')]){delete _0x38b0e1['account'][_0x070e('0x7e')];}return db['CmContact']['describe']();})[_0x070e('0x1f')](function(_0x5df2fa){if(!_0x5df2fa){throw new db['Sequelize'][(_0x070e('0x1d'))](_0x070e('0x82'));}_0x5e71ab=_[_0x070e('0x83')](_[_0x070e('0x54')](_0x5df2fa),[_0x070e('0x84'),'updatedAt']);_0x202ebf=_[_0x070e('0x83')](_[_0x070e('0x54')](_0x5df2fa),[_0x070e('0x84'),_0x070e('0x85'),_0x070e('0x86'),_0x070e('0x87')]);_0x38b0e1['body']={'mapKey':_0x070e('0x88')};if(_0x38b0e1[_0x070e('0x7f')][_0x070e('0x3d')]&&_0x38b0e1[_0x070e('0x7f')]['type']==='twilio'){_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')]=_0x46e19f[_0x070e('0x5f')][_0x070e('0x8a')][_0x070e('0x8b')](_0x070e('0x8c'),'');_0x38b0e1['body'][_0x070e('0x5f')]=_0x46e19f[_0x070e('0x5f')][_0x070e('0x8d')];_0x38b0e1[_0x070e('0x5f')][_0x070e('0x8e')]=_0x46e19f[_0x070e('0x5f')]['MessageSid'];}if(_0x38b0e1['body']['id']){delete _0x38b0e1[_0x070e('0x5f')]['id'];}if(_[_0x070e('0x8f')](_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')])){throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))](_0x070e('0x90'));}if(_['isNil'](_0x38b0e1[_0x070e('0x5f')]['body'])||_0x38b0e1[_0x070e('0x5f')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x070e('0x91'));}if(_[_0x070e('0x8f')](_0x38b0e1[_0x070e('0x5f')][_0x070e('0x92')])){throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))](_0x070e('0x93')+_0x202ebf);}if(!_[_0x070e('0x94')](_0x202ebf,_0x38b0e1[_0x070e('0x5f')]['mapKey'])){throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))](_0x070e('0x95')+_0x202ebf);}_0x1d48a9[_0x38b0e1[_0x070e('0x5f')][_0x070e('0x92')]]=_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')];return db[_0x070e('0x96')][_0x070e('0x57')]({'where':{'id':_0x38b0e1['account']['ListId']},'include':[{'model':db[_0x070e('0x97')],'as':_0x070e('0x98'),'where':_0x1d48a9,'limit':0x1,'order':[['updatedAt',_0x070e('0x99')]]}]});})['then'](handleEntityNotFound(_0x239385,null))['then'](function(_0x3f2eb0){if(_0x3f2eb0){_0x38b0e1[_0x070e('0x9a')]=_['omit'](_0x3f2eb0,[_0x070e('0x98')]);if(_0x3f2eb0[_0x070e('0x98')][_0x070e('0x44')]){return _0x3f2eb0['Contacts'][0x0];}var _0x590326=_[_0x070e('0x17')](_0x38b0e1[_0x070e('0x5f')],{'firstName':_0x38b0e1[_0x070e('0x5f')]['from'],'ListId':_0x3f2eb0['id']});_0x590326[_0x38b0e1[_0x070e('0x5f')][_0x070e('0x92')]]=_0x38b0e1['body'][_0x070e('0x89')];return db[_0x070e('0x97')][_0x070e('0x58')](_0x590326,{'fields':_0x5e71ab,'raw':!![]});}})[_0x070e('0x1f')](handleEntityNotFound(_0x239385,null))[_0x070e('0x1f')](function(_0x92db3c){if(_0x92db3c){_0x38b0e1[_0x070e('0x9b')]=_0x92db3c;var _0x1cf02b={'ContactId':_0x92db3c['id'],'phone':_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')],'WhatsappAccountId':_0x46e19f[_0x070e('0x52')]['id']};var _0x2b45d5={'ContactId':_0x92db3c['id'],'WhatsappAccountId':_0x46e19f[_0x070e('0x52')]['id'],'closed':![]};return db[_0x070e('0x9c')][_0x070e('0x57')]({'where':_0x2b45d5})[_0x070e('0x1f')](function(_0x2948a2){if(_0x2948a2){return[_0x2948a2,![]];}return db['WhatsappInteraction']['create'](_0x1cf02b)['then'](function(_0x52b206){return[_0x52b206,!![]];});});}})[_0x070e('0x70')](function(_0x8e9f07,_0x19a31f){_0x38b0e1['interaction']=_0x8e9f07[_0x070e('0x5a')]({'plain':!![]});_0x38b0e1[_0x070e('0x9d')][_0x070e('0x9e')]=![];if(_0x19a31f){if(_0x38b0e1['account'][_0x070e('0x9f')]){_0x38b0e1[_0x070e('0xa0')][_0x070e('0xa1')]({'id':0x0,'priority':_0x38b0e1[_0x070e('0xa0')]['length']+0x1,'app':_0x070e('0xa2'),'appdata':_0x070e('0xa3'),'interval':_0x070e('0xa4')});}_0x38b0e1['interaction'][_0x070e('0x9e')]=!![];}return db[_0x070e('0xa5')][_0x070e('0x58')]({'phone':_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')],'messageId':_0x38b0e1[_0x070e('0x5f')][_0x070e('0x8e')],'body':_0x38b0e1[_0x070e('0x5f')][_0x070e('0x5f')],'WhatsappAccountId':_0x46e19f['params']['id'],'WhatsappInteractionId':_0x8e9f07['id'],'direction':'in','ContactId':_0x8e9f07['ContactId'],'AttachmentId':_0x38b0e1[_0x070e('0x5f')]['AttachmentId']});})['then'](function(_0x197c18){_0x38b0e1[_0x070e('0x26')]=_0x197c18;if(_0x38b0e1[_0x070e('0x9d')][_0x070e('0xa6')]){return db[_0x070e('0x75')][_0x070e('0x57')]({'attributes':['id','name'],'where':{'id':_0x38b0e1[_0x070e('0x9d')][_0x070e('0xa6')]}})[_0x070e('0x1f')](function(_0x351d73){if(_0x351d73){_0x38b0e1['applications'][_0x070e('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x351d73[_0x070e('0x37')]+','+(_0x38b0e1[_0x070e('0x7f')][_0x070e('0xa8')]||0xa),'interval':_0x070e('0xa4')});}return respondWithRpcPromise(_0x070e('0xa9'),_0x070e('0xaa'),_0x38b0e1);});}return respondWithRpcPromise(_0x070e('0xa9'),_0x070e('0xaa'),_0x38b0e1);})[_0x070e('0x1f')](function(_0x537d78){if(_0x537d78){var _0xc35037=0xc8;var _0x1f71df=_0x070e('0xab');logger[_0x070e('0x20')](_0x070e('0xac'),_0x1f71df,_0xc35037,_0x070e('0xad'));logger[_0x070e('0xae')](_0x070e('0xaf'),_0x1f71df,_0xc35037,'entity\x20found',JSON[_0x070e('0x23')](_0x537d78));if(_0x38b0e1[_0x070e('0x7f')]['type']==='twilio'){return _0x239385[_0x070e('0x29')](_0xc35037)[_0x070e('0x2e')](_0x070e('0xb0'),_0x070e('0xb1'))[_0x070e('0x38')](_0x070e('0xb2'));}else{return _0x239385['status'](_0xc35037)['json'](_0x537d78);}}})[_0x070e('0x27')](handleError(_0x239385,null));};exports[_0x070e('0x38')]=function(_0x5079d9,_0x31d3fa,_0x5aebee){var _0x17e949,_0xa2c957,_0x535518;if(_[_0x070e('0x8f')](_0x5079d9[_0x070e('0x5f')]['body'])||_0x5079d9['body'][_0x070e('0x5f')]===''){throw new db['Sequelize'][(_0x070e('0x1d'))](_0x070e('0x91'));}if(_[_0x070e('0x8f')](_0x5079d9['body']['to'])){throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))]('to\x20is\x20mandatory');}_0x17e949=_0x5079d9[_0x070e('0x5f')]['to'];return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x5079d9[_0x070e('0x52')]['id']},'include':[{'model':db[_0x070e('0x96')],'as':_0x070e('0xb3'),'include':[{'model':db[_0x070e('0x97')],'as':_0x070e('0x98'),'where':{'mobile':_0x17e949},'limit':0x1,'order':[[_0x070e('0x85'),_0x070e('0x99')]]}]}]})['then'](handleEntityNotFound(_0x31d3fa,null))[_0x070e('0x1f')](function(_0x11a111){if(_0x11a111&&_0x11a111[_0x070e('0xb3')]){_0xa2c957=_0x11a111['get']({'plain':!![]});if(_0xa2c957['List']&&_0xa2c957[_0x070e('0xb3')][_0x070e('0x98')][_0x070e('0x44')]){return _0xa2c957[_0x070e('0xb3')]['Contacts'][0x0];}return db[_0x070e('0x97')]['create'](_['defaults'](_0x5079d9[_0x070e('0x5f')],{'firstName':_0x17e949,'mobile':_0x17e949,'phone':_0x17e949,'ListId':_0xa2c957['ListId']}));}})[_0x070e('0x1f')](handleEntityNotFound(_0x31d3fa,null))[_0x070e('0x1f')](function(_0x1f4a5e){if(_0x1f4a5e){_0x535518=_0x1f4a5e;return db[_0x070e('0x9c')]['find']({'where':{'ContactId':_0x535518['id'],'closed':![],'WhatsappAccountId':_0xa2c957['id']}})[_0x070e('0x1f')](function(_0x532c79){if(_0x532c79){return[_0x532c79,![]];}return db[_0x070e('0x9c')][_0x070e('0x58')]({'UserId':_0x5079d9[_0x070e('0x59')]['id'],'ContactId':_0x535518['id'],'WhatsappAccountId':_0xa2c957['id'],'phone':_0x17e949,'firstMsgDirection':_0x070e('0xb4'),'Messages':[_[_0x070e('0x4a')](_0x5079d9[_0x070e('0x5f')],{'read':![],'body':_0x5079d9[_0x070e('0x5f')][_0x070e('0x5f')],'phone':_0x17e949,'WhatsappAccountId':_0xa2c957['id'],'UserId':_0x5079d9[_0x070e('0x59')]['id'],'ContactId':_0x535518['id']})]},{'include':[{'model':db[_0x070e('0xa5')],'as':_0x070e('0xb5')}]})[_0x070e('0x1f')](function(_0x1316d1){return[_0x1316d1,!![]];});});}})[_0x070e('0x70')](function(_0x9c7a91,_0x34e985){if(_0x34e985){return _0x9c7a91;}return db['WhatsappMessage']['create'](_[_0x070e('0x4a')](_0x5079d9[_0x070e('0x5f')],{'read':![],'body':_0x5079d9['body'][_0x070e('0x5f')],'phone':_0x17e949,'WhatsappAccountId':_0xa2c957['id'],'WhatsappInteractionId':_0x9c7a91['id'],'UserId':_0x5079d9[_0x070e('0x59')]['id'],'ContactId':_0x535518['id']}))['then'](function(_0x257a42){_0x9c7a91[_0x070e('0xb6')]['Messages']=[];_0x9c7a91[_0x070e('0xb6')][_0x070e('0xb5')][_0x070e('0xa1')](_0x257a42[_0x070e('0xb6')]);return _0x9c7a91;});})[_0x070e('0x1f')](respondWithResult(_0x31d3fa,null))[_0x070e('0x27')](handleError(_0x31d3fa,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3abfecc..f6e42d4 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 _0x9b0d=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x5dc54f,_0x43a500){_0x5dc54f=_0x5dc54f-0x0;var _0x170843=_0x9b0d[_0x5dc54f];return _0x170843;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xd9b0('0x0'))['db'][_0xd9b0('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd9b0('0x2')](0x0);var events={'afterCreate':_0xd9b0('0x3'),'afterUpdate':'update','afterDestroy':_0xd9b0('0x4')};function emitEvent(_0x32fa05){return function(_0x3168e3,_0xe33596,_0x4ae1d0){WhatsappAccountEvents[_0xd9b0('0x5')](_0x32fa05+':'+_0x3168e3['id'],_0x3168e3);WhatsappAccountEvents[_0xd9b0('0x5')](_0x32fa05,_0x3168e3);_0x4ae1d0(null);};}for(var e in events){if(events[_0xd9b0('0x6')](e)){var event=events[e];WhatsappAccount[_0xd9b0('0x7')](e,emitEvent(event));}}module[_0xd9b0('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x8ace=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x3e8bdd,_0x109e7c){var _0x514f2d=function(_0x42352d){while(--_0x42352d){_0x3e8bdd['push'](_0x3e8bdd['shift']());}};_0x514f2d(++_0x109e7c);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x3b8170,_0x3f8a3f){_0x3b8170=_0x3b8170-0x0;var _0xbd0a3b=_0x8ace[_0x3b8170];return _0xbd0a3b;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var WhatsappAccount=require(_0xe8ac('0x1'))['db'][_0xe8ac('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe8ac('0x3')](0x0);var events={'afterCreate':_0xe8ac('0x4'),'afterUpdate':_0xe8ac('0x5'),'afterDestroy':_0xe8ac('0x6')};function emitEvent(_0x274d7d){return function(_0x114351,_0xf6af00,_0x199794){WhatsappAccountEvents[_0xe8ac('0x7')](_0x274d7d+':'+_0x114351['id'],_0x114351);WhatsappAccountEvents[_0xe8ac('0x7')](_0x274d7d,_0x114351);_0x199794(null);};}for(var e in events){if(events[_0xe8ac('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xe8ac('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 0e247d1..6de5f2d 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 _0x543f=['define','whatsapp_accounts','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5b533e,_0x3ef7e4){var _0x3eeb3a=function(_0x3d7597){while(--_0x3d7597){_0x5b533e['push'](_0x5b533e['shift']());}};_0x3eeb3a(++_0x3ef7e4);}(_0x543f,0xe8));var _0xf543=function(_0x584b71,_0x4b8559){_0x584b71=_0x584b71-0x0;var _0x161e94=_0x543f[_0x584b71];return _0x161e94;};'use strict';var _=require(_0xf543('0x0'));var util=require('util');var logger=require(_0xf543('0x1'))(_0xf543('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf543('0x3'));var fs=require('fs');var path=require(_0xf543('0x4'));var rimraf=require(_0xf543('0x5'));var config=require(_0xf543('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xf543('0x7')]=function(_0x2139d5,_0x5640c8){return _0x2139d5[_0xf543('0x8')]('WhatsappAccount',attributes,{'tableName':_0xf543('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe58b=['define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x32af9d,_0x7bc19b){var _0x4279e1=function(_0x3a01ec){while(--_0x3a01ec){_0x32af9d['push'](_0x32af9d['shift']());}};_0x4279e1(++_0x7bc19b);}(_0xe58b,0x1e3));var _0xbe58=function(_0x1fff7d,_0xe8b9a){_0x1fff7d=_0x1fff7d-0x0;var _0x2996e0=_0xe58b[_0x1fff7d];return _0x2996e0;};'use strict';var _=require(_0xbe58('0x0'));var util=require(_0xbe58('0x1'));var logger=require(_0xbe58('0x2'))(_0xbe58('0x3'));var moment=require(_0xbe58('0x4'));var BPromise=require(_0xbe58('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe58('0x6'));var rimraf=require(_0xbe58('0x7'));var config=require(_0xbe58('0x8'));var attributes=require(_0xbe58('0x9'));module[_0xbe58('0xa')]=function(_0x29f976,_0x514fca){return _0x29f976[_0xbe58('0xb')]('WhatsappAccount',attributes,{'tableName':_0xbe58('0xc'),'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 20f64d5..b54323e 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 _0xaaff=['localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','include','model','attributes','map','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x592df5,_0x3e64e6){var _0x29f40e=function(_0x5ad3bf){while(--_0x5ad3bf){_0x592df5['push'](_0x592df5['shift']());}};_0x29f40e(++_0x3e64e6);}(_0xaaff,0xad));var _0xfaaf=function(_0x3b204d,_0x2868c6){_0x3b204d=_0x3b204d-0x0;var _0x31c4dd=_0xaaff[_0x3b204d];return _0x31c4dd;};'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});config[_0xfaaf('0xa')]=_[_0xfaaf('0xb')](config[_0xfaaf('0xa')],{'host':_0xfaaf('0xc'),'port':0x18eb});var socket=require(_0xfaaf('0xd'))(new Redis(config[_0xfaaf('0xa')]));require(_0xfaaf('0xe'))[_0xfaaf('0xf')](socket);function respondWithRpcPromise(_0x5dfb50,_0x54bf0a,_0x34b83c){return new BPromise(function(_0xc7d92e,_0x41950){return client[_0xfaaf('0x10')](_0x5dfb50,_0x34b83c)[_0xfaaf('0x11')](function(_0x84a596){logger[_0xfaaf('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x54bf0a,'request\x20sent');logger[_0xfaaf('0x13')](_0xfaaf('0x14'),_0x54bf0a,_0xfaaf('0x15'),JSON[_0xfaaf('0x16')](_0x84a596));if(_0x84a596['error']){if(_0x84a596[_0xfaaf('0x17')][_0xfaaf('0x18')]===0x1f4){logger[_0xfaaf('0x17')](_0xfaaf('0x19'),_0x54bf0a,_0x84a596[_0xfaaf('0x17')][_0xfaaf('0x1a')]);return _0x41950(_0x84a596['error'][_0xfaaf('0x1a')]);}logger[_0xfaaf('0x17')](_0xfaaf('0x19'),_0x54bf0a,_0x84a596[_0xfaaf('0x17')][_0xfaaf('0x1a')]);return _0xc7d92e(_0x84a596['error'][_0xfaaf('0x1a')]);}else{logger['info'](_0xfaaf('0x19'),_0x54bf0a,'request\x20sent');_0xc7d92e(_0x84a596['result'][_0xfaaf('0x1a')]);}})[_0xfaaf('0x1b')](function(_0x4b6dc2){logger['error'](_0xfaaf('0x19'),_0x54bf0a,_0x4b6dc2);_0x41950(_0x4b6dc2);});});}exports[_0xfaaf('0x1c')]=function(_0x47641a){var _0x24672e=this;return new Promise(function(_0x1ae346,_0x197691){return db[_0xfaaf('0x1d')][_0xfaaf('0x1e')]({'raw':_0x47641a[_0xfaaf('0x1f')]?_0x47641a['options'][_0xfaaf('0x20')]===undefined?!![]:![]:!![],'where':_0x47641a['options']?_0x47641a[_0xfaaf('0x1f')]['where']||null:null,'attributes':_0x47641a['options']?_0x47641a[_0xfaaf('0x1f')]['attributes']||null:null,'include':_0x47641a[_0xfaaf('0x1f')]?_0x47641a[_0xfaaf('0x1f')]['include']?_['map'](_0x47641a[_0xfaaf('0x1f')][_0xfaaf('0x21')],function(_0x9ba174){return{'model':db[_0x9ba174[_0xfaaf('0x22')]],'as':_0x9ba174['as'],'attributes':_0x9ba174[_0xfaaf('0x23')],'include':_0x9ba174[_0xfaaf('0x21')]?_[_0xfaaf('0x24')](_0x9ba174['include'],function(_0x3d7c49){return{'model':db[_0x3d7c49[_0xfaaf('0x22')]],'as':_0x3d7c49['as'],'attributes':_0x3d7c49['attributes'],'include':_0x3d7c49[_0xfaaf('0x21')]?_[_0xfaaf('0x24')](_0x3d7c49[_0xfaaf('0x21')],function(_0x4bb847){return{'model':db[_0x4bb847[_0xfaaf('0x22')]],'as':_0x4bb847['as'],'attributes':_0x4bb847[_0xfaaf('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfaaf('0x11')](function(_0x3999c6){logger['info'](_0xfaaf('0x1c'),_0x47641a);logger[_0xfaaf('0x13')]('ShowWhatsappAccount',_0x47641a,JSON['stringify'](_0x3999c6));_0x1ae346(_0x3999c6);})[_0xfaaf('0x1b')](function(_0x5b65e6){logger[_0xfaaf('0x17')](_0xfaaf('0x1c'),_0x5b65e6[_0xfaaf('0x1a')],_0x47641a);_0x197691(_0x24672e[_0xfaaf('0x17')](0x1f4,_0x5b65e6[_0xfaaf('0x1a')]));});});}; \ No newline at end of file +var _0x418f=['catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','result'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x418f,0xdf));var _0xf418=function(_0x5bc3fc,_0x54db61){_0x5bc3fc=_0x5bc3fc-0x0;var _0x1253d0=_0x418f[_0x5bc3fc];return _0x1253d0;};'use strict';var _=require(_0xf418('0x0'));var util=require(_0xf418('0x1'));var moment=require(_0xf418('0x2'));var BPromise=require(_0xf418('0x3'));var rs=require(_0xf418('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf418('0x5'))['db'];var utils=require(_0xf418('0x6'));var logger=require(_0xf418('0x7'))(_0xf418('0x8'));var config=require('../../config/environment');var jayson=require(_0xf418('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xf418('0xa')],{'host':_0xf418('0xb'),'port':0x18eb});var socket=require(_0xf418('0xc'))(new Redis(config[_0xf418('0xa')]));require(_0xf418('0xd'))['register'](socket);function respondWithRpcPromise(_0x30f49b,_0x2c455d,_0x2efb5d){return new BPromise(function(_0x1503bc,_0x2293a2){return client[_0xf418('0xe')](_0x30f49b,_0x2efb5d)['then'](function(_0x45d2f3){logger[_0xf418('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x2c455d,_0xf418('0x10'));logger['debug'](_0xf418('0x11'),_0x2c455d,'request\x20sent',JSON['stringify'](_0x45d2f3));if(_0x45d2f3[_0xf418('0x12')]){if(_0x45d2f3[_0xf418('0x12')]['code']===0x1f4){logger[_0xf418('0x12')](_0xf418('0x13'),_0x2c455d,_0x45d2f3[_0xf418('0x12')][_0xf418('0x14')]);return _0x2293a2(_0x45d2f3[_0xf418('0x12')]['message']);}logger[_0xf418('0x12')](_0xf418('0x13'),_0x2c455d,_0x45d2f3['error'][_0xf418('0x14')]);return _0x1503bc(_0x45d2f3[_0xf418('0x12')][_0xf418('0x14')]);}else{logger['info'](_0xf418('0x13'),_0x2c455d,_0xf418('0x10'));_0x1503bc(_0x45d2f3[_0xf418('0x15')][_0xf418('0x14')]);}})[_0xf418('0x16')](function(_0x1a1f0c){logger[_0xf418('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x2c455d,_0x1a1f0c);_0x2293a2(_0x1a1f0c);});});}exports[_0xf418('0x17')]=function(_0x3ab008){var _0x57955b=this;return new Promise(function(_0x129ad7,_0xb7c2ee){return db[_0xf418('0x18')][_0xf418('0x19')]({'raw':_0x3ab008['options']?_0x3ab008['options'][_0xf418('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ab008['options']?_0x3ab008[_0xf418('0x1b')][_0xf418('0x1c')]||null:null,'attributes':_0x3ab008['options']?_0x3ab008[_0xf418('0x1b')][_0xf418('0x1d')]||null:null,'include':_0x3ab008['options']?_0x3ab008['options'][_0xf418('0x1e')]?_[_0xf418('0x1f')](_0x3ab008[_0xf418('0x1b')][_0xf418('0x1e')],function(_0x506295){return{'model':db[_0x506295[_0xf418('0x20')]],'as':_0x506295['as'],'attributes':_0x506295[_0xf418('0x1d')],'include':_0x506295['include']?_[_0xf418('0x1f')](_0x506295[_0xf418('0x1e')],function(_0x5b98ea){return{'model':db[_0x5b98ea[_0xf418('0x20')]],'as':_0x5b98ea['as'],'attributes':_0x5b98ea['attributes'],'include':_0x5b98ea[_0xf418('0x1e')]?_['map'](_0x5b98ea['include'],function(_0x1aa139){return{'model':db[_0x1aa139[_0xf418('0x20')]],'as':_0x1aa139['as'],'attributes':_0x1aa139[_0xf418('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11480c){logger[_0xf418('0xf')](_0xf418('0x17'),_0x3ab008);logger[_0xf418('0x21')]('ShowWhatsappAccount',_0x3ab008,JSON[_0xf418('0x22')](_0x11480c));_0x129ad7(_0x11480c);})['catch'](function(_0x2df419){logger[_0xf418('0x12')]('ShowWhatsappAccount',_0x2df419[_0xf418('0x14')],_0x3ab008);_0xb7c2ee(_0x57955b[_0xf418('0x12')](0x1f4,_0x2df419[_0xf418('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3070bf4..830d26c 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 _0x87cd=['save','update','emit','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x1b4ed7,_0x5faf41){var _0x271110=function(_0x10b24a){while(--_0x10b24a){_0x1b4ed7['push'](_0x1b4ed7['shift']());}};_0x271110(++_0x5faf41);}(_0x87cd,0xf5));var _0xd87c=function(_0x5b98bd,_0x1461c9){_0x5b98bd=_0x5b98bd-0x0;var _0x5147be=_0x87cd[_0x5b98bd];return _0x5147be;};'use strict';var WhatsappAccountEvents=require(_0xd87c('0x0'));var events=[_0xd87c('0x1'),'remove',_0xd87c('0x2')];function createListener(_0x2c88e2,_0x136a52){return function(_0x539382){_0x136a52[_0xd87c('0x3')](_0x2c88e2,_0x539382);};}function removeListener(_0x177c84,_0x2627c1){return function(){WhatsappAccountEvents['removeListener'](_0x177c84,_0x2627c1);};}exports['register']=function(_0x566e38){for(var _0x3ef959=0x0,_0x8218aa=events[_0xd87c('0x4')];_0x3ef959<_0x8218aa;_0x3ef959++){var _0x1aae2d=events[_0x3ef959];var _0x36eb4d=createListener(_0xd87c('0x5')+_0x1aae2d,_0x566e38);WhatsappAccountEvents['on'](_0x1aae2d,_0x36eb4d);}}; \ No newline at end of file +var _0x89e5=['whatsappAccount:','./whatsappAccount.events','update','emit','register'];(function(_0x4490a4,_0x2d4239){var _0x8747=function(_0x571938){while(--_0x571938){_0x4490a4['push'](_0x4490a4['shift']());}};_0x8747(++_0x2d4239);}(_0x89e5,0xbf));var _0x589e=function(_0x505cc8,_0x2ec31e){_0x505cc8=_0x505cc8-0x0;var _0x27e703=_0x89e5[_0x505cc8];return _0x27e703;};'use strict';var WhatsappAccountEvents=require(_0x589e('0x0'));var events=['save','remove',_0x589e('0x1')];function createListener(_0x6aa6c5,_0x2d9fbe){return function(_0x416f67){_0x2d9fbe[_0x589e('0x2')](_0x6aa6c5,_0x416f67);};}function removeListener(_0x2b62f0,_0x24bddc){return function(){WhatsappAccountEvents['removeListener'](_0x2b62f0,_0x24bddc);};}exports[_0x589e('0x3')]=function(_0x116555){for(var _0x602b8e=0x0,_0x230cbe=events['length'];_0x602b8e<_0x230cbe;_0x602b8e++){var _0x34f78c=events[_0x602b8e];var _0x3727d7=createListener(_0x589e('0x4')+_0x34f78c,_0x116555);WhatsappAccountEvents['on'](_0x34f78c,_0x3727d7);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index a657b1a..9d93a2f 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 _0x45e3=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4b3f3e,_0x47dfcc){var _0x921fc3=function(_0x3e4b3b){while(--_0x3e4b3b){_0x4b3f3e['push'](_0x4b3f3e['shift']());}};_0x921fc3(++_0x47dfcc);}(_0x45e3,0x1e9));var _0x345e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x45e3[_0x3054be];return _0x3df150;};'use strict';var multer=require('multer');var util=require(_0x345e('0x0'));var path=require(_0x345e('0x1'));var timeout=require(_0x345e('0x2'));var express=require('express');var router=express[_0x345e('0x3')]();var auth=require(_0x345e('0x4'));var interaction=require(_0x345e('0x5'));var config=require(_0x345e('0x6'));var controller=require(_0x345e('0x7'));router[_0x345e('0x8')]('/',auth[_0x345e('0x9')](),controller[_0x345e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x345e('0xb')]('/',auth[_0x345e('0x9')](),controller[_0x345e('0xc')]);router[_0x345e('0xd')](_0x345e('0xe'),auth[_0x345e('0x9')](),controller[_0x345e('0xf')]);router[_0x345e('0x10')](_0x345e('0xe'),auth[_0x345e('0x9')](),controller[_0x345e('0x11')]);module[_0x345e('0x12')]=router; \ No newline at end of file +var _0xb1d9=['../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5e38cb,_0x56aa5a){var _0xd85952=function(_0x28810d){while(--_0x28810d){_0x5e38cb['push'](_0x5e38cb['shift']());}};_0xd85952(++_0x56aa5a);}(_0xb1d9,0x66));var _0x9b1d=function(_0x4b82ec,_0x2e9bb6){_0x4b82ec=_0x4b82ec-0x0;var _0x598eaf=_0xb1d9[_0x4b82ec];return _0x598eaf;};'use strict';var multer=require(_0x9b1d('0x0'));var util=require(_0x9b1d('0x1'));var path=require(_0x9b1d('0x2'));var timeout=require(_0x9b1d('0x3'));var express=require(_0x9b1d('0x4'));var router=express[_0x9b1d('0x5')]();var auth=require(_0x9b1d('0x6'));var interaction=require(_0x9b1d('0x7'));var config=require('../../config/environment');var controller=require(_0x9b1d('0x8'));router[_0x9b1d('0x9')]('/',auth[_0x9b1d('0xa')](),controller[_0x9b1d('0xb')]);router['get'](_0x9b1d('0xc'),auth[_0x9b1d('0xa')](),controller[_0x9b1d('0xd')]);router[_0x9b1d('0xe')]('/',auth['isAuthenticated'](),controller[_0x9b1d('0xf')]);router['put'](_0x9b1d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9b1d('0x10')](_0x9b1d('0xc'),auth[_0x9b1d('0xa')](),controller[_0x9b1d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index a4a31bb..c148cb0 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 _0x259d=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x2d5dcf,_0xf71498){var _0x42a3e8=function(_0xaa41d8){while(--_0xaa41d8){_0x2d5dcf['push'](_0x2d5dcf['shift']());}};_0x42a3e8(++_0xf71498);}(_0x259d,0x1e3));var _0xd259=function(_0x5d812b,_0xa39fa9){_0x5d812b=_0x5d812b-0x0;var _0x365fb6=_0x259d[_0x5d812b];return _0x365fb6;};'use strict';var Sequelize=require('sequelize');module[_0xd259('0x0')]={'priority':{'type':Sequelize[_0xd259('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd259('0x2')],'allowNull':![],'defaultValue':_0xd259('0x3')},'appdata':{'type':Sequelize[_0xd259('0x4')]()},'description':{'type':Sequelize[_0xd259('0x2')]},'interval':{'type':Sequelize[_0xd259('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf851=['noop','STRING','sequelize','INTEGER'];(function(_0x50c5dc,_0x2228fd){var _0xfb1827=function(_0x57e52f){while(--_0x57e52f){_0x50c5dc['push'](_0x50c5dc['shift']());}};_0xfb1827(++_0x2228fd);}(_0xf851,0xaa));var _0x1f85=function(_0x511933,_0x1d9966){_0x511933=_0x511933-0x0;var _0x3e063d=_0xf851[_0x511933];return _0x3e063d;};'use strict';var Sequelize=require(_0x1f85('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1f85('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1f85('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1f85('0x3')]},'interval':{'type':Sequelize[_0x1f85('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 8dfa8f6..5ebfc17 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 _0x5327=['fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','rows','catch','show','keys','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x57ea70,_0x5af725){var _0x558a2a=function(_0x3ec44f){while(--_0x3ec44f){_0x57ea70['push'](_0x57ea70['shift']());}};_0x558a2a(++_0x5af725);}(_0x5327,0xa7));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7532('0x0'));var emlformat=require(_0x7532('0x1'));var rimraf=require(_0x7532('0x2'));var zipdir=require(_0x7532('0x3'));var jsonpatch=require(_0x7532('0x4'));var rp=require('request-promise');var moment=require(_0x7532('0x5'));var BPromise=require(_0x7532('0x6'));var Mustache=require(_0x7532('0x7'));var util=require(_0x7532('0x8'));var path=require(_0x7532('0x9'));var sox=require(_0x7532('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7532('0xb'));var squel=require(_0x7532('0xc'));var crypto=require(_0x7532('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7532('0xe'));var querystring=require(_0x7532('0xf'));var Papa=require(_0x7532('0x10'));var Redis=require(_0x7532('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7532('0x12'));var hardwareService=require(_0x7532('0x13'));var logger=require('../../config/logger')(_0x7532('0x14'));var utils=require('../../config/utils');var config=require(_0x7532('0x15'));var db=require(_0x7532('0x16'))['db'];function respondWithStatusCode(_0x145943,_0x23c50b){_0x23c50b=_0x23c50b||0xcc;return function(_0x120939){if(_0x120939){return _0x145943[_0x7532('0x17')](_0x23c50b);}return _0x145943[_0x7532('0x18')](_0x23c50b)[_0x7532('0x19')]();};}function respondWithResult(_0x1efe8c,_0x35e731){_0x35e731=_0x35e731||0xc8;return function(_0x1565d3){if(_0x1565d3){return _0x1efe8c[_0x7532('0x18')](_0x35e731)['json'](_0x1565d3);}};}function respondWithFilteredResult(_0x34d81a,_0x2aa06a){return function(_0x251cc1){if(_0x251cc1){var _0x318a01=_0x251cc1[_0x7532('0x1a')],_0x4c2915=_0x2aa06a[_0x7532('0x1b')],_0x1600d1=_0x2aa06a[_0x7532('0x1b')]+_0x2aa06a['limit'],_0x3abfd7;if(_0x1600d1>=_0x318a01){_0x1600d1=_0x318a01;_0x3abfd7=0xc8;}else{_0x3abfd7=0xce;}_0x34d81a[_0x7532('0x18')](_0x3abfd7);return _0x34d81a[_0x7532('0x1c')](_0x7532('0x1d'),_0x4c2915+'-'+_0x1600d1+'/'+_0x318a01)[_0x7532('0x1e')](_0x251cc1);}return null;};}function patchUpdates(_0x2e17d3){return function(_0x2c21b4){try{jsonpatch[_0x7532('0x1f')](_0x2c21b4,_0x2e17d3,!![]);}catch(_0x29fc57){return BPromise['reject'](_0x29fc57);}return _0x2c21b4[_0x7532('0x20')]();};}function saveUpdates(_0x189a43,_0x2a1ad8){return function(_0x592309){if(_0x592309){return _0x592309[_0x7532('0x21')](_0x189a43)[_0x7532('0x22')](function(_0x18296e){return _0x18296e;});}return null;};}function removeEntity(_0x9757e,_0xe869d2){return function(_0x9d2e6c){if(_0x9d2e6c){return _0x9d2e6c[_0x7532('0x23')]()[_0x7532('0x22')](function(){_0x9757e[_0x7532('0x18')](0xcc)[_0x7532('0x19')]();});}};}function handleEntityNotFound(_0x5e3b71,_0x1a75f2){return function(_0x1dc4b5){if(!_0x1dc4b5){_0x5e3b71[_0x7532('0x17')](0x194);}return _0x1dc4b5;};}function handleError(_0x2e526c,_0x29a775){_0x29a775=_0x29a775||0x1f4;return function(_0x54b0bb){logger['error'](_0x54b0bb['stack']);if(_0x54b0bb[_0x7532('0x24')]){delete _0x54b0bb[_0x7532('0x24')];}_0x2e526c[_0x7532('0x18')](_0x29a775)[_0x7532('0x25')](_0x54b0bb);};}exports[_0x7532('0x26')]=function(_0x2df19e,_0x2f4f49){var _0x6eb1d1={},_0x5b775f={},_0x261e39={'count':0x0,'rows':[]};var _0x56aca5=_[_0x7532('0x27')](db['WhatsappApplication'][_0x7532('0x28')],function(_0x176d9f){return{'name':_0x176d9f[_0x7532('0x29')],'type':_0x176d9f[_0x7532('0x2a')][_0x7532('0x2b')]};});_0x5b775f[_0x7532('0x2c')]=_[_0x7532('0x27')](_0x56aca5,_0x7532('0x24'));_0x5b775f['query']=_['keys'](_0x2df19e[_0x7532('0x2d')]);_0x5b775f[_0x7532('0x2e')]=_[_0x7532('0x2f')](_0x5b775f['model'],_0x5b775f[_0x7532('0x2d')]);_0x6eb1d1[_0x7532('0x30')]=_['intersection'](_0x5b775f['model'],qs[_0x7532('0x31')](_0x2df19e[_0x7532('0x2d')][_0x7532('0x31')]));_0x6eb1d1[_0x7532('0x30')]=_0x6eb1d1[_0x7532('0x30')][_0x7532('0x32')]?_0x6eb1d1[_0x7532('0x30')]:_0x5b775f[_0x7532('0x2c')];if(!_0x2df19e[_0x7532('0x2d')][_0x7532('0x33')](_0x7532('0x34'))){_0x6eb1d1['limit']=qs['limit'](_0x2df19e['query'][_0x7532('0x35')]);_0x6eb1d1[_0x7532('0x1b')]=qs['offset'](_0x2df19e[_0x7532('0x2d')][_0x7532('0x1b')]);}_0x6eb1d1['order']=qs[_0x7532('0x36')](_0x2df19e[_0x7532('0x2d')][_0x7532('0x36')]);_0x6eb1d1[_0x7532('0x37')]=qs[_0x7532('0x2e')](_[_0x7532('0x38')](_0x2df19e[_0x7532('0x2d')],_0x5b775f['filters']),_0x56aca5);if(_0x2df19e[_0x7532('0x2d')][_0x7532('0x39')]){_0x6eb1d1['where']=_[_0x7532('0x3a')](_0x6eb1d1[_0x7532('0x37')],{'$or':_[_0x7532('0x27')](_0x56aca5,function(_0x216955){if(_0x216955[_0x7532('0x2a')]!==_0x7532('0x3b')){var _0x44360a={};_0x44360a[_0x216955[_0x7532('0x24')]]={'$like':'%'+_0x2df19e['query'][_0x7532('0x39')]+'%'};return _0x44360a;}})});}_0x6eb1d1=_[_0x7532('0x3a')]({},_0x6eb1d1,_0x2df19e[_0x7532('0x3c')]);var _0x190236={'where':_0x6eb1d1[_0x7532('0x37')]};return db[_0x7532('0x3d')][_0x7532('0x1a')](_0x190236)['then'](function(_0x542d35){_0x261e39[_0x7532('0x1a')]=_0x542d35;if(_0x2df19e[_0x7532('0x2d')][_0x7532('0x3e')]){_0x6eb1d1['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x6eb1d1);})['then'](function(_0x2e3f1b){_0x261e39[_0x7532('0x3f')]=_0x2e3f1b;return _0x261e39;})['then'](respondWithFilteredResult(_0x2f4f49,_0x6eb1d1))[_0x7532('0x40')](handleError(_0x2f4f49,null));};exports[_0x7532('0x41')]=function(_0xa7fdd6,_0x3d5147){var _0x586d83={'raw':!![],'where':{'id':_0xa7fdd6['params']['id']}},_0x21c99e={};_0x21c99e[_0x7532('0x2c')]=_['keys'](db['WhatsappApplication'][_0x7532('0x28')]);_0x21c99e['query']=_[_0x7532('0x42')](_0xa7fdd6[_0x7532('0x2d')]);_0x21c99e[_0x7532('0x2e')]=_[_0x7532('0x2f')](_0x21c99e[_0x7532('0x2c')],_0x21c99e['query']);_0x586d83[_0x7532('0x30')]=_[_0x7532('0x2f')](_0x21c99e[_0x7532('0x2c')],qs[_0x7532('0x31')](_0xa7fdd6[_0x7532('0x2d')][_0x7532('0x31')]));_0x586d83[_0x7532('0x30')]=_0x586d83[_0x7532('0x30')]['length']?_0x586d83[_0x7532('0x30')]:_0x21c99e[_0x7532('0x2c')];if(_0xa7fdd6[_0x7532('0x2d')]['includeAll']){_0x586d83[_0x7532('0x43')]=[{'all':!![]}];}_0x586d83=_[_0x7532('0x3a')]({},_0x586d83,_0xa7fdd6[_0x7532('0x3c')]);return db[_0x7532('0x3d')][_0x7532('0x44')](_0x586d83)[_0x7532('0x22')](handleEntityNotFound(_0x3d5147,null))[_0x7532('0x22')](respondWithResult(_0x3d5147,null))['catch'](handleError(_0x3d5147,null));};exports[_0x7532('0x45')]=function(_0x712e0b,_0x59ae5e){return db[_0x7532('0x3d')][_0x7532('0x45')](_0x712e0b[_0x7532('0x46')],{})['then'](respondWithResult(_0x59ae5e,0xc9))['catch'](handleError(_0x59ae5e,null));};exports['update']=function(_0x162d16,_0x58e93f){if(_0x162d16[_0x7532('0x46')]['id']){delete _0x162d16['body']['id'];}return db[_0x7532('0x3d')][_0x7532('0x44')]({'where':{'id':_0x162d16['params']['id']}})[_0x7532('0x22')](handleEntityNotFound(_0x58e93f,null))[_0x7532('0x22')](saveUpdates(_0x162d16[_0x7532('0x46')],null))[_0x7532('0x22')](respondWithResult(_0x58e93f,null))[_0x7532('0x40')](handleError(_0x58e93f,null));};exports[_0x7532('0x23')]=function(_0x5d8455,_0x51ca3f){return db[_0x7532('0x3d')][_0x7532('0x44')]({'where':{'id':_0x5d8455[_0x7532('0x47')]['id']}})['then'](handleEntityNotFound(_0x51ca3f,null))[_0x7532('0x22')](removeEntity(_0x51ca3f,null))[_0x7532('0x40')](handleError(_0x51ca3f,null));}; \ No newline at end of file +var _0xcd5a=['pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','keys','intersection','includeAll','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','sendStatus','end','status','json','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','WhatsappApplication','fieldName','key','map','query','filters','model','fields','attributes','length','nolimit','limit','offset','order','sort','where'];(function(_0x1b18cf,_0x1d06ad){var _0x2670c4=function(_0x2f9d46){while(--_0x2f9d46){_0x1b18cf['push'](_0x1b18cf['shift']());}};_0x2670c4(++_0x1d06ad);}(_0xcd5a,0xe0));var _0xacd5=function(_0x42c0ce,_0x3007fe){_0x42c0ce=_0x42c0ce-0x0;var _0x4ff05d=_0xcd5a[_0x42c0ce];return _0x4ff05d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xacd5('0x0'));var rimraf=require(_0xacd5('0x1'));var zipdir=require(_0xacd5('0x2'));var jsonpatch=require(_0xacd5('0x3'));var rp=require(_0xacd5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xacd5('0x5'));var csv=require(_0xacd5('0x6'));var ejs=require(_0xacd5('0x7'));var fs=require('fs');var _=require(_0xacd5('0x8'));var squel=require(_0xacd5('0x9'));var crypto=require(_0xacd5('0xa'));var jsforce=require(_0xacd5('0xb'));var deskjs=require(_0xacd5('0xc'));var toCsv=require(_0xacd5('0x6'));var querystring=require(_0xacd5('0xd'));var Papa=require(_0xacd5('0xe'));var Redis=require(_0xacd5('0xf'));var authService=require(_0xacd5('0x10'));var qs=require(_0xacd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacd5('0x12'));var logger=require(_0xacd5('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ec89a,_0x24a8d3){_0x24a8d3=_0x24a8d3||0xcc;return function(_0x1e7075){if(_0x1e7075){return _0x5ec89a[_0xacd5('0x14')](_0x24a8d3);}return _0x5ec89a['status'](_0x24a8d3)[_0xacd5('0x15')]();};}function respondWithResult(_0x457d3a,_0x25d3fe){_0x25d3fe=_0x25d3fe||0xc8;return function(_0x7db492){if(_0x7db492){return _0x457d3a[_0xacd5('0x16')](_0x25d3fe)[_0xacd5('0x17')](_0x7db492);}};}function respondWithFilteredResult(_0x2b5f45,_0x3847f6){return function(_0x2ae790){if(_0x2ae790){var _0x4b21df=_0x2ae790[_0xacd5('0x18')],_0x883d0a=_0x3847f6['offset'],_0xdf9d17=_0x3847f6['offset']+_0x3847f6['limit'],_0x3978ee;if(_0xdf9d17>=_0x4b21df){_0xdf9d17=_0x4b21df;_0x3978ee=0xc8;}else{_0x3978ee=0xce;}_0x2b5f45[_0xacd5('0x16')](_0x3978ee);return _0x2b5f45[_0xacd5('0x19')](_0xacd5('0x1a'),_0x883d0a+'-'+_0xdf9d17+'/'+_0x4b21df)[_0xacd5('0x17')](_0x2ae790);}return null;};}function patchUpdates(_0x15846f){return function(_0x5ccdf1){try{jsonpatch[_0xacd5('0x1b')](_0x5ccdf1,_0x15846f,!![]);}catch(_0x26a078){return BPromise[_0xacd5('0x1c')](_0x26a078);}return _0x5ccdf1[_0xacd5('0x1d')]();};}function saveUpdates(_0xcc43cb,_0x56a4c1){return function(_0xe5828a){if(_0xe5828a){return _0xe5828a[_0xacd5('0x1e')](_0xcc43cb)['then'](function(_0x2da89c){return _0x2da89c;});}return null;};}function removeEntity(_0x437692,_0x5b05d0){return function(_0x58fe2c){if(_0x58fe2c){return _0x58fe2c[_0xacd5('0x1f')]()[_0xacd5('0x20')](function(){_0x437692['status'](0xcc)[_0xacd5('0x15')]();});}};}function handleEntityNotFound(_0x169815,_0x2173f9){return function(_0x5de3b0){if(!_0x5de3b0){_0x169815[_0xacd5('0x14')](0x194);}return _0x5de3b0;};}function handleError(_0x4a16b9,_0x5e34b4){_0x5e34b4=_0x5e34b4||0x1f4;return function(_0x5bbfc3){logger['error'](_0x5bbfc3[_0xacd5('0x21')]);if(_0x5bbfc3[_0xacd5('0x22')]){delete _0x5bbfc3[_0xacd5('0x22')];}_0x4a16b9[_0xacd5('0x16')](_0x5e34b4)['send'](_0x5bbfc3);};}exports[_0xacd5('0x23')]=function(_0xc7b847,_0x16b00f){var _0x3d7de1={},_0xcfc563={},_0x392667={'count':0x0,'rows':[]};var _0x2cd750=_['map'](db[_0xacd5('0x24')]['rawAttributes'],function(_0x3eb433){return{'name':_0x3eb433[_0xacd5('0x25')],'type':_0x3eb433['type'][_0xacd5('0x26')]};});_0xcfc563['model']=_[_0xacd5('0x27')](_0x2cd750,_0xacd5('0x22'));_0xcfc563[_0xacd5('0x28')]=_['keys'](_0xc7b847[_0xacd5('0x28')]);_0xcfc563[_0xacd5('0x29')]=_['intersection'](_0xcfc563[_0xacd5('0x2a')],_0xcfc563[_0xacd5('0x28')]);_0x3d7de1['attributes']=_['intersection'](_0xcfc563[_0xacd5('0x2a')],qs['fields'](_0xc7b847[_0xacd5('0x28')][_0xacd5('0x2b')]));_0x3d7de1[_0xacd5('0x2c')]=_0x3d7de1['attributes'][_0xacd5('0x2d')]?_0x3d7de1[_0xacd5('0x2c')]:_0xcfc563[_0xacd5('0x2a')];if(!_0xc7b847['query']['hasOwnProperty'](_0xacd5('0x2e'))){_0x3d7de1[_0xacd5('0x2f')]=qs[_0xacd5('0x2f')](_0xc7b847[_0xacd5('0x28')][_0xacd5('0x2f')]);_0x3d7de1[_0xacd5('0x30')]=qs['offset'](_0xc7b847[_0xacd5('0x28')]['offset']);}_0x3d7de1[_0xacd5('0x31')]=qs['sort'](_0xc7b847[_0xacd5('0x28')][_0xacd5('0x32')]);_0x3d7de1[_0xacd5('0x33')]=qs[_0xacd5('0x29')](_[_0xacd5('0x34')](_0xc7b847[_0xacd5('0x28')],_0xcfc563[_0xacd5('0x29')]),_0x2cd750);if(_0xc7b847[_0xacd5('0x28')][_0xacd5('0x35')]){_0x3d7de1['where']=_[_0xacd5('0x36')](_0x3d7de1[_0xacd5('0x33')],{'$or':_[_0xacd5('0x27')](_0x2cd750,function(_0x285d0b){if(_0x285d0b[_0xacd5('0x37')]!==_0xacd5('0x38')){var _0x42b06f={};_0x42b06f[_0x285d0b[_0xacd5('0x22')]]={'$like':'%'+_0xc7b847['query'][_0xacd5('0x35')]+'%'};return _0x42b06f;}})});}_0x3d7de1=_['merge']({},_0x3d7de1,_0xc7b847[_0xacd5('0x39')]);var _0x1473e9={'where':_0x3d7de1[_0xacd5('0x33')]};return db[_0xacd5('0x24')][_0xacd5('0x18')](_0x1473e9)['then'](function(_0x199794){_0x392667[_0xacd5('0x18')]=_0x199794;if(_0xc7b847[_0xacd5('0x28')]['includeAll']){_0x3d7de1['include']=[{'all':!![]}];}return db[_0xacd5('0x24')][_0xacd5('0x3a')](_0x3d7de1);})['then'](function(_0x2880f2){_0x392667[_0xacd5('0x3b')]=_0x2880f2;return _0x392667;})['then'](respondWithFilteredResult(_0x16b00f,_0x3d7de1))[_0xacd5('0x3c')](handleError(_0x16b00f,null));};exports[_0xacd5('0x3d')]=function(_0x507ce6,_0x501644){var _0x5c4026={'raw':!![],'where':{'id':_0x507ce6['params']['id']}},_0x1d344e={};_0x1d344e[_0xacd5('0x2a')]=_['keys'](db[_0xacd5('0x24')][_0xacd5('0x3e')]);_0x1d344e[_0xacd5('0x28')]=_[_0xacd5('0x3f')](_0x507ce6[_0xacd5('0x28')]);_0x1d344e['filters']=_[_0xacd5('0x40')](_0x1d344e[_0xacd5('0x2a')],_0x1d344e['query']);_0x5c4026[_0xacd5('0x2c')]=_[_0xacd5('0x40')](_0x1d344e[_0xacd5('0x2a')],qs['fields'](_0x507ce6[_0xacd5('0x28')]['fields']));_0x5c4026['attributes']=_0x5c4026[_0xacd5('0x2c')]['length']?_0x5c4026[_0xacd5('0x2c')]:_0x1d344e[_0xacd5('0x2a')];if(_0x507ce6['query'][_0xacd5('0x41')]){_0x5c4026['include']=[{'all':!![]}];}_0x5c4026=_[_0xacd5('0x36')]({},_0x5c4026,_0x507ce6[_0xacd5('0x39')]);return db[_0xacd5('0x24')]['find'](_0x5c4026)[_0xacd5('0x20')](handleEntityNotFound(_0x501644,null))['then'](respondWithResult(_0x501644,null))['catch'](handleError(_0x501644,null));};exports[_0xacd5('0x42')]=function(_0x2d23d4,_0x3af099){return db['WhatsappApplication'][_0xacd5('0x42')](_0x2d23d4[_0xacd5('0x43')],{})['then'](respondWithResult(_0x3af099,0xc9))[_0xacd5('0x3c')](handleError(_0x3af099,null));};exports['update']=function(_0x6ed6ad,_0x14cae1){if(_0x6ed6ad['body']['id']){delete _0x6ed6ad[_0xacd5('0x43')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x6ed6ad[_0xacd5('0x44')]['id']}})[_0xacd5('0x20')](handleEntityNotFound(_0x14cae1,null))['then'](saveUpdates(_0x6ed6ad[_0xacd5('0x43')],null))[_0xacd5('0x20')](respondWithResult(_0x14cae1,null))[_0xacd5('0x3c')](handleError(_0x14cae1,null));};exports[_0xacd5('0x1f')]=function(_0x342197,_0x46f3b0){return db[_0xacd5('0x24')]['find']({'where':{'id':_0x342197[_0xacd5('0x44')]['id']}})[_0xacd5('0x20')](handleEntityNotFound(_0x46f3b0,null))[_0xacd5('0x20')](removeEntity(_0x46f3b0,null))[_0xacd5('0x3c')](handleError(_0x46f3b0,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f53d2d4..453b782 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 _0x9c02=['utf8mb4_unicode_ci','lodash','util','../../config/logger','path','../../config/environment','exports','define','WhatsappApplication'];(function(_0x573dcc,_0x2888ae){var _0x3bc335=function(_0x25180e){while(--_0x25180e){_0x573dcc['push'](_0x573dcc['shift']());}};_0x3bc335(++_0x2888ae);}(_0x9c02,0x196));var _0x29c0=function(_0x2d7158,_0x15f598){_0x2d7158=_0x2d7158-0x0;var _0x229b17=_0x9c02[_0x2d7158];return _0x229b17;};'use strict';var _=require(_0x29c0('0x0'));var util=require(_0x29c0('0x1'));var logger=require(_0x29c0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29c0('0x3'));var rimraf=require('rimraf');var config=require(_0x29c0('0x4'));var attributes=require('./whatsappApplication.attributes');module[_0x29c0('0x5')]=function(_0x4bc5cf,_0x2fb607){return _0x4bc5cf[_0x29c0('0x6')](_0x29c0('0x7'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x29c0('0x8')});}; \ No newline at end of file +var _0x1681=['define','whatsapp_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes','exports'];(function(_0x189744,_0x26f963){var _0x1072d1=function(_0x334bdb){while(--_0x334bdb){_0x189744['push'](_0x189744['shift']());}};_0x1072d1(++_0x26f963);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1168('0x0'))(_0x1168('0x1'));var moment=require(_0x1168('0x2'));var BPromise=require(_0x1168('0x3'));var rp=require(_0x1168('0x4'));var fs=require('fs');var path=require(_0x1168('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1168('0x6'));module[_0x1168('0x7')]=function(_0x4a111a,_0x4601fe){return _0x4a111a[_0x1168('0x8')]('WhatsappApplication',attributes,{'tableName':_0x1168('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1168('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f2ee4d7..8a7ff79 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 _0xce68=['../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x356093,_0x50806b){var _0x441e4f=function(_0x3be7b6){while(--_0x3be7b6){_0x356093['push'](_0x356093['shift']());}};_0x441e4f(++_0x50806b);}(_0xce68,0x10c));var _0x8ce6=function(_0x58f29e,_0x756a4){_0x58f29e=_0x58f29e-0x0;var _0x475dc3=_0xce68[_0x58f29e];return _0x475dc3;};'use strict';var _=require(_0x8ce6('0x0'));var util=require('util');var moment=require(_0x8ce6('0x1'));var BPromise=require(_0x8ce6('0x2'));var rs=require(_0x8ce6('0x3'));var fs=require('fs');var Redis=require(_0x8ce6('0x4'));var db=require(_0x8ce6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ce6('0x6'))(_0x8ce6('0x7'));var config=require(_0x8ce6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ce6('0x9')][_0x8ce6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fed90,_0x4e5471,_0x34b134){return new BPromise(function(_0x357fbb,_0x17811e){return client[_0x8ce6('0xb')](_0x4fed90,_0x34b134)['then'](function(_0x417bcf){logger[_0x8ce6('0xc')](_0x8ce6('0xd'),_0x4e5471,_0x8ce6('0xe'));logger[_0x8ce6('0xf')](_0x8ce6('0x10'),_0x4e5471,_0x8ce6('0xe'),JSON[_0x8ce6('0x11')](_0x417bcf));if(_0x417bcf[_0x8ce6('0x12')]){if(_0x417bcf[_0x8ce6('0x12')][_0x8ce6('0x13')]===0x1f4){logger[_0x8ce6('0x12')](_0x8ce6('0xd'),_0x4e5471,_0x417bcf[_0x8ce6('0x12')][_0x8ce6('0x14')]);return _0x17811e(_0x417bcf[_0x8ce6('0x12')][_0x8ce6('0x14')]);}logger[_0x8ce6('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x4e5471,_0x417bcf[_0x8ce6('0x12')]['message']);return _0x357fbb(_0x417bcf[_0x8ce6('0x12')][_0x8ce6('0x14')]);}else{logger[_0x8ce6('0xc')](_0x8ce6('0xd'),_0x4e5471,_0x8ce6('0xe'));_0x357fbb(_0x417bcf[_0x8ce6('0x15')][_0x8ce6('0x14')]);}})[_0x8ce6('0x16')](function(_0x3fae8e){logger[_0x8ce6('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x4e5471,_0x3fae8e);_0x17811e(_0x3fae8e);});});} \ No newline at end of file +var _0x6d19=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','request\x20sent'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6d19,0x160));var _0x96d1=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x6d19[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var moment=require(_0x96d1('0x2'));var BPromise=require(_0x96d1('0x3'));var rs=require(_0x96d1('0x4'));var fs=require('fs');var Redis=require(_0x96d1('0x5'));var db=require(_0x96d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x96d1('0x7'))(_0x96d1('0x8'));var config=require(_0x96d1('0x9'));var jayson=require(_0x96d1('0xa'));var client=jayson['client'][_0x96d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x230638,_0x61e0f5,_0x58ade3){return new BPromise(function(_0xba2d03,_0x3f7a36){return client[_0x96d1('0xc')](_0x230638,_0x58ade3)[_0x96d1('0xd')](function(_0x37b251){logger[_0x96d1('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x61e0f5,'request\x20sent');logger[_0x96d1('0xf')](_0x96d1('0x10'),_0x61e0f5,'request\x20sent',JSON[_0x96d1('0x11')](_0x37b251));if(_0x37b251['error']){if(_0x37b251[_0x96d1('0x12')][_0x96d1('0x13')]===0x1f4){logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x37b251[_0x96d1('0x12')][_0x96d1('0x15')]);return _0x3f7a36(_0x37b251['error'][_0x96d1('0x15')]);}logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x37b251[_0x96d1('0x12')][_0x96d1('0x15')]);return _0xba2d03(_0x37b251['error']['message']);}else{logger[_0x96d1('0xe')](_0x96d1('0x14'),_0x61e0f5,_0x96d1('0x16'));_0xba2d03(_0x37b251[_0x96d1('0x17')][_0x96d1('0x15')]);}})[_0x96d1('0x18')](function(_0x45dc6f){logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x45dc6f);_0x3f7a36(_0x45dc6f);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a322aec..d190fc2 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 _0xa767=['whatsappinteraction:addtags','addTags','put','tracked','update','delete','whatsappinteraction:destroy','removeTags','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','download','create','addMessage','post','/:id/tags','whatsapp'];(function(_0x2d50d2,_0x3934cc){var _0x3da905=function(_0x4e2f1a){while(--_0x4e2f1a){_0x2d50d2['push'](_0x2d50d2['shift']());}};_0x3da905(++_0x3934cc);}(_0xa767,0x12a));var _0x7a76=function(_0x57d696,_0x56ea10){_0x57d696=_0x57d696-0x0;var _0x3fc844=_0xa767[_0x57d696];return _0x3fc844;};'use strict';var multer=require('multer');var util=require(_0x7a76('0x0'));var path=require(_0x7a76('0x1'));var timeout=require(_0x7a76('0x2'));var express=require(_0x7a76('0x3'));var router=express['Router']();var auth=require(_0x7a76('0x4'));var interaction=require(_0x7a76('0x5'));var config=require(_0x7a76('0x6'));var controller=require(_0x7a76('0x7'));router['get']('/',auth[_0x7a76('0x8')](),controller[_0x7a76('0x9')]);router[_0x7a76('0xa')](_0x7a76('0xb'),auth[_0x7a76('0x8')](),controller[_0x7a76('0xc')]);router[_0x7a76('0xa')](_0x7a76('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7a76('0xa')](_0x7a76('0xe'),auth[_0x7a76('0x8')](),controller['getMessages']);router[_0x7a76('0xa')]('/:id/download',auth[_0x7a76('0x8')](),controller[_0x7a76('0xf')]);router['post']('/',auth[_0x7a76('0x8')](),controller[_0x7a76('0x10')]);router['post']('/:id/messages',auth[_0x7a76('0x8')](),controller[_0x7a76('0x11')]);router[_0x7a76('0x12')](_0x7a76('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x7a76('0x14'),_0x7a76('0x15')),controller[_0x7a76('0x16')]);router[_0x7a76('0x17')](_0x7a76('0xd'),auth['isAuthenticated'](),interaction[_0x7a76('0x18')](_0x7a76('0x14'),'whatsappinteraction:update'),controller[_0x7a76('0x19')]);router[_0x7a76('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x7a76('0x1b')),controller['destroy']);router[_0x7a76('0x1a')](_0x7a76('0x13'),auth[_0x7a76('0x8')](),controller[_0x7a76('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb20b=['getMessages','/:id/download','post','create','/:id/tags','tracked','addTags','put','update','whatsapp','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','show','/:id/messages'];(function(_0x2965ba,_0x1df010){var _0x2829a3=function(_0x32d923){while(--_0x32d923){_0x2965ba['push'](_0x2965ba['shift']());}};_0x2829a3(++_0x1df010);}(_0xb20b,0x93));var _0xbb20=function(_0x34951f,_0x4b9a30){_0x34951f=_0x34951f-0x0;var _0x4ff01c=_0xb20b[_0x34951f];return _0x4ff01c;};'use strict';var multer=require(_0xbb20('0x0'));var util=require('util');var path=require(_0xbb20('0x1'));var timeout=require(_0xbb20('0x2'));var express=require(_0xbb20('0x3'));var router=express[_0xbb20('0x4')]();var auth=require(_0xbb20('0x5'));var interaction=require(_0xbb20('0x6'));var config=require(_0xbb20('0x7'));var controller=require(_0xbb20('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb20('0x9')]);router[_0xbb20('0xa')](_0xbb20('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbb20('0xc')](),controller[_0xbb20('0xd')]);router['get'](_0xbb20('0xe'),auth[_0xbb20('0xc')](),controller[_0xbb20('0xf')]);router[_0xbb20('0xa')](_0xbb20('0x10'),auth[_0xbb20('0xc')](),controller['download']);router[_0xbb20('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb20('0x12')]);router[_0xbb20('0x11')](_0xbb20('0xe'),auth[_0xbb20('0xc')](),controller['addMessage']);router[_0xbb20('0x11')](_0xbb20('0x13'),auth[_0xbb20('0xc')](),interaction[_0xbb20('0x14')]('whatsapp','whatsappinteraction:addtags'),controller[_0xbb20('0x15')]);router[_0xbb20('0x16')]('/:id',auth[_0xbb20('0xc')](),interaction[_0xbb20('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0xbb20('0x17')]);router['delete']('/:id',auth[_0xbb20('0xc')](),interaction[_0xbb20('0x14')](_0xbb20('0x18'),'whatsappinteraction:destroy'),controller[_0xbb20('0x19')]);router['delete']('/:id/tags',auth[_0xbb20('0xc')](),controller['removeTags']);module[_0xbb20('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 0cbbc01..27197d2 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 _0xffb9=['STRING','out','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x2c84a2,_0x5afe0d){var _0x593ec4=function(_0x311cc9){while(--_0x311cc9){_0x2c84a2['push'](_0x2c84a2['shift']());}};_0x593ec4(++_0x5afe0d);}(_0xffb9,0x1c3));var _0x9ffb=function(_0x4e7261,_0xa23e38){_0x4e7261=_0x4e7261-0x0;var _0x24dd41=_0xffb9[_0x4e7261];return _0x24dd41;};'use strict';var Sequelize=require(_0x9ffb('0x0'));var moment=require(_0x9ffb('0x1'));module[_0x9ffb('0x2')]={'closed':{'type':Sequelize[_0x9ffb('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ffb('0x4')]},'disposition':{'type':Sequelize[_0x9ffb('0x5')]},'note':{'type':Sequelize[_0x9ffb('0x5')]},'phone':{'type':Sequelize[_0x9ffb('0x5')]},'read1stAt':{'type':Sequelize[_0x9ffb('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9ffb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9ffb('0x7')]('in',_0x9ffb('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xef27=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x64ac46,_0x29a347){var _0x1a8b52=function(_0x49dc42){while(--_0x49dc42){_0x64ac46['push'](_0x64ac46['shift']());}};_0x1a8b52(++_0x29a347);}(_0xef27,0x6b));var _0x7ef2=function(_0x65ad87,_0x2bb0bc){_0x65ad87=_0x65ad87-0x0;var _0x3fb63a=_0xef27[_0x65ad87];return _0x3fb63a;};'use strict';var Sequelize=require(_0x7ef2('0x0'));var moment=require(_0x7ef2('0x1'));module[_0x7ef2('0x2')]={'closed':{'type':Sequelize[_0x7ef2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7ef2('0x4')]},'disposition':{'type':Sequelize[_0x7ef2('0x5')]},'note':{'type':Sequelize[_0x7ef2('0x5')]},'phone':{'type':Sequelize[_0x7ef2('0x5')]},'read1stAt':{'type':Sequelize[_0x7ef2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7ef2('0x6')]('in',_0x7ef2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7ef2('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7ef2('0x6')]('in',_0x7ef2('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 6bbd092..d4bbab2 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 _0xe14b=['Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','body','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','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?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','push','all','rows','show','includeAll','include','options','WhatsappInteraction','create','update','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','whatsappInteractionTags:save','download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','WhatsappAccount','Account','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','System','lastName','out','secret','server','views','downloadInteraction.html','toFile','transcript-','log','unlinkSync','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','u.id','u.fullname','ui.WhatsappInteractionId','from','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe14b,0x93));var _0xbe14=function(_0x491fbc,_0x1a708a){_0x491fbc=_0x491fbc-0x0;var _0x2559d7=_0xe14b[_0x491fbc];return _0x2559d7;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];config[_0xbe14('0x15')]=_[_0xbe14('0x16')](config[_0xbe14('0x15')],{'host':_0xbe14('0x17'),'port':0x18eb});var socket=require(_0xbe14('0x18'))(new Redis(config[_0xbe14('0x15')]));require(_0xbe14('0x19'))[_0xbe14('0x1a')](socket);function respondWithStatusCode(_0x33fd54,_0x813399){_0x813399=_0x813399||0xcc;return function(_0x530538){if(_0x530538){return _0x33fd54['sendStatus'](_0x813399);}return _0x33fd54[_0xbe14('0x1b')](_0x813399)[_0xbe14('0x1c')]();};}function respondWithResult(_0xf4ac9,_0x37ce4e){_0x37ce4e=_0x37ce4e||0xc8;return function(_0x4e8f34){if(_0x4e8f34){return _0xf4ac9[_0xbe14('0x1b')](_0x37ce4e)[_0xbe14('0x1d')](_0x4e8f34);}};}function respondWithFilteredResult(_0xfd7b8f,_0x123ede){return function(_0x38f1ea){if(_0x38f1ea){var _0x29ab73=_0x38f1ea[_0xbe14('0x1e')],_0x17ae86=_0x123ede[_0xbe14('0x1f')],_0x5ea1f8=_0x123ede[_0xbe14('0x1f')]+_0x123ede[_0xbe14('0x20')],_0x137ee5;if(_0x5ea1f8>=_0x29ab73){_0x5ea1f8=_0x29ab73;_0x137ee5=0xc8;}else{_0x137ee5=0xce;}_0xfd7b8f[_0xbe14('0x1b')](_0x137ee5);return _0xfd7b8f['set'](_0xbe14('0x21'),_0x17ae86+'-'+_0x5ea1f8+'/'+_0x29ab73)[_0xbe14('0x1d')](_0x38f1ea);}return null;};}function patchUpdates(_0x417c8d){return function(_0xc12977){try{jsonpatch[_0xbe14('0x22')](_0xc12977,_0x417c8d,!![]);}catch(_0x51dc0b){return BPromise[_0xbe14('0x23')](_0x51dc0b);}return _0xc12977['save']();};}function saveUpdates(_0x3c1c85,_0x56e80c){return function(_0x32e8eb){if(_0x32e8eb){return _0x32e8eb['update'](_0x3c1c85)[_0xbe14('0x24')](function(_0x3d3608){return _0x3d3608;});}return null;};}function removeEntity(_0x505dbd,_0x2da350){return function(_0x4d4190){if(_0x4d4190){return _0x4d4190[_0xbe14('0x25')]()['then'](function(){_0x505dbd[_0xbe14('0x1b')](0xcc)[_0xbe14('0x1c')]();});}};}function handleEntityNotFound(_0x1ee9c1,_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x1ee9c1[_0xbe14('0x26')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x27')](_0x1ba46a[_0xbe14('0x28')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x29')];}_0x55d001[_0xbe14('0x1b')](_0x1822e0)['send'](_0x1ba46a);};}function getInteractionUsers(_0x3c3613,_0x3b3e84){return new BPromise(function(_0x1c7cc7,_0x19252f){try{if(_0x3b3e84[_0x3c3613['id']]){_0x3c3613[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x3b3e84[_0x3c3613['id']],function(_0x31a664){return{'id':_0x31a664['id'],'fullname':_0x31a664[_0xbe14('0x2c')]};});}}catch(_0x4168c8){_0x19252f(_0x4168c8);}_0x1c7cc7(_0x3c3613);});}function getInteractionTags(_0x16a159,_0x40538f){return new BPromise(function(_0x3bf43c,_0x39dc0a){try{if(_0x16a159[_0xbe14('0x2d')]){_0x16a159[_0xbe14('0x2e')]=[];_0x16a159[_0xbe14('0x2d')][_0xbe14('0x2f')](',')[_0xbe14('0x30')](function(_0x29e76a){_0x16a159[_0xbe14('0x2e')]['push'](_0x40538f[_0x29e76a]);});}delete _0x16a159[_0xbe14('0x2d')];}catch(_0x499793){_0x39dc0a(_0x499793);}_0x3bf43c(_0x16a159);});}function updateWhatsappInteraction(_0x58f8de,_0x46c2d1,_0x4c1e7e){return new BPromise(function(_0x243524,_0x345b0){return getInteractionUsers(_0x58f8de,_0x4c1e7e)['then'](function(_0x50cb09){return getInteractionTags(_0x50cb09,_0x46c2d1);})['then'](function(_0x412ad5){_0x243524(_0x412ad5);})[_0xbe14('0x31')](function(_0x5f27b6){_0x345b0(_0x5f27b6);});});}exports[_0xbe14('0x32')]=function(_0x1faf3e,_0x452635){var _0x1aa849={},_0x29c23e={},_0x5ef1e5={'count':0x0,'rows':[]};var _0x591a36=_[_0xbe14('0x2b')](db['WhatsappInteraction']['rawAttributes'],function(_0x5c5e9f){return{'name':_0x5c5e9f[_0xbe14('0x33')],'type':_0x5c5e9f[_0xbe14('0x34')][_0xbe14('0x35')]};});_0x29c23e[_0xbe14('0x36')]=_[_0xbe14('0x2b')](_0x591a36,_0xbe14('0x29'));_0x29c23e[_0xbe14('0x37')]=_[_0xbe14('0x38')](_0x1faf3e[_0xbe14('0x37')]);_0x29c23e[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x29c23e[_0xbe14('0x36')],_0x29c23e['query']);_0x1aa849['attributes']=_[_0xbe14('0x3a')](_0x29c23e[_0xbe14('0x36')],qs[_0xbe14('0x3b')](_0x1faf3e['query'][_0xbe14('0x3b')]));_0x1aa849[_0xbe14('0x3c')]=_0x1aa849[_0xbe14('0x3c')][_0xbe14('0x3d')]?_0x1aa849[_0xbe14('0x3c')]:_0x29c23e[_0xbe14('0x36')];if(!_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x3e')](_0xbe14('0x3f'))){_0x1aa849['limit']=qs[_0xbe14('0x20')](_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x20')]);_0x1aa849[_0xbe14('0x1f')]=qs[_0xbe14('0x1f')](_0x1faf3e[_0xbe14('0x37')]['offset']);}_0x1aa849[_0xbe14('0x40')]=qs[_0xbe14('0x41')](_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x41')]);_0x1aa849['where']=qs['filters'](_[_0xbe14('0x42')](_0x1faf3e[_0xbe14('0x37')],_0x29c23e[_0xbe14('0x39')]),_0x591a36);var _0x51c859=[];var _0x5d5318=squel[_0xbe14('0x43')]()['field']('id')['field'](_0xbe14('0x29'))[_0xbe14('0x44')](_0xbe14('0x45'))['from']('tools_tags');var _0x5aaa4f=squel[_0xbe14('0x43')]()[_0xbe14('0x44')](_0xbe14('0x46'))['field'](_0xbe14('0x47'))[_0xbe14('0x44')](_0xbe14('0x48'))[_0xbe14('0x49')]('user_has_whatsapp_interactions','ui')['left_join'](_0xbe14('0x4a'),'u',_0xbe14('0x4b'));var _0x24559b=squel[_0xbe14('0x43')]()[_0xbe14('0x49')]('whatsapp_interactions','i')['left_join'](_0xbe14('0x4c'),'c',_0xbe14('0x4d'))[_0xbe14('0x4e')](_0xbe14('0x4a'),'o','o.id\x20=\x20i.UserId')[_0xbe14('0x4e')](_0xbe14('0x4f'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xbe14('0x4e')](_0xbe14('0x50'),'me',_0xbe14('0x51'))[_0xbe14('0x4e')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xbe14('0x4e')](_0xbe14('0x52'),'t','t.id\x20=\x20it.TagId');var _0x5acf90=squel[_0xbe14('0x53')]();var _0x5d3726=[];var _0x3f7f5b=squel[_0xbe14('0x53')]();var _0xdbc6e1;if(_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x54')]){_0xdbc6e1=as['parseSearch'](_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x54')]);var _0x6928f2=_0xdbc6e1[_0xbe14('0x55')];for(var _0x2fc073=0x0;_0x2fc073<_0xdbc6e1['conditions'][_0xbe14('0x3d')];_0x2fc073++){var _0x3d419a=_0xdbc6e1[_0xbe14('0x56')][_0x2fc073];var _0x20f46d='i';var _0x3d3ae1=_[_0xbe14('0x57')](_0x591a36,['name',_0x3d419a['field']]);if(!_0x3d3ae1){switch(_0x3d419a[_0xbe14('0x44')]){case _0xbe14('0x58'):if(_0x3d419a[_0xbe14('0x59')]==0x1){_0x24559b['having']('`'+_0x3d419a['field']+_0xbe14('0x5a'));}else{_0x24559b[_0xbe14('0x5b')]('`'+_0x3d419a['field']+_0xbe14('0x5c'));}break;case _0xbe14('0x5d'):if(_0x3d419a['operator']===_0xbe14('0x5e')){if(_0x3d419a['value'][_0xbe14('0x2f')]('\x20')[_0xbe14('0x3d')]>0x1){_0x5acf90[_0x6928f2](_0xbe14('0x5f'),qs['getFullTextValue'](_0x3d419a[_0xbe14('0x59')]),null);}else{var _0x404212='%'+_0x3d419a['value']+'%';_0x5acf90[_0x6928f2](_0xbe14('0x60'),_0x404212,_0x404212,_0x404212);}}else{_0x3d3ae1=_[_0xbe14('0x57')](_0x591a36,[_0xbe14('0x29'),_0xbe14('0x61')]);_0x3d419a[_0xbe14('0x44')]='ContactId';_0x1a945b=as[_0xbe14('0x62')](_0x20f46d,_0x3d3ae1[_0xbe14('0x34')],_0x3d419a);_0x5acf90[_0x6928f2](_0x1a945b[_0xbe14('0x63')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x64')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x1c')]);}break;case'Tag':var _0x72c875=_0x3d419a[_0xbe14('0x59')][_0xbe14('0x2f')](',')[_0xbe14('0x2b')](function(_0x246ed5){return Number(_0x246ed5);});_0x72c875[_0xbe14('0x30')](function(_0xd8f78f){_0x3f7f5b['or'](_0xbe14('0x65'),'%,'+_0xd8f78f+',%');});_0x5d3726=_[_0xbe14('0x66')](_0x5d3726,_0x72c875);break;case _0xbe14('0x67'):if(_0x3d419a[_0xbe14('0x68')]==='$substring'){_0x5acf90[_0x6928f2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3d419a['value']+'%',null);}else{_0x3d3ae1=_[_0xbe14('0x57')](_0x591a36,[_0xbe14('0x29'),_0xbe14('0x69')]);_0x3d419a[_0xbe14('0x44')]=_0xbe14('0x69');_0x1a945b=as[_0xbe14('0x62')](_0x20f46d,_0x3d3ae1[_0xbe14('0x34')],_0x3d419a);_0x5acf90[_0x6928f2](_0x1a945b[_0xbe14('0x63')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x64')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x1c')]);}break;case _0xbe14('0x6a'):_0x1a945b=as[_0xbe14('0x62')]('me',null,_0x3d419a);_0x5acf90[_0x6928f2](_0x1a945b[_0xbe14('0x63')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x64')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x1c')]);break;}}else{var _0x1a945b=as['buildExpression'](_0x20f46d,_0x3d3ae1[_0xbe14('0x34')],_0x3d419a);_0x5acf90[_0x6928f2](_0x1a945b[_0xbe14('0x63')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x64')],_0x1a945b[_0xbe14('0x59')][_0xbe14('0x1c')]);}}}else{var _0x198b55=_(_0x1faf3e[_0xbe14('0x37')])[_0xbe14('0x38')]()[_0xbe14('0x2b')](function(_0x5917d5){return _[_0xbe14('0x6b')](_0x591a36,[_0xbe14('0x29'),_0x5917d5])?_0x5917d5:undefined;})[_0xbe14('0x6c')]()[_0xbe14('0x59')]();if(!_[_0xbe14('0x6d')](_0x198b55)){_0x198b55['forEach'](function(_0x42b341){if(_0x42b341===_0xbe14('0x6e')){_0x24559b[_0xbe14('0x6f')](_0xbe14('0x70'),[][_0xbe14('0x71')](_0x1faf3e['query'][_0x42b341]));}else if(_0x42b341===_0xbe14('0x72')){var _0x14f064=JSON[_0xbe14('0x73')](_0x1faf3e[_0xbe14('0x37')][_0x42b341])[_0xbe14('0x74')];var _0x289c4d=JSON[_0xbe14('0x73')](_0x1faf3e[_0xbe14('0x37')][_0x42b341])['$lte'];_0x24559b[_0xbe14('0x6f')](_0xbe14('0x75'),_0x14f064,_0x289c4d);}else{if(_0x1faf3e[_0xbe14('0x37')][_0x42b341]===_0xbe14('0x76')){_0x24559b[_0xbe14('0x6f')]('i.'+_0x42b341+_0xbe14('0x77'));}else{_0x24559b[_0xbe14('0x6f')]('i.'+_0x42b341+'\x20=\x20?',_0x1faf3e['query'][_0x42b341]);}}});}if(_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x78')]){if(_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x78')]==0x1){_0x24559b[_0xbe14('0x5b')](_0xbe14('0x79'));}else{_0x24559b[_0xbe14('0x5b')](_0xbe14('0x7a'));}}if(_0x1faf3e['query']['tag']){_0x5d3726=_[_0xbe14('0x7b')](_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x7c')])?_0x1faf3e['query'][_0xbe14('0x7c')]:new Array(_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x7c')]);_0x5d3726[_0xbe14('0x30')](function(_0x468e9f){_0x3f7f5b['or'](_0xbe14('0x65'),'%,'+_0x468e9f+',%');});}if(_0x1faf3e[_0xbe14('0x37')]['filter']){var _0x43b817=_0x1faf3e[_0xbe14('0x37')][_0xbe14('0x7d')][_0xbe14('0x7e')]('\x5c','\x5c\x5c')[_0xbe14('0x7e')]('\x27\x27',_0xbe14('0x7f'));if(qs[_0xbe14('0x80')](_0x43b817)){_0x5acf90['or']('i.id\x20LIKE\x20?',_0x43b817+'%')['or'](_0xbe14('0x81'),_0x43b817+'%');}else{_0x5acf90['or'](_0xbe14('0x82'),qs[_0xbe14('0x83')](_0x43b817))['or'](_0xbe14('0x84'),_0x43b817+'%');}}}_0x24559b[_0xbe14('0x6f')](_0x5acf90);_0x24559b[_0xbe14('0x85')](_0xbe14('0x86'));var _0xd756b2={'type':db['Sequelize'][_0xbe14('0x87')][_0xbe14('0x88')],'raw':!![]};var _0x362999=_0x24559b[_0xbe14('0x89')]();_0x362999[_0xbe14('0x44')](_0xbe14('0x86'));_0x362999['field'](_0xbe14('0x8a'),_0xbe14('0x58'));if(_0x1aa849[_0xbe14('0x40')]){_0x1aa849[_0xbe14('0x40')]['forEach'](function(_0x7e9e5c){_0x24559b[_0xbe14('0x40')]('i.'+_0x7e9e5c[0x0],_0x7e9e5c[0x1]===_0xbe14('0x8b')?![]:!![]);});}if(!_[_0xbe14('0x6d')](_0x5d3726)){_0x24559b[_0xbe14('0x5b')](_0x3f7f5b);_0x362999[_0xbe14('0x6f')](_0xbe14('0x8c'),_0x5d3726);}BPromise['resolve']()[_0xbe14('0x24')](function(){if(!_0xdbc6e1){if(_0x1faf3e['query'][_0xbe14('0x6e')]||_0x1faf3e['query'][_0xbe14('0x8d')])return;_0x362999[_0xbe14('0x6f')](_0xbe14('0x8e'));_0x24559b['where'](_0xbe14('0x8e'));return;}return _0x1faf3e[_0xbe14('0x8f')][_0xbe14('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x41a896){if(_[_0xbe14('0x6d')](_0x41a896)){_0x362999[_0xbe14('0x6f')](_0xbe14('0x91'));_0x24559b['where'](_0xbe14('0x91'));}else{_0x362999[_0xbe14('0x6f')](_0xbe14('0x70'),_[_0xbe14('0x2b')](_0x41a896,'id'));_0x24559b[_0xbe14('0x6f')](_0xbe14('0x70'),_[_0xbe14('0x2b')](_0x41a896,'id'));}});})['then'](function(){db[_0xbe14('0x92')][_0xbe14('0x37')](_0x362999[_0xbe14('0x93')](),_0xd756b2)['then'](function(_0x704c05){_0x5ef1e5[_0xbe14('0x1e')]=_0x704c05[_0xbe14('0x3d')];if(_0x5ef1e5['count']===0x0)return[];return db[_0xbe14('0x92')][_0xbe14('0x37')](_0x5d5318['toString'](),_0xd756b2)[_0xbe14('0x24')](function(_0x49990b){_0x51c859=_[_0xbe14('0x94')](_0x49990b,'id');_0xd756b2=_[_0xbe14('0x95')](_0xd756b2,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1faf3e['query'][_0xbe14('0x3b')]){_0x1aa849[_0xbe14('0x3c')][_0xbe14('0x30')](function(_0x4c76c1){_0x24559b[_0xbe14('0x44')]('i.'+_0x4c76c1);});}else{_0x24559b[_0xbe14('0x44')](_0xbe14('0x8a'),_0xbe14('0x58'));_0x24559b['field']('a.key',_0xbe14('0x96'));_0x24559b[_0xbe14('0x44')](_0xbe14('0x97'),_0xbe14('0x98'));_0x24559b[_0xbe14('0x44')](_0xbe14('0x99'));_0x24559b[_0xbe14('0x44')]('c.firstName',_0xbe14('0x9a'));_0x24559b['field'](_0xbe14('0x9b'),_0xbe14('0x9c'));_0x24559b[_0xbe14('0x44')](_0xbe14('0x9d'),'Contact.email');_0x24559b[_0xbe14('0x44')](_0xbe14('0x9e'),_0xbe14('0x9f'));_0x24559b['field'](_0xbe14('0xa0'),_0xbe14('0xa1'));_0x24559b[_0xbe14('0x44')](_0xbe14('0xa2'),_0xbe14('0xa3'));_0x24559b[_0xbe14('0x44')](_0xbe14('0xa4'),_0xbe14('0xa5'));_0x24559b[_0xbe14('0x44')](_0xbe14('0xa6'),_0xbe14('0xa7'));_0x24559b[_0xbe14('0x44')](_0xbe14('0xa8'),_0xbe14('0x2d'));}if(_0x1aa849[_0xbe14('0x20')])_0x24559b[_0xbe14('0x20')](_0x1aa849[_0xbe14('0x20')]);if(_0x1aa849[_0xbe14('0x1f')])_0x24559b[_0xbe14('0x1f')](_0x1aa849[_0xbe14('0x1f')]);return db['sequelize'][_0xbe14('0x37')](_0x24559b['toString'](),_0xd756b2);})[_0xbe14('0x24')](function(_0x1b8733){_0x5aaa4f[_0xbe14('0x6f')](_0xbe14('0xa9'),_[_0xbe14('0x2b')](_0x1b8733,'id'));return db['sequelize']['query'](_0x5aaa4f[_0xbe14('0x93')](),_0xd756b2)[_0xbe14('0x24')](function(_0x13a732){var _0x42b849=_['groupBy'](_0x13a732,_0xbe14('0xaa'));var _0x357095=[];_0x1b8733['forEach'](function(_0x186225){_0x357095[_0xbe14('0xab')](updateWhatsappInteraction(_0x186225,_0x51c859,_0x42b849));});return BPromise[_0xbe14('0xac')](_0x357095);});});})[_0xbe14('0x24')](function(_0x4f9936){_0x5ef1e5[_0xbe14('0xad')]=_0x4f9936;return _0x5ef1e5;})['then'](respondWithFilteredResult(_0x452635,_0x1aa849));})['catch'](handleError(_0x452635,null));};exports[_0xbe14('0xae')]=function(_0x8d506a,_0x110603){var _0x3d890b={'raw':![],'where':{'id':_0x8d506a['params']['id']}},_0x3e8655={};_0x3e8655[_0xbe14('0x36')]=_[_0xbe14('0x38')](db['WhatsappInteraction']['rawAttributes']);_0x3e8655[_0xbe14('0x37')]=_[_0xbe14('0x38')](_0x8d506a['query']);_0x3e8655[_0xbe14('0x39')]=_['intersection'](_0x3e8655[_0xbe14('0x36')],_0x3e8655['query']);_0x3d890b[_0xbe14('0x3c')]=_['intersection'](_0x3e8655[_0xbe14('0x36')],qs['fields'](_0x8d506a[_0xbe14('0x37')][_0xbe14('0x3b')]));_0x3d890b['attributes']=_0x3d890b['attributes'][_0xbe14('0x3d')]?_0x3d890b['attributes']:_0x3e8655['model'];if(_0x8d506a[_0xbe14('0x37')][_0xbe14('0xaf')]){_0x3d890b[_0xbe14('0xb0')]=[{'all':!![]}];}_0x3d890b=_[_0xbe14('0x95')]({},_0x3d890b,_0x8d506a[_0xbe14('0xb1')]);return db[_0xbe14('0xb2')][_0xbe14('0x57')](_0x3d890b)['then'](handleEntityNotFound(_0x110603,null))[_0xbe14('0x24')](respondWithResult(_0x110603,null))[_0xbe14('0x31')](handleError(_0x110603,null));};exports[_0xbe14('0xb3')]=function(_0x1445ce,_0x59779a){return db[_0xbe14('0xb2')][_0xbe14('0xb3')](_0x1445ce[_0xbe14('0x6a')],{})['then'](respondWithResult(_0x59779a,0xc9))[_0xbe14('0x31')](handleError(_0x59779a,null));};exports[_0xbe14('0xb4')]=function(_0x521a9f,_0x360cee){if(_0x521a9f['body']['id']){delete _0x521a9f[_0xbe14('0x6a')]['id'];}return db[_0xbe14('0xb2')][_0xbe14('0x57')]({'where':{'id':_0x521a9f['params']['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x360cee,null))['then'](saveUpdates(_0x521a9f[_0xbe14('0x6a')],null))['then'](respondWithResult(_0x360cee,null))['catch'](handleError(_0x360cee,null));};exports[_0xbe14('0x25')]=function(_0x553f51,_0xab74eb){return db['WhatsappInteraction'][_0xbe14('0x57')]({'where':{'id':_0x553f51[_0xbe14('0xb5')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0xab74eb,null))[_0xbe14('0x24')](removeEntity(_0xab74eb,null))[_0xbe14('0x31')](handleError(_0xab74eb,null));};exports[_0xbe14('0xb6')]=function(_0x43d406,_0x3086f3){return db[_0xbe14('0xb2')][_0xbe14('0xb6')]()[_0xbe14('0x24')](respondWithResult(_0x3086f3,null))[_0xbe14('0x31')](handleError(_0x3086f3,null));};exports[_0xbe14('0xb7')]=function(_0x4c2a25,_0x2d99fa,_0x234c4e){return db[_0xbe14('0xb8')][_0xbe14('0x57')]({'where':{'id':_0x4c2a25[_0xbe14('0xb5')]['id']}})['then'](handleEntityNotFound(_0x2d99fa,null))['then'](function(_0x116282){if(_0x116282){return _0x116282[_0xbe14('0xb7')](_0x4c2a25[_0xbe14('0x6a')][_0xbe14('0xb9')],_[_0xbe14('0xba')](_0x4c2a25[_0xbe14('0x6a')],[_0xbe14('0xb9'),'id'])||{});}})[_0xbe14('0x24')](respondWithResult(_0x2d99fa,null))[_0xbe14('0x31')](handleError(_0x2d99fa,null));};exports[_0xbe14('0xbb')]=function(_0x761b3d,_0x30597b,_0xaddf0d){var _0x23fd86={'raw':![],'where':{}};var _0x894313={};var _0x2c2dce={'count':0x0,'rows':[]};return db[_0xbe14('0xb2')][_0xbe14('0xbc')]({'where':{'id':_0x761b3d[_0xbe14('0xb5')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x30597b,null))[_0xbe14('0x24')](function(_0x82d19a){if(_0x82d19a){_0x894313[_0xbe14('0x36')]=_[_0xbe14('0x38')](db[_0xbe14('0xb8')]['rawAttributes']);_0x894313[_0xbe14('0x37')]=_[_0xbe14('0x38')](_0x761b3d[_0xbe14('0x37')]);_0x894313[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x894313[_0xbe14('0x36')],_0x894313['query']);_0x23fd86['attributes']=_[_0xbe14('0x3a')](_0x894313['model'],qs[_0xbe14('0x3b')](_0x761b3d['query'][_0xbe14('0x3b')]));_0x23fd86['attributes']=_0x23fd86[_0xbe14('0x3c')][_0xbe14('0x3d')]?_0x23fd86[_0xbe14('0x3c')]:_0x894313[_0xbe14('0x36')];if(!_0x761b3d[_0xbe14('0x37')][_0xbe14('0x3e')](_0xbe14('0x3f'))){_0x23fd86[_0xbe14('0x20')]=qs[_0xbe14('0x20')](_0x761b3d['query'][_0xbe14('0x20')]);_0x23fd86[_0xbe14('0x1f')]=qs[_0xbe14('0x1f')](_0x761b3d[_0xbe14('0x37')]['offset']);}_0x23fd86[_0xbe14('0x40')]=qs['sort'](_0x761b3d[_0xbe14('0x37')]['sort']);_0x23fd86[_0xbe14('0x6f')]=qs[_0xbe14('0x39')](_[_0xbe14('0x42')](_0x761b3d['query'],_0x894313[_0xbe14('0x39')]));_0x23fd86['where'][_0xbe14('0xaa')]=_0x82d19a['id'];if(_0x761b3d[_0xbe14('0x37')][_0xbe14('0x7d')]){_0x23fd86[_0xbe14('0x6f')]=_[_0xbe14('0x95')](_0x23fd86[_0xbe14('0x6f')],{'$or':_[_0xbe14('0x2b')](_0x23fd86[_0xbe14('0x3c')],function(_0x2a2b93){var _0x5a7724={};_0x5a7724[_0x2a2b93]={'$like':'%'+_0x761b3d[_0xbe14('0x37')]['filter']+'%'};return _0x5a7724;})});}if(_0x761b3d[_0xbe14('0x37')][_0xbe14('0x74')]){var _0x119797=_0x761b3d['query'][_0xbe14('0x74')][_0xbe14('0x2f')](',');var _0x219403={};_0x219403[_0x119797[0x0]]={'$gte':moment(_0x119797[0x1])[_0xbe14('0xbd')](_0xbe14('0xbe'))};_0x23fd86['where']=_['merge'](_0x23fd86[_0xbe14('0x6f')],_0x219403);}_0x23fd86=_['merge']({},_0x23fd86,_0x761b3d[_0xbe14('0xb1')]);return db[_0xbe14('0xb8')][_0xbe14('0x1e')]({'where':_0x23fd86[_0xbe14('0x6f')]})['then'](function(_0x33c7d5){_0x2c2dce[_0xbe14('0x1e')]=_0x33c7d5;if(_0x761b3d['query'][_0xbe14('0xaf')]){_0x23fd86[_0xbe14('0xb0')]=[{'all':!![]}];}return db[_0xbe14('0xb8')][_0xbe14('0xbf')](_0x23fd86);})['then'](function(_0x20282c){_0x2c2dce[_0xbe14('0xad')]=_0x20282c;return _0x2c2dce;});}})[_0xbe14('0x24')](respondWithFilteredResult(_0x30597b,_0x23fd86))[_0xbe14('0x31')](handleError(_0x30597b,null));};exports[_0xbe14('0xc0')]=function(_0x469ef3,_0x208fae,_0x310d42){return db[_0xbe14('0xb2')][_0xbe14('0x57')]({'where':{'id':_0x469ef3['params']['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x208fae,null))[_0xbe14('0x24')](function(_0x419706){if(_0x419706){return _0x419706[_0xbe14('0xc1')](_0x469ef3['body'][_0xbe14('0xb9')],_[_0xbe14('0xba')](_0x469ef3[_0xbe14('0x6a')],['ids','id'])||{})[_0xbe14('0xc2')](function(){return db[_0xbe14('0xc3')][_0xbe14('0xbf')]({'attributes':['id',_0xbe14('0x29'),_0xbe14('0x45')],'where':{'id':_0x469ef3[_0xbe14('0x6a')][_0xbe14('0xb9')]}});})['then'](function(_0x2c2e46){socket['emit'](_0xbe14('0xc4'),{'id':Number(_0x469ef3[_0xbe14('0xb5')]['id']),'tags':_0x2c2e46||[]});return{'id':Number(_0x469ef3[_0xbe14('0xb5')]['id']),'tags':_0x2c2e46||[]};});}})[_0xbe14('0x24')](respondWithResult(_0x208fae,null))[_0xbe14('0x31')](handleError(_0x208fae,null));};exports['removeTags']=function(_0x5db8e8,_0xe2c9b,_0x161d13){return db[_0xbe14('0xb2')][_0xbe14('0x57')]({'where':{'id':_0x5db8e8['params']['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0xe2c9b,null))[_0xbe14('0x24')](function(_0x25ebee){if(_0x25ebee){return _0x25ebee['removeTags'](_0x5db8e8[_0xbe14('0x37')]['ids']);}})['then'](respondWithStatusCode(_0xe2c9b,null))[_0xbe14('0x31')](handleError(_0xe2c9b,null));};exports[_0xbe14('0xc5')]=function(_0x359608,_0x5322d7){var _0x3ea9c2=moment()[_0xbe14('0xc6')]()['toString']();var _0x4443a7=path[_0xbe14('0xc7')](config[_0xbe14('0xc8')],'server',_0xbe14('0xc9'),_0xbe14('0xca'));var _0x138ca1=path[_0xbe14('0xc7')](config[_0xbe14('0xc8')],'server',_0xbe14('0xc9'),_0xbe14('0xcb'));var _0x1c6bf4=path['join'](_0x4443a7,_0x3ea9c2);var _0x192dce=util[_0xbe14('0xbd')](_0xbe14('0xcc'),_0x359608[_0xbe14('0xb5')]['id'],_0x3ea9c2);var _0x1c8e26=path[_0xbe14('0xc7')](_0x4443a7,_0x192dce);var _0x1b22a0=[];_0x1b22a0[_0xbe14('0xab')]({'model':db[_0xbe14('0x67')],'as':_0xbe14('0x67'),'attributes':['id',_0xbe14('0x2c')],'raw':!![]});_0x1b22a0['push']({'model':db[_0xbe14('0xcd')],'as':_0xbe14('0x5d'),'attributes':['id',_0xbe14('0xce'),'lastName'],'raw':!![]});if(_0x359608[_0xbe14('0x37')][_0xbe14('0xcb')]){_0x1b22a0[_0xbe14('0xab')]({'model':db['Attachment'],'as':_0xbe14('0xcf'),'raw':!![]});}var _0x55b4a1=[{'model':db[_0xbe14('0xb8')],'as':_0xbe14('0xd0'),'attributes':['id','body',_0xbe14('0x72'),_0xbe14('0xd1'),'secret',_0xbe14('0x78')],'include':_0x1b22a0}];_0x55b4a1[_0xbe14('0xab')]({'model':db[_0xbe14('0xd2')],'as':_0xbe14('0xd3'),'attributes':['id',_0xbe14('0x29')]});_0x55b4a1[_0xbe14('0xab')]({'model':db['User'],'as':'Owner','attributes':['id',_0xbe14('0x2c')]});return db[_0xbe14('0xb2')][_0xbe14('0x57')]({'where':{'id':_0x359608[_0xbe14('0xb5')]['id']},'include':_0x55b4a1})['then'](handleEntityNotFound(_0x5322d7,null))[_0xbe14('0x24')](function(_0x4cb29c){if(_0x4cb29c){var _0x3dac28=_0x4cb29c[_0xbe14('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x1c6bf4);var _0x141449={'format':'A4','border':_0xbe14('0xd5'),'header':{'height':_0xbe14('0xd6'),'contents':{'first':_0xbe14('0xd7')}},'footer':{'height':_0xbe14('0xd8'),'contents':{'default':util[_0xbe14('0xbd')](_0xbe14('0xd9'),util[_0xbe14('0xbd')](_0xbe14('0xda'),_0xbe14('0xdb'),_0x3dac28['id']),moment()[_0xbe14('0xbd')](_0xbe14('0xdc'))['toString']())}}};var _0x20f196={'channel':_0xbe14('0xdb'),'account':_0x3dac28[_0xbe14('0xd3')][_0xbe14('0x29')],'agent':_0x3dac28['Owner']?_0x3dac28[_0xbe14('0xdd')][_0xbe14('0x2c')]:'N.A.','createdAt':moment(_0x3dac28[_0xbe14('0x72')])[_0xbe14('0xbd')](_0xbe14('0xbe'))['toString'](),'closedAt':_0x3dac28[_0xbe14('0xde')]?moment(_0x3dac28[_0xbe14('0xdf')])[_0xbe14('0xbd')](_0xbe14('0xbe'))[_0xbe14('0x93')]():'','disposition':_0x3dac28['disposition'],'messages':_(_0x3dac28[_0xbe14('0xd0')])[_0xbe14('0x7d')]({'secret':![]})[_0xbe14('0x2b')](function(_0x3f7732){if(_0x3f7732[_0xbe14('0xcf')]){var _0x5370c5=path[_0xbe14('0xc7')](_0x138ca1,_0x3f7732[_0xbe14('0xcf')][_0xbe14('0xe0')]);if(fs[_0xbe14('0xe1')](_0x5370c5)){fs[_0xbe14('0xe2')](_0x5370c5)[_0xbe14('0xe3')](fs[_0xbe14('0xe4')](path[_0xbe14('0xc7')](_0x1c6bf4,_0x3f7732['Attachment']['basename'])));}}return{'date':moment(_0x3f7732[_0xbe14('0x72')])[_0xbe14('0xbd')](_0xbe14('0xbe'))[_0xbe14('0x93')](),'sender':_0x3f7732[_0xbe14('0xd1')]==='out'?_0x3f7732[_0xbe14('0x67')]?_0x3f7732[_0xbe14('0x67')][_0xbe14('0x2c')]:_0xbe14('0xe5'):_0x3f7732[_0xbe14('0x5d')][_0xbe14('0xce')]+(_0x3f7732[_0xbe14('0x5d')][_0xbe14('0xe6')]?'\x20'+_0x3f7732['Contact'][_0xbe14('0xe6')]:''),'body':_0x3f7732[_0xbe14('0xcf')]?_0x3f7732['Attachment']['basename']:_0x3f7732[_0xbe14('0x6a')],'direction':_0x3f7732['direction']===_0xbe14('0xe7')?'A':'C','secret':_0x3f7732[_0xbe14('0xe8')],'read':_0x3f7732[_0xbe14('0x78')],'attachment':_0x3f7732[_0xbe14('0xcf')]};})[_0xbe14('0x59')]()};return ejs['renderFile'](path[_0xbe14('0xc7')](config[_0xbe14('0xc8')],_0xbe14('0xe9'),_0xbe14('0xea'),_0xbe14('0xeb')),{'interaction':_0x20f196})[_0xbe14('0x24')](function(_0x4df025){return new BPromise(function(_0x4eea48,_0x2e681e){pdf['create'](_0x4df025,_0x141449)[_0xbe14('0xec')](path[_0xbe14('0xc7')](_0x1c6bf4,_0xbe14('0xed')+_0x3dac28['id']+'-'+_0x3ea9c2+'.pdf'),function(_0x42b665,_0x2a090){if(_0x42b665)return _0x2e681e(_0x42b665);_0x4eea48(_0x2a090);});});})[_0xbe14('0x24')](function(){return new BPromise(function(_0x1ad15d,_0x41a064){zipdir(_0x1c6bf4,{'saveTo':_0x1c8e26},function(_0x2e5106,_0x156fb3){if(_0x2e5106)return _0x41a064(_0x2e5106);return _0x1ad15d(_0x156fb3);});})['then'](function(){return new BPromise(function(_0x2fd64c,_0x5d5fad){rimraf(_0x1c6bf4,function(_0x5e8d27){if(_0x5e8d27)_0x5d5fad(_0x5e8d27);return _0x2fd64c();});});})['then'](function(){return _0x5322d7['download'](_0x1c8e26,_0x192dce,function(_0x1b2a71){if(_0x1b2a71){console[_0xbe14('0xee')]('err',_0x1b2a71);}else{fs[_0xbe14('0xef')](_0x1c8e26);}});});});}else{return _0x5322d7['sendStatus'](0xc8);}})[_0xbe14('0x31')](handleError(_0x5322d7,null));}; \ No newline at end of file +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(_0x1124b6,_0x35be37){var _0x1074e8=function(_0xb21e42){while(--_0xb21e42){_0x1124b6['push'](_0x1124b6['shift']());}};_0x1074e8(++_0x35be37);}(_0x814b,0x1a2));var _0xb814=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x814b[_0x59ae8f];return _0x3900b5;};'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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 7bffcbe..088fdef 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 _0x5bc5=['setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x5bc5,0x186));var _0x55bc=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x5bc5[_0xaa0309];return _0x5de7ce;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x55bc('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x55bc('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x55bc('0x1')](0x0);var events={'afterCreate':_0x55bc('0x2'),'afterUpdate':_0x55bc('0x3'),'afterDestroy':_0x55bc('0x4')};function emitEvent(_0x347851){return function(_0x2df8a3,_0xd211b2,_0x328cf8){_0x2df8a3[_0x55bc('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2d30a5){_0x2df8a3[_0x55bc('0x6')]('Users',_0x2d30a5[_0x55bc('0x7')](function(_0x5bf50d){return{'id':_0x5bf50d['id']};}));return WhatsappMessage[_0x55bc('0x8')]({'where':{'WhatsappInteractionId':_0x2df8a3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x55bc('0x9')](function(_0x1d9571){_0x2df8a3[_0x55bc('0x6')](_0x55bc('0xa'),_0x1d9571[_0x55bc('0xb')]);WhatsappInteractionEvents[_0x55bc('0xc')](_0x347851+':'+_0x2df8a3['id'],_0x2df8a3);WhatsappInteractionEvents['emit'](_0x347851,_0x2df8a3);_0x328cf8(null);})[_0x55bc('0xd')](_0x328cf8(null));};}for(var e in events){if(events[_0x55bc('0xe')](e)){var event=events[e];WhatsappInteraction[_0x55bc('0xf')](e,emitEvent(event));}}module[_0x55bc('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc457=['map','findAll','then','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','getUsers','setDataValue','Users'];(function(_0x1169db,_0x5385cd){var _0x2d04a6=function(_0x14b85d){while(--_0x14b85d){_0x1169db['push'](_0x1169db['shift']());}};_0x2d04a6(++_0x5385cd);}(_0xc457,0xbc));var _0x7c45=function(_0x5ef942,_0x5a8f46){_0x5ef942=_0x5ef942-0x0;var _0x113f1f=_0xc457[_0x5ef942];return _0x113f1f;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x7c45('0x0'))['db'][_0x7c45('0x1')];var WhatsappMessage=require(_0x7c45('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7c45('0x2')](0x0);var events={'afterCreate':_0x7c45('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32386e){return function(_0x3de364,_0xb2f941,_0x2c499c){_0x3de364[_0x7c45('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x20962d){_0x3de364[_0x7c45('0x5')](_0x7c45('0x6'),_0x20962d[_0x7c45('0x7')](function(_0x43ae95){return{'id':_0x43ae95['id']};}));return WhatsappMessage[_0x7c45('0x8')]({'where':{'WhatsappInteractionId':_0x3de364['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c45('0x9')](function(_0x4cdb76){_0x3de364[_0x7c45('0x5')](_0x7c45('0xa'),_0x4cdb76['length']);WhatsappInteractionEvents[_0x7c45('0xb')](_0x32386e+':'+_0x3de364['id'],_0x3de364);WhatsappInteractionEvents['emit'](_0x32386e,_0x3de364);_0x2c499c(null);})['catch'](_0x2c499c(null));};}for(var e in events){if(events[_0x7c45('0xc')](e)){var event=events[e];WhatsappInteraction[_0x7c45('0xd')](e,emitEvent(event));}}module[_0x7c45('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 1654d85..1243a55 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(_0x4ca7d8,_0x18d1d1){var _0x436c42=function(_0x5aa144){while(--_0x5aa144){_0x4ca7d8['push'](_0x4ca7d8['shift']());}};_0x436c42(++_0x18d1d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x13fa8f,_0x195308){var _0x52ebf0=function(_0x11dfde){while(--_0x11dfde){_0x13fa8f['push'](_0x13fa8f['shift']());}};_0x52ebf0(++_0x195308);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 4a35028..7850fca 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 _0xa056=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','raw','limit','AddTagsToWhatsappInteraction','find','where','addTags','ids','body'];(function(_0x28efdc,_0x5bc5a4){var _0x35f396=function(_0x2c6762){while(--_0x2c6762){_0x28efdc['push'](_0x28efdc['shift']());}};_0x35f396(++_0x5bc5a4);}(_0xa056,0x13a));var _0x6a05=function(_0x544c32,_0x2c3406){_0x544c32=_0x544c32-0x0;var _0x5abd2c=_0xa056[_0x544c32];return _0x5abd2c;};'use strict';var _=require(_0x6a05('0x0'));var util=require(_0x6a05('0x1'));var moment=require(_0x6a05('0x2'));var BPromise=require(_0x6a05('0x3'));var rs=require(_0x6a05('0x4'));var fs=require('fs');var Redis=require(_0x6a05('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a05('0x6'));var logger=require(_0x6a05('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6a05('0x8'));var client=jayson[_0x6a05('0x9')][_0x6a05('0xa')]({'port':0x232a});config[_0x6a05('0xb')]=_[_0x6a05('0xc')](config[_0x6a05('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6a05('0xd'))[_0x6a05('0xe')](socket);function respondWithRpcPromise(_0x235c52,_0x5e174f,_0xf7ad99){return new BPromise(function(_0x5abfd2,_0x5ee21f){return client['request'](_0x235c52,_0xf7ad99)[_0x6a05('0xf')](function(_0x5143fd){logger[_0x6a05('0x10')](_0x6a05('0x11'),_0x5e174f,_0x6a05('0x12'));logger[_0x6a05('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5e174f,'request\x20sent',JSON[_0x6a05('0x14')](_0x5143fd));if(_0x5143fd['error']){if(_0x5143fd[_0x6a05('0x15')][_0x6a05('0x16')]===0x1f4){logger[_0x6a05('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x5e174f,_0x5143fd['error'][_0x6a05('0x17')]);return _0x5ee21f(_0x5143fd[_0x6a05('0x15')][_0x6a05('0x17')]);}logger[_0x6a05('0x15')](_0x6a05('0x11'),_0x5e174f,_0x5143fd[_0x6a05('0x15')][_0x6a05('0x17')]);return _0x5abfd2(_0x5143fd['error'][_0x6a05('0x17')]);}else{logger[_0x6a05('0x10')](_0x6a05('0x11'),_0x5e174f,_0x6a05('0x12'));_0x5abfd2(_0x5143fd[_0x6a05('0x18')][_0x6a05('0x17')]);}})[_0x6a05('0x19')](function(_0x143749){logger[_0x6a05('0x15')](_0x6a05('0x11'),_0x5e174f,_0x143749);_0x5ee21f(_0x143749);});});}exports[_0x6a05('0x1a')]=function(_0x2e0441){var _0x4221c3=this;return new Promise(function(_0x2dbafb,_0x792159){return db[_0x6a05('0x1b')]['update'](_0x2e0441['body'],{'raw':_0x2e0441[_0x6a05('0x1c')]?_0x2e0441[_0x6a05('0x1c')][_0x6a05('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e0441['options']?_0x2e0441['options']['where']||null:null,'attributes':_0x2e0441[_0x6a05('0x1c')]?_0x2e0441[_0x6a05('0x1c')]['attributes']||null:null,'limit':_0x2e0441[_0x6a05('0x1c')]?_0x2e0441['options'][_0x6a05('0x1e')]||null:null})[_0x6a05('0xf')](function(_0xf738ff){logger[_0x6a05('0x10')]('UpdateWhatsappInteraction',_0x2e0441);logger[_0x6a05('0x13')](_0x6a05('0x1a'),_0x2e0441,JSON[_0x6a05('0x14')](_0xf738ff));_0x2dbafb(_0xf738ff);})[_0x6a05('0x19')](function(_0x5be7aa){logger[_0x6a05('0x15')](_0x6a05('0x1a'),_0x5be7aa['message'],_0x2e0441);_0x792159(_0x4221c3['error'](0x1f4,_0x5be7aa[_0x6a05('0x17')]));});});};exports[_0x6a05('0x1f')]=function(_0x5e76f3){return new Promise(function(_0x1bfa66,_0x20c7d7){return db['WhatsappInteraction'][_0x6a05('0x20')]({'where':_0x5e76f3[_0x6a05('0x1c')]?_0x5e76f3[_0x6a05('0x1c')][_0x6a05('0x21')]||null:null})[_0x6a05('0xf')](function(_0x38276e){if(_0x38276e){return _0x38276e[_0x6a05('0x22')](_0x5e76f3['body'][_0x6a05('0x23')],_['omit'](_0x5e76f3[_0x6a05('0x24')],[_0x6a05('0x23'),'id'])||{});}})[_0x6a05('0x25')](function(_0x139c85){logger[_0x6a05('0x10')](_0x6a05('0x26'),_0x5e76f3);logger[_0x6a05('0x13')]('AddTags',_0x5e76f3,JSON[_0x6a05('0x14')](_0x139c85));_0x1bfa66(_0x139c85);})[_0x6a05('0x19')](function(_0x2069b9){logger[_0x6a05('0x15')](_0x6a05('0x26'),_0x2069b9[_0x6a05('0x17')],_0x5e76f3);_0x20c7d7(_this[_0x6a05('0x15')](0x1f4,_0x2069b9[_0x6a05('0x17')]));});});}; \ No newline at end of file +var _0xcf08=['message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x575500,_0x5f06b7){var _0xba27d2=function(_0x32cf55){while(--_0x32cf55){_0x575500['push'](_0x575500['shift']());}};_0xba27d2(++_0x5f06b7);}(_0xcf08,0x11b));var _0x8cf0=function(_0x43b20d,_0x3dbeca){_0x43b20d=_0x43b20d-0x0;var _0x5e3411=_0xcf08[_0x43b20d];return _0x5e3411;};'use strict';var _=require(_0x8cf0('0x0'));var util=require(_0x8cf0('0x1'));var moment=require(_0x8cf0('0x2'));var BPromise=require(_0x8cf0('0x3'));var rs=require(_0x8cf0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cf0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8cf0('0x6'));var config=require(_0x8cf0('0x7'));var jayson=require(_0x8cf0('0x8'));var client=jayson[_0x8cf0('0x9')][_0x8cf0('0xa')]({'port':0x232a});config[_0x8cf0('0xb')]=_[_0x8cf0('0xc')](config[_0x8cf0('0xb')],{'host':_0x8cf0('0xd'),'port':0x18eb});var socket=require(_0x8cf0('0xe'))(new Redis(config[_0x8cf0('0xb')]));require(_0x8cf0('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d5e5f,_0x45f2b4,_0x512d69){return new BPromise(function(_0x355d14,_0x1c212a){return client[_0x8cf0('0x10')](_0x5d5e5f,_0x512d69)[_0x8cf0('0x11')](function(_0x484fbf){logger['info'](_0x8cf0('0x12'),_0x45f2b4,'request\x20sent');logger[_0x8cf0('0x13')](_0x8cf0('0x14'),_0x45f2b4,_0x8cf0('0x15'),JSON[_0x8cf0('0x16')](_0x484fbf));if(_0x484fbf[_0x8cf0('0x17')]){if(_0x484fbf['error'][_0x8cf0('0x18')]===0x1f4){logger[_0x8cf0('0x17')](_0x8cf0('0x12'),_0x45f2b4,_0x484fbf[_0x8cf0('0x17')][_0x8cf0('0x19')]);return _0x1c212a(_0x484fbf[_0x8cf0('0x17')][_0x8cf0('0x19')]);}logger[_0x8cf0('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x45f2b4,_0x484fbf[_0x8cf0('0x17')][_0x8cf0('0x19')]);return _0x355d14(_0x484fbf[_0x8cf0('0x17')][_0x8cf0('0x19')]);}else{logger[_0x8cf0('0x1a')](_0x8cf0('0x12'),_0x45f2b4,_0x8cf0('0x15'));_0x355d14(_0x484fbf[_0x8cf0('0x1b')][_0x8cf0('0x19')]);}})[_0x8cf0('0x1c')](function(_0x1f9155){logger['error'](_0x8cf0('0x12'),_0x45f2b4,_0x1f9155);_0x1c212a(_0x1f9155);});});}exports[_0x8cf0('0x1d')]=function(_0x3b53d4){var _0x55f843=this;return new Promise(function(_0x579185,_0x1234be){return db[_0x8cf0('0x1e')][_0x8cf0('0x1f')](_0x3b53d4[_0x8cf0('0x20')],{'raw':_0x3b53d4[_0x8cf0('0x21')]?_0x3b53d4['options'][_0x8cf0('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b53d4['options']?_0x3b53d4['options'][_0x8cf0('0x23')]||null:null,'attributes':_0x3b53d4[_0x8cf0('0x21')]?_0x3b53d4['options'][_0x8cf0('0x24')]||null:null,'limit':_0x3b53d4[_0x8cf0('0x21')]?_0x3b53d4[_0x8cf0('0x21')]['limit']||null:null})[_0x8cf0('0x11')](function(_0x2fa51f){logger[_0x8cf0('0x1a')](_0x8cf0('0x1d'),_0x3b53d4);logger[_0x8cf0('0x13')](_0x8cf0('0x1d'),_0x3b53d4,JSON['stringify'](_0x2fa51f));_0x579185(_0x2fa51f);})[_0x8cf0('0x1c')](function(_0x292e01){logger[_0x8cf0('0x17')](_0x8cf0('0x1d'),_0x292e01[_0x8cf0('0x19')],_0x3b53d4);_0x1234be(_0x55f843[_0x8cf0('0x17')](0x1f4,_0x292e01[_0x8cf0('0x19')]));});});};exports[_0x8cf0('0x25')]=function(_0x2b3159){return new Promise(function(_0x443b3a,_0x11392d){return db[_0x8cf0('0x1e')][_0x8cf0('0x26')]({'where':_0x2b3159['options']?_0x2b3159['options']['where']||null:null})[_0x8cf0('0x11')](function(_0x3ff79d){if(_0x3ff79d){return _0x3ff79d[_0x8cf0('0x27')](_0x2b3159['body']['ids'],_[_0x8cf0('0x28')](_0x2b3159[_0x8cf0('0x20')],[_0x8cf0('0x29'),'id'])||{});}})[_0x8cf0('0x2a')](function(_0x3ee251){logger[_0x8cf0('0x1a')](_0x8cf0('0x2b'),_0x2b3159);logger[_0x8cf0('0x13')]('AddTags',_0x2b3159,JSON[_0x8cf0('0x16')](_0x3ee251));_0x443b3a(_0x3ee251);})[_0x8cf0('0x1c')](function(_0x3cd721){logger[_0x8cf0('0x17')]('AddTags',_0x3cd721[_0x8cf0('0x19')],_0x2b3159);_0x11392d(_this['error'](0x1f4,_0x3cd721[_0x8cf0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index afc09c0..fbfee6a 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 _0xcad6=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit'];(function(_0x49a138,_0x559cad){var _0x446308=function(_0x35a1e5){while(--_0x35a1e5){_0x49a138['push'](_0x49a138['shift']());}};_0x446308(++_0x559cad);}(_0xcad6,0x81));var _0x6cad=function(_0x2dd8d0,_0x45af9c){_0x2dd8d0=_0x2dd8d0-0x0;var _0x34540e=_0xcad6[_0x2dd8d0];return _0x34540e;};'use strict';var WhatsappInteractionEvents=require(_0x6cad('0x0'));var events=['save',_0x6cad('0x1'),_0x6cad('0x2')];function createListener(_0x33321d,_0x3d6dfa){return function(_0x317de7){_0x3d6dfa[_0x6cad('0x3')](_0x33321d,_0x317de7);};}function removeListener(_0x4c1197,_0x58f85a){return function(){WhatsappInteractionEvents[_0x6cad('0x4')](_0x4c1197,_0x58f85a);};}exports['register']=function(_0x27be51){for(var _0x2b1483=0x0,_0x5039a7=events[_0x6cad('0x5')];_0x2b1483<_0x5039a7;_0x2b1483++){var _0x5acfb7=events[_0x2b1483];var _0x642dc7=createListener(_0x6cad('0x6')+_0x5acfb7,_0x27be51);WhatsappInteractionEvents['on'](_0x5acfb7,_0x642dc7);}}; \ No newline at end of file +var _0x5232=['length','./whatsappInteraction.events','save','update','removeListener','register'];(function(_0x25b5c1,_0x15f706){var _0x15cb0d=function(_0x269d4e){while(--_0x269d4e){_0x25b5c1['push'](_0x25b5c1['shift']());}};_0x15cb0d(++_0x15f706);}(_0x5232,0x9d));var _0x2523=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x5232[_0x2b0bc2];return _0x56e5b9;};'use strict';var WhatsappInteractionEvents=require(_0x2523('0x0'));var events=[_0x2523('0x1'),'remove',_0x2523('0x2')];function createListener(_0x324f42,_0x37d1ff){return function(_0x75f40b){_0x37d1ff['emit'](_0x324f42,_0x75f40b);};}function removeListener(_0x2d84a9,_0x1700c8){return function(){WhatsappInteractionEvents[_0x2523('0x3')](_0x2d84a9,_0x1700c8);};}exports[_0x2523('0x4')]=function(_0x3e113c){for(var _0x387253=0x0,_0x31541d=events[_0x2523('0x5')];_0x387253<_0x31541d;_0x387253++){var _0xdfa59d=events[_0x387253];var _0x460679=createListener('whatsappInteraction:'+_0xdfa59d,_0x3e113c);WhatsappInteractionEvents['on'](_0xdfa59d,_0x460679);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 163bd86..a0d5422 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 _0x5bac=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','/:id','post','isAuthenticated','tracked','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x345ab5,_0x452df3){var _0x41c8d4=function(_0x8375dd){while(--_0x8375dd){_0x345ab5['push'](_0x345ab5['shift']());}};_0x41c8d4(++_0x452df3);}(_0x5bac,0x1e2));var _0xc5ba=function(_0x5625b8,_0x2b1e8d){_0x5625b8=_0x5625b8-0x0;var _0xe173f7=_0x5bac[_0x5625b8];return _0xe173f7;};'use strict';var multer=require(_0xc5ba('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc5ba('0x1'));var express=require(_0xc5ba('0x2'));var router=express['Router']();var auth=require(_0xc5ba('0x3'));var interaction=require(_0xc5ba('0x4'));var config=require(_0xc5ba('0x5'));var controller=require(_0xc5ba('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc5ba('0x7')]);router[_0xc5ba('0x8')](_0xc5ba('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xc5ba('0x8')](_0xc5ba('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc5ba('0xb')]('/',auth[_0xc5ba('0xc')](),interaction[_0xc5ba('0xd')]('whatsapp','whatsappmessage:create'),controller[_0xc5ba('0xe')]);router['post'](_0xc5ba('0xf'),controller['status']);router[_0xc5ba('0x10')](_0xc5ba('0xa'),auth[_0xc5ba('0xc')](),controller[_0xc5ba('0x11')]);router[_0xc5ba('0x10')](_0xc5ba('0x12'),auth[_0xc5ba('0xc')](),controller[_0xc5ba('0x13')]);router['put'](_0xc5ba('0x14'),auth[_0xc5ba('0xc')](),controller[_0xc5ba('0x15')]);router['delete'](_0xc5ba('0xa'),auth[_0xc5ba('0xc')](),controller[_0xc5ba('0x16')]);module[_0xc5ba('0x17')]=router; \ No newline at end of file +var _0xefaa=['put','update','/:id/accept','accept','reject','delete','destroy','util','path','express','get','isAuthenticated','index','describe','/:id','post','tracked','create','/:id/status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefaa,0x1a9));var _0xaefa=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xefaa[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require('multer');var util=require(_0xaefa('0x0'));var path=require(_0xaefa('0x1'));var timeout=require('connect-timeout');var express=require(_0xaefa('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xaefa('0x3')]('/',auth[_0xaefa('0x4')](),controller[_0xaefa('0x5')]);router['get']('/describe',auth[_0xaefa('0x4')](),controller[_0xaefa('0x6')]);router[_0xaefa('0x3')](_0xaefa('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xaefa('0x8')]('/',auth[_0xaefa('0x4')](),interaction[_0xaefa('0x9')]('whatsapp','whatsappmessage:create'),controller[_0xaefa('0xa')]);router[_0xaefa('0x8')](_0xaefa('0xb'),controller['status']);router[_0xaefa('0xc')](_0xaefa('0x7'),auth['isAuthenticated'](),controller[_0xaefa('0xd')]);router[_0xaefa('0xc')](_0xaefa('0xe'),auth[_0xaefa('0x4')](),controller[_0xaefa('0xf')]);router[_0xaefa('0xc')]('/:id/reject',auth[_0xaefa('0x4')](),controller[_0xaefa('0x10')]);router[_0xaefa('0x11')]('/:id',auth[_0xaefa('0x4')](),controller[_0xaefa('0x12')]);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 8acb4de..c70599b 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 _0xafca=['BOOLEAN','out','STRING','DATE','exports','TEXT'];(function(_0x24ee0e,_0x5deadb){var _0x11b7b0=function(_0x434f52){while(--_0x434f52){_0x24ee0e['push'](_0x24ee0e['shift']());}};_0x11b7b0(++_0x5deadb);}(_0xafca,0x106));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xaafc('0x0')]={'body':{'type':Sequelize[_0xaafc('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xaafc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaafc('0x3')),'defaultValue':_0xaafc('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xaafc('0x4')]},'readAt':{'type':Sequelize[_0xaafc('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2631=['out','STRING','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x4403e0,_0x2d0eec){var _0x5b0967=function(_0x526072){while(--_0x526072){_0x4403e0['push'](_0x4403e0['shift']());}};_0x5b0967(++_0x2d0eec);}(_0x2631,0x173));var _0x1263=function(_0x4c5611,_0x4ea142){_0x4c5611=_0x4c5611-0x0;var _0x453fe3=_0x2631[_0x4c5611];return _0x453fe3;};'use strict';var Sequelize=require(_0x1263('0x0'));module[_0x1263('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1263('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1263('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1263('0x4')]('in',_0x1263('0x5')),'defaultValue':_0x1263('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1263('0x6')](0xbe)},'phone':{'type':Sequelize[_0x1263('0x6')]},'readAt':{'type':Sequelize[_0x1263('0x7')]},'secret':{'type':Sequelize[_0x1263('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ff1dcfd..c93a76a 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 _0xcf59=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','merge','VIRTUAL','filter','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','accept','whatsapp','read','readAt','format','UserId','CmContact','get','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','stringify','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x9709ce,_0x5765af){var _0x414c87=function(_0x51149b){while(--_0x51149b){_0x9709ce['push'](_0x9709ce['shift']());}};_0x414c87(++_0x5765af);}(_0xcf59,0x71));var _0x9cf5=function(_0x2e97bf,_0x569e2b){_0x2e97bf=_0x2e97bf-0x0;var _0x3b2110=_0xcf59[_0x2e97bf];return _0x3b2110;};'use strict';var pdf=require(_0x9cf5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cf5('0x1'));var zipdir=require(_0x9cf5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cf5('0x3'));var moment=require(_0x9cf5('0x4'));var BPromise=require(_0x9cf5('0x5'));var Mustache=require(_0x9cf5('0x6'));var util=require('util');var path=require(_0x9cf5('0x7'));var sox=require(_0x9cf5('0x8'));var csv=require(_0x9cf5('0x9'));var ejs=require(_0x9cf5('0xa'));var fs=require('fs');var _=require(_0x9cf5('0xb'));var squel=require('squel');var crypto=require(_0x9cf5('0xc'));var jsforce=require(_0x9cf5('0xd'));var deskjs=require(_0x9cf5('0xe'));var toCsv=require(_0x9cf5('0x9'));var querystring=require('querystring');var Papa=require(_0x9cf5('0xf'));var Redis=require(_0x9cf5('0x10'));var authService=require(_0x9cf5('0x11'));var qs=require(_0x9cf5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cf5('0x13'));var logger=require(_0x9cf5('0x14'))(_0x9cf5('0x15'));var utils=require(_0x9cf5('0x16'));var config=require(_0x9cf5('0x17'));var db=require(_0x9cf5('0x18'))['db'];config[_0x9cf5('0x19')]=_[_0x9cf5('0x1a')](config[_0x9cf5('0x19')],{'host':_0x9cf5('0x1b'),'port':0x18eb});var socket=require(_0x9cf5('0x1c'))(new Redis(config[_0x9cf5('0x19')]));require(_0x9cf5('0x1d'))[_0x9cf5('0x1e')](socket);var jayson=require(_0x9cf5('0x1f'));var client=jayson[_0x9cf5('0x20')][_0x9cf5('0x21')]({'port':0x232c});var client9002=jayson[_0x9cf5('0x20')][_0x9cf5('0x21')]({'port':0x232a});function checkPasswordPattern(_0x45e869,_0x5f420b,_0x40059f){if(_0x40059f){var _0x54d674=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54d674['test'](_0x5f420b)){return _0x45e869;}else{throw new db[(_0x9cf5('0x22'))][(_0x9cf5('0x23'))](_0x9cf5('0x24'));}}else{return _0x45e869;}}function respondWithRpcPromise(_0x37f18f,_0xb6d853,_0x58e76a,_0x57a5fc){return new BPromise(function(_0x65bdce,_0x27bd59){var _0x2ea5c0=_0x57a5fc||client;return _0x2ea5c0[_0x9cf5('0x25')](_0x37f18f,_0x58e76a)[_0x9cf5('0x26')](function(_0x48c4a9){logger[_0x9cf5('0x27')](_0x9cf5('0x28'),_0xb6d853,_0x9cf5('0x29'));logger[_0x9cf5('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb6d853,'request\x20sent',JSON['stringify'](_0x48c4a9));if(_0x48c4a9[_0x9cf5('0x2b')]){if(_0x48c4a9[_0x9cf5('0x2b')][_0x9cf5('0x2c')]===0x1f4){logger[_0x9cf5('0x2b')](_0x9cf5('0x28'),_0xb6d853,_0x48c4a9[_0x9cf5('0x2b')][_0x9cf5('0x2d')]);return _0x27bd59(_0x48c4a9[_0x9cf5('0x2b')]['message']);}logger[_0x9cf5('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0xb6d853,_0x48c4a9[_0x9cf5('0x2b')][_0x9cf5('0x2d')]);return _0x65bdce(_0x48c4a9['error'][_0x9cf5('0x2d')]);}else{logger[_0x9cf5('0x27')](_0x9cf5('0x28'),_0xb6d853,_0x9cf5('0x29'));_0x65bdce(_0x48c4a9[_0x9cf5('0x2e')][_0x9cf5('0x2d')]);}})['catch'](function(_0x2a2135){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xb6d853,_0x2a2135);_0x27bd59(_0x2a2135);});});}function respondWithStatusCode(_0x1e871d,_0x5d8700){_0x5d8700=_0x5d8700||0xcc;return function(_0x566a88){if(_0x566a88){return _0x1e871d['sendStatus'](_0x5d8700);}return _0x1e871d[_0x9cf5('0x2f')](_0x5d8700)['end']();};}function respondWithResult(_0x450985,_0x1a16d2){_0x1a16d2=_0x1a16d2||0xc8;return function(_0x67f9f4){if(_0x67f9f4){return _0x450985[_0x9cf5('0x2f')](_0x1a16d2)[_0x9cf5('0x30')](_0x67f9f4);}};}function respondWithFilteredResult(_0x3dbaea,_0x42c4a6){return function(_0x8216e1){if(_0x8216e1){var _0x1a7e35=_0x8216e1[_0x9cf5('0x31')],_0x265459=_0x42c4a6[_0x9cf5('0x32')],_0xef4f5=_0x42c4a6[_0x9cf5('0x32')]+_0x42c4a6[_0x9cf5('0x33')],_0x2e0f75;if(_0xef4f5>=_0x1a7e35){_0xef4f5=_0x1a7e35;_0x2e0f75=0xc8;}else{_0x2e0f75=0xce;}_0x3dbaea['status'](_0x2e0f75);return _0x3dbaea[_0x9cf5('0x34')](_0x9cf5('0x35'),_0x265459+'-'+_0xef4f5+'/'+_0x1a7e35)['json'](_0x8216e1);}return null;};}function patchUpdates(_0x1e89b5){return function(_0x2ff47b){try{jsonpatch[_0x9cf5('0x36')](_0x2ff47b,_0x1e89b5,!![]);}catch(_0x29aeec){return BPromise['reject'](_0x29aeec);}return _0x2ff47b[_0x9cf5('0x37')]();};}function saveUpdates(_0x22b7ca,_0x2e6afc){return function(_0x3829c8){if(_0x3829c8){return _0x3829c8[_0x9cf5('0x38')](_0x22b7ca)['then'](function(_0x53f43c){return _0x53f43c;});}return null;};}function removeEntity(_0x10584e,_0x4a5fb2){return function(_0x238caa){if(_0x238caa){return _0x238caa[_0x9cf5('0x39')]()[_0x9cf5('0x26')](function(){_0x10584e[_0x9cf5('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d6ce,_0x44b022){return function(_0x2c62b6){if(!_0x2c62b6){_0x16d6ce[_0x9cf5('0x3a')](0x194);}return _0x2c62b6;};}function handleError(_0x298326,_0x32c86c){_0x32c86c=_0x32c86c||0x1f4;return function(_0x167446){logger['error'](_0x167446['stack']);if(_0x167446[_0x9cf5('0x3b')]){delete _0x167446[_0x9cf5('0x3b')];}_0x298326[_0x9cf5('0x2f')](_0x32c86c)[_0x9cf5('0x3c')](_0x167446);};}exports['index']=function(_0x24f178,_0x2e084c){var _0x49cb5f={},_0x1a77e1={},_0x568a37={'count':0x0,'rows':[]};var _0x2a07f4=_[_0x9cf5('0x3d')](db[_0x9cf5('0x3e')][_0x9cf5('0x3f')],function(_0x5743ca){return{'name':_0x5743ca[_0x9cf5('0x40')],'type':_0x5743ca[_0x9cf5('0x41')][_0x9cf5('0x42')]};});_0x1a77e1['model']=_[_0x9cf5('0x3d')](_0x2a07f4,_0x9cf5('0x3b'));_0x1a77e1[_0x9cf5('0x43')]=_[_0x9cf5('0x44')](_0x24f178[_0x9cf5('0x43')]);_0x1a77e1[_0x9cf5('0x45')]=_[_0x9cf5('0x46')](_0x1a77e1['model'],_0x1a77e1['query']);_0x49cb5f['attributes']=_['intersection'](_0x1a77e1[_0x9cf5('0x47')],qs[_0x9cf5('0x48')](_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x48')]));_0x49cb5f[_0x9cf5('0x49')]=_0x49cb5f[_0x9cf5('0x49')][_0x9cf5('0x4a')]?_0x49cb5f[_0x9cf5('0x49')]:_0x1a77e1[_0x9cf5('0x47')];if(!_0x24f178[_0x9cf5('0x43')]['hasOwnProperty'](_0x9cf5('0x4b'))){_0x49cb5f[_0x9cf5('0x33')]=qs[_0x9cf5('0x33')](_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x33')]);_0x49cb5f['offset']=qs['offset'](_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x32')]);}_0x49cb5f['order']=qs[_0x9cf5('0x4c')](_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x4c')]);_0x49cb5f['where']=qs[_0x9cf5('0x45')](_['pick'](_0x24f178['query'],_0x1a77e1['filters']),_0x2a07f4);if(_0x24f178[_0x9cf5('0x43')]['filter']){_0x49cb5f['where']=_[_0x9cf5('0x4d')](_0x49cb5f['where'],{'$or':_[_0x9cf5('0x3d')](_0x2a07f4,function(_0xcc8d4c){if(_0xcc8d4c['type']!==_0x9cf5('0x4e')){var _0x6cd745={};_0x6cd745[_0xcc8d4c[_0x9cf5('0x3b')]]={'$like':'%'+_0x24f178['query'][_0x9cf5('0x4f')]+'%'};return _0x6cd745;}})});}_0x49cb5f=_[_0x9cf5('0x4d')]({},_0x49cb5f,_0x24f178['options']);var _0x3fa409={'where':_0x49cb5f['where']};return db[_0x9cf5('0x3e')][_0x9cf5('0x31')](_0x3fa409)[_0x9cf5('0x26')](function(_0x1522be){_0x568a37['count']=_0x1522be;if(_0x24f178[_0x9cf5('0x43')][_0x9cf5('0x50')]){_0x49cb5f['include']=[{'all':!![]}];}return db[_0x9cf5('0x3e')][_0x9cf5('0x51')](_0x49cb5f);})[_0x9cf5('0x26')](function(_0x177736){_0x568a37['rows']=_0x177736;return _0x568a37;})[_0x9cf5('0x26')](respondWithFilteredResult(_0x2e084c,_0x49cb5f))[_0x9cf5('0x52')](handleError(_0x2e084c,null));};exports[_0x9cf5('0x53')]=function(_0x5426a0,_0x3c11ad){var _0x31c81a={'raw':!![],'where':{'id':_0x5426a0[_0x9cf5('0x54')]['id']}},_0x39610e={};_0x39610e[_0x9cf5('0x47')]=_[_0x9cf5('0x44')](db[_0x9cf5('0x3e')]['rawAttributes']);_0x39610e[_0x9cf5('0x43')]=_[_0x9cf5('0x44')](_0x5426a0['query']);_0x39610e[_0x9cf5('0x45')]=_[_0x9cf5('0x46')](_0x39610e[_0x9cf5('0x47')],_0x39610e[_0x9cf5('0x43')]);_0x31c81a['attributes']=_[_0x9cf5('0x46')](_0x39610e[_0x9cf5('0x47')],qs[_0x9cf5('0x48')](_0x5426a0['query'][_0x9cf5('0x48')]));_0x31c81a[_0x9cf5('0x49')]=_0x31c81a[_0x9cf5('0x49')][_0x9cf5('0x4a')]?_0x31c81a[_0x9cf5('0x49')]:_0x39610e[_0x9cf5('0x47')];if(_0x5426a0[_0x9cf5('0x43')]['includeAll']){_0x31c81a[_0x9cf5('0x55')]=[{'all':!![]}];}_0x31c81a=_[_0x9cf5('0x4d')]({},_0x31c81a,_0x5426a0[_0x9cf5('0x56')]);return db['WhatsappMessage'][_0x9cf5('0x57')](_0x31c81a)['then'](handleEntityNotFound(_0x3c11ad,null))[_0x9cf5('0x26')](respondWithResult(_0x3c11ad,null))[_0x9cf5('0x52')](handleError(_0x3c11ad,null));};exports[_0x9cf5('0x58')]=function(_0x558b55,_0x1b2b15){return db[_0x9cf5('0x3e')][_0x9cf5('0x58')](_0x558b55[_0x9cf5('0x59')],{})[_0x9cf5('0x26')](respondWithResult(_0x1b2b15,0xc9))[_0x9cf5('0x52')](handleError(_0x1b2b15,null));};exports[_0x9cf5('0x38')]=function(_0x25ac78,_0x1891e3){if(_0x25ac78[_0x9cf5('0x59')]['id']){delete _0x25ac78[_0x9cf5('0x59')]['id'];}return db[_0x9cf5('0x3e')][_0x9cf5('0x57')]({'where':{'id':_0x25ac78[_0x9cf5('0x54')]['id']}})[_0x9cf5('0x26')](handleEntityNotFound(_0x1891e3,null))['then'](saveUpdates(_0x25ac78[_0x9cf5('0x59')],null))['then'](respondWithResult(_0x1891e3,null))['catch'](handleError(_0x1891e3,null));};exports[_0x9cf5('0x39')]=function(_0x1bf6a9,_0x4dab63){return db[_0x9cf5('0x3e')][_0x9cf5('0x57')]({'where':{'id':_0x1bf6a9[_0x9cf5('0x54')]['id']}})['then'](handleEntityNotFound(_0x4dab63,null))[_0x9cf5('0x26')](removeEntity(_0x4dab63,null))['catch'](handleError(_0x4dab63,null));};exports['describe']=function(_0xa1ffe6,_0x572633){return db['WhatsappMessage'][_0x9cf5('0x5a')]()[_0x9cf5('0x26')](respondWithResult(_0x572633,null))['catch'](handleError(_0x572633,null));};var interaction_log=require(_0x9cf5('0x14'))('whatsapp-interactions');exports[_0x9cf5('0x5b')]=function(_0xd4db54,_0xef58cc,_0x35e1ab){var _0x567aa6={'channel':_0x9cf5('0x5c')};if(_0xd4db54[_0x9cf5('0x59')]['id']){delete _0xd4db54[_0x9cf5('0x59')]['id'];}_0xd4db54[_0x9cf5('0x59')][_0x9cf5('0x5d')]=!![];_0xd4db54['body'][_0x9cf5('0x5e')]=moment()[_0x9cf5('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0xd4db54[_0x9cf5('0x59')][_0x9cf5('0x60')]=_0xd4db54[_0x9cf5('0x59')][_0x9cf5('0x60')]||_0xd4db54['user']['id'];return db[_0x9cf5('0x3e')][_0x9cf5('0x57')]({'where':{'id':_0xd4db54[_0x9cf5('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x9cf5('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0xef58cc,null))['then'](saveUpdates(_0xd4db54[_0x9cf5('0x59')],null))[_0x9cf5('0x26')](function(_0x3e35ca){if(_0x3e35ca){_0x567aa6[_0x9cf5('0x2d')]=_0x3e35ca[_0x9cf5('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x9cf5('0x57')]({'where':{'id':_0x3e35ca[_0x9cf5('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xef58cc,null))['then'](function(_0xba330b){if(_0xba330b){return _0xba330b[_0x9cf5('0x38')]({'UserId':_0xd4db54['body']['UserId'],'read1stAt':_['isNil'](_0xba330b[_0x9cf5('0x64')])?moment()[_0x9cf5('0x5f')](_0x9cf5('0x65')):undefined});}return null;})['then'](function(_0x1c21f7){if(_0x1c21f7){_0x567aa6['interaction']=_0x1c21f7['get']({'plain':!![]});interaction_log['info'](_0x9cf5('0x66'),_0xd4db54[_0x9cf5('0x67')]['id'],_0xd4db54[_0x9cf5('0x67')][_0x9cf5('0x3b')],_0xd4db54[_0x9cf5('0x67')]['role'],_0x567aa6[_0x9cf5('0x68')]['id'],_0xd4db54['body']?JSON[_0x9cf5('0x69')](_0xd4db54[_0x9cf5('0x59')]):_0x9cf5('0x6a'));return respondWithRpcPromise(_0x9cf5('0x6b'),_0x9cf5('0x6c'),_0x567aa6);}return null;})[_0x9cf5('0x26')](function(_0x5f45b7){if(_0x5f45b7){if(_0xd4db54['body']['manual']){_0x567aa6['message'][_0x9cf5('0x6d')]=util[_0x9cf5('0x5f')](_0x9cf5('0x6e'),_0xd4db54['user']['name']);_0x567aa6['message'][_0x9cf5('0x6f')]=_0x567aa6['channel'];_0x567aa6[_0x9cf5('0x2d')][_0x9cf5('0x70')]='accept';return respondWithRpcPromise(_0x9cf5('0x71'),_0x9cf5('0x71'),{'event':_0x9cf5('0x72'),'message':_0x567aa6[_0x9cf5('0x2d')]},client9002)[_0x9cf5('0x26')](function(){return _0x567aa6;});}return _0x567aa6;}return null;})[_0x9cf5('0x26')](respondWithResult(_0xef58cc,null))[_0x9cf5('0x52')](handleError(_0xef58cc,null));};var interaction_log=require(_0x9cf5('0x14'))('whatsapp-interactions');exports[_0x9cf5('0x73')]=function(_0x30ebe2,_0x562341,_0x1415e2){var _0x363f45={'agent':{},'channel':_0x9cf5('0x5c')};if(_0x30ebe2[_0x9cf5('0x59')]['id']){delete _0x30ebe2['body']['id'];}_0x30ebe2['body']['UserId']=_0x30ebe2[_0x9cf5('0x59')][_0x9cf5('0x60')]||_0x30ebe2[_0x9cf5('0x67')]['id'];_0x363f45['agent']['id']=_0x30ebe2['body'][_0x9cf5('0x60')];return db[_0x9cf5('0x3e')]['find']({'where':{'id':_0x30ebe2[_0x9cf5('0x54')]['id'],'UserId':null}})[_0x9cf5('0x26')](handleEntityNotFound(_0x562341,null))['then'](function(_0x22033c){if(_0x22033c){_0x363f45['message']=_0x22033c[_0x9cf5('0x62')]({'plain':!![]});return db[_0x9cf5('0x74')][_0x9cf5('0x57')]({'where':{'id':_0x22033c['WhatsappInteractionId']}});}return null;})[_0x9cf5('0x26')](handleEntityNotFound(_0x562341,null))[_0x9cf5('0x26')](function(_0x5c9274){if(_0x5c9274){_0x363f45[_0x9cf5('0x68')]=_0x5c9274[_0x9cf5('0x62')]({'plain':!![]});interaction_log[_0x9cf5('0x27')](_0x9cf5('0x75'),_0x30ebe2[_0x9cf5('0x67')]['id'],_0x30ebe2[_0x9cf5('0x67')]['name'],_0x30ebe2[_0x9cf5('0x67')]['role'],_0x363f45['interaction']['id'],_0x30ebe2['body']?JSON['stringify'](_0x30ebe2[_0x9cf5('0x59')]):_0x9cf5('0x6a'));return respondWithRpcPromise('RejectMessage',_0x9cf5('0x76'),_0x363f45);}return null;})[_0x9cf5('0x26')](function(_0x28709f){if(_0x28709f){_0x28709f[_0x9cf5('0x2d')][_0x9cf5('0x6d')]=util[_0x9cf5('0x5f')]('SIP/%s',_0x30ebe2['user'][_0x9cf5('0x3b')]);_0x28709f[_0x9cf5('0x2d')][_0x9cf5('0x6f')]=_0x363f45['channel'];_0x28709f['message'][_0x9cf5('0x70')]=_0x9cf5('0x73');respondWithRpcPromise(_0x9cf5('0x71'),_0x9cf5('0x71'),{'event':_0x9cf5('0x77'),'message':_0x28709f[_0x9cf5('0x2d')]},client9002);return _0x363f45;}return null;})[_0x9cf5('0x26')](respondWithResult(_0x562341,null))[_0x9cf5('0x52')](handleError(_0x562341,null));};exports[_0x9cf5('0x2f')]=function(_0x3e307c,_0x250f0a,_0x3e5689){if(_0x3e307c['body']['id']){delete _0x3e307c['body']['id'];}var _0x4c8b73;return db[_0x9cf5('0x3e')][_0x9cf5('0x57')]({'where':{'id':_0x3e307c[_0x9cf5('0x54')]['id']}})['then'](handleEntityNotFound(_0x250f0a,null))[_0x9cf5('0x26')](function(_0x34cbee){if(_0x34cbee){_0x4c8b73=_0x34cbee;return db[_0x9cf5('0x78')]['find']({'where':{'id':_0x34cbee['WhatsappAccountId']}});}})[_0x9cf5('0x26')](handleEntityNotFound(_0x250f0a,null))[_0x9cf5('0x26')](function(_0x3e4533){if(_0x3e4533){logger[_0x9cf5('0x2a')](_0x9cf5('0x79'),_0x9cf5('0x2f'),_0x9cf5('0x7a'),_0x3e4533['type'],util[_0x9cf5('0x7b')](_0x3e307c[_0x9cf5('0x59')],{'showHidden':![],'depth':null}));switch(_0x3e4533[_0x9cf5('0x41')]){case'twilio':if(_0x3e307c[_0x9cf5('0x59')]['MessageSid']&&_0x3e307c['body']['MessageSid']===_0x4c8b73[_0x9cf5('0x7c')]&&_0x3e307c[_0x9cf5('0x59')][_0x9cf5('0x7d')]&&_0x3e307c[_0x9cf5('0x59')][_0x9cf5('0x7d')]===_0x9cf5('0x5d')){return _0x4c8b73['update']({'read':!![]});}else{logger[_0x9cf5('0x2b')](_0x9cf5('0x7e'),'status',_0x9cf5('0x7f'),util[_0x9cf5('0x7b')](_0x3e307c['body'],{'showHidden':![],'depth':null}));}break;}return _0x4c8b73;}})[_0x9cf5('0x26')](respondWithResult(_0x250f0a,null))[_0x9cf5('0x52')](handleError(_0x250f0a,null));}; \ No newline at end of file +var _0xde3f=['send','index','WhatsappMessage','rawAttributes','fieldName','model','map','query','intersection','attributes','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','show','params','keys','fields','length','include','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','format','channel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','zip-dir','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name'];(function(_0x4bd723,_0x22fb39){var _0x35a23f=function(_0x28b065){while(--_0x28b065){_0x4bd723['push'](_0x4bd723['shift']());}};_0x35a23f(++_0x22fb39);}(_0xde3f,0x1c9));var _0xfde3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xde3f[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0xfde3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfde3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfde3('0x2'));var Mustache=require(_0xfde3('0x3'));var util=require(_0xfde3('0x4'));var path=require(_0xfde3('0x5'));var sox=require(_0xfde3('0x6'));var csv=require(_0xfde3('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfde3('0x8'));var crypto=require(_0xfde3('0x9'));var jsforce=require(_0xfde3('0xa'));var deskjs=require(_0xfde3('0xb'));var toCsv=require(_0xfde3('0x7'));var querystring=require(_0xfde3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfde3('0xd'));var hardwareService=require(_0xfde3('0xe'));var logger=require(_0xfde3('0xf'))(_0xfde3('0x10'));var utils=require(_0xfde3('0x11'));var config=require(_0xfde3('0x12'));var db=require(_0xfde3('0x13'))['db'];config[_0xfde3('0x14')]=_[_0xfde3('0x15')](config[_0xfde3('0x14')],{'host':_0xfde3('0x16'),'port':0x18eb});var socket=require(_0xfde3('0x17'))(new Redis(config[_0xfde3('0x14')]));require(_0xfde3('0x18'))[_0xfde3('0x19')](socket);var jayson=require(_0xfde3('0x1a'));var client=jayson['client'][_0xfde3('0x1b')]({'port':0x232c});var client9002=jayson[_0xfde3('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x4bce8b,_0x51b544,_0x2edbe9){if(_0x2edbe9){var _0x121960=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x121960[_0xfde3('0x1d')](_0x51b544)){return _0x4bce8b;}else{throw new db[(_0xfde3('0x1e'))]['ValidationError'](_0xfde3('0x1f'));}}else{return _0x4bce8b;}}function respondWithRpcPromise(_0x59f6db,_0x201baf,_0x2a3543,_0x99a214){return new BPromise(function(_0x394e3f,_0x1d97de){var _0x1b8bd0=_0x99a214||client;return _0x1b8bd0[_0xfde3('0x20')](_0x59f6db,_0x2a3543)['then'](function(_0x18a0c8){logger['info'](_0xfde3('0x21'),_0x201baf,_0xfde3('0x22'));logger[_0xfde3('0x23')](_0xfde3('0x24'),_0x201baf,'request\x20sent',JSON[_0xfde3('0x25')](_0x18a0c8));if(_0x18a0c8['error']){if(_0x18a0c8[_0xfde3('0x26')]['code']===0x1f4){logger[_0xfde3('0x26')](_0xfde3('0x21'),_0x201baf,_0x18a0c8[_0xfde3('0x26')][_0xfde3('0x27')]);return _0x1d97de(_0x18a0c8[_0xfde3('0x26')][_0xfde3('0x27')]);}logger['error'](_0xfde3('0x21'),_0x201baf,_0x18a0c8['error'][_0xfde3('0x27')]);return _0x394e3f(_0x18a0c8[_0xfde3('0x26')][_0xfde3('0x27')]);}else{logger[_0xfde3('0x28')](_0xfde3('0x21'),_0x201baf,_0xfde3('0x22'));_0x394e3f(_0x18a0c8[_0xfde3('0x29')]['message']);}})[_0xfde3('0x2a')](function(_0xadf6b8){logger['error'](_0xfde3('0x21'),_0x201baf,_0xadf6b8);_0x1d97de(_0xadf6b8);});});}function respondWithStatusCode(_0x5d6fda,_0x25eb14){_0x25eb14=_0x25eb14||0xcc;return function(_0x227cd5){if(_0x227cd5){return _0x5d6fda[_0xfde3('0x2b')](_0x25eb14);}return _0x5d6fda[_0xfde3('0x2c')](_0x25eb14)[_0xfde3('0x2d')]();};}function respondWithResult(_0x41ba9c,_0xc208e9){_0xc208e9=_0xc208e9||0xc8;return function(_0x5516d6){if(_0x5516d6){return _0x41ba9c['status'](_0xc208e9)['json'](_0x5516d6);}};}function respondWithFilteredResult(_0x1130ce,_0x281df0){return function(_0x5376df){if(_0x5376df){var _0x4d13f0=_0x5376df['count'],_0x3a0666=_0x281df0[_0xfde3('0x2e')],_0xe3fde=_0x281df0['offset']+_0x281df0[_0xfde3('0x2f')],_0xed43fe;if(_0xe3fde>=_0x4d13f0){_0xe3fde=_0x4d13f0;_0xed43fe=0xc8;}else{_0xed43fe=0xce;}_0x1130ce[_0xfde3('0x2c')](_0xed43fe);return _0x1130ce[_0xfde3('0x30')](_0xfde3('0x31'),_0x3a0666+'-'+_0xe3fde+'/'+_0x4d13f0)[_0xfde3('0x32')](_0x5376df);}return null;};}function patchUpdates(_0x331d2f){return function(_0x4171b7){try{jsonpatch[_0xfde3('0x33')](_0x4171b7,_0x331d2f,!![]);}catch(_0x3d1568){return BPromise[_0xfde3('0x34')](_0x3d1568);}return _0x4171b7[_0xfde3('0x35')]();};}function saveUpdates(_0x58cdcd,_0x5170f4){return function(_0x4e7571){if(_0x4e7571){return _0x4e7571[_0xfde3('0x36')](_0x58cdcd)[_0xfde3('0x37')](function(_0x4d6292){return _0x4d6292;});}return null;};}function removeEntity(_0x2e51ba,_0x51406d){return function(_0x2f988a){if(_0x2f988a){return _0x2f988a[_0xfde3('0x38')]()[_0xfde3('0x37')](function(){_0x2e51ba[_0xfde3('0x2c')](0xcc)[_0xfde3('0x2d')]();});}};}function handleEntityNotFound(_0x528dbd,_0x546b66){return function(_0x1bdb43){if(!_0x1bdb43){_0x528dbd[_0xfde3('0x2b')](0x194);}return _0x1bdb43;};}function handleError(_0x1bbb67,_0x4d0bc5){_0x4d0bc5=_0x4d0bc5||0x1f4;return function(_0x460f75){logger['error'](_0x460f75[_0xfde3('0x39')]);if(_0x460f75[_0xfde3('0x3a')]){delete _0x460f75[_0xfde3('0x3a')];}_0x1bbb67[_0xfde3('0x2c')](_0x4d0bc5)[_0xfde3('0x3b')](_0x460f75);};}exports[_0xfde3('0x3c')]=function(_0x17b070,_0x30c473){var _0x1082bb={},_0x2feced={},_0x30074c={'count':0x0,'rows':[]};var _0x2d2100=_['map'](db[_0xfde3('0x3d')][_0xfde3('0x3e')],function(_0x438d46){return{'name':_0x438d46[_0xfde3('0x3f')],'type':_0x438d46['type']['key']};});_0x2feced[_0xfde3('0x40')]=_[_0xfde3('0x41')](_0x2d2100,_0xfde3('0x3a'));_0x2feced[_0xfde3('0x42')]=_['keys'](_0x17b070['query']);_0x2feced['filters']=_[_0xfde3('0x43')](_0x2feced['model'],_0x2feced[_0xfde3('0x42')]);_0x1082bb['attributes']=_['intersection'](_0x2feced[_0xfde3('0x40')],qs['fields'](_0x17b070[_0xfde3('0x42')]['fields']));_0x1082bb[_0xfde3('0x44')]=_0x1082bb[_0xfde3('0x44')]['length']?_0x1082bb[_0xfde3('0x44')]:_0x2feced[_0xfde3('0x40')];if(!_0x17b070[_0xfde3('0x42')]['hasOwnProperty'](_0xfde3('0x45'))){_0x1082bb[_0xfde3('0x2f')]=qs[_0xfde3('0x2f')](_0x17b070[_0xfde3('0x42')][_0xfde3('0x2f')]);_0x1082bb[_0xfde3('0x2e')]=qs[_0xfde3('0x2e')](_0x17b070[_0xfde3('0x42')][_0xfde3('0x2e')]);}_0x1082bb['order']=qs['sort'](_0x17b070[_0xfde3('0x42')][_0xfde3('0x46')]);_0x1082bb[_0xfde3('0x47')]=qs[_0xfde3('0x48')](_[_0xfde3('0x49')](_0x17b070[_0xfde3('0x42')],_0x2feced[_0xfde3('0x48')]),_0x2d2100);if(_0x17b070['query'][_0xfde3('0x4a')]){_0x1082bb['where']=_[_0xfde3('0x4b')](_0x1082bb[_0xfde3('0x47')],{'$or':_[_0xfde3('0x41')](_0x2d2100,function(_0x5b1783){if(_0x5b1783[_0xfde3('0x4c')]!==_0xfde3('0x4d')){var _0x1320bb={};_0x1320bb[_0x5b1783[_0xfde3('0x3a')]]={'$like':'%'+_0x17b070[_0xfde3('0x42')][_0xfde3('0x4a')]+'%'};return _0x1320bb;}})});}_0x1082bb=_[_0xfde3('0x4b')]({},_0x1082bb,_0x17b070[_0xfde3('0x4e')]);var _0x4116a0={'where':_0x1082bb[_0xfde3('0x47')]};return db[_0xfde3('0x3d')][_0xfde3('0x4f')](_0x4116a0)[_0xfde3('0x37')](function(_0x35cf08){_0x30074c['count']=_0x35cf08;if(_0x17b070[_0xfde3('0x42')][_0xfde3('0x50')]){_0x1082bb['include']=[{'all':!![]}];}return db[_0xfde3('0x3d')][_0xfde3('0x51')](_0x1082bb);})[_0xfde3('0x37')](function(_0x4eaa09){_0x30074c['rows']=_0x4eaa09;return _0x30074c;})[_0xfde3('0x37')](respondWithFilteredResult(_0x30c473,_0x1082bb))[_0xfde3('0x2a')](handleError(_0x30c473,null));};exports[_0xfde3('0x52')]=function(_0x2a0214,_0x2c2f88){var _0x10b7fa={'raw':!![],'where':{'id':_0x2a0214[_0xfde3('0x53')]['id']}},_0x2f9a3b={};_0x2f9a3b[_0xfde3('0x40')]=_[_0xfde3('0x54')](db['WhatsappMessage']['rawAttributes']);_0x2f9a3b[_0xfde3('0x42')]=_['keys'](_0x2a0214[_0xfde3('0x42')]);_0x2f9a3b['filters']=_[_0xfde3('0x43')](_0x2f9a3b[_0xfde3('0x40')],_0x2f9a3b[_0xfde3('0x42')]);_0x10b7fa[_0xfde3('0x44')]=_['intersection'](_0x2f9a3b[_0xfde3('0x40')],qs[_0xfde3('0x55')](_0x2a0214[_0xfde3('0x42')][_0xfde3('0x55')]));_0x10b7fa[_0xfde3('0x44')]=_0x10b7fa['attributes'][_0xfde3('0x56')]?_0x10b7fa[_0xfde3('0x44')]:_0x2f9a3b['model'];if(_0x2a0214['query'][_0xfde3('0x50')]){_0x10b7fa[_0xfde3('0x57')]=[{'all':!![]}];}_0x10b7fa=_[_0xfde3('0x4b')]({},_0x10b7fa,_0x2a0214[_0xfde3('0x4e')]);return db['WhatsappMessage'][_0xfde3('0x58')](_0x10b7fa)[_0xfde3('0x37')](handleEntityNotFound(_0x2c2f88,null))[_0xfde3('0x37')](respondWithResult(_0x2c2f88,null))[_0xfde3('0x2a')](handleError(_0x2c2f88,null));};exports[_0xfde3('0x59')]=function(_0x330e19,_0x54d34e){return db['WhatsappMessage'][_0xfde3('0x59')](_0x330e19['body'],{})['then'](respondWithResult(_0x54d34e,0xc9))[_0xfde3('0x2a')](handleError(_0x54d34e,null));};exports[_0xfde3('0x36')]=function(_0xd89b77,_0x55f324){if(_0xd89b77[_0xfde3('0x5a')]['id']){delete _0xd89b77[_0xfde3('0x5a')]['id'];}return db['WhatsappMessage'][_0xfde3('0x58')]({'where':{'id':_0xd89b77[_0xfde3('0x53')]['id']}})[_0xfde3('0x37')](handleEntityNotFound(_0x55f324,null))[_0xfde3('0x37')](saveUpdates(_0xd89b77[_0xfde3('0x5a')],null))[_0xfde3('0x37')](respondWithResult(_0x55f324,null))[_0xfde3('0x2a')](handleError(_0x55f324,null));};exports[_0xfde3('0x38')]=function(_0x5af07b,_0xeaa925){return db[_0xfde3('0x3d')][_0xfde3('0x58')]({'where':{'id':_0x5af07b[_0xfde3('0x53')]['id']}})[_0xfde3('0x37')](handleEntityNotFound(_0xeaa925,null))['then'](removeEntity(_0xeaa925,null))['catch'](handleError(_0xeaa925,null));};exports[_0xfde3('0x5b')]=function(_0xc36fd6,_0x373d5f){return db['WhatsappMessage'][_0xfde3('0x5b')]()[_0xfde3('0x37')](respondWithResult(_0x373d5f,null))['catch'](handleError(_0x373d5f,null));};var interaction_log=require('../../config/logger')(_0xfde3('0x5c'));exports[_0xfde3('0x5d')]=function(_0x42b3f6,_0x1650bb,_0xe3b429){var _0x4a4261={'channel':_0xfde3('0x5e')};if(_0x42b3f6[_0xfde3('0x5a')]['id']){delete _0x42b3f6[_0xfde3('0x5a')]['id'];}_0x42b3f6['body'][_0xfde3('0x5f')]=!![];_0x42b3f6[_0xfde3('0x5a')][_0xfde3('0x60')]=moment()['format'](_0xfde3('0x61'));_0x42b3f6[_0xfde3('0x5a')]['UserId']=_0x42b3f6[_0xfde3('0x5a')][_0xfde3('0x62')]||_0x42b3f6[_0xfde3('0x63')]['id'];return db['WhatsappMessage'][_0xfde3('0x58')]({'where':{'id':_0x42b3f6['params']['id'],'UserId':null},'include':[{'model':db[_0xfde3('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x1650bb,null))['then'](saveUpdates(_0x42b3f6['body'],null))[_0xfde3('0x37')](function(_0x1121d7){if(_0x1121d7){_0x4a4261[_0xfde3('0x27')]=_0x1121d7[_0xfde3('0x65')]({'plain':!![]});return db[_0xfde3('0x66')][_0xfde3('0x58')]({'where':{'id':_0x1121d7[_0xfde3('0x67')]}});}return null;})[_0xfde3('0x37')](handleEntityNotFound(_0x1650bb,null))[_0xfde3('0x37')](function(_0xa38730){if(_0xa38730){return _0xa38730['update']({'UserId':_0x42b3f6[_0xfde3('0x5a')]['UserId'],'read1stAt':_[_0xfde3('0x68')](_0xa38730[_0xfde3('0x69')])?moment()['format'](_0xfde3('0x61')):undefined});}return null;})['then'](function(_0x584028){if(_0x584028){_0x4a4261[_0xfde3('0x6a')]=_0x584028[_0xfde3('0x65')]({'plain':!![]});interaction_log[_0xfde3('0x28')](_0xfde3('0x6b'),_0x42b3f6[_0xfde3('0x63')]['id'],_0x42b3f6[_0xfde3('0x63')][_0xfde3('0x3a')],_0x42b3f6[_0xfde3('0x63')][_0xfde3('0x6c')],_0x4a4261[_0xfde3('0x6a')]['id'],_0x42b3f6[_0xfde3('0x5a')]?JSON[_0xfde3('0x25')](_0x42b3f6[_0xfde3('0x5a')]):_0xfde3('0x6d'));return respondWithRpcPromise(_0xfde3('0x6e'),'acceptMessage',_0x4a4261);}return null;})['then'](function(_0x17ff97){if(_0x17ff97){if(_0x42b3f6[_0xfde3('0x5a')][_0xfde3('0x6f')]){_0x4a4261[_0xfde3('0x27')][_0xfde3('0x70')]=util[_0xfde3('0x71')]('SIP/%s',_0x42b3f6['user']['name']);_0x4a4261['message'][_0xfde3('0x72')]=_0x4a4261['channel'];_0x4a4261[_0xfde3('0x27')][_0xfde3('0x73')]=_0xfde3('0x5d');return respondWithRpcPromise(_0xfde3('0x74'),_0xfde3('0x74'),{'event':'acceptmessage','message':_0x4a4261[_0xfde3('0x27')]},client9002)['then'](function(){return _0x4a4261;});}return _0x4a4261;}return null;})[_0xfde3('0x37')](respondWithResult(_0x1650bb,null))['catch'](handleError(_0x1650bb,null));};var interaction_log=require(_0xfde3('0xf'))(_0xfde3('0x5c'));exports[_0xfde3('0x34')]=function(_0x52a39b,_0x35f25a,_0x425b74){var _0xc5c138={'agent':{},'channel':_0xfde3('0x5e')};if(_0x52a39b[_0xfde3('0x5a')]['id']){delete _0x52a39b[_0xfde3('0x5a')]['id'];}_0x52a39b['body'][_0xfde3('0x62')]=_0x52a39b[_0xfde3('0x5a')]['UserId']||_0x52a39b[_0xfde3('0x63')]['id'];_0xc5c138['agent']['id']=_0x52a39b['body']['UserId'];return db[_0xfde3('0x3d')]['find']({'where':{'id':_0x52a39b[_0xfde3('0x53')]['id'],'UserId':null}})[_0xfde3('0x37')](handleEntityNotFound(_0x35f25a,null))['then'](function(_0x4f7e24){if(_0x4f7e24){_0xc5c138[_0xfde3('0x27')]=_0x4f7e24[_0xfde3('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0xfde3('0x58')]({'where':{'id':_0x4f7e24[_0xfde3('0x67')]}});}return null;})[_0xfde3('0x37')](handleEntityNotFound(_0x35f25a,null))[_0xfde3('0x37')](function(_0x34ffe1){if(_0x34ffe1){_0xc5c138[_0xfde3('0x6a')]=_0x34ffe1[_0xfde3('0x65')]({'plain':!![]});interaction_log['info'](_0xfde3('0x75'),_0x52a39b[_0xfde3('0x63')]['id'],_0x52a39b[_0xfde3('0x63')]['name'],_0x52a39b[_0xfde3('0x63')][_0xfde3('0x6c')],_0xc5c138[_0xfde3('0x6a')]['id'],_0x52a39b[_0xfde3('0x5a')]?JSON[_0xfde3('0x25')](_0x52a39b[_0xfde3('0x5a')]):_0xfde3('0x6d'));return respondWithRpcPromise('RejectMessage',_0xfde3('0x76'),_0xc5c138);}return null;})[_0xfde3('0x37')](function(_0x133c89){if(_0x133c89){_0x133c89['message'][_0xfde3('0x70')]=util['format'](_0xfde3('0x77'),_0x52a39b[_0xfde3('0x63')]['name']);_0x133c89[_0xfde3('0x27')][_0xfde3('0x72')]=_0xc5c138[_0xfde3('0x72')];_0x133c89[_0xfde3('0x27')][_0xfde3('0x73')]=_0xfde3('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0xfde3('0x78'),'message':_0x133c89[_0xfde3('0x27')]},client9002);return _0xc5c138;}return null;})[_0xfde3('0x37')](respondWithResult(_0x35f25a,null))[_0xfde3('0x2a')](handleError(_0x35f25a,null));};exports[_0xfde3('0x2c')]=function(_0x3ef14b,_0x49205e,_0x568b35){if(_0x3ef14b[_0xfde3('0x5a')]['id']){delete _0x3ef14b[_0xfde3('0x5a')]['id'];}var _0x2574c;return db['WhatsappMessage'][_0xfde3('0x58')]({'where':{'id':_0x3ef14b[_0xfde3('0x53')]['id']}})['then'](handleEntityNotFound(_0x49205e,null))['then'](function(_0x59ba75){if(_0x59ba75){_0x2574c=_0x59ba75;return db[_0xfde3('0x79')]['find']({'where':{'id':_0x59ba75['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x49205e,null))[_0xfde3('0x37')](function(_0x49f566){if(_0x49f566){logger[_0xfde3('0x23')](_0xfde3('0x7a'),'status',_0xfde3('0x7b'),_0x49f566['type'],util['inspect'](_0x3ef14b[_0xfde3('0x5a')],{'showHidden':![],'depth':null}));switch(_0x49f566[_0xfde3('0x4c')]){case _0xfde3('0x7c'):if(_0x3ef14b[_0xfde3('0x5a')][_0xfde3('0x7d')]&&_0x3ef14b['body'][_0xfde3('0x7d')]===_0x2574c['messageId']&&_0x3ef14b[_0xfde3('0x5a')][_0xfde3('0x7e')]&&_0x3ef14b[_0xfde3('0x5a')][_0xfde3('0x7e')]===_0xfde3('0x5f')){return _0x2574c[_0xfde3('0x36')]({'read':!![]});}else{logger[_0xfde3('0x26')](_0xfde3('0x7f'),_0xfde3('0x2c'),'twilio',util[_0xfde3('0x80')](_0x3ef14b[_0xfde3('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2574c;}})[_0xfde3('0x37')](respondWithResult(_0x49205e,null))[_0xfde3('0x2a')](handleError(_0x49205e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e2d579f..76c8e1d 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x297581,_0x5f3639){var _0x588d68=function(_0x5a056d){while(--_0x5a056d){_0x297581['push'](_0x297581['shift']());}};_0x588d68(++_0x5f3639);}(_0xb10b,0x12a));var _0xbb10=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0xb10b[_0x56d1ed];return _0x1b282b;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x90b537,_0x534713){var _0x4e811d=function(_0x244b0b){while(--_0x244b0b){_0x90b537['push'](_0x90b537['shift']());}};_0x4e811d(++_0x534713);}(_0x7a54,0x106));var _0x47a5=function(_0x5c16c0,_0x1145e8){_0x5c16c0=_0x5c16c0-0x0;var _0x98d4db=_0x7a54[_0x5c16c0];return _0x98d4db;};'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 diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 1accaa7..2ad5615 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 _0x74c1=['whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x74c1,0x1d7));var _0x174c=function(_0xa4703,_0x49c036){_0xa4703=_0xa4703-0x0;var _0x1ff1cb=_0x74c1[_0xa4703];return _0x1ff1cb;};'use strict';var _=require(_0x174c('0x0'));var util=require(_0x174c('0x1'));var logger=require(_0x174c('0x2'))('api');var moment=require(_0x174c('0x3'));var BPromise=require(_0x174c('0x4'));var rp=require(_0x174c('0x5'));var fs=require('fs');var path=require(_0x174c('0x6'));var rimraf=require(_0x174c('0x7'));var config=require(_0x174c('0x8'));var attributes=require(_0x174c('0x9'));module[_0x174c('0xa')]=function(_0x4d525a,_0x443eef){return _0x4d525a[_0x174c('0xb')]('WhatsappMessage',attributes,{'tableName':_0x174c('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x174c('0xd')]},{'name':_0x174c('0xe'),'fields':[_0x174c('0xf')],'type':_0x174c('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bf68e,_0x26f5db,_0x264e07){var _0x578dcf=_0x4d525a['models'];var _0x1c8799=_0x4bf68e[_0x174c('0x11')]({'plain':!![]});if(_0x1c8799[_0x174c('0x12')]['toLowerCase']()==='in'||_0x1c8799[_0x174c('0x12')][_0x174c('0x13')]()===_0x174c('0x14')&&!_0x1c8799[_0x174c('0x15')]&&!_[_0x174c('0x16')](_0x1c8799[_0x174c('0x17')])){_0x578dcf['WhatsappInteraction']['findOne']({'where':{'id':_0x1c8799[_0x174c('0x18')]}})[_0x174c('0x19')](function(_0x3b1ad5){if(_0x3b1ad5){_0x3b1ad5[_0x174c('0x1a')]({'lastMsgAt':_0x1c8799[_0x174c('0x1b')],'lastMsgDirection':_0x1c8799[_0x174c('0x12')]['toLowerCase']()});}})[_0x174c('0x1c')](function(_0xdb0524){console[_0x174c('0x1d')](_0xdb0524);});}if(_0x1c8799['direction']===_0x174c('0x14')&&!_0x1c8799[_0x174c('0x15')]){var _0x179f02;_0x578dcf[_0x174c('0x1e')][_0x174c('0x1f')]({'where':{'id':_0x1c8799['WhatsappAccountId']},'raw':!![]})[_0x174c('0x19')](function(_0x2ab546){_0x179f02=_0x2ab546;if(_0x179f02&&_0x179f02[_0x174c('0x20')]){switch(_0x179f02['type']){case _0x174c('0x21'):var _0x1aac10=require(_0x174c('0x21'));if(_0x179f02[_0x174c('0x22')]&&_0x179f02[_0x174c('0x23')]&&_0x179f02[_0x174c('0x24')]){var _0x2dbf27=new _0x1aac10(_0x179f02[_0x174c('0x22')],_0x179f02[_0x174c('0x23')]);_0x2dbf27[_0x174c('0x25')][_0x174c('0x26')]({'body':_0x1c8799[_0x174c('0xf')],'to':'whatsapp:'+_0x1c8799['phone'],'from':_0x174c('0x27')+_0x179f02[_0x174c('0x24')],'statusCallback':_0x179f02[_0x174c('0x28')]+_0x174c('0x29')+_0x1c8799['id']+_0x174c('0x2a')+_0x179f02[_0x174c('0x2b')]})['then'](function(_0x563831){if(_0x563831['sid']){return _0x4bf68e[_0x174c('0x1a')]({'messageId':_0x563831[_0x174c('0x2c')]});}})[_0x174c('0x1c')](function(_0x5ba43e){logger[_0x174c('0x1d')](_0x174c('0x2d'),'afterCreate',_0x174c('0x21'),util['inspect'](_0x5ba43e,{'showHidden':![],'depth':null}));});}else{logger[_0x174c('0x1d')](_0x174c('0x2d'),_0x174c('0x2e'),'twilio',_0x174c('0x2f'));}break;}}})[_0x174c('0x30')](function(){_0x264e07();});}else{_0x264e07();}}},'charset':_0x174c('0x31'),'collate':_0x174c('0x32')});}; \ No newline at end of file +var _0x05b7=['rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','secret','WhatsappInteraction','WhatsappInteractionId','then','createdAt','catch','direction','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/status?token=','token','update','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','util','../../config/logger','api','request-promise','path'];(function(_0x5de3f3,_0x297ddf){var _0x461e0a=function(_0x2c7dd3){while(--_0x2c7dd3){_0x5de3f3['push'](_0x5de3f3['shift']());}};_0x461e0a(++_0x297ddf);}(_0x05b7,0xb7));var _0x705b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x05b7[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var util=require(_0x705b('0x0'));var logger=require(_0x705b('0x1'))(_0x705b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x705b('0x3'));var fs=require('fs');var path=require(_0x705b('0x4'));var rimraf=require(_0x705b('0x5'));var config=require(_0x705b('0x6'));var attributes=require(_0x705b('0x7'));module[_0x705b('0x8')]=function(_0x532645,_0x346092){return _0x532645['define'](_0x705b('0x9'),attributes,{'tableName':_0x705b('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x705b('0xb')]},{'name':_0x705b('0xc'),'fields':[_0x705b('0xd')],'type':_0x705b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42e444,_0x4eb847,_0x327a87){var _0x4a5df7=_0x532645[_0x705b('0xf')];var _0x33f9db=_0x42e444[_0x705b('0x10')]({'plain':!![]});if(_0x33f9db['direction'][_0x705b('0x11')]()==='in'||_0x33f9db['direction']['toLowerCase']()==='out'&&!_0x33f9db[_0x705b('0x12')]&&!_['isNil'](_0x33f9db['UserId'])){_0x4a5df7[_0x705b('0x13')]['findOne']({'where':{'id':_0x33f9db[_0x705b('0x14')]}})[_0x705b('0x15')](function(_0x29eee2){if(_0x29eee2){_0x29eee2['update']({'lastMsgAt':_0x33f9db[_0x705b('0x16')],'lastMsgDirection':_0x33f9db['direction']['toLowerCase']()});}})[_0x705b('0x17')](function(_0x480f61){console['error'](_0x480f61);});}if(_0x33f9db[_0x705b('0x18')]===_0x705b('0x19')&&!_0x33f9db[_0x705b('0x12')]){var _0x758ac3;_0x4a5df7[_0x705b('0x1a')][_0x705b('0x1b')]({'where':{'id':_0x33f9db[_0x705b('0x1c')]},'raw':!![]})['then'](function(_0x39eb3a){_0x758ac3=_0x39eb3a;if(_0x758ac3&&_0x758ac3[_0x705b('0x1d')]){switch(_0x758ac3['type']){case _0x705b('0x1e'):var _0x2621a3=require(_0x705b('0x1e'));if(_0x758ac3[_0x705b('0x1f')]&&_0x758ac3[_0x705b('0x20')]&&_0x758ac3[_0x705b('0x21')]){var _0x2f2e9e=new _0x2621a3(_0x758ac3['accountSid'],_0x758ac3['authToken']);_0x2f2e9e[_0x705b('0x22')]['create']({'body':_0x33f9db[_0x705b('0xd')],'to':'whatsapp:'+_0x33f9db['phone'],'from':_0x705b('0x23')+_0x758ac3['phone'],'statusCallback':_0x758ac3[_0x705b('0x24')]+'/api/whatsapp/messages/'+_0x33f9db['id']+_0x705b('0x25')+_0x758ac3[_0x705b('0x26')]})[_0x705b('0x15')](function(_0x258101){if(_0x258101['sid']){return _0x42e444[_0x705b('0x27')]({'messageId':_0x258101[_0x705b('0x28')]});}})[_0x705b('0x17')](function(_0x2d0ab9){logger[_0x705b('0x29')](_0x705b('0x2a'),'afterCreate',_0x705b('0x1e'),util[_0x705b('0x2b')](_0x2d0ab9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x705b('0x2a'),_0x705b('0x2c'),_0x705b('0x1e'),_0x705b('0x2d'));}break;}}})['finally'](function(){_0x327a87();});}else{_0x327a87();}}},'charset':_0x705b('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c1bf480..b64cbd7 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 _0x90d2=['create','body','options','then','debug','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x2b82af,_0x46cbe4){var _0xbd1ca=function(_0x16be25){while(--_0x16be25){_0x2b82af['push'](_0x2b82af['shift']());}};_0xbd1ca(++_0x46cbe4);}(_0x90d2,0x185));var _0x290d=function(_0x335eca,_0x23bee1){_0x335eca=_0x335eca-0x0;var _0x4a9e78=_0x90d2[_0x335eca];return _0x4a9e78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x290d('0x0'));var BPromise=require(_0x290d('0x1'));var rs=require(_0x290d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x290d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x290d('0x4'))(_0x290d('0x5'));var config=require(_0x290d('0x6'));var jayson=require(_0x290d('0x7'));var client=jayson[_0x290d('0x8')][_0x290d('0x9')]({'port':0x232a});config[_0x290d('0xa')]=_[_0x290d('0xb')](config[_0x290d('0xa')],{'host':_0x290d('0xc'),'port':0x18eb});var socket=require(_0x290d('0xd'))(new Redis(config[_0x290d('0xa')]));require(_0x290d('0xe'))[_0x290d('0xf')](socket);function respondWithRpcPromise(_0x5d596e,_0x53cc6e,_0x3a2a60){return new BPromise(function(_0x6d6ae8,_0x47bdb0){return client[_0x290d('0x10')](_0x5d596e,_0x3a2a60)['then'](function(_0x4848bb){logger[_0x290d('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x53cc6e,_0x290d('0x12'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x53cc6e,_0x290d('0x12'),JSON[_0x290d('0x13')](_0x4848bb));if(_0x4848bb[_0x290d('0x14')]){if(_0x4848bb[_0x290d('0x14')]['code']===0x1f4){logger[_0x290d('0x14')](_0x290d('0x15'),_0x53cc6e,_0x4848bb[_0x290d('0x14')]['message']);return _0x47bdb0(_0x4848bb[_0x290d('0x14')]['message']);}logger[_0x290d('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x53cc6e,_0x4848bb['error'][_0x290d('0x16')]);return _0x6d6ae8(_0x4848bb['error'][_0x290d('0x16')]);}else{logger[_0x290d('0x11')](_0x290d('0x15'),_0x53cc6e,'request\x20sent');_0x6d6ae8(_0x4848bb[_0x290d('0x17')][_0x290d('0x16')]);}})[_0x290d('0x18')](function(_0xeee984){logger[_0x290d('0x14')](_0x290d('0x15'),_0x53cc6e,_0xeee984);_0x47bdb0(_0xeee984);});});}exports[_0x290d('0x19')]=function(_0x4f2985){var _0x540045=this;return new Promise(function(_0xf6c4dc,_0x254979){return db[_0x290d('0x1a')][_0x290d('0x1b')](_0x4f2985[_0x290d('0x1c')],{'raw':_0x4f2985[_0x290d('0x1d')]?_0x4f2985[_0x290d('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x290d('0x1e')](function(_0x2a084a){logger[_0x290d('0x11')](_0x290d('0x19'),_0x4f2985);logger[_0x290d('0x1f')](_0x290d('0x19'),_0x4f2985,JSON[_0x290d('0x13')](_0x2a084a));_0xf6c4dc(_0x2a084a);})['catch'](function(_0x4dc9c4){logger[_0x290d('0x14')](_0x290d('0x19'),_0x4dc9c4[_0x290d('0x16')],_0x4f2985);_0x254979(_0x540045[_0x290d('0x14')](0x1f4,_0x4dc9c4[_0x290d('0x16')]));});});}; \ No newline at end of file +var _0xb1b2=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0xb1b2,0xe1));var _0x2b1b=function(_0x55a523,_0x502714){_0x55a523=_0x55a523-0x0;var _0x24d8b0=_0xb1b2[_0x55a523];return _0x24d8b0;};'use strict';var _=require('lodash');var util=require(_0x2b1b('0x0'));var moment=require('moment');var BPromise=require(_0x2b1b('0x1'));var rs=require(_0x2b1b('0x2'));var fs=require('fs');var Redis=require(_0x2b1b('0x3'));var db=require(_0x2b1b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b1b('0x5'))(_0x2b1b('0x6'));var config=require(_0x2b1b('0x7'));var jayson=require(_0x2b1b('0x8'));var client=jayson[_0x2b1b('0x9')]['http']({'port':0x232a});config[_0x2b1b('0xa')]=_[_0x2b1b('0xb')](config[_0x2b1b('0xa')],{'host':_0x2b1b('0xc'),'port':0x18eb});var socket=require(_0x2b1b('0xd'))(new Redis(config[_0x2b1b('0xa')]));require(_0x2b1b('0xe'))[_0x2b1b('0xf')](socket);function respondWithRpcPromise(_0x9a6119,_0x896ddf,_0x1ffdde){return new BPromise(function(_0x2db2f2,_0x5c938b){return client['request'](_0x9a6119,_0x1ffdde)[_0x2b1b('0x10')](function(_0x132166){logger[_0x2b1b('0x11')](_0x2b1b('0x12'),_0x896ddf,_0x2b1b('0x13'));logger[_0x2b1b('0x14')](_0x2b1b('0x15'),_0x896ddf,_0x2b1b('0x13'),JSON[_0x2b1b('0x16')](_0x132166));if(_0x132166[_0x2b1b('0x17')]){if(_0x132166[_0x2b1b('0x17')][_0x2b1b('0x18')]===0x1f4){logger[_0x2b1b('0x17')](_0x2b1b('0x12'),_0x896ddf,_0x132166[_0x2b1b('0x17')][_0x2b1b('0x19')]);return _0x5c938b(_0x132166['error'][_0x2b1b('0x19')]);}logger['error'](_0x2b1b('0x12'),_0x896ddf,_0x132166['error'][_0x2b1b('0x19')]);return _0x2db2f2(_0x132166[_0x2b1b('0x17')][_0x2b1b('0x19')]);}else{logger[_0x2b1b('0x11')](_0x2b1b('0x12'),_0x896ddf,_0x2b1b('0x13'));_0x2db2f2(_0x132166[_0x2b1b('0x1a')][_0x2b1b('0x19')]);}})[_0x2b1b('0x1b')](function(_0x2124ce){logger[_0x2b1b('0x17')](_0x2b1b('0x12'),_0x896ddf,_0x2124ce);_0x5c938b(_0x2124ce);});});}exports[_0x2b1b('0x1c')]=function(_0x3afc3b){var _0xa900a2=this;return new Promise(function(_0x1210a3,_0xedea13){return db[_0x2b1b('0x1d')][_0x2b1b('0x1e')](_0x3afc3b['body'],{'raw':_0x3afc3b[_0x2b1b('0x1f')]?_0x3afc3b[_0x2b1b('0x1f')][_0x2b1b('0x20')]===undefined?!![]:![]:!![]})[_0x2b1b('0x10')](function(_0x285008){logger['info'](_0x2b1b('0x1c'),_0x3afc3b);logger['debug'](_0x2b1b('0x1c'),_0x3afc3b,JSON['stringify'](_0x285008));_0x1210a3(_0x285008);})[_0x2b1b('0x1b')](function(_0x47ae80){logger[_0x2b1b('0x17')]('CreateWhatsappMessage',_0x47ae80[_0x2b1b('0x19')],_0x3afc3b);_0xedea13(_0xa900a2[_0x2b1b('0x17')](0x1f4,_0x47ae80[_0x2b1b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1656d5a..ee9e925 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 _0xa110=['whatsappMessage:','./whatsappMessage.events','save','update','emit','removeListener','register','length'];(function(_0xd37b38,_0x13d1c3){var _0x1f29c5=function(_0x21036c){while(--_0x21036c){_0xd37b38['push'](_0xd37b38['shift']());}};_0x1f29c5(++_0x13d1c3);}(_0xa110,0x111));var _0x0a11=function(_0x130a56,_0x47e89d){_0x130a56=_0x130a56-0x0;var _0x47dfc9=_0xa110[_0x130a56];return _0x47dfc9;};'use strict';var WhatsappMessageEvents=require(_0x0a11('0x0'));var events=[_0x0a11('0x1'),'remove',_0x0a11('0x2')];function createListener(_0x6511fb,_0x304b11){return function(_0x2d9341){_0x304b11[_0x0a11('0x3')](_0x6511fb,_0x2d9341);};}function removeListener(_0x160bbf,_0x40098f){return function(){WhatsappMessageEvents[_0x0a11('0x4')](_0x160bbf,_0x40098f);};}exports[_0x0a11('0x5')]=function(_0x328e7a){for(var _0x141b7e=0x0,_0x2576ad=events[_0x0a11('0x6')];_0x141b7e<_0x2576ad;_0x141b7e++){var _0x5ac9f1=events[_0x141b7e];var _0x5c7ad9=createListener(_0x0a11('0x7')+_0x5ac9f1,_0x328e7a);WhatsappMessageEvents['on'](_0x5ac9f1,_0x5c7ad9);}}; \ No newline at end of file +var _0xf301=['remove','update','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf301,0xe6));var _0x1f30=function(_0x49830c,_0x4472d7){_0x49830c=_0x49830c-0x0;var _0x5872f2=_0xf301[_0x49830c];return _0x5872f2;};'use strict';var WhatsappMessageEvents=require(_0x1f30('0x0'));var events=[_0x1f30('0x1'),_0x1f30('0x2'),_0x1f30('0x3')];function createListener(_0x33f6b1,_0x412361){return function(_0x352c2a){_0x412361[_0x1f30('0x4')](_0x33f6b1,_0x352c2a);};}function removeListener(_0x34055d,_0x1edad6){return function(){WhatsappMessageEvents[_0x1f30('0x5')](_0x34055d,_0x1edad6);};}exports[_0x1f30('0x6')]=function(_0xe30628){for(var _0xcd7b81=0x0,_0x82a96f=events['length'];_0xcd7b81<_0x82a96f;_0xcd7b81++){var _0x1f77a8=events[_0xcd7b81];var _0x43c98d=createListener(_0x1f30('0x7')+_0x1f77a8,_0xe30628);WhatsappMessageEvents['on'](_0x1f77a8,_0x43c98d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 37ccb03..0c7448f 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 _0xa29e=['destroy','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','get','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete'];(function(_0x335d0b,_0x265021){var _0x1e8e3e=function(_0x33fd78){while(--_0x33fd78){_0x335d0b['push'](_0x335d0b['shift']());}};_0x1e8e3e(++_0x265021);}(_0xa29e,0x1f0));var _0xea29=function(_0x468837,_0x5f0a68){_0x468837=_0x468837-0x0;var _0x7c161e=_0xa29e[_0x468837];return _0x7c161e;};'use strict';var multer=require('multer');var util=require(_0xea29('0x0'));var path=require(_0xea29('0x1'));var timeout=require(_0xea29('0x2'));var express=require(_0xea29('0x3'));var router=express[_0xea29('0x4')]();var auth=require(_0xea29('0x5'));var interaction=require(_0xea29('0x6'));var config=require(_0xea29('0x7'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xea29('0x8')](),controller[_0xea29('0x9')]);router['get'](_0xea29('0xa'),auth['isAuthenticated'](),controller[_0xea29('0xb')]);router['get'](_0xea29('0xc'),auth['isAuthenticated'](),controller[_0xea29('0xd')]);router['get'](_0xea29('0xe'),auth[_0xea29('0x8')](),controller[_0xea29('0xf')]);router[_0xea29('0x10')](_0xea29('0x11'),auth[_0xea29('0x8')](),controller[_0xea29('0x12')]);router['get'](_0xea29('0x13'),auth[_0xea29('0x8')](),controller[_0xea29('0x14')]);router[_0xea29('0x15')]('/',auth[_0xea29('0x8')](),controller['create']);router[_0xea29('0x15')]('/:id/teams',auth[_0xea29('0x8')](),controller[_0xea29('0x16')]);router[_0xea29('0x15')](_0xea29('0x13'),auth['isAuthenticated'](),controller[_0xea29('0x17')]);router[_0xea29('0x18')](_0xea29('0xc'),auth[_0xea29('0x8')](),controller['update']);router[_0xea29('0x19')](_0xea29('0xc'),auth['isAuthenticated'](),controller[_0xea29('0x1a')]);router['delete']('/:id/teams',auth[_0xea29('0x8')](),controller[_0xea29('0x1b')]);router['delete']('/:id/users',auth[_0xea29('0x8')](),controller['removeAgents']);module[_0xea29('0x1c')]=router; \ No newline at end of file +var _0xc0d6=['describe','/:id','isAuthenticated','show','/:id/teams','/:id/users','getAgents','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','/describe'];(function(_0x31a951,_0x457142){var _0x29c5f8=function(_0x3f80b0){while(--_0x3f80b0){_0x31a951['push'](_0x31a951['shift']());}};_0x29c5f8(++_0x457142);}(_0xc0d6,0x155));var _0x6c0d=function(_0xb5a8b4,_0x470cc4){_0xb5a8b4=_0xb5a8b4-0x0;var _0xc91467=_0xc0d6[_0xb5a8b4];return _0xc91467;};'use strict';var multer=require(_0x6c0d('0x0'));var util=require(_0x6c0d('0x1'));var path=require(_0x6c0d('0x2'));var timeout=require(_0x6c0d('0x3'));var express=require(_0x6c0d('0x4'));var router=express[_0x6c0d('0x5')]();var auth=require(_0x6c0d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x6c0d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6c0d('0x7')](_0x6c0d('0x8'),auth['isAuthenticated'](),controller[_0x6c0d('0x9')]);router[_0x6c0d('0x7')](_0x6c0d('0xa'),auth[_0x6c0d('0xb')](),controller[_0x6c0d('0xc')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x6c0d('0x7')](_0x6c0d('0xd'),auth[_0x6c0d('0xb')](),controller['getTeams']);router[_0x6c0d('0x7')](_0x6c0d('0xe'),auth[_0x6c0d('0xb')](),controller[_0x6c0d('0xf')]);router[_0x6c0d('0x10')]('/',auth[_0x6c0d('0xb')](),controller['create']);router['post'](_0x6c0d('0xd'),auth[_0x6c0d('0xb')](),controller['addTeams']);router[_0x6c0d('0x10')](_0x6c0d('0xe'),auth[_0x6c0d('0xb')](),controller[_0x6c0d('0x11')]);router[_0x6c0d('0x12')](_0x6c0d('0xa'),auth[_0x6c0d('0xb')](),controller[_0x6c0d('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6c0d('0x14')]);router[_0x6c0d('0x15')](_0x6c0d('0xd'),auth[_0x6c0d('0xb')](),controller[_0x6c0d('0x16')]);router[_0x6c0d('0x15')](_0x6c0d('0xe'),auth['isAuthenticated'](),controller[_0x6c0d('0x17')]);module[_0x6c0d('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 27eeab9..b10c311 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 _0x61a1=['beepall','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x3f5d1a,_0x33400b){var _0x2db38a=function(_0x1bd67a){while(--_0x1bd67a){_0x3f5d1a['push'](_0x3f5d1a['shift']());}};_0x2db38a(++_0x33400b);}(_0x61a1,0x121));var _0x161a=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x61a1[_0x3ceb54];return _0x26d8a6;};'use strict';var Sequelize=require(_0x161a('0x0'));module['exports']={'name':{'type':Sequelize[_0x161a('0x1')],'unique':_0x161a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x161a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x161a('0x4'),_0x161a('0x5'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9cf2=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x482e94,_0x2f34bd){var _0x3c3ec1=function(_0x142a34){while(--_0x142a34){_0x482e94['push'](_0x482e94['shift']());}};_0x3c3ec1(++_0x2f34bd);}(_0x9cf2,0xf7));var _0x29cf=function(_0x5283f1,_0x958204){_0x5283f1=_0x5283f1-0x0;var _0x17964e=_0x9cf2[_0x5283f1];return _0x17964e;};'use strict';var Sequelize=require(_0x29cf('0x0'));module[_0x29cf('0x1')]={'name':{'type':Sequelize[_0x29cf('0x2')],'unique':_0x29cf('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x29cf('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x29cf('0x5')](_0x29cf('0x6'),_0x29cf('0x7'),_0x29cf('0x8'))},'description':{'type':Sequelize[_0x29cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 59ad226..2ff5518 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 _0x775a=['sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','WhatsappQueues','UserProfileResource','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','WhatsappQueue','find','create','user','role','get','userProfileId','autoAssociation','body','describe','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','updatedAt','whatsappPause','createdAt','getTeams','Team','ids','User','Agents','online','voicePause','flatMap','addTeams','each','findOrCreate','forEach','emit','select','tq.TeamId','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','includes','all','compact','value','removeTeams','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x5c0d00,_0x3795fb){var _0x332df9=function(_0x27447a){while(--_0x27447a){_0x5c0d00['push'](_0x5c0d00['shift']());}};_0x332df9(++_0x3795fb);}(_0x775a,0xed));var _0xa775=function(_0x39f7b5,_0x10ddb9){_0x39f7b5=_0x39f7b5-0x0;var _0x17e247=_0x775a[_0x39f7b5];return _0x17e247;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa775('0x0'));var rimraf=require(_0xa775('0x1'));var zipdir=require(_0xa775('0x2'));var jsonpatch=require(_0xa775('0x3'));var rp=require(_0xa775('0x4'));var moment=require(_0xa775('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa775('0x6'));var util=require(_0xa775('0x7'));var path=require(_0xa775('0x8'));var sox=require('sox');var csv=require(_0xa775('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa775('0xa'));var jsforce=require(_0xa775('0xb'));var deskjs=require(_0xa775('0xc'));var toCsv=require(_0xa775('0x9'));var querystring=require(_0xa775('0xd'));var Papa=require(_0xa775('0xe'));var Redis=require(_0xa775('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa775('0x10'));var as=require(_0xa775('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa775('0x12'));var config=require(_0xa775('0x13'));var db=require(_0xa775('0x14'))['db'];config[_0xa775('0x15')]=_[_0xa775('0x16')](config[_0xa775('0x15')],{'host':_0xa775('0x17'),'port':0x18eb});var socket=require(_0xa775('0x18'))(new Redis(config[_0xa775('0x15')]));require(_0xa775('0x19'))[_0xa775('0x1a')](socket);function respondWithStatusCode(_0x16efaa,_0x5708c1){_0x5708c1=_0x5708c1||0xcc;return function(_0x1f3cdb){if(_0x1f3cdb){return _0x16efaa[_0xa775('0x1b')](_0x5708c1);}return _0x16efaa[_0xa775('0x1c')](_0x5708c1)['end']();};}function respondWithResult(_0x5bc58e,_0x52d4a3){_0x52d4a3=_0x52d4a3||0xc8;return function(_0x15020e){if(_0x15020e){return _0x5bc58e[_0xa775('0x1c')](_0x52d4a3)[_0xa775('0x1d')](_0x15020e);}};}function respondWithFilteredResult(_0x5137ec,_0x2cfe1c){return function(_0x3de00f){if(_0x3de00f){var _0x4886c8=_0x3de00f['count'],_0x1ab535=_0x2cfe1c[_0xa775('0x1e')],_0x204f1c=_0x2cfe1c['offset']+_0x2cfe1c[_0xa775('0x1f')],_0x1af19d;if(_0x204f1c>=_0x4886c8){_0x204f1c=_0x4886c8;_0x1af19d=0xc8;}else{_0x1af19d=0xce;}_0x5137ec[_0xa775('0x1c')](_0x1af19d);return _0x5137ec[_0xa775('0x20')](_0xa775('0x21'),_0x1ab535+'-'+_0x204f1c+'/'+_0x4886c8)[_0xa775('0x1d')](_0x3de00f);}return null;};}function patchUpdates(_0x2f1361){return function(_0x5806c0){try{jsonpatch[_0xa775('0x22')](_0x5806c0,_0x2f1361,!![]);}catch(_0x243764){return BPromise[_0xa775('0x23')](_0x243764);}return _0x5806c0['save']();};}function saveUpdates(_0x1431b5,_0xcad945){return function(_0x5260fc){if(_0x5260fc){return _0x5260fc[_0xa775('0x24')](_0x1431b5)['then'](function(_0x15ffde){return _0x15ffde;});}return null;};}function removeEntity(_0x5da623,_0x50c9a1){return function(_0x4330d8){if(_0x4330d8){return _0x4330d8['destroy']()[_0xa775('0x25')](function(){var _0x4e0269=_0x4330d8['get']({'plain':!![]});var _0x62d57a=_0xa775('0x26');return db[_0xa775('0x27')][_0xa775('0x28')]({'where':{'type':_0x62d57a,'resourceId':_0x4e0269['id']}})['then'](function(){return _0x4330d8;});})['then'](function(){_0x5da623[_0xa775('0x1c')](0xcc)[_0xa775('0x29')]();});}};}function handleEntityNotFound(_0x472491,_0x378e61){return function(_0x2519df){if(!_0x2519df){_0x472491[_0xa775('0x1b')](0x194);}return _0x2519df;};}function handleError(_0x1e883d,_0x4974c1){_0x4974c1=_0x4974c1||0x1f4;return function(_0x5ea461){logger[_0xa775('0x2a')](_0x5ea461[_0xa775('0x2b')]);if(_0x5ea461[_0xa775('0x2c')]){delete _0x5ea461[_0xa775('0x2c')];}_0x1e883d[_0xa775('0x1c')](_0x4974c1)['send'](_0x5ea461);};}exports[_0xa775('0x2d')]=function(_0x5812e9,_0x3feb29){var _0x3704da={},_0x5c7c25={},_0x129018={'count':0x0,'rows':[]};var _0x410f55=_[_0xa775('0x2e')](db['WhatsappQueue'][_0xa775('0x2f')],function(_0x34aab6){return{'name':_0x34aab6[_0xa775('0x30')],'type':_0x34aab6[_0xa775('0x31')]['key']};});_0x5c7c25['model']=_[_0xa775('0x2e')](_0x410f55,'name');_0x5c7c25[_0xa775('0x32')]=_[_0xa775('0x33')](_0x5812e9[_0xa775('0x32')]);_0x5c7c25[_0xa775('0x34')]=_[_0xa775('0x35')](_0x5c7c25[_0xa775('0x36')],_0x5c7c25[_0xa775('0x32')]);_0x3704da[_0xa775('0x37')]=_[_0xa775('0x35')](_0x5c7c25['model'],qs[_0xa775('0x38')](_0x5812e9[_0xa775('0x32')][_0xa775('0x38')]));_0x3704da[_0xa775('0x37')]=_0x3704da[_0xa775('0x37')][_0xa775('0x39')]?_0x3704da[_0xa775('0x37')]:_0x5c7c25[_0xa775('0x36')];if(!_0x5812e9['query'][_0xa775('0x3a')](_0xa775('0x3b'))){_0x3704da[_0xa775('0x1f')]=qs['limit'](_0x5812e9['query'][_0xa775('0x1f')]);_0x3704da[_0xa775('0x1e')]=qs[_0xa775('0x1e')](_0x5812e9[_0xa775('0x32')]['offset']);}_0x3704da[_0xa775('0x3c')]=qs['sort'](_0x5812e9[_0xa775('0x32')][_0xa775('0x3d')]);_0x3704da['where']=qs['filters'](_[_0xa775('0x3e')](_0x5812e9['query'],_0x5c7c25[_0xa775('0x34')]),_0x410f55);if(_0x5812e9[_0xa775('0x32')]['filter']){_0x3704da['where']=_[_0xa775('0x3f')](_0x3704da[_0xa775('0x40')],{'$or':_['map'](_0x410f55,function(_0x756113){if(_0x756113[_0xa775('0x31')]!==_0xa775('0x41')){var _0x59dbe8={};_0x59dbe8[_0x756113[_0xa775('0x2c')]]={'$like':'%'+_0x5812e9['query'][_0xa775('0x42')]+'%'};return _0x59dbe8;}})});}_0x3704da=_[_0xa775('0x3f')]({},_0x3704da,_0x5812e9[_0xa775('0x43')]);var _0x509082={'where':_0x3704da['where']};return db['WhatsappQueue'][_0xa775('0x44')](_0x509082)[_0xa775('0x25')](function(_0x2b540e){_0x129018[_0xa775('0x44')]=_0x2b540e;if(_0x5812e9[_0xa775('0x32')][_0xa775('0x45')]){_0x3704da[_0xa775('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xa775('0x47')](_0x3704da);})[_0xa775('0x25')](function(_0x1a25f6){_0x129018['rows']=_0x1a25f6;return _0x129018;})[_0xa775('0x25')](respondWithFilteredResult(_0x3feb29,_0x3704da))[_0xa775('0x48')](handleError(_0x3feb29,null));};exports[_0xa775('0x49')]=function(_0x1bf101,_0x577d45){var _0x32f101={'raw':!![],'where':{'id':_0x1bf101[_0xa775('0x4a')]['id']}},_0x4d1401={};_0x4d1401[_0xa775('0x36')]=_[_0xa775('0x33')](db[_0xa775('0x4b')]['rawAttributes']);_0x4d1401['query']=_['keys'](_0x1bf101[_0xa775('0x32')]);_0x4d1401[_0xa775('0x34')]=_['intersection'](_0x4d1401[_0xa775('0x36')],_0x4d1401[_0xa775('0x32')]);_0x32f101['attributes']=_[_0xa775('0x35')](_0x4d1401[_0xa775('0x36')],qs[_0xa775('0x38')](_0x1bf101[_0xa775('0x32')]['fields']));_0x32f101[_0xa775('0x37')]=_0x32f101[_0xa775('0x37')]['length']?_0x32f101[_0xa775('0x37')]:_0x4d1401['model'];if(_0x1bf101[_0xa775('0x32')][_0xa775('0x45')]){_0x32f101[_0xa775('0x46')]=[{'all':!![]}];}_0x32f101=_['merge']({},_0x32f101,_0x1bf101[_0xa775('0x43')]);return db[_0xa775('0x4b')][_0xa775('0x4c')](_0x32f101)['then'](handleEntityNotFound(_0x577d45,null))[_0xa775('0x25')](respondWithResult(_0x577d45,null))[_0xa775('0x48')](handleError(_0x577d45,null));};exports[_0xa775('0x4d')]=function(_0x4f2042,_0x39306a){return db['WhatsappQueue']['create'](_0x4f2042['body'],{})[_0xa775('0x25')](function(_0x13fe95){var _0x26ee63=_0x4f2042[_0xa775('0x4e')]['get']({'plain':!![]});if(!_0x26ee63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26ee63[_0xa775('0x4f')]===_0xa775('0x4e')){var _0x30aaf4=_0x13fe95[_0xa775('0x50')]({'plain':!![]});var _0x22b8a8='WhatsappQueues';return db['UserProfileSection'][_0xa775('0x4c')]({'where':{'name':_0x22b8a8,'userProfileId':_0x26ee63[_0xa775('0x51')]},'raw':!![]})[_0xa775('0x25')](function(_0x1abb6d){if(_0x1abb6d&&_0x1abb6d[_0xa775('0x52')]===0x0){return db[_0xa775('0x27')][_0xa775('0x4d')]({'name':_0x30aaf4[_0xa775('0x2c')],'resourceId':_0x30aaf4['id'],'type':_0x1abb6d['name'],'sectionId':_0x1abb6d['id']},{})['then'](function(){return _0x13fe95;});}else{return _0x13fe95;}})['catch'](function(_0x3159c8){logger[_0xa775('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3159c8);throw _0x3159c8;});}return _0x13fe95;})[_0xa775('0x25')](respondWithResult(_0x39306a,0xc9))[_0xa775('0x48')](handleError(_0x39306a,null));};exports[_0xa775('0x24')]=function(_0x17f70d,_0x1524b9){if(_0x17f70d['body']['id']){delete _0x17f70d[_0xa775('0x53')]['id'];}return db[_0xa775('0x4b')]['find']({'where':{'id':_0x17f70d[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x1524b9,null))['then'](saveUpdates(_0x17f70d['body'],null))[_0xa775('0x25')](respondWithResult(_0x1524b9,null))['catch'](handleError(_0x1524b9,null));};exports[_0xa775('0x28')]=function(_0x22af18,_0x2a3a36){return db['WhatsappQueue'][_0xa775('0x4c')]({'where':{'id':_0x22af18['params']['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x2a3a36,null))[_0xa775('0x25')](removeEntity(_0x2a3a36,null))[_0xa775('0x48')](handleError(_0x2a3a36,null));};exports[_0xa775('0x54')]=function(_0x1b6e7c,_0x243d71){return db['WhatsappQueue'][_0xa775('0x54')]()['then'](respondWithResult(_0x243d71,null))[_0xa775('0x48')](handleError(_0x243d71,null));};exports['getMembers']=function(_0x372b77,_0x1173a4,_0x12ccc){var _0x4698eb={'raw':!![],'where':{}},_0x4ba811={},_0x2d36b2;return db[_0xa775('0x4b')][_0xa775('0x55')]({'where':{'id':_0x372b77[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x1173a4,null))[_0xa775('0x25')](function(_0x45f48c){if(_0x45f48c){_0x2d36b2=_0x45f48c['get']({'plain':!![]});_0x4ba811[_0xa775('0x36')]=_[_0xa775('0x33')](db[_0xa775('0x56')]['rawAttributes']);_0x4ba811[_0xa775('0x32')]=_[_0xa775('0x33')](_0x372b77['query']);_0x4ba811[_0xa775('0x34')]=_[_0xa775('0x35')](_0x4ba811[_0xa775('0x36')],_0x4ba811['query']);_0x4698eb['attributes']=_[_0xa775('0x35')](_0x4ba811[_0xa775('0x36')],qs[_0xa775('0x38')](_0x372b77[_0xa775('0x32')][_0xa775('0x38')]));_0x4698eb[_0xa775('0x37')]=_0x4698eb[_0xa775('0x37')][_0xa775('0x39')]?_0x4698eb[_0xa775('0x37')]:_0x4ba811[_0xa775('0x36')];if(!_0x372b77[_0xa775('0x32')][_0xa775('0x3a')](_0xa775('0x3b'))){_0x4698eb[_0xa775('0x1f')]=qs['limit'](_0x372b77[_0xa775('0x32')]['limit']);_0x4698eb[_0xa775('0x1e')]=qs[_0xa775('0x1e')](_0x372b77[_0xa775('0x32')][_0xa775('0x1e')]);}_0x4698eb[_0xa775('0x3c')]=qs[_0xa775('0x3d')](_0x372b77['query'][_0xa775('0x3d')]);_0x4698eb['where']=qs[_0xa775('0x34')](_[_0xa775('0x3e')](_0x372b77[_0xa775('0x32')],_0x4ba811[_0xa775('0x34')]));_0x4698eb[_0xa775('0x40')][_0xa775('0x57')]=_0x45f48c['id'];if(_0x372b77[_0xa775('0x32')][_0xa775('0x42')]){_0x4698eb[_0xa775('0x40')]=_[_0xa775('0x3f')](_0x4698eb[_0xa775('0x40')],{'$or':_[_0xa775('0x2e')](_0x4698eb['attributes'],function(_0x82516d){var _0x2490ad={};_0x2490ad[_0x82516d]={'$like':'%'+_0x372b77[_0xa775('0x32')][_0xa775('0x42')]+'%'};return _0x2490ad;})});}_0x4698eb=_[_0xa775('0x3f')]({},_0x4698eb,_0x372b77[_0xa775('0x43')]);return db[_0xa775('0x56')]['findAll'](_0x4698eb);}})[_0xa775('0x25')](function(_0x1eb3c8){if(_0x1eb3c8){return db['User'][_0xa775('0x58')]({'where':{'id':_['map'](_0x1eb3c8,_0xa775('0x59')),'role':_0xa775('0x5a')},'attributes':['id',_0xa775('0x2c'),'whatsappPause',_0xa775('0x5b'),'createdAt']});}})[_0xa775('0x25')](function(_0xb7d7b8){if(_0xb7d7b8){return{'count':_0xb7d7b8['count'],'rows':_[_0xa775('0x2e')](_0xb7d7b8['rows'],function(_0x5d2420){return{'membername':_0x5d2420[_0xa775('0x2c')],'UserId':_0x5d2420['id'],'queue_name':_0x2d36b2['name'],'WhatsappQueueId':_0x2d36b2['id'],'interface':util['format']('%s/%s','SIP',_0x5d2420['name']),'penalty':0x0,'paused':_0x5d2420[_0xa775('0x5c')],'createdAt':_0x5d2420[_0xa775('0x5d')],'updatedAt':_0x5d2420[_0xa775('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa775('0x25')](respondWithFilteredResult(_0x1173a4,_0x4698eb))[_0xa775('0x48')](handleError(_0x1173a4,null));};exports[_0xa775('0x5e')]=function(_0x11d584,_0x5035b3,_0x50cde3){var _0x4e3bca={};var _0x114c0a={};var _0x1a74e0;var _0x54d1a6;return db[_0xa775('0x4b')][_0xa775('0x55')]({'where':{'id':_0x11d584['params']['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x5035b3,null))[_0xa775('0x25')](function(_0x26d3ad){if(_0x26d3ad){_0x1a74e0=_0x26d3ad;_0x114c0a['model']=_[_0xa775('0x33')](db[_0xa775('0x5f')]['rawAttributes']);_0x114c0a[_0xa775('0x32')]=_['keys'](_0x11d584[_0xa775('0x32')]);_0x114c0a[_0xa775('0x34')]=_['intersection'](_0x114c0a[_0xa775('0x36')],_0x114c0a['query']);_0x4e3bca['attributes']=_['intersection'](_0x114c0a[_0xa775('0x36')],qs[_0xa775('0x38')](_0x11d584[_0xa775('0x32')][_0xa775('0x38')]));_0x4e3bca[_0xa775('0x37')]=_0x4e3bca['attributes'][_0xa775('0x39')]?_0x4e3bca[_0xa775('0x37')]:_0x114c0a[_0xa775('0x36')];_0x4e3bca[_0xa775('0x3c')]=qs[_0xa775('0x3d')](_0x11d584[_0xa775('0x32')][_0xa775('0x3d')]);_0x4e3bca['where']=qs[_0xa775('0x34')](_[_0xa775('0x3e')](_0x11d584[_0xa775('0x32')],_0x114c0a[_0xa775('0x34')]));if(_0x11d584[_0xa775('0x32')][_0xa775('0x42')]){_0x4e3bca[_0xa775('0x40')]=_['merge'](_0x4e3bca[_0xa775('0x40')],{'$or':_[_0xa775('0x2e')](_0x4e3bca[_0xa775('0x37')],function(_0x4adf53){var _0x5c2677={};_0x5c2677[_0x4adf53]={'$like':'%'+_0x11d584[_0xa775('0x32')][_0xa775('0x42')]+'%'};return _0x5c2677;})});}_0x4e3bca=_['merge']({},_0x4e3bca,_0x11d584[_0xa775('0x43')]);return _0x1a74e0['getTeams'](_0x4e3bca);}})[_0xa775('0x25')](function(_0x3e3812){if(_0x3e3812){_0x54d1a6=_0x3e3812['length'];if(!_0x11d584['query'][_0xa775('0x3a')](_0xa775('0x3b'))){_0x4e3bca[_0xa775('0x1f')]=qs['limit'](_0x11d584[_0xa775('0x32')][_0xa775('0x1f')]);_0x4e3bca['offset']=qs[_0xa775('0x1e')](_0x11d584[_0xa775('0x32')][_0xa775('0x1e')]);}return _0x1a74e0[_0xa775('0x5e')](_0x4e3bca);}})[_0xa775('0x25')](function(_0x4cdd5b){if(_0x4cdd5b){return _0x4cdd5b?{'count':_0x54d1a6,'rows':_0x4cdd5b}:null;}})[_0xa775('0x25')](respondWithResult(_0x5035b3,null))[_0xa775('0x48')](handleError(_0x5035b3,null));};exports['addTeams']=function(_0x1a72a9,_0x1ff7e1,_0x6e1059){var _0x3362ca=_0x1a72a9[_0xa775('0x53')][_0xa775('0x60')];return db['Team'][_0xa775('0x47')]({'where':{'id':_0x3362ca},'attributes':['id'],'include':[{'model':db[_0xa775('0x61')],'as':_0xa775('0x62'),'attributes':['id',_0xa775('0x2c'),_0xa775('0x63'),_0xa775('0x64'),'interface'],'raw':!![]}]})[_0xa775('0x25')](function(_0x4912e7){if(_0x4912e7){var _0xb45223=_[_0xa775('0x65')](_0x4912e7,function(_0x567ebf){var _0x402ad3=_0x567ebf[_0xa775('0x50')]({'plain':!![]});return _0x402ad3[_0xa775('0x62')];});return db[_0xa775('0x4b')][_0xa775('0x4c')]({'where':{'id':_0x1a72a9[_0xa775('0x4a')]['id']}})['then'](function(_0x4d029f){return db['sequelize']['transaction'](function(_0x229af4){return _0x4d029f[_0xa775('0x66')](_0x3362ca,{'transaction':_0x229af4})['then'](function(){return BPromise[_0xa775('0x67')](_0xb45223,function(_0x553187){return db[_0xa775('0x56')][_0xa775('0x68')]({'where':{'UserId':_0x553187['id'],'WhatsappQueueId':_0x1a72a9[_0xa775('0x4a')]['id']},'transaction':_0x229af4});});})[_0xa775('0x25')](function(){_0xb45223[_0xa775('0x69')](function(_0x5c8450){socket[_0xa775('0x6a')]('userWhatsappQueue:save',{'UserId':_0x5c8450['id'],'WhatsappQueueId':_0x4d029f['id']});});});});});}})[_0xa775('0x25')](respondWithStatusCode(_0x1ff7e1,null))[_0xa775('0x48')](handleError(_0x1ff7e1,null));};exports['removeTeams']=function(_0x59b585,_0x5c37de,_0x5c3b98){return db[_0xa775('0x5f')][_0xa775('0x47')]({'where':{'id':_0x59b585[_0xa775('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa775('0x61')],'as':_0xa775('0x62'),'attributes':['id'],'raw':!![]}]})[_0xa775('0x25')](handleEntityNotFound(_0x5c37de,null))[_0xa775('0x25')](function(_0x297fbe){var _0x473ae2=_[_0xa775('0x2e')](_0x297fbe,'id');var _0x4be1c9=[];var _0x1e3555=[];var _0x3491fa=squel[_0xa775('0x6b')]();_0x3491fa['field'](_0xa775('0x6c'))['from'](_0xa775('0x6d'),'tq')['join']('user_has_teams','ut',_0xa775('0x6e'))[_0xa775('0x40')](_0xa775('0x6f'),_0x59b585[_0xa775('0x4a')]['id']);for(var _0x5065ad=0x0;_0x5065ad<_0x297fbe[_0xa775('0x39')];_0x5065ad+=0x1){let _0xdde26e=_0x297fbe[_0x5065ad];for(var _0x151fea=0x0;_0x151fea<_0xdde26e[_0xa775('0x62')][_0xa775('0x39')];_0x151fea+=0x1){let _0x570f61=_0xdde26e[_0xa775('0x62')][_0x151fea];var _0x1c7ec6=_0x3491fa[_0xa775('0x70')]();_0x1c7ec6[_0xa775('0x40')](_0xa775('0x71'),_0x570f61['id']);_0x1e3555[_0xa775('0x72')](db[_0xa775('0x73')][_0xa775('0x32')](_0x1c7ec6['toString'](),{'type':db['sequelize'][_0xa775('0x74')]['SELECT']})[_0xa775('0x25')](function(_0x14b523){if(_0x14b523[_0xa775('0x39')]===0x1){return _0x570f61['id'];}else{var _0x39ba39=_[_0xa775('0x75')](_[_0xa775('0x2e')](_0x14b523,_0xa775('0x76')),function(_0x3f9959){return _[_0xa775('0x77')](_0x473ae2,_0x3f9959);});if(_0x39ba39){return _0x570f61['id'];}}}));}}return BPromise[_0xa775('0x78')](_0x1e3555)[_0xa775('0x25')](function(_0x1d1ebc){_0x4be1c9=_(_0x4be1c9)['union'](_0x1d1ebc)[_0xa775('0x79')]()[_0xa775('0x7a')]();return db['WhatsappQueue'][_0xa775('0x4c')]({'where':{'id':_0x59b585[_0xa775('0x4a')]['id']}})['then'](function(_0x5cdc0c){return db[_0xa775('0x73')]['transaction'](function(_0x196c78){return _0x5cdc0c[_0xa775('0x7b')](_0x59b585[_0xa775('0x32')]['ids'],{'transaction':_0x196c78})[_0xa775('0x25')](function(){if(!_['isEmpty'](_0x4be1c9)){return _0x5cdc0c[_0xa775('0x7c')](_0x4be1c9,{'transaction':_0x196c78});}})['then'](function(){_0x4be1c9['forEach'](function(_0x59c5c1){socket[_0xa775('0x6a')]('userWhatsappQueue:remove',{'UserId':_0x59c5c1,'WhatsappQueueId':_0x5cdc0c['id']});});});});});});})['then'](respondWithStatusCode(_0x5c37de,null))[_0xa775('0x48')](handleError(_0x5c37de,null));};exports['addAgents']=function(_0x5b5679,_0x5ec1a5,_0x5773d3){return db[_0xa775('0x4b')][_0xa775('0x4c')]({'where':{'id':_0x5b5679[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x5ec1a5,null))[_0xa775('0x25')](function(_0x40aa67){if(_0x40aa67){return _0x40aa67[_0xa775('0x7d')](_0x5b5679[_0xa775('0x53')][_0xa775('0x60')],_[_0xa775('0x7e')](_0x5b5679[_0xa775('0x53')],[_0xa775('0x60'),'id'])||{})[_0xa775('0x7f')](function(_0x597941){for(var _0x3d1c27=0x0;_0x3d1c27<_0x5b5679['body']['ids'][_0xa775('0x39')];_0x3d1c27+=0x1){socket[_0xa775('0x6a')](_0xa775('0x80'),{'UserId':_0x5b5679[_0xa775('0x53')][_0xa775('0x60')][_0x3d1c27],'WhatsappQueueId':_0x5b5679['params']['id']});}return _0x597941;});}})[_0xa775('0x25')](respondWithResult(_0x5ec1a5,null))[_0xa775('0x48')](handleError(_0x5ec1a5,null));};exports[_0xa775('0x7c')]=function(_0x70daba,_0x4ff7cb,_0x2c1e98){return db['WhatsappQueue'][_0xa775('0x4c')]({'where':{'id':_0x70daba[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x4ff7cb,null))['then'](function(_0x13ff77){if(_0x13ff77){return _0x13ff77[_0xa775('0x7c')](_0x70daba['query'][_0xa775('0x60')])['then'](function(){if(_[_0xa775('0x81')](_0x70daba[_0xa775('0x32')]['ids'])){for(var _0x131e8c=0x0;_0x131e8c<_0x70daba[_0xa775('0x32')][_0xa775('0x60')][_0xa775('0x39')];_0x131e8c+=0x1){socket[_0xa775('0x6a')](_0xa775('0x82'),{'UserId':Number(_0x70daba[_0xa775('0x32')]['ids'][_0x131e8c]),'WhatsappQueueId':Number(_0x70daba[_0xa775('0x4a')]['id'])});}}else{socket['emit'](_0xa775('0x82'),{'UserId':Number(_0x70daba[_0xa775('0x32')][_0xa775('0x60')]),'WhatsappQueueId':Number(_0x70daba[_0xa775('0x4a')]['id'])});}});}})[_0xa775('0x25')](respondWithStatusCode(_0x4ff7cb,null))['catch'](handleError(_0x4ff7cb,null));};exports['getAgents']=function(_0x382bc7,_0x51b186,_0x304cd8){var _0x3027f9={};var _0xe512b8={};var _0x53b69a;var _0x4f52c1;return db['WhatsappQueue'][_0xa775('0x55')]({'where':{'id':_0x382bc7[_0xa775('0x4a')]['id']}})[_0xa775('0x25')](handleEntityNotFound(_0x51b186,null))[_0xa775('0x25')](function(_0x409391){if(_0x409391){_0x53b69a=_0x409391;_0xe512b8[_0xa775('0x36')]=_['keys'](db['User'][_0xa775('0x2f')]);_0xe512b8[_0xa775('0x32')]=_[_0xa775('0x33')](_0x382bc7[_0xa775('0x32')]);_0xe512b8[_0xa775('0x34')]=_['intersection'](_0xe512b8['model'],_0xe512b8[_0xa775('0x32')]);_0x3027f9[_0xa775('0x37')]=_[_0xa775('0x35')](_0xe512b8[_0xa775('0x36')],qs[_0xa775('0x38')](_0x382bc7[_0xa775('0x32')][_0xa775('0x38')]));_0x3027f9['attributes']=_0x3027f9['attributes']['length']?_0x3027f9[_0xa775('0x37')]:_0xe512b8['model'];_0x3027f9[_0xa775('0x3c')]=qs[_0xa775('0x3d')](_0x382bc7[_0xa775('0x32')][_0xa775('0x3d')]);_0x3027f9[_0xa775('0x40')]=qs['filters'](_['pick'](_0x382bc7[_0xa775('0x32')],_0xe512b8['filters']));if(_0x382bc7[_0xa775('0x32')][_0xa775('0x42')]){_0x3027f9['where']=_[_0xa775('0x3f')](_0x3027f9[_0xa775('0x40')],{'$or':_[_0xa775('0x2e')](_0x3027f9[_0xa775('0x37')],function(_0x360284){var _0x534c32={};_0x534c32[_0x360284]={'$like':'%'+_0x382bc7[_0xa775('0x32')]['filter']+'%'};return _0x534c32;})});}_0x3027f9=_[_0xa775('0x3f')]({},_0x3027f9,_0x382bc7['options']);return _0x53b69a[_0xa775('0x83')](_0x3027f9);}})[_0xa775('0x25')](function(_0x3cb1f5){if(_0x3cb1f5){_0x4f52c1=_0x3cb1f5[_0xa775('0x39')];if(!_0x382bc7[_0xa775('0x32')]['hasOwnProperty'](_0xa775('0x3b'))){_0x3027f9['limit']=qs[_0xa775('0x1f')](_0x382bc7[_0xa775('0x32')][_0xa775('0x1f')]);_0x3027f9['offset']=qs['offset'](_0x382bc7[_0xa775('0x32')][_0xa775('0x1e')]);}return _0x53b69a[_0xa775('0x83')](_0x3027f9);}})['then'](function(_0x4240d2){if(_0x4240d2){return _0x4240d2?{'count':_0x4f52c1,'rows':_0x4240d2}:null;}})['then'](respondWithResult(_0x51b186,null))[_0xa775('0x48')](handleError(_0x51b186,null));}; \ No newline at end of file +var _0x5255=['findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','findOne','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','WhatsappQueue','rawAttributes','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','get','UserWhatsappQueue','WhatsappQueueId','findAll','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','nolimit','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each'];(function(_0x4b0dfe,_0x532a27){var _0x415271=function(_0x5ba4b){while(--_0x5ba4b){_0x4b0dfe['push'](_0x4b0dfe['shift']());}};_0x415271(++_0x532a27);}(_0x5255,0xad));var _0x5525=function(_0x2ba78b,_0x323359){_0x2ba78b=_0x2ba78b-0x0;var _0x4acb91=_0x5255[_0x2ba78b];return _0x4acb91;};'use strict';var pdf=require(_0x5525('0x0'));var emlformat=require(_0x5525('0x1'));var rimraf=require(_0x5525('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5525('0x3'));var rp=require(_0x5525('0x4'));var moment=require(_0x5525('0x5'));var BPromise=require(_0x5525('0x6'));var Mustache=require(_0x5525('0x7'));var util=require(_0x5525('0x8'));var path=require(_0x5525('0x9'));var sox=require(_0x5525('0xa'));var csv=require(_0x5525('0xb'));var ejs=require(_0x5525('0xc'));var fs=require('fs');var _=require(_0x5525('0xd'));var squel=require(_0x5525('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5525('0xf'));var toCsv=require(_0x5525('0xb'));var querystring=require(_0x5525('0x10'));var Papa=require(_0x5525('0x11'));var Redis=require('ioredis');var authService=require(_0x5525('0x12'));var qs=require(_0x5525('0x13'));var as=require(_0x5525('0x14'));var hardwareService=require(_0x5525('0x15'));var logger=require(_0x5525('0x16'))(_0x5525('0x17'));var utils=require('../../config/utils');var config=require(_0x5525('0x18'));var db=require(_0x5525('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5525('0x1a')]));require(_0x5525('0x1b'))[_0x5525('0x1c')](socket);function respondWithStatusCode(_0x31e3a1,_0x45bd38){_0x45bd38=_0x45bd38||0xcc;return function(_0x24b877){if(_0x24b877){return _0x31e3a1[_0x5525('0x1d')](_0x45bd38);}return _0x31e3a1[_0x5525('0x1e')](_0x45bd38)[_0x5525('0x1f')]();};}function respondWithResult(_0x34b3c1,_0xe92738){_0xe92738=_0xe92738||0xc8;return function(_0x3a1906){if(_0x3a1906){return _0x34b3c1[_0x5525('0x1e')](_0xe92738)['json'](_0x3a1906);}};}function respondWithFilteredResult(_0xfde2cc,_0x41b86d){return function(_0x2f1356){if(_0x2f1356){var _0x51eb4f=_0x2f1356[_0x5525('0x20')],_0x1226fc=_0x41b86d[_0x5525('0x21')],_0x44d699=_0x41b86d[_0x5525('0x21')]+_0x41b86d[_0x5525('0x22')],_0x59aada;if(_0x44d699>=_0x51eb4f){_0x44d699=_0x51eb4f;_0x59aada=0xc8;}else{_0x59aada=0xce;}_0xfde2cc[_0x5525('0x1e')](_0x59aada);return _0xfde2cc[_0x5525('0x23')](_0x5525('0x24'),_0x1226fc+'-'+_0x44d699+'/'+_0x51eb4f)[_0x5525('0x25')](_0x2f1356);}return null;};}function patchUpdates(_0x19d37a){return function(_0x595ed8){try{jsonpatch[_0x5525('0x26')](_0x595ed8,_0x19d37a,!![]);}catch(_0x38bb35){return BPromise[_0x5525('0x27')](_0x38bb35);}return _0x595ed8[_0x5525('0x28')]();};}function saveUpdates(_0x45f32a,_0x4cdacb){return function(_0x1c9814){if(_0x1c9814){return _0x1c9814[_0x5525('0x29')](_0x45f32a)[_0x5525('0x2a')](function(_0x2d43fc){return _0x2d43fc;});}return null;};}function removeEntity(_0x3248a8,_0x39963d){return function(_0x4f4afe){if(_0x4f4afe){return _0x4f4afe['destroy']()[_0x5525('0x2a')](function(){var _0x6ad2f4=_0x4f4afe['get']({'plain':!![]});var _0x42479e='WhatsappQueues';return db['UserProfileResource'][_0x5525('0x2b')]({'where':{'type':_0x42479e,'resourceId':_0x6ad2f4['id']}})['then'](function(){return _0x4f4afe;});})[_0x5525('0x2a')](function(){_0x3248a8[_0x5525('0x1e')](0xcc)[_0x5525('0x1f')]();});}};}function handleEntityNotFound(_0x18683f,_0x48cede){return function(_0x25f857){if(!_0x25f857){_0x18683f[_0x5525('0x1d')](0x194);}return _0x25f857;};}function handleError(_0xa690cb,_0x55261b){_0x55261b=_0x55261b||0x1f4;return function(_0xab2c2e){logger[_0x5525('0x2c')](_0xab2c2e['stack']);if(_0xab2c2e['name']){delete _0xab2c2e[_0x5525('0x2d')];}_0xa690cb[_0x5525('0x1e')](_0x55261b)['send'](_0xab2c2e);};}exports[_0x5525('0x2e')]=function(_0x2b7543,_0x1a6af6){var _0x471cb1={},_0x5e9ab5={},_0x159c0e={'count':0x0,'rows':[]};var _0x3525ea=_[_0x5525('0x2f')](db['WhatsappQueue']['rawAttributes'],function(_0x116837){return{'name':_0x116837[_0x5525('0x30')],'type':_0x116837[_0x5525('0x31')][_0x5525('0x32')]};});_0x5e9ab5[_0x5525('0x33')]=_['map'](_0x3525ea,'name');_0x5e9ab5[_0x5525('0x34')]=_[_0x5525('0x35')](_0x2b7543[_0x5525('0x34')]);_0x5e9ab5[_0x5525('0x36')]=_['intersection'](_0x5e9ab5[_0x5525('0x33')],_0x5e9ab5[_0x5525('0x34')]);_0x471cb1['attributes']=_[_0x5525('0x37')](_0x5e9ab5['model'],qs[_0x5525('0x38')](_0x2b7543[_0x5525('0x34')][_0x5525('0x38')]));_0x471cb1['attributes']=_0x471cb1[_0x5525('0x39')][_0x5525('0x3a')]?_0x471cb1[_0x5525('0x39')]:_0x5e9ab5['model'];if(!_0x2b7543[_0x5525('0x34')][_0x5525('0x3b')]('nolimit')){_0x471cb1[_0x5525('0x22')]=qs['limit'](_0x2b7543[_0x5525('0x34')][_0x5525('0x22')]);_0x471cb1[_0x5525('0x21')]=qs[_0x5525('0x21')](_0x2b7543[_0x5525('0x34')][_0x5525('0x21')]);}_0x471cb1['order']=qs[_0x5525('0x3c')](_0x2b7543[_0x5525('0x34')][_0x5525('0x3c')]);_0x471cb1[_0x5525('0x3d')]=qs[_0x5525('0x36')](_[_0x5525('0x3e')](_0x2b7543[_0x5525('0x34')],_0x5e9ab5[_0x5525('0x36')]),_0x3525ea);if(_0x2b7543[_0x5525('0x34')]['filter']){_0x471cb1['where']=_[_0x5525('0x3f')](_0x471cb1[_0x5525('0x3d')],{'$or':_[_0x5525('0x2f')](_0x3525ea,function(_0x4d91a3){if(_0x4d91a3[_0x5525('0x31')]!==_0x5525('0x40')){var _0x99b76c={};_0x99b76c[_0x4d91a3[_0x5525('0x2d')]]={'$like':'%'+_0x2b7543[_0x5525('0x34')][_0x5525('0x41')]+'%'};return _0x99b76c;}})});}_0x471cb1=_['merge']({},_0x471cb1,_0x2b7543['options']);var _0x394266={'where':_0x471cb1[_0x5525('0x3d')]};return db['WhatsappQueue']['count'](_0x394266)[_0x5525('0x2a')](function(_0x23ff8f){_0x159c0e[_0x5525('0x20')]=_0x23ff8f;if(_0x2b7543[_0x5525('0x34')][_0x5525('0x42')]){_0x471cb1[_0x5525('0x43')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x471cb1);})['then'](function(_0x151463){_0x159c0e[_0x5525('0x44')]=_0x151463;return _0x159c0e;})[_0x5525('0x2a')](respondWithFilteredResult(_0x1a6af6,_0x471cb1))['catch'](handleError(_0x1a6af6,null));};exports[_0x5525('0x45')]=function(_0x439516,_0x1cd801){var _0x15005c={'raw':!![],'where':{'id':_0x439516[_0x5525('0x46')]['id']}},_0x784d93={};_0x784d93[_0x5525('0x33')]=_[_0x5525('0x35')](db[_0x5525('0x47')][_0x5525('0x48')]);_0x784d93[_0x5525('0x34')]=_[_0x5525('0x35')](_0x439516['query']);_0x784d93[_0x5525('0x36')]=_[_0x5525('0x37')](_0x784d93[_0x5525('0x33')],_0x784d93[_0x5525('0x34')]);_0x15005c['attributes']=_[_0x5525('0x37')](_0x784d93[_0x5525('0x33')],qs['fields'](_0x439516[_0x5525('0x34')][_0x5525('0x38')]));_0x15005c[_0x5525('0x39')]=_0x15005c[_0x5525('0x39')][_0x5525('0x3a')]?_0x15005c['attributes']:_0x784d93[_0x5525('0x33')];if(_0x439516[_0x5525('0x34')][_0x5525('0x42')]){_0x15005c[_0x5525('0x43')]=[{'all':!![]}];}_0x15005c=_['merge']({},_0x15005c,_0x439516[_0x5525('0x49')]);return db[_0x5525('0x47')][_0x5525('0x4a')](_0x15005c)[_0x5525('0x2a')](handleEntityNotFound(_0x1cd801,null))['then'](respondWithResult(_0x1cd801,null))[_0x5525('0x4b')](handleError(_0x1cd801,null));};exports[_0x5525('0x4c')]=function(_0x533d46,_0xf748d8){return db[_0x5525('0x47')][_0x5525('0x4c')](_0x533d46[_0x5525('0x4d')],{})[_0x5525('0x2a')](function(_0x3c9e7e){var _0x3a2943=_0x533d46[_0x5525('0x4e')]['get']({'plain':!![]});if(!_0x3a2943)throw new Error(_0x5525('0x4f'));if(_0x3a2943[_0x5525('0x50')]==='user'){var _0x294a9f=_0x3c9e7e['get']({'plain':!![]});var _0x2e5a80=_0x5525('0x51');return db[_0x5525('0x52')][_0x5525('0x4a')]({'where':{'name':_0x2e5a80,'userProfileId':_0x3a2943[_0x5525('0x53')]},'raw':!![]})[_0x5525('0x2a')](function(_0x2faba3){if(_0x2faba3&&_0x2faba3[_0x5525('0x54')]===0x0){return db[_0x5525('0x55')][_0x5525('0x4c')]({'name':_0x294a9f[_0x5525('0x2d')],'resourceId':_0x294a9f['id'],'type':_0x2faba3['name'],'sectionId':_0x2faba3['id']},{})[_0x5525('0x2a')](function(){return _0x3c9e7e;});}else{return _0x3c9e7e;}})[_0x5525('0x4b')](function(_0x373e59){logger['error'](_0x5525('0x56'),_0x373e59);throw _0x373e59;});}return _0x3c9e7e;})[_0x5525('0x2a')](respondWithResult(_0xf748d8,0xc9))[_0x5525('0x4b')](handleError(_0xf748d8,null));};exports[_0x5525('0x29')]=function(_0x31e28c,_0x29edbd){if(_0x31e28c['body']['id']){delete _0x31e28c['body']['id'];}return db[_0x5525('0x47')][_0x5525('0x4a')]({'where':{'id':_0x31e28c[_0x5525('0x46')]['id']}})['then'](handleEntityNotFound(_0x29edbd,null))['then'](saveUpdates(_0x31e28c[_0x5525('0x4d')],null))[_0x5525('0x2a')](respondWithResult(_0x29edbd,null))[_0x5525('0x4b')](handleError(_0x29edbd,null));};exports[_0x5525('0x2b')]=function(_0x2f1a3a,_0x410368){return db[_0x5525('0x47')][_0x5525('0x4a')]({'where':{'id':_0x2f1a3a[_0x5525('0x46')]['id']}})['then'](handleEntityNotFound(_0x410368,null))[_0x5525('0x2a')](removeEntity(_0x410368,null))[_0x5525('0x4b')](handleError(_0x410368,null));};exports[_0x5525('0x57')]=function(_0x240c52,_0x4723e0){return db['WhatsappQueue'][_0x5525('0x57')]()[_0x5525('0x2a')](respondWithResult(_0x4723e0,null))[_0x5525('0x4b')](handleError(_0x4723e0,null));};exports['getMembers']=function(_0x34af6f,_0x340edb,_0xa22aeb){var _0x23ae0c={'raw':!![],'where':{}},_0x5204fc={},_0x28b0d8;return db[_0x5525('0x47')]['findOne']({'where':{'id':_0x34af6f[_0x5525('0x46')]['id']}})['then'](handleEntityNotFound(_0x340edb,null))[_0x5525('0x2a')](function(_0x4e0dfd){if(_0x4e0dfd){_0x28b0d8=_0x4e0dfd[_0x5525('0x58')]({'plain':!![]});_0x5204fc[_0x5525('0x33')]=_[_0x5525('0x35')](db[_0x5525('0x59')][_0x5525('0x48')]);_0x5204fc['query']=_[_0x5525('0x35')](_0x34af6f[_0x5525('0x34')]);_0x5204fc[_0x5525('0x36')]=_[_0x5525('0x37')](_0x5204fc[_0x5525('0x33')],_0x5204fc[_0x5525('0x34')]);_0x23ae0c['attributes']=_[_0x5525('0x37')](_0x5204fc[_0x5525('0x33')],qs[_0x5525('0x38')](_0x34af6f['query']['fields']));_0x23ae0c[_0x5525('0x39')]=_0x23ae0c[_0x5525('0x39')]['length']?_0x23ae0c[_0x5525('0x39')]:_0x5204fc[_0x5525('0x33')];if(!_0x34af6f[_0x5525('0x34')][_0x5525('0x3b')]('nolimit')){_0x23ae0c['limit']=qs[_0x5525('0x22')](_0x34af6f[_0x5525('0x34')][_0x5525('0x22')]);_0x23ae0c[_0x5525('0x21')]=qs[_0x5525('0x21')](_0x34af6f[_0x5525('0x34')][_0x5525('0x21')]);}_0x23ae0c['order']=qs[_0x5525('0x3c')](_0x34af6f[_0x5525('0x34')][_0x5525('0x3c')]);_0x23ae0c['where']=qs[_0x5525('0x36')](_[_0x5525('0x3e')](_0x34af6f[_0x5525('0x34')],_0x5204fc[_0x5525('0x36')]));_0x23ae0c[_0x5525('0x3d')][_0x5525('0x5a')]=_0x4e0dfd['id'];if(_0x34af6f[_0x5525('0x34')][_0x5525('0x41')]){_0x23ae0c[_0x5525('0x3d')]=_['merge'](_0x23ae0c[_0x5525('0x3d')],{'$or':_[_0x5525('0x2f')](_0x23ae0c[_0x5525('0x39')],function(_0x345ffd){var _0x3c24e9={};_0x3c24e9[_0x345ffd]={'$like':'%'+_0x34af6f['query'][_0x5525('0x41')]+'%'};return _0x3c24e9;})});}_0x23ae0c=_[_0x5525('0x3f')]({},_0x23ae0c,_0x34af6f[_0x5525('0x49')]);return db[_0x5525('0x59')][_0x5525('0x5b')](_0x23ae0c);}})['then'](function(_0x5e557a){if(_0x5e557a){return db[_0x5525('0x5c')]['findAndCountAll']({'where':{'id':_[_0x5525('0x2f')](_0x5e557a,_0x5525('0x5d')),'role':_0x5525('0x5e')},'attributes':['id',_0x5525('0x2d'),_0x5525('0x5f'),_0x5525('0x60'),_0x5525('0x61')]});}})['then'](function(_0x16789a){if(_0x16789a){return{'count':_0x16789a[_0x5525('0x20')],'rows':_['map'](_0x16789a[_0x5525('0x44')],function(_0x45e017){return{'membername':_0x45e017[_0x5525('0x2d')],'UserId':_0x45e017['id'],'queue_name':_0x28b0d8[_0x5525('0x2d')],'WhatsappQueueId':_0x28b0d8['id'],'interface':util[_0x5525('0x62')]('%s/%s',_0x5525('0x63'),_0x45e017[_0x5525('0x2d')]),'penalty':0x0,'paused':_0x45e017['whatsappPause'],'createdAt':_0x45e017[_0x5525('0x61')],'updatedAt':_0x45e017[_0x5525('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x340edb,_0x23ae0c))['catch'](handleError(_0x340edb,null));};exports[_0x5525('0x64')]=function(_0x5f19c2,_0x52b2ed,_0x2374c5){var _0x5b542b={};var _0x2b80b0={};var _0x30d5b4;var _0x182f88;return db[_0x5525('0x47')]['findOne']({'where':{'id':_0x5f19c2[_0x5525('0x46')]['id']}})[_0x5525('0x2a')](handleEntityNotFound(_0x52b2ed,null))[_0x5525('0x2a')](function(_0x588c04){if(_0x588c04){_0x30d5b4=_0x588c04;_0x2b80b0[_0x5525('0x33')]=_[_0x5525('0x35')](db[_0x5525('0x65')][_0x5525('0x48')]);_0x2b80b0[_0x5525('0x34')]=_['keys'](_0x5f19c2[_0x5525('0x34')]);_0x2b80b0[_0x5525('0x36')]=_[_0x5525('0x37')](_0x2b80b0[_0x5525('0x33')],_0x2b80b0['query']);_0x5b542b[_0x5525('0x39')]=_[_0x5525('0x37')](_0x2b80b0[_0x5525('0x33')],qs['fields'](_0x5f19c2[_0x5525('0x34')][_0x5525('0x38')]));_0x5b542b[_0x5525('0x39')]=_0x5b542b[_0x5525('0x39')][_0x5525('0x3a')]?_0x5b542b[_0x5525('0x39')]:_0x2b80b0[_0x5525('0x33')];_0x5b542b[_0x5525('0x66')]=qs[_0x5525('0x3c')](_0x5f19c2[_0x5525('0x34')][_0x5525('0x3c')]);_0x5b542b[_0x5525('0x3d')]=qs[_0x5525('0x36')](_[_0x5525('0x3e')](_0x5f19c2[_0x5525('0x34')],_0x2b80b0[_0x5525('0x36')]));if(_0x5f19c2[_0x5525('0x34')][_0x5525('0x41')]){_0x5b542b[_0x5525('0x3d')]=_[_0x5525('0x3f')](_0x5b542b[_0x5525('0x3d')],{'$or':_[_0x5525('0x2f')](_0x5b542b[_0x5525('0x39')],function(_0x235d5f){var _0x2035b4={};_0x2035b4[_0x235d5f]={'$like':'%'+_0x5f19c2[_0x5525('0x34')]['filter']+'%'};return _0x2035b4;})});}_0x5b542b=_['merge']({},_0x5b542b,_0x5f19c2['options']);return _0x30d5b4[_0x5525('0x64')](_0x5b542b);}})['then'](function(_0x5f3597){if(_0x5f3597){_0x182f88=_0x5f3597[_0x5525('0x3a')];if(!_0x5f19c2[_0x5525('0x34')][_0x5525('0x3b')](_0x5525('0x67'))){_0x5b542b[_0x5525('0x22')]=qs[_0x5525('0x22')](_0x5f19c2[_0x5525('0x34')][_0x5525('0x22')]);_0x5b542b['offset']=qs[_0x5525('0x21')](_0x5f19c2[_0x5525('0x34')]['offset']);}return _0x30d5b4[_0x5525('0x64')](_0x5b542b);}})[_0x5525('0x2a')](function(_0x4a6829){if(_0x4a6829){return _0x4a6829?{'count':_0x182f88,'rows':_0x4a6829}:null;}})['then'](respondWithResult(_0x52b2ed,null))['catch'](handleError(_0x52b2ed,null));};exports['addTeams']=function(_0x30e861,_0x2b9fae,_0x2f3103){var _0x7cc52=_0x30e861[_0x5525('0x4d')][_0x5525('0x68')];return db[_0x5525('0x65')][_0x5525('0x5b')]({'where':{'id':_0x7cc52},'attributes':['id'],'include':[{'model':db[_0x5525('0x5c')],'as':_0x5525('0x69'),'attributes':['id',_0x5525('0x2d'),_0x5525('0x6a'),'voicePause',_0x5525('0x6b')],'raw':!![]}]})[_0x5525('0x2a')](function(_0x1697f0){if(_0x1697f0){var _0x30e5ad=_[_0x5525('0x6c')](_0x1697f0,function(_0x196dba){var _0x61f132=_0x196dba['get']({'plain':!![]});return _0x61f132[_0x5525('0x69')];});return db[_0x5525('0x47')][_0x5525('0x4a')]({'where':{'id':_0x30e861['params']['id']}})[_0x5525('0x2a')](function(_0x5863ce){return db[_0x5525('0x6d')][_0x5525('0x6e')](function(_0x58bc36){return _0x5863ce[_0x5525('0x6f')](_0x7cc52,{'transaction':_0x58bc36})[_0x5525('0x2a')](function(){return BPromise[_0x5525('0x70')](_0x30e5ad,function(_0x30ebf9){return db['UserWhatsappQueue'][_0x5525('0x71')]({'where':{'UserId':_0x30ebf9['id'],'WhatsappQueueId':_0x30e861[_0x5525('0x46')]['id']},'transaction':_0x58bc36});});})['then'](function(){_0x30e5ad[_0x5525('0x72')](function(_0x1a62d1){socket[_0x5525('0x73')](_0x5525('0x74'),{'UserId':_0x1a62d1['id'],'WhatsappQueueId':_0x5863ce['id']});});});});});}})[_0x5525('0x2a')](respondWithStatusCode(_0x2b9fae,null))[_0x5525('0x4b')](handleError(_0x2b9fae,null));};exports[_0x5525('0x75')]=function(_0x2184fc,_0x139754,_0x460d85){return db[_0x5525('0x65')][_0x5525('0x5b')]({'where':{'id':_0x2184fc[_0x5525('0x34')][_0x5525('0x68')]},'attributes':['id'],'include':[{'model':db[_0x5525('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5525('0x2a')](handleEntityNotFound(_0x139754,null))['then'](function(_0x5717c4){var _0x2fdb36=_['map'](_0x5717c4,'id');var _0xbedbaa=[];var _0x31b451=[];var _0x2defa3=squel[_0x5525('0x76')]();_0x2defa3[_0x5525('0x77')](_0x5525('0x78'))[_0x5525('0x79')]('team_has_whatsapp_queues','tq')[_0x5525('0x7a')]('user_has_teams','ut',_0x5525('0x7b'))[_0x5525('0x3d')](_0x5525('0x7c'),_0x2184fc[_0x5525('0x46')]['id']);for(var _0x1e789b=0x0;_0x1e789b<_0x5717c4[_0x5525('0x3a')];_0x1e789b+=0x1){let _0x408c74=_0x5717c4[_0x1e789b];for(var _0xbaff93=0x0;_0xbaff93<_0x408c74[_0x5525('0x69')][_0x5525('0x3a')];_0xbaff93+=0x1){let _0x10dec0=_0x408c74[_0x5525('0x69')][_0xbaff93];var _0x56833b=_0x2defa3[_0x5525('0x7d')]();_0x56833b['where'](_0x5525('0x7e'),_0x10dec0['id']);_0x31b451[_0x5525('0x7f')](db[_0x5525('0x6d')][_0x5525('0x34')](_0x56833b[_0x5525('0x80')](),{'type':db[_0x5525('0x6d')]['QueryTypes']['SELECT']})[_0x5525('0x2a')](function(_0x478c75){if(_0x478c75[_0x5525('0x3a')]===0x1){return _0x10dec0['id'];}else{var _0x2c083a=_[_0x5525('0x81')](_[_0x5525('0x2f')](_0x478c75,_0x5525('0x82')),function(_0x1aeb28){return _[_0x5525('0x83')](_0x2fdb36,_0x1aeb28);});if(_0x2c083a){return _0x10dec0['id'];}}}));}}return BPromise[_0x5525('0x84')](_0x31b451)[_0x5525('0x2a')](function(_0x1bcb6d){_0xbedbaa=_(_0xbedbaa)[_0x5525('0x85')](_0x1bcb6d)[_0x5525('0x86')]()[_0x5525('0x87')]();return db[_0x5525('0x47')]['find']({'where':{'id':_0x2184fc[_0x5525('0x46')]['id']}})[_0x5525('0x2a')](function(_0x54e9ce){return db['sequelize'][_0x5525('0x6e')](function(_0x16e917){return _0x54e9ce['removeTeams'](_0x2184fc[_0x5525('0x34')][_0x5525('0x68')],{'transaction':_0x16e917})['then'](function(){if(!_[_0x5525('0x88')](_0xbedbaa)){return _0x54e9ce[_0x5525('0x89')](_0xbedbaa,{'transaction':_0x16e917});}})['then'](function(){_0xbedbaa[_0x5525('0x72')](function(_0x46f4a7){socket[_0x5525('0x73')](_0x5525('0x8a'),{'UserId':_0x46f4a7,'WhatsappQueueId':_0x54e9ce['id']});});});});});});})['then'](respondWithStatusCode(_0x139754,null))[_0x5525('0x4b')](handleError(_0x139754,null));};exports[_0x5525('0x8b')]=function(_0x287099,_0x896774,_0x2b4320){return db[_0x5525('0x47')]['find']({'where':{'id':_0x287099[_0x5525('0x46')]['id']}})['then'](handleEntityNotFound(_0x896774,null))[_0x5525('0x2a')](function(_0x4eb14d){if(_0x4eb14d){return _0x4eb14d['addAgents'](_0x287099[_0x5525('0x4d')][_0x5525('0x68')],_['omit'](_0x287099[_0x5525('0x4d')],[_0x5525('0x68'),'id'])||{})[_0x5525('0x8c')](function(_0x4bf4b9){for(var _0xf066ed=0x0;_0xf066ed<_0x287099[_0x5525('0x4d')]['ids']['length'];_0xf066ed+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x287099[_0x5525('0x4d')][_0x5525('0x68')][_0xf066ed],'WhatsappQueueId':_0x287099[_0x5525('0x46')]['id']});}return _0x4bf4b9;});}})['then'](respondWithResult(_0x896774,null))['catch'](handleError(_0x896774,null));};exports[_0x5525('0x89')]=function(_0x340656,_0x465596,_0x57e952){return db['WhatsappQueue']['find']({'where':{'id':_0x340656[_0x5525('0x46')]['id']}})[_0x5525('0x2a')](handleEntityNotFound(_0x465596,null))[_0x5525('0x2a')](function(_0x505427){if(_0x505427){return _0x505427[_0x5525('0x89')](_0x340656[_0x5525('0x34')]['ids'])[_0x5525('0x2a')](function(){if(_['isArray'](_0x340656[_0x5525('0x34')]['ids'])){for(var _0x51d1fb=0x0;_0x51d1fb<_0x340656['query']['ids'][_0x5525('0x3a')];_0x51d1fb+=0x1){socket[_0x5525('0x73')](_0x5525('0x8a'),{'UserId':Number(_0x340656[_0x5525('0x34')][_0x5525('0x68')][_0x51d1fb]),'WhatsappQueueId':Number(_0x340656[_0x5525('0x46')]['id'])});}}else{socket[_0x5525('0x73')](_0x5525('0x8a'),{'UserId':Number(_0x340656[_0x5525('0x34')]['ids']),'WhatsappQueueId':Number(_0x340656[_0x5525('0x46')]['id'])});}});}})[_0x5525('0x2a')](respondWithStatusCode(_0x465596,null))[_0x5525('0x4b')](handleError(_0x465596,null));};exports['getAgents']=function(_0x4f5311,_0x345fe7,_0x158aef){var _0x1c5bc9={};var _0x92a816={};var _0x31fec4;var _0x433da2;return db[_0x5525('0x47')][_0x5525('0x8d')]({'where':{'id':_0x4f5311[_0x5525('0x46')]['id']}})[_0x5525('0x2a')](handleEntityNotFound(_0x345fe7,null))[_0x5525('0x2a')](function(_0x35c925){if(_0x35c925){_0x31fec4=_0x35c925;_0x92a816[_0x5525('0x33')]=_['keys'](db[_0x5525('0x5c')][_0x5525('0x48')]);_0x92a816[_0x5525('0x34')]=_[_0x5525('0x35')](_0x4f5311['query']);_0x92a816[_0x5525('0x36')]=_[_0x5525('0x37')](_0x92a816[_0x5525('0x33')],_0x92a816['query']);_0x1c5bc9['attributes']=_[_0x5525('0x37')](_0x92a816[_0x5525('0x33')],qs[_0x5525('0x38')](_0x4f5311[_0x5525('0x34')][_0x5525('0x38')]));_0x1c5bc9[_0x5525('0x39')]=_0x1c5bc9[_0x5525('0x39')][_0x5525('0x3a')]?_0x1c5bc9['attributes']:_0x92a816[_0x5525('0x33')];_0x1c5bc9[_0x5525('0x66')]=qs[_0x5525('0x3c')](_0x4f5311['query']['sort']);_0x1c5bc9[_0x5525('0x3d')]=qs[_0x5525('0x36')](_[_0x5525('0x3e')](_0x4f5311[_0x5525('0x34')],_0x92a816['filters']));if(_0x4f5311[_0x5525('0x34')]['filter']){_0x1c5bc9[_0x5525('0x3d')]=_['merge'](_0x1c5bc9[_0x5525('0x3d')],{'$or':_['map'](_0x1c5bc9[_0x5525('0x39')],function(_0x3abe68){var _0x32ac41={};_0x32ac41[_0x3abe68]={'$like':'%'+_0x4f5311['query'][_0x5525('0x41')]+'%'};return _0x32ac41;})});}_0x1c5bc9=_[_0x5525('0x3f')]({},_0x1c5bc9,_0x4f5311[_0x5525('0x49')]);return _0x31fec4[_0x5525('0x8e')](_0x1c5bc9);}})[_0x5525('0x2a')](function(_0x91eef9){if(_0x91eef9){_0x433da2=_0x91eef9['length'];if(!_0x4f5311[_0x5525('0x34')][_0x5525('0x3b')]('nolimit')){_0x1c5bc9[_0x5525('0x22')]=qs[_0x5525('0x22')](_0x4f5311[_0x5525('0x34')][_0x5525('0x22')]);_0x1c5bc9[_0x5525('0x21')]=qs[_0x5525('0x21')](_0x4f5311['query'][_0x5525('0x21')]);}return _0x31fec4['getAgents'](_0x1c5bc9);}})[_0x5525('0x2a')](function(_0x238bfc){if(_0x238bfc){return _0x238bfc?{'count':_0x433da2,'rows':_0x238bfc}:null;}})['then'](respondWithResult(_0x345fe7,null))[_0x5525('0x4b')](handleError(_0x345fe7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index eff02cc..d88a5de 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 _0xd6f5=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0xa5638d,_0x139854){var _0x5e5ac1=function(_0x569c82){while(--_0x569c82){_0xa5638d['push'](_0xa5638d['shift']());}};_0x5e5ac1(++_0x139854);}(_0xd6f5,0x7f));var _0x5d6f=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd6f5[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require(_0x5d6f('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x5d6f('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5d6f('0x2')](0x0);var events={'afterCreate':_0x5d6f('0x3'),'afterUpdate':_0x5d6f('0x4'),'afterDestroy':_0x5d6f('0x5')};function emitEvent(_0xd5a2d4){return function(_0xc17670,_0x294bd1,_0x1d5ac6){WhatsappQueueEvents[_0x5d6f('0x6')](_0xd5a2d4+':'+_0xc17670['id'],_0xc17670);WhatsappQueueEvents[_0x5d6f('0x6')](_0xd5a2d4,_0xc17670);_0x1d5ac6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x5d6f('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x8f7d=['events','WhatsappQueue','setMaxListeners','save','update','emit','hook','exports'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x8f7d,0x178));var _0xd8f7=function(_0x381764,_0x52fe19){_0x381764=_0x381764-0x0;var _0x292f80=_0x8f7d[_0x381764];return _0x292f80;};'use strict';var EventEmitter=require(_0xd8f7('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xd8f7('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd8f7('0x2')](0x0);var events={'afterCreate':_0xd8f7('0x3'),'afterUpdate':_0xd8f7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1bcdc8){return function(_0x263458,_0x1c1a0a,_0x46b4e0){WhatsappQueueEvents[_0xd8f7('0x5')](_0x1bcdc8+':'+_0x263458['id'],_0x263458);WhatsappQueueEvents[_0xd8f7('0x5')](_0x1bcdc8,_0x263458);_0x46b4e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd8f7('0x6')](e,emitEvent(event));}}module[_0xd8f7('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2586b35..bbfa921 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 _0xc1f0=['WhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappQueue.attributes','exports','define'];(function(_0x221019,_0x15c3c1){var _0x1b3cae=function(_0x7a192d){while(--_0x7a192d){_0x221019['push'](_0x221019['shift']());}};_0x1b3cae(++_0x15c3c1);}(_0xc1f0,0x79));var _0x0c1f=function(_0x263901,_0x36ae24){_0x263901=_0x263901-0x0;var _0x31f81e=_0xc1f0[_0x263901];return _0x31f81e;};'use strict';var _=require(_0x0c1f('0x0'));var util=require(_0x0c1f('0x1'));var logger=require(_0x0c1f('0x2'))(_0x0c1f('0x3'));var moment=require(_0x0c1f('0x4'));var BPromise=require(_0x0c1f('0x5'));var rp=require(_0x0c1f('0x6'));var fs=require('fs');var path=require(_0x0c1f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0c1f('0x8'));module[_0x0c1f('0x9')]=function(_0x46be7e,_0x5e3027){return _0x46be7e[_0x0c1f('0xa')](_0x0c1f('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ab6=['moment','bluebird','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2ab6,0xf3));var _0x62ab=function(_0x416902,_0xccb5e4){_0x416902=_0x416902-0x0;var _0x2f0619=_0x2ab6[_0x416902];return _0x2f0619;};'use strict';var _=require(_0x62ab('0x0'));var util=require(_0x62ab('0x1'));var logger=require(_0x62ab('0x2'))(_0x62ab('0x3'));var moment=require(_0x62ab('0x4'));var BPromise=require(_0x62ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62ab('0x6'));var rimraf=require(_0x62ab('0x7'));var config=require('../../config/environment');var attributes=require(_0x62ab('0x8'));module[_0x62ab('0x9')]=function(_0x3d4bc2,_0x1d4fdc){return _0x3d4bc2[_0x62ab('0xa')](_0x62ab('0xb'),attributes,{'tableName':_0x62ab('0xc'),'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 6bac316..7ea3b7e 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 _0x2d05=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','find','raw'];(function(_0x36332d,_0x274d7f){var _0x19ace7=function(_0x4edf76){while(--_0x4edf76){_0x36332d['push'](_0x36332d['shift']());}};_0x19ace7(++_0x274d7f);}(_0x2d05,0x1a4));var _0x52d0=function(_0x5e0502,_0x11be0d){_0x5e0502=_0x5e0502-0x0;var _0x1259c2=_0x2d05[_0x5e0502];return _0x1259c2;};'use strict';var _=require(_0x52d0('0x0'));var util=require(_0x52d0('0x1'));var moment=require(_0x52d0('0x2'));var BPromise=require(_0x52d0('0x3'));var rs=require(_0x52d0('0x4'));var fs=require('fs');var Redis=require(_0x52d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x52d0('0x6'));var logger=require(_0x52d0('0x7'))(_0x52d0('0x8'));var config=require(_0x52d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x52d0('0xa')]({'port':0x232a});config[_0x52d0('0xb')]=_[_0x52d0('0xc')](config[_0x52d0('0xb')],{'host':_0x52d0('0xd'),'port':0x18eb});var socket=require(_0x52d0('0xe'))(new Redis(config[_0x52d0('0xb')]));require(_0x52d0('0xf'))[_0x52d0('0x10')](socket);function respondWithRpcPromise(_0x5d2205,_0x1d41b2,_0x5691ad){return new BPromise(function(_0x3c9327,_0x10ac61){return client[_0x52d0('0x11')](_0x5d2205,_0x5691ad)[_0x52d0('0x12')](function(_0x25f1b7){logger[_0x52d0('0x13')](_0x52d0('0x14'),_0x1d41b2,_0x52d0('0x15'));logger[_0x52d0('0x16')](_0x52d0('0x17'),_0x1d41b2,'request\x20sent',JSON['stringify'](_0x25f1b7));if(_0x25f1b7[_0x52d0('0x18')]){if(_0x25f1b7[_0x52d0('0x18')]['code']===0x1f4){logger[_0x52d0('0x18')](_0x52d0('0x14'),_0x1d41b2,_0x25f1b7[_0x52d0('0x18')][_0x52d0('0x19')]);return _0x10ac61(_0x25f1b7[_0x52d0('0x18')][_0x52d0('0x19')]);}logger[_0x52d0('0x18')](_0x52d0('0x14'),_0x1d41b2,_0x25f1b7[_0x52d0('0x18')][_0x52d0('0x19')]);return _0x3c9327(_0x25f1b7['error'][_0x52d0('0x19')]);}else{logger['info'](_0x52d0('0x14'),_0x1d41b2,_0x52d0('0x15'));_0x3c9327(_0x25f1b7[_0x52d0('0x1a')]['message']);}})[_0x52d0('0x1b')](function(_0x299aee){logger['error'](_0x52d0('0x14'),_0x1d41b2,_0x299aee);_0x10ac61(_0x299aee);});});}exports['GetWhatsappQueue']=function(_0x5b4a7a){var _0x52536c=this;return new Promise(function(_0x449214,_0x3fd8a9){return db[_0x52d0('0x1c')][_0x52d0('0x1d')]({'raw':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')][_0x52d0('0x1f')]||null:null,'attributes':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')][_0x52d0('0x20')]||null:null,'limit':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')][_0x52d0('0x21')]||null:null,'include':_0x5b4a7a[_0x52d0('0x1e')]?_0x5b4a7a[_0x52d0('0x1e')][_0x52d0('0x22')]?_[_0x52d0('0x23')](_0x5b4a7a[_0x52d0('0x1e')]['include'],function(_0x533270){return{'model':db[_0x533270['model']],'as':_0x533270['as'],'attributes':_0x533270['attributes'],'include':_0x533270['include']?_[_0x52d0('0x23')](_0x533270[_0x52d0('0x22')],function(_0x423ef1){return{'model':db[_0x423ef1[_0x52d0('0x24')]],'as':_0x423ef1['as'],'attributes':_0x423ef1[_0x52d0('0x20')],'include':_0x423ef1[_0x52d0('0x22')]?_[_0x52d0('0x23')](_0x423ef1[_0x52d0('0x22')],function(_0x4cca4e){return{'model':db[_0x4cca4e['model']],'as':_0x4cca4e['as'],'attributes':_0x4cca4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x52d0('0x12')](function(_0x56e5b5){logger[_0x52d0('0x13')](_0x52d0('0x25'),_0x5b4a7a);logger['debug'](_0x52d0('0x25'),_0x5b4a7a,JSON[_0x52d0('0x26')](_0x56e5b5));_0x449214(_0x56e5b5);})['catch'](function(_0x4e6387){logger['error'](_0x52d0('0x25'),_0x4e6387[_0x52d0('0x19')],_0x5b4a7a);_0x3fd8a9(_0x52536c[_0x52d0('0x18')](0x1f4,_0x4e6387[_0x52d0('0x19')]));});});};exports[_0x52d0('0x27')]=function(_0x204498){var _0x42bf3=this;return new Promise(function(_0x3a241d,_0xb4039a){return db[_0x52d0('0x1c')][_0x52d0('0x28')]({'raw':_0x204498[_0x52d0('0x1e')]?_0x204498[_0x52d0('0x1e')][_0x52d0('0x29')]===undefined?!![]:![]:!![],'where':_0x204498['options']?_0x204498[_0x52d0('0x1e')][_0x52d0('0x1f')]||null:null,'attributes':_0x204498['options']?_0x204498[_0x52d0('0x1e')][_0x52d0('0x20')]||null:null,'include':_0x204498[_0x52d0('0x1e')]?_0x204498[_0x52d0('0x1e')]['include']?_['map'](_0x204498['options'][_0x52d0('0x22')],function(_0x1aaada){return{'model':db[_0x1aaada[_0x52d0('0x24')]],'as':_0x1aaada['as'],'attributes':_0x1aaada[_0x52d0('0x20')],'include':_0x1aaada[_0x52d0('0x22')]?_[_0x52d0('0x23')](_0x1aaada['include'],function(_0x4e009f){return{'model':db[_0x4e009f[_0x52d0('0x24')]],'as':_0x4e009f['as'],'attributes':_0x4e009f[_0x52d0('0x20')],'include':_0x4e009f[_0x52d0('0x22')]?_[_0x52d0('0x23')](_0x4e009f['include'],function(_0xb7bea6){return{'model':db[_0xb7bea6[_0x52d0('0x24')]],'as':_0xb7bea6['as'],'attributes':_0xb7bea6[_0x52d0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52d0('0x12')](function(_0x23fb3b){logger['info'](_0x52d0('0x27'),_0x204498);logger[_0x52d0('0x16')](_0x52d0('0x27'),_0x204498,JSON[_0x52d0('0x26')](_0x23fb3b));_0x3a241d(_0x23fb3b);})[_0x52d0('0x1b')](function(_0x4d5a49){logger[_0x52d0('0x18')](_0x52d0('0x27'),_0x4d5a49[_0x52d0('0x19')],_0x204498);_0xb4039a(_0x42bf3[_0x52d0('0x18')](0x1f4,_0x4d5a49[_0x52d0('0x19')]));});});}; \ No newline at end of file +var _0x5152=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','WhatsappQueue','ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis'];(function(_0x2f070e,_0x746f67){var _0x4c2618=function(_0x4d7813){while(--_0x4d7813){_0x2f070e['push'](_0x2f070e['shift']());}};_0x4c2618(++_0x746f67);}(_0x5152,0x19d));var _0x2515=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x5152[_0x8e8ca7];return _0x561381;};'use strict';var _=require(_0x2515('0x0'));var util=require(_0x2515('0x1'));var moment=require(_0x2515('0x2'));var BPromise=require(_0x2515('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2515('0x4'));var db=require(_0x2515('0x5'))['db'];var utils=require(_0x2515('0x6'));var logger=require(_0x2515('0x7'))('rpc');var config=require(_0x2515('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2515('0x9')][_0x2515('0xa')]({'port':0x232a});config[_0x2515('0xb')]=_[_0x2515('0xc')](config['redis'],{'host':_0x2515('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2515('0xb')]));require('./whatsappQueue.socket')[_0x2515('0xe')](socket);function respondWithRpcPromise(_0x9c5b35,_0xa749fa,_0x5ed7e4){return new BPromise(function(_0x1bee65,_0x1c539f){return client[_0x2515('0xf')](_0x9c5b35,_0x5ed7e4)['then'](function(_0x2359c7){logger[_0x2515('0x10')](_0x2515('0x11'),_0xa749fa,_0x2515('0x12'));logger[_0x2515('0x13')](_0x2515('0x14'),_0xa749fa,_0x2515('0x12'),JSON['stringify'](_0x2359c7));if(_0x2359c7[_0x2515('0x15')]){if(_0x2359c7[_0x2515('0x15')][_0x2515('0x16')]===0x1f4){logger['error'](_0x2515('0x11'),_0xa749fa,_0x2359c7[_0x2515('0x15')]['message']);return _0x1c539f(_0x2359c7[_0x2515('0x15')][_0x2515('0x17')]);}logger[_0x2515('0x15')](_0x2515('0x11'),_0xa749fa,_0x2359c7[_0x2515('0x15')][_0x2515('0x17')]);return _0x1bee65(_0x2359c7[_0x2515('0x15')][_0x2515('0x17')]);}else{logger[_0x2515('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0xa749fa,'request\x20sent');_0x1bee65(_0x2359c7['result'][_0x2515('0x17')]);}})[_0x2515('0x18')](function(_0x5dddfd){logger['error'](_0x2515('0x11'),_0xa749fa,_0x5dddfd);_0x1c539f(_0x5dddfd);});});}exports[_0x2515('0x19')]=function(_0x512080){var _0x10639f=this;return new Promise(function(_0x475cd9,_0x12c9af){return db['WhatsappQueue'][_0x2515('0x1a')]({'raw':_0x512080[_0x2515('0x1b')]?_0x512080[_0x2515('0x1b')][_0x2515('0x1c')]===undefined?!![]:![]:!![],'where':_0x512080['options']?_0x512080[_0x2515('0x1b')][_0x2515('0x1d')]||null:null,'attributes':_0x512080[_0x2515('0x1b')]?_0x512080[_0x2515('0x1b')][_0x2515('0x1e')]||null:null,'limit':_0x512080['options']?_0x512080['options'][_0x2515('0x1f')]||null:null,'include':_0x512080[_0x2515('0x1b')]?_0x512080['options']['include']?_['map'](_0x512080[_0x2515('0x1b')][_0x2515('0x20')],function(_0x5882e3){return{'model':db[_0x5882e3[_0x2515('0x21')]],'as':_0x5882e3['as'],'attributes':_0x5882e3[_0x2515('0x1e')],'include':_0x5882e3['include']?_[_0x2515('0x22')](_0x5882e3[_0x2515('0x20')],function(_0x434334){return{'model':db[_0x434334[_0x2515('0x21')]],'as':_0x434334['as'],'attributes':_0x434334[_0x2515('0x1e')],'include':_0x434334[_0x2515('0x20')]?_[_0x2515('0x22')](_0x434334[_0x2515('0x20')],function(_0x2f9533){return{'model':db[_0x2f9533['model']],'as':_0x2f9533['as'],'attributes':_0x2f9533[_0x2515('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38be7f){logger[_0x2515('0x10')]('GetWhatsappQueue',_0x512080);logger[_0x2515('0x13')](_0x2515('0x19'),_0x512080,JSON[_0x2515('0x23')](_0x38be7f));_0x475cd9(_0x38be7f);})['catch'](function(_0x8bd2a7){logger[_0x2515('0x15')](_0x2515('0x19'),_0x8bd2a7[_0x2515('0x17')],_0x512080);_0x12c9af(_0x10639f[_0x2515('0x15')](0x1f4,_0x8bd2a7[_0x2515('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x4a0db0){var _0x1c30d6=this;return new Promise(function(_0x17b376,_0x476eb6){return db[_0x2515('0x24')]['find']({'raw':_0x4a0db0[_0x2515('0x1b')]?_0x4a0db0['options'][_0x2515('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a0db0[_0x2515('0x1b')]?_0x4a0db0[_0x2515('0x1b')][_0x2515('0x1d')]||null:null,'attributes':_0x4a0db0[_0x2515('0x1b')]?_0x4a0db0[_0x2515('0x1b')][_0x2515('0x1e')]||null:null,'include':_0x4a0db0[_0x2515('0x1b')]?_0x4a0db0['options'][_0x2515('0x20')]?_[_0x2515('0x22')](_0x4a0db0[_0x2515('0x1b')][_0x2515('0x20')],function(_0x472341){return{'model':db[_0x472341[_0x2515('0x21')]],'as':_0x472341['as'],'attributes':_0x472341['attributes'],'include':_0x472341[_0x2515('0x20')]?_['map'](_0x472341[_0x2515('0x20')],function(_0x448809){return{'model':db[_0x448809[_0x2515('0x21')]],'as':_0x448809['as'],'attributes':_0x448809[_0x2515('0x1e')],'include':_0x448809[_0x2515('0x20')]?_[_0x2515('0x22')](_0x448809[_0x2515('0x20')],function(_0x295d4b){return{'model':db[_0x295d4b[_0x2515('0x21')]],'as':_0x295d4b['as'],'attributes':_0x295d4b[_0x2515('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x276965){logger[_0x2515('0x10')](_0x2515('0x25'),_0x4a0db0);logger[_0x2515('0x13')](_0x2515('0x25'),_0x4a0db0,JSON[_0x2515('0x23')](_0x276965));_0x17b376(_0x276965);})[_0x2515('0x18')](function(_0x22f906){logger['error'](_0x2515('0x25'),_0x22f906['message'],_0x4a0db0);_0x476eb6(_0x1c30d6[_0x2515('0x15')](0x1f4,_0x22f906[_0x2515('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 1431877..28ab6ae 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 _0x6ae1=['whatsappQueue:','save','remove','update','emit','removeListener','length'];(function(_0x68d80a,_0x13923e){var _0x202105=function(_0x4fdafc){while(--_0x4fdafc){_0x68d80a['push'](_0x68d80a['shift']());}};_0x202105(++_0x13923e);}(_0x6ae1,0x15f));var _0x16ae=function(_0x33dbb6,_0x3483eb){_0x33dbb6=_0x33dbb6-0x0;var _0x397273=_0x6ae1[_0x33dbb6];return _0x397273;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x16ae('0x0'),_0x16ae('0x1'),_0x16ae('0x2')];function createListener(_0x2b560d,_0x44132a){return function(_0x37f230){_0x44132a[_0x16ae('0x3')](_0x2b560d,_0x37f230);};}function removeListener(_0x298b6b,_0x25062a){return function(){WhatsappQueueEvents[_0x16ae('0x4')](_0x298b6b,_0x25062a);};}exports['register']=function(_0x47e09d){for(var _0x219c25=0x0,_0x47d3f8=events[_0x16ae('0x5')];_0x219c25<_0x47d3f8;_0x219c25++){var _0x401622=events[_0x219c25];var _0x1ba690=createListener(_0x16ae('0x6')+_0x401622,_0x47e09d);WhatsappQueueEvents['on'](_0x401622,_0x1ba690);}}; \ No newline at end of file +var _0x9885=['removeListener','register','./whatsappQueue.events','save','remove','update','emit'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x9885,0x191));var _0x5988=function(_0x17ff44,_0x2d0e21){_0x17ff44=_0x17ff44-0x0;var _0x504dec=_0x9885[_0x17ff44];return _0x504dec;};'use strict';var WhatsappQueueEvents=require(_0x5988('0x0'));var events=[_0x5988('0x1'),_0x5988('0x2'),_0x5988('0x3')];function createListener(_0x16ddaf,_0x39580b){return function(_0xe59da4){_0x39580b[_0x5988('0x4')](_0x16ddaf,_0xe59da4);};}function removeListener(_0x57de53,_0x3891b5){return function(){WhatsappQueueEvents[_0x5988('0x5')](_0x57de53,_0x3891b5);};}exports[_0x5988('0x6')]=function(_0x559566){for(var _0x2bb661=0x0,_0x394436=events['length'];_0x2bb661<_0x394436;_0x2bb661++){var _0x4af41f=events[_0x2bb661];var _0x4888b6=createListener('whatsappQueue:'+_0x4af41f,_0x559566);WhatsappQueueEvents['on'](_0x4af41f,_0x4888b6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2fed39f..974a799 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 _0xaf11=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x5b2cb6,_0x4edd09){var _0x54b802=function(_0x16f2ca){while(--_0x16f2ca){_0x5b2cb6['push'](_0x5b2cb6['shift']());}};_0x54b802(++_0x4edd09);}(_0xaf11,0x12f));var _0x1af1=function(_0xc57949,_0x3e4648){_0xc57949=_0xc57949-0x0;var _0x331c40=_0xaf11[_0xc57949];return _0x331c40;};'use strict';var multer=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var path=require(_0x1af1('0x2'));var timeout=require(_0x1af1('0x3'));var express=require('express');var router=express[_0x1af1('0x4')]();var auth=require(_0x1af1('0x5'));var interaction=require(_0x1af1('0x6'));var config=require('../../config/environment');var controller=require(_0x1af1('0x7'));router[_0x1af1('0x8')]('/',auth[_0x1af1('0x9')](),controller['index']);router[_0x1af1('0x8')]('/describe',auth[_0x1af1('0x9')](),controller[_0x1af1('0xa')]);router['get'](_0x1af1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1af1('0xc')]('/',auth[_0x1af1('0x9')](),controller[_0x1af1('0xd')]);router[_0x1af1('0xe')](_0x1af1('0xb'),auth[_0x1af1('0x9')](),controller['update']);router[_0x1af1('0xf')](_0x1af1('0xb'),auth[_0x1af1('0x9')](),controller[_0x1af1('0x10')]);module[_0x1af1('0x11')]=router; \ No newline at end of file +var _0x1d71=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','create','/:id','update','destroy','exports','multer','util'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x1d71,0x154));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x11d7('0x0'));var util=require(_0x11d7('0x1'));var path=require(_0x11d7('0x2'));var timeout=require(_0x11d7('0x3'));var express=require(_0x11d7('0x4'));var router=express[_0x11d7('0x5')]();var auth=require(_0x11d7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x11d7('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x11d7('0x8')]('/',auth['isAuthenticated'](),controller[_0x11d7('0x9')]);router[_0x11d7('0x8')]('/describe',auth[_0x11d7('0xa')](),controller[_0x11d7('0xb')]);router[_0x11d7('0x8')]('/:id',auth[_0x11d7('0xa')](),controller[_0x11d7('0xc')]);router['post']('/',auth[_0x11d7('0xa')](),controller[_0x11d7('0xd')]);router['put'](_0x11d7('0xe'),auth[_0x11d7('0xa')](),controller[_0x11d7('0xf')]);router['delete'](_0x11d7('0xe'),auth[_0x11d7('0xa')](),controller[_0x11d7('0x10')]);module[_0x11d7('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 86f2a3b..0b68810 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['exports','STRING','DATE','sequelize'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa41a,0x6b));var _0xaa41=function(_0x36e3bc,_0x41ca82){_0x36e3bc=_0x36e3bc-0x0;var _0x1f8fcb=_0xa41a[_0x36e3bc];return _0x1f8fcb;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaa41('0x2')]},'joinAt':{'type':Sequelize[_0xaa41('0x3')]},'leaveAt':{'type':Sequelize[_0xaa41('0x3')]},'acceptAt':{'type':Sequelize[_0xaa41('0x3')]},'exitAt':{'type':Sequelize[_0xaa41('0x3')]},'reason':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file +var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x60033,_0x226f33){var _0x53c597=function(_0x5e6457){while(--_0x5e6457){_0x60033['push'](_0x60033['shift']());}};_0x53c597(++_0x226f33);}(_0x55ca,0x126));var _0xa55c=function(_0x2bbbc2,_0x2fd8b9){_0x2bbbc2=_0x2bbbc2-0x0;var _0x1f0319=_0x55ca[_0x2bbbc2];return _0x1f0319;};'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 c49df4b..51b8971 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 _0xaaee=['VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','length','include','merge','find','create','body','catch','params','describe','html-pdf','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/logger','api','../../config/utils','status','end','json','count','offset','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick'];(function(_0x6be2f5,_0x50a3e4){var _0x198c0b=function(_0x11bbfe){while(--_0x11bbfe){_0x6be2f5['push'](_0x6be2f5['shift']());}};_0x198c0b(++_0x50a3e4);}(_0xaaee,0xa9));var _0xeaae=function(_0x37aa2a,_0x126490){_0x37aa2a=_0x37aa2a-0x0;var _0x3c89eb=_0xaaee[_0x37aa2a];return _0x3c89eb;};'use strict';var pdf=require(_0xeaae('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeaae('0x1'));var zipdir=require(_0xeaae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeaae('0x3'));var moment=require(_0xeaae('0x4'));var BPromise=require(_0xeaae('0x5'));var Mustache=require(_0xeaae('0x6'));var util=require('util');var path=require(_0xeaae('0x7'));var sox=require(_0xeaae('0x8'));var csv=require(_0xeaae('0x9'));var ejs=require(_0xeaae('0xa'));var fs=require('fs');var _=require(_0xeaae('0xb'));var squel=require(_0xeaae('0xc'));var crypto=require('crypto');var jsforce=require(_0xeaae('0xd'));var deskjs=require(_0xeaae('0xe'));var toCsv=require(_0xeaae('0x9'));var querystring=require(_0xeaae('0xf'));var Papa=require(_0xeaae('0x10'));var Redis=require(_0xeaae('0x11'));var authService=require(_0xeaae('0x12'));var qs=require(_0xeaae('0x13'));var as=require(_0xeaae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaae('0x15'))(_0xeaae('0x16'));var utils=require(_0xeaae('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ae51,_0xf4e6b7){_0xf4e6b7=_0xf4e6b7||0xcc;return function(_0x16c851){if(_0x16c851){return _0x24ae51['sendStatus'](_0xf4e6b7);}return _0x24ae51[_0xeaae('0x18')](_0xf4e6b7)[_0xeaae('0x19')]();};}function respondWithResult(_0x3b1578,_0x3f46ff){_0x3f46ff=_0x3f46ff||0xc8;return function(_0x4f3501){if(_0x4f3501){return _0x3b1578['status'](_0x3f46ff)[_0xeaae('0x1a')](_0x4f3501);}};}function respondWithFilteredResult(_0x1b4f7e,_0x8dc1ac){return function(_0x25b974){if(_0x25b974){var _0x49741a=_0x25b974[_0xeaae('0x1b')],_0x1dd48f=_0x8dc1ac[_0xeaae('0x1c')],_0x5be794=_0x8dc1ac[_0xeaae('0x1c')]+_0x8dc1ac['limit'],_0x29bd11;if(_0x5be794>=_0x49741a){_0x5be794=_0x49741a;_0x29bd11=0xc8;}else{_0x29bd11=0xce;}_0x1b4f7e['status'](_0x29bd11);return _0x1b4f7e['set']('Content-Range',_0x1dd48f+'-'+_0x5be794+'/'+_0x49741a)[_0xeaae('0x1a')](_0x25b974);}return null;};}function patchUpdates(_0x1590d2){return function(_0x5b169d){try{jsonpatch[_0xeaae('0x1d')](_0x5b169d,_0x1590d2,!![]);}catch(_0x5cc79c){return BPromise[_0xeaae('0x1e')](_0x5cc79c);}return _0x5b169d[_0xeaae('0x1f')]();};}function saveUpdates(_0x3491a6,_0x52de90){return function(_0x3be7cf){if(_0x3be7cf){return _0x3be7cf[_0xeaae('0x20')](_0x3491a6)['then'](function(_0x590a27){return _0x590a27;});}return null;};}function removeEntity(_0x2cbdbb,_0x5ee523){return function(_0x48f4a9){if(_0x48f4a9){return _0x48f4a9[_0xeaae('0x21')]()[_0xeaae('0x22')](function(){_0x2cbdbb[_0xeaae('0x18')](0xcc)[_0xeaae('0x19')]();});}};}function handleEntityNotFound(_0xefe74b,_0x41739e){return function(_0x2a961c){if(!_0x2a961c){_0xefe74b[_0xeaae('0x23')](0x194);}return _0x2a961c;};}function handleError(_0x31801a,_0x1d3111){_0x1d3111=_0x1d3111||0x1f4;return function(_0x56eae0){logger[_0xeaae('0x24')](_0x56eae0[_0xeaae('0x25')]);if(_0x56eae0[_0xeaae('0x26')]){delete _0x56eae0[_0xeaae('0x26')];}_0x31801a[_0xeaae('0x18')](_0x1d3111)[_0xeaae('0x27')](_0x56eae0);};}exports[_0xeaae('0x28')]=function(_0x21690b,_0x58ac1d){var _0x51c515={},_0x261ccd={},_0x668fd2={'count':0x0,'rows':[]};var _0x3ee762=_['map'](db[_0xeaae('0x29')][_0xeaae('0x2a')],function(_0xa334c8){return{'name':_0xa334c8[_0xeaae('0x2b')],'type':_0xa334c8[_0xeaae('0x2c')][_0xeaae('0x2d')]};});_0x261ccd[_0xeaae('0x2e')]=_[_0xeaae('0x2f')](_0x3ee762,_0xeaae('0x26'));_0x261ccd[_0xeaae('0x30')]=_['keys'](_0x21690b[_0xeaae('0x30')]);_0x261ccd[_0xeaae('0x31')]=_['intersection'](_0x261ccd['model'],_0x261ccd[_0xeaae('0x30')]);_0x51c515['attributes']=_[_0xeaae('0x32')](_0x261ccd[_0xeaae('0x2e')],qs[_0xeaae('0x33')](_0x21690b['query']['fields']));_0x51c515['attributes']=_0x51c515[_0xeaae('0x34')]['length']?_0x51c515[_0xeaae('0x34')]:_0x261ccd[_0xeaae('0x2e')];if(!_0x21690b[_0xeaae('0x30')]['hasOwnProperty'](_0xeaae('0x35'))){_0x51c515[_0xeaae('0x36')]=qs[_0xeaae('0x36')](_0x21690b[_0xeaae('0x30')][_0xeaae('0x36')]);_0x51c515['offset']=qs[_0xeaae('0x1c')](_0x21690b[_0xeaae('0x30')][_0xeaae('0x1c')]);}_0x51c515[_0xeaae('0x37')]=qs[_0xeaae('0x38')](_0x21690b[_0xeaae('0x30')][_0xeaae('0x38')]);_0x51c515[_0xeaae('0x39')]=qs[_0xeaae('0x31')](_[_0xeaae('0x3a')](_0x21690b[_0xeaae('0x30')],_0x261ccd['filters']),_0x3ee762);if(_0x21690b['query']['filter']){_0x51c515['where']=_['merge'](_0x51c515[_0xeaae('0x39')],{'$or':_['map'](_0x3ee762,function(_0xc5a4a7){if(_0xc5a4a7['type']!==_0xeaae('0x3b')){var _0x588a60={};_0x588a60[_0xc5a4a7['name']]={'$like':'%'+_0x21690b[_0xeaae('0x30')][_0xeaae('0x3c')]+'%'};return _0x588a60;}})});}_0x51c515=_['merge']({},_0x51c515,_0x21690b[_0xeaae('0x3d')]);var _0x4284f={'where':_0x51c515['where']};return db[_0xeaae('0x29')][_0xeaae('0x1b')](_0x4284f)[_0xeaae('0x22')](function(_0x116833){_0x668fd2[_0xeaae('0x1b')]=_0x116833;if(_0x21690b['query'][_0xeaae('0x3e')]){_0x51c515['include']=[{'all':!![]}];}return db[_0xeaae('0x29')][_0xeaae('0x3f')](_0x51c515);})['then'](function(_0x22ce0c){_0x668fd2[_0xeaae('0x40')]=_0x22ce0c;return _0x668fd2;})[_0xeaae('0x22')](respondWithFilteredResult(_0x58ac1d,_0x51c515))['catch'](handleError(_0x58ac1d,null));};exports[_0xeaae('0x41')]=function(_0x37f92b,_0x3cabe6){var _0x40d844={'raw':!![],'where':{'id':_0x37f92b['params']['id']}},_0x1386ca={};_0x1386ca['model']=_[_0xeaae('0x42')](db[_0xeaae('0x29')][_0xeaae('0x2a')]);_0x1386ca['query']=_[_0xeaae('0x42')](_0x37f92b['query']);_0x1386ca[_0xeaae('0x31')]=_['intersection'](_0x1386ca[_0xeaae('0x2e')],_0x1386ca[_0xeaae('0x30')]);_0x40d844[_0xeaae('0x34')]=_['intersection'](_0x1386ca[_0xeaae('0x2e')],qs['fields'](_0x37f92b[_0xeaae('0x30')]['fields']));_0x40d844['attributes']=_0x40d844[_0xeaae('0x34')][_0xeaae('0x43')]?_0x40d844['attributes']:_0x1386ca[_0xeaae('0x2e')];if(_0x37f92b[_0xeaae('0x30')][_0xeaae('0x3e')]){_0x40d844[_0xeaae('0x44')]=[{'all':!![]}];}_0x40d844=_[_0xeaae('0x45')]({},_0x40d844,_0x37f92b[_0xeaae('0x3d')]);return db['WhatsappQueueReport'][_0xeaae('0x46')](_0x40d844)[_0xeaae('0x22')](handleEntityNotFound(_0x3cabe6,null))[_0xeaae('0x22')](respondWithResult(_0x3cabe6,null))['catch'](handleError(_0x3cabe6,null));};exports['create']=function(_0x5479b3,_0xf6db32){return db['WhatsappQueueReport'][_0xeaae('0x47')](_0x5479b3[_0xeaae('0x48')],{})[_0xeaae('0x22')](respondWithResult(_0xf6db32,0xc9))[_0xeaae('0x49')](handleError(_0xf6db32,null));};exports[_0xeaae('0x20')]=function(_0x57a5ff,_0x2ea077){if(_0x57a5ff['body']['id']){delete _0x57a5ff['body']['id'];}return db[_0xeaae('0x29')][_0xeaae('0x46')]({'where':{'id':_0x57a5ff[_0xeaae('0x4a')]['id']}})[_0xeaae('0x22')](handleEntityNotFound(_0x2ea077,null))[_0xeaae('0x22')](saveUpdates(_0x57a5ff[_0xeaae('0x48')],null))[_0xeaae('0x22')](respondWithResult(_0x2ea077,null))[_0xeaae('0x49')](handleError(_0x2ea077,null));};exports[_0xeaae('0x21')]=function(_0x246612,_0x407a09){return db[_0xeaae('0x29')][_0xeaae('0x46')]({'where':{'id':_0x246612[_0xeaae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x407a09,null))[_0xeaae('0x22')](removeEntity(_0x407a09,null))['catch'](handleError(_0x407a09,null));};exports[_0xeaae('0x4b')]=function(_0x8ab30c,_0x1a6304){return db[_0xeaae('0x29')]['describe']()[_0xeaae('0x22')](respondWithResult(_0x1a6304,null))['catch'](handleError(_0x1a6304,null));}; \ No newline at end of file +var _0x47c5=['sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','index','map','WhatsappQueueReport','rawAttributes','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','catch','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x1d4fa6,_0x391d9d){var _0x134c9e=function(_0x305dd9){while(--_0x305dd9){_0x1d4fa6['push'](_0x1d4fa6['shift']());}};_0x134c9e(++_0x391d9d);}(_0x47c5,0x165));var _0x547c=function(_0x501d0d,_0x38b758){_0x501d0d=_0x501d0d-0x0;var _0x37a8b8=_0x47c5[_0x501d0d];return _0x37a8b8;};'use strict';var pdf=require(_0x547c('0x0'));var emlformat=require(_0x547c('0x1'));var rimraf=require(_0x547c('0x2'));var zipdir=require(_0x547c('0x3'));var jsonpatch=require(_0x547c('0x4'));var rp=require(_0x547c('0x5'));var moment=require('moment');var BPromise=require(_0x547c('0x6'));var Mustache=require(_0x547c('0x7'));var util=require('util');var path=require(_0x547c('0x8'));var sox=require(_0x547c('0x9'));var csv=require('to-csv');var ejs=require(_0x547c('0xa'));var fs=require('fs');var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x10'));var querystring=require(_0x547c('0x11'));var Papa=require(_0x547c('0x12'));var Redis=require(_0x547c('0x13'));var authService=require(_0x547c('0x14'));var qs=require(_0x547c('0x15'));var as=require(_0x547c('0x16'));var hardwareService=require(_0x547c('0x17'));var logger=require(_0x547c('0x18'))(_0x547c('0x19'));var utils=require(_0x547c('0x1a'));var config=require('../../config/environment');var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x39dce7,_0x5eea67){_0x5eea67=_0x5eea67||0xcc;return function(_0x436c19){if(_0x436c19){return _0x39dce7[_0x547c('0x1c')](_0x5eea67);}return _0x39dce7[_0x547c('0x1d')](_0x5eea67)[_0x547c('0x1e')]();};}function respondWithResult(_0x392a35,_0x150317){_0x150317=_0x150317||0xc8;return function(_0x2bc289){if(_0x2bc289){return _0x392a35[_0x547c('0x1d')](_0x150317)[_0x547c('0x1f')](_0x2bc289);}};}function respondWithFilteredResult(_0x161991,_0x240243){return function(_0x103455){if(_0x103455){var _0x39f316=_0x103455[_0x547c('0x20')],_0x23644b=_0x240243[_0x547c('0x21')],_0x2d5331=_0x240243['offset']+_0x240243['limit'],_0xf32cdd;if(_0x2d5331>=_0x39f316){_0x2d5331=_0x39f316;_0xf32cdd=0xc8;}else{_0xf32cdd=0xce;}_0x161991[_0x547c('0x1d')](_0xf32cdd);return _0x161991[_0x547c('0x22')](_0x547c('0x23'),_0x23644b+'-'+_0x2d5331+'/'+_0x39f316)['json'](_0x103455);}return null;};}function patchUpdates(_0x248aca){return function(_0x18ef77){try{jsonpatch[_0x547c('0x24')](_0x18ef77,_0x248aca,!![]);}catch(_0x58ddc9){return BPromise[_0x547c('0x25')](_0x58ddc9);}return _0x18ef77[_0x547c('0x26')]();};}function saveUpdates(_0x496c38,_0x5453f9){return function(_0x35040a){if(_0x35040a){return _0x35040a[_0x547c('0x27')](_0x496c38)['then'](function(_0x11e709){return _0x11e709;});}return null;};}function removeEntity(_0x16a3a6,_0x592e46){return function(_0x2e317a){if(_0x2e317a){return _0x2e317a[_0x547c('0x28')]()[_0x547c('0x29')](function(){_0x16a3a6['status'](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x361c5c,_0x470694){return function(_0x26823c){if(!_0x26823c){_0x361c5c[_0x547c('0x1c')](0x194);}return _0x26823c;};}function handleError(_0x2663bc,_0x2ab2cc){_0x2ab2cc=_0x2ab2cc||0x1f4;return function(_0x17fa33){logger['error'](_0x17fa33[_0x547c('0x2a')]);if(_0x17fa33['name']){delete _0x17fa33['name'];}_0x2663bc['status'](_0x2ab2cc)['send'](_0x17fa33);};}exports[_0x547c('0x2b')]=function(_0x4c5256,_0x93985c){var _0x5729b0={},_0x3ea493={},_0x486216={'count':0x0,'rows':[]};var _0x1c2cd2=_[_0x547c('0x2c')](db[_0x547c('0x2d')][_0x547c('0x2e')],function(_0x198afb){return{'name':_0x198afb['fieldName'],'type':_0x198afb['type'][_0x547c('0x2f')]};});_0x3ea493['model']=_[_0x547c('0x2c')](_0x1c2cd2,_0x547c('0x30'));_0x3ea493[_0x547c('0x31')]=_[_0x547c('0x32')](_0x4c5256[_0x547c('0x31')]);_0x3ea493[_0x547c('0x33')]=_[_0x547c('0x34')](_0x3ea493['model'],_0x3ea493['query']);_0x5729b0[_0x547c('0x35')]=_[_0x547c('0x34')](_0x3ea493[_0x547c('0x36')],qs[_0x547c('0x37')](_0x4c5256[_0x547c('0x31')][_0x547c('0x37')]));_0x5729b0[_0x547c('0x35')]=_0x5729b0[_0x547c('0x35')][_0x547c('0x38')]?_0x5729b0[_0x547c('0x35')]:_0x3ea493[_0x547c('0x36')];if(!_0x4c5256[_0x547c('0x31')][_0x547c('0x39')](_0x547c('0x3a'))){_0x5729b0['limit']=qs[_0x547c('0x3b')](_0x4c5256['query']['limit']);_0x5729b0['offset']=qs[_0x547c('0x21')](_0x4c5256[_0x547c('0x31')][_0x547c('0x21')]);}_0x5729b0[_0x547c('0x3c')]=qs[_0x547c('0x3d')](_0x4c5256[_0x547c('0x31')]['sort']);_0x5729b0['where']=qs['filters'](_[_0x547c('0x3e')](_0x4c5256[_0x547c('0x31')],_0x3ea493[_0x547c('0x33')]),_0x1c2cd2);if(_0x4c5256[_0x547c('0x31')][_0x547c('0x3f')]){_0x5729b0[_0x547c('0x40')]=_['merge'](_0x5729b0[_0x547c('0x40')],{'$or':_['map'](_0x1c2cd2,function(_0x32308f){if(_0x32308f[_0x547c('0x41')]!=='VIRTUAL'){var _0x380705={};_0x380705[_0x32308f['name']]={'$like':'%'+_0x4c5256['query'][_0x547c('0x3f')]+'%'};return _0x380705;}})});}_0x5729b0=_[_0x547c('0x42')]({},_0x5729b0,_0x4c5256[_0x547c('0x43')]);var _0x22a70b={'where':_0x5729b0['where']};return db['WhatsappQueueReport'][_0x547c('0x20')](_0x22a70b)[_0x547c('0x29')](function(_0x411c6f){_0x486216['count']=_0x411c6f;if(_0x4c5256[_0x547c('0x31')][_0x547c('0x44')]){_0x5729b0[_0x547c('0x45')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x547c('0x46')](_0x5729b0);})[_0x547c('0x29')](function(_0xbb08e7){_0x486216['rows']=_0xbb08e7;return _0x486216;})[_0x547c('0x29')](respondWithFilteredResult(_0x93985c,_0x5729b0))[_0x547c('0x47')](handleError(_0x93985c,null));};exports['show']=function(_0x26ea8c,_0x23c8b2){var _0x9c3cb2={'raw':!![],'where':{'id':_0x26ea8c[_0x547c('0x48')]['id']}},_0x4ffd10={};_0x4ffd10['model']=_[_0x547c('0x32')](db['WhatsappQueueReport'][_0x547c('0x2e')]);_0x4ffd10[_0x547c('0x31')]=_[_0x547c('0x32')](_0x26ea8c[_0x547c('0x31')]);_0x4ffd10[_0x547c('0x33')]=_[_0x547c('0x34')](_0x4ffd10['model'],_0x4ffd10['query']);_0x9c3cb2[_0x547c('0x35')]=_[_0x547c('0x34')](_0x4ffd10[_0x547c('0x36')],qs['fields'](_0x26ea8c[_0x547c('0x31')][_0x547c('0x37')]));_0x9c3cb2[_0x547c('0x35')]=_0x9c3cb2[_0x547c('0x35')][_0x547c('0x38')]?_0x9c3cb2[_0x547c('0x35')]:_0x4ffd10['model'];if(_0x26ea8c[_0x547c('0x31')][_0x547c('0x44')]){_0x9c3cb2[_0x547c('0x45')]=[{'all':!![]}];}_0x9c3cb2=_['merge']({},_0x9c3cb2,_0x26ea8c[_0x547c('0x43')]);return db[_0x547c('0x2d')][_0x547c('0x49')](_0x9c3cb2)[_0x547c('0x29')](handleEntityNotFound(_0x23c8b2,null))['then'](respondWithResult(_0x23c8b2,null))[_0x547c('0x47')](handleError(_0x23c8b2,null));};exports['create']=function(_0x15ffa6,_0x5025cc){return db[_0x547c('0x2d')][_0x547c('0x4a')](_0x15ffa6['body'],{})[_0x547c('0x29')](respondWithResult(_0x5025cc,0xc9))[_0x547c('0x47')](handleError(_0x5025cc,null));};exports[_0x547c('0x27')]=function(_0x1ddf30,_0x52d419){if(_0x1ddf30[_0x547c('0x4b')]['id']){delete _0x1ddf30['body']['id'];}return db['WhatsappQueueReport'][_0x547c('0x49')]({'where':{'id':_0x1ddf30[_0x547c('0x48')]['id']}})[_0x547c('0x29')](handleEntityNotFound(_0x52d419,null))[_0x547c('0x29')](saveUpdates(_0x1ddf30[_0x547c('0x4b')],null))[_0x547c('0x29')](respondWithResult(_0x52d419,null))[_0x547c('0x47')](handleError(_0x52d419,null));};exports[_0x547c('0x28')]=function(_0x58cb05,_0x31a262){return db[_0x547c('0x2d')][_0x547c('0x49')]({'where':{'id':_0x58cb05['params']['id']}})['then'](handleEntityNotFound(_0x31a262,null))[_0x547c('0x29')](removeEntity(_0x31a262,null))[_0x547c('0x47')](handleError(_0x31a262,null));};exports['describe']=function(_0xadd57d,_0x3e42a2){return db[_0x547c('0x2d')][_0x547c('0x4c')]()[_0x547c('0x29')](respondWithResult(_0x3e42a2,null))[_0x547c('0x47')](handleError(_0x3e42a2,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 96c20e6..e5ff7fd 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 _0x0309=['../../config/logger','api','moment','request-promise','path','./whatsappQueueReport.attributes','define','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0x0309,0x8d));var _0x9030=function(_0x3ff777,_0x5509d3){_0x3ff777=_0x3ff777-0x0;var _0x3cf2df=_0x0309[_0x3ff777];return _0x3cf2df;};'use strict';var _=require(_0x9030('0x0'));var util=require(_0x9030('0x1'));var logger=require(_0x9030('0x2'))(_0x9030('0x3'));var moment=require(_0x9030('0x4'));var BPromise=require('bluebird');var rp=require(_0x9030('0x5'));var fs=require('fs');var path=require(_0x9030('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9030('0x7'));module['exports']=function(_0x56913f,_0x58c3db){return _0x56913f[_0x9030('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x9030('0x9'),'paranoid':![],'indexes':[{'name':_0x9030('0xa'),'fields':[_0x9030('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45a4=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','api','bluebird'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0x45a4,0x140));var _0x445a=function(_0xb31b0c,_0x41de7a){_0xb31b0c=_0xb31b0c-0x0;var _0x145f0d=_0x45a4[_0xb31b0c];return _0x145f0d;};'use strict';var _=require(_0x445a('0x0'));var util=require(_0x445a('0x1'));var logger=require('../../config/logger')(_0x445a('0x2'));var moment=require('moment');var BPromise=require(_0x445a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x445a('0x4'));var rimraf=require(_0x445a('0x5'));var config=require(_0x445a('0x6'));var attributes=require(_0x445a('0x7'));module[_0x445a('0x8')]=function(_0x2fed40,_0x16a5a0){return _0x2fed40[_0x445a('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x445a('0xa'),'paranoid':![],'indexes':[{'name':_0x445a('0xb'),'fields':[_0x445a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 90333d1..239f8f3 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 _0x1ff1=['lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','where','attributes','UpdateWhatsappQueueReport'];(function(_0x3c80fd,_0x3b6149){var _0x390a9d=function(_0x47b446){while(--_0x47b446){_0x3c80fd['push'](_0x3c80fd['shift']());}};_0x390a9d(++_0x3b6149);}(_0x1ff1,0x1c2));var _0x11ff=function(_0x21cd93,_0x3a305b){_0x21cd93=_0x21cd93-0x0;var _0x69aa37=_0x1ff1[_0x21cd93];return _0x69aa37;};'use strict';var _=require(_0x11ff('0x0'));var util=require(_0x11ff('0x1'));var moment=require('moment');var BPromise=require(_0x11ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11ff('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x11ff('0x4'))('rpc');var config=require(_0x11ff('0x5'));var jayson=require(_0x11ff('0x6'));var client=jayson[_0x11ff('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18af19,_0x5b3269,_0x2ed378){return new BPromise(function(_0x584a18,_0x4a8e5e){return client[_0x11ff('0x8')](_0x18af19,_0x2ed378)[_0x11ff('0x9')](function(_0x3022c0){logger[_0x11ff('0xa')](_0x11ff('0xb'),_0x5b3269,_0x11ff('0xc'));logger[_0x11ff('0xd')](_0x11ff('0xe'),_0x5b3269,'request\x20sent',JSON[_0x11ff('0xf')](_0x3022c0));if(_0x3022c0['error']){if(_0x3022c0['error'][_0x11ff('0x10')]===0x1f4){logger['error'](_0x11ff('0xb'),_0x5b3269,_0x3022c0[_0x11ff('0x11')][_0x11ff('0x12')]);return _0x4a8e5e(_0x3022c0[_0x11ff('0x11')][_0x11ff('0x12')]);}logger[_0x11ff('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5b3269,_0x3022c0[_0x11ff('0x11')][_0x11ff('0x12')]);return _0x584a18(_0x3022c0[_0x11ff('0x11')][_0x11ff('0x12')]);}else{logger[_0x11ff('0xa')](_0x11ff('0xb'),_0x5b3269,'request\x20sent');_0x584a18(_0x3022c0[_0x11ff('0x13')][_0x11ff('0x12')]);}})[_0x11ff('0x14')](function(_0x448684){logger[_0x11ff('0x11')](_0x11ff('0xb'),_0x5b3269,_0x448684);_0x4a8e5e(_0x448684);});});}exports[_0x11ff('0x15')]=function(_0x231cbb){var _0x404680=this;return new Promise(function(_0x4f9f32,_0x4773e8){return db[_0x11ff('0x16')][_0x11ff('0x17')](_0x231cbb[_0x11ff('0x18')],{'raw':_0x231cbb[_0x11ff('0x19')]?_0x231cbb[_0x11ff('0x19')][_0x11ff('0x1a')]===undefined?!![]:![]:!![]})[_0x11ff('0x9')](function(_0xa0a8bc){logger[_0x11ff('0xa')](_0x11ff('0x15'),_0x231cbb);logger['debug'](_0x11ff('0x15'),_0x231cbb,JSON[_0x11ff('0xf')](_0xa0a8bc));_0x4f9f32(_0xa0a8bc);})[_0x11ff('0x14')](function(_0x5d9278){logger[_0x11ff('0x11')](_0x11ff('0x15'),_0x5d9278[_0x11ff('0x12')],_0x231cbb);_0x4773e8(_0x404680['error'](0x1f4,_0x5d9278['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x41f546){var _0x494e35=this;return new Promise(function(_0x122dc8,_0x354e81){return db[_0x11ff('0x16')]['update'](_0x41f546[_0x11ff('0x18')],{'raw':_0x41f546['options']?_0x41f546[_0x11ff('0x19')][_0x11ff('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f546['options']?_0x41f546[_0x11ff('0x19')][_0x11ff('0x1b')]||null:null,'attributes':_0x41f546[_0x11ff('0x19')]?_0x41f546[_0x11ff('0x19')][_0x11ff('0x1c')]||null:null,'limit':_0x41f546[_0x11ff('0x19')]?_0x41f546[_0x11ff('0x19')]['limit']||null:null})[_0x11ff('0x9')](function(_0x417725){logger[_0x11ff('0xa')](_0x11ff('0x1d'),_0x41f546);logger[_0x11ff('0xd')](_0x11ff('0x1d'),_0x41f546,JSON[_0x11ff('0xf')](_0x417725));_0x122dc8(_0x417725);})[_0x11ff('0x14')](function(_0x277b93){logger[_0x11ff('0x11')](_0x11ff('0x1d'),_0x277b93[_0x11ff('0x12')],_0x41f546);_0x354e81(_0x494e35['error'](0x1f4,_0x277b93[_0x11ff('0x12')]));});});}; \ No newline at end of file +var _0xc925=['message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug','UpdateWhatsappQueueReport','where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4be857,_0x155753){var _0x35e2d4=function(_0x1ba7da){while(--_0x1ba7da){_0x4be857['push'](_0x4be857['shift']());}};_0x35e2d4(++_0x155753);}(_0xc925,0x71));var _0x5c92=function(_0x33ccb5,_0xe10dac){_0x33ccb5=_0x33ccb5-0x0;var _0x5d9d6f=_0xc925[_0x33ccb5];return _0x5d9d6f;};'use strict';var _=require('lodash');var util=require(_0x5c92('0x0'));var moment=require(_0x5c92('0x1'));var BPromise=require(_0x5c92('0x2'));var rs=require(_0x5c92('0x3'));var fs=require('fs');var Redis=require(_0x5c92('0x4'));var db=require(_0x5c92('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c92('0x6'))(_0x5c92('0x7'));var config=require(_0x5c92('0x8'));var jayson=require(_0x5c92('0x9'));var client=jayson[_0x5c92('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17afff,_0x31ee43,_0x1c0e51){return new BPromise(function(_0x582302,_0xaf398d){return client[_0x5c92('0xb')](_0x17afff,_0x1c0e51)[_0x5c92('0xc')](function(_0x34e90c){logger[_0x5c92('0xd')](_0x5c92('0xe'),_0x31ee43,_0x5c92('0xf'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x31ee43,_0x5c92('0xf'),JSON[_0x5c92('0x10')](_0x34e90c));if(_0x34e90c[_0x5c92('0x11')]){if(_0x34e90c[_0x5c92('0x11')][_0x5c92('0x12')]===0x1f4){logger[_0x5c92('0x11')](_0x5c92('0xe'),_0x31ee43,_0x34e90c[_0x5c92('0x11')]['message']);return _0xaf398d(_0x34e90c[_0x5c92('0x11')][_0x5c92('0x13')]);}logger[_0x5c92('0x11')](_0x5c92('0xe'),_0x31ee43,_0x34e90c[_0x5c92('0x11')][_0x5c92('0x13')]);return _0x582302(_0x34e90c[_0x5c92('0x11')][_0x5c92('0x13')]);}else{logger[_0x5c92('0xd')](_0x5c92('0xe'),_0x31ee43,_0x5c92('0xf'));_0x582302(_0x34e90c[_0x5c92('0x14')][_0x5c92('0x13')]);}})['catch'](function(_0x490773){logger[_0x5c92('0x11')](_0x5c92('0xe'),_0x31ee43,_0x490773);_0xaf398d(_0x490773);});});}exports[_0x5c92('0x15')]=function(_0x423799){var _0x5a67ca=this;return new Promise(function(_0x5bb4ee,_0x5b8a86){return db[_0x5c92('0x16')][_0x5c92('0x17')](_0x423799[_0x5c92('0x18')],{'raw':_0x423799['options']?_0x423799[_0x5c92('0x19')][_0x5c92('0x1a')]===undefined?!![]:![]:!![]})[_0x5c92('0xc')](function(_0x5ec3fc){logger[_0x5c92('0xd')](_0x5c92('0x15'),_0x423799);logger[_0x5c92('0x1b')](_0x5c92('0x15'),_0x423799,JSON['stringify'](_0x5ec3fc));_0x5bb4ee(_0x5ec3fc);})['catch'](function(_0x55acb5){logger[_0x5c92('0x11')](_0x5c92('0x15'),_0x55acb5['message'],_0x423799);_0x5b8a86(_0x5a67ca[_0x5c92('0x11')](0x1f4,_0x55acb5[_0x5c92('0x13')]));});});};exports[_0x5c92('0x1c')]=function(_0x2f69a6){var _0x4d911c=this;return new Promise(function(_0x31a9a1,_0x448fd0){return db['WhatsappQueueReport']['update'](_0x2f69a6[_0x5c92('0x18')],{'raw':_0x2f69a6['options']?_0x2f69a6['options'][_0x5c92('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f69a6[_0x5c92('0x19')]?_0x2f69a6[_0x5c92('0x19')][_0x5c92('0x1d')]||null:null,'attributes':_0x2f69a6[_0x5c92('0x19')]?_0x2f69a6[_0x5c92('0x19')][_0x5c92('0x1e')]||null:null,'limit':_0x2f69a6['options']?_0x2f69a6['options'][_0x5c92('0x1f')]||null:null})[_0x5c92('0xc')](function(_0x326d8a){logger[_0x5c92('0xd')](_0x5c92('0x1c'),_0x2f69a6);logger['debug'](_0x5c92('0x1c'),_0x2f69a6,JSON[_0x5c92('0x10')](_0x326d8a));_0x31a9a1(_0x326d8a);})[_0x5c92('0x20')](function(_0x9e6d68){logger[_0x5c92('0x11')]('UpdateWhatsappQueueReport',_0x9e6d68[_0x5c92('0x13')],_0x2f69a6);_0x448fd0(_0x4d911c[_0x5c92('0x11')](0x1f4,_0x9e6d68[_0x5c92('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 42a7a37..3253154 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 _0xb9e0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path'];(function(_0x2b59f2,_0x550b43){var _0x219eb4=function(_0x1be0a2){while(--_0x1be0a2){_0x2b59f2['push'](_0x2b59f2['shift']());}};_0x219eb4(++_0x550b43);}(_0xb9e0,0x18c));var _0x0b9e=function(_0x38c7e3,_0x34b4bc){_0x38c7e3=_0x38c7e3-0x0;var _0x34b66f=_0xb9e0[_0x38c7e3];return _0x34b66f;};'use strict';var multer=require(_0x0b9e('0x0'));var util=require(_0x0b9e('0x1'));var path=require(_0x0b9e('0x2'));var timeout=require(_0x0b9e('0x3'));var express=require(_0x0b9e('0x4'));var router=express[_0x0b9e('0x5')]();var auth=require(_0x0b9e('0x6'));var interaction=require(_0x0b9e('0x7'));var config=require(_0x0b9e('0x8'));var controller=require(_0x0b9e('0x9'));router[_0x0b9e('0xa')]('/',auth[_0x0b9e('0xb')](),controller[_0x0b9e('0xc')]);router[_0x0b9e('0xa')](_0x0b9e('0xd'),auth[_0x0b9e('0xb')](),controller['describe']);router[_0x0b9e('0xa')](_0x0b9e('0xe'),auth[_0x0b9e('0xb')](),controller[_0x0b9e('0xf')]);router[_0x0b9e('0x10')]('/',auth[_0x0b9e('0xb')](),controller['create']);router['put'](_0x0b9e('0xe'),auth[_0x0b9e('0xb')](),controller[_0x0b9e('0x11')]);router[_0x0b9e('0x12')](_0x0b9e('0xe'),auth[_0x0b9e('0xb')](),controller[_0x0b9e('0x13')]);module[_0x0b9e('0x14')]=router; \ No newline at end of file +var _0xc139=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','multer'];(function(_0x5da980,_0x45b11c){var _0x4ee75e=function(_0x1e843b){while(--_0x1e843b){_0x5da980['push'](_0x5da980['shift']());}};_0x4ee75e(++_0x45b11c);}(_0xc139,0x1b9));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c13('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9c13('0x1'));var express=require(_0x9c13('0x2'));var router=express[_0x9c13('0x3')]();var auth=require(_0x9c13('0x4'));var interaction=require(_0x9c13('0x5'));var config=require(_0x9c13('0x6'));var controller=require(_0x9c13('0x7'));router[_0x9c13('0x8')]('/',auth[_0x9c13('0x9')](),controller[_0x9c13('0xa')]);router[_0x9c13('0x8')](_0x9c13('0xb'),auth[_0x9c13('0x9')](),controller[_0x9c13('0xc')]);router['get'](_0x9c13('0xd'),auth[_0x9c13('0x9')](),controller[_0x9c13('0xe')]);router['post']('/',auth[_0x9c13('0x9')](),controller['create']);router[_0x9c13('0xf')](_0x9c13('0xd'),auth[_0x9c13('0x9')](),controller[_0x9c13('0x10')]);router['delete'](_0x9c13('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index da4d3b6..afbc44b 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3494e8,_0x4111ea){_0x3494e8=_0x3494e8-0x0;var _0x20bd8c=_0xb10b[_0x3494e8];return _0x20bd8c;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x5dda62,_0x3cfc26){var _0x46cc3b=function(_0x368441){while(--_0x368441){_0x5dda62['push'](_0x5dda62['shift']());}};_0x46cc3b(++_0x3cfc26);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2610e1,_0x5a86f1){_0x2610e1=_0x2610e1-0x0;var _0xef812e=_0x5f2f[_0x2610e1];return _0xef812e;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index aa8d854..968361c 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 _0x43a0=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','findAll','rows','show','params','includeAll','include','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key'];(function(_0x161ae4,_0x33b6e1){var _0x3438b1=function(_0x2106a0){while(--_0x2106a0){_0x161ae4['push'](_0x161ae4['shift']());}};_0x3438b1(++_0x33b6e1);}(_0x43a0,0x159));var _0x043a=function(_0x395d72,_0x3c4192){_0x395d72=_0x395d72-0x0;var _0x4a5936=_0x43a0[_0x395d72];return _0x4a5936;};'use strict';var pdf=require(_0x043a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x043a('0x1'));var zipdir=require(_0x043a('0x2'));var jsonpatch=require(_0x043a('0x3'));var rp=require(_0x043a('0x4'));var moment=require(_0x043a('0x5'));var BPromise=require(_0x043a('0x6'));var Mustache=require(_0x043a('0x7'));var util=require(_0x043a('0x8'));var path=require(_0x043a('0x9'));var sox=require(_0x043a('0xa'));var csv=require('to-csv');var ejs=require(_0x043a('0xb'));var fs=require('fs');var _=require(_0x043a('0xc'));var squel=require(_0x043a('0xd'));var crypto=require(_0x043a('0xe'));var jsforce=require(_0x043a('0xf'));var deskjs=require(_0x043a('0x10'));var toCsv=require(_0x043a('0x11'));var querystring=require(_0x043a('0x12'));var Papa=require(_0x043a('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x043a('0x14'));var hardwareService=require(_0x043a('0x15'));var logger=require(_0x043a('0x16'))(_0x043a('0x17'));var utils=require(_0x043a('0x18'));var config=require(_0x043a('0x19'));var db=require(_0x043a('0x1a'))['db'];function respondWithStatusCode(_0x201122,_0x1c2672){_0x1c2672=_0x1c2672||0xcc;return function(_0x1ba56a){if(_0x1ba56a){return _0x201122[_0x043a('0x1b')](_0x1c2672);}return _0x201122[_0x043a('0x1c')](_0x1c2672)[_0x043a('0x1d')]();};}function respondWithResult(_0xeec951,_0x3341e1){_0x3341e1=_0x3341e1||0xc8;return function(_0x4457c7){if(_0x4457c7){return _0xeec951[_0x043a('0x1c')](_0x3341e1)[_0x043a('0x1e')](_0x4457c7);}};}function respondWithFilteredResult(_0x1851a9,_0x3f32ae){return function(_0x2a327b){if(_0x2a327b){var _0x584bba=_0x2a327b['count'],_0x2d0ee0=_0x3f32ae[_0x043a('0x1f')],_0xc7bd9a=_0x3f32ae['offset']+_0x3f32ae[_0x043a('0x20')],_0x247f08;if(_0xc7bd9a>=_0x584bba){_0xc7bd9a=_0x584bba;_0x247f08=0xc8;}else{_0x247f08=0xce;}_0x1851a9['status'](_0x247f08);return _0x1851a9[_0x043a('0x21')](_0x043a('0x22'),_0x2d0ee0+'-'+_0xc7bd9a+'/'+_0x584bba)[_0x043a('0x1e')](_0x2a327b);}return null;};}function patchUpdates(_0x238557){return function(_0x30ce3e){try{jsonpatch[_0x043a('0x23')](_0x30ce3e,_0x238557,!![]);}catch(_0x4d619f){return BPromise['reject'](_0x4d619f);}return _0x30ce3e[_0x043a('0x24')]();};}function saveUpdates(_0x4707d8,_0x1d6acb){return function(_0x1bb9c4){if(_0x1bb9c4){return _0x1bb9c4[_0x043a('0x25')](_0x4707d8)[_0x043a('0x26')](function(_0x535c15){return _0x535c15;});}return null;};}function removeEntity(_0x33a6bb,_0x1da056){return function(_0x4b0cbd){if(_0x4b0cbd){return _0x4b0cbd[_0x043a('0x27')]()[_0x043a('0x26')](function(){_0x33a6bb[_0x043a('0x1c')](0xcc)[_0x043a('0x1d')]();});}};}function handleEntityNotFound(_0x149322,_0x45073b){return function(_0x5339fd){if(!_0x5339fd){_0x149322['sendStatus'](0x194);}return _0x5339fd;};}function handleError(_0xa5a41b,_0x1db7c7){_0x1db7c7=_0x1db7c7||0x1f4;return function(_0x5cb95d){logger['error'](_0x5cb95d[_0x043a('0x28')]);if(_0x5cb95d['name']){delete _0x5cb95d[_0x043a('0x29')];}_0xa5a41b[_0x043a('0x1c')](_0x1db7c7)[_0x043a('0x2a')](_0x5cb95d);};}exports[_0x043a('0x2b')]=function(_0x1d316b,_0x55eee6){var _0x803a8e={},_0x595517={},_0x69261a={'count':0x0,'rows':[]};var _0x555450=_[_0x043a('0x2c')](db[_0x043a('0x2d')][_0x043a('0x2e')],function(_0x1c330a){return{'name':_0x1c330a[_0x043a('0x2f')],'type':_0x1c330a[_0x043a('0x30')][_0x043a('0x31')]};});_0x595517[_0x043a('0x32')]=_['map'](_0x555450,_0x043a('0x29'));_0x595517[_0x043a('0x33')]=_[_0x043a('0x34')](_0x1d316b[_0x043a('0x33')]);_0x595517[_0x043a('0x35')]=_[_0x043a('0x36')](_0x595517[_0x043a('0x32')],_0x595517[_0x043a('0x33')]);_0x803a8e[_0x043a('0x37')]=_[_0x043a('0x36')](_0x595517[_0x043a('0x32')],qs[_0x043a('0x38')](_0x1d316b['query']['fields']));_0x803a8e[_0x043a('0x37')]=_0x803a8e[_0x043a('0x37')][_0x043a('0x39')]?_0x803a8e[_0x043a('0x37')]:_0x595517[_0x043a('0x32')];if(!_0x1d316b[_0x043a('0x33')][_0x043a('0x3a')](_0x043a('0x3b'))){_0x803a8e[_0x043a('0x20')]=qs['limit'](_0x1d316b['query'][_0x043a('0x20')]);_0x803a8e[_0x043a('0x1f')]=qs['offset'](_0x1d316b['query']['offset']);}_0x803a8e['order']=qs['sort'](_0x1d316b['query'][_0x043a('0x3c')]);_0x803a8e['where']=qs[_0x043a('0x35')](_[_0x043a('0x3d')](_0x1d316b[_0x043a('0x33')],_0x595517[_0x043a('0x35')]),_0x555450);if(_0x1d316b[_0x043a('0x33')][_0x043a('0x3e')]){_0x803a8e[_0x043a('0x3f')]=_[_0x043a('0x40')](_0x803a8e[_0x043a('0x3f')],{'$or':_[_0x043a('0x2c')](_0x555450,function(_0x3b3039){if(_0x3b3039[_0x043a('0x30')]!==_0x043a('0x41')){var _0x387f7f={};_0x387f7f[_0x3b3039[_0x043a('0x29')]]={'$like':'%'+_0x1d316b['query'][_0x043a('0x3e')]+'%'};return _0x387f7f;}})});}_0x803a8e=_['merge']({},_0x803a8e,_0x1d316b[_0x043a('0x42')]);var _0x2e2e75={'where':_0x803a8e[_0x043a('0x3f')]};return db[_0x043a('0x2d')][_0x043a('0x43')](_0x2e2e75)[_0x043a('0x26')](function(_0x2aac97){_0x69261a['count']=_0x2aac97;if(_0x1d316b[_0x043a('0x33')]['includeAll']){_0x803a8e['include']=[{'all':!![]}];}return db[_0x043a('0x2d')][_0x043a('0x44')](_0x803a8e);})[_0x043a('0x26')](function(_0x303c97){_0x69261a[_0x043a('0x45')]=_0x303c97;return _0x69261a;})[_0x043a('0x26')](respondWithFilteredResult(_0x55eee6,_0x803a8e))['catch'](handleError(_0x55eee6,null));};exports[_0x043a('0x46')]=function(_0x1b63cf,_0x3721e5){var _0x247dfe={'raw':!![],'where':{'id':_0x1b63cf[_0x043a('0x47')]['id']}},_0x1f643e={};_0x1f643e[_0x043a('0x32')]=_['keys'](db[_0x043a('0x2d')][_0x043a('0x2e')]);_0x1f643e[_0x043a('0x33')]=_[_0x043a('0x34')](_0x1b63cf[_0x043a('0x33')]);_0x1f643e[_0x043a('0x35')]=_[_0x043a('0x36')](_0x1f643e[_0x043a('0x32')],_0x1f643e[_0x043a('0x33')]);_0x247dfe[_0x043a('0x37')]=_[_0x043a('0x36')](_0x1f643e[_0x043a('0x32')],qs[_0x043a('0x38')](_0x1b63cf[_0x043a('0x33')][_0x043a('0x38')]));_0x247dfe['attributes']=_0x247dfe[_0x043a('0x37')][_0x043a('0x39')]?_0x247dfe[_0x043a('0x37')]:_0x1f643e[_0x043a('0x32')];if(_0x1b63cf['query'][_0x043a('0x48')]){_0x247dfe[_0x043a('0x49')]=[{'all':!![]}];}_0x247dfe=_['merge']({},_0x247dfe,_0x1b63cf['options']);return db[_0x043a('0x2d')][_0x043a('0x4a')](_0x247dfe)[_0x043a('0x26')](handleEntityNotFound(_0x3721e5,null))[_0x043a('0x26')](respondWithResult(_0x3721e5,null))[_0x043a('0x4b')](handleError(_0x3721e5,null));};exports[_0x043a('0x4c')]=function(_0x152de5,_0x38f59c){return db[_0x043a('0x2d')][_0x043a('0x4c')](_0x152de5[_0x043a('0x4d')],{})[_0x043a('0x26')](respondWithResult(_0x38f59c,0xc9))['catch'](handleError(_0x38f59c,null));};exports['update']=function(_0x31774c,_0x6481b0){if(_0x31774c['body']['id']){delete _0x31774c[_0x043a('0x4d')]['id'];}return db[_0x043a('0x2d')][_0x043a('0x4a')]({'where':{'id':_0x31774c[_0x043a('0x47')]['id']}})[_0x043a('0x26')](handleEntityNotFound(_0x6481b0,null))[_0x043a('0x26')](saveUpdates(_0x31774c[_0x043a('0x4d')],null))['then'](respondWithResult(_0x6481b0,null))[_0x043a('0x4b')](handleError(_0x6481b0,null));};exports['destroy']=function(_0x1bd917,_0x484baa){return db[_0x043a('0x2d')][_0x043a('0x4a')]({'where':{'id':_0x1bd917[_0x043a('0x47')]['id']}})[_0x043a('0x26')](handleEntityNotFound(_0x484baa,null))['then'](removeEntity(_0x484baa,null))['catch'](handleError(_0x484baa,null));};exports[_0x043a('0x4e')]=function(_0x4a6359,_0x524daf){return db[_0x043a('0x2d')][_0x043a('0x4e')]()[_0x043a('0x26')](respondWithResult(_0x524daf,null))['catch'](handleError(_0x524daf,null));}; \ No newline at end of file +var _0x6815=['find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','sendStatus','status','end','offset','limit','apply','reject','save','update','then','destroy','error','name','send','map','WhatsappTransferReport','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','rows','catch','rawAttributes','length'];(function(_0x500384,_0x55595d){var _0x28ff7c=function(_0x317714){while(--_0x317714){_0x500384['push'](_0x500384['shift']());}};_0x28ff7c(++_0x55595d);}(_0x6815,0x1a2));var _0x5681=function(_0x4b612c,_0x6eb4c2){_0x4b612c=_0x4b612c-0x0;var _0x8b7601=_0x6815[_0x4b612c];return _0x8b7601;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5681('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5681('0x1'));var rp=require(_0x5681('0x2'));var moment=require(_0x5681('0x3'));var BPromise=require(_0x5681('0x4'));var Mustache=require('mustache');var util=require(_0x5681('0x5'));var path=require(_0x5681('0x6'));var sox=require(_0x5681('0x7'));var csv=require(_0x5681('0x8'));var ejs=require(_0x5681('0x9'));var fs=require('fs');var _=require(_0x5681('0xa'));var squel=require(_0x5681('0xb'));var crypto=require(_0x5681('0xc'));var jsforce=require(_0x5681('0xd'));var deskjs=require(_0x5681('0xe'));var toCsv=require(_0x5681('0x8'));var querystring=require('querystring');var Papa=require(_0x5681('0xf'));var Redis=require('ioredis');var authService=require(_0x5681('0x10'));var qs=require(_0x5681('0x11'));var as=require(_0x5681('0x12'));var hardwareService=require(_0x5681('0x13'));var logger=require(_0x5681('0x14'))(_0x5681('0x15'));var utils=require(_0x5681('0x16'));var config=require('../../config/environment');var db=require(_0x5681('0x17'))['db'];function respondWithStatusCode(_0x537e7a,_0x4b73d5){_0x4b73d5=_0x4b73d5||0xcc;return function(_0x1a1830){if(_0x1a1830){return _0x537e7a[_0x5681('0x18')](_0x4b73d5);}return _0x537e7a[_0x5681('0x19')](_0x4b73d5)[_0x5681('0x1a')]();};}function respondWithResult(_0x97408b,_0x8fda40){_0x8fda40=_0x8fda40||0xc8;return function(_0x4e9c0c){if(_0x4e9c0c){return _0x97408b[_0x5681('0x19')](_0x8fda40)['json'](_0x4e9c0c);}};}function respondWithFilteredResult(_0x1cf74f,_0x3d9406){return function(_0x50bdba){if(_0x50bdba){var _0x3f6be9=_0x50bdba['count'],_0x3557b2=_0x3d9406[_0x5681('0x1b')],_0xe6c886=_0x3d9406[_0x5681('0x1b')]+_0x3d9406[_0x5681('0x1c')],_0x202573;if(_0xe6c886>=_0x3f6be9){_0xe6c886=_0x3f6be9;_0x202573=0xc8;}else{_0x202573=0xce;}_0x1cf74f['status'](_0x202573);return _0x1cf74f['set']('Content-Range',_0x3557b2+'-'+_0xe6c886+'/'+_0x3f6be9)['json'](_0x50bdba);}return null;};}function patchUpdates(_0x3b5ed3){return function(_0x1f6dfa){try{jsonpatch[_0x5681('0x1d')](_0x1f6dfa,_0x3b5ed3,!![]);}catch(_0x1bba0f){return BPromise[_0x5681('0x1e')](_0x1bba0f);}return _0x1f6dfa[_0x5681('0x1f')]();};}function saveUpdates(_0x2e370b,_0x222a61){return function(_0x17f774){if(_0x17f774){return _0x17f774[_0x5681('0x20')](_0x2e370b)[_0x5681('0x21')](function(_0x4359ad){return _0x4359ad;});}return null;};}function removeEntity(_0x2b2208,_0x3e3953){return function(_0x29a4a4){if(_0x29a4a4){return _0x29a4a4[_0x5681('0x22')]()[_0x5681('0x21')](function(){_0x2b2208[_0x5681('0x19')](0xcc)[_0x5681('0x1a')]();});}};}function handleEntityNotFound(_0x5c6164,_0x3fd74a){return function(_0x9b6895){if(!_0x9b6895){_0x5c6164[_0x5681('0x18')](0x194);}return _0x9b6895;};}function handleError(_0x3d7da9,_0x5c0599){_0x5c0599=_0x5c0599||0x1f4;return function(_0x45e2ce){logger[_0x5681('0x23')](_0x45e2ce['stack']);if(_0x45e2ce[_0x5681('0x24')]){delete _0x45e2ce['name'];}_0x3d7da9['status'](_0x5c0599)[_0x5681('0x25')](_0x45e2ce);};}exports['index']=function(_0x3f86fe,_0xeeecc0){var _0x4946e3={},_0x43a933={},_0x4846b5={'count':0x0,'rows':[]};var _0x437734=_[_0x5681('0x26')](db[_0x5681('0x27')]['rawAttributes'],function(_0x102c29){return{'name':_0x102c29['fieldName'],'type':_0x102c29[_0x5681('0x28')][_0x5681('0x29')]};});_0x43a933[_0x5681('0x2a')]=_[_0x5681('0x26')](_0x437734,_0x5681('0x24'));_0x43a933['query']=_[_0x5681('0x2b')](_0x3f86fe[_0x5681('0x2c')]);_0x43a933['filters']=_[_0x5681('0x2d')](_0x43a933['model'],_0x43a933[_0x5681('0x2c')]);_0x4946e3[_0x5681('0x2e')]=_[_0x5681('0x2d')](_0x43a933['model'],qs[_0x5681('0x2f')](_0x3f86fe[_0x5681('0x2c')][_0x5681('0x2f')]));_0x4946e3[_0x5681('0x2e')]=_0x4946e3['attributes']['length']?_0x4946e3[_0x5681('0x2e')]:_0x43a933[_0x5681('0x2a')];if(!_0x3f86fe[_0x5681('0x2c')][_0x5681('0x30')](_0x5681('0x31'))){_0x4946e3[_0x5681('0x1c')]=qs[_0x5681('0x1c')](_0x3f86fe[_0x5681('0x2c')][_0x5681('0x1c')]);_0x4946e3[_0x5681('0x1b')]=qs[_0x5681('0x1b')](_0x3f86fe[_0x5681('0x2c')]['offset']);}_0x4946e3[_0x5681('0x32')]=qs[_0x5681('0x33')](_0x3f86fe['query'][_0x5681('0x33')]);_0x4946e3[_0x5681('0x34')]=qs[_0x5681('0x35')](_[_0x5681('0x36')](_0x3f86fe[_0x5681('0x2c')],_0x43a933[_0x5681('0x35')]),_0x437734);if(_0x3f86fe[_0x5681('0x2c')][_0x5681('0x37')]){_0x4946e3[_0x5681('0x34')]=_[_0x5681('0x38')](_0x4946e3['where'],{'$or':_[_0x5681('0x26')](_0x437734,function(_0x181ec9){if(_0x181ec9[_0x5681('0x28')]!==_0x5681('0x39')){var _0x58bbe9={};_0x58bbe9[_0x181ec9[_0x5681('0x24')]]={'$like':'%'+_0x3f86fe[_0x5681('0x2c')][_0x5681('0x37')]+'%'};return _0x58bbe9;}})});}_0x4946e3=_[_0x5681('0x38')]({},_0x4946e3,_0x3f86fe[_0x5681('0x3a')]);var _0x5159fc={'where':_0x4946e3['where']};return db[_0x5681('0x27')][_0x5681('0x3b')](_0x5159fc)[_0x5681('0x21')](function(_0x23c4df){_0x4846b5[_0x5681('0x3b')]=_0x23c4df;if(_0x3f86fe['query']['includeAll']){_0x4946e3[_0x5681('0x3c')]=[{'all':!![]}];}return db[_0x5681('0x27')]['findAll'](_0x4946e3);})['then'](function(_0x237966){_0x4846b5[_0x5681('0x3d')]=_0x237966;return _0x4846b5;})[_0x5681('0x21')](respondWithFilteredResult(_0xeeecc0,_0x4946e3))[_0x5681('0x3e')](handleError(_0xeeecc0,null));};exports['show']=function(_0x29a125,_0x272c9d){var _0x16592b={'raw':!![],'where':{'id':_0x29a125['params']['id']}},_0x49ad6e={};_0x49ad6e[_0x5681('0x2a')]=_[_0x5681('0x2b')](db[_0x5681('0x27')][_0x5681('0x3f')]);_0x49ad6e[_0x5681('0x2c')]=_[_0x5681('0x2b')](_0x29a125[_0x5681('0x2c')]);_0x49ad6e[_0x5681('0x35')]=_['intersection'](_0x49ad6e[_0x5681('0x2a')],_0x49ad6e[_0x5681('0x2c')]);_0x16592b[_0x5681('0x2e')]=_[_0x5681('0x2d')](_0x49ad6e[_0x5681('0x2a')],qs['fields'](_0x29a125[_0x5681('0x2c')][_0x5681('0x2f')]));_0x16592b['attributes']=_0x16592b[_0x5681('0x2e')][_0x5681('0x40')]?_0x16592b[_0x5681('0x2e')]:_0x49ad6e['model'];if(_0x29a125[_0x5681('0x2c')]['includeAll']){_0x16592b[_0x5681('0x3c')]=[{'all':!![]}];}_0x16592b=_[_0x5681('0x38')]({},_0x16592b,_0x29a125[_0x5681('0x3a')]);return db[_0x5681('0x27')][_0x5681('0x41')](_0x16592b)[_0x5681('0x21')](handleEntityNotFound(_0x272c9d,null))[_0x5681('0x21')](respondWithResult(_0x272c9d,null))['catch'](handleError(_0x272c9d,null));};exports[_0x5681('0x42')]=function(_0x242243,_0x1a258d){return db[_0x5681('0x27')]['create'](_0x242243[_0x5681('0x43')],{})[_0x5681('0x21')](respondWithResult(_0x1a258d,0xc9))[_0x5681('0x3e')](handleError(_0x1a258d,null));};exports[_0x5681('0x20')]=function(_0x488664,_0x412715){if(_0x488664['body']['id']){delete _0x488664['body']['id'];}return db[_0x5681('0x27')][_0x5681('0x41')]({'where':{'id':_0x488664['params']['id']}})[_0x5681('0x21')](handleEntityNotFound(_0x412715,null))[_0x5681('0x21')](saveUpdates(_0x488664[_0x5681('0x43')],null))[_0x5681('0x21')](respondWithResult(_0x412715,null))[_0x5681('0x3e')](handleError(_0x412715,null));};exports[_0x5681('0x22')]=function(_0x1aa856,_0x3b993f){return db['WhatsappTransferReport'][_0x5681('0x41')]({'where':{'id':_0x1aa856['params']['id']}})[_0x5681('0x21')](handleEntityNotFound(_0x3b993f,null))['then'](removeEntity(_0x3b993f,null))['catch'](handleError(_0x3b993f,null));};exports[_0x5681('0x44')]=function(_0x5856bd,_0x2b53f1){return db[_0x5681('0x27')]['describe']()[_0x5681('0x21')](respondWithResult(_0x2b53f1,null))['catch'](handleError(_0x2b53f1,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d7c8f19..d8aa4b6 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 _0x61ba=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4de1a1,_0x411368){var _0x39417a=function(_0x3c65b2){while(--_0x3c65b2){_0x4de1a1['push'](_0x4de1a1['shift']());}};_0x39417a(++_0x411368);}(_0x61ba,0x166));var _0xa61b=function(_0x362141,_0x4cfdaa){_0x362141=_0x362141-0x0;var _0x60fa60=_0x61ba[_0x362141];return _0x60fa60;};'use strict';var _=require(_0xa61b('0x0'));var util=require(_0xa61b('0x1'));var logger=require('../../config/logger')(_0xa61b('0x2'));var moment=require(_0xa61b('0x3'));var BPromise=require(_0xa61b('0x4'));var rp=require(_0xa61b('0x5'));var fs=require('fs');var path=require(_0xa61b('0x6'));var rimraf=require(_0xa61b('0x7'));var config=require(_0xa61b('0x8'));var attributes=require(_0xa61b('0x9'));module[_0xa61b('0xa')]=function(_0x395984,_0x5ccddc){return _0x395984[_0xa61b('0xb')](_0xa61b('0xc'),attributes,{'tableName':_0xa61b('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2d2=['util','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x2f7d36,_0x6c8153){var _0x300cf9=function(_0x487534){while(--_0x487534){_0x2f7d36['push'](_0x2f7d36['shift']());}};_0x300cf9(++_0x6c8153);}(_0xb2d2,0xa7));var _0x2b2d=function(_0x5388d7,_0x138e82){_0x5388d7=_0x5388d7-0x0;var _0x576d49=_0xb2d2[_0x5388d7];return _0x576d49;};'use strict';var _=require(_0x2b2d('0x0'));var util=require(_0x2b2d('0x1'));var logger=require('../../config/logger')(_0x2b2d('0x2'));var moment=require(_0x2b2d('0x3'));var BPromise=require(_0x2b2d('0x4'));var rp=require(_0x2b2d('0x5'));var fs=require('fs');var path=require(_0x2b2d('0x6'));var rimraf=require(_0x2b2d('0x7'));var config=require('../../config/environment');var attributes=require(_0x2b2d('0x8'));module['exports']=function(_0x63dae3,_0x136bc1){return _0x63dae3['define'](_0x2b2d('0x9'),attributes,{'tableName':_0x2b2d('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2b2d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d7d2a0e..c40e006 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(_0x647130,_0x1071ee){var _0x28f986=function(_0x2cecbc){while(--_0x2cecbc){_0x647130['push'](_0x647130['shift']());}};_0x28f986(++_0x1071ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x5be891,_0xf27226){var _0x434bce=function(_0x528fdb){while(--_0x528fdb){_0x5be891['push'](_0x5be891['shift']());}};_0x434bce(++_0xf27226);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 7145b60..24f4f88 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee96=['map','status','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','sequelize','sync','then','listen','info','start','Online\x20apps:','filter','online','name','join','Offline\x20apps:'];(function(_0x2b672f,_0xe4bca4){var _0x2eabbe=function(_0x4f290e){while(--_0x4f290e){_0x2b672f['push'](_0x2b672f['shift']());}};_0x2eabbe(++_0xe4bca4);}(_0xee96,0xa5));var _0x6ee9=function(_0x264d3e,_0x3268f4){_0x264d3e=_0x264d3e-0x0;var _0x57ae7c=_0xee96[_0x264d3e];return _0x57ae7c;};'use strict';var _=require(_0x6ee9('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x6ee9('0x1'))('app');var pm2=require(_0x6ee9('0x2'));var pm2Config=require(_0x6ee9('0x3'));var schedule=require(_0x6ee9('0x4'));var chat=require('./config/schedule/chat');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x6ee9('0x5')][_0x6ee9('0x6')]()[_0x6ee9('0x7')](function(){return rpc[_0x6ee9('0x8')]();})[_0x6ee9('0x7')](function(_0x424bb5){logger[_0x6ee9('0x9')](_0x424bb5);return chat['start']();})[_0x6ee9('0x7')](function(){return schedule[_0x6ee9('0xa')]();})['then'](function(){return transcribe[_0x6ee9('0xa')]();})['then'](function(_0x3be7ef){logger['info'](_0x3be7ef);return pm2[_0x6ee9('0xa')](pm2Config);})[_0x6ee9('0x7')](function(_0x15be15){logger[_0x6ee9('0x9')](_0x6ee9('0xb'),_['map'](_[_0x6ee9('0xc')](_0x15be15,{'status':_0x6ee9('0xd')}),_0x6ee9('0xe'))[_0x6ee9('0xf')]());logger['info'](_0x6ee9('0x10'),_[_0x6ee9('0x11')](_['filter'](_0x15be15,function(_0x1a4e0e){return _0x1a4e0e[_0x6ee9('0x12')]!==_0x6ee9('0xd');}),_0x6ee9('0xe'))['join']()||'None');config[_0x6ee9('0x13')]&&require(_0x6ee9('0x14'))[_0x6ee9('0x15')]();require(_0x6ee9('0x16'))[_0x6ee9('0x15')]();})[_0x6ee9('0x17')](function(_0x487280){logger[_0x6ee9('0x18')](_0x6ee9('0x19'),_0x487280);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xb7fd=['lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','start','info','Online\x20apps:','map','filter','online','name','Offline\x20apps:','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x2e65ee,_0x29dad9){var _0x4c712a=function(_0xca593f){while(--_0xca593f){_0x2e65ee['push'](_0x2e65ee['shift']());}};_0x4c712a(++_0x29dad9);}(_0xb7fd,0x122));var _0xdb7f=function(_0x5c616f,_0x4ace32){_0x5c616f=_0x5c616f-0x0;var _0x167d23=_0xb7fd[_0x5c616f];return _0x167d23;};'use strict';var _=require(_0xdb7f('0x0'));var mysqldb=require(_0xdb7f('0x1'));var rpc=require('./rpc');var config=require(_0xdb7f('0x2'));var logger=require(_0xdb7f('0x3'))(_0xdb7f('0x4'));var pm2=require(_0xdb7f('0x5'));var pm2Config=require(_0xdb7f('0x6'));var schedule=require(_0xdb7f('0x7'));var chat=require(_0xdb7f('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xdb7f('0x9')][_0xdb7f('0xa')]()[_0xdb7f('0xb')](function(){return rpc[_0xdb7f('0xc')]();})[_0xdb7f('0xb')](function(_0x22a207){logger['info'](_0x22a207);return chat[_0xdb7f('0xd')]();})[_0xdb7f('0xb')](function(){return schedule[_0xdb7f('0xd')]();})[_0xdb7f('0xb')](function(){return transcribe[_0xdb7f('0xd')]();})[_0xdb7f('0xb')](function(_0x5f54df){logger[_0xdb7f('0xe')](_0x5f54df);return pm2[_0xdb7f('0xd')](pm2Config);})[_0xdb7f('0xb')](function(_0x4f79cb){logger['info'](_0xdb7f('0xf'),_[_0xdb7f('0x10')](_[_0xdb7f('0x11')](_0x4f79cb,{'status':_0xdb7f('0x12')}),_0xdb7f('0x13'))['join']());logger[_0xdb7f('0xe')](_0xdb7f('0x14'),_[_0xdb7f('0x10')](_[_0xdb7f('0x11')](_0x4f79cb,function(_0x259e3f){return _0x259e3f['status']!==_0xdb7f('0x12');}),_0xdb7f('0x13'))['join']()||_0xdb7f('0x15'));config[_0xdb7f('0x16')]&&require(_0xdb7f('0x17'))[_0xdb7f('0x18')]();require(_0xdb7f('0x19'))['default']();})[_0xdb7f('0x1a')](function(_0x2a3ffc){logger[_0xdb7f('0x1b')](_0xdb7f('0x1c'),_0x2a3ffc);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index c91f8f4..cb05e8e 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 _0xb127=['Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','payload','options','promisify','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','secrets','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarRemoteControlPort','hotdesk','interface','use','findOne','params','closed','then','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','pass','json','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey'];(function(_0x10d4f3,_0x4ed93d){var _0x5761d8=function(_0x11d400){while(--_0x11d400){_0x10d4f3['push'](_0x10d4f3['shift']());}};_0x5761d8(++_0x4ed93d);}(_0xb127,0xbe));var _0x7b12=function(_0x527080,_0x29e4dd){_0x527080=_0x527080-0x0;var _0x535ea1=_0xb127[_0x527080];return _0x535ea1;};'use strict';var db=require(_0x7b12('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x7b12('0x1'));var _=require(_0x7b12('0x2'));var jwt=require(_0x7b12('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x7b12('0x4'));var basicAuth=require(_0x7b12('0x5'));var crypto=require(_0x7b12('0x6'));var BPromise=require(_0x7b12('0x7'));var validateJwt=expressJwt({'secret':config[_0x7b12('0x8')]['session']});var userAttributes=['id','role',_0x7b12('0x9'),_0x7b12('0xa'),_0x7b12('0xb'),_0x7b12('0xc'),_0x7b12('0xd'),_0x7b12('0xe'),_0x7b12('0xf'),_0x7b12('0x10'),_0x7b12('0x11'),'mailPause',_0x7b12('0x12'),_0x7b12('0x13'),_0x7b12('0x14'),_0x7b12('0x15'),_0x7b12('0x16'),_0x7b12('0x17'),'lastPauseAt','crudPermissions',_0x7b12('0x18'),'passwordResetAt',_0x7b12('0x19'),_0x7b12('0x1a'),_0x7b12('0x1b'),_0x7b12('0x1c'),_0x7b12('0x1d'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl',_0x7b12('0x1e'),_0x7b12('0x1f'),_0x7b12('0x20'),'userProfileId'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x7b12('0x21')](function(_0x438f5f,_0x234f31,_0x2e70c3){if(_0x438f5f['user']){_0x2e70c3();}else{return db['ChatInteraction'][_0x7b12('0x22')]({'where':{'id':_0x438f5f[_0x7b12('0x23')]['id']},'attributes':['id',_0x7b12('0x24'),'disposition'],'raw':!![]})[_0x7b12('0x25')](function(_0x5bcfc2){if(_0x5bcfc2&&_0x5bcfc2[_0x7b12('0x24')]){return _0x234f31[_0x7b12('0x26')](_0x5bcfc2[_0x7b12('0x27')]==='unmanaged'?0x195:0x193)['json']({'message':_0x5bcfc2['disposition']===_0x7b12('0x28')?_0x7b12('0x29'):_0x7b12('0x2a')});}else{_0x2e70c3();}})[_0x7b12('0x2b')](function(_0x3dcd7b){_0x2e70c3(_0x3dcd7b);});}});};exports[_0x7b12('0x2c')]=function isAuthenticated(_0xb2ac69){return compose()['use'](function(_0x4d08b2,_0x32eba4,_0x4662ad){if(_0x4d08b2[_0x7b12('0x2d')]['authorization']){if(_[_0x7b12('0x2e')](_0x4d08b2[_0x7b12('0x2d')][_0x7b12('0x2f')],_0x7b12('0x30'))){var _0x50d551=basicAuth(_0x4d08b2);db[_0x7b12('0x31')][_0x7b12('0x32')]({'where':{'name':_0x50d551[_0x7b12('0xa')]}})[_0x7b12('0x25')](function(_0x2ae42d){if(!_0x2ae42d||!_0x2ae42d['authenticate'](_0x50d551[_0x7b12('0x33')])){return _0x32eba4[_0x7b12('0x26')](0x191)[_0x7b12('0x34')]({'message':'Wrong\x20credentials.'});}_0x4d08b2[_0x7b12('0x35')]={'id':_0x2ae42d['id']};_0x4662ad();})['catch'](function(_0x2192a0){_0x4662ad(_0x2192a0);});}else if(_[_0x7b12('0x2e')](_0x4d08b2[_0x7b12('0x2d')][_0x7b12('0x2f')],_0x7b12('0x36'))){validateJwt(_0x4d08b2,_0x32eba4,_0x4662ad);}else{if(_0xb2ac69){_0x4662ad();}else{return _0x32eba4[_0x7b12('0x26')](0x193)['json']({'message':_0x7b12('0x37')});}}}else if(_0x4d08b2[_0x7b12('0x38')][_0x7b12('0x39')]){try{var _0x54ce60={'audience':hardwareConf[_0x7b12('0x3a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x4d08b2[_0x7b12('0x38')][_0x7b12('0x39')],_0x54ce60)['then'](function(_0x2f02c1){return db[_0x7b12('0x31')][_0x7b12('0x32')]({'where':{'id':_0x2f02c1[_0x7b12('0x3b')]}})[_0x7b12('0x25')](function(_0x1caa1c){if(!_0x1caa1c||!_[_0x7b12('0x3c')](_0x1caa1c['apiKeyNonce'],_0x2f02c1[_0x7b12('0x3d')])){return _0x32eba4[_0x7b12('0x26')](0x191)[_0x7b12('0x34')]({'message':_0x7b12('0x3e')});}_0x4d08b2[_0x7b12('0x35')]={'id':_0x1caa1c['id']};_0x4662ad();});})[_0x7b12('0x2b')](function(){return _0x32eba4[_0x7b12('0x26')](0x191)[_0x7b12('0x34')]({'message':_0x7b12('0x3f')});});}catch(_0x2c0edb){_0x4662ad(_0x2c0edb);}}else if(_0xb2ac69){_0x4662ad();}else{return _0x32eba4['status'](0x193)[_0x7b12('0x34')]({'message':_0x7b12('0x37')});}})['use'](function(_0x355218,_0x50df22,_0x4cd23c){if(_0x355218[_0x7b12('0x35')]){db[_0x7b12('0x31')][_0x7b12('0x32')]({'where':{'id':_0x355218[_0x7b12('0x35')]['id']},'attributes':userAttributes})[_0x7b12('0x25')](function(_0x2805c8){if(!_0x2805c8){return _0x50df22['status'](0x194)[_0x7b12('0x34')]({'message':'User\x20not\x20found.'});}_0x355218[_0x7b12('0x35')]=_0x2805c8;_0x4cd23c();})[_0x7b12('0x2b')](function(_0x2cca83){_0x4cd23c(_0x2cca83);});}else if(_0xb2ac69){_0x4cd23c();}else{return _0x50df22['status'](0x194)[_0x7b12('0x34')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x7b12('0x40')]=function canUpdate(){return compose()[_0x7b12('0x21')](function(_0x4dcf41,_0x4ab33e,_0x29b822){return require(_0x7b12('0x41'))['getLicense']()[_0x7b12('0x25')](function(_0x4473e7){if(_0x4473e7[_0x7b12('0x42')]){_0x29b822();}else{return _0x4ab33e[_0x7b12('0x26')](0x193)['json']({'message':_0x7b12('0x43')});}})[_0x7b12('0x2b')](function(_0x1eb6fb){_0x29b822(_0x1eb6fb);});});};exports[_0x7b12('0x44')]=function(_0x399748,_0x4e7637,_0x1eeb7d){_0x399748[_0x7b12('0x44')]=!![];return _0x1eeb7d();};exports[_0x7b12('0x45')]=function signToken(_0x2bec65){return signJwt(_0x2bec65);};exports[_0x7b12('0x46')]=function(_0x2e7dd8,_0x50f85f){if(!_0x2e7dd8[_0x7b12('0x35')]){return _0x50f85f['status'](0x194)[_0x7b12('0x34')]({'message':_0x7b12('0x47')});}var _0x115963={'payload':{'id':_0x2e7dd8[_0x7b12('0x35')]['id'],'role':_0x2e7dd8[_0x7b12('0x35')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x115963)[_0x7b12('0x25')](function(_0xe2d8fd){_0x50f85f[_0x7b12('0x48')]('motion.token',_0xe2d8fd);_0x50f85f[_0x7b12('0x49')]('/dashboards/general');})[_0x7b12('0x2b')](function(_0xee1c89){return _0x50f85f[_0x7b12('0x26')](0x1f4)[_0x7b12('0x4a')](_0xee1c89);});};exports[_0x7b12('0x4b')]=function(_0x244c45){if(_[_0x7b12('0x4c')](_0x244c45[_0x7b12('0x4d')])||_['isNil'](_0x244c45[_0x7b12('0x4e')])){return null;}else{return createJwt(_0x244c45);}};exports[_0x7b12('0x4f')]=function(_0x51adf6){_0x51adf6[_0x7b12('0x4d')]=generateNonce();_0x51adf6['apiKeyIat']=generateIssuedAt();return createJwt(_0x51adf6);};exports['regenerateApiKey']=function(_0x31ea6b,_0x217a35){var _0x25996a=_0x31ea6b['query'][_0x7b12('0x39')];if(_0x25996a){var _0x447aa9={'nonce':_0x217a35['apiKeyNonce'],'iat':_0x217a35['apiKeyIat'],'audience':hardwareConf[_0x7b12('0x3a')](),'issuer':hardwareConf[_0x7b12('0x3a')]()};return verifyJwt(_0x25996a,_0x447aa9)['then'](function(){return generateApiKey(_0x217a35);});}else{throw{'message':_0x7b12('0x50')};}};function signJwt(_0x2e598f){var _0x1778e6=BPromise['promisify'](jwt[_0x7b12('0x51')],{'context':jwt});var _0x2eaca0=_0x2e598f[_0x7b12('0x52')]||config[_0x7b12('0x8')]['session'];return new BPromise(function(_0x391699,_0x1fb56a){_0x1778e6(_0x2e598f[_0x7b12('0x53')],_0x2eaca0,_0x2e598f[_0x7b12('0x54')])[_0x7b12('0x25')](function(_0x2c6156){_0x391699(_0x2c6156);})['catch'](function(_0x343c8e){_0x1fb56a(_0x343c8e);});});}function verifyJwt(_0x46ef34,_0x475622,_0x3c726a){var _0x113452=BPromise[_0x7b12('0x55')](jwt['verify'],{'context':jwt});var _0x2f372c=_0x3c726a||config['secrets']['session'];return new BPromise(function(_0x222a53,_0x2414e5){_0x113452(_0x46ef34,_0x2f372c,_0x475622)[_0x7b12('0x25')](function(_0x2c40c3){_0x222a53(_0x2c40c3);})['catch'](function(_0x4eb379){_0x2414e5(_0x4eb379);});});}function generateNonce(){return crypto[_0x7b12('0x56')](0x10)[_0x7b12('0x57')]('hex');}function generateIssuedAt(){return Math[_0x7b12('0x58')](Date[_0x7b12('0x59')]()/0x3e8)[_0x7b12('0x57')]();}function createJwt(_0x4f9657){var _0xf02155={'payload':{'iat':_0x4f9657['apiKeyIat'],'nonce':_0x4f9657[_0x7b12('0x4d')]},'options':{'algorithm':'HS512','subject':_0x4f9657['id'][_0x7b12('0x57')](),'issuer':hardwareConf[_0x7b12('0x3a')](),'audience':hardwareConf[_0x7b12('0x3a')]()}};return signJwt(_0xf02155)[_0x7b12('0x25')](function(_0x586568){return{'iat':_0x4f9657[_0x7b12('0x4e')],'nonce':_0x4f9657[_0x7b12('0x4d')],'token':_0x586568};});} \ No newline at end of file +var _0x9b21=['phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','use','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','authorization','headers','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','user','catch','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','setTokenCookie','cookie','redirect','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload','randomBytes','toString','hex','floor','now','HS512','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','bluebird','secrets','session','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording'];(function(_0x4737aa,_0x266f4b){var _0x275ab2=function(_0x2d4454){while(--_0x2d4454){_0x4737aa['push'](_0x4737aa['shift']());}};_0x275ab2(++_0x266f4b);}(_0x9b21,0x9d));var _0x19b2=function(_0x20fe72,_0x2665e1){_0x20fe72=_0x20fe72-0x0;var _0x370e09=_0x9b21[_0x20fe72];return _0x370e09;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x19b2('0x0'));var _=require(_0x19b2('0x1'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x19b2('0x2'));var compose=require(_0x19b2('0x3'));var basicAuth=require(_0x19b2('0x4'));var crypto=require('crypto');var BPromise=require(_0x19b2('0x5'));var validateJwt=expressJwt({'secret':config[_0x19b2('0x6')][_0x19b2('0x7')]});var userAttributes=['id',_0x19b2('0x8'),_0x19b2('0x9'),_0x19b2('0xa'),_0x19b2('0xb'),_0x19b2('0xc'),'userpic',_0x19b2('0xd'),_0x19b2('0xe'),_0x19b2('0xf'),_0x19b2('0x10'),_0x19b2('0x11'),_0x19b2('0x12'),_0x19b2('0x13'),'openchannelPause','pauseType',_0x19b2('0x14'),_0x19b2('0x15'),_0x19b2('0x16'),'crudPermissions',_0x19b2('0x17'),_0x19b2('0x18'),_0x19b2('0x19'),_0x19b2('0x1a'),_0x19b2('0x1b'),'phoneBarDnd',_0x19b2('0x1c'),_0x19b2('0x1d'),_0x19b2('0x1e'),_0x19b2('0x1f'),_0x19b2('0x20'),'phoneBarRemoteControl',_0x19b2('0x21'),_0x19b2('0x22'),_0x19b2('0x23'),'userProfileId'];exports[_0x19b2('0x24')]=function(){return this[_0x19b2('0x25')](!![])[_0x19b2('0x26')](function(_0x592d59,_0x108c70,_0x285b6d){if(_0x592d59['user']){_0x285b6d();}else{return db['ChatInteraction'][_0x19b2('0x27')]({'where':{'id':_0x592d59[_0x19b2('0x28')]['id']},'attributes':['id',_0x19b2('0x29'),_0x19b2('0x2a')],'raw':!![]})[_0x19b2('0x2b')](function(_0xaa219d){if(_0xaa219d&&_0xaa219d[_0x19b2('0x29')]){return _0x108c70['status'](_0xaa219d[_0x19b2('0x2a')]===_0x19b2('0x2c')?0x195:0x193)[_0x19b2('0x2d')]({'message':_0xaa219d['disposition']===_0x19b2('0x2c')?_0x19b2('0x2e'):_0x19b2('0x2f')});}else{_0x285b6d();}})['catch'](function(_0x3ea6bb){_0x285b6d(_0x3ea6bb);});}});};exports[_0x19b2('0x25')]=function isAuthenticated(_0x144a78){return compose()[_0x19b2('0x26')](function(_0x101f0c,_0x3f24e9,_0x2956af){if(_0x101f0c['headers'][_0x19b2('0x30')]){if(_['startsWith'](_0x101f0c[_0x19b2('0x31')][_0x19b2('0x30')],_0x19b2('0x32'))){var _0x3c4911=basicAuth(_0x101f0c);db[_0x19b2('0x33')][_0x19b2('0x34')]({'where':{'name':_0x3c4911[_0x19b2('0xa')]}})[_0x19b2('0x2b')](function(_0x27c39f){if(!_0x27c39f||!_0x27c39f[_0x19b2('0x35')](_0x3c4911[_0x19b2('0x36')])){return _0x3f24e9[_0x19b2('0x37')](0x191)[_0x19b2('0x2d')]({'message':_0x19b2('0x38')});}_0x101f0c[_0x19b2('0x39')]={'id':_0x27c39f['id']};_0x2956af();})[_0x19b2('0x3a')](function(_0x28d466){_0x2956af(_0x28d466);});}else if(_[_0x19b2('0x3b')](_0x101f0c[_0x19b2('0x31')][_0x19b2('0x30')],_0x19b2('0x3c'))){validateJwt(_0x101f0c,_0x3f24e9,_0x2956af);}else{if(_0x144a78){_0x2956af();}else{return _0x3f24e9[_0x19b2('0x37')](0x193)[_0x19b2('0x2d')]({'message':_0x19b2('0x3d')});}}}else if(_0x101f0c[_0x19b2('0x3e')][_0x19b2('0x3f')]){try{var _0x18be38={'audience':hardwareConf[_0x19b2('0x40')](),'issuer':hardwareConf[_0x19b2('0x40')]()};verifyJwt(_0x101f0c[_0x19b2('0x3e')][_0x19b2('0x3f')],_0x18be38)[_0x19b2('0x2b')](function(_0x21c82d){return db[_0x19b2('0x33')][_0x19b2('0x34')]({'where':{'id':_0x21c82d['sub']}})['then'](function(_0xf5ae99){if(!_0xf5ae99||!_['isEqual'](_0xf5ae99['apiKeyNonce'],_0x21c82d[_0x19b2('0x41')])){return _0x3f24e9['status'](0x191)[_0x19b2('0x2d')]({'message':_0x19b2('0x42')});}_0x101f0c[_0x19b2('0x39')]={'id':_0xf5ae99['id']};_0x2956af();});})['catch'](function(){return _0x3f24e9['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x3e4e74){_0x2956af(_0x3e4e74);}}else if(_0x144a78){_0x2956af();}else{return _0x3f24e9[_0x19b2('0x37')](0x193)[_0x19b2('0x2d')]({'message':_0x19b2('0x3d')});}})['use'](function(_0x27acc2,_0x1f5e04,_0x2231b7){if(_0x27acc2[_0x19b2('0x39')]){db[_0x19b2('0x33')][_0x19b2('0x34')]({'where':{'id':_0x27acc2[_0x19b2('0x39')]['id']},'attributes':userAttributes})[_0x19b2('0x2b')](function(_0x35ba27){if(!_0x35ba27){return _0x1f5e04[_0x19b2('0x37')](0x194)[_0x19b2('0x2d')]({'message':_0x19b2('0x43')});}_0x27acc2[_0x19b2('0x39')]=_0x35ba27;_0x2231b7();})[_0x19b2('0x3a')](function(_0x23525b){_0x2231b7(_0x23525b);});}else if(_0x144a78){_0x2231b7();}else{return _0x1f5e04[_0x19b2('0x37')](0x194)['json']({'message':_0x19b2('0x44')});}});};exports[_0x19b2('0x45')]=function canUpdate(){return compose()[_0x19b2('0x26')](function(_0x389f8d,_0x49df0f,_0x361e18){return require('../../config/license/util')[_0x19b2('0x46')]()[_0x19b2('0x2b')](function(_0x53a649){if(_0x53a649['update']){_0x361e18();}else{return _0x49df0f[_0x19b2('0x37')](0x193)[_0x19b2('0x2d')]({'message':_0x19b2('0x47')});}})[_0x19b2('0x3a')](function(_0xfc44d5){_0x361e18(_0xfc44d5);});});};exports[_0x19b2('0x48')]=function(_0x20a3af,_0x5f4a08,_0x4c04cf){_0x20a3af[_0x19b2('0x48')]=!![];return _0x4c04cf();};exports['signToken']=function signToken(_0x2a8e11){return signJwt(_0x2a8e11);};exports[_0x19b2('0x49')]=function(_0x738212,_0x53a5a0){if(!_0x738212[_0x19b2('0x39')]){return _0x53a5a0['status'](0x194)[_0x19b2('0x2d')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x324272={'payload':{'id':_0x738212['user']['id'],'role':_0x738212['user'][_0x19b2('0x8')]},'options':{'expiresIn':0x15180}};return signJwt(_0x324272)[_0x19b2('0x2b')](function(_0x547f55){_0x53a5a0[_0x19b2('0x4a')]('motion.token',_0x547f55);_0x53a5a0[_0x19b2('0x4b')]('/dashboards/general');})['catch'](function(_0x8a4aa1){return _0x53a5a0['status'](0x1f4)[_0x19b2('0x4c')](_0x8a4aa1);});};exports[_0x19b2('0x4d')]=function(_0xb0c134){if(_[_0x19b2('0x4e')](_0xb0c134[_0x19b2('0x4f')])||_['isNil'](_0xb0c134['apiKeyIat'])){return null;}else{return createJwt(_0xb0c134);}};exports[_0x19b2('0x50')]=function(_0x299a36){_0x299a36[_0x19b2('0x4f')]=generateNonce();_0x299a36['apiKeyIat']=generateIssuedAt();return createJwt(_0x299a36);};exports['regenerateApiKey']=function(_0x4d16bf,_0x18b6fb){var _0x55878c=_0x4d16bf[_0x19b2('0x3e')][_0x19b2('0x3f')];if(_0x55878c){var _0x20e5c7={'nonce':_0x18b6fb[_0x19b2('0x4f')],'iat':_0x18b6fb[_0x19b2('0x51')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x19b2('0x40')]()};return verifyJwt(_0x55878c,_0x20e5c7)[_0x19b2('0x2b')](function(){return generateApiKey(_0x18b6fb);});}else{throw{'message':_0x19b2('0x52')};}};function signJwt(_0x59bc1f){var _0x537f3b=BPromise[_0x19b2('0x53')](jwt[_0x19b2('0x54')],{'context':jwt});var _0x2ea4ba=_0x59bc1f[_0x19b2('0x55')]||config[_0x19b2('0x6')]['session'];return new BPromise(function(_0x4bd92e,_0x6b4310){_0x537f3b(_0x59bc1f[_0x19b2('0x56')],_0x2ea4ba,_0x59bc1f['options'])[_0x19b2('0x2b')](function(_0x16d5f2){_0x4bd92e(_0x16d5f2);})[_0x19b2('0x3a')](function(_0x29e2b3){_0x6b4310(_0x29e2b3);});});}function verifyJwt(_0x47fb7d,_0x372cf1,_0x3c3d5e){var _0x268f22=BPromise[_0x19b2('0x53')](jwt['verify'],{'context':jwt});var _0x16001a=_0x3c3d5e||config['secrets']['session'];return new BPromise(function(_0x33a778,_0x512c6b){_0x268f22(_0x47fb7d,_0x16001a,_0x372cf1)['then'](function(_0x1e31be){_0x33a778(_0x1e31be);})['catch'](function(_0x2605ff){_0x512c6b(_0x2605ff);});});}function generateNonce(){return crypto[_0x19b2('0x57')](0x10)[_0x19b2('0x58')](_0x19b2('0x59'));}function generateIssuedAt(){return Math[_0x19b2('0x5a')](Date[_0x19b2('0x5b')]()/0x3e8)[_0x19b2('0x58')]();}function createJwt(_0x30aa1e){var _0x287a7d={'payload':{'iat':_0x30aa1e[_0x19b2('0x51')],'nonce':_0x30aa1e[_0x19b2('0x4f')]},'options':{'algorithm':_0x19b2('0x5c'),'subject':_0x30aa1e['id'][_0x19b2('0x58')](),'issuer':hardwareConf[_0x19b2('0x40')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x287a7d)['then'](function(_0x6a1a24){return{'iat':_0x30aa1e['apiKeyIat'],'nonce':_0x30aa1e[_0x19b2('0x4f')],'token':_0x6a1a24};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index f9a2a77..39f7e47 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 _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x222b34,_0x42df5e){var _0x8cb53d=function(_0x156e48){while(--_0x156e48){_0x222b34['push'](_0x222b34['shift']());}};_0x8cb53d(++_0x42df5e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file +var _0xbaf0=['data','update','binary','write','end','decryptFile','createDecipher','final','close','unlink','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x0baf('0x0'));var defaultOptions={'algorithm':_0x0baf('0x1')};function combineOptions(_0x1e212d){var _0x263f79={};for(var _0x1688bc in defaultOptions){if(defaultOptions[_0x0baf('0x2')](_0x1688bc)){_0x263f79[_0x1688bc]=defaultOptions[_0x1688bc];}}if(_0x1e212d){for(var _0x5a3e42 in _0x1e212d){if(_0x1e212d[_0x0baf('0x2')](_0x5a3e42)){_0x263f79[_0x5a3e42]=_0x1e212d[_0x5a3e42];}}}return _0x263f79;}exports[_0x0baf('0x3')]=function(_0x2d3fa5,_0x39b8f3,_0xe4c3c4,_0x335e24){return new BPromise(function(_0x1a10b1,_0x2dcaac){_0x335e24=combineOptions(_0x335e24);var _0x1d0a0d=new Buffer(_0xe4c3c4);var _0x5f5030=fs[_0x0baf('0x4')](_0x2d3fa5);var _0x5f20aa=fs[_0x0baf('0x5')](_0x39b8f3);var _0x2c7442=crypto[_0x0baf('0x6')](_0x335e24[_0x0baf('0x7')],_0x1d0a0d);_0x5f5030['on'](_0x0baf('0x8'),function(_0xf4c8ac){var _0x41cead=new Buffer(_0x2c7442[_0x0baf('0x9')](_0xf4c8ac),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x41cead);});_0x5f5030['on'](_0x0baf('0xc'),function(){try{var _0x51d93c=new Buffer(_0x2c7442['final'](_0x0baf('0xa')),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x51d93c);_0x5f20aa[_0x0baf('0xc')]();_0x5f20aa['on']('close',function(){return _0x1a10b1(_0x39b8f3);});}catch(_0x2ab33e){fs['unlink'](_0x39b8f3);return _0x2dcaac(_0x2ab33e);}});});};exports[_0x0baf('0xd')]=function(_0x1f50c3,_0x7fbf67,_0x2bc381,_0xb8339e){return new BPromise(function(_0x469599,_0x4f80a8){_0xb8339e=combineOptions(_0xb8339e);var _0x4cd79d=new Buffer(_0x2bc381);var _0x2312c7=fs[_0x0baf('0x4')](_0x1f50c3);var _0x283408=fs[_0x0baf('0x5')](_0x7fbf67);var _0x2cf7da=crypto[_0x0baf('0xe')](_0xb8339e['algorithm'],_0x4cd79d);_0x2312c7['on'](_0x0baf('0x8'),function(_0xfbecec){var _0x1ef0e5=new Buffer(_0x2cf7da[_0x0baf('0x9')](_0xfbecec),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x1ef0e5);});_0x2312c7['on']('end',function(){try{var _0x5cff5d=new Buffer(_0x2cf7da[_0x0baf('0xf')](_0x0baf('0xa')),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x5cff5d);_0x283408[_0x0baf('0xc')]();_0x283408['on'](_0x0baf('0x10'),function(){return _0x469599(_0x7fbf67);});}catch(_0x210cd8){fs[_0x0baf('0x11')](_0x7fbf67);return _0x4f80a8(_0x210cd8);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 165b459..07c11de 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 _0xa9e0=['Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','split','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x52a03d&&_0x52a03d[_0x0a9e('0x14')]){var _0x48f32d=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284);if(_0x307b3e['split']){for(;_0x16033c;_0x519dfd+=_0xf81284,_0x48f32d=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x48f32d==0x0||_0x48f32d==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x1a')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1b')](path[_0x0a9e('0x1c')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1d')](path[_0x0a9e('0x1c')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1e')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x14')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,csv(_0x33161b));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1c')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1c')](_0x20f109,util[_0x0a9e('0xb')]('%s.%s',_0x588269,_0x0a9e('0x22')))},function(_0x468813,_0x2b1f27){});rimraf(path[_0x0a9e('0x1c')](_0x20f109,_0x588269),function(){});}})['then'](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x23'),EXTRACTED_REPORT_ID,_0x0a9e('0x24')));return analyticExtractedReport(_0x0a9e('0x25'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x22'):_0x0a9e('0x1f')):null);});})['catch'](function(_0x426950){logger['info'](util[_0x0a9e('0xb')](_0x0a9e('0x26'),EXTRACTED_REPORT_ID,_0x0a9e('0x24')),util[_0x0a9e('0x27')](_0x426950,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0a9e('0x28'));});}main(); \ No newline at end of file +var _0x4522=['Setting','find','split','splitSizeCsv','then','format','sequelize','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','mkdirSync','join','each','csv','writeFileSync','Completed','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4522,0x1a0));var _0x2452=function(_0x46b7b8,_0x1ec3ac){_0x46b7b8=_0x46b7b8-0x0;var _0x1dc692=_0x4522[_0x46b7b8];return _0x1dc692;};'use strict';var util=require('util');var path=require('path');var _=require(_0x2452('0x0'));var csv=require(_0x2452('0x1'));var fs=require('fs');var BPromise=require(_0x2452('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x2452('0x3'));var db=require(_0x2452('0x4'))['db'];var dbH=require(_0x2452('0x4'))[_0x2452('0x5')];var logger=require(_0x2452('0x6'))(_0x2452('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x2452('0x8')][0x2]);var QUERY=process[_0x2452('0x8')][0x3];var PATH=process[_0x2452('0x8')][0x4];function analyticExtractedReport(_0x149807,_0x3bc193){var _0x33b935={'status':_0x149807};var _0x24073f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bc193){_0x33b935[_0x2452('0x9')]=_0x3bc193;}return db[_0x2452('0xa')][_0x2452('0xb')](_0x33b935,_0x24073f);}function main(){var _0x5a38e0=0x1388;var _0x5dc630;logger[_0x2452('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2452('0xd')));return db[_0x2452('0xe')][_0x2452('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2452('0x10'),_0x2452('0x11')]})[_0x2452('0x12')](function(_0x2c1e0f){if(_0x2c1e0f){_0x5dc630=_0x2c1e0f;_0x5a38e0=_0x5dc630[_0x2452('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0x2452('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2452('0x14')]['QueryTypes'][_0x2452('0x15')]});})[_0x2452('0x12')](function(_0x5d0438){if(!_0x5d0438[0x0][_0x2452('0x16')]){return analyticExtractedReport('Empty');}var _0x3dd8cc=[];var _0x734b88=0x0;var _0x461d2b=!![];if(_0x5d0438&&_0x5d0438[_0x2452('0x17')]){var _0x4e1d20=_0x5d0438[0x0][_0x2452('0x16')]%(_0x734b88+_0x5a38e0);if(_0x5dc630[_0x2452('0x10')]){for(;_0x461d2b;_0x734b88+=_0x5a38e0,_0x4e1d20=_0x5d0438[0x0]['num']%(_0x734b88+_0x5a38e0)){if(_0x4e1d20==0x0||_0x4e1d20==_0x5d0438[0x0]['num']){_0x461d2b=![];}_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](util['format'](_0x2452('0x1a'),QUERY,_0x5a38e0,_0x734b88),{'type':dbH[_0x2452('0x14')][_0x2452('0x1b')][_0x2452('0x15')]}));}}else{_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](QUERY,{'type':dbH[_0x2452('0x14')]['QueryTypes']['SELECT']}));}}var _0x1f060d=path[_0x2452('0x1c')](PATH);var _0x4bb3ff=path[_0x2452('0x1d')](PATH,_0x2452('0x1e'));var _0x1d5720=_0x5dc630[_0x2452('0x10')]&&_0x3dd8cc[_0x2452('0x17')]>0x1;var _0x397f21=[];if(!fs[_0x2452('0x1f')](path['join'](_0x1f060d,_0x4bb3ff))&&_0x1d5720){fs[_0x2452('0x20')](path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff));}return BPromise[_0x2452('0x22')](_0x3dd8cc,function(_0x231410){_0x397f21[_0x2452('0x18')](_0x231410);})['then'](function(){for(var _0x48783a=0x0;_0x48783a<_0x397f21[_0x2452('0x17')];_0x48783a+=0x1){var _0x159ba1;var _0x46fcbb=_0x397f21[_0x48783a];if(_0x1d5720){_0x159ba1=path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff,util[_0x2452('0x13')]('%s%d.%s',_0x4bb3ff,_0x48783a,_0x2452('0x23')));}else{_0x159ba1=path[_0x2452('0x21')](_0x1f060d,util['format']('%s.%s',_0x4bb3ff,_0x2452('0x23')));}fs[_0x2452('0x24')](_0x159ba1,csv(_0x46fcbb));}})[_0x2452('0x12')](function(){if(_0x1d5720){zipdir(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),{'saveTo':path[_0x2452('0x21')](_0x1f060d,util[_0x2452('0x13')]('%s.%s',_0x4bb3ff,'zip'))},function(_0x46b611,_0x454e0a){});rimraf(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),function(){});}})['then'](function(){logger[_0x2452('0xc')](util[_0x2452('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2452('0xd')));return analyticExtractedReport(_0x2452('0x25'),_0x1d5720?util[_0x2452('0x13')](_0x2452('0x26'),_0x4bb3ff,_0x1d5720?_0x2452('0x27'):_0x2452('0x23')):null);});})[_0x2452('0x28')](function(_0x115e09){logger[_0x2452('0xc')](util[_0x2452('0x13')](_0x2452('0x29'),EXTRACTED_REPORT_ID,_0x2452('0xd')),util[_0x2452('0x2a')](_0x115e09,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 797d464..e55e7bc 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(_0x459b9c,_0xfd4ad8){var _0x43d1bd=function(_0x431917){while(--_0x431917){_0x459b9c['push'](_0x459b9c['shift']());}};_0x43d1bd(++_0xfd4ad8);}(_0xb10b,0x12a));var _0xbb10=function(_0x11e000,_0x12a8e5){_0x11e000=_0x11e000-0x0;var _0x110c27=_0xb10b[_0x11e000];return _0x110c27;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0xdd4337,_0x3673f9){var _0x231608=function(_0x3fa60){while(--_0x3fa60){_0xdd4337['push'](_0xdd4337['shift']());}};_0x231608(++_0x3673f9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5dcc07,_0x12dc38){_0x5dcc07=_0x5dcc07-0x0;var _0x47cc95=_0x5f2f[_0x5dcc07];return _0x47cc95;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0f1f981..a47d5b5 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 _0x79ca=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','split','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','binary','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','update','format','XLSX','find','splitSizeXlsx','then','sequelize','query'];(function(_0x176194,_0xb8c7cc){var _0xb65549=function(_0x5703c2){while(--_0x5703c2){_0x176194['push'](_0x176194['shift']());}};_0xb65549(++_0xb8c7cc);}(_0x79ca,0x9e));var _0xa79c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x79ca[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xa79c('0x0'));var path=require(_0xa79c('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xa79c('0x2'));var BPromise=require(_0xa79c('0x3'));var zipdir=require(_0xa79c('0x4'));var rimraf=require(_0xa79c('0x5'));var db=require(_0xa79c('0x6'))['db'];var dbH=require('../../mysqldb')[_0xa79c('0x7')];var logger=require('../../config/logger')(_0xa79c('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa79c('0x9')][0x4];function analyticExtractedReport(_0x7afb5d,_0x44c906){var _0x58e10a={'status':_0x7afb5d};var _0x3974c4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44c906){_0x58e10a['savename']=_0x44c906;}return db['AnalyticExtractedReport'][_0xa79c('0xa')](_0x58e10a,_0x3974c4);}function main(){var _0x2335a2=0x1388;var _0xf511a6;logger['info'](util[_0xa79c('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa79c('0xc')));return db['Setting'][_0xa79c('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa79c('0xe')]})['then'](function(_0x2eb2d2){if(_0x2eb2d2){_0xf511a6=_0x2eb2d2;_0x2335a2=_0xf511a6[_0xa79c('0xe')]||0x1388;}})[_0xa79c('0xf')](function(){return dbH[_0xa79c('0x10')][_0xa79c('0x11')](util[_0xa79c('0xb')](_0xa79c('0x12'),QUERY),{'type':dbH[_0xa79c('0x10')][_0xa79c('0x13')][_0xa79c('0x14')]});})[_0xa79c('0xf')](function(_0x34ade8){if(!_0x34ade8[0x0]['num']){return analyticExtractedReport('Empty');}var _0x3f46f2=[];var _0x51dc6f=0x0;var _0x5692f3=!![];if(_0xf511a6[_0xa79c('0x15')]){if(_0x34ade8&&_0x34ade8[_0xa79c('0x16')]){var _0x356c1a=_0x34ade8[0x0][_0xa79c('0x17')]%(_0x51dc6f+_0x2335a2);for(;_0x5692f3;_0x51dc6f+=_0x2335a2,_0x356c1a=_0x34ade8[0x0][_0xa79c('0x17')]%(_0x51dc6f+_0x2335a2)){if(_0x356c1a==0x0||_0x356c1a==_0x34ade8[0x0][_0xa79c('0x17')]){_0x5692f3=![];}_0x3f46f2[_0xa79c('0x18')](dbH['sequelize']['query'](util[_0xa79c('0xb')](_0xa79c('0x19'),QUERY,_0x2335a2,_0x51dc6f),{'type':dbH[_0xa79c('0x10')][_0xa79c('0x13')]['SELECT']}));}}}else{_0x3f46f2[_0xa79c('0x18')](dbH[_0xa79c('0x10')][_0xa79c('0x11')](QUERY,{'type':dbH[_0xa79c('0x10')][_0xa79c('0x13')][_0xa79c('0x14')]}));}var _0xf38f65=path[_0xa79c('0x1a')](PATH);var _0x3fba78=path[_0xa79c('0x1b')](PATH,_0xa79c('0x1c'));var _0x4055fd=_0xf511a6[_0xa79c('0x15')]&&_0x3f46f2[_0xa79c('0x16')]>0x1;var _0x754855=[];if(!fs[_0xa79c('0x1d')](path[_0xa79c('0x1e')](_0xf38f65,_0x3fba78))&&_0x4055fd){fs[_0xa79c('0x1f')](path[_0xa79c('0x1e')](_0xf38f65,_0x3fba78));}return BPromise['each'](_0x3f46f2,function(_0x2d3065){_0x754855[_0xa79c('0x18')](_0x2d3065);})[_0xa79c('0xf')](function(){for(var _0x528bfa=0x0;_0x528bfa<_0x754855[_0xa79c('0x16')];_0x528bfa+=0x1){var _0x2827eb;var _0x21a296=_0x754855[_0x528bfa];if(_0x4055fd){_0x2827eb=path['join'](_0xf38f65,_0x3fba78,util['format'](_0xa79c('0x20'),_0x3fba78,_0x528bfa,'xlsx'));}else{_0x2827eb=path[_0xa79c('0x1e')](_0xf38f65,util[_0xa79c('0xb')]('%s.%s',_0x3fba78,_0xa79c('0x21')));}fs['writeFileSync'](_0x2827eb,json2xls(_0x21a296),_0xa79c('0x22'));}})[_0xa79c('0xf')](function(){if(_0x4055fd){zipdir(path[_0xa79c('0x1e')](_0xf38f65,_0x3fba78),{'saveTo':path['join'](_0xf38f65,util[_0xa79c('0xb')](_0xa79c('0x23'),_0x3fba78,_0xa79c('0x24')))},function(_0x257d58,_0x5de933){});rimraf(path[_0xa79c('0x1e')](_0xf38f65,_0x3fba78),function(){});}})[_0xa79c('0xf')](function(){logger[_0xa79c('0x25')](util[_0xa79c('0xb')](_0xa79c('0x26'),EXTRACTED_REPORT_ID,_0xa79c('0xc')));return analyticExtractedReport(_0xa79c('0x27'),_0x4055fd?util[_0xa79c('0xb')](_0xa79c('0x23'),_0x3fba78,_0x4055fd?_0xa79c('0x24'):'xlsx'):null);});})[_0xa79c('0x28')](function(_0x5d9436){logger[_0xa79c('0x25')](util[_0xa79c('0xb')](_0xa79c('0x29'),EXTRACTED_REPORT_ID,_0xa79c('0xc')),util[_0xa79c('0x2a')](_0x5d9436,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa79c('0x2b'));});}main(); \ No newline at end of file +var _0x8084=['then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx'];(function(_0x56e891,_0x1e8de0){var _0x4460cf=function(_0x22c423){while(--_0x22c423){_0x56e891['push'](_0x56e891['shift']());}};_0x4460cf(++_0x1e8de0);}(_0x8084,0x13b));var _0x4808=function(_0x38908c,_0xcdfb79){_0x38908c=_0x38908c-0x0;var _0x1f3eaa=_0x8084[_0x38908c];return _0x1f3eaa;};'use strict';var util=require(_0x4808('0x0'));var path=require(_0x4808('0x1'));var _=require(_0x4808('0x2'));var fs=require('fs');var json2xls=require(_0x4808('0x3'));var BPromise=require(_0x4808('0x4'));var zipdir=require(_0x4808('0x5'));var rimraf=require(_0x4808('0x6'));var db=require(_0x4808('0x7'))['db'];var dbH=require(_0x4808('0x7'))[_0x4808('0x8')];var logger=require(_0x4808('0x9'))(_0x4808('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4808('0xb')][0x2]);var QUERY=process[_0x4808('0xb')][0x3];var PATH=process[_0x4808('0xb')][0x4];function analyticExtractedReport(_0x477ddd,_0x4bc3c9){var _0x295cee={'status':_0x477ddd};var _0x57bb0e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4bc3c9){_0x295cee[_0x4808('0xc')]=_0x4bc3c9;}return db['AnalyticExtractedReport'][_0x4808('0xd')](_0x295cee,_0x57bb0e);}function main(){var _0x193e67=0x1388;var _0x4428d4;logger[_0x4808('0xe')](util['format'](_0x4808('0xf'),EXTRACTED_REPORT_ID,_0x4808('0x10')));return db[_0x4808('0x11')][_0x4808('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4808('0x13'),_0x4808('0x14')]})[_0x4808('0x15')](function(_0x29a0b0){if(_0x29a0b0){_0x4428d4=_0x29a0b0;_0x193e67=_0x4428d4[_0x4808('0x14')]||0x1388;}})[_0x4808('0x15')](function(){return dbH[_0x4808('0x16')]['query'](util[_0x4808('0x17')](_0x4808('0x18'),QUERY),{'type':dbH['sequelize'][_0x4808('0x19')]['SELECT']});})['then'](function(_0x37fe93){if(!_0x37fe93[0x0][_0x4808('0x1a')]){return analyticExtractedReport(_0x4808('0x1b'));}var _0x5eae59=[];var _0xe3b4ea=0x0;var _0x4221b1=!![];if(_0x4428d4[_0x4808('0x13')]){if(_0x37fe93&&_0x37fe93[_0x4808('0x1c')]){var _0x27b85d=_0x37fe93[0x0]['num']%(_0xe3b4ea+_0x193e67);for(;_0x4221b1;_0xe3b4ea+=_0x193e67,_0x27b85d=_0x37fe93[0x0][_0x4808('0x1a')]%(_0xe3b4ea+_0x193e67)){if(_0x27b85d==0x0||_0x27b85d==_0x37fe93[0x0]['num']){_0x4221b1=![];}_0x5eae59[_0x4808('0x1d')](dbH[_0x4808('0x16')][_0x4808('0x1e')](util[_0x4808('0x17')](_0x4808('0x1f'),QUERY,_0x193e67,_0xe3b4ea),{'type':dbH['sequelize'][_0x4808('0x19')][_0x4808('0x20')]}));}}}else{_0x5eae59['push'](dbH[_0x4808('0x16')][_0x4808('0x1e')](QUERY,{'type':dbH[_0x4808('0x16')][_0x4808('0x19')][_0x4808('0x20')]}));}var _0x371333=path[_0x4808('0x21')](PATH);var _0x244e5a=path[_0x4808('0x22')](PATH,_0x4808('0x23'));var _0x3cfb7f=_0x4428d4['split']&&_0x5eae59['length']>0x1;var _0x31e4f4=[];if(!fs[_0x4808('0x24')](path[_0x4808('0x25')](_0x371333,_0x244e5a))&&_0x3cfb7f){fs['mkdirSync'](path['join'](_0x371333,_0x244e5a));}return BPromise['each'](_0x5eae59,function(_0x1b1199){_0x31e4f4[_0x4808('0x1d')](_0x1b1199);})['then'](function(){for(var _0x2c55f1=0x0;_0x2c55f1<_0x31e4f4['length'];_0x2c55f1+=0x1){var _0x2597c6;var _0x153067=_0x31e4f4[_0x2c55f1];if(_0x3cfb7f){_0x2597c6=path[_0x4808('0x25')](_0x371333,_0x244e5a,util[_0x4808('0x17')](_0x4808('0x26'),_0x244e5a,_0x2c55f1,'xlsx'));}else{_0x2597c6=path[_0x4808('0x25')](_0x371333,util[_0x4808('0x17')]('%s.%s',_0x244e5a,_0x4808('0x27')));}fs[_0x4808('0x28')](_0x2597c6,json2xls(_0x153067),_0x4808('0x29'));}})[_0x4808('0x15')](function(){if(_0x3cfb7f){zipdir(path[_0x4808('0x25')](_0x371333,_0x244e5a),{'saveTo':path[_0x4808('0x25')](_0x371333,util[_0x4808('0x17')](_0x4808('0x2a'),_0x244e5a,_0x4808('0x2b')))},function(_0x1c540e,_0x560594){});rimraf(path[_0x4808('0x25')](_0x371333,_0x244e5a),function(){});}})[_0x4808('0x15')](function(){logger[_0x4808('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x4808('0x2c'),_0x3cfb7f?util[_0x4808('0x17')](_0x4808('0x2a'),_0x244e5a,_0x3cfb7f?'zip':'xlsx'):null);});})[_0x4808('0x2d')](function(_0x317023){logger[_0x4808('0xe')](util[_0x4808('0x17')](_0x4808('0x2e'),EXTRACTED_REPORT_ID,_0x4808('0x10')),util[_0x4808('0x2f')](_0x317023,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index bbbb719..3b8023a 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 _0xbe5e=['extension','find','exten','Set','type','context','VoiceExtensionId','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN}','push','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','length','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','IntervalId','VoiceExtension','uniq','map','filter','groupBy','playback','hasOwnProperty','priority'];(function(_0x24bde7,_0x3f8438){var _0x292aaa=function(_0x103724){while(--_0x103724){_0x24bde7['push'](_0x24bde7['shift']());}};_0x292aaa(++_0x3f8438);}(_0xbe5e,0x81));var _0xebe5=function(_0xe4700f,_0x1b782e){_0xe4700f=_0xe4700f-0x0;var _0x3fce7a=_0xbe5e[_0xe4700f];return _0x3fce7a;};'use strict';var _=require(_0xebe5('0x0'));var util=require(_0xebe5('0x1'));function rewrite(_0x5d46f7,_0x3060a7){var _0x2be430=this;return _0x5d46f7[_0xebe5('0x2')][_0xebe5('0x3')][_0xebe5('0x4')]({'raw':!![]})[_0xebe5('0x5')](function(_0x1e3335){_0x2be430['intervals']=_0x1e3335;return _0x5d46f7[_0xebe5('0x2')]['VoiceExtension'][_0xebe5('0x4')]({'where':{'IntervalId':_0x3060a7[_0xebe5('0x6')]},'raw':!![]});})[_0xebe5('0x5')](function(_0x73d4df){return _0x5d46f7[_0xebe5('0x2')][_0xebe5('0x7')][_0xebe5('0x4')]({'where':{'exten':{'$in':_[_0xebe5('0x8')](_[_0xebe5('0x9')](_0x73d4df,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xebe5('0x5')](function(_0x16c715){var _0x5882ff=_[_0xebe5('0xa')](_0x16c715,{'priority':'1'});var _0x1e8eec=_['filter'](_0x16c715,{'isApp':0x1});var _0x45c3b4=_[_0xebe5('0xb')](_0x1e8eec,'exten');var _0x594b3c=['queue',_0xebe5('0xc')];var _0x219bf0=[];var _0x560491=[];for(var _0x396b16 in _0x45c3b4){if(_0x45c3b4[_0xebe5('0xd')](_0x396b16)){_0x2be430[_0xebe5('0xe')]=0x2;_0x2be430['extensions']=[];_0x2be430[_0xebe5('0xf')]=_[_0xebe5('0x10')](_0x5882ff,{'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')]});_0x2be430['extensions']['push']({'type':_0x45c3b4[_0x396b16][0x0]['type'],'app':_0xebe5('0x12'),'appdata':util['format']('CDR(type)=%s',_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')]),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});if(_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')]===_0xebe5('0x16')){if(_0x2be430['extension']){_0x2be430[_0xebe5('0x17')]['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x18')+(_0x2be430[_0xebe5('0xf')][_0xebe5('0x19')]?'${EXTEN:'+_0x2be430['extension'][_0xebe5('0x19')]+'}':_0xebe5('0x1a')),'context':_0x45c3b4[_0x396b16][0x0]['context'],'exten':_0x45c3b4[_0x396b16][0x0]['exten'],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});}_0x2be430[_0xebe5('0x17')][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':'Set','appdata':_0xebe5('0x1c')+_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')],'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});var _0x485386=_0x2be430[_0xebe5('0xe')]++;_0x2be430[_0xebe5('0x17')][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x1d'),'appdata':_0xebe5('0x1e')+(_0x485386+0x2)+_0xebe5('0x1f')+(_0x485386+0x1)+')','context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0]['exten'],'priority':_0x485386,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});if(_0x2be430[_0xebe5('0xf')]){_0x2be430['extensions'][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':'Set','appdata':_0x2be430['extension'][_0xebe5('0x19')]?'CDR(prefix)=${EXTEN:0:'+_0x2be430[_0xebe5('0xf')][_0xebe5('0x19')]+'}':_0xebe5('0x20'),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});}_0x2be430[_0xebe5('0x17')]['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x21')+_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')],'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});if(_0x2be430[_0xebe5('0xf')]&&_0x2be430[_0xebe5('0xf')][_0xebe5('0xd')]('recordingFormat')&&_0x2be430['extension'][_0xebe5('0x22')]!==_0xebe5('0x23')){_0x2be430[_0xebe5('0x17')]['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0]['exten'],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});_0x2be430['extensions'][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0]['type'],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x24')+_0x2be430[_0xebe5('0xf')][_0xebe5('0x22')]||_0xebe5('0x25'),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});}}_0x2be430[_0xebe5('0x17')][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x26'),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430[_0xebe5('0xe')]++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});_0x2be430[_0xebe5('0x17')][_0xebe5('0x1b')]({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430['priority']++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});_0x2be430[_0xebe5('0x17')]['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x27'),'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'priority':_0x2be430['priority']++,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});for(var _0x17303b=0x0,_0x5a2720=0x0;_0x17303b<_0x45c3b4[_0x396b16]['length'];_0x17303b+=0x1,_0x5a2720=0x0){var _0x468604=_0x45c3b4[_0x396b16][_0x17303b];if(_0x468604[_0xebe5('0x13')]){_0x468604[_0xebe5('0x13')]=_0x468604[_0xebe5('0x13')][_0xebe5('0x28')]();}var _0x37e8f4=[];var _0x307488=[];delete _0x468604['id'];delete _0x468604[_0xebe5('0x29')];delete _0x468604[_0xebe5('0x2a')];var _0x4b04c6=_0x468604[_0xebe5('0x2b')]!==_0xebe5('0x2c')?[_0x468604[_0xebe5('0x2b')]]:_0x468604[_0xebe5('0x6')]?_[_0xebe5('0x9')](_[_0xebe5('0xa')](_0x2be430[_0xebe5('0x2d')],{'IntervalId':_0x468604[_0xebe5('0x6')]}),_0xebe5('0x2b')):[];if(_0x468604['hasOwnProperty']('tag')){if(_0x468604[_0xebe5('0x2e')]&&_0x468604['tag']!=='--'){_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x2f')+_0x468604[_0xebe5('0x2e')],'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430['priority']+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});}}if(_0x468604[_0xebe5('0x13')]===_0xebe5('0x16')&&_0x468604[_0xebe5('0xd')](_0xebe5('0x31'))){if(_0x468604['callerID']){_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x1d'),'appdata':_0xebe5('0x32')+_0x468604['callerID']+')','context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430['priority']+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});}else{_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x1d'),'appdata':_0xebe5('0x33'),'context':_0x468604['context'],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430[_0xebe5('0xe')]+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});}}if(_0x468604['hasOwnProperty'](_0xebe5('0x34'))){if(_0x594b3c[_0xebe5('0x35')](_0x468604[_0xebe5('0x36')][_0xebe5('0x28')]())>=0x0&&_0x468604[_0xebe5('0x37')]!==_0xebe5('0x38')){if(_0x468604['answer']){_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':'ExecIf','appdata':_0xebe5('0x39'),'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6['length']+_0x2be430[_0xebe5('0xe')]+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});_0x37e8f4['push']({'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x12'),'appdata':_0xebe5('0x3a'),'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430[_0xebe5('0xe')]+_0x5a2720++,'VoiceExtensionId':_0x468604[_0xebe5('0x15')]});}else{_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':'ExecIf','appdata':_0xebe5('0x3b'),'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430[_0xebe5('0xe')]+_0x5a2720++,'VoiceExtensionId':_0x468604['VoiceExtensionId']});_0x37e8f4[_0xebe5('0x1b')]({'type':_0x468604[_0xebe5('0x13')],'app':'Set','appdata':_0xebe5('0x3c'),'context':_0x468604[_0xebe5('0x14')],'exten':_0x468604[_0xebe5('0x11')],'priority':_0x4b04c6[_0xebe5('0x30')]+_0x2be430['priority']+_0x5a2720++,'VoiceExtensionId':_0x468604['VoiceExtensionId']});}}}for(var _0x6215c9=0x0;_0x6215c9<_0x4b04c6[_0xebe5('0x30')];_0x6215c9+=0x1){var _0x2ec838=_0x2be430[_0xebe5('0xe')]+_0x4b04c6[_0xebe5('0x30')];var _0x1162a7=_0x6215c9===_0x4b04c6[_0xebe5('0x30')]-0x1?_0x2be430[_0xebe5('0xe')]+_0x37e8f4[_0xebe5('0x30')]+_0x307488[_0xebe5('0x30')]+0x2:_0x2be430[_0xebe5('0xe')]+_0x6215c9+0x1;_0x37e8f4[_0xebe5('0x3d')](_0x6215c9,0x0,{'type':_0x468604[_0xebe5('0x13')],'app':_0xebe5('0x3e'),'appdata':_0x4b04c6[_0x6215c9]+'?'+_0x468604['context']+_0xebe5('0x3f')+_0x2ec838+':'+_0x468604[_0xebe5('0x14')]+_0xebe5('0x3f')+_0x1162a7,'exten':_0x468604[_0xebe5('0x11')],'context':_0x468604[_0xebe5('0x14')],'priority':_0x2be430[_0xebe5('0xe')]+_0x6215c9,'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]});}_0x468604[_0xebe5('0xe')]=_0x37e8f4[_0xebe5('0x30')]?_[_0xebe5('0x40')](_0x37e8f4)[_0xebe5('0xe')]+0x1:_0x2be430[_0xebe5('0xe')];_0x2be430[_0xebe5('0xe')]=(_0x307488[_0xebe5('0x30')]?_[_0xebe5('0x40')](_0x307488)[_0xebe5('0xe')]:_0x468604[_0xebe5('0xe')])+0x1;_0x2be430[_0xebe5('0x17')]=_[_0xebe5('0x41')](_0x2be430[_0xebe5('0x17')],_0x37e8f4,[_0x468604],_0x307488);}_0x2be430['extensions']['push']({'type':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x13')],'app':_0xebe5('0x42'),'exten':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x11')],'context':_0x45c3b4[_0x396b16][0x0][_0xebe5('0x14')],'priority':_0x2be430[_0xebe5('0xe')],'VoiceExtensionId':_0x45c3b4[_0x396b16][0x0]['VoiceExtensionId']});_0x219bf0['push'](_0x45c3b4[_0x396b16][0x0][_0xebe5('0x15')]);_0x560491=_[_0xebe5('0x41')](_0x560491,_0x2be430[_0xebe5('0x17')]);}}return _0x5d46f7[_0xebe5('0x43')](function(_0x5a1ded){return _0x5d46f7[_0xebe5('0x2')][_0xebe5('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x219bf0}},'transaction':_0x5a1ded})['then'](function(_0x15dafd){return _0x5d46f7['models'][_0xebe5('0x7')][_0xebe5('0x44')](_[_0xebe5('0x45')](_0x560491,_0xebe5('0xe')),{'transaction':_0x5a1ded});});});})[_0xebe5('0x46')](function(_0x3dea29){console['error'](_0x3dea29);});}exports[_0xebe5('0x47')]=rewrite; \ No newline at end of file +var _0x4ee4=['XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','format','CDR(type)=%s','type','context','outbound','Set','cutdigits','${EXTEN:','VoiceExtensionId','push','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','createdAt','interval','*,*,*,*','map','tag','CDR(tag)=','hasOwnProperty','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)','indexOf','app','toLowerCase','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x2696e3,_0x230c4d){var _0x533b98=function(_0x348f07){while(--_0x348f07){_0x2696e3['push'](_0x2696e3['shift']());}};_0x533b98(++_0x230c4d);}(_0x4ee4,0x179));var _0x44ee=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x4ee4[_0x3da832];return _0xe602f2;};'use strict';var _=require(_0x44ee('0x0'));var util=require(_0x44ee('0x1'));function rewrite(_0x1a3f8f,_0x215fb6){var _0x4cdb1a=this;return _0x1a3f8f[_0x44ee('0x2')][_0x44ee('0x3')][_0x44ee('0x4')]({'raw':!![]})[_0x44ee('0x5')](function(_0x30a093){_0x4cdb1a[_0x44ee('0x6')]=_0x30a093;return _0x1a3f8f[_0x44ee('0x2')][_0x44ee('0x7')][_0x44ee('0x4')]({'where':{'IntervalId':_0x215fb6[_0x44ee('0x8')]},'raw':!![]});})[_0x44ee('0x5')](function(_0x12c056){return _0x1a3f8f[_0x44ee('0x2')][_0x44ee('0x7')][_0x44ee('0x4')]({'where':{'exten':{'$in':_[_0x44ee('0x9')](_['map'](_0x12c056,_0x44ee('0xa')))}},'order':[{'raw':_0x44ee('0xb')}],'raw':!![]});})[_0x44ee('0x5')](function(_0x6fd1a8){var _0x5abc82=_[_0x44ee('0xc')](_0x6fd1a8,{'priority':'1'});var _0x4c0cb3=_['filter'](_0x6fd1a8,{'isApp':0x1});var _0x55f049=_[_0x44ee('0xd')](_0x4c0cb3,'exten');var _0x54851b=[_0x44ee('0xe'),_0x44ee('0xf')];var _0x22e8bb=[];var _0x579c74=[];for(var _0x3ea3d9 in _0x55f049){if(_0x55f049['hasOwnProperty'](_0x3ea3d9)){_0x4cdb1a[_0x44ee('0x10')]=0x2;_0x4cdb1a[_0x44ee('0x11')]=[];_0x4cdb1a[_0x44ee('0x12')]=_[_0x44ee('0x13')](_0x5abc82,{'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')]});_0x4cdb1a[_0x44ee('0x11')]['push']({'type':_0x55f049[_0x3ea3d9][0x0]['type'],'app':'Set','appdata':util[_0x44ee('0x14')](_0x44ee('0x15'),_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')]),'context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'priority':_0x4cdb1a[_0x44ee('0x10')]++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0]['VoiceExtensionId']});if(_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')]===_0x44ee('0x18')){if(_0x4cdb1a[_0x44ee('0x12')]){_0x4cdb1a[_0x44ee('0x11')]['push']({'type':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')],'app':_0x44ee('0x19'),'appdata':'CDR(destination)='+(_0x4cdb1a[_0x44ee('0x12')][_0x44ee('0x1a')]?_0x44ee('0x1b')+_0x4cdb1a[_0x44ee('0x12')][_0x44ee('0x1a')]+'}':'${EXTEN}'),'context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0]['exten'],'priority':_0x4cdb1a['priority']++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});}_0x4cdb1a[_0x44ee('0x11')][_0x44ee('0x1d')]({'type':_0x55f049[_0x3ea3d9][0x0]['type'],'app':_0x44ee('0x19'),'appdata':_0x44ee('0x1e')+_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')],'context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0]['exten'],'priority':_0x4cdb1a[_0x44ee('0x10')]++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});var _0x452d63=_0x4cdb1a[_0x44ee('0x10')]++;_0x4cdb1a[_0x44ee('0x11')]['push']({'type':_0x55f049[_0x3ea3d9][0x0]['type'],'app':_0x44ee('0x1f'),'appdata':_0x44ee('0x20')+(_0x452d63+0x2)+_0x44ee('0x21')+(_0x452d63+0x1)+')','context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'priority':_0x452d63,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});if(_0x4cdb1a[_0x44ee('0x12')]){_0x4cdb1a[_0x44ee('0x11')][_0x44ee('0x1d')]({'type':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')],'app':_0x44ee('0x19'),'appdata':_0x4cdb1a['extension'][_0x44ee('0x1a')]?_0x44ee('0x22')+_0x4cdb1a['extension'][_0x44ee('0x1a')]+'}':_0x44ee('0x23'),'context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'priority':_0x4cdb1a['priority']++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0]['VoiceExtensionId']});}_0x4cdb1a['extensions'][_0x44ee('0x1d')]({'type':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')],'app':_0x44ee('0x19'),'appdata':_0x44ee('0x24')+_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')],'context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0]['exten'],'priority':_0x4cdb1a[_0x44ee('0x10')]++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});if(_0x4cdb1a[_0x44ee('0x12')]&&_0x4cdb1a[_0x44ee('0x12')]['hasOwnProperty'](_0x44ee('0x25'))&&_0x4cdb1a[_0x44ee('0x12')][_0x44ee('0x25')]!==_0x44ee('0x26')){_0x4cdb1a[_0x44ee('0x11')]['push']({'type':_0x55f049[_0x3ea3d9][0x0]['type'],'app':_0x44ee('0x19'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'priority':_0x4cdb1a['priority']++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});_0x4cdb1a[_0x44ee('0x11')][_0x44ee('0x1d')]({'type':_0x55f049[_0x3ea3d9][0x0]['type'],'app':_0x44ee('0x19'),'appdata':_0x44ee('0x27')+_0x4cdb1a[_0x44ee('0x12')][_0x44ee('0x25')]||_0x44ee('0x28'),'context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'priority':_0x4cdb1a['priority']++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0]['VoiceExtensionId']});}}_0x4cdb1a[_0x44ee('0x11')][_0x44ee('0x1d')]({'type':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')],'app':_0x44ee('0x19'),'appdata':_0x44ee('0x29'),'context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'priority':_0x4cdb1a[_0x44ee('0x10')]++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});_0x4cdb1a[_0x44ee('0x11')][_0x44ee('0x1d')]({'type':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')],'app':_0x44ee('0x19'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'priority':_0x4cdb1a[_0x44ee('0x10')]++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});_0x4cdb1a['extensions'][_0x44ee('0x1d')]({'type':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')],'app':_0x44ee('0x19'),'appdata':'MONITOR_OPTIONS=ab','context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'priority':_0x4cdb1a['priority']++,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});for(var _0x44e683=0x0,_0x493bad=0x0;_0x44e683<_0x55f049[_0x3ea3d9][_0x44ee('0x2a')];_0x44e683+=0x1,_0x493bad=0x0){var _0x1b1678=_0x55f049[_0x3ea3d9][_0x44e683];if(_0x1b1678[_0x44ee('0x16')]){_0x1b1678['type']=_0x1b1678[_0x44ee('0x16')]['toLowerCase']();}var _0x383600=[];var _0x3fa13c=[];delete _0x1b1678['id'];delete _0x1b1678[_0x44ee('0x2b')];delete _0x1b1678['updatedAt'];var _0xf6ef3a=_0x1b1678[_0x44ee('0x2c')]!==_0x44ee('0x2d')?[_0x1b1678['interval']]:_0x1b1678[_0x44ee('0x8')]?_[_0x44ee('0x2e')](_['filter'](_0x4cdb1a[_0x44ee('0x6')],{'IntervalId':_0x1b1678[_0x44ee('0x8')]}),'interval'):[];if(_0x1b1678['hasOwnProperty']('tag')){if(_0x1b1678[_0x44ee('0x2f')]&&_0x1b1678[_0x44ee('0x2f')]!=='--'){_0x383600[_0x44ee('0x1d')]({'type':_0x1b1678[_0x44ee('0x16')],'app':_0x44ee('0x19'),'appdata':_0x44ee('0x30')+_0x1b1678[_0x44ee('0x2f')],'context':_0x1b1678[_0x44ee('0x17')],'exten':_0x1b1678[_0x44ee('0xa')],'priority':_0xf6ef3a[_0x44ee('0x2a')]+_0x4cdb1a['priority']+_0x493bad++,'VoiceExtensionId':_0x1b1678[_0x44ee('0x1c')]});}}if(_0x1b1678[_0x44ee('0x16')]==='outbound'&&_0x1b1678[_0x44ee('0x31')](_0x44ee('0x32'))){if(_0x1b1678[_0x44ee('0x32')]){_0x383600['push']({'type':_0x1b1678['type'],'app':_0x44ee('0x1f'),'appdata':_0x44ee('0x33')+_0x1b1678[_0x44ee('0x32')]+')','context':_0x1b1678[_0x44ee('0x17')],'exten':_0x1b1678[_0x44ee('0xa')],'priority':_0xf6ef3a['length']+_0x4cdb1a[_0x44ee('0x10')]+_0x493bad++,'VoiceExtensionId':_0x1b1678['VoiceExtensionId']});}else{_0x383600[_0x44ee('0x1d')]({'type':_0x1b1678[_0x44ee('0x16')],'app':'ExecIf','appdata':_0x44ee('0x34'),'context':_0x1b1678[_0x44ee('0x17')],'exten':_0x1b1678[_0x44ee('0xa')],'priority':_0xf6ef3a[_0x44ee('0x2a')]+_0x4cdb1a[_0x44ee('0x10')]+_0x493bad++,'VoiceExtensionId':_0x1b1678[_0x44ee('0x1c')]});}}if(_0x1b1678[_0x44ee('0x31')]('answer')){if(_0x54851b[_0x44ee('0x35')](_0x1b1678[_0x44ee('0x36')][_0x44ee('0x37')]())>=0x0&&_0x1b1678[_0x44ee('0x38')]!=='custom'){if(_0x1b1678[_0x44ee('0x39')]){_0x383600[_0x44ee('0x1d')]({'type':_0x1b1678[_0x44ee('0x16')],'app':_0x44ee('0x1f'),'appdata':_0x44ee('0x3a'),'context':_0x1b1678[_0x44ee('0x17')],'exten':_0x1b1678[_0x44ee('0xa')],'priority':_0xf6ef3a['length']+_0x4cdb1a[_0x44ee('0x10')]+_0x493bad++,'VoiceExtensionId':_0x1b1678[_0x44ee('0x1c')]});_0x383600[_0x44ee('0x1d')]({'type':_0x1b1678[_0x44ee('0x16')],'app':'Set','appdata':_0x44ee('0x3b'),'context':_0x1b1678[_0x44ee('0x17')],'exten':_0x1b1678[_0x44ee('0xa')],'priority':_0xf6ef3a[_0x44ee('0x2a')]+_0x4cdb1a[_0x44ee('0x10')]+_0x493bad++,'VoiceExtensionId':_0x1b1678['VoiceExtensionId']});}else{_0x383600[_0x44ee('0x1d')]({'type':_0x1b1678[_0x44ee('0x16')],'app':_0x44ee('0x1f'),'appdata':_0x44ee('0x3c'),'context':_0x1b1678[_0x44ee('0x17')],'exten':_0x1b1678[_0x44ee('0xa')],'priority':_0xf6ef3a['length']+_0x4cdb1a[_0x44ee('0x10')]+_0x493bad++,'VoiceExtensionId':_0x1b1678[_0x44ee('0x1c')]});_0x383600['push']({'type':_0x1b1678[_0x44ee('0x16')],'app':'Set','appdata':_0x44ee('0x3d'),'context':_0x1b1678[_0x44ee('0x17')],'exten':_0x1b1678['exten'],'priority':_0xf6ef3a[_0x44ee('0x2a')]+_0x4cdb1a[_0x44ee('0x10')]+_0x493bad++,'VoiceExtensionId':_0x1b1678[_0x44ee('0x1c')]});}}}for(var _0xaad89a=0x0;_0xaad89a<_0xf6ef3a[_0x44ee('0x2a')];_0xaad89a+=0x1){var _0x2b57e7=_0x4cdb1a['priority']+_0xf6ef3a[_0x44ee('0x2a')];var _0x47f265=_0xaad89a===_0xf6ef3a[_0x44ee('0x2a')]-0x1?_0x4cdb1a[_0x44ee('0x10')]+_0x383600['length']+_0x3fa13c['length']+0x2:_0x4cdb1a[_0x44ee('0x10')]+_0xaad89a+0x1;_0x383600[_0x44ee('0x3e')](_0xaad89a,0x0,{'type':_0x1b1678[_0x44ee('0x16')],'app':_0x44ee('0x3f'),'appdata':_0xf6ef3a[_0xaad89a]+'?'+_0x1b1678[_0x44ee('0x17')]+_0x44ee('0x40')+_0x2b57e7+':'+_0x1b1678[_0x44ee('0x17')]+_0x44ee('0x40')+_0x47f265,'exten':_0x1b1678['exten'],'context':_0x1b1678[_0x44ee('0x17')],'priority':_0x4cdb1a[_0x44ee('0x10')]+_0xaad89a,'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0]['VoiceExtensionId']});}_0x1b1678[_0x44ee('0x10')]=_0x383600[_0x44ee('0x2a')]?_[_0x44ee('0x41')](_0x383600)['priority']+0x1:_0x4cdb1a[_0x44ee('0x10')];_0x4cdb1a[_0x44ee('0x10')]=(_0x3fa13c[_0x44ee('0x2a')]?_[_0x44ee('0x41')](_0x3fa13c)[_0x44ee('0x10')]:_0x1b1678[_0x44ee('0x10')])+0x1;_0x4cdb1a[_0x44ee('0x11')]=_['concat'](_0x4cdb1a[_0x44ee('0x11')],_0x383600,[_0x1b1678],_0x3fa13c);}_0x4cdb1a['extensions'][_0x44ee('0x1d')]({'type':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x16')],'app':_0x44ee('0x42'),'exten':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0xa')],'context':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x17')],'priority':_0x4cdb1a[_0x44ee('0x10')],'VoiceExtensionId':_0x55f049[_0x3ea3d9][0x0][_0x44ee('0x1c')]});_0x22e8bb[_0x44ee('0x1d')](_0x55f049[_0x3ea3d9][0x0]['VoiceExtensionId']);_0x579c74=_['concat'](_0x579c74,_0x4cdb1a[_0x44ee('0x11')]);}}return _0x1a3f8f[_0x44ee('0x43')](function(_0x1b3f2f){return _0x1a3f8f['models'][_0x44ee('0x7')][_0x44ee('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x22e8bb}},'transaction':_0x1b3f2f})['then'](function(_0x1a73f2){return _0x1a3f8f['models'][_0x44ee('0x7')][_0x44ee('0x45')](_[_0x44ee('0x46')](_0x579c74,_0x44ee('0x10')),{'transaction':_0x1b3f2f});});});})['catch'](function(_0xfb7fe2){console[_0x44ee('0x47')](_0xfb7fe2);});}exports[_0x44ee('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index da2946f..194edee 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x23eb37,_0x4df51a){var _0x1d25e7=function(_0x1ba202){while(--_0x1ba202){_0x23eb37['push'](_0x23eb37['shift']());}};_0x1d25e7(++_0x4df51a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +var _0x70e0=['insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','createdAt','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','catch','query','BlackLists','all','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','duplicate','Duplicate\x20Contact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect'];(function(_0x4809f1,_0x44933e){var _0x289ff9=function(_0x31c4b0){while(--_0x31c4b0){_0x4809f1['push'](_0x4809f1['shift']());}};_0x289ff9(++_0x44933e);}(_0x70e0,0x17b));var _0x070e=function(_0x5eae84,_0x1fa7aa){_0x5eae84=_0x5eae84-0x0;var _0x78a981=_0x70e0[_0x5eae84];return _0x78a981;};'use strict';var BPromise=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var _=require(_0x070e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var config=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('api');config[_0x070e('0x7')]=_['defaults'](config[_0x070e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x8'))[_0x070e('0x9')](socket);try{if(!process[_0x070e('0xa')][0x2]||process[_0x070e('0xa')][0x2]===_0x070e('0xb')||process[_0x070e('0xa')][0x2]===_0x070e('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x070e('0xa')][0x3]||process[_0x070e('0xa')][0x3]===_0x070e('0xb')||process[_0x070e('0xa')][0x3]===_0x070e('0xc')||!process[_0x070e('0xa')][0x4]||process[_0x070e('0xa')][0x4]===_0x070e('0xb')||process[_0x070e('0xa')][0x4]===_0x070e('0xc')){throw new Error(_0x070e('0xd'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x070e('0xe')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x070e('0xa')][0x5]===_0x070e('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x070e('0xf'));}var LISTID=process[_0x070e('0xa')][0x5];var COMPANYID=process[_0x070e('0xa')][0x6]&&process[_0x070e('0xa')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x070e('0xc')?process[_0x070e('0xa')][0x6]:null;var DUPLICATES=process[_0x070e('0xa')][0x7]&&process[_0x070e('0xa')][0x7]!==_0x070e('0xb')&&process['argv'][0x7]!==_0x070e('0xc')?process[_0x070e('0xa')][0x7]:null;if(!process[_0x070e('0xa')][0x8]||process[_0x070e('0xa')][0x8]===_0x070e('0xb')||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x070e('0xa')][0x8];}catch(_0x3004f0){logger[_0x070e('0x10')](_0x3004f0);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(_0x4be0d7,_0x5b184,_0x5dc5d2,_0xf8dd5d){var _0x3f6985={'message':_0x5b184};_0x3f6985[_0x4be0d7]=!![];if(_0x5dc5d2){_0x3f6985[_0x070e('0x11')]=_0x5dc5d2;}if(_0xf8dd5d){_0x3f6985[_0x070e('0x12')]=_0xf8dd5d;}return _0x3f6985;}function isEmail(_0x28a1c3){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))*$/[_0x070e('0x13')](_0x28a1c3);}function checkRow(_0xe405e,_0x164cdf,_0x595c7e){return new BPromise(function(_0x2f8055,_0x270061){if(_[_0x070e('0x14')](_0xe405e)){return _0x270061(handleCheckRowError('error',_0x070e('0x15'),null,_0x595c7e));}if(_0xe405e['errors']&&_0xe405e['errors'][_0x070e('0x16')]){var _0x25f6e=_[_0x070e('0x17')](_0xe405e[_0x070e('0x18')],_0x070e('0x19'))['join'](';');return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x25f6e,null,_0x595c7e));}var _0x219e48={};for(var _0x1d72d6 in FIELDS){if(FIELDS[_0x070e('0x1a')](_0x1d72d6)&&FIELDS[_0x1d72d6]){_0x219e48[_0x1d72d6]=_0xe405e[_0x070e('0x1b')][0x0][FIELDS[_0x1d72d6]]||_0xe405e[_0x070e('0x1b')][0x0]['\ufeff'+FIELDS[_0x1d72d6]];}}if(!_0x219e48[_0x070e('0x1c')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),'firstName\x20not\x20specified!',null,_0x595c7e));}if(!_0x219e48[_0x070e('0x1d')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x1e'),null,_0x595c7e));}if(_0x219e48['birthDate']){var _0x5c5f0d=moment(_0x219e48[_0x070e('0x1f')],_0x070e('0x20'));if(!_0x5c5f0d[_0x070e('0x21')]()){return _0x270061(handleCheckRowError('error',_0x070e('0x22'),null,_0x595c7e));}}if(_0x219e48[_0x070e('0x23')]){if(!isEmail(_0x219e48[_0x070e('0x23')])){return _0x270061(handleCheckRowError(_0x070e('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0x595c7e));}}_0x219e48['ListId']=LISTID;_0x219e48['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x164cdf){var _0xdf8945={};for(var _0x4e0a7d=0x0,_0x1dff97=DUPLICATES[_0x070e('0x16')];_0x4e0a7d<_0x1dff97;_0x4e0a7d+=0x1){_0xdf8945[DUPLICATES[_0x4e0a7d]]=_0x219e48[DUPLICATES[_0x4e0a7d]];}var _0x4f8130=_['find'](_0x164cdf,_0xdf8945);if(_0x4f8130){return _0x270061(handleCheckRowError(_0x070e('0x24'),_0x070e('0x25'),_0x4f8130,_0x595c7e));}}return db['CmContact']['create'](_0x219e48,{'raw':!![],'hooks':![],'fields':_[_0x070e('0x26')](_0x219e48)})[_0x070e('0x27')](function(_0x444d02){if(DUPLICATES&&DUPLICATES[_0x070e('0x16')]&&_0x164cdf){_0x164cdf[_0x070e('0x28')](_['pick'](_0x219e48,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x444d02['id'];return _0x2f8055();})['catch'](function(_0x24d17d){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x29')+(_0x24d17d[_0x070e('0x19')]||JSON[_0x070e('0x2a')](_0x24d17d)),null,_0x595c7e));});});}function checkHopper(){function _0x4deaf8(){return function(_0x22f3a9){logger[_0x070e('0x10')]('cmContact',_0x070e('0x2b'),util[_0x070e('0x2c')](_0x22f3a9,{'showHidden':![],'depth':null}));};}var _0x4ba6f0=function(_0x4d4ee8,_0x5ddbe9){var _0x363bff=squel[_0x070e('0x2d')]()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x5ddbe9,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone',_0x070e('0x1d'))[_0x070e('0x36')]('NOW()',_0x070e('0x31'))['field']('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x4d4ee8['id']['toString'](),_0x5ddbe9)[_0x070e('0x36')]('NOW()','createdAt')[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'))[_0x070e('0x3d')]('cm_hopper')[_0x070e('0x3a')](_0x5ddbe9+'\x20=\x20?',_0x4d4ee8['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x363bff;};var _0xff760c=function(_0x52fcea,_0x54285a){var _0x261a27=squel['insert']()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),'ListId',_0x54285a,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'),_0x070e('0x1d'))['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x52fcea['id'][_0x070e('0x37')](),_0x54285a)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))['where'](_0x070e('0x42'))['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()['field'](_0x070e('0x43'))[_0x070e('0x3d')](_0x070e('0x44'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]()))[_0x070e('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x070e('0x35')]()['field']('phone')[_0x070e('0x3d')](_0x070e('0x2f'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x261a27;};function _0x440fa1(_0x343785,_0x53bea1){var _0x477e69=squel['insert']()['into'](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x53bea1,_0x070e('0x3e'),_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone','phone')['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))['field'](LISTID[_0x070e('0x37')](),'ListId')[_0x070e('0x36')](_0x343785['id'][_0x070e('0x37')](),_0x53bea1)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')]('NOW()',_0x070e('0x34'))[_0x070e('0x3d')](_0x070e('0x39'))['where'](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where'](_0x070e('0x40'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x477e69;}function _0x1ae5cb(_0x1100d8,_0x122198){var _0x3cb9ee=squel[_0x070e('0x2d')]()['into'](_0x070e('0x46'))['fromQuery']([_0x070e('0x1d'),'ContactId',_0x070e('0x33'),_0x122198,_0x070e('0x3e'),'updatedAt'],squel[_0x070e('0x35')]()['field'](_0x070e('0x1d'),_0x070e('0x1d'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x1100d8['id'][_0x070e('0x37')](),_0x122198)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),'updatedAt')[_0x070e('0x3d')](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))['where'](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))[_0x070e('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x3cb9ee;}return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x070e('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x36373d){var _0x3a1ad2=[];if(_0x36373d){var _0x150bf6;for(var _0x2a20d4=0x0,_0x50ef9f;_0x2a20d4<_0x36373d[_0x070e('0x16')];_0x2a20d4+=0x1){_0x50ef9f=_0x36373d[_0x2a20d4][_0x070e('0x4b')]({'plain':!![]});switch(_0x50ef9f[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0xff760c(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case'onlyIfOpen':_0x3a1ad2[_0x070e('0x28')](db['sequelize'][_0x070e('0x51')](_0x4ba6f0(_0x50ef9f,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0x440fa1(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})['catch'](_0x4deaf8()));}}}return _0x3a1ad2;})['all']()[_0x070e('0x27')](function(){return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id'],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x332c8a){var _0x25b599=[];if(_0x332c8a){var _0x1d1f44;for(var _0x72077d=0x0,_0x25670e;_0x72077d<_0x332c8a[_0x070e('0x16')];_0x72077d+=0x1){_0x25670e=_0x332c8a[_0x72077d]['get']({'plain':!![]});_0x25b599[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x1ae5cb(_0x25670e,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x25b599;})[_0x070e('0x53')]();})[_0x070e('0x27')](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id',_0x070e('0x4c')],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x55'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x62800d){var _0x2084a1=[];if(_0x62800d){for(var _0x46ec49=0x0,_0x595e2e;_0x46ec49<_0x62800d['length'];_0x46ec49+=0x1){_0x595e2e=_0x62800d[_0x46ec49]['get']({'plain':!![]});switch(_0x595e2e[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0xff760c(_0x595e2e,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case _0x070e('0x57'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x4ba6f0(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x440fa1(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));}}}return _0x2084a1;})[_0x070e('0x53')]();})['then'](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0xf0aef8){var _0x4da906=[];if(_0xf0aef8){for(var _0x40d7e6=0x0,_0xe8c476;_0x40d7e6<_0xf0aef8[_0x070e('0x16')];_0x40d7e6+=0x1){_0xe8c476=_0xf0aef8[_0x40d7e6][_0x070e('0x4b')]({'plain':!![]});_0x4da906[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x1ae5cb(_0xe8c476,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x4da906;})[_0x070e('0x53')]();})[_0x070e('0x50')](function(_0x18c27a){logger['error'](_0x070e('0x58'),_0x070e('0x59'),_0x18c27a[_0x070e('0x19')]);});}var processPromises=function(_0x1b71dd){return BPromise[_0x070e('0x53')](promises)[_0x070e('0x27')](function(_0x5c4352){})['catch'](function(_0x4a8563){logger[_0x070e('0x10')](_0x070e('0x5a'),JSON[_0x070e('0x2a')](_0x4a8563));})[_0x070e('0x5b')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1b71dd){return _0x1b71dd[_0x070e('0x5d')]();}});};var endCsv=function(){return BPromise[_0x070e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x070e('0x27')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x070e('0x5f')](FILEPATH);}catch(_0x59e6e5){logger['error'](_0x070e('0x60'),JSON[_0x070e('0x2a')](_0x59e6e5));}finally{process['exit'](0x0);}});};process['on'](_0x070e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x070e('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x070e('0xe')](',');return db[_0x070e('0x62')][_0x070e('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x070e('0x27')](function(_0x341756){var _0x2a12a1=fs[_0x070e('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x070e('0x64')](_0x2a12a1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xdcc60a,_0x4e0f6e){total+=0x1;var _0x1306e6=total;promises[_0x070e('0x28')](checkRow(_0xdcc60a,_0x341756,_0x1306e6)[_0x070e('0x27')](function(){success+=0x1;})[_0x070e('0x50')](function(_0x3f2bb5){if(_0x3f2bb5[_0x070e('0x10')]){errors+=0x1;delete _0x3f2bb5[_0x070e('0x10')];}else if(_0x3f2bb5[_0x070e('0x24')]){duplicates+=0x1;delete _0x3f2bb5[_0x070e('0x24')];}rows[_0x070e('0x28')](_0x3f2bb5);}));if(total%0xc8===0x0){_0x4e0f6e[_0x070e('0x65')]();return processPromises(_0x4e0f6e);}},'complete':function(){return processPromises()['then'](function(){logger[_0x070e('0x66')](_0x070e('0x67'));endCsv();});},'error':function(_0x449337,_0xe50b1b){logger['info'](_0x070e('0x68'),JSON[_0x070e('0x2a')](_0x449337));endCsv();}});})[_0x070e('0x50')](function(_0x2bad43){logger[_0x070e('0x10')](_0x070e('0x69'),JSON['stringify'](_0x2bad43));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e94ad35..1cf0f96 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 _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x5cf175,_0x42be8c){var _0x467baa=function(_0x617e75){while(--_0x617e75){_0x5cf175['push'](_0x5cf175['shift']());}};_0x467baa(++_0x42be8c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));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'](_0x7995('0xe'));function isEmail(_0x3116fb){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))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x34fa84,_0x45f460){var _0xff0fe=function(_0x537cac){while(--_0x537cac){_0x34fa84['push'](_0x34fa84['shift']());}};_0xff0fe(++_0x45f460);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));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'](_0x7995('0xe'));function isEmail(_0x3116fb){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))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),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 5af7ad1..676eda6 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 _0xe4fb=['join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','push','all','then','catch','error','message','AdditionalPhones','split','filter','CmContactHasItem','findOne','update','updated','create','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','ContactId','ListId','createdAt','updatedAt','priority','select','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','into','fromQuery','fields','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','code','spread','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','parse','createReadStream','data','rows','errors','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','field','phone','from'];(function(_0x4778a9,_0x25fc7b){var _0x42ddb3=function(_0x4f72d6){while(--_0x4f72d6){_0x4778a9['push'](_0x4778a9['shift']());}};_0x42ddb3(++_0x25fc7b);}(_0xe4fb,0x1d8));var _0xbe4f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe4fb[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var path=require(_0xbe4f('0x0'));var _=require(_0xbe4f('0x1'));var Papa=require(_0xbe4f('0x2'));var util=require(_0xbe4f('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xbe4f('0x4'));var Redis=require(_0xbe4f('0x5'));var db=require(_0xbe4f('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xbe4f('0x7'))(_0xbe4f('0x8'));config['redis']=_[_0xbe4f('0x9')](config[_0xbe4f('0xa')],{'host':_0xbe4f('0xb'),'port':0x18eb});var socket=require(_0xbe4f('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xbe4f('0xd')](_0xbe4f('0xe'));var tempTableName='cm_contacts_temp_'+moment()[_0xbe4f('0xd')](_0xbe4f('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x1c8a81){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))*$/[_0xbe4f('0x10')](_0x1c8a81);}function selectNotIn(_0x104cab,_0x59ca9b,_0x2b6dd7,_0x25e3da,_0x5564e9){return squel['select']()[_0xbe4f('0x11')](_0xbe4f('0x12'))[_0xbe4f('0x13')](_0x25e3da)[_0xbe4f('0x14')](_0x59ca9b,null,_0x59ca9b+_0xbe4f('0x15')+_0x25e3da+'.'+_0x2b6dd7)[_0xbe4f('0x16')](_0x25e3da+'.'+_0x2b6dd7+_0xbe4f('0x17')+_0x104cab+'.'+_0x2b6dd7)[_0xbe4f('0x16')](_0x59ca9b+_0xbe4f('0x18')+_0x5564e9['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3fa4d8,_0x47ef7c){promisesAdditionalPhones=[];promisesContact=[];return db[_0xbe4f('0x19')][_0xbe4f('0x1a')](_0xbe4f('0x1b')+tempTableName)['spread'](function(_0x128ce3){if(_0x128ce3!==null){var _0x560bc2=[];for(var _0x20adc1=0x0;_0x20adc1<_0x128ce3[_0xbe4f('0x1c')];_0x20adc1++){var _0x129efb=_0x128ce3[_0x20adc1];if(!_[_0xbe4f('0x1d')](_0x129efb[_0xbe4f('0x12')])){if(!_['isNil'](_0x129efb['AdditionalPhones']))_0x560bc2[_0xbe4f('0x1e')](insertAdditionalPhones(_0x129efb));promisesContact[_0xbe4f('0x1e')]({'contact':_0x129efb});}}}Promise[_0xbe4f('0x1f')](_0x560bc2)[_0xbe4f('0x20')](function(){_0x3fa4d8({'val':0x1});});})[_0xbe4f('0x21')](function(_0x28def2){logger[_0xbe4f('0x22')](_0x28def2[_0xbe4f('0x23')]);});});}function insertAdditionalPhones(_0xbfd83e){return new Promise(function(_0x41d605,_0xaf2aa1){var _0x23446c=_0xbfd83e[_0xbe4f('0x24')];if(_['isNil'](_0x23446c))_0xaf2aa1({'val':0x0});else{var _0xe3adad=_0x23446c[_0xbe4f('0x25')](';');var _0x4609e2=[];orderBy=0x0;for(var _0x59df1e=0x0;_0x59df1e<_0xe3adad[_0xbe4f('0x1c')];_0x59df1e++){_0x4609e2[_0xbe4f('0x1e')](splitAdditionalPhone(_0xbfd83e['id'],_0xe3adad[_0x59df1e]));}Promise[_0xbe4f('0x1f')](_0x4609e2)['then'](function(){_0x41d605({'val':_0xe3adad[_0xbe4f('0x1c')]});});}});}function splitAdditionalPhone(_0x15dbca,_0x5c099a){return new Promise(function(_0x4cc633,_0x5660f0){var _0xe2bf31=_0x5c099a[_0xbe4f('0x25')](':');var _0x1b95dc=_0xe2bf31[0x0];var _0x43220a=_0xe2bf31[0x1];if(_0x43220a!==''){var _0x18699f=_0x43220a[_0xbe4f('0x25')]('|');var _0x37f40f=[];for(var _0x50f8e1=0x0;_0x50f8e1<_0x18699f[_0xbe4f('0x1c')];_0x50f8e1++){if(_0x18699f[_0x50f8e1]!==''){var _0x14fdda=_[_0xbe4f('0x26')](promisesAdditionalPhones,{'contactId':_0x15dbca,'phone':_0x18699f[_0x50f8e1]});if(_0x14fdda['length']==0x0){orderBy++;promisesAdditionalPhones[_0xbe4f('0x1e')]({'contactId':_0x15dbca,'contactTypeId':_0x1b95dc,'phone':_0x18699f[_0x50f8e1],'orderBy':orderBy});}}}_0x4cc633({'ok':0x1});}else _0x4cc633({'res':0x0});});}function createAdditionalPhone(_0x446d7c,_0x43334a,_0x2cd274,_0xd5d455){return new Promise(function(_0x154302,_0x3c09eb){return db[_0xbe4f('0x27')][_0xbe4f('0x28')]({'where':{'CmContactId':_0x446d7c,'item':_0x2cd274}})[_0xbe4f('0x20')](function(_0x17b89d){if(_0x17b89d){return db['CmContactHasItem'][_0xbe4f('0x29')]({'ItemTypeId':_0x43334a,'OrderBy':_0xd5d455},{'where':{'CmContactId':_0x446d7c,'item':_0x2cd274}})['then'](function(_0x404967){_0x154302({'res':_0xbe4f('0x2a')});});}else{return db['CmContactHasItem'][_0xbe4f('0x2b')]({'CmContactId':_0x446d7c,'item':_0x2cd274,'ItemTypeId':_0x43334a,'OrderBy':_0xd5d455,'ItemClass':'PHONE'})[_0xbe4f('0x20')](function(_0x10ee7a){_0x154302({'res':_0xbe4f('0x2c')});});}});});}function updateContact(_0x3d4f42){return new Promise(function(_0x1a3f37,_0xa028d2){var _0x46a401=_0x3d4f42['id'];delete _0x3d4f42['id'];return db['CmContact']['update'](_0x3d4f42,{'where':{'id':_0x46a401}})['then'](function(_0x37ab4a){updatedRows+=0x1;return db[_0xbe4f('0x2d')][_0xbe4f('0x29')]({'phone':_0x3d4f42[_0xbe4f('0x12')]},{'where':{'ContactId':_0x46a401}})[_0xbe4f('0x20')](function(_0x2efcef){_0x1a3f37({'ret':'OK'});});});});}function insertCmHopper(_0x7b0a58,_0x4bab84,_0x506a80,_0x5171f9,_0x2ebc05){var _0x53fa46=[_0xbe4f('0x2e'),_0xbe4f('0x2f'),_0xbe4f('0x30'),_0xbe4f('0x31'),_0x4bab84+'.'+_0x5171f9,_0xbe4f('0x32'),'cm_contacts.updatedAt',_0xbe4f('0x33'),_0xbe4f('0x34'),'\x22'+_0x2ebc05+'\x22'];return squel[_0xbe4f('0x35')]()['into'](_0xbe4f('0x36'))['fromQuery']([_0xbe4f('0x12'),'scheduledat',_0xbe4f('0x37'),_0xbe4f('0x38'),_0x5171f9,_0xbe4f('0x39'),_0xbe4f('0x3a'),_0xbe4f('0x3b'),'UserId','recallme'],squel[_0xbe4f('0x3c')]()['fields'](_0x53fa46)[_0xbe4f('0x13')](_0x4bab84)[_0xbe4f('0x14')]('cm_contacts',null,_0xbe4f('0x3d')+_0x4bab84+_0xbe4f('0x3e'))[_0xbe4f('0x14')](_0x506a80,null,_0x506a80+_0xbe4f('0x15')+_0x4bab84+'.'+_0x5171f9)['where'](_0x4bab84+_0xbe4f('0x3f'),_0x7b0a58)[_0xbe4f('0x16')](_0xbe4f('0x40'),NOW)['where'](_0xbe4f('0x41'),selectNotIn(_0x4bab84,_0x506a80,_0x5171f9,_0xbe4f('0x36'),[_0xbe4f('0x42'),_0xbe4f('0x43')]))[_0xbe4f('0x16')](_0xbe4f('0x41'),selectNotIn(_0x4bab84,_0x506a80,_0x5171f9,_0xbe4f('0x36'),['\x22always\x22'])))[_0xbe4f('0x44')]();}function insertCmHopperBlack(_0x269452,_0x3b2d04,_0x453196,_0x58f8f7){var _0x495096=[_0xbe4f('0x2e'),_0xbe4f('0x30'),_0xbe4f('0x31'),_0x3b2d04+'.'+_0x58f8f7,_0xbe4f('0x32'),_0xbe4f('0x45')];return squel[_0xbe4f('0x35')]()[_0xbe4f('0x46')]('cm_hopper_black')[_0xbe4f('0x47')]([_0xbe4f('0x12'),'ContactId',_0xbe4f('0x38'),_0x58f8f7,'createdAt','updatedAt'],squel[_0xbe4f('0x3c')]()[_0xbe4f('0x48')](_0x495096)['from'](_0x3b2d04)[_0xbe4f('0x14')]('cm_contacts',null,_0xbe4f('0x3d')+_0x3b2d04+'.CmListId')[_0xbe4f('0x14')](_0x453196,null,_0x453196+'.id\x20=\x20'+_0x3b2d04+'.'+_0x58f8f7)['where'](_0x3b2d04+_0xbe4f('0x3f'),_0x269452)[_0xbe4f('0x16')](_0xbe4f('0x40'),NOW)[_0xbe4f('0x16')](_0xbe4f('0x41'),squel[_0xbe4f('0x3c')]()[_0xbe4f('0x11')](_0xbe4f('0x12'))[_0xbe4f('0x13')](_0xbe4f('0x49'))[_0xbe4f('0x16')](_0xbe4f('0x4a'),_0x269452)['where'](_0x58f8f7+'\x20=\x20?',_0x3b2d04+'.'+_0x58f8f7)))[_0xbe4f('0x44')]();}function insertCmHopperAdditionalPhones(_0x5c6974){var _0x4a49cd=[_0xbe4f('0x4b'),_0xbe4f('0x4c'),_0xbe4f('0x4d'),_0xbe4f('0x4e'),_0xbe4f('0x4f')];return squel[_0xbe4f('0x35')]()[_0xbe4f('0x46')](_0xbe4f('0x50'))[_0xbe4f('0x47')]([_0xbe4f('0x51'),'phone',_0xbe4f('0x52'),_0xbe4f('0x39'),'updatedAt'],squel['select']()[_0xbe4f('0x48')](_0x4a49cd)[_0xbe4f('0x13')](_0xbe4f('0x36'))[_0xbe4f('0x14')](_0xbe4f('0x53'),null,_0xbe4f('0x54'))['join'](_0xbe4f('0x55'),null,_0xbe4f('0x56'))[_0xbe4f('0x16')](_0xbe4f('0x57'),_0x5c6974)[_0xbe4f('0x16')](_0xbe4f('0x40'),NOW))['toString']();}function insertCmContact(_0x2e3b22,_0x17c840,_0x2cce8e,_0x3320f8){var _0x97870f=_[_0xbe4f('0x58')](_[_0xbe4f('0x59')](_0x3320f8),[_0xbe4f('0x38'),'CompanyId',_0xbe4f('0x39'),_0xbe4f('0x3a')]);return squel[_0xbe4f('0x35')]()[_0xbe4f('0x46')](_0xbe4f('0x53'))[_0xbe4f('0x47')](_0x97870f,squel[_0xbe4f('0x3c')]()['fields'](_0x97870f)['from'](_0x17c840)['where']('('+_0x2cce8e[_0xbe4f('0x14')](',')+_0xbe4f('0x5a'),squel['select']()[_0xbe4f('0x48')](_0x2cce8e)[_0xbe4f('0x13')](_0xbe4f('0x53'))['where']('ListId\x20=\x20?',_0x2e3b22))[_0xbe4f('0x16')]('id\x20IN\x20?',squel['select']()[_0xbe4f('0x11')](_0xbe4f('0x5b'),_0xbe4f('0x5c'))['from'](_0x17c840)[_0xbe4f('0x5d')](_0x2cce8e['join'](','))))[_0xbe4f('0x44')]();}function handleStop(){logger[_0xbe4f('0x5e')](_0xbe4f('0x5f'));stopped=!![];}function handleUncaughtException(_0x1704fd){logger[_0xbe4f('0x22')](_0x1704fd[_0xbe4f('0x23')]);process[_0xbe4f('0x60')](0x1);}function handleError(_0x522457,_0x437428){stats['errors']['push']({'name':_0x437428[_0xbe4f('0x61')],'message':_0x437428[_0xbe4f('0x23')],'row':_0x522457});}function handleQuery(_0x129de8){logger['info'](_0x129de8);return db['sequelize'][_0xbe4f('0x1a')](_0x129de8)[_0xbe4f('0x62')](function(_0x24d545){results[_0xbe4f('0x1e')](_0x24d545);})[_0xbe4f('0x21')](function(_0x475a8e){logger[_0xbe4f('0x22')](_0x475a8e[_0xbe4f('0x23')]);});}function main(_0x498456,_0x32d9b8,_0x543ac3,_0x5ba99d){logger['info']('main',_0x498456,JSON[_0xbe4f('0x63')](_0x32d9b8));process[_0xbe4f('0x64')](_0xbe4f('0x65'));var _0x5e7c5f=_0x32d9b8['binding'];var _0x1d9906=_[_0xbe4f('0x66')](_0x5e7c5f);var _0x217905=_0x32d9b8[_0xbe4f('0x67')];var _0x4384b2=path[_0xbe4f('0x14')](config[_0xbe4f('0x68')],_0xbe4f('0x69'),_0x217905+_0xbe4f('0x6a'));logger[_0xbe4f('0x5e')](_0xbe4f('0x6b'),_0x32d9b8);db[_0xbe4f('0x6c')][_0xbe4f('0x6d')]({'raw':!![],'attributes':['id',_0xbe4f('0x6e')]})[_0xbe4f('0x20')](function(_0x9974b7){for(var _0x20a1c8=0x0;_0x20a1c8<_0x9974b7[_0xbe4f('0x1c')];_0x20a1c8++){if(_0x9974b7[_0x20a1c8][_0xbe4f('0x6e')]in _0x5e7c5f){contactItemTypes['push'](_0x9974b7[_0x20a1c8]);delete _0x1d9906[_0x9974b7[_0x20a1c8]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x1d9906[_0xbe4f('0x24')]='';var _0x5be69b=_[_0xbe4f('0x59')](_0x1d9906)[_0xbe4f('0x14')]();logger[_0xbe4f('0x5e')](_0xbe4f('0x6f'),_0x5be69b);fs['writeFileSync'](_0x4384b2,_0x5be69b+'\x0a');Papa[_0xbe4f('0x70')](fs[_0xbe4f('0x71')](_0x498456),{'header':!![],'skipEmptyLines':!![],'step':function(_0x49fc40,_0x26a007){try{for(var _0x5d7a76=0x0,_0x468258=[];_0x5d7a76<_0x49fc40[_0xbe4f('0x72')][_0xbe4f('0x1c')];_0x5d7a76++){stats[_0xbe4f('0x73')]+=0x1;if(_0x49fc40['errors'][_0x5d7a76]){handleError(_0x49fc40[_0xbe4f('0x72')][_0x5d7a76],_0x49fc40[_0xbe4f('0x74')][_0x5d7a76]);}else{var _0x8a18dc=[];var _0x39ae86=[];for(var _0x57c559 in _0x5e7c5f){let _0x454ae5=contactItemTypes['find'](_0x518e3f=>_0x518e3f['name']===_0x57c559);if(_[_0xbe4f('0x1d')](_0x454ae5)){if(_0x5e7c5f[_0xbe4f('0x75')](_0x57c559)){if(_0x49fc40[_0xbe4f('0x72')][_0x5d7a76][_0x5e7c5f[_0x57c559]]){var _0xede7b9=_[_0xbe4f('0x76')](_0x49fc40[_0xbe4f('0x72')][_0x5d7a76][_0x5e7c5f[_0x57c559]][_0xbe4f('0x77')](/"/g,'\x27'));switch(_0x57c559){case _0xbe4f('0x78'):var _0x4ed9bc=moment(_0xede7b9,_0xbe4f('0xe'),!![]);if(_0x4ed9bc[_0xbe4f('0x79')]()){_0x468258['push']('\x22'+_0xede7b9+'\x22');}else{_0x8a18dc[_0xbe4f('0x1e')](_0xbe4f('0x7a'));}break;case _0xbe4f('0x3b'):var _0x5e7a5b=parseInt(_0xede7b9);_0xede7b9=_['isNaN'](_0x5e7a5b)||_0x5e7a5b<0x0||_0x5e7a5b>0x4?_0x5ba99d?0x3:0x2:_0x5e7a5b;_0x468258[_0xbe4f('0x1e')]('\x22'+_0xede7b9+'\x22');break;case'UserId':var _0x163e1c=parseInt(_0xede7b9);if(_['isNumber'](_0x163e1c)&&_['includes'](_0x543ac3,_0x163e1c)){_0x468258[_0xbe4f('0x1e')]('\x22'+_0x163e1c+'\x22');}else{_0x8a18dc[_0xbe4f('0x1e')](_0xbe4f('0x7b'));}break;case _0xbe4f('0x7c'):if(isEmail(_0xede7b9)){_0x468258['push']('\x22'+_0xede7b9+'\x22');}else{_0x8a18dc['push'](_0xbe4f('0x7d'));}break;case _0xbe4f('0x7e'):var _0x279fee=moment(_0xede7b9,_0xbe4f('0x7f'),!![]);if(_0x279fee[_0xbe4f('0x79')]()){_0x468258[_0xbe4f('0x1e')]('\x22'+_0xede7b9+'\x22');}else{_0x8a18dc[_0xbe4f('0x1e')](_0xbe4f('0x80'));}break;default:_0x468258[_0xbe4f('0x1e')]('\x22'+_0xede7b9+'\x22');}}else{switch(_0x57c559){case _0xbe4f('0x81'):case _0xbe4f('0x12'):_0x8a18dc[_0xbe4f('0x1e')](_0x57c559+_0xbe4f('0x82'));break;default:_0x468258[_0xbe4f('0x1e')]('\x22\x22');}}}}else{var _0x139940='';for(var _0x351053=0x0;_0x351053<_0x5e7c5f[_0x57c559][_0xbe4f('0x1c')];_0x351053++){var _0xede7b9=_[_0xbe4f('0x76')](_0x49fc40[_0xbe4f('0x72')][_0x5d7a76][_0x5e7c5f[_0x57c559][_0x351053]][_0xbe4f('0x77')](/"/g,'\x27'));if(_0x139940=='')_0x139940=_0xede7b9;else _0x139940+='|'+_0xede7b9;}_0x39ae86[_0xbe4f('0x1e')](_0x454ae5['id']+':'+_0x139940);}}if(hasAdditionalPhones){_0x468258[_0xbe4f('0x1e')]('\x22'+_0x39ae86[_0xbe4f('0x14')](';')+'\x22');}if(_0x8a18dc['length']){handleError(_0x49fc40[_0xbe4f('0x72')][_0x5d7a76],{'code':'SystemRow','message':_0x8a18dc['join']()});}else{fs[_0xbe4f('0x83')](_0x4384b2,_0x468258['join']()+'\x0a');}_0x468258=[];}if(!(stats[_0xbe4f('0x73')]%0xc8)){socket[_0xbe4f('0x84')](_0xbe4f('0x85')+_0x217905,stats);stats[_0xbe4f('0x74')]=[];}}if(stopped){logger['info'](_0xbe4f('0x86'));_0x26a007[_0xbe4f('0x87')]();}}catch(_0x3d3836){handleError(_0x49fc40[_0xbe4f('0x72')][_0x5d7a76],{'code':_0xbe4f('0x88'),'message':_0x3d3836['message']});logger[_0xbe4f('0x22')](_0xbe4f('0x89'),_0x3d3836[_0xbe4f('0x23')]);}},'complete':function(){try{var _0x503791=[];var _0x52451e=tempTableName;_0x503791[_0xbe4f('0x1e')](_0xbe4f('0x8a')+_0x52451e+_0xbe4f('0x8b'));logger[_0xbe4f('0x5e')](_0xbe4f('0x8c'),contactItemTypes[_0xbe4f('0x1c')]);var _0x131f2c=util[_0xbe4f('0xd')](_0xbe4f('0x8d'),_0x4384b2,_0x52451e,_0x5be69b,_0x32d9b8[_0xbe4f('0x38')],_0x32d9b8[_0xbe4f('0x8e')]||null,NOW,NOW);if(_[_0xbe4f('0x1d')](_0x5e7c5f[_0xbe4f('0x78')])){_0x131f2c+=_0xbe4f('0x8f');}_0x503791[_0xbe4f('0x1e')](_0x131f2c);BPromise[_0xbe4f('0x90')](_0x503791,handleQuery)[_0xbe4f('0x20')](function(_0xea198f){BPromise[_0xbe4f('0x1f')]([handleAdditionalPhones()])[_0xbe4f('0x20')](function(){_0x503791=[];for(var _0x53df43=0x0;_0x53df43\x20\x20','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','phone','from','.id\x20=\x20','where','join','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','error','message','split','length','filter','findOne','update','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId'];(function(_0x332878,_0x2f2658){var _0x26953b=function(_0x198011){while(--_0x198011){_0x332878['push'](_0x332878['shift']());}};_0x26953b(++_0x2f2658);}(_0x54d2,0x1a2));var _0x254d=function(_0x57010f,_0x11304b){_0x57010f=_0x57010f-0x0;var _0x7c532c=_0x54d2[_0x57010f];return _0x7c532c;};'use strict';var fs=require('fs');var path=require(_0x254d('0x0'));var _=require(_0x254d('0x1'));var Papa=require(_0x254d('0x2'));var util=require(_0x254d('0x3'));var BPromise=require(_0x254d('0x4'));var moment=require(_0x254d('0x5'));var squel=require(_0x254d('0x6'));var Redis=require(_0x254d('0x7'));var db=require(_0x254d('0x8'))['db'];var config=require(_0x254d('0x9'));var logger=require('../../../config/logger')(_0x254d('0xa'));config[_0x254d('0xb')]=_[_0x254d('0xc')](config[_0x254d('0xb')],{'host':_0x254d('0xd'),'port':0x18eb});var socket=require(_0x254d('0xe'))(new Redis(config[_0x254d('0xb')]));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()[_0x254d('0xf')](_0x254d('0x10'));var tempTableName='cm_contacts_temp_'+moment()[_0x254d('0xf')](_0x254d('0x11'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x545cfe){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))*$/[_0x254d('0x12')](_0x545cfe);}function selectNotIn(_0x4e651c,_0x5870c1,_0x2c1432,_0x37dbdd,_0x46e2a4){return squel[_0x254d('0x13')]()['field'](_0x254d('0x14'))[_0x254d('0x15')](_0x37dbdd)['join'](_0x5870c1,null,_0x5870c1+_0x254d('0x16')+_0x37dbdd+'.'+_0x2c1432)[_0x254d('0x17')](_0x37dbdd+'.'+_0x2c1432+'\x20=\x20'+_0x4e651c+'.'+_0x2c1432)[_0x254d('0x17')](_0x5870c1+'.dialCheckDuplicateType\x20IN\x20('+_0x46e2a4[_0x254d('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x485e26,_0xeb5b19){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x254d('0x19')](_0x254d('0x1a')+tempTableName)[_0x254d('0x1b')](function(_0x2350e6){if(_0x2350e6!==null){var _0x1d6abd=[];for(var _0x2d9b46=0x0;_0x2d9b46<_0x2350e6['length'];_0x2d9b46++){var _0x17151e=_0x2350e6[_0x2d9b46];if(!_[_0x254d('0x1c')](_0x17151e[_0x254d('0x14')])){if(!_[_0x254d('0x1c')](_0x17151e[_0x254d('0x1d')]))_0x1d6abd[_0x254d('0x1e')](insertAdditionalPhones(_0x17151e));promisesContact['push']({'contact':_0x17151e});}}}Promise[_0x254d('0x1f')](_0x1d6abd)[_0x254d('0x20')](function(){_0x485e26({'val':0x1});});})['catch'](function(_0x49d723){logger[_0x254d('0x21')](_0x49d723[_0x254d('0x22')]);});});}function insertAdditionalPhones(_0x107b87){return new Promise(function(_0x518f15,_0x3c2049){var _0x87cbd9=_0x107b87[_0x254d('0x1d')];if(_[_0x254d('0x1c')](_0x87cbd9))_0x3c2049({'val':0x0});else{var _0x570e01=_0x87cbd9[_0x254d('0x23')](';');var _0x3370e2=[];orderBy=0x0;for(var _0x4d30a6=0x0;_0x4d30a6<_0x570e01[_0x254d('0x24')];_0x4d30a6++){_0x3370e2['push'](splitAdditionalPhone(_0x107b87['id'],_0x570e01[_0x4d30a6]));}Promise['all'](_0x3370e2)[_0x254d('0x20')](function(){_0x518f15({'val':_0x570e01[_0x254d('0x24')]});});}});}function splitAdditionalPhone(_0x16e660,_0x487c37){return new Promise(function(_0x1f42ca,_0x42c6c6){var _0xec869f=_0x487c37['split'](':');var _0x19748e=_0xec869f[0x0];var _0x32a5c5=_0xec869f[0x1];if(_0x32a5c5!==''){var _0x43314d=_0x32a5c5[_0x254d('0x23')]('|');var _0x5ac917=[];for(var _0x4d386d=0x0;_0x4d386d<_0x43314d['length'];_0x4d386d++){if(_0x43314d[_0x4d386d]!==''){var _0x18e2ae=_[_0x254d('0x25')](promisesAdditionalPhones,{'contactId':_0x16e660,'phone':_0x43314d[_0x4d386d]});if(_0x18e2ae['length']==0x0){orderBy++;promisesAdditionalPhones[_0x254d('0x1e')]({'contactId':_0x16e660,'contactTypeId':_0x19748e,'phone':_0x43314d[_0x4d386d],'orderBy':orderBy});}}}_0x1f42ca({'ok':0x1});}else _0x1f42ca({'res':0x0});});}function createAdditionalPhone(_0x4cfc33,_0x2fa104,_0x4fc822,_0x4ce0fc){return new Promise(function(_0x11b47b,_0x307bbb){return db['CmContactHasItem'][_0x254d('0x26')]({'where':{'CmContactId':_0x4cfc33,'item':_0x4fc822}})[_0x254d('0x20')](function(_0x197c7b){if(_0x197c7b){return db['CmContactHasItem'][_0x254d('0x27')]({'ItemTypeId':_0x2fa104,'OrderBy':_0x4ce0fc},{'where':{'CmContactId':_0x4cfc33,'item':_0x4fc822}})[_0x254d('0x20')](function(_0xf1f285){_0x11b47b({'res':'updated'});});}else{return db['CmContactHasItem'][_0x254d('0x28')]({'CmContactId':_0x4cfc33,'item':_0x4fc822,'ItemTypeId':_0x2fa104,'OrderBy':_0x4ce0fc,'ItemClass':_0x254d('0x29')})[_0x254d('0x20')](function(_0x1c7293){_0x11b47b({'res':_0x254d('0x2a')});});}});});}function updateContact(_0x44eba9){return new Promise(function(_0x39fba1,_0x2760b1){var _0x235b70=_0x44eba9['id'];delete _0x44eba9['id'];return db[_0x254d('0x2b')]['update'](_0x44eba9,{'where':{'id':_0x235b70}})[_0x254d('0x20')](function(_0x4fef57){updatedRows+=0x1;return db[_0x254d('0x2c')][_0x254d('0x27')]({'phone':_0x44eba9[_0x254d('0x14')]},{'where':{'ContactId':_0x235b70}})[_0x254d('0x20')](function(_0x360f07){_0x39fba1({'ret':'OK'});});});});}function insertCmHopper(_0x539612,_0x169e10,_0x47bd70,_0x119952,_0x3452d9){var _0x48520f=[_0x254d('0x2d'),_0x254d('0x2e'),_0x254d('0x2f'),_0x254d('0x30'),_0x169e10+'.'+_0x119952,_0x254d('0x31'),'cm_contacts.updatedAt',_0x254d('0x32'),'cm_contacts.UserId','\x22'+_0x3452d9+'\x22'];return squel['insert']()[_0x254d('0x33')](_0x254d('0x34'))[_0x254d('0x35')]([_0x254d('0x14'),_0x254d('0x36'),_0x254d('0x37'),'ListId',_0x119952,_0x254d('0x38'),_0x254d('0x39'),_0x254d('0x3a'),_0x254d('0x3b'),_0x254d('0x3c')],squel[_0x254d('0x13')]()[_0x254d('0x3d')](_0x48520f)[_0x254d('0x15')](_0x169e10)['join'](_0x254d('0x3e'),null,_0x254d('0x3f')+_0x169e10+_0x254d('0x40'))[_0x254d('0x18')](_0x47bd70,null,_0x47bd70+'.id\x20=\x20'+_0x169e10+'.'+_0x119952)[_0x254d('0x17')](_0x169e10+_0x254d('0x41'),_0x539612)[_0x254d('0x17')](_0x254d('0x42'),NOW)[_0x254d('0x17')](_0x254d('0x43'),selectNotIn(_0x169e10,_0x47bd70,_0x119952,'cm_hopper',[_0x254d('0x44'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x169e10,_0x47bd70,_0x119952,'cm_hopper',[_0x254d('0x44')])))['toString']();}function insertCmHopperBlack(_0x36bdfa,_0x111778,_0x172cef,_0x461ac8){var _0x403e00=[_0x254d('0x2d'),_0x254d('0x2f'),'cm_contacts.ListId',_0x111778+'.'+_0x461ac8,_0x254d('0x31'),_0x254d('0x45')];return squel[_0x254d('0x46')]()[_0x254d('0x33')](_0x254d('0x47'))[_0x254d('0x35')](['phone','ContactId',_0x254d('0x48'),_0x461ac8,_0x254d('0x38'),_0x254d('0x39')],squel[_0x254d('0x13')]()[_0x254d('0x3d')](_0x403e00)[_0x254d('0x15')](_0x111778)[_0x254d('0x18')](_0x254d('0x3e'),null,_0x254d('0x3f')+_0x111778+_0x254d('0x40'))[_0x254d('0x18')](_0x172cef,null,_0x172cef+_0x254d('0x16')+_0x111778+'.'+_0x461ac8)['where'](_0x111778+_0x254d('0x41'),_0x36bdfa)[_0x254d('0x17')](_0x254d('0x42'),NOW)[_0x254d('0x17')](_0x254d('0x43'),squel[_0x254d('0x13')]()[_0x254d('0x49')](_0x254d('0x14'))['from'](_0x254d('0x47'))['where'](_0x254d('0x4a'),_0x36bdfa)[_0x254d('0x17')](_0x461ac8+_0x254d('0x4b'),_0x111778+'.'+_0x461ac8)))[_0x254d('0x4c')]();}function insertCmHopperAdditionalPhones(_0xb63533){var _0x4b2ee3=[_0x254d('0x4d'),_0x254d('0x4e'),_0x254d('0x4f'),_0x254d('0x50'),_0x254d('0x51')];return squel[_0x254d('0x46')]()[_0x254d('0x33')]('cm_hopper_additional_phones')[_0x254d('0x35')]([_0x254d('0x52'),_0x254d('0x14'),_0x254d('0x53'),_0x254d('0x38'),_0x254d('0x39')],squel[_0x254d('0x13')]()[_0x254d('0x3d')](_0x4b2ee3)[_0x254d('0x15')](_0x254d('0x34'))[_0x254d('0x18')](_0x254d('0x3e'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x254d('0x18')](_0x254d('0x54'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x254d('0x17')](_0x254d('0x55'),_0xb63533)[_0x254d('0x17')](_0x254d('0x42'),NOW))['toString']();}function insertCmContact(_0x192969,_0x4b04f8,_0x131a2c,_0xa53ff7){var _0x5de172=_[_0x254d('0x56')](_[_0x254d('0x57')](_0xa53ff7),[_0x254d('0x48'),_0x254d('0x58'),_0x254d('0x38'),_0x254d('0x39')]);return squel[_0x254d('0x46')]()['into'](_0x254d('0x3e'))[_0x254d('0x35')](_0x5de172,squel[_0x254d('0x13')]()['fields'](_0x5de172)[_0x254d('0x15')](_0x4b04f8)[_0x254d('0x17')]('('+_0x131a2c[_0x254d('0x18')](',')+_0x254d('0x59'),squel[_0x254d('0x13')]()['fields'](_0x131a2c)['from'](_0x254d('0x3e'))[_0x254d('0x17')](_0x254d('0x4a'),_0x192969))[_0x254d('0x17')](_0x254d('0x5a'),squel[_0x254d('0x13')]()['field'](_0x254d('0x5b'),_0x254d('0x5c'))[_0x254d('0x15')](_0x4b04f8)[_0x254d('0x5d')](_0x131a2c['join'](','))))[_0x254d('0x4c')]();}function handleStop(){logger[_0x254d('0x5e')](_0x254d('0x5f'));stopped=!![];}function handleUncaughtException(_0x376960){logger[_0x254d('0x21')](_0x376960[_0x254d('0x22')]);process['exit'](0x1);}function handleError(_0x5ea14e,_0x2ea473){stats[_0x254d('0x60')][_0x254d('0x1e')]({'name':_0x2ea473[_0x254d('0x61')],'message':_0x2ea473[_0x254d('0x22')],'row':_0x5ea14e});}function handleQuery(_0x565c8){logger[_0x254d('0x5e')](_0x565c8);return db[_0x254d('0x62')]['query'](_0x565c8)[_0x254d('0x1b')](function(_0x2a953e){results[_0x254d('0x1e')](_0x2a953e);})[_0x254d('0x63')](function(_0x32a22c){logger[_0x254d('0x21')](_0x32a22c[_0x254d('0x22')]);});}function main(_0x1fdab9,_0x48c3ba,_0x16b394,_0x1a2aa3){logger[_0x254d('0x5e')]('main',_0x1fdab9,JSON['stringify'](_0x48c3ba));process['send']('start');var _0x518187=_0x48c3ba[_0x254d('0x64')];var _0x3df448=_[_0x254d('0x65')](_0x518187);var _0x1cd85f=_0x48c3ba[_0x254d('0x66')];var _0x30ccc9=path[_0x254d('0x18')](config[_0x254d('0x67')],_0x254d('0x68'),_0x1cd85f+_0x254d('0x69'));logger[_0x254d('0x5e')](_0x254d('0x6a'),_0x48c3ba);db[_0x254d('0x6b')][_0x254d('0x6c')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x1fdef1){for(var _0x4ea0a5=0x0;_0x4ea0a5<_0x1fdef1[_0x254d('0x24')];_0x4ea0a5++){if(_0x1fdef1[_0x4ea0a5]['name']in _0x518187){contactItemTypes[_0x254d('0x1e')](_0x1fdef1[_0x4ea0a5]);delete _0x3df448[_0x1fdef1[_0x4ea0a5][_0x254d('0x6d')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x3df448[_0x254d('0x1d')]='';var _0x512035=_[_0x254d('0x57')](_0x3df448)[_0x254d('0x18')]();logger[_0x254d('0x5e')]('header',_0x512035);fs[_0x254d('0x6e')](_0x30ccc9,_0x512035+'\x0a');Papa['parse'](fs[_0x254d('0x6f')](_0x1fdab9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4464cc,_0x1570f9){try{for(var _0x3960f5=0x0,_0x5a85ca=[];_0x3960f5<_0x4464cc[_0x254d('0x70')]['length'];_0x3960f5++){stats[_0x254d('0x71')]+=0x1;if(_0x4464cc[_0x254d('0x60')][_0x3960f5]){handleError(_0x4464cc[_0x254d('0x70')][_0x3960f5],_0x4464cc['errors'][_0x3960f5]);}else{var _0x5b6296=[];var _0x327f03=[];for(var _0x16689e in _0x518187){let _0x33e43c=contactItemTypes[_0x254d('0x72')](_0x8334d3=>_0x8334d3[_0x254d('0x6d')]===_0x16689e);if(_[_0x254d('0x1c')](_0x33e43c)){if(_0x518187[_0x254d('0x73')](_0x16689e)){if(_0x4464cc[_0x254d('0x70')][_0x3960f5][_0x518187[_0x16689e]]){var _0x379e40=_[_0x254d('0x74')](_0x4464cc[_0x254d('0x70')][_0x3960f5][_0x518187[_0x16689e]][_0x254d('0x75')](/"/g,'\x27'));switch(_0x16689e){case _0x254d('0x36'):var _0x3a35b4=moment(_0x379e40,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3a35b4['isValid']()){_0x5a85ca[_0x254d('0x1e')]('\x22'+_0x379e40+'\x22');}else{_0x5b6296[_0x254d('0x1e')](_0x254d('0x76'));}break;case _0x254d('0x3a'):var _0x1ab6f8=parseInt(_0x379e40);_0x379e40=_[_0x254d('0x77')](_0x1ab6f8)||_0x1ab6f8<0x0||_0x1ab6f8>0x4?_0x1a2aa3?0x3:0x2:_0x1ab6f8;_0x5a85ca['push']('\x22'+_0x379e40+'\x22');break;case _0x254d('0x3b'):var _0x226abe=parseInt(_0x379e40);if(_[_0x254d('0x78')](_0x226abe)&&_[_0x254d('0x79')](_0x16b394,_0x226abe)){_0x5a85ca[_0x254d('0x1e')]('\x22'+_0x226abe+'\x22');}else{_0x5b6296[_0x254d('0x1e')](_0x254d('0x7a'));}break;case _0x254d('0x7b'):if(isEmail(_0x379e40)){_0x5a85ca[_0x254d('0x1e')]('\x22'+_0x379e40+'\x22');}else{_0x5b6296[_0x254d('0x1e')](_0x254d('0x7c'));}break;case _0x254d('0x7d'):var _0x36445f=moment(_0x379e40,_0x254d('0x7e'),!![]);if(_0x36445f['isValid']()){_0x5a85ca['push']('\x22'+_0x379e40+'\x22');}else{_0x5b6296[_0x254d('0x1e')](_0x254d('0x7f'));}break;default:_0x5a85ca[_0x254d('0x1e')]('\x22'+_0x379e40+'\x22');}}else{switch(_0x16689e){case _0x254d('0x80'):case'phone':_0x5b6296['push'](_0x16689e+_0x254d('0x81'));break;default:_0x5a85ca['push']('\x22\x22');}}}}else{var _0x2bc3ec='';for(var _0xb4d48e=0x0;_0xb4d48e<_0x518187[_0x16689e][_0x254d('0x24')];_0xb4d48e++){var _0x379e40=_[_0x254d('0x74')](_0x4464cc[_0x254d('0x70')][_0x3960f5][_0x518187[_0x16689e][_0xb4d48e]]['replace'](/"/g,'\x27'));if(_0x2bc3ec=='')_0x2bc3ec=_0x379e40;else _0x2bc3ec+='|'+_0x379e40;}_0x327f03[_0x254d('0x1e')](_0x33e43c['id']+':'+_0x2bc3ec);}}if(hasAdditionalPhones){_0x5a85ca[_0x254d('0x1e')]('\x22'+_0x327f03['join'](';')+'\x22');}if(_0x5b6296[_0x254d('0x24')]){handleError(_0x4464cc[_0x254d('0x70')][_0x3960f5],{'code':_0x254d('0x82'),'message':_0x5b6296[_0x254d('0x18')]()});}else{fs[_0x254d('0x83')](_0x30ccc9,_0x5a85ca[_0x254d('0x18')]()+'\x0a');}_0x5a85ca=[];}if(!(stats[_0x254d('0x71')]%0xc8)){socket[_0x254d('0x84')](_0x254d('0x85')+_0x1cd85f,stats);stats[_0x254d('0x60')]=[];}}if(stopped){logger[_0x254d('0x5e')](_0x254d('0x86'));_0x1570f9[_0x254d('0x87')]();}}catch(_0x4e350a){handleError(_0x4464cc[_0x254d('0x70')][_0x3960f5],{'code':'SystemError','message':_0x4e350a['message']});logger[_0x254d('0x21')](_0x254d('0x88'),_0x4e350a[_0x254d('0x22')]);}},'complete':function(){try{var _0x2e8841=[];var _0x3168d6=tempTableName;_0x2e8841[_0x254d('0x1e')](_0x254d('0x89')+_0x3168d6+_0x254d('0x8a'));logger[_0x254d('0x5e')](_0x254d('0x8b'),contactItemTypes[_0x254d('0x24')]);var _0x35bc4c=util[_0x254d('0xf')](_0x254d('0x8c'),_0x30ccc9,_0x3168d6,_0x512035,_0x48c3ba[_0x254d('0x48')],_0x48c3ba[_0x254d('0x58')]||null,NOW,NOW);if(_[_0x254d('0x1c')](_0x518187[_0x254d('0x36')])){_0x35bc4c+=_0x254d('0x8d');}_0x2e8841[_0x254d('0x1e')](_0x35bc4c);BPromise[_0x254d('0x8e')](_0x2e8841,handleQuery)[_0x254d('0x20')](function(_0x4e8548){BPromise[_0x254d('0x1f')]([handleAdditionalPhones()])[_0x254d('0x20')](function(){_0x2e8841=[];for(var _0x1f725f=0x0;_0x1f725f=_0x56fdab){return _0x4dc8e9['status'](0x193)['json']({'message':util[_0x3134('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x51e5fb)});}_0x1d551b();})[_0x3134('0x14')](function(_0x56fcda){_0x1d551b(_0x56fcda);});});}function isUserLimit(){return isLimit(_0x3134('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x3134('0x16')]=isUserLimit; \ No newline at end of file +var _0x2949=['utf8','hasOwnProperty','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64'];(function(_0x4c1898,_0x5f3fe5){var _0x1f295a=function(_0x416a1b){while(--_0x416a1b){_0x4c1898['push'](_0x4c1898['shift']());}};_0x1f295a(++_0x5f3fe5);}(_0x2949,0x152));var _0x9294=function(_0x2f43f4,_0x2428b1){_0x2f43f4=_0x2f43f4-0x0;var _0x4f4223=_0x2949[_0x2f43f4];return _0x4f4223;};'use strict';var crypto=require(_0x9294('0x0'));var util=require(_0x9294('0x1'));var compose=require('composable-middleware');var db=require(_0x9294('0x2'))['db'];var config=require(_0x9294('0x3'));function getValueFromLicense(_0x33ffa8,_0x3cd9f0){if(_0x33ffa8&&_0x3cd9f0){if(_0x3cd9f0['data1']&&_0x3cd9f0[_0x9294('0x4')]){var _0x20cccb=_0x3cd9f0['data1'];var _0x2feb67=_0x3cd9f0[_0x9294('0x4')];var _0x3de666=_0x20cccb[_0x9294('0x5')]('-')[0x4];var _0x4620da=_0x20cccb[_0x9294('0x5')]('-')[0x0];var _0x319550=crypto[_0x9294('0x6')](_0x9294('0x7'),util[_0x9294('0x8')](_0x9294('0x9'),_0x3de666,_0x20cccb,_0x4620da));var _0x3ae393=_0x319550[_0x9294('0xa')](_0x2feb67,_0x9294('0xb'),_0x9294('0xc'));_0x3ae393+=_0x319550['final'](_0x9294('0xc'));var _0x5bf047=JSON['parse'](_0x3ae393);return _0x5bf047[_0x9294('0xd')](_0x33ffa8)?_0x5bf047[_0x33ffa8]:null;}}return null;}function isLimit(_0xcb67ca,_0x4996a9,_0x17edc3,_0x3d92e6){var _0x31eea6=_0x4996a9;return compose()['use'](function(_0x455309,_0x55f8a7,_0x515158){return db['License'][_0x9294('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x9294('0xf')](function(_0x3c1774){var _0x4515ee=getValueFromLicense(_0xcb67ca,_0x3c1774);return _0x4515ee?_0x4515ee:_0x31eea6;})[_0x9294('0xf')](function(_0x2f477b){_0x31eea6=_0x2f477b;return _0x17edc3[_0x9294('0x10')](_0x3d92e6);})[_0x9294('0xf')](function(_0x188bc3){if(_0x188bc3>=_0x31eea6){return _0x55f8a7[_0x9294('0x11')](0x193)[_0x9294('0x12')]({'message':util[_0x9294('0x8')](_0x9294('0x13'),_0xcb67ca)});}_0x515158();})[_0x9294('0x14')](function(_0x544cb7){_0x515158(_0x544cb7);});});}function isUserLimit(){return isLimit(_0x9294('0x15'),0x1,db[_0x9294('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0x9294('0x17')}]}});}exports[_0x9294('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 951430f..9ac2b4e 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 _0xf3f7=['shift','match','indexOf','map','conditions','push','DATE','value','includes','$gt','$lte','operator','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','$between','start','utcOffset','format','hours','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach'];(function(_0x5d82ad,_0x2a734a){var _0x4ab31f=function(_0x4c9098){while(--_0x4c9098){_0x5d82ad['push'](_0x5d82ad['shift']());}};_0x4ab31f(++_0x2a734a);}(_0xf3f7,0x1d1));var _0x7f3f=function(_0x5f1a3c,_0x62321e){_0x5f1a3c=_0x5f1a3c-0x0;var _0x3e8fd9=_0xf3f7[_0x5f1a3c];return _0x3e8fd9;};'use strict';var _=require(_0x7f3f('0x0'));var moment=require('moment');exports[_0x7f3f('0x1')]=function(_0x388cea){var _0x2c99fc={'conditions':[]};_0x2c99fc[_0x7f3f('0x2')]=_[_0x7f3f('0x3')](_0x388cea,_0x7f3f('0x4'))?'or':_0x7f3f('0x5');var _0x4c5d84=_0x388cea[_0x7f3f('0x6')](_0x7f3f('0x7'),'')['replace'](_0x7f3f('0x4'),'')[_0x7f3f('0x8')]('||');for(var _0x28b566=0x0;_0x28b566<_0x4c5d84[_0x7f3f('0x9')];_0x28b566++){var _0x3aa41a=_0x4c5d84[_0x28b566][_0x7f3f('0x8')](':=');var _0x50de24=_0x3aa41a[0x0];var _0x5a592d=_0x3aa41a[_0x7f3f('0xa')](0x1);_0x5a592d[_0x7f3f('0xb')](function(_0x3bb8ff){var _0x13a7ab=_0x3bb8ff[_0x7f3f('0x8')]('[')[_0x7f3f('0xc')]();var _0x88122a=_0x3bb8ff[_0x7f3f('0xd')](/\[(.*?)\]/g);_0x88122a[_0x7f3f('0xb')](function(_0x55e904){var _0x141ac9=_0x55e904[_0x7f3f('0x8')]('[')['filter'](function(_0x4657a4){return _0x4657a4[_0x7f3f('0xe')](']')>-0x1;})[_0x7f3f('0xf')](function(_0x2d2aa8){return _0x2d2aa8[_0x7f3f('0x8')](']')[0x0];})[0x0];_0x2c99fc[_0x7f3f('0x10')][_0x7f3f('0x11')]({'field':_0x50de24,'operator':_0x13a7ab,'value':_0x141ac9});});});}return _0x2c99fc;};exports['buildExpression']=function(_0x586e44,_0x2e3286,_0x249b79){var _0x3b8ac7={};if(_0x2e3286===_0x7f3f('0x12')){if(_0x249b79['operator']==='$eq'){_0x249b79['operator']='$between';_0x249b79['value']+=','+_0x249b79[_0x7f3f('0x13')];}else if(_[_0x7f3f('0x14')]([_0x7f3f('0x15'),_0x7f3f('0x16')],_0x249b79[_0x7f3f('0x17')])){_0x249b79[_0x7f3f('0x13')]=moment(_0x249b79['value'])[_0x7f3f('0x18')](0x1,_0x7f3f('0x19'))['format'](_0x7f3f('0x1a'));}}if(_0x249b79[_0x7f3f('0x1b')]){_0x2e3286=_0x249b79[_0x7f3f('0x1b')];_0x3b8ac7[_0x7f3f('0x1c')]=_0x7f3f('0x1d')+_0x586e44+'.'+_0x249b79[_0x7f3f('0x1e')]+_0x7f3f('0x1f')+_0x249b79[_0x7f3f('0x1b')]+')\x20'+parseOperator(_0x249b79[_0x7f3f('0x17')]);}else{_0x3b8ac7[_0x7f3f('0x1c')]=_0x586e44+'.'+_0x249b79[_0x7f3f('0x1e')]+'\x20'+parseOperator(_0x249b79[_0x7f3f('0x17')]);}if(_['includes']([_0x7f3f('0x20'),_0x7f3f('0x21')],_0x249b79[_0x7f3f('0x17')]))_0x3b8ac7[_0x7f3f('0x1c')]='('+_0x3b8ac7['text']+_0x7f3f('0x22')+_0x586e44+'.'+_0x249b79['field']+_0x7f3f('0x23');_0x3b8ac7[_0x7f3f('0x13')]=parseValue(_0x2e3286,_0x249b79[_0x7f3f('0x17')],_0x249b79['value']);return _0x3b8ac7;};function parseOperator(_0x42ff0f){var _0x23985d;switch(_0x42ff0f){case _0x7f3f('0x24'):_0x23985d=_0x7f3f('0x25');break;case _0x7f3f('0x21'):_0x23985d=_0x7f3f('0x26');break;case _0x7f3f('0x27'):_0x23985d='=\x20?';break;case _0x7f3f('0x20'):_0x23985d=_0x7f3f('0x28');break;case _0x7f3f('0x29'):case _0x7f3f('0x2a'):case'$endsWith':_0x23985d=_0x7f3f('0x2b');break;case _0x7f3f('0x2c'):_0x23985d=_0x7f3f('0x2d');break;case _0x7f3f('0x15'):_0x23985d=_0x7f3f('0x2e');break;case _0x7f3f('0x16'):_0x23985d='<=\x20?';break;case _0x7f3f('0x2f'):_0x23985d='>=\x20?';break;case _0x7f3f('0x30'):_0x23985d='BETWEEN\x20?\x20AND\x20?';break;}return _0x23985d;}function parseValue(_0x2b1e8e,_0x202f46,_0x363890){var _0x3e359a={'start':undefined,'end':undefined};switch(_0x202f46){case _0x7f3f('0x24'):case _0x7f3f('0x21'):_0x3e359a[_0x7f3f('0x31')]=_0x363890['split'](',');break;case _0x7f3f('0x29'):_0x3e359a[_0x7f3f('0x31')]='%'+_0x363890+'%';break;case _0x7f3f('0x2a'):_0x3e359a[_0x7f3f('0x31')]=_0x363890+'%';break;case'$endsWith':_0x3e359a[_0x7f3f('0x31')]='%'+_0x363890;break;case _0x7f3f('0x30'):var _0x15605d=_0x363890[_0x7f3f('0x8')](',');var _0x363890=_0x15605d[_0x7f3f('0xc')]();var _0xb2efda=_0x15605d['pop']();if(_0x2b1e8e===_0x7f3f('0x12')){_0x363890=moment(_0x363890)[_0x7f3f('0x32')](0x0,!![])[_0x7f3f('0x33')]();_0xb2efda=moment(_0xb2efda)[_0x7f3f('0x32')](0x0,!![])['add'](0x17,_0x7f3f('0x34'))[_0x7f3f('0x18')](0x3b,'minutes')[_0x7f3f('0x18')](0x3b,'seconds')['format']();}_0x3e359a={'start':_0x363890,'end':_0xb2efda};break;default:_0x3e359a[_0x7f3f('0x31')]=_0x363890;break;}return _0x3e359a;} \ No newline at end of file +var _0x3148=['$substring','pop','utcOffset','hours','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','shift','match','forEach','filter','indexOf','map','buildExpression','DATE','operator','$between','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x3148,0x123));var _0x8314=function(_0x4e9559,_0x324346){_0x4e9559=_0x4e9559-0x0;var _0x13d630=_0x3148[_0x4e9559];return _0x13d630;};'use strict';var _=require('lodash');var moment=require(_0x8314('0x0'));exports[_0x8314('0x1')]=function(_0x137cdb){var _0x46ff94={'conditions':[]};_0x46ff94[_0x8314('0x2')]=_[_0x8314('0x3')](_0x137cdb,_0x8314('0x4'))?'or':_0x8314('0x5');var _0x301b64=_0x137cdb[_0x8314('0x6')](_0x8314('0x7'),'')['replace'](_0x8314('0x4'),'')[_0x8314('0x8')]('||');for(var _0x5df308=0x0;_0x5df308<_0x301b64['length'];_0x5df308++){var _0xc7d7c8=_0x301b64[_0x5df308]['split'](':=');var _0x4f37f1=_0xc7d7c8[0x0];var _0x4cd980=_0xc7d7c8[_0x8314('0x9')](0x1);_0x4cd980['forEach'](function(_0x53dbfb){var _0x2aba91=_0x53dbfb[_0x8314('0x8')]('[')[_0x8314('0xa')]();var _0x59d2fc=_0x53dbfb[_0x8314('0xb')](/\[(.*?)\]/g);_0x59d2fc[_0x8314('0xc')](function(_0x141124){var _0x4501ff=_0x141124[_0x8314('0x8')]('[')[_0x8314('0xd')](function(_0x3c2ac1){return _0x3c2ac1[_0x8314('0xe')](']')>-0x1;})[_0x8314('0xf')](function(_0x392f53){return _0x392f53[_0x8314('0x8')](']')[0x0];})[0x0];_0x46ff94['conditions']['push']({'field':_0x4f37f1,'operator':_0x2aba91,'value':_0x4501ff});});});}return _0x46ff94;};exports[_0x8314('0x10')]=function(_0x59979c,_0x230cc9,_0x5a711a){var _0x583659={};if(_0x230cc9===_0x8314('0x11')){if(_0x5a711a['operator']==='$eq'){_0x5a711a[_0x8314('0x12')]=_0x8314('0x13');_0x5a711a[_0x8314('0x14')]+=','+_0x5a711a[_0x8314('0x14')];}else if(_[_0x8314('0x15')]([_0x8314('0x16'),'$lte'],_0x5a711a[_0x8314('0x12')])){_0x5a711a[_0x8314('0x14')]=moment(_0x5a711a[_0x8314('0x14')])[_0x8314('0x17')](0x1,_0x8314('0x18'))[_0x8314('0x19')](_0x8314('0x1a'));}}if(_0x5a711a[_0x8314('0x1b')]){_0x230cc9=_0x5a711a[_0x8314('0x1b')];_0x583659[_0x8314('0x1c')]=_0x8314('0x1d')+_0x59979c+'.'+_0x5a711a[_0x8314('0x1e')]+'\x20AS\x20'+_0x5a711a[_0x8314('0x1b')]+')\x20'+parseOperator(_0x5a711a['operator']);}else{_0x583659[_0x8314('0x1c')]=_0x59979c+'.'+_0x5a711a[_0x8314('0x1e')]+'\x20'+parseOperator(_0x5a711a[_0x8314('0x12')]);}if(_['includes']([_0x8314('0x1f'),_0x8314('0x20')],_0x5a711a[_0x8314('0x12')]))_0x583659[_0x8314('0x1c')]='('+_0x583659[_0x8314('0x1c')]+'\x20OR\x20'+_0x59979c+'.'+_0x5a711a[_0x8314('0x1e')]+_0x8314('0x21');_0x583659[_0x8314('0x14')]=parseValue(_0x230cc9,_0x5a711a[_0x8314('0x12')],_0x5a711a[_0x8314('0x14')]);return _0x583659;};function parseOperator(_0x58986c){var _0x4651ae;switch(_0x58986c){case _0x8314('0x22'):_0x4651ae=_0x8314('0x23');break;case _0x8314('0x20'):_0x4651ae=_0x8314('0x24');break;case _0x8314('0x25'):_0x4651ae=_0x8314('0x26');break;case _0x8314('0x1f'):_0x4651ae=_0x8314('0x27');break;case'$substring':case _0x8314('0x28'):case _0x8314('0x29'):_0x4651ae=_0x8314('0x2a');break;case _0x8314('0x2b'):_0x4651ae='<\x20?';break;case _0x8314('0x16'):_0x4651ae=_0x8314('0x2c');break;case _0x8314('0x2d'):_0x4651ae=_0x8314('0x2e');break;case _0x8314('0x2f'):_0x4651ae=_0x8314('0x30');break;case _0x8314('0x13'):_0x4651ae=_0x8314('0x31');break;}return _0x4651ae;}function parseValue(_0x23acb9,_0x8143e9,_0x48c7b9){var _0x5726f0={'start':undefined,'end':undefined};switch(_0x8143e9){case _0x8314('0x22'):case _0x8314('0x20'):_0x5726f0[_0x8314('0x32')]=_0x48c7b9['split'](',');break;case _0x8314('0x33'):_0x5726f0['start']='%'+_0x48c7b9+'%';break;case _0x8314('0x28'):_0x5726f0[_0x8314('0x32')]=_0x48c7b9+'%';break;case _0x8314('0x29'):_0x5726f0['start']='%'+_0x48c7b9;break;case _0x8314('0x13'):var _0x337484=_0x48c7b9[_0x8314('0x8')](',');var _0x48c7b9=_0x337484[_0x8314('0xa')]();var _0x3f1ec6=_0x337484[_0x8314('0x34')]();if(_0x23acb9===_0x8314('0x11')){_0x48c7b9=moment(_0x48c7b9)[_0x8314('0x35')](0x0,!![])['format']();_0x3f1ec6=moment(_0x3f1ec6)[_0x8314('0x35')](0x0,!![])['add'](0x17,_0x8314('0x36'))[_0x8314('0x17')](0x3b,_0x8314('0x37'))[_0x8314('0x17')](0x3b,_0x8314('0x38'))['format']();}_0x5726f0={'start':_0x48c7b9,'end':_0x3f1ec6};break;default:_0x5726f0[_0x8314('0x32')]=_0x48c7b9;break;}return _0x5726f0;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 0bd1a27..1129a54 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 _0x47b4=['isPlainObject','$gte','YYYY-MM-DD','utc','format','isArray','parse','split','limit','sort','cast','col','unsigned','priority','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','toString','fields','isEmpty','forOwn','find','type','DATE'];(function(_0x59f228,_0x57e995){var _0x364c5f=function(_0x34ff82){while(--_0x34ff82){_0x59f228['push'](_0x59f228['shift']());}};_0x364c5f(++_0x57e995);}(_0x47b4,0x144));var _0x447b=function(_0x537fd7,_0x5c3379){_0x537fd7=_0x537fd7-0x0;var _0x45903a=_0x47b4[_0x537fd7];return _0x45903a;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x447b('0x0')]=function(_0xf39100){var _0x1aa6d2=null;if(_0xf39100){_0x1aa6d2=_0xf39100['split'](',');}return _0x1aa6d2;};exports['filters']=function(_0x4ae779,_0x362eb6){var _0x85216={};if(!_[_0x447b('0x1')](_0x4ae779)){_[_0x447b('0x2')](_0x4ae779,function(_0x5736a7,_0x5a62cc){try{if(_0x362eb6){var _0x182a5a=_[_0x447b('0x3')](_0x362eb6,{'name':_0x5a62cc})||{};if(_0x182a5a[_0x447b('0x4')]===_0x447b('0x5')&&_[_0x447b('0x6')](_0x5736a7)){var _0x29e9dd=JSON['parse'](_0x5736a7);var _0x3bda09={'$gte':moment(moment(_0x29e9dd[_0x447b('0x7')])['format'](_0x447b('0x8')))[_0x447b('0x9')]()[_0x447b('0xa')](),'$lte':moment(moment(_0x29e9dd['$lte'])[_0x447b('0xa')]('YYYY-MM-DD'))[_0x447b('0x9')]()['subtract'](0x1,'s')[_0x447b('0xa')]()};_0x85216[_0x5a62cc]=_0x3bda09;}else{_0x85216[_0x5a62cc]=_[_0x447b('0xb')](_0x5736a7)?_0x5736a7:JSON['parse'](_0x5736a7);}}else{_0x85216[_0x5a62cc]=_[_0x447b('0xb')](_0x5736a7)?_0x5736a7:JSON[_0x447b('0xc')](_0x5736a7);}}catch(_0x3f0a5f){_0x85216[_0x5a62cc]=_0x5736a7[_0x447b('0xd')](',');}});}return _0x85216;};exports[_0x447b('0xe')]=function(_0x2f0f39){_0x2f0f39=parseInt(_0x2f0f39,0xa);if(!_0x2f0f39||_0x2f0f39<0x0){_0x2f0f39=LIMIT_VALUE;}return _0x2f0f39;};exports['offset']=function(_0x3df952){_0x3df952=parseInt(_0x3df952,0xa);if(!_0x3df952||_0x3df952<0x0){_0x3df952=0x0;}return _0x3df952;};exports[_0x447b('0xf')]=function(_0x4b4d64){var _0x531309,_0x4cbd0b=null;if(_0x4b4d64){_0x531309=_0x4b4d64[_0x447b('0xd')](',');_0x4cbd0b=_['map'](_0x531309,function(_0xdd5016){if(_0xdd5016['indexOf']('-')===0x0){return[_0xdd5016==='priority'?sequelize[_0x447b('0x10')](sequelize[_0x447b('0x11')]('priority'),_0x447b('0x12')):_0xdd5016['substr'](0x1),'DESC'];}else{return[_0xdd5016===_0x447b('0x13')?sequelize['cast'](sequelize['col'](_0x447b('0x13')),'unsigned'):_0xdd5016,_0x447b('0x14')];}});}return _0x4cbd0b;};exports[_0x447b('0x15')]=function(_0x45a9d9,_0x26990c){if(_[_0x447b('0x1')](_0x45a9d9)){return _0x45a9d9;}if(_[_0x447b('0xb')](_0x45a9d9)){for(var _0x3a7b3a=0x0;_0x3a7b3a<_0x45a9d9[_0x447b('0x16')];_0x3a7b3a+=0x1){_0x45a9d9[_0x3a7b3a]=this[_0x447b('0x15')](_0x45a9d9[_0x3a7b3a],_0x26990c);}return _0x45a9d9;}if(!_[_0x447b('0x17')](_0x45a9d9)){return _0x45a9d9;}if(_[_0x447b('0x18')](_0x26990c)){_0x26990c=[_0x26990c];}if(!_['isArray'](_0x26990c)){return _0x45a9d9;}for(var _0x5ed61a=0x0;_0x5ed61a<_0x26990c[_0x447b('0x16')];_0x5ed61a+=0x1){_[_0x447b('0x19')](_0x45a9d9,_0x26990c[_0x5ed61a]);}for(var _0x3b5cf2 in _0x45a9d9){if(_0x45a9d9[_0x447b('0x1a')](_0x3b5cf2)){_0x45a9d9[_0x3b5cf2]=this[_0x447b('0x15')](_0x45a9d9[_0x3b5cf2],_0x26990c);}}return _0x45a9d9;};exports[_0x447b('0x1b')]=function(_0x443ac3){return _0x443ac3[_0x447b('0x1c')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x447b('0x1d')]=function(_0x4b4eed){return _0x4b4eed[_0x447b('0x1c')](/^\S+@\S+$/)?!![]:![];};exports[_0x447b('0x1e')]=function(_0x21bd0a){var _0x1c9356=[];_0x21bd0a[_0x447b('0xd')]('\x20')[_0x447b('0x1f')](function(_0x211677){_0x1c9356['push']('+'+_0x211677[_0x447b('0x20')]()+'*');});return _0x1c9356['join']('\x20');}; \ No newline at end of file +var _0x3454=['length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','join','sequelize','moment','fields','split','isEmpty','forOwn','find','type','DATE','parse','format','utc','subtract','isArray','limit','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','omit'];(function(_0x4a26e9,_0x12442b){var _0x39d5db=function(_0x349e1b){while(--_0x349e1b){_0x4a26e9['push'](_0x4a26e9['shift']());}};_0x39d5db(++_0x12442b);}(_0x3454,0x1c8));var _0x4345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3454[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require(_0x4345('0x0'));var moment=require(_0x4345('0x1'));var LIMIT_VALUE=0xfa;exports[_0x4345('0x2')]=function(_0x12bd51){var _0x1f4c03=null;if(_0x12bd51){_0x1f4c03=_0x12bd51[_0x4345('0x3')](',');}return _0x1f4c03;};exports['filters']=function(_0x84e8f,_0x60d183){var _0xdc0ad3={};if(!_[_0x4345('0x4')](_0x84e8f)){_[_0x4345('0x5')](_0x84e8f,function(_0xe6402a,_0x4bfaeb){try{if(_0x60d183){var _0x570d36=_[_0x4345('0x6')](_0x60d183,{'name':_0x4bfaeb})||{};if(_0x570d36[_0x4345('0x7')]===_0x4345('0x8')&&_['isPlainObject'](_0xe6402a)){var _0x4c79c8=JSON[_0x4345('0x9')](_0xe6402a);var _0x19cd80={'$gte':moment(moment(_0x4c79c8['$gte'])[_0x4345('0xa')]('YYYY-MM-DD'))['utc']()[_0x4345('0xa')](),'$lte':moment(moment(_0x4c79c8['$lte'])[_0x4345('0xa')]('YYYY-MM-DD'))[_0x4345('0xb')]()[_0x4345('0xc')](0x1,'s')[_0x4345('0xa')]()};_0xdc0ad3[_0x4bfaeb]=_0x19cd80;}else{_0xdc0ad3[_0x4bfaeb]=_[_0x4345('0xd')](_0xe6402a)?_0xe6402a:JSON['parse'](_0xe6402a);}}else{_0xdc0ad3[_0x4bfaeb]=_['isArray'](_0xe6402a)?_0xe6402a:JSON[_0x4345('0x9')](_0xe6402a);}}catch(_0x50c88a){_0xdc0ad3[_0x4bfaeb]=_0xe6402a[_0x4345('0x3')](',');}});}return _0xdc0ad3;};exports[_0x4345('0xe')]=function(_0x2c988e){_0x2c988e=parseInt(_0x2c988e,0xa);if(!_0x2c988e||_0x2c988e<0x0){_0x2c988e=LIMIT_VALUE;}return _0x2c988e;};exports['offset']=function(_0x4e9bf3){_0x4e9bf3=parseInt(_0x4e9bf3,0xa);if(!_0x4e9bf3||_0x4e9bf3<0x0){_0x4e9bf3=0x0;}return _0x4e9bf3;};exports[_0x4345('0xf')]=function(_0x4ac109){var _0x155260,_0x284c1e=null;if(_0x4ac109){_0x155260=_0x4ac109[_0x4345('0x3')](',');_0x284c1e=_[_0x4345('0x10')](_0x155260,function(_0x172beb){if(_0x172beb[_0x4345('0x11')]('-')===0x0){return[_0x172beb===_0x4345('0x12')?sequelize['cast'](sequelize[_0x4345('0x13')](_0x4345('0x12')),_0x4345('0x14')):_0x172beb[_0x4345('0x15')](0x1),_0x4345('0x16')];}else{return[_0x172beb===_0x4345('0x12')?sequelize[_0x4345('0x17')](sequelize[_0x4345('0x13')](_0x4345('0x12')),'unsigned'):_0x172beb,'ASC'];}});}return _0x284c1e;};exports[_0x4345('0x18')]=function(_0x6b079c,_0x276190){if(_[_0x4345('0x4')](_0x6b079c)){return _0x6b079c;}if(_[_0x4345('0xd')](_0x6b079c)){for(var _0x1b6814=0x0;_0x1b6814<_0x6b079c[_0x4345('0x19')];_0x1b6814+=0x1){_0x6b079c[_0x1b6814]=this[_0x4345('0x18')](_0x6b079c[_0x1b6814],_0x276190);}return _0x6b079c;}if(!_[_0x4345('0x1a')](_0x6b079c)){return _0x6b079c;}if(_[_0x4345('0x1b')](_0x276190)){_0x276190=[_0x276190];}if(!_[_0x4345('0xd')](_0x276190)){return _0x6b079c;}for(var _0x346178=0x0;_0x346178<_0x276190[_0x4345('0x19')];_0x346178+=0x1){_[_0x4345('0x1c')](_0x6b079c,_0x276190[_0x346178]);}for(var _0x3b3d61 in _0x6b079c){if(_0x6b079c[_0x4345('0x1d')](_0x3b3d61)){_0x6b079c[_0x3b3d61]=this[_0x4345('0x18')](_0x6b079c[_0x3b3d61],_0x276190);}}return _0x6b079c;};exports[_0x4345('0x1e')]=function(_0x2084bb){return _0x2084bb[_0x4345('0x1f')](RegExp(_0x4345('0x20')))?!![]:![];};exports[_0x4345('0x21')]=function(_0x443591){return _0x443591[_0x4345('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0x4345('0x22')]=function(_0x3b875b){var _0x2dedc4=[];_0x3b875b[_0x4345('0x3')]('\x20')[_0x4345('0x23')](function(_0x4183c5){_0x2dedc4['push']('+'+_0x4183c5['toString']()+'*');});return _0x2dedc4[_0x4345('0x24')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a534092..14f07a0 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2df0=['serve-favicon','method-override','cookie-parser','errorhandler','passport','cors','moment','../mysqldb','default','production','set','appPath','join','root','test','client','use','toISOString','split','static','get','views','engine','ejs','renderFile','html','urlencoded','50mb','json'];(function(_0x3e6d80,_0x42d3ff){var _0x3e3fd1=function(_0x14acb8){while(--_0x14acb8){_0x3e6d80['push'](_0x3e6d80['shift']());}};_0x3e3fd1(++_0x42d3ff);}(_0x2df0,0x91));var _0x02df=function(_0x16ace0,_0x5a64c8){_0x16ace0=_0x16ace0-0x0;var _0x2748d8=_0x2df0[_0x16ace0];return _0x2748d8;};'use strict';var express=require('express');var favicon=require(_0x02df('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0x02df('0x1'));var cookieParser=require(_0x02df('0x2'));var errorHandler=require(_0x02df('0x3'));var path=require('path');var passport=require(_0x02df('0x4'));var cors=require(_0x02df('0x5'));var moment=require(_0x02df('0x6'));var config=require('./environment');var db=require(_0x02df('0x7'))['db'];exports[_0x02df('0x8')]=function(_0x5875bd){var _0x2bce2d=_0x5875bd['get']('env');if(_0x2bce2d===_0x02df('0x9')){_0x5875bd[_0x02df('0xa')](_0x02df('0xb'),path[_0x02df('0xc')](config[_0x02df('0xd')],'public'));}if(_0x2bce2d==='development'||_0x2bce2d===_0x02df('0xe')){_0x5875bd[_0x02df('0xa')](_0x02df('0xb'),path[_0x02df('0xc')](config[_0x02df('0xd')],_0x02df('0xf')));_0x5875bd[_0x02df('0x10')](errorHandler());}_0x5875bd[_0x02df('0xa')]('json\x20replacer',function(_0x2225c,_0x13e280){if(this[_0x2225c]instanceof Date){_0x13e280=this[_0x2225c][_0x02df('0x11')]()[_0x02df('0x12')]('.')[0x0]+'Z';}return _0x13e280;});_0x5875bd['use'](express[_0x02df('0x13')](_0x5875bd[_0x02df('0x14')](_0x02df('0xb'))));_0x5875bd[_0x02df('0xa')](_0x02df('0x15'),config['root']+'/server/views');_0x5875bd[_0x02df('0x16')]('html',require(_0x02df('0x17'))[_0x02df('0x18')]);_0x5875bd['set']('view\x20engine',_0x02df('0x19'));_0x5875bd['use'](bodyParser[_0x02df('0x1a')]({'limit':_0x02df('0x1b'),'extended':!![]}));_0x5875bd['use'](bodyParser[_0x02df('0x1c')]({'limit':_0x02df('0x1b')}));_0x5875bd[_0x02df('0x10')](cors());_0x5875bd[_0x02df('0x10')](methodOverride());_0x5875bd['use'](cookieParser());_0x5875bd[_0x02df('0x10')](passport['initialize']());}; \ No newline at end of file +var _0x6108=['get','appPath','views','root','/server/views','engine','html','renderFile','view\x20engine','50mb','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','passport','cors','moment','./environment','../mysqldb','default','env','production','join','development','test','set','client','use','toISOString','split','static'];(function(_0x38c7aa,_0xbe5efc){var _0x49f6fd=function(_0x1f21d2){while(--_0x1f21d2){_0x38c7aa['push'](_0x38c7aa['shift']());}};_0x49f6fd(++_0xbe5efc);}(_0x6108,0x8f));var _0x8610=function(_0x16521d,_0x46bde9){_0x16521d=_0x16521d-0x0;var _0x12da2e=_0x6108[_0x16521d];return _0x12da2e;};'use strict';var express=require(_0x8610('0x0'));var favicon=require(_0x8610('0x1'));var bodyParser=require(_0x8610('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x8610('0x3'));var errorHandler=require(_0x8610('0x4'));var path=require('path');var passport=require(_0x8610('0x5'));var cors=require(_0x8610('0x6'));var moment=require(_0x8610('0x7'));var config=require(_0x8610('0x8'));var db=require(_0x8610('0x9'))['db'];exports[_0x8610('0xa')]=function(_0x237302){var _0x2e3939=_0x237302['get'](_0x8610('0xb'));if(_0x2e3939===_0x8610('0xc')){_0x237302['set']('appPath',path[_0x8610('0xd')](config['root'],'public'));}if(_0x2e3939===_0x8610('0xe')||_0x2e3939===_0x8610('0xf')){_0x237302[_0x8610('0x10')]('appPath',path[_0x8610('0xd')](config['root'],_0x8610('0x11')));_0x237302[_0x8610('0x12')](errorHandler());}_0x237302[_0x8610('0x10')]('json\x20replacer',function(_0x5b52b5,_0x15f802){if(this[_0x5b52b5]instanceof Date){_0x15f802=this[_0x5b52b5][_0x8610('0x13')]()[_0x8610('0x14')]('.')[0x0]+'Z';}return _0x15f802;});_0x237302[_0x8610('0x12')](express[_0x8610('0x15')](_0x237302[_0x8610('0x16')](_0x8610('0x17'))));_0x237302[_0x8610('0x10')](_0x8610('0x18'),config[_0x8610('0x19')]+_0x8610('0x1a'));_0x237302[_0x8610('0x1b')](_0x8610('0x1c'),require('ejs')[_0x8610('0x1d')]);_0x237302[_0x8610('0x10')](_0x8610('0x1e'),_0x8610('0x1c'));_0x237302[_0x8610('0x12')](bodyParser['urlencoded']({'limit':_0x8610('0x1f'),'extended':!![]}));_0x237302[_0x8610('0x12')](bodyParser['json']({'limit':_0x8610('0x1f')}));_0x237302[_0x8610('0x12')](cors());_0x237302[_0x8610('0x12')](methodOverride());_0x237302[_0x8610('0x12')](cookieParser());_0x237302[_0x8610('0x12')](passport[_0x8610('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 1b4cab9..5e3c531 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 _0x6d19=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','cpus','map','model','join','md5','update','digest','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x6d19,0x160));var _0x96d1=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x6d19[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require(_0x96d1('0x0'));var os=require('os');var crypto=require(_0x96d1('0x1'));var machine=require(_0x96d1('0x2'));var exec=require(_0x96d1('0x3'))[_0x96d1('0x4')];function getInterfaces(){var _0x31518c=[];var _0x36405d=os['networkInterfaces']();var _0x186315=_[_0x96d1('0x5')](_[_0x96d1('0x6')](_0x36405d));for(var _0x4704b3=0x0;_0x4704b3<_0x186315['length'];_0x4704b3++){var _0x32b7d9=_0x36405d[_0x186315[_0x4704b3]][_0x96d1('0x7')](function(_0x61e0f5){return _0x61e0f5['family']===_0x96d1('0x8')&&_0x61e0f5[_0x96d1('0x9')]===![];});_0x31518c=_0x31518c[_0x96d1('0xa')](_0x32b7d9);}return _0x31518c;}function getFirstInterface(){var _0x4e1e7a=_[_0x96d1('0xb')](getInterfaces());return{'macAddress':_0x4e1e7a&&_0x4e1e7a[_0x96d1('0xc')]?_0x4e1e7a['mac']:'00:00:00:00:00:00','ipAddress':_0x4e1e7a&&_0x4e1e7a[_0x96d1('0xd')]?_0x4e1e7a[_0x96d1('0xd')]:'127.0.0.1'};}exports[_0x96d1('0xe')]=getFirstInterface;function getCPUhash(){var _0x51b089=_[_0x96d1('0x5')](os[_0x96d1('0xf')]()[_0x96d1('0x10')](function(_0xb019fb){return _0xb019fb[_0x96d1('0x11')];}))[_0x96d1('0x12')](':');return crypto['createHash'](_0x96d1('0x13'))[_0x96d1('0x14')](_0x51b089)[_0x96d1('0x15')](_0x96d1('0x16'));}exports[_0x96d1('0x17')]=function(){switch(os['platform']()){case'win32':return exec(_0x96d1('0x18'),{'encoding':_0x96d1('0x19')})[_0x96d1('0x1a')]('\x0d\x0a','');default:var _0x9eb2c4=getFirstInterface();var _0x2d521d=getCPUhash();var _0x3e9a0=_0x2d521d+'|'+os[_0x96d1('0x1b')]()+'|'+_0x9eb2c4[_0x96d1('0x1c')]+'|'+_0x9eb2c4[_0x96d1('0x1d')];var _0x5853f0=crypto[_0x96d1('0x1e')](_0x96d1('0x13'))[_0x96d1('0x14')](_0x3e9a0)[_0x96d1('0x15')](_0x96d1('0x16'));return _0x5853f0['substring'](0x0,0x8)+'-'+_0x5853f0[_0x96d1('0x1f')](0x8,0xc)+'-'+_0x5853f0[_0x96d1('0x1f')](0xc,0x10)+'-'+_0x5853f0[_0x96d1('0x1f')](0x10,0x14)+'-'+_0x5853f0[_0x96d1('0x1f')](0x14);}}; \ No newline at end of file +var _0x379e=['md5','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','lodash','execSync','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','model','join','createHash'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x379e,0x104));var _0xe379=function(_0x15e04a,_0x5c3c25){_0x15e04a=_0x15e04a-0x0;var _0x8beb80=_0x379e[_0x15e04a];return _0x8beb80;};'use strict';var _=require(_0xe379('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xe379('0x1')];function getInterfaces(){var _0xccbef2=[];var _0x1e24f9=os[_0xe379('0x2')]();var _0x3db31a=_[_0xe379('0x3')](_[_0xe379('0x4')](_0x1e24f9));for(var _0x5ebed1=0x0;_0x5ebed1<_0x3db31a[_0xe379('0x5')];_0x5ebed1++){var _0x24221c=_0x1e24f9[_0x3db31a[_0x5ebed1]][_0xe379('0x6')](function(_0x1b6fed){return _0x1b6fed[_0xe379('0x7')]==='IPv4'&&_0x1b6fed[_0xe379('0x8')]===![];});_0xccbef2=_0xccbef2[_0xe379('0x9')](_0x24221c);}return _0xccbef2;}function getFirstInterface(){var _0x29537d=_[_0xe379('0xa')](getInterfaces());return{'macAddress':_0x29537d&&_0x29537d[_0xe379('0xb')]?_0x29537d[_0xe379('0xb')]:_0xe379('0xc'),'ipAddress':_0x29537d&&_0x29537d[_0xe379('0xd')]?_0x29537d[_0xe379('0xd')]:'127.0.0.1'};}exports[_0xe379('0xe')]=getFirstInterface;function getCPUhash(){var _0x19631b=_[_0xe379('0x3')](os[_0xe379('0xf')]()['map'](function(_0x4c6562){return _0x4c6562[_0xe379('0x10')];}))[_0xe379('0x11')](':');return crypto[_0xe379('0x12')](_0xe379('0x13'))[_0xe379('0x14')](_0x19631b)[_0xe379('0x15')](_0xe379('0x16'));}exports[_0xe379('0x17')]=function(){switch(os['platform']()){case _0xe379('0x18'):return exec(_0xe379('0x19'),{'encoding':_0xe379('0x1a')})[_0xe379('0x1b')]('\x0d\x0a','');default:var _0x3d9351=getFirstInterface();var _0x3fc4a0=getCPUhash();var _0x48c772=_0x3fc4a0+'|'+os[_0xe379('0x1c')]()+'|'+_0x3d9351['macAddress']+'|'+_0x3d9351[_0xe379('0x1d')];var _0x56c11d=crypto[_0xe379('0x12')](_0xe379('0x13'))[_0xe379('0x14')](_0x48c772)[_0xe379('0x15')]('hex');return _0x56c11d[_0xe379('0x1e')](0x0,0x8)+'-'+_0x56c11d[_0xe379('0x1e')](0x8,0xc)+'-'+_0x56c11d[_0xe379('0x1e')](0xc,0x10)+'-'+_0x56c11d[_0xe379('0x1e')](0x10,0x14)+'-'+_0x56c11d[_0xe379('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index dc7c3f4..470f8d0 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 _0xb98e=['days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','bluebird','pkginfo','version','../environment','./hardware','../logger','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','session','base64','final','createDecipher','secrets','update','utf8','||FIELD||VALUE||\x0a','findOne','admin','|machineUuid|','fullname','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','email','get','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff'];(function(_0x4c0f0a,_0x1899ff){var _0x429d23=function(_0x58cf44){while(--_0x58cf44){_0x4c0f0a['push'](_0x4c0f0a['shift']());}};_0x429d23(++_0x1899ff);}(_0xb98e,0x184));var _0xeb98=function(_0x1ca7ee,_0x73137b){_0x1ca7ee=_0x1ca7ee-0x0;var _0x72152c=_0xb98e[_0x1ca7ee];return _0x72152c;};'use strict';var util=require(_0xeb98('0x0'));var crypto=require(_0xeb98('0x1'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xeb98('0x2'));var pkginfo=require(_0xeb98('0x3'))(module,_0xeb98('0x4'));var db=require('../../mysqldb')['db'];var config=require(_0xeb98('0x5'));var hardware=require(_0xeb98('0x6'));var logger=require(_0xeb98('0x7'))('license');var jira=require(_0xeb98('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x4a7e79){return new BPromise(function(_0x47c83f,_0x41309a){var _0x16a195=util[_0xeb98('0x9')](_0xeb98('0xa'),HOST,_0x4a7e79,module[_0xeb98('0xb')][_0xeb98('0x4')]);if(oldToken){_0x16a195=util[_0xeb98('0x9')](_0xeb98('0xc'),HOST,_0x4a7e79,module['exports'][_0xeb98('0x4')],oldToken);}var _0x8b537e={'uri':_0x16a195,'method':_0xeb98('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x8b537e)[_0xeb98('0xe')](function(_0x1c8990){_0x47c83f(_0x1c8990);})[_0xeb98('0xf')](function(_0x15372d){_0x41309a(_0x15372d);});});}function encryptDate(_0x30cf5b){var _0x2b3f9f=crypto[_0xeb98('0x10')](_0xeb98('0x11'),config['secrets'][_0xeb98('0x12')]);var _0x3ee150=_0x2b3f9f['update'](_0x30cf5b,'utf8',_0xeb98('0x13'));_0x3ee150+=_0x2b3f9f[_0xeb98('0x14')](_0xeb98('0x13'));return _0x3ee150;}function decryptDate(_0x31ff03){var _0xac14bc=crypto[_0xeb98('0x15')](_0xeb98('0x11'),config[_0xeb98('0x16')][_0xeb98('0x12')]);var _0x2fd9c8=_0xac14bc[_0xeb98('0x17')](_0x31ff03,_0xeb98('0x13'),_0xeb98('0x18'));_0x2fd9c8+=_0xac14bc[_0xeb98('0x14')](_0xeb98('0x18'));return _0x2fd9c8;}function sendJiraAlert(_0x1caff9,_0x38b7be,_0x25a13d){var _0xbe8e08=_0xeb98('0x19');return db['User'][_0xeb98('0x1a')]({'where':{'role':_0xeb98('0x1b')},'attributes':['fullname','email'],'raw':!![]})[_0xeb98('0xe')](function(_0x10790d){ADMIN=_0x10790d;_0xbe8e08+='|reason|'+_0x25a13d+'|\x0a';_0xbe8e08+='|uuid|'+_0x1caff9+'|\x0a';_0xbe8e08+=_0xeb98('0x1c')+_0x38b7be+'|\x0a';_0xbe8e08+='|name|'+ADMIN[_0xeb98('0x1d')]+'|\x0a';_0xbe8e08+=_0xeb98('0x1e')+ADMIN['email']+'|\x0a';return _0xbe8e08;})[_0xeb98('0xe')](function(_0xb561eb){var _0x3a3566=hardware[_0xeb98('0x1f')]()[_0xeb98('0x20')];return jira[_0xeb98('0x21')]({'key':_0xeb98('0x22'),'summary':_0xeb98('0x23'),'description':_0xb561eb,'issuetype':_0xeb98('0x24'),'oldToken':_0x1caff9,'newToken':_0x38b7be,'email':ADMIN[_0xeb98('0x25')],'name':ADMIN[_0xeb98('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x3a3566});});}function manageLicense(_0x499ae8,_0x19f31d){var _0x29fecd=_0x19f31d[_0xeb98('0x26')]({'plain':!![]});httpRequest(_0x499ae8)[_0xeb98('0xe')](function(_0x296f65){if(oldToken){oldToken=undefined;}if(_0x296f65[_0xeb98('0x27')]){if(!_0x29fecd[_0xeb98('0x28')]&&_0x29fecd[_0xeb98('0x28')]!=_0x296f65[_0xeb98('0x28')]||_0x29fecd[_0xeb98('0x28')]&&_0x29fecd[_0xeb98('0x29')]){logger[_0xeb98('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x29fecd[_0xeb98('0x28')]&&!_0x29fecd[_0xeb98('0x29')]&&_0x29fecd[_0xeb98('0x28')]!=_0x296f65[_0xeb98('0x28')]){logger['info'](_0xeb98('0x2b'));}if(_0x29fecd[_0xeb98('0x28')]&&!_0x29fecd[_0xeb98('0x29')]&&_0x29fecd[_0xeb98('0x28')]==_0x296f65[_0xeb98('0x28')]){return _0x19f31d;}return _0x19f31d[_0xeb98('0x17')]({'data1':_0x499ae8,'data2':null,'license':_0x296f65['license']});}else{if(_0x296f65['license']||_0x29fecd[_0xeb98('0x28')]){if(!_0x29fecd[_0xeb98('0x29')]){if(_0x29fecd[_0xeb98('0x2c')]==_0x499ae8){GRAY_PERIOD_REASON=_0xeb98('0x2d');logger[_0xeb98('0x2a')](_0xeb98('0x2e'));}else{GRAY_PERIOD_REASON=_0xeb98('0x2f');oldToken=_0x29fecd[_0xeb98('0x2c')];logger[_0xeb98('0x2a')](_0xeb98('0x30'),_0x29fecd[_0xeb98('0x2c')],_0x499ae8);}sendJiraAlert(_0x29fecd[_0xeb98('0x2c')],_0x296f65[_0xeb98('0x31')],GRAY_PERIOD_REASON);logger[_0xeb98('0x2a')](_0xeb98('0x32'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xeb98('0x9')](_0xeb98('0x33')));return _0x19f31d[_0xeb98('0x17')]({'data2':encryptDate(moment()['format'](_0xeb98('0x33')))});}else{if(moment()[_0xeb98('0x34')](decryptDate(_0x29fecd['data2']),_0xeb98('0x35'))>DAYS){logger[_0xeb98('0x2a')](_0xeb98('0x36'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x19f31d[_0xeb98('0x17')]({'data1':_0x499ae8,'data2':null,'license':null});}}}else{if(_0x29fecd[_0xeb98('0x2c')]!=_0x499ae8){logger[_0xeb98('0x2a')](_0xeb98('0x30'),_0x29fecd['data1'],_0x499ae8);return _0x19f31d[_0xeb98('0x17')]({'data1':_0x499ae8,'data2':null,'license':null});}}}return _0x19f31d;})[_0xeb98('0xe')](function(_0x5b6693){_0x19f31d=_0x5b6693;})[_0xeb98('0xf')](function(_0x59e14c){logger[_0xeb98('0x37')](_0x59e14c[_0xeb98('0x38')]);})[_0xeb98('0x39')](function(){setTimeout(function(){manageLicense(hardware[_0xeb98('0x3a')](),_0x19f31d);},TIME);});}function defaultLicense(){var _0x256737=hardware['getUuid']();if(_0x256737){return db['License'][_0xeb98('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x256737}})[_0xeb98('0x3c')](function(_0x1ae437,_0xa4d8aa){logger[_0xeb98('0x2a')](_0xeb98('0x3d'),_0x256737);manageLicense(_0x256737,_0x1ae437);})[_0xeb98('0xf')](function(_0x23610c){logger[_0xeb98('0x37')](_0x23610c[_0xeb98('0x38')]);});}}exports[_0xeb98('0x3e')]=defaultLicense; \ No newline at end of file +var _0x3588=['getUuid','License','spread','default','util','crypto','moment','request-promise','bluebird','pkginfo','version','../environment','./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','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','||FIELD||VALUE||\x0a','User','findOne','admin','|reason|','|name|','|email|','email','getFirstInterface','ipAddress','MOTLICENSE','Alert','fullname','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x3588,0x82));var _0x8358=function(_0x47470f,_0x411315){_0x47470f=_0x47470f-0x0;var _0x5b16a4=_0x3588[_0x47470f];return _0x5b16a4;};'use strict';var util=require(_0x8358('0x0'));var crypto=require(_0x8358('0x1'));var moment=require(_0x8358('0x2'));var rp=require(_0x8358('0x3'));var BPromise=require(_0x8358('0x4'));var pkginfo=require(_0x8358('0x5'))(module,_0x8358('0x6'));var db=require('../../mysqldb')['db'];var config=require(_0x8358('0x7'));var hardware=require(_0x8358('0x8'));var logger=require(_0x8358('0x9'))(_0x8358('0xa'));var jira=require('../../api/jira/jira.controller');var HOST=_0x8358('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x846201){return new BPromise(function(_0x49d515,_0x11d369){var _0x583720=util[_0x8358('0xc')](_0x8358('0xd'),HOST,_0x846201,module[_0x8358('0xe')][_0x8358('0x6')]);if(oldToken){_0x583720=util['format'](_0x8358('0xf'),HOST,_0x846201,module['exports'][_0x8358('0x6')],oldToken);}var _0x3a0bd9={'uri':_0x583720,'method':_0x8358('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x3a0bd9)[_0x8358('0x11')](function(_0x12fd8f){_0x49d515(_0x12fd8f);})[_0x8358('0x12')](function(_0x3fea96){_0x11d369(_0x3fea96);});});}function encryptDate(_0xf6d13f){var _0x3cf276=crypto[_0x8358('0x13')](_0x8358('0x14'),config[_0x8358('0x15')][_0x8358('0x16')]);var _0xc9a911=_0x3cf276[_0x8358('0x17')](_0xf6d13f,_0x8358('0x18'),'base64');_0xc9a911+=_0x3cf276['final'](_0x8358('0x19'));return _0xc9a911;}function decryptDate(_0x4bad9c){var _0x19da0b=crypto['createDecipher']('aes-256-ctr',config['secrets'][_0x8358('0x16')]);var _0x31d71f=_0x19da0b[_0x8358('0x17')](_0x4bad9c,_0x8358('0x19'),_0x8358('0x18'));_0x31d71f+=_0x19da0b[_0x8358('0x1a')](_0x8358('0x18'));return _0x31d71f;}function sendJiraAlert(_0x524bfb,_0x7695cd,_0x3f2701){var _0x4d5fb0=_0x8358('0x1b');return db[_0x8358('0x1c')][_0x8358('0x1d')]({'where':{'role':_0x8358('0x1e')},'attributes':['fullname','email'],'raw':!![]})[_0x8358('0x11')](function(_0x177c4f){ADMIN=_0x177c4f;_0x4d5fb0+=_0x8358('0x1f')+_0x3f2701+'|\x0a';_0x4d5fb0+='|uuid|'+_0x524bfb+'|\x0a';_0x4d5fb0+='|machineUuid|'+_0x7695cd+'|\x0a';_0x4d5fb0+=_0x8358('0x20')+ADMIN['fullname']+'|\x0a';_0x4d5fb0+=_0x8358('0x21')+ADMIN[_0x8358('0x22')]+'|\x0a';return _0x4d5fb0;})[_0x8358('0x11')](function(_0x21e9ad){var _0x25d82a=hardware[_0x8358('0x23')]()[_0x8358('0x24')];return jira['openIssue']({'key':_0x8358('0x25'),'summary':'Motion\x20License\x20Alert','description':_0x21e9ad,'issuetype':_0x8358('0x26'),'oldToken':_0x524bfb,'newToken':_0x7695cd,'email':ADMIN['email'],'name':ADMIN[_0x8358('0x27')],'reason':GRAY_PERIOD_REASON,'ip':_0x25d82a});});}function manageLicense(_0x1beaa7,_0x3a707c){var _0x542499=_0x3a707c[_0x8358('0x28')]({'plain':!![]});httpRequest(_0x1beaa7)[_0x8358('0x11')](function(_0x12dc59){if(oldToken){oldToken=undefined;}if(_0x12dc59[_0x8358('0x29')]){if(!_0x542499[_0x8358('0xa')]&&_0x542499[_0x8358('0xa')]!=_0x12dc59[_0x8358('0xa')]||_0x542499['license']&&_0x542499[_0x8358('0x2a')]){logger[_0x8358('0x2b')](_0x8358('0x2c'));}if(_0x542499[_0x8358('0xa')]&&!_0x542499[_0x8358('0x2a')]&&_0x542499[_0x8358('0xa')]!=_0x12dc59[_0x8358('0xa')]){logger[_0x8358('0x2b')](_0x8358('0x2d'));}if(_0x542499[_0x8358('0xa')]&&!_0x542499[_0x8358('0x2a')]&&_0x542499[_0x8358('0xa')]==_0x12dc59[_0x8358('0xa')]){return _0x3a707c;}return _0x3a707c['update']({'data1':_0x1beaa7,'data2':null,'license':_0x12dc59[_0x8358('0xa')]});}else{if(_0x12dc59['license']||_0x542499['license']){if(!_0x542499[_0x8358('0x2a')]){if(_0x542499[_0x8358('0x2e')]==_0x1beaa7){GRAY_PERIOD_REASON=_0x8358('0x2f');logger[_0x8358('0x2b')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x8358('0x30');oldToken=_0x542499[_0x8358('0x2e')];logger[_0x8358('0x2b')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x542499[_0x8358('0x2e')],_0x1beaa7);}sendJiraAlert(_0x542499[_0x8358('0x2e')],_0x12dc59[_0x8358('0x31')],GRAY_PERIOD_REASON);logger[_0x8358('0x2b')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x8358('0x32')](),moment()['format'](_0x8358('0x33')));return _0x3a707c[_0x8358('0x17')]({'data2':encryptDate(moment()[_0x8358('0xc')](_0x8358('0x33')))});}else{if(moment()[_0x8358('0x34')](decryptDate(_0x542499[_0x8358('0x2a')]),_0x8358('0x35'))>DAYS){logger[_0x8358('0x2b')](_0x8358('0x36'),moment()[_0x8358('0xc')](_0x8358('0x33')));return _0x3a707c['update']({'data1':_0x1beaa7,'data2':null,'license':null});}}}else{if(_0x542499['data1']!=_0x1beaa7){logger[_0x8358('0x2b')](_0x8358('0x37'),_0x542499[_0x8358('0x2e')],_0x1beaa7);return _0x3a707c[_0x8358('0x17')]({'data1':_0x1beaa7,'data2':null,'license':null});}}}return _0x3a707c;})['then'](function(_0x5a2e9d){_0x3a707c=_0x5a2e9d;})[_0x8358('0x12')](function(_0x45c08b){logger[_0x8358('0x38')](_0x45c08b[_0x8358('0x39')]);})[_0x8358('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0x8358('0x3b')](),_0x3a707c);},TIME);});}function defaultLicense(){var _0x4b7186=hardware[_0x8358('0x3b')]();if(_0x4b7186){return db[_0x8358('0x3c')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4b7186}})[_0x8358('0x3d')](function(_0x9aced3,_0x26ef7c){logger[_0x8358('0x2b')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4b7186);manageLicense(_0x4b7186,_0x9aced3);})[_0x8358('0x12')](function(_0x2a4b27){logger[_0x8358('0x38')](_0x2a4b27['message']);});}}exports[_0x8358('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index afc51cf..cf8a8c1 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 _0xfa12=['Demo\x20license','defaults','checkLicense','crypto','util','lodash','../environment','../../mysqldb','license','isEmpty','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','uuid','machineUuid','getUuid','session','final','gray','deadline','add','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message'];(function(_0x2f5b22,_0x37a632){var _0x1db4f1=function(_0x27fd45){while(--_0x27fd45){_0x2f5b22['push'](_0x2f5b22['shift']());}};_0x1db4f1(++_0x37a632);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x171b1b,_0x57c370){_0x171b1b=_0x171b1b-0x0;var _0x5429ec=_0xfa12[_0x171b1b];return _0x5429ec;};'use strict';var crypto=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var _=require(_0x2fa1('0x2'));var moment=require('moment');var hardware=require('./hardware');var config=require(_0x2fa1('0x3'));var db=require(_0x2fa1('0x4'))['db'];function checkLicense(_0x4b6cd7,_0x4ec644){if(_0x4b6cd7){try{var _0x41eaf6=_0x4ec644||_0x4b6cd7[_0x2fa1('0x5')];if(_[_0x2fa1('0x6')](_0x41eaf6)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x19a57a=_0x4b6cd7['data1'];var _0xfa25d9=_0x4b6cd7[_0x2fa1('0x7')];var _0x3ee801=_0x19a57a[_0x2fa1('0x8')]('-')[0x4];var _0x1c2df0=_0x19a57a[_0x2fa1('0x8')]('-')[0x0];var _0x4e3028=crypto[_0x2fa1('0x9')](_0x2fa1('0xa'),util[_0x2fa1('0xb')](_0x2fa1('0xc'),_0x3ee801,_0x19a57a,_0x1c2df0));var _0xa714a=_0x4e3028[_0x2fa1('0xd')](_0x41eaf6,_0x2fa1('0xe'),_0x2fa1('0xf'));_0xa714a+=_0x4e3028['final'](_0x2fa1('0xf'));var _0x4ad9b1=JSON[_0x2fa1('0x10')](_0xa714a);_0x4ad9b1['demo']=![];_0x4ad9b1[_0x2fa1('0x11')]=_0x19a57a;_0x4ad9b1[_0x2fa1('0x12')]=hardware[_0x2fa1('0x13')]();if(_0xfa25d9){var _0x17ae9f=crypto[_0x2fa1('0x9')](_0x2fa1('0xa'),config['secrets'][_0x2fa1('0x14')]);var _0x583134=_0x17ae9f[_0x2fa1('0xd')](_0xfa25d9,_0x2fa1('0xe'),'utf8');_0x583134+=_0x17ae9f[_0x2fa1('0x15')](_0x2fa1('0xf'));_0x4ad9b1[_0x2fa1('0x16')]=_0x583134;_0x4ad9b1[_0x2fa1('0x17')]=moment(_0x583134)[_0x2fa1('0x18')](0x7,'days')['format']();_0x4ad9b1[_0x2fa1('0x19')]=_0x4ad9b1['uuid']!=_0x4ad9b1[_0x2fa1('0x12')]?_0x2fa1('0x1a'):_0x2fa1('0x1b');}return _0x4ad9b1;}catch(_0x5bfcd9){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2fa1('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2fa1('0x1d'),'uuid':_0x4b6cd7['data1'],'machineUuid':hardware[_0x2fa1('0x13')](),'message':_0x5bfcd9[_0x2fa1('0x1e')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2fa1('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x2fa1('0x1f'),'uuid':_0x4b6cd7['data1'],'machineUuid':hardware[_0x2fa1('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x2ffe87){return db['License']['find'](_[_0x2fa1('0x20')](_0x2ffe87,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1c4f31){return checkLicense(_0x1c4f31,null);});};exports[_0x2fa1('0x21')]=checkLicense; \ No newline at end of file +var _0xc4ea=['Demo\x20license','getLicense','License','find','checkLicense','util','lodash','moment','../../mysqldb','license','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','demo','uuid','machineUuid','getUuid','secrets','session','gray','deadline','add','days','changed','disabled','2027-01-01T00:00:00.000Z'];(function(_0x1825ac,_0x3eb421){var _0xc4551=function(_0x33e9ae){while(--_0x33e9ae){_0x1825ac['push'](_0x1825ac['shift']());}};_0xc4551(++_0x3eb421);}(_0xc4ea,0x1ef));var _0xac4e=function(_0x33b0bc,_0x3b8f26){_0x33b0bc=_0x33b0bc-0x0;var _0x1a2057=_0xc4ea[_0x33b0bc];return _0x1a2057;};'use strict';var crypto=require('crypto');var util=require(_0xac4e('0x0'));var _=require(_0xac4e('0x1'));var moment=require(_0xac4e('0x2'));var hardware=require('./hardware');var config=require('../environment');var db=require(_0xac4e('0x3'))['db'];function checkLicense(_0x361d99,_0x2db72c){if(_0x361d99){try{var _0x3b0539=_0x2db72c||_0x361d99[_0xac4e('0x4')];if(_['isEmpty'](_0x3b0539)){throw new Error(_0xac4e('0x5'));}var _0x44b905=_0x361d99[_0xac4e('0x6')];var _0x2ee5d4=_0x361d99[_0xac4e('0x7')];var _0x336798=_0x44b905[_0xac4e('0x8')]('-')[0x4];var _0x4e56d2=_0x44b905[_0xac4e('0x8')]('-')[0x0];var _0x191130=crypto[_0xac4e('0x9')]('aes-256-ctr',util[_0xac4e('0xa')](_0xac4e('0xb'),_0x336798,_0x44b905,_0x4e56d2));var _0x138e74=_0x191130[_0xac4e('0xc')](_0x3b0539,_0xac4e('0xd'),_0xac4e('0xe'));_0x138e74+=_0x191130[_0xac4e('0xf')](_0xac4e('0xe'));var _0x139eb2=JSON[_0xac4e('0x10')](_0x138e74);_0x139eb2[_0xac4e('0x11')]=![];_0x139eb2[_0xac4e('0x12')]=_0x44b905;_0x139eb2[_0xac4e('0x13')]=hardware[_0xac4e('0x14')]();if(_0x2ee5d4){var _0x5cf65c=crypto[_0xac4e('0x9')]('aes-256-ctr',config[_0xac4e('0x15')][_0xac4e('0x16')]);var _0x507592=_0x5cf65c[_0xac4e('0xc')](_0x2ee5d4,_0xac4e('0xd'),_0xac4e('0xe'));_0x507592+=_0x5cf65c[_0xac4e('0xf')]('utf8');_0x139eb2[_0xac4e('0x17')]=_0x507592;_0x139eb2[_0xac4e('0x18')]=moment(_0x507592)[_0xac4e('0x19')](0x7,_0xac4e('0x1a'))['format']();_0x139eb2['grayReason']=_0x139eb2[_0xac4e('0x12')]!=_0x139eb2[_0xac4e('0x13')]?_0xac4e('0x1b'):_0xac4e('0x1c');}return _0x139eb2;}catch(_0x28d0b2){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xac4e('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x361d99[_0xac4e('0x6')],'machineUuid':hardware[_0xac4e('0x14')](),'message':_0x28d0b2['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xac4e('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xac4e('0x1e'),'uuid':_0x361d99[_0xac4e('0x6')],'machineUuid':hardware[_0xac4e('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xac4e('0x1f')]=function(_0x5a5511){return db[_0xac4e('0x20')][_0xac4e('0x21')](_['defaults'](_0x5a5511,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5ab54e){return checkLicense(_0x5ab54e,null);});};exports[_0xac4e('0x22')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 30e35f3..1b24a76 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 _0x6e90=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6e90,0xf5));var _0x06e9=function(_0xeab9a7,_0x167d13){_0xeab9a7=_0xeab9a7-0x0;var _0xfb6691=_0x6e90[_0xeab9a7];return _0xfb6691;};'use strict';module[_0x06e9('0x0')]={'DOMAIN':_0x06e9('0x1'),'SESSION_SECRET':_0x06e9('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x06e9('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x85cf=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x246890,_0x46b964){var _0x2b2a5a=function(_0x4f1232){while(--_0x4f1232){_0x246890['push'](_0x246890['shift']());}};_0x2b2a5a(++_0x46b964);}(_0x85cf,0x76));var _0xf85c=function(_0xfde94a,_0x23a49b){_0xfde94a=_0xfde94a-0x0;var _0x1d0aee=_0x85cf[_0xfde94a];return _0x1d0aee;};'use strict';module['exports']={'DOMAIN':_0xf85c('0x0'),'SESSION_SECRET':_0xf85c('0x1'),'GOOGLE_ID':_0xf85c('0x2'),'GOOGLE_SECRET':_0xf85c('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index bd631fb..e158252 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf216=['%s-%s','error','transports','info','env','debugLevel','moment','winston','util','path','INFO','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','message','exports','File'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf216,0x9e));var _0x6f21=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf216[_0x411017];return _0x2adeea;};'use strict';var moment=require(_0x6f21('0x0'));var winston=require(_0x6f21('0x1'));var util=require(_0x6f21('0x2'));var path=require(_0x6f21('0x3'));var debugLevel=_0x6f21('0x4');function filename(_0x250d3e,_0x1e1435){return path['join']('/var',_0x6f21('0x5'),_0x6f21('0x6'),util[_0x6f21('0x7')]('%s-%s.log',_0x250d3e,_0x1e1435));}function formatter(_0x18e85e,_0x23b6a6){return util['format'](_0x6f21('0x8'),moment()[_0x6f21('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x23b6a6[_0x6f21('0x9')]['toUpperCase'](),_0x18e85e,_0x23b6a6[_0x6f21('0xa')]);}module[_0x6f21('0xb')]=function(_0x5f1acc){return new winston['Logger']({'transports':[new winston['transports'][(_0x6f21('0xc'))]({'name':util[_0x6f21('0x7')](_0x6f21('0xd'),_0x5f1acc,_0x6f21('0xe')),'filename':filename(_0x5f1acc,'error'),'level':_0x6f21('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x79372c){return formatter(_0x5f1acc,_0x79372c);}}),new winston[(_0x6f21('0xf'))][(_0x6f21('0xc'))]({'name':util['format'](_0x6f21('0xd'),_0x5f1acc,'info'),'filename':filename(_0x5f1acc,_0x6f21('0x10')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x55d0c2){return formatter(_0x5f1acc,_0x55d0c2);}}),new winston[(_0x6f21('0xf'))]['Console']({'level':process[_0x6f21('0x11')][_0x6f21('0x12')]||debugLevel,'json':![],'formatter':function(_0x837862){return formatter(_0x5f1acc,_0x837862);}})]});}; \ No newline at end of file +var _0x5f83=['INFO','join','/var','xcally','format','%s-%s.log','message','exports','File','error','info','transports','Console','moment','path'];(function(_0x4279ea,_0x8c9fc2){var _0x151c20=function(_0x4f8a5f){while(--_0x4f8a5f){_0x4279ea['push'](_0x4279ea['shift']());}};_0x151c20(++_0x8c9fc2);}(_0x5f83,0x1ed));var _0x35f8=function(_0x9442b7,_0x56fbd8){_0x9442b7=_0x9442b7-0x0;var _0x1a2b51=_0x5f83[_0x9442b7];return _0x1a2b51;};'use strict';var moment=require(_0x35f8('0x0'));var winston=require('winston');var util=require('util');var path=require(_0x35f8('0x1'));var debugLevel=_0x35f8('0x2');function filename(_0x39b868,_0x7b4e33){return path[_0x35f8('0x3')](_0x35f8('0x4'),'log',_0x35f8('0x5'),util[_0x35f8('0x6')](_0x35f8('0x7'),_0x39b868,_0x7b4e33));}function formatter(_0x1d42ed,_0x4bbd4f){return util[_0x35f8('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x35f8('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4bbd4f['level']['toUpperCase'](),_0x1d42ed,_0x4bbd4f[_0x35f8('0x8')]);}module[_0x35f8('0x9')]=function(_0x19d48){return new winston['Logger']({'transports':[new winston['transports'][(_0x35f8('0xa'))]({'name':util[_0x35f8('0x6')]('%s-%s',_0x19d48,'error'),'filename':filename(_0x19d48,_0x35f8('0xb')),'level':_0x35f8('0xb'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xbf5f7c){return formatter(_0x19d48,_0xbf5f7c);}}),new winston['transports'][(_0x35f8('0xa'))]({'name':util[_0x35f8('0x6')]('%s-%s',_0x19d48,_0x35f8('0xc')),'filename':filename(_0x19d48,_0x35f8('0xc')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x11e720){return formatter(_0x19d48,_0x11e720);}}),new winston[(_0x35f8('0xd'))][(_0x35f8('0xe'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x32eca6){return formatter(_0x19d48,_0x32eca6);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d5e39ff..e8dea15 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 _0xd851=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','ami','join','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x353b63,_0x456db0){var _0x361bc6=function(_0x174bfa){while(--_0x174bfa){_0x353b63['push'](_0x353b63['shift']());}};_0x361bc6(++_0x456db0);}(_0xd851,0x148));var _0x1d85=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0xd851[_0x69a451];return _0x3d6ef5;};'use strict';var path=require(_0x1d85('0x0'));var os=require('os');var config={'apps':[{'name':_0x1d85('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x1d85('0x2'),'script':path[_0x1d85('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x1d85('0x4'),'script':path['join'](__dirname,_0x1d85('0x5'))},{'name':_0x1d85('0x6'),'script':path[_0x1d85('0x3')](__dirname,_0x1d85('0x7'))},{'name':'routing','script':path[_0x1d85('0x3')](__dirname,_0x1d85('0x8'))},{'name':_0x1d85('0x9'),'script':path[_0x1d85('0x3')](__dirname,_0x1d85('0xa'))}]};module[_0x1d85('0xb')]=config; \ No newline at end of file +var _0x5b6b=['exports','path','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js'];(function(_0x1b7afa,_0x4be0ea){var _0x570d2c=function(_0xf743ec){while(--_0xf743ec){_0x1b7afa['push'](_0x1b7afa['shift']());}};_0x570d2c(++_0x4be0ea);}(_0x5b6b,0x121));var _0xb5b6=function(_0x56ae7d,_0x2455e0){_0x56ae7d=_0x56ae7d-0x0;var _0x43bf23=_0x5b6b[_0x56ae7d];return _0x43bf23;};'use strict';var path=require(_0xb5b6('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xb5b6('0x1')](__dirname,'../../services/express/index.js')},{'name':_0xb5b6('0x2'),'script':path[_0xb5b6('0x1')](__dirname,_0xb5b6('0x3'))},{'name':_0xb5b6('0x4'),'script':path[_0xb5b6('0x1')](__dirname,_0xb5b6('0x5'))},{'name':_0xb5b6('0x6'),'script':path[_0xb5b6('0x1')](__dirname,_0xb5b6('0x7'))},{'name':_0xb5b6('0x8'),'script':path[_0xb5b6('0x1')](__dirname,'../../services/routing/index.js')},{'name':_0xb5b6('0x9'),'script':path[_0xb5b6('0x1')](__dirname,_0xb5b6('0xa'))}]};module[_0xb5b6('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 90c4fa0..3468fa6 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 _0xd90b=['start','then','disconnect','stop','restart','describe','delete','dump','saved','pm2'];(function(_0x32093d,_0x894489){var _0x3a9574=function(_0x21aac4){while(--_0x21aac4){_0x32093d['push'](_0x32093d['shift']());}};_0x3a9574(++_0x894489);}(_0xd90b,0xbd));var _0xbd90=function(_0x1dacbe,_0x2533f5){_0x1dacbe=_0x1dacbe-0x0;var _0x5c2ffe=_0xd90b[_0x1dacbe];return _0x5c2ffe;};'use strict';var pm2=require(_0xbd90('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x2f8d43,_0x5a9a50){return pm2['connect'](function(_0x40bb8c){if(_0x40bb8c){return _0x5a9a50(_0x40bb8c);}return _0x2f8d43('connected');});});};exports[_0xbd90('0x1')]=function(_0x1813c7){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x948d45,_0x448c24){return pm2[_0xbd90('0x1')](_0x1813c7,function(_0x524ad0,_0x3c1098){if(_0x524ad0){return _0x448c24(_0x524ad0);}pm2[_0xbd90('0x3')]();return _0x948d45(_0x3c1098);});});});};exports[_0xbd90('0x4')]=function(_0x21b464){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x3da600,_0x45f5af){return pm2[_0xbd90('0x4')](_0x21b464,function(_0x35b7cb,_0x3eec4a){if(_0x35b7cb){return _0x45f5af(_0x35b7cb);}pm2[_0xbd90('0x3')]();return _0x3da600(_0x3eec4a);});});});};exports['restart']=function(_0x32cfca){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x546fef,_0x57eb75){return pm2[_0xbd90('0x5')](_0x32cfca,function(_0x17adb4,_0x289891){if(_0x17adb4){return _0x57eb75(_0x17adb4);}pm2[_0xbd90('0x3')]();return _0x546fef(_0x289891);});});});};exports['list']=function(){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x5c7d96,_0x5ef084){return pm2['list'](function(_0xcb2f72,_0xdbdbf9){if(_0xcb2f72){return _0x5ef084(_0xcb2f72);}pm2[_0xbd90('0x3')]();return _0x5c7d96(_0xdbdbf9);});});});};exports[_0xbd90('0x6')]=function(_0x75d333){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x5eea50,_0x15f3ac){return pm2[_0xbd90('0x6')](_0x75d333,function(_0x4c6b76,_0x172871){if(_0x4c6b76){return _0x15f3ac(_0x4c6b76);}pm2[_0xbd90('0x3')]();return _0x5eea50(_0x172871);});});});};exports[_0xbd90('0x7')]=function(_0x516f4b){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x8fd858,_0xb23a81){return pm2[_0xbd90('0x7')](_0x516f4b,function(_0x5baabe,_0x57811c){if(_0x5baabe){return _0xb23a81(_0x5baabe);}pm2[_0xbd90('0x3')]();return _0x8fd858(_0x57811c);});});});};exports['dump']=function(){return connect()[_0xbd90('0x2')](function(){return new BPromise(function(_0x35a139,_0x1793c5){return pm2[_0xbd90('0x8')](function(_0x433101){if(_0x433101){return _0x1793c5(_0x433101);}return _0x35a139(_0xbd90('0x9'));});});});}; \ No newline at end of file +var _0xb7a7=['then','restart','list','describe','delete','dump','pm2','bluebird','./config','connected','start','disconnect','stop'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x305081,_0x4fec5f){_0x305081=_0x305081-0x0;var _0xc5684e=_0xb7a7[_0x305081];return _0xc5684e;};'use strict';var pm2=require(_0x7b7a('0x0'));var BPromise=require(_0x7b7a('0x1'));var config=require(_0x7b7a('0x2'));function connect(){return new BPromise(function(_0x2750c2,_0xdc2ef1){return pm2['connect'](function(_0x51de97){if(_0x51de97){return _0xdc2ef1(_0x51de97);}return _0x2750c2(_0x7b7a('0x3'));});});};exports[_0x7b7a('0x4')]=function(_0x42d678){return connect()['then'](function(){return new BPromise(function(_0x8a892f,_0x6e7b3c){return pm2[_0x7b7a('0x4')](_0x42d678,function(_0xf003bc,_0x8e6a84){if(_0xf003bc){return _0x6e7b3c(_0xf003bc);}pm2[_0x7b7a('0x5')]();return _0x8a892f(_0x8e6a84);});});});};exports[_0x7b7a('0x6')]=function(_0x2e09b4){return connect()[_0x7b7a('0x7')](function(){return new BPromise(function(_0x4ae895,_0x3f1125){return pm2['stop'](_0x2e09b4,function(_0x14ed0e,_0x21c573){if(_0x14ed0e){return _0x3f1125(_0x14ed0e);}pm2[_0x7b7a('0x5')]();return _0x4ae895(_0x21c573);});});});};exports[_0x7b7a('0x8')]=function(_0x156e80){return connect()['then'](function(){return new BPromise(function(_0x5207bb,_0x56c0b8){return pm2['restart'](_0x156e80,function(_0x430256,_0x1413f8){if(_0x430256){return _0x56c0b8(_0x430256);}pm2['disconnect']();return _0x5207bb(_0x1413f8);});});});};exports[_0x7b7a('0x9')]=function(){return connect()[_0x7b7a('0x7')](function(){return new BPromise(function(_0x318b50,_0x3776a4){return pm2[_0x7b7a('0x9')](function(_0x24e334,_0x2a8585){if(_0x24e334){return _0x3776a4(_0x24e334);}pm2[_0x7b7a('0x5')]();return _0x318b50(_0x2a8585);});});});};exports[_0x7b7a('0xa')]=function(_0x3b1998){return connect()['then'](function(){return new BPromise(function(_0x582062,_0x150104){return pm2[_0x7b7a('0xa')](_0x3b1998,function(_0x3a10a9,_0x41f0a8){if(_0x3a10a9){return _0x150104(_0x3a10a9);}pm2[_0x7b7a('0x5')]();return _0x582062(_0x41f0a8);});});});};exports['delete']=function(_0x36d78d){return connect()['then'](function(){return new BPromise(function(_0x430c11,_0x763b6){return pm2[_0x7b7a('0xb')](_0x36d78d,function(_0x35e2d4,_0x2569bd){if(_0x35e2d4){return _0x763b6(_0x35e2d4);}pm2[_0x7b7a('0x5')]();return _0x430c11(_0x2569bd);});});});};exports[_0x7b7a('0xc')]=function(){return connect()[_0x7b7a('0x7')](function(){return new BPromise(function(_0x2cb0b4,_0x1c897d){return pm2[_0x7b7a('0xc')](function(_0x402794){if(_0x402794){return _0x1c897d(_0x402794);}return _0x2cb0b4('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 394ddda..ad51ab3 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 _0xcfad=['error','start','lodash','ioredis','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','system','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length','chatInteraction:update','catch'];(function(_0x118e31,_0x2c3d3f){var _0x13c8c0=function(_0x1d2943){while(--_0x1d2943){_0x118e31['push'](_0x118e31['shift']());}};_0x13c8c0(++_0x2c3d3f);}(_0xcfad,0x12e));var _0xdcfa=function(_0xe5ba6e,_0x57e369){_0xe5ba6e=_0xe5ba6e-0x0;var _0x8046b6=_0xcfad[_0xe5ba6e];return _0x8046b6;};'use strict';var _=require(_0xdcfa('0x0'));var moment=require('moment');var Redis=require(_0xdcfa('0x1'));var db=require(_0xdcfa('0x2'))['db'];var config=require(_0xdcfa('0x3'));config[_0xdcfa('0x4')]=_['defaults'](config[_0xdcfa('0x4')],{'host':_0xdcfa('0x5'),'port':0x18eb});var io=require(_0xdcfa('0x6'))(new Redis(config[_0xdcfa('0x4')]));function closeInteractions(){var _0x2679ee=0x0;var _0x3cb839=[];return db[_0xdcfa('0x7')][_0xdcfa('0x8')]({'raw':!![],'attributes':['id',_0xdcfa('0x9')],'where':{'id':0x1}})[_0xdcfa('0xa')](function(_0x3ab31e){_0x2679ee=_0x3ab31e[_0xdcfa('0x9')];if(_0x2679ee){return db[_0xdcfa('0xb')][_0xdcfa('0xc')]({'raw':!![],'attributes':['id',_0xdcfa('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xdcfa('0xe')](_0x3ab31e[_0xdcfa('0x9')],_0xdcfa('0xf'))}}});}else{return[];}})['then'](function(_0x5bc13d){_0x3cb839=_0x5bc13d;if(_0x2679ee){return db[_0xdcfa('0xb')]['update']({'closeReason':_0xdcfa('0x10'),'disposition':_0xdcfa('0x11'),'closed':!![],'closedAt':moment()['format'](_0xdcfa('0x12'))},{'where':{'id':_[_0xdcfa('0x13')](_0x3cb839||[],'id')}});}})[_0xdcfa('0xa')](function(_0x2c830b){for(var _0x196e3d=0x0;_0x196e3d<_0x3cb839[_0xdcfa('0x14')];_0x196e3d++){io['emit'](_0xdcfa('0x15'),{'id':_0x3cb839[_0x196e3d]['id'],'closed':!![]});}})[_0xdcfa('0x16')](function(_0x1cfd04){console[_0xdcfa('0x17')](_0x1cfd04);});}exports[_0xdcfa('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3d1d=['length','emit','chatInteraction:update','catch','error','moment','ioredis','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','update','system','format','YYYY-MM-DD\x20HH:mm:ss','map'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x3d1d,0xb4));var _0xd3d1=function(_0x2ec411,_0x4fd58c){_0x2ec411=_0x2ec411-0x0;var _0x1aa774=_0x3d1d[_0x2ec411];return _0x1aa774;};'use strict';var _=require('lodash');var moment=require(_0xd3d1('0x0'));var Redis=require(_0xd3d1('0x1'));var db=require(_0xd3d1('0x2'))['db'];var config=require(_0xd3d1('0x3'));config[_0xd3d1('0x4')]=_['defaults'](config[_0xd3d1('0x4')],{'host':_0xd3d1('0x5'),'port':0x18eb});var io=require(_0xd3d1('0x6'))(new Redis(config[_0xd3d1('0x4')]));function closeInteractions(){var _0x3227aa=0x0;var _0x4fc4ab=[];return db[_0xd3d1('0x7')][_0xd3d1('0x8')]({'raw':!![],'attributes':['id',_0xd3d1('0x9')],'where':{'id':0x1}})[_0xd3d1('0xa')](function(_0x1fad2c){_0x3227aa=_0x1fad2c['chatTimeout'];if(_0x3227aa){return db[_0xd3d1('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xd3d1('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd3d1('0xd')](_0x1fad2c[_0xd3d1('0x9')],_0xd3d1('0xe'))}}});}else{return[];}})[_0xd3d1('0xa')](function(_0x3be108){_0x4fc4ab=_0x3be108;if(_0x3227aa){return db[_0xd3d1('0xb')][_0xd3d1('0xf')]({'closeReason':_0xd3d1('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xd3d1('0x11')](_0xd3d1('0x12'))},{'where':{'id':_[_0xd3d1('0x13')](_0x4fc4ab||[],'id')}});}})['then'](function(_0x344dd6){for(var _0x108afb=0x0;_0x108afb<_0x4fc4ab[_0xd3d1('0x14')];_0x108afb++){io[_0xd3d1('0x15')](_0xd3d1('0x16'),{'id':_0x4fc4ab[_0x108afb]['id'],'closed':!![]});}})[_0xd3d1('0x17')](function(_0x41af85){console[_0xd3d1('0x18')](_0x41af85);});}exports['start']=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 6c39597..0ef511f 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 _0x6242=['catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','jobs','map','toString','keyBy','difference','exists','stop','deleteJob','delete\x20cron','length','index','run\x20job','cron','isBetween','startAt','endAt','start','add\x20cron','active','update','update\x20cron','stop\x20cron','run','util','lodash','moment','jayson/promise','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','%s.%s','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','error','error\x20mail','email\x20sent'];(function(_0x33fd3a,_0x1cf330){var _0x22687a=function(_0x5cd3b2){while(--_0x5cd3b2){_0x33fd3a['push'](_0x33fd3a['shift']());}};_0x22687a(++_0x1cf330);}(_0x6242,0x127));var _0x2624=function(_0x2f38cd,_0x5427bc){_0x2f38cd=_0x2f38cd-0x0;var _0x2cca67=_0x6242[_0x2f38cd];return _0x2cca67;};'use strict';var fs=require('fs');var util=require(_0x2624('0x0'));var path=require('path');var _=require(_0x2624('0x1'));var moment=require(_0x2624('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x2624('0x3'));var BPromise=require(_0x2624('0x4'));var logger=require(_0x2624('0x5'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x2624('0x6'));var analyticDefaultReportController=require(_0x2624('0x7'));var client=jayson['client'][_0x2624('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4819dd,_0x509706){return function(){logger[_0x2624('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4819dd[_0x2624('0xa')]);var _0x3f383a=!![];var _0x5b04b1={'tls':{'rejectUnauthorized':![]}};if(_0x4819dd[_0x2624('0xb')][_0x2624('0xc')][_0x2624('0xd')]){_0x5b04b1['service']=_0x4819dd[_0x2624('0xb')][_0x2624('0xc')]['service'];}else{_0x5b04b1[_0x2624('0xe')]=_0x4819dd[_0x2624('0xb')]['Smtp'][_0x2624('0xe')];_0x5b04b1[_0x2624('0xf')]=_0x4819dd[_0x2624('0xb')][_0x2624('0xc')]['port'];_0x5b04b1['secure']=_0x4819dd[_0x2624('0xb')]['Smtp'][_0x2624('0x10')];}if(_0x4819dd[_0x2624('0xb')][_0x2624('0xc')]['authentication']){_0x5b04b1[_0x2624('0x11')]={'user':_0x4819dd[_0x2624('0xb')][_0x2624('0xc')][_0x2624('0x12')],'pass':_0x4819dd[_0x2624('0xb')]['Smtp'][_0x2624('0x13')]};}var _0x297e64={'account':_0x5b04b1,'message':{'from':util[_0x2624('0x14')]('\x22%s\x22\x20<%s>',_0x4819dd['MailAccount']['name'],_0x4819dd[_0x2624('0xb')]['email']||_0x4819dd[_0x2624('0xb')][_0x2624('0xc')][_0x2624('0x12')]),'to':_0x4819dd[_0x2624('0xa')],'cc':_0x4819dd['cc'],'bcc':_0x4819dd[_0x2624('0x15')],'subject':util[_0x2624('0x14')](_0x2624('0x16'),_0x509706[_0x2624('0x17')],_0x4819dd[_0x2624('0x18')],_0x4819dd['subtractUnit'])}};var _0x4012cc=path[_0x2624('0x19')](__dirname,_0x2624('0x1a'));var _0x4c814b=_0x509706[_0x2624('0x1b')];var _0x4c2365=util['format'](_0x2624('0x1c'),path[_0x2624('0x1d')](_0x509706[_0x2624('0x1b')],path['extname'](_0x509706[_0x2624('0x1b')])),_0x2624('0x1e'));var _0x45a9f9=path[_0x2624('0x19')](_0x4012cc,_0x4c814b);var _0x446c1d=path[_0x2624('0x19')](_0x4012cc,_0x4c2365);if(fs[_0x2624('0x1f')](_0x45a9f9)){_0x509706[_0x2624('0x20')]=_0x2624('0x21');_0x297e64[_0x2624('0x22')][_0x2624('0x23')]=[{'filename':_0x4c814b,'path':_0x45a9f9}];_0x297e64[_0x2624('0x22')][_0x2624('0x24')]=util['format'](_0x2624('0x25'),JSON[_0x2624('0x26')](_0x509706,null,0x2));}else if(fs['existsSync'](_0x446c1d)){_0x509706[_0x2624('0x20')]='Sent';_0x297e64[_0x2624('0x22')][_0x2624('0x23')]=[{'filename':_0x4c2365,'path':_0x446c1d}];}else{_0x297e64[_0x2624('0x22')][_0x2624('0x24')]=_0x2624('0x27');if(!_0x4819dd[_0x2624('0x28')]){_0x3f383a=![];logger[_0x2624('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3f383a){return client[_0x2624('0x29')]('SendMail',_0x297e64)['then'](function(_0x18a24a){if(_0x18a24a['error']){return logger[_0x2624('0x2a')](_0x2624('0x2b'),JSON[_0x2624('0x26')](_0x18a24a));}return logger[_0x2624('0x9')](_0x2624('0x2c'));})[_0x2624('0x2d')](function(_0x168020){return logger[_0x2624('0x2a')](_0x2624('0x2b'),JSON[_0x2624('0x26')](_0x168020));});}};}function handleError(){return function(_0x3d4769){return logger[_0x2624('0x2a')](JSON[_0x2624('0x26')](_0x3d4769));};}function handleResult(_0x412100){return function(_0x3a82d0){logger[_0x2624('0x9')](_0x2624('0x2e'),JSON[_0x2624('0x26')](_0x3a82d0));if(_0x412100[_0x2624('0xb')]&&_0x412100[_0x2624('0xb')][_0x2624('0xc')]&&!_[_0x2624('0x2f')](_0x412100[_0x2624('0xa')])){setTimeout(handleSendEmail(_0x412100,_0x3a82d0),0x3c*0x3e8);}};}function handleJob(_0x4312d7){return function(){try{if(_[_0x2624('0x2f')](_0x4312d7[_0x2624('0x18')])){return logger[_0x2624('0x9')](_0x2624('0x30'));}if(_[_0x2624('0x2f')](_0x4312d7['subtractUnit'])){return logger[_0x2624('0x9')](_0x2624('0x31'));}var _0x2f2e9d={'startDate':moment()['subtract'](_0x4312d7[_0x2624('0x18')],_0x4312d7[_0x2624('0x32')])[_0x2624('0x14')](_0x2624('0x33')),'endDate':moment()[_0x2624('0x14')](_0x2624('0x33')),'type':_0x2624('0x34'),'output':_0x4312d7[_0x2624('0x35')],'name':_0x4312d7['name']};if(!_['isNil'](_0x4312d7[_0x2624('0x36')])){logger['info'](_0x2624('0x37'),_0x4312d7['DefaultReportId']);return analyticDefaultReportController[_0x2624('0x38')]({'id':_0x4312d7['DefaultReportId']},_0x2f2e9d)[_0x2624('0x39')](handleResult(_0x4312d7))[_0x2624('0x2d')](handleError());}if(!_['isNil'](_0x4312d7[_0x2624('0x3a')])){logger[_0x2624('0x9')]('exec\x20custom\x20report\x20id:%s',_0x4312d7[_0x2624('0x3a')]);return analyticCustomReportController[_0x2624('0x38')]({'id':_0x4312d7[_0x2624('0x3a')]},_0x2f2e9d)[_0x2624('0x39')](handleResult(_0x4312d7))[_0x2624('0x2d')](handleError());}}catch(_0x41e62e){logger['error'](JSON['stringify'](_0x41e62e));}return logger[_0x2624('0x9')](_0x2624('0x3b'));};}function getJobs(_0x477d93){var _0x49e2c4={};if(_0x477d93){_0x49e2c4['id']=_0x477d93;}return db[_0x2624('0x3c')]['findAll']({'where':_0x49e2c4,'include':[{'model':db[_0x2624('0xb')],'attributes':['id',_0x2624('0x17'),_0x2624('0xa')],'include':[{'model':db[_0x2624('0x3d')],'as':_0x2624('0xc')}]}]})['then'](function(_0x256228){var _0x472e9c=_['keys'](manager[_0x2624('0x3e')]);var _0x28f417=_[_0x2624('0x3f')](_0x256228,function(_0x4f6916){return _0x4f6916['id'][_0x2624('0x40')]();});var _0x3c95e5=_[_0x2624('0x41')](_0x256228,function(_0x4f4e39){return _0x4f4e39['id'][_0x2624('0x40')]();});var _0x2e8d32=_0x477d93?_0x28f417:_[_0x2624('0x42')](_0x28f417,_0x472e9c);var _0xbd8433=_['intersection'](_0x28f417,_0x472e9c);var _0x5dcc92=_[_0x2624('0x42')](_0x472e9c,_0x28f417);var _0x9410f9;var _0xe47404;for(_0x9410f9=0x0;_0x9410f9<_0x5dcc92['length']&&!_0x477d93;_0x9410f9+=0x1){_0xe47404=_0x5dcc92[_0x9410f9][_0x2624('0x40')]();if(manager[_0x2624('0x43')](_0xe47404)){manager[_0x2624('0x44')](_0xe47404);manager[_0x2624('0x45')](_0xe47404);logger[_0x2624('0x9')](_0x2624('0x46'),_0xe47404);}}logger[_0x2624('0x9')]('toRun',JSON[_0x2624('0x26')](_0x2e8d32));for(_0x9410f9=0x0;_0x9410f9<_0x2e8d32[_0x2624('0x47')];_0x9410f9+=0x1){_0xe47404=_0x2e8d32[_0x9410f9][_0x2624('0x40')]();logger[_0x2624('0x9')](_0x2624('0x48'),_0xe47404);if(_0x477d93){logger[_0x2624('0x9')]('my\x20id',_0x477d93);logger[_0x2624('0x9')](JSON[_0x2624('0x26')](_0x3c95e5[_0xe47404]));BPromise['resolve']()['then'](handleJob(_0x3c95e5[_0xe47404]));logger['info'](_0x2624('0x49'),_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}else if(_0x3c95e5[_0xe47404][_0x2624('0x4a')]&&_0x3c95e5[_0xe47404]['active']&&moment()[_0x2624('0x4b')](_0x3c95e5[_0xe47404][_0x2624('0x4c')],_0x3c95e5[_0xe47404][_0x2624('0x4d')])){manager['add'](_0xe47404,_0x3c95e5[_0xe47404][_0x2624('0x4a')],handleJob(_0x3c95e5[_0xe47404]));manager[_0x2624('0x4e')](_0xe47404);logger[_0x2624('0x9')](_0x2624('0x4f'),_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}else if(manager[_0x2624('0x43')](_0xe47404)){manager[_0x2624('0x44')](_0xe47404);manager['deleteJob'](_0xe47404);logger[_0x2624('0x9')]('stop\x20cron',_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}}for(_0x9410f9=0x0,_0xe47404;_0x9410f9<_0xbd8433[_0x2624('0x47')]&&!_0x477d93;_0x9410f9+=0x1){_0xe47404=_0xbd8433[_0x9410f9][_0x2624('0x40')]();if(manager['exists'](_0xe47404)){if(_0x3c95e5[_0xe47404][_0x2624('0x4a')]&&_0x3c95e5[_0xe47404][_0x2624('0x50')]&&moment()[_0x2624('0x4b')](_0x3c95e5[_0xe47404][_0x2624('0x4c')],_0x3c95e5[_0xe47404][_0x2624('0x4d')])){manager[_0x2624('0x51')](_0xe47404,_0x3c95e5[_0xe47404][_0x2624('0x4a')],handleJob(_0x3c95e5[_0xe47404]));logger[_0x2624('0x9')](_0x2624('0x52'),_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}else{manager[_0x2624('0x44')](_0xe47404);manager[_0x2624('0x45')](_0xe47404);logger['info'](_0x2624('0x53'),_0x3c95e5[_0xe47404][_0x2624('0x17')],_0x3c95e5[_0xe47404][_0x2624('0x4a')]);}}}})[_0x2624('0x2d')](function(_0x30f5e9){logger['error'](JSON[_0x2624('0x26')](_0x30f5e9));});}exports[_0x2624('0x54')]=function(_0x24a89c){return getJobs(_0x24a89c);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd156=['cron','active','isBetween','startAt','start','stop\x20cron','endAt','update','update\x20cron','run','util','moment','cron-job-manager','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','pass','email','user','bcc','format','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','attachments','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','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','email\x20sent','catch','error','error\x20mail','stringify','data','isNil','subtractNumber','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','no\x20report\x20id','Schedule','name','MailServerOut','keys','map','toString','keyBy','difference','length','exists','stop','delete\x20cron','toRun','index','resolve','run\x20job'];(function(_0x2e26e1,_0x2728de){var _0x5241f5=function(_0x3a3e15){while(--_0x3a3e15){_0x2e26e1['push'](_0x2e26e1['shift']());}};_0x5241f5(++_0x2728de);}(_0xd156,0x10f));var _0x6d15=function(_0x54a25b,_0x48f7c5){_0x54a25b=_0x54a25b-0x0;var _0x591489=_0xd156[_0x54a25b];return _0x591489;};'use strict';var fs=require('fs');var util=require(_0x6d15('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x6d15('0x1'));var CronJobManager=require(_0x6d15('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0x6d15('0x3'));var logger=require('../logger')(_0x6d15('0x4'));var db=require(_0x6d15('0x5'))['db'];var analyticCustomReportController=require(_0x6d15('0x6'));var analyticDefaultReportController=require(_0x6d15('0x7'));var client=jayson[_0x6d15('0x8')][_0x6d15('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4d2c80,_0x39809f){return function(){logger[_0x6d15('0xa')](_0x6d15('0xb'),_0x4d2c80['email']);var _0x3faac5=!![];var _0x25a7b4={'tls':{'rejectUnauthorized':![]}};if(_0x4d2c80[_0x6d15('0xc')][_0x6d15('0xd')][_0x6d15('0xe')]){_0x25a7b4['service']=_0x4d2c80['MailAccount']['Smtp'][_0x6d15('0xe')];}else{_0x25a7b4[_0x6d15('0xf')]=_0x4d2c80[_0x6d15('0xc')]['Smtp']['host'];_0x25a7b4[_0x6d15('0x10')]=_0x4d2c80[_0x6d15('0xc')][_0x6d15('0xd')]['port'];_0x25a7b4['secure']=_0x4d2c80['MailAccount']['Smtp']['secure'];}if(_0x4d2c80['MailAccount'][_0x6d15('0xd')]['authentication']){_0x25a7b4['auth']={'user':_0x4d2c80[_0x6d15('0xc')][_0x6d15('0xd')]['user'],'pass':_0x4d2c80[_0x6d15('0xc')][_0x6d15('0xd')][_0x6d15('0x11')]};}var _0x35c829={'account':_0x25a7b4,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4d2c80[_0x6d15('0xc')]['name'],_0x4d2c80['MailAccount'][_0x6d15('0x12')]||_0x4d2c80['MailAccount'][_0x6d15('0xd')][_0x6d15('0x13')]),'to':_0x4d2c80[_0x6d15('0x12')],'cc':_0x4d2c80['cc'],'bcc':_0x4d2c80[_0x6d15('0x14')],'subject':util[_0x6d15('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x39809f['name'],_0x4d2c80['subtractNumber'],_0x4d2c80[_0x6d15('0x16')])}};var _0x40f713=path[_0x6d15('0x17')](__dirname,_0x6d15('0x18'));var _0x5a340c=_0x39809f[_0x6d15('0x19')];var _0x476fba=util[_0x6d15('0x15')](_0x6d15('0x1a'),path[_0x6d15('0x1b')](_0x39809f[_0x6d15('0x19')],path[_0x6d15('0x1c')](_0x39809f[_0x6d15('0x19')])),_0x6d15('0x1d'));var _0x5b3f05=path['join'](_0x40f713,_0x5a340c);var _0x15d63a=path['join'](_0x40f713,_0x476fba);if(fs[_0x6d15('0x1e')](_0x5b3f05)){_0x39809f[_0x6d15('0x1f')]=_0x6d15('0x20');_0x35c829['message'][_0x6d15('0x21')]=[{'filename':_0x5a340c,'path':_0x5b3f05}];_0x35c829[_0x6d15('0x22')][_0x6d15('0x23')]=util['format'](_0x6d15('0x24'),JSON['stringify'](_0x39809f,null,0x2));}else if(fs[_0x6d15('0x1e')](_0x15d63a)){_0x39809f[_0x6d15('0x1f')]=_0x6d15('0x20');_0x35c829[_0x6d15('0x22')][_0x6d15('0x21')]=[{'filename':_0x476fba,'path':_0x15d63a}];}else{_0x35c829['message'][_0x6d15('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4d2c80[_0x6d15('0x25')]){_0x3faac5=![];logger[_0x6d15('0xa')](_0x6d15('0x26'));}}if(_0x3faac5){return client[_0x6d15('0x27')](_0x6d15('0x28'),_0x35c829)[_0x6d15('0x29')](function(_0x2b0066){if(_0x2b0066['error']){return logger['error']('error\x20mail',JSON['stringify'](_0x2b0066));}return logger[_0x6d15('0xa')](_0x6d15('0x2a'));})[_0x6d15('0x2b')](function(_0xe6f3a5){return logger[_0x6d15('0x2c')](_0x6d15('0x2d'),JSON['stringify'](_0xe6f3a5));});}};}function handleError(){return function(_0x4d775d){return logger[_0x6d15('0x2c')](JSON[_0x6d15('0x2e')](_0x4d775d));};}function handleResult(_0x3ee8ce){return function(_0x1096e0){logger[_0x6d15('0xa')](_0x6d15('0x2f'),JSON[_0x6d15('0x2e')](_0x1096e0));if(_0x3ee8ce[_0x6d15('0xc')]&&_0x3ee8ce[_0x6d15('0xc')][_0x6d15('0xd')]&&!_[_0x6d15('0x30')](_0x3ee8ce['email'])){setTimeout(handleSendEmail(_0x3ee8ce,_0x1096e0),0x3c*0x3e8);}};}function handleJob(_0x90d4bc){return function(){try{if(_[_0x6d15('0x30')](_0x90d4bc[_0x6d15('0x31')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x6d15('0x30')](_0x90d4bc[_0x6d15('0x16')])){return logger['info'](_0x6d15('0x32'));}var _0x4fb77c={'startDate':moment()[_0x6d15('0x33')](_0x90d4bc[_0x6d15('0x31')],_0x90d4bc['subtractUnit'])[_0x6d15('0x15')](_0x6d15('0x34')),'endDate':moment()[_0x6d15('0x15')](_0x6d15('0x34')),'type':_0x6d15('0x35'),'output':_0x90d4bc[_0x6d15('0x36')],'name':_0x90d4bc['name']};if(!_['isNil'](_0x90d4bc[_0x6d15('0x37')])){logger[_0x6d15('0xa')](_0x6d15('0x38'),_0x90d4bc['DefaultReportId']);return analyticDefaultReportController[_0x6d15('0x39')]({'id':_0x90d4bc[_0x6d15('0x37')]},_0x4fb77c)[_0x6d15('0x29')](handleResult(_0x90d4bc))['catch'](handleError());}if(!_[_0x6d15('0x30')](_0x90d4bc[_0x6d15('0x3a')])){logger[_0x6d15('0xa')](_0x6d15('0x3b'),_0x90d4bc[_0x6d15('0x3a')]);return analyticCustomReportController[_0x6d15('0x39')]({'id':_0x90d4bc[_0x6d15('0x3a')]},_0x4fb77c)[_0x6d15('0x29')](handleResult(_0x90d4bc))[_0x6d15('0x2b')](handleError());}}catch(_0x377769){logger[_0x6d15('0x2c')](JSON[_0x6d15('0x2e')](_0x377769));}return logger['info'](_0x6d15('0x3c'));};}function getJobs(_0x1cf058){var _0x1ef063={};if(_0x1cf058){_0x1ef063['id']=_0x1cf058;}return db[_0x6d15('0x3d')]['findAll']({'where':_0x1ef063,'include':[{'model':db['MailAccount'],'attributes':['id',_0x6d15('0x3e'),'email'],'include':[{'model':db[_0x6d15('0x3f')],'as':_0x6d15('0xd')}]}]})['then'](function(_0x2e0769){var _0x4a5c94=_[_0x6d15('0x40')](manager['jobs']);var _0x3ec8aa=_[_0x6d15('0x41')](_0x2e0769,function(_0x4636f5){return _0x4636f5['id'][_0x6d15('0x42')]();});var _0x4a4b99=_[_0x6d15('0x43')](_0x2e0769,function(_0x1a792c){return _0x1a792c['id'][_0x6d15('0x42')]();});var _0x2dc137=_0x1cf058?_0x3ec8aa:_['difference'](_0x3ec8aa,_0x4a5c94);var _0x3117ae=_['intersection'](_0x3ec8aa,_0x4a5c94);var _0x345a6e=_[_0x6d15('0x44')](_0x4a5c94,_0x3ec8aa);var _0x1e9d46;var _0x1b2246;for(_0x1e9d46=0x0;_0x1e9d46<_0x345a6e[_0x6d15('0x45')]&&!_0x1cf058;_0x1e9d46+=0x1){_0x1b2246=_0x345a6e[_0x1e9d46]['toString']();if(manager[_0x6d15('0x46')](_0x1b2246)){manager[_0x6d15('0x47')](_0x1b2246);manager['deleteJob'](_0x1b2246);logger[_0x6d15('0xa')](_0x6d15('0x48'),_0x1b2246);}}logger[_0x6d15('0xa')](_0x6d15('0x49'),JSON[_0x6d15('0x2e')](_0x2dc137));for(_0x1e9d46=0x0;_0x1e9d46<_0x2dc137[_0x6d15('0x45')];_0x1e9d46+=0x1){_0x1b2246=_0x2dc137[_0x1e9d46][_0x6d15('0x42')]();logger[_0x6d15('0xa')](_0x6d15('0x4a'),_0x1b2246);if(_0x1cf058){logger[_0x6d15('0xa')]('my\x20id',_0x1cf058);logger[_0x6d15('0xa')](JSON[_0x6d15('0x2e')](_0x4a4b99[_0x1b2246]));BPromise[_0x6d15('0x4b')]()[_0x6d15('0x29')](handleJob(_0x4a4b99[_0x1b2246]));logger['info'](_0x6d15('0x4c'),_0x4a4b99[_0x1b2246][_0x6d15('0x3e')],_0x4a4b99[_0x1b2246]['cron']);}else if(_0x4a4b99[_0x1b2246][_0x6d15('0x4d')]&&_0x4a4b99[_0x1b2246][_0x6d15('0x4e')]&&moment()[_0x6d15('0x4f')](_0x4a4b99[_0x1b2246][_0x6d15('0x50')],_0x4a4b99[_0x1b2246]['endAt'])){manager['add'](_0x1b2246,_0x4a4b99[_0x1b2246][_0x6d15('0x4d')],handleJob(_0x4a4b99[_0x1b2246]));manager[_0x6d15('0x51')](_0x1b2246);logger[_0x6d15('0xa')]('add\x20cron',_0x4a4b99[_0x1b2246][_0x6d15('0x3e')],_0x4a4b99[_0x1b2246][_0x6d15('0x4d')]);}else if(manager['exists'](_0x1b2246)){manager[_0x6d15('0x47')](_0x1b2246);manager['deleteJob'](_0x1b2246);logger[_0x6d15('0xa')](_0x6d15('0x52'),_0x4a4b99[_0x1b2246][_0x6d15('0x3e')],_0x4a4b99[_0x1b2246][_0x6d15('0x4d')]);}}for(_0x1e9d46=0x0,_0x1b2246;_0x1e9d46<_0x3117ae[_0x6d15('0x45')]&&!_0x1cf058;_0x1e9d46+=0x1){_0x1b2246=_0x3117ae[_0x1e9d46][_0x6d15('0x42')]();if(manager[_0x6d15('0x46')](_0x1b2246)){if(_0x4a4b99[_0x1b2246][_0x6d15('0x4d')]&&_0x4a4b99[_0x1b2246]['active']&&moment()[_0x6d15('0x4f')](_0x4a4b99[_0x1b2246][_0x6d15('0x50')],_0x4a4b99[_0x1b2246][_0x6d15('0x53')])){manager[_0x6d15('0x54')](_0x1b2246,_0x4a4b99[_0x1b2246][_0x6d15('0x4d')],handleJob(_0x4a4b99[_0x1b2246]));logger['info'](_0x6d15('0x55'),_0x4a4b99[_0x1b2246][_0x6d15('0x3e')],_0x4a4b99[_0x1b2246]['cron']);}else{manager['stop'](_0x1b2246);manager['deleteJob'](_0x1b2246);logger[_0x6d15('0xa')](_0x6d15('0x52'),_0x4a4b99[_0x1b2246][_0x6d15('0x3e')],_0x4a4b99[_0x1b2246][_0x6d15('0x4d')]);}}}})[_0x6d15('0x2b')](function(_0x11db7c){logger[_0x6d15('0x2c')](JSON[_0x6d15('0x2e')](_0x11db7c));});}exports[_0x6d15('0x56')]=function(_0x1a0f4e){return getJobs(_0x1a0f4e);};exports[_0x6d15('0x51')]=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 b6154a4..57421ec 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 _0xf686=['info','format','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','ValidationError','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','sentimentRegion','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20configured','findOne','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','catch','name','error','inspect','VoiceRecording','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','SequelizeValidationError','start','lodash','request-promise','util','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0x541927,_0x524230){var _0x15636a=function(_0x3f19f3){while(--_0x3f19f3){_0x541927['push'](_0x541927['shift']());}};_0x15636a(++_0x524230);}(_0xf686,0x196));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};var _=require(_0x6f68('0x0'));var AWS=require('aws-sdk');var rp=require(_0x6f68('0x1'));var util=require(_0x6f68('0x2'));var BPromise=require(_0x6f68('0x3'));var db=require(_0x6f68('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x231d2f,_0x4f51e2,_0x5741b3,_0x133a21){return new Promise(function(_0x526995,_0x2420c3){var _0x1a3f23=new AWS[(_0x6f68('0x5'))]({'accessKeyId':_0x4f51e2,'secretAccessKey':_0x231d2f,'region':_0x5741b3});_0x1a3f23[_0x6f68('0x6')]({'TranscriptionJobName':_0x133a21},function(_0x28bf93,_0x301b12){if(_0x28bf93){return _0x2420c3(_0x28bf93);}else{return _0x526995(_0x301b12);}});});}function sentiment(_0x23db13,_0x57c60d,_0x77e858,_0x1bdce4,_0x271a12){return new Promise(function(_0x5c7d58,_0x81364d){var _0x91da1b=new AWS['Comprehend']({'accessKeyId':_0x57c60d,'secretAccessKey':_0x23db13,'region':_0x77e858});_0x91da1b[_0x6f68('0x7')]({'Text':_0x1bdce4,'LanguageCode':_0x271a12['substring'](0x0,0x2)},function(_0x3c7657,_0x47d2e1){if(_0x3c7657){return _0x81364d(_0x3c7657);}else{return _0x5c7d58(_0x47d2e1);}});});}function checkTranscribeJob(_0x5972af,_0x2f2043,_0x1ab9fb){var _0x2ce20c;return new BPromise(function(_0x3881db,_0x2d3d4a){logger[_0x6f68('0x8')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5972af['id'],_0x5972af['transcribeName']));return getTranscriptionJob(_0x1ab9fb['data1'],_0x1ab9fb[_0x6f68('0xa')],_0x2f2043[_0x6f68('0xb')],_0x5972af[_0x6f68('0xc')])[_0x6f68('0xd')](function(_0x906e9a){logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0xe'),_0x5972af['id'],_0x5972af['transcribeName'],_0x906e9a[_0x6f68('0xf')]['TranscriptionJobStatus']));if(!_0x5972af[_0x6f68('0x10')]){switch(_0x906e9a['TranscriptionJob']['TranscriptionJobStatus']){case _0x6f68('0x11'):var _0x50c813={'transcribeStatus':_0x906e9a[_0x6f68('0xf')]['TranscriptionJobStatus'],'fileUri':_0x906e9a[_0x6f68('0xf')]['Transcript'][_0x6f68('0x12')]};logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x13'),_0x5972af['id']));return rp({'uri':_0x906e9a[_0x6f68('0xf')][_0x6f68('0x14')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x1f4ddc){logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x15'),_0x5972af['id']));if(_0x1f4ddc&&_0x1f4ddc[_0x6f68('0x16')]&&_0x1f4ddc['results'][_0x6f68('0x17')]&&_0x1f4ddc[_0x6f68('0x16')][_0x6f68('0x17')]['length']){_0x50c813[_0x6f68('0x10')]='';for(var _0x10d6ee=0x0;_0x10d6ee<_0x1f4ddc['results'][_0x6f68('0x17')]['length'];_0x10d6ee++){_0x50c813[_0x6f68('0x10')]+=_0x1f4ddc[_0x6f68('0x16')][_0x6f68('0x17')][_0x10d6ee]['transcript']+'';}}return _0x5972af[_0x6f68('0x18')](_0x50c813);})['then'](function(){logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x19'),_0x5972af['id']));if(!_0x5972af[_0x6f68('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x6f68('0x1b'));}if(!_0x2f2043[_0x6f68('0x1c')]||!_0x2f2043[_0x6f68('0x1d')]||!_0x2f2043['sentimentRegion']||!_0x2f2043[_0x6f68('0x1e')]||!_0x2f2043[_0x6f68('0x1f')]){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x50c813[_0x6f68('0x10')]){throw new Error(_0x6f68('0x22'));}if(_0x2f2043[_0x6f68('0x1d')]===_0x1ab9fb['id']){return _0x1ab9fb;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x6f68('0x1d')]}});}})['then'](function(_0x87bb1f){if(!_0x87bb1f){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x23'));}if(!_0x87bb1f['data1']||!_0x87bb1f[_0x6f68('0xa')]){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x24'));}_0x2ce20c=_0x87bb1f;logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x25'),_0x5972af['id']));return sentiment(_0x2ce20c[_0x6f68('0x26')],_0x2ce20c[_0x6f68('0xa')],_0x2f2043[_0x6f68('0x27')],_0x50c813[_0x6f68('0x10')],_0x2f2043[_0x6f68('0x1e')]);})[_0x6f68('0xd')](function(_0x3325ae){logger[_0x6f68('0x8')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5972af['id']));return _0x5972af[_0x6f68('0x18')]({'sentiment':_0x3325ae['Sentiment'],'sPositive':_0x3325ae[_0x6f68('0x28')][_0x6f68('0x29')],'sNegative':_0x3325ae[_0x6f68('0x28')][_0x6f68('0x2a')],'sMixed':_0x3325ae['SentimentScore'][_0x6f68('0x2b')],'sNeutral':_0x3325ae[_0x6f68('0x28')][_0x6f68('0x2c')]});})[_0x6f68('0xd')](function(){logger[_0x6f68('0x8')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5972af['id']));_0x3881db();});case'FAILED':return _0x5972af[_0x6f68('0x18')]({'transcribeStatus':'FAILED','failureReason':_0x906e9a[_0x6f68('0xf')]['FailureReason']})['then'](function(){logger[_0x6f68('0x8')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5972af['id']));_0x3881db();});default:logger['info'](util[_0x6f68('0x9')](_0x6f68('0x2d'),_0x5972af['id']));break;}}else{return BPromise['resolve']()[_0x6f68('0xd')](function(){if(!_0x5972af[_0x6f68('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x6f68('0x1b'));}if(!_0x2f2043[_0x6f68('0x1c')]||!_0x2f2043[_0x6f68('0x1d')]||!_0x2f2043[_0x6f68('0x27')]||!_0x2f2043[_0x6f68('0x1e')]||!_0x2f2043['bucket']){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x2e'));}if(!_0x5972af[_0x6f68('0x10')]){throw new Error('Transcript\x20not\x20available');}if(_0x2f2043['sentimentAccountId']===_0x1ab9fb['id']){return _0x1ab9fb;}else{return db['CloudProvider'][_0x6f68('0x2f')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x9df8d2){if(!_0x9df8d2){throw new db['Sequelize'][(_0x6f68('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x9df8d2['data1']||!_0x9df8d2[_0x6f68('0xa')]){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x24'));}_0x2ce20c=_0x9df8d2;logger[_0x6f68('0x8')](util[_0x6f68('0x9')](_0x6f68('0x25'),_0x5972af['id']));return sentiment(_0x2ce20c[_0x6f68('0x26')],_0x2ce20c[_0x6f68('0xa')],_0x2f2043['sentimentRegion'],_0x5972af[_0x6f68('0x10')],_0x2f2043[_0x6f68('0x1e')]);})[_0x6f68('0xd')](function(_0x1e6a7f){logger[_0x6f68('0x8')](util['format'](_0x6f68('0x30'),_0x5972af['id']));return _0x5972af[_0x6f68('0x18')]({'sentiment':_0x1e6a7f[_0x6f68('0x31')],'sPositive':_0x1e6a7f['SentimentScore'][_0x6f68('0x29')],'sNegative':_0x1e6a7f['SentimentScore'][_0x6f68('0x2a')],'sMixed':_0x1e6a7f[_0x6f68('0x28')][_0x6f68('0x2b')],'sNeutral':_0x1e6a7f[_0x6f68('0x28')][_0x6f68('0x2c')],'transcribeStatus':_0x6f68('0x11')});})[_0x6f68('0xd')](function(){logger['info'](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5972af['id']));_0x3881db();});}})[_0x6f68('0x32')](function(_0x2af44a){if(_0x2af44a){if(!_0x2af44a['name']||_0x2af44a[_0x6f68('0x33')]!=='SequelizeValidationError'){logger[_0x6f68('0x34')](util[_0x6f68('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5972af['id']),util[_0x6f68('0x35')](_0x2af44a,{'showHidden':![],'depth':null}));}}_0x3881db();});});}function checkTranscribe(){var _0x41720b;var _0x12c148;var _0x18eb93;return db[_0x6f68('0x36')]['findAll']({'where':{'transcribeStatus':_0x6f68('0x37')}})[_0x6f68('0xd')](function(_0x85de0b){if(!_0x85de0b||!_0x85de0b[_0x6f68('0x38')]){throw new db['Sequelize']['ValidationError'](_0x6f68('0x39'));}_0x41720b=_0x85de0b;return db[_0x6f68('0x3a')][_0x6f68('0x2f')]({'where':{'id':0x1}});})[_0x6f68('0xd')](function(_0x22ba80){if(!_0x22ba80){throw new db[(_0x6f68('0x20'))]['ValidationError'](_0x6f68('0x3b'));}_0x12c148=_0x22ba80;if(!_0x12c148[_0x6f68('0x3c')]||!_0x12c148[_0x6f68('0x3d')]||!_0x12c148[_0x6f68('0xb')]||!_0x12c148[_0x6f68('0x1e')]||!_0x12c148['bucket']){throw new db[(_0x6f68('0x20'))]['ValidationError'](_0x6f68('0x3e'));}return db[_0x6f68('0x3f')][_0x6f68('0x2f')]({'where':{'id':_0x12c148[_0x6f68('0x3d')]}});})[_0x6f68('0xd')](function(_0x202b4d){if(!_0x202b4d){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x23'));}if(!_0x202b4d[_0x6f68('0x26')]||!_0x202b4d[_0x6f68('0xa')]){throw new db[(_0x6f68('0x20'))][(_0x6f68('0x21'))](_0x6f68('0x24'));}_0x18eb93=_0x202b4d;var _0x1a49b0=[];_0x41720b[_0x6f68('0x40')](function(_0x3c0587){_0x1a49b0[_0x6f68('0x41')](checkTranscribeJob(_0x3c0587,_0x12c148,_0x18eb93));});return BPromise[_0x6f68('0x42')](_0x1a49b0);})[_0x6f68('0x32')](function(_0x5242f7){if(_0x5242f7){if(!_0x5242f7[_0x6f68('0x33')]||_0x5242f7['name']!==_0x6f68('0x43')){logger[_0x6f68('0x34')](util[_0x6f68('0x35')](_0x5242f7,{'showHidden':![],'depth':null}));}}});}exports[_0x6f68('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3d84=['inspect','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','push','all','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','getTranscriptionJob','detectSentiment','substring','info','format','transcribeName','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x219b98,_0x38a85b){var _0x7c426e=function(_0x2024fa){while(--_0x2024fa){_0x219b98['push'](_0x219b98['shift']());}};_0x7c426e(++_0x38a85b);}(_0x3d84,0x12b));var _0x43d8=function(_0x3bd468,_0x40117f){_0x3bd468=_0x3bd468-0x0;var _0x501332=_0x3d84[_0x3bd468];return _0x501332;};var _=require(_0x43d8('0x0'));var AWS=require('aws-sdk');var rp=require(_0x43d8('0x1'));var util=require(_0x43d8('0x2'));var BPromise=require(_0x43d8('0x3'));var db=require(_0x43d8('0x4'))['db'];var logger=require(_0x43d8('0x5'))('transcribe');function getTranscriptionJob(_0x3a0dba,_0x54f1a9,_0x3af5ac,_0x210163){return new Promise(function(_0x2640c7,_0x5a9caa){var _0x544700=new AWS['TranscribeService']({'accessKeyId':_0x54f1a9,'secretAccessKey':_0x3a0dba,'region':_0x3af5ac});_0x544700[_0x43d8('0x6')]({'TranscriptionJobName':_0x210163},function(_0x3d5698,_0x149fdf){if(_0x3d5698){return _0x5a9caa(_0x3d5698);}else{return _0x2640c7(_0x149fdf);}});});}function sentiment(_0x615ff7,_0x268529,_0xd55946,_0x2a158a,_0x2d71c8){return new Promise(function(_0x4ba1df,_0x4242c6){var _0xcaa01=new AWS['Comprehend']({'accessKeyId':_0x268529,'secretAccessKey':_0x615ff7,'region':_0xd55946});_0xcaa01[_0x43d8('0x7')]({'Text':_0x2a158a,'LanguageCode':_0x2d71c8[_0x43d8('0x8')](0x0,0x2)},function(_0x1776a2,_0x58f252){if(_0x1776a2){return _0x4242c6(_0x1776a2);}else{return _0x4ba1df(_0x58f252);}});});}function checkTranscribeJob(_0xe449aa,_0x38cc21,_0x5511cd){var _0x26521b;return new BPromise(function(_0xb9eb29,_0x3c680e){logger[_0x43d8('0x9')](util[_0x43d8('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xe449aa['id'],_0xe449aa[_0x43d8('0xb')]));return getTranscriptionJob(_0x5511cd['data1'],_0x5511cd['data2'],_0x38cc21[_0x43d8('0xc')],_0xe449aa[_0x43d8('0xb')])['then'](function(_0x130b95){logger[_0x43d8('0x9')](util['format'](_0x43d8('0xd'),_0xe449aa['id'],_0xe449aa[_0x43d8('0xb')],_0x130b95[_0x43d8('0xe')][_0x43d8('0xf')]));if(!_0xe449aa[_0x43d8('0x10')]){switch(_0x130b95[_0x43d8('0xe')]['TranscriptionJobStatus']){case'COMPLETED':var _0x1dd07e={'transcribeStatus':_0x130b95[_0x43d8('0xe')][_0x43d8('0xf')],'fileUri':_0x130b95[_0x43d8('0xe')][_0x43d8('0x11')][_0x43d8('0x12')]};logger['info'](util[_0x43d8('0xa')](_0x43d8('0x13'),_0xe449aa['id']));return rp({'uri':_0x130b95[_0x43d8('0xe')][_0x43d8('0x11')][_0x43d8('0x12')],'json':!![]})[_0x43d8('0x14')](function(_0x19bd58){logger[_0x43d8('0x9')](util[_0x43d8('0xa')](_0x43d8('0x15'),_0xe449aa['id']));if(_0x19bd58&&_0x19bd58[_0x43d8('0x16')]&&_0x19bd58[_0x43d8('0x16')]['transcripts']&&_0x19bd58[_0x43d8('0x16')][_0x43d8('0x17')]['length']){_0x1dd07e[_0x43d8('0x10')]='';for(var _0x534663=0x0;_0x534663<_0x19bd58[_0x43d8('0x16')][_0x43d8('0x17')][_0x43d8('0x18')];_0x534663++){_0x1dd07e[_0x43d8('0x10')]+=_0x19bd58[_0x43d8('0x16')][_0x43d8('0x17')][_0x534663][_0x43d8('0x19')]+'';}}return _0xe449aa[_0x43d8('0x1a')](_0x1dd07e);})[_0x43d8('0x14')](function(){logger['info'](util[_0x43d8('0xa')](_0x43d8('0x1b'),_0xe449aa['id']));if(!_0xe449aa[_0x43d8('0x1c')]){throw new db['Sequelize']['ValidationError'](_0x43d8('0x1d'));}if(!_0x38cc21[_0x43d8('0x1e')]||!_0x38cc21[_0x43d8('0x1f')]||!_0x38cc21['sentimentRegion']||!_0x38cc21[_0x43d8('0x20')]||!_0x38cc21['bucket']){throw new db[(_0x43d8('0x21'))][(_0x43d8('0x22'))](_0x43d8('0x23'));}if(!_0x1dd07e['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x38cc21['sentimentAccountId']===_0x5511cd['id']){return _0x5511cd;}else{return db[_0x43d8('0x24')][_0x43d8('0x25')]({'where':{'id':_settings[_0x43d8('0x1f')]}});}})['then'](function(_0x51a9f3){if(!_0x51a9f3){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x51a9f3[_0x43d8('0x26')]||!_0x51a9f3[_0x43d8('0x27')]){throw new db[(_0x43d8('0x21'))][(_0x43d8('0x22'))](_0x43d8('0x28'));}_0x26521b=_0x51a9f3;logger[_0x43d8('0x9')](util[_0x43d8('0xa')](_0x43d8('0x29'),_0xe449aa['id']));return sentiment(_0x26521b[_0x43d8('0x26')],_0x26521b[_0x43d8('0x27')],_0x38cc21[_0x43d8('0x2a')],_0x1dd07e['fileText'],_0x38cc21[_0x43d8('0x20')]);})['then'](function(_0x2d1da3){logger['info'](util['format'](_0x43d8('0x2b'),_0xe449aa['id']));return _0xe449aa[_0x43d8('0x1a')]({'sentiment':_0x2d1da3[_0x43d8('0x2c')],'sPositive':_0x2d1da3[_0x43d8('0x2d')][_0x43d8('0x2e')],'sNegative':_0x2d1da3[_0x43d8('0x2d')][_0x43d8('0x2f')],'sMixed':_0x2d1da3[_0x43d8('0x2d')][_0x43d8('0x30')],'sNeutral':_0x2d1da3[_0x43d8('0x2d')][_0x43d8('0x31')]});})[_0x43d8('0x14')](function(){logger['info'](util[_0x43d8('0xa')](_0x43d8('0x1b'),_0xe449aa['id']));_0xb9eb29();});case _0x43d8('0x32'):return _0xe449aa[_0x43d8('0x1a')]({'transcribeStatus':_0x43d8('0x32'),'failureReason':_0x130b95[_0x43d8('0xe')]['FailureReason']})[_0x43d8('0x14')](function(){logger[_0x43d8('0x9')](util[_0x43d8('0xa')](_0x43d8('0x1b'),_0xe449aa['id']));_0xb9eb29();});default:logger[_0x43d8('0x9')](util[_0x43d8('0xa')](_0x43d8('0x33'),_0xe449aa['id']));break;}}else{return BPromise[_0x43d8('0x34')]()['then'](function(){if(!_0xe449aa['tempSentiment']){throw new db[(_0x43d8('0x21'))][(_0x43d8('0x22'))](_0x43d8('0x1d'));}if(!_0x38cc21[_0x43d8('0x1e')]||!_0x38cc21[_0x43d8('0x1f')]||!_0x38cc21[_0x43d8('0x2a')]||!_0x38cc21[_0x43d8('0x20')]||!_0x38cc21[_0x43d8('0x35')]){throw new db[(_0x43d8('0x21'))]['ValidationError'](_0x43d8('0x23'));}if(!_0xe449aa[_0x43d8('0x10')]){throw new Error(_0x43d8('0x36'));}if(_0x38cc21['sentimentAccountId']===_0x5511cd['id']){return _0x5511cd;}else{return db[_0x43d8('0x24')]['findOne']({'where':{'id':_settings[_0x43d8('0x1f')]}});}})[_0x43d8('0x14')](function(_0xab986a){if(!_0xab986a){throw new db[(_0x43d8('0x21'))]['ValidationError'](_0x43d8('0x37'));}if(!_0xab986a['data1']||!_0xab986a['data2']){throw new db[(_0x43d8('0x21'))][(_0x43d8('0x22'))](_0x43d8('0x28'));}_0x26521b=_0xab986a;logger[_0x43d8('0x9')](util[_0x43d8('0xa')](_0x43d8('0x29'),_0xe449aa['id']));return sentiment(_0x26521b[_0x43d8('0x26')],_0x26521b[_0x43d8('0x27')],_0x38cc21[_0x43d8('0x2a')],_0xe449aa['fileText'],_0x38cc21[_0x43d8('0x20')]);})['then'](function(_0x48c2bd){logger['info'](util['format'](_0x43d8('0x2b'),_0xe449aa['id']));return _0xe449aa['update']({'sentiment':_0x48c2bd[_0x43d8('0x2c')],'sPositive':_0x48c2bd[_0x43d8('0x2d')]['Positive'],'sNegative':_0x48c2bd[_0x43d8('0x2d')][_0x43d8('0x2f')],'sMixed':_0x48c2bd[_0x43d8('0x2d')]['Mixed'],'sNeutral':_0x48c2bd[_0x43d8('0x2d')][_0x43d8('0x31')],'transcribeStatus':'COMPLETED'});})[_0x43d8('0x14')](function(){logger['info'](util[_0x43d8('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xe449aa['id']));_0xb9eb29();});}})[_0x43d8('0x38')](function(_0x53a370){if(_0x53a370){if(!_0x53a370[_0x43d8('0x39')]||_0x53a370['name']!==_0x43d8('0x3a')){logger[_0x43d8('0x3b')](util[_0x43d8('0xa')](_0x43d8('0x3c'),_0xe449aa['id']),util[_0x43d8('0x3d')](_0x53a370,{'showHidden':![],'depth':null}));}}_0xb9eb29();});});}function checkTranscribe(){var _0x46aae6;var _0x297a42;var _0x1ff9b2;return db['VoiceRecording'][_0x43d8('0x3e')]({'where':{'transcribeStatus':_0x43d8('0x3f')}})[_0x43d8('0x14')](function(_0x3b9393){if(!_0x3b9393||!_0x3b9393[_0x43d8('0x18')]){throw new db[(_0x43d8('0x21'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x46aae6=_0x3b9393;return db[_0x43d8('0x40')][_0x43d8('0x25')]({'where':{'id':0x1}});})[_0x43d8('0x14')](function(_0x328544){if(!_0x328544){throw new db[(_0x43d8('0x21'))][(_0x43d8('0x22'))](_0x43d8('0x41'));}_0x297a42=_0x328544;if(!_0x297a42[_0x43d8('0x42')]||!_0x297a42[_0x43d8('0x43')]||!_0x297a42[_0x43d8('0xc')]||!_0x297a42[_0x43d8('0x20')]||!_0x297a42[_0x43d8('0x35')]){throw new db['Sequelize']['ValidationError'](_0x43d8('0x44'));}return db['CloudProvider'][_0x43d8('0x25')]({'where':{'id':_0x297a42[_0x43d8('0x43')]}});})[_0x43d8('0x14')](function(_0x3dfa56){if(!_0x3dfa56){throw new db[(_0x43d8('0x21'))][(_0x43d8('0x22'))](_0x43d8('0x37'));}if(!_0x3dfa56[_0x43d8('0x26')]||!_0x3dfa56[_0x43d8('0x27')]){throw new db[(_0x43d8('0x21'))]['ValidationError'](_0x43d8('0x28'));}_0x1ff9b2=_0x3dfa56;var _0xb82875=[];_0x46aae6['forEach'](function(_0x25f54f){_0xb82875[_0x43d8('0x45')](checkTranscribeJob(_0x25f54f,_0x297a42,_0x1ff9b2));});return BPromise[_0x43d8('0x46')](_0xb82875);})[_0x43d8('0x38')](function(_0x5e017c){if(_0x5e017c){if(!_0x5e017c['name']||_0x5e017c['name']!=='SequelizeValidationError'){logger[_0x43d8('0x3b')](util[_0x43d8('0x3d')](_0x5e017c,{'showHidden':![],'depth':null}));}}});}exports[_0x43d8('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6e11462..595971d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b6e=['now','destroy','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x0b6e,0x1e0));var _0xe0b6=function(_0x49652f,_0x1f44cf){_0x49652f=_0x49652f-0x0;var _0x44ab95=_0x0b6e[_0x49652f];return _0x44ab95;};'use strict';var util=require(_0xe0b6('0x0'));var db=require(_0xe0b6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe0b6('0x2')]({'id':i,'firstName':_0xe0b6('0x3')+i,'lastName':_0xe0b6('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe0b6('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xe0b6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe0b6('0x6')](),'updatedAt':Date[_0xe0b6('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe0b6('0x3')+i,'lastName':_0xe0b6('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe0b6('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe0b6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe0b6('0x6')](),'updatedAt':Date[_0xe0b6('0x6')]()});}db['CmContact'][_0xe0b6('0x7')]({'where':{}})['then'](function(){return db[_0xe0b6('0x8')][_0xe0b6('0x9')](contacts);})[_0xe0b6('0xa')](function(){console[_0xe0b6('0xb')](_0xe0b6('0xc'),_0xe0b6('0xd'));return db[_0xe0b6('0xe')][_0xe0b6('0x7')]({'where':{}});})[_0xe0b6('0xa')](function(){return db[_0xe0b6('0xe')][_0xe0b6('0x9')](hopper);})['then'](function(){console['log'](_0xe0b6('0xc'),_0xe0b6('0xf'));return db[_0xe0b6('0x8')][_0xe0b6('0x9')](contacts2);})['then'](function(){console[_0xe0b6('0xb')]('finished\x20populating','contacts2');return db[_0xe0b6('0xe')]['bulkCreate'](hopper2);})['then'](function(){console['log']('finished\x20populating',_0xe0b6('0x10'));})[_0xe0b6('0x11')](function(_0x5e204a){console['log'](_0x5e204a);}); \ No newline at end of file +var _0xb287=['../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xb287,0xc5));var _0x7b28=function(_0x2a0f46,_0x4a0313){_0x2a0f46=_0x2a0f46-0x0;var _0x187603=_0xb287[_0x2a0f46];return _0x187603;};'use strict';var util=require(_0x7b28('0x0'));var db=require(_0x7b28('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7b28('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7b28('0x3')+i,'phone':0xf879fb460+i,'email':_0x7b28('0x4')+i+_0x7b28('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7b28('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7b28('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7b28('0x6')](),'updatedAt':Date[_0x7b28('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7b28('0x7')+i,'lastName':_0x7b28('0x3')+i,'phone':0xf879fb460+i,'email':_0x7b28('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7b28('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7b28('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7b28('0x6')](),'updatedAt':Date[_0x7b28('0x6')]()});}db[_0x7b28('0x8')][_0x7b28('0x9')]({'where':{}})[_0x7b28('0xa')](function(){return db[_0x7b28('0x8')][_0x7b28('0xb')](contacts);})[_0x7b28('0xa')](function(){console[_0x7b28('0xc')](_0x7b28('0xd'),_0x7b28('0xe'));return db[_0x7b28('0xf')][_0x7b28('0x9')]({'where':{}});})[_0x7b28('0xa')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x7b28('0xa')](function(){console['log']('finished\x20populating',_0x7b28('0x10'));return db['CmContact'][_0x7b28('0xb')](contacts2);})['then'](function(){console[_0x7b28('0xc')](_0x7b28('0xd'),_0x7b28('0x11'));return db[_0x7b28('0xf')][_0x7b28('0xb')](hopper2);})[_0x7b28('0xa')](function(){console[_0x7b28('0xc')]('finished\x20populating','hopper2');})['catch'](function(_0x59bd5a){console[_0x7b28('0xc')](_0x59bd5a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9217603..cd16f12 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1f9=['%s%s','%s%s@xcally.com','password','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','agent','format'];(function(_0x14090e,_0x30c2f7){var _0x554da7=function(_0x165d16){while(--_0x165d16){_0x14090e['push'](_0x14090e['shift']());}};_0x554da7(++_0x30c2f7);}(_0xf1f9,0xcd));var _0x9f1f=function(_0x215ee7,_0x1ea789){_0x215ee7=_0x215ee7-0x0;var _0x2ce8e8=_0xf1f9[_0x215ee7];return _0x2ce8e8;};'use strict';var util=require(_0x9f1f('0x0'));var db=require(_0x9f1f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9f1f('0x2')]({'name':util['format']('%s%s',_0x9f1f('0x3'),i),'fullname':util[_0x9f1f('0x4')](_0x9f1f('0x5'),_0x9f1f('0x3'),i),'email':util[_0x9f1f('0x4')](_0x9f1f('0x6'),_0x9f1f('0x3'),i),'role':_0x9f1f('0x3'),'password':_0x9f1f('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x9f1f('0x8'),'ws','wss'],'disallow':['all'],'allow':[_0x9f1f('0x9')],'defaultuser':util[_0x9f1f('0x4')](_0x9f1f('0x5'),_0x9f1f('0x3'),i),'encryption':'yes','avpf':_0x9f1f('0xa'),'force_avp':_0x9f1f('0xa'),'icesupport':_0x9f1f('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x9f1f('0xb'),'dtlsprivatekey':_0x9f1f('0xc'),'dtlssetup':_0x9f1f('0xd'),'callerid':util[_0x9f1f('0x4')](_0x9f1f('0xe'),util['format'](_0x9f1f('0x5'),'agent',i),0xfa0+i)});}db[_0x9f1f('0xf')][_0x9f1f('0x10')](users)[_0x9f1f('0x11')](function(){console[_0x9f1f('0x12')](_0x9f1f('0x13'));})[_0x9f1f('0x14')](function(_0x27ce73){console[_0x9f1f('0x12')](_0x27ce73);}); \ No newline at end of file +var _0x2196=['udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','add\x20user','catch','log','util','../mysqldb','push','%s%s','agent','format','password','friend'];(function(_0x2c3fbd,_0x3e2441){var _0x50ffff=function(_0x49d6d7){while(--_0x49d6d7){_0x2c3fbd['push'](_0x2c3fbd['shift']());}};_0x50ffff(++_0x3e2441);}(_0x2196,0x1b1));var _0x6219=function(_0x1a875a,_0x2a1002){_0x1a875a=_0x1a875a-0x0;var _0x1a0e87=_0x2196[_0x1a875a];return _0x1a0e87;};'use strict';var util=require(_0x6219('0x0'));var db=require(_0x6219('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6219('0x2')]({'name':util['format'](_0x6219('0x3'),_0x6219('0x4'),i),'fullname':util['format'](_0x6219('0x3'),'agent',i),'email':util[_0x6219('0x5')]('%s%s@xcally.com',_0x6219('0x4'),i),'role':'agent','password':_0x6219('0x6'),'internal':0xfa0+i,'type':_0x6219('0x7'),'transport':[_0x6219('0x8'),'ws',_0x6219('0x9')],'disallow':[_0x6219('0xa')],'allow':[_0x6219('0xb')],'defaultuser':util[_0x6219('0x5')](_0x6219('0x3'),_0x6219('0x4'),i),'encryption':_0x6219('0xc'),'avpf':_0x6219('0xc'),'force_avp':_0x6219('0xc'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x6219('0xd'),'dtlsprivatekey':_0x6219('0xe'),'dtlssetup':'actpass','callerid':util['format'](_0x6219('0xf'),util[_0x6219('0x5')](_0x6219('0x3'),_0x6219('0x4'),i),0xfa0+i)});}db[_0x6219('0x10')]['bulkCreate'](users)[_0x6219('0x11')](function(){console['log'](_0x6219('0x12'));})[_0x6219('0x13')](function(_0x594dc4){console[_0x6219('0x14')](_0x594dc4);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d13905e..85ee4c1 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc158=['MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','role','Campaign','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','format','admin','voice:inbound','voice:outbound','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues'];(function(_0xa6aed6,_0x203d83){var _0x440b5c=function(_0x329a70){while(--_0x329a70){_0xa6aed6['push'](_0xa6aed6['shift']());}};_0x440b5c(++_0x203d83);}(_0xc158,0x113));var _0x8c15=function(_0x1e3fac,_0x4fa3b0){_0x1e3fac=_0x1e3fac-0x0;var _0x5b753f=_0xc158[_0x1e3fac];return _0x5b753f;};'use strict';var _=require(_0x8c15('0x0'));var util=require(_0x8c15('0x1'));var BPromise=require(_0x8c15('0x2'));var db=require(_0x8c15('0x3'))['db'];var config=require(_0x8c15('0x4'));var queryQueues={'attributes':['id',_0x8c15('0x5')],'include':[{'as':_0x8c15('0x6'),'model':db[_0x8c15('0x7')],'attributes':['id',_0x8c15('0x5'),'role'],'raw':!![],'where':{'role':_0x8c15('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8c15('0x5')],'where':{'role':_0x8c15('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8c15('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8c15('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8c15('0x5'),_0x8c15('0xa')],'where':{'type':_0x8c15('0xb')}};function getAssociatedResources(_0x97efc6,_0x350453,_0x2559c1){return db[_0x8c15('0xc')][_0x8c15('0xd')]({'where':{'name':_0x97efc6,'userProfileId':_0x350453},'raw':!![]})['then'](function(_0x61d4e1){if(_0x61d4e1){if(_0x61d4e1[_0x8c15('0xe')]){switch(_0x97efc6){case _0x8c15('0xf'):case _0x8c15('0x10'):case _0x8c15('0x11'):case _0x8c15('0x12'):case _0x8c15('0x13'):case _0x8c15('0x14'):case _0x8c15('0x15'):return db[_0x2559c1][_0x8c15('0x16')](queryQueues);case _0x8c15('0x17'):return db[_0x2559c1][_0x8c15('0x16')](queryTelephones);case _0x8c15('0x18'):return db[_0x2559c1][_0x8c15('0x16')](queryTrunks);case _0x8c15('0x19'):return db[_0x2559c1][_0x8c15('0x16')](queryCampaigns);}}else{return db[_0x8c15('0x1a')]['findAll']({'attributes':[_0x8c15('0x1b')],'where':{'sectionId':_0x61d4e1['id']},'raw':!![]})[_0x8c15('0x1c')](function(_0x44fffc){if(_0x44fffc){var _0x3b6ac6={'where':{'id':_[_0x8c15('0x1d')](_0x44fffc,'resourceId')},'raw':!![]};switch(_0x2559c1){case _0x8c15('0x7'):_0x3b6ac6[_0x8c15('0x1e')][_0x8c15('0x1f')]=_0x8c15('0x9');break;case _0x8c15('0x20'):_0x3b6ac6[_0x8c15('0x1e')][_0x8c15('0xa')]='ivr';break;}return db[_0x2559c1]['findAll'](_0x3b6ac6);}else{return[];}});}}else{return[];}})[_0x8c15('0x1c')](function(_0x113054){return _0x113054;});}function joinOrLeaveQueues(_0x19170c,_0xa18520,_0x3c2760,_0x4b4505){_0x19170c[_0xa18520](util['format']('%s:queue:%s',_0x3c2760,_0x4b4505['name']));if(_0x4b4505[_0x8c15('0x6')]){for(var _0x430a1f=0x0;_0x430a1f<_0x4b4505[_0x8c15('0x6')]['length'];_0x430a1f+=0x1){_0x19170c[_0xa18520](util['format']('user:%s',_0x4b4505['Agents'][_0x430a1f][_0x8c15('0x5')]));}}}function joinOrLeave(_0x3a3e8d,_0x56e4e6,_0x1dd399){var _0x512c4c;if(_0x3a3e8d[_0x8c15('0x21')][_0x8c15('0x22')]['id']){db[_0x8c15('0x7')][_0x8c15('0x23')]({'attributes':['id','name',_0x8c15('0x1f'),_0x8c15('0x24')],'where':{'id':_0x3a3e8d[_0x8c15('0x21')][_0x8c15('0x22')]['id']},'include':[{'model':db[_0x8c15('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x8c15('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x8c15('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8c15('0x28')],'as':_0x8c15('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x8c15('0x2a')],'as':_0x8c15('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x8c15('0x2c')],'as':_0x8c15('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x85fd05){if(_0x85fd05){_0x512c4c=_0x85fd05;_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')]('user:%s',_0x85fd05[_0x8c15('0x5')]));var _0x494079=[];switch(_0x85fd05[_0x8c15('0x1f')]){case _0x8c15('0x2f'):_0x3a3e8d[_0x56e4e6](_0x8c15('0x30'));_0x3a3e8d[_0x56e4e6](_0x8c15('0x31'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x494079[_0x8c15('0x32')](db[_0x8c15('0x33')][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x34')][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x35')][_0x8c15('0x16')](queryQueues));_0x494079['push'](db['SmsQueue'][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x36')][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x37')][_0x8c15('0x16')](queryQueues));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x38')][_0x8c15('0x16')](queryQueues));_0x494079['push'](db['User'][_0x8c15('0x16')](queryTelephones));_0x494079['push'](db[_0x8c15('0x39')]['findAll'](queryTrunks));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x20')]['findAll'](queryCampaigns));_0x494079['push'](db[_0x8c15('0x7')][_0x8c15('0x16')](queryAgents));break;case _0x8c15('0x3a'):_0x3a3e8d[_0x56e4e6](_0x8c15('0x30'));_0x3a3e8d[_0x56e4e6](_0x8c15('0x31'));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0xf'),_0x85fd05['userProfileId'],_0x8c15('0x33')));_0x494079[_0x8c15('0x32')](getAssociatedResources('ChatQueues',_0x85fd05[_0x8c15('0x24')],_0x8c15('0x34')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x11'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x35')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x12'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x3b')));_0x494079[_0x8c15('0x32')](getAssociatedResources('MailQueues',_0x85fd05[_0x8c15('0x24')],_0x8c15('0x36')));_0x494079['push'](getAssociatedResources(_0x8c15('0x14'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x37')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x15'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x38')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x17'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x7')));_0x494079['push'](getAssociatedResources(_0x8c15('0x18'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x39')));_0x494079[_0x8c15('0x32')](getAssociatedResources(_0x8c15('0x19'),_0x85fd05[_0x8c15('0x24')],_0x8c15('0x20')));_0x494079[_0x8c15('0x32')](db[_0x8c15('0x7')]['findAll'](queryAgents));break;case _0x8c15('0x8'):_0x3a3e8d[_0x56e4e6](_0x8c15('0x30'));_0x3a3e8d[_0x56e4e6](_0x8c15('0x31'));_0x494079['push'](_0x85fd05[_0x8c15('0x3c')]({'attributes':['id',_0x8c15('0x5')]}));_0x494079['push'](_0x85fd05[_0x8c15('0x3d')]({'attributes':['id','name']}));_0x494079[_0x8c15('0x32')](_0x85fd05[_0x8c15('0x3e')]({'attributes':['id',_0x8c15('0x5')]}));_0x494079[_0x8c15('0x32')](_0x85fd05[_0x8c15('0x3f')]({'attributes':['id','name']}));_0x494079['push'](_0x85fd05['getMailQueues']({'attributes':['id',_0x8c15('0x5')]}));_0x494079[_0x8c15('0x32')](_0x85fd05[_0x8c15('0x40')]({'attributes':['id',_0x8c15('0x5')]}));_0x494079[_0x8c15('0x32')](_0x85fd05[_0x8c15('0x41')]({'attributes':['id',_0x8c15('0x5')]}));break;}return BPromise['all'](_0x494079);}})['then'](function(_0x59f990){if(_0x59f990&&_0x59f990[_0x8c15('0x42')]){for(var _0x423dc7=0x0;_0x423dc7<_0x59f990[_0x8c15('0x42')];_0x423dc7+=0x1){for(var _0x1e324b=0x0;_0x1e324b<_0x59f990[_0x423dc7]['length'];_0x1e324b+=0x1){switch(_0x423dc7){case 0x0:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x43'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x1:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x44'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x2:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x45'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x3:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x46'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x4:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x47'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x5:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,'openchannel',_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x6:joinOrLeaveQueues(_0x3a3e8d,_0x56e4e6,_0x8c15('0x48'),_0x59f990[_0x423dc7][_0x1e324b]);break;case 0x7:_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')](_0x8c15('0x49'),_0x59f990[_0x423dc7][_0x1e324b][_0x8c15('0x5')]));break;case 0x8:_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')](_0x8c15('0x4a'),_0x59f990[_0x423dc7][_0x1e324b]['name']));break;case 0x9:_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')](_0x8c15('0x4b'),_0x59f990[_0x423dc7][_0x1e324b][_0x8c15('0xa')],_0x59f990[_0x423dc7][_0x1e324b]['name']));break;case 0xa:_0x3a3e8d[_0x56e4e6](util[_0x8c15('0x2e')](_0x8c15('0x4c'),_0x59f990[_0x423dc7][_0x1e324b][_0x8c15('0x5')]));break;}}}}})[_0x8c15('0x1c')](function(){if(_0x56e4e6===_0x8c15('0x4d')){var _0x2f83ca=_[_0x8c15('0x1d')](_0x512c4c['ChatInteractions'],'id');return _0x512c4c[_0x8c15('0x4e')](_0x2f83ca)[_0x8c15('0x1c')](function(){for(var _0xe887b5=0x0;_0xe887b5<_0x2f83ca[_0x8c15('0x42')];_0xe887b5+=0x1){_0x1dd399[_0x8c15('0x4f')](_0x8c15('0x50'),{'ChatInteractionId':Number(_0x2f83ca[_0xe887b5]),'UserId':Number(_0x512c4c['id'])});}});}})['then'](function(){if(_0x56e4e6==='leave'){var _0x256e17=_[_0x8c15('0x1d')](_0x512c4c[_0x8c15('0x26')],'id');return _0x512c4c[_0x8c15('0x51')](_0x256e17)[_0x8c15('0x1c')](function(){for(var _0x1bdd6e=0x0;_0x1bdd6e<_0x256e17[_0x8c15('0x42')];_0x1bdd6e+=0x1){_0x1dd399['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x256e17[_0x1bdd6e]),'UserId':Number(_0x512c4c['id'])});}});}})[_0x8c15('0x1c')](function(){if(_0x56e4e6===_0x8c15('0x4d')){var _0x174255=_[_0x8c15('0x1d')](_0x512c4c['FaxInteractions'],'id');return _0x512c4c['removeFaxInteractions'](_0x174255)[_0x8c15('0x1c')](function(){for(var _0x3f0161=0x0;_0x3f0161<_0x174255[_0x8c15('0x42')];_0x3f0161+=0x1){_0x1dd399[_0x8c15('0x4f')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x174255[_0x3f0161]),'UserId':Number(_0x512c4c['id'])});}});}})[_0x8c15('0x1c')](function(){if(_0x56e4e6===_0x8c15('0x4d')){var _0xf97dc3=_[_0x8c15('0x1d')](_0x512c4c['SmsInteractions'],'id');return _0x512c4c['removeSmsInteractions'](_0xf97dc3)['then'](function(){for(var _0x436aa8=0x0;_0x436aa8<_0xf97dc3[_0x8c15('0x42')];_0x436aa8+=0x1){_0x1dd399[_0x8c15('0x4f')](_0x8c15('0x52'),{'SmsInteractionId':Number(_0xf97dc3[_0x436aa8]),'UserId':Number(_0x512c4c['id'])});}});}})['then'](function(){if(_0x56e4e6===_0x8c15('0x4d')){var _0x43f455=_['map'](_0x512c4c[_0x8c15('0x2b')],'id');return _0x512c4c[_0x8c15('0x53')](_0x43f455)[_0x8c15('0x1c')](function(){for(var _0xf6b540=0x0;_0xf6b540<_0x43f455[_0x8c15('0x42')];_0xf6b540+=0x1){_0x1dd399[_0x8c15('0x4f')](_0x8c15('0x54'),{'OpenchannelInteractionId':Number(_0x43f455[_0xf6b540]),'UserId':Number(_0x512c4c['id'])});}});}})[_0x8c15('0x1c')](function(){if(_0x56e4e6==='leave'){var _0x179fc9=_['map'](_0x512c4c[_0x8c15('0x2d')],'id');return _0x512c4c[_0x8c15('0x55')](_0x179fc9)[_0x8c15('0x1c')](function(){for(var _0x29df21=0x0;_0x29df21<_0x179fc9[_0x8c15('0x42')];_0x29df21+=0x1){_0x1dd399['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x179fc9[_0x29df21]),'UserId':Number(_0x512c4c['id'])});}});}})[_0x8c15('0x56')](function(_0x1ae1e3){_0x3a3e8d[_0x8c15('0x57')](_0x1ae1e3);});}}function onDisconnect(_0x49af26,_0x49dfd9){joinOrLeave(_0x49af26,_0x8c15('0x4d'),_0x49dfd9);}function onConnect(_0x1c62fe){joinOrLeave(_0x1c62fe,'join');}exports[_0x8c15('0x58')]=function(_0x2608b){_0x2608b['on'](_0x8c15('0x59'),function(_0x395479){_0x395479[_0x8c15('0x5a')](0x0);_0x395479[_0x8c15('0x5b')]=_0x395479[_0x8c15('0x5c')][_0x8c15('0x59')][_0x8c15('0x5d')]+':'+_0x395479[_0x8c15('0x5c')][_0x8c15('0x59')]['remotePort'];_0x395479[_0x8c15('0x5e')]=new Date();_0x395479[_0x8c15('0x57')]=function(_0x480a4e){console[_0x8c15('0x57')](_0x8c15('0x5f')+_0x395479['nsp'][_0x8c15('0x5')]+'['+_0x395479[_0x8c15('0x5b')]+']',_0x480a4e);};_0x395479['on']('disconnect',function(){onDisconnect(_0x395479,_0x2608b);_0x395479[_0x8c15('0x57')](_0x8c15('0x60'));});onConnect(_0x395479);_0x395479[_0x8c15('0x57')](_0x8c15('0x61'));});}; \ No newline at end of file +var _0xa3c4=['agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','VoiceQueue','FaxQueue','MailQueues','WhatsappQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','all','voice','chat','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','leave','removeMailInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','log','default','connection','address','remoteAddress','request','remotePort','nsp','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','name','User'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa3c4,0x114));var _0x4a3c=function(_0x468188,_0x12a2f5){_0x468188=_0x468188-0x0;var _0x1b4129=_0xa3c4[_0x468188];return _0x1b4129;};'use strict';var _=require(_0x4a3c('0x0'));var util=require('util');var BPromise=require(_0x4a3c('0x1'));var db=require(_0x4a3c('0x2'))['db'];var config=require(_0x4a3c('0x3'));var queryQueues={'attributes':['id',_0x4a3c('0x4')],'include':[{'as':'Agents','model':db[_0x4a3c('0x5')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x4a3c('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x4a3c('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4a3c('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x4a3c('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4a3c('0x4'),_0x4a3c('0x8')],'where':{'type':_0x4a3c('0x9')}};function getAssociatedResources(_0x503219,_0x31ce0b,_0x255ee6){return db[_0x4a3c('0xa')][_0x4a3c('0xb')]({'where':{'name':_0x503219,'userProfileId':_0x31ce0b},'raw':!![]})[_0x4a3c('0xc')](function(_0x26ae54){if(_0x26ae54){if(_0x26ae54[_0x4a3c('0xd')]){switch(_0x503219){case _0x4a3c('0xe'):case _0x4a3c('0xf'):case _0x4a3c('0x10'):case _0x4a3c('0x11'):case'MailQueues':case _0x4a3c('0x12'):case _0x4a3c('0x13'):return db[_0x255ee6]['findAll'](queryQueues);case _0x4a3c('0x14'):return db[_0x255ee6][_0x4a3c('0x15')](queryTelephones);case _0x4a3c('0x16'):return db[_0x255ee6][_0x4a3c('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x255ee6][_0x4a3c('0x15')](queryCampaigns);}}else{return db[_0x4a3c('0x17')][_0x4a3c('0x15')]({'attributes':[_0x4a3c('0x18')],'where':{'sectionId':_0x26ae54['id']},'raw':!![]})[_0x4a3c('0xc')](function(_0x37b0cb){if(_0x37b0cb){var _0xc762f8={'where':{'id':_[_0x4a3c('0x19')](_0x37b0cb,_0x4a3c('0x18'))},'raw':!![]};switch(_0x255ee6){case _0x4a3c('0x5'):_0xc762f8[_0x4a3c('0x1a')][_0x4a3c('0x1b')]=_0x4a3c('0x7');break;case _0x4a3c('0x1c'):_0xc762f8['where'][_0x4a3c('0x8')]=_0x4a3c('0x9');break;}return db[_0x255ee6]['findAll'](_0xc762f8);}else{return[];}});}}else{return[];}})[_0x4a3c('0xc')](function(_0x537d52){return _0x537d52;});}function joinOrLeaveQueues(_0x43ca84,_0x30a892,_0x446ba8,_0x1f10f1){_0x43ca84[_0x30a892](util[_0x4a3c('0x1d')](_0x4a3c('0x1e'),_0x446ba8,_0x1f10f1['name']));if(_0x1f10f1[_0x4a3c('0x1f')]){for(var _0x531458=0x0;_0x531458<_0x1f10f1[_0x4a3c('0x1f')][_0x4a3c('0x20')];_0x531458+=0x1){_0x43ca84[_0x30a892](util[_0x4a3c('0x1d')](_0x4a3c('0x21'),_0x1f10f1['Agents'][_0x531458][_0x4a3c('0x4')]));}}}function joinOrLeave(_0x4574a4,_0xe30090,_0x597b2e){var _0x10ff09;if(_0x4574a4[_0x4a3c('0x22')]['query']['id']){db['User'][_0x4a3c('0x23')]({'attributes':['id',_0x4a3c('0x4'),_0x4a3c('0x1b'),_0x4a3c('0x24')],'where':{'id':_0x4574a4[_0x4a3c('0x22')][_0x4a3c('0x25')]['id']},'include':[{'model':db[_0x4a3c('0x26')],'as':_0x4a3c('0x27'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4a3c('0x28')],'as':_0x4a3c('0x29'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x4a3c('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x4a3c('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x4a3c('0x2c')],'as':_0x4a3c('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x179b55){if(_0x179b55){_0x10ff09=_0x179b55;_0x4574a4[_0xe30090](util[_0x4a3c('0x1d')]('user:%s',_0x179b55[_0x4a3c('0x4')]));var _0x2eb071=[];switch(_0x179b55['role']){case'admin':_0x4574a4[_0xe30090](_0x4a3c('0x2e'));_0x4574a4[_0xe30090](_0x4a3c('0x2f'));if(queryQueues[_0x4a3c('0x30')](_0x4a3c('0x31'))){delete queryQueues['include'];}_0x2eb071[_0x4a3c('0x32')](db['VoiceQueue'][_0x4a3c('0x15')](queryQueues));_0x2eb071['push'](db[_0x4a3c('0x33')][_0x4a3c('0x15')](queryQueues));_0x2eb071[_0x4a3c('0x32')](db['FaxQueue'][_0x4a3c('0x15')](queryQueues));_0x2eb071['push'](db[_0x4a3c('0x34')][_0x4a3c('0x15')](queryQueues));_0x2eb071[_0x4a3c('0x32')](db[_0x4a3c('0x35')][_0x4a3c('0x15')](queryQueues));_0x2eb071[_0x4a3c('0x32')](db[_0x4a3c('0x36')][_0x4a3c('0x15')](queryQueues));_0x2eb071[_0x4a3c('0x32')](db['WhatsappQueue'][_0x4a3c('0x15')](queryQueues));_0x2eb071['push'](db[_0x4a3c('0x5')][_0x4a3c('0x15')](queryTelephones));_0x2eb071['push'](db[_0x4a3c('0x37')][_0x4a3c('0x15')](queryTrunks));_0x2eb071[_0x4a3c('0x32')](db['Campaign'][_0x4a3c('0x15')](queryCampaigns));_0x2eb071[_0x4a3c('0x32')](db[_0x4a3c('0x5')]['findAll'](queryAgents));break;case _0x4a3c('0x38'):_0x4574a4[_0xe30090]('voice:inbound');_0x4574a4[_0xe30090](_0x4a3c('0x2f'));_0x2eb071['push'](getAssociatedResources('VoiceQueues',_0x179b55[_0x4a3c('0x24')],_0x4a3c('0x39')));_0x2eb071[_0x4a3c('0x32')](getAssociatedResources(_0x4a3c('0xf'),_0x179b55['userProfileId'],_0x4a3c('0x33')));_0x2eb071['push'](getAssociatedResources(_0x4a3c('0x10'),_0x179b55[_0x4a3c('0x24')],_0x4a3c('0x3a')));_0x2eb071[_0x4a3c('0x32')](getAssociatedResources(_0x4a3c('0x11'),_0x179b55[_0x4a3c('0x24')],_0x4a3c('0x34')));_0x2eb071[_0x4a3c('0x32')](getAssociatedResources(_0x4a3c('0x3b'),_0x179b55[_0x4a3c('0x24')],_0x4a3c('0x35')));_0x2eb071[_0x4a3c('0x32')](getAssociatedResources('OpenchannelQueues',_0x179b55[_0x4a3c('0x24')],_0x4a3c('0x36')));_0x2eb071[_0x4a3c('0x32')](getAssociatedResources(_0x4a3c('0x13'),_0x179b55['userProfileId'],_0x4a3c('0x3c')));_0x2eb071[_0x4a3c('0x32')](getAssociatedResources('Telephones',_0x179b55['userProfileId'],_0x4a3c('0x5')));_0x2eb071[_0x4a3c('0x32')](getAssociatedResources(_0x4a3c('0x16'),_0x179b55[_0x4a3c('0x24')],_0x4a3c('0x37')));_0x2eb071[_0x4a3c('0x32')](getAssociatedResources(_0x4a3c('0x3d'),_0x179b55[_0x4a3c('0x24')],_0x4a3c('0x1c')));_0x2eb071[_0x4a3c('0x32')](db['User'][_0x4a3c('0x15')](queryAgents));break;case'agent':_0x4574a4[_0xe30090](_0x4a3c('0x2e'));_0x4574a4[_0xe30090](_0x4a3c('0x2f'));_0x2eb071[_0x4a3c('0x32')](_0x179b55[_0x4a3c('0x3e')]({'attributes':['id','name']}));_0x2eb071[_0x4a3c('0x32')](_0x179b55[_0x4a3c('0x3f')]({'attributes':['id','name']}));_0x2eb071['push'](_0x179b55[_0x4a3c('0x40')]({'attributes':['id','name']}));_0x2eb071[_0x4a3c('0x32')](_0x179b55['getSmsQueues']({'attributes':['id',_0x4a3c('0x4')]}));_0x2eb071[_0x4a3c('0x32')](_0x179b55[_0x4a3c('0x41')]({'attributes':['id',_0x4a3c('0x4')]}));_0x2eb071[_0x4a3c('0x32')](_0x179b55['getOpenchannelQueues']({'attributes':['id',_0x4a3c('0x4')]}));_0x2eb071[_0x4a3c('0x32')](_0x179b55['getWhatsappQueues']({'attributes':['id',_0x4a3c('0x4')]}));break;}return BPromise[_0x4a3c('0x42')](_0x2eb071);}})[_0x4a3c('0xc')](function(_0x45164b){if(_0x45164b&&_0x45164b[_0x4a3c('0x20')]){for(var _0x1a81ea=0x0;_0x1a81ea<_0x45164b[_0x4a3c('0x20')];_0x1a81ea+=0x1){for(var _0x6c0242=0x0;_0x6c0242<_0x45164b[_0x1a81ea][_0x4a3c('0x20')];_0x6c0242+=0x1){switch(_0x1a81ea){case 0x0:joinOrLeaveQueues(_0x4574a4,_0xe30090,_0x4a3c('0x43'),_0x45164b[_0x1a81ea][_0x6c0242]);break;case 0x1:joinOrLeaveQueues(_0x4574a4,_0xe30090,_0x4a3c('0x44'),_0x45164b[_0x1a81ea][_0x6c0242]);break;case 0x2:joinOrLeaveQueues(_0x4574a4,_0xe30090,'fax',_0x45164b[_0x1a81ea][_0x6c0242]);break;case 0x3:joinOrLeaveQueues(_0x4574a4,_0xe30090,_0x4a3c('0x45'),_0x45164b[_0x1a81ea][_0x6c0242]);break;case 0x4:joinOrLeaveQueues(_0x4574a4,_0xe30090,_0x4a3c('0x46'),_0x45164b[_0x1a81ea][_0x6c0242]);break;case 0x5:joinOrLeaveQueues(_0x4574a4,_0xe30090,_0x4a3c('0x47'),_0x45164b[_0x1a81ea][_0x6c0242]);break;case 0x6:joinOrLeaveQueues(_0x4574a4,_0xe30090,_0x4a3c('0x48'),_0x45164b[_0x1a81ea][_0x6c0242]);break;case 0x7:_0x4574a4[_0xe30090](util['format']('telephone:%s',_0x45164b[_0x1a81ea][_0x6c0242][_0x4a3c('0x4')]));break;case 0x8:_0x4574a4[_0xe30090](util['format'](_0x4a3c('0x49'),_0x45164b[_0x1a81ea][_0x6c0242]['name']));break;case 0x9:_0x4574a4[_0xe30090](util[_0x4a3c('0x1d')](_0x4a3c('0x4a'),_0x45164b[_0x1a81ea][_0x6c0242][_0x4a3c('0x8')],_0x45164b[_0x1a81ea][_0x6c0242][_0x4a3c('0x4')]));break;case 0xa:_0x4574a4[_0xe30090](util['format'](_0x4a3c('0x21'),_0x45164b[_0x1a81ea][_0x6c0242]['name']));break;}}}}})['then'](function(){if(_0xe30090==='leave'){var _0x2e2dea=_[_0x4a3c('0x19')](_0x10ff09['ChatInteractions'],'id');return _0x10ff09[_0x4a3c('0x4b')](_0x2e2dea)['then'](function(){for(var _0x47fbe5=0x0;_0x47fbe5<_0x2e2dea[_0x4a3c('0x20')];_0x47fbe5+=0x1){_0x597b2e[_0x4a3c('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2e2dea[_0x47fbe5]),'UserId':Number(_0x10ff09['id'])});}});}})['then'](function(){if(_0xe30090===_0x4a3c('0x4d')){var _0x19bb4f=_[_0x4a3c('0x19')](_0x10ff09['MailInteractions'],'id');return _0x10ff09[_0x4a3c('0x4e')](_0x19bb4f)[_0x4a3c('0xc')](function(){for(var _0x3519d5=0x0;_0x3519d5<_0x19bb4f[_0x4a3c('0x20')];_0x3519d5+=0x1){_0x597b2e[_0x4a3c('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x19bb4f[_0x3519d5]),'UserId':Number(_0x10ff09['id'])});}});}})['then'](function(){if(_0xe30090===_0x4a3c('0x4d')){var _0x5a6ecf=_[_0x4a3c('0x19')](_0x10ff09[_0x4a3c('0x29')],'id');return _0x10ff09['removeFaxInteractions'](_0x5a6ecf)[_0x4a3c('0xc')](function(){for(var _0x304fd6=0x0;_0x304fd6<_0x5a6ecf[_0x4a3c('0x20')];_0x304fd6+=0x1){_0x597b2e[_0x4a3c('0x4c')](_0x4a3c('0x4f'),{'FaxInteractionId':Number(_0x5a6ecf[_0x304fd6]),'UserId':Number(_0x10ff09['id'])});}});}})[_0x4a3c('0xc')](function(){if(_0xe30090==='leave'){var _0x3fcc5b=_[_0x4a3c('0x19')](_0x10ff09[_0x4a3c('0x2a')],'id');return _0x10ff09[_0x4a3c('0x50')](_0x3fcc5b)[_0x4a3c('0xc')](function(){for(var _0x5d31e5=0x0;_0x5d31e5<_0x3fcc5b['length'];_0x5d31e5+=0x1){_0x597b2e[_0x4a3c('0x4c')](_0x4a3c('0x51'),{'SmsInteractionId':Number(_0x3fcc5b[_0x5d31e5]),'UserId':Number(_0x10ff09['id'])});}});}})[_0x4a3c('0xc')](function(){if(_0xe30090==='leave'){var _0x59cb8f=_[_0x4a3c('0x19')](_0x10ff09['OpenchannelInteractions'],'id');return _0x10ff09[_0x4a3c('0x52')](_0x59cb8f)['then'](function(){for(var _0x3b8f90=0x0;_0x3b8f90<_0x59cb8f[_0x4a3c('0x20')];_0x3b8f90+=0x1){_0x597b2e['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x59cb8f[_0x3b8f90]),'UserId':Number(_0x10ff09['id'])});}});}})['then'](function(){if(_0xe30090===_0x4a3c('0x4d')){var _0x56510c=_[_0x4a3c('0x19')](_0x10ff09[_0x4a3c('0x2d')],'id');return _0x10ff09[_0x4a3c('0x53')](_0x56510c)[_0x4a3c('0xc')](function(){for(var _0x43ac57=0x0;_0x43ac57<_0x56510c[_0x4a3c('0x20')];_0x43ac57+=0x1){_0x597b2e['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x56510c[_0x43ac57]),'UserId':Number(_0x10ff09['id'])});}});}})['catch'](function(_0x312f64){_0x4574a4[_0x4a3c('0x54')](_0x312f64);});}}function onDisconnect(_0x448fd9,_0x53960e){joinOrLeave(_0x448fd9,_0x4a3c('0x4d'),_0x53960e);}function onConnect(_0x370ffd){joinOrLeave(_0x370ffd,'join');}exports[_0x4a3c('0x55')]=function(_0x598650){_0x598650['on'](_0x4a3c('0x56'),function(_0x4bc4e7){_0x4bc4e7['setMaxListeners'](0x0);_0x4bc4e7[_0x4a3c('0x57')]=_0x4bc4e7['request']['connection'][_0x4a3c('0x58')]+':'+_0x4bc4e7[_0x4a3c('0x59')][_0x4a3c('0x56')][_0x4a3c('0x5a')];_0x4bc4e7['connectedAt']=new Date();_0x4bc4e7[_0x4a3c('0x54')]=function(_0x33099c){console[_0x4a3c('0x54')]('SocketIO\x20'+_0x4bc4e7[_0x4a3c('0x5b')][_0x4a3c('0x4')]+'['+_0x4bc4e7[_0x4a3c('0x57')]+']',_0x33099c);};_0x4bc4e7['on'](_0x4a3c('0x5c'),function(){onDisconnect(_0x4bc4e7,_0x598650);_0x4bc4e7[_0x4a3c('0x54')](_0x4a3c('0x5d'));});onConnect(_0x4bc4e7);_0x4bc4e7[_0x4a3c('0x54')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 79fc4b9..33f7b5b 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 _0x9862=['Mail','MailInteraction','OpenchannelInteraction','Openchannel','request','EventManager','Trigger,\x20%s','error','catch','get','channel','event','UserId','User','name','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','find','then','format','default','length','hasOwnProperty','model','hook','callback','toLowerCase','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','FaxInteraction','Fax','FaxMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9862,0x184));var _0x2986=function(_0x3e25c9,_0x4ab755){_0x3e25c9=_0x3e25c9-0x0;var _0x1e0e21=_0x9862[_0x3e25c9];return _0x1e0e21;};'use strict';var util=require(_0x2986('0x0'));var db=require(_0x2986('0x1'))['db'];var jayson=require(_0x2986('0x2'));var logger=require(_0x2986('0x3'))('triggers');var client=jayson[_0x2986('0x4')][_0x2986('0x5')]({'port':0x232a});var triggers=[{'channel':_0x2986('0x6'),'model':_0x2986('0x7'),'event':_0x2986('0x8'),'condition':_0x2986('0x9'),'callback':afterCreate},{'channel':_0x2986('0x6'),'model':_0x2986('0x7'),'event':_0x2986('0xa'),'condition':_0x2986('0xb'),'callback':afterUpdate},{'channel':_0x2986('0x6'),'model':'ChatMessage','event':_0x2986('0x8'),'condition':_0x2986('0xc'),'callback':afterCreateMessage},{'channel':_0x2986('0xd'),'model':_0x2986('0xe'),'event':_0x2986('0x8'),'condition':_0x2986('0x9'),'callback':afterCreate},{'channel':'Sms','model':_0x2986('0xe'),'event':_0x2986('0xa'),'condition':_0x2986('0xb'),'callback':afterUpdate},{'channel':_0x2986('0xd'),'model':'SmsMessage','event':_0x2986('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x2986('0xf'),'model':_0x2986('0x10'),'event':_0x2986('0x8'),'condition':_0x2986('0x9'),'callback':afterCreate},{'channel':_0x2986('0xf'),'model':'WhatsappInteraction','event':_0x2986('0xa'),'condition':_0x2986('0xb'),'callback':afterUpdate},{'channel':_0x2986('0xf'),'model':'WhatsappMessage','event':_0x2986('0x8'),'condition':_0x2986('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x2986('0x11'),'event':_0x2986('0x8'),'condition':_0x2986('0x9'),'callback':afterCreate},{'channel':_0x2986('0x12'),'model':_0x2986('0x11'),'event':_0x2986('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':_0x2986('0x13'),'event':_0x2986('0x8'),'condition':_0x2986('0xc'),'callback':afterCreateMessage},{'channel':_0x2986('0x14'),'model':_0x2986('0x15'),'event':_0x2986('0x8'),'condition':_0x2986('0x9'),'callback':afterCreate},{'channel':'Mail','model':_0x2986('0x15'),'event':_0x2986('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x2986('0x14'),'model':'MailMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x2986('0x8'),'condition':_0x2986('0x9'),'callback':afterCreate},{'channel':'Openchannel','model':_0x2986('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x2986('0x17'),'model':'OpenchannelMessage','event':_0x2986('0x8'),'condition':_0x2986('0xc'),'callback':afterCreateMessage}];function request(_0x2c310f){return client[_0x2986('0x18')](_0x2986('0x19'),_0x2c310f)['then'](function(_0x1c962e){logger['info'](_0x2986('0x1a'),_0x2986('0x19'),_0x1c962e);if(_0x1c962e[_0x2986('0x1b')]){if(_0x1c962e[_0x2986('0x1b')]['code']===0x1f4){logger[_0x2986('0x1b')](_0x2986('0x1a'),_0x2986('0x19'),_0x1c962e[_0x2986('0x1b')]);}}})[_0x2986('0x1c')](function(_0x21416a){logger['error'](_0x2986('0x1a'),_0x2986('0x19'),_0x21416a);});}function afterCreateMessage(_0x27e5a5,_0x4a113f){return function(_0xa6b662,_0x3369cc){_0xa6b662=_0xa6b662[_0x2986('0x1d')]({'plain':!![]});_0xa6b662[_0x2986('0x1e')]=_0x27e5a5;_0xa6b662[_0x2986('0x1f')]=_0xa6b662['direction'];if(_0xa6b662[_0x2986('0x20')]){return db[_0x2986('0x21')]['find']({'where':{'id':_0xa6b662[_0x2986('0x20')]},'attributes':['id',_0x2986('0x22')],'raw':!![]})['then'](function(_0x3a6e16){_0xa6b662['interface']=util['format'](_0x2986('0x23'),_0x3a6e16[_0x2986('0x22')]);_0xa6b662[_0x2986('0x1e')]=_0x27e5a5;return request({'event':_0x2986('0x24'),'message':_0xa6b662});})[_0x2986('0x1c')](function(_0x1ce471){console[_0x2986('0x1b')](_0x1ce471);});}else{return request({'event':_0x2986('0x25'),'message':_0xa6b662});}};}function afterCreate(_0x3f3267,_0x107320){return function(_0x124d20,_0x18837f){_0x124d20=_0x124d20['get']({'plain':!![]});_0x124d20[_0x2986('0x1e')]=_0x3f3267;_0x124d20['event']=_0x2986('0x26');return request({'event':_0x107320,'message':_0x124d20});};}function afterUpdate(_0x1d7992,_0x5beda3){return function(_0x1fe4d7,_0xad5bb8){if(_0x1fe4d7[_0x2986('0x27')]('closed')&&_0x1fe4d7[_0x2986('0x28')]){_0x1fe4d7=_0x1fe4d7['get']({'plain':!![]});_0x1fe4d7['channel']=_0x1d7992;_0x1fe4d7[_0x2986('0x1f')]=_0x2986('0x28');if(_0x1fe4d7['UserId']){return db[_0x2986('0x21')][_0x2986('0x29')]({'where':{'id':_0x1fe4d7[_0x2986('0x20')]},'attributes':['id',_0x2986('0x22')],'raw':!![]})[_0x2986('0x2a')](function(_0x8f89e8){_0x1fe4d7['interface']=util[_0x2986('0x2b')](_0x2986('0x23'),_0x8f89e8[_0x2986('0x22')]);return request({'event':_0x5beda3,'message':_0x1fe4d7});})[_0x2986('0x1c')](function(_0x220ae9){console[_0x2986('0x1b')](_0x220ae9);});}else{return request({'event':_0x5beda3,'message':_0x1fe4d7});}}};}exports[_0x2986('0x2c')]=function(){for(var _0x5462fa=0x0;_0x5462fa=_0x28733f['agents']){throw Error(_0xaef8('0x14'));}_0x5b1802(_0x1b0a69);})[_0xaef8('0x15')](function(_0x441779){_0x321020(_0x441779);});});}; \ No newline at end of file +var _0xb3de=['chat','fax','sms','whatsapp','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','User','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','mail'];(function(_0x5712da,_0x5938c0){var _0x4ab54a=function(_0x3e5cfb){while(--_0x3e5cfb){_0x5712da['push'](_0x5712da['shift']());}};_0x4ab54a(++_0x5938c0);}(_0xb3de,0x1b1));var _0xeb3d=function(_0x19adc4,_0x2ff135){_0x19adc4=_0x19adc4-0x0;var _0x93ad24=_0xb3de[_0x19adc4];return _0x93ad24;};'use strict';var _=require(_0xeb3d('0x0'));var BPromise=require(_0xeb3d('0x1'));var db=require(_0xeb3d('0x2'))['db'];var util=require('./license/util');var channels=['voice',_0xeb3d('0x3'),_0xeb3d('0x4'),_0xeb3d('0x5'),_0xeb3d('0x6'),_0xeb3d('0x7'),'openchannel'];exports[_0xeb3d('0x8')]=function(){return channels;};exports[_0xeb3d('0x9')]=function(_0x393936){_0x393936=_0x393936[_0xeb3d('0xa')]();return _[_0xeb3d('0xb')](channels,_0x393936);};exports['clearBlockUser']=function(_0x1e9757,_0x44095d,_0x44535a,_0x3309e6){var _0x190338={'loginAttempts':_0x44095d,'blocked':_0x44535a};if(!_[_0xeb3d('0xc')](_0x3309e6)){_0x190338[_0xeb3d('0xd')]=_0x3309e6;}return _0x1e9757[_0xeb3d('0xe')](_0x190338);};exports[_0xeb3d('0xf')]=function(_0x15f399){return new BPromise(function(_0x4106fd,_0x3de0be){var _0x4fad6e=0x0;if(_0x15f399[_0xeb3d('0x10')]!=='agent'){_0x4106fd(_0x15f399);}db[_0xeb3d('0x11')]['count']({'where':{'role':_0xeb3d('0x12'),'online':!![],'id':{'$ne':_0x15f399['id']}}})[_0xeb3d('0x13')](function(_0x468514){_0x4fad6e=_0x468514;return util[_0xeb3d('0xf')]();})[_0xeb3d('0x13')](function(_0x5ac2a7){if(_0x5ac2a7&&_0x5ac2a7['agents']&&_0x4fad6e>=_0x5ac2a7[_0xeb3d('0x14')]){throw Error(_0xeb3d('0x15'));}_0x4106fd(_0x15f399);})[_0xeb3d('0x16')](function(_0x1dec89){_0x3de0be(_0x1dec89);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a2a4789..f7cdb7f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf68d=['status','render','json','exports'];(function(_0x26fde2,_0x2fda50){var _0x54e3ed=function(_0x54f8cb){while(--_0x54f8cb){_0x26fde2['push'](_0x26fde2['shift']());}};_0x54e3ed(++_0x2fda50);}(_0xf68d,0xff));var _0xdf68=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xf68d[_0x33032e];return _0x13316b;};'use strict';module[_0xdf68('0x0')][0x194]=function pageNotFound(_0x2a3a48,_0x4b6cf6){var _0x1ffb35='404';var _0xeabb00=0x194;var _0x342ecd={'status':_0xeabb00};_0x4b6cf6[_0xdf68('0x1')](_0x342ecd[_0xdf68('0x1')]);_0x4b6cf6[_0xdf68('0x2')](_0x1ffb35,{},function(_0x1e9ff3,_0x1fa398){if(_0x1e9ff3){return _0x4b6cf6[_0xdf68('0x1')](_0x342ecd[_0xdf68('0x1')])[_0xdf68('0x3')](_0x342ecd);}_0x4b6cf6['send'](_0x1fa398);});}; \ No newline at end of file +var _0x9946=['exports','404','status','render','json','send'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0x9946,0x17a));var _0x6994=function(_0x10d864,_0x5d2d91){_0x10d864=_0x10d864-0x0;var _0x1b2775=_0x9946[_0x10d864];return _0x1b2775;};'use strict';module[_0x6994('0x0')][0x194]=function pageNotFound(_0x5b7463,_0x2eb5a4){var _0x8fba40=_0x6994('0x1');var _0x2dbff6=0x194;var _0x19b215={'status':_0x2dbff6};_0x2eb5a4[_0x6994('0x2')](_0x19b215[_0x6994('0x2')]);_0x2eb5a4[_0x6994('0x3')](_0x8fba40,{},function(_0xf04b72,_0x4386d7){if(_0xf04b72){return _0x2eb5a4[_0x6994('0x2')](_0x19b215['status'])[_0x6994('0x4')](_0x19b215);}_0x2eb5a4[_0x6994('0x5')](_0x4386d7);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 44136b2..4194717 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd634=['../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','SmsInteractions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','ChatQueues','UserChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Team','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','Contact','ContactId','MailAccount','MailAccountId','MailServerOut','Dispositions','Answers','Interactions','Applications','ListId','Template','TemplateId','mandatoryDispositionPause','UserMailQueue','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','restrict','TagId','List','Dashboard','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','Owner','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','ChatWebsiteId','ProactiveActions','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CompanyId','JscriptySessions','cm_contact_has_tags','Agent','Queue','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','SalesforceAccount','Description','Field','SugarcrmAccount','Subject','DeskAccount','int_desk_configuration_has_tags','VariableId','int_zendesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Account','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','FromId','SessionId','ProjectId','team_has_chat_queues','FaxQueues','SmsQueues','team_has_whatsapp_queues','Hoppers','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','FromChatWebsiteId','ToAgent','ToChatQueueId','ToQueue','ToAccount','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','UserProfileSection','Resources','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','../config/environment','sequelize','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','username','password','options','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','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','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','../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/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0xd634,0xf4));var _0x4d63=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0xd634[_0x1488cd];return _0x63fa13;};'use strict';var path=require('path');var config=require(_0x4d63('0x0'));var Sequelize=require(_0x4d63('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x4d63('0x2')]();config[_0x4d63('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x4d63('0x3'),'username':_0x4d63('0x4'),'password':_0x4d63('0x5'),'options':{'host':_0x4d63('0x6'),'port':0xcea,'dialect':_0x4d63('0x7'),'dialectOptions':{'charset':_0x4d63('0x8')},'logging':![],'timezone':timezone[_0x4d63('0x9')](),'define':{'charset':_0x4d63('0xa'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':_0x4d63('0x4'),'password':_0x4d63('0x5'),'options':{'host':_0x4d63('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x4d63('0x8')},'logging':![],'timezone':timezone[_0x4d63('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4d63('0x1')]['database'],config[_0x4d63('0x1')][_0x4d63('0xb')],config[_0x4d63('0x1')][_0x4d63('0xc')],config[_0x4d63('0x1')][_0x4d63('0xd')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config['sequelizeHistory'][_0x4d63('0xb')],config[_0x4d63('0xe')][_0x4d63('0xc')],config[_0x4d63('0xe')]['options'])};db[_0x4d63('0xf')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x11'));db[_0x4d63('0x12')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x13'));db['VoiceContext']=db['sequelize'][_0x4d63('0x10')]('../api/voiceContext/voiceContext.model');db[_0x4d63('0x14')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x15'));db[_0x4d63('0x16')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x17'));db['VoiceQueue']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x18'));db['VoiceRecording']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x19'));db[_0x4d63('0x1a')]=db['sequelize'][_0x4d63('0x10')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x1b'));db[_0x4d63('0x1c')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x1d'));db[_0x4d63('0x1e')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/voiceCallReport/voiceCallReport.model');db[_0x4d63('0x1f')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x20'));db[_0x4d63('0x21')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x22'));db[_0x4d63('0x23')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x24'));db[_0x4d63('0x25')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x26'));db['Trunk']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x27'));db[_0x4d63('0x28')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x4d63('0x29')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x2a'));db[_0x4d63('0x2b')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x2c'));db['UserChatQueue']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x2d'));db['UserMailQueue']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/userMailQueue/userMailQueue.model');db[_0x4d63('0x2e')]=db['sequelize']['import'](_0x4d63('0x2f'));db[_0x4d63('0x30')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x31'));db[_0x4d63('0x32')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x33'));db[_0x4d63('0x34')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x35'));db[_0x4d63('0x36')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x37'));db['MailServerOut']=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x38'));db['MailAccount']=db['sequelize'][_0x4d63('0x10')]('../api/mailAccount/mailAccount.model');db[_0x4d63('0x39')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/mailQueue/mailQueue.model');db[_0x4d63('0x3a')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x3b'));db[_0x4d63('0x3c')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x3d'));db[_0x4d63('0x3e')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x3f'));db[_0x4d63('0x40')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x41'));db[_0x4d63('0x42')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x43'));db['Dashboard']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x44'));db['DashboardItem']=db[_0x4d63('0x1')]['import'](_0x4d63('0x45'));db[_0x4d63('0x46')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x47'));db[_0x4d63('0x48')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x49'));db[_0x4d63('0x4a')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x4b'));db[_0x4d63('0x4c')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x4d'));db['FaxQueue']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x4e'));db[_0x4d63('0x4f')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x50'));db['SmsAccount']=db[_0x4d63('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x4d63('0x51')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x52'));db[_0x4d63('0x53')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x54'));db[_0x4d63('0x55')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x56'));db[_0x4d63('0x57')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x58'));db[_0x4d63('0x59')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x5a'));db['OpenchannelApplication']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x4d63('0x1')]['import'](_0x4d63('0x5b'));db[_0x4d63('0x5c')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x5d'));db['OpenchannelQueue']=db[_0x4d63('0x1')]['import'](_0x4d63('0x5e'));db[_0x4d63('0x5f')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/chatWebsite/chatWebsite.model');db[_0x4d63('0x60')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x61'));db[_0x4d63('0x62')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/chatApplication/chatApplication.model');db[_0x4d63('0x63')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x64'));db[_0x4d63('0x65')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x66'));db[_0x4d63('0x67')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x68'));db[_0x4d63('0x69')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x6a'));db[_0x4d63('0x6b')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x6c'));db[_0x4d63('0x6d')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x6e'));db[_0x4d63('0x6f')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x70'));db[_0x4d63('0x71')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x72'));db[_0x4d63('0x73')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x74'));db[_0x4d63('0x75')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x76'));db[_0x4d63('0x77')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x78'));db[_0x4d63('0x79')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x7a'));db[_0x4d63('0x7b')]=db['sequelize'][_0x4d63('0x10')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x4d63('0x7c')]=db['sequelize']['import'](_0x4d63('0x7d'));db[_0x4d63('0x7e')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x7f'));db[_0x4d63('0x80')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x81'));db[_0x4d63('0x82')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x83'));db[_0x4d63('0x84')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x85'));db[_0x4d63('0x86')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x87'));db[_0x4d63('0x88')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x89'));db[_0x4d63('0x8a')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x8b'));db['Cdr']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/cdr/cdr.model');db[_0x4d63('0x8c')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x8d'));db[_0x4d63('0x8e')]=db[_0x4d63('0x1')]['import'](_0x4d63('0x8f'));db[_0x4d63('0x90')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x91'));db[_0x4d63('0x92')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x93'));db['Template']=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x94'));db[_0x4d63('0x95')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x96'));db[_0x4d63('0x97')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x98'));db[_0x4d63('0x99')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x9a'));db[_0x4d63('0x9b')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x9c'));db[_0x4d63('0x9d')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x9e'));db[_0x4d63('0x9f')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa0'));db[_0x4d63('0xa1')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xa2'));db['AnalyticMetric']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa3'));db[_0x4d63('0xa4')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xa5'));db['AnalyticTreeReport']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa6'));db['SalesforceAccount']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa7'));db[_0x4d63('0xa8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xa9'));db[_0x4d63('0xaa')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xab'));db['SugarcrmAccount']=db[_0x4d63('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x4d63('0xac')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xad'));db[_0x4d63('0xae')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xaf'));db['DeskAccount']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/intDeskAccount/intDeskAccount.model');db[_0x4d63('0xb0')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xb1'));db[_0x4d63('0xb2')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xb3'));db[_0x4d63('0xb4')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/intZohoAccount/intZohoAccount.model');db[_0x4d63('0xb5')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xb6'));db[_0x4d63('0xb7')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xb8'));db[_0x4d63('0xb9')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xba'));db[_0x4d63('0xbb')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xbc'));db[_0x4d63('0xbd')]=db['sequelize'][_0x4d63('0x10')]('../api/intZendeskField/intZendeskField.model');db[_0x4d63('0xbe')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xbf'));db[_0x4d63('0xc0')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xc1'));db[_0x4d63('0xc2')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xc3'));db[_0x4d63('0xc4')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xc5'));db['VtigerConfiguration']=db[_0x4d63('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x4d63('0xc6')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xc7'));db['ServicenowAccount']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x4d63('0xc8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xc9'));db[_0x4d63('0xca')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xcb'));db['Dynamics365Account']=db[_0x4d63('0x1')]['import'](_0x4d63('0xcc'));db[_0x4d63('0xcd')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xce'));db['Dynamics365Field']=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xcf'));db[_0x4d63('0xd0')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xd1'));db['FreshsalesConfiguration']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x4d63('0x1')]['import'](_0x4d63('0xd2'));db[_0x4d63('0x99')]=db[_0x4d63('0x1')]['import']('../api/integration/integration.model');db[_0x4d63('0xd3')]=db[_0x4d63('0x1')]['import']('../api/network/network.model');db[_0x4d63('0xd4')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xd5'));db[_0x4d63('0xd6')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xd7'));db[_0x4d63('0xd8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xd9'));db[_0x4d63('0xda')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xdb'));db[_0x4d63('0xdc')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/smsQueueReport/smsQueueReport.model');db[_0x4d63('0xdd')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xde'));db['SquareDetailsReport']=db[_0x4d63('0x1')]['import'](_0x4d63('0xdf'));db[_0x4d63('0xe0')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xe1'));db['Setting']=db[_0x4d63('0x1')]['import'](_0x4d63('0xe2'));db['SquareOdbc']=db[_0x4d63('0x1')]['import'](_0x4d63('0xe3'));db[_0x4d63('0xe4')]=db[_0x4d63('0x1')]['import'](_0x4d63('0xe5'));db[_0x4d63('0xe6')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xe7'));db[_0x4d63('0xe8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xe9'));db['Team']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xea'));db[_0x4d63('0xeb')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xec'));db['Campaign']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xed'));db['Migration']=db[_0x4d63('0x1')]['import'](_0x4d63('0xee'));db['Attachment']=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xef'));db[_0x4d63('0xf0')]=db['sequelize']['import'](_0x4d63('0xf1'));db['MailTransferReport']=db[_0x4d63('0x1')]['import'](_0x4d63('0xf2'));db[_0x4d63('0xf3')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xf4'));db['FaxTransferReport']=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize']['import'](_0x4d63('0xf5'));db[_0x4d63('0xf6')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xf7'));db[_0x4d63('0xf8')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0xf9'));db[_0x4d63('0xfa')]=db[_0x4d63('0x1')][_0x4d63('0x10')]('../api/voicePrefix/voicePrefix.model');db[_0x4d63('0xfb')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xfc'));db['UserProfileSection']=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xfd'));db[_0x4d63('0xfe')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0xff'));db[_0x4d63('0x100')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x101'));db[_0x4d63('0x102')]=db['sequelize']['import'](_0x4d63('0x103'));db[_0x4d63('0x104')]=db['sequelize']['import'](_0x4d63('0x105'));db[_0x4d63('0x106')]=db['sequelize']['import'](_0x4d63('0x107'));db[_0x4d63('0x108')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x109'));db['WhatsappQueueReport']=db['sequelize']['import'](_0x4d63('0x10a'));db[_0x4d63('0x10b')]=db['sequelize'][_0x4d63('0x10')](_0x4d63('0x10c'));db[_0x4d63('0x10d')]=db['sequelize'][_0x4d63('0x10')]('../api/whatsappQueue/whatsappQueue.model');db[_0x4d63('0x10e')]=db[_0x4d63('0x1')][_0x4d63('0x10')](_0x4d63('0x10f'));db[_0x4d63('0xf')][_0x4d63('0x110')](db[_0x4d63('0x111')],{'as':_0x4d63('0x111'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x113')});db['User']['hasMany'](db['VoiceRecording'],{'as':_0x4d63('0x114'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db['UserVoiceQueueRt'],{'as':_0x4d63('0x116'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')]['hasMany'](db['VoiceExtension'],{'as':_0x4d63('0x117'),'onDelete':'cascade','hooks':!![]});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x77')],{'as':_0x4d63('0x118'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db['CmHopperHistory'],{'as':_0x4d63('0x119'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x4d63('0x113')});db['User']['hasMany'](db[_0x4d63('0x11a')],{'as':'OpenchannelInteractions','foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x63')],{'as':'ChatInteractions','foreignKey':_0x4d63('0x113')});db['User'][_0x4d63('0x115')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x4a')],{'as':_0x4d63('0x11b'),'foreignKey':_0x4d63('0x113')});db['User'][_0x4d63('0x115')](db[_0x4d63('0x3c')],{'as':_0x4d63('0x11c'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')][_0x4d63('0x115')](db[_0x4d63('0x106')],{'as':_0x4d63('0x11d'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0xf')]['hasMany'](db[_0x4d63('0x100')],{'as':_0x4d63('0x11e'),'foreignKey':_0x4d63('0x11f')});db['User'][_0x4d63('0x120')](db[_0x4d63('0xfb')],{'as':_0x4d63('0xfb'),'foreignKey':_0x4d63('0x121')});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x6b')],{'as':_0x4d63('0x122'),'through':_0x4d63('0x123')});db[_0x4d63('0xf')]['belongsToMany'](db['CmContact'],{'as':_0x4d63('0x124'),'through':_0x4d63('0x125')});db['User'][_0x4d63('0x126')](db[_0x4d63('0xf8')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x4d63('0xf')][_0x4d63('0x126')](db['Team'],{'through':_0x4d63('0x127')});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x3c')],{'as':_0x4d63('0x11c'),'through':_0x4d63('0x128')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x63')],{'as':_0x4d63('0x129'),'through':_0x4d63('0x12a')});db[_0x4d63('0xf')][_0x4d63('0x126')](db['FaxInteraction'],{'as':_0x4d63('0x11b'),'through':'user_has_fax_interactions'});db[_0x4d63('0xf')][_0x4d63('0x126')](db['SmsInteraction'],{'as':_0x4d63('0x12b'),'through':'user_has_sms_interactions'});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x11a')],{'as':_0x4d63('0x12c'),'through':_0x4d63('0x12d')});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x106')],{'as':_0x4d63('0x11d'),'through':_0x4d63('0x12e')});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x12f')],{'as':_0x4d63('0x130'),'through':_0x4d63('0x2b'),'required':![]});db[_0x4d63('0xf')]['belongsToMany'](db[_0x4d63('0x39')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':_0x4d63('0x131'),'through':_0x4d63('0x132'),'required':![],'hooks':!![]});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x133')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x57')],{'as':'SmsQueues','through':_0x4d63('0x30'),'required':![]});db['User'][_0x4d63('0x126')](db[_0x4d63('0x134')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db['User'][_0x4d63('0x126')](db[_0x4d63('0x10d')],{'as':_0x4d63('0x135'),'through':_0x4d63('0x34'),'required':![]});db['User'][_0x4d63('0x126')](db[_0x4d63('0xf8')],{'through':_0x4d63('0x136')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0xfa')],{'as':_0x4d63('0x137'),'through':_0x4d63('0x138'),'required':![]});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x5f')],{'as':_0x4d63('0x139'),'through':_0x4d63('0x13a')});db['User'][_0x4d63('0x126')](db['FaxAccount'],{'as':'FaxAccounts','through':_0x4d63('0x13b')});db['User'][_0x4d63('0x126')](db['MailAccount'],{'as':_0x4d63('0x13c'),'through':_0x4d63('0x13d')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x59')],{'as':_0x4d63('0x13e'),'through':_0x4d63('0x13f')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x140')],{'as':'SmsAccounts','through':_0x4d63('0x141')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0x102')],{'as':_0x4d63('0x142'),'through':_0x4d63('0x143')});db[_0x4d63('0xf')][_0x4d63('0x126')](db[_0x4d63('0xe4')],{'as':_0x4d63('0x144'),'through':_0x4d63('0x145')});db['VoiceChanSpy'][_0x4d63('0x115')](db['VoiceExtension'],{'as':_0x4d63('0x146'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x147')});db['VoiceContext'][_0x4d63('0x115')](db[_0x4d63('0x14')],{'onDelete':_0x4d63('0x112')});db[_0x4d63('0x14')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0x4d63('0x112')});db[_0x4d63('0x16')][_0x4d63('0x126')](db[_0x4d63('0x90')],{'as':'Sounds','through':_0x4d63('0x148')});db['VoiceQueue'][_0x4d63('0x115')](db[_0x4d63('0x29')],{'as':_0x4d63('0x149'),'foreignKey':_0x4d63('0x14a')});db['VoiceQueue']['hasMany'](db[_0x4d63('0x73')],{'as':'Hoppers','foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')][_0x4d63('0x115')](db['CmHopperFinal'],{'as':_0x4d63('0x118'),'foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')]['hasMany'](db[_0x4d63('0x79')],{'as':_0x4d63('0x14b'),'foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')][_0x4d63('0x115')](db[_0x4d63('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')][_0x4d63('0x115')](db[_0x4d63('0x75')],{'as':_0x4d63('0x14c'),'foreignKey':_0x4d63('0x14a')});db[_0x4d63('0x12f')][_0x4d63('0x115')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x4d63('0x14a')});db['VoiceQueue'][_0x4d63('0x120')](db[_0x4d63('0x14d')],{'as':_0x4d63('0x14d'),'foreignKey':_0x4d63('0x14e')});db[_0x4d63('0x12f')][_0x4d63('0x120')](db['Trunk'],{'as':_0x4d63('0x14f'),'foreignKey':_0x4d63('0x150')});db[_0x4d63('0x12f')][_0x4d63('0x120')](db[_0x4d63('0x88')],{'as':_0x4d63('0x88'),'foreignKey':_0x4d63('0x151')});db[_0x4d63('0x12f')][_0x4d63('0x120')](db[_0x4d63('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':_0x4d63('0x152')});db[_0x4d63('0x12f')][_0x4d63('0x126')](db['CmList'],{'as':_0x4d63('0x153'),'through':_0x4d63('0x154')});db[_0x4d63('0x12f')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x2b')});db[_0x4d63('0x12f')]['belongsToMany'](db[_0x4d63('0x156')],{'as':_0x4d63('0x157'),'through':_0x4d63('0x158')});db[_0x4d63('0x12f')][_0x4d63('0x126')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x159'),'through':_0x4d63('0x15a')});db[_0x4d63('0x15b')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0xf'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0x1a')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':'User','foreignKey':'UserId'});db[_0x4d63('0x111')][_0x4d63('0x115')](db[_0x4d63('0x1c')],{'as':_0x4d63('0x15c'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x4d63('0x15d')});db[_0x4d63('0x1c')][_0x4d63('0x120')](db[_0x4d63('0x111')],{'foreignKey':_0x4d63('0x15e'),'targetKey':_0x4d63('0x15d')});db[_0x4d63('0x1e')][_0x4d63('0x115')](db['VoiceQueueReport'],{'as':_0x4d63('0x15f'),'foreignKey':_0x4d63('0x160'),'constraints':![]});db[_0x4d63('0x1e')][_0x4d63('0x115')](db[_0x4d63('0x21')],{'as':'AgentReports','foreignKey':_0x4d63('0x160'),'constraints':![]});db[_0x4d63('0x1e')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0xf'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0x1e')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x36')][_0x4d63('0x120')](db[_0x4d63('0x163')],{'as':_0x4d63('0x163'),'foreignKey':_0x4d63('0x164')});db['MailServerOut'][_0x4d63('0x120')](db[_0x4d63('0x163')],{'as':_0x4d63('0x163'),'foreignKey':_0x4d63('0x164')});db['MailAccount'][_0x4d63('0x110')](db[_0x4d63('0x36')],{'as':'Imap','onDelete':_0x4d63('0x112')});db[_0x4d63('0x163')][_0x4d63('0x110')](db[_0x4d63('0x165')],{'as':'Smtp','onDelete':_0x4d63('0x112')});db[_0x4d63('0x163')][_0x4d63('0x115')](db['Disposition'],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x164')});db[_0x4d63('0x163')]['hasMany'](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':_0x4d63('0x164')});db[_0x4d63('0x163')][_0x4d63('0x115')](db[_0x4d63('0x3e')],{'as':'Messages','foreignKey':_0x4d63('0x164')});db[_0x4d63('0x163')][_0x4d63('0x115')](db[_0x4d63('0x3c')],{'as':_0x4d63('0x168')});db['MailAccount'][_0x4d63('0x115')](db[_0x4d63('0x40')],{'as':_0x4d63('0x169')});db['MailAccount'][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':'List','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0x163')][_0x4d63('0x120')](db[_0x4d63('0x16b')],{'as':_0x4d63('0x16b'),'foreignKey':_0x4d63('0x16c')});db[_0x4d63('0x163')]['belongsTo'](db[_0x4d63('0x8a')],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x163')]['belongsToMany'](db[_0x4d63('0xf')],{'as':'Agents','through':_0x4d63('0x13d')});db[_0x4d63('0x39')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':'Agents','through':_0x4d63('0x16e')});db[_0x4d63('0x39')][_0x4d63('0x126')](db[_0x4d63('0x156')],{'through':_0x4d63('0x16f'),'as':_0x4d63('0x157')});db[_0x4d63('0x3c')][_0x4d63('0x115')](db[_0x4d63('0x3e')],{'as':_0x4d63('0x15c'),'onDelete':'cascade','foreignKey':_0x4d63('0x170')});db[_0x4d63('0x3c')][_0x4d63('0x120')](db['MailAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x164')});db[_0x4d63('0x3c')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x3c')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db[_0x4d63('0x92')],{'through':_0x4d63('0x172'),'as':_0x4d63('0x173')});db[_0x4d63('0x3c')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x172'),'as':_0x4d63('0x174')});db[_0x4d63('0x3c')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x128'),'foreignKey':_0x4d63('0x170')});db['MailMessage'][_0x4d63('0x115')](db[_0x4d63('0x176')],{'as':_0x4d63('0x177'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0x3e')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0xf')});db[_0x4d63('0x3e')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161')});db[_0x4d63('0x3e')][_0x4d63('0x120')](db['MailInteraction'],{'as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x170')});db[_0x4d63('0x3e')][_0x4d63('0x120')](db[_0x4d63('0x163')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x4d63('0x40')][_0x4d63('0x120')](db['User'],{'onDelete':'restrict'});db['MailApplication'][_0x4d63('0x120')](db[_0x4d63('0x39')],{'onDelete':_0x4d63('0x179')});db['MailApplication'][_0x4d63('0x120')](db[_0x4d63('0x163')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x40')][_0x4d63('0x120')](db[_0x4d63('0x88')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['MailApplication'][_0x4d63('0x120')](db[_0x4d63('0x92')],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x17a')});db[_0x4d63('0x42')][_0x4d63('0x120')](db[_0x4d63('0x163')],{});db[_0x4d63('0x42')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x42')][_0x4d63('0x120')](db[_0x4d63('0x3c')],{});db[_0x4d63('0x42')][_0x4d63('0x120')](db[_0x4d63('0x3e')],{});db['MailQueueReport'][_0x4d63('0x120')](db['User'],{});db[_0x4d63('0x42')][_0x4d63('0x120')](db['MailQueue'],{});db[_0x4d63('0x17c')]['hasMany'](db['DashboardItem'],{'as':_0x4d63('0x17d'),'onDelete':'cascade'});db[_0x4d63('0x46')][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x4d63('0x115')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4d63('0x17e')});db[_0x4d63('0x46')][_0x4d63('0x115')](db['FaxInteraction'],{'as':_0x4d63('0x168')});db[_0x4d63('0x46')][_0x4d63('0x115')](db[_0x4d63('0x48')],{'as':_0x4d63('0x169')});db[_0x4d63('0x46')]['hasMany'](db[_0x4d63('0x14')],{'as':_0x4d63('0x17f'),'onDelete':'cascade'});db['FaxAccount'][_0x4d63('0x115')](db[_0x4d63('0x4c')],{'as':_0x4d63('0x15c')});db[_0x4d63('0x46')][_0x4d63('0x120')](db[_0x4d63('0x14d')],{'as':_0x4d63('0x14d')});db[_0x4d63('0x46')][_0x4d63('0x120')](db['CmList'],{'as':'List','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0x46')][_0x4d63('0x120')](db['Pause'],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x46')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':'user_has_fax_accounts'});db[_0x4d63('0x48')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x48')][_0x4d63('0x120')](db['FaxQueue'],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x48')]['belongsTo'](db[_0x4d63('0x46')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x48')][_0x4d63('0x120')](db[_0x4d63('0x92')],{'onDelete':_0x4d63('0x179'),'foreignKey':'TagId'});db['FaxInteraction']['hasMany'](db[_0x4d63('0x4c')],{'as':_0x4d63('0x15c'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x180')});db[_0x4d63('0x4a')][_0x4d63('0x120')](db[_0x4d63('0x46')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x4d63('0x4a')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':'Contact','foreignKey':_0x4d63('0x162')});db[_0x4d63('0x4a')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':'Owner','foreignKey':_0x4d63('0x113')});db[_0x4d63('0x4a')]['belongsToMany'](db['Tag'],{'through':_0x4d63('0x181'),'as':_0x4d63('0x173')});db[_0x4d63('0x4a')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x181'),'as':'ThroughTags'});db[_0x4d63('0x4a')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x182'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x112'),'as':'User'});db['FaxMessage'][_0x4d63('0x120')](db[_0x4d63('0x4a')],{'as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x180')});db['FaxMessage'][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161')});db[_0x4d63('0x4c')][_0x4d63('0x120')](db[_0x4d63('0x176')],{'as':_0x4d63('0x176'),'foreignKey':_0x4d63('0x183')});db[_0x4d63('0x4c')]['belongsTo'](db[_0x4d63('0x46')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x17e')});db[_0x4d63('0x133')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':'UserFaxQueue'});db[_0x4d63('0x133')][_0x4d63('0x126')](db[_0x4d63('0x156')],{'through':_0x4d63('0x184'),'as':_0x4d63('0x157')});db[_0x4d63('0x4f')][_0x4d63('0x120')](db[_0x4d63('0x46')],{});db[_0x4d63('0x4f')]['belongsTo'](db['CmList'],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db['FaxQueueReport'][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':'Contact','foreignKey':'ContactId'});db['FaxQueueReport'][_0x4d63('0x120')](db[_0x4d63('0x4a')],{});db[_0x4d63('0x4f')]['belongsTo'](db[_0x4d63('0x4c')],{});db[_0x4d63('0x4f')]['belongsTo'](db[_0x4d63('0xf')],{});db[_0x4d63('0x4f')][_0x4d63('0x120')](db[_0x4d63('0x133')],{});db[_0x4d63('0x140')][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x185')});db[_0x4d63('0x140')][_0x4d63('0x115')](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsMessage'],{'as':'Messages','foreignKey':_0x4d63('0x185')});db['SmsAccount'][_0x4d63('0x115')](db[_0x4d63('0x53')],{'as':_0x4d63('0x168')});db[_0x4d63('0x140')]['hasMany'](db[_0x4d63('0x51')],{'as':_0x4d63('0x169')});db[_0x4d63('0x140')]['belongsTo'](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db['SmsAccount'][_0x4d63('0x120')](db['Pause'],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x140')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x4d63('0x51')]['belongsTo'](db[_0x4d63('0xf')],{'onDelete':'restrict'});db[_0x4d63('0x51')][_0x4d63('0x120')](db['SmsQueue'],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x51')][_0x4d63('0x120')](db[_0x4d63('0x140')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x51')][_0x4d63('0x120')](db['Interval'],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x151')});db[_0x4d63('0x51')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x4d63('0x53')][_0x4d63('0x115')](db[_0x4d63('0x55')],{'as':_0x4d63('0x15c'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x186')});db[_0x4d63('0x53')][_0x4d63('0x120')](db['SmsAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x185')});db[_0x4d63('0x53')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x53')][_0x4d63('0x120')](db['User'],{'as':_0x4d63('0x187'),'foreignKey':_0x4d63('0x113')});db['SmsInteraction'][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x188'),'as':_0x4d63('0x173')});db[_0x4d63('0x53')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':'sms_interaction_has_tags','as':_0x4d63('0x174')});db[_0x4d63('0x53')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':'user_has_sms_interactions','foreignKey':_0x4d63('0x186')});db[_0x4d63('0x55')][_0x4d63('0x120')](db['User'],{'as':_0x4d63('0xf')});db[_0x4d63('0x55')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':'cascade','as':'Contact'});db[_0x4d63('0x55')][_0x4d63('0x120')](db[_0x4d63('0x53')],{'onDelete':_0x4d63('0x112'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x4d63('0x55')][_0x4d63('0x120')](db[_0x4d63('0x140')],{'as':'Account','foreignKey':_0x4d63('0x185')});db[_0x4d63('0x57')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x30'),'foreignKey':_0x4d63('0x189')});db['SmsQueue'][_0x4d63('0x126')](db['Team'],{'through':'team_has_sms_queues','as':_0x4d63('0x157')});db['OpenchannelAccount'][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x59')][_0x4d63('0x115')](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x59')][_0x4d63('0x115')](db[_0x4d63('0x11a')],{'as':_0x4d63('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x4d63('0x59')]['hasMany'](db[_0x4d63('0x5c')],{'as':_0x4d63('0x15c'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x59')][_0x4d63('0x115')](db['OpenchannelApplication'],{'as':_0x4d63('0x169'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x59')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId'});db[_0x4d63('0x59')][_0x4d63('0x120')](db['Pause'],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x59')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x13f')});db[_0x4d63('0x18b')]['belongsTo'](db[_0x4d63('0xf')],{'onDelete':'restrict'});db[_0x4d63('0x18b')][_0x4d63('0x120')](db['OpenchannelQueue'],{'onDelete':_0x4d63('0x179'),'foreignKey':'OpenchannelQueueId'});db[_0x4d63('0x18b')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x18b')][_0x4d63('0x120')](db['Interval'],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x151')});db[_0x4d63('0x18b')][_0x4d63('0x120')](db[_0x4d63('0x92')],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x17a')});db['OpenchannelInteraction'][_0x4d63('0x115')](db[_0x4d63('0x5c')],{'as':_0x4d63('0x15c'),'onDelete':_0x4d63('0x112'),'foreignKey':'OpenchannelInteractionId'});db[_0x4d63('0x11a')][_0x4d63('0x120')](db[_0x4d63('0x59')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x11a')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x11a')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0x187'),'foreignKey':_0x4d63('0x113')});db['OpenchannelInteraction'][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x18c'),'as':_0x4d63('0x173')});db[_0x4d63('0x11a')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x18c'),'as':_0x4d63('0x174')});db['OpenchannelInteraction'][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':'Users','through':_0x4d63('0x12d'),'foreignKey':'OpenchannelInteractionId'});db[_0x4d63('0x5c')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0xf')});db[_0x4d63('0x5c')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161')});db[_0x4d63('0x5c')][_0x4d63('0x120')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x18d')});db[_0x4d63('0x5c')][_0x4d63('0x120')](db[_0x4d63('0x176')],{'as':'Attachment','foreignKey':_0x4d63('0x183')});db[_0x4d63('0x5c')][_0x4d63('0x120')](db[_0x4d63('0x59')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x18a')});db[_0x4d63('0x134')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x32'),'foreignKey':_0x4d63('0x18e')});db[_0x4d63('0x134')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0x4d63('0x157')});db['ChatWebsite'][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x5f')][_0x4d63('0x115')](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x5f')]['hasMany'](db[_0x4d63('0x6d')],{'as':_0x4d63('0x190')});db[_0x4d63('0x5f')][_0x4d63('0x115')](db['ChatInteraction'],{'as':_0x4d63('0x168')});db[_0x4d63('0x5f')][_0x4d63('0x115')](db[_0x4d63('0x62')],{'as':_0x4d63('0x169')});db[_0x4d63('0x5f')][_0x4d63('0x115')](db[_0x4d63('0x65')],{'as':_0x4d63('0x15c')});db[_0x4d63('0x5f')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db[_0x4d63('0x5f')][_0x4d63('0x120')](db['Interval'],{'as':'Interval','foreignKey':_0x4d63('0x151')});db['ChatWebsite'][_0x4d63('0x120')](db[_0x4d63('0x8a')],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x5f')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':'user_has_chat_websites'});db[_0x4d63('0x60')][_0x4d63('0x120')](db[_0x4d63('0x59')],{});db[_0x4d63('0x60')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db['OpenchannelQueueReport'][_0x4d63('0x120')](db['CmContact'],{'as':_0x4d63('0x161'),'foreignKey':'ContactId'});db[_0x4d63('0x60')][_0x4d63('0x120')](db[_0x4d63('0x11a')],{});db['OpenchannelQueueReport'][_0x4d63('0x120')](db[_0x4d63('0x5c')],{});db[_0x4d63('0x60')][_0x4d63('0x120')](db['User'],{});db[_0x4d63('0x60')][_0x4d63('0x120')](db[_0x4d63('0x134')],{});db[_0x4d63('0x62')][_0x4d63('0x120')](db['User'],{'as':'Agent','foreignKey':_0x4d63('0x113'),'onDelete':'restrict'});db[_0x4d63('0x62')][_0x4d63('0x120')](db[_0x4d63('0x69')],{'as':'Queue','foreignKey':_0x4d63('0x191'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x62')]['belongsTo'](db['ChatWebsite'],{'as':_0x4d63('0x192'),'foreignKey':'ChatWebsiteId','onDelete':_0x4d63('0x179')});db[_0x4d63('0x62')][_0x4d63('0x120')](db['Tag'],{'onDelete':_0x4d63('0x179'),'foreignKey':'TagId'});db[_0x4d63('0x63')][_0x4d63('0x115')](db['ChatMessage'],{'as':_0x4d63('0x15c'),'onDelete':'cascade','foreignKey':_0x4d63('0x193')});db[_0x4d63('0x63')][_0x4d63('0x120')](db[_0x4d63('0x5f')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x63')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x63')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0x187'),'foreignKey':'UserId'});db[_0x4d63('0x63')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x194'),'as':_0x4d63('0x173')});db[_0x4d63('0x63')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':'chat_interaction_has_tags','as':_0x4d63('0x174')});db[_0x4d63('0x63')]['belongsToMany'](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x12a'),'foreignKey':_0x4d63('0x193')});db[_0x4d63('0x65')]['belongsTo'](db[_0x4d63('0xf')],{'onDelete':'cascade','as':_0x4d63('0xf')});db[_0x4d63('0x65')]['belongsTo'](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x65')][_0x4d63('0x120')](db[_0x4d63('0x63')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x193')});db[_0x4d63('0x65')][_0x4d63('0x120')](db[_0x4d63('0x176')],{'as':_0x4d63('0x176'),'foreignKey':_0x4d63('0x183')});db[_0x4d63('0x65')]['belongsTo'](db[_0x4d63('0x5f')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x67')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x67')]['belongsTo'](db[_0x4d63('0x5f')],{'as':'Account','foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x69')][_0x4d63('0x126')](db['User'],{'as':_0x4d63('0x155'),'through':_0x4d63('0x132'),'hooks':!![]});db[_0x4d63('0x69')][_0x4d63('0x126')](db[_0x4d63('0x156')],{'through':'team_has_chat_queues','as':_0x4d63('0x157')});db[_0x4d63('0x6b')][_0x4d63('0x115')](db[_0x4d63('0xd6')],{'as':_0x4d63('0x15c'),'foreignKey':_0x4d63('0x195'),'onDelete':'cascade'});db[_0x4d63('0x6b')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x149'),'through':_0x4d63('0x123')});db[_0x4d63('0x6d')]['belongsTo'](db[_0x4d63('0x5f')],{'as':'Website','foreignKey':_0x4d63('0x18f')});db[_0x4d63('0x6f')]['hasMany'](db[_0x4d63('0x71')],{'as':_0x4d63('0x124'),'foreignKey':_0x4d63('0x196')});db[_0x4d63('0x71')][_0x4d63('0x115')](db[_0x4d63('0x73')],{'as':'Hoppers','foreignKey':_0x4d63('0x162')});db['CmContact'][_0x4d63('0x115')](db[_0x4d63('0x77')],{'as':_0x4d63('0x118'),'foreignKey':_0x4d63('0x162')});db['CmContact'][_0x4d63('0x115')](db[_0x4d63('0x79')],{'as':_0x4d63('0x14b'),'foreignKey':'ContactId'});db[_0x4d63('0x71')]['hasMany'](db[_0x4d63('0x7b')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x4d63('0x71')][_0x4d63('0x115')](db['JscriptySessionReport'],{'as':_0x4d63('0x197'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x71')]['hasMany'](db[_0x4d63('0x11a')],{'as':_0x4d63('0x12c'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x71')][_0x4d63('0x115')](db['ChatInteraction'],{'as':_0x4d63('0x129'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x71')][_0x4d63('0x115')](db[_0x4d63('0x53')],{'as':_0x4d63('0x12b'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x71')][_0x4d63('0x115')](db[_0x4d63('0x4a')],{'as':_0x4d63('0x11b'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x71')][_0x4d63('0x115')](db[_0x4d63('0x3c')],{'as':_0x4d63('0x11c'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x179')});db['CmContact'][_0x4d63('0x120')](db[_0x4d63('0x6f')],{'as':'Company','foreignKey':_0x4d63('0x196')});db[_0x4d63('0x71')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId','onDelete':_0x4d63('0x112')});db[_0x4d63('0x71')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x125')});db['CmContact'][_0x4d63('0x126')](db['Tag'],{'as':_0x4d63('0x173'),'through':_0x4d63('0x198')});db[_0x4d63('0x71')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x198'),'as':'ThroughTags'});db[_0x4d63('0x73')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':'Contact','foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0x73')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x4d63('0x73')][_0x4d63('0x120')](db['User'],{'as':_0x4d63('0x199'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0x73')]['belongsTo'](db[_0x4d63('0x12f')],{'as':_0x4d63('0x19a'),'foreignKey':_0x4d63('0x14a'),'onDelete':'cascade'});db['CmHopper'][_0x4d63('0x120')](db[_0x4d63('0x19b')],{'as':_0x4d63('0x19b'),'foreignKey':_0x4d63('0x19c'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0x73')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':'Owner','foreignKey':_0x4d63('0x19d')});db['CmHopperBlack']['belongsTo'](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0x75')][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a'),'onDelete':_0x4d63('0x112')});db['CmHopperBlack'][_0x4d63('0x120')](db['VoiceQueue'],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x4d63('0x112')});db[_0x4d63('0x75')][_0x4d63('0x120')](db[_0x4d63('0x19b')],{'as':'Campaign','foreignKey':_0x4d63('0x19c'),'onDelete':'cascade'});db[_0x4d63('0x80')][_0x4d63('0x115')](db[_0x4d63('0x86')],{'as':{'plural':'All','singular':_0x4d63('0x19e')},'foreignKey':_0x4d63('0x19f'),'onDelete':_0x4d63('0x112'),'hooks':!![]});db[_0x4d63('0x80')][_0x4d63('0x115')](db[_0x4d63('0x86')],{'as':{'plural':'Any','singular':_0x4d63('0x1a0')},'foreignKey':_0x4d63('0x1a1'),'onDelete':_0x4d63('0x112'),'hooks':!![]});db[_0x4d63('0x80')][_0x4d63('0x115')](db[_0x4d63('0x7e')],{'as':_0x4d63('0x1a2'),'foreignKey':_0x4d63('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0x4d63('0x88')]['hasMany'](db[_0x4d63('0x88')],{'as':_0x4d63('0x1a4'),'foreignKey':_0x4d63('0x151'),'onDelete':_0x4d63('0x112'),'hooks':!![],'required':![]});db[_0x4d63('0x88')]['hasMany'](db['VoiceExtension'],{'as':_0x4d63('0x117'),'foreignKey':_0x4d63('0x151'),'onDelete':'restrict'});db['Interval']['hasMany'](db[_0x4d63('0x40')],{'as':_0x4d63('0x1a5'),'foreignKey':'IntervalId'});db[_0x4d63('0x88')][_0x4d63('0x115')](db[_0x4d63('0x62')],{'as':_0x4d63('0x1a6'),'foreignKey':_0x4d63('0x151')});db[_0x4d63('0x88')][_0x4d63('0x115')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0x4d63('0x151')});db[_0x4d63('0x88')][_0x4d63('0x115')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x4d63('0x151')});db[_0x4d63('0x8e')][_0x4d63('0x120')](db[_0x4d63('0x163')],{});db['Schedule']['belongsTo'](db[_0x4d63('0x9f')],{'foreignKey':_0x4d63('0x1a7')});db[_0x4d63('0x8e')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x4d63('0x1a8')});db[_0x4d63('0x90')][_0x4d63('0x126')](db[_0x4d63('0x16')],{'as':_0x4d63('0x1a9'),'through':_0x4d63('0x148'),'onDelete':_0x4d63('0x179')});db[_0x4d63('0x92')][_0x4d63('0x126')](db[_0x4d63('0x71')],{'through':_0x4d63('0x198')});db[_0x4d63('0x92')][_0x4d63('0x126')](db['ChatInteraction'],{'through':_0x4d63('0x194')});db[_0x4d63('0x92')][_0x4d63('0x126')](db['MailInteraction'],{'through':_0x4d63('0x172')});db[_0x4d63('0x92')][_0x4d63('0x126')](db['SmsInteraction'],{'through':_0x4d63('0x188')});db['Tag']['belongsToMany'](db[_0x4d63('0x4a')],{'through':_0x4d63('0x181')});db[_0x4d63('0x92')][_0x4d63('0x126')](db['OpenchannelInteraction'],{'through':_0x4d63('0x18c')});db[_0x4d63('0x92')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x4d63('0x1aa')});db[_0x4d63('0x95')][_0x4d63('0x115')](db[_0x4d63('0x86')],{'as':{'plural':_0x4d63('0x1ab'),'singular':_0x4d63('0x1ac')},'foreignKey':_0x4d63('0x1ad'),'onDelete':_0x4d63('0x112'),'hooks':!![]});db[_0x4d63('0x95')][_0x4d63('0x115')](db[_0x4d63('0x86')],{'as':{'plural':_0x4d63('0x1ae'),'singular':_0x4d63('0x1af')},'foreignKey':'TriggerAnyId','onDelete':_0x4d63('0x112'),'hooks':!![]});db[_0x4d63('0x95')]['hasMany'](db[_0x4d63('0x7e')],{'as':_0x4d63('0x1a2'),'foreignKey':_0x4d63('0x1b0'),'onDelete':_0x4d63('0x112'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x4d63('0xa4')],{'as':_0x4d63('0x1b1'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1a8'),'hooks':!![]});db[_0x4d63('0x9f')][_0x4d63('0x115')](db[_0x4d63('0xa4')],{'as':_0x4d63('0x1b1'),'onDelete':'cascade','foreignKey':_0x4d63('0x1a7')});db[_0x4d63('0x1b2')][_0x4d63('0x115')](db[_0x4d63('0xa4')],{'as':_0x4d63('0x1b1'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b3')});db[_0x4d63('0xa4')]['belongsTo'](db[_0x4d63('0x1b2')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x4d63('0x115')](db[_0x4d63('0xa8')],{'as':_0x4d63('0x1b4'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xa8')][_0x4d63('0x115')](db[_0x4d63('0xaa')],{'as':_0x4d63('0x1b6'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xa8')][_0x4d63('0x115')](db['SalesforceField'],{'as':_0x4d63('0x1b8'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xa8')][_0x4d63('0x115')](db[_0x4d63('0xaa')],{'as':_0x4d63('0x1b1'),'onDelete':'cascade','foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xa8')][_0x4d63('0x120')](db[_0x4d63('0x1bb')],{'as':'Account','foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xaa')][_0x4d63('0x115')](db[_0x4d63('0xaa')],{'as':'Subject','foreignKey':_0x4d63('0x1b7')});db['SalesforceField'][_0x4d63('0x115')](db['SalesforceField'],{'as':_0x4d63('0x1bc'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xaa')]['hasMany'](db[_0x4d63('0xaa')],{'as':_0x4d63('0x1bd'),'foreignKey':'FieldId'});db[_0x4d63('0xaa')]['belongsTo'](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':'VariableId'});db[_0x4d63('0x1be')][_0x4d63('0x115')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xac')]['hasMany'](db[_0x4d63('0xae')],{'as':'Subjects','onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xac')][_0x4d63('0x115')](db[_0x4d63('0xae')],{'as':_0x4d63('0x1b8'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b9')});db['SugarcrmConfiguration'][_0x4d63('0x115')](db[_0x4d63('0xae')],{'as':_0x4d63('0x1b1'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xac')][_0x4d63('0x120')](db['SugarcrmAccount'],{'as':_0x4d63('0x171'),'foreignKey':'AccountId'});db[_0x4d63('0xae')][_0x4d63('0x115')](db[_0x4d63('0xae')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xae')][_0x4d63('0x115')](db[_0x4d63('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x4d63('0x1bd'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xae')][_0x4d63('0x120')](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':'VariableId'});db[_0x4d63('0x1c0')]['hasMany'](db['DeskConfiguration'],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b5')});db['DeskConfiguration'][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':_0x4d63('0x1b6'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xb0')][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':'Descriptions','onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xb0')][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x4d63('0x1ba')});db['DeskConfiguration'][_0x4d63('0x120')](db[_0x4d63('0x1c0')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x4d63('0x1c1')});db[_0x4d63('0xb2')][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xb2')]['hasMany'](db['DeskField'],{'as':_0x4d63('0x1bc'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xb2')][_0x4d63('0x115')](db[_0x4d63('0xb2')],{'as':_0x4d63('0x1bd'),'foreignKey':'FieldId'});db[_0x4d63('0xb2')][_0x4d63('0x120')](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xb4')][_0x4d63('0x115')](db[_0x4d63('0xb5')],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b5')});db['ZohoConfiguration']['hasMany'](db[_0x4d63('0xb7')],{'as':'Subjects','onDelete':_0x4d63('0x112'),'foreignKey':'SubjectId'});db[_0x4d63('0xb5')]['hasMany'](db[_0x4d63('0xb7')],{'as':_0x4d63('0x1b8'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xb5')][_0x4d63('0x115')](db['ZohoField'],{'as':_0x4d63('0x1b1'),'onDelete':_0x4d63('0x112'),'foreignKey':'FieldId'});db[_0x4d63('0xb5')][_0x4d63('0x120')](db[_0x4d63('0xb4')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db['ZohoField']['hasMany'](db[_0x4d63('0xb7')],{'as':'Subject','foreignKey':_0x4d63('0x1b7')});db['ZohoField'][_0x4d63('0x115')](db[_0x4d63('0xb7')],{'as':_0x4d63('0x1bc'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xb7')]['hasMany'](db[_0x4d63('0xb7')],{'as':_0x4d63('0x1bd'),'foreignKey':'FieldId'});db[_0x4d63('0xb7')][_0x4d63('0x120')](db['Variable'],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xb9')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x4d63('0x1b4'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b5')});db['ZendeskConfiguration'][_0x4d63('0x115')](db[_0x4d63('0xbd')],{'as':_0x4d63('0x1b6'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xbb')][_0x4d63('0x115')](db['ZendeskField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x4d63('0xbb')][_0x4d63('0x115')](db[_0x4d63('0xbd')],{'as':_0x4d63('0x1b1'),'foreignKey':'FieldId'});db[_0x4d63('0xbb')]['belongsTo'](db['ZendeskAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db['ZendeskConfiguration'][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x1c3')});db[_0x4d63('0xbd')][_0x4d63('0x115')](db[_0x4d63('0xbd')],{'as':'Subject','foreignKey':_0x4d63('0x1b7')});db['ZendeskField']['hasMany'](db[_0x4d63('0xbd')],{'as':_0x4d63('0x1bc'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x4d63('0x115')](db[_0x4d63('0xbd')],{'as':_0x4d63('0x1bd'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xbd')]['belongsTo'](db['Variable'],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xbe')][_0x4d63('0x115')](db[_0x4d63('0xc0')],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':'AccountId'});db[_0x4d63('0xc0')]['hasMany'](db['FreshdeskField'],{'as':_0x4d63('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x4d63('0xc0')][_0x4d63('0x115')](db[_0x4d63('0xc2')],{'as':'Descriptions','onDelete':_0x4d63('0x112'),'foreignKey':'DescriptionId'});db[_0x4d63('0xc0')][_0x4d63('0x115')](db[_0x4d63('0xc2')],{'as':_0x4d63('0x1b1'),'onDelete':'cascade','foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xc0')][_0x4d63('0x120')](db[_0x4d63('0xbe')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xc0')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x4d63('0xc2')]['hasMany'](db[_0x4d63('0xc2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4d63('0xc2')][_0x4d63('0x115')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xc2')][_0x4d63('0x115')](db['FreshdeskField'],{'as':_0x4d63('0x1bd'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xc2')][_0x4d63('0x120')](db[_0x4d63('0x97')],{'as':'Variable','foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xc4')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0x1c4')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':'Subjects','foreignKey':_0x4d63('0x1b7')});db['VtigerConfiguration']['hasMany'](db[_0x4d63('0xc6')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x4d63('0x1c4')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':_0x4d63('0x1b1'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0x1c4')][_0x4d63('0x120')](db['VtigerAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xc6')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0xc6')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':_0x4d63('0x1bc'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xc6')][_0x4d63('0x115')](db[_0x4d63('0xc6')],{'as':_0x4d63('0x1bd'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':'VariableId'});db[_0x4d63('0x1c5')][_0x4d63('0x115')](db[_0x4d63('0xc8')],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b5')});db['ServicenowConfiguration'][_0x4d63('0x115')](db[_0x4d63('0xca')],{'as':'Subjects','foreignKey':_0x4d63('0x1b7')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x4d63('0x1b8'),'foreignKey':'DescriptionId'});db[_0x4d63('0xc8')][_0x4d63('0x115')](db[_0x4d63('0xca')],{'as':_0x4d63('0x1b1'),'foreignKey':_0x4d63('0x1ba')});db['ServicenowConfiguration'][_0x4d63('0x120')](db[_0x4d63('0x1c5')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0xca')][_0x4d63('0x115')](db['ServicenowField'],{'as':_0x4d63('0x1bf'),'foreignKey':'SubjectId'});db[_0x4d63('0xca')][_0x4d63('0x115')](db[_0x4d63('0xca')],{'as':'Description','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xca')]['hasMany'](db['ServicenowField'],{'as':_0x4d63('0x1bd'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xca')]['belongsTo'](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0x1c6')][_0x4d63('0x115')](db[_0x4d63('0xcd')],{'as':_0x4d63('0x1b4'),'onDelete':'cascade','foreignKey':_0x4d63('0x1b5')});db['Dynamics365Configuration'][_0x4d63('0x115')](db['Dynamics365Field'],{'as':_0x4d63('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x4d63('0xcd')]['hasMany'](db[_0x4d63('0x1c7')],{'as':_0x4d63('0x1b8'),'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0xcd')][_0x4d63('0x115')](db['Dynamics365Field'],{'as':_0x4d63('0x1b1'),'onDelete':'cascade','foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0xcd')][_0x4d63('0x120')](db[_0x4d63('0x1c6')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db[_0x4d63('0x1c7')][_0x4d63('0x115')](db[_0x4d63('0x1c7')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0x1c7')]['hasMany'](db[_0x4d63('0x1c7')],{'as':_0x4d63('0x1bc'),'foreignKey':'DescriptionId'});db[_0x4d63('0x1c7')][_0x4d63('0x115')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x4d63('0x1ba')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0x4d63('0x97'),'foreignKey':'VariableId'});db[_0x4d63('0xd0')][_0x4d63('0x115')](db[_0x4d63('0x1c8')],{'as':_0x4d63('0x1b4'),'onDelete':_0x4d63('0x112'),'foreignKey':'AccountId'});db[_0x4d63('0x1c8')][_0x4d63('0x115')](db[_0x4d63('0x1c9')],{'as':'Subjects','foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0x1c8')]['hasMany'](db['FreshsalesField'],{'as':_0x4d63('0x1b8'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0x4d63('0x1c9')],{'as':_0x4d63('0x1b1'),'foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0x1c8')][_0x4d63('0x120')](db[_0x4d63('0xd0')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1b5')});db['FreshsalesField'][_0x4d63('0x115')](db[_0x4d63('0x1c9')],{'as':_0x4d63('0x1bf'),'foreignKey':_0x4d63('0x1b7')});db[_0x4d63('0x1c9')][_0x4d63('0x115')](db[_0x4d63('0x1c9')],{'as':'Description','foreignKey':_0x4d63('0x1b9')});db[_0x4d63('0x1c9')][_0x4d63('0x115')](db[_0x4d63('0x1c9')],{'as':'Field','foreignKey':_0x4d63('0x1ba')});db[_0x4d63('0x1c9')][_0x4d63('0x120')](db[_0x4d63('0x97')],{'as':_0x4d63('0x97'),'foreignKey':_0x4d63('0x1c2')});db[_0x4d63('0xd4')][_0x4d63('0x120')](db[_0x4d63('0x5f')],{});db[_0x4d63('0xd4')]['belongsTo'](db[_0x4d63('0xf8')],{'as':'List','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xd4')]['belongsTo'](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0xd4')][_0x4d63('0x120')](db[_0x4d63('0x63')],{});db[_0x4d63('0xd4')]['belongsTo'](db[_0x4d63('0x65')],{});db['ChatQueueReport']['belongsTo'](db['User'],{});db[_0x4d63('0xd4')][_0x4d63('0x120')](db[_0x4d63('0x69')],{});db['ChatInternalMessage'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x112'),'foreignKey':_0x4d63('0x1ca')});db[_0x4d63('0xd6')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x112'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0x4d63('0x115')](db[_0x4d63('0xda')],{'foreignKey':_0x4d63('0x1cb'),'onDelete':_0x4d63('0x112')});db['JscriptySessionReport'][_0x4d63('0x115')](db[_0x4d63('0xd8')],{'foreignKey':_0x4d63('0x1cb'),'onDelete':_0x4d63('0x112')});db['SmsQueueReport']['belongsTo'](db[_0x4d63('0x140')],{});db['SmsQueueReport'][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db['SmsQueueReport']['belongsTo'](db[_0x4d63('0x71')],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0xdc')][_0x4d63('0x120')](db[_0x4d63('0x53')],{});db[_0x4d63('0xdc')][_0x4d63('0x120')](db[_0x4d63('0x55')],{});db[_0x4d63('0xdc')]['belongsTo'](db[_0x4d63('0xf')],{});db[_0x4d63('0xdc')][_0x4d63('0x120')](db[_0x4d63('0x57')],{});db['JscriptyProject'][_0x4d63('0x115')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0x4d63('0xe0')][_0x4d63('0x115')](db[_0x4d63('0xda')],{'foreignKey':_0x4d63('0x1cc')});db[_0x4d63('0xe0')][_0x4d63('0x115')](db[_0x4d63('0xd8')],{'foreignKey':_0x4d63('0x1cc')});db[_0x4d63('0xe4')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x175'),'through':_0x4d63('0x145')});db[_0x4d63('0x156')]['belongsToMany'](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x127')});db['Team'][_0x4d63('0x126')](db[_0x4d63('0x12f')],{'through':_0x4d63('0x158'),'as':_0x4d63('0x130')});db[_0x4d63('0x156')]['belongsToMany'](db[_0x4d63('0x39')],{'through':_0x4d63('0x16f'),'as':'MailQueues'});db[_0x4d63('0x156')][_0x4d63('0x126')](db['ChatQueue'],{'through':_0x4d63('0x1cd'),'as':'ChatQueues'});db[_0x4d63('0x156')]['belongsToMany'](db[_0x4d63('0x133')],{'through':'team_has_fax_queues','as':_0x4d63('0x1ce')});db[_0x4d63('0x156')][_0x4d63('0x126')](db[_0x4d63('0x57')],{'through':'team_has_sms_queues','as':_0x4d63('0x1cf')});db[_0x4d63('0x156')]['belongsToMany'](db[_0x4d63('0x134')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x4d63('0x156')][_0x4d63('0x126')](db[_0x4d63('0x10d')],{'through':_0x4d63('0x1d0'),'as':_0x4d63('0x135')});db['Campaign'][_0x4d63('0x115')](db[_0x4d63('0x73')],{'as':_0x4d63('0x1d1'),'foreignKey':_0x4d63('0x19c')});db[_0x4d63('0x19b')][_0x4d63('0x115')](db[_0x4d63('0x77')],{'as':_0x4d63('0x118'),'foreignKey':_0x4d63('0x19c')});db['Campaign'][_0x4d63('0x115')](db[_0x4d63('0x79')],{'as':_0x4d63('0x14b'),'foreignKey':_0x4d63('0x19c')});db['Campaign'][_0x4d63('0x115')](db[_0x4d63('0x75')],{'as':_0x4d63('0x14c'),'foreignKey':_0x4d63('0x19c')});db[_0x4d63('0x19b')][_0x4d63('0x120')](db[_0x4d63('0x14d')],{'as':'Trunk','foreignKey':_0x4d63('0x14e')});db[_0x4d63('0x19b')][_0x4d63('0x120')](db[_0x4d63('0x14d')],{'as':_0x4d63('0x14f'),'foreignKey':_0x4d63('0x150')});db[_0x4d63('0x19b')][_0x4d63('0x120')](db[_0x4d63('0x88')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x4d63('0x19b')]['belongsTo'](db[_0x4d63('0xe4')],{'as':_0x4d63('0xe4'),'foreignKey':_0x4d63('0x1d2')});db['Campaign'][_0x4d63('0x126')](db['CmList'],{'as':_0x4d63('0x153'),'through':_0x4d63('0x1d3')});db[_0x4d63('0x19b')][_0x4d63('0x126')](db['CmList'],{'as':_0x4d63('0x159'),'through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0x4d63('0x120')](db[_0x4d63('0x3e')],{});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db[_0x4d63('0x3c')],{});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db[_0x4d63('0x163')],{'foreignKey':_0x4d63('0x1d5'),'as':_0x4d63('0x1d6')});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d7'),'as':_0x4d63('0x1d8')});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db['User'],{'foreignKey':_0x4d63('0x1d9'),'as':'ToAgent'});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db['MailQueue'],{'foreignKey':_0x4d63('0x1da'),'as':'ToQueue'});db[_0x4d63('0x1d4')][_0x4d63('0x120')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x4d63('0xf3')]['belongsTo'](db[_0x4d63('0x65')],{});db[_0x4d63('0xf3')][_0x4d63('0x120')](db[_0x4d63('0x63')],{});db[_0x4d63('0xf3')][_0x4d63('0x120')](db[_0x4d63('0x5f')],{'foreignKey':_0x4d63('0x1db'),'as':_0x4d63('0x1d6')});db[_0x4d63('0xf3')]['belongsTo'](db[_0x4d63('0xf')],{'foreignKey':'FromUserId','as':_0x4d63('0x1d8')});db[_0x4d63('0xf3')][_0x4d63('0x120')](db['User'],{'foreignKey':_0x4d63('0x1d9'),'as':_0x4d63('0x1dc')});db[_0x4d63('0xf3')][_0x4d63('0x120')](db['ChatQueue'],{'foreignKey':_0x4d63('0x1dd'),'as':_0x4d63('0x1de')});db['ChatTransferReport']['belongsTo'](db[_0x4d63('0x5f')],{'foreignKey':'ToChatWebsiteId','as':_0x4d63('0x1df')});db[_0x4d63('0x1e0')]['belongsTo'](db[_0x4d63('0x4c')],{});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0x4a')],{});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0x46')],{'foreignKey':'FromFaxAccountId','as':_0x4d63('0x1d6')});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':'FromUserId','as':'FromAgent'});db['FaxTransferReport']['belongsTo'](db[_0x4d63('0xf')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0x133')],{'foreignKey':_0x4d63('0x1e1'),'as':_0x4d63('0x1de')});db[_0x4d63('0x1e0')][_0x4d63('0x120')](db[_0x4d63('0x46')],{'foreignKey':_0x4d63('0x1e2'),'as':_0x4d63('0x1df')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0x5c')],{});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0x11a')],{});db['OpenchannelTransferReport'][_0x4d63('0x120')](db[_0x4d63('0x59')],{'foreignKey':_0x4d63('0x1e4'),'as':_0x4d63('0x1d6')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d7'),'as':_0x4d63('0x1d8')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d9'),'as':_0x4d63('0x1dc')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db[_0x4d63('0x134')],{'foreignKey':_0x4d63('0x1e5'),'as':_0x4d63('0x1de')});db[_0x4d63('0x1e3')][_0x4d63('0x120')](db['OpenchannelAccount'],{'foreignKey':_0x4d63('0x1e6'),'as':_0x4d63('0x1df')});db['SmsTransferReport'][_0x4d63('0x120')](db['SmsMessage'],{});db[_0x4d63('0xf6')][_0x4d63('0x120')](db[_0x4d63('0x53')],{});db[_0x4d63('0xf6')]['belongsTo'](db[_0x4d63('0x140')],{'foreignKey':_0x4d63('0x1e7'),'as':_0x4d63('0x1d6')});db['SmsTransferReport'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':'FromUserId','as':_0x4d63('0x1d8')});db['SmsTransferReport'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d9'),'as':_0x4d63('0x1dc')});db[_0x4d63('0xf6')]['belongsTo'](db[_0x4d63('0x57')],{'foreignKey':_0x4d63('0x1e8'),'as':_0x4d63('0x1de')});db[_0x4d63('0xf6')][_0x4d63('0x120')](db[_0x4d63('0x140')],{'foreignKey':_0x4d63('0x1e9'),'as':_0x4d63('0x1df')});db['CmList'][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x115')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x115')](db[_0x4d63('0x71')],{'as':_0x4d63('0x124'),'onDelete':_0x4d63('0x112'),'foreignKey':'ListId'});db[_0x4d63('0xf8')][_0x4d63('0x115')](db[_0x4d63('0x77')],{'as':'HopperFinals','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x115')](db[_0x4d63('0x79')],{'as':'HopperHistory','foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x115')](db[_0x4d63('0x7b')],{'as':_0x4d63('0x7b'),'foreignKey':_0x4d63('0x16a')});db[_0x4d63('0xf8')][_0x4d63('0x126')](db['VoiceQueue'],{'as':_0x4d63('0x1ea'),'through':_0x4d63('0x154')});db[_0x4d63('0xf8')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x136')});db[_0x4d63('0xfa')][_0x4d63('0x115')](db[_0x4d63('0x14')],{'as':_0x4d63('0x117'),'onDelete':_0x4d63('0x112')});db[_0x4d63('0xfa')]['belongsToMany'](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x138')});db[_0x4d63('0xfb')][_0x4d63('0x115')](db['User'],{'as':_0x4d63('0x175'),'foreignKey':'userProfileId'});db[_0x4d63('0xfb')]['hasMany'](db['UserProfileSection'],{'as':_0x4d63('0x1eb'),'foreignKey':_0x4d63('0x121'),'onDelete':'cascade'});db[_0x4d63('0x1ec')][_0x4d63('0x115')](db[_0x4d63('0xfe')],{'as':_0x4d63('0x1ed'),'foreignKey':'sectionId','onDelete':_0x4d63('0x112')});db['WhatsappAccount'][_0x4d63('0x115')](db[_0x4d63('0x84')],{'as':_0x4d63('0x166'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x102')][_0x4d63('0x115')](db[_0x4d63('0x82')],{'as':_0x4d63('0x167'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x102')][_0x4d63('0x115')](db[_0x4d63('0x108')],{'as':_0x4d63('0x15c'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x102')][_0x4d63('0x115')](db[_0x4d63('0x106')],{'as':_0x4d63('0x168')});db[_0x4d63('0x102')][_0x4d63('0x115')](db[_0x4d63('0x104')],{'as':_0x4d63('0x169')});db['WhatsappAccount'][_0x4d63('0x120')](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':'ListId'});db[_0x4d63('0x102')]['belongsTo'](db[_0x4d63('0x8a')],{'as':_0x4d63('0x16d'),'foreignKey':_0x4d63('0x152')});db[_0x4d63('0x102')][_0x4d63('0x126')](db[_0x4d63('0xf')],{'as':_0x4d63('0x155'),'through':_0x4d63('0x143')});db['WhatsappApplication'][_0x4d63('0x120')](db[_0x4d63('0xf')],{'onDelete':_0x4d63('0x179')});db[_0x4d63('0x104')]['belongsTo'](db[_0x4d63('0x10d')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x4d63('0x120')](db[_0x4d63('0x102')],{'onDelete':_0x4d63('0x179')});db['WhatsappApplication'][_0x4d63('0x120')](db[_0x4d63('0x88')],{'onDelete':_0x4d63('0x179'),'foreignKey':'IntervalId'});db[_0x4d63('0x104')][_0x4d63('0x120')](db[_0x4d63('0x92')],{'onDelete':_0x4d63('0x179'),'foreignKey':_0x4d63('0x17a')});db[_0x4d63('0x106')]['hasMany'](db['WhatsappMessage'],{'as':_0x4d63('0x15c'),'onDelete':'cascade','foreignKey':_0x4d63('0x1ef')});db[_0x4d63('0x106')]['belongsTo'](db[_0x4d63('0x102')],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x106')][_0x4d63('0x120')](db['CmContact'],{'as':_0x4d63('0x161'),'foreignKey':_0x4d63('0x162')});db[_0x4d63('0x106')][_0x4d63('0x120')](db[_0x4d63('0xf')],{'as':_0x4d63('0x187'),'foreignKey':_0x4d63('0x113')});db[_0x4d63('0x106')][_0x4d63('0x126')](db['Tag'],{'through':_0x4d63('0x1aa'),'as':_0x4d63('0x173')});db[_0x4d63('0x106')][_0x4d63('0x126')](db[_0x4d63('0x92')],{'through':_0x4d63('0x1aa'),'as':_0x4d63('0x174')});db[_0x4d63('0x106')][_0x4d63('0x126')](db['User'],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x4d63('0x1ef')});db[_0x4d63('0x108')][_0x4d63('0x120')](db['User'],{'as':'User'});db['WhatsappMessage'][_0x4d63('0x120')](db[_0x4d63('0x71')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x161')});db[_0x4d63('0x108')][_0x4d63('0x120')](db[_0x4d63('0x106')],{'onDelete':_0x4d63('0x112'),'as':_0x4d63('0x178'),'foreignKey':_0x4d63('0x1ef')});db['WhatsappMessage'][_0x4d63('0x120')](db['WhatsappAccount'],{'as':_0x4d63('0x171'),'foreignKey':_0x4d63('0x1ee')});db[_0x4d63('0x1f0')][_0x4d63('0x120')](db['WhatsappAccount'],{});db[_0x4d63('0x1f0')]['belongsTo'](db[_0x4d63('0xf8')],{'as':_0x4d63('0x17b'),'foreignKey':_0x4d63('0x16a')});db[_0x4d63('0x1f0')][_0x4d63('0x120')](db[_0x4d63('0x71')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4d63('0x1f0')][_0x4d63('0x120')](db[_0x4d63('0x106')],{});db['WhatsappQueueReport']['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x4d63('0x108')],{});db[_0x4d63('0x1f0')][_0x4d63('0x120')](db[_0x4d63('0xf')],{});db[_0x4d63('0x10b')][_0x4d63('0x120')](db[_0x4d63('0x108')],{});db[_0x4d63('0x10b')]['belongsTo'](db[_0x4d63('0x106')],{});db[_0x4d63('0x10b')][_0x4d63('0x120')](db[_0x4d63('0x102')],{'foreignKey':_0x4d63('0x1f1'),'as':_0x4d63('0x1d6')});db[_0x4d63('0x10b')][_0x4d63('0x120')](db[_0x4d63('0x102')],{'foreignKey':_0x4d63('0x1f2'),'as':_0x4d63('0x1df')});db[_0x4d63('0x10b')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x4d63('0x1f3'),'as':_0x4d63('0x1de')});db[_0x4d63('0x10b')][_0x4d63('0x120')](db['User'],{'foreignKey':_0x4d63('0x1d7'),'as':_0x4d63('0x1d8')});db[_0x4d63('0x10b')]['belongsTo'](db[_0x4d63('0xf')],{'foreignKey':_0x4d63('0x1d9'),'as':_0x4d63('0x1dc')});db[_0x4d63('0x10d')]['belongsToMany'](db[_0x4d63('0xf')],{'as':'Agents','through':_0x4d63('0x34'),'foreignKey':'WhatsappQueueId'});db[_0x4d63('0x10d')][_0x4d63('0x126')](db[_0x4d63('0x156')],{'through':_0x4d63('0x1d0'),'as':_0x4d63('0x157')});module[_0x4d63('0x1f4')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbf07=['SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','team_has_sms_queues','Teams','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsite','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','Contacts','SmsInteractions','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','OneAll','AutomationAllId','Any','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','Configurations','Subjects','SubjectId','FieldId','AccountId','Description','DescriptionId','Field','VariableId','Descriptions','Subject','DeskAccount','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','Dynamics365Field','FromId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','team_has_voice_queues','team_has_chat_queues','OpenchannelQueues','team_has_whatsapp_queues','HopperBlacks','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','FromOpenchannelAccountId','ToUserId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','path','../config/environment','sequelize','lodash','determine','xcall','utf8mb4','utf8','sequelizeHistory','defaultsDeep','motion2','xC@LL1234','mysql','name','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','Recordings','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notification','Notifications','belongsTo','UserProfile','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','SquareProjects','user_has_square_projects','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Agents','voice_queues_has_cm_blacklists','Messages','mailboxuser','VoiceQueueReport','QueueCalls','Contact','ContactId','MailAccountId','MailServerOut','Smtp','Dispositions','Answers','Interactions','ListId','Template','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','restrict','TagId','List','Items','FaxAccountId','CannedAnswer','Exntensions','mandatoryDispositionPauseId','FaxApplication','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport'];(function(_0x5aea22,_0x84db0c){var _0x25bcda=function(_0x45afd3){while(--_0x45afd3){_0x5aea22['push'](_0x5aea22['shift']());}};_0x25bcda(++_0x84db0c);}(_0xbf07,0x77));var _0x7bf0=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0xbf07[_0x36c6eb];return _0x30675b;};'use strict';var path=require(_0x7bf0('0x0'));var config=require(_0x7bf0('0x1'));var Sequelize=require(_0x7bf0('0x2'));var _=require(_0x7bf0('0x3'));var jstz=require('jstz');var timezone=jstz[_0x7bf0('0x4')]();config[_0x7bf0('0x2')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0x7bf0('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7bf0('0x6')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7bf0('0x7'),'collate':'utf8_general_ci'}}});config[_0x7bf0('0x8')]=_[_0x7bf0('0x9')](config[_0x7bf0('0x8')],{'database':_0x7bf0('0xa'),'username':_0x7bf0('0x5'),'password':_0x7bf0('0xb'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x7bf0('0xc'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x7bf0('0xd')](),'define':{'charset':_0x7bf0('0x7'),'collate':_0x7bf0('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7bf0('0x2')][_0x7bf0('0xf')],config[_0x7bf0('0x2')][_0x7bf0('0x10')],config[_0x7bf0('0x2')][_0x7bf0('0x11')],config[_0x7bf0('0x2')][_0x7bf0('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7bf0('0x8')][_0x7bf0('0xf')],config[_0x7bf0('0x8')][_0x7bf0('0x10')],config[_0x7bf0('0x8')][_0x7bf0('0x11')],config[_0x7bf0('0x8')][_0x7bf0('0x12')])};db[_0x7bf0('0x13')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x15'));db[_0x7bf0('0x16')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x7bf0('0x17')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x18'));db[_0x7bf0('0x19')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x1a'));db[_0x7bf0('0x1b')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x1c'));db[_0x7bf0('0x1d')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x1e'));db[_0x7bf0('0x1f')]=db['sequelize']['import'](_0x7bf0('0x20'));db[_0x7bf0('0x21')]=db['sequelize'][_0x7bf0('0x14')]('../api/screenRecording/screenRecording.model');db[_0x7bf0('0x22')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x23'));db[_0x7bf0('0x24')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x25'));db[_0x7bf0('0x26')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x7bf0('0x27')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x28'));db[_0x7bf0('0x29')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x2a'));db['VoiceQueueReport']=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x2b'));db[_0x7bf0('0x2c')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x2d'));db[_0x7bf0('0x2e')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x2f'));db[_0x7bf0('0x30')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x7bf0('0x31')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x32'));db[_0x7bf0('0x33')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x34'));db['UserChatQueue']=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x7bf0('0x35')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x36'));db[_0x7bf0('0x37')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x38'));db[_0x7bf0('0x39')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x3a'));db[_0x7bf0('0x3b')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x7bf0('0x3c')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x3d'));db[_0x7bf0('0x3e')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x3f'));db['MailServerOut']=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x40'));db[_0x7bf0('0x41')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x42'));db[_0x7bf0('0x43')]=db[_0x7bf0('0x2')]['import']('../api/mailQueue/mailQueue.model');db[_0x7bf0('0x44')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x7bf0('0x45')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x46'));db[_0x7bf0('0x47')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/mailMessage/mailMessage.model');db[_0x7bf0('0x48')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x49'));db[_0x7bf0('0x4a')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x4b'));db[_0x7bf0('0x4c')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x4d'));db[_0x7bf0('0x4e')]=db[_0x7bf0('0x2')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x7bf0('0x4f')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x50'));db['FaxApplication']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x51'));db['FaxInteraction']=db['sequelize']['import'](_0x7bf0('0x52'));db[_0x7bf0('0x53')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x54'));db[_0x7bf0('0x55')]=db['sequelize']['import']('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x7bf0('0x2')]['import']('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x56'));db[_0x7bf0('0x57')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x58'));db[_0x7bf0('0x59')]=db['sequelize']['import'](_0x7bf0('0x5a'));db[_0x7bf0('0x5b')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x5c'));db[_0x7bf0('0x5d')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x5e'));db[_0x7bf0('0x5f')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x60'));db[_0x7bf0('0x61')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x7bf0('0x62')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x63'));db[_0x7bf0('0x64')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x65'));db[_0x7bf0('0x66')]=db[_0x7bf0('0x2')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x67'));db[_0x7bf0('0x68')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x69'));db[_0x7bf0('0x6a')]=db['sequelize']['import'](_0x7bf0('0x6b'));db[_0x7bf0('0x6c')]=db['sequelize'][_0x7bf0('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x7bf0('0x6d')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x6e'));db['ChatOfflineMessage']=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x6f'));db[_0x7bf0('0x70')]=db['sequelize'][_0x7bf0('0x14')]('../api/chatQueue/chatQueue.model');db[_0x7bf0('0x71')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/chatGroup/chatGroup.model');db[_0x7bf0('0x72')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x73'));db[_0x7bf0('0x74')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x75'));db[_0x7bf0('0x76')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/cmContact/cmContact.model');db[_0x7bf0('0x77')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x78'));db[_0x7bf0('0x79')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x7bf0('0x7a')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x7b'));db[_0x7bf0('0x7c')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x7d'));db['ReportAgentPreview']=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x7e'));db['CmCustomField']=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x7f'));db[_0x7bf0('0x80')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x81'));db[_0x7bf0('0x82')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x83'));db['CannedAnswer']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x84'));db[_0x7bf0('0x85')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x86'));db[_0x7bf0('0x87')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/condition/condition.model');db[_0x7bf0('0x88')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x89'));db[_0x7bf0('0x8a')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/pause/pause.model');db['Cdr']=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x8b'));db[_0x7bf0('0x8c')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x8d'));db[_0x7bf0('0x8e')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x8f'));db[_0x7bf0('0x90')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x91'));db[_0x7bf0('0x92')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x93'));db['Template']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x94'));db[_0x7bf0('0x95')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/trigger/trigger.model');db[_0x7bf0('0x96')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x97'));db['Integration']=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x98'));db[_0x7bf0('0x99')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0x9a'));db['AnalyticCustomReport']=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x9b'));db[_0x7bf0('0x9c')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x7bf0('0x9d')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x9e'));db[_0x7bf0('0x9f')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xa0'));db[_0x7bf0('0xa1')]=db[_0x7bf0('0x2')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xa2'));db[_0x7bf0('0xa3')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xa4'));db[_0x7bf0('0xa5')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xa6'));db[_0x7bf0('0xa7')]=db['sequelize'][_0x7bf0('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x7bf0('0xa8')]=db['sequelize']['import'](_0x7bf0('0xa9'));db[_0x7bf0('0xaa')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xab'));db[_0x7bf0('0xac')]=db['sequelize'][_0x7bf0('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0xad'));db[_0x7bf0('0xae')]=db[_0x7bf0('0x2')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db['sequelize'][_0x7bf0('0x14')]('../api/intDeskField/intDeskField.model');db[_0x7bf0('0xaf')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xb0'));db['ZohoConfiguration']=db[_0x7bf0('0x2')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x7bf0('0xb1')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/intZohoField/intZohoField.model');db[_0x7bf0('0xb2')]=db['sequelize']['import'](_0x7bf0('0xb3'));db[_0x7bf0('0xb4')]=db[_0x7bf0('0x2')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize'][_0x7bf0('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0x7bf0('0xb5')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xb6'));db['FreshdeskConfiguration']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xb7'));db[_0x7bf0('0xb8')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x7bf0('0xb9')]=db['sequelize']['import'](_0x7bf0('0xba'));db[_0x7bf0('0xbb')]=db['sequelize'][_0x7bf0('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x7bf0('0xbc')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xbd'));db[_0x7bf0('0xbe')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xbf'));db[_0x7bf0('0xc0')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x7bf0('0xc1')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x7bf0('0xc2')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xc3'));db[_0x7bf0('0xc4')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xc5'));db['Dynamics365Field']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xc6'));db[_0x7bf0('0xc7')]=db[_0x7bf0('0x2')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x7bf0('0xc8')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xc9'));db[_0x7bf0('0xca')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x7bf0('0xcb')]=db['sequelize']['import'](_0x7bf0('0x98'));db[_0x7bf0('0xcc')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0xcd'));db[_0x7bf0('0xce')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xcf'));db[_0x7bf0('0xd0')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xd1'));db['JscriptyAnswerReport']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xd2'));db['JscriptyQuestionReport']=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0xd3'));db[_0x7bf0('0xd4')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xd5'));db[_0x7bf0('0xd6')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0xd7'));db[_0x7bf0('0xd8')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0xd9'));db[_0x7bf0('0xda')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xdb'));db[_0x7bf0('0xdc')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xdd'));db[_0x7bf0('0xde')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xdf'));db[_0x7bf0('0xe0')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xe1'));db[_0x7bf0('0xe2')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xe3'));db[_0x7bf0('0xe4')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0xe5'));db['SquareMessage']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xe6'));db[_0x7bf0('0xe7')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xe8'));db[_0x7bf0('0xe9')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xea'));db[_0x7bf0('0xeb')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xec'));db[_0x7bf0('0xed')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/migration/migration.model');db[_0x7bf0('0xee')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0xef'));db[_0x7bf0('0xf0')]=db['sequelize']['import'](_0x7bf0('0xf1'));db['MailTransferReport']=db[_0x7bf0('0x2')]['import'](_0x7bf0('0xf2'));db['ChatTransferReport']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xf3'));db[_0x7bf0('0xf4')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xf5'));db[_0x7bf0('0xf6')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0xf7'));db[_0x7bf0('0xf8')]=db['sequelize'][_0x7bf0('0x14')](_0x7bf0('0xf9'));db[_0x7bf0('0xfa')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x7bf0('0xfb')]=db['sequelize']['import'](_0x7bf0('0xfc'));db['UserProfile']=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/userProfile/userProfile.model');db[_0x7bf0('0xfd')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xfe'));db['UserProfileResource']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0xff'));db['Notification']=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/notification/notification.model');db['WhatsappAccount']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x100'));db['WhatsappApplication']=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x101'));db[_0x7bf0('0x102')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x103'));db[_0x7bf0('0x104')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x105'));db[_0x7bf0('0x106')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x107'));db[_0x7bf0('0x108')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x7bf0('0x109')]=db[_0x7bf0('0x2')][_0x7bf0('0x14')](_0x7bf0('0x10a'));db[_0x7bf0('0x10b')]=db[_0x7bf0('0x2')]['import'](_0x7bf0('0x10c'));db[_0x7bf0('0x13')][_0x7bf0('0x10d')](db['VoiceMail'],{'as':_0x7bf0('0x22'),'onDelete':_0x7bf0('0x10e'),'foreignKey':'UserId'});db[_0x7bf0('0x13')]['hasMany'](db[_0x7bf0('0x1f')],{'as':_0x7bf0('0x10f'),'foreignKey':_0x7bf0('0x110')});db['User'][_0x7bf0('0x111')](db[_0x7bf0('0x31')],{'as':_0x7bf0('0x112'),'foreignKey':'UserId'});db[_0x7bf0('0x13')][_0x7bf0('0x111')](db[_0x7bf0('0x19')],{'as':_0x7bf0('0x113'),'onDelete':_0x7bf0('0x10e'),'hooks':!![]});db['User']['hasMany'](db[_0x7bf0('0x7a')],{'as':_0x7bf0('0x114'),'foreignKey':'UserId'});db['User'][_0x7bf0('0x111')](db['CmHopperHistory'],{'as':_0x7bf0('0x115'),'foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x13')][_0x7bf0('0x111')](db[_0x7bf0('0x116')],{'as':_0x7bf0('0x116'),'foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x13')][_0x7bf0('0x111')](db[_0x7bf0('0x62')],{'as':_0x7bf0('0x117'),'foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x13')][_0x7bf0('0x111')](db[_0x7bf0('0x6c')],{'as':_0x7bf0('0x118'),'foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x13')][_0x7bf0('0x111')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x13')][_0x7bf0('0x111')](db['FaxInteraction'],{'as':_0x7bf0('0x119'),'foreignKey':'UserId'});db[_0x7bf0('0x13')][_0x7bf0('0x111')](db['MailInteraction'],{'as':_0x7bf0('0x11a'),'foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x13')]['hasMany'](db[_0x7bf0('0x102')],{'as':_0x7bf0('0x11b'),'foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x13')][_0x7bf0('0x111')](db[_0x7bf0('0x11c')],{'as':_0x7bf0('0x11d'),'foreignKey':'SenderId'});db[_0x7bf0('0x13')][_0x7bf0('0x11e')](db[_0x7bf0('0x11f')],{'as':_0x7bf0('0x11f'),'foreignKey':'userProfileId'});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x71')],{'as':_0x7bf0('0x121'),'through':_0x7bf0('0x122')});db['User'][_0x7bf0('0x120')](db[_0x7bf0('0x76')],{'as':'Contacts','through':_0x7bf0('0x123')});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x124'),'through':_0x7bf0('0x125')});db['User']['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x45')],{'as':_0x7bf0('0x11a'),'through':'user_has_mail_interactions'});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db['ChatInteraction'],{'as':_0x7bf0('0x118'),'through':_0x7bf0('0x126')});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x127')],{'as':'FaxInteractions','through':_0x7bf0('0x128')});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x59')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x62')],{'as':_0x7bf0('0x117'),'through':_0x7bf0('0x129')});db['User'][_0x7bf0('0x120')](db[_0x7bf0('0x102')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db['VoiceQueue'],{'as':_0x7bf0('0x12a'),'through':_0x7bf0('0x33'),'required':![]});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x43')],{'as':_0x7bf0('0x12b'),'through':_0x7bf0('0x35'),'required':![]});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x70')],{'as':_0x7bf0('0x12c'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x55')],{'as':_0x7bf0('0x12d'),'through':_0x7bf0('0x37'),'required':![]});db['User'][_0x7bf0('0x120')](db[_0x7bf0('0x5d')],{'as':_0x7bf0('0x12e'),'through':'UserSmsQueue','required':![]});db[_0x7bf0('0x13')]['belongsToMany'](db[_0x7bf0('0x66')],{'as':'OpenchannelQueues','through':_0x7bf0('0x3b'),'required':![]});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db['WhatsappQueue'],{'as':_0x7bf0('0x12f'),'through':'UserWhatsappQueue','required':![]});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x7bf0('0x13')]['belongsToMany'](db[_0x7bf0('0xfb')],{'as':_0x7bf0('0x130'),'through':_0x7bf0('0x131'),'required':![]});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db['ChatWebsite'],{'as':_0x7bf0('0x132'),'through':_0x7bf0('0x133')});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x4f')],{'as':_0x7bf0('0x134'),'through':_0x7bf0('0x135')});db['User'][_0x7bf0('0x120')](db['MailAccount'],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x7bf0('0x13')]['belongsToMany'](db[_0x7bf0('0x5f')],{'as':_0x7bf0('0x136'),'through':'user_has_openchannel_accounts'});db['User'][_0x7bf0('0x120')](db[_0x7bf0('0x137')],{'as':_0x7bf0('0x138'),'through':_0x7bf0('0x139')});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0x13a')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x7bf0('0x13')][_0x7bf0('0x120')](db[_0x7bf0('0xe2')],{'as':_0x7bf0('0x13b'),'through':_0x7bf0('0x13c')});db[_0x7bf0('0x16')]['hasMany'](db[_0x7bf0('0x19')],{'as':_0x7bf0('0x13d'),'onDelete':_0x7bf0('0x10e'),'foreignKey':'ChanSpyId'});db[_0x7bf0('0x17')][_0x7bf0('0x111')](db[_0x7bf0('0x19')],{'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x19')][_0x7bf0('0x111')](db[_0x7bf0('0x19')],{'as':_0x7bf0('0x13e'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x1b')]['belongsToMany'](db[_0x7bf0('0x90')],{'as':_0x7bf0('0x13f'),'through':_0x7bf0('0x140')});db[_0x7bf0('0x1d')][_0x7bf0('0x111')](db[_0x7bf0('0x31')],{'as':_0x7bf0('0x141'),'foreignKey':_0x7bf0('0x142')});db[_0x7bf0('0x1d')][_0x7bf0('0x111')](db[_0x7bf0('0x77')],{'as':_0x7bf0('0x143'),'foreignKey':_0x7bf0('0x142')});db[_0x7bf0('0x1d')][_0x7bf0('0x111')](db[_0x7bf0('0x7a')],{'as':'HopperFinals','foreignKey':_0x7bf0('0x142')});db[_0x7bf0('0x1d')][_0x7bf0('0x111')](db[_0x7bf0('0x7c')],{'as':_0x7bf0('0x144'),'foreignKey':_0x7bf0('0x142')});db[_0x7bf0('0x1d')][_0x7bf0('0x111')](db[_0x7bf0('0x116')],{'as':_0x7bf0('0x116'),'foreignKey':_0x7bf0('0x142')});db[_0x7bf0('0x1d')][_0x7bf0('0x111')](db[_0x7bf0('0x79')],{'as':'HopperBlacks','foreignKey':_0x7bf0('0x142')});db[_0x7bf0('0x1d')][_0x7bf0('0x111')](db['JscriptySessionReport'],{'as':_0x7bf0('0x145'),'foreignKey':_0x7bf0('0x142')});db[_0x7bf0('0x1d')][_0x7bf0('0x11e')](db[_0x7bf0('0x2e')],{'as':_0x7bf0('0x2e'),'foreignKey':_0x7bf0('0x146')});db[_0x7bf0('0x1d')][_0x7bf0('0x11e')](db[_0x7bf0('0x2e')],{'as':_0x7bf0('0x147'),'foreignKey':_0x7bf0('0x148')});db['VoiceQueue'][_0x7bf0('0x11e')](db[_0x7bf0('0x88')],{'as':_0x7bf0('0x88'),'foreignKey':_0x7bf0('0x149')});db[_0x7bf0('0x1d')]['belongsTo'](db[_0x7bf0('0x8a')],{'as':_0x7bf0('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x7bf0('0x120')](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x124'),'through':'voice_queues_has_cm_lists'});db[_0x7bf0('0x1d')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x14b'),'through':'UserVoiceQueue'});db[_0x7bf0('0x1d')][_0x7bf0('0x120')](db[_0x7bf0('0xe7')],{'as':'Teams','through':'team_has_voice_queues'});db[_0x7bf0('0x1d')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0x7bf0('0x14c')});db[_0x7bf0('0x1f')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':'User','foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x21')][_0x7bf0('0x11e')](db['User'],{'as':'User','foreignKey':'UserId'});db['VoiceMail']['hasMany'](db[_0x7bf0('0x24')],{'as':_0x7bf0('0x14d'),'onDelete':'cascade','foreignKey':_0x7bf0('0x14e'),'sourceKey':'mailbox'});db[_0x7bf0('0x24')][_0x7bf0('0x11e')](db[_0x7bf0('0x22')],{'foreignKey':_0x7bf0('0x14e'),'targetKey':'mailbox'});db[_0x7bf0('0x26')]['hasMany'](db[_0x7bf0('0x14f')],{'as':_0x7bf0('0x150'),'foreignKey':'uniqueid','constraints':![]});db[_0x7bf0('0x26')][_0x7bf0('0x111')](db[_0x7bf0('0x29')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x7bf0('0x26')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':'User','foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x26')][_0x7bf0('0x11e')](db['CmContact'],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x3e')][_0x7bf0('0x11e')](db[_0x7bf0('0x41')],{'as':_0x7bf0('0x41'),'foreignKey':_0x7bf0('0x153')});db[_0x7bf0('0x154')][_0x7bf0('0x11e')](db[_0x7bf0('0x41')],{'as':_0x7bf0('0x41'),'foreignKey':'MailAccountId'});db[_0x7bf0('0x41')][_0x7bf0('0x10d')](db['MailServerIn'],{'as':'Imap','onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x41')][_0x7bf0('0x10d')](db[_0x7bf0('0x154')],{'as':_0x7bf0('0x155'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x41')][_0x7bf0('0x111')](db['Disposition'],{'as':_0x7bf0('0x156'),'foreignKey':'MailAccountId'});db[_0x7bf0('0x41')][_0x7bf0('0x111')](db['CannedAnswer'],{'as':_0x7bf0('0x157'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x7bf0('0x111')](db['MailMessage'],{'as':'Messages','foreignKey':_0x7bf0('0x153')});db[_0x7bf0('0x41')][_0x7bf0('0x111')](db['MailInteraction'],{'as':_0x7bf0('0x158')});db[_0x7bf0('0x41')][_0x7bf0('0x111')](db[_0x7bf0('0x48')],{'as':_0x7bf0('0x13e')});db[_0x7bf0('0x41')]['belongsTo'](db[_0x7bf0('0xfa')],{'as':'List','foreignKey':_0x7bf0('0x159')});db[_0x7bf0('0x41')][_0x7bf0('0x11e')](db[_0x7bf0('0x15a')],{'as':_0x7bf0('0x15a'),'foreignKey':'TemplateId'});db[_0x7bf0('0x41')]['belongsTo'](db[_0x7bf0('0x8a')],{'as':_0x7bf0('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':'Agents','through':_0x7bf0('0x15b')});db[_0x7bf0('0x43')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x14b'),'through':_0x7bf0('0x35')});db[_0x7bf0('0x43')][_0x7bf0('0x120')](db[_0x7bf0('0xe7')],{'through':_0x7bf0('0x15c'),'as':'Teams'});db['MailInteraction'][_0x7bf0('0x111')](db[_0x7bf0('0x47')],{'as':_0x7bf0('0x14d'),'onDelete':'cascade','foreignKey':_0x7bf0('0x15d')});db['MailInteraction'][_0x7bf0('0x11e')](db['MailAccount'],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x153')});db[_0x7bf0('0x45')]['belongsTo'](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x45')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x15f'),'foreignKey':'UserId'});db['MailInteraction'][_0x7bf0('0x120')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x7bf0('0x160')});db[_0x7bf0('0x45')][_0x7bf0('0x120')](db['Tag'],{'through':_0x7bf0('0x161'),'as':_0x7bf0('0x162')});db[_0x7bf0('0x45')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x163'),'through':_0x7bf0('0x164'),'foreignKey':_0x7bf0('0x15d')});db[_0x7bf0('0x47')][_0x7bf0('0x111')](db[_0x7bf0('0xee')],{'as':_0x7bf0('0x165'),'onDelete':'cascade'});db['MailMessage'][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x13')});db[_0x7bf0('0x47')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'onDelete':'cascade','as':'Contact'});db[_0x7bf0('0x47')][_0x7bf0('0x11e')](db[_0x7bf0('0x45')],{'as':_0x7bf0('0x166'),'foreignKey':_0x7bf0('0x15d')});db[_0x7bf0('0x47')][_0x7bf0('0x11e')](db['MailAccount'],{'as':'Account','foreignKey':_0x7bf0('0x153')});db[_0x7bf0('0x48')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'onDelete':'restrict'});db[_0x7bf0('0x48')][_0x7bf0('0x11e')](db[_0x7bf0('0x43')],{'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x48')][_0x7bf0('0x11e')](db[_0x7bf0('0x41')],{'onDelete':'restrict'});db[_0x7bf0('0x48')][_0x7bf0('0x11e')](db[_0x7bf0('0x88')],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x149')});db['MailApplication'][_0x7bf0('0x11e')](db['Tag'],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x168')});db[_0x7bf0('0x4a')][_0x7bf0('0x11e')](db['MailAccount'],{});db[_0x7bf0('0x4a')][_0x7bf0('0x11e')](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x169'),'foreignKey':'ListId'});db[_0x7bf0('0x4a')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x151'),'foreignKey':'ContactId'});db[_0x7bf0('0x4a')][_0x7bf0('0x11e')](db[_0x7bf0('0x45')],{});db[_0x7bf0('0x4a')][_0x7bf0('0x11e')](db['MailMessage'],{});db[_0x7bf0('0x4a')]['belongsTo'](db[_0x7bf0('0x13')],{});db[_0x7bf0('0x4a')][_0x7bf0('0x11e')](db['MailQueue'],{});db[_0x7bf0('0x4c')][_0x7bf0('0x111')](db[_0x7bf0('0x4e')],{'as':_0x7bf0('0x16a'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x4f')][_0x7bf0('0x111')](db[_0x7bf0('0x85')],{'as':_0x7bf0('0x156'),'foreignKey':_0x7bf0('0x16b')});db[_0x7bf0('0x4f')][_0x7bf0('0x111')](db[_0x7bf0('0x16c')],{'as':'Answers','foreignKey':_0x7bf0('0x16b')});db[_0x7bf0('0x4f')][_0x7bf0('0x111')](db[_0x7bf0('0x127')],{'as':'Interactions'});db[_0x7bf0('0x4f')][_0x7bf0('0x111')](db['FaxApplication'],{'as':'Applications'});db[_0x7bf0('0x4f')][_0x7bf0('0x111')](db[_0x7bf0('0x19')],{'as':_0x7bf0('0x16d'),'onDelete':_0x7bf0('0x10e')});db['FaxAccount'][_0x7bf0('0x111')](db[_0x7bf0('0x53')],{'as':'Messages'});db[_0x7bf0('0x4f')]['belongsTo'](db[_0x7bf0('0x2e')],{'as':_0x7bf0('0x2e')});db[_0x7bf0('0x4f')]['belongsTo'](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x169'),'foreignKey':_0x7bf0('0x159')});db['FaxAccount'][_0x7bf0('0x11e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x7bf0('0x16e')});db[_0x7bf0('0x4f')]['belongsToMany'](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x14b'),'through':_0x7bf0('0x135')});db[_0x7bf0('0x16f')][_0x7bf0('0x11e')](db['User'],{'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x16f')][_0x7bf0('0x11e')](db[_0x7bf0('0x55')],{'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x16f')][_0x7bf0('0x11e')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x7bf0('0x16f')][_0x7bf0('0x11e')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x7bf0('0x168')});db['FaxInteraction'][_0x7bf0('0x111')](db['FaxMessage'],{'as':_0x7bf0('0x14d'),'onDelete':'cascade','foreignKey':_0x7bf0('0x170')});db[_0x7bf0('0x127')]['belongsTo'](db[_0x7bf0('0x4f')],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x16b')});db[_0x7bf0('0x127')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'as':'Contact','foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x127')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x15f'),'foreignKey':'UserId'});db[_0x7bf0('0x127')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x171'),'as':_0x7bf0('0x160')});db['FaxInteraction'][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x171'),'as':_0x7bf0('0x162')});db['FaxInteraction'][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x163'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x13')});db[_0x7bf0('0x53')][_0x7bf0('0x11e')](db['FaxInteraction'],{'as':_0x7bf0('0x166'),'foreignKey':_0x7bf0('0x170')});db[_0x7bf0('0x53')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x151')});db[_0x7bf0('0x53')][_0x7bf0('0x11e')](db[_0x7bf0('0xee')],{'as':'Attachment','foreignKey':_0x7bf0('0x172')});db['FaxMessage'][_0x7bf0('0x11e')](db[_0x7bf0('0x4f')],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x16b')});db[_0x7bf0('0x55')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x14b'),'through':_0x7bf0('0x37')});db[_0x7bf0('0x55')][_0x7bf0('0x120')](db[_0x7bf0('0xe7')],{'through':_0x7bf0('0x173'),'as':'Teams'});db[_0x7bf0('0x174')][_0x7bf0('0x11e')](db[_0x7bf0('0x4f')],{});db[_0x7bf0('0x174')][_0x7bf0('0x11e')](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x169'),'foreignKey':_0x7bf0('0x159')});db[_0x7bf0('0x174')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'as':'Contact','foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x174')][_0x7bf0('0x11e')](db[_0x7bf0('0x127')],{});db[_0x7bf0('0x174')][_0x7bf0('0x11e')](db['FaxMessage'],{});db[_0x7bf0('0x174')]['belongsTo'](db[_0x7bf0('0x13')],{});db['FaxQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x55')],{});db[_0x7bf0('0x137')][_0x7bf0('0x111')](db['Disposition'],{'as':_0x7bf0('0x156'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x7bf0('0x111')](db[_0x7bf0('0x16c')],{'as':'Answers','foreignKey':_0x7bf0('0x175')});db['SmsAccount'][_0x7bf0('0x111')](db[_0x7bf0('0x5b')],{'as':_0x7bf0('0x14d'),'foreignKey':_0x7bf0('0x175')});db[_0x7bf0('0x137')][_0x7bf0('0x111')](db[_0x7bf0('0x59')],{'as':_0x7bf0('0x158')});db[_0x7bf0('0x137')][_0x7bf0('0x111')](db['SmsApplication'],{'as':_0x7bf0('0x13e')});db[_0x7bf0('0x137')][_0x7bf0('0x11e')](db['CmList'],{'as':_0x7bf0('0x169'),'foreignKey':_0x7bf0('0x159')});db['SmsAccount']['belongsTo'](db['Pause'],{'as':_0x7bf0('0x14a'),'foreignKey':_0x7bf0('0x16e')});db['SmsAccount']['belongsToMany'](db[_0x7bf0('0x13')],{'as':'Agents','through':_0x7bf0('0x139')});db[_0x7bf0('0x57')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'onDelete':'restrict'});db[_0x7bf0('0x57')]['belongsTo'](db['SmsQueue'],{'onDelete':'restrict'});db[_0x7bf0('0x57')]['belongsTo'](db[_0x7bf0('0x137')],{'onDelete':_0x7bf0('0x167')});db['SmsApplication'][_0x7bf0('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x7bf0('0x149')});db[_0x7bf0('0x57')][_0x7bf0('0x11e')](db[_0x7bf0('0x92')],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x168')});db[_0x7bf0('0x59')][_0x7bf0('0x111')](db[_0x7bf0('0x5b')],{'as':_0x7bf0('0x14d'),'onDelete':_0x7bf0('0x10e'),'foreignKey':'SmsInteractionId'});db[_0x7bf0('0x59')]['belongsTo'](db[_0x7bf0('0x137')],{'as':'Account','foreignKey':_0x7bf0('0x175')});db['SmsInteraction'][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'as':'Contact','foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x59')][_0x7bf0('0x11e')](db['User'],{'as':_0x7bf0('0x15f'),'foreignKey':_0x7bf0('0x110')});db[_0x7bf0('0x59')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x176'),'as':_0x7bf0('0x160')});db['SmsInteraction'][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x176'),'as':_0x7bf0('0x162')});db[_0x7bf0('0x59')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x163'),'through':_0x7bf0('0x177'),'foreignKey':_0x7bf0('0x178')});db['SmsMessage'][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x13')});db[_0x7bf0('0x5b')][_0x7bf0('0x11e')](db['CmContact'],{'onDelete':'cascade','as':_0x7bf0('0x151')});db[_0x7bf0('0x5b')][_0x7bf0('0x11e')](db[_0x7bf0('0x59')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x166'),'foreignKey':_0x7bf0('0x178')});db[_0x7bf0('0x5b')][_0x7bf0('0x11e')](db[_0x7bf0('0x137')],{'as':_0x7bf0('0x15e'),'foreignKey':'SmsAccountId'});db[_0x7bf0('0x5d')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x14b'),'through':_0x7bf0('0x39'),'foreignKey':'SmsQueueId'});db[_0x7bf0('0x5d')]['belongsToMany'](db[_0x7bf0('0xe7')],{'through':_0x7bf0('0x179'),'as':_0x7bf0('0x17a')});db[_0x7bf0('0x5f')][_0x7bf0('0x111')](db[_0x7bf0('0x85')],{'as':_0x7bf0('0x156'),'foreignKey':_0x7bf0('0x17b')});db[_0x7bf0('0x5f')]['hasMany'](db['CannedAnswer'],{'as':_0x7bf0('0x157'),'foreignKey':_0x7bf0('0x17b')});db[_0x7bf0('0x5f')][_0x7bf0('0x111')](db[_0x7bf0('0x62')],{'as':_0x7bf0('0x158'),'foreignKey':_0x7bf0('0x17b')});db[_0x7bf0('0x5f')]['hasMany'](db[_0x7bf0('0x64')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x7bf0('0x111')](db[_0x7bf0('0x61')],{'as':_0x7bf0('0x13e'),'foreignKey':_0x7bf0('0x17b')});db[_0x7bf0('0x5f')][_0x7bf0('0x11e')](db[_0x7bf0('0xfa')],{'as':'List','foreignKey':_0x7bf0('0x159')});db[_0x7bf0('0x5f')][_0x7bf0('0x11e')](db[_0x7bf0('0x8a')],{'as':_0x7bf0('0x14a'),'foreignKey':_0x7bf0('0x16e')});db[_0x7bf0('0x5f')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':'Agents','through':_0x7bf0('0x17c')});db[_0x7bf0('0x61')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'onDelete':_0x7bf0('0x167')});db['OpenchannelApplication'][_0x7bf0('0x11e')](db[_0x7bf0('0x66')],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x17d')});db['OpenchannelApplication']['belongsTo'](db[_0x7bf0('0x5f')],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x17b')});db[_0x7bf0('0x61')][_0x7bf0('0x11e')](db[_0x7bf0('0x88')],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x149')});db['OpenchannelApplication'][_0x7bf0('0x11e')](db[_0x7bf0('0x92')],{'onDelete':'restrict','foreignKey':_0x7bf0('0x168')});db[_0x7bf0('0x62')]['hasMany'](db[_0x7bf0('0x64')],{'as':_0x7bf0('0x14d'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x17e')});db[_0x7bf0('0x62')][_0x7bf0('0x11e')](db[_0x7bf0('0x5f')],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x17b')});db[_0x7bf0('0x62')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x62')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x15f'),'foreignKey':'UserId'});db[_0x7bf0('0x62')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x17f'),'as':_0x7bf0('0x160')});db[_0x7bf0('0x62')][_0x7bf0('0x120')](db['Tag'],{'through':_0x7bf0('0x17f'),'as':'ThroughTags'});db[_0x7bf0('0x62')]['belongsToMany'](db[_0x7bf0('0x13')],{'as':'Users','through':_0x7bf0('0x129'),'foreignKey':_0x7bf0('0x17e')});db[_0x7bf0('0x64')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x7bf0('0x13')});db[_0x7bf0('0x64')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x151')});db[_0x7bf0('0x64')][_0x7bf0('0x11e')](db[_0x7bf0('0x62')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x166'),'foreignKey':_0x7bf0('0x17e')});db[_0x7bf0('0x64')][_0x7bf0('0x11e')](db['Attachment'],{'as':_0x7bf0('0xee'),'foreignKey':_0x7bf0('0x172')});db[_0x7bf0('0x64')][_0x7bf0('0x11e')](db['OpenchannelAccount'],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x17b')});db['OpenchannelQueue'][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x7bf0('0x17d')});db[_0x7bf0('0x66')]['belongsToMany'](db[_0x7bf0('0xe7')],{'through':_0x7bf0('0x180'),'as':_0x7bf0('0x17a')});db[_0x7bf0('0x181')][_0x7bf0('0x111')](db[_0x7bf0('0x85')],{'as':_0x7bf0('0x156'),'foreignKey':_0x7bf0('0x182')});db['ChatWebsite'][_0x7bf0('0x111')](db[_0x7bf0('0x16c')],{'as':_0x7bf0('0x157'),'foreignKey':'ChatWebsiteId'});db[_0x7bf0('0x181')][_0x7bf0('0x111')](db[_0x7bf0('0x72')],{'as':_0x7bf0('0x183')});db[_0x7bf0('0x181')][_0x7bf0('0x111')](db[_0x7bf0('0x6c')],{'as':_0x7bf0('0x158')});db[_0x7bf0('0x181')][_0x7bf0('0x111')](db[_0x7bf0('0x6a')],{'as':_0x7bf0('0x13e')});db[_0x7bf0('0x181')][_0x7bf0('0x111')](db[_0x7bf0('0x6d')],{'as':_0x7bf0('0x14d')});db[_0x7bf0('0x181')][_0x7bf0('0x11e')](db['CmList'],{'as':_0x7bf0('0x169'),'foreignKey':_0x7bf0('0x159')});db[_0x7bf0('0x181')][_0x7bf0('0x11e')](db['Interval'],{'as':_0x7bf0('0x88'),'foreignKey':_0x7bf0('0x149')});db[_0x7bf0('0x181')]['belongsTo'](db[_0x7bf0('0x8a')],{'as':_0x7bf0('0x14a'),'foreignKey':_0x7bf0('0x16e')});db[_0x7bf0('0x181')]['belongsToMany'](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x14b'),'through':_0x7bf0('0x133')});db[_0x7bf0('0x68')][_0x7bf0('0x11e')](db[_0x7bf0('0x5f')],{});db['OpenchannelQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x169'),'foreignKey':_0x7bf0('0x159')});db[_0x7bf0('0x68')]['belongsTo'](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x151'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x62')],{});db['OpenchannelQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x64')],{});db['OpenchannelQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{});db[_0x7bf0('0x68')][_0x7bf0('0x11e')](db['OpenchannelQueue'],{});db[_0x7bf0('0x6a')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x184'),'foreignKey':_0x7bf0('0x110'),'onDelete':'restrict'});db['ChatApplication'][_0x7bf0('0x11e')](db[_0x7bf0('0x70')],{'as':_0x7bf0('0x185'),'foreignKey':_0x7bf0('0x186'),'onDelete':_0x7bf0('0x167')});db['ChatApplication'][_0x7bf0('0x11e')](db[_0x7bf0('0x181')],{'as':_0x7bf0('0x187'),'foreignKey':_0x7bf0('0x182'),'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x6a')][_0x7bf0('0x11e')](db['Tag'],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x168')});db[_0x7bf0('0x6c')][_0x7bf0('0x111')](db[_0x7bf0('0x6d')],{'as':_0x7bf0('0x14d'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x188')});db[_0x7bf0('0x6c')]['belongsTo'](db[_0x7bf0('0x181')],{'as':'Account','foreignKey':_0x7bf0('0x182')});db[_0x7bf0('0x6c')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db['ChatInteraction'][_0x7bf0('0x11e')](db['User'],{'as':_0x7bf0('0x15f'),'foreignKey':_0x7bf0('0x110')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x7bf0('0x189'),'as':_0x7bf0('0x160')});db[_0x7bf0('0x6c')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x189'),'as':_0x7bf0('0x162')});db[_0x7bf0('0x6c')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x163'),'through':_0x7bf0('0x126'),'foreignKey':_0x7bf0('0x188')});db[_0x7bf0('0x6d')][_0x7bf0('0x11e')](db['User'],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x13')});db[_0x7bf0('0x6d')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db['ChatMessage'][_0x7bf0('0x11e')](db[_0x7bf0('0x6c')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x166'),'foreignKey':'ChatInteractionId'});db[_0x7bf0('0x6d')][_0x7bf0('0x11e')](db[_0x7bf0('0xee')],{'as':_0x7bf0('0xee'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x7bf0('0x11e')](db[_0x7bf0('0x181')],{'as':_0x7bf0('0x15e'),'foreignKey':'ChatWebsiteId'});db[_0x7bf0('0x18a')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'onDelete':'cascade','as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db['ChatOfflineMessage']['belongsTo'](db[_0x7bf0('0x181')],{'as':_0x7bf0('0x15e'),'foreignKey':'ChatWebsiteId'});db[_0x7bf0('0x70')][_0x7bf0('0x120')](db['User'],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x7bf0('0x70')][_0x7bf0('0x120')](db[_0x7bf0('0xe7')],{'through':'team_has_chat_queues','as':_0x7bf0('0x17a')});db['ChatGroup'][_0x7bf0('0x111')](db[_0x7bf0('0xd0')],{'as':_0x7bf0('0x14d'),'foreignKey':'ChatGroupId','onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x71')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x141'),'through':_0x7bf0('0x122')});db[_0x7bf0('0x72')][_0x7bf0('0x11e')](db[_0x7bf0('0x181')],{'as':_0x7bf0('0x187'),'foreignKey':_0x7bf0('0x182')});db[_0x7bf0('0x74')]['hasMany'](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x18b'),'foreignKey':'CompanyId'});db[_0x7bf0('0x76')][_0x7bf0('0x111')](db[_0x7bf0('0x77')],{'as':_0x7bf0('0x143'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x76')][_0x7bf0('0x111')](db['CmHopperFinal'],{'as':_0x7bf0('0x114'),'foreignKey':'ContactId'});db['CmContact'][_0x7bf0('0x111')](db[_0x7bf0('0x7c')],{'as':_0x7bf0('0x144'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x76')][_0x7bf0('0x111')](db['ReportAgentPreview'],{'as':_0x7bf0('0x116'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x76')][_0x7bf0('0x111')](db[_0x7bf0('0xd4')],{'as':_0x7bf0('0x145'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x76')][_0x7bf0('0x111')](db[_0x7bf0('0x62')],{'as':_0x7bf0('0x117'),'foreignKey':_0x7bf0('0x152'),'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x76')]['hasMany'](db[_0x7bf0('0x6c')],{'as':_0x7bf0('0x118'),'foreignKey':_0x7bf0('0x152'),'onDelete':'restrict'});db[_0x7bf0('0x76')][_0x7bf0('0x111')](db[_0x7bf0('0x59')],{'as':_0x7bf0('0x18c'),'foreignKey':_0x7bf0('0x152'),'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x76')][_0x7bf0('0x111')](db[_0x7bf0('0x127')],{'as':_0x7bf0('0x119'),'foreignKey':'ContactId','onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x76')]['hasMany'](db['MailInteraction'],{'as':_0x7bf0('0x11a'),'foreignKey':_0x7bf0('0x152'),'onDelete':_0x7bf0('0x167')});db['CmContact']['belongsTo'](db[_0x7bf0('0x74')],{'as':_0x7bf0('0x18d'),'foreignKey':_0x7bf0('0x18e')});db[_0x7bf0('0x76')]['belongsTo'](db[_0x7bf0('0xfa')],{'as':'List','foreignKey':_0x7bf0('0x159'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x76')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x163'),'through':_0x7bf0('0x123')});db[_0x7bf0('0x76')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x7bf0('0x76')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x18f'),'as':_0x7bf0('0x162')});db[_0x7bf0('0x77')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x77')]['belongsTo'](db['CmList'],{'as':_0x7bf0('0x169'),'foreignKey':_0x7bf0('0x159'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x77')][_0x7bf0('0x11e')](db['User'],{'as':_0x7bf0('0x184'),'foreignKey':'UserId'});db[_0x7bf0('0x77')]['belongsTo'](db['VoiceQueue'],{'as':_0x7bf0('0x185'),'foreignKey':_0x7bf0('0x142'),'onDelete':_0x7bf0('0x10e')});db['CmHopper'][_0x7bf0('0x11e')](db[_0x7bf0('0xeb')],{'as':'Campaign','foreignKey':_0x7bf0('0x190'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x77')]['belongsTo'](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x15f'),'foreignKey':_0x7bf0('0x191')});db[_0x7bf0('0x79')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152'),'onDelete':_0x7bf0('0x10e')});db['CmHopperBlack'][_0x7bf0('0x11e')](db['CmList'],{'as':_0x7bf0('0x169'),'foreignKey':_0x7bf0('0x159'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x79')][_0x7bf0('0x11e')](db[_0x7bf0('0x1d')],{'as':_0x7bf0('0x185'),'foreignKey':_0x7bf0('0x142'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0x79')][_0x7bf0('0x11e')](db[_0x7bf0('0xeb')],{'as':_0x7bf0('0xeb'),'foreignKey':'CampaignId','onDelete':_0x7bf0('0x10e')});db['Automation'][_0x7bf0('0x111')](db[_0x7bf0('0x87')],{'as':{'plural':'All','singular':_0x7bf0('0x192')},'foreignKey':_0x7bf0('0x193'),'onDelete':_0x7bf0('0x10e'),'hooks':!![]});db[_0x7bf0('0x82')]['hasMany'](db[_0x7bf0('0x87')],{'as':{'plural':_0x7bf0('0x194'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x7bf0('0x10e'),'hooks':!![]});db[_0x7bf0('0x82')][_0x7bf0('0x111')](db['Action'],{'as':'Actions','foreignKey':_0x7bf0('0x195'),'onDelete':_0x7bf0('0x10e'),'hooks':!![]});db[_0x7bf0('0x88')][_0x7bf0('0x111')](db[_0x7bf0('0x88')],{'as':_0x7bf0('0x196'),'foreignKey':_0x7bf0('0x149'),'onDelete':_0x7bf0('0x10e'),'hooks':!![],'required':![]});db[_0x7bf0('0x88')][_0x7bf0('0x111')](db['VoiceExtension'],{'as':_0x7bf0('0x113'),'foreignKey':_0x7bf0('0x149'),'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x88')]['hasMany'](db[_0x7bf0('0x48')],{'as':_0x7bf0('0x197'),'foreignKey':_0x7bf0('0x149')});db[_0x7bf0('0x88')][_0x7bf0('0x111')](db['ChatApplication'],{'as':_0x7bf0('0x198'),'foreignKey':'IntervalId'});db[_0x7bf0('0x88')][_0x7bf0('0x111')](db['FaxApplication'],{'as':_0x7bf0('0x199'),'foreignKey':_0x7bf0('0x149')});db[_0x7bf0('0x88')][_0x7bf0('0x111')](db[_0x7bf0('0x57')],{'as':_0x7bf0('0x19a'),'foreignKey':_0x7bf0('0x149')});db[_0x7bf0('0x8e')]['belongsTo'](db[_0x7bf0('0x41')],{});db['Schedule'][_0x7bf0('0x11e')](db['AnalyticDefaultReport'],{'foreignKey':_0x7bf0('0x19b')});db[_0x7bf0('0x8e')][_0x7bf0('0x11e')](db[_0x7bf0('0x19c')],{'foreignKey':_0x7bf0('0x19d')});db[_0x7bf0('0x90')][_0x7bf0('0x120')](db[_0x7bf0('0x1b')],{'as':_0x7bf0('0x19e'),'through':_0x7bf0('0x140'),'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x92')]['belongsToMany'](db[_0x7bf0('0x76')],{'through':_0x7bf0('0x18f')});db['Tag'][_0x7bf0('0x120')](db[_0x7bf0('0x6c')],{'through':_0x7bf0('0x189')});db['Tag'][_0x7bf0('0x120')](db[_0x7bf0('0x45')],{'through':_0x7bf0('0x161')});db[_0x7bf0('0x92')][_0x7bf0('0x120')](db[_0x7bf0('0x59')],{'through':_0x7bf0('0x176')});db[_0x7bf0('0x92')][_0x7bf0('0x120')](db[_0x7bf0('0x127')],{'through':_0x7bf0('0x171')});db[_0x7bf0('0x92')][_0x7bf0('0x120')](db[_0x7bf0('0x62')],{'through':_0x7bf0('0x17f')});db[_0x7bf0('0x92')]['belongsToMany'](db[_0x7bf0('0x102')],{'through':_0x7bf0('0x19f')});db[_0x7bf0('0x95')][_0x7bf0('0x111')](db['Condition'],{'as':{'plural':_0x7bf0('0x1a0'),'singular':_0x7bf0('0x1a1')},'foreignKey':_0x7bf0('0x1a2'),'onDelete':_0x7bf0('0x10e'),'hooks':!![]});db[_0x7bf0('0x95')][_0x7bf0('0x111')](db[_0x7bf0('0x87')],{'as':{'plural':_0x7bf0('0x1a3'),'singular':_0x7bf0('0x1a4')},'foreignKey':_0x7bf0('0x1a5'),'onDelete':_0x7bf0('0x10e'),'hooks':!![]});db[_0x7bf0('0x95')][_0x7bf0('0x111')](db[_0x7bf0('0x80')],{'as':'Actions','foreignKey':_0x7bf0('0x1a6'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x7bf0('0xa1')],{'as':_0x7bf0('0x1a7'),'onDelete':'cascade','foreignKey':_0x7bf0('0x19d'),'hooks':!![]});db[_0x7bf0('0x9c')][_0x7bf0('0x111')](db[_0x7bf0('0xa1')],{'as':_0x7bf0('0x1a7'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x19b')});db[_0x7bf0('0x9f')][_0x7bf0('0x111')](db['AnalyticFieldReport'],{'as':_0x7bf0('0x1a7'),'onDelete':_0x7bf0('0x10e'),'foreignKey':'MetricId'});db[_0x7bf0('0xa1')][_0x7bf0('0x11e')](db[_0x7bf0('0x9f')],{'foreignKey':'MetricId'});db[_0x7bf0('0xa3')][_0x7bf0('0x111')](db[_0x7bf0('0xa5')],{'as':_0x7bf0('0x1a8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x7bf0('0xa5')][_0x7bf0('0x111')](db[_0x7bf0('0xa7')],{'as':_0x7bf0('0x1a9'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xa5')]['hasMany'](db[_0x7bf0('0xa7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7bf0('0xa5')][_0x7bf0('0x111')](db[_0x7bf0('0xa7')],{'as':_0x7bf0('0x1a7'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ab')});db['SalesforceConfiguration'][_0x7bf0('0x11e')](db['SalesforceAccount'],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0xa7')][_0x7bf0('0x111')](db[_0x7bf0('0xa7')],{'as':'Subject','foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xa7')]['hasMany'](db[_0x7bf0('0xa7')],{'as':_0x7bf0('0x1ad'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0xa7')]['hasMany'](db[_0x7bf0('0xa7')],{'as':_0x7bf0('0x1af'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0xa7')][_0x7bf0('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0x7bf0('0x1b0')});db[_0x7bf0('0xa8')][_0x7bf0('0x111')](db[_0x7bf0('0xaa')],{'as':_0x7bf0('0x1a8'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0xaa')]['hasMany'](db['SugarcrmField'],{'as':_0x7bf0('0x1a9'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xaa')][_0x7bf0('0x111')](db[_0x7bf0('0xac')],{'as':_0x7bf0('0x1b1'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ae')});db['SugarcrmConfiguration'][_0x7bf0('0x111')](db['SugarcrmField'],{'as':_0x7bf0('0x1a7'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0xaa')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x7bf0('0x15e'),'foreignKey':'AccountId'});db[_0x7bf0('0xac')][_0x7bf0('0x111')](db[_0x7bf0('0xac')],{'as':_0x7bf0('0x1b2'),'foreignKey':_0x7bf0('0x1aa')});db['SugarcrmField'][_0x7bf0('0x111')](db['SugarcrmField'],{'as':_0x7bf0('0x1ad'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0xac')][_0x7bf0('0x111')](db[_0x7bf0('0xac')],{'as':_0x7bf0('0x1af'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0xac')][_0x7bf0('0x11e')](db[_0x7bf0('0x96')],{'as':_0x7bf0('0x96'),'foreignKey':_0x7bf0('0x1b0')});db[_0x7bf0('0x1b3')][_0x7bf0('0x111')](db[_0x7bf0('0xae')],{'as':_0x7bf0('0x1a8'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0xae')]['hasMany'](db[_0x7bf0('0x1b4')],{'as':'Subjects','onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1aa')});db['DeskConfiguration'][_0x7bf0('0x111')](db[_0x7bf0('0x1b4')],{'as':_0x7bf0('0x1b1'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0xae')][_0x7bf0('0x111')](db['DeskField'],{'as':'Fields','onDelete':_0x7bf0('0x10e'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x7bf0('0x11e')](db['DeskAccount'],{'as':_0x7bf0('0x15e'),'foreignKey':'AccountId'});db[_0x7bf0('0xae')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x1b5')});db[_0x7bf0('0x1b4')][_0x7bf0('0x111')](db[_0x7bf0('0x1b4')],{'as':'Subject','foreignKey':_0x7bf0('0x1aa')});db['DeskField'][_0x7bf0('0x111')](db[_0x7bf0('0x1b4')],{'as':_0x7bf0('0x1ad'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0x1b4')]['hasMany'](db[_0x7bf0('0x1b4')],{'as':'Field','foreignKey':'FieldId'});db['DeskField']['belongsTo'](db[_0x7bf0('0x96')],{'as':_0x7bf0('0x96'),'foreignKey':'VariableId'});db[_0x7bf0('0xaf')]['hasMany'](db[_0x7bf0('0x1b6')],{'as':_0x7bf0('0x1a8'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0x1b6')][_0x7bf0('0x111')](db['ZohoField'],{'as':'Subjects','onDelete':_0x7bf0('0x10e'),'foreignKey':'SubjectId'});db[_0x7bf0('0x1b6')][_0x7bf0('0x111')](db[_0x7bf0('0xb1')],{'as':_0x7bf0('0x1b1'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0x1b6')][_0x7bf0('0x111')](db[_0x7bf0('0xb1')],{'as':_0x7bf0('0x1a7'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0x1b6')][_0x7bf0('0x11e')](db[_0x7bf0('0xaf')],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x1ac')});db['ZohoField'][_0x7bf0('0x111')](db['ZohoField'],{'as':_0x7bf0('0x1b2'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xb1')][_0x7bf0('0x111')](db['ZohoField'],{'as':'Description','foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0xb1')][_0x7bf0('0x111')](db[_0x7bf0('0xb1')],{'as':_0x7bf0('0x1af'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0xb1')][_0x7bf0('0x11e')](db[_0x7bf0('0x96')],{'as':_0x7bf0('0x96'),'foreignKey':_0x7bf0('0x1b0')});db['ZendeskAccount'][_0x7bf0('0x111')](db[_0x7bf0('0xb4')],{'as':'Configurations','onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0xb4')]['hasMany'](db[_0x7bf0('0x1b7')],{'as':_0x7bf0('0x1a9'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xb4')][_0x7bf0('0x111')](db[_0x7bf0('0x1b7')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x7bf0('0xb4')]['hasMany'](db[_0x7bf0('0x1b7')],{'as':_0x7bf0('0x1a7'),'foreignKey':_0x7bf0('0x1ab')});db['ZendeskConfiguration'][_0x7bf0('0x11e')](db[_0x7bf0('0xb2')],{'as':'Account','foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0xb4')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x1b8')});db[_0x7bf0('0x1b7')][_0x7bf0('0x111')](db[_0x7bf0('0x1b7')],{'as':_0x7bf0('0x1b2'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0x1b7')][_0x7bf0('0x111')](db['ZendeskField'],{'as':'Description','foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0x1b7')]['hasMany'](db['ZendeskField'],{'as':_0x7bf0('0x1af'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0x1b7')][_0x7bf0('0x11e')](db[_0x7bf0('0x96')],{'as':_0x7bf0('0x96'),'foreignKey':_0x7bf0('0x1b0')});db[_0x7bf0('0xb5')][_0x7bf0('0x111')](db[_0x7bf0('0x1b9')],{'as':_0x7bf0('0x1a8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x7bf0('0x1b9')][_0x7bf0('0x111')](db[_0x7bf0('0xb8')],{'as':_0x7bf0('0x1a9'),'onDelete':'cascade','foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0x1b9')][_0x7bf0('0x111')](db[_0x7bf0('0xb8')],{'as':_0x7bf0('0x1b1'),'onDelete':'cascade','foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0x1b9')]['hasMany'](db[_0x7bf0('0xb8')],{'as':_0x7bf0('0x1a7'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0x1b9')]['belongsTo'](db[_0x7bf0('0xb5')],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0x1b9')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x1ba')});db['FreshdeskField'][_0x7bf0('0x111')](db[_0x7bf0('0xb8')],{'as':_0x7bf0('0x1b2'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xb8')][_0x7bf0('0x111')](db['FreshdeskField'],{'as':_0x7bf0('0x1ad'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0x7bf0('0x111')](db[_0x7bf0('0xb8')],{'as':_0x7bf0('0x1af'),'foreignKey':_0x7bf0('0x1ab')});db['FreshdeskField']['belongsTo'](db[_0x7bf0('0x96')],{'as':_0x7bf0('0x96'),'foreignKey':_0x7bf0('0x1b0')});db[_0x7bf0('0xb9')][_0x7bf0('0x111')](db['VtigerConfiguration'],{'as':_0x7bf0('0x1a8'),'onDelete':_0x7bf0('0x10e'),'foreignKey':'AccountId'});db[_0x7bf0('0xbb')]['hasMany'](db['VtigerField'],{'as':_0x7bf0('0x1a9'),'foreignKey':_0x7bf0('0x1aa')});db['VtigerConfiguration'][_0x7bf0('0x111')](db[_0x7bf0('0xbc')],{'as':_0x7bf0('0x1b1'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0xbb')]['hasMany'](db['VtigerField'],{'as':_0x7bf0('0x1a7'),'foreignKey':_0x7bf0('0x1ab')});db['VtigerConfiguration'][_0x7bf0('0x11e')](db[_0x7bf0('0xb9')],{'as':'Account','foreignKey':_0x7bf0('0x1ac')});db['VtigerField']['hasMany'](db[_0x7bf0('0xbc')],{'as':_0x7bf0('0x1b2'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xbc')]['hasMany'](db['VtigerField'],{'as':_0x7bf0('0x1ad'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0xbc')][_0x7bf0('0x111')](db[_0x7bf0('0xbc')],{'as':'Field','foreignKey':'FieldId'});db[_0x7bf0('0xbc')]['belongsTo'](db[_0x7bf0('0x96')],{'as':_0x7bf0('0x96'),'foreignKey':_0x7bf0('0x1b0')});db[_0x7bf0('0xbe')][_0x7bf0('0x111')](db[_0x7bf0('0xc0')],{'as':_0x7bf0('0x1a8'),'onDelete':_0x7bf0('0x10e'),'foreignKey':'AccountId'});db[_0x7bf0('0xc0')][_0x7bf0('0x111')](db[_0x7bf0('0xc1')],{'as':_0x7bf0('0x1a9'),'foreignKey':_0x7bf0('0x1aa')});db['ServicenowConfiguration'][_0x7bf0('0x111')](db[_0x7bf0('0xc1')],{'as':_0x7bf0('0x1b1'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0xc0')][_0x7bf0('0x111')](db[_0x7bf0('0xc1')],{'as':_0x7bf0('0x1a7'),'foreignKey':'FieldId'});db[_0x7bf0('0xc0')]['belongsTo'](db[_0x7bf0('0xbe')],{'as':_0x7bf0('0x15e'),'foreignKey':'AccountId'});db[_0x7bf0('0xc1')][_0x7bf0('0x111')](db['ServicenowField'],{'as':_0x7bf0('0x1b2'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xc1')][_0x7bf0('0x111')](db[_0x7bf0('0xc1')],{'as':'Description','foreignKey':_0x7bf0('0x1ae')});db['ServicenowField'][_0x7bf0('0x111')](db[_0x7bf0('0xc1')],{'as':_0x7bf0('0x1af'),'foreignKey':_0x7bf0('0x1ab')});db['ServicenowField'][_0x7bf0('0x11e')](db['Variable'],{'as':_0x7bf0('0x96'),'foreignKey':_0x7bf0('0x1b0')});db[_0x7bf0('0xc2')]['hasMany'](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0xc4')][_0x7bf0('0x111')](db['Dynamics365Field'],{'as':_0x7bf0('0x1a9'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x7bf0('0xc4')][_0x7bf0('0x111')](db[_0x7bf0('0x1bb')],{'as':_0x7bf0('0x1b1'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ae')});db['Dynamics365Configuration'][_0x7bf0('0x111')](db[_0x7bf0('0x1bb')],{'as':_0x7bf0('0x1a7'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0xc4')][_0x7bf0('0x11e')](db[_0x7bf0('0xc2')],{'as':'Account','foreignKey':_0x7bf0('0x1ac')});db['Dynamics365Field'][_0x7bf0('0x111')](db['Dynamics365Field'],{'as':_0x7bf0('0x1b2'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0x1bb')][_0x7bf0('0x111')](db[_0x7bf0('0x1bb')],{'as':_0x7bf0('0x1ad'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0x1bb')]['hasMany'](db[_0x7bf0('0x1bb')],{'as':_0x7bf0('0x1af'),'foreignKey':'FieldId'});db[_0x7bf0('0x1bb')][_0x7bf0('0x11e')](db[_0x7bf0('0x96')],{'as':_0x7bf0('0x96'),'foreignKey':_0x7bf0('0x1b0')});db[_0x7bf0('0xc7')][_0x7bf0('0x111')](db[_0x7bf0('0xc8')],{'as':_0x7bf0('0x1a8'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x7bf0('0x1a9'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xc8')][_0x7bf0('0x111')](db[_0x7bf0('0xca')],{'as':_0x7bf0('0x1b1'),'foreignKey':_0x7bf0('0x1ae')});db[_0x7bf0('0xc8')]['hasMany'](db[_0x7bf0('0xca')],{'as':_0x7bf0('0x1a7'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0xc8')]['belongsTo'](db[_0x7bf0('0xc7')],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x1ac')});db[_0x7bf0('0xca')][_0x7bf0('0x111')](db[_0x7bf0('0xca')],{'as':_0x7bf0('0x1b2'),'foreignKey':_0x7bf0('0x1aa')});db[_0x7bf0('0xca')][_0x7bf0('0x111')](db[_0x7bf0('0xca')],{'as':_0x7bf0('0x1ad'),'foreignKey':'DescriptionId'});db[_0x7bf0('0xca')][_0x7bf0('0x111')](db[_0x7bf0('0xca')],{'as':_0x7bf0('0x1af'),'foreignKey':_0x7bf0('0x1ab')});db[_0x7bf0('0xca')][_0x7bf0('0x11e')](db[_0x7bf0('0x96')],{'as':_0x7bf0('0x96'),'foreignKey':_0x7bf0('0x1b0')});db[_0x7bf0('0xce')][_0x7bf0('0x11e')](db['ChatWebsite'],{});db[_0x7bf0('0xce')][_0x7bf0('0x11e')](db[_0x7bf0('0xfa')],{'as':'List','foreignKey':_0x7bf0('0x159')});db[_0x7bf0('0xce')][_0x7bf0('0x11e')](db['CmContact'],{'as':_0x7bf0('0x151'),'foreignKey':'ContactId'});db[_0x7bf0('0xce')][_0x7bf0('0x11e')](db[_0x7bf0('0x6c')],{});db['ChatQueueReport']['belongsTo'](db[_0x7bf0('0x6d')],{});db['ChatQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{});db['ChatQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x70')],{});db[_0x7bf0('0xd0')][_0x7bf0('0x11e')](db['User'],{'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x1bc')});db[_0x7bf0('0xd0')]['belongsTo'](db[_0x7bf0('0x13')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x7bf0('0xd4')][_0x7bf0('0x111')](db[_0x7bf0('0x1bd')],{'foreignKey':_0x7bf0('0x1be'),'onDelete':_0x7bf0('0x10e')});db['JscriptySessionReport'][_0x7bf0('0x111')](db[_0x7bf0('0x1bf')],{'foreignKey':'SessionId','onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0xd6')]['belongsTo'](db[_0x7bf0('0x137')],{});db[_0x7bf0('0xd6')][_0x7bf0('0x11e')](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x169'),'foreignKey':'ListId'});db[_0x7bf0('0xd6')][_0x7bf0('0x11e')](db['CmContact'],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db['SmsQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x59')],{});db[_0x7bf0('0xd6')][_0x7bf0('0x11e')](db[_0x7bf0('0x5b')],{});db['SmsQueueReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{});db[_0x7bf0('0xd6')][_0x7bf0('0x11e')](db[_0x7bf0('0x5d')],{});db['JscriptyProject'][_0x7bf0('0x111')](db[_0x7bf0('0xd4')],{'foreignKey':_0x7bf0('0x1c0')});db[_0x7bf0('0xdc')][_0x7bf0('0x111')](db[_0x7bf0('0x1bd')],{'foreignKey':_0x7bf0('0x1c0')});db[_0x7bf0('0xdc')]['hasMany'](db[_0x7bf0('0x1bf')],{'foreignKey':'ProjectId'});db[_0x7bf0('0xe2')][_0x7bf0('0x120')](db['User'],{'as':_0x7bf0('0x163'),'through':_0x7bf0('0x13c')});db[_0x7bf0('0xe7')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':'Agents','through':'user_has_teams'});db['Team'][_0x7bf0('0x120')](db['VoiceQueue'],{'through':_0x7bf0('0x1c1'),'as':'VoiceQueues'});db[_0x7bf0('0xe7')][_0x7bf0('0x120')](db['MailQueue'],{'through':_0x7bf0('0x15c'),'as':_0x7bf0('0x12b')});db['Team'][_0x7bf0('0x120')](db[_0x7bf0('0x70')],{'through':_0x7bf0('0x1c2'),'as':_0x7bf0('0x12c')});db[_0x7bf0('0xe7')]['belongsToMany'](db[_0x7bf0('0x55')],{'through':'team_has_fax_queues','as':_0x7bf0('0x12d')});db[_0x7bf0('0xe7')][_0x7bf0('0x120')](db[_0x7bf0('0x5d')],{'through':_0x7bf0('0x179'),'as':_0x7bf0('0x12e')});db['Team'][_0x7bf0('0x120')](db[_0x7bf0('0x66')],{'through':_0x7bf0('0x180'),'as':_0x7bf0('0x1c3')});db[_0x7bf0('0xe7')][_0x7bf0('0x120')](db['WhatsappQueue'],{'through':_0x7bf0('0x1c4'),'as':_0x7bf0('0x12f')});db[_0x7bf0('0xeb')][_0x7bf0('0x111')](db[_0x7bf0('0x77')],{'as':_0x7bf0('0x143'),'foreignKey':_0x7bf0('0x190')});db[_0x7bf0('0xeb')][_0x7bf0('0x111')](db[_0x7bf0('0x7a')],{'as':_0x7bf0('0x114'),'foreignKey':_0x7bf0('0x190')});db[_0x7bf0('0xeb')][_0x7bf0('0x111')](db[_0x7bf0('0x7c')],{'as':_0x7bf0('0x144'),'foreignKey':_0x7bf0('0x190')});db['Campaign'][_0x7bf0('0x111')](db[_0x7bf0('0x79')],{'as':_0x7bf0('0x1c5'),'foreignKey':_0x7bf0('0x190')});db[_0x7bf0('0xeb')]['belongsTo'](db['Trunk'],{'as':_0x7bf0('0x2e'),'foreignKey':'TrunkId'});db['Campaign'][_0x7bf0('0x11e')](db[_0x7bf0('0x2e')],{'as':'TrunkBackup','foreignKey':_0x7bf0('0x148')});db[_0x7bf0('0xeb')][_0x7bf0('0x11e')](db[_0x7bf0('0x88')],{'as':_0x7bf0('0x88'),'foreignKey':_0x7bf0('0x149')});db['Campaign'][_0x7bf0('0x11e')](db[_0x7bf0('0xe2')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x7bf0('0xeb')][_0x7bf0('0x120')](db[_0x7bf0('0xfa')],{'as':'Lists','through':_0x7bf0('0x1c6')});db['Campaign'][_0x7bf0('0x120')](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x1c7'),'through':_0x7bf0('0x1c8')});db[_0x7bf0('0x1c9')][_0x7bf0('0x11e')](db[_0x7bf0('0x47')],{});db[_0x7bf0('0x1c9')][_0x7bf0('0x11e')](db[_0x7bf0('0x45')],{});db[_0x7bf0('0x1c9')]['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x7bf0('0x1ca')});db[_0x7bf0('0x1c9')][_0x7bf0('0x11e')](db['User'],{'foreignKey':_0x7bf0('0x1cb'),'as':_0x7bf0('0x1cc')});db[_0x7bf0('0x1c9')]['belongsTo'](db[_0x7bf0('0x13')],{'foreignKey':'ToUserId','as':_0x7bf0('0x1cd')});db[_0x7bf0('0x1c9')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x7bf0('0x1ce'),'as':_0x7bf0('0x1cf')});db[_0x7bf0('0x1c9')][_0x7bf0('0x11e')](db[_0x7bf0('0x41')],{'foreignKey':_0x7bf0('0x1d0'),'as':_0x7bf0('0x1d1')});db[_0x7bf0('0x1d2')][_0x7bf0('0x11e')](db[_0x7bf0('0x6d')],{});db[_0x7bf0('0x1d2')][_0x7bf0('0x11e')](db[_0x7bf0('0x6c')],{});db[_0x7bf0('0x1d2')][_0x7bf0('0x11e')](db[_0x7bf0('0x181')],{'foreignKey':_0x7bf0('0x1d3'),'as':_0x7bf0('0x1ca')});db[_0x7bf0('0x1d2')]['belongsTo'](db[_0x7bf0('0x13')],{'foreignKey':'FromUserId','as':_0x7bf0('0x1cc')});db[_0x7bf0('0x1d2')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'foreignKey':'ToUserId','as':_0x7bf0('0x1cd')});db[_0x7bf0('0x1d2')][_0x7bf0('0x11e')](db[_0x7bf0('0x70')],{'foreignKey':_0x7bf0('0x1d4'),'as':_0x7bf0('0x1cf')});db['ChatTransferReport'][_0x7bf0('0x11e')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x7bf0('0x1d1')});db[_0x7bf0('0xf4')]['belongsTo'](db[_0x7bf0('0x53')],{});db[_0x7bf0('0xf4')][_0x7bf0('0x11e')](db['FaxInteraction'],{});db[_0x7bf0('0xf4')]['belongsTo'](db[_0x7bf0('0x4f')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x7bf0('0xf4')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'foreignKey':'FromUserId','as':_0x7bf0('0x1cc')});db[_0x7bf0('0xf4')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x7bf0('0xf4')][_0x7bf0('0x11e')](db[_0x7bf0('0x55')],{'foreignKey':'ToFaxQueueId','as':_0x7bf0('0x1cf')});db[_0x7bf0('0xf4')][_0x7bf0('0x11e')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0x7bf0('0x1d1')});db[_0x7bf0('0xf6')][_0x7bf0('0x11e')](db[_0x7bf0('0x64')],{});db[_0x7bf0('0xf6')][_0x7bf0('0x11e')](db[_0x7bf0('0x62')],{});db[_0x7bf0('0xf6')][_0x7bf0('0x11e')](db[_0x7bf0('0x5f')],{'foreignKey':_0x7bf0('0x1d5'),'as':'FromAccount'});db[_0x7bf0('0xf6')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'foreignKey':_0x7bf0('0x1cb'),'as':_0x7bf0('0x1cc')});db[_0x7bf0('0xf6')]['belongsTo'](db[_0x7bf0('0x13')],{'foreignKey':_0x7bf0('0x1d6'),'as':_0x7bf0('0x1cd')});db['OpenchannelTransferReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x66')],{'foreignKey':_0x7bf0('0x1d7'),'as':_0x7bf0('0x1cf')});db[_0x7bf0('0xf6')][_0x7bf0('0x11e')](db[_0x7bf0('0x5f')],{'foreignKey':_0x7bf0('0x1d8'),'as':_0x7bf0('0x1d1')});db[_0x7bf0('0xf8')]['belongsTo'](db[_0x7bf0('0x5b')],{});db[_0x7bf0('0xf8')][_0x7bf0('0x11e')](db[_0x7bf0('0x59')],{});db['SmsTransferReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x137')],{'foreignKey':_0x7bf0('0x1d9'),'as':'FromAccount'});db['SmsTransferReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'foreignKey':_0x7bf0('0x1cb'),'as':_0x7bf0('0x1cc')});db[_0x7bf0('0xf8')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'foreignKey':_0x7bf0('0x1d6'),'as':_0x7bf0('0x1cd')});db[_0x7bf0('0xf8')]['belongsTo'](db[_0x7bf0('0x5d')],{'foreignKey':_0x7bf0('0x1da'),'as':_0x7bf0('0x1cf')});db[_0x7bf0('0xf8')][_0x7bf0('0x11e')](db['SmsAccount'],{'foreignKey':_0x7bf0('0x1db'),'as':_0x7bf0('0x1d1')});db[_0x7bf0('0xfa')]['hasMany'](db[_0x7bf0('0x85')],{'as':_0x7bf0('0x156'),'foreignKey':'ListId'});db[_0x7bf0('0xfa')][_0x7bf0('0x111')](db[_0x7bf0('0x1dc')],{'as':_0x7bf0('0x1dd'),'foreignKey':_0x7bf0('0x159')});db['CmList']['hasMany'](db['CmContact'],{'as':_0x7bf0('0x18b'),'onDelete':_0x7bf0('0x10e'),'foreignKey':_0x7bf0('0x159')});db['CmList']['hasMany'](db[_0x7bf0('0x7a')],{'as':_0x7bf0('0x114'),'foreignKey':'ListId'});db[_0x7bf0('0xfa')][_0x7bf0('0x111')](db[_0x7bf0('0x7c')],{'as':_0x7bf0('0x115'),'foreignKey':_0x7bf0('0x159')});db[_0x7bf0('0xfa')][_0x7bf0('0x111')](db['ReportAgentPreview'],{'as':_0x7bf0('0x116'),'foreignKey':'ListId'});db[_0x7bf0('0xfa')][_0x7bf0('0x120')](db['VoiceQueue'],{'as':_0x7bf0('0x1de'),'through':_0x7bf0('0x1df')});db[_0x7bf0('0xfa')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x14b'),'through':'cm_user_has_lists'});db[_0x7bf0('0xfb')][_0x7bf0('0x111')](db[_0x7bf0('0x19')],{'as':_0x7bf0('0x113'),'onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0xfb')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':'Agents','through':_0x7bf0('0x131')});db['UserProfile'][_0x7bf0('0x111')](db['User'],{'as':'Users','foreignKey':_0x7bf0('0x1e0')});db['UserProfile']['hasMany'](db[_0x7bf0('0xfd')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x7bf0('0x10e')});db[_0x7bf0('0xfd')][_0x7bf0('0x111')](db[_0x7bf0('0x1e1')],{'as':_0x7bf0('0x1e2'),'foreignKey':_0x7bf0('0x1e3'),'onDelete':'cascade'});db[_0x7bf0('0x13a')][_0x7bf0('0x111')](db[_0x7bf0('0x85')],{'as':_0x7bf0('0x156'),'foreignKey':_0x7bf0('0x1e4')});db[_0x7bf0('0x13a')][_0x7bf0('0x111')](db[_0x7bf0('0x16c')],{'as':_0x7bf0('0x157'),'foreignKey':_0x7bf0('0x1e4')});db[_0x7bf0('0x13a')][_0x7bf0('0x111')](db[_0x7bf0('0x104')],{'as':'Messages','foreignKey':_0x7bf0('0x1e4')});db[_0x7bf0('0x13a')][_0x7bf0('0x111')](db[_0x7bf0('0x102')],{'as':'Interactions'});db['WhatsappAccount'][_0x7bf0('0x111')](db[_0x7bf0('0x1e5')],{'as':_0x7bf0('0x13e')});db[_0x7bf0('0x13a')]['belongsTo'](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x169'),'foreignKey':'ListId'});db[_0x7bf0('0x13a')][_0x7bf0('0x11e')](db[_0x7bf0('0x8a')],{'as':_0x7bf0('0x14a'),'foreignKey':_0x7bf0('0x16e')});db[_0x7bf0('0x13a')]['belongsToMany'](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x14b'),'through':_0x7bf0('0x1e6')});db['WhatsappApplication'][_0x7bf0('0x11e')](db['User'],{'onDelete':_0x7bf0('0x167')});db['WhatsappApplication']['belongsTo'](db[_0x7bf0('0x109')],{'onDelete':_0x7bf0('0x167')});db[_0x7bf0('0x1e5')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x7bf0('0x167')});db['WhatsappApplication'][_0x7bf0('0x11e')](db['Interval'],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x149')});db[_0x7bf0('0x1e5')][_0x7bf0('0x11e')](db[_0x7bf0('0x92')],{'onDelete':_0x7bf0('0x167'),'foreignKey':_0x7bf0('0x168')});db[_0x7bf0('0x102')][_0x7bf0('0x111')](db['WhatsappMessage'],{'as':_0x7bf0('0x14d'),'onDelete':_0x7bf0('0x10e'),'foreignKey':'WhatsappInteractionId'});db[_0x7bf0('0x102')][_0x7bf0('0x11e')](db[_0x7bf0('0x13a')],{'as':'Account','foreignKey':_0x7bf0('0x1e4')});db[_0x7bf0('0x102')][_0x7bf0('0x11e')](db['CmContact'],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x102')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x15f'),'foreignKey':_0x7bf0('0x110')});db['WhatsappInteraction'][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x19f'),'as':_0x7bf0('0x160')});db[_0x7bf0('0x102')][_0x7bf0('0x120')](db[_0x7bf0('0x92')],{'through':_0x7bf0('0x19f'),'as':_0x7bf0('0x162')});db[_0x7bf0('0x102')][_0x7bf0('0x120')](db[_0x7bf0('0x13')],{'as':_0x7bf0('0x163'),'through':_0x7bf0('0x1e7'),'foreignKey':_0x7bf0('0x1e8')});db['WhatsappMessage'][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'as':'User'});db[_0x7bf0('0x104')][_0x7bf0('0x11e')](db[_0x7bf0('0x76')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x151')});db[_0x7bf0('0x104')][_0x7bf0('0x11e')](db[_0x7bf0('0x102')],{'onDelete':_0x7bf0('0x10e'),'as':_0x7bf0('0x166'),'foreignKey':'WhatsappInteractionId'});db[_0x7bf0('0x104')][_0x7bf0('0x11e')](db[_0x7bf0('0x13a')],{'as':_0x7bf0('0x15e'),'foreignKey':_0x7bf0('0x1e4')});db[_0x7bf0('0x106')][_0x7bf0('0x11e')](db[_0x7bf0('0x13a')],{});db[_0x7bf0('0x106')]['belongsTo'](db[_0x7bf0('0xfa')],{'as':_0x7bf0('0x169'),'foreignKey':_0x7bf0('0x159')});db[_0x7bf0('0x106')]['belongsTo'](db[_0x7bf0('0x76')],{'as':_0x7bf0('0x151'),'foreignKey':_0x7bf0('0x152')});db[_0x7bf0('0x106')][_0x7bf0('0x11e')](db[_0x7bf0('0x102')],{});db[_0x7bf0('0x106')]['belongsTo'](db['WhatsappQueue'],{});db[_0x7bf0('0x106')][_0x7bf0('0x11e')](db[_0x7bf0('0x104')],{});db[_0x7bf0('0x106')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{});db[_0x7bf0('0x108')][_0x7bf0('0x11e')](db[_0x7bf0('0x104')],{});db[_0x7bf0('0x108')]['belongsTo'](db[_0x7bf0('0x102')],{});db[_0x7bf0('0x108')][_0x7bf0('0x11e')](db['WhatsappAccount'],{'foreignKey':_0x7bf0('0x1e9'),'as':_0x7bf0('0x1ca')});db[_0x7bf0('0x108')][_0x7bf0('0x11e')](db[_0x7bf0('0x13a')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db['WhatsappTransferReport'][_0x7bf0('0x11e')](db[_0x7bf0('0x109')],{'foreignKey':_0x7bf0('0x1ea'),'as':_0x7bf0('0x1cf')});db[_0x7bf0('0x108')][_0x7bf0('0x11e')](db['User'],{'foreignKey':_0x7bf0('0x1cb'),'as':_0x7bf0('0x1cc')});db[_0x7bf0('0x108')][_0x7bf0('0x11e')](db[_0x7bf0('0x13')],{'foreignKey':'ToUserId','as':_0x7bf0('0x1cd')});db[_0x7bf0('0x109')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x7bf0('0x3c'),'foreignKey':_0x7bf0('0x1eb')});db[_0x7bf0('0x109')][_0x7bf0('0x120')](db['Team'],{'through':_0x7bf0('0x1c4'),'as':_0x7bf0('0x17a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 194d8cf..3b3c604 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9eb0=['./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./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/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','1.0.16','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','express','express-winston','util','./errors','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','role','agent_id','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/configurations'];(function(_0x2d5938,_0x200e7d){var _0x5d0814=function(_0x44cbe8){while(--_0x44cbe8){_0x2d5938['push'](_0x2d5938['shift']());}};_0x5d0814(++_0x200e7d);}(_0x9eb0,0x1a9));var _0x09eb=function(_0x134bf8,_0x26b3a3){_0x134bf8=_0x134bf8-0x0;var _0x504b1f=_0x9eb0[_0x134bf8];return _0x504b1f;};'use strict';var path=require('path');var express=require(_0x09eb('0x0'));var ewinston=require(_0x09eb('0x1'));var util=require(_0x09eb('0x2'));var errors=require(_0x09eb('0x3'));var config=require('./config/environment');var logger=require(_0x09eb('0x4'))('api');var authLogger=require(_0x09eb('0x4'))(_0x09eb('0x5'));exports[_0x09eb('0x6')]=function(_0x243373){_0x243373[_0x09eb('0x7')](ewinston[_0x09eb('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4e6c77,_0x1bb0f8){return util[_0x09eb('0x9')](_0x09eb('0xa'),_0x4e6c77[_0x09eb('0xb')],_0x4e6c77[_0x09eb('0xc')][_0x09eb('0xd')]?_0x4e6c77[_0x09eb('0xc')][_0x09eb('0xd')]:_0x4e6c77[_0x09eb('0xe')][_0x09eb('0xf')]||_0x4e6c77['ip'],_0x4e6c77[_0x09eb('0x10')],_0x1bb0f8['statusCode'],_0x1bb0f8[_0x09eb('0x11')],_0x4e6c77[_0x09eb('0x12')]?_0x4e6c77[_0x09eb('0x12')]['id']:null,_0x4e6c77[_0x09eb('0x12')]?_0x4e6c77[_0x09eb('0x12')][_0x09eb('0x13')]:null,_0x4e6c77[_0x09eb('0x12')]?_0x4e6c77['user']['role']:null);}}));_0x243373[_0x09eb('0x7')](ewinston[_0x09eb('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xbd1ec4,_0x2e6384){var _0x2b1334=_0x09eb('0x14');if(_0xbd1ec4['body']&&_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x16')]&&_0xbd1ec4[_0x09eb('0x15')]['agent_id']){_0x2b1334=_0x09eb('0x17');}return util[_0x09eb('0x9')](_0x2b1334,_0xbd1ec4['method'],_0xbd1ec4[_0x09eb('0xc')][_0x09eb('0xd')]?_0xbd1ec4['headers'][_0x09eb('0xd')]:_0xbd1ec4['connection'][_0x09eb('0xf')]||_0xbd1ec4['ip'],_0xbd1ec4[_0x09eb('0x10')],_0x2e6384['statusCode'],_0x2e6384[_0x09eb('0x11')],_0xbd1ec4['user']?_0xbd1ec4[_0x09eb('0x12')]['id']:null,_0xbd1ec4[_0x09eb('0x12')]?_0xbd1ec4[_0x09eb('0x12')][_0x09eb('0x13')]:null,_0xbd1ec4['user']?_0xbd1ec4[_0x09eb('0x12')][_0x09eb('0x18')]:null,_0xbd1ec4[_0x09eb('0x15')]&&_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x16')]?_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x16')]:'other',_0xbd1ec4[_0x09eb('0x15')]&&_0xbd1ec4[_0x09eb('0x15')]['agent_id']?_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x19')]:'',_0xbd1ec4[_0x09eb('0x15')]&&_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x1a')]?_0xbd1ec4[_0x09eb('0x15')][_0x09eb('0x1a')]:'');},'ignoreRoute':function(_0x13c8c){var _0x20bcf9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x20bcf9[_0x09eb('0x1b')](_0x13c8c['url']);}}));_0x243373[_0x09eb('0x7')]('/api/users',require(_0x09eb('0x1c')));_0x243373['use'](_0x09eb('0x1d'),require(_0x09eb('0x1e')));_0x243373['use'](_0x09eb('0x1f'),require(_0x09eb('0x20')));_0x243373[_0x09eb('0x7')](_0x09eb('0x21'),require(_0x09eb('0x22')));_0x243373[_0x09eb('0x7')]('/api/voice/mohs',require(_0x09eb('0x23')));_0x243373[_0x09eb('0x7')](_0x09eb('0x24'),require(_0x09eb('0x25')));_0x243373['use'](_0x09eb('0x26'),require(_0x09eb('0x27')));_0x243373[_0x09eb('0x7')](_0x09eb('0x28'),require(_0x09eb('0x29')));_0x243373[_0x09eb('0x7')]('/api/voice/mails',require(_0x09eb('0x2a')));_0x243373[_0x09eb('0x7')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x243373['use'](_0x09eb('0x2b'),require(_0x09eb('0x2c')));_0x243373['use'](_0x09eb('0x2d'),require(_0x09eb('0x2e')));_0x243373[_0x09eb('0x7')](_0x09eb('0x2f'),require(_0x09eb('0x30')));_0x243373[_0x09eb('0x7')](_0x09eb('0x31'),require(_0x09eb('0x32')));_0x243373['use']('/api/members/reports',require('./api/memberReport'));_0x243373['use'](_0x09eb('0x33'),require(_0x09eb('0x34')));_0x243373[_0x09eb('0x7')]('/api/voice/transfers/reports',require(_0x09eb('0x35')));_0x243373[_0x09eb('0x7')]('/api/mail/out_servers',require(_0x09eb('0x36')));_0x243373[_0x09eb('0x7')](_0x09eb('0x37'),require(_0x09eb('0x38')));_0x243373[_0x09eb('0x7')]('/api/mail/queues',require(_0x09eb('0x39')));_0x243373[_0x09eb('0x7')](_0x09eb('0x3a'),require(_0x09eb('0x3b')));_0x243373[_0x09eb('0x7')](_0x09eb('0x3c'),require(_0x09eb('0x3d')));_0x243373[_0x09eb('0x7')](_0x09eb('0x3e'),require('./api/mailMessage'));_0x243373[_0x09eb('0x7')](_0x09eb('0x3f'),require('./api/mailApplication'));_0x243373[_0x09eb('0x7')](_0x09eb('0x40'),require('./api/mailQueueReport'));_0x243373['use']('/api/dashboards',require('./api/dashboard'));_0x243373['use'](_0x09eb('0x41'),require(_0x09eb('0x42')));_0x243373['use'](_0x09eb('0x43'),require(_0x09eb('0x44')));_0x243373['use'](_0x09eb('0x45'),require(_0x09eb('0x46')));_0x243373[_0x09eb('0x7')](_0x09eb('0x47'),require(_0x09eb('0x48')));_0x243373[_0x09eb('0x7')](_0x09eb('0x49'),require(_0x09eb('0x4a')));_0x243373[_0x09eb('0x7')](_0x09eb('0x4b'),require(_0x09eb('0x4c')));_0x243373[_0x09eb('0x7')](_0x09eb('0x4d'),require('./api/faxQueueReport'));_0x243373[_0x09eb('0x7')](_0x09eb('0x4e'),require(_0x09eb('0x4f')));_0x243373[_0x09eb('0x7')]('/api/sms/applications',require(_0x09eb('0x50')));_0x243373['use'](_0x09eb('0x51'),require(_0x09eb('0x52')));_0x243373[_0x09eb('0x7')](_0x09eb('0x53'),require('./api/smsMessage'));_0x243373[_0x09eb('0x7')]('/api/sms/queues',require(_0x09eb('0x54')));_0x243373[_0x09eb('0x7')](_0x09eb('0x55'),require(_0x09eb('0x56')));_0x243373['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x243373[_0x09eb('0x7')](_0x09eb('0x57'),require(_0x09eb('0x58')));_0x243373['use'](_0x09eb('0x59'),require('./api/openchannelMessage'));_0x243373[_0x09eb('0x7')](_0x09eb('0x5a'),require('./api/openchannelQueue'));_0x243373[_0x09eb('0x7')]('/api/chat/websites',require(_0x09eb('0x5b')));_0x243373[_0x09eb('0x7')](_0x09eb('0x5c'),require(_0x09eb('0x5d')));_0x243373['use'](_0x09eb('0x5e'),require(_0x09eb('0x5f')));_0x243373[_0x09eb('0x7')]('/api/chat/interactions',require(_0x09eb('0x60')));_0x243373[_0x09eb('0x7')](_0x09eb('0x61'),require('./api/chatMessage'));_0x243373[_0x09eb('0x7')]('/api/chat/offline_messages',require(_0x09eb('0x62')));_0x243373[_0x09eb('0x7')](_0x09eb('0x63'),require(_0x09eb('0x64')));_0x243373[_0x09eb('0x7')]('/api/chat/groups',require(_0x09eb('0x65')));_0x243373[_0x09eb('0x7')](_0x09eb('0x66'),require(_0x09eb('0x67')));_0x243373[_0x09eb('0x7')](_0x09eb('0x68'),require(_0x09eb('0x69')));_0x243373[_0x09eb('0x7')](_0x09eb('0x6a'),require(_0x09eb('0x6b')));_0x243373[_0x09eb('0x7')]('/api/cm/hopper',require(_0x09eb('0x6c')));_0x243373[_0x09eb('0x7')](_0x09eb('0x6d'),require(_0x09eb('0x6e')));_0x243373['use'](_0x09eb('0x6f'),require('./api/cmHopperFinal'));_0x243373[_0x09eb('0x7')](_0x09eb('0x70'),require('./api/cmHopperHistory'));_0x243373['use'](_0x09eb('0x71'),require(_0x09eb('0x72')));_0x243373[_0x09eb('0x7')]('/api/actions',require(_0x09eb('0x73')));_0x243373[_0x09eb('0x7')](_0x09eb('0x74'),require(_0x09eb('0x75')));_0x243373[_0x09eb('0x7')](_0x09eb('0x76'),require(_0x09eb('0x77')));_0x243373['use'](_0x09eb('0x78'),require('./api/disposition'));_0x243373[_0x09eb('0x7')](_0x09eb('0x79'),require(_0x09eb('0x7a')));_0x243373[_0x09eb('0x7')](_0x09eb('0x7b'),require(_0x09eb('0x7c')));_0x243373[_0x09eb('0x7')](_0x09eb('0x7d'),require('./api/pause'));_0x243373[_0x09eb('0x7')](_0x09eb('0x7e'),require(_0x09eb('0x7f')));_0x243373['use'](_0x09eb('0x80'),require(_0x09eb('0x81')));_0x243373['use'](_0x09eb('0x82'),require(_0x09eb('0x83')));_0x243373[_0x09eb('0x7')](_0x09eb('0x84'),require(_0x09eb('0x85')));_0x243373[_0x09eb('0x7')]('/api/tags',require(_0x09eb('0x86')));_0x243373[_0x09eb('0x7')]('/api/templates',require(_0x09eb('0x87')));_0x243373['use'](_0x09eb('0x88'),require(_0x09eb('0x89')));_0x243373[_0x09eb('0x7')](_0x09eb('0x8a'),require('./api/variable'));_0x243373[_0x09eb('0x7')]('/api/integrations',require(_0x09eb('0x8b')));_0x243373[_0x09eb('0x7')](_0x09eb('0x8c'),require(_0x09eb('0x8d')));_0x243373['use']('/api/analytics/custom_reports',require(_0x09eb('0x8e')));_0x243373[_0x09eb('0x7')](_0x09eb('0x8f'),require(_0x09eb('0x90')));_0x243373[_0x09eb('0x7')](_0x09eb('0x91'),require(_0x09eb('0x92')));_0x243373[_0x09eb('0x7')](_0x09eb('0x93'),require(_0x09eb('0x94')));_0x243373[_0x09eb('0x7')](_0x09eb('0x95'),require(_0x09eb('0x96')));_0x243373[_0x09eb('0x7')](_0x09eb('0x97'),require(_0x09eb('0x98')));_0x243373['use'](_0x09eb('0x99'),require(_0x09eb('0x9a')));_0x243373[_0x09eb('0x7')](_0x09eb('0x9b'),require(_0x09eb('0x9c')));_0x243373[_0x09eb('0x7')](_0x09eb('0x9d'),require(_0x09eb('0x9e')));_0x243373[_0x09eb('0x7')](_0x09eb('0x9f'),require(_0x09eb('0xa0')));_0x243373[_0x09eb('0x7')](_0x09eb('0xa1'),require(_0x09eb('0xa2')));_0x243373['use'](_0x09eb('0xa3'),require('./api/intSugarcrmField'));_0x243373[_0x09eb('0x7')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x243373[_0x09eb('0x7')](_0x09eb('0xa4'),require(_0x09eb('0xa5')));_0x243373[_0x09eb('0x7')](_0x09eb('0xa6'),require('./api/intDeskField'));_0x243373['use'](_0x09eb('0xa7'),require(_0x09eb('0xa8')));_0x243373[_0x09eb('0x7')](_0x09eb('0xa9'),require(_0x09eb('0xaa')));_0x243373[_0x09eb('0x7')](_0x09eb('0xab'),require(_0x09eb('0xac')));_0x243373[_0x09eb('0x7')](_0x09eb('0xad'),require(_0x09eb('0xae')));_0x243373[_0x09eb('0x7')](_0x09eb('0xaf'),require(_0x09eb('0xb0')));_0x243373[_0x09eb('0x7')](_0x09eb('0xb1'),require(_0x09eb('0xb2')));_0x243373[_0x09eb('0x7')](_0x09eb('0xb3'),require('./api/intFreshdeskAccount'));_0x243373['use'](_0x09eb('0xb4'),require('./api/intFreshdeskConfiguration'));_0x243373[_0x09eb('0x7')](_0x09eb('0xb5'),require('./api/intFreshdeskField'));_0x243373[_0x09eb('0x7')](_0x09eb('0xb6'),require('./api/intVtigerAccount'));_0x243373[_0x09eb('0x7')]('/api/integrations/vtiger/configurations',require(_0x09eb('0xb7')));_0x243373[_0x09eb('0x7')](_0x09eb('0xb8'),require(_0x09eb('0xb9')));_0x243373['use'](_0x09eb('0xba'),require('./api/intServicenowAccount'));_0x243373[_0x09eb('0x7')](_0x09eb('0xbb'),require(_0x09eb('0xbc')));_0x243373['use'](_0x09eb('0xbd'),require(_0x09eb('0xbe')));_0x243373[_0x09eb('0x7')](_0x09eb('0xbf'),require(_0x09eb('0xc0')));_0x243373['use']('/api/integrations/dynamics365/configurations',require(_0x09eb('0xc1')));_0x243373[_0x09eb('0x7')](_0x09eb('0xc2'),require(_0x09eb('0xc3')));_0x243373[_0x09eb('0x7')](_0x09eb('0xc4'),require(_0x09eb('0xc5')));_0x243373[_0x09eb('0x7')](_0x09eb('0xc6'),require(_0x09eb('0xc7')));_0x243373[_0x09eb('0x7')]('/api/integrations/freshsales/fields',require(_0x09eb('0xc8')));_0x243373[_0x09eb('0x7')](_0x09eb('0xc9'),require(_0x09eb('0xca')));_0x243373[_0x09eb('0x7')](_0x09eb('0xcb'),require(_0x09eb('0xcc')));_0x243373[_0x09eb('0x7')](_0x09eb('0xcd'),require(_0x09eb('0xce')));_0x243373[_0x09eb('0x7')](_0x09eb('0xcf'),require('./api/jscriptyAnswerReport'));_0x243373['use'](_0x09eb('0xd0'),require(_0x09eb('0xd1')));_0x243373[_0x09eb('0x7')](_0x09eb('0xd2'),require('./api/jscriptySessionReport'));_0x243373[_0x09eb('0x7')](_0x09eb('0xd3'),require(_0x09eb('0xd4')));_0x243373[_0x09eb('0x7')](_0x09eb('0xd5'),require('./api/squareReport'));_0x243373['use'](_0x09eb('0xd6'),require(_0x09eb('0xd7')));_0x243373[_0x09eb('0x7')](_0x09eb('0xd8'),require(_0x09eb('0xd9')));_0x243373['use']('/api/settings',require(_0x09eb('0xda')));_0x243373[_0x09eb('0x7')]('/api/square/odbc',require('./api/squareOdbc'));_0x243373[_0x09eb('0x7')](_0x09eb('0xdb'),require(_0x09eb('0xdc')));_0x243373['use'](_0x09eb('0xdd'),require(_0x09eb('0xde')));_0x243373[_0x09eb('0x7')](_0x09eb('0xdf'),require(_0x09eb('0xe0')));_0x243373[_0x09eb('0x7')](_0x09eb('0xe1'),require(_0x09eb('0xe2')));_0x243373['use']('/api/license',require(_0x09eb('0xe3')));_0x243373['use']('/api/campaigns',require(_0x09eb('0xe4')));_0x243373[_0x09eb('0x7')](_0x09eb('0xe5'),require(_0x09eb('0xe6')));_0x243373['use'](_0x09eb('0xe7'),require(_0x09eb('0xe8')));_0x243373[_0x09eb('0x7')](_0x09eb('0xe9'),require(_0x09eb('0xea')));_0x243373[_0x09eb('0x7')](_0x09eb('0xeb'),require(_0x09eb('0xec')));_0x243373[_0x09eb('0x7')]('/api/chat/reports/transfer',require(_0x09eb('0xed')));_0x243373[_0x09eb('0x7')](_0x09eb('0xee'),require(_0x09eb('0xef')));_0x243373['use'](_0x09eb('0xf0'),require(_0x09eb('0xf1')));_0x243373[_0x09eb('0x7')](_0x09eb('0xf2'),require(_0x09eb('0xf3')));_0x243373[_0x09eb('0x7')]('/api/cm/lists',require(_0x09eb('0xf4')));_0x243373['use'](_0x09eb('0xf5'),require(_0x09eb('0xf6')));_0x243373['use'](_0x09eb('0xf7'),require(_0x09eb('0xf8')));_0x243373[_0x09eb('0x7')](_0x09eb('0xf9'),require('./api/userProfileSection'));_0x243373[_0x09eb('0x7')](_0x09eb('0xfa'),require(_0x09eb('0xfb')));_0x243373[_0x09eb('0x7')](_0x09eb('0xfc'),require(_0x09eb('0xfd')));_0x243373[_0x09eb('0x7')](_0x09eb('0xfe'),require(_0x09eb('0xff')));_0x243373[_0x09eb('0x7')]('/api/whatsapp/applications',require(_0x09eb('0x100')));_0x243373[_0x09eb('0x7')](_0x09eb('0x101'),require(_0x09eb('0x102')));_0x243373[_0x09eb('0x7')](_0x09eb('0x103'),require(_0x09eb('0x104')));_0x243373[_0x09eb('0x7')](_0x09eb('0x105'),require(_0x09eb('0x106')));_0x243373[_0x09eb('0x7')]('/api/whatsapp/reports/transfer',require(_0x09eb('0x107')));_0x243373[_0x09eb('0x7')](_0x09eb('0x108'),require(_0x09eb('0x109')));_0x243373[_0x09eb('0x7')](_0x09eb('0x10a'),require(_0x09eb('0x10b')));_0x243373[_0x09eb('0x7')](_0x09eb('0x10c'),require(_0x09eb('0x10d')));_0x243373[_0x09eb('0x7')](_0x09eb('0x10e'),require('./api/authGoogle'));_0x243373[_0x09eb('0x7')](_0x09eb('0x10f'),require(_0x09eb('0x110')));_0x243373[_0x09eb('0x7')](_0x09eb('0x111'),require('./api/rpc'));_0x243373[_0x09eb('0x7')](_0x09eb('0x112'),require(_0x09eb('0x113')));_0x243373['use'](_0x09eb('0x114'),require(_0x09eb('0x115')));_0x243373[_0x09eb('0x7')](_0x09eb('0x116'),require('./api/pm2'));_0x243373[_0x09eb('0x7')]('/api/webbar',require(_0x09eb('0x117')));_0x243373['use']('/apidoc',express[_0x09eb('0x118')](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],_0x09eb('0x11b'))));_0x243373[_0x09eb('0x7')](_0x09eb('0x11c'),express[_0x09eb('0x118')](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],'/www')));_0x243373[_0x09eb('0x7')](_0x09eb('0x11d'),express['static'](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],_0x09eb('0x11d'))));_0x243373['use'](_0x09eb('0x11e'),express[_0x09eb('0x118')](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],'snippet',_0x09eb('0x11f'))));_0x243373[_0x09eb('0x7')]('/plugins',express['static'](path[_0x09eb('0x119')](config[_0x09eb('0x11a')],'/server/files/plugins')));_0x243373['route'](_0x09eb('0x120'))[_0x09eb('0x121')](errors[0x194]);_0x243373[_0x09eb('0x122')]('/*')[_0x09eb('0x121')](function(_0x58abac,_0x37b3a0){_0x37b3a0[_0x09eb('0x123')](path[_0x09eb('0x124')](_0x243373['get'](_0x09eb('0x125'))+_0x09eb('0x126')));});}; \ No newline at end of file +var _0x689f=['/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','/api/notifications','./api/notification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','root','/www','/demo','join','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','resolve','get','/index.html','express-winston','util','./errors','./config/environment','api','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','connection','remoteAddress','statusCode','responseTime','user','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','x-forwarded-for','name','other','agent_name','test','url','./api/user','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./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/voiceQueueReport','/api/members/reports','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./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/cm/hopper_black','./api/cmHopperFinal','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts'];(function(_0x287504,_0x3477ce){var _0x14cbb0=function(_0x4ceac0){while(--_0x4ceac0){_0x287504['push'](_0x287504['shift']());}};_0x14cbb0(++_0x3477ce);}(_0x689f,0x17c));var _0xf689=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x689f[_0x4653f7];return _0x5454da;};'use strict';var path=require('path');var express=require('express');var ewinston=require(_0xf689('0x0'));var util=require(_0xf689('0x1'));var errors=require(_0xf689('0x2'));var config=require(_0xf689('0x3'));var logger=require('./config/logger')(_0xf689('0x4'));var authLogger=require('./config/logger')(_0xf689('0x5'));exports[_0xf689('0x6')]=function(_0x3bf716){_0x3bf716[_0xf689('0x7')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xac2b70,_0x3e8347){return util['format'](_0xf689('0x8'),_0xac2b70[_0xf689('0x9')],_0xac2b70[_0xf689('0xa')]['x-forwarded-for']?_0xac2b70[_0xf689('0xa')]['x-forwarded-for']:_0xac2b70[_0xf689('0xb')][_0xf689('0xc')]||_0xac2b70['ip'],_0xac2b70['url'],_0x3e8347[_0xf689('0xd')],_0x3e8347[_0xf689('0xe')],_0xac2b70[_0xf689('0xf')]?_0xac2b70[_0xf689('0xf')]['id']:null,_0xac2b70[_0xf689('0xf')]?_0xac2b70[_0xf689('0xf')]['name']:null,_0xac2b70[_0xf689('0xf')]?_0xac2b70[_0xf689('0xf')][_0xf689('0x10')]:null);}}));_0x3bf716[_0xf689('0x7')](ewinston[_0xf689('0x11')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x21e39c,_0x584ebe){var _0xfe30f1=_0xf689('0x12');if(_0x21e39c[_0xf689('0x13')]&&_0x21e39c[_0xf689('0x13')][_0xf689('0x14')]&&_0x21e39c[_0xf689('0x13')][_0xf689('0x15')]){_0xfe30f1=_0xf689('0x16');}return util['format'](_0xfe30f1,_0x21e39c[_0xf689('0x9')],_0x21e39c[_0xf689('0xa')][_0xf689('0x17')]?_0x21e39c[_0xf689('0xa')][_0xf689('0x17')]:_0x21e39c[_0xf689('0xb')][_0xf689('0xc')]||_0x21e39c['ip'],_0x21e39c['url'],_0x584ebe[_0xf689('0xd')],_0x584ebe[_0xf689('0xe')],_0x21e39c[_0xf689('0xf')]?_0x21e39c[_0xf689('0xf')]['id']:null,_0x21e39c[_0xf689('0xf')]?_0x21e39c[_0xf689('0xf')][_0xf689('0x18')]:null,_0x21e39c[_0xf689('0xf')]?_0x21e39c[_0xf689('0xf')]['role']:null,_0x21e39c[_0xf689('0x13')]&&_0x21e39c[_0xf689('0x13')][_0xf689('0x14')]?_0x21e39c[_0xf689('0x13')][_0xf689('0x14')]:_0xf689('0x19'),_0x21e39c[_0xf689('0x13')]&&_0x21e39c[_0xf689('0x13')]['agent_id']?_0x21e39c[_0xf689('0x13')][_0xf689('0x15')]:'',_0x21e39c['body']&&_0x21e39c[_0xf689('0x13')][_0xf689('0x1a')]?_0x21e39c[_0xf689('0x13')][_0xf689('0x1a')]:'');},'ignoreRoute':function(_0x21cbe2){var _0x38a226=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x38a226[_0xf689('0x1b')](_0x21cbe2[_0xf689('0x1c')]);}}));_0x3bf716[_0xf689('0x7')]('/api/users',require(_0xf689('0x1d')));_0x3bf716[_0xf689('0x7')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x3bf716[_0xf689('0x7')](_0xf689('0x1e'),require(_0xf689('0x1f')));_0x3bf716['use']('/api/voice/extensions',require(_0xf689('0x20')));_0x3bf716[_0xf689('0x7')](_0xf689('0x21'),require(_0xf689('0x22')));_0x3bf716[_0xf689('0x7')]('/api/voice/queues',require(_0xf689('0x23')));_0x3bf716['use'](_0xf689('0x24'),require(_0xf689('0x25')));_0x3bf716[_0xf689('0x7')](_0xf689('0x26'),require(_0xf689('0x27')));_0x3bf716[_0xf689('0x7')](_0xf689('0x28'),require(_0xf689('0x29')));_0x3bf716[_0xf689('0x7')](_0xf689('0x2a'),require(_0xf689('0x2b')));_0x3bf716[_0xf689('0x7')]('/api/voice/calls/reports',require(_0xf689('0x2c')));_0x3bf716[_0xf689('0x7')](_0xf689('0x2d'),require(_0xf689('0x2e')));_0x3bf716['use'](_0xf689('0x2f'),require(_0xf689('0x30')));_0x3bf716[_0xf689('0x7')](_0xf689('0x31'),require(_0xf689('0x32')));_0x3bf716['use'](_0xf689('0x33'),require('./api/memberReport'));_0x3bf716[_0xf689('0x7')]('/api/trunks',require(_0xf689('0x34')));_0x3bf716[_0xf689('0x7')](_0xf689('0x35'),require(_0xf689('0x36')));_0x3bf716[_0xf689('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x3bf716[_0xf689('0x7')](_0xf689('0x37'),require(_0xf689('0x38')));_0x3bf716[_0xf689('0x7')](_0xf689('0x39'),require('./api/mailQueue'));_0x3bf716[_0xf689('0x7')]('/api/mail/substatuses',require(_0xf689('0x3a')));_0x3bf716['use'](_0xf689('0x3b'),require('./api/mailInteraction'));_0x3bf716['use']('/api/mail/messages',require(_0xf689('0x3c')));_0x3bf716['use'](_0xf689('0x3d'),require('./api/mailApplication'));_0x3bf716[_0xf689('0x7')](_0xf689('0x3e'),require(_0xf689('0x3f')));_0x3bf716[_0xf689('0x7')](_0xf689('0x40'),require(_0xf689('0x41')));_0x3bf716[_0xf689('0x7')]('/api/dashboards/items',require(_0xf689('0x42')));_0x3bf716[_0xf689('0x7')](_0xf689('0x43'),require('./api/faxAccount'));_0x3bf716['use'](_0xf689('0x44'),require(_0xf689('0x45')));_0x3bf716['use']('/api/fax/interactions',require(_0xf689('0x46')));_0x3bf716[_0xf689('0x7')](_0xf689('0x47'),require(_0xf689('0x48')));_0x3bf716[_0xf689('0x7')](_0xf689('0x49'),require('./api/faxQueue'));_0x3bf716[_0xf689('0x7')]('/api/fax/reports/queue',require(_0xf689('0x4a')));_0x3bf716[_0xf689('0x7')](_0xf689('0x4b'),require(_0xf689('0x4c')));_0x3bf716[_0xf689('0x7')]('/api/sms/applications',require(_0xf689('0x4d')));_0x3bf716[_0xf689('0x7')]('/api/sms/interactions',require(_0xf689('0x4e')));_0x3bf716[_0xf689('0x7')](_0xf689('0x4f'),require(_0xf689('0x50')));_0x3bf716['use'](_0xf689('0x51'),require('./api/smsQueue'));_0x3bf716['use'](_0xf689('0x52'),require(_0xf689('0x53')));_0x3bf716[_0xf689('0x7')]('/api/openchannel/applications',require(_0xf689('0x54')));_0x3bf716['use'](_0xf689('0x55'),require(_0xf689('0x56')));_0x3bf716[_0xf689('0x7')]('/api/openchannel/messages',require(_0xf689('0x57')));_0x3bf716[_0xf689('0x7')](_0xf689('0x58'),require('./api/openchannelQueue'));_0x3bf716[_0xf689('0x7')](_0xf689('0x59'),require(_0xf689('0x5a')));_0x3bf716[_0xf689('0x7')](_0xf689('0x5b'),require(_0xf689('0x5c')));_0x3bf716[_0xf689('0x7')]('/api/chat/applications',require(_0xf689('0x5d')));_0x3bf716[_0xf689('0x7')]('/api/chat/interactions',require('./api/chatInteraction'));_0x3bf716[_0xf689('0x7')](_0xf689('0x5e'),require(_0xf689('0x5f')));_0x3bf716[_0xf689('0x7')](_0xf689('0x60'),require(_0xf689('0x61')));_0x3bf716['use']('/api/chat/queues',require(_0xf689('0x62')));_0x3bf716[_0xf689('0x7')](_0xf689('0x63'),require(_0xf689('0x64')));_0x3bf716['use']('/api/chat/proactive_actions',require(_0xf689('0x65')));_0x3bf716[_0xf689('0x7')](_0xf689('0x66'),require(_0xf689('0x67')));_0x3bf716[_0xf689('0x7')](_0xf689('0x68'),require(_0xf689('0x69')));_0x3bf716[_0xf689('0x7')](_0xf689('0x6a'),require(_0xf689('0x6b')));_0x3bf716[_0xf689('0x7')](_0xf689('0x6c'),require('./api/cmHopperBlack'));_0x3bf716[_0xf689('0x7')]('/api/cm/hopper_final',require(_0xf689('0x6d')));_0x3bf716['use']('/api/cm/hopper_history',require(_0xf689('0x6e')));_0x3bf716['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x3bf716[_0xf689('0x7')](_0xf689('0x6f'),require(_0xf689('0x70')));_0x3bf716['use'](_0xf689('0x71'),require(_0xf689('0x72')));_0x3bf716[_0xf689('0x7')](_0xf689('0x73'),require('./api/cannedAnswer'));_0x3bf716[_0xf689('0x7')]('/api/dispositions',require('./api/disposition'));_0x3bf716['use'](_0xf689('0x74'),require('./api/condition'));_0x3bf716[_0xf689('0x7')](_0xf689('0x75'),require(_0xf689('0x76')));_0x3bf716[_0xf689('0x7')](_0xf689('0x77'),require('./api/pause'));_0x3bf716[_0xf689('0x7')]('/api/cdr',require(_0xf689('0x78')));_0x3bf716[_0xf689('0x7')](_0xf689('0x79'),require(_0xf689('0x7a')));_0x3bf716[_0xf689('0x7')](_0xf689('0x7b'),require(_0xf689('0x7c')));_0x3bf716[_0xf689('0x7')](_0xf689('0x7d'),require(_0xf689('0x7e')));_0x3bf716[_0xf689('0x7')](_0xf689('0x7f'),require(_0xf689('0x80')));_0x3bf716[_0xf689('0x7')](_0xf689('0x81'),require(_0xf689('0x82')));_0x3bf716[_0xf689('0x7')](_0xf689('0x83'),require(_0xf689('0x84')));_0x3bf716['use']('/api/variables',require('./api/variable'));_0x3bf716['use']('/api/integrations',require(_0xf689('0x85')));_0x3bf716[_0xf689('0x7')](_0xf689('0x86'),require(_0xf689('0x87')));_0x3bf716[_0xf689('0x7')](_0xf689('0x88'),require(_0xf689('0x89')));_0x3bf716['use'](_0xf689('0x8a'),require('./api/analyticDefaultReport'));_0x3bf716['use'](_0xf689('0x8b'),require('./api/analyticExtractedReport'));_0x3bf716[_0xf689('0x7')](_0xf689('0x8c'),require(_0xf689('0x8d')));_0x3bf716['use'](_0xf689('0x8e'),require(_0xf689('0x8f')));_0x3bf716[_0xf689('0x7')](_0xf689('0x90'),require(_0xf689('0x91')));_0x3bf716[_0xf689('0x7')]('/api/integrations/salesforce/accounts',require(_0xf689('0x92')));_0x3bf716[_0xf689('0x7')](_0xf689('0x93'),require(_0xf689('0x94')));_0x3bf716[_0xf689('0x7')]('/api/integrations/salesforce/fields',require(_0xf689('0x95')));_0x3bf716[_0xf689('0x7')]('/api/integrations/sugarcrm/accounts',require(_0xf689('0x96')));_0x3bf716[_0xf689('0x7')](_0xf689('0x97'),require('./api/intSugarcrmConfiguration'));_0x3bf716['use'](_0xf689('0x98'),require(_0xf689('0x99')));_0x3bf716[_0xf689('0x7')](_0xf689('0x9a'),require(_0xf689('0x9b')));_0x3bf716[_0xf689('0x7')](_0xf689('0x9c'),require(_0xf689('0x9d')));_0x3bf716[_0xf689('0x7')](_0xf689('0x9e'),require('./api/intDeskField'));_0x3bf716['use'](_0xf689('0x9f'),require(_0xf689('0xa0')));_0x3bf716[_0xf689('0x7')](_0xf689('0xa1'),require('./api/intZohoConfiguration'));_0x3bf716[_0xf689('0x7')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3bf716[_0xf689('0x7')](_0xf689('0xa2'),require('./api/intZendeskAccount'));_0x3bf716[_0xf689('0x7')](_0xf689('0xa3'),require('./api/intZendeskConfiguration'));_0x3bf716[_0xf689('0x7')](_0xf689('0xa4'),require('./api/intZendeskField'));_0x3bf716[_0xf689('0x7')]('/api/integrations/freshdesk/accounts',require(_0xf689('0xa5')));_0x3bf716[_0xf689('0x7')]('/api/integrations/freshdesk/configurations',require(_0xf689('0xa6')));_0x3bf716[_0xf689('0x7')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x3bf716[_0xf689('0x7')](_0xf689('0xa7'),require(_0xf689('0xa8')));_0x3bf716[_0xf689('0x7')](_0xf689('0xa9'),require(_0xf689('0xaa')));_0x3bf716[_0xf689('0x7')](_0xf689('0xab'),require('./api/intVtigerField'));_0x3bf716[_0xf689('0x7')](_0xf689('0xac'),require(_0xf689('0xad')));_0x3bf716[_0xf689('0x7')](_0xf689('0xae'),require(_0xf689('0xaf')));_0x3bf716['use'](_0xf689('0xb0'),require(_0xf689('0xb1')));_0x3bf716['use'](_0xf689('0xb2'),require(_0xf689('0xb3')));_0x3bf716['use'](_0xf689('0xb4'),require('./api/intDynamics365Configuration'));_0x3bf716[_0xf689('0x7')](_0xf689('0xb5'),require(_0xf689('0xb6')));_0x3bf716[_0xf689('0x7')](_0xf689('0xb7'),require('./api/intFreshsalesAccount'));_0x3bf716['use'](_0xf689('0xb8'),require(_0xf689('0xb9')));_0x3bf716[_0xf689('0x7')](_0xf689('0xba'),require(_0xf689('0xbb')));_0x3bf716[_0xf689('0x7')](_0xf689('0xbc'),require(_0xf689('0xbd')));_0x3bf716['use'](_0xf689('0xbe'),require(_0xf689('0xbf')));_0x3bf716['use'](_0xf689('0xc0'),require(_0xf689('0xc1')));_0x3bf716['use'](_0xf689('0xc2'),require(_0xf689('0xc3')));_0x3bf716[_0xf689('0x7')](_0xf689('0xc4'),require('./api/jscriptyQuestionReport'));_0x3bf716[_0xf689('0x7')](_0xf689('0xc5'),require(_0xf689('0xc6')));_0x3bf716[_0xf689('0x7')](_0xf689('0xc7'),require(_0xf689('0xc8')));_0x3bf716[_0xf689('0x7')](_0xf689('0xc9'),require(_0xf689('0xca')));_0x3bf716['use'](_0xf689('0xcb'),require(_0xf689('0xcc')));_0x3bf716[_0xf689('0x7')](_0xf689('0xcd'),require(_0xf689('0xce')));_0x3bf716[_0xf689('0x7')](_0xf689('0xcf'),require(_0xf689('0xd0')));_0x3bf716[_0xf689('0x7')](_0xf689('0xd1'),require(_0xf689('0xd2')));_0x3bf716[_0xf689('0x7')](_0xf689('0xd3'),require('./api/squareProject'));_0x3bf716['use']('/api/square/recordings',require('./api/squareRecording'));_0x3bf716[_0xf689('0x7')](_0xf689('0xd4'),require(_0xf689('0xd5')));_0x3bf716[_0xf689('0x7')](_0xf689('0xd6'),require(_0xf689('0xd7')));_0x3bf716['use'](_0xf689('0xd8'),require(_0xf689('0xd9')));_0x3bf716[_0xf689('0x7')](_0xf689('0xda'),require(_0xf689('0xdb')));_0x3bf716[_0xf689('0x7')](_0xf689('0xdc'),require(_0xf689('0xdd')));_0x3bf716[_0xf689('0x7')](_0xf689('0xde'),require(_0xf689('0xdf')));_0x3bf716[_0xf689('0x7')](_0xf689('0xe0'),require('./api/plugin'));_0x3bf716[_0xf689('0x7')](_0xf689('0xe1'),require(_0xf689('0xe2')));_0x3bf716[_0xf689('0x7')]('/api/chat/reports/transfer',require(_0xf689('0xe3')));_0x3bf716[_0xf689('0x7')]('/api/fax/reports/transfer',require(_0xf689('0xe4')));_0x3bf716[_0xf689('0x7')](_0xf689('0xe5'),require('./api/openchannelTransferReport'));_0x3bf716[_0xf689('0x7')](_0xf689('0xe6'),require(_0xf689('0xe7')));_0x3bf716[_0xf689('0x7')](_0xf689('0xe8'),require(_0xf689('0xe9')));_0x3bf716['use']('/api/voice/prefixes',require(_0xf689('0xea')));_0x3bf716[_0xf689('0x7')](_0xf689('0xeb'),require('./api/userProfile'));_0x3bf716[_0xf689('0x7')]('/api/userProfile/sections',require(_0xf689('0xec')));_0x3bf716[_0xf689('0x7')](_0xf689('0xed'),require('./api/userProfileResource'));_0x3bf716[_0xf689('0x7')](_0xf689('0xee'),require(_0xf689('0xef')));_0x3bf716[_0xf689('0x7')]('/api/whatsapp/accounts',require(_0xf689('0xf0')));_0x3bf716[_0xf689('0x7')](_0xf689('0xf1'),require(_0xf689('0xf2')));_0x3bf716[_0xf689('0x7')]('/api/whatsapp/interactions',require(_0xf689('0xf3')));_0x3bf716[_0xf689('0x7')](_0xf689('0xf4'),require(_0xf689('0xf5')));_0x3bf716[_0xf689('0x7')](_0xf689('0xf6'),require(_0xf689('0xf7')));_0x3bf716[_0xf689('0x7')](_0xf689('0xf8'),require('./api/whatsappTransferReport'));_0x3bf716[_0xf689('0x7')](_0xf689('0xf9'),require(_0xf689('0xfa')));_0x3bf716[_0xf689('0x7')](_0xf689('0xfb'),require(_0xf689('0xfc')));_0x3bf716[_0xf689('0x7')](_0xf689('0xfd'),require(_0xf689('0xfe')));_0x3bf716[_0xf689('0x7')](_0xf689('0xff'),require('./api/authGoogle'));_0x3bf716['use']('/api/jira',require('./api/jira'));_0x3bf716['use'](_0xf689('0x100'),require(_0xf689('0x101')));_0x3bf716['use'](_0xf689('0x102'),require(_0xf689('0x103')));_0x3bf716[_0xf689('0x7')](_0xf689('0x104'),require(_0xf689('0x105')));_0x3bf716[_0xf689('0x7')](_0xf689('0x106'),require(_0xf689('0x107')));_0x3bf716[_0xf689('0x7')](_0xf689('0x108'),require(_0xf689('0x109')));_0x3bf716['use'](_0xf689('0x10a'),express[_0xf689('0x10b')](path['join'](config[_0xf689('0x10c')],_0xf689('0x10a'))));_0x3bf716['use'](_0xf689('0x10d'),express['static'](path['join'](config[_0xf689('0x10c')],'/www')));_0x3bf716[_0xf689('0x7')](_0xf689('0x10e'),express[_0xf689('0x10b')](path[_0xf689('0x10f')](config['root'],_0xf689('0x10e'))));_0x3bf716['use'](_0xf689('0x110'),express[_0xf689('0x10b')](path[_0xf689('0x10f')](config[_0xf689('0x10c')],_0xf689('0x111'),_0xf689('0x112'))));_0x3bf716[_0xf689('0x7')](_0xf689('0x113'),express[_0xf689('0x10b')](path['join'](config[_0xf689('0x10c')],_0xf689('0x114'))));_0x3bf716['route'](_0xf689('0x115'))['get'](errors[0x194]);_0x3bf716[_0xf689('0x116')]('/*')['get'](function(_0x243be2,_0x7c20cb){_0x7c20cb['sendFile'](path[_0xf689('0x117')](_0x3bf716[_0xf689('0x118')]('appPath')+_0xf689('0x119')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b9d992b..e8deef8 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x439c=['../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc'];(function(_0x3b5175,_0x2ee9ba){var _0x4138c4=function(_0x496a34){while(--_0x496a34){_0x3b5175['push'](_0x3b5175['shift']());}};_0x4138c4(++_0x2ee9ba);}(_0x439c,0xe4));var _0xc439=function(_0x1313f0,_0x20b46b){_0x1313f0=_0x1313f0-0x0;var _0x43f926=_0x439c[_0x1313f0];return _0x43f926;};'use strict';var jayson=require(_0xc439('0x0'));var BPromise=require(_0xc439('0x1'));var _=require(_0xc439('0x2'));var config=require('../config/environment');exports[_0xc439('0x3')]=function(){return new BPromise(function(_0x33103e,_0x20df16){var _0x41517e={};_0x41517e=_['merge'](_0x41517e,require('../api/user/user.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x5')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x6')));_0x41517e=_['merge'](_0x41517e,require('../api/voiceRecording/voiceRecording.rpc'));_0x41517e=_['merge'](_0x41517e,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x7')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x8')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x9')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/memberReport/memberReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/trunk/trunk.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xa')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xb')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xc')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xd')));_0x41517e=_['merge'](_0x41517e,require('../api/mailQueue/mailQueue.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0xe')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0xf')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x10')));_0x41517e=_['merge'](_0x41517e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x11')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x12')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/faxInteraction/faxInteraction.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x13')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x14')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/smsAccount/smsAccount.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x15')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x16')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x17')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x18')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x19')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x1a')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x1b')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x1c')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x1d')));_0x41517e=_['merge'](_0x41517e,require('../api/chatMessage/chatMessage.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x1e')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x1f')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x20')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x21')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x22')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x23')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x24')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x25')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x26')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x27')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/template/template.rpc'));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x28')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x29')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2a')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2b')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2c')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2d')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2e')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x2f')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x30')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x31')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x32')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x33')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x34')));_0x41517e=_['merge'](_0x41517e,require('../api/squareOdbc/squareOdbc.rpc'));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x35')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x36')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x37')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x38')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x39')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3a')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3b')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3c')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3d')));_0x41517e=_['merge'](_0x41517e,require(_0xc439('0x3e')));_0x41517e=_[_0xc439('0x4')](_0x41517e,require(_0xc439('0x3f')));var _0x21ef57=jayson['server'](_0x41517e)['http']();var _0x44164f=config[_0xc439('0x40')][_0xc439('0x41')]||config['port']+0x1;var _0x274010=config['rpc']['ip']||'localhost';_0x21ef57['on']('error',function(_0x263dfa){return _0x20df16(_0x263dfa);});_0x21ef57['listen'](_0x44164f,_0x274010,function(){console[_0xc439('0x42')](_0xc439('0x43'),_0x274010,_0x44164f);require(_0xc439('0x44'))['default']();return _0x33103e(_0xc439('0x45')+_0x274010+':'+_0x44164f);});});}; \ No newline at end of file +var _0x2baa=['../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','listen','merge','../api/user/user.rpc','../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/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2baa,0xfe));var _0xa2ba=function(_0x211219,_0x1c7e0d){_0x211219=_0x211219-0x0;var _0x2f39b1=_0x2baa[_0x211219];return _0x2f39b1;};'use strict';var jayson=require(_0xa2ba('0x0'));var BPromise=require(_0xa2ba('0x1'));var _=require('lodash');var config=require('../config/environment');exports[_0xa2ba('0x2')]=function(){return new BPromise(function(_0x38f4f4,_0x40983e){var _0x30d423={};_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x4')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x5')));_0x30d423=_['merge'](_0x30d423,require(_0xa2ba('0x6')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x7')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x8')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x9')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0xa')));_0x30d423=_['merge'](_0x30d423,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0xb')));_0x30d423=_['merge'](_0x30d423,require(_0xa2ba('0xc')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0xd')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0xe')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0xf')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x10')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x11')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x12')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/mailMessage/mailMessage.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x13')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x14')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x15')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x16')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x17')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x18')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x19')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x1a')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x1b')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x1c')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x1d')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/smsQueue/smsQueue.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x1e')));_0x30d423=_['merge'](_0x30d423,require(_0xa2ba('0x1f')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x20')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x21')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x22')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x23')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x24')));_0x30d423=_['merge'](_0x30d423,require('../api/cmContact/cmContact.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x25')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x26')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x27')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x28')));_0x30d423=_['merge'](_0x30d423,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x30d423=_['merge'](_0x30d423,require('../api/interval/interval.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x29')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x2a')));_0x30d423=_['merge'](_0x30d423,require(_0xa2ba('0x2b')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x2c')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x2d')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x2e')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x2f')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x30')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x31')));_0x30d423=_['merge'](_0x30d423,require(_0xa2ba('0x32')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x33')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x34')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x35')));_0x30d423=_['merge'](_0x30d423,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x30d423=_['merge'](_0x30d423,require(_0xa2ba('0x36')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x37')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/squareReport/squareReport.rpc'));_0x30d423=_['merge'](_0x30d423,require(_0xa2ba('0x38')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x39')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x3a')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x3b')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x3c')));_0x30d423=_['merge'](_0x30d423,require(_0xa2ba('0x3d')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x3e')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/plugin/plugin.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x3f')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require(_0xa2ba('0x40')));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x30d423=_[_0xa2ba('0x3')](_0x30d423,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x35dd1d=jayson[_0xa2ba('0x41')](_0x30d423)['http']();var _0x2f177c=config[_0xa2ba('0x42')][_0xa2ba('0x43')]||config[_0xa2ba('0x43')]+0x1;var _0x138560=config[_0xa2ba('0x42')]['ip']||_0xa2ba('0x44');_0x35dd1d['on'](_0xa2ba('0x45'),function(_0x24eab7){return _0x40983e(_0x24eab7);});_0x35dd1d[_0xa2ba('0x2')](_0x2f177c,_0x138560,function(){console[_0xa2ba('0x46')](_0xa2ba('0x47'),_0x138560,_0x2f177c);require(_0xa2ba('0x48'))['default']();return _0x38f4f4(_0xa2ba('0x49')+_0x138560+':'+_0x2f177c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 28e24e5..0c8051b 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 _0xf261=['destroy','pipe','command','log','write','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','toString','sayNumber','sayDigits','sayPhonetic','continueAt','extension','setExtension','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','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT'];(function(_0xa26647,_0xe25a78){var _0x33e921=function(_0x5632c0){while(--_0x5632c0){_0xa26647['push'](_0xa26647['shift']());}};_0x33e921(++_0xe25a78);}(_0xf261,0x11a));var _0x1f26=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf261[_0x167cc1];return _0x10bc4b;};'use strict';var util=require('util');var _=require(_0x1f26('0x0'));var EventEmitter=require(_0x1f26('0x1'))[_0x1f26('0x2')];var AGIReply=require(_0x1f26('0x3'));var AGIError=require(_0x1f26('0x4'));function AGIChannel(_0x3ed9c8){var _0x1a35c1=this,_0x2b259f=new AGIReply(),_0x5827c8=![],_0x381f0b={};EventEmitter[_0x1f26('0x5')](_0x1a35c1);_0x3ed9c8[_0x1f26('0x6')](_0x1f26('0x7'));_0x3ed9c8['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2b259f['setEncoding']('utf8');_0x2b259f['on'](_0x1f26('0x8'),function(_0xddc93b){for(var _0xd9bae6 in _0xddc93b){_0x1a35c1[_0xd9bae6]=_0xddc93b[_0xd9bae6];}_0x1a35c1['emit'](_0x1f26('0x9'));});_0x2b259f['on'](_0x1f26('0xa'),function(_0x555a98){if(_0x555a98[_0x1f26('0xb')]()==_0x1f26('0xc')){_0x1a35c1[_0x1f26('0xd')](_0x1f26('0xc'));return;}if(_0x555a98[_0x1f26('0xe')](0x0,0xb)==_0x1f26('0xf')){_0x5827c8=!![];}if(_0x5827c8){_0x381f0b['rx']+=_0x555a98+'\x0a';if(_0x555a98[_0x1f26('0x10')](_0x1f26('0x11'))!=-0x1){_0x5827c8=![];}}else{_0x381f0b['rx']=_0x555a98;}if(_0x5827c8){return;}if(typeof _0x381f0b['cb']==_0x1f26('0x12')){var _0x2e5b0b=_0x381f0b['rx']['substring'](0x0,0x3),_0x2bc876=null,_0x3b4ef5=null;_0x2e5b0b=parseInt(_0x2e5b0b);if(isNaN(_0x2e5b0b)){_0x381f0b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1f26('0x13')});return;}if(_0x2e5b0b!=0xc8){_0x381f0b['cb'](null,{'code':_0x2e5b0b,'result':-0x1,'extra':'KO'});return;}_0x2bc876=_0x381f0b['rx'][_0x1f26('0xe')](0x4)[_0x1f26('0x14')](_0x1f26('0x15'),'');if(_0x2bc876[_0x1f26('0x16')]('\x20')!=-0x1){_0x2bc876=_0x2bc876[_0x1f26('0x17')](0x0,_0x2bc876[_0x1f26('0x16')]('\x20'));}if(_[_0x1f26('0x18')](_0x2bc876,'-1')){_0x2bc876=parseInt(_0x2bc876);}_0x3b4ef5=_0x381f0b['rx'][_0x1f26('0x19')]('\x20');if(_0x3b4ef5['length']==0x3){_0x3b4ef5=_0x3b4ef5[0x2][_0x1f26('0xe')](0x1,_0x3b4ef5[0x2]['length']-0x1);}else if(_0x3b4ef5[_0x1f26('0x1a')]>0x3){var _0x5d8b29=/\((.+)\)/;var _0xa44065=_0x381f0b['rx'][_0x1f26('0x1b')](_0x5d8b29);if(_0xa44065){_0x3b4ef5=_0xa44065[0x1];}else{_0x3b4ef5=null;}}else{_0x3b4ef5=null;}_0x381f0b['cb'](null,{'code':_0x2e5b0b,'result':_0x2bc876,'extra':_0x3b4ef5});}});_0x3ed9c8['on'](_0x1f26('0x1c'),function(_0x4b4d25){_0x1a35c1[_0x1f26('0xd')](_0x1f26('0x1c'),new AGIError('E_AGI_SOCKET_ERROR',_0x4b4d25[_0x1f26('0x1d')]));});_0x3ed9c8['on'](_0x1f26('0x1e'),function(){_0x1a35c1[_0x1f26('0xd')]('close',new AGIError(_0x1f26('0x1f')));});_0x3ed9c8['on'](_0x1f26('0x20'),function(){_0x1a35c1[_0x1f26('0xd')](_0x1f26('0x20'),new AGIError(_0x1f26('0x21')));_0x3ed9c8[_0x1f26('0x22')]();});_0x3ed9c8[_0x1f26('0x23')](_0x2b259f);this[_0x1f26('0x24')]=function(_0x40e594,_0x11b1c3){console[_0x1f26('0x25')]('command=',_0x40e594);var _0x40e594=_0x40e594||'',_0x11b1c3=typeof _0x11b1c3==_0x1f26('0x12')?_0x11b1c3:new Function();_0x381f0b={'tx':_0x40e594,'rx':'','cb':_0x11b1c3};_0x3ed9c8[_0x1f26('0x26')](_0x40e594+'\x0a');},this['close']=function(){_0x3ed9c8[_0x1f26('0x22')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x1f26('0x27')][_0x1f26('0x28')]=function(_0x497333){return this[_0x1f26('0x24')][_0x1f26('0x29')](this,_0x497333);};AGIChannel[_0x1f26('0x27')][_0x1f26('0x2a')]=function(){return this[_0x1f26('0x28')](_0x1f26('0x2b'));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x2c')]=function(_0x3764c9,_0x5bb071,_0x18d0f0){_0x3764c9=_0x3764c9===undefined?_0x1f26('0x2d'):_0x3764c9;_0x5bb071=_0x5bb071===undefined?'5':_0x5bb071;_0x18d0f0=_0x18d0f0===undefined?'1':_0x18d0f0;return this['sendRequest'](util[_0x1f26('0x2e')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3764c9,_0x5bb071*0x3e8,_0x18d0f0));};AGIChannel['prototype'][_0x1f26('0x2f')]=function(_0x7ea1b6){_0x7ea1b6=_0x7ea1b6||_0x1f26('0x30');return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x31'),_0x7ea1b6));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x32')]=function(_0x2b63fd,_0x21c104){if(_['isArray'](_0x21c104)){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')]('EXEC\x20%s\x20%s',_0x2b63fd,_0x21c104['join'](',')));}return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x33'),_0x2b63fd,_0x21c104));};AGIChannel['prototype'][_0x1f26('0x34')]=function(_0x231ecf){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x35'),_0x231ecf));};AGIChannel[_0x1f26('0x27')]['setExtension']=function(_0x5b6954){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x36'),_0x5b6954));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x37')]=function(_0xe5a7fc){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')](_0x1f26('0x38'),_0xe5a7fc));};AGIChannel[_0x1f26('0x27')]['hangup']=function(){return this[_0x1f26('0x28')](_0x1f26('0x39'));};AGIChannel[_0x1f26('0x27')]['setVariable']=function(_0x46a46d,_0x473526){var _0x3cc8d5=_[_0x1f26('0x3a')](_0x473526)||_['isNumber'](_0x473526)?_0x473526[_0x1f26('0x3b')]():_0x473526;return this[_0x1f26('0x28')](util[_0x1f26('0x2e')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x46a46d,_0x3cc8d5?_0x3cc8d5[_0x1f26('0x3b')]()[_0x1f26('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x3c')]=function(_0x2aa0a0,_0x2f12ca){return this[_0x1f26('0x28')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x2aa0a0,_0x2f12ca));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x3d')]=function(_0x492217,_0xc5988d){return this[_0x1f26('0x28')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x492217,_0xc5988d));};AGIChannel['prototype'][_0x1f26('0x3e')]=function(_0x52ce8d,_0x2c7ab8){return this[_0x1f26('0x28')](util[_0x1f26('0x2e')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x52ce8d,_0x2c7ab8));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x3f')]=function(_0x1ca3b9,_0x487815,_0x55c54b){_0x487815=_0x487815||this[_0x1f26('0x40')];_0x55c54b=_0x55c54b||0x1;this['setContext'](_0x1ca3b9);this[_0x1f26('0x41')](_0x487815);this[_0x1f26('0x37')](_0x55c54b);return this[_0x1f26('0x2f')](util['format'](_0x1f26('0x42'),_0x1ca3b9,_0x487815,_0x55c54b));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x43')]=function(_0x33e017){console[_0x1f26('0x25')](_0x1f26('0x44'),_0x33e017);return this[_0x1f26('0x28')](util[_0x1f26('0x2e')]('GET\x20VARIABLE\x20\x22%s\x22',_0x33e017));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x45')]=function(_0x46677d,_0x11d522,_0xf6661a,_0x586a04,_0x36f92c,_0x1902d1){_0x11d522=_0x11d522||_0x1f26('0x46');_0xf6661a=_0xf6661a||'';_0x586a04=_0x586a04===undefined?-0x1:_0x586a04==='-1'?-0x1:_0x586a04*0x3e8;_0x36f92c=_0x36f92c===undefined?'':'s='+_0x36f92c;_0x1902d1=_0x1902d1?'BEEP':'';return this[_0x1f26('0x28')](util['format'](_0x1f26('0x47'),_0x46677d,_0x11d522,_0xf6661a,_0x586a04,_0x1902d1,_0x36f92c));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x48')]=function(_0x87094d,_0x5710d2){_0x5710d2=_0x5710d2||'';return this[_0x1f26('0x28')](util['format'](_0x1f26('0x49'),_0x87094d,_0x5710d2));};AGIChannel[_0x1f26('0x27')][_0x1f26('0x4a')]=function(_0x5117b3){return this[_0x1f26('0x32')]('AGI',_0x5117b3);};AGIChannel['prototype'][_0x1f26('0x4b')]=function(_0xb2b8ab){return this[_0x1f26('0x32')](_0x1f26('0x4c'),_0xb2b8ab);};AGIChannel['prototype'][_0x1f26('0x1c')]=function(_0x415f07,_0x2c56ec){this[_0x1f26('0x2f')](util[_0x1f26('0x2e')](_0x1f26('0x4d'),_0x415f07['id'],_0x415f07['label'],_0x2c56ec));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1f26('0x4e')]=AGIChannel; \ No newline at end of file +var _0x6009=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','log','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec','AGI','wait','label','exports','util','lodash','events','./error','call','setEncoding','utf8','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','indexOf','substr','startsWith','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','command=','write','destroy','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','format','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','isBoolean'];(function(_0x400001,_0x4b768f){var _0x343fbe=function(_0x199f05){while(--_0x199f05){_0x400001['push'](_0x400001['shift']());}};_0x343fbe(++_0x4b768f);}(_0x6009,0x140));var _0x9600=function(_0x2bdb28,_0x140b07){_0x2bdb28=_0x2bdb28-0x0;var _0xec9a20=_0x6009[_0x2bdb28];return _0xec9a20;};'use strict';var util=require(_0x9600('0x0'));var _=require(_0x9600('0x1'));var EventEmitter=require(_0x9600('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x9600('0x3'));function AGIChannel(_0x3ca542){var _0x3d6e5e=this,_0x2d1746=new AGIReply(),_0x5c118e=![],_0x51a51c={};EventEmitter[_0x9600('0x4')](_0x3d6e5e);_0x3ca542[_0x9600('0x5')]('utf8');_0x3ca542['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2d1746[_0x9600('0x5')](_0x9600('0x6'));_0x2d1746['on']('headers',function(_0x5ae4c2){for(var _0x1bc495 in _0x5ae4c2){_0x3d6e5e[_0x1bc495]=_0x5ae4c2[_0x1bc495];}_0x3d6e5e[_0x9600('0x7')](_0x9600('0x8'));});_0x2d1746['on'](_0x9600('0x9'),function(_0x54586e){if(_0x54586e[_0x9600('0xa')]()==_0x9600('0xb')){_0x3d6e5e[_0x9600('0x7')](_0x9600('0xb'));return;}if(_0x54586e[_0x9600('0xc')](0x0,0xb)==_0x9600('0xd')){_0x5c118e=!![];}if(_0x5c118e){_0x51a51c['rx']+=_0x54586e+'\x0a';if(_0x54586e[_0x9600('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x5c118e=![];}}else{_0x51a51c['rx']=_0x54586e;}if(_0x5c118e){return;}if(typeof _0x51a51c['cb']==_0x9600('0xf')){var _0x28ead4=_0x51a51c['rx'][_0x9600('0xc')](0x0,0x3),_0x7fa041=null,_0x5b15f3=null;_0x28ead4=parseInt(_0x28ead4);if(isNaN(_0x28ead4)){_0x51a51c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9600('0x10')});return;}if(_0x28ead4!=0xc8){_0x51a51c['cb'](null,{'code':_0x28ead4,'result':-0x1,'extra':'KO'});return;}_0x7fa041=_0x51a51c['rx'][_0x9600('0xc')](0x4)['replace']('result=','');if(_0x7fa041[_0x9600('0x11')]('\x20')!=-0x1){_0x7fa041=_0x7fa041[_0x9600('0x12')](0x0,_0x7fa041[_0x9600('0x11')]('\x20'));}if(_[_0x9600('0x13')](_0x7fa041,'-1')){_0x7fa041=parseInt(_0x7fa041);}_0x5b15f3=_0x51a51c['rx']['split']('\x20');if(_0x5b15f3['length']==0x3){_0x5b15f3=_0x5b15f3[0x2][_0x9600('0xc')](0x1,_0x5b15f3[0x2][_0x9600('0x14')]-0x1);}else if(_0x5b15f3[_0x9600('0x14')]>0x3){var _0xea9e59=/\((.+)\)/;var _0x13d1e6=_0x51a51c['rx']['match'](_0xea9e59);if(_0x13d1e6){_0x5b15f3=_0x13d1e6[0x1];}else{_0x5b15f3=null;}}else{_0x5b15f3=null;}_0x51a51c['cb'](null,{'code':_0x28ead4,'result':_0x7fa041,'extra':_0x5b15f3});}});_0x3ca542['on'](_0x9600('0x15'),function(_0x19edc2){_0x3d6e5e[_0x9600('0x7')](_0x9600('0x15'),new AGIError('E_AGI_SOCKET_ERROR',_0x19edc2['code']));});_0x3ca542['on'](_0x9600('0x16'),function(){_0x3d6e5e[_0x9600('0x7')](_0x9600('0x16'),new AGIError(_0x9600('0x17')));});_0x3ca542['on'](_0x9600('0x18'),function(){_0x3d6e5e[_0x9600('0x7')](_0x9600('0x18'),new AGIError(_0x9600('0x19')));_0x3ca542['destroy']();});_0x3ca542[_0x9600('0x1a')](_0x2d1746);this[_0x9600('0x1b')]=function(_0x5c1ef6,_0x5e4438){console['log'](_0x9600('0x1c'),_0x5c1ef6);var _0x5c1ef6=_0x5c1ef6||'',_0x5e4438=typeof _0x5e4438=='function'?_0x5e4438:new Function();_0x51a51c={'tx':_0x5c1ef6,'rx':'','cb':_0x5e4438};_0x3ca542[_0x9600('0x1d')](_0x5c1ef6+'\x0a');},this[_0x9600('0x16')]=function(){_0x3ca542[_0x9600('0x1e')]();};}util[_0x9600('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x9600('0x20')][_0x9600('0x21')]=function(_0x477626){return this[_0x9600('0x1b')][_0x9600('0x22')](this,_0x477626);};AGIChannel['prototype'][_0x9600('0x23')]=function(){return this[_0x9600('0x21')](_0x9600('0x24'));};AGIChannel[_0x9600('0x20')][_0x9600('0x25')]=function(_0x6d399,_0x445ed1,_0xbd2fd8){_0x6d399=_0x6d399===undefined?_0x9600('0x26'):_0x6d399;_0x445ed1=_0x445ed1===undefined?'5':_0x445ed1;_0xbd2fd8=_0xbd2fd8===undefined?'1':_0xbd2fd8;return this['sendRequest'](util['format'](_0x9600('0x27'),_0x6d399,_0x445ed1*0x3e8,_0xbd2fd8));};AGIChannel[_0x9600('0x20')][_0x9600('0x28')]=function(_0x16412b){_0x16412b=_0x16412b||'NO\x20MESSAGE';return this[_0x9600('0x21')](util['format'](_0x9600('0x29'),_0x16412b));};AGIChannel[_0x9600('0x20')]['exec']=function(_0x587db8,_0x572ff7){if(_['isArray'](_0x572ff7)){return this[_0x9600('0x21')](util[_0x9600('0x2a')](_0x9600('0x2b'),_0x587db8,_0x572ff7[_0x9600('0x2c')](',')));}return this[_0x9600('0x21')](util['format'](_0x9600('0x2b'),_0x587db8,_0x572ff7));};AGIChannel[_0x9600('0x20')]['setContext']=function(_0x2b3ef5){return this[_0x9600('0x21')](util[_0x9600('0x2a')](_0x9600('0x2d'),_0x2b3ef5));};AGIChannel[_0x9600('0x20')][_0x9600('0x2e')]=function(_0xb76372){return this['sendRequest'](util['format']('SET\x20EXTENSION\x20%s',_0xb76372));};AGIChannel[_0x9600('0x20')][_0x9600('0x2f')]=function(_0x4373ba){return this[_0x9600('0x21')](util['format'](_0x9600('0x30'),_0x4373ba));};AGIChannel[_0x9600('0x20')][_0x9600('0xb')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x9600('0x20')]['setVariable']=function(_0xa6df38,_0x58f656){var _0x2b3eaf=_[_0x9600('0x31')](_0x58f656)||_['isNumber'](_0x58f656)?_0x58f656[_0x9600('0x32')]():_0x58f656;return this[_0x9600('0x21')](util[_0x9600('0x2a')](_0x9600('0x33'),_0xa6df38,_0x2b3eaf?_0x2b3eaf[_0x9600('0x32')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9600('0x20')][_0x9600('0x34')]=function(_0x4a7ffb,_0x3b2a00){return this['sendRequest'](util[_0x9600('0x2a')](_0x9600('0x35'),_0x4a7ffb,_0x3b2a00));};AGIChannel[_0x9600('0x20')][_0x9600('0x36')]=function(_0x32f8c6,_0x1489ba){return this[_0x9600('0x21')](util[_0x9600('0x2a')](_0x9600('0x37'),_0x32f8c6,_0x1489ba));};AGIChannel[_0x9600('0x20')][_0x9600('0x38')]=function(_0x1aaaa0,_0x274022){return this[_0x9600('0x21')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1aaaa0,_0x274022));};AGIChannel['prototype'][_0x9600('0x39')]=function(_0x56d89b,_0x2b2a3a,_0x162b97){_0x2b2a3a=_0x2b2a3a||this[_0x9600('0x3a')];_0x162b97=_0x162b97||0x1;this['setContext'](_0x56d89b);this['setExtension'](_0x2b2a3a);this[_0x9600('0x2f')](_0x162b97);return this['noop'](util['format'](_0x9600('0x3b'),_0x56d89b,_0x2b2a3a,_0x162b97));};AGIChannel[_0x9600('0x20')][_0x9600('0x3c')]=function(_0x29ff0d){console[_0x9600('0x3d')]('getvariable',_0x29ff0d);return this['sendRequest'](util['format'](_0x9600('0x3e'),_0x29ff0d));};AGIChannel[_0x9600('0x20')][_0x9600('0x3f')]=function(_0x827cdc,_0x28245b,_0x37cef7,_0x338e80,_0x4a76c8,_0x1b9f07){_0x28245b=_0x28245b||_0x9600('0x40');_0x37cef7=_0x37cef7||'';_0x338e80=_0x338e80===undefined?-0x1:_0x338e80==='-1'?-0x1:_0x338e80*0x3e8;_0x4a76c8=_0x4a76c8===undefined?'':'s='+_0x4a76c8;_0x1b9f07=_0x1b9f07?_0x9600('0x41'):'';return this[_0x9600('0x21')](util[_0x9600('0x2a')](_0x9600('0x42'),_0x827cdc,_0x28245b,_0x37cef7,_0x338e80,_0x1b9f07,_0x4a76c8));};AGIChannel[_0x9600('0x20')][_0x9600('0x43')]=function(_0x19a3e6,_0x37d3ee){_0x37d3ee=_0x37d3ee||'';return this[_0x9600('0x21')](util[_0x9600('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x19a3e6,_0x37d3ee));};AGIChannel[_0x9600('0x20')][_0x9600('0x44')]=function(_0x42facf){return this[_0x9600('0x45')](_0x9600('0x46'),_0x42facf);};AGIChannel[_0x9600('0x20')][_0x9600('0x47')]=function(_0x449548){return this[_0x9600('0x45')]('WAIT',_0x449548);};AGIChannel['prototype'][_0x9600('0x15')]=function(_0x57a038,_0x1c8ca3){this['noop'](util[_0x9600('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x57a038['id'],_0x57a038[_0x9600('0x48')],_0x1c8ca3));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9600('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e588ff4..0949ffa 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 _0xb700=['apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x435b01,_0x64cb90){var _0x100b0e=function(_0x39bc79){while(--_0x39bc79){_0x435b01['push'](_0x435b01['shift']());}};_0x100b0e(++_0x64cb90);}(_0xb700,0x1d3));var _0x0b70=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0xb700[_0x2fd160];return _0x5c2031;};'use strict';var util=require(_0x0b70('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x0b70('0x1'),'E_AGI_SERVER_ERROR':_0x0b70('0x2'),'E_AGI_SERVER_CLOSE':_0x0b70('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0b70('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0b70('0x5'),'E_AGI_SOCKET_ERROR':_0x0b70('0x6'),'E_AGI_SOCKET_CLOSE':_0x0b70('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x0b70('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0b70('0x9')};function AGIError(_0x186d93){var _0x186d93=_0x186d93||null,_0x17cc6d=_0x17cc6d||[],_0x12fd11=0x1,_0x51e82a='';if(!error[_0x186d93]){_0x186d93=_0x0b70('0xa');}_0x17cc6d[_0x0b70('0xb')](error[_0x186d93]);while(arguments[_0x12fd11]){_0x17cc6d[_0x0b70('0xb')](arguments[_0x12fd11]);_0x12fd11++;}_0x51e82a=util[_0x0b70('0xc')][_0x0b70('0xd')](util,_0x17cc6d);this[_0x0b70('0xe')]=_0x51e82a;this[_0x0b70('0xf')]=_0x186d93;}module['exports']=AGIError; \ No newline at end of file +var _0x0a12=['name','exports','Undefined\x20error.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0x0a12,0xb8));var _0x20a1=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x0a12[_0x2aec52];return _0x3b8835;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x20a1('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x20a1('0x1'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x20a1('0x2'),'E_AGI_SOCKET_CLOSE':_0x20a1('0x3'),'E_AGI_SOCKET_TIMEOUT':_0x20a1('0x4'),'E_AGI_COMMAND_EMPTY':_0x20a1('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x20a1('0x6'),'E_AGI_IVR_ENTRY':_0x20a1('0x7')};function AGIError(_0x1fedd2){var _0x1fedd2=_0x1fedd2||null,_0x494314=_0x494314||[],_0x28ed27=0x1,_0x52fb53='';if(!error[_0x1fedd2]){_0x1fedd2='E_AGI_UNDEFINED';}_0x494314[_0x20a1('0x8')](error[_0x1fedd2]);while(arguments[_0x28ed27]){_0x494314[_0x20a1('0x8')](arguments[_0x28ed27]);_0x28ed27++;}_0x52fb53=util[_0x20a1('0x9')][_0x20a1('0xa')](util,_0x494314);this[_0x20a1('0xb')]=_0x52fb53;this[_0x20a1('0xc')]=_0x1fedd2;}module[_0x20a1('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 18686fd..1e0c0ad 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 _0x2f3a=['size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype'];(function(_0xc39da7,_0x19f50a){var _0x20b444=function(_0x36a42b){while(--_0x36a42b){_0xc39da7['push'](_0xc39da7['shift']());}};_0x20b444(++_0x19f50a);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x68ecb1,_0x5c8115){_0x68ecb1=_0x68ecb1-0x0;var _0x2d94ed=_0x2f3a[_0x68ecb1];return _0x2d94ed;};'use strict';var _=require(_0xa2f3('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0xa2f3('0x1'),_0xa2f3('0x2'),_0xa2f3('0x3')];var Graph=function(){this[_0xa2f3('0x4')]={};this[_0xa2f3('0x5')]={};this[_0xa2f3('0x6')]=0x0;};Graph['prototype'][_0xa2f3('0x7')]=function(_0x589d0f){this[_0xa2f3('0x4')][_0x589d0f['id']]=_0x589d0f;this[_0xa2f3('0x5')][_0x589d0f['id']]=[];};Graph['prototype']['addEdge']=function(_0x2faf36,_0x3944a0,_0x4405a2){this[_0xa2f3('0x5')][_0x2faf36]['push']({'target':_0x3944a0,'condition':_0x4405a2});this[_0xa2f3('0x6')]+=0x1;};Graph[_0xa2f3('0x8')][_0xa2f3('0x9')]=function(){return _[_0xa2f3('0x9')](this[_0xa2f3('0x4')]);};Graph['prototype'][_0xa2f3('0xa')]=function(){return this[_0xa2f3('0x6')];};Graph['prototype'][_0xa2f3('0xb')]=function(_0x1f7642){return this[_0xa2f3('0x4')][_0x1f7642];};Graph['prototype'][_0xa2f3('0xc')]=function(_0x194281,_0x1b524e){if(!this[_0xa2f3('0x4')][_0x194281]){return logger[_0xa2f3('0xd')](_0xa2f3('0xe'));}var _0x3907fe=_0x1b524e(this[_0xa2f3('0x4')][_0x194281]);if(!_0x3907fe){return logger[_0xa2f3('0xd')]('stop\x20traverse');}if(this[_0xa2f3('0x5')][_0x194281][_0xa2f3('0xf')]===0x0){return logger[_0xa2f3('0xd')]('no\x20edge/s\x20available');}for(var _0x3f9782=0x0,_0xd8e8bf=[],_0x4b138b=![];_0x3f9782\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','isUndefined','[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','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./vertices','defaults','nextTick','error','log','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','info','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','mxGraphModel','root','agicommand','hasOwnProperty','retry','omit','isArray','length','target','addEdge','source','value','getSquareProject','then','createSquareReport','catch','indexOf','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','SQUAREROOT','start','debug','YYYY-MM-DD\x20HH:mm:ss','mxCell','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','clear','vertex','VERTEX','gotoc','context','extension','priority','vresponse','code','result','response','toString','agicommand\x20not\x20found','finally'];(function(_0x1f3591,_0x1270e9){var _0x3ffcd8=function(_0x1898ac){while(--_0x1898ac){_0x1f3591['push'](_0x1f3591['shift']());}};_0x3ffcd8(++_0x1270e9);}(_0x7aa1,0x6e));var _0x17aa=function(_0x504637,_0x6ca85c){_0x504637=_0x504637-0x0;var _0x2cfe27=_0x7aa1[_0x504637];return _0x2cfe27;};'use strict';var parser=require(_0x17aa('0x0'));var _=require(_0x17aa('0x1'));var syncho=require(_0x17aa('0x2'));var util=require(_0x17aa('0x3'));var moment=require(_0x17aa('0x4'));var config=require(_0x17aa('0x5'));var logger=require('../../config/logger')(_0x17aa('0x6'));var utilLicense=require(_0x17aa('0x7'));var rpc=require(_0x17aa('0x8'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x17aa('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x17aa('0x6')]=_[_0x17aa('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x28811b){process[_0x17aa('0xb')](function(){syncho(function(){try{setChannelVariables(_0x28811b);agiHandler(_0x28811b);}catch(_0x5997c9){logger[_0x17aa('0xc')](_0x5997c9['stack']);}});});}function listeningHandler(){console[_0x17aa('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x17aa('0x6')][_0x17aa('0xe')]);logger['info'](util[_0x17aa('0xf')](_0x17aa('0x10'),config[_0x17aa('0x6')]['ip'],config[_0x17aa('0x6')][_0x17aa('0xe')]));}function errorHandler(_0x262036){if(_0x262036&&_0x262036[_0x17aa('0x11')]&&_0x262036[_0x17aa('0x12')]){logger[_0x17aa('0xc')](util[_0x17aa('0xf')](_0x17aa('0x13'),_0x262036[_0x17aa('0x11')],_0x262036['message']));}else{logger[_0x17aa('0xc')](util[_0x17aa('0xf')](_0x17aa('0x14'),_0x262036[_0x17aa('0x15')]));}}function closeHandler(){logger['info'](util['format'](_0x17aa('0x16'),this[_0x17aa('0x17')],this['calleridname'],this['callerid'],this[_0x17aa('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5c9d2e){logger[_0x17aa('0xc')](_0x5c9d2e['stack']);}}function timeoutHandler(){logger['info'](util['format'](_0x17aa('0x19'),this[_0x17aa('0x17')],this['calleridname'],this[_0x17aa('0x1a')],this['dnid'],this[_0x17aa('0x1b')]));}function hangupHandler(){logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x1d'),this[_0x17aa('0x17')],this[_0x17aa('0x1e')],this[_0x17aa('0x1a')],this[_0x17aa('0x18')],this[_0x17aa('0x1b')]));this[_0x17aa('0x1f')]=!![];}function getRoot(_0x2bce11){return parser['toJson'](_0x2bce11,{'object':!![]})[_0x17aa('0x20')][_0x17aa('0x21')];}function addVertex(_0xb0f4d4,_0x49d235,_0x5883e3){_0x49d235[_0x17aa('0x22')]=_0x5883e3;if(_0x49d235[_0x17aa('0x23')](_0x17aa('0x24'))){_0x49d235['maxRetry']=parseInt(_0x49d235[_0x17aa('0x24')],0xa);}_0xb0f4d4['addVertex'](_[_0x17aa('0x25')](_0x49d235,'mxCell'));}function initGraph(_0x37f195,_0x566c0b){var _0xf637cf=new Graph();for(var _0x517a78 in _0x37f195){if(_0x37f195[_0x17aa('0x23')](_0x517a78)){if(_[_0x17aa('0x26')](_0x37f195[_0x517a78])){for(var _0x542e0b=0x0;_0x542e0b<_0x37f195[_0x517a78][_0x17aa('0x27')];_0x542e0b+=0x1){addVertex(_0xf637cf,_0x37f195[_0x517a78][_0x542e0b],_0x517a78);}}else{addVertex(_0xf637cf,_0x37f195[_0x517a78],_0x517a78);}}}for(var _0xf8dfaf=0x0;_0xf8dfaf<_0x566c0b['length'];_0xf8dfaf+=0x1){if(_0x566c0b[_0xf8dfaf]['source']&&_0x566c0b[_0xf8dfaf][_0x17aa('0x28')]){_0xf637cf[_0x17aa('0x29')](_0x566c0b[_0xf8dfaf][_0x17aa('0x2a')],_0x566c0b[_0xf8dfaf][_0x17aa('0x28')],_0x566c0b[_0xf8dfaf][_0x17aa('0x2b')]);}}return _0xf637cf;}function getSquareProject(_0x27d215,_0x4a4357){rpc[_0x17aa('0x2c')](_0x27d215)[_0x17aa('0x2d')](function(_0x13a2b5){_0x4a4357(null,_0x13a2b5);})['catch'](function(_0x4bf10a){_0x4a4357(null,_0x4bf10a);});}function createSquareReport(_0x1b3a5d,_0x18f56b){rpc[_0x17aa('0x2e')](_0x1b3a5d)[_0x17aa('0x2d')](function(_0x1f0606){if(_0x18f56b){_0x18f56b(null,_0x1f0606);}})[_0x17aa('0x2f')](function(_0x1bbc42){if(_0x18f56b){_0x18f56b(null,_0x1bbc42);}});}function setChannelVariables(_0x2a1d1d){for(var _0x5c82f0 in _0x2a1d1d){if(_0x2a1d1d[_0x17aa('0x23')](_0x5c82f0)){if(_0x5c82f0[_0x17aa('0x30')]('agi_')===0x0){_0x2a1d1d[_0x5c82f0[_0x17aa('0x31')](0x4)]=_0x2a1d1d[_0x5c82f0];delete _0x2a1d1d[_0x5c82f0];}}}}function getLogFromObject(_0x5e56a5){return util[_0x17aa('0x32')](_0x5e56a5,{'showHidden':![],'depth':null});}function agiHandler(_0x507a86){var _0x305c31,_0x1f5e2d,_0x1007a9,_0x45006b,_0x20bee2;logger['debug'](_0x17aa('0x33'),JSON[_0x17aa('0x34')](_0x507a86,null,0x2));logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x35'),_0x507a86['arg_1'],_0x507a86[_0x17aa('0x1e')],_0x507a86['callerid'],_0x507a86[_0x17aa('0x18')],_0x507a86[_0x17aa('0x1b')]));_0x507a86['on'](_0x17aa('0xc'),errorHandler);_0x507a86['on'](_0x17aa('0x36'),closeHandler);_0x507a86['on']('timeout',timeoutHandler);_0x507a86[_0x17aa('0x1f')]=![];_0x507a86['on'](_0x17aa('0x37'),hangupHandler);var _0x113a9d=getSquareProject[_0x17aa('0x38')](null,_0x507a86['arg_1']);if(_0x113a9d){if(_0x113a9d[_0x17aa('0x39')]){_0x305c31=getRoot(_0x113a9d[_0x17aa('0x39')]);console[_0x17aa('0xd')](_0x17aa('0x3a'),_0x305c31);if(_0x305c31&&_0x305c31[_0x17aa('0x3b')]){logger[_0x17aa('0x3c')](_0x17aa('0x21'),JSON['stringify'](_0x305c31,null,0x2));_0x507a86['joinAt']=moment()[_0x17aa('0xf')](_0x17aa('0x3d'));_0x1f5e2d=initGraph(_[_0x17aa('0x25')](_0x305c31,_0x17aa('0x3e')),_0x305c31[_0x17aa('0x3e')]);_0x1007a9=new Vertices(_0x507a86,rpc,mailRpc);console[_0x17aa('0xd')](_0x17aa('0x3f'),_0x1007a9);logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x40'),_0x507a86[_0x17aa('0x17')],_0x507a86[_0x17aa('0x1e')],_0x507a86[_0x17aa('0x1a')],_0x507a86[_0x17aa('0x18')],_0x507a86[_0x17aa('0x1b')]));console[_0x17aa('0xd')](_0x17aa('0x41'));_0x1f5e2d['traverseBFS'](_0x305c31[_0x17aa('0x3b')]['id'],function(_0x5921e6){try{_0x5921e6=_0x1007a9[_0x17aa('0x42')](_0x5921e6);logger[_0x17aa('0x3c')](_0x17aa('0x43'),JSON[_0x17aa('0x34')](_0x5921e6,null,0x2));console[_0x17aa('0xd')](_0x17aa('0x44'),_0x5921e6);if(_0x5921e6[_0x17aa('0x22')]===_0x17aa('0x45')){logger[_0x17aa('0x1c')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x507a86['context']=_0x5921e6[_0x17aa('0x46')]||_0x507a86['context'];_0x507a86[_0x17aa('0x47')]=_0x5921e6[_0x17aa('0x47')];_0x507a86[_0x17aa('0x48')]=_0x5921e6[_0x17aa('0x48')]?_0x5921e6[_0x17aa('0x48')]-0x1:0x1;return null;}else if(_0x5921e6&&_0x1007a9[_0x5921e6[_0x17aa('0x22')]]){_0x20bee2=_0x1007a9[_0x5921e6[_0x17aa('0x22')]](_0x5921e6);console[_0x17aa('0xd')](_0x17aa('0x49'),_0x20bee2);logger[_0x17aa('0x1c')]('response',JSON[_0x17aa('0x34')](_0x20bee2,null,0x2));if(_0x20bee2&&_0x20bee2[_0x17aa('0x4a')]===AGI_CODE_SUCCESS&&_0x20bee2[_0x17aa('0x4b')]!==AGI_RESULT_ERROR&&!_0x507a86[_0x17aa('0x1f')]){logger[_0x17aa('0x3c')](_0x17aa('0x4c'),getLogFromObject(_0x20bee2));return _['isUndefined'](_0x20bee2[_0x17aa('0x4b')])?null:_0x20bee2[_0x17aa('0x4b')][_0x17aa('0x4d')]();}else{logger[_0x17aa('0xc')](_0x17aa('0x4c'),getLogFromObject(_0x20bee2));return null;}}else{logger[_0x17aa('0xc')](_0x17aa('0x4e'));return null;}}catch(_0x1940d5){logger[_0x17aa('0xc')](_0x1940d5['stack']);return null;}});if(_0x305c31[_0x17aa('0x4f')]){logger['info'](util[_0x17aa('0xf')](_0x17aa('0x50'),_0x507a86[_0x17aa('0x17')],_0x507a86[_0x17aa('0x1e')],_0x507a86[_0x17aa('0x1a')],_0x507a86[_0x17aa('0x18')],_0x507a86['uniqueid']));_0x1f5e2d[_0x17aa('0x51')](_0x305c31['finally']['id'],function(_0x4ae6a5){try{_0x4ae6a5=_0x1007a9[_0x17aa('0x42')](_0x4ae6a5);logger[_0x17aa('0x3c')](_0x17aa('0x43'),JSON['stringify'](_0x4ae6a5,null,0x2));if(_0x4ae6a5&&_0x1007a9[_0x4ae6a5[_0x17aa('0x22')]]){_0x20bee2=_0x1007a9[_0x4ae6a5[_0x17aa('0x22')]](_0x4ae6a5);if(_0x20bee2){logger['debug'](_0x17aa('0x4c'),getLogFromObject(_0x20bee2));return _[_0x17aa('0x52')](_0x20bee2['result'])?null:_0x20bee2[_0x17aa('0x4b')]['toString']();}else{logger[_0x17aa('0xc')](_0x17aa('0x4c'),getLogFromObject(_0x20bee2));return null;}}else{logger[_0x17aa('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x91f4e1){logger[_0x17aa('0xc')](_0x91f4e1[_0x17aa('0x15')]);return null;}});}logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x53'),_0x507a86[_0x17aa('0x17')],_0x507a86['calleridname'],_0x507a86[_0x17aa('0x1a')],_0x507a86[_0x17aa('0x18')],_0x507a86[_0x17aa('0x1b')]));logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x54'),_0x507a86[_0x17aa('0x46')],_0x507a86[_0x17aa('0x47')],parseInt(_0x507a86[_0x17aa('0x48')],0xa)+0x1));_0x507a86[_0x17aa('0x55')](_0x507a86[_0x17aa('0x46')],_0x507a86['extension'],parseInt(_0x507a86['priority'],0xa)+0x1);_0x507a86[_0x17aa('0x36')]();}}else{logger[_0x17aa('0xc')](util['format']('Project\x20%s\x20not\x20published',_0x507a86[_0x17aa('0x17')]));_0x507a86[_0x17aa('0x55')](_0x507a86[_0x17aa('0x46')],_0x507a86[_0x17aa('0x47')],parseInt(_0x507a86[_0x17aa('0x48')],0xa)+0x1);_0x507a86[_0x17aa('0x36')]();}}else{logger[_0x17aa('0xc')](util[_0x17aa('0xf')]('Project\x20%s\x20not\x20found',_0x507a86['arg_1']));_0x507a86[_0x17aa('0x55')](_0x507a86[_0x17aa('0x46')],_0x507a86['extension'],parseInt(_0x507a86['priority'],0xa)+0x1);_0x507a86[_0x17aa('0x36')]();}}function main(){var _0x4fe2f7;return utilLicense[_0x17aa('0x56')]()['then'](function(_0x2c0ef5){if(_0x2c0ef5){if(_0x2c0ef5[_0x17aa('0x57')]){if(_0x2c0ef5[_0x17aa('0x58')]&&_0x2c0ef5[_0x17aa('0x58')]>0x0){logger[_0x17aa('0x1c')](util[_0x17aa('0xf')](_0x17aa('0x59'),_0x2c0ef5[_0x17aa('0x58')]));_0x4fe2f7=_0x2c0ef5['callysquare'];}else{logger['info'](_0x17aa('0x5a'));}}else{logger[_0x17aa('0x1c')](_0x17aa('0x5b'));_0x4fe2f7=-0x1;}}})[_0x17aa('0x2f')](function(_0x1dbf43){logger['error']('[LICENSE]',_0x1dbf43[_0x17aa('0x15')]);})[_0x17aa('0x4f')](function(){var _0x26f7ba=require(_0x17aa('0x5c'))(config[_0x17aa('0x6')][_0x17aa('0xe')],config[_0x17aa('0x6')]['ip'],_0x4fe2f7);_0x26f7ba['on'](_0x17aa('0xc'),errorHandler);_0x26f7ba['on'](_0x17aa('0x5d'),listeningHandler);_0x26f7ba['on'](_0x17aa('0x5e'),connectionHandler);_0x26f7ba['on'](_0x17aa('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x3c1a=['start','clear','vertex','VERTEX','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','code','result','isUndefined','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','127.0.0.1','nextTick','error','log','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[%s]\x20%s','message','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','close','evtHangup','production','YYYY-MM-DD\x20HH:mm:ss','mxCell','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','LOOP\x20through\x20graph','traverseBFS'];(function(_0x20f5fa,_0x3b479e){var _0x35ab42=function(_0x2e605a){while(--_0x2e605a){_0x20f5fa['push'](_0x20f5fa['shift']());}};_0x35ab42(++_0x3b479e);}(_0x3c1a,0xda));var _0xa3c1=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0x3c1a[_0x3f25db];return _0x54f29d;};'use strict';var parser=require(_0xa3c1('0x0'));var _=require(_0xa3c1('0x1'));var syncho=require(_0xa3c1('0x2'));var util=require(_0xa3c1('0x3'));var moment=require(_0xa3c1('0x4'));var config=require(_0xa3c1('0x5'));var logger=require(_0xa3c1('0x6'))('agi');var utilLicense=require(_0xa3c1('0x7'));var rpc=require('./rpc');var mailRpc=require(_0xa3c1('0x8'));var Graph=require(_0xa3c1('0x9'));var Vertices=require(_0xa3c1('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa3c1('0xb')]=_['defaults'](config['agi'],{'ip':_0xa3c1('0xc'),'port':0x11dd});function connectionHandler(_0x1aa471){process[_0xa3c1('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1aa471);agiHandler(_0x1aa471);}catch(_0x1e45c6){logger[_0xa3c1('0xe')](_0x1e45c6['stack']);}});});}function listeningHandler(){console[_0xa3c1('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger['info'](util[_0xa3c1('0x10')](_0xa3c1('0x11'),config[_0xa3c1('0xb')]['ip'],config[_0xa3c1('0xb')][_0xa3c1('0x12')]));}function errorHandler(_0x1ce473){if(_0x1ce473&&_0x1ce473[_0xa3c1('0x13')]&&_0x1ce473['message']){logger[_0xa3c1('0xe')](util[_0xa3c1('0x10')](_0xa3c1('0x14'),_0x1ce473[_0xa3c1('0x13')],_0x1ce473[_0xa3c1('0x15')]));}else{logger[_0xa3c1('0xe')](util[_0xa3c1('0x10')]('[ERROR]\x20%s',_0x1ce473[_0xa3c1('0x16')]));}}function closeHandler(){logger[_0xa3c1('0x17')](util['format'](_0xa3c1('0x18'),this[_0xa3c1('0x19')],this['calleridname'],this['callerid'],this[_0xa3c1('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1d0077){logger['error'](_0x1d0077['stack']);}}function timeoutHandler(){logger[_0xa3c1('0x17')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa3c1('0x19')],this[_0xa3c1('0x1b')],this['callerid'],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0xa3c1('0x17')](util[_0xa3c1('0x10')](_0xa3c1('0x1c'),this[_0xa3c1('0x19')],this[_0xa3c1('0x1b')],this['callerid'],this[_0xa3c1('0x1a')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x5ec5cf){return parser['toJson'](_0x5ec5cf,{'object':!![]})[_0xa3c1('0x1d')][_0xa3c1('0x1e')];}function addVertex(_0x1400e0,_0x321ae8,_0x558713){_0x321ae8[_0xa3c1('0x1f')]=_0x558713;if(_0x321ae8[_0xa3c1('0x20')](_0xa3c1('0x21'))){_0x321ae8[_0xa3c1('0x22')]=parseInt(_0x321ae8['retry'],0xa);}_0x1400e0['addVertex'](_[_0xa3c1('0x23')](_0x321ae8,'mxCell'));}function initGraph(_0x34569c,_0x353fb6){var _0x3194fa=new Graph();for(var _0x3a7052 in _0x34569c){if(_0x34569c[_0xa3c1('0x20')](_0x3a7052)){if(_[_0xa3c1('0x24')](_0x34569c[_0x3a7052])){for(var _0x11d226=0x0;_0x11d226<_0x34569c[_0x3a7052][_0xa3c1('0x25')];_0x11d226+=0x1){addVertex(_0x3194fa,_0x34569c[_0x3a7052][_0x11d226],_0x3a7052);}}else{addVertex(_0x3194fa,_0x34569c[_0x3a7052],_0x3a7052);}}}for(var _0x54d233=0x0;_0x54d233<_0x353fb6[_0xa3c1('0x25')];_0x54d233+=0x1){if(_0x353fb6[_0x54d233][_0xa3c1('0x26')]&&_0x353fb6[_0x54d233][_0xa3c1('0x27')]){_0x3194fa[_0xa3c1('0x28')](_0x353fb6[_0x54d233][_0xa3c1('0x26')],_0x353fb6[_0x54d233][_0xa3c1('0x27')],_0x353fb6[_0x54d233][_0xa3c1('0x29')]);}}return _0x3194fa;}function getSquareProject(_0x409d12,_0x3d440f){rpc[_0xa3c1('0x2a')](_0x409d12)[_0xa3c1('0x2b')](function(_0x38fe18){_0x3d440f(null,_0x38fe18);})[_0xa3c1('0x2c')](function(_0x257afe){_0x3d440f(null,_0x257afe);});}function createSquareReport(_0x15660c,_0x4cde8c){rpc[_0xa3c1('0x2d')](_0x15660c)[_0xa3c1('0x2b')](function(_0x15a8f3){if(_0x4cde8c){_0x4cde8c(null,_0x15a8f3);}})[_0xa3c1('0x2c')](function(_0x42e7b4){if(_0x4cde8c){_0x4cde8c(null,_0x42e7b4);}});}function setChannelVariables(_0x19e4be){for(var _0x4391b9 in _0x19e4be){if(_0x19e4be[_0xa3c1('0x20')](_0x4391b9)){if(_0x4391b9[_0xa3c1('0x2e')]('agi_')===0x0){_0x19e4be[_0x4391b9[_0xa3c1('0x2f')](0x4)]=_0x19e4be[_0x4391b9];delete _0x19e4be[_0x4391b9];}}}}function getLogFromObject(_0x474583){return util[_0xa3c1('0x30')](_0x474583,{'showHidden':![],'depth':null});}function agiHandler(_0xd693a5){var _0x8d98ee,_0x18db67,_0x19430c,_0x19da4b,_0xdfc44a;logger[_0xa3c1('0x31')](_0xa3c1('0x32'),JSON[_0xa3c1('0x33')](_0xd693a5,null,0x2));logger[_0xa3c1('0x17')](util['format'](_0xa3c1('0x34'),_0xd693a5[_0xa3c1('0x19')],_0xd693a5['calleridname'],_0xd693a5[_0xa3c1('0x35')],_0xd693a5['dnid'],_0xd693a5['uniqueid']));_0xd693a5['on'](_0xa3c1('0xe'),errorHandler);_0xd693a5['on'](_0xa3c1('0x36'),closeHandler);_0xd693a5['on']('timeout',timeoutHandler);_0xd693a5[_0xa3c1('0x37')]=![];_0xd693a5['on']('hangup',hangupHandler);var _0x4f27d4=getSquareProject['sync'](null,_0xd693a5[_0xa3c1('0x19')]);if(_0x4f27d4){if(_0x4f27d4['production']){_0x8d98ee=getRoot(_0x4f27d4[_0xa3c1('0x38')]);console[_0xa3c1('0xf')]('SQUAREROOT',_0x8d98ee);if(_0x8d98ee&&_0x8d98ee['start']){logger[_0xa3c1('0x31')](_0xa3c1('0x1e'),JSON[_0xa3c1('0x33')](_0x8d98ee,null,0x2));_0xd693a5['joinAt']=moment()[_0xa3c1('0x10')](_0xa3c1('0x39'));_0x18db67=initGraph(_[_0xa3c1('0x23')](_0x8d98ee,_0xa3c1('0x3a')),_0x8d98ee['mxCell']);_0x19430c=new Vertices(_0xd693a5,rpc,mailRpc);console[_0xa3c1('0xf')](_0xa3c1('0x3b'),_0x19430c);logger[_0xa3c1('0x17')](util[_0xa3c1('0x10')](_0xa3c1('0x3c'),_0xd693a5[_0xa3c1('0x19')],_0xd693a5['calleridname'],_0xd693a5[_0xa3c1('0x35')],_0xd693a5['dnid'],_0xd693a5[_0xa3c1('0x3d')]));console[_0xa3c1('0xf')](_0xa3c1('0x3e'));_0x18db67[_0xa3c1('0x3f')](_0x8d98ee[_0xa3c1('0x40')]['id'],function(_0x3cf736){try{_0x3cf736=_0x19430c[_0xa3c1('0x41')](_0x3cf736);logger['debug'](_0xa3c1('0x42'),JSON[_0xa3c1('0x33')](_0x3cf736,null,0x2));console[_0xa3c1('0xf')](_0xa3c1('0x43'),_0x3cf736);if(_0x3cf736[_0xa3c1('0x1f')]===_0xa3c1('0x44')){logger[_0xa3c1('0x17')](_0xa3c1('0x45'));_0xd693a5['context']=_0x3cf736['context']||_0xd693a5[_0xa3c1('0x46')];_0xd693a5[_0xa3c1('0x47')]=_0x3cf736[_0xa3c1('0x47')];_0xd693a5[_0xa3c1('0x48')]=_0x3cf736[_0xa3c1('0x48')]?_0x3cf736[_0xa3c1('0x48')]-0x1:0x1;return null;}else if(_0x3cf736&&_0x19430c[_0x3cf736['agicommand']]){_0xdfc44a=_0x19430c[_0x3cf736[_0xa3c1('0x1f')]](_0x3cf736);console[_0xa3c1('0xf')](_0xa3c1('0x49'),_0xdfc44a);logger[_0xa3c1('0x17')](_0xa3c1('0x4a'),JSON[_0xa3c1('0x33')](_0xdfc44a,null,0x2));if(_0xdfc44a&&_0xdfc44a[_0xa3c1('0x4b')]===AGI_CODE_SUCCESS&&_0xdfc44a[_0xa3c1('0x4c')]!==AGI_RESULT_ERROR&&!_0xd693a5[_0xa3c1('0x37')]){logger[_0xa3c1('0x31')](_0xa3c1('0x4a'),getLogFromObject(_0xdfc44a));return _[_0xa3c1('0x4d')](_0xdfc44a[_0xa3c1('0x4c')])?null:_0xdfc44a[_0xa3c1('0x4c')]['toString']();}else{logger[_0xa3c1('0xe')](_0xa3c1('0x4a'),getLogFromObject(_0xdfc44a));return null;}}else{logger[_0xa3c1('0xe')](_0xa3c1('0x4e'));return null;}}catch(_0x329645){logger[_0xa3c1('0xe')](_0x329645['stack']);return null;}});if(_0x8d98ee['finally']){logger['info'](util['format'](_0xa3c1('0x4f'),_0xd693a5[_0xa3c1('0x19')],_0xd693a5[_0xa3c1('0x1b')],_0xd693a5[_0xa3c1('0x35')],_0xd693a5['dnid'],_0xd693a5[_0xa3c1('0x3d')]));_0x18db67[_0xa3c1('0x3f')](_0x8d98ee[_0xa3c1('0x50')]['id'],function(_0x3c068e){try{_0x3c068e=_0x19430c[_0xa3c1('0x41')](_0x3c068e);logger[_0xa3c1('0x31')](_0xa3c1('0x42'),JSON[_0xa3c1('0x33')](_0x3c068e,null,0x2));if(_0x3c068e&&_0x19430c[_0x3c068e[_0xa3c1('0x1f')]]){_0xdfc44a=_0x19430c[_0x3c068e[_0xa3c1('0x1f')]](_0x3c068e);if(_0xdfc44a){logger[_0xa3c1('0x31')](_0xa3c1('0x4a'),getLogFromObject(_0xdfc44a));return _[_0xa3c1('0x4d')](_0xdfc44a[_0xa3c1('0x4c')])?null:_0xdfc44a[_0xa3c1('0x4c')][_0xa3c1('0x51')]();}else{logger['error'](_0xa3c1('0x4a'),getLogFromObject(_0xdfc44a));return null;}}else{logger[_0xa3c1('0xe')](_0xa3c1('0x4e'));return null;}}catch(_0x211f7f){logger[_0xa3c1('0xe')](_0x211f7f[_0xa3c1('0x16')]);return null;}});}logger[_0xa3c1('0x17')](util['format'](_0xa3c1('0x52'),_0xd693a5[_0xa3c1('0x19')],_0xd693a5[_0xa3c1('0x1b')],_0xd693a5[_0xa3c1('0x35')],_0xd693a5[_0xa3c1('0x1a')],_0xd693a5[_0xa3c1('0x3d')]));logger['info'](util[_0xa3c1('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xd693a5['context'],_0xd693a5[_0xa3c1('0x47')],parseInt(_0xd693a5[_0xa3c1('0x48')],0xa)+0x1));_0xd693a5[_0xa3c1('0x53')](_0xd693a5[_0xa3c1('0x46')],_0xd693a5[_0xa3c1('0x47')],parseInt(_0xd693a5[_0xa3c1('0x48')],0xa)+0x1);_0xd693a5[_0xa3c1('0x36')]();}}else{logger['error'](util[_0xa3c1('0x10')](_0xa3c1('0x54'),_0xd693a5[_0xa3c1('0x19')]));_0xd693a5[_0xa3c1('0x53')](_0xd693a5[_0xa3c1('0x46')],_0xd693a5[_0xa3c1('0x47')],parseInt(_0xd693a5[_0xa3c1('0x48')],0xa)+0x1);_0xd693a5[_0xa3c1('0x36')]();}}else{logger['error'](util[_0xa3c1('0x10')](_0xa3c1('0x55'),_0xd693a5[_0xa3c1('0x19')]));_0xd693a5[_0xa3c1('0x53')](_0xd693a5[_0xa3c1('0x46')],_0xd693a5[_0xa3c1('0x47')],parseInt(_0xd693a5['priority'],0xa)+0x1);_0xd693a5[_0xa3c1('0x36')]();}}function main(){var _0xc1521d;return utilLicense['getLicense']()[_0xa3c1('0x2b')](function(_0x560291){if(_0x560291){if(_0x560291[_0xa3c1('0x56')]){if(_0x560291['callysquare']&&_0x560291[_0xa3c1('0x57')]>0x0){logger[_0xa3c1('0x17')](util[_0xa3c1('0x10')](_0xa3c1('0x58'),_0x560291[_0xa3c1('0x57')]));_0xc1521d=_0x560291[_0xa3c1('0x57')];}else{logger[_0xa3c1('0x17')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xa3c1('0x17')](_0xa3c1('0x59'));_0xc1521d=-0x1;}}})[_0xa3c1('0x2c')](function(_0x22746e){logger[_0xa3c1('0xe')](_0xa3c1('0x5a'),_0x22746e[_0xa3c1('0x16')]);})['finally'](function(){var _0x18e833=require(_0xa3c1('0x5b'))(config[_0xa3c1('0xb')][_0xa3c1('0x12')],config[_0xa3c1('0xb')]['ip'],_0xc1521d);_0x18e833['on'](_0xa3c1('0xe'),errorHandler);_0x18e833['on'](_0xa3c1('0x5c'),listeningHandler);_0x18e833['on'](_0xa3c1('0x5d'),connectionHandler);_0x18e833['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 5a5d04d..98a0229 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0xfcf655,_0x5ae91a){var _0x356485=function(_0xabc736){while(--_0xabc736){_0xfcf655['push'](_0xfcf655['shift']());}};_0x356485(++_0x5ae91a);}(_0x34e8,0x12c));var _0x834e=function(_0x5dfa3c,_0x352a60){_0x5dfa3c=_0x5dfa3c-0x0;var _0x4b3c6b=_0x34e8[_0x5dfa3c];return _0x4b3c6b;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x51b0fc,_0xfc3203){var _0x10c36d=function(_0x40c79b){while(--_0x40c79b){_0x51b0fc['push'](_0x51b0fc['shift']());}};_0x10c36d(++_0xfc3203);}(_0x34e8,0x12c));var _0x834e=function(_0x17fba1,_0x21937c){_0x17fba1=_0x17fba1-0x0;var _0x2f6bc4=_0x34e8[_0x17fba1];return _0x2f6bc4;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 47e7434..1a13b4b 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xb10b,0x12a));var _0xbb10=function(_0x346e6b,_0x1f4479){_0x346e6b=_0x346e6b-0x0;var _0x15f973=_0xb10b[_0x346e6b];return _0x15f973;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x40a988,_0x1ff48e){var _0x1b6054=function(_0x5b8c30){while(--_0x5b8c30){_0x40a988['push'](_0x40a988['shift']());}};_0x1b6054(++_0x1ff48e);}(_0x7a54,0x106));var _0x47a5=function(_0x2ea283,_0x4777ff){_0x2ea283=_0x2ea283-0x0;var _0x110e57=_0x7a54[_0x2ea283];return _0x110e57;};'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 c921430..39dd3a7 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 _0x60eb=['CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','then','error','message','result','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','dsn','getUserById','ShowUser','getContactByPhone','rpcreq','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x60eb,0x17e));var _0xb60e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x60eb[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0xb60e('0x0'));var moment=require(_0xb60e('0x1'));var _=require('lodash');var util=require(_0xb60e('0x2'));var jayson=require(_0xb60e('0x3'));var client=jayson[_0xb60e('0x4')][_0xb60e('0x5')]({'port':0x2329});function request(_0x18e900,_0x270f19){return new BPromise(function(_0x57c830,_0xf6b228){return client['request'](_0x18e900,_0x270f19)[_0xb60e('0x6')](function(_0x4fc548){if(_0x4fc548[_0xb60e('0x7')]){return _0xf6b228(_0x4fc548['error'][_0xb60e('0x8')]);}else{return _0x57c830(_0x4fc548[_0xb60e('0x9')]);}})['catch'](function(_0x5abde7){return _0xf6b228(_0x5abde7);});});}exports['getSquareProject']=function(_0x4c4b51){return request(_0xb60e('0xa'),{'options':{'raw':![],'where':{'name':_0x4c4b51},'attributes':['production']}});};exports[_0xb60e('0xb')]=function(_0x52571d){return request(_0xb60e('0xc'),{'options':{'raw':![],'where':{'id':_0x52571d},'include':[{'model':_0xb60e('0xd'),'as':_0xb60e('0xe')}],'attributes':['id',_0xb60e('0xf'),_0xb60e('0x10')]}});};exports[_0xb60e('0x11')]=function(_0x46a611){return request(_0xb60e('0xa'),{'options':{'where':{'id':_0x46a611},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x12')]=function(_0x472aa3){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x472aa3},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x13')]=function(_0x4bca2a){return request(_0xb60e('0x14'),{'options':{'where':{'id':_0x4bca2a},'attributes':[_0xb60e('0xf')]}});};exports['getSquareOdbcById']=function(_0x29e0d7){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x29e0d7},'attributes':[_0xb60e('0x15')]}});};exports[_0xb60e('0x16')]=function(_0x361eae){return request(_0xb60e('0x17'),{'options':{'where':{'id':_0x361eae},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x18')]=function(_0x4e3c3d){console['log'](_0xb60e('0x19'),_0x4e3c3d);return request(_0xb60e('0x1a'),{'options':{'where':{'phone':_0x4e3c3d[_0xb60e('0x1b')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x11fa42){return request(_0xb60e('0x1c'),{'options':{'where':{'id':_0x11fa42},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x1d')]=function(_0x14ecdc){return request(_0xb60e('0x1e'),{'options':{'where':{'id':_0x14ecdc},'attributes':[_0xb60e('0x1f')]}});};exports[_0xb60e('0x20')]=function(_0x1360e0){return request(_0xb60e('0x21'),{'options':{'raw':![],'where':{'id':_0x1360e0},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0xb60e('0x22')]=function(_0x203797){return request(_0xb60e('0x23'),{'options':{'where':{'id':_0x203797},'attributes':['id',_0xb60e('0xf')]}});};exports['createSmsMessage']=function(_0x5106fd){return request(_0xb60e('0x24'),{'body':_0x5106fd});};exports[_0xb60e('0x25')]=function(_0x1e9370){return request('CreateSquareDetailsReport',{'body':_0x1e9370});};exports[_0xb60e('0x26')]=function(_0x400088){return request(_0xb60e('0x27'),{'body':_[_0xb60e('0x28')](_0x400088,{'project_name':_0x400088[_0xb60e('0x29')],'prev_project_name':_0x400088[_0xb60e('0x2a')]||'','is_subproject':_0x400088['arg_2']?!![]:![],'leaveAt':moment()[_0xb60e('0x2b')](_0xb60e('0x2c'))})});};exports[_0xb60e('0x2d')]=function(_0x515499){return request(_0xb60e('0x2e'),{'body':_0x515499});};exports[_0xb60e('0x2f')]=function(_0xb04028){return request(_0xb60e('0x30'),{'body':_0xb04028});};exports[_0xb60e('0x31')]=function(_0x21b245){return request(_0xb60e('0x32'),{'options':{'raw':![],'where':{'phone':_0x21b245[_0xb60e('0x1b')],'ListId':_0x21b245[_0xb60e('0x33')]}}})[_0xb60e('0x6')](function(_0x3b4b81){if(_0x3b4b81){return _0x3b4b81;}return request(_0xb60e('0x34'),{'body':_0x21b245});});};exports[_0xb60e('0x35')]=function(_0x1452bb){return request(_0xb60e('0x36'),{'options':{'where':{'id':_0x1452bb},'attributes':[_0xb60e('0xf')]}});};exports[_0xb60e('0x37')]=function(_0x17199e,_0x416d33){return request(_0xb60e('0x38'),{'body':{'interface':_0x416d33},'options':{'where':_0x17199e}});};exports[_0xb60e('0x39')]=function(_0x56d9ee,_0x144bb3,_0x5e3be8){return request('PauseUser',{'body':{'type':_0x144bb3,'uniqueid':_0x5e3be8},'options':{'where':_0x56d9ee}});};exports[_0xb60e('0x3a')]=function(_0x526e60){return request(_0xb60e('0x3b'),{'body':{},'options':{'where':_0x526e60}});};exports[_0xb60e('0x3c')]=function(_0x41ec3f){return request(_0xb60e('0x3d'),{'body':{},'options':{'where':_0x41ec3f}});}; \ No newline at end of file +var _0x8790=['MailServerOut','Smtp','name','email','ShowVoiceQueue','getVariableById','ShowVariable','dsn','getUserById','ShowUser','getContactByPhone','log','rpcreq','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentUnpause','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','http','request','then','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8790,0x67));var _0x0879=function(_0x515bea,_0x4a59ef){_0x515bea=_0x515bea-0x0;var _0x8e643b=_0x8790[_0x515bea];return _0x8e643b;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0879('0x0'));var _=require(_0x0879('0x1'));var util=require(_0x0879('0x2'));var jayson=require(_0x0879('0x3'));var client=jayson['client'][_0x0879('0x4')]({'port':0x2329});function request(_0x49872f,_0xf0f4f3){return new BPromise(function(_0x1bb6bc,_0xa22d24){return client[_0x0879('0x5')](_0x49872f,_0xf0f4f3)[_0x0879('0x6')](function(_0x2036e5){if(_0x2036e5[_0x0879('0x7')]){return _0xa22d24(_0x2036e5[_0x0879('0x7')][_0x0879('0x8')]);}else{return _0x1bb6bc(_0x2036e5[_0x0879('0x9')]);}})['catch'](function(_0x3fba0d){return _0xa22d24(_0x3fba0d);});});}exports[_0x0879('0xa')]=function(_0x3fcd8a){return request(_0x0879('0xb'),{'options':{'raw':![],'where':{'name':_0x3fcd8a},'attributes':[_0x0879('0xc')]}});};exports[_0x0879('0xd')]=function(_0x1f73d1){return request(_0x0879('0xe'),{'options':{'raw':![],'where':{'id':_0x1f73d1},'include':[{'model':_0x0879('0xf'),'as':_0x0879('0x10')}],'attributes':['id',_0x0879('0x11'),_0x0879('0x12')]}});};exports['getSquareProjectById']=function(_0x58dbe0){return request(_0x0879('0xb'),{'options':{'where':{'id':_0x58dbe0},'attributes':[_0x0879('0x11')]}});};exports['getVoiceQueueById']=function(_0x44f464){return request(_0x0879('0x13'),{'options':{'where':{'id':_0x44f464},'attributes':[_0x0879('0x11')]}});};exports[_0x0879('0x14')]=function(_0xf8002f){return request(_0x0879('0x15'),{'options':{'where':{'id':_0xf8002f},'attributes':[_0x0879('0x11')]}});};exports['getSquareOdbcById']=function(_0x7995cd){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x7995cd},'attributes':[_0x0879('0x16')]}});};exports[_0x0879('0x17')]=function(_0x36eab2){return request(_0x0879('0x18'),{'options':{'where':{'id':_0x36eab2},'attributes':['name']}});};exports[_0x0879('0x19')]=function(_0x4a7332){console[_0x0879('0x1a')](_0x0879('0x1b'),_0x4a7332);return request(_0x0879('0x1c'),{'options':{'where':{'phone':_0x4a7332[_0x0879('0x1d')]},'attributes':['id']}});};exports[_0x0879('0x1e')]=function(_0x45165b){return request('ShowTrunk',{'options':{'where':{'id':_0x45165b},'attributes':[_0x0879('0x11')]}});};exports[_0x0879('0x1f')]=function(_0x23eed5){return request(_0x0879('0x20'),{'options':{'where':{'id':_0x23eed5},'attributes':[_0x0879('0x21')]}});};exports[_0x0879('0x22')]=function(_0x261ee9){return request(_0x0879('0x23'),{'options':{'raw':![],'where':{'id':_0x261ee9},'include':[{'model':_0x0879('0x24'),'as':_0x0879('0x25')}]}});};exports[_0x0879('0x26')]=function(_0x4941ca){return request(_0x0879('0x27'),{'options':{'where':{'id':_0x4941ca},'attributes':['id',_0x0879('0x11')]}});};exports['createSmsMessage']=function(_0x3bfc6){return request(_0x0879('0x28'),{'body':_0x3bfc6});};exports[_0x0879('0x29')]=function(_0x55ec5b){return request(_0x0879('0x2a'),{'body':_0x55ec5b});};exports[_0x0879('0x2b')]=function(_0xe30d18){return request(_0x0879('0x2c'),{'body':_[_0x0879('0x2d')](_0xe30d18,{'project_name':_0xe30d18[_0x0879('0x2e')],'prev_project_name':_0xe30d18[_0x0879('0x2f')]||'','is_subproject':_0xe30d18[_0x0879('0x2f')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x0879('0x30')]=function(_0x1809f2){return request('CreateSquareRecording',{'body':_0x1809f2});};exports['createSquareMessage']=function(_0x351cb7){return request(_0x0879('0x31'),{'body':_0x351cb7});};exports['createCmContact']=function(_0x24fd7f){return request(_0x0879('0x32'),{'options':{'raw':![],'where':{'phone':_0x24fd7f['phone'],'ListId':_0x24fd7f[_0x0879('0x33')]}}})[_0x0879('0x6')](function(_0x5c1046){if(_0x5c1046){return _0x5c1046;}return request(_0x0879('0x34'),{'body':_0x24fd7f});});};exports['getPauseById']=function(_0x535719){return request(_0x0879('0x35'),{'options':{'where':{'id':_0x535719},'attributes':['name']}});};exports[_0x0879('0x36')]=function(_0xbf7e5d,_0x37fcd7){return request(_0x0879('0x37'),{'body':{'interface':_0x37fcd7},'options':{'where':_0xbf7e5d}});};exports['agentPause']=function(_0x8b86dd,_0x30df96,_0x54f3fa){return request('PauseUser',{'body':{'type':_0x30df96,'uniqueid':_0x54f3fa},'options':{'where':_0x8b86dd}});};exports[_0x0879('0x38')]=function(_0x272297){return request('UnpauseUser',{'body':{},'options':{'where':_0x272297}});};exports[_0x0879('0x39')]=function(_0x897935){return request(_0x0879('0x3a'),{'body':{},'options':{'where':_0x897935}});}; \ 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 3a1570f..4b26e39 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 _0x8ce3=['./lex','./polly'];(function(_0x1e475c,_0x3bf7b4){var _0x2bf368=function(_0x4caefd){while(--_0x4caefd){_0x1e475c['push'](_0x1e475c['shift']());}};_0x2bf368(++_0x3bf7b4);}(_0x8ce3,0xc3));var _0x38ce=function(_0x4cce81,_0x252735){_0x4cce81=_0x4cce81-0x0;var _0xad14bc=_0x8ce3[_0x4cce81];return _0xad14bc;};var polly=require(_0x38ce('0x0'));var lex=require(_0x38ce('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x70e0=['exports','./polly','./lex'];(function(_0x20c1a5,_0x14c8d0){var _0x462ded=function(_0x5f7c66){while(--_0x5f7c66){_0x20c1a5['push'](_0x20c1a5['shift']());}};_0x462ded(++_0x14c8d0);}(_0x70e0,0x17b));var _0x070e=function(_0x3fb793,_0x1c705e){_0x3fb793=_0x3fb793-0x0;var _0x5ec9cc=_0x70e0[_0x3fb793];return _0x5ec9cc;};var polly=require(_0x070e('0x0'));var lex=require(_0x070e('0x1'));module[_0x070e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index ff56406..9bee793 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 _0xd0bb=['exports','./lib/api'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x8bca3f,_0x158cf8){_0x8bca3f=_0x8bca3f-0x0;var _0x448ab5=_0xd0bb[_0x8bca3f];return _0x448ab5;};'use strict';var lex=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]=function(_0x43bfb8,_0x5793c9,_0x68ea36,_0x4ab08f,_0x39b03a,_0x1f6ec3){return lex(_0x43bfb8,_0x5793c9,_0x68ea36,_0x4ab08f,_0x39b03a,_0x1f6ec3);}; \ No newline at end of file +var _0xc3fe=['exports','./lib/api'];(function(_0x5a62e6,_0x184c1f){var _0x285b3c=function(_0x342134){while(--_0x342134){_0x5a62e6['push'](_0x5a62e6['shift']());}};_0x285b3c(++_0x184c1f);}(_0xc3fe,0xff));var _0xec3f=function(_0x50d48f,_0x2755d3){_0x50d48f=_0x50d48f-0x0;var _0x33f5cf=_0xc3fe[_0x50d48f];return _0x33f5cf;};'use strict';var lex=require(_0xec3f('0x0'));module[_0xec3f('0x1')]=function(_0xc1dd73,_0x4d38a1,_0x15ddf0,_0x2a45d9,_0x2d85fc,_0x553ad4){return lex(_0xc1dd73,_0x4d38a1,_0x15ddf0,_0x2a45d9,_0x2d85fc,_0x553ad4);}; \ 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 9a0a737..c892a9d 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 _0xd191=['exports','LexRuntime','bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xd191,0xe2));var _0x1d19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd191[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x1d19('0x0'));var AWS=require(_0x1d19('0x1'));function lexResult(_0x32fb2c,_0x441e67){return new BPromise(function(_0x48f927,_0x5230e2){_0x32fb2c[_0x1d19('0x2')](_0x441e67,function(_0x3495f5,_0x2b1f5b){if(_0x3495f5){_0x5230e2(_0x3495f5);}if(_0x2b1f5b[_0x1d19('0x3')]){for(const _0x523e81 in _0x2b1f5b[_0x1d19('0x3')]){if(_0x2b1f5b['slots'][_0x1d19('0x4')](_0x523e81)){var _0x568932=_0x2b1f5b[_0x1d19('0x3')][_0x523e81];_0x2b1f5b[_0x1d19('0x5')+_0x523e81]=_0x568932;}}}_0x48f927(_0x2b1f5b);});});}module[_0x1d19('0x6')]=function(_0x25d07d,_0x51febb,_0x35c64b,_0x179ea5,_0x3906b6,_0x3a2036){var _0xb7d00a=new AWS[(_0x1d19('0x7'))]({'accessKeyId':_0x51febb,'secretAccessKey':_0x35c64b,'region':_0x179ea5});var _0x5d5737={'botAlias':'$LATEST','botName':_0x3a2036,'inputText':_0x3906b6,'userId':_0x25d07d};return lexResult(_0xb7d00a,_0x5d5737);}; \ No newline at end of file +var _0xbd38=['exports','aws-sdk','slots','slot_'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xbd38,0x14d));var _0x8bd3=function(_0x4f5c95,_0xe3e0c7){_0x4f5c95=_0x4f5c95-0x0;var _0x27c064=_0xbd38[_0x4f5c95];return _0x27c064;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x8bd3('0x0'));function lexResult(_0xd10480,_0x474b1f){return new BPromise(function(_0x2e7a6f,_0x30b2ae){_0xd10480['postText'](_0x474b1f,function(_0x500358,_0xad9e0b){if(_0x500358){_0x30b2ae(_0x500358);}if(_0xad9e0b[_0x8bd3('0x1')]){for(const _0x2f27cd in _0xad9e0b[_0x8bd3('0x1')]){if(_0xad9e0b[_0x8bd3('0x1')]['hasOwnProperty'](_0x2f27cd)){var _0x49b24=_0xad9e0b[_0x8bd3('0x1')][_0x2f27cd];_0xad9e0b[_0x8bd3('0x2')+_0x2f27cd]=_0x49b24;}}}_0x2e7a6f(_0xad9e0b);});});}module[_0x8bd3('0x3')]=function(_0x212613,_0x262c73,_0x38aad6,_0x2d172a,_0x2e580a,_0x14e51f){var _0x175221=new AWS['LexRuntime']({'accessKeyId':_0x262c73,'secretAccessKey':_0x38aad6,'region':_0x2d172a});var _0x20f741={'botAlias':'$LATEST','botName':_0x14e51f,'inputText':_0x2e580a,'userId':_0x212613};return lexResult(_0x175221,_0x20f741);}; \ 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 a2214ad..b880cf9 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 _0x43b3=['./lib/api','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x43b3,0x1be));var _0x343b=function(_0x34a278,_0x28a04d){_0x34a278=_0x34a278-0x0;var _0x1f38bb=_0x43b3[_0x34a278];return _0x1f38bb;};'use strict';var polly=require(_0x343b('0x0'));module[_0x343b('0x1')]=function(_0x270336,_0x5e69cb,_0x359a96,_0x4002bb,_0x5136e5,_0x4a1d43,_0x28ea0d){return polly(_0x270336,_0x5e69cb,_0x359a96,_0x4002bb,_0x5136e5,_0x4a1d43,_0x28ea0d);}; \ No newline at end of file +var _0x6519=['./lib/api','exports'];(function(_0x23cca9,_0xc7df47){var _0x449f95=function(_0x161afc){while(--_0x161afc){_0x23cca9['push'](_0x23cca9['shift']());}};_0x449f95(++_0xc7df47);}(_0x6519,0x18a));var _0x9651=function(_0x526818,_0x30c916){_0x526818=_0x526818-0x0;var _0x44c7e3=_0x6519[_0x526818];return _0x44c7e3;};'use strict';var polly=require(_0x9651('0x0'));module[_0x9651('0x1')]=function(_0x59b570,_0x53b49e,_0x51b9de,_0x2d5378,_0x4c8f98,_0x528712,_0x480f94){return polly(_0x59b570,_0x53b49e,_0x51b9de,_0x2d5378,_0x4c8f98,_0x528712,_0x480f94);}; \ 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 174a9ac..0c2c40e 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 _0x1664=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x5836d8,_0x4a568a){var _0x49a100=function(_0x4f817a){while(--_0x4f817a){_0x5836d8['push'](_0x5836d8['shift']());}};_0x49a100(++_0x4a568a);}(_0x1664,0x1a4));var _0x4166=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x1664[_0x26462c];return _0x509a42;};'use strict';var fs=require('fs');var path=require(_0x4166('0x0'));var BPromise=require(_0x4166('0x1'));var rs=require(_0x4166('0x2'));var AWS=require(_0x4166('0x3'));function pollyResult(_0x429f0c,_0x181ab2,_0x1e3580){return new BPromise(function(_0xad4812,_0xffa71e){_0x429f0c[_0x4166('0x4')](_0x181ab2,function(_0x4fd9b7,_0x467f3a){if(_0x4fd9b7){_0xffa71e(_0x4fd9b7);}else if(_0x467f3a){if(_0x467f3a[_0x4166('0x5')]instanceof Buffer){fs[_0x4166('0x6')](_0x1e3580,_0x467f3a['AudioStream'],function(_0x4c1bbf){if(_0x4c1bbf){_0xffa71e(_0x4c1bbf);}else{_0xad4812();}});}else{_0xffa71e(new Error(_0x4166('0x7')));}}else{_0xffa71e(new Error(_0x4166('0x8')));}});});}module[_0x4166('0x9')]=function(_0x36c3d0,_0x5d3b78,_0x2b1799,_0x1effd9,_0x323ac8,_0x212e95,_0x360359){var _0x33e330=new AWS[(_0x4166('0xa'))]({'accessKeyId':_0x36c3d0,'secretAccessKey':_0x5d3b78,'region':_0x2b1799});var _0x5eb427={'Text':_0x323ac8,'TextType':_0x212e95||_0x4166('0xb'),'OutputFormat':'mp3','VoiceId':_0x1effd9};return pollyResult(_0x33e330,_0x5eb427,_0x360359);}; \ No newline at end of file +var _0x7f69=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0x2b6c72,_0x180fe8){var _0x1f49b5=function(_0x43cb26){while(--_0x43cb26){_0x2b6c72['push'](_0x2b6c72['shift']());}};_0x1f49b5(++_0x180fe8);}(_0x7f69,0x8a));var _0x97f6=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x7f69[_0x8b8564];return _0x360c61;};'use strict';var fs=require('fs');var path=require(_0x97f6('0x0'));var BPromise=require(_0x97f6('0x1'));var rs=require(_0x97f6('0x2'));var AWS=require(_0x97f6('0x3'));function pollyResult(_0x528edb,_0x21f42e,_0x4e15ca){return new BPromise(function(_0x134158,_0x3dfc30){_0x528edb['synthesizeSpeech'](_0x21f42e,function(_0x30c855,_0x58f700){if(_0x30c855){_0x3dfc30(_0x30c855);}else if(_0x58f700){if(_0x58f700[_0x97f6('0x4')]instanceof Buffer){fs[_0x97f6('0x5')](_0x4e15ca,_0x58f700[_0x97f6('0x4')],function(_0x2c6b81){if(_0x2c6b81){_0x3dfc30(_0x2c6b81);}else{_0x134158();}});}else{_0x3dfc30(new Error(_0x97f6('0x6')));}}else{_0x3dfc30(new Error(_0x97f6('0x7')));}});});}module[_0x97f6('0x8')]=function(_0x1029dc,_0x251561,_0xbba2cf,_0x4af085,_0x84a343,_0x5e9ef0,_0x4f735f){var _0x4649fd=new AWS['Polly']({'accessKeyId':_0x1029dc,'secretAccessKey':_0x251561,'region':_0xbba2cf});var _0x11da51={'Text':_0x84a343,'TextType':_0x5e9ef0||_0x97f6('0x9'),'OutputFormat':_0x97f6('0xa'),'VoiceId':_0x4af085};return pollyResult(_0x4649fd,_0x11da51,_0x4f735f);}; \ 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 c350143..7111ab3 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 _0x43b4=['exports'];(function(_0x34a087,_0x4bd68e){var _0x5c15d7=function(_0x152823){while(--_0x152823){_0x34a087['push'](_0x34a087['shift']());}};_0x5c15d7(++_0x4bd68e);}(_0x43b4,0x11e));var _0x443b=function(_0x169879,_0x13ae35){_0x169879=_0x169879-0x0;var _0x1973ff=_0x43b4[_0x169879];return _0x1973ff;};'use strict';var asr=require('./lib/api');module[_0x443b('0x0')]=function(_0x14b5dc,_0xc74c53,_0x5ae52c,_0xcbd80d){return asr(_0x14b5dc,_0xc74c53,_0x5ae52c);}; \ No newline at end of file +var _0xe5f5=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5f5,0x1c9));var _0x5e5f=function(_0x297608,_0x29913f){_0x297608=_0x297608-0x0;var _0x165999=_0xe5f5[_0x297608];return _0x165999;};'use strict';var asr=require('./lib/api');module[_0x5e5f('0x0')]=function(_0x1f2313,_0x25a941,_0x43b799,_0x1e1187){return asr(_0x1f2313,_0x25a941,_0x43b799);}; \ 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 0e66d16..afad93b 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 _0x8a29=['toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8a29,0x113));var _0x98a2=function(_0x511021,_0x39d3d8){_0x511021=_0x511021-0x0;var _0xdb1bd9=_0x8a29[_0x511021];return _0xdb1bd9;};'use strict';var url=require(_0x98a2('0x0'));var BPromise=require(_0x98a2('0x1'));var fs=require('fs');var host=_0x98a2('0x2');module[_0x98a2('0x3')]=function(_0x131882,_0x36d074,_0xe02886){return new BPromise(function(_0x510450,_0x158719){var _0x3d8e53;if(typeof _0x131882!==_0x98a2('0x4')||_0x131882[_0x98a2('0x5')]===0x0){return _0x158719(_0x98a2('0x6'));}if(typeof _0x36d074!==_0x98a2('0x4')||_0x36d074[_0x98a2('0x5')]===0x0){return _0x158719(_0x98a2('0x7'));}if(typeof _0xe02886!==_0x98a2('0x8')&&(typeof _0xe02886!==_0x98a2('0x4')||_0xe02886[_0x98a2('0x5')]===0x0)){return _0x158719(_0x98a2('0x9'));}try{_0x3d8e53=fs['readFileSync'](_0x131882)[_0x98a2('0xa')](_0x98a2('0xb'));}catch(_0x98a8b8){return _0x158719(_0x98a8b8);}return _0x510450({'method':_0x98a2('0xc'),'uri':host+_0x98a2('0xd')+_0x36d074,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x98a2('0xe'),'languageCode':_0xe02886},'audio':{'content':_0x3d8e53}},'json':!![]});});}; \ No newline at end of file +var _0x3775=['POST','/v1/speech:recognize?key=','LINEAR16','8000','url','exports','length','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64'];(function(_0x5a11a6,_0x3016be){var _0x587761=function(_0x19e2be){while(--_0x19e2be){_0x5a11a6['push'](_0x5a11a6['shift']());}};_0x587761(++_0x3016be);}(_0x3775,0x1be));var _0x5377=function(_0x3caaee,_0x2267bc){_0x3caaee=_0x3caaee-0x0;var _0x16df54=_0x3775[_0x3caaee];return _0x16df54;};'use strict';var url=require(_0x5377('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x5377('0x1')]=function(_0x4c671c,_0x4b30f2,_0x111a6a){return new BPromise(function(_0x34fd61,_0x4b053d){var _0x5b93aa;if(typeof _0x4c671c!=='string'||_0x4c671c[_0x5377('0x2')]===0x0){return _0x4b053d('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4b30f2!==_0x5377('0x3')||_0x4b30f2[_0x5377('0x2')]===0x0){return _0x4b053d('key\x20should\x20be\x20a\x20string');}if(typeof _0x111a6a!==_0x5377('0x4')&&(typeof _0x111a6a!=='string'||_0x111a6a[_0x5377('0x2')]===0x0)){return _0x4b053d(_0x5377('0x5'));}try{_0x5b93aa=fs[_0x5377('0x6')](_0x4c671c)[_0x5377('0x7')](_0x5377('0x8'));}catch(_0x619e0d){return _0x4b053d(_0x619e0d);}return _0x34fd61({'method':_0x5377('0x9'),'uri':host+_0x5377('0xa')+_0x4b30f2,'body':{'config':{'encoding':_0x5377('0xb'),'sampleRateHertz':_0x5377('0xc'),'languageCode':_0x111a6a},'audio':{'content':_0x5b93aa}},'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 10cb4be..b3ab00b 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x2883=['./asr','exports'];(function(_0x35ed44,_0x265d05){var _0x479406=function(_0x95239a){while(--_0x95239a){_0x35ed44['push'](_0x35ed44['shift']());}};_0x479406(++_0x265d05);}(_0x2883,0x11e));var _0x3288=function(_0xec9ca0,_0x5eb6e3){_0xec9ca0=_0xec9ca0-0x0;var _0x14329f=_0x2883[_0xec9ca0];return _0x14329f;};var asr=require(_0x3288('0x0'));module[_0x3288('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 42810bb..d77882c 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 _0xf232=['text:synthesize','POST','generate','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','stringify','result','source','fulfillment','speech','status','metadata','endConversation','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','https','parse','bluebird','randomstring','sox','request-promise','google-tts-api','apiai-promise','md5','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','info','finish\x20download\x20file','close','unlink','end','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','audioConfig','MP3'];(function(_0x1f5a29,_0x3f8434){var _0x52e837=function(_0x712c90){while(--_0x712c90){_0x1f5a29['push'](_0x1f5a29['shift']());}};_0x52e837(++_0x3f8434);}(_0xf232,0x1d5));var _0x2f23=function(_0x20c449,_0x3cd6a1){_0x20c449=_0x20c449-0x0;var _0x272a63=_0xf232[_0x20c449];return _0x272a63;};'use strict';var fs=require('fs');var path=require(_0x2f23('0x0'));var http=require(_0x2f23('0x1'));var https=require(_0x2f23('0x2'));var urlParse=require('url')[_0x2f23('0x3')];var BPromise=require(_0x2f23('0x4'));var rs=require(_0x2f23('0x5'));var sox=require(_0x2f23('0x6'));var rp=require(_0x2f23('0x7'));var util=require('util');var querystring=require('querystring');var tts=require(_0x2f23('0x8'));var apiai=require(_0x2f23('0x9'));var md5=require(_0x2f23('0xa'));var google=require('./google');var aws=require(_0x2f23('0xb'));var tilde=require(_0x2f23('0xc'));var sestek=require(_0x2f23('0xd'));var logger=require(_0x2f23('0xe'))(_0x2f23('0xf'));var ISPEECH_API=_0x2f23('0x10');function downloadFile(_0x3280df,_0x475c4d){return new BPromise(function(_0x1f6ca9,_0x11c5de){var _0xdd8618=urlParse(_0x3280df);var _0xa0c84c=_0xdd8618[_0x2f23('0x11')]===_0x2f23('0x12')?https:http;var _0x42c7a3={'host':_0xdd8618[_0x2f23('0x13')],'path':_0xdd8618[_0x2f23('0x0')],'headers':{'user-agent':_0x2f23('0x14')}};_0xa0c84c[_0x2f23('0x15')](_0x42c7a3,function(_0x291236){if(_0x291236[_0x2f23('0x16')]!==0xc8){logger[_0x2f23('0x17')]('request\x20to\x20'+_0x3280df+_0x2f23('0x18')+_0x291236[_0x2f23('0x16')]+'\x20('+_0x291236[_0x2f23('0x19')]+')');_0x11c5de(new Error(_0x2f23('0x1a')+_0x3280df+_0x2f23('0x18')+_0x291236[_0x2f23('0x16')]+'\x20('+_0x291236[_0x2f23('0x19')]+')'));return;}var _0x17b13c=fs['createWriteStream'](_0x475c4d);_0x17b13c['on']('finish',function(){logger[_0x2f23('0x1b')](_0x2f23('0x1c'));_0x17b13c[_0x2f23('0x1d')](_0x1f6ca9);});_0x17b13c['on'](_0x2f23('0x17'),function(_0x437992){fs[_0x2f23('0x1e')](_0x475c4d);logger[_0x2f23('0x17')]('download\x20error',_0x437992);_0x11c5de(_0x437992);});_0x291236['pipe'](_0x17b13c);})['on'](_0x2f23('0x17'),function(_0x2efa93){logger[_0x2f23('0x17')](_0x2efa93);_0x11c5de(_0x2efa93);})[_0x2f23('0x1f')]();});}function uploadFile(_0x4cc013){return new BPromise(function(_0x273437,_0x3eeaab){var _0x1742e3=urlParse(_0x4cc013);var _0x7aade9=_0x1742e3['protocol']===_0x2f23('0x12')?https:http;var _0x27fbe7={'host':_0x1742e3['host'],'path':_0x1742e3['path'],'headers':{'user-agent':_0x2f23('0x14')}};_0x7aade9['get'](_0x27fbe7,function(_0x11e3cc){if(_0x11e3cc['statusCode']!==0xc8){_0x3eeaab(new Error(_0x2f23('0x1a')+_0x4cc013+_0x2f23('0x18')+_0x11e3cc[_0x2f23('0x16')]+'\x20('+_0x11e3cc[_0x2f23('0x19')]+')'));return;}var _0x5970ad='';_0x11e3cc['on'](_0x2f23('0x20'),function(_0xedcfb2){_0x5970ad+=_0xedcfb2;});_0x11e3cc['on'](_0x2f23('0x1f'),function(){_0x273437(_0x5970ad);});})['on'](_0x2f23('0x17'),function(_0x1d450f){_0x3eeaab(_0x1d450f);})[_0x2f23('0x1f')]();});}function convertFile(_0x106e69,_0x5232e9){return new BPromise(function(_0x1d5de0,_0x3a38da){var _0x4d658b=sox['transcode'](_0x106e69,_0x5232e9,{'sampleRate':0x1f40,'format':_0x2f23('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d658b['on'](_0x2f23('0x17'),function(_0x58374d){logger[_0x2f23('0x17')](_0x2f23('0x22'),_0x58374d);_0x3a38da(_0x58374d);});_0x4d658b['on']('end',function(){logger['info'](_0x2f23('0x23'));_0x1d5de0();});_0x4d658b[_0x2f23('0x24')]();});}function base64Decode(_0xf11a40,_0x55955a){var _0x515350=path[_0x2f23('0x25')](__dirname,_0x2f23('0x26'),rs['generate'](0x4)+_0x2f23('0x27'));fs['writeFileSync'](_0x515350,_0xf11a40,_0x2f23('0x28'));return convertFile(_0x515350,_0x55955a)[_0x2f23('0x29')](function(){try{fs[_0x2f23('0x1e')](_0x515350);fs[_0x2f23('0x2a')](_0x55955a,_0x2f23('0x2b'));}catch(_0x57b6d6){logger['error'](_0x57b6d6);}return _0x55955a[_0x2f23('0x2c')]('.')[0x0];});}function base64Encode(_0xf06ed6){var _0x3f1220=fs[_0x2f23('0x2d')](_0xf06ed6);return new Buffer(_0x3f1220)['toString'](_0x2f23('0x28'));}exports[_0x2f23('0x2e')]=function(_0x12378b,_0x363006,_0x381b32,_0x199bf8,_0x3e5f08,_0x2dc8ad){var _0x421855,_0x5e9c6d;var _0x518a6a=_0x2f23('0x2f');var _0x5cacbe='?key='+_0x12378b;var _0x34e730={};if(_0x363006==='ssml'){_0x34e730[_0x2f23('0x30')]={'ssml':_0x381b32};}else{_0x34e730['input']={'text':_0x381b32};};_0x34e730['voice']={'languageCode':_0x199bf8,'ssmlGender':_0x3e5f08};_0x34e730[_0x2f23('0x31')]={'audioEncoding':_0x2f23('0x32'),'sampleRateHertz':0x1f40};var _0x57b292={'url':_0x518a6a+_0x2f23('0x33')+_0x5cacbe,'method':_0x2f23('0x34'),'json':!![],'body':_0x34e730};return rp(_0x57b292)[_0x2f23('0x29')](function(_0x2ab550){return new BPromise(function(_0x1d9364,_0x9ac68){_0x421855=path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+_0x2f23('0x36'));var _0x13e5bb=Buffer['from'](_0x2ab550[_0x2f23('0x37')],_0x2f23('0x28'));return fs[_0x2f23('0x38')](_0x421855,_0x13e5bb,function(_0x137adc){_0x9ac68(_0x137adc);},function(_0x42da25){fs[_0x2f23('0x2a')](_0x421855,_0x2f23('0x2b'));_0x1d9364(_0x42da25);});});})['then'](function(_0x1b1bc2){_0x5e9c6d=path['resolve'](__dirname,_0x2f23('0x26'),rs['generate'](0x4)+_0x2f23('0x27'));return convertFile(_0x421855,_0x5e9c6d);})[_0x2f23('0x29')](function(){try{fs[_0x2f23('0x1e')](_0x421855);fs[_0x2f23('0x2a')](_0x5e9c6d,'777');}catch(_0x2f455b){logger[_0x2f23('0x17')](_0x2f455b);}logger[_0x2f23('0x1b')](_0x2f23('0x39'),_0x5e9c6d['split']('.')[0x0]);return _0x5e9c6d[_0x2f23('0x2c')]('.')[0x0];});};exports[_0x2f23('0x3a')]=function(_0x583ac6,_0x5f09d0){var _0x12f7fb,_0x314847;return tts(_0x583ac6,_0x5f09d0||'en',0x1)[_0x2f23('0x29')](function(_0x88edab){logger[_0x2f23('0x1b')](_0x88edab);_0x12f7fb=path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+_0x2f23('0x36'));return downloadFile(_0x88edab,_0x12f7fb);})[_0x2f23('0x29')](function(){_0x314847=path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+_0x2f23('0x27'));return convertFile(_0x12f7fb,_0x314847);})[_0x2f23('0x29')](function(){try{fs[_0x2f23('0x1e')](_0x12f7fb);fs[_0x2f23('0x2a')](_0x314847,'777');}catch(_0x398df2){logger[_0x2f23('0x17')](_0x398df2);}logger[_0x2f23('0x1b')](_0x2f23('0x3b'),_0x314847[_0x2f23('0x2c')]('.')[0x0]);return _0x314847[_0x2f23('0x2c')]('.')[0x0];});};exports[_0x2f23('0x3c')]=function(_0xe38e7c,_0x36f736,_0x8240c6){return google[_0x2f23('0x3d')](_0xe38e7c,_0x36f736,_0x8240c6)[_0x2f23('0x29')](function(_0x2d57e9){logger['info'](_0x2d57e9[_0x2f23('0x3e')]);return rp(_0x2d57e9);})['then'](function(_0x5cd740){var _0x25d9a6='';var _0x2f86e9=0x0;try{fs[_0x2f23('0x1e')](_0xe38e7c);}catch(_0x8eb220){logger[_0x2f23('0x17')](_0x8eb220);}if(_0x5cd740&&_0x5cd740[_0x2f23('0x3f')]){_0x25d9a6=_0x5cd740[_0x2f23('0x3f')][_0x2f23('0x40')](function(_0x563fd3){return _0x563fd3&&_0x563fd3[_0x2f23('0x41')][0x0]&&_0x563fd3[_0x2f23('0x41')][0x0][_0x2f23('0x42')]?_0x563fd3[_0x2f23('0x41')][0x0]['transcript']:'';})[_0x2f23('0x43')]('\x0a');_0x2f86e9=_0x5cd740[_0x2f23('0x3f')][_0x2f23('0x40')](function(_0x424e73){return _0x424e73&&_0x424e73['alternatives'][0x0]&&_0x424e73[_0x2f23('0x41')][0x0][_0x2f23('0x44')]?_0x424e73[_0x2f23('0x41')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x2f23('0x1b')]('googleASR\x20transcription',_0x25d9a6);logger[_0x2f23('0x1b')](_0x2f23('0x45'),_0x2f86e9);return{'transcript':_0x25d9a6,'confidence':_0x2f86e9};})[_0x2f23('0x46')](function(_0x1c42bd){logger[_0x2f23('0x17')](_0x2f23('0x47'),_0x1c42bd[_0x2f23('0x16')],_0x1c42bd[_0x2f23('0x48')],_0x1c42bd[_0x2f23('0x49')]);});};exports['googleDialogflow']=function(_0x308f3c,_0x20c3cb,_0x211e90,_0x4b4e10){var _0x287b7b=apiai(_0x20c3cb,{'language':_0x4b4e10||'en'});return _0x287b7b[_0x2f23('0x4a')](_0x211e90,{'sessionId':md5(_0x308f3c)})['then'](function(_0x30079e){logger[_0x2f23('0x1b')](JSON[_0x2f23('0x4b')](_0x30079e));return{'source':_0x30079e[_0x2f23('0x4c')][_0x2f23('0x4d')],'resolvedQuery':_0x30079e[_0x2f23('0x4c')]['resolvedQuery'],'action':_0x30079e[_0x2f23('0x4c')]['action'],'actionIncomplete':_0x30079e[_0x2f23('0x4c')]['actionIncomplete'],'speech':_0x30079e[_0x2f23('0x4c')][_0x2f23('0x4e')][_0x2f23('0x4f')],'score':_0x30079e[_0x2f23('0x4c')]['score'],'statusCode':_0x30079e[_0x2f23('0x50')]['code'],'endConversation':_0x30079e[_0x2f23('0x4c')][_0x2f23('0x51')][_0x2f23('0x52')]||![],'isFallbackIntent':_0x30079e['result'][_0x2f23('0x51')]['isFallbackIntent']};});};exports[_0x2f23('0x53')]=function(_0x34b495,_0x55be5c,_0x24d721,_0x132c10){return tilde[_0x2f23('0x3d')](_0x34b495,_0x55be5c,_0x24d721,_0x132c10)[_0x2f23('0x29')](function(_0x31edcc){try{fs[_0x2f23('0x1e')](_0x34b495);}catch(_0x6b6c17){logger[_0x2f23('0x17')](_0x6b6c17);}logger[_0x2f23('0x1b')](_0x2f23('0x54'),_0x31edcc[_0x2f23('0x42')]);logger[_0x2f23('0x1b')](_0x2f23('0x55'),_0x31edcc['confidence']);return _0x31edcc;});};exports[_0x2f23('0x56')]=function(_0x2bfb5f,_0x51f630,_0x3cc066,_0xfd709c,_0x41d97c,_0x56fe1e){var _0x3d5c17=path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+_0x2f23('0x36'));var _0x472069;return aws[_0x2f23('0x57')](_0x2bfb5f,_0x51f630,_0x3cc066,_0xfd709c,_0x41d97c,_0x56fe1e,_0x3d5c17)['then'](function(){_0x472069=path['resolve'](__dirname,_0x2f23('0x26'),rs['generate'](0x4)+_0x2f23('0x27'));return convertFile(_0x3d5c17,_0x472069);})['then'](function(){try{fs[_0x2f23('0x1e')](_0x3d5c17);fs[_0x2f23('0x2a')](_0x472069,'777');}catch(_0x152d96){logger[_0x2f23('0x17')](_0x152d96);}return _0x472069[_0x2f23('0x2c')]('.')[0x0];});};exports[_0x2f23('0x58')]=function(_0x4091b9,_0x43eed,_0x3d243f,_0x25c64b,_0x5de037,_0x370717){return aws['lex'](_0x4091b9,_0x43eed,_0x3d243f,_0x25c64b,_0x5de037,_0x370717)['then'](function(_0x29c0e6){logger[_0x2f23('0x1b')](JSON['stringify'](_0x29c0e6));return _0x29c0e6;});};exports[_0x2f23('0x59')]=function(_0x37568f,_0x40c2b7,_0x142bb0,_0x48c65f){var _0x383dab=util[_0x2f23('0x5a')](_0x2f23('0x5b'),ISPEECH_API,_0x37568f,encodeURIComponent(_0x40c2b7),_0x142bb0,_0x48c65f);var _0x4cf03f=path[_0x2f23('0x25')](__dirname,_0x2f23('0x26'),rs[_0x2f23('0x35')](0x4)+_0x2f23('0x36'));var _0x2cd863;return downloadFile(_0x383dab,_0x4cf03f)[_0x2f23('0x29')](function(){_0x2cd863=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x2f23('0x27'));return convertFile(_0x4cf03f,_0x2cd863);})[_0x2f23('0x29')](function(){try{fs[_0x2f23('0x1e')](_0x4cf03f);fs[_0x2f23('0x2a')](_0x2cd863,_0x2f23('0x2b'));}catch(_0x3bd1bf){logger[_0x2f23('0x17')](_0x3bd1bf);}return _0x2cd863[_0x2f23('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x544b7b,_0x2a2a14,_0x52e3b3,_0x2a1f83){var _0x571f42=util[_0x2f23('0x5a')](_0x2f23('0x5c'),ISPEECH_API,_0x2a2a14,_0x52e3b3,base64Encode(_0x544b7b),_0x2a1f83?util['format'](_0x2f23('0x5d'),encodeURIComponent(_0x2a1f83)):'freeform=3');return uploadFile(_0x571f42)[_0x2f23('0x29')](function(_0x2801bf){return querystring[_0x2f23('0x3')](_0x2801bf);});};exports[_0x2f23('0x5e')]=function(_0x4ae969,_0x1c0638){return sestek[_0x2f23('0x5f')](_0x4ae969,_0x1c0638)[_0x2f23('0x29')](function(_0x5b5007){logger['info'](JSON['stringify'](_0x5b5007));var _0x35f7a6={'speech':_0x5b5007[_0x2f23('0x60')],'action':_0x5b5007['channelData']?_0x5b5007[_0x2f23('0x61')][_0x2f23('0x62')]:undefined,'actiondata':_0x5b5007['channelData']?_0x5b5007[_0x2f23('0x61')][_0x2f23('0x63')]:undefined};if(_0x5b5007[_0x2f23('0x61')]&&_0x5b5007['channelData'][_0x2f23('0x64')]){return base64Decode(_0x5b5007[_0x2f23('0x61')][_0x2f23('0x64')][_0x2f23('0x65')],path[_0x2f23('0x25')](__dirname,'tmp',rs[_0x2f23('0x35')](0x4)+'.wav'))[_0x2f23('0x29')](function(_0x145816){_0x35f7a6[_0x2f23('0x66')]=_0x145816;return _0x35f7a6;});}return _0x35f7a6;});};exports[_0x2f23('0x67')]=function(){return __dirname;}; \ No newline at end of file +var _0x2c8e=['AudioFromTts','Data','dirName','https','parse','bluebird','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','path','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','protocol','host','get','data','wav','error\x20convert','start','resolve','tmp','generate','writeFileSync','then','chmodSync','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','.mp3','from','audioContent','base64','writeFile','.wav','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','map','alternatives','transcript','results','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','awsPolly','awsLex','lex','stringify','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','text','channelData','CustomAction'];(function(_0x3980ef,_0x295d1d){var _0x4d23f2=function(_0x392c77){while(--_0x392c77){_0x3980ef['push'](_0x3980ef['shift']());}};_0x4d23f2(++_0x295d1d);}(_0x2c8e,0x144));var _0xe2c8=function(_0x47953d,_0x25115f){_0x47953d=_0x47953d-0x0;var _0x34de41=_0x2c8e[_0x47953d];return _0x34de41;};'use strict';var fs=require('fs');var path=require('path');var http=require('http');var https=require(_0xe2c8('0x0'));var urlParse=require('url')[_0xe2c8('0x1')];var BPromise=require(_0xe2c8('0x2'));var rs=require('randomstring');var sox=require(_0xe2c8('0x3'));var rp=require(_0xe2c8('0x4'));var util=require(_0xe2c8('0x5'));var querystring=require(_0xe2c8('0x6'));var tts=require(_0xe2c8('0x7'));var apiai=require(_0xe2c8('0x8'));var md5=require(_0xe2c8('0x9'));var google=require(_0xe2c8('0xa'));var aws=require(_0xe2c8('0xb'));var tilde=require(_0xe2c8('0xc'));var sestek=require(_0xe2c8('0xd'));var logger=require(_0xe2c8('0xe'))(_0xe2c8('0xf'));var ISPEECH_API=_0xe2c8('0x10');function downloadFile(_0x2c68cb,_0x1315b5){return new BPromise(function(_0x1e58a7,_0x397fe6){var _0x4dbc76=urlParse(_0x2c68cb);var _0x1c41f9=_0x4dbc76['protocol']==='https:'?https:http;var _0x2a87a1={'host':_0x4dbc76['host'],'path':_0x4dbc76[_0xe2c8('0x11')],'headers':{'user-agent':_0xe2c8('0x12')}};_0x1c41f9['get'](_0x2a87a1,function(_0x31c626){if(_0x31c626['statusCode']!==0xc8){logger[_0xe2c8('0x13')](_0xe2c8('0x14')+_0x2c68cb+_0xe2c8('0x15')+_0x31c626['statusCode']+'\x20('+_0x31c626[_0xe2c8('0x16')]+')');_0x397fe6(new Error(_0xe2c8('0x14')+_0x2c68cb+'\x20failed,\x20status\x20code\x20=\x20'+_0x31c626[_0xe2c8('0x17')]+'\x20('+_0x31c626[_0xe2c8('0x16')]+')'));return;}var _0x3b31e2=fs['createWriteStream'](_0x1315b5);_0x3b31e2['on'](_0xe2c8('0x18'),function(){logger[_0xe2c8('0x19')](_0xe2c8('0x1a'));_0x3b31e2[_0xe2c8('0x1b')](_0x1e58a7);});_0x3b31e2['on'](_0xe2c8('0x13'),function(_0x1dc3d4){fs[_0xe2c8('0x1c')](_0x1315b5);logger['error'](_0xe2c8('0x1d'),_0x1dc3d4);_0x397fe6(_0x1dc3d4);});_0x31c626['pipe'](_0x3b31e2);})['on'](_0xe2c8('0x13'),function(_0x379059){logger[_0xe2c8('0x13')](_0x379059);_0x397fe6(_0x379059);})[_0xe2c8('0x1e')]();});}function uploadFile(_0x15ad1d){return new BPromise(function(_0x515cde,_0x5657a1){var _0x3efbb5=urlParse(_0x15ad1d);var _0x310da2=_0x3efbb5[_0xe2c8('0x1f')]==='https:'?https:http;var _0x4919f4={'host':_0x3efbb5[_0xe2c8('0x20')],'path':_0x3efbb5[_0xe2c8('0x11')],'headers':{'user-agent':_0xe2c8('0x12')}};_0x310da2[_0xe2c8('0x21')](_0x4919f4,function(_0x2da143){if(_0x2da143[_0xe2c8('0x17')]!==0xc8){_0x5657a1(new Error('request\x20to\x20'+_0x15ad1d+_0xe2c8('0x15')+_0x2da143[_0xe2c8('0x17')]+'\x20('+_0x2da143['statusMessage']+')'));return;}var _0x3f96a0='';_0x2da143['on'](_0xe2c8('0x22'),function(_0x35c086){_0x3f96a0+=_0x35c086;});_0x2da143['on'](_0xe2c8('0x1e'),function(){_0x515cde(_0x3f96a0);});})['on'](_0xe2c8('0x13'),function(_0x4e52ea){_0x5657a1(_0x4e52ea);})[_0xe2c8('0x1e')]();});}function convertFile(_0x96f33,_0x583149){return new BPromise(function(_0x2fab98,_0x1ac3a2){var _0xbe9b0=sox['transcode'](_0x96f33,_0x583149,{'sampleRate':0x1f40,'format':_0xe2c8('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xbe9b0['on'](_0xe2c8('0x13'),function(_0x5ce9a2){logger[_0xe2c8('0x13')](_0xe2c8('0x24'),_0x5ce9a2);_0x1ac3a2(_0x5ce9a2);});_0xbe9b0['on']('end',function(){logger[_0xe2c8('0x19')]('finish\x20to\x20convert');_0x2fab98();});_0xbe9b0[_0xe2c8('0x25')]();});}function base64Decode(_0x1592dd,_0x1e76a4){var _0x1dbcc2=path[_0xe2c8('0x26')](__dirname,_0xe2c8('0x27'),rs[_0xe2c8('0x28')](0x4)+'.wav');fs[_0xe2c8('0x29')](_0x1dbcc2,_0x1592dd,'base64');return convertFile(_0x1dbcc2,_0x1e76a4)[_0xe2c8('0x2a')](function(){try{fs[_0xe2c8('0x1c')](_0x1dbcc2);fs[_0xe2c8('0x2b')](_0x1e76a4,_0xe2c8('0x2c'));}catch(_0x48c744){logger[_0xe2c8('0x13')](_0x48c744);}return _0x1e76a4[_0xe2c8('0x2d')]('.')[0x0];});}function base64Encode(_0x128b57){var _0x360a31=fs[_0xe2c8('0x2e')](_0x128b57);return new Buffer(_0x360a31)['toString']('base64');}exports['googleCloudTTS']=function(_0x287a06,_0x35ce51,_0x1b7a0f,_0x44d30a,_0x3589dd,_0x1caecf){var _0x1f347d,_0x5429df;var _0x5d9cf2=_0xe2c8('0x2f');var _0x1d3cc8=_0xe2c8('0x30')+_0x287a06;var _0xe74150={};if(_0x35ce51===_0xe2c8('0x31')){_0xe74150[_0xe2c8('0x32')]={'ssml':_0x1b7a0f};}else{_0xe74150['input']={'text':_0x1b7a0f};};_0xe74150['voice']={'languageCode':_0x44d30a,'ssmlGender':_0x3589dd};_0xe74150['audioConfig']={'audioEncoding':_0xe2c8('0x33'),'sampleRateHertz':0x1f40};var _0xa58dea={'url':_0x5d9cf2+_0xe2c8('0x34')+_0x1d3cc8,'method':'POST','json':!![],'body':_0xe74150};return rp(_0xa58dea)[_0xe2c8('0x2a')](function(_0x1bd4d8){return new BPromise(function(_0x2ba0c3,_0x2f60b4){_0x1f347d=path[_0xe2c8('0x26')](__dirname,_0xe2c8('0x27'),rs[_0xe2c8('0x28')](0x4)+_0xe2c8('0x35'));var _0x42a04e=Buffer[_0xe2c8('0x36')](_0x1bd4d8[_0xe2c8('0x37')],_0xe2c8('0x38'));return fs[_0xe2c8('0x39')](_0x1f347d,_0x42a04e,function(_0x31b188){_0x2f60b4(_0x31b188);},function(_0x116563){fs['chmodSync'](_0x1f347d,_0xe2c8('0x2c'));_0x2ba0c3(_0x116563);});});})[_0xe2c8('0x2a')](function(_0x3b7a87){_0x5429df=path[_0xe2c8('0x26')](__dirname,_0xe2c8('0x27'),rs[_0xe2c8('0x28')](0x4)+_0xe2c8('0x3a'));return convertFile(_0x1f347d,_0x5429df);})[_0xe2c8('0x2a')](function(){try{fs[_0xe2c8('0x1c')](_0x1f347d);fs[_0xe2c8('0x2b')](_0x5429df,_0xe2c8('0x2c'));}catch(_0x1720d6){logger[_0xe2c8('0x13')](_0x1720d6);}logger['info'](_0xe2c8('0x3b'),_0x5429df[_0xe2c8('0x2d')]('.')[0x0]);return _0x5429df[_0xe2c8('0x2d')]('.')[0x0];});};exports[_0xe2c8('0x3c')]=function(_0x3dc995,_0xef176c){var _0x8558d4,_0xdad58e;return tts(_0x3dc995,_0xef176c||'en',0x1)[_0xe2c8('0x2a')](function(_0x269bdf){logger['info'](_0x269bdf);_0x8558d4=path['resolve'](__dirname,_0xe2c8('0x27'),rs['generate'](0x4)+'.mp3');return downloadFile(_0x269bdf,_0x8558d4);})['then'](function(){_0xdad58e=path[_0xe2c8('0x26')](__dirname,_0xe2c8('0x27'),rs[_0xe2c8('0x28')](0x4)+'.wav');return convertFile(_0x8558d4,_0xdad58e);})[_0xe2c8('0x2a')](function(){try{fs[_0xe2c8('0x1c')](_0x8558d4);fs['chmodSync'](_0xdad58e,'777');}catch(_0x12941b){logger[_0xe2c8('0x13')](_0x12941b);}logger[_0xe2c8('0x19')](_0xe2c8('0x3d'),_0xdad58e[_0xe2c8('0x2d')]('.')[0x0]);return _0xdad58e['split']('.')[0x0];});};exports[_0xe2c8('0x3e')]=function(_0x4f5c26,_0x2062da,_0x39441d){return google[_0xe2c8('0x3f')](_0x4f5c26,_0x2062da,_0x39441d)['then'](function(_0x5a6506){logger[_0xe2c8('0x19')](_0x5a6506[_0xe2c8('0x40')]);return rp(_0x5a6506);})['then'](function(_0x27ea47){var _0x264cf3='';var _0x57c700=0x0;try{fs[_0xe2c8('0x1c')](_0x4f5c26);}catch(_0x369fd1){logger[_0xe2c8('0x13')](_0x369fd1);}if(_0x27ea47&&_0x27ea47['results']){_0x264cf3=_0x27ea47['results'][_0xe2c8('0x41')](function(_0x99d6e4){return _0x99d6e4&&_0x99d6e4['alternatives'][0x0]&&_0x99d6e4[_0xe2c8('0x42')][0x0][_0xe2c8('0x43')]?_0x99d6e4['alternatives'][0x0][_0xe2c8('0x43')]:'';})['join']('\x0a');_0x57c700=_0x27ea47[_0xe2c8('0x44')][_0xe2c8('0x41')](function(_0x31e6e9){return _0x31e6e9&&_0x31e6e9['alternatives'][0x0]&&_0x31e6e9[_0xe2c8('0x42')][0x0][_0xe2c8('0x45')]?_0x31e6e9[_0xe2c8('0x42')][0x0][_0xe2c8('0x45')]:0x0;})[_0xe2c8('0x46')]('\x0a');}logger['info'](_0xe2c8('0x47'),_0x264cf3);logger[_0xe2c8('0x19')](_0xe2c8('0x48'),_0x57c700);return{'transcript':_0x264cf3,'confidence':_0x57c700};})[_0xe2c8('0x49')](function(_0x4cd971){logger[_0xe2c8('0x13')]('[%s]\x20%s:%s',_0x4cd971['statusCode'],_0x4cd971[_0xe2c8('0x4a')],_0x4cd971[_0xe2c8('0x4b')]);});};exports[_0xe2c8('0x4c')]=function(_0x2486c0,_0x5e3ff8,_0x2a6ba7,_0x242243){var _0x5fd32b=apiai(_0x5e3ff8,{'language':_0x242243||'en'});return _0x5fd32b[_0xe2c8('0x4d')](_0x2a6ba7,{'sessionId':md5(_0x2486c0)})[_0xe2c8('0x2a')](function(_0x129643){logger['info'](JSON['stringify'](_0x129643));return{'source':_0x129643[_0xe2c8('0x4e')][_0xe2c8('0x4f')],'resolvedQuery':_0x129643['result'][_0xe2c8('0x50')],'action':_0x129643[_0xe2c8('0x4e')][_0xe2c8('0x51')],'actionIncomplete':_0x129643['result'][_0xe2c8('0x52')],'speech':_0x129643[_0xe2c8('0x4e')][_0xe2c8('0x53')]['speech'],'score':_0x129643['result'][_0xe2c8('0x54')],'statusCode':_0x129643[_0xe2c8('0x55')][_0xe2c8('0x56')],'endConversation':_0x129643[_0xe2c8('0x4e')][_0xe2c8('0x57')][_0xe2c8('0x58')]||![],'isFallbackIntent':_0x129643[_0xe2c8('0x4e')]['metadata'][_0xe2c8('0x59')]};});};exports[_0xe2c8('0x5a')]=function(_0x3651c8,_0x3a06b0,_0x39f64f,_0x34bb52){return tilde['asr'](_0x3651c8,_0x3a06b0,_0x39f64f,_0x34bb52)[_0xe2c8('0x2a')](function(_0xa5d990){try{fs[_0xe2c8('0x1c')](_0x3651c8);}catch(_0x370594){logger[_0xe2c8('0x13')](_0x370594);}logger['info']('Tilde\x20ASR\x20transcription',_0xa5d990[_0xe2c8('0x43')]);logger['info']('Tilde\x20ASR\x20confidence',_0xa5d990[_0xe2c8('0x45')]);return _0xa5d990;});};exports[_0xe2c8('0x5b')]=function(_0x805d18,_0x402929,_0x113a46,_0x16fc4d,_0x9e8f26,_0x357284){var _0x499f06=path[_0xe2c8('0x26')](__dirname,_0xe2c8('0x27'),rs[_0xe2c8('0x28')](0x4)+'.mp3');var _0x2ef132;return aws['polly'](_0x805d18,_0x402929,_0x113a46,_0x16fc4d,_0x9e8f26,_0x357284,_0x499f06)[_0xe2c8('0x2a')](function(){_0x2ef132=path[_0xe2c8('0x26')](__dirname,_0xe2c8('0x27'),rs[_0xe2c8('0x28')](0x4)+_0xe2c8('0x3a'));return convertFile(_0x499f06,_0x2ef132);})['then'](function(){try{fs[_0xe2c8('0x1c')](_0x499f06);fs[_0xe2c8('0x2b')](_0x2ef132,_0xe2c8('0x2c'));}catch(_0x1d5195){logger[_0xe2c8('0x13')](_0x1d5195);}return _0x2ef132[_0xe2c8('0x2d')]('.')[0x0];});};exports[_0xe2c8('0x5c')]=function(_0x6cb879,_0x145470,_0x192e51,_0x1b3962,_0x156518,_0xf7a8ca){return aws[_0xe2c8('0x5d')](_0x6cb879,_0x145470,_0x192e51,_0x1b3962,_0x156518,_0xf7a8ca)[_0xe2c8('0x2a')](function(_0x14e779){logger[_0xe2c8('0x19')](JSON[_0xe2c8('0x5e')](_0x14e779));return _0x14e779;});};exports[_0xe2c8('0x5f')]=function(_0x29bae2,_0x47e94e,_0x1e2c8b,_0xc39e22){var _0x4b6f4f=util[_0xe2c8('0x60')](_0xe2c8('0x61'),ISPEECH_API,_0x29bae2,encodeURIComponent(_0x47e94e),_0x1e2c8b,_0xc39e22);var _0x56c8a5=path[_0xe2c8('0x26')](__dirname,_0xe2c8('0x27'),rs[_0xe2c8('0x28')](0x4)+'.mp3');var _0x17ab44;return downloadFile(_0x4b6f4f,_0x56c8a5)[_0xe2c8('0x2a')](function(){_0x17ab44=path['resolve'](__dirname,_0xe2c8('0x27'),rs[_0xe2c8('0x28')](0x4)+_0xe2c8('0x3a'));return convertFile(_0x56c8a5,_0x17ab44);})[_0xe2c8('0x2a')](function(){try{fs['unlink'](_0x56c8a5);fs[_0xe2c8('0x2b')](_0x17ab44,_0xe2c8('0x2c'));}catch(_0x567691){logger[_0xe2c8('0x13')](_0x567691);}return _0x17ab44[_0xe2c8('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x4ce5bf,_0x2e565d,_0x30014e,_0x14598f){var _0x21175b=util[_0xe2c8('0x60')](_0xe2c8('0x62'),ISPEECH_API,_0x2e565d,_0x30014e,base64Encode(_0x4ce5bf),_0x14598f?util[_0xe2c8('0x60')]('model=%s',encodeURIComponent(_0x14598f)):_0xe2c8('0x63'));return uploadFile(_0x21175b)[_0xe2c8('0x2a')](function(_0x429e42){return querystring[_0xe2c8('0x1')](_0x429e42);});};exports['sestekNDA']=function(_0x5a03f3,_0x27ae4c){return sestek[_0xe2c8('0x64')](_0x5a03f3,_0x27ae4c)[_0xe2c8('0x2a')](function(_0x2f8f9c){logger[_0xe2c8('0x19')](JSON[_0xe2c8('0x5e')](_0x2f8f9c));var _0x49c313={'speech':_0x2f8f9c[_0xe2c8('0x65')],'action':_0x2f8f9c[_0xe2c8('0x66')]?_0x2f8f9c[_0xe2c8('0x66')][_0xe2c8('0x67')]:undefined,'actiondata':_0x2f8f9c['channelData']?_0x2f8f9c[_0xe2c8('0x66')]['CustomActionData']:undefined};if(_0x2f8f9c['channelData']&&_0x2f8f9c[_0xe2c8('0x66')]['AudioFromTts']){return base64Decode(_0x2f8f9c[_0xe2c8('0x66')][_0xe2c8('0x68')][_0xe2c8('0x69')],path[_0xe2c8('0x26')](__dirname,_0xe2c8('0x27'),rs['generate'](0x4)+_0xe2c8('0x3a')))[_0xe2c8('0x2a')](function(_0x30b82f){_0x49c313['audiofile']=_0x30b82f;return _0x49c313;});}return _0x49c313;});};exports[_0xe2c8('0x6a')]=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 fe63f50..5ad04d1 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 _0x293b=['./nda'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x293b,0x141));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};var nda=require(_0xb293('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x9de1=['./nda','exports'];(function(_0x5d8e77,_0x1a0c80){var _0x28dc3a=function(_0x2b0052){while(--_0x2b0052){_0x5d8e77['push'](_0x5d8e77['shift']());}};_0x28dc3a(++_0x1a0c80);}(_0x9de1,0x1ea));var _0x19de=function(_0x47bf54,_0x327a53){_0x47bf54=_0x47bf54-0x0;var _0x2b75bc=_0x9de1[_0x47bf54];return _0x2b75bc;};var nda=require(_0x19de('0x0'));module[_0x19de('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 f2b99a5..3817ff1 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 _0xdcbd=['custom_action','CustomAction','custom_action_data','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav'];(function(_0x4ee698,_0x4b588f){var _0x503343=function(_0x385a5){while(--_0x385a5){_0x4ee698['push'](_0x4ee698['shift']());}};_0x503343(++_0x4b588f);}(_0xdcbd,0x104));var _0xddcb=function(_0x16491d,_0x46db64){_0x16491d=_0x16491d-0x0;var _0x4d471b=_0xdcbd[_0x16491d];return _0x4d471b;};'use strict';var rp=require('request-promise');var url=require(_0xddcb('0x0'));var logger=require(_0xddcb('0x1'))(_0xddcb('0x2'));module[_0xddcb('0x3')]=function(_0x3cc80b,_0x14225f){var _0x3009fe={'method':_0xddcb('0x4'),'uri':url[_0xddcb('0x5')](_0x14225f[_0xddcb('0x6')],_0xddcb('0x7')),'form':{'grant_type':_0xddcb('0x8'),'username':_0x14225f[_0xddcb('0x9')],'password':_0x14225f['password']},'json':!![]};return rp(_0x3009fe)['then'](function(_0x3f86be){var _0x146729={'method':_0xddcb('0x4'),'uri':url[_0xddcb('0x5')](_0x14225f['ndassistant_url'],_0xddcb('0xa')),'body':{'type':_0x14225f[_0xddcb('0xb')]||_0xddcb('0xc'),'channelId':_0xddcb('0xd'),'conversation':{'id':_0x3cc80b[_0xddcb('0xe')]},'from':{'id':_0x3cc80b[_0xddcb('0xf')],'name':_0x3cc80b[_0xddcb('0x10')]},'recipient':{'id':_0x3cc80b[_0xddcb('0x11')],'name':_0x3cc80b[_0xddcb('0x12')]},'text':_0x14225f[_0xddcb('0x13')],'channelData':{}},'headers':{'Authorization':_0xddcb('0x14')+_0x3f86be[_0xddcb('0x15')]},'json':!![]};if(_0x14225f['project']){_0x146729[_0xddcb('0x16')][_0xddcb('0x17')][_0xddcb('0x18')]=_0x14225f[_0xddcb('0x19')];}if(_0x14225f['ndagenerate_audio']=='1'){_0x146729[_0xddcb('0x16')][_0xddcb('0x17')][_0xddcb('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xddcb('0x1b')};}if(_0x14225f[_0xddcb('0x1c')]){_0x146729['body'][_0xddcb('0x17')][_0xddcb('0x1d')]=_0x14225f[_0xddcb('0x1c')];if(_0x14225f[_0xddcb('0x1e')]){_0x146729[_0xddcb('0x16')][_0xddcb('0x17')]['CustomActionData']=_0x14225f[_0xddcb('0x1e')];}}logger['info'](JSON[_0xddcb('0x1f')](_0x146729));return rp(_0x146729);});}; \ No newline at end of file +var _0xfdb6=['Nda','uniqueid','callerid','calleridname','extension','text','access_token','body','channelData','project','ndagenerate_audio','audio/wav','CustomAction','custom_action','CustomActionData','custom_action_data','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndaactivity_type','message'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xfdb6,0x1b0));var _0x6fdb=function(_0x100b8d,_0x1d5879){_0x100b8d=_0x100b8d-0x0;var _0x8f8590=_0xfdb6[_0x100b8d];return _0x8f8590;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')(_0x6fdb('0x0'));module[_0x6fdb('0x1')]=function(_0x3a041e,_0x3822a7){var _0x4f9d62={'method':_0x6fdb('0x2'),'uri':url[_0x6fdb('0x3')](_0x3822a7[_0x6fdb('0x4')],_0x6fdb('0x5')),'form':{'grant_type':_0x6fdb('0x6'),'username':_0x3822a7['username'],'password':_0x3822a7[_0x6fdb('0x6')]},'json':!![]};return rp(_0x4f9d62)[_0x6fdb('0x7')](function(_0x1aa31a){var _0x7a2ff4={'method':_0x6fdb('0x2'),'uri':url[_0x6fdb('0x3')](_0x3822a7['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3822a7[_0x6fdb('0x8')]||_0x6fdb('0x9'),'channelId':_0x6fdb('0xa'),'conversation':{'id':_0x3a041e[_0x6fdb('0xb')]},'from':{'id':_0x3a041e[_0x6fdb('0xc')],'name':_0x3a041e[_0x6fdb('0xd')]},'recipient':{'id':_0x3a041e['dnid'],'name':_0x3a041e[_0x6fdb('0xe')]},'text':_0x3822a7[_0x6fdb('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x1aa31a[_0x6fdb('0x10')]},'json':!![]};if(_0x3822a7['project']){_0x7a2ff4[_0x6fdb('0x11')][_0x6fdb('0x12')]['ProjectName']=_0x3822a7[_0x6fdb('0x13')];}if(_0x3822a7[_0x6fdb('0x14')]=='1'){_0x7a2ff4[_0x6fdb('0x11')][_0x6fdb('0x12')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6fdb('0x15')};}if(_0x3822a7['custom_action']){_0x7a2ff4[_0x6fdb('0x11')][_0x6fdb('0x12')][_0x6fdb('0x16')]=_0x3822a7[_0x6fdb('0x17')];if(_0x3822a7['custom_action_data']){_0x7a2ff4[_0x6fdb('0x11')][_0x6fdb('0x12')][_0x6fdb('0x18')]=_0x3822a7[_0x6fdb('0x19')];}}logger['info'](JSON['stringify'](_0x7a2ff4));return rp(_0x7a2ff4);});}; \ 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 ee6bc91..5fccb3c 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 _0x4350=['./lib/api','exports'];(function(_0x520a2d,_0x2e77b7){var _0x179c82=function(_0x14d3c6){while(--_0x14d3c6){_0x520a2d['push'](_0x520a2d['shift']());}};_0x179c82(++_0x2e77b7);}(_0x4350,0x1d0));var _0x0435=function(_0x1a1f22,_0x5e3378){_0x1a1f22=_0x1a1f22-0x0;var _0x299d41=_0x4350[_0x1a1f22];return _0x299d41;};'use strict';var asr=require(_0x0435('0x0'));module[_0x0435('0x1')]=function(_0x4970c7,_0x165bec,_0x57ff95,_0x1527f9){return asr(_0x4970c7,_0x165bec,_0x57ff95,_0x1527f9);}; \ No newline at end of file +var _0xcb62=['./lib/api'];(function(_0x4ed40b,_0x44d3aa){var _0x242033=function(_0xdb6e58){while(--_0xdb6e58){_0x4ed40b['push'](_0x4ed40b['shift']());}};_0x242033(++_0x44d3aa);}(_0xcb62,0x6c));var _0x2cb6=function(_0x4e9e8d,_0xcc83ba){_0x4e9e8d=_0x4e9e8d-0x0;var _0x1e2dfb=_0xcb62[_0x4e9e8d];return _0x1e2dfb;};'use strict';var asr=require(_0x2cb6('0x0'));module['exports']=function(_0x55e83b,_0x1563b0,_0x33dae9,_0x25b6ac){return asr(_0x55e83b,_0x1563b0,_0x33dae9,_0x25b6ac);}; \ 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 3b3b6d9..5b2d4ec 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 _0x6d96=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','lodash','moment','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','status','result','final','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x39daac,_0x2075fd){var _0x522cb2=function(_0x1fbf04){while(--_0x1fbf04){_0x39daac['push'](_0x39daac['shift']());}};_0x522cb2(++_0x2075fd);}(_0x6d96,0x1ce));var _0x66d9=function(_0x3a88a2,_0x4d1357){_0x3a88a2=_0x3a88a2-0x0;var _0x10fb3b=_0x6d96[_0x3a88a2];return _0x10fb3b;};'use strict';var BPromise=require('bluebird');var _=require(_0x66d9('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x66d9('0x1'));var crypto=require(_0x66d9('0x2'));var logger=require(_0x66d9('0x3'))('agi');module['exports']=function(_0x4f2104,_0x447616,_0x25a6fd,_0x201a01){return new BPromise(function(_0x404711,_0x210e2f){logger[_0x66d9('0x4')](_0x66d9('0x5'),_0x201a01||_0x66d9('0x6'));var _0x1da611=new WebSocket(_0x201a01||_0x66d9('0x6'),{'perMessageDeflate':![]});var _0x496602='';var _0x2a5d48='0';var _0x7505f0='1';var _0x52ad22=_0x66d9('0x7');function _0x3499cb(_0x3b50b2){var _0xd6eaa8=crypto[_0x66d9('0x8')](_0x66d9('0x9'));_0xd6eaa8[_0x66d9('0xa')](_0x3b50b2);return _0xd6eaa8[_0x66d9('0xb')](_0x66d9('0xc'));}function _0x2e04b2(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0xccc81c=moment()[_0x66d9('0xd')]();var _0x17102a=_0x3499cb(_0xccc81c+_0x447616+_0x25a6fd);_0x1da611[_0x66d9('0xe')](JSON[_0x66d9('0xf')]({'appID':_0x447616,'timestamp':_0xccc81c,'appKey':_0x17102a}));var _0x476952=fs[_0x66d9('0x10')](_0x4f2104);_0x476952['on'](_0x66d9('0x11'),function(_0x524463){_0x1da611[_0x66d9('0xe')](_0x524463);});_0x476952['on'](_0x66d9('0x12'),function(){_0x1da611['send'](_0x66d9('0x13'));});}catch(_0x1ad66f){logger['error'](_0x66d9('0x14'),JSON['stringify'](_0x1ad66f));_0x1da611['terminate']();}}function _0x2fbd68(_0x1bf556){try{if(_0x1bf556){var _0x2e9c93=JSON['parse'](_0x1bf556);switch(_0x2e9c93[_0x66d9('0x15')]){case 0x0:if(_0x2e9c93[_0x66d9('0x16')]){if(_0x2e9c93[_0x66d9('0x16')][_0x66d9('0x17')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x2e9c93[_0x66d9('0x16')][_0x66d9('0x18')]));_0x496602=_0x2e9c93[_0x66d9('0x16')][_0x66d9('0x18')][0x0][_0x66d9('0x19')];_0x2a5d48=_0x2e9c93[_0x66d9('0x16')][_0x66d9('0x18')][0x0][_0x66d9('0x1a')];_0x7505f0='0';_0x52ad22=_0x66d9('0x1b');_0x1da611[_0x66d9('0x1c')]();}}break;case 0x1:logger[_0x66d9('0x4')](_0x66d9('0x7'));_0x7505f0='1';_0x52ad22='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x66d9('0x4')](_0x66d9('0x1d'));_0x7505f0='2';_0x52ad22=_0x66d9('0x1d');break;case 0x9:logger['info'](_0x66d9('0x1e'));_0x7505f0='9';_0x52ad22=_0x66d9('0x1e');break;case 0xa:logger[_0x66d9('0x4')](_0x66d9('0x1f'));_0x7505f0='10';_0x52ad22=_0x66d9('0x1f');break;case 0xb:logger[_0x66d9('0x4')](_0x66d9('0x20'));_0x7505f0='11';_0x52ad22=_0x66d9('0x20');}}}catch(_0x2c4084){logger[_0x66d9('0x21')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x66d9('0xf')](_0x2c4084));_0x1da611[_0x66d9('0x1c')]();}}function _0x13823d(){logger[_0x66d9('0x4')](_0x66d9('0x22'));_0x404711({'transcript':_0x496602,'confidence':_0x2a5d48,'status':_0x7505f0,'status_message':_0x52ad22});}function _0x3013d6(_0x4b2cb7){logger['error'](_0x66d9('0x23'));if(!_['isNil'](_0x4b2cb7)){logger[_0x66d9('0x21')](_[_0x66d9('0x24')](_0x4b2cb7)?JSON[_0x66d9('0xf')](_0x4b2cb7):_0x4b2cb7);}}_0x1da611['on'](_0x66d9('0x25'),_0x2e04b2);_0x1da611['on']('message',_0x2fbd68);_0x1da611['on']('close',_0x13823d);_0x1da611['on'](_0x66d9('0x21'),_0x3013d6);});}; \ No newline at end of file +var _0x2947=['stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x2947,0x189));var _0x7294=function(_0x27f953,_0x585a91){_0x27f953=_0x27f953-0x0;var _0x4e6e6e=_0x2947[_0x27f953];return _0x4e6e6e;};'use strict';var BPromise=require(_0x7294('0x0'));var _=require(_0x7294('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7294('0x2'));var crypto=require(_0x7294('0x3'));var logger=require(_0x7294('0x4'))(_0x7294('0x5'));module[_0x7294('0x6')]=function(_0x5289e2,_0x55b43e,_0x3c7616,_0x59bce1){return new BPromise(function(_0xfd5b6a,_0xd80099){logger[_0x7294('0x7')](_0x7294('0x8'),_0x59bce1||_0x7294('0x9'));var _0xd8bb93=new WebSocket(_0x59bce1||_0x7294('0x9'),{'perMessageDeflate':![]});var _0x2a1ff0='';var _0x37fc6b='0';var _0x277b98='1';var _0x59d56b=_0x7294('0xa');function _0x3456fd(_0x489d66){var _0x52b728=crypto['createHash'](_0x7294('0xb'));_0x52b728[_0x7294('0xc')](_0x489d66);return _0x52b728[_0x7294('0xd')]('hex');}function _0x4f3834(){try{logger[_0x7294('0x7')](_0x7294('0xe'));var _0x3a7528=moment()[_0x7294('0xf')]();var _0x20d046=_0x3456fd(_0x3a7528+_0x55b43e+_0x3c7616);_0xd8bb93[_0x7294('0x10')](JSON[_0x7294('0x11')]({'appID':_0x55b43e,'timestamp':_0x3a7528,'appKey':_0x20d046}));var _0x7a36ad=fs[_0x7294('0x12')](_0x5289e2);_0x7a36ad['on'](_0x7294('0x13'),function(_0x71452f){_0xd8bb93[_0x7294('0x10')](_0x71452f);});_0x7a36ad['on'](_0x7294('0x14'),function(){_0xd8bb93[_0x7294('0x10')](_0x7294('0x15'));});}catch(_0x3bd238){logger['error'](_0x7294('0x16'),JSON[_0x7294('0x11')](_0x3bd238));_0xd8bb93[_0x7294('0x17')]();}}function _0x10d168(_0x3f37ad){try{if(_0x3f37ad){var _0x4a4f79=JSON[_0x7294('0x18')](_0x3f37ad);switch(_0x4a4f79[_0x7294('0x19')]){case 0x0:if(_0x4a4f79[_0x7294('0x1a')]){if(_0x4a4f79[_0x7294('0x1a')][_0x7294('0x1b')]){logger[_0x7294('0x7')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x4a4f79[_0x7294('0x1a')][_0x7294('0x1c')]));_0x2a1ff0=_0x4a4f79[_0x7294('0x1a')][_0x7294('0x1c')][0x0][_0x7294('0x1d')];_0x37fc6b=_0x4a4f79[_0x7294('0x1a')][_0x7294('0x1c')][0x0]['likelihood'];_0x277b98='0';_0x59d56b=_0x7294('0x1e');_0xd8bb93[_0x7294('0x17')]();}}break;case 0x1:logger[_0x7294('0x7')](_0x7294('0xa'));_0x277b98='1';_0x59d56b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x7294('0x7')](_0x7294('0x1f'));_0x277b98='2';_0x59d56b=_0x7294('0x1f');break;case 0x9:logger[_0x7294('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x277b98='9';_0x59d56b='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x277b98='10';_0x59d56b=_0x7294('0x20');break;case 0xb:logger['info'](_0x7294('0x21'));_0x277b98='11';_0x59d56b='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x59caf4){logger[_0x7294('0x22')](_0x7294('0x23'),JSON[_0x7294('0x11')](_0x59caf4));_0xd8bb93[_0x7294('0x17')]();}}function _0x12c5ab(){logger[_0x7294('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0xfd5b6a({'transcript':_0x2a1ff0,'confidence':_0x37fc6b,'status':_0x277b98,'status_message':_0x59d56b});}function _0x325dc7(_0x25f700){logger[_0x7294('0x22')](_0x7294('0x24'));if(!_[_0x7294('0x25')](_0x25f700)){logger[_0x7294('0x22')](_[_0x7294('0x26')](_0x25f700)?JSON[_0x7294('0x11')](_0x25f700):_0x25f700);}}_0xd8bb93['on'](_0x7294('0x27'),_0x4f3834);_0xd8bb93['on'](_0x7294('0x28'),_0x10d168);_0xd8bb93['on'](_0x7294('0x14'),_0x12c5ab);_0xd8bb93['on'](_0x7294('0x22'),_0x325dc7);});}; \ 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 4180898..473cfe8 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 _0xb999=['./asr'];(function(_0xe2307f,_0x38bb26){var _0x2f4fb1=function(_0x25bee1){while(--_0x25bee1){_0xe2307f['push'](_0xe2307f['shift']());}};_0x2f4fb1(++_0x38bb26);}(_0xb999,0xad));var _0x9b99=function(_0x15df3a,_0x45270c){_0x15df3a=_0x15df3a-0x0;var _0x4b2e7d=_0xb999[_0x15df3a];return _0x4b2e7d;};var asr=require(_0x9b99('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9072=['exports','./asr'];(function(_0x2a2588,_0x524eb5){var _0x534723=function(_0x434118){while(--_0x434118){_0x2a2588['push'](_0x2a2588['shift']());}};_0x534723(++_0x524eb5);}(_0x9072,0x169));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};var asr=require(_0x2907('0x0'));module[_0x2907('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8abdc4a..99f09f2 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 _0x5712=['events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net'];(function(_0x5236cc,_0x477839){var _0x287559=function(_0x44cd67){while(--_0x44cd67){_0x5236cc['push'](_0x5236cc['shift']());}};_0x287559(++_0x477839);}(_0x5712,0x140));var _0x2571=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5712[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x2571('0x0'));var net=require(_0x2571('0x1'));var EventEmitter=require(_0x2571('0x2'))[_0x2571('0x3')];var AGIError=require(_0x2571('0x4'));var AGIChannel=require(_0x2571('0x5'));var AGIServer=function(_0x29c464,_0x1b044e,_0x102dd6){var _0x42459b=this,_0x29c464=_0x29c464||0x11dd,_0x1b044e=_0x1b044e||_0x2571('0x6'),_0x4713ad=null,_0x50fc72=0x0;EventEmitter[_0x2571('0x7')](_0x42459b);function _0x3ca885(){if(!_0x29c464){_0x42459b[_0x2571('0x8')](_0x2571('0x9'),new AGIError(_0x2571('0xa')));return![];}_0x4713ad=net['createServer']();_0x4713ad[_0x2571('0xb')](_0x29c464,_0x1b044e);_0x4713ad['on']('listening',function(){_0x42459b[_0x2571('0x8')](_0x2571('0xc'));});_0x4713ad['on'](_0x2571('0xd'),function(_0x42bf6e){_0x4713ad[_0x2571('0xe')](function(_0x366f74,_0x4fce3){if(_0x366f74){_0x42459b[_0x2571('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x366f74));}else if(_0x102dd6&&_0x102dd6<0x0){_0x42459b[_0x2571('0x8')](_0x2571('0x9'),new AGIError(_0x2571('0xf')));_0x42bf6e[_0x2571('0x10')]();}else if(_0x102dd6&&_0x102dd6>0x0&&_0x102dd6<_0x4fce3){_0x50fc72+=0x1;_0x42459b[_0x2571('0x8')](_0x2571('0x9'),new AGIError(_0x2571('0x11'),_0x50fc72));_0x42bf6e[_0x2571('0x10')]();}else{var _0xdf8c3a=new AGIChannel(_0x42bf6e);_0xdf8c3a['on'](_0x2571('0x12'),function(){_0x42459b[_0x2571('0x8')](_0x2571('0xd'),_0xdf8c3a);});}});});_0x4713ad['on']('error',function(_0x30b0f2){_0x42459b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x30b0f2['code']));});_0x4713ad['on'](_0x2571('0x13'),function(){_0x42459b[_0x2571('0x8')](_0x2571('0x13'),new AGIError(_0x2571('0x14')));});}process['nextTick'](function(){_0x3ca885();});};util[_0x2571('0x15')](AGIServer,EventEmitter);module[_0x2571('0x16')]=function(_0x5e4995,_0x185df2,_0x7303ad){return new AGIServer(_0x5e4995,_0x185df2,_0x7303ad);}; \ No newline at end of file +var _0xec56=['listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x41ba15,_0x3616fc){var _0x599ed7=function(_0x2e0603){while(--_0x2e0603){_0x41ba15['push'](_0x41ba15['shift']());}};_0x599ed7(++_0x3616fc);}(_0xec56,0x1bd));var _0x6ec5=function(_0x22d18e,_0x1beaac){_0x22d18e=_0x22d18e-0x0;var _0x39e003=_0xec56[_0x22d18e];return _0x39e003;};'use strict';var util=require(_0x6ec5('0x0'));var net=require('net');var EventEmitter=require('events')[_0x6ec5('0x1')];var AGIError=require(_0x6ec5('0x2'));var AGIChannel=require(_0x6ec5('0x3'));var AGIServer=function(_0x240ccf,_0x43c2cd,_0x399441){var _0x469679=this,_0x240ccf=_0x240ccf||0x11dd,_0x43c2cd=_0x43c2cd||_0x6ec5('0x4'),_0x28b12b=null,_0x2d0a93=0x0;EventEmitter[_0x6ec5('0x5')](_0x469679);function _0x1f59cd(){if(!_0x240ccf){_0x469679[_0x6ec5('0x6')](_0x6ec5('0x7'),new AGIError(_0x6ec5('0x8')));return![];}_0x28b12b=net[_0x6ec5('0x9')]();_0x28b12b[_0x6ec5('0xa')](_0x240ccf,_0x43c2cd);_0x28b12b['on']('listening',function(){_0x469679[_0x6ec5('0x6')](_0x6ec5('0xb'));});_0x28b12b['on'](_0x6ec5('0xc'),function(_0x1964ae){_0x28b12b[_0x6ec5('0xd')](function(_0x181e79,_0x1d5b76){if(_0x181e79){_0x469679['emit'](_0x6ec5('0x7'),new AGIError(_0x6ec5('0xe'),_0x181e79));}else if(_0x399441&&_0x399441<0x0){_0x469679[_0x6ec5('0x6')](_0x6ec5('0x7'),new AGIError(_0x6ec5('0xf')));_0x1964ae[_0x6ec5('0x10')]();}else if(_0x399441&&_0x399441>0x0&&_0x399441<_0x1d5b76){_0x2d0a93+=0x1;_0x469679[_0x6ec5('0x6')](_0x6ec5('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x2d0a93));_0x1964ae[_0x6ec5('0x10')]();}else{var _0x4d1510=new AGIChannel(_0x1964ae);_0x4d1510['on'](_0x6ec5('0x11'),function(){_0x469679[_0x6ec5('0x6')](_0x6ec5('0xc'),_0x4d1510);});}});});_0x28b12b['on'](_0x6ec5('0x7'),function(_0xdc0b10){_0x469679['emit'](_0x6ec5('0x7'),new AGIError(_0x6ec5('0xe'),_0xdc0b10[_0x6ec5('0x12')]));});_0x28b12b['on'](_0x6ec5('0x13'),function(){_0x469679[_0x6ec5('0x6')](_0x6ec5('0x13'),new AGIError(_0x6ec5('0x14')));});}process[_0x6ec5('0x15')](function(){_0x1f59cd();});};util[_0x6ec5('0x16')](AGIServer,EventEmitter);module[_0x6ec5('0x17')]=function(_0x17f7a2,_0x45c230,_0x437f0f){return new AGIServer(_0x17f7a2,_0x45c230,_0x437f0f);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 131ba16..f0e62ef 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 _0x0284=['aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','%s.%s','replaceall\x20init','split','getVariable','extra','replaceall\x20end','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','noop','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','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','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','setVariable','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','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','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','math','no\x20operation\x20configured','operation','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saveRestApiResult','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','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','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','mailRpc','then','name','catch','prototype','getSquareProject','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','arg_1','file','createSquareMessage','createCmContact','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','log','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','phone','utcOffset','minutestoadd','scheduledat\x20before','add','minutes','scheduledat\x20after','insertContact','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','url','method','timeout','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','stringify','render','statusCode','statusMessage','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','isConfigured','model','awsPolly'];(function(_0x3b8db4,_0x57a9df){var _0x4ed597=function(_0x3ce5bd){while(--_0x3ce5bd){_0x3b8db4['push'](_0x3b8db4['shift']());}};_0x4ed597(++_0x57a9df);}(_0x0284,0x14f));var _0x4028=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x0284[_0x28f32c];return _0x355402;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x4028('0x0'));var _=require(_0x4028('0x1'));var sh=require(_0x4028('0x2'));var odbc=require(_0x4028('0x3'))();var rs=require(_0x4028('0x4'));var moment=require(_0x4028('0x5'));var Mustache=require(_0x4028('0x6'));var rp=require(_0x4028('0x7'));var logger=require(_0x4028('0x8'))(_0x4028('0x9'));var config=require(_0x4028('0xa'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0x4028('0xb');var recursiveMapAttributes=[_0x4028('0xc'),_0x4028('0xd')];var verticesWithRetry=[_0x4028('0xe'),_0x4028('0xf'),'getsecretdigits'];var AGIVertices=function(_0x541de5,_0x5e1cd8,_0xbdb688){this['channel']=_0x541de5;this['rpc']=_0x5e1cd8;this[_0x4028('0x10')]=_0xbdb688;};AGIVertices['prototype']['getVariable']=function(_0x251fab,_0x1276de){this['rpc']['getVariableById'](_0x251fab)[_0x4028('0x11')](function(_0x31893f){_0x1276de(null,_0x31893f?_0x31893f[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x555118){_0x1276de(_0x555118);});};AGIVertices[_0x4028('0x14')]['getVoiceQueue']=function(_0x3560c4,_0x357724){this['rpc']['getVoiceQueueById'](_0x3560c4)[_0x4028('0x11')](function(_0x313368){_0x357724(null,_0x313368?_0x313368[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x1ff126){_0x357724(_0x1ff126);});};AGIVertices[_0x4028('0x14')][_0x4028('0x15')]=function(_0x4adde4,_0x2696da){this[_0x4028('0x16')][_0x4028('0x17')](_0x4adde4)[_0x4028('0x11')](function(_0x39170a){_0x2696da(null,_0x39170a?_0x39170a[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x1d63d5){_0x2696da(_0x1d63d5);});};AGIVertices[_0x4028('0x14')][_0x4028('0x18')]=function(_0x4f0c89,_0x558518){this['rpc'][_0x4028('0x19')](_0x4f0c89)[_0x4028('0x11')](function(_0x409ce1){_0x558518(null,_0x409ce1?_0x409ce1['dsn']:![]);})['catch'](function(_0x1e6388){_0x558518(_0x1e6388);});};AGIVertices[_0x4028('0x14')][_0x4028('0x1a')]=function(_0xbc445d,_0x124f33){this['rpc'][_0x4028('0x1b')](_0xbc445d)[_0x4028('0x11')](function(_0x43f796){_0x124f33(null,_0x43f796?_0x43f796[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x15c7a9){_0x124f33(_0x15c7a9);});};AGIVertices[_0x4028('0x14')][_0x4028('0x1c')]=function(_0xa78d97,_0x429e14){this[_0x4028('0x16')][_0x4028('0x1d')](_0xa78d97)[_0x4028('0x11')](function(_0x3069e4){_0x429e14(null,_0x3069e4?_0x3069e4[_0x4028('0x12')]:![]);})[_0x4028('0x13')](function(_0x371dda){_0x429e14(_0x371dda);});};AGIVertices[_0x4028('0x14')]['getSound']=function(_0x468363,_0x5a22eb){var _0xcf8b45=this;this[_0x4028('0x16')][_0x4028('0x1e')](_0x468363)[_0x4028('0x11')](function(_0x4030ed){_0x5a22eb(null,_0x4030ed?_0xcf8b45['getSoundPath'](_0x4030ed['save_name']):![]);})[_0x4028('0x13')](function(_0x1763c6){_0x5a22eb(_0x1763c6);});};AGIVertices[_0x4028('0x14')]['getMailAccount']=function(_0x44f723,_0x238c75){this['rpc']['getMailAccountById'](_0x44f723)[_0x4028('0x11')](function(_0x1da132){_0x238c75(null,_0x1da132?_0x1da132:![]);})[_0x4028('0x13')](function(_0x582d9e){_0x238c75(_0x582d9e);});};AGIVertices['prototype'][_0x4028('0x1f')]=function(_0x29954d,_0x221b69,_0x304846){this['mailRpc']['sendMailMessage'](_0x29954d,_0x221b69)[_0x4028('0x11')](function(){_0x304846(null);})[_0x4028('0x13')](function(_0x3be6bc){_0x304846(_0x3be6bc);});};AGIVertices['prototype']['getIntervals']=function(_0x25efae,_0x491cc6){this['rpc'][_0x4028('0x20')](_0x25efae)[_0x4028('0x11')](function(_0x510ef5){if(_0x510ef5){if(_0x510ef5[_0x4028('0x21')]){_0x491cc6(null,[_0x510ef5[_0x4028('0x22')]]);}else{_0x491cc6(null,_[_0x4028('0x23')](_0x510ef5[_0x4028('0x24')],'interval'));}}else{_0x491cc6(null,![]);}})['catch'](function(_0x219e36){_0x491cc6(_0x219e36);});};AGIVertices['prototype'][_0x4028('0x25')]=function(_0x2bd8b2){return util[_0x4028('0x26')](_0x4028('0x27'),FILES_PATH,_0x2bd8b2);};AGIVertices[_0x4028('0x14')][_0x4028('0x28')]=function(_0x2f1019,_0xd2a631,_0x27ef7e){odbc[_0x4028('0x29')](_0x2f1019,function(_0x5c5970){if(_0x5c5970){logger[_0x4028('0x2a')](_0x4028('0x2b'),_0x5c5970);_0x27ef7e(_0x5c5970);}else{logger[_0x4028('0x2c')](_0x4028('0x2d'));odbc['query'](_0xd2a631,function(_0x563d42,_0x4a501d){if(_0x563d42){logger[_0x4028('0x2c')](_0x4028('0x2e'),_0xd2a631);_0x27ef7e(_0x563d42);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0xd2a631);odbc['close'](function(_0x52affd){if(_0x52affd){logger[_0x4028('0x2a')](_0x4028('0x2f'),_0x52affd);}_0x27ef7e(null,_0x4a501d);});}});}});};AGIVertices[_0x4028('0x14')][_0x4028('0x30')]=function(_0x48e508,_0x15906b){this[_0x4028('0x16')][_0x4028('0x31')](_0x48e508)[_0x4028('0x11')](function(_0x45a301){_0x15906b(null,_0x45a301?_0x45a301:![]);})['catch'](function(_0x2e3471){_0x15906b(_0x2e3471);});};AGIVertices[_0x4028('0x14')]['createSmsMessage']=function(_0x18efda,_0x3404e3){this['rpc'][_0x4028('0x32')](_0x18efda)[_0x4028('0x11')](function(_0x1db4c3){_0x3404e3(null,_0x1db4c3);})[_0x4028('0x13')](function(_0x55ec4e){_0x3404e3(_0x55ec4e);});};AGIVertices[_0x4028('0x14')][_0x4028('0x33')]=function(_0xe7f721,_0x4a9f82,_0x2d2803){this[_0x4028('0x16')][_0x4028('0x33')]({'uniqueid':this[_0x4028('0x34')][_0x4028('0x35')],'node':_0xe7f721[_0x4028('0x36')],'application':_0xe7f721[_0x4028('0x37')],'data':_0x4a9f82||null,'project_name':this[_0x4028('0x34')]['arg_1'],'callerid':this[_0x4028('0x34')][_0x4028('0x38')]})['then'](function(_0x25b8a0){if(_0x2d2803){_0x2d2803(null,_0x25b8a0);}})[_0x4028('0x13')](function(_0x1c109b){if(_0x2d2803){_0x2d2803(_0x1c109b);}});};AGIVertices['prototype'][_0x4028('0x39')]=function(_0x1a11af,_0x144ed5,_0x40d535,_0x4f2ca3){this[_0x4028('0x16')][_0x4028('0x39')]({'uniqueid':this[_0x4028('0x34')][_0x4028('0x35')],'callerid':this[_0x4028('0x34')]['callerid'],'calleridname':this[_0x4028('0x34')][_0x4028('0x3a')],'context':this[_0x4028('0x34')][_0x4028('0x3b')],'extension':this[_0x4028('0x34')][_0x4028('0x3c')],'priority':this[_0x4028('0x34')][_0x4028('0x3d')],'accountcode':this[_0x4028('0x34')]['accountcode'],'dnid':this[_0x4028('0x34')][_0x4028('0x3e')],'projectName':this['channel'][_0x4028('0x3f')],'saveName':_0x144ed5,'filename':_0x1a11af[_0x4028('0x40')]||_0x144ed5,'savePath':_0x40d535})[_0x4028('0x11')](function(_0x595aa4){_0x4f2ca3(null,_0x595aa4);})[_0x4028('0x13')](function(_0x27f357){_0x4f2ca3(_0x27f357);});};AGIVertices[_0x4028('0x14')]['createSquareMessage']=function(_0xb2ec71,_0x149283,_0x40fa31){this['rpc'][_0x4028('0x41')]({'uniqueid':this[_0x4028('0x34')]['uniqueid'],'body':_0xb2ec71,'direction':_0x149283})[_0x4028('0x11')](function(_0xc23708){if(_0x40fa31){_0x40fa31(null,_0xc23708);}})[_0x4028('0x13')](function(_0x3aeac6){if(_0x40fa31){_0x40fa31(_0x3aeac6);}});};AGIVertices[_0x4028('0x14')][_0x4028('0x42')]=function(_0x5addc0,_0x245a1e){console['log'](_0x4028('0x43'),_0x5addc0);console['log'](_0x4028('0x44'),_0x245a1e);var _0x2f909a=0x0;var _0x3ebe9a={'firstName':_[_0x4028('0x45')](_0x5addc0['name'])||_[_0x4028('0x46')](_0x5addc0[_0x4028('0x12')])?_0x4028('0x47')+Math['random']():_0x5addc0[_0x4028('0x12')],'lastName':_[_0x4028('0x45')](_0x5addc0[_0x4028('0x48')])||_[_0x4028('0x46')](_0x5addc0['lastName'])?null:_0x5addc0[_0x4028('0x48')],'phone':_0x5addc0['phone'],'ListId':_0x5addc0['list_id'],'scheduledat':_0x5addc0[_0x4028('0x49')],'callbackUniqueid':this[_0x4028('0x34')][_0x4028('0x35')],'tags':_0x4028('0x4a'),'description':_0x4028('0x4b')+_0x5addc0['scheduledAt'][_0x4028('0x4c')](),'priority':_0x5addc0[_0x4028('0x4d')]};if(_[_0x4028('0x4e')](_0x5addc0,_0x4028('0x4f'))){if(!_[_0x4028('0x46')](_0x5addc0['dialTimezone'])){var _0x281110=_0x5addc0[_0x4028('0x4f')];console[_0x4028('0x50')](_0x4028('0x51'),_0x281110);if(_0x5addc0['dialTimezone']==_0x4028('0x52')){this[_0x4028('0x16')][_0x4028('0x53')]({'phone':_0x5addc0[_0x4028('0x54')]})[_0x4028('0x11')](function(_0x4cd0cb){console[_0x4028('0x50')]('RES1',_0x4cd0cb);var _0x1c6dc4=_0x4cd0cb[_0x4028('0x4f')];console[_0x4028('0x50')]('dialtimezone',_0x1c6dc4);if(!_[_0x4028('0x46')](_0x1c6dc4)){var _0x17b053=shared[_0x1c6dc4];console[_0x4028('0x50')]('tz',_0x17b053);if(!_[_0x4028('0x46')](_0x17b053)){var _0x41ac40=-0x1*_0x17b053[_0x4028('0x55')];console[_0x4028('0x50')](_0x4028('0x56'),_0x41ac40);console['log'](_0x4028('0x57'),_0x3ebe9a[_0x4028('0x49')]);_0x3ebe9a[_0x4028('0x49')]=moment(_0x5addc0[_0x4028('0x49')])[_0x4028('0x58')](_0x41ac40,_0x4028('0x59'));console['log'](_0x4028('0x5a'),_0x3ebe9a['scheduledAt']);this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)['then'](function(_0x5bc8c5){_0x245a1e(null,_0x5bc8c5);})[_0x4028('0x13')](function(_0x197dc1){_0x245a1e(_0x197dc1);});}else{this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x41f5a9){_0x245a1e(null,_0x41f5a9);})['catch'](function(_0x2131b1){_0x245a1e(_0x2131b1);});}}else{this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x30346f){_0x245a1e(null,_0x30346f);})[_0x4028('0x13')](function(_0x2b46ad){_0x245a1e(_0x2b46ad);});}});}else{var _0x2f909a=shared[_0x281110];if(!_[_0x4028('0x46')](_0x2f909a)){var _0xbbf0fe=-0x1*_0x2f909a[_0x4028('0x55')];_0x3ebe9a['scheduledAt']=moment(_0x5addc0[_0x4028('0x49')])[_0x4028('0x58')](_0xbbf0fe,_0x4028('0x59'));this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x53b478){_0x245a1e(null,_0x53b478);})[_0x4028('0x13')](function(_0x48d861){_0x245a1e(_0x48d861);});}else{this[_0x4028('0x16')]['insertContact'](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x97bb72){_0x245a1e(null,_0x97bb72);})['catch'](function(_0x33d039){_0x245a1e(_0x33d039);});}}}else{this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x1df7d9){_0x245a1e(null,_0x1df7d9);})[_0x4028('0x13')](function(_0x815dea){_0x245a1e(_0x815dea);});}}else{this[_0x4028('0x16')][_0x4028('0x5b')](_0x3ebe9a,_0x5addc0,_0x245a1e)[_0x4028('0x11')](function(_0x48e306){_0x245a1e(null,_0x48e306);})[_0x4028('0x13')](function(_0x40e276){_0x245a1e(_0x40e276);});}};AGIVertices['prototype']['insertContact']=function(_0x1744e6,_0x44d2e8,_0x33df99){this['rpc'][_0x4028('0x42')](_0x1744e6)[_0x4028('0x11')](function(_0x50f8e7){_0x33df99(null,_0x50f8e7);})[_0x4028('0x13')](function(_0x256c29){_0x33df99(_0x256c29);});};AGIVertices[_0x4028('0x14')][_0x4028('0x5c')]=function(_0x140406,_0x54b253){this['rpc'][_0x4028('0x5d')](_0x140406)[_0x4028('0x11')](function(_0x4a5953){_0x54b253(null,_0x4a5953?_0x4a5953[_0x4028('0x12')]:![]);})['catch'](function(_0xbdc870){_0x54b253(_0xbdc870);});};AGIVertices[_0x4028('0x14')][_0x4028('0x5e')]=function(_0x1b4ece,_0x50e89a,_0x1bcfa8){var _0x1da502={'role':_0x4028('0x5f')};_0x1da502[_0x1b4ece]=this['channel']['callerid'];this[_0x4028('0x16')][_0x4028('0x5e')](_0x1da502,_0x50e89a,this['channel']['uniqueid'])[_0x4028('0x11')](function(_0x4b9a92){_0x1bcfa8(null,_[_0x4028('0x46')](_0x4b9a92)?![]:!![]);})[_0x4028('0x13')](function(_0x13b5a6){logger['error'](_0x13b5a6);_0x1bcfa8(null,![]);});};AGIVertices[_0x4028('0x14')][_0x4028('0x60')]=function(_0x505406,_0x24f8e6){var _0x14a448={'role':_0x4028('0x5f')};_0x14a448[_0x505406]=this['channel']['callerid'];this[_0x4028('0x16')]['agentUnpause'](_0x14a448)['then'](function(_0x5b2390){_0x24f8e6(null,_[_0x4028('0x46')](_0x5b2390)?![]:!![]);})['catch'](function(_0x2dbc59){logger['error'](_0x2dbc59);_0x24f8e6(null,![]);});};AGIVertices[_0x4028('0x14')]['agentLogout']=function(_0x2c290e,_0x11c414){var _0x5e2c3f={'role':_0x4028('0x5f')};_0x5e2c3f[_0x2c290e]=this[_0x4028('0x34')]['callerid'];this[_0x4028('0x16')][_0x4028('0x61')](_0x5e2c3f)['then'](function(_0x52e823){_0x11c414(null,_[_0x4028('0x46')](_0x52e823)?![]:!![]);})['catch'](function(_0x89e5ba){logger['error'](_0x89e5ba);_0x11c414(null,![]);});};AGIVertices[_0x4028('0x14')][_0x4028('0x62')]=function(_0x5eb955,_0x44d126){var _0x322a51={'role':_0x4028('0x5f')};_0x322a51[_0x5eb955]=this[_0x4028('0x34')][_0x4028('0x38')];var _0x500900=_0x5eb955!=_0x4028('0x63')?util[_0x4028('0x26')](_0x4028('0x64'),_0x4028('0x65'),this[_0x4028('0x34')][_0x4028('0x38')]):undefined;this['rpc'][_0x4028('0x62')](_0x322a51,_0x500900)[_0x4028('0x11')](function(_0x215edb){_0x44d126(null,_[_0x4028('0x46')](_0x215edb)?![]:!![]);})[_0x4028('0x13')](function(_0x5504b0){logger[_0x4028('0x2a')](_0x5504b0);_0x44d126(null,![]);});};AGIVertices[_0x4028('0x14')]['shellCommand']=function(_0x10dbc4,_0x3bbf2b){sh['exec'](_[_0x4028('0x66')](_0x10dbc4),function(_0x332876,_0x474c6b){var _0x31eea2=_0x474c6b[_0x4028('0x67')](/(\r\n|\n|\r)/gm,'');_0x3bbf2b(null,_0x31eea2);});};AGIVertices['prototype'][_0x4028('0x68')]=function(_0x2fada5,_0x521582){scripts[_0x4028('0x68')](_0x2fada5[_0x4028('0x69')],_0x2fada5[_0x4028('0x6a')]||'text',_0x2fada5[_0x4028('0x6b')],_0x2fada5['languageCode']||_0x4028('0x6c'),_0x2fada5[_0x4028('0x6d')]||'MALE',_0x2fada5[_0x4028('0x6e')]||'MP3')['then'](function(_0x4111c4){_0x521582(null,_0x4111c4);})[_0x4028('0x13')](function(_0x39466c){_0x521582(_0x39466c);});};AGIVertices[_0x4028('0x14')][_0x4028('0x6f')]=function(_0x328bfc,_0x402347){scripts['googleTTS'](_0x328bfc[_0x4028('0x6b')],_0x328bfc[_0x4028('0x70')]||'en',0x1)['then'](function(_0x334877){_0x402347(null,_0x334877);})[_0x4028('0x13')](function(_0x1443cb){_0x402347(_0x1443cb);});};AGIVertices[_0x4028('0x14')]['restAPI']=function(_0xa41004,_0x305051){var _0x49517a={'uri':_0xa41004[_0x4028('0x71')],'method':_0xa41004[_0x4028('0x72')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xa41004[_0x4028('0x73')])===_0x4028('0x74')&&parseInt(_0xa41004[_0x4028('0x73')])>=0x1?parseInt(_0xa41004[_0x4028('0x73')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x4028('0x75'),_0x4028('0x76')],_0x49517a[_0x4028('0x72')][_0x4028('0x77')]())){try{_0x49517a[_0x4028('0x78')]=_0xa41004[_0x4028('0xd')]?JSON[_0x4028('0x79')](_0xa41004['rawBody']):{};}catch(_0x47583a){logger[_0x4028('0x2a')](_0x4028('0x7a'),_0x47583a);}}try{_0x49517a['headers']=_0xa41004[_0x4028('0xc')]?JSON['parse'](_0xa41004['rawHeaders']):{};}catch(_0x522a4a){logger[_0x4028('0x2a')](_0x4028('0x7b'),_0x522a4a);}if(_0xa41004[_0x4028('0x7c')]){try{var _0x58651b=require(_0xa41004['computedVariables'])[_0x4028('0x7d')](this,_0x49517a);_0x49517a[_0x4028('0x7e')]=Mustache['render'](_0xa41004[_0x4028('0x71')],_0x58651b,{},['$$','$$']);if(_0x49517a[_0x4028('0x7f')]){_0x49517a[_0x4028('0x7f')]=JSON[_0x4028('0x79')](Mustache['render'](JSON[_0x4028('0x80')](_0x49517a[_0x4028('0x7f')]),_0x58651b,{},['$$','$$']));}if(_0x49517a['body']){_0x49517a['body']=JSON[_0x4028('0x79')](Mustache[_0x4028('0x81')](JSON[_0x4028('0x80')](_0x49517a[_0x4028('0x78')]),_0x58651b,{},['$$','$$']));}}catch(_0x252fda){logger[_0x4028('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x252fda);}}rp(_0x49517a)[_0x4028('0x11')](function(_0x153bd9){var _0x41e01f={'statusCode':_0x153bd9[_0x4028('0x82')]||0xc8,'statusMessage':_0x153bd9[_0x4028('0x83')]||'OK','headers':_0x153bd9[_0x4028('0x7f')]||{},'body':_0x153bd9['body']||{}};_0x305051(null,_0x41e01f);})['catch'](function(_0x31b664){var _0x4dfeca={'statusCode':_0x31b664[_0x4028('0x82')]||0x1f4,'statusMessage':_0x31b664['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x31b664['options'][_0x4028('0x7f')]||{},'body':_0x31b664[_0x4028('0x84')][_0x4028('0x78')]||{}};_0x305051(null,_0x4dfeca);});};AGIVertices[_0x4028('0x14')][_0x4028('0x85')]=function(_0xaa48da,_0x4d71bc){scripts['googleDialogflow'](this['channel'][_0x4028('0x35')],_0xaa48da['key'],_0xaa48da['text'],_0xaa48da[_0x4028('0x86')]||'en')[_0x4028('0x11')](function(_0x15628e){_0x4d71bc(null,_0x15628e);})['catch'](function(_0x21ec13){_0x4d71bc(_0x21ec13);});};AGIVertices[_0x4028('0x14')][_0x4028('0x87')]=function(_0x4028c0,_0x34fb20){scripts[_0x4028('0x87')](this[_0x4028('0x34')],_0x4028c0)['then'](function(_0x1339df){_0x34fb20(null,_0x1339df);})[_0x4028('0x13')](function(_0xba08ab){_0x34fb20(_0xba08ab);});};AGIVertices['prototype'][_0x4028('0x88')]=function(_0x30f2c7,_0x16dc70){scripts[_0x4028('0x88')](_0x30f2c7[_0x4028('0x89')],_0x30f2c7[_0x4028('0x6b')],_0x30f2c7['ispeech_tts_language']||'en-US',_0x30f2c7[_0x4028('0x8a')])[_0x4028('0x11')](function(_0x16ef40){_0x16dc70(null,_0x16ef40);})[_0x4028('0x13')](function(_0x44ef6c){_0x16dc70(_0x44ef6c);});};AGIVertices[_0x4028('0x14')][_0x4028('0x8b')]=function(_0x3a21ae,_0x1ae3f0,_0x4aeb67){scripts[_0x4028('0x8b')](_0x1ae3f0,_0x3a21ae[_0x4028('0x89')],_0x3a21ae['ispeech_asr_language']||_0x4028('0x6c'),this[_0x4028('0x8c')](_0x3a21ae[_0x4028('0x8d')])?_0x3a21ae[_0x4028('0x8d')]:undefined)[_0x4028('0x11')](function(_0x42a846){_0x4aeb67(null,_0x42a846);})['catch'](function(_0x5d5044){_0x4aeb67(_0x5d5044);});};AGIVertices[_0x4028('0x14')]['awsPolly']=function(_0x22c6e8,_0x40c19d){scripts[_0x4028('0x8e')](_0x22c6e8[_0x4028('0x8f')],_0x22c6e8[_0x4028('0x90')],_0x22c6e8[_0x4028('0x91')],_0x22c6e8[_0x4028('0x92')]||_0x4028('0x93'),_0x22c6e8[_0x4028('0x6b')],_0x22c6e8[_0x4028('0x94')]||_0x4028('0x6b'))[_0x4028('0x11')](function(_0x275231){_0x40c19d(null,_0x275231);})[_0x4028('0x13')](function(_0x35a9ae){_0x40c19d(_0x35a9ae);});};AGIVertices[_0x4028('0x14')][_0x4028('0x95')]=function(_0xbe054f,_0x4560f5){scripts[_0x4028('0x95')](this[_0x4028('0x34')][_0x4028('0x35')],_0xbe054f['aws_access_key_id'],_0xbe054f['aws_secret_access_key'],_0xbe054f['aws_lex_region'],_0xbe054f['text'],_0xbe054f[_0x4028('0x96')])[_0x4028('0x11')](function(_0x318936){_0x4560f5(null,_0x318936);})[_0x4028('0x13')](function(_0x10b17f){_0x4560f5(_0x10b17f);});};AGIVertices[_0x4028('0x14')][_0x4028('0x97')]=function(_0x47db04,_0x2ec481,_0x4985a6){scripts[_0x4028('0x97')](_0x2ec481,_0x47db04[_0x4028('0x89')],_0x47db04[_0x4028('0x98')]||_0x4028('0x6c'))[_0x4028('0x11')](function(_0x391b6d){_0x4985a6(null,_0x391b6d);})[_0x4028('0x13')](function(_0x102a9d){_0x4985a6(_0x102a9d);});};AGIVertices[_0x4028('0x14')]['tildeASR']=function(_0x18ddfa,_0x191fa9,_0x39dc49){scripts[_0x4028('0x99')](_0x191fa9,_0x18ddfa[_0x4028('0x9a')],_0x18ddfa[_0x4028('0x9b')],_0x18ddfa['uri'])[_0x4028('0x11')](function(_0x477327){_0x39dc49(null,_0x477327);})['catch'](function(_0x48458e){_0x39dc49(_0x48458e);});};AGIVertices['prototype'][_0x4028('0x9c')]=function(_0x24d572){var _0x5235fb=_[_0x4028('0x9d')](verticesWithRetry,_0x24d572[_0x4028('0x37')])?_0x24d572:_[_0x4028('0x9e')](_0x24d572);for(var _0xbcd60a in _0x5235fb){if(_0x5235fb[_0x4028('0x9f')](_0xbcd60a)){if(_0x5235fb[_0xbcd60a]&&_['isString'](_0x5235fb[_0xbcd60a])){if(_[_0x4028('0x9d')](recursiveMapAttributes,_0xbcd60a)){_0x5235fb[_0xbcd60a]=this[_0x4028('0xa0')](_0x5235fb[_0xbcd60a]);}else{_0x5235fb[_0xbcd60a]=this[_0x4028('0xa1')](_0x5235fb[_0xbcd60a]);}}}}return _0x5235fb;};AGIVertices[_0x4028('0x14')][_0x4028('0xa2')]=function(_0x136014){for(var _0x537adf in _0x136014){if(_0x136014[_0x4028('0x9f')](_0x537adf)){if(_[_0x4028('0xa3')](_0x136014[_0x537adf])){this[_0x4028('0xa2')](_0x136014[_0x537adf]);}else if(_[_0x4028('0xa4')](_0x136014[_0x537adf])){for(var _0x1744a2=0x0;_0x1744a2<_0x136014[_0x537adf][_0x4028('0xa5')];_0x1744a2++){this[_0x4028('0xa2')](_0x136014[_0x537adf][_0x1744a2]);}}else if(_[_0x4028('0xa6')](_0x136014[_0x537adf])){_0x136014[_0x537adf]=this[_0x4028('0xa1')](_0x136014[_0x537adf]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x38c9f4,_0x3413ef){for(var _0x4de204 in _0x38c9f4){if(_0x38c9f4[_0x4028('0x9f')](_0x4de204)){if(_['isPlainObject'](_0x38c9f4[_0x4de204])){if(!_[_0x4028('0x45')](_0x38c9f4[_0x4de204])){this['saveRestApiResult'](_0x38c9f4[_0x4de204],util[_0x4028('0x26')](_0x4028('0xa7'),_0x3413ef,_0x4de204));}}else if(_[_0x4028('0xa4')](_0x38c9f4[_0x4de204])){for(var _0x3b36d8=0x0;_0x3b36d8<_0x38c9f4[_0x4de204]['length'];_0x3b36d8++){this['saveRestApiResult'](_0x38c9f4[_0x4de204][_0x3b36d8],util[_0x4028('0x26')](_0x4028('0xa7'),_0x3413ef,_0x4de204+'['+_0x3b36d8+']'));}}else{if(!_[_0x4028('0x46')](_0x38c9f4[_0x4de204])){this['channel']['setVariable'](util[_0x4028('0x26')](_0x4028('0xa7'),_0x3413ef,_0x4de204),_0x38c9f4[_0x4de204]);}}}}};AGIVertices[_0x4028('0x14')][_0x4028('0xa0')]=function(_0x2c2306){try{var _0x3d6bc2=JSON['parse'](_0x2c2306);this[_0x4028('0xa2')](_0x3d6bc2);return JSON[_0x4028('0x80')](_0x3d6bc2);}catch(_0x46cc24){return this[_0x4028('0xa1')](_0x2c2306);}};AGIVertices['prototype'][_0x4028('0xa1')]=function(_0x5ed059){console[_0x4028('0x50')](_0x4028('0xa8'),_0x5ed059);var _0x31a6d3=_0x5ed059[_0x4028('0xa9')]('{');for(var _0x20146b=0x1;_0x20146b<_0x31a6d3['length'];_0x20146b+=0x1){var _0x113e97=_0x31a6d3[_0x20146b][_0x4028('0xa9')]('}');console[_0x4028('0x50')]('nextbracket',_0x113e97);if(_0x113e97[_0x4028('0xa5')]>0x1){_0x5ed059=_0x5ed059['replaceAll']('{'+_0x113e97[0x0]+'}',this[_0x4028('0x34')][_0x4028('0xaa')](_0x113e97[0x0])[_0x4028('0xab')]||_0x113e97[0x0]);}}if(_0x31a6d3['length']===0x1){return _0x5ed059['toString']();}console[_0x4028('0x50')](_0x4028('0xac'),_0x5ed059);return this['replaceAllVariables'](_0x5ed059);};AGIVertices[_0x4028('0x14')]['getAndSetVariable']=function(_0x6d7e3e,_0x457d24){var _0x480a47=this[_0x4028('0x34')]['getVariable'](_0x6d7e3e);if(_0x480a47[_0x4028('0xad')]===-0x1){return _0x480a47;}logger[_0x4028('0x2c')](util['format'](_0x4028('0xae'),_0x457d24,_0x480a47[_0x4028('0xab')]));return this['channel']['setVariable'](_0x457d24,_0x480a47[_0x4028('0xab')]);};AGIVertices[_0x4028('0x14')][_0x4028('0x8c')]=function(_0x72cb17){return _0x72cb17&&_0x72cb17!=='0'&&_0x72cb17!=='-1'&&_0x72cb17!=='';};AGIVertices[_0x4028('0x14')][_0x4028('0xaf')]=function(_0x190557){this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x190557,'-');_0x190557['retry']=_0x190557['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4028('0x14')][_0x4028('0xb0')]=function(_0x555df4){logger[_0x4028('0x2c')](util['format'](_0x4028('0xb1'),_0x555df4[_0x4028('0x36')]));if(!this['isConfigured'](_0x555df4[_0x4028('0x6b')])){return this[_0x4028('0x34')]['noop']('no\x20text\x20configured');}var _0x18c9ce='\x22'+_0x555df4[_0x4028('0x6b')]+'\x22';if(this[_0x4028('0x8c')](_0x555df4[_0x4028('0x84')])){_0x18c9ce+=','+_0x555df4[_0x4028('0x84')];}var _0x4cf1af=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0xb3'),_0x18c9ce);if(_0x4cf1af[_0x4028('0xad')]===-0x1){return _0x4cf1af;}return this[_0x4028('0x34')]['noop'](util['format'](_0x4028('0xb4'),_0x18c9ce));};AGIVertices[_0x4028('0x14')]['mrcprecog']=function(_0x4f9600){logger[_0x4028('0x2c')](util[_0x4028('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4f9600['label']));if(!this[_0x4028('0x8c')](_0x4f9600[_0x4028('0xb5')])){return this[_0x4028('0x34')][_0x4028('0xb6')]('no\x20grammar\x20configured');}var _0x4ca102=_0x4f9600[_0x4028('0xb5')];if(this[_0x4028('0x8c')](_0x4f9600[_0x4028('0x84')])){_0x4ca102+=','+_0x4f9600[_0x4028('0x84')];}var _0x6d70c0=this[_0x4028('0x34')]['exec']('MRCPRecog',_0x4ca102);if(_0x6d70c0[_0x4028('0xad')]===-0x1){return _0x6d70c0;}var _0x29c31e=this[_0x4028('0xb7')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x29c31e[_0x4028('0xad')]===-0x1){return _0x29c31e;}var _0xf8b878=this[_0x4028('0xb7')](_0x4028('0xb8'),_0x4028('0xb9'));if(_0xf8b878[_0x4028('0xad')]===-0x1){return _0xf8b878;}var _0x17dfdb=this[_0x4028('0xb7')](_0x4028('0xba'),_0x4028('0xbb'));if(_0x17dfdb['result']===-0x1){return _0x17dfdb;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xbc'),_0x4ca102));};AGIVertices[_0x4028('0x14')][_0x4028('0x9')]=function(_0x5f3999){logger['info'](util['format'](_0x4028('0xbd'),_0x5f3999[_0x4028('0x36')]));return this['channel'][_0x4028('0x9')]([_0x5f3999[_0x4028('0xbe')],_0x5f3999['args']]);};AGIVertices[_0x4028('0x14')][_0x4028('0xbf')]=function(_0x1b8364){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1b8364[_0x4028('0x36')]));if(this[_0x4028('0x8c')](_0x1b8364[_0x4028('0x73')])){logger['info'](util[_0x4028('0x26')](_0x4028('0xc0'),_0x1b8364[_0x4028('0x73')]));var _0x1b9689=this['channel'][_0x4028('0xc1')](_0x1b8364[_0x4028('0x73')]);if(_0x1b9689[_0x4028('0xad')]===-0x1){return _0x1b9689;}}return this[_0x4028('0x34')][_0x4028('0xbf')]();};AGIVertices['prototype']['callback']=function(_0x2a76d7){console[_0x4028('0x50')](_0x4028('0xc2'),_0x2a76d7);logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xc3'),_0x2a76d7[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2a76d7[_0x4028('0xc4')])){return this['channel']['error'](_0x2a76d7,'no\x20list\x20selected');}_0x2a76d7['scheduledAt']=moment();if(this['isConfigured'](_0x2a76d7[_0x4028('0xc5')])){_0x2a76d7[_0x4028('0x49')]=moment()[_0x4028('0x58')](_0x2a76d7['delay'],_0x4028('0x59'));}if(!this['isConfigured'](_0x2a76d7[_0x4028('0x4d')])){_0x2a76d7[_0x4028('0x4d')]=0x2;}console['log'](_0x4028('0xc6'),_0x2a76d7);this[_0x4028('0x42')]['sync'](this,_0x2a76d7);return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xc7'),_0x2a76d7['phone'],_0x2a76d7['list_id'],_0x2a76d7[_0x4028('0x49')]));};AGIVertices[_0x4028('0x14')][_0x4028('0xc8')]=function(_0x140061){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xc9'),_0x140061[_0x4028('0x36')]));var _0x161ea8=this[_0x4028('0x34')][_0x4028('0xb2')](_0x140061[_0x4028('0xca')],_0x140061[_0x4028('0x84')]);if(_0x161ea8['result']===-0x1){return _0x161ea8;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('Executed\x20command\x20%s\x20%s',_0x140061[_0x4028('0xca')],_0x140061[_0x4028('0x84')]));};AGIVertices['prototype'][_0x4028('0xcb')]=function(_0x217681){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xcc'),_0x217681[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x217681[_0x4028('0x6b')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}var _0xe4f516='\x22'+_0x217681[_0x4028('0x6b')]+'\x22';if(this[_0x4028('0x8c')](_0x217681[_0x4028('0x84')])){_0xe4f516+=','+_0x217681[_0x4028('0x84')];}var _0x110e8f=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0xb3'),_0xe4f516);if(_0x110e8f['result']===-0x1){return _0x110e8f;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xb4'),_0xe4f516));};AGIVertices['prototype'][_0x4028('0xce')]=function(_0x3c157c){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xcf'),_0x3c157c['label']));if(!this[_0x4028('0x8c')](_0x3c157c['text'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}var _0x5932ca='\x22'+_0x3c157c[_0x4028('0x6b')]+'\x22';if(this['isConfigured'](_0x3c157c[_0x4028('0x84')])){_0x5932ca+=','+_0x3c157c[_0x4028('0x84')];}var _0x5935cd=this[_0x4028('0x34')][_0x4028('0xb2')]('MRCPSynth',_0x5932ca);if(_0x5935cd[_0x4028('0xad')]===-0x1){return _0x5935cd;}return this['channel']['noop'](util['format'](_0x4028('0xb4'),_0x5932ca));};AGIVertices[_0x4028('0x14')][_0x4028('0xd0')]=function(_0x4b44b6){logger['info'](util[_0x4028('0x26')](_0x4028('0xd1'),_0x4b44b6['label']));if(!this[_0x4028('0x8c')](_0x4b44b6[_0x4028('0xb5')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xd2'));}var _0x28b03d=_0x4b44b6[_0x4028('0xb5')];if(this[_0x4028('0x8c')](_0x4b44b6['options'])){_0x28b03d+=','+_0x4b44b6['options'];}var _0x336968=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0xd3'),_0x28b03d);if(_0x336968[_0x4028('0xad')]===-0x1){return _0x336968;}var _0x44e8f1=this['getAndSetVariable'](_0x4028('0xd4'),_0x4028('0xd5'));if(_0x44e8f1[_0x4028('0xad')]===-0x1){return _0x44e8f1;}var _0x2463b9=this['getAndSetVariable']('RECOG_INPUT()',_0x4028('0xd6'));if(_0x2463b9['result']===-0x1){return _0x2463b9;}var _0x5db3e=this[_0x4028('0xb7')](_0x4028('0xba'),_0x4028('0xd7'));if(_0x5db3e[_0x4028('0xad')]===-0x1){return _0x5db3e;}return this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xbc'),_0x28b03d));};AGIVertices['prototype'][_0x4028('0xd8')]=function(_0x56c1b1){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xd9'),_0x56c1b1['label']));if(!this[_0x4028('0x8c')](_0x56c1b1[_0x4028('0xb5')])){return this[_0x4028('0x34')]['noop']('no\x20grammar\x20configured');}var _0x14914a=_0x56c1b1[_0x4028('0xb5')];if(this['isConfigured'](_0x56c1b1[_0x4028('0x84')])){_0x14914a+=','+_0x56c1b1[_0x4028('0x84')];}var _0x5b552d=this[_0x4028('0x34')]['exec'](_0x4028('0xd3'),_0x14914a);if(_0x5b552d[_0x4028('0xad')]===-0x1){return _0x5b552d;}var _0x233e0d=this[_0x4028('0xb7')](_0x4028('0xd4'),'SESTEK_ASR_CONFIDENCE');if(_0x233e0d[_0x4028('0xad')]===-0x1){return _0x233e0d;}var _0x43e281=this[_0x4028('0xb7')](_0x4028('0xb8'),'SESTEK_ASR_TRANSCRIPT');if(_0x43e281[_0x4028('0xad')]===-0x1){return _0x43e281;}var _0x1bc8a7=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x1bc8a7['result']===-0x1){return _0x1bc8a7;}return this['channel'][_0x4028('0xb6')](util['format'](_0x4028('0xbc'),_0x14914a));};AGIVertices[_0x4028('0x14')]['database']=function(_0x2c2725){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xda'),_0x2c2725[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2c2725['odbc_id'])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2c2725,_0x4028('0xdb'));}var _0x5d99e0=this[_0x4028('0x18')][_0x4028('0x7d')](this,_0x2c2725[_0x4028('0xdc')]);if(!_0x5d99e0){return this['channel']['error'](_0x2c2725,_0x4028('0xdd'));}if(!this[_0x4028('0x8c')](_0x2c2725['query'])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2c2725,_0x4028('0xde'));}var _0x4bd67a=_0x2c2725[_0x4028('0xdf')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xe0'),_0x4bd67a));var _0x16d77c=this[_0x4028('0x28')][_0x4028('0x7d')](this,_0x5d99e0,_0x4bd67a);this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x2c2725,_0x4bd67a);if(!this[_0x4028('0x8c')](_0x2c2725[_0x4028('0xe1')])){return this['channel'][_0x4028('0xb6')](_0x4028('0xe2'));}var _0x8f8273=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x2c2725['variable_id']);if(!_0x8f8273){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2c2725,'no\x20variable\x20found');}var _0x29642e=this;_0x16d77c[_0x4028('0xe3')](function(_0x242916,_0x3735f5){Object['keys'](_0x242916)[_0x4028('0xe3')](function(_0x3e5bec){_0x29642e['channel'][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0xe5'),_0x8f8273,_0x3735f5,_0x3e5bec),_0x242916[_0x3e5bec]);});});this[_0x4028('0x34')][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0xe6'),_0x8f8273),_0x16d77c[_0x4028('0xa5')]);return this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')]('variable\x20%s\x20set',_0x8f8273));};AGIVertices[_0x4028('0x14')][_0x4028('0xe7')]=function(_0x7d3335){logger[_0x4028('0xe8')](util[_0x4028('0x26')](_0x4028('0xe9'),_0x7d3335[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x7d3335[_0x4028('0xea')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x7d3335,_0x4028('0xeb'));}var _0x15b33a=this[_0x4028('0x1a')]['sync'](this,_0x7d3335[_0x4028('0xea')]);if(!_0x15b33a){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x7d3335,_0x4028('0xec'));}var _0x1f94c0=this['channel'][_0x4028('0xb2')]('DIAL',[util[_0x4028('0x26')]('SIP/%s',_0x15b33a),_0x7d3335['timeout'],_0x7d3335[_0x4028('0xed')],_0x7d3335[_0x4028('0x71')]]);if(_0x1f94c0[_0x4028('0xad')]===-0x1){return _0x1f94c0;}return this[_0x4028('0x34')][_0x4028('0xb6')](util['format']('Executed\x20command\x20%s',_0x4028('0xee')));};AGIVertices[_0x4028('0x14')][_0x4028('0xef')]=function(_0x5858a5){logger['info'](util[_0x4028('0x26')](_0x4028('0xf0'),_0x5858a5[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x5858a5['key'])){return this[_0x4028('0x34')][_0x4028('0xb6')]('no\x20key\x20configured');}if(!this[_0x4028('0x8c')](_0x5858a5[_0x4028('0x6b')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this['channel'][_0x4028('0xf1')]=!![];this['createSquareDetailsReport'](_0x5858a5);this['createSquareMessage'](_0x5858a5['text'],'in');this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xf2'),_0x5858a5[_0x4028('0x6b')]));var _0x4f32c7=this[_0x4028('0x85')][_0x4028('0x7d')](this,_0x5858a5);if(_0x4f32c7){for(var _0x4c509f in _0x4f32c7){if(_0x4f32c7[_0x4028('0x9f')](_0x4c509f)){this[_0x4028('0x34')][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0xf3'),_0x4c509f['toUpperCase']()),_0x4f32c7[_0x4c509f]);}}this[_0x4028('0x41')](_0x4f32c7[_0x4028('0xf4')],_0x4028('0xf5'));return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0xf6'),_0x4f32c7[_0x4028('0xf4')]));}return this['channel']['error'](_0x5858a5,_0x4028('0xf7'));};AGIVertices[_0x4028('0x14')]['sesteknda']=function(_0x45998d){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0xf8'),_0x45998d[_0x4028('0x36')]));if(!this['isConfigured'](_0x45998d['ndauth_url'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xf9'));}if(!this['isConfigured'](_0x45998d[_0x4028('0xfa')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xfb'));}if(!this[_0x4028('0x8c')](_0x45998d[_0x4028('0xfc')])){return this[_0x4028('0x34')][_0x4028('0xb6')]('no\x20password\x20configured');}if(!this[_0x4028('0x8c')](_0x45998d[_0x4028('0xfd')])){return this['channel'][_0x4028('0xb6')](_0x4028('0xcd'));}this[_0x4028('0x34')]['bot']=!![];this['createSquareDetailsReport'](_0x45998d);this['createSquareMessage'](_0x45998d[_0x4028('0x6b')],'in');this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0xfe'),_0x45998d[_0x4028('0x6b')]));var _0x5e657d=this[_0x4028('0x87')][_0x4028('0x7d')](this,_0x45998d);if(_0x5e657d){for(var _0x2ce8a0 in _0x5e657d){if(_0x5e657d[_0x4028('0x9f')](_0x2ce8a0)){this['channel'][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0xff'),_0x2ce8a0[_0x4028('0x77')]()),_0x5e657d[_0x2ce8a0]);}}this[_0x4028('0x41')](_0x5e657d[_0x4028('0xf4')],'out');if(_0x5e657d[_0x4028('0x100')]){this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x101'),_0x5e657d[_0x4028('0x100')]));var _0x55acde=this[_0x4028('0x34')][_0x4028('0x102')](_0x5e657d[_0x4028('0x100')]);try{fs[_0x4028('0x103')](_0x5e657d['audiofile']+_0x4028('0x104'));}catch(_0x5e4072){logger[_0x4028('0x2a')](_0x5e4072);}return _0x55acde;}else{return this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x105'),_0x5e657d[_0x4028('0xf4')]));}}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x45998d,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x4028('0x14')][_0x4028('0x106')]=function(_0x27f119){logger[_0x4028('0x2c')](util['format'](_0x4028('0x107'),_0x27f119[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0xb6')]('end');};AGIVertices[_0x4028('0x14')][_0x4028('0x108')]=function(_0x50af4d){logger[_0x4028('0x2c')](util['format'](_0x4028('0x109'),_0x50af4d['label']));var _0x50547c='';if(_0x50af4d[_0x4028('0x10a')]){if(!this[_0x4028('0x8c')](_0x50af4d[_0x4028('0x10a')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x50af4d,_0x4028('0x10b'));}else{var _0x3940d3=parseInt(_0x50af4d['trunk_id'],0xa);if(isNaN(_0x3940d3)){_0x50547c=_0x50af4d['trunk_id'];}else{_0x50547c=this[_0x4028('0x1c')][_0x4028('0x7d')](this,_0x50af4d[_0x4028('0x10a')]);if(!_0x50547c){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x50af4d,'no\x20trunk\x20found');}}}}else if(_0x50af4d[_0x4028('0x10c')]){_0x50547c=_0x50af4d[_0x4028('0x10c')];}else{return this[_0x4028('0x34')][_0x4028('0x2a')](_0x50af4d,_0x4028('0x10b'));}var _0x8e701a=this['channel'][_0x4028('0xb2')](_0x4028('0xee'),[util['format'](_0x4028('0x10d'),_0x50547c,_0x50af4d[_0x4028('0x54')]),_0x50af4d[_0x4028('0x73')],_0x50af4d['opts'],_0x50af4d[_0x4028('0x71')]]);if(_0x8e701a['result']===-0x1){return _0x8e701a;}return this['channel']['noop'](util[_0x4028('0x26')](_0x4028('0x10e'),_0x4028('0xee')));};AGIVertices['prototype'][_0x4028('0x10f')]=function(_0x27c830){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x110'),_0x27c830[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0xb6')]('finally');};AGIVertices[_0x4028('0x14')][_0x4028('0xf')]=function(_0x770506){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x111'),_0x770506['label']));if(_0x770506[_0x4028('0x112')]===0x0){return this[_0x4028('0xaf')](_0x770506);}_0x770506['retry']-=0x1;if(!this[_0x4028('0x8c')](_0x770506[_0x4028('0x113')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x770506,_0x4028('0x114'));}var _0x3ef2bb=this[_0x4028('0x115')][_0x4028('0x7d')](this,_0x770506['file_id']);if(!_0x3ef2bb){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x770506,_0x4028('0x116'));}if(!this[_0x4028('0x8c')](_0x770506['variable_id'])){return this['channel'][_0x4028('0x2a')](_0x4028('0xe2'));}var _0x58ba90=this[_0x4028('0x34')][_0x4028('0x117')](_0x3ef2bb,_0x770506['response'],_0x770506[_0x4028('0x118')]);var _0x1aac5f=_0x58ba90[_0x4028('0xad')]?_0x58ba90['result'][_0x4028('0x4c')]():'';logger[_0x4028('0x2c')](_0x4028('0x119'),JSON[_0x4028('0x80')](_0x58ba90));if(_0x58ba90[_0x4028('0xad')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x770506,_0x1aac5f);return _0x58ba90;}else if(_0x58ba90[_0x4028('0xab')]===_0x4028('0x73')){_0x58ba90[_0x4028('0xad')]=_0x1aac5f[_0x4028('0xa5')]>=parseInt(_0x770506[_0x4028('0x11a')])?'x':'i';}else{_0x58ba90[_0x4028('0xad')]=_0x1aac5f['length']>=parseInt(_0x770506['mindigit'])&&_0x1aac5f['length']<=parseInt(_0x770506['maxdigit'])?'x':'i';}var _0x2c5f28=this[_0x4028('0xaa')]['sync'](this,_0x770506['variable_id']);if(!_0x2c5f28){return this[_0x4028('0x34')]['error'](_0x770506,_0x4028('0x11b'));}this['channel'][_0x4028('0xe4')](_0x2c5f28,_0x1aac5f);if(this[_0x4028('0x8c')](_0x770506['hiddendigitsnum'])){var _0x37b49d=parseInt(_0x770506[_0x4028('0x11c')],0xa);var _0x909f7c=rs[_0x4028('0x11d')]({'charset':'*','length':_0x37b49d});var _0x3db4e6=_0x1aac5f['length'];if(_0x3db4e6>0x0){if(_0x3db4e6>_0x37b49d){this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x770506,_0x770506[_0x4028('0x11e')]===_0x4028('0x11f')?_0x909f7c+_0x1aac5f[_0x4028('0x120')](_0x37b49d):_0x1aac5f[_0x4028('0x120')](0x0,_0x3db4e6-_0x37b49d)+_0x909f7c);}else{this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x770506,rs['generate']({'charset':'*','length':_0x3db4e6}));}}else{this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x770506,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x770506,_0x1aac5f);}return _0x58ba90;};AGIVertices[_0x4028('0x14')][_0x4028('0x121')]=function(_0x41e7ba){logger[_0x4028('0x2c')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x41e7ba['label']));return this[_0x4028('0xf')](_0x41e7ba);};AGIVertices['prototype']['goal']=function(_0x1188d7){logger['info'](util[_0x4028('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1188d7[_0x4028('0x36')]));this[_0x4028('0x33')]['sync'](this,_0x1188d7,_0x1188d7[_0x4028('0x122')]);return this[_0x4028('0x34')][_0x4028('0xb6')](util['format']('GOAL\x20%s',_0x1188d7[_0x4028('0x122')]));};AGIVertices[_0x4028('0x14')]['awspolly']=function(_0x44de61){logger[_0x4028('0x2c')](util['format'](_0x4028('0x123'),_0x44de61[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x44de61[_0x4028('0x8f')])||!this[_0x4028('0x8c')](_0x44de61[_0x4028('0x90')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x124'));}if(!this[_0x4028('0x8c')](_0x44de61[_0x4028('0x6b')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this['channel']['noop'](util[_0x4028('0x26')](_0x4028('0x125'),_0x44de61[_0x4028('0x6b')]));var _0x157c3e=this[_0x4028('0x8e')]['sync'](this,_0x44de61);if(_0x157c3e){this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x126'),_0x157c3e));var _0x2bbf4c=this[_0x4028('0x34')][_0x4028('0x102')](_0x157c3e);try{fs[_0x4028('0x103')](_0x157c3e+_0x4028('0x104'));}catch(_0x420589){logger['error'](_0x420589);}return _0x2bbf4c;}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x44de61,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x4028('0x14')][_0x4028('0x127')]=function(_0x1cd698){logger[_0x4028('0x2c')](util['format'](_0x4028('0x128'),_0x1cd698[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x1cd698['aws_access_key_id'])||!this[_0x4028('0x8c')](_0x1cd698[_0x4028('0x90')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x124'));}if(!this['isConfigured'](_0x1cd698[_0x4028('0x96')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x129'));}if(!this[_0x4028('0x8c')](_0x1cd698['text'])){return this[_0x4028('0x34')]['noop'](_0x4028('0xcd'));}this[_0x4028('0x34')]['bot']=!![];this[_0x4028('0x33')](_0x1cd698);this['createSquareMessage'](_0x1cd698[_0x4028('0x6b')],'in');this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0x12a'),_0x1cd698[_0x4028('0x6b')]));var _0x118434=this['awsLex'][_0x4028('0x7d')](this,_0x1cd698);if(_0x118434){for(var _0x29bee6 in _0x118434){if(_0x118434[_0x4028('0x9f')](_0x29bee6)&&_['isString'](_0x118434[_0x29bee6])){this[_0x4028('0x34')][_0x4028('0xe4')](util['format'](_0x4028('0x12b'),_0x29bee6[_0x4028('0x77')]()),_0x118434[_0x29bee6]);}}if(_[_0x4028('0x46')](_0x118434[_0x4028('0x12c')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x12d'));}else{this['createSquareMessage'](_0x118434['message'],_0x4028('0xf5'));return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0x12e'),_0x118434[_0x4028('0x12c')]));}}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x1cd698,_0x4028('0x12f'));};AGIVertices[_0x4028('0x14')][_0x4028('0x130')]=function(_0xa8c1e){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x131'),_0xa8c1e['label'],_0xa8c1e[_0x4028('0x73')]));if(!this[_0x4028('0x8c')](_0xa8c1e['key'])){return this['channel'][_0x4028('0xb6')](_0x4028('0x132'));}var _0x3b38f0=_0x4028('0x133');var _0x5d2edf=util[_0x4028('0x26')](_0x4028('0x134'),FILES_PATH,rs[_0x4028('0x11d')](0x4));var _0x2e1d6a=util[_0x4028('0x26')](_0x4028('0xa7'),_0x5d2edf,_0x3b38f0);var _0x1b7a8a=!![];if(_0xa8c1e[_0x4028('0x135')]===_0x4028('0x136')){_0x1b7a8a=![];}var _0x25b141=this['channel']['recordFile'](_0x5d2edf,_0x3b38f0,_0xa8c1e[_0x4028('0x137')],_0xa8c1e['timeout'],undefined,_0x1b7a8a);if(_0x25b141['result']!==-0x1){this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x138'),_0x2e1d6a));var _0x66657d=this[_0x4028('0x97')][_0x4028('0x7d')](this,_0xa8c1e,_0x2e1d6a);if(_0x66657d){for(var _0x4b4065 in _0x66657d){if(_0x66657d[_0x4028('0x9f')](_0x4b4065)){this[_0x4028('0x34')][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0x139'),_0x4b4065['toUpperCase']()),_0x66657d[_0x4b4065]);}}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x13a'),JSON['stringify'](_0x66657d)));}}return _0x25b141;};AGIVertices[_0x4028('0x14')][_0x4028('0x13b')]=function(_0x2e6481){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x13c'),_0x2e6481['label']));if(!this[_0x4028('0x8c')](_0x2e6481[_0x4028('0x9a')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x13d'));}if(!this[_0x4028('0x8c')](_0x2e6481[_0x4028('0x9b')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x13e'));}var _0x4e9c42=_0x4028('0x133');var _0x310d3a=util['format'](_0x4028('0x134'),FILES_PATH,rs['generate'](0x4));var _0x39e2d6=util[_0x4028('0x26')](_0x4028('0xa7'),_0x310d3a,_0x4e9c42);var _0x54e39b=!![];if(_0x2e6481['beep']==='NOBEEP'){_0x54e39b=![];}var _0x100363=this['channel'][_0x4028('0x13f')](_0x310d3a,_0x4e9c42,_0x2e6481[_0x4028('0x137')],_0x2e6481[_0x4028('0x73')],undefined,_0x54e39b);if(_0x100363[_0x4028('0xad')]!==-0x1){this['channel'][_0x4028('0xb6')](util['format']('tilde\x20%s\x20file\x20created',_0x39e2d6));var _0x3248bc=this['tildeASR'][_0x4028('0x7d')](this,_0x2e6481,_0x39e2d6);if(_0x3248bc){for(var _0x2e3cef in _0x3248bc){if(_0x3248bc['hasOwnProperty'](_0x2e3cef)){this['channel'][_0x4028('0xe4')](util[_0x4028('0x26')]('TILDE_ASR_%s',_0x2e3cef[_0x4028('0x77')]()),_0x3248bc[_0x2e3cef]);}}return this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x140'),JSON[_0x4028('0x80')](_0x3248bc)));}}return _0x100363;};AGIVertices[_0x4028('0x14')][_0x4028('0x141')]=function(_0x2e0054){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x142'),_0x2e0054[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0x143')](_0x2e0054[_0x4028('0x3b')],_0x2e0054[_0x4028('0x3c')],_0x2e0054['priority']);};AGIVertices[_0x4028('0x14')][_0x4028('0x144')]=function(_0x124bec){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x145'),_0x124bec[_0x4028('0x36')]));if(!this['isConfigured'](_0x124bec['condition'])){return this['channel']['error'](_0x124bec,_0x4028('0x146'));}try{var _0x429f15=eval(_0x124bec['condition'])?_0x4028('0x147'):_0x4028('0x148');this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x124bec[_0x4028('0x149')],_0x429f15));return{'code':0xc8,'result':_0x429f15};}catch(_0x4aca5d){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x4028('0x14')][_0x4028('0x14a')]=function(_0x3eeb67){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x14b'),_0x3eeb67[_0x4028('0x36')]));if(!this['isConfigured'](_0x3eeb67[_0x4028('0x14c')])){return this[_0x4028('0x34')]['error'](_0x3eeb67,_0x4028('0x14d'));}var _0x4368a1=this[_0x4028('0x14e')][_0x4028('0x7d')](this,_0x3eeb67[_0x4028('0x14c')]);if(!_0x4368a1){return this['channel'][_0x4028('0x2a')](_0x3eeb67,_0x4028('0x14f'));}for(var _0x35d50c=0x0;_0x35d50c<_0x4368a1['length'];_0x35d50c+=0x1){var _0xc9b76c=this[_0x4028('0x34')][_0x4028('0xaa')](util[_0x4028('0x26')](_0x4028('0x150'),_0x4368a1[_0x35d50c]));if(_0xc9b76c[_0x4028('0xad')]===-0x1){return _0xc9b76c;}logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x151'),_0x4368a1[_0x35d50c],_0xc9b76c[_0x4028('0xab')]));if(_0xc9b76c[_0x4028('0xab')]===_0x4028('0x147')){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x151'),_0x4368a1[_0x35d50c],_0x4028('0x147')));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x151'),_0x4368a1[_0x35d50c],_0x4028('0x147')));return{'code':0xc8,'result':_0x4028('0x147')};}else{logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x151'),_0x4368a1[_0x35d50c],'false'));this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')]('IFTIME\x20%s\x20%s',_0x4368a1[_0x35d50c],_0x4028('0x148')));}}return{'code':0xc8,'result':_0x4028('0x148')};};AGIVertices[_0x4028('0x14')]['hangup']=function(_0x35b97c){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x152'),_0x35b97c[_0x4028('0x36')]));return this[_0x4028('0x34')]['hangup']();};AGIVertices[_0x4028('0x14')][_0x4028('0x153')]=function(_0x5910bb){logger[_0x4028('0x2c')](util['format'](_0x4028('0x154'),_0x5910bb[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x5910bb[_0x4028('0x89')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x132'));}var _0x1ed6ee=_0x4028('0x133');var _0x21ec12=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x327851=util['format'](_0x4028('0xa7'),_0x21ec12,_0x1ed6ee);var _0x50aca4=!![];if(_0x5910bb[_0x4028('0x135')]===_0x4028('0x136')){_0x50aca4=![];}var _0x32b01a=this[_0x4028('0x34')][_0x4028('0x13f')](_0x21ec12,_0x1ed6ee,_0x5910bb[_0x4028('0x137')],_0x5910bb[_0x4028('0x73')],undefined,_0x50aca4);if(_0x32b01a['result']!==-0x1){this['channel']['noop'](util[_0x4028('0x26')]('ispeech\x20%s\x20file\x20created',_0x327851));var _0x231e24=this['ispeechASR']['sync'](this,_0x5910bb,_0x327851);if(_0x231e24){for(var _0x1d6a55 in _0x231e24){if(_0x231e24[_0x4028('0x9f')](_0x1d6a55)){this['channel'][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0x155'),_0x1d6a55[_0x4028('0x77')]()),_0x231e24[_0x1d6a55]);}}return this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x156'),JSON['stringify'](_0x231e24)));}}return _0x32b01a;};AGIVertices[_0x4028('0x14')][_0x4028('0x157')]=function(_0x42e58a){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x42e58a['label']));if(!this['isConfigured'](_0x42e58a[_0x4028('0x89')])){return this[_0x4028('0x34')]['noop'](_0x4028('0x132'));}if(!this['isConfigured'](_0x42e58a['text'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('Trying\x20ispeech\x20TTS\x20%s',_0x42e58a[_0x4028('0x6b')]));var _0x1d62b5=this['ispeechTTS'][_0x4028('0x7d')](this,_0x42e58a);if(_0x1d62b5){this['channel']['noop'](util[_0x4028('0x26')](_0x4028('0x158'),_0x1d62b5));var _0x5b77d7=this['channel'][_0x4028('0x102')](_0x1d62b5,_0x42e58a['intKey']);try{fs[_0x4028('0x103')](_0x1d62b5+_0x4028('0x104'));}catch(_0x1a7420){logger[_0x4028('0x2a')](_0x1a7420);}return _0x5b77d7;}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x42e58a,_0x4028('0x159'));};AGIVertices['prototype'][_0x4028('0x15a')]=function(_0x2204dd){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x15b'),_0x2204dd[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2204dd['findBy'])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2204dd,'no\x20find\x20by\x20configured');}logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x15c'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2204dd[_0x4028('0x15d')]));var _0x1df2dd=this[_0x4028('0x62')][_0x4028('0x7d')](this,_0x2204dd[_0x4028('0x15d')]);if(_0x1df2dd){logger[_0x4028('0x2c')](util[_0x4028('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4028('0x34')][_0x4028('0x38')],_0x2204dd[_0x4028('0x15d')]));this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2204dd['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4028('0x26')](_0x4028('0x15f'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2204dd['findBy']));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x2204dd['findBy']));return{'code':0xc8,'result':_0x4028('0x160')};}};AGIVertices['prototype'][_0x4028('0x161')]=function(_0x5ab8f8){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x162'),_0x5ab8f8[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x5ab8f8[_0x4028('0x15d')])){return this['channel']['error'](_0x5ab8f8,_0x4028('0x163'));}logger[_0x4028('0x2c')](util[_0x4028('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4028('0x34')][_0x4028('0x38')],_0x5ab8f8['findBy']));var _0x4428a8=this['agentLogout']['sync'](this,_0x5ab8f8[_0x4028('0x15d')]);if(_0x4428a8){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')]['callerid'],_0x5ab8f8[_0x4028('0x15d')]));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x5ab8f8[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x164')};}else{logger[_0x4028('0x2c')](util[_0x4028('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4028('0x38')],_0x5ab8f8['findBy']));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x15f'),this[_0x4028('0x34')][_0x4028('0x38')],_0x5ab8f8[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x160')};}};AGIVertices[_0x4028('0x14')][_0x4028('0x165')]=function(_0x25f3d2){logger[_0x4028('0x2c')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x25f3d2[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x25f3d2['operation'])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x25f3d2,_0x4028('0x166'));}this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('math\x20%s',_0x25f3d2[_0x4028('0x167')]));var _0x2ce384=eval(_0x25f3d2[_0x4028('0x167')]);if(!this[_0x4028('0x8c')](_0x25f3d2[_0x4028('0xe1')])){return this[_0x4028('0x34')]['noop'](_0x4028('0xe2'));}var _0x4784fc=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x25f3d2[_0x4028('0xe1')]);if(!_0x4784fc){return this[_0x4028('0x34')]['error'](_0x25f3d2,_0x4028('0x11b'));}if(_[_0x4028('0xa4')](_0x2ce384)){var _0x111748=this;_0x2ce384[_0x4028('0xe3')](function(_0x44a220,_0x4b95d1){_0x111748[_0x4028('0x34')][_0x4028('0xe4')](util[_0x4028('0x26')]('%s[%s]',_0x4784fc,_0x4b95d1),_0x44a220);});return this['channel'][_0x4028('0xb6')](util['format']('variable\x20%s[key]\x20set',_0x4784fc));}else{return this['channel'][_0x4028('0xe4')](_0x4784fc,_0x2ce384);}};AGIVertices['prototype'][_0x4028('0xe')]=function(_0x55e9c5){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x168'),_0x55e9c5[_0x4028('0x36')]));if(_0x55e9c5[_0x4028('0x112')]===0x0){return this['maxRetry'](_0x55e9c5);}_0x55e9c5[_0x4028('0x112')]-=0x1;if(!this[_0x4028('0x8c')](_0x55e9c5[_0x4028('0x113')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x55e9c5,_0x4028('0x114'));}var _0x22f06b=this['getSound'][_0x4028('0x7d')](this,_0x55e9c5['file_id']);if(!_0x22f06b){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x55e9c5,_0x4028('0x116'));}var _0xa6e4d4=this[_0x4028('0x34')]['getData'](_0x22f06b,_0x55e9c5[_0x4028('0x169')],_0x55e9c5[_0x4028('0x16a')]);var _0x525efa=_0xa6e4d4['result'];if(_0xa6e4d4[_0x4028('0xad')]===-0x1){this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x55e9c5,'-1');return _0xa6e4d4;}else if(_0xa6e4d4[_0x4028('0xab')]===_0x4028('0x73')){_0xa6e4d4[_0x4028('0xad')]=_0xa6e4d4[_0x4028('0xad')][_0x4028('0xa5')]>0x0?_0xa6e4d4[_0x4028('0xad')]:'t';}else if(_[_0x4028('0x45')](_0xa6e4d4['result'])){_0xa6e4d4['result']='#';_0x525efa='#';}if(!this['isConfigured'](_0x55e9c5['variable_id'])){this[_0x4028('0x34')][_0x4028('0xb6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x540a9e=this['getVariable']['sync'](this,_0x55e9c5[_0x4028('0xe1')]);if(!_0x540a9e){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x55e9c5,_0x4028('0x11b'));}this[_0x4028('0x34')][_0x4028('0xe4')](_0x540a9e,_0x525efa);}this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x55e9c5,_0x525efa);return _0xa6e4d4;};AGIVertices[_0x4028('0x14')]['noop']=function(_0x127079){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x16b'),_0x127079['label']));return this[_0x4028('0x34')][_0x4028('0xb6')](_0x127079[_0x4028('0x16c')]||_0x127079['label']);};AGIVertices[_0x4028('0x14')]['pause']=function(_0x4aaf25){logger['info'](util[_0x4028('0x26')](_0x4028('0x16d'),_0x4aaf25[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x4aaf25[_0x4028('0x15d')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x4aaf25,'no\x20find\x20by\x20configured');}logger[_0x4028('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4028('0x34')][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));var _0x3b0b6e=this[_0x4028('0x5c')][_0x4028('0x7d')](this,_0x4aaf25[_0x4028('0x16e')]);var _0x1e5e83=this[_0x4028('0x5e')][_0x4028('0x7d')](this,_0x4aaf25[_0x4028('0x15d')],_0x3b0b6e);if(_0x1e5e83){logger['info'](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0x15e'),this['channel'][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4028('0x2c')](util[_0x4028('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4028('0x34')][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x4aaf25[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x160')};}};AGIVertices['prototype'][_0x4028('0x16f')]=function(_0x3f47a){logger['info'](util[_0x4028('0x26')](_0x4028('0x170'),_0x3f47a[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x3f47a[_0x4028('0x113')])){return this[_0x4028('0x34')]['error'](_0x3f47a,_0x4028('0x114'));}var _0x33ed21=this[_0x4028('0x115')]['sync'](this,_0x3f47a[_0x4028('0x113')]);if(!_0x33ed21){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x3f47a,'no\x20file\x20audio\x20found');}var _0x19c5ec=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0x171'),[_0x33ed21,_0x3f47a[_0x4028('0xed')]]);if(_0x19c5ec[_0x4028('0xad')]===-0x1){return _0x19c5ec;}return this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x172'),_0x4028('0x171'),_0x33ed21));};AGIVertices[_0x4028('0x14')][_0x4028('0x173')]=function(_0x5741c0){logger['info'](util[_0x4028('0x26')](_0x4028('0x174'),_0x5741c0[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x5741c0[_0x4028('0x175')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x5741c0,_0x4028('0x176'));}var _0x76f8d0='';var _0x1b78c1=parseInt(_0x5741c0[_0x4028('0x175')],0xa);if(isNaN(_0x1b78c1)){_0x76f8d0=_0x5741c0[_0x4028('0x175')];}else{_0x76f8d0=this['getVoiceQueue'][_0x4028('0x7d')](this,_0x5741c0[_0x4028('0x175')]);if(!_0x76f8d0){return this[_0x4028('0x34')]['error'](_0x5741c0,_0x4028('0x177'));}}var _0x1613bc='';if(this[_0x4028('0x8c')](_0x5741c0[_0x4028('0x113')])){var _0x43b387=this['getSound'][_0x4028('0x7d')](this,_0x5741c0[_0x4028('0x113')]);if(_0x43b387){_0x1613bc=_0x43b387;}}this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x5741c0,_0x76f8d0);if(_0x5741c0[_0x4028('0xed')][_0x4028('0x178')]('x')<0x0){_0x5741c0[_0x4028('0xed')]+='x';}if(_0x5741c0['opts'][_0x4028('0x178')]('X')<0x0){_0x5741c0['opts']+='X';}this[_0x4028('0x34')][_0x4028('0xe4')](_0x4028('0x179'),_0x76f8d0?_0x76f8d0[_0x4028('0x17a')]():'');var _0x52e41a=this['channel'][_0x4028('0xb2')](_0x4028('0x17b'),[_0x76f8d0,_0x5741c0[_0x4028('0xed')],_0x5741c0['url'],_0x1613bc,_0x5741c0['timeout'],_0x5741c0[_0x4028('0x9')],_0x5741c0[_0x4028('0x17c')],_0x5741c0[_0x4028('0x17d')],'',_0x5741c0['position']]);if(_0x52e41a[_0x4028('0xad')]===-0x1){return _0x52e41a;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x172'),_0x4028('0x17b'),_0x76f8d0));};AGIVertices[_0x4028('0x14')][_0x4028('0x17e')]=function(_0x559a2d){logger['info'](util[_0x4028('0x26')](_0x4028('0x17f'),_0x559a2d[_0x4028('0x36')]));var _0x10db27=_0x559a2d[_0x4028('0x180')]||'wav';var _0x3018f2=util[_0x4028('0x26')](_0x4028('0x181'),this[_0x4028('0x34')][_0x4028('0x35')],rs[_0x4028('0x11d')](0x5));var _0x3742c4=util['format'](_0x4028('0x182'),FILES_PATH,_0x3018f2,_0x10db27);var _0x26a2e9=util[_0x4028('0x26')]('%s/recordings/%s',FILES_PATH,_0x3018f2);this['createSquareRecording']['sync'](this,_0x559a2d,_0x3018f2,_0x3742c4);this['channel']['setVariable'](_0x4028('0x183'),_0x3018f2);logger[_0x4028('0x2c')](_0x4028('0x184'),_0x26a2e9,_0x10db27,_0x559a2d[_0x4028('0x185')],_0x559a2d[_0x4028('0x73')]);return this[_0x4028('0x34')][_0x4028('0x13f')](_0x26a2e9,_0x10db27,_0x559a2d[_0x4028('0x185')],_0x559a2d[_0x4028('0x73')],undefined,!![]);};AGIVertices[_0x4028('0x14')][_0x4028('0x186')]=function(_0x31df9e){logger[_0x4028('0x2c')](util['format'](_0x4028('0x187'),_0x31df9e['label']));if(!this[_0x4028('0x8c')](_0x31df9e['url'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x188'));}var _0x54d6ef=this[_0x4028('0x189')][_0x4028('0x7d')](this,_0x31df9e);logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x18a'),util[_0x4028('0x18b')](_0x54d6ef,{'showHidden':![],'depth':null})));if(!this[_0x4028('0x8c')](_0x31df9e[_0x4028('0xe1')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x18c'));}var _0x339079=this['getVariable'][_0x4028('0x7d')](this,_0x31df9e['variable_id']);if(!_0x339079){return this[_0x4028('0x34')]['error'](_0x31df9e,'no\x20variable\x20found');}this['channel'][_0x4028('0xe4')](util['format'](_0x4028('0x18d'),_0x339079),_0x54d6ef[_0x4028('0x82')]?_0x54d6ef[_0x4028('0x82')]:_0x4028('0x18e'));this['channel'][_0x4028('0xe4')](util[_0x4028('0x26')](_0x4028('0x18f'),_0x339079),_0x54d6ef[_0x4028('0x83')]?_0x54d6ef[_0x4028('0x83')]:'OK');if(_0x54d6ef[_0x4028('0x78')]){try{this[_0x4028('0x190')](_0x54d6ef[_0x4028('0x78')],_0x339079);}catch(_0x288dbc){logger[_0x4028('0x2a')](util[_0x4028('0x26')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x339079));}}return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')]('variable\x20%s\x20set',_0x339079));};AGIVertices[_0x4028('0x14')]['saydigits']=function(_0xee13ce){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x191'),_0xee13ce[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0x192')](_0xee13ce[_0x4028('0x193')][_0x4028('0x67')](/\s+/g,''),_0xee13ce[_0x4028('0x185')]);};AGIVertices[_0x4028('0x14')][_0x4028('0x194')]=function(_0x149ad0){logger['info'](util[_0x4028('0x26')](_0x4028('0x195'),_0x149ad0[_0x4028('0x36')]));return this[_0x4028('0x34')][_0x4028('0x196')](_0x149ad0[_0x4028('0x74')][_0x4028('0x67')](/\s+/g,''),_0x149ad0[_0x4028('0x185')]);};AGIVertices['prototype'][_0x4028('0x197')]=function(_0x3da9eb){logger[_0x4028('0x2c')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x3da9eb[_0x4028('0x36')]));return this[_0x4028('0x34')]['sayPhonetic'](_0x3da9eb['text'],_0x3da9eb[_0x4028('0x185')]);};AGIVertices[_0x4028('0x14')][_0x4028('0x198')]=function(_0x2e6e5c){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x199'),_0x2e6e5c[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2e6e5c[_0x4028('0x19a')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x19b'));}var _0x137c2a=this[_0x4028('0x19c')][_0x4028('0x7d')](this,_0x2e6e5c['account_id']);if(!_0x137c2a||!_0x137c2a['Smtp']){return this['channel'][_0x4028('0x2a')](_0x2e6e5c,_0x4028('0x19d'));}var _0x53e8ea={'from':util['format'](_0x4028('0x19e'),_0x137c2a[_0x4028('0x12')],_0x137c2a[_0x4028('0x19f')]||_0x137c2a[_0x4028('0x1a0')]['user']),'to':_0x2e6e5c['to']||'','cc':_0x2e6e5c['cc']||'','bcc':_0x2e6e5c[_0x4028('0x1a1')]||'','subject':_0x2e6e5c[_0x4028('0x1a2')],'html':_0x2e6e5c[_0x4028('0x6b')],'text':_0x2e6e5c[_0x4028('0x6b')]};var _0x44be2e={'tls':{'rejectUnauthorized':![]}};if(_0x137c2a[_0x4028('0x1a0')][_0x4028('0x1a3')]){_0x44be2e[_0x4028('0x1a3')]=_0x137c2a[_0x4028('0x1a0')][_0x4028('0x1a3')];}else{_0x44be2e[_0x4028('0x1a4')]=_0x137c2a['Smtp'][_0x4028('0x1a4')];_0x44be2e[_0x4028('0x1a5')]=_0x137c2a[_0x4028('0x1a0')]['port'];_0x44be2e['secure']=_0x137c2a[_0x4028('0x1a0')][_0x4028('0x1a6')];}if(_0x137c2a['Smtp'][_0x4028('0x1a7')]){_0x44be2e[_0x4028('0x1a8')]={'user':_0x137c2a['Smtp'][_0x4028('0x1a9')],'pass':_0x137c2a[_0x4028('0x1a0')][_0x4028('0x1aa')]};}if(this[_0x4028('0x8c')](_0x2e6e5c[_0x4028('0x1ab')])){}logger[_0x4028('0xe8')](_0x4028('0x1ac'),JSON[_0x4028('0x80')](_0x53e8ea));this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x2e6e5c,_0x2e6e5c[_0x4028('0x19a')]);this['channel']['noop'](util[_0x4028('0x26')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x137c2a[_0x4028('0x12')]));this['sendMailMessage'][_0x4028('0x7d')](this,_0x44be2e,_0x53e8ea);return this[_0x4028('0x34')][_0x4028('0xb6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['sendFax']=function(_0x1bf9d2){logger['info'](util[_0x4028('0x26')](_0x4028('0x1ad'),_0x1bf9d2[_0x4028('0x36')]));return this['channel'][_0x4028('0xb6')](_0x4028('0x1ae'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1af')]=function(_0x50a2e5){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1b0'),_0x50a2e5[_0x4028('0x36')]));if(!this['isConfigured'](_0x50a2e5[_0x4028('0x1b1')])){return this['channel'][_0x4028('0xb6')](_0x4028('0x1b2'));}var _0x59399b=this[_0x4028('0x30')][_0x4028('0x7d')](this,_0x50a2e5[_0x4028('0x1b1')]);if(!_0x59399b){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x50a2e5,_0x4028('0x1b3'));}var _0x412e5a={'body':_0x50a2e5[_0x4028('0x1b4')],'phone':_0x50a2e5['to']||'','SmsAccountId':_0x59399b['id']};logger['debug'](_0x4028('0x1b5'),JSON[_0x4028('0x80')](_0x412e5a));this['createSquareDetailsReport'][_0x4028('0x7d')](this,_0x50a2e5,_0x50a2e5['sms_account_id']);this[_0x4028('0x34')][_0x4028('0xb6')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x59399b[_0x4028('0x12')]));this[_0x4028('0x32')][_0x4028('0x7d')](this,_0x412e5a);return this['channel']['noop'](_0x4028('0x1b6'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1b7')]=function(_0x21ed5d){logger[_0x4028('0x2c')](util['format'](_0x4028('0x1b8'),_0x21ed5d[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x21ed5d[_0x4028('0xe1')])){return this['channel']['error'](_0x21ed5d,'no\x20variable\x20selected');}var _0x3cdca5=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x21ed5d['variable_id']);if(!_0x3cdca5){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x21ed5d,_0x4028('0x11b'));}return this['channel'][_0x4028('0xe4')](_0x3cdca5,_0x21ed5d[_0x4028('0x1b9')]);};AGIVertices['prototype'][_0x4028('0x1ba')]=function(_0x3aaff0){logger['info'](util['format'](_0x4028('0x1bb'),_0x3aaff0['label']));this['channel']['noop'](_0x4028('0x1bc'));if(_0x3aaff0[_0x4028('0xbf')]===_0x4028('0x1bd')){this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x1be'));return this[_0x4028('0x34')][_0x4028('0xbf')]();}return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x1bf'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1c0')]=function(_0x11271f){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1c1'),_0x11271f[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x11271f[_0x4028('0x1c2')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x11271f,_0x4028('0x1c3'));}var _0x2a53ff=this[_0x4028('0x15')][_0x4028('0x7d')](this,_0x11271f[_0x4028('0x1c2')]);if(!this[_0x4028('0x8c')](_0x2a53ff)){return this['channel'][_0x4028('0x2a')](_0x11271f,util[_0x4028('0x26')](_0x4028('0x1c4'),_0x11271f[_0x4028('0x1c2')]));}if(_0x2a53ff===this[_0x4028('0x34')][_0x4028('0x3f')]){return this[_0x4028('0x34')]['error'](_0x11271f,_0x4028('0x1c5'));}this[_0x4028('0x33')]['sync'](this,_0x11271f,_0x2a53ff);var _0x246b1e=this[_0x4028('0x34')][_0x4028('0xb2')](_0x4028('0x1c6'),util[_0x4028('0x26')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x4028('0x9')]['host']||_0x4028('0x1c7'),_0x2a53ff,this['channel'][_0x4028('0x3f')]));if(_0x246b1e[_0x4028('0xad')]===-0x1){return _0x246b1e;}return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')]('Executed\x20command\x20%s\x20%s',_0x4028('0x1c6'),_0x2a53ff));};AGIVertices[_0x4028('0x14')][_0x4028('0x1c8')]=function(_0x51c060){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1c9'),_0x51c060[_0x4028('0x36')]));var _0x259ef0=this[_0x4028('0x1ca')][_0x4028('0x7d')](this,_0x51c060[_0x4028('0xbe')]);this[_0x4028('0x33')][_0x4028('0x7d')](this,_0x51c060,_0x51c060[_0x4028('0xbe')]);if(this[_0x4028('0x8c')](_0x51c060[_0x4028('0xe1')])){var _0x58a735=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x51c060[_0x4028('0xe1')]);if(_0x58a735){this[_0x4028('0x34')]['setVariable'](_0x58a735,_0x259ef0);return this['channel'][_0x4028('0xb6')](util['format'](_0x4028('0x1cb'),_0x51c060[_0x4028('0xbe')],_0x58a735));}}return this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x51c060['command']));};AGIVertices[_0x4028('0x14')][_0x4028('0x1cc')]=function(_0x2207ce){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1cd'),_0x2207ce['label']));_0x2207ce[_0x4028('0x6b')]=_0x2207ce[_0x4028('0x6b')][_0x4028('0x67')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4028('0x8c')](_0x2207ce[_0x4028('0x69')])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0x1ce'));}if(!this[_0x4028('0x8c')](_0x2207ce['text'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this['channel'][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x1cf'),_0x2207ce[_0x4028('0x6b')]));var _0x5aca9a=this[_0x4028('0x68')][_0x4028('0x7d')](this,_0x2207ce);if(_0x5aca9a){this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x1d0'),_0x5aca9a));var _0x9133c9=this['channel'][_0x4028('0x102')](_0x5aca9a);try{fs[_0x4028('0x103')](_0x5aca9a+_0x4028('0x104'));}catch(_0x5b956c){logger[_0x4028('0x2a')](_0x5b956c);}return _0x9133c9;}return this[_0x4028('0x34')]['error'](_0x2207ce,_0x4028('0x1d1'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1d2')]=function(_0x51c246){logger[_0x4028('0x2c')](util[_0x4028('0x26')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x51c246[_0x4028('0x36')]));_0x51c246['text']=_0x51c246['text'][_0x4028('0x67')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x51c246['text'])){return this[_0x4028('0x34')][_0x4028('0xb6')](_0x4028('0xcd'));}this[_0x4028('0x34')]['noop'](util[_0x4028('0x26')](_0x4028('0x1d3'),_0x51c246['text']));var _0x197856=this[_0x4028('0x6f')][_0x4028('0x7d')](this,_0x51c246);if(_0x197856){this['channel']['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x197856));var _0x485dd2=this[_0x4028('0x34')][_0x4028('0x102')](_0x197856);try{fs[_0x4028('0x103')](_0x197856+_0x4028('0x104'));}catch(_0x33a452){logger[_0x4028('0x2a')](_0x33a452);}return _0x485dd2;}return this[_0x4028('0x34')][_0x4028('0x2a')](_0x51c246,_0x4028('0x1d4'));};AGIVertices[_0x4028('0x14')][_0x4028('0x1d5')]=function(_0x2b9d61){logger[_0x4028('0x2c')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2b9d61[_0x4028('0x36')]));if(!this[_0x4028('0x8c')](_0x2b9d61[_0x4028('0x15d')])){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x2b9d61,_0x4028('0x163'));}logger[_0x4028('0x2c')](util[_0x4028('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x4028('0x38')],_0x2b9d61[_0x4028('0x15d')]));var _0x5eb6b6=this[_0x4028('0x60')][_0x4028('0x7d')](this,_0x2b9d61[_0x4028('0x15d')]);if(_0x5eb6b6){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x15e'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2b9d61['findBy']));this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x4028('0x38')],_0x2b9d61[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x164')};}else{logger['info'](util[_0x4028('0x26')](_0x4028('0x15f'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2b9d61[_0x4028('0x15d')]));this[_0x4028('0x34')][_0x4028('0xb6')](util['format'](_0x4028('0x15f'),this[_0x4028('0x34')][_0x4028('0x38')],_0x2b9d61[_0x4028('0x15d')]));return{'code':0xc8,'result':_0x4028('0x160')};}};AGIVertices[_0x4028('0x14')][_0x4028('0x1d6')]=function(_0x76ec10){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1d7'),_0x76ec10[_0x4028('0x36')]));var _0x1b2626=this[_0x4028('0x34')]['exec']('VOICEMAIL',[_0x76ec10['mailbox'],_0x76ec10[_0x4028('0x84')]]);if(_0x1b2626['result']===-0x1){return _0x1b2626;}return this[_0x4028('0x34')][_0x4028('0xb6')](util[_0x4028('0x26')](_0x4028('0x172'),_0x4028('0x1d8'),_0x76ec10['mailbox']));};AGIVertices[_0x4028('0x14')][_0x4028('0x1d9')]=function(_0x9aa11b){logger[_0x4028('0x2c')](util[_0x4028('0x26')](_0x4028('0x1da'),_0x9aa11b['label']));if(!this[_0x4028('0x8c')](_0x9aa11b[_0x4028('0xe1')])){return this[_0x4028('0x34')]['error'](_0x9aa11b,_0x4028('0x1db'));}var _0x46bc5b=this[_0x4028('0xaa')][_0x4028('0x7d')](this,_0x9aa11b['variable_id']);if(!_0x46bc5b){return this[_0x4028('0x34')][_0x4028('0x2a')](_0x9aa11b,_0x4028('0x11b'));}var _0x2dbb1f=this[_0x4028('0x34')]['getVariable'](_0x46bc5b);return{'code':0xc8,'result':_0x2dbb1f[_0x4028('0xab')]?_0x2dbb1f[_0x4028('0xab')]:'-'};};String[_0x4028('0x14')]['replaceAll']=function(_0x38c76f,_0x107585){return this[_0x4028('0xa9')](_0x38c76f)[_0x4028('0x1dc')](_0x107585);};module[_0x4028('0x1dd')]=AGIVertices; \ No newline at end of file +var _0x4323=['awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','agentPause','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','position','record','recordingFormat','%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:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','auth','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','replaceAll','join','exports','lodash','shelljs','randomstring','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','has','dialTimezone','VALUE\x20TZ','getContactByPhone','dialtimezone','utcOffset','minutestoadd','add','minutes','insertContact','getPause','getPauseById','agentUnpause','agentLogout','agentLogin','agent','internal','%s/%s@from-sip/n','shellCommand','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','googleTTS','restAPI','url','number','includes','method','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','options','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','timeout','Wait\x20%s\x20seconds\x20before\x20answer','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','before\x20createcmcontact','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable'];(function(_0x224532,_0x440273){var _0x3a6b95=function(_0x504d0f){while(--_0x504d0f){_0x224532['push'](_0x224532['shift']());}};_0x3a6b95(++_0x440273);}(_0x4323,0xa5));var _0x3432=function(_0x20d72e,_0x534501){_0x20d72e=_0x20d72e-0x0;var _0x2580d6=_0x4323[_0x20d72e];return _0x2580d6;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x3432('0x0'));var sh=require(_0x3432('0x1'));var odbc=require('odbc')();var rs=require(_0x3432('0x2'));var moment=require('moment');var Mustache=require(_0x3432('0x3'));var rp=require(_0x3432('0x4'));var logger=require(_0x3432('0x5'))('agi');var config=require(_0x3432('0x6'));var shared=require('../../config/environment/shared');var scripts=require(_0x3432('0x7'));var FILES_PATH=_0x3432('0x8');var recursiveMapAttributes=[_0x3432('0x9'),_0x3432('0xa')];var verticesWithRetry=['menu',_0x3432('0xb'),'getsecretdigits'];var AGIVertices=function(_0x589e29,_0x43c83a,_0x3f8ff4){this[_0x3432('0xc')]=_0x589e29;this[_0x3432('0xd')]=_0x43c83a;this[_0x3432('0xe')]=_0x3f8ff4;};AGIVertices[_0x3432('0xf')][_0x3432('0x10')]=function(_0x1efdf9,_0xa6f337){this[_0x3432('0xd')][_0x3432('0x11')](_0x1efdf9)[_0x3432('0x12')](function(_0x21126a){_0xa6f337(null,_0x21126a?_0x21126a[_0x3432('0x13')]:![]);})[_0x3432('0x14')](function(_0x4102a1){_0xa6f337(_0x4102a1);});};AGIVertices[_0x3432('0xf')][_0x3432('0x15')]=function(_0x9b0c0d,_0x1e88a3){this[_0x3432('0xd')][_0x3432('0x16')](_0x9b0c0d)[_0x3432('0x12')](function(_0x4bb159){_0x1e88a3(null,_0x4bb159?_0x4bb159['name']:![]);})[_0x3432('0x14')](function(_0x34bd65){_0x1e88a3(_0x34bd65);});};AGIVertices['prototype'][_0x3432('0x17')]=function(_0x5b9528,_0x1f759c){this[_0x3432('0xd')][_0x3432('0x18')](_0x5b9528)[_0x3432('0x12')](function(_0x2ee63f){_0x1f759c(null,_0x2ee63f?_0x2ee63f[_0x3432('0x13')]:![]);})[_0x3432('0x14')](function(_0x2767d1){_0x1f759c(_0x2767d1);});};AGIVertices[_0x3432('0xf')]['getSquareOdbc']=function(_0x254825,_0x3e3ee9){this['rpc'][_0x3432('0x19')](_0x254825)[_0x3432('0x12')](function(_0x4474e1){_0x3e3ee9(null,_0x4474e1?_0x4474e1['dsn']:![]);})[_0x3432('0x14')](function(_0x3f6637){_0x3e3ee9(_0x3f6637);});};AGIVertices[_0x3432('0xf')]['getUser']=function(_0x297a80,_0x4786a6){this[_0x3432('0xd')][_0x3432('0x1a')](_0x297a80)[_0x3432('0x12')](function(_0x2b4a09){_0x4786a6(null,_0x2b4a09?_0x2b4a09[_0x3432('0x13')]:![]);})[_0x3432('0x14')](function(_0x4a141a){_0x4786a6(_0x4a141a);});};AGIVertices[_0x3432('0xf')][_0x3432('0x1b')]=function(_0x4c5bdf,_0x8fbefe){this[_0x3432('0xd')]['getTrunkById'](_0x4c5bdf)[_0x3432('0x12')](function(_0x3567f0){_0x8fbefe(null,_0x3567f0?_0x3567f0[_0x3432('0x13')]:![]);})[_0x3432('0x14')](function(_0x3fa7cb){_0x8fbefe(_0x3fa7cb);});};AGIVertices[_0x3432('0xf')][_0x3432('0x1c')]=function(_0x366ad8,_0x479c16){var _0x4cecc2=this;this[_0x3432('0xd')][_0x3432('0x1d')](_0x366ad8)[_0x3432('0x12')](function(_0x13d797){_0x479c16(null,_0x13d797?_0x4cecc2[_0x3432('0x1e')](_0x13d797[_0x3432('0x1f')]):![]);})[_0x3432('0x14')](function(_0x58b7a4){_0x479c16(_0x58b7a4);});};AGIVertices[_0x3432('0xf')][_0x3432('0x20')]=function(_0x2090d4,_0x335013){this[_0x3432('0xd')][_0x3432('0x21')](_0x2090d4)[_0x3432('0x12')](function(_0x4f4737){_0x335013(null,_0x4f4737?_0x4f4737:![]);})[_0x3432('0x14')](function(_0x29d5db){_0x335013(_0x29d5db);});};AGIVertices[_0x3432('0xf')][_0x3432('0x22')]=function(_0x773810,_0x473733,_0x234bdd){this[_0x3432('0xe')][_0x3432('0x22')](_0x773810,_0x473733)['then'](function(){_0x234bdd(null);})['catch'](function(_0x5cdef8){_0x234bdd(_0x5cdef8);});};AGIVertices[_0x3432('0xf')]['getIntervals']=function(_0xd8c0b6,_0x41df36){this[_0x3432('0xd')][_0x3432('0x23')](_0xd8c0b6)[_0x3432('0x12')](function(_0x30ba08){if(_0x30ba08){if(_0x30ba08[_0x3432('0x24')]){_0x41df36(null,[_0x30ba08[_0x3432('0x25')]]);}else{_0x41df36(null,_['map'](_0x30ba08[_0x3432('0x26')],_0x3432('0x25')));}}else{_0x41df36(null,![]);}})['catch'](function(_0x2475c7){_0x41df36(_0x2475c7);});};AGIVertices[_0x3432('0xf')]['getSoundPath']=function(_0x11d009){return util[_0x3432('0x27')](_0x3432('0x28'),FILES_PATH,_0x11d009);};AGIVertices['prototype']['getQueryOdbc']=function(_0x2fe4ee,_0x581ba4,_0x1e3e7){odbc[_0x3432('0x29')](_0x2fe4ee,function(_0x39a4ee){if(_0x39a4ee){logger['error'](_0x3432('0x2a'),_0x39a4ee);_0x1e3e7(_0x39a4ee);}else{logger['info'](_0x3432('0x2b'));odbc[_0x3432('0x2c')](_0x581ba4,function(_0x38cbca,_0x2409d6){if(_0x38cbca){logger[_0x3432('0x2d')]('Error\x20executing\x20query\x20%s',_0x581ba4);_0x1e3e7(_0x38cbca);}else{logger[_0x3432('0x2d')](_0x3432('0x2e'),_0x581ba4);odbc[_0x3432('0x2f')](function(_0x1d8fdc){if(_0x1d8fdc){logger[_0x3432('0x30')](_0x3432('0x31'),_0x1d8fdc);}_0x1e3e7(null,_0x2409d6);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0xd5323e,_0x10e2e1){this[_0x3432('0xd')]['getSmsAccountById'](_0xd5323e)[_0x3432('0x12')](function(_0x4cf2e9){_0x10e2e1(null,_0x4cf2e9?_0x4cf2e9:![]);})[_0x3432('0x14')](function(_0x1c5a8c){_0x10e2e1(_0x1c5a8c);});};AGIVertices['prototype']['createSmsMessage']=function(_0xad8814,_0x26a903){this[_0x3432('0xd')][_0x3432('0x32')](_0xad8814)[_0x3432('0x12')](function(_0x42b3b1){_0x26a903(null,_0x42b3b1);})[_0x3432('0x14')](function(_0x13df73){_0x26a903(_0x13df73);});};AGIVertices[_0x3432('0xf')][_0x3432('0x33')]=function(_0x559dac,_0x306dad,_0x4c10ad){this[_0x3432('0xd')][_0x3432('0x33')]({'uniqueid':this['channel'][_0x3432('0x34')],'node':_0x559dac[_0x3432('0x35')],'application':_0x559dac[_0x3432('0x36')],'data':_0x306dad||null,'project_name':this[_0x3432('0xc')][_0x3432('0x37')],'callerid':this[_0x3432('0xc')][_0x3432('0x38')]})[_0x3432('0x12')](function(_0x5e970f){if(_0x4c10ad){_0x4c10ad(null,_0x5e970f);}})['catch'](function(_0x33249f){if(_0x4c10ad){_0x4c10ad(_0x33249f);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x427bbc,_0x243fa1,_0x4bfd0c,_0xc4b652){this['rpc'][_0x3432('0x39')]({'uniqueid':this[_0x3432('0xc')]['uniqueid'],'callerid':this[_0x3432('0xc')][_0x3432('0x38')],'calleridname':this[_0x3432('0xc')][_0x3432('0x3a')],'context':this['channel'][_0x3432('0x3b')],'extension':this[_0x3432('0xc')]['extension'],'priority':this['channel'][_0x3432('0x3c')],'accountcode':this[_0x3432('0xc')][_0x3432('0x3d')],'dnid':this[_0x3432('0xc')][_0x3432('0x3e')],'projectName':this[_0x3432('0xc')][_0x3432('0x37')],'saveName':_0x243fa1,'filename':_0x427bbc[_0x3432('0x3f')]||_0x243fa1,'savePath':_0x4bfd0c})[_0x3432('0x12')](function(_0xe6b618){_0xc4b652(null,_0xe6b618);})['catch'](function(_0x239003){_0xc4b652(_0x239003);});};AGIVertices['prototype'][_0x3432('0x40')]=function(_0x57ae90,_0x4ebc02,_0x57cb31){this['rpc']['createSquareMessage']({'uniqueid':this[_0x3432('0xc')]['uniqueid'],'body':_0x57ae90,'direction':_0x4ebc02})[_0x3432('0x12')](function(_0x430bd6){if(_0x57cb31){_0x57cb31(null,_0x430bd6);}})[_0x3432('0x14')](function(_0x15a25b){if(_0x57cb31){_0x57cb31(_0x15a25b);}});};AGIVertices[_0x3432('0xf')][_0x3432('0x41')]=function(_0x301589,_0x46697c){console[_0x3432('0x42')](_0x3432('0x43'),_0x301589);console[_0x3432('0x42')](_0x3432('0x44'),_0x46697c);var _0x26725f=0x0;var _0x3979b9={'firstName':_['isEmpty'](_0x301589[_0x3432('0x13')])||_[_0x3432('0x45')](_0x301589[_0x3432('0x13')])?_0x3432('0x46')+Math[_0x3432('0x47')]():_0x301589[_0x3432('0x13')],'lastName':_[_0x3432('0x48')](_0x301589[_0x3432('0x49')])||_[_0x3432('0x45')](_0x301589[_0x3432('0x49')])?null:_0x301589[_0x3432('0x49')],'phone':_0x301589[_0x3432('0x4a')],'ListId':_0x301589[_0x3432('0x4b')],'scheduledat':_0x301589[_0x3432('0x4c')],'callbackUniqueid':this[_0x3432('0xc')][_0x3432('0x34')],'tags':_0x3432('0x4d'),'description':'Callback\x20scheduled\x20at\x20'+_0x301589[_0x3432('0x4c')][_0x3432('0x4e')](),'priority':_0x301589[_0x3432('0x4f')]};if(_[_0x3432('0x50')](_0x301589,'dialTimezone')){if(!_[_0x3432('0x45')](_0x301589[_0x3432('0x51')])){var _0x5e7c41=_0x301589[_0x3432('0x51')];console['log'](_0x3432('0x52'),_0x5e7c41);if(_0x301589['dialTimezone']=='CALLERID(dialTimezone)'){this['rpc'][_0x3432('0x53')]({'phone':_0x301589['phone']})[_0x3432('0x12')](function(_0x2904f3){console[_0x3432('0x42')]('RES1',_0x2904f3);var _0x37f27b=_0x2904f3[_0x3432('0x51')];console['log'](_0x3432('0x54'),_0x37f27b);if(!_[_0x3432('0x45')](_0x37f27b)){var _0x4a86d1=shared[_0x37f27b];console[_0x3432('0x42')]('tz',_0x4a86d1);if(!_[_0x3432('0x45')](_0x4a86d1)){var _0x38a502=-0x1*_0x4a86d1[_0x3432('0x55')];console[_0x3432('0x42')](_0x3432('0x56'),_0x38a502);console[_0x3432('0x42')]('scheduledat\x20before',_0x3979b9[_0x3432('0x4c')]);_0x3979b9[_0x3432('0x4c')]=moment(_0x301589[_0x3432('0x4c')])[_0x3432('0x57')](_0x38a502,_0x3432('0x58'));console['log']('scheduledat\x20after',_0x3979b9[_0x3432('0x4c')]);this[_0x3432('0xd')][_0x3432('0x59')](_0x3979b9,_0x301589,_0x46697c)[_0x3432('0x12')](function(_0x18b49f){_0x46697c(null,_0x18b49f);})[_0x3432('0x14')](function(_0x134956){_0x46697c(_0x134956);});}else{this[_0x3432('0xd')]['insertContact'](_0x3979b9,_0x301589,_0x46697c)['then'](function(_0x36a64b){_0x46697c(null,_0x36a64b);})['catch'](function(_0x1e6580){_0x46697c(_0x1e6580);});}}else{this[_0x3432('0xd')][_0x3432('0x59')](_0x3979b9,_0x301589,_0x46697c)[_0x3432('0x12')](function(_0x302f35){_0x46697c(null,_0x302f35);})['catch'](function(_0x1f1c52){_0x46697c(_0x1f1c52);});}});}else{var _0x26725f=shared[_0x5e7c41];if(!_[_0x3432('0x45')](_0x26725f)){var _0x9cbbca=-0x1*_0x26725f[_0x3432('0x55')];_0x3979b9[_0x3432('0x4c')]=moment(_0x301589[_0x3432('0x4c')])[_0x3432('0x57')](_0x9cbbca,_0x3432('0x58'));this[_0x3432('0xd')][_0x3432('0x59')](_0x3979b9,_0x301589,_0x46697c)['then'](function(_0x13c094){_0x46697c(null,_0x13c094);})[_0x3432('0x14')](function(_0x48aabb){_0x46697c(_0x48aabb);});}else{this[_0x3432('0xd')]['insertContact'](_0x3979b9,_0x301589,_0x46697c)[_0x3432('0x12')](function(_0x55c49b){_0x46697c(null,_0x55c49b);})[_0x3432('0x14')](function(_0x38161c){_0x46697c(_0x38161c);});}}}else{this[_0x3432('0xd')][_0x3432('0x59')](_0x3979b9,_0x301589,_0x46697c)[_0x3432('0x12')](function(_0x734743){_0x46697c(null,_0x734743);})[_0x3432('0x14')](function(_0x2e49e4){_0x46697c(_0x2e49e4);});}}else{this[_0x3432('0xd')][_0x3432('0x59')](_0x3979b9,_0x301589,_0x46697c)[_0x3432('0x12')](function(_0x5a499d){_0x46697c(null,_0x5a499d);})['catch'](function(_0x81ef67){_0x46697c(_0x81ef67);});}};AGIVertices[_0x3432('0xf')]['insertContact']=function(_0x3bdcba,_0x17ccc2,_0x114fb8){this[_0x3432('0xd')]['createCmContact'](_0x3bdcba)['then'](function(_0x58ffaf){_0x114fb8(null,_0x58ffaf);})[_0x3432('0x14')](function(_0x5a68b9){_0x114fb8(_0x5a68b9);});};AGIVertices[_0x3432('0xf')][_0x3432('0x5a')]=function(_0x4aea01,_0x317049){this[_0x3432('0xd')][_0x3432('0x5b')](_0x4aea01)[_0x3432('0x12')](function(_0xc29951){_0x317049(null,_0xc29951?_0xc29951[_0x3432('0x13')]:![]);})[_0x3432('0x14')](function(_0x506695){_0x317049(_0x506695);});};AGIVertices['prototype']['agentPause']=function(_0x3f09bd,_0x53e2fd,_0x1e8009){var _0x1dce33={'role':'agent'};_0x1dce33[_0x3f09bd]=this[_0x3432('0xc')][_0x3432('0x38')];this[_0x3432('0xd')]['agentPause'](_0x1dce33,_0x53e2fd,this[_0x3432('0xc')][_0x3432('0x34')])['then'](function(_0x3186f3){_0x1e8009(null,_['isNil'](_0x3186f3)?![]:!![]);})[_0x3432('0x14')](function(_0x4e501f){logger[_0x3432('0x30')](_0x4e501f);_0x1e8009(null,![]);});};AGIVertices[_0x3432('0xf')][_0x3432('0x5c')]=function(_0x538f97,_0x15afb3){var _0x2a4dc2={'role':'agent'};_0x2a4dc2[_0x538f97]=this[_0x3432('0xc')][_0x3432('0x38')];this[_0x3432('0xd')]['agentUnpause'](_0x2a4dc2)[_0x3432('0x12')](function(_0x5e2bef){_0x15afb3(null,_[_0x3432('0x45')](_0x5e2bef)?![]:!![]);})[_0x3432('0x14')](function(_0x294853){logger[_0x3432('0x30')](_0x294853);_0x15afb3(null,![]);});};AGIVertices[_0x3432('0xf')][_0x3432('0x5d')]=function(_0x3ea7bc,_0x336cc6){var _0x295e51={'role':'agent'};_0x295e51[_0x3ea7bc]=this[_0x3432('0xc')][_0x3432('0x38')];this['rpc'][_0x3432('0x5d')](_0x295e51)['then'](function(_0x3f318a){_0x336cc6(null,_[_0x3432('0x45')](_0x3f318a)?![]:!![]);})[_0x3432('0x14')](function(_0x4ba20f){logger['error'](_0x4ba20f);_0x336cc6(null,![]);});};AGIVertices[_0x3432('0xf')][_0x3432('0x5e')]=function(_0x325f9a,_0x51216f){var _0x2edc41={'role':_0x3432('0x5f')};_0x2edc41[_0x325f9a]=this['channel'][_0x3432('0x38')];var _0x5ec131=_0x325f9a!=_0x3432('0x60')?util[_0x3432('0x27')](_0x3432('0x61'),'LOCAL',this['channel'][_0x3432('0x38')]):undefined;this[_0x3432('0xd')][_0x3432('0x5e')](_0x2edc41,_0x5ec131)[_0x3432('0x12')](function(_0x47c181){_0x51216f(null,_[_0x3432('0x45')](_0x47c181)?![]:!![]);})[_0x3432('0x14')](function(_0x44161a){logger['error'](_0x44161a);_0x51216f(null,![]);});};AGIVertices[_0x3432('0xf')][_0x3432('0x62')]=function(_0x1530b4,_0x4be12f){sh[_0x3432('0x63')](_['trim'](_0x1530b4),function(_0x1ee82c,_0x3b3e65){var _0x22b241=_0x3b3e65[_0x3432('0x64')](/(\r\n|\n|\r)/gm,'');_0x4be12f(null,_0x22b241);});};AGIVertices[_0x3432('0xf')][_0x3432('0x65')]=function(_0x3bedfe,_0x277093){scripts[_0x3432('0x65')](_0x3bedfe['apiKey'],_0x3bedfe[_0x3432('0x66')]||_0x3432('0x67'),_0x3bedfe[_0x3432('0x67')],_0x3bedfe['languageCode']||_0x3432('0x68'),_0x3bedfe[_0x3432('0x69')]||'MALE',_0x3bedfe[_0x3432('0x6a')]||'MP3')[_0x3432('0x12')](function(_0xb8ac0e){_0x277093(null,_0xb8ac0e);})[_0x3432('0x14')](function(_0x99ab6b){_0x277093(_0x99ab6b);});};AGIVertices[_0x3432('0xf')][_0x3432('0x6b')]=function(_0x24a541,_0xa70ade){scripts[_0x3432('0x6b')](_0x24a541[_0x3432('0x67')],_0x24a541['google_tts_language']||'en',0x1)[_0x3432('0x12')](function(_0x55964f){_0xa70ade(null,_0x55964f);})[_0x3432('0x14')](function(_0x213a16){_0xa70ade(_0x213a16);});};AGIVertices[_0x3432('0xf')][_0x3432('0x6c')]=function(_0x1574f6,_0x51edfe){var _0x3d58dc={'uri':_0x1574f6[_0x3432('0x6d')],'method':_0x1574f6['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1574f6['timeout'])===_0x3432('0x6e')&&parseInt(_0x1574f6['timeout'])>=0x1?parseInt(_0x1574f6['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x3432('0x6f')](['POST','PUT'],_0x3d58dc[_0x3432('0x70')]['toUpperCase']())){try{_0x3d58dc['body']=_0x1574f6[_0x3432('0xa')]?JSON[_0x3432('0x71')](_0x1574f6[_0x3432('0xa')]):{};}catch(_0x21ef32){logger[_0x3432('0x30')](_0x3432('0x72'),_0x21ef32);}}try{_0x3d58dc['headers']=_0x1574f6[_0x3432('0x9')]?JSON[_0x3432('0x71')](_0x1574f6[_0x3432('0x9')]):{};}catch(_0x5a3b2c){logger['error'](_0x3432('0x73'),_0x5a3b2c);}if(_0x1574f6['computedVariables']){try{var _0x1ce042=require(_0x1574f6[_0x3432('0x74')])['sync'](this,_0x3d58dc);_0x3d58dc[_0x3432('0x75')]=Mustache[_0x3432('0x76')](_0x1574f6[_0x3432('0x6d')],_0x1ce042,{},['$$','$$']);if(_0x3d58dc[_0x3432('0x77')]){_0x3d58dc[_0x3432('0x77')]=JSON[_0x3432('0x71')](Mustache['render'](JSON[_0x3432('0x78')](_0x3d58dc[_0x3432('0x77')]),_0x1ce042,{},['$$','$$']));}if(_0x3d58dc[_0x3432('0x79')]){_0x3d58dc[_0x3432('0x79')]=JSON[_0x3432('0x71')](Mustache['render'](JSON[_0x3432('0x78')](_0x3d58dc['body']),_0x1ce042,{},['$$','$$']));}}catch(_0x8ad178){logger[_0x3432('0x30')](_0x3432('0x7a'),_0x8ad178);}}rp(_0x3d58dc)[_0x3432('0x12')](function(_0x416d8a){var _0x556f38={'statusCode':_0x416d8a[_0x3432('0x7b')]||0xc8,'statusMessage':_0x416d8a[_0x3432('0x7c')]||'OK','headers':_0x416d8a[_0x3432('0x77')]||{},'body':_0x416d8a[_0x3432('0x79')]||{}};_0x51edfe(null,_0x556f38);})[_0x3432('0x14')](function(_0x3751b4){var _0x692c34={'statusCode':_0x3751b4[_0x3432('0x7b')]||0x1f4,'statusMessage':_0x3751b4[_0x3432('0x7d')]||_0x3432('0x7e'),'headers':_0x3751b4['options'][_0x3432('0x77')]||{},'body':_0x3751b4['options'][_0x3432('0x79')]||{}};_0x51edfe(null,_0x692c34);});};AGIVertices['prototype'][_0x3432('0x7f')]=function(_0xbb4c5,_0x634758){scripts[_0x3432('0x7f')](this[_0x3432('0xc')][_0x3432('0x34')],_0xbb4c5[_0x3432('0x80')],_0xbb4c5[_0x3432('0x67')],_0xbb4c5[_0x3432('0x81')]||'en')[_0x3432('0x12')](function(_0x1a0888){_0x634758(null,_0x1a0888);})['catch'](function(_0x4c93d8){_0x634758(_0x4c93d8);});};AGIVertices[_0x3432('0xf')][_0x3432('0x82')]=function(_0x9ceeff,_0x440982){scripts['sestekNDA'](this[_0x3432('0xc')],_0x9ceeff)[_0x3432('0x12')](function(_0x466301){_0x440982(null,_0x466301);})[_0x3432('0x14')](function(_0x46736f){_0x440982(_0x46736f);});};AGIVertices['prototype'][_0x3432('0x83')]=function(_0x1e67ec,_0x55d186){scripts[_0x3432('0x83')](_0x1e67ec[_0x3432('0x80')],_0x1e67ec['text'],_0x1e67ec[_0x3432('0x84')]||_0x3432('0x68'),_0x1e67ec['speed'])['then'](function(_0x41bde1){_0x55d186(null,_0x41bde1);})['catch'](function(_0xd87d21){_0x55d186(_0xd87d21);});};AGIVertices[_0x3432('0xf')][_0x3432('0x85')]=function(_0x8b665c,_0x33990c,_0x37313a){scripts[_0x3432('0x85')](_0x33990c,_0x8b665c[_0x3432('0x80')],_0x8b665c[_0x3432('0x86')]||_0x3432('0x68'),this['isConfigured'](_0x8b665c[_0x3432('0x87')])?_0x8b665c['model']:undefined)[_0x3432('0x12')](function(_0x1b5326){_0x37313a(null,_0x1b5326);})[_0x3432('0x14')](function(_0x3cfd34){_0x37313a(_0x3cfd34);});};AGIVertices[_0x3432('0xf')][_0x3432('0x88')]=function(_0x5ec81c,_0x1f1c93){scripts[_0x3432('0x88')](_0x5ec81c['aws_access_key_id'],_0x5ec81c['aws_secret_access_key'],_0x5ec81c[_0x3432('0x89')],_0x5ec81c['aws_polly_voice']||_0x3432('0x8a'),_0x5ec81c['text'],_0x5ec81c[_0x3432('0x8b')]||_0x3432('0x67'))[_0x3432('0x12')](function(_0x1ac74b){_0x1f1c93(null,_0x1ac74b);})[_0x3432('0x14')](function(_0x39df99){_0x1f1c93(_0x39df99);});};AGIVertices[_0x3432('0xf')][_0x3432('0x8c')]=function(_0x45ba9f,_0x3fe190){scripts['awsLex'](this[_0x3432('0xc')][_0x3432('0x34')],_0x45ba9f['aws_access_key_id'],_0x45ba9f[_0x3432('0x8d')],_0x45ba9f[_0x3432('0x8e')],_0x45ba9f[_0x3432('0x67')],_0x45ba9f['aws_bot_name'])[_0x3432('0x12')](function(_0x9ead0){_0x3fe190(null,_0x9ead0);})[_0x3432('0x14')](function(_0xac7490){_0x3fe190(_0xac7490);});};AGIVertices['prototype'][_0x3432('0x8f')]=function(_0x43979b,_0x14cc75,_0x2c5143){scripts[_0x3432('0x8f')](_0x14cc75,_0x43979b[_0x3432('0x80')],_0x43979b[_0x3432('0x90')]||_0x3432('0x68'))[_0x3432('0x12')](function(_0x3c3e5f){_0x2c5143(null,_0x3c3e5f);})[_0x3432('0x14')](function(_0x4e0fd8){_0x2c5143(_0x4e0fd8);});};AGIVertices['prototype']['tildeASR']=function(_0x1ddbcc,_0x22c88c,_0x547b19){scripts[_0x3432('0x91')](_0x22c88c,_0x1ddbcc['appid'],_0x1ddbcc[_0x3432('0x92')],_0x1ddbcc[_0x3432('0x75')])[_0x3432('0x12')](function(_0x4269a2){_0x547b19(null,_0x4269a2);})[_0x3432('0x14')](function(_0x19c4b9){_0x547b19(_0x19c4b9);});};AGIVertices[_0x3432('0xf')][_0x3432('0x93')]=function(_0x4b35e){var _0x6f0c1a=_[_0x3432('0x6f')](verticesWithRetry,_0x4b35e[_0x3432('0x36')])?_0x4b35e:_[_0x3432('0x94')](_0x4b35e);for(var _0x5f4497 in _0x6f0c1a){if(_0x6f0c1a['hasOwnProperty'](_0x5f4497)){if(_0x6f0c1a[_0x5f4497]&&_[_0x3432('0x95')](_0x6f0c1a[_0x5f4497])){if(_[_0x3432('0x6f')](recursiveMapAttributes,_0x5f4497)){_0x6f0c1a[_0x5f4497]=this[_0x3432('0x96')](_0x6f0c1a[_0x5f4497]);}else{_0x6f0c1a[_0x5f4497]=this[_0x3432('0x97')](_0x6f0c1a[_0x5f4497]);}}}}return _0x6f0c1a;};AGIVertices[_0x3432('0xf')][_0x3432('0x98')]=function(_0xaabee5){for(var _0x31eff3 in _0xaabee5){if(_0xaabee5[_0x3432('0x99')](_0x31eff3)){if(_[_0x3432('0x9a')](_0xaabee5[_0x31eff3])){this[_0x3432('0x98')](_0xaabee5[_0x31eff3]);}else if(_['isArray'](_0xaabee5[_0x31eff3])){for(var _0x43b30d=0x0;_0x43b30d<_0xaabee5[_0x31eff3][_0x3432('0x9b')];_0x43b30d++){this[_0x3432('0x98')](_0xaabee5[_0x31eff3][_0x43b30d]);}}else if(_['isString'](_0xaabee5[_0x31eff3])){_0xaabee5[_0x31eff3]=this[_0x3432('0x97')](_0xaabee5[_0x31eff3]);}}}};AGIVertices[_0x3432('0xf')][_0x3432('0x9c')]=function(_0x4a6996,_0x2e2fd8){for(var _0x1fa115 in _0x4a6996){if(_0x4a6996[_0x3432('0x99')](_0x1fa115)){if(_['isPlainObject'](_0x4a6996[_0x1fa115])){if(!_['isEmpty'](_0x4a6996[_0x1fa115])){this['saveRestApiResult'](_0x4a6996[_0x1fa115],util[_0x3432('0x27')](_0x3432('0x9d'),_0x2e2fd8,_0x1fa115));}}else if(_[_0x3432('0x9e')](_0x4a6996[_0x1fa115])){for(var _0x33882f=0x0;_0x33882f<_0x4a6996[_0x1fa115][_0x3432('0x9b')];_0x33882f++){this[_0x3432('0x9c')](_0x4a6996[_0x1fa115][_0x33882f],util[_0x3432('0x27')]('%s.%s',_0x2e2fd8,_0x1fa115+'['+_0x33882f+']'));}}else{if(!_[_0x3432('0x45')](_0x4a6996[_0x1fa115])){this[_0x3432('0xc')][_0x3432('0x9f')](util[_0x3432('0x27')](_0x3432('0x9d'),_0x2e2fd8,_0x1fa115),_0x4a6996[_0x1fa115]);}}}}};AGIVertices['prototype'][_0x3432('0x96')]=function(_0x5f3412){try{var _0xcf3889=JSON[_0x3432('0x71')](_0x5f3412);this['recursiveNodeIndex'](_0xcf3889);return JSON[_0x3432('0x78')](_0xcf3889);}catch(_0x45a7a4){return this[_0x3432('0x97')](_0x5f3412);}};AGIVertices['prototype'][_0x3432('0x97')]=function(_0x4b3ca4){console[_0x3432('0x42')]('replaceall\x20init',_0x4b3ca4);var _0x21b56e=_0x4b3ca4[_0x3432('0xa0')]('{');for(var _0x18a75b=0x1;_0x18a75b<_0x21b56e[_0x3432('0x9b')];_0x18a75b+=0x1){var _0x411d95=_0x21b56e[_0x18a75b][_0x3432('0xa0')]('}');console[_0x3432('0x42')]('nextbracket',_0x411d95);if(_0x411d95[_0x3432('0x9b')]>0x1){_0x4b3ca4=_0x4b3ca4['replaceAll']('{'+_0x411d95[0x0]+'}',this['channel'][_0x3432('0x10')](_0x411d95[0x0])['extra']||_0x411d95[0x0]);}}if(_0x21b56e[_0x3432('0x9b')]===0x1){return _0x4b3ca4[_0x3432('0x4e')]();}console[_0x3432('0x42')](_0x3432('0xa1'),_0x4b3ca4);return this[_0x3432('0x97')](_0x4b3ca4);};AGIVertices[_0x3432('0xf')][_0x3432('0xa2')]=function(_0x5bd71a,_0xd60f9){var _0x24c75b=this[_0x3432('0xc')]['getVariable'](_0x5bd71a);if(_0x24c75b[_0x3432('0xa3')]===-0x1){return _0x24c75b;}logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0xa4'),_0xd60f9,_0x24c75b[_0x3432('0xa5')]));return this['channel']['setVariable'](_0xd60f9,_0x24c75b[_0x3432('0xa5')]);};AGIVertices['prototype'][_0x3432('0xa6')]=function(_0x23c966){return _0x23c966&&_0x23c966!=='0'&&_0x23c966!=='-1'&&_0x23c966!=='';};AGIVertices[_0x3432('0xf')][_0x3432('0xa7')]=function(_0x155d2b){this[_0x3432('0x33')]['sync'](this,_0x155d2b,'-');_0x155d2b[_0x3432('0xa8')]=_0x155d2b[_0x3432('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3432('0xf')][_0x3432('0xa9')]=function(_0x48b6d8){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x48b6d8[_0x3432('0x35')]));if(!this['isConfigured'](_0x48b6d8[_0x3432('0x67')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xab'));}var _0x46db9d='\x22'+_0x48b6d8[_0x3432('0x67')]+'\x22';if(this[_0x3432('0xa6')](_0x48b6d8['options'])){_0x46db9d+=','+_0x48b6d8['options'];}var _0x45c6d0=this[_0x3432('0xc')][_0x3432('0x63')](_0x3432('0xac'),_0x46db9d);if(_0x45c6d0[_0x3432('0xa3')]===-0x1){return _0x45c6d0;}return this[_0x3432('0xc')][_0x3432('0xaa')](util['format'](_0x3432('0xad'),_0x46db9d));};AGIVertices[_0x3432('0xf')][_0x3432('0xae')]=function(_0x59cdaf){logger[_0x3432('0x2d')](util['format'](_0x3432('0xaf'),_0x59cdaf[_0x3432('0x35')]));if(!this['isConfigured'](_0x59cdaf[_0x3432('0xb0')])){return this[_0x3432('0xc')][_0x3432('0xaa')]('no\x20grammar\x20configured');}var _0x236462=_0x59cdaf[_0x3432('0xb0')];if(this[_0x3432('0xa6')](_0x59cdaf['options'])){_0x236462+=','+_0x59cdaf[_0x3432('0xb1')];}var _0x49deef=this['channel']['exec'](_0x3432('0xb2'),_0x236462);if(_0x49deef[_0x3432('0xa3')]===-0x1){return _0x49deef;}var _0x32bba2=this[_0x3432('0xa2')](_0x3432('0xb3'),_0x3432('0xb4'));if(_0x32bba2[_0x3432('0xa3')]===-0x1){return _0x32bba2;}var _0x1d7c61=this[_0x3432('0xa2')](_0x3432('0xb5'),_0x3432('0xb6'));if(_0x1d7c61[_0x3432('0xa3')]===-0x1){return _0x1d7c61;}var _0x1611fc=this[_0x3432('0xa2')](_0x3432('0xb7'),_0x3432('0xb8'));if(_0x1611fc['result']===-0x1){return _0x1611fc;}return this[_0x3432('0xc')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x236462));};AGIVertices[_0x3432('0xf')][_0x3432('0xb9')]=function(_0x5b5f25){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0xba'),_0x5b5f25[_0x3432('0x35')]));return this[_0x3432('0xc')][_0x3432('0xb9')]([_0x5b5f25[_0x3432('0xbb')],_0x5b5f25[_0x3432('0xbc')]]);};AGIVertices['prototype']['answer']=function(_0x14e6c3){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x14e6c3[_0x3432('0x35')]));if(this[_0x3432('0xa6')](_0x14e6c3[_0x3432('0xbd')])){logger[_0x3432('0x2d')](util['format'](_0x3432('0xbe'),_0x14e6c3[_0x3432('0xbd')]));var _0x17adf4=this[_0x3432('0xc')]['wait'](_0x14e6c3['timeout']);if(_0x17adf4[_0x3432('0xa3')]===-0x1){return _0x17adf4;}}return this[_0x3432('0xc')][_0x3432('0xbf')]();};AGIVertices[_0x3432('0xf')]['callback']=function(_0xee1ec){console['log']('enter\x20in\x20callbackblock',_0xee1ec);logger[_0x3432('0x2d')](util['format'](_0x3432('0xc0'),_0xee1ec[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0xee1ec[_0x3432('0x4b')])){return this[_0x3432('0xc')][_0x3432('0x30')](_0xee1ec,_0x3432('0xc1'));}_0xee1ec[_0x3432('0x4c')]=moment();if(this[_0x3432('0xa6')](_0xee1ec['delay'])){_0xee1ec[_0x3432('0x4c')]=moment()[_0x3432('0x57')](_0xee1ec['delay'],_0x3432('0x58'));}if(!this[_0x3432('0xa6')](_0xee1ec[_0x3432('0x4f')])){_0xee1ec[_0x3432('0x4f')]=0x2;}console[_0x3432('0x42')](_0x3432('0xc2'),_0xee1ec);this[_0x3432('0x41')][_0x3432('0xc3')](this,_0xee1ec);return this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0xc4'),_0xee1ec[_0x3432('0x4a')],_0xee1ec[_0x3432('0x4b')],_0xee1ec['scheduledAt']));};AGIVertices[_0x3432('0xf')][_0x3432('0xc5')]=function(_0x5f2db6){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x5f2db6[_0x3432('0x35')]));var _0x1acb09=this[_0x3432('0xc')][_0x3432('0x63')](_0x5f2db6[_0x3432('0xc6')],_0x5f2db6[_0x3432('0xb1')]);if(_0x1acb09[_0x3432('0xa3')]===-0x1){return _0x1acb09;}return this[_0x3432('0xc')][_0x3432('0xaa')](util['format']('Executed\x20command\x20%s\x20%s',_0x5f2db6[_0x3432('0xc6')],_0x5f2db6[_0x3432('0xb1')]));};AGIVertices[_0x3432('0xf')][_0x3432('0xc7')]=function(_0x562f08){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0xc8'),_0x562f08['label']));if(!this[_0x3432('0xa6')](_0x562f08['text'])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xab'));}var _0x403fa4='\x22'+_0x562f08[_0x3432('0x67')]+'\x22';if(this['isConfigured'](_0x562f08[_0x3432('0xb1')])){_0x403fa4+=','+_0x562f08['options'];}var _0x5227af=this[_0x3432('0xc')]['exec'](_0x3432('0xac'),_0x403fa4);if(_0x5227af[_0x3432('0xa3')]===-0x1){return _0x5227af;}return this[_0x3432('0xc')]['noop'](util[_0x3432('0x27')](_0x3432('0xad'),_0x403fa4));};AGIVertices['prototype'][_0x3432('0xc9')]=function(_0x4749c8){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0xca'),_0x4749c8[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x4749c8['text'])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xab'));}var _0x54b344='\x22'+_0x4749c8[_0x3432('0x67')]+'\x22';if(this[_0x3432('0xa6')](_0x4749c8[_0x3432('0xb1')])){_0x54b344+=','+_0x4749c8['options'];}var _0x20241f=this['channel'][_0x3432('0x63')](_0x3432('0xac'),_0x54b344);if(_0x20241f[_0x3432('0xa3')]===-0x1){return _0x20241f;}return this[_0x3432('0xc')][_0x3432('0xaa')](util['format'](_0x3432('0xad'),_0x54b344));};AGIVertices[_0x3432('0xf')][_0x3432('0xcb')]=function(_0x2e9061){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0xcc'),_0x2e9061[_0x3432('0x35')]));if(!this['isConfigured'](_0x2e9061['grammar'])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xcd'));}var _0x21e351=_0x2e9061['grammar'];if(this['isConfigured'](_0x2e9061[_0x3432('0xb1')])){_0x21e351+=','+_0x2e9061['options'];}var _0x23d114=this['channel']['exec']('MRCPRecog',_0x21e351);if(_0x23d114['result']===-0x1){return _0x23d114;}var _0x1d7b3a=this[_0x3432('0xa2')](_0x3432('0xb3'),_0x3432('0xce'));if(_0x1d7b3a[_0x3432('0xa3')]===-0x1){return _0x1d7b3a;}var _0x1722d9=this[_0x3432('0xa2')](_0x3432('0xb5'),_0x3432('0xcf'));if(_0x1722d9['result']===-0x1){return _0x1722d9;}var _0x3fff35=this[_0x3432('0xa2')](_0x3432('0xb7'),_0x3432('0xd0'));if(_0x3fff35['result']===-0x1){return _0x3fff35;}return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x21e351));};AGIVertices[_0x3432('0xf')]['sestekasr']=function(_0x1013f3){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0xd1'),_0x1013f3[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x1013f3[_0x3432('0xb0')])){return this['channel'][_0x3432('0xaa')](_0x3432('0xcd'));}var _0x56a4e2=_0x1013f3[_0x3432('0xb0')];if(this[_0x3432('0xa6')](_0x1013f3[_0x3432('0xb1')])){_0x56a4e2+=','+_0x1013f3[_0x3432('0xb1')];}var _0x50532f=this[_0x3432('0xc')]['exec']('MRCPRecog',_0x56a4e2);if(_0x50532f['result']===-0x1){return _0x50532f;}var _0x3e3bf5=this[_0x3432('0xa2')](_0x3432('0xb3'),_0x3432('0xd2'));if(_0x3e3bf5[_0x3432('0xa3')]===-0x1){return _0x3e3bf5;}var _0x3762ac=this[_0x3432('0xa2')](_0x3432('0xb5'),_0x3432('0xd3'));if(_0x3762ac['result']===-0x1){return _0x3762ac;}var _0x1dd7a4=this[_0x3432('0xa2')](_0x3432('0xb7'),'SESTEK_ASR_INSTANCE');if(_0x1dd7a4[_0x3432('0xa3')]===-0x1){return _0x1dd7a4;}return this[_0x3432('0xc')]['noop'](util[_0x3432('0x27')](_0x3432('0xd4'),_0x56a4e2));};AGIVertices[_0x3432('0xf')]['database']=function(_0x3d1128){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3d1128['label']));if(!this[_0x3432('0xa6')](_0x3d1128[_0x3432('0xd5')])){return this[_0x3432('0xc')][_0x3432('0x30')](_0x3d1128,_0x3432('0xd6'));}var _0x4fbd8d=this[_0x3432('0xd7')][_0x3432('0xc3')](this,_0x3d1128[_0x3432('0xd5')]);if(!_0x4fbd8d){return this[_0x3432('0xc')][_0x3432('0x30')](_0x3d1128,_0x3432('0xd8'));}if(!this[_0x3432('0xa6')](_0x3d1128[_0x3432('0x2c')])){return this['channel'][_0x3432('0x30')](_0x3d1128,'no\x20query\x20configured');}var _0x44304f=_0x3d1128[_0x3432('0x2c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0xd9'),_0x44304f));var _0x356107=this[_0x3432('0xda')]['sync'](this,_0x4fbd8d,_0x44304f);this['createSquareDetailsReport']['sync'](this,_0x3d1128,_0x44304f);if(!this[_0x3432('0xa6')](_0x3d1128[_0x3432('0xdb')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xdc'));}var _0x18759d=this[_0x3432('0x10')][_0x3432('0xc3')](this,_0x3d1128[_0x3432('0xdb')]);if(!_0x18759d){return this[_0x3432('0xc')][_0x3432('0x30')](_0x3d1128,'no\x20variable\x20found');}var _0x35146d=this;_0x356107[_0x3432('0xdd')](function(_0x27b221,_0x553050){Object[_0x3432('0xde')](_0x27b221)[_0x3432('0xdd')](function(_0x11e359){_0x35146d[_0x3432('0xc')][_0x3432('0x9f')](util[_0x3432('0x27')]('%s[%s][%s]',_0x18759d,_0x553050,_0x11e359),_0x27b221[_0x11e359]);});});this[_0x3432('0xc')][_0x3432('0x9f')](util[_0x3432('0x27')](_0x3432('0xdf'),_0x18759d),_0x356107[_0x3432('0x9b')]);return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')]('variable\x20%s\x20set',_0x18759d));};AGIVertices[_0x3432('0xf')][_0x3432('0xe0')]=function(_0x5d833e){logger[_0x3432('0xe1')](util[_0x3432('0x27')](_0x3432('0xe2'),_0x5d833e[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x5d833e[_0x3432('0xe3')])){return this['channel'][_0x3432('0x30')](_0x5d833e,_0x3432('0xe4'));}var _0x3c4815=this['getUser']['sync'](this,_0x5d833e[_0x3432('0xe3')]);if(!_0x3c4815){return this[_0x3432('0xc')]['error'](_0x5d833e,_0x3432('0xe5'));}var _0x5a1e80=this[_0x3432('0xc')][_0x3432('0x63')](_0x3432('0xe6'),[util[_0x3432('0x27')](_0x3432('0xe7'),_0x3c4815),_0x5d833e[_0x3432('0xbd')],_0x5d833e['opts'],_0x5d833e[_0x3432('0x6d')]]);if(_0x5a1e80[_0x3432('0xa3')]===-0x1){return _0x5a1e80;}return this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0xe8'),_0x3432('0xe6')));};AGIVertices[_0x3432('0xf')][_0x3432('0xe9')]=function(_0x421e42){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x421e42[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x421e42[_0x3432('0x80')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xea'));}if(!this[_0x3432('0xa6')](_0x421e42[_0x3432('0x67')])){return this['channel'][_0x3432('0xaa')](_0x3432('0xab'));}this[_0x3432('0xc')][_0x3432('0xeb')]=!![];this[_0x3432('0x33')](_0x421e42);this[_0x3432('0x40')](_0x421e42[_0x3432('0x67')],'in');this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0xec'),_0x421e42['text']));var _0x8438e0=this[_0x3432('0x7f')]['sync'](this,_0x421e42);if(_0x8438e0){for(var _0x3854de in _0x8438e0){if(_0x8438e0[_0x3432('0x99')](_0x3854de)){this[_0x3432('0xc')][_0x3432('0x9f')](util[_0x3432('0x27')](_0x3432('0xed'),_0x3854de[_0x3432('0xee')]()),_0x8438e0[_0x3854de]);}}this[_0x3432('0x40')](_0x8438e0[_0x3432('0xef')],_0x3432('0xf0'));return this[_0x3432('0xc')]['noop'](util[_0x3432('0x27')]('Dialogflow\x20Result\x20%s',_0x8438e0[_0x3432('0xef')]));}return this[_0x3432('0xc')][_0x3432('0x30')](_0x421e42,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x3432('0xf')][_0x3432('0xf1')]=function(_0x5bfd02){logger[_0x3432('0x2d')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x5bfd02[_0x3432('0x35')]));if(!this['isConfigured'](_0x5bfd02[_0x3432('0xf2')])){return this[_0x3432('0xc')]['noop'](_0x3432('0xf3'));}if(!this['isConfigured'](_0x5bfd02[_0x3432('0xf4')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xf5'));}if(!this['isConfigured'](_0x5bfd02[_0x3432('0xf6')])){return this[_0x3432('0xc')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x5bfd02[_0x3432('0xf7')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xab'));}this[_0x3432('0xc')]['bot']=!![];this[_0x3432('0x33')](_0x5bfd02);this[_0x3432('0x40')](_0x5bfd02['text'],'in');this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')]('Trying\x20SestekNDA:\x20%s',_0x5bfd02[_0x3432('0x67')]));var _0x1a2496=this[_0x3432('0x82')][_0x3432('0xc3')](this,_0x5bfd02);if(_0x1a2496){for(var _0x104c9a in _0x1a2496){if(_0x1a2496[_0x3432('0x99')](_0x104c9a)){this[_0x3432('0xc')]['setVariable'](util[_0x3432('0x27')](_0x3432('0xf8'),_0x104c9a['toUpperCase']()),_0x1a2496[_0x104c9a]);}}this[_0x3432('0x40')](_0x1a2496[_0x3432('0xef')],_0x3432('0xf0'));if(_0x1a2496['audiofile']){this[_0x3432('0xc')][_0x3432('0xaa')](util['format'](_0x3432('0xf9'),_0x1a2496[_0x3432('0xfa')]));var _0x54fdee=this['channel'][_0x3432('0xfb')](_0x1a2496[_0x3432('0xfa')]);try{fs[_0x3432('0xfc')](_0x1a2496[_0x3432('0xfa')]+'.wav');}catch(_0x1baf9f){logger[_0x3432('0x30')](_0x1baf9f);}return _0x54fdee;}else{return this[_0x3432('0xc')]['noop'](util['format'](_0x3432('0xfd'),_0x1a2496[_0x3432('0xef')]));}}return this[_0x3432('0xc')][_0x3432('0x30')](_0x5bfd02,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x3432('0xfe')]=function(_0x35e26c){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0xff'),_0x35e26c[_0x3432('0x35')]));return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xfe'));};AGIVertices[_0x3432('0xf')][_0x3432('0x100')]=function(_0x19d854){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x101'),_0x19d854['label']));var _0x4a7414='';if(_0x19d854[_0x3432('0x102')]){if(!this[_0x3432('0xa6')](_0x19d854['trunk_id'])){return this[_0x3432('0xc')][_0x3432('0x30')](_0x19d854,_0x3432('0x103'));}else{var _0xc10a66=parseInt(_0x19d854[_0x3432('0x102')],0xa);if(isNaN(_0xc10a66)){_0x4a7414=_0x19d854[_0x3432('0x102')];}else{_0x4a7414=this[_0x3432('0x1b')][_0x3432('0xc3')](this,_0x19d854[_0x3432('0x102')]);if(!_0x4a7414){return this[_0x3432('0xc')][_0x3432('0x30')](_0x19d854,'no\x20trunk\x20found');}}}}else if(_0x19d854[_0x3432('0x104')]){_0x4a7414=_0x19d854[_0x3432('0x104')];}else{return this[_0x3432('0xc')][_0x3432('0x30')](_0x19d854,'no\x20trunk\x20selected');}var _0x5b61b6=this['channel'][_0x3432('0x63')](_0x3432('0xe6'),[util[_0x3432('0x27')](_0x3432('0x105'),_0x4a7414,_0x19d854[_0x3432('0x4a')]),_0x19d854[_0x3432('0xbd')],_0x19d854[_0x3432('0x106')],_0x19d854[_0x3432('0x6d')]]);if(_0x5b61b6[_0x3432('0xa3')]===-0x1){return _0x5b61b6;}return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0xe8'),_0x3432('0xe6')));};AGIVertices[_0x3432('0xf')]['finally']=function(_0x103951){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x103951['label']));return this['channel'][_0x3432('0xaa')]('finally');};AGIVertices[_0x3432('0xf')][_0x3432('0xb')]=function(_0xcc12d3){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x107'),_0xcc12d3[_0x3432('0x35')]));if(_0xcc12d3[_0x3432('0xa8')]===0x0){return this[_0x3432('0xa7')](_0xcc12d3);}_0xcc12d3[_0x3432('0xa8')]-=0x1;if(!this['isConfigured'](_0xcc12d3[_0x3432('0x108')])){return this['channel'][_0x3432('0x30')](_0xcc12d3,_0x3432('0x109'));}var _0x4cf9e1=this[_0x3432('0x1c')]['sync'](this,_0xcc12d3[_0x3432('0x108')]);if(!_0x4cf9e1){return this[_0x3432('0xc')][_0x3432('0x30')](_0xcc12d3,_0x3432('0x10a'));}if(!this[_0x3432('0xa6')](_0xcc12d3[_0x3432('0xdb')])){return this[_0x3432('0xc')][_0x3432('0x30')](_0x3432('0xdc'));}var _0x16c065=this[_0x3432('0xc')][_0x3432('0x10b')](_0x4cf9e1,_0xcc12d3[_0x3432('0x10c')],_0xcc12d3['maxdigit']);var _0x42599a=_0x16c065[_0x3432('0xa3')]?_0x16c065[_0x3432('0xa3')][_0x3432('0x4e')]():'';logger[_0x3432('0x2d')](_0x3432('0x10d'),JSON['stringify'](_0x16c065));if(_0x16c065['result']===-0x1){this[_0x3432('0x33')][_0x3432('0xc3')](this,_0xcc12d3,_0x42599a);return _0x16c065;}else if(_0x16c065[_0x3432('0xa5')]===_0x3432('0xbd')){_0x16c065[_0x3432('0xa3')]=_0x42599a[_0x3432('0x9b')]>=parseInt(_0xcc12d3[_0x3432('0x10e')])?'x':'i';}else{_0x16c065[_0x3432('0xa3')]=_0x42599a[_0x3432('0x9b')]>=parseInt(_0xcc12d3['mindigit'])&&_0x42599a[_0x3432('0x9b')]<=parseInt(_0xcc12d3[_0x3432('0x10f')])?'x':'i';}var _0x115979=this['getVariable']['sync'](this,_0xcc12d3['variable_id']);if(!_0x115979){return this['channel']['error'](_0xcc12d3,_0x3432('0x110'));}this[_0x3432('0xc')][_0x3432('0x9f')](_0x115979,_0x42599a);if(this[_0x3432('0xa6')](_0xcc12d3['hiddendigitsnum'])){var _0x379167=parseInt(_0xcc12d3[_0x3432('0x111')],0xa);var _0x45e9a4=rs[_0x3432('0x112')]({'charset':'*','length':_0x379167});var _0x1f2ff8=_0x42599a['length'];if(_0x1f2ff8>0x0){if(_0x1f2ff8>_0x379167){this[_0x3432('0x33')][_0x3432('0xc3')](this,_0xcc12d3,_0xcc12d3[_0x3432('0x113')]===_0x3432('0x114')?_0x45e9a4+_0x42599a['substr'](_0x379167):_0x42599a[_0x3432('0x115')](0x0,_0x1f2ff8-_0x379167)+_0x45e9a4);}else{this['createSquareDetailsReport']['sync'](this,_0xcc12d3,rs['generate']({'charset':'*','length':_0x1f2ff8}));}}else{this[_0x3432('0x33')]['sync'](this,_0xcc12d3,'');}}else{this[_0x3432('0x33')][_0x3432('0xc3')](this,_0xcc12d3,_0x42599a);}return _0x16c065;};AGIVertices[_0x3432('0xf')][_0x3432('0x116')]=function(_0x39a146){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x39a146[_0x3432('0x35')]));return this['getdigits'](_0x39a146);};AGIVertices[_0x3432('0xf')][_0x3432('0x117')]=function(_0x580852){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x118'),_0x580852[_0x3432('0x35')]));this[_0x3432('0x33')][_0x3432('0xc3')](this,_0x580852,_0x580852[_0x3432('0x119')]);return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x11a'),_0x580852[_0x3432('0x119')]));};AGIVertices[_0x3432('0xf')][_0x3432('0x11b')]=function(_0x5425a9){logger[_0x3432('0x2d')](util['format'](_0x3432('0x11c'),_0x5425a9['label']));if(!this[_0x3432('0xa6')](_0x5425a9[_0x3432('0x11d')])||!this[_0x3432('0xa6')](_0x5425a9[_0x3432('0x8d')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0x11e'));}if(!this[_0x3432('0xa6')](_0x5425a9['text'])){return this[_0x3432('0xc')]['noop']('no\x20text\x20configured');}this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x11f'),_0x5425a9[_0x3432('0x67')]));var _0x1300e4=this[_0x3432('0x88')][_0x3432('0xc3')](this,_0x5425a9);if(_0x1300e4){this[_0x3432('0xc')]['noop'](util['format'](_0x3432('0x120'),_0x1300e4));var _0x9cb19b=this['channel']['streamFile'](_0x1300e4);try{fs[_0x3432('0xfc')](_0x1300e4+_0x3432('0x121'));}catch(_0x477014){logger['error'](_0x477014);}return _0x9cb19b;}return this[_0x3432('0xc')]['error'](_0x5425a9,_0x3432('0x122'));};AGIVertices[_0x3432('0xf')][_0x3432('0x123')]=function(_0x168f4b){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x124'),_0x168f4b[_0x3432('0x35')]));if(!this['isConfigured'](_0x168f4b[_0x3432('0x11d')])||!this[_0x3432('0xa6')](_0x168f4b[_0x3432('0x8d')])){return this['channel']['noop'](_0x3432('0x11e'));}if(!this['isConfigured'](_0x168f4b['aws_bot_name'])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0x125'));}if(!this[_0x3432('0xa6')](_0x168f4b[_0x3432('0x67')])){return this[_0x3432('0xc')]['noop'](_0x3432('0xab'));}this[_0x3432('0xc')][_0x3432('0xeb')]=!![];this[_0x3432('0x33')](_0x168f4b);this[_0x3432('0x40')](_0x168f4b[_0x3432('0x67')],'in');this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x126'),_0x168f4b['text']));var _0x1cb1ac=this[_0x3432('0x8c')][_0x3432('0xc3')](this,_0x168f4b);if(_0x1cb1ac){for(var _0x2c9979 in _0x1cb1ac){if(_0x1cb1ac[_0x3432('0x99')](_0x2c9979)&&_[_0x3432('0x95')](_0x1cb1ac[_0x2c9979])){this['channel'][_0x3432('0x9f')](util[_0x3432('0x27')]('AWS_LEX_%s',_0x2c9979[_0x3432('0xee')]()),_0x1cb1ac[_0x2c9979]);}}if(_[_0x3432('0x45')](_0x1cb1ac[_0x3432('0x7d')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0x127'));}else{this['createSquareMessage'](_0x1cb1ac[_0x3432('0x7d')],_0x3432('0xf0'));return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x128'),_0x1cb1ac['message']));}}return this[_0x3432('0xc')][_0x3432('0x30')](_0x168f4b,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype']['googleasr']=function(_0x40d984){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x129'),_0x40d984[_0x3432('0x35')],_0x40d984[_0x3432('0xbd')]));if(!this[_0x3432('0xa6')](_0x40d984[_0x3432('0x80')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xea'));}var _0x4b278a=_0x3432('0x12a');var _0x110294=util[_0x3432('0x27')](_0x3432('0x12b'),FILES_PATH,rs[_0x3432('0x112')](0x4));var _0xd0769d=util['format'](_0x3432('0x9d'),_0x110294,_0x4b278a);var _0x1d2ee4=!![];if(_0x40d984['beep']==='NOBEEP'){_0x1d2ee4=![];}var _0x2278cf=this[_0x3432('0xc')][_0x3432('0x12c')](_0x110294,_0x4b278a,_0x40d984['intKey'],_0x40d984[_0x3432('0xbd')],undefined,_0x1d2ee4);if(_0x2278cf['result']!==-0x1){this[_0x3432('0xc')]['noop'](util[_0x3432('0x27')]('google\x20%s\x20file\x20created',_0xd0769d));var _0x33bf39=this['googleASR'][_0x3432('0xc3')](this,_0x40d984,_0xd0769d);if(_0x33bf39){for(var _0x40c18e in _0x33bf39){if(_0x33bf39['hasOwnProperty'](_0x40c18e)){this[_0x3432('0xc')][_0x3432('0x9f')](util[_0x3432('0x27')](_0x3432('0x12d'),_0x40c18e[_0x3432('0xee')]()),_0x33bf39[_0x40c18e]);}}return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x12e'),JSON['stringify'](_0x33bf39)));}}return _0x2278cf;};AGIVertices[_0x3432('0xf')][_0x3432('0x12f')]=function(_0xfb6048){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x130'),_0xfb6048[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0xfb6048[_0x3432('0x131')])){return this[_0x3432('0xc')]['noop'](_0x3432('0x132'));}if(!this[_0x3432('0xa6')](_0xfb6048[_0x3432('0x92')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0x133'));}var _0x44f82b=_0x3432('0x12a');var _0x36e268=util[_0x3432('0x27')](_0x3432('0x12b'),FILES_PATH,rs[_0x3432('0x112')](0x4));var _0x15765f=util['format'](_0x3432('0x9d'),_0x36e268,_0x44f82b);var _0x224765=!![];if(_0xfb6048[_0x3432('0x134')]===_0x3432('0x135')){_0x224765=![];}var _0x45ea18=this[_0x3432('0xc')][_0x3432('0x12c')](_0x36e268,_0x44f82b,_0xfb6048[_0x3432('0x136')],_0xfb6048[_0x3432('0xbd')],undefined,_0x224765);if(_0x45ea18['result']!==-0x1){this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x137'),_0x15765f));var _0x536dbd=this['tildeASR'][_0x3432('0xc3')](this,_0xfb6048,_0x15765f);if(_0x536dbd){for(var _0x11e096 in _0x536dbd){if(_0x536dbd['hasOwnProperty'](_0x11e096)){this[_0x3432('0xc')][_0x3432('0x9f')](util[_0x3432('0x27')]('TILDE_ASR_%s',_0x11e096[_0x3432('0xee')]()),_0x536dbd[_0x11e096]);}}return this[_0x3432('0xc')]['noop'](util[_0x3432('0x27')](_0x3432('0x138'),JSON[_0x3432('0x78')](_0x536dbd)));}}return _0x45ea18;};AGIVertices[_0x3432('0xf')]['gotoc']=function(_0x32def9){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x139'),_0x32def9[_0x3432('0x35')]));return this[_0x3432('0xc')]['continueAt'](_0x32def9[_0x3432('0x3b')],_0x32def9['extension'],_0x32def9[_0x3432('0x3c')]);};AGIVertices['prototype'][_0x3432('0x13a')]=function(_0xe488c4){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x13b'),_0xe488c4[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0xe488c4['condition'])){return this[_0x3432('0xc')][_0x3432('0x30')](_0xe488c4,_0x3432('0x13c'));}try{var _0x3c4369=eval(_0xe488c4[_0x3432('0x13d')])?_0x3432('0x13e'):_0x3432('0x13f');this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x140'),_0xe488c4[_0x3432('0x13d')],_0x3c4369));return{'code':0xc8,'result':_0x3c4369};}catch(_0x15a556){return{'code':0xc8,'result':_0x3432('0x13f')};}};AGIVertices['prototype'][_0x3432('0x141')]=function(_0x428216){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x428216[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x428216['interval_id'])){return this[_0x3432('0xc')]['error'](_0x428216,'no\x20interval\x20configured');}var _0x497d24=this[_0x3432('0x142')][_0x3432('0xc3')](this,_0x428216[_0x3432('0x143')]);if(!_0x497d24){return this[_0x3432('0xc')][_0x3432('0x30')](_0x428216,_0x3432('0x144'));}for(var _0x32b164=0x0;_0x32b164<_0x497d24[_0x3432('0x9b')];_0x32b164+=0x1){var _0xff061e=this[_0x3432('0xc')][_0x3432('0x10')](util[_0x3432('0x27')](_0x3432('0x145'),_0x497d24[_0x32b164]));if(_0xff061e[_0x3432('0xa3')]===-0x1){return _0xff061e;}logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x146'),_0x497d24[_0x32b164],_0xff061e[_0x3432('0xa5')]));if(_0xff061e[_0x3432('0xa5')]===_0x3432('0x13e')){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x146'),_0x497d24[_0x32b164],_0x3432('0x13e')));this['channel']['noop'](util['format'](_0x3432('0x146'),_0x497d24[_0x32b164],_0x3432('0x13e')));return{'code':0xc8,'result':_0x3432('0x13e')};}else{logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x146'),_0x497d24[_0x32b164],'false'));this[_0x3432('0xc')][_0x3432('0xaa')](util['format'](_0x3432('0x146'),_0x497d24[_0x32b164],_0x3432('0x13f')));}}return{'code':0xc8,'result':_0x3432('0x13f')};};AGIVertices[_0x3432('0xf')]['hangup']=function(_0x1a0476){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x147'),_0x1a0476['label']));return this['channel'][_0x3432('0x148')]();};AGIVertices['prototype'][_0x3432('0x149')]=function(_0x5c97f8){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x14a'),_0x5c97f8[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x5c97f8[_0x3432('0x80')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xea'));}var _0x4daefb='wav';var _0x4009a4=util[_0x3432('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x3432('0x112')](0x4));var _0x1175b9=util[_0x3432('0x27')](_0x3432('0x9d'),_0x4009a4,_0x4daefb);var _0x52f405=!![];if(_0x5c97f8['beep']===_0x3432('0x135')){_0x52f405=![];}var _0x4c242d=this[_0x3432('0xc')]['recordFile'](_0x4009a4,_0x4daefb,_0x5c97f8[_0x3432('0x136')],_0x5c97f8[_0x3432('0xbd')],undefined,_0x52f405);if(_0x4c242d[_0x3432('0xa3')]!==-0x1){this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x14b'),_0x1175b9));var _0x4c681d=this[_0x3432('0x85')]['sync'](this,_0x5c97f8,_0x1175b9);if(_0x4c681d){for(var _0x3bb2a3 in _0x4c681d){if(_0x4c681d['hasOwnProperty'](_0x3bb2a3)){this['channel'][_0x3432('0x9f')](util['format']('ISPEECH_ASR_%s',_0x3bb2a3['toUpperCase']()),_0x4c681d[_0x3bb2a3]);}}return this[_0x3432('0xc')][_0x3432('0xaa')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x3432('0x78')](_0x4c681d)));}}return _0x4c242d;};AGIVertices[_0x3432('0xf')][_0x3432('0x14c')]=function(_0xa9b106){logger['info'](util[_0x3432('0x27')](_0x3432('0x14d'),_0xa9b106[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0xa9b106[_0x3432('0x80')])){return this[_0x3432('0xc')]['noop']('no\x20key\x20configured');}if(!this[_0x3432('0xa6')](_0xa9b106[_0x3432('0x67')])){return this[_0x3432('0xc')]['noop'](_0x3432('0xab'));}this[_0x3432('0xc')]['noop'](util[_0x3432('0x27')](_0x3432('0x14e'),_0xa9b106[_0x3432('0x67')]));var _0x558ed0=this[_0x3432('0x83')][_0x3432('0xc3')](this,_0xa9b106);if(_0x558ed0){this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x14b'),_0x558ed0));var _0x160404=this[_0x3432('0xc')][_0x3432('0xfb')](_0x558ed0,_0xa9b106[_0x3432('0x136')]);try{fs['unlink'](_0x558ed0+'.wav');}catch(_0x285710){logger[_0x3432('0x30')](_0x285710);}return _0x160404;}return this[_0x3432('0xc')]['error'](_0xa9b106,_0x3432('0x14f'));};AGIVertices[_0x3432('0xf')][_0x3432('0x150')]=function(_0x428ca8){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x151'),_0x428ca8[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x428ca8['findBy'])){return this['channel'][_0x3432('0x30')](_0x428ca8,_0x3432('0x152'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3432('0xc')][_0x3432('0x38')],_0x428ca8['findBy']));var _0x47f20c=this[_0x3432('0x5e')][_0x3432('0xc3')](this,_0x428ca8[_0x3432('0x153')]);if(_0x47f20c){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x154'),this['channel'][_0x3432('0x38')],_0x428ca8[_0x3432('0x153')]));this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3432('0xc')]['callerid'],_0x428ca8[_0x3432('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x155'),this[_0x3432('0xc')][_0x3432('0x38')],_0x428ca8[_0x3432('0x153')]));this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x155'),this[_0x3432('0xc')][_0x3432('0x38')],_0x428ca8[_0x3432('0x153')]));return{'code':0xc8,'result':_0x3432('0x156')};}};AGIVertices[_0x3432('0xf')][_0x3432('0x157')]=function(_0x36a050){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x158'),_0x36a050[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x36a050['findBy'])){return this[_0x3432('0xc')][_0x3432('0x30')](_0x36a050,_0x3432('0x152'));}logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x159'),this[_0x3432('0xc')][_0x3432('0x38')],_0x36a050['findBy']));var _0x28ec5a=this[_0x3432('0x5d')]['sync'](this,_0x36a050['findBy']);if(_0x28ec5a){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x154'),this[_0x3432('0xc')][_0x3432('0x38')],_0x36a050[_0x3432('0x153')]));this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x154'),this[_0x3432('0xc')][_0x3432('0x38')],_0x36a050[_0x3432('0x153')]));return{'code':0xc8,'result':_0x3432('0x15a')};}else{logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x155'),this['channel'][_0x3432('0x38')],_0x36a050[_0x3432('0x153')]));this[_0x3432('0xc')][_0x3432('0xaa')](util['format'](_0x3432('0x155'),this['channel'][_0x3432('0x38')],_0x36a050['findBy']));return{'code':0xc8,'result':_0x3432('0x156')};}};AGIVertices[_0x3432('0xf')]['math']=function(_0x156203){logger[_0x3432('0x2d')](util['format'](_0x3432('0x15b'),_0x156203[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x156203['operation'])){return this[_0x3432('0xc')]['error'](_0x156203,_0x3432('0x15c'));}this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x15d'),_0x156203[_0x3432('0x15e')]));var _0x59c893=eval(_0x156203[_0x3432('0x15e')]);if(!this[_0x3432('0xa6')](_0x156203[_0x3432('0xdb')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xdc'));}var _0x1d6cae=this[_0x3432('0x10')]['sync'](this,_0x156203[_0x3432('0xdb')]);if(!_0x1d6cae){return this[_0x3432('0xc')][_0x3432('0x30')](_0x156203,_0x3432('0x110'));}if(_[_0x3432('0x9e')](_0x59c893)){var _0x139847=this;_0x59c893[_0x3432('0xdd')](function(_0x45e118,_0x5c8ec2){_0x139847[_0x3432('0xc')]['setVariable'](util[_0x3432('0x27')](_0x3432('0x15f'),_0x1d6cae,_0x5c8ec2),_0x45e118);});return this['channel']['noop'](util['format'](_0x3432('0x160'),_0x1d6cae));}else{return this[_0x3432('0xc')][_0x3432('0x9f')](_0x1d6cae,_0x59c893);}};AGIVertices['prototype'][_0x3432('0x161')]=function(_0xfb7b2a){logger['info'](util[_0x3432('0x27')](_0x3432('0x162'),_0xfb7b2a[_0x3432('0x35')]));if(_0xfb7b2a[_0x3432('0xa8')]===0x0){return this['maxRetry'](_0xfb7b2a);}_0xfb7b2a[_0x3432('0xa8')]-=0x1;if(!this[_0x3432('0xa6')](_0xfb7b2a['file_id'])){return this[_0x3432('0xc')][_0x3432('0x30')](_0xfb7b2a,_0x3432('0x109'));}var _0x1723ec=this[_0x3432('0x1c')]['sync'](this,_0xfb7b2a[_0x3432('0x108')]);if(!_0x1723ec){return this['channel'][_0x3432('0x30')](_0xfb7b2a,_0x3432('0x10a'));}var _0xb943b3=this[_0x3432('0xc')][_0x3432('0x10b')](_0x1723ec,_0xfb7b2a[_0x3432('0x10c')],_0xfb7b2a['digit']);var _0x1a5923=_0xb943b3[_0x3432('0xa3')];if(_0xb943b3[_0x3432('0xa3')]===-0x1){this[_0x3432('0x33')][_0x3432('0xc3')](this,_0xfb7b2a,'-1');return _0xb943b3;}else if(_0xb943b3['extra']===_0x3432('0xbd')){_0xb943b3[_0x3432('0xa3')]=_0xb943b3[_0x3432('0xa3')][_0x3432('0x9b')]>0x0?_0xb943b3[_0x3432('0xa3')]:'t';}else if(_[_0x3432('0x48')](_0xb943b3[_0x3432('0xa3')])){_0xb943b3['result']='#';_0x1a5923='#';}if(!this[_0x3432('0xa6')](_0xfb7b2a[_0x3432('0xdb')])){this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0xdc'));}else{var _0x1f9cff=this[_0x3432('0x10')]['sync'](this,_0xfb7b2a['variable_id']);if(!_0x1f9cff){return this[_0x3432('0xc')]['error'](_0xfb7b2a,_0x3432('0x110'));}this['channel']['setVariable'](_0x1f9cff,_0x1a5923);}this['createSquareDetailsReport']['sync'](this,_0xfb7b2a,_0x1a5923);return _0xb943b3;};AGIVertices['prototype'][_0x3432('0xaa')]=function(_0x135768){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x163'),_0x135768[_0x3432('0x35')]));return this['channel'][_0x3432('0xaa')](_0x135768[_0x3432('0x164')]||_0x135768[_0x3432('0x35')]);};AGIVertices[_0x3432('0xf')]['pause']=function(_0x35438b){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x165'),_0x35438b[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x35438b[_0x3432('0x153')])){return this['channel'][_0x3432('0x30')](_0x35438b,_0x3432('0x152'));}logger[_0x3432('0x2d')](util[_0x3432('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3432('0xc')][_0x3432('0x38')],_0x35438b[_0x3432('0x153')]));var _0x58e5b6=this[_0x3432('0x5a')][_0x3432('0xc3')](this,_0x35438b['pause_id']);var _0x1ff41a=this[_0x3432('0x166')]['sync'](this,_0x35438b[_0x3432('0x153')],_0x58e5b6);if(_0x1ff41a){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x154'),this['channel'][_0x3432('0x38')],_0x35438b[_0x3432('0x153')]));this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x154'),this[_0x3432('0xc')]['callerid'],_0x35438b[_0x3432('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x155'),this['channel']['callerid'],_0x35438b[_0x3432('0x153')]));this[_0x3432('0xc')][_0x3432('0xaa')](util['format'](_0x3432('0x154'),this['channel'][_0x3432('0x38')],_0x35438b[_0x3432('0x153')]));return{'code':0xc8,'result':_0x3432('0x156')};}};AGIVertices['prototype'][_0x3432('0x167')]=function(_0x940549){logger['info'](util[_0x3432('0x27')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x940549[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x940549[_0x3432('0x108')])){return this[_0x3432('0xc')][_0x3432('0x30')](_0x940549,_0x3432('0x109'));}var _0x4d6916=this[_0x3432('0x1c')]['sync'](this,_0x940549['file_id']);if(!_0x4d6916){return this[_0x3432('0xc')][_0x3432('0x30')](_0x940549,_0x3432('0x10a'));}var _0x3f2d96=this['channel'][_0x3432('0x63')](_0x3432('0x168'),[_0x4d6916,_0x940549[_0x3432('0x106')]]);if(_0x3f2d96['result']===-0x1){return _0x3f2d96;}return this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x169'),_0x3432('0x168'),_0x4d6916));};AGIVertices['prototype'][_0x3432('0x16a')]=function(_0x5d812e){logger['info'](util['format'](_0x3432('0x16b'),_0x5d812e[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x5d812e[_0x3432('0x16c')])){return this['channel']['error'](_0x5d812e,'no\x20queue\x20selected');}var _0x4ad9f4='';var _0x1e736b=parseInt(_0x5d812e[_0x3432('0x16c')],0xa);if(isNaN(_0x1e736b)){_0x4ad9f4=_0x5d812e['queue_id'];}else{_0x4ad9f4=this[_0x3432('0x15')][_0x3432('0xc3')](this,_0x5d812e['queue_id']);if(!_0x4ad9f4){return this[_0x3432('0xc')]['error'](_0x5d812e,_0x3432('0x16d'));}}var _0x50899a='';if(this['isConfigured'](_0x5d812e[_0x3432('0x108')])){var _0x44c53f=this[_0x3432('0x1c')][_0x3432('0xc3')](this,_0x5d812e['file_id']);if(_0x44c53f){_0x50899a=_0x44c53f;}}this[_0x3432('0x33')][_0x3432('0xc3')](this,_0x5d812e,_0x4ad9f4);if(_0x5d812e['opts'][_0x3432('0x16e')]('x')<0x0){_0x5d812e[_0x3432('0x106')]+='x';}if(_0x5d812e[_0x3432('0x106')][_0x3432('0x16e')]('X')<0x0){_0x5d812e[_0x3432('0x106')]+='X';}this[_0x3432('0xc')][_0x3432('0x9f')]('XMCS-QUEUE',_0x4ad9f4?_0x4ad9f4[_0x3432('0x16f')]():'');var _0xc3cfed=this['channel'][_0x3432('0x63')](_0x3432('0x170'),[_0x4ad9f4,_0x5d812e['opts'],_0x5d812e['url'],_0x50899a,_0x5d812e[_0x3432('0xbd')],_0x5d812e[_0x3432('0xb9')],_0x5d812e['macro'],_0x5d812e['gosub'],'',_0x5d812e[_0x3432('0x171')]]);if(_0xc3cfed[_0x3432('0xa3')]===-0x1){return _0xc3cfed;}return this[_0x3432('0xc')]['noop'](util[_0x3432('0x27')](_0x3432('0x169'),_0x3432('0x170'),_0x4ad9f4));};AGIVertices[_0x3432('0xf')][_0x3432('0x172')]=function(_0x348a66){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x348a66['label']));var _0x4f519f=_0x348a66[_0x3432('0x173')]||_0x3432('0x12a');var _0x58ebd5=util[_0x3432('0x27')](_0x3432('0x174'),this['channel'][_0x3432('0x34')],rs[_0x3432('0x112')](0x5));var _0x1d4fc4=util[_0x3432('0x27')](_0x3432('0x175'),FILES_PATH,_0x58ebd5,_0x4f519f);var _0x349b8a=util['format']('%s/recordings/%s',FILES_PATH,_0x58ebd5);this['createSquareRecording']['sync'](this,_0x348a66,_0x58ebd5,_0x1d4fc4);this['channel'][_0x3432('0x9f')](_0x3432('0x176'),_0x58ebd5);logger[_0x3432('0x2d')](_0x3432('0x177'),_0x349b8a,_0x4f519f,_0x348a66[_0x3432('0x178')],_0x348a66[_0x3432('0xbd')]);return this[_0x3432('0xc')][_0x3432('0x12c')](_0x349b8a,_0x4f519f,_0x348a66[_0x3432('0x178')],_0x348a66['timeout'],undefined,!![]);};AGIVertices[_0x3432('0xf')][_0x3432('0x179')]=function(_0x56d76b){logger['info'](util[_0x3432('0x27')](_0x3432('0x17a'),_0x56d76b[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x56d76b[_0x3432('0x6d')])){return this['channel']['noop'](_0x3432('0x17b'));}var _0x25c643=this[_0x3432('0x6c')][_0x3432('0xc3')](this,_0x56d76b);logger['info'](util[_0x3432('0x27')](_0x3432('0x17c'),util[_0x3432('0x17d')](_0x25c643,{'showHidden':![],'depth':null})));if(!this[_0x3432('0xa6')](_0x56d76b[_0x3432('0xdb')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0x17e'));}var _0x1d1b3e=this[_0x3432('0x10')][_0x3432('0xc3')](this,_0x56d76b[_0x3432('0xdb')]);if(!_0x1d1b3e){return this[_0x3432('0xc')][_0x3432('0x30')](_0x56d76b,'no\x20variable\x20found');}this[_0x3432('0xc')]['setVariable'](util[_0x3432('0x27')](_0x3432('0x17f'),_0x1d1b3e),_0x25c643[_0x3432('0x7b')]?_0x25c643[_0x3432('0x7b')]:_0x3432('0x180'));this[_0x3432('0xc')][_0x3432('0x9f')](util['format'](_0x3432('0x181'),_0x1d1b3e),_0x25c643[_0x3432('0x7c')]?_0x25c643[_0x3432('0x7c')]:'OK');if(_0x25c643['body']){try{this[_0x3432('0x9c')](_0x25c643[_0x3432('0x79')],_0x1d1b3e);}catch(_0x5d470d){logger[_0x3432('0x30')](util[_0x3432('0x27')](_0x3432('0x182'),_0x1d1b3e));}}return this['channel'][_0x3432('0xaa')](util['format']('variable\x20%s\x20set',_0x1d1b3e));};AGIVertices[_0x3432('0xf')][_0x3432('0x183')]=function(_0x5cb5bb){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5cb5bb[_0x3432('0x35')]));return this['channel'][_0x3432('0x184')](_0x5cb5bb[_0x3432('0x185')][_0x3432('0x64')](/\s+/g,''),_0x5cb5bb['escape_digits']);};AGIVertices[_0x3432('0xf')][_0x3432('0x186')]=function(_0x465451){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x465451[_0x3432('0x35')]));return this[_0x3432('0xc')][_0x3432('0x187')](_0x465451[_0x3432('0x6e')][_0x3432('0x64')](/\s+/g,''),_0x465451['escape_digits']);};AGIVertices[_0x3432('0xf')]['sayphonetic']=function(_0x469922){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x188'),_0x469922[_0x3432('0x35')]));return this[_0x3432('0xc')][_0x3432('0x189')](_0x469922['text'],_0x469922[_0x3432('0x178')]);};AGIVertices[_0x3432('0xf')][_0x3432('0x18a')]=function(_0x58c4c3){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x18b'),_0x58c4c3[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x58c4c3[_0x3432('0x18c')])){return this[_0x3432('0xc')]['noop'](_0x3432('0x18d'));}var _0xe027a7=this[_0x3432('0x20')]['sync'](this,_0x58c4c3[_0x3432('0x18c')]);if(!_0xe027a7||!_0xe027a7[_0x3432('0x18e')]){return this[_0x3432('0xc')][_0x3432('0x30')](_0x58c4c3,'no\x20mail\x20account\x20found');}var _0x23ee95={'from':util['format'](_0x3432('0x18f'),_0xe027a7['name'],_0xe027a7[_0x3432('0x190')]||_0xe027a7[_0x3432('0x18e')][_0x3432('0x191')]),'to':_0x58c4c3['to']||'','cc':_0x58c4c3['cc']||'','bcc':_0x58c4c3[_0x3432('0x192')]||'','subject':_0x58c4c3[_0x3432('0x193')],'html':_0x58c4c3[_0x3432('0x67')],'text':_0x58c4c3[_0x3432('0x67')]};var _0x7300ef={'tls':{'rejectUnauthorized':![]}};if(_0xe027a7[_0x3432('0x18e')][_0x3432('0x194')]){_0x7300ef['service']=_0xe027a7[_0x3432('0x18e')][_0x3432('0x194')];}else{_0x7300ef[_0x3432('0x195')]=_0xe027a7['Smtp'][_0x3432('0x195')];_0x7300ef[_0x3432('0x196')]=_0xe027a7['Smtp'][_0x3432('0x196')];_0x7300ef[_0x3432('0x197')]=_0xe027a7[_0x3432('0x18e')]['secure'];}if(_0xe027a7['Smtp']['authentication']){_0x7300ef[_0x3432('0x198')]={'user':_0xe027a7['Smtp'][_0x3432('0x191')],'pass':_0xe027a7[_0x3432('0x18e')]['pass']};}if(this[_0x3432('0xa6')](_0x58c4c3['template_id'])){}logger['debug'](_0x3432('0x199'),JSON[_0x3432('0x78')](_0x23ee95));this[_0x3432('0x33')][_0x3432('0xc3')](this,_0x58c4c3,_0x58c4c3[_0x3432('0x18c')]);this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x19a'),_0xe027a7['name']));this[_0x3432('0x22')][_0x3432('0xc3')](this,_0x7300ef,_0x23ee95);return this[_0x3432('0xc')][_0x3432('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x3432('0xf')][_0x3432('0x19b')]=function(_0x2d1dda){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2d1dda[_0x3432('0x35')]));return this[_0x3432('0xc')]['noop'](_0x3432('0x19c'));};AGIVertices[_0x3432('0xf')][_0x3432('0x19d')]=function(_0x15d349){logger[_0x3432('0x2d')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x15d349[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x15d349['sms_account_id'])){return this[_0x3432('0xc')]['noop']('no\x20sms\x20account\x20configured');}var _0x46dc8d=this[_0x3432('0x19e')][_0x3432('0xc3')](this,_0x15d349[_0x3432('0x19f')]);if(!_0x46dc8d){return this[_0x3432('0xc')][_0x3432('0x30')](_0x15d349,_0x3432('0x1a0'));}var _0x539c59={'body':_0x15d349[_0x3432('0x1a1')],'phone':_0x15d349['to']||'','SmsAccountId':_0x46dc8d['id']};logger['debug'](_0x3432('0x1a2'),JSON[_0x3432('0x78')](_0x539c59));this['createSquareDetailsReport'][_0x3432('0xc3')](this,_0x15d349,_0x15d349[_0x3432('0x19f')]);this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x1a3'),_0x46dc8d[_0x3432('0x13')]));this[_0x3432('0x32')][_0x3432('0xc3')](this,_0x539c59);return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0x1a4'));};AGIVertices[_0x3432('0xf')]['set']=function(_0x4ef081){logger['info'](util[_0x3432('0x27')](_0x3432('0x1a5'),_0x4ef081[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x4ef081['variable_id'])){return this[_0x3432('0xc')][_0x3432('0x30')](_0x4ef081,'no\x20variable\x20selected');}var _0x5d17e2=this['getVariable'][_0x3432('0xc3')](this,_0x4ef081[_0x3432('0xdb')]);if(!_0x5d17e2){return this[_0x3432('0xc')]['error'](_0x4ef081,_0x3432('0x110'));}return this[_0x3432('0xc')][_0x3432('0x9f')](_0x5d17e2,_0x4ef081[_0x3432('0x1a6')]);};AGIVertices[_0x3432('0xf')]['start']=function(_0x8ea25f){logger[_0x3432('0x2d')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x8ea25f[_0x3432('0x35')]));this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0x1a7'));if(_0x8ea25f[_0x3432('0xbf')]===_0x3432('0x1a8')){this['channel'][_0x3432('0xaa')](_0x3432('0x1a9'));return this[_0x3432('0xc')]['answer']();}return this['channel'][_0x3432('0xaa')](_0x3432('0x1aa'));};AGIVertices[_0x3432('0xf')]['subproject']=function(_0x345a79){logger['info'](util['format'](_0x3432('0x1ab'),_0x345a79[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x345a79['project_id'])){return this[_0x3432('0xc')][_0x3432('0x30')](_0x345a79,_0x3432('0x1ac'));}var _0x2b75d6=this[_0x3432('0x17')]['sync'](this,_0x345a79[_0x3432('0x1ad')]);if(!this[_0x3432('0xa6')](_0x2b75d6)){return this[_0x3432('0xc')][_0x3432('0x30')](_0x345a79,util[_0x3432('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x345a79[_0x3432('0x1ad')]));}if(_0x2b75d6===this[_0x3432('0xc')][_0x3432('0x37')]){return this[_0x3432('0xc')][_0x3432('0x30')](_0x345a79,_0x3432('0x1ae'));}this[_0x3432('0x33')][_0x3432('0xc3')](this,_0x345a79,_0x2b75d6);var _0x17d11a=this[_0x3432('0xc')][_0x3432('0x63')](_0x3432('0x1af'),util[_0x3432('0x27')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x3432('0xb9')][_0x3432('0x195')]||_0x3432('0x1b0'),_0x2b75d6,this[_0x3432('0xc')][_0x3432('0x37')]));if(_0x17d11a[_0x3432('0xa3')]===-0x1){return _0x17d11a;}return this['channel'][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x169'),_0x3432('0x1af'),_0x2b75d6));};AGIVertices[_0x3432('0xf')][_0x3432('0x1b1')]=function(_0x7bb97c){logger['info'](util[_0x3432('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x7bb97c['label']));var _0x4db737=this[_0x3432('0x62')]['sync'](this,_0x7bb97c[_0x3432('0xbb')]);this[_0x3432('0x33')]['sync'](this,_0x7bb97c,_0x7bb97c[_0x3432('0xbb')]);if(this[_0x3432('0xa6')](_0x7bb97c[_0x3432('0xdb')])){var _0x3d4e83=this['getVariable'][_0x3432('0xc3')](this,_0x7bb97c[_0x3432('0xdb')]);if(_0x3d4e83){this['channel'][_0x3432('0x9f')](_0x3d4e83,_0x4db737);return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x1b2'),_0x7bb97c[_0x3432('0xbb')],_0x3d4e83));}}return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x1b3'),_0x7bb97c[_0x3432('0xbb')]));};AGIVertices[_0x3432('0xf')][_0x3432('0x1b4')]=function(_0x4905af){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x4905af[_0x3432('0x35')]));_0x4905af['text']=_0x4905af[_0x3432('0x67')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3432('0xa6')](_0x4905af[_0x3432('0x1b5')])){return this[_0x3432('0xc')][_0x3432('0xaa')](_0x3432('0x1b6'));}if(!this['isConfigured'](_0x4905af[_0x3432('0x67')])){return this[_0x3432('0xc')][_0x3432('0xaa')]('no\x20text\x20configured');}this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x1b7'),_0x4905af['text']));var _0x5a4d7c=this[_0x3432('0x65')][_0x3432('0xc3')](this,_0x4905af);if(_0x5a4d7c){this[_0x3432('0xc')]['noop'](util[_0x3432('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5a4d7c));var _0x5d8050=this[_0x3432('0xc')]['streamFile'](_0x5a4d7c);try{fs['unlink'](_0x5a4d7c+'.wav');}catch(_0x467e6b){logger['error'](_0x467e6b);}return _0x5d8050;}return this['channel'][_0x3432('0x30')](_0x4905af,_0x3432('0x1b8'));};AGIVertices[_0x3432('0xf')][_0x3432('0x1b9')]=function(_0x2e518f){logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x1ba'),_0x2e518f[_0x3432('0x35')]));_0x2e518f[_0x3432('0x67')]=_0x2e518f[_0x3432('0x67')][_0x3432('0x64')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3432('0xa6')](_0x2e518f['text'])){return this['channel'][_0x3432('0xaa')]('no\x20text\x20configured');}this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x1bb'),_0x2e518f[_0x3432('0x67')]));var _0x1fd27c=this[_0x3432('0x6b')]['sync'](this,_0x2e518f);if(_0x1fd27c){this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')]('Google\x20TTS\x20%s\x20file\x20created',_0x1fd27c));var _0x5550b6=this[_0x3432('0xc')][_0x3432('0xfb')](_0x1fd27c);try{fs[_0x3432('0xfc')](_0x1fd27c+_0x3432('0x121'));}catch(_0x366a25){logger[_0x3432('0x30')](_0x366a25);}return _0x5550b6;}return this[_0x3432('0xc')][_0x3432('0x30')](_0x2e518f,_0x3432('0x1bc'));};AGIVertices[_0x3432('0xf')][_0x3432('0x1bd')]=function(_0x1ff84f){logger[_0x3432('0x2d')](util['format'](_0x3432('0x1be'),_0x1ff84f[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x1ff84f[_0x3432('0x153')])){return this[_0x3432('0xc')][_0x3432('0x30')](_0x1ff84f,_0x3432('0x152'));}logger['info'](util[_0x3432('0x27')](_0x3432('0x159'),this[_0x3432('0xc')][_0x3432('0x38')],_0x1ff84f[_0x3432('0x153')]));var _0x1e42c4=this[_0x3432('0x5c')][_0x3432('0xc3')](this,_0x1ff84f[_0x3432('0x153')]);if(_0x1e42c4){logger[_0x3432('0x2d')](util['format'](_0x3432('0x154'),this[_0x3432('0xc')][_0x3432('0x38')],_0x1ff84f[_0x3432('0x153')]));this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x154'),this[_0x3432('0xc')][_0x3432('0x38')],_0x1ff84f[_0x3432('0x153')]));return{'code':0xc8,'result':_0x3432('0x15a')};}else{logger[_0x3432('0x2d')](util[_0x3432('0x27')](_0x3432('0x155'),this['channel'][_0x3432('0x38')],_0x1ff84f[_0x3432('0x153')]));this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x155'),this[_0x3432('0xc')][_0x3432('0x38')],_0x1ff84f[_0x3432('0x153')]));return{'code':0xc8,'result':_0x3432('0x156')};}};AGIVertices['prototype'][_0x3432('0x1bf')]=function(_0x369794){logger[_0x3432('0x2d')](util['format'](_0x3432('0x1c0'),_0x369794[_0x3432('0x35')]));var _0x3bab4a=this[_0x3432('0xc')][_0x3432('0x63')](_0x3432('0x1c1'),[_0x369794[_0x3432('0x1c2')],_0x369794['options']]);if(_0x3bab4a['result']===-0x1){return _0x3bab4a;}return this[_0x3432('0xc')][_0x3432('0xaa')](util[_0x3432('0x27')](_0x3432('0x169'),_0x3432('0x1c1'),_0x369794[_0x3432('0x1c2')]));};AGIVertices['prototype'][_0x3432('0x1c3')]=function(_0x42b819){logger[_0x3432('0x2d')](util[_0x3432('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x42b819[_0x3432('0x35')]));if(!this[_0x3432('0xa6')](_0x42b819[_0x3432('0xdb')])){return this['channel'][_0x3432('0x30')](_0x42b819,_0x3432('0x1c4'));}var _0x4db456=this[_0x3432('0x10')][_0x3432('0xc3')](this,_0x42b819['variable_id']);if(!_0x4db456){return this[_0x3432('0xc')][_0x3432('0x30')](_0x42b819,_0x3432('0x110'));}var _0x3553a5=this[_0x3432('0xc')][_0x3432('0x10')](_0x4db456);return{'code':0xc8,'result':_0x3553a5['extra']?_0x3553a5[_0x3432('0xa5')]:'-'};};String['prototype'][_0x3432('0x1c5')]=function(_0x1b7320,_0x237953){return this[_0x3432('0xa0')](_0x1b7320)[_0x3432('0x1c6')](_0x237953);};module[_0x3432('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 20572a4..2fa1dd4 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 _0x33c5=['Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x33c5,0xe6));var _0x533c=function(_0x53d3b0,_0x62aa42){_0x53d3b0=_0x53d3b0-0x0;var _0x44f608=_0x33c5[_0x53d3b0];return _0x44f608;};'use strict';var util=require('util');var _=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var ami=require('../ami');var logger=require(_0x533c('0x2'))(_0x533c('0x3'));var RpcUser=require(_0x533c('0x4'));var RpcVoiceAgentReport=require(_0x533c('0x5'));function Acw(_0x358127){this['voiceQueues']=_0x358127[_0x533c('0x6')];this[_0x533c('0x7')]=_0x358127[_0x533c('0x7')];this[_0x533c('0x8')]=_0x358127[_0x533c('0x8')];this[_0x533c('0x9')]={};ami['on'](_0x533c('0xa'),this[_0x533c('0xb')][_0x533c('0xc')](this));ami['on'](_0x533c('0xd'),this[_0x533c('0xe')][_0x533c('0xc')](this));ami['on'](_0x533c('0xf'),this[_0x533c('0x10')][_0x533c('0xc')](this));ami['on'](_0x533c('0x11'),this['syncAgentRingNoAnswer'][_0x533c('0xc')](this));ami['on'](_0x533c('0x12'),this[_0x533c('0x13')][_0x533c('0xc')](this));ami['on'](_0x533c('0x14'),this[_0x533c('0x15')]['bind'](this));ami['on'](_0x533c('0x16'),this[_0x533c('0x17')][_0x533c('0xc')](this));}function getDiff(_0x12ecae){var _0x2d5bc8=moment()[_0x533c('0x18')](0x0);var _0x8d7c66=moment(_0x12ecae)[_0x533c('0x18')](0x0);return _0x2d5bc8['diff'](_0x8d7c66,_0x533c('0x19'));}Acw[_0x533c('0x1a')][_0x533c('0x1b')]=function(_0x3e544f){try{var _0x56dfb7=this;var _0x1031e7=this[_0x533c('0x9')][_0x3e544f][_0x533c('0x1c')];var _0x311700=this[_0x533c('0x9')][_0x3e544f][_0x533c('0x1d')];var _0x1f0a72=this[_0x533c('0x6')][_0x311700];var _0x1f9f85=![];var _0x12e126=_0x533c('0x1e');if(_0x1f0a72[_0x533c('0x1f')]){if(_0x1f0a72[_0x533c('0x20')][_0x533c('0x21')]){_0x1f9f85=!![];_0x12e126=_0x1f0a72[_0x533c('0x20')][_0x533c('0x21')];}}ami[_0x533c('0x22')]({'action':_0x533c('0x23'),'interface':_0x1031e7,'paused':!![],'reason':_0x12e126})['then'](function(_0xce8d9){if(_0x56dfb7['agents'][_0x1031e7]){return RpcUser['getAgent'](_0x56dfb7[_0x533c('0x7')][_0x1031e7]['id'])[_0x533c('0x24')](function(_0x5f5090){if(_0x5f5090&&!_0x5f5090[_0x533c('0x25')]){logger[_0x533c('0x26')](_0x533c('0x27'),_0x3e544f,_0x1031e7,_0x311700);var _0x3dd249=_0x56dfb7['channels'][_0x3e544f][_0x533c('0x28')]&&_0x56dfb7[_0x533c('0x9')][_0x3e544f][_0x533c('0x29')]?_0x56dfb7[_0x533c('0x9')][_0x3e544f][_0x533c('0x29')]:_0x3e544f;return RpcUser[_0x533c('0x2a')](_0x56dfb7[_0x533c('0x7')][_0x1031e7],_0x12e126,_0x3dd249)[_0x533c('0x24')](function(_0xb1c937){if(!_0x1f9f85){_0x56dfb7[_0x533c('0x8')][_0x1031e7]={};logger['info'](_0x533c('0x2b'),_0x3e544f,_0x56dfb7[_0x533c('0x6')][_0x311700]['acwTimeout'],_0x1031e7,_0x311700);_0x56dfb7[_0x533c('0x8')][_0x1031e7]['timer']=setTimeout(_0x56dfb7[_0x533c('0x2c')][_0x533c('0xc')](_0x56dfb7,_0x1031e7),_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x2d')]*0x3e8);_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2e')]=moment()[_0x533c('0x2f')](_0x533c('0x30'));_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x31')]=_0x3e544f;_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x1d')]=_0x311700;_0x56dfb7['timers'][_0x1031e7][_0x533c('0x32')]=function(){var _0x591499=getDiff(_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x2e')]);clearTimeout(_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x33')]);_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x33')]=![];RpcVoiceAgentReport[_0x533c('0x34')]({'acwtime':_0x591499},_0x56dfb7[_0x533c('0x8')][_0x1031e7][_0x533c('0x31')],_0x1031e7)[_0x533c('0x24')](function(_0x1bbcb7){logger[_0x533c('0x26')](_0x533c('0x35'),_0x3e544f,_0x591499,_0x1bbcb7);})[_0x533c('0x36')](function(_0x3803d0){logger['error'](_0x533c('0x37'),_0x3e544f,_0x3803d0);});delete _0x56dfb7[_0x533c('0x8')][_0x1031e7];};}});}else{logger[_0x533c('0x26')](_0x533c('0x38'),_0x3e544f,_0x1031e7,_0x311700);}});}})['catch'](function(_0x3f1db9){logger[_0x533c('0x39')](_0x533c('0x2b'),_0x3e544f,_0x56dfb7[_0x533c('0x6')][_0x311700][_0x533c('0x2d')],_0x1031e7,_0x311700);})['finally'](function(){delete _0x56dfb7['channels'][_0x3e544f];});}catch(_0x538bc0){logger['error']('[ACW][START]\x20%s',_0x538bc0[_0x533c('0x3a')]);}};Acw['prototype'][_0x533c('0x2c')]=function(_0x55726a){try{var _0x34243d=this;if(_0x34243d[_0x533c('0x8')][_0x55726a]){_0x34243d[_0x533c('0x8')][_0x55726a]['timer']=![];var _0x44a18d=_0x34243d[_0x533c('0x8')][_0x55726a][_0x533c('0x31')];var _0x55b010=_0x34243d[_0x533c('0x8')][_0x55726a][_0x533c('0x1d')];var _0x30e5eb=_0x34243d['voiceQueues'][_0x55b010][_0x533c('0x2d')];logger[_0x533c('0x26')](_0x533c('0x3b'),_0x55726a);RpcUser[_0x533c('0x3c')](this[_0x533c('0x7')][_0x55726a]);RpcVoiceAgentReport[_0x533c('0x34')]({'acwtime':_0x30e5eb,'agentacw':!![]},_0x44a18d,_0x55726a)[_0x533c('0x24')](function(_0x2dbd81){logger[_0x533c('0x26')](_0x533c('0x35'),_0x44a18d,_0x30e5eb,_0x2dbd81);})[_0x533c('0x36')](function(_0x55af6e){logger[_0x533c('0x39')](_0x533c('0x37'),_0x44a18d,_0x55af6e);});}else{logger[_0x533c('0x39')](_0x533c('0x3d'),_0x55726a);if(_0x34243d[_0x533c('0x8')]){logger[_0x533c('0x26')]('[ACW][TIMERS]',JSON[_0x533c('0x3e')](_0x34243d[_0x533c('0x8')]));}}}catch(_0x41f5a2){logger['error'](_0x533c('0x3f'),_0x41f5a2[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0xb')]=function(_0x502a67){try{if(this[_0x533c('0x6')][_0x502a67['queue']]&&(this[_0x533c('0x6')][_0x502a67[_0x533c('0x1d')]]['acw']||this[_0x533c('0x6')][_0x502a67[_0x533c('0x1d')]][_0x533c('0x1f')])){if(this['agents'][_0x502a67['interface']]){this['channels'][_0x502a67['uniqueid']]={'queue':_0x502a67[_0x533c('0x1d')],'interface':_0x502a67['interface'],'destlinkedid':_0x502a67[_0x533c('0x29')]};}}}catch(_0x503852){logger[_0x533c('0x39')]('[ACW][syncAgentConnect]\x20%s',_0x503852[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')]['syncAgentConnectPreview']=function(_0x132e42){try{if(this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]]&&(this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]]['acw']||this[_0x533c('0x6')][_0x132e42[_0x533c('0x1d')]][_0x533c('0x1f')])){if(this[_0x533c('0x7')][_0x132e42['interface']]){this[_0x533c('0x9')][_0x132e42[_0x533c('0x31')]]={'queue':_0x132e42['queue'],'interface':_0x132e42['interface']};}}}catch(_0x1dc963){logger['error'](_0x533c('0x40'),_0x1dc963[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0xe')]=function(_0xe9354a){try{if(this[_0x533c('0x9')][_0xe9354a[_0x533c('0x31')]]&&_[_0x533c('0x41')](this['channels'][_0xe9354a[_0x533c('0x31')]][_0x533c('0x28')])){logger[_0x533c('0x26')]('[%s][HANGUP:UNIQUEID]',_0xe9354a[_0x533c('0x31')]);this[_0x533c('0x1b')](_0xe9354a['uniqueid']);}else if(this[_0x533c('0x9')][_0xe9354a['linkedid']]&&_[_0x533c('0x41')](this[_0x533c('0x9')][_0xe9354a[_0x533c('0x42')]][_0x533c('0x28')])){logger[_0x533c('0x26')](_0x533c('0x43'),_0xe9354a[_0x533c('0x42')]);this['startAcw'](_0xe9354a[_0x533c('0x42')]);}}catch(_0x24c2f4){logger[_0x533c('0x39')](_0x533c('0x44'),_0x24c2f4[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x10')]=function(_0x50d5a2){try{if(this['channels'][_0x50d5a2['uniqueid']]&&this['channels'][_0x50d5a2[_0x533c('0x31')]][_0x533c('0x28')]){logger['info'](_0x533c('0x45'),_0x50d5a2[_0x533c('0x31')]);this[_0x533c('0x1b')](_0x50d5a2['uniqueid']);}else if(this[_0x533c('0x9')][_0x50d5a2['linkedid']]&&this['channels'][_0x50d5a2[_0x533c('0x42')]][_0x533c('0x28')]){logger[_0x533c('0x26')](_0x533c('0x46'),_0x50d5a2[_0x533c('0x42')]);this[_0x533c('0x1b')](_0x50d5a2[_0x533c('0x42')]);}}catch(_0x51190c){logger[_0x533c('0x39')]('[ACW][syncHangup]\x20%s',_0x51190c[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x13')]=function(_0x2c7600){try{if(!_[_0x533c('0x47')](this[_0x533c('0x9')][_0x2c7600[_0x533c('0x48')]])){this[_0x533c('0x1b')](_0x2c7600['transfereeuniqueid']);if(this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]]){this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]][_0x533c('0x28')]=!![];this[_0x533c('0x9')][_0x2c7600['transfertargetuniqueid']]=this[_0x533c('0x9')][_0x2c7600['secondtransfereruniqueid']];delete this[_0x533c('0x9')][_0x2c7600[_0x533c('0x49')]];}}else if(!_[_0x533c('0x47')](this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4a')]])){this[_0x533c('0x1b')](_0x2c7600['transfertargetuniqueid']);if(this['channels'][_0x2c7600[_0x533c('0x4b')]]){this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]][_0x533c('0x28')]=!![];this['channels'][_0x2c7600[_0x533c('0x48')]]=this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]];delete this[_0x533c('0x9')][_0x2c7600[_0x533c('0x4b')]];}}}catch(_0x2f2863){logger[_0x533c('0x39')](_0x533c('0x4c'),_0x2f2863[_0x533c('0x3a')]);}};Acw[_0x533c('0x1a')][_0x533c('0x15')]=function(_0xb8a24b){try{if(this[_0x533c('0x9')][_0xb8a24b[_0x533c('0x4d')]]){logger[_0x533c('0x26')](_0x533c('0x4e'),JSON[_0x533c('0x3e')](_0xb8a24b['transfereruniqueid']));this[_0x533c('0x1b')](_0xb8a24b['transfereruniqueid']);}else if(this['channels'][_0xb8a24b[_0x533c('0x4f')]]){logger[_0x533c('0x26')](_0x533c('0x50'),JSON[_0x533c('0x3e')](_0xb8a24b[_0x533c('0x4f')]));this[_0x533c('0x1b')](_0xb8a24b[_0x533c('0x4f')]);}}catch(_0x50df3a){logger[_0x533c('0x39')](_0x533c('0x51'),_0x50df3a['message']);}};Acw[_0x533c('0x1a')][_0x533c('0x52')]=function(_0x8174d0){try{if(this[_0x533c('0x6')][_0x8174d0['queue']]&&this[_0x533c('0x6')][_0x8174d0[_0x533c('0x1d')]]['autopause']===_0x533c('0x53')){if(this[_0x533c('0x7')][_0x8174d0['interface']]){logger[_0x533c('0x26')](_0x533c('0x54'),_0x8174d0['uniqueid'],_0x8174d0[_0x533c('0x1c')],_0x8174d0['queue']);return RpcUser['savePause'](this[_0x533c('0x7')][_0x8174d0[_0x533c('0x1c')]],_0x533c('0x55'),_0x8174d0[_0x533c('0x31')]);}}}catch(_0x5f233c){logger[_0x533c('0x39')](_0x533c('0x56'),_0x5f233c[_0x533c('0x3a')]);}};module[_0x533c('0x57')]=Acw; \ No newline at end of file +var _0x8ef6=['milliseconds','diff','seconds','prototype','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','startAcw','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview'];(function(_0x515232,_0x3de920){var _0x45685c=function(_0x25bae8){while(--_0x25bae8){_0x515232['push'](_0x515232['shift']());}};_0x45685c(++_0x3de920);}(_0x8ef6,0xf2));var _0x68ef=function(_0x590c94,_0x47b74b){_0x590c94=_0x590c94-0x0;var _0x1734f2=_0x8ef6[_0x590c94];return _0x1734f2;};'use strict';var util=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var ami=require(_0x68ef('0x3'));var logger=require(_0x68ef('0x4'))(_0x68ef('0x5'));var RpcUser=require(_0x68ef('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x27d0af){this[_0x68ef('0x7')]=_0x27d0af[_0x68ef('0x7')];this[_0x68ef('0x8')]=_0x27d0af['agents'];this['timers']=_0x27d0af[_0x68ef('0x9')];this[_0x68ef('0xa')]={};ami['on'](_0x68ef('0xb'),this['syncAgentConnect'][_0x68ef('0xc')](this));ami['on'](_0x68ef('0xd'),this[_0x68ef('0xe')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0xf'),this[_0x68ef('0x10')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x11'),this[_0x68ef('0x12')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x13'),this[_0x68ef('0x14')]['bind'](this));ami['on'](_0x68ef('0x15'),this[_0x68ef('0x16')][_0x68ef('0xc')](this));ami['on'](_0x68ef('0x17'),this[_0x68ef('0x18')][_0x68ef('0xc')](this));}function getDiff(_0x508671){var _0x3b48dd=moment()[_0x68ef('0x19')](0x0);var _0x2657c5=moment(_0x508671)['milliseconds'](0x0);return _0x3b48dd[_0x68ef('0x1a')](_0x2657c5,_0x68ef('0x1b'));}Acw[_0x68ef('0x1c')]['startAcw']=function(_0x35493d){try{var _0x37c4cc=this;var _0x3d1e90=this[_0x68ef('0xa')][_0x35493d]['interface'];var _0x2ada1c=this['channels'][_0x35493d]['queue'];var _0x2633c1=this[_0x68ef('0x7')][_0x2ada1c];var _0x4ade0d=![];var _0x527870=_0x68ef('0x1d');if(_0x2633c1[_0x68ef('0x1e')]){if(_0x2633c1[_0x68ef('0x1f')]['name']){_0x4ade0d=!![];_0x527870=_0x2633c1[_0x68ef('0x1f')][_0x68ef('0x20')];}}ami[_0x68ef('0x21')]({'action':'QueuePause','interface':_0x3d1e90,'paused':!![],'reason':_0x527870})[_0x68ef('0x22')](function(_0x3be4c0){if(_0x37c4cc['agents'][_0x3d1e90]){return RpcUser[_0x68ef('0x23')](_0x37c4cc[_0x68ef('0x8')][_0x3d1e90]['id'])[_0x68ef('0x22')](function(_0x5ddec7){if(_0x5ddec7&&!_0x5ddec7['voicePause']){logger['info'](_0x68ef('0x24'),_0x35493d,_0x3d1e90,_0x2ada1c);var _0x2023f2=_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x25')]&&_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x26')]?_0x37c4cc[_0x68ef('0xa')][_0x35493d][_0x68ef('0x26')]:_0x35493d;return RpcUser[_0x68ef('0x27')](_0x37c4cc[_0x68ef('0x8')][_0x3d1e90],_0x527870,_0x2023f2)['then'](function(_0x178460){if(!_0x4ade0d){_0x37c4cc['timers'][_0x3d1e90]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x35493d,_0x37c4cc[_0x68ef('0x7')][_0x2ada1c][_0x68ef('0x28')],_0x3d1e90,_0x2ada1c);_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x29')]=setTimeout(_0x37c4cc['stopAcw']['bind'](_0x37c4cc,_0x3d1e90),_0x37c4cc[_0x68ef('0x7')][_0x2ada1c][_0x68ef('0x28')]*0x3e8);_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2a')]=moment()[_0x68ef('0x2b')](_0x68ef('0x2c'));_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2d')]=_0x35493d;_0x37c4cc['timers'][_0x3d1e90][_0x68ef('0x2e')]=_0x2ada1c;_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x2f')]=function(){var _0x4c25aa=getDiff(_0x37c4cc[_0x68ef('0x9')][_0x3d1e90]['lastPauseAt']);clearTimeout(_0x37c4cc[_0x68ef('0x9')][_0x3d1e90][_0x68ef('0x29')]);_0x37c4cc['timers'][_0x3d1e90]['timer']=![];RpcVoiceAgentReport[_0x68ef('0x30')]({'acwtime':_0x4c25aa},_0x37c4cc[_0x68ef('0x9')][_0x3d1e90]['uniqueid'],_0x3d1e90)[_0x68ef('0x22')](function(_0x8c0a06){logger[_0x68ef('0x31')](_0x68ef('0x32'),_0x35493d,_0x4c25aa,_0x8c0a06);})['catch'](function(_0x2c8bd0){logger[_0x68ef('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x35493d,_0x2c8bd0);});delete _0x37c4cc[_0x68ef('0x9')][_0x3d1e90];};}});}else{logger['info'](_0x68ef('0x34'),_0x35493d,_0x3d1e90,_0x2ada1c);}});}})[_0x68ef('0x35')](function(_0x4973c2){logger[_0x68ef('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x35493d,_0x37c4cc[_0x68ef('0x7')][_0x2ada1c]['acwTimeout'],_0x3d1e90,_0x2ada1c);})[_0x68ef('0x36')](function(){delete _0x37c4cc[_0x68ef('0xa')][_0x35493d];});}catch(_0x798276){logger['error'](_0x68ef('0x37'),_0x798276['message']);}};Acw[_0x68ef('0x1c')]['stopAcw']=function(_0x474ffa){try{var _0x362ef1=this;if(_0x362ef1[_0x68ef('0x9')][_0x474ffa]){_0x362ef1[_0x68ef('0x9')][_0x474ffa][_0x68ef('0x29')]=![];var _0xefd1d=_0x362ef1['timers'][_0x474ffa][_0x68ef('0x2d')];var _0x15a6ab=_0x362ef1[_0x68ef('0x9')][_0x474ffa]['queue'];var _0x32eddd=_0x362ef1[_0x68ef('0x7')][_0x15a6ab][_0x68ef('0x28')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x474ffa);RpcUser[_0x68ef('0x38')](this[_0x68ef('0x8')][_0x474ffa]);RpcVoiceAgentReport[_0x68ef('0x30')]({'acwtime':_0x32eddd,'agentacw':!![]},_0xefd1d,_0x474ffa)[_0x68ef('0x22')](function(_0x401459){logger[_0x68ef('0x31')](_0x68ef('0x32'),_0xefd1d,_0x32eddd,_0x401459);})['catch'](function(_0xaf7df1){logger[_0x68ef('0x33')](_0x68ef('0x39'),_0xefd1d,_0xaf7df1);});}else{logger[_0x68ef('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x474ffa);if(_0x362ef1[_0x68ef('0x9')]){logger[_0x68ef('0x31')](_0x68ef('0x3a'),JSON[_0x68ef('0x3b')](_0x362ef1[_0x68ef('0x9')]));}}}catch(_0x3b00ea){logger['error'](_0x68ef('0x3c'),_0x3b00ea[_0x68ef('0x3d')]);}};Acw[_0x68ef('0x1c')][_0x68ef('0x3e')]=function(_0x449f3c){try{if(this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]]&&(this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]]['acw']||this[_0x68ef('0x7')][_0x449f3c[_0x68ef('0x2e')]][_0x68ef('0x1e')])){if(this[_0x68ef('0x8')][_0x449f3c[_0x68ef('0x3f')]]){this[_0x68ef('0xa')][_0x449f3c[_0x68ef('0x2d')]]={'queue':_0x449f3c['queue'],'interface':_0x449f3c[_0x68ef('0x3f')],'destlinkedid':_0x449f3c['destlinkedid']};}}}catch(_0x13c088){logger[_0x68ef('0x33')](_0x68ef('0x40'),_0x13c088[_0x68ef('0x3d')]);}};Acw['prototype'][_0x68ef('0x18')]=function(_0x5a8231){try{if(this[_0x68ef('0x7')][_0x5a8231['queue']]&&(this[_0x68ef('0x7')][_0x5a8231[_0x68ef('0x2e')]][_0x68ef('0x5')]||this['voiceQueues'][_0x5a8231['queue']][_0x68ef('0x1e')])){if(this[_0x68ef('0x8')][_0x5a8231['interface']]){this['channels'][_0x5a8231['uniqueid']]={'queue':_0x5a8231[_0x68ef('0x2e')],'interface':_0x5a8231[_0x68ef('0x3f')]};}}}catch(_0x173fb7){logger[_0x68ef('0x33')](_0x68ef('0x41'),_0x173fb7['message']);}};Acw['prototype'][_0x68ef('0xe')]=function(_0x21f064){try{if(this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x2d')]]&&_['isUndefined'](this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x2d')]][_0x68ef('0x25')])){logger[_0x68ef('0x31')]('[%s][HANGUP:UNIQUEID]',_0x21f064['uniqueid']);this[_0x68ef('0x42')](_0x21f064[_0x68ef('0x2d')]);}else if(this['channels'][_0x21f064[_0x68ef('0x43')]]&&_[_0x68ef('0x44')](this[_0x68ef('0xa')][_0x21f064[_0x68ef('0x43')]][_0x68ef('0x25')])){logger['info'](_0x68ef('0x45'),_0x21f064[_0x68ef('0x43')]);this[_0x68ef('0x42')](_0x21f064['linkedid']);}}catch(_0x8ef51b){logger[_0x68ef('0x33')](_0x68ef('0x46'),_0x8ef51b['message']);}};Acw[_0x68ef('0x1c')]['syncHangup']=function(_0x574573){try{if(this[_0x68ef('0xa')][_0x574573['uniqueid']]&&this[_0x68ef('0xa')][_0x574573[_0x68ef('0x2d')]][_0x68ef('0x25')]){logger[_0x68ef('0x31')](_0x68ef('0x47'),_0x574573[_0x68ef('0x2d')]);this[_0x68ef('0x42')](_0x574573[_0x68ef('0x2d')]);}else if(this[_0x68ef('0xa')][_0x574573[_0x68ef('0x43')]]&&this['channels'][_0x574573['linkedid']][_0x68ef('0x25')]){logger[_0x68ef('0x31')](_0x68ef('0x48'),_0x574573[_0x68ef('0x43')]);this[_0x68ef('0x42')](_0x574573[_0x68ef('0x43')]);}}catch(_0x15400c){logger[_0x68ef('0x33')](_0x68ef('0x49'),_0x15400c['message']);}};Acw['prototype'][_0x68ef('0x14')]=function(_0x5781c8){try{if(!_[_0x68ef('0x4a')](this['channels'][_0x5781c8[_0x68ef('0x4b')]])){this[_0x68ef('0x42')](_0x5781c8['transfereeuniqueid']);if(this[_0x68ef('0xa')][_0x5781c8['secondtransfereruniqueid']]){this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4c')]][_0x68ef('0x25')]=!![];this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4d')]]=this[_0x68ef('0xa')][_0x5781c8['secondtransfereruniqueid']];delete this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4c')]];}}else if(!_[_0x68ef('0x4a')](this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4d')]])){this[_0x68ef('0x42')](_0x5781c8['transfertargetuniqueid']);if(this[_0x68ef('0xa')][_0x5781c8[_0x68ef('0x4e')]]){this['channels'][_0x5781c8[_0x68ef('0x4e')]][_0x68ef('0x25')]=!![];this[_0x68ef('0xa')][_0x5781c8['transfereeuniqueid']]=this[_0x68ef('0xa')][_0x5781c8['origtransfereruniqueid']];delete this['channels'][_0x5781c8[_0x68ef('0x4e')]];}}}catch(_0x540da5){logger[_0x68ef('0x33')]('[ACW][syncAttendedTransfer]\x20%s',_0x540da5[_0x68ef('0x3d')]);}};Acw[_0x68ef('0x1c')][_0x68ef('0x16')]=function(_0x3fbd39){try{if(this[_0x68ef('0xa')][_0x3fbd39[_0x68ef('0x4f')]]){logger['info'](_0x68ef('0x50'),JSON['stringify'](_0x3fbd39[_0x68ef('0x4f')]));this['startAcw'](_0x3fbd39[_0x68ef('0x4f')]);}else if(this[_0x68ef('0xa')][_0x3fbd39[_0x68ef('0x51')]]){logger[_0x68ef('0x31')](_0x68ef('0x52'),JSON[_0x68ef('0x3b')](_0x3fbd39[_0x68ef('0x51')]));this['startAcw'](_0x3fbd39[_0x68ef('0x51')]);}}catch(_0x11bab3){logger[_0x68ef('0x33')](_0x68ef('0x53'),_0x11bab3[_0x68ef('0x3d')]);}};Acw['prototype'][_0x68ef('0x12')]=function(_0x561e8d){try{if(this[_0x68ef('0x7')][_0x561e8d['queue']]&&this['voiceQueues'][_0x561e8d[_0x68ef('0x2e')]][_0x68ef('0x54')]===_0x68ef('0x55')){if(this[_0x68ef('0x8')][_0x561e8d['interface']]){logger[_0x68ef('0x31')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x561e8d[_0x68ef('0x2d')],_0x561e8d[_0x68ef('0x3f')],_0x561e8d[_0x68ef('0x2e')]);return RpcUser['savePause'](this['agents'][_0x561e8d[_0x68ef('0x3f')]],_0x68ef('0x56'),_0x561e8d[_0x68ef('0x2d')]);}}}catch(_0x454c6f){logger['error'](_0x68ef('0x57'),_0x454c6f[_0x68ef('0x3d')]);}};module[_0x68ef('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 4ff5bbe..6a429ba 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 _0xe96f=['exports','asterisk-manager','bluebird','moment','util','../../config/logger','asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','username','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList'];(function(_0xee2ff7,_0x19a2fe){var _0x23ea75=function(_0x4bae01){while(--_0x4bae01){_0xee2ff7['push'](_0xee2ff7['shift']());}};_0x23ea75(++_0x19a2fe);}(_0xe96f,0xb5));var _0xfe96=function(_0x2273ba,_0x326011){_0x2273ba=_0x2273ba-0x0;var _0x2415b3=_0xe96f[_0x2273ba];return _0x2415b3;};'use strict';var Manager=require(_0xfe96('0x0'));var BPromise=require(_0xfe96('0x1'));var moment=require(_0xfe96('0x2'));var util=require(_0xfe96('0x3'));var _=require('lodash');var logger=require(_0xfe96('0x4'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0xfe96('0x5')]['port'],config['asterisk']['ip'],config[_0xfe96('0x5')]['username'],config[_0xfe96('0x5')][_0xfe96('0x6')],!![]);ami[_0xfe96('0x7')]();ami[_0xfe96('0x8')]=BPromise[_0xfe96('0x9')](ami[_0xfe96('0xa')]);function error(_0xed6dbe){logger[_0xfe96('0xb')](util[_0xfe96('0xc')](_0xfe96('0xd'),config['asterisk']['username'],config[_0xfe96('0x5')]['ip'],config[_0xfe96('0x5')][_0xfe96('0xe')],util[_0xfe96('0xf')](_0xed6dbe,![],null)));}function close(){logger['error'](util[_0xfe96('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xfe96('0x5')]['username'],config['asterisk']['ip'],config[_0xfe96('0x5')]['port']));}ami[_0xfe96('0x10')]=function(){return function(){return ami[_0xfe96('0x8')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xfe96('0x8')]({'action':'devicestatelist'});};};ami[_0xfe96('0x11')]=function(){return function(){return ami[_0xfe96('0x8')]({'action':_0xfe96('0x12')});};};ami[_0xfe96('0x13')]=function(){return function(){return ami[_0xfe96('0x8')]({'action':_0xfe96('0x14')});};};ami[_0xfe96('0x15')]=function(){return function(){return ami[_0xfe96('0x8')]({'action':'coreshowchannels'});};};function connect(_0x308f54){logger[_0xfe96('0x16')](util[_0xfe96('0xc')](_0xfe96('0x17'),config[_0xfe96('0x5')][_0xfe96('0x18')],config[_0xfe96('0x5')]['ip'],config[_0xfe96('0x5')]['port']));ami[_0xfe96('0x19')](_0xfe96('0xb'),error);ami['once'](_0xfe96('0x1a'),close);}ami['on'](_0xfe96('0x1b'),connect);ami['on'](_0xfe96('0x1c'),function(_0x2294d1){logger[_0xfe96('0x16')](util[_0xfe96('0xc')](_0xfe96('0x1d'),config[_0xfe96('0x5')]['username'],config[_0xfe96('0x5')]['ip'],config['asterisk'][_0xfe96('0xe')],util[_0xfe96('0xf')](_0x2294d1,![],null)));});ami['on'](_0xfe96('0x1e'),function(_0x37ddc3){logger[_0xfe96('0x16')](util[_0xfe96('0xc')](_0xfe96('0x1f'),config[_0xfe96('0x5')][_0xfe96('0x18')],config[_0xfe96('0x5')]['ip'],config[_0xfe96('0x5')]['port']));return BPromise[_0xfe96('0x20')]()[_0xfe96('0x21')](ami[_0xfe96('0x10')]())[_0xfe96('0x21')](ami[_0xfe96('0x22')]())['then'](ami[_0xfe96('0x11')]())[_0xfe96('0x21')](ami[_0xfe96('0x13')]())['then'](ami[_0xfe96('0x15')]())['catch'](function(_0x45dd65){console['log'](_0x45dd65);});});ami[_0xfe96('0x19')](_0xfe96('0xb'),error);ami[_0xfe96('0x19')](_0xfe96('0x1a'),close);module[_0xfe96('0x23')]=ami; \ No newline at end of file +var _0x14b1=['log','exports','asterisk-manager','bluebird','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x14b1,0x160));var _0x114b=function(_0x531b1e,_0x301978){_0x531b1e=_0x531b1e-0x0;var _0x1208b6=_0x14b1[_0x531b1e];return _0x1208b6;};'use strict';var Manager=require(_0x114b('0x0'));var BPromise=require(_0x114b('0x1'));var moment=require('moment');var util=require('util');var _=require(_0x114b('0x2'));var logger=require(_0x114b('0x3'))(_0x114b('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x114b('0x5')][_0x114b('0x6')],config[_0x114b('0x5')]['ip'],config['asterisk'][_0x114b('0x7')],config[_0x114b('0x5')][_0x114b('0x8')],!![]);ami[_0x114b('0x9')]();ami[_0x114b('0xa')]=BPromise[_0x114b('0xb')](ami['action']);function error(_0x356f39){logger[_0x114b('0xc')](util['format'](_0x114b('0xd'),config[_0x114b('0x5')][_0x114b('0x7')],config[_0x114b('0x5')]['ip'],config[_0x114b('0x5')][_0x114b('0x6')],util[_0x114b('0xe')](_0x356f39,![],null)));}function close(){logger[_0x114b('0xc')](util['format'](_0x114b('0xf'),config[_0x114b('0x5')][_0x114b('0x7')],config[_0x114b('0x5')]['ip'],config[_0x114b('0x5')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x114b('0xa')]({'action':_0x114b('0x10')});};};ami[_0x114b('0x11')]=function(){return function(){return ami[_0x114b('0xa')]({'action':_0x114b('0x12')});};};ami[_0x114b('0x13')]=function(){return function(){return ami[_0x114b('0xa')]({'action':'sippeerstatus'});};};ami[_0x114b('0x14')]=function(){return function(){return ami[_0x114b('0xa')]({'action':'queuesummary'});};};ami[_0x114b('0x15')]=function(){return function(){return ami[_0x114b('0xa')]({'action':'coreshowchannels'});};};function connect(_0x45f64){logger[_0x114b('0x16')](util[_0x114b('0x17')](_0x114b('0x18'),config['asterisk'][_0x114b('0x7')],config[_0x114b('0x5')]['ip'],config[_0x114b('0x5')][_0x114b('0x6')]));ami[_0x114b('0x19')]('error',error);ami[_0x114b('0x19')]('close',close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x53edb3){logger[_0x114b('0x16')](util[_0x114b('0x17')](_0x114b('0x1a'),config['asterisk'][_0x114b('0x7')],config[_0x114b('0x5')]['ip'],config[_0x114b('0x5')]['port'],util[_0x114b('0xe')](_0x53edb3,![],null)));});ami['on'](_0x114b('0x1b'),function(_0x46addc){logger[_0x114b('0x16')](util['format'](_0x114b('0x1c'),config['asterisk']['username'],config[_0x114b('0x5')]['ip'],config[_0x114b('0x5')]['port']));return BPromise[_0x114b('0x1d')]()[_0x114b('0x1e')](ami[_0x114b('0x1f')]())['then'](ami[_0x114b('0x11')]())[_0x114b('0x1e')](ami[_0x114b('0x13')]())['then'](ami[_0x114b('0x14')]())[_0x114b('0x1e')](ami['actionCoreShowChannels']())[_0x114b('0x20')](function(_0x3cf701){console[_0x114b('0x21')](_0x3cf701);});});ami[_0x114b('0x19')](_0x114b('0xc'),error);ami[_0x114b('0x19')]('close',close);module[_0x114b('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index cca8616..5e351b6 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 _0xae18=['memberReport','error','rpc','message','result','exports','jayson/promise','bluebird','../../config/logger','ami','client','http','request','then'];(function(_0x322e2f,_0x21ba28){var _0xedcce2=function(_0x593029){while(--_0x593029){_0x322e2f['push'](_0x322e2f['shift']());}};_0xedcce2(++_0x21ba28);}(_0xae18,0xe6));var _0x8ae1=function(_0x78b7dd,_0x5d2ad1){_0x78b7dd=_0x78b7dd-0x0;var _0xf91e1d=_0xae18[_0x78b7dd];return _0xf91e1d;};'use strict';var jayson=require(_0x8ae1('0x0'));var BPromise=require(_0x8ae1('0x1'));var logger=require(_0x8ae1('0x2'))(_0x8ae1('0x3'));var client=jayson[_0x8ae1('0x4')][_0x8ae1('0x5')]({'port':0x2329});client['Request']=function(_0x4be52a,_0x255f4b){return new BPromise(function(_0x3bd02e,_0x3b522e){return client[_0x8ae1('0x6')](_0x4be52a,_0x255f4b)[_0x8ae1('0x7')](function(_0x238dd8){logger['debug']('rpc',_0x8ae1('0x8'),_0x4be52a,_0x255f4b,_0x238dd8);if(_0x238dd8['error']){logger[_0x8ae1('0x9')](_0x8ae1('0xa'),_0x8ae1('0x8'),_0x4be52a,_0x238dd8[_0x8ae1('0x9')][_0x8ae1('0xb')],_0x255f4b);return _0x3b522e(_0x238dd8['error']['message']);}else{return _0x3bd02e(_0x238dd8[_0x8ae1('0xc')]);}})['catch'](function(_0x4ae71a){logger[_0x8ae1('0x9')](_0x8ae1('0xa'),_0x8ae1('0x8'),_0x4be52a,_0x4ae71a,_0x255f4b);return _0x3b522e(_0x4ae71a);});});};module[_0x8ae1('0xd')]=client; \ No newline at end of file +var _0x38d1=['http','Request','then','debug','memberReport','error','message','catch','exports','jayson/promise','../../config/logger','ami','client'];(function(_0x431f3c,_0x54cb7b){var _0x543f22=function(_0x577165){while(--_0x577165){_0x431f3c['push'](_0x431f3c['shift']());}};_0x543f22(++_0x54cb7b);}(_0x38d1,0xa5));var _0x138d=function(_0x2ce3f6,_0x24acaf){_0x2ce3f6=_0x2ce3f6-0x0;var _0x598dab=_0x38d1[_0x2ce3f6];return _0x598dab;};'use strict';var jayson=require(_0x138d('0x0'));var BPromise=require('bluebird');var logger=require(_0x138d('0x1'))(_0x138d('0x2'));var client=jayson[_0x138d('0x3')][_0x138d('0x4')]({'port':0x2329});client[_0x138d('0x5')]=function(_0x2d4419,_0x27dbd5){return new BPromise(function(_0x16d60c,_0xab189a){return client['request'](_0x2d4419,_0x27dbd5)[_0x138d('0x6')](function(_0x32da88){logger[_0x138d('0x7')]('rpc',_0x138d('0x8'),_0x2d4419,_0x27dbd5,_0x32da88);if(_0x32da88[_0x138d('0x9')]){logger[_0x138d('0x9')]('rpc',_0x138d('0x8'),_0x2d4419,_0x32da88[_0x138d('0x9')][_0x138d('0xa')],_0x27dbd5);return _0xab189a(_0x32da88[_0x138d('0x9')][_0x138d('0xa')]);}else{return _0x16d60c(_0x32da88['result']);}})[_0x138d('0xb')](function(_0x7eea87){logger['error']('rpc',_0x138d('0x8'),_0x2d4419,_0x7eea87,_0x27dbd5);return _0xab189a(_0x7eea87);});});};module[_0x138d('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 4ce43e6..40589db 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 _0xa6e2=['\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','string','voiceQueue','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype'];(function(_0x3fba08,_0x31894a){var _0x54ff2f=function(_0x424a38){while(--_0x424a38){_0x3fba08['push'](_0x3fba08['shift']());}};_0x54ff2f(++_0x31894a);}(_0xa6e2,0x132));var _0x2a6e=function(_0x324219,_0x1ceb38){_0x324219=_0x324219-0x0;var _0xef373e=_0xa6e2[_0x324219];return _0xef373e;};'use strict';var util=require(_0x2a6e('0x0'));var _=require(_0x2a6e('0x1'));var moment=require('moment');function checkNameSurname(_0x144192,_0x1286dd,_0x314611){var _0x4e74b6='';if(!_['isNil'](_0x1286dd)&&_0x2a6e('0x2')===typeof _0x1286dd){_0x4e74b6+=_0x1286dd;}if(!_['isNil'](_0x314611)&&'string'===typeof _0x314611){_0x4e74b6+='\x20'+_0x314611;}if(_0x4e74b6!==''){return _0x4e74b6;}return _0x144192;}function Action(_0x2bb3fa,_0x17b0f4,_0x29fd48){this[_0x2a6e('0x3')]=_0x2bb3fa;this['uniqueid']=_0x29fd48||undefined;this[_0x2a6e('0x4')]=checkNameSurname(_0x17b0f4[_0x2a6e('0x5')]['phone'],_0x17b0f4[_0x2a6e('0x5')][_0x2a6e('0x6')],_0x17b0f4[_0x2a6e('0x5')][_0x2a6e('0x7')]);this[_0x2a6e('0x8')]=_0x17b0f4[_0x2a6e('0x5')][_0x2a6e('0x9')];this[_0x2a6e('0xa')]=_0x2bb3fa[_0x2a6e('0x4')];this[_0x2a6e('0xb')]=_0x17b0f4['active']||![];this[_0x2a6e('0xc')]=_0x2bb3fa['type'];this[_0x2a6e('0xd')]=_0x2bb3fa[_0x2a6e('0xd')]||0x3;this[_0x2a6e('0xe')]=_0x17b0f4[_0x2a6e('0xe')];this[_0x2a6e('0xf')]=_0x17b0f4[_0x2a6e('0xf')];this[_0x2a6e('0x10')]=_0x17b0f4['countcongestionretry'];this[_0x2a6e('0x11')]=_0x17b0f4[_0x2a6e('0x11')];this['countnosuchnumberretry']=_0x17b0f4[_0x2a6e('0x12')];this[_0x2a6e('0x13')]=_0x17b0f4[_0x2a6e('0x13')];this[_0x2a6e('0x14')]=_0x17b0f4['countabandonedretry'];this[_0x2a6e('0x15')]=_0x17b0f4[_0x2a6e('0x15')];this[_0x2a6e('0x16')]=_0x17b0f4[_0x2a6e('0x16')];this[_0x2a6e('0x17')]=_0x17b0f4['ContactId'];this[_0x2a6e('0x18')]=_0x17b0f4[_0x2a6e('0x18')];this[_0x2a6e('0x19')]=_0x17b0f4[_0x2a6e('0x19')];this[_0x2a6e('0x1a')]=_0x17b0f4[_0x2a6e('0x1a')];this['CampaignId']=_0x17b0f4[_0x2a6e('0x1b')];this[_0x2a6e('0x1c')]=_0x17b0f4['id'];this[_0x2a6e('0x1d')]=_0x17b0f4[_0x2a6e('0x5')][_0x2a6e('0x6')]||'';this[_0x2a6e('0x1e')]=moment()['format'](_0x2a6e('0x1f'));this[_0x2a6e('0x20')]=_0x17b0f4[_0x2a6e('0x20')];this[_0x2a6e('0x21')]=_0x17b0f4[_0x2a6e('0x21')];this['callbackat']=_0x17b0f4[_0x2a6e('0x22')];this['recallme']=_0x17b0f4[_0x2a6e('0x23')];this[_0x2a6e('0x24')]='';this['originatecalleridname']='';}Action[_0x2a6e('0x25')]['getCaller']=function(){return util['format'](_0x2a6e('0x26'),this[_0x2a6e('0x4')],this[_0x2a6e('0x3')][_0x2a6e('0x27')]>0x0?this[_0x2a6e('0x8')][_0x2a6e('0x28')](this[_0x2a6e('0x3')]['dialCutDigit']):this[_0x2a6e('0x8')]);};Action[_0x2a6e('0x25')][_0x2a6e('0x29')]=function(){return this[_0x2a6e('0xa')];};module[_0x2a6e('0x2a')]=Action; \ No newline at end of file +var _0xde6f=['callbackat','recallme','originatecalleridname','prototype','format','dialCutDigit','substring','getQueue','exports','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x5dbcd9,_0x1d0ce2){var _0x29f990=function(_0x324786){while(--_0x324786){_0x5dbcd9['push'](_0x5dbcd9['shift']());}};_0x29f990(++_0x1d0ce2);}(_0xde6f,0x84));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xfde6('0x0'));function checkNameSurname(_0xe3543e,_0x211a20,_0x5df9d5){var _0x1b72d8='';if(!_[_0xfde6('0x1')](_0x211a20)&&_0xfde6('0x2')===typeof _0x211a20){_0x1b72d8+=_0x211a20;}if(!_[_0xfde6('0x1')](_0x5df9d5)&&_0xfde6('0x2')===typeof _0x5df9d5){_0x1b72d8+='\x20'+_0x5df9d5;}if(_0x1b72d8!==''){return _0x1b72d8;}return _0xe3543e;}function Action(_0x347a67,_0x50d21a,_0x5628ea){this[_0xfde6('0x3')]=_0x347a67;this[_0xfde6('0x4')]=_0x5628ea||undefined;this[_0xfde6('0x5')]=checkNameSurname(_0x50d21a[_0xfde6('0x6')]['phone'],_0x50d21a[_0xfde6('0x6')][_0xfde6('0x7')],_0x50d21a[_0xfde6('0x6')]['lastName']);this[_0xfde6('0x8')]=_0x50d21a[_0xfde6('0x6')]['phone'];this['queue']=_0x347a67[_0xfde6('0x5')];this[_0xfde6('0x9')]=_0x50d21a[_0xfde6('0x9')]||![];this[_0xfde6('0xa')]=_0x347a67['type'];this[_0xfde6('0xb')]=_0x347a67[_0xfde6('0xb')]||0x3;this[_0xfde6('0xc')]=_0x50d21a[_0xfde6('0xc')];this[_0xfde6('0xd')]=_0x50d21a['countbusyretry'];this[_0xfde6('0xe')]=_0x50d21a[_0xfde6('0xe')];this['countnoanswerretry']=_0x50d21a[_0xfde6('0xf')];this[_0xfde6('0x10')]=_0x50d21a[_0xfde6('0x10')];this['countdropretry']=_0x50d21a[_0xfde6('0x11')];this[_0xfde6('0x12')]=_0x50d21a[_0xfde6('0x12')];this[_0xfde6('0x13')]=_0x50d21a['countmachineretry'];this['countagentrejectretry']=_0x50d21a[_0xfde6('0x14')];this['ContactId']=_0x50d21a[_0xfde6('0x15')];this[_0xfde6('0x16')]=_0x50d21a['ListId'];this[_0xfde6('0x17')]=_0x50d21a['UserId'];this[_0xfde6('0x18')]=_0x50d21a[_0xfde6('0x18')];this[_0xfde6('0x19')]=_0x50d21a[_0xfde6('0x19')];this[_0xfde6('0x1a')]=_0x50d21a['id'];this[_0xfde6('0x1b')]=_0x50d21a[_0xfde6('0x6')][_0xfde6('0x7')]||'';this[_0xfde6('0x1c')]=moment()['format'](_0xfde6('0x1d'));this[_0xfde6('0x1e')]=_0x50d21a['callback'];this[_0xfde6('0x1f')]=_0x50d21a[_0xfde6('0x1f')];this['callbackat']=_0x50d21a[_0xfde6('0x20')];this[_0xfde6('0x21')]=_0x50d21a['recallme'];this['originatecalleridnum']='';this[_0xfde6('0x22')]='';}Action[_0xfde6('0x23')]['getCaller']=function(){return util[_0xfde6('0x24')]('\x22%s\x22\x20<%s>',this['name'],this[_0xfde6('0x3')][_0xfde6('0x25')]>0x0?this[_0xfde6('0x8')][_0xfde6('0x26')](this[_0xfde6('0x3')][_0xfde6('0x25')]):this['number']);};Action[_0xfde6('0x23')][_0xfde6('0x27')]=function(){return this['queue'];};module[_0xfde6('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 73357c6..90b8fd7 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 _0x3e06=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x35e362,_0x38c9e2){var _0x5e9011=function(_0x53ccfd){while(--_0x53ccfd){_0x35e362['push'](_0x35e362['shift']());}};_0x5e9011(++_0x38c9e2);}(_0x3e06,0x13f));var _0x63e0=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3e06[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x63e0('0x0'));var _=require(_0x63e0('0x1'));var moment=require(_0x63e0('0x2'));function getSeconds(_0x33ac53,_0x301610){var _0x56bd93=moment(_0x33ac53)[_0x63e0('0x3')](0x0);var _0x397494=moment(_0x301610)[_0x63e0('0x3')](0x0);return _0x56bd93[_0x63e0('0x4')](_0x397494,_0x63e0('0x5'));}function AdditionalPhone(_0x4e304d){this[_0x63e0('0x6')]=_0x4e304d[_0x63e0('0x6')];this[_0x63e0('0x7')]=_0x4e304d[_0x63e0('0x7')]||undefined;this['type']=_0x4e304d[_0x63e0('0x8')];this[_0x63e0('0x9')]=_0x4e304d['type']===_0x63e0('0xa')?_0x63e0('0xb'):_0x4e304d[_0x63e0('0x8')];this[_0x63e0('0xc')]=_0x4e304d[_0x63e0('0xc')];this[_0x63e0('0xd')]=_0x4e304d[_0x63e0('0xd')];this['countnoanswerretry']=_0x4e304d[_0x63e0('0xe')];this[_0x63e0('0xf')]=_0x4e304d['countbusyretry']+_0x4e304d[_0x63e0('0xd')]+_0x4e304d[_0x63e0('0xe')]+_0x4e304d[_0x63e0('0x10')]+_0x4e304d[_0x63e0('0x11')]+_0x4e304d[_0x63e0('0x12')]+_0x4e304d[_0x63e0('0x13')]+_0x4e304d[_0x63e0('0x14')];this[_0x63e0('0x10')]=_0x4e304d['countnosuchnumberretry'];this[_0x63e0('0x11')]=_0x4e304d[_0x63e0('0x11')];this[_0x63e0('0x12')]=_0x4e304d['countabandonedretry'];this['countmachineretry']=_0x4e304d['countmachineretry'];this[_0x63e0('0x14')]=_0x4e304d['countagentrejectretry'];this[_0x63e0('0xb')]=_0x4e304d['queue'];this[_0x63e0('0x15')]=_0x4e304d[_0x63e0('0x16')];this[_0x63e0('0x17')]=_0x4e304d['number'];this[_0x63e0('0x18')]=_0x4e304d[_0x63e0('0x18')];this[_0x63e0('0x19')]=_0x4e304d[_0x63e0('0x19')];this['endtime']=_0x4e304d['responsetime'];this[_0x63e0('0x1a')]=getSeconds(_0x4e304d['responsetime'],_0x4e304d['starttime']);this[_0x63e0('0x1b')]=0x0;this[_0x63e0('0x1c')]=0x0;this['callback']=_0x4e304d[_0x63e0('0x1d')];this['callbackuniqueid']=_0x4e304d[_0x63e0('0x1e')];this[_0x63e0('0x1f')]=_0x4e304d[_0x63e0('0x1f')];this['recallme']=_0x4e304d[_0x63e0('0x20')];this[_0x63e0('0x21')]=_0x4e304d[_0x63e0('0x21')];this[_0x63e0('0x22')]=_0x4e304d[_0x63e0('0x22')];this['UserId']=_0x4e304d[_0x63e0('0x23')];this[_0x63e0('0x24')]=_0x4e304d[_0x63e0('0x24')];this['CampaignId']=_0x4e304d[_0x63e0('0x25')];this[_0x63e0('0x26')]=_0x4e304d['originatecalleridnum']||'';this[_0x63e0('0x27')]=_0x4e304d[_0x63e0('0x27')]||'';}module[_0x63e0('0x28')]=History; \ No newline at end of file +var _0xaa98=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','endtime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','diff'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xaa98,0x12d));var _0x8aa9=function(_0x3ad779,_0x5249e1){_0x3ad779=_0x3ad779-0x0;var _0x31ee8b=_0xaa98[_0x3ad779];return _0x31ee8b;};'use strict';var util=require('util');var _=require(_0x8aa9('0x0'));var moment=require(_0x8aa9('0x1'));function getSeconds(_0x3246c3,_0x24cdce){var _0x205e53=moment(_0x3246c3)['milliseconds'](0x0);var _0x178201=moment(_0x24cdce)['milliseconds'](0x0);return _0x205e53[_0x8aa9('0x2')](_0x178201,_0x8aa9('0x3'));}function AdditionalPhone(_0x2622c5){this[_0x8aa9('0x4')]=_0x2622c5[_0x8aa9('0x4')];this[_0x8aa9('0x5')]=_0x2622c5[_0x8aa9('0x5')]||undefined;this[_0x8aa9('0x6')]=_0x2622c5[_0x8aa9('0x6')];this[_0x8aa9('0x7')]=_0x2622c5[_0x8aa9('0x6')]===_0x8aa9('0x8')?_0x8aa9('0x9'):_0x2622c5[_0x8aa9('0x6')];this[_0x8aa9('0xa')]=_0x2622c5[_0x8aa9('0xa')];this[_0x8aa9('0xb')]=_0x2622c5[_0x8aa9('0xb')];this[_0x8aa9('0xc')]=_0x2622c5[_0x8aa9('0xc')];this[_0x8aa9('0xd')]=_0x2622c5['countbusyretry']+_0x2622c5[_0x8aa9('0xb')]+_0x2622c5['countnoanswerretry']+_0x2622c5[_0x8aa9('0xe')]+_0x2622c5[_0x8aa9('0xf')]+_0x2622c5[_0x8aa9('0x10')]+_0x2622c5[_0x8aa9('0x11')]+_0x2622c5['countagentrejectretry'];this[_0x8aa9('0xe')]=_0x2622c5['countnosuchnumberretry'];this['countdropretry']=_0x2622c5[_0x8aa9('0xf')];this[_0x8aa9('0x10')]=_0x2622c5['countabandonedretry'];this[_0x8aa9('0x11')]=_0x2622c5[_0x8aa9('0x11')];this[_0x8aa9('0x12')]=_0x2622c5[_0x8aa9('0x12')];this[_0x8aa9('0x9')]=_0x2622c5[_0x8aa9('0x9')];this['calleridname']=_0x2622c5[_0x8aa9('0x13')];this[_0x8aa9('0x14')]=_0x2622c5[_0x8aa9('0x15')];this['starttime']=_0x2622c5[_0x8aa9('0x16')];this['responsetime']=_0x2622c5['responsetime'];this[_0x8aa9('0x17')]=_0x2622c5[_0x8aa9('0x18')];this['ringtime']=getSeconds(_0x2622c5['responsetime'],_0x2622c5[_0x8aa9('0x16')]);this[_0x8aa9('0x19')]=0x0;this[_0x8aa9('0x1a')]=0x0;this['callback']=_0x2622c5[_0x8aa9('0x1b')];this[_0x8aa9('0x1c')]=_0x2622c5['callbackuniqueid'];this[_0x8aa9('0x1d')]=_0x2622c5['callbackat'];this['recallme']=_0x2622c5['recallme'];this[_0x8aa9('0x1e')]=_0x2622c5[_0x8aa9('0x1e')];this[_0x8aa9('0x1f')]=_0x2622c5[_0x8aa9('0x1f')];this[_0x8aa9('0x20')]=_0x2622c5['UserId'];this[_0x8aa9('0x21')]=_0x2622c5[_0x8aa9('0x21')];this[_0x8aa9('0x22')]=_0x2622c5[_0x8aa9('0x22')];this['originatecalleridnum']=_0x2622c5[_0x8aa9('0x23')]||'';this[_0x8aa9('0x24')]=_0x2622c5['originatecalleridname']||'';}module[_0x8aa9('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 24d8afe..a18e7c5 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 _0x665d=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','ringtime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','moment','milliseconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countnoanswerretry','countglobal'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x665d,0x144));var _0xd665=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0x665d[_0x47878f];return _0x4b05b8;};'use strict';var util=require(_0xd665('0x0'));var _=require('lodash');var moment=require(_0xd665('0x1'));function getSeconds(_0x346ef2,_0x52034f){var _0x10670e=moment(_0x346ef2)[_0xd665('0x2')](0x0);var _0x2f27ab=moment(_0x52034f)[_0xd665('0x2')](0x0);return _0x10670e['diff'](_0x2f27ab,'seconds');}function AgentComplete(_0x19b06f,_0x4bdcd8){this[_0xd665('0x3')]=0x4;this[_0xd665('0x4')]=_0xd665('0x5');this[_0xd665('0x6')]=_0x19b06f[_0xd665('0x6')];this['type']=_0x19b06f[_0xd665('0x7')];this['campaigntype']=_0x19b06f[_0xd665('0x7')]===_0xd665('0x8')?'queue':_0x19b06f[_0xd665('0x7')];this[_0xd665('0x9')]=_0x19b06f['countbusyretry'];this['countcongestionretry']=_0x19b06f['countcongestionretry'];this[_0xd665('0xa')]=_0x19b06f[_0xd665('0xa')];this[_0xd665('0xb')]=_0x19b06f[_0xd665('0x9')]+_0x19b06f['countcongestionretry']+_0x19b06f[_0xd665('0xa')]+_0x19b06f[_0xd665('0xc')]+_0x19b06f[_0xd665('0xd')]+_0x19b06f[_0xd665('0xe')]+_0x19b06f[_0xd665('0xf')]+_0x19b06f[_0xd665('0x10')];this['countnosuchnumberretry']=_0x19b06f[_0xd665('0xc')];this[_0xd665('0xd')]=_0x19b06f[_0xd665('0xd')];this[_0xd665('0xe')]=_0x19b06f[_0xd665('0xe')];this[_0xd665('0xf')]=_0x19b06f[_0xd665('0xf')];this['countagentrejectretry']=_0x19b06f[_0xd665('0x10')];this[_0xd665('0x11')]=_0x4bdcd8['uniqueid'];this[_0xd665('0x12')]=_0x19b06f[_0xd665('0x13')];this[_0xd665('0x14')]=_0x19b06f[_0xd665('0x15')];this['starttime']=_0x19b06f[_0xd665('0x16')];this['responsetime']=_0x19b06f[_0xd665('0x17')];this[_0xd665('0x18')]=_0x19b06f[_0xd665('0x18')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd665('0x19')]=getSeconds(_0x19b06f[_0xd665('0x17')],_0x19b06f[_0xd665('0x16')]);this[_0xd665('0x1a')]=getSeconds(_0x19b06f[_0xd665('0x18')],_0x19b06f[_0xd665('0x17')]);this[_0xd665('0x1b')]=getSeconds(this[_0xd665('0x1c')],_0x19b06f[_0xd665('0x18')]);this[_0xd665('0x1d')]=_0x4bdcd8['queue'];this['membername']=_0x4bdcd8[_0xd665('0x1e')];this[_0xd665('0x1f')]=_0x4bdcd8['reason'];this['callback']=_0x19b06f[_0xd665('0x20')];this[_0xd665('0x21')]=_0x19b06f[_0xd665('0x21')];this[_0xd665('0x22')]=_0x19b06f[_0xd665('0x22')];this[_0xd665('0x23')]=_0x19b06f['recallme'];this['ContactId']=_0x19b06f[_0xd665('0x24')];this[_0xd665('0x25')]=_0x19b06f[_0xd665('0x25')];this[_0xd665('0x26')]=_0x19b06f['UserId'];this[_0xd665('0x27')]=_0x19b06f[_0xd665('0x27')];this['CampaignId']=_0x19b06f[_0xd665('0x28')];this[_0xd665('0x29')]=_0x19b06f['originatecalleridnum']||'';this['originatecalleridname']=_0x19b06f['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xf745=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason'];(function(_0x156a2d,_0x28ea83){var _0x4cf0ed=function(_0x155b78){while(--_0x155b78){_0x156a2d['push'](_0x156a2d['shift']());}};_0x4cf0ed(++_0x28ea83);}(_0xf745,0xf6));var _0x5f74=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf745[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x5f74('0x0'));var _=require(_0x5f74('0x1'));var moment=require(_0x5f74('0x2'));function getSeconds(_0xc72b6d,_0x259692){var _0x1e0fa8=moment(_0xc72b6d)[_0x5f74('0x3')](0x0);var _0x383aa0=moment(_0x259692)[_0x5f74('0x3')](0x0);return _0x1e0fa8[_0x5f74('0x4')](_0x383aa0,'seconds');}function AgentComplete(_0x54f74e,_0x10dd1f){this[_0x5f74('0x5')]=0x4;this[_0x5f74('0x6')]=_0x5f74('0x7');this['scheduledat']=_0x54f74e[_0x5f74('0x8')];this['type']=_0x54f74e[_0x5f74('0x9')];this[_0x5f74('0xa')]=_0x54f74e[_0x5f74('0x9')]===_0x5f74('0xb')?_0x5f74('0xc'):_0x54f74e[_0x5f74('0x9')];this[_0x5f74('0xd')]=_0x54f74e[_0x5f74('0xd')];this[_0x5f74('0xe')]=_0x54f74e['countcongestionretry'];this[_0x5f74('0xf')]=_0x54f74e[_0x5f74('0xf')];this[_0x5f74('0x10')]=_0x54f74e[_0x5f74('0xd')]+_0x54f74e[_0x5f74('0xe')]+_0x54f74e['countnoanswerretry']+_0x54f74e[_0x5f74('0x11')]+_0x54f74e['countdropretry']+_0x54f74e[_0x5f74('0x12')]+_0x54f74e[_0x5f74('0x13')]+_0x54f74e[_0x5f74('0x14')];this['countnosuchnumberretry']=_0x54f74e[_0x5f74('0x11')];this['countdropretry']=_0x54f74e['countdropretry'];this[_0x5f74('0x12')]=_0x54f74e[_0x5f74('0x12')];this[_0x5f74('0x13')]=_0x54f74e[_0x5f74('0x13')];this['countagentrejectretry']=_0x54f74e[_0x5f74('0x14')];this[_0x5f74('0x15')]=_0x10dd1f['uniqueid'];this[_0x5f74('0x16')]=_0x54f74e[_0x5f74('0x17')];this[_0x5f74('0x18')]=_0x54f74e['number'];this[_0x5f74('0x19')]=_0x54f74e[_0x5f74('0x19')];this[_0x5f74('0x1a')]=_0x54f74e[_0x5f74('0x1a')];this['answertime']=_0x54f74e[_0x5f74('0x1b')];this['endtime']=moment()[_0x5f74('0x1c')](_0x5f74('0x1d'));this[_0x5f74('0x1e')]=getSeconds(_0x54f74e[_0x5f74('0x1a')],_0x54f74e[_0x5f74('0x19')]);this[_0x5f74('0x1f')]=getSeconds(_0x54f74e[_0x5f74('0x1b')],_0x54f74e[_0x5f74('0x1a')]);this[_0x5f74('0x20')]=getSeconds(this[_0x5f74('0x21')],_0x54f74e[_0x5f74('0x1b')]);this[_0x5f74('0xc')]=_0x10dd1f['queue'];this[_0x5f74('0x22')]=_0x10dd1f[_0x5f74('0x22')];this[_0x5f74('0x23')]=_0x10dd1f[_0x5f74('0x23')];this[_0x5f74('0x24')]=_0x54f74e[_0x5f74('0x24')];this['callbackuniqueid']=_0x54f74e['callbackuniqueid'];this[_0x5f74('0x25')]=_0x54f74e['callbackat'];this['recallme']=_0x54f74e[_0x5f74('0x26')];this[_0x5f74('0x27')]=_0x54f74e[_0x5f74('0x27')];this['ListId']=_0x54f74e[_0x5f74('0x28')];this[_0x5f74('0x29')]=_0x54f74e[_0x5f74('0x29')];this[_0x5f74('0x2a')]=_0x54f74e[_0x5f74('0x2a')];this[_0x5f74('0x2b')]=_0x54f74e[_0x5f74('0x2b')];this['originatecalleridnum']=_0x54f74e[_0x5f74('0x2c')]||'';this[_0x5f74('0x2d')]=_0x54f74e[_0x5f74('0x2d')]||'';}module[_0x5f74('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 3e59b82..adb8c0e 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 _0xbd96=['UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x40b4da,_0x4765f4){var _0x1c72b8=function(_0x13368a){while(--_0x13368a){_0x40b4da['push'](_0x40b4da['shift']());}};_0x1c72b8(++_0x4765f4);}(_0xbd96,0x152));var _0x6bd9=function(_0x23f98f,_0xcf4c1c){_0x23f98f=_0x23f98f-0x0;var _0x3b4758=_0xbd96[_0x23f98f];return _0x3b4758;};'use strict';var util=require(_0x6bd9('0x0'));var _=require(_0x6bd9('0x1'));var moment=require('moment');function getSeconds(_0x246e5a,_0x3bc5ea){var _0x4adb0c=moment(_0x246e5a)['milliseconds'](0x0);var _0x4869a4=moment(_0x3bc5ea)[_0x6bd9('0x2')](0x0);return _0x4adb0c[_0x6bd9('0x3')](_0x4869a4,_0x6bd9('0x4'));}function Final(_0x5e4856){this[_0x6bd9('0x5')]=_0x5e4856[_0x6bd9('0x5')];this[_0x6bd9('0x6')]=_0x5e4856[_0x6bd9('0x6')];this[_0x6bd9('0x7')]=_0x5e4856['type'];this[_0x6bd9('0x8')]=_0x5e4856[_0x6bd9('0x7')]==='outbound'?_0x6bd9('0x9'):_0x5e4856[_0x6bd9('0x7')];this[_0x6bd9('0xa')]=_0x5e4856[_0x6bd9('0xa')];this[_0x6bd9('0xb')]=_0x5e4856[_0x6bd9('0xb')];this[_0x6bd9('0xc')]=_0x5e4856['countnoanswerretry'];this[_0x6bd9('0xd')]=_0x5e4856['countbusyretry']+_0x5e4856[_0x6bd9('0xb')]+_0x5e4856['countnoanswerretry']+_0x5e4856[_0x6bd9('0xe')]+_0x5e4856[_0x6bd9('0xf')]+_0x5e4856[_0x6bd9('0x10')]+_0x5e4856[_0x6bd9('0x11')]+_0x5e4856[_0x6bd9('0x12')];this['countnosuchnumberretry']=_0x5e4856['countnosuchnumberretry'];this['countdropretry']=_0x5e4856[_0x6bd9('0xf')];this[_0x6bd9('0x10')]=_0x5e4856[_0x6bd9('0x10')];this[_0x6bd9('0x11')]=_0x5e4856[_0x6bd9('0x11')];this[_0x6bd9('0x12')]=_0x5e4856[_0x6bd9('0x12')];this[_0x6bd9('0x9')]=_0x5e4856[_0x6bd9('0x9')];this[_0x6bd9('0x13')]=_0x5e4856[_0x6bd9('0x13')];this['calleridnum']=_0x5e4856[_0x6bd9('0x14')];this['starttime']=_0x5e4856['starttime'];this[_0x6bd9('0x15')]=_0x5e4856['responsetime'];this[_0x6bd9('0x16')]=_0x5e4856[_0x6bd9('0x15')];this['ringtime']=_0x5e4856[_0x6bd9('0x17')]||0x0;this[_0x6bd9('0x18')]=_0x5e4856[_0x6bd9('0x18')]||0x0;this['talktime']=_0x5e4856[_0x6bd9('0x19')]||0x0;this[_0x6bd9('0x1a')]=_0x5e4856[_0x6bd9('0x1a')];this[_0x6bd9('0x1b')]=_0x5e4856[_0x6bd9('0x1b')];this[_0x6bd9('0x1c')]=_0x5e4856[_0x6bd9('0x1c')];this[_0x6bd9('0x1d')]=_0x5e4856[_0x6bd9('0x1d')];this[_0x6bd9('0x1e')]=_0x5e4856['ContactId'];this['ListId']=_0x5e4856[_0x6bd9('0x1f')];this[_0x6bd9('0x20')]=_0x5e4856['UserId'];this[_0x6bd9('0x21')]=_0x5e4856[_0x6bd9('0x21')];this[_0x6bd9('0x22')]=_0x5e4856['CampaignId'];this['originatecalleridnum']=_0x5e4856['originatecalleridnum']||'';this[_0x6bd9('0x23')]=_0x5e4856[_0x6bd9('0x23')]||'';}module[_0x6bd9('0x24')]=Final; \ No newline at end of file +var _0x4cce=['countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4cb9d5,_0x187d5a){var _0x444523=function(_0x46497c){while(--_0x46497c){_0x4cb9d5['push'](_0x4cb9d5['shift']());}};_0x444523(++_0x187d5a);}(_0x4cce,0x16e));var _0xe4cc=function(_0x2ff2b8,_0x35a036){_0x2ff2b8=_0x2ff2b8-0x0;var _0x3d0b7e=_0x4cce[_0x2ff2b8];return _0x3d0b7e;};'use strict';var util=require(_0xe4cc('0x0'));var _=require(_0xe4cc('0x1'));var moment=require(_0xe4cc('0x2'));function getSeconds(_0x108f11,_0x2917d3){var _0x50c431=moment(_0x108f11)[_0xe4cc('0x3')](0x0);var _0x5c6364=moment(_0x2917d3)[_0xe4cc('0x3')](0x0);return _0x50c431[_0xe4cc('0x4')](_0x5c6364,_0xe4cc('0x5'));}function Final(_0x1ad8d2){this[_0xe4cc('0x6')]=_0x1ad8d2[_0xe4cc('0x6')];this[_0xe4cc('0x7')]=_0x1ad8d2[_0xe4cc('0x7')];this[_0xe4cc('0x8')]=_0x1ad8d2['type'];this[_0xe4cc('0x9')]=_0x1ad8d2[_0xe4cc('0x8')]===_0xe4cc('0xa')?'queue':_0x1ad8d2[_0xe4cc('0x8')];this[_0xe4cc('0xb')]=_0x1ad8d2[_0xe4cc('0xb')];this[_0xe4cc('0xc')]=_0x1ad8d2[_0xe4cc('0xc')];this[_0xe4cc('0xd')]=_0x1ad8d2[_0xe4cc('0xd')];this[_0xe4cc('0xe')]=_0x1ad8d2[_0xe4cc('0xb')]+_0x1ad8d2[_0xe4cc('0xc')]+_0x1ad8d2[_0xe4cc('0xd')]+_0x1ad8d2[_0xe4cc('0xf')]+_0x1ad8d2[_0xe4cc('0x10')]+_0x1ad8d2['countabandonedretry']+_0x1ad8d2[_0xe4cc('0x11')]+_0x1ad8d2[_0xe4cc('0x12')];this['countnosuchnumberretry']=_0x1ad8d2[_0xe4cc('0xf')];this[_0xe4cc('0x10')]=_0x1ad8d2[_0xe4cc('0x10')];this[_0xe4cc('0x13')]=_0x1ad8d2[_0xe4cc('0x13')];this[_0xe4cc('0x11')]=_0x1ad8d2[_0xe4cc('0x11')];this[_0xe4cc('0x12')]=_0x1ad8d2['countagentrejectretry'];this[_0xe4cc('0x14')]=_0x1ad8d2[_0xe4cc('0x14')];this[_0xe4cc('0x15')]=_0x1ad8d2[_0xe4cc('0x15')];this[_0xe4cc('0x16')]=_0x1ad8d2[_0xe4cc('0x16')];this[_0xe4cc('0x17')]=_0x1ad8d2['starttime'];this[_0xe4cc('0x18')]=_0x1ad8d2[_0xe4cc('0x18')];this['endtime']=_0x1ad8d2['responsetime'];this[_0xe4cc('0x19')]=_0x1ad8d2[_0xe4cc('0x19')]||0x0;this[_0xe4cc('0x1a')]=_0x1ad8d2['holdtime']||0x0;this[_0xe4cc('0x1b')]=_0x1ad8d2[_0xe4cc('0x1b')]||0x0;this['callback']=_0x1ad8d2[_0xe4cc('0x1c')];this[_0xe4cc('0x1d')]=_0x1ad8d2[_0xe4cc('0x1d')];this[_0xe4cc('0x1e')]=_0x1ad8d2[_0xe4cc('0x1e')];this['recallme']=_0x1ad8d2['recallme'];this[_0xe4cc('0x1f')]=_0x1ad8d2[_0xe4cc('0x1f')];this[_0xe4cc('0x20')]=_0x1ad8d2['ListId'];this['UserId']=_0x1ad8d2[_0xe4cc('0x21')];this['VoiceQueueId']=_0x1ad8d2[_0xe4cc('0x22')];this[_0xe4cc('0x23')]=_0x1ad8d2[_0xe4cc('0x23')];this[_0xe4cc('0x24')]=_0x1ad8d2[_0xe4cc('0x24')]||'';this['originatecalleridname']=_0x1ad8d2[_0xe4cc('0x25')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index da729a3..efbfeae 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 _0x1fe0=['uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','util','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry'];(function(_0x2df23b,_0x447c05){var _0x27bf3e=function(_0x20b32d){while(--_0x20b32d){_0x2df23b['push'](_0x2df23b['shift']());}};_0x27bf3e(++_0x447c05);}(_0x1fe0,0x1a5));var _0x01fe=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x1fe0[_0x565ed7];return _0x183ad7;};'use strict';var util=require(_0x01fe('0x0'));var _=require(_0x01fe('0x1'));var moment=require(_0x01fe('0x2'));function getSeconds(_0x267479,_0xc90fba){var _0x25f28c=moment(_0x267479)[_0x01fe('0x3')](0x0);var _0x26806c=moment(_0xc90fba)[_0x01fe('0x3')](0x0);return _0x25f28c['diff'](_0x26806c,_0x01fe('0x4'));}function Hangup(_0x1ea89a,_0x2a5b83){this[_0x01fe('0x5')]=0x4;this[_0x01fe('0x6')]='Answer';this['scheduledat']=_0x1ea89a[_0x01fe('0x7')];this['type']=_0x1ea89a[_0x01fe('0x8')];this[_0x01fe('0x9')]=_0x1ea89a['type']===_0x01fe('0xa')?_0x01fe('0xb'):_0x1ea89a['type'];this[_0x01fe('0xc')]=_0x1ea89a['countbusyretry'];this[_0x01fe('0xd')]=_0x1ea89a['countcongestionretry'];this[_0x01fe('0xe')]=_0x1ea89a[_0x01fe('0xe')];this['countglobal']=_0x1ea89a[_0x01fe('0xc')]+_0x1ea89a[_0x01fe('0xd')]+_0x1ea89a[_0x01fe('0xe')]+_0x1ea89a[_0x01fe('0xf')]+_0x1ea89a['countdropretry']+_0x1ea89a[_0x01fe('0x10')]+_0x1ea89a[_0x01fe('0x11')]+_0x1ea89a['countagentrejectretry'];this['countnosuchnumberretry']=_0x1ea89a[_0x01fe('0xf')];this[_0x01fe('0x12')]=_0x1ea89a[_0x01fe('0x12')];this[_0x01fe('0x10')]=_0x1ea89a[_0x01fe('0x10')];this[_0x01fe('0x11')]=_0x1ea89a[_0x01fe('0x11')];this['countagentrejectretry']=_0x1ea89a['countagentrejectretry'];this[_0x01fe('0x13')]=_0x2a5b83[_0x01fe('0x13')];this[_0x01fe('0x14')]=_0x1ea89a[_0x01fe('0x15')];this['calleridnum']=_0x1ea89a[_0x01fe('0x16')];this[_0x01fe('0x17')]=_0x1ea89a[_0x01fe('0x17')];this[_0x01fe('0x18')]=_0x1ea89a['responsetime'];this[_0x01fe('0x19')]=moment()[_0x01fe('0x1a')](_0x01fe('0x1b'));this['ringtime']=getSeconds(_0x1ea89a['responsetime'],_0x1ea89a[_0x01fe('0x17')]);this['holdtime']=0x0;this[_0x01fe('0x1c')]=getSeconds(this['endtime'],_0x1ea89a[_0x01fe('0x18')]);this[_0x01fe('0xb')]=_0x1ea89a['queue'];this[_0x01fe('0x1d')]=_0x01fe('0x1e');this[_0x01fe('0x1f')]=_0x2a5b83[_0x01fe('0x20')];this['callback']=_0x1ea89a['callback'];this[_0x01fe('0x21')]=_0x1ea89a[_0x01fe('0x21')];this['callbackat']=_0x1ea89a[_0x01fe('0x22')];this['recallme']=_0x1ea89a[_0x01fe('0x23')];this[_0x01fe('0x24')]=_0x1ea89a[_0x01fe('0x24')];this[_0x01fe('0x25')]=_0x1ea89a['ListId'];this['UserId']=_0x1ea89a[_0x01fe('0x26')];this['VoiceQueueId']=_0x1ea89a['VoiceQueueId'];this[_0x01fe('0x27')]=_0x1ea89a['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x1055=['callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','cause-txt','callback'];(function(_0x5b55ae,_0x1fe5d4){var _0x247129=function(_0x1ea3d9){while(--_0x1ea3d9){_0x5b55ae['push'](_0x5b55ae['shift']());}};_0x247129(++_0x1fe5d4);}(_0x1055,0xe4));var _0x5105=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x1055[_0x3cb6dc];return _0x47ec89;};'use strict';var util=require(_0x5105('0x0'));var _=require('lodash');var moment=require(_0x5105('0x1'));function getSeconds(_0x340357,_0x210361){var _0x4da78f=moment(_0x340357)[_0x5105('0x2')](0x0);var _0x4b20bc=moment(_0x210361)[_0x5105('0x2')](0x0);return _0x4da78f[_0x5105('0x3')](_0x4b20bc,_0x5105('0x4'));}function Hangup(_0x113c95,_0x4541a0){this[_0x5105('0x5')]=0x4;this[_0x5105('0x6')]=_0x5105('0x7');this[_0x5105('0x8')]=_0x113c95[_0x5105('0x8')];this[_0x5105('0x9')]=_0x113c95['type'];this[_0x5105('0xa')]=_0x113c95['type']===_0x5105('0xb')?_0x5105('0xc'):_0x113c95[_0x5105('0x9')];this[_0x5105('0xd')]=_0x113c95[_0x5105('0xd')];this[_0x5105('0xe')]=_0x113c95[_0x5105('0xe')];this[_0x5105('0xf')]=_0x113c95[_0x5105('0xf')];this[_0x5105('0x10')]=_0x113c95[_0x5105('0xd')]+_0x113c95[_0x5105('0xe')]+_0x113c95[_0x5105('0xf')]+_0x113c95[_0x5105('0x11')]+_0x113c95['countdropretry']+_0x113c95['countabandonedretry']+_0x113c95[_0x5105('0x12')]+_0x113c95[_0x5105('0x13')];this[_0x5105('0x11')]=_0x113c95['countnosuchnumberretry'];this[_0x5105('0x14')]=_0x113c95[_0x5105('0x14')];this[_0x5105('0x15')]=_0x113c95[_0x5105('0x15')];this[_0x5105('0x12')]=_0x113c95[_0x5105('0x12')];this['countagentrejectretry']=_0x113c95['countagentrejectretry'];this['uniqueid']=_0x4541a0[_0x5105('0x16')];this['calleridname']=_0x113c95[_0x5105('0x17')];this[_0x5105('0x18')]=_0x113c95[_0x5105('0x19')];this[_0x5105('0x1a')]=_0x113c95[_0x5105('0x1a')];this[_0x5105('0x1b')]=_0x113c95['responsetime'];this[_0x5105('0x1c')]=moment()[_0x5105('0x1d')](_0x5105('0x1e'));this['ringtime']=getSeconds(_0x113c95[_0x5105('0x1b')],_0x113c95[_0x5105('0x1a')]);this[_0x5105('0x1f')]=0x0;this['talktime']=getSeconds(this[_0x5105('0x1c')],_0x113c95[_0x5105('0x1b')]);this[_0x5105('0xc')]=_0x113c95['queue'];this[_0x5105('0x20')]='IVR';this[_0x5105('0x21')]=_0x4541a0[_0x5105('0x22')];this[_0x5105('0x23')]=_0x113c95['callback'];this['callbackuniqueid']=_0x113c95[_0x5105('0x24')];this['callbackat']=_0x113c95[_0x5105('0x25')];this[_0x5105('0x26')]=_0x113c95[_0x5105('0x26')];this[_0x5105('0x27')]=_0x113c95[_0x5105('0x27')];this[_0x5105('0x28')]=_0x113c95['ListId'];this['UserId']=_0x113c95['UserId'];this[_0x5105('0x29')]=_0x113c95[_0x5105('0x29')];this[_0x5105('0x2a')]=_0x113c95[_0x5105('0x2a')];}module[_0x5105('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index a7b2e07..6b00ceb 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 _0x0a34=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','number'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0a34,0x12a));var _0x40a3=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x0a34[_0x50a0c2];return _0x5ebadd;};'use strict';var util=require(_0x40a3('0x0'));var _=require(_0x40a3('0x1'));var moment=require('moment');function getSeconds(_0x33897b,_0x37ccb2){var _0x1649d9=moment(_0x33897b)['milliseconds'](0x0);var _0x13fe1b=moment(_0x37ccb2)[_0x40a3('0x2')](0x0);return _0x1649d9[_0x40a3('0x3')](_0x13fe1b,'seconds');}function History(_0x347dbf){this[_0x40a3('0x4')]=_0x347dbf[_0x40a3('0x4')];this[_0x40a3('0x5')]=_0x347dbf[_0x40a3('0x5')]||undefined;this[_0x40a3('0x6')]=_0x347dbf['type'];this[_0x40a3('0x7')]=_0x347dbf[_0x40a3('0x6')]===_0x40a3('0x8')?_0x40a3('0x9'):_0x347dbf[_0x40a3('0x6')];this[_0x40a3('0xa')]=_0x347dbf['countbusyretry'];this[_0x40a3('0xb')]=_0x347dbf[_0x40a3('0xb')];this[_0x40a3('0xc')]=_0x347dbf['countnoanswerretry'];this[_0x40a3('0xd')]=_0x347dbf[_0x40a3('0xa')]+_0x347dbf['countcongestionretry']+_0x347dbf[_0x40a3('0xc')]+_0x347dbf[_0x40a3('0xe')]+_0x347dbf['countdropretry']+_0x347dbf[_0x40a3('0xf')]+_0x347dbf[_0x40a3('0x10')]+_0x347dbf['countagentrejectretry'];this[_0x40a3('0xe')]=_0x347dbf[_0x40a3('0xe')];this[_0x40a3('0x11')]=_0x347dbf[_0x40a3('0x11')];this['countabandonedretry']=_0x347dbf['countabandonedretry'];this['countmachineretry']=_0x347dbf[_0x40a3('0x10')];this[_0x40a3('0x12')]=_0x347dbf[_0x40a3('0x12')];this['queue']=_0x347dbf[_0x40a3('0x9')];this[_0x40a3('0x13')]=_0x347dbf['name'];this[_0x40a3('0x14')]=_0x347dbf[_0x40a3('0x15')];this[_0x40a3('0x16')]=_0x347dbf[_0x40a3('0x16')];this[_0x40a3('0x17')]=_0x347dbf['responsetime'];this[_0x40a3('0x18')]=_0x347dbf[_0x40a3('0x17')];this[_0x40a3('0x19')]=getSeconds(_0x347dbf[_0x40a3('0x17')],_0x347dbf[_0x40a3('0x16')]);this[_0x40a3('0x1a')]=0x0;this[_0x40a3('0x1b')]=0x0;this[_0x40a3('0x1c')]=_0x347dbf[_0x40a3('0x1c')];this[_0x40a3('0x1d')]=_0x347dbf[_0x40a3('0x1d')];this[_0x40a3('0x1e')]=_0x347dbf[_0x40a3('0x1e')];this[_0x40a3('0x1f')]=_0x347dbf[_0x40a3('0x1f')];this[_0x40a3('0x20')]=_0x347dbf['ContactId'];this[_0x40a3('0x21')]=_0x347dbf[_0x40a3('0x21')];this[_0x40a3('0x22')]=_0x347dbf[_0x40a3('0x22')];this[_0x40a3('0x23')]=_0x347dbf[_0x40a3('0x23')];this['CampaignId']=_0x347dbf[_0x40a3('0x24')];this['originatecalleridnum']=_0x347dbf[_0x40a3('0x25')]||'';this[_0x40a3('0x26')]=_0x347dbf['originatecalleridname']||'';}module[_0x40a3('0x27')]=History; \ No newline at end of file +var _0x0eec=['uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff'];(function(_0x3259eb,_0x297dad){var _0x100d07=function(_0x56bce1){while(--_0x56bce1){_0x3259eb['push'](_0x3259eb['shift']());}};_0x100d07(++_0x297dad);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xc0ee('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x30bcf3,_0x1eb788){var _0x460e72=moment(_0x30bcf3)[_0xc0ee('0x1')](0x0);var _0xf8033b=moment(_0x1eb788)[_0xc0ee('0x1')](0x0);return _0x460e72[_0xc0ee('0x2')](_0xf8033b,'seconds');}function History(_0x10ab80){this['uniqueid']=_0x10ab80[_0xc0ee('0x3')];this[_0xc0ee('0x4')]=_0x10ab80[_0xc0ee('0x4')]||undefined;this[_0xc0ee('0x5')]=_0x10ab80[_0xc0ee('0x5')];this[_0xc0ee('0x6')]=_0x10ab80[_0xc0ee('0x5')]==='outbound'?_0xc0ee('0x7'):_0x10ab80[_0xc0ee('0x5')];this[_0xc0ee('0x8')]=_0x10ab80[_0xc0ee('0x8')];this[_0xc0ee('0x9')]=_0x10ab80[_0xc0ee('0x9')];this[_0xc0ee('0xa')]=_0x10ab80['countnoanswerretry'];this[_0xc0ee('0xb')]=_0x10ab80[_0xc0ee('0x8')]+_0x10ab80[_0xc0ee('0x9')]+_0x10ab80[_0xc0ee('0xa')]+_0x10ab80[_0xc0ee('0xc')]+_0x10ab80[_0xc0ee('0xd')]+_0x10ab80[_0xc0ee('0xe')]+_0x10ab80[_0xc0ee('0xf')]+_0x10ab80[_0xc0ee('0x10')];this['countnosuchnumberretry']=_0x10ab80['countnosuchnumberretry'];this[_0xc0ee('0xd')]=_0x10ab80[_0xc0ee('0xd')];this[_0xc0ee('0xe')]=_0x10ab80['countabandonedretry'];this[_0xc0ee('0xf')]=_0x10ab80[_0xc0ee('0xf')];this[_0xc0ee('0x10')]=_0x10ab80['countagentrejectretry'];this['queue']=_0x10ab80[_0xc0ee('0x7')];this['calleridname']=_0x10ab80[_0xc0ee('0x11')];this[_0xc0ee('0x12')]=_0x10ab80[_0xc0ee('0x13')];this['starttime']=_0x10ab80['starttime'];this[_0xc0ee('0x14')]=_0x10ab80[_0xc0ee('0x14')];this[_0xc0ee('0x15')]=_0x10ab80['responsetime'];this[_0xc0ee('0x16')]=getSeconds(_0x10ab80[_0xc0ee('0x14')],_0x10ab80['starttime']);this['holdtime']=0x0;this[_0xc0ee('0x17')]=0x0;this[_0xc0ee('0x18')]=_0x10ab80['callback'];this[_0xc0ee('0x19')]=_0x10ab80[_0xc0ee('0x19')];this[_0xc0ee('0x1a')]=_0x10ab80['callbackat'];this['recallme']=_0x10ab80['recallme'];this[_0xc0ee('0x1b')]=_0x10ab80[_0xc0ee('0x1b')];this['ListId']=_0x10ab80[_0xc0ee('0x1c')];this[_0xc0ee('0x1d')]=_0x10ab80[_0xc0ee('0x1d')];this[_0xc0ee('0x1e')]=_0x10ab80[_0xc0ee('0x1e')];this[_0xc0ee('0x1f')]=_0x10ab80[_0xc0ee('0x1f')];this[_0xc0ee('0x20')]=_0x10ab80[_0xc0ee('0x20')]||'';this[_0xc0ee('0x21')]=_0x10ab80[_0xc0ee('0x21')]||'';}module[_0xc0ee('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5a3f888..e31b793 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 _0xc56b=['iftime\x20%s,%s','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','launchHandleIvr','handleIvr','loggedIn','dialGlobalInterval','dialTimezone','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','match','object','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','predictiveIntervalErlangCallsDroppedCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[handlePredictive][limitChannel]','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','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','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','string','\x22%s\x22\x20<%s>','inspect','error','stack','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[actions]','isNil','Action','status','channel','catch','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countglobal','amd','countnoanswerretry','dialGlobalMaxRetry','stateGlobal','CampaignId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','Unknow','syncAgentComplete','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','queueBooked','push','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','command','timezones','content','indexOf','true'];(function(_0x3cdbec,_0x45eba3){var _0x1894a3=function(_0x613575){while(--_0x613575){_0x3cdbec['push'](_0x3cdbec['shift']());}};_0x1894a3(++_0x45eba3);}(_0xc56b,0xd0));var _0xbc56=function(_0x14e8b8,_0x2f7af7){_0x14e8b8=_0x14e8b8-0x0;var _0x2e136b=_0xc56b[_0x14e8b8];return _0x2e136b;};'use strict';var util=require('util');var _=require(_0xbc56('0x0'));var BPromise=require(_0xbc56('0x1'));var uuid=require(_0xbc56('0x2'));var moment=require(_0xbc56('0x3'));var rr=require('rr');var md5=require(_0xbc56('0x4'));var Redis=require(_0xbc56('0x5'));var ut=require('../preview/util/util');var config=require(_0xbc56('0x6'));var logger=require(_0xbc56('0x7'))('dialer');var loggerBooked=require(_0xbc56('0x7'))(_0xbc56('0x8'));var loggerPredictive=require('../../../config/logger')(_0xbc56('0x9'));var loggerPredictiveCalls=require(_0xbc56('0x7'))(_0xbc56('0xa'));var loggerSyncQueueSummary=require(_0xbc56('0x7'))(_0xbc56('0xb'));var ami=require(_0xbc56('0xc'));config['redis']=_[_0xbc56('0xd')](config[_0xbc56('0xe')],{'host':_0xbc56('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xbc56('0x10'));var voiceQueueRt=require(_0xbc56('0x11'));var Action=require(_0xbc56('0x12'));var History=require(_0xbc56('0x13'));var Final=require(_0xbc56('0x14'));var AgentComplete=require(_0xbc56('0x15'));var QueueCallerAbandon=require(_0xbc56('0x16'));var Hangup=require(_0xbc56('0x17'));var ipAgi=process[_0xbc56('0x18')][_0xbc56('0x19')]||_0xbc56('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':_0xbc56('0x1b')};var Sequence=function(){};Sequence[_0xbc56('0x1c')][_0xbc56('0x1d')]=function(_0x746270){this[_0xbc56('0x1e')]=this[_0xbc56('0x1e')]?this[_0xbc56('0x1e')][_0xbc56('0x1f')](_0x746270):_0x746270();};function Dialer(_0x412ed9,_0xf69bb3){this[_0xbc56('0x20')]=new Sequence();this[_0xbc56('0x21')]=_0xf69bb3;this[_0xbc56('0x22')]=_0x412ed9[_0xbc56('0x22')];this[_0xbc56('0x23')]=_0x412ed9[_0xbc56('0x23')];this['agents']=_0x412ed9[_0xbc56('0x24')];this['trunks']=_0x412ed9[_0xbc56('0x25')];this[_0xbc56('0x26')]=config[_0xbc56('0x26')]||0x2;this[_0xbc56('0x27')]={};this[_0xbc56('0x28')]={};this[_0xbc56('0x29')]={};this[_0xbc56('0x2a')]={};this['optionPredictive']={};this[_0xbc56('0x2b')]={};this[_0xbc56('0x2c')]={};this[_0xbc56('0x2d')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0xbc56('0x2e')][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x30'),this[_0xbc56('0x31')][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x32'),this[_0xbc56('0x33')][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x34'),this['syncAgentComplete'][_0xbc56('0x2f')](this));ami['on']('custom:queuesummary',this[_0xbc56('0xb')]['bind'](this));ami['on'](_0xbc56('0x35'),this[_0xbc56('0x36')]['bind'](this));ami['on'](_0xbc56('0x37'),this['syncNewExten'][_0xbc56('0x2f')](this));ami['on']('varset',this[_0xbc56('0x38')][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x39'),this['syncQueueMember'][_0xbc56('0x2f')](this));ami['on'](_0xbc56('0x3a'),this[_0xbc56('0x3b')][_0xbc56('0x2f')](this));this[_0xbc56('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0x5963f7){return _0x5963f7!==null&&!_[_0xbc56('0x3d')](_0x5963f7);}function checkIsLoggedIn(_0x33540e,_0x4433e3){return function(){if(_0x4433e3<=0x0){_0x33540e[_0xbc56('0x3e')]=_0xbc56('0x3f');throw _0x33540e[_0xbc56('0x40')]+_0xbc56('0x41');}};}function isActive(_0x5ba377){return _0x5ba377;}function checkIsActive(_0x876ede,_0x43bb71){return function(){if(!isActive(_0x43bb71)){_0x876ede[_0xbc56('0x3e')]='NOT_ACTIVE';throw _0x876ede[_0xbc56('0x40')]+'\x20NOT\x20Active';}};}function checkInterval(_0x39d19f){return function(){if(!isNotNull(_0x39d19f['Interval'])){_0x39d19f[_0xbc56('0x3e')]=_0xbc56('0x42');throw _0x39d19f[_0xbc56('0x40')]+_0xbc56('0x43');}if(!isNotNull(_0x39d19f[_0xbc56('0x44')]['Intervals'])){_0x39d19f[_0xbc56('0x3e')]=_0xbc56('0x42');throw _0x39d19f[_0xbc56('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xbc56('0x45')](_0x39d19f[_0xbc56('0x44')][_0xbc56('0x46')]))){_0x39d19f['message']=_0xbc56('0x42');throw _0x39d19f[_0xbc56('0x40')]+_0xbc56('0x43');}};}function msgResponse(_0x9b0fd1,_0x1a4c89,_0x20ee9c){return{'action':_0x9b0fd1,'response':_0x1a4c89,'message':_0x20ee9c,'stack':_0x20ee9c};}function myreject(_0x22b0fd){return function(_0x1d4af2){return _0x22b0fd(msgResponse(_0xbc56('0x47'),_0xbc56('0x48'),JSON[_0xbc56('0x49')](_0x1d4af2)));};}function getSeconds(_0x173ccc,_0x240f25){var _0x45dadd=moment(_0x173ccc)[_0xbc56('0x4a')](0x0);var _0xff6a3=moment(_0x240f25)[_0xbc56('0x4a')](0x0);return _0x45dadd[_0xbc56('0x4b')](_0xff6a3,_0xbc56('0x4c'));}function emit(_0x131003,_0x30387a,_0x2652e1){io['to'](_0x131003)[_0xbc56('0x4d')](_0x30387a,_0x2652e1);}function emitVoiceQueueSummary(_0x529bd7){if(_0x529bd7['type']===_0xbc56('0x4e')){var _0x6e0601={'id':_0x529bd7['id'],'name':_0x529bd7[_0xbc56('0x40')],'strategy':_0x529bd7[_0xbc56('0x4f')],'answered':_0x529bd7[_0xbc56('0x50')],'available':_0x529bd7[_0xbc56('0x51')],'loggedIn':_0x529bd7['loggedIn'],'pTalking':_0x529bd7[_0xbc56('0x52')],'sumBillable':_0x529bd7['sumBillable'],'sumDuration':_0x529bd7[_0xbc56('0x53')],'sumHoldTime':_0x529bd7[_0xbc56('0x54')]||0x0,'talking':_0x529bd7[_0xbc56('0x55')],'total':_0x529bd7[_0xbc56('0x56')],'type':_0x529bd7[_0xbc56('0x57')],'unmanaged':_0x529bd7[_0xbc56('0x58')],'abandoned':_0x529bd7[_0xbc56('0x59')],'waiting':_0x529bd7[_0xbc56('0x5a')],'loggedInDb':_0x529bd7[_0xbc56('0x5b')],'dialActive':_0x529bd7[_0xbc56('0x5c')],'dialMethod':_0x529bd7[_0xbc56('0x5d')],'dialOriginateCallerIdName':_0x529bd7[_0xbc56('0x5e')],'dialOriginateCallerIdNumber':_0x529bd7[_0xbc56('0x5f')],'dialOriginateTimeout':_0x529bd7[_0xbc56('0x60')],'dialPrefix':_0x529bd7['dialPrefix'],'outboundAnswerAgiCallsDay':_0x529bd7[_0xbc56('0x61')],'outboundAnswerCallsDay':_0x529bd7[_0xbc56('0x62')],'outboundBlacklistCallsDay':_0x529bd7['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x529bd7[_0xbc56('0x63')],'outboundCongestionCallsDay':_0x529bd7[_0xbc56('0x64')],'outboundDropCallsDayACS':_0x529bd7['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x529bd7[_0xbc56('0x65')],'outboundDropCallsDayTimeout':_0x529bd7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x529bd7['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x529bd7[_0xbc56('0x66')],'outboundOriginateFailureCallsDay':_0x529bd7[_0xbc56('0x67')],'outboundReCallsDay':_0x529bd7[_0xbc56('0x68')],'outboundRejectCallsDay':_0x529bd7['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x529bd7[_0xbc56('0x69')],'predictiveIntervalAnsweredCalls':_0x529bd7[_0xbc56('0x6a')],'predictiveIntervalAvgHoldtime':_0x529bd7[_0xbc56('0x6b')],'predictiveIntervalAvgTalktime':_0x529bd7[_0xbc56('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x529bd7[_0xbc56('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x529bd7[_0xbc56('0x6e')],'predictiveIntervalErlangCalls':_0x529bd7[_0xbc56('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x529bd7['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x529bd7[_0xbc56('0x70')],'predictiveIntervalMultiplicativeFactor':_0x529bd7[_0xbc56('0x71')],'predictiveIntervalPauses':_0x529bd7[_0xbc56('0x72')],'predictiveIntervalAvailable':_0x529bd7[_0xbc56('0x73')],'predictiveIntervalTotalCalls':_0x529bd7[_0xbc56('0x74')],'message':_0x529bd7[_0xbc56('0x3e')],'originated':_0x529bd7[_0xbc56('0x75')],'erlangCalls':_0x529bd7[_0xbc56('0x76')],'erlangCallToSecond':_0x529bd7['erlangCallToSecond'],'erlangAbandonmentRate':_0x529bd7[_0xbc56('0x77')],'erlangBusyFactor':_0x529bd7[_0xbc56('0x78')],'startPredictive':_0x529bd7[_0xbc56('0x2b')],'startProgressive':_0x529bd7[_0xbc56('0x2c')]};if(_0x529bd7[_0xbc56('0x79')]){_0x6e0601[_0xbc56('0x79')]={'id':_0x529bd7['Trunk']['id'],'name':_0x529bd7[_0xbc56('0x79')][_0xbc56('0x40')],'active':_0x529bd7['Trunk'][_0xbc56('0x7a')],'callerid':_0x529bd7[_0xbc56('0x79')][_0xbc56('0x7b')]};}if(_0x529bd7['Interval']){_0x6e0601[_0xbc56('0x44')]={'id':_0x529bd7[_0xbc56('0x44')]['id'],'name':_0x529bd7[_0xbc56('0x44')][_0xbc56('0x40')]};}var _0x5928c7=md5(JSON[_0xbc56('0x49')](_0x6e0601));if(_0x529bd7[_0xbc56('0x4')]!==_0x5928c7){_0x529bd7[_0xbc56('0x4')]=_0x5928c7;emit(util[_0xbc56('0x7c')](_0xbc56('0x7d'),_0x6e0601['name']),_0xbc56('0x7e'),_0x6e0601);}}}function emitCampaignSummary(_0xfe2a76){if(_0xfe2a76[_0xbc56('0x57')]===_0xbc56('0x7f')){emit(util[_0xbc56('0x7c')](_0xbc56('0x80'),_0xfe2a76[_0xbc56('0x40')]),_0xbc56('0x81'),_0xfe2a76);}}function checkGetDataPredictive(_0xb0ad04){if(isNotNull(_0xb0ad04)){if(!_[_0xbc56('0x45')](_0xb0ad04)){loggerPredictive[_0xbc56('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xbc56('0x82')](_0xbc56('0x83'),_0xb0ad04[_0xbc56('0x74')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x84'),_0xb0ad04[_0xbc56('0x6a')]);loggerPredictive[_0xbc56('0x82')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb0ad04[_0xbc56('0x6e')]);loggerPredictive['info'](_0xbc56('0x85'),_0xb0ad04[_0xbc56('0x6d')]);loggerPredictive['info'](_0xbc56('0x86'),_0xb0ad04['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x87'),_0xb0ad04[_0xbc56('0x6c')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x88'));if(_0xb0ad04[_0xbc56('0x74')]>0x0){if(!_[_0xbc56('0x3d')](_0xb0ad04['predictiveIntervalAvgTalktime'])&&_0xb0ad04[_0xbc56('0x6c')]>0x0){return!![];}else{loggerPredictive[_0xbc56('0x82')](_0xbc56('0x89'));}if(!_['isUndefined'](_0xb0ad04[_0xbc56('0x6b')])&&_0xb0ad04['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0xbc56('0x82')](_0xbc56('0x8a'));}}else{loggerPredictive['info'](_0xbc56('0x8b'));}}else{loggerPredictive['info'](_0xbc56('0x8c'));}}else{loggerPredictive[_0xbc56('0x82')](_0xbc56('0x8c'));}return![];}function mergeDataErlangB(_0x19135e){return function(_0xfebd62){loggerPredictive[_0xbc56('0x82')](_0xbc56('0x8d'));loggerPredictive['info'](_0xbc56('0x8e'),_0xfebd62[_0xbc56('0x76')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x8f'),_0xfebd62[_0xbc56('0x90')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x91'),_0xfebd62[_0xbc56('0x77')]);loggerPredictive['info'](_0xbc56('0x92'),_0xfebd62[_0xbc56('0x78')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x91'),_0xfebd62[_0xbc56('0x77')]);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x88'));_[_0xbc56('0x93')](_0x19135e,_0xfebd62);};}function getDiff(_0x557ffc){var _0xb138d7=moment()['milliseconds'](0x0);var _0x5865a5=moment(_0x557ffc)[_0xbc56('0x4a')](0x0);return _0xb138d7[_0xbc56('0x4b')](_0x5865a5,'seconds');}function ifInterval(_0x55c5ef,_0x3457b8){if(_[_0xbc56('0x3d')](_0x3457b8)){return![];}if(getDiff(_0x3457b8)<_0x55c5ef*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x129936){if(isNotNull(_0x129936)){if(!_[_0xbc56('0x3d')](_0x129936[_0xbc56('0x2c')])){_0x129936[_0xbc56('0x2c')]=undefined;loggerPredictive[_0xbc56('0x82')](_0x129936['name'],_0xbc56('0x94'));}if(!_['isUndefined'](_0x129936[_0xbc56('0x2b')])){_0x129936[_0xbc56('0x2b')]=undefined;loggerPredictive[_0xbc56('0x82')](_0x129936['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xbc56('0x3d')](_0x129936[_0xbc56('0x95')])){clearInterval(_0x129936[_0xbc56('0x95')]);_0x129936[_0xbc56('0x95')]=undefined;loggerPredictive[_0xbc56('0x82')](_0x129936[_0xbc56('0x40')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x1716c8,_0x2011e9){if(_0x2011e9===0x0){return 0x0;}var _0x4685e5=0x1;for(var _0x5b5fcf=0x1;_0x5b5fcf<=_0x2011e9;_0x5b5fcf+=0x1){_0x4685e5=0x1+_0x4685e5*_0x5b5fcf/_0x1716c8;}return 0x1/_0x4685e5;}function isVoiceQueueOutbound(_0x1027c9){return _0x1027c9===_0xbc56('0x4e');}function isNotPreview(_0x468b27){return _0x468b27!==_0xbc56('0x21');}function isCampaignIvr(_0x35e3d4){return _0x35e3d4===_0xbc56('0x7f');}function getCallerId(_0x13324e,_0x3c70ad,_0x399344){if(!_[_0xbc56('0x3d')](_0x399344)&&_0xbc56('0x96')===typeof _0x399344&&!_['isEmpty'](_0x399344)){if(!_[_0xbc56('0x3d')](_0x3c70ad)&&_0xbc56('0x96')===typeof _0x3c70ad&&!_[_0xbc56('0x45')](_0x3c70ad)){return util[_0xbc56('0x7c')](_0xbc56('0x97'),_0x3c70ad,_0x399344);}return util['format'](_0xbc56('0x97'),_0x399344,_0x399344);}if(!_[_0xbc56('0x3d')](_0x13324e)&&'string'===typeof _0x13324e&&!_[_0xbc56('0x45')](_0x13324e)){return _0x13324e;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x261925,_0x43694f){return function(_0x2d65d4){freeVariablesPredictive(_0x43694f);emitVoiceQueueSummary(_0x43694f);emitCampaignSummary(_0x43694f);loggerSyncQueueSummary['error'](_0x261925,util[_0xbc56('0x98')](_0x2d65d4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3a9a20,_0x540210){return function(_0x32bec5){loggerPredictive[_0xbc56('0x99')](_0x540210[_0xbc56('0x40')],_0x3a9a20);loggerPredictive[_0xbc56('0x99')](_0x32bec5[_0xbc56('0x9a')]);freeVariablesPredictive(_0x540210);};}function loggerCatch(_0x2ae0b8){return function(_0x38c191){logger[_0xbc56('0x99')](_0x2ae0b8,util[_0xbc56('0x98')](_0x38c191,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x154a52){return _0x154a52&&!_['isUndefined'](_0x154a52)&&_0x154a52['length']>0x0;}function decremetOriginate(_0xbc2cc7){if(!_['isUndefined'](_0xbc2cc7)&&_0xbc2cc7!==null){if(_0xbc2cc7[_0xbc56('0x9b')]('originated')){if(_0xbc2cc7['originated']>0x0){_0xbc2cc7[_0xbc56('0x75')]-=0x1;}else{logger[_0xbc56('0x99')](_0xbc56('0x9c'));}}}else{logger[_0xbc56('0x99')](_0xbc56('0x9d'));}}function checkContactLowerLimitOriginate(_0x389353,_0x1ebba1,_0x1a4c38){if(_0x1ebba1>_0x1a4c38){for(var _0x3766d0=0x0;_0x3766d0<_0x1ebba1-_0x1a4c38;_0x3766d0+=0x1){decremetOriginate(_0x389353);}}}function loggerGetContactDialer(_0x3e59ef,_0x3efc10,_0x484322){return function(_0x535ba8){checkContactLowerLimitOriginate(_0x3efc10,_0x484322,0x0);logger[_0xbc56('0x99')](_0x3e59ef,util[_0xbc56('0x98')](_0x535ba8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2c87bb){return function(_0x1422c5){if(isNotNull(_0x1422c5)&&isNotNull(_0x1422c5[0x0])){if(_0x1422c5[0x0][_0xbc56('0x9e')]>0x0){_0x2c87bb[_0xbc56('0x3e')]=_0xbc56('0x9f');logger[_0xbc56('0x82')]('[getContactDialer2][ReScheduled]'+_0x2c87bb['name'],_0x1422c5[0x0][_0xbc56('0x9e')],_0xbc56('0xa0'));}else{_0x2c87bb[_0xbc56('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xbc56('0x82')]('[getContactDialer2][Empty]'+_0x2c87bb[_0xbc56('0x40')]);}}};}function notSendMessagesQueue(_0x52e83b){if(_0x52e83b['sendMessageOneNotActive']){freeVariablesPredictive(_0x52e83b);if(_0x52e83b[_0xbc56('0x75')]===0x0&&_0x52e83b['talking']===0x0&&_0x52e83b['waiting']===0x0&&(_0x52e83b[_0xbc56('0x52')]||0x0)===0x0){_0x52e83b[_0xbc56('0xa1')]=![];_0x52e83b[_0xbc56('0x51')]=0x0;_0x52e83b['message']=_0xbc56('0xa2');loggerSyncQueueSummary[_0xbc56('0x99')](_0xbc56('0xa3'),_0x52e83b['name'],_0xbc56('0xa4'));}else{_0x52e83b['message']=_0xbc56('0xa5');loggerSyncQueueSummary[_0xbc56('0x99')](_0xbc56('0xa3'),_0x52e83b[_0xbc56('0x40')],_0xbc56('0xa6'));}emitVoiceQueueSummary(_0x52e83b);}}function notSendMessagesCampaign(_0x586c49){if(_0x586c49[_0xbc56('0xa1')]){if(_0x586c49['originated']===0x0){_0x586c49['sendMessageOneNotActive']=![];_0x586c49['message']=_0xbc56('0xa2');loggerSyncQueueSummary[_0xbc56('0x99')](_0xbc56('0xa7'),_0x586c49[_0xbc56('0x40')],_0xbc56('0xa4'));}else{_0x586c49[_0xbc56('0x3e')]=_0xbc56('0xa5');loggerSyncQueueSummary[_0xbc56('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x586c49['name'],_0xbc56('0xa6'));}emitCampaignSummary(_0x586c49);}}function createObjHistory(_0x518677,_0x5ba4f6,_0x55bf71,_0x22cdec,_0x619889){_0x518677[_0xbc56('0x3e')]=_0x55bf71;var _0x56f8ac=new Action(_0x518677,_0x5ba4f6);var _0x896914=new History(_0x56f8ac);_0x896914[_0xbc56('0xa8')]=_0x22cdec;_0x896914[_0xbc56('0xa9')]=_0x619889;_0x896914[_0xbc56('0xaa')]=_0x56f8ac[_0xbc56('0xab')];return _0x896914;}Dialer['prototype'][_0xbc56('0xac')]=function(){var _0x315d1f=this;setInterval(function(){_0x315d1f[_0xbc56('0xad')](_0x315d1f[_0xbc56('0x2a')],'[uniqueid]');_0x315d1f[_0xbc56('0xad')](_0x315d1f[_0xbc56('0x28')],_0xbc56('0xae'));},0x32c8);};Dialer[_0xbc56('0x1c')][_0xbc56('0xad')]=function(_0x19cb61,_0x175c52){var _0x513c8c=this;for(var _0x196cb7 in _0x19cb61){if(_0x19cb61[_0xbc56('0x9b')](_0x196cb7)){this[_0xbc56('0x20')][_0xbc56('0x1d')](function(){if(!_[_0xbc56('0xaf')](_0x19cb61[_0x196cb7])){return ami[_0xbc56('0xb0')]({'action':_0xbc56('0xb1'),'channel':_0x19cb61[_0x196cb7][_0xbc56('0xb2')]})[_0xbc56('0xb3')](function(_0x398b38){if(_0x398b38[_0xbc56('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x19cb61[_0x196cb7]&&_0x19cb61[_0x196cb7][_0xbc56('0x57')]!==_0xbc56('0x7f')){_0x513c8c['updateOriginated'](_0x513c8c[_0xbc56('0x22')][_0x19cb61[_0x196cb7][_0xbc56('0xb4')]]);logger['error']('[Dialer][checkChannel]',_0x175c52,_0x196cb7,_0x19cb61[_0x196cb7][_0xbc56('0xb4')]);delete _0x19cb61[_0x196cb7];}if(_0x19cb61[_0x196cb7]&&_0x19cb61[_0x196cb7]['type']===_0xbc56('0x7f')){_0x513c8c['updateOriginated'](_0x513c8c[_0xbc56('0x23')][_0x19cb61[_0x196cb7]['queue']]);logger[_0xbc56('0x99')](_0xbc56('0xb5'),_0x175c52,_0x196cb7,_0x19cb61[_0x196cb7][_0xbc56('0xb4')]);delete _0x19cb61[_0x196cb7];}},0x2328);}});}});}}};Dialer[_0xbc56('0x1c')][_0xbc56('0xb6')]=function(_0x869831){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper[_0xbc56('0xb6')](_0x869831))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xb9')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xba')]=function(_0x135e76){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopperBlack['checkIsBlackList'](_0x135e76))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xbb')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xbc')]=function(_0x5f55c5){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopperBlack[_0xbc56('0xbc')](_0x5f55c5))['catch'](loggerCatch(_0xbc56('0xbd')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xbe')]=function(_0x14205e){return BPromise['resolve']()[_0xbc56('0xb8')](cmHopperHistory[_0xbc56('0xbf')](_0x14205e))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc0')));};Dialer['prototype']['rescheduleContact']=function(_0x41a404){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper[_0xbc56('0xc1')](_0x41a404))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc2')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xc3')]=function(_0x3be37e,_0x1e4f9e,_0x590493){return BPromise['resolve']()[_0xbc56('0xb8')](cmHopper[_0xbc56('0xc3')](_0x3be37e,_0x1e4f9e,_0x590493))['catch'](loggerCatch(_0xbc56('0xc4')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xc5')]=function(_0x11a35b,_0x862ce1,_0x24352b,_0x5e90e5){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper['getContactDialer'](_0x11a35b,_0x862ce1,_0x24352b,_0x5e90e5))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc6')));};Dialer['prototype']['getContactDialerIvr']=function(_0x866577,_0x2f2b59,_0x4fec31){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper[_0xbc56('0xc7')](_0x866577,_0x2f2b59,_0x4fec31))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc6')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xc8')]=function(_0x23f4e5){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](voiceQueueRt[_0xbc56('0xc8')](_0x23f4e5))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xc9')));};Dialer[_0xbc56('0x1c')][_0xbc56('0xca')]=function(_0x4de0c7){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopper['moveContactManagedDialer'](_0x4de0c7))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xcb')));};Dialer['prototype'][_0xbc56('0xcc')]=function(_0x4b6830){return BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](cmHopperHistory[_0xbc56('0xcc')](_0x4b6830))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xcd')));};Dialer['prototype'][_0xbc56('0xce')]=function(_0x87465a){if(!_[_0xbc56('0x3d')](_0x87465a)&&_0x87465a!==null){if(_0x87465a[_0xbc56('0x9b')](_0xbc56('0x75'))){if(_0x87465a['originated']>0x0){_0x87465a['originated']-=0x1;}else{logger['error'](_0xbc56('0xcf'));}}}else{logger['error'](_0xbc56('0xd0'));}};Dialer[_0xbc56('0x1c')][_0xbc56('0xd1')]=function(_0x2d6262,_0x371aad){var _0x1ddf60=this;return function(_0x15b0f8){_0x1ddf60['updateOriginated'](_0x371aad);logger[_0xbc56('0x99')](_0x2d6262,util[_0xbc56('0x98')](_0x15b0f8,{'showHidden':![],'depth':null}));};};Dialer[_0xbc56('0x1c')][_0xbc56('0xd2')]=function(_0x1cf9c5,_0x27da2f,_0x3dc238){var _0x2add9a={'state':0x19,'statedesc':_0xbc56('0xd3')};this[_0xbc56('0xce')](_0x27da2f);this[_0xbc56('0xd4')](_[_0xbc56('0x93')](_0x2add9a,_[_0xbc56('0xd5')](_0x3dc238,[_0xbc56('0xd6'),_0xbc56('0xd7'),'UserId','VoiceQueueId','CampaignId'])),'[emptyContact][createHistory]',_0xbc56('0xd8'));logger[_0xbc56('0x99')](_0x1cf9c5);};Dialer['prototype'][_0xbc56('0xd9')]=function(_0x445beb){return _0x445beb===_0xbc56('0xda');};Dialer[_0xbc56('0x1c')][_0xbc56('0xdb')]=function(_0x3122c6){return!_[_0xbc56('0x3d')](_0x3122c6)&&_0x3122c6&&!_[_0xbc56('0x3d')](_0x3122c6[_0xbc56('0x40')])&&!_[_0xbc56('0x3d')](_0x3122c6['active'])&&_0x3122c6['active']&&(this['trunks'][util[_0xbc56('0x7c')](_0xbc56('0xdc'),_0x3122c6[_0xbc56('0x40')])][_0xbc56('0xb1')]===_0xbc56('0xdd')||this[_0xbc56('0x25')][util[_0xbc56('0x7c')](_0xbc56('0xdc'),_0x3122c6['name'])][_0xbc56('0xb1')]===_0xbc56('0xde'));};Dialer[_0xbc56('0x1c')][_0xbc56('0xd4')]=function(_0x184b19,_0x1b8e03,_0x363591){this[_0xbc56('0xcc')](_0x184b19)[_0xbc56('0xb3')](loggerCatch(_0x1b8e03));this['moveContactManagedDialer'](_0x184b19)[_0xbc56('0xb3')](loggerCatch(_0x363591));};Dialer[_0xbc56('0x1c')][_0xbc56('0x38')]=function(_0x2aba1f){var _0x45106c=this[_0xbc56('0x2a')][_0x2aba1f[_0xbc56('0xdf')]];var _0x5f1948;if(!_[_0xbc56('0xaf')](_0x2aba1f)&&!_[_0xbc56('0xaf')](_0x2aba1f['variable'])&&!_['isNil'](_0x2aba1f[_0xbc56('0xe0')][_0xbc56('0xe1')])&&_0x2aba1f[_0xbc56('0xe2')]===_0xbc56('0xe3')&&_0x45106c){if(_0x45106c['type']!==_0xbc56('0x7f')&&this['voiceQueues'][_0x45106c[_0xbc56('0xb4')]]['dialAMDActive']&&_0x2aba1f[_0xbc56('0xe4')]==='HANGUP'){delete this[_0xbc56('0x2a')][_0x2aba1f[_0xbc56('0xdf')]];this[_0xbc56('0xce')](this[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]]);this[_0xbc56('0x22')][_0x45106c['queue']][_0xbc56('0x62')]+=0x1;this[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]][_0xbc56('0x61')]+=0x1;_0x5f1948=new Hangup(_0x45106c,_0x2aba1f);_0x5f1948['state']=0x12;_0x5f1948[_0xbc56('0xa9')]=_0xbc56('0xe5');_0x5f1948[_0xbc56('0xe6')]=_0xbc56('0xe7');this[_0xbc56('0xd4')](_0x5f1948,_0xbc56('0xe8'),_0xbc56('0xe9'));}if(_0x45106c[_0xbc56('0x57')]!==_0xbc56('0x7f')&&this['voiceQueues'][_0x45106c[_0xbc56('0xb4')]][_0xbc56('0xea')]&&_0x2aba1f[_0xbc56('0xe4')]==='MACHINE'){var _0x430bad=this;return new BPromise(function(_0x1945c9,_0x5b11be){delete _0x430bad[_0xbc56('0x2a')][_0x2aba1f[_0xbc56('0xdf')]];_0x430bad['updateOriginated'](_0x430bad[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]]);_0x430bad['voiceQueues'][_0x45106c[_0xbc56('0xb4')]][_0xbc56('0x62')]+=0x1;_0x430bad[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]][_0xbc56('0x61')]+=0x1;var _0x57e2eb=_0x430bad[_0xbc56('0x22')][_0x45106c[_0xbc56('0xb4')]];var _0x582b70=new Hangup(_0x45106c,_0x2aba1f);_0x582b70[_0xbc56('0xa8')]=0x13;_0x582b70[_0xbc56('0xa9')]='Machine';_0x582b70[_0xbc56('0xe6')]=_0xbc56('0xe7');_0x582b70[_0xbc56('0xeb')]+=0x1;_0x582b70['countglobal']+=0x1;_0x582b70['amd']=!![];_0x430bad[_0xbc56('0xcc')](_0x582b70)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xec')));if(_0x582b70[_0xbc56('0xed')]+_0x582b70[_0xbc56('0xee')]+_0x582b70['countnoanswerretry']+_0x582b70[_0xbc56('0xef')]+_0x582b70[_0xbc56('0xf0')]+_0x582b70[_0xbc56('0xf1')]+_0x582b70[_0xbc56('0xeb')]+_0x582b70[_0xbc56('0xf2')]>=_0x57e2eb['dialGlobalMaxRetry']){_0x430bad['stateGlobal'](_0x582b70,_0x1945c9,_0x5b11be,_0xbc56('0xf3'));}else{if(_0x582b70[_0xbc56('0xeb')]>=_0x57e2eb[_0xbc56('0xf4')]){_0x430bad[_0xbc56('0xf5')](_0x582b70,_0x1945c9,_0x5b11be,_0xbc56('0xf6'));}else{_0x430bad[_0xbc56('0xc1')]({'active':![],'countmachineretry':_0x582b70[_0xbc56('0xeb')],'scheduledat':moment()[_0xbc56('0xf7')](_0x57e2eb[_0xbc56('0xf8')],_0xbc56('0xf9'))['format'](_0xbc56('0xfa')),'ContactId':_0x582b70['ContactId'],'ListId':_0x582b70[_0xbc56('0xd7')],'VoiceQueueId':_0x582b70[_0xbc56('0xfb')]||undefined,'CampaignId':_0x582b70['CampaignId']||undefined})['catch'](loggerCatch(_0xbc56('0xfc')));_0x1945c9({'reschedule':0x1});}}});}if(_0x45106c[_0xbc56('0x57')]===_0xbc56('0x7f')&&this[_0xbc56('0x23')][_0x45106c[_0xbc56('0xb4')]]['dialAMDActive']&&_0x2aba1f[_0xbc56('0xe4')]===_0xbc56('0xfd')){delete this[_0xbc56('0x2a')][_0x2aba1f['uniqueid']];this[_0xbc56('0xce')](this['campaigns'][_0x45106c[_0xbc56('0xb4')]]);_0x5f1948=new Hangup(_0x45106c,_0x2aba1f);_0x5f1948[_0xbc56('0xa8')]=0x12;_0x5f1948['statedesc']='HangupInAMD';_0x5f1948[_0xbc56('0xe6')]='AMD';this['saveInDb'](_0x5f1948,_0xbc56('0xfe'),_0xbc56('0xff'));}if(_0x45106c['type']===_0xbc56('0x7f')&&this[_0xbc56('0x23')][_0x45106c[_0xbc56('0xb4')]]['dialAMDActive']&&_0x2aba1f['value']===_0xbc56('0x100')){var _0x430bad=this;return new BPromise(function(_0x56f690,_0x4c1c65){delete _0x430bad[_0xbc56('0x2a')][_0x2aba1f[_0xbc56('0xdf')]];_0x430bad[_0xbc56('0xce')](_0x430bad[_0xbc56('0x23')][_0x45106c['queue']]);_0x430bad[_0xbc56('0x23')][_0x45106c[_0xbc56('0xb4')]]['outboundAnswerCallsDay']+=0x1;_0x430bad[_0xbc56('0x23')][_0x45106c['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x4bd3d8=_0x430bad[_0xbc56('0x23')][_0x45106c[_0xbc56('0xb4')]];var _0x3f1f6c=new Hangup(_0x45106c,_0x2aba1f);_0x3f1f6c[_0xbc56('0xa8')]=0x13;_0x3f1f6c['statedesc']=_0xbc56('0x101');_0x3f1f6c[_0xbc56('0xe6')]=_0xbc56('0xe7');_0x3f1f6c[_0xbc56('0xeb')]+=0x1;_0x3f1f6c[_0xbc56('0x102')]+=0x1;_0x3f1f6c[_0xbc56('0x103')]=!![];_0x430bad[_0xbc56('0xcc')](_0x3f1f6c)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xec')));if(_0x3f1f6c[_0xbc56('0xed')]+_0x3f1f6c['countcongestionretry']+_0x3f1f6c[_0xbc56('0x104')]+_0x3f1f6c[_0xbc56('0xef')]+_0x3f1f6c[_0xbc56('0xf0')]+_0x3f1f6c[_0xbc56('0xf1')]+_0x3f1f6c[_0xbc56('0xeb')]+_0x3f1f6c[_0xbc56('0xf2')]>=_0x4bd3d8[_0xbc56('0x105')]){_0x430bad[_0xbc56('0x106')](_0x3f1f6c,_0x56f690,_0x4c1c65,_0xbc56('0xf3'));}else{if(_0x3f1f6c[_0xbc56('0xeb')]>=_0x4bd3d8[_0xbc56('0xf4')]){_0x430bad[_0xbc56('0xf5')](_0x3f1f6c,_0x56f690,_0x4c1c65,_0xbc56('0xf6'));}else{_0x430bad['rescheduleContact']({'active':![],'countmachineretry':_0x3f1f6c[_0xbc56('0xeb')],'scheduledat':moment()[_0xbc56('0xf7')](_0x4bd3d8[_0xbc56('0xf8')],_0xbc56('0xf9'))[_0xbc56('0x7c')](_0xbc56('0xfa')),'ContactId':_0x3f1f6c['ContactId'],'ListId':_0x3f1f6c[_0xbc56('0xd7')],'VoiceQueueId':_0x3f1f6c[_0xbc56('0xfb')]||undefined,'CampaignId':_0x3f1f6c[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xfc')));_0x56f690({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xbc56('0x36')]=function(_0x53569e){var _0x11eef5=this[_0xbc56('0x2a')][_0x53569e[_0xbc56('0xdf')]];var _0x94fb47=this;var _0x4ec0d0;if(_0x11eef5&&_0x11eef5[_0xbc56('0x57')]===_0xbc56('0x7f')){delete this['uniqueId'][_0x53569e[_0xbc56('0xdf')]];this[_0xbc56('0xce')](this[_0xbc56('0x23')][_0x11eef5['queue']]);this['campaigns'][_0x11eef5[_0xbc56('0xb4')]][_0xbc56('0x108')]+=0x1;_0x4ec0d0=new Hangup(_0x11eef5,_0x53569e);this[_0xbc56('0xcc')](_0x4ec0d0)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x109')));this['moveContactManagedDialer'](_0x4ec0d0)['catch'](loggerCatch(_0xbc56('0x10a')));}if(_0x11eef5&&_0x11eef5[_0xbc56('0x57')]!==_0xbc56('0x7f')&&isNotNull(this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]]['dialQueueProject'])){delete this[_0xbc56('0x2a')][_0x53569e[_0xbc56('0xdf')]];this['updateOriginated'](this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]]);this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]][_0xbc56('0x62')]+=0x1;this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4ec0d0=new Hangup(_0x11eef5,_0x53569e);_0x4ec0d0['state']=0x10;_0x4ec0d0[_0xbc56('0xa9')]=_0xbc56('0x10b');_0x4ec0d0[_0xbc56('0xe6')]='AGI';this['createHistory'](_0x4ec0d0)['catch'](loggerCatch(_0xbc56('0x109')));this[_0xbc56('0xca')](_0x4ec0d0)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x10a')));}if(_0x11eef5&&_0x11eef5[_0xbc56('0x57')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x11eef5[_0xbc56('0xb4')]][_0xbc56('0x10c')])){delete this[_0xbc56('0x2a')][_0x53569e[_0xbc56('0xdf')]];this[_0xbc56('0xce')](this[_0xbc56('0x22')][_0x11eef5[_0xbc56('0xb4')]]);this[_0xbc56('0x22')][_0x11eef5[_0xbc56('0xb4')]][_0xbc56('0x69')]+=0x1;_0x4ec0d0=new Hangup(_0x11eef5,_0x53569e);_0x4ec0d0[_0xbc56('0xa8')]=0xc;_0x4ec0d0[_0xbc56('0xa9')]=_0x53569e['cause-txt'];_0x4ec0d0['membername']=_0xbc56('0x10d');this[_0xbc56('0xcc')](_0x4ec0d0)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x109')));this[_0xbc56('0xca')](_0x4ec0d0)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x10a')));}};Dialer[_0xbc56('0x1c')][_0xbc56('0x10e')]=function(_0x2b168a){var _0x517528=this['uniqueId'][_0x2b168a[_0xbc56('0xdf')]];var _0x3ac891=this;if(this[_0xbc56('0x22')][_0x2b168a[_0xbc56('0xb4')]]){if(_0x517528&&_0x517528['type']!==_0xbc56('0x7f')){delete this[_0xbc56('0x2a')][_0x2b168a[_0xbc56('0xdf')]];this[_0xbc56('0x22')][_0x2b168a[_0xbc56('0xb4')]][_0xbc56('0x62')]+=0x1;var _0x18568c=new AgentComplete(_0x517528,_0x2b168a);if(_0x2b168a[_0xbc56('0x10f')]===_0xbc56('0x110')){_0x18568c['agiafterat']=this[_0xbc56('0x22')][_0x2b168a[_0xbc56('0xb4')]][_0xbc56('0x111')]&&this[_0xbc56('0x22')][_0x2b168a[_0xbc56('0xb4')]][_0xbc56('0x112')]?moment()['format'](_0xbc56('0xfa')):undefined;}this['createHistory'](_0x18568c)['catch'](loggerCatch(_0xbc56('0x113')));this[_0xbc56('0xca')](_0x18568c)[_0xbc56('0xb3')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xbc56('0x1c')][_0xbc56('0x2e')]=function(_0x1e21e5){if(this[_0xbc56('0x22')][_0x1e21e5[_0xbc56('0xb4')]]){if(this['uniqueId'][_0x1e21e5[_0xbc56('0xdf')]]&&this[_0xbc56('0x2a')][_0x1e21e5[_0xbc56('0xdf')]]['type']!==_0xbc56('0x7f')){this['updateOriginated'](this[_0xbc56('0x22')][_0x1e21e5[_0xbc56('0xb4')]]);this[_0xbc56('0x2a')][_0x1e21e5['uniqueid']][_0xbc56('0x114')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));}}};Dialer['prototype'][_0xbc56('0x115')]=function(_0x5d4d71){this[_0xbc56('0xcc')](_0x5d4d71)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x113')));this[_0xbc56('0xca')](_0x5d4d71)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x116')));};Dialer[_0xbc56('0x1c')]['syncQueueCallerAbandon']=function(_0x2785ee){var _0x4e457f=this['uniqueId'][_0x2785ee[_0xbc56('0xdf')]];var _0x464647=this;if(this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]]){if(_0x4e457f&&_0x4e457f[_0xbc56('0x57')]!==_0xbc56('0x7f')){delete this[_0xbc56('0x2a')][_0x2785ee[_0xbc56('0xdf')]];this['updateOriginated'](this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]]);_0x4e457f[_0xbc56('0x117')]=moment()[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4aaa98=new QueueCallerAbandon(_0x4e457f,_0x2785ee);if(getSeconds(_0x4e457f['droptime'],_0x4e457f['responsetime'])>=_0x4e457f[_0xbc56('0x118')]){this['voiceQueues'][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x6e')]+=0x1;this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x119')]+=0x1;this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4aaa98[_0xbc56('0xa8')]=0xa;_0x4aaa98[_0xbc56('0xa9')]='Drop';_0x4aaa98[_0xbc56('0x11a')]=_0xbc56('0x11b');_0x4aaa98[_0xbc56('0x11c')]=this[_0xbc56('0x22')][_0x2785ee['queue']][_0xbc56('0x111')]?moment()[_0xbc56('0x7c')](_0xbc56('0xfa')):undefined;_0x4aaa98['countdropretry']+=0x1;_0x4aaa98[_0xbc56('0x102')]+=0x1;if(_0x4aaa98[_0xbc56('0xf0')]>=this[_0xbc56('0x22')][_0x2785ee['queue']][_0xbc56('0x11d')]){this['queueCallerAbandonCreateState'](_0x4aaa98);}else{this[_0xbc56('0xc1')]({'active':![],'countdropretry':_0x4aaa98[_0xbc56('0xf0')],'scheduledat':moment()[_0xbc56('0xf7')](this['voiceQueues'][_0x2785ee['queue']][_0xbc56('0x11e')],_0xbc56('0xf9'))[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e457f[_0xbc56('0xd6')],'ListId':_0x4e457f[_0xbc56('0xd7')],'VoiceQueueId':_0x4e457f['VoiceQueueId']||undefined,'CampaignId':_0x4e457f[_0xbc56('0x107')]||undefined})['catch'](loggerCatch(_0xbc56('0x11f')));var _0xec25c3=new History(_0x4aaa98);_0xec25c3[_0xbc56('0xa8')]=0xa;_0xec25c3[_0xbc56('0xa9')]=_0xbc56('0x120');_0xec25c3[_0xbc56('0xab')]=moment()[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');_0xec25c3[_0xbc56('0xaa')]=_0xec25c3[_0xbc56('0xab')];_0xec25c3[_0xbc56('0x121')]=_0x4aaa98['calleridname'];_0xec25c3[_0xbc56('0x122')]=_0x4aaa98[_0xbc56('0x122')];this[_0xbc56('0xcc')](_0xec25c3)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x6d')]+=0x1;this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x65')]+=0x1;_0x4aaa98['state']=0xb;_0x4aaa98[_0xbc56('0xa9')]=_0xbc56('0x123');_0x4aaa98[_0xbc56('0x11a')]=_0xbc56('0x124');_0x4aaa98[_0xbc56('0xf1')]+=0x1;_0x4aaa98['countglobal']+=0x1;if(_0x4aaa98['countabandonedretry']>=this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]][_0xbc56('0x125')]){this[_0xbc56('0x115')](_0x4aaa98);}else{this[_0xbc56('0xc1')]({'active':![],'countabandonedretry':_0x4aaa98[_0xbc56('0xf1')],'scheduledat':moment()[_0xbc56('0xf7')](this[_0xbc56('0x22')][_0x2785ee[_0xbc56('0xb4')]]['dialAbandonedRetryFrequency'],_0xbc56('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e457f[_0xbc56('0xd6')],'ListId':_0x4e457f[_0xbc56('0xd7')],'VoiceQueueId':_0x4e457f[_0xbc56('0xfb')]||undefined,'CampaignId':_0x4e457f[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x126')));var _0xec25c3=new History(_0x4aaa98);_0xec25c3[_0xbc56('0xa8')]=0xb;_0xec25c3[_0xbc56('0xa9')]=_0xbc56('0x123');_0xec25c3[_0xbc56('0xab')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));_0xec25c3[_0xbc56('0xaa')]=_0xec25c3[_0xbc56('0xab')];_0xec25c3[_0xbc56('0x121')]=_0x4aaa98[_0xbc56('0x121')];_0xec25c3[_0xbc56('0x122')]=_0x4aaa98[_0xbc56('0x122')];this[_0xbc56('0xcc')](_0xec25c3)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x127')));}}}}};Dialer[_0xbc56('0x1c')]['syncNewExten']=function(_0xc6afc1){if(this[_0xbc56('0x28')][_0xc6afc1['uniqueid']]){this[_0xbc56('0x28')][_0xc6afc1[_0xbc56('0xdf')]][_0xbc56('0xb2')]=_0xc6afc1[_0xbc56('0xb2')];}if(this['uniqueId'][_0xc6afc1[_0xbc56('0xdf')]]){this[_0xbc56('0x2a')][_0xc6afc1[_0xbc56('0xdf')]][_0xbc56('0xb2')]=_0xc6afc1[_0xbc56('0xb2')];}};Dialer[_0xbc56('0x1c')]['syncQueueMember']=function(_0x19dbb2){if(strategy[this['voiceQueues'][this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0xb4')]][_0xbc56('0x4f')]]===_0xbc56('0x1b')){if(this[_0xbc56('0x28')][_0x19dbb2['actionid']]&&_['isNil'](this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0x129')])&&_0x19dbb2[_0xbc56('0xb1')]==='1'&&_0x19dbb2[_0xbc56('0x12a')]==='0'){if(this[_0xbc56('0x24')][_0x19dbb2['stateinterface']]){if(!this[_0xbc56('0x24')][_0x19dbb2[_0xbc56('0x12b')]][_0xbc56('0x129')]){this['agents'][_0x19dbb2['stateinterface']]['locked']=!![];this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0x129')]=!![];this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0x12b')]=_0x19dbb2[_0xbc56('0x12b')];}}}}else if((strategy[this['voiceQueues'][this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]][_0xbc56('0xb4')]]['strategy']]||_0xbc56('0x12c'))===_0xbc56('0x12c')){if(this[_0xbc56('0x28')][_0x19dbb2['actionid']]){if(this[_0xbc56('0x24')][_0x19dbb2[_0xbc56('0x12b')]]){this['actions'][_0x19dbb2[_0xbc56('0x128')]]['stateinterface']=_0x19dbb2['stateinterface'];if(_['isNil'](this['queueBooked'][this['actions'][_0x19dbb2[_0xbc56('0x128')]]['queue']])){this[_0xbc56('0x12d')][this[_0xbc56('0x28')][_0x19dbb2[_0xbc56('0x128')]]['queue']]=[];}this['queueBooked'][this[_0xbc56('0x28')][_0x19dbb2['actionid']][_0xbc56('0xb4')]][_0xbc56('0x12e')](_[_0xbc56('0x93')](_[_0xbc56('0xd5')](this[_0xbc56('0x28')][_0x19dbb2['actionid']],[_0xbc56('0x12f'),'stateinterface']),{'status':_0x19dbb2['status'],'paused':_0x19dbb2[_0xbc56('0x12a')]}));}}}};function unlockQueueStatus(_0x4a8821,_0x3eba1e){setTimeout(function(){if(_['isUndefined'](_0x4a8821['queueStatusComplete'])){loggerBooked[_0xbc56('0x99')](_0xbc56('0x130'),_0x3eba1e);}_0x4a8821['queueStatusComplete']=!![];loggerBooked[_0xbc56('0x82')](_0xbc56('0x131'),_0x3eba1e,JSON[_0xbc56('0x49')](_[_0xbc56('0xd5')](_0x4a8821,[_0xbc56('0x40'),_0xbc56('0x132')])));},0x1f3);}Dialer['prototype'][_0xbc56('0x3b')]=function(_0x52846a){var _0x161245=this;var _0x107e07=_0x161245['voiceQueues'][_0x161245['actions'][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]];if(strategy[this[_0xbc56('0x22')][this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]['strategy']]===_0xbc56('0x1b')){if(this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]&&this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]['stateinterface']){this['preview'][_0xbc56('0x133')](this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0x12f')],this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0x12b')])['catch'](function(_0x21b789){logger['error'](_0xbc56('0x134'),util[_0xbc56('0x98')](_0x21b789,{'showHidden':![],'depth':null}));})[_0xbc56('0x1f')](function(){_0x161245[_0xbc56('0xce')](_0x161245[_0xbc56('0x22')][_0x161245[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]['queue']]);_0x161245[_0xbc56('0x24')][_0x161245[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0x12b')]]['locked']=![];delete _0x161245[_0xbc56('0x28')][_0x52846a['actionid']];unlockQueueStatus(_0x107e07);});}else{this[_0xbc56('0xce')](this[_0xbc56('0x22')][this['actions'][_0x52846a[_0xbc56('0x128')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0xbc56('0x28')][_0x52846a['actionid']]['ContactId'],'ListId':this['actions'][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xd7')],'VoiceQueueId':this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xfb')]||undefined,'CampaignId':this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x135')));delete this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]];unlockQueueStatus(_0x107e07);}}else if((strategy[this[_0xbc56('0x22')][this['actions'][_0x52846a[_0xbc56('0x128')]]['queue']][_0xbc56('0x4f')]]||'rrmemory')===_0xbc56('0x12c')){var _0x1420a7;if(this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]&&!_[_0xbc56('0x45')](this[_0xbc56('0x12d')][this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]])){if(this[_0xbc56('0x136')][_0x161245[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]){this[_0xbc56('0x136')][_0x161245[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]=this[_0xbc56('0x136')][this['actions'][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]?this[_0xbc56('0x136')][this['actions'][_0x52846a[_0xbc56('0x128')]][_0xbc56('0xb4')]]:this[_0xbc56('0x12d')][this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]['queue']]?this['queueBooked'][this[_0xbc56('0x28')][_0x52846a[_0xbc56('0x128')]]['queue']][_0xbc56('0x137')]||0x0:0x0;}this[_0xbc56('0x12d')][this[_0xbc56('0x28')][_0x52846a['actionid']][_0xbc56('0xb4')]][_0xbc56('0x137')]=this[_0xbc56('0x136')][this[_0xbc56('0x28')][_0x52846a['actionid']][_0xbc56('0xb4')]];for(var _0x25a802=0x0;_0x25a802=0x0?!![]:![];})[_0xbc56('0xb3')](myreject(_0x75f8bd)));}}else{_0x2d0ab7[_0xbc56('0x12e')](ami['Action']({'action':_0xbc56('0x150'),'command':util[_0xbc56('0x7c')](_0xbc56('0x155'),_0x4cb286,!_['isUndefined'](config[_0xbc56('0x151')][_0x1571e4])?_0x1571e4:'')})[_0xbc56('0xb8')](function(_0xa04add){return _0xa04add[_0xbc56('0x152')][_0xbc56('0x153')](_0xbc56('0x154'))>=0x0?!![]:![];})[_0xbc56('0xb3')](myreject(_0x75f8bd)));}BPromise['all'](_0x2d0ab7)[_0xbc56('0xb8')](function(_0x175cd6){var _0xc6c64f=_[_0xbc56('0x156')](_0x175cd6);if(_0xc6c64f){return _0x57c737(_0xc6c64f);}else{_0x390ac1[_0xbc56('0x3e')]=_0x3cd5c0?'GLOBAL_INTERVAL_IS_OVERTIME':_0xbc56('0x157');return _0x75f8bd(msgResponse(_0xbc56('0x158'),_0xbc56('0x148'),_0xbc56('0x159')+_0x3cd5c0+'\x20'+_0x433d56+_0xbc56('0x15a')+util[_0xbc56('0x98')](_0x4cb286,{'showHidden':![],'depth':null})+_0xbc56('0x15b')+_0x1571e4));}})[_0xbc56('0xb3')](function(_0x24fa84){return _0x75f8bd(msgResponse(_0xbc56('0x146'),_0xbc56('0x148'),JSON[_0xbc56('0x49')](_0x24fa84)));});});};Dialer[_0xbc56('0x1c')][_0xbc56('0x15c')]=function(_0x5825db){var _0x45e137=this;return function(){switch(_0x5825db['dialMethod']){case _0xbc56('0x15d'):freeVariablesPredictive(_0x5825db);_0x45e137[_0xbc56('0x15e')](_0x5825db,0x1);break;case _0xbc56('0x15f'):freeVariablesPredictive(_0x5825db);_0x45e137['handlePower'](_0x5825db,_0x5825db[_0xbc56('0x160')]);break;case _0xbc56('0x9'):_0x45e137[_0xbc56('0x9')](_0x5825db);break;case _0xbc56('0x8'):freeVariablesPredictive(_0x5825db);_0x45e137[_0xbc56('0x15e')](_0x5825db,0x1);break;default:freeVariablesPredictive(_0x5825db);logger[_0xbc56('0x99')](_0xbc56('0x161'),_0x5825db['name'],'method\x20not\x20recognized');}};};Dialer[_0xbc56('0x1c')][_0xbc56('0x162')]=function(_0x829c1b){var _0x31aeff=this;return function(){_0x31aeff[_0xbc56('0x163')](_0x829c1b);};};Dialer[_0xbc56('0x1c')]['syncQueueSummary']=function(_0x4ae1ab){var _0x4bd8c7=this;if(isNotPreview(_0x4ae1ab[_0xbc56('0x5d')])){if(isVoiceQueueOutbound(_0x4ae1ab['type'])&&isActive(_0x4ae1ab['dialActive'])){_0x4ae1ab['sendMessageOneNotActive']=!![];BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](checkIsLoggedIn(_0x4ae1ab,_0x4ae1ab[_0xbc56('0x164')]))['then'](checkIsActive(_0x4ae1ab,_0x4ae1ab['dialActive']))[_0xbc56('0xb8')](checkInterval(_0x4ae1ab))[_0xbc56('0xb8')](_0x4bd8c7['checkIsTrunkReachable'](_0x4ae1ab))[_0xbc56('0xb8')](_0x4bd8c7[_0xbc56('0x145')](_0x4ae1ab[_0xbc56('0x165')],_0x4ae1ab[_0xbc56('0x166')],_0x4ae1ab[_0xbc56('0x40')],_0x4ae1ab))[_0xbc56('0xb8')](_0x4bd8c7[_0xbc56('0x147')](_0x4ae1ab[_0xbc56('0x44')],_0x4ae1ab[_0xbc56('0x166')],_0x4ae1ab[_0xbc56('0x40')],_0x4ae1ab))[_0xbc56('0xb8')](_0x4bd8c7[_0xbc56('0x15c')](_0x4ae1ab))[_0xbc56('0xb3')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4ae1ab));}else{notSendMessagesQueue(_0x4ae1ab);}}else{freeVariablesPredictive(_0x4ae1ab);}};Dialer[_0xbc56('0x1c')][_0xbc56('0x141')]=function(){var _0x8d958c=this;var _0x3a0d1b;for(var _0x513d94 in this[_0xbc56('0x23')]){if(this[_0xbc56('0x23')][_0xbc56('0x9b')](_0x513d94)){_0x3a0d1b=this[_0xbc56('0x23')][_0x513d94];if(isCampaignIvr(_0x3a0d1b[_0xbc56('0x57')])&&isActive(_0x3a0d1b['active'])){_0x3a0d1b[_0xbc56('0xa1')]=!![];BPromise[_0xbc56('0xb7')]()[_0xbc56('0xb8')](checkIsActive(_0x3a0d1b,_0x3a0d1b['active']))['then'](checkInterval(_0x3a0d1b))['then'](_0x8d958c[_0xbc56('0x167')](_0x3a0d1b))[_0xbc56('0xb8')](_0x8d958c['checkIfTime'](_0x3a0d1b[_0xbc56('0x165')],_0x3a0d1b['dialTimezone'],_0x3a0d1b[_0xbc56('0x40')],_0x3a0d1b))[_0xbc56('0xb8')](_0x8d958c[_0xbc56('0x147')](_0x3a0d1b[_0xbc56('0x44')],_0x3a0d1b['dialTimezone'],_0x3a0d1b[_0xbc56('0x40')],_0x3a0d1b))[_0xbc56('0xb8')](_0x8d958c['launchHandleIvr'](_0x3a0d1b))[_0xbc56('0xb3')](loggerCatchQueueSummary(_0xbc56('0x168'),_0x3a0d1b));}else{notSendMessagesCampaign(_0x3a0d1b);}}}};function getCallerIdRandom(_0x3c4a33,_0xef4cc9){var _0x227828,_0x2a3e8d,_0x26fdf9;if(_0xef4cc9<=0x0){_0xef4cc9=0x1;}_0x227828=new RegExp(_0xbc56('0x169')+_0xef4cc9+'}$');_0x2a3e8d=Math[_0xbc56('0x16a')](0xa,_0xef4cc9-0x1);_0x26fdf9=Math['pow'](0xa,_0xef4cc9)-0x1;return util[_0xbc56('0x7c')]('%s',_[_0xbc56('0x16b')](_0x3c4a33,_0x227828,_['random'](_0x2a3e8d,_0x26fdf9)));}function extractCalleridName(_0xba5a18){var _0x510cd3=_0xba5a18['match'](/"(.*?)"/);return _0x510cd3?_0x510cd3[0x1]:_0xba5a18;}function extractCalleridNumber(_0x520e28){var _0x1b46ee=_0x520e28[_0xbc56('0x16c')](/<(.*?)>/);return _0x1b46ee?_0x1b46ee[0x1]:_0x520e28;}Dialer[_0xbc56('0x1c')]['actionOriginate']=function(_0x57a3fd,_0x43e597){var _0xf446ed=this;var _0x201d6f=uuid['v4']();this[_0xbc56('0x28')][_0x201d6f]=new Action(_0x57a3fd,_0x43e597,_0x201d6f);return new BPromise(function(_0x4c8a39,_0x97f578){if(_[_0xbc56('0x3d')](_0x57a3fd)&&_0xbc56('0x16d')!==typeof _0x57a3fd){return _0x97f578(msgResponse('originate',_0xbc56('0x148'),_0xbc56('0x16e')));}if(_[_0xbc56('0x3d')](_0x43e597['Contact'][_0xbc56('0x16f')])||_0x43e597[_0xbc56('0x170')][_0xbc56('0x16f')]===null){return _0x97f578(msgResponse(_0xbc56('0x171'),'Failure',_0xbc56('0x172')));}var _0x583fd8={'XMD-CALLERID':_0xf446ed[_0xbc56('0x28')][_0x201d6f]['getCaller'](),'XMD-AGI':_0x57a3fd[_0xbc56('0x10c')]?util['format'](_0xbc56('0x173'),ipAgi,_0x57a3fd['dialQueueProject']):_0xbc56('0x174'),'XMD-AGIAFTER':_0x57a3fd[_0xbc56('0x111')]?util[_0xbc56('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x57a3fd['dialQueueProject2']):_0xbc56('0x174'),'XMD-QUEUE':_0x57a3fd['type']===_0xbc56('0x4e')?util['format'](_0xbc56('0x175'),_0x57a3fd[_0xbc56('0x40')],_0x57a3fd[_0xbc56('0x176')]||'',_0x57a3fd[_0xbc56('0x112')]?'c':'',_0x57a3fd[_0xbc56('0x118')]||0x3):_0xbc56('0x174'),'XMD-CONTACTID':_0x43e597['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xf446ed[_0xbc56('0x28')][_0x201d6f][_0xbc56('0x177')](),'XMD-AMD':_0x57a3fd[_0xbc56('0xea')]?_0xbc56('0x178'):'NONE','XMD-DESTINATION':_0xbc56('0xe3')};if(_0x57a3fd[_0xbc56('0xea')]){_0x583fd8[_0xbc56('0x179')]=_0x57a3fd[_0xbc56('0x17a')]||0x9c4;_0x583fd8[_0xbc56('0x17b')]=_0x57a3fd[_0xbc56('0x17c')]||0x5dc;_0x583fd8['XMD-AMDAFTERGREETINGSILENCE']=_0x57a3fd[_0xbc56('0x17d')]||0x320;_0x583fd8[_0xbc56('0x17e')]=_0x57a3fd[_0xbc56('0x17f')]||0x1388;_0x583fd8['XMD-AMDMINWORDLENGTH']=_0x57a3fd['dialAMDMinWordLength']||0x64;_0x583fd8['XMD-AMDBETWEENWORDSSILENCE']=_0x57a3fd[_0xbc56('0x180')]||0x32;_0x583fd8[_0xbc56('0x181')]=_0x57a3fd[_0xbc56('0x182')]||0x3;_0x583fd8[_0xbc56('0x183')]=_0x57a3fd[_0xbc56('0x184')]||0x100;_0x583fd8[_0xbc56('0x185')]=_0x57a3fd[_0xbc56('0x186')]||0x1388;}if(_0x57a3fd[_0xbc56('0x57')]===_0xbc56('0x4e')){_0x583fd8[_0xbc56('0x187')]=_0x43e597[_0xbc56('0xfb')];}else{_0x583fd8[_0xbc56('0x188')]=_0x43e597[_0xbc56('0x107')];}for(var _0x488dfd in _0x43e597[_0xbc56('0x170')]){if(_0x43e597[_0xbc56('0x170')][_0xbc56('0x9b')](_0x488dfd)){if(isNotNull(_0x43e597[_0xbc56('0x170')][_0x488dfd])&&_0x488dfd!=='id'&&_0x488dfd!==_0xbc56('0x189')&&_0x488dfd!=='createdAt'&&_0x488dfd!==_0xbc56('0x18a')){_0x583fd8[util['format'](_0xbc56('0x18b'),_0xbc56('0x18c'),_[_0xbc56('0x18d')](_0x488dfd))]=_0x43e597['Contact'][_0x488dfd];}}}var _0x49717b=_0xf446ed[_0xbc56('0xdb')](_0x57a3fd[_0xbc56('0x79')])?getCallerId(_0x57a3fd[_0xbc56('0x79')][_0xbc56('0x7b')],_0x57a3fd[_0xbc56('0x5e')],_0x57a3fd[_0xbc56('0x18e')]>0x0?getCallerIdRandom(_0x57a3fd[_0xbc56('0x5f')],_0x57a3fd[_0xbc56('0x18e')]):_0x57a3fd[_0xbc56('0x5f')]):getCallerId(_['isNil'](_0x57a3fd[_0xbc56('0x142')])?_0x57a3fd['Trunk'][_0xbc56('0x7b')]:_0x57a3fd[_0xbc56('0x142')][_0xbc56('0x7b')],_0x57a3fd[_0xbc56('0x5e')],_0x57a3fd['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x57a3fd[_0xbc56('0x5f')],_0x57a3fd[_0xbc56('0x18e')]):_0x57a3fd['dialOriginateCallerIdNumber']);if(_0x49717b){_0x583fd8[_0xbc56('0x18f')]=_0xf446ed[_0xbc56('0x28')][_0x201d6f][_0xbc56('0x190')]=extractCalleridName(_0x49717b);_0x583fd8[_0xbc56('0x191')]=_0xf446ed[_0xbc56('0x28')][_0x201d6f][_0xbc56('0x192')]=extractCalleridNumber(_0x49717b);}return ami[_0xbc56('0xb0')]({'actionid':_0x201d6f,'action':'originate','channel':_0xf446ed['isTrunkReachable'](_0x57a3fd[_0xbc56('0x79')])?util[_0xbc56('0x7c')]('SIP/%s/%s%s',_0x57a3fd['Trunk'][_0xbc56('0x40')],isNotNull(_0x57a3fd['dialPrefix'])?_0x57a3fd[_0xbc56('0x193')]['trim']()||'':'',_0x57a3fd[_0xbc56('0x194')]>0x0?_0x43e597[_0xbc56('0x170')][_0xbc56('0x16f')][_0xbc56('0x195')](_0x57a3fd[_0xbc56('0x194')]):_0x43e597[_0xbc56('0x170')]['phone']):util[_0xbc56('0x7c')](_0xbc56('0x196'),_[_0xbc56('0xaf')](_0x57a3fd['TrunkBackup'])?_0x57a3fd['Trunk']['name']:_0x57a3fd[_0xbc56('0x142')][_0xbc56('0x40')],isNotNull(_0x57a3fd['dialPrefix'])?_0x57a3fd[_0xbc56('0x193')][_0xbc56('0x197')]()||'':'',_0x57a3fd[_0xbc56('0x194')]>0x0?_0x43e597[_0xbc56('0x170')]['phone'][_0xbc56('0x195')](_0x57a3fd[_0xbc56('0x194')]):_0x43e597[_0xbc56('0x170')]['phone']),'callerid':_0x49717b,'Exten':_0xbc56('0xe3'),'Context':_0xbc56('0x198'),'Priority':'1','variable':_0x583fd8,'timeout':(_0x57a3fd['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x201d6f})[_0xbc56('0xb8')](function(_0x428144){return _0x4c8a39(_0x428144);})[_0xbc56('0xb3')](function(_0x386f4d){_0x57a3fd[_0xbc56('0x67')]+=0x1;var _0x1b056b=new History(_0xf446ed[_0xbc56('0x28')][_0x201d6f]);logger[_0xbc56('0x99')](util[_0xbc56('0x7c')]('[originateError]:\x20%s',JSON[_0xbc56('0x49')](_0x386f4d)));_0x1b056b['state']=0xe;_0x1b056b[_0xbc56('0xa9')]=_0xbc56('0x199');_0x1b056b[_0xbc56('0xab')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));_0x1b056b['endtime']=_0x1b056b[_0xbc56('0xab')];_0xf446ed[_0xbc56('0xcc')](_0x1b056b)[_0xbc56('0xb3')](loggerCatch('[originate][error]'));_0xf446ed[_0xbc56('0xca')](_0x1b056b)['catch'](loggerCatch(_0xbc56('0x19a')))[_0xbc56('0x1f')](function(){delete _0xf446ed[_0xbc56('0x28')][_0x201d6f];return _0x97f578(msgResponse(_0xbc56('0x171'),_0xbc56('0x48'),_0xbc56('0x19b')));});});});};Dialer['prototype'][_0xbc56('0x33')]=function(_0x5701e6){var _0x50adf4=this[_0xbc56('0x28')][_0x5701e6['actionid']];var _0x418fde=this;if(_0x50adf4){delete this[_0xbc56('0x28')][_0x5701e6[_0xbc56('0x128')]];_0x50adf4['responsetime']=moment()[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x138ab9=_0x50adf4[_0xbc56('0x57')]===_0xbc56('0x7f')?this[_0xbc56('0x23')][_0x50adf4['queue']]:this[_0xbc56('0x22')][_0x50adf4[_0xbc56('0x19c')]()];if(!this[_0xbc56('0xd9')](_0x5701e6[_0xbc56('0x19d')])){this['updateOriginated'](_0x138ab9);return this[_0xbc56('0x19e')](_0x50adf4,_0x138ab9,_0x5701e6)[_0xbc56('0xb8')](function(_0xbb438c){})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x19f')));}else{this['uniqueId'][_0x5701e6[_0xbc56('0xdf')]]=_0x50adf4;}}};Dialer[_0xbc56('0x1c')][_0xbc56('0x1a0')]=function(_0x1b4eb2,_0x1712c7,_0x46d427){var _0x202c91=new History(_0x1712c7);if(_0x202c91[_0xbc56('0xed')]+_0x202c91[_0xbc56('0xee')]+_0x202c91['countnoanswerretry']+_0x202c91[_0xbc56('0xef')]+_0x202c91[_0xbc56('0xf0')]+_0x202c91[_0xbc56('0xf1')]+_0x202c91[_0xbc56('0xeb')]+_0x202c91['countagentrejectretry']>=_0x46d427[_0xbc56('0x105')]-0x1){return!![];}switch(_0x1b4eb2){case 0x3:if(_0x202c91[_0xbc56('0x104')]>=_0x46d427['dialNoAnswerMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x202c91[_0xbc56('0x104')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427[_0xbc56('0x1a1')],_0xbc56('0xf9'))[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x202c91[_0xbc56('0xed')]>=_0x46d427[_0xbc56('0x1a2')]-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countbusyretry':_0x202c91[_0xbc56('0xed')]+=0x1,'scheduledat':moment()['add'](_0x46d427[_0xbc56('0x1a3')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91['ListId'],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1a4')));}break;case 0x8:if(_0x202c91[_0xbc56('0xee')]>=_0x46d427[_0xbc56('0x1a5')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x202c91[_0xbc56('0xee')]+=0x1,'scheduledat':moment()['add'](_0x46d427['dialCongestionRetryFrequency'],'minutes')['format'](_0xbc56('0xfa')),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x202c91[_0xbc56('0xef')]>=_0x46d427['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countnosuchnumberretry':_0x202c91[_0xbc56('0xef')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427[_0xbc56('0x1a6')],_0xbc56('0xf9'))[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1a7')));}break;case 0xa:if(_0x202c91['countdropretry']>=_0x46d427[_0xbc56('0x11d')]-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countdropretry':_0x202c91[_0xbc56('0xf0')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427['dialDropRetryFrequency'],_0xbc56('0xf9'))['format'](_0xbc56('0xfa')),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91['CampaignId']||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x11f')));}break;case 0xb:if(_0x202c91[_0xbc56('0xf1')]>=_0x46d427[_0xbc56('0x125')]-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countabandonedretry':_0x202c91[_0xbc56('0xf1')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427[_0xbc56('0x1a8')],_0xbc56('0xf9'))[_0xbc56('0x7c')](_0xbc56('0xfa')),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})['catch'](loggerCatch(_0xbc56('0x126')));}break;case 0x13:if(_0x202c91[_0xbc56('0xeb')]>=_0x46d427['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countmachineretry':_0x202c91[_0xbc56('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x46d427[_0xbc56('0xf8')],'minutes')[_0xbc56('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x202c91[_0xbc56('0xd6')],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x202c91[_0xbc56('0xf2')]>=_0x46d427[_0xbc56('0x1a9')]-0x1){return!![];}else{this[_0xbc56('0xc1')]({'active':![],'countagentrejectretry':_0x202c91[_0xbc56('0xf2')]+=0x1,'scheduledat':moment()[_0xbc56('0xf7')](_0x46d427[_0xbc56('0x1aa')],_0xbc56('0xf9'))['format'](_0xbc56('0xfa')),'ContactId':_0x202c91['ContactId'],'ListId':_0x202c91[_0xbc56('0xd7')],'VoiceQueueId':_0x202c91[_0xbc56('0xfb')]||undefined,'CampaignId':_0x202c91[_0xbc56('0x107')]||undefined})['catch'](loggerCatch(_0xbc56('0x1ab')));}break;default:return!![];}};Dialer[_0xbc56('0x1c')]['callProgressDetecting']=function(_0x523c71,_0x20c573,_0x358eeb){var _0x16b917=this;var _0x1e45e1=new History(_0x523c71);return new BPromise(function(_0x360dde,_0x1a8710){if(_[_0xbc56('0x3d')](_0x20c573)&&_0xbc56('0x16d')!==typeof _0x20c573){return _0x1a8710(msgResponse(_0xbc56('0x1ac'),_0xbc56('0x148'),_0xbc56('0x1ad')));}if(_['isUndefined'](_0x358eeb)&&_0xbc56('0x16d')!==typeof _0x358eeb){return _0x1a8710(msgResponse(_0xbc56('0x1ac'),_0xbc56('0x148'),_0xbc56('0x1ae')));}switch(_0x358eeb[_0xbc56('0x10f')]){case'0':_0x20c573[_0xbc56('0x66')]+=0x1;_0x1e45e1['state']=0x0;_0x1e45e1[_0xbc56('0xa9')]=_0xbc56('0x1af');_0x1e45e1[_0xbc56('0xef')]+=0x1;_0x1e45e1[_0xbc56('0x102')]+=0x1;ami[_0xbc56('0x4d')](_0xbc56('0x1b0'),ut[_0xbc56('0x1b1')](_0x523c71,_0xbc56('0x1b2')));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x16b917[_0xbc56('0x1a0')](0x0,_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xef')]>=_0x20c573[_0xbc56('0x1b3')]){_0x16b917['createStateFinal'](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x200\x20no\x20such\x20number....');}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x20c573[_0xbc56('0x1b4')]+=0x1;_0x1e45e1['state']=0x3;_0x1e45e1[_0xbc56('0xa9')]=_0xbc56('0x1b5');_0x1e45e1[_0xbc56('0x104')]+=0x1;_0x1e45e1['countglobal']+=0x1;ami[_0xbc56('0x4d')](_0xbc56('0x1b6'),ut[_0xbc56('0x1b1')](_0x523c71,'noanswer'));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1b7')));if(_0x16b917[_0xbc56('0x1a0')](0x3,_0x523c71,_0x20c573)){if(_0x1e45e1['countnoanswerretry']>=_0x20c573[_0xbc56('0x1b8')]){_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1b9'));}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1b9'));}}break;case'5':_0x20c573[_0xbc56('0x63')]+=0x1;_0x1e45e1['state']=0x5;_0x1e45e1[_0xbc56('0xa9')]=_0xbc56('0x1ba');_0x1e45e1[_0xbc56('0xed')]+=0x1;_0x1e45e1[_0xbc56('0x102')]+=0x1;ami['emit'](_0xbc56('0x1bb'),ut[_0xbc56('0x1b1')](_0x523c71,_0xbc56('0x1bc')));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1bd')));if(_0x16b917['checkRetriveMax'](0x5,_0x523c71,_0x20c573)){if(_0x1e45e1['countbusyretry']>=_0x20c573[_0xbc56('0x1a2')]){_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1be'));}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x205\x20busy');}}break;case'8':_0x20c573['outboundCongestionCallsDay']+=0x1;_0x1e45e1[_0xbc56('0xa8')]=0x8;_0x1e45e1['statedesc']='Congestion';_0x1e45e1[_0xbc56('0xee')]+=0x1;_0x1e45e1['countglobal']+=0x1;ami[_0xbc56('0x4d')](_0xbc56('0x1bf'),ut['buildObj'](_0x523c71,_0xbc56('0x1c0')));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1c1')));if(_0x16b917[_0xbc56('0x1a0')](0x8,_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xee')]>=_0x20c573['dialCongestionMaxRetry']){_0x16b917['createStateFinal'](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x208\x20congestion');}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1c2'));}}break;case'11':_0x20c573[_0xbc56('0x1c3')]+=0x1;_0x1e45e1['state']=0xb;_0x1e45e1[_0xbc56('0xa9')]=_0xbc56('0x123');_0x1e45e1[_0xbc56('0xf1')]+=0x1;_0x1e45e1[_0xbc56('0x102')]+=0x1;_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x127')));if(_0x16b917[_0xbc56('0x1a0')](0xb,_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xf1')]>=_0x20c573[_0xbc56('0x125')]){_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1c4'));}else{_0x16b917['stateGlobal'](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x2011\x20abandoned');}}break;case'20':_0x20c573[_0xbc56('0x1c5')]+=0x1;_0x1e45e1['state']=0x14;_0x1e45e1['statedesc']=_0xbc56('0x1c6');_0x1e45e1[_0xbc56('0xf2')]+=0x1;_0x1e45e1[_0xbc56('0x102')]+=0x1;ami[_0xbc56('0x4d')](_0xbc56('0x1c7'),ut[_0xbc56('0x1b1')](_0x523c71,_0xbc56('0x1c8')));_0x16b917[_0xbc56('0xcc')](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1c9')));if(_0x16b917[_0xbc56('0x1a0')](0x14,_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xf2')]>=_0x20c573['dialAgentRejectMaxRetry']){_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0xbc56('0x1ca'));}else{_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,'reason\x2020\x20agentreject');}}break;default:_0x20c573[_0xbc56('0x69')]+=0x1;_0x1e45e1[_0xbc56('0xa8')]=0xc;_0x1e45e1[_0xbc56('0xa9')]=_0x358eeb['reason'];_0x16b917['createHistory'](_0x1e45e1)[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1cb')));if(_0x16b917['checkRetriveMax'](_0x358eeb[_0xbc56('0x10f')],_0x523c71,_0x20c573)){if(_0x1e45e1[_0xbc56('0xed')]+_0x1e45e1[_0xbc56('0xee')]+_0x1e45e1['countnoanswerretry']+_0x1e45e1[_0xbc56('0xef')]+_0x1e45e1['countdropretry']+_0x1e45e1[_0xbc56('0xf1')]+_0x1e45e1[_0xbc56('0xeb')]+_0x1e45e1[_0xbc56('0xf2')]>=_0x20c573[_0xbc56('0x105')]){_0x16b917[_0xbc56('0x106')](_0x1e45e1,_0x360dde,_0x1a8710,_0x358eeb[_0xbc56('0x10f')]);}else{_0x16b917[_0xbc56('0xf5')](_0x1e45e1,_0x360dde,_0x1a8710,_0x358eeb[_0xbc56('0x10f')]);}}}});};Dialer[_0xbc56('0x1c')][_0xbc56('0x106')]=function(_0xb8f612,_0x3b5540,_0x5bb9b4,_0x2001fb){var _0x1f5038=new Final(_0xb8f612);_0x1f5038[_0xbc56('0xa8')]=0xf;_0x1f5038['statedesc']=_0xbc56('0x1cc');this['createStateFinal'](_0x1f5038,_0x3b5540,_0x5bb9b4,_0x2001fb);};Dialer[_0xbc56('0x1c')][_0xbc56('0xf5')]=function(_0x1317a3,_0x1b69f5,_0x4257b0,_0x5ac784){this[_0xbc56('0xca')](_0x1317a3)['then'](function(_0x23f60b){return _0x1b69f5(msgResponse(_0xbc56('0x1ac'),'Success',_0x5ac784));})[_0xbc56('0xb3')](function(_0x5ab424){return _0x4257b0(msgResponse(_0xbc56('0x1cd'),_0xbc56('0x148'),_0xbc56('0x1ce')));});};Dialer[_0xbc56('0x1c')][_0xbc56('0x9')]=function(_0x3d7dff){var _0x1aa9ba=this;var _0x1bcc4c=_0x3d7dff['dialPredictiveOptimizationPercentage']/0x64;var _0x26b7c3=_0x3d7dff[_0xbc56('0x119')]/(_0x3d7dff[_0xbc56('0x119')]+_0x3d7dff[_0xbc56('0x62')]);var _0x474caa=Math['round'](_0x3d7dff[_0xbc56('0x73')]*(_0x3d7dff[_0xbc56('0x1cf')]/0x64));var _0xf4a36e=Math[_0xbc56('0x1d0')](_0x3d7dff[_0xbc56('0x73')]*(_0x3d7dff[_0xbc56('0x1d1')]/0x64));var _0x2f8317=_0x3d7dff[_0xbc56('0x51')]+_0x3d7dff['talking'];var _0x3fe1b8=Math[_0xbc56('0x1d2')](_0x3d7dff[_0xbc56('0x76')]*_0x3d7dff[_0xbc56('0x77')]*_0x3d7dff[_0xbc56('0x70')]*_0x3d7dff['predictiveIntervalMultiplicativeFactor']);if(_[_0xbc56('0x3d')](_0x3d7dff[_0xbc56('0x2c')])){if(!_['isUndefined'](_0x3d7dff['startPredictive'])){_0x3d7dff[_0xbc56('0x2b')]=undefined;loggerPredictive['error'](_0xbc56('0x1d3'),_0xbc56('0x1d4'));}if(!_[_0xbc56('0x3d')](_0x3d7dff[_0xbc56('0x95')])){loggerPredictive['error'](_0xbc56('0x1d3'),_0xbc56('0x1d5'));clearInterval(_0x3d7dff[_0xbc56('0x95')]);_0x3d7dff[_0xbc56('0x95')]=undefined;}_0x3d7dff[_0xbc56('0x2c')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x3d7dff[_0xbc56('0x2c')]);this[_0xbc56('0x15e')](_0x3d7dff,0x1);}else if(ifInterval(_0x3d7dff['dialPredictiveInterval'],_0x3d7dff['startProgressive'])){this[_0xbc56('0x15e')](_0x3d7dff,0x1);loggerPredictiveCalls[_0xbc56('0x82')](_0xbc56('0x1d6'),_0x3d7dff[_0xbc56('0x2c')],_0x3d7dff[_0xbc56('0x40')]);_0x3d7dff[_0xbc56('0x76')]=0x0;_0x3d7dff['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1bcc4c<_0x26b7c3&&_0x3d7dff[_0xbc56('0x1d7')]==='dropRate'){freeVariablesPredictive(_0x3d7dff);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x1d8'),'Dropped\x20calls\x20day',_0x26b7c3,_0xbc56('0x2c'),_0x3d7dff[_0xbc56('0x40')]);}else if(_0x3fe1b8<_0x3d7dff[_0xbc56('0x1d9')]&&_0x3d7dff['dialPredictiveOptimization']===_0xbc56('0x1da')){freeVariablesPredictive(_0x3d7dff);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x1db'),_0xbc56('0x1dc'),_0x3fe1b8,'Drop\x20in\x20this\x20interval',_0x3d7dff[_0xbc56('0x1d9')],'startProgressive',_0x3d7dff[_0xbc56('0x40')]);}else if(!ifInterval(_0x3d7dff[_0xbc56('0x1dd')],_0x3d7dff['startProgressive'])&&_[_0xbc56('0x3d')](_0x3d7dff['startPredictive'])&&!_['isUndefined'](_0x3d7dff['startProgressive'])){_0x3d7dff[_0xbc56('0x2b')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],'started\x20in\x20predictive\x20at',_0x3d7dff['startPredictive']);this[_0xbc56('0xbe')](_0x3d7dff['dialPredictiveInterval'])[_0xbc56('0xb8')](this[_0xbc56('0x1de')](_0x3d7dff))[_0xbc56('0xb8')](mergeDataErlangB(_0x3d7dff))[_0xbc56('0xb8')](this[_0xbc56('0x1df')](_0x3d7dff))[_0xbc56('0xb3')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x3d7dff));}else if(!ifInterval(_0x3d7dff[_0xbc56('0x1dd')],_0x3d7dff[_0xbc56('0x2b')])){_0x3d7dff[_0xbc56('0x1d9')]=0x0;_0x3d7dff[_0xbc56('0x2b')]=moment()[_0xbc56('0x7c')](_0xbc56('0xfa'));loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],_0xbc56('0x1e0'),_0x3d7dff[_0xbc56('0x2b')]);clearInterval(_0x3d7dff['handlePredictive']);_0x3d7dff[_0xbc56('0x95')]=undefined;this['averageHandleTime'](_0x3d7dff[_0xbc56('0x1dd')])[_0xbc56('0xb8')](this[_0xbc56('0x1de')](_0x3d7dff))[_0xbc56('0xb8')](mergeDataErlangB(_0x3d7dff))['then'](this['startMethodPredictive'](_0x3d7dff))[_0xbc56('0xb3')](loggerCatchPredictive(_0xbc56('0x1e1'),_0x3d7dff));}else if(_0x3d7dff['predictiveIntervalAvailable']&&_0x2f8317<_0x3d7dff[_0xbc56('0x73')]-_0xf4a36e){freeVariablesPredictive(_0x3d7dff);loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],_0xbc56('0x1e2'),_0x2f8317,')\x20are\x20less\x20than\x20threshold\x20(',_0x3d7dff[_0xbc56('0x73')],'-',_0xf4a36e,'=',_0x3d7dff[_0xbc56('0x73')]-_0xf4a36e,')');}else if(_0x3d7dff[_0xbc56('0x73')]&&_0x2f8317>_0x3d7dff[_0xbc56('0x73')]+_0x474caa){freeVariablesPredictive(_0x3d7dff);loggerPredictive[_0xbc56('0x82')](_0x3d7dff[_0xbc56('0x40')],_0xbc56('0x1e2'),_0x2f8317,_0xbc56('0x1e3'),_0x3d7dff['predictiveIntervalAvailable'],'+',_0x474caa,'=',_0x3d7dff['predictiveIntervalAvailable']+_0x474caa,')');}};Dialer[_0xbc56('0x1c')][_0xbc56('0x1de')]=function(_0x6310b2){var _0x60a843=this;return function(_0x352f4a){return new BPromise(function(_0xb2121f,_0x58a4b0){_[_0xbc56('0x93')](_0x6310b2,_0x352f4a[0x0]);if(checkGetDataPredictive(_0x352f4a[0x0])){var _0x3030ff=_0x6310b2[_0xbc56('0x73')]=_0x6310b2[_0xbc56('0x55')]+_0x6310b2[_0xbc56('0x51')];var _0x305433=_0x6310b2[_0xbc56('0x1dd')]*0x3c;var _0x534e8e=_0x352f4a[0x0][_0xbc56('0x6c')]+_0x352f4a[0x0][_0xbc56('0x6b')];var _0x34f78f=(_0x352f4a[0x0]['predictiveIntervalAnsweredCalls']+_0x352f4a[0x0][_0xbc56('0x6e')]+_0x352f4a[0x0][_0xbc56('0x6d')])/_0x352f4a[0x0]['predictiveIntervalTotalCalls'];_0x6310b2[_0xbc56('0x70')]=_0x34f78f>0x0?_0x34f78f:0x1;switch(_0x6310b2[_0xbc56('0x1d7')]){case'dropRate':var _0x9b0192=_0x6310b2['dialPredictiveOptimizationPercentage']/0x64;return _0x60a843[_0xbc56('0x1e4')](_0x3030ff,_0x305433,_0x534e8e,_0x34f78f,_0x9b0192)[_0xbc56('0xb8')](function(_0x431db0){return _0xb2121f(_0x431db0);});case _0xbc56('0x1e5'):var _0x1bb38a=_0x6310b2[_0xbc56('0x1e6')]/0x64;return _0x60a843[_0xbc56('0x1e7')](_0x3030ff,_0x305433,_0x534e8e,_0x34f78f,_0x1bb38a)[_0xbc56('0xb8')](function(_0x3b0a8c){return _0xb2121f(_0x3b0a8c);});default:return _0x58a4b0(msgResponse(_0xbc56('0x1e8'),'Failure',_0xbc56('0x1e9')));}}else{return _0x58a4b0(msgResponse(_0xbc56('0x1e8'),_0xbc56('0x148'),_0xbc56('0x1ea')));}});};};Dialer['prototype'][_0xbc56('0x1eb')]=function(_0xc9532){var _0x3b40dc=this;return function(_0x31d288){return new BPromise(function(_0x228590,_0x29707b){_['merge'](_0xc9532,_0x31d288[0x0]);if(checkGetDataPredictive(_0x31d288[0x0])){loggerPredictive[_0xbc56('0x82')](JSON[_0xbc56('0x49')](_0x31d288[0x0]));if(_0xc9532[_0xbc56('0x1d7')]==='dropRate'){return _0x3b40dc['getVoiceQueueRtPauses'](_0xc9532['id'])[_0xbc56('0xb8')](function(_0x4efc66){var _0x5709c7=_0xc9532[_0xbc56('0x164')]-_0x4efc66[0x0][_0xbc56('0x1ec')];var _0x188064=_0xc9532[_0xbc56('0x1dd')]*0x3c;var _0x2d27e4=_0x31d288[0x0][_0xbc56('0x6c')]+_0x31d288[0x0][_0xbc56('0x6b')];var _0x5626fb=(_0x31d288[0x0][_0xbc56('0x6a')]+_0x31d288[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x31d288[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x31d288[0x0][_0xbc56('0x74')];var _0x51ac8c=_0xc9532['dialPredictiveOptimizationPercentage']/0x64;_0xc9532['predictiveIntervalPauses']=_0x4efc66[0x0]['outboundQueuePauses']||0x0;_0xc9532[_0xbc56('0x70')]=_0x5626fb>0x0?_0x5626fb:0x1;return _0x3b40dc[_0xbc56('0x1e4')](_0x5709c7,_0x188064,_0x2d27e4,_0x5626fb,_0x51ac8c);})[_0xbc56('0xb8')](function(_0x3f4eaa){return _0x228590(_0x3f4eaa);})[_0xbc56('0xb3')](function(_0x1b2d87){return _0x29707b(msgResponse('[CatchErlangB]','Failure',JSON[_0xbc56('0x49')](_0x1b2d87)));});}if(_0xc9532[_0xbc56('0x1d7')]===_0xbc56('0x1e5')){return _0x3b40dc[_0xbc56('0xc8')](_0xc9532['id'])[_0xbc56('0xb8')](function(_0x319f0d){var _0x42accf=_0xc9532[_0xbc56('0x164')]-_0x319f0d[0x0][_0xbc56('0x1ec')];var _0x58b7a2=_0xc9532[_0xbc56('0x1dd')]*0x3c;var _0x14a33a=_0x31d288[0x0][_0xbc56('0x6c')]+_0x31d288[0x0][_0xbc56('0x6b')];var _0x1498f6=(_0x31d288[0x0]['predictiveIntervalAnsweredCalls']+_0x31d288[0x0][_0xbc56('0x6e')]+_0x31d288[0x0][_0xbc56('0x6d')])/_0x31d288[0x0][_0xbc56('0x74')];var _0x1391b2=_0xc9532[_0xbc56('0x1e6')]/0x64;_0xc9532[_0xbc56('0x72')]=_0x319f0d[0x0][_0xbc56('0x1ec')]||0x0;_0xc9532[_0xbc56('0x70')]=_0x1498f6>0x0?_0x1498f6:0x1;return _0x3b40dc[_0xbc56('0x1e7')](_0x42accf,_0x58b7a2,_0x14a33a,_0x1498f6,_0x1391b2);})[_0xbc56('0xb8')](function(_0x37b73c){return _0x228590(_0x37b73c);})[_0xbc56('0xb3')](function(_0x1d0c92){return _0x29707b(msgResponse(_0xbc56('0x1ed'),'Failure',JSON[_0xbc56('0x49')](_0x1d0c92)));});}}else{return _0x29707b(msgResponse(_0xbc56('0x1e8'),_0xbc56('0x148'),'check\x20failure'));}});};};Dialer[_0xbc56('0x1c')][_0xbc56('0x1df')]=function(_0x5307b8){var _0x353483=this;return function(){var _0x50b302=0x0;var _0x5101a9=Math[_0xbc56('0x1d2')](_0x5307b8[_0xbc56('0x90')]*0x3e8);if(_0x5101a9>0x0){_0x5101a9=_0x5101a9<0x64?0x64:_0x5101a9;loggerPredictive[_0xbc56('0x82')](_0x5307b8['name'],'one\x20call\x20every:',_0x5101a9,'milliseconds');_0x5307b8[_0xbc56('0x95')]=setInterval(function(){_0x353483[_0xbc56('0x95')](_0x5307b8);loggerPredictiveCalls[_0xbc56('0x82')](_0xbc56('0x1ee'),_0x50b302+=0x1);},_0x5101a9);}else{loggerPredictive[_0xbc56('0x82')](_0x5307b8['name'],_0xbc56('0x1ef'));}};};Dialer[_0xbc56('0x1c')][_0xbc56('0x1f0')]=function(_0x2f616e,_0x3ab5d8){var _0x439957=this;return function(_0x2e27fc){if(_[_0xbc56('0x45')](_0x2e27fc)){if(_['isNil'](_0x3ab5d8['UserId'])||!_0x3ab5d8[_0xbc56('0x1f1')]){if(_0x2f616e[_0xbc56('0x5d')]===_0xbc56('0x8')){_0x2f616e[_0xbc56('0x132')]=_[_0xbc56('0x3d')](_0x2f616e['queueStatusComplete'])?!![]:_0x2f616e['queueStatusComplete'];var _0x7eb6ad=uuid['v4']();_0x439957[_0xbc56('0x28')][_0x7eb6ad]=new Action(_0x2f616e,_0x3ab5d8,_0x7eb6ad);loggerBooked[_0xbc56('0x82')](_0xbc56('0x1f2'),_0x7eb6ad,'queueStatusComplete:\x20',JSON[_0xbc56('0x49')](_0x2f616e[_0xbc56('0x132')]),_0xbc56('0x1f3'),_0x2f616e['name']);if(_0x2f616e[_0xbc56('0x132')]){_0x2f616e[_0xbc56('0x132')]=![];_0x439957['queueBooked'][_0x439957['actions'][_0x7eb6ad]['queue']]=[];ami[_0xbc56('0xb0')]({'actionid':_0x7eb6ad,'action':_0xbc56('0x1f4'),'queue':_0x2f616e[_0xbc56('0x40')]})[_0xbc56('0xb3')](function(_0x2cf9c7){_0x439957[_0xbc56('0xce')](_0x2f616e);_0x439957[_0xbc56('0xc1')]({'active':![],'ContactId':_0x439957[_0xbc56('0x28')][_0x7eb6ad]['ContactId'],'ListId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0xd7')],'VoiceQueueId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0xfb')]||undefined,'CampaignId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1f5')));delete _0x439957[_0xbc56('0x28')][_0x7eb6ad];});}else{loggerBooked[_0xbc56('0x82')]('[booked][checkContactBlack][else]',JSON[_0xbc56('0x49')](_0x2f616e[_0xbc56('0x132')]),_0xbc56('0x1f3'),_0x2f616e['name']);_0x439957[_0xbc56('0xce')](_0x2f616e);_0x439957['rescheduleContact']({'active':![],'ContactId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0xd6')],'ListId':_0x439957['actions'][_0x7eb6ad][_0xbc56('0xd7')],'VoiceQueueId':_0x439957[_0xbc56('0x28')][_0x7eb6ad]['VoiceQueueId']||undefined,'CampaignId':_0x439957[_0xbc56('0x28')][_0x7eb6ad][_0xbc56('0x107')]||undefined})['catch'](loggerCatch(_0xbc56('0x1f5')));delete _0x439957[_0xbc56('0x28')][_0x7eb6ad];}}else{return _0x439957['actionOriginate'](_0x2f616e,_0x3ab5d8);}}else{if(getDiff(_0x3ab5d8[_0xbc56('0x1f6')])<_0x2f616e[_0xbc56('0x1f7')]*0x3c){if(_0x3ab5d8[_0xbc56('0x1f8')]&&!_0x3ab5d8[_0xbc56('0x1f8')][_0xbc56('0x1f9')]){_0x439957[_0xbc56('0x21')][_0xbc56('0x133')](_0x3ab5d8['id'])[_0xbc56('0x1f')](function(){_0x439957['updateOriginated'](_0x2f616e);});}else{_0x439957[_0xbc56('0xc3')]({'active':![]},_0x3ab5d8['id'],0x1)[_0xbc56('0x1f')](function(){console[_0xbc56('0x1fa')](_0xbc56('0x1fb'));_0x439957[_0xbc56('0xce')](_0x2f616e);});}}else{_0x2f616e[_0xbc56('0x68')]+=0x1;_0x439957[_0xbc56('0xce')](_0x2f616e);if(_0x2f616e[_0xbc56('0x1fc')]){_0x439957[_0xbc56('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ab5d8[_0xbc56('0xd6')],'ListId':_0x3ab5d8[_0xbc56('0xd7')],'VoiceQueueId':_0x3ab5d8[_0xbc56('0xfb')]||undefined,'CampaignId':_0x3ab5d8[_0xbc56('0x107')]||undefined})[_0xbc56('0xb3')](loggerCatch(_0xbc56('0x1fd')));_0x439957['createHistory'](createObjHistory(_0x2f616e,_0x3ab5d8,_0xbc56('0x1fe'),0x17,_0xbc56('0x1ff')))[_0xbc56('0xb3')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x439957[_0xbc56('0xd4')](createObjHistory(_0x2f616e,_0x3ab5d8,_0xbc56('0x200'),0x16,_0xbc56('0x201')),_0xbc56('0x202'),_0xbc56('0x203'));}}}}else{_0x2f616e['outboundBlacklistCallsDay']+=0x1;_0x439957[_0xbc56('0xd4')](createObjHistory(_0x2f616e,_0x3ab5d8,_0xbc56('0x204'),0xd,_0xbc56('0x205')),_0xbc56('0x206'),_0xbc56('0x207'));throw _0xbc56('0x208');}};};Dialer['prototype'][_0xbc56('0x163')]=function(_0xf84f2a){var _0x4c83de=this;var _0x3085d3=[];var _0x1b3db1=_0xf84f2a[_0xbc56('0x209')]-_0xf84f2a[_0xbc56('0x75')]-_0xf84f2a[_0xbc56('0x20a')];emitCampaignSummary(_0xf84f2a);if(_0x1b3db1>0x0){if(_0x1b3db1>this[_0xbc56('0x26')]){_0x1b3db1=this['maxNumberOriginate'];}_0xf84f2a[_0xbc56('0x20a')]+=_0x1b3db1;this[_0xbc56('0xc7')](_0xf84f2a['id'],_0x1b3db1,_0xf84f2a[_0xbc56('0x20b')])[_0xbc56('0xb8')](function(_0x1832b2){_0xf84f2a[_0xbc56('0x20a')]-=_0x1b3db1;_0xf84f2a[_0xbc56('0x20a')]=_0xf84f2a[_0xbc56('0x20a')]>0x0?_0xf84f2a[_0xbc56('0x20a')]:0x0;if(!checkContactEmpty(_0x1832b2)){_0xf84f2a[_0xbc56('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xbc56('0x82')]('[getContactCampaign2][Empty]'+_0xf84f2a[_0xbc56('0x40')]);}else{_0xf84f2a['originated']+=_0x1832b2[_0xbc56('0x14f')];_0xf84f2a['message']=_0xbc56('0x20c');for(var _0x5fb8df=0x0;_0x5fb8df<_0x1832b2[_0xbc56('0x14f')];_0x5fb8df+=0x1){_0xf84f2a[_0xbc56('0x20d')]+=0x1;if(_[_0xbc56('0xaf')](_0x1832b2[_0x5fb8df])||_[_0xbc56('0xaf')](_0x1832b2[_0x5fb8df]['Contact'])||_['isNil'](_0x1832b2[_0x5fb8df][_0xbc56('0x170')]['phone'])){_0x4c83de['emptyContact'](_0xbc56('0x20e'),_0xf84f2a,_0x1832b2[_0x5fb8df]);}else{_0x4c83de[_0xbc56('0xbc')](_['pick'](_0x1832b2[_0x5fb8df],[_0xbc56('0x107'),_0xbc56('0x20f')]))[_0xbc56('0xb8')](_0x4c83de[_0xbc56('0x1f0')](_0xf84f2a,_0x1832b2[_0x5fb8df]))[_0xbc56('0xb3')](_0x4c83de[_0xbc56('0xd1')](_0xbc56('0x210'),_0xf84f2a));}}}})[_0xbc56('0xb3')](loggerGetContactDialer(_0xbc56('0x211'),_0xf84f2a,_0x1b3db1));}};Dialer[_0xbc56('0x1c')][_0xbc56('0x15e')]=function(_0x5b67ab,_0x47200e){var _0x346f2c=this;var _0x438f19=[];var _0x1e37db=_0x47200e>=0x1?_0x47200e:0x1;var _0x408eb5=[];if(_0x5b67ab[_0xbc56('0x5d')]===_0xbc56('0x8')){_0x1e37db=0x1;}var _0xa24d29=Math[_0xbc56('0x1d2')](_0x5b67ab[_0xbc56('0x51')]*_0x1e37db)-_0x5b67ab['originated']-_0x5b67ab[_0xbc56('0x20a')];emitVoiceQueueSummary(_0x5b67ab);if(_0x5b67ab[_0xbc56('0x212')]>0x0){var _0x2024bf=_0x5b67ab[_0xbc56('0x212')]-_0x5b67ab['originated']-_0x5b67ab[_0xbc56('0x55')]-_0x5b67ab[_0xbc56('0x20a')]-_0x5b67ab[_0xbc56('0x52')];if(_0xa24d29>_0x2024bf){_0xa24d29=_0x2024bf;}}if(_0xa24d29>0x0){if(_0x5b67ab[_0xbc56('0x5d')]===_0xbc56('0x8')){_0xa24d29=0x1;}if(_0xa24d29>this[_0xbc56('0x26')]){_0xa24d29=this['maxNumberOriginate'];}_0x5b67ab[_0xbc56('0x20a')]+=_0xa24d29;for(var _0x27a5f5 in this[_0xbc56('0x24')]){if(this[_0xbc56('0x24')][_0xbc56('0x9b')](_0x27a5f5)){if(this[_0xbc56('0x24')][_0x27a5f5][_0xbc56('0xa8')]===_0xbc56('0x213')&&this['agents'][_0x27a5f5][_0xbc56('0xb1')]===_0xbc56('0xdd')){_0x438f19[_0xbc56('0x12e')](this[_0xbc56('0x24')][_0x27a5f5]['id']);}}}this[_0xbc56('0xc5')](_0x5b67ab['id'],_0x438f19,_0xa24d29,_0x5b67ab[_0xbc56('0x20b')])['then'](function(_0x27e011){_0x5b67ab[_0xbc56('0x20a')]-=_0xa24d29;_0x5b67ab[_0xbc56('0x20a')]=_0x5b67ab[_0xbc56('0x20a')]>0x0?_0x5b67ab[_0xbc56('0x20a')]:0x0;if(!checkContactEmpty(_0x27e011)){_0x346f2c[_0xbc56('0xb6')](_0x5b67ab)[_0xbc56('0xb8')](sendMessageReschedule(_0x5b67ab))[_0xbc56('0xb3')](loggerCatch('[countReScheduled]\x20'));}else{_0x5b67ab[_0xbc56('0x75')]+=_0x27e011[_0xbc56('0x14f')];_0x5b67ab['message']=_0x5b67ab[_0xbc56('0x5d')]==='booked'?_0xbc56('0x178'):_0xbc56('0x20c');for(var _0x4ad474=0x0;_0x4ad474<_0x27e011[_0xbc56('0x14f')];_0x4ad474+=0x1){if(_['isNil'](_0x27e011[_0x4ad474])||_[_0xbc56('0xaf')](_0x27e011[_0x4ad474][_0xbc56('0x170')])||_[_0xbc56('0xaf')](_0x27e011[_0x4ad474]['Contact']['phone'])){_0x346f2c['emptyContact'](_0xbc56('0x20e'),_0x5b67ab,_0x27e011[_0x4ad474]);}else{_0x346f2c['checkIsBlackList'](_[_0xbc56('0xd5')](_0x27e011[_0x4ad474],['VoiceQueueId',_0xbc56('0x20f')]))['then'](_0x346f2c[_0xbc56('0x1f0')](_0x5b67ab,_0x27e011[_0x4ad474]))[_0xbc56('0xb3')](_0x346f2c[_0xbc56('0xd1')]('[actionOriginate]\x20',_0x5b67ab));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x5b67ab,_0xa24d29));}};Dialer[_0xbc56('0x1c')][_0xbc56('0x95')]=function(_0x2f85da){var _0x22669d=this;if(_0x2f85da[_0xbc56('0x212')]>0x0){var _0x130f1d=_0x2f85da[_0xbc56('0x212')]-_0x2f85da[_0xbc56('0x75')]-_0x2f85da[_0xbc56('0x55')];if(_0x130f1d>0x0){this['tryOriginatePredictive'](_0x2f85da);}else{loggerPredictiveCalls[_0xbc56('0x82')](_0xbc56('0x214'));}}else{this[_0xbc56('0x215')](_0x2f85da);}};Dialer[_0xbc56('0x1c')]['tryOriginatePredictive']=function(_0xc25c75){var _0x14e305=this;var _0x553f56=[];_0xc25c75[_0xbc56('0x75')]+=0x1;for(var _0x176204 in this[_0xbc56('0x24')]){if(this[_0xbc56('0x24')]['hasOwnProperty'](_0x176204)){if(this[_0xbc56('0x24')][_0x176204][_0xbc56('0xa8')]===_0xbc56('0x213')&&this[_0xbc56('0x24')][_0x176204]['status']===_0xbc56('0xdd')){_0x553f56['push'](this['agents'][_0x176204]['id']);}}}this[_0xbc56('0xc5')](_0xc25c75['id'],_0x553f56,0x1,_0xc25c75[_0xbc56('0x20b')])[_0xbc56('0xb8')](function(_0x39f419){if(!checkContactEmpty(_0x39f419)){checkContactLowerLimitOriginate(_0xc25c75,0x1,0x0);_0x14e305[_0xbc56('0xb6')](_0xc25c75)[_0xbc56('0xb8')](sendMessageReschedule(_0xc25c75))[_0xbc56('0xb3')](loggerCatch(_0xbc56('0xb9')));}else{_0xc25c75[_0xbc56('0x3e')]=_0xbc56('0x20c');if(_['isNil'](_0x39f419[0x0])||_[_0xbc56('0xaf')](_0x39f419[0x0][_0xbc56('0x170')])||_[_0xbc56('0xaf')](_0x39f419[0x0][_0xbc56('0x170')][_0xbc56('0x16f')])){_0x14e305[_0xbc56('0xd2')](_0xbc56('0x20e'),_0xc25c75,_0x39f419[0x0]);}else{_0x14e305[_0xbc56('0xba')](_[_0xbc56('0xd5')](_0x39f419[0x0],[_0xbc56('0xfb'),_0xbc56('0x20f')]))[_0xbc56('0xb8')](_0x14e305[_0xbc56('0x1f0')](_0xc25c75,_0x39f419[0x0]))[_0xbc56('0xb3')](_0x14e305['loggerHandler'](_0xbc56('0x216'),_0xc25c75));}}})['catch'](loggerGetContactDialer(_0xbc56('0x217'),_0xc25c75,0x1));emitVoiceQueueSummary(_0xc25c75);};Dialer['prototype'][_0xbc56('0x1e4')]=function(_0x2e5be7,_0xaf54e8,_0x4547df,_0x265300,_0x2f54e3,_0x5c2f3d){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xbc56('0x218'),_0x2e5be7);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x219'),_0xaf54e8);loggerPredictive['info'](_0xbc56('0x21a'),_0x4547df);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x21b'),_0x265300);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x21c'),_0x2f54e3);loggerPredictive[_0xbc56('0x82')]('---------------------------');return new BPromise(function(_0x4c0573,_0x4c597b){if(_0x2e5be7<=0x0||isNaN(_0x2e5be7)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),'Error',_0xbc56('0x21e')+_0x2e5be7));}if(_0x4547df<=0x0||isNaN(_0x4547df)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),_0xbc56('0x48'),'Ts\x20=\x20'+_0x4547df));}if(_0x265300<=0x0||isNaN(_0x265300)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),_0xbc56('0x48'),'p\x20=\x20'+_0x265300));}if(_0xaf54e8<=0x0||isNaN(_0xaf54e8)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),_0xbc56('0x48'),_0xbc56('0x21f')+_0xaf54e8));}if(_0x2f54e3<=0x0||isNaN(_0x2f54e3)){return _0x4c597b(msgResponse(_0xbc56('0x21d'),'Error','Amax\x20=\x20'+_0x2f54e3));}_0x5c2f3d=_0x5c2f3d||0x0;var _0x5175e7=0x1/_0x4547df;var _0x29c03a=0x0;var _0x59c798=0x0;var _0x14c69f=0x0;var _0x4301a9=0x0;for(var _0x2b476e=0x0;_0x14c69f<_0x2f54e3;_0x2b476e+=0x1){_0x59c798=_0x2b476e/_0xaf54e8;_0x29c03a=(_0x265300*_0x59c798+_0x5c2f3d)/_0x5175e7;_0x14c69f=erlangb(_0x29c03a,_0x2e5be7);_0x4301a9=_0x29c03a/_0x2e5be7*(0x1-erlangb(_0x29c03a,_0x2e5be7));}return _0x4c0573({'erlangCalls':_0x2b476e,'erlangCallToSecond':_0xaf54e8/_0x2b476e,'erlangAbandonmentRate':_0x14c69f,'erlangBusyFactor':_0x4301a9});});};Dialer['prototype'][_0xbc56('0x1e7')]=function(_0x5d37c2,_0x35f525,_0x36b4ab,_0x425002,_0x3cb6a1,_0x570606){loggerPredictive['info'](_0xbc56('0x220'));loggerPredictive[_0xbc56('0x82')]('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',_0x5d37c2);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x219'),_0x35f525);loggerPredictive['info'](_0xbc56('0x21a'),_0x36b4ab);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x21b'),_0x425002);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',_0x3cb6a1);loggerPredictive[_0xbc56('0x82')](_0xbc56('0x88'));return new BPromise(function(_0x171676,_0x3fbd70){if(_0x5d37c2<=0x0||isNaN(_0x5d37c2)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),'Error','m\x20=\x20'+_0x5d37c2));}if(_0x36b4ab<=0x0||isNaN(_0x36b4ab)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),_0xbc56('0x48'),'Ts\x20=\x20'+_0x36b4ab));}if(_0x425002<=0x0||isNaN(_0x425002)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),'Error',_0xbc56('0x222')+_0x425002));}if(_0x35f525<=0x0||isNaN(_0x35f525)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),'Error',_0xbc56('0x21f')+_0x35f525));}if(_0x3cb6a1<=0x0||isNaN(_0x3cb6a1)){return _0x3fbd70(msgResponse(_0xbc56('0x221'),_0xbc56('0x48'),_0xbc56('0x223')+_0x3cb6a1));}_0x570606=_0x570606||0x0;var _0x1694bc=0x1/_0x36b4ab;var _0x1b4f92=0x0;var _0x4afaa9=0x0;var _0x310d1a=0x0;var _0x53960e=0x0;for(var _0x1c8521=0x0;_0x53960e<_0x3cb6a1;_0x1c8521+=0x1){_0x4afaa9=_0x1c8521/_0x35f525;_0x1b4f92=(_0x425002*_0x4afaa9+_0x570606)/_0x1694bc;_0x310d1a=erlangb(_0x1b4f92,_0x5d37c2);_0x53960e=_0x1b4f92/_0x5d37c2*(0x1-erlangb(_0x1b4f92,_0x5d37c2));}return _0x171676({'erlangCalls':_0x1c8521,'erlangCallToSecond':_0x35f525/_0x1c8521,'erlangAbandonmentRate':_0x310d1a,'erlangBusyFactor':_0x53960e});});};module[_0xbc56('0x224')]=Dialer; \ No newline at end of file +var _0xcf80=['[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','content','true','indexOf','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','stateGlobal','outboundAbandonedCallsDay','custom:agentreject','dialAgentRejectMaxRetry','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','log','Contact\x20updated','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','BLACKLIST','[Originate][historyBlacklist]','temp','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','Contact.phone','[handlePredictive][limitChannel]','tryOriginatePredictive','reachable','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','p\x20=\x20','interval\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','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','bluebird','uuid','moment','md5','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','milliseconds','seconds','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','waiting','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangBusyFactor','startPredictive','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','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','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','prototype','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','enqueue','isNil','Action','status','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','merge','pick','ContactId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','unmonitored','uniqueid','variable','exten','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','dialGlobalMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','CampaignId','[rescheduleContact][Machine]','countcongestionretry','countnoanswerretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','add','ivrAnswerCallsDay','AnswerAGI','AGI','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Unknow','[syncHangupIvr]','syncAgentComplete','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','dialQueueProject2','countdropretry','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridnum'];(function(_0x1b3f8b,_0x15783c){var _0x22b1d5=function(_0x359d99){while(--_0x359d99){_0x1b3f8b['push'](_0x1b3f8b['shift']());}};_0x22b1d5(++_0x15783c);}(_0xcf80,0xf1));var _0x0cf8=function(_0x28d5df,_0x3f2cac){_0x28d5df=_0x28d5df-0x0;var _0x1d84fc=_0xcf80[_0x28d5df];return _0x1d84fc;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x0cf8('0x0'));var uuid=require(_0x0cf8('0x1'));var moment=require(_0x0cf8('0x2'));var rr=require('rr');var md5=require(_0x0cf8('0x3'));var Redis=require(_0x0cf8('0x4'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x0cf8('0x5'))(_0x0cf8('0x6'));var loggerBooked=require(_0x0cf8('0x5'))(_0x0cf8('0x7'));var loggerPredictive=require(_0x0cf8('0x5'))(_0x0cf8('0x8'));var loggerPredictiveCalls=require(_0x0cf8('0x5'))(_0x0cf8('0x9'));var loggerSyncQueueSummary=require(_0x0cf8('0x5'))(_0x0cf8('0xa'));var ami=require(_0x0cf8('0xb'));config[_0x0cf8('0xc')]=_[_0x0cf8('0xd')](config[_0x0cf8('0xc')],{'host':_0x0cf8('0xe'),'port':0x18eb});var io=require(_0x0cf8('0xf'))(new Redis(config[_0x0cf8('0xc')]));var cmHopper=require(_0x0cf8('0x10'));var cmHopperFinal=require(_0x0cf8('0x11'));var cmHopperHistory=require(_0x0cf8('0x12'));var cmHopperBlack=require(_0x0cf8('0x13'));var voiceQueueRt=require(_0x0cf8('0x14'));var Action=require(_0x0cf8('0x15'));var History=require(_0x0cf8('0x16'));var Final=require(_0x0cf8('0x17'));var AgentComplete=require(_0x0cf8('0x18'));var QueueCallerAbandon=require(_0x0cf8('0x19'));var Hangup=require(_0x0cf8('0x1a'));var ipAgi=process[_0x0cf8('0x1b')][_0x0cf8('0x1c')]||_0x0cf8('0x1d');var strategy={'rrmemory':_0x0cf8('0x1e'),'roundrobin':_0x0cf8('0x1f')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x53fb67){this[_0x0cf8('0x20')]=this['tail']?this['tail'][_0x0cf8('0x21')](_0x53fb67):_0x53fb67();};function Dialer(_0x43a8c9,_0x43826d){this[_0x0cf8('0x22')]=new Sequence();this[_0x0cf8('0x23')]=_0x43826d;this[_0x0cf8('0x24')]=_0x43a8c9[_0x0cf8('0x24')];this[_0x0cf8('0x25')]=_0x43a8c9['campaigns'];this[_0x0cf8('0x26')]=_0x43a8c9[_0x0cf8('0x26')];this[_0x0cf8('0x27')]=_0x43a8c9[_0x0cf8('0x27')];this['maxNumberOriginate']=config[_0x0cf8('0x28')]||0x2;this[_0x0cf8('0x29')]={};this[_0x0cf8('0x2a')]={};this[_0x0cf8('0x2b')]={};this[_0x0cf8('0x2c')]={};this[_0x0cf8('0x2d')]={};this['startPredictive']={};this[_0x0cf8('0x2e')]={};this[_0x0cf8('0x2f')]={};this[_0x0cf8('0x30')]={};this[_0x0cf8('0x31')]={};ami['on'](_0x0cf8('0x32'),this[_0x0cf8('0x33')][_0x0cf8('0x34')](this));ami['on'](_0x0cf8('0x35'),this[_0x0cf8('0x36')]['bind'](this));ami['on'](_0x0cf8('0x37'),this[_0x0cf8('0x38')]['bind'](this));ami['on'](_0x0cf8('0x39'),this['syncAgentComplete']['bind'](this));ami['on'](_0x0cf8('0x3a'),this[_0x0cf8('0xa')][_0x0cf8('0x34')](this));ami['on'](_0x0cf8('0x3b'),this[_0x0cf8('0x3c')][_0x0cf8('0x34')](this));ami['on'](_0x0cf8('0x3d'),this[_0x0cf8('0x3e')][_0x0cf8('0x34')](this));ami['on']('varset',this[_0x0cf8('0x3f')][_0x0cf8('0x34')](this));ami['on']('queuemember',this[_0x0cf8('0x40')][_0x0cf8('0x34')](this));ami['on'](_0x0cf8('0x41'),this[_0x0cf8('0x42')][_0x0cf8('0x34')](this));this[_0x0cf8('0x43')]();this['loopClearZombieChannels']();}function isNotNull(_0xb6678f){return _0xb6678f!==null&&!_[_0x0cf8('0x44')](_0xb6678f);}function checkIsLoggedIn(_0x4f0120,_0x5b153c){return function(){if(_0x5b153c<=0x0){_0x4f0120['message']='AGENTS_NOT_LOGGED';throw _0x4f0120[_0x0cf8('0x45')]+_0x0cf8('0x46');}};}function isActive(_0x460ecb){return _0x460ecb;}function checkIsActive(_0x241102,_0x5371e6){return function(){if(!isActive(_0x5371e6)){_0x241102['message']=_0x0cf8('0x47');throw _0x241102[_0x0cf8('0x45')]+_0x0cf8('0x48');}};}function checkInterval(_0x668eb8){return function(){if(!isNotNull(_0x668eb8[_0x0cf8('0x49')])){_0x668eb8[_0x0cf8('0x4a')]=_0x0cf8('0x4b');throw _0x668eb8[_0x0cf8('0x45')]+_0x0cf8('0x4c');}if(!isNotNull(_0x668eb8[_0x0cf8('0x49')][_0x0cf8('0x4d')])){_0x668eb8[_0x0cf8('0x4a')]='INTERVAL_IS_NULL';throw _0x668eb8[_0x0cf8('0x45')]+_0x0cf8('0x4c');}if(!isNotNull(_[_0x0cf8('0x4e')](_0x668eb8[_0x0cf8('0x49')][_0x0cf8('0x4d')]))){_0x668eb8['message']=_0x0cf8('0x4b');throw _0x668eb8[_0x0cf8('0x45')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x3a0ca5,_0x5121a0,_0x2d931f){return{'action':_0x3a0ca5,'response':_0x5121a0,'message':_0x2d931f,'stack':_0x2d931f};}function myreject(_0x16f2a9){return function(_0x2760db){return _0x16f2a9(msgResponse(_0x0cf8('0x4f'),'Error',JSON['stringify'](_0x2760db)));};}function getSeconds(_0x2420d7,_0x2d0a39){var _0xfa445a=moment(_0x2420d7)[_0x0cf8('0x50')](0x0);var _0x5a95a3=moment(_0x2d0a39)[_0x0cf8('0x50')](0x0);return _0xfa445a['diff'](_0x5a95a3,_0x0cf8('0x51'));}function emit(_0x57677d,_0xc69ae5,_0x600072){io['to'](_0x57677d)['emit'](_0xc69ae5,_0x600072);}function emitVoiceQueueSummary(_0x21ea41){if(_0x21ea41[_0x0cf8('0x52')]===_0x0cf8('0x53')){var _0x4a18d9={'id':_0x21ea41['id'],'name':_0x21ea41[_0x0cf8('0x45')],'strategy':_0x21ea41[_0x0cf8('0x54')],'answered':_0x21ea41['answered'],'available':_0x21ea41[_0x0cf8('0x55')],'loggedIn':_0x21ea41[_0x0cf8('0x56')],'pTalking':_0x21ea41[_0x0cf8('0x57')],'sumBillable':_0x21ea41[_0x0cf8('0x58')],'sumDuration':_0x21ea41[_0x0cf8('0x59')],'sumHoldTime':_0x21ea41['sumHoldTime']||0x0,'talking':_0x21ea41[_0x0cf8('0x5a')],'total':_0x21ea41['total'],'type':_0x21ea41[_0x0cf8('0x52')],'unmanaged':_0x21ea41[_0x0cf8('0x5b')],'abandoned':_0x21ea41['abandoned'],'waiting':_0x21ea41[_0x0cf8('0x5c')],'loggedInDb':_0x21ea41['loggedInDb'],'dialActive':_0x21ea41[_0x0cf8('0x5d')],'dialMethod':_0x21ea41[_0x0cf8('0x5e')],'dialOriginateCallerIdName':_0x21ea41['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x21ea41['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x21ea41[_0x0cf8('0x5f')],'dialPrefix':_0x21ea41['dialPrefix'],'outboundAnswerAgiCallsDay':_0x21ea41[_0x0cf8('0x60')],'outboundAnswerCallsDay':_0x21ea41[_0x0cf8('0x61')],'outboundBlacklistCallsDay':_0x21ea41[_0x0cf8('0x62')],'outboundBusyCallsDay':_0x21ea41[_0x0cf8('0x63')],'outboundCongestionCallsDay':_0x21ea41[_0x0cf8('0x64')],'outboundDropCallsDayACS':_0x21ea41[_0x0cf8('0x65')],'outboundDropCallsDayCallersExit':_0x21ea41[_0x0cf8('0x66')],'outboundDropCallsDayTimeout':_0x21ea41[_0x0cf8('0x67')],'outboundNoAnswerCallsDay':_0x21ea41[_0x0cf8('0x68')],'outboundNoSuchCallsDay':_0x21ea41[_0x0cf8('0x69')],'outboundOriginateFailureCallsDay':_0x21ea41['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x21ea41['outboundReCallsDay'],'outboundRejectCallsDay':_0x21ea41[_0x0cf8('0x6a')],'outboundUnknownCallsDay':_0x21ea41[_0x0cf8('0x6b')],'predictiveIntervalAnsweredCalls':_0x21ea41[_0x0cf8('0x6c')],'predictiveIntervalAvgHoldtime':_0x21ea41[_0x0cf8('0x6d')],'predictiveIntervalAvgTalktime':_0x21ea41[_0x0cf8('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x21ea41[_0x0cf8('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x21ea41[_0x0cf8('0x70')],'predictiveIntervalErlangCalls':_0x21ea41[_0x0cf8('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x21ea41['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x21ea41[_0x0cf8('0x72')],'predictiveIntervalMultiplicativeFactor':_0x21ea41[_0x0cf8('0x73')],'predictiveIntervalPauses':_0x21ea41[_0x0cf8('0x74')],'predictiveIntervalAvailable':_0x21ea41[_0x0cf8('0x75')],'predictiveIntervalTotalCalls':_0x21ea41[_0x0cf8('0x76')],'message':_0x21ea41[_0x0cf8('0x4a')],'originated':_0x21ea41['originated'],'erlangCalls':_0x21ea41[_0x0cf8('0x77')],'erlangCallToSecond':_0x21ea41['erlangCallToSecond'],'erlangAbandonmentRate':_0x21ea41['erlangAbandonmentRate'],'erlangBusyFactor':_0x21ea41[_0x0cf8('0x78')],'startPredictive':_0x21ea41[_0x0cf8('0x79')],'startProgressive':_0x21ea41[_0x0cf8('0x2e')]};if(_0x21ea41['Trunk']){_0x4a18d9[_0x0cf8('0x7a')]={'id':_0x21ea41[_0x0cf8('0x7a')]['id'],'name':_0x21ea41['Trunk'][_0x0cf8('0x45')],'active':_0x21ea41[_0x0cf8('0x7a')][_0x0cf8('0x7b')],'callerid':_0x21ea41[_0x0cf8('0x7a')][_0x0cf8('0x7c')]};}if(_0x21ea41[_0x0cf8('0x49')]){_0x4a18d9[_0x0cf8('0x49')]={'id':_0x21ea41['Interval']['id'],'name':_0x21ea41[_0x0cf8('0x49')][_0x0cf8('0x45')]};}var _0x585d72=md5(JSON[_0x0cf8('0x7d')](_0x4a18d9));if(_0x21ea41[_0x0cf8('0x3')]!==_0x585d72){_0x21ea41[_0x0cf8('0x3')]=_0x585d72;emit(util[_0x0cf8('0x7e')](_0x0cf8('0x7f'),_0x4a18d9[_0x0cf8('0x45')]),_0x0cf8('0x80'),_0x4a18d9);}}}function emitCampaignSummary(_0x146684){if(_0x146684[_0x0cf8('0x52')]==='ivr'){emit(util[_0x0cf8('0x7e')]('campaign:ivr:%s',_0x146684[_0x0cf8('0x45')]),_0x0cf8('0x81'),_0x146684);}}function checkGetDataPredictive(_0x3984fb){if(isNotNull(_0x3984fb)){if(!_[_0x0cf8('0x4e')](_0x3984fb)){loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x83'));loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x84'),_0x3984fb['predictiveIntervalTotalCalls']);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x85'),_0x3984fb[_0x0cf8('0x6c')]);loggerPredictive[_0x0cf8('0x82')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3984fb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3984fb[_0x0cf8('0x6f')]);loggerPredictive['info'](_0x0cf8('0x86'),_0x3984fb[_0x0cf8('0x6d')]);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x87'),_0x3984fb[_0x0cf8('0x6e')]);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x88'));if(_0x3984fb['predictiveIntervalTotalCalls']>0x0){if(!_[_0x0cf8('0x44')](_0x3984fb[_0x0cf8('0x6e')])&&_0x3984fb['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x89'));}if(!_[_0x0cf8('0x44')](_0x3984fb['predictiveIntervalAvgHoldtime'])&&_0x3984fb[_0x0cf8('0x6d')]>0x0){return!![];}else{loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x8a'));}}else{loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x8b'));}}else{loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x8c'));}}else{loggerPredictive['info'](_0x0cf8('0x8c'));}return![];}function mergeDataErlangB(_0x6795e8){return function(_0x33d1c4){loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x8d'));loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x8e'),_0x33d1c4['erlangCalls']);loggerPredictive['info'](_0x0cf8('0x8f'),_0x33d1c4[_0x0cf8('0x90')]);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x91'),_0x33d1c4[_0x0cf8('0x92')]);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x93'),_0x33d1c4[_0x0cf8('0x78')]);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x91'),_0x33d1c4['erlangAbandonmentRate']);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x88'));_['merge'](_0x6795e8,_0x33d1c4);};}function getDiff(_0x2d47f5){var _0x4a8cd0=moment()[_0x0cf8('0x50')](0x0);var _0x1d4bdd=moment(_0x2d47f5)['milliseconds'](0x0);return _0x4a8cd0['diff'](_0x1d4bdd,_0x0cf8('0x51'));}function ifInterval(_0x51cdf4,_0x56089d){if(_[_0x0cf8('0x44')](_0x56089d)){return![];}if(getDiff(_0x56089d)<_0x51cdf4*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xd1b3a8){if(isNotNull(_0xd1b3a8)){if(!_[_0x0cf8('0x44')](_0xd1b3a8[_0x0cf8('0x2e')])){_0xd1b3a8[_0x0cf8('0x2e')]=undefined;loggerPredictive['info'](_0xd1b3a8['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x0cf8('0x44')](_0xd1b3a8[_0x0cf8('0x79')])){_0xd1b3a8[_0x0cf8('0x79')]=undefined;loggerPredictive[_0x0cf8('0x82')](_0xd1b3a8[_0x0cf8('0x45')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0cf8('0x44')](_0xd1b3a8[_0x0cf8('0x94')])){clearInterval(_0xd1b3a8[_0x0cf8('0x94')]);_0xd1b3a8['handlePredictive']=undefined;loggerPredictive[_0x0cf8('0x82')](_0xd1b3a8[_0x0cf8('0x45')],_0x0cf8('0x95'));}}}function erlangb(_0x476957,_0xf713f5){if(_0xf713f5===0x0){return 0x0;}var _0x2c7735=0x1;for(var _0x49d8fc=0x1;_0x49d8fc<=_0xf713f5;_0x49d8fc+=0x1){_0x2c7735=0x1+_0x2c7735*_0x49d8fc/_0x476957;}return 0x1/_0x2c7735;}function isVoiceQueueOutbound(_0x153b55){return _0x153b55===_0x0cf8('0x53');}function isNotPreview(_0x2c6bc1){return _0x2c6bc1!==_0x0cf8('0x23');}function isCampaignIvr(_0x1bb41b){return _0x1bb41b===_0x0cf8('0x96');}function getCallerId(_0x1d59a2,_0x194e93,_0x402ff2){if(!_[_0x0cf8('0x44')](_0x402ff2)&&'string'===typeof _0x402ff2&&!_[_0x0cf8('0x4e')](_0x402ff2)){if(!_['isUndefined'](_0x194e93)&&_0x0cf8('0x97')===typeof _0x194e93&&!_[_0x0cf8('0x4e')](_0x194e93)){return util[_0x0cf8('0x7e')]('\x22%s\x22\x20<%s>',_0x194e93,_0x402ff2);}return util[_0x0cf8('0x7e')](_0x0cf8('0x98'),_0x402ff2,_0x402ff2);}if(!_[_0x0cf8('0x44')](_0x1d59a2)&&_0x0cf8('0x97')===typeof _0x1d59a2&&!_[_0x0cf8('0x4e')](_0x1d59a2)){return _0x1d59a2;}return _0x0cf8('0x99');}function loggerCatchQueueSummary(_0x829c25,_0x221b9d){return function(_0x29d726){freeVariablesPredictive(_0x221b9d);emitVoiceQueueSummary(_0x221b9d);emitCampaignSummary(_0x221b9d);loggerSyncQueueSummary['error'](_0x829c25,util['inspect'](_0x29d726,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x293abf,_0x49cf76){return function(_0x2b96ee){loggerPredictive[_0x0cf8('0x9a')](_0x49cf76[_0x0cf8('0x45')],_0x293abf);loggerPredictive[_0x0cf8('0x9a')](_0x2b96ee[_0x0cf8('0x9b')]);freeVariablesPredictive(_0x49cf76);};}function loggerCatch(_0x1265de){return function(_0xced358){logger[_0x0cf8('0x9a')](_0x1265de,util[_0x0cf8('0x9c')](_0xced358,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4ce796){return _0x4ce796&&!_[_0x0cf8('0x44')](_0x4ce796)&&_0x4ce796[_0x0cf8('0x9d')]>0x0;}function decremetOriginate(_0x338ab5){if(!_[_0x0cf8('0x44')](_0x338ab5)&&_0x338ab5!==null){if(_0x338ab5[_0x0cf8('0x9e')](_0x0cf8('0x9f'))){if(_0x338ab5[_0x0cf8('0x9f')]>0x0){_0x338ab5[_0x0cf8('0x9f')]-=0x1;}else{logger[_0x0cf8('0x9a')](_0x0cf8('0xa0'));}}}else{logger[_0x0cf8('0x9a')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x5774aa,_0x31ca1f,_0x34b29d){if(_0x31ca1f>_0x34b29d){for(var _0x460ee4=0x0;_0x460ee4<_0x31ca1f-_0x34b29d;_0x460ee4+=0x1){decremetOriginate(_0x5774aa);}}}function loggerGetContactDialer(_0x5c54ab,_0x3056f7,_0x14883e){return function(_0x264d19){checkContactLowerLimitOriginate(_0x3056f7,_0x14883e,0x0);logger['error'](_0x5c54ab,util[_0x0cf8('0x9c')](_0x264d19,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3b5a64){return function(_0x26cd70){if(isNotNull(_0x26cd70)&&isNotNull(_0x26cd70[0x0])){if(_0x26cd70[0x0][_0x0cf8('0xa1')]>0x0){_0x3b5a64[_0x0cf8('0x4a')]=_0x0cf8('0xa2');logger[_0x0cf8('0x82')](_0x0cf8('0xa3')+_0x3b5a64[_0x0cf8('0x45')],_0x26cd70[0x0][_0x0cf8('0xa1')],_0x0cf8('0xa4'));}else{_0x3b5a64[_0x0cf8('0x4a')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x0cf8('0x82')](_0x0cf8('0xa5')+_0x3b5a64[_0x0cf8('0x45')]);}}};}function notSendMessagesQueue(_0x5c371b){if(_0x5c371b[_0x0cf8('0xa6')]){freeVariablesPredictive(_0x5c371b);if(_0x5c371b[_0x0cf8('0x9f')]===0x0&&_0x5c371b[_0x0cf8('0x5a')]===0x0&&_0x5c371b[_0x0cf8('0x5c')]===0x0&&(_0x5c371b[_0x0cf8('0x57')]||0x0)===0x0){_0x5c371b[_0x0cf8('0xa6')]=![];_0x5c371b[_0x0cf8('0x55')]=0x0;_0x5c371b[_0x0cf8('0x4a')]=_0x0cf8('0x47');loggerSyncQueueSummary[_0x0cf8('0x9a')](_0x0cf8('0xa7'),_0x5c371b[_0x0cf8('0x45')],_0x0cf8('0xa8'));}else{_0x5c371b[_0x0cf8('0x4a')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x0cf8('0xa7'),_0x5c371b[_0x0cf8('0x45')],_0x0cf8('0xa9'));}emitVoiceQueueSummary(_0x5c371b);}}function notSendMessagesCampaign(_0x1db1fe){if(_0x1db1fe[_0x0cf8('0xa6')]){if(_0x1db1fe[_0x0cf8('0x9f')]===0x0){_0x1db1fe[_0x0cf8('0xa6')]=![];_0x1db1fe[_0x0cf8('0x4a')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0cf8('0x9a')](_0x0cf8('0xaa'),_0x1db1fe[_0x0cf8('0x45')],_0x0cf8('0xa8'));}else{_0x1db1fe['message']=_0x0cf8('0xab');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1db1fe[_0x0cf8('0x45')],_0x0cf8('0xa9'));}emitCampaignSummary(_0x1db1fe);}}function createObjHistory(_0x40ec08,_0x3bb1b4,_0x18de4b,_0xd713e,_0x25c395){_0x40ec08[_0x0cf8('0x4a')]=_0x18de4b;var _0x17e9ec=new Action(_0x40ec08,_0x3bb1b4);var _0x3e0a44=new History(_0x17e9ec);_0x3e0a44[_0x0cf8('0xac')]=_0xd713e;_0x3e0a44[_0x0cf8('0xad')]=_0x25c395;_0x3e0a44[_0x0cf8('0xae')]=_0x17e9ec[_0x0cf8('0xaf')];return _0x3e0a44;}Dialer[_0x0cf8('0xb0')][_0x0cf8('0xb1')]=function(){var _0x5e9cdd=this;setInterval(function(){_0x5e9cdd['clearZombieChannels'](_0x5e9cdd['uniqueId'],_0x0cf8('0xb2'));_0x5e9cdd[_0x0cf8('0xb3')](_0x5e9cdd[_0x0cf8('0x2a')],_0x0cf8('0xb4'));},0x32c8);};Dialer['prototype'][_0x0cf8('0xb3')]=function(_0x16bd7b,_0x35c380){var _0x111a7e=this;for(var _0x13aa5a in _0x16bd7b){if(_0x16bd7b[_0x0cf8('0x9e')](_0x13aa5a)){this['sequence'][_0x0cf8('0xb5')](function(){if(!_[_0x0cf8('0xb6')](_0x16bd7b[_0x13aa5a])){return ami[_0x0cf8('0xb7')]({'action':_0x0cf8('0xb8'),'channel':_0x16bd7b[_0x13aa5a]['channel']})[_0x0cf8('0xb9')](function(_0x207b89){if(_0x207b89[_0x0cf8('0x4a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x16bd7b[_0x13aa5a]&&_0x16bd7b[_0x13aa5a][_0x0cf8('0x52')]!==_0x0cf8('0x96')){_0x111a7e[_0x0cf8('0xba')](_0x111a7e['voiceQueues'][_0x16bd7b[_0x13aa5a][_0x0cf8('0xbb')]]);logger[_0x0cf8('0x9a')](_0x0cf8('0xbc'),_0x35c380,_0x13aa5a,_0x16bd7b[_0x13aa5a][_0x0cf8('0xbb')]);delete _0x16bd7b[_0x13aa5a];}if(_0x16bd7b[_0x13aa5a]&&_0x16bd7b[_0x13aa5a][_0x0cf8('0x52')]===_0x0cf8('0x96')){_0x111a7e['updateOriginated'](_0x111a7e[_0x0cf8('0x25')][_0x16bd7b[_0x13aa5a][_0x0cf8('0xbb')]]);logger['error'](_0x0cf8('0xbd'),_0x35c380,_0x13aa5a,_0x16bd7b[_0x13aa5a][_0x0cf8('0xbb')]);delete _0x16bd7b[_0x13aa5a];}},0x2328);}});}});}}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xbe')]=function(_0xb04933){return BPromise[_0x0cf8('0xbf')]()['then'](cmHopper[_0x0cf8('0xbe')](_0xb04933))[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xc0')));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xc1')]=function(_0x5c6aa5){return BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](cmHopperBlack[_0x0cf8('0xc1')](_0x5c6aa5))[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xc3')));};Dialer['prototype'][_0x0cf8('0xc4')]=function(_0x2b318b){return BPromise['resolve']()['then'](cmHopperBlack[_0x0cf8('0xc4')](_0x2b318b))[_0x0cf8('0xb9')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x0cf8('0xc5')]=function(_0x501d06){return BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](cmHopperHistory[_0x0cf8('0xc6')](_0x501d06))[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xc7')));};Dialer['prototype']['rescheduleContact']=function(_0x4aa873){return BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](cmHopper[_0x0cf8('0xc8')](_0x4aa873))[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xc9')));};Dialer['prototype']['unlockContact']=function(_0x3b0ec6,_0x1320dd,_0x5ef235){return BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](cmHopper[_0x0cf8('0xca')](_0x3b0ec6,_0x1320dd,_0x5ef235))[_0x0cf8('0xb9')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x0cf8('0xb0')]['getContactDialer']=function(_0x1bbbe2,_0x4743be,_0x281e36,_0xc61b41){return BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](cmHopper[_0x0cf8('0xcb')](_0x1bbbe2,_0x4743be,_0x281e36,_0xc61b41))[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xcc')));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xcd')]=function(_0x1a0dd4,_0x34ac4a,_0xe4452b){return BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](cmHopper[_0x0cf8('0xcd')](_0x1a0dd4,_0x34ac4a,_0xe4452b))[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xcc')));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xce')]=function(_0x329774){return BPromise[_0x0cf8('0xbf')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x329774))['catch'](loggerCatch(_0x0cf8('0xcf')));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xd0')]=function(_0x33ac3a){return BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](cmHopper[_0x0cf8('0xd0')](_0x33ac3a))['catch'](loggerCatch(_0x0cf8('0xd1')));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xd2')]=function(_0x1b923){return BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](cmHopperHistory[_0x0cf8('0xd2')](_0x1b923))[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xd3')));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xba')]=function(_0x177732){if(!_['isUndefined'](_0x177732)&&_0x177732!==null){if(_0x177732['hasOwnProperty']('originated')){if(_0x177732['originated']>0x0){_0x177732[_0x0cf8('0x9f')]-=0x1;}else{logger[_0x0cf8('0x9a')](_0x0cf8('0xd4'));}}}else{logger['error'](_0x0cf8('0xd5'));}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xd6')]=function(_0x4ca852,_0x33606e){var _0x599162=this;return function(_0x36c9f7){_0x599162[_0x0cf8('0xba')](_0x33606e);logger['error'](_0x4ca852,util[_0x0cf8('0x9c')](_0x36c9f7,{'showHidden':![],'depth':null}));};};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xd7')]=function(_0x2ad936,_0x222439,_0x1efc60){var _0x62ecc2={'state':0x19,'statedesc':'notFound'};this[_0x0cf8('0xba')](_0x222439);this[_0x0cf8('0xd8')](_[_0x0cf8('0xd9')](_0x62ecc2,_[_0x0cf8('0xda')](_0x1efc60,[_0x0cf8('0xdb'),'ListId',_0x0cf8('0xdc'),_0x0cf8('0xdd'),'CampaignId'])),_0x0cf8('0xde'),_0x0cf8('0xdf'));logger['error'](_0x2ad936);};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xe0')]=function(_0xe2a345){return _0xe2a345==='Success';};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xe1')]=function(_0x1f4a49){return!_[_0x0cf8('0x44')](_0x1f4a49)&&_0x1f4a49&&!_[_0x0cf8('0x44')](_0x1f4a49[_0x0cf8('0x45')])&&!_[_0x0cf8('0x44')](_0x1f4a49['active'])&&_0x1f4a49[_0x0cf8('0x7b')]&&(this[_0x0cf8('0x27')][util['format']('SIP/%s',_0x1f4a49[_0x0cf8('0x45')])]['status']==='reachable'||this['trunks'][util[_0x0cf8('0x7e')]('SIP/%s',_0x1f4a49[_0x0cf8('0x45')])][_0x0cf8('0xb8')]===_0x0cf8('0xe2'));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xd8')]=function(_0x1bf9db,_0x488b14,_0x8ba81a){this[_0x0cf8('0xd2')](_0x1bf9db)[_0x0cf8('0xb9')](loggerCatch(_0x488b14));this[_0x0cf8('0xd0')](_0x1bf9db)['catch'](loggerCatch(_0x8ba81a));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x3f')]=function(_0x1ea52b){var _0x24c821=this[_0x0cf8('0x2c')][_0x1ea52b[_0x0cf8('0xe3')]];var _0x5bfd95;if(!_[_0x0cf8('0xb6')](_0x1ea52b)&&!_[_0x0cf8('0xb6')](_0x1ea52b[_0x0cf8('0xe4')])&&!_[_0x0cf8('0xb6')](_0x1ea52b[_0x0cf8('0xe4')]['amdstatus'])&&_0x1ea52b[_0x0cf8('0xe5')]==='xcally-motion-dialer'&&_0x24c821){if(_0x24c821['type']!==_0x0cf8('0x96')&&this[_0x0cf8('0x24')][_0x24c821[_0x0cf8('0xbb')]][_0x0cf8('0xe6')]&&_0x1ea52b[_0x0cf8('0xe7')]===_0x0cf8('0xe8')){delete this['uniqueId'][_0x1ea52b[_0x0cf8('0xe3')]];this[_0x0cf8('0xba')](this[_0x0cf8('0x24')][_0x24c821[_0x0cf8('0xbb')]]);this[_0x0cf8('0x24')][_0x24c821['queue']][_0x0cf8('0x61')]+=0x1;this[_0x0cf8('0x24')][_0x24c821[_0x0cf8('0xbb')]][_0x0cf8('0x60')]+=0x1;_0x5bfd95=new Hangup(_0x24c821,_0x1ea52b);_0x5bfd95[_0x0cf8('0xac')]=0x12;_0x5bfd95[_0x0cf8('0xad')]=_0x0cf8('0xe9');_0x5bfd95[_0x0cf8('0xea')]=_0x0cf8('0xeb');this[_0x0cf8('0xd8')](_0x5bfd95,_0x0cf8('0xec'),_0x0cf8('0xed'));}if(_0x24c821[_0x0cf8('0x52')]!==_0x0cf8('0x96')&&this[_0x0cf8('0x24')][_0x24c821[_0x0cf8('0xbb')]][_0x0cf8('0xe6')]&&_0x1ea52b['value']===_0x0cf8('0xee')){var _0x38e604=this;return new BPromise(function(_0x476c3b,_0x2c353e){delete _0x38e604[_0x0cf8('0x2c')][_0x1ea52b['uniqueid']];_0x38e604['updateOriginated'](_0x38e604[_0x0cf8('0x24')][_0x24c821[_0x0cf8('0xbb')]]);_0x38e604['voiceQueues'][_0x24c821[_0x0cf8('0xbb')]][_0x0cf8('0x61')]+=0x1;_0x38e604['voiceQueues'][_0x24c821[_0x0cf8('0xbb')]][_0x0cf8('0x60')]+=0x1;var _0x5eae32=_0x38e604[_0x0cf8('0x24')][_0x24c821[_0x0cf8('0xbb')]];var _0x26d2fc=new Hangup(_0x24c821,_0x1ea52b);_0x26d2fc['state']=0x13;_0x26d2fc[_0x0cf8('0xad')]=_0x0cf8('0xef');_0x26d2fc[_0x0cf8('0xea')]=_0x0cf8('0xeb');_0x26d2fc[_0x0cf8('0xf0')]+=0x1;_0x26d2fc[_0x0cf8('0xf1')]+=0x1;_0x26d2fc[_0x0cf8('0xf2')]=!![];_0x38e604[_0x0cf8('0xd2')](_0x26d2fc)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xf3')));if(_0x26d2fc[_0x0cf8('0xf4')]+_0x26d2fc['countcongestionretry']+_0x26d2fc['countnoanswerretry']+_0x26d2fc[_0x0cf8('0xf5')]+_0x26d2fc['countdropretry']+_0x26d2fc['countabandonedretry']+_0x26d2fc[_0x0cf8('0xf0')]+_0x26d2fc['countagentrejectretry']>=_0x5eae32[_0x0cf8('0xf6')]){_0x38e604['stateGlobal'](_0x26d2fc,_0x476c3b,_0x2c353e,'reason19\x20machine....');}else{if(_0x26d2fc[_0x0cf8('0xf0')]>=_0x5eae32['dialMachineMaxRetry']){_0x38e604['createStateFinal'](_0x26d2fc,_0x476c3b,_0x2c353e,_0x0cf8('0xf7'));}else{_0x38e604['rescheduleContact']({'active':![],'countmachineretry':_0x26d2fc[_0x0cf8('0xf0')],'scheduledat':moment()['add'](_0x5eae32[_0x0cf8('0xf8')],_0x0cf8('0xf9'))['format'](_0x0cf8('0xfa')),'ContactId':_0x26d2fc['ContactId'],'ListId':_0x26d2fc[_0x0cf8('0xfb')],'VoiceQueueId':_0x26d2fc['VoiceQueueId']||undefined,'CampaignId':_0x26d2fc[_0x0cf8('0xfc')]||undefined})['catch'](loggerCatch(_0x0cf8('0xfd')));_0x476c3b({'reschedule':0x1});}}});}if(_0x24c821[_0x0cf8('0x52')]===_0x0cf8('0x96')&&this['campaigns'][_0x24c821[_0x0cf8('0xbb')]][_0x0cf8('0xe6')]&&_0x1ea52b[_0x0cf8('0xe7')]==='HANGUP'){delete this[_0x0cf8('0x2c')][_0x1ea52b[_0x0cf8('0xe3')]];this[_0x0cf8('0xba')](this[_0x0cf8('0x25')][_0x24c821[_0x0cf8('0xbb')]]);_0x5bfd95=new Hangup(_0x24c821,_0x1ea52b);_0x5bfd95[_0x0cf8('0xac')]=0x12;_0x5bfd95['statedesc']='HangupInAMD';_0x5bfd95[_0x0cf8('0xea')]=_0x0cf8('0xeb');this[_0x0cf8('0xd8')](_0x5bfd95,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x24c821[_0x0cf8('0x52')]===_0x0cf8('0x96')&&this[_0x0cf8('0x25')][_0x24c821[_0x0cf8('0xbb')]]['dialAMDActive']&&_0x1ea52b['value']==='MACHINE'){var _0x38e604=this;return new BPromise(function(_0x42fe21,_0x587171){delete _0x38e604[_0x0cf8('0x2c')][_0x1ea52b['uniqueid']];_0x38e604['updateOriginated'](_0x38e604[_0x0cf8('0x25')][_0x24c821[_0x0cf8('0xbb')]]);_0x38e604[_0x0cf8('0x25')][_0x24c821[_0x0cf8('0xbb')]][_0x0cf8('0x61')]+=0x1;_0x38e604[_0x0cf8('0x25')][_0x24c821[_0x0cf8('0xbb')]][_0x0cf8('0x60')]+=0x1;var _0x5642c5=_0x38e604['campaigns'][_0x24c821[_0x0cf8('0xbb')]];var _0x309aca=new Hangup(_0x24c821,_0x1ea52b);_0x309aca[_0x0cf8('0xac')]=0x13;_0x309aca[_0x0cf8('0xad')]=_0x0cf8('0xef');_0x309aca[_0x0cf8('0xea')]=_0x0cf8('0xeb');_0x309aca['countmachineretry']+=0x1;_0x309aca[_0x0cf8('0xf1')]+=0x1;_0x309aca['amd']=!![];_0x38e604['createHistory'](_0x309aca)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xf3')));if(_0x309aca[_0x0cf8('0xf4')]+_0x309aca[_0x0cf8('0xfe')]+_0x309aca[_0x0cf8('0xff')]+_0x309aca[_0x0cf8('0xf5')]+_0x309aca['countdropretry']+_0x309aca['countabandonedretry']+_0x309aca[_0x0cf8('0xf0')]+_0x309aca[_0x0cf8('0x100')]>=_0x5642c5['dialGlobalMaxRetry']){_0x38e604['stateGlobal'](_0x309aca,_0x42fe21,_0x587171,'reason19\x20machine....');}else{if(_0x309aca[_0x0cf8('0xf0')]>=_0x5642c5[_0x0cf8('0x101')]){_0x38e604[_0x0cf8('0x102')](_0x309aca,_0x42fe21,_0x587171,_0x0cf8('0xf7'));}else{_0x38e604[_0x0cf8('0xc8')]({'active':![],'countmachineretry':_0x309aca['countmachineretry'],'scheduledat':moment()[_0x0cf8('0x103')](_0x5642c5['dialMachineRetryFrequency'],_0x0cf8('0xf9'))[_0x0cf8('0x7e')](_0x0cf8('0xfa')),'ContactId':_0x309aca[_0x0cf8('0xdb')],'ListId':_0x309aca[_0x0cf8('0xfb')],'VoiceQueueId':_0x309aca[_0x0cf8('0xdd')]||undefined,'CampaignId':_0x309aca['CampaignId']||undefined})[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xfd')));_0x42fe21({'reschedule':0x1});}}});}}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x3c')]=function(_0x5ea128){var _0x3bed2a=this['uniqueId'][_0x5ea128['uniqueid']];var _0x51007c=this;var _0x17ea0a;if(_0x3bed2a&&_0x3bed2a[_0x0cf8('0x52')]==='ivr'){delete this[_0x0cf8('0x2c')][_0x5ea128[_0x0cf8('0xe3')]];this[_0x0cf8('0xba')](this['campaigns'][_0x3bed2a['queue']]);this['campaigns'][_0x3bed2a[_0x0cf8('0xbb')]][_0x0cf8('0x104')]+=0x1;_0x17ea0a=new Hangup(_0x3bed2a,_0x5ea128);this['createHistory'](_0x17ea0a)[_0x0cf8('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0cf8('0xd0')](_0x17ea0a)[_0x0cf8('0xb9')](loggerCatch('[syncHangupIvr]'));}if(_0x3bed2a&&_0x3bed2a[_0x0cf8('0x52')]!==_0x0cf8('0x96')&&isNotNull(this[_0x0cf8('0x24')][_0x3bed2a['queue']]['dialQueueProject'])){delete this[_0x0cf8('0x2c')][_0x5ea128[_0x0cf8('0xe3')]];this[_0x0cf8('0xba')](this[_0x0cf8('0x24')][_0x3bed2a[_0x0cf8('0xbb')]]);this[_0x0cf8('0x24')][_0x3bed2a[_0x0cf8('0xbb')]][_0x0cf8('0x61')]+=0x1;this[_0x0cf8('0x24')][_0x3bed2a[_0x0cf8('0xbb')]][_0x0cf8('0x60')]+=0x1;_0x17ea0a=new Hangup(_0x3bed2a,_0x5ea128);_0x17ea0a['state']=0x10;_0x17ea0a['statedesc']=_0x0cf8('0x105');_0x17ea0a['membername']=_0x0cf8('0x106');this[_0x0cf8('0xd2')](_0x17ea0a)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x107')));this['moveContactManagedDialer'](_0x17ea0a)[_0x0cf8('0xb9')](loggerCatch('[syncHangupIvr]'));}if(_0x3bed2a&&_0x3bed2a[_0x0cf8('0x52')]!==_0x0cf8('0x96')&&!isNotNull(this[_0x0cf8('0x24')][_0x3bed2a[_0x0cf8('0xbb')]][_0x0cf8('0x108')])){delete this['uniqueId'][_0x5ea128[_0x0cf8('0xe3')]];this[_0x0cf8('0xba')](this['voiceQueues'][_0x3bed2a[_0x0cf8('0xbb')]]);this[_0x0cf8('0x24')][_0x3bed2a[_0x0cf8('0xbb')]][_0x0cf8('0x6b')]+=0x1;_0x17ea0a=new Hangup(_0x3bed2a,_0x5ea128);_0x17ea0a[_0x0cf8('0xac')]=0xc;_0x17ea0a[_0x0cf8('0xad')]=_0x5ea128[_0x0cf8('0x109')];_0x17ea0a[_0x0cf8('0xea')]=_0x0cf8('0x10a');this[_0x0cf8('0xd2')](_0x17ea0a)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x107')));this[_0x0cf8('0xd0')](_0x17ea0a)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x10b')));}};Dialer['prototype'][_0x0cf8('0x10c')]=function(_0x154b12){var _0x513036=this[_0x0cf8('0x2c')][_0x154b12['uniqueid']];var _0x2cb1b7=this;if(this['voiceQueues'][_0x154b12['queue']]){if(_0x513036&&_0x513036[_0x0cf8('0x52')]!=='ivr'){delete this['uniqueId'][_0x154b12[_0x0cf8('0xe3')]];this[_0x0cf8('0x24')][_0x154b12[_0x0cf8('0xbb')]]['outboundAnswerCallsDay']+=0x1;var _0x3334b5=new AgentComplete(_0x513036,_0x154b12);if(_0x154b12[_0x0cf8('0x10d')]===_0x0cf8('0x10e')){_0x3334b5['agiafterat']=this['voiceQueues'][_0x154b12[_0x0cf8('0xbb')]]['dialQueueProject2']&&this[_0x0cf8('0x24')][_0x154b12[_0x0cf8('0xbb')]][_0x0cf8('0x10f')]?moment()['format'](_0x0cf8('0xfa')):undefined;}this['createHistory'](_0x3334b5)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x110')));this[_0x0cf8('0xd0')](_0x3334b5)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x33')]=function(_0x24cbe5){if(this['voiceQueues'][_0x24cbe5[_0x0cf8('0xbb')]]){if(this[_0x0cf8('0x2c')][_0x24cbe5[_0x0cf8('0xe3')]]&&this[_0x0cf8('0x2c')][_0x24cbe5[_0x0cf8('0xe3')]][_0x0cf8('0x52')]!==_0x0cf8('0x96')){this[_0x0cf8('0xba')](this['voiceQueues'][_0x24cbe5[_0x0cf8('0xbb')]]);this['uniqueId'][_0x24cbe5[_0x0cf8('0xe3')]][_0x0cf8('0x111')]=moment()[_0x0cf8('0x7e')](_0x0cf8('0xfa'));}}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x112')]=function(_0x57698e){this['createHistory'](_0x57698e)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x0cf8('0xd0')](_0x57698e)[_0x0cf8('0xb9')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x36')]=function(_0x16db7e){var _0x20b27f=this['uniqueId'][_0x16db7e[_0x0cf8('0xe3')]];var _0x3c877d=this;if(this['voiceQueues'][_0x16db7e[_0x0cf8('0xbb')]]){if(_0x20b27f&&_0x20b27f[_0x0cf8('0x52')]!=='ivr'){delete this[_0x0cf8('0x2c')][_0x16db7e[_0x0cf8('0xe3')]];this['updateOriginated'](this[_0x0cf8('0x24')][_0x16db7e[_0x0cf8('0xbb')]]);_0x20b27f[_0x0cf8('0x113')]=moment()['format'](_0x0cf8('0xfa'));var _0x3c3fe8=new QueueCallerAbandon(_0x20b27f,_0x16db7e);if(getSeconds(_0x20b27f['droptime'],_0x20b27f[_0x0cf8('0x114')])>=_0x20b27f[_0x0cf8('0x115')]){this[_0x0cf8('0x24')][_0x16db7e[_0x0cf8('0xbb')]][_0x0cf8('0x70')]+=0x1;this['voiceQueues'][_0x16db7e['queue']][_0x0cf8('0x67')]+=0x1;this[_0x0cf8('0x24')][_0x16db7e[_0x0cf8('0xbb')]][_0x0cf8('0x116')]+=0x1;_0x3c3fe8[_0x0cf8('0xac')]=0xa;_0x3c3fe8[_0x0cf8('0xad')]=_0x0cf8('0x117');_0x3c3fe8[_0x0cf8('0x118')]=_0x0cf8('0x119');_0x3c3fe8[_0x0cf8('0x11a')]=this[_0x0cf8('0x24')][_0x16db7e['queue']][_0x0cf8('0x11b')]?moment()[_0x0cf8('0x7e')](_0x0cf8('0xfa')):undefined;_0x3c3fe8[_0x0cf8('0x11c')]+=0x1;_0x3c3fe8[_0x0cf8('0xf1')]+=0x1;if(_0x3c3fe8[_0x0cf8('0x11c')]>=this[_0x0cf8('0x24')][_0x16db7e[_0x0cf8('0xbb')]][_0x0cf8('0x11d')]){this[_0x0cf8('0x112')](_0x3c3fe8);}else{this[_0x0cf8('0xc8')]({'active':![],'countdropretry':_0x3c3fe8['countdropretry'],'scheduledat':moment()['add'](this[_0x0cf8('0x24')][_0x16db7e['queue']][_0x0cf8('0x11e')],'minutes')['format'](_0x0cf8('0xfa')),'ContactId':_0x20b27f[_0x0cf8('0xdb')],'ListId':_0x20b27f[_0x0cf8('0xfb')],'VoiceQueueId':_0x20b27f['VoiceQueueId']||undefined,'CampaignId':_0x20b27f[_0x0cf8('0xfc')]||undefined})[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x11f')));var _0x1f083f=new History(_0x3c3fe8);_0x1f083f[_0x0cf8('0xac')]=0xa;_0x1f083f[_0x0cf8('0xad')]='Drop';_0x1f083f[_0x0cf8('0xaf')]=moment()[_0x0cf8('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f083f[_0x0cf8('0xae')]=_0x1f083f[_0x0cf8('0xaf')];_0x1f083f[_0x0cf8('0x120')]=_0x3c3fe8['calleridname'];_0x1f083f['calleridnum']=_0x3c3fe8['calleridnum'];this[_0x0cf8('0xd2')](_0x1f083f)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x121')));}}else{this['voiceQueues'][_0x16db7e[_0x0cf8('0xbb')]][_0x0cf8('0x6f')]+=0x1;this[_0x0cf8('0x24')][_0x16db7e[_0x0cf8('0xbb')]][_0x0cf8('0x66')]+=0x1;_0x3c3fe8[_0x0cf8('0xac')]=0xb;_0x3c3fe8['statedesc']=_0x0cf8('0x122');_0x3c3fe8[_0x0cf8('0x118')]='CALLEREXIT';_0x3c3fe8['countabandonedretry']+=0x1;_0x3c3fe8[_0x0cf8('0xf1')]+=0x1;if(_0x3c3fe8[_0x0cf8('0x123')]>=this[_0x0cf8('0x24')][_0x16db7e[_0x0cf8('0xbb')]][_0x0cf8('0x124')]){this['queueCallerAbandonCreateState'](_0x3c3fe8);}else{this[_0x0cf8('0xc8')]({'active':![],'countabandonedretry':_0x3c3fe8[_0x0cf8('0x123')],'scheduledat':moment()[_0x0cf8('0x103')](this[_0x0cf8('0x24')][_0x16db7e['queue']][_0x0cf8('0x125')],'minutes')[_0x0cf8('0x7e')](_0x0cf8('0xfa')),'ContactId':_0x20b27f[_0x0cf8('0xdb')],'ListId':_0x20b27f[_0x0cf8('0xfb')],'VoiceQueueId':_0x20b27f[_0x0cf8('0xdd')]||undefined,'CampaignId':_0x20b27f[_0x0cf8('0xfc')]||undefined})[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x126')));var _0x1f083f=new History(_0x3c3fe8);_0x1f083f[_0x0cf8('0xac')]=0xb;_0x1f083f[_0x0cf8('0xad')]='Abandoned';_0x1f083f[_0x0cf8('0xaf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1f083f['endtime']=_0x1f083f[_0x0cf8('0xaf')];_0x1f083f[_0x0cf8('0x120')]=_0x3c3fe8[_0x0cf8('0x120')];_0x1f083f[_0x0cf8('0x127')]=_0x3c3fe8[_0x0cf8('0x127')];this['createHistory'](_0x1f083f)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x128')));}}}}};Dialer[_0x0cf8('0xb0')]['syncNewExten']=function(_0x10539d){if(this['actions'][_0x10539d[_0x0cf8('0xe3')]]){this[_0x0cf8('0x2a')][_0x10539d['uniqueid']][_0x0cf8('0x129')]=_0x10539d[_0x0cf8('0x129')];}if(this['uniqueId'][_0x10539d['uniqueid']]){this[_0x0cf8('0x2c')][_0x10539d['uniqueid']][_0x0cf8('0x129')]=_0x10539d[_0x0cf8('0x129')];}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x40')]=function(_0x5c785e){if(strategy[this[_0x0cf8('0x24')][this['actions'][_0x5c785e[_0x0cf8('0x12a')]]['queue']][_0x0cf8('0x54')]]===_0x0cf8('0x1f')){if(this[_0x0cf8('0x2a')][_0x5c785e[_0x0cf8('0x12a')]]&&_[_0x0cf8('0xb6')](this['actions'][_0x5c785e[_0x0cf8('0x12a')]][_0x0cf8('0x12b')])&&_0x5c785e[_0x0cf8('0xb8')]==='1'&&_0x5c785e[_0x0cf8('0x12c')]==='0'){if(this[_0x0cf8('0x26')][_0x5c785e[_0x0cf8('0x12d')]]){if(!this['agents'][_0x5c785e['stateinterface']][_0x0cf8('0x12b')]){this[_0x0cf8('0x26')][_0x5c785e[_0x0cf8('0x12d')]][_0x0cf8('0x12b')]=!![];this['actions'][_0x5c785e['actionid']]['locked']=!![];this[_0x0cf8('0x2a')][_0x5c785e[_0x0cf8('0x12a')]][_0x0cf8('0x12d')]=_0x5c785e[_0x0cf8('0x12d')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x5c785e[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]][_0x0cf8('0x54')]]||'rrmemory')==='rrmemory'){if(this[_0x0cf8('0x2a')][_0x5c785e['actionid']]){if(this[_0x0cf8('0x26')][_0x5c785e[_0x0cf8('0x12d')]]){this['actions'][_0x5c785e[_0x0cf8('0x12a')]]['stateinterface']=_0x5c785e['stateinterface'];if(_[_0x0cf8('0xb6')](this[_0x0cf8('0x30')][this[_0x0cf8('0x2a')][_0x5c785e[_0x0cf8('0x12a')]]['queue']])){this[_0x0cf8('0x30')][this['actions'][_0x5c785e[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]]=[];}this[_0x0cf8('0x30')][this[_0x0cf8('0x2a')][_0x5c785e['actionid']][_0x0cf8('0xbb')]][_0x0cf8('0x12e')](_[_0x0cf8('0xd9')](_[_0x0cf8('0xda')](this['actions'][_0x5c785e['actionid']],[_0x0cf8('0x12f'),_0x0cf8('0x12d')]),{'status':_0x5c785e['status'],'paused':_0x5c785e[_0x0cf8('0x12c')]}));}}}};function unlockQueueStatus(_0x314a00,_0x1f29d8){setTimeout(function(){if(_[_0x0cf8('0x44')](_0x314a00[_0x0cf8('0x130')])){loggerBooked[_0x0cf8('0x9a')]('[unlockQueueStatus][undefined]',_0x1f29d8);}_0x314a00['queueStatusComplete']=!![];loggerBooked[_0x0cf8('0x82')](_0x0cf8('0x131'),_0x1f29d8,JSON[_0x0cf8('0x7d')](_[_0x0cf8('0xda')](_0x314a00,[_0x0cf8('0x45'),_0x0cf8('0x130')])));},0x1f3);}Dialer[_0x0cf8('0xb0')][_0x0cf8('0x42')]=function(_0x281a5a){var _0x1e1d83=this;var _0x19930c=_0x1e1d83[_0x0cf8('0x24')][_0x1e1d83[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]];if(strategy[this['voiceQueues'][this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]][_0x0cf8('0x54')]]===_0x0cf8('0x1f')){if(this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]]&&this['actions'][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0x12d')]){this[_0x0cf8('0x23')][_0x0cf8('0x132')](this['actions'][_0x281a5a[_0x0cf8('0x12a')]]['idHopper'],this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0x12d')])[_0x0cf8('0xb9')](function(_0x3f3c29){logger[_0x0cf8('0x9a')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x0cf8('0x9c')](_0x3f3c29,{'showHidden':![],'depth':null}));})[_0x0cf8('0x21')](function(){_0x1e1d83['updateOriginated'](_0x1e1d83[_0x0cf8('0x24')][_0x1e1d83['actions'][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]]);_0x1e1d83[_0x0cf8('0x26')][_0x1e1d83[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0x12d')]][_0x0cf8('0x12b')]=![];delete _0x1e1d83[_0x0cf8('0x2a')][_0x281a5a['actionid']];unlockQueueStatus(_0x19930c);});}else{this['updateOriginated'](this[_0x0cf8('0x24')][this['actions'][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]]);this[_0x0cf8('0xc8')]({'active':![],'ContactId':this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]]['ContactId'],'ListId':this['actions'][_0x281a5a['actionid']][_0x0cf8('0xfb')],'VoiceQueueId':this['actions'][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xdd')]||undefined,'CampaignId':this[_0x0cf8('0x2a')][_0x281a5a['actionid']]['CampaignId']||undefined})[_0x0cf8('0xb9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x281a5a[_0x0cf8('0x12a')]];unlockQueueStatus(_0x19930c);}}else if((strategy[this['voiceQueues'][this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]][_0x0cf8('0x54')]]||_0x0cf8('0x1e'))===_0x0cf8('0x1e')){var _0x212d4c;if(this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]]&&!_[_0x0cf8('0x4e')](this['queueBooked'][this[_0x0cf8('0x2a')][_0x281a5a['actionid']][_0x0cf8('0xbb')]])){if(this['queueBookedRR'][_0x1e1d83['actions'][_0x281a5a['actionid']][_0x0cf8('0xbb')]]){this['queueBookedRR'][_0x1e1d83[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]]=this[_0x0cf8('0x31')][this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]]?this[_0x0cf8('0x31')][this[_0x0cf8('0x2a')][_0x281a5a['actionid']][_0x0cf8('0xbb')]]:this[_0x0cf8('0x30')][this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]]['queue']]?this[_0x0cf8('0x30')][this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]][_0x0cf8('0x133')]||0x0:0x0;}this[_0x0cf8('0x30')][this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]][_0x0cf8('0xbb')]][_0x0cf8('0x133')]=this['queueBookedRR'][this[_0x0cf8('0x2a')][_0x281a5a[_0x0cf8('0x12a')]]['queue']];for(var _0x3d95a2=0x0;_0x3d95a2=0x0?!![]:![];})[_0x0cf8('0xb9')](myreject(_0x23abf9)));}}else{_0x1855e5[_0x0cf8('0x12e')](ami[_0x0cf8('0xb7')]({'action':_0x0cf8('0x14a'),'command':util[_0x0cf8('0x7e')](_0x0cf8('0x14b'),_0x15cb85,!_[_0x0cf8('0x44')](config[_0x0cf8('0x147')][_0x3e2524])?_0x3e2524:'')})['then'](function(_0x173058){return _0x173058[_0x0cf8('0x14c')][_0x0cf8('0x14e')](_0x0cf8('0x14d'))>=0x0?!![]:![];})[_0x0cf8('0xb9')](myreject(_0x23abf9)));}BPromise['all'](_0x1855e5)[_0x0cf8('0xc2')](function(_0x2bb08d){var _0x2ad001=_[_0x0cf8('0x14f')](_0x2bb08d);if(_0x2ad001){return _0x387cb3(_0x2ad001);}else{_0xdc3bb2[_0x0cf8('0x4a')]=_0x4b5529?_0x0cf8('0x150'):_0x0cf8('0x151');return _0x23abf9(msgResponse(_0x0cf8('0x152'),_0x0cf8('0x144'),_0x0cf8('0x153')+_0x4b5529+'\x20'+_0x275158+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0cf8('0x9c')](_0x15cb85,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3e2524));}})[_0x0cf8('0xb9')](function(_0x296636){return _0x23abf9(msgResponse('ifTime',_0x0cf8('0x144'),JSON['stringify'](_0x296636)));});});};Dialer[_0x0cf8('0xb0')]['checkDialMethod']=function(_0x4fbb27){var _0x17c20c=this;return function(){switch(_0x4fbb27[_0x0cf8('0x5e')]){case _0x0cf8('0x154'):freeVariablesPredictive(_0x4fbb27);_0x17c20c[_0x0cf8('0x155')](_0x4fbb27,0x1);break;case _0x0cf8('0x156'):freeVariablesPredictive(_0x4fbb27);_0x17c20c[_0x0cf8('0x155')](_0x4fbb27,_0x4fbb27[_0x0cf8('0x157')]);break;case _0x0cf8('0x8'):_0x17c20c[_0x0cf8('0x8')](_0x4fbb27);break;case'booked':freeVariablesPredictive(_0x4fbb27);_0x17c20c[_0x0cf8('0x155')](_0x4fbb27,0x1);break;default:freeVariablesPredictive(_0x4fbb27);logger[_0x0cf8('0x9a')](_0x0cf8('0x158'),_0x4fbb27['name'],_0x0cf8('0x159'));}};};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x15a')]=function(_0x3d29f2){var _0x3b886c=this;return function(){_0x3b886c['handleIvr'](_0x3d29f2);};};Dialer[_0x0cf8('0xb0')][_0x0cf8('0xa')]=function(_0x6c514e){var _0x26150c=this;if(isNotPreview(_0x6c514e['dialMethod'])){if(isVoiceQueueOutbound(_0x6c514e[_0x0cf8('0x52')])&&isActive(_0x6c514e[_0x0cf8('0x5d')])){_0x6c514e[_0x0cf8('0xa6')]=!![];BPromise[_0x0cf8('0xbf')]()[_0x0cf8('0xc2')](checkIsLoggedIn(_0x6c514e,_0x6c514e[_0x0cf8('0x56')]))[_0x0cf8('0xc2')](checkIsActive(_0x6c514e,_0x6c514e[_0x0cf8('0x5d')]))[_0x0cf8('0xc2')](checkInterval(_0x6c514e))[_0x0cf8('0xc2')](_0x26150c[_0x0cf8('0x13d')](_0x6c514e))[_0x0cf8('0xc2')](_0x26150c[_0x0cf8('0x141')](_0x6c514e[_0x0cf8('0x15b')],_0x6c514e[_0x0cf8('0x15c')],_0x6c514e[_0x0cf8('0x45')],_0x6c514e))[_0x0cf8('0xc2')](_0x26150c[_0x0cf8('0x143')](_0x6c514e[_0x0cf8('0x49')],_0x6c514e[_0x0cf8('0x15c')],_0x6c514e[_0x0cf8('0x45')],_0x6c514e))['then'](_0x26150c[_0x0cf8('0x15d')](_0x6c514e))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x6c514e));}else{notSendMessagesQueue(_0x6c514e);}}else{freeVariablesPredictive(_0x6c514e);}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x15e')]=function(){var _0x231994=this;var _0x429803;for(var _0x1c7b3b in this[_0x0cf8('0x25')]){if(this[_0x0cf8('0x25')][_0x0cf8('0x9e')](_0x1c7b3b)){_0x429803=this['campaigns'][_0x1c7b3b];if(isCampaignIvr(_0x429803[_0x0cf8('0x52')])&&isActive(_0x429803[_0x0cf8('0x7b')])){_0x429803[_0x0cf8('0xa6')]=!![];BPromise[_0x0cf8('0xbf')]()['then'](checkIsActive(_0x429803,_0x429803[_0x0cf8('0x7b')]))[_0x0cf8('0xc2')](checkInterval(_0x429803))[_0x0cf8('0xc2')](_0x231994[_0x0cf8('0x13d')](_0x429803))[_0x0cf8('0xc2')](_0x231994[_0x0cf8('0x141')](_0x429803[_0x0cf8('0x15b')],_0x429803[_0x0cf8('0x15c')],_0x429803['name'],_0x429803))[_0x0cf8('0xc2')](_0x231994[_0x0cf8('0x143')](_0x429803[_0x0cf8('0x49')],_0x429803[_0x0cf8('0x15c')],_0x429803['name'],_0x429803))[_0x0cf8('0xc2')](_0x231994[_0x0cf8('0x15a')](_0x429803))[_0x0cf8('0xb9')](loggerCatchQueueSummary(_0x0cf8('0x15f'),_0x429803));}else{notSendMessagesCampaign(_0x429803);}}}};function getCallerIdRandom(_0x536505,_0x355e20){var _0x34ef36,_0x10cea9,_0x2c955a;if(_0x355e20<=0x0){_0x355e20=0x1;}_0x34ef36=new RegExp(_0x0cf8('0x160')+_0x355e20+'}$');_0x10cea9=Math[_0x0cf8('0x161')](0xa,_0x355e20-0x1);_0x2c955a=Math[_0x0cf8('0x161')](0xa,_0x355e20)-0x1;return util['format']('%s',_['replace'](_0x536505,_0x34ef36,_[_0x0cf8('0x162')](_0x10cea9,_0x2c955a)));}function extractCalleridName(_0x9c8d04){var _0x40890f=_0x9c8d04[_0x0cf8('0x163')](/"(.*?)"/);return _0x40890f?_0x40890f[0x1]:_0x9c8d04;}function extractCalleridNumber(_0x4be96a){var _0xa51741=_0x4be96a['match'](/<(.*?)>/);return _0xa51741?_0xa51741[0x1]:_0x4be96a;}Dialer[_0x0cf8('0xb0')][_0x0cf8('0x164')]=function(_0xa1c9cf,_0x2fb40e){var _0x1ae2f3=this;var _0x2595bd=uuid['v4']();this[_0x0cf8('0x2a')][_0x2595bd]=new Action(_0xa1c9cf,_0x2fb40e,_0x2595bd);return new BPromise(function(_0x3126b5,_0x22dec5){if(_['isUndefined'](_0xa1c9cf)&&_0x0cf8('0x165')!==typeof _0xa1c9cf){return _0x22dec5(msgResponse(_0x0cf8('0x166'),_0x0cf8('0x144'),_0x0cf8('0x167')));}if(_[_0x0cf8('0x44')](_0x2fb40e[_0x0cf8('0x168')][_0x0cf8('0x169')])||_0x2fb40e[_0x0cf8('0x168')][_0x0cf8('0x169')]===null){return _0x22dec5(msgResponse(_0x0cf8('0x166'),_0x0cf8('0x144'),'contact\x20is\x20undefine'));}var _0x21deaa={'XMD-CALLERID':_0x1ae2f3[_0x0cf8('0x2a')][_0x2595bd]['getCaller'](),'XMD-AGI':_0xa1c9cf[_0x0cf8('0x108')]?util[_0x0cf8('0x7e')](_0x0cf8('0x16a'),ipAgi,_0xa1c9cf[_0x0cf8('0x108')]):_0x0cf8('0x16b'),'XMD-AGIAFTER':_0xa1c9cf[_0x0cf8('0x11b')]?util['format'](_0x0cf8('0x16a'),ipAgi,_0xa1c9cf['dialQueueProject2']):_0x0cf8('0x16b'),'XMD-QUEUE':_0xa1c9cf[_0x0cf8('0x52')]===_0x0cf8('0x53')?util[_0x0cf8('0x7e')](_0x0cf8('0x16c'),_0xa1c9cf[_0x0cf8('0x45')],_0xa1c9cf[_0x0cf8('0x16d')]||'',_0xa1c9cf[_0x0cf8('0x10f')]?'c':'',_0xa1c9cf[_0x0cf8('0x115')]||0x3):_0x0cf8('0x16b'),'XMD-CONTACTID':_0x2fb40e[_0x0cf8('0xdb')],'XMD-CDRTYPE':_0x0cf8('0x6'),'CALLERID(all)':_0x1ae2f3[_0x0cf8('0x2a')][_0x2595bd][_0x0cf8('0x16e')](),'XMD-AMD':_0xa1c9cf[_0x0cf8('0xe6')]?_0x0cf8('0x16f'):_0x0cf8('0x16b'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xa1c9cf['dialAMDActive']){_0x21deaa[_0x0cf8('0x170')]=_0xa1c9cf[_0x0cf8('0x171')]||0x9c4;_0x21deaa[_0x0cf8('0x172')]=_0xa1c9cf[_0x0cf8('0x173')]||0x5dc;_0x21deaa[_0x0cf8('0x174')]=_0xa1c9cf['dialAMDAfterGreetingSilence']||0x320;_0x21deaa['XMD-AMDTOTALANALYSISTIME']=_0xa1c9cf['dialAMDTotalAnalysisTime']||0x1388;_0x21deaa[_0x0cf8('0x175')]=_0xa1c9cf[_0x0cf8('0x176')]||0x64;_0x21deaa[_0x0cf8('0x177')]=_0xa1c9cf[_0x0cf8('0x178')]||0x32;_0x21deaa['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xa1c9cf['dialAMDMaximumNumberOfWords']||0x3;_0x21deaa[_0x0cf8('0x179')]=_0xa1c9cf[_0x0cf8('0x17a')]||0x100;_0x21deaa[_0x0cf8('0x17b')]=_0xa1c9cf[_0x0cf8('0x17c')]||0x1388;}if(_0xa1c9cf[_0x0cf8('0x52')]===_0x0cf8('0x53')){_0x21deaa[_0x0cf8('0x17d')]=_0x2fb40e[_0x0cf8('0xdd')];}else{_0x21deaa[_0x0cf8('0x17e')]=_0x2fb40e[_0x0cf8('0xfc')];}for(var _0x144efd in _0x2fb40e['Contact']){if(_0x2fb40e[_0x0cf8('0x168')][_0x0cf8('0x9e')](_0x144efd)){if(isNotNull(_0x2fb40e[_0x0cf8('0x168')][_0x144efd])&&_0x144efd!=='id'&&_0x144efd!==_0x0cf8('0x17f')&&_0x144efd!==_0x0cf8('0x180')&&_0x144efd!=='updatedAt'){_0x21deaa[util[_0x0cf8('0x7e')](_0x0cf8('0x181'),_0x0cf8('0x182'),_[_0x0cf8('0x183')](_0x144efd))]=_0x2fb40e[_0x0cf8('0x168')][_0x144efd];}}}var _0x2030fe=_0x1ae2f3[_0x0cf8('0xe1')](_0xa1c9cf['Trunk'])?getCallerId(_0xa1c9cf[_0x0cf8('0x7a')][_0x0cf8('0x7c')],_0xa1c9cf['dialOriginateCallerIdName'],_0xa1c9cf[_0x0cf8('0x184')]>0x0?getCallerIdRandom(_0xa1c9cf['dialOriginateCallerIdNumber'],_0xa1c9cf[_0x0cf8('0x184')]):_0xa1c9cf['dialOriginateCallerIdNumber']):getCallerId(_[_0x0cf8('0xb6')](_0xa1c9cf[_0x0cf8('0x13e')])?_0xa1c9cf[_0x0cf8('0x7a')][_0x0cf8('0x7c')]:_0xa1c9cf['TrunkBackup'][_0x0cf8('0x7c')],_0xa1c9cf['dialOriginateCallerIdName'],_0xa1c9cf['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xa1c9cf[_0x0cf8('0x185')],_0xa1c9cf[_0x0cf8('0x184')]):_0xa1c9cf[_0x0cf8('0x185')]);if(_0x2030fe){_0x21deaa['XMD-ORIGINATECALLERIDNAME']=_0x1ae2f3['actions'][_0x2595bd][_0x0cf8('0x186')]=extractCalleridName(_0x2030fe);_0x21deaa[_0x0cf8('0x187')]=_0x1ae2f3['actions'][_0x2595bd][_0x0cf8('0x188')]=extractCalleridNumber(_0x2030fe);}return ami[_0x0cf8('0xb7')]({'actionid':_0x2595bd,'action':'originate','channel':_0x1ae2f3[_0x0cf8('0xe1')](_0xa1c9cf['Trunk'])?util[_0x0cf8('0x7e')](_0x0cf8('0x189'),_0xa1c9cf['Trunk'][_0x0cf8('0x45')],isNotNull(_0xa1c9cf['dialPrefix'])?_0xa1c9cf[_0x0cf8('0x18a')][_0x0cf8('0x18b')]()||'':'',_0xa1c9cf[_0x0cf8('0x18c')]>0x0?_0x2fb40e[_0x0cf8('0x168')][_0x0cf8('0x169')]['substring'](_0xa1c9cf[_0x0cf8('0x18c')]):_0x2fb40e['Contact'][_0x0cf8('0x169')]):util[_0x0cf8('0x7e')]('SIP/%s/%s%s',_[_0x0cf8('0xb6')](_0xa1c9cf[_0x0cf8('0x13e')])?_0xa1c9cf['Trunk'][_0x0cf8('0x45')]:_0xa1c9cf['TrunkBackup']['name'],isNotNull(_0xa1c9cf[_0x0cf8('0x18a')])?_0xa1c9cf[_0x0cf8('0x18a')][_0x0cf8('0x18b')]()||'':'',_0xa1c9cf[_0x0cf8('0x18c')]>0x0?_0x2fb40e[_0x0cf8('0x168')][_0x0cf8('0x169')][_0x0cf8('0x18d')](_0xa1c9cf[_0x0cf8('0x18c')]):_0x2fb40e[_0x0cf8('0x168')][_0x0cf8('0x169')]),'callerid':_0x2030fe,'Exten':'xcally-motion-dialer','Context':_0x0cf8('0x18e'),'Priority':'1','variable':_0x21deaa,'timeout':(_0xa1c9cf[_0x0cf8('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2595bd})['then'](function(_0x37b2be){return _0x3126b5(_0x37b2be);})[_0x0cf8('0xb9')](function(_0x41beac){_0xa1c9cf['outboundOriginateFailureCallsDay']+=0x1;var _0x11fd9e=new History(_0x1ae2f3['actions'][_0x2595bd]);logger[_0x0cf8('0x9a')](util[_0x0cf8('0x7e')](_0x0cf8('0x18f'),JSON[_0x0cf8('0x7d')](_0x41beac)));_0x11fd9e['state']=0xe;_0x11fd9e[_0x0cf8('0xad')]=_0x0cf8('0x190');_0x11fd9e[_0x0cf8('0xaf')]=moment()[_0x0cf8('0x7e')](_0x0cf8('0xfa'));_0x11fd9e['endtime']=_0x11fd9e[_0x0cf8('0xaf')];_0x1ae2f3[_0x0cf8('0xd2')](_0x11fd9e)['catch'](loggerCatch(_0x0cf8('0x191')));_0x1ae2f3['moveContactManagedDialer'](_0x11fd9e)['catch'](loggerCatch(_0x0cf8('0x191')))[_0x0cf8('0x21')](function(){delete _0x1ae2f3[_0x0cf8('0x2a')][_0x2595bd];return _0x22dec5(msgResponse(_0x0cf8('0x166'),_0x0cf8('0x192'),_0x0cf8('0x193')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x2fb6be){var _0x2366bc=this[_0x0cf8('0x2a')][_0x2fb6be[_0x0cf8('0x12a')]];var _0x1e0db5=this;if(_0x2366bc){delete this[_0x0cf8('0x2a')][_0x2fb6be[_0x0cf8('0x12a')]];_0x2366bc[_0x0cf8('0x114')]=moment()[_0x0cf8('0x7e')](_0x0cf8('0xfa'));var _0x41f842=_0x2366bc[_0x0cf8('0x52')]==='ivr'?this[_0x0cf8('0x25')][_0x2366bc[_0x0cf8('0xbb')]]:this[_0x0cf8('0x24')][_0x2366bc[_0x0cf8('0x194')]()];if(!this[_0x0cf8('0xe0')](_0x2fb6be[_0x0cf8('0x195')])){this[_0x0cf8('0xba')](_0x41f842);return this[_0x0cf8('0x196')](_0x2366bc,_0x41f842,_0x2fb6be)[_0x0cf8('0xc2')](function(_0x3a791c){})[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x197')));}else{this['uniqueId'][_0x2fb6be['uniqueid']]=_0x2366bc;}}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x198')]=function(_0x3270c6,_0x390f57,_0x1c13b6){var _0x6ec0aa=new History(_0x390f57);if(_0x6ec0aa[_0x0cf8('0xf4')]+_0x6ec0aa[_0x0cf8('0xfe')]+_0x6ec0aa[_0x0cf8('0xff')]+_0x6ec0aa[_0x0cf8('0xf5')]+_0x6ec0aa['countdropretry']+_0x6ec0aa['countabandonedretry']+_0x6ec0aa[_0x0cf8('0xf0')]+_0x6ec0aa[_0x0cf8('0x100')]>=_0x1c13b6[_0x0cf8('0xf6')]-0x1){return!![];}switch(_0x3270c6){case 0x3:if(_0x6ec0aa['countnoanswerretry']>=_0x1c13b6[_0x0cf8('0x199')]-0x1){return!![];}else{this[_0x0cf8('0xc8')]({'active':![],'countnoanswerretry':_0x6ec0aa[_0x0cf8('0xff')]+=0x1,'scheduledat':moment()['add'](_0x1c13b6[_0x0cf8('0x19a')],_0x0cf8('0xf9'))[_0x0cf8('0x7e')](_0x0cf8('0xfa')),'ContactId':_0x6ec0aa[_0x0cf8('0xdb')],'ListId':_0x6ec0aa[_0x0cf8('0xfb')],'VoiceQueueId':_0x6ec0aa[_0x0cf8('0xdd')]||undefined,'CampaignId':_0x6ec0aa['CampaignId']||undefined})['catch'](loggerCatch(_0x0cf8('0x19b')));}break;case 0x5:if(_0x6ec0aa['countbusyretry']>=_0x1c13b6[_0x0cf8('0x19c')]-0x1){return!![];}else{this[_0x0cf8('0xc8')]({'active':![],'countbusyretry':_0x6ec0aa['countbusyretry']+=0x1,'scheduledat':moment()[_0x0cf8('0x103')](_0x1c13b6[_0x0cf8('0x19d')],_0x0cf8('0xf9'))[_0x0cf8('0x7e')](_0x0cf8('0xfa')),'ContactId':_0x6ec0aa[_0x0cf8('0xdb')],'ListId':_0x6ec0aa['ListId'],'VoiceQueueId':_0x6ec0aa['VoiceQueueId']||undefined,'CampaignId':_0x6ec0aa[_0x0cf8('0xfc')]||undefined})['catch'](loggerCatch(_0x0cf8('0x19e')));}break;case 0x8:if(_0x6ec0aa[_0x0cf8('0xfe')]>=_0x1c13b6['dialCongestionMaxRetry']-0x1){return!![];}else{this[_0x0cf8('0xc8')]({'active':![],'countcongestionretry':_0x6ec0aa['countcongestionretry']+=0x1,'scheduledat':moment()[_0x0cf8('0x103')](_0x1c13b6[_0x0cf8('0x19f')],'minutes')[_0x0cf8('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6ec0aa['ContactId'],'ListId':_0x6ec0aa[_0x0cf8('0xfb')],'VoiceQueueId':_0x6ec0aa[_0x0cf8('0xdd')]||undefined,'CampaignId':_0x6ec0aa[_0x0cf8('0xfc')]||undefined})['catch'](loggerCatch(_0x0cf8('0x1a0')));}break;case 0x0:if(_0x6ec0aa[_0x0cf8('0xf5')]>=_0x1c13b6['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x6ec0aa[_0x0cf8('0xf5')]+=0x1,'scheduledat':moment()[_0x0cf8('0x103')](_0x1c13b6[_0x0cf8('0x1a1')],_0x0cf8('0xf9'))[_0x0cf8('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6ec0aa[_0x0cf8('0xdb')],'ListId':_0x6ec0aa[_0x0cf8('0xfb')],'VoiceQueueId':_0x6ec0aa[_0x0cf8('0xdd')]||undefined,'CampaignId':_0x6ec0aa[_0x0cf8('0xfc')]||undefined})[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x1a2')));}break;case 0xa:if(_0x6ec0aa[_0x0cf8('0x11c')]>=_0x1c13b6[_0x0cf8('0x11d')]-0x1){return!![];}else{this[_0x0cf8('0xc8')]({'active':![],'countdropretry':_0x6ec0aa[_0x0cf8('0x11c')]+=0x1,'scheduledat':moment()[_0x0cf8('0x103')](_0x1c13b6['dialDropRetryFrequency'],_0x0cf8('0xf9'))[_0x0cf8('0x7e')](_0x0cf8('0xfa')),'ContactId':_0x6ec0aa[_0x0cf8('0xdb')],'ListId':_0x6ec0aa[_0x0cf8('0xfb')],'VoiceQueueId':_0x6ec0aa['VoiceQueueId']||undefined,'CampaignId':_0x6ec0aa[_0x0cf8('0xfc')]||undefined})[_0x0cf8('0xb9')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x6ec0aa['countabandonedretry']>=_0x1c13b6[_0x0cf8('0x124')]-0x1){return!![];}else{this[_0x0cf8('0xc8')]({'active':![],'countabandonedretry':_0x6ec0aa[_0x0cf8('0x123')]+=0x1,'scheduledat':moment()[_0x0cf8('0x103')](_0x1c13b6[_0x0cf8('0x125')],_0x0cf8('0xf9'))[_0x0cf8('0x7e')](_0x0cf8('0xfa')),'ContactId':_0x6ec0aa[_0x0cf8('0xdb')],'ListId':_0x6ec0aa[_0x0cf8('0xfb')],'VoiceQueueId':_0x6ec0aa[_0x0cf8('0xdd')]||undefined,'CampaignId':_0x6ec0aa[_0x0cf8('0xfc')]||undefined})['catch'](loggerCatch(_0x0cf8('0x126')));}break;case 0x13:if(_0x6ec0aa[_0x0cf8('0xf0')]>=_0x1c13b6[_0x0cf8('0x101')]-0x1){return!![];}else{this[_0x0cf8('0xc8')]({'active':![],'countmachineretry':_0x6ec0aa['countmachineretry']+=0x1,'scheduledat':moment()[_0x0cf8('0x103')](_0x1c13b6[_0x0cf8('0xf8')],_0x0cf8('0xf9'))[_0x0cf8('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6ec0aa['ContactId'],'ListId':_0x6ec0aa[_0x0cf8('0xfb')],'VoiceQueueId':_0x6ec0aa[_0x0cf8('0xdd')]||undefined,'CampaignId':_0x6ec0aa[_0x0cf8('0xfc')]||undefined})[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xfd')));}break;case 0x14:if(_0x6ec0aa[_0x0cf8('0x100')]>=_0x1c13b6['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0x0cf8('0xc8')]({'active':![],'countagentrejectretry':_0x6ec0aa[_0x0cf8('0x100')]+=0x1,'scheduledat':moment()['add'](_0x1c13b6[_0x0cf8('0x1a3')],_0x0cf8('0xf9'))['format'](_0x0cf8('0xfa')),'ContactId':_0x6ec0aa[_0x0cf8('0xdb')],'ListId':_0x6ec0aa[_0x0cf8('0xfb')],'VoiceQueueId':_0x6ec0aa['VoiceQueueId']||undefined,'CampaignId':_0x6ec0aa[_0x0cf8('0xfc')]||undefined})[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x1a4')));}break;default:return!![];}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x196')]=function(_0x177c47,_0xd145d,_0x175a4b){var _0x5570c1=this;var _0x59c6f6=new History(_0x177c47);return new BPromise(function(_0x5f539f,_0x5dd2c6){if(_[_0x0cf8('0x44')](_0xd145d)&&'object'!==typeof _0xd145d){return _0x5dd2c6(msgResponse(_0x0cf8('0x1a5'),'Failure',_0x0cf8('0x1a6')));}if(_['isUndefined'](_0x175a4b)&&_0x0cf8('0x165')!==typeof _0x175a4b){return _0x5dd2c6(msgResponse(_0x0cf8('0x1a5'),_0x0cf8('0x144'),_0x0cf8('0x1a7')));}switch(_0x175a4b[_0x0cf8('0x10d')]){case'0':_0xd145d[_0x0cf8('0x69')]+=0x1;_0x59c6f6[_0x0cf8('0xac')]=0x0;_0x59c6f6[_0x0cf8('0xad')]='NoSuchNumber';_0x59c6f6[_0x0cf8('0xf5')]+=0x1;_0x59c6f6[_0x0cf8('0xf1')]+=0x1;ami[_0x0cf8('0x1a8')](_0x0cf8('0x1a9'),ut[_0x0cf8('0x1aa')](_0x177c47,_0x0cf8('0x1ab')));_0x5570c1['createHistory'](_0x59c6f6)[_0x0cf8('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5570c1[_0x0cf8('0x198')](0x0,_0x177c47,_0xd145d)){if(_0x59c6f6['countnosuchnumberretry']>=_0xd145d[_0x0cf8('0x1ac')]){_0x5570c1[_0x0cf8('0x102')](_0x59c6f6,_0x5f539f,_0x5dd2c6,'reason\x200\x20no\x20such\x20number....');}else{_0x5570c1['stateGlobal'](_0x59c6f6,_0x5f539f,_0x5dd2c6,_0x0cf8('0x1ad'));}}break;case'3':_0xd145d[_0x0cf8('0x68')]+=0x1;_0x59c6f6[_0x0cf8('0xac')]=0x3;_0x59c6f6['statedesc']=_0x0cf8('0x1ae');_0x59c6f6[_0x0cf8('0xff')]+=0x1;_0x59c6f6['countglobal']+=0x1;ami[_0x0cf8('0x1a8')](_0x0cf8('0x1af'),ut['buildObj'](_0x177c47,'noanswer'));_0x5570c1[_0x0cf8('0xd2')](_0x59c6f6)['catch'](loggerCatch(_0x0cf8('0x1b0')));if(_0x5570c1[_0x0cf8('0x198')](0x3,_0x177c47,_0xd145d)){if(_0x59c6f6[_0x0cf8('0xff')]>=_0xd145d[_0x0cf8('0x199')]){_0x5570c1['createStateFinal'](_0x59c6f6,_0x5f539f,_0x5dd2c6,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5570c1['stateGlobal'](_0x59c6f6,_0x5f539f,_0x5dd2c6,_0x0cf8('0x1b1'));}}break;case'5':_0xd145d['outboundBusyCallsDay']+=0x1;_0x59c6f6['state']=0x5;_0x59c6f6[_0x0cf8('0xad')]=_0x0cf8('0x1b2');_0x59c6f6[_0x0cf8('0xf4')]+=0x1;_0x59c6f6[_0x0cf8('0xf1')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x0cf8('0x1aa')](_0x177c47,'busy'));_0x5570c1[_0x0cf8('0xd2')](_0x59c6f6)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x1b3')));if(_0x5570c1['checkRetriveMax'](0x5,_0x177c47,_0xd145d)){if(_0x59c6f6['countbusyretry']>=_0xd145d[_0x0cf8('0x19c')]){_0x5570c1[_0x0cf8('0x102')](_0x59c6f6,_0x5f539f,_0x5dd2c6,'reason\x205\x20busy');}else{_0x5570c1['stateGlobal'](_0x59c6f6,_0x5f539f,_0x5dd2c6,'reason\x205\x20busy');}}break;case'8':_0xd145d[_0x0cf8('0x64')]+=0x1;_0x59c6f6[_0x0cf8('0xac')]=0x8;_0x59c6f6[_0x0cf8('0xad')]='Congestion';_0x59c6f6['countcongestionretry']+=0x1;_0x59c6f6[_0x0cf8('0xf1')]+=0x1;ami['emit'](_0x0cf8('0x1b4'),ut[_0x0cf8('0x1aa')](_0x177c47,_0x0cf8('0x1b5')));_0x5570c1['createHistory'](_0x59c6f6)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x1b6')));if(_0x5570c1['checkRetriveMax'](0x8,_0x177c47,_0xd145d)){if(_0x59c6f6[_0x0cf8('0xfe')]>=_0xd145d[_0x0cf8('0x1b7')]){_0x5570c1['createStateFinal'](_0x59c6f6,_0x5f539f,_0x5dd2c6,_0x0cf8('0x1b8'));}else{_0x5570c1[_0x0cf8('0x1b9')](_0x59c6f6,_0x5f539f,_0x5dd2c6,_0x0cf8('0x1b8'));}}break;case'11':_0xd145d[_0x0cf8('0x1ba')]+=0x1;_0x59c6f6[_0x0cf8('0xac')]=0xb;_0x59c6f6[_0x0cf8('0xad')]='Abandoned';_0x59c6f6[_0x0cf8('0x123')]+=0x1;_0x59c6f6[_0x0cf8('0xf1')]+=0x1;_0x5570c1[_0x0cf8('0xd2')](_0x59c6f6)[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x128')));if(_0x5570c1[_0x0cf8('0x198')](0xb,_0x177c47,_0xd145d)){if(_0x59c6f6[_0x0cf8('0x123')]>=_0xd145d[_0x0cf8('0x124')]){_0x5570c1[_0x0cf8('0x102')](_0x59c6f6,_0x5f539f,_0x5dd2c6,'reason\x2011\x20abandoned');}else{_0x5570c1[_0x0cf8('0x1b9')](_0x59c6f6,_0x5f539f,_0x5dd2c6,'reason\x2011\x20abandoned');}}break;case'20':_0xd145d['outboundRejectCallsDay']+=0x1;_0x59c6f6[_0x0cf8('0xac')]=0x14;_0x59c6f6['statedesc']='AgentReject';_0x59c6f6['countagentrejectretry']+=0x1;_0x59c6f6[_0x0cf8('0xf1')]+=0x1;ami[_0x0cf8('0x1a8')](_0x0cf8('0x1bb'),ut[_0x0cf8('0x1aa')](_0x177c47,'agentreject'));_0x5570c1[_0x0cf8('0xd2')](_0x59c6f6)[_0x0cf8('0xb9')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5570c1[_0x0cf8('0x198')](0x14,_0x177c47,_0xd145d)){if(_0x59c6f6[_0x0cf8('0x100')]>=_0xd145d[_0x0cf8('0x1bc')]){_0x5570c1[_0x0cf8('0x102')](_0x59c6f6,_0x5f539f,_0x5dd2c6,'reason\x2020\x20agentreject');}else{_0x5570c1[_0x0cf8('0x1b9')](_0x59c6f6,_0x5f539f,_0x5dd2c6,'reason\x2020\x20agentreject');}}break;default:_0xd145d[_0x0cf8('0x6b')]+=0x1;_0x59c6f6[_0x0cf8('0xac')]=0xc;_0x59c6f6[_0x0cf8('0xad')]=_0x175a4b[_0x0cf8('0x10d')];_0x5570c1['createHistory'](_0x59c6f6)['catch'](loggerCatch(_0x0cf8('0x1bd')));if(_0x5570c1[_0x0cf8('0x198')](_0x175a4b[_0x0cf8('0x10d')],_0x177c47,_0xd145d)){if(_0x59c6f6['countbusyretry']+_0x59c6f6[_0x0cf8('0xfe')]+_0x59c6f6[_0x0cf8('0xff')]+_0x59c6f6[_0x0cf8('0xf5')]+_0x59c6f6[_0x0cf8('0x11c')]+_0x59c6f6[_0x0cf8('0x123')]+_0x59c6f6[_0x0cf8('0xf0')]+_0x59c6f6[_0x0cf8('0x100')]>=_0xd145d[_0x0cf8('0xf6')]){_0x5570c1[_0x0cf8('0x1b9')](_0x59c6f6,_0x5f539f,_0x5dd2c6,_0x175a4b[_0x0cf8('0x10d')]);}else{_0x5570c1[_0x0cf8('0x102')](_0x59c6f6,_0x5f539f,_0x5dd2c6,_0x175a4b['reason']);}}}});};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x1b9')]=function(_0x33e424,_0xc1893d,_0x581346,_0x11ac4c){var _0xc9e114=new Final(_0x33e424);_0xc9e114['state']=0xf;_0xc9e114[_0x0cf8('0xad')]=_0x0cf8('0x1be');this[_0x0cf8('0x102')](_0xc9e114,_0xc1893d,_0x581346,_0x11ac4c);};Dialer['prototype'][_0x0cf8('0x102')]=function(_0x794f33,_0x1bbb81,_0x4ca27a,_0x607cb9){this[_0x0cf8('0xd0')](_0x794f33)[_0x0cf8('0xc2')](function(_0x5e7237){return _0x1bbb81(msgResponse(_0x0cf8('0x1a5'),_0x0cf8('0x1bf'),_0x607cb9));})[_0x0cf8('0xb9')](function(_0x219057){return _0x4ca27a(msgResponse(_0x0cf8('0x1c0'),_0x0cf8('0x144'),_0x0cf8('0x1c1')));});};Dialer['prototype'][_0x0cf8('0x8')]=function(_0x11978e){var _0x19dada=this;var _0x2dcbe3=_0x11978e[_0x0cf8('0x1c2')]/0x64;var _0x7c0ed2=_0x11978e[_0x0cf8('0x67')]/(_0x11978e[_0x0cf8('0x67')]+_0x11978e[_0x0cf8('0x61')]);var _0x136251=Math[_0x0cf8('0x1c3')](_0x11978e['predictiveIntervalAvailable']*(_0x11978e['predictiveIntervalMaxThreshold']/0x64));var _0x3f6d7a=Math['round'](_0x11978e[_0x0cf8('0x75')]*(_0x11978e[_0x0cf8('0x1c4')]/0x64));var _0xe87d3a=_0x11978e['available']+_0x11978e[_0x0cf8('0x5a')];var _0x1f9596=Math[_0x0cf8('0x1c5')](_0x11978e['erlangCalls']*_0x11978e[_0x0cf8('0x92')]*_0x11978e[_0x0cf8('0x72')]*_0x11978e[_0x0cf8('0x73')]);if(_[_0x0cf8('0x44')](_0x11978e[_0x0cf8('0x2e')])){if(!_[_0x0cf8('0x44')](_0x11978e['startPredictive'])){_0x11978e[_0x0cf8('0x79')]=undefined;loggerPredictive[_0x0cf8('0x9a')](_0x0cf8('0x1c6'),_0x0cf8('0x1c7'));}if(!_[_0x0cf8('0x44')](_0x11978e[_0x0cf8('0x94')])){loggerPredictive[_0x0cf8('0x9a')]('[startMethodPredictive][StartProgressive]',_0x0cf8('0x1c8'));clearInterval(_0x11978e[_0x0cf8('0x94')]);_0x11978e[_0x0cf8('0x94')]=undefined;}_0x11978e['startProgressive']=moment()[_0x0cf8('0x7e')](_0x0cf8('0xfa'));loggerPredictive['info'](_0x11978e[_0x0cf8('0x45')],'collection\x20data\x20in\x20progressive\x20at',_0x11978e['startProgressive']);this[_0x0cf8('0x155')](_0x11978e,0x1);}else if(ifInterval(_0x11978e[_0x0cf8('0x1c9')],_0x11978e[_0x0cf8('0x2e')])){this[_0x0cf8('0x155')](_0x11978e,0x1);loggerPredictiveCalls['info'](_0x0cf8('0x1ca'),_0x11978e[_0x0cf8('0x2e')],_0x11978e[_0x0cf8('0x45')]);_0x11978e[_0x0cf8('0x77')]=0x0;_0x11978e[_0x0cf8('0x116')]=0x0;}else if(_0x2dcbe3<_0x7c0ed2&&_0x11978e[_0x0cf8('0x1cb')]==='dropRate'){freeVariablesPredictive(_0x11978e);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x1cc'),_0x0cf8('0x1cd'),_0x7c0ed2,_0x0cf8('0x2e'),_0x11978e[_0x0cf8('0x45')]);}else if(_0x1f9596<_0x11978e[_0x0cf8('0x116')]&&_0x11978e[_0x0cf8('0x1cb')]==='dropRate'){freeVariablesPredictive(_0x11978e);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x1ce'),_0x0cf8('0x1cf'),_0x1f9596,_0x0cf8('0x1d0'),_0x11978e['predictiveIntervalErlangCallsDroppedCalls'],_0x0cf8('0x2e'),_0x11978e['name']);}else if(!ifInterval(_0x11978e[_0x0cf8('0x1c9')],_0x11978e[_0x0cf8('0x2e')])&&_['isUndefined'](_0x11978e[_0x0cf8('0x79')])&&!_[_0x0cf8('0x44')](_0x11978e['startProgressive'])){_0x11978e['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0cf8('0x82')](_0x11978e['name'],'started\x20in\x20predictive\x20at',_0x11978e['startPredictive']);this[_0x0cf8('0xc5')](_0x11978e[_0x0cf8('0x1c9')])[_0x0cf8('0xc2')](this[_0x0cf8('0x1d1')](_0x11978e))[_0x0cf8('0xc2')](mergeDataErlangB(_0x11978e))[_0x0cf8('0xc2')](this[_0x0cf8('0x1d2')](_0x11978e))[_0x0cf8('0xb9')](loggerCatchPredictive(_0x0cf8('0x1d3'),_0x11978e));}else if(!ifInterval(_0x11978e[_0x0cf8('0x1c9')],_0x11978e[_0x0cf8('0x79')])){_0x11978e[_0x0cf8('0x116')]=0x0;_0x11978e[_0x0cf8('0x79')]=moment()['format'](_0x0cf8('0xfa'));loggerPredictive[_0x0cf8('0x82')](_0x11978e[_0x0cf8('0x45')],_0x0cf8('0x1d4'),_0x11978e[_0x0cf8('0x79')]);clearInterval(_0x11978e[_0x0cf8('0x94')]);_0x11978e[_0x0cf8('0x94')]=undefined;this[_0x0cf8('0xc5')](_0x11978e[_0x0cf8('0x1c9')])[_0x0cf8('0xc2')](this[_0x0cf8('0x1d1')](_0x11978e))[_0x0cf8('0xc2')](mergeDataErlangB(_0x11978e))[_0x0cf8('0xc2')](this[_0x0cf8('0x1d2')](_0x11978e))[_0x0cf8('0xb9')](loggerCatchPredictive(_0x0cf8('0x1d5'),_0x11978e));}else if(_0x11978e['predictiveIntervalAvailable']&&_0xe87d3a<_0x11978e['predictiveIntervalAvailable']-_0x3f6d7a){freeVariablesPredictive(_0x11978e);loggerPredictive[_0x0cf8('0x82')](_0x11978e[_0x0cf8('0x45')],_0x0cf8('0x1d6'),_0xe87d3a,')\x20are\x20less\x20than\x20threshold\x20(',_0x11978e['predictiveIntervalAvailable'],'-',_0x3f6d7a,'=',_0x11978e[_0x0cf8('0x75')]-_0x3f6d7a,')');}else if(_0x11978e['predictiveIntervalAvailable']&&_0xe87d3a>_0x11978e[_0x0cf8('0x75')]+_0x136251){freeVariablesPredictive(_0x11978e);loggerPredictive[_0x0cf8('0x82')](_0x11978e[_0x0cf8('0x45')],_0x0cf8('0x1d6'),_0xe87d3a,_0x0cf8('0x1d7'),_0x11978e[_0x0cf8('0x75')],'+',_0x136251,'=',_0x11978e[_0x0cf8('0x75')]+_0x136251,')');}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x1d1')]=function(_0x27984a){var _0x59093b=this;return function(_0x18c97b){return new BPromise(function(_0x34a4f3,_0x3533a3){_[_0x0cf8('0xd9')](_0x27984a,_0x18c97b[0x0]);if(checkGetDataPredictive(_0x18c97b[0x0])){var _0x30130f=_0x27984a[_0x0cf8('0x75')]=_0x27984a[_0x0cf8('0x5a')]+_0x27984a['available'];var _0x83710=_0x27984a['dialPredictiveInterval']*0x3c;var _0x348c06=_0x18c97b[0x0][_0x0cf8('0x6e')]+_0x18c97b[0x0][_0x0cf8('0x6d')];var _0xac9f21=(_0x18c97b[0x0][_0x0cf8('0x6c')]+_0x18c97b[0x0][_0x0cf8('0x70')]+_0x18c97b[0x0][_0x0cf8('0x6f')])/_0x18c97b[0x0]['predictiveIntervalTotalCalls'];_0x27984a[_0x0cf8('0x72')]=_0xac9f21>0x0?_0xac9f21:0x1;switch(_0x27984a[_0x0cf8('0x1cb')]){case _0x0cf8('0x1d8'):var _0x43a32a=_0x27984a[_0x0cf8('0x1c2')]/0x64;return _0x59093b[_0x0cf8('0x1d9')](_0x30130f,_0x83710,_0x348c06,_0xac9f21,_0x43a32a)['then'](function(_0x57784c){return _0x34a4f3(_0x57784c);});case _0x0cf8('0x1da'):var _0x4bfb1f=_0x27984a['dialPredictiveOptimizationPercentage']/0x64;return _0x59093b[_0x0cf8('0x1db')](_0x30130f,_0x83710,_0x348c06,_0xac9f21,_0x4bfb1f)[_0x0cf8('0xc2')](function(_0x3522f9){return _0x34a4f3(_0x3522f9);});default:return _0x3533a3(msgResponse(_0x0cf8('0x1dc'),_0x0cf8('0x144'),_0x0cf8('0x1dd')));}}else{return _0x3533a3(msgResponse(_0x0cf8('0x1dc'),'Failure',_0x0cf8('0x1de')));}});};};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x1df')]=function(_0x5aed50){var _0x1522cf=this;return function(_0x191a7f){return new BPromise(function(_0xe4a992,_0x2ddf65){_[_0x0cf8('0xd9')](_0x5aed50,_0x191a7f[0x0]);if(checkGetDataPredictive(_0x191a7f[0x0])){loggerPredictive['info'](JSON[_0x0cf8('0x7d')](_0x191a7f[0x0]));if(_0x5aed50['dialPredictiveOptimization']==='dropRate'){return _0x1522cf['getVoiceQueueRtPauses'](_0x5aed50['id'])[_0x0cf8('0xc2')](function(_0xb894be){var _0x4b3fd7=_0x5aed50[_0x0cf8('0x56')]-_0xb894be[0x0][_0x0cf8('0x1e0')];var _0x32c944=_0x5aed50[_0x0cf8('0x1c9')]*0x3c;var _0x2ef2e2=_0x191a7f[0x0]['predictiveIntervalAvgTalktime']+_0x191a7f[0x0]['predictiveIntervalAvgHoldtime'];var _0xd4bbca=(_0x191a7f[0x0][_0x0cf8('0x6c')]+_0x191a7f[0x0][_0x0cf8('0x70')]+_0x191a7f[0x0][_0x0cf8('0x6f')])/_0x191a7f[0x0]['predictiveIntervalTotalCalls'];var _0x4633fa=_0x5aed50[_0x0cf8('0x1c2')]/0x64;_0x5aed50[_0x0cf8('0x74')]=_0xb894be[0x0][_0x0cf8('0x1e0')]||0x0;_0x5aed50[_0x0cf8('0x72')]=_0xd4bbca>0x0?_0xd4bbca:0x1;return _0x1522cf['abandonmentRate'](_0x4b3fd7,_0x32c944,_0x2ef2e2,_0xd4bbca,_0x4633fa);})[_0x0cf8('0xc2')](function(_0x1b50c9){return _0xe4a992(_0x1b50c9);})[_0x0cf8('0xb9')](function(_0x4d5e47){return _0x2ddf65(msgResponse('[CatchErlangB]',_0x0cf8('0x144'),JSON[_0x0cf8('0x7d')](_0x4d5e47)));});}if(_0x5aed50[_0x0cf8('0x1cb')]===_0x0cf8('0x1da')){return _0x1522cf[_0x0cf8('0xce')](_0x5aed50['id'])[_0x0cf8('0xc2')](function(_0x51f4ff){var _0x2dd772=_0x5aed50[_0x0cf8('0x56')]-_0x51f4ff[0x0][_0x0cf8('0x1e0')];var _0x388959=_0x5aed50['dialPredictiveInterval']*0x3c;var _0x3f0498=_0x191a7f[0x0][_0x0cf8('0x6e')]+_0x191a7f[0x0][_0x0cf8('0x6d')];var _0x3e541e=(_0x191a7f[0x0][_0x0cf8('0x6c')]+_0x191a7f[0x0][_0x0cf8('0x70')]+_0x191a7f[0x0][_0x0cf8('0x6f')])/_0x191a7f[0x0]['predictiveIntervalTotalCalls'];var _0x2ffe9d=_0x5aed50['dialPredictiveOptimizationPercentage']/0x64;_0x5aed50[_0x0cf8('0x74')]=_0x51f4ff[0x0][_0x0cf8('0x1e0')]||0x0;_0x5aed50['predictiveIntervalHitRate']=_0x3e541e>0x0?_0x3e541e:0x1;return _0x1522cf[_0x0cf8('0x1db')](_0x2dd772,_0x388959,_0x3f0498,_0x3e541e,_0x2ffe9d);})['then'](function(_0xd28ebe){return _0xe4a992(_0xd28ebe);})[_0x0cf8('0xb9')](function(_0x152136){return _0x2ddf65(msgResponse(_0x0cf8('0x1e1'),_0x0cf8('0x144'),JSON[_0x0cf8('0x7d')](_0x152136)));});}}else{return _0x2ddf65(msgResponse(_0x0cf8('0x1dc'),'Failure',_0x0cf8('0x1de')));}});};};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x1d2')]=function(_0x412a2b){var _0x2d305b=this;return function(){var _0x4e5652=0x0;var _0x2098b3=Math['floor'](_0x412a2b['erlangCallToSecond']*0x3e8);if(_0x2098b3>0x0){_0x2098b3=_0x2098b3<0x64?0x64:_0x2098b3;loggerPredictive[_0x0cf8('0x82')](_0x412a2b[_0x0cf8('0x45')],_0x0cf8('0x1e2'),_0x2098b3,_0x0cf8('0x50'));_0x412a2b[_0x0cf8('0x94')]=setInterval(function(){_0x2d305b['handlePredictive'](_0x412a2b);loggerPredictiveCalls[_0x0cf8('0x82')](_0x0cf8('0x1e3'),_0x4e5652+=0x1);},_0x2098b3);}else{loggerPredictive[_0x0cf8('0x82')](_0x412a2b[_0x0cf8('0x45')],_0x0cf8('0x1e4'));}};};Dialer[_0x0cf8('0xb0')]['checkContactBlack']=function(_0x22f635,_0x5c733c){var _0x1db45f=this;return function(_0x18ad7f){if(_[_0x0cf8('0x4e')](_0x18ad7f)){if(_[_0x0cf8('0xb6')](_0x5c733c[_0x0cf8('0xdc')])||!_0x5c733c[_0x0cf8('0x1e5')]){if(_0x22f635[_0x0cf8('0x5e')]===_0x0cf8('0x7')){_0x22f635['queueStatusComplete']=_[_0x0cf8('0x44')](_0x22f635[_0x0cf8('0x130')])?!![]:_0x22f635['queueStatusComplete'];var _0x347353=uuid['v4']();_0x1db45f[_0x0cf8('0x2a')][_0x347353]=new Action(_0x22f635,_0x5c733c,_0x347353);loggerBooked['info'](_0x0cf8('0x1e6'),_0x347353,_0x0cf8('0x1e7'),JSON[_0x0cf8('0x7d')](_0x22f635[_0x0cf8('0x130')]),_0x0cf8('0x1e8'),_0x22f635[_0x0cf8('0x45')]);if(_0x22f635[_0x0cf8('0x130')]){_0x22f635[_0x0cf8('0x130')]=![];_0x1db45f[_0x0cf8('0x30')][_0x1db45f[_0x0cf8('0x2a')][_0x347353]['queue']]=[];ami[_0x0cf8('0xb7')]({'actionid':_0x347353,'action':_0x0cf8('0x1e9'),'queue':_0x22f635[_0x0cf8('0x45')]})[_0x0cf8('0xb9')](function(_0x31f453){_0x1db45f[_0x0cf8('0xba')](_0x22f635);_0x1db45f[_0x0cf8('0xc8')]({'active':![],'ContactId':_0x1db45f[_0x0cf8('0x2a')][_0x347353][_0x0cf8('0xdb')],'ListId':_0x1db45f[_0x0cf8('0x2a')][_0x347353][_0x0cf8('0xfb')],'VoiceQueueId':_0x1db45f[_0x0cf8('0x2a')][_0x347353][_0x0cf8('0xdd')]||undefined,'CampaignId':_0x1db45f[_0x0cf8('0x2a')][_0x347353]['CampaignId']||undefined})[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0x1ea')));delete _0x1db45f[_0x0cf8('0x2a')][_0x347353];});}else{loggerBooked[_0x0cf8('0x82')](_0x0cf8('0x1eb'),JSON[_0x0cf8('0x7d')](_0x22f635[_0x0cf8('0x130')]),'Queue:\x20',_0x22f635[_0x0cf8('0x45')]);_0x1db45f[_0x0cf8('0xba')](_0x22f635);_0x1db45f['rescheduleContact']({'active':![],'ContactId':_0x1db45f[_0x0cf8('0x2a')][_0x347353][_0x0cf8('0xdb')],'ListId':_0x1db45f[_0x0cf8('0x2a')][_0x347353][_0x0cf8('0xfb')],'VoiceQueueId':_0x1db45f['actions'][_0x347353]['VoiceQueueId']||undefined,'CampaignId':_0x1db45f[_0x0cf8('0x2a')][_0x347353][_0x0cf8('0xfc')]||undefined})[_0x0cf8('0xb9')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1db45f[_0x0cf8('0x2a')][_0x347353];}}else{return _0x1db45f['actionOriginate'](_0x22f635,_0x5c733c);}}else{if(getDiff(_0x5c733c[_0x0cf8('0x1ec')])<_0x22f635[_0x0cf8('0x1ed')]*0x3c){if(_0x5c733c[_0x0cf8('0x1ee')]&&!_0x5c733c[_0x0cf8('0x1ee')]['voicePause']){_0x1db45f[_0x0cf8('0x23')][_0x0cf8('0x132')](_0x5c733c['id'])['finally'](function(){_0x1db45f[_0x0cf8('0xba')](_0x22f635);});}else{_0x1db45f[_0x0cf8('0xca')]({'active':![]},_0x5c733c['id'],0x1)['finally'](function(){console[_0x0cf8('0x1ef')](_0x0cf8('0x1f0'));_0x1db45f['updateOriginated'](_0x22f635);});}}else{_0x22f635[_0x0cf8('0x1f1')]+=0x1;_0x1db45f[_0x0cf8('0xba')](_0x22f635);if(_0x22f635[_0x0cf8('0x1f2')]){_0x1db45f[_0x0cf8('0xc8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c733c['ContactId'],'ListId':_0x5c733c[_0x0cf8('0xfb')],'VoiceQueueId':_0x5c733c[_0x0cf8('0xdd')]||undefined,'CampaignId':_0x5c733c[_0x0cf8('0xfc')]||undefined})['catch'](loggerCatch(_0x0cf8('0x1f3')));_0x1db45f[_0x0cf8('0xd2')](createObjHistory(_0x22f635,_0x5c733c,_0x0cf8('0x1f4'),0x17,_0x0cf8('0x1f5')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x1db45f[_0x0cf8('0xd8')](createObjHistory(_0x22f635,_0x5c733c,_0x0cf8('0x1f6'),0x16,_0x0cf8('0x1f7')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x22f635[_0x0cf8('0x62')]+=0x1;_0x1db45f[_0x0cf8('0xd8')](createObjHistory(_0x22f635,_0x5c733c,_0x0cf8('0x1f8'),0xd,'Blacklist'),_0x0cf8('0x1f9'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x0cf8('0xb0')]['handleIvr']=function(_0x52053d){var _0x138a21=this;var _0x1c1700=[];var _0x3e8892=_0x52053d['limitCalls']-_0x52053d[_0x0cf8('0x9f')]-_0x52053d['temp'];emitCampaignSummary(_0x52053d);if(_0x3e8892>0x0){if(_0x3e8892>this['maxNumberOriginate']){_0x3e8892=this[_0x0cf8('0x28')];}_0x52053d['temp']+=_0x3e8892;this[_0x0cf8('0xcd')](_0x52053d['id'],_0x3e8892,_0x52053d['dialOrderByScheduledAt'])[_0x0cf8('0xc2')](function(_0x161e9f){_0x52053d[_0x0cf8('0x1fa')]-=_0x3e8892;_0x52053d[_0x0cf8('0x1fa')]=_0x52053d[_0x0cf8('0x1fa')]>0x0?_0x52053d[_0x0cf8('0x1fa')]:0x0;if(!checkContactEmpty(_0x161e9f)){_0x52053d['message']=_0x0cf8('0x1fb');logger[_0x0cf8('0x82')](_0x0cf8('0x1fc')+_0x52053d['name']);}else{_0x52053d[_0x0cf8('0x9f')]+=_0x161e9f[_0x0cf8('0x9d')];_0x52053d[_0x0cf8('0x4a')]=_0x0cf8('0x1fd');for(var _0xaffc56=0x0;_0xaffc56<_0x161e9f[_0x0cf8('0x9d')];_0xaffc56+=0x1){_0x52053d[_0x0cf8('0x1fe')]+=0x1;if(_[_0x0cf8('0xb6')](_0x161e9f[_0xaffc56])||_[_0x0cf8('0xb6')](_0x161e9f[_0xaffc56][_0x0cf8('0x168')])||_[_0x0cf8('0xb6')](_0x161e9f[_0xaffc56][_0x0cf8('0x168')][_0x0cf8('0x169')])){_0x138a21['emptyContact'](_0x0cf8('0x1ff'),_0x52053d,_0x161e9f[_0xaffc56]);}else{_0x138a21[_0x0cf8('0xc4')](_['pick'](_0x161e9f[_0xaffc56],[_0x0cf8('0xfc'),'Contact.phone']))['then'](_0x138a21[_0x0cf8('0x200')](_0x52053d,_0x161e9f[_0xaffc56]))[_0x0cf8('0xb9')](_0x138a21[_0x0cf8('0xd6')](_0x0cf8('0x201'),_0x52053d));}}}})[_0x0cf8('0xb9')](loggerGetContactDialer(_0x0cf8('0x202'),_0x52053d,_0x3e8892));}};Dialer[_0x0cf8('0xb0')]['handlePower']=function(_0xc900c3,_0x13009a){var _0x3dab03=this;var _0x23af73=[];var _0x202cf0=_0x13009a>=0x1?_0x13009a:0x1;var _0x52a482=[];if(_0xc900c3[_0x0cf8('0x5e')]===_0x0cf8('0x7')){_0x202cf0=0x1;}var _0x5eafd3=Math[_0x0cf8('0x1c5')](_0xc900c3[_0x0cf8('0x55')]*_0x202cf0)-_0xc900c3[_0x0cf8('0x9f')]-_0xc900c3[_0x0cf8('0x1fa')];emitVoiceQueueSummary(_0xc900c3);if(_0xc900c3[_0x0cf8('0x203')]>0x0){var _0x5b2ca5=_0xc900c3[_0x0cf8('0x203')]-_0xc900c3[_0x0cf8('0x9f')]-_0xc900c3[_0x0cf8('0x5a')]-_0xc900c3['temp']-_0xc900c3[_0x0cf8('0x57')];if(_0x5eafd3>_0x5b2ca5){_0x5eafd3=_0x5b2ca5;}}if(_0x5eafd3>0x0){if(_0xc900c3['dialMethod']===_0x0cf8('0x7')){_0x5eafd3=0x1;}if(_0x5eafd3>this[_0x0cf8('0x28')]){_0x5eafd3=this[_0x0cf8('0x28')];}_0xc900c3['temp']+=_0x5eafd3;for(var _0x160d90 in this[_0x0cf8('0x26')]){if(this[_0x0cf8('0x26')][_0x0cf8('0x9e')](_0x160d90)){if(this[_0x0cf8('0x26')][_0x160d90][_0x0cf8('0xac')]===_0x0cf8('0x204')&&this[_0x0cf8('0x26')][_0x160d90][_0x0cf8('0xb8')]==='reachable'){_0x23af73[_0x0cf8('0x12e')](this['agents'][_0x160d90]['id']);}}}this['getContactDialer'](_0xc900c3['id'],_0x23af73,_0x5eafd3,_0xc900c3[_0x0cf8('0x205')])['then'](function(_0x195e6c){_0xc900c3[_0x0cf8('0x1fa')]-=_0x5eafd3;_0xc900c3[_0x0cf8('0x1fa')]=_0xc900c3['temp']>0x0?_0xc900c3[_0x0cf8('0x1fa')]:0x0;if(!checkContactEmpty(_0x195e6c)){_0x3dab03[_0x0cf8('0xbe')](_0xc900c3)['then'](sendMessageReschedule(_0xc900c3))[_0x0cf8('0xb9')](loggerCatch(_0x0cf8('0xc0')));}else{_0xc900c3[_0x0cf8('0x9f')]+=_0x195e6c[_0x0cf8('0x9d')];_0xc900c3[_0x0cf8('0x4a')]=_0xc900c3[_0x0cf8('0x5e')]===_0x0cf8('0x7')?_0x0cf8('0x16f'):_0x0cf8('0x1fd');for(var _0x33cddd=0x0;_0x33cddd<_0x195e6c[_0x0cf8('0x9d')];_0x33cddd+=0x1){if(_[_0x0cf8('0xb6')](_0x195e6c[_0x33cddd])||_[_0x0cf8('0xb6')](_0x195e6c[_0x33cddd][_0x0cf8('0x168')])||_[_0x0cf8('0xb6')](_0x195e6c[_0x33cddd][_0x0cf8('0x168')][_0x0cf8('0x169')])){_0x3dab03[_0x0cf8('0xd7')](_0x0cf8('0x1ff'),_0xc900c3,_0x195e6c[_0x33cddd]);}else{_0x3dab03[_0x0cf8('0xc1')](_[_0x0cf8('0xda')](_0x195e6c[_0x33cddd],[_0x0cf8('0xdd'),_0x0cf8('0x206')]))[_0x0cf8('0xc2')](_0x3dab03[_0x0cf8('0x200')](_0xc900c3,_0x195e6c[_0x33cddd]))['catch'](_0x3dab03['loggerHandler'](_0x0cf8('0x1ff'),_0xc900c3));}}}})[_0x0cf8('0xb9')](loggerGetContactDialer('[getContactDialer2]',_0xc900c3,_0x5eafd3));}};Dialer[_0x0cf8('0xb0')]['handlePredictive']=function(_0x2df0e2){var _0x2b806b=this;if(_0x2df0e2[_0x0cf8('0x203')]>0x0){var _0x1d966a=_0x2df0e2[_0x0cf8('0x203')]-_0x2df0e2['originated']-_0x2df0e2[_0x0cf8('0x5a')];if(_0x1d966a>0x0){this['tryOriginatePredictive'](_0x2df0e2);}else{loggerPredictiveCalls[_0x0cf8('0x82')](_0x0cf8('0x207'));}}else{this[_0x0cf8('0x208')](_0x2df0e2);}};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x208')]=function(_0x221e93){var _0x4289c3=this;var _0x3e1b36=[];_0x221e93[_0x0cf8('0x9f')]+=0x1;for(var _0x28ad34 in this['agents']){if(this[_0x0cf8('0x26')][_0x0cf8('0x9e')](_0x28ad34)){if(this[_0x0cf8('0x26')][_0x28ad34][_0x0cf8('0xac')]===_0x0cf8('0x204')&&this[_0x0cf8('0x26')][_0x28ad34][_0x0cf8('0xb8')]===_0x0cf8('0x209')){_0x3e1b36['push'](this['agents'][_0x28ad34]['id']);}}}this[_0x0cf8('0xcb')](_0x221e93['id'],_0x3e1b36,0x1,_0x221e93[_0x0cf8('0x205')])[_0x0cf8('0xc2')](function(_0xbc2df){if(!checkContactEmpty(_0xbc2df)){checkContactLowerLimitOriginate(_0x221e93,0x1,0x0);_0x4289c3[_0x0cf8('0xbe')](_0x221e93)['then'](sendMessageReschedule(_0x221e93))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x221e93[_0x0cf8('0x4a')]='RUNNING';if(_[_0x0cf8('0xb6')](_0xbc2df[0x0])||_[_0x0cf8('0xb6')](_0xbc2df[0x0][_0x0cf8('0x168')])||_['isNil'](_0xbc2df[0x0][_0x0cf8('0x168')][_0x0cf8('0x169')])){_0x4289c3[_0x0cf8('0xd7')](_0x0cf8('0x1ff'),_0x221e93,_0xbc2df[0x0]);}else{_0x4289c3[_0x0cf8('0xc1')](_[_0x0cf8('0xda')](_0xbc2df[0x0],[_0x0cf8('0xdd'),_0x0cf8('0x206')]))[_0x0cf8('0xc2')](_0x4289c3[_0x0cf8('0x200')](_0x221e93,_0xbc2df[0x0]))[_0x0cf8('0xb9')](_0x4289c3['loggerHandler']('[actionOriginatePredictive]\x20',_0x221e93));}}})[_0x0cf8('0xb9')](loggerGetContactDialer(_0x0cf8('0x20a'),_0x221e93,0x1));emitVoiceQueueSummary(_0x221e93);};Dialer['prototype'][_0x0cf8('0x1d9')]=function(_0x3b518f,_0x1ef27c,_0x5a01b3,_0x5b1145,_0x57bc05,_0x54f492){loggerPredictive['info'](_0x0cf8('0x20b'));loggerPredictive['info'](_0x0cf8('0x20c'),_0x3b518f);loggerPredictive['info'](_0x0cf8('0x20d'),_0x1ef27c);loggerPredictive[_0x0cf8('0x82')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5a01b3);loggerPredictive['info'](_0x0cf8('0x20e'),_0x5b1145);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x20f'),_0x57bc05);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x88'));return new BPromise(function(_0x48a9d3,_0x4a1151){if(_0x3b518f<=0x0||isNaN(_0x3b518f)){return _0x4a1151(msgResponse(_0x0cf8('0x210'),_0x0cf8('0x192'),_0x0cf8('0x211')+_0x3b518f));}if(_0x5a01b3<=0x0||isNaN(_0x5a01b3)){return _0x4a1151(msgResponse(_0x0cf8('0x210'),'Error','Ts\x20=\x20'+_0x5a01b3));}if(_0x5b1145<=0x0||isNaN(_0x5b1145)){return _0x4a1151(msgResponse(_0x0cf8('0x210'),_0x0cf8('0x192'),_0x0cf8('0x212')+_0x5b1145));}if(_0x1ef27c<=0x0||isNaN(_0x1ef27c)){return _0x4a1151(msgResponse(_0x0cf8('0x210'),_0x0cf8('0x192'),_0x0cf8('0x213')+_0x1ef27c));}if(_0x57bc05<=0x0||isNaN(_0x57bc05)){return _0x4a1151(msgResponse(_0x0cf8('0x210'),_0x0cf8('0x192'),'Amax\x20=\x20'+_0x57bc05));}_0x54f492=_0x54f492||0x0;var _0x234e2c=0x1/_0x5a01b3;var _0x59bb5a=0x0;var _0x36224b=0x0;var _0x184b10=0x0;var _0x1a4798=0x0;for(var _0x602c6d=0x0;_0x184b10<_0x57bc05;_0x602c6d+=0x1){_0x36224b=_0x602c6d/_0x1ef27c;_0x59bb5a=(_0x5b1145*_0x36224b+_0x54f492)/_0x234e2c;_0x184b10=erlangb(_0x59bb5a,_0x3b518f);_0x1a4798=_0x59bb5a/_0x3b518f*(0x1-erlangb(_0x59bb5a,_0x3b518f));}return _0x48a9d3({'erlangCalls':_0x602c6d,'erlangCallToSecond':_0x1ef27c/_0x602c6d,'erlangAbandonmentRate':_0x184b10,'erlangBusyFactor':_0x1a4798});});};Dialer[_0x0cf8('0xb0')][_0x0cf8('0x1db')]=function(_0x3e7af2,_0x3c5b41,_0xb2e405,_0x5780a8,_0xd09d87,_0x2a15c8){loggerPredictive[_0x0cf8('0x82')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x0cf8('0x20c'),_0x3e7af2);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x20d'),_0x3c5b41);loggerPredictive[_0x0cf8('0x82')](_0x0cf8('0x214'),_0xb2e405);loggerPredictive['info'](_0x0cf8('0x20e'),_0x5780a8);loggerPredictive['info'](_0x0cf8('0x215'),_0xd09d87);loggerPredictive[_0x0cf8('0x82')]('---------------------------');return new BPromise(function(_0x505191,_0x3071d3){if(_0x3e7af2<=0x0||isNaN(_0x3e7af2)){return _0x3071d3(msgResponse(_0x0cf8('0x216'),_0x0cf8('0x192'),_0x0cf8('0x211')+_0x3e7af2));}if(_0xb2e405<=0x0||isNaN(_0xb2e405)){return _0x3071d3(msgResponse(_0x0cf8('0x216'),_0x0cf8('0x192'),'Ts\x20=\x20'+_0xb2e405));}if(_0x5780a8<=0x0||isNaN(_0x5780a8)){return _0x3071d3(msgResponse('[busyFactor]',_0x0cf8('0x192'),'p\x20=\x20'+_0x5780a8));}if(_0x3c5b41<=0x0||isNaN(_0x3c5b41)){return _0x3071d3(msgResponse(_0x0cf8('0x216'),_0x0cf8('0x192'),_0x0cf8('0x213')+_0x3c5b41));}if(_0xd09d87<=0x0||isNaN(_0xd09d87)){return _0x3071d3(msgResponse(_0x0cf8('0x216'),'Error',_0x0cf8('0x217')+_0xd09d87));}_0x2a15c8=_0x2a15c8||0x0;var _0x3074c0=0x1/_0xb2e405;var _0x210d62=0x0;var _0x5e95f2=0x0;var _0x2bbc42=0x0;var _0xfbd7b5=0x0;for(var _0xa077a8=0x0;_0xfbd7b5<_0xd09d87;_0xa077a8+=0x1){_0x5e95f2=_0xa077a8/_0x3c5b41;_0x210d62=(_0x5780a8*_0x5e95f2+_0x2a15c8)/_0x3074c0;_0x2bbc42=erlangb(_0x210d62,_0x3e7af2);_0xfbd7b5=_0x210d62/_0x3e7af2*(0x1-erlangb(_0x210d62,_0x3e7af2));}return _0x505191({'erlangCalls':_0xa077a8,'erlangCallToSecond':_0x3c5b41/_0xa077a8,'erlangAbandonmentRate':_0x2bbc42,'erlangBusyFactor':_0xfbd7b5});});};module[_0x0cf8('0x218')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 94a880d..b817a89 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 _0x902e=['moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x30f6c1,_0x2ab231){var _0x52bcd0=function(_0x2bbdd6){while(--_0x2bbdd6){_0x30f6c1['push'](_0x30f6c1['shift']());}};_0x52bcd0(++_0x2ab231);}(_0x902e,0x7c));var _0xe902=function(_0x224ab3,_0x12a2f6){_0x224ab3=_0x224ab3-0x0;var _0x588969=_0x902e[_0x224ab3];return _0x588969;};'use strict';var util=require(_0xe902('0x0'));var _=require(_0xe902('0x1'));var moment=require(_0xe902('0x2'));function getSeconds(_0x51e768,_0x4e5313){var _0x81ccac=moment(_0x51e768)['milliseconds'](0x0);var _0x5d2d21=moment(_0x4e5313)[_0xe902('0x3')](0x0);return _0x81ccac[_0xe902('0x4')](_0x5d2d21,_0xe902('0x5'));}function QueueCallerAbandon(_0x12ea8b,_0xc42a3e){this[_0xe902('0x6')]=_0x12ea8b[_0xe902('0x6')];this[_0xe902('0x7')]=_0x12ea8b[_0xe902('0x7')];this[_0xe902('0x8')]=_0x12ea8b['type']==='outbound'?'queue':_0x12ea8b[_0xe902('0x7')];this['countbusyretry']=_0x12ea8b[_0xe902('0x9')];this[_0xe902('0xa')]=_0x12ea8b['countcongestionretry'];this['countnoanswerretry']=_0x12ea8b['countnoanswerretry'];this['countglobal']=_0x12ea8b[_0xe902('0x9')]+_0x12ea8b[_0xe902('0xa')]+_0x12ea8b['countnoanswerretry']+_0x12ea8b[_0xe902('0xb')]+_0x12ea8b[_0xe902('0xc')]+_0x12ea8b[_0xe902('0xd')]+_0x12ea8b[_0xe902('0xe')]+_0x12ea8b[_0xe902('0xf')];this[_0xe902('0xb')]=_0x12ea8b[_0xe902('0xb')];this[_0xe902('0xc')]=_0x12ea8b[_0xe902('0xc')];this[_0xe902('0xd')]=_0x12ea8b[_0xe902('0xd')];this[_0xe902('0xe')]=_0x12ea8b[_0xe902('0xe')];this[_0xe902('0xf')]=_0x12ea8b[_0xe902('0xf')];this[_0xe902('0x10')]=_0xc42a3e[_0xe902('0x10')];this[_0xe902('0x11')]=_0x12ea8b[_0xe902('0x12')];this[_0xe902('0x13')]=_0x12ea8b[_0xe902('0x14')];this['starttime']=_0x12ea8b[_0xe902('0x15')];this[_0xe902('0x16')]=_0x12ea8b[_0xe902('0x16')];this[_0xe902('0x17')]=_0x12ea8b['droptime'];this[_0xe902('0x18')]=this[_0xe902('0x17')];this[_0xe902('0x19')]=getSeconds(_0x12ea8b[_0xe902('0x16')],_0x12ea8b['starttime']);this[_0xe902('0x1a')]=getSeconds(this[_0xe902('0x17')],_0x12ea8b['responsetime']);this[_0xe902('0x1b')]=0x0;this[_0xe902('0x1c')]=_0xc42a3e['queue'];this[_0xe902('0x1d')]=_0xc42a3e[_0xe902('0x1e')];this[_0xe902('0x1f')]=_0xc42a3e[_0xe902('0x1f')];this[_0xe902('0x20')]=_0x12ea8b[_0xe902('0x20')];this[_0xe902('0x21')]=_0x12ea8b[_0xe902('0x21')];this[_0xe902('0x22')]=_0x12ea8b[_0xe902('0x22')];this[_0xe902('0x23')]=_0x12ea8b[_0xe902('0x23')];this['ContactId']=_0x12ea8b['ContactId'];this[_0xe902('0x24')]=_0x12ea8b['ListId'];this['UserId']=_0x12ea8b['UserId'];this[_0xe902('0x25')]=_0x12ea8b[_0xe902('0x25')];this[_0xe902('0x26')]=_0x12ea8b[_0xe902('0x26')];this[_0xe902('0x27')]=_0x12ea8b[_0xe902('0x27')]||'';this[_0xe902('0x28')]=_0x12ea8b[_0xe902('0x28')]||'';}module[_0xe902('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x8a54=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','reason','callback','callbackuniqueid'];(function(_0x46d8a2,_0x255825){var _0x1a3fee=function(_0x2e871f){while(--_0x2e871f){_0x46d8a2['push'](_0x46d8a2['shift']());}};_0x1a3fee(++_0x255825);}(_0x8a54,0x171));var _0x48a5=function(_0x433d7e,_0x31424e){_0x433d7e=_0x433d7e-0x0;var _0x164dbf=_0x8a54[_0x433d7e];return _0x164dbf;};'use strict';var util=require(_0x48a5('0x0'));var _=require(_0x48a5('0x1'));var moment=require(_0x48a5('0x2'));function getSeconds(_0x1212c4,_0x3ca440){var _0x36d8c8=moment(_0x1212c4)[_0x48a5('0x3')](0x0);var _0x48703a=moment(_0x3ca440)[_0x48a5('0x3')](0x0);return _0x36d8c8['diff'](_0x48703a,'seconds');}function QueueCallerAbandon(_0xe4c95e,_0x299092){this[_0x48a5('0x4')]=_0xe4c95e[_0x48a5('0x4')];this['type']=_0xe4c95e[_0x48a5('0x5')];this[_0x48a5('0x6')]=_0xe4c95e[_0x48a5('0x5')]==='outbound'?_0x48a5('0x7'):_0xe4c95e[_0x48a5('0x5')];this[_0x48a5('0x8')]=_0xe4c95e[_0x48a5('0x8')];this[_0x48a5('0x9')]=_0xe4c95e[_0x48a5('0x9')];this[_0x48a5('0xa')]=_0xe4c95e['countnoanswerretry'];this[_0x48a5('0xb')]=_0xe4c95e[_0x48a5('0x8')]+_0xe4c95e['countcongestionretry']+_0xe4c95e[_0x48a5('0xa')]+_0xe4c95e[_0x48a5('0xc')]+_0xe4c95e[_0x48a5('0xd')]+_0xe4c95e['countabandonedretry']+_0xe4c95e[_0x48a5('0xe')]+_0xe4c95e[_0x48a5('0xf')];this[_0x48a5('0xc')]=_0xe4c95e['countnosuchnumberretry'];this['countdropretry']=_0xe4c95e['countdropretry'];this[_0x48a5('0x10')]=_0xe4c95e[_0x48a5('0x10')];this[_0x48a5('0xe')]=_0xe4c95e[_0x48a5('0xe')];this[_0x48a5('0xf')]=_0xe4c95e[_0x48a5('0xf')];this['uniqueid']=_0x299092[_0x48a5('0x11')];this[_0x48a5('0x12')]=_0xe4c95e[_0x48a5('0x13')];this['calleridnum']=_0xe4c95e[_0x48a5('0x14')];this[_0x48a5('0x15')]=_0xe4c95e[_0x48a5('0x15')];this[_0x48a5('0x16')]=_0xe4c95e['responsetime'];this[_0x48a5('0x17')]=_0xe4c95e[_0x48a5('0x17')];this[_0x48a5('0x18')]=this['droptime'];this[_0x48a5('0x19')]=getSeconds(_0xe4c95e['responsetime'],_0xe4c95e[_0x48a5('0x15')]);this[_0x48a5('0x1a')]=getSeconds(this[_0x48a5('0x17')],_0xe4c95e[_0x48a5('0x16')]);this[_0x48a5('0x1b')]=0x0;this[_0x48a5('0x7')]=_0x299092[_0x48a5('0x7')];this['membername']=_0x299092['connectedlinename'];this[_0x48a5('0x1c')]=_0x299092['reason'];this['callback']=_0xe4c95e[_0x48a5('0x1d')];this['callbackuniqueid']=_0xe4c95e[_0x48a5('0x1e')];this[_0x48a5('0x1f')]=_0xe4c95e[_0x48a5('0x1f')];this[_0x48a5('0x20')]=_0xe4c95e['recallme'];this[_0x48a5('0x21')]=_0xe4c95e['ContactId'];this[_0x48a5('0x22')]=_0xe4c95e[_0x48a5('0x22')];this[_0x48a5('0x23')]=_0xe4c95e[_0x48a5('0x23')];this[_0x48a5('0x24')]=_0xe4c95e[_0x48a5('0x24')];this['CampaignId']=_0xe4c95e['CampaignId'];this['originatecalleridnum']=_0xe4c95e[_0x48a5('0x25')]||'';this[_0x48a5('0x26')]=_0xe4c95e[_0x48a5('0x26')]||'';}module[_0x48a5('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 29d9f77..6f456f0 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 _0xe57f=['headerinfo','path','AttachmentId','exports','lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','name','fax','localstationid'];(function(_0x292162,_0x29b023){var _0x189258=function(_0x1365ea){while(--_0x1365ea){_0x292162['push'](_0x292162['shift']());}};_0x189258(++_0x29b023);}(_0xe57f,0x74));var _0xfe57=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe57f[_0x4565bf];return _0x5610ba;};'use strict';var util=require('util');var _=require(_0xfe57('0x0'));var moment=require(_0xfe57('0x1'));function Action(_0x25c382,_0x302c1a,_0x295bb7){this[_0xfe57('0x2')]=_0x25c382||undefined;this[_0xfe57('0x3')]=util['format'](_0xfe57('0x4'),_0x302c1a[_0xfe57('0x5')],_0x302c1a[_0xfe57('0x6')][_0xfe57('0x7')],_0x295bb7[_0xfe57('0x8')]);this[_0xfe57('0x9')]=_0x302c1a['localstationid'];this[_0xfe57('0xa')]=_0x302c1a['headerinfo'];this[_0xfe57('0xb')]=_0x295bb7[_0xfe57('0xb')];this[_0xfe57('0xc')]=_0x295bb7[_0xfe57('0xc')];}module[_0xfe57('0xd')]=Action; \ No newline at end of file +var _0x9cba=['channel','format','%s/%s/%s','tech','Trunk','name','fax','headerinfo','path','AttachmentId','exports','util','lodash'];(function(_0x464f2d,_0x23e382){var _0x5dd91a=function(_0x51abed){while(--_0x51abed){_0x464f2d['push'](_0x464f2d['shift']());}};_0x5dd91a(++_0x23e382);}(_0x9cba,0x73));var _0xa9cb=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9cba[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0xa9cb('0x0'));var _=require(_0xa9cb('0x1'));var moment=require('moment');function Action(_0xe02c4c,_0x4560fd,_0x61c0de){this['uniqueid']=_0xe02c4c||undefined;this[_0xa9cb('0x2')]=util[_0xa9cb('0x3')](_0xa9cb('0x4'),_0x4560fd[_0xa9cb('0x5')],_0x4560fd[_0xa9cb('0x6')][_0xa9cb('0x7')],_0x61c0de[_0xa9cb('0x8')]);this['localstationid']=_0x4560fd['localstationid'];this[_0xa9cb('0x9')]=_0x4560fd[_0xa9cb('0x9')];this[_0xa9cb('0xa')]=_0x61c0de[_0xa9cb('0xa')];this['AttachmentId']=_0x61c0de[_0xa9cb('0xb')];}module[_0xa9cb('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 1d20422..6494cf0 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 _0x58c2=['syncNewExten','faxstatus','syncFaxStatus','receivefax','originateresponse','prototype','context','from-voip-provider','exten','localstationid','channels','uniqueid','info','\x20syncNewchannel\x20','channel','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','name','.pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten'];(function(_0x5c9a52,_0xbd9770){var _0x69dc1a=function(_0x47d041){while(--_0x47d041){_0x5c9a52['push'](_0x5c9a52['shift']());}};_0x69dc1a(++_0xbd9770);}(_0x58c2,0x148));var _0x258c=function(_0x4e623c,_0x110ef0){_0x4e623c=_0x4e623c-0x0;var _0x43fbbf=_0x58c2[_0x4e623c];return _0x43fbbf;};'use strict';var util=require('util');var _=require(_0x258c('0x0'));var BPromise=require(_0x258c('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x258c('0x2'));var tiff2pdf=require(_0x258c('0x3'));var gs=require(_0x258c('0x4'));var logger=require(_0x258c('0x5'))(_0x258c('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x258c('0x7'));var ut=require(_0x258c('0x8'));var Action=require(_0x258c('0x9'));var faxAccount=require(_0x258c('0xa'));var attachment=require(_0x258c('0xb'));var faxMessage=require(_0x258c('0xc'));function Fax(_0x520d12){this['channels']={};this[_0x258c('0xd')]=_0x520d12[_0x258c('0xd')];this[_0x258c('0xe')]=_0x520d12['trunks'];this[_0x258c('0xf')]={};ami['on'](_0x258c('0x10'),this[_0x258c('0x11')][_0x258c('0x12')](this));ami['on'](_0x258c('0x13'),this['syncVarSet'][_0x258c('0x12')](this));ami['on'](_0x258c('0x14'),this[_0x258c('0x15')][_0x258c('0x12')](this));ami['on'](_0x258c('0x16'),this[_0x258c('0x17')]['bind'](this));ami['on'](_0x258c('0x18'),this[_0x258c('0x19')][_0x258c('0x12')](this));ami['on'](_0x258c('0x1a'),this['syncReceiveFax'][_0x258c('0x12')](this));ami['on']('hangup',this['syncHangup'][_0x258c('0x12')](this));ami['on'](_0x258c('0x1b'),this['syncOriginateResponse'][_0x258c('0x12')](this));}Fax[_0x258c('0x1c')]['syncNewchannel']=function(_0x1c7092){if(_0x1c7092[_0x258c('0x1d')]===_0x258c('0x1e')){for(var _0xcecef2 in this[_0x258c('0xd')]){if(this[_0x258c('0xd')]['hasOwnProperty'](_0xcecef2)){if(_0x1c7092[_0x258c('0x1f')]===this[_0x258c('0xd')][_0xcecef2][_0x258c('0x20')]){this[_0x258c('0x21')][_0x1c7092['uniqueid']]={};this[_0x258c('0x21')][_0x1c7092[_0x258c('0x22')]]['channel']=_0x1c7092['channel'];this[_0x258c('0x21')][_0x1c7092[_0x258c('0x22')]]['id']=this[_0x258c('0xd')][_0xcecef2]['id'];this[_0x258c('0x21')][_0x1c7092['uniqueid']]['name']=this[_0x258c('0xd')][_0xcecef2]['name'];logger[_0x258c('0x23')](_0x1c7092[_0x258c('0x22')],_0x258c('0x24'));}}}}if(this[_0x258c('0xf')][_0x1c7092['uniqueid']]){this['channels'][_0x1c7092['uniqueid']]={};this[_0x258c('0x21')][_0x1c7092[_0x258c('0x22')]]['channel']=_0x1c7092[_0x258c('0x25')];logger[_0x258c('0x23')](_0x1c7092[_0x258c('0x22')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x4339c4){if(this[_0x258c('0x21')][_0x4339c4[_0x258c('0x22')]]){for(var _0x186446 in _0x4339c4[_0x258c('0x26')]){if(_0x4339c4[_0x258c('0x26')][_0x258c('0x27')](_0x186446)){this['channels'][_0x4339c4[_0x258c('0x22')]][_0x186446]=_0x4339c4[_0x258c('0x28')];}}}};Fax[_0x258c('0x1c')][_0x258c('0x15')]=function(_0xadbdc5){if(this[_0x258c('0x21')][_0xadbdc5[_0x258c('0x22')]]){this[_0x258c('0x21')][_0xadbdc5[_0x258c('0x22')]]['channelstate']=_0xadbdc5[_0x258c('0x29')];this[_0x258c('0x21')][_0xadbdc5['uniqueid']][_0x258c('0x2a')]=_0xadbdc5[_0x258c('0x2a')];}};Fax['prototype'][_0x258c('0x17')]=function(_0x423c92){if(this[_0x258c('0x21')][_0x423c92['uniqueid']]){for(var _0x1afba9 in _0x423c92[_0x258c('0x26')]){if(_0x423c92['variable'][_0x258c('0x27')](_0x1afba9)){this[_0x258c('0x21')][_0x423c92['uniqueid']][_0x1afba9]=_0x423c92[_0x258c('0x28')];}}}};Fax['prototype'][_0x258c('0x19')]=function(_0x240670){if(this['channels'][_0x240670['uniqueid']]){this[_0x258c('0x21')][_0x240670[_0x258c('0x22')]][_0x258c('0x2b')]=_0x240670['operation'];this[_0x258c('0x21')][_0x240670[_0x258c('0x22')]]['status']=_0x240670[_0x258c('0x2c')];this['channels'][_0x240670[_0x258c('0x22')]]['localstationid']=_0x240670[_0x258c('0x20')];this[_0x258c('0x21')][_0x240670[_0x258c('0x22')]]['filename']=_0x240670[_0x258c('0x2d')];logger[_0x258c('0x23')](_0x240670[_0x258c('0x22')],_0x258c('0x2e'));}};Fax[_0x258c('0x1c')][_0x258c('0x2f')]=function(_0x506b6f){var _0x42e2c0=this;if(this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]]){var _0x5b4794=this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]]['id'];this['channels'][_0x506b6f[_0x258c('0x22')]][_0x258c('0x30')]=_0x506b6f[_0x258c('0x30')];this['channels'][_0x506b6f[_0x258c('0x22')]][_0x258c('0x31')]=_0x506b6f[_0x258c('0x31')];this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]][_0x258c('0x20')]=_0x506b6f[_0x258c('0x20')];this['channels'][_0x506b6f['uniqueid']][_0x258c('0x32')]=_0x506b6f[_0x258c('0x32')];this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]][_0x258c('0x33')]=_0x506b6f[_0x258c('0x33')];this['channels'][_0x506b6f[_0x258c('0x22')]]['filename']=_0x506b6f[_0x258c('0x2d')];this[_0x258c('0x21')][_0x506b6f[_0x258c('0x22')]][_0x258c('0x34')]=_0x506b6f[_0x258c('0x34')];if(this[_0x258c('0x21')][_0x506b6f['uniqueid']][_0x258c('0x31')]>0x0){tiff2pdf(_0x506b6f[_0x258c('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x223b4e){logger[_0x258c('0x23')](_0x506b6f[_0x258c('0x22')],_0x258c('0x35'),_0x223b4e[_0x258c('0x36')]);attachment['create']({'name':path[_0x258c('0x37')](_0x506b6f['filename'])[_0x258c('0x38')],'basename':path[_0x258c('0x37')](_0x506b6f[_0x258c('0x2d')])[_0x258c('0x38')]+_0x258c('0x39'),'type':'application/pdf'})[_0x258c('0x3a')](function(_0x4b2b05){faxAccount['notify'](_0x5b4794,{'from':_0x506b6f[_0x258c('0x34')],'mapKey':_0x258c('0x6'),'body':path[_0x258c('0x37')](_0x506b6f['filename'])[_0x258c('0x38')]+_0x258c('0x39'),'AttachmentId':_0x4b2b05['id']})[_0x258c('0x3b')](function(_0x21f529){logger[_0x258c('0x3c')](_0x506b6f['uniqueid'],_0x258c('0x3d'),JSON[_0x258c('0x3e')](_0x21f529));});})[_0x258c('0x3b')](function(_0x25a3fd){logger[_0x258c('0x3c')](_0x506b6f[_0x258c('0x22')],_0x258c('0x3f'),JSON[_0x258c('0x3e')](_0x25a3fd));});});}logger[_0x258c('0x23')](_0x506b6f[_0x258c('0x22')],_0x258c('0x3f'));}};Fax['prototype'][_0x258c('0x40')]=function(_0x31bb23){if(this[_0x258c('0xf')][_0x31bb23['uniqueid']]){_[_0x258c('0x41')](this[_0x258c('0x21')][_0x31bb23[_0x258c('0x22')]],_[_0x258c('0x42')](_0x31bb23,[_0x258c('0x43'),_0x258c('0x44')]));}};function updateStatus(_0x256f58){if(_0x256f58['AttachmentId']){faxMessage['update'](_0x256f58[_0x258c('0x45')],{'failMessage':_0x258c('0x46')})[_0x258c('0x3a')](function(_0x198e6b){ut['logger']('[Fax][Message][Error][Updated]',_0x198e6b);})['catch'](function(_0x487694){ut['logger'](_0x258c('0x47'),_0x487694);});}else{ut[_0x258c('0x48')](_0x258c('0x49'));}}Fax[_0x258c('0x1c')]['updateStatus']=function(_0x4cc429,_0x50f290,_0x140a4b){var _0x2dced0=this;var _0x31297a={};if(_0x50f290){_0x31297a={'read':_0x50f290};}else{_0x31297a={'failMessage':_0x140a4b};}if(this['actions'][_0x4cc429][_0x258c('0x45')]){faxMessage[_0x258c('0x4a')](this['actions'][_0x4cc429]['AttachmentId'],_0x31297a)[_0x258c('0x3a')](function(_0x2ad952){ut[_0x258c('0x48')](_0x258c('0x4b'),_0x2ad952);})[_0x258c('0x3b')](function(_0x4df037){ut[_0x258c('0x48')](_0x258c('0x4c'),_0x4df037);})[_0x258c('0x4d')](function(){delete _0x2dced0[_0x258c('0x21')][_0x4cc429];delete _0x2dced0[_0x258c('0xf')][_0x4cc429];});}else{ut[_0x258c('0x48')](_0x258c('0x4e'));delete this[_0x258c('0x21')][_0x4cc429];delete this[_0x258c('0xf')][_0x4cc429];}};Fax['prototype'][_0x258c('0x4f')]=function(_0x113420){var _0xfcdaa3=this;if(this[_0x258c('0x21')][_0x113420[_0x258c('0x22')]]){if(this[_0x258c('0xf')][_0x113420[_0x258c('0x22')]]){this[_0x258c('0x21')][_0x113420[_0x258c('0x22')]]['id']=this[_0x258c('0xf')][_0x113420[_0x258c('0x22')]]['id'];this['channels'][_0x113420[_0x258c('0x22')]][_0x258c('0x38')]=this[_0x258c('0xf')][_0x113420[_0x258c('0x22')]][_0x258c('0x38')];}logger[_0x258c('0x23')](_0x113420[_0x258c('0x22')],this[_0x258c('0xf')][_0x113420['uniqueid']]?_0x258c('0x50'):_0x258c('0x51'),JSON[_0x258c('0x3e')](this[_0x258c('0x21')][_0x113420[_0x258c('0x22')]]));if(this[_0x258c('0xf')][_0x113420['uniqueid']]){if(this[_0x258c('0x21')][_0x113420['uniqueid']][_0x258c('0x52')]>0x0&&this[_0x258c('0x21')][_0x113420[_0x258c('0x22')]]['faxstatus']==='SUCCESS'){this['updateStatus'](_0x113420[_0x258c('0x22')],!![]);}else{this[_0x258c('0x53')](_0x113420['uniqueid'],![],this['channels'][_0x113420['uniqueid']][_0x258c('0x54')]?_0x258c('0x55')+this['channels'][_0x113420['uniqueid']][_0x258c('0x54')]:_0x258c('0x56'));}}}};Fax['prototype'][_0x258c('0x57')]=function(_0x372ce6){var _0x2c682f=this;return new BPromise(function(_0x29003e,_0x61fb8f){_0x2c682f[_0x258c('0x58')](_0x372ce6,_0x2c682f['faxAccounts'][_0x372ce6[_0x258c('0x59')]])[_0x258c('0x3a')](function(_0x3d4373){ut['logger']('[Fax][execOriginate][success]',_0x3d4373);_0x29003e(ut[_0x258c('0x36')]('Fax\x20received'));})['catch'](function(_0x61d7b5){ut[_0x258c('0x48')](_0x258c('0x5a'),_0x61d7b5);updateStatus(_0x372ce6);_0x61fb8f(ut[_0x258c('0x36')](_0x258c('0x5b')));});});};Fax[_0x258c('0x1c')][_0x258c('0x5c')]=function(_0x2c7597){var _0x4cc5cd=this;return new BPromise(function(_0x22610a,_0x43e4cc){var _0x475a1f=_0x4cc5cd['checkTrunk'](_0x4cc5cd[_0x258c('0xd')][_0x2c7597[_0x258c('0x59')]][_0x258c('0x5d')],_0x2c7597);if(_0x475a1f[_0x258c('0x5e')]){_0x22610a(ut[_0x258c('0x36')]('Trunk\x20Reachable'));}else{_0x43e4cc(ut[_0x258c('0x36')](_0x475a1f['message']));}});};function originate(_0x3451e4,_0x1ab571,_0x5b19c7){return new BPromise(function(_0x54cc57,_0x20a1b5){if(_0x5b19c7){var _0x5a01c0=util['format'](_0x258c('0x5f'),path[_0x258c('0x37')](_0x3451e4[_0x258c('0x2')])[_0x258c('0x38')],_0x3451e4[_0x258c('0x2')]);gs[_0x258c('0x60')](_0x5a01c0)[_0x258c('0x3a')](function(){_0x3451e4['path']=util[_0x258c('0x61')]('%s/%s.tif',path[_0x258c('0x37')](_0x3451e4[_0x258c('0x2')])[_0x258c('0x62')],path[_0x258c('0x37')](_0x3451e4[_0x258c('0x2')])[_0x258c('0x38')]);_0x1ab571[_0x258c('0x63')]=_0x3451e4[_0x258c('0x2')];ut[_0x258c('0x48')](_0x258c('0x64'),'');ami[_0x258c('0x65')](ut[_0x258c('0x66')](_0x3451e4,_0x1ab571))['then'](function(_0x5f1ac3){_0x54cc57(_0x5f1ac3);})['catch'](function(_0x1374f6){_0x20a1b5(_0x1374f6);});})['catch'](function(_0x108c36){_0x20a1b5(_0x108c36);});}else{ami[_0x258c('0x65')](ut[_0x258c('0x66')](_0x3451e4,_0x1ab571))[_0x258c('0x3a')](function(_0x54d225){_0x54cc57(_0x54d225);})[_0x258c('0x3b')](function(_0x2eac38){_0x20a1b5(_0x2eac38);});}});}Fax[_0x258c('0x1c')][_0x258c('0x58')]=function(_0x302507,_0x1a21b6){var _0x4191fb=this;return new BPromise(function(_0x318b43,_0x64208e){var _0x3f03cc=uuid['v4']();var _0x765ea2=ut[_0x258c('0x67')](_0x302507,_0x1a21b6);_0x4191fb[_0x258c('0xf')][_0x3f03cc]=new Action(_0x3f03cc,_0x1a21b6,_0x302507);var _0x2ad322=_0x4191fb[_0x258c('0xf')][_0x3f03cc];if(path[_0x258c('0x37')](_0x302507[_0x258c('0x2')])[_0x258c('0x68')]==='.pdf'){originate(_0x2ad322,_0x765ea2,!![])[_0x258c('0x3a')](function(_0x5db0d7){_0x318b43(_0x5db0d7);})[_0x258c('0x3b')](function(_0xdb9476){_0x64208e(_0xdb9476);});}else{originate(_0x2ad322,_0x765ea2,![])[_0x258c('0x3a')](function(_0x5a9ccf){_0x318b43(_0x5a9ccf);})[_0x258c('0x3b')](function(_0x572be0){_0x64208e(_0x572be0);});}});};Fax[_0x258c('0x1c')][_0x258c('0x69')]=function(_0x47cd3d){return!_[_0x258c('0x6a')](_0x47cd3d)&&!_[_0x258c('0x6a')](_0x47cd3d['name'])&&!_[_0x258c('0x6a')](_0x47cd3d[_0x258c('0x6b')])&&_0x47cd3d[_0x258c('0x6b')]&&!_['isNil'](this[_0x258c('0xe')][util[_0x258c('0x61')]('SIP/%s',_0x47cd3d['name'])])&&!_[_0x258c('0x6a')](this[_0x258c('0xe')][util[_0x258c('0x61')]('SIP/%s',_0x47cd3d[_0x258c('0x38')])]['status'])&&(this[_0x258c('0xe')][util[_0x258c('0x61')](_0x258c('0x6c'),_0x47cd3d[_0x258c('0x38')])][_0x258c('0x2c')]===_0x258c('0x6d')||this['trunks'][util[_0x258c('0x61')](_0x258c('0x6c'),_0x47cd3d[_0x258c('0x38')])]['status']===_0x258c('0x6e'));};Fax[_0x258c('0x1c')]['checkTrunk']=function(_0x3e68f3,_0x3d0797){if(!this[_0x258c('0x69')](_0x3e68f3)){ut[_0x258c('0x48')](_0x258c('0x6f'),_[_0x258c('0x6a')](_0x3e68f3)?'':_0x3e68f3[_0x258c('0x38')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x258c('0x70')};}if(_[_0x258c('0x6a')](_0x3d0797[_0x258c('0x6')])){ut[_0x258c('0x48')](_0x258c('0x71'),JSON[_0x258c('0x3e')](_0x3d0797));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x3d0797[_0x258c('0x2')])){ut[_0x258c('0x48')](_0x258c('0x72'),JSON['stringify'](_0x3d0797));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x258c('0x73')};};module[_0x258c('0x74')]=Fax; \ No newline at end of file +var _0x2fc4=['lodash','bluebird','moment','path','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatus','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid'];(function(_0x1b8498,_0x891643){var _0x40add6=function(_0xe1d17b){while(--_0xe1d17b){_0x1b8498['push'](_0x1b8498['shift']());}};_0x40add6(++_0x891643);}(_0x2fc4,0x153));var _0x42fc=function(_0x27f424,_0xa6af37){_0x27f424=_0x27f424-0x0;var _0x5ae589=_0x2fc4[_0x27f424];return _0x5ae589;};'use strict';var util=require('util');var _=require(_0x42fc('0x0'));var BPromise=require(_0x42fc('0x1'));var uuid=require('uuid');var moment=require(_0x42fc('0x2'));var path=require(_0x42fc('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x42fc('0x4'))(_0x42fc('0x5'));var ami=require(_0x42fc('0x6'));var rpcDb=require(_0x42fc('0x7'));var Channel=require(_0x42fc('0x8'));var ut=require(_0x42fc('0x9'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x42fc('0xa'));var faxMessage=require(_0x42fc('0xb'));function Fax(_0x11fcf2){this[_0x42fc('0xc')]={};this[_0x42fc('0xd')]=_0x11fcf2[_0x42fc('0xd')];this[_0x42fc('0xe')]=_0x11fcf2[_0x42fc('0xe')];this[_0x42fc('0xf')]={};ami['on'](_0x42fc('0x10'),this[_0x42fc('0x11')][_0x42fc('0x12')](this));ami['on'](_0x42fc('0x13'),this[_0x42fc('0x14')][_0x42fc('0x12')](this));ami['on']('newstate',this[_0x42fc('0x15')]['bind'](this));ami['on']('newexten',this[_0x42fc('0x16')][_0x42fc('0x12')](this));ami['on']('faxstatus',this[_0x42fc('0x17')][_0x42fc('0x12')](this));ami['on'](_0x42fc('0x18'),this[_0x42fc('0x19')]['bind'](this));ami['on']('hangup',this[_0x42fc('0x1a')][_0x42fc('0x12')](this));ami['on']('originateresponse',this[_0x42fc('0x1b')]['bind'](this));}Fax['prototype']['syncNewchannel']=function(_0x14a54b){if(_0x14a54b[_0x42fc('0x1c')]===_0x42fc('0x1d')){for(var _0xf4a563 in this[_0x42fc('0xd')]){if(this[_0x42fc('0xd')][_0x42fc('0x1e')](_0xf4a563)){if(_0x14a54b[_0x42fc('0x1f')]===this[_0x42fc('0xd')][_0xf4a563][_0x42fc('0x20')]){this[_0x42fc('0xc')][_0x14a54b[_0x42fc('0x21')]]={};this['channels'][_0x14a54b[_0x42fc('0x21')]][_0x42fc('0x22')]=_0x14a54b[_0x42fc('0x22')];this['channels'][_0x14a54b[_0x42fc('0x21')]]['id']=this[_0x42fc('0xd')][_0xf4a563]['id'];this['channels'][_0x14a54b[_0x42fc('0x21')]][_0x42fc('0x23')]=this[_0x42fc('0xd')][_0xf4a563]['name'];logger['info'](_0x14a54b[_0x42fc('0x21')],'\x20syncNewchannel\x20');}}}}if(this[_0x42fc('0xf')][_0x14a54b['uniqueid']]){this[_0x42fc('0xc')][_0x14a54b['uniqueid']]={};this['channels'][_0x14a54b['uniqueid']][_0x42fc('0x22')]=_0x14a54b[_0x42fc('0x22')];logger[_0x42fc('0x24')](_0x14a54b['uniqueid'],_0x42fc('0x25'));}};Fax[_0x42fc('0x26')][_0x42fc('0x14')]=function(_0x63b70c){if(this['channels'][_0x63b70c['uniqueid']]){for(var _0x27e92d in _0x63b70c[_0x42fc('0x27')]){if(_0x63b70c['variable'][_0x42fc('0x1e')](_0x27e92d)){this[_0x42fc('0xc')][_0x63b70c[_0x42fc('0x21')]][_0x27e92d]=_0x63b70c[_0x42fc('0x28')];}}}};Fax[_0x42fc('0x26')][_0x42fc('0x15')]=function(_0x3ed823){if(this[_0x42fc('0xc')][_0x3ed823[_0x42fc('0x21')]]){this[_0x42fc('0xc')][_0x3ed823[_0x42fc('0x21')]][_0x42fc('0x29')]=_0x3ed823[_0x42fc('0x29')];this[_0x42fc('0xc')][_0x3ed823[_0x42fc('0x21')]][_0x42fc('0x2a')]=_0x3ed823[_0x42fc('0x2a')];}};Fax['prototype'][_0x42fc('0x16')]=function(_0x556e46){if(this['channels'][_0x556e46['uniqueid']]){for(var _0x562ad4 in _0x556e46['variable']){if(_0x556e46[_0x42fc('0x27')]['hasOwnProperty'](_0x562ad4)){this['channels'][_0x556e46[_0x42fc('0x21')]][_0x562ad4]=_0x556e46[_0x42fc('0x28')];}}}};Fax[_0x42fc('0x26')][_0x42fc('0x17')]=function(_0x3177ff){if(this['channels'][_0x3177ff[_0x42fc('0x21')]]){this[_0x42fc('0xc')][_0x3177ff[_0x42fc('0x21')]][_0x42fc('0x2b')]=_0x3177ff['operation'];this[_0x42fc('0xc')][_0x3177ff[_0x42fc('0x21')]]['status']=_0x3177ff[_0x42fc('0x2c')];this[_0x42fc('0xc')][_0x3177ff['uniqueid']][_0x42fc('0x20')]=_0x3177ff['localstationid'];this[_0x42fc('0xc')][_0x3177ff[_0x42fc('0x21')]][_0x42fc('0x2d')]=_0x3177ff[_0x42fc('0x2d')];logger[_0x42fc('0x24')](_0x3177ff[_0x42fc('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0x42fc('0x26')][_0x42fc('0x19')]=function(_0x491097){var _0x561885=this;if(this[_0x42fc('0xc')][_0x491097[_0x42fc('0x21')]]){var _0x4693a4=this[_0x42fc('0xc')][_0x491097[_0x42fc('0x21')]]['id'];this[_0x42fc('0xc')][_0x491097[_0x42fc('0x21')]]['remotestationid']=_0x491097[_0x42fc('0x2e')];this[_0x42fc('0xc')][_0x491097['uniqueid']][_0x42fc('0x2f')]=_0x491097[_0x42fc('0x2f')];this[_0x42fc('0xc')][_0x491097['uniqueid']][_0x42fc('0x20')]=_0x491097[_0x42fc('0x20')];this[_0x42fc('0xc')][_0x491097[_0x42fc('0x21')]][_0x42fc('0x30')]=_0x491097[_0x42fc('0x30')];this['channels'][_0x491097[_0x42fc('0x21')]]['transferrate']=_0x491097['transferrate'];this[_0x42fc('0xc')][_0x491097[_0x42fc('0x21')]]['filename']=_0x491097[_0x42fc('0x2d')];this[_0x42fc('0xc')][_0x491097['uniqueid']][_0x42fc('0x31')]=_0x491097[_0x42fc('0x31')];if(this['channels'][_0x491097[_0x42fc('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x491097[_0x42fc('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x5be991){logger[_0x42fc('0x24')](_0x491097[_0x42fc('0x21')],_0x42fc('0x32'),_0x5be991[_0x42fc('0x33')]);attachment[_0x42fc('0x34')]({'name':path[_0x42fc('0x35')](_0x491097['filename'])[_0x42fc('0x23')],'basename':path[_0x42fc('0x35')](_0x491097[_0x42fc('0x2d')])[_0x42fc('0x23')]+_0x42fc('0x36'),'type':'application/pdf'})[_0x42fc('0x37')](function(_0x4e4a70){faxAccount[_0x42fc('0x38')](_0x4693a4,{'from':_0x491097[_0x42fc('0x31')],'mapKey':_0x42fc('0x5'),'body':path[_0x42fc('0x35')](_0x491097[_0x42fc('0x2d')])[_0x42fc('0x23')]+'.pdf','AttachmentId':_0x4e4a70['id']})['catch'](function(_0xea90bb){logger[_0x42fc('0x39')](_0x491097['uniqueid'],_0x42fc('0x3a'),JSON[_0x42fc('0x3b')](_0xea90bb));});})[_0x42fc('0x3c')](function(_0x4b1ac1){logger[_0x42fc('0x39')](_0x491097[_0x42fc('0x21')],'\x20receiveFax\x20',JSON['stringify'](_0x4b1ac1));});});}logger['info'](_0x491097[_0x42fc('0x21')],_0x42fc('0x3d'));}};Fax['prototype'][_0x42fc('0x1b')]=function(_0x205de3){if(this['actions'][_0x205de3['uniqueid']]){_[_0x42fc('0x3e')](this[_0x42fc('0xc')][_0x205de3['uniqueid']],_['pick'](_0x205de3,[_0x42fc('0x3f'),_0x42fc('0x40')]));}};function updateStatus(_0x2438a3){if(_0x2438a3[_0x42fc('0x41')]){faxMessage[_0x42fc('0x42')](_0x2438a3[_0x42fc('0x41')],{'failMessage':_0x42fc('0x43')})[_0x42fc('0x37')](function(_0x556e8b){ut[_0x42fc('0x44')](_0x42fc('0x45'),_0x556e8b);})[_0x42fc('0x3c')](function(_0x31805c){ut[_0x42fc('0x44')](_0x42fc('0x46'),_0x31805c);});}else{ut[_0x42fc('0x44')](_0x42fc('0x47'));}}Fax[_0x42fc('0x26')][_0x42fc('0x48')]=function(_0x55ba21,_0x11051c,_0x3edf32){var _0x523218=this;var _0x413750={};if(_0x11051c){_0x413750={'read':_0x11051c};}else{_0x413750={'failMessage':_0x3edf32};}if(this[_0x42fc('0xf')][_0x55ba21][_0x42fc('0x41')]){faxMessage[_0x42fc('0x42')](this[_0x42fc('0xf')][_0x55ba21]['AttachmentId'],_0x413750)[_0x42fc('0x37')](function(_0x35d946){ut[_0x42fc('0x44')]('[Fax][Message][Updated]',_0x35d946);})[_0x42fc('0x3c')](function(_0x21980e){ut[_0x42fc('0x44')]('[Fax][Message][NoUpdate1]',_0x21980e);})[_0x42fc('0x49')](function(){delete _0x523218[_0x42fc('0xc')][_0x55ba21];delete _0x523218[_0x42fc('0xf')][_0x55ba21];});}else{ut[_0x42fc('0x44')](_0x42fc('0x4a'));delete this[_0x42fc('0xc')][_0x55ba21];delete this[_0x42fc('0xf')][_0x55ba21];}};Fax['prototype'][_0x42fc('0x1a')]=function(_0x1cc36b){var _0x7ea727=this;if(this[_0x42fc('0xc')][_0x1cc36b[_0x42fc('0x21')]]){if(this['actions'][_0x1cc36b[_0x42fc('0x21')]]){this[_0x42fc('0xc')][_0x1cc36b[_0x42fc('0x21')]]['id']=this['actions'][_0x1cc36b['uniqueid']]['id'];this[_0x42fc('0xc')][_0x1cc36b[_0x42fc('0x21')]][_0x42fc('0x23')]=this[_0x42fc('0xf')][_0x1cc36b[_0x42fc('0x21')]]['name'];}logger[_0x42fc('0x24')](_0x1cc36b[_0x42fc('0x21')],this[_0x42fc('0xf')][_0x1cc36b['uniqueid']]?_0x42fc('0x4b'):'\x20hangup\x20faxRiceive\x20',JSON[_0x42fc('0x3b')](this[_0x42fc('0xc')][_0x1cc36b[_0x42fc('0x21')]]));if(this[_0x42fc('0xf')][_0x1cc36b['uniqueid']]){if(this[_0x42fc('0xc')][_0x1cc36b['uniqueid']][_0x42fc('0x4c')]>0x0&&this[_0x42fc('0xc')][_0x1cc36b['uniqueid']][_0x42fc('0x4d')]===_0x42fc('0x4e')){this[_0x42fc('0x48')](_0x1cc36b[_0x42fc('0x21')],!![]);}else{this[_0x42fc('0x48')](_0x1cc36b['uniqueid'],![],this[_0x42fc('0xc')][_0x1cc36b[_0x42fc('0x21')]]['faxstatusstring']?_0x42fc('0x4f')+this['channels'][_0x1cc36b['uniqueid']][_0x42fc('0x50')]:_0x42fc('0x51'));}}}};Fax[_0x42fc('0x26')][_0x42fc('0x52')]=function(_0x1cf64c){var _0x2240ef=this;return new BPromise(function(_0x39326e,_0x2aaced){_0x2240ef[_0x42fc('0x53')](_0x1cf64c,_0x2240ef['faxAccounts'][_0x1cf64c['FaxAccountId']])['then'](function(_0x69c06d){ut['logger'](_0x42fc('0x54'),_0x69c06d);_0x39326e(ut[_0x42fc('0x33')](_0x42fc('0x55')));})['catch'](function(_0x41a65b){ut[_0x42fc('0x44')](_0x42fc('0x56'),_0x41a65b);updateStatus(_0x1cf64c);_0x2aaced(ut['message'](_0x42fc('0x57')));});});};Fax[_0x42fc('0x26')][_0x42fc('0x58')]=function(_0x4d31ab){var _0x575a63=this;return new BPromise(function(_0xe5fb47,_0x53cdc8){var _0x1d7bcd=_0x575a63['checkTrunk'](_0x575a63[_0x42fc('0xd')][_0x4d31ab[_0x42fc('0x59')]][_0x42fc('0x5a')],_0x4d31ab);if(_0x1d7bcd['isValid']){_0xe5fb47(ut[_0x42fc('0x33')](_0x42fc('0x5b')));}else{_0x53cdc8(ut['message'](_0x1d7bcd[_0x42fc('0x33')]));}});};function originate(_0x1707fb,_0x3e5ad6,_0x33b489){return new BPromise(function(_0x2eb856,_0x815882){if(_0x33b489){var _0x1d6fa1=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x1707fb[_0x42fc('0x3')])[_0x42fc('0x23')],_0x1707fb[_0x42fc('0x3')]);gs[_0x42fc('0x5c')](_0x1d6fa1)[_0x42fc('0x37')](function(){_0x1707fb['path']=util[_0x42fc('0x5d')](_0x42fc('0x5e'),path['parse'](_0x1707fb[_0x42fc('0x3')])[_0x42fc('0x5f')],path['parse'](_0x1707fb[_0x42fc('0x3')])[_0x42fc('0x23')]);_0x3e5ad6[_0x42fc('0x60')]=_0x1707fb[_0x42fc('0x3')];ut['logger'](_0x42fc('0x61'),'');ami[_0x42fc('0x62')](ut[_0x42fc('0x63')](_0x1707fb,_0x3e5ad6))['then'](function(_0x4d5544){_0x2eb856(_0x4d5544);})[_0x42fc('0x3c')](function(_0x36dcb3){_0x815882(_0x36dcb3);});})[_0x42fc('0x3c')](function(_0x4cd441){_0x815882(_0x4cd441);});}else{ami[_0x42fc('0x62')](ut[_0x42fc('0x63')](_0x1707fb,_0x3e5ad6))[_0x42fc('0x37')](function(_0x3e09a5){_0x2eb856(_0x3e09a5);})['catch'](function(_0x5d62c2){_0x815882(_0x5d62c2);});}});}Fax[_0x42fc('0x26')]['execOriginate']=function(_0x3c0db9,_0x92590b){var _0x12f385=this;return new BPromise(function(_0x399baf,_0xa8ff60){var _0x7b43d3=uuid['v4']();var _0x2390e9=ut[_0x42fc('0x64')](_0x3c0db9,_0x92590b);_0x12f385[_0x42fc('0xf')][_0x7b43d3]=new Action(_0x7b43d3,_0x92590b,_0x3c0db9);var _0x19c8a0=_0x12f385[_0x42fc('0xf')][_0x7b43d3];if(path['parse'](_0x3c0db9[_0x42fc('0x3')])['ext']===_0x42fc('0x36')){originate(_0x19c8a0,_0x2390e9,!![])['then'](function(_0xc8e440){_0x399baf(_0xc8e440);})[_0x42fc('0x3c')](function(_0x41b0cf){_0xa8ff60(_0x41b0cf);});}else{originate(_0x19c8a0,_0x2390e9,![])[_0x42fc('0x37')](function(_0x1d55c3){_0x399baf(_0x1d55c3);})[_0x42fc('0x3c')](function(_0x332f7d){_0xa8ff60(_0x332f7d);});}});};Fax['prototype'][_0x42fc('0x65')]=function(_0x3349b7){return!_['isNil'](_0x3349b7)&&!_[_0x42fc('0x66')](_0x3349b7[_0x42fc('0x23')])&&!_[_0x42fc('0x66')](_0x3349b7['active'])&&_0x3349b7[_0x42fc('0x67')]&&!_[_0x42fc('0x66')](this[_0x42fc('0xe')][util['format'](_0x42fc('0x68'),_0x3349b7[_0x42fc('0x23')])])&&!_[_0x42fc('0x66')](this[_0x42fc('0xe')][util[_0x42fc('0x5d')](_0x42fc('0x68'),_0x3349b7[_0x42fc('0x23')])][_0x42fc('0x2c')])&&(this[_0x42fc('0xe')][util[_0x42fc('0x5d')](_0x42fc('0x68'),_0x3349b7['name'])][_0x42fc('0x2c')]==='reachable'||this[_0x42fc('0xe')][util[_0x42fc('0x5d')]('SIP/%s',_0x3349b7[_0x42fc('0x23')])][_0x42fc('0x2c')]===_0x42fc('0x69'));};Fax[_0x42fc('0x26')][_0x42fc('0x6a')]=function(_0x11dd55,_0x2c8a59){if(!this[_0x42fc('0x65')](_0x11dd55)){ut[_0x42fc('0x44')](_0x42fc('0x6b'),_[_0x42fc('0x66')](_0x11dd55)?'':_0x11dd55[_0x42fc('0x23')]+_0x42fc('0x6c'));return{'isValid':![],'message':_0x42fc('0x6d')};}if(_['isNil'](_0x2c8a59['fax'])){ut[_0x42fc('0x44')](_0x42fc('0x6e'),JSON[_0x42fc('0x3b')](_0x2c8a59));return{'isValid':![],'message':_0x42fc('0x6f')};}if(_[_0x42fc('0x66')](_0x2c8a59[_0x42fc('0x3')])){ut[_0x42fc('0x44')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x42fc('0x3b')](_0x2c8a59));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x42fc('0x70')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 168e8f0..a3b9a54 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 _0xe3bd=['inspect','notify','then','[Notify]\x20','bluebird','../../../config/logger','lodash','error'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xe3bd,0x1ec));var _0xde3b=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0xe3bd[_0x2c602e];return _0x1a2650;};'use strict';var util=require('util');var BPromise=require(_0xde3b('0x0'));var logger=require(_0xde3b('0x1'))('preview');var _=require(_0xde3b('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x46ec71){return function(_0x5ec212){logger[_0xde3b('0x3')](_0x46ec71,util[_0xde3b('0x4')](_0x5ec212,{'showHidden':![],'depth':null}));};}exports[_0xde3b('0x5')]=function(_0x213f06,_0x2cd261){return BPromise['resolve']()[_0xde3b('0x6')](faxAccount[_0xde3b('0x5')](_0x213f06,_0x2cd261))['catch'](loggerCatch(_0xde3b('0x7')));}; \ No newline at end of file +var _0x6b9f=['../rpc/faxAccount','error','inspect','notify','resolve','catch','../../../config/logger','preview','lodash'];(function(_0x15fa42,_0x3aff88){var _0x47d7ab=function(_0x29c623){while(--_0x29c623){_0x15fa42['push'](_0x15fa42['shift']());}};_0x47d7ab(++_0x3aff88);}(_0x6b9f,0x9f));var _0xf6b9=function(_0x20d0c5,_0x3a1d1d){_0x20d0c5=_0x20d0c5-0x0;var _0xebfea0=_0x6b9f[_0x20d0c5];return _0xebfea0;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xf6b9('0x0'))(_0xf6b9('0x1'));var _=require(_0xf6b9('0x2'));var faxAccount=require(_0xf6b9('0x3'));function loggerCatch(_0x3ebfb4){return function(_0xf8a959){logger[_0xf6b9('0x4')](_0x3ebfb4,util[_0xf6b9('0x5')](_0xf8a959,{'showHidden':![],'depth':null}));};}exports[_0xf6b9('0x6')]=function(_0x38bbc5,_0x57c49a){return BPromise[_0xf6b9('0x7')]()['then'](faxAccount[_0xf6b9('0x6')](_0x38bbc5,_0x57c49a))[_0xf6b9('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 18ba706..a5e6fb9 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 _0x4cfd=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x22a6ec,_0x40571b){var _0x58aab4=function(_0x52ca9c){while(--_0x52ca9c){_0x22a6ec['push'](_0x22a6ec['shift']());}};_0x58aab4(++_0x40571b);}(_0x4cfd,0xa9));var _0xd4cf=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x4cfd[_0x3e44fa];return _0x2a0aba;};'use strict';var util=require(_0xd4cf('0x0'));var logger=require(_0xd4cf('0x1'))(_0xd4cf('0x2'));var BPromise=require(_0xd4cf('0x3'));var exec=require(_0xd4cf('0x4'))[_0xd4cf('0x5')];exports[_0xd4cf('0x6')]=function(_0x128d1d){return new BPromise(function(_0x45a864,_0x41616a){exec(_0x128d1d,function(_0x1d46fc,_0x1ebe08,_0x13aeaf){logger[_0xd4cf('0x7')](_0xd4cf('0x8'),_0x1ebe08);if(_0x1d46fc){logger[_0xd4cf('0x7')]('Exec\x20gs',_0xd4cf('0x9'),util[_0xd4cf('0xa')](_0x1d46fc,{'showHidden':![],'depth':null}),_0x1ebe08,_0x13aeaf);_0x41616a(_0x1d46fc);}_0x45a864(_0x1ebe08);});});}; \ No newline at end of file +var _0xd316=['child_process','exec','Exec\x20gs','\x20Error\x20:','inspect','util','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd316,0x75));var _0x6d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd316[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6d31('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x6d31('0x1'));var exec=require(_0x6d31('0x2'))[_0x6d31('0x3')];exports['execute']=function(_0x42c56f){return new BPromise(function(_0x47832b,_0x47c340){exec(_0x42c56f,function(_0x12375d,_0x3aaf68,_0xe0d3ea){logger['info'](_0x6d31('0x4'),_0x3aaf68);if(_0x12375d){logger['info'](_0x6d31('0x4'),_0x6d31('0x5'),util[_0x6d31('0x6')](_0x12375d,{'showHidden':![],'depth':null}),_0x3aaf68,_0xe0d3ea);_0x47c340(_0x12375d);}_0x47832b(_0x3aaf68);});});}; \ 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 5db422c..99e4f6f 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 _0xaa88=['message','logger','info','ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa88,0x137));var _0x8aa8=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xaa88[_0xf71120];return _0xbe2fd3;};'use strict';var util=require(_0x8aa8('0x0'));var _=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var logger=require(_0x8aa8('0x3'))('fax');exports[_0x8aa8('0x4')]=function(_0x3a5b12){return{'message':_0x3a5b12};};exports[_0x8aa8('0x5')]=function(_0x3b2c88,_0x3e3b70){logger[_0x8aa8('0x6')](_0x3b2c88,util['inspect'](_0x3e3b70,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x460042,_0x5264ff){var _0x449d2d={'XMF-ECM':_0x5264ff[_0x8aa8('0x7')],'XMF-HEADERINFO':_0x5264ff[_0x8aa8('0x8')],'XMF-MINRATE':_0x5264ff[_0x8aa8('0x9')],'XMF-MAXRATE':_0x5264ff['maxrate'],'XMF-MODEM':util[_0x8aa8('0xa')](_0x8aa8('0xb'),_0x5264ff[_0x8aa8('0xc')]),'XMF-GATEWAY':_0x5264ff['gateway'],'XMF-FAXDETECT':_0x5264ff[_0x8aa8('0xd')],'XMF-T38TIMEOUT':_0x5264ff[_0x8aa8('0xe')],'XMF-LOCALSTATIONID':_0x5264ff[_0x8aa8('0xf')],'XMF-PATH':_0x460042[_0x8aa8('0x10')]};return _0x449d2d;};exports['variablesAction']=function(_0x3f8100,_0x30c114){return{'actionid':_0x3f8100['uniqueid'],'action':_0x8aa8('0x11'),'channel':_0x3f8100[_0x8aa8('0x12')],'Exten':_0x8aa8('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x8aa8('0xa')](_0x8aa8('0x14'),_0x3f8100[_0x8aa8('0x8')]?_0x3f8100['headerinfo']:'',_0x3f8100[_0x8aa8('0xf')]),'variable':_0x30c114,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3f8100['uniqueid']};}; \ No newline at end of file +var _0xc368=['from-sip','\x22%s\x22\x20<%s>','localstationid','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc368,0x7b));var _0x8c36=function(_0xb9e95b,_0x522ddc){_0xb9e95b=_0xb9e95b-0x0;var _0x3b3396=_0xc368[_0xb9e95b];return _0x3b3396;};'use strict';var util=require('util');var _=require(_0x8c36('0x0'));var moment=require('moment');var logger=require(_0x8c36('0x1'))(_0x8c36('0x2'));exports[_0x8c36('0x3')]=function(_0x2640c5){return{'message':_0x2640c5};};exports[_0x8c36('0x4')]=function(_0x5d3b27,_0x3e9034){logger[_0x8c36('0x5')](_0x5d3b27,util[_0x8c36('0x6')](_0x3e9034,{'showHidden':![],'depth':null}));};exports[_0x8c36('0x7')]=function(_0x5ebfc1,_0x554022){var _0x8ed437={'XMF-ECM':_0x554022[_0x8c36('0x8')],'XMF-HEADERINFO':_0x554022[_0x8c36('0x9')],'XMF-MINRATE':_0x554022[_0x8c36('0xa')],'XMF-MAXRATE':_0x554022[_0x8c36('0xb')],'XMF-MODEM':util[_0x8c36('0xc')]('\x22%s\x22',_0x554022['modem']),'XMF-GATEWAY':_0x554022['gateway'],'XMF-FAXDETECT':_0x554022[_0x8c36('0xd')],'XMF-T38TIMEOUT':_0x554022[_0x8c36('0xe')],'XMF-LOCALSTATIONID':_0x554022['localstationid'],'XMF-PATH':_0x5ebfc1[_0x8c36('0xf')]};return _0x8ed437;};exports[_0x8c36('0x10')]=function(_0x1d5c61,_0xe7857e){return{'actionid':_0x1d5c61[_0x8c36('0x11')],'action':_0x8c36('0x12'),'channel':_0x1d5c61[_0x8c36('0x13')],'Exten':_0x8c36('0x14'),'Context':_0x8c36('0x15'),'Priority':'1','callerid':util[_0x8c36('0xc')](_0x8c36('0x16'),_0x1d5c61[_0x8c36('0x9')]?_0x1d5c61[_0x8c36('0x9')]:'',_0x1d5c61[_0x8c36('0x17')]),'variable':_0xe7857e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d5c61['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index bac096b..97f0b13 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 _0x5e35=['initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','listen','sync','catch','bluebird','util','moment','./realtime','./report','./acw','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts'];(function(_0xd1fff0,_0x2f3df0){var _0x1fedcf=function(_0x54df7f){while(--_0x54df7f){_0xd1fff0['push'](_0xd1fff0['shift']());}};_0x1fedcf(++_0x2f3df0);}(_0x5e35,0x1af));var _0x55e3=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x5e35[_0x1e4360];return _0x31e6b4;};'use strict';var BPromise=require(_0x55e3('0x0'));var util=require(_0x55e3('0x1'));var moment=require(_0x55e3('0x2'));var server=require('./server');var Realtime=require(_0x55e3('0x3'));var Report=require(_0x55e3('0x4'));var Acw=require(_0x55e3('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x55e3('0x6'));var Preview=require('./preview');var Fax=require(_0x55e3('0x7'));var user=require(_0x55e3('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x55e3('0x9'));var voiceCallReport=require(_0x55e3('0xa'));var trunk=require(_0x55e3('0xb'));var trigger=require(_0x55e3('0xc'));var template=require(_0x55e3('0xd'));var cmHopperHistory=require(_0x55e3('0xe'));var campaign=require(_0x55e3('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x55e3('0x10'));var zendesk=require(_0x55e3('0x11'));var salesforce=require(_0x55e3('0x12'));var sugarcrm=require(_0x55e3('0x13'));var freshdesk=require(_0x55e3('0x14'));var desk=require(_0x55e3('0x15'));var zoho=require(_0x55e3('0x16'));var vtiger=require(_0x55e3('0x17'));var freshsales=require('./rpc/integrations/freshsales');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()[_0x55e3('0x18')](_0x55e3('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x55e3('0x18')](_0x55e3('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x55e3('0x1a')]()[_0x55e3('0x1b')](user[_0x55e3('0x1c')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x1d')]())[_0x55e3('0x1b')](user[_0x55e3('0x1e')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x1f')]())[_0x55e3('0x1b')](trunk[_0x55e3('0x20')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x21')]())[_0x55e3('0x1b')](voiceQueue['getVoiceQueues']())[_0x55e3('0x1b')](realtime['initVoiceQueues']())[_0x55e3('0x1b')](trigger['getTriggers']())['then'](realtime[_0x55e3('0x22')]())[_0x55e3('0x1b')](template['getTemplates']())[_0x55e3('0x1b')](realtime[_0x55e3('0x23')]())['then'](zendesk['getZendeskAccounts']())[_0x55e3('0x1b')](realtime[_0x55e3('0x24')]())['then'](salesforce[_0x55e3('0x25')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x26')]())[_0x55e3('0x1b')](sugarcrm[_0x55e3('0x27')]())['then'](realtime[_0x55e3('0x28')]())[_0x55e3('0x1b')](freshdesk['getFreshdeskAccounts']())[_0x55e3('0x1b')](realtime[_0x55e3('0x29')]())[_0x55e3('0x1b')](desk[_0x55e3('0x2a')]())['then'](realtime[_0x55e3('0x2b')]())[_0x55e3('0x1b')](zoho[_0x55e3('0x2c')]())[_0x55e3('0x1b')](realtime['initZohoAccounts']())['then'](vtiger[_0x55e3('0x2d')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x2e')]())[_0x55e3('0x1b')](freshsales[_0x55e3('0x2f')]())['then'](realtime[_0x55e3('0x30')]())[_0x55e3('0x1b')](servicenow[_0x55e3('0x31')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x32')]())[_0x55e3('0x1b')](dynamics365[_0x55e3('0x33')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x34')]())[_0x55e3('0x1b')](campaign['getCampaigns']())[_0x55e3('0x1b')](realtime[_0x55e3('0x35')]())[_0x55e3('0x1b')](voiceExtension[_0x55e3('0x36')]())['then'](realtime[_0x55e3('0x37')]())[_0x55e3('0x1b')](faxAccount[_0x55e3('0x38')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x39')]())[_0x55e3('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x55e3('0x1a')]()[_0x55e3('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0x55e3('0x1b')](realtime[_0x55e3('0x3a')]())[_0x55e3('0x1b')](cmHopperHistory[_0x55e3('0x3b')]())[_0x55e3('0x1b')](realtime[_0x55e3('0x3c')]())[_0x55e3('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0x55e3('0x1b')](realtime[_0x55e3('0x3d')]())[_0x55e3('0x1b')](voiceCallReport[_0x55e3('0x3e')]())['then'](realtime['initVoiceCallReports']())[_0x55e3('0x1b')](function(_0x2a9172){})['catch'](function(_0x1cce44){console[_0x55e3('0x3f')](_0x1cce44);});}function main(){return server[_0x55e3('0x40')](realtime,preview,fax)[_0x55e3('0x1b')](function(_0x28c680){return initRealtime();})[_0x55e3('0x1b')](function(){return initParams();})[_0x55e3('0x1b')](function(){report[_0x55e3('0x41')]();setInterval(initRealtime,0x1388);})[_0x55e3('0x42')](function(_0x51f8c9){console[_0x55e3('0x3f')](_0x51f8c9);});}main(); \ No newline at end of file +var _0x2cb0=['initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','bluebird','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2cb0,0xdd));var _0x02cb=function(_0x1aec19,_0x330feb){_0x1aec19=_0x1aec19-0x0;var _0x4f2068=_0x2cb0[_0x1aec19];return _0x4f2068;};'use strict';var BPromise=require(_0x02cb('0x0'));var util=require('util');var moment=require(_0x02cb('0x1'));var server=require('./server');var Realtime=require(_0x02cb('0x2'));var Report=require(_0x02cb('0x3'));var Acw=require(_0x02cb('0x4'));var Trigger=require(_0x02cb('0x5'));var Dialer=require(_0x02cb('0x6'));var Preview=require(_0x02cb('0x7'));var Fax=require(_0x02cb('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x02cb('0x9'));var trigger=require(_0x02cb('0xa'));var template=require('./rpc/template');var cmHopperHistory=require(_0x02cb('0xb'));var campaign=require(_0x02cb('0xc'));var voiceExtension=require(_0x02cb('0xd'));var faxAccount=require(_0x02cb('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x02cb('0xf'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x02cb('0x10'));var desk=require(_0x02cb('0x11'));var zoho=require(_0x02cb('0x12'));var vtiger=require(_0x02cb('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x02cb('0x14'));var dynamics365=require(_0x02cb('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x02cb('0x16')](_0x02cb('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x02cb('0x16')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x02cb('0x18')]()['then'](user[_0x02cb('0x19')]())[_0x02cb('0x1a')](realtime['initAgents']())[_0x02cb('0x1a')](user[_0x02cb('0x1b')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x1c')]())['then'](trunk[_0x02cb('0x1d')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x1e')]())[_0x02cb('0x1a')](voiceQueue['getVoiceQueues']())[_0x02cb('0x1a')](realtime['initVoiceQueues']())[_0x02cb('0x1a')](trigger[_0x02cb('0x1f')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x20')]())[_0x02cb('0x1a')](template[_0x02cb('0x21')]())['then'](realtime[_0x02cb('0x22')]())['then'](zendesk[_0x02cb('0x23')]())[_0x02cb('0x1a')](realtime['initZendeskAccounts']())[_0x02cb('0x1a')](salesforce[_0x02cb('0x24')]())['then'](realtime[_0x02cb('0x25')]())[_0x02cb('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x02cb('0x1a')](realtime['initSugarcrmAccounts']())[_0x02cb('0x1a')](freshdesk[_0x02cb('0x26')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x27')]())[_0x02cb('0x1a')](desk[_0x02cb('0x28')]())['then'](realtime['initDeskAccounts']())[_0x02cb('0x1a')](zoho[_0x02cb('0x29')]())['then'](realtime[_0x02cb('0x2a')]())['then'](vtiger[_0x02cb('0x2b')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x2c')]())['then'](freshsales[_0x02cb('0x2d')]())['then'](realtime[_0x02cb('0x2e')]())[_0x02cb('0x1a')](servicenow['getServicenowAccounts']())[_0x02cb('0x1a')](realtime[_0x02cb('0x2f')]())[_0x02cb('0x1a')](dynamics365[_0x02cb('0x30')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x31')]())['then'](campaign[_0x02cb('0x32')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x33')]())[_0x02cb('0x1a')](voiceExtension[_0x02cb('0x34')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x35')]())[_0x02cb('0x1a')](faxAccount[_0x02cb('0x36')]())['then'](realtime[_0x02cb('0x37')]())[_0x02cb('0x1a')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x02cb('0x38')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x39')]())[_0x02cb('0x1a')](cmHopperHistory[_0x02cb('0x3a')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x3b')]())[_0x02cb('0x1a')](cmHopperHistory[_0x02cb('0x3c')]())['then'](realtime[_0x02cb('0x3d')]())[_0x02cb('0x1a')](voiceCallReport[_0x02cb('0x3e')]())[_0x02cb('0x1a')](realtime[_0x02cb('0x3f')]())[_0x02cb('0x1a')](function(_0x16d303){})[_0x02cb('0x40')](function(_0x5dc038){console[_0x02cb('0x41')](_0x5dc038);});}function main(){return server[_0x02cb('0x42')](realtime,preview,fax)[_0x02cb('0x1a')](function(_0x32e3bf){return initRealtime();})['then'](function(){return initParams();})[_0x02cb('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x02cb('0x40')](function(_0x3d88ce){console[_0x02cb('0x41')](_0x3d88ce);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 96210b9..f6dcf4f 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 _0x32f4=['localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','toNumber','format','voiceStatusCallerIdNumber','voiceStatusQueue','stringify','user:%s','emit','user:save','lodash','util','moment','md5','ioredis','redis','defaults'];(function(_0x1002b4,_0x3f09fb){var _0x3a4e7f=function(_0x169d02){while(--_0x169d02){_0x1002b4['push'](_0x1002b4['shift']());}};_0x3a4e7f(++_0x3f09fb);}(_0x32f4,0x74));var _0x432f=function(_0x58d25c,_0x4e9bdf){_0x58d25c=_0x58d25c-0x0;var _0xf17b59=_0x32f4[_0x58d25c];return _0xf17b59;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var md5=require(_0x432f('0x3'));var Redis=require(_0x432f('0x4'));var config=require('../../../config/environment');config[_0x432f('0x5')]=_[_0x432f('0x6')](config[_0x432f('0x5')],{'host':_0x432f('0x7'),'port':0x18eb});var io=require(_0x432f('0x8'))(new Redis(config[_0x432f('0x5')]));function Agent(_0xe36511){this['id']=_0xe36511['id']||0x0;this[_0x432f('0x9')]=_0xe36511[_0x432f('0x9')]||'';this['email']=_0xe36511[_0x432f('0xa')]||'';this[_0x432f('0xb')]=_0xe36511[_0x432f('0xb')]||'';this[_0x432f('0xc')]=_0xe36511[_0x432f('0xc')]||'';this[_0x432f('0xd')]=_0x432f('0xe');this[_0x432f('0xf')]=0x0;this[_0x432f('0x10')]='unknown';this[_0x432f('0x11')]='';this[_0x432f('0x12')]='';this[_0x432f('0x13')]='';this[_0x432f('0x14')]='';this[_0x432f('0x15')]=_0xe36511[_0x432f('0x15')]||![];this[_0x432f('0x16')]='unknown';this[_0x432f('0x17')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x432f('0x18')]=![];this[_0x432f('0x19')]=![];this['md5']='';}Agent[_0x432f('0x1a')][_0x432f('0x1b')]=function(_0x116529){var _0x22f2b6;if(_0x116529&&_0x116529[_0x432f('0xd')]){_0x22f2b6=_0x116529[_0x432f('0xd')][_0x432f('0x1c')]();switch(_0x22f2b6){case _0x432f('0x1d'):_0x22f2b6=_0x432f('0x1e');break;case _0x432f('0x1f'):_0x22f2b6=_0x432f('0x20');break;}}if(_0x22f2b6&&this[_0x432f('0x16')]!==_0x22f2b6||_0x116529['statePause']){this[_0x432f('0x17')]=_[_0x432f('0x21')](moment()[_0x432f('0x22')]('x'));}if(_0x22f2b6){this['voiceStatus']=_0x22f2b6;}var _0x24cd50={'id':this['id'],'name':this[_0x432f('0x9')],'email':this[_0x432f('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x432f('0xc')],'state':this[_0x432f('0xd')],'stateTime':this[_0x432f('0xf')],'status':this[_0x432f('0x10')],'address':this['address'],'online':this[_0x432f('0x15')],'voiceStatus':this[_0x432f('0x16')],'voiceStatusTime':this[_0x432f('0x17')],'voiceStatusCallerIdNumber':this[_0x432f('0x23')],'voiceStatusQueue':this[_0x432f('0x24')],'interface':this[_0x432f('0x14')],'onhold':this[_0x432f('0x18')]};var _0x2b22d2=md5(JSON[_0x432f('0x25')](_0x24cd50));if(this[_0x432f('0x3')]!==_0x2b22d2){this['md5']=_0x2b22d2;io['to'](util['format'](_0x432f('0x26'),_0x24cd50[_0x432f('0x9')]))[_0x432f('0x27')](_0x432f('0x28'),_0x24cd50);}};module['exports']=Agent; \ No newline at end of file +var _0xf7f0=['local','prototype','toLowerCase','not_inuse','idle','talking','statePause','toNumber','format','voiceStatusCallerIdNumber','interface','stringify','user:%s','emit','user:save','exports','lodash','util','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold'];(function(_0x4877bc,_0x24b542){var _0x296c34=function(_0x45e2b0){while(--_0x45e2b0){_0x4877bc['push'](_0x4877bc['shift']());}};_0x296c34(++_0x24b542);}(_0xf7f0,0x16f));var _0x0f7f=function(_0x46cd02,_0x1acf7b){_0x46cd02=_0x46cd02-0x0;var _0x332301=_0xf7f0[_0x46cd02];return _0x332301;};'use strict';var _=require(_0x0f7f('0x0'));var util=require(_0x0f7f('0x1'));var moment=require('moment');var md5=require(_0x0f7f('0x2'));var Redis=require(_0x0f7f('0x3'));var config=require(_0x0f7f('0x4'));config['redis']=_['defaults'](config[_0x0f7f('0x5')],{'host':_0x0f7f('0x6'),'port':0x18eb});var io=require(_0x0f7f('0x7'))(new Redis(config['redis']));function Agent(_0xd0e0ba){this['id']=_0xd0e0ba['id']||0x0;this['name']=_0xd0e0ba[_0x0f7f('0x8')]||'';this[_0x0f7f('0x9')]=_0xd0e0ba[_0x0f7f('0x9')]||'';this[_0x0f7f('0xa')]=_0xd0e0ba[_0x0f7f('0xa')]||'';this[_0x0f7f('0xb')]=_0xd0e0ba[_0x0f7f('0xb')]||'';this[_0x0f7f('0xc')]=_0x0f7f('0xd');this[_0x0f7f('0xe')]=0x0;this[_0x0f7f('0xf')]='unknown';this[_0x0f7f('0x10')]='';this['phone']='';this[_0x0f7f('0x11')]='';this['interface']='';this[_0x0f7f('0x12')]=_0xd0e0ba['online']||![];this[_0x0f7f('0x13')]='unknown';this[_0x0f7f('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x0f7f('0x15')]='';this[_0x0f7f('0x16')]=![];this[_0x0f7f('0x17')]=![];this[_0x0f7f('0x2')]='';}Agent[_0x0f7f('0x18')]['updateStatusRealtime']=function(_0x55be1a){var _0x18d81b;if(_0x55be1a&&_0x55be1a[_0x0f7f('0xc')]){_0x18d81b=_0x55be1a[_0x0f7f('0xc')][_0x0f7f('0x19')]();switch(_0x18d81b){case _0x0f7f('0x1a'):_0x18d81b=_0x0f7f('0x1b');break;case'inuse':_0x18d81b=_0x0f7f('0x1c');break;}}if(_0x18d81b&&this[_0x0f7f('0x13')]!==_0x18d81b||_0x55be1a[_0x0f7f('0x1d')]){this[_0x0f7f('0x14')]=_[_0x0f7f('0x1e')](moment()[_0x0f7f('0x1f')]('x'));}if(_0x18d81b){this[_0x0f7f('0x13')]=_0x18d81b;}var _0x72e07={'id':this['id'],'name':this[_0x0f7f('0x8')],'email':this[_0x0f7f('0x9')],'accountcode':this[_0x0f7f('0xa')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x0f7f('0xe')],'status':this[_0x0f7f('0xf')],'address':this['address'],'online':this[_0x0f7f('0x12')],'voiceStatus':this[_0x0f7f('0x13')],'voiceStatusTime':this[_0x0f7f('0x14')],'voiceStatusCallerIdNumber':this[_0x0f7f('0x20')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x0f7f('0x21')],'onhold':this[_0x0f7f('0x16')]};var _0x42af3b=md5(JSON[_0x0f7f('0x22')](_0x72e07));if(this[_0x0f7f('0x2')]!==_0x42af3b){this[_0x0f7f('0x2')]=_0x42af3b;io['to'](util['format'](_0x0f7f('0x23'),_0x72e07[_0x0f7f('0x8')]))[_0x0f7f('0x24')](_0x0f7f('0x25'),_0x72e07);}};module[_0x0f7f('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 79a8bd0..26e8fe5 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 _0xb731=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x449a3d,_0x122735){var _0x41ec24=function(_0x12de68){while(--_0x12de68){_0x449a3d['push'](_0x449a3d['shift']());}};_0x41ec24(++_0x122735);}(_0xb731,0x15e));var _0x1b73=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb731[_0x5c9307];return _0x373e29;};'use strict';function Campaign(_0x5a239b){this['id']=_0x5a239b['id']||0x0;this[_0x1b73('0x0')]=_0x5a239b[_0x1b73('0x0')]||'';this[_0x1b73('0x1')]=_0x5a239b[_0x1b73('0x1')]||'campaign';this['originated']=0x0;this[_0x1b73('0x2')]=0x0;this[_0x1b73('0x3')]=0x0;this[_0x1b73('0x4')]=0x0;this[_0x1b73('0x5')]='';this[_0x1b73('0x6')]=!![];this[_0x1b73('0x7')]=_0x5a239b[_0x1b73('0x7')];this[_0x1b73('0x8')]=_0x5a239b[_0x1b73('0x8')];this[_0x1b73('0x9')]=_0x5a239b[_0x1b73('0x9')]||null;this[_0x1b73('0xa')]=_0x5a239b[_0x1b73('0xa')]?_0x5a239b[_0x1b73('0xa')]:null;this['dialOriginateCallerIdName']=_0x5a239b[_0x1b73('0xb')];this[_0x1b73('0xc')]=_0x5a239b[_0x1b73('0xc')];this['dialOriginateTimeout']=_0x5a239b[_0x1b73('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x5a239b[_0x1b73('0xe')];this[_0x1b73('0xf')]=_0x5a239b[_0x1b73('0xf')];this[_0x1b73('0x10')]=_0x5a239b[_0x1b73('0x10')];this[_0x1b73('0x11')]=_0x5a239b[_0x1b73('0x11')];this['dialNoAnswerMaxRetry']=_0x5a239b['dialNoAnswerMaxRetry'];this[_0x1b73('0x12')]=_0x5a239b['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x5a239b[_0x1b73('0x13')];this['dialNoSuchNumberMaxRetry']=_0x5a239b[_0x1b73('0x14')]||0x3;this[_0x1b73('0x15')]=_0x5a239b[_0x1b73('0x15')]||0x96;this[_0x1b73('0x16')]=_0x5a239b[_0x1b73('0x16')]||0x3;this[_0x1b73('0x17')]=_0x5a239b[_0x1b73('0x17')]||0x96;this[_0x1b73('0x18')]=_0x5a239b[_0x1b73('0x18')]||0x3;this[_0x1b73('0x19')]=_0x5a239b[_0x1b73('0x19')]||0x96;this[_0x1b73('0x1a')]=_0x5a239b[_0x1b73('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x5a239b[_0x1b73('0x1b')]||0x96;this[_0x1b73('0x1c')]=_0x5a239b['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x5a239b[_0x1b73('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x5a239b['dialOrderByScheduledAt']||'DESC';this['dialPrefix']=_0x5a239b['dialPrefix']||undefined;this[_0x1b73('0x1e')]=_0x5a239b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1b73('0x1f')]=_0x5a239b[_0x1b73('0x1f')]||undefined;this['TrunkBackup']=_0x5a239b[_0x1b73('0x20')]?_0x5a239b[_0x1b73('0x20')]:undefined;this[_0x1b73('0x21')]=_0x5a239b[_0x1b73('0x21')]?_0x5a239b[_0x1b73('0x21')]:undefined;this[_0x1b73('0x22')]=_0x5a239b[_0x1b73('0x22')]?_0x5a239b[_0x1b73('0x22')]:undefined;this[_0x1b73('0x23')]=_0x5a239b[_0x1b73('0x23')]?_0x5a239b[_0x1b73('0x23')]:undefined;this[_0x1b73('0x24')]=_0x5a239b['SquareProject']?_0x5a239b['SquareProject'][_0x1b73('0x0')]:undefined;this['dialAMDActive']=_0x5a239b[_0x1b73('0x25')]||![];this['dialAMDInitialSilence']=_0x5a239b[_0x1b73('0x26')];this[_0x1b73('0x27')]=_0x5a239b[_0x1b73('0x27')];this[_0x1b73('0x28')]=_0x5a239b[_0x1b73('0x28')];this['dialAMDTotalAnalysisTime']=_0x5a239b['dialAMDTotalAnalysisTime'];this[_0x1b73('0x29')]=_0x5a239b[_0x1b73('0x29')];this[_0x1b73('0x2a')]=_0x5a239b[_0x1b73('0x2a')];this[_0x1b73('0x2b')]=_0x5a239b['dialAMDMaximumNumberOfWords'];this[_0x1b73('0x2c')]=_0x5a239b[_0x1b73('0x2c')];this[_0x1b73('0x2d')]=_0x5a239b[_0x1b73('0x2d')];}module[_0x1b73('0x2e')]=Campaign; \ No newline at end of file +var _0x9b38=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x9b38,0x72));var _0x89b3=function(_0x45a12e,_0x198eb9){_0x45a12e=_0x45a12e-0x0;var _0x22cacc=_0x9b38[_0x45a12e];return _0x22cacc;};'use strict';function Campaign(_0x5276a7){this['id']=_0x5276a7['id']||0x0;this[_0x89b3('0x0')]=_0x5276a7[_0x89b3('0x0')]||'';this[_0x89b3('0x1')]=_0x5276a7[_0x89b3('0x1')]||_0x89b3('0x2');this[_0x89b3('0x3')]=0x0;this[_0x89b3('0x4')]=0x0;this[_0x89b3('0x5')]=0x0;this[_0x89b3('0x6')]=0x0;this[_0x89b3('0x7')]='';this[_0x89b3('0x8')]=!![];this[_0x89b3('0x9')]=_0x5276a7['active'];this[_0x89b3('0xa')]=_0x5276a7[_0x89b3('0xa')];this[_0x89b3('0xb')]=_0x5276a7[_0x89b3('0xb')]||null;this[_0x89b3('0xc')]=_0x5276a7[_0x89b3('0xc')]?_0x5276a7['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x5276a7['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x5276a7[_0x89b3('0xd')];this[_0x89b3('0xe')]=_0x5276a7[_0x89b3('0xe')]||0x1e;this[_0x89b3('0xf')]=_0x5276a7[_0x89b3('0xf')];this[_0x89b3('0x10')]=_0x5276a7[_0x89b3('0x10')];this['dialBusyMaxRetry']=_0x5276a7[_0x89b3('0x11')];this[_0x89b3('0x12')]=_0x5276a7[_0x89b3('0x12')];this['dialNoAnswerMaxRetry']=_0x5276a7['dialNoAnswerMaxRetry'];this[_0x89b3('0x13')]=_0x5276a7[_0x89b3('0x13')];this['dialGlobalMaxRetry']=_0x5276a7['dialGlobalMaxRetry'];this[_0x89b3('0x14')]=_0x5276a7[_0x89b3('0x14')]||0x3;this[_0x89b3('0x15')]=_0x5276a7[_0x89b3('0x15')]||0x96;this[_0x89b3('0x16')]=_0x5276a7[_0x89b3('0x16')]||0x3;this['dialDropRetryFrequency']=_0x5276a7[_0x89b3('0x17')]||0x96;this[_0x89b3('0x18')]=_0x5276a7[_0x89b3('0x18')]||0x3;this[_0x89b3('0x19')]=_0x5276a7[_0x89b3('0x19')]||0x96;this['dialMachineMaxRetry']=_0x5276a7['dialMachineMaxRetry']||0x3;this[_0x89b3('0x1a')]=_0x5276a7['dialMachineRetryFrequency']||0x96;this[_0x89b3('0x1b')]=_0x5276a7[_0x89b3('0x1b')]||0x3;this[_0x89b3('0x1c')]=_0x5276a7[_0x89b3('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x5276a7[_0x89b3('0x1d')]||_0x89b3('0x1e');this['dialPrefix']=_0x5276a7[_0x89b3('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5276a7['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x89b3('0x20')]=_0x5276a7[_0x89b3('0x20')]||undefined;this[_0x89b3('0x21')]=_0x5276a7[_0x89b3('0x21')]?_0x5276a7[_0x89b3('0x21')]:undefined;this[_0x89b3('0x22')]=_0x5276a7[_0x89b3('0x22')]?_0x5276a7[_0x89b3('0x22')]:undefined;this[_0x89b3('0x23')]=_0x5276a7[_0x89b3('0x23')]?_0x5276a7[_0x89b3('0x23')]:undefined;this[_0x89b3('0x24')]=_0x5276a7[_0x89b3('0x24')]?_0x5276a7[_0x89b3('0x24')]:undefined;this['dialQueueProject']=_0x5276a7[_0x89b3('0x24')]?_0x5276a7[_0x89b3('0x24')][_0x89b3('0x0')]:undefined;this['dialAMDActive']=_0x5276a7['dialAMDActive']||![];this[_0x89b3('0x25')]=_0x5276a7[_0x89b3('0x25')];this[_0x89b3('0x26')]=_0x5276a7[_0x89b3('0x26')];this[_0x89b3('0x27')]=_0x5276a7['dialAMDAfterGreetingSilence'];this[_0x89b3('0x28')]=_0x5276a7['dialAMDTotalAnalysisTime'];this[_0x89b3('0x29')]=_0x5276a7['dialAMDMinWordLength'];this[_0x89b3('0x2a')]=_0x5276a7[_0x89b3('0x2a')];this[_0x89b3('0x2b')]=_0x5276a7[_0x89b3('0x2b')];this[_0x89b3('0x2c')]=_0x5276a7[_0x89b3('0x2c')];this[_0x89b3('0x2d')]=_0x5276a7[_0x89b3('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 d71f3ed..c535272 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 _0x9d01=['destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','channel'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x9d01,0x1ec));var _0x19d0=function(_0x155e04,_0x28cd61){_0x155e04=_0x155e04-0x0;var _0x4590d0=_0x9d01[_0x155e04];return _0x4590d0;};'use strict';function Channel(){this[_0x19d0('0x0')]=null;this[_0x19d0('0x1')]='';this[_0x19d0('0x2')]='';this[_0x19d0('0x3')]=0x0;this[_0x19d0('0x4')]='';this[_0x19d0('0x5')]=undefined;this[_0x19d0('0x6')]=undefined;this[_0x19d0('0x7')]=0x0;this['context']='';this[_0x19d0('0x8')]=0x0;this['linkedid']=0x0;this[_0x19d0('0x9')]=0x0;this[_0x19d0('0xa')]=![];this[_0x19d0('0xb')]=null;this['endtime']=null;this[_0x19d0('0xc')]=![];this[_0x19d0('0xd')]=![];this[_0x19d0('0xe')]='';this[_0x19d0('0xf')]='';this[_0x19d0('0x10')]=0x0;this[_0x19d0('0x11')]=0x0;this[_0x19d0('0x12')]=0x0;this[_0x19d0('0x13')]=null;this[_0x19d0('0x14')]=null;this[_0x19d0('0x15')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x19d0('0x16')]=null;this[_0x19d0('0x17')]=[];this[_0x19d0('0x18')]=undefined;this[_0x19d0('0x19')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x676c=['starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','lastapplication','billableseconds','holdtime','disposition','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','mohtime','exports'];(function(_0x278455,_0x1bdb5e){var _0x445ecc=function(_0x2b8676){while(--_0x2b8676){_0x278455['push'](_0x278455['shift']());}};_0x445ecc(++_0x1bdb5e);}(_0x676c,0x198));var _0xc676=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x676c[_0x321bb2];return _0x9c12ed;};'use strict';function Channel(){this[_0xc676('0x0')]=null;this[_0xc676('0x1')]='';this[_0xc676('0x2')]='';this['calleridnum']=0x0;this[_0xc676('0x3')]='';this[_0xc676('0x4')]=undefined;this[_0xc676('0x5')]=undefined;this[_0xc676('0x6')]=0x0;this[_0xc676('0x7')]='';this[_0xc676('0x8')]=0x0;this['linkedid']=0x0;this[_0xc676('0x9')]=0x0;this[_0xc676('0xa')]=![];this[_0xc676('0xb')]=null;this[_0xc676('0xc')]=null;this[_0xc676('0xd')]=![];this['abandoned']=![];this[_0xc676('0xe')]='';this['lastdata']='';this['duration']=0x0;this[_0xc676('0xf')]=0x0;this[_0xc676('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0xc676('0x11')]=null;this[_0xc676('0x12')]=![];this[_0xc676('0x13')]=null;this['queue']=null;this['monitors']=[];this[_0xc676('0x14')]=undefined;this[_0xc676('0x15')]=undefined;this[_0xc676('0x16')]=0x0;}module[_0xc676('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 23fe2b1..7293595 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 _0xc01b=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret','token'];(function(_0x3ec209,_0x36dea6){var _0x248999=function(_0x2c3998){while(--_0x2c3998){_0x3ec209['push'](_0x3ec209['shift']());}};_0x248999(++_0x36dea6);}(_0xc01b,0x65));var _0xbc01=function(_0x4f0464,_0x2b747f){_0x4f0464=_0x4f0464-0x0;var _0x5d072d=_0xc01b[_0x4f0464];return _0x5d072d;};'use strict';function DeskAccount(_0x1a44cb){this['id']=_0x1a44cb['id']||0x0;this[_0xbc01('0x0')]=_0x1a44cb[_0xbc01('0x0')]||'';this[_0xbc01('0x1')]=_0x1a44cb['username']||'';this[_0xbc01('0x2')]=_0x1a44cb[_0xbc01('0x2')]||'';this['authType']=_0x1a44cb['authType']||'';this['password']=_0x1a44cb[_0xbc01('0x3')]||'';this[_0xbc01('0x4')]=_0x1a44cb['consumerKey']||'';this['consumerSecret']=_0x1a44cb[_0xbc01('0x5')]||'';this[_0xbc01('0x6')]=_0x1a44cb[_0xbc01('0x6')]||'';this[_0xbc01('0x7')]=_0x1a44cb[_0xbc01('0x7')]||'';this[_0xbc01('0x8')]=_0x1a44cb[_0xbc01('0x8')]||'';this['serverUrl']=_0x1a44cb[_0xbc01('0x9')]||'';this[_0xbc01('0xa')]=_0x1a44cb[_0xbc01('0xa')]||{};}module[_0xbc01('0xb')]=DeskAccount; \ No newline at end of file +var _0xf611=['type','serverUrl','Configurations','name','username','authType','password','consumerSecret','token','tokenSecret'];(function(_0x4f80c7,_0x3b5459){var _0x445f50=function(_0x5f390b){while(--_0x5f390b){_0x4f80c7['push'](_0x4f80c7['shift']());}};_0x445f50(++_0x3b5459);}(_0xf611,0x7b));var _0x1f61=function(_0x3815b2,_0xdeaa84){_0x3815b2=_0x3815b2-0x0;var _0x2ebd79=_0xf611[_0x3815b2];return _0x2ebd79;};'use strict';function DeskAccount(_0x400b57){this['id']=_0x400b57['id']||0x0;this[_0x1f61('0x0')]=_0x400b57[_0x1f61('0x0')]||'';this[_0x1f61('0x1')]=_0x400b57['username']||'';this['remoteUri']=_0x400b57['remoteUri']||'';this[_0x1f61('0x2')]=_0x400b57['authType']||'';this[_0x1f61('0x3')]=_0x400b57[_0x1f61('0x3')]||'';this['consumerKey']=_0x400b57['consumerKey']||'';this[_0x1f61('0x4')]=_0x400b57[_0x1f61('0x4')]||'';this[_0x1f61('0x5')]=_0x400b57[_0x1f61('0x5')]||'';this['tokenSecret']=_0x400b57[_0x1f61('0x6')]||'';this[_0x1f61('0x7')]=_0x400b57[_0x1f61('0x7')]||'';this['serverUrl']=_0x400b57[_0x1f61('0x8')]||'';this[_0x1f61('0x9')]=_0x400b57['Configurations']||{};}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 d78a7ce..bea6227 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 _0xc86a=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x23485b,_0x49ee2a){var _0x4fa124=function(_0x85c3f1){while(--_0x85c3f1){_0x23485b['push'](_0x23485b['shift']());}};_0x4fa124(++_0x49ee2a);}(_0xc86a,0x128));var _0xac86=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xc86a[_0x1e3671];return _0x48d5f5;};'use strict';function Dynamics365Account(_0x4aad09){this['id']=_0x4aad09['id']||0x0;this[_0xac86('0x0')]=_0x4aad09['name']||'';this[_0xac86('0x1')]=_0x4aad09['username']||'';this[_0xac86('0x2')]=_0x4aad09[_0xac86('0x2')]||'';this['remoteUri']=_0x4aad09[_0xac86('0x3')]||'';this['tenantId']=_0x4aad09[_0xac86('0x4')]||'';this[_0xac86('0x5')]=_0x4aad09[_0xac86('0x5')]||'';this[_0xac86('0x6')]=_0x4aad09[_0xac86('0x6')]||{};this[_0xac86('0x7')]=_0x4aad09[_0xac86('0x7')]||'';this['Configurations']=_0x4aad09[_0xac86('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xcb18=['exports','name','username','password','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x41940a,_0x5ea0cd){var _0x20fc79=function(_0x556490){while(--_0x556490){_0x41940a['push'](_0x41940a['shift']());}};_0x20fc79(++_0x5ea0cd);}(_0xcb18,0x1a8));var _0x8cb1=function(_0x1b8f43,_0x399691){_0x1b8f43=_0x1b8f43-0x0;var _0x4231ba=_0xcb18[_0x1b8f43];return _0x4231ba;};'use strict';function Dynamics365Account(_0x591353){this['id']=_0x591353['id']||0x0;this[_0x8cb1('0x0')]=_0x591353[_0x8cb1('0x0')]||'';this[_0x8cb1('0x1')]=_0x591353[_0x8cb1('0x1')]||'';this[_0x8cb1('0x2')]=_0x591353[_0x8cb1('0x2')]||'';this['remoteUri']=_0x591353['remoteUri']||'';this[_0x8cb1('0x3')]=_0x591353[_0x8cb1('0x3')]||'';this['clientId']=_0x591353[_0x8cb1('0x4')]||'';this[_0x8cb1('0x5')]=_0x591353[_0x8cb1('0x5')]||{};this[_0x8cb1('0x6')]=_0x591353[_0x8cb1('0x6')]||'';this[_0x8cb1('0x7')]=_0x591353[_0x8cb1('0x7')]||{};}module[_0x8cb1('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 b8e09bb..15d26c9 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 _0xaeff=['name','description','headerinfo','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports'];(function(_0x52a9a6,_0x24737c){var _0x14b05a=function(_0x7c26eb){while(--_0x7c26eb){_0x52a9a6['push'](_0x52a9a6['shift']());}};_0x14b05a(++_0x24737c);}(_0xaeff,0x179));var _0xfaef=function(_0x2fb34a,_0x4938e8){_0x2fb34a=_0x2fb34a-0x0;var _0x2f022b=_0xaeff[_0x2fb34a];return _0x2f022b;};'use strict';function FaxAccount(_0x1dfd25){this['id']=_0x1dfd25['id']||0x0;this[_0xfaef('0x0')]=_0x1dfd25[_0xfaef('0x0')]||'';this[_0xfaef('0x1')]=_0x1dfd25[_0xfaef('0x1')];this['ecm']=_0x1dfd25['ecm'];this['headerinfo']=_0x1dfd25[_0xfaef('0x2')];this['localstationid']=_0x1dfd25['localstationid'];this['minrate']=_0x1dfd25['minrate']||0x960;this[_0xfaef('0x3')]=_0x1dfd25['maxrate']||0x3840;this[_0xfaef('0x4')]=_0x1dfd25['modem']||'v17,v27,v29';this[_0xfaef('0x5')]=_0x1dfd25[_0xfaef('0x5')]||'no';this[_0xfaef('0x6')]=_0x1dfd25[_0xfaef('0x6')]||'no';this['t38timeout']=_0x1dfd25[_0xfaef('0x7')]||0x1388;this[_0xfaef('0x8')]=_0x1dfd25[_0xfaef('0x8')]||'SIP';this[_0xfaef('0x9')]=_0x1dfd25[_0xfaef('0x9')]?_0x1dfd25[_0xfaef('0x9')]:undefined;this[_0xfaef('0xa')]=_0x1dfd25['ListId'];this[_0xfaef('0xb')]=_0x1dfd25[_0xfaef('0xb')];}module[_0xfaef('0xc')]=FaxAccount; \ No newline at end of file +var _0x6931=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6931,0x1a9));var _0x1693=function(_0x58ed88,_0x583f3b){_0x58ed88=_0x58ed88-0x0;var _0x3c9f7b=_0x6931[_0x58ed88];return _0x3c9f7b;};'use strict';function FaxAccount(_0x4f91fe){this['id']=_0x4f91fe['id']||0x0;this[_0x1693('0x0')]=_0x4f91fe[_0x1693('0x0')]||'';this[_0x1693('0x1')]=_0x4f91fe[_0x1693('0x1')];this[_0x1693('0x2')]=_0x4f91fe[_0x1693('0x2')];this[_0x1693('0x3')]=_0x4f91fe['headerinfo'];this[_0x1693('0x4')]=_0x4f91fe[_0x1693('0x4')];this[_0x1693('0x5')]=_0x4f91fe[_0x1693('0x5')]||0x960;this[_0x1693('0x6')]=_0x4f91fe['maxrate']||0x3840;this[_0x1693('0x7')]=_0x4f91fe[_0x1693('0x7')]||_0x1693('0x8');this['gateway']=_0x4f91fe[_0x1693('0x9')]||'no';this[_0x1693('0xa')]=_0x4f91fe[_0x1693('0xa')]||'no';this[_0x1693('0xb')]=_0x4f91fe[_0x1693('0xb')]||0x1388;this[_0x1693('0xc')]=_0x4f91fe[_0x1693('0xc')]||_0x1693('0xd');this[_0x1693('0xe')]=_0x4f91fe[_0x1693('0xe')]?_0x4f91fe[_0x1693('0xe')]:undefined;this['ListId']=_0x4f91fe[_0x1693('0xf')];this[_0x1693('0x10')]=_0x4f91fe[_0x1693('0x10')];}module[_0x1693('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 15f584e..a61b4aa 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 _0xd46f=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x328a2a,_0x16e1b7){var _0x36bd51=function(_0x249917){while(--_0x249917){_0x328a2a['push'](_0x328a2a['shift']());}};_0x36bd51(++_0x16e1b7);}(_0xd46f,0xe3));var _0xfd46=function(_0x4dd759,_0x1ee8c0){_0x4dd759=_0x4dd759-0x0;var _0x53177e=_0xd46f[_0x4dd759];return _0x53177e;};'use strict';function FreshdeskAccount(_0xc61ca9){this['id']=_0xc61ca9['id']||0x0;this[_0xfd46('0x0')]=_0xc61ca9['name']||'';this[_0xfd46('0x1')]=_0xc61ca9['username']||'';this[_0xfd46('0x2')]=_0xc61ca9[_0xfd46('0x3')]||'';this[_0xfd46('0x4')]=_0xc61ca9[_0xfd46('0x4')]||'';this[_0xfd46('0x5')]=_0xc61ca9[_0xfd46('0x5')]||'';this[_0xfd46('0x6')]=_0xc61ca9[_0xfd46('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x9bf6=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0x9bf6,0x1af));var _0x69bf=function(_0x3d84fa,_0x14283c){_0x3d84fa=_0x3d84fa-0x0;var _0x1e13a4=_0x9bf6[_0x3d84fa];return _0x1e13a4;};'use strict';function FreshdeskAccount(_0x5318cd){this['id']=_0x5318cd['id']||0x0;this[_0x69bf('0x0')]=_0x5318cd[_0x69bf('0x0')]||'';this['username']=_0x5318cd[_0x69bf('0x1')]||'';this[_0x69bf('0x2')]=_0x5318cd[_0x69bf('0x3')]||'';this[_0x69bf('0x4')]=_0x5318cd[_0x69bf('0x4')]||'';this['serverUrl']=_0x5318cd[_0x69bf('0x5')]||'';this[_0x69bf('0x6')]=_0x5318cd['Configurations']||{};}module[_0x69bf('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 98be750..4d03bc7 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 _0x4477=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x263a71,_0x3a917a){var _0x2d5a72=function(_0x709c6){while(--_0x709c6){_0x263a71['push'](_0x263a71['shift']());}};_0x2d5a72(++_0x3a917a);}(_0x4477,0xb1));var _0x7447=function(_0x30aa58,_0xf0491){_0x30aa58=_0x30aa58-0x0;var _0x31a094=_0x4477[_0x30aa58];return _0x31a094;};'use strict';function FreshsalesAccount(_0x43960a){this['id']=_0x43960a['id']||0x0;this[_0x7447('0x0')]=_0x43960a[_0x7447('0x0')]||'';this[_0x7447('0x1')]=_0x43960a[_0x7447('0x1')]||'';this[_0x7447('0x2')]=_0x43960a[_0x7447('0x3')]||'';this[_0x7447('0x4')]=_0x43960a[_0x7447('0x4')]||'';this['serverUrl']=_0x43960a[_0x7447('0x5')]||'';this[_0x7447('0x6')]=_0x43960a[_0x7447('0x6')]||{};}module[_0x7447('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x6d84=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x6d84,0x19d));var _0x46d8=function(_0x59cbf9,_0x583558){_0x59cbf9=_0x59cbf9-0x0;var _0x58414e=_0x6d84[_0x59cbf9];return _0x58414e;};'use strict';function FreshsalesAccount(_0x22132f){this['id']=_0x22132f['id']||0x0;this[_0x46d8('0x0')]=_0x22132f['name']||'';this[_0x46d8('0x1')]=_0x22132f[_0x46d8('0x1')]||'';this[_0x46d8('0x2')]=_0x22132f['token']||'';this[_0x46d8('0x3')]=_0x22132f[_0x46d8('0x3')]||'';this[_0x46d8('0x4')]=_0x22132f[_0x46d8('0x4')]||'';this[_0x46d8('0x5')]=_0x22132f['Configurations']||{};}module[_0x46d8('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 91288a2..ec91adf 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 _0x0f98=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','lastAssignedTo','variables','exports','type','inbound','calleridnum','calleridname','queue'];(function(_0xf8f775,_0x3a58aa){var _0xff22ad=function(_0x224464){while(--_0x224464){_0xf8f775['push'](_0xf8f775['shift']());}};_0xff22ad(++_0x3a58aa);}(_0x0f98,0xc3));var _0x80f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f98[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0x80f9('0x0')]=_0x80f9('0x1');this['uniqueid']='';this[_0x80f9('0x2')]='';this[_0x80f9('0x3')]='';this[_0x80f9('0x4')]='';this['queuecallerjoinAt']=null;this[_0x80f9('0x5')]=null;this[_0x80f9('0x6')]=0x1;this[_0x80f9('0x7')]=0x1;this[_0x80f9('0x8')]=![];this[_0x80f9('0x9')]=null;this[_0x80f9('0xa')]=![];this[_0x80f9('0xb')]=null;this[_0x80f9('0xc')]=![];this[_0x80f9('0xd')]=null;this[_0x80f9('0xe')]=0x1;this[_0x80f9('0xf')]='';this[_0x80f9('0x10')]='';this[_0x80f9('0x11')]='';this[_0x80f9('0x12')]='';this[_0x80f9('0x13')]='';this[_0x80f9('0x14')]='';this['priority']='';this[_0x80f9('0x15')]=0x0;this['assigned']=![];this[_0x80f9('0x16')]='';this['mohtime']=0x0;this[_0x80f9('0x17')]={};}module[_0x80f9('0x18')]=QueueReport; \ No newline at end of file +var _0xd4bb=['originalposition','channel','connectedlinenum','connectedlinename','accountcode','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd4bb,0x144));var _0xbd4b=function(_0x16f582,_0x4dfba1){_0x16f582=_0x16f582-0x0;var _0x7cd448=_0xd4bb[_0x16f582];return _0x7cd448;};'use strict';function QueueReport(){this[_0xbd4b('0x0')]=_0xbd4b('0x1');this[_0xbd4b('0x2')]='';this[_0xbd4b('0x3')]='';this['calleridname']='';this[_0xbd4b('0x4')]='';this[_0xbd4b('0x5')]=null;this[_0xbd4b('0x6')]=null;this[_0xbd4b('0x7')]=0x1;this[_0xbd4b('0x8')]=0x1;this['queuecallerabandon']=![];this[_0xbd4b('0x9')]=null;this[_0xbd4b('0xa')]=![];this[_0xbd4b('0xb')]=null;this[_0xbd4b('0xc')]=![];this[_0xbd4b('0xd')]=null;this[_0xbd4b('0xe')]=0x1;this[_0xbd4b('0xf')]='';this[_0xbd4b('0x10')]='';this[_0xbd4b('0x11')]='';this[_0xbd4b('0x12')]='';this['context']='';this['exten']='';this[_0xbd4b('0x13')]='';this[_0xbd4b('0x14')]=0x0;this[_0xbd4b('0x15')]=![];this[_0xbd4b('0x16')]='';this[_0xbd4b('0x17')]=0x0;this[_0xbd4b('0x18')]={};}module[_0xbd4b('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1ab7f49..122b9d3 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 _0x37a5=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','username','remoteUri','password','clientId'];(function(_0x534ee1,_0x3cc0a6){var _0x43abcb=function(_0x18b5eb){while(--_0x18b5eb){_0x534ee1['push'](_0x534ee1['shift']());}};_0x43abcb(++_0x3cc0a6);}(_0x37a5,0x167));var _0x537a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x37a5[_0x68c979];return _0x4f0001;};'use strict';function SalesforceAccount(_0x55284a){this['id']=_0x55284a['id']||0x0;this['name']=_0x55284a['name']||'';this[_0x537a('0x0')]=_0x55284a['username']||'';this[_0x537a('0x1')]=_0x55284a[_0x537a('0x1')]||'';this[_0x537a('0x2')]=_0x55284a[_0x537a('0x2')]||'';this['clientId']=_0x55284a[_0x537a('0x3')]||'';this[_0x537a('0x4')]=_0x55284a[_0x537a('0x4')]||'';this['securityToken']=_0x55284a[_0x537a('0x5')]||'';this[_0x537a('0x6')]=_0x55284a[_0x537a('0x6')]||_0x537a('0x7');this[_0x537a('0x8')]=_0x55284a['serverUrl']||'';this[_0x537a('0x9')]=_0x55284a['Configurations']||{};}module[_0x537a('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x2d51=['password','clientId','clientSecret','securityToken','type','serverUrl','exports','name','username','remoteUri'];(function(_0x1f7e17,_0x47c3f1){var _0x4bea60=function(_0x140dbc){while(--_0x140dbc){_0x1f7e17['push'](_0x1f7e17['shift']());}};_0x4bea60(++_0x47c3f1);}(_0x2d51,0x101));var _0x12d5=function(_0x2c9f4b,_0x10a676){_0x2c9f4b=_0x2c9f4b-0x0;var _0x81ffc=_0x2d51[_0x2c9f4b];return _0x81ffc;};'use strict';function SalesforceAccount(_0x3377e8){this['id']=_0x3377e8['id']||0x0;this[_0x12d5('0x0')]=_0x3377e8[_0x12d5('0x0')]||'';this[_0x12d5('0x1')]=_0x3377e8[_0x12d5('0x1')]||'';this[_0x12d5('0x2')]=_0x3377e8[_0x12d5('0x2')]||'';this[_0x12d5('0x3')]=_0x3377e8['password']||'';this[_0x12d5('0x4')]=_0x3377e8[_0x12d5('0x4')]||'';this[_0x12d5('0x5')]=_0x3377e8[_0x12d5('0x5')]||'';this[_0x12d5('0x6')]=_0x3377e8[_0x12d5('0x6')]||'';this[_0x12d5('0x7')]=_0x3377e8[_0x12d5('0x7')]||'integrationTab';this[_0x12d5('0x8')]=_0x3377e8[_0x12d5('0x8')]||'';this['Configurations']=_0x3377e8['Configurations']||{};}module[_0x12d5('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 29a41a2..c0d27fe 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 _0xc888=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0xc888,0x9d));var _0x8c88=function(_0x11f418,_0x16283a){_0x11f418=_0x11f418-0x0;var _0x5d7f70=_0xc888[_0x11f418];return _0x5d7f70;};'use strict';function ServicenowAccount(_0x44e1ef){this['id']=_0x44e1ef['id']||0x0;this[_0x8c88('0x0')]=_0x44e1ef['name']||'';this[_0x8c88('0x1')]=_0x44e1ef[_0x8c88('0x1')]||'';this['password']=_0x44e1ef[_0x8c88('0x2')]||'';this['remoteUri']=_0x44e1ef[_0x8c88('0x3')]||'';this[_0x8c88('0x4')]=_0x44e1ef[_0x8c88('0x4')]||'';this[_0x8c88('0x5')]=_0x44e1ef[_0x8c88('0x5')]||{};}module[_0x8c88('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb4b7=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xb4b7,0x119));var _0x7b4b=function(_0x1916ad,_0x365b30){_0x1916ad=_0x1916ad-0x0;var _0xb112ea=_0xb4b7[_0x1916ad];return _0xb112ea;};'use strict';function ServicenowAccount(_0xdc7ca0){this['id']=_0xdc7ca0['id']||0x0;this[_0x7b4b('0x0')]=_0xdc7ca0['name']||'';this[_0x7b4b('0x1')]=_0xdc7ca0[_0x7b4b('0x1')]||'';this[_0x7b4b('0x2')]=_0xdc7ca0[_0x7b4b('0x2')]||'';this[_0x7b4b('0x3')]=_0xdc7ca0[_0x7b4b('0x3')]||'';this[_0x7b4b('0x4')]=_0xdc7ca0[_0x7b4b('0x4')]||'';this[_0x7b4b('0x5')]=_0xdc7ca0[_0x7b4b('0x5')]||{};}module[_0x7b4b('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 9451510..7f4e095 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 _0x8bfa=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x54bf73,_0x5ed440){var _0x579aea=function(_0x18e0ee){while(--_0x18e0ee){_0x54bf73['push'](_0x54bf73['shift']());}};_0x579aea(++_0x5ed440);}(_0x8bfa,0x14e));var _0xa8bf=function(_0x1c9721,_0x3f83a4){_0x1c9721=_0x1c9721-0x0;var _0x5b1a4c=_0x8bfa[_0x1c9721];return _0x5b1a4c;};'use strict';function SugarcrmAccount(_0x19c606){this['id']=_0x19c606['id']||0x0;this[_0xa8bf('0x0')]=_0x19c606[_0xa8bf('0x0')]||'';this[_0xa8bf('0x1')]=_0x19c606[_0xa8bf('0x1')]||'';this[_0xa8bf('0x2')]=_0x19c606[_0xa8bf('0x2')]||'';this['remoteUri']=_0x19c606[_0xa8bf('0x3')]||'';this[_0xa8bf('0x4')]=_0x19c606[_0xa8bf('0x4')]||'';this[_0xa8bf('0x5')]=_0x19c606[_0xa8bf('0x5')]||{};}module[_0xa8bf('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x4b47=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x494315,_0x2d42bd){var _0x49cc18=function(_0x419de9){while(--_0x419de9){_0x494315['push'](_0x494315['shift']());}};_0x49cc18(++_0x2d42bd);}(_0x4b47,0x1ce));var _0x74b4=function(_0x4e341a,_0x9deed3){_0x4e341a=_0x4e341a-0x0;var _0x7fcf4d=_0x4b47[_0x4e341a];return _0x7fcf4d;};'use strict';function SugarcrmAccount(_0x416576){this['id']=_0x416576['id']||0x0;this[_0x74b4('0x0')]=_0x416576[_0x74b4('0x0')]||'';this[_0x74b4('0x1')]=_0x416576['username']||'';this['password']=_0x416576['password']||'';this[_0x74b4('0x2')]=_0x416576[_0x74b4('0x2')]||'';this[_0x74b4('0x3')]=_0x416576[_0x74b4('0x3')]||'';this[_0x74b4('0x4')]=_0x416576[_0x74b4('0x4')]||{};}module[_0x74b4('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ec20377..0314c1f 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 _0x9088=['status','address','exports','name','state','unknown','stateTime'];(function(_0x9a330d,_0x528268){var _0x202e33=function(_0x3fed1b){while(--_0x3fed1b){_0x9a330d['push'](_0x9a330d['shift']());}};_0x202e33(++_0x528268);}(_0x9088,0xce));var _0x8908=function(_0xd1eb2d,_0x57f262){_0xd1eb2d=_0xd1eb2d-0x0;var _0x2901ae=_0x9088[_0xd1eb2d];return _0x2901ae;};'use strict';function Telephone(_0x4bb7d2){this['id']=_0x4bb7d2['id']||0x0;this[_0x8908('0x0')]=_0x4bb7d2[_0x8908('0x0')]||'';this['accountcode']=_0x4bb7d2['accountcode']||'';this[_0x8908('0x1')]=_0x8908('0x2');this[_0x8908('0x3')]=0x0;this[_0x8908('0x4')]=_0x8908('0x2');this[_0x8908('0x5')]='';}module[_0x8908('0x6')]=Telephone; \ No newline at end of file +var _0xe943=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x3282b0,_0x3626fc){var _0x37e5d9=function(_0xc8d94d){while(--_0xc8d94d){_0x3282b0['push'](_0x3282b0['shift']());}};_0x37e5d9(++_0x3626fc);}(_0xe943,0x68));var _0x3e94=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0xe943[_0x119b3e];return _0x1169ae;};'use strict';function Telephone(_0x16bd10){this['id']=_0x16bd10['id']||0x0;this[_0x3e94('0x0')]=_0x16bd10[_0x3e94('0x0')]||'';this['accountcode']=_0x16bd10[_0x3e94('0x1')]||'';this[_0x3e94('0x2')]=_0x3e94('0x3');this[_0x3e94('0x4')]=0x0;this[_0x3e94('0x5')]=_0x3e94('0x3');this[_0x3e94('0x6')]='';}module[_0x3e94('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 13232de..5450d15 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 _0xfef5=['exports','name','html'];(function(_0x287f12,_0xc8fa2d){var _0x30834e=function(_0x4d7d25){while(--_0x4d7d25){_0x287f12['push'](_0x287f12['shift']());}};_0x30834e(++_0xc8fa2d);}(_0xfef5,0x6d));var _0x5fef=function(_0x48563f,_0x1868f7){_0x48563f=_0x48563f-0x0;var _0x2ee6db=_0xfef5[_0x48563f];return _0x2ee6db;};'use strict';function template(_0x5b9570){this['id']=_0x5b9570['id']||0x0;this['name']=_0x5b9570[_0x5fef('0x0')]||'';this[_0x5fef('0x1')]=_0x5b9570[_0x5fef('0x1')]||'';}module[_0x5fef('0x2')]=template; \ No newline at end of file +var _0x098c=['name','html'];(function(_0x43059f,_0x4b73ee){var _0x46cd3d=function(_0x351d43){while(--_0x351d43){_0x43059f['push'](_0x43059f['shift']());}};_0x46cd3d(++_0x4b73ee);}(_0x098c,0x124));var _0xc098=function(_0x77ab15,_0x5a2f81){_0x77ab15=_0x77ab15-0x0;var _0x4a0b15=_0x098c[_0x77ab15];return _0x4a0b15;};'use strict';function template(_0x11a6e8){this['id']=_0x11a6e8['id']||0x0;this[_0xc098('0x0')]=_0x11a6e8['name']||'';this[_0xc098('0x1')]=_0x11a6e8[_0xc098('0x1')]||'';}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 c980122..912e829 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 _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x4c659c,_0x12c83e){var _0x2cc14b=function(_0x219efa){while(--_0x219efa){_0x4c659c['push'](_0x4c659c['shift']());}};_0x2cc14b(++_0x12c83e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x7b5cdd,_0x8c88d8){_0x7b5cdd=_0x7b5cdd-0x0;var _0x3a29ae=_0x4b84[_0x7b5cdd];return _0x3a29ae;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0xa993ce,_0x27e56b){var _0x1bfe42=function(_0x32c832){while(--_0x32c832){_0xa993ce['push'](_0xa993ce['shift']());}};_0x1bfe42(++_0x27e56b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1b08a6,_0x50559a){_0x1b08a6=_0x1b08a6-0x0;var _0x500aa6=_0x8ef6[_0x1b08a6];return _0x500aa6;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6945521..942eca6 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 _0x09ff=['port','domain','domainport','stateRegistry','address','exports','active','name','unknown','status','registry','indexOf','split'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x09ff,0x165));var _0xf09f=function(_0x4875c0,_0x312611){_0x4875c0=_0x4875c0-0x0;var _0x4453de=_0x09ff[_0x4875c0];return _0x4453de;};'use strict';function Trunk(_0x78aed){this['id']=_0x78aed['id']||0x0;this[_0xf09f('0x0')]=_0x78aed[_0xf09f('0x0')]||![];this[_0xf09f('0x1')]=_0x78aed[_0xf09f('0x1')]||'';this['state']=_0xf09f('0x2');this['stateTime']=0x0;this[_0xf09f('0x3')]='unknown';this[_0xf09f('0x4')]=_0x78aed['registry']&&_0x78aed[_0xf09f('0x4')][_0xf09f('0x5')](':')?_0x78aed[_0xf09f('0x4')][_0xf09f('0x6')](':')[0x0]:'';this['host']='';this[_0xf09f('0x7')]='';this[_0xf09f('0x8')]='';this[_0xf09f('0x9')]='';this['refresh']='';this[_0xf09f('0xa')]=_0xf09f('0x2');this['registrationtime']='';this[_0xf09f('0xb')]='';}module[_0xf09f('0xc')]=Trunk; \ No newline at end of file +var _0x3fc3=['state','unknown','stateTime','registry','indexOf','host','port','refresh','stateRegistry','address','exports','active','name'];(function(_0x1ef897,_0x8978cb){var _0x18679c=function(_0x4f2e7a){while(--_0x4f2e7a){_0x1ef897['push'](_0x1ef897['shift']());}};_0x18679c(++_0x8978cb);}(_0x3fc3,0x150));var _0x33fc=function(_0x5801d7,_0x1824f9){_0x5801d7=_0x5801d7-0x0;var _0x42812f=_0x3fc3[_0x5801d7];return _0x42812f;};'use strict';function Trunk(_0x316ad2){this['id']=_0x316ad2['id']||0x0;this['active']=_0x316ad2[_0x33fc('0x0')]||![];this[_0x33fc('0x1')]=_0x316ad2[_0x33fc('0x1')]||'';this[_0x33fc('0x2')]=_0x33fc('0x3');this[_0x33fc('0x4')]=0x0;this['status']=_0x33fc('0x3');this[_0x33fc('0x5')]=_0x316ad2[_0x33fc('0x5')]&&_0x316ad2[_0x33fc('0x5')][_0x33fc('0x6')](':')?_0x316ad2[_0x33fc('0x5')]['split'](':')[0x0]:'';this[_0x33fc('0x7')]='';this[_0x33fc('0x8')]='';this['domain']='';this['domainport']='';this[_0x33fc('0x9')]='';this[_0x33fc('0xa')]=_0x33fc('0x3');this['registrationtime']='';this[_0x33fc('0xb')]='';}module[_0x33fc('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2b79873..be555bb 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 _0xe155=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x94f45d,_0x13cd3d){var _0x3e7072=function(_0x5f4234){while(--_0x5f4234){_0x94f45d['push'](_0x94f45d['shift']());}};_0x3e7072(++_0x13cd3d);}(_0xe155,0x105));var _0x5e15=function(_0x456927,_0x27b202){_0x456927=_0x456927-0x0;var _0xa4b14d=_0xe155[_0x456927];return _0xa4b14d;};'use strict';function voiceExtension(_0x3f96ff){this['id']=_0x3f96ff['id']||0x0;this[_0x5e15('0x0')]=_0x3f96ff['exten']||'';this[_0x5e15('0x1')]=_0x3f96ff[_0x5e15('0x1')]||_0x5e15('0x2');this['mandatoryDisposition']=_0x3f96ff[_0x5e15('0x3')]||![];}module[_0x5e15('0x4')]=voiceExtension; \ No newline at end of file +var _0x8f6c=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x2ffe25,_0x3259eb){var _0x3740ee=function(_0x5a883d){while(--_0x5a883d){_0x2ffe25['push'](_0x2ffe25['shift']());}};_0x3740ee(++_0x3259eb);}(_0x8f6c,0x173));var _0xc8f6=function(_0x2caa3d,_0x23dbbb){_0x2caa3d=_0x2caa3d-0x0;var _0x463c9e=_0x8f6c[_0x2caa3d];return _0x463c9e;};'use strict';function voiceExtension(_0x3f0a44){this['id']=_0x3f0a44['id']||0x0;this[_0xc8f6('0x0')]=_0x3f0a44[_0xc8f6('0x0')]||'';this[_0xc8f6('0x1')]=_0x3f0a44['recordingFormat']||_0xc8f6('0x2');this[_0xc8f6('0x3')]=_0x3f0a44[_0xc8f6('0x3')]||![];}module[_0xc8f6('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 4a0b349..2cee33d 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 _0x7796=['dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive'];(function(_0x243b03,_0x1d93c1){var _0x4d7902=function(_0x5ba3){while(--_0x5ba3){_0x243b03['push'](_0x243b03['shift']());}};_0x4d7902(++_0x1d93c1);}(_0x7796,0x148));var _0x6779=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7796[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=['unknown',_0x6779('0x0'),_0x6779('0x1'),'busy',_0x6779('0x2'),_0x6779('0x3'),_0x6779('0x4'),_0x6779('0x5'),_0x6779('0x6')];var monitorFormat={'wav':'wav','wav49':_0x6779('0x7'),'gsm':_0x6779('0x8')};var strategy={'rrmemory':_0x6779('0x9'),'roundrobin':_0x6779('0xa')};function VoiceQueue(_0xdf83d7){this['id']=_0xdf83d7['id']||0x0;this[_0x6779('0xb')]=_0xdf83d7[_0x6779('0xb')]||'';this['monitor_format']=_0xdf83d7[_0x6779('0xc')]||'';this[_0x6779('0xd')]=_0xdf83d7[_0x6779('0xd')]||_0x6779('0xe');this[_0x6779('0xf')]=0x0;this[_0x6779('0x10')]=0x0;this[_0x6779('0x11')]=0x0;this[_0x6779('0x12')]=0x0;this[_0x6779('0x13')]=0x0;this[_0x6779('0x14')]=0x0;this[_0x6779('0x15')]=0x0;this['unmanaged']=0x0;this[_0x6779('0x16')]=0x0;this['loggedIn']=0x0;this[_0x6779('0x17')]=0x0;this['acw']=_0xdf83d7[_0x6779('0x18')]||![];this[_0x6779('0x19')]=_0xdf83d7[_0x6779('0x19')]||0xa;this['autopause']=_0xdf83d7['autopause']||'no';this[_0x6779('0x1a')]=!![];this[_0x6779('0x1b')]='';this[_0x6779('0x1c')]=0x0;this['temp']=0x0;this[_0x6779('0x1d')]=_0xdf83d7[_0x6779('0x1d')]||null;this[_0x6779('0x1e')]=_0xdf83d7[_0x6779('0x1e')]?_0xdf83d7['dialGlobalInterval']:null;this[_0x6779('0x1f')]=_0xdf83d7[_0x6779('0x1f')];this[_0x6779('0x20')]=_0xdf83d7['dialMethod']||_0x6779('0x21');this[_0x6779('0x22')]=_0xdf83d7[_0x6779('0x22')]||0x0;this[_0x6779('0x23')]=_0xdf83d7[_0x6779('0x23')]||0x0;this[_0x6779('0x24')]=_0xdf83d7[_0x6779('0x24')]||0x1;this['dialPredictiveOptimization']=_0xdf83d7[_0x6779('0x25')]||_0x6779('0x26');this[_0x6779('0x27')]=_0xdf83d7['dialPredictiveOptimizationPercentage']||0.03;this[_0x6779('0x28')]=_0xdf83d7[_0x6779('0x28')]||0x258;this[_0x6779('0x29')]=_0xdf83d7[_0x6779('0x29')]||'anonymous';this[_0x6779('0x2a')]=_0xdf83d7['dialOriginateCallerIdNumber']||_0x6779('0x2b');this[_0x6779('0x2c')]=_0xdf83d7[_0x6779('0x2c')]||0x1e;this[_0x6779('0x2d')]=_0xdf83d7['dialQueueOptions']||_0x6779('0x2e');this[_0x6779('0x2f')]=_0xdf83d7['dialQueueTimeout']||0x3;this[_0x6779('0x30')]=_0xdf83d7[_0x6779('0x30')]||undefined;this['dialCongestionMaxRetry']=_0xdf83d7['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0xdf83d7[_0x6779('0x31')]||0x96;this[_0x6779('0x32')]=_0xdf83d7['dialBusyMaxRetry']||0x3;this[_0x6779('0x33')]=_0xdf83d7['dialBusyRetryFrequency']||0x96;this[_0x6779('0x34')]=_0xdf83d7[_0x6779('0x34')]||0x3;this[_0x6779('0x35')]=_0xdf83d7['dialNoAnswerRetryFrequency']||0x96;this[_0x6779('0x36')]=_0xdf83d7[_0x6779('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xdf83d7[_0x6779('0x37')]||0x96;this[_0x6779('0x38')]=_0xdf83d7[_0x6779('0x38')]||0x3;this['dialDropRetryFrequency']=_0xdf83d7['dialDropRetryFrequency']||0x96;this[_0x6779('0x39')]=_0xdf83d7[_0x6779('0x39')]||0x3;this[_0x6779('0x3a')]=_0xdf83d7[_0x6779('0x3a')]||0x96;this[_0x6779('0x3b')]=_0xdf83d7[_0x6779('0x3b')]||0x3;this[_0x6779('0x3c')]=_0xdf83d7[_0x6779('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0xdf83d7[_0x6779('0x3d')]||0x3;this[_0x6779('0x3e')]=_0xdf83d7[_0x6779('0x3e')]||0x96;this[_0x6779('0x3f')]=_0xdf83d7[_0x6779('0x3f')]||0x4;this[_0x6779('0x40')]=_0xdf83d7['Trunk']?_0xdf83d7[_0x6779('0x40')]:undefined;this['TrunkBackup']=_0xdf83d7[_0x6779('0x41')]?_0xdf83d7[_0x6779('0x41')]:undefined;this[_0x6779('0x42')]=_0xdf83d7[_0x6779('0x42')]||undefined;this[_0x6779('0x43')]=_0xdf83d7['Interval']?_0xdf83d7['Interval']:undefined;this['dialOrderByScheduledAt']=_0xdf83d7[_0x6779('0x44')]||'DESC';this[_0x6779('0x45')]=_0xdf83d7[_0x6779('0x45')]||undefined;this[_0x6779('0x46')]=_0xdf83d7[_0x6779('0x46')]||undefined;this[_0x6779('0x47')]=strategy[_0xdf83d7['strategy']]||_0x6779('0x9');this[_0x6779('0x48')]=!![];this[_0x6779('0x49')]=_0xdf83d7['dialAMDActive']||![];this[_0x6779('0x4a')]=_0xdf83d7[_0x6779('0x4a')];this[_0x6779('0x4b')]=_0xdf83d7[_0x6779('0x4b')];this['dialAMDAfterGreetingSilence']=_0xdf83d7[_0x6779('0x4c')];this[_0x6779('0x4d')]=_0xdf83d7[_0x6779('0x4d')];this[_0x6779('0x4e')]=_0xdf83d7['dialAMDMinWordLength'];this[_0x6779('0x4f')]=_0xdf83d7[_0x6779('0x4f')];this[_0x6779('0x50')]=_0xdf83d7[_0x6779('0x50')];this['dialAMDSilenceThreshold']=_0xdf83d7[_0x6779('0x51')];this[_0x6779('0x52')]=_0xdf83d7[_0x6779('0x52')];this[_0x6779('0x53')]=0x0;this[_0x6779('0x54')]=0x0;this['timeout']=_0xdf83d7[_0x6779('0x55')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x6779('0x56')]=0x0;this[_0x6779('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x6779('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x6779('0x59')]=0x0;this[_0x6779('0x5a')]=0x0;this[_0x6779('0x5b')]=0x0;this[_0x6779('0x5c')]=0x0;this[_0x6779('0x5d')]=0x0;this[_0x6779('0x5e')]=0x0;this[_0x6779('0x5f')]=0x0;this[_0x6779('0x60')]=undefined;this['startPredictive']=undefined;this[_0x6779('0x61')]=undefined;this[_0x6779('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x6779('0x63')]=0x0;this[_0x6779('0x64')]=0x0;this[_0x6779('0x65')]=0x0;this[_0x6779('0x66')]=0x0;this[_0x6779('0x67')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x6779('0x68')]=0x0;this[_0x6779('0x69')]=_0xdf83d7[_0x6779('0x6a')]||0x14;this[_0x6779('0x6b')]=_0xdf83d7[_0x6779('0x6a')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x6779('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x6779('0x6d')]=0x0;this[_0x6779('0x6e')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x6779('0x6f')]=0x0;this[_0x6779('0x70')]=_0xdf83d7[_0x6779('0x70')]||0x1e;this[_0x6779('0x71')]=_0xdf83d7[_0x6779('0x71')]||![];this[_0x6779('0x72')]=_0xdf83d7[_0x6779('0x72')]||undefined;this[_0x6779('0x73')]=_0xdf83d7[_0x6779('0x73')]||![];this[_0x6779('0x74')]=_0xdf83d7[_0x6779('0x74')]||![];this['monitor_format']=monitorFormat[_0xdf83d7['monitor_format']]?monitorFormat[_0xdf83d7['monitor_format']]:undefined;this[_0x6779('0x75')]=_0xdf83d7[_0x6779('0x75')]||![];this['mandatoryDispositionPause']=_0xdf83d7[_0x6779('0x76')]?_0xdf83d7['mandatoryDispositionPause']:undefined;}module[_0x6779('0x77')]=VoiceQueue; \ No newline at end of file +var _0xcf2a=['dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','unavailable','ringing','ringinuse','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp'];(function(_0x40b17a,_0x35d58a){var _0x4440c3=function(_0xe889c5){while(--_0xe889c5){_0x40b17a['push'](_0x40b17a['shift']());}};_0x4440c3(++_0x35d58a);}(_0xcf2a,0xd2));var _0xacf2=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xcf2a[_0x20589d];return _0x422de9;};'use strict';var statusDesc=[_0xacf2('0x0'),'not_inuse',_0xacf2('0x1'),_0xacf2('0x2'),'invalid',_0xacf2('0x3'),_0xacf2('0x4'),_0xacf2('0x5'),'onhold'];var monitorFormat={'wav':_0xacf2('0x6'),'wav49':'wav49','gsm':_0xacf2('0x7')};var strategy={'rrmemory':_0xacf2('0x8'),'roundrobin':_0xacf2('0x9')};function VoiceQueue(_0x53751a){this['id']=_0x53751a['id']||0x0;this[_0xacf2('0xa')]=_0x53751a[_0xacf2('0xa')]||'';this[_0xacf2('0xb')]=_0x53751a[_0xacf2('0xb')]||'';this[_0xacf2('0xc')]=_0x53751a[_0xacf2('0xc')]||_0xacf2('0xd');this[_0xacf2('0xe')]=0x0;this['talking']=0x0;this[_0xacf2('0xf')]=0x0;this[_0xacf2('0x10')]=0x0;this[_0xacf2('0x11')]=0x0;this[_0xacf2('0x12')]=0x0;this[_0xacf2('0x13')]=0x0;this[_0xacf2('0x14')]=0x0;this[_0xacf2('0x15')]=0x0;this[_0xacf2('0x16')]=0x0;this[_0xacf2('0x17')]=0x0;this[_0xacf2('0x18')]=_0x53751a[_0xacf2('0x18')]||![];this[_0xacf2('0x19')]=_0x53751a['acwTimeout']||0xa;this[_0xacf2('0x1a')]=_0x53751a[_0xacf2('0x1a')]||'no';this[_0xacf2('0x1b')]=!![];this['message']='';this[_0xacf2('0x1c')]=0x0;this[_0xacf2('0x1d')]=0x0;this[_0xacf2('0x1e')]=_0x53751a[_0xacf2('0x1e')]||null;this[_0xacf2('0x1f')]=_0x53751a['dialGlobalInterval']?_0x53751a[_0xacf2('0x1f')]:null;this[_0xacf2('0x20')]=_0x53751a[_0xacf2('0x20')];this[_0xacf2('0x21')]=_0x53751a[_0xacf2('0x21')]||_0xacf2('0x22');this['dialLimitChannel']=_0x53751a[_0xacf2('0x23')]||0x0;this[_0xacf2('0x24')]=_0x53751a[_0xacf2('0x24')]||0x0;this['dialPowerLevel']=_0x53751a[_0xacf2('0x25')]||0x1;this['dialPredictiveOptimization']=_0x53751a[_0xacf2('0x26')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x53751a[_0xacf2('0x27')]||0.03;this['dialPredictiveInterval']=_0x53751a['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x53751a['dialOriginateCallerIdName']||_0xacf2('0x28');this[_0xacf2('0x29')]=_0x53751a[_0xacf2('0x29')]||_0xacf2('0x28');this[_0xacf2('0x2a')]=_0x53751a[_0xacf2('0x2a')]||0x1e;this[_0xacf2('0x2b')]=_0x53751a[_0xacf2('0x2b')]||_0xacf2('0x2c');this['dialQueueTimeout']=_0x53751a[_0xacf2('0x2d')]||0x3;this[_0xacf2('0x2e')]=_0x53751a[_0xacf2('0x2e')]||undefined;this[_0xacf2('0x2f')]=_0x53751a[_0xacf2('0x2f')]||0x3;this[_0xacf2('0x30')]=_0x53751a[_0xacf2('0x30')]||0x96;this[_0xacf2('0x31')]=_0x53751a[_0xacf2('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x53751a[_0xacf2('0x32')]||0x96;this[_0xacf2('0x33')]=_0x53751a[_0xacf2('0x33')]||0x3;this[_0xacf2('0x34')]=_0x53751a[_0xacf2('0x34')]||0x96;this[_0xacf2('0x35')]=_0x53751a[_0xacf2('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x53751a[_0xacf2('0x36')]||0x96;this['dialDropMaxRetry']=_0x53751a['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x53751a[_0xacf2('0x37')]||0x96;this[_0xacf2('0x38')]=_0x53751a[_0xacf2('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x53751a[_0xacf2('0x39')]||0x96;this['dialMachineMaxRetry']=_0x53751a[_0xacf2('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x53751a[_0xacf2('0x3b')]||0x96;this[_0xacf2('0x3c')]=_0x53751a['dialAgentRejectMaxRetry']||0x3;this[_0xacf2('0x3d')]=_0x53751a[_0xacf2('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x53751a[_0xacf2('0x3e')]||0x4;this[_0xacf2('0x3f')]=_0x53751a['Trunk']?_0x53751a['Trunk']:undefined;this[_0xacf2('0x40')]=_0x53751a[_0xacf2('0x40')]?_0x53751a[_0xacf2('0x40')]:undefined;this[_0xacf2('0x41')]=_0x53751a[_0xacf2('0x41')]||undefined;this['Interval']=_0x53751a['Interval']?_0x53751a[_0xacf2('0x42')]:undefined;this[_0xacf2('0x43')]=_0x53751a[_0xacf2('0x43')]||'DESC';this[_0xacf2('0x44')]=_0x53751a[_0xacf2('0x44')]||undefined;this['dialCutDigit']=_0x53751a[_0xacf2('0x45')]||undefined;this[_0xacf2('0x46')]=strategy[_0x53751a[_0xacf2('0x46')]]||_0xacf2('0x8');this['queueStatusComplete']=!![];this[_0xacf2('0x47')]=_0x53751a[_0xacf2('0x47')]||![];this['dialAMDInitialSilence']=_0x53751a[_0xacf2('0x48')];this['dialAMDGreeting']=_0x53751a[_0xacf2('0x49')];this['dialAMDAfterGreetingSilence']=_0x53751a[_0xacf2('0x4a')];this[_0xacf2('0x4b')]=_0x53751a[_0xacf2('0x4b')];this[_0xacf2('0x4c')]=_0x53751a['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x53751a[_0xacf2('0x4d')];this[_0xacf2('0x4e')]=_0x53751a[_0xacf2('0x4e')];this[_0xacf2('0x4f')]=_0x53751a[_0xacf2('0x4f')];this['dialAMDMaximumWordLength']=_0x53751a[_0xacf2('0x50')];this[_0xacf2('0x51')]=0x0;this['pTalking']=0x0;this[_0xacf2('0x52')]=_0x53751a[_0xacf2('0x52')];this[_0xacf2('0x53')]=0x0;this[_0xacf2('0x54')]=0x0;this[_0xacf2('0x55')]=0x0;this[_0xacf2('0x56')]=0x0;this[_0xacf2('0x57')]=0x0;this[_0xacf2('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xacf2('0x59')]=0x0;this[_0xacf2('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xacf2('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0xacf2('0x5c')]=0x0;this['startProgressive']=undefined;this[_0xacf2('0x5d')]=undefined;this[_0xacf2('0x5e')]=undefined;this[_0xacf2('0x5f')]=1.05;this[_0xacf2('0x60')]=0x0;this[_0xacf2('0x61')]=0x0;this[_0xacf2('0x62')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xacf2('0x63')]=0x0;this[_0xacf2('0x64')]=0x0;this[_0xacf2('0x65')]=0x0;this[_0xacf2('0x66')]=0x0;this[_0xacf2('0x67')]=_0x53751a[_0xacf2('0x68')]||0x14;this[_0xacf2('0x69')]=_0x53751a[_0xacf2('0x68')]||0xa;this[_0xacf2('0x6a')]=0x0;this[_0xacf2('0x6b')]=0x0;this[_0xacf2('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0xacf2('0x6d')]=0x0;this[_0xacf2('0x6e')]=0x0;this[_0xacf2('0x6f')]=0x0;this[_0xacf2('0x70')]=_0x53751a[_0xacf2('0x70')]||0x1e;this[_0xacf2('0x71')]=_0x53751a['dialRecallInQueue']||![];this[_0xacf2('0x72')]=_0x53751a[_0xacf2('0x72')]||undefined;this[_0xacf2('0x73')]=_0x53751a[_0xacf2('0x73')]||![];this[_0xacf2('0x74')]=_0x53751a[_0xacf2('0x74')]||![];this[_0xacf2('0xb')]=monitorFormat[_0x53751a['monitor_format']]?monitorFormat[_0x53751a[_0xacf2('0xb')]]:undefined;this[_0xacf2('0x75')]=_0x53751a[_0xacf2('0x75')]||![];this[_0xacf2('0x76')]=_0x53751a[_0xacf2('0x76')]?_0x53751a['mandatoryDispositionPause']:undefined;}module[_0xacf2('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a43fbfd..7467b38 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 _0x07a5=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x1eaae4,_0x37e35b){var _0x1f92ce=function(_0x3edbf7){while(--_0x3edbf7){_0x1eaae4['push'](_0x1eaae4['shift']());}};_0x1f92ce(++_0x37e35b);}(_0x07a5,0xd0));var _0x507a=function(_0x4ea571,_0x524bc2){_0x4ea571=_0x4ea571-0x0;var _0x122eba=_0x07a5[_0x4ea571];return _0x122eba;};'use strict';function VtigerAccount(_0x2b3def){this['id']=_0x2b3def['id']||0x0;this[_0x507a('0x0')]=_0x2b3def[_0x507a('0x0')]||'';this[_0x507a('0x1')]=_0x2b3def[_0x507a('0x1')]||'';this[_0x507a('0x2')]=_0x2b3def[_0x507a('0x2')]||'';this[_0x507a('0x3')]=_0x2b3def[_0x507a('0x3')]||'';this[_0x507a('0x4')]=_0x2b3def[_0x507a('0x4')]||'';this[_0x507a('0x5')]=_0x2b3def[_0x507a('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xa1a8=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5ad10e,_0x217c2f){var _0x3fa52e=function(_0x4e7a55){while(--_0x4e7a55){_0x5ad10e['push'](_0x5ad10e['shift']());}};_0x3fa52e(++_0x217c2f);}(_0xa1a8,0x199));var _0x8a1a=function(_0x4c80ca,_0xfb5ee1){_0x4c80ca=_0x4c80ca-0x0;var _0x5441bc=_0xa1a8[_0x4c80ca];return _0x5441bc;};'use strict';function VtigerAccount(_0x15aa74){this['id']=_0x15aa74['id']||0x0;this['name']=_0x15aa74[_0x8a1a('0x0')]||'';this[_0x8a1a('0x1')]=_0x15aa74[_0x8a1a('0x1')]||'';this[_0x8a1a('0x2')]=_0x15aa74[_0x8a1a('0x2')]||'';this[_0x8a1a('0x3')]=_0x15aa74[_0x8a1a('0x3')]||'';this[_0x8a1a('0x4')]=_0x15aa74[_0x8a1a('0x4')]||'';this[_0x8a1a('0x5')]=_0x15aa74[_0x8a1a('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index d18a342..69e8017 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(_0x5c0c26,_0x32a9c8){_0x5c0c26=_0x5c0c26-0x0;var _0x2015be=_0xadb5[_0x5c0c26];return _0x2015be;};'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(_0x53afb7,_0x42db68){_0x53afb7=_0x53afb7-0x0;var _0xd6780c=_0xadb5[_0x53afb7];return _0xd6780c;};'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 056bd83..8550e47 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 _0x457b=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x4d051b,_0x4899bb){var _0x4c6741=function(_0x499ba4){while(--_0x499ba4){_0x4d051b['push'](_0x4d051b['shift']());}};_0x4c6741(++_0x4899bb);}(_0x457b,0xca));var _0xb457=function(_0x241099,_0x2997a9){_0x241099=_0x241099-0x0;var _0x164e96=_0x457b[_0x241099];return _0x164e96;};'use strict';function ZohoAccount(_0x404021){this['id']=_0x404021['id']||0x0;this[_0xb457('0x0')]=_0x404021['name']||'';this[_0xb457('0x1')]=_0x404021[_0xb457('0x1')]||'';this[_0xb457('0x2')]=_0x404021[_0xb457('0x2')]||'';this[_0xb457('0x3')]=_0x404021['zone']||'';this[_0xb457('0x4')]=_0x404021[_0xb457('0x4')]||'';this[_0xb457('0x5')]=_0x404021[_0xb457('0x5')]||'';this[_0xb457('0x6')]=_0x404021['serverUrl']||'';this[_0xb457('0x7')]=_0x404021[_0xb457('0x7')]||'';this[_0xb457('0x8')]=_0x404021['refreshToken']||'';this['Configurations']=_0x404021[_0xb457('0x9')]||{};}module[_0xb457('0xa')]=ZohoAccount; \ No newline at end of file +var _0x1516=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x42ec0b,_0x88176a){var _0x26577e=function(_0x4bc74a){while(--_0x4bc74a){_0x42ec0b['push'](_0x42ec0b['shift']());}};_0x26577e(++_0x88176a);}(_0x1516,0xb0));var _0x6151=function(_0x4daa32,_0x504c0b){_0x4daa32=_0x4daa32-0x0;var _0x3b7fc1=_0x1516[_0x4daa32];return _0x3b7fc1;};'use strict';function ZohoAccount(_0x508329){this['id']=_0x508329['id']||0x0;this[_0x6151('0x0')]=_0x508329[_0x6151('0x0')]||'';this['description']=_0x508329[_0x6151('0x1')]||'';this[_0x6151('0x2')]=_0x508329[_0x6151('0x2')]||'';this[_0x6151('0x3')]=_0x508329[_0x6151('0x3')]||'';this['clientId']=_0x508329[_0x6151('0x4')]||'';this['clientSecret']=_0x508329[_0x6151('0x5')]||'';this[_0x6151('0x6')]=_0x508329[_0x6151('0x6')]||'';this[_0x6151('0x7')]=_0x508329[_0x6151('0x7')]||'';this[_0x6151('0x8')]=_0x508329[_0x6151('0x8')]||'';this[_0x6151('0x9')]=_0x508329[_0x6151('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index a67b72a..cb9296c 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 _0xcec9=['uniqueid','idContact','queue','name','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string'];(function(_0x286ae6,_0x32f6b7){var _0x3d828f=function(_0x28007e){while(--_0x28007e){_0x286ae6['push'](_0x286ae6['shift']());}};_0x3d828f(++_0x32f6b7);}(_0xcec9,0x7b));var _0x9cec=function(_0x487bce,_0xd11228){_0x487bce=_0x487bce-0x0;var _0x17ba7a=_0xcec9[_0x487bce];return _0x17ba7a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9cec('0x0'));function checkNameSurname(_0x56bc1f,_0x5aec8d,_0xf69a20){var _0x15d448='';if(!_[_0x9cec('0x1')](_0x5aec8d)&&_0x9cec('0x2')===typeof _0x5aec8d){_0x15d448+=_0x5aec8d;}if(!_[_0x9cec('0x1')](_0xf69a20)&&_0x9cec('0x2')===typeof _0xf69a20){_0x15d448+='\x20'+_0xf69a20;}if(_0x15d448!==''){return _0x15d448;}return _0x56bc1f;}function Action(_0x18aec4,_0x300fd0,_0x45aedc,_0x418edd,_0x30bfbd){this[_0x9cec('0x3')]=_0x45aedc||undefined;this[_0x9cec('0x4')]=_0x18aec4['id'];this[_0x9cec('0x5')]=_0x300fd0[_0x9cec('0x6')];this['type']=_0x300fd0['type'];this['campaigntype']=_0x9cec('0x5');this[_0x9cec('0x7')]=![];this[_0x9cec('0x8')]=_[_0x9cec('0x1')](_0x18aec4[_0x9cec('0x9')])?undefined:_0x18aec4['Agent'][_0x9cec('0x6')];this[_0x9cec('0xa')]=this[_0x9cec('0x8')]?util[_0x9cec('0xb')](_0x9cec('0xc'),this[_0x9cec('0x8')]):_0x418edd||undefined;this[_0x9cec('0xd')]=checkNameSurname(_0x18aec4[_0x9cec('0xe')][_0x9cec('0xf')],_0x18aec4[_0x9cec('0xe')][_0x9cec('0x10')],_0x18aec4[_0x9cec('0xe')]['lastName']);this[_0x9cec('0x11')]=_0x18aec4[_0x9cec('0x11')]||![];this[_0x9cec('0x12')]=_0x18aec4['Contact'][_0x9cec('0xf')];this[_0x9cec('0x13')]=_0x18aec4['scheduledat'];this[_0x9cec('0x14')]=_0x18aec4[_0x9cec('0x14')]||0x0;this['countcongestionretry']=_0x18aec4[_0x9cec('0x15')]||0x0;this[_0x9cec('0x16')]=_0x18aec4[_0x9cec('0x16')]||0x0;this[_0x9cec('0x17')]=(_0x18aec4[_0x9cec('0x14')]||0x0)+(_0x18aec4[_0x9cec('0x15')]||0x0)+(_0x18aec4[_0x9cec('0x16')]||0x0)+(_0x18aec4[_0x9cec('0x18')]||0x0)+(_0x18aec4[_0x9cec('0x19')]||0x0)+(_0x18aec4[_0x9cec('0x1a')]||0x0)+(_0x18aec4[_0x9cec('0x1b')]||0x0)+(_0x18aec4[_0x9cec('0x1c')]||0x0);this[_0x9cec('0x18')]=_0x18aec4[_0x9cec('0x18')]||0x0;this[_0x9cec('0x19')]=_0x18aec4['countdropretry']||0x0;this[_0x9cec('0x1a')]=_0x18aec4[_0x9cec('0x1a')]||0x0;this[_0x9cec('0x1b')]=_0x18aec4[_0x9cec('0x1b')]||0x0;this[_0x9cec('0x1c')]=_0x18aec4['countagentrejectretry']||0x0;this['callback']=_0x18aec4[_0x9cec('0x1d')];this[_0x9cec('0x1e')]=_0x18aec4['callbackuniqueid'];this[_0x9cec('0x1f')]=_0x18aec4[_0x9cec('0x1f')];this[_0x9cec('0x20')]=_0x18aec4[_0x9cec('0x20')];this['ContactId']=_0x18aec4[_0x9cec('0x21')];this[_0x9cec('0x22')]=_0x18aec4[_0x9cec('0x22')];this[_0x9cec('0x23')]=_['isNil'](_0x18aec4[_0x9cec('0x9')])?_0x18aec4[_0x9cec('0x23')]:_0x18aec4['Agent']['id'];this['VoiceQueueId']=_0x18aec4[_0x9cec('0x24')];this['originatecalleridnum']='';this[_0x9cec('0x25')]='';}Action['prototype'][_0x9cec('0x26')]=function(){return util[_0x9cec('0xb')](_0x9cec('0x27'),this[_0x9cec('0xd')],this[_0x9cec('0x28')]);};module[_0x9cec('0x29')]=Action; \ No newline at end of file +var _0xdf4a=['exports','util','moment','isNil','string','uniqueid','queue','name','type','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number'];(function(_0x2e397f,_0xcd3891){var _0x574023=function(_0x2d0d12){while(--_0x2d0d12){_0x2e397f['push'](_0x2e397f['shift']());}};_0x574023(++_0xcd3891);}(_0xdf4a,0x1b9));var _0xadf4=function(_0x2e958b,_0x350ebd){_0x2e958b=_0x2e958b-0x0;var _0x3d724a=_0xdf4a[_0x2e958b];return _0x3d724a;};'use strict';var util=require(_0xadf4('0x0'));var _=require('lodash');var moment=require(_0xadf4('0x1'));function checkNameSurname(_0x2194df,_0x2d843,_0x29896f){var _0x2a1d6d='';if(!_[_0xadf4('0x2')](_0x2d843)&&_0xadf4('0x3')===typeof _0x2d843){_0x2a1d6d+=_0x2d843;}if(!_['isNil'](_0x29896f)&&_0xadf4('0x3')===typeof _0x29896f){_0x2a1d6d+='\x20'+_0x29896f;}if(_0x2a1d6d!==''){return _0x2a1d6d;}return _0x2194df;}function Action(_0x1aaf42,_0xd93f3a,_0x128180,_0x2b8a98,_0x5d9b58){this[_0xadf4('0x4')]=_0x128180||undefined;this['idContact']=_0x1aaf42['id'];this[_0xadf4('0x5')]=_0xd93f3a[_0xadf4('0x6')];this[_0xadf4('0x7')]=_0xd93f3a['type'];this['campaigntype']=_0xadf4('0x5');this['dialAnswer']=![];this[_0xadf4('0x8')]=_['isNil'](_0x1aaf42[_0xadf4('0x9')])?undefined:_0x1aaf42[_0xadf4('0x9')]['name'];this['channelAgent']=this['membername']?util[_0xadf4('0xa')](_0xadf4('0xb'),this[_0xadf4('0x8')]):_0x2b8a98||undefined;this[_0xadf4('0xc')]=checkNameSurname(_0x1aaf42[_0xadf4('0xd')][_0xadf4('0xe')],_0x1aaf42[_0xadf4('0xd')][_0xadf4('0xf')],_0x1aaf42[_0xadf4('0xd')]['lastName']);this[_0xadf4('0x10')]=_0x1aaf42[_0xadf4('0x10')]||![];this[_0xadf4('0x11')]=_0x1aaf42[_0xadf4('0xd')][_0xadf4('0xe')];this['scheduledat']=_0x1aaf42['scheduledat'];this[_0xadf4('0x12')]=_0x1aaf42[_0xadf4('0x12')]||0x0;this[_0xadf4('0x13')]=_0x1aaf42[_0xadf4('0x13')]||0x0;this[_0xadf4('0x14')]=_0x1aaf42['countnoanswerretry']||0x0;this['countglobal']=(_0x1aaf42[_0xadf4('0x12')]||0x0)+(_0x1aaf42[_0xadf4('0x13')]||0x0)+(_0x1aaf42['countnoanswerretry']||0x0)+(_0x1aaf42['countnosuchnumberretry']||0x0)+(_0x1aaf42['countdropretry']||0x0)+(_0x1aaf42[_0xadf4('0x15')]||0x0)+(_0x1aaf42[_0xadf4('0x16')]||0x0)+(_0x1aaf42[_0xadf4('0x17')]||0x0);this[_0xadf4('0x18')]=_0x1aaf42[_0xadf4('0x18')]||0x0;this[_0xadf4('0x19')]=_0x1aaf42['countdropretry']||0x0;this[_0xadf4('0x15')]=_0x1aaf42[_0xadf4('0x15')]||0x0;this['countmachineretry']=_0x1aaf42[_0xadf4('0x16')]||0x0;this[_0xadf4('0x17')]=_0x1aaf42[_0xadf4('0x17')]||0x0;this[_0xadf4('0x1a')]=_0x1aaf42[_0xadf4('0x1a')];this[_0xadf4('0x1b')]=_0x1aaf42[_0xadf4('0x1b')];this[_0xadf4('0x1c')]=_0x1aaf42[_0xadf4('0x1c')];this[_0xadf4('0x1d')]=_0x1aaf42[_0xadf4('0x1d')];this[_0xadf4('0x1e')]=_0x1aaf42[_0xadf4('0x1e')];this[_0xadf4('0x1f')]=_0x1aaf42[_0xadf4('0x1f')];this[_0xadf4('0x20')]=_[_0xadf4('0x2')](_0x1aaf42[_0xadf4('0x9')])?_0x1aaf42[_0xadf4('0x20')]:_0x1aaf42[_0xadf4('0x9')]['id'];this['VoiceQueueId']=_0x1aaf42[_0xadf4('0x21')];this[_0xadf4('0x22')]='';this[_0xadf4('0x23')]='';}Action[_0xadf4('0x24')]['getCaller']=function(){return util[_0xadf4('0xa')](_0xadf4('0x25'),this[_0xadf4('0xc')],this[_0xadf4('0x26')]);};module[_0xadf4('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 6eb5f47..663cc65 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 _0x2504=['[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','variablesAction','[originateFailure][logOriginateFailure]','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','syncBlindTransfer','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','preview','../../../config/logger','actionPreview','./rpcDb','./util/util','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','loopCampaigns','emit','type','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','outbound','dialActive','setMessage','isNil','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','UserId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','recallMe','agentReadyId','length','getDiff','Agent','run','then','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','responsetime','[syncHangup][talking][increment]','uniqueid','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','total','countglobal','totalGlobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]'];(function(_0x20e81e,_0x2ad41f){var _0x3e6654=function(_0x3f2904){while(--_0x3f2904){_0x20e81e['push'](_0x20e81e['shift']());}};_0x3e6654(++_0x2ad41f);}(_0x2504,0x1cf));var _0x4250=function(_0x308fd9,_0x36f728){_0x308fd9=_0x308fd9-0x0;var _0xadbb4=_0x2504[_0x308fd9];return _0xadbb4;};'use strict';var util=require(_0x4250('0x0'));var _=require(_0x4250('0x1'));var BPromise=require(_0x4250('0x2'));var uuid=require(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var md5=require(_0x4250('0x5'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4250('0x6'));var loggerAction=require(_0x4250('0x7'))(_0x4250('0x8'));var ami=require('../ami');var rpcDb=require(_0x4250('0x9'));var Action=require('./action');var ut=require(_0x4250('0xa'));config[_0x4250('0xb')]=_['defaults'](config[_0x4250('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4250('0xb')]));var Sequence=function(){};Sequence[_0x4250('0xc')][_0x4250('0xd')]=function(_0x441962){this[_0x4250('0xe')]=this[_0x4250('0xe')]?this[_0x4250('0xe')]['finally'](_0x441962):_0x441962();};function Preview(_0xc98878){this[_0x4250('0xf')]=new Sequence();this[_0x4250('0x10')]=_0xc98878[_0x4250('0x11')];this[_0x4250('0x12')]=_0xc98878['trunks'];this[_0x4250('0x13')]={};this[_0x4250('0x14')]=_0xc98878[_0x4250('0x14')];this[_0x4250('0x15')]=0x0;ami['on'](_0x4250('0x16'),this[_0x4250('0x17')][_0x4250('0x18')](this));ami['on'](_0x4250('0x19'),this[_0x4250('0x1a')][_0x4250('0x18')](this));ami['on'](_0x4250('0x1b'),this[_0x4250('0x1c')][_0x4250('0x18')](this));ami['on']('dialend',this[_0x4250('0x1d')][_0x4250('0x18')](this));ami['on'](_0x4250('0x1e'),this[_0x4250('0x1f')][_0x4250('0x18')](this));ami['on'](_0x4250('0x20'),this[_0x4250('0x21')][_0x4250('0x18')](this));ami['on'](_0x4250('0x22'),this['syncAttendedTransfer'][_0x4250('0x18')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4250('0x18')](this));this[_0x4250('0x23')](this[_0x4250('0x10')]);}function emit(_0x35549a,_0x5807b3,_0x2e6969){io['to'](_0x35549a)[_0x4250('0x24')](_0x5807b3,_0x2e6969);}function emitCampaignPreview(_0x530a84){if(_0x530a84[_0x4250('0x25')]==='outbound'){var _0x4a1625={'id':_0x530a84['id'],'name':_0x530a84[_0x4250('0x26')],'strategy':_0x530a84[_0x4250('0x27')],'answered':_0x530a84[_0x4250('0x28')],'available':_0x530a84['available'],'loggedIn':_0x530a84[_0x4250('0x29')],'pTalking':_0x530a84[_0x4250('0x2a')],'sumBillable':_0x530a84[_0x4250('0x2b')],'sumDuration':_0x530a84[_0x4250('0x2c')],'sumHoldTime':_0x530a84[_0x4250('0x2d')]||0x0,'talking':_0x530a84['talking'],'total':_0x530a84['total'],'type':_0x530a84[_0x4250('0x25')],'unmanaged':_0x530a84['unmanaged'],'abandoned':_0x530a84[_0x4250('0x2e')],'waiting':_0x530a84['waiting'],'loggedInDb':_0x530a84[_0x4250('0x2f')],'dialActive':_0x530a84['dialActive'],'dialMethod':_0x530a84[_0x4250('0x30')],'dialOriginateCallerIdName':_0x530a84['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x530a84[_0x4250('0x31')],'dialOriginateTimeout':_0x530a84[_0x4250('0x32')],'dialPrefix':_0x530a84[_0x4250('0x33')],'outboundAnswerAgiCallsDay':_0x530a84[_0x4250('0x34')],'outboundAnswerCallsDay':_0x530a84[_0x4250('0x35')],'outboundBlacklistCallsDay':_0x530a84[_0x4250('0x36')],'outboundBusyCallsDay':_0x530a84[_0x4250('0x37')],'outboundCongestionCallsDay':_0x530a84[_0x4250('0x38')],'outboundDropCallsDayACS':_0x530a84[_0x4250('0x39')],'outboundDropCallsDayCallersExit':_0x530a84[_0x4250('0x3a')],'outboundDropCallsDayTimeout':_0x530a84[_0x4250('0x3b')],'outboundNoAnswerCallsDay':_0x530a84[_0x4250('0x3c')],'outboundNoSuchCallsDay':_0x530a84[_0x4250('0x3d')],'outboundOriginateFailureCallsDay':_0x530a84[_0x4250('0x3e')],'outboundReCallsDay':_0x530a84['outboundReCallsDay'],'outboundRejectCallsDay':_0x530a84[_0x4250('0x3f')],'outboundUnknownCallsDay':_0x530a84[_0x4250('0x40')],'outboundAbandonedCallsDay':_0x530a84[_0x4250('0x41')],'predictiveIntervalAnsweredCalls':_0x530a84['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x530a84[_0x4250('0x42')],'predictiveIntervalAvgTalktime':_0x530a84[_0x4250('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x530a84[_0x4250('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x530a84[_0x4250('0x45')],'predictiveIntervalErlangCalls':_0x530a84[_0x4250('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x530a84[_0x4250('0x47')],'predictiveIntervalHitRate':_0x530a84[_0x4250('0x48')],'predictiveIntervalMultiplicativeFactor':_0x530a84[_0x4250('0x49')],'predictiveIntervalPauses':_0x530a84['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x530a84['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x530a84[_0x4250('0x4a')],'message':_0x530a84[_0x4250('0x4b')],'originated':_0x530a84[_0x4250('0x4c')],'erlangCalls':_0x530a84[_0x4250('0x4d')],'erlangCallToSecond':_0x530a84[_0x4250('0x4e')],'erlangAbandonmentRate':_0x530a84[_0x4250('0x4f')],'erlangBusyFactor':_0x530a84[_0x4250('0x50')],'startPredictive':_0x530a84[_0x4250('0x51')],'startProgressive':_0x530a84['startProgressive']};if(_0x530a84[_0x4250('0x52')]){_0x4a1625[_0x4250('0x52')]={'id':_0x530a84[_0x4250('0x52')]['id'],'name':_0x530a84['Trunk'][_0x4250('0x26')],'active':_0x530a84[_0x4250('0x52')][_0x4250('0x53')],'callerid':_0x530a84['Trunk'][_0x4250('0x54')]};}if(_0x530a84[_0x4250('0x55')]){_0x4a1625[_0x4250('0x55')]={'id':_0x530a84[_0x4250('0x55')]['id'],'name':_0x530a84[_0x4250('0x55')][_0x4250('0x26')]};}var _0x56926a=md5(JSON[_0x4250('0x56')](_0x4a1625));if(_0x530a84[_0x4250('0x5')]!==_0x56926a){_0x530a84[_0x4250('0x5')]=_0x56926a;emit(util[_0x4250('0x57')](_0x4250('0x58'),_0x4a1625[_0x4250('0x26')]),_0x4250('0x59'),_0x4a1625);}}}function emitVoiceQueueChannelRemove(_0x8c8251){logger[_0x4250('0x5a')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x4250('0x56')](_0x8c8251));emit(util[_0x4250('0x57')](_0x4250('0x58'),_0x8c8251[_0x4250('0x26')]),'voice_queue_channel:remove',_0x8c8251);}function notSendMessagesQueue(_0x348a00){if(_0x348a00[_0x4250('0x5b')]){if(_0x348a00[_0x4250('0x4c')]===0x0&&_0x348a00['pTalking']===0x0){_0x348a00[_0x4250('0x5b')]=![];_0x348a00[_0x4250('0x5c')]=0x0;_0x348a00[_0x4250('0x5d')]=0x0;_0x348a00[_0x4250('0x4b')]=_0x4250('0x5e');ut['logger'](_0x4250('0x5f'),_0x348a00['name']+_0x4250('0x60'));}else{_0x348a00['message']=_0x4250('0x61');ut[_0x4250('0x62')](_0x4250('0x5f'),_0x348a00['name']+_0x4250('0x63'));}emitCampaignPreview(_0x348a00);}}Preview['prototype'][_0x4250('0x23')]=function(){var _0x4f085d=this;setInterval(function(){_0x4f085d['syncCampaigns']();},0x7cf);};Preview[_0x4250('0xc')][_0x4250('0x64')]=function(){var _0x1527bb=this[_0x4250('0x10')];this[_0x4250('0x15')]+=0x1;for(var _0x286fdd in _0x1527bb){if(_0x1527bb[_0x4250('0x65')](_0x286fdd)&&(_0x1527bb[_0x286fdd][_0x4250('0x30')]==='preview'||_0x1527bb[_0x286fdd][_0x4250('0x30')]===_0x4250('0x66'))&&_0x1527bb[_0x286fdd][_0x4250('0x25')]==='outbound'){if(this[_0x4250('0x15')]>0x7){this[_0x4250('0x15')]=0x0;this[_0x4250('0x67')]();}}if(_0x1527bb[_0x4250('0x65')](_0x286fdd)&&_0x1527bb[_0x286fdd][_0x4250('0x30')]===_0x4250('0x6')&&_0x1527bb[_0x286fdd][_0x4250('0x25')]===_0x4250('0x68')){if(_0x1527bb[_0x286fdd][_0x4250('0x69')]){this[_0x4250('0x6a')](_0x1527bb[_0x286fdd]);this['recallMe'](_0x1527bb[_0x286fdd]);}else{notSendMessagesQueue(_0x1527bb[_0x286fdd]);}}}};Preview[_0x4250('0xc')]['clearZombieChannel']=function(_0x3dc8bf){var _0x3bcdf0=this;this[_0x4250('0xf')][_0x4250('0xd')](function(){if(!_[_0x4250('0x6b')](_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf])){loggerAction[_0x4250('0x5a')](_0x4250('0x6c'),_0x3dc8bf,'Queue',_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x6d')],'originated:\x20',JSON['stringify'](_0x3bcdf0[_0x4250('0x10')][_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x6d')]][_0x4250('0x4c')]),_0x4250('0x6e'),JSON[_0x4250('0x56')](_0x3bcdf0[_0x4250('0x10')][_0x3bcdf0['actions'][_0x3dc8bf][_0x4250('0x6d')]]['pTalking']),JSON[_0x4250('0x56')](_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x6f')]),JSON[_0x4250('0x56')](_['pick'](_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf],['contactId',_0x4250('0x70'),'VoiceQueueId',_0x4250('0x71')])));return ami[_0x4250('0x72')]({'action':_0x4250('0x73'),'channel':_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x74')]})[_0x4250('0x75')](function(_0x3b019d){if(_0x3b019d['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf]){ut[_0x4250('0x76')](_0x3bcdf0['campaignsPreview'][_0x3bcdf0['actions'][_0x3dc8bf][_0x4250('0x6d')]],_0x4250('0x77'));if(_0x3bcdf0['actions'][_0x3dc8bf][_0x4250('0x6f')]===!![]){ut[_0x4250('0x78')](_0x3bcdf0[_0x4250('0x10')][_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf][_0x4250('0x6d')]],_0x4250('0x77'));ut[_0x4250('0x79')](_0x4250('0x7a')+_0x3dc8bf,_0x3bcdf0[_0x4250('0x13')][_0x3dc8bf]['queue']);}ut['loggerError'](_0x4250('0x7b')+_0x3dc8bf,_0x3bcdf0['actions'][_0x3dc8bf][_0x4250('0x6d')]);delete _0x3bcdf0[_0x4250('0x13')][_0x3dc8bf];}},0x2328);}});}});};Preview[_0x4250('0xc')][_0x4250('0x67')]=function(){var _0x1d5156=this;loggerAction['info'](_0x4250('0x7c'),_[_0x4250('0x7d')](this[_0x4250('0x13')]));for(var _0x15d6ac in this[_0x4250('0x13')]){if(_0x1d5156[_0x4250('0x13')][_0x4250('0x65')](_0x15d6ac)){_0x1d5156[_0x4250('0x7e')](_0x15d6ac);}}};Preview[_0x4250('0xc')][_0x4250('0x7f')]=function(_0x335ab7){var _0x430da3=this;rpcDb['getContactRecallMe'](_0x335ab7['id'],ut[_0x4250('0x80')](this[_0x4250('0x14')]))['then'](function(_0x5ca52c){if(!_[_0x4250('0x6b')](_0x5ca52c)){for(var _0x56f6d6=0x0;_0x56f6d6<_0x5ca52c[_0x4250('0x81')];_0x56f6d6+=0x1){if(ut[_0x4250('0x82')](_0x5ca52c[_0x56f6d6]['scheduledat'])<_0x335ab7['dialRecallMeTimeout']*0x3c){if(_0x5ca52c[_0x56f6d6][_0x4250('0x83')]&&!_0x5ca52c[_0x56f6d6][_0x4250('0x83')]['voicePause']){_0x430da3[_0x4250('0x84')](_0x5ca52c[_0x56f6d6]['id'])[_0x4250('0x85')](ut[_0x4250('0x86')]('[RecallMe]'))[_0x4250('0x75')](ut[_0x4250('0x86')](_0x4250('0x87')));}else{rpcDb[_0x4250('0x88')](_0x5ca52c[_0x56f6d6]['id']);}}else{var _0x3ea999=new Action(_0x5ca52c[_0x56f6d6],_0x335ab7);_0x3ea999['starttime']=moment()['format'](_0x4250('0x89'));_0x335ab7[_0x4250('0x8a')]+=0x1;ut[_0x4250('0x8b')](_0x3ea999,0x17,_0x4250('0x8c'));if(_0x335ab7[_0x4250('0x8d')]){rpcDb[_0x4250('0x8e')](ut[_0x4250('0x8f')](_0x5ca52c[_0x56f6d6]));rpcDb[_0x4250('0x90')](_0x3ea999,_0x4250('0x91'));}else{ut['logCustomer'](_0x3ea999,0x16,_0x4250('0x92'));rpcDb[_0x4250('0x90')](_0x3ea999,_0x4250('0x93'));rpcDb[_0x4250('0x94')](_0x3ea999,'[HistoryRecallClose]');}}}}})[_0x4250('0x75')](ut['logger2'](_0x4250('0x95')));};Preview[_0x4250('0xc')][_0x4250('0x6a')]=function(_0x45521e){_0x45521e[_0x4250('0x5b')]=!![];if(ut[_0x4250('0x96')](_0x45521e['loggedIn'])){_0x45521e[_0x4250('0x4b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x4250('0x97')](_0x45521e[_0x4250('0x69')])){_0x45521e[_0x4250('0x4b')]=_0x4250('0x5e');}else if(!this[_0x4250('0x98')](_0x45521e['Trunk'])){if(!this[_0x4250('0x98')](_0x45521e['TrunkBackup'])){_0x45521e['message']=_0x4250('0x99');}else{_0x45521e[_0x4250('0x4b')]=_0x4250('0x9a');}}else{_0x45521e[_0x4250('0x4b')]=_0x4250('0x9a');}emitCampaignPreview(_0x45521e);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x36121a,_0x18c318,_0x4f2dd4){var _0x3aa02a=this;var _0x2bd5ec=this[_0x4250('0x13')][_0x18c318];var _0x3f0eda=this[_0x4250('0x10')][_0x2bd5ec[_0x4250('0x6d')]];var _0x1a2f12;if(_0x3f0eda){switch(_0x4f2dd4){case'1':_0x3f0eda[_0x4250('0x3d')]+=0x1;_0x2bd5ec[_0x4250('0x9b')]+=0x1;_0x2bd5ec['countglobal']=ut['totalGlobal'](_0x2bd5ec);ut['logCustomer'](_0x2bd5ec,0x0,_0x4250('0x9c'));ami[_0x4250('0x24')](_0x4250('0x9d'),ut['buildObj'](_0x2bd5ec,_0x4250('0x9e')));rpcDb[_0x4250('0x90')](_0x2bd5ec,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,'Global');rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xa1'));}else{if(_0x2bd5ec[_0x4250('0x9b')]>=_0x3f0eda['dialNoSuchNumberMaxRetry']){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xa1'));}else{rpcDb[_0x4250('0xa2')](ut[_0x4250('0xa3')](_0x2bd5ec,'countnosuchnumberretry',_0x3f0eda[_0x4250('0xa4')]),_0x2bd5ec[_0x4250('0xa5')],_0x2bd5ec['activeContact']);}}delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xa6')]];break;case'ANSWER':var _0x112d66=moment()[_0x4250('0x57')](_0x4250('0x89'));_0x2bd5ec[_0x4250('0xa7')]=_0x112d66;_0x2bd5ec['answertime']=_0x112d66;_0x2bd5ec[_0x4250('0x6f')]=!![];_0x3f0eda[_0x4250('0x2a')]+=0x1;logger[_0x4250('0x5a')](_0x4250('0xa8'),_0x2bd5ec[_0x4250('0xa9')],'\x20Queue',_0x3f0eda[_0x4250('0x26')],_0x4250('0x6e'),_0x3f0eda[_0x4250('0x2a')]);ami[_0x4250('0x24')]('custom:agentconnect',ut['buildObj'](_0x2bd5ec,_0x4250('0xaa')));if(_0x3f0eda['acw']){ami[_0x4250('0x24')](_0x4250('0xab'),ut[_0x4250('0xac')](_0x2bd5ec));}break;case'16':ami[_0x4250('0x24')](_0x4250('0xad'),ut[_0x4250('0xae')](_0x2bd5ec,_0x4250('0xaf')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2bd5ec,_0x4250('0xaf')));_0x3f0eda['outboundAnswerCallsDay']+=0x1;_0x3f0eda[_0x4250('0xb0')]+=0x1;_0x3f0eda[_0x4250('0x28')]+=0x1;ut[_0x4250('0x78')](_0x3f0eda,'[16]');_0x2bd5ec[_0x4250('0xb1')]=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x4,_0x4250('0xb3'));rpcDb['createCustomerHistory'](_0x2bd5ec,_0x4250('0xb4'));rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xb5'));rpcDb[_0x4250('0xb6')](_0x2bd5ec);_0x3f0eda[_0x4250('0x2c')]+=_0x2bd5ec[_0x4250('0xb7')];_0x3f0eda[_0x4250('0x2b')]+=_0x2bd5ec[_0x4250('0xb7')];logger[_0x4250('0x5a')]('[syncHangup][talking][decrement]',_0x2bd5ec['uniqueid'],'\x20Queue',_0x3f0eda[_0x4250('0x26')],'pTalking:\x20',_0x3f0eda[_0x4250('0x2a')]);delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xa6')]];break;case _0x4250('0xb8'):_0x3f0eda[_0x4250('0x37')]+=0x1;_0x2bd5ec[_0x4250('0xb9')]+=0x1;_0x2bd5ec[_0x4250('0xb1')]=ut['totalGlobal'](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x5,_0x4250('0xba'));ami[_0x4250('0x24')](_0x4250('0xbb'),ut['buildObj'](_0x2bd5ec,_0x4250('0xbc')));rpcDb['createCustomerHistory'](_0x2bd5ec,_0x4250('0xbd'));if(ut['totalGlobal'](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut['cloneAction'](_0x2bd5ec,0xf,_0x4250('0xbe'));rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xbf'));}else{if(_0x2bd5ec[_0x4250('0xb9')]>=_0x3f0eda[_0x4250('0xc0')]){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xbd'));}else{rpcDb[_0x4250('0xa2')](ut['scheduledAt'](_0x2bd5ec,_0x4250('0xb9'),_0x3f0eda[_0x4250('0xc1')]),_0x2bd5ec[_0x4250('0xa5')],_0x2bd5ec[_0x4250('0xc2')]);}}break;case _0x4250('0xc3'):_0x3f0eda[_0x4250('0x3c')]+=0x1;_0x2bd5ec[_0x4250('0xc4')]+=0x1;_0x2bd5ec['countglobal']=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x3,_0x4250('0xc5'));ami[_0x4250('0x24')](_0x4250('0xc6'),ut[_0x4250('0xae')](_0x2bd5ec,'noanswer'));rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xc7'));if(ut[_0x4250('0xb2')](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,_0x4250('0xbe'));rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xc8'));}else{if(_0x2bd5ec[_0x4250('0xc4')]>=_0x3f0eda['dialNoAnswerMaxRetry']){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xc7'));}else{rpcDb[_0x4250('0xa2')](ut[_0x4250('0xa3')](_0x2bd5ec,_0x4250('0xc4'),_0x3f0eda[_0x4250('0xc9')]),_0x2bd5ec['unlockAgent'],_0x2bd5ec[_0x4250('0xc2')]);}}break;case _0x4250('0xca'):_0x3f0eda[_0x4250('0x38')]+=0x1;_0x2bd5ec['countcongestionretry']+=0x1;_0x2bd5ec[_0x4250('0xb1')]=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x8,_0x4250('0xcb'));ami[_0x4250('0x24')](_0x4250('0xcc'),ut[_0x4250('0xae')](_0x2bd5ec,_0x4250('0xcd')));rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xce'));if(ut[_0x4250('0xb2')](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,'Global');rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xcf'));}else{if(_0x2bd5ec[_0x4250('0xd0')]>=_0x3f0eda['dialCongestionMaxRetry']){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xce'));}else{rpcDb[_0x4250('0xa2')](ut[_0x4250('0xa3')](_0x2bd5ec,'countcongestionretry',_0x3f0eda[_0x4250('0xc1')]),_0x2bd5ec[_0x4250('0xa5')],_0x2bd5ec[_0x4250('0xc2')]);}}break;case'CANCEL':_0x3f0eda['outboundRejectCallsDay']+=0x1;_0x2bd5ec[_0x4250('0xd1')]+=0x1;_0x2bd5ec[_0x4250('0xb1')]=ut['totalGlobal'](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0x14,_0x4250('0xd2'));ami[_0x4250('0x24')](_0x4250('0xd3'),ut[_0x4250('0xae')](_0x2bd5ec,_0x4250('0xd4')));rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xd5'));if(ut['totalGlobal'](_0x2bd5ec)>=_0x3f0eda['dialGlobalMaxRetry']){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0x14,'AgentReject');rpcDb[_0x4250('0x94')](_0x1a2f12,_0x4250('0xd6'));}else{if(_0x2bd5ec[_0x4250('0xd1')]>=_0x3f0eda[_0x4250('0xd7')]){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xd6'));}else{rpcDb[_0x4250('0xa2')](ut['scheduledAt'](_0x2bd5ec,_0x4250('0xd1'),_0x3f0eda[_0x4250('0xd8')]),_0x2bd5ec['unlockAgent'],_0x2bd5ec[_0x4250('0xc2')]);}}break;case _0x4250('0xd9'):_0x3f0eda['outboundAbandonedCallsDay']+=0x1;_0x2bd5ec[_0x4250('0xda')]+=0x1;_0x2bd5ec['countglobal']=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0xb,_0x4250('0xdb'));rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xdc'));if(ut[_0x4250('0xb2')](_0x2bd5ec)>=_0x3f0eda['dialGlobalMaxRetry']){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,_0x4250('0xbe'));rpcDb['createCustomerFinal'](_0x1a2f12,_0x4250('0xdc'));}else{if(_0x2bd5ec[_0x4250('0xdd')]>=_0x3f0eda[_0x4250('0xde')]){rpcDb[_0x4250('0x94')](_0x2bd5ec,_0x4250('0xdc'));}else{rpcDb[_0x4250('0xa2')](ut[_0x4250('0xa3')](_0x2bd5ec,_0x4250('0xda'),_0x3f0eda[_0x4250('0xdf')]),_0x2bd5ec[_0x4250('0xa5')],_0x2bd5ec[_0x4250('0xc2')]);}}break;default:if(_0x2bd5ec[_0x4250('0x6f')]){ut[_0x4250('0x78')](_0x3f0eda,'[default]');ut[_0x4250('0x79')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3f0eda[_0x4250('0x26')],_0x36121a);}_0x3f0eda['outboundUnknownCallsDay']+=0x1;_0x2bd5ec[_0x4250('0xb1')]=ut[_0x4250('0xb2')](_0x2bd5ec);ut[_0x4250('0x8b')](_0x2bd5ec,0xc,_0x36121a[_0x4250('0xe0')]||_0x36121a[_0x4250('0xe1')]);rpcDb[_0x4250('0x90')](_0x2bd5ec,_0x4250('0xe2'));if(ut[_0x4250('0xb2')](_0x2bd5ec)>=_0x3f0eda[_0x4250('0x9f')]){_0x1a2f12=ut[_0x4250('0xa0')](_0x2bd5ec,0xf,_0x4250('0xbe'));rpcDb['createCustomerFinal'](_0x1a2f12,_0x4250('0xe3'));}else{rpcDb['createCustomerFinal'](_0x2bd5ec,_0x4250('0xe3'));}delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xa6')]];}if(!(_0x2bd5ec['dialAnswer']&&_0x4f2dd4==='16')){ut[_0x4250('0x76')](_0x3f0eda,'[callProgressDetectingCustomer]');logger['info'](_0x4250('0xe4'),_0x2bd5ec[_0x4250('0xa9')],_0x4250('0xe5'),_0x3f0eda['name'],'originated:\x20',_0x3f0eda[_0x4250('0x4c')]);}if(_0x4f2dd4!==_0x4250('0xe6')){delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xa6')]];delete this[_0x4250('0x13')][_0x36121a[_0x4250('0xe7')]];}}};Preview[_0x4250('0xc')][_0x4250('0xe8')]=function(_0x296d91,_0x2ede09,_0x53ed0c){if(_[_0x4250('0xe9')](_0x2ede09)&&_0x4250('0xea')!==typeof _0x2ede09){return;}if(_[_0x4250('0xe9')](_0x53ed0c)&&_0x4250('0xea')!==typeof _0x53ed0c){return;}switch(_0x53ed0c[_0x4250('0xeb')]){case'0':ut[_0x4250('0xec')](_0x296d91,0x0,_0x4250('0x9c'));rpcDb[_0x4250('0xed')](_0x296d91,_0x4250('0xee'));break;case'3':ut[_0x4250('0xec')](_0x296d91,0x3,_0x4250('0xc5'));rpcDb[_0x4250('0xed')](_0x296d91,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x4250('0xec')](_0x296d91,0x5,_0x4250('0xba'));rpcDb[_0x4250('0xed')](_0x296d91,_0x4250('0xef'));break;case'8':ut['logAgent'](_0x296d91,0x8,_0x4250('0xcb'));rpcDb[_0x4250('0xed')](_0x296d91,_0x4250('0xf0'));break;case'22':ut[_0x4250('0xec')](_0x296d91,0x16,'AnswerAGI');rpcDb[_0x4250('0xed')](_0x296d91,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x296d91,0xc,_0x53ed0c['reason']);rpcDb[_0x4250('0xed')](_0x296d91,_0x4250('0xf0'));}ut[_0x4250('0x76')](_0x2ede09,_0x4250('0xf1'));logger['info'](_0x4250('0xf2'),_0x296d91[_0x4250('0xa9')],_0x4250('0xe5'),_0x2ede09[_0x4250('0x26')],_0x4250('0xf3'),_0x2ede09['originated']);delete this[_0x4250('0x13')][_0x296d91[_0x4250('0xa9')]];};Preview['prototype'][_0x4250('0xf4')]=function(_0x4ec98b,_0x5d1434,_0x141449,_0xa6f271,_0x133fbf){var _0x39c68d=this;return new BPromise(function(_0x370cad,_0x1f5e45){if(_[_0x4250('0x6b')](_0x5d1434)||_[_0x4250('0x6b')](_0x5d1434[_0x4250('0xf5')])||_['isNil'](_0x5d1434['Contact'][_0x4250('0xf6')])||_[_0x4250('0x6b')](_0x5d1434[_0x4250('0xf7')])){_0x1f5e45(ut[_0x4250('0x4b')](_0x4250('0xf8'),_0xa6f271,_0x133fbf));return;}var _0xb3c02d=uuid['v4']();var _0x48d4a5=_0x39c68d[_0x4250('0x10')][_0x5d1434[_0x4250('0xf9')][_0x4250('0x26')]];var _0x4ca272=_0x141449?_0x39c68d[_0x4250('0x14')][_0x141449]['id']:undefined;_0x39c68d[_0x4250('0x13')][_0xb3c02d]=new Action(_0x5d1434,_0x48d4a5,_0xb3c02d,_0x141449,_0x4ca272);var _0x1e4d3e=_0x39c68d['actions'][_0xb3c02d];_0x1e4d3e[_0x4250('0xa5')]=_0xa6f271;_0x1e4d3e[_0x4250('0xc2')]=_0x133fbf;_0x1e4d3e[_0x4250('0xfa')]=_0x141449;if(_['isEmpty'](_0x4ec98b)){_0x39c68d[_0x4250('0xfb')](_0x1e4d3e,_0x48d4a5,_0x5d1434,_0x141449)[_0x4250('0x85')](function(_0x3aaca1){logger['info'](_0x4250('0xfc'),_0x4250('0xfd')+_0x1e4d3e[_0x4250('0x6d')]+_0x4250('0xfe')+_0x1e4d3e['idContact'],JSON[_0x4250('0x56')](_0x3aaca1));ami['emit']('custom:agentcalled',ut[_0x4250('0xae')](_0x1e4d3e,_0x4250('0xff')));_0x370cad(ut[_0x4250('0x4b')](_0x4250('0x100')));})[_0x4250('0x75')](function(_0x407cc0){ut[_0x4250('0x62')](_0x4250('0x101'),_0x407cc0);_0x1f5e45(ut[_0x4250('0x4b')](_0x4250('0x102'),_0xa6f271,_0x133fbf));});}else{_0x48d4a5['outboundBlacklistCallsDay']+=0x1;ut[_0x4250('0x103')](_0x1e4d3e);rpcDb[_0x4250('0x104')](_0x1e4d3e,'[Blacklist][error]');delete _0x39c68d[_0x4250('0x13')][_0xb3c02d];_0x1f5e45(ut[_0x4250('0x4b')](_0x4250('0x105'),_0xa6f271,_0x133fbf));}});};Preview[_0x4250('0xc')][_0x4250('0x98')]=function(_0xf7facd){return!_[_0x4250('0x6b')](_0xf7facd)&&!_[_0x4250('0x6b')](_0xf7facd[_0x4250('0x26')])&&!_[_0x4250('0x6b')](_0xf7facd[_0x4250('0x53')])&&_0xf7facd[_0x4250('0x53')]&&!_[_0x4250('0x6b')](this['trunks'][util[_0x4250('0x57')]('SIP/%s',_0xf7facd[_0x4250('0x26')])])&&!_[_0x4250('0x6b')](this[_0x4250('0x12')][util[_0x4250('0x57')](_0x4250('0x106'),_0xf7facd[_0x4250('0x26')])][_0x4250('0x73')])&&(this[_0x4250('0x12')][util[_0x4250('0x57')](_0x4250('0x106'),_0xf7facd[_0x4250('0x26')])][_0x4250('0x73')]===_0x4250('0x107')||this[_0x4250('0x12')][util[_0x4250('0x57')]('SIP/%s',_0xf7facd[_0x4250('0x26')])][_0x4250('0x73')]===_0x4250('0x108'));};Preview[_0x4250('0xc')][_0x4250('0x84')]=function(_0x1fa830,_0x45a79e){var _0xc683bd=this;return new BPromise(function(_0x458db1,_0x51d8fb){_0xc683bd[_0x4250('0x109')](_0x1fa830,_0x45a79e)['then'](function(_0x3c1faa){_0x458db1(_[_0x4250('0x10a')](_0x3c1faa,[_0x4250('0x4b')]));})[_0x4250('0x75')](function(_0x4b01e7){if(_0x4b01e7[_0x4250('0x10b')]){rpcDb[_0x4250('0x10c')](_0x1fa830);}if(_0x4b01e7[_0x4250('0x53')]){rpcDb[_0x4250('0x88')](_0x1fa830);}_0x51d8fb(_[_0x4250('0x10a')](_0x4b01e7,['message']));});});};Preview[_0x4250('0xc')][_0x4250('0x109')]=function(_0x37c741,_0x46f98f){var _0x5eb27e=this;return new BPromise(function(_0x5296a0,_0x5464ad){var _0x3f1dcf,_0x1a2306;rpcDb[_0x4250('0x10d')](_0x37c741)[_0x4250('0x85')](function(_0x3b0535){if(!_[_0x4250('0x6b')](_0x3b0535[0x0])){_0x1a2306=_0x3b0535[0x0][_0x4250('0x10e')]?![]:!![];_0x3f1dcf=_0x3b0535[0x0][_0x4250('0x10e')]?!![]:![];_0x3f1dcf=_0x46f98f?!![]:_0x3f1dcf;}var _0x4d1eb9=_0x5eb27e[_0x4250('0x10f')](_0x3b0535);if(_0x4d1eb9[_0x4250('0x110')]){rpcDb[_0x4250('0x111')](_[_0x4250('0x10a')](_0x3b0535[0x0],['VoiceQueueId',_0x4250('0x112')]))[_0x4250('0x85')](function(_0x5213e6){_0x5eb27e[_0x4250('0xf4')](_0x5213e6,_0x3b0535[0x0],_0x46f98f,_0x1a2306,_0x3f1dcf)[_0x4250('0x85')](function(_0x2fc5ab){_0x5296a0(_0x2fc5ab);})['catch'](function(_0xccf796){_0x5464ad(_0xccf796);});})['catch'](function(_0x23c18b){ut['logger']('[Preview][checkIsBlackList]',_0x23c18b);_0x5464ad(ut['message'](_0x4250('0x113'),_0x1a2306,_0x3f1dcf));});}else{_0x5464ad(ut[_0x4250('0x4b')](_0x4d1eb9['message'],_0x1a2306,_0x3f1dcf));}})['catch'](function(_0x51493c){ut['logger'](_0x4250('0x114'),_0x51493c);_0x5464ad(ut[_0x4250('0x4b')](_0x4250('0x113'),![],!![]));});});};Preview[_0x4250('0xc')]['validateContact']=function(_0x330eac){if(_['isNil'](_0x330eac)||_[_0x4250('0x115')](_0x330eac)||!_[_0x4250('0x6b')](_0x330eac[0x0][_0x4250('0x83')])&&_['isNil'](_0x330eac[0x0][_0x4250('0x83')][_0x4250('0x26')])){ut[_0x4250('0x62')]('[Preview][validateContact][Empty\x20Contact]',_0x330eac);return{'isValid':![],'message':_0x4250('0x116')};}var _0x4e4473=this[_0x4250('0x10')][_0x330eac[0x0]['Queue'][_0x4250('0x26')]];_0x4e4473[_0x4250('0x4b')]='ACTIVE';if(_['isNil'](_0x4e4473)){ut[_0x4250('0x62')](_0x4250('0x117'),_0x4e4473);return{'isValid':![],'message':_0x4250('0x118')};}if(!this['isTrunkReachable'](_0x4e4473[_0x4250('0x52')])){ut[_0x4250('0x62')](_0x4250('0x119'),_0x4250('0x11a')+_0x4e4473[_0x4250('0x26')]+_0x4250('0x11b'));if(!this['isTrunkReachable'](_0x4e4473[_0x4250('0x11c')])){ut['logger'](_0x4250('0x119'),_0x4e4473[_0x4250('0x26')]+_0x4250('0x11d'));return{'isValid':![],'message':_0x4250('0x11e')};}}if(!ut[_0x4250('0x97')](_0x4e4473[_0x4250('0x69')])){ut[_0x4250('0x62')](_0x4250('0x11f'),_0x4e4473['name']+_0x4250('0x120'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4e4473[_0x4250('0x26')]+_0x4250('0x120')};}return{'isValid':!![],'message':_0x4250('0x121')};};Preview[_0x4250('0xc')]['execCall']=function(_0x5507ac,_0x2e82e1,_0xd83704,_0x577485){var _0x52a109=this;return new BPromise(function(_0x342087,_0x5896d4){var _0x16545d=_0x5507ac['uniqueid'];var _0x355baa=_0x52a109['isTrunkReachable'](_0x2e82e1[_0x4250('0x52')])?util[_0x4250('0x57')](_0x4250('0x122'),_0x2e82e1['Trunk']['name'],_[_0x4250('0x6b')](_0x2e82e1[_0x4250('0x33')])?'':_0x2e82e1[_0x4250('0x33')][_0x4250('0x123')]()||'',_0x2e82e1[_0x4250('0x124')]>0x0?_0xd83704[_0x4250('0xf5')]['phone']['substring'](_0x2e82e1['dialCutDigit']):_0xd83704[_0x4250('0xf5')][_0x4250('0xf6')]):util[_0x4250('0x57')](_0x4250('0x122'),_['isNil'](_0x2e82e1[_0x4250('0x11c')])?_0x2e82e1[_0x4250('0x52')][_0x4250('0x26')]:_0x2e82e1[_0x4250('0x11c')][_0x4250('0x26')],_['isNil'](_0x2e82e1[_0x4250('0x33')])?'':_0x2e82e1['dialPrefix'][_0x4250('0x123')]()||'',_0x2e82e1[_0x4250('0x124')]>0x0?_0xd83704[_0x4250('0xf5')][_0x4250('0xf6')][_0x4250('0x125')](_0x2e82e1[_0x4250('0x124')]):_0xd83704['Contact'][_0x4250('0xf6')]);var _0x1b4145=_0x52a109['isTrunkReachable'](_0x2e82e1[_0x4250('0x52')])?ut[_0x4250('0x126')](_0x2e82e1[_0x4250('0x52')]['callerid'],_0x2e82e1[_0x4250('0x127')],_0x2e82e1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4250('0x128')](_0x2e82e1[_0x4250('0x31')],_0x2e82e1['dialRandomLastDigitCallerIdNumber']):_0x2e82e1[_0x4250('0x31')]):ut['getCallerId'](_[_0x4250('0x6b')](_0x2e82e1[_0x4250('0x11c')])?_0x2e82e1[_0x4250('0x52')]['callerid']:_0x2e82e1['TrunkBackup'][_0x4250('0x54')],_0x2e82e1[_0x4250('0x127')],_0x2e82e1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4250('0x128')](_0x2e82e1[_0x4250('0x31')],_0x2e82e1[_0x4250('0x129')]):_0x2e82e1[_0x4250('0x31')]);if(_0x1b4145){_0x5507ac[_0x4250('0x12a')]=ut[_0x4250('0x12b')](_0x1b4145);_0x5507ac[_0x4250('0x12c')]=ut[_0x4250('0x12d')](_0x1b4145);}var _0x5ac02f=ut[_0x4250('0x12e')](_0x2e82e1,_0xd83704,_0x355baa,_0x1b4145,_0x16545d,_0x5507ac);_[_0x4250('0x12f')](_0x5507ac,ut[_0x4250('0x130')](_0x5ac02f));_0x5507ac[_0x4250('0x131')]=moment()[_0x4250('0x57')](_0x4250('0x89'));ami['Action'](ut[_0x4250('0x132')](_0x5507ac,_0x2e82e1,_0x5ac02f,_0x5507ac[_0x4250('0xc2')],_0x577485))['then'](function(_0x5d439e){_0x2e82e1[_0x4250('0x4c')]+=0x1;logger[_0x4250('0x5a')]('[originated][increment]',_0x16545d,_0x4250('0xe5'),_0x2e82e1[_0x4250('0x26')],_0x4250('0xf3'),_0x2e82e1['originated']);_0x342087(_0x5d439e);})[_0x4250('0x75')](function(_0x1b78d4){ut['logAgent'](_0x5507ac,0xe,'OriginateError');rpcDb[_0x4250('0xed')](_0x5507ac,_0x4250('0x133'));_0x5896d4(_0x1b78d4);});});};Preview['prototype'][_0x4250('0x1f')]=function(_0x421b7c){if(this[_0x4250('0x13')][_0x421b7c[_0x4250('0xa6')]]){this['actions'][_0x421b7c[_0x4250('0xa6')]][_0x4250('0x74')]=_0x421b7c[_0x4250('0x74')];}};Preview[_0x4250('0xc')][_0x4250('0x17')]=function(_0x42f713){var _0x376651=this;var _0x3a553c=this[_0x4250('0x13')][_0x42f713['actionid']];if(_0x3a553c){if(_0x3a553c['lookAgent']&&this[_0x4250('0x14')][_0x3a553c['lookAgent']]){ut['logLookAgent'](_0x3a553c,this[_0x4250('0x14')][_0x3a553c['lookAgent']][_0x4250('0x26')],this['agents'][_0x3a553c['lookAgent']]['id']);}var _0xf1ec3e=_[_0x4250('0x134')](_0x3a553c);_0xf1ec3e[_0x4250('0xa7')]=moment()['format'](_0x4250('0x89'));var _0x536549=_0x376651[_0x4250('0x10')][_0x3a553c['queue']];if(ut[_0x4250('0x135')](_0x42f713[_0x4250('0x136')])){if(_0x3a553c[_0x4250('0xa5')]){rpcDb[_0x4250('0x10c')](_0x3a553c[_0x4250('0x137')]);}if(_0x3a553c['activeContact']){rpcDb['disableContact'](_0x3a553c[_0x4250('0x137')]);}ami[_0x4250('0x24')](_0x4250('0x138'),ut[_0x4250('0xae')](_0x3a553c,_0x4250('0x139')));this[_0x4250('0xe8')](_0xf1ec3e,_0x536549,_0x42f713);}else{_0x3a553c[_0x4250('0x131')]=moment()['format'](_0x4250('0x89'));ut[_0x4250('0xec')](_0xf1ec3e,0x4,_0x4250('0xb3'));rpcDb[_0x4250('0xed')](_0xf1ec3e,_0x4250('0x13a'));}}};Preview[_0x4250('0xc')]['syncHangup']=function(_0x1de032){var _0xf4b42f=this;var _0xe117b=this[_0x4250('0x13')][_0x1de032[_0x4250('0xa6')]];var _0x29cfe4;if(_0xe117b){_0x29cfe4=this[_0x4250('0x10')][_0xe117b[_0x4250('0x6d')]];logger['info']('[syncHangup][talking]',_0x1de032[_0x4250('0xa6')],'\x20Queue',_0x29cfe4[_0x4250('0x26')],_0x4250('0x6e'),_0x29cfe4[_0x4250('0x2a')]);}if(this[_0x4250('0x13')][_0x1de032[_0x4250('0xa6')]]&&_0x1de032['linkedid']!==_0x1de032[_0x4250('0xa9')]){if(_0x1de032[_0x4250('0x13b')]==='16'&&this[_0x4250('0x13')][_0x1de032['linkedid']][_0x4250('0x6f')]){this['callProgressDetectingCustomer'](_0x1de032,_0x1de032[_0x4250('0xa6')],_0x1de032['cause']);}else if(this[_0x4250('0x13')][_0x1de032[_0x4250('0xa6')]]['dialAnswer']){logger[_0x4250('0x5a')]('[syncHangup][talking][cause]',_0x1de032[_0x4250('0xa6')],_0x1de032['cause'],_0x4250('0xe5'),_0x29cfe4[_0x4250('0x26')],_0x4250('0x6e'),_0x29cfe4[_0x4250('0x2a')]);this[_0x4250('0x13c')](_0x1de032,_0x1de032[_0x4250('0xa6')],_0x1de032[_0x4250('0x13b')]);}}else if(_0xe117b&&_[_0x4250('0x6b')](_0xe117b[_0x4250('0x13d')])&&_0x29cfe4[_0x4250('0x13e')]&&_0x1de032[_0x4250('0xa6')]===_0x1de032[_0x4250('0xa9')]&&_[_0x4250('0x6b')](_0x1de032[_0x4250('0xeb')])&&_0x1de032[_0x4250('0x13b')]==='16'&&_0x1de032[_0x4250('0x13f')]==='6'&&_['isUndefined'](_0xe117b['transfer'])){if(_0xe117b[_0x4250('0xa5')]){rpcDb['unlockContact'](_0xe117b[_0x4250('0x137')]);}if(_0xe117b[_0x4250('0xc2')]){rpcDb[_0x4250('0x88')](_0xe117b[_0x4250('0x137')]);}_0x1de032[_0x4250('0xeb')]='22';this[_0x4250('0xe8')](_0xe117b,_0x29cfe4,_0x1de032);}else if(_0xe117b&&_0xe117b[_0x4250('0x140')]){if(_0x1de032['cause']==='16'&&this[_0x4250('0x13')][_0x1de032['linkedid']][_0x4250('0x6f')]){logger[_0x4250('0x5a')](_0x4250('0x141'),_0x1de032[_0x4250('0xa6')],_0x1de032['cause'],_0x4250('0xe5'),_0x29cfe4[_0x4250('0x26')],_0x4250('0x6e'),_0x29cfe4[_0x4250('0x2a')]);this['callProgressDetectingCustomer'](_0x1de032,_0x1de032[_0x4250('0xa6')],_0x1de032['cause']);}else if(this['actions'][_0x1de032[_0x4250('0xa6')]][_0x4250('0x6f')]){logger[_0x4250('0x5a')](_0x4250('0x142'),_0x1de032[_0x4250('0xa6')],_0x1de032['cause'],_0x4250('0xe5'),_0x29cfe4['name'],'pTalking:\x20',_0x29cfe4['pTalking']);this['callProgressDetectingCustomer'](_0x1de032,_0x1de032[_0x4250('0xa6')],_0x1de032[_0x4250('0x13b')]);}}};Preview[_0x4250('0xc')]['syncDialEnd']=function(_0x43d9a9){if(this[_0x4250('0x13')][_0x43d9a9[_0x4250('0xe7')]]&&_0x43d9a9['destlinkedid']!==_0x43d9a9[_0x4250('0x143')]){this['callProgressDetectingCustomer'](_0x43d9a9,_0x43d9a9[_0x4250('0xe7')],_0x43d9a9[_0x4250('0xe1')]);}};Preview[_0x4250('0xc')][_0x4250('0x1c')]=function(_0x143b00){if(this[_0x4250('0x13')][_0x143b00[_0x4250('0xa6')]]&&_0x143b00['linkedid']!==_0x143b00['uniqueid']&&!this[_0x4250('0x13')][_0x143b00['linkedid']][_0x4250('0x6f')]){if(_0x143b00[_0x4250('0x13b')]==='1'){this[_0x4250('0x13c')](_0x143b00,_0x143b00[_0x4250('0xa6')],_0x143b00[_0x4250('0x13b')]);}}};Preview[_0x4250('0xc')][_0x4250('0x144')]=function(_0x3427fe,_0x45efa7,_0xcc3c9a){if(this[_0x4250('0x13')][_0x3427fe]){if(_[_0x4250('0x6b')](this[_0x4250('0x13')][_0x3427fe][_0x4250('0x145')])){this['actions'][_0x3427fe][_0x4250('0x145')]={};}this[_0x4250('0x13')][_0x3427fe][_0x4250('0x145')][_0x45efa7]=_0xcc3c9a;}};Preview['prototype']['syncVarSet']=function(_0x4b3257){try{if(!_[_0x4250('0x6b')](_0x4b3257)){if(ut[_0x4250('0x146')](_[_0x4250('0x147')](_0x4b3257['variable'])[0x0])){this[_0x4250('0x144')](_0x4b3257[_0x4250('0xa9')],_[_0x4250('0x147')](_0x4b3257['variable'])[0x0],_0x4b3257[_0x4250('0x148')]);}}}catch(_0x27d2c5){logger[_0x4250('0x149')](_0x4250('0x14a'),util[_0x4250('0x14b')](_0x27d2c5,{'showHidden':![],'depth':null}));}};Preview[_0x4250('0xc')][_0x4250('0x14c')]=function(_0x3a5447){if(_0x3a5447){if(this[_0x4250('0x13')][_0x3a5447['transfertargetlinkedid']]){this['actions'][_0x3a5447['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x4250('0xc')][_0x4250('0x14d')]=function(_0xde378a){if(_0xde378a){if(this[_0x4250('0x13')][_0xde378a[_0x4250('0x14e')]]){this['actions'][_0xde378a[_0x4250('0x14e')]][_0x4250('0x140')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xfe71=['Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','isActive','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','trim','substring','SIP/%s/%s%s','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originateFailure][logOriginateFailure]','syncNewExten','actionid','clone','isFailure','response','unlockContact','rejected','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destlinkedid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','stringify','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','clearZombieChannels','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[action]','getContactRecallMe','agentReadyId','agents','then','length','scheduledat','Agent','voicePause','run','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','catch','logger2','[getContactRecallMe]','setMessage','IsNotLoggedIn','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','logger','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]'];(function(_0x19c23a,_0x4f27fe){var _0xa4734=function(_0x3b0bed){while(--_0x3b0bed){_0x19c23a['push'](_0x19c23a['shift']());}};_0xa4734(++_0x4f27fe);}(_0xfe71,0x185));var _0x1fe7=function(_0x42d5b3,_0x318f43){_0x42d5b3=_0x42d5b3-0x0;var _0x16cc10=_0xfe71[_0x42d5b3];return _0x16cc10;};'use strict';var util=require(_0x1fe7('0x0'));var _=require(_0x1fe7('0x1'));var BPromise=require(_0x1fe7('0x2'));var uuid=require(_0x1fe7('0x3'));var moment=require(_0x1fe7('0x4'));var md5=require(_0x1fe7('0x5'));var Redis=require('ioredis');var config=require(_0x1fe7('0x6'));var logger=require(_0x1fe7('0x7'))(_0x1fe7('0x8'));var loggerAction=require(_0x1fe7('0x7'))(_0x1fe7('0x9'));var ami=require(_0x1fe7('0xa'));var rpcDb=require(_0x1fe7('0xb'));var Action=require(_0x1fe7('0xc'));var ut=require(_0x1fe7('0xd'));config[_0x1fe7('0xe')]=_[_0x1fe7('0xf')](config[_0x1fe7('0xe')],{'host':_0x1fe7('0x10'),'port':0x18eb});var io=require(_0x1fe7('0x11'))(new Redis(config[_0x1fe7('0xe')]));var Sequence=function(){};Sequence[_0x1fe7('0x12')][_0x1fe7('0x13')]=function(_0x44bbfd){this[_0x1fe7('0x14')]=this[_0x1fe7('0x14')]?this[_0x1fe7('0x14')][_0x1fe7('0x15')](_0x44bbfd):_0x44bbfd();};function Preview(_0x133889){this[_0x1fe7('0x16')]=new Sequence();this[_0x1fe7('0x17')]=_0x133889[_0x1fe7('0x18')];this[_0x1fe7('0x19')]=_0x133889['trunks'];this[_0x1fe7('0x1a')]={};this['agents']=_0x133889['agents'];this[_0x1fe7('0x1b')]=0x0;ami['on']('originateresponse',this[_0x1fe7('0x1c')][_0x1fe7('0x1d')](this));ami['on'](_0x1fe7('0x1e'),this[_0x1fe7('0x1f')][_0x1fe7('0x1d')](this));ami['on'](_0x1fe7('0x20'),this['syncHangupRequest'][_0x1fe7('0x1d')](this));ami['on'](_0x1fe7('0x21'),this['syncDialEnd'][_0x1fe7('0x1d')](this));ami['on'](_0x1fe7('0x22'),this['syncNewExten'][_0x1fe7('0x1d')](this));ami['on'](_0x1fe7('0x23'),this[_0x1fe7('0x24')][_0x1fe7('0x1d')](this));ami['on'](_0x1fe7('0x25'),this[_0x1fe7('0x26')][_0x1fe7('0x1d')](this));ami['on'](_0x1fe7('0x27'),this[_0x1fe7('0x28')][_0x1fe7('0x1d')](this));this[_0x1fe7('0x29')](this['campaignsPreview']);}function emit(_0x3c62bd,_0x324b50,_0x1a9278){io['to'](_0x3c62bd)[_0x1fe7('0x2a')](_0x324b50,_0x1a9278);}function emitCampaignPreview(_0x3d66cc){if(_0x3d66cc[_0x1fe7('0x2b')]===_0x1fe7('0x2c')){var _0x4da347={'id':_0x3d66cc['id'],'name':_0x3d66cc['name'],'strategy':_0x3d66cc['strategy'],'answered':_0x3d66cc['answered'],'available':_0x3d66cc[_0x1fe7('0x2d')],'loggedIn':_0x3d66cc[_0x1fe7('0x2e')],'pTalking':_0x3d66cc[_0x1fe7('0x2f')],'sumBillable':_0x3d66cc[_0x1fe7('0x30')],'sumDuration':_0x3d66cc[_0x1fe7('0x31')],'sumHoldTime':_0x3d66cc['sumHoldTime']||0x0,'talking':_0x3d66cc[_0x1fe7('0x32')],'total':_0x3d66cc[_0x1fe7('0x33')],'type':_0x3d66cc[_0x1fe7('0x2b')],'unmanaged':_0x3d66cc['unmanaged'],'abandoned':_0x3d66cc[_0x1fe7('0x34')],'waiting':_0x3d66cc[_0x1fe7('0x35')],'loggedInDb':_0x3d66cc[_0x1fe7('0x36')],'dialActive':_0x3d66cc[_0x1fe7('0x37')],'dialMethod':_0x3d66cc[_0x1fe7('0x38')],'dialOriginateCallerIdName':_0x3d66cc['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3d66cc['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3d66cc[_0x1fe7('0x39')],'dialPrefix':_0x3d66cc[_0x1fe7('0x3a')],'outboundAnswerAgiCallsDay':_0x3d66cc[_0x1fe7('0x3b')],'outboundAnswerCallsDay':_0x3d66cc[_0x1fe7('0x3c')],'outboundBlacklistCallsDay':_0x3d66cc['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3d66cc['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3d66cc[_0x1fe7('0x3d')],'outboundDropCallsDayACS':_0x3d66cc[_0x1fe7('0x3e')],'outboundDropCallsDayCallersExit':_0x3d66cc[_0x1fe7('0x3f')],'outboundDropCallsDayTimeout':_0x3d66cc[_0x1fe7('0x40')],'outboundNoAnswerCallsDay':_0x3d66cc[_0x1fe7('0x41')],'outboundNoSuchCallsDay':_0x3d66cc['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3d66cc[_0x1fe7('0x42')],'outboundReCallsDay':_0x3d66cc['outboundReCallsDay'],'outboundRejectCallsDay':_0x3d66cc['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3d66cc[_0x1fe7('0x43')],'outboundAbandonedCallsDay':_0x3d66cc[_0x1fe7('0x44')],'predictiveIntervalAnsweredCalls':_0x3d66cc['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3d66cc[_0x1fe7('0x45')],'predictiveIntervalAvgTalktime':_0x3d66cc[_0x1fe7('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x3d66cc[_0x1fe7('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x3d66cc[_0x1fe7('0x48')],'predictiveIntervalErlangCalls':_0x3d66cc['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3d66cc[_0x1fe7('0x49')],'predictiveIntervalHitRate':_0x3d66cc['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3d66cc[_0x1fe7('0x4a')],'predictiveIntervalPauses':_0x3d66cc[_0x1fe7('0x4b')],'predictiveIntervalAvailable':_0x3d66cc[_0x1fe7('0x4c')],'predictiveIntervalTotalCalls':_0x3d66cc[_0x1fe7('0x4d')],'message':_0x3d66cc['message'],'originated':_0x3d66cc[_0x1fe7('0x4e')],'erlangCalls':_0x3d66cc[_0x1fe7('0x4f')],'erlangCallToSecond':_0x3d66cc[_0x1fe7('0x50')],'erlangAbandonmentRate':_0x3d66cc['erlangAbandonmentRate'],'erlangBusyFactor':_0x3d66cc['erlangBusyFactor'],'startPredictive':_0x3d66cc[_0x1fe7('0x51')],'startProgressive':_0x3d66cc[_0x1fe7('0x52')]};if(_0x3d66cc[_0x1fe7('0x53')]){_0x4da347[_0x1fe7('0x53')]={'id':_0x3d66cc[_0x1fe7('0x53')]['id'],'name':_0x3d66cc[_0x1fe7('0x53')][_0x1fe7('0x54')],'active':_0x3d66cc[_0x1fe7('0x53')][_0x1fe7('0x55')],'callerid':_0x3d66cc['Trunk'][_0x1fe7('0x56')]};}if(_0x3d66cc[_0x1fe7('0x57')]){_0x4da347[_0x1fe7('0x57')]={'id':_0x3d66cc['Interval']['id'],'name':_0x3d66cc[_0x1fe7('0x57')][_0x1fe7('0x54')]};}var _0xdcf6ae=md5(JSON['stringify'](_0x4da347));if(_0x3d66cc['md5']!==_0xdcf6ae){_0x3d66cc[_0x1fe7('0x5')]=_0xdcf6ae;emit(util[_0x1fe7('0x58')](_0x1fe7('0x59'),_0x4da347['name']),_0x1fe7('0x5a'),_0x4da347);}}}function emitVoiceQueueChannelRemove(_0x38cd46){logger[_0x1fe7('0x5b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x1fe7('0x5c')](_0x38cd46));emit(util[_0x1fe7('0x58')](_0x1fe7('0x59'),_0x38cd46[_0x1fe7('0x54')]),_0x1fe7('0x5d'),_0x38cd46);}function notSendMessagesQueue(_0x3bccd1){if(_0x3bccd1[_0x1fe7('0x5e')]){if(_0x3bccd1[_0x1fe7('0x4e')]===0x0&&_0x3bccd1[_0x1fe7('0x2f')]===0x0){_0x3bccd1['sendMessageOneNotActive']=![];_0x3bccd1[_0x1fe7('0x2d')]=0x0;_0x3bccd1[_0x1fe7('0x5f')]=0x0;_0x3bccd1[_0x1fe7('0x60')]=_0x1fe7('0x61');ut['logger'](_0x1fe7('0x62'),_0x3bccd1[_0x1fe7('0x54')]+_0x1fe7('0x63'));}else{_0x3bccd1[_0x1fe7('0x60')]='IS_DISACTIVED';ut['logger'](_0x1fe7('0x62'),_0x3bccd1[_0x1fe7('0x54')]+_0x1fe7('0x64'));}emitCampaignPreview(_0x3bccd1);}}Preview[_0x1fe7('0x12')][_0x1fe7('0x29')]=function(){var _0x1600a2=this;setInterval(function(){_0x1600a2[_0x1fe7('0x65')]();},0x7cf);};Preview[_0x1fe7('0x12')]['syncCampaigns']=function(){var _0xc017b8=this[_0x1fe7('0x17')];this[_0x1fe7('0x1b')]+=0x1;for(var _0x23680e in _0xc017b8){if(_0xc017b8[_0x1fe7('0x66')](_0x23680e)&&(_0xc017b8[_0x23680e]['dialMethod']===_0x1fe7('0x8')||_0xc017b8[_0x23680e][_0x1fe7('0x38')]==='booked')&&_0xc017b8[_0x23680e][_0x1fe7('0x2b')]===_0x1fe7('0x2c')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x1fe7('0x67')]();}}if(_0xc017b8[_0x1fe7('0x66')](_0x23680e)&&_0xc017b8[_0x23680e][_0x1fe7('0x38')]===_0x1fe7('0x8')&&_0xc017b8[_0x23680e][_0x1fe7('0x2b')]==='outbound'){if(_0xc017b8[_0x23680e][_0x1fe7('0x37')]){this['setMessage'](_0xc017b8[_0x23680e]);this[_0x1fe7('0x68')](_0xc017b8[_0x23680e]);}else{notSendMessagesQueue(_0xc017b8[_0x23680e]);}}}};Preview['prototype'][_0x1fe7('0x69')]=function(_0x54af20){var _0xcf4270=this;this['sequence']['enqueue'](function(){if(!_[_0x1fe7('0x6a')](_0xcf4270[_0x1fe7('0x1a')][_0x54af20])){loggerAction[_0x1fe7('0x5b')](_0x1fe7('0x6b'),_0x54af20,_0x1fe7('0x6c'),_0xcf4270[_0x1fe7('0x1a')][_0x54af20]['queue'],_0x1fe7('0x6d'),JSON['stringify'](_0xcf4270[_0x1fe7('0x17')][_0xcf4270[_0x1fe7('0x1a')][_0x54af20][_0x1fe7('0x6e')]]['originated']),_0x1fe7('0x6f'),JSON[_0x1fe7('0x5c')](_0xcf4270[_0x1fe7('0x17')][_0xcf4270[_0x1fe7('0x1a')][_0x54af20][_0x1fe7('0x6e')]]['pTalking']),JSON[_0x1fe7('0x5c')](_0xcf4270['actions'][_0x54af20][_0x1fe7('0x70')]),JSON[_0x1fe7('0x5c')](_[_0x1fe7('0x71')](_0xcf4270[_0x1fe7('0x1a')][_0x54af20],[_0x1fe7('0x72'),'UserId','VoiceQueueId',_0x1fe7('0x73')])));return ami[_0x1fe7('0x74')]({'action':'status','channel':_0xcf4270[_0x1fe7('0x1a')][_0x54af20][_0x1fe7('0x75')]})['catch'](function(_0x4db784){if(_0x4db784['message']===_0x1fe7('0x76')){setTimeout(function(){if(_0xcf4270[_0x1fe7('0x1a')][_0x54af20]){ut[_0x1fe7('0x77')](_0xcf4270[_0x1fe7('0x17')][_0xcf4270[_0x1fe7('0x1a')][_0x54af20][_0x1fe7('0x6e')]],'[clearZombieChannel]');if(_0xcf4270[_0x1fe7('0x1a')][_0x54af20][_0x1fe7('0x70')]===!![]){ut[_0x1fe7('0x78')](_0xcf4270[_0x1fe7('0x17')][_0xcf4270['actions'][_0x54af20][_0x1fe7('0x6e')]],_0x1fe7('0x79'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x54af20,_0xcf4270[_0x1fe7('0x1a')][_0x54af20][_0x1fe7('0x6e')]);}ut[_0x1fe7('0x7a')]('[Dialer][checkChannel][Preview]'+_0x54af20,_0xcf4270['actions'][_0x54af20][_0x1fe7('0x6e')]);delete _0xcf4270[_0x1fe7('0x1a')][_0x54af20];}},0x2328);}});}});};Preview[_0x1fe7('0x12')][_0x1fe7('0x67')]=function(){var _0x3c5e82=this;loggerAction[_0x1fe7('0x5b')](_0x1fe7('0x7b'),_['size'](this[_0x1fe7('0x1a')]));for(var _0x5355eb in this[_0x1fe7('0x1a')]){if(_0x3c5e82[_0x1fe7('0x1a')][_0x1fe7('0x66')](_0x5355eb)){_0x3c5e82[_0x1fe7('0x69')](_0x5355eb);}}};Preview[_0x1fe7('0x12')][_0x1fe7('0x68')]=function(_0x546f89){var _0x8010e9=this;rpcDb[_0x1fe7('0x7c')](_0x546f89['id'],ut[_0x1fe7('0x7d')](this[_0x1fe7('0x7e')]))[_0x1fe7('0x7f')](function(_0x136234){if(!_[_0x1fe7('0x6a')](_0x136234)){for(var _0x1a3f81=0x0;_0x1a3f81<_0x136234[_0x1fe7('0x80')];_0x1a3f81+=0x1){if(ut['getDiff'](_0x136234[_0x1a3f81][_0x1fe7('0x81')])<_0x546f89['dialRecallMeTimeout']*0x3c){if(_0x136234[_0x1a3f81][_0x1fe7('0x82')]&&!_0x136234[_0x1a3f81][_0x1fe7('0x82')][_0x1fe7('0x83')]){_0x8010e9[_0x1fe7('0x84')](_0x136234[_0x1a3f81]['id'])[_0x1fe7('0x7f')](ut['logger2'](_0x1fe7('0x85')))['catch'](ut['logger2'](_0x1fe7('0x85')));}else{rpcDb[_0x1fe7('0x86')](_0x136234[_0x1a3f81]['id']);}}else{var _0x342f03=new Action(_0x136234[_0x1a3f81],_0x546f89);_0x342f03[_0x1fe7('0x87')]=moment()[_0x1fe7('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x546f89[_0x1fe7('0x88')]+=0x1;ut[_0x1fe7('0x89')](_0x342f03,0x17,_0x1fe7('0x8a'));if(_0x546f89[_0x1fe7('0x8b')]){rpcDb['rescheduleContactInQueue'](ut[_0x1fe7('0x8c')](_0x136234[_0x1a3f81]));rpcDb[_0x1fe7('0x8d')](_0x342f03,_0x1fe7('0x8e'));}else{ut[_0x1fe7('0x89')](_0x342f03,0x16,_0x1fe7('0x8f'));rpcDb['createCustomerHistory'](_0x342f03,_0x1fe7('0x90'));rpcDb[_0x1fe7('0x91')](_0x342f03,_0x1fe7('0x90'));}}}}})[_0x1fe7('0x92')](ut[_0x1fe7('0x93')](_0x1fe7('0x94')));};Preview[_0x1fe7('0x12')][_0x1fe7('0x95')]=function(_0x4d8d1c){_0x4d8d1c[_0x1fe7('0x5e')]=!![];if(ut[_0x1fe7('0x96')](_0x4d8d1c[_0x1fe7('0x2e')])){_0x4d8d1c[_0x1fe7('0x60')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x4d8d1c[_0x1fe7('0x37')])){_0x4d8d1c['message']=_0x1fe7('0x61');}else if(!this[_0x1fe7('0x97')](_0x4d8d1c[_0x1fe7('0x53')])){if(!this[_0x1fe7('0x97')](_0x4d8d1c[_0x1fe7('0x98')])){_0x4d8d1c[_0x1fe7('0x60')]=_0x1fe7('0x99');}else{_0x4d8d1c[_0x1fe7('0x60')]=_0x1fe7('0x9a');}}else{_0x4d8d1c[_0x1fe7('0x60')]=_0x1fe7('0x9a');}emitCampaignPreview(_0x4d8d1c);};Preview[_0x1fe7('0x12')][_0x1fe7('0x9b')]=function(_0x30fb2a,_0xb954e6,_0x1f39d6){var _0x2542d5=this;var _0x24984a=this[_0x1fe7('0x1a')][_0xb954e6];var _0x2e86da=this['campaignsPreview'][_0x24984a[_0x1fe7('0x6e')]];var _0x2257ae;if(_0x2e86da){switch(_0x1f39d6){case'1':_0x2e86da[_0x1fe7('0x9c')]+=0x1;_0x24984a[_0x1fe7('0x9d')]+=0x1;_0x24984a['countglobal']=ut['totalGlobal'](_0x24984a);ut[_0x1fe7('0x89')](_0x24984a,0x0,_0x1fe7('0x9e'));ami[_0x1fe7('0x2a')](_0x1fe7('0x9f'),ut['buildObj'](_0x24984a,_0x1fe7('0xa0')));rpcDb[_0x1fe7('0x8d')](_0x24984a,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x1fe7('0xa1')](_0x24984a)>=_0x2e86da[_0x1fe7('0xa2')]){_0x2257ae=ut[_0x1fe7('0xa3')](_0x24984a,0xf,_0x1fe7('0xa4'));rpcDb[_0x1fe7('0x91')](_0x2257ae,_0x1fe7('0xa5'));}else{if(_0x24984a['countnosuchnumberretry']>=_0x2e86da[_0x1fe7('0xa6')]){rpcDb['createCustomerFinal'](_0x24984a,_0x1fe7('0xa5'));}else{rpcDb[_0x1fe7('0xa7')](ut[_0x1fe7('0xa8')](_0x24984a,_0x1fe7('0x9d'),_0x2e86da[_0x1fe7('0xa9')]),_0x24984a[_0x1fe7('0xaa')],_0x24984a['activeContact']);}}delete this[_0x1fe7('0x1a')][_0x30fb2a[_0x1fe7('0xab')]];break;case _0x1fe7('0xac'):var _0xd0d56e=moment()[_0x1fe7('0x58')](_0x1fe7('0xad'));_0x24984a[_0x1fe7('0xae')]=_0xd0d56e;_0x24984a['answertime']=_0xd0d56e;_0x24984a[_0x1fe7('0x70')]=!![];_0x2e86da[_0x1fe7('0x2f')]+=0x1;logger[_0x1fe7('0x5b')]('[syncHangup][talking][increment]',_0x24984a[_0x1fe7('0xaf')],_0x1fe7('0xb0'),_0x2e86da[_0x1fe7('0x54')],_0x1fe7('0x6f'),_0x2e86da[_0x1fe7('0x2f')]);ami[_0x1fe7('0x2a')](_0x1fe7('0xb1'),ut[_0x1fe7('0xb2')](_0x24984a,_0x1fe7('0xb3')));if(_0x2e86da[_0x1fe7('0xb4')]){ami[_0x1fe7('0x2a')](_0x1fe7('0xb5'),ut[_0x1fe7('0xb6')](_0x24984a));}break;case'16':ami[_0x1fe7('0x2a')]('custom:agentcomplete',ut[_0x1fe7('0xb2')](_0x24984a,_0x1fe7('0xb7')));emitVoiceQueueChannelRemove(ut[_0x1fe7('0xb2')](_0x24984a,_0x1fe7('0xb7')));_0x2e86da[_0x1fe7('0x3c')]+=0x1;_0x2e86da['total']+=0x1;_0x2e86da[_0x1fe7('0xb8')]+=0x1;ut[_0x1fe7('0x78')](_0x2e86da,_0x1fe7('0xb9'));_0x24984a[_0x1fe7('0xba')]=ut[_0x1fe7('0xa1')](_0x24984a);ut[_0x1fe7('0x89')](_0x24984a,0x4,_0x1fe7('0xbb'));rpcDb['createCustomerHistory'](_0x24984a,_0x1fe7('0xbc'));rpcDb[_0x1fe7('0x91')](_0x24984a,_0x1fe7('0xbd'));rpcDb[_0x1fe7('0xbe')](_0x24984a);_0x2e86da[_0x1fe7('0x31')]+=_0x24984a[_0x1fe7('0xbf')];_0x2e86da['sumBillable']+=_0x24984a[_0x1fe7('0xbf')];logger[_0x1fe7('0x5b')](_0x1fe7('0xc0'),_0x24984a[_0x1fe7('0xaf')],'\x20Queue',_0x2e86da[_0x1fe7('0x54')],_0x1fe7('0x6f'),_0x2e86da['pTalking']);delete this['actions'][_0x30fb2a[_0x1fe7('0xab')]];break;case _0x1fe7('0xc1'):_0x2e86da[_0x1fe7('0xc2')]+=0x1;_0x24984a[_0x1fe7('0xc3')]+=0x1;_0x24984a[_0x1fe7('0xba')]=ut[_0x1fe7('0xa1')](_0x24984a);ut[_0x1fe7('0x89')](_0x24984a,0x5,_0x1fe7('0xc4'));ami[_0x1fe7('0x2a')](_0x1fe7('0xc5'),ut[_0x1fe7('0xb2')](_0x24984a,_0x1fe7('0xc6')));rpcDb[_0x1fe7('0x8d')](_0x24984a,_0x1fe7('0xc7'));if(ut['totalGlobal'](_0x24984a)>=_0x2e86da[_0x1fe7('0xa2')]){_0x2257ae=ut[_0x1fe7('0xa3')](_0x24984a,0xf,_0x1fe7('0xa4'));rpcDb['createCustomerFinal'](_0x2257ae,_0x1fe7('0xc8'));}else{if(_0x24984a[_0x1fe7('0xc3')]>=_0x2e86da[_0x1fe7('0xc9')]){rpcDb[_0x1fe7('0x91')](_0x24984a,_0x1fe7('0xc7'));}else{rpcDb[_0x1fe7('0xa7')](ut[_0x1fe7('0xa8')](_0x24984a,_0x1fe7('0xc3'),_0x2e86da['dialBusyRetryFrequency']),_0x24984a[_0x1fe7('0xaa')],_0x24984a[_0x1fe7('0xca')]);}}break;case _0x1fe7('0xcb'):_0x2e86da[_0x1fe7('0x41')]+=0x1;_0x24984a[_0x1fe7('0xcc')]+=0x1;_0x24984a['countglobal']=ut[_0x1fe7('0xa1')](_0x24984a);ut[_0x1fe7('0x89')](_0x24984a,0x3,_0x1fe7('0xcd'));ami[_0x1fe7('0x2a')](_0x1fe7('0xce'),ut[_0x1fe7('0xb2')](_0x24984a,_0x1fe7('0xcf')));rpcDb['createCustomerHistory'](_0x24984a,_0x1fe7('0xd0'));if(ut[_0x1fe7('0xa1')](_0x24984a)>=_0x2e86da['dialGlobalMaxRetry']){_0x2257ae=ut[_0x1fe7('0xa3')](_0x24984a,0xf,_0x1fe7('0xa4'));rpcDb['createCustomerFinal'](_0x2257ae,_0x1fe7('0xd1'));}else{if(_0x24984a[_0x1fe7('0xcc')]>=_0x2e86da['dialNoAnswerMaxRetry']){rpcDb[_0x1fe7('0x91')](_0x24984a,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x1fe7('0xa7')](ut[_0x1fe7('0xa8')](_0x24984a,_0x1fe7('0xcc'),_0x2e86da['dialNoAnswerRetryFrequency']),_0x24984a[_0x1fe7('0xaa')],_0x24984a['activeContact']);}}break;case _0x1fe7('0xd2'):_0x2e86da[_0x1fe7('0x3d')]+=0x1;_0x24984a[_0x1fe7('0xd3')]+=0x1;_0x24984a['countglobal']=ut[_0x1fe7('0xa1')](_0x24984a);ut[_0x1fe7('0x89')](_0x24984a,0x8,'Congestion');ami[_0x1fe7('0x2a')]('custom:agentcongestion',ut[_0x1fe7('0xb2')](_0x24984a,_0x1fe7('0xd4')));rpcDb[_0x1fe7('0x8d')](_0x24984a,_0x1fe7('0xd5'));if(ut[_0x1fe7('0xa1')](_0x24984a)>=_0x2e86da[_0x1fe7('0xa2')]){_0x2257ae=ut[_0x1fe7('0xa3')](_0x24984a,0xf,_0x1fe7('0xa4'));rpcDb[_0x1fe7('0x91')](_0x2257ae,_0x1fe7('0xd6'));}else{if(_0x24984a['countcongestionretry']>=_0x2e86da['dialCongestionMaxRetry']){rpcDb[_0x1fe7('0x91')](_0x24984a,_0x1fe7('0xd5'));}else{rpcDb[_0x1fe7('0xa7')](ut[_0x1fe7('0xa8')](_0x24984a,_0x1fe7('0xd3'),_0x2e86da[_0x1fe7('0xd7')]),_0x24984a[_0x1fe7('0xaa')],_0x24984a[_0x1fe7('0xca')]);}}break;case'CANCEL':_0x2e86da[_0x1fe7('0xd8')]+=0x1;_0x24984a[_0x1fe7('0xd9')]+=0x1;_0x24984a['countglobal']=ut[_0x1fe7('0xa1')](_0x24984a);ut[_0x1fe7('0x89')](_0x24984a,0x14,_0x1fe7('0xda'));ami['emit'](_0x1fe7('0xdb'),ut[_0x1fe7('0xb2')](_0x24984a,_0x1fe7('0xdc')));rpcDb[_0x1fe7('0x8d')](_0x24984a,_0x1fe7('0xdd'));if(ut[_0x1fe7('0xa1')](_0x24984a)>=_0x2e86da['dialGlobalMaxRetry']){_0x2257ae=ut[_0x1fe7('0xa3')](_0x24984a,0x14,_0x1fe7('0xda'));rpcDb[_0x1fe7('0x91')](_0x2257ae,_0x1fe7('0xde'));}else{if(_0x24984a[_0x1fe7('0xd9')]>=_0x2e86da[_0x1fe7('0xdf')]){rpcDb[_0x1fe7('0x91')](_0x24984a,_0x1fe7('0xde'));}else{rpcDb[_0x1fe7('0xa7')](ut['scheduledAt'](_0x24984a,'countagentrejectretry',_0x2e86da[_0x1fe7('0xe0')]),_0x24984a[_0x1fe7('0xaa')],_0x24984a[_0x1fe7('0xca')]);}}break;case _0x1fe7('0xe1'):_0x2e86da['outboundAbandonedCallsDay']+=0x1;_0x24984a[_0x1fe7('0xe2')]+=0x1;_0x24984a['countglobal']=ut['totalGlobal'](_0x24984a);ut[_0x1fe7('0x89')](_0x24984a,0xb,_0x1fe7('0xe3'));rpcDb[_0x1fe7('0x8d')](_0x24984a,_0x1fe7('0xe4'));if(ut[_0x1fe7('0xa1')](_0x24984a)>=_0x2e86da['dialGlobalMaxRetry']){_0x2257ae=ut[_0x1fe7('0xa3')](_0x24984a,0xf,_0x1fe7('0xa4'));rpcDb[_0x1fe7('0x91')](_0x2257ae,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x24984a['countabandonedetry']>=_0x2e86da[_0x1fe7('0xe5')]){rpcDb[_0x1fe7('0x91')](_0x24984a,_0x1fe7('0xe4'));}else{rpcDb[_0x1fe7('0xa7')](ut[_0x1fe7('0xa8')](_0x24984a,'countabandonedretry',_0x2e86da['dialAbandonedRetryFrequency']),_0x24984a[_0x1fe7('0xaa')],_0x24984a[_0x1fe7('0xca')]);}}break;default:if(_0x24984a['dialAnswer']){ut[_0x1fe7('0x78')](_0x2e86da,_0x1fe7('0xe6'));ut[_0x1fe7('0x7a')](_0x1fe7('0xe7')+_0x2e86da[_0x1fe7('0x54')],_0x30fb2a);}_0x2e86da['outboundUnknownCallsDay']+=0x1;_0x24984a[_0x1fe7('0xba')]=ut[_0x1fe7('0xa1')](_0x24984a);ut[_0x1fe7('0x89')](_0x24984a,0xc,_0x30fb2a['cause-txt']||_0x30fb2a[_0x1fe7('0xe8')]);rpcDb[_0x1fe7('0x8d')](_0x24984a,_0x1fe7('0xe9'));if(ut[_0x1fe7('0xa1')](_0x24984a)>=_0x2e86da['dialGlobalMaxRetry']){_0x2257ae=ut[_0x1fe7('0xa3')](_0x24984a,0xf,_0x1fe7('0xa4'));rpcDb[_0x1fe7('0x91')](_0x2257ae,_0x1fe7('0xea'));}else{rpcDb[_0x1fe7('0x91')](_0x24984a,_0x1fe7('0xea'));}delete this[_0x1fe7('0x1a')][_0x30fb2a[_0x1fe7('0xab')]];}if(!(_0x24984a[_0x1fe7('0x70')]&&_0x1f39d6==='16')){ut['updateOriginated'](_0x2e86da,'[callProgressDetectingCustomer]');logger[_0x1fe7('0x5b')](_0x1fe7('0xeb'),_0x24984a[_0x1fe7('0xaf')],_0x1fe7('0xb0'),_0x2e86da['name'],_0x1fe7('0x6d'),_0x2e86da[_0x1fe7('0x4e')]);}if(_0x1f39d6!==_0x1fe7('0xac')){delete this[_0x1fe7('0x1a')][_0x30fb2a[_0x1fe7('0xab')]];delete this[_0x1fe7('0x1a')][_0x30fb2a['destlinkedid']];}}};Preview[_0x1fe7('0x12')][_0x1fe7('0xec')]=function(_0x2338a1,_0x4b27fd,_0x4364bb){if(_[_0x1fe7('0xed')](_0x4b27fd)&&_0x1fe7('0xee')!==typeof _0x4b27fd){return;}if(_[_0x1fe7('0xed')](_0x4364bb)&&'object'!==typeof _0x4364bb){return;}switch(_0x4364bb[_0x1fe7('0xef')]){case'0':ut[_0x1fe7('0xf0')](_0x2338a1,0x0,_0x1fe7('0x9e'));rpcDb[_0x1fe7('0xf1')](_0x2338a1,_0x1fe7('0xf2'));break;case'3':ut[_0x1fe7('0xf0')](_0x2338a1,0x3,'NoAnswer');rpcDb[_0x1fe7('0xf1')](_0x2338a1,_0x1fe7('0xf3'));break;case'5':ut[_0x1fe7('0xf0')](_0x2338a1,0x5,_0x1fe7('0xc4'));rpcDb[_0x1fe7('0xf1')](_0x2338a1,_0x1fe7('0xf4'));break;case'8':ut[_0x1fe7('0xf0')](_0x2338a1,0x8,_0x1fe7('0xf5'));rpcDb[_0x1fe7('0xf1')](_0x2338a1,_0x1fe7('0xf6'));break;case'22':ut[_0x1fe7('0xf0')](_0x2338a1,0x16,_0x1fe7('0xf7'));rpcDb[_0x1fe7('0xf1')](_0x2338a1,_0x1fe7('0xf8'));break;default:ut[_0x1fe7('0xf0')](_0x2338a1,0xc,_0x4364bb[_0x1fe7('0xef')]);rpcDb[_0x1fe7('0xf1')](_0x2338a1,_0x1fe7('0xf6'));}ut[_0x1fe7('0x77')](_0x4b27fd,_0x1fe7('0xf9'));logger[_0x1fe7('0x5b')]('[originated][decrement][callProgressDetectingAgent]',_0x2338a1[_0x1fe7('0xaf')],'\x20Queue',_0x4b27fd[_0x1fe7('0x54')],_0x1fe7('0x6d'),_0x4b27fd[_0x1fe7('0x4e')]);delete this[_0x1fe7('0x1a')][_0x2338a1[_0x1fe7('0xaf')]];};Preview['prototype'][_0x1fe7('0xfa')]=function(_0x1e7ddf,_0x2cd3a3,_0x539908,_0x1ed2e9,_0x46a17e){var _0x2edb60=this;return new BPromise(function(_0x103cf5,_0x22a533){if(_[_0x1fe7('0x6a')](_0x2cd3a3)||_['isNil'](_0x2cd3a3[_0x1fe7('0xfb')])||_['isNil'](_0x2cd3a3[_0x1fe7('0xfb')][_0x1fe7('0xfc')])||_['isNil'](_0x2cd3a3[_0x1fe7('0xfd')])){_0x22a533(ut[_0x1fe7('0x60')](_0x1fe7('0xfe'),_0x1ed2e9,_0x46a17e));return;}var _0x5c2509=uuid['v4']();var _0x2f0a3c=_0x2edb60['campaignsPreview'][_0x2cd3a3[_0x1fe7('0x6c')][_0x1fe7('0x54')]];var _0x181e94=_0x539908?_0x2edb60['agents'][_0x539908]['id']:undefined;_0x2edb60[_0x1fe7('0x1a')][_0x5c2509]=new Action(_0x2cd3a3,_0x2f0a3c,_0x5c2509,_0x539908,_0x181e94);var _0x2d2486=_0x2edb60[_0x1fe7('0x1a')][_0x5c2509];_0x2d2486[_0x1fe7('0xaa')]=_0x1ed2e9;_0x2d2486[_0x1fe7('0xca')]=_0x46a17e;_0x2d2486[_0x1fe7('0xff')]=_0x539908;if(_['isEmpty'](_0x1e7ddf)){_0x2edb60[_0x1fe7('0x100')](_0x2d2486,_0x2f0a3c,_0x2cd3a3,_0x539908)[_0x1fe7('0x7f')](function(_0x1e0686){logger['info']('[Preview][execCall][success]',_0x1fe7('0x101')+_0x2d2486[_0x1fe7('0x6e')]+_0x1fe7('0x102')+_0x2d2486[_0x1fe7('0x103')],JSON[_0x1fe7('0x5c')](_0x1e0686));ami[_0x1fe7('0x2a')](_0x1fe7('0x104'),ut[_0x1fe7('0xb2')](_0x2d2486,'called'));_0x103cf5(ut[_0x1fe7('0x60')](_0x1fe7('0x105')));})['catch'](function(_0x3d6f61){ut[_0x1fe7('0x106')](_0x1fe7('0x107'),_0x3d6f61);_0x22a533(ut[_0x1fe7('0x60')](_0x1fe7('0x108'),_0x1ed2e9,_0x46a17e));});}else{_0x2f0a3c['outboundBlacklistCallsDay']+=0x1;ut[_0x1fe7('0x109')](_0x2d2486);rpcDb[_0x1fe7('0x10a')](_0x2d2486,_0x1fe7('0x10b'));delete _0x2edb60[_0x1fe7('0x1a')][_0x5c2509];_0x22a533(ut[_0x1fe7('0x60')](_0x1fe7('0x10c'),_0x1ed2e9,_0x46a17e));}});};Preview['prototype'][_0x1fe7('0x97')]=function(_0x13a9e5){return!_['isNil'](_0x13a9e5)&&!_['isNil'](_0x13a9e5[_0x1fe7('0x54')])&&!_[_0x1fe7('0x6a')](_0x13a9e5[_0x1fe7('0x55')])&&_0x13a9e5[_0x1fe7('0x55')]&&!_[_0x1fe7('0x6a')](this[_0x1fe7('0x19')][util[_0x1fe7('0x58')]('SIP/%s',_0x13a9e5[_0x1fe7('0x54')])])&&!_['isNil'](this[_0x1fe7('0x19')][util[_0x1fe7('0x58')](_0x1fe7('0x10d'),_0x13a9e5['name'])][_0x1fe7('0x10e')])&&(this[_0x1fe7('0x19')][util[_0x1fe7('0x58')](_0x1fe7('0x10d'),_0x13a9e5[_0x1fe7('0x54')])][_0x1fe7('0x10e')]==='reachable'||this[_0x1fe7('0x19')][util['format'](_0x1fe7('0x10d'),_0x13a9e5[_0x1fe7('0x54')])]['status']===_0x1fe7('0x10f'));};Preview['prototype']['run']=function(_0x2d28ee,_0x558ac4){var _0x3fe32e=this;return new BPromise(function(_0x235b87,_0x55ca81){_0x3fe32e[_0x1fe7('0x110')](_0x2d28ee,_0x558ac4)[_0x1fe7('0x7f')](function(_0x3bcb8a){_0x235b87(_[_0x1fe7('0x71')](_0x3bcb8a,[_0x1fe7('0x60')]));})['catch'](function(_0x336d52){if(_0x336d52[_0x1fe7('0x111')]){rpcDb['unlockContact'](_0x2d28ee);}if(_0x336d52['active']){rpcDb[_0x1fe7('0x86')](_0x2d28ee);}_0x55ca81(_[_0x1fe7('0x71')](_0x336d52,[_0x1fe7('0x60')]));});});};Preview[_0x1fe7('0x12')][_0x1fe7('0x110')]=function(_0x22dcbc,_0x268292){var _0x295111=this;return new BPromise(function(_0x378431,_0x4d6902){var _0x5f475e,_0xe0bfde;rpcDb[_0x1fe7('0x112')](_0x22dcbc)[_0x1fe7('0x7f')](function(_0x2f9242){if(!_['isNil'](_0x2f9242[0x0])){_0xe0bfde=_0x2f9242[0x0][_0x1fe7('0x113')]?![]:!![];_0x5f475e=_0x2f9242[0x0]['recallme']?!![]:![];_0x5f475e=_0x268292?!![]:_0x5f475e;}var _0x2206d7=_0x295111[_0x1fe7('0x114')](_0x2f9242);if(_0x2206d7[_0x1fe7('0x115')]){rpcDb[_0x1fe7('0x116')](_['pick'](_0x2f9242[0x0],[_0x1fe7('0xfd'),'Contact.phone']))[_0x1fe7('0x7f')](function(_0x31637c){_0x295111['checkInBlack'](_0x31637c,_0x2f9242[0x0],_0x268292,_0xe0bfde,_0x5f475e)[_0x1fe7('0x7f')](function(_0x27bf4d){_0x378431(_0x27bf4d);})['catch'](function(_0x120e35){_0x4d6902(_0x120e35);});})['catch'](function(_0x3f5de4){ut['logger'](_0x1fe7('0x117'),_0x3f5de4);_0x4d6902(ut[_0x1fe7('0x60')](_0x1fe7('0x118'),_0xe0bfde,_0x5f475e));});}else{_0x4d6902(ut['message'](_0x2206d7[_0x1fe7('0x60')],_0xe0bfde,_0x5f475e));}})[_0x1fe7('0x92')](function(_0x2720ea){ut[_0x1fe7('0x106')](_0x1fe7('0x119'),_0x2720ea);_0x4d6902(ut[_0x1fe7('0x60')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x1fe7('0x12')]['validateContact']=function(_0x114e29){if(_[_0x1fe7('0x6a')](_0x114e29)||_[_0x1fe7('0x11a')](_0x114e29)||!_[_0x1fe7('0x6a')](_0x114e29[0x0]['Agent'])&&_[_0x1fe7('0x6a')](_0x114e29[0x0][_0x1fe7('0x82')][_0x1fe7('0x54')])){ut[_0x1fe7('0x106')]('[Preview][validateContact][Empty\x20Contact]',_0x114e29);return{'isValid':![],'message':_0x1fe7('0x11b')};}var _0x1c2223=this['campaignsPreview'][_0x114e29[0x0][_0x1fe7('0x6c')][_0x1fe7('0x54')]];_0x1c2223['message']=_0x1fe7('0x9a');if(_[_0x1fe7('0x6a')](_0x1c2223)){ut[_0x1fe7('0x106')](_0x1fe7('0x11c'),_0x1c2223);return{'isValid':![],'message':_0x1fe7('0x11d')};}if(!this[_0x1fe7('0x97')](_0x1c2223['Trunk'])){ut[_0x1fe7('0x106')](_0x1fe7('0x11e'),'campaign\x20Name:\x20'+_0x1c2223[_0x1fe7('0x54')]+_0x1fe7('0x11f'));if(!this[_0x1fe7('0x97')](_0x1c2223[_0x1fe7('0x98')])){ut[_0x1fe7('0x106')](_0x1fe7('0x11e'),_0x1c2223['name']+_0x1fe7('0x120'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x1fe7('0x121')](_0x1c2223[_0x1fe7('0x37')])){ut[_0x1fe7('0x106')](_0x1fe7('0x122'),_0x1c2223['name']+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1c2223[_0x1fe7('0x54')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x1fe7('0x123')};};Preview['prototype'][_0x1fe7('0x100')]=function(_0x34e35a,_0x1902d3,_0x8d791f,_0x540dec){var _0x1bb3b7=this;return new BPromise(function(_0xab5623,_0x2c1324){var _0x333450=_0x34e35a[_0x1fe7('0xaf')];var _0x4e56f4=_0x1bb3b7[_0x1fe7('0x97')](_0x1902d3[_0x1fe7('0x53')])?util[_0x1fe7('0x58')]('SIP/%s/%s%s',_0x1902d3[_0x1fe7('0x53')][_0x1fe7('0x54')],_[_0x1fe7('0x6a')](_0x1902d3[_0x1fe7('0x3a')])?'':_0x1902d3[_0x1fe7('0x3a')][_0x1fe7('0x124')]()||'',_0x1902d3['dialCutDigit']>0x0?_0x8d791f[_0x1fe7('0xfb')]['phone'][_0x1fe7('0x125')](_0x1902d3['dialCutDigit']):_0x8d791f[_0x1fe7('0xfb')][_0x1fe7('0xfc')]):util[_0x1fe7('0x58')](_0x1fe7('0x126'),_[_0x1fe7('0x6a')](_0x1902d3[_0x1fe7('0x98')])?_0x1902d3[_0x1fe7('0x53')][_0x1fe7('0x54')]:_0x1902d3[_0x1fe7('0x98')]['name'],_[_0x1fe7('0x6a')](_0x1902d3[_0x1fe7('0x3a')])?'':_0x1902d3[_0x1fe7('0x3a')]['trim']()||'',_0x1902d3[_0x1fe7('0x127')]>0x0?_0x8d791f[_0x1fe7('0xfb')][_0x1fe7('0xfc')]['substring'](_0x1902d3[_0x1fe7('0x127')]):_0x8d791f[_0x1fe7('0xfb')][_0x1fe7('0xfc')]);var _0x4d7f42=_0x1bb3b7[_0x1fe7('0x97')](_0x1902d3[_0x1fe7('0x53')])?ut[_0x1fe7('0x128')](_0x1902d3['Trunk'][_0x1fe7('0x56')],_0x1902d3[_0x1fe7('0x129')],_0x1902d3[_0x1fe7('0x12a')]>0x0?ut['getCallerIdRandom'](_0x1902d3[_0x1fe7('0x12b')],_0x1902d3['dialRandomLastDigitCallerIdNumber']):_0x1902d3['dialOriginateCallerIdNumber']):ut[_0x1fe7('0x128')](_[_0x1fe7('0x6a')](_0x1902d3['TrunkBackup'])?_0x1902d3[_0x1fe7('0x53')][_0x1fe7('0x56')]:_0x1902d3[_0x1fe7('0x98')][_0x1fe7('0x56')],_0x1902d3['dialOriginateCallerIdName'],_0x1902d3['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x1fe7('0x12c')](_0x1902d3['dialOriginateCallerIdNumber'],_0x1902d3[_0x1fe7('0x12a')]):_0x1902d3['dialOriginateCallerIdNumber']);if(_0x4d7f42){_0x34e35a['originatecalleridname']=ut[_0x1fe7('0x12d')](_0x4d7f42);_0x34e35a[_0x1fe7('0x12e')]=ut[_0x1fe7('0x12f')](_0x4d7f42);}var _0xa9228c=ut[_0x1fe7('0x130')](_0x1902d3,_0x8d791f,_0x4e56f4,_0x4d7f42,_0x333450,_0x34e35a);_[_0x1fe7('0x131')](_0x34e35a,ut[_0x1fe7('0x132')](_0xa9228c));_0x34e35a['starttime']=moment()[_0x1fe7('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x1fe7('0x74')](ut[_0x1fe7('0x133')](_0x34e35a,_0x1902d3,_0xa9228c,_0x34e35a['activeContact'],_0x540dec))[_0x1fe7('0x7f')](function(_0x49d1ca){_0x1902d3[_0x1fe7('0x4e')]+=0x1;logger[_0x1fe7('0x5b')]('[originated][increment]',_0x333450,_0x1fe7('0xb0'),_0x1902d3[_0x1fe7('0x54')],'originated:\x20',_0x1902d3[_0x1fe7('0x4e')]);_0xab5623(_0x49d1ca);})['catch'](function(_0x56b0ab){ut[_0x1fe7('0xf0')](_0x34e35a,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x34e35a,_0x1fe7('0x134'));_0x2c1324(_0x56b0ab);});});};Preview[_0x1fe7('0x12')][_0x1fe7('0x135')]=function(_0xa8cb37){if(this[_0x1fe7('0x1a')][_0xa8cb37[_0x1fe7('0xab')]]){this[_0x1fe7('0x1a')][_0xa8cb37['linkedid']]['channel']=_0xa8cb37[_0x1fe7('0x75')];}};Preview['prototype']['syncOriginateResponse']=function(_0x4a8f48){var _0x1603d1=this;var _0x6c8441=this[_0x1fe7('0x1a')][_0x4a8f48[_0x1fe7('0x136')]];if(_0x6c8441){if(_0x6c8441[_0x1fe7('0xff')]&&this[_0x1fe7('0x7e')][_0x6c8441[_0x1fe7('0xff')]]){ut['logLookAgent'](_0x6c8441,this[_0x1fe7('0x7e')][_0x6c8441['lookAgent']][_0x1fe7('0x54')],this[_0x1fe7('0x7e')][_0x6c8441[_0x1fe7('0xff')]]['id']);}var _0x26aa15=_[_0x1fe7('0x137')](_0x6c8441);_0x26aa15[_0x1fe7('0xae')]=moment()['format'](_0x1fe7('0xad'));var _0x539490=_0x1603d1[_0x1fe7('0x17')][_0x6c8441[_0x1fe7('0x6e')]];if(ut[_0x1fe7('0x138')](_0x4a8f48[_0x1fe7('0x139')])){if(_0x6c8441[_0x1fe7('0xaa')]){rpcDb[_0x1fe7('0x13a')](_0x6c8441['idContact']);}if(_0x6c8441[_0x1fe7('0xca')]){rpcDb[_0x1fe7('0x86')](_0x6c8441[_0x1fe7('0x103')]);}ami[_0x1fe7('0x2a')]('custom:agentringnoanswer',ut[_0x1fe7('0xb2')](_0x6c8441,_0x1fe7('0x13b')));this[_0x1fe7('0xec')](_0x26aa15,_0x539490,_0x4a8f48);}else{_0x6c8441[_0x1fe7('0x87')]=moment()[_0x1fe7('0x58')](_0x1fe7('0xad'));ut[_0x1fe7('0xf0')](_0x26aa15,0x4,_0x1fe7('0xbb'));rpcDb[_0x1fe7('0xf1')](_0x26aa15,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x1fe7('0x12')][_0x1fe7('0x1f')]=function(_0x248a25){var _0x2253f1=this;var _0x3347e4=this[_0x1fe7('0x1a')][_0x248a25[_0x1fe7('0xab')]];var _0x1a9796;if(_0x3347e4){_0x1a9796=this['campaignsPreview'][_0x3347e4['queue']];logger[_0x1fe7('0x5b')](_0x1fe7('0x13c'),_0x248a25[_0x1fe7('0xab')],_0x1fe7('0xb0'),_0x1a9796[_0x1fe7('0x54')],_0x1fe7('0x6f'),_0x1a9796[_0x1fe7('0x2f')]);}if(this['actions'][_0x248a25[_0x1fe7('0xab')]]&&_0x248a25[_0x1fe7('0xab')]!==_0x248a25[_0x1fe7('0xaf')]){if(_0x248a25[_0x1fe7('0x13d')]==='16'&&this[_0x1fe7('0x1a')][_0x248a25['linkedid']]['dialAnswer']){this[_0x1fe7('0x9b')](_0x248a25,_0x248a25[_0x1fe7('0xab')],_0x248a25[_0x1fe7('0x13d')]);}else if(this[_0x1fe7('0x1a')][_0x248a25[_0x1fe7('0xab')]][_0x1fe7('0x70')]){logger[_0x1fe7('0x5b')]('[syncHangup][talking][cause]',_0x248a25[_0x1fe7('0xab')],_0x248a25['cause'],'\x20Queue',_0x1a9796[_0x1fe7('0x54')],'pTalking:\x20',_0x1a9796['pTalking']);this[_0x1fe7('0x9b')](_0x248a25,_0x248a25[_0x1fe7('0xab')],_0x248a25['cause']);}}else if(_0x3347e4&&_['isNil'](_0x3347e4[_0x1fe7('0x13e')])&&_0x1a9796[_0x1fe7('0x13f')]&&_0x248a25[_0x1fe7('0xab')]===_0x248a25['uniqueid']&&_[_0x1fe7('0x6a')](_0x248a25[_0x1fe7('0xef')])&&_0x248a25[_0x1fe7('0x13d')]==='16'&&_0x248a25['channelstate']==='6'&&_['isUndefined'](_0x3347e4['transfer'])){if(_0x3347e4[_0x1fe7('0xaa')]){rpcDb[_0x1fe7('0x13a')](_0x3347e4[_0x1fe7('0x103')]);}if(_0x3347e4[_0x1fe7('0xca')]){rpcDb[_0x1fe7('0x86')](_0x3347e4[_0x1fe7('0x103')]);}_0x248a25[_0x1fe7('0xef')]='22';this[_0x1fe7('0xec')](_0x3347e4,_0x1a9796,_0x248a25);}else if(_0x3347e4&&_0x3347e4[_0x1fe7('0x140')]){if(_0x248a25[_0x1fe7('0x13d')]==='16'&&this['actions'][_0x248a25[_0x1fe7('0xab')]]['dialAnswer']){logger[_0x1fe7('0x5b')](_0x1fe7('0x141'),_0x248a25[_0x1fe7('0xab')],_0x248a25[_0x1fe7('0x13d')],_0x1fe7('0xb0'),_0x1a9796[_0x1fe7('0x54')],_0x1fe7('0x6f'),_0x1a9796[_0x1fe7('0x2f')]);this[_0x1fe7('0x9b')](_0x248a25,_0x248a25['linkedid'],_0x248a25[_0x1fe7('0x13d')]);}else if(this[_0x1fe7('0x1a')][_0x248a25['linkedid']][_0x1fe7('0x70')]){logger['info'](_0x1fe7('0x142'),_0x248a25[_0x1fe7('0xab')],_0x248a25[_0x1fe7('0x13d')],'\x20Queue',_0x1a9796[_0x1fe7('0x54')],_0x1fe7('0x6f'),_0x1a9796['pTalking']);this[_0x1fe7('0x9b')](_0x248a25,_0x248a25[_0x1fe7('0xab')],_0x248a25[_0x1fe7('0x13d')]);}}};Preview['prototype'][_0x1fe7('0x143')]=function(_0x2f9023){if(this[_0x1fe7('0x1a')][_0x2f9023['destlinkedid']]&&_0x2f9023[_0x1fe7('0x144')]!==_0x2f9023['destuniqueid']){this['callProgressDetectingCustomer'](_0x2f9023,_0x2f9023['destlinkedid'],_0x2f9023['dialstatus']);}};Preview['prototype'][_0x1fe7('0x145')]=function(_0x2921b5){if(this[_0x1fe7('0x1a')][_0x2921b5['linkedid']]&&_0x2921b5[_0x1fe7('0xab')]!==_0x2921b5['uniqueid']&&!this['actions'][_0x2921b5[_0x1fe7('0xab')]][_0x1fe7('0x70')]){if(_0x2921b5[_0x1fe7('0x13d')]==='1'){this['callProgressDetectingCustomer'](_0x2921b5,_0x2921b5[_0x1fe7('0xab')],_0x2921b5[_0x1fe7('0x13d')]);}}};Preview[_0x1fe7('0x12')][_0x1fe7('0x146')]=function(_0x3e56f2,_0x5d3e6a,_0x184765){if(this['actions'][_0x3e56f2]){if(_[_0x1fe7('0x6a')](this[_0x1fe7('0x1a')][_0x3e56f2][_0x1fe7('0x147')])){this[_0x1fe7('0x1a')][_0x3e56f2][_0x1fe7('0x147')]={};}this[_0x1fe7('0x1a')][_0x3e56f2][_0x1fe7('0x147')][_0x5d3e6a]=_0x184765;}};Preview[_0x1fe7('0x12')][_0x1fe7('0x24')]=function(_0x29f0be){try{if(!_['isNil'](_0x29f0be)){if(ut[_0x1fe7('0x148')](_[_0x1fe7('0x149')](_0x29f0be[_0x1fe7('0x14a')])[0x0])){this[_0x1fe7('0x146')](_0x29f0be[_0x1fe7('0xaf')],_['keys'](_0x29f0be[_0x1fe7('0x14a')])[0x0],_0x29f0be[_0x1fe7('0x14b')]);}}}catch(_0x5c3e5e){logger[_0x1fe7('0x14c')](_0x1fe7('0x14d'),util[_0x1fe7('0x14e')](_0x5c3e5e,{'showHidden':![],'depth':null}));}};Preview[_0x1fe7('0x12')]['syncAttendedTransfer']=function(_0x55ce42){if(_0x55ce42){if(this[_0x1fe7('0x1a')][_0x55ce42[_0x1fe7('0x14f')]]){this[_0x1fe7('0x1a')][_0x55ce42[_0x1fe7('0x14f')]]['transfer']=!![];}}};Preview[_0x1fe7('0x12')][_0x1fe7('0x28')]=function(_0x106058){if(_0x106058){if(this['actions'][_0x106058[_0x1fe7('0x150')]]){this[_0x1fe7('0x1a')][_0x106058[_0x1fe7('0x150')]]['transfer']=!![];}}};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 6b77ea5..e85613f 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 _0x277c=['endtime','connectedlinename','membername','from-sip','exten','holdtime','lastAssignedTo','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','error','resolve','createHistory','catch','[createHistory]\x20','then','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt'];(function(_0x176e12,_0x180e8a){var _0x4bef6d=function(_0x1e895a){while(--_0x1e895a){_0x176e12['push'](_0x176e12['shift']());}};_0x4bef6d(++_0x180e8a);}(_0x277c,0x153));var _0xc277=function(_0x3bf7b3,_0x305a6f){_0x3bf7b3=_0x3bf7b3-0x0;var _0x15157d=_0x277c[_0x3bf7b3];return _0x15157d;};'use strict';var util=require(_0xc277('0x0'));var BPromise=require('bluebird');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var _=require(_0xc277('0x3'));var cmHopper=require(_0xc277('0x4'));var cmHopperFinal=require(_0xc277('0x5'));var cmHopperHistory=require(_0xc277('0x6'));var cmHopperBlack=require(_0xc277('0x7'));var voiceQueueRt=require(_0xc277('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1a6582){return function(_0x5a4f03){logger[_0xc277('0x9')](_0x1a6582,util['inspect'](_0x5a4f03,{'showHidden':![],'depth':null}));};}function create(_0x378158){return BPromise[_0xc277('0xa')]()['then'](cmHopperHistory[_0xc277('0xb')](_0x378158))[_0xc277('0xc')](loggerCatch(_0xc277('0xd')));}function createAgent(_0x1b1db0){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](agentReportPreview['createHistory'](_0x1b1db0))['catch'](loggerCatch(_0xc277('0xd')));}function moveContact(_0x1632bb){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper['moveContactManagedDialer'](_0x1632bb,!![]))[_0xc277('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xc277('0xf')]=function(_0x2bba87){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopperBlack['checkIsBlackList'](_0x2bba87))[_0xc277('0xc')](loggerCatch(_0xc277('0x10')));};exports[_0xc277('0x11')]=function(_0x4de960){return BPromise['resolve']()[_0xc277('0xe')](cmHopper['getContactPreview'](_0x4de960))[_0xc277('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0xc277('0xb')]=function(_0x1162b9,_0x15f560){create(_0x1162b9)['catch'](loggerCatch(_0x15f560));moveContact(_0x1162b9)['catch'](loggerCatch(_0x15f560));};exports[_0xc277('0x12')]=function(_0x4d23a7,_0x4d8351){createAgent(_0x4d23a7)[_0xc277('0xc')](loggerCatch(_0x4d8351));};exports[_0xc277('0x13')]=function(_0x3b247e,_0x176dfb){create(_0x3b247e)[_0xc277('0xc')](loggerCatch(_0x176dfb));};exports[_0xc277('0x14')]=function(_0x391cc3,_0x4a7a79){moveContact(_0x391cc3)['catch'](loggerCatch(_0x4a7a79));};exports[_0xc277('0x15')]=function(_0x28900e,_0x2bdc25,_0x28b7b1){if(_0x2bdc25){_0x28900e[_0xc277('0x16')]=null;}if(_0x28b7b1){_0x28900e[_0xc277('0x17')]=![];}return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper[_0xc277('0x15')](_0x28900e))[_0xc277('0xc')](loggerCatch(_0xc277('0x18')));};exports['countReScheduled']=function(_0x2b9936){return BPromise[_0xc277('0xa')]()['then'](cmHopper[_0xc277('0x19')](_0x2b9936))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xc277('0x1a')]=function(_0x57b03){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper[_0xc277('0x1a')]({'UserId':null},_0x57b03,0x1))[_0xc277('0xc')](loggerCatch(_0xc277('0x1b')));};exports[_0xc277('0x1c')]=function(_0xf903ea){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper['unlockContact']({'active':![]},_0xf903ea,0x1))['catch'](loggerCatch(_0xc277('0x1d')));};exports[_0xc277('0x1e')]=function(_0x4ebb0f){var _0x4efc1e={};_0x4efc1e[_0xc277('0x1f')]=_0x4ebb0f[_0xc277('0x1f')];_0x4efc1e[_0xc277('0x20')]=_0x4ebb0f[_0xc277('0x20')];_0x4efc1e[_0xc277('0x21')]=_0x4ebb0f['calleridnum'];_0x4efc1e[_0xc277('0x22')]=_0x4ebb0f['calleridname'];_0x4efc1e[_0xc277('0x23')]=_0x4ebb0f[_0xc277('0x23')];_0x4efc1e[_0xc277('0x24')]=_0x4ebb0f[_0xc277('0x25')];_0x4efc1e['queuecallerleaveAt']=_0x4ebb0f[_0xc277('0x25')];_0x4efc1e['queuecallercomplete']=0x1;_0x4efc1e[_0xc277('0x26')]=_0x4ebb0f[_0xc277('0x27')];_0x4efc1e[_0xc277('0x28')]=_0x4ebb0f[_0xc277('0x29')];_0x4efc1e['context']=_0xc277('0x2a');_0x4efc1e[_0xc277('0x2b')]='xcally-motion-preview';_0x4efc1e[_0xc277('0x2c')]=0x0;_0x4efc1e['assigned']=0x1;_0x4efc1e[_0xc277('0x2d')]=_0x4ebb0f[_0xc277('0x29')];_0x4efc1e[_0xc277('0x2e')]=_0xc277('0x2f');return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](voiceQueueReport[_0xc277('0x30')](_0x4efc1e))[_0xc277('0xc')](loggerCatch(_0xc277('0x31')));};exports[_0xc277('0x32')]=function(_0xdc94a1,_0x5b2329){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper[_0xc277('0x32')](_0xdc94a1,_0x5b2329))['catch'](loggerCatch(_0xc277('0x33')));};exports[_0xc277('0x34')]=function(_0x18986b){return BPromise[_0xc277('0xa')]()[_0xc277('0xe')](cmHopper['rescheduleContact'](_0x18986b,!![],!![]))['catch'](loggerCatch(_0xc277('0x35')));}; \ No newline at end of file +var _0x56e7=['xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0x56e7,0x7b));var _0x756e=function(_0x465ef6,_0x8adf2a){_0x465ef6=_0x465ef6-0x0;var _0x5cf599=_0x56e7[_0x465ef6];return _0x5cf599;};'use strict';var util=require('util');var BPromise=require(_0x756e('0x0'));var logger=require(_0x756e('0x1'))('preview');var _=require(_0x756e('0x2'));var cmHopper=require(_0x756e('0x3'));var cmHopperFinal=require(_0x756e('0x4'));var cmHopperHistory=require(_0x756e('0x5'));var cmHopperBlack=require(_0x756e('0x6'));var voiceQueueRt=require(_0x756e('0x7'));var agentReportPreview=require(_0x756e('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3b3b8f){return function(_0x404189){logger[_0x756e('0x9')](_0x3b3b8f,util[_0x756e('0xa')](_0x404189,{'showHidden':![],'depth':null}));};}function create(_0x5c8589){return BPromise[_0x756e('0xb')]()['then'](cmHopperHistory[_0x756e('0xc')](_0x5c8589))[_0x756e('0xd')](loggerCatch(_0x756e('0xe')));}function createAgent(_0x4738dc){return BPromise['resolve']()['then'](agentReportPreview[_0x756e('0xc')](_0x4738dc))[_0x756e('0xd')](loggerCatch(_0x756e('0xe')));}function moveContact(_0x4c4d7c){return BPromise[_0x756e('0xb')]()[_0x756e('0xf')](cmHopper['moveContactManagedDialer'](_0x4c4d7c,!![]))['catch'](loggerCatch(_0x756e('0x10')));}exports['checkIsBlackList']=function(_0x459237){return BPromise[_0x756e('0xb')]()[_0x756e('0xf')](cmHopperBlack[_0x756e('0x11')](_0x459237))[_0x756e('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x36de2a){return BPromise[_0x756e('0xb')]()[_0x756e('0xf')](cmHopper['getContactPreview'](_0x36de2a))['catch'](loggerCatch(_0x756e('0x12')));};exports[_0x756e('0xc')]=function(_0x1cf73d,_0x296b14){create(_0x1cf73d)[_0x756e('0xd')](loggerCatch(_0x296b14));moveContact(_0x1cf73d)[_0x756e('0xd')](loggerCatch(_0x296b14));};exports[_0x756e('0x13')]=function(_0x1a8614,_0xb17214){createAgent(_0x1a8614)['catch'](loggerCatch(_0xb17214));};exports[_0x756e('0x14')]=function(_0x47c3c4,_0x4d7581){create(_0x47c3c4)[_0x756e('0xd')](loggerCatch(_0x4d7581));};exports[_0x756e('0x15')]=function(_0x30bc11,_0xe26ae){moveContact(_0x30bc11)[_0x756e('0xd')](loggerCatch(_0xe26ae));};exports[_0x756e('0x16')]=function(_0xb00195,_0x27e1eb,_0x88787d){if(_0x27e1eb){_0xb00195[_0x756e('0x17')]=null;}if(_0x88787d){_0xb00195[_0x756e('0x18')]=![];}return BPromise[_0x756e('0xb')]()[_0x756e('0xf')](cmHopper[_0x756e('0x16')](_0xb00195))[_0x756e('0xd')](loggerCatch(_0x756e('0x19')));};exports['countReScheduled']=function(_0x335523){return BPromise['resolve']()[_0x756e('0xf')](cmHopper[_0x756e('0x1a')](_0x335523))[_0x756e('0xd')](loggerCatch(_0x756e('0x1b')));};exports['unlockContact']=function(_0x3ef5ef){return BPromise[_0x756e('0xb')]()[_0x756e('0xf')](cmHopper['unlockContact']({'UserId':null},_0x3ef5ef,0x1))[_0x756e('0xd')](loggerCatch(_0x756e('0x1c')));};exports[_0x756e('0x1d')]=function(_0x555912){return BPromise[_0x756e('0xb')]()[_0x756e('0xf')](cmHopper['unlockContact']({'active':![]},_0x555912,0x1))[_0x756e('0xd')](loggerCatch(_0x756e('0x1e')));};exports[_0x756e('0x1f')]=function(_0x5a1cf0){var _0x3c332e={};_0x3c332e[_0x756e('0x20')]=_0x5a1cf0['type'];_0x3c332e[_0x756e('0x21')]=_0x5a1cf0[_0x756e('0x21')];_0x3c332e['calleridnum']=_0x5a1cf0[_0x756e('0x22')];_0x3c332e[_0x756e('0x23')]=_0x5a1cf0[_0x756e('0x23')];_0x3c332e[_0x756e('0x24')]=_0x5a1cf0[_0x756e('0x24')];_0x3c332e['queuecallerjoinAt']=_0x5a1cf0[_0x756e('0x25')];_0x3c332e['queuecallerleaveAt']=_0x5a1cf0['answertime'];_0x3c332e[_0x756e('0x26')]=0x1;_0x3c332e['queuecallercompleteAt']=_0x5a1cf0[_0x756e('0x27')];_0x3c332e[_0x756e('0x28')]=_0x5a1cf0[_0x756e('0x29')];_0x3c332e[_0x756e('0x2a')]=_0x756e('0x2b');_0x3c332e[_0x756e('0x2c')]=_0x756e('0x2d');_0x3c332e[_0x756e('0x2e')]=0x0;_0x3c332e[_0x756e('0x2f')]=0x1;_0x3c332e[_0x756e('0x30')]=_0x5a1cf0[_0x756e('0x29')];_0x3c332e[_0x756e('0x31')]='COMPLETED';return BPromise['resolve']()[_0x756e('0xf')](voiceQueueReport[_0x756e('0x32')](_0x3c332e))[_0x756e('0xd')](loggerCatch(_0x756e('0x33')));};exports[_0x756e('0x34')]=function(_0x31a507,_0x1e977a){return BPromise['resolve']()['then'](cmHopper['getContactRecallMe'](_0x31a507,_0x1e977a))[_0x756e('0xd')](loggerCatch(_0x756e('0x35')));};exports[_0x756e('0x36')]=function(_0x4fadda){return BPromise[_0x756e('0xb')]()[_0x756e('0xf')](cmHopper['rescheduleContact'](_0x4fadda,!![],!![]))[_0x756e('0xd')](loggerCatch(_0x756e('0x37')));}; \ 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 73477d8..50d0666 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 _0xc5b3=['YYYY-MM-DD\x20HH:mm:ss','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledat','minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','interface','queue','agentReadyId','status','reachable','push','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent'];(function(_0xe909a7,_0x4e7e69){var _0x54bf8b=function(_0x11ea16){while(--_0x11ea16){_0xe909a7['push'](_0xe909a7['shift']());}};_0x54bf8b(++_0x4e7e69);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xc5b3[_0xd0cd0b];return _0x59cced;};'use strict';var util=require(_0x3c5b('0x0'));var _=require(_0x3c5b('0x1'));var moment=require(_0x3c5b('0x2'));var logger=require(_0x3c5b('0x3'))(_0x3c5b('0x4'));var ipAgi=process[_0x3c5b('0x5')][_0x3c5b('0x6')]||_0x3c5b('0x7');function getSeconds(_0x5c99ff,_0x3cd21d){var _0x721a26=moment(_0x5c99ff)['milliseconds'](0x0);var _0x320aa2=moment(_0x3cd21d)['milliseconds'](0x0);return _0x721a26[_0x3c5b('0x8')](_0x320aa2,_0x3c5b('0x9'));}exports[_0x3c5b('0xa')]=function(_0xae86a0){return function(_0x32586d){logger[_0x3c5b('0xb')](_0xae86a0,util[_0x3c5b('0xc')](_0x32586d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x115ec1,_0x110772){logger[_0x3c5b('0xd')](_0x115ec1,util[_0x3c5b('0xc')](_0x110772,{'showHidden':![],'depth':null}));};exports[_0x3c5b('0xe')]=function(_0x575f2d,_0x127c2e){logger[_0x3c5b('0xb')](_0x575f2d,util[_0x3c5b('0xc')](_0x127c2e,{'showHidden':![],'depth':null}));};exports[_0x3c5b('0xf')]=function(_0x4454b0){return function(_0xf5a6a8){logger[_0x3c5b('0xd')](_0x4454b0,util['inspect'](_0xf5a6a8,{'showHidden':![],'depth':null}));};};exports[_0x3c5b('0x10')]=function(_0x4769e3,_0x1890d7,_0x287716){return{'message':_0x4769e3,'unlock':_0x1890d7,'active':_0x287716};};exports['getCallerId']=function(_0x6449c3,_0x5e5fbb,_0x12330d){if(!_[_0x3c5b('0x11')](_0x12330d)&&'string'===typeof _0x12330d&&!_[_0x3c5b('0x12')](_0x12330d)){if(!_[_0x3c5b('0x11')](_0x5e5fbb)&&'string'===typeof _0x5e5fbb&&!_[_0x3c5b('0x12')](_0x5e5fbb)){return util[_0x3c5b('0x13')](_0x3c5b('0x14'),_0x5e5fbb,_0x12330d);}return util['format'](_0x3c5b('0x14'),_0x12330d,_0x12330d);}if(!_['isUndefined'](_0x6449c3)&&_0x3c5b('0x15')===typeof _0x6449c3&&!_[_0x3c5b('0x12')](_0x6449c3)){return _0x6449c3;}return _0x3c5b('0x16');};exports[_0x3c5b('0x17')]=function(_0x37dfb0){if(_[_0x3c5b('0x18')](_0x37dfb0)){return![];}return _0x37dfb0;};exports['addVariables']=function(_0x4a76d5,_0xa074cc,_0x497947,_0x7b1e1,_0x1e1c0b,_0x135666){var _0x4cb3d3={'XMD-QUEUE':_0xa074cc[_0x3c5b('0x19')]?_0xa074cc['Queue'][_0x3c5b('0x1a')]:'','XMD-CALLERID':_0x7b1e1,'XMD-CALLERID-PREVIEW':_0x135666?util[_0x3c5b('0x13')](_0x3c5b('0x14'),_0x135666[_0x3c5b('0x1b')],_0x135666[_0x3c5b('0x1c')]):_0x7b1e1,'XMD-DIALID':_0x1e1c0b,'XMD-CONTACTID':_0xa074cc[_0x3c5b('0x1d')],'XMD-CDRTYPE':_0x3c5b('0x1e'),'CALLERID(all)':_0x7b1e1,'XMD-VOICEQUEUEID':_0xa074cc[_0x3c5b('0x1f')],'XMD-DIALCHANNEL':_0x497947,'XMD-DIALTIMEOUT':_0x4a76d5['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x3c5b('0x13')](_0x3c5b('0x20'),_0x4a76d5[_0x3c5b('0x21')]?'g':'',_['isEmpty'](_0x4a76d5[_0x3c5b('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4a76d5['dialPreviewUrl']||'','XMD-AGI':_0x4a76d5['dialQueueProject']?util['format'](_0x3c5b('0x23'),ipAgi,_0x4a76d5[_0x3c5b('0x24')]):_0x3c5b('0x25'),'XMD-AGIAFTER':_0x4a76d5['dialQueueProject2']?util[_0x3c5b('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4a76d5[_0x3c5b('0x21')]):_0x3c5b('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x135666?_0x135666[_0x3c5b('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x135666?_0x135666[_0x3c5b('0x27')]:'','XMD-DESTINATION':_0x3c5b('0x28')};if(!_[_0x3c5b('0x12')](_0x4a76d5[_0x3c5b('0x22')])){_0x4cb3d3[util[_0x3c5b('0x13')]('%s',_0x3c5b('0x29'))]=_0x4a76d5['monitor_format'];_0x4cb3d3[util[_0x3c5b('0x13')]('%s',_0x3c5b('0x2a'))]=_0x1e1c0b;}if(_0xa074cc&&_0xa074cc[_0x3c5b('0x2b')]){for(var _0x410ebf in _0xa074cc[_0x3c5b('0x2b')]){if(_0xa074cc[_0x3c5b('0x2b')][_0x3c5b('0x2c')](_0x410ebf)){if(!_[_0x3c5b('0x18')](_0xa074cc['Contact'][_0x410ebf])&&_0x410ebf!=='id'&&_0x410ebf!=='tags'&&_0x410ebf!==_0x3c5b('0x2d')&&_0x410ebf!==_0x3c5b('0x2e')){_0x4cb3d3[util['format'](_0x3c5b('0x2f'),_0x3c5b('0x30'),_['toUpper'](_0x410ebf))]=_0xa074cc[_0x3c5b('0x2b')][_0x410ebf];}}}}return _0x4cb3d3;};exports[_0x3c5b('0x31')]=function(_0x539da6){var _0xab01c0={};for(var _0x275d32 in _0x539da6){if(_0x539da6[_0x3c5b('0x2c')](_0x275d32)){_0xab01c0[util[_0x3c5b('0x13')]('%s',_[_0x3c5b('0x32')](_0x275d32))]=_0x539da6[_0x275d32];}}return{'variables':_0xab01c0};};exports[_0x3c5b('0x33')]=function(_0x281e53,_0x3029b0){if(!_[_0x3c5b('0x18')](_0x281e53)){if(_0x281e53[_0x3c5b('0x2c')](_0x3c5b('0x34'))){if(_0x281e53[_0x3c5b('0x34')]>0x0){_0x281e53[_0x3c5b('0x34')]-=0x1;}else{logger[_0x3c5b('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3029b0);}}}else{logger[_0x3c5b('0xb')](_0x3c5b('0x35'),_0x3029b0);}};exports[_0x3c5b('0x36')]=function(_0x561010){var _0x4ebc4c=moment()[_0x3c5b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x561010[_0x3c5b('0x37')]=0xd;_0x561010[_0x3c5b('0x38')]=_0x3c5b('0x39');_0x561010[_0x3c5b('0x3a')]=_0x4ebc4c;_0x561010[_0x3c5b('0x3b')]=_0x4ebc4c;_0x561010[_0x3c5b('0x3c')]=_0x4ebc4c;};exports[_0x3c5b('0x3d')]=function(_0x5c2674,_0x4c16aa,_0x49c18f){var _0x30a18e=moment()['format'](_0x3c5b('0x3e'));_0x5c2674[_0x3c5b('0x37')]=_0x4c16aa;_0x5c2674[_0x3c5b('0x38')]=_0x49c18f;_0x5c2674[_0x3c5b('0x3b')]=_0x30a18e;_0x5c2674['ringtime']=getSeconds(_0x5c2674[_0x3c5b('0x3b')],_0x5c2674[_0x3c5b('0x3a')]);};exports[_0x3c5b('0x3f')]=function(_0x4b712f,_0x508cbb,_0x401deb){_0x4b712f[_0x3c5b('0x40')]=_0x508cbb;_0x4b712f[_0x3c5b('0x41')]=_0x401deb;};exports[_0x3c5b('0x42')]=function(_0x1175d7,_0x23ceb0,_0x5110b2){var _0x50bdd6=moment()['format'](_0x3c5b('0x3e'));_0x1175d7[_0x3c5b('0x37')]=_0x23ceb0;_0x1175d7[_0x3c5b('0x38')]=_0x5110b2;_0x1175d7['responsetime']=_0x1175d7['responsetime']?_0x1175d7[_0x3c5b('0x3b')]:_0x50bdd6;_0x1175d7[_0x3c5b('0x3c')]=_0x1175d7['endtime']?_0x1175d7[_0x3c5b('0x3c')]:_0x50bdd6;_0x1175d7['ringtime']=getSeconds(_0x1175d7['responsetime']||0x0,_0x1175d7[_0x3c5b('0x3a')]||0x0);_0x1175d7[_0x3c5b('0x43')]=_0x1175d7[_0x3c5b('0x44')]?getSeconds(_0x1175d7[_0x3c5b('0x3c')],_0x1175d7[_0x3c5b('0x44')]):0x0;};exports[_0x3c5b('0x45')]=function(_0x1c448d){return _0x1c448d===_0x3c5b('0x46');};exports[_0x3c5b('0x47')]=function(_0x324d27,_0x23bb3d,_0x5d724e,_0x1e61b5,_0x523281){var _0x4752b8=_0x1e61b5?'RECALL':_0x324d27[_0x3c5b('0x1b')];_0x4752b8=_0x523281?_0x3c5b('0x48'):_0x4752b8;return{'actionid':_0x324d27[_0x3c5b('0x49')],'action':_0x3c5b('0x4a'),'channel':_0x324d27[_0x3c5b('0x4b')],'callerid':util[_0x3c5b('0x13')](_0x3c5b('0x14'),_0x4752b8,_0x324d27[_0x3c5b('0x1c')]),'Exten':'xcally-motion-preview','Context':_0x3c5b('0x4c'),'Priority':'1','variable':_0x5d724e,'timeout':(_0x23bb3d[_0x3c5b('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x324d27[_0x3c5b('0x49')]};};exports[_0x3c5b('0x4e')]=function(_0x4e312a){return _0x4e312a[_0x3c5b('0x4f')]+_0x4e312a[_0x3c5b('0x50')]+_0x4e312a[_0x3c5b('0x51')]+_0x4e312a[_0x3c5b('0x52')]+_0x4e312a[_0x3c5b('0x53')];};exports[_0x3c5b('0x54')]=function(_0x24d4f6){var _0x159799=_[_0x3c5b('0x55')](_0x24d4f6);_0x159799[_0x3c5b('0x37')]=0xf;_0x159799[_0x3c5b('0x38')]=_0x3c5b('0x56');return _0x159799;};exports['scheduledAt']=function(_0x4b3232,_0x418b0c,_0x19a129){var _0xb6e9e={};_0xb6e9e[_0x418b0c]=_0x4b3232[_0x418b0c];_0xb6e9e['active']=![];_0xb6e9e[_0x3c5b('0x57')]=moment()['add'](_0x19a129,_0x3c5b('0x58'))[_0x3c5b('0x13')](_0x3c5b('0x3e'));_0xb6e9e[_0x3c5b('0x1d')]=_0x4b3232[_0x3c5b('0x1d')];_0xb6e9e[_0x3c5b('0x59')]=_0x4b3232[_0x3c5b('0x59')];_0xb6e9e[_0x3c5b('0x1f')]=_0x4b3232[_0x3c5b('0x1f')]||undefined;return _0xb6e9e;};exports[_0x3c5b('0x5a')]=function(_0x2267cd,_0x153a37){if(!_[_0x3c5b('0x18')](_0x2267cd)){if(_0x2267cd[_0x3c5b('0x5b')]>0x0){_0x2267cd[_0x3c5b('0x5b')]-=0x1;}else{logger[_0x3c5b('0xb')](_0x153a37,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x3c5b('0xb')](_0x153a37,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x3c5b('0x5c')]=function(_0x414251){if(_0x414251<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3f05ea,_0x50982e){_0x3f05ea[_0x3c5b('0x5d')]=_0x50982e;_0x3f05ea[_0x3c5b('0x1a')]=_0x3f05ea['queue'];_0x3f05ea[_0x3c5b('0x5e')]=_0x3f05ea[_0x3c5b('0x4b')];return _0x3f05ea;};exports['buildAcw']=function(_0x190fae){var _0x28d62d={};_0x28d62d[_0x3c5b('0x5f')]=_0x190fae[_0x3c5b('0x5f')];_0x28d62d['interface']=_0x190fae[_0x3c5b('0x4b')];_0x28d62d[_0x3c5b('0x49')]=_0x190fae[_0x3c5b('0x49')];return _0x28d62d;};exports[_0x3c5b('0x60')]=function(_0x365b4d){var _0x46b647=[];for(var _0x4223d2 in _0x365b4d){if(_0x365b4d[_0x3c5b('0x2c')](_0x4223d2)){if(!_[_0x3c5b('0x18')](_0x365b4d[_0x4223d2])&&_0x365b4d[_0x4223d2][_0x3c5b('0x37')]==='not_inuse'&&_0x365b4d[_0x4223d2][_0x3c5b('0x61')]===_0x3c5b('0x62')){_0x46b647[_0x3c5b('0x63')](_0x365b4d[_0x4223d2]['id']);}}}return _0x46b647;};exports[_0x3c5b('0x64')]=function(_0x4b79f1){var _0x420ed0=moment()[_0x3c5b('0x65')](0x0);var _0x37aadb=moment(_0x4b79f1)[_0x3c5b('0x65')](0x0);return _0x420ed0[_0x3c5b('0x8')](_0x37aadb,_0x3c5b('0x9'));};exports[_0x3c5b('0x66')]=function(_0x1d6337){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1d6337[_0x3c5b('0x1d')],'ListId':_0x1d6337['ListId'],'VoiceQueueId':_0x1d6337['VoiceQueueId']||undefined,'CampaignId':_0x1d6337[_0x3c5b('0x67')]||undefined};};exports[_0x3c5b('0x68')]=function(_0x2e105e){if(_0x2e105e===_0x3c5b('0x49')||_0x2e105e===_0x3c5b('0x69')||_0x2e105e===_0x3c5b('0x5f')||_0x2e105e===_0x3c5b('0x6a')||_0x2e105e===_0x3c5b('0x6b')||_0x2e105e===_0x3c5b('0x6c')||_0x2e105e==='membername'||_0x2e105e===_0x3c5b('0x4b')||_0x2e105e===_0x3c5b('0x1b')||_0x2e105e==='active'||_0x2e105e==='calleridnum'||_0x2e105e===_0x3c5b('0x57')||_0x2e105e===_0x3c5b('0x4f')||_0x2e105e==='countcongestionretry'||_0x2e105e===_0x3c5b('0x51')||_0x2e105e===_0x3c5b('0x6d')||_0x2e105e===_0x3c5b('0x6e')||_0x2e105e==='callbackuniqueid'||_0x2e105e===_0x3c5b('0x6f')||_0x2e105e===_0x3c5b('0x70')||_0x2e105e===_0x3c5b('0x1d')||_0x2e105e==='ListId'||_0x2e105e===_0x3c5b('0x41')||_0x2e105e===_0x3c5b('0x1f')||_0x2e105e===_0x3c5b('0x71')||_0x2e105e===_0x3c5b('0x72')||_0x2e105e===_0x3c5b('0x73')||_0x2e105e===_0x3c5b('0x74')||_0x2e105e===_0x3c5b('0x75')||_0x2e105e==='xmd-dialurl'||_0x2e105e==='xmd-dialtimeout'||_0x2e105e==='xmd-dialoptions'||_0x2e105e===_0x3c5b('0x76')||_0x2e105e===_0x3c5b('0x77')||_0x2e105e===_0x3c5b('0x78')||_0x2e105e==='xmd-cdrtype'||_0x2e105e==='xmd-callerid'||_0x2e105e===_0x3c5b('0x79')||_0x2e105e===_0x3c5b('0x7a')||_0x2e105e===_0x3c5b('0x7b')||_0x2e105e===_0x3c5b('0x7c')||_0x2e105e===_0x3c5b('0x7d')||_0x2e105e==='rtpaudioqosjitterbridged'||_0x2e105e===_0x3c5b('0x7e')||_0x2e105e===_0x3c5b('0x7f')||_0x2e105e===_0x3c5b('0x80')||_0x2e105e===_0x3c5b('0x81')||_0x2e105e===_0x3c5b('0x7b')||_0x2e105e===_0x3c5b('0x7c')||_0x2e105e===_0x3c5b('0x7d')||_0x2e105e===_0x3c5b('0x82')||_0x2e105e===_0x3c5b('0x7e')||_0x2e105e===_0x3c5b('0x7f')||_0x2e105e==='rtpaudioqosrtt'||_0x2e105e===_0x3c5b('0x81')||_0x2e105e===_0x3c5b('0x83')||_0x2e105e==='bridgepvtcallid'||_0x2e105e==='state'||_0x2e105e===_0x3c5b('0x38')){return![];}return!![];};exports[_0x3c5b('0x84')]=function(_0x5bb775,_0x576da2){var _0x37a325,_0x4aa406,_0x2240e5;if(_0x576da2<=0x0){_0x576da2=0x1;}_0x37a325=new RegExp('\x5cw{0,'+_0x576da2+'}$');_0x4aa406=Math[_0x3c5b('0x85')](0xa,_0x576da2-0x1);_0x2240e5=Math[_0x3c5b('0x85')](0xa,_0x576da2)-0x1;return util['format']('%s',_[_0x3c5b('0x86')](_0x5bb775,_0x37a325,_[_0x3c5b('0x87')](_0x4aa406,_0x2240e5)));};exports[_0x3c5b('0x88')]=function(_0x441720){var _0x3fb875=_0x441720[_0x3c5b('0x89')](/"(.*?)"/);return _0x3fb875?_0x3fb875[0x1]:_0x441720;};exports[_0x3c5b('0x8a')]=function(_0x5d67cc){var _0x17c76c=_0x5d67cc[_0x3c5b('0x89')](/<(.*?)>/);return _0x17c76c?_0x17c76c[0x1]:_0x5d67cc;}; \ No newline at end of file +var _0x8212=['type','campaigntype','dialAnswer','active','countnoanswerretry','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','seconds','error','inspect','logger','info','message','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','logLookAgent','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','lastevent','queue','interface','buildAcw','not_inuse','reachable','push','getDiff','milliseconds','createBody','filterKey','idContact'];(function(_0x15cc63,_0x4e6b33){var _0x2687b2=function(_0x3e5d55){while(--_0x3e5d55){_0x15cc63['push'](_0x15cc63['shift']());}};_0x2687b2(++_0x4e6b33);}(_0x8212,0xb3));var _0x2821=function(_0x2036fa,_0x168ee5){_0x2036fa=_0x2036fa-0x0;var _0x1dd8d6=_0x8212[_0x2036fa];return _0x1dd8d6;};'use strict';var util=require(_0x2821('0x0'));var _=require(_0x2821('0x1'));var moment=require('moment');var logger=require(_0x2821('0x2'))(_0x2821('0x3'));var ipAgi=process[_0x2821('0x4')][_0x2821('0x5')]||_0x2821('0x6');function getSeconds(_0x1b2d87,_0xbc7b3c){var _0x4151aa=moment(_0x1b2d87)['milliseconds'](0x0);var _0x2f22bd=moment(_0xbc7b3c)['milliseconds'](0x0);return _0x4151aa[_0x2821('0x7')](_0x2f22bd,_0x2821('0x8'));}exports['loggerCatch']=function(_0x3644aa){return function(_0x201069){logger[_0x2821('0x9')](_0x3644aa,util[_0x2821('0xa')](_0x201069,{'showHidden':![],'depth':null}));};};exports[_0x2821('0xb')]=function(_0x17d352,_0x258b64){logger[_0x2821('0xc')](_0x17d352,util[_0x2821('0xa')](_0x258b64,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x11a5fe,_0x2023ec){logger[_0x2821('0x9')](_0x11a5fe,util['inspect'](_0x2023ec,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x532ad6){return function(_0x4c81c1){logger[_0x2821('0xc')](_0x532ad6,util[_0x2821('0xa')](_0x4c81c1,{'showHidden':![],'depth':null}));};};exports[_0x2821('0xd')]=function(_0x223234,_0x353943,_0x2fbc96){return{'message':_0x223234,'unlock':_0x353943,'active':_0x2fbc96};};exports['getCallerId']=function(_0x3ba091,_0x5030fc,_0x5a92f0){if(!_[_0x2821('0xe')](_0x5a92f0)&&_0x2821('0xf')===typeof _0x5a92f0&&!_[_0x2821('0x10')](_0x5a92f0)){if(!_[_0x2821('0xe')](_0x5030fc)&&'string'===typeof _0x5030fc&&!_[_0x2821('0x10')](_0x5030fc)){return util['format'](_0x2821('0x11'),_0x5030fc,_0x5a92f0);}return util[_0x2821('0x12')](_0x2821('0x11'),_0x5a92f0,_0x5a92f0);}if(!_[_0x2821('0xe')](_0x3ba091)&&_0x2821('0xf')===typeof _0x3ba091&&!_[_0x2821('0x10')](_0x3ba091)){return _0x3ba091;}return _0x2821('0x13');};exports[_0x2821('0x14')]=function(_0x48b0e8){if(_[_0x2821('0x15')](_0x48b0e8)){return![];}return _0x48b0e8;};exports['addVariables']=function(_0x399784,_0xb7b9a0,_0x1d690e,_0x8ba96e,_0x38d898,_0x2fa9a8){var _0x1c0907={'XMD-QUEUE':_0xb7b9a0[_0x2821('0x16')]?_0xb7b9a0[_0x2821('0x16')][_0x2821('0x17')]:'','XMD-CALLERID':_0x8ba96e,'XMD-CALLERID-PREVIEW':_0x2fa9a8?util[_0x2821('0x12')]('\x22%s\x22\x20<%s>',_0x2fa9a8['calleridname'],_0x2fa9a8[_0x2821('0x18')]):_0x8ba96e,'XMD-DIALID':_0x38d898,'XMD-CONTACTID':_0xb7b9a0[_0x2821('0x19')],'XMD-CDRTYPE':_0x2821('0x1a'),'CALLERID(all)':_0x8ba96e,'XMD-VOICEQUEUEID':_0xb7b9a0[_0x2821('0x1b')],'XMD-DIALCHANNEL':_0x1d690e,'XMD-DIALTIMEOUT':_0x399784[_0x2821('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x2821('0x12')](_0x2821('0x1d'),_0x399784[_0x2821('0x1e')]?'g':'',_[_0x2821('0x10')](_0x399784[_0x2821('0x1f')])?'':_0x2821('0x20')),'XMD-DIALURL':_0x399784[_0x2821('0x21')]||'','XMD-AGI':_0x399784[_0x2821('0x22')]?util[_0x2821('0x12')](_0x2821('0x23'),ipAgi,_0x399784[_0x2821('0x22')]):_0x2821('0x24'),'XMD-AGIAFTER':_0x399784[_0x2821('0x1e')]?util[_0x2821('0x12')](_0x2821('0x23'),ipAgi,_0x399784['dialQueueProject2']):_0x2821('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x2fa9a8?_0x2fa9a8['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2fa9a8?_0x2fa9a8[_0x2821('0x25')]:'','XMD-DESTINATION':_0x2821('0x26')};if(!_[_0x2821('0x10')](_0x399784[_0x2821('0x1f')])){_0x1c0907[util['format']('%s',_0x2821('0x27'))]=_0x399784[_0x2821('0x1f')];_0x1c0907[util['format']('%s',_0x2821('0x28'))]=_0x38d898;}if(_0xb7b9a0&&_0xb7b9a0[_0x2821('0x29')]){for(var _0x3d2d07 in _0xb7b9a0['Contact']){if(_0xb7b9a0[_0x2821('0x29')][_0x2821('0x2a')](_0x3d2d07)){if(!_[_0x2821('0x15')](_0xb7b9a0[_0x2821('0x29')][_0x3d2d07])&&_0x3d2d07!=='id'&&_0x3d2d07!==_0x2821('0x2b')&&_0x3d2d07!==_0x2821('0x2c')&&_0x3d2d07!==_0x2821('0x2d')){_0x1c0907[util['format'](_0x2821('0x2e'),_0x2821('0x2f'),_[_0x2821('0x30')](_0x3d2d07))]=_0xb7b9a0[_0x2821('0x29')][_0x3d2d07];}}}}return _0x1c0907;};exports[_0x2821('0x31')]=function(_0x31d9e3){var _0x1cb61a={};for(var _0x2c3846 in _0x31d9e3){if(_0x31d9e3[_0x2821('0x2a')](_0x2c3846)){_0x1cb61a[util[_0x2821('0x12')]('%s',_[_0x2821('0x32')](_0x2c3846))]=_0x31d9e3[_0x2c3846];}}return{'variables':_0x1cb61a};};exports['updateOriginated']=function(_0x1880f6,_0x132893){if(!_[_0x2821('0x15')](_0x1880f6)){if(_0x1880f6[_0x2821('0x2a')]('originated')){if(_0x1880f6[_0x2821('0x33')]>0x0){_0x1880f6[_0x2821('0x33')]-=0x1;}else{logger[_0x2821('0x9')](_0x2821('0x34'),_0x132893);}}}else{logger[_0x2821('0x9')](_0x2821('0x35'),_0x132893);}};exports[_0x2821('0x36')]=function(_0x2e0eaf){var _0x2f30d6=moment()[_0x2821('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e0eaf[_0x2821('0x37')]=0xd;_0x2e0eaf[_0x2821('0x38')]=_0x2821('0x39');_0x2e0eaf[_0x2821('0x3a')]=_0x2f30d6;_0x2e0eaf[_0x2821('0x3b')]=_0x2f30d6;_0x2e0eaf['endtime']=_0x2f30d6;};exports[_0x2821('0x3c')]=function(_0x58f3ce,_0x4f7a17,_0x3b4b88){var _0x421b76=moment()[_0x2821('0x12')](_0x2821('0x3d'));_0x58f3ce[_0x2821('0x37')]=_0x4f7a17;_0x58f3ce[_0x2821('0x38')]=_0x3b4b88;_0x58f3ce[_0x2821('0x3b')]=_0x421b76;_0x58f3ce['ringtime']=getSeconds(_0x58f3ce['responsetime'],_0x58f3ce[_0x2821('0x3a')]);};exports[_0x2821('0x3e')]=function(_0x45b76a,_0x2737a7,_0x277af7){_0x45b76a['membername']=_0x2737a7;_0x45b76a['UserId']=_0x277af7;};exports[_0x2821('0x3f')]=function(_0x26d389,_0x234f59,_0xde4a38){var _0x3deef7=moment()[_0x2821('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x26d389[_0x2821('0x37')]=_0x234f59;_0x26d389[_0x2821('0x38')]=_0xde4a38;_0x26d389['responsetime']=_0x26d389[_0x2821('0x3b')]?_0x26d389[_0x2821('0x3b')]:_0x3deef7;_0x26d389[_0x2821('0x40')]=_0x26d389[_0x2821('0x40')]?_0x26d389[_0x2821('0x40')]:_0x3deef7;_0x26d389['ringtime']=getSeconds(_0x26d389[_0x2821('0x3b')]||0x0,_0x26d389[_0x2821('0x3a')]||0x0);_0x26d389[_0x2821('0x41')]=_0x26d389[_0x2821('0x42')]?getSeconds(_0x26d389['endtime'],_0x26d389['answertime']):0x0;};exports[_0x2821('0x43')]=function(_0x37bdbd){return _0x37bdbd===_0x2821('0x44');};exports[_0x2821('0x45')]=function(_0x18fd69,_0x2bae3b,_0x107706,_0x5dc6cd,_0x5e0715){var _0x278d2b=_0x5dc6cd?'RECALL':_0x18fd69[_0x2821('0x46')];_0x278d2b=_0x5e0715?_0x2821('0x47'):_0x278d2b;return{'actionid':_0x18fd69[_0x2821('0x48')],'action':_0x2821('0x49'),'channel':_0x18fd69[_0x2821('0x4a')],'callerid':util[_0x2821('0x12')](_0x2821('0x11'),_0x278d2b,_0x18fd69['calleridnum']),'Exten':_0x2821('0x26'),'Context':_0x2821('0x4b'),'Priority':'1','variable':_0x107706,'timeout':(_0x2bae3b[_0x2821('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x18fd69[_0x2821('0x48')]};};exports[_0x2821('0x4d')]=function(_0x29386e){return _0x29386e[_0x2821('0x4e')]+_0x29386e[_0x2821('0x4f')]+_0x29386e['countnoanswerretry']+_0x29386e[_0x2821('0x50')]+_0x29386e[_0x2821('0x51')];};exports[_0x2821('0x52')]=function(_0x3f370d){var _0x487d18=_[_0x2821('0x53')](_0x3f370d);_0x487d18[_0x2821('0x37')]=0xf;_0x487d18[_0x2821('0x38')]='Global';return _0x487d18;};exports['scheduledAt']=function(_0x5162b3,_0x9721,_0x16283e){var _0x459794={};_0x459794[_0x9721]=_0x5162b3[_0x9721];_0x459794['active']=![];_0x459794[_0x2821('0x54')]=moment()[_0x2821('0x55')](_0x16283e,_0x2821('0x56'))[_0x2821('0x12')](_0x2821('0x3d'));_0x459794[_0x2821('0x19')]=_0x5162b3['ContactId'];_0x459794['ListId']=_0x5162b3[_0x2821('0x57')];_0x459794[_0x2821('0x1b')]=_0x5162b3['VoiceQueueId']||undefined;return _0x459794;};exports[_0x2821('0x58')]=function(_0x4421c5,_0x684af3){if(!_[_0x2821('0x15')](_0x4421c5)){if(_0x4421c5[_0x2821('0x59')]>0x0){_0x4421c5[_0x2821('0x59')]-=0x1;}else{logger[_0x2821('0x9')](_0x684af3,_0x2821('0x5a'));}}else{logger[_0x2821('0x9')](_0x684af3,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5436f6){if(_0x5436f6<=0x0){return!![];}return![];};exports['buildObj']=function(_0x4d5eaa,_0x50ab8e){_0x4d5eaa[_0x2821('0x5b')]=_0x50ab8e;_0x4d5eaa[_0x2821('0x17')]=_0x4d5eaa[_0x2821('0x5c')];_0x4d5eaa[_0x2821('0x5d')]=_0x4d5eaa[_0x2821('0x4a')];return _0x4d5eaa;};exports[_0x2821('0x5e')]=function(_0x436574){var _0x5d276c={};_0x5d276c[_0x2821('0x5c')]=_0x436574[_0x2821('0x5c')];_0x5d276c['interface']=_0x436574[_0x2821('0x4a')];_0x5d276c[_0x2821('0x48')]=_0x436574[_0x2821('0x48')];return _0x5d276c;};exports['agentReadyId']=function(_0x5f4d83){var _0x21928c=[];for(var _0xc969df in _0x5f4d83){if(_0x5f4d83[_0x2821('0x2a')](_0xc969df)){if(!_[_0x2821('0x15')](_0x5f4d83[_0xc969df])&&_0x5f4d83[_0xc969df][_0x2821('0x37')]===_0x2821('0x5f')&&_0x5f4d83[_0xc969df]['status']===_0x2821('0x60')){_0x21928c[_0x2821('0x61')](_0x5f4d83[_0xc969df]['id']);}}}return _0x21928c;};exports[_0x2821('0x62')]=function(_0x16a67b){var _0x31d5f6=moment()[_0x2821('0x63')](0x0);var _0x3ba3b4=moment(_0x16a67b)[_0x2821('0x63')](0x0);return _0x31d5f6[_0x2821('0x7')](_0x3ba3b4,_0x2821('0x8'));};exports[_0x2821('0x64')]=function(_0x4e6042){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e6042[_0x2821('0x19')],'ListId':_0x4e6042[_0x2821('0x57')],'VoiceQueueId':_0x4e6042[_0x2821('0x1b')]||undefined,'CampaignId':_0x4e6042['CampaignId']||undefined};};exports[_0x2821('0x65')]=function(_0x512c68){if(_0x512c68===_0x2821('0x48')||_0x512c68===_0x2821('0x66')||_0x512c68===_0x2821('0x5c')||_0x512c68===_0x2821('0x67')||_0x512c68===_0x2821('0x68')||_0x512c68===_0x2821('0x69')||_0x512c68==='membername'||_0x512c68===_0x2821('0x4a')||_0x512c68===_0x2821('0x46')||_0x512c68===_0x2821('0x6a')||_0x512c68===_0x2821('0x18')||_0x512c68===_0x2821('0x54')||_0x512c68===_0x2821('0x4e')||_0x512c68==='countcongestionretry'||_0x512c68===_0x2821('0x6b')||_0x512c68===_0x2821('0x6c')||_0x512c68===_0x2821('0x6d')||_0x512c68==='callbackuniqueid'||_0x512c68===_0x2821('0x6e')||_0x512c68===_0x2821('0x6f')||_0x512c68===_0x2821('0x19')||_0x512c68===_0x2821('0x57')||_0x512c68===_0x2821('0x70')||_0x512c68===_0x2821('0x1b')||_0x512c68===_0x2821('0x71')||_0x512c68===_0x2821('0x72')||_0x512c68==='xmd-queue'||_0x512c68===_0x2821('0x73')||_0x512c68===_0x2821('0x74')||_0x512c68===_0x2821('0x75')||_0x512c68===_0x2821('0x76')||_0x512c68===_0x2821('0x77')||_0x512c68===_0x2821('0x78')||_0x512c68==='xmd-dialchannel'||_0x512c68==='xmd-contactid'||_0x512c68===_0x2821('0x79')||_0x512c68===_0x2821('0x7a')||_0x512c68===_0x2821('0x7b')||_0x512c68===_0x2821('0x7c')||_0x512c68==='rtpaudioqos'||_0x512c68===_0x2821('0x7d')||_0x512c68===_0x2821('0x7e')||_0x512c68===_0x2821('0x7f')||_0x512c68==='rtpaudioqosloss'||_0x512c68==='rtpaudioqoslossbridged'||_0x512c68===_0x2821('0x80')||_0x512c68===_0x2821('0x81')||_0x512c68==='rtpaudioqos'||_0x512c68===_0x2821('0x7d')||_0x512c68===_0x2821('0x7e')||_0x512c68===_0x2821('0x7f')||_0x512c68===_0x2821('0x82')||_0x512c68==='rtpaudioqoslossbridged'||_0x512c68===_0x2821('0x80')||_0x512c68===_0x2821('0x81')||_0x512c68===_0x2821('0x83')||_0x512c68===_0x2821('0x84')||_0x512c68==='state'||_0x512c68==='statedesc'){return![];}return!![];};exports[_0x2821('0x85')]=function(_0x4b3558,_0x254578){var _0x4e414d,_0x156839,_0x484f8b;if(_0x254578<=0x0){_0x254578=0x1;}_0x4e414d=new RegExp(_0x2821('0x86')+_0x254578+'}$');_0x156839=Math[_0x2821('0x87')](0xa,_0x254578-0x1);_0x484f8b=Math[_0x2821('0x87')](0xa,_0x254578)-0x1;return util[_0x2821('0x12')]('%s',_[_0x2821('0x88')](_0x4b3558,_0x4e414d,_[_0x2821('0x89')](_0x156839,_0x484f8b)));};exports[_0x2821('0x8a')]=function(_0x488eca){var _0x364e0b=_0x488eca[_0x2821('0x8b')](/"(.*?)"/);return _0x364e0b?_0x364e0b[0x1]:_0x488eca;};exports[_0x2821('0x8c')]=function(_0x34f5f8){var _0xa55967=_0x34f5f8['match'](/<(.*?)>/);return _0xa55967?_0xa55967[0x1]:_0x34f5f8;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0d6bbd0..2e43682 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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x362fce,_0xd44c62){var _0x12c2b3=function(_0x1f6025){while(--_0x1f6025){_0x362fce['push'](_0x362fce['shift']());}};_0x12c2b3(++_0xd44c62);}(_0xb10b,0x12a));var _0xbb10=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0xb10b[_0x5302fb];return _0x43e6a4;};'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 +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3dd90a,_0x5a7602){var _0x2a815c=function(_0x3e916d){while(--_0x3e916d){_0x3dd90a['push'](_0x3dd90a['shift']());}};_0x2a815c(++_0x5a7602);}(_0x7a54,0x106));var _0x47a5=function(_0x16030a,_0x39d49b){_0x16030a=_0x16030a-0x0;var _0x3af392=_0x7a54[_0x16030a];return _0x3af392;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8068d1d..c27f152 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 _0x4a8c=['../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','channels','outboundChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','hasOwnProperty','isNil','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','sugarcrmAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount'];(function(_0x222c72,_0x496c56){var _0xebdd9b=function(_0x2228f0){while(--_0x2228f0){_0x222c72['push'](_0x222c72['shift']());}};_0xebdd9b(++_0x496c56);}(_0x4a8c,0x12f));var _0xc4a8=function(_0x3afd17,_0x1afe7b){_0x3afd17=_0x3afd17-0x0;var _0x5e6a06=_0x4a8c[_0x3afd17];return _0x5e6a06;};'use strict';var BPromise=require(_0xc4a8('0x0'));var util=require(_0xc4a8('0x1'));var _=require(_0xc4a8('0x2'));var moment=require('moment');var Agent=require(_0xc4a8('0x3'));var Telephone=require(_0xc4a8('0x4'));var Trunk=require(_0xc4a8('0x5'));var VoiceQueue=require(_0xc4a8('0x6'));var Trigger=require(_0xc4a8('0x7'));var Template=require(_0xc4a8('0x8'));var Campaign=require(_0xc4a8('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xc4a8('0xa'));var SugarcrmAccount=require(_0xc4a8('0xb'));var ZohoAccount=require(_0xc4a8('0xc'));var DeskAccount=require(_0xc4a8('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xc4a8('0xe'));var Dynamics365Account=require(_0xc4a8('0xf'));var FreshsalesAccount=require(_0xc4a8('0x10'));var FaxAccount=require(_0xc4a8('0x11'));var Realtime=function(){this[_0xc4a8('0x12')]={};this[_0xc4a8('0x13')]={};this[_0xc4a8('0x14')]={};this['voiceQueues']={};this[_0xc4a8('0x15')]={};this[_0xc4a8('0x16')]={};this[_0xc4a8('0x17')]={};this[_0xc4a8('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xc4a8('0x19')]={};this['queueChannels']={};this[_0xc4a8('0x1a')]={};this[_0xc4a8('0x1b')]={};this['zendeskAccounts']={};this[_0xc4a8('0x1c')]={};this['sugarcrmAccounts']={};this[_0xc4a8('0x1d')]={};this[_0xc4a8('0x1e')]={};this[_0xc4a8('0x1f')]={};this[_0xc4a8('0x20')]={};this['servicenowAccounts']={};this[_0xc4a8('0x21')]={};this[_0xc4a8('0x22')]={};this[_0xc4a8('0x23')]={};};function freeIsNotKey(_0x1bccdd,_0x383f4f,_0x1f5e25){var _0x177afa=_[_0xc4a8('0x24')](_0x1bccdd,function(_0x2a6ff5,_0x26dee1){return _0x2a6ff5[_0x1f5e25];});for(var _0x39dd00 in _0x383f4f){if(_0x383f4f['hasOwnProperty'](_0x39dd00)){if(!_0x177afa[_0x39dd00]){delete _0x383f4f[_0x39dd00];}}}}function freeIsNotKeySip(_0x2d1660,_0x22d790){var _0xe218b1=_[_0xc4a8('0x24')](_0x2d1660,function(_0x26d1d0,_0x3e0744){return util[_0xc4a8('0x25')](_0xc4a8('0x26'),_0x26d1d0['name']);});for(var _0x3f2aa3 in _0x22d790){if(_0x22d790[_0xc4a8('0x27')](_0x3f2aa3)){if(!_0xe218b1[_0x3f2aa3]){delete _0x22d790[_0x3f2aa3];}}}}function freeIsNotKeyAgent(_0x2bf273,_0x57617e){var _0x855e25=_[_0xc4a8('0x24')](_0x2bf273,function(_0x28ec8b,_0x453d68){var _0x78b002=_[_0xc4a8('0x28')](_0x28ec8b[_0xc4a8('0x29')])?util[_0xc4a8('0x25')]('SIP/%s',_0x28ec8b[_0xc4a8('0x2a')]):_0x28ec8b[_0xc4a8('0x29')];return _0x78b002;});for(var _0x3a4fd9 in _0x57617e){if(_0x57617e[_0xc4a8('0x27')](_0x3a4fd9)){if(!_0x855e25[_0x3a4fd9]){delete _0x57617e[_0x3a4fd9];}}}}function clearVoiceCallReports(_0x19d959){_0x19d959[_0xc4a8('0x2b')]=0x0;_0x19d959[_0xc4a8('0x2c')]=0x0;_0x19d959[_0xc4a8('0x2d')]=0x0;_0x19d959[_0xc4a8('0x2e')]=0x0;_0x19d959[_0xc4a8('0x2f')]=0x0;}function clearCampaigns(_0x209b6a){if(!_[_0xc4a8('0x30')](_0x209b6a)){for(var _0x17e7f4 in _0x209b6a){if(_0x209b6a['hasOwnProperty'](_0x17e7f4)){_0x209b6a[_0x17e7f4]['ivrTotalCallsDays']=0x0;_0x209b6a[_0x17e7f4][_0xc4a8('0x31')]=0x0;}}}}function clearVoiceQueues(_0x291571){if(!_[_0xc4a8('0x30')](_0x291571)){for(var _0xf50ec2 in _0x291571){if(_0x291571[_0xc4a8('0x27')](_0xf50ec2)){_0x291571[_0xf50ec2][_0xc4a8('0x2b')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x2c')]=0x0;_0x291571[_0xf50ec2]['unmanaged']=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x32')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x2d')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x2e')]=0x0;_0x291571[_0xf50ec2]['sumBillable']=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x33')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x34')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x35')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x36')]=0x0;_0x291571[_0xf50ec2]['outboundNoSuchCallsDay']=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x37')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x38')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x39')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3a')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3b')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3c')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3d')]=0x0;_0x291571[_0xf50ec2]['outboundAnswerAgiCallsDay']=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3e')]=0x0;_0x291571[_0xf50ec2][_0xc4a8('0x3f')]=!![];}}}}Realtime['prototype'][_0xc4a8('0x40')]=function(_0xdf7386,_0x553f1d){for(var _0x5868a3 in _0x553f1d){if(_0xdf7386[_0xc4a8('0x27')](_0x5868a3)){_0xdf7386[_0x5868a3]=_0x553f1d[_0x5868a3];}}};Realtime[_0xc4a8('0x41')][_0xc4a8('0x42')]=function(){var _0x2baa4c=this;return function(_0x380f16){if(_0x380f16){freeIsNotKeyAgent(_0x380f16,_0x2baa4c['agents']);for(var _0x1f9715=0x0,_0x4e28dc={},_0x26d2b0={};_0x1f9715<_0x380f16[_0xc4a8('0x43')];_0x1f9715+=0x1){_0x4e28dc=_0x380f16[_0x1f9715];var _0x14e364=_[_0xc4a8('0x28')](_0x4e28dc[_0xc4a8('0x29')])?util['format'](_0xc4a8('0x26'),_0x4e28dc[_0xc4a8('0x2a')]):_0x4e28dc[_0xc4a8('0x29')];if(_[_0xc4a8('0x44')](_0x2baa4c[_0xc4a8('0x12')][_0x14e364])){_0x2baa4c[_0xc4a8('0x12')][_0x14e364]=new Agent(_0x4e28dc);}else{_0x2baa4c[_0xc4a8('0x40')](_0x2baa4c[_0xc4a8('0x12')][_0x14e364],_0x4e28dc);}}}return _0x2baa4c[_0xc4a8('0x12')];};};Realtime['prototype'][_0xc4a8('0x45')]=function(){var _0x1d2cbc=this;return function(_0xf32ad0){if(_0xf32ad0){freeIsNotKeySip(_0xf32ad0,_0x1d2cbc[_0xc4a8('0x13')]);for(var _0x392549=0x0,_0x193dec={},_0x16d883={};_0x392549<_0xf32ad0[_0xc4a8('0x43')];_0x392549+=0x1){_0x193dec=_0xf32ad0[_0x392549];if(_['isUndefined'](_0x1d2cbc[_0xc4a8('0x13')][util[_0xc4a8('0x25')](_0xc4a8('0x26'),_0x193dec[_0xc4a8('0x2a')])])){_0x1d2cbc['telephones'][util[_0xc4a8('0x25')]('SIP/%s',_0x193dec[_0xc4a8('0x2a')])]=new Telephone(_0x193dec);}else{_0x1d2cbc[_0xc4a8('0x40')](_0x1d2cbc['telephones'][util[_0xc4a8('0x25')]('SIP/%s',_0x193dec[_0xc4a8('0x2a')])],_0x193dec);}}}return _0x1d2cbc[_0xc4a8('0x13')];};};Realtime['prototype'][_0xc4a8('0x46')]=function(){var _0x12dee4=this;return function(_0x4b8eb1){if(_0x4b8eb1){freeIsNotKeySip(_0x4b8eb1,_0x12dee4['trunks']);for(var _0x7f7b21=0x0,_0x16505e={},_0x5e9073={};_0x7f7b21<_0x4b8eb1[_0xc4a8('0x43')];_0x7f7b21+=0x1){_0x16505e=_0x4b8eb1[_0x7f7b21];if(_[_0xc4a8('0x44')](_0x12dee4['trunks'][util['format'](_0xc4a8('0x26'),_0x16505e[_0xc4a8('0x2a')])])){_0x12dee4[_0xc4a8('0x14')][util[_0xc4a8('0x25')]('SIP/%s',_0x16505e['name'])]=new Trunk(_0x16505e);}else{_0x12dee4[_0xc4a8('0x40')](_0x12dee4[_0xc4a8('0x14')][util[_0xc4a8('0x25')](_0xc4a8('0x26'),_0x16505e[_0xc4a8('0x2a')])],_0x16505e);}}}return _0x12dee4[_0xc4a8('0x14')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x47')]=function(){var _0x2f60a9=this;return function(_0xd55257){if(_0xd55257){freeIsNotKey(_0xd55257,_0x2f60a9['voiceQueues'],_0xc4a8('0x2a'));for(var _0x4a5e2c=0x0,_0x175242={},_0x5b3382={};_0x4a5e2c<_0xd55257[_0xc4a8('0x43')];_0x4a5e2c+=0x1){_0x175242=_0xd55257[_0x4a5e2c];if(_['isUndefined'](_0x2f60a9[_0xc4a8('0x48')][_0x175242['name']])){_0x2f60a9['voiceQueues'][_0x175242[_0xc4a8('0x2a')]]=new VoiceQueue(_0x175242);}else{_0x2f60a9[_0xc4a8('0x40')](_0x2f60a9[_0xc4a8('0x48')][_0x175242[_0xc4a8('0x2a')]],_0x175242);}}}return _0x2f60a9['voiceQueues'];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x49')]=function(){var _0x2b2d92=this;return function(_0x441988){if(_0x441988){freeIsNotKey(_0x441988,_0x2b2d92[_0xc4a8('0x15')],'id');for(var _0x53c4ba=0x0,_0x19a39e={},_0x55cdb6={};_0x53c4ba<_0x441988[_0xc4a8('0x43')];_0x53c4ba+=0x1){_0x19a39e=_0x441988[_0x53c4ba];if(_[_0xc4a8('0x44')](_0x2b2d92[_0xc4a8('0x15')][_0x19a39e['id']])){_0x2b2d92[_0xc4a8('0x15')][_0x19a39e['id']]=new Trigger(_0x19a39e);}else{_0x2b2d92[_0xc4a8('0x40')](_0x2b2d92[_0xc4a8('0x15')][_0x19a39e['id']],_0x19a39e);}}}return _0x2b2d92[_0xc4a8('0x15')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x4a')]=function(){var _0x59dd9c=this;return function(_0x40f280){if(_0x40f280){freeIsNotKey(_0x40f280,_0x59dd9c['templates'],'id');for(var _0x4024f7=0x0,_0x52bfe0={},_0x28d5be={};_0x4024f7<_0x40f280[_0xc4a8('0x43')];_0x4024f7+=0x1){_0x52bfe0=_0x40f280[_0x4024f7];if(_[_0xc4a8('0x44')](_0x59dd9c[_0xc4a8('0x17')][_0x52bfe0['id']])){_0x59dd9c['templates'][_0x52bfe0['id']]=new Template(_0x52bfe0);}else{_0x59dd9c[_0xc4a8('0x40')](_0x59dd9c[_0xc4a8('0x17')][_0x52bfe0['id']],_0x52bfe0);}}}return _0x59dd9c[_0xc4a8('0x17')];};};Realtime[_0xc4a8('0x41')]['initZendeskAccounts']=function(){var _0x2908ce=this;return function(_0x5575c0){if(_0x5575c0){freeIsNotKey(_0x5575c0,_0x2908ce[_0xc4a8('0x4b')],'id');for(var _0x4d83d6=0x0,_0x28408d={},_0x562abe={};_0x4d83d6<_0x5575c0[_0xc4a8('0x43')];_0x4d83d6+=0x1){_0x28408d=_0x5575c0[_0x4d83d6];if(_[_0xc4a8('0x44')](_0x2908ce[_0xc4a8('0x4b')][_0x28408d['id']])){_0x2908ce[_0xc4a8('0x4b')][_0x28408d['id']]=new ZendeskAccount(_0x28408d);}else{_0x2908ce[_0xc4a8('0x40')](_0x2908ce[_0xc4a8('0x4b')][_0x28408d['id']],_0x28408d);}}}return _0x2908ce[_0xc4a8('0x4b')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x4c')]=function(){var _0xa31ee0=this;return function(_0x2b694e){if(_0x2b694e){freeIsNotKey(_0x2b694e,_0xa31ee0[_0xc4a8('0x1c')],'id');for(var _0x6cba4f=0x0,_0x22d41a={},_0x15b856={};_0x6cba4f<_0x2b694e['length'];_0x6cba4f+=0x1){_0x22d41a=_0x2b694e[_0x6cba4f];if(_[_0xc4a8('0x44')](_0xa31ee0[_0xc4a8('0x1c')][_0x22d41a['id']])){_0xa31ee0[_0xc4a8('0x1c')][_0x22d41a['id']]=new SalesforceAccount(_0x22d41a);}else{_0xa31ee0[_0xc4a8('0x40')](_0xa31ee0[_0xc4a8('0x1c')][_0x22d41a['id']],_0x22d41a);}}}return _0xa31ee0['salesforceAccounts'];};};Realtime[_0xc4a8('0x41')]['initFreshdeskAccounts']=function(){var _0x2b4fab=this;return function(_0x1b974c){if(_0x1b974c){freeIsNotKey(_0x1b974c,_0x2b4fab[_0xc4a8('0x1d')],'id');for(var _0x4a5cc0=0x0,_0x4d4c9c={},_0x77e227={};_0x4a5cc0<_0x1b974c[_0xc4a8('0x43')];_0x4a5cc0+=0x1){_0x4d4c9c=_0x1b974c[_0x4a5cc0];if(_[_0xc4a8('0x44')](_0x2b4fab[_0xc4a8('0x1d')][_0x4d4c9c['id']])){_0x2b4fab[_0xc4a8('0x1d')][_0x4d4c9c['id']]=new FreshdeskAccount(_0x4d4c9c);}else{_0x2b4fab[_0xc4a8('0x40')](_0x2b4fab[_0xc4a8('0x1d')][_0x4d4c9c['id']],_0x4d4c9c);}}}return _0x2b4fab[_0xc4a8('0x1d')];};};Realtime[_0xc4a8('0x41')]['initZohoAccounts']=function(){var _0x2b2a6e=this;return function(_0x29473c){if(_0x29473c){freeIsNotKey(_0x29473c,_0x2b2a6e['zohoAccounts'],'id');for(var _0x490fab=0x0,_0x1d1891={},_0x1db670={};_0x490fab<_0x29473c[_0xc4a8('0x43')];_0x490fab+=0x1){_0x1d1891=_0x29473c[_0x490fab];if(_[_0xc4a8('0x44')](_0x2b2a6e[_0xc4a8('0x1e')][_0x1d1891['id']])){_0x2b2a6e[_0xc4a8('0x1e')][_0x1d1891['id']]=new ZohoAccount(_0x1d1891);}else{_0x2b2a6e['mergeFromDatabase'](_0x2b2a6e[_0xc4a8('0x1e')][_0x1d1891['id']],_0x1d1891);}}}return _0x2b2a6e[_0xc4a8('0x1e')];};};Realtime[_0xc4a8('0x41')]['initDeskAccounts']=function(){var _0x375e4c=this;return function(_0x2bc420){if(_0x2bc420){freeIsNotKey(_0x2bc420,_0x375e4c[_0xc4a8('0x1f')],'id');for(var _0x1f4441=0x0,_0xc01881={},_0x402d23={};_0x1f4441<_0x2bc420[_0xc4a8('0x43')];_0x1f4441+=0x1){_0xc01881=_0x2bc420[_0x1f4441];if(_[_0xc4a8('0x44')](_0x375e4c['deskAccounts'][_0xc01881['id']])){_0x375e4c[_0xc4a8('0x1f')][_0xc01881['id']]=new DeskAccount(_0xc01881);}else{_0x375e4c[_0xc4a8('0x40')](_0x375e4c[_0xc4a8('0x1f')][_0xc01881['id']],_0xc01881);}}}return _0x375e4c[_0xc4a8('0x1f')];};};Realtime['prototype'][_0xc4a8('0x4d')]=function(){var _0x239318=this;return function(_0x166f65){if(_0x166f65){freeIsNotKey(_0x166f65,_0x239318[_0xc4a8('0x4e')],'id');for(var _0x5e3091=0x0,_0x53ea9a={},_0x400d2e={};_0x5e3091<_0x166f65[_0xc4a8('0x43')];_0x5e3091+=0x1){_0x53ea9a=_0x166f65[_0x5e3091];if(_['isUndefined'](_0x239318['sugarcrmAccounts'][_0x53ea9a['id']])){_0x239318[_0xc4a8('0x4e')][_0x53ea9a['id']]=new SugarcrmAccount(_0x53ea9a);}else{_0x239318[_0xc4a8('0x40')](_0x239318[_0xc4a8('0x4e')][_0x53ea9a['id']],_0x53ea9a);}}}return _0x239318['sugarcrmAccounts'];};};Realtime[_0xc4a8('0x41')]['initVtigerAccounts']=function(){var _0x937976=this;return function(_0x4ba114){if(_0x4ba114){freeIsNotKey(_0x4ba114,_0x937976[_0xc4a8('0x20')],'id');for(var _0x674c72=0x0,_0x3fe2a8={},_0x1f28f8={};_0x674c72<_0x4ba114[_0xc4a8('0x43')];_0x674c72+=0x1){_0x3fe2a8=_0x4ba114[_0x674c72];if(_[_0xc4a8('0x44')](_0x937976[_0xc4a8('0x20')][_0x3fe2a8['id']])){_0x937976['vtigerAccounts'][_0x3fe2a8['id']]=new VtigerAccount(_0x3fe2a8);}else{_0x937976[_0xc4a8('0x40')](_0x937976['vtigerAccounts'][_0x3fe2a8['id']],_0x3fe2a8);}}}return _0x937976['vtigerAccounts'];};};Realtime[_0xc4a8('0x41')]['initServicenowAccounts']=function(){var _0x54f004=this;return function(_0x5badd1){if(_0x5badd1){freeIsNotKey(_0x5badd1,_0x54f004[_0xc4a8('0x4f')],'id');for(var _0xc00298=0x0,_0x4c162b={},_0x1c4bb6={};_0xc00298<_0x5badd1[_0xc4a8('0x43')];_0xc00298+=0x1){_0x4c162b=_0x5badd1[_0xc00298];if(_[_0xc4a8('0x44')](_0x54f004['servicenowAccounts'][_0x4c162b['id']])){_0x54f004[_0xc4a8('0x4f')][_0x4c162b['id']]=new ServicenowAccount(_0x4c162b);}else{_0x54f004['mergeFromDatabase'](_0x54f004[_0xc4a8('0x4f')][_0x4c162b['id']],_0x4c162b);}}}return _0x54f004['servicenowAccounts'];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x50')]=function(){var _0x2201f1=this;return function(_0x5db2ff){if(_0x5db2ff){freeIsNotKey(_0x5db2ff,_0x2201f1['dynamics365Accounts'],'id');for(var _0x13271b=0x0,_0x3f86a5={},_0x10d616={};_0x13271b<_0x5db2ff[_0xc4a8('0x43')];_0x13271b+=0x1){_0x3f86a5=_0x5db2ff[_0x13271b];if(_[_0xc4a8('0x44')](_0x2201f1['dynamics365Accounts'][_0x3f86a5['id']])){_0x2201f1[_0xc4a8('0x21')][_0x3f86a5['id']]=new Dynamics365Account(_0x3f86a5);}else{_0x2201f1[_0xc4a8('0x40')](_0x2201f1[_0xc4a8('0x21')][_0x3f86a5['id']],_0x3f86a5);}}}return _0x2201f1[_0xc4a8('0x21')];};};Realtime['prototype'][_0xc4a8('0x51')]=function(){var _0x936807=this;return function(_0x15f3fa){if(_0x15f3fa){freeIsNotKey(_0x15f3fa,_0x936807['freshsalesAccounts'],'id');for(var _0x1db054=0x0,_0x232e9d={},_0x20d3d1={};_0x1db054<_0x15f3fa['length'];_0x1db054+=0x1){_0x232e9d=_0x15f3fa[_0x1db054];if(_[_0xc4a8('0x44')](_0x936807[_0xc4a8('0x22')][_0x232e9d['id']])){_0x936807['freshsalesAccounts'][_0x232e9d['id']]=new FreshsalesAccount(_0x232e9d);}else{_0x936807[_0xc4a8('0x40')](_0x936807[_0xc4a8('0x22')][_0x232e9d['id']],_0x232e9d);}}}return _0x936807[_0xc4a8('0x22')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x52')]=function(){var _0x3c553f=this;return function(_0x341fa3){for(var _0x41451f=0x0;_0x41451f<_0x341fa3['length'];_0x41451f+=0x1){_[_0xc4a8('0x53')](_0x3c553f['voiceQueues'][_0x341fa3[_0x41451f][_0xc4a8('0x2a')]],_0x341fa3[_0x41451f]);}return _0x3c553f[_0xc4a8('0x48')];};};Realtime[_0xc4a8('0x41')]['initVoiceQueueReports']=function(){var _0x2597e5=this;return function(_0xed5ead){clearVoiceQueues(_0x2597e5[_0xc4a8('0x48')]);if(_0xed5ead){_0xed5ead=_[_0xc4a8('0x54')](_0xed5ead,'uniqueid');for(var _0x13230c in _0xed5ead){if(_0xed5ead['hasOwnProperty'](_0x13230c)){var _0x5f442d={};for(var _0x32cdae=0x0;_0x32cdae<_0xed5ead[_0x13230c][_0xc4a8('0x43')];_0x32cdae+=0x1){var _0x27b43a=_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x55')];if(_0x2597e5['voiceQueues'][_0x27b43a]){if(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x56')]){_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x57')]+=0x1;}if(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x58')]){_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x32')]+=0x1;}_0x2597e5['voiceQueues'][_0x27b43a]['sumHoldTime']+=moment(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x59')])[_0xc4a8('0x5a')](moment(_0xed5ead[_0x13230c][_0x32cdae]['queuecallerjoinAt']),_0xc4a8('0x5b'))||0x0;if(_0x32cdae===_0xed5ead[_0x13230c][_0xc4a8('0x43')]-0x1){_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x2e')]+=moment(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x5c')]||_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x5d')]||_0xed5ead[_0x13230c][_0x32cdae]['queuecallerexitAt'])[_0xc4a8('0x5a')](moment(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x5e')]),'seconds')||0x0;_0x2597e5['voiceQueues'][_0x27b43a]['total']+=0x1;if(_0xed5ead[_0x13230c][_0x32cdae][_0xc4a8('0x5f')]){_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x2c')]+=0x1;_0x2597e5['voiceQueues'][_0x27b43a][_0xc4a8('0x2f')]+=moment(_0xed5ead[_0x13230c][_0x32cdae]['queuecallercompleteAt'])[_0xc4a8('0x5a')](moment(_0xed5ead[_0x13230c][_0x32cdae]['queuecallerleaveAt']),_0xc4a8('0x5b'))||0x0;}}else{_0x2597e5['voiceQueues'][_0x27b43a][_0xc4a8('0x2e')]+=_0x2597e5[_0xc4a8('0x48')][_0x27b43a][_0xc4a8('0x2d')]||0x0;}}}}}}return _0x2597e5['voiceQueues'];};};Realtime['prototype'][_0xc4a8('0x60')]=function(){var _0x49d56a=this;return function(_0x4abc88){clearVoiceCallReports(_0x49d56a['outbound']);if(_0x4abc88){for(var _0x1d84e1=0x0;_0x1d84e1<_0x4abc88[_0xc4a8('0x43')];_0x1d84e1+=0x1){_0x49d56a[_0xc4a8('0x18')][_0xc4a8('0x2b')]+=0x1;_0x49d56a['outbound'][_0xc4a8('0x2e')]+=_0x4abc88[_0x1d84e1][_0xc4a8('0x61')];if(_0x4abc88[_0x1d84e1][_0xc4a8('0x62')]==='ANSWERED'){_0x49d56a[_0xc4a8('0x18')][_0xc4a8('0x2c')]+=0x1;_0x49d56a[_0xc4a8('0x18')][_0xc4a8('0x2d')]+=_0x4abc88[_0x1d84e1]['duration']-_0x4abc88[_0x1d84e1][_0xc4a8('0x63')]||0x0;_0x49d56a[_0xc4a8('0x18')][_0xc4a8('0x2f')]+=_0x4abc88[_0x1d84e1][_0xc4a8('0x63')];}}}return _0x49d56a[_0xc4a8('0x18')];};};Realtime[_0xc4a8('0x41')]['initCampaigns']=function(){var _0x529fe5=this;return function(_0x478a9e){if(_0x478a9e){freeIsNotKey(_0x478a9e,_0x529fe5[_0xc4a8('0x16')],_0xc4a8('0x2a'));for(var _0x40a5c3=0x0,_0x55fd2b={};_0x40a5c3<_0x478a9e[_0xc4a8('0x43')];_0x40a5c3+=0x1){_0x55fd2b=_0x478a9e[_0x40a5c3];if(_[_0xc4a8('0x44')](_0x529fe5[_0xc4a8('0x16')][_0x55fd2b[_0xc4a8('0x2a')]])){_0x529fe5[_0xc4a8('0x16')][_0x55fd2b['name']]=new Campaign(_0x55fd2b);}else{_0x529fe5[_0xc4a8('0x40')](_0x529fe5['campaigns'][_0x55fd2b[_0xc4a8('0x2a')]],_0x55fd2b);_0x529fe5[_0xc4a8('0x16')][_0x55fd2b[_0xc4a8('0x2a')]][_0xc4a8('0x64')]=_0x55fd2b[_0xc4a8('0x65')]?_0x55fd2b[_0xc4a8('0x65')][_0xc4a8('0x2a')]:undefined;}}}return _0x529fe5[_0xc4a8('0x16')];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x66')]=function(){var _0x507b73=this;return function(_0x40c240){if(_0x40c240){freeIsNotKey(_0x40c240,_0x507b73[_0xc4a8('0x67')],'id');for(var _0x16bcdf=0x0,_0x7b375={};_0x16bcdf<_0x40c240[_0xc4a8('0x43')];_0x16bcdf+=0x1){_0x7b375=_0x40c240[_0x16bcdf];if(_['isUndefined'](_0x507b73[_0xc4a8('0x67')][_0x7b375['id']])){_0x507b73[_0xc4a8('0x67')][_0x7b375['id']]=new VoiceExtension(_0x7b375);}else{_0x507b73[_0xc4a8('0x40')](_0x507b73[_0xc4a8('0x67')][_0x7b375['id']],_0x7b375);}}}return _0x507b73['voiceExtensions'];};};Realtime[_0xc4a8('0x41')][_0xc4a8('0x68')]=function(){var _0x4d9736=this;return function(_0x23ba0b){clearCampaigns(_0x4d9736[_0xc4a8('0x16')]);for(var _0x1d92b7=0x0;_0x1d92b7<_0x23ba0b['length'];_0x1d92b7+=0x1){_[_0xc4a8('0x53')](_0x4d9736[_0xc4a8('0x16')][_0x23ba0b[_0x1d92b7][_0xc4a8('0x2a')]],_0x23ba0b[_0x1d92b7]);}return _0x4d9736[_0xc4a8('0x16')];};};Realtime['prototype'][_0xc4a8('0x69')]=function(){var _0x235cb0=this;return function(_0x3e8d3f){if(_0x3e8d3f){freeIsNotKey(_0x3e8d3f,_0x235cb0[_0xc4a8('0x23')],'id');for(var _0x1465aa=0x0,_0xc94402={},_0x512397={};_0x1465aa<_0x3e8d3f[_0xc4a8('0x43')];_0x1465aa+=0x1){_0xc94402=_0x3e8d3f[_0x1465aa];if(_[_0xc4a8('0x44')](_0x235cb0[_0xc4a8('0x23')][_0xc94402['id']])){_0x235cb0[_0xc4a8('0x23')][_0xc94402['id']]=new FaxAccount(_0xc94402);}else{_0x235cb0['mergeFromDatabase'](_0x235cb0[_0xc4a8('0x23')][_0xc94402['id']],_0xc94402);}}}return _0x235cb0[_0xc4a8('0x23')];};};module['exports']=Realtime; \ No newline at end of file +var _0xe36a=['format','name','isNil','interface','SIP/%s','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','total','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initTelephones','length','isUndefined','initTriggers','initTemplates','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','sumHoldTime','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','mapKeys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe36a,0xa4));var _0xae36=function(_0x3e4bd5,_0x1191df){_0x3e4bd5=_0x3e4bd5-0x0;var _0x261d71=_0xe36a[_0x3e4bd5];return _0x261d71;};'use strict';var BPromise=require(_0xae36('0x0'));var util=require(_0xae36('0x1'));var _=require('lodash');var moment=require(_0xae36('0x2'));var Agent=require(_0xae36('0x3'));var Telephone=require(_0xae36('0x4'));var Trunk=require(_0xae36('0x5'));var VoiceQueue=require(_0xae36('0x6'));var Trigger=require(_0xae36('0x7'));var Template=require('../model/template');var Campaign=require(_0xae36('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xae36('0x9'));var FreshdeskAccount=require(_0xae36('0xa'));var SugarcrmAccount=require(_0xae36('0xb'));var ZohoAccount=require(_0xae36('0xc'));var DeskAccount=require(_0xae36('0xd'));var VtigerAccount=require(_0xae36('0xe'));var ServicenowAccount=require(_0xae36('0xf'));var Dynamics365Account=require(_0xae36('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xae36('0x11'));var Realtime=function(){this[_0xae36('0x12')]={};this[_0xae36('0x13')]={};this[_0xae36('0x14')]={};this[_0xae36('0x15')]={};this[_0xae36('0x16')]={};this[_0xae36('0x17')]={};this[_0xae36('0x18')]={};this[_0xae36('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xae36('0x1a')]={};this[_0xae36('0x1b')]={};this['queueChannels']={};this['outboundChannels']={};this[_0xae36('0x1c')]={};this['zendeskAccounts']={};this[_0xae36('0x1d')]={};this[_0xae36('0x1e')]={};this[_0xae36('0x1f')]={};this[_0xae36('0x20')]={};this[_0xae36('0x21')]={};this[_0xae36('0x22')]={};this[_0xae36('0x23')]={};this[_0xae36('0x24')]={};this[_0xae36('0x25')]={};this['faxAccounts']={};};function freeIsNotKey(_0x33c524,_0xca1242,_0x2c8f6c){var _0x26db23=_['mapKeys'](_0x33c524,function(_0x3a944a,_0x3f14cd){return _0x3a944a[_0x2c8f6c];});for(var _0x586b40 in _0xca1242){if(_0xca1242[_0xae36('0x26')](_0x586b40)){if(!_0x26db23[_0x586b40]){delete _0xca1242[_0x586b40];}}}}function freeIsNotKeySip(_0x392867,_0x511b64){var _0x2eeac0=_[_0xae36('0x27')](_0x392867,function(_0x42d245,_0x13cbb1){return util[_0xae36('0x28')]('SIP/%s',_0x42d245[_0xae36('0x29')]);});for(var _0x521d09 in _0x511b64){if(_0x511b64[_0xae36('0x26')](_0x521d09)){if(!_0x2eeac0[_0x521d09]){delete _0x511b64[_0x521d09];}}}}function freeIsNotKeyAgent(_0x5e996c,_0x1779f6){var _0x49c445=_['mapKeys'](_0x5e996c,function(_0xdc872b,_0x117dff){var _0x224b96=_[_0xae36('0x2a')](_0xdc872b[_0xae36('0x2b')])?util['format'](_0xae36('0x2c'),_0xdc872b[_0xae36('0x29')]):_0xdc872b[_0xae36('0x2b')];return _0x224b96;});for(var _0x29cf0f in _0x1779f6){if(_0x1779f6[_0xae36('0x26')](_0x29cf0f)){if(!_0x49c445[_0x29cf0f]){delete _0x1779f6[_0x29cf0f];}}}}function clearVoiceCallReports(_0x3992f2){_0x3992f2['total']=0x0;_0x3992f2[_0xae36('0x2d')]=0x0;_0x3992f2['sumHoldTime']=0x0;_0x3992f2[_0xae36('0x2e')]=0x0;_0x3992f2[_0xae36('0x2f')]=0x0;}function clearCampaigns(_0x3676a7){if(!_[_0xae36('0x30')](_0x3676a7)){for(var _0x491f53 in _0x3676a7){if(_0x3676a7[_0xae36('0x26')](_0x491f53)){_0x3676a7[_0x491f53][_0xae36('0x31')]=0x0;_0x3676a7[_0x491f53]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x468093){if(!_[_0xae36('0x30')](_0x468093)){for(var _0x47a9f1 in _0x468093){if(_0x468093[_0xae36('0x26')](_0x47a9f1)){_0x468093[_0x47a9f1][_0xae36('0x32')]=0x0;_0x468093[_0x47a9f1]['answered']=0x0;_0x468093[_0x47a9f1][_0xae36('0x33')]=0x0;_0x468093[_0x47a9f1][_0xae36('0x34')]=0x0;_0x468093[_0x47a9f1]['sumHoldTime']=0x0;_0x468093[_0x47a9f1]['sumDuration']=0x0;_0x468093[_0x47a9f1][_0xae36('0x2f')]=0x0;_0x468093[_0x47a9f1]['outboundAnswerAgiCallsDay']=0x0;_0x468093[_0x47a9f1][_0xae36('0x35')]=0x0;_0x468093[_0x47a9f1]['outboundBusyCallsDay']=0x0;_0x468093[_0x47a9f1]['outboundCongestionCallsDay']=0x0;_0x468093[_0x47a9f1][_0xae36('0x36')]=0x0;_0x468093[_0x47a9f1]['outboundUnknownCallsDay']=0x0;_0x468093[_0x47a9f1][_0xae36('0x37')]=0x0;_0x468093[_0x47a9f1][_0xae36('0x38')]=0x0;_0x468093[_0x47a9f1][_0xae36('0x39')]=0x0;_0x468093[_0x47a9f1][_0xae36('0x3a')]=0x0;_0x468093[_0x47a9f1]['outboundRejectCallsDay']=0x0;_0x468093[_0x47a9f1][_0xae36('0x3b')]=0x0;_0x468093[_0x47a9f1][_0xae36('0x3c')]=0x0;_0x468093[_0x47a9f1][_0xae36('0x3d')]=0x0;_0x468093[_0x47a9f1]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0xae36('0x3e')]=function(_0x22d5ea,_0xa1ac){for(var _0x27d237 in _0xa1ac){if(_0x22d5ea['hasOwnProperty'](_0x27d237)){_0x22d5ea[_0x27d237]=_0xa1ac[_0x27d237];}}};Realtime[_0xae36('0x3f')]['initAgents']=function(){var _0x25cc79=this;return function(_0x2e9947){if(_0x2e9947){freeIsNotKeyAgent(_0x2e9947,_0x25cc79['agents']);for(var _0x5f5dbd=0x0,_0x173bcc={},_0x4edb1d={};_0x5f5dbd<_0x2e9947['length'];_0x5f5dbd+=0x1){_0x173bcc=_0x2e9947[_0x5f5dbd];var _0x18ac20=_['isNil'](_0x173bcc['interface'])?util['format'](_0xae36('0x2c'),_0x173bcc[_0xae36('0x29')]):_0x173bcc[_0xae36('0x2b')];if(_['isUndefined'](_0x25cc79[_0xae36('0x12')][_0x18ac20])){_0x25cc79[_0xae36('0x12')][_0x18ac20]=new Agent(_0x173bcc);}else{_0x25cc79[_0xae36('0x3e')](_0x25cc79[_0xae36('0x12')][_0x18ac20],_0x173bcc);}}}return _0x25cc79[_0xae36('0x12')];};};Realtime[_0xae36('0x3f')][_0xae36('0x40')]=function(){var _0x16cb30=this;return function(_0x3b734f){if(_0x3b734f){freeIsNotKeySip(_0x3b734f,_0x16cb30[_0xae36('0x13')]);for(var _0x13b0b2=0x0,_0x245a2e={},_0x17ae59={};_0x13b0b2<_0x3b734f[_0xae36('0x41')];_0x13b0b2+=0x1){_0x245a2e=_0x3b734f[_0x13b0b2];if(_[_0xae36('0x42')](_0x16cb30[_0xae36('0x13')][util[_0xae36('0x28')](_0xae36('0x2c'),_0x245a2e[_0xae36('0x29')])])){_0x16cb30['telephones'][util[_0xae36('0x28')](_0xae36('0x2c'),_0x245a2e[_0xae36('0x29')])]=new Telephone(_0x245a2e);}else{_0x16cb30['mergeFromDatabase'](_0x16cb30[_0xae36('0x13')][util[_0xae36('0x28')](_0xae36('0x2c'),_0x245a2e[_0xae36('0x29')])],_0x245a2e);}}}return _0x16cb30[_0xae36('0x13')];};};Realtime[_0xae36('0x3f')]['initTrunks']=function(){var _0x371274=this;return function(_0x2f6f1c){if(_0x2f6f1c){freeIsNotKeySip(_0x2f6f1c,_0x371274[_0xae36('0x14')]);for(var _0x10c47d=0x0,_0x351f0c={},_0x4f0563={};_0x10c47d<_0x2f6f1c[_0xae36('0x41')];_0x10c47d+=0x1){_0x351f0c=_0x2f6f1c[_0x10c47d];if(_[_0xae36('0x42')](_0x371274[_0xae36('0x14')][util[_0xae36('0x28')](_0xae36('0x2c'),_0x351f0c[_0xae36('0x29')])])){_0x371274['trunks'][util[_0xae36('0x28')](_0xae36('0x2c'),_0x351f0c[_0xae36('0x29')])]=new Trunk(_0x351f0c);}else{_0x371274[_0xae36('0x3e')](_0x371274[_0xae36('0x14')][util[_0xae36('0x28')](_0xae36('0x2c'),_0x351f0c[_0xae36('0x29')])],_0x351f0c);}}}return _0x371274['trunks'];};};Realtime[_0xae36('0x3f')]['initVoiceQueues']=function(){var _0x688791=this;return function(_0x1ddd04){if(_0x1ddd04){freeIsNotKey(_0x1ddd04,_0x688791[_0xae36('0x15')],'name');for(var _0x2327b6=0x0,_0x1f3f19={},_0x2658bf={};_0x2327b6<_0x1ddd04['length'];_0x2327b6+=0x1){_0x1f3f19=_0x1ddd04[_0x2327b6];if(_[_0xae36('0x42')](_0x688791[_0xae36('0x15')][_0x1f3f19[_0xae36('0x29')]])){_0x688791[_0xae36('0x15')][_0x1f3f19['name']]=new VoiceQueue(_0x1f3f19);}else{_0x688791[_0xae36('0x3e')](_0x688791[_0xae36('0x15')][_0x1f3f19[_0xae36('0x29')]],_0x1f3f19);}}}return _0x688791['voiceQueues'];};};Realtime[_0xae36('0x3f')][_0xae36('0x43')]=function(){var _0x4a8dc6=this;return function(_0x356a5b){if(_0x356a5b){freeIsNotKey(_0x356a5b,_0x4a8dc6['triggers'],'id');for(var _0x1dd544=0x0,_0x22a14e={},_0x2a634d={};_0x1dd544<_0x356a5b[_0xae36('0x41')];_0x1dd544+=0x1){_0x22a14e=_0x356a5b[_0x1dd544];if(_['isUndefined'](_0x4a8dc6[_0xae36('0x16')][_0x22a14e['id']])){_0x4a8dc6[_0xae36('0x16')][_0x22a14e['id']]=new Trigger(_0x22a14e);}else{_0x4a8dc6['mergeFromDatabase'](_0x4a8dc6['triggers'][_0x22a14e['id']],_0x22a14e);}}}return _0x4a8dc6[_0xae36('0x16')];};};Realtime['prototype'][_0xae36('0x44')]=function(){var _0x8a4d0a=this;return function(_0xd5bd97){if(_0xd5bd97){freeIsNotKey(_0xd5bd97,_0x8a4d0a[_0xae36('0x18')],'id');for(var _0xefe1e3=0x0,_0xf8136b={},_0x1df0b9={};_0xefe1e3<_0xd5bd97[_0xae36('0x41')];_0xefe1e3+=0x1){_0xf8136b=_0xd5bd97[_0xefe1e3];if(_[_0xae36('0x42')](_0x8a4d0a[_0xae36('0x18')][_0xf8136b['id']])){_0x8a4d0a[_0xae36('0x18')][_0xf8136b['id']]=new Template(_0xf8136b);}else{_0x8a4d0a[_0xae36('0x3e')](_0x8a4d0a[_0xae36('0x18')][_0xf8136b['id']],_0xf8136b);}}}return _0x8a4d0a[_0xae36('0x18')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x4ca33e=this;return function(_0x54dbe6){if(_0x54dbe6){freeIsNotKey(_0x54dbe6,_0x4ca33e[_0xae36('0x45')],'id');for(var _0x34d394=0x0,_0x3f2345={},_0x139b23={};_0x34d394<_0x54dbe6['length'];_0x34d394+=0x1){_0x3f2345=_0x54dbe6[_0x34d394];if(_['isUndefined'](_0x4ca33e[_0xae36('0x45')][_0x3f2345['id']])){_0x4ca33e[_0xae36('0x45')][_0x3f2345['id']]=new ZendeskAccount(_0x3f2345);}else{_0x4ca33e['mergeFromDatabase'](_0x4ca33e['zendeskAccounts'][_0x3f2345['id']],_0x3f2345);}}}return _0x4ca33e[_0xae36('0x45')];};};Realtime[_0xae36('0x3f')]['initSalesforceAccounts']=function(){var _0x1a7983=this;return function(_0x5c4c93){if(_0x5c4c93){freeIsNotKey(_0x5c4c93,_0x1a7983[_0xae36('0x1d')],'id');for(var _0xf0c5fb=0x0,_0x3868aa={},_0x27478a={};_0xf0c5fb<_0x5c4c93[_0xae36('0x41')];_0xf0c5fb+=0x1){_0x3868aa=_0x5c4c93[_0xf0c5fb];if(_['isUndefined'](_0x1a7983[_0xae36('0x1d')][_0x3868aa['id']])){_0x1a7983['salesforceAccounts'][_0x3868aa['id']]=new SalesforceAccount(_0x3868aa);}else{_0x1a7983[_0xae36('0x3e')](_0x1a7983['salesforceAccounts'][_0x3868aa['id']],_0x3868aa);}}}return _0x1a7983[_0xae36('0x1d')];};};Realtime[_0xae36('0x3f')][_0xae36('0x46')]=function(){var _0x368be6=this;return function(_0x5c2a2c){if(_0x5c2a2c){freeIsNotKey(_0x5c2a2c,_0x368be6[_0xae36('0x1f')],'id');for(var _0x490959=0x0,_0x58918c={},_0x5d5b8f={};_0x490959<_0x5c2a2c['length'];_0x490959+=0x1){_0x58918c=_0x5c2a2c[_0x490959];if(_['isUndefined'](_0x368be6[_0xae36('0x1f')][_0x58918c['id']])){_0x368be6[_0xae36('0x1f')][_0x58918c['id']]=new FreshdeskAccount(_0x58918c);}else{_0x368be6['mergeFromDatabase'](_0x368be6[_0xae36('0x1f')][_0x58918c['id']],_0x58918c);}}}return _0x368be6[_0xae36('0x1f')];};};Realtime['prototype'][_0xae36('0x47')]=function(){var _0x1ce59d=this;return function(_0x472612){if(_0x472612){freeIsNotKey(_0x472612,_0x1ce59d[_0xae36('0x20')],'id');for(var _0x9a6913=0x0,_0x523897={},_0x351d4f={};_0x9a6913<_0x472612['length'];_0x9a6913+=0x1){_0x523897=_0x472612[_0x9a6913];if(_[_0xae36('0x42')](_0x1ce59d[_0xae36('0x20')][_0x523897['id']])){_0x1ce59d[_0xae36('0x20')][_0x523897['id']]=new ZohoAccount(_0x523897);}else{_0x1ce59d[_0xae36('0x3e')](_0x1ce59d[_0xae36('0x20')][_0x523897['id']],_0x523897);}}}return _0x1ce59d[_0xae36('0x20')];};};Realtime[_0xae36('0x3f')]['initDeskAccounts']=function(){var _0x3441db=this;return function(_0x46edb3){if(_0x46edb3){freeIsNotKey(_0x46edb3,_0x3441db[_0xae36('0x21')],'id');for(var _0x3b63a9=0x0,_0x599edd={},_0x2cb806={};_0x3b63a9<_0x46edb3[_0xae36('0x41')];_0x3b63a9+=0x1){_0x599edd=_0x46edb3[_0x3b63a9];if(_[_0xae36('0x42')](_0x3441db['deskAccounts'][_0x599edd['id']])){_0x3441db[_0xae36('0x21')][_0x599edd['id']]=new DeskAccount(_0x599edd);}else{_0x3441db[_0xae36('0x3e')](_0x3441db['deskAccounts'][_0x599edd['id']],_0x599edd);}}}return _0x3441db[_0xae36('0x21')];};};Realtime['prototype'][_0xae36('0x48')]=function(){var _0x4f27fd=this;return function(_0xa9ba17){if(_0xa9ba17){freeIsNotKey(_0xa9ba17,_0x4f27fd[_0xae36('0x1e')],'id');for(var _0x31f01f=0x0,_0x2cb15e={},_0x13ae75={};_0x31f01f<_0xa9ba17[_0xae36('0x41')];_0x31f01f+=0x1){_0x2cb15e=_0xa9ba17[_0x31f01f];if(_[_0xae36('0x42')](_0x4f27fd[_0xae36('0x1e')][_0x2cb15e['id']])){_0x4f27fd[_0xae36('0x1e')][_0x2cb15e['id']]=new SugarcrmAccount(_0x2cb15e);}else{_0x4f27fd[_0xae36('0x3e')](_0x4f27fd[_0xae36('0x1e')][_0x2cb15e['id']],_0x2cb15e);}}}return _0x4f27fd['sugarcrmAccounts'];};};Realtime[_0xae36('0x3f')]['initVtigerAccounts']=function(){var _0x419888=this;return function(_0x2c3b22){if(_0x2c3b22){freeIsNotKey(_0x2c3b22,_0x419888[_0xae36('0x22')],'id');for(var _0x30d74c=0x0,_0x277554={},_0x2c6338={};_0x30d74c<_0x2c3b22['length'];_0x30d74c+=0x1){_0x277554=_0x2c3b22[_0x30d74c];if(_[_0xae36('0x42')](_0x419888[_0xae36('0x22')][_0x277554['id']])){_0x419888['vtigerAccounts'][_0x277554['id']]=new VtigerAccount(_0x277554);}else{_0x419888['mergeFromDatabase'](_0x419888[_0xae36('0x22')][_0x277554['id']],_0x277554);}}}return _0x419888[_0xae36('0x22')];};};Realtime[_0xae36('0x3f')][_0xae36('0x49')]=function(){var _0x28e33e=this;return function(_0x2edfcd){if(_0x2edfcd){freeIsNotKey(_0x2edfcd,_0x28e33e[_0xae36('0x23')],'id');for(var _0x2f9cef=0x0,_0x2143c6={},_0x48eebe={};_0x2f9cef<_0x2edfcd[_0xae36('0x41')];_0x2f9cef+=0x1){_0x2143c6=_0x2edfcd[_0x2f9cef];if(_[_0xae36('0x42')](_0x28e33e[_0xae36('0x23')][_0x2143c6['id']])){_0x28e33e[_0xae36('0x23')][_0x2143c6['id']]=new ServicenowAccount(_0x2143c6);}else{_0x28e33e['mergeFromDatabase'](_0x28e33e['servicenowAccounts'][_0x2143c6['id']],_0x2143c6);}}}return _0x28e33e[_0xae36('0x23')];};};Realtime[_0xae36('0x3f')][_0xae36('0x4a')]=function(){var _0x16c59a=this;return function(_0x3f18ed){if(_0x3f18ed){freeIsNotKey(_0x3f18ed,_0x16c59a['dynamics365Accounts'],'id');for(var _0x1d7005=0x0,_0x50e6a0={},_0x20c248={};_0x1d7005<_0x3f18ed[_0xae36('0x41')];_0x1d7005+=0x1){_0x50e6a0=_0x3f18ed[_0x1d7005];if(_[_0xae36('0x42')](_0x16c59a[_0xae36('0x24')][_0x50e6a0['id']])){_0x16c59a[_0xae36('0x24')][_0x50e6a0['id']]=new Dynamics365Account(_0x50e6a0);}else{_0x16c59a['mergeFromDatabase'](_0x16c59a[_0xae36('0x24')][_0x50e6a0['id']],_0x50e6a0);}}}return _0x16c59a[_0xae36('0x24')];};};Realtime[_0xae36('0x3f')][_0xae36('0x4b')]=function(){var _0x28e5f5=this;return function(_0xccffe8){if(_0xccffe8){freeIsNotKey(_0xccffe8,_0x28e5f5[_0xae36('0x25')],'id');for(var _0xd378e4=0x0,_0x5bef8b={},_0x4dbb2c={};_0xd378e4<_0xccffe8['length'];_0xd378e4+=0x1){_0x5bef8b=_0xccffe8[_0xd378e4];if(_['isUndefined'](_0x28e5f5[_0xae36('0x25')][_0x5bef8b['id']])){_0x28e5f5[_0xae36('0x25')][_0x5bef8b['id']]=new FreshsalesAccount(_0x5bef8b);}else{_0x28e5f5[_0xae36('0x3e')](_0x28e5f5[_0xae36('0x25')][_0x5bef8b['id']],_0x5bef8b);}}}return _0x28e5f5['freshsalesAccounts'];};};Realtime[_0xae36('0x3f')][_0xae36('0x4c')]=function(){var _0x34e7bf=this;return function(_0x542d2c){for(var _0x5cb91b=0x0;_0x5cb91b<_0x542d2c['length'];_0x5cb91b+=0x1){_[_0xae36('0x4d')](_0x34e7bf['voiceQueues'][_0x542d2c[_0x5cb91b][_0xae36('0x29')]],_0x542d2c[_0x5cb91b]);}return _0x34e7bf[_0xae36('0x15')];};};Realtime[_0xae36('0x3f')][_0xae36('0x4e')]=function(){var _0x4c20ab=this;return function(_0x4b7091){clearVoiceQueues(_0x4c20ab[_0xae36('0x15')]);if(_0x4b7091){_0x4b7091=_[_0xae36('0x4f')](_0x4b7091,_0xae36('0x50'));for(var _0x45237f in _0x4b7091){if(_0x4b7091['hasOwnProperty'](_0x45237f)){var _0x336d7c={};for(var _0x4a1e67=0x0;_0x4a1e67<_0x4b7091[_0x45237f][_0xae36('0x41')];_0x4a1e67+=0x1){var _0x5506e2=_0x4b7091[_0x45237f][_0x4a1e67]['queue'];if(_0x4c20ab['voiceQueues'][_0x5506e2]){if(_0x4b7091[_0x45237f][_0x4a1e67][_0xae36('0x51')]){_0x4c20ab[_0xae36('0x15')][_0x5506e2][_0xae36('0x33')]+=0x1;}if(_0x4b7091[_0x45237f][_0x4a1e67][_0xae36('0x52')]){_0x4c20ab[_0xae36('0x15')][_0x5506e2][_0xae36('0x34')]+=0x1;}_0x4c20ab['voiceQueues'][_0x5506e2][_0xae36('0x53')]+=moment(_0x4b7091[_0x45237f][_0x4a1e67]['queuecallerleaveAt'])[_0xae36('0x54')](moment(_0x4b7091[_0x45237f][_0x4a1e67][_0xae36('0x55')]),_0xae36('0x56'))||0x0;if(_0x4a1e67===_0x4b7091[_0x45237f][_0xae36('0x41')]-0x1){_0x4c20ab[_0xae36('0x15')][_0x5506e2][_0xae36('0x2e')]+=moment(_0x4b7091[_0x45237f][_0x4a1e67][_0xae36('0x57')]||_0x4b7091[_0x45237f][_0x4a1e67][_0xae36('0x58')]||_0x4b7091[_0x45237f][_0x4a1e67][_0xae36('0x59')])['diff'](moment(_0x4b7091[_0x45237f][_0x4a1e67]['queuecallerjoinAt']),_0xae36('0x56'))||0x0;_0x4c20ab[_0xae36('0x15')][_0x5506e2]['total']+=0x1;if(_0x4b7091[_0x45237f][_0x4a1e67]['queuecallercomplete']){_0x4c20ab[_0xae36('0x15')][_0x5506e2][_0xae36('0x2d')]+=0x1;_0x4c20ab['voiceQueues'][_0x5506e2]['sumBillable']+=moment(_0x4b7091[_0x45237f][_0x4a1e67][_0xae36('0x57')])[_0xae36('0x54')](moment(_0x4b7091[_0x45237f][_0x4a1e67]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x4c20ab[_0xae36('0x15')][_0x5506e2][_0xae36('0x2e')]+=_0x4c20ab[_0xae36('0x15')][_0x5506e2][_0xae36('0x53')]||0x0;}}}}}}return _0x4c20ab[_0xae36('0x15')];};};Realtime[_0xae36('0x3f')][_0xae36('0x5a')]=function(){var _0x57e976=this;return function(_0x1c233e){clearVoiceCallReports(_0x57e976[_0xae36('0x19')]);if(_0x1c233e){for(var _0x1db25c=0x0;_0x1db25c<_0x1c233e[_0xae36('0x41')];_0x1db25c+=0x1){_0x57e976[_0xae36('0x19')][_0xae36('0x32')]+=0x1;_0x57e976[_0xae36('0x19')][_0xae36('0x2e')]+=_0x1c233e[_0x1db25c]['duration'];if(_0x1c233e[_0x1db25c]['disposition']===_0xae36('0x5b')){_0x57e976[_0xae36('0x19')][_0xae36('0x2d')]+=0x1;_0x57e976[_0xae36('0x19')][_0xae36('0x53')]+=_0x1c233e[_0x1db25c][_0xae36('0x5c')]-_0x1c233e[_0x1db25c][_0xae36('0x5d')]||0x0;_0x57e976['outbound'][_0xae36('0x2f')]+=_0x1c233e[_0x1db25c][_0xae36('0x5d')];}}}return _0x57e976[_0xae36('0x19')];};};Realtime['prototype'][_0xae36('0x5e')]=function(){var _0x4dd63c=this;return function(_0x4e8743){if(_0x4e8743){freeIsNotKey(_0x4e8743,_0x4dd63c[_0xae36('0x17')],_0xae36('0x29'));for(var _0x46a3fd=0x0,_0x5c1d4d={};_0x46a3fd<_0x4e8743[_0xae36('0x41')];_0x46a3fd+=0x1){_0x5c1d4d=_0x4e8743[_0x46a3fd];if(_[_0xae36('0x42')](_0x4dd63c[_0xae36('0x17')][_0x5c1d4d['name']])){_0x4dd63c[_0xae36('0x17')][_0x5c1d4d[_0xae36('0x29')]]=new Campaign(_0x5c1d4d);}else{_0x4dd63c[_0xae36('0x3e')](_0x4dd63c[_0xae36('0x17')][_0x5c1d4d['name']],_0x5c1d4d);_0x4dd63c['campaigns'][_0x5c1d4d[_0xae36('0x29')]][_0xae36('0x5f')]=_0x5c1d4d[_0xae36('0x60')]?_0x5c1d4d[_0xae36('0x60')]['name']:undefined;}}}return _0x4dd63c[_0xae36('0x17')];};};Realtime[_0xae36('0x3f')][_0xae36('0x61')]=function(){var _0x5a637c=this;return function(_0x35d383){if(_0x35d383){freeIsNotKey(_0x35d383,_0x5a637c[_0xae36('0x1a')],'id');for(var _0x2388f8=0x0,_0x5cfff5={};_0x2388f8<_0x35d383[_0xae36('0x41')];_0x2388f8+=0x1){_0x5cfff5=_0x35d383[_0x2388f8];if(_[_0xae36('0x42')](_0x5a637c[_0xae36('0x1a')][_0x5cfff5['id']])){_0x5a637c[_0xae36('0x1a')][_0x5cfff5['id']]=new VoiceExtension(_0x5cfff5);}else{_0x5a637c['mergeFromDatabase'](_0x5a637c[_0xae36('0x1a')][_0x5cfff5['id']],_0x5cfff5);}}}return _0x5a637c[_0xae36('0x1a')];};};Realtime['prototype'][_0xae36('0x62')]=function(){var _0x3e8009=this;return function(_0x280bb4){clearCampaigns(_0x3e8009['campaigns']);for(var _0x1008d1=0x0;_0x1008d1<_0x280bb4[_0xae36('0x41')];_0x1008d1+=0x1){_[_0xae36('0x4d')](_0x3e8009[_0xae36('0x17')][_0x280bb4[_0x1008d1]['name']],_0x280bb4[_0x1008d1]);}return _0x3e8009[_0xae36('0x17')];};};Realtime[_0xae36('0x3f')][_0xae36('0x63')]=function(){var _0x70fbbe=this;return function(_0x4c326f){if(_0x4c326f){freeIsNotKey(_0x4c326f,_0x70fbbe[_0xae36('0x64')],'id');for(var _0x53ae8d=0x0,_0x1df9f6={},_0x32769a={};_0x53ae8d<_0x4c326f[_0xae36('0x41')];_0x53ae8d+=0x1){_0x1df9f6=_0x4c326f[_0x53ae8d];if(_[_0xae36('0x42')](_0x70fbbe[_0xae36('0x64')][_0x1df9f6['id']])){_0x70fbbe['faxAccounts'][_0x1df9f6['id']]=new FaxAccount(_0x1df9f6);}else{_0x70fbbe[_0xae36('0x3e')](_0x70fbbe[_0xae36('0x64')][_0x1df9f6['id']],_0x1df9f6);}}}return _0x70fbbe[_0xae36('0x64')];};};module[_0xae36('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e57071f..98e7afc 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 _0xc67f=['assigned','lastAssignedTo','format','YYYY-MM-DD\x20HH:mm:ss','match','destination','exten','type','dialer','lastapplication','lastdata','queue','context','callerid','from-sip','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','calleridname','connectedlinename','membername','xcally-motion-dialer','create','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','findAgent','SIP/%s','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','find','accountcode','name','isNil','interface','length','connectedlinenum'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xc67f,0x1b7));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xfc67('0x0'));var _=require(_0xfc67('0x1'));var moment=require(_0xfc67('0x2'));var util=require(_0xfc67('0x3'));var config=require(_0xfc67('0x4'));var logger=require(_0xfc67('0x5'))('ami');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xfc67('0x6'));var RpcVoiceCallReport=require(_0xfc67('0x7'));var RpcVoiceDialReport=require(_0xfc67('0x8'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xfc67('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xfc67('0xa'));var VoiceAgentReport=require(_0xfc67('0xb'));var VoiceDialReport=require(_0xfc67('0xc'));var UserReport=require(_0xfc67('0xd'));function Report(_0x410e49){this[_0xfc67('0xe')]=_0x410e49;this[_0xfc67('0xf')]=_0x410e49[_0xfc67('0xf')];this[_0xfc67('0x10')]=_0x410e49[_0xfc67('0x10')];}Report[_0xfc67('0x11')]['sync']=function(_0x44b4f8){var _0x406799=new VoiceQueueReport(this[_0xfc67('0xe')]);var _0x1ae763=new VoiceAgentReport(this[_0xfc67('0xe')]);var _0x42707b=new VoiceDialReport(this[_0xfc67('0xe')]);var _0x347166=new VoiceCallReport(this[_0xfc67('0xe')]);var _0x4409ab=new UserReport(this['realtime']);if(config[_0xfc67('0x12')]&&config[_0xfc67('0x12')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0xfc67('0x13')][_0xfc67('0x14')](this));ami['on']('custom:voiceCallReport',this[_0xfc67('0x15')][_0xfc67('0x14')](this));ami['on'](_0xfc67('0x16'),this[_0xfc67('0x17')][_0xfc67('0x14')](this));ami['on']('custom:voiceDialReport',this[_0xfc67('0x18')][_0xfc67('0x14')](this));ami['on'](_0xfc67('0x19'),this[_0xfc67('0x1a')][_0xfc67('0x14')](this));ami['on']('attendedtransfer',this[_0xfc67('0x1b')][_0xfc67('0x14')](this));}};Report[_0xfc67('0x11')]['findAgent']=function(_0x2a7aad){var _0x185f82=undefined;_0x185f82=_[_0xfc67('0x1c')](this[_0xfc67('0xf')],function(_0x464718){return _0x464718[_0xfc67('0x1d')]==_0x2a7aad||_0x464718[_0xfc67('0x1e')]==_0x2a7aad;});if(_[_0xfc67('0x1f')](_0x185f82)){var _0xa6ceb1=_['find'](this[_0xfc67('0x10')],function(_0x1b0a7a){return _0x1b0a7a[_0xfc67('0x1d')]==_0x2a7aad||_0x1b0a7a[_0xfc67('0x1e')]==_0x2a7aad;});if(_0xa6ceb1){_0x185f82=_['find'](this[_0xfc67('0xf')],function(_0x2b36b2){return _0x2b36b2[_0xfc67('0x20')]==util['format']('SIP/%s',_0xa6ceb1[_0xfc67('0x1e')]);});}}return _0x185f82;};Report[_0xfc67('0x11')][_0xfc67('0x13')]=function(_0x287a47){for(var _0x1d6131=0x0;_0x1d6131<_0x287a47[_0xfc67('0x21')];_0x1d6131+=0x1){var _0x514851=this['findAgent'](_0x287a47[_0x1d6131][_0xfc67('0x22')]);if(_0x514851){_0x287a47[_0x1d6131][_0xfc67('0x1d')]=_0x514851[_0xfc67('0x1d')];_0x287a47[_0x1d6131][_0xfc67('0x23')]=!![];_0x287a47[_0x1d6131][_0xfc67('0x24')]=_0x514851[_0xfc67('0x1e')];_0x287a47[_0x1d6131][_0xfc67('0x20')]=_[_0xfc67('0x1f')](_0x514851[_0xfc67('0x20')])?util[_0xfc67('0x25')]('SIP/%s',_0x514851[_0xfc67('0x1e')]):_0x514851[_0xfc67('0x20')];if(_0x287a47[_0x1d6131]['queuecallercomplete']){_0x287a47[_0x1d6131]['queuecallercompleteAt']=moment()[_0xfc67('0x25')](_0xfc67('0x26'));}if(_0x287a47[_0x1d6131]['queuecallerexit']){_0x287a47[_0x1d6131]['queuecallerexitAt']=moment()[_0xfc67('0x25')](_0xfc67('0x26'));}RpcMemberReport['voiceQueueReport'](_0x287a47[_0x1d6131]);}RpcVoiceQueueReport['create'](_0x287a47[_0x1d6131]);}};function extractCalleridNumber(_0xd3aa1e){var _0x411900=_0xd3aa1e[_0xfc67('0x27')](/<(.*?)>/);return _0x411900?_0x411900[0x1]:_0xd3aa1e;}Report[_0xfc67('0x11')][_0xfc67('0x15')]=function(_0x55ecca){_0x55ecca[_0xfc67('0x28')]=_0x55ecca[_0xfc67('0x28')]||_0x55ecca[_0xfc67('0x29')];if(_0x55ecca[_0xfc67('0x2a')]==_0xfc67('0x2b')){_0x55ecca[_0xfc67('0x2c')]='queue';_0x55ecca[_0xfc67('0x2d')]=_0x55ecca[_0xfc67('0x2e')];if(_0x55ecca[_0xfc67('0x2f')]=='from-voip-provider'){_0x55ecca[_0xfc67('0x1d')]='';_0x55ecca['destination']=extractCalleridNumber(_0x55ecca[_0xfc67('0x30')]);}else if(_0x55ecca['context']==_0xfc67('0x31')){if(_0x55ecca[_0xfc67('0x28')]=='xcally-motion-preview'){_0x55ecca[_0xfc67('0x28')]=extractCalleridNumber(_0x55ecca['calleridpreview']);_0x55ecca[_0xfc67('0x32')]=_0x55ecca[_0xfc67('0x33')];_0x55ecca[_0xfc67('0x34')]=[_0x55ecca[_0xfc67('0x35')],_0x55ecca[_0xfc67('0x35')]=_0x55ecca[_0xfc67('0x34')]][0x0];_0x55ecca['callerid']=_0x55ecca[_0xfc67('0x36')];}else{_0x55ecca[_0xfc67('0x28')]=_0x55ecca[_0xfc67('0x32')];_0x55ecca['calleridnum']=_0x55ecca[_0xfc67('0x33')];if(_0x55ecca[_0xfc67('0x37')]==_0xfc67('0x38')){_0x55ecca[_0xfc67('0x1d')]=_0x55ecca['connectedlinenum'];}else{_0x55ecca[_0xfc67('0x1d')]='';}}}}else{_0x55ecca['callerid']=util[_0xfc67('0x25')](_0xfc67('0x39'),_0x55ecca['calleridname'],_0x55ecca['calleridnum']);}RpcVoiceCallReport['create'](_0x55ecca);if(_0x55ecca['monitor']){for(var _0x5c96b6=0x0;_0x5c96b6<_0x55ecca['monitors']['length'];_0x5c96b6+=0x1){_0x55ecca[_0xfc67('0x3a')]=_0x55ecca[_0xfc67('0x3b')][_0x5c96b6][_0xfc67('0x3c')];_0x55ecca[_0xfc67('0x3d')]=_0x55ecca[_0xfc67('0x3b')][_0x5c96b6][_0xfc67('0x3d')];if(_0x55ecca[_0xfc67('0x29')]==_0xfc67('0x3e')){_0x55ecca[_0xfc67('0x32')]=_0x55ecca[_0xfc67('0x22')];_0x55ecca[_0xfc67('0x3f')]=_0x55ecca[_0xfc67('0x40')];_0x55ecca[_0xfc67('0x22')]=_0x55ecca[_0xfc67('0x1d')];_0x55ecca[_0xfc67('0x40')]=_0x55ecca[_0xfc67('0x41')];_0x55ecca[_0xfc67('0x29')]=_0x55ecca[_0xfc67('0x33')];}else if(_0x55ecca['exten']==_0xfc67('0x42')){_0x55ecca[_0xfc67('0x32')]=_0x55ecca['destination'];_0x55ecca['exten']=_0x55ecca[_0xfc67('0x33')];}RpcVoiceRecording[_0xfc67('0x43')](_0x55ecca);}}};Report['prototype'][_0xfc67('0x17')]=function(_0x21d712){if(_[_0xfc67('0x44')](_0x21d712)){_0x21d712[_0xfc67('0x45')](function(_0x2eeda5){RpcVoiceAgentReport[_0xfc67('0x43')](_0x2eeda5);});}else{RpcVoiceAgentReport['create'](_0x21d712);}};Report[_0xfc67('0x11')][_0xfc67('0x18')]=function(_0x5ce3a2){RpcVoiceDialReport[_0xfc67('0x43')](_0x5ce3a2);var _0x41f171=undefined;var _0x228b30=_0x5ce3a2[_0xfc67('0x35')];if(_[_0xfc67('0x46')](_0x228b30,_0xfc67('0x47'))){var _0x2b962c=_0x228b30[_0xfc67('0x48')](_0x228b30[_0xfc67('0x49')]('/')+0x1,_0x228b30[_0xfc67('0x49')]('@'));_0x41f171=_[_0xfc67('0x1c')](this[_0xfc67('0xf')],function(_0x5e7696){return _0x5e7696[_0xfc67('0x4a')]==_0x2b962c||_0x5e7696[_0xfc67('0x4b')]==_0x2b962c||_0x5e7696[_0xfc67('0x1d')]==_0x2b962c;});}else{var _0x2b962c=_0x228b30[_0xfc67('0x48')](_0x228b30[_0xfc67('0x49')]('/')+0x1,_0x228b30[_0xfc67('0x4c')]('-'));_0x41f171=this[_0xfc67('0x4d')](_0x2b962c);}if(_0x41f171){_0x5ce3a2[_0xfc67('0x20')]=_[_0xfc67('0x1f')](_0x41f171[_0xfc67('0x20')])?util[_0xfc67('0x25')](_0xfc67('0x4e'),_0x41f171[_0xfc67('0x1e')]):_0x41f171[_0xfc67('0x20')];_0x5ce3a2[_0xfc67('0x41')]=_0x41f171[_0xfc67('0x1e')];_0x5ce3a2[_0xfc67('0x1d')]=_0x41f171[_0xfc67('0x1d')];RpcMemberReport[_0xfc67('0x18')](_0x5ce3a2);}};Report[_0xfc67('0x11')][_0xfc67('0x1a')]=function(_0x2bdf1f){RpcVoiceTransferReport[_0xfc67('0x1a')](_0x2bdf1f);};Report[_0xfc67('0x11')]['attendedTransfer']=function(_0x166eb5){RpcVoiceTransferReport[_0xfc67('0x1b')](_0x166eb5);};module['exports']=Report; \ No newline at end of file +var _0xfa79=['exten','type','dialer','queue','lastdata','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','calleridname','monitor','monitors','monitorFilename','filename','createdAt','membername','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','voiceQueueReport','create','match','destination'];(function(_0x52ba49,_0x928968){var _0x1a5618=function(_0x4e2db1){while(--_0x4e2db1){_0x52ba49['push'](_0x52ba49['shift']());}};_0x1a5618(++_0x928968);}(_0xfa79,0x175));var _0x9fa7=function(_0x20a9bc,_0x91481c){_0x20a9bc=_0x20a9bc-0x0;var _0x4897aa=_0xfa79[_0x20a9bc];return _0x4897aa;};'use strict';var BPromise=require(_0x9fa7('0x0'));var _=require(_0x9fa7('0x1'));var moment=require(_0x9fa7('0x2'));var util=require(_0x9fa7('0x3'));var config=require(_0x9fa7('0x4'));var logger=require(_0x9fa7('0x5'))(_0x9fa7('0x6'));var ami=require(_0x9fa7('0x7'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x9fa7('0x8'));var RpcMemberReport=require(_0x9fa7('0x9'));var RpcVoiceQueueReport=require(_0x9fa7('0xa'));var RpcVoiceRecording=require(_0x9fa7('0xb'));var RpcVoiceTransferReport=require(_0x9fa7('0xc'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x9fa7('0xd'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9fa7('0xe'));var UserReport=require(_0x9fa7('0xf'));function Report(_0x8a44a3){this[_0x9fa7('0x10')]=_0x8a44a3;this[_0x9fa7('0x11')]=_0x8a44a3[_0x9fa7('0x11')];this[_0x9fa7('0x12')]=_0x8a44a3[_0x9fa7('0x12')];}Report[_0x9fa7('0x13')][_0x9fa7('0x14')]=function(_0x1029e7){var _0x14c369=new VoiceQueueReport(this[_0x9fa7('0x10')]);var _0x189b52=new VoiceAgentReport(this[_0x9fa7('0x10')]);var _0x29db2c=new VoiceDialReport(this['realtime']);var _0x726267=new VoiceCallReport(this[_0x9fa7('0x10')]);var _0x40fbcf=new UserReport(this[_0x9fa7('0x10')]);if(config[_0x9fa7('0x15')]&&config[_0x9fa7('0x15')][_0x9fa7('0x16')]){ami['on'](_0x9fa7('0x17'),this['voiceQueueReport']['bind'](this));ami['on'](_0x9fa7('0x18'),this[_0x9fa7('0x19')][_0x9fa7('0x1a')](this));ami['on']('custom:voiceAgentReport',this[_0x9fa7('0x1b')]['bind'](this));ami['on'](_0x9fa7('0x1c'),this['voiceDialReport']['bind'](this));ami['on']('blindtransfer',this[_0x9fa7('0x1d')][_0x9fa7('0x1a')](this));ami['on'](_0x9fa7('0x1e'),this[_0x9fa7('0x1f')][_0x9fa7('0x1a')](this));}};Report[_0x9fa7('0x13')][_0x9fa7('0x20')]=function(_0x208f07){var _0x526f55=undefined;_0x526f55=_[_0x9fa7('0x21')](this[_0x9fa7('0x11')],function(_0x330f02){return _0x330f02[_0x9fa7('0x22')]==_0x208f07||_0x330f02[_0x9fa7('0x23')]==_0x208f07;});if(_[_0x9fa7('0x24')](_0x526f55)){var _0x208db9=_[_0x9fa7('0x21')](this[_0x9fa7('0x12')],function(_0x20a4be){return _0x20a4be[_0x9fa7('0x22')]==_0x208f07||_0x20a4be[_0x9fa7('0x23')]==_0x208f07;});if(_0x208db9){_0x526f55=_[_0x9fa7('0x21')](this['agents'],function(_0x40b4a5){return _0x40b4a5[_0x9fa7('0x25')]==util[_0x9fa7('0x26')](_0x9fa7('0x27'),_0x208db9[_0x9fa7('0x23')]);});}}return _0x526f55;};Report[_0x9fa7('0x13')]['voiceQueueReport']=function(_0x45723e){for(var _0x36ff84=0x0;_0x36ff84<_0x45723e[_0x9fa7('0x28')];_0x36ff84+=0x1){var _0xd2af2=this['findAgent'](_0x45723e[_0x36ff84][_0x9fa7('0x29')]);if(_0xd2af2){_0x45723e[_0x36ff84][_0x9fa7('0x22')]=_0xd2af2[_0x9fa7('0x22')];_0x45723e[_0x36ff84][_0x9fa7('0x2a')]=!![];_0x45723e[_0x36ff84][_0x9fa7('0x2b')]=_0xd2af2['name'];_0x45723e[_0x36ff84]['interface']=_[_0x9fa7('0x24')](_0xd2af2[_0x9fa7('0x25')])?util[_0x9fa7('0x26')](_0x9fa7('0x27'),_0xd2af2[_0x9fa7('0x23')]):_0xd2af2[_0x9fa7('0x25')];if(_0x45723e[_0x36ff84]['queuecallercomplete']){_0x45723e[_0x36ff84][_0x9fa7('0x2c')]=moment()[_0x9fa7('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x45723e[_0x36ff84][_0x9fa7('0x2d')]){_0x45723e[_0x36ff84][_0x9fa7('0x2e')]=moment()[_0x9fa7('0x26')](_0x9fa7('0x2f'));}RpcMemberReport[_0x9fa7('0x30')](_0x45723e[_0x36ff84]);}RpcVoiceQueueReport[_0x9fa7('0x31')](_0x45723e[_0x36ff84]);}};function extractCalleridNumber(_0x253063){var _0x3f867c=_0x253063[_0x9fa7('0x32')](/<(.*?)>/);return _0x3f867c?_0x3f867c[0x1]:_0x253063;}Report[_0x9fa7('0x13')][_0x9fa7('0x19')]=function(_0x1f9434){_0x1f9434[_0x9fa7('0x33')]=_0x1f9434[_0x9fa7('0x33')]||_0x1f9434[_0x9fa7('0x34')];if(_0x1f9434[_0x9fa7('0x35')]==_0x9fa7('0x36')){_0x1f9434['lastapplication']=_0x9fa7('0x37');_0x1f9434[_0x9fa7('0x38')]=_0x1f9434[_0x9fa7('0x37')];if(_0x1f9434['context']=='from-voip-provider'){_0x1f9434[_0x9fa7('0x22')]='';_0x1f9434['destination']=extractCalleridNumber(_0x1f9434['callerid']);}else if(_0x1f9434[_0x9fa7('0x39')]==_0x9fa7('0x3a')){if(_0x1f9434[_0x9fa7('0x33')]==_0x9fa7('0x3b')){_0x1f9434[_0x9fa7('0x33')]=extractCalleridNumber(_0x1f9434[_0x9fa7('0x3c')]);_0x1f9434[_0x9fa7('0x3d')]=_0x1f9434[_0x9fa7('0x3e')];_0x1f9434[_0x9fa7('0x3f')]=[_0x1f9434[_0x9fa7('0x40')],_0x1f9434[_0x9fa7('0x40')]=_0x1f9434['destinationchannel']][0x0];_0x1f9434[_0x9fa7('0x41')]=_0x1f9434[_0x9fa7('0x3c')];}else{_0x1f9434[_0x9fa7('0x33')]=_0x1f9434[_0x9fa7('0x3d')];_0x1f9434[_0x9fa7('0x3d')]=_0x1f9434[_0x9fa7('0x3e')];if(_0x1f9434[_0x9fa7('0x42')]==_0x9fa7('0x43')){_0x1f9434[_0x9fa7('0x22')]=_0x1f9434[_0x9fa7('0x29')];}else{_0x1f9434['accountcode']='';}}}}else{_0x1f9434[_0x9fa7('0x41')]=util[_0x9fa7('0x26')]('\x22%s\x22\x20<%s>',_0x1f9434[_0x9fa7('0x44')],_0x1f9434[_0x9fa7('0x3d')]);}RpcVoiceCallReport['create'](_0x1f9434);if(_0x1f9434[_0x9fa7('0x45')]){for(var _0x14284f=0x0;_0x14284f<_0x1f9434[_0x9fa7('0x46')]['length'];_0x14284f+=0x1){_0x1f9434[_0x9fa7('0x47')]=_0x1f9434[_0x9fa7('0x46')][_0x14284f][_0x9fa7('0x48')];_0x1f9434['createdAt']=_0x1f9434['monitors'][_0x14284f][_0x9fa7('0x49')];if(_0x1f9434[_0x9fa7('0x34')]==_0x9fa7('0x3b')){_0x1f9434[_0x9fa7('0x3d')]=_0x1f9434[_0x9fa7('0x29')];_0x1f9434[_0x9fa7('0x44')]=_0x1f9434['connectedlinename'];_0x1f9434['connectedlinenum']=_0x1f9434[_0x9fa7('0x22')];_0x1f9434['connectedlinename']=_0x1f9434[_0x9fa7('0x4a')];_0x1f9434[_0x9fa7('0x34')]=_0x1f9434[_0x9fa7('0x3e')];}else if(_0x1f9434[_0x9fa7('0x34')]=='xcally-motion-dialer'){_0x1f9434['calleridnum']=_0x1f9434[_0x9fa7('0x33')];_0x1f9434[_0x9fa7('0x34')]=_0x1f9434[_0x9fa7('0x3e')];}RpcVoiceRecording[_0x9fa7('0x31')](_0x1f9434);}}};Report[_0x9fa7('0x13')][_0x9fa7('0x1b')]=function(_0x24a14b){if(_[_0x9fa7('0x4b')](_0x24a14b)){_0x24a14b[_0x9fa7('0x4c')](function(_0x533277){RpcVoiceAgentReport[_0x9fa7('0x31')](_0x533277);});}else{RpcVoiceAgentReport[_0x9fa7('0x31')](_0x24a14b);}};Report[_0x9fa7('0x13')][_0x9fa7('0x4d')]=function(_0x352cc1){RpcVoiceDialReport[_0x9fa7('0x31')](_0x352cc1);var _0x441b1a=undefined;var _0x8257f4=_0x352cc1[_0x9fa7('0x40')];if(_[_0x9fa7('0x4e')](_0x8257f4,_0x9fa7('0x4f'))){var _0x3faba4=_0x8257f4[_0x9fa7('0x50')](_0x8257f4[_0x9fa7('0x51')]('/')+0x1,_0x8257f4['indexOf']('@'));_0x441b1a=_[_0x9fa7('0x21')](this['agents'],function(_0x41701d){return _0x41701d[_0x9fa7('0x52')]==_0x3faba4||_0x41701d[_0x9fa7('0x53')]==_0x3faba4||_0x41701d[_0x9fa7('0x22')]==_0x3faba4;});}else{var _0x3faba4=_0x8257f4[_0x9fa7('0x50')](_0x8257f4[_0x9fa7('0x51')]('/')+0x1,_0x8257f4['lastIndexOf']('-'));_0x441b1a=this[_0x9fa7('0x20')](_0x3faba4);}if(_0x441b1a){_0x352cc1['interface']=_[_0x9fa7('0x24')](_0x441b1a['interface'])?util[_0x9fa7('0x26')](_0x9fa7('0x27'),_0x441b1a[_0x9fa7('0x23')]):_0x441b1a[_0x9fa7('0x25')];_0x352cc1['membername']=_0x441b1a[_0x9fa7('0x23')];_0x352cc1[_0x9fa7('0x22')]=_0x441b1a[_0x9fa7('0x22')];RpcMemberReport[_0x9fa7('0x4d')](_0x352cc1);}};Report[_0x9fa7('0x13')][_0x9fa7('0x1d')]=function(_0x5d15b2){RpcVoiceTransferReport['blindTransfer'](_0x5d15b2);};Report[_0x9fa7('0x13')][_0x9fa7('0x1f')]=function(_0x170768){RpcVoiceTransferReport['attendedTransfer'](_0x170768);};module[_0x9fa7('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 2d7eaec..8c40fdc 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 _0x923a=['util','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','actionSipPeerStatus','catch','error','inspect','prototype','loopSyncRealTimeShow','[loopSyncRealTimeShow]','isNotNull','isUndefined','emit','find','username','stateRegistry','state','merge','omit','event','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','stateTime','toNumber','format','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','[syncDeviceState][UserReport]','peer','registered','status','address','updateStatusRealtime','[syncPeerStatus][UserReport]','lodash','bluebird'];(function(_0x17b8aa,_0x542724){var _0x2a5923=function(_0x323f63){while(--_0x323f63){_0x17b8aa['push'](_0x17b8aa['shift']());}};_0x2a5923(++_0x542724);}(_0x923a,0xc4));var _0xa923=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x923a[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xa923('0x0'));var moment=require('moment');var BPromise=require(_0xa923('0x1'));var util=require(_0xa923('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xa923('0x3'))(_0xa923('0x4'));var ami=require('../ami');config['redis']=_[_0xa923('0x5')](config[_0xa923('0x6')],{'host':_0xa923('0x7'),'port':0x18eb});var io=require(_0xa923('0x8'))(new Redis(config['redis']));function UserReport(_0x404e91){this['trunks']=_0x404e91[_0xa923('0x9')];this[_0xa923('0xa')]=_0x404e91[_0xa923('0xa')];this[_0xa923('0xb')]=_0x404e91[_0xa923('0xb')];ami['on'](_0xa923('0xc'),this[_0xa923('0xd')][_0xa923('0xe')](this));ami['on'](_0xa923('0xf'),this[_0xa923('0xd')][_0xa923('0xe')](this));ami['on'](_0xa923('0x10'),this[_0xa923('0x11')]['bind'](this));ami['on'](_0xa923('0x12'),this[_0xa923('0x13')][_0xa923('0xe')](this));this['loopSyncRealTimeShow']();return BPromise[_0xa923('0x14')]()[_0xa923('0x15')](ami[_0xa923('0x16')]())[_0xa923('0x15')](ami['actionDeviceStateList']())[_0xa923('0x15')](ami[_0xa923('0x17')]())[_0xa923('0x18')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x1310f1){return function(_0x55f71e){logger[_0xa923('0x19')](_0x1310f1,util[_0xa923('0x1a')](_0x55f71e,{'showHidden':![],'depth':null}));};}UserReport[_0xa923('0x1b')][_0xa923('0x1c')]=function(){setInterval(function(){BPromise[_0xa923('0x14')]()[_0xa923('0x15')](ami[_0xa923('0x16')]())[_0xa923('0x15')](ami['actionDeviceStateList']())[_0xa923('0x15')](ami[_0xa923('0x17')]())[_0xa923('0x18')](loggerCatch(_0xa923('0x1d')));},0x32c8);};UserReport[_0xa923('0x1b')][_0xa923('0x1e')]=function(_0x5dc207){return _0x5dc207!==null&&!_[_0xa923('0x1f')](_0x5dc207);};UserReport[_0xa923('0x1b')][_0xa923('0x20')]=function(_0x277869,_0x49a503,_0x5f07d0){io['to'](_0x277869)[_0xa923('0x20')](_0x49a503,_0x5f07d0);};UserReport[_0xa923('0x1b')]['syncRegistry']=function(_0x8ddc9b){try{if(this['isNotNull'](_0x8ddc9b)){var _0x26efe7=_[_0xa923('0x21')](this['trunks'],{'registry':_0x8ddc9b[_0xa923('0x22')]});if(_0x26efe7){_0x8ddc9b[_0xa923('0x23')]=_0x8ddc9b[_0xa923('0x24')];_[_0xa923('0x25')](_0x26efe7,_[_0xa923('0x26')](_0x8ddc9b,[_0xa923('0x27'),'actionid',_0xa923('0x22'),_0xa923('0x24')]));this[_0xa923('0x20')](util['format'](_0xa923('0x28'),_0x26efe7[_0xa923('0x29')]),_0xa923('0x2a'),_0x26efe7);}}}catch(_0x2aa479){logger[_0xa923('0x19')](_0xa923('0x2b'),util[_0xa923('0x1a')](_0x2aa479,{'showHidden':![],'depth':null}));}};UserReport[_0xa923('0x1b')][_0xa923('0x11')]=function(_0xfbf69f){try{if(this[_0xa923('0x1e')](_0xfbf69f)){if(this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]]){if(!this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x2d')]||_0xfbf69f['state'][_0xa923('0x2e')]()=='inuse'){this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x2d')]=![];if(this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x24')]!==_0xfbf69f['state'][_0xa923('0x2e')]()){this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x2f')]=_[_0xa923('0x30')](moment()[_0xa923('0x31')]('x'));}this[_0xa923('0xa')][_0xfbf69f['device']][_0xa923('0x24')]=_0xfbf69f[_0xa923('0x24')]['toLowerCase']();this[_0xa923('0xa')][_0xfbf69f[_0xa923('0x2c')]]['updateStatusRealtime'](_0xfbf69f);}}else if(this[_0xa923('0xb')][_0xfbf69f[_0xa923('0x2c')]]){if(this['telephones'][_0xfbf69f['device']][_0xa923('0x24')]!==_0xfbf69f[_0xa923('0x24')][_0xa923('0x2e')]()){this['telephones'][_0xfbf69f['device']][_0xa923('0x2f')]=_[_0xa923('0x30')](moment()[_0xa923('0x31')]('x'));}this[_0xa923('0xb')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x24')]=_0xfbf69f[_0xa923('0x24')][_0xa923('0x2e')]();this[_0xa923('0x20')](util[_0xa923('0x31')](_0xa923('0x32'),this['telephones'][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x29')]),_0xa923('0x33'),this[_0xa923('0xb')][_0xfbf69f[_0xa923('0x2c')]]);}else if(this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]]){if(this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]]['state']!==_0xfbf69f['state']['toLowerCase']()){this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x2f')]=_['toNumber'](moment()[_0xa923('0x31')]('x'));}this['trunks'][_0xfbf69f['device']][_0xa923('0x24')]=_0xfbf69f[_0xa923('0x24')][_0xa923('0x2e')]();this[_0xa923('0x20')](util['format'](_0xa923('0x28'),this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]][_0xa923('0x29')]),_0xa923('0x2a'),this[_0xa923('0x9')][_0xfbf69f[_0xa923('0x2c')]]);}else if(_[_0xa923('0x34')](_0xfbf69f[_0xa923('0x2c')],_0xa923('0x35'))){}else if(_[_0xa923('0x34')](_0xfbf69f[_0xa923('0x2c')],_0xa923('0x36'))){var _0x1fc862=_0xfbf69f[_0xa923('0x2c')];var _0x16f114=_0x1fc862[_0xa923('0x37')](_0x1fc862[_0xa923('0x38')]('/')+0x1,_0x1fc862[_0xa923('0x38')]('@'));var _0x3dba51=_['find'](this[_0xa923('0xa')],function(_0x199d23){return _0x199d23[_0xa923('0x39')]==_0x16f114||_0x199d23[_0xa923('0x3a')]==_0x16f114||_0x199d23['accountcode']==_0x16f114;});if(_0x3dba51){if(_0x3dba51[_0xa923('0x24')]!==_0xfbf69f['state']['toLowerCase']()){_0x3dba51['stateTime']=_[_0xa923('0x30')](moment()[_0xa923('0x31')]('x'));}_0x3dba51['state']=_0xfbf69f[_0xa923('0x24')][_0xa923('0x2e')]();_0x3dba51[_0xa923('0x2d')]=!![];_0x3dba51['updateStatusRealtime'](_0xfbf69f);}}else{}}}catch(_0x34a9ee){logger['error'](_0xa923('0x3b'),util[_0xa923('0x1a')](_0x34a9ee,{'showHidden':![],'depth':null}));}};UserReport[_0xa923('0x1b')][_0xa923('0x13')]=function(_0x60359){try{if(this[_0xa923('0x1e')](_0x60359)&&this['isNotNull'](_0x60359['peerstatus'])){if(this['agents'][_0x60359[_0xa923('0x3c')]]){if(!this[_0xa923('0xa')][_0x60359[_0xa923('0x3c')]]['local']||_0x60359[_0xa923('0x12')]['toLowerCase']()==_0xa923('0x3d')){this['agents'][_0x60359[_0xa923('0x3c')]][_0xa923('0x2d')]=![];this[_0xa923('0xa')][_0x60359[_0xa923('0x3c')]][_0xa923('0x3e')]=_0x60359['peerstatus'][_0xa923('0x2e')]();this[_0xa923('0xa')][_0x60359[_0xa923('0x3c')]][_0xa923('0x3f')]=_0x60359[_0xa923('0x3f')];this[_0xa923('0xa')][_0x60359[_0xa923('0x3c')]][_0xa923('0x40')](_0x60359);}}else if(this[_0xa923('0xb')][_0x60359[_0xa923('0x3c')]]){this[_0xa923('0xb')][_0x60359[_0xa923('0x3c')]][_0xa923('0x3e')]=_0x60359[_0xa923('0x12')]['toLowerCase']();this['telephones'][_0x60359[_0xa923('0x3c')]][_0xa923('0x3f')]=_0x60359[_0xa923('0x3f')];this['emit'](util[_0xa923('0x31')](_0xa923('0x32'),this[_0xa923('0xb')][_0x60359['peer']][_0xa923('0x29')]),_0xa923('0x33'),this['telephones'][_0x60359[_0xa923('0x3c')]]);}else if(this[_0xa923('0x9')][_0x60359['peer']]){this[_0xa923('0x9')][_0x60359[_0xa923('0x3c')]][_0xa923('0x3e')]=_0x60359[_0xa923('0x12')][_0xa923('0x2e')]();this[_0xa923('0x9')][_0x60359[_0xa923('0x3c')]]['address']=_0x60359[_0xa923('0x3f')];this[_0xa923('0x20')](util[_0xa923('0x31')](_0xa923('0x28'),this[_0xa923('0x9')][_0x60359[_0xa923('0x3c')]][_0xa923('0x29')]),_0xa923('0x2a'),this['trunks'][_0x60359['peer']]);}else{}}}catch(_0x723f58){logger[_0xa923('0x19')](_0xa923('0x41'),util[_0xa923('0x1a')](_0x723f58,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xcbd3=['[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','actionSipPeerStatus','[loopSyncRealTimeShow]','prototype','loopSyncRealTimeShow','actionDeviceStateList','isNotNull','isUndefined','emit','find','stateRegistry','merge','omit','event','username','state','format','trunk:save','error','[syncRegistry][UserReport]','inspect','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','name','telephone:save','startsWith','Local','indexOf','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','address','status','telephone:%s','trunk:%s'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xcbd3,0x10a));var _0x3cbd=function(_0xa7b963,_0x508a6c){_0xa7b963=_0xa7b963-0x0;var _0x3f43e5=_0xcbd3[_0xa7b963];return _0x3f43e5;};'use strict';var _=require(_0x3cbd('0x0'));var moment=require(_0x3cbd('0x1'));var BPromise=require(_0x3cbd('0x2'));var util=require(_0x3cbd('0x3'));var Redis=require(_0x3cbd('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3cbd('0x5'));var ami=require('../ami');config[_0x3cbd('0x6')]=_[_0x3cbd('0x7')](config[_0x3cbd('0x6')],{'host':_0x3cbd('0x8'),'port':0x18eb});var io=require(_0x3cbd('0x9'))(new Redis(config[_0x3cbd('0x6')]));function UserReport(_0x83668c){this[_0x3cbd('0xa')]=_0x83668c['trunks'];this[_0x3cbd('0xb')]=_0x83668c[_0x3cbd('0xb')];this[_0x3cbd('0xc')]=_0x83668c[_0x3cbd('0xc')];ami['on'](_0x3cbd('0xd'),this[_0x3cbd('0xe')][_0x3cbd('0xf')](this));ami['on'](_0x3cbd('0x10'),this['syncRegistry'][_0x3cbd('0xf')](this));ami['on'](_0x3cbd('0x11'),this[_0x3cbd('0x12')][_0x3cbd('0xf')](this));ami['on'](_0x3cbd('0x13'),this[_0x3cbd('0x14')][_0x3cbd('0xf')](this));this['loopSyncRealTimeShow']();return BPromise[_0x3cbd('0x15')]()[_0x3cbd('0x16')](ami[_0x3cbd('0x17')]())[_0x3cbd('0x16')](ami['actionDeviceStateList']())[_0x3cbd('0x16')](ami[_0x3cbd('0x18')]())['catch'](loggerCatch(_0x3cbd('0x19')));}function loggerCatch(_0x39cb02){return function(_0x51f3bf){logger['error'](_0x39cb02,util['inspect'](_0x51f3bf,{'showHidden':![],'depth':null}));};}UserReport[_0x3cbd('0x1a')][_0x3cbd('0x1b')]=function(){setInterval(function(){BPromise[_0x3cbd('0x15')]()[_0x3cbd('0x16')](ami[_0x3cbd('0x17')]())[_0x3cbd('0x16')](ami[_0x3cbd('0x1c')]())['then'](ami[_0x3cbd('0x18')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0x3cbd('0x1a')][_0x3cbd('0x1d')]=function(_0x2dafca){return _0x2dafca!==null&&!_[_0x3cbd('0x1e')](_0x2dafca);};UserReport[_0x3cbd('0x1a')][_0x3cbd('0x1f')]=function(_0x2ecedb,_0x28b157,_0x4926ab){io['to'](_0x2ecedb)[_0x3cbd('0x1f')](_0x28b157,_0x4926ab);};UserReport[_0x3cbd('0x1a')]['syncRegistry']=function(_0x313bde){try{if(this[_0x3cbd('0x1d')](_0x313bde)){var _0x4707ed=_[_0x3cbd('0x20')](this[_0x3cbd('0xa')],{'registry':_0x313bde['username']});if(_0x4707ed){_0x313bde[_0x3cbd('0x21')]=_0x313bde['state'];_[_0x3cbd('0x22')](_0x4707ed,_[_0x3cbd('0x23')](_0x313bde,[_0x3cbd('0x24'),'actionid',_0x3cbd('0x25'),_0x3cbd('0x26')]));this[_0x3cbd('0x1f')](util[_0x3cbd('0x27')]('trunk:%s',_0x4707ed['name']),_0x3cbd('0x28'),_0x4707ed);}}}catch(_0x23ea52){logger[_0x3cbd('0x29')](_0x3cbd('0x2a'),util[_0x3cbd('0x2b')](_0x23ea52,{'showHidden':![],'depth':null}));}};UserReport[_0x3cbd('0x1a')][_0x3cbd('0x12')]=function(_0x4a058c){try{if(this['isNotNull'](_0x4a058c)){if(this[_0x3cbd('0xb')][_0x4a058c[_0x3cbd('0x2c')]]){if(!this[_0x3cbd('0xb')][_0x4a058c[_0x3cbd('0x2c')]][_0x3cbd('0x2d')]||_0x4a058c[_0x3cbd('0x26')][_0x3cbd('0x2e')]()=='inuse'){this[_0x3cbd('0xb')][_0x4a058c[_0x3cbd('0x2c')]]['local']=![];if(this[_0x3cbd('0xb')][_0x4a058c[_0x3cbd('0x2c')]][_0x3cbd('0x26')]!==_0x4a058c[_0x3cbd('0x26')]['toLowerCase']()){this[_0x3cbd('0xb')][_0x4a058c['device']][_0x3cbd('0x2f')]=_[_0x3cbd('0x30')](moment()[_0x3cbd('0x27')]('x'));}this[_0x3cbd('0xb')][_0x4a058c['device']][_0x3cbd('0x26')]=_0x4a058c[_0x3cbd('0x26')][_0x3cbd('0x2e')]();this[_0x3cbd('0xb')][_0x4a058c['device']][_0x3cbd('0x31')](_0x4a058c);}}else if(this[_0x3cbd('0xc')][_0x4a058c[_0x3cbd('0x2c')]]){if(this[_0x3cbd('0xc')][_0x4a058c[_0x3cbd('0x2c')]]['state']!==_0x4a058c['state'][_0x3cbd('0x2e')]()){this['telephones'][_0x4a058c[_0x3cbd('0x2c')]][_0x3cbd('0x2f')]=_[_0x3cbd('0x30')](moment()[_0x3cbd('0x27')]('x'));}this['telephones'][_0x4a058c[_0x3cbd('0x2c')]][_0x3cbd('0x26')]=_0x4a058c['state'][_0x3cbd('0x2e')]();this[_0x3cbd('0x1f')](util[_0x3cbd('0x27')]('telephone:%s',this['telephones'][_0x4a058c[_0x3cbd('0x2c')]][_0x3cbd('0x32')]),_0x3cbd('0x33'),this[_0x3cbd('0xc')][_0x4a058c[_0x3cbd('0x2c')]]);}else if(this['trunks'][_0x4a058c[_0x3cbd('0x2c')]]){if(this[_0x3cbd('0xa')][_0x4a058c[_0x3cbd('0x2c')]][_0x3cbd('0x26')]!==_0x4a058c['state'][_0x3cbd('0x2e')]()){this['trunks'][_0x4a058c[_0x3cbd('0x2c')]]['stateTime']=_['toNumber'](moment()[_0x3cbd('0x27')]('x'));}this[_0x3cbd('0xa')][_0x4a058c[_0x3cbd('0x2c')]][_0x3cbd('0x26')]=_0x4a058c[_0x3cbd('0x26')][_0x3cbd('0x2e')]();this[_0x3cbd('0x1f')](util[_0x3cbd('0x27')]('trunk:%s',this[_0x3cbd('0xa')][_0x4a058c[_0x3cbd('0x2c')]]['name']),_0x3cbd('0x28'),this[_0x3cbd('0xa')][_0x4a058c[_0x3cbd('0x2c')]]);}else if(_[_0x3cbd('0x34')](_0x4a058c[_0x3cbd('0x2c')],'Queue')){}else if(_[_0x3cbd('0x34')](_0x4a058c[_0x3cbd('0x2c')],_0x3cbd('0x35'))){var _0x32dc4e=_0x4a058c[_0x3cbd('0x2c')];var _0xbfae55=_0x32dc4e['substring'](_0x32dc4e[_0x3cbd('0x36')]('/')+0x1,_0x32dc4e[_0x3cbd('0x36')]('@'));var _0xb4c7c3=_[_0x3cbd('0x20')](this[_0x3cbd('0xb')],function(_0xdb7fd9){return _0xdb7fd9['mobile']==_0xbfae55||_0xdb7fd9[_0x3cbd('0x37')]==_0xbfae55||_0xdb7fd9[_0x3cbd('0x38')]==_0xbfae55;});if(_0xb4c7c3){if(_0xb4c7c3[_0x3cbd('0x26')]!==_0x4a058c[_0x3cbd('0x26')]['toLowerCase']()){_0xb4c7c3['stateTime']=_[_0x3cbd('0x30')](moment()[_0x3cbd('0x27')]('x'));}_0xb4c7c3[_0x3cbd('0x26')]=_0x4a058c[_0x3cbd('0x26')]['toLowerCase']();_0xb4c7c3[_0x3cbd('0x2d')]=!![];_0xb4c7c3['updateStatusRealtime'](_0x4a058c);}}else{}}}catch(_0x5a918e){logger[_0x3cbd('0x29')](_0x3cbd('0x39'),util[_0x3cbd('0x2b')](_0x5a918e,{'showHidden':![],'depth':null}));}};UserReport[_0x3cbd('0x1a')]['syncPeerStatus']=function(_0x22678f){try{if(this[_0x3cbd('0x1d')](_0x22678f)&&this[_0x3cbd('0x1d')](_0x22678f[_0x3cbd('0x13')])){if(this[_0x3cbd('0xb')][_0x22678f[_0x3cbd('0x3a')]]){if(!this['agents'][_0x22678f[_0x3cbd('0x3a')]][_0x3cbd('0x2d')]||_0x22678f['peerstatus'][_0x3cbd('0x2e')]()==_0x3cbd('0x3b')){this[_0x3cbd('0xb')][_0x22678f['peer']]['local']=![];this[_0x3cbd('0xb')][_0x22678f[_0x3cbd('0x3a')]]['status']=_0x22678f['peerstatus'][_0x3cbd('0x2e')]();this[_0x3cbd('0xb')][_0x22678f['peer']][_0x3cbd('0x3c')]=_0x22678f[_0x3cbd('0x3c')];this['agents'][_0x22678f[_0x3cbd('0x3a')]]['updateStatusRealtime'](_0x22678f);}}else if(this[_0x3cbd('0xc')][_0x22678f[_0x3cbd('0x3a')]]){this[_0x3cbd('0xc')][_0x22678f[_0x3cbd('0x3a')]][_0x3cbd('0x3d')]=_0x22678f[_0x3cbd('0x13')][_0x3cbd('0x2e')]();this[_0x3cbd('0xc')][_0x22678f[_0x3cbd('0x3a')]][_0x3cbd('0x3c')]=_0x22678f['address'];this[_0x3cbd('0x1f')](util['format'](_0x3cbd('0x3e'),this[_0x3cbd('0xc')][_0x22678f['peer']][_0x3cbd('0x32')]),_0x3cbd('0x33'),this[_0x3cbd('0xc')][_0x22678f['peer']]);}else if(this[_0x3cbd('0xa')][_0x22678f[_0x3cbd('0x3a')]]){this[_0x3cbd('0xa')][_0x22678f[_0x3cbd('0x3a')]][_0x3cbd('0x3d')]=_0x22678f[_0x3cbd('0x13')][_0x3cbd('0x2e')]();this[_0x3cbd('0xa')][_0x22678f[_0x3cbd('0x3a')]][_0x3cbd('0x3c')]=_0x22678f[_0x3cbd('0x3c')];this[_0x3cbd('0x1f')](util[_0x3cbd('0x27')](_0x3cbd('0x3f'),this[_0x3cbd('0xa')][_0x22678f[_0x3cbd('0x3a')]][_0x3cbd('0x32')]),_0x3cbd('0x28'),this['trunks'][_0x22678f[_0x3cbd('0x3a')]]);}else{}}}catch(_0x839de2){logger['error'](_0x3cbd('0x40'),util['inspect'](_0x839de2,{'showHidden':![],'depth':null}));}};module[_0x3cbd('0x41')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index b5bb20c..d23725f 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 _0x0661=['syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','isNotNull','isUndefined','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','uniqueid','queue','type','inbound','merge','omit','event','privilege','emit','custom:agentcalled','format','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstatedesc','interface','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswer','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','agentringnoanswerAt','rejected','custom:agentringnoanswer','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','agent','acw','acwtime','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','transfer','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','channel','substring','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart'];(function(_0xccfcd5,_0x3ec100){var _0x409989=function(_0x4cf894){while(--_0x4cf894){_0xccfcd5['push'](_0xccfcd5['shift']());}};_0x409989(++_0x3ec100);}(_0x0661,0x162));var _0x1066=function(_0x28ca99,_0x4e900b){_0x28ca99=_0x28ca99-0x0;var _0x57b650=_0x0661[_0x28ca99];return _0x57b650;};'use strict';var _=require(_0x1066('0x0'));var moment=require(_0x1066('0x1'));var util=require('util');var Redis=require(_0x1066('0x2'));var config=require(_0x1066('0x3'));var logger=require(_0x1066('0x4'))('ami');var ami=require('../ami');config[_0x1066('0x5')]=_[_0x1066('0x6')](config[_0x1066('0x5')],{'host':_0x1066('0x7'),'port':0x18eb});var io=require(_0x1066('0x8'))(new Redis(config[_0x1066('0x5')]));function VoiceAgentReport(_0x37c6f5){this[_0x1066('0x9')]={};this[_0x1066('0xa')]=_0x37c6f5[_0x1066('0xa')];this[_0x1066('0xb')]=_0x37c6f5['agents'];this[_0x1066('0xc')]={};ami['on'](_0x1066('0xd'),this[_0x1066('0xe')]['bind'](this));ami['on'](_0x1066('0xf'),this[_0x1066('0x10')][_0x1066('0x11')](this));ami['on']('agentringnoanswer',this[_0x1066('0x12')][_0x1066('0x11')](this));ami['on'](_0x1066('0x13'),this['syncQueueCallerAbandon'][_0x1066('0x11')](this));ami['on'](_0x1066('0x14'),this[_0x1066('0x15')][_0x1066('0x11')](this));ami['on'](_0x1066('0x16'),this[_0x1066('0x17')][_0x1066('0x11')](this));ami['on'](_0x1066('0x18'),this[_0x1066('0x19')][_0x1066('0x11')](this));ami['on'](_0x1066('0x1a'),this[_0x1066('0x1b')][_0x1066('0x11')](this));ami['on']('musiconholdstop',this[_0x1066('0x1c')][_0x1066('0x11')](this));ami['on'](_0x1066('0x1d'),this[_0x1066('0x1e')][_0x1066('0x11')](this));ami['on'](_0x1066('0x1f'),this['syncBlindTransfer'][_0x1066('0x11')](this));}VoiceAgentReport[_0x1066('0x20')]['emit']=function(_0x4cfe46,_0x2ed4c1,_0x12e19e){io['to'](_0x4cfe46)['emit'](_0x2ed4c1,_0x12e19e);};VoiceAgentReport['prototype'][_0x1066('0x21')]=function(_0x3fee64){return _0x3fee64!==null&&!_[_0x1066('0x22')](_0x3fee64);};VoiceAgentReport[_0x1066('0x20')]['syncAgentCalled']=function(_0x3c53da){try{if(this[_0x1066('0x21')](_0x3c53da)){if(_[_0x1066('0x22')](this[_0x1066('0x9')][_0x3c53da['uniqueid']])){this[_0x1066('0x9')][_0x3c53da['uniqueid']]={};}if(_[_0x1066('0x22')](this[_0x1066('0x9')][_0x3c53da['uniqueid']][_0x3c53da[_0x1066('0x23')]])){this[_0x1066('0x9')][_0x3c53da['uniqueid']][_0x3c53da['destuniqueid']]={'agentcalledAt':moment()['format'](_0x1066('0x24')),'lastevent':_0x1066('0x25'),'variables':this[_0x1066('0xc')][_0x3c53da[_0x1066('0x26')]],'type':this[_0x1066('0xa')][_0x3c53da['queue']]?this['voiceQueues'][_0x3c53da[_0x1066('0x27')]][_0x1066('0x28')]||_0x1066('0x29'):_0x1066('0x29')};}_[_0x1066('0x2a')](this[_0x1066('0x9')][_0x3c53da[_0x1066('0x26')]][_0x3c53da[_0x1066('0x23')]],_[_0x1066('0x2b')](_0x3c53da,[_0x1066('0x2c'),_0x1066('0x2d')]));ami[_0x1066('0x2e')](_0x1066('0x2f'),this[_0x1066('0x9')][_0x3c53da[_0x1066('0x26')]][_0x3c53da['destuniqueid']]);this[_0x1066('0x2e')](util[_0x1066('0x30')](_0x1066('0x31'),_0x3c53da[_0x1066('0x32')]),_0x1066('0x33'),this[_0x1066('0x9')][_0x3c53da[_0x1066('0x26')]][_0x3c53da[_0x1066('0x23')]]);}}catch(_0x1c806d){logger[_0x1066('0x34')](_0x1066('0x35'),util['inspect'](_0x1c806d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x10')]=function(_0x2b5a44){try{if(this[_0x1066('0x21')](_0x2b5a44)){if(this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]]){for(var _0x197b5d in this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]]){if(this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x1066('0x36')](_0x197b5d)){if(_0x2b5a44[_0x1066('0x23')]===_0x197b5d){this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x37')]=moment()[_0x1066('0x30')](_0x1066('0x24'));this[_0x1066('0x9')][_0x2b5a44['uniqueid']][_0x197b5d][_0x1066('0x38')]=_0x1066('0x39');this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x3a')]=_0x2b5a44[_0x1066('0x3a')];this[_0x1066('0x9')][_0x2b5a44['uniqueid']][_0x197b5d]['connectedlinenum']=_0x2b5a44[_0x1066('0x3b')];this[_0x1066('0x9')][_0x2b5a44['uniqueid']][_0x197b5d][_0x1066('0x3c')]=_0x2b5a44[_0x1066('0x3c')];this['channels'][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['destchannelstate']=_0x2b5a44['destchannelstate'];this['channels'][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['destchannelstatedesc']=_0x2b5a44[_0x1066('0x3d')];_[_0x1066('0x2a')](this[_0x1066('0xb')][_0x2b5a44[_0x1066('0x3e')]],_['pick'](_0x2b5a44,[_0x1066('0x27'),_0x1066('0x3f')]));this[_0x1066('0x2e')](util[_0x1066('0x30')]('user:%s',_0x2b5a44['membername']),_0x1066('0x40'),this['channels'][_0x2b5a44[_0x1066('0x26')]][_0x2b5a44['destuniqueid']]);ami[_0x1066('0x2e')](_0x1066('0x41'),this[_0x1066('0x9')][_0x2b5a44['uniqueid']][_0x197b5d]);}else if(!this['channels'][_0x2b5a44['uniqueid']][_0x197b5d][_0x1066('0x42')]&&!this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x14')]){this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['agentringnoanswer']=!![];this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['agentringnoanswerAt']=moment()[_0x1066('0x30')](_0x1066('0x24'));this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x43')]=_0x1066('0x44');this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]['lastevent']=_0x1066('0x44');this['channels'][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x45')]=_0x2b5a44[_0x1066('0x23')];this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d][_0x1066('0x46')]=_0x2b5a44[_0x1066('0x32')];ami['emit'](_0x1066('0x47'),this[_0x1066('0x9')][_0x2b5a44[_0x1066('0x26')]][_0x197b5d]);}}}}}}catch(_0x18a57b){logger[_0x1066('0x34')](_0x1066('0x48'),util[_0x1066('0x49')](_0x18a57b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x12')]=function(_0x3b05ec){try{if(this[_0x1066('0x21')](_0x3b05ec)){if(this['channels'][_0x3b05ec[_0x1066('0x26')]]&&this['channels'][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]]){this[_0x1066('0x9')][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]][_0x1066('0x42')]=!![];this[_0x1066('0x9')][_0x3b05ec['uniqueid']][_0x3b05ec[_0x1066('0x23')]][_0x1066('0x4a')]=moment()[_0x1066('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]][_0x1066('0x43')]='rejected';this[_0x1066('0x9')][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]]['lastevent']=_0x1066('0x4b');ami[_0x1066('0x2e')](_0x1066('0x4c'),this[_0x1066('0x9')][_0x3b05ec[_0x1066('0x26')]][_0x3b05ec[_0x1066('0x23')]]);}}}catch(_0x31eb9c){logger[_0x1066('0x34')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x1066('0x49')](_0x31eb9c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x4d')]=function(_0x258dd2){try{if(this[_0x1066('0x21')](_0x258dd2)){if(this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]]){for(var _0x5f50d3 in this['channels'][_0x258dd2[_0x1066('0x26')]]){if(this['channels'][_0x258dd2[_0x1066('0x26')]]['hasOwnProperty'](_0x5f50d3)&&!this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3]['agentringnoanswer']&&!this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3][_0x1066('0x14')]){this['channels'][_0x258dd2[_0x1066('0x26')]][_0x5f50d3]['agentringnoanswer']=!![];this[_0x1066('0x9')][_0x258dd2['uniqueid']][_0x5f50d3][_0x1066('0x4a')]=moment()[_0x1066('0x30')](_0x1066('0x24'));this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3]['reason']=_0x1066('0x4e');this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3][_0x1066('0x38')]='abandoned';ami[_0x1066('0x2e')](_0x1066('0x4f'),this[_0x1066('0x9')][_0x258dd2[_0x1066('0x26')]][_0x5f50d3]);}}}}}catch(_0xa8d001){logger[_0x1066('0x34')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x1066('0x49')](_0xa8d001,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x15')]=function(_0x25229e){try{if(this[_0x1066('0x21')](_0x25229e)){if(this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]]){for(var _0x4d969c in this['channels'][_0x25229e[_0x1066('0x26')]]){if(this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x1066('0x36')](_0x4d969c)){if(this['channels'][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x37')]&&!this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x14')]){this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x14')]=!![];this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x50')]=moment()[_0x1066('0x30')](_0x1066('0x24'));this['channels'][_0x25229e[_0x1066('0x26')]][_0x4d969c]['lastevent']=_0x1066('0x51');this['channels'][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x52')]=_0x25229e[_0x1066('0x52')];this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x43')]=_0x25229e[_0x1066('0x43')]=='transfer'?_0x1066('0x53'):_0x25229e[_0x1066('0x43')];if(this['voiceQueues'][_0x25229e[_0x1066('0x27')]]&&this['voiceQueues'][_0x25229e[_0x1066('0x27')]][_0x1066('0x54')]){this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c]['agentacw']=!![];this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c][_0x1066('0x55')]=this[_0x1066('0xa')][_0x25229e[_0x1066('0x27')]][_0x1066('0x56')];}this[_0x1066('0xb')][_0x25229e[_0x1066('0x3e')]]=_['omit'](this[_0x1066('0xb')][_0x25229e[_0x1066('0x3e')]],[_0x1066('0x27'),_0x1066('0x3f')]);this[_0x1066('0x2e')](util[_0x1066('0x30')](_0x1066('0x31'),_0x25229e[_0x1066('0x32')]),_0x1066('0x57'),this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c]);ami[_0x1066('0x2e')](_0x1066('0x58'),this[_0x1066('0x9')][_0x25229e[_0x1066('0x26')]][_0x4d969c]);}}}}}}catch(_0x21fa3b){logger['error'](_0x1066('0x59'),util[_0x1066('0x49')](_0x21fa3b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1066('0x17')]=function(_0xf70a0c){try{if(this[_0x1066('0x21')](_0xf70a0c)){this[_0x1066('0x5a')](_0xf70a0c[_0x1066('0x26')],_[_0x1066('0x5b')](_0xf70a0c[_0x1066('0x5c')])[0x0],_0xf70a0c[_0x1066('0x5d')]);if(this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]]){for(var _0x15f208 in this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]]){if(this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]][_0x1066('0x36')](_0x15f208)){if(_[_0x1066('0x22')](this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]][_0x15f208]['variables'])){this[_0x1066('0x9')][_0xf70a0c['uniqueid']][_0x15f208][_0x1066('0xc')]={};}this[_0x1066('0x9')][_0xf70a0c[_0x1066('0x26')]][_0x15f208]['variables']=this[_0x1066('0xc')][_0xf70a0c[_0x1066('0x26')]];}}}}}catch(_0xa97c5d){logger[_0x1066('0x34')](_0x1066('0x5e'),util[_0x1066('0x49')](_0xa97c5d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x5a')]=function(_0x153743,_0x1b56b7,_0x2e7b01){var _0x346295=[_0x1066('0x5f'),_0x1066('0x60'),_0x1066('0x61'),_0x1066('0x62'),_0x1066('0x63'),_0x1066('0x64'),_0x1066('0x65'),'rtpaudioqosrttbridged',_0x1066('0x66'),_0x1066('0x67'),_0x1066('0x68'),_0x1066('0x69'),_0x1066('0x6a'),_0x1066('0x6b'),_0x1066('0x6c'),_0x1066('0x6d'),_0x1066('0x32'),'memberpenalty','memberrealtime'];if(!_[_0x1066('0x6e')](_0x1b56b7)&&!_['includes'](_0x346295,_0x1b56b7)){if(_['isUndefined'](this[_0x1066('0xc')][_0x153743])){this[_0x1066('0xc')][_0x153743]={};}this['variables'][_0x153743][_0x1b56b7]=_0x2e7b01;}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x19')]=function(_0x4d7301){try{if(this[_0x1066('0x21')](_0x4d7301)){if(this[_0x1066('0x9')][_0x4d7301[_0x1066('0x26')]]){for(var _0x46634a in this[_0x1066('0x9')][_0x4d7301['uniqueid']]){if(this[_0x1066('0x9')][_0x4d7301[_0x1066('0x26')]][_0x1066('0x36')](_0x46634a)){if(this[_0x1066('0x9')][_0x4d7301[_0x1066('0x26')]][_0x46634a][_0x1066('0x43')]==_0x1066('0x6f')&&this[_0x1066('0x9')][_0x4d7301['uniqueid']][_0x46634a][_0x1066('0x14')]){this['channels'][_0x4d7301[_0x1066('0x26')]][_0x46634a]['agentcompleteAt']=moment()[_0x1066('0x30')](_0x1066('0x24'));}}}ami[_0x1066('0x2e')](_0x1066('0x70'),_['values'](this['channels'][_0x4d7301[_0x1066('0x26')]]));delete this[_0x1066('0x9')][_0x4d7301['uniqueid']];}if(this[_0x1066('0xc')][_0x4d7301[_0x1066('0x26')]]){delete this[_0x1066('0xc')][_0x4d7301[_0x1066('0x26')]];}}}catch(_0xbc6514){logger[_0x1066('0x34')](_0x1066('0x71'),util['inspect'](_0xbc6514,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x1e')]=function(_0x3b1948){try{if(this[_0x1066('0x21')](_0x3b1948)){if(this['channels'][_0x3b1948[_0x1066('0x72')]]){for(var _0x1b3700 in this[_0x1066('0x9')][_0x3b1948[_0x1066('0x72')]]){if(this['channels'][_0x3b1948[_0x1066('0x72')]]['hasOwnProperty'](_0x1b3700)){if(_0x3b1948[_0x1066('0x73')]===_0x1b3700){var _0x1f4030=moment();this[_0x1066('0x9')][_0x3b1948[_0x1066('0x72')]][_0x1b3700][_0x1066('0x14')]=!![];this['channels'][_0x3b1948[_0x1066('0x72')]][_0x1b3700]['agentcompleteAt']=moment()[_0x1066('0x30')](_0x1066('0x24'));this['channels'][_0x3b1948['transfereeuniqueid']][_0x1b3700][_0x1066('0x43')]=_0x1066('0x6f');this[_0x1066('0x9')][_0x3b1948['transfereeuniqueid']][_0x1b3700][_0x1066('0x38')]=_0x1066('0x51');this[_0x1066('0x9')][_0x3b1948[_0x1066('0x72')]][_0x1b3700][_0x1066('0x52')]=_0x1f4030[_0x1066('0x74')](this[_0x1066('0x9')][_0x3b1948['transfereeuniqueid']][_0x1b3700]['agentconnectAt'],'seconds');}}}}if(this['channels'][_0x3b1948[_0x1066('0x75')]]){var _0x245971=this[_0x1066('0x9')][_0x3b1948[_0x1066('0x75')]];this[_0x1066('0x9')][_0x3b1948[_0x1066('0x75')]]=this[_0x1066('0x9')][_0x3b1948['transfereeuniqueid']];this[_0x1066('0x9')][_0x3b1948[_0x1066('0x72')]]=_0x245971;}}}catch(_0x468e45){logger[_0x1066('0x34')](_0x1066('0x76'),util[_0x1066('0x49')](_0x468e45,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x77')]=function(_0x16756b){try{if(this[_0x1066('0x21')](_0x16756b)){if(this[_0x1066('0x9')][_0x16756b['transfereeuniqueid']]){for(var _0x2ca028 in this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]]){if(this[_0x1066('0x9')][_0x16756b['transfereeuniqueid']][_0x1066('0x36')](_0x2ca028)){if(_0x16756b[_0x1066('0x78')]===_0x2ca028){var _0x15e397=moment();this['channels'][_0x16756b[_0x1066('0x72')]][_0x2ca028]['agentcomplete']=!![];this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]][_0x2ca028][_0x1066('0x50')]=_0x15e397;this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]][_0x2ca028][_0x1066('0x43')]=_0x1066('0x6f');this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]][_0x2ca028][_0x1066('0x38')]=_0x1066('0x51');this['channels'][_0x16756b['transfereeuniqueid']][_0x2ca028]['talktime']=_0x15e397[_0x1066('0x74')](this[_0x1066('0x9')][_0x16756b[_0x1066('0x72')]][_0x2ca028]['agentconnectAt'],'seconds');}}}}}}catch(_0x2218c6){logger[_0x1066('0x34')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x1066('0x49')](_0x2218c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')]['syncMusicOnHoldStart']=function(_0x1fc0c0){var _0x4073a3='';try{if(this[_0x1066('0x21')](_0x1fc0c0)){if(_0x1fc0c0[_0x1066('0x79')]){_0x4073a3=_0x1fc0c0[_0x1066('0x79')][_0x1066('0x7a')](0x0,_0x1fc0c0['channel']['lastIndexOf']('-'));if(this['agents'][_0x4073a3]){this['agents'][_0x4073a3]['onhold']=!![];}}}}catch(_0x466c5a){logger[_0x1066('0x34')](_0x1066('0x7b'),util[_0x1066('0x49')](_0x466c5a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1066('0x20')][_0x1066('0x1c')]=function(_0x640029){var _0x4103bd='';try{if(this[_0x1066('0x21')](_0x640029)){if(_0x640029[_0x1066('0x79')]){_0x4103bd=_0x640029[_0x1066('0x79')][_0x1066('0x7a')](0x0,_0x640029[_0x1066('0x79')][_0x1066('0x7c')]('-'));if(this['agents'][_0x4103bd]){this[_0x1066('0xb')][_0x4103bd][_0x1066('0x7d')]=![];}}}}catch(_0x5798b8){logger[_0x1066('0x34')](_0x1066('0x7e'),util[_0x1066('0x49')](_0x5798b8,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x2fea=['../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','event','privilege','custom:agentcalled','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','merge','interface','pick','user:%s','user:agentconnect','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','syncAgentComplete','agentcompleteAt','complete','talktime','agent','acwtime','acwTimeout','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','value','hasOwnProperty','[syncVarSet][VoiceAgentReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','transfer','values','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment'];(function(_0x424d23,_0x5d500a){var _0x5b815f=function(_0x15b666){while(--_0x15b666){_0x424d23['push'](_0x424d23['shift']());}};_0x5b815f(++_0x5d500a);}(_0x2fea,0xf9));var _0xa2fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2fea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa2fe('0x0'));var moment=require(_0xa2fe('0x1'));var util=require(_0xa2fe('0x2'));var Redis=require(_0xa2fe('0x3'));var config=require(_0xa2fe('0x4'));var logger=require(_0xa2fe('0x5'))(_0xa2fe('0x6'));var ami=require(_0xa2fe('0x7'));config[_0xa2fe('0x8')]=_[_0xa2fe('0x9')](config['redis'],{'host':_0xa2fe('0xa'),'port':0x18eb});var io=require(_0xa2fe('0xb'))(new Redis(config['redis']));function VoiceAgentReport(_0x5f2599){this[_0xa2fe('0xc')]={};this[_0xa2fe('0xd')]=_0x5f2599[_0xa2fe('0xd')];this[_0xa2fe('0xe')]=_0x5f2599[_0xa2fe('0xe')];this[_0xa2fe('0xf')]={};ami['on'](_0xa2fe('0x10'),this[_0xa2fe('0x11')]['bind'](this));ami['on'](_0xa2fe('0x12'),this[_0xa2fe('0x13')][_0xa2fe('0x14')](this));ami['on'](_0xa2fe('0x15'),this[_0xa2fe('0x16')][_0xa2fe('0x14')](this));ami['on'](_0xa2fe('0x17'),this['syncQueueCallerAbandon'][_0xa2fe('0x14')](this));ami['on'](_0xa2fe('0x18'),this['syncAgentComplete']['bind'](this));ami['on'](_0xa2fe('0x19'),this[_0xa2fe('0x1a')][_0xa2fe('0x14')](this));ami['on'](_0xa2fe('0x1b'),this[_0xa2fe('0x1c')][_0xa2fe('0x14')](this));ami['on']('musiconholdstart',this[_0xa2fe('0x1d')]['bind'](this));ami['on']('musiconholdstop',this[_0xa2fe('0x1e')]['bind'](this));ami['on'](_0xa2fe('0x1f'),this[_0xa2fe('0x20')]['bind'](this));ami['on']('blindtransfer',this[_0xa2fe('0x21')]['bind'](this));}VoiceAgentReport['prototype'][_0xa2fe('0x22')]=function(_0x5a40bd,_0x243b80,_0x325d42){io['to'](_0x5a40bd)['emit'](_0x243b80,_0x325d42);};VoiceAgentReport[_0xa2fe('0x23')]['isNotNull']=function(_0x5a5841){return _0x5a5841!==null&&!_['isUndefined'](_0x5a5841);};VoiceAgentReport['prototype'][_0xa2fe('0x11')]=function(_0x5b96b5){try{if(this[_0xa2fe('0x24')](_0x5b96b5)){if(_[_0xa2fe('0x25')](this[_0xa2fe('0xc')][_0x5b96b5[_0xa2fe('0x26')]])){this[_0xa2fe('0xc')][_0x5b96b5[_0xa2fe('0x26')]]={};}if(_[_0xa2fe('0x25')](this[_0xa2fe('0xc')][_0x5b96b5[_0xa2fe('0x26')]][_0x5b96b5[_0xa2fe('0x27')]])){this[_0xa2fe('0xc')][_0x5b96b5[_0xa2fe('0x26')]][_0x5b96b5[_0xa2fe('0x27')]]={'agentcalledAt':moment()[_0xa2fe('0x28')](_0xa2fe('0x29')),'lastevent':_0xa2fe('0x2a'),'variables':this['variables'][_0x5b96b5['uniqueid']],'type':this[_0xa2fe('0xd')][_0x5b96b5[_0xa2fe('0x2b')]]?this[_0xa2fe('0xd')][_0x5b96b5[_0xa2fe('0x2b')]][_0xa2fe('0x2c')]||_0xa2fe('0x2d'):_0xa2fe('0x2d')};}_['merge'](this[_0xa2fe('0xc')][_0x5b96b5[_0xa2fe('0x26')]][_0x5b96b5[_0xa2fe('0x27')]],_[_0xa2fe('0x2e')](_0x5b96b5,[_0xa2fe('0x2f'),_0xa2fe('0x30')]));ami[_0xa2fe('0x22')](_0xa2fe('0x31'),this[_0xa2fe('0xc')][_0x5b96b5[_0xa2fe('0x26')]][_0x5b96b5['destuniqueid']]);this[_0xa2fe('0x22')](util[_0xa2fe('0x28')]('user:%s',_0x5b96b5[_0xa2fe('0x32')]),_0xa2fe('0x33'),this[_0xa2fe('0xc')][_0x5b96b5[_0xa2fe('0x26')]][_0x5b96b5[_0xa2fe('0x27')]]);}}catch(_0x1f5ce2){logger[_0xa2fe('0x34')](_0xa2fe('0x35'),util[_0xa2fe('0x36')](_0x1f5ce2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa2fe('0x23')][_0xa2fe('0x13')]=function(_0xe8b520){try{if(this[_0xa2fe('0x24')](_0xe8b520)){if(this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]]){for(var _0x1dbc10 in this[_0xa2fe('0xc')][_0xe8b520['uniqueid']]){if(this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]]['hasOwnProperty'](_0x1dbc10)){if(_0xe8b520[_0xa2fe('0x27')]===_0x1dbc10){this['channels'][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x37')]=moment()[_0xa2fe('0x28')](_0xa2fe('0x29'));this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x38')]=_0xa2fe('0x39');this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x3a')]=_0xe8b520['holdtime'];this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x3b')]=_0xe8b520[_0xa2fe('0x3b')];this[_0xa2fe('0xc')][_0xe8b520['uniqueid']][_0x1dbc10][_0xa2fe('0x3c')]=_0xe8b520[_0xa2fe('0x3c')];this['channels'][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x3d')]=_0xe8b520[_0xa2fe('0x3d')];this['channels'][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x3e')]=_0xe8b520[_0xa2fe('0x3e')];_[_0xa2fe('0x3f')](this[_0xa2fe('0xe')][_0xe8b520[_0xa2fe('0x40')]],_[_0xa2fe('0x41')](_0xe8b520,[_0xa2fe('0x2b'),'destconnectedlinenum']));this[_0xa2fe('0x22')](util['format'](_0xa2fe('0x42'),_0xe8b520['membername']),_0xa2fe('0x43'),this['channels'][_0xe8b520[_0xa2fe('0x26')]][_0xe8b520[_0xa2fe('0x27')]]);ami[_0xa2fe('0x22')](_0xa2fe('0x44'),this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10]);}else if(!this['channels'][_0xe8b520['uniqueid']][_0x1dbc10][_0xa2fe('0x15')]&&!this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x18')]){this['channels'][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x15')]=!![];this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x45')]=moment()[_0xa2fe('0x28')](_0xa2fe('0x29'));this['channels'][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x46')]=_0xa2fe('0x47');this[_0xa2fe('0xc')][_0xe8b520['uniqueid']][_0x1dbc10]['lastevent']='answered_elsewhere';this['channels'][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x48')]=_0xe8b520[_0xa2fe('0x27')];this[_0xa2fe('0xc')][_0xe8b520[_0xa2fe('0x26')]][_0x1dbc10][_0xa2fe('0x49')]=_0xe8b520['membername'];ami[_0xa2fe('0x22')](_0xa2fe('0x4a'),this[_0xa2fe('0xc')][_0xe8b520['uniqueid']][_0x1dbc10]);}}}}}}catch(_0x3143a5){logger[_0xa2fe('0x34')](_0xa2fe('0x4b'),util[_0xa2fe('0x36')](_0x3143a5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa2fe('0x23')][_0xa2fe('0x16')]=function(_0x1dcb79){try{if(this['isNotNull'](_0x1dcb79)){if(this[_0xa2fe('0xc')][_0x1dcb79[_0xa2fe('0x26')]]&&this['channels'][_0x1dcb79['uniqueid']][_0x1dcb79[_0xa2fe('0x27')]]){this[_0xa2fe('0xc')][_0x1dcb79[_0xa2fe('0x26')]][_0x1dcb79[_0xa2fe('0x27')]]['agentringnoanswer']=!![];this[_0xa2fe('0xc')][_0x1dcb79[_0xa2fe('0x26')]][_0x1dcb79[_0xa2fe('0x27')]][_0xa2fe('0x45')]=moment()[_0xa2fe('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa2fe('0xc')][_0x1dcb79[_0xa2fe('0x26')]][_0x1dcb79['destuniqueid']][_0xa2fe('0x46')]=_0xa2fe('0x4c');this[_0xa2fe('0xc')][_0x1dcb79[_0xa2fe('0x26')]][_0x1dcb79[_0xa2fe('0x27')]][_0xa2fe('0x38')]=_0xa2fe('0x4c');ami[_0xa2fe('0x22')](_0xa2fe('0x4d'),this[_0xa2fe('0xc')][_0x1dcb79[_0xa2fe('0x26')]][_0x1dcb79['destuniqueid']]);}}}catch(_0x18002c){logger['error'](_0xa2fe('0x4e'),util[_0xa2fe('0x36')](_0x18002c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa2fe('0x23')][_0xa2fe('0x4f')]=function(_0x38175c){try{if(this['isNotNull'](_0x38175c)){if(this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]]){for(var _0x56f4b7 in this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]]){if(this['channels'][_0x38175c[_0xa2fe('0x26')]]['hasOwnProperty'](_0x56f4b7)&&!this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]][_0x56f4b7][_0xa2fe('0x15')]&&!this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]][_0x56f4b7][_0xa2fe('0x18')]){this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]][_0x56f4b7][_0xa2fe('0x15')]=!![];this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]][_0x56f4b7][_0xa2fe('0x45')]=moment()[_0xa2fe('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]][_0x56f4b7][_0xa2fe('0x46')]='abandoned';this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]][_0x56f4b7][_0xa2fe('0x38')]=_0xa2fe('0x50');ami[_0xa2fe('0x22')](_0xa2fe('0x51'),this[_0xa2fe('0xc')][_0x38175c[_0xa2fe('0x26')]][_0x56f4b7]);}}}}}catch(_0x205e3e){logger[_0xa2fe('0x34')](_0xa2fe('0x52'),util[_0xa2fe('0x36')](_0x205e3e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa2fe('0x23')][_0xa2fe('0x53')]=function(_0x1fbc30){try{if(this[_0xa2fe('0x24')](_0x1fbc30)){if(this[_0xa2fe('0xc')][_0x1fbc30['uniqueid']]){for(var _0x427667 in this[_0xa2fe('0xc')][_0x1fbc30[_0xa2fe('0x26')]]){if(this[_0xa2fe('0xc')][_0x1fbc30['uniqueid']]['hasOwnProperty'](_0x427667)){if(this['channels'][_0x1fbc30['uniqueid']][_0x427667][_0xa2fe('0x37')]&&!this[_0xa2fe('0xc')][_0x1fbc30[_0xa2fe('0x26')]][_0x427667]['agentcomplete']){this[_0xa2fe('0xc')][_0x1fbc30[_0xa2fe('0x26')]][_0x427667][_0xa2fe('0x18')]=!![];this['channels'][_0x1fbc30[_0xa2fe('0x26')]][_0x427667][_0xa2fe('0x54')]=moment()[_0xa2fe('0x28')](_0xa2fe('0x29'));this[_0xa2fe('0xc')][_0x1fbc30[_0xa2fe('0x26')]][_0x427667][_0xa2fe('0x38')]=_0xa2fe('0x55');this[_0xa2fe('0xc')][_0x1fbc30['uniqueid']][_0x427667]['talktime']=_0x1fbc30[_0xa2fe('0x56')];this[_0xa2fe('0xc')][_0x1fbc30[_0xa2fe('0x26')]][_0x427667]['reason']=_0x1fbc30[_0xa2fe('0x46')]=='transfer'?_0xa2fe('0x57'):_0x1fbc30[_0xa2fe('0x46')];if(this['voiceQueues'][_0x1fbc30['queue']]&&this[_0xa2fe('0xd')][_0x1fbc30['queue']]['acw']){this[_0xa2fe('0xc')][_0x1fbc30[_0xa2fe('0x26')]][_0x427667]['agentacw']=!![];this['channels'][_0x1fbc30[_0xa2fe('0x26')]][_0x427667][_0xa2fe('0x58')]=this['voiceQueues'][_0x1fbc30[_0xa2fe('0x2b')]][_0xa2fe('0x59')];}this[_0xa2fe('0xe')][_0x1fbc30['interface']]=_[_0xa2fe('0x2e')](this[_0xa2fe('0xe')][_0x1fbc30['interface']],['queue','destconnectedlinenum']);this['emit'](util['format']('user:%s',_0x1fbc30[_0xa2fe('0x32')]),'user:agentcomplete',this[_0xa2fe('0xc')][_0x1fbc30[_0xa2fe('0x26')]][_0x427667]);ami['emit'](_0xa2fe('0x5a'),this['channels'][_0x1fbc30[_0xa2fe('0x26')]][_0x427667]);}}}}}}catch(_0x23cee3){logger['error'](_0xa2fe('0x5b'),util['inspect'](_0x23cee3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa2fe('0x23')][_0xa2fe('0x1a')]=function(_0x3ca5eb){try{if(this[_0xa2fe('0x24')](_0x3ca5eb)){this[_0xa2fe('0x5c')](_0x3ca5eb['uniqueid'],_['keys'](_0x3ca5eb[_0xa2fe('0x5d')])[0x0],_0x3ca5eb[_0xa2fe('0x5e')]);if(this[_0xa2fe('0xc')][_0x3ca5eb[_0xa2fe('0x26')]]){for(var _0x2eb1a9 in this[_0xa2fe('0xc')][_0x3ca5eb[_0xa2fe('0x26')]]){if(this[_0xa2fe('0xc')][_0x3ca5eb[_0xa2fe('0x26')]][_0xa2fe('0x5f')](_0x2eb1a9)){if(_[_0xa2fe('0x25')](this[_0xa2fe('0xc')][_0x3ca5eb[_0xa2fe('0x26')]][_0x2eb1a9]['variables'])){this[_0xa2fe('0xc')][_0x3ca5eb[_0xa2fe('0x26')]][_0x2eb1a9]['variables']={};}this['channels'][_0x3ca5eb[_0xa2fe('0x26')]][_0x2eb1a9][_0xa2fe('0xf')]=this[_0xa2fe('0xf')][_0x3ca5eb['uniqueid']];}}}}}catch(_0x13e8e8){logger[_0xa2fe('0x34')](_0xa2fe('0x60'),util['inspect'](_0x13e8e8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa2fe('0x23')][_0xa2fe('0x5c')]=function(_0x2b296d,_0x388420,_0x1850a8){var _0x39e70f=['rtpaudioqos',_0xa2fe('0x61'),_0xa2fe('0x62'),_0xa2fe('0x63'),_0xa2fe('0x64'),_0xa2fe('0x65'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xa2fe('0x66'),_0xa2fe('0x67'),_0xa2fe('0x68'),_0xa2fe('0x69'),_0xa2fe('0x6a'),_0xa2fe('0x6b'),_0xa2fe('0x6c'),_0xa2fe('0x6d'),'membername',_0xa2fe('0x6e'),_0xa2fe('0x6f')];if(!_['isNil'](_0x388420)&&!_['includes'](_0x39e70f,_0x388420)){if(_[_0xa2fe('0x25')](this[_0xa2fe('0xf')][_0x2b296d])){this[_0xa2fe('0xf')][_0x2b296d]={};}this[_0xa2fe('0xf')][_0x2b296d][_0x388420]=_0x1850a8;}};VoiceAgentReport['prototype'][_0xa2fe('0x1c')]=function(_0x1f6ca9){try{if(this[_0xa2fe('0x24')](_0x1f6ca9)){if(this[_0xa2fe('0xc')][_0x1f6ca9[_0xa2fe('0x26')]]){for(var _0x36f38b in this['channels'][_0x1f6ca9[_0xa2fe('0x26')]]){if(this[_0xa2fe('0xc')][_0x1f6ca9['uniqueid']]['hasOwnProperty'](_0x36f38b)){if(this[_0xa2fe('0xc')][_0x1f6ca9[_0xa2fe('0x26')]][_0x36f38b][_0xa2fe('0x46')]==_0xa2fe('0x70')&&this[_0xa2fe('0xc')][_0x1f6ca9[_0xa2fe('0x26')]][_0x36f38b][_0xa2fe('0x18')]){this[_0xa2fe('0xc')][_0x1f6ca9['uniqueid']][_0x36f38b][_0xa2fe('0x54')]=moment()[_0xa2fe('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0xa2fe('0x22')]('custom:voiceAgentReport',_[_0xa2fe('0x71')](this[_0xa2fe('0xc')][_0x1f6ca9['uniqueid']]));delete this[_0xa2fe('0xc')][_0x1f6ca9[_0xa2fe('0x26')]];}if(this['variables'][_0x1f6ca9[_0xa2fe('0x26')]]){delete this[_0xa2fe('0xf')][_0x1f6ca9[_0xa2fe('0x26')]];}}}catch(_0x37512d){logger[_0xa2fe('0x34')]('[syncHangup][VoiceAgentReport]',util[_0xa2fe('0x36')](_0x37512d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa2fe('0x23')][_0xa2fe('0x20')]=function(_0x88b65e){try{if(this[_0xa2fe('0x24')](_0x88b65e)){if(this['channels'][_0x88b65e[_0xa2fe('0x72')]]){for(var _0x48427d in this[_0xa2fe('0xc')][_0x88b65e[_0xa2fe('0x72')]]){if(this['channels'][_0x88b65e[_0xa2fe('0x72')]][_0xa2fe('0x5f')](_0x48427d)){if(_0x88b65e[_0xa2fe('0x73')]===_0x48427d){var _0x479ffa=moment();this[_0xa2fe('0xc')][_0x88b65e[_0xa2fe('0x72')]][_0x48427d][_0xa2fe('0x18')]=!![];this[_0xa2fe('0xc')][_0x88b65e[_0xa2fe('0x72')]][_0x48427d][_0xa2fe('0x54')]=moment()[_0xa2fe('0x28')](_0xa2fe('0x29'));this[_0xa2fe('0xc')][_0x88b65e[_0xa2fe('0x72')]][_0x48427d][_0xa2fe('0x46')]=_0xa2fe('0x70');this[_0xa2fe('0xc')][_0x88b65e[_0xa2fe('0x72')]][_0x48427d][_0xa2fe('0x38')]='complete';this[_0xa2fe('0xc')][_0x88b65e[_0xa2fe('0x72')]][_0x48427d]['talktime']=_0x479ffa[_0xa2fe('0x74')](this['channels'][_0x88b65e['transfereeuniqueid']][_0x48427d]['agentconnectAt'],_0xa2fe('0x75'));}}}}if(this[_0xa2fe('0xc')][_0x88b65e['secondtransfereruniqueid']]){var _0xfb9698=this[_0xa2fe('0xc')][_0x88b65e[_0xa2fe('0x76')]];this['channels'][_0x88b65e[_0xa2fe('0x76')]]=this[_0xa2fe('0xc')][_0x88b65e['transfereeuniqueid']];this['channels'][_0x88b65e['transfereeuniqueid']]=_0xfb9698;}}}catch(_0x134188){logger[_0xa2fe('0x34')]('[syncAttendedTransfer][VoiceAgentReport]',util['inspect'](_0x134188,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa2fe('0x23')]['syncBlindTransfer']=function(_0x2be7a1){try{if(this[_0xa2fe('0x24')](_0x2be7a1)){if(this[_0xa2fe('0xc')][_0x2be7a1[_0xa2fe('0x72')]]){for(var _0x2bd83f in this['channels'][_0x2be7a1[_0xa2fe('0x72')]]){if(this['channels'][_0x2be7a1['transfereeuniqueid']][_0xa2fe('0x5f')](_0x2bd83f)){if(_0x2be7a1['transfereruniqueid']===_0x2bd83f){var _0x5c22d9=moment();this[_0xa2fe('0xc')][_0x2be7a1[_0xa2fe('0x72')]][_0x2bd83f][_0xa2fe('0x18')]=!![];this['channels'][_0x2be7a1['transfereeuniqueid']][_0x2bd83f]['agentcompleteAt']=_0x5c22d9;this[_0xa2fe('0xc')][_0x2be7a1[_0xa2fe('0x72')]][_0x2bd83f][_0xa2fe('0x46')]=_0xa2fe('0x70');this[_0xa2fe('0xc')][_0x2be7a1[_0xa2fe('0x72')]][_0x2bd83f][_0xa2fe('0x38')]='complete';this[_0xa2fe('0xc')][_0x2be7a1[_0xa2fe('0x72')]][_0x2bd83f]['talktime']=_0x5c22d9[_0xa2fe('0x74')](this['channels'][_0x2be7a1['transfereeuniqueid']][_0x2bd83f][_0xa2fe('0x37')],'seconds');}}}}}}catch(_0x241c7d){logger['error'](_0xa2fe('0x77'),util['inspect'](_0x241c7d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa2fe('0x1d')]=function(_0x15b49f){var _0x1031be='';try{if(this[_0xa2fe('0x24')](_0x15b49f)){if(_0x15b49f[_0xa2fe('0x78')]){_0x1031be=_0x15b49f[_0xa2fe('0x78')][_0xa2fe('0x79')](0x0,_0x15b49f[_0xa2fe('0x78')][_0xa2fe('0x7a')]('-'));if(this['agents'][_0x1031be]){this[_0xa2fe('0xe')][_0x1031be][_0xa2fe('0x7b')]=!![];}}}}catch(_0x3b6e2c){logger[_0xa2fe('0x34')](_0xa2fe('0x7c'),util['inspect'](_0x3b6e2c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa2fe('0x1e')]=function(_0x4a569e){var _0x1013e5='';try{if(this['isNotNull'](_0x4a569e)){if(_0x4a569e[_0xa2fe('0x78')]){_0x1013e5=_0x4a569e[_0xa2fe('0x78')][_0xa2fe('0x79')](0x0,_0x4a569e['channel'][_0xa2fe('0x7a')]('-'));if(this[_0xa2fe('0xe')][_0x1013e5]){this[_0xa2fe('0xe')][_0x1013e5][_0xa2fe('0x7b')]=![];}}}}catch(_0x49a3f4){logger['error'](_0xa2fe('0x7d'),util['inspect'](_0x49a3f4,{'showHidden':![],'depth':null}));}};module[_0xa2fe('0x7e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 3925e88..869a891 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 _0x3836=['secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','syncBlindTransfer','transfercalleridnum','transfereecalleridnum','extension','syncHangup','BlindTransfer','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','defaults','redis','localhost','socket.io-emitter','channels','agents','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','log','prototype','isNotNull','emit','linkedid','isUndefined','merge','uniqueid','keys','error','[syncNewCallerId][VoiceCallReport]','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','pick','context','from-sip','channel','destconnectedlinenum','exten','user:%s','split','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','disposition','includes','lastdata','startsWith','cdr(','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','calleridnum','xcally-motion-preview','connectedlinename','calleridname','UserId','membername','monitor','endsWith','.wav49','.WAV','monitorFilename','find','isNil','monitors','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone','xmd-callerid','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','xmcs-queue','sipcallid','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum'];(function(_0xf5c7bf,_0x3a157d){var _0x1425e6=function(_0x1124f1){while(--_0x1124f1){_0xf5c7bf['push'](_0xf5c7bf['shift']());}};_0x1425e6(++_0x3a157d);}(_0x3836,0x140));var _0x6383=function(_0x4ff145,_0x514ca9){_0x4ff145=_0x4ff145-0x0;var _0x159db2=_0x3836[_0x4ff145];return _0x159db2;};'use strict';var BPromise=require(_0x6383('0x0'));var _=require('lodash');var moment=require(_0x6383('0x1'));var util=require(_0x6383('0x2'));var path=require(_0x6383('0x3'));var Redis=require(_0x6383('0x4'));var config=require(_0x6383('0x5'));var logger=require(_0x6383('0x6'))('ami');var ami=require(_0x6383('0x7'));var Channel=require(_0x6383('0x8'));var statusDesc=[_0x6383('0x9'),_0x6383('0xa'),_0x6383('0xb'),_0x6383('0xc'),_0x6383('0xd'),_0x6383('0xe'),_0x6383('0xf'),'ringinuse','onhold'];var applications=[_0x6383('0x10'),_0x6383('0x11'),_0x6383('0x12'),_0x6383('0x13'),_0x6383('0x14'),_0x6383('0x15')];var dispositions=[_0x6383('0x16'),'FAILED','FAILED',_0x6383('0x16'),_0x6383('0x16'),_0x6383('0x16'),_0x6383('0x17'),_0x6383('0x18'),_0x6383('0x19'),_0x6383('0x19'),'FAILED'];var actions={};config['redis']=_[_0x6383('0x1a')](config[_0x6383('0x1b')],{'host':_0x6383('0x1c'),'port':0x18eb});var io=require(_0x6383('0x1d'))(new Redis(config[_0x6383('0x1b')]));function VoiceCallReport(_0x43c9e4){this[_0x6383('0x1e')]=_0x43c9e4[_0x6383('0x1e')];this[_0x6383('0x1f')]=_0x43c9e4[_0x6383('0x1f')];ami['on']('coreshowchannel',this[_0x6383('0x20')]['bind'](this));ami['on'](_0x6383('0x21'),this[_0x6383('0x20')][_0x6383('0x22')](this));ami['on'](_0x6383('0x23'),this[_0x6383('0x24')][_0x6383('0x22')](this));ami['on'](_0x6383('0x25'),this[_0x6383('0x26')][_0x6383('0x22')](this));ami['on'](_0x6383('0x27'),this[_0x6383('0x28')][_0x6383('0x22')](this));ami['on'](_0x6383('0x29'),this['syncHangup'][_0x6383('0x22')](this));ami['on'](_0x6383('0x2a'),this[_0x6383('0x2b')][_0x6383('0x22')](this));ami['on']('attendedtransfer',this[_0x6383('0x2c')]['bind'](this));ami['on'](_0x6383('0x2d'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x6383('0x2e'),this[_0x6383('0x2f')][_0x6383('0x22')](this));ami['on'](_0x6383('0x30'),this[_0x6383('0x31')][_0x6383('0x22')](this));return BPromise[_0x6383('0x32')]()['then'](ami[_0x6383('0x33')]())[_0x6383('0x34')](function(_0x3624d0){console[_0x6383('0x35')](_0x3624d0);});}VoiceCallReport[_0x6383('0x36')][_0x6383('0x37')]=function(_0x5bade1){return _0x5bade1!==null&&!_['isUndefined'](_0x5bade1);};VoiceCallReport[_0x6383('0x36')][_0x6383('0x38')]=function(_0x29b30f,_0x5f8d5c,_0x58e358){io['to'](_0x29b30f)[_0x6383('0x38')](_0x5f8d5c,_0x58e358);};VoiceCallReport[_0x6383('0x36')][_0x6383('0x2b')]=function(_0x3f2032){try{if(this[_0x6383('0x37')](_0x3f2032)){if(_0x3f2032['uniqueid']===_0x3f2032[_0x6383('0x39')]){if(!_[_0x6383('0x3a')](this[_0x6383('0x1e')][_0x3f2032['uniqueid']])){_[_0x6383('0x3b')](this[_0x6383('0x1e')][_0x3f2032[_0x6383('0x3c')]],_['pick'](_0x3f2032,_[_0x6383('0x3d')](this['channels'][_0x3f2032[_0x6383('0x3c')]])));}}}}catch(_0x5af3bf){logger[_0x6383('0x3e')](_0x6383('0x3f'),util['inspect'](_0x5af3bf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')][_0x6383('0x24')]=function(_0x2633ae){try{if(this[_0x6383('0x37')](_0x2633ae)){if(_0x2633ae[_0x6383('0x3c')]===_0x2633ae['linkedid']&&_0x2633ae['channel']!=_0x6383('0x40')){if(_[_0x6383('0x3a')](this[_0x6383('0x1e')][_0x2633ae[_0x6383('0x3c')]])){this['channels'][_0x2633ae[_0x6383('0x3c')]]=new Channel();this[_0x6383('0x1e')][_0x2633ae[_0x6383('0x3c')]][_0x6383('0x41')]=moment()[_0x6383('0x42')](_0x6383('0x43'));this[_0x6383('0x1e')][_0x2633ae[_0x6383('0x3c')]]['disposition']=dispositions[_[_0x6383('0x44')](_0x2633ae[_0x6383('0x45')])];_[_0x6383('0x3b')](this['channels'][_0x2633ae[_0x6383('0x3c')]],_[_0x6383('0x46')](_0x2633ae,_[_0x6383('0x3d')](this['channels'][_0x2633ae['uniqueid']])));if(_0x2633ae[_0x6383('0x47')]===_0x6383('0x48')){if(this['agents'][_0x2633ae[_0x6383('0x49')]['split']('-')[0x0]]){this[_0x6383('0x1f')][_0x2633ae['channel']['split']('-')[0x0]][_0x6383('0x4a')]=_0x2633ae[_0x6383('0x4b')];this[_0x6383('0x38')](util['format'](_0x6383('0x4c'),this[_0x6383('0x1f')][_0x2633ae[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]][_0x6383('0x4e')]),_0x6383('0x4f'),{'destaccountcode':this['agents'][_0x2633ae[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]][_0x6383('0x50')],'destconnectedlinenum':_0x2633ae['exten']});}}}}}}catch(_0x1ccb47){logger[_0x6383('0x3e')](_0x6383('0x51'),util[_0x6383('0x52')](_0x1ccb47,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')][_0x6383('0x20')]=function(_0x15108a){try{if(this[_0x6383('0x37')](_0x15108a)){if(_0x15108a['uniqueid']===_0x15108a[_0x6383('0x39')]&&_0x15108a[_0x6383('0x4b')]!='h'&&_0x15108a['channel']!=_0x6383('0x40')){_0x15108a[_0x6383('0x53')]=_0x15108a['application'][_0x6383('0x54')]();_0x15108a[_0x6383('0x55')]=(_0x15108a[_0x6383('0x56')]||_0x15108a['applicationdata'])[_0x6383('0x54')]();if(_[_0x6383('0x3a')](this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]])){this[_0x6383('0x1e')][_0x15108a['uniqueid']]=new Channel();this['channels'][_0x15108a[_0x6383('0x3c')]][_0x6383('0x41')]=_0x15108a['duration']?moment()[_0x6383('0x57')](moment['duration'](_0x15108a[_0x6383('0x58')])[_0x6383('0x59')](),'seconds')[_0x6383('0x42')](_0x6383('0x43')):moment()[_0x6383('0x42')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]][_0x6383('0x5a')]='NO\x20ANSWER';}_[_0x6383('0x3b')](this[_0x6383('0x1e')][_0x15108a['uniqueid']],_[_0x6383('0x46')](_0x15108a,_['keys'](this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]])));if(_[_0x6383('0x5b')](applications,_0x15108a[_0x6383('0x53')])){this[_0x6383('0x1e')][_0x15108a['uniqueid']]['lastapplication']=_0x15108a[_0x6383('0x53')];this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]][_0x6383('0x5c')]=_0x15108a[_0x6383('0x55')];if(_0x15108a[_0x6383('0x53')]===_0x6383('0x10')&&_[_0x6383('0x5d')](_0x15108a['applicationdata'],_0x6383('0x5e'))){var _0x570cc6=_0x15108a[_0x6383('0x55')]['split']('=');var _0x475afa=_0x570cc6[0x0]['match'](/cdr\((.*)\)/);if(_0x475afa){this[_0x6383('0x1e')][_0x15108a['uniqueid']][_0x475afa[0x1]]=_0x570cc6[0x1];}}else if(_0x15108a['application']===_0x6383('0x11')){this[_0x6383('0x1e')][_0x15108a[_0x6383('0x3c')]][_0x6383('0x11')]=_0x15108a[_0x6383('0x55')][_0x6383('0x4d')](',')[0x0];}}}}}catch(_0x19147c){logger[_0x6383('0x3e')](_0x6383('0x5f'),util[_0x6383('0x52')](_0x19147c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')]['syncNewState']=function(_0x7923c1){try{if(this[_0x6383('0x37')](_0x7923c1)){if(_0x7923c1[_0x6383('0x3c')]!==_0x7923c1[_0x6383('0x39')]){if(this[_0x6383('0x1e')][_0x7923c1['linkedid']]){if(_0x7923c1['channelstate']==='6'){if(!this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x60')]){var _0x3f48f5=moment();this['channels'][_0x7923c1[_0x6383('0x39')]][_0x6383('0x60')]=!![];this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x61')]=_0x3f48f5['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x41')]){this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x62')]=_0x3f48f5['diff'](this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x41')],_0x6383('0x59'));}}this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x39')]=_0x7923c1[_0x6383('0x3c')];if(_0x7923c1[_0x6383('0x63')]!==_0x6383('0x64')){this[_0x6383('0x1e')][_0x7923c1['linkedid']]['connectedlinenum']=_0x7923c1[_0x6383('0x63')];}this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x39')]][_0x6383('0x65')]=_0x7923c1[_0x6383('0x66')];this['channels'][_0x7923c1[_0x6383('0x39')]]['destinationchannel']=_0x7923c1[_0x6383('0x49')];this['channels'][_0x7923c1[_0x6383('0x39')]][_0x6383('0x5a')]=dispositions[_[_0x6383('0x44')](_0x7923c1['channelstate'])];if(this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]){this[_0x6383('0x1e')][_0x7923c1['linkedid']][_0x6383('0x67')]=this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]['id'];this[_0x6383('0x1e')][_0x7923c1['linkedid']][_0x6383('0x68')]=this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]][_0x6383('0x4e')];}}}}else{if(this[_0x6383('0x1e')][_0x7923c1['uniqueid']]){if(_0x7923c1[_0x6383('0x45')]==='6'){if(this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]){this['channels'][_0x7923c1[_0x6383('0x3c')]][_0x6383('0x67')]=this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]['id'];this[_0x6383('0x1e')][_0x7923c1[_0x6383('0x3c')]][_0x6383('0x68')]=this[_0x6383('0x1f')][_0x7923c1[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]['name'];}}}}}}catch(_0x45e5a4){logger[_0x6383('0x3e')]('[syncNewState][VoiceCallReport]',util['inspect'](_0x45e5a4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')]['syncMixMonitorFilename']=function(_0x5508c7,_0x18eabd){if(this[_0x6383('0x1e')][_0x5508c7]){this[_0x6383('0x1e')][_0x5508c7][_0x6383('0x69')]=!![];if(_[_0x6383('0x6a')](_0x18eabd,'.wav49')){_0x18eabd=_0x18eabd['replace'](_0x6383('0x6b'),_0x6383('0x6c'));}this[_0x6383('0x1e')][_0x5508c7][_0x6383('0x6d')]=_0x18eabd;var _0x3c6eef=_[_0x6383('0x6e')](this[_0x6383('0x1e')][_0x5508c7]['monitors'],{'filename':_0x18eabd});if(_[_0x6383('0x6f')](_0x3c6eef)){this[_0x6383('0x1e')][_0x5508c7][_0x6383('0x70')][_0x6383('0x71')]({'filename':_0x18eabd,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x6383('0x72')});}}};VoiceCallReport['prototype'][_0x6383('0x28')]=function(_0x2ffc79){try{if(this[_0x6383('0x37')](_0x2ffc79)){if(this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]]&&_0x2ffc79['channel']!=_0x6383('0x40')){if(this['isNotNull'](_0x2ffc79[_0x6383('0x73')])){if(this[_0x6383('0x37')](_0x2ffc79['variable'][_0x6383('0x74')])){this[_0x6383('0x75')](_0x2ffc79['uniqueid'],_0x2ffc79[_0x6383('0x76')]);}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x77')])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]]['calleridnum']=_0x2ffc79[_0x6383('0x76')];}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x78')])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]]['callerid']=_0x2ffc79['value'];}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')]['xmd-cdrtype'])){this['channels'][_0x2ffc79[_0x6383('0x3c')]]['type']=_0x2ffc79['value'];}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x79')])){this['channels'][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x11')]=_0x2ffc79[_0x6383('0x76')][_0x6383('0x4d')](',')[0x0];}else if(this['isNotNull'](_0x2ffc79[_0x6383('0x73')][_0x6383('0x7a')])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x7b')]=_0x2ffc79['value'];}else if(this['isNotNull'](_0x2ffc79[_0x6383('0x73')][_0x6383('0x7c')])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x7d')]=_0x2ffc79[_0x6383('0x76')];}else if(this[_0x6383('0x37')](_0x2ffc79['variable']['xmd-callerid-preview'])){this[_0x6383('0x1e')][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x7e')]=_0x2ffc79['value'];}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x7f')])){this['channels'][_0x2ffc79[_0x6383('0x3c')]][_0x6383('0x11')]=_0x2ffc79[_0x6383('0x76')];}else if(this[_0x6383('0x37')](_0x2ffc79['variable'][_0x6383('0x80')])){this[_0x6383('0x1e')][_0x2ffc79['uniqueid']]['sipcalluniqueid']=_0x2ffc79[_0x6383('0x76')];}}}else if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x74')])){if(_0x2ffc79['value']){var _0x1bf3e0=path['parse'](_0x2ffc79[_0x6383('0x76')])['name'];this[_0x6383('0x75')](_0x1bf3e0,_0x2ffc79[_0x6383('0x76')]);}}else if(this[_0x6383('0x1e')][_0x2ffc79['linkedid']]){if(this[_0x6383('0x37')](_0x2ffc79['variable'])){if(this[_0x6383('0x37')](_0x2ffc79[_0x6383('0x73')][_0x6383('0x80')])){this[_0x6383('0x1e')][_0x2ffc79['linkedid']]['sipcalllinkedid']=_0x2ffc79[_0x6383('0x76')];}}}}}catch(_0x182082){logger[_0x6383('0x3e')](_0x6383('0x81'),util['inspect'](_0x182082,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')]['syncHangup']=function(_0x5ed227){try{if(this['isNotNull'](_0x5ed227)){if(this['channels'][_0x5ed227[_0x6383('0x3c')]]){var _0x387948=moment();this[_0x6383('0x1e')][_0x5ed227['uniqueid']][_0x6383('0x82')]=_0x387948[_0x6383('0x42')](_0x6383('0x43'));this['channels'][_0x5ed227['uniqueid']][_0x6383('0x58')]=_0x387948[_0x6383('0x83')](this[_0x6383('0x1e')][_0x5ed227['uniqueid']][_0x6383('0x41')],_0x6383('0x59'));if(this[_0x6383('0x1e')][_0x5ed227[_0x6383('0x3c')]]['answered']){this[_0x6383('0x1e')][_0x5ed227['uniqueid']][_0x6383('0x84')]=_0x387948[_0x6383('0x83')](this['channels'][_0x5ed227[_0x6383('0x3c')]][_0x6383('0x61')],_0x6383('0x59'));this[_0x6383('0x1e')][_0x5ed227['uniqueid']][_0x6383('0x62')]=this[_0x6383('0x1e')][_0x5ed227['uniqueid']]['duration']-this[_0x6383('0x1e')][_0x5ed227[_0x6383('0x3c')]][_0x6383('0x84')];}if(_0x5ed227[_0x6383('0x47')]===_0x6383('0x48')){if(this['agents'][_0x5ed227[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]){this[_0x6383('0x1f')][_0x5ed227[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]]=_['omit'](this['agents'][_0x5ed227[_0x6383('0x49')][_0x6383('0x4d')]('-')[0x0]],[_0x6383('0x4a')]);this[_0x6383('0x38')](util['format'](_0x6383('0x4c'),this[_0x6383('0x1f')][_0x5ed227[_0x6383('0x49')]['split']('-')[0x0]][_0x6383('0x4e')]),_0x6383('0x85'),{'destaccountcode':this[_0x6383('0x1f')][_0x5ed227[_0x6383('0x49')]['split']('-')[0x0]][_0x6383('0x50')]});}}ami[_0x6383('0x38')](_0x6383('0x86'),this[_0x6383('0x1e')][_0x5ed227[_0x6383('0x3c')]]);delete this[_0x6383('0x1e')][_0x5ed227[_0x6383('0x3c')]];}}}catch(_0x3bd535){logger[_0x6383('0x3e')](_0x6383('0x87'),util[_0x6383('0x52')](_0x3bd535,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6383('0x36')][_0x6383('0x2c')]=function(_0x348b35){try{if(this['isNotNull'](_0x348b35)){if(this[_0x6383('0x1e')][_0x348b35['transfereeuniqueid']]){this['channels'][_0x348b35[_0x6383('0x88')]]['transfercalleridnum']=_0x348b35['origtransferercalleridnum'];this[_0x6383('0x1e')][_0x348b35[_0x6383('0x88')]][_0x6383('0x89')]=_0x348b35[_0x6383('0x8a')];if(this['channels'][_0x348b35[_0x6383('0x8b')]]){var _0x35fc26=this[_0x6383('0x1e')][_0x348b35[_0x6383('0x8b')]];this['channels'][_0x348b35[_0x6383('0x8b')]]=this[_0x6383('0x1e')][_0x348b35[_0x6383('0x88')]];this['channels'][_0x348b35[_0x6383('0x88')]]=_0x35fc26;}}else if(this[_0x6383('0x1e')][_0x348b35[_0x6383('0x8c')]]){this['channels'][_0x348b35['transfertargetuniqueid']]['transfercalleridnum']=_0x348b35[_0x6383('0x8d')];this['channels'][_0x348b35['transfertargetuniqueid']][_0x6383('0x89')]=_0x348b35[_0x6383('0x8a')];if(this[_0x6383('0x1e')][_0x348b35['origtransfereruniqueid']]){var _0x35fc26=this[_0x6383('0x1e')][_0x348b35['origtransfereruniqueid']];this['channels'][_0x348b35['origtransfereruniqueid']]=this['channels'][_0x348b35[_0x6383('0x8c')]];this[_0x6383('0x1e')][_0x348b35[_0x6383('0x8c')]]=_0x35fc26;}}}}catch(_0x37b82d){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util['inspect'](_0x37b82d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6383('0x8e')]=function(_0x29c834){try{if(this[_0x6383('0x37')](_0x29c834)){if(this[_0x6383('0x1e')][_0x29c834['transfereeuniqueid']]){this['channels'][_0x29c834[_0x6383('0x88')]][_0x6383('0x8f')]=_0x29c834[_0x6383('0x90')];this[_0x6383('0x1e')][_0x29c834[_0x6383('0x88')]][_0x6383('0x89')]=_0x29c834[_0x6383('0x91')];this[_0x6383('0x92')]({'event':_0x6383('0x93'),'uniqueid':_0x29c834[_0x6383('0x88')],'context':_0x29c834[_0x6383('0x47')],'channel':_0x29c834['transfererchannel']});}}}catch(_0x5a9cc4){logger[_0x6383('0x3e')]('[syncBlindTransfer][VoiceCallReport]',util[_0x6383('0x52')](_0x5a9cc4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6383('0x2f')]=function(_0x205c68){try{if(this[_0x6383('0x37')](_0x205c68)){if(this['channels'][_0x205c68[_0x6383('0x3c')]]){if(!_[_0x6383('0x6f')](this[_0x6383('0x1e')][_0x205c68[_0x6383('0x3c')]][_0x6383('0x61')])){this[_0x6383('0x1e')][_0x205c68[_0x6383('0x3c')]]['mohstarttime']=moment()[_0x6383('0x42')](_0x6383('0x43'));}}}}catch(_0x30645e){logger['error'](_0x6383('0x94'),util[_0x6383('0x52')](_0x30645e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6383('0x31')]=function(_0x2e1b1b){try{if(this[_0x6383('0x37')](_0x2e1b1b)){if(this[_0x6383('0x1e')][_0x2e1b1b[_0x6383('0x3c')]]){if(!_[_0x6383('0x6f')](this[_0x6383('0x1e')][_0x2e1b1b[_0x6383('0x3c')]][_0x6383('0x95')])){this['channels'][_0x2e1b1b['uniqueid']][_0x6383('0x96')]+=moment()[_0x6383('0x97')](0x0)[_0x6383('0x83')](this[_0x6383('0x1e')][_0x2e1b1b[_0x6383('0x3c')]]['mohstarttime'],_0x6383('0x59'));delete this[_0x6383('0x1e')][_0x2e1b1b['uniqueid']][_0x6383('0x95')];}}}}catch(_0x4ae517){logger['error'](_0x6383('0x98'),util[_0x6383('0x52')](_0x4ae517,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x4c01=['sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','context','omit','user:agentcomplete','custom:voiceCallReport','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','isNil','mohtime','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','not_inuse','inuse','busy','invalid','ringing','ringinuse','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','newexten','syncNewExten','syncNewChannel','bind','newstate','syncNewState','varset','hangup','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','resolve','then','log','prototype','isUndefined','emit','isNotNull','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','channelstate','from-sip','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','accountcode','application','toLowerCase','duration','subtract','seconds','includes','lastapplication','lastdata','applicationdata','startsWith','cdr(','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','starttime','calleridnum','xcally-motion-preview','connectedlinename','calleridname','destinationchannel','disposition','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','rec','syncVarSet','mixmonitor_filename','value','variable','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid'];(function(_0x2c5a3f,_0x5becbf){var _0x47cce4=function(_0x348fef){while(--_0x348fef){_0x2c5a3f['push'](_0x2c5a3f['shift']());}};_0x47cce4(++_0x5becbf);}(_0x4c01,0x13c));var _0x14c0=function(_0x1d8bca,_0x495841){_0x1d8bca=_0x1d8bca-0x0;var _0xce7d2e=_0x4c01[_0x1d8bca];return _0xce7d2e;};'use strict';var BPromise=require(_0x14c0('0x0'));var _=require('lodash');var moment=require(_0x14c0('0x1'));var util=require(_0x14c0('0x2'));var path=require(_0x14c0('0x3'));var Redis=require(_0x14c0('0x4'));var config=require(_0x14c0('0x5'));var logger=require(_0x14c0('0x6'))(_0x14c0('0x7'));var ami=require(_0x14c0('0x8'));var Channel=require('../model/channel');var statusDesc=['unknown',_0x14c0('0x9'),_0x14c0('0xa'),_0x14c0('0xb'),_0x14c0('0xc'),'unavailable',_0x14c0('0xd'),_0x14c0('0xe'),'onhold'];var applications=[_0x14c0('0xf'),_0x14c0('0x10'),'agi',_0x14c0('0x11'),_0x14c0('0x12'),_0x14c0('0x13')];var dispositions=[_0x14c0('0x14'),_0x14c0('0x15'),'FAILED',_0x14c0('0x14'),_0x14c0('0x14'),_0x14c0('0x14'),'ANSWERED',_0x14c0('0x16'),_0x14c0('0x15'),_0x14c0('0x15'),'FAILED'];var actions={};config[_0x14c0('0x17')]=_['defaults'](config[_0x14c0('0x17')],{'host':_0x14c0('0x18'),'port':0x18eb});var io=require(_0x14c0('0x19'))(new Redis(config[_0x14c0('0x17')]));function VoiceCallReport(_0x4e8e50){this[_0x14c0('0x1a')]=_0x4e8e50[_0x14c0('0x1a')];this[_0x14c0('0x1b')]=_0x4e8e50['agents'];ami['on'](_0x14c0('0x1c'),this['syncNewExten']['bind'](this));ami['on'](_0x14c0('0x1d'),this[_0x14c0('0x1e')]['bind'](this));ami['on']('newchannel',this[_0x14c0('0x1f')][_0x14c0('0x20')](this));ami['on'](_0x14c0('0x21'),this[_0x14c0('0x22')][_0x14c0('0x20')](this));ami['on'](_0x14c0('0x23'),this['syncVarSet'][_0x14c0('0x20')](this));ami['on'](_0x14c0('0x24'),this[_0x14c0('0x25')][_0x14c0('0x20')](this));ami['on']('newcallerid',this[_0x14c0('0x26')][_0x14c0('0x20')](this));ami['on']('attendedtransfer',this[_0x14c0('0x27')][_0x14c0('0x20')](this));ami['on'](_0x14c0('0x28'),this[_0x14c0('0x29')][_0x14c0('0x20')](this));ami['on'](_0x14c0('0x2a'),this[_0x14c0('0x2b')]['bind'](this));ami['on'](_0x14c0('0x2c'),this['syncMusicOnHoldStop'][_0x14c0('0x20')](this));return BPromise[_0x14c0('0x2d')]()[_0x14c0('0x2e')](ami['actionCoreShowChannels']())['catch'](function(_0x18f502){console[_0x14c0('0x2f')](_0x18f502);});}VoiceCallReport[_0x14c0('0x30')]['isNotNull']=function(_0x5a4abe){return _0x5a4abe!==null&&!_[_0x14c0('0x31')](_0x5a4abe);};VoiceCallReport['prototype']['emit']=function(_0x843209,_0x1f838f,_0x228d9c){io['to'](_0x843209)[_0x14c0('0x32')](_0x1f838f,_0x228d9c);};VoiceCallReport['prototype'][_0x14c0('0x26')]=function(_0x59e016){try{if(this[_0x14c0('0x33')](_0x59e016)){if(_0x59e016[_0x14c0('0x34')]===_0x59e016[_0x14c0('0x35')]){if(!_[_0x14c0('0x31')](this[_0x14c0('0x1a')][_0x59e016['uniqueid']])){_[_0x14c0('0x36')](this[_0x14c0('0x1a')][_0x59e016[_0x14c0('0x34')]],_[_0x14c0('0x37')](_0x59e016,_[_0x14c0('0x38')](this[_0x14c0('0x1a')][_0x59e016[_0x14c0('0x34')]])));}}}}catch(_0x2f4156){logger[_0x14c0('0x39')](_0x14c0('0x3a'),util[_0x14c0('0x3b')](_0x2f4156,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x14c0('0x30')]['syncNewChannel']=function(_0x28e462){try{if(this['isNotNull'](_0x28e462)){if(_0x28e462[_0x14c0('0x34')]===_0x28e462[_0x14c0('0x35')]&&_0x28e462[_0x14c0('0x3c')]!=_0x14c0('0x3d')){if(_[_0x14c0('0x31')](this[_0x14c0('0x1a')][_0x28e462[_0x14c0('0x34')]])){this[_0x14c0('0x1a')][_0x28e462[_0x14c0('0x34')]]=new Channel();this[_0x14c0('0x1a')][_0x28e462[_0x14c0('0x34')]]['starttime']=moment()[_0x14c0('0x3e')](_0x14c0('0x3f'));this[_0x14c0('0x1a')][_0x28e462[_0x14c0('0x34')]]['disposition']=dispositions[_['toNumber'](_0x28e462[_0x14c0('0x40')])];_['merge'](this['channels'][_0x28e462['uniqueid']],_[_0x14c0('0x37')](_0x28e462,_[_0x14c0('0x38')](this[_0x14c0('0x1a')][_0x28e462['uniqueid']])));if(_0x28e462['context']===_0x14c0('0x41')){if(this[_0x14c0('0x1b')][_0x28e462[_0x14c0('0x3c')]['split']('-')[0x0]]){this['agents'][_0x28e462[_0x14c0('0x3c')][_0x14c0('0x42')]('-')[0x0]][_0x14c0('0x43')]=_0x28e462[_0x14c0('0x44')];this[_0x14c0('0x32')](util[_0x14c0('0x3e')](_0x14c0('0x45'),this[_0x14c0('0x1b')][_0x28e462[_0x14c0('0x3c')][_0x14c0('0x42')]('-')[0x0]][_0x14c0('0x46')]),_0x14c0('0x47'),{'destaccountcode':this[_0x14c0('0x1b')][_0x28e462[_0x14c0('0x3c')][_0x14c0('0x42')]('-')[0x0]][_0x14c0('0x48')],'destconnectedlinenum':_0x28e462[_0x14c0('0x44')]});}}}}}}catch(_0x523311){logger['error']('[syncNewChannel][VoiceCallReport]',util[_0x14c0('0x3b')](_0x523311,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x31edab){try{if(this[_0x14c0('0x33')](_0x31edab)){if(_0x31edab[_0x14c0('0x34')]===_0x31edab[_0x14c0('0x35')]&&_0x31edab[_0x14c0('0x44')]!='h'&&_0x31edab[_0x14c0('0x3c')]!=_0x14c0('0x3d')){_0x31edab[_0x14c0('0x49')]=_0x31edab[_0x14c0('0x49')][_0x14c0('0x4a')]();_0x31edab['applicationdata']=(_0x31edab['appdata']||_0x31edab['applicationdata'])[_0x14c0('0x4a')]();if(_[_0x14c0('0x31')](this[_0x14c0('0x1a')][_0x31edab[_0x14c0('0x34')]])){this[_0x14c0('0x1a')][_0x31edab[_0x14c0('0x34')]]=new Channel();this['channels'][_0x31edab['uniqueid']]['starttime']=_0x31edab[_0x14c0('0x4b')]?moment()[_0x14c0('0x4c')](moment[_0x14c0('0x4b')](_0x31edab[_0x14c0('0x4b')])[_0x14c0('0x4d')](),'seconds')[_0x14c0('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x14c0('0x3e')](_0x14c0('0x3f'));this['channels'][_0x31edab[_0x14c0('0x34')]]['disposition']=_0x14c0('0x14');}_[_0x14c0('0x36')](this[_0x14c0('0x1a')][_0x31edab['uniqueid']],_['pick'](_0x31edab,_[_0x14c0('0x38')](this[_0x14c0('0x1a')][_0x31edab[_0x14c0('0x34')]])));if(_[_0x14c0('0x4e')](applications,_0x31edab[_0x14c0('0x49')])){this['channels'][_0x31edab[_0x14c0('0x34')]][_0x14c0('0x4f')]=_0x31edab[_0x14c0('0x49')];this[_0x14c0('0x1a')][_0x31edab[_0x14c0('0x34')]][_0x14c0('0x50')]=_0x31edab[_0x14c0('0x51')];if(_0x31edab[_0x14c0('0x49')]===_0x14c0('0xf')&&_[_0x14c0('0x52')](_0x31edab['applicationdata'],_0x14c0('0x53'))){var _0x5330f2=_0x31edab[_0x14c0('0x51')][_0x14c0('0x42')]('=');var _0x2bce64=_0x5330f2[0x0]['match'](/cdr\((.*)\)/);if(_0x2bce64){this[_0x14c0('0x1a')][_0x31edab['uniqueid']][_0x2bce64[0x1]]=_0x5330f2[0x1];}}else if(_0x31edab[_0x14c0('0x49')]===_0x14c0('0x10')){this[_0x14c0('0x1a')][_0x31edab[_0x14c0('0x34')]][_0x14c0('0x10')]=_0x31edab[_0x14c0('0x51')][_0x14c0('0x42')](',')[0x0];}}}}}catch(_0xe8768d){logger['error'](_0x14c0('0x54'),util['inspect'](_0xe8768d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x14c0('0x30')][_0x14c0('0x22')]=function(_0xd99bf6){try{if(this[_0x14c0('0x33')](_0xd99bf6)){if(_0xd99bf6[_0x14c0('0x34')]!==_0xd99bf6[_0x14c0('0x35')]){if(this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]]){if(_0xd99bf6[_0x14c0('0x40')]==='6'){if(!this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x55')]){var _0x42de82=moment();this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x55')]=!![];this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x56')]=_0x42de82[_0x14c0('0x3e')](_0x14c0('0x3f'));if(this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]]['starttime']){this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x57')]=_0x42de82[_0x14c0('0x58')](this['channels'][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x59')],_0x14c0('0x4d'));}}this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x35')]=_0xd99bf6['uniqueid'];if(_0xd99bf6[_0x14c0('0x5a')]!==_0x14c0('0x5b')){this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]]['connectedlinenum']=_0xd99bf6['calleridnum'];}this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x5c')]=_0xd99bf6[_0x14c0('0x5d')];this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x5e')]=_0xd99bf6[_0x14c0('0x3c')];this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x5f')]=dispositions[_['toNumber'](_0xd99bf6[_0x14c0('0x40')])];if(this[_0x14c0('0x1b')][_0xd99bf6[_0x14c0('0x3c')][_0x14c0('0x42')]('-')[0x0]]){this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x60')]=this['agents'][_0xd99bf6['channel'][_0x14c0('0x42')]('-')[0x0]]['id'];this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x35')]][_0x14c0('0x61')]=this[_0x14c0('0x1b')][_0xd99bf6[_0x14c0('0x3c')][_0x14c0('0x42')]('-')[0x0]][_0x14c0('0x46')];}}}}else{if(this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x34')]]){if(_0xd99bf6['channelstate']==='6'){if(this['agents'][_0xd99bf6[_0x14c0('0x3c')][_0x14c0('0x42')]('-')[0x0]]){this[_0x14c0('0x1a')][_0xd99bf6[_0x14c0('0x34')]][_0x14c0('0x60')]=this['agents'][_0xd99bf6['channel'][_0x14c0('0x42')]('-')[0x0]]['id'];this[_0x14c0('0x1a')][_0xd99bf6['uniqueid']][_0x14c0('0x61')]=this[_0x14c0('0x1b')][_0xd99bf6[_0x14c0('0x3c')][_0x14c0('0x42')]('-')[0x0]][_0x14c0('0x46')];}}}}}}catch(_0xf990af){logger[_0x14c0('0x39')](_0x14c0('0x62'),util[_0x14c0('0x3b')](_0xf990af,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x14c0('0x30')][_0x14c0('0x63')]=function(_0x5c83c,_0x115392){if(this['channels'][_0x5c83c]){this[_0x14c0('0x1a')][_0x5c83c][_0x14c0('0x64')]=!![];if(_[_0x14c0('0x65')](_0x115392,'.wav49')){_0x115392=_0x115392[_0x14c0('0x66')](_0x14c0('0x67'),_0x14c0('0x68'));}this[_0x14c0('0x1a')][_0x5c83c][_0x14c0('0x69')]=_0x115392;var _0x150c6b=_[_0x14c0('0x6a')](this[_0x14c0('0x1a')][_0x5c83c]['monitors'],{'filename':_0x115392});if(_['isNil'](_0x150c6b)){this[_0x14c0('0x1a')][_0x5c83c][_0x14c0('0x6b')]['push']({'filename':_0x115392,'createdAt':moment()[_0x14c0('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x14c0('0x6c')});}}};VoiceCallReport[_0x14c0('0x30')][_0x14c0('0x6d')]=function(_0x55ebef){try{if(this[_0x14c0('0x33')](_0x55ebef)){if(this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x34')]]&&_0x55ebef[_0x14c0('0x3c')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x55ebef['variable'])){if(this[_0x14c0('0x33')](_0x55ebef['variable'][_0x14c0('0x6e')])){this[_0x14c0('0x63')](_0x55ebef[_0x14c0('0x34')],_0x55ebef[_0x14c0('0x6f')]);}else if(this['isNotNull'](_0x55ebef[_0x14c0('0x70')]['xmd-phone'])){this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x34')]][_0x14c0('0x5a')]=_0x55ebef[_0x14c0('0x6f')];}else if(this[_0x14c0('0x33')](_0x55ebef[_0x14c0('0x70')]['xmd-callerid'])){this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x34')]][_0x14c0('0x71')]=_0x55ebef[_0x14c0('0x6f')];}else if(this[_0x14c0('0x33')](_0x55ebef['variable'][_0x14c0('0x72')])){this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x34')]][_0x14c0('0x73')]=_0x55ebef[_0x14c0('0x6f')];}else if(this['isNotNull'](_0x55ebef['variable'][_0x14c0('0x74')])){this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x34')]][_0x14c0('0x10')]=_0x55ebef[_0x14c0('0x6f')][_0x14c0('0x42')](',')[0x0];}else if(this[_0x14c0('0x33')](_0x55ebef[_0x14c0('0x70')][_0x14c0('0x75')])){this['channels'][_0x55ebef[_0x14c0('0x34')]][_0x14c0('0x76')]=_0x55ebef[_0x14c0('0x6f')];}else if(this[_0x14c0('0x33')](_0x55ebef[_0x14c0('0x70')]['xmd-destination'])){this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x34')]][_0x14c0('0x77')]=_0x55ebef[_0x14c0('0x6f')];}else if(this[_0x14c0('0x33')](_0x55ebef[_0x14c0('0x70')][_0x14c0('0x78')])){this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x34')]][_0x14c0('0x79')]=_0x55ebef['value'];}else if(this[_0x14c0('0x33')](_0x55ebef[_0x14c0('0x70')][_0x14c0('0x7a')])){this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x34')]]['queue']=_0x55ebef['value'];}else if(this[_0x14c0('0x33')](_0x55ebef[_0x14c0('0x70')][_0x14c0('0x7b')])){this['channels'][_0x55ebef[_0x14c0('0x34')]][_0x14c0('0x7c')]=_0x55ebef[_0x14c0('0x6f')];}}}else if(this[_0x14c0('0x33')](_0x55ebef['variable'][_0x14c0('0x6e')])){if(_0x55ebef[_0x14c0('0x6f')]){var _0xe3fabb=path['parse'](_0x55ebef['value'])[_0x14c0('0x46')];this['syncMixMonitorFilename'](_0xe3fabb,_0x55ebef[_0x14c0('0x6f')]);}}else if(this['channels'][_0x55ebef[_0x14c0('0x35')]]){if(this[_0x14c0('0x33')](_0x55ebef[_0x14c0('0x70')])){if(this['isNotNull'](_0x55ebef[_0x14c0('0x70')][_0x14c0('0x7b')])){this[_0x14c0('0x1a')][_0x55ebef[_0x14c0('0x35')]][_0x14c0('0x7d')]=_0x55ebef[_0x14c0('0x6f')];}}}}}catch(_0x28114a){logger[_0x14c0('0x39')](_0x14c0('0x7e'),util[_0x14c0('0x3b')](_0x28114a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x14c0('0x25')]=function(_0x1edbcb){try{if(this[_0x14c0('0x33')](_0x1edbcb)){if(this['channels'][_0x1edbcb[_0x14c0('0x34')]]){var _0x3a9b02=moment();this[_0x14c0('0x1a')][_0x1edbcb[_0x14c0('0x34')]][_0x14c0('0x7f')]=_0x3a9b02[_0x14c0('0x3e')](_0x14c0('0x3f'));this[_0x14c0('0x1a')][_0x1edbcb[_0x14c0('0x34')]][_0x14c0('0x4b')]=_0x3a9b02[_0x14c0('0x58')](this['channels'][_0x1edbcb[_0x14c0('0x34')]][_0x14c0('0x59')],_0x14c0('0x4d'));if(this[_0x14c0('0x1a')][_0x1edbcb[_0x14c0('0x34')]][_0x14c0('0x55')]){this[_0x14c0('0x1a')][_0x1edbcb[_0x14c0('0x34')]][_0x14c0('0x80')]=_0x3a9b02[_0x14c0('0x58')](this[_0x14c0('0x1a')][_0x1edbcb[_0x14c0('0x34')]][_0x14c0('0x56')],_0x14c0('0x4d'));this[_0x14c0('0x1a')][_0x1edbcb[_0x14c0('0x34')]][_0x14c0('0x57')]=this[_0x14c0('0x1a')][_0x1edbcb[_0x14c0('0x34')]]['duration']-this[_0x14c0('0x1a')][_0x1edbcb['uniqueid']][_0x14c0('0x80')];}if(_0x1edbcb[_0x14c0('0x81')]==='from-sip'){if(this[_0x14c0('0x1b')][_0x1edbcb[_0x14c0('0x3c')]['split']('-')[0x0]]){this[_0x14c0('0x1b')][_0x1edbcb[_0x14c0('0x3c')][_0x14c0('0x42')]('-')[0x0]]=_[_0x14c0('0x82')](this['agents'][_0x1edbcb['channel'][_0x14c0('0x42')]('-')[0x0]],[_0x14c0('0x43')]);this[_0x14c0('0x32')](util['format'](_0x14c0('0x45'),this['agents'][_0x1edbcb['channel'][_0x14c0('0x42')]('-')[0x0]]['name']),_0x14c0('0x83'),{'destaccountcode':this['agents'][_0x1edbcb['channel'][_0x14c0('0x42')]('-')[0x0]]['accountcode']});}}ami['emit'](_0x14c0('0x84'),this['channels'][_0x1edbcb[_0x14c0('0x34')]]);delete this[_0x14c0('0x1a')][_0x1edbcb[_0x14c0('0x34')]];}}}catch(_0x21b860){logger[_0x14c0('0x39')]('[syncHangup][VoiceCallReport]',util[_0x14c0('0x3b')](_0x21b860,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x14c0('0x30')][_0x14c0('0x27')]=function(_0x11a528){try{if(this['isNotNull'](_0x11a528)){if(this['channels'][_0x11a528[_0x14c0('0x85')]]){this[_0x14c0('0x1a')][_0x11a528['transfereeuniqueid']][_0x14c0('0x86')]=_0x11a528[_0x14c0('0x87')];this[_0x14c0('0x1a')][_0x11a528[_0x14c0('0x85')]][_0x14c0('0x88')]=_0x11a528[_0x14c0('0x89')];if(this[_0x14c0('0x1a')][_0x11a528[_0x14c0('0x8a')]]){var _0x33f8eb=this[_0x14c0('0x1a')][_0x11a528[_0x14c0('0x8a')]];this[_0x14c0('0x1a')][_0x11a528[_0x14c0('0x8a')]]=this[_0x14c0('0x1a')][_0x11a528['transfereeuniqueid']];this['channels'][_0x11a528[_0x14c0('0x85')]]=_0x33f8eb;}}else if(this[_0x14c0('0x1a')][_0x11a528['transfertargetuniqueid']]){this[_0x14c0('0x1a')][_0x11a528[_0x14c0('0x8b')]][_0x14c0('0x86')]=_0x11a528[_0x14c0('0x87')];this['channels'][_0x11a528[_0x14c0('0x8b')]]['transferconnectedlinenum']=_0x11a528['transfertargetcalleridnum'];if(this['channels'][_0x11a528[_0x14c0('0x8c')]]){var _0x33f8eb=this[_0x14c0('0x1a')][_0x11a528[_0x14c0('0x8c')]];this['channels'][_0x11a528[_0x14c0('0x8c')]]=this[_0x14c0('0x1a')][_0x11a528[_0x14c0('0x8b')]];this['channels'][_0x11a528[_0x14c0('0x8b')]]=_0x33f8eb;}}}}catch(_0x34390d){logger[_0x14c0('0x39')]('[syncAttendedTransfer][VoiceCallReport]',util['inspect'](_0x34390d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x14c0('0x30')][_0x14c0('0x29')]=function(_0x598d71){try{if(this['isNotNull'](_0x598d71)){if(this[_0x14c0('0x1a')][_0x598d71[_0x14c0('0x85')]]){this[_0x14c0('0x1a')][_0x598d71[_0x14c0('0x85')]]['transfercalleridnum']=_0x598d71['transfereecalleridnum'];this[_0x14c0('0x1a')][_0x598d71[_0x14c0('0x85')]][_0x14c0('0x88')]=_0x598d71['extension'];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x598d71['transfereeuniqueid'],'context':_0x598d71['context'],'channel':_0x598d71['transfererchannel']});}}}catch(_0xc5d6e){logger[_0x14c0('0x39')]('[syncBlindTransfer][VoiceCallReport]',util[_0x14c0('0x3b')](_0xc5d6e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x14c0('0x30')][_0x14c0('0x2b')]=function(_0x4ba0f9){try{if(this[_0x14c0('0x33')](_0x4ba0f9)){if(this['channels'][_0x4ba0f9[_0x14c0('0x34')]]){if(!_['isNil'](this[_0x14c0('0x1a')][_0x4ba0f9[_0x14c0('0x34')]][_0x14c0('0x56')])){this['channels'][_0x4ba0f9['uniqueid']][_0x14c0('0x8d')]=moment()[_0x14c0('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x368ff8){logger[_0x14c0('0x39')](_0x14c0('0x8e'),util[_0x14c0('0x3b')](_0x368ff8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x14c0('0x8f')]=function(_0x24edd4){try{if(this[_0x14c0('0x33')](_0x24edd4)){if(this['channels'][_0x24edd4[_0x14c0('0x34')]]){if(!_[_0x14c0('0x90')](this[_0x14c0('0x1a')][_0x24edd4[_0x14c0('0x34')]][_0x14c0('0x8d')])){this[_0x14c0('0x1a')][_0x24edd4[_0x14c0('0x34')]][_0x14c0('0x91')]+=moment()['milliseconds'](0x0)['diff'](this[_0x14c0('0x1a')][_0x24edd4[_0x14c0('0x34')]]['mohstarttime'],'seconds');delete this['channels'][_0x24edd4[_0x14c0('0x34')]][_0x14c0('0x8d')];}}}}catch(_0x5e5ba7){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util['inspect'](_0x5e5ba7,{'showHidden':![],'depth':null}));}};module[_0x14c0('0x92')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index e1bf65f..adac3c1 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 _0x79de=['answertime','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','isUndefined','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','endtime','YYYY-MM-DD\x20HH:mm:ss','diff','starttime','complete','total','answered','holdtime','billableseconds','seconds','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','util','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','prototype','isNotNull','emit','uniqueid','format','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename'];(function(_0x5bc65a,_0x492ca3){var _0x21488e=function(_0x3e53ea){while(--_0x3e53ea){_0x5bc65a['push'](_0x5bc65a['shift']());}};_0x21488e(++_0x492ca3);}(_0x79de,0x1a8));var _0xe79d=function(_0x57b7ab,_0x1e565d){_0x57b7ab=_0x57b7ab-0x0;var _0x379c6d=_0x79de[_0x57b7ab];return _0x379c6d;};'use strict';var _=require(_0xe79d('0x0'));var moment=require('moment');var util=require(_0xe79d('0x1'));var Redis=require(_0xe79d('0x2'));var config=require(_0xe79d('0x3'));var logger=require(_0xe79d('0x4'))('ami');var ami=require('../ami');config[_0xe79d('0x5')]=_[_0xe79d('0x6')](config[_0xe79d('0x5')],{'host':_0xe79d('0x7'),'port':0x18eb});var io=require(_0xe79d('0x8'))(new Redis(config[_0xe79d('0x5')]));function VoiceDialReport(_0xa3af86){this[_0xe79d('0x9')]=_0xa3af86[_0xe79d('0xa')];this[_0xe79d('0xb')]=_0xa3af86[_0xe79d('0xb')];this['variables']={};ami['on'](_0xe79d('0xc'),this[_0xe79d('0xd')][_0xe79d('0xe')](this));ami['on'](_0xe79d('0xf'),this[_0xe79d('0x10')][_0xe79d('0xe')](this));ami['on'](_0xe79d('0x11'),this[_0xe79d('0x12')][_0xe79d('0xe')](this));ami['on']('hangup',this[_0xe79d('0x13')][_0xe79d('0xe')](this));}VoiceDialReport[_0xe79d('0x14')][_0xe79d('0x15')]=function(_0x30d4c4){return _0x30d4c4!==null&&!_['isUndefined'](_0x30d4c4);};VoiceDialReport[_0xe79d('0x14')]['emit']=function(_0x59516f,_0x5e5373,_0x203b95){io['to'](_0x59516f)[_0xe79d('0x16')](_0x5e5373,_0x203b95);};VoiceDialReport[_0xe79d('0x14')][_0xe79d('0xd')]=function(_0x16654b){try{if(this[_0xe79d('0x15')](_0x16654b)){if(this[_0xe79d('0x9')][_0x16654b[_0xe79d('0x17')]]){_['merge'](this[_0xe79d('0x9')][_0x16654b[_0xe79d('0x17')]],{'starttime':moment()[_0xe79d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xe79d('0x19'),'interface':_0x16654b['channel']['substring'](0x0,_0x16654b[_0xe79d('0x1a')]['lastIndexOf']('-')),'membername':_0x16654b[_0xe79d('0x1a')][_0xe79d('0x1b')](_0x16654b[_0xe79d('0x1a')][_0xe79d('0x1c')]('/')+0x1,_0x16654b[_0xe79d('0x1a')][_0xe79d('0x1c')]('-'))},_[_0xe79d('0x1d')](_0x16654b,[_0xe79d('0x1e'),_0xe79d('0x1f')]));this[_0xe79d('0x16')](_0xe79d('0x20'),_0xe79d('0x21'),this['channels'][_0x16654b[_0xe79d('0x17')]]);ami['emit']('custom:dialbegin',this[_0xe79d('0x9')][_0x16654b[_0xe79d('0x17')]]);}}}catch(_0x37b499){logger[_0xe79d('0x22')](_0xe79d('0x23'),util[_0xe79d('0x24')](_0x37b499,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe79d('0x14')]['syncDialEnd']=function(_0x597a96){try{if(this[_0xe79d('0x15')](_0x597a96)){if(this['channels'][_0x597a96[_0xe79d('0x17')]]){this['channels'][_0x597a96[_0xe79d('0x17')]]['dialstatus']=_0x597a96[_0xe79d('0x25')];if(_0x597a96[_0xe79d('0x25')]===_0xe79d('0x26')){this['channels'][_0x597a96['uniqueid']]['connectedlinenum']=_0x597a96[_0xe79d('0x27')];this[_0xe79d('0x9')][_0x597a96[_0xe79d('0x17')]][_0xe79d('0x28')]=_0x597a96[_0xe79d('0x28')];this[_0xe79d('0x9')][_0x597a96[_0xe79d('0x17')]][_0xe79d('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xe79d('0x9')][_0x597a96[_0xe79d('0x17')]][_0xe79d('0x2a')]=_0xe79d('0x2b');ami[_0xe79d('0x16')](_0xe79d('0x2c'),this[_0xe79d('0x9')][_0x597a96[_0xe79d('0x17')]]);}this['emit'](_0xe79d('0x20'),_0xe79d('0x21'),this[_0xe79d('0x9')][_0x597a96['uniqueid']]);}}}catch(_0x28e4ef){logger[_0xe79d('0x22')](_0xe79d('0x2d'),util[_0xe79d('0x24')](_0x28e4ef,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe79d('0x14')][_0xe79d('0x12')]=function(_0x583e9c){try{if(this['isNotNull'](_0x583e9c)){this[_0xe79d('0x2e')](_0x583e9c['uniqueid'],_[_0xe79d('0x2f')](_0x583e9c[_0xe79d('0x30')])[0x0],_0x583e9c[_0xe79d('0x31')]);if(this[_0xe79d('0x15')](_0x583e9c[_0xe79d('0x30')])&&this[_0xe79d('0x15')](_0x583e9c[_0xe79d('0x30')][_0xe79d('0x32')])){if(_[_0xe79d('0x33')](this['channels'][_0x583e9c['uniqueid']])){this[_0xe79d('0x9')][_0x583e9c[_0xe79d('0x17')]]={'routeId':_0x583e9c[_0xe79d('0x31')],'variables':this[_0xe79d('0x34')][_0x583e9c[_0xe79d('0x17')]]};this['emit'](_0xe79d('0x20'),_0xe79d('0x21'),this[_0xe79d('0x9')][_0x583e9c[_0xe79d('0x17')]]);}}}}catch(_0x25a45c){logger[_0xe79d('0x22')](_0xe79d('0x35'),util['inspect'](_0x25a45c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe79d('0x14')][_0xe79d('0x2e')]=function(_0x5894ed,_0x46e1c3,_0x59dadd){var _0x495054=[_0xe79d('0x36'),'rtpaudioqosbridged',_0xe79d('0x37'),_0xe79d('0x38'),_0xe79d('0x39'),_0xe79d('0x3a'),_0xe79d('0x3b'),_0xe79d('0x3c'),_0xe79d('0x3d'),_0xe79d('0x3e'),_0xe79d('0x3f'),_0xe79d('0x40'),_0xe79d('0x41'),_0xe79d('0x42'),_0xe79d('0x43'),_0xe79d('0x44'),_0xe79d('0x45'),_0xe79d('0x46'),_0xe79d('0x47')];if(!_[_0xe79d('0x48')](_0x46e1c3)&&!_['includes'](_0x495054,_0x46e1c3)){if(_[_0xe79d('0x33')](this[_0xe79d('0x34')][_0x5894ed])){this['variables'][_0x5894ed]={};}this[_0xe79d('0x34')][_0x5894ed][_0x46e1c3]=_0x59dadd;}};VoiceDialReport[_0xe79d('0x14')][_0xe79d('0x13')]=function(_0x558f6b){try{if(this[_0xe79d('0x15')](_0x558f6b)){if(this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]){this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x49')]=moment()[_0xe79d('0x18')](_0xe79d('0x4a'));this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]['duration']=moment(this['channels'][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x49')])[_0xe79d('0x4b')](this['channels'][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x4c')],'seconds');this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x2a')]=_0xe79d('0x4d');this[_0xe79d('0xb')][_0xe79d('0x4e')]+=0x1;if(this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]['answertime']){this[_0xe79d('0xb')][_0xe79d('0x4f')]+=0x1;this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x50')]=moment(this['channels'][_0x558f6b['uniqueid']]['answertime'])['diff'](this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x4c')],'seconds');this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x51')]=moment(this[_0xe79d('0x9')][_0x558f6b['uniqueid']]['endtime'])[_0xe79d('0x4b')](this['channels'][_0x558f6b[_0xe79d('0x17')]]['answertime'],_0xe79d('0x52'));this[_0xe79d('0xb')]['sumHoldTime']+=this['channels'][_0x558f6b[_0xe79d('0x17')]][_0xe79d('0x50')]||0x0;this[_0xe79d('0xb')]['sumBillable']+=this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]['billableseconds'];}this[_0xe79d('0xb')]['sumDuration']+=this[_0xe79d('0x9')][_0x558f6b['uniqueid']][_0xe79d('0x53')];ami[_0xe79d('0x16')](_0xe79d('0x54'),this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]);ami[_0xe79d('0x16')](_0xe79d('0x55'),this[_0xe79d('0x9')][_0x558f6b['uniqueid']]);this[_0xe79d('0x16')](_0xe79d('0x20'),_0xe79d('0x56'),this[_0xe79d('0xb')]);logger[_0xe79d('0x57')](_0xe79d('0x58'),JSON[_0xe79d('0x59')](this['channels'][_0x558f6b[_0xe79d('0x17')]]));this[_0xe79d('0x16')](_0xe79d('0x20'),_0xe79d('0x5a'),this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]]);delete this[_0xe79d('0x9')][_0x558f6b[_0xe79d('0x17')]];}if(this['variables'][_0x558f6b[_0xe79d('0x17')]]){delete this[_0xe79d('0x34')][_0x558f6b['uniqueid']];}}}catch(_0x1b1319){logger[_0xe79d('0x22')](_0xe79d('0x5b'),util['inspect'](_0x1b1319,{'showHidden':![],'depth':null}));}};module[_0xe79d('0x5c')]=VoiceDialReport; \ No newline at end of file +var _0xf749=['merge','format','called','channel','substring','lastIndexOf','omit','privilege','voice_outbound_channel:save','emit','custom:dialbegin','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','voice:outbound','[syncDialEnd][VoiceDialReport]','inspect','syncVarSet','addVariable','variable','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','memberlastcall','memberrealtime','isNil','includes','diff','starttime','seconds','complete','answered','holdtime','billableseconds','endtime','sumHoldTime','duration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','isUndefined','prototype','isNotNull','uniqueid'];(function(_0x45e632,_0x5714ec){var _0x2b7ac1=function(_0x183774){while(--_0x183774){_0x45e632['push'](_0x45e632['shift']());}};_0x2b7ac1(++_0x5714ec);}(_0xf749,0xd8));var _0x9f74=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf749[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var moment=require(_0x9f74('0x0'));var util=require(_0x9f74('0x1'));var Redis=require(_0x9f74('0x2'));var config=require(_0x9f74('0x3'));var logger=require(_0x9f74('0x4'))(_0x9f74('0x5'));var ami=require(_0x9f74('0x6'));config['redis']=_[_0x9f74('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x5a5dc6){this[_0x9f74('0x8')]=_0x5a5dc6[_0x9f74('0x9')];this[_0x9f74('0xa')]=_0x5a5dc6[_0x9f74('0xa')];this[_0x9f74('0xb')]={};ami['on'](_0x9f74('0xc'),this[_0x9f74('0xd')][_0x9f74('0xe')](this));ami['on'](_0x9f74('0xf'),this[_0x9f74('0x10')][_0x9f74('0xe')](this));ami['on'](_0x9f74('0x11'),this['syncVarSet'][_0x9f74('0xe')](this));ami['on'](_0x9f74('0x12'),this[_0x9f74('0x13')][_0x9f74('0xe')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x1b0b89){return _0x1b0b89!==null&&!_[_0x9f74('0x14')](_0x1b0b89);};VoiceDialReport[_0x9f74('0x15')]['emit']=function(_0x454a1f,_0x2c5744,_0x5e1f13){io['to'](_0x454a1f)['emit'](_0x2c5744,_0x5e1f13);};VoiceDialReport[_0x9f74('0x15')][_0x9f74('0xd')]=function(_0x375d4a){try{if(this[_0x9f74('0x16')](_0x375d4a)){if(this['channels'][_0x375d4a[_0x9f74('0x17')]]){_[_0x9f74('0x18')](this['channels'][_0x375d4a['uniqueid']],{'starttime':moment()[_0x9f74('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x9f74('0x1a'),'interface':_0x375d4a[_0x9f74('0x1b')][_0x9f74('0x1c')](0x0,_0x375d4a['channel'][_0x9f74('0x1d')]('-')),'membername':_0x375d4a['channel'][_0x9f74('0x1c')](_0x375d4a[_0x9f74('0x1b')][_0x9f74('0x1d')]('/')+0x1,_0x375d4a[_0x9f74('0x1b')]['lastIndexOf']('-'))},_[_0x9f74('0x1e')](_0x375d4a,['event',_0x9f74('0x1f')]));this['emit']('voice:outbound',_0x9f74('0x20'),this[_0x9f74('0x8')][_0x375d4a[_0x9f74('0x17')]]);ami[_0x9f74('0x21')](_0x9f74('0x22'),this[_0x9f74('0x8')][_0x375d4a[_0x9f74('0x17')]]);}}}catch(_0x21796d){logger[_0x9f74('0x23')]('[syncDialBegin][VoiceDialReport]',util['inspect'](_0x21796d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9f74('0x15')]['syncDialEnd']=function(_0x3ea101){try{if(this['isNotNull'](_0x3ea101)){if(this[_0x9f74('0x8')][_0x3ea101[_0x9f74('0x17')]]){this[_0x9f74('0x8')][_0x3ea101[_0x9f74('0x17')]][_0x9f74('0x24')]=_0x3ea101[_0x9f74('0x24')];if(_0x3ea101[_0x9f74('0x24')]===_0x9f74('0x25')){this[_0x9f74('0x8')][_0x3ea101[_0x9f74('0x17')]][_0x9f74('0x26')]=_0x3ea101[_0x9f74('0x26')];this['channels'][_0x3ea101[_0x9f74('0x17')]][_0x9f74('0x27')]=_0x3ea101[_0x9f74('0x27')];this[_0x9f74('0x8')][_0x3ea101[_0x9f74('0x17')]][_0x9f74('0x28')]=moment()[_0x9f74('0x19')](_0x9f74('0x29'));this[_0x9f74('0x8')][_0x3ea101[_0x9f74('0x17')]][_0x9f74('0x2a')]=_0x9f74('0x2b');ami['emit']('custom:dialconnect',this[_0x9f74('0x8')][_0x3ea101[_0x9f74('0x17')]]);}this[_0x9f74('0x21')](_0x9f74('0x2c'),_0x9f74('0x20'),this[_0x9f74('0x8')][_0x3ea101['uniqueid']]);}}}catch(_0x2ea806){logger[_0x9f74('0x23')](_0x9f74('0x2d'),util[_0x9f74('0x2e')](_0x2ea806,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9f74('0x15')][_0x9f74('0x2f')]=function(_0x52b344){try{if(this[_0x9f74('0x16')](_0x52b344)){this[_0x9f74('0x30')](_0x52b344['uniqueid'],_['keys'](_0x52b344[_0x9f74('0x31')])[0x0],_0x52b344[_0x9f74('0x32')]);if(this[_0x9f74('0x16')](_0x52b344['variable'])&&this['isNotNull'](_0x52b344[_0x9f74('0x31')]['outboundrouteid'])){if(_[_0x9f74('0x14')](this['channels'][_0x52b344['uniqueid']])){this[_0x9f74('0x8')][_0x52b344[_0x9f74('0x17')]]={'routeId':_0x52b344['value'],'variables':this[_0x9f74('0xb')][_0x52b344[_0x9f74('0x17')]]};this[_0x9f74('0x21')]('voice:outbound',_0x9f74('0x20'),this[_0x9f74('0x8')][_0x52b344[_0x9f74('0x17')]]);}}}}catch(_0x3b579f){logger[_0x9f74('0x23')]('[syncVarSet][VoiceDialReport]',util[_0x9f74('0x2e')](_0x3b579f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9f74('0x15')]['addVariable']=function(_0x23df51,_0xa05cc9,_0x404cdc){var _0x4180d8=[_0x9f74('0x33'),_0x9f74('0x34'),_0x9f74('0x35'),_0x9f74('0x36'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x9f74('0x37'),'sipcallid',_0x9f74('0x38'),_0x9f74('0x39'),'bridgepvtcallid','membercalls','memberdynamic','memberinterface',_0x9f74('0x3a'),'membername','memberpenalty',_0x9f74('0x3b')];if(!_[_0x9f74('0x3c')](_0xa05cc9)&&!_[_0x9f74('0x3d')](_0x4180d8,_0xa05cc9)){if(_[_0x9f74('0x14')](this['variables'][_0x23df51])){this[_0x9f74('0xb')][_0x23df51]={};}this[_0x9f74('0xb')][_0x23df51][_0xa05cc9]=_0x404cdc;}};VoiceDialReport[_0x9f74('0x15')][_0x9f74('0x13')]=function(_0x295dc9){try{if(this['isNotNull'](_0x295dc9)){if(this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]]){this[_0x9f74('0x8')][_0x295dc9['uniqueid']]['endtime']=moment()[_0x9f74('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9f74('0x8')][_0x295dc9['uniqueid']]['duration']=moment(this['channels'][_0x295dc9[_0x9f74('0x17')]]['endtime'])[_0x9f74('0x3e')](this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x3f')],_0x9f74('0x40'));this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x2a')]=_0x9f74('0x41');this[_0x9f74('0xa')]['total']+=0x1;if(this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x28')]){this[_0x9f74('0xa')][_0x9f74('0x42')]+=0x1;this['channels'][_0x295dc9['uniqueid']][_0x9f74('0x43')]=moment(this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x28')])[_0x9f74('0x3e')](this['channels'][_0x295dc9['uniqueid']][_0x9f74('0x3f')],_0x9f74('0x40'));this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x44')]=moment(this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x45')])[_0x9f74('0x3e')](this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x28')],'seconds');this['outbound'][_0x9f74('0x46')]+=this[_0x9f74('0x8')][_0x295dc9['uniqueid']]['holdtime']||0x0;this[_0x9f74('0xa')]['sumBillable']+=this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x44')];}this[_0x9f74('0xa')]['sumDuration']+=this['channels'][_0x295dc9[_0x9f74('0x17')]][_0x9f74('0x47')];ami['emit'](_0x9f74('0x48'),this[_0x9f74('0x8')][_0x295dc9['uniqueid']]);ami[_0x9f74('0x21')](_0x9f74('0x49'),this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]]);this[_0x9f74('0x21')](_0x9f74('0x2c'),_0x9f74('0x4a'),this[_0x9f74('0xa')]);logger[_0x9f74('0x4b')](_0x9f74('0x4c'),JSON[_0x9f74('0x4d')](this[_0x9f74('0x8')][_0x295dc9[_0x9f74('0x17')]]));this['emit']('voice:outbound',_0x9f74('0x4e'),this[_0x9f74('0x8')][_0x295dc9['uniqueid']]);delete this[_0x9f74('0x8')][_0x295dc9['uniqueid']];}if(this[_0x9f74('0xb')][_0x295dc9[_0x9f74('0x17')]]){delete this[_0x9f74('0xb')][_0x295dc9[_0x9f74('0x17')]];}}}catch(_0x43d05b){logger[_0x9f74('0x23')]('[syncHangup][VoiceDialReport]',util['inspect'](_0x43d05b,{'showHidden':![],'depth':null}));}};module[_0x9f74('0x4f')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 152f8b5..cac496a 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 _0xb10c=['status','channel','catch','No\x20such\x20channel','error','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','agents','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','emitVoiceQueueSummary','inbound','answered','available','loggedIn','sumBillable','sumDuration','total','type','unmanaged','abandoned','Trunk','active','Interval','md5','format','voice_queue:save','isNotNull','loopQueueShow','queues','[queues]','loopQueueSummary','flagQueueSummary','syncQueueSummary','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','inspect','isUndefined','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','holdtime','originalposition','queuecallerabandon','queuecallerexitreason','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','queuecallerabandonAt','assigned','queuecallercomplete','queuecallerexit','queuecallerexitAt','transfer','reason','toLowerCase','local/','linkedid','add','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','addVariable','value','variable','queuestatus','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','rtpaudioqosjitter','sipcallid','sipuri','membercalls','memberdynamic','memberlastcall','memberpenalty','length','seconds','milliseconds','diff','custom:queuecallerabandon','sumHoldTime','custom:voiceQueueReport','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transfertype','switch','[syncAttendedTransfer][VoiceQueueReport]','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','prototype','enqueue','tail','finally','sequence','queueReports','channels','voiceQueues','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','isNil','Action'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb10c,0x84));var _0xcb10=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0xb10c[_0x5e1b91];return _0x59b52f;};'use strict';var _=require('lodash');var moment=require(_0xcb10('0x0'));var BPromise=require(_0xcb10('0x1'));var util=require(_0xcb10('0x2'));var md5=require('md5');var Redis=require(_0xcb10('0x3'));var config=require(_0xcb10('0x4'));var logger=require(_0xcb10('0x5'))(_0xcb10('0x6'));var ami=require(_0xcb10('0x7'));var QueueReport=require(_0xcb10('0x8'));config[_0xcb10('0x9')]=_[_0xcb10('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xcb10('0xb')][_0xcb10('0xc')]=function(_0x11247b){this['tail']=this[_0xcb10('0xd')]?this[_0xcb10('0xd')][_0xcb10('0xe')](_0x11247b):_0x11247b();};function VoiceQueueReport(_0x24ae81){this[_0xcb10('0xf')]=new Sequence();this[_0xcb10('0x10')]={};this['agents']=_0x24ae81['agents'];this[_0xcb10('0x11')]=_0x24ae81['queueChannels'];this[_0xcb10('0x12')]=_0x24ae81[_0xcb10('0x12')];this['flagQueueSummary']=!![];this['campaigns']=_0x24ae81[_0xcb10('0x13')];this[_0xcb10('0x14')]={};ami['on'](_0xcb10('0x15'),this['syncQueueSummary'][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x17'),this[_0xcb10('0x18')]['bind'](this));ami['on'](_0xcb10('0x19'),this[_0xcb10('0x1a')]['bind'](this));ami['on']('queuecallerabandon',this[_0xcb10('0x1b')][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x1c'),this[_0xcb10('0x1d')][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x1e'),this['syncAgentComplete'][_0xcb10('0x16')](this));ami['on']('agentconnect',this[_0xcb10('0x1f')][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x20'),this[_0xcb10('0x21')][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x22'),this[_0xcb10('0x23')][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x24'),this[_0xcb10('0x25')][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x26'),this[_0xcb10('0x27')][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x28'),this[_0xcb10('0x29')][_0xcb10('0x16')](this));ami['on'](_0xcb10('0x2a'),this[_0xcb10('0x2b')][_0xcb10('0x16')](this));ami['on']('blindtransfer',this[_0xcb10('0x2c')][_0xcb10('0x16')](this));this['loopQueueSummary']();this['loopQueueShow']();}function isNotNull(_0x186ef0){return _0x186ef0!==null&&!_['isUndefined'](_0x186ef0);}function clearChannels(_0xfb1e07){if(!_[_0xcb10('0x2d')](_0xfb1e07)){for(var _0x12469b in _0xfb1e07){if(_0xfb1e07[_0xcb10('0x2e')](_0x12469b)){delete _0xfb1e07[_0x12469b];}}}}function clearCampaigns(_0x10a6b1){if(!_[_0xcb10('0x2d')](_0x10a6b1)){for(var _0x4e25df in _0x10a6b1){if(_0x10a6b1[_0xcb10('0x2e')](_0x4e25df)){_0x10a6b1[_0x4e25df]['originated']=0x0;}}}}function clearVoiceQueues(_0x91359d){if(!_[_0xcb10('0x2d')](_0x91359d)){for(var _0x11c6b1 in _0x91359d){if(_0x91359d['hasOwnProperty'](_0x11c6b1)){_0x91359d[_0x11c6b1][_0xcb10('0x2f')]=0x0;_0x91359d[_0x11c6b1][_0xcb10('0x30')]=0x0;_0x91359d[_0x11c6b1][_0xcb10('0x31')]=0x0;_0x91359d[_0x11c6b1][_0xcb10('0x32')]=0x0;_0x91359d[_0x11c6b1][_0xcb10('0x33')]=!![];}}}}function clearAgentBooked(_0x226af9){if(!_[_0xcb10('0x2d')](_0x226af9)){for(var _0x50ccc3 in _0x226af9){if(_0x226af9[_0xcb10('0x2e')](_0x50ccc3)){_0x226af9[_0x50ccc3][_0xcb10('0x34')]=!![];}}}}VoiceQueueReport['prototype'][_0xcb10('0x35')]=function(){var _0x3f3b37=this;for(var _0x2d39e3 in this[_0xcb10('0x11')]){if(this[_0xcb10('0x11')]['hasOwnProperty'](_0x2d39e3)&&!this[_0xcb10('0x11')][_0x2d39e3]['switch']){this[_0xcb10('0xf')][_0xcb10('0xc')](function(){if(!_[_0xcb10('0x36')](_0x3f3b37[_0xcb10('0x11')][_0x2d39e3])){return ami[_0xcb10('0x37')]({'action':_0xcb10('0x38'),'channel':_0x3f3b37[_0xcb10('0x11')][_0x2d39e3][_0xcb10('0x39')]})[_0xcb10('0x3a')](function(_0x228e3d){if(_0x228e3d['message']===_0xcb10('0x3b')){setTimeout(function(){if(_0x3f3b37[_0xcb10('0x11')][_0x2d39e3]){delete _0x3f3b37[_0xcb10('0x11')][_0x2d39e3];logger[_0xcb10('0x3c')]('[voiceQueueReport][checkChannel]',_0x2d39e3);}if(_0x3f3b37['queueReports'][_0x2d39e3]){delete _0x3f3b37[_0xcb10('0x10')][_0x2d39e3];logger[_0xcb10('0x3c')]('[voiceQueueReport][checkQueueReport]',_0x2d39e3);}if(_0x3f3b37[_0xcb10('0x14')][_0x2d39e3]){delete _0x3f3b37[_0xcb10('0x14')][_0x2d39e3];logger['error'](_0xcb10('0x3d'),_0x2d39e3);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xcb10('0x25')]=function(){logger[_0xcb10('0x3c')](_0xcb10('0x3e'));clearChannels(this['channels']);this['clearQueueReport'](this[_0xcb10('0x10')]);clearAgentBooked(this[_0xcb10('0x3f')]);clearVoiceQueues(this[_0xcb10('0x12')]);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype'][_0xcb10('0x40')]=function(_0x414ed3){var _0x5363dd=this;if(!_['isEmpty'](_0x414ed3)){for(var _0x8d4c06 in _0x414ed3){if(_0x414ed3[_0xcb10('0x2e')](_0x8d4c06)){_0x5363dd[_0xcb10('0x41')](_0x414ed3[_0x8d4c06]);delete _0x414ed3[_0x8d4c06];}}}};function loggerCatch(_0x559dec){return function(_0x5f4bab){logger[_0xcb10('0x3c')](_0x559dec,util['inspect'](_0x5f4bab,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0xcb10('0x42')]=function(_0x22a4d3,_0x2121b6,_0x4738e6){io['to'](_0x22a4d3)[_0xcb10('0x42')](_0x2121b6,_0x4738e6);};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x43')]=function(_0x1511c8){this['emit'](util['format'](_0xcb10('0x44'),_0x1511c8[_0xcb10('0x45')]),_0xcb10('0x46'),_0x1511c8);};VoiceQueueReport['prototype'][_0xcb10('0x41')]=function(_0x937887){logger[_0xcb10('0x47')](_0xcb10('0x48'),JSON[_0xcb10('0x49')](_0x937887));this[_0xcb10('0x42')](util['format'](_0xcb10('0x44'),_0x937887[_0xcb10('0x45')]),_0xcb10('0x4a'),_0x937887);};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x4b')]=function(_0x55d574){if(_0x55d574['type']===_0xcb10('0x4c')){var _0x49567a={'id':_0x55d574['id'],'name':_0x55d574[_0xcb10('0x45')],'strategy':_0x55d574['strategy'],'answered':_0x55d574[_0xcb10('0x4d')],'available':_0x55d574[_0xcb10('0x4e')],'loggedIn':_0x55d574[_0xcb10('0x4f')],'pTalking':_0x55d574[_0xcb10('0x31')],'sumBillable':_0x55d574[_0xcb10('0x50')],'sumDuration':_0x55d574[_0xcb10('0x51')],'sumHoldTime':_0x55d574['sumHoldTime']||0x0,'talking':_0x55d574['talking'],'total':_0x55d574[_0xcb10('0x52')],'type':_0x55d574[_0xcb10('0x53')],'unmanaged':_0x55d574[_0xcb10('0x54')],'abandoned':_0x55d574[_0xcb10('0x55')],'waiting':_0x55d574[_0xcb10('0x32')]};if(_0x55d574[_0xcb10('0x56')]){_0x49567a[_0xcb10('0x56')]={'id':_0x55d574[_0xcb10('0x56')]['id'],'name':_0x55d574[_0xcb10('0x56')][_0xcb10('0x45')],'active':_0x55d574[_0xcb10('0x56')][_0xcb10('0x57')],'callerid':_0x55d574[_0xcb10('0x56')]['callerid']};}if(_0x55d574[_0xcb10('0x58')]){_0x49567a[_0xcb10('0x58')]={'id':_0x55d574[_0xcb10('0x58')]['id'],'name':_0x55d574['Interval']['name']};}var _0x2f0c82=md5(JSON['stringify'](_0x49567a));if(_0x55d574['md5']!==_0x2f0c82){_0x55d574[_0xcb10('0x59')]=_0x2f0c82;this[_0xcb10('0x42')](util[_0xcb10('0x5a')](_0xcb10('0x44'),_0x49567a['name']),_0xcb10('0x5b'),_0x49567a);}}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x5c')]=function(_0x5cc52a){return _0x5cc52a!==null&&!_['isUndefined'](_0x5cc52a);};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x5d')]=function(){var _0x212adc=this;setInterval(function(){_0x212adc[_0xcb10('0x35')]();ami[_0xcb10('0x37')]({'action':_0xcb10('0x5e')})[_0xcb10('0x3a')](loggerCatch(_0xcb10('0x5f')));},0x2710);};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x60')]=function(){var _0x81e186=this;setInterval(function(){if(_0x81e186[_0xcb10('0x61')]){return ami[_0xcb10('0x37')]({'action':_0xcb10('0x15')})['then'](function(_0xcd836a){_0x81e186[_0xcb10('0x61')]=![];})[_0xcb10('0x3a')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport['prototype'][_0xcb10('0x62')]=function(_0x36c3cc){try{if(this[_0xcb10('0x5c')](_0x36c3cc)&&this[_0xcb10('0x5c')](_0x36c3cc['queue'])){if(this['voiceQueues'][_0x36c3cc[_0xcb10('0x63')]]){var _0x3842b2=_[_0xcb10('0x64')](this[_0xcb10('0x11')],_0xcb10('0x63'))[_0x36c3cc[_0xcb10('0x63')]]||0x0;var _0x3cc077=_0x3842b2-_0x36c3cc[_0xcb10('0x65')];if(this['voiceQueues'][_0x36c3cc[_0xcb10('0x63')]][_0xcb10('0x32')]!==_[_0xcb10('0x66')](_0x36c3cc['callers'])||this['voiceQueues'][_0x36c3cc[_0xcb10('0x63')]]['loggedIn']!==_[_0xcb10('0x66')](_0x36c3cc['loggedin'])||this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]][_0xcb10('0x4e')]!==_[_0xcb10('0x66')](_0x36c3cc[_0xcb10('0x4e')])||this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]][_0xcb10('0x30')]!==_0x3cc077){this['voiceQueues'][_0x36c3cc['queue']][_0xcb10('0x32')]=_[_0xcb10('0x66')](_0x36c3cc[_0xcb10('0x65')]);this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]][_0xcb10('0x4f')]=_[_0xcb10('0x66')](_0x36c3cc[_0xcb10('0x67')]);this['voiceQueues'][_0x36c3cc['queue']][_0xcb10('0x4e')]=_[_0xcb10('0x66')](_0x36c3cc[_0xcb10('0x4e')]);this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]]['talking']=_0x3cc077>0x0?_0x3cc077:0x0;this['voiceQueues'][_0x36c3cc[_0xcb10('0x63')]]['talking']=this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]][_0xcb10('0x30')]>_[_0xcb10('0x66')](_0x36c3cc[_0xcb10('0x67')])?_[_0xcb10('0x66')](_0x36c3cc[_0xcb10('0x67')]):this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]][_0xcb10('0x30')];this[_0xcb10('0x4b')](this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]]);}ami[_0xcb10('0x42')](_0xcb10('0x68'),this[_0xcb10('0x12')][_0x36c3cc[_0xcb10('0x63')]]);}}}catch(_0x9cfeb6){logger[_0xcb10('0x3c')]('[syncQueueSummary][VoiceQueueReport]',util[_0xcb10('0x69')](_0x9cfeb6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x18')]=function(_0x68543e){this[_0xcb10('0x61')]=!![];};VoiceQueueReport[_0xcb10('0xb')]['syncNewExten']=function(_0x1636c7){};VoiceQueueReport['prototype'][_0xcb10('0x1a')]=function(_0x45b2de){try{if(this[_0xcb10('0x5c')](_0x45b2de)){if(_[_0xcb10('0x6a')](this[_0xcb10('0x10')][_0x45b2de[_0xcb10('0x6b')]])){this['queueReports'][_0x45b2de[_0xcb10('0x6b')]]=[];this[_0xcb10('0x11')][_0x45b2de['uniqueid']]={};}var _0x3b1758=new QueueReport();_0x3b1758[_0xcb10('0x45')]=_0x45b2de[_0xcb10('0x63')];_0x3b1758[_0xcb10('0x53')]=this[_0xcb10('0x12')][_0x3b1758[_0xcb10('0x45')]]&&this[_0xcb10('0x12')][_0x3b1758['name']]['type']?this['voiceQueues'][_0x3b1758[_0xcb10('0x45')]][_0xcb10('0x53')]||'inbound':_0xcb10('0x4c');_0x3b1758[_0xcb10('0x63')]=_0x45b2de['queue'];_0x3b1758[_0xcb10('0x6c')]=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x3b1758['position']=_0x45b2de[_0xcb10('0x6e')];_0x3b1758[_0xcb10('0x6f')]=_0x45b2de[_0xcb10('0x6f')];_[_0xcb10('0x70')](_0x3b1758,_[_0xcb10('0x71')](_0x45b2de,_[_0xcb10('0x72')](_0x3b1758)));this[_0xcb10('0x10')][_0x45b2de[_0xcb10('0x6b')]][_0xcb10('0x73')](_0x3b1758);this[_0xcb10('0x11')][_0x45b2de[_0xcb10('0x6b')]]=_0x3b1758;this['emitVoiceQueueChannelSave'](_0x3b1758);}}catch(_0x2df43d){logger['error'](_0xcb10('0x74'),util['inspect'](_0x2df43d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x1b')]=function(_0x3bb3e9){try{if(this[_0xcb10('0x5c')](_0x3bb3e9)){if(this[_0xcb10('0x10')][_0x3bb3e9['uniqueid']]){var _0x5b67f1=_['last'](this[_0xcb10('0x10')][_0x3bb3e9[_0xcb10('0x6b')]]);_0x5b67f1['queuecallercomplete']=![];_0x5b67f1['queuecallercompleteAt']=null;_0x5b67f1[_0xcb10('0x75')]=_0x3bb3e9[_0xcb10('0x75')];_0x5b67f1[_0xcb10('0x76')]=_0x3bb3e9[_0xcb10('0x76')];_0x5b67f1[_0xcb10('0x77')]=!![];_0x5b67f1['queuecallerabandonAt']=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x5b67f1[_0xcb10('0x78')]='ABANDONED';_0x5b67f1[_0xcb10('0x79')]=null;this[_0xcb10('0x11')][_0x3bb3e9[_0xcb10('0x6b')]]=_0x5b67f1;this[_0xcb10('0x41')](_0x5b67f1);}}}catch(_0x2ef9f9){logger['error'](_0xcb10('0x7a'),util[_0xcb10('0x69')](_0x2ef9f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')]['syncQueueCallerLeave']=function(_0x5e83bf){try{if(this[_0xcb10('0x5c')](_0x5e83bf)){if(this[_0xcb10('0x10')][_0x5e83bf[_0xcb10('0x6b')]]){var _0x4dbc7a=_[_0xcb10('0x7b')](this[_0xcb10('0x10')][_0x5e83bf[_0xcb10('0x6b')]]);_0x4dbc7a[_0xcb10('0x7c')]=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x4dbc7a[_0xcb10('0x7d')]=_0x5e83bf[_0xcb10('0x7d')];_0x4dbc7a['connectedlinename']=_0x5e83bf[_0xcb10('0x7e')];this[_0xcb10('0x11')][_0x5e83bf[_0xcb10('0x6b')]]=_0x4dbc7a;this[_0xcb10('0x43')](_0x4dbc7a);}}}catch(_0x96d1cd){logger[_0xcb10('0x3c')](_0xcb10('0x7f'),util[_0xcb10('0x69')](_0x96d1cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x1f')]=function(_0x17c08b){try{if(this[_0xcb10('0x5c')](_0x17c08b)){if(this['queueReports'][_0x17c08b[_0xcb10('0x6b')]]){var _0x3c9161=_[_0xcb10('0x7b')](this[_0xcb10('0x10')][_0x17c08b[_0xcb10('0x6b')]]);_0x3c9161['queuecallercomplete']=!![];_0x3c9161[_0xcb10('0x78')]=_0xcb10('0x80');}}}catch(_0x10cdf7){logger[_0xcb10('0x3c')](_0xcb10('0x81'),util[_0xcb10('0x69')](_0x10cdf7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x5346af){try{if(this[_0xcb10('0x5c')](_0x5346af)){if(this['queueReports'][_0x5346af[_0xcb10('0x6b')]]){var _0x1d575e=_[_0xcb10('0x7b')](this['queueReports'][_0x5346af[_0xcb10('0x6b')]]);_0x1d575e[_0xcb10('0x77')]=![];_0x1d575e[_0xcb10('0x82')]=null;_0x1d575e[_0xcb10('0x83')]=!![];_0x1d575e[_0xcb10('0x79')]=_0x5346af['membername'];_0x1d575e['holdtime']=_0x5346af['holdtime'];_0x1d575e[_0xcb10('0x84')]=!![];_0x1d575e[_0xcb10('0x85')]=![];_0x1d575e[_0xcb10('0x86')]=null;if(!_0x1d575e[_0xcb10('0x87')]){if(_0x5346af[_0xcb10('0x88')]=='transfer'){_0x1d575e[_0xcb10('0x78')]='COMPLETED';}else{if(_['startsWith'](_0x5346af[_0xcb10('0x39')][_0xcb10('0x89')](),_0xcb10('0x8a'))){if(this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x8b')]]){var _0x1f9dfc=_[_0xcb10('0x7b')](this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x8b')]]);_0x1f9dfc[_0xcb10('0x84')]=![];_0x1f9dfc[_0xcb10('0x85')]=!![];_0x1f9dfc[_0xcb10('0x86')]=moment(_0x1d575e['queuecallerjoinAt'])[_0xcb10('0x8c')](_0x5346af[_0xcb10('0x75')],'seconds')[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x1f9dfc['queuecallerexitreason']='FORWARDTRANSFER';_0x1f9dfc[_0xcb10('0x87')]=!![];_0x1f9dfc['transfertype']=_0xcb10('0x8d');_0x1f9dfc[_0xcb10('0x8e')]=_0x5346af[_0xcb10('0x8f')];_0x1f9dfc[_0xcb10('0x90')]=_0x5346af['uniqueid'];var _0x2b0adf=this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x8b')]];this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x8b')]]=this[_0xcb10('0x10')][_0x5346af[_0xcb10('0x6b')]];this['queueReports'][_0x5346af[_0xcb10('0x6b')]]=_0x2b0adf;}}else{_0x1d575e['queuecallerexitreason']=_0xcb10('0x91')+_0x5346af[_0xcb10('0x88')][_0xcb10('0x92')]();}}}this['channels'][_0x5346af[_0xcb10('0x6b')]]=_0x1d575e;this[_0xcb10('0x41')](_0x1d575e);}}}catch(_0xa60624){logger[_0xcb10('0x3c')]('[syncAgentComplete][VoiceQueueReport]',util[_0xcb10('0x69')](_0xa60624,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x21')]=function(_0x319104){try{if(this[_0xcb10('0x5c')](_0x319104)){this[_0xcb10('0x93')](_0x319104[_0xcb10('0x6b')],_['keys'](_0x319104['variable'])[0x0],_0x319104[_0xcb10('0x94')]);if(this['queueReports'][_0x319104[_0xcb10('0x6b')]]){var _0x21aa1a=_['last'](this[_0xcb10('0x10')][_0x319104[_0xcb10('0x6b')]]);if(_0x21aa1a){if(this[_0xcb10('0x5c')](_0x319104[_0xcb10('0x95')])&&this[_0xcb10('0x5c')](_0x319104['variable'][_0xcb10('0x96')])){switch(_0x319104['value']){case'CONTINUE':_0x21aa1a[_0xcb10('0x85')]=![];_0x21aa1a[_0xcb10('0x86')]=null;break;case'TIMEOUT':_0x21aa1a[_0xcb10('0x97')]=_0xcb10('0x98');ami[_0xcb10('0x42')](_0xcb10('0x99'),_0x21aa1a);break;default:_0x21aa1a[_0xcb10('0x85')]=!![];_0x21aa1a[_0xcb10('0x86')]=moment()['format'](_0xcb10('0x6d'));_0x21aa1a[_0xcb10('0x7c')]=moment()[_0xcb10('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x21aa1a[_0xcb10('0x77')]=![];_0x21aa1a['queuecallerabandonAt']=null;_0x21aa1a[_0xcb10('0x78')]=_0x319104[_0xcb10('0x94')];this[_0xcb10('0x11')][_0x319104[_0xcb10('0x6b')]]=_0x21aa1a;this[_0xcb10('0x41')](_0x21aa1a);}else if(this[_0xcb10('0x5c')](_0x319104['variable'])&&this['isNotNull'](_0x319104['variable'][_0xcb10('0x9a')])){if(!_0x21aa1a[_0xcb10('0x77')]){_0x21aa1a[_0xcb10('0x85')]=!![];_0x21aa1a[_0xcb10('0x86')]=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));_0x21aa1a[_0xcb10('0x78')]=_0xcb10('0x9b');_0x21aa1a[_0xcb10('0x7c')]=moment()[_0xcb10('0x5a')](_0xcb10('0x6d'));this[_0xcb10('0x11')][_0x319104[_0xcb10('0x6b')]]=_0x21aa1a;}}_0x21aa1a[_0xcb10('0x14')]=this[_0xcb10('0x14')][_0x319104['uniqueid']];}}}}catch(_0x437360){logger[_0xcb10('0x3c')]('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x437360,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcb10('0xb')]['addVariable']=function(_0x2e6813,_0x2199d9,_0x16faa2){var _0x4675a5=['rtpaudioqos','rtpaudioqosbridged',_0xcb10('0x9c'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0xcb10('0x9d'),_0xcb10('0x9e'),'bridgepeer','bridgepvtcallid',_0xcb10('0x9f'),_0xcb10('0xa0'),'memberinterface',_0xcb10('0xa1'),'membername',_0xcb10('0xa2'),'memberrealtime'];if(!_[_0xcb10('0x36')](_0x2199d9)&&!_['includes'](_0x4675a5,_0x2199d9)){if(_[_0xcb10('0x6a')](this['variables'][_0x2e6813])){this[_0xcb10('0x14')][_0x2e6813]={};}this[_0xcb10('0x14')][_0x2e6813][_0x2199d9]=_0x16faa2;}};VoiceQueueReport[_0xcb10('0xb')][_0xcb10('0x23')]=function(_0x5a04c8){try{if(this[_0xcb10('0x5c')](_0x5a04c8)){if(this[_0xcb10('0x10')][_0x5a04c8[_0xcb10('0x6b')]]){for(var _0xe1a383=0x0,_0x4d7aff={};_0xe1a3830x0?_0x6bf3b8:0x0;this[_0x3745('0x16')][_0x45f62b[_0x3745('0x61')]]['talking']=this[_0x3745('0x16')][_0x45f62b[_0x3745('0x61')]][_0x3745('0x30')]>_[_0x3745('0x64')](_0x45f62b['loggedin'])?_[_0x3745('0x64')](_0x45f62b[_0x3745('0x65')]):this['voiceQueues'][_0x45f62b[_0x3745('0x61')]][_0x3745('0x30')];this[_0x3745('0x4a')](this['voiceQueues'][_0x45f62b[_0x3745('0x61')]]);}ami[_0x3745('0x42')](_0x3745('0x66'),this[_0x3745('0x16')][_0x45f62b[_0x3745('0x61')]]);}}}catch(_0x302af6){logger[_0x3745('0x3b')](_0x3745('0x67'),util[_0x3745('0x41')](_0x302af6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3745('0xd')][_0x3745('0x1c')]=function(_0xa4e412){this[_0x3745('0x5d')]=!![];};VoiceQueueReport[_0x3745('0xd')][_0x3745('0x68')]=function(_0x214c88){};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2d7cf9){try{if(this[_0x3745('0x60')](_0x2d7cf9)){if(_['isUndefined'](this[_0x3745('0x12')][_0x2d7cf9[_0x3745('0x69')]])){this[_0x3745('0x12')][_0x2d7cf9[_0x3745('0x69')]]=[];this[_0x3745('0x14')][_0x2d7cf9[_0x3745('0x69')]]={};}var _0x309ac1=new QueueReport();_0x309ac1[_0x3745('0x46')]=_0x2d7cf9[_0x3745('0x61')];_0x309ac1[_0x3745('0x54')]=this[_0x3745('0x16')][_0x309ac1[_0x3745('0x46')]]&&this[_0x3745('0x16')][_0x309ac1[_0x3745('0x46')]][_0x3745('0x54')]?this[_0x3745('0x16')][_0x309ac1[_0x3745('0x46')]]['type']||'inbound':_0x3745('0x4b');_0x309ac1[_0x3745('0x61')]=_0x2d7cf9['queue'];_0x309ac1[_0x3745('0x6a')]=moment()['format'](_0x3745('0x6b'));_0x309ac1[_0x3745('0x6c')]=_0x2d7cf9[_0x3745('0x6c')];_0x309ac1[_0x3745('0x6d')]=_0x2d7cf9[_0x3745('0x6d')];_[_0x3745('0x6e')](_0x309ac1,_[_0x3745('0x6f')](_0x2d7cf9,_['keys'](_0x309ac1)));this['queueReports'][_0x2d7cf9[_0x3745('0x69')]][_0x3745('0x70')](_0x309ac1);this[_0x3745('0x14')][_0x2d7cf9[_0x3745('0x69')]]=_0x309ac1;this[_0x3745('0x43')](_0x309ac1);}}catch(_0x24a99a){logger[_0x3745('0x3b')](_0x3745('0x71'),util[_0x3745('0x41')](_0x24a99a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3745('0xd')][_0x3745('0x72')]=function(_0x360b00){try{if(this[_0x3745('0x60')](_0x360b00)){if(this[_0x3745('0x12')][_0x360b00[_0x3745('0x69')]]){var _0x3ae96d=_[_0x3745('0x73')](this[_0x3745('0x12')][_0x360b00[_0x3745('0x69')]]);_0x3ae96d[_0x3745('0x74')]=![];_0x3ae96d[_0x3745('0x75')]=null;_0x3ae96d[_0x3745('0x76')]=_0x360b00[_0x3745('0x76')];_0x3ae96d['originalposition']=_0x360b00['originalposition'];_0x3ae96d[_0x3745('0x1e')]=!![];_0x3ae96d[_0x3745('0x77')]=moment()['format'](_0x3745('0x6b'));_0x3ae96d[_0x3745('0x78')]=_0x3745('0x79');_0x3ae96d['lastAssignedTo']=null;this[_0x3745('0x14')][_0x360b00[_0x3745('0x69')]]=_0x3ae96d;this[_0x3745('0x7a')](_0x3ae96d);}}}catch(_0x16defa){logger[_0x3745('0x3b')](_0x3745('0x7b'),util[_0x3745('0x41')](_0x16defa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3745('0xd')][_0x3745('0x7c')]=function(_0x4921c2){try{if(this[_0x3745('0x60')](_0x4921c2)){if(this[_0x3745('0x12')][_0x4921c2[_0x3745('0x69')]]){var _0x16e61e=_[_0x3745('0x73')](this['queueReports'][_0x4921c2[_0x3745('0x69')]]);_0x16e61e['queuecallerleaveAt']=moment()[_0x3745('0x44')](_0x3745('0x6b'));_0x16e61e[_0x3745('0x7d')]=_0x4921c2[_0x3745('0x7d')];_0x16e61e[_0x3745('0x7e')]=_0x4921c2[_0x3745('0x7e')];this['channels'][_0x4921c2[_0x3745('0x69')]]=_0x16e61e;this[_0x3745('0x43')](_0x16e61e);}}}catch(_0x437dd7){logger[_0x3745('0x3b')](_0x3745('0x7f'),util['inspect'](_0x437dd7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3745('0xd')][_0x3745('0x22')]=function(_0x18b101){try{if(this[_0x3745('0x60')](_0x18b101)){if(this[_0x3745('0x12')][_0x18b101[_0x3745('0x69')]]){var _0x3a7b52=_[_0x3745('0x73')](this[_0x3745('0x12')][_0x18b101[_0x3745('0x69')]]);_0x3a7b52[_0x3745('0x74')]=!![];_0x3a7b52[_0x3745('0x78')]='COMPLETEDBYAGENT';}}}catch(_0x2dbd70){logger[_0x3745('0x3b')](_0x3745('0x80'),util['inspect'](_0x2dbd70,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3745('0x21')]=function(_0x23f7f6){try{if(this[_0x3745('0x60')](_0x23f7f6)){if(this[_0x3745('0x12')][_0x23f7f6['uniqueid']]){var _0x3c1dec=_[_0x3745('0x73')](this[_0x3745('0x12')][_0x23f7f6[_0x3745('0x69')]]);_0x3c1dec[_0x3745('0x1e')]=![];_0x3c1dec['queuecallerabandonAt']=null;_0x3c1dec[_0x3745('0x81')]=!![];_0x3c1dec[_0x3745('0x82')]=_0x23f7f6[_0x3745('0x83')];_0x3c1dec[_0x3745('0x76')]=_0x23f7f6[_0x3745('0x76')];_0x3c1dec[_0x3745('0x74')]=!![];_0x3c1dec[_0x3745('0x84')]=![];_0x3c1dec[_0x3745('0x85')]=null;if(!_0x3c1dec[_0x3745('0x86')]){if(_0x23f7f6[_0x3745('0x87')]=='transfer'){_0x3c1dec[_0x3745('0x78')]=_0x3745('0x88');}else{if(_[_0x3745('0x89')](_0x23f7f6[_0x3745('0x38')]['toLowerCase'](),'local/')){if(this[_0x3745('0x12')][_0x23f7f6[_0x3745('0x8a')]]){var _0x32ce26=_['last'](this[_0x3745('0x12')][_0x23f7f6['linkedid']]);_0x32ce26[_0x3745('0x74')]=![];_0x32ce26['queuecallerexit']=!![];_0x32ce26['queuecallerexitAt']=moment(_0x3c1dec['queuecallerjoinAt'])[_0x3745('0x8b')](_0x23f7f6[_0x3745('0x76')],_0x3745('0x8c'))[_0x3745('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x32ce26[_0x3745('0x78')]=_0x3745('0x8d');_0x32ce26[_0x3745('0x86')]=!![];_0x32ce26[_0x3745('0x8e')]=_0x3745('0x8f');_0x32ce26['transferexten']=_0x23f7f6[_0x3745('0x90')];_0x32ce26[_0x3745('0x91')]=_0x23f7f6[_0x3745('0x69')];var _0x4017ac=this[_0x3745('0x12')][_0x23f7f6['linkedid']];this[_0x3745('0x12')][_0x23f7f6[_0x3745('0x8a')]]=this['queueReports'][_0x23f7f6[_0x3745('0x69')]];this[_0x3745('0x12')][_0x23f7f6['uniqueid']]=_0x4017ac;}}else{_0x3c1dec[_0x3745('0x78')]='COMPLETEDBY'+_0x23f7f6['reason'][_0x3745('0x92')]();}}}this[_0x3745('0x14')][_0x23f7f6[_0x3745('0x69')]]=_0x3c1dec;this[_0x3745('0x7a')](_0x3c1dec);}}}catch(_0x57d3ed){logger[_0x3745('0x3b')]('[syncAgentComplete][VoiceQueueReport]',util[_0x3745('0x41')](_0x57d3ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3745('0xd')][_0x3745('0x24')]=function(_0x4d8c9e){try{if(this['isNotNull'](_0x4d8c9e)){this['addVariable'](_0x4d8c9e[_0x3745('0x69')],_[_0x3745('0x93')](_0x4d8c9e['variable'])[0x0],_0x4d8c9e[_0x3745('0x94')]);if(this[_0x3745('0x12')][_0x4d8c9e[_0x3745('0x69')]]){var _0x42d9ba=_[_0x3745('0x73')](this['queueReports'][_0x4d8c9e['uniqueid']]);if(_0x42d9ba){if(this[_0x3745('0x60')](_0x4d8c9e[_0x3745('0x95')])&&this[_0x3745('0x60')](_0x4d8c9e[_0x3745('0x95')]['queuestatus'])){switch(_0x4d8c9e[_0x3745('0x94')]){case _0x3745('0x96'):_0x42d9ba['queuecallerexit']=![];_0x42d9ba['queuecallerexitAt']=null;break;case'TIMEOUT':_0x42d9ba['lastevent']=_0x3745('0x97');ami[_0x3745('0x42')](_0x3745('0x98'),_0x42d9ba);break;default:_0x42d9ba['queuecallerexit']=!![];_0x42d9ba[_0x3745('0x85')]=moment()[_0x3745('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x42d9ba[_0x3745('0x99')]=moment()[_0x3745('0x44')](_0x3745('0x6b'));}_0x42d9ba['queuecallerabandon']=![];_0x42d9ba[_0x3745('0x77')]=null;_0x42d9ba[_0x3745('0x78')]=_0x4d8c9e[_0x3745('0x94')];this[_0x3745('0x14')][_0x4d8c9e['uniqueid']]=_0x42d9ba;this[_0x3745('0x7a')](_0x42d9ba);}else if(this[_0x3745('0x60')](_0x4d8c9e[_0x3745('0x95')])&&this['isNotNull'](_0x4d8c9e['variable']['queueposition'])){if(!_0x42d9ba['queuecallerabandon']){_0x42d9ba[_0x3745('0x84')]=!![];_0x42d9ba[_0x3745('0x85')]=moment()[_0x3745('0x44')](_0x3745('0x6b'));_0x42d9ba[_0x3745('0x78')]=_0x3745('0x9a');_0x42d9ba[_0x3745('0x99')]=moment()[_0x3745('0x44')](_0x3745('0x6b'));this[_0x3745('0x14')][_0x4d8c9e[_0x3745('0x69')]]=_0x42d9ba;}}_0x42d9ba[_0x3745('0x18')]=this[_0x3745('0x18')][_0x4d8c9e[_0x3745('0x69')]];}}}}catch(_0x16ac29){logger[_0x3745('0x3b')]('[syncVarSet][VoiceQueueReport]',util[_0x3745('0x41')](_0x16ac29,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3745('0xd')][_0x3745('0x9b')]=function(_0x5e4308,_0x209f09,_0x1d1958){var _0xfcffaa=[_0x3745('0x9c'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x3745('0x9d'),_0x3745('0x9e'),_0x3745('0x9f'),_0x3745('0xa0'),_0x3745('0xa1'),_0x3745('0xa2'),'sipuri',_0x3745('0xa3'),_0x3745('0xa4'),_0x3745('0xa5'),_0x3745('0xa6'),_0x3745('0xa7'),_0x3745('0xa8'),_0x3745('0x83'),_0x3745('0xa9'),_0x3745('0xaa')];if(!_[_0x3745('0x35')](_0x209f09)&&!_[_0x3745('0xab')](_0xfcffaa,_0x209f09)){if(_['isUndefined'](this[_0x3745('0x18')][_0x5e4308])){this['variables'][_0x5e4308]={};}this[_0x3745('0x18')][_0x5e4308][_0x209f09]=_0x1d1958;}};VoiceQueueReport[_0x3745('0xd')][_0x3745('0xac')]=function(_0x1ceda5){try{if(this[_0x3745('0x60')](_0x1ceda5)){if(this['queueReports'][_0x1ceda5[_0x3745('0x69')]]){for(var _0x184dfc=0x0,_0x329ceb={};_0x184dfc=0x0?moment(_0x3daa57[_0xb647('0x1b')])['diff'](_0x3daa57['starttime'],_0xb647('0xf')):null,'data1':'outbound','data2':_0x3daa57[_0xb647('0x1c')],'data3':_0x3daa57['exten'],'data4':_0x3daa57[_0xb647('0x1d')]||null,'role':_0xb647('0x14'),'internal':_0x3daa57[_0xb647('0x1c')]?_['toNumber'](_0x3daa57[_0xb647('0x1c')]):undefined,'uniqueid':_0x3daa57[_0xb647('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xb110=['membername','starttime','endtime','outbound','dialstring','moment','lodash','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','interface','format','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xb110,0x144));var _0x0b11=function(_0x580776,_0xa214bc){_0x580776=_0x580776-0x0;var _0x31a81c=_0xb110[_0x580776];return _0x31a81c;};'use strict';var moment=require(_0x0b11('0x0'));var _=require(_0x0b11('0x1'));var util=require('util');var client=require(_0x0b11('0x2'));exports[_0x0b11('0x3')]=function(_0x183662){var _0x5167b2=_0x183662['queuecallercompleteAt']||_0x183662[_0x0b11('0x4')];return client[_0x0b11('0x5')](_0x0b11('0x6'),{'body':{'channel':_0x0b11('0x7'),'membername':_0x183662['lastAssignedTo'],'interface':_['isNil'](_0x183662[_0x0b11('0x8')])?util[_0x0b11('0x9')]('SIP/%s',_0x183662[_0x0b11('0xa')]):_0x183662[_0x0b11('0x8')],'type':_0x0b11('0xb'),'enterAt':_0x183662[_0x0b11('0xc')],'exitAt':_0x5167b2,'duration':moment(_0x5167b2)[_0x0b11('0xd')](_0x183662[_0x0b11('0xc')],_0x0b11('0xe')),'data1':_0x0b11('0xf'),'data2':_0x183662[_0x0b11('0x10')],'data3':_0x183662[_0x0b11('0x11')],'data4':null,'data5':_0x183662[_0x0b11('0x12')],'role':_0x0b11('0x13'),'internal':_0x183662[_0x0b11('0x14')]?_[_0x0b11('0x15')](_0x183662[_0x0b11('0x14')]):undefined,'uniqueid':_0x183662[_0x0b11('0x16')]},'log':_0x0b11('0x6')});};exports[_0x0b11('0x17')]=function(_0x44f162){return client[_0x0b11('0x5')](_0x0b11('0x6'),{'body':{'channel':_0x0b11('0x7'),'membername':_0x44f162[_0x0b11('0x18')],'interface':_0x44f162[_0x0b11('0x8')],'type':_0x0b11('0xb'),'enterAt':_0x44f162[_0x0b11('0x19')],'exitAt':_0x44f162[_0x0b11('0x1a')],'duration':moment(_0x44f162[_0x0b11('0x1a')])[_0x0b11('0xd')](_0x44f162['starttime'],_0x0b11('0xe'))>=0x0?moment(_0x44f162[_0x0b11('0x1a')])[_0x0b11('0xd')](_0x44f162[_0x0b11('0x19')],'seconds'):null,'data1':_0x0b11('0x1b'),'data2':_0x44f162[_0x0b11('0x14')],'data3':_0x44f162[_0x0b11('0x11')],'data4':_0x44f162[_0x0b11('0x1c')]||null,'role':_0x0b11('0x13'),'internal':_0x44f162[_0x0b11('0x14')]?_[_0x0b11('0x15')](_0x44f162[_0x0b11('0x14')]):undefined,'uniqueid':_0x44f162[_0x0b11('0x16')]},'log':_0x0b11('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 3ade2b6..f2a1556 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 _0x073e=['GetTemplate','../client','getTemplates','html'];(function(_0x466101,_0x41dc92){var _0x562d55=function(_0x44ca99){while(--_0x44ca99){_0x466101['push'](_0x466101['shift']());}};_0x562d55(++_0x41dc92);}(_0x073e,0x181));var _0xe073=function(_0x37b32b,_0x3a8bfb){_0x37b32b=_0x37b32b-0x0;var _0x2c9ed0=_0x073e[_0x37b32b];return _0x2c9ed0;};'use strict';var client=require(_0xe073('0x0'));exports[_0xe073('0x1')]=function(_0x876bb9){return function(_0x358375){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xe073('0x2')]},'log':_0xe073('0x3')});};}; \ No newline at end of file +var _0xad8a=['html','GetTemplate','../client','getTemplates','Request','name'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xad8a,0xb0));var _0xaad8=function(_0x55a496,_0x12a0a3){_0x55a496=_0x55a496-0x0;var _0x57fb12=_0xad8a[_0x55a496];return _0x57fb12;};'use strict';var client=require(_0xaad8('0x0'));exports[_0xaad8('0x1')]=function(_0x6efdc8){return function(_0xa8be63){return client[_0xaad8('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xaad8('0x3'),_0xaad8('0x4')]},'log':_0xaad8('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 1204f7d..3c18e02 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 _0x0826=['data7','GetTrigger','../client','getTriggers','Request','Condition','AllConditions','field','operator','value','AnyConditions','Action','data3','data4','data6'];(function(_0x5338d3,_0x470835){var _0x8beb32=function(_0x718ac9){while(--_0x718ac9){_0x5338d3['push'](_0x5338d3['shift']());}};_0x8beb32(++_0x470835);}(_0x0826,0xc5));var _0x6082=function(_0x4414a6,_0x1dbf0e){_0x4414a6=_0x4414a6-0x0;var _0x5f009c=_0x0826[_0x4414a6];return _0x5f009c;};'use strict';var client=require(_0x6082('0x0'));exports[_0x6082('0x1')]=function(_0x9f03b7){return function(_0x6c27ac){return client[_0x6082('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x6082('0x3'),'as':_0x6082('0x4'),'attributes':['id',_0x6082('0x5'),_0x6082('0x6'),_0x6082('0x7')]},{'model':'Condition','as':_0x6082('0x8'),'attributes':['id',_0x6082('0x5'),_0x6082('0x6'),_0x6082('0x7')]},{'model':_0x6082('0x9'),'as':'Actions','attributes':['id','action','data1','data2',_0x6082('0xa'),_0x6082('0xb'),'data5',_0x6082('0xc'),_0x6082('0xd')]}]},'log':_0x6082('0xe')});};}; \ No newline at end of file +var _0xb74b=['getTriggers','Request','GetTrigger','name','field','operator','value','Condition','Action','Actions','action','data1','data2','data5','data6','data7','../client'];(function(_0x9c9660,_0x523234){var _0x35913e=function(_0x520f64){while(--_0x520f64){_0x9c9660['push'](_0x9c9660['shift']());}};_0x35913e(++_0x523234);}(_0xb74b,0x142));var _0xbb74=function(_0x4a7b2b,_0x3366e1){_0x4a7b2b=_0x4a7b2b-0x0;var _0x35e381=_0xb74b[_0x4a7b2b];return _0x35e381;};'use strict';var client=require(_0xbb74('0x0'));exports[_0xbb74('0x1')]=function(_0x96999a){return function(_0x399ca2){return client[_0xbb74('0x2')](_0xbb74('0x3'),{'options':{'raw':![],'attributes':['id',_0xbb74('0x4'),'channel','status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xbb74('0x5'),_0xbb74('0x6'),_0xbb74('0x7')]},{'model':_0xbb74('0x8'),'as':'AnyConditions','attributes':['id','field','operator',_0xbb74('0x7')]},{'model':_0xbb74('0x9'),'as':_0xbb74('0xa'),'attributes':['id',_0xbb74('0xb'),_0xbb74('0xc'),_0xbb74('0xd'),'data3','data4',_0xbb74('0xe'),_0xbb74('0xf'),_0xbb74('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a43c58c..a96835a 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 _0x2b12=['registry','../client','Request','name'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x2b12,0x69));var _0x22b1=function(_0x5d84d6,_0x1a4671){_0x5d84d6=_0x5d84d6-0x0;var _0x2cd0f5=_0x2b12[_0x5d84d6];return _0x2cd0f5;};'use strict';var client=require(_0x22b1('0x0'));exports['getTrunks']=function(_0x1ac419){return function(_0x226c44){return client[_0x22b1('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x22b1('0x2'),_0x22b1('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x7664=['name','registry','getTrunks','GetTrunk'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7664,0xb6));var _0x4766=function(_0x3d3015,_0x5d4ae3){_0x3d3015=_0x3d3015-0x0;var _0x44b59f=_0x7664[_0x3d3015];return _0x44b59f;};'use strict';var client=require('../client');exports[_0x4766('0x0')]=function(_0x2ae3a3){return function(_0x5c4b14){return client['Request'](_0x4766('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4766('0x2'),_0x4766('0x3')]},'log':_0x4766('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d99aae9..7c8b172 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 _0xedf9=['fullname','pauseType','voicePause','mobile','interface','getTelephones','telephone','accountcode','internal','PauseUser','savePause','UnpauseUser','getAgent','ShowUser','online','lastPauseAt','getAgents','Request','agent','name','email'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xedf9,0x64));var _0x9edf=function(_0x37df7f,_0x4c827d){_0x37df7f=_0x37df7f-0x0;var _0x59fd67=_0xedf9[_0x37df7f];return _0x59fd67;};'use strict';var client=require('../client');exports[_0x9edf('0x0')]=function(){return function(){return client[_0x9edf('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0x9edf('0x2')},'attributes':['id',_0x9edf('0x3'),_0x9edf('0x4'),'accountcode',_0x9edf('0x5'),'online','lastLoginAt',_0x9edf('0x6'),'lastPauseAt',_0x9edf('0x7'),'phone',_0x9edf('0x8'),_0x9edf('0x9')]},'log':'getAgents'});};};exports[_0x9edf('0xa')]=function(){return function(){return client[_0x9edf('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x9edf('0xb')},'attributes':['id',_0x9edf('0x3'),_0x9edf('0xc'),_0x9edf('0xd')]},'log':_0x9edf('0xa')});};};exports['savePause']=function(_0x3f991b,_0x2bf6f1,_0x5ebb99){return client['Request'](_0x9edf('0xe'),{'body':{'type':_0x2bf6f1,'uniqueid':_0x5ebb99},'options':{'where':{'id':_0x3f991b['id']}},'log':_0x9edf('0xf')});};exports['saveUnpause']=function(_0x91bad){return client['Request'](_0x9edf('0x10'),{'body':{},'options':{'where':{'id':_0x91bad['id']}},'log':_0x9edf('0xf')});};exports[_0x9edf('0x11')]=function(_0x554e32){return client[_0x9edf('0x1')](_0x9edf('0x12'),{'options':{'raw':![],'where':{'role':_0x9edf('0x2'),'id':_0x554e32},'attributes':['id',_0x9edf('0x3'),'email',_0x9edf('0xc'),_0x9edf('0x5'),_0x9edf('0x13'),'lastLoginAt',_0x9edf('0x6'),_0x9edf('0x14'),'voicePause','interface']},'log':_0x9edf('0x11')});}; \ No newline at end of file +var _0x9b7f=['lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','saveUnpause','getAgent','voicePause','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType'];(function(_0x237b3b,_0x591f4b){var _0x48a55d=function(_0x2b5afa){while(--_0x2b5afa){_0x237b3b['push'](_0x237b3b['shift']());}};_0x48a55d(++_0x591f4b);}(_0x9b7f,0x121));var _0xf9b7=function(_0x3e6108,_0x2b73c0){_0x3e6108=_0x3e6108-0x0;var _0x2bb0bb=_0x9b7f[_0x3e6108];return _0x2bb0bb;};'use strict';var client=require(_0xf9b7('0x0'));exports[_0xf9b7('0x1')]=function(){return function(){return client[_0xf9b7('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0xf9b7('0x3')},'attributes':['id',_0xf9b7('0x4'),_0xf9b7('0x5'),_0xf9b7('0x6'),_0xf9b7('0x7'),_0xf9b7('0x8'),_0xf9b7('0x9'),_0xf9b7('0xa'),_0xf9b7('0xb'),'voicePause','phone','mobile',_0xf9b7('0xc')]},'log':'getAgents'});};};exports[_0xf9b7('0xd')]=function(){return function(){return client[_0xf9b7('0x2')](_0xf9b7('0xe'),{'options':{'raw':!![],'where':{'role':_0xf9b7('0xf')},'attributes':['id','name',_0xf9b7('0x6'),'internal']},'log':'getTelephones'});};};exports[_0xf9b7('0x10')]=function(_0x45aa1b,_0x593e45,_0x2cb1da){return client[_0xf9b7('0x2')]('PauseUser',{'body':{'type':_0x593e45,'uniqueid':_0x2cb1da},'options':{'where':{'id':_0x45aa1b['id']}},'log':_0xf9b7('0x10')});};exports[_0xf9b7('0x11')]=function(_0x5ce795){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5ce795['id']}},'log':_0xf9b7('0x10')});};exports[_0xf9b7('0x12')]=function(_0x2ac03d){return client[_0xf9b7('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0xf9b7('0x3'),'id':_0x2ac03d},'attributes':['id','name',_0xf9b7('0x5'),_0xf9b7('0x6'),_0xf9b7('0x7'),_0xf9b7('0x8'),_0xf9b7('0x9'),_0xf9b7('0xa'),'lastPauseAt',_0xf9b7('0x13'),_0xf9b7('0xc')]},'log':_0xf9b7('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 3b61d88..0272660 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 _0x102f=['UpdateVoiceAgentReport','Request','update'];(function(_0x730f27,_0x4a8fa5){var _0x13fe15=function(_0xd14a9){while(--_0xd14a9){_0x730f27['push'](_0x730f27['shift']());}};_0x13fe15(++_0x4a8fa5);}(_0x102f,0x1d2));var _0xf102=function(_0x3833fd,_0x3d4f6a){_0x3833fd=_0x3833fd-0x0;var _0x111c26=_0x102f[_0x3833fd];return _0x111c26;};'use strict';var client=require('../client');exports['create']=function(_0x516df0){return client[_0xf102('0x0')]('CreateVoiceAgentReport',{'body':_0x516df0,'log':'CreateVoiceAgentReport'});};exports[_0xf102('0x1')]=function(_0x109fe0,_0xa8ad91,_0x62ef71){return client['Request'](_0xf102('0x2'),{'body':_0x109fe0,'options':{'where':{'uniqueid':_0xa8ad91,'interface':_0x62ef71,'agentcomplete':!![]}},'log':_0xf102('0x2')});}; \ No newline at end of file +var _0x5aec=['create','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x153f52,_0x15100e){var _0x7d14eb=function(_0x279676){while(--_0x279676){_0x153f52['push'](_0x153f52['shift']());}};_0x7d14eb(++_0x15100e);}(_0x5aec,0xe8));var _0xc5ae=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x5aec[_0x45d55e];return _0x29812a;};'use strict';var client=require('../client');exports[_0xc5ae('0x0')]=function(_0xfdfa4b){return client['Request'](_0xc5ae('0x1'),{'body':_0xfdfa4b,'log':'CreateVoiceAgentReport'});};exports[_0xc5ae('0x2')]=function(_0x91a4de,_0xfc3ef7,_0x3a2134){return client['Request'](_0xc5ae('0x3'),{'body':_0x91a4de,'options':{'where':{'uniqueid':_0xfc3ef7,'interface':_0x3a2134,'agentcomplete':!![]}},'log':_0xc5ae('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7672c54..10c8048 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 _0xc24c=['startOf','day','format','endOf','type','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','context','GetVoiceCallReport'];(function(_0x39fb6f,_0x4f8491){var _0x5c7720=function(_0x4211b2){while(--_0x4211b2){_0x39fb6f['push'](_0x39fb6f['shift']());}};_0x5c7720(++_0x4f8491);}(_0xc24c,0x17e));var _0xcc24=function(_0x23f1d8,_0x1be604){_0x23f1d8=_0x23f1d8-0x0;var _0x5ae398=_0xc24c[_0x23f1d8];return _0x5ae398;};'use strict';var moment=require(_0xcc24('0x0'));var util=require('util');var _=require(_0xcc24('0x1'));var client=require('../client');exports[_0xcc24('0x2')]=function(_0x12cab2){return client[_0xcc24('0x3')](_0xcc24('0x4'),{'body':_[_0xcc24('0x5')](_0x12cab2,{'source':_0x12cab2['calleridnum'],'destinationcontext':_0x12cab2[_0xcc24('0x6')],'callerid':_0x12cab2['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0xcc24('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xcc24('0x3')](_0xcc24('0x7'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xcc24('0x8')](_0xcc24('0x9'))[_0xcc24('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xcc24('0xb')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xcc24('0xc'),'disposition','duration',_0xcc24('0xd')]},'log':_0xcc24('0xe')});};}; \ No newline at end of file +var _0xaebe=['DOCUMENTATION','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context'];(function(_0x2037d3,_0x1d4141){var _0x504c96=function(_0xf0fc28){while(--_0xf0fc28){_0x2037d3['push'](_0x2037d3['shift']());}};_0x504c96(++_0x1d4141);}(_0xaebe,0xa2));var _0xeaeb=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xaebe[_0x160c73];return _0xd9302;};'use strict';var moment=require(_0xeaeb('0x0'));var util=require(_0xeaeb('0x1'));var _=require('lodash');var client=require(_0xeaeb('0x2'));exports[_0xeaeb('0x3')]=function(_0x5c77a5){return client[_0xeaeb('0x4')](_0xeaeb('0x5'),{'body':_[_0xeaeb('0x6')](_0x5c77a5,{'source':_0x5c77a5[_0xeaeb('0x7')],'destinationcontext':_0x5c77a5[_0xeaeb('0x8')],'callerid':_0x5c77a5['callerid'],'amaflags':_0xeaeb('0x9')}),'log':_0xeaeb('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xeaeb('0xa'),{'options':{'where':{'type':[_0xeaeb('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xeaeb('0xc'))[_0xeaeb('0xd')](_0xeaeb('0xe')),moment()[_0xeaeb('0xf')](_0xeaeb('0xc'))[_0xeaeb('0xd')](_0xeaeb('0xe'))]}},'attributes':[_0xeaeb('0x10'),_0xeaeb('0x11'),'duration','billableseconds']},'log':_0xeaeb('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a85273b..1c3fc44 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 _0x46d2=['../client','create','Request','CreateVoiceDialReport'];(function(_0x152457,_0x2d8546){var _0x50cec5=function(_0x46b166){while(--_0x46b166){_0x152457['push'](_0x152457['shift']());}};_0x50cec5(++_0x2d8546);}(_0x46d2,0x1cc));var _0x246d=function(_0x37456e,_0x475d2f){_0x37456e=_0x37456e-0x0;var _0x4e48ba=_0x46d2[_0x37456e];return _0x4e48ba;};'use strict';var client=require(_0x246d('0x0'));exports[_0x246d('0x1')]=function(_0x53708b){return client[_0x246d('0x2')]('CreateVoiceDialReport',{'body':_0x53708b,'log':_0x246d('0x3')});}; \ No newline at end of file +var _0xd16d=['../client'];(function(_0x29a9f2,_0x2b0179){var _0x345df2=function(_0x4d7f8f){while(--_0x4d7f8f){_0x29a9f2['push'](_0x29a9f2['shift']());}};_0x345df2(++_0x2b0179);}(_0xd16d,0xb7));var _0xdd16=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd16d[_0x4e676e];return _0x336a3c;};'use strict';var client=require(_0xdd16('0x0'));exports['create']=function(_0x154f63){return client['Request']('CreateVoiceDialReport',{'body':_0x154f63,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 56f53d4..672e2b0 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 _0x25c2=['getVoiceExtensions','../client','Request','GetVoiceExtension','recordingFormat'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x25c2,0xdd));var _0x225c=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x25c2[_0x2ff238];return _0x204a56;};'use strict';var client=require(_0x225c('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x225c('0x1')](_0x225c('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x225c('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x225c('0x4')});};}; \ No newline at end of file +var _0x659e=['Request','GetVoiceExtension','recordingFormat','../client'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x659e,0x117));var _0xe659=function(_0x12cc15,_0x3d147e){_0x12cc15=_0x12cc15-0x0;var _0xcc627d=_0x659e[_0x12cc15];return _0xcc627d;};'use strict';var client=require(_0xe659('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xe659('0x1')](_0xe659('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xe659('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 143ef16..7775034 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 _0x619e=['getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','TrunkBackup','Interval','Intervals','interval','../client'];(function(_0x2d25a7,_0x5950c5){var _0x5dafc9=function(_0x117515){while(--_0x117515){_0x2d25a7['push'](_0x2d25a7['shift']());}};_0x5dafc9(++_0x5950c5);}(_0x619e,0x1a3));var _0xe619=function(_0x2c4ca7,_0x5abe87){_0x2c4ca7=_0x2c4ca7-0x0;var _0xc82d75=_0x619e[_0x2c4ca7];return _0xc82d75;};'use strict';var client=require(_0xe619('0x0'));exports[_0xe619('0x1')]=function(){return function(){return client[_0xe619('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xe619('0x3'),_0xe619('0x4'),_0xe619('0x5'),_0xe619('0x6'),_0xe619('0x7'),_0xe619('0x8'),_0xe619('0x9'),'dialMethod',_0xe619('0xa'),'dialLimitQueue',_0xe619('0xb'),_0xe619('0xc'),_0xe619('0xd'),_0xe619('0xe'),'dialOriginateCallerIdName',_0xe619('0xf'),_0xe619('0x10'),_0xe619('0x11'),'dialQueueTimeout',_0xe619('0x12'),_0xe619('0x13'),'dialCongestionRetryFrequency',_0xe619('0x14'),_0xe619('0x15'),_0xe619('0x16'),_0xe619('0x17'),_0xe619('0x18'),_0xe619('0x19'),_0xe619('0x1a'),_0xe619('0x1b'),_0xe619('0x1c'),_0xe619('0x1d'),'dialAMDInitialSilence',_0xe619('0x1e'),_0xe619('0x1f'),_0xe619('0x20'),_0xe619('0x21'),_0xe619('0x22'),_0xe619('0x23'),_0xe619('0x24'),_0xe619('0x25'),_0xe619('0x26'),_0xe619('0x27'),'dialRecallInQueue',_0xe619('0x28'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xe619('0x29'),'monitor_format','strategy',_0xe619('0x2a'),_0xe619('0x2b'),'dialNoSuchNumberMaxRetry',_0xe619('0x2c'),_0xe619('0x2d'),_0xe619('0x2e'),_0xe619('0x2f'),_0xe619('0x30'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xe619('0x31'),_0xe619('0x32'),'mandatoryDisposition',_0xe619('0x33'),_0xe619('0x34')],'include':[{'model':_0xe619('0x35'),'as':_0xe619('0x35'),'attributes':['id',_0xe619('0x3'),_0xe619('0x36'),_0xe619('0x37')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0xe619('0x3')]},{'model':_0xe619('0x35'),'as':_0xe619('0x38'),'attributes':['id','name',_0xe619('0x36'),'active']},{'model':_0xe619('0x39'),'as':_0xe619('0x39'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xe619('0x3a'),'attributes':['id',_0xe619('0x3'),_0xe619('0x3b')]}]}]},'log':_0xe619('0x1')});};}; \ No newline at end of file +var _0xa84f=['getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','callerid','Pause','mandatoryDispositionPause','Trunk','TrunkBackup','Interval','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa84f,0xdd));var _0xfa84=function(_0xe406bc,_0x45e9af){_0xe406bc=_0xe406bc-0x0;var _0x56cbd4=_0xa84f[_0xe406bc];return _0x56cbd4;};'use strict';var client=require(_0xfa84('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xfa84('0x1')](_0xfa84('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa84('0x3'),_0xfa84('0x4'),_0xfa84('0x5'),_0xfa84('0x6'),_0xfa84('0x7'),_0xfa84('0x8'),_0xfa84('0x9'),_0xfa84('0xa'),_0xfa84('0xb'),'dialLimitQueue','dialPowerLevel','dialPredictiveOptimization',_0xfa84('0xc'),_0xfa84('0xd'),_0xfa84('0xe'),_0xfa84('0xf'),'dialOriginateTimeout',_0xfa84('0x10'),_0xfa84('0x11'),'dialQueueProject',_0xfa84('0x12'),'dialCongestionRetryFrequency',_0xfa84('0x13'),'dialBusyRetryFrequency',_0xfa84('0x14'),_0xfa84('0x15'),_0xfa84('0x16'),_0xfa84('0x17'),'dialGlobalInterval',_0xfa84('0x18'),_0xfa84('0x19'),'dialAMDActive',_0xfa84('0x1a'),_0xfa84('0x1b'),_0xfa84('0x1c'),_0xfa84('0x1d'),_0xfa84('0x1e'),_0xfa84('0x1f'),_0xfa84('0x20'),'dialAMDSilenceThreshold',_0xfa84('0x21'),'timeout',_0xfa84('0x22'),_0xfa84('0x23'),'dialOrderByScheduledAt',_0xfa84('0x24'),_0xfa84('0x25'),'dialQueueProject2',_0xfa84('0x7'),_0xfa84('0x26'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xfa84('0x27'),_0xfa84('0x28'),'dialDropMaxRetry',_0xfa84('0x29'),_0xfa84('0x2a'),_0xfa84('0x2b'),'dialMachineMaxRetry',_0xfa84('0x2c'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition',_0xfa84('0x2d'),_0xfa84('0x2e')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id','name',_0xfa84('0x2f'),'active']},{'model':_0xfa84('0x30'),'as':_0xfa84('0x31'),'attributes':['id',_0xfa84('0x3')]},{'model':_0xfa84('0x32'),'as':_0xfa84('0x33'),'attributes':['id',_0xfa84('0x3'),'callerid','active']},{'model':'Interval','as':_0xfa84('0x34'),'attributes':['id',_0xfa84('0x3')],'include':[{'model':'Interval','as':_0xfa84('0x35'),'attributes':['id',_0xfa84('0x3'),'interval']}]}]},'log':_0xfa84('0x36')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 8b37e50..78d5d02 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 _0x73c6=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt'];(function(_0x5e0c74,_0x2b9f06){var _0x2dfde9=function(_0x29921a){while(--_0x29921a){_0x5e0c74['push'](_0x5e0c74['shift']());}};_0x2dfde9(++_0x2b9f06);}(_0x73c6,0x195));var _0x673c=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x73c6[_0x42bdad];return _0x122626;};'use strict';var moment=require(_0x673c('0x0'));var _=require('lodash');var client=require(_0x673c('0x1'));exports['create']=function(_0x4ab3b1){return client[_0x673c('0x2')](_0x673c('0x3'),{'body':_0x4ab3b1,'log':_0x673c('0x3')});};exports[_0x673c('0x4')]=function(){return function(){return client[_0x673c('0x2')](_0x673c('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x673c('0x6'))[_0x673c('0x7')](_0x673c('0x8')),moment()[_0x673c('0x9')](_0x673c('0x6'))[_0x673c('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x673c('0xa'),_0x673c('0xb'),_0x673c('0xc'),'queuecallerleaveAt',_0x673c('0xd'),_0x673c('0xe'),_0x673c('0xf'),_0x673c('0x10'),_0x673c('0x11'),_0x673c('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x0cce=['queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queue','queuecallerjoinAt'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x0cce,0xf6));var _0xe0cc=function(_0x4a5760,_0x134c15){_0x4a5760=_0x4a5760-0x0;var _0x2994b=_0x0cce[_0x4a5760];return _0x2994b;};'use strict';var moment=require(_0xe0cc('0x0'));var _=require(_0xe0cc('0x1'));var client=require(_0xe0cc('0x2'));exports[_0xe0cc('0x3')]=function(_0x4b6ded){return client[_0xe0cc('0x4')](_0xe0cc('0x5'),{'body':_0x4b6ded,'log':_0xe0cc('0x5')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xe0cc('0x4')](_0xe0cc('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xe0cc('0x7')](_0xe0cc('0x8')),moment()[_0xe0cc('0x9')](_0xe0cc('0xa'))[_0xe0cc('0x7')](_0xe0cc('0x8'))]}},'attributes':[_0xe0cc('0xb'),_0xe0cc('0xc'),_0xe0cc('0xd'),_0xe0cc('0xe'),_0xe0cc('0xf'),_0xe0cc('0x10'),'queuecallerexit',_0xe0cc('0x11'),'queuecallerabandon',_0xe0cc('0x12')]},'log':_0xe0cc('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index bca052e..342e174 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 _0x458d=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x551f25,_0x34ca56){var _0x573dc2=function(_0x297cb6){while(--_0x297cb6){_0x551f25['push'](_0x551f25['shift']());}};_0x573dc2(++_0x34ca56);}(_0x458d,0xe2));var _0xd458=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x458d[_0x4a53d];return _0x27410e;};'use strict';var client=require(_0xd458('0x0'));exports[_0xd458('0x1')]=function(_0x33a9e1){return function(){return client[_0xd458('0x2')](_0xd458('0x3'),{'options':{'where':{'VoiceQueueId':_0x33a9e1,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xb61b=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x4e8f0c,_0x1a6ed5){var _0x126fc2=function(_0x58326a){while(--_0x58326a){_0x4e8f0c['push'](_0x4e8f0c['shift']());}};_0x126fc2(++_0x1a6ed5);}(_0xb61b,0x7d));var _0xbb61=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb61b[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xbb61('0x0'));exports[_0xbb61('0x1')]=function(_0x44d873){return function(){return client[_0xbb61('0x2')](_0xbb61('0x3'),{'options':{'where':{'VoiceQueueId':_0x44d873,'paused':!![]},'raw':!![]},'log':_0xbb61('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6e5ff3c..7c14cc4 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 _0x0221=['CreateVoiceRecording','lodash','../client','Request'];(function(_0x52b37c,_0x3a0940){var _0x44997d=function(_0x563f1e){while(--_0x563f1e){_0x52b37c['push'](_0x52b37c['shift']());}};_0x44997d(++_0x3a0940);}(_0x0221,0x141));var _0x1022=function(_0x53837f,_0x9b178e){_0x53837f=_0x53837f-0x0;var _0x5d8c8c=_0x0221[_0x53837f];return _0x5d8c8c;};'use strict';var _=require(_0x1022('0x0'));var client=require(_0x1022('0x1'));exports['create']=function(_0x5e6867){return client[_0x1022('0x2')]('CreateVoiceRecording',{'body':_['merge'](_0x5e6867,{'value':_0x5e6867['monitorFilename']}),'log':_0x1022('0x3')});}; \ No newline at end of file +var _0x2e0a=['../client','create','Request','monitorFilename'];(function(_0x281820,_0x47572b){var _0x2d05f6=function(_0x539948){while(--_0x539948){_0x281820['push'](_0x281820['shift']());}};_0x2d05f6(++_0x47572b);}(_0x2e0a,0x1e8));var _0xa2e0=function(_0x10703d,_0x2aa6a8){_0x10703d=_0x10703d-0x0;var _0x3bf1a0=_0x2e0a[_0x10703d];return _0x3bf1a0;};'use strict';var _=require('lodash');var client=require(_0xa2e0('0x0'));exports[_0xa2e0('0x1')]=function(_0x3a3eed){return client[_0xa2e0('0x2')]('CreateVoiceRecording',{'body':_['merge'](_0x3a3eed,{'value':_0x3a3eed[_0xa2e0('0x3')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index fffef05..4b0d839 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 _0xf4b0=['transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x2f99a9,_0x18c2ec){var _0xc446bb=function(_0x10cafc){while(--_0x10cafc){_0x2f99a9['push'](_0x2f99a9['shift']());}};_0xc446bb(++_0x18c2ec);}(_0xf4b0,0x10f));var _0x0f4b=function(_0x294b37,_0x4b3dfe){_0x294b37=_0x294b37-0x0;var _0x3d2f95=_0xf4b0[_0x294b37];return _0x3d2f95;};'use strict';var client=require(_0x0f4b('0x0'));exports['blindTransfer']=function(_0x17b631){return client[_0x0f4b('0x1')](_0x0f4b('0x2'),{'body':{'result':_0x17b631[_0x0f4b('0x3')],'transfererchannel':_0x17b631[_0x0f4b('0x4')],'transferercalleridnum':_0x17b631[_0x0f4b('0x5')],'transferercalleridname':_0x17b631['transferercalleridname'],'transfererconnectedlinenum':_0x17b631[_0x0f4b('0x6')],'transfererconnectedlinename':_0x17b631[_0x0f4b('0x7')],'transfereraccountcode':_0x17b631[_0x0f4b('0x8')],'transferercontext':_0x17b631['transferercontext'],'transfererexten':_0x17b631['transfererexten'],'transfererlinkedid':_0x17b631['transfererlinkedid'],'transfereechannel':_0x17b631['transfereechannel'],'transfereecalleridnum':_0x17b631[_0x0f4b('0x9')],'transfereecalleridname':_0x17b631[_0x0f4b('0xa')],'transfereeconnectedlinenum':_0x17b631['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x17b631[_0x0f4b('0xb')],'transfereeaccountcode':_0x17b631[_0x0f4b('0xc')],'transfereecontext':_0x17b631[_0x0f4b('0xd')],'transfereeexten':_0x17b631['transfereeexten'],'transfereelinkedid':_0x17b631[_0x0f4b('0xe')],'isexternal':_0x17b631['isexternal'],'context':_0x17b631[_0x0f4b('0xf')],'extension':_0x17b631[_0x0f4b('0x10')],'type':_0x0f4b('0x11')},'log':_0x0f4b('0x2')});};exports[_0x0f4b('0x12')]=function(_0x47abfa){return client['Request'](_0x0f4b('0x2'),{'body':{'result':_0x47abfa['result'],'transfererchannel':_0x47abfa[_0x0f4b('0x13')],'transferercalleridnum':_0x47abfa[_0x0f4b('0x14')],'transferercalleridname':_0x47abfa[_0x0f4b('0x15')],'transfererconnectedlinenum':_0x47abfa[_0x0f4b('0x16')],'transfererconnectedlinename':_0x47abfa['secondtransfererconnectedlinename'],'transfereraccountcode':_0x47abfa[_0x0f4b('0x17')],'transferercontext':_0x47abfa[_0x0f4b('0x18')],'transfererexten':_0x47abfa[_0x0f4b('0x19')],'transfererlinkedid':_0x47abfa[_0x0f4b('0x1a')],'transfereechannel':_0x47abfa[_0x0f4b('0x1b')],'transfereecalleridnum':_0x47abfa[_0x0f4b('0x1c')],'transfereecalleridname':_0x47abfa[_0x0f4b('0x1d')],'transfereeconnectedlinenum':_0x47abfa[_0x0f4b('0x1e')],'transfereeconnectedlinename':_0x47abfa[_0x0f4b('0x1f')],'transfereeaccountcode':_0x47abfa[_0x0f4b('0x20')],'transfereecontext':_0x47abfa[_0x0f4b('0x21')],'transfereeexten':_0x47abfa['transfertargetexten'],'transfereelinkedid':_0x47abfa[_0x0f4b('0x22')],'isexternal':_0x47abfa[_0x0f4b('0x23')],'context':_0x47abfa[_0x0f4b('0x24')],'extension':_0x47abfa[_0x0f4b('0x25')],'type':'attended'},'log':_0x0f4b('0x2')});}; \ No newline at end of file +var _0x1523=['transfereecontext','transfereeexten','transfereelinkedid','context','extension','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode'];(function(_0x12325b,_0x3628f7){var _0x32cf79=function(_0x558cb5){while(--_0x558cb5){_0x12325b['push'](_0x12325b['shift']());}};_0x32cf79(++_0x3628f7);}(_0x1523,0xfe));var _0x3152=function(_0x363cab,_0x4e6b52){_0x363cab=_0x363cab-0x0;var _0x3bace2=_0x1523[_0x363cab];return _0x3bace2;};'use strict';var client=require(_0x3152('0x0'));exports['blindTransfer']=function(_0x17723e){return client[_0x3152('0x1')](_0x3152('0x2'),{'body':{'result':_0x17723e['result'],'transfererchannel':_0x17723e['transfererchannel'],'transferercalleridnum':_0x17723e['transferercalleridnum'],'transferercalleridname':_0x17723e['transferercalleridname'],'transfererconnectedlinenum':_0x17723e[_0x3152('0x3')],'transfererconnectedlinename':_0x17723e[_0x3152('0x4')],'transfereraccountcode':_0x17723e[_0x3152('0x5')],'transferercontext':_0x17723e['transferercontext'],'transfererexten':_0x17723e[_0x3152('0x6')],'transfererlinkedid':_0x17723e[_0x3152('0x7')],'transfereechannel':_0x17723e[_0x3152('0x8')],'transfereecalleridnum':_0x17723e['transfereecalleridnum'],'transfereecalleridname':_0x17723e[_0x3152('0x9')],'transfereeconnectedlinenum':_0x17723e[_0x3152('0xa')],'transfereeconnectedlinename':_0x17723e['transfereeconnectedlinename'],'transfereeaccountcode':_0x17723e[_0x3152('0xb')],'transfereecontext':_0x17723e[_0x3152('0xc')],'transfereeexten':_0x17723e[_0x3152('0xd')],'transfereelinkedid':_0x17723e[_0x3152('0xe')],'isexternal':_0x17723e['isexternal'],'context':_0x17723e[_0x3152('0xf')],'extension':_0x17723e[_0x3152('0x10')],'type':'blind'},'log':_0x3152('0x2')});};exports[_0x3152('0x11')]=function(_0x243826){return client['Request'](_0x3152('0x2'),{'body':{'result':_0x243826[_0x3152('0x12')],'transfererchannel':_0x243826[_0x3152('0x13')],'transferercalleridnum':_0x243826[_0x3152('0x14')],'transferercalleridname':_0x243826['origtransferercalleridname'],'transfererconnectedlinenum':_0x243826[_0x3152('0x15')],'transfererconnectedlinename':_0x243826[_0x3152('0x16')],'transfereraccountcode':_0x243826[_0x3152('0x17')],'transferercontext':_0x243826[_0x3152('0x18')],'transfererexten':_0x243826[_0x3152('0x19')],'transfererlinkedid':_0x243826[_0x3152('0x1a')],'transfereechannel':_0x243826[_0x3152('0x1b')],'transfereecalleridnum':_0x243826[_0x3152('0x1c')],'transfereecalleridname':_0x243826[_0x3152('0x1d')],'transfereeconnectedlinenum':_0x243826[_0x3152('0x1e')],'transfereeconnectedlinename':_0x243826['transfertargetconnectedlinename'],'transfereeaccountcode':_0x243826[_0x3152('0x1f')],'transfereecontext':_0x243826[_0x3152('0x20')],'transfereeexten':_0x243826['transfertargetexten'],'transfereelinkedid':_0x243826[_0x3152('0x21')],'isexternal':_0x243826[_0x3152('0x22')],'context':_0x243826[_0x3152('0x23')],'extension':_0x243826[_0x3152('0x24')],'type':_0x3152('0x25')},'log':_0x3152('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c1b1f0c..d6a01c5 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 _0x8a38=['then','message','catch','ami\x20disconnected','join','action','Command','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','values','voicechannel','find','channels','uniqueid','channel','%s.%s','filename','wav','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelredirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','pick','keys','module','Reload','Action'];(function(_0x541e7c,_0x3683b8){var _0xa22516=function(_0xf63d6a){while(--_0xf63d6a){_0x541e7c['push'](_0x541e7c['shift']());}};_0xa22516(++_0x3683b8);}(_0x8a38,0x171));var _0x88a3=function(_0x57c029,_0x302ebd){_0x57c029=_0x57c029-0x0;var _0x6b7d44=_0x8a38[_0x57c029];return _0x6b7d44;};'use strict';var _=require(_0x88a3('0x0'));var util=require(_0x88a3('0x1'));var jayson=require(_0x88a3('0x2'));var schema=require(_0x88a3('0x3'));var BPromise=require('bluebird');var moment=require(_0x88a3('0x4'));var config=require(_0x88a3('0x5'));var properties=require(_0x88a3('0x6'));var ami=require(_0x88a3('0x7'));exports[_0x88a3('0x8')]=function(_0x736bc0,_0x4fb92a,_0x189268){return new BPromise(function(_0x3746b3,_0x58542b){var _0x280f8c={'QueuePause':function(_0x4a6b41){return new Promise(function(_0x332f48,_0x421cb0){var _0x3605f1=util[_0x88a3('0x9')](_0x88a3('0xa'),'SIP',_0x4a6b41[_0x88a3('0xb')]);if(_0x736bc0[_0x88a3('0xc')]&&_0x736bc0[_0x88a3('0xc')][_0x3605f1]&&_0x736bc0[_0x88a3('0xc')][_0x3605f1]['timer']){_0x736bc0[_0x88a3('0xc')][_0x3605f1][_0x88a3('0xd')]();}if(_0x736bc0[_0x88a3('0xe')][_0x3605f1]){_0x736bc0[_0x88a3('0xe')][_0x3605f1][_0x88a3('0xf')]({'statePause':_0x4a6b41[_0x88a3('0x10')]?!![]:![]});}_0x332f48({'code':0xc8,'message':_0x88a3('0x11')});});},'Reload':function(_0x24ba33){var _0x533045=this;return new Promise(function(_0x4eb69b,_0x270bc4){if(ami[_0x88a3('0x12')]()==![]){return _0x270bc4(_0x533045[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')][_0x88a3('0x15')],'ami\x20disconnected']['join']('\x20')));}_0x24ba33=_[_0x88a3('0x16')](_0x24ba33,_[_0x88a3('0x17')](properties[_0x88a3('0x18')]));_0x24ba33['action']=_0x88a3('0x19');return ami[_0x88a3('0x1a')](_0x24ba33)[_0x88a3('0x1b')](function(_0x4ce980){_0x4eb69b({'code':0xc8,'message':_0x4ce980[_0x88a3('0x1c')]});})[_0x88a3('0x1d')](function(_0xa0ae84){_0x270bc4(_0x533045[_0x88a3('0x13')](0x1f5,_0xa0ae84['message']));});});},'Command':function(_0x5ca419){var _0xdf39d5=this;return new Promise(function(_0x49473e,_0x4324b2){if(ami[_0x88a3('0x12')]()==![]){return _0x4324b2(_0xdf39d5[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')][_0x88a3('0x15')],_0x88a3('0x1e')][_0x88a3('0x1f')]('\x20')));}_0x5ca419=_[_0x88a3('0x16')](_0x5ca419,'command');_0x5ca419[_0x88a3('0x20')]=_0x88a3('0x21');return ami['Action'](_0x5ca419)[_0x88a3('0x1b')](function(_0x512226){_0x49473e({'code':0xc8,'message':_0x512226['content']});})[_0x88a3('0x1d')](function(_0x2afe1e){_0x4324b2(_0xdf39d5['error'](0x1f5,_0x2afe1e[_0x88a3('0x1c')]));});});},'VoiceQueues':function(_0x503f1a){return new Promise(function(_0xbb2426,_0x5afa43){var _0x23bc9e=[];for(var _0x121ee0 in _0x736bc0[_0x88a3('0x22')]){if(_0x736bc0['voiceQueues']['hasOwnProperty'](_0x121ee0)){var _0x18492f=_0x736bc0['voiceQueues'][_0x121ee0];var _0x19b3af={'id':_0x18492f['id'],'name':_0x18492f['name'],'strategy':_0x18492f[_0x88a3('0x23')],'answered':_0x18492f[_0x88a3('0x24')],'available':_0x18492f[_0x88a3('0x25')],'loggedIn':_0x18492f[_0x88a3('0x26')],'pTalking':_0x18492f[_0x88a3('0x27')],'sumBillable':_0x18492f['sumBillable'],'sumDuration':_0x18492f[_0x88a3('0x28')],'sumHoldTime':_0x18492f[_0x88a3('0x29')]||0x0,'talking':_0x18492f[_0x88a3('0x2a')],'total':_0x18492f[_0x88a3('0x2b')],'type':_0x18492f[_0x88a3('0x2c')],'unmanaged':_0x18492f['unmanaged'],'abandoned':_0x18492f[_0x88a3('0x2d')],'waiting':_0x18492f[_0x88a3('0x2e')],'loggedInDb':_0x18492f[_0x88a3('0x2f')]};if(_0x18492f[_0x88a3('0x2c')]===_0x88a3('0x30')){_0x19b3af[_0x88a3('0x31')]=_0x18492f['dialActive'];_0x19b3af[_0x88a3('0x32')]=_0x18492f['dialMethod'];_0x19b3af[_0x88a3('0x33')]=_0x18492f[_0x88a3('0x33')];_0x19b3af[_0x88a3('0x34')]=_0x18492f['dialOriginateCallerIdNumber'];_0x19b3af['dialOriginateTimeout']=_0x18492f[_0x88a3('0x35')];_0x19b3af[_0x88a3('0x36')]=_0x18492f[_0x88a3('0x36')];_0x19b3af[_0x88a3('0x37')]=_0x18492f[_0x88a3('0x37')];_0x19b3af[_0x88a3('0x38')]=_0x18492f[_0x88a3('0x38')];_0x19b3af[_0x88a3('0x39')]=_0x18492f[_0x88a3('0x39')];_0x19b3af['outboundBusyCallsDay']=_0x18492f[_0x88a3('0x3a')];_0x19b3af[_0x88a3('0x3b')]=_0x18492f['outboundCongestionCallsDay'];_0x19b3af['outboundDropCallsDayACS']=_0x18492f['outboundDropCallsDayACS'];_0x19b3af['outboundDropCallsDayCallersExit']=_0x18492f[_0x88a3('0x3c')];_0x19b3af[_0x88a3('0x3d')]=_0x18492f[_0x88a3('0x3d')];_0x19b3af[_0x88a3('0x3e')]=_0x18492f['outboundNoAnswerCallsDay'];_0x19b3af['outboundNoSuchCallsDay']=_0x18492f[_0x88a3('0x3f')];_0x19b3af[_0x88a3('0x40')]=_0x18492f['outboundOriginateFailureCallsDay'];_0x19b3af[_0x88a3('0x41')]=_0x18492f[_0x88a3('0x41')];_0x19b3af['outboundRejectCallsDay']=_0x18492f[_0x88a3('0x42')];_0x19b3af['outboundUnknownCallsDay']=_0x18492f['outboundUnknownCallsDay'];_0x19b3af['predictiveIntervalAnsweredCalls']=_0x18492f[_0x88a3('0x43')];_0x19b3af[_0x88a3('0x44')]=_0x18492f[_0x88a3('0x44')];_0x19b3af['predictiveIntervalAvgTalktime']=_0x18492f['predictiveIntervalAvgTalktime'];_0x19b3af[_0x88a3('0x45')]=_0x18492f[_0x88a3('0x45')];_0x19b3af[_0x88a3('0x46')]=_0x18492f[_0x88a3('0x46')];_0x19b3af[_0x88a3('0x47')]=_0x18492f[_0x88a3('0x47')];_0x19b3af[_0x88a3('0x48')]=_0x18492f[_0x88a3('0x48')];_0x19b3af['predictiveIntervalHitRate']=_0x18492f['predictiveIntervalHitRate'];_0x19b3af[_0x88a3('0x49')]=_0x18492f[_0x88a3('0x49')];_0x19b3af[_0x88a3('0x4a')]=_0x18492f[_0x88a3('0x4a')];_0x19b3af[_0x88a3('0x4b')]=_0x18492f[_0x88a3('0x4b')];_0x19b3af[_0x88a3('0x4c')]=_0x18492f[_0x88a3('0x4c')];_0x19b3af[_0x88a3('0x1c')]=_0x18492f[_0x88a3('0x1c')];_0x19b3af[_0x88a3('0x4d')]=_0x18492f[_0x88a3('0x4d')];_0x19b3af[_0x88a3('0x4e')]=_0x18492f[_0x88a3('0x4e')];_0x19b3af[_0x88a3('0x4f')]=_0x18492f[_0x88a3('0x4f')];_0x19b3af[_0x88a3('0x50')]=_0x18492f[_0x88a3('0x50')];_0x19b3af['erlangBusyFactor']=_0x18492f['erlangBusyFactor'];_0x19b3af[_0x88a3('0x51')]=_0x18492f[_0x88a3('0x51')];_0x19b3af[_0x88a3('0x52')]=_0x18492f[_0x88a3('0x52')];}if(_0x18492f['Trunk']){_0x19b3af[_0x88a3('0x53')]={'id':_0x18492f[_0x88a3('0x53')]['id'],'name':_0x18492f['Trunk']['name'],'active':_0x18492f[_0x88a3('0x53')][_0x88a3('0x54')],'callerid':_0x18492f[_0x88a3('0x53')][_0x88a3('0x55')]};}if(_0x18492f[_0x88a3('0x56')]){_0x19b3af['Interval']={'id':_0x18492f[_0x88a3('0x56')]['id'],'name':_0x18492f[_0x88a3('0x56')]['name']};}_0x23bc9e['push'](_0x19b3af);}}_0xbb2426({'count':_0x23bc9e[_0x88a3('0x57')],'rows':_0x23bc9e});});},'VoiceChannels':function(_0x390e2f){return new Promise(function(_0x30edcc,_0xe4c351){var _0x33fef9=_[_0x88a3('0x58')](_0x736bc0['channels']);_0x30edcc({'count':_0x33fef9['length'],'rows':_0x33fef9});});},'VoiceChannelMixMonitor':function(_0x2dea08){var _0x4270ee=this;return new Promise(function(_0x2a3b18,_0x1dde05){if(ami[_0x88a3('0x12')]()==![]){return _0x1dde05(_0x4270ee[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')][_0x88a3('0x15')],_0x88a3('0x1e')]['join']('\x20')));}var _0x47c98f=schema(properties[_0x88a3('0x59')])[_0x88a3('0x3')](_0x2dea08);if(_0x47c98f['length']>0x0){return _0x1dde05(_0x4270ee[_0x88a3('0x13')](0x1f4,_['map'](_0x47c98f,_0x88a3('0x1c'))[_0x88a3('0x1f')](',\x20')));}var _0x571cf4=_[_0x88a3('0x5a')](_0x736bc0[_0x88a3('0x5b')],{'uniqueid':_0x2dea08[_0x88a3('0x5c')]});if(_0x571cf4&&_0x571cf4[_0x88a3('0x5d')]){var _0x16b807=util[_0x88a3('0x9')](_0x88a3('0x5e'),_0x2dea08[_0x88a3('0x5f')]||_0x2dea08['uniqueid'],_0x2dea08[_0x88a3('0x9')]||_0x88a3('0x60'));return ami['Action']({'action':'MixMonitor','channel':_0x571cf4['channel'],'file':_0x16b807,'options':'ai(mixmonitorid)'})[_0x88a3('0x1b')](function(_0x3f2bc1){var _0x5151dd=_['find'](_0x571cf4[_0x88a3('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x16b807[_0x88a3('0x62')]()});if(_[_0x88a3('0x63')](_0x5151dd)){_0x571cf4['monitors'][_0x88a3('0x64')]({'filename':_0x88a3('0x65')+_0x16b807['toLowerCase'](),'createdAt':moment()['format'](_0x88a3('0x66')),'mixmonitorid':_0x3f2bc1[_0x88a3('0x67')],'status':_0x88a3('0x68')});}else{_0x5151dd['mixmonitorid']=_0x3f2bc1[_0x88a3('0x67')];_0x5151dd[_0x88a3('0x69')]=_0x88a3('0x68');}_0x2a3b18({'code':0xc8,'message':[_0x2dea08['uniqueid'],_0x88a3('0x6a'),_0x3f2bc1['mixmonitorid']][_0x88a3('0x1f')]('\x20'),'mixmonitorid':_0x3f2bc1[_0x88a3('0x67')]});})[_0x88a3('0x1d')](function(_0x2fa1b1){_0x1dde05(_0x4270ee[_0x88a3('0x13')](0x1f5,[_0x2dea08['uniqueid'],_0x2fa1b1[_0x88a3('0x1c')]['toLowerCase']()][_0x88a3('0x1f')]('\x20')));});}else{return _0x1dde05(_0x4270ee[_0x88a3('0x13')](0x1f5,_0x88a3('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x5e76cb){var _0xfe49be=this;return new Promise(function(_0x5df1e4,_0x55d02a){if(ami[_0x88a3('0x12')]()==![]){return _0x55d02a(_0xfe49be[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')]['username'],_0x88a3('0x1e')][_0x88a3('0x1f')]('\x20')));}var _0x3b4b9f=schema(properties[_0x88a3('0x59')])[_0x88a3('0x3')](_0x5e76cb);if(_0x3b4b9f['length']>0x0){return _0x55d02a(_0xfe49be[_0x88a3('0x13')](0x1f4,_[_0x88a3('0x6c')](_0x3b4b9f,'message')[_0x88a3('0x1f')](',\x20')));}var _0x1c1467=_[_0x88a3('0x5a')](_0x736bc0['channels'],{'uniqueid':_0x5e76cb[_0x88a3('0x5c')]});if(_0x1c1467){return BPromise['resolve']()['then'](function(){if(_0x1c1467['channel']){return ami[_0x88a3('0x1a')]({'action':_0x88a3('0x6d'),'channel':_0x1c1467['channel'],'mixmonitorid':_0x5e76cb[_0x88a3('0x67')]})['catch'](function(_0x4da87f){});}})[_0x88a3('0x1b')](function(){if(_0x1c1467[_0x88a3('0x6e')]){return ami[_0x88a3('0x1a')]({'action':_0x88a3('0x6d'),'channel':_0x1c1467['destinationchannel'],'mixmonitorid':_0x5e76cb[_0x88a3('0x67')]})[_0x88a3('0x1d')](function(_0x1f7957){});}})[_0x88a3('0x1b')](function(_0x4b1ec5){var _0x38efc3=_[_0x88a3('0x5a')](_0x1c1467[_0x88a3('0x61')],{'mixmonitorid':_0x5e76cb['mixmonitorid']});if(_0x38efc3){_0x38efc3[_0x88a3('0x69')]=_0x88a3('0x6f');}})[_0x88a3('0x1b')](function(){var _0x304b68=util[_0x88a3('0x9')]('%s.%s',_0x5e76cb['filename']||_0x5e76cb[_0x88a3('0x5c')],_0x5e76cb[_0x88a3('0x9')]||'wav');var _0x4aee67=_['find'](_0x1c1467['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x304b68[_0x88a3('0x62')]()});if(_0x4aee67){_0x4aee67[_0x88a3('0x69')]=_0x88a3('0x6f');}})['then'](function(){_0x5df1e4({'code':0xc8,'message':[_0x5e76cb['uniqueid'],_0x88a3('0x70')][_0x88a3('0x1f')]('\x20')});})['catch'](function(_0x314160){_0x55d02a(_0xfe49be['error'](0x1f5,[_0x5e76cb[_0x88a3('0x5c')],_0x314160[_0x88a3('0x1c')][_0x88a3('0x62')]()]['join']('\x20')));});}else{return _0x55d02a(_0xfe49be[_0x88a3('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5ea1e9){return new Promise(function(_0x4b2179,_0x252317){var _0xc42605=_['values'](_0x736bc0[_0x88a3('0x71')]);_0x4b2179({'count':_0xc42605[_0x88a3('0x57')],'rows':_0xc42605});});},'VoiceQueuesChannel':function(_0x7892d3){var _0x21158e=this;return new Promise(function(_0x17d545,_0xe3e42e){var _0x4938da=schema(properties[_0x88a3('0x72')])['validate'](_0x7892d3);if(_0x4938da[_0x88a3('0x57')]>0x0){return _0xe3e42e(_0x21158e[_0x88a3('0x13')](0x1f4,_[_0x88a3('0x6c')](_0x4938da,_0x88a3('0x1c'))[_0x88a3('0x1f')](',\x20')));}var _0x34f81d=_[_0x88a3('0x5a')](_0x736bc0[_0x88a3('0x71')],{'uniqueid':_0x7892d3['uniqueid']});if(_0x34f81d){_0x17d545(_0x34f81d);}else{return _0xe3e42e(_0x21158e[_0x88a3('0x13')](0x1f5,_0x88a3('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x4bf85c){var _0x40f651=this;return new Promise(function(_0x1b06c8,_0x5a05c4){if(ami[_0x88a3('0x12')]()==![]){return _0x5a05c4(_0x40f651[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')][_0x88a3('0x15')],_0x88a3('0x1e')][_0x88a3('0x1f')]('\x20')));}var _0x2182b3=schema(properties['voicequeuechannelhangup'])[_0x88a3('0x3')](_0x4bf85c);if(_0x2182b3['length']>0x0){return _0x5a05c4(_0x40f651[_0x88a3('0x13')](0x1f4,_[_0x88a3('0x6c')](_0x2182b3,_0x88a3('0x1c'))[_0x88a3('0x1f')](',\x20')));}var _0x227cb6=_[_0x88a3('0x5a')](_0x736bc0['queueChannels'],{'uniqueid':_0x4bf85c[_0x88a3('0x5c')]});if(_0x227cb6&&_0x227cb6['channel']){return ami[_0x88a3('0x1a')]({'action':'Hangup','channel':_0x227cb6[_0x88a3('0x5d')]})['then'](function(_0x2e5824){_0x1b06c8({'code':0xc8,'message':[_0x4bf85c[_0x88a3('0x5c')],_0x2e5824[_0x88a3('0x1c')][_0x88a3('0x62')]()]['join']('\x20')});})[_0x88a3('0x1d')](function(_0x42c6ef){_0x5a05c4(_0x40f651['error'](0x1f5,[_0x4bf85c[_0x88a3('0x5c')],_0x42c6ef['message'][_0x88a3('0x62')]()][_0x88a3('0x1f')]('\x20')));});}else{return _0x5a05c4(_0x40f651[_0x88a3('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x268f08){var _0x5e175b=this;return new Promise(function(_0x31ba20,_0x410ced){if(ami[_0x88a3('0x12')]()==![]){return _0x410ced(_0x5e175b[_0x88a3('0x13')](0x1f4,[config[_0x88a3('0x14')]['ip'],config[_0x88a3('0x14')]['username'],'ami\x20disconnected'][_0x88a3('0x1f')]('\x20')));}var _0x36e857=schema(properties[_0x88a3('0x73')])[_0x88a3('0x3')](_0x268f08);if(_0x36e857['length']>0x0){return _0x410ced(_0x5e175b[_0x88a3('0x13')](0x1f4,_['map'](_0x36e857,_0x88a3('0x1c'))[_0x88a3('0x1f')](',\x20')));}var _0x35cf0d=_[_0x88a3('0x5a')](_0x736bc0[_0x88a3('0x71')],{'uniqueid':_0x268f08[_0x88a3('0x5c')]});if(_0x35cf0d&&_0x35cf0d['channel']){return ami[_0x88a3('0x1a')]({'action':'Redirect','channel':_0x35cf0d[_0x88a3('0x5d')],'exten':_0x268f08[_0x88a3('0x74')],'context':_0x268f08[_0x88a3('0x75')]||_0x35cf0d[_0x88a3('0x75')],'priority':0x1})[_0x88a3('0x1b')](function(_0x28a9fa){_0x31ba20({'code':0xc8,'message':[_0x268f08['uniqueid'],_0x28a9fa['message']['toLowerCase']()][_0x88a3('0x1f')]('\x20')});})['catch'](function(_0x2b3e38){_0x410ced(_0x5e175b['error'](0x1f5,[_0x268f08['uniqueid'],_0x2b3e38[_0x88a3('0x1c')]['toLowerCase']()][_0x88a3('0x1f')]('\x20')));});}else{return _0x410ced(_0x5e175b[_0x88a3('0x13')](0x1f5,_0x88a3('0x6b')));}});},'Agents':function(_0x4ed1f6){return new Promise(function(_0x2a9605,_0x548181){var _0x1087b3=_['values'](_0x736bc0[_0x88a3('0xe')]);_0x2a9605({'count':_0x1087b3[_0x88a3('0x57')],'rows':_0x1087b3});});},'Telephones':function(_0x41f22f){return new Promise(function(_0x457f74,_0x4ee75a){var _0xfe399d=_[_0x88a3('0x58')](_0x736bc0[_0x88a3('0x76')]);_0x457f74({'count':_0xfe399d[_0x88a3('0x57')],'rows':_0xfe399d});});},'Trunks':function(_0x914a92){return new Promise(function(_0x6418e1,_0x6531d9){var _0x580a16=_['values'](_0x736bc0[_0x88a3('0x77')]);_0x6418e1({'count':_0x580a16[_0x88a3('0x57')],'rows':_0x580a16});});},'OutboundChannels':function(_0x376cdf){return new Promise(function(_0x203a5a,_0x59731d){var _0x5de6a8=_[_0x88a3('0x58')](_0x736bc0['outboundChannels']);_0x203a5a({'count':_0x5de6a8[_0x88a3('0x57')],'rows':_0x5de6a8});});},'Outbound':function(_0xec65e7){return new Promise(function(_0x538abd,_0x31e0ad){_0x538abd(_0x736bc0[_0x88a3('0x30')]);});},'Campaigns':function(_0x5225ac){return new Promise(function(_0x3fac6c,_0x499128){var _0x204b96=_[_0x88a3('0x58')](_0x736bc0[_0x88a3('0x78')]);_0x3fac6c({'count':_0x204b96[_0x88a3('0x57')],'rows':_0x204b96});});},'VoiceQueuesPreview':function(_0x3af083){var _0x10c269=this;return new Promise(function(_0x1ec0e4,_0x5f4cbf){_0x4fb92a[_0x88a3('0x79')](_0x3af083['id'])['then'](function(_0x3b6382){_0x1ec0e4({'code':0xc8,'message':_0x3b6382['message']});})[_0x88a3('0x1d')](function(_0x39ae97){_0x5f4cbf(_0x10c269['error'](0x1f4,_0x39ae97[_0x88a3('0x1c')]));});});},'EventManager':function(_0xedf751){var _0x3ac587=this;return new Promise(function(_0x1b74b1,_0x1f096e){if(!_0xedf751[_0x88a3('0x7a')]){return _0x1f096e(_0x3ac587[_0x88a3('0x13')](0x1f4,_0x88a3('0x7b')));}ami['emit'](_0x88a3('0x7c')+_0xedf751[_0x88a3('0x7a')],_0xedf751[_0x88a3('0x1c')]);_0x1b74b1({'code':0xc8,'message':_0xedf751});});},'FaxAccounts':function(_0x10c491){return new Promise(function(_0x3b4ee5,_0x563320){var _0x10ccd3=_['values'](_0x736bc0[_0x88a3('0x7d')]);_0x3b4ee5({'count':_0x10ccd3[_0x88a3('0x57')],'rows':_0x10ccd3});});},'SendFax':function(_0x4559da){var _0x547758=this;return new Promise(function(_0x476cd7,_0x15e323){_0x189268['send'](_0x4559da)['then'](function(_0x292b87){_0x476cd7({'code':0xc8,'message':_0x292b87[_0x88a3('0x1c')]});})[_0x88a3('0x1d')](function(_0x33de2e){_0x15e323(_0x547758[_0x88a3('0x13')](0x1f4,_0x33de2e[_0x88a3('0x1c')]));});});},'CheckAfterSend':function(_0x12b523){var _0x3c3f72=this;return new Promise(function(_0x23e2f0,_0x48a0ed){_0x189268[_0x88a3('0x7e')](_0x12b523)[_0x88a3('0x1b')](function(_0x1e5824){_0x23e2f0({'code':0xc8,'message':_0x1e5824[_0x88a3('0x1c')]});})[_0x88a3('0x1d')](function(_0x476d37){_0x48a0ed(_0x3c3f72[_0x88a3('0x13')](0x1f4,_0x476d37['message']));});});}};var _0x1d2307=jayson[_0x88a3('0x7f')](_0x280f8c)[_0x88a3('0x80')]();_0x1d2307['on'](_0x88a3('0x13'),function(_0x2e42aa){return _0x58542b(_0x2e42aa);});_0x1d2307['listen'](0x232a,_0x88a3('0x81'),function(){console[_0x88a3('0x82')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3746b3(_0x88a3('0x83')+0x232a);});});}; \ No newline at end of file +var _0xce88=['QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','Reload','Action','then','message','catch','command','action','Command','content','voiceQueues','hasOwnProperty','answered','available','pTalking','sumDuration','sumHoldTime','talking','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','push','length','values','channels','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime'];(function(_0x103575,_0x1609cd){var _0x9ccab8=function(_0x4075cd){while(--_0x4075cd){_0x103575['push'](_0x103575['shift']());}};_0x9ccab8(++_0x1609cd);}(_0xce88,0x108));var _0x8ce8=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xce88[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x8ce8('0x0'));var util=require(_0x8ce8('0x1'));var jayson=require(_0x8ce8('0x2'));var schema=require(_0x8ce8('0x3'));var BPromise=require(_0x8ce8('0x4'));var moment=require(_0x8ce8('0x5'));var config=require(_0x8ce8('0x6'));var properties=require(_0x8ce8('0x7'));var ami=require(_0x8ce8('0x8'));exports[_0x8ce8('0x9')]=function(_0x3f37fd,_0x54376e,_0x17af84){return new BPromise(function(_0x270b12,_0x5c73e8){var _0x3bf443={'QueuePause':function(_0x19e749){return new Promise(function(_0x14614b,_0x267146){var _0x10e9d3=util[_0x8ce8('0xa')](_0x8ce8('0xb'),_0x8ce8('0xc'),_0x19e749['name']);if(_0x3f37fd['timers']&&_0x3f37fd[_0x8ce8('0xd')][_0x10e9d3]&&_0x3f37fd['timers'][_0x10e9d3][_0x8ce8('0xe')]){_0x3f37fd[_0x8ce8('0xd')][_0x10e9d3][_0x8ce8('0xf')]();}if(_0x3f37fd[_0x8ce8('0x10')][_0x10e9d3]){_0x3f37fd['agents'][_0x10e9d3][_0x8ce8('0x11')]({'statePause':_0x19e749['pause']?!![]:![]});}_0x14614b({'code':0xc8,'message':_0x8ce8('0x12')});});},'Reload':function(_0x1c87b3){var _0x2d19da=this;return new Promise(function(_0x27810a,_0x5b0784){if(ami[_0x8ce8('0x13')]()==![]){return _0x5b0784(_0x2d19da[_0x8ce8('0x14')](0x1f4,[config[_0x8ce8('0x15')]['ip'],config[_0x8ce8('0x15')][_0x8ce8('0x16')],_0x8ce8('0x17')][_0x8ce8('0x18')]('\x20')));}_0x1c87b3=_[_0x8ce8('0x19')](_0x1c87b3,_[_0x8ce8('0x1a')](properties[_0x8ce8('0x1b')]));_0x1c87b3['action']=_0x8ce8('0x1c');return ami[_0x8ce8('0x1d')](_0x1c87b3)[_0x8ce8('0x1e')](function(_0x4f5174){_0x27810a({'code':0xc8,'message':_0x4f5174[_0x8ce8('0x1f')]});})[_0x8ce8('0x20')](function(_0x3afa35){_0x5b0784(_0x2d19da[_0x8ce8('0x14')](0x1f5,_0x3afa35['message']));});});},'Command':function(_0xc17a72){var _0x2738e7=this;return new Promise(function(_0x39926b,_0x5860d0){if(ami[_0x8ce8('0x13')]()==![]){return _0x5860d0(_0x2738e7['error'](0x1f4,[config[_0x8ce8('0x15')]['ip'],config[_0x8ce8('0x15')][_0x8ce8('0x16')],_0x8ce8('0x17')]['join']('\x20')));}_0xc17a72=_['pick'](_0xc17a72,_0x8ce8('0x21'));_0xc17a72[_0x8ce8('0x22')]=_0x8ce8('0x23');return ami[_0x8ce8('0x1d')](_0xc17a72)[_0x8ce8('0x1e')](function(_0x2e6015){_0x39926b({'code':0xc8,'message':_0x2e6015[_0x8ce8('0x24')]});})[_0x8ce8('0x20')](function(_0x3a3016){_0x5860d0(_0x2738e7[_0x8ce8('0x14')](0x1f5,_0x3a3016[_0x8ce8('0x1f')]));});});},'VoiceQueues':function(_0x222a53){return new Promise(function(_0x12e701,_0x52ae0c){var _0x3b2b65=[];for(var _0x2b6404 in _0x3f37fd[_0x8ce8('0x25')]){if(_0x3f37fd['voiceQueues'][_0x8ce8('0x26')](_0x2b6404)){var _0x1a8952=_0x3f37fd[_0x8ce8('0x25')][_0x2b6404];var _0x51b51e={'id':_0x1a8952['id'],'name':_0x1a8952['name'],'strategy':_0x1a8952['strategy'],'answered':_0x1a8952[_0x8ce8('0x27')],'available':_0x1a8952[_0x8ce8('0x28')],'loggedIn':_0x1a8952['loggedIn'],'pTalking':_0x1a8952[_0x8ce8('0x29')],'sumBillable':_0x1a8952['sumBillable'],'sumDuration':_0x1a8952[_0x8ce8('0x2a')],'sumHoldTime':_0x1a8952[_0x8ce8('0x2b')]||0x0,'talking':_0x1a8952[_0x8ce8('0x2c')],'total':_0x1a8952['total'],'type':_0x1a8952[_0x8ce8('0x2d')],'unmanaged':_0x1a8952['unmanaged'],'abandoned':_0x1a8952[_0x8ce8('0x2e')],'waiting':_0x1a8952[_0x8ce8('0x2f')],'loggedInDb':_0x1a8952[_0x8ce8('0x30')]};if(_0x1a8952[_0x8ce8('0x2d')]===_0x8ce8('0x31')){_0x51b51e[_0x8ce8('0x32')]=_0x1a8952[_0x8ce8('0x32')];_0x51b51e['dialMethod']=_0x1a8952[_0x8ce8('0x33')];_0x51b51e[_0x8ce8('0x34')]=_0x1a8952[_0x8ce8('0x34')];_0x51b51e[_0x8ce8('0x35')]=_0x1a8952['dialOriginateCallerIdNumber'];_0x51b51e[_0x8ce8('0x36')]=_0x1a8952['dialOriginateTimeout'];_0x51b51e['dialPrefix']=_0x1a8952[_0x8ce8('0x37')];_0x51b51e[_0x8ce8('0x38')]=_0x1a8952['outboundAnswerAgiCallsDay'];_0x51b51e[_0x8ce8('0x39')]=_0x1a8952[_0x8ce8('0x39')];_0x51b51e[_0x8ce8('0x3a')]=_0x1a8952[_0x8ce8('0x3a')];_0x51b51e['outboundBusyCallsDay']=_0x1a8952[_0x8ce8('0x3b')];_0x51b51e[_0x8ce8('0x3c')]=_0x1a8952['outboundCongestionCallsDay'];_0x51b51e[_0x8ce8('0x3d')]=_0x1a8952[_0x8ce8('0x3d')];_0x51b51e[_0x8ce8('0x3e')]=_0x1a8952[_0x8ce8('0x3e')];_0x51b51e[_0x8ce8('0x3f')]=_0x1a8952[_0x8ce8('0x3f')];_0x51b51e[_0x8ce8('0x40')]=_0x1a8952['outboundNoAnswerCallsDay'];_0x51b51e[_0x8ce8('0x41')]=_0x1a8952['outboundNoSuchCallsDay'];_0x51b51e[_0x8ce8('0x42')]=_0x1a8952[_0x8ce8('0x42')];_0x51b51e[_0x8ce8('0x43')]=_0x1a8952['outboundReCallsDay'];_0x51b51e[_0x8ce8('0x44')]=_0x1a8952[_0x8ce8('0x44')];_0x51b51e[_0x8ce8('0x45')]=_0x1a8952['outboundUnknownCallsDay'];_0x51b51e[_0x8ce8('0x46')]=_0x1a8952['predictiveIntervalAnsweredCalls'];_0x51b51e[_0x8ce8('0x47')]=_0x1a8952[_0x8ce8('0x47')];_0x51b51e[_0x8ce8('0x48')]=_0x1a8952['predictiveIntervalAvgTalktime'];_0x51b51e['predictiveIntervalDroppedCallsCallersExit']=_0x1a8952['predictiveIntervalDroppedCallsCallersExit'];_0x51b51e[_0x8ce8('0x49')]=_0x1a8952[_0x8ce8('0x49')];_0x51b51e['predictiveIntervalErlangCalls']=_0x1a8952[_0x8ce8('0x4a')];_0x51b51e['predictiveIntervalErlangCallsDroppedCalls']=_0x1a8952[_0x8ce8('0x4b')];_0x51b51e[_0x8ce8('0x4c')]=_0x1a8952[_0x8ce8('0x4c')];_0x51b51e[_0x8ce8('0x4d')]=_0x1a8952['predictiveIntervalMultiplicativeFactor'];_0x51b51e[_0x8ce8('0x4e')]=_0x1a8952[_0x8ce8('0x4e')];_0x51b51e[_0x8ce8('0x4f')]=_0x1a8952['predictiveIntervalAvailable'];_0x51b51e[_0x8ce8('0x50')]=_0x1a8952[_0x8ce8('0x50')];_0x51b51e['message']=_0x1a8952['message'];_0x51b51e[_0x8ce8('0x51')]=_0x1a8952[_0x8ce8('0x51')];_0x51b51e[_0x8ce8('0x52')]=_0x1a8952[_0x8ce8('0x52')];_0x51b51e[_0x8ce8('0x53')]=_0x1a8952[_0x8ce8('0x53')];_0x51b51e[_0x8ce8('0x54')]=_0x1a8952[_0x8ce8('0x54')];_0x51b51e[_0x8ce8('0x55')]=_0x1a8952[_0x8ce8('0x55')];_0x51b51e[_0x8ce8('0x56')]=_0x1a8952['startPredictive'];_0x51b51e[_0x8ce8('0x57')]=_0x1a8952[_0x8ce8('0x57')];}if(_0x1a8952[_0x8ce8('0x58')]){_0x51b51e[_0x8ce8('0x58')]={'id':_0x1a8952['Trunk']['id'],'name':_0x1a8952['Trunk'][_0x8ce8('0x59')],'active':_0x1a8952[_0x8ce8('0x58')][_0x8ce8('0x5a')],'callerid':_0x1a8952['Trunk'][_0x8ce8('0x5b')]};}if(_0x1a8952[_0x8ce8('0x5c')]){_0x51b51e['Interval']={'id':_0x1a8952[_0x8ce8('0x5c')]['id'],'name':_0x1a8952[_0x8ce8('0x5c')][_0x8ce8('0x59')]};}_0x3b2b65[_0x8ce8('0x5d')](_0x51b51e);}}_0x12e701({'count':_0x3b2b65[_0x8ce8('0x5e')],'rows':_0x3b2b65});});},'VoiceChannels':function(_0x459c9a){return new Promise(function(_0x53f4fa,_0x4497ea){var _0x4c4a56=_[_0x8ce8('0x5f')](_0x3f37fd[_0x8ce8('0x60')]);_0x53f4fa({'count':_0x4c4a56[_0x8ce8('0x5e')],'rows':_0x4c4a56});});},'VoiceChannelMixMonitor':function(_0x14ee09){var _0x2bb042=this;return new Promise(function(_0x53ec3a,_0x18b17e){if(ami[_0x8ce8('0x13')]()==![]){return _0x18b17e(_0x2bb042[_0x8ce8('0x14')](0x1f4,[config[_0x8ce8('0x15')]['ip'],config[_0x8ce8('0x15')]['username'],_0x8ce8('0x17')][_0x8ce8('0x18')]('\x20')));}var _0x15c7ec=schema(properties[_0x8ce8('0x61')])[_0x8ce8('0x3')](_0x14ee09);if(_0x15c7ec[_0x8ce8('0x5e')]>0x0){return _0x18b17e(_0x2bb042[_0x8ce8('0x14')](0x1f4,_[_0x8ce8('0x62')](_0x15c7ec,_0x8ce8('0x1f'))[_0x8ce8('0x18')](',\x20')));}var _0x426605=_[_0x8ce8('0x63')](_0x3f37fd[_0x8ce8('0x60')],{'uniqueid':_0x14ee09[_0x8ce8('0x64')]});if(_0x426605&&_0x426605[_0x8ce8('0x65')]){var _0x2e7c41=util['format'](_0x8ce8('0x66'),_0x14ee09[_0x8ce8('0x67')]||_0x14ee09[_0x8ce8('0x64')],_0x14ee09[_0x8ce8('0xa')]||_0x8ce8('0x68'));return ami[_0x8ce8('0x1d')]({'action':_0x8ce8('0x69'),'channel':_0x426605[_0x8ce8('0x65')],'file':_0x2e7c41,'options':_0x8ce8('0x6a')})[_0x8ce8('0x1e')](function(_0x295558){var _0x4aef71=_['find'](_0x426605[_0x8ce8('0x6b')],{'filename':_0x8ce8('0x6c')+_0x2e7c41[_0x8ce8('0x6d')]()});if(_[_0x8ce8('0x6e')](_0x4aef71)){_0x426605['monitors']['push']({'filename':_0x8ce8('0x6c')+_0x2e7c41['toLowerCase'](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x295558[_0x8ce8('0x6f')],'status':_0x8ce8('0x70')});}else{_0x4aef71[_0x8ce8('0x6f')]=_0x295558[_0x8ce8('0x6f')];_0x4aef71[_0x8ce8('0x71')]='rec';}_0x53ec3a({'code':0xc8,'message':[_0x14ee09[_0x8ce8('0x64')],'MixMonitor\x20Success',_0x295558[_0x8ce8('0x6f')]][_0x8ce8('0x18')]('\x20'),'mixmonitorid':_0x295558[_0x8ce8('0x6f')]});})[_0x8ce8('0x20')](function(_0xf2f2b){_0x18b17e(_0x2bb042['error'](0x1f5,[_0x14ee09['uniqueid'],_0xf2f2b['message'][_0x8ce8('0x6d')]()][_0x8ce8('0x18')]('\x20')));});}else{return _0x18b17e(_0x2bb042[_0x8ce8('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5f4629){var _0x1a8856=this;return new Promise(function(_0x19d2ab,_0x4abbe5){if(ami[_0x8ce8('0x13')]()==![]){return _0x4abbe5(_0x1a8856[_0x8ce8('0x14')](0x1f4,[config[_0x8ce8('0x15')]['ip'],config['asterisk'][_0x8ce8('0x16')],_0x8ce8('0x17')][_0x8ce8('0x18')]('\x20')));}var _0x325210=schema(properties[_0x8ce8('0x61')])[_0x8ce8('0x3')](_0x5f4629);if(_0x325210['length']>0x0){return _0x4abbe5(_0x1a8856[_0x8ce8('0x14')](0x1f4,_[_0x8ce8('0x62')](_0x325210,_0x8ce8('0x1f'))[_0x8ce8('0x18')](',\x20')));}var _0x51f827=_[_0x8ce8('0x63')](_0x3f37fd[_0x8ce8('0x60')],{'uniqueid':_0x5f4629[_0x8ce8('0x64')]});if(_0x51f827){return BPromise['resolve']()[_0x8ce8('0x1e')](function(){if(_0x51f827[_0x8ce8('0x65')]){return ami['Action']({'action':_0x8ce8('0x72'),'channel':_0x51f827['channel'],'mixmonitorid':_0x5f4629[_0x8ce8('0x6f')]})[_0x8ce8('0x20')](function(_0x2d26ad){});}})[_0x8ce8('0x1e')](function(){if(_0x51f827[_0x8ce8('0x73')]){return ami['Action']({'action':_0x8ce8('0x72'),'channel':_0x51f827[_0x8ce8('0x73')],'mixmonitorid':_0x5f4629[_0x8ce8('0x6f')]})[_0x8ce8('0x20')](function(_0x2b939d){});}})[_0x8ce8('0x1e')](function(_0x44fe3d){var _0x347451=_[_0x8ce8('0x63')](_0x51f827[_0x8ce8('0x6b')],{'mixmonitorid':_0x5f4629[_0x8ce8('0x6f')]});if(_0x347451){_0x347451[_0x8ce8('0x71')]=_0x8ce8('0x74');}})[_0x8ce8('0x1e')](function(){var _0xd2b901=util[_0x8ce8('0xa')](_0x8ce8('0x66'),_0x5f4629[_0x8ce8('0x67')]||_0x5f4629[_0x8ce8('0x64')],_0x5f4629[_0x8ce8('0xa')]||_0x8ce8('0x68'));var _0x528759=_[_0x8ce8('0x63')](_0x51f827['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0xd2b901[_0x8ce8('0x6d')]()});if(_0x528759){_0x528759[_0x8ce8('0x71')]='stop';}})[_0x8ce8('0x1e')](function(){_0x19d2ab({'code':0xc8,'message':[_0x5f4629[_0x8ce8('0x64')],_0x8ce8('0x75')][_0x8ce8('0x18')]('\x20')});})[_0x8ce8('0x20')](function(_0x3cb786){_0x4abbe5(_0x1a8856[_0x8ce8('0x14')](0x1f5,[_0x5f4629[_0x8ce8('0x64')],_0x3cb786[_0x8ce8('0x1f')][_0x8ce8('0x6d')]()][_0x8ce8('0x18')]('\x20')));});}else{return _0x4abbe5(_0x1a8856[_0x8ce8('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1a9380){return new Promise(function(_0x597713,_0x5ddb23){var _0x477d21=_[_0x8ce8('0x5f')](_0x3f37fd[_0x8ce8('0x76')]);_0x597713({'count':_0x477d21['length'],'rows':_0x477d21});});},'VoiceQueuesChannel':function(_0x2858ff){var _0xb296a6=this;return new Promise(function(_0x4a7ec6,_0x55e0fc){var _0x52bd97=schema(properties[_0x8ce8('0x77')])['validate'](_0x2858ff);if(_0x52bd97[_0x8ce8('0x5e')]>0x0){return _0x55e0fc(_0xb296a6[_0x8ce8('0x14')](0x1f4,_[_0x8ce8('0x62')](_0x52bd97,'message')[_0x8ce8('0x18')](',\x20')));}var _0x1374bc=_[_0x8ce8('0x63')](_0x3f37fd[_0x8ce8('0x76')],{'uniqueid':_0x2858ff['uniqueid']});if(_0x1374bc){_0x4a7ec6(_0x1374bc);}else{return _0x55e0fc(_0xb296a6[_0x8ce8('0x14')](0x1f5,_0x8ce8('0x78')));}});},'VoiceQueuesChannelHangup':function(_0x4e460a){var _0x247663=this;return new Promise(function(_0x5b0acd,_0x5e8871){if(ami[_0x8ce8('0x13')]()==![]){return _0x5e8871(_0x247663[_0x8ce8('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x8ce8('0x15')][_0x8ce8('0x16')],_0x8ce8('0x17')][_0x8ce8('0x18')]('\x20')));}var _0x503185=schema(properties[_0x8ce8('0x79')])[_0x8ce8('0x3')](_0x4e460a);if(_0x503185[_0x8ce8('0x5e')]>0x0){return _0x5e8871(_0x247663['error'](0x1f4,_['map'](_0x503185,_0x8ce8('0x1f'))['join'](',\x20')));}var _0x33bc53=_['find'](_0x3f37fd[_0x8ce8('0x76')],{'uniqueid':_0x4e460a[_0x8ce8('0x64')]});if(_0x33bc53&&_0x33bc53[_0x8ce8('0x65')]){return ami[_0x8ce8('0x1d')]({'action':_0x8ce8('0x7a'),'channel':_0x33bc53['channel']})[_0x8ce8('0x1e')](function(_0x203a0a){_0x5b0acd({'code':0xc8,'message':[_0x4e460a['uniqueid'],_0x203a0a['message'][_0x8ce8('0x6d')]()][_0x8ce8('0x18')]('\x20')});})[_0x8ce8('0x20')](function(_0x5b076b){_0x5e8871(_0x247663[_0x8ce8('0x14')](0x1f5,[_0x4e460a['uniqueid'],_0x5b076b[_0x8ce8('0x1f')][_0x8ce8('0x6d')]()][_0x8ce8('0x18')]('\x20')));});}else{return _0x5e8871(_0x247663[_0x8ce8('0x14')](0x1f5,_0x8ce8('0x78')));}});},'VoiceQueuesChannelRedirect':function(_0x785618){var _0x302330=this;return new Promise(function(_0x571d2a,_0x18a4eb){if(ami['isConnected']()==![]){return _0x18a4eb(_0x302330[_0x8ce8('0x14')](0x1f4,[config[_0x8ce8('0x15')]['ip'],config[_0x8ce8('0x15')][_0x8ce8('0x16')],'ami\x20disconnected'][_0x8ce8('0x18')]('\x20')));}var _0x2f31b6=schema(properties['voicequeuechannelredirect'])[_0x8ce8('0x3')](_0x785618);if(_0x2f31b6['length']>0x0){return _0x18a4eb(_0x302330[_0x8ce8('0x14')](0x1f4,_[_0x8ce8('0x62')](_0x2f31b6,_0x8ce8('0x1f'))[_0x8ce8('0x18')](',\x20')));}var _0x52fdb4=_[_0x8ce8('0x63')](_0x3f37fd[_0x8ce8('0x76')],{'uniqueid':_0x785618['uniqueid']});if(_0x52fdb4&&_0x52fdb4[_0x8ce8('0x65')]){return ami['Action']({'action':_0x8ce8('0x7b'),'channel':_0x52fdb4[_0x8ce8('0x65')],'exten':_0x785618[_0x8ce8('0x7c')],'context':_0x785618[_0x8ce8('0x7d')]||_0x52fdb4[_0x8ce8('0x7d')],'priority':0x1})[_0x8ce8('0x1e')](function(_0x2eec73){_0x571d2a({'code':0xc8,'message':[_0x785618['uniqueid'],_0x2eec73[_0x8ce8('0x1f')][_0x8ce8('0x6d')]()][_0x8ce8('0x18')]('\x20')});})[_0x8ce8('0x20')](function(_0x4cfbc9){_0x18a4eb(_0x302330[_0x8ce8('0x14')](0x1f5,[_0x785618[_0x8ce8('0x64')],_0x4cfbc9['message'][_0x8ce8('0x6d')]()][_0x8ce8('0x18')]('\x20')));});}else{return _0x18a4eb(_0x302330['error'](0x1f5,_0x8ce8('0x78')));}});},'Agents':function(_0x5b159e){return new Promise(function(_0x1c5948,_0x54a025){var _0x353a80=_[_0x8ce8('0x5f')](_0x3f37fd[_0x8ce8('0x10')]);_0x1c5948({'count':_0x353a80['length'],'rows':_0x353a80});});},'Telephones':function(_0xb8e9de){return new Promise(function(_0x21d97a,_0x5868ec){var _0x1f7220=_[_0x8ce8('0x5f')](_0x3f37fd[_0x8ce8('0x7e')]);_0x21d97a({'count':_0x1f7220[_0x8ce8('0x5e')],'rows':_0x1f7220});});},'Trunks':function(_0x15ef2f){return new Promise(function(_0x2a3a57,_0xcda4b){var _0x4b06d1=_[_0x8ce8('0x5f')](_0x3f37fd[_0x8ce8('0x7f')]);_0x2a3a57({'count':_0x4b06d1[_0x8ce8('0x5e')],'rows':_0x4b06d1});});},'OutboundChannels':function(_0x4f56b9){return new Promise(function(_0x46af80,_0x8dd5fc){var _0x418074=_[_0x8ce8('0x5f')](_0x3f37fd[_0x8ce8('0x80')]);_0x46af80({'count':_0x418074[_0x8ce8('0x5e')],'rows':_0x418074});});},'Outbound':function(_0x3527c0){return new Promise(function(_0x220014,_0x5811c0){_0x220014(_0x3f37fd['outbound']);});},'Campaigns':function(_0x2bfc99){return new Promise(function(_0x28d74e,_0x54782b){var _0x7d5c63=_[_0x8ce8('0x5f')](_0x3f37fd[_0x8ce8('0x81')]);_0x28d74e({'count':_0x7d5c63[_0x8ce8('0x5e')],'rows':_0x7d5c63});});},'VoiceQueuesPreview':function(_0x1efe89){var _0x5a6b8b=this;return new Promise(function(_0x4f2358,_0x1333b1){_0x54376e[_0x8ce8('0x82')](_0x1efe89['id'])[_0x8ce8('0x1e')](function(_0x4d89c2){_0x4f2358({'code':0xc8,'message':_0x4d89c2[_0x8ce8('0x1f')]});})[_0x8ce8('0x20')](function(_0x3e764b){_0x1333b1(_0x5a6b8b[_0x8ce8('0x14')](0x1f4,_0x3e764b['message']));});});},'EventManager':function(_0x18d846){var _0x3bd384=this;return new Promise(function(_0x320823,_0x2be474){if(!_0x18d846['event']){return _0x2be474(_0x3bd384[_0x8ce8('0x14')](0x1f4,_0x8ce8('0x83')));}ami[_0x8ce8('0x84')](_0x8ce8('0x85')+_0x18d846[_0x8ce8('0x86')],_0x18d846[_0x8ce8('0x1f')]);_0x320823({'code':0xc8,'message':_0x18d846});});},'FaxAccounts':function(_0x476292){return new Promise(function(_0x4ef09a,_0x248021){var _0x51eaee=_[_0x8ce8('0x5f')](_0x3f37fd[_0x8ce8('0x87')]);_0x4ef09a({'count':_0x51eaee[_0x8ce8('0x5e')],'rows':_0x51eaee});});},'SendFax':function(_0x13e62e){var _0x30f446=this;return new Promise(function(_0x163059,_0x1b55fc){_0x17af84[_0x8ce8('0x88')](_0x13e62e)['then'](function(_0x255bdd){_0x163059({'code':0xc8,'message':_0x255bdd[_0x8ce8('0x1f')]});})[_0x8ce8('0x20')](function(_0x382f02){_0x1b55fc(_0x30f446[_0x8ce8('0x14')](0x1f4,_0x382f02['message']));});});},'CheckAfterSend':function(_0x5cf5f8){var _0x24ea43=this;return new Promise(function(_0x58c11d,_0x1f4a8b){_0x17af84['checkAfterSend'](_0x5cf5f8)[_0x8ce8('0x1e')](function(_0x2b6d50){_0x58c11d({'code':0xc8,'message':_0x2b6d50[_0x8ce8('0x1f')]});})[_0x8ce8('0x20')](function(_0x3e5aa7){_0x1f4a8b(_0x24ea43[_0x8ce8('0x14')](0x1f4,_0x3e5aa7['message']));});});}};var _0x4ee5ef=jayson['server'](_0x3bf443)[_0x8ce8('0x89')]();_0x4ee5ef['on'](_0x8ce8('0x14'),function(_0x45ce7d){return _0x5c73e8(_0x45ce7d);});_0x4ee5ef[_0x8ce8('0x9')](0x232a,_0x8ce8('0x8a'),function(){console[_0x8ce8('0x8b')](_0x8ce8('0x8c'),0x232a);return _0x270b12('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 6b80ec8..0642c20 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 _0xc0a6=['ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','exec','data2','data1','calleridnum','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','omit','[%s][%s]\x20Contact\x20found:%s','format','trigger:%s','action','toLowerCase','createContact','[%s][%s]\x20Contact\x20created:%s','user:%s','name','merge','catch','error','[%s][%s]\x20Error\x20creating\x20contact','bluebird','util'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xc0a6,0xcb));var _0x6c0a=function(_0x2ee6a2,_0x3b2bb5){_0x2ee6a2=_0x2ee6a2-0x0;var _0x3faa98=_0xc0a6[_0x2ee6a2];return _0x3faa98;};'use strict';var BPromise=require(_0x6c0a('0x0'));var util=require(_0x6c0a('0x1'));var _=require('lodash');var Redis=require(_0x6c0a('0x2'));var config=require(_0x6c0a('0x3'));var logger=require(_0x6c0a('0x4'))(_0x6c0a('0x5'));var cmContactRpc=require(_0x6c0a('0x6'));config[_0x6c0a('0x7')]=_[_0x6c0a('0x8')](config[_0x6c0a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6c0a('0x9'))(new Redis(config[_0x6c0a('0x7')]));function emit(_0x416ceb,_0x415ded,_0x48695b,_0x344873){logger[_0x6c0a('0xa')]('[%s][%s]',_0x416ceb,'',_0x415ded,_0x48695b,JSON[_0x6c0a('0xb')](_0x344873));io['to'](_0x415ded)['emit'](_0x48695b,_0x344873);}exports[_0x6c0a('0xc')]=function(_0x5e0d93,_0x5a28df,_0x4f20f2){_0x4f20f2['autoCreate']=0x0;if(_0x5a28df[_0x6c0a('0xd')]&&parseInt(_0x5a28df['data2'],0xa)){var _0x20fc6e={'ListId':parseInt(_0x5a28df[_0x6c0a('0xe')],0xa),'phone':_0x4f20f2[_0x6c0a('0xf')]};if(_['isNil'](_0x4f20f2[_0x6c0a('0x10')])){_0x20fc6e[_0x6c0a('0x11')]=_0x4f20f2[_0x6c0a('0x12')]&&_0x4f20f2[_0x6c0a('0x12')]!==_0x6c0a('0x13')?_0x4f20f2[_0x6c0a('0x12')]:_0x4f20f2['calleridnum']||_0x4f20f2[_0x6c0a('0x14')];}else{_0x20fc6e[_0x6c0a('0x11')]=_0x4f20f2[_0x6c0a('0x15')]&&_0x4f20f2[_0x6c0a('0x15')]!==_0x6c0a('0x13')?_0x4f20f2[_0x6c0a('0x15')]:_0x4f20f2[_0x6c0a('0x16')]||_0x4f20f2[_0x6c0a('0x14')];_0x20fc6e[_0x6c0a('0x17')]=_0x4f20f2[_0x6c0a('0x15')]&&_0x4f20f2[_0x6c0a('0x15')]!==_0x6c0a('0x13')?_0x4f20f2['destcalleridname']:_0x4f20f2[_0x6c0a('0x16')]||_0x4f20f2[_0x6c0a('0x14')];}BPromise[_0x6c0a('0x18')]()[_0x6c0a('0x19')](cmContactRpc[_0x6c0a('0x1a')]({'where':_[_0x6c0a('0x1b')](_0x20fc6e,[_0x6c0a('0x11')])}))[_0x6c0a('0x19')](function(_0x5e7962){if(_0x5e7962){logger[_0x6c0a('0xa')](_0x6c0a('0x1c'),_0x4f20f2['uniqueid'],'',_0x5e7962['id']);if(_0x5e0d93){_0x4f20f2['xmd-contactid2']=_0x5e7962['id'];emit(_0x4f20f2[_0x6c0a('0x14')],util[_0x6c0a('0x1d')]('user:%s',_0x5e0d93['name']),util[_0x6c0a('0x1d')](_0x6c0a('0x1e'),_0x5a28df[_0x6c0a('0x1f')][_0x6c0a('0x20')]()),_['merge'](_0x4f20f2,{'ListId':parseInt(_0x5a28df['data1'],0xa)}));}return;}else{logger[_0x6c0a('0xa')]('[%s][%s]\x20Contact\x20not\x20found',_0x4f20f2[_0x6c0a('0x14')],'');return BPromise[_0x6c0a('0x18')]()[_0x6c0a('0x19')](cmContactRpc[_0x6c0a('0x21')](_0x20fc6e));}})[_0x6c0a('0x19')](function(_0xb291d){if(_0xb291d){logger[_0x6c0a('0xa')](_0x6c0a('0x22'),_0x4f20f2[_0x6c0a('0x14')],'',_0xb291d['id']);if(_0x5e0d93){_0x4f20f2['xmd-contactid2']=_0xb291d['id'];emit(_0x4f20f2[_0x6c0a('0x14')],util[_0x6c0a('0x1d')](_0x6c0a('0x23'),_0x5e0d93[_0x6c0a('0x24')]),util[_0x6c0a('0x1d')](_0x6c0a('0x1e'),_0x5a28df[_0x6c0a('0x1f')][_0x6c0a('0x20')]()),_[_0x6c0a('0x25')](_0x4f20f2,{'ListId':parseInt(_0x5a28df[_0x6c0a('0xe')],0xa)}));}}})[_0x6c0a('0x26')](function(_0x1aee5c){logger[_0x6c0a('0x27')](_0x6c0a('0x28'),_0x4f20f2[_0x6c0a('0x14')],'',JSON['stringify'](_0x1aee5c));});}else{if(_0x5e0d93){logger['info']('[%s][%s]\x20Autocreate\x20disabled',_0x4f20f2[_0x6c0a('0x14')],'');emit(_0x4f20f2[_0x6c0a('0x14')],util[_0x6c0a('0x1d')]('user:%s',_0x5e0d93['name']),util[_0x6c0a('0x1d')](_0x6c0a('0x1e'),_0x5a28df[_0x6c0a('0x1f')]['toLowerCase']()),_[_0x6c0a('0x25')]({'ListId':parseInt(_0x5a28df[_0x6c0a('0xe')],0xa)},_0x4f20f2));}}}; \ No newline at end of file +var _0xb78e=['[%s][%s]\x20Contact\x20created:%s','toLowerCase','merge','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','','destcalleridname','destcalleridnum','phone','uniqueid','then','showContact','omit','xmd-contactid2','format','user:%s','name','trigger:%s','action','[%s][%s]\x20Contact\x20not\x20found','resolve'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4535e6,_0x217c84){_0x4535e6=_0x4535e6-0x0;var _0x497054=_0xb78e[_0x4535e6];return _0x497054;};'use strict';var BPromise=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var _=require('lodash');var Redis=require(_0xeb78('0x2'));var config=require(_0xeb78('0x3'));var logger=require(_0xeb78('0x4'))(_0xeb78('0x5'));var cmContactRpc=require(_0xeb78('0x6'));config[_0xeb78('0x7')]=_[_0xeb78('0x8')](config[_0xeb78('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xeb78('0x9'))(new Redis(config[_0xeb78('0x7')]));function emit(_0x1ccc2f,_0x30c884,_0x2b7925,_0x36963f){logger[_0xeb78('0xa')]('[%s][%s]',_0x1ccc2f,'',_0x30c884,_0x2b7925,JSON[_0xeb78('0xb')](_0x36963f));io['to'](_0x30c884)[_0xeb78('0xc')](_0x2b7925,_0x36963f);}exports[_0xeb78('0xd')]=function(_0x46fbad,_0x125e97,_0x402680){_0x402680[_0xeb78('0xe')]=0x0;if(_0x125e97[_0xeb78('0xf')]&&parseInt(_0x125e97[_0xeb78('0xf')],0xa)){var _0x59d8d8={'ListId':parseInt(_0x125e97[_0xeb78('0x10')],0xa),'phone':_0x402680[_0xeb78('0x11')]};if(_[_0xeb78('0x12')](_0x402680[_0xeb78('0x13')])){_0x59d8d8[_0xeb78('0x14')]=_0x402680[_0xeb78('0x15')]&&_0x402680[_0xeb78('0x15')]!==_0xeb78('0x16')?_0x402680[_0xeb78('0x15')]:_0x402680[_0xeb78('0x11')]||_0x402680['uniqueid'];}else{_0x59d8d8[_0xeb78('0x14')]=_0x402680[_0xeb78('0x17')]&&_0x402680['destcalleridname']!==''?_0x402680['destcalleridname']:_0x402680[_0xeb78('0x18')]||_0x402680['uniqueid'];_0x59d8d8[_0xeb78('0x19')]=_0x402680[_0xeb78('0x17')]&&_0x402680['destcalleridname']!==_0xeb78('0x16')?_0x402680['destcalleridname']:_0x402680[_0xeb78('0x18')]||_0x402680[_0xeb78('0x1a')];}BPromise['resolve']()[_0xeb78('0x1b')](cmContactRpc[_0xeb78('0x1c')]({'where':_[_0xeb78('0x1d')](_0x59d8d8,['firstName'])}))[_0xeb78('0x1b')](function(_0x2c43c5){if(_0x2c43c5){logger['info']('[%s][%s]\x20Contact\x20found:%s',_0x402680[_0xeb78('0x1a')],'',_0x2c43c5['id']);if(_0x46fbad){_0x402680[_0xeb78('0x1e')]=_0x2c43c5['id'];emit(_0x402680[_0xeb78('0x1a')],util[_0xeb78('0x1f')](_0xeb78('0x20'),_0x46fbad[_0xeb78('0x21')]),util[_0xeb78('0x1f')](_0xeb78('0x22'),_0x125e97[_0xeb78('0x23')]['toLowerCase']()),_['merge'](_0x402680,{'ListId':parseInt(_0x125e97['data1'],0xa)}));}return;}else{logger['info'](_0xeb78('0x24'),_0x402680['uniqueid'],'');return BPromise[_0xeb78('0x25')]()[_0xeb78('0x1b')](cmContactRpc['createContact'](_0x59d8d8));}})[_0xeb78('0x1b')](function(_0x4ac816){if(_0x4ac816){logger[_0xeb78('0xa')](_0xeb78('0x26'),_0x402680[_0xeb78('0x1a')],'',_0x4ac816['id']);if(_0x46fbad){_0x402680[_0xeb78('0x1e')]=_0x4ac816['id'];emit(_0x402680['uniqueid'],util[_0xeb78('0x1f')]('user:%s',_0x46fbad[_0xeb78('0x21')]),util[_0xeb78('0x1f')](_0xeb78('0x22'),_0x125e97['action'][_0xeb78('0x27')]()),_[_0xeb78('0x28')](_0x402680,{'ListId':parseInt(_0x125e97[_0xeb78('0x10')],0xa)}));}}})[_0xeb78('0x29')](function(_0x3d4a97){logger[_0xeb78('0x2a')](_0xeb78('0x2b'),_0x402680[_0xeb78('0x1a')],'',JSON[_0xeb78('0xb')](_0x3d4a97));});}else{if(_0x46fbad){logger[_0xeb78('0xa')](_0xeb78('0x2c'),_0x402680['uniqueid'],'');emit(_0x402680['uniqueid'],util['format'](_0xeb78('0x20'),_0x46fbad[_0xeb78('0x21')]),util[_0xeb78('0x1f')]('trigger:%s',_0x125e97[_0xeb78('0x23')][_0xeb78('0x27')]()),_[_0xeb78('0x28')]({'ListId':parseInt(_0x125e97[_0xeb78('0x10')],0xa)},_0x402680));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 88dbc72..1e79a66 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 _0x031e=['exports','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','checkTriggers','interface','status','checkTrigger','merge','variables','Actions','length','toLowerCase','motionbar','browser','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winapp','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','action','jscripty','trigger:%s','contactmanager','exec','queue','routeId','parse','search','replace','AllConditions','every','checkConditions','AnyConditions','some','channel','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent'];(function(_0x41a59e,_0x1f2931){var _0x4ccc26=function(_0x2a7dd3){while(--_0x2a7dd3){_0x41a59e['push'](_0x41a59e['shift']());}};_0x4ccc26(++_0x1f2931);}(_0x031e,0x75));var _0xe031=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x031e[_0x24f31b];return _0x488401;};'use strict';var util=require('util');var _=require(_0xe031('0x0'));var url=require(_0xe031('0x1'));var Mustache=require(_0xe031('0x2'));var Redis=require(_0xe031('0x3'));var urlforward=require('./urlforward');var integration=require(_0xe031('0x4'));var cmContact=require(_0xe031('0x5'));var script=require(_0xe031('0x6'));var cmContactRpc=require(_0xe031('0x7'));var config=require(_0xe031('0x8'));var logger=require(_0xe031('0x9'))('trigger');var ami=require('../ami');config[_0xe031('0xa')]=_['defaults'](config[_0xe031('0xa')],{'host':_0xe031('0xb'),'port':0x18eb});var io=require(_0xe031('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x4600ae,_0x307b01){return _0x4600ae==_0x307b01;},'not_equals':function(_0x470c05,_0x9ab1dd){return _0x470c05!=_0x9ab1dd;}};var barAndWebActions=[_0xe031('0xd'),_0xe031('0x1'),'winapp'];function Trigger(_0xd01bfe){this[_0xe031('0xe')]=_0xd01bfe[_0xe031('0xe')];this['agents']=_0xd01bfe[_0xe031('0xf')];this[_0xe031('0x10')]=_0xd01bfe[_0xe031('0x10')];this[_0xe031('0x11')]=_0xd01bfe['templates'];this[_0xe031('0x12')]=_0xd01bfe[_0xe031('0x12')];this[_0xe031('0x13')]=_0xd01bfe[_0xe031('0x13')];this['freshdeskAccounts']=_0xd01bfe[_0xe031('0x14')];this['salesforceAccounts']=_0xd01bfe['salesforceAccounts'];this['sugarcrmAccounts']=_0xd01bfe[_0xe031('0x15')];this[_0xe031('0x16')]=_0xd01bfe['zohoAccounts'];this[_0xe031('0x17')]=_0xd01bfe[_0xe031('0x17')];this[_0xe031('0x18')]=_0xd01bfe['vtigerAccounts'];this['servicenowAccounts']=_0xd01bfe[_0xe031('0x19')];this[_0xe031('0x1a')]=_0xd01bfe['dynamics365Accounts'];this['freshsalesAccounts']=_0xd01bfe[_0xe031('0x1b')];this[_0xe031('0x1c')]={'zendesk':this[_0xe031('0x13')],'salesforce':this[_0xe031('0x1d')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0xe031('0x17')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xe031('0x1a')],'freshsales':this[_0xe031('0x1b')],'servicenow':this['servicenowAccounts']};ami['on'](_0xe031('0x1e'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on'](_0xe031('0x21'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on'](_0xe031('0x22'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on']('custom:agentcomplete',this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on'](_0xe031('0x23'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0xe031('0x20')](this));ami['on'](_0xe031('0x24'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on'](_0xe031('0x25'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on'](_0xe031('0x26'),this['syncCustomEvent'][_0xe031('0x20')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0xe031('0x20')](this));ami['on'](_0xe031('0x27'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on']('custom:dialbegin',this[_0xe031('0x28')][_0xe031('0x20')](this));ami['on']('custom:dialconnect',this[_0xe031('0x28')][_0xe031('0x20')](this));ami['on']('custom:dialend',this['syncAgentDial'][_0xe031('0x20')](this));ami['on'](_0xe031('0x29'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on'](_0xe031('0x2a'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on'](_0xe031('0x2b'),this[_0xe031('0x1f')][_0xe031('0x20')](this));ami['on'](_0xe031('0x2c'),this[_0xe031('0x1f')]['bind'](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0xe031('0x20')](this));ami['on'](_0xe031('0x2d'),this['syncCustomEvent'][_0xe031('0x20')](this));}Trigger[_0xe031('0x2e')][_0xe031('0x2f')]=function(_0x446edb,_0x50b75a,_0x356442){logger[_0xe031('0x30')](_0x446edb,_0x50b75a,JSON[_0xe031('0x31')](_0x356442));io['to'](_0x446edb)[_0xe031('0x2f')](_0x50b75a,_0x356442);};Trigger[_0xe031('0x2e')][_0xe031('0x1f')]=function(_0x4c0b56){var _0x587d44=_['clone'](_0x4c0b56);this[_0xe031('0x32')](_0x587d44);};Trigger[_0xe031('0x2e')][_0xe031('0x28')]=function(_0x4077d7){if(this[_0xe031('0xf')][_0x4077d7[_0xe031('0x33')]]){this[_0xe031('0x1f')](_0x4077d7);}};Trigger['prototype'][_0xe031('0x32')]=function(_0x3023c0){var _0x48eb5a;for(var _0x2d518e in this[_0xe031('0xe')]){if(this[_0xe031('0xe')]['hasOwnProperty'](_0x2d518e)){if(this['triggers'][_0x2d518e][_0xe031('0x34')]){_0x48eb5a=this[_0xe031('0x35')](this['triggers'][_0x2d518e],_0x3023c0);if(_0x48eb5a){_[_0xe031('0x36')](_0x3023c0,_0x3023c0[_0xe031('0x37')]);for(var _0x30460b=0x0,_0x3b7a80,_0x1ce8db,_0x2692af;_0x30460b0x0){_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(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 89b52a9..50a6c2d 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 _0xf9c6=['then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','message','toLowerCase','outbound','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','ticketId','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','format','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret'];(function(_0x47da8d,_0x517e13){var _0x5aabef=function(_0x2528d7){while(--_0x2528d7){_0x47da8d['push'](_0x47da8d['shift']());}};_0x5aabef(++_0x517e13);}(_0xf9c6,0x1d7));var _0x6f9c=function(_0x19101f,_0x3f1b9a){_0x19101f=_0x19101f-0x0;var _0x103bca=_0xf9c6[_0x19101f];return _0x103bca;};'use strict';var _=require(_0x6f9c('0x0'));var BPromise=require(_0x6f9c('0x1'));var rp=require(_0x6f9c('0x2'));var util=require(_0x6f9c('0x3'));var intUtil=require(_0x6f9c('0x4'));var md5=require(_0x6f9c('0x5'));var Redis=require(_0x6f9c('0x6'));var logger=require(_0x6f9c('0x7'))('dynamics365');var config=require(_0x6f9c('0x8'));config[_0x6f9c('0x9')]=_[_0x6f9c('0xa')](config[_0x6f9c('0x9')],{'host':_0x6f9c('0xb'),'port':0x18eb});var io=require(_0x6f9c('0xc'))(new Redis(config[_0x6f9c('0x9')]));function getAuthToken(_0x2d3d6b,_0x4ee7c6,_0x5f4917){var _0x6d8186={'method':_0x6f9c('0xd'),'uri':_0x4ee7c6,'form':{'client_id':_0x2d3d6b[_0x6f9c('0xe')],'resource':_0x2d3d6b[_0x6f9c('0xf')],'username':_0x2d3d6b[_0x6f9c('0x10')],'password':_0x2d3d6b[_0x6f9c('0x11')],'grant_type':_0x6f9c('0x11'),'client_secret':_0x2d3d6b[_0x6f9c('0x12')]},'json':!![]};return rp(_0x6d8186)[_0x6f9c('0x13')](function(_0xe27904){return _0xe27904[_0x6f9c('0x14')];})[_0x6f9c('0x15')](function(_0x5c32e6){logger[_0x6f9c('0x16')]('['+[_0x5f4917[_0x6f9c('0x17')]()]+_0x6f9c('0x18'));return _0x5c32e6['message'];});}function getUser(_0x2cab50,_0x30db75,_0xf1ce05,_0x3b20a3,_0x88a062,_0x3d41b9){return new BPromise(function(_0xc68ef5,_0x1aa11e){return getAuthToken(_0x30db75,_0x3b20a3,_0x3d41b9)[_0x6f9c('0x13')](function(_0x286443){var _0x46cf6e={'method':_0x6f9c('0x19'),'uri':_0x88a062+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x6f9c('0x1a')+_0x286443,'OData-Version':_0x6f9c('0x1b')},'json':!![]};return rp(_0x46cf6e);})[_0x6f9c('0x13')](function(_0x28ee3d){var _0x16c9a4=_0x28ee3d[_0x6f9c('0x1c')];var _0xcae7f7=![];var _0x446e4d=null;if(!_[_0x6f9c('0x1d')](_0xf1ce05)){if(intUtil[_0x6f9c('0x1e')](_0xf1ce05['email'])){_0x2cab50['userEmail']=_0xf1ce05[_0x6f9c('0x1f')];for(_0x446e4d=0x0;_0x446e4d<_0x16c9a4[_0x6f9c('0x20')];_0x446e4d++){if(_0x16c9a4[_0x446e4d][_0x6f9c('0x21')]===_0xf1ce05['email']&&!_0x16c9a4[_0x446e4d][_0x6f9c('0x22')]){_0xcae7f7=!![];logger[_0x6f9c('0x23')]('['+[_0x3d41b9[_0x6f9c('0x17')]()]+_0x6f9c('0x24')+_0x16c9a4[_0x446e4d][_0x6f9c('0x25')]+'!');_0x2cab50[_0x6f9c('0x26')]=_0x16c9a4[_0x446e4d]['systemuserid'];}}}}if(!_0xcae7f7){logger[_0x6f9c('0x23')]('['+[_0x3d41b9[_0x6f9c('0x17')]()]+_0x6f9c('0x27'));_0x2cab50[_0x6f9c('0x28')]=_0x30db75[_0x6f9c('0x10')];for(_0x446e4d=0x0;_0x446e4d<_0x16c9a4[_0x6f9c('0x20')];_0x446e4d++){if(_0x16c9a4[_0x446e4d][_0x6f9c('0x21')]===_0x30db75[_0x6f9c('0x10')]){_0x2cab50[_0x6f9c('0x26')]=_0x16c9a4[_0x446e4d][_0x6f9c('0x25')];}}}_0xc68ef5(_0x2cab50);})[_0x6f9c('0x15')](function(_0x2d4ebf){_0x1aa11e(_0x2d4ebf[_0x6f9c('0x29')]);});});}function createEndUser(_0x16cc2c,_0x3b6609,_0x4653dc,_0x348397,_0x5b2d01,_0x421c7c){return new BPromise(function(_0x21ccba,_0x457573){return getAuthToken(_0x3b6609,_0x4653dc,_0x421c7c)[_0x6f9c('0x13')](function(_0x199db1){var _0x150e9b=_0x421c7c[_0x6f9c('0x2a')]()===_0x6f9c('0x2b')?_0x5b2d01['destcalleridnum']:_0x5b2d01[_0x6f9c('0x2c')];var _0x50eab8={'method':_0x6f9c('0xd'),'uri':_0x348397+_0x6f9c('0x2d'),'body':{'telephone1':_0x150e9b,'fullname':_0x150e9b,'firstname':_0x150e9b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6f9c('0x2e')+_0x16cc2c[_0x6f9c('0x26')]+')'},'headers':{'Authorization':_0x6f9c('0x1a')+_0x199db1,'OData-Version':_0x6f9c('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x50eab8);})[_0x6f9c('0x13')](function(_0x7fbe3c){var _0x3036cb=_0x7fbe3c[_0x6f9c('0x2f')][_0x6f9c('0x30')];var _0x5659f5=_0x3036cb[_0x6f9c('0x31')](_0x3036cb['lastIndexOf']('(')+0x1,_0x3036cb[_0x6f9c('0x32')](')'));_0x16cc2c[_0x6f9c('0x33')]=_0x5659f5;_0x21ccba(_0x16cc2c);})['catch'](function(_0x352530){_0x457573(_0x352530['message']);});});}function getEndUser(_0xae8e95,_0x1924e6,_0x2c40c2,_0x1b4138,_0x518d54,_0x705d2c){return new BPromise(function(_0x1086f0,_0x501b21){return getAuthToken(_0x1924e6,_0x2c40c2,_0x705d2c)[_0x6f9c('0x13')](function(_0x349559){var _0x2b28f8={'method':_0x6f9c('0x19'),'uri':_0x1b4138+'contacts?$select=telephone1','headers':{'Authorization':_0x6f9c('0x1a')+_0x349559,'If-None-Match':null,'OData-Version':_0x6f9c('0x1b')},'json':!![]};return rp(_0x2b28f8);})[_0x6f9c('0x13')](function(_0x2d3b16){var _0x5e5ca0=null;if(_0x2d3b16){var _0x153306=_0x2d3b16['value'];var _0x297e0c=![];for(_0x5e5ca0=0x0;_0x5e5ca0<_0x153306[_0x6f9c('0x20')];_0x5e5ca0++){var _0x242e9a=_0x705d2c['toLowerCase']()===_0x6f9c('0x2b')?_0x518d54[_0x6f9c('0x34')]:_0x518d54['calleridnum'];if(_0x153306[_0x5e5ca0][_0x6f9c('0x35')]===_0x242e9a){_0x297e0c=!![];_0xae8e95[_0x6f9c('0x33')]=_0x153306[_0x5e5ca0][_0x6f9c('0x36')];}}if(_0x297e0c){_0x1086f0(_0xae8e95);}else{return createEndUser(_0xae8e95,_0x1924e6,_0x2c40c2,_0x1b4138,_0x518d54,_0x705d2c)[_0x6f9c('0x13')](function(_0x302ce7){logger[_0x6f9c('0x23')]('['+[_0x705d2c['toUpperCase']()]+_0x6f9c('0x37'),_0x302ce7[_0x6f9c('0x33')]);_0x1086f0(_0x302ce7);});}}else{return createEndUser(_0xae8e95,_0x1924e6,_0x2c40c2,_0x1b4138,_0x518d54,_0x705d2c)[_0x6f9c('0x13')](function(_0x198e20){logger[_0x6f9c('0x23')]('['+[_0x705d2c['toUpperCase']()]+']\x20Enduser\x20Created!',_0x198e20[_0x6f9c('0x33')]);_0x1086f0(_0x198e20);});}});});}function getCustomFields(_0x38f151,_0x4a56a2,_0x2abd95){var _0x1184d={};if(_0x38f151[_0x6f9c('0x20')]>0x0){_[_0x6f9c('0x38')](_0x38f151,function(_0x5cb40){if(_0x5cb40[_0x6f9c('0x39')]===_0x6f9c('0x3a')&&_0x5cb40[_0x6f9c('0x3b')]&&!_0x5cb40[_0x6f9c('0x3c')]){var _0x2d2ec6=_0x5cb40[_0x6f9c('0x3d')]['toLowerCase']();var _0x382afc=_0x2d2ec6['substring'](0x0,_0x2d2ec6[_0x6f9c('0x3e')]('_'));var _0x332076=_0x2d2ec6[_0x6f9c('0x31')](_0x2d2ec6['indexOf']('_')+0x1);if(_0x382afc===_0x2abd95){_0x1184d[_0x332076]=_0x5cb40[_0x6f9c('0x3f')];}}});}return _0x1184d;}function getTicket(_0x319026,_0x493e2c,_0x4533cf,_0xa40ea3,_0x589486,_0xdca517,_0x2de6c0){return new BPromise(function(_0xc8ab95,_0x7d9ec7){var _0xec5842;return getAuthToken(_0x493e2c,_0x4533cf,_0x2de6c0)[_0x6f9c('0x13')](function(_0x4b834e){if(_0xdca517[_0x6f9c('0x40')]===_0x6f9c('0x41')){_0xec5842={'method':_0x6f9c('0xd'),'uri':_0xa40ea3+'incidents','body':Object[_0x6f9c('0x42')]({},{'title':intUtil[_0x6f9c('0x43')](_0xdca517[_0x6f9c('0x44')],_0x589486,'\x20'),'description':intUtil[_0x6f9c('0x43')](_0xdca517[_0x6f9c('0x45')],_0x589486,'\x0a'),'customerid_contact@odata.bind':_0x6f9c('0x46')+_0x319026[_0x6f9c('0x33')]+')','ownerid@odata.bind':_0x6f9c('0x2e')+_0x319026[_0x6f9c('0x26')]+')','caseorigincode':'1'},getCustomFields(_0xdca517[_0x6f9c('0x47')],_0x589486,_0xdca517[_0x6f9c('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x4b834e,'OData-Version':_0x6f9c('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xdca517['ticketType']==='phonecall'){_0xec5842={'method':_0x6f9c('0xd'),'uri':_0xa40ea3+_0x6f9c('0x48'),'body':Object[_0x6f9c('0x42')]({},{'subject':intUtil['getString'](_0xdca517[_0x6f9c('0x44')],_0x589486,'\x20'),'phonenumber':String(_0x589486[_0x6f9c('0x2c')]),'description':intUtil[_0x6f9c('0x43')](_0xdca517[_0x6f9c('0x45')],_0x589486,'\x0a'),'regardingobjectid_contact@odata.bind':_0x6f9c('0x46')+_0x319026['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x319026['userId']+')','directioncode':_0x319026[_0x6f9c('0x49')]===_0x6f9c('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x6f9c('0x2e')+_0x319026[_0x6f9c('0x26')]+')','participationtypemask':_0x319026[_0x6f9c('0x49')]===_0x6f9c('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0x6f9c('0x46')+_0x319026['enduserId']+')','participationtypemask':_0x319026[_0x6f9c('0x49')]===_0x6f9c('0x4a')?0x1:0x2}]},getCustomFields(_0xdca517[_0x6f9c('0x47')],_0x589486,_0xdca517['ticketType'])),'headers':{'Authorization':_0x6f9c('0x1a')+_0x4b834e,'OData-Version':_0x6f9c('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xec5842);})['then'](function(_0x320bba){var _0x40200a=_0x320bba[_0x6f9c('0x2f')][_0x6f9c('0x30')];var _0x4622e4=_0x40200a[_0x6f9c('0x31')](_0x40200a[_0x6f9c('0x32')]('(')+0x1,_0x40200a[_0x6f9c('0x32')](')'));_0x319026[_0x6f9c('0x4b')]=_0x4622e4;_0xc8ab95(_0x319026);})[_0x6f9c('0x15')](function(_0x1147d7){_0x7d9ec7(_0x1147d7[_0x6f9c('0x29')]);});});}function emit(_0x19a8b4,_0x36d219,_0x48f946,_0x1c5efb){var _0x4e36a9={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x19a8b4,_0x48f946,_0x1c5efb)};io['to'](util['format'](_0x6f9c('0x4c'),_0x36d219))[_0x6f9c('0x4d')](_0x6f9c('0x4e'),_0x4e36a9);}exports['cs']=function(_0x26536e,_0x5a99e0,_0x46793b,_0x50e3db,_0x4b4514,_0x3c63f0,_0x453d21,_0x2e5e32){var _0x4f8a8e={};_0x3c63f0[_0x6f9c('0xf')]=intUtil[_0x6f9c('0x4f')](_0x3c63f0[_0x6f9c('0xf')]);_0x3c63f0[_0x6f9c('0x50')]=intUtil[_0x6f9c('0x4f')](_0x3c63f0['serverUrl']);_0x4f8a8e[_0x6f9c('0x49')]=_0x2e5e32==='queue'||_0x2e5e32===_0x6f9c('0x51')?'queue':_0x6f9c('0x2b');var _0x30771f=util['format']('%s/api/data/v9.0/',_0x3c63f0[_0x6f9c('0xf')]);var _0x588b26=util['format'](_0x6f9c('0x52'),_0x3c63f0[_0x6f9c('0x53')]);var _0x550f00=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c63f0[_0x6f9c('0x50')],_0x5a99e0[_0x6f9c('0x54')],md5(_0x5a99e0[_0x6f9c('0x54')]));if(_0x4b4514&&_0x4b4514['monitor_format']){logger[_0x6f9c('0x23')](_0x6f9c('0x55'),_0x6f9c('0x56'));_0x5a99e0[_0x6f9c('0x57')]=_0x550f00;}else if(_0x453d21&&_0x453d21['recordingFormat']&&_0x453d21[_0x6f9c('0x58')]!==_0x6f9c('0x59')){logger['info'](_0x6f9c('0x5a'),_0x6f9c('0x56'));_0x5a99e0[_0x6f9c('0x57')]=_0x550f00;}else{_0x5a99e0[_0x6f9c('0x57')]='';}return getUser(_0x4f8a8e,_0x3c63f0,_0x50e3db,_0x588b26,_0x30771f,_0x2e5e32)['then'](function(_0x22ee7a){logger[_0x6f9c('0x23')]('['+_0x2e5e32[_0x6f9c('0x17')]()+_0x6f9c('0x5b'),_0x22ee7a[_0x6f9c('0x26')]);logger[_0x6f9c('0x23')]('['+_0x2e5e32[_0x6f9c('0x17')]()+_0x6f9c('0x5c'),_0x22ee7a['userEmail']);return getEndUser(_0x22ee7a,_0x3c63f0,_0x588b26,_0x30771f,_0x5a99e0,_0x2e5e32);})[_0x6f9c('0x13')](function(_0x2457bf){logger['info']('['+_0x2e5e32['toUpperCase']()+_0x6f9c('0x5d'),_0x2457bf[_0x6f9c('0x33')]);logger[_0x6f9c('0x23')]('['+_0x2e5e32[_0x6f9c('0x17')]()+_0x6f9c('0x5e'),_0x5a99e0[_0x6f9c('0x2c')]);return getTicket(_0x2457bf,_0x3c63f0,_0x588b26,_0x30771f,_0x5a99e0,_0x46793b,_0x2e5e32);})['then'](function(_0x5b3a78){logger[_0x6f9c('0x23')](util['format']('['+_0x2e5e32[_0x6f9c('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x46793b[_0x6f9c('0x40')],_0x5b3a78['ticketId']));logger['info'](util[_0x6f9c('0x5f')]('['+_0x2e5e32['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x2e5e32));if(_0x2e5e32!==_0x6f9c('0x51')){logger[_0x6f9c('0x23')]('['+_0x2e5e32['toUpperCase']()+']',_0x6f9c('0x60'));emit(_0x3c63f0[_0x6f9c('0xf')],_0x50e3db[_0x6f9c('0x61')],_0x46793b[_0x6f9c('0x40')],_0x5b3a78[_0x6f9c('0x4b')]);}})[_0x6f9c('0x15')](function(_0x55d7c0){logger[_0x6f9c('0x16')]('['+_0x2e5e32[_0x6f9c('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x55d7c0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x673a=['getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','queue','/systemusers(','callDirection','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','destcalleridnum','contacts','4.0','headers','substring','lastIndexOf','enduserId','outbound','calleridnum','telephone1',']\x20Enduser\x20created!','forEach','type','nameField','customField','indexOf','content','ticketType','assign'];(function(_0x20cb54,_0x118325){var _0x8f64df=function(_0x200535){while(--_0x200535){_0x20cb54['push'](_0x20cb54['shift']());}};_0x8f64df(++_0x118325);}(_0x673a,0x133));var _0xa673=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0x673a[_0x3d78d7];return _0x4b6784;};'use strict';var _=require('lodash');var BPromise=require(_0xa673('0x0'));var rp=require('request-promise');var util=require(_0xa673('0x1'));var intUtil=require('./util');var md5=require(_0xa673('0x2'));var Redis=require(_0xa673('0x3'));var logger=require(_0xa673('0x4'))(_0xa673('0x5'));var config=require(_0xa673('0x6'));config[_0xa673('0x7')]=_[_0xa673('0x8')](config[_0xa673('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa673('0x9'))(new Redis(config['redis']));function getAuthToken(_0x225b70,_0xb2b1dc,_0x4e78f9){var _0x22cd12={'method':_0xa673('0xa'),'uri':_0xb2b1dc,'form':{'client_id':_0x225b70[_0xa673('0xb')],'resource':_0x225b70['remoteUri'],'username':_0x225b70[_0xa673('0xc')],'password':_0x225b70[_0xa673('0xd')],'grant_type':_0xa673('0xd'),'client_secret':_0x225b70[_0xa673('0xe')]},'json':!![]};return rp(_0x22cd12)[_0xa673('0xf')](function(_0x39746d){return _0x39746d[_0xa673('0x10')];})[_0xa673('0x11')](function(_0x1b1ad0){logger[_0xa673('0x12')]('['+[_0x4e78f9['toUpperCase']()]+_0xa673('0x13'));return _0x1b1ad0[_0xa673('0x14')];});}function getUser(_0x3e79c8,_0x1642d1,_0x2548ef,_0x51a8e4,_0x26157e,_0x566a13){return new BPromise(function(_0x2e38df,_0x5ef65e){return getAuthToken(_0x1642d1,_0x51a8e4,_0x566a13)['then'](function(_0x5c2529){var _0xba0958={'method':_0xa673('0x15'),'uri':_0x26157e+_0xa673('0x16'),'headers':{'Authorization':_0xa673('0x17')+_0x5c2529,'OData-Version':'4.0'},'json':!![]};return rp(_0xba0958);})[_0xa673('0xf')](function(_0x403f38){var _0x61f8b1=_0x403f38[_0xa673('0x18')];var _0x431982=![];var _0x4ef3a6=null;if(!_[_0xa673('0x19')](_0x2548ef)){if(intUtil[_0xa673('0x1a')](_0x2548ef[_0xa673('0x1b')])){_0x3e79c8[_0xa673('0x1c')]=_0x2548ef[_0xa673('0x1b')];for(_0x4ef3a6=0x0;_0x4ef3a6<_0x61f8b1['length'];_0x4ef3a6++){if(_0x61f8b1[_0x4ef3a6][_0xa673('0x1d')]===_0x2548ef[_0xa673('0x1b')]&&!_0x61f8b1[_0x4ef3a6]['isdisabled']){_0x431982=!![];logger[_0xa673('0x1e')]('['+[_0x566a13['toUpperCase']()]+_0xa673('0x1f')+_0x61f8b1[_0x4ef3a6][_0xa673('0x20')]+'!');_0x3e79c8[_0xa673('0x21')]=_0x61f8b1[_0x4ef3a6][_0xa673('0x20')];}}}}if(!_0x431982){logger['info']('['+[_0x566a13[_0xa673('0x22')]()]+_0xa673('0x23'));_0x3e79c8[_0xa673('0x1c')]=_0x1642d1['username'];for(_0x4ef3a6=0x0;_0x4ef3a6<_0x61f8b1[_0xa673('0x24')];_0x4ef3a6++){if(_0x61f8b1[_0x4ef3a6][_0xa673('0x1d')]===_0x1642d1[_0xa673('0xc')]){_0x3e79c8[_0xa673('0x21')]=_0x61f8b1[_0x4ef3a6][_0xa673('0x20')];}}}_0x2e38df(_0x3e79c8);})[_0xa673('0x11')](function(_0x30fa81){_0x5ef65e(_0x30fa81[_0xa673('0x14')]);});});}function createEndUser(_0x15db61,_0x557662,_0x3da6fd,_0x2fb52e,_0x176efb,_0x208af2){return new BPromise(function(_0x572c4a,_0x402286){return getAuthToken(_0x557662,_0x3da6fd,_0x208af2)['then'](function(_0x4d5005){var _0x3bb7ab=_0x208af2[_0xa673('0x25')]()==='outbound'?_0x176efb[_0xa673('0x26')]:_0x176efb['calleridnum'];var _0x38a12e={'method':_0xa673('0xa'),'uri':_0x2fb52e+_0xa673('0x27'),'body':{'telephone1':_0x3bb7ab,'fullname':_0x3bb7ab,'firstname':_0x3bb7ab,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x15db61[_0xa673('0x21')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4d5005,'OData-Version':_0xa673('0x28')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x38a12e);})[_0xa673('0xf')](function(_0x1d872c){var _0x27ce72=_0x1d872c[_0xa673('0x29')]['odata-entityid'];var _0x15914c=_0x27ce72[_0xa673('0x2a')](_0x27ce72[_0xa673('0x2b')]('(')+0x1,_0x27ce72[_0xa673('0x2b')](')'));_0x15db61[_0xa673('0x2c')]=_0x15914c;_0x572c4a(_0x15db61);})[_0xa673('0x11')](function(_0x12699d){_0x402286(_0x12699d[_0xa673('0x14')]);});});}function getEndUser(_0x3ae30b,_0x30a2e4,_0x3469e9,_0x259dc2,_0x52f6be,_0x53a41b){return new BPromise(function(_0x252b09,_0x434958){return getAuthToken(_0x30a2e4,_0x3469e9,_0x53a41b)[_0xa673('0xf')](function(_0x57bfd7){var _0x4fa3af={'method':'GET','uri':_0x259dc2+'contacts?$select=telephone1','headers':{'Authorization':_0xa673('0x17')+_0x57bfd7,'If-None-Match':null,'OData-Version':_0xa673('0x28')},'json':!![]};return rp(_0x4fa3af);})[_0xa673('0xf')](function(_0x4d5843){var _0xe92345=null;if(_0x4d5843){var _0x39656e=_0x4d5843[_0xa673('0x18')];var _0x5d4597=![];for(_0xe92345=0x0;_0xe92345<_0x39656e[_0xa673('0x24')];_0xe92345++){var _0x1b5dd2=_0x53a41b['toLowerCase']()===_0xa673('0x2d')?_0x52f6be[_0xa673('0x26')]:_0x52f6be[_0xa673('0x2e')];if(_0x39656e[_0xe92345][_0xa673('0x2f')]===_0x1b5dd2){_0x5d4597=!![];_0x3ae30b[_0xa673('0x2c')]=_0x39656e[_0xe92345]['contactid'];}}if(_0x5d4597){_0x252b09(_0x3ae30b);}else{return createEndUser(_0x3ae30b,_0x30a2e4,_0x3469e9,_0x259dc2,_0x52f6be,_0x53a41b)[_0xa673('0xf')](function(_0x584022){logger['info']('['+[_0x53a41b[_0xa673('0x22')]()]+_0xa673('0x30'),_0x584022[_0xa673('0x2c')]);_0x252b09(_0x584022);});}}else{return createEndUser(_0x3ae30b,_0x30a2e4,_0x3469e9,_0x259dc2,_0x52f6be,_0x53a41b)['then'](function(_0x5dca9a){logger['info']('['+[_0x53a41b[_0xa673('0x22')]()]+']\x20Enduser\x20Created!',_0x5dca9a['enduserId']);_0x252b09(_0x5dca9a);});}});});}function getCustomFields(_0x3b54a6,_0x465099,_0x38a5ca){var _0x4b1ed7={};if(_0x3b54a6[_0xa673('0x24')]>0x0){_[_0xa673('0x31')](_0x3b54a6,function(_0x24f295){if(_0x24f295[_0xa673('0x32')]==='string'&&_0x24f295[_0xa673('0x33')]&&!_0x24f295[_0xa673('0x34')]){var _0x9769a5=_0x24f295['idField'][_0xa673('0x25')]();var _0x4672b3=_0x9769a5[_0xa673('0x2a')](0x0,_0x9769a5[_0xa673('0x35')]('_'));var _0x129068=_0x9769a5['substring'](_0x9769a5[_0xa673('0x35')]('_')+0x1);if(_0x4672b3===_0x38a5ca){_0x4b1ed7[_0x129068]=_0x24f295[_0xa673('0x36')];}}});}return _0x4b1ed7;}function getTicket(_0x2fc677,_0x7e9387,_0x5ea9c9,_0x58da8a,_0x574f54,_0x19a808,_0x4769f4){return new BPromise(function(_0x1221b3,_0x38284f){var _0x841b82;return getAuthToken(_0x7e9387,_0x5ea9c9,_0x4769f4)[_0xa673('0xf')](function(_0x39019e){if(_0x19a808[_0xa673('0x37')]==='incident'){_0x841b82={'method':'POST','uri':_0x58da8a+'incidents','body':Object[_0xa673('0x38')]({},{'title':intUtil[_0xa673('0x39')](_0x19a808[_0xa673('0x3a')],_0x574f54,'\x20'),'description':intUtil[_0xa673('0x39')](_0x19a808[_0xa673('0x3b')],_0x574f54,'\x0a'),'customerid_contact@odata.bind':_0xa673('0x3c')+_0x2fc677[_0xa673('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x2fc677['userId']+')','caseorigincode':'1'},getCustomFields(_0x19a808[_0xa673('0x3d')],_0x574f54,_0x19a808[_0xa673('0x37')])),'headers':{'Authorization':_0xa673('0x17')+_0x39019e,'OData-Version':_0xa673('0x28')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x19a808['ticketType']==='phonecall'){_0x841b82={'method':_0xa673('0xa'),'uri':_0x58da8a+_0xa673('0x3e'),'body':Object[_0xa673('0x38')]({},{'subject':intUtil[_0xa673('0x39')](_0x19a808['Subjects'],_0x574f54,'\x20'),'phonenumber':String(_0x574f54['calleridnum']),'description':intUtil[_0xa673('0x39')](_0x19a808[_0xa673('0x3b')],_0x574f54,'\x0a'),'regardingobjectid_contact@odata.bind':_0xa673('0x3c')+_0x2fc677['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x2fc677[_0xa673('0x21')]+')','directioncode':_0x2fc677['callDirection']===_0xa673('0x3f')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xa673('0x40')+_0x2fc677['userId']+')','participationtypemask':_0x2fc677[_0xa673('0x41')]===_0xa673('0x3f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x2fc677[_0xa673('0x2c')]+')','participationtypemask':_0x2fc677[_0xa673('0x41')]==='queue'?0x1:0x2}]},getCustomFields(_0x19a808['Fields'],_0x574f54,_0x19a808[_0xa673('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x39019e,'OData-Version':_0xa673('0x28')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x841b82);})[_0xa673('0xf')](function(_0x401059){var _0x6ee697=_0x401059[_0xa673('0x29')][_0xa673('0x42')];var _0x4ea6eb=_0x6ee697[_0xa673('0x2a')](_0x6ee697[_0xa673('0x2b')]('(')+0x1,_0x6ee697[_0xa673('0x2b')](')'));_0x2fc677[_0xa673('0x43')]=_0x4ea6eb;_0x1221b3(_0x2fc677);})[_0xa673('0x11')](function(_0x5b9136){_0x38284f(_0x5b9136[_0xa673('0x14')]);});});}function emit(_0x2ad389,_0xaf7223,_0x4d8319,_0x345c25){var _0xffc873={'uri':util['format'](_0xa673('0x44'),_0x2ad389,_0x4d8319,_0x345c25)};io['to'](util['format']('user:%s',_0xaf7223))['emit'](_0xa673('0x45'),_0xffc873);}exports['cs']=function(_0x50ea53,_0x3468d7,_0x4fae10,_0x314d1d,_0x3b6948,_0x51ed99,_0x131021,_0x4e2b7c){var _0x438114={};_0x51ed99[_0xa673('0x46')]=intUtil['stripTrailingSlash'](_0x51ed99['remoteUri']);_0x51ed99[_0xa673('0x47')]=intUtil[_0xa673('0x48')](_0x51ed99[_0xa673('0x47')]);_0x438114[_0xa673('0x41')]=_0x4e2b7c===_0xa673('0x3f')||_0x4e2b7c==='unmanaged'?_0xa673('0x3f'):_0xa673('0x2d');var _0x2eb37e=util[_0xa673('0x49')](_0xa673('0x4a'),_0x51ed99[_0xa673('0x46')]);var _0x18e714=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x51ed99[_0xa673('0x4b')]);var _0x25cf08=util[_0xa673('0x49')](_0xa673('0x4c'),_0x51ed99[_0xa673('0x47')],_0x3468d7[_0xa673('0x4d')],md5(_0x3468d7[_0xa673('0x4d')]));if(_0x3b6948&&_0x3b6948['monitor_format']){logger[_0xa673('0x1e')](_0xa673('0x4e'),_0xa673('0x4f'));_0x3468d7[_0xa673('0x50')]=_0x25cf08;}else if(_0x131021&&_0x131021[_0xa673('0x51')]&&_0x131021[_0xa673('0x51')]!=='none'){logger['info'](_0xa673('0x52'),'Recording\x20is\x20enabled!');_0x3468d7[_0xa673('0x50')]=_0x25cf08;}else{_0x3468d7[_0xa673('0x50')]='';}return getUser(_0x438114,_0x51ed99,_0x314d1d,_0x18e714,_0x2eb37e,_0x4e2b7c)[_0xa673('0xf')](function(_0x4cbbea){logger[_0xa673('0x1e')]('['+_0x4e2b7c[_0xa673('0x22')]()+']\x20The\x20User\x20ID\x20is:',_0x4cbbea['userId']);logger[_0xa673('0x1e')]('['+_0x4e2b7c[_0xa673('0x22')]()+']\x20The\x20User\x20email\x20is:',_0x4cbbea[_0xa673('0x1c')]);return getEndUser(_0x4cbbea,_0x51ed99,_0x18e714,_0x2eb37e,_0x3468d7,_0x4e2b7c);})[_0xa673('0xf')](function(_0x1f065){logger[_0xa673('0x1e')]('['+_0x4e2b7c[_0xa673('0x22')]()+_0xa673('0x53'),_0x1f065[_0xa673('0x2c')]);logger[_0xa673('0x1e')]('['+_0x4e2b7c[_0xa673('0x22')]()+_0xa673('0x54'),_0x3468d7[_0xa673('0x2e')]);return getTicket(_0x1f065,_0x51ed99,_0x18e714,_0x2eb37e,_0x3468d7,_0x4fae10,_0x4e2b7c);})[_0xa673('0xf')](function(_0x1d0d0c){logger[_0xa673('0x1e')](util['format']('['+_0x4e2b7c[_0xa673('0x22')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4fae10['ticketType'],_0x1d0d0c[_0xa673('0x43')]));logger[_0xa673('0x1e')](util['format']('['+_0x4e2b7c[_0xa673('0x22')]()+_0xa673('0x55'),_0x4e2b7c));if(_0x4e2b7c!==_0xa673('0x56')){logger[_0xa673('0x1e')]('['+_0x4e2b7c['toUpperCase']()+']',_0xa673('0x57'));emit(_0x51ed99[_0xa673('0x46')],_0x314d1d[_0xa673('0x58')],_0x4fae10[_0xa673('0x37')],_0x1d0d0c[_0xa673('0x43')]);}})[_0xa673('0x11')](function(_0x478ac4){logger['error']('['+_0x4e2b7c[_0xa673('0x22')]()+_0xa673('0x59'),util[_0xa673('0x5a')](_0x478ac4,{'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 7333b12..78d8072 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 _0x17f1=['value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','type','nameField','customField','toLowerCase','toString','string','push','content','variable','variableName','idField','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','error','[OUTBOUND]','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','Authorization','lodash','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','custom_fields','mapValues'];(function(_0x403744,_0x26dc0e){var _0x4966cf=function(_0x4f2512){while(--_0x4f2512){_0x403744['push'](_0x403744['shift']());}};_0x4966cf(++_0x26dc0e);}(_0x17f1,0x1a6));var _0x117f=function(_0x58acd3,_0x31c811){_0x58acd3=_0x58acd3-0x0;var _0x549f13=_0x17f1[_0x58acd3];return _0x549f13;};'use strict';var _=require(_0x117f('0x0'));var rp=require('request-promise');var md5=require(_0x117f('0x1'));var util=require(_0x117f('0x2'));var Redis=require(_0x117f('0x3'));var intUtil=require(_0x117f('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x117f('0x5'));config[_0x117f('0x6')]=_[_0x117f('0x7')](config[_0x117f('0x6')],{'host':_0x117f('0x8'),'port':0x18eb});var io=require(_0x117f('0x9'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x117f('0xa')};function emit(_0x21e163,_0x2fe730,_0x5d677d){io['to'](_0x21e163)['emit'](_0x2fe730,_0x5d677d);}function getTicket(_0x5acc8c,_0x4e7178,_0x456761,_0x985e55,_0x55db8c){logger[_0x117f('0xb')](_0x117f('0xc'));var _0x235163=_[_0x117f('0xd')]({'responder_id':_0x4e7178['id'],'requester_id':_0x456761['id'],'name':util['format'](_0x117f('0xe'),_0x55db8c[_0x117f('0xf')]),'phone':_0x55db8c[_0x117f('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x117f('0x11')](_0x985e55['Subjects'],_0x55db8c,'\x20'),'description':intUtil['getString'](_0x985e55[_0x117f('0x12')],_0x55db8c,_0x117f('0x13')),'tags':getTags(_0x985e55['Tags'],_0x117f('0x14'))},getCustomFields(_0x985e55['Fields'],_0x55db8c));_0x235163[_0x117f('0x15')]=_[_0x117f('0x16')](_['keyBy'](_0x235163['custom_fields'],'id'),_0x117f('0x17'));return request({'uri':util[_0x117f('0x18')](_0x117f('0x19'),_0x5acc8c[_0x117f('0x1a')]),'method':'POST','body':_0x235163})[_0x117f('0x1b')](function(_0x31c15e){logger[_0x117f('0xb')](_0x117f('0x1c'));return _0x31c15e;});}function getUser(_0x301db6,_0x1d8a4b){if(intUtil[_0x117f('0x1d')](_0x1d8a4b)){return request({'uri':util[_0x117f('0x18')](_0x117f('0x1e'),_0x301db6[_0x117f('0x1a')]),'qs':{'email':_0x1d8a4b}})[_0x117f('0x1b')](function(_0x8fba21){if(_0x8fba21['length']){logger[_0x117f('0xb')](_0x117f('0x1f'));return _[_0x117f('0x20')](_0x8fba21,function(_0x22e558){return _0x22e558[_0x117f('0x21')]['email']===_0x1d8a4b;});}else{logger['info'](_0x117f('0x22'));return request({'uri':util[_0x117f('0x18')]('%s/api/v2/agents/me',_0x301db6['remoteUri'])})[_0x117f('0x1b')](function(_0x41b74e){logger[_0x117f('0xb')]('Admin\x20account\x20selected.');return _0x41b74e;});}});}else{logger['info'](_0x117f('0x23'));return request({'uri':util[_0x117f('0x18')]('%s/api/v2/agents/me',_0x301db6[_0x117f('0x1a')])})[_0x117f('0x1b')](function(_0x29183e){logger[_0x117f('0xb')](_0x117f('0x24'));return _0x29183e;});}}function getEndUser(_0x50d465,_0x3e905f,_0x5202df){logger[_0x117f('0xb')](_0x117f('0x25'),_0x5202df);return request({'uri':util['format'](_0x117f('0x26'),_0x50d465['remoteUri']),'qs':{'phone':_0x5202df}})[_0x117f('0x1b')](function(_0x2483cf){if(_0x2483cf[_0x117f('0x27')]){logger[_0x117f('0xb')](_0x117f('0x28'));return _[_0x117f('0x20')](_0x2483cf,{'phone':_0x5202df});}else{logger[_0x117f('0xb')](_0x117f('0x29'));return request({'uri':util[_0x117f('0x18')](_0x117f('0x26'),_0x50d465[_0x117f('0x1a')]),'method':_0x117f('0x2a'),'body':{'name':_0x3e905f,'phone':_0x5202df}})['then'](function(_0x2372c2){logger[_0x117f('0xb')](_0x117f('0x2b'));return _0x2372c2;});}});}function getAuth(_0x442562){return util[_0x117f('0x18')](_0x117f('0x2c'),new Buffer(_0x442562[_0x117f('0x2d')]+':X')['toString'](_0x117f('0x2e')));}function request(_0x3f7b05){logger[_0x117f('0x2f')](_0x117f('0x30'),JSON[_0x117f('0x31')](_0x3f7b05));return rp(_[_0x117f('0x7')](_0x3f7b05,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3c3c43,_0x113007){var _0x5e1bd0=[];if(_0x3c3c43&&_0x3c3c43[_0x117f('0x27')]>0x0){_0x5e1bd0=_['map'](_0x3c3c43,_0x113007);}return _0x5e1bd0;}function getCustomFields(_0x282b5d,_0x416913){var _0x14de7c=[];var _0x307d65={'custom_fields':[]};if(_0x282b5d[_0x117f('0x27')]>0x0){_['forEach'](_0x282b5d,function(_0x24b7dc){if(_0x24b7dc[_0x117f('0x32')]==='string'&&_0x24b7dc[_0x117f('0x33')]&&!_0x24b7dc[_0x117f('0x34')]){_0x307d65[_0x24b7dc[_0x117f('0x33')][_0x117f('0x35')]()]=_0x24b7dc['content'][_0x117f('0x36')]();}else if(_0x24b7dc[_0x117f('0x32')]===_0x117f('0x37')&&_0x24b7dc['idField']&&_0x24b7dc[_0x117f('0x34')]){_0x307d65['custom_fields'][_0x117f('0x38')]({'id':_0x24b7dc['idField'],'value':_0x24b7dc[_0x117f('0x39')][_0x117f('0x36')]()});}else if(_0x24b7dc['type']===_0x117f('0x3a')&&_0x24b7dc[_0x117f('0x3b')]&&_0x24b7dc[_0x117f('0x3c')]&&_0x24b7dc[_0x117f('0x34')]){_0x416913[_0x24b7dc[_0x117f('0x3b')]]&&_0x307d65[_0x117f('0x15')][_0x117f('0x38')]({'id':_0x24b7dc[_0x117f('0x3c')],'value':_0x416913[_0x24b7dc[_0x117f('0x3b')]]['toString']()});}else if(_0x24b7dc[_0x117f('0x32')]==='customVariable'&&_0x24b7dc[_0x117f('0x3d')]&&_0x24b7dc[_0x117f('0x3d')][_0x117f('0x14')]&&_0x24b7dc[_0x117f('0x3c')]&&_0x24b7dc[_0x117f('0x34')]){_0x416913[_0x24b7dc['Variable'][_0x117f('0x14')][_0x117f('0x35')]()]&&_0x307d65[_0x117f('0x15')][_0x117f('0x38')]({'id':_0x24b7dc[_0x117f('0x3c')],'value':_0x416913[_0x24b7dc[_0x117f('0x3d')]['name'][_0x117f('0x35')]()][_0x117f('0x36')]()});}});}return _0x307d65;}exports[_0x117f('0x3e')]=function(_0x2545d8,_0x930045,_0x59d302,_0x35efa2,_0x2d27bf,_0xda7df3){var _0xb795c8,_0x35d319;_0xda7df3[_0x117f('0x1a')]=intUtil[_0x117f('0x3f')](_0xda7df3[_0x117f('0x1a')]);_0xda7df3['serverUrl']=intUtil[_0x117f('0x3f')](_0xda7df3[_0x117f('0x40')]);if(_0x2d27bf&&_0x2d27bf['monitor_format']){logger[_0x117f('0xb')](_0x117f('0x41'),'Recording\x20is\x20enabled!');_0x930045[_0x117f('0x42')]=util[_0x117f('0x18')](_0x117f('0x43'),_0xda7df3[_0x117f('0x40')],_0x930045['uniqueid'],md5(_0x930045[_0x117f('0x44')]));}else{_0x930045['recordingURL']='';}headers['Authorization']=getAuth(_0xda7df3);return getUser(_0xda7df3,_0x35efa2[_0x117f('0x45')])[_0x117f('0x1b')](function(_0x639b7b){_0xb795c8=_0x639b7b;logger[_0x117f('0xb')]('The\x20User\x20ID\x20is:',_0xb795c8['id']);return getEndUser(_0xda7df3,_0x930045[_0x117f('0xf')],_0x930045[_0x117f('0x10')]);})[_0x117f('0x1b')](function(_0x40295d){_0x35d319=_0x40295d;logger[_0x117f('0xb')](_0x117f('0x46'),_0x35d319['id']);return getTicket(_0xda7df3,_0xb795c8,_0x35d319,_0x59d302,_0x930045);})[_0x117f('0x1b')](function(_0x2ebe57){if(_0x2ebe57&&_0x2ebe57['id']){logger['info'](_0x117f('0x1c'));logger[_0x117f('0xb')](_0x117f('0x47'),_0x2ebe57['id']);logger[_0x117f('0xb')](_0x117f('0x41'),_0x117f('0x48'));emit(util['format'](_0x117f('0x49'),_0x35efa2[_0x117f('0x14')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0xda7df3[_0x117f('0x1a')],_0x2ebe57['id'])});}})[_0x117f('0x4a')](function(_0x17d569){logger['error'](_0x117f('0x41'),JSON[_0x117f('0x31')](_0x17d569));});};exports[_0x117f('0x4b')]=function(_0x56e9b2,_0x1d1016,_0x3f70d0,_0x1ee97c,_0x135cda,_0x265c76,_0x12cded){var _0x19cee3,_0xb6e55b;_0x265c76[_0x117f('0x1a')]=intUtil[_0x117f('0x3f')](_0x265c76[_0x117f('0x1a')]);_0x265c76['serverUrl']=intUtil['stripTrailingSlash'](_0x265c76[_0x117f('0x40')]);if(_0x12cded&&_0x12cded[_0x117f('0x4c')]&&_0x12cded['recordingFormat']!==_0x117f('0x4d')){logger[_0x117f('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1d1016[_0x117f('0x42')]=util[_0x117f('0x18')](_0x117f('0x43'),_0x265c76[_0x117f('0x40')],_0x1d1016[_0x117f('0x44')],md5(_0x1d1016[_0x117f('0x44')]));}headers['Authorization']=getAuth(_0x265c76);return getUser(_0x265c76,_0x1ee97c[_0x117f('0x45')])[_0x117f('0x1b')](function(_0x17ccd5){_0x19cee3=_0x17ccd5;logger['info'](_0x117f('0x4e'),_0x19cee3['id']);return getEndUser(_0x265c76,_0x1d1016[_0x117f('0x4f')],_0x1d1016[_0x117f('0x50')]);})[_0x117f('0x1b')](function(_0x408c4e){_0xb6e55b=_0x408c4e;logger[_0x117f('0xb')](_0x117f('0x46'),_0xb6e55b['id']);return getTicket(_0x265c76,_0x19cee3,_0xb6e55b,_0x3f70d0,_0x1d1016);})[_0x117f('0x1b')](function(_0x1af254){if(_0x1af254&&_0x1af254['id']){logger[_0x117f('0xb')](_0x117f('0x1c'));logger[_0x117f('0xb')](_0x117f('0x47'),_0x1af254['id']);logger[_0x117f('0xb')]('[OUTBOUND]',_0x117f('0x48'));emit(util['format'](_0x117f('0x49'),_0x1ee97c[_0x117f('0x14')]),'trigger:browser:url',{'uri':util[_0x117f('0x18')](_0x117f('0x51'),_0x265c76[_0x117f('0x1a')],_0x1af254['id'])});}})['catch'](function(_0xfc3b05){logger[_0x117f('0x52')](_0x117f('0x53'),JSON[_0x117f('0x31')](_0xfc3b05));});};exports[_0x117f('0x54')]=function(_0x278e78,_0x387a21,_0x5cdb85,_0x1fb585,_0x458fc8,_0xecb23b){var _0x76199a,_0x404f36;_0xecb23b[_0x117f('0x1a')]=intUtil['stripTrailingSlash'](_0xecb23b['remoteUri']);_0xecb23b['serverUrl']=intUtil['stripTrailingSlash'](_0xecb23b[_0x117f('0x40')]);if(_0x458fc8&&_0x458fc8['monitor_format']){logger[_0x117f('0xb')]('['+_0x387a21[_0x117f('0x55')][_0x117f('0x56')]()+']',_0x117f('0x57'));_0x387a21['recordingURL']=util[_0x117f('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xecb23b['serverUrl'],_0x387a21[_0x117f('0x44')],md5(_0x387a21[_0x117f('0x44')]));}else{_0x387a21[_0x117f('0x42')]='';}headers[_0x117f('0x58')]=getAuth(_0xecb23b);return getUser(_0xecb23b,'')[_0x117f('0x1b')](function(_0x3b7819){_0x76199a=_0x3b7819;logger[_0x117f('0xb')](_0x117f('0x4e'),_0x76199a['id']);return getEndUser(_0xecb23b,_0x387a21[_0x117f('0xf')],_0x387a21[_0x117f('0x10')]);})[_0x117f('0x1b')](function(_0x4ad6d4){_0x404f36=_0x4ad6d4;logger[_0x117f('0xb')](_0x117f('0x46'),_0x404f36['id']);return getTicket(_0xecb23b,_0x76199a,_0x404f36,_0x5cdb85,_0x387a21);})[_0x117f('0x1b')](function(_0x371d8c){if(_0x371d8c){logger['info'](_0x117f('0x1c'));logger[_0x117f('0xb')](_0x117f('0x47'),_0x371d8c['id']);}})[_0x117f('0x4a')](function(_0xb0774a){logger[_0x117f('0x52')]('['+_0x387a21[_0x117f('0x55')][_0x117f('0x56')]()+']',JSON[_0x117f('0x31')](_0xb0774a));});}; \ No newline at end of file +var _0xa438=['error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','localhost','socket.io-emitter','redis','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','name','Fields','custom_fields','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','nameField','toLowerCase','toString','customField','push','idField','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xa438,0x122));var _0x8a43=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa438[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x8a43('0x0'));var util=require(_0x8a43('0x1'));var Redis=require(_0x8a43('0x2'));var intUtil=require(_0x8a43('0x3'));var config=require(_0x8a43('0x4'));var logger=require(_0x8a43('0x5'))(_0x8a43('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x8a43('0x7'),'port':0x18eb});var io=require(_0x8a43('0x8'))(new Redis(config[_0x8a43('0x9')]));var headers={'Content-Type':_0x8a43('0xa'),'Accept':_0x8a43('0xa')};function emit(_0x17d5ee,_0xcca54b,_0x27979c){io['to'](_0x17d5ee)['emit'](_0xcca54b,_0x27979c);}function getTicket(_0x32d09c,_0x5e0430,_0x43d6d2,_0x19442e,_0x4d5142){logger[_0x8a43('0xb')](_0x8a43('0xc'));var _0x245657=_[_0x8a43('0xd')]({'responder_id':_0x5e0430['id'],'requester_id':_0x43d6d2['id'],'name':util['format'](_0x8a43('0xe'),_0x4d5142[_0x8a43('0xf')]),'phone':_0x4d5142[_0x8a43('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x19442e['Subjects'],_0x4d5142,'\x20'),'description':intUtil[_0x8a43('0x11')](_0x19442e['Descriptions'],_0x4d5142,_0x8a43('0x12')),'tags':getTags(_0x19442e[_0x8a43('0x13')],_0x8a43('0x14'))},getCustomFields(_0x19442e[_0x8a43('0x15')],_0x4d5142));_0x245657[_0x8a43('0x16')]=_['mapValues'](_['keyBy'](_0x245657[_0x8a43('0x16')],'id'),_0x8a43('0x17'));return request({'uri':util[_0x8a43('0x18')](_0x8a43('0x19'),_0x32d09c[_0x8a43('0x1a')]),'method':'POST','body':_0x245657})[_0x8a43('0x1b')](function(_0x19a72b){logger[_0x8a43('0xb')](_0x8a43('0x1c'));return _0x19a72b;});}function getUser(_0x2b496a,_0x2547f8){if(intUtil['validateEmail'](_0x2547f8)){return request({'uri':util[_0x8a43('0x18')](_0x8a43('0x1d'),_0x2b496a[_0x8a43('0x1a')]),'qs':{'email':_0x2547f8}})[_0x8a43('0x1b')](function(_0x46795a){if(_0x46795a[_0x8a43('0x1e')]){logger[_0x8a43('0xb')](_0x8a43('0x1f'));return _[_0x8a43('0x20')](_0x46795a,function(_0x21ca03){return _0x21ca03[_0x8a43('0x21')][_0x8a43('0x22')]===_0x2547f8;});}else{logger['info'](_0x8a43('0x23'));return request({'uri':util[_0x8a43('0x18')](_0x8a43('0x24'),_0x2b496a['remoteUri'])})[_0x8a43('0x1b')](function(_0x294dc1){logger[_0x8a43('0xb')](_0x8a43('0x25'));return _0x294dc1;});}});}else{logger[_0x8a43('0xb')](_0x8a43('0x26'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2b496a['remoteUri'])})[_0x8a43('0x1b')](function(_0x143c1){logger['info'](_0x8a43('0x25'));return _0x143c1;});}}function getEndUser(_0x4df610,_0x4ce7d6,_0x1fac16){logger['info'](_0x8a43('0x27'),_0x1fac16);return request({'uri':util[_0x8a43('0x18')]('%s/api/v2/contacts',_0x4df610['remoteUri']),'qs':{'phone':_0x1fac16}})[_0x8a43('0x1b')](function(_0x54ab46){if(_0x54ab46[_0x8a43('0x1e')]){logger[_0x8a43('0xb')]('Enduser\x20found!');return _[_0x8a43('0x20')](_0x54ab46,{'phone':_0x1fac16});}else{logger[_0x8a43('0xb')](_0x8a43('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x4df610[_0x8a43('0x1a')]),'method':_0x8a43('0x29'),'body':{'name':_0x4ce7d6,'phone':_0x1fac16}})[_0x8a43('0x1b')](function(_0x95b7e4){logger[_0x8a43('0xb')](_0x8a43('0x2a'));return _0x95b7e4;});}});}function getAuth(_0x2273ef){return util[_0x8a43('0x18')](_0x8a43('0x2b'),new Buffer(_0x2273ef[_0x8a43('0x2c')]+':X')['toString'](_0x8a43('0x2d')));}function request(_0x448902){logger[_0x8a43('0x2e')](_0x8a43('0x2f'),JSON[_0x8a43('0x30')](_0x448902));return rp(_[_0x8a43('0x31')](_0x448902,{'method':_0x8a43('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x167b45,_0x470068){var _0x18ee44=[];if(_0x167b45&&_0x167b45[_0x8a43('0x1e')]>0x0){_0x18ee44=_[_0x8a43('0x33')](_0x167b45,_0x470068);}return _0x18ee44;}function getCustomFields(_0x32da73,_0x5e6ce3){var _0x101b35=[];var _0x1acd60={'custom_fields':[]};if(_0x32da73[_0x8a43('0x1e')]>0x0){_[_0x8a43('0x34')](_0x32da73,function(_0x310ca2){if(_0x310ca2[_0x8a43('0x35')]==='string'&&_0x310ca2[_0x8a43('0x36')]&&!_0x310ca2['customField']){_0x1acd60[_0x310ca2[_0x8a43('0x36')][_0x8a43('0x37')]()]=_0x310ca2['content'][_0x8a43('0x38')]();}else if(_0x310ca2[_0x8a43('0x35')]==='string'&&_0x310ca2['idField']&&_0x310ca2[_0x8a43('0x39')]){_0x1acd60[_0x8a43('0x16')][_0x8a43('0x3a')]({'id':_0x310ca2[_0x8a43('0x3b')],'value':_0x310ca2[_0x8a43('0x3c')][_0x8a43('0x38')]()});}else if(_0x310ca2[_0x8a43('0x35')]===_0x8a43('0x3d')&&_0x310ca2[_0x8a43('0x3e')]&&_0x310ca2[_0x8a43('0x3b')]&&_0x310ca2[_0x8a43('0x39')]){_0x5e6ce3[_0x310ca2[_0x8a43('0x3e')]]&&_0x1acd60[_0x8a43('0x16')][_0x8a43('0x3a')]({'id':_0x310ca2[_0x8a43('0x3b')],'value':_0x5e6ce3[_0x310ca2[_0x8a43('0x3e')]][_0x8a43('0x38')]()});}else if(_0x310ca2[_0x8a43('0x35')]===_0x8a43('0x3f')&&_0x310ca2[_0x8a43('0x40')]&&_0x310ca2['Variable']['name']&&_0x310ca2[_0x8a43('0x3b')]&&_0x310ca2['customField']){_0x5e6ce3[_0x310ca2[_0x8a43('0x40')]['name'][_0x8a43('0x37')]()]&&_0x1acd60['custom_fields'][_0x8a43('0x3a')]({'id':_0x310ca2[_0x8a43('0x3b')],'value':_0x5e6ce3[_0x310ca2['Variable'][_0x8a43('0x14')][_0x8a43('0x37')]()]['toString']()});}});}return _0x1acd60;}exports[_0x8a43('0x41')]=function(_0x1a1f30,_0x538cb4,_0x12268f,_0x5c68a5,_0x24147e,_0x26a219){var _0xcaaa5f,_0x9bfb77;_0x26a219[_0x8a43('0x1a')]=intUtil[_0x8a43('0x42')](_0x26a219[_0x8a43('0x1a')]);_0x26a219['serverUrl']=intUtil['stripTrailingSlash'](_0x26a219[_0x8a43('0x43')]);if(_0x24147e&&_0x24147e[_0x8a43('0x44')]){logger[_0x8a43('0xb')](_0x8a43('0x45'),_0x8a43('0x46'));_0x538cb4['recordingURL']=util[_0x8a43('0x18')](_0x8a43('0x47'),_0x26a219[_0x8a43('0x43')],_0x538cb4[_0x8a43('0x48')],md5(_0x538cb4[_0x8a43('0x48')]));}else{_0x538cb4[_0x8a43('0x49')]='';}headers[_0x8a43('0x4a')]=getAuth(_0x26a219);return getUser(_0x26a219,_0x5c68a5['email'])[_0x8a43('0x1b')](function(_0xbb71c3){_0xcaaa5f=_0xbb71c3;logger[_0x8a43('0xb')](_0x8a43('0x4b'),_0xcaaa5f['id']);return getEndUser(_0x26a219,_0x538cb4[_0x8a43('0xf')],_0x538cb4['calleridnum']);})[_0x8a43('0x1b')](function(_0x3ab737){_0x9bfb77=_0x3ab737;logger[_0x8a43('0xb')](_0x8a43('0x4c'),_0x9bfb77['id']);return getTicket(_0x26a219,_0xcaaa5f,_0x9bfb77,_0x12268f,_0x538cb4);})[_0x8a43('0x1b')](function(_0x3b6850){if(_0x3b6850&&_0x3b6850['id']){logger[_0x8a43('0xb')]('Ticket\x20created!');logger[_0x8a43('0xb')](_0x8a43('0x4d'),_0x3b6850['id']);logger[_0x8a43('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8a43('0x18')](_0x8a43('0x4e'),_0x5c68a5[_0x8a43('0x14')]),_0x8a43('0x4f'),{'uri':util[_0x8a43('0x18')](_0x8a43('0x50'),_0x26a219[_0x8a43('0x1a')],_0x3b6850['id'])});}})[_0x8a43('0x51')](function(_0x2fa19e){logger[_0x8a43('0x52')](_0x8a43('0x45'),JSON[_0x8a43('0x30')](_0x2fa19e));});};exports[_0x8a43('0x53')]=function(_0x93718f,_0x4b45d3,_0x569f44,_0xd9b92d,_0x3612f4,_0x17779a,_0x3ad30b){var _0x38284c,_0x1a719b;_0x17779a[_0x8a43('0x1a')]=intUtil['stripTrailingSlash'](_0x17779a['remoteUri']);_0x17779a[_0x8a43('0x43')]=intUtil[_0x8a43('0x42')](_0x17779a['serverUrl']);if(_0x3ad30b&&_0x3ad30b[_0x8a43('0x54')]&&_0x3ad30b[_0x8a43('0x54')]!==_0x8a43('0x55')){logger['info'](_0x8a43('0x56'),_0x8a43('0x46'));_0x4b45d3[_0x8a43('0x49')]=util[_0x8a43('0x18')](_0x8a43('0x47'),_0x17779a[_0x8a43('0x43')],_0x4b45d3[_0x8a43('0x48')],md5(_0x4b45d3[_0x8a43('0x48')]));}headers[_0x8a43('0x4a')]=getAuth(_0x17779a);return getUser(_0x17779a,_0xd9b92d[_0x8a43('0x22')])[_0x8a43('0x1b')](function(_0x59c53d){_0x38284c=_0x59c53d;logger[_0x8a43('0xb')]('The\x20User\x20ID\x20is:',_0x38284c['id']);return getEndUser(_0x17779a,_0x4b45d3[_0x8a43('0x57')],_0x4b45d3[_0x8a43('0x58')]);})['then'](function(_0x486525){_0x1a719b=_0x486525;logger[_0x8a43('0xb')](_0x8a43('0x4c'),_0x1a719b['id']);return getTicket(_0x17779a,_0x38284c,_0x1a719b,_0x569f44,_0x4b45d3);})[_0x8a43('0x1b')](function(_0x8528e5){if(_0x8528e5&&_0x8528e5['id']){logger[_0x8a43('0xb')](_0x8a43('0x1c'));logger[_0x8a43('0xb')](_0x8a43('0x4d'),_0x8528e5['id']);logger['info'](_0x8a43('0x56'),_0x8a43('0x59'));emit(util[_0x8a43('0x18')]('user:%s',_0xd9b92d[_0x8a43('0x14')]),_0x8a43('0x4f'),{'uri':util[_0x8a43('0x18')](_0x8a43('0x50'),_0x17779a['remoteUri'],_0x8528e5['id'])});}})[_0x8a43('0x51')](function(_0x3fd2f7){logger['error'](_0x8a43('0x56'),JSON[_0x8a43('0x30')](_0x3fd2f7));});};exports[_0x8a43('0x5a')]=function(_0x4fea2a,_0x1ac605,_0x3cc808,_0x5ab0b0,_0x187162,_0x4dd688){var _0x5395fa,_0x95e6aa;_0x4dd688['remoteUri']=intUtil[_0x8a43('0x42')](_0x4dd688[_0x8a43('0x1a')]);_0x4dd688[_0x8a43('0x43')]=intUtil['stripTrailingSlash'](_0x4dd688[_0x8a43('0x43')]);if(_0x187162&&_0x187162[_0x8a43('0x44')]){logger[_0x8a43('0xb')]('['+_0x1ac605[_0x8a43('0x5b')][_0x8a43('0x5c')]()+']',_0x8a43('0x46'));_0x1ac605[_0x8a43('0x49')]=util[_0x8a43('0x18')](_0x8a43('0x47'),_0x4dd688[_0x8a43('0x43')],_0x1ac605[_0x8a43('0x48')],md5(_0x1ac605[_0x8a43('0x48')]));}else{_0x1ac605[_0x8a43('0x49')]='';}headers[_0x8a43('0x4a')]=getAuth(_0x4dd688);return getUser(_0x4dd688,'')[_0x8a43('0x1b')](function(_0x171fac){_0x5395fa=_0x171fac;logger['info'](_0x8a43('0x4b'),_0x5395fa['id']);return getEndUser(_0x4dd688,_0x1ac605['calleridname'],_0x1ac605[_0x8a43('0x10')]);})[_0x8a43('0x1b')](function(_0x3a7cc3){_0x95e6aa=_0x3a7cc3;logger[_0x8a43('0xb')]('The\x20Enduser\x20ID\x20is:',_0x95e6aa['id']);return getTicket(_0x4dd688,_0x5395fa,_0x95e6aa,_0x3cc808,_0x1ac605);})[_0x8a43('0x1b')](function(_0x46067e){if(_0x46067e){logger['info'](_0x8a43('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x46067e['id']);}})[_0x8a43('0x51')](function(_0x22cf74){logger[_0x8a43('0x52')]('['+_0x1ac605[_0x8a43('0x5b')][_0x8a43('0x5c')]()+']',JSON['stringify'](_0x22cf74));});}; \ 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 87c272d..1eda89d 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 _0x8c85=['adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','GET','then','filters','forEach','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','find','contacts','work_number','contactNumber','mobile_number','endUserId','Contact\x20created:','catch','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','toUpperCase','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','calleridnum','unmanaged','queue','outbound','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','email'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0x8c85,0x158));var _0x58c8=function(_0x423231,_0x3927cc){_0x423231=_0x423231-0x0;var _0x15d340=_0x8c85[_0x423231];return _0x15d340;};'use strict';var _=require(_0x58c8('0x0'));var rp=require(_0x58c8('0x1'));var md5=require(_0x58c8('0x2'));var util=require('util');var moment=require(_0x58c8('0x3'));var Promise=require(_0x58c8('0x4'));var Redis=require(_0x58c8('0x5'));var intUtil=require(_0x58c8('0x6'));var config=require(_0x58c8('0x7'));var logger=require(_0x58c8('0x8'))(_0x58c8('0x9'));config[_0x58c8('0xa')]=_[_0x58c8('0xb')](config[_0x58c8('0xa')],{'host':_0x58c8('0xc'),'port':0x18eb});var io=require(_0x58c8('0xd'))(new Redis(config['redis']));function getAdminId(_0x23a3f1,_0x5ac280,_0x133858,_0xdcb58b){return new Promise(function(_0x5c8001,_0xa8c49){var _0x4a5caa=![];var _0x81a69a={'method':'GET','uri':_0xdcb58b+_0x58c8('0xe'),'json':!![]};_0x81a69a[_0x58c8('0xf')]=_0x133858;logger['info'](_0x58c8('0x10'));return rp(_0x81a69a)['then'](function(_0x443b01){if(_0x443b01){var _0x125240=_0x443b01[_0x58c8('0x11')];var _0x119ae3=null;for(_0x119ae3=0x0;_0x119ae3<_0x125240[_0x58c8('0x12')];_0x119ae3++){if(_0x125240[_0x119ae3][_0x58c8('0x13')]===_0x23a3f1[_0x58c8('0x14')]){_0x23a3f1['adminId']=_0x125240[_0x119ae3]['id'];_0x4a5caa=!![];}}if(_0x4a5caa){logger[_0x58c8('0x15')](_0x58c8('0x16'),_0x23a3f1[_0x58c8('0x17')]);_0x5c8001(_0x23a3f1);}else{_0xa8c49({'statusCode':0x194,'message':_0x58c8('0x18')});}}else{_0xa8c49({'statusCode':0x194,'message':_0x58c8('0x18')});}})['catch'](function(_0x5b8682){logger[_0x58c8('0x19')]('['+[_0x5ac280['toUpperCase']()]+']',_0x5b8682[_0x58c8('0x1a')]);_0xa8c49(_0x5b8682);});});}function getUser(_0x7a5a4b,_0x36a588,_0x2da3a0){return function(_0x1fdaa2){return new Promise(function(_0x26ad7f,_0x271c35){var _0x4452f1={'method':'GET','uri':_0x2da3a0+_0x58c8('0xe'),'json':!![]};_0x4452f1[_0x58c8('0xf')]=_0x36a588;logger[_0x58c8('0x15')]('Getting\x20user\x20list');return rp(_0x4452f1)['then'](function(_0x2a329b){if(_0x2a329b){var _0x31124f=_0x2a329b[_0x58c8('0x11')];var _0x31e9b6=![];var _0x106b71=null;if(_0x1fdaa2[_0x58c8('0x1b')]!==null){logger[_0x58c8('0x15')](_0x58c8('0x1c'),_0x1fdaa2['agentEmail']);_0x1fdaa2[_0x58c8('0x1d')]=_0x1fdaa2['agentEmail'];for(_0x106b71=0x0;_0x106b71<_0x31124f[_0x58c8('0x12')];_0x106b71++){if(_0x31124f[_0x106b71][_0x58c8('0x13')]===_0x1fdaa2[_0x58c8('0x1b')]){_0x31e9b6=!![];_0x1fdaa2[_0x58c8('0x1e')]=_0x31124f[_0x106b71]['id'];logger['info'](_0x58c8('0x1f'),_0x1fdaa2[_0x58c8('0x1e')]);}}}if(!_0x31e9b6){logger[_0x58c8('0x15')]('Admin\x20selected');_0x1fdaa2[_0x58c8('0x1d')]=_0x1fdaa2[_0x58c8('0x14')];_0x1fdaa2[_0x58c8('0x1e')]=_0x1fdaa2[_0x58c8('0x17')];_0x31e9b6=!![];}if(_0x31e9b6){_0x26ad7f(_0x1fdaa2);}else{_0x271c35({'statusCode':0x194,'message':_0x58c8('0x18')});}}else{_0x271c35({'statusCode':0x194,'message':_0x58c8('0x18')});}})['catch'](function(_0x19c043){logger[_0x58c8('0x19')]('['+[_0x7a5a4b['toUpperCase']()]+']',_0x19c043[_0x58c8('0x1a')]);_0x271c35(_0x19c043);});});};}function getEndUser(_0x1c146d,_0xab2c72,_0x4c962d){return function(_0x5b7374){return new Promise(function(_0x48b777,_0x27a231){var _0x41e12f=0x0;var _0x53c86a={'method':_0x58c8('0x20'),'uri':_0x4c962d+'/api/contacts/filters','json':!![]};_0x53c86a[_0x58c8('0xf')]=_0xab2c72;logger[_0x58c8('0x15')]('Getting\x20contacts\x20filter');return rp(_0x53c86a)[_0x58c8('0x21')](function(_0x1b5535){_0x1b5535[_0x58c8('0x22')][_0x58c8('0x23')](function(_0x2f5f41){if(_0x2f5f41['name']===_0x58c8('0x24')){_0x41e12f=_0x2f5f41['id'];}});})[_0x58c8('0x21')](function(){logger['info'](_0x58c8('0x25'));var _0x3de9e8={'method':_0x58c8('0x20'),'uri':_0x4c962d+_0x58c8('0x26')+_0x41e12f,'json':!![]};_0x3de9e8[_0x58c8('0xf')]=_0xab2c72;return rp(_0x3de9e8);})['then'](function(_0xeaf85d){logger['info'](_0x58c8('0x27'),_0x5b7374['contactNumber']);if(_0xeaf85d['contacts'][_0x58c8('0x12')]>0x0){var _0x15ee77=_[_0x58c8('0x28')](_0xeaf85d[_0x58c8('0x29')],function(_0xb25242){if(_0xb25242[_0x58c8('0x2a')]===_0x5b7374[_0x58c8('0x2b')]||_0xb25242[_0x58c8('0x2c')]===_0x5b7374[_0x58c8('0x2b')]){return _0xb25242;}});if(_0x15ee77){_0x5b7374[_0x58c8('0x2d')]=_0x15ee77['id'];logger[_0x58c8('0x15')]('Contact\x20found:',_0x5b7374[_0x58c8('0x2d')]);_0x48b777(_0x5b7374);}else{return createEndUser(_0x5b7374,_0x1c146d,_0xab2c72,_0x4c962d)[_0x58c8('0x21')](function(_0x1fa59f){logger[_0x58c8('0x15')]('Contact\x20created:',_0x5b7374['endUserId']);_0x48b777(_0x1fa59f);});}}else{return createEndUser(_0x5b7374,_0x1c146d,_0xab2c72,_0x4c962d)[_0x58c8('0x21')](function(_0x4dc19f){logger[_0x58c8('0x15')](_0x58c8('0x2e'),_0x5b7374[_0x58c8('0x2d')]);_0x48b777(_0x4dc19f);});}})[_0x58c8('0x2f')](function(_0x1930c9){throw new Error(_0x1930c9['message']);});});};}function createEndUser(_0xd6f4d0,_0x179cbf,_0x1d567e,_0x307f8d){return new Promise(function(_0x55f294,_0x3361d8){var _0x3e723a=moment();var _0x22e0b0={'method':'POST','uri':_0x307f8d+_0x58c8('0x30'),'body':{'contact':{'last_name':_0xd6f4d0[_0x58c8('0x2b')],'work_number':_0xd6f4d0[_0x58c8('0x2b')],'mobile_number':_0xd6f4d0[_0x58c8('0x2b')],'owner_id':_0xd6f4d0[_0x58c8('0x1e')],'created_at':_0x3e723a[_0x58c8('0x31')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x22e0b0[_0x58c8('0xf')]=_0x1d567e;logger[_0x58c8('0x15')](_0x58c8('0x32'));return rp(_0x22e0b0)[_0x58c8('0x21')](function(_0x16e592){_0xd6f4d0[_0x58c8('0x2d')]=_0x16e592[_0x58c8('0x33')]['id'];_0x55f294(_0xd6f4d0);})['catch'](function(_0x292de9){logger[_0x58c8('0x19')]('['+[_0x179cbf['toUpperCase']()]+']',_0x292de9[_0x58c8('0x1a')]);_0x3361d8(_0x292de9[_0x58c8('0x1a')]);});});}function getTicket(_0x434f1c,_0x18ccb2,_0x473be8,_0x5b4e41,_0x5b82af){return function(_0x4c6c81){logger['info'](_0x58c8('0x34'));return new Promise(function(_0x292cbd,_0x5928b1){var _0x2d3b69=moment();var _0x3b38f0={'method':_0x58c8('0x35'),'uri':_0x473be8+_0x58c8('0x36'),'body':{'title':intUtil[_0x58c8('0x37')](_0x5b4e41[_0x58c8('0x38')],_0x5b82af,'\x20'),'description':intUtil['getString'](_0x5b4e41[_0x58c8('0x39')],_0x5b82af,'\x0a'),'owner_id':_0x4c6c81['userId'],'creater_id':_0x4c6c81['adminId'],'targetable_id':_0x4c6c81['endUserId'],'targetable_type':_0x58c8('0x3a'),'created_at':_0x2d3b69[_0x58c8('0x31')](_0x58c8('0x3b')),'due_date':_0x2d3b69[_0x58c8('0x3c')](0x1e,'m')[_0x58c8('0x31')](_0x58c8('0x3b'))},'json':!![]};_0x3b38f0[_0x58c8('0xf')]=_0x18ccb2;return rp(_0x3b38f0)[_0x58c8('0x21')](function(_0x368581){_0x4c6c81[_0x58c8('0x3d')]=_0x368581[_0x58c8('0x3e')]['id'];logger[_0x58c8('0x15')](_0x58c8('0x3f'),_0x4c6c81[_0x58c8('0x3d')]);_0x292cbd(_0x4c6c81);})['catch'](function(_0x11802d){logger[_0x58c8('0x19')]('['+[_0x434f1c[_0x58c8('0x40')]()]+']',_0x11802d[_0x58c8('0x1a')]);_0x5928b1(_0x11802d[_0x58c8('0x1a')]);});});};}function emit(_0x4d1a2d,_0x2b8037,_0x3cc111){var _0x4c0fd5={'uri':_0x4d1a2d+_0x58c8('0x41')+_0x3cc111};io['to'](util[_0x58c8('0x31')](_0x58c8('0x42'),_0x2b8037))['emit'](_0x58c8('0x43'),_0x4c0fd5);}exports['cs']=function(_0x2597f9,_0x2c1c56,_0x564e26,_0x1a0d68,_0x47adc7,_0x56a2f9,_0x18853a,_0x2db62){var _0x20fd46={};var _0x298d3a={'Authorization':_0x58c8('0x44')+_0x56a2f9[_0x58c8('0x45')]};_0x56a2f9[_0x58c8('0x46')]=intUtil[_0x58c8('0x47')](_0x56a2f9[_0x58c8('0x46')]);_0x56a2f9[_0x58c8('0x48')]=intUtil[_0x58c8('0x47')](_0x56a2f9[_0x58c8('0x48')]);var _0xa87568=_0x56a2f9['remoteUri'];_0x20fd46[_0x58c8('0x14')]=_0x56a2f9[_0x58c8('0x49')];_0x20fd46['contactNumber']=_0x2db62[_0x58c8('0x4a')]()==='outbound'?_0x2c1c56['destcalleridnum']:_0x2c1c56[_0x58c8('0x4b')];_0x20fd46['callDirection']=_0x2db62==='queue'||_0x2db62===_0x58c8('0x4c')?_0x58c8('0x4d'):_0x58c8('0x4e');if(_0x1a0d68){_0x20fd46[_0x58c8('0x1b')]=_0x1a0d68[_0x58c8('0x13')];}var _0x21c55d=util[_0x58c8('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56a2f9[_0x58c8('0x48')],_0x2c1c56[_0x58c8('0x4f')],md5(_0x2c1c56[_0x58c8('0x4f')]));if(_0x47adc7&&_0x47adc7[_0x58c8('0x50')]){logger[_0x58c8('0x15')](_0x58c8('0x51'),'Recording\x20is\x20enabled!');_0x2c1c56['recordingURL']=_0x21c55d;}else if(_0x18853a&&_0x18853a[_0x58c8('0x52')]&&_0x18853a[_0x58c8('0x52')]!==_0x58c8('0x53')){logger['info'](_0x58c8('0x54'),_0x58c8('0x55'));_0x2c1c56[_0x58c8('0x56')]=_0x21c55d;}else{_0x2c1c56[_0x58c8('0x56')]='';}return getAdminId(_0x20fd46,_0x2db62,_0x298d3a,_0xa87568)[_0x58c8('0x21')](getUser(_0x2db62,_0x298d3a,_0xa87568))[_0x58c8('0x21')](getEndUser(_0x2db62,_0x298d3a,_0xa87568))[_0x58c8('0x21')](getTicket(_0x2db62,_0x298d3a,_0xa87568,_0x564e26,_0x2c1c56))[_0x58c8('0x21')](function(_0x178875){logger[_0x58c8('0x15')](util[_0x58c8('0x31')](_0x58c8('0x57'),_0x178875[_0x58c8('0x3d')]));if(_0x2db62!==_0x58c8('0x4c')){logger['info']('['+[_0x2db62['toUpperCase']()]+']',_0x58c8('0x58'));emit(_0xa87568,_0x1a0d68[_0x58c8('0x59')],_0x178875[_0x58c8('0x2d')]);}})[_0x58c8('0x2f')](function(_0x5e3072){logger[_0x58c8('0x19')]('['+[_0x2db62[_0x58c8('0x40')]()]+_0x58c8('0x5a'),util['inspect'](_0x5e3072,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2607=['catch','Creating\x20new\x20task','POST','/api/tasks','Subjects','getString','Descriptions','Contact','format','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','../../../../config/environment','freshsales','redis','defaults','localhost','GET','info','Getting\x20admin\x20information','users','email','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','adminEmail','/api/contacts/filters','Getting\x20contacts\x20filter','forEach','name','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','mobile_number','contactNumber','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x431860,_0x23fa12){var _0x24b5f3=function(_0x5b7080){while(--_0x5b7080){_0x431860['push'](_0x431860['shift']());}};_0x24b5f3(++_0x23fa12);}(_0x2607,0x19b));var _0x7260=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x2607[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x7260('0x0'));var rp=require(_0x7260('0x1'));var md5=require('md5');var util=require(_0x7260('0x2'));var moment=require(_0x7260('0x3'));var Promise=require(_0x7260('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x7260('0x5'));var logger=require('../../../../config/logger')(_0x7260('0x6'));config[_0x7260('0x7')]=_[_0x7260('0x8')](config[_0x7260('0x7')],{'host':_0x7260('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x11abdc,_0x410627,_0x523e64,_0x409b9a){return new Promise(function(_0x4ac6e4,_0x4dd0ef){var _0x2a6e36=![];var _0x4e4454={'method':_0x7260('0xa'),'uri':_0x409b9a+'/api/selector/owners','json':!![]};_0x4e4454['headers']=_0x523e64;logger[_0x7260('0xb')](_0x7260('0xc'));return rp(_0x4e4454)['then'](function(_0xc883bd){if(_0xc883bd){var _0x4dd244=_0xc883bd[_0x7260('0xd')];var _0x5c8a35=null;for(_0x5c8a35=0x0;_0x5c8a35<_0x4dd244['length'];_0x5c8a35++){if(_0x4dd244[_0x5c8a35][_0x7260('0xe')]===_0x11abdc['adminEmail']){_0x11abdc['adminId']=_0x4dd244[_0x5c8a35]['id'];_0x2a6e36=!![];}}if(_0x2a6e36){logger[_0x7260('0xb')]('Admin\x20found:',_0x11abdc[_0x7260('0xf')]);_0x4ac6e4(_0x11abdc);}else{_0x4dd0ef({'statusCode':0x194,'message':_0x7260('0x10')});}}else{_0x4dd0ef({'statusCode':0x194,'message':_0x7260('0x10')});}})['catch'](function(_0x4172a8){logger[_0x7260('0x11')]('['+[_0x410627[_0x7260('0x12')]()]+']',_0x4172a8[_0x7260('0x13')]);_0x4dd0ef(_0x4172a8);});});}function getUser(_0x2767c,_0x2e13c0,_0x534a89){return function(_0x33b6c4){return new Promise(function(_0x125aed,_0xa6285e){var _0x89908a={'method':'GET','uri':_0x534a89+'/api/selector/owners','json':!![]};_0x89908a[_0x7260('0x14')]=_0x2e13c0;logger[_0x7260('0xb')](_0x7260('0x15'));return rp(_0x89908a)[_0x7260('0x16')](function(_0x1e0cd4){if(_0x1e0cd4){var _0x2f8e68=_0x1e0cd4[_0x7260('0xd')];var _0x4e5e9c=![];var _0x13a87c=null;if(_0x33b6c4[_0x7260('0x17')]!==null){logger['info'](_0x7260('0x18'),_0x33b6c4[_0x7260('0x17')]);_0x33b6c4[_0x7260('0x19')]=_0x33b6c4[_0x7260('0x17')];for(_0x13a87c=0x0;_0x13a87c<_0x2f8e68[_0x7260('0x1a')];_0x13a87c++){if(_0x2f8e68[_0x13a87c]['email']===_0x33b6c4[_0x7260('0x17')]){_0x4e5e9c=!![];_0x33b6c4[_0x7260('0x1b')]=_0x2f8e68[_0x13a87c]['id'];logger[_0x7260('0xb')](_0x7260('0x1c'),_0x33b6c4['userId']);}}}if(!_0x4e5e9c){logger[_0x7260('0xb')](_0x7260('0x1d'));_0x33b6c4[_0x7260('0x19')]=_0x33b6c4[_0x7260('0x1e')];_0x33b6c4[_0x7260('0x1b')]=_0x33b6c4[_0x7260('0xf')];_0x4e5e9c=!![];}if(_0x4e5e9c){_0x125aed(_0x33b6c4);}else{_0xa6285e({'statusCode':0x194,'message':_0x7260('0x10')});}}else{_0xa6285e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x5cf717){logger['error']('['+[_0x2767c[_0x7260('0x12')]()]+']',_0x5cf717[_0x7260('0x13')]);_0xa6285e(_0x5cf717);});});};}function getEndUser(_0x16d89a,_0x2fa901,_0x2340b9){return function(_0x40b762){return new Promise(function(_0x124b81,_0x1759cb){var _0x287a00=0x0;var _0xb0d21c={'method':'GET','uri':_0x2340b9+_0x7260('0x1f'),'json':!![]};_0xb0d21c[_0x7260('0x14')]=_0x2fa901;logger[_0x7260('0xb')](_0x7260('0x20'));return rp(_0xb0d21c)['then'](function(_0x23f9a7){_0x23f9a7['filters'][_0x7260('0x21')](function(_0x590134){if(_0x590134[_0x7260('0x22')]==='All\x20Contacts'){_0x287a00=_0x590134['id'];}});})['then'](function(){logger[_0x7260('0xb')](_0x7260('0x23'));var _0x3b50f3={'method':'GET','uri':_0x2340b9+_0x7260('0x24')+_0x287a00,'json':!![]};_0x3b50f3[_0x7260('0x14')]=_0x2fa901;return rp(_0x3b50f3);})['then'](function(_0x161469){logger[_0x7260('0xb')](_0x7260('0x25'),_0x40b762['contactNumber']);if(_0x161469[_0x7260('0x26')][_0x7260('0x1a')]>0x0){var _0x4125f1=_[_0x7260('0x27')](_0x161469[_0x7260('0x26')],function(_0x5944a5){if(_0x5944a5[_0x7260('0x28')]===_0x40b762['contactNumber']||_0x5944a5[_0x7260('0x29')]===_0x40b762[_0x7260('0x2a')]){return _0x5944a5;}});if(_0x4125f1){_0x40b762[_0x7260('0x2b')]=_0x4125f1['id'];logger['info'](_0x7260('0x2c'),_0x40b762['endUserId']);_0x124b81(_0x40b762);}else{return createEndUser(_0x40b762,_0x16d89a,_0x2fa901,_0x2340b9)[_0x7260('0x16')](function(_0x459d3c){logger['info'](_0x7260('0x2d'),_0x40b762[_0x7260('0x2b')]);_0x124b81(_0x459d3c);});}}else{return createEndUser(_0x40b762,_0x16d89a,_0x2fa901,_0x2340b9)[_0x7260('0x16')](function(_0x4d6ce9){logger[_0x7260('0xb')](_0x7260('0x2d'),_0x40b762['endUserId']);_0x124b81(_0x4d6ce9);});}})['catch'](function(_0x589240){throw new Error(_0x589240['message']);});});};}function createEndUser(_0x205b2e,_0x20f7c4,_0x1d3276,_0x3ff66e){return new Promise(function(_0x12408d,_0x43fc8f){var _0x5d2c38=moment();var _0xe13505={'method':'POST','uri':_0x3ff66e+_0x7260('0x2e'),'body':{'contact':{'last_name':_0x205b2e[_0x7260('0x2a')],'work_number':_0x205b2e[_0x7260('0x2a')],'mobile_number':_0x205b2e['contactNumber'],'owner_id':_0x205b2e['userId'],'created_at':_0x5d2c38['format'](_0x7260('0x2f'))}},'json':!![]};_0xe13505[_0x7260('0x14')]=_0x1d3276;logger[_0x7260('0xb')](_0x7260('0x30'));return rp(_0xe13505)[_0x7260('0x16')](function(_0x12697e){_0x205b2e[_0x7260('0x2b')]=_0x12697e['contact']['id'];_0x12408d(_0x205b2e);})[_0x7260('0x31')](function(_0x1150e5){logger[_0x7260('0x11')]('['+[_0x20f7c4[_0x7260('0x12')]()]+']',_0x1150e5[_0x7260('0x13')]);_0x43fc8f(_0x1150e5['message']);});});}function getTicket(_0x4ab655,_0x4f0459,_0x492682,_0xadf678,_0x2aa347){return function(_0x314c8f){logger[_0x7260('0xb')](_0x7260('0x32'));return new Promise(function(_0x12aec3,_0x5b3d76){var _0x297baa=moment();var _0x1d9567={'method':_0x7260('0x33'),'uri':_0x492682+_0x7260('0x34'),'body':{'title':intUtil['getString'](_0xadf678[_0x7260('0x35')],_0x2aa347,'\x20'),'description':intUtil[_0x7260('0x36')](_0xadf678[_0x7260('0x37')],_0x2aa347,'\x0a'),'owner_id':_0x314c8f['userId'],'creater_id':_0x314c8f[_0x7260('0xf')],'targetable_id':_0x314c8f[_0x7260('0x2b')],'targetable_type':_0x7260('0x38'),'created_at':_0x297baa[_0x7260('0x39')](_0x7260('0x2f')),'due_date':_0x297baa[_0x7260('0x3a')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1d9567['headers']=_0x4f0459;return rp(_0x1d9567)[_0x7260('0x16')](function(_0xc7d8e5){_0x314c8f[_0x7260('0x3b')]=_0xc7d8e5[_0x7260('0x3c')]['id'];logger['info'](_0x7260('0x3d'),_0x314c8f[_0x7260('0x3b')]);_0x12aec3(_0x314c8f);})[_0x7260('0x31')](function(_0x17bd58){logger[_0x7260('0x11')]('['+[_0x4ab655[_0x7260('0x12')]()]+']',_0x17bd58[_0x7260('0x13')]);_0x5b3d76(_0x17bd58[_0x7260('0x13')]);});});};}function emit(_0x552e3e,_0x195163,_0x1cb678){var _0x409237={'uri':_0x552e3e+_0x7260('0x3e')+_0x1cb678};io['to'](util[_0x7260('0x39')](_0x7260('0x3f'),_0x195163))[_0x7260('0x40')](_0x7260('0x41'),_0x409237);}exports['cs']=function(_0x2e4920,_0x2f8e2e,_0xcf19a2,_0x357ff3,_0x26f873,_0x43ff2e,_0x1cfba9,_0x16e45f){var _0x80dbf={};var _0x40ed4c={'Authorization':_0x7260('0x42')+_0x43ff2e[_0x7260('0x43')]};_0x43ff2e['remoteUri']=intUtil[_0x7260('0x44')](_0x43ff2e[_0x7260('0x45')]);_0x43ff2e[_0x7260('0x46')]=intUtil[_0x7260('0x44')](_0x43ff2e['serverUrl']);var _0x1376e3=_0x43ff2e['remoteUri'];_0x80dbf[_0x7260('0x1e')]=_0x43ff2e[_0x7260('0x47')];_0x80dbf[_0x7260('0x2a')]=_0x16e45f[_0x7260('0x48')]()==='outbound'?_0x2f8e2e[_0x7260('0x49')]:_0x2f8e2e[_0x7260('0x4a')];_0x80dbf[_0x7260('0x4b')]=_0x16e45f===_0x7260('0x4c')||_0x16e45f===_0x7260('0x4d')?'queue':_0x7260('0x4e');if(_0x357ff3){_0x80dbf[_0x7260('0x17')]=_0x357ff3[_0x7260('0xe')];}var _0x3f502a=util[_0x7260('0x39')](_0x7260('0x4f'),_0x43ff2e['serverUrl'],_0x2f8e2e[_0x7260('0x50')],md5(_0x2f8e2e['uniqueid']));if(_0x26f873&&_0x26f873[_0x7260('0x51')]){logger[_0x7260('0xb')](_0x7260('0x52'),'Recording\x20is\x20enabled!');_0x2f8e2e[_0x7260('0x53')]=_0x3f502a;}else if(_0x1cfba9&&_0x1cfba9[_0x7260('0x54')]&&_0x1cfba9['recordingFormat']!==_0x7260('0x55')){logger[_0x7260('0xb')](_0x7260('0x56'),_0x7260('0x57'));_0x2f8e2e[_0x7260('0x53')]=_0x3f502a;}else{_0x2f8e2e[_0x7260('0x53')]='';}return getAdminId(_0x80dbf,_0x16e45f,_0x40ed4c,_0x1376e3)[_0x7260('0x16')](getUser(_0x16e45f,_0x40ed4c,_0x1376e3))[_0x7260('0x16')](getEndUser(_0x16e45f,_0x40ed4c,_0x1376e3))['then'](getTicket(_0x16e45f,_0x40ed4c,_0x1376e3,_0xcf19a2,_0x2f8e2e))[_0x7260('0x16')](function(_0x773862){logger[_0x7260('0xb')](util[_0x7260('0x39')](_0x7260('0x58'),_0x773862['ticketId']));if(_0x16e45f!==_0x7260('0x4d')){logger['info']('['+[_0x16e45f[_0x7260('0x12')]()]+']',_0x7260('0x59'));emit(_0x1376e3,_0x357ff3[_0x7260('0x22')],_0x773862[_0x7260('0x2b')]);}})['catch'](function(_0xf2933b){logger[_0x7260('0x11')]('['+[_0x16e45f[_0x7260('0x12')]()]+_0x7260('0x5a'),util[_0x7260('0x5b')](_0xf2933b,{'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 e225625..d3caf2f 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 _0x8603=['zendesk','salesforce','sugarcrm','freshdesk','zoho','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./dynamics365'];(function(_0x13802c,_0x15cec9){var _0x1694b6=function(_0x58aed9){while(--_0x58aed9){_0x13802c['push'](_0x13802c['shift']());}};_0x1694b6(++_0x15cec9);}(_0x8603,0x190));var _0x3860=function(_0x41aa4d,_0x51e45f){_0x41aa4d=_0x41aa4d-0x0;var _0x3fb7d6=_0x8603[_0x41aa4d];return _0x3fb7d6;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var zendesk=require(_0x3860('0x1'));var salesforce=require(_0x3860('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x3860('0x3'));var desk=require(_0x3860('0x4'));var vtiger=require(_0x3860('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x3860('0x6'));var freshsales=require('./freshsales');var integrations=[_0x3860('0x7'),_0x3860('0x8'),_0x3860('0x9'),_0x3860('0xa'),_0x3860('0xb'),'desk','vtiger','dynamics365',_0x3860('0xc'),_0x3860('0xd')];exports['exec']=function(_0x2fb169,_0x38737e,_0x5909b8,_0x101263,_0x45ba50,_0x4cd35d){if(_0x5909b8){if(_[_0x3860('0xe')](integrations,_0x2fb169[_0x3860('0xf')]['toLowerCase']())){try{var _0x405510=null;var _0x8ad61d='';var _0x2428f6=_0x5909b8[_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()];if(_0x2428f6){var _0x21ae4e=_0x2428f6[_0x2fb169[_0x3860('0x11')]];if(_0x21ae4e){var _0x12b23b=_[_0x3860('0x12')](_0x21ae4e[_0x3860('0x13')],{'id':parseInt(_0x2fb169['data3'],0xa)});if(_0x12b23b){if(_0x101263){if(_0x45ba50&&_0x38737e[_0x3860('0x14')]){_0x8ad61d=_0x3860('0x14');}else if(_0x38737e[_0x3860('0x15')]){_0x8ad61d=_0x3860('0x16');}else{console[_0x3860('0x17')](_0x3860('0x18'),_0x38737e);}}else{_0x8ad61d=_0x3860('0x19');}switch(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()){case _0x3860('0x7'):zendesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x8'):salesforce[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x9'):sugarcrm[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'freshdesk':freshdesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'zoho':zoho[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1a'):desk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1b'):vtiger[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0xc'):freshsales['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case'servicenow':servicenow['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case _0x3860('0x1c'):dynamics365['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;default:console[_0x3860('0x17')](_0x3860('0x1d'));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x22'),_0x2fb169[_0x3860('0xf')][_0x3860('0x10')](),_0x2fb169[_0x3860('0x23')]));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')]['toLowerCase']());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x24'),_0x2fb169[_0x3860('0xf')]['toLowerCase'](),_0x2fb169[_0x3860('0x11')]));}}else{}}catch(_0x568515){console['error'](_0x568515);}}}}; \ No newline at end of file +var _0xed3c=['%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','salesforce','desk','servicenow','exec','includes','toLowerCase','data1','Configurations','data3','queue','outbound','log','unmanaged','sugarcrm','zoho','vtiger','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format'];(function(_0x56ab8f,_0x27db7b){var _0x267d57=function(_0x5dad03){while(--_0x5dad03){_0x56ab8f['push'](_0x56ab8f['shift']());}};_0x267d57(++_0x27db7b);}(_0xed3c,0x1a6));var _0xced3=function(_0x146b09,_0x345cd3){_0x146b09=_0x146b09-0x0;var _0x4e9e36=_0xed3c[_0x146b09];return _0x4e9e36;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var zendesk=require(_0xced3('0x2'));var salesforce=require(_0xced3('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xced3('0x4'));var zoho=require(_0xced3('0x5'));var desk=require(_0xced3('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xced3('0x7'));var freshsales=require(_0xced3('0x8'));var integrations=[_0xced3('0x9'),_0xced3('0xa'),'sugarcrm','freshdesk','zoho',_0xced3('0xb'),'vtiger','dynamics365','freshsales',_0xced3('0xc')];exports[_0xced3('0xd')]=function(_0x3e5a04,_0x12612f,_0x1cb639,_0x5934b2,_0x36ea7f,_0x32a95d){if(_0x1cb639){if(_[_0xced3('0xe')](integrations,_0x3e5a04['data1'][_0xced3('0xf')]())){try{var _0x19b8c2=null;var _0x42d879='';var _0x3b2ac4=_0x1cb639[_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]()];if(_0x3b2ac4){var _0x1869d5=_0x3b2ac4[_0x3e5a04['data2']];if(_0x1869d5){var _0x65bb58=_['find'](_0x1869d5[_0xced3('0x11')],{'id':parseInt(_0x3e5a04[_0xced3('0x12')],0xa)});if(_0x65bb58){if(_0x5934b2){if(_0x36ea7f&&_0x12612f[_0xced3('0x13')]){_0x42d879=_0xced3('0x13');}else if(_0x12612f['routeId']){_0x42d879=_0xced3('0x14');}else{console[_0xced3('0x15')]('EVENT\x20UNKNOWN',_0x12612f);}}else{_0x42d879=_0xced3('0x16');}switch(_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]()){case _0xced3('0x9'):zendesk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case'salesforce':salesforce[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x17'):sugarcrm[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case'freshdesk':freshdesk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x18'):zoho[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0xb'):desk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x19'):vtiger[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x1a'):freshsales['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;case _0xced3('0xc'):servicenow['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;case _0xced3('0x1b'):dynamics365['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;default:console[_0xced3('0x15')](_0xced3('0x1c'));}}else{_0x19b8c2=require(_0xced3('0x1d'))(_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]());_0x19b8c2['error']('[EXEC]',util['format'](_0xced3('0x1e'),_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')](),_0x3e5a04['data3']));}}else{_0x19b8c2=require(_0xced3('0x1d'))(_0x3e5a04[_0xced3('0x10')]['toLowerCase']());_0x19b8c2['error'](_0xced3('0x1f'),util[_0xced3('0x20')](_0xced3('0x21'),_0x3e5a04[_0xced3('0x10')]['toLowerCase'](),_0x3e5a04[_0xced3('0x22')]));}}else{}}catch(_0x23f92b){console['error'](_0x23f92b);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 9c83cdf..a93c06c 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 _0x5e1b=['Connection','remoteUri','https://login.salesforce.com','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','user:%s','%s/%s/e','instanceUrl','error','outbound','recordingFormat','none','[OUTBOUND]','trigger:salesforce:display','trigger:browser:url','unmanaged','lastevent','toUpperCase','isNil',']\x20Integration\x20account\x20type\x20%s.','catch','stringify','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','assign','getString','Subjects','Descriptions','WhoId','ContactId','sobject','create','User','find','execute','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact','lead','Case','length','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','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x5e1b,0xfc));var _0xb5e1=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5e1b[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xb5e1('0x0'));var rp=require(_0xb5e1('0x1'));var moment=require(_0xb5e1('0x2'));var BPromise=require(_0xb5e1('0x3'));var md5=require('md5');var jsforce=require(_0xb5e1('0x4'));var util=require(_0xb5e1('0x5'));var Redis=require(_0xb5e1('0x6'));var intUtil=require('./util');var config=require(_0xb5e1('0x7'));var logger=require(_0xb5e1('0x8'))(_0xb5e1('0x9'));config[_0xb5e1('0xa')]=_[_0xb5e1('0xb')](config[_0xb5e1('0xa')],{'host':_0xb5e1('0xc'),'port':0x18eb});var io=require(_0xb5e1('0xd'))(new Redis(config[_0xb5e1('0xa')]));function emit(_0x29aced,_0x47884a,_0x59fff0){io['to'](_0x29aced)[_0xb5e1('0xe')](_0x47884a,_0x59fff0);}function getTicket(_0x52ef0a,_0x2e344a,_0x596f93,_0x184f6b,_0x547f6b,_0x6efcee,_0x5a3911,_0x7d7ca){var _0x330733={};if(_0x184f6b[_0xb5e1('0xf')]==='Task'){_0x330733=Object[_0xb5e1('0x10')]({},{'OwnerId':_0x2e344a['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xb5e1('0x11')](_0x184f6b[_0xb5e1('0x12')],_0x547f6b,'\x20'),'Description':intUtil[_0xb5e1('0x11')](_0x184f6b[_0xb5e1('0x13')],_0x547f6b,'\x0a')},getCustomFields(_0x6efcee,_0x547f6b));if(_0x596f93){_0x330733[_0xb5e1('0x14')]=_0x596f93['id'];}}else if(_0x184f6b[_0xb5e1('0xf')]==='Case'){_0x330733=Object[_0xb5e1('0x10')]({},{'OwnerId':_0x2e344a['id'],'Subject':intUtil['getString'](_0x184f6b[_0xb5e1('0x12')],_0x547f6b,'\x20'),'Description':intUtil[_0xb5e1('0x11')](_0x184f6b[_0xb5e1('0x13')],_0x547f6b,'\x0a')},getCustomFields(_0x6efcee,_0x547f6b));if(_0x596f93){_0x330733[_0xb5e1('0x15')]=_0x596f93['id'];}}return _0x5a3911[_0xb5e1('0x16')](_0x184f6b[_0xb5e1('0xf')])[_0xb5e1('0x17')](_0x330733);}function getUser(_0x3f0e4c,_0x453410,_0x38433f){if(!_['isNil'](_0x453410)&&intUtil['validateEmail'](_0x453410)){var _0xf50706={'Email':_0x453410};var _0x583554={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x38433f['sobject'](_0xb5e1('0x18'))[_0xb5e1('0x19')](_0xf50706,_0x583554)[_0xb5e1('0x1a')]()['then'](function(_0x508d68){if(_0x508d68['length']){var _0x16298b=_[_0xb5e1('0x19')](_0x508d68,function(_0x36596e){return _0x36596e[_0xb5e1('0x1b')]===_0x453410;});if(_0x16298b){logger[_0xb5e1('0x1c')]('Agent\x20%s\x20found.',_0x453410);return BPromise[_0xb5e1('0x1d')]({'id':_0x16298b['Id'],'name':_0x16298b[_0xb5e1('0x1e')]});}}else{logger[_0xb5e1('0x1c')](_0xb5e1('0x1f'),_0x453410);return _0x38433f['identity']()[_0xb5e1('0x20')](function(_0x4ced9f){return BPromise[_0xb5e1('0x1d')]({'id':_0x4ced9f[_0xb5e1('0x21')],'name':_0x4ced9f[_0xb5e1('0x22')]});});}});}else{logger['info'](_0xb5e1('0x1f'),_0x453410);return _0x38433f[_0xb5e1('0x23')]()['then'](function(_0x3c25a2){return BPromise[_0xb5e1('0x1d')]({'id':_0x3c25a2[_0xb5e1('0x21')],'name':_0x3c25a2[_0xb5e1('0x22')]});});}}function getEndUser(_0xbaa53e,_0x4050e2,_0x39d70,_0x5de443,_0x2fddc2){var _0x386a99={'Phone':_0x5de443};var _0x4653c6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xb5e1('0x20')](function(){if(_0x4050e2[_0xb5e1('0xf')]===_0xb5e1('0x24')){logger[_0xb5e1('0x1c')](_0xb5e1('0x25'),_0x5de443,_0x4050e2[_0xb5e1('0x26')]);switch(_0x4050e2['moduleSearch']){case'contact_lead':return _0x2fddc2[_0xb5e1('0x16')](_0xb5e1('0x27'))[_0xb5e1('0x19')](_0x386a99,_0x4653c6)[_0xb5e1('0x1a')]()[_0xb5e1('0x20')](function(_0x4b2751){if(_0x4b2751&&_0x4b2751['length']){return _0x4b2751;}else{return _0x2fddc2[_0xb5e1('0x16')](_0xb5e1('0x28'))[_0xb5e1('0x19')](_0x386a99,_0x4653c6);}});case _0xb5e1('0x29'):return _0x2fddc2[_0xb5e1('0x16')]('Contact')[_0xb5e1('0x19')](_0x386a99,_0x4653c6)[_0xb5e1('0x1a')]();case _0xb5e1('0x2a'):return _0x2fddc2['sobject']('Lead')['find'](_0x386a99,_0x4653c6);default:return null;}}else if(_0x4050e2['ticketType']===_0xb5e1('0x2b')){logger['info'](_0xb5e1('0x25'),_0x5de443,_0xb5e1('0x29'));return _0x2fddc2[_0xb5e1('0x16')](_0xb5e1('0x27'))['find'](_0x386a99,_0x4653c6)[_0xb5e1('0x1a')]();}})['then'](function(_0x33b1b0){if(_0x33b1b0&&_0x33b1b0[_0xb5e1('0x2c')]){var _0x400381=_[_0xb5e1('0x19')](_0x33b1b0,function(_0x159dfc){return _0x159dfc[_0xb5e1('0x2d')]===_0x5de443;});if(_0x400381){return BPromise[_0xb5e1('0x1d')]({'id':_0x400381['Id'],'name':_0x400381['Name'],'phone':_0x400381['Phone']});}}})[_0xb5e1('0x20')](function(_0x12c620){if(_0x12c620){logger['info'](_0xb5e1('0x2e'),_0x5de443);return BPromise[_0xb5e1('0x1d')](_0x12c620);}else{logger[_0xb5e1('0x1c')](_0xb5e1('0x2f'),_0x5de443);var _0x552139={'LastName':_0x39d70!==_0xb5e1('0x30')?_0x39d70:util[_0xb5e1('0x31')](_0xb5e1('0x32'),_0x5de443),'Phone':_0x5de443};if(_0x4050e2[_0xb5e1('0x33')]){if(_0x4050e2[_0xb5e1('0x33')]===_0xb5e1('0x29')){logger[_0xb5e1('0x1c')](_0xb5e1('0x34'),_0x5de443,_0x4050e2[_0xb5e1('0x33')]);}else if(_0x4050e2[_0xb5e1('0x33')]===_0xb5e1('0x2a')&&_0x4050e2[_0xb5e1('0xf')]==='Task'){logger[_0xb5e1('0x1c')](_0xb5e1('0x34'),_0x5de443,_0x4050e2[_0xb5e1('0x33')]);_0x552139[_0xb5e1('0x35')]=_0xb5e1('0x36');}else{return null;}}return _0x2fddc2[_0xb5e1('0x16')](_[_0xb5e1('0x37')](_0x4050e2['moduleCreate']))[_0xb5e1('0x17')](_0x552139);}});}function getCustomFields(_0x1527b8,_0x29f371){var _0x3a5aa8={};if(_0x1527b8[_0xb5e1('0x2c')]>0x0){_[_0xb5e1('0x38')](_0x1527b8,function(_0x5c449f){if(_0x5c449f[_0xb5e1('0x39')]==='string'&&_0x5c449f[_0xb5e1('0x3a')]){_0x3a5aa8[_0x5c449f[_0xb5e1('0x3a')]]=_0x5c449f[_0xb5e1('0x3b')][_0xb5e1('0x3c')]();}else if(_0x5c449f[_0xb5e1('0x39')]===_0xb5e1('0x3d')&&_0x5c449f[_0xb5e1('0x3e')]&&_0x5c449f[_0xb5e1('0x3a')]){_0x29f371[_0x5c449f[_0xb5e1('0x3e')]]&&(_0x3a5aa8[_0x5c449f[_0xb5e1('0x3a')]]=_0x29f371[_0x5c449f['variableName']]['toString']());}else if(_0x5c449f['type']===_0xb5e1('0x3f')&&_0x5c449f[_0xb5e1('0x40')]&&_0x5c449f[_0xb5e1('0x40')]['name']&&_0x5c449f['idField']){_0x29f371[_0x5c449f['Variable'][_0xb5e1('0x41')][_0xb5e1('0x42')]()]&&(_0x3a5aa8[_0x5c449f[_0xb5e1('0x3a')]]=_0x29f371[_0x5c449f[_0xb5e1('0x40')][_0xb5e1('0x41')][_0xb5e1('0x42')]()][_0xb5e1('0x3c')]());}});}return _0x3a5aa8;}function getConnection(_0x49c2df){var _0x85e636=_0x49c2df[_0xb5e1('0x43')]['concat'](_0x49c2df[_0xb5e1('0x44')]);var _0x4accb8=new jsforce[(_0xb5e1('0x45'))]({'oauth2':{'loginUrl':_0x49c2df[_0xb5e1('0x46')]||_0xb5e1('0x47'),'clientId':_0x49c2df['clientId'],'clientSecret':_0x49c2df['clientSecret']}});return _0x4accb8[_0xb5e1('0x48')](_0x49c2df['username'],_0x85e636)[_0xb5e1('0x20')](function(){logger[_0xb5e1('0x1c')](_0xb5e1('0x49'));return _0x4accb8;});}exports[_0xb5e1('0x4a')]=function(_0x305c9b,_0x237df3,_0x50e0e9,_0x2f882c,_0x410087,_0xe20a06){var _0x13df47,_0x44895a,_0x4dec48,_0xd9a4b3;_0xe20a06['serverUrl']=intUtil[_0xb5e1('0x4b')](_0xe20a06[_0xb5e1('0x4c')]);_0xe20a06[_0xb5e1('0x46')]=intUtil[_0xb5e1('0x4b')](_0xe20a06['remoteUri']);if(_0x410087&&_0x410087[_0xb5e1('0x4d')]){logger[_0xb5e1('0x1c')](_0xb5e1('0x4e'),_0xb5e1('0x4f'));_0x237df3[_0xb5e1('0x50')]=util['format'](_0xb5e1('0x51'),_0xe20a06['serverUrl'],_0x237df3[_0xb5e1('0x52')],md5(_0x237df3['uniqueid']));}else{_0x237df3['recordingURL']='';}return getConnection(_0xe20a06)['then'](function(_0x5b8761){_0xd9a4b3=_0x5b8761;return getUser(_0xe20a06,_0x2f882c[_0xb5e1('0x53')],_0xd9a4b3);})[_0xb5e1('0x20')](function(_0x24d159){_0x13df47=_0x24d159;return getEndUser(_0xe20a06,_0x50e0e9,_0x237df3[_0xb5e1('0x54')],_0x237df3['calleridnum'],_0xd9a4b3);})['then'](function(_0x14e453){_0x44895a=_0x14e453;return getTicket(_0xe20a06,_0x13df47,_0x44895a,_0x50e0e9,_0x237df3,_0x50e0e9[_0xb5e1('0x55')],_0xd9a4b3,_0xb5e1('0x4a'));})['then'](function(_0x4acfe5){_0x4dec48=_0x4acfe5;logger['info'](_0xb5e1('0x56'),_0x4dec48['id']);logger['info'](_0xb5e1('0x57'),_0x4dec48['id'],_0x2f882c[_0xb5e1('0x41')],_0xe20a06['type']);switch(_0xe20a06[_0xb5e1('0x39')]){case _0xb5e1('0x58'):emit(util[_0xb5e1('0x31')]('user:%s',_0x2f882c[_0xb5e1('0x41')]),'trigger:salesforce:display',{'recordId':_0x4dec48['id']});break;case _0xb5e1('0x59'):emit(util[_0xb5e1('0x31')](_0xb5e1('0x5a'),_0x2f882c[_0xb5e1('0x41')]),'trigger:browser:url',{'uri':util[_0xb5e1('0x31')](_0xb5e1('0x5b'),_0xd9a4b3[_0xb5e1('0x5c')],_0x4dec48['id'])});break;default:logger[_0xb5e1('0x5d')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x51237){logger[_0xb5e1('0x5d')](_0xb5e1('0x4e'),JSON['stringify'](_0x51237));});};exports[_0xb5e1('0x5e')]=function(_0x4a598b,_0x19527a,_0x4a5233,_0x179392,_0x580e97,_0x19ad54,_0x4e8ea8){var _0x59359f,_0x26e5e6,_0x31cef2,_0x468f4a;_0x19ad54[_0xb5e1('0x4c')]=intUtil[_0xb5e1('0x4b')](_0x19ad54[_0xb5e1('0x4c')]);_0x19ad54[_0xb5e1('0x46')]=intUtil[_0xb5e1('0x4b')](_0x19ad54[_0xb5e1('0x46')]);if(_0x4e8ea8&&_0x4e8ea8[_0xb5e1('0x5f')]&&_0x4e8ea8[_0xb5e1('0x5f')]!==_0xb5e1('0x60')){logger[_0xb5e1('0x1c')](_0xb5e1('0x61'),'Recording\x20is\x20enabled!');_0x19527a[_0xb5e1('0x50')]=util['format'](_0xb5e1('0x51'),_0x19ad54[_0xb5e1('0x4c')],_0x19527a[_0xb5e1('0x52')],md5(_0x19527a[_0xb5e1('0x52')]));}return getConnection(_0x19ad54)['then'](function(_0x5aeb47){_0x468f4a=_0x5aeb47;return getUser(_0x19ad54,_0x179392[_0xb5e1('0x53')],_0x468f4a);})['then'](function(_0x1355fc){_0x59359f=_0x1355fc;return getEndUser(_0x19ad54,_0x4a5233,_0x19527a['destcalleridname'],_0x19527a['destcalleridnum'],_0x468f4a);})[_0xb5e1('0x20')](function(_0x2b89b1){_0x26e5e6=_0x2b89b1;return getTicket(_0x19ad54,_0x59359f,_0x26e5e6,_0x4a5233,_0x19527a,_0x4a5233[_0xb5e1('0x55')],_0x468f4a,'outbound');})[_0xb5e1('0x20')](function(_0x422a89){_0x31cef2=_0x422a89;logger[_0xb5e1('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x31cef2['id']);logger[_0xb5e1('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x31cef2['id'],_0x179392[_0xb5e1('0x41')],_0x19ad54['type']);switch(_0x19ad54['type']){case _0xb5e1('0x58'):emit(util['format']('user:%s',_0x179392[_0xb5e1('0x41')]),_0xb5e1('0x62'),{'recordId':_0x31cef2['id']});break;case'newTab':emit(util[_0xb5e1('0x31')](_0xb5e1('0x5a'),_0x179392[_0xb5e1('0x41')]),_0xb5e1('0x63'),{'uri':util[_0xb5e1('0x31')]('%s/%s/e',_0x468f4a[_0xb5e1('0x5c')],_0x31cef2['id'])});break;default:logger[_0xb5e1('0x5d')](_0xb5e1('0x61'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x388a80){logger[_0xb5e1('0x5d')]('[OUTBOUND]',JSON['stringify'](_0x388a80));});};exports[_0xb5e1('0x64')]=function(_0x1bcc59,_0x18237e,_0x3b4d01,_0x25b0fd,_0xc15fad,_0x5db1aa){var _0x4e8765,_0x3ce40a,_0x36b8e5,_0x349fc3;_0x5db1aa['serverUrl']=intUtil[_0xb5e1('0x4b')](_0x5db1aa['serverUrl']);_0x5db1aa['remoteUri']=intUtil[_0xb5e1('0x4b')](_0x5db1aa[_0xb5e1('0x46')]);if(_0xc15fad&&_0xc15fad['monitor_format']){logger['info']('['+_0x18237e[_0xb5e1('0x65')][_0xb5e1('0x66')]()+']',_0xb5e1('0x4f'));_0x18237e[_0xb5e1('0x50')]=util[_0xb5e1('0x31')](_0xb5e1('0x51'),_0x5db1aa['serverUrl'],_0x18237e[_0xb5e1('0x52')],md5(_0x18237e[_0xb5e1('0x52')]));}else{_0x18237e[_0xb5e1('0x50')]='';}return getConnection(_0x5db1aa)['then'](function(_0x48d307){_0x349fc3=_0x48d307;if(!_[_0xb5e1('0x67')](_0x25b0fd)){return getUser(_0x5db1aa,_0x25b0fd[_0xb5e1('0x41')],_0x349fc3);}else{return getUser(_0x5db1aa,null,_0x349fc3);}})['then'](function(_0x349ca9){_0x4e8765=_0x349ca9;return getEndUser(_0x5db1aa,_0x3b4d01,_0x18237e['calleridname'],_0x18237e['calleridnum'],_0x349fc3);})[_0xb5e1('0x20')](function(_0x412a5a){_0x3ce40a=_0x412a5a;return getTicket(_0x5db1aa,_0x4e8765,_0x3ce40a,_0x3b4d01,_0x18237e,_0x3b4d01[_0xb5e1('0x55')],_0x349fc3);})[_0xb5e1('0x20')](function(_0x115540){_0x36b8e5=_0x115540;logger[_0xb5e1('0x1c')]('['+_0x18237e[_0xb5e1('0x65')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x36b8e5['id']);logger[_0xb5e1('0x1c')]('['+_0x18237e[_0xb5e1('0x65')][_0xb5e1('0x66')]()+_0xb5e1('0x68'),_0x5db1aa[_0xb5e1('0x39')]);})[_0xb5e1('0x69')](function(_0x39c6ad){logger[_0xb5e1('0x5d')]('['+_0x18237e[_0xb5e1('0x65')][_0xb5e1('0x66')]()+']',JSON[_0xb5e1('0x6a')](_0x39c6ad));});}; \ No newline at end of file +var _0x590f=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','ticketType','assign','utc','Subjects','Descriptions','WhoId','getString','ContactId','sobject','create','isNil','validateEmail','User','execute','length','find','Email','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Lead','Contact','Case','Phone','Enduser\x20with\x20phone\x20%s\x20found.','format','Caller\x20-\x20%s','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','upperFirst','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','stripTrailingSlash'];(function(_0x97f6dd,_0x417a98){var _0x12c5c1=function(_0x47af5a){while(--_0x47af5a){_0x97f6dd['push'](_0x97f6dd['shift']());}};_0x12c5c1(++_0x417a98);}(_0x590f,0x97));var _0xf590=function(_0x3b7ae2,_0x3a82bd){_0x3b7ae2=_0x3b7ae2-0x0;var _0x4067c1=_0x590f[_0x3b7ae2];return _0x4067c1;};'use strict';var _=require(_0xf590('0x0'));var rp=require(_0xf590('0x1'));var moment=require(_0xf590('0x2'));var BPromise=require(_0xf590('0x3'));var md5=require('md5');var jsforce=require(_0xf590('0x4'));var util=require(_0xf590('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xf590('0x6'));var logger=require(_0xf590('0x7'))('salesforce');config[_0xf590('0x8')]=_['defaults'](config['redis'],{'host':_0xf590('0x9'),'port':0x18eb});var io=require(_0xf590('0xa'))(new Redis(config['redis']));function emit(_0x373ef7,_0x35892d,_0x4280de){io['to'](_0x373ef7)['emit'](_0x35892d,_0x4280de);}function getTicket(_0x2c2e77,_0x3163c1,_0x1c9fb2,_0x3f36cc,_0x4ea3b4,_0xdc03ac,_0x2a76a7,_0x2b9382){var _0xa2e02c={};if(_0x3f36cc[_0xf590('0xb')]==='Task'){_0xa2e02c=Object[_0xf590('0xc')]({},{'OwnerId':_0x3163c1['id'],'ActivityDate':moment[_0xf590('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x3f36cc[_0xf590('0xe')],_0x4ea3b4,'\x20'),'Description':intUtil['getString'](_0x3f36cc[_0xf590('0xf')],_0x4ea3b4,'\x0a')},getCustomFields(_0xdc03ac,_0x4ea3b4));if(_0x1c9fb2){_0xa2e02c[_0xf590('0x10')]=_0x1c9fb2['id'];}}else if(_0x3f36cc['ticketType']==='Case'){_0xa2e02c=Object[_0xf590('0xc')]({},{'OwnerId':_0x3163c1['id'],'Subject':intUtil[_0xf590('0x11')](_0x3f36cc[_0xf590('0xe')],_0x4ea3b4,'\x20'),'Description':intUtil[_0xf590('0x11')](_0x3f36cc[_0xf590('0xf')],_0x4ea3b4,'\x0a')},getCustomFields(_0xdc03ac,_0x4ea3b4));if(_0x1c9fb2){_0xa2e02c[_0xf590('0x12')]=_0x1c9fb2['id'];}}return _0x2a76a7[_0xf590('0x13')](_0x3f36cc[_0xf590('0xb')])[_0xf590('0x14')](_0xa2e02c);}function getUser(_0x3ad704,_0xf47e6c,_0x909c89){if(!_[_0xf590('0x15')](_0xf47e6c)&&intUtil[_0xf590('0x16')](_0xf47e6c)){var _0x164c03={'Email':_0xf47e6c};var _0x553a33={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x909c89[_0xf590('0x13')](_0xf590('0x17'))['find'](_0x164c03,_0x553a33)[_0xf590('0x18')]()['then'](function(_0x230504){if(_0x230504[_0xf590('0x19')]){var _0x208528=_[_0xf590('0x1a')](_0x230504,function(_0x2e9b7d){return _0x2e9b7d[_0xf590('0x1b')]===_0xf47e6c;});if(_0x208528){logger['info']('Agent\x20%s\x20found.',_0xf47e6c);return BPromise[_0xf590('0x1c')]({'id':_0x208528['Id'],'name':_0x208528[_0xf590('0x1d')]});}}else{logger[_0xf590('0x1e')](_0xf590('0x1f'),_0xf47e6c);return _0x909c89['identity']()[_0xf590('0x20')](function(_0x28b0b0){return BPromise[_0xf590('0x1c')]({'id':_0x28b0b0[_0xf590('0x21')],'name':_0x28b0b0[_0xf590('0x22')]});});}});}else{logger[_0xf590('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xf47e6c);return _0x909c89[_0xf590('0x23')]()[_0xf590('0x20')](function(_0x6648eb){return BPromise[_0xf590('0x1c')]({'id':_0x6648eb[_0xf590('0x21')],'name':_0x6648eb['display_name']});});}}function getEndUser(_0x242a03,_0x43ce27,_0x5cef8b,_0x41a09b,_0x2033f2){var _0x28b853={'Phone':_0x41a09b};var _0x3c0e27={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf590('0x1c')]()[_0xf590('0x20')](function(){if(_0x43ce27[_0xf590('0xb')]===_0xf590('0x24')){logger[_0xf590('0x1e')](_0xf590('0x25'),_0x41a09b,_0x43ce27['moduleSearch']);switch(_0x43ce27[_0xf590('0x26')]){case _0xf590('0x27'):return _0x2033f2[_0xf590('0x13')]('Contact')[_0xf590('0x1a')](_0x28b853,_0x3c0e27)[_0xf590('0x18')]()[_0xf590('0x20')](function(_0x553e02){if(_0x553e02&&_0x553e02[_0xf590('0x19')]){return _0x553e02;}else{return _0x2033f2['sobject'](_0xf590('0x28'))[_0xf590('0x1a')](_0x28b853,_0x3c0e27);}});case'contact':return _0x2033f2[_0xf590('0x13')](_0xf590('0x29'))[_0xf590('0x1a')](_0x28b853,_0x3c0e27)[_0xf590('0x18')]();case'lead':return _0x2033f2[_0xf590('0x13')](_0xf590('0x28'))[_0xf590('0x1a')](_0x28b853,_0x3c0e27);default:return null;}}else if(_0x43ce27[_0xf590('0xb')]===_0xf590('0x2a')){logger[_0xf590('0x1e')](_0xf590('0x25'),_0x41a09b,'contact');return _0x2033f2['sobject'](_0xf590('0x29'))[_0xf590('0x1a')](_0x28b853,_0x3c0e27)[_0xf590('0x18')]();}})['then'](function(_0x1484a6){if(_0x1484a6&&_0x1484a6[_0xf590('0x19')]){var _0x511dc1=_[_0xf590('0x1a')](_0x1484a6,function(_0x28e5d3){return _0x28e5d3[_0xf590('0x2b')]===_0x41a09b;});if(_0x511dc1){return BPromise[_0xf590('0x1c')]({'id':_0x511dc1['Id'],'name':_0x511dc1[_0xf590('0x1d')],'phone':_0x511dc1['Phone']});}}})['then'](function(_0x3dd643){if(_0x3dd643){logger['info'](_0xf590('0x2c'),_0x41a09b);return BPromise[_0xf590('0x1c')](_0x3dd643);}else{logger[_0xf590('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x41a09b);var _0x556f98={'LastName':_0x5cef8b!==''?_0x5cef8b:util[_0xf590('0x2d')](_0xf590('0x2e'),_0x41a09b),'Phone':_0x41a09b};if(_0x43ce27[_0xf590('0x2f')]){if(_0x43ce27[_0xf590('0x2f')]===_0xf590('0x30')){logger[_0xf590('0x1e')](_0xf590('0x31'),_0x41a09b,_0x43ce27['moduleCreate']);}else if(_0x43ce27['moduleCreate']===_0xf590('0x32')&&_0x43ce27[_0xf590('0xb')]==='Task'){logger[_0xf590('0x1e')](_0xf590('0x31'),_0x41a09b,_0x43ce27[_0xf590('0x2f')]);_0x556f98[_0xf590('0x33')]='No\x20Company';}else{return null;}}return _0x2033f2[_0xf590('0x13')](_[_0xf590('0x34')](_0x43ce27[_0xf590('0x2f')]))['create'](_0x556f98);}});}function getCustomFields(_0x1a2d46,_0x151d96){var _0x2b0c91={};if(_0x1a2d46[_0xf590('0x19')]>0x0){_['forEach'](_0x1a2d46,function(_0x21e49b){if(_0x21e49b[_0xf590('0x35')]===_0xf590('0x36')&&_0x21e49b[_0xf590('0x37')]){_0x2b0c91[_0x21e49b[_0xf590('0x37')]]=_0x21e49b[_0xf590('0x38')]['toString']();}else if(_0x21e49b[_0xf590('0x35')]===_0xf590('0x39')&&_0x21e49b['variableName']&&_0x21e49b[_0xf590('0x37')]){_0x151d96[_0x21e49b[_0xf590('0x3a')]]&&(_0x2b0c91[_0x21e49b['idField']]=_0x151d96[_0x21e49b[_0xf590('0x3a')]][_0xf590('0x3b')]());}else if(_0x21e49b[_0xf590('0x35')]===_0xf590('0x3c')&&_0x21e49b[_0xf590('0x3d')]&&_0x21e49b[_0xf590('0x3d')][_0xf590('0x3e')]&&_0x21e49b['idField']){_0x151d96[_0x21e49b['Variable'][_0xf590('0x3e')][_0xf590('0x3f')]()]&&(_0x2b0c91[_0x21e49b[_0xf590('0x37')]]=_0x151d96[_0x21e49b[_0xf590('0x3d')][_0xf590('0x3e')]['toLowerCase']()][_0xf590('0x3b')]());}});}return _0x2b0c91;}function getConnection(_0x4a535d){var _0xfb7d74=_0x4a535d[_0xf590('0x40')][_0xf590('0x41')](_0x4a535d[_0xf590('0x42')]);var _0x3437c0=new jsforce[(_0xf590('0x43'))]({'oauth2':{'loginUrl':_0x4a535d[_0xf590('0x44')]||_0xf590('0x45'),'clientId':_0x4a535d['clientId'],'clientSecret':_0x4a535d['clientSecret']}});return _0x3437c0[_0xf590('0x46')](_0x4a535d[_0xf590('0x47')],_0xfb7d74)[_0xf590('0x20')](function(){logger[_0xf590('0x1e')](_0xf590('0x48'));return _0x3437c0;});}exports[_0xf590('0x49')]=function(_0x1d4e75,_0x3cc8f2,_0xe6a54b,_0x228515,_0x194eab,_0x7a3958){var _0x41fcb0,_0x203214,_0x5d712d,_0x3fec36;_0x7a3958['serverUrl']=intUtil[_0xf590('0x4a')](_0x7a3958['serverUrl']);_0x7a3958['remoteUri']=intUtil[_0xf590('0x4a')](_0x7a3958[_0xf590('0x44')]);if(_0x194eab&&_0x194eab[_0xf590('0x4b')]){logger[_0xf590('0x1e')](_0xf590('0x4c'),_0xf590('0x4d'));_0x3cc8f2[_0xf590('0x4e')]=util[_0xf590('0x2d')](_0xf590('0x4f'),_0x7a3958[_0xf590('0x50')],_0x3cc8f2[_0xf590('0x51')],md5(_0x3cc8f2[_0xf590('0x51')]));}else{_0x3cc8f2[_0xf590('0x4e')]='';}return getConnection(_0x7a3958)['then'](function(_0x20b353){_0x3fec36=_0x20b353;return getUser(_0x7a3958,_0x228515[_0xf590('0x52')],_0x3fec36);})[_0xf590('0x20')](function(_0x3d6522){_0x41fcb0=_0x3d6522;return getEndUser(_0x7a3958,_0xe6a54b,_0x3cc8f2[_0xf590('0x53')],_0x3cc8f2['calleridnum'],_0x3fec36);})[_0xf590('0x20')](function(_0x2ca9d9){_0x203214=_0x2ca9d9;return getTicket(_0x7a3958,_0x41fcb0,_0x203214,_0xe6a54b,_0x3cc8f2,_0xe6a54b['Fields'],_0x3fec36,_0xf590('0x49'));})[_0xf590('0x20')](function(_0x33b9ae){_0x5d712d=_0x33b9ae;logger[_0xf590('0x1e')](_0xf590('0x54'),_0x5d712d['id']);logger['info'](_0xf590('0x55'),_0x5d712d['id'],_0x228515[_0xf590('0x3e')],_0x7a3958[_0xf590('0x35')]);switch(_0x7a3958['type']){case _0xf590('0x56'):emit(util[_0xf590('0x2d')]('user:%s',_0x228515['name']),_0xf590('0x57'),{'recordId':_0x5d712d['id']});break;case _0xf590('0x58'):emit(util['format'](_0xf590('0x59'),_0x228515[_0xf590('0x3e')]),'trigger:browser:url',{'uri':util[_0xf590('0x2d')](_0xf590('0x5a'),_0x3fec36['instanceUrl'],_0x5d712d['id'])});break;default:logger[_0xf590('0x5b')](_0xf590('0x5c'));}})[_0xf590('0x5d')](function(_0x26f806){logger['error'](_0xf590('0x4c'),JSON[_0xf590('0x5e')](_0x26f806));});};exports[_0xf590('0x5f')]=function(_0x401120,_0x16d5a0,_0xec6ab0,_0x27be3f,_0x490f2a,_0x4ce4bf,_0x2730f4){var _0x498ff5,_0x5ae8d9,_0x5ab6b1,_0x3e1b35;_0x4ce4bf[_0xf590('0x50')]=intUtil[_0xf590('0x4a')](_0x4ce4bf[_0xf590('0x50')]);_0x4ce4bf['remoteUri']=intUtil[_0xf590('0x4a')](_0x4ce4bf[_0xf590('0x44')]);if(_0x2730f4&&_0x2730f4[_0xf590('0x60')]&&_0x2730f4['recordingFormat']!==_0xf590('0x61')){logger['info']('[OUTBOUND]',_0xf590('0x4d'));_0x16d5a0[_0xf590('0x4e')]=util['format'](_0xf590('0x4f'),_0x4ce4bf[_0xf590('0x50')],_0x16d5a0[_0xf590('0x51')],md5(_0x16d5a0['uniqueid']));}return getConnection(_0x4ce4bf)['then'](function(_0xf00e5a){_0x3e1b35=_0xf00e5a;return getUser(_0x4ce4bf,_0x27be3f[_0xf590('0x52')],_0x3e1b35);})[_0xf590('0x20')](function(_0x430a62){_0x498ff5=_0x430a62;return getEndUser(_0x4ce4bf,_0xec6ab0,_0x16d5a0[_0xf590('0x62')],_0x16d5a0[_0xf590('0x63')],_0x3e1b35);})['then'](function(_0x2ec1c6){_0x5ae8d9=_0x2ec1c6;return getTicket(_0x4ce4bf,_0x498ff5,_0x5ae8d9,_0xec6ab0,_0x16d5a0,_0xec6ab0[_0xf590('0x64')],_0x3e1b35,_0xf590('0x5f'));})[_0xf590('0x20')](function(_0x4bdc56){_0x5ab6b1=_0x4bdc56;logger[_0xf590('0x1e')](_0xf590('0x65'),_0x5ab6b1['id']);logger[_0xf590('0x1e')](_0xf590('0x66'),_0x5ab6b1['id'],_0x27be3f[_0xf590('0x3e')],_0x4ce4bf[_0xf590('0x35')]);switch(_0x4ce4bf[_0xf590('0x35')]){case _0xf590('0x56'):emit(util[_0xf590('0x2d')]('user:%s',_0x27be3f[_0xf590('0x3e')]),_0xf590('0x57'),{'recordId':_0x5ab6b1['id']});break;case _0xf590('0x58'):emit(util[_0xf590('0x2d')]('user:%s',_0x27be3f[_0xf590('0x3e')]),_0xf590('0x67'),{'uri':util[_0xf590('0x2d')](_0xf590('0x5a'),_0x3e1b35[_0xf590('0x68')],_0x5ab6b1['id'])});break;default:logger['error'](_0xf590('0x69'),_0xf590('0x6a'));}})[_0xf590('0x5d')](function(_0x4215f7){logger['error'](_0xf590('0x69'),JSON['stringify'](_0x4215f7));});};exports[_0xf590('0x6b')]=function(_0x2ba0be,_0x1e048e,_0x9e388b,_0x365bab,_0x465014,_0x2c2086){var _0xd996b0,_0x3a904d,_0x201a91,_0x115dc2;_0x2c2086[_0xf590('0x50')]=intUtil[_0xf590('0x4a')](_0x2c2086[_0xf590('0x50')]);_0x2c2086[_0xf590('0x44')]=intUtil['stripTrailingSlash'](_0x2c2086['remoteUri']);if(_0x465014&&_0x465014[_0xf590('0x4b')]){logger['info']('['+_0x1e048e[_0xf590('0x6c')]['toUpperCase']()+']',_0xf590('0x4d'));_0x1e048e[_0xf590('0x4e')]=util[_0xf590('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c2086[_0xf590('0x50')],_0x1e048e[_0xf590('0x51')],md5(_0x1e048e[_0xf590('0x51')]));}else{_0x1e048e[_0xf590('0x4e')]='';}return getConnection(_0x2c2086)['then'](function(_0x4cde2c){_0x115dc2=_0x4cde2c;if(!_[_0xf590('0x15')](_0x365bab)){return getUser(_0x2c2086,_0x365bab['name'],_0x115dc2);}else{return getUser(_0x2c2086,null,_0x115dc2);}})[_0xf590('0x20')](function(_0x1a10e4){_0xd996b0=_0x1a10e4;return getEndUser(_0x2c2086,_0x9e388b,_0x1e048e['calleridname'],_0x1e048e[_0xf590('0x6d')],_0x115dc2);})[_0xf590('0x20')](function(_0xc524f2){_0x3a904d=_0xc524f2;return getTicket(_0x2c2086,_0xd996b0,_0x3a904d,_0x9e388b,_0x1e048e,_0x9e388b['Fields'],_0x115dc2);})[_0xf590('0x20')](function(_0x4a609e){_0x201a91=_0x4a609e;logger[_0xf590('0x1e')]('['+_0x1e048e['lastevent'][_0xf590('0x6e')]()+_0xf590('0x6f'),_0x201a91['id']);logger[_0xf590('0x1e')]('['+_0x1e048e[_0xf590('0x6c')][_0xf590('0x6e')]()+_0xf590('0x70'),_0x2c2086['type']);})['catch'](function(_0x54c7e4){logger[_0xf590('0x5b')]('['+_0x1e048e[_0xf590('0x6c')]['toUpperCase']()+']',JSON[_0xf590('0x5e')](_0x54c7e4));});}; \ 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 1a08351..1dedf27 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 _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x4235aa,_0x52f789){var _0x1f2014=function(_0x50430a){while(--_0x50430a){_0x4235aa['push'](_0x4235aa['shift']());}};_0x1f2014(++_0x52f789);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x3fd770,_0x316b8d){var _0x2f66cf=function(_0x2432ee){while(--_0x2432ee){_0x3fd770['push'](_0x3fd770['shift']());}};_0x2f66cf(++_0x316b8d);}(_0x1261,0x144));var _0x1126=function(_0x3adafa,_0x1ff5ea){_0x3adafa=_0x3adafa-0x0;var _0x229947=_0x1261[_0x3adafa];return _0x229947;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index c1bdd7c..e7743c8 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 _0x90b1=['JSON','stringify','format','apiKey','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','toString','variable','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','localhost','socket.io-emitter','redis','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','idField','set_entry'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x90b1,0x1bb));var _0x190b=function(_0xb9b6a6,_0x3691a2){_0xb9b6a6=_0xb9b6a6-0x0;var _0x296039=_0x90b1[_0xb9b6a6];return _0x296039;};'use strict';var _=require(_0x190b('0x0'));var rp=require(_0x190b('0x1'));var BPromise=require(_0x190b('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x190b('0x3'));var intUtil=require(_0x190b('0x4'));var config=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('sugarcrm');config['redis']=_['defaults'](config['redis'],{'host':_0x190b('0x7'),'port':0x18eb});var io=require(_0x190b('0x8'))(new Redis(config[_0x190b('0x9')]));var def={'method':_0x190b('0xa'),'json':!![]};function emit(_0x311161,_0x802924,_0x32c30c){io['to'](_0x311161)['emit'](_0x802924,_0x32c30c);}function getTicket(_0x14b93d,_0x186101,_0x163966,_0x33fd04,_0x41b788,_0x409aa3,_0x3e99a3,_0x1da225){logger['info'](_0x190b('0xb'));var _0x5cf995=new Date();var _0x5701ad=[{'name':_0x190b('0xc'),'value':intUtil[_0x190b('0xd')](_0x33fd04[_0x190b('0xe')],_0x41b788,'\x20')},{'name':_0x190b('0xf'),'value':_0x186101['id']},{'name':_0x190b('0x10'),'value':_0x186101['id']},{'name':_0x190b('0x11'),'value':intUtil[_0x190b('0xd')](_0x33fd04[_0x190b('0x12')],_0x41b788,'\x0a')},{'name':_0x190b('0x13'),'value':_0x5cf995[_0x190b('0x14')]()[_0x190b('0x15')](0x0,0x13)[_0x190b('0x16')]('T','\x20')},{'name':_0x190b('0x17'),'value':'0'},{'name':_0x190b('0x18'),'value':'15'},{'name':_0x190b('0x19'),'value':_0x163966['id']},{'name':_0x190b('0x1a'),'value':_0x190b('0x1b')},{'name':'parent_name','value':_0x163966[_0x190b('0xc')]},{'name':'direction','value':_0x1da225}];if(_0x409aa3[_0x190b('0x1c')]){_[_0x190b('0x1d')](_0x409aa3,function(_0x56d07a){if(_0x41b788[_0x56d07a[_0x190b('0x1e')]]){_0x5701ad['push']({'name':_0x56d07a[_0x190b('0x1f')],'value':_0x41b788[_0x56d07a[_0x190b('0x1e')]]});}});}return request({'form':{'method':_0x190b('0x20'),'input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x3e99a3['id'],'module_name':'Calls','name_value_list':_0x5701ad})}});}function getAuth(_0x3ed24c){return util[_0x190b('0x23')]('Basic\x20%s',new Buffer(_0x3ed24c[_0x190b('0x24')]+':X')['toString']('base64'));}function getServerInfo(_0xcd15e5){return request({'form':{'method':_0x190b('0x25'),'input_type':_0x190b('0x21'),'response_type':'JSON','rest_data':JSON[_0x190b('0x22')]({'session':_0xcd15e5['id']})}});}function getUser(_0x2e633e,_0x16e989,_0x292ce3){if(!_[_0x190b('0x26')](_0x16e989)){logger[_0x190b('0x27')](_0x190b('0x28'),_0x16e989);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x292ce3['id'],'module_name':'Employees','query':util['format'](_0x190b('0x29'),_0x16e989),'order_by':'','offset':'0','select_fields':['id','name',_0x190b('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x190b('0x2b')](function(_0x51f8b4){if(_0x51f8b4[_0x190b('0x2c')][_0x190b('0x1c')]){var _0x5c89ab=_[_0x190b('0x2d')](_0x51f8b4[_0x190b('0x2c')],function(_0x359b4a){return _0x359b4a['name_value_list']['user_name'][_0x190b('0x2e')]===_0x16e989;});if(_0x5c89ab){logger['info'](_0x190b('0x2f'));return BPromise[_0x190b('0x30')]({'id':_0x5c89ab['name_value_list']['id'][_0x190b('0x2e')],'name':_0x5c89ab['name_value_list'][_0x190b('0xc')]['value']});}}logger[_0x190b('0x27')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x190b('0x30')]({'id':_0x292ce3[_0x190b('0x31')]['user_id'][_0x190b('0x2e')],'name':_0x292ce3[_0x190b('0x31')][_0x190b('0x2a')][_0x190b('0x2e')]});});}else{logger[_0x190b('0x27')](_0x190b('0x32'));return BPromise[_0x190b('0x30')]({'id':_0x292ce3[_0x190b('0x31')]['user_id']['value'],'name':_0x292ce3[_0x190b('0x31')][_0x190b('0x2a')]['value']});}}function getEndUser(_0x51dea7,_0x2dcd39,_0x3e4dd8,_0x3fbba1){logger[_0x190b('0x27')](_0x190b('0x33'),_0x3e4dd8);return request({'form':{'method':_0x190b('0x34'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x190b('0x22')]({'session':_0x3fbba1['id'],'module_name':_0x190b('0x1b'),'query':util[_0x190b('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3e4dd8),'order_by':'','offset':'0','select_fields':['id',_0x190b('0xc'),_0x190b('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x190b('0x2b')](function(_0x5a9669){if(_0x5a9669[_0x190b('0x2c')]['length']){var _0x4f12db=_[_0x190b('0x2d')](_0x5a9669[_0x190b('0x2c')],function(_0x5dcaa8){return _0x5dcaa8[_0x190b('0x31')][_0x190b('0x35')][_0x190b('0x2e')]===_0x3e4dd8;});if(_0x4f12db){logger['info'](_0x190b('0x36'));return BPromise[_0x190b('0x30')]({'id':_0x4f12db['name_value_list']['id']['value'],'name':_0x4f12db[_0x190b('0x31')]['name'][_0x190b('0x2e')],'phone':_0x4f12db[_0x190b('0x31')][_0x190b('0x35')][_0x190b('0x2e')]});}}else{logger['info'](_0x190b('0x37'));return request({'form':{'method':'set_entry','input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON['stringify']({'session':_0x3fbba1['id'],'module_name':_0x190b('0x1b'),'name_value_list':[{'name':_0x190b('0x38'),'value':_0x2dcd39!==_0x190b('0x39')?_0x2dcd39:util['format'](_0x190b('0x3a'),_0x3e4dd8)},{'name':'phone_home','value':_0x3e4dd8}]})}})['then'](function(_0x554486){logger[_0x190b('0x27')](_0x190b('0x3b'));return BPromise[_0x190b('0x30')]({'id':_0x554486['id'],'name':_0x554486[_0x190b('0x2c')]['first_name']['value'],'phone':_0x554486[_0x190b('0x2c')]['phone_home'][_0x190b('0x2e')]});});}});}function request(_0x3d67f0){logger['debug'](_0x190b('0x3c'),JSON[_0x190b('0x22')](_0x3d67f0));return rp(_[_0x190b('0x3d')](def,_0x3d67f0));}function getTags(_0x47e414,_0x4b6584){var _0x33597b=[];if(_0x47e414&&_0x47e414['length']>0x0){_0x33597b=_[_0x190b('0x3e')](_0x47e414,_0x4b6584);}return _0x33597b;}function getCustomFields(_0x596956,_0x1b8d35){var _0x12c276=[];var _0x1ce1f7={'custom_fields':[]};if(_0x596956['length']>0x0){_[_0x190b('0x1d')](_0x596956,function(_0x58e006){if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x40')&&_0x58e006[_0x190b('0x41')]&&!_0x58e006[_0x190b('0x42')]){_0x1ce1f7[_0x58e006[_0x190b('0x41')][_0x190b('0x43')]()]=_0x58e006[_0x190b('0x44')]['toString']();}else if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x40')&&_0x58e006[_0x190b('0x1f')]&&_0x58e006['customField']){_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006[_0x190b('0x1f')],'value':_0x58e006[_0x190b('0x44')][_0x190b('0x47')]()});}else if(_0x58e006['type']===_0x190b('0x48')&&_0x58e006[_0x190b('0x1e')]&&_0x58e006[_0x190b('0x1f')]&&_0x58e006['customField']){_0x1b8d35[_0x58e006[_0x190b('0x1e')]]&&_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006['idField'],'value':_0x1b8d35[_0x58e006['variableName']][_0x190b('0x47')]()});}else if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x49')&&_0x58e006[_0x190b('0x4a')]&&_0x58e006[_0x190b('0x4a')][_0x190b('0xc')]&&_0x58e006['idField']&&_0x58e006[_0x190b('0x42')]){_0x1b8d35[_0x58e006[_0x190b('0x4a')][_0x190b('0xc')]['toLowerCase']()]&&_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006[_0x190b('0x1f')],'value':_0x1b8d35[_0x58e006['Variable'][_0x190b('0xc')][_0x190b('0x43')]()][_0x190b('0x47')]()});}});}return _0x1ce1f7;}function getConnection(_0x3256c0){return request({'method':_0x190b('0xa'),'form':{'method':_0x190b('0x4b'),'input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'user_auth':{'user_name':_0x3256c0[_0x190b('0x4c')],'password':_0x3256c0[_0x190b('0x4d')],'encryption':'PLAIN'},'application':_0x190b('0x4e')})}})['then'](function(_0x1141c6){var _0x18f361=_0x1141c6;if(_0x18f361['id']){def['sessionID']=_0x18f361['id'];return BPromise[_0x190b('0x30')](_0x18f361);}else{throw new Error(util[_0x190b('0x23')](_0x190b('0x4f'),_0x3256c0['id']));}});}function setRelationship(_0x347a23,_0x21b1c3,_0x25036d,_0x618748){return request({'form':{'method':_0x190b('0x50'),'input_type':'JSON','response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x347a23['id'],'module_name':_0x190b('0x51'),'module_id':_0x25036d['id'],'link_field_name':_0x618748,'related_ids':[_0x21b1c3['id']]})}});}exports['queue']=function(_0x447fc4,_0x4b009d,_0x4a3db4,_0x41b16,_0x4008c4,_0x158c54){var _0x150312,_0x38e63f,_0x20314b,_0x1383e5;_0x158c54[_0x190b('0x52')]=intUtil[_0x190b('0x53')](_0x158c54[_0x190b('0x52')]);_0x158c54[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x158c54[_0x190b('0x54')]);def[_0x190b('0x55')]=util['format'](_0x190b('0x56'),_0x158c54[_0x190b('0x52')]);if(_0x4008c4&&_0x4008c4[_0x190b('0x57')]){logger[_0x190b('0x27')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4b009d[_0x190b('0x58')]=util[_0x190b('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x158c54[_0x190b('0x54')],_0x4b009d['uniqueid'],md5(_0x4b009d[_0x190b('0x59')]));}else{_0x4b009d[_0x190b('0x58')]='';}return getConnection(_0x158c54)[_0x190b('0x2b')](function(_0x4d2814){_0x1383e5=_0x4d2814;return getUser(_0x158c54,_0x41b16[_0x190b('0xc')],_0x1383e5);})[_0x190b('0x2b')](function(_0xffe7cb){_0x150312=_0xffe7cb;logger[_0x190b('0x27')](_0x190b('0x5a'),_0x150312['id']);return getEndUser(_0x158c54,_0x4b009d[_0x190b('0x5b')],_0x4b009d[_0x190b('0x5c')],_0x1383e5);})[_0x190b('0x2b')](function(_0x25e2a2){_0x38e63f=_0x25e2a2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x38e63f['id']);return getTicket(_0x158c54,_0x150312,_0x38e63f,_0x4a3db4,_0x4b009d,_0x4a3db4[_0x190b('0x5d')],_0x1383e5,_0x190b('0x5e'));})[_0x190b('0x2b')](function(_0x2a4db8){_0x20314b=_0x2a4db8;logger['info'](_0x190b('0x5f'));logger[_0x190b('0x27')]('The\x20Ticket\x20ID\x20is:',_0x20314b['id']);return setRelationship(_0x1383e5,_0x150312,_0x20314b,_0x190b('0x60'));})[_0x190b('0x2b')](function(){return setRelationship(_0x1383e5,_0x38e63f,_0x20314b,_0x190b('0x61'));})[_0x190b('0x2b')](function(){return getServerInfo(_0x1383e5);})[_0x190b('0x2b')](function(_0x6eeb1e){var _0x8f95e9=parseInt(_0x6eeb1e[_0x190b('0x62')]['charAt'](0x0));var _0x14d1b8=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x158c54[_0x190b('0x52')],_0x20314b['id']);if(_0x8f95e9>0x6){_0x14d1b8=util[_0x190b('0x23')](_0x190b('0x63'),_0x158c54['remoteUri'],_0x20314b['id']);}logger['info'](_0x190b('0x64'),_0x190b('0x65'));emit(util[_0x190b('0x23')](_0x190b('0x66'),_0x41b16[_0x190b('0xc')]),_0x190b('0x67'),{'uri':_0x14d1b8});})[_0x190b('0x68')](function(_0x25ba8d){logger['error'](_0x190b('0x64'),JSON[_0x190b('0x22')](_0x25ba8d));});};exports[_0x190b('0x69')]=function(_0x20b9f0,_0x172f19,_0x5aa9cb,_0x13cda6,_0x3be030,_0x6fe403,_0x4c877e){var _0x5a0493,_0x19103f,_0x33703e,_0x2b0362;_0x6fe403['remoteUri']=intUtil[_0x190b('0x53')](_0x6fe403[_0x190b('0x52')]);_0x6fe403[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x6fe403['serverUrl']);def[_0x190b('0x55')]=util['format'](_0x190b('0x56'),_0x6fe403[_0x190b('0x52')]);if(_0x4c877e&&_0x4c877e[_0x190b('0x6a')]&&_0x4c877e[_0x190b('0x6a')]!=='none'){logger[_0x190b('0x27')]('[OUTBOUND]',_0x190b('0x6b'));_0x172f19['recordingURL']=util['format'](_0x190b('0x6c'),_0x6fe403['serverUrl'],_0x172f19[_0x190b('0x59')],md5(_0x172f19[_0x190b('0x59')]));}return getConnection(_0x6fe403)[_0x190b('0x2b')](function(_0x3b6803){_0x2b0362=_0x3b6803;return getUser(_0x6fe403,_0x13cda6[_0x190b('0xc')],_0x2b0362);})['then'](function(_0x2f9922){_0x5a0493=_0x2f9922;logger[_0x190b('0x27')](_0x190b('0x5a'),_0x5a0493['id']);return getEndUser(_0x6fe403,_0x172f19['destcalleridname'],_0x172f19[_0x190b('0x6d')],_0x2b0362);})[_0x190b('0x2b')](function(_0x5f1e3c){_0x19103f=_0x5f1e3c;logger[_0x190b('0x27')](_0x190b('0x6e'),_0x19103f['id']);return getTicket(_0x6fe403,_0x5a0493,_0x19103f,_0x5aa9cb,_0x172f19,_0x5aa9cb[_0x190b('0x5d')],_0x2b0362,'Outbound');})[_0x190b('0x2b')](function(_0x26be58){_0x33703e=_0x26be58;logger[_0x190b('0x27')](_0x190b('0x5f'));logger['info'](_0x190b('0x6f'),_0x33703e['id']);return setRelationship(_0x2b0362,_0x5a0493,_0x33703e,_0x190b('0x60'));})[_0x190b('0x2b')](function(){return setRelationship(_0x2b0362,_0x19103f,_0x33703e,'contacts');})[_0x190b('0x2b')](function(){return getServerInfo(_0x2b0362);})[_0x190b('0x2b')](function(_0x2d969f){var _0x49bd3b=parseInt(_0x2d969f[_0x190b('0x62')][_0x190b('0x70')](0x0));var _0x71f228=util[_0x190b('0x23')](_0x190b('0x71'),_0x6fe403['remoteUri'],_0x33703e['id']);if(_0x49bd3b>0x6){_0x71f228=util['format'](_0x190b('0x63'),_0x6fe403[_0x190b('0x52')],_0x33703e['id']);}logger['info'](_0x190b('0x72'),_0x190b('0x65'));emit(util['format']('user:%s',_0x13cda6[_0x190b('0xc')]),_0x190b('0x67'),{'uri':_0x71f228});})['catch'](function(_0x5a7c9d){logger[_0x190b('0x73')](_0x190b('0x72'),JSON[_0x190b('0x22')](_0x5a7c9d));});};exports[_0x190b('0x74')]=function(_0x172dbf,_0x47c9c6,_0x5c9258,_0x189779,_0x4813ee,_0x254be3){var _0x82050a,_0x472dea,_0x3c9653,_0x16b41f;_0x254be3[_0x190b('0x52')]=intUtil[_0x190b('0x53')](_0x254be3[_0x190b('0x52')]);_0x254be3[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x254be3[_0x190b('0x54')]);def['uri']=util[_0x190b('0x23')](_0x190b('0x56'),_0x254be3[_0x190b('0x52')]);if(_0x4813ee&&_0x4813ee['monitor_format']){logger['info']('['+_0x47c9c6[_0x190b('0x75')][_0x190b('0x76')]()+']','Recording\x20is\x20enabled!');_0x47c9c6[_0x190b('0x58')]=util[_0x190b('0x23')](_0x190b('0x6c'),_0x254be3['serverUrl'],_0x47c9c6[_0x190b('0x59')],md5(_0x47c9c6[_0x190b('0x59')]));}else{_0x47c9c6['recordingURL']='';}return getConnection(_0x254be3)[_0x190b('0x2b')](function(_0x2ba27b){_0x16b41f=_0x2ba27b;if(!_['isNil'](_0x189779)){return getUser(_0x254be3,_0x189779[_0x190b('0xc')],_0x16b41f);}else{return getUser(_0x254be3,null,_0x16b41f);}})['then'](function(_0x48c4d0){_0x82050a=_0x48c4d0;logger['info']('The\x20User\x20ID\x20is:',_0x82050a['id']);return getEndUser(_0x254be3,_0x47c9c6[_0x190b('0x5b')],_0x47c9c6[_0x190b('0x5c')],_0x16b41f);})['then'](function(_0x26e8ce){_0x472dea=_0x26e8ce;logger[_0x190b('0x27')]('The\x20Enduser\x20ID\x20is:',_0x472dea['id']);return getTicket(_0x254be3,_0x82050a,_0x472dea,_0x5c9258,_0x47c9c6,_0x5c9258[_0x190b('0x5d')],_0x16b41f,_0x190b('0x5e'));})[_0x190b('0x2b')](function(_0x9bd5ac){_0x3c9653=_0x9bd5ac;logger[_0x190b('0x27')](_0x190b('0x5f'));logger[_0x190b('0x27')](_0x190b('0x6f'),_0x3c9653['id']);return setRelationship(_0x16b41f,_0x82050a,_0x3c9653,_0x190b('0x60'));})['then'](function(){return setRelationship(_0x16b41f,_0x472dea,_0x3c9653,_0x190b('0x61'));})['then'](function(){return getServerInfo(_0x16b41f);})['catch'](function(_0x2c7328){logger[_0x190b('0x73')]('['+_0x47c9c6[_0x190b('0x75')][_0x190b('0x76')]()+']',JSON[_0x190b('0x22')](_0x2c7328));});}; \ No newline at end of file +var _0xa817=['users','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','merge','map','type','string','nameField','customField','content','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','uniqueid','recordingURL','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','%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','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','Fields','Outbound','Ticket\x20created!','charAt','catch','unmanaged','lastevent','calleridname'];(function(_0x4aadbc,_0x4afc4d){var _0x372f33=function(_0xc50454){while(--_0xc50454){_0x4aadbc['push'](_0x4aadbc['shift']());}};_0x372f33(++_0x4afc4d);}(_0xa817,0x7b));var _0x7a81=function(_0x2748f9,_0x42a1bf){_0x2748f9=_0x2748f9-0x0;var _0x423e3a=_0xa817[_0x2748f9];return _0x423e3a;};'use strict';var _=require(_0x7a81('0x0'));var rp=require(_0x7a81('0x1'));var BPromise=require(_0x7a81('0x2'));var md5=require(_0x7a81('0x3'));var util=require(_0x7a81('0x4'));var Redis=require(_0x7a81('0x5'));var intUtil=require(_0x7a81('0x6'));var config=require(_0x7a81('0x7'));var logger=require(_0x7a81('0x8'))('sugarcrm');config[_0x7a81('0x9')]=_[_0x7a81('0xa')](config['redis'],{'host':_0x7a81('0xb'),'port':0x18eb});var io=require(_0x7a81('0xc'))(new Redis(config[_0x7a81('0x9')]));var def={'method':_0x7a81('0xd'),'json':!![]};function emit(_0x1869fb,_0x18f6f6,_0x59d701){io['to'](_0x1869fb)[_0x7a81('0xe')](_0x18f6f6,_0x59d701);}function getTicket(_0x5b3b66,_0x5ae346,_0x2b8dc7,_0x493b02,_0x41d90b,_0x37fee1,_0xcf4b61,_0x2116c5){logger[_0x7a81('0xf')](_0x7a81('0x10'));var _0x2bea43=new Date();var _0x4c632e=[{'name':_0x7a81('0x11'),'value':intUtil[_0x7a81('0x12')](_0x493b02[_0x7a81('0x13')],_0x41d90b,'\x20')},{'name':'assigned_user_id','value':_0x5ae346['id']},{'name':_0x7a81('0x14'),'value':_0x5ae346['id']},{'name':_0x7a81('0x15'),'value':intUtil[_0x7a81('0x12')](_0x493b02[_0x7a81('0x16')],_0x41d90b,'\x0a')},{'name':_0x7a81('0x17'),'value':_0x2bea43[_0x7a81('0x18')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x7a81('0x19'),'value':'0'},{'name':_0x7a81('0x1a'),'value':'15'},{'name':'parent_id','value':_0x2b8dc7['id']},{'name':_0x7a81('0x1b'),'value':_0x7a81('0x1c')},{'name':_0x7a81('0x1d'),'value':_0x2b8dc7[_0x7a81('0x11')]},{'name':_0x7a81('0x1e'),'value':_0x2116c5}];if(_0x37fee1[_0x7a81('0x1f')]){_[_0x7a81('0x20')](_0x37fee1,function(_0x3d9a4f){if(_0x41d90b[_0x3d9a4f[_0x7a81('0x21')]]){_0x4c632e[_0x7a81('0x22')]({'name':_0x3d9a4f[_0x7a81('0x23')],'value':_0x41d90b[_0x3d9a4f[_0x7a81('0x21')]]});}});}return request({'form':{'method':_0x7a81('0x24'),'input_type':'JSON','response_type':_0x7a81('0x25'),'rest_data':JSON[_0x7a81('0x26')]({'session':_0xcf4b61['id'],'module_name':_0x7a81('0x27'),'name_value_list':_0x4c632e})}});}function getAuth(_0x3087c0){return util[_0x7a81('0x28')](_0x7a81('0x29'),new Buffer(_0x3087c0[_0x7a81('0x2a')]+':X')[_0x7a81('0x2b')](_0x7a81('0x2c')));}function getServerInfo(_0x596a8c){return request({'form':{'method':_0x7a81('0x2d'),'input_type':_0x7a81('0x25'),'response_type':_0x7a81('0x25'),'rest_data':JSON[_0x7a81('0x26')]({'session':_0x596a8c['id']})}});}function getUser(_0x26556b,_0x15a1cd,_0x249ae1){if(!_[_0x7a81('0x2e')](_0x15a1cd)){logger['info'](_0x7a81('0x2f'),_0x15a1cd);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x7a81('0x25'),'rest_data':JSON[_0x7a81('0x26')]({'session':_0x249ae1['id'],'module_name':_0x7a81('0x30'),'query':util['format'](_0x7a81('0x31'),_0x15a1cd),'order_by':'','offset':'0','select_fields':['id',_0x7a81('0x11'),_0x7a81('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7a81('0x33')](function(_0x16ea00){if(_0x16ea00['entry_list'][_0x7a81('0x1f')]){var _0x33ac1f=_[_0x7a81('0x34')](_0x16ea00[_0x7a81('0x35')],function(_0x29655a){return _0x29655a[_0x7a81('0x36')][_0x7a81('0x32')]['value']===_0x15a1cd;});if(_0x33ac1f){logger[_0x7a81('0xf')]('Agent\x20found!');return BPromise[_0x7a81('0x37')]({'id':_0x33ac1f[_0x7a81('0x36')]['id'][_0x7a81('0x38')],'name':_0x33ac1f['name_value_list'][_0x7a81('0x11')]['value']});}}logger['info'](_0x7a81('0x39'));return BPromise[_0x7a81('0x37')]({'id':_0x249ae1[_0x7a81('0x36')][_0x7a81('0x3a')][_0x7a81('0x38')],'name':_0x249ae1['name_value_list'][_0x7a81('0x32')][_0x7a81('0x38')]});});}else{logger[_0x7a81('0xf')](_0x7a81('0x3b'));return BPromise[_0x7a81('0x37')]({'id':_0x249ae1[_0x7a81('0x36')][_0x7a81('0x3a')]['value'],'name':_0x249ae1[_0x7a81('0x36')][_0x7a81('0x32')][_0x7a81('0x38')]});}}function getEndUser(_0x5d7658,_0x3161fe,_0x414d1d,_0x3f91b0){logger[_0x7a81('0xf')]('Searching\x20enduser\x20with\x20phone',_0x414d1d);return request({'form':{'method':_0x7a81('0x3c'),'input_type':_0x7a81('0x25'),'response_type':_0x7a81('0x25'),'rest_data':JSON[_0x7a81('0x26')]({'session':_0x3f91b0['id'],'module_name':_0x7a81('0x1c'),'query':util['format'](_0x7a81('0x3d'),_0x414d1d),'order_by':'','offset':'0','select_fields':['id',_0x7a81('0x11'),_0x7a81('0x3e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7a81('0x33')](function(_0x23a747){if(_0x23a747[_0x7a81('0x35')][_0x7a81('0x1f')]){var _0x595b6a=_['find'](_0x23a747[_0x7a81('0x35')],function(_0x1b1ebd){return _0x1b1ebd['name_value_list'][_0x7a81('0x3e')][_0x7a81('0x38')]===_0x414d1d;});if(_0x595b6a){logger[_0x7a81('0xf')]('Enduser\x20found!');return BPromise[_0x7a81('0x37')]({'id':_0x595b6a[_0x7a81('0x36')]['id']['value'],'name':_0x595b6a[_0x7a81('0x36')][_0x7a81('0x11')][_0x7a81('0x38')],'phone':_0x595b6a['name_value_list'][_0x7a81('0x3e')][_0x7a81('0x38')]});}}else{logger['info'](_0x7a81('0x3f'));return request({'form':{'method':_0x7a81('0x24'),'input_type':_0x7a81('0x25'),'response_type':_0x7a81('0x25'),'rest_data':JSON[_0x7a81('0x26')]({'session':_0x3f91b0['id'],'module_name':_0x7a81('0x1c'),'name_value_list':[{'name':_0x7a81('0x40'),'value':_0x3161fe!==''?_0x3161fe:util['format'](_0x7a81('0x41'),_0x414d1d)},{'name':_0x7a81('0x3e'),'value':_0x414d1d}]})}})[_0x7a81('0x33')](function(_0x5092fc){logger[_0x7a81('0xf')](_0x7a81('0x42'));return BPromise[_0x7a81('0x37')]({'id':_0x5092fc['id'],'name':_0x5092fc[_0x7a81('0x35')][_0x7a81('0x40')]['value'],'phone':_0x5092fc[_0x7a81('0x35')][_0x7a81('0x3e')]['value']});});}});}function request(_0x611df){logger['debug']('[HTTP]',JSON[_0x7a81('0x26')](_0x611df));return rp(_[_0x7a81('0x43')](def,_0x611df));}function getTags(_0x36f97e,_0x3c186e){var _0x472f6b=[];if(_0x36f97e&&_0x36f97e[_0x7a81('0x1f')]>0x0){_0x472f6b=_[_0x7a81('0x44')](_0x36f97e,_0x3c186e);}return _0x472f6b;}function getCustomFields(_0x3ec075,_0x3ec3a7){var _0x1146e3=[];var _0x3cf0b6={'custom_fields':[]};if(_0x3ec075[_0x7a81('0x1f')]>0x0){_[_0x7a81('0x20')](_0x3ec075,function(_0x4878bd){if(_0x4878bd[_0x7a81('0x45')]===_0x7a81('0x46')&&_0x4878bd[_0x7a81('0x47')]&&!_0x4878bd[_0x7a81('0x48')]){_0x3cf0b6[_0x4878bd[_0x7a81('0x47')]['toLowerCase']()]=_0x4878bd[_0x7a81('0x49')][_0x7a81('0x2b')]();}else if(_0x4878bd[_0x7a81('0x45')]==='string'&&_0x4878bd[_0x7a81('0x23')]&&_0x4878bd[_0x7a81('0x48')]){_0x3cf0b6[_0x7a81('0x4a')][_0x7a81('0x22')]({'id':_0x4878bd[_0x7a81('0x23')],'value':_0x4878bd[_0x7a81('0x49')][_0x7a81('0x2b')]()});}else if(_0x4878bd['type']===_0x7a81('0x4b')&&_0x4878bd[_0x7a81('0x21')]&&_0x4878bd[_0x7a81('0x23')]&&_0x4878bd[_0x7a81('0x48')]){_0x3ec3a7[_0x4878bd[_0x7a81('0x21')]]&&_0x3cf0b6[_0x7a81('0x4a')]['push']({'id':_0x4878bd['idField'],'value':_0x3ec3a7[_0x4878bd[_0x7a81('0x21')]][_0x7a81('0x2b')]()});}else if(_0x4878bd[_0x7a81('0x45')]===_0x7a81('0x4c')&&_0x4878bd['Variable']&&_0x4878bd[_0x7a81('0x4d')][_0x7a81('0x11')]&&_0x4878bd[_0x7a81('0x23')]&&_0x4878bd[_0x7a81('0x48')]){_0x3ec3a7[_0x4878bd[_0x7a81('0x4d')]['name']['toLowerCase']()]&&_0x3cf0b6[_0x7a81('0x4a')][_0x7a81('0x22')]({'id':_0x4878bd[_0x7a81('0x23')],'value':_0x3ec3a7[_0x4878bd['Variable'][_0x7a81('0x11')][_0x7a81('0x4e')]()][_0x7a81('0x2b')]()});}});}return _0x3cf0b6;}function getConnection(_0x1d4f8d){return request({'method':'POST','form':{'method':_0x7a81('0x4f'),'input_type':_0x7a81('0x25'),'response_type':'JSON','rest_data':JSON[_0x7a81('0x26')]({'user_auth':{'user_name':_0x1d4f8d[_0x7a81('0x50')],'password':_0x1d4f8d['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x7a81('0x33')](function(_0x4ed2c4){var _0x4aa184=_0x4ed2c4;if(_0x4aa184['id']){def[_0x7a81('0x51')]=_0x4aa184['id'];return BPromise[_0x7a81('0x37')](_0x4aa184);}else{throw new Error(util[_0x7a81('0x28')](_0x7a81('0x52'),_0x1d4f8d['id']));}});}function setRelationship(_0x3f4e75,_0x5ef130,_0x49eaa1,_0x46d597){return request({'form':{'method':_0x7a81('0x53'),'input_type':'JSON','response_type':_0x7a81('0x25'),'rest_data':JSON['stringify']({'session':_0x3f4e75['id'],'module_name':_0x7a81('0x27'),'module_id':_0x49eaa1['id'],'link_field_name':_0x46d597,'related_ids':[_0x5ef130['id']]})}});}exports[_0x7a81('0x54')]=function(_0xd2b77e,_0x55356f,_0x2eca87,_0x87c409,_0x2e5e34,_0x17defa){var _0x329285,_0x4f53a3,_0x743a0b,_0x1080ac;_0x17defa['remoteUri']=intUtil[_0x7a81('0x55')](_0x17defa[_0x7a81('0x56')]);_0x17defa[_0x7a81('0x57')]=intUtil[_0x7a81('0x55')](_0x17defa[_0x7a81('0x57')]);def[_0x7a81('0x58')]=util[_0x7a81('0x28')](_0x7a81('0x59'),_0x17defa['remoteUri']);if(_0x2e5e34&&_0x2e5e34[_0x7a81('0x5a')]){logger[_0x7a81('0xf')](_0x7a81('0x5b'),'Recording\x20is\x20enabled!');_0x55356f['recordingURL']=util[_0x7a81('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17defa[_0x7a81('0x57')],_0x55356f['uniqueid'],md5(_0x55356f[_0x7a81('0x5c')]));}else{_0x55356f[_0x7a81('0x5d')]='';}return getConnection(_0x17defa)['then'](function(_0x41e913){_0x1080ac=_0x41e913;return getUser(_0x17defa,_0x87c409['name'],_0x1080ac);})[_0x7a81('0x33')](function(_0x2a5acd){_0x329285=_0x2a5acd;logger['info']('The\x20User\x20ID\x20is:',_0x329285['id']);return getEndUser(_0x17defa,_0x55356f['calleridname'],_0x55356f['calleridnum'],_0x1080ac);})['then'](function(_0x13dd50){_0x4f53a3=_0x13dd50;logger[_0x7a81('0xf')](_0x7a81('0x5e'),_0x4f53a3['id']);return getTicket(_0x17defa,_0x329285,_0x4f53a3,_0x2eca87,_0x55356f,_0x2eca87['Fields'],_0x1080ac,_0x7a81('0x5f'));})[_0x7a81('0x33')](function(_0x597e13){_0x743a0b=_0x597e13;logger[_0x7a81('0xf')]('Ticket\x20created!');logger['info'](_0x7a81('0x60'),_0x743a0b['id']);return setRelationship(_0x1080ac,_0x329285,_0x743a0b,'users');})[_0x7a81('0x33')](function(){return setRelationship(_0x1080ac,_0x4f53a3,_0x743a0b,_0x7a81('0x61'));})[_0x7a81('0x33')](function(){return getServerInfo(_0x1080ac);})[_0x7a81('0x33')](function(_0x32a918){var _0x5b9f4a=parseInt(_0x32a918[_0x7a81('0x62')]['charAt'](0x0));var _0x416851=util[_0x7a81('0x28')](_0x7a81('0x63'),_0x17defa[_0x7a81('0x56')],_0x743a0b['id']);if(_0x5b9f4a>0x6){_0x416851=util[_0x7a81('0x28')](_0x7a81('0x64'),_0x17defa[_0x7a81('0x56')],_0x743a0b['id']);}logger[_0x7a81('0xf')](_0x7a81('0x5b'),_0x7a81('0x65'));emit(util['format'](_0x7a81('0x66'),_0x87c409[_0x7a81('0x11')]),_0x7a81('0x67'),{'uri':_0x416851});})['catch'](function(_0x4470c6){logger[_0x7a81('0x68')](_0x7a81('0x5b'),JSON[_0x7a81('0x26')](_0x4470c6));});};exports['outbound']=function(_0x441738,_0x24c5c0,_0x3a6b0f,_0x3115e2,_0x4ce0cb,_0x4dc124,_0x56fea2){var _0x228f7e,_0xcce3b0,_0x26d00b,_0x6b5f4e;_0x4dc124[_0x7a81('0x56')]=intUtil['stripTrailingSlash'](_0x4dc124[_0x7a81('0x56')]);_0x4dc124[_0x7a81('0x57')]=intUtil['stripTrailingSlash'](_0x4dc124['serverUrl']);def[_0x7a81('0x58')]=util[_0x7a81('0x28')](_0x7a81('0x59'),_0x4dc124[_0x7a81('0x56')]);if(_0x56fea2&&_0x56fea2[_0x7a81('0x69')]&&_0x56fea2[_0x7a81('0x69')]!==_0x7a81('0x6a')){logger['info'](_0x7a81('0x6b'),_0x7a81('0x6c'));_0x24c5c0[_0x7a81('0x5d')]=util[_0x7a81('0x28')](_0x7a81('0x6d'),_0x4dc124[_0x7a81('0x57')],_0x24c5c0['uniqueid'],md5(_0x24c5c0[_0x7a81('0x5c')]));}return getConnection(_0x4dc124)['then'](function(_0x415554){_0x6b5f4e=_0x415554;return getUser(_0x4dc124,_0x3115e2[_0x7a81('0x11')],_0x6b5f4e);})[_0x7a81('0x33')](function(_0x3db2b1){_0x228f7e=_0x3db2b1;logger[_0x7a81('0xf')](_0x7a81('0x6e'),_0x228f7e['id']);return getEndUser(_0x4dc124,_0x24c5c0['destcalleridname'],_0x24c5c0['destcalleridnum'],_0x6b5f4e);})[_0x7a81('0x33')](function(_0x4c9bc6){_0xcce3b0=_0x4c9bc6;logger[_0x7a81('0xf')](_0x7a81('0x5e'),_0xcce3b0['id']);return getTicket(_0x4dc124,_0x228f7e,_0xcce3b0,_0x3a6b0f,_0x24c5c0,_0x3a6b0f[_0x7a81('0x6f')],_0x6b5f4e,_0x7a81('0x70'));})[_0x7a81('0x33')](function(_0x20a5c8){_0x26d00b=_0x20a5c8;logger[_0x7a81('0xf')](_0x7a81('0x71'));logger[_0x7a81('0xf')](_0x7a81('0x60'),_0x26d00b['id']);return setRelationship(_0x6b5f4e,_0x228f7e,_0x26d00b,'users');})['then'](function(){return setRelationship(_0x6b5f4e,_0xcce3b0,_0x26d00b,'contacts');})[_0x7a81('0x33')](function(){return getServerInfo(_0x6b5f4e);})[_0x7a81('0x33')](function(_0x2417b4){var _0x347b71=parseInt(_0x2417b4['version'][_0x7a81('0x72')](0x0));var _0x21963a=util[_0x7a81('0x28')](_0x7a81('0x63'),_0x4dc124[_0x7a81('0x56')],_0x26d00b['id']);if(_0x347b71>0x6){_0x21963a=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4dc124[_0x7a81('0x56')],_0x26d00b['id']);}logger[_0x7a81('0xf')](_0x7a81('0x6b'),_0x7a81('0x65'));emit(util[_0x7a81('0x28')](_0x7a81('0x66'),_0x3115e2[_0x7a81('0x11')]),'trigger:browser:url',{'uri':_0x21963a});})[_0x7a81('0x73')](function(_0x5e25a4){logger[_0x7a81('0x68')](_0x7a81('0x6b'),JSON[_0x7a81('0x26')](_0x5e25a4));});};exports[_0x7a81('0x74')]=function(_0x250990,_0x509972,_0x33a9ea,_0x16c859,_0x10156e,_0x5522a7){var _0x4ae56c,_0x374911,_0x1f651c,_0x504e1c;_0x5522a7[_0x7a81('0x56')]=intUtil[_0x7a81('0x55')](_0x5522a7[_0x7a81('0x56')]);_0x5522a7['serverUrl']=intUtil[_0x7a81('0x55')](_0x5522a7[_0x7a81('0x57')]);def[_0x7a81('0x58')]=util[_0x7a81('0x28')](_0x7a81('0x59'),_0x5522a7[_0x7a81('0x56')]);if(_0x10156e&&_0x10156e[_0x7a81('0x5a')]){logger[_0x7a81('0xf')]('['+_0x509972[_0x7a81('0x75')]['toUpperCase']()+']',_0x7a81('0x6c'));_0x509972[_0x7a81('0x5d')]=util[_0x7a81('0x28')](_0x7a81('0x6d'),_0x5522a7[_0x7a81('0x57')],_0x509972[_0x7a81('0x5c')],md5(_0x509972[_0x7a81('0x5c')]));}else{_0x509972[_0x7a81('0x5d')]='';}return getConnection(_0x5522a7)[_0x7a81('0x33')](function(_0x55d2bc){_0x504e1c=_0x55d2bc;if(!_[_0x7a81('0x2e')](_0x16c859)){return getUser(_0x5522a7,_0x16c859[_0x7a81('0x11')],_0x504e1c);}else{return getUser(_0x5522a7,null,_0x504e1c);}})['then'](function(_0x54cfd1){_0x4ae56c=_0x54cfd1;logger[_0x7a81('0xf')](_0x7a81('0x6e'),_0x4ae56c['id']);return getEndUser(_0x5522a7,_0x509972[_0x7a81('0x76')],_0x509972['calleridnum'],_0x504e1c);})[_0x7a81('0x33')](function(_0x32fb04){_0x374911=_0x32fb04;logger['info'](_0x7a81('0x5e'),_0x374911['id']);return getTicket(_0x5522a7,_0x4ae56c,_0x374911,_0x33a9ea,_0x509972,_0x33a9ea[_0x7a81('0x6f')],_0x504e1c,'Inbound');})['then'](function(_0x546112){_0x1f651c=_0x546112;logger[_0x7a81('0xf')](_0x7a81('0x71'));logger[_0x7a81('0xf')](_0x7a81('0x60'),_0x1f651c['id']);return setRelationship(_0x504e1c,_0x4ae56c,_0x1f651c,_0x7a81('0x77'));})[_0x7a81('0x33')](function(){return setRelationship(_0x504e1c,_0x374911,_0x1f651c,_0x7a81('0x61'));})[_0x7a81('0x33')](function(){return getServerInfo(_0x504e1c);})[_0x7a81('0x73')](function(_0x382835){logger['error']('['+_0x509972['lastevent'][_0x7a81('0x78')]()+']',JSON[_0x7a81('0x26')](_0x382835));});}; \ 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 eb13504..f335470 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 _0xff28=['push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','validateEmail','test','util','length','sortBy','type','string'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xff28,0xd3));var _0x8ff2=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0xff28[_0x48f7cf];return _0xc201c0;};'use strict';var _=require('lodash');var util=require(_0x8ff2('0x0'));exports['getString']=function(_0xd2f6ab,_0x5f0fbd,_0xa15b82){var _0x42a4a4=[];if(_0xd2f6ab[_0x8ff2('0x1')]>0x0){var _0x3b9ce4=_[_0x8ff2('0x2')](_0xd2f6ab,['id']);for(var _0x57e2ba=0x0;_0x57e2ba<_0x3b9ce4['length'];_0x57e2ba++){var _0xe69a2d=_0x3b9ce4[_0x57e2ba];if(_0xe69a2d[_0x8ff2('0x3')]===_0x8ff2('0x4')){_0x42a4a4[_0x8ff2('0x5')](_0xe69a2d['content']);}else if(_0xe69a2d['type']===_0x8ff2('0x6')&&_0xe69a2d['variableName']){_0x5f0fbd[_0xe69a2d[_0x8ff2('0x7')]]&&_0x42a4a4[_0x8ff2('0x5')](_0x5f0fbd[_0xe69a2d['variableName']][_0x8ff2('0x8')]());}else if(_0xe69a2d[_0x8ff2('0x3')]===_0x8ff2('0x9')&&_0xe69a2d['Variable']&&_0xe69a2d[_0x8ff2('0xa')][_0x8ff2('0xb')]){_0x5f0fbd[_0xe69a2d[_0x8ff2('0xa')]['name'][_0x8ff2('0xc')]()]&&_0x42a4a4[_0x8ff2('0x5')](_0x5f0fbd[_0xe69a2d['Variable']['name'][_0x8ff2('0xc')]()][_0x8ff2('0x8')]());}else if(_0xe69a2d[_0x8ff2('0x3')]===_0x8ff2('0xd')){if(_0xe69a2d[_0x8ff2('0xe')]==='string'&&_0xe69a2d[_0x8ff2('0xf')]){_0x42a4a4['push'](util[_0x8ff2('0x10')](_0x8ff2('0x11'),_0xe69a2d[_0x8ff2('0xf')],_0xe69a2d['keyContent']));}else if(_0xe69a2d[_0x8ff2('0xe')]==='variable'&&_0xe69a2d['variableName']&&_0xe69a2d[_0x8ff2('0xf')]){_0x5f0fbd[_0xe69a2d[_0x8ff2('0x7')]]&&_0x42a4a4[_0x8ff2('0x5')](util[_0x8ff2('0x10')]('%s:\x20%s',_0xe69a2d[_0x8ff2('0xf')],_0x5f0fbd[_0xe69a2d[_0x8ff2('0x7')]]));}else if(_0xe69a2d[_0x8ff2('0xe')]==='customVariable'&&_0xe69a2d['Variable']&&_0xe69a2d[_0x8ff2('0xa')][_0x8ff2('0xb')]&&_0xe69a2d[_0x8ff2('0xf')]){_0x5f0fbd[_0xe69a2d['Variable']['name'][_0x8ff2('0xc')]()]&&_0x42a4a4[_0x8ff2('0x5')](util['format'](_0x8ff2('0x11'),_0xe69a2d[_0x8ff2('0xf')],_0x5f0fbd[_0xe69a2d[_0x8ff2('0xa')][_0x8ff2('0xb')][_0x8ff2('0xc')]()]));}}}}return _0x42a4a4[_0x8ff2('0x12')](_0xa15b82);};exports[_0x8ff2('0x13')]=function(_0x37a8d1){var _0x3400e5=_0x37a8d1[_0x8ff2('0x14')](-0x1);if(_0x3400e5==='/'){_0x37a8d1=_0x37a8d1[_0x8ff2('0x15')](0x0,_0x37a8d1['lastIndexOf'](_0x3400e5));}return _0x37a8d1;};exports[_0x8ff2('0x16')]=function(_0x4fdd30){if(!_['isNil'](_0x4fdd30)&&_0x4fdd30!==''){var _0x90707f=/^(([^<>()\[\]\\.,;:\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 _0x90707f[_0x8ff2('0x17')](String(_0x4fdd30)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xcf9d=['Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','slice','substring','validateEmail','test','util','length','type','string','push','variable','variableName','toString','customVariable'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xcf9d,0x1af));var _0xdcf9=function(_0x1fec65,_0x22dc2f){_0x1fec65=_0x1fec65-0x0;var _0x2aa11d=_0xcf9d[_0x1fec65];return _0x2aa11d;};'use strict';var _=require('lodash');var util=require(_0xdcf9('0x0'));exports['getString']=function(_0x1b7ef9,_0x1eac19,_0x2d7d0b){var _0x546945=[];if(_0x1b7ef9[_0xdcf9('0x1')]>0x0){var _0x5119dc=_['sortBy'](_0x1b7ef9,['id']);for(var _0x4c079c=0x0;_0x4c079c<_0x5119dc['length'];_0x4c079c++){var _0xf404bd=_0x5119dc[_0x4c079c];if(_0xf404bd[_0xdcf9('0x2')]===_0xdcf9('0x3')){_0x546945[_0xdcf9('0x4')](_0xf404bd['content']);}else if(_0xf404bd[_0xdcf9('0x2')]===_0xdcf9('0x5')&&_0xf404bd[_0xdcf9('0x6')]){_0x1eac19[_0xf404bd[_0xdcf9('0x6')]]&&_0x546945[_0xdcf9('0x4')](_0x1eac19[_0xf404bd[_0xdcf9('0x6')]][_0xdcf9('0x7')]());}else if(_0xf404bd[_0xdcf9('0x2')]===_0xdcf9('0x8')&&_0xf404bd[_0xdcf9('0x9')]&&_0xf404bd[_0xdcf9('0x9')]['name']){_0x1eac19[_0xf404bd[_0xdcf9('0x9')][_0xdcf9('0xa')]['toLowerCase']()]&&_0x546945['push'](_0x1eac19[_0xf404bd[_0xdcf9('0x9')][_0xdcf9('0xa')][_0xdcf9('0xb')]()][_0xdcf9('0x7')]());}else if(_0xf404bd['type']===_0xdcf9('0xc')){if(_0xf404bd[_0xdcf9('0xd')]===_0xdcf9('0x3')&&_0xf404bd[_0xdcf9('0xe')]){_0x546945[_0xdcf9('0x4')](util[_0xdcf9('0xf')]('%s:\x20%s',_0xf404bd[_0xdcf9('0xe')],_0xf404bd['keyContent']));}else if(_0xf404bd[_0xdcf9('0xd')]===_0xdcf9('0x5')&&_0xf404bd[_0xdcf9('0x6')]&&_0xf404bd[_0xdcf9('0xe')]){_0x1eac19[_0xf404bd['variableName']]&&_0x546945[_0xdcf9('0x4')](util[_0xdcf9('0xf')](_0xdcf9('0x10'),_0xf404bd['key'],_0x1eac19[_0xf404bd[_0xdcf9('0x6')]]));}else if(_0xf404bd['keyType']===_0xdcf9('0x8')&&_0xf404bd['Variable']&&_0xf404bd[_0xdcf9('0x9')][_0xdcf9('0xa')]&&_0xf404bd[_0xdcf9('0xe')]){_0x1eac19[_0xf404bd[_0xdcf9('0x9')][_0xdcf9('0xa')][_0xdcf9('0xb')]()]&&_0x546945[_0xdcf9('0x4')](util['format'](_0xdcf9('0x10'),_0xf404bd[_0xdcf9('0xe')],_0x1eac19[_0xf404bd[_0xdcf9('0x9')][_0xdcf9('0xa')][_0xdcf9('0xb')]()]));}}}}return _0x546945[_0xdcf9('0x11')](_0x2d7d0b);};exports['stripTrailingSlash']=function(_0x5eb494){var _0x3cabfe=_0x5eb494[_0xdcf9('0x12')](-0x1);if(_0x3cabfe==='/'){_0x5eb494=_0x5eb494[_0xdcf9('0x13')](0x0,_0x5eb494['lastIndexOf'](_0x3cabfe));}return _0x5eb494;};exports[_0xdcf9('0x14')]=function(_0x2c4397){if(!_['isNil'](_0x2c4397)&&_0x2c4397!==''){var _0x21668d=/^(([^<>()\[\]\\.,;:\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 _0x21668d[_0xdcf9('0x15')](String(_0x2c4397)['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 6af4cd4..ac0ad1a 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 _0x6bc4=['../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','emit','length','forEach','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','format','%s/webservice.php','remoteUri','create','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','resolve','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','sessionName','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','lastname','POST','Contacts','Enduser\x20created.','phone','GET','getchallenge','getConnection','[HTTP]','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','email','destcalleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','toUpperCase','lodash','request-promise','util','ioredis'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x6bc4,0x1c3));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x46bc('0x0'));var rp=require(_0x46bc('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x46bc('0x2'));var Redis=require(_0x46bc('0x3'));var intUtil=require('./util');var config=require(_0x46bc('0x4'));var logger=require(_0x46bc('0x5'))(_0x46bc('0x6'));config['redis']=_[_0x46bc('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x46bc('0x8')]));function emit(_0x58e98e,_0x3e9cbd,_0x244050){io['to'](_0x58e98e)[_0x46bc('0x9')](_0x3e9cbd,_0x244050);}function getCustomFields(_0x448654,_0x4d7bdc){var _0x3ea31b={};if(_0x448654[_0x46bc('0xa')]>0x0){_[_0x46bc('0xb')](_0x448654,function(_0x2fa5fe){if(_0x2fa5fe[_0x46bc('0xc')]==='string'&&_0x2fa5fe[_0x46bc('0xd')]){_0x3ea31b[_0x2fa5fe[_0x46bc('0xd')]]=_0x2fa5fe[_0x46bc('0xe')]['toString']();}else if(_0x2fa5fe[_0x46bc('0xc')]===_0x46bc('0xf')&&_0x2fa5fe[_0x46bc('0x10')]&&_0x2fa5fe[_0x46bc('0xd')]&&_0x4d7bdc[_0x2fa5fe[_0x46bc('0x10')]]){_0x3ea31b[_0x2fa5fe[_0x46bc('0xd')]]=_0x4d7bdc[_0x2fa5fe['variableName']][_0x46bc('0x11')]();}else if(_0x2fa5fe[_0x46bc('0xc')]===_0x46bc('0x12')&&_0x2fa5fe[_0x46bc('0x13')]&&_0x2fa5fe[_0x46bc('0x13')]['name']&&_0x2fa5fe['idField']&&_0x4d7bdc[_0x2fa5fe[_0x46bc('0x13')][_0x46bc('0x14')]['toLowerCase']()]){_0x3ea31b[_0x2fa5fe[_0x46bc('0xd')]]=_0x4d7bdc[_0x2fa5fe[_0x46bc('0x13')][_0x46bc('0x14')][_0x46bc('0x15')]()][_0x46bc('0x11')]();}});}return _0x3ea31b;}function createTicket(_0xf68ef6,_0x261cc3,_0x107d3b,_0x56d32d,_0x445915,_0x335dd0,_0x4c6fe9){logger[_0x46bc('0x16')](_0x46bc('0x17'));var _0xac5fd3=_[_0x46bc('0x18')]({'parent_id':'','assigned_user_id':_0x261cc3['id'],'ticketpriorities':_0x46bc('0x19'),'ticketstatus':_0x46bc('0x1a'),'ticket_title':intUtil[_0x46bc('0x1b')](_0x56d32d['Subjects'],_0x445915,'\x20'),'description':intUtil[_0x46bc('0x1b')](_0x56d32d['Descriptions'],_0x445915,'\x0a'),'contact_id':_0x107d3b['id']},getCustomFields(_0x335dd0,_0x445915));var _0xf21a72={'method':'POST','uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0xf68ef6[_0x46bc('0x1e')]),'form':{'operation':_0x46bc('0x1f'),'username':_0xf68ef6['username'],'sessionName':_0x4c6fe9['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0xac5fd3)},'json':!![]};return request(_0xf21a72)[_0x46bc('0x20')](function(_0x146af7){if(_0x146af7['success']){return BPromise['resolve']({'id':_0x146af7[_0x46bc('0x21')]['id']});}else{throw new Error(util[_0x46bc('0x1c')](_0x46bc('0x22'),JSON[_0x46bc('0x23')](_0x146af7[_0x46bc('0x24')])));}})[_0x46bc('0x25')](function(_0x3ddb2c){var _0x26f24f=_0x3ddb2c[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')]('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x26f24f,JSON[_0x46bc('0x23')](_0x3ddb2c));});}function getUser(_0x231854,_0x57e3d4,_0x190a95){if(intUtil['validateEmail'](_0x57e3d4)){logger[_0x46bc('0x16')]('Getting\x20agent\x20with\x20email',_0x57e3d4);return request({'method':'GET','uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0x231854[_0x46bc('0x1e')]),'qs':{'operation':_0x46bc('0x27'),'username':_0x231854[_0x46bc('0x28')],'sessionName':_0x190a95['sessionName'],'query':util[_0x46bc('0x1c')](_0x46bc('0x29'),_0x57e3d4)},'json':!![]})[_0x46bc('0x20')](function(_0xf0a0e8){if(_0xf0a0e8[_0x46bc('0x2a')]&&_0xf0a0e8[_0x46bc('0x21')]['length']){logger[_0x46bc('0x16')](_0x46bc('0x2b'));return BPromise[_0x46bc('0x2c')]({'id':_0xf0a0e8[_0x46bc('0x21')][0x0]['id'],'email':_0xf0a0e8[_0x46bc('0x21')][0x0][_0x46bc('0x2d')],'name':_0xf0a0e8['result'][0x0][_0x46bc('0x2e')]+'\x20'+_0xf0a0e8[_0x46bc('0x21')][_0x46bc('0x2f')]});}else{logger[_0x46bc('0x16')](_0x46bc('0x30'));return BPromise[_0x46bc('0x2c')]({'id':_0x190a95[_0x46bc('0x31')],'email':_0x231854[_0x46bc('0x28')],'name':_0x46bc('0x32')});}})[_0x46bc('0x25')](function(_0x91a66d){var _0x1af4bb=_0x91a66d[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')](_0x46bc('0x33'),_0x46bc('0x34'),_0x1af4bb,JSON[_0x46bc('0x23')](_0x91a66d));});}else{logger[_0x46bc('0x16')](_0x46bc('0x30'));return BPromise['resolve']({'id':_0x190a95[_0x46bc('0x31')],'email':_0x231854['username'],'name':'admin'})[_0x46bc('0x25')](function(_0x4a3b05){var _0x4af885=_0x4a3b05[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')](_0x46bc('0x33'),'getUser',_0x4af885,JSON[_0x46bc('0x23')](_0x4a3b05));});}}function getEndUser(_0x2b9667,_0x1616ec,_0x12aeff,_0x18e789){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x12aeff);return request({'method':'GET','uri':util[_0x46bc('0x1c')]('%s/webservice.php',_0x2b9667['remoteUri']),'qs':{'operation':_0x46bc('0x27'),'username':_0x2b9667['username'],'sessionName':_0x18e789[_0x46bc('0x35')],'query':util['format'](_0x46bc('0x36'),_0x12aeff,_0x12aeff,_0x12aeff,_0x12aeff,_0x12aeff)},'json':!![]})[_0x46bc('0x20')](function(_0x32048f){if(_0x32048f[_0x46bc('0x2a')]&&_0x32048f[_0x46bc('0x21')][_0x46bc('0xa')]){logger[_0x46bc('0x16')](_0x46bc('0x37'));return BPromise[_0x46bc('0x2c')]({'id':_0x32048f[_0x46bc('0x21')][0x0]['id'],'name':_0x32048f[_0x46bc('0x21')][0x0]['firstname']+'\x20'+_0x32048f['result'][0x0][_0x46bc('0x38')],'phone':_0x12aeff});}else{logger[_0x46bc('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x46bc('0x39'),'uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0x2b9667[_0x46bc('0x1e')]),'form':{'operation':_0x46bc('0x1f'),'sessionName':_0x18e789[_0x46bc('0x35')],'elementType':_0x46bc('0x3a'),'element':JSON[_0x46bc('0x23')]({'lastname':_0x1616ec,'phone':_0x12aeff,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x50e5a4){logger[_0x46bc('0x16')](_0x46bc('0x3b'));return BPromise[_0x46bc('0x2c')]({'id':_0x50e5a4[_0x46bc('0x21')]['id'],'name':_0x50e5a4['result'][_0x46bc('0x38')],'phone':_0x50e5a4['result'][_0x46bc('0x3c')]});})[_0x46bc('0x25')](function(_0xbbb7c3){var _0x26a1fb=_0xbbb7c3[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')](_0x46bc('0x33'),'getEndUser',_0x26a1fb,JSON[_0x46bc('0x23')](_0xbbb7c3));});}});}function getConnection(_0x280122){var _0x3ceef2=_0x280122[_0x46bc('0x28')];var _0x28af21=_0x280122['accessKey'];return request({'method':_0x46bc('0x3d'),'uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0x280122[_0x46bc('0x1e')]),'qs':{'operation':_0x46bc('0x3e'),'username':_0x3ceef2},'json':!![]})[_0x46bc('0x20')](function(_0x384984){if(_0x384984[_0x46bc('0x2a')]){return request({'method':_0x46bc('0x39'),'uri':util[_0x46bc('0x1c')](_0x46bc('0x1d'),_0x280122[_0x46bc('0x1e')]),'form':{'operation':'login','username':_0x3ceef2,'accessKey':md5(_0x384984[_0x46bc('0x21')]['token']+_0x28af21)},'json':!![]});}})['then'](function(_0xdee44){if(_0xdee44['success']){return BPromise[_0x46bc('0x2c')](_0xdee44[_0x46bc('0x21')]);}else{throw new Error(util[_0x46bc('0x1c')]('Account\x20%d\x20is\x20not\x20valid',_0x280122['id']));}})[_0x46bc('0x25')](function(_0x1917c6){var _0x36cba7=_0x1917c6[_0x46bc('0x26')]||0x1f4;logger[_0x46bc('0x24')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x46bc('0x3f'),_0x36cba7,JSON[_0x46bc('0x23')](_0x1917c6));});}function request(_0x41a855){logger[_0x46bc('0x16')](_0x46bc('0x40'),JSON[_0x46bc('0x23')](_0x41a855));return rp(_0x41a855);}exports['queue']=function(_0x62bebb,_0x3c7afb,_0x5f42e9,_0x31144b,_0x55d7a0,_0x40dbf8){var _0x7e5230,_0x569082,_0x3377b3,_0x376dc8;_0x40dbf8['remoteUri']=intUtil[_0x46bc('0x41')](_0x40dbf8['remoteUri']);if(_0x55d7a0&&_0x55d7a0[_0x46bc('0x42')]){logger[_0x46bc('0x16')]('[QUEUE]',_0x46bc('0x43'));_0x3c7afb[_0x46bc('0x44')]=util[_0x46bc('0x1c')](_0x46bc('0x45'),_0x40dbf8[_0x46bc('0x46')],_0x3c7afb[_0x46bc('0x47')],md5(_0x3c7afb[_0x46bc('0x47')]));}else{_0x3c7afb[_0x46bc('0x44')]='';}return getConnection(_0x40dbf8)[_0x46bc('0x20')](function(_0x2c8e3a){_0x376dc8=_0x2c8e3a;return getUser(_0x40dbf8,_0x31144b['email'],_0x376dc8);})[_0x46bc('0x20')](function(_0x253169){_0x7e5230=_0x253169;logger['info'](_0x46bc('0x48'),_0x7e5230['id']);return getEndUser(_0x40dbf8,_0x3c7afb[_0x46bc('0x49')],_0x3c7afb[_0x46bc('0x4a')],_0x376dc8);})[_0x46bc('0x20')](function(_0x42d3b3){_0x569082=_0x42d3b3;logger['info'](_0x46bc('0x4b'),_0x569082['id']);return createTicket(_0x40dbf8,_0x7e5230,_0x569082,_0x5f42e9,_0x3c7afb,_0x5f42e9['Fields'],_0x376dc8);})[_0x46bc('0x20')](function(_0x5916d9){_0x3377b3=_0x5916d9;logger['info']('Ticket\x20created!');logger[_0x46bc('0x16')]('The\x20Ticket\x20ID\x20is:',_0x3377b3['id']);var _0x3a7dfe=util[_0x46bc('0x1c')](_0x46bc('0x4c'),_0x40dbf8[_0x46bc('0x1e')],_[_0x46bc('0x4d')](_0x3377b3['id'],'x')[0x1]);logger[_0x46bc('0x16')](_0x46bc('0x4e'),_0x46bc('0x4f'));emit(util[_0x46bc('0x1c')](_0x46bc('0x50'),_0x31144b['name']),_0x46bc('0x51'),{'uri':_0x3a7dfe});})['catch'](function(_0x3095ff){logger[_0x46bc('0x24')](_0x46bc('0x4e'),JSON[_0x46bc('0x23')](_0x3095ff));});};exports[_0x46bc('0x52')]=function(_0x424456,_0x136e83,_0x2760a0,_0x380ded,_0x19e090,_0x109923,_0x41ea6e){var _0x2c6162,_0x524ec2,_0x3bc913,_0x52ef9a;_0x109923[_0x46bc('0x1e')]=intUtil[_0x46bc('0x41')](_0x109923[_0x46bc('0x1e')]);_0x109923[_0x46bc('0x46')]=intUtil[_0x46bc('0x41')](_0x109923[_0x46bc('0x46')]);if(_0x41ea6e&&_0x41ea6e['recordingFormat']&&_0x41ea6e[_0x46bc('0x53')]!=='none'){logger[_0x46bc('0x16')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x136e83[_0x46bc('0x44')]=util[_0x46bc('0x1c')](_0x46bc('0x45'),_0x109923[_0x46bc('0x46')],_0x136e83[_0x46bc('0x47')],md5(_0x136e83[_0x46bc('0x47')]));}return getConnection(_0x109923)['then'](function(_0x488ccf){_0x52ef9a=_0x488ccf;return getUser(_0x109923,_0x380ded[_0x46bc('0x54')],_0x52ef9a);})[_0x46bc('0x20')](function(_0xee7079){_0x2c6162=_0xee7079;logger['info']('The\x20User\x20ID\x20is:',_0x2c6162['id']);return getEndUser(_0x109923,_0x136e83['destcalleridname'],_0x136e83[_0x46bc('0x55')],_0x52ef9a);})[_0x46bc('0x20')](function(_0x1443a1){_0x524ec2=_0x1443a1;logger['info'](_0x46bc('0x4b'),_0x524ec2['id']);return createTicket(_0x109923,_0x2c6162,_0x524ec2,_0x2760a0,_0x136e83,_0x2760a0[_0x46bc('0x56')],_0x52ef9a);})[_0x46bc('0x20')](function(_0x52cb64){_0x3bc913=_0x52cb64;logger['info'](_0x46bc('0x57'));logger['info'](_0x46bc('0x58'),_0x3bc913['id']);var _0x5ca9bb=util[_0x46bc('0x1c')](_0x46bc('0x4c'),_0x109923[_0x46bc('0x1e')],_[_0x46bc('0x4d')](_0x3bc913['id'],'x')[0x1]);logger['info'](_0x46bc('0x59'),_0x46bc('0x4f'));emit(util[_0x46bc('0x1c')]('user:%s',_0x380ded[_0x46bc('0x14')]),_0x46bc('0x51'),{'uri':_0x5ca9bb});})[_0x46bc('0x25')](function(_0x3a7440){logger[_0x46bc('0x24')](_0x46bc('0x59'),JSON[_0x46bc('0x23')](_0x3a7440));});};exports['unmanaged']=function(_0x46f37a,_0x22c5fc,_0x5479c1,_0x25404b,_0x15d6c4,_0x1a74e6){var _0x1d29fe,_0x11d14f,_0x5d3be7,_0x2ee929;_0x1a74e6[_0x46bc('0x1e')]=intUtil['stripTrailingSlash'](_0x1a74e6['remoteUri']);_0x1a74e6[_0x46bc('0x46')]=intUtil[_0x46bc('0x41')](_0x1a74e6['serverUrl']);if(_0x15d6c4&&_0x15d6c4[_0x46bc('0x42')]){logger[_0x46bc('0x16')]('['+_0x22c5fc['lastevent'][_0x46bc('0x5a')]()+']',_0x46bc('0x43'));_0x22c5fc[_0x46bc('0x44')]=util[_0x46bc('0x1c')](_0x46bc('0x45'),_0x1a74e6[_0x46bc('0x46')],_0x22c5fc['uniqueid'],md5(_0x22c5fc[_0x46bc('0x47')]));}else{_0x22c5fc[_0x46bc('0x44')]='';}return getConnection(_0x1a74e6)[_0x46bc('0x20')](function(_0x9c4c6d){_0x2ee929=_0x9c4c6d;return getUser(_0x1a74e6,'',_0x2ee929);})[_0x46bc('0x20')](function(_0x1efb79){_0x1d29fe=_0x1efb79;logger[_0x46bc('0x16')]('The\x20User\x20ID\x20is:',_0x1d29fe['id']);return getEndUser(_0x1a74e6,_0x22c5fc['calleridname'],_0x22c5fc[_0x46bc('0x4a')],_0x2ee929);})[_0x46bc('0x20')](function(_0x3f9d41){_0x11d14f=_0x3f9d41;logger['info'](_0x46bc('0x4b'),_0x11d14f['id']);return createTicket(_0x1a74e6,_0x1d29fe,_0x11d14f,_0x5479c1,_0x22c5fc,_0x5479c1[_0x46bc('0x56')],_0x2ee929);})[_0x46bc('0x20')](function(_0x167118){_0x5d3be7=_0x167118;logger[_0x46bc('0x16')]('Ticket\x20created!');logger[_0x46bc('0x16')]('The\x20Ticket\x20ID\x20is:',_0x5d3be7['id']);})[_0x46bc('0x25')](function(_0x289a01){logger[_0x46bc('0x24')]('['+_0x22c5fc['lastevent'][_0x46bc('0x5a')]()+']',JSON['stringify'](_0x289a01));});}; \ No newline at end of file +var _0x6124=['The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridnum','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','defaults','redis','localhost','socket.io-emitter','emit','forEach','type','string','idField','content','variableName','toString','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Subjects','%s/webservice.php','create','HelpDesk','stringify','then','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','createTicket','validateEmail','GET','remoteUri','query','username','sessionName','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','length','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','phone','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridname'];(function(_0x10657d,_0x4d47c5){var _0x1a9577=function(_0x427f2c){while(--_0x427f2c){_0x10657d['push'](_0x10657d['shift']());}};_0x1a9577(++_0x4d47c5);}(_0x6124,0x7a));var _0x4612=function(_0x40cbc2,_0x398002){_0x40cbc2=_0x40cbc2-0x0;var _0x1fbe22=_0x6124[_0x40cbc2];return _0x1fbe22;};'use strict';var _=require(_0x4612('0x0'));var rp=require(_0x4612('0x1'));var BPromise=require(_0x4612('0x2'));var md5=require(_0x4612('0x3'));var util=require(_0x4612('0x4'));var Redis=require(_0x4612('0x5'));var intUtil=require(_0x4612('0x6'));var config=require(_0x4612('0x7'));var logger=require(_0x4612('0x8'))(_0x4612('0x9'));config['redis']=_[_0x4612('0xa')](config[_0x4612('0xb')],{'host':_0x4612('0xc'),'port':0x18eb});var io=require(_0x4612('0xd'))(new Redis(config['redis']));function emit(_0x4f6a76,_0x1e213f,_0x5ba7f2){io['to'](_0x4f6a76)[_0x4612('0xe')](_0x1e213f,_0x5ba7f2);}function getCustomFields(_0x435155,_0x178489){var _0x4ff446={};if(_0x435155['length']>0x0){_[_0x4612('0xf')](_0x435155,function(_0xca0374){if(_0xca0374[_0x4612('0x10')]===_0x4612('0x11')&&_0xca0374[_0x4612('0x12')]){_0x4ff446[_0xca0374[_0x4612('0x12')]]=_0xca0374[_0x4612('0x13')]['toString']();}else if(_0xca0374[_0x4612('0x10')]==='variable'&&_0xca0374[_0x4612('0x14')]&&_0xca0374[_0x4612('0x12')]&&_0x178489[_0xca0374[_0x4612('0x14')]]){_0x4ff446[_0xca0374[_0x4612('0x12')]]=_0x178489[_0xca0374[_0x4612('0x14')]][_0x4612('0x15')]();}else if(_0xca0374[_0x4612('0x10')]==='customVariable'&&_0xca0374[_0x4612('0x16')]&&_0xca0374[_0x4612('0x16')]['name']&&_0xca0374[_0x4612('0x12')]&&_0x178489[_0xca0374[_0x4612('0x16')][_0x4612('0x17')][_0x4612('0x18')]()]){_0x4ff446[_0xca0374[_0x4612('0x12')]]=_0x178489[_0xca0374[_0x4612('0x16')][_0x4612('0x17')][_0x4612('0x18')]()][_0x4612('0x15')]();}});}return _0x4ff446;}function createTicket(_0xf7ddab,_0x353368,_0x5d0683,_0x451bf7,_0x491348,_0x46c066,_0x31b0c3){logger[_0x4612('0x19')](_0x4612('0x1a'));var _0x52e310=_[_0x4612('0x1b')]({'parent_id':'','assigned_user_id':_0x353368['id'],'ticketpriorities':_0x4612('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x451bf7[_0x4612('0x1d')],_0x491348,'\x20'),'description':intUtil['getString'](_0x451bf7['Descriptions'],_0x491348,'\x0a'),'contact_id':_0x5d0683['id']},getCustomFields(_0x46c066,_0x491348));var _0x34a8d9={'method':'POST','uri':util['format'](_0x4612('0x1e'),_0xf7ddab['remoteUri']),'form':{'operation':_0x4612('0x1f'),'username':_0xf7ddab['username'],'sessionName':_0x31b0c3['sessionName'],'elementType':_0x4612('0x20'),'element':JSON[_0x4612('0x21')](_0x52e310)},'json':!![]};return request(_0x34a8d9)[_0x4612('0x22')](function(_0x5cb9ef){if(_0x5cb9ef[_0x4612('0x23')]){return BPromise[_0x4612('0x24')]({'id':_0x5cb9ef[_0x4612('0x25')]['id']});}else{throw new Error(util[_0x4612('0x26')](_0x4612('0x27'),JSON[_0x4612('0x21')](_0x5cb9ef['error'])));}})[_0x4612('0x28')](function(_0x3af661){var _0x1ba2ae=_0x3af661[_0x4612('0x29')]||0x1f4;logger[_0x4612('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x4612('0x2b'),_0x1ba2ae,JSON[_0x4612('0x21')](_0x3af661));});}function getUser(_0x5de33a,_0x96b411,_0x1fb9fb){if(intUtil[_0x4612('0x2c')](_0x96b411)){logger[_0x4612('0x19')]('Getting\x20agent\x20with\x20email',_0x96b411);return request({'method':_0x4612('0x2d'),'uri':util['format']('%s/webservice.php',_0x5de33a[_0x4612('0x2e')]),'qs':{'operation':_0x4612('0x2f'),'username':_0x5de33a[_0x4612('0x30')],'sessionName':_0x1fb9fb[_0x4612('0x31')],'query':util[_0x4612('0x26')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x96b411)},'json':!![]})['then'](function(_0x5e5d71){if(_0x5e5d71['success']&&_0x5e5d71[_0x4612('0x25')]['length']){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x5e5d71[_0x4612('0x25')][0x0]['id'],'email':_0x5e5d71['result'][0x0][_0x4612('0x32')],'name':_0x5e5d71['result'][0x0][_0x4612('0x33')]+'\x20'+_0x5e5d71[_0x4612('0x25')][_0x4612('0x34')]});}else{logger[_0x4612('0x19')](_0x4612('0x35'));return BPromise['resolve']({'id':_0x1fb9fb[_0x4612('0x36')],'email':_0x5de33a[_0x4612('0x30')],'name':_0x4612('0x37')});}})['catch'](function(_0x4e8249){var _0x340fbe=_0x4e8249['statusCode']||0x1f4;logger[_0x4612('0x2a')](_0x4612('0x38'),'getUser',_0x340fbe,JSON[_0x4612('0x21')](_0x4e8249));});}else{logger['info'](_0x4612('0x35'));return BPromise[_0x4612('0x24')]({'id':_0x1fb9fb[_0x4612('0x36')],'email':_0x5de33a[_0x4612('0x30')],'name':_0x4612('0x37')})['catch'](function(_0x599fd5){var _0x19eecd=_0x599fd5['statusCode']||0x1f4;logger[_0x4612('0x2a')](_0x4612('0x38'),_0x4612('0x39'),_0x19eecd,JSON[_0x4612('0x21')](_0x599fd5));});}}function getEndUser(_0x46ee02,_0x44b16c,_0x35056f,_0x460515){logger['info'](_0x4612('0x3a'),_0x35056f);return request({'method':_0x4612('0x2d'),'uri':util[_0x4612('0x26')](_0x4612('0x1e'),_0x46ee02[_0x4612('0x2e')]),'qs':{'operation':'query','username':_0x46ee02[_0x4612('0x30')],'sessionName':_0x460515[_0x4612('0x31')],'query':util[_0x4612('0x26')](_0x4612('0x3b'),_0x35056f,_0x35056f,_0x35056f,_0x35056f,_0x35056f)},'json':!![]})[_0x4612('0x22')](function(_0x49441c){if(_0x49441c[_0x4612('0x23')]&&_0x49441c[_0x4612('0x25')][_0x4612('0x3c')]){logger[_0x4612('0x19')](_0x4612('0x3d'));return BPromise[_0x4612('0x24')]({'id':_0x49441c[_0x4612('0x25')][0x0]['id'],'name':_0x49441c[_0x4612('0x25')][0x0][_0x4612('0x3e')]+'\x20'+_0x49441c['result'][0x0][_0x4612('0x3f')],'phone':_0x35056f});}else{logger['info'](_0x4612('0x40'));return request({'method':_0x4612('0x41'),'uri':util[_0x4612('0x26')](_0x4612('0x1e'),_0x46ee02[_0x4612('0x2e')]),'form':{'operation':_0x4612('0x1f'),'sessionName':_0x460515[_0x4612('0x31')],'elementType':'Contacts','element':JSON[_0x4612('0x21')]({'lastname':_0x44b16c,'phone':_0x35056f,'assigned_user_id':'\x20'})},'json':!![]})[_0x4612('0x22')](function(_0x303b2a){logger[_0x4612('0x19')](_0x4612('0x42'));return BPromise[_0x4612('0x24')]({'id':_0x303b2a[_0x4612('0x25')]['id'],'name':_0x303b2a[_0x4612('0x25')]['lastname'],'phone':_0x303b2a['result'][_0x4612('0x43')]});})[_0x4612('0x28')](function(_0x2ba4d9){var _0x382ee9=_0x2ba4d9[_0x4612('0x29')]||0x1f4;logger['error'](_0x4612('0x38'),'getEndUser',_0x382ee9,JSON[_0x4612('0x21')](_0x2ba4d9));});}});}function getConnection(_0x4d29e6){var _0x2112a1=_0x4d29e6[_0x4612('0x30')];var _0x953773=_0x4d29e6[_0x4612('0x44')];return request({'method':_0x4612('0x2d'),'uri':util[_0x4612('0x26')](_0x4612('0x1e'),_0x4d29e6[_0x4612('0x2e')]),'qs':{'operation':'getchallenge','username':_0x2112a1},'json':!![]})[_0x4612('0x22')](function(_0x345656){if(_0x345656[_0x4612('0x23')]){return request({'method':'POST','uri':util['format'](_0x4612('0x1e'),_0x4d29e6[_0x4612('0x2e')]),'form':{'operation':_0x4612('0x45'),'username':_0x2112a1,'accessKey':md5(_0x345656['result']['token']+_0x953773)},'json':!![]});}})[_0x4612('0x22')](function(_0x26df1b){if(_0x26df1b[_0x4612('0x23')]){return BPromise[_0x4612('0x24')](_0x26df1b[_0x4612('0x25')]);}else{throw new Error(util[_0x4612('0x26')](_0x4612('0x46'),_0x4d29e6['id']));}})[_0x4612('0x28')](function(_0x3e2562){var _0x1ea2f8=_0x3e2562[_0x4612('0x29')]||0x1f4;logger[_0x4612('0x2a')](_0x4612('0x38'),_0x4612('0x47'),_0x1ea2f8,JSON[_0x4612('0x21')](_0x3e2562));});}function request(_0x351657){logger[_0x4612('0x19')](_0x4612('0x48'),JSON['stringify'](_0x351657));return rp(_0x351657);}exports[_0x4612('0x49')]=function(_0x4c588e,_0xbc2885,_0x584497,_0x13488a,_0x10eacf,_0x3c68d4){var _0x235270,_0x3326c2,_0x3dd76b,_0x156c0e;_0x3c68d4[_0x4612('0x2e')]=intUtil['stripTrailingSlash'](_0x3c68d4['remoteUri']);if(_0x10eacf&&_0x10eacf[_0x4612('0x4a')]){logger[_0x4612('0x19')](_0x4612('0x4b'),_0x4612('0x4c'));_0xbc2885[_0x4612('0x4d')]=util['format'](_0x4612('0x4e'),_0x3c68d4[_0x4612('0x4f')],_0xbc2885[_0x4612('0x50')],md5(_0xbc2885['uniqueid']));}else{_0xbc2885[_0x4612('0x4d')]='';}return getConnection(_0x3c68d4)[_0x4612('0x22')](function(_0x28bf28){_0x156c0e=_0x28bf28;return getUser(_0x3c68d4,_0x13488a['email'],_0x156c0e);})[_0x4612('0x22')](function(_0xf570b8){_0x235270=_0xf570b8;logger['info']('The\x20User\x20ID\x20is:',_0x235270['id']);return getEndUser(_0x3c68d4,_0xbc2885[_0x4612('0x51')],_0xbc2885['calleridnum'],_0x156c0e);})[_0x4612('0x22')](function(_0x21a4c3){_0x3326c2=_0x21a4c3;logger[_0x4612('0x19')](_0x4612('0x52'),_0x3326c2['id']);return createTicket(_0x3c68d4,_0x235270,_0x3326c2,_0x584497,_0xbc2885,_0x584497[_0x4612('0x53')],_0x156c0e);})[_0x4612('0x22')](function(_0xc532ca){_0x3dd76b=_0xc532ca;logger[_0x4612('0x19')](_0x4612('0x54'));logger[_0x4612('0x19')](_0x4612('0x55'),_0x3dd76b['id']);var _0x3b019f=util[_0x4612('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3c68d4[_0x4612('0x2e')],_[_0x4612('0x56')](_0x3dd76b['id'],'x')[0x1]);logger[_0x4612('0x19')](_0x4612('0x4b'),_0x4612('0x57'));emit(util['format'](_0x4612('0x58'),_0x13488a['name']),_0x4612('0x59'),{'uri':_0x3b019f});})[_0x4612('0x28')](function(_0x427832){logger['error'](_0x4612('0x4b'),JSON[_0x4612('0x21')](_0x427832));});};exports[_0x4612('0x5a')]=function(_0x1d878e,_0x15bd3e,_0x1a176f,_0x2785c9,_0x167cfa,_0x44b46e,_0x13dedc){var _0x52b6e1,_0x2cd8c7,_0xdfb4e5,_0x526ea6;_0x44b46e[_0x4612('0x2e')]=intUtil['stripTrailingSlash'](_0x44b46e['remoteUri']);_0x44b46e[_0x4612('0x4f')]=intUtil[_0x4612('0x5b')](_0x44b46e[_0x4612('0x4f')]);if(_0x13dedc&&_0x13dedc[_0x4612('0x5c')]&&_0x13dedc[_0x4612('0x5c')]!==_0x4612('0x5d')){logger['info'](_0x4612('0x5e'),'Recording\x20is\x20enabled!');_0x15bd3e['recordingURL']=util[_0x4612('0x26')](_0x4612('0x4e'),_0x44b46e[_0x4612('0x4f')],_0x15bd3e[_0x4612('0x50')],md5(_0x15bd3e[_0x4612('0x50')]));}return getConnection(_0x44b46e)[_0x4612('0x22')](function(_0x4c45ad){_0x526ea6=_0x4c45ad;return getUser(_0x44b46e,_0x2785c9[_0x4612('0x5f')],_0x526ea6);})['then'](function(_0x5666fb){_0x52b6e1=_0x5666fb;logger[_0x4612('0x19')](_0x4612('0x60'),_0x52b6e1['id']);return getEndUser(_0x44b46e,_0x15bd3e['destcalleridname'],_0x15bd3e[_0x4612('0x61')],_0x526ea6);})[_0x4612('0x22')](function(_0x59ff17){_0x2cd8c7=_0x59ff17;logger['info'](_0x4612('0x52'),_0x2cd8c7['id']);return createTicket(_0x44b46e,_0x52b6e1,_0x2cd8c7,_0x1a176f,_0x15bd3e,_0x1a176f[_0x4612('0x53')],_0x526ea6);})['then'](function(_0xabc84f){_0xdfb4e5=_0xabc84f;logger['info'](_0x4612('0x54'));logger[_0x4612('0x19')](_0x4612('0x55'),_0xdfb4e5['id']);var _0x42ce4c=util[_0x4612('0x26')](_0x4612('0x62'),_0x44b46e[_0x4612('0x2e')],_[_0x4612('0x56')](_0xdfb4e5['id'],'x')[0x1]);logger[_0x4612('0x19')](_0x4612('0x5e'),_0x4612('0x57'));emit(util[_0x4612('0x26')]('user:%s',_0x2785c9['name']),'trigger:browser:url',{'uri':_0x42ce4c});})['catch'](function(_0x2c4332){logger[_0x4612('0x2a')](_0x4612('0x5e'),JSON[_0x4612('0x21')](_0x2c4332));});};exports[_0x4612('0x63')]=function(_0x214e77,_0x1bbf0d,_0x2780de,_0x41dbe2,_0x1e084e,_0x2e59df){var _0x32c4de,_0x512d63,_0x348637,_0xf802f3;_0x2e59df[_0x4612('0x2e')]=intUtil['stripTrailingSlash'](_0x2e59df[_0x4612('0x2e')]);_0x2e59df[_0x4612('0x4f')]=intUtil[_0x4612('0x5b')](_0x2e59df[_0x4612('0x4f')]);if(_0x1e084e&&_0x1e084e[_0x4612('0x4a')]){logger[_0x4612('0x19')]('['+_0x1bbf0d[_0x4612('0x64')][_0x4612('0x65')]()+']',_0x4612('0x4c'));_0x1bbf0d[_0x4612('0x4d')]=util[_0x4612('0x26')](_0x4612('0x4e'),_0x2e59df[_0x4612('0x4f')],_0x1bbf0d[_0x4612('0x50')],md5(_0x1bbf0d[_0x4612('0x50')]));}else{_0x1bbf0d[_0x4612('0x4d')]='';}return getConnection(_0x2e59df)[_0x4612('0x22')](function(_0x23f5f0){_0xf802f3=_0x23f5f0;return getUser(_0x2e59df,'',_0xf802f3);})['then'](function(_0x37ba3f){_0x32c4de=_0x37ba3f;logger[_0x4612('0x19')](_0x4612('0x60'),_0x32c4de['id']);return getEndUser(_0x2e59df,_0x1bbf0d[_0x4612('0x51')],_0x1bbf0d['calleridnum'],_0xf802f3);})[_0x4612('0x22')](function(_0x6458f3){_0x512d63=_0x6458f3;logger[_0x4612('0x19')](_0x4612('0x52'),_0x512d63['id']);return createTicket(_0x2e59df,_0x32c4de,_0x512d63,_0x2780de,_0x1bbf0d,_0x2780de['Fields'],_0xf802f3);})['then'](function(_0x5c4d52){_0x348637=_0x5c4d52;logger['info'](_0x4612('0x54'));logger[_0x4612('0x19')]('The\x20Ticket\x20ID\x20is:',_0x348637['id']);})[_0x4612('0x28')](function(_0x551193){logger['error']('['+_0x1bbf0d['lastevent'][_0x4612('0x65')]()+']',JSON[_0x4612('0x21')](_0x551193));});}; \ 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 3034267..42f83fe 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 _0x4ea3=['trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','recordingURL','destcalleridname','[OUTBOUND]','user:%s'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x34ea('0x0'));var rp=require(_0x34ea('0x1'));var md5=require(_0x34ea('0x2'));var util=require(_0x34ea('0x3'));var Redis=require('ioredis');var intUtil=require(_0x34ea('0x4'));var config=require('../../../../config/environment');var logger=require(_0x34ea('0x5'))('zendesk');config['redis']=_[_0x34ea('0x6')](config[_0x34ea('0x7')],{'host':_0x34ea('0x8'),'port':0x18eb});var io=require(_0x34ea('0x9'))(new Redis(config[_0x34ea('0x7')]));function emit(_0x18b461,_0x22b09e,_0x5bec7c){io['to'](_0x18b461)[_0x34ea('0xa')](_0x22b09e,_0x5bec7c);}var headers={'Content-Type':_0x34ea('0xb'),'Accept':_0x34ea('0xb')};function getTicket(_0x5132c4,_0x301b98,_0xea1be2,_0x5126de,_0x4a76b1){logger[_0x34ea('0xc')](_0x34ea('0xd'));return request({'uri':util[_0x34ea('0xe')]('%s/tickets.json',_0x5132c4[_0x34ea('0xf')]),'method':_0x34ea('0x10'),'body':{'ticket':_[_0x34ea('0x11')]({'requester_id':_0xea1be2['id'],'submitter_id':_0x301b98?_0x301b98['id']:undefined,'assignee_id':_0x301b98?_0x301b98['id']:undefined,'tags':getTags(_0x5126de[_0x34ea('0x12')],_0x34ea('0x13')),'subject':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x15')],_0x4a76b1,'\x20'),'description':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x16')],_0x4a76b1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x16')],_0x4a76b1,'\x0a')}},getCustomFields(_0x5126de['Fields'],_0x4a76b1))}})[_0x34ea('0x17')](function(_0x89e3f2){logger[_0x34ea('0xc')](_0x34ea('0x18'));return _0x89e3f2[_0x34ea('0x19')];});}function getUser(_0x56b2d7,_0x6a84a7){if(intUtil[_0x34ea('0x1a')](_0x6a84a7)){logger[_0x34ea('0xc')](_0x34ea('0x1b'),_0x6a84a7);return request({'uri':util['format'](_0x34ea('0x1c'),_0x56b2d7[_0x34ea('0xf')]),'qs':{'query':util[_0x34ea('0xe')]('type:user\x20role:agent\x20email:%s',_0x6a84a7)}})[_0x34ea('0x17')](function(_0x1353de){if(_0x1353de[_0x34ea('0x1d')]){logger[_0x34ea('0xc')]('Agent\x20found!');return _[_0x34ea('0x1e')](_0x1353de[_0x34ea('0x1f')],{'email':_0x6a84a7,'role':_0x34ea('0x20')});}else{logger[_0x34ea('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x34ea('0x21'),_0x56b2d7[_0x34ea('0xf')])})[_0x34ea('0x17')](function(_0x51022f){logger['info'](_0x34ea('0x22'));return _0x51022f[_0x34ea('0x23')];});}});}else{logger[_0x34ea('0xc')](_0x34ea('0x24'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x21'),_0x56b2d7['remoteUri'])})[_0x34ea('0x17')](function(_0x46671f){logger[_0x34ea('0xc')](_0x34ea('0x22'));return _0x46671f['user'];});}}function getEndUser(_0x56f320,_0x564d1b,_0x142709){logger[_0x34ea('0xc')](_0x34ea('0x25'),_0x142709);return request({'uri':util[_0x34ea('0xe')]('%s/search.json',_0x56f320[_0x34ea('0xf')]),'qs':{'query':util[_0x34ea('0xe')](_0x34ea('0x26'),_0x142709)}})['then'](function(_0x4cded8){var _0x5b4727;if(_0x4cded8['results'][_0x34ea('0x27')]){_0x4cded8[_0x34ea('0x1f')]=_[_0x34ea('0x28')](_0x4cded8[_0x34ea('0x1f')],{'suspended':![],'role':'end-user'});if(_0x4cded8[_0x34ea('0x1f')]['length']){_0x5b4727=_[_0x34ea('0x29')](_0x4cded8['results']);}}if(_0x5b4727){logger[_0x34ea('0xc')](_0x34ea('0x2a'));return _0x5b4727;}else{logger[_0x34ea('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x2b'),_0x56f320['remoteUri']),'method':_0x34ea('0x10'),'body':{'user':{'role':'end-user','name':util[_0x34ea('0xe')](_0x34ea('0x2c'),_0x564d1b||_0x142709),'phone':_0x142709}}})[_0x34ea('0x17')](function(_0x5ead76){logger['info'](_0x34ea('0x2d'));return _0x5ead76['user'];});}});}function getAuth(_0x151fac){var _0x359a31;if(_0x151fac['authType']===_0x34ea('0x2e')){_0x359a31=util[_0x34ea('0xe')](_0x34ea('0x2f'),_0x151fac[_0x34ea('0x30')],_0x151fac['password']);}else if(_0x151fac['authType']==='token'){_0x359a31=util[_0x34ea('0xe')](_0x34ea('0x31'),_0x151fac[_0x34ea('0x30')],_0x151fac['token']);}return util['format']('Basic\x20%s',new Buffer(_0x359a31)[_0x34ea('0x32')](_0x34ea('0x33')));}function request(_0x583e2d){logger[_0x34ea('0x34')](_0x34ea('0x35'),JSON[_0x34ea('0x36')](_0x583e2d));return rp(_[_0x34ea('0x6')](_0x583e2d,{'method':_0x34ea('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x185883,_0x4e99e4){var _0x2faf49=[];if(_0x185883&&_0x185883[_0x34ea('0x27')]>0x0){_0x2faf49=_[_0x34ea('0x38')](_0x185883,_0x4e99e4);}return _0x2faf49;}function getCustomFields(_0x3a73a1,_0x4f05fc){var _0x5c44ab=[];var _0x6f024c={'custom_fields':[]};if(_0x3a73a1[_0x34ea('0x27')]>0x0){_[_0x34ea('0x39')](_0x3a73a1,function(_0x19f401){if(_0x19f401[_0x34ea('0x3a')]==='string'&&_0x19f401[_0x34ea('0x3b')]&&!_0x19f401[_0x34ea('0x3c')]){_0x6f024c[_0x19f401[_0x34ea('0x3b')][_0x34ea('0x3d')]()]=_0x19f401[_0x34ea('0x3e')][_0x34ea('0x32')]();}else if(_0x19f401[_0x34ea('0x3a')]===_0x34ea('0x3f')&&_0x19f401[_0x34ea('0x40')]&&_0x19f401[_0x34ea('0x3c')]){_0x6f024c[_0x34ea('0x41')][_0x34ea('0x42')]({'id':_0x19f401[_0x34ea('0x40')],'value':_0x19f401[_0x34ea('0x3e')][_0x34ea('0x32')]()});}else if(_0x19f401[_0x34ea('0x3a')]==='variable'&&_0x19f401[_0x34ea('0x43')]&&_0x19f401['idField']&&_0x19f401[_0x34ea('0x3c')]){_0x4f05fc[_0x19f401[_0x34ea('0x43')]]&&_0x6f024c[_0x34ea('0x41')][_0x34ea('0x42')]({'id':_0x19f401[_0x34ea('0x40')],'value':_0x4f05fc[_0x19f401[_0x34ea('0x43')]][_0x34ea('0x32')]()});}else if(_0x19f401[_0x34ea('0x3a')]===_0x34ea('0x44')&&_0x19f401['Variable']&&_0x19f401[_0x34ea('0x45')]['name']&&_0x19f401[_0x34ea('0x40')]&&_0x19f401[_0x34ea('0x3c')]){_0x4f05fc[_0x19f401[_0x34ea('0x45')][_0x34ea('0x13')][_0x34ea('0x3d')]()]&&_0x6f024c[_0x34ea('0x41')]['push']({'id':_0x19f401[_0x34ea('0x40')],'value':_0x4f05fc[_0x19f401[_0x34ea('0x45')]['name'][_0x34ea('0x3d')]()][_0x34ea('0x32')]()});}});}return _0x6f024c;}exports[_0x34ea('0x46')]=function(_0x37de77,_0xf5f2a3,_0x5d8dc9,_0x4384cc,_0x180444,_0x3f7456){var _0x2487bd,_0x3e2e61;_0x3f7456[_0x34ea('0xf')]=intUtil['stripTrailingSlash'](_0x3f7456['remoteUri']);_0x3f7456[_0x34ea('0x47')]=intUtil[_0x34ea('0x48')](_0x3f7456[_0x34ea('0x47')]);if(_0x180444&&_0x180444['monitor_format']){logger[_0x34ea('0xc')]('[QUEUE]',_0x34ea('0x49'));_0xf5f2a3['recordingURL']=util[_0x34ea('0xe')](_0x34ea('0x4a'),_0x3f7456[_0x34ea('0x47')],_0xf5f2a3['uniqueid'],md5(_0xf5f2a3[_0x34ea('0x4b')]));}else{_0xf5f2a3['recordingURL']='';}headers[_0x34ea('0x4c')]=getAuth(_0x3f7456);return getUser(_0x3f7456,_0x4384cc[_0x34ea('0x4d')])[_0x34ea('0x17')](function(_0xb8246e){_0x2487bd=_0xb8246e;logger['info'](_0x34ea('0x4e'),_0x2487bd['id']);return getEndUser(_0x3f7456,_0xf5f2a3[_0x34ea('0x4f')],_0xf5f2a3[_0x34ea('0x50')]);})[_0x34ea('0x17')](function(_0x3df3c8){_0x3e2e61=_0x3df3c8;logger[_0x34ea('0xc')](_0x34ea('0x51'),_0x3e2e61['id']);return getTicket(_0x3f7456,_0x2487bd,_0x3e2e61,_0x5d8dc9,_0xf5f2a3);})['then'](function(_0x1059dc){if(_0x1059dc){logger[_0x34ea('0xc')](_0x34ea('0x52'),_0x1059dc['id']);switch(_0x3f7456[_0x34ea('0x3a')]){case _0x34ea('0x53'):logger[_0x34ea('0xc')](_0x34ea('0x54'),_0x34ea('0x55'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x56'),_0x3f7456[_0x34ea('0xf')],_0x2487bd['id'],_0x1059dc['id']),'method':_0x34ea('0x10')});case _0x34ea('0x57'):logger['info'](_0x34ea('0x54'),_0x34ea('0x58'));emit(util[_0x34ea('0xe')]('user:%s',_0x4384cc[_0x34ea('0x13')]),'trigger:browser:url',{'uri':util[_0x34ea('0xe')](_0x34ea('0x59'),_0x3f7456['remoteUri'],_0x1059dc['id'])});break;default:logger[_0x34ea('0x5a')](_0x34ea('0x54'),_0x34ea('0x5b'));}}})['catch'](function(_0x50935b){logger[_0x34ea('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x50935b,{'showHidden':!![],'depth':null}));});};exports[_0x34ea('0x5c')]=function(_0x4df7bf,_0x3808ee,_0x2e77c7,_0x3918c5,_0x443c98,_0x46e912,_0x3f844f){var _0x41da1a,_0x6a3da3;_0x46e912[_0x34ea('0xf')]=intUtil[_0x34ea('0x48')](_0x46e912[_0x34ea('0xf')]);_0x46e912[_0x34ea('0x47')]=intUtil[_0x34ea('0x48')](_0x46e912[_0x34ea('0x47')]);if(_0x3f844f&&_0x3f844f[_0x34ea('0x5d')]&&_0x3f844f[_0x34ea('0x5d')]!=='none'){logger[_0x34ea('0xc')]('[OUTBOUND]',_0x34ea('0x49'));_0x3808ee[_0x34ea('0x5e')]=util[_0x34ea('0xe')](_0x34ea('0x4a'),_0x46e912[_0x34ea('0x47')],_0x3808ee[_0x34ea('0x4b')],md5(_0x3808ee['uniqueid']));}headers[_0x34ea('0x4c')]=getAuth(_0x46e912);return getUser(_0x46e912,_0x3918c5[_0x34ea('0x4d')])[_0x34ea('0x17')](function(_0x36c5a0){_0x41da1a=_0x36c5a0;logger[_0x34ea('0xc')]('The\x20User\x20ID\x20is:',_0x41da1a['id']);return getEndUser(_0x46e912,_0x3808ee[_0x34ea('0x5f')],_0x3808ee['destcalleridnum']);})['then'](function(_0x54dc5e){_0x6a3da3=_0x54dc5e;logger[_0x34ea('0xc')]('The\x20Enduser\x20ID\x20is:',_0x6a3da3['id']);return getTicket(_0x46e912,_0x41da1a,_0x6a3da3,_0x2e77c7,_0x3808ee);})[_0x34ea('0x17')](function(_0x53aafe){if(_0x53aafe){logger[_0x34ea('0xc')]('The\x20Ticket\x20ID\x20is:',_0x53aafe['id']);switch(_0x46e912[_0x34ea('0x3a')]){case'integrationTab':logger[_0x34ea('0xc')](_0x34ea('0x60'),_0x34ea('0x55'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x56'),_0x46e912['remoteUri'],_0x41da1a['id'],_0x53aafe['id']),'method':'POST'});case _0x34ea('0x57'):logger[_0x34ea('0xc')](_0x34ea('0x60'),_0x34ea('0x58'));emit(util[_0x34ea('0xe')](_0x34ea('0x61'),_0x3918c5[_0x34ea('0x13')]),_0x34ea('0x62'),{'uri':util[_0x34ea('0xe')]('%s/agent/tickets/%s',_0x46e912[_0x34ea('0xf')],_0x53aafe['id'])});break;default:logger[_0x34ea('0x5a')](_0x34ea('0x60'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x13e9c1){logger[_0x34ea('0x5a')](_0x34ea('0x63'),util['inspect'](_0x13e9c1,{'showHidden':!![],'depth':null}));});};exports[_0x34ea('0x64')]=function(_0x3fa4cf,_0x38542d,_0x483c71,_0xeb203a,_0x26a73a,_0x4bba99){var _0x1f3978,_0x2cbc92;_0x4bba99[_0x34ea('0xf')]=intUtil['stripTrailingSlash'](_0x4bba99[_0x34ea('0xf')]);_0x4bba99['serverUrl']=intUtil[_0x34ea('0x48')](_0x4bba99[_0x34ea('0x47')]);if(_0x26a73a&&_0x26a73a[_0x34ea('0x65')]){logger[_0x34ea('0xc')]('['+_0x38542d['lastevent'][_0x34ea('0x66')]()+']',_0x34ea('0x49'));_0x38542d['recordingURL']=util[_0x34ea('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bba99[_0x34ea('0x47')],_0x38542d[_0x34ea('0x4b')],md5(_0x38542d[_0x34ea('0x4b')]));}else{_0x38542d['recordingURL']='';}headers[_0x34ea('0x4c')]=getAuth(_0x4bba99);return getUser(_0x4bba99)[_0x34ea('0x17')](function(_0x2cf2c9){_0x1f3978=_0x2cf2c9;logger[_0x34ea('0xc')]('The\x20User\x20ID\x20is:',_0x1f3978['id']);return getEndUser(_0x4bba99,_0x38542d[_0x34ea('0x4f')],_0x38542d[_0x34ea('0x50')]);})[_0x34ea('0x17')](function(_0x405da9){_0x2cbc92=_0x405da9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2cbc92['id']);return getTicket(_0x4bba99,_0x1f3978,_0x2cbc92,_0x483c71,_0x38542d);})[_0x34ea('0x17')](function(_0x3200f7){if(_0x3200f7){logger['info'](_0x34ea('0x52'),_0x3200f7['id']);}})[_0x34ea('0x67')](function(_0x30a609){logger['error']('['+_0x38542d['lastevent']['toUpperCase']()+']'+_0x34ea('0x68'),util['inspect'](_0x30a609,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x39cb=['[QUEUE]','Displaying\x20ticket\x20to\x20agent...','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','integrationTab','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','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','first','Enduser\x20found!','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','map','forEach','type','string','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','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:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:'];(function(_0x6133cf,_0x2c8596){var _0x3e5cb5=function(_0xbc7db1){while(--_0xbc7db1){_0x6133cf['push'](_0x6133cf['shift']());}};_0x3e5cb5(++_0x2c8596);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var rp=require(_0xb39c('0x0'));var md5=require(_0xb39c('0x1'));var util=require('util');var Redis=require(_0xb39c('0x2'));var intUtil=require(_0xb39c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xb39c('0x4'))(_0xb39c('0x5'));config[_0xb39c('0x6')]=_[_0xb39c('0x7')](config[_0xb39c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb39c('0x8'))(new Redis(config[_0xb39c('0x6')]));function emit(_0x40112f,_0x3f2fbe,_0x47d6d7){io['to'](_0x40112f)['emit'](_0x3f2fbe,_0x47d6d7);}var headers={'Content-Type':_0xb39c('0x9'),'Accept':_0xb39c('0x9')};function getTicket(_0x3ffb94,_0x42c6dc,_0x5402b2,_0x4a6f36,_0x5a0dba){logger[_0xb39c('0xa')](_0xb39c('0xb'));return request({'uri':util[_0xb39c('0xc')](_0xb39c('0xd'),_0x3ffb94[_0xb39c('0xe')]),'method':_0xb39c('0xf'),'body':{'ticket':_[_0xb39c('0x10')]({'requester_id':_0x5402b2['id'],'submitter_id':_0x42c6dc?_0x42c6dc['id']:undefined,'assignee_id':_0x42c6dc?_0x42c6dc['id']:undefined,'tags':getTags(_0x4a6f36[_0xb39c('0x11')],'name'),'subject':intUtil[_0xb39c('0x12')](_0x4a6f36[_0xb39c('0x13')],_0x5a0dba,'\x20'),'description':intUtil[_0xb39c('0x12')](_0x4a6f36['Descriptions'],_0x5a0dba,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb39c('0x12')](_0x4a6f36[_0xb39c('0x14')],_0x5a0dba,'\x0a')}},getCustomFields(_0x4a6f36[_0xb39c('0x15')],_0x5a0dba))}})[_0xb39c('0x16')](function(_0x469fa9){logger[_0xb39c('0xa')](_0xb39c('0x17'));return _0x469fa9['ticket'];});}function getUser(_0x316c9b,_0x3223f6){if(intUtil[_0xb39c('0x18')](_0x3223f6)){logger[_0xb39c('0xa')](_0xb39c('0x19'),_0x3223f6);return request({'uri':util[_0xb39c('0xc')](_0xb39c('0x1a'),_0x316c9b[_0xb39c('0xe')]),'qs':{'query':util[_0xb39c('0xc')](_0xb39c('0x1b'),_0x3223f6)}})['then'](function(_0x1d2f49){if(_0x1d2f49[_0xb39c('0x1c')]){logger[_0xb39c('0xa')](_0xb39c('0x1d'));return _['find'](_0x1d2f49[_0xb39c('0x1e')],{'email':_0x3223f6,'role':_0xb39c('0x1f')});}else{logger['info'](_0xb39c('0x20'));return request({'uri':util[_0xb39c('0xc')](_0xb39c('0x21'),_0x316c9b['remoteUri'])})['then'](function(_0x2789fd){logger[_0xb39c('0xa')](_0xb39c('0x22'));return _0x2789fd['user'];});}});}else{logger[_0xb39c('0xa')](_0xb39c('0x20'));return request({'uri':util[_0xb39c('0xc')](_0xb39c('0x21'),_0x316c9b[_0xb39c('0xe')])})['then'](function(_0x3036f5){logger[_0xb39c('0xa')]('Admin\x20account\x20selected.');return _0x3036f5[_0xb39c('0x23')];});}}function getEndUser(_0x4492a4,_0x39116b,_0x12be70){logger[_0xb39c('0xa')]('Searching\x20enduser\x20with\x20phone',_0x12be70);return request({'uri':util[_0xb39c('0xc')](_0xb39c('0x1a'),_0x4492a4[_0xb39c('0xe')]),'qs':{'query':util['format'](_0xb39c('0x24'),_0x12be70)}})[_0xb39c('0x16')](function(_0x52eb5e){var _0x3d08e1;if(_0x52eb5e[_0xb39c('0x1e')][_0xb39c('0x25')]){_0x52eb5e['results']=_[_0xb39c('0x26')](_0x52eb5e[_0xb39c('0x1e')],{'suspended':![],'role':'end-user'});if(_0x52eb5e[_0xb39c('0x1e')]['length']){_0x3d08e1=_[_0xb39c('0x27')](_0x52eb5e[_0xb39c('0x1e')]);}}if(_0x3d08e1){logger[_0xb39c('0xa')](_0xb39c('0x28'));return _0x3d08e1;}else{logger[_0xb39c('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb39c('0xc')]('%s/users.json',_0x4492a4[_0xb39c('0xe')]),'method':'POST','body':{'user':{'role':_0xb39c('0x29'),'name':util[_0xb39c('0xc')](_0xb39c('0x2a'),_0x39116b||_0x12be70),'phone':_0x12be70}}})[_0xb39c('0x16')](function(_0x4fc7be){logger['info'](_0xb39c('0x2b'));return _0x4fc7be[_0xb39c('0x23')];});}});}function getAuth(_0x4a9184){var _0x1d7f2a;if(_0x4a9184[_0xb39c('0x2c')]===_0xb39c('0x2d')){_0x1d7f2a=util[_0xb39c('0xc')](_0xb39c('0x2e'),_0x4a9184[_0xb39c('0x2f')],_0x4a9184[_0xb39c('0x2d')]);}else if(_0x4a9184[_0xb39c('0x2c')]===_0xb39c('0x30')){_0x1d7f2a=util[_0xb39c('0xc')](_0xb39c('0x31'),_0x4a9184[_0xb39c('0x2f')],_0x4a9184[_0xb39c('0x30')]);}return util[_0xb39c('0xc')](_0xb39c('0x32'),new Buffer(_0x1d7f2a)[_0xb39c('0x33')](_0xb39c('0x34')));}function request(_0x22eda9){logger[_0xb39c('0x35')]('[HTTP]',JSON[_0xb39c('0x36')](_0x22eda9));return rp(_[_0xb39c('0x7')](_0x22eda9,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x56e80a,_0x55e9d9){var _0x22d673=[];if(_0x56e80a&&_0x56e80a[_0xb39c('0x25')]>0x0){_0x22d673=_[_0xb39c('0x37')](_0x56e80a,_0x55e9d9);}return _0x22d673;}function getCustomFields(_0x5522ce,_0x3071dd){var _0x141e70=[];var _0x44afba={'custom_fields':[]};if(_0x5522ce[_0xb39c('0x25')]>0x0){_[_0xb39c('0x38')](_0x5522ce,function(_0x4b51ac){if(_0x4b51ac[_0xb39c('0x39')]===_0xb39c('0x3a')&&_0x4b51ac['nameField']&&!_0x4b51ac[_0xb39c('0x3b')]){_0x44afba[_0x4b51ac['nameField'][_0xb39c('0x3c')]()]=_0x4b51ac[_0xb39c('0x3d')][_0xb39c('0x33')]();}else if(_0x4b51ac['type']===_0xb39c('0x3a')&&_0x4b51ac[_0xb39c('0x3e')]&&_0x4b51ac[_0xb39c('0x3b')]){_0x44afba[_0xb39c('0x3f')][_0xb39c('0x40')]({'id':_0x4b51ac[_0xb39c('0x3e')],'value':_0x4b51ac[_0xb39c('0x3d')][_0xb39c('0x33')]()});}else if(_0x4b51ac[_0xb39c('0x39')]===_0xb39c('0x41')&&_0x4b51ac[_0xb39c('0x42')]&&_0x4b51ac[_0xb39c('0x3e')]&&_0x4b51ac['customField']){_0x3071dd[_0x4b51ac[_0xb39c('0x42')]]&&_0x44afba[_0xb39c('0x3f')][_0xb39c('0x40')]({'id':_0x4b51ac[_0xb39c('0x3e')],'value':_0x3071dd[_0x4b51ac[_0xb39c('0x42')]][_0xb39c('0x33')]()});}else if(_0x4b51ac[_0xb39c('0x39')]===_0xb39c('0x43')&&_0x4b51ac[_0xb39c('0x44')]&&_0x4b51ac['Variable']['name']&&_0x4b51ac[_0xb39c('0x3e')]&&_0x4b51ac[_0xb39c('0x3b')]){_0x3071dd[_0x4b51ac['Variable']['name'][_0xb39c('0x3c')]()]&&_0x44afba['custom_fields'][_0xb39c('0x40')]({'id':_0x4b51ac[_0xb39c('0x3e')],'value':_0x3071dd[_0x4b51ac[_0xb39c('0x44')][_0xb39c('0x45')][_0xb39c('0x3c')]()]['toString']()});}});}return _0x44afba;}exports[_0xb39c('0x46')]=function(_0x1d729a,_0x4d2a47,_0x494e6d,_0x2f2fce,_0x53408c,_0x5470f1){var _0x20a5c4,_0x2ff5ac;_0x5470f1[_0xb39c('0xe')]=intUtil[_0xb39c('0x47')](_0x5470f1[_0xb39c('0xe')]);_0x5470f1[_0xb39c('0x48')]=intUtil[_0xb39c('0x47')](_0x5470f1[_0xb39c('0x48')]);if(_0x53408c&&_0x53408c[_0xb39c('0x49')]){logger[_0xb39c('0xa')]('[QUEUE]',_0xb39c('0x4a'));_0x4d2a47[_0xb39c('0x4b')]=util[_0xb39c('0xc')](_0xb39c('0x4c'),_0x5470f1[_0xb39c('0x48')],_0x4d2a47[_0xb39c('0x4d')],md5(_0x4d2a47[_0xb39c('0x4d')]));}else{_0x4d2a47[_0xb39c('0x4b')]='';}headers[_0xb39c('0x4e')]=getAuth(_0x5470f1);return getUser(_0x5470f1,_0x2f2fce[_0xb39c('0x4f')])[_0xb39c('0x16')](function(_0x2df60d){_0x20a5c4=_0x2df60d;logger[_0xb39c('0xa')](_0xb39c('0x50'),_0x20a5c4['id']);return getEndUser(_0x5470f1,_0x4d2a47[_0xb39c('0x51')],_0x4d2a47[_0xb39c('0x52')]);})['then'](function(_0x283acf){_0x2ff5ac=_0x283acf;logger[_0xb39c('0xa')](_0xb39c('0x53'),_0x2ff5ac['id']);return getTicket(_0x5470f1,_0x20a5c4,_0x2ff5ac,_0x494e6d,_0x4d2a47);})[_0xb39c('0x16')](function(_0xa50077){if(_0xa50077){logger[_0xb39c('0xa')](_0xb39c('0x54'),_0xa50077['id']);switch(_0x5470f1[_0xb39c('0x39')]){case'integrationTab':logger['info'](_0xb39c('0x55'),_0xb39c('0x56'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5470f1[_0xb39c('0xe')],_0x20a5c4['id'],_0xa50077['id']),'method':_0xb39c('0xf')});case'newTab':logger[_0xb39c('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb39c('0xc')]('user:%s',_0x2f2fce[_0xb39c('0x45')]),_0xb39c('0x57'),{'uri':util[_0xb39c('0xc')](_0xb39c('0x58'),_0x5470f1[_0xb39c('0xe')],_0xa50077['id'])});break;default:logger[_0xb39c('0x59')]('[QUEUE]',_0xb39c('0x5a'));}}})[_0xb39c('0x5b')](function(_0x1c6d75){logger[_0xb39c('0x59')](_0xb39c('0x5c'),util['inspect'](_0x1c6d75,{'showHidden':!![],'depth':null}));});};exports[_0xb39c('0x5d')]=function(_0x4ab58e,_0x1caea1,_0x2f537f,_0x131cb2,_0x9e4e89,_0x41305a,_0x24a2d6){var _0x3fd1ec,_0x31bedc;_0x41305a[_0xb39c('0xe')]=intUtil[_0xb39c('0x47')](_0x41305a[_0xb39c('0xe')]);_0x41305a[_0xb39c('0x48')]=intUtil[_0xb39c('0x47')](_0x41305a[_0xb39c('0x48')]);if(_0x24a2d6&&_0x24a2d6[_0xb39c('0x5e')]&&_0x24a2d6[_0xb39c('0x5e')]!==_0xb39c('0x5f')){logger[_0xb39c('0xa')](_0xb39c('0x60'),'Recording\x20is\x20enabled!');_0x1caea1['recordingURL']=util[_0xb39c('0xc')](_0xb39c('0x4c'),_0x41305a['serverUrl'],_0x1caea1[_0xb39c('0x4d')],md5(_0x1caea1[_0xb39c('0x4d')]));}headers['Authorization']=getAuth(_0x41305a);return getUser(_0x41305a,_0x131cb2[_0xb39c('0x4f')])[_0xb39c('0x16')](function(_0x129d1f){_0x3fd1ec=_0x129d1f;logger[_0xb39c('0xa')](_0xb39c('0x50'),_0x3fd1ec['id']);return getEndUser(_0x41305a,_0x1caea1[_0xb39c('0x61')],_0x1caea1['destcalleridnum']);})[_0xb39c('0x16')](function(_0x384f4f){_0x31bedc=_0x384f4f;logger[_0xb39c('0xa')](_0xb39c('0x53'),_0x31bedc['id']);return getTicket(_0x41305a,_0x3fd1ec,_0x31bedc,_0x2f537f,_0x1caea1);})[_0xb39c('0x16')](function(_0x1d0fbf){if(_0x1d0fbf){logger[_0xb39c('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1d0fbf['id']);switch(_0x41305a[_0xb39c('0x39')]){case _0xb39c('0x62'):logger[_0xb39c('0xa')](_0xb39c('0x60'),_0xb39c('0x56'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x41305a[_0xb39c('0xe')],_0x3fd1ec['id'],_0x1d0fbf['id']),'method':_0xb39c('0xf')});case _0xb39c('0x63'):logger['info'](_0xb39c('0x60'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb39c('0xc')]('user:%s',_0x131cb2[_0xb39c('0x45')]),_0xb39c('0x57'),{'uri':util[_0xb39c('0xc')]('%s/agent/tickets/%s',_0x41305a[_0xb39c('0xe')],_0x1d0fbf['id'])});break;default:logger[_0xb39c('0x59')](_0xb39c('0x60'),_0xb39c('0x5a'));}}})[_0xb39c('0x5b')](function(_0x31f8be){logger[_0xb39c('0x59')](_0xb39c('0x64'),util[_0xb39c('0x65')](_0x31f8be,{'showHidden':!![],'depth':null}));});};exports[_0xb39c('0x66')]=function(_0x34127d,_0x227152,_0x3fb267,_0x4522cf,_0x1b2138,_0x31b9c1){var _0x451b48,_0x58fbe0;_0x31b9c1[_0xb39c('0xe')]=intUtil[_0xb39c('0x47')](_0x31b9c1[_0xb39c('0xe')]);_0x31b9c1['serverUrl']=intUtil[_0xb39c('0x47')](_0x31b9c1['serverUrl']);if(_0x1b2138&&_0x1b2138['monitor_format']){logger[_0xb39c('0xa')]('['+_0x227152[_0xb39c('0x67')][_0xb39c('0x68')]()+']',_0xb39c('0x4a'));_0x227152[_0xb39c('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31b9c1[_0xb39c('0x48')],_0x227152[_0xb39c('0x4d')],md5(_0x227152['uniqueid']));}else{_0x227152[_0xb39c('0x4b')]='';}headers[_0xb39c('0x4e')]=getAuth(_0x31b9c1);return getUser(_0x31b9c1)[_0xb39c('0x16')](function(_0x32acb6){_0x451b48=_0x32acb6;logger[_0xb39c('0xa')](_0xb39c('0x50'),_0x451b48['id']);return getEndUser(_0x31b9c1,_0x227152[_0xb39c('0x51')],_0x227152[_0xb39c('0x52')]);})[_0xb39c('0x16')](function(_0x2f7fc1){_0x58fbe0=_0x2f7fc1;logger[_0xb39c('0xa')](_0xb39c('0x53'),_0x58fbe0['id']);return getTicket(_0x31b9c1,_0x451b48,_0x58fbe0,_0x3fb267,_0x227152);})[_0xb39c('0x16')](function(_0x12f02d){if(_0x12f02d){logger[_0xb39c('0xa')]('The\x20Ticket\x20ID\x20is:',_0x12f02d['id']);}})[_0xb39c('0x5b')](function(_0x5c901f){logger[_0xb39c('0x59')]('['+_0x227152[_0xb39c('0x67')]['toUpperCase']()+']'+_0xb39c('0x69'),util[_0xb39c('0x65')](_0x5c901f,{'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 fa70c28..01f5a09 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 _0x62c0=['Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','mm:ss','answertime','utc','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','details','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','calleridnum','toUpperCase','lodash','request-promise','md5','util','bluebird','../../../../config/logger','zoho','redis','localhost','emit','debug','[HTTP]','stringify','length','forEach','string','idField','toString','variable','variableName','type','customVariable','name','Variable','toLowerCase','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','data','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','info','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','enduserType'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x62c0,0xdb));var _0x062c=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x62c0[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x062c('0x0'));var rp=require(_0x062c('0x1'));var md5=require(_0x062c('0x2'));var util=require(_0x062c('0x3'));var intUtil=require('./util');var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x062c('0x4'));var config=require('../../../../config/environment');var logger=require(_0x062c('0x5'))(_0x062c('0x6'));config[_0x062c('0x7')]=_['defaults'](config[_0x062c('0x7')],{'host':_0x062c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x062c('0x7')]));function emit(_0x47c929,_0x15312a,_0x2d2526){io['to'](_0x47c929)[_0x062c('0x9')](_0x15312a,_0x2d2526);}function request(_0x3dfecd){logger[_0x062c('0xa')](_0x062c('0xb'),JSON[_0x062c('0xc')](_0x3dfecd));return rp(_0x3dfecd);}function getCustomFields(_0x599f88,_0x4200fc){var _0x4246cc={};if(_0x599f88[_0x062c('0xd')]>0x0){_[_0x062c('0xe')](_0x599f88,function(_0x4e3bd3){if(_0x4e3bd3['type']===_0x062c('0xf')&&_0x4e3bd3[_0x062c('0x10')]){_0x4246cc[_0x4e3bd3[_0x062c('0x10')]]=_0x4e3bd3['content'][_0x062c('0x11')]();}else if(_0x4e3bd3['type']===_0x062c('0x12')&&_0x4e3bd3[_0x062c('0x13')]&&_0x4e3bd3[_0x062c('0x10')]&&_0x4200fc[_0x4e3bd3[_0x062c('0x13')]]){_0x4246cc[_0x4e3bd3[_0x062c('0x10')]]=_0x4200fc[_0x4e3bd3[_0x062c('0x13')]]['toString']();}else if(_0x4e3bd3[_0x062c('0x14')]===_0x062c('0x15')&&_0x4e3bd3['Variable']&&_0x4e3bd3['Variable'][_0x062c('0x16')]&&_0x4e3bd3[_0x062c('0x10')]&&_0x4200fc[_0x4e3bd3[_0x062c('0x17')][_0x062c('0x16')][_0x062c('0x18')]()]){_0x4246cc[_0x4e3bd3[_0x062c('0x10')]]=_0x4200fc[_0x4e3bd3[_0x062c('0x17')][_0x062c('0x16')][_0x062c('0x18')]()][_0x062c('0x11')]();}});}return _0x4246cc;}function getName(_0x543db0){if(_0x543db0['indexOf']('\x20')>0x0){var _0x411bc2=_0x543db0['split'](/ (.+)/);if(_0x411bc2[0x1]){return _0x411bc2;}}return[_0x543db0,_0x543db0];}var accountsTokens={};function getAccessToken(_0x2429ec){return new Promise(function(_0x38b0a7,_0x7a0dce){if(!_['isNil'](accountsTokens[_0x2429ec['id']])&&!_['isNil'](accountsTokens[_0x2429ec['id']][_0x062c('0x19')])){if(moment()[_0x062c('0x1a')](accountsTokens[_0x2429ec['id']]['expires_in'])){_0x38b0a7(accountsTokens[_0x2429ec['id']][_0x062c('0x19')]);}}var _0x286938;switch(_0x2429ec[_0x062c('0x1b')]){case'US':_0x286938=_0x062c('0x1c');break;case'AU':_0x286938='https://accounts.zoho.com.au';break;case'EU':_0x286938=_0x062c('0x1d');break;case'IN':_0x286938=_0x062c('0x1e');break;case'CN':_0x286938=_0x062c('0x1f');break;default:_0x286938=_0x062c('0x1d');break;}var _0x7b03e9={'method':_0x062c('0x20'),'uri':_0x286938+'/oauth/v2/token','qs':{'refresh_token':_0x2429ec[_0x062c('0x21')],'client_id':_0x2429ec[_0x062c('0x22')],'client_secret':_0x2429ec[_0x062c('0x23')],'grant_type':_0x062c('0x24')},'json':!![]};return rp(_0x7b03e9)[_0x062c('0x25')](function(_0x120f40){accountsTokens[_0x2429ec['id']]={'access_token':_0x120f40['access_token'],'expires_in':moment()[_0x062c('0x26')](_0x120f40[_0x062c('0x27')],_0x062c('0x28'))};_0x38b0a7(_0x120f40['access_token']);})[_0x062c('0x29')](function(_0x570eb2){logger[_0x062c('0x2a')](_0x062c('0x2b'),_0x570eb2[_0x062c('0x2c')]);_0x7a0dce(_0x570eb2);});});}function getUser(_0x537b08,_0x4a648e,_0x337551,_0x3caadf){logger['info'](_0x062c('0x2d'));return request({'method':_0x062c('0x2e'),'uri':util[_0x062c('0x2f')](_0x062c('0x30'),_0x4a648e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x062c('0x31')+_0x537b08},'json':!![]})[_0x062c('0x25')](function(_0x5c6fba){if(_0x5c6fba[_0x062c('0x32')]){var _0x5997d5=-0x1;if(_[_0x062c('0x33')](_0x5c6fba[_0x062c('0x32')])){if(!_[_0x062c('0x34')](_0x3caadf)){_0x5997d5=_[_0x062c('0x35')](_0x5c6fba[_0x062c('0x32')],function(_0x4a02c5){return _0x4a02c5[_0x062c('0x36')]===_0x3caadf;});}if(_0x5997d5>=0x0){logger['info'](_0x062c('0x37'));}else{logger['info'](_0x062c('0x38'));_0x5997d5=_[_0x062c('0x35')](_0x5c6fba[_0x062c('0x32')],function(_0x424fe8){return _0x424fe8[_0x062c('0x39')]['name']===_0x062c('0x3a');});}return _0x5c6fba[_0x062c('0x32')][_0x5997d5];}else{if(_0x5c6fba['user'][_0x062c('0x39')][_0x062c('0x16')]==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0x5c6fba[_0x062c('0x3b')];return user;}else{logger['error'](_0x062c('0x3c'),JSON['stringify'](_0x5c6fba));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x062c('0xc')](_0x5c6fba));}}}else{logger[_0x062c('0x2a')](_0x062c('0x3c'),JSON[_0x062c('0xc')](_0x5c6fba));throw new Error(_0x062c('0x3d')+JSON[_0x062c('0xc')](_0x5c6fba));}})[_0x062c('0x29')](function(_0x9be984){console[_0x062c('0x2a')](_0x9be984);});}function getZohoUser(_0x262277,_0x48eb7c){return new BPromise(function(_0x9a4194,_0x245c65){request(_0x262277)['then'](function(_0x14babd){var _0x4ef105=null;if(_0x14babd){_0x4ef105=_0x14babd['data'][0x0];_0x4ef105['enduserType']=_0x48eb7c;}_0x9a4194(_0x4ef105);})[_0x062c('0x29')](function(_0x2fe970){_0x245c65(_0x2fe970);});});}function createEndUser(_0x3c2d33,_0xead944,_0xf58271,_0x2f21c3,_0x41feb8,_0xb4306e){var _0xf58271=getName(_0xf58271);return request({'method':'POST','uri':_0x062c('0x3e')+_0xead944+_0x062c('0x3f')+_[_0x062c('0x40')](_0xb4306e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xf58271[0x1],'First_Name':_0xf58271[0x0],'Phone':_0x2f21c3,'Owner':{'name':!_[_0x062c('0x34')](_0x41feb8[_0x062c('0x41')][_0x062c('0x16')])?_0x41feb8[_0x062c('0x41')]['name']:!_[_0x062c('0x34')](_0x41feb8[_0x062c('0x42')])?_0x41feb8[_0x062c('0x42')]+'\x20'+_0x41feb8[_0x062c('0x43')]:_0x41feb8[_0x062c('0x43')],'id':_0x41feb8['id']}}]},'headers':{'Authorization':_0x062c('0x31')+_0x3c2d33},'json':!![]})[_0x062c('0x25')](function(_0x1b50b8){if(_0x1b50b8&&_0x1b50b8['data'][0x0][_0x062c('0x44')]==='SUCCESS'){var _0x4f520c=_0x1b50b8[_0x062c('0x45')][0x0]['details'];_0x4f520c['enduserType']=_[_0x062c('0x40')](_0xb4306e[_0x062c('0x46')])+'s';return _0x4f520c;}logger['error'](_0x062c('0x3c'),JSON[_0x062c('0xc')](data));throw new Error(_0x062c('0x47')+JSON[_0x062c('0xc')](data));})['catch'](function(_0x3c028f){console[_0x062c('0x48')](_0x062c('0x49'),_0x3c028f);});}function getEndUser(_0x334886,_0x37ebc1,_0x57908e,_0x1f7304,_0x3895b1,_0x41101f,_0x9cfeba){var _0x4a0ff7={'method':'GET','uri':'','headers':{'Authorization':_0x062c('0x31')+_0x334886},'json':!![]};switch(_0x9cfeba[_0x062c('0x4a')]){case _0x062c('0x4b'):_0x4a0ff7[_0x062c('0x4c')]=_0x062c('0x3e')+_0x37ebc1+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3895b1+'))';return getZohoUser(_0x4a0ff7,_0x062c('0x4d'))[_0x062c('0x25')](function(_0x17dbc4){if(_0x17dbc4)return _0x17dbc4;_0x4a0ff7[_0x062c('0x4c')]='https://www.zohoapis.'+_0x37ebc1+_0x062c('0x4e')+_0x3895b1+'))';return getZohoUser(_0x4a0ff7,'Leads')[_0x062c('0x25')](function(_0x583b73){if(_0x583b73)return _0x583b73;if(_0x9cfeba[_0x062c('0x46')]!=_0x062c('0x4f')){return createEndUser(_0x334886,_0x37ebc1,_0x1f7304,_0x3895b1,_0x41101f,_0x9cfeba);}else{return{};}});});break;case _0x062c('0x50'):_0x4a0ff7[_0x062c('0x4c')]='https://www.zohoapis.'+_0x37ebc1+_0x062c('0x51')+_0x3895b1+'))';return getZohoUser(_0x4a0ff7,'Contacts')[_0x062c('0x25')](function(_0x1e4588){if(_0x1e4588)return _0x1e4588;if(_0x9cfeba['moduleCreate']!='nothing'){return createEndUser(_0x334886,_0x37ebc1,_0x1f7304,_0x3895b1,_0x41101f,_0x9cfeba);}else{return{};}});break;case _0x062c('0x52'):_0x4a0ff7[_0x062c('0x4c')]=_0x062c('0x3e')+_0x37ebc1+_0x062c('0x4e')+_0x3895b1+'))';return getZohoUser(_0x4a0ff7,_0x062c('0x53'))[_0x062c('0x25')](function(_0x5a382e){if(_0x5a382e)return _0x5a382e;if(_0x9cfeba[_0x062c('0x46')]!=_0x062c('0x4f')){return createEndUser(_0x334886,_0x37ebc1,_0x1f7304,_0x3895b1,_0x41101f,_0x9cfeba);}else{return{};}});break;}}function getCall(_0x3624ed,_0x8d7828,_0x50f2a4,_0x5c22a5,_0xbd182f,_0x24b0a7,_0x44f3c6,_0x222f14){logger[_0x062c('0x54')](_0x062c('0x55'));var _0x10cfdb={};_0x10cfdb[_0x062c('0x56')]={'name':!_[_0x062c('0x34')](_0x5c22a5[_0x062c('0x41')][_0x062c('0x16')])&&!_[_0x062c('0x34')](_0x5c22a5[_0x062c('0x39')][_0x062c('0x16')])&&_0x5c22a5[_0x062c('0x39')][_0x062c('0x16')]===_0x062c('0x57')?_0x5c22a5[_0x062c('0x41')][_0x062c('0x16')]:!_[_0x062c('0x34')](_0x5c22a5[_0x062c('0x42')])?_0x5c22a5['first_name']+'\x20'+_0x5c22a5[_0x062c('0x43')]:_0x5c22a5['last_name'],'id':_0x5c22a5['id']};_0x10cfdb[_0x062c('0x58')]=intUtil['getString'](_0x24b0a7[_0x062c('0x59')],_0x44f3c6,'\x20');_0x10cfdb[_0x062c('0x5a')]=intUtil[_0x062c('0x5b')](_0x24b0a7['Descriptions'],_0x44f3c6,'\x0a');if(_0xbd182f[_0x062c('0x5c')]===_0x062c('0x4d')){_0x10cfdb['Who_Id']={'name':!_['isNil'](_0xbd182f['Full_Name'])?_0xbd182f[_0x062c('0x5d')]:!_[_0x062c('0x34')](_0xbd182f['First_Name'])?_0xbd182f[_0x062c('0x5e')]+'\x20'+_0xbd182f[_0x062c('0x5f')]:_0xbd182f[_0x062c('0x5f')],'id':_0xbd182f['id']};}if(_0xbd182f[_0x062c('0x5c')]===_0x062c('0x53')){_0x10cfdb[_0x062c('0x60')]={'name':!_[_0x062c('0x34')](_0xbd182f['Full_Name'])?_0xbd182f['Full_Name']:!_['isNil'](_0xbd182f['First_Name'])?_0xbd182f['First_Name']+'\x20'+_0xbd182f[_0x062c('0x5f')]:_0xbd182f['Last_Name'],'id':_0xbd182f['id']};_0x10cfdb[_0x062c('0x61')]=_[_0x062c('0x40')](_0xbd182f['enduserType']);}if(_0x44f3c6['talktime']){_0x10cfdb[_0x062c('0x62')]=moment['utc'](parseInt(_0x44f3c6[_0x062c('0x63')])*0x3e8)['format'](_0x062c('0x64'));}else if(_0x44f3c6[_0x062c('0x65')]&&_0x44f3c6['endtime']){_0x10cfdb[_0x062c('0x62')]=moment[_0x062c('0x66')](moment(_0x44f3c6[_0x062c('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0x062c('0x68')](moment(_0x44f3c6[_0x062c('0x69')],_0x062c('0x6a'))))['format']('mm:ss');}switch(_0x44f3c6[_0x062c('0x6b')]){case _0x062c('0x6c'):_0x10cfdb[_0x062c('0x6d')]=_0x062c('0x6e');break;case'complete':case _0x062c('0x6f'):_0x10cfdb['Call_Result']=_0x062c('0x70');break;case _0x062c('0x71'):_0x10cfdb[_0x062c('0x6d')]=_0x062c('0x72');break;case _0x062c('0x73'):_0x10cfdb[_0x062c('0x6d')]=_0x062c('0x74');break;case'timeout':_0x10cfdb[_0x062c('0x6d')]=_0x062c('0x75');default:}_0x10cfdb[_0x062c('0x76')]=(_0x222f14==='outbound'?moment(_0x44f3c6['starttime'])[_0x062c('0x2f')](_0x062c('0x6a')):moment(_0x44f3c6[_0x062c('0x77')])[_0x062c('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x062c('0x6a'));_0x10cfdb[_0x062c('0x78')]=_0x222f14||_0x062c('0x79');_0x10cfdb=_[_0x062c('0x7a')](_0x10cfdb,getCustomFields(_0x24b0a7[_0x062c('0x7b')],_0x44f3c6));return request({'method':'POST','uri':_0x062c('0x3e')+_0x8d7828+_0x062c('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3624ed},'body':{'data':[_0x10cfdb]},'json':!![]})[_0x062c('0x25')](function(_0x443c15){if(_0x443c15&&_0x443c15[_0x062c('0x45')][0x0][_0x062c('0x44')]==='SUCCESS'){logger[_0x062c('0x54')]('Call\x20created!');return{'id':_0x443c15[_0x062c('0x45')][0x0][_0x062c('0x7d')]['id']};}})[_0x062c('0x29')](function(_0x554d49){logger[_0x062c('0x54')]('err',_0x554d49['stack']);console[_0x062c('0x48')](_0x062c('0x7e'),_0x554d49);});}exports[_0x062c('0x7f')]=function(_0xcd1094,_0x2aad86,_0x5b22ed,_0x39b527,_0x517c98,_0x251c27){var _0x241f1b,_0x132823,_0x362923;_0x251c27[_0x062c('0x80')]=intUtil['stripTrailingSlash'](_0x251c27[_0x062c('0x80')]);_0x251c27[_0x062c('0x81')]=intUtil[_0x062c('0x82')](_0x251c27[_0x062c('0x81')]);if(_0x517c98&&_0x517c98[_0x062c('0x83')]){logger[_0x062c('0x54')](_0x062c('0x84'),'Recording\x20is\x20enabled!');_0x2aad86['recordingURL']=_0x251c27[_0x062c('0x81')]+_0x062c('0x85')+_0x2aad86[_0x062c('0x86')]+_0x062c('0x87')+md5(_0x2aad86[_0x062c('0x86')]);}else{_0x2aad86[_0x062c('0x88')]='';}var _0x1ae5cd=_0x251c27[_0x062c('0x80')]===_0x062c('0x89')?'eu':_0x062c('0x8a');return getAccessToken(_0x251c27)['then'](function(_0x14f03c){_0x362923=_0x14f03c;return getUser(_0x362923,_0x1ae5cd,_0x251c27,_0x39b527['email']);})[_0x062c('0x25')](function(_0xec200e){_0x241f1b=_0xec200e;logger['info'](_0x062c('0x8b'),_0x241f1b['id']);return getEndUser(_0x362923,_0x1ae5cd,_0x251c27,_0x2aad86[_0x062c('0x8c')],_0x2aad86['calleridnum'],_0x241f1b,_0x5b22ed);})[_0x062c('0x25')](function(_0x3cc59a){_0x132823=_0x3cc59a;return getCall(_0x362923,_0x1ae5cd,_0x251c27,_0x241f1b,_0x132823,_0x5b22ed,_0x2aad86,_0x062c('0x79'));})[_0x062c('0x25')](function(_0x6b9c5d){if(_0x6b9c5d){logger['info'](_0x062c('0x8d'),_0x6b9c5d['id']);logger[_0x062c('0x54')](_0x062c('0x84'),_0x062c('0x8e'));emit(util[_0x062c('0x2f')](_0x062c('0x8f'),_0x39b527[_0x062c('0x16')]),_0x062c('0x90'),{'uri':'https://crm.'+_0x251c27[_0x062c('0x80')]+_0x062c('0x91')+_0x6b9c5d['id']});}})[_0x062c('0x29')](function(_0xc4147d){logger[_0x062c('0x2a')](_0x062c('0x84'),JSON[_0x062c('0xc')](_0xc4147d));});};exports['outbound']=function(_0x590857,_0x4254fd,_0x24f9ee,_0x3adee1,_0x59d9c5,_0x5f2f64,_0x4b9535){var _0x304b2b,_0x5dee0a,_0x17ba3b;_0x5f2f64[_0x062c('0x80')]=intUtil[_0x062c('0x82')](_0x5f2f64['host']);_0x5f2f64[_0x062c('0x81')]=intUtil[_0x062c('0x82')](_0x5f2f64[_0x062c('0x81')]);if(_0x4b9535&&_0x4b9535['recordingFormat']&&_0x4b9535[_0x062c('0x92')]!==_0x062c('0x93')){logger[_0x062c('0x54')]('[OUTBOUND]',_0x062c('0x94'));_0x4254fd[_0x062c('0x88')]=_0x5f2f64[_0x062c('0x81')]+'/api/voice/recordings/'+_0x4254fd[_0x062c('0x86')]+_0x062c('0x87')+md5(_0x4254fd[_0x062c('0x86')]);}var _0xfc9d98=_0x5f2f64[_0x062c('0x80')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x5f2f64)[_0x062c('0x25')](function(_0x3ab5c1){_0x17ba3b=_0x3ab5c1;return getUser(_0x17ba3b,_0xfc9d98,_0x5f2f64,_0x3adee1[_0x062c('0x36')]);})[_0x062c('0x25')](function(_0x1edccf){_0x304b2b=_0x1edccf;logger[_0x062c('0x54')]('The\x20User\x20ID\x20is:',_0x304b2b['id']);return getEndUser(_0x17ba3b,_0xfc9d98,_0x5f2f64,_0x4254fd[_0x062c('0x95')],_0x4254fd[_0x062c('0x96')],_0x304b2b,_0x24f9ee);})[_0x062c('0x25')](function(_0x35b55c){_0x5dee0a=_0x35b55c;return getCall(_0x17ba3b,_0xfc9d98,_0x5f2f64,_0x304b2b,_0x5dee0a,_0x24f9ee,_0x4254fd,_0x062c('0x97'));})[_0x062c('0x25')](function(_0x5acc7f){if(_0x5acc7f){logger[_0x062c('0x54')](_0x062c('0x8d'),_0x5acc7f['id']);logger[_0x062c('0x54')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x062c('0x8f'),_0x3adee1[_0x062c('0x16')]),_0x062c('0x90'),{'uri':'https://crm.'+_0x5f2f64[_0x062c('0x80')]+_0x062c('0x91')+_0x5acc7f['id']});}})[_0x062c('0x29')](function(_0x56e36d){logger['error'](_0x062c('0x98'),JSON[_0x062c('0xc')](_0x56e36d));});};exports[_0x062c('0x99')]=function(_0x1497e1,_0xc2e608,_0x124861,_0x4bbdec,_0x78b4cd,_0x24be9d){var _0x4b71bd,_0x5dbf69,_0x1f3145;_0x24be9d['host']=intUtil[_0x062c('0x82')](_0x24be9d[_0x062c('0x80')]);_0x24be9d[_0x062c('0x81')]=intUtil[_0x062c('0x82')](_0x24be9d[_0x062c('0x81')]);if(_0x78b4cd&&_0x78b4cd['monitor_format']){logger[_0x062c('0x54')]('['+_0xc2e608[_0x062c('0x6b')]['toUpperCase']()+']',_0x062c('0x94'));_0xc2e608[_0x062c('0x88')]=_0x24be9d[_0x062c('0x81')]+'/api/voice/recordings/'+_0xc2e608[_0x062c('0x86')]+_0x062c('0x87')+md5(_0xc2e608[_0x062c('0x86')]);}else{_0xc2e608[_0x062c('0x88')]='';}var _0x4b6b84=_0x24be9d['host']===_0x062c('0x89')?'eu':_0x062c('0x8a');return getAccessToken(_0x24be9d)[_0x062c('0x25')](function(_0x49d868){_0x1f3145=_0x49d868;return getUser(_0x1f3145,_0x4b6b84,_0x24be9d);})['then'](function(_0x554e2c){_0x4b71bd=_0x554e2c;logger[_0x062c('0x54')](_0x062c('0x8b'),_0x4b71bd['id']);return getEndUser(_0x1f3145,_0x4b6b84,_0x24be9d,_0xc2e608[_0x062c('0x8c')],_0xc2e608[_0x062c('0x9a')],_0x4b71bd,_0x124861);})['then'](function(_0x39b535){_0x5dbf69=_0x39b535;return getCall(_0x1f3145,_0x4b6b84,_0x24be9d,_0x4b71bd,_0x5dbf69,_0x124861,_0xc2e608,_0x062c('0x79'));})['then'](function(_0x42cbfc){if(_0x42cbfc){logger['info'](_0x062c('0x8d'),_0x42cbfc['id']);}})['catch'](function(_0x6906f4){logger['error']('['+_0xc2e608['lastevent'][_0x062c('0x9b')]()+']',JSON['stringify'](_0x6906f4));});}; \ No newline at end of file +var _0x84e5=['seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','https://www.zohoapis.','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','unmanaged','lastevent','toUpperCase','request-promise','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','debug','stringify','forEach','type','string','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x84e5,0x111));var _0x584e=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x84e5[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require('lodash');var rp=require(_0x584e('0x0'));var md5=require('md5');var util=require(_0x584e('0x1'));var intUtil=require(_0x584e('0x2'));var moment=require(_0x584e('0x3'));var Redis=require(_0x584e('0x4'));var BPromise=require('bluebird');var config=require(_0x584e('0x5'));var logger=require(_0x584e('0x6'))(_0x584e('0x7'));config[_0x584e('0x8')]=_[_0x584e('0x9')](config[_0x584e('0x8')],{'host':_0x584e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x584e('0x8')]));function emit(_0x4db377,_0x7653b8,_0xf37c79){io['to'](_0x4db377)['emit'](_0x7653b8,_0xf37c79);}function request(_0x5a3795){logger[_0x584e('0xb')]('[HTTP]',JSON[_0x584e('0xc')](_0x5a3795));return rp(_0x5a3795);}function getCustomFields(_0x4fd6fe,_0x3ce180){var _0x1fa193={};if(_0x4fd6fe['length']>0x0){_[_0x584e('0xd')](_0x4fd6fe,function(_0x268c26){if(_0x268c26[_0x584e('0xe')]===_0x584e('0xf')&&_0x268c26[_0x584e('0x10')]){_0x1fa193[_0x268c26[_0x584e('0x10')]]=_0x268c26[_0x584e('0x11')][_0x584e('0x12')]();}else if(_0x268c26['type']===_0x584e('0x13')&&_0x268c26['variableName']&&_0x268c26[_0x584e('0x10')]&&_0x3ce180[_0x268c26[_0x584e('0x14')]]){_0x1fa193[_0x268c26[_0x584e('0x10')]]=_0x3ce180[_0x268c26['variableName']][_0x584e('0x12')]();}else if(_0x268c26['type']==='customVariable'&&_0x268c26[_0x584e('0x15')]&&_0x268c26['Variable'][_0x584e('0x16')]&&_0x268c26[_0x584e('0x10')]&&_0x3ce180[_0x268c26[_0x584e('0x15')][_0x584e('0x16')][_0x584e('0x17')]()]){_0x1fa193[_0x268c26[_0x584e('0x10')]]=_0x3ce180[_0x268c26[_0x584e('0x15')]['name']['toLowerCase']()]['toString']();}});}return _0x1fa193;}function getName(_0x153dc2){if(_0x153dc2['indexOf']('\x20')>0x0){var _0x207313=_0x153dc2[_0x584e('0x18')](/ (.+)/);if(_0x207313[0x1]){return _0x207313;}}return[_0x153dc2,_0x153dc2];}var accountsTokens={};function getAccessToken(_0x4db9de){return new Promise(function(_0x3f10ad,_0x57df72){if(!_[_0x584e('0x19')](accountsTokens[_0x4db9de['id']])&&!_[_0x584e('0x19')](accountsTokens[_0x4db9de['id']][_0x584e('0x1a')])){if(moment()[_0x584e('0x1b')](accountsTokens[_0x4db9de['id']][_0x584e('0x1c')])){_0x3f10ad(accountsTokens[_0x4db9de['id']][_0x584e('0x1a')]);}}var _0x5a8cc1;switch(_0x4db9de[_0x584e('0x1d')]){case'US':_0x5a8cc1=_0x584e('0x1e');break;case'AU':_0x5a8cc1=_0x584e('0x1f');break;case'EU':_0x5a8cc1=_0x584e('0x20');break;case'IN':_0x5a8cc1=_0x584e('0x21');break;case'CN':_0x5a8cc1=_0x584e('0x22');break;default:_0x5a8cc1=_0x584e('0x20');break;}var _0x35794f={'method':_0x584e('0x23'),'uri':_0x5a8cc1+_0x584e('0x24'),'qs':{'refresh_token':_0x4db9de[_0x584e('0x25')],'client_id':_0x4db9de[_0x584e('0x26')],'client_secret':_0x4db9de[_0x584e('0x27')],'grant_type':_0x584e('0x28')},'json':!![]};return rp(_0x35794f)['then'](function(_0x15ce87){accountsTokens[_0x4db9de['id']]={'access_token':_0x15ce87[_0x584e('0x1a')],'expires_in':moment()['add'](_0x15ce87['expires_in'],_0x584e('0x29'))};_0x3f10ad(_0x15ce87[_0x584e('0x1a')]);})[_0x584e('0x2a')](function(_0x492258){logger[_0x584e('0x2b')](_0x584e('0x2c'),_0x492258[_0x584e('0x2d')]);_0x57df72(_0x492258);});});}function getUser(_0x1f3105,_0x5e0578,_0x1a5bc,_0x75b8d0){logger['info'](_0x584e('0x2e'));return request({'method':_0x584e('0x2f'),'uri':util[_0x584e('0x30')](_0x584e('0x31'),_0x5e0578),'qs':{'type':_0x584e('0x32')},'headers':{'Authorization':_0x584e('0x33')+_0x1f3105},'json':!![]})[_0x584e('0x34')](function(_0x48de53){if(_0x48de53[_0x584e('0x35')]){var _0x19753a=-0x1;if(_[_0x584e('0x36')](_0x48de53['users'])){if(!_['isNil'](_0x75b8d0)){_0x19753a=_[_0x584e('0x37')](_0x48de53[_0x584e('0x35')],function(_0x183078){return _0x183078[_0x584e('0x38')]===_0x75b8d0;});}if(_0x19753a>=0x0){logger[_0x584e('0x39')](_0x584e('0x3a'));}else{logger[_0x584e('0x39')](_0x584e('0x3b'));_0x19753a=_['findIndex'](_0x48de53[_0x584e('0x35')],function(_0x2ed086){return _0x2ed086[_0x584e('0x3c')][_0x584e('0x16')]===_0x584e('0x3d');});}return _0x48de53['users'][_0x19753a];}else{if(_0x48de53[_0x584e('0x3e')][_0x584e('0x3c')][_0x584e('0x16')]===_0x584e('0x3d')){logger[_0x584e('0x39')]('Using\x20the\x20admin\x20account!');user=_0x48de53[_0x584e('0x3e')];return user;}else{logger['error'](_0x584e('0x3f'),JSON[_0x584e('0xc')](_0x48de53));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x48de53));}}}else{logger[_0x584e('0x2b')](_0x584e('0x3f'),JSON[_0x584e('0xc')](_0x48de53));throw new Error(_0x584e('0x40')+JSON[_0x584e('0xc')](_0x48de53));}})[_0x584e('0x2a')](function(_0x4285e7){console['error'](_0x4285e7);});}function getZohoUser(_0x22cf93,_0x17467b){return new BPromise(function(_0x490db5,_0x365b3d){request(_0x22cf93)['then'](function(_0x479004){var _0xaf1589=null;if(_0x479004){_0xaf1589=_0x479004[_0x584e('0x41')][0x0];_0xaf1589[_0x584e('0x42')]=_0x17467b;}_0x490db5(_0xaf1589);})[_0x584e('0x2a')](function(_0x4fe50b){_0x365b3d(_0x4fe50b);});});}function createEndUser(_0x362549,_0x5a05b2,_0x593334,_0x3a5f0c,_0x4f079c,_0x1de30d){var _0x593334=getName(_0x593334);return request({'method':_0x584e('0x23'),'uri':'https://www.zohoapis.'+_0x5a05b2+_0x584e('0x43')+_[_0x584e('0x44')](_0x1de30d[_0x584e('0x45')])+'s','body':{'data':[{'Last_Name':_0x593334[0x1],'First_Name':_0x593334[0x0],'Phone':_0x3a5f0c,'Owner':{'name':!_[_0x584e('0x19')](_0x4f079c[_0x584e('0x46')][_0x584e('0x16')])?_0x4f079c[_0x584e('0x46')][_0x584e('0x16')]:!_[_0x584e('0x19')](_0x4f079c['first_name'])?_0x4f079c[_0x584e('0x47')]+'\x20'+_0x4f079c[_0x584e('0x48')]:_0x4f079c[_0x584e('0x48')],'id':_0x4f079c['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x362549},'json':!![]})[_0x584e('0x34')](function(_0x5c87e6){if(_0x5c87e6&&_0x5c87e6[_0x584e('0x41')][0x0][_0x584e('0x49')]===_0x584e('0x4a')){var _0x51f6c6=_0x5c87e6['data'][0x0][_0x584e('0x4b')];_0x51f6c6[_0x584e('0x42')]=_[_0x584e('0x44')](_0x1de30d[_0x584e('0x45')])+'s';return _0x51f6c6;}logger[_0x584e('0x2b')](_0x584e('0x3f'),JSON[_0x584e('0xc')](data));throw new Error(_0x584e('0x4c')+JSON[_0x584e('0xc')](data));})[_0x584e('0x2a')](function(_0x33cca2){console[_0x584e('0x4d')](_0x584e('0x4e'),_0x33cca2);});}function getEndUser(_0x2742d4,_0x1cf41d,_0x597f3b,_0x2b5dfc,_0x1384e3,_0x29b7db,_0x4606ad){var _0x4763ef={'method':_0x584e('0x2f'),'uri':'','headers':{'Authorization':_0x584e('0x33')+_0x2742d4},'json':!![]};switch(_0x4606ad['moduleSearch']){case _0x584e('0x4f'):_0x4763ef['uri']='https://www.zohoapis.'+_0x1cf41d+_0x584e('0x50')+_0x1384e3+'))';return getZohoUser(_0x4763ef,_0x584e('0x51'))['then'](function(_0x2ca287){if(_0x2ca287)return _0x2ca287;_0x4763ef[_0x584e('0x52')]='https://www.zohoapis.'+_0x1cf41d+_0x584e('0x53')+_0x1384e3+'))';return getZohoUser(_0x4763ef,'Leads')[_0x584e('0x34')](function(_0x311f00){if(_0x311f00)return _0x311f00;if(_0x4606ad['moduleCreate']!=_0x584e('0x54')){return createEndUser(_0x2742d4,_0x1cf41d,_0x2b5dfc,_0x1384e3,_0x29b7db,_0x4606ad);}else{return{};}});});break;case _0x584e('0x55'):_0x4763ef['uri']=_0x584e('0x56')+_0x1cf41d+_0x584e('0x50')+_0x1384e3+'))';return getZohoUser(_0x4763ef,_0x584e('0x51'))[_0x584e('0x34')](function(_0x3017ed){if(_0x3017ed)return _0x3017ed;if(_0x4606ad['moduleCreate']!=_0x584e('0x54')){return createEndUser(_0x2742d4,_0x1cf41d,_0x2b5dfc,_0x1384e3,_0x29b7db,_0x4606ad);}else{return{};}});break;case _0x584e('0x57'):_0x4763ef[_0x584e('0x52')]='https://www.zohoapis.'+_0x1cf41d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1384e3+'))';return getZohoUser(_0x4763ef,_0x584e('0x58'))['then'](function(_0x2c5a2e){if(_0x2c5a2e)return _0x2c5a2e;if(_0x4606ad[_0x584e('0x45')]!='nothing'){return createEndUser(_0x2742d4,_0x1cf41d,_0x2b5dfc,_0x1384e3,_0x29b7db,_0x4606ad);}else{return{};}});break;}}function getCall(_0x141ff7,_0x25da46,_0x248196,_0x278b12,_0x894fff,_0x5dcaf4,_0x4243ec,_0x32c0ef){logger[_0x584e('0x39')](_0x584e('0x59'));var _0x2dcca0={};_0x2dcca0[_0x584e('0x5a')]={'name':!_[_0x584e('0x19')](_0x278b12[_0x584e('0x46')][_0x584e('0x16')])&&!_[_0x584e('0x19')](_0x278b12[_0x584e('0x3c')]['name'])&&_0x278b12[_0x584e('0x3c')][_0x584e('0x16')]===_0x584e('0x5b')?_0x278b12[_0x584e('0x46')]['name']:!_['isNil'](_0x278b12['first_name'])?_0x278b12[_0x584e('0x47')]+'\x20'+_0x278b12[_0x584e('0x48')]:_0x278b12[_0x584e('0x48')],'id':_0x278b12['id']};_0x2dcca0[_0x584e('0x5c')]=intUtil[_0x584e('0x5d')](_0x5dcaf4['Subjects'],_0x4243ec,'\x20');_0x2dcca0[_0x584e('0x5e')]=intUtil[_0x584e('0x5d')](_0x5dcaf4['Descriptions'],_0x4243ec,'\x0a');if(_0x894fff[_0x584e('0x42')]===_0x584e('0x51')){_0x2dcca0[_0x584e('0x5f')]={'name':!_[_0x584e('0x19')](_0x894fff['Full_Name'])?_0x894fff[_0x584e('0x60')]:!_['isNil'](_0x894fff['First_Name'])?_0x894fff[_0x584e('0x61')]+'\x20'+_0x894fff[_0x584e('0x62')]:_0x894fff['Last_Name'],'id':_0x894fff['id']};}if(_0x894fff[_0x584e('0x42')]==='Leads'){_0x2dcca0['What_Id']={'name':!_[_0x584e('0x19')](_0x894fff[_0x584e('0x60')])?_0x894fff[_0x584e('0x60')]:!_[_0x584e('0x19')](_0x894fff[_0x584e('0x61')])?_0x894fff[_0x584e('0x61')]+'\x20'+_0x894fff[_0x584e('0x62')]:_0x894fff['Last_Name'],'id':_0x894fff['id']};_0x2dcca0[_0x584e('0x63')]=_['startCase'](_0x894fff[_0x584e('0x42')]);}if(_0x4243ec[_0x584e('0x64')]){_0x2dcca0[_0x584e('0x65')]=moment['utc'](parseInt(_0x4243ec[_0x584e('0x64')])*0x3e8)[_0x584e('0x30')](_0x584e('0x66'));}else if(_0x4243ec[_0x584e('0x67')]&&_0x4243ec[_0x584e('0x68')]){_0x2dcca0['Call_Duration']=moment[_0x584e('0x69')](moment(_0x4243ec[_0x584e('0x68')],_0x584e('0x6a'))[_0x584e('0x6b')](moment(_0x4243ec[_0x584e('0x6c')],_0x584e('0x6a'))))[_0x584e('0x30')](_0x584e('0x66'));}switch(_0x4243ec['lastevent']){case _0x584e('0x6d'):_0x2dcca0[_0x584e('0x6e')]=_0x584e('0x6f');break;case _0x584e('0x70'):case _0x584e('0x71'):_0x2dcca0[_0x584e('0x6e')]=_0x584e('0x72');break;case _0x584e('0x73'):_0x2dcca0['Call_Result']=_0x584e('0x74');break;case'abandoned':_0x2dcca0[_0x584e('0x6e')]=_0x584e('0x75');break;case _0x584e('0x76'):_0x2dcca0[_0x584e('0x6e')]=_0x584e('0x77');default:}_0x2dcca0[_0x584e('0x78')]=(_0x32c0ef===_0x584e('0x79')?moment(_0x4243ec[_0x584e('0x6c')])[_0x584e('0x30')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x4243ec[_0x584e('0x7a')])[_0x584e('0x30')](_0x584e('0x6a')))||moment()[_0x584e('0x30')](_0x584e('0x6a'));_0x2dcca0[_0x584e('0x7b')]=_0x32c0ef||_0x584e('0x7c');_0x2dcca0=_[_0x584e('0x7d')](_0x2dcca0,getCustomFields(_0x5dcaf4[_0x584e('0x7e')],_0x4243ec));return request({'method':_0x584e('0x23'),'uri':_0x584e('0x56')+_0x25da46+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x141ff7},'body':{'data':[_0x2dcca0]},'json':!![]})[_0x584e('0x34')](function(_0x55cb47){if(_0x55cb47&&_0x55cb47[_0x584e('0x41')][0x0][_0x584e('0x49')]==='SUCCESS'){logger[_0x584e('0x39')](_0x584e('0x7f'));return{'id':_0x55cb47['data'][0x0]['details']['id']};}})['catch'](function(_0x5e0963){logger[_0x584e('0x39')](_0x584e('0x80'),_0x5e0963[_0x584e('0x2d')]);console[_0x584e('0x4d')](_0x584e('0x80'),_0x5e0963);});}exports[_0x584e('0x81')]=function(_0x32e25c,_0x5317b0,_0x505cfd,_0x5cbd2b,_0x567d18,_0x1050d9){var _0x2453cb,_0xad3c76,_0x4c0a10;_0x1050d9[_0x584e('0x82')]=intUtil[_0x584e('0x83')](_0x1050d9[_0x584e('0x82')]);_0x1050d9['serverUrl']=intUtil[_0x584e('0x83')](_0x1050d9[_0x584e('0x84')]);if(_0x567d18&&_0x567d18[_0x584e('0x85')]){logger[_0x584e('0x39')](_0x584e('0x86'),_0x584e('0x87'));_0x5317b0[_0x584e('0x88')]=_0x1050d9['serverUrl']+_0x584e('0x89')+_0x5317b0[_0x584e('0x8a')]+_0x584e('0x8b')+md5(_0x5317b0[_0x584e('0x8a')]);}else{_0x5317b0['recordingURL']='';}var _0x3ac371=_0x1050d9[_0x584e('0x82')]===_0x584e('0x8c')?'eu':_0x584e('0x8d');return getAccessToken(_0x1050d9)['then'](function(_0x46ec60){_0x4c0a10=_0x46ec60;return getUser(_0x4c0a10,_0x3ac371,_0x1050d9,_0x5cbd2b[_0x584e('0x38')]);})['then'](function(_0x39831f){_0x2453cb=_0x39831f;logger['info']('The\x20User\x20ID\x20is:',_0x2453cb['id']);return getEndUser(_0x4c0a10,_0x3ac371,_0x1050d9,_0x5317b0[_0x584e('0x8e')],_0x5317b0[_0x584e('0x8f')],_0x2453cb,_0x505cfd);})[_0x584e('0x34')](function(_0x167c6f){_0xad3c76=_0x167c6f;return getCall(_0x4c0a10,_0x3ac371,_0x1050d9,_0x2453cb,_0xad3c76,_0x505cfd,_0x5317b0,_0x584e('0x7c'));})[_0x584e('0x34')](function(_0x520da6){if(_0x520da6){logger[_0x584e('0x39')]('The\x20Call\x20ID\x20is:',_0x520da6['id']);logger[_0x584e('0x39')]('[QUEUE]',_0x584e('0x90'));emit(util[_0x584e('0x30')]('user:%s',_0x5cbd2b[_0x584e('0x16')]),_0x584e('0x91'),{'uri':_0x584e('0x92')+_0x1050d9['host']+_0x584e('0x93')+_0x520da6['id']});}})[_0x584e('0x2a')](function(_0x3d2009){logger['error'](_0x584e('0x86'),JSON[_0x584e('0xc')](_0x3d2009));});};exports['outbound']=function(_0x2bac61,_0x3e8089,_0x42ba9e,_0x3b7c6d,_0x306084,_0x3d205b,_0x5c7d43){var _0x209c23,_0x179144,_0x69ec22;_0x3d205b['host']=intUtil[_0x584e('0x83')](_0x3d205b['host']);_0x3d205b['serverUrl']=intUtil[_0x584e('0x83')](_0x3d205b[_0x584e('0x84')]);if(_0x5c7d43&&_0x5c7d43[_0x584e('0x94')]&&_0x5c7d43[_0x584e('0x94')]!=='none'){logger[_0x584e('0x39')](_0x584e('0x95'),_0x584e('0x87'));_0x3e8089[_0x584e('0x88')]=_0x3d205b[_0x584e('0x84')]+_0x584e('0x89')+_0x3e8089[_0x584e('0x8a')]+_0x584e('0x8b')+md5(_0x3e8089['uniqueid']);}var _0x44ab1d=_0x3d205b[_0x584e('0x82')]==='zoho.eu'?'eu':_0x584e('0x8d');return getAccessToken(_0x3d205b)[_0x584e('0x34')](function(_0x423743){_0x69ec22=_0x423743;return getUser(_0x69ec22,_0x44ab1d,_0x3d205b,_0x3b7c6d['email']);})['then'](function(_0x12ac60){_0x209c23=_0x12ac60;logger[_0x584e('0x39')](_0x584e('0x96'),_0x209c23['id']);return getEndUser(_0x69ec22,_0x44ab1d,_0x3d205b,_0x3e8089[_0x584e('0x97')],_0x3e8089[_0x584e('0x98')],_0x209c23,_0x42ba9e);})[_0x584e('0x34')](function(_0x4185f4){_0x179144=_0x4185f4;return getCall(_0x69ec22,_0x44ab1d,_0x3d205b,_0x209c23,_0x179144,_0x42ba9e,_0x3e8089,'Outbound');})['then'](function(_0x577308){if(_0x577308){logger[_0x584e('0x39')](_0x584e('0x99'),_0x577308['id']);logger[_0x584e('0x39')](_0x584e('0x95'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3b7c6d['name']),_0x584e('0x91'),{'uri':'https://crm.'+_0x3d205b[_0x584e('0x82')]+'/crm/EntityInfo.do?module=Calls&id='+_0x577308['id']});}})[_0x584e('0x2a')](function(_0x5aa801){logger[_0x584e('0x2b')]('[OUTBOUND]',JSON['stringify'](_0x5aa801));});};exports[_0x584e('0x9a')]=function(_0x4df6cb,_0xb221c1,_0x4d74b0,_0x22e5a2,_0x4c8437,_0x5b197e){var _0x25d03e,_0x323824,_0x1cfd52;_0x5b197e[_0x584e('0x82')]=intUtil[_0x584e('0x83')](_0x5b197e[_0x584e('0x82')]);_0x5b197e[_0x584e('0x84')]=intUtil[_0x584e('0x83')](_0x5b197e['serverUrl']);if(_0x4c8437&&_0x4c8437[_0x584e('0x85')]){logger[_0x584e('0x39')]('['+_0xb221c1[_0x584e('0x9b')][_0x584e('0x9c')]()+']','Recording\x20is\x20enabled!');_0xb221c1[_0x584e('0x88')]=_0x5b197e[_0x584e('0x84')]+'/api/voice/recordings/'+_0xb221c1[_0x584e('0x8a')]+_0x584e('0x8b')+md5(_0xb221c1[_0x584e('0x8a')]);}else{_0xb221c1[_0x584e('0x88')]='';}var _0xda130c=_0x5b197e[_0x584e('0x82')]==='zoho.eu'?'eu':_0x584e('0x8d');return getAccessToken(_0x5b197e)['then'](function(_0x4c638d){_0x1cfd52=_0x4c638d;return getUser(_0x1cfd52,_0xda130c,_0x5b197e);})[_0x584e('0x34')](function(_0x53a35b){_0x25d03e=_0x53a35b;logger['info'](_0x584e('0x96'),_0x25d03e['id']);return getEndUser(_0x1cfd52,_0xda130c,_0x5b197e,_0xb221c1[_0x584e('0x8e')],_0xb221c1[_0x584e('0x8f')],_0x25d03e,_0x4d74b0);})[_0x584e('0x34')](function(_0x203214){_0x323824=_0x203214;return getCall(_0x1cfd52,_0xda130c,_0x5b197e,_0x25d03e,_0x323824,_0x4d74b0,_0xb221c1,_0x584e('0x7c'));})['then'](function(_0xa91116){if(_0xa91116){logger['info'](_0x584e('0x99'),_0xa91116['id']);}})[_0x584e('0x2a')](function(_0x3a70a0){logger[_0x584e('0x2b')]('['+_0xb221c1[_0x584e('0x9b')][_0x584e('0x9c')]()+']',JSON['stringify'](_0x3a70a0));});}; \ 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 8956509..1b964d6 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(_0x1f21c7,_0x5bd3f2){var _0x48c32e=function(_0x51980b){while(--_0x51980b){_0x1f21c7['push'](_0x1f21c7['shift']());}};_0x48c32e(++_0x5bd3f2);}(_0x7a54,0x106));var _0x47a5=function(_0x179b46,_0x57a372){_0x179b46=_0x179b46-0x0;var _0x4a2035=_0x7a54[_0x179b46];return _0x4a2035;};'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(_0x1438f0,_0xa837e0){var _0x4133b3=function(_0x365e02){while(--_0x365e02){_0x1438f0['push'](_0x1438f0['shift']());}};_0x4133b3(++_0xa837e0);}(_0x7a54,0x106));var _0x47a5=function(_0x10273a,_0x1e700f){_0x10273a=_0x10273a-0x0;var _0x59b653=_0x7a54[_0x10273a];return _0x59b653;};'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 d3512a5..66c1ddc 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x5e3b7d,_0x4f429f){var _0x4aa9f5=function(_0x35a802){while(--_0x35a802){_0x5e3b7d['push'](_0x5e3b7d['shift']());}};_0x4aa9f5(++_0x4f429f);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a91d9,_0x47cedb){_0x5a91d9=_0x5a91d9-0x0;var _0x5275e2=_0xb10b[_0x5a91d9];return _0x5275e2;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _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(_0x5ac918,_0x40234e){var _0x217317=function(_0x337f11){while(--_0x337f11){_0x5ac918['push'](_0x5ac918['shift']());}};_0x217317(++_0x40234e);}(_0xb10b,0x12a));var _0xbb10=function(_0x16f39a,_0x233f55){_0x16f39a=_0x16f39a-0x0;var _0xd6a5da=_0xb10b[_0x16f39a];return _0xd6a5da;};'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 c9f9dda..89673bc 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 _0x98a7=['error','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','rpc'];(function(_0x137cf4,_0x467afd){var _0x3f25ca=function(_0x1cc0d4){while(--_0x1cc0d4){_0x137cf4['push'](_0x137cf4['shift']());}};_0x3f25ca(++_0x467afd);}(_0x98a7,0x9e));var _0x798a=function(_0xbac363,_0x55c3ab){_0xbac363=_0xbac363-0x0;var _0x51d69a=_0x98a7[_0xbac363];return _0x51d69a;};'use strict';var jayson=require(_0x798a('0x0'));var BPromise=require(_0x798a('0x1'));var logger=require(_0x798a('0x2'))(_0x798a('0x3'));var client=jayson[_0x798a('0x4')][_0x798a('0x5')]({'port':0x2329});client[_0x798a('0x6')]=function(_0x5d1e77,_0x15c97c){return new BPromise(function(_0x3c85b6,_0x4dc381){return client['request'](_0x5d1e77,_0x15c97c)[_0x798a('0x7')](function(_0x451a05){logger[_0x798a('0x8')](_0x798a('0x9'),_0x798a('0x3'),_0x5d1e77,_0x15c97c,_0x451a05);if(_0x451a05[_0x798a('0xa')]){logger[_0x798a('0xa')](_0x798a('0x9'),'routing',_0x5d1e77,_0x451a05[_0x798a('0xa')][_0x798a('0xb')],_0x15c97c);return _0x4dc381(_0x451a05[_0x798a('0xa')][_0x798a('0xb')]);}else{return _0x3c85b6(_0x451a05['result']);}})[_0x798a('0xc')](function(_0x33db74){logger[_0x798a('0xa')](_0x798a('0x9'),_0x798a('0x3'),_0x5d1e77,_0x33db74,_0x15c97c);return _0x4dc381(_0x33db74);});});};module[_0x798a('0xd')]=client; \ No newline at end of file +var _0xf2c7=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then'];(function(_0x4bfcc4,_0x460dc9){var _0x85ce92=function(_0x51045d){while(--_0x51045d){_0x4bfcc4['push'](_0x4bfcc4['shift']());}};_0x85ce92(++_0x460dc9);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0xf2c7[_0x15f3c0];return _0x1adfe0;};'use strict';var jayson=require(_0x7f2c('0x0'));var BPromise=require(_0x7f2c('0x1'));var logger=require(_0x7f2c('0x2'))(_0x7f2c('0x3'));var client=jayson['client'][_0x7f2c('0x4')]({'port':0x2329});client[_0x7f2c('0x5')]=function(_0x4f526a,_0x4f340c){return new BPromise(function(_0xebab07,_0x4cb6ff){return client[_0x7f2c('0x6')](_0x4f526a,_0x4f340c)[_0x7f2c('0x7')](function(_0x4e348c){logger[_0x7f2c('0x8')](_0x7f2c('0x9'),_0x7f2c('0x3'),_0x4f526a,_0x4f340c,_0x4e348c);if(_0x4e348c['error']){logger[_0x7f2c('0xa')](_0x7f2c('0x9'),_0x7f2c('0x3'),_0x4f526a,_0x4e348c[_0x7f2c('0xa')][_0x7f2c('0xb')],_0x4f340c);return _0x4cb6ff(_0x4e348c[_0x7f2c('0xa')]['message']);}else{return _0xebab07(_0x4e348c[_0x7f2c('0xc')]);}})[_0x7f2c('0xd')](function(_0x3edb66){logger[_0x7f2c('0xa')](_0x7f2c('0x9'),_0x7f2c('0x3'),_0x4f526a,_0x3edb66,_0x4f340c);return _0x4cb6ff(_0x3edb66);});});};module[_0x7f2c('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index eeef11d..628e702 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 _0x7fd6=['Setting','findOne','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','listen'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fd6,0x157));var _0x67fd=function(_0x5897bb,_0x94d79d){_0x5897bb=_0x5897bb-0x0;var _0x1ad763=_0x7fd6[_0x5897bb];return _0x1ad763;};'use strict';var BPromise=require(_0x67fd('0x0'));var server=require('./server');var Realtime=require(_0x67fd('0x1'));var EmailChannel=require(_0x67fd('0x2'));var mailAccount=require(_0x67fd('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x67fd('0x4'))['db'];function initRealtime(){return BPromise[_0x67fd('0x5')]()[_0x67fd('0x6')](mailAccount['getMailAccounts']())[_0x67fd('0x6')](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x67fd('0x7')](realtime,email)[_0x67fd('0x6')](function(_0x21d7b1){return initRealtime();})[_0x67fd('0x6')](function(_0x74be46){return db[_0x67fd('0x8')][_0x67fd('0x9')]({'attributes':['id',_0x67fd('0xa')],'raw':!![]});})['then'](function(_0x25ce35){return setInterval(initRealtime,_0x25ce35[_0x67fd('0xa')]*0x3e8);})[_0x67fd('0xb')](function(_0x65f39c){console[_0x67fd('0xc')](_0x65f39c);});}main(); \ No newline at end of file +var _0xdbd0=['initMailAccounts','refresh','mailAccounts','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0xdbd0,0x88));var _0x0dbd=function(_0x438740,_0x21ba83){_0x438740=_0x438740-0x0;var _0x40ae8a=_0xdbd0[_0x438740];return _0x40ae8a;};'use strict';var BPromise=require(_0x0dbd('0x0'));var server=require(_0x0dbd('0x1'));var Realtime=require(_0x0dbd('0x2'));var EmailChannel=require(_0x0dbd('0x3'));var mailAccount=require(_0x0dbd('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x0dbd('0x5')]()[_0x0dbd('0x6')](mailAccount[_0x0dbd('0x7')]())['then'](realtime[_0x0dbd('0x8')]())[_0x0dbd('0x6')](function(){email[_0x0dbd('0x9')](realtime[_0x0dbd('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0xcb72c2){return initRealtime();})[_0x0dbd('0x6')](function(_0x1a957e){return db[_0x0dbd('0xb')][_0x0dbd('0xc')]({'attributes':['id',_0x0dbd('0xd')],'raw':!![]});})['then'](function(_0x55f318){return setInterval(initRealtime,_0x55f318[_0x0dbd('0xd')]*0x3e8);})[_0x0dbd('0xe')](function(_0x86fd0){console[_0x0dbd('0xf')](_0x86fd0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ac00f42..9b4c299 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 _0x3c95=['handleImapError','disabled','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','error'];(function(_0x1411d8,_0x5d8a99){var _0x2572c7=function(_0x44515c){while(--_0x44515c){_0x1411d8['push'](_0x1411d8['shift']());}};_0x2572c7(++_0x5d8a99);}(_0x3c95,0x177));var _0x53c9=function(_0x2ea271,_0x5373b3){_0x2ea271=_0x2ea271-0x0;var _0x306656=_0x3c95[_0x2ea271];return _0x306656;};'use strict';var _=require(_0x53c9('0x0'));var moment=require(_0x53c9('0x1'));var BPromise=require(_0x53c9('0x2'));var md5=require(_0x53c9('0x3'));var Redis=require(_0x53c9('0x4'));var config=require(_0x53c9('0x5'));var logger=require('../../../config/logger')(_0x53c9('0x6'));config[_0x53c9('0x7')]=_['defaults'](config[_0x53c9('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x53c9('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x53c9('0x9'));var EmailSmtp=require(_0x53c9('0xa'));var mailAccount=require(_0x53c9('0xb'));var md5Accounts={};function EmailChannel(_0x41bc03){logger[_0x53c9('0xc')]('start\x20email\x20channel');this['mailAccounts']=_0x41bc03[_0x53c9('0xd')];this[_0x53c9('0xe')]={};this[_0x53c9('0xf')]=new EmailSmtp();}EmailChannel[_0x53c9('0x10')][_0x53c9('0x11')]=function(_0x1b14ad){var _0x3bc19b=this[_0x53c9('0xd')][_0x1b14ad];var _0x2b029b={'id':_0x3bc19b['id'],'name':_0x3bc19b['name'],'key':_0x3bc19b[_0x53c9('0x12')],'active':_0x3bc19b[_0x53c9('0x13')],'Imap':{'status':_0x3bc19b[_0x53c9('0x14')][_0x53c9('0x15')],'messageStatus':_0x3bc19b[_0x53c9('0x14')][_0x53c9('0x16')],'total':_0x3bc19b['Imap'][_0x53c9('0x17')]}};if(_['isNil'](md5Accounts[_0x1b14ad])){md5Accounts[_0x1b14ad]={};}var _0x4d8152=md5(JSON[_0x53c9('0x18')](_0x2b029b));if(md5Accounts[_0x1b14ad][_0x53c9('0x3')]!==_0x4d8152){md5Accounts[_0x1b14ad][_0x53c9('0x3')]=_0x4d8152;io[_0x53c9('0x11')](_0x53c9('0x19'),_0x2b029b);}};EmailChannel['prototype'][_0x53c9('0x1a')]=function(_0x787a56){for(var _0x5cfcb7 in _0x787a56){if(_0x787a56['hasOwnProperty'](_0x5cfcb7)){if(_0x787a56[_0x5cfcb7]['Imap']&&_0x787a56[_0x5cfcb7][_0x53c9('0x13')]){var _0x5331d3=_0x787a56[_0x5cfcb7][_0x53c9('0x14')];if(!this[_0x53c9('0xe')][_0x53c9('0x1b')](_0x5331d3['id'])){this[_0x53c9('0xe')][_0x5331d3['id']]=new EmailImap(_0x5331d3,_0x787a56[_0x5cfcb7][_0x53c9('0x6')]);this[_0x53c9('0xe')][_0x5331d3['id']]['on']('box',this[_0x53c9('0x1c')][_0x53c9('0x1d')](this,_0x5cfcb7));this['imapAccounts'][_0x5331d3['id']]['on']('email',this[_0x53c9('0x1e')][_0x53c9('0x1d')](this,_0x5cfcb7));this[_0x53c9('0xe')][_0x5331d3['id']]['on'](_0x53c9('0x1f'),this['handleImapEnd']['bind'](this,_0x5cfcb7));this[_0x53c9('0xe')][_0x5331d3['id']]['on'](_0x53c9('0x20'),this[_0x53c9('0x21')][_0x53c9('0x1d')](this,_0x5cfcb7));}}else{if(_['isNil'](this[_0x53c9('0xd')][_0x5cfcb7]['Imap'])){this[_0x53c9('0xd')][_0x5cfcb7][_0x53c9('0x14')]={};}this['mailAccounts'][_0x5cfcb7][_0x53c9('0x14')][_0x53c9('0x15')]=_0x53c9('0x22');this[_0x53c9('0xd')][_0x5cfcb7]['Imap']['messageStatus']='';this['emit'](_0x5cfcb7);}}}};EmailChannel[_0x53c9('0x10')][_0x53c9('0x1c')]=function(_0x449bf3,_0x194762){if(this[_0x53c9('0xd')][_0x449bf3]){this[_0x53c9('0xd')][_0x449bf3]['Imap']['status']='connected';this[_0x53c9('0xd')][_0x449bf3][_0x53c9('0x14')][_0x53c9('0x16')]=_0x194762[_0x53c9('0x23')];if(_0x194762['messages']){this[_0x53c9('0xd')][_0x449bf3][_0x53c9('0x14')][_0x53c9('0x17')]=_0x194762[_0x53c9('0x24')]['total'];}return this[_0x53c9('0x11')](_0x449bf3);}};EmailChannel[_0x53c9('0x10')]['handleImapEmail']=function(_0x35abb2,_0x2d761f){logger['info'](_0x53c9('0x25'),_0x2d761f[_0x53c9('0x26')],_0x2d761f[_0x53c9('0x27')],_0x2d761f[_0x53c9('0x28')],_0x35abb2);if(this[_0x53c9('0xd')][_0x35abb2]){return mailAccount['notify'](_0x35abb2,_0x2d761f)[_0x53c9('0x29')](function(_0x369ec2){if(_0x369ec2){logger[_0x53c9('0xc')](_0x53c9('0x2a'));}})[_0x53c9('0x2b')](function(_0x5a2509){logger[_0x53c9('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x53c9('0x18')](_0x5a2509));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x22e168){if(this[_0x53c9('0xd')][_0x22e168]&&this[_0x53c9('0xd')][_0x22e168]['Imap']){if(this['imapAccounts'][this[_0x53c9('0xd')][_0x22e168][_0x53c9('0x14')]['id']]){delete this[_0x53c9('0xe')][this[_0x53c9('0xd')][_0x22e168][_0x53c9('0x14')]['id']];}this['mailAccounts'][_0x22e168][_0x53c9('0x14')][_0x53c9('0x2c')]=moment();this[_0x53c9('0x11')](_0x22e168);}};EmailChannel[_0x53c9('0x10')][_0x53c9('0x21')]=function(_0x374491,_0x34c5d7){if(this[_0x53c9('0xd')][_0x374491]){this[_0x53c9('0xd')][_0x374491]['Imap'][_0x53c9('0x15')]=_0x53c9('0x20');this[_0x53c9('0xd')][_0x374491][_0x53c9('0x14')]['messageStatus']=_0x34c5d7;return this[_0x53c9('0x11')](_0x374491);}};EmailChannel['prototype'][_0x53c9('0x2d')]=function(_0x2ecf66,_0x37ca15){return this[_0x53c9('0xf')]['send'](_0x2ecf66,_0x37ca15);};EmailChannel[_0x53c9('0x10')][_0x53c9('0x2e')]=function(_0x41249f){var _0x25a73b=this;if(this[_0x53c9('0xd')][_0x41249f['id']]){if(_['isNil'](this[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')])){this[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')]={};}this[_0x53c9('0xd')][_0x41249f['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x3f6ef5,_0x20ad1a){return _0x25a73b[_0x53c9('0xf')][_0x53c9('0x30')](_0x41249f)[_0x53c9('0x29')](function(_0x35395b){_0x25a73b[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')][_0x53c9('0x15')]=_0x53c9('0x31');_0x25a73b[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')][_0x53c9('0x16')]='';_0x25a73b[_0x53c9('0x11')](_0x41249f['id']);_0x3f6ef5(_0x35395b);})['catch'](function(_0x1244a5){_0x25a73b[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')][_0x53c9('0x15')]=_0x53c9('0x20');_0x25a73b[_0x53c9('0xd')][_0x41249f['id']][_0x53c9('0x2f')][_0x53c9('0x16')]=_0x1244a5;_0x25a73b[_0x53c9('0x11')](_0x41249f['id']);_0x20ad1a(_0x1244a5);});});}return this[_0x53c9('0xf')]['verify'](_0x41249f);};module[_0x53c9('0x32')]=EmailChannel; \ No newline at end of file +var _0x54bb=['Imap','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','email','box','bind','handleImapEmail','end','error','handleImapError','disabled','handleImapBox','connected','name','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','Mail\x20accepted\x20from\x20routing','handleImapEnd','status','sendMail','send','verifySmtp','Smtp','lastSync','verify','then','verified','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','key','active'];(function(_0x1868a9,_0xd5877d){var _0x2a8e8b=function(_0x2dad35){while(--_0x2dad35){_0x1868a9['push'](_0x1868a9['shift']());}};_0x2a8e8b(++_0xd5877d);}(_0x54bb,0x17b));var _0xb54b=function(_0x31ab90,_0x145a96){_0x31ab90=_0x31ab90-0x0;var _0x2d6123=_0x54bb[_0x31ab90];return _0x2d6123;};'use strict';var _=require(_0xb54b('0x0'));var moment=require(_0xb54b('0x1'));var BPromise=require(_0xb54b('0x2'));var md5=require(_0xb54b('0x3'));var Redis=require(_0xb54b('0x4'));var config=require(_0xb54b('0x5'));var logger=require('../../../config/logger')('email');config[_0xb54b('0x6')]=_[_0xb54b('0x7')](config[_0xb54b('0x6')],{'host':_0xb54b('0x8'),'port':0x18eb});var io=require(_0xb54b('0x9'))(new Redis(config[_0xb54b('0x6')]));var EmailImap=require(_0xb54b('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xb54b('0xb'));var md5Accounts={};function EmailChannel(_0xaff2e){logger[_0xb54b('0xc')](_0xb54b('0xd'));this[_0xb54b('0xe')]=_0xaff2e[_0xb54b('0xe')];this['imapAccounts']={};this[_0xb54b('0xf')]=new EmailSmtp();}EmailChannel[_0xb54b('0x10')][_0xb54b('0x11')]=function(_0x4466a4){var _0x41d1d8=this['mailAccounts'][_0x4466a4];var _0x4ed94f={'id':_0x41d1d8['id'],'name':_0x41d1d8['name'],'key':_0x41d1d8[_0xb54b('0x12')],'active':_0x41d1d8[_0xb54b('0x13')],'Imap':{'status':_0x41d1d8[_0xb54b('0x14')]['status'],'messageStatus':_0x41d1d8[_0xb54b('0x14')][_0xb54b('0x15')],'total':_0x41d1d8['Imap']['total']}};if(_[_0xb54b('0x16')](md5Accounts[_0x4466a4])){md5Accounts[_0x4466a4]={};}var _0x295683=md5(JSON[_0xb54b('0x17')](_0x4ed94f));if(md5Accounts[_0x4466a4]['md5']!==_0x295683){md5Accounts[_0x4466a4][_0xb54b('0x3')]=_0x295683;io[_0xb54b('0x11')](_0xb54b('0x18'),_0x4ed94f);}};EmailChannel[_0xb54b('0x10')][_0xb54b('0x19')]=function(_0x18785c){for(var _0x5c5c14 in _0x18785c){if(_0x18785c[_0xb54b('0x1a')](_0x5c5c14)){if(_0x18785c[_0x5c5c14][_0xb54b('0x14')]&&_0x18785c[_0x5c5c14][_0xb54b('0x13')]){var _0x3469f2=_0x18785c[_0x5c5c14][_0xb54b('0x14')];if(!this[_0xb54b('0x1b')]['hasOwnProperty'](_0x3469f2['id'])){this[_0xb54b('0x1b')][_0x3469f2['id']]=new EmailImap(_0x3469f2,_0x18785c[_0x5c5c14][_0xb54b('0x1c')]);this[_0xb54b('0x1b')][_0x3469f2['id']]['on'](_0xb54b('0x1d'),this['handleImapBox'][_0xb54b('0x1e')](this,_0x5c5c14));this['imapAccounts'][_0x3469f2['id']]['on'](_0xb54b('0x1c'),this[_0xb54b('0x1f')][_0xb54b('0x1e')](this,_0x5c5c14));this[_0xb54b('0x1b')][_0x3469f2['id']]['on'](_0xb54b('0x20'),this['handleImapEnd'][_0xb54b('0x1e')](this,_0x5c5c14));this['imapAccounts'][_0x3469f2['id']]['on'](_0xb54b('0x21'),this[_0xb54b('0x22')][_0xb54b('0x1e')](this,_0x5c5c14));}}else{if(_['isNil'](this[_0xb54b('0xe')][_0x5c5c14][_0xb54b('0x14')])){this[_0xb54b('0xe')][_0x5c5c14][_0xb54b('0x14')]={};}this[_0xb54b('0xe')][_0x5c5c14]['Imap']['status']=_0xb54b('0x23');this[_0xb54b('0xe')][_0x5c5c14][_0xb54b('0x14')][_0xb54b('0x15')]='';this[_0xb54b('0x11')](_0x5c5c14);}}}};EmailChannel[_0xb54b('0x10')][_0xb54b('0x24')]=function(_0x47484c,_0x3c9310){if(this[_0xb54b('0xe')][_0x47484c]){this[_0xb54b('0xe')][_0x47484c][_0xb54b('0x14')]['status']=_0xb54b('0x25');this[_0xb54b('0xe')][_0x47484c][_0xb54b('0x14')][_0xb54b('0x15')]=_0x3c9310[_0xb54b('0x26')];if(_0x3c9310[_0xb54b('0x27')]){this[_0xb54b('0xe')][_0x47484c][_0xb54b('0x14')]['total']=_0x3c9310[_0xb54b('0x27')][_0xb54b('0x28')];}return this[_0xb54b('0x11')](_0x47484c);}};EmailChannel[_0xb54b('0x10')][_0xb54b('0x1f')]=function(_0x4519ba,_0x47ca7b){logger[_0xb54b('0xc')](_0xb54b('0x29'),_0x47ca7b['firstName'],_0x47ca7b['lastName'],_0x47ca7b[_0xb54b('0x2a')],_0x4519ba);if(this['mailAccounts'][_0x4519ba]){return mailAccount[_0xb54b('0x2b')](_0x4519ba,_0x47ca7b)['then'](function(_0x5cc056){if(_0x5cc056){logger[_0xb54b('0xc')](_0xb54b('0x2c'));}})['catch'](function(_0x3bc90c){logger[_0xb54b('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xb54b('0x17')](_0x3bc90c));});}};EmailChannel[_0xb54b('0x10')][_0xb54b('0x2d')]=function(_0xf89899){if(this[_0xb54b('0xe')][_0xf89899]&&this[_0xb54b('0xe')][_0xf89899][_0xb54b('0x14')]){if(this[_0xb54b('0x1b')][this[_0xb54b('0xe')][_0xf89899][_0xb54b('0x14')]['id']]){delete this[_0xb54b('0x1b')][this[_0xb54b('0xe')][_0xf89899]['Imap']['id']];}this[_0xb54b('0xe')][_0xf89899]['Imap']['lastSync']=moment();this['emit'](_0xf89899);}};EmailChannel['prototype']['handleImapError']=function(_0x13ffa9,_0xce5812){if(this[_0xb54b('0xe')][_0x13ffa9]){this[_0xb54b('0xe')][_0x13ffa9][_0xb54b('0x14')][_0xb54b('0x2e')]=_0xb54b('0x21');this[_0xb54b('0xe')][_0x13ffa9][_0xb54b('0x14')][_0xb54b('0x15')]=_0xce5812;return this[_0xb54b('0x11')](_0x13ffa9);}};EmailChannel[_0xb54b('0x10')][_0xb54b('0x2f')]=function(_0x29cb30,_0x56dac3){return this['smtp'][_0xb54b('0x30')](_0x29cb30,_0x56dac3);};EmailChannel[_0xb54b('0x10')][_0xb54b('0x31')]=function(_0x480bef){var _0x40cfcf=this;if(this['mailAccounts'][_0x480bef['id']]){if(_[_0xb54b('0x16')](this[_0xb54b('0xe')][_0x480bef['id']]['Smtp'])){this[_0xb54b('0xe')][_0x480bef['id']][_0xb54b('0x32')]={};}this['mailAccounts'][_0x480bef['id']][_0xb54b('0x32')][_0xb54b('0x33')]=moment();return new BPromise(function(_0x2b8af3,_0x463ce7){return _0x40cfcf[_0xb54b('0xf')][_0xb54b('0x34')](_0x480bef)[_0xb54b('0x35')](function(_0x332bc5){_0x40cfcf[_0xb54b('0xe')][_0x480bef['id']][_0xb54b('0x32')][_0xb54b('0x2e')]=_0xb54b('0x36');_0x40cfcf[_0xb54b('0xe')][_0x480bef['id']]['Smtp'][_0xb54b('0x15')]='';_0x40cfcf[_0xb54b('0x11')](_0x480bef['id']);_0x2b8af3(_0x332bc5);})[_0xb54b('0x37')](function(_0x456537){_0x40cfcf['mailAccounts'][_0x480bef['id']][_0xb54b('0x32')]['status']=_0xb54b('0x21');_0x40cfcf[_0xb54b('0xe')][_0x480bef['id']][_0xb54b('0x32')][_0xb54b('0x15')]=_0x456537;_0x40cfcf[_0xb54b('0x11')](_0x480bef['id']);_0x463ce7(_0x456537);});});}return this[_0xb54b('0xf')][_0xb54b('0x34')](_0x480bef);};module[_0xb54b('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ddf1455..df365fe 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 _0x7c0a=['prototype','getAccount','authTimeout','isNil','service','authentication','password','host','port','tls','autotls','user','getHost','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','path','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits'];(function(_0x29f095,_0x5c23ac){var _0x180061=function(_0x49c12d){while(--_0x49c12d){_0x29f095['push'](_0x29f095['shift']());}};_0x180061(++_0x5c23ac);}(_0x7c0a,0x1d0));var _0xa7c0=function(_0x481a17,_0x6fcb3c){_0x481a17=_0x481a17-0x0;var _0x1fd04d=_0x7c0a[_0x481a17];return _0x1fd04d;};'use strict';var fs=require('fs');var path=require(_0xa7c0('0x0'));var util=require('util');var Imap=require(_0xa7c0('0x1'));var _=require(_0xa7c0('0x2'));var rs=require(_0xa7c0('0x3'));var simpleParser=require(_0xa7c0('0x4'))[_0xa7c0('0x5')];var Iconv=require('iconv')[_0xa7c0('0x6')];var EventEmitter=require(_0xa7c0('0x7'))[_0xa7c0('0x8')];var utils=require(_0xa7c0('0x9'));var logger=require(_0xa7c0('0xa'))(_0xa7c0('0xb'));function EmailImap(_0x155645,_0x4d6c57){this[_0xa7c0('0xc')]='INBOX';this[_0xa7c0('0xd')]=this['getAccount'](_0x155645,_0x4d6c57);this[_0xa7c0('0x1')]=new Imap(this['account']);this[_0xa7c0('0x1')][_0xa7c0('0xe')](_0xa7c0('0xf'),this[_0xa7c0('0x10')][_0xa7c0('0x11')](this));this[_0xa7c0('0x1')][_0xa7c0('0xe')](_0xa7c0('0x12'),this[_0xa7c0('0x13')][_0xa7c0('0x11')](this));this[_0xa7c0('0x1')]['on'](_0xa7c0('0x14'),this[_0xa7c0('0x15')][_0xa7c0('0x11')](this));this[_0xa7c0('0x1')][_0xa7c0('0x16')]();}util[_0xa7c0('0x17')](EmailImap,EventEmitter);EmailImap[_0xa7c0('0x18')][_0xa7c0('0x19')]=function(_0x60660e,_0x32da5c){var _0x1daac1={'connTimeout':_0x60660e['connTimeout']?_0x60660e['connTimeout']*0x3e8:0x2710,'authTimeout':_0x60660e[_0xa7c0('0x1a')]?_0x60660e['authTimeout']*0x3e8:0x1388};if(_[_0xa7c0('0x1b')](_0x60660e[_0xa7c0('0x1c')])){if(_0x60660e[_0xa7c0('0x1d')]){_0x1daac1['user']=_0x60660e['user'];_0x1daac1[_0xa7c0('0x1e')]=_0x60660e[_0xa7c0('0x1e')];}_0x1daac1['host']=_0x60660e[_0xa7c0('0x1f')];_0x1daac1['port']=_0x60660e[_0xa7c0('0x20')]||0x3e1;if(_0x60660e['tls']){_0x1daac1['tls']=!![];}else{_0x1daac1[_0xa7c0('0x21')]=![];_0x1daac1[_0xa7c0('0x22')]='required';}}else{_0x1daac1[_0xa7c0('0x23')]=_0x60660e[_0xa7c0('0x23')];_0x1daac1[_0xa7c0('0x1e')]=_0x60660e[_0xa7c0('0x1e')];_0x1daac1[_0xa7c0('0x1f')]=utils[_0xa7c0('0x24')](_0x60660e[_0xa7c0('0x1c')]);_0x1daac1[_0xa7c0('0x20')]=0x3e1;_0x1daac1[_0xa7c0('0x21')]=!![];}_0x1daac1[_0xa7c0('0xb')]=_0x32da5c||_0x60660e[_0xa7c0('0x23')]||'anonymous@xcally.com';return _0x1daac1;};EmailImap[_0xa7c0('0x18')]['handleReady']=function(){this[_0xa7c0('0x1')]['openBox'](this[_0xa7c0('0xc')],![],this[_0xa7c0('0x25')][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x25')]=function(_0x2d0865,_0x1cec1a){if(_0x2d0865){this[_0xa7c0('0x15')](_0x2d0865,!![]);}else{this[_0xa7c0('0x26')]('box',_0x1cec1a);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x503435){if(_0x503435){this['handleError'](_0x503435,!![]);}else{this[_0xa7c0('0x1')][_0xa7c0('0x12')]();}};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x27')]=function(){this['imap'][_0xa7c0('0x28')]([_0xa7c0('0x29')],this[_0xa7c0('0x2a')]['bind'](this));};EmailImap[_0xa7c0('0x18')]['handleReadUnseen']=function(_0x4727e3,_0x21a62b){if(_0x4727e3){this['handleError'](_0x4727e3,!![]);}else{if(_0x21a62b[_0xa7c0('0x2b')]){try{var _0x958c1d=this[_0xa7c0('0x1')][_0xa7c0('0x2c')](_0x21a62b,{'bodies':'','markSeen':!![]});_0x958c1d['on'](_0xa7c0('0x2d'),this[_0xa7c0('0x2e')][_0xa7c0('0x11')](this));_0x958c1d['once'](_0xa7c0('0x14'),this[_0xa7c0('0x2f')][_0xa7c0('0x11')](this));_0x958c1d[_0xa7c0('0xe')](_0xa7c0('0x12'),this['handleFetchEnd'][_0xa7c0('0x11')](this));}catch(_0x2e4dc0){logger[_0xa7c0('0x14')](_0x2e4dc0);}}else{this['imap'][_0xa7c0('0x30')](!![],this[_0xa7c0('0x31')][_0xa7c0('0x11')](this));}}};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x2e')]=function(_0x38c799,_0x593801){_0x38c799['on'](_0xa7c0('0x32'),this[_0xa7c0('0x33')]['bind'](this));_0x38c799[_0xa7c0('0xe')](_0xa7c0('0x34'),this[_0xa7c0('0x35')][_0xa7c0('0x11')](this));_0x38c799['once'](_0xa7c0('0x12'),this['handleMessageEnd'][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x33')]=function(_0x31e586,_0xcfb6c0){simpleParser(_0x31e586,{'Iconv':Iconv},this['handleSimpleParser'][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')]['handleMessageAttributes']=function(_0x53e48b){};EmailImap['prototype'][_0xa7c0('0x36')]=function(){};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x37')]=function(_0x42891e,_0x2ed732){if(_0x42891e){logger[_0xa7c0('0x14')](_0x42891e);}else{var _0x7b3d94=this;utils[_0xa7c0('0x38')](this['account'],_0x2ed732,function(_0x5c1b4b){_0x7b3d94[_0xa7c0('0x26')](_0xa7c0('0xb'),_0x5c1b4b);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xa7c0('0x1')][_0xa7c0('0x30')](!![],this[_0xa7c0('0x31')][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')]['handleFetchError']=function(_0x3494d2){this['handleError'](_0x3494d2);this[_0xa7c0('0x1')][_0xa7c0('0x30')](!![],this[_0xa7c0('0x31')][_0xa7c0('0x11')](this));};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x13')]=function(){this[_0xa7c0('0x26')](_0xa7c0('0x12'));};EmailImap[_0xa7c0('0x18')][_0xa7c0('0x15')]=function(_0x2af757,_0x1410bc){logger['error'](_0xa7c0('0x15'),this[_0xa7c0('0xd')][_0xa7c0('0xb')],JSON[_0xa7c0('0x39')](_0x2af757));var _0x48fa4e='';if(_0x2af757){if(_0x2af757[_0xa7c0('0x3a')]){_0x48fa4e=_0x2af757[_0xa7c0('0x3a')];}else{for(var _0x2ffdd7 in _0x2af757){if(_0x2af757[_0xa7c0('0x3b')](_0x2ffdd7)){_0x48fa4e+=_[_0xa7c0('0x3c')](_0x2ffdd7)+':\x20'+_0x2af757[_0x2ffdd7]+'\x0a';}}}}if(_0x1410bc){this[_0xa7c0('0x1')]['end']();}else{this[_0xa7c0('0x26')](_0xa7c0('0x14'),_0x48fa4e);this['emit'](_0xa7c0('0x12'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x2780=['getAccount','imap','once','ready','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','authentication','user','password','host','port','tls','getHost','service','email','anonymous@xcally.com','openBox','handleOpenBox','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','error','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','emit','stringify','textCode','exports','util','randomstring','mailparser','iconv','Iconv','./utils','account'];(function(_0x5a2201,_0x494e47){var _0x15b753=function(_0x2ab144){while(--_0x2ab144){_0x5a2201['push'](_0x5a2201['shift']());}};_0x15b753(++_0x494e47);}(_0x2780,0x1a1));var _0x0278=function(_0x372760,_0x5d0664){_0x372760=_0x372760-0x0;var _0x35212a=_0x2780[_0x372760];return _0x35212a;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x0278('0x0'));var Imap=require('imap');var _=require('lodash');var rs=require(_0x0278('0x1'));var simpleParser=require(_0x0278('0x2'))['simpleParser'];var Iconv=require(_0x0278('0x3'))[_0x0278('0x4')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x0278('0x5'));var logger=require('../../../config/logger')('email');function EmailImap(_0x24d036,_0x1332b7){this['mailbox']='INBOX';this[_0x0278('0x6')]=this[_0x0278('0x7')](_0x24d036,_0x1332b7);this[_0x0278('0x8')]=new Imap(this[_0x0278('0x6')]);this[_0x0278('0x8')][_0x0278('0x9')](_0x0278('0xa'),this[_0x0278('0xb')][_0x0278('0xc')](this));this['imap'][_0x0278('0x9')](_0x0278('0xd'),this[_0x0278('0xe')][_0x0278('0xc')](this));this[_0x0278('0x8')]['on']('error',this[_0x0278('0xf')][_0x0278('0xc')](this));this['imap'][_0x0278('0x10')]();}util[_0x0278('0x11')](EmailImap,EventEmitter);EmailImap[_0x0278('0x12')][_0x0278('0x7')]=function(_0x4756f4,_0x5733ff){var _0x2f050e={'connTimeout':_0x4756f4[_0x0278('0x13')]?_0x4756f4[_0x0278('0x13')]*0x3e8:0x2710,'authTimeout':_0x4756f4[_0x0278('0x14')]?_0x4756f4[_0x0278('0x14')]*0x3e8:0x1388};if(_['isNil'](_0x4756f4['service'])){if(_0x4756f4[_0x0278('0x15')]){_0x2f050e[_0x0278('0x16')]=_0x4756f4[_0x0278('0x16')];_0x2f050e[_0x0278('0x17')]=_0x4756f4['password'];}_0x2f050e['host']=_0x4756f4[_0x0278('0x18')];_0x2f050e[_0x0278('0x19')]=_0x4756f4[_0x0278('0x19')]||0x3e1;if(_0x4756f4[_0x0278('0x1a')]){_0x2f050e['tls']=!![];}else{_0x2f050e[_0x0278('0x1a')]=![];_0x2f050e['autotls']='required';}}else{_0x2f050e[_0x0278('0x16')]=_0x4756f4[_0x0278('0x16')];_0x2f050e[_0x0278('0x17')]=_0x4756f4[_0x0278('0x17')];_0x2f050e[_0x0278('0x18')]=utils[_0x0278('0x1b')](_0x4756f4[_0x0278('0x1c')]);_0x2f050e[_0x0278('0x19')]=0x3e1;_0x2f050e['tls']=!![];}_0x2f050e[_0x0278('0x1d')]=_0x5733ff||_0x4756f4[_0x0278('0x16')]||_0x0278('0x1e');return _0x2f050e;};EmailImap[_0x0278('0x12')][_0x0278('0xb')]=function(){this['imap'][_0x0278('0x1f')](this['mailbox'],![],this[_0x0278('0x20')]['bind'](this));};EmailImap[_0x0278('0x12')][_0x0278('0x20')]=function(_0xa8cc32,_0x2f0bf0){if(_0xa8cc32){this[_0x0278('0xf')](_0xa8cc32,!![]);}else{this['emit']('box',_0x2f0bf0);this[_0x0278('0x21')]();}};EmailImap['prototype'][_0x0278('0x22')]=function(_0x598200){if(_0x598200){this[_0x0278('0xf')](_0x598200,!![]);}else{this[_0x0278('0x8')][_0x0278('0xd')]();}};EmailImap[_0x0278('0x12')][_0x0278('0x21')]=function(){this[_0x0278('0x8')][_0x0278('0x23')]([_0x0278('0x24')],this[_0x0278('0x25')][_0x0278('0xc')](this));};EmailImap[_0x0278('0x12')][_0x0278('0x25')]=function(_0x5cfc1d,_0x6f344a){if(_0x5cfc1d){this['handleError'](_0x5cfc1d,!![]);}else{if(_0x6f344a[_0x0278('0x26')]){try{var _0x4e6148=this['imap'][_0x0278('0x27')](_0x6f344a,{'bodies':'','markSeen':!![]});_0x4e6148['on']('message',this['handleFetchMessage'][_0x0278('0xc')](this));_0x4e6148[_0x0278('0x9')](_0x0278('0x28'),this[_0x0278('0x29')]['bind'](this));_0x4e6148['once'](_0x0278('0xd'),this[_0x0278('0x2a')][_0x0278('0xc')](this));}catch(_0x2eb415){logger[_0x0278('0x28')](_0x2eb415);}}else{this[_0x0278('0x8')][_0x0278('0x2b')](!![],this[_0x0278('0x22')][_0x0278('0xc')](this));}}};EmailImap['prototype'][_0x0278('0x2c')]=function(_0x4e4daf,_0x38d3d7){_0x4e4daf['on']('body',this['handleMessageBody'][_0x0278('0xc')](this));_0x4e4daf['once'](_0x0278('0x2d'),this[_0x0278('0x2e')]['bind'](this));_0x4e4daf[_0x0278('0x9')](_0x0278('0xd'),this['handleMessageEnd'][_0x0278('0xc')](this));};EmailImap[_0x0278('0x12')]['handleMessageBody']=function(_0x158ff6,_0x3301d9){simpleParser(_0x158ff6,{'Iconv':Iconv},this[_0x0278('0x2f')][_0x0278('0xc')](this));};EmailImap['prototype'][_0x0278('0x2e')]=function(_0x47dc5c){};EmailImap['prototype'][_0x0278('0x30')]=function(){};EmailImap['prototype'][_0x0278('0x2f')]=function(_0x5b7f68,_0x1a17c4){if(_0x5b7f68){logger[_0x0278('0x28')](_0x5b7f68);}else{var _0x4467d2=this;utils['parser'](this[_0x0278('0x6')],_0x1a17c4,function(_0x5cd209){_0x4467d2[_0x0278('0x31')]('email',_0x5cd209);});}};EmailImap[_0x0278('0x12')][_0x0278('0x2a')]=function(){this[_0x0278('0x8')][_0x0278('0x2b')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x125743){this[_0x0278('0xf')](_0x125743);this[_0x0278('0x8')][_0x0278('0x2b')](!![],this[_0x0278('0x22')][_0x0278('0xc')](this));};EmailImap[_0x0278('0x12')]['handleEnd']=function(){this[_0x0278('0x31')](_0x0278('0xd'));};EmailImap['prototype'][_0x0278('0xf')]=function(_0x54197a,_0x32d5fc){logger['error']('handleError',this[_0x0278('0x6')][_0x0278('0x1d')],JSON[_0x0278('0x32')](_0x54197a));var _0x4aa73a='';if(_0x54197a){if(_0x54197a[_0x0278('0x33')]){_0x4aa73a=_0x54197a[_0x0278('0x33')];}else{for(var _0x4bd9ae in _0x54197a){if(_0x54197a['hasOwnProperty'](_0x4bd9ae)){_0x4aa73a+=_['upperFirst'](_0x4bd9ae)+':\x20'+_0x54197a[_0x4bd9ae]+'\x0a';}}}}if(_0x32d5fc){this['imap'][_0x0278('0xd')]();}else{this['emit']('error',_0x4aa73a);this[_0x0278('0x31')](_0x0278('0xd'));}};module[_0x0278('0x34')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 5e61ac2..e3d55dd 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 _0x861a=['compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use'];(function(_0x33cd79,_0x52b92e){var _0x43d081=function(_0x191d93){while(--_0x191d93){_0x33cd79['push'](_0x33cd79['shift']());}};_0x43d081(++_0x52b92e);}(_0x861a,0x19d));var _0xa861=function(_0x286063,_0x5445bb){_0x286063=_0x286063-0x0;var _0x5bb1ed=_0x861a[_0x286063];return _0x5bb1ed;};'use strict';var nodemailer=require(_0xa861('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xa861('0x1'));function EmailSmtp(){}EmailSmtp[_0xa861('0x2')]['send']=function(_0x5aff15,_0xf1128c){return new BPromise(function(_0x4c8a67,_0x4d129e){var _0x53c937=nodemailer[_0xa861('0x3')](_0x5aff15);_0x53c937[_0xa861('0x4')](_0xa861('0x5'),inlineBase64());_0x53c937[_0xa861('0x6')](_0xf1128c,function(_0x30452f,_0x5ddf50){if(_0x30452f){_0x4d129e(_0x30452f[_0xa861('0x7')]());}else{_0x4c8a67(_0x5ddf50);}});});};EmailSmtp[_0xa861('0x2')][_0xa861('0x8')]=function(_0xa61dff){return new BPromise(function(_0x220e14,_0x38bdf1){var _0x2ebea6=nodemailer['createTransport'](_0xa61dff);_0x2ebea6[_0xa861('0x8')](function(_0x14f396,_0x569582){if(_0x14f396){_0x38bdf1(_0x14f396['toString']());}else{if(_0x569582){_0x220e14(_0x569582);}else{_0x38bdf1(_0xa861('0x9'));}}});});};module[_0xa861('0xa')]=EmailSmtp; \ No newline at end of file +var _0x55a7=['verify','exports','nodemailer','prototype','send','createTransport','use','compile','toString'];(function(_0x2b55cb,_0x1fa6a9){var _0x494fa9=function(_0x21d315){while(--_0x21d315){_0x2b55cb['push'](_0x2b55cb['shift']());}};_0x494fa9(++_0x1fa6a9);}(_0x55a7,0x119));var _0x755a=function(_0x1e1a22,_0x28c6f0){_0x1e1a22=_0x1e1a22-0x0;var _0x505a5a=_0x55a7[_0x1e1a22];return _0x505a5a;};'use strict';var nodemailer=require(_0x755a('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x755a('0x1')][_0x755a('0x2')]=function(_0xfc467e,_0xba0941){return new BPromise(function(_0x462621,_0xed9816){var _0x27b22f=nodemailer[_0x755a('0x3')](_0xfc467e);_0x27b22f[_0x755a('0x4')](_0x755a('0x5'),inlineBase64());_0x27b22f['sendMail'](_0xba0941,function(_0x401b06,_0x31adc8){if(_0x401b06){_0xed9816(_0x401b06[_0x755a('0x6')]());}else{_0x462621(_0x31adc8);}});});};EmailSmtp[_0x755a('0x1')][_0x755a('0x7')]=function(_0x36c82a){return new BPromise(function(_0x353abc,_0x4a1757){var _0x4e46f6=nodemailer[_0x755a('0x3')](_0x36c82a);_0x4e46f6[_0x755a('0x7')](function(_0x2b622e,_0x24206c){if(_0x2b622e){_0x4a1757(_0x2b622e[_0x755a('0x6')]());}else{if(_0x24206c){_0x353abc(_0x24206c);}else{_0x4a1757('Not\x20verifired');}}});});};module[_0x755a('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index ab15c7e..c55fa22 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 _0xce82=['test','replace','body','textAsHtml','message','originTo','originCc','includes','attachments','type','attachment','filename','format','%s-%s','now','server/files/attachments/','writeFileSync','content','contentType','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','split','length','slice','join','Anonymous','pop','isEmpty','generate','html'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0xce82,0x182));var _0x2ce8=function(_0x3db137,_0x66740){_0x3db137=_0x3db137-0x0;var _0x569d1f=_0xce82[_0x3db137];return _0x569d1f;};'use strict';var _=require(_0x2ce8('0x0'));var moment=require(_0x2ce8('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0x2ce8('0x2'));var tnef=require(_0x2ce8('0x3'));var logger=require(_0x2ce8('0x4'))(_0x2ce8('0x5'));var config=require(_0x2ce8('0x6'));function getAddress(_0x1ecb25){var _0x2ba0ef=_[_0x2ce8('0x7')](_0x1ecb25[_0x2ce8('0x8')]);return _0x2ba0ef&&_0x2ba0ef[_0x2ce8('0x9')]?_0x2ba0ef[_0x2ce8('0x9')]:_0x2ce8('0xa')+random['generate'](0x6)+_0x2ce8('0xb');}function getFirstName(_0x476c05){var _0x3d68bd=_[_0x2ce8('0x7')](_0x476c05['value']);if(_0x3d68bd&&_0x3d68bd['name']){var _0x12c03c=_0x3d68bd[_0x2ce8('0xc')][_0x2ce8('0xd')](/\s+/);return _0x12c03c[_0x2ce8('0xe')]?_0x12c03c[_0x2ce8('0xf')](0x0,-0x1)[_0x2ce8('0x10')]('\x20'):_0x3d68bd[_0x2ce8('0xc')];}return _0x2ce8('0x11');}function getLastName(_0x169230){var _0xabc506=_[_0x2ce8('0x7')](_0x169230[_0x2ce8('0x8')]);if(_0xabc506&&_0xabc506[_0x2ce8('0xc')]){var _0x159d99=_0xabc506['name'][_0x2ce8('0xd')](/\s+/);return _0x159d99[_0x2ce8('0xe')]>0x1?_0x159d99[_0x2ce8('0x12')]():'';}return'';}function getMails(_0x46e152,_0x12964a){var _0x382b33='';for(var _0xc0651a=0x0;_0xc0651a<_0x12964a[_0x2ce8('0x8')]['length'];_0xc0651a+=0x1){if(_0x12964a[_0x2ce8('0x8')][_0xc0651a][_0x2ce8('0x9')]!==_0x46e152){if(!_[_0x2ce8('0x13')](_0x382b33)){_0x382b33+=',';}_0x382b33+=_0x12964a[_0x2ce8('0x8')][_0xc0651a][_0x2ce8('0xc')]||_0x12964a['value'][_0xc0651a][_0x2ce8('0x9')]||'';_0x382b33+='\x20<';_0x382b33+=_0x12964a[_0x2ce8('0x8')][_0xc0651a][_0x2ce8('0x9')]?_0x12964a['value'][_0xc0651a][_0x2ce8('0x9')]:_0x2ce8('0xa')+random[_0x2ce8('0x14')](0x6)+_0x2ce8('0xb');_0x382b33+='>';}}return _0x382b33;}function parseEmail(_0x1e5800,_0x4c19d8,_0x1dbc66){if(_0x4c19d8[_0x2ce8('0x15')]){var _0xcc5cb=/)<[^<]*)*<\/script>/gi;while(_0xcc5cb[_0x2ce8('0x16')](_0x4c19d8[_0x2ce8('0x15')])){_0x4c19d8[_0x2ce8('0x15')]=_0x4c19d8[_0x2ce8('0x15')][_0x2ce8('0x17')](_0xcc5cb,'');}_0x1dbc66[_0x2ce8('0x18')]=_0x4c19d8[_0x2ce8('0x15')];}else{_0x1dbc66[_0x2ce8('0x18')]=_0x4c19d8[_0x2ce8('0x19')];}if(_0x1dbc66[_0x2ce8('0x18')]){_0x1dbc66[_0x2ce8('0x18')]=_0x1dbc66[_0x2ce8('0x18')][_0x2ce8('0x17')](/Empty\x20message

'];(function(_0x414373,_0x4fa4b0){var _0xda69fd=function(_0x58a4d7){while(--_0x58a4d7){_0x414373['push'](_0x414373['shift']());}};_0xda69fd(++_0x4fa4b0);}(_0x7c3b,0x1a4));var _0xb7c3=function(_0x29a8b3,_0x1f22b9){_0x29a8b3=_0x29a8b3-0x0;var _0x4e5fc9=_0x7c3b[_0x29a8b3];return _0x4e5fc9;};'use strict';var _=require(_0xb7c3('0x0'));var moment=require(_0xb7c3('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xb7c3('0x2'));var tnef=require(_0xb7c3('0x3'));var logger=require(_0xb7c3('0x4'))(_0xb7c3('0x5'));var config=require(_0xb7c3('0x6'));function getAddress(_0x1fa258){var _0x257f92=_[_0xb7c3('0x7')](_0x1fa258[_0xb7c3('0x8')]);return _0x257f92&&_0x257f92[_0xb7c3('0x9')]?_0x257f92['address']:_0xb7c3('0xa')+random[_0xb7c3('0xb')](0x6)+_0xb7c3('0xc');}function getFirstName(_0x5c389d){var _0x12ba59=_[_0xb7c3('0x7')](_0x5c389d[_0xb7c3('0x8')]);if(_0x12ba59&&_0x12ba59[_0xb7c3('0xd')]){var _0x16dddd=_0x12ba59[_0xb7c3('0xd')][_0xb7c3('0xe')](/\s+/);return _0x16dddd[_0xb7c3('0xf')]?_0x16dddd[_0xb7c3('0x10')](0x0,-0x1)[_0xb7c3('0x11')]('\x20'):_0x12ba59[_0xb7c3('0xd')];}return _0xb7c3('0x12');}function getLastName(_0x55a8fa){var _0x4e7bb9=_[_0xb7c3('0x7')](_0x55a8fa[_0xb7c3('0x8')]);if(_0x4e7bb9&&_0x4e7bb9[_0xb7c3('0xd')]){var _0x28b24a=_0x4e7bb9[_0xb7c3('0xd')]['split'](/\s+/);return _0x28b24a[_0xb7c3('0xf')]>0x1?_0x28b24a['pop']():'';}return'';}function getMails(_0x296c36,_0x3880f0){var _0x5ddae3='';for(var _0x3b8305=0x0;_0x3b8305<_0x3880f0[_0xb7c3('0x8')][_0xb7c3('0xf')];_0x3b8305+=0x1){if(_0x3880f0[_0xb7c3('0x8')][_0x3b8305][_0xb7c3('0x9')]!==_0x296c36){if(!_[_0xb7c3('0x13')](_0x5ddae3)){_0x5ddae3+=',';}_0x5ddae3+=_0x3880f0[_0xb7c3('0x8')][_0x3b8305]['name']||_0x3880f0[_0xb7c3('0x8')][_0x3b8305][_0xb7c3('0x9')]||'';_0x5ddae3+='\x20<';_0x5ddae3+=_0x3880f0[_0xb7c3('0x8')][_0x3b8305][_0xb7c3('0x9')]?_0x3880f0[_0xb7c3('0x8')][_0x3b8305]['address']:_0xb7c3('0xa')+random[_0xb7c3('0xb')](0x6)+'@xcally.com';_0x5ddae3+='>';}}return _0x5ddae3;}function parseEmail(_0xb1c5e7,_0x5044c5,_0xe3ce4){if(_0x5044c5[_0xb7c3('0x14')]){var _0x2e5260=/)<[^<]*)*<\/script>/gi;while(_0x2e5260[_0xb7c3('0x15')](_0x5044c5[_0xb7c3('0x14')])){_0x5044c5[_0xb7c3('0x14')]=_0x5044c5[_0xb7c3('0x14')][_0xb7c3('0x16')](_0x2e5260,'');}_0xe3ce4[_0xb7c3('0x17')]=_0x5044c5['html'];}else{_0xe3ce4['body']=_0x5044c5['textAsHtml'];}if(_0xe3ce4['body']){_0xe3ce4[_0xb7c3('0x17')]=_0xe3ce4[_0xb7c3('0x17')]['replace'](/0x0){if(this[_0x42d828+_0x7254('0x2c')]>0x0&&this[_0x42d828+_0x7254('0x2b')]>=this[_0x42d828+_0x7254('0x2c')]){return _0x7254('0x2d');}else{return _0x7254('0x2e');}}else{return'idle';}};Agent['prototype'][_0x7254('0x28')]=function(){var _0xd91c1f=[_0x7254('0x2f'),_0x7254('0x30'),_0x7254('0x31'),_0x7254('0x32'),_0x7254('0x33'),'whatsapp'];for(var _0x133287=0x0;_0x133287<_0xd91c1f[_0x7254('0x34')];_0x133287+=0x1){var _0x2b4f46=this['getChannelStatus'](_0xd91c1f[_0x133287]);if(this[_0xd91c1f[_0x133287]+_0x7254('0x35')]!==_0x2b4f46){this[_0xd91c1f[_0x133287]+'StatusTime']=_[_0x7254('0x36')](moment()[_0x7254('0x37')]('x'));}this[_0xd91c1f[_0x133287]+'Status']=_0x2b4f46;}var _0x17bb46={'id':this['id'],'name':this[_0x7254('0x7')],'online':this['online'],'voicePause':this[_0x7254('0x9')],'chatPause':this[_0x7254('0xa')],'mailPause':this[_0x7254('0x38')],'smsPause':this[_0x7254('0xc')],'faxPause':this[_0x7254('0xb')],'openchannelPause':this[_0x7254('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x7254('0xf')],'chatCapacity':this[_0x7254('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x7254('0x11')],'mailStatusTime':this[_0x7254('0x13')],'mailCapacity':this[_0x7254('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x7254('0x16')],'faxStatusTime':this[_0x7254('0x17')],'faxCapacity':this[_0x7254('0x18')],'faxCurrentCapacity':this[_0x7254('0x19')],'smsStatus':this[_0x7254('0x1a')],'smsStatusTime':this[_0x7254('0x1b')],'smsCapacity':this[_0x7254('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x7254('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x7254('0x21')],'openchannelStatus':this[_0x7254('0x22')],'openchannelStatusTime':this[_0x7254('0x23')],'openchannelCapacity':this[_0x7254('0x24')],'openchannelCurrentCapacity':this[_0x7254('0x25')],'busy':this[_0x7254('0x26')],'busyQueue':this[_0x7254('0x27')]};var _0x147cef=md5(JSON[_0x7254('0x39')](_0x17bb46));if(this[_0x7254('0x1')]!==_0x147cef){this[_0x7254('0x1')]=_0x147cef;io[_0x7254('0x3a')](_0x7254('0x3b'),_0x17bb46);}};module[_0x7254('0x3c')]=Agent; \ No newline at end of file +var _0xf69c=['format','faxStatus','faxStatusTime','smsStatusTime','whatsappStatus','whatsappStatusTime','openchannelStatusTime','stringify','emit','user:save','lodash','moment','md5','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','prototype','chat','openchannel','whatsapp','length','Status','StatusTime','toNumber'];(function(_0x11cb9a,_0x3300eb){var _0x37848e=function(_0x3e9261){while(--_0x3e9261){_0x11cb9a['push'](_0x11cb9a['shift']());}};_0x37848e(++_0x3300eb);}(_0xf69c,0x1e2));var _0xcf69=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0xf69c[_0x4f34d8];return _0xc97536;};'use strict';var _=require(_0xcf69('0x0'));var moment=require(_0xcf69('0x1'));var md5=require(_0xcf69('0x2'));var Redis=require(_0xcf69('0x3'));var config=require('../../../config/environment');config[_0xcf69('0x4')]=_[_0xcf69('0x5')](config[_0xcf69('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xcf69('0x6'))(new Redis(config[_0xcf69('0x4')]));function Agent(_0x30b30a){this['id']=_0x30b30a['id']||0x0;this[_0xcf69('0x7')]=_0x30b30a[_0xcf69('0x7')]||'';this[_0xcf69('0x8')]=_0x30b30a[_0xcf69('0x8')]||!![];this['voicePause']=_0x30b30a[_0xcf69('0x9')]||![];this[_0xcf69('0xa')]=_0x30b30a['chatPause']||![];this[_0xcf69('0xb')]=_0x30b30a[_0xcf69('0xb')]||![];this[_0xcf69('0xc')]=_0x30b30a[_0xcf69('0xc')]||![];this['smsPause']=_0x30b30a[_0xcf69('0xd')]||![];this[_0xcf69('0xe')]=_0x30b30a[_0xcf69('0xe')]||![];this['chatStatus']=_0xcf69('0xf');this[_0xcf69('0x10')]=0x0;this['chatCapacity']=_0x30b30a[_0xcf69('0x11')]||0x0;this[_0xcf69('0x12')]=0x0;this[_0xcf69('0x13')]=_0xcf69('0xf');this[_0xcf69('0x14')]=0x0;this[_0xcf69('0x15')]=_0x30b30a[_0xcf69('0x15')]||0x0;this[_0xcf69('0x16')]=0x0;this['faxStatus']=_0xcf69('0xf');this['faxStatusTime']=0x0;this[_0xcf69('0x17')]=_0x30b30a['faxCapacity']||0x0;this[_0xcf69('0x18')]=0x0;this[_0xcf69('0x19')]='unknown';this['smsStatusTime']=0x0;this[_0xcf69('0x1a')]=_0x30b30a['smsCapacity']||0x0;this[_0xcf69('0x1b')]=0x0;this['whatsappStatus']=_0xcf69('0xf');this['whatsappStatusTime']=0x0;this[_0xcf69('0x1c')]=_0x30b30a['whatsappCapacity']||0x0;this[_0xcf69('0x1d')]=0x0;this[_0xcf69('0x1e')]=_0xcf69('0xf');this['openchannelStatusTime']=0x0;this[_0xcf69('0x1f')]=_0x30b30a[_0xcf69('0x1f')]||0x0;this[_0xcf69('0x20')]=0x0;this[_0xcf69('0x21')]=![];this[_0xcf69('0x22')]=undefined;this[_0xcf69('0x2')]='';this[_0xcf69('0x23')]();}Agent['prototype'][_0xcf69('0x24')]=function(_0x1c8816){if(this[_0x1c8816+_0xcf69('0x25')]>0x0){if(this[_0x1c8816+_0xcf69('0x26')]>0x0&&this[_0x1c8816+_0xcf69('0x25')]>=this[_0x1c8816+'Capacity']){return _0xcf69('0x27');}else{return'working';}}else{return _0xcf69('0x28');}};Agent[_0xcf69('0x29')][_0xcf69('0x23')]=function(){var _0x213889=['mail',_0xcf69('0x2a'),_0xcf69('0x2b'),'fax','sms',_0xcf69('0x2c')];for(var _0x348eaf=0x0;_0x348eaf<_0x213889[_0xcf69('0x2d')];_0x348eaf+=0x1){var _0x229182=this['getChannelStatus'](_0x213889[_0x348eaf]);if(this[_0x213889[_0x348eaf]+_0xcf69('0x2e')]!==_0x229182){this[_0x213889[_0x348eaf]+_0xcf69('0x2f')]=_[_0xcf69('0x30')](moment()[_0xcf69('0x31')]('x'));}this[_0x213889[_0x348eaf]+_0xcf69('0x2e')]=_0x229182;}var _0x5e2374={'id':this['id'],'name':this[_0xcf69('0x7')],'online':this[_0xcf69('0x8')],'voicePause':this[_0xcf69('0x9')],'chatPause':this[_0xcf69('0xa')],'mailPause':this[_0xcf69('0xb')],'smsPause':this[_0xcf69('0xd')],'faxPause':this[_0xcf69('0xc')],'openchannelPause':this[_0xcf69('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xcf69('0x10')],'chatCapacity':this[_0xcf69('0x11')],'chatCurrentCapacity':this[_0xcf69('0x12')],'mailStatus':this[_0xcf69('0x13')],'mailStatusTime':this[_0xcf69('0x14')],'mailCapacity':this[_0xcf69('0x15')],'mailCurrentCapacity':this[_0xcf69('0x16')],'faxStatus':this[_0xcf69('0x32')],'faxStatusTime':this[_0xcf69('0x33')],'faxCapacity':this[_0xcf69('0x17')],'faxCurrentCapacity':this[_0xcf69('0x18')],'smsStatus':this[_0xcf69('0x19')],'smsStatusTime':this[_0xcf69('0x34')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xcf69('0x35')],'whatsappStatusTime':this[_0xcf69('0x36')],'whatsappCapacity':this[_0xcf69('0x1c')],'whatsappCurrentCapacity':this[_0xcf69('0x1d')],'openchannelStatus':this[_0xcf69('0x1e')],'openchannelStatusTime':this[_0xcf69('0x37')],'openchannelCapacity':this[_0xcf69('0x1f')],'openchannelCurrentCapacity':this[_0xcf69('0x20')],'busy':this[_0xcf69('0x21')],'busyQueue':this[_0xcf69('0x22')]};var _0x1972e4=md5(JSON[_0xcf69('0x38')](_0x5e2374));if(this['md5']!==_0x1972e4){this[_0xcf69('0x2')]=_0x1972e4;io[_0xcf69('0x39')](_0xcf69('0x3a'),_0x5e2374);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fcacb74..3cb3d20 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 _0x7c01=['waiting','updateRouting','prototype','map','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x7c01,0xd3));var _0x17c0=function(_0x133ef7,_0x4ffae8){_0x133ef7=_0x133ef7-0x0;var _0x30fbbd=_0x7c01[_0x133ef7];return _0x30fbbd;};'use strict';var _=require('lodash');var md5=require(_0x17c0('0x0'));var util=require(_0x17c0('0x1'));var Redis=require(_0x17c0('0x2'));var config=require(_0x17c0('0x3'));config[_0x17c0('0x4')]=_['defaults'](config[_0x17c0('0x4')],{'host':_0x17c0('0x5'),'port':0x18eb});var io=require(_0x17c0('0x6'))(new Redis(config[_0x17c0('0x4')]));function ChatQueue(_0x1e463a){this['id']=_0x1e463a['id']||0x0;this[_0x17c0('0x7')]=_0x1e463a['name']||'';this['timeout']=_0x1e463a[_0x17c0('0x8')]||0xa;this[_0x17c0('0x9')]=_0x1e463a['strategy']||_0x17c0('0xa');this[_0x17c0('0xb')]=_0x1e463a[_0x17c0('0xb')];this[_0x17c0('0xc')]={};this[_0x17c0('0xd')]=0x0;this[_0x17c0('0x0')]='';this[_0x17c0('0xe')]();this['updateRealtime']();}ChatQueue[_0x17c0('0xf')][_0x17c0('0xe')]=function(){var _0x5b2fc3=this[_0x17c0('0xc')]['_rr'];this[_0x17c0('0xc')]=_[_0x17c0('0x10')](this['Agents'],'id');this[_0x17c0('0xc')]['_rr']=_0x5b2fc3;};ChatQueue[_0x17c0('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x17c0('0x11')]=0x0;for(var _0x1c4b87=0x0;_0x1c4b87=0x0?this[_0x17c0('0x16')]:0x0;var _0x234acc={'id':this['id'],'available':this[_0x17c0('0x16')],'loggedIn':this[_0x17c0('0x14')],'name':this[_0x17c0('0x7')],'paused':this[_0x17c0('0x11')],'waiting':this[_0x17c0('0xd')]};var _0x30f759=md5(JSON[_0x17c0('0x17')](_0x234acc));if(this[_0x17c0('0x0')]!==_0x30f759){this['md5']=_0x30f759;io['to'](util[_0x17c0('0x18')](_0x17c0('0x19'),_0x234acc[_0x17c0('0x7')]))['emit'](_0x17c0('0x1a'),_0x234acc);}};module[_0x17c0('0x1b')]=ChatQueue; \ No newline at end of file +var _0xaff3=['loggedIn','paused','online','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x3486b0,_0x248021){var _0x2c8a3f=function(_0x7b5568){while(--_0x7b5568){_0x3486b0['push'](_0x3486b0['shift']());}};_0x2c8a3f(++_0x248021);}(_0xaff3,0x1ca));var _0x3aff=function(_0x571728,_0x582613){_0x571728=_0x571728-0x0;var _0x34e5f4=_0xaff3[_0x571728];return _0x34e5f4;};'use strict';var _=require(_0x3aff('0x0'));var md5=require(_0x3aff('0x1'));var util=require(_0x3aff('0x2'));var Redis=require(_0x3aff('0x3'));var config=require('../../../config/environment');config[_0x3aff('0x4')]=_[_0x3aff('0x5')](config[_0x3aff('0x4')],{'host':_0x3aff('0x6'),'port':0x18eb});var io=require(_0x3aff('0x7'))(new Redis(config[_0x3aff('0x4')]));function ChatQueue(_0x1ee301){this['id']=_0x1ee301['id']||0x0;this[_0x3aff('0x8')]=_0x1ee301['name']||'';this[_0x3aff('0x9')]=_0x1ee301['timeout']||0xa;this['strategy']=_0x1ee301[_0x3aff('0xa')]||'beepall';this['Agents']=_0x1ee301[_0x3aff('0xb')];this[_0x3aff('0xc')]={};this[_0x3aff('0xd')]=0x0;this[_0x3aff('0x1')]='';this[_0x3aff('0xe')]();this[_0x3aff('0xf')]();}ChatQueue[_0x3aff('0x10')][_0x3aff('0xe')]=function(){var _0x465deb=this[_0x3aff('0xc')][_0x3aff('0x11')];this[_0x3aff('0xc')]=_['map'](this[_0x3aff('0xb')],'id');this['mapAgentsId']['_rr']=_0x465deb;};ChatQueue['prototype'][_0x3aff('0xf')]=function(){this[_0x3aff('0x12')]=0x0;this[_0x3aff('0x13')]=0x0;for(var _0x4ecd87=0x0;_0x4ecd87=0x0?this[_0x3aff('0x16')]:0x0;var _0x37b2d8={'id':this['id'],'available':this[_0x3aff('0x16')],'loggedIn':this[_0x3aff('0x12')],'name':this[_0x3aff('0x8')],'paused':this['paused'],'waiting':this[_0x3aff('0xd')]};var _0x135f6f=md5(JSON['stringify'](_0x37b2d8));if(this[_0x3aff('0x1')]!==_0x135f6f){this[_0x3aff('0x1')]=_0x135f6f;io['to'](util[_0x3aff('0x17')](_0x3aff('0x18'),_0x37b2d8[_0x3aff('0x8')]))[_0x3aff('0x19')](_0x3aff('0x1a'),_0x37b2d8);}};module[_0x3aff('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index def7066..ea806e4 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(_0x22351d,_0xd02174){var _0x4c311b=function(_0x509c7b){while(--_0x509c7b){_0x22351d['push'](_0x22351d['shift']());}};_0x4c311b(++_0xd02174);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x27e57d,_0x2d0563){var _0x406e8c=function(_0x5f354f){while(--_0x5f354f){_0x27e57d['push'](_0x27e57d['shift']());}};_0x406e8c(++_0x2d0563);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 671b0ba..5d7b99f 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 _0xcb87=['name','Intervals'];(function(_0x52799c,_0x5d6fa4){var _0x1804c2=function(_0x35264e){while(--_0x35264e){_0x52799c['push'](_0x52799c['shift']());}};_0x1804c2(++_0x5d6fa4);}(_0xcb87,0xa6));var _0x7cb8=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xcb87[_0x3f0b30];return _0x2748a5;};'use strict';function Interval(_0x4c2985){this['id']=_0x4c2985['id']||0x0;this['name']=_0x4c2985[_0x7cb8('0x0')]||'';this[_0x7cb8('0x1')]=_0x4c2985[_0x7cb8('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xd0b0=['exports','name','Intervals'];(function(_0x1115ef,_0x1500a4){var _0x82bc27=function(_0x397a10){while(--_0x397a10){_0x1115ef['push'](_0x1115ef['shift']());}};_0x82bc27(++_0x1500a4);}(_0xd0b0,0x12d));var _0x0d0b=function(_0x560629,_0x1d093c){_0x560629=_0x560629-0x0;var _0x143d59=_0xd0b0[_0x560629];return _0x143d59;};'use strict';function Interval(_0x2f2a39){this['id']=_0x2f2a39['id']||0x0;this[_0x0d0b('0x0')]=_0x2f2a39[_0x0d0b('0x0')]||'';this[_0x0d0b('0x1')]=_0x2f2a39['Intervals']||{};}module[_0x0d0b('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index cfe1f46..df9526c 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 _0xd86f=['available','stringify','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online'];(function(_0x121957,_0x1b2fd5){var _0x276907=function(_0x2f768a){while(--_0x2f768a){_0x121957['push'](_0x121957['shift']());}};_0x276907(++_0x1b2fd5);}(_0xd86f,0x180));var _0xfd86=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd86f[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xfd86('0x0'));var md5=require(_0xfd86('0x1'));var util=require(_0xfd86('0x2'));var Redis=require(_0xfd86('0x3'));var config=require(_0xfd86('0x4'));config[_0xfd86('0x5')]=_['defaults'](config[_0xfd86('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x1368f3){this['id']=_0x1368f3['id']||0x0;this[_0xfd86('0x6')]=_0x1368f3[_0xfd86('0x6')]||'';this[_0xfd86('0x7')]=_0x1368f3['timeout']||0xa;this[_0xfd86('0x8')]=_0x1368f3['strategy']||'beepall';this[_0xfd86('0x9')]=_0x1368f3[_0xfd86('0x9')];this[_0xfd86('0xa')]={};this[_0xfd86('0xb')]=0x0;this['md5']='';this[_0xfd86('0xc')]();this[_0xfd86('0xd')]();}MailQueue['prototype'][_0xfd86('0xc')]=function(){var _0x68a2dc=this[_0xfd86('0xa')][_0xfd86('0xe')];this[_0xfd86('0xa')]=_[_0xfd86('0xf')](this[_0xfd86('0x9')],'id');this[_0xfd86('0xa')][_0xfd86('0xe')]=_0x68a2dc;};MailQueue[_0xfd86('0x10')][_0xfd86('0xd')]=function(){this[_0xfd86('0x11')]=0x0;this[_0xfd86('0x12')]=0x0;for(var _0x5a8eec=0x0;_0x5a8eec=0x0?this['available']:0x0;var _0x3cb1c6={'id':this['id'],'available':this[_0xfd86('0x15')],'loggedIn':this[_0xfd86('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xfd86('0xb')]};var _0x39d2eb=md5(JSON[_0xfd86('0x16')](_0x3cb1c6));if(this[_0xfd86('0x1')]!==_0x39d2eb){this[_0xfd86('0x1')]=_0x39d2eb;io['to'](util[_0xfd86('0x17')](_0xfd86('0x18'),_0x3cb1c6[_0xfd86('0x6')]))[_0xfd86('0x19')]('mail_queue:save',_0x3cb1c6);}};module[_0xfd86('0x1a')]=MailQueue; \ No newline at end of file +var _0x4cf9=['online','mailPause','paused','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','length'];(function(_0x7d2c9b,_0x6dfca9){var _0x1dc1fc=function(_0x4c753e){while(--_0x4c753e){_0x7d2c9b['push'](_0x7d2c9b['shift']());}};_0x1dc1fc(++_0x6dfca9);}(_0x4cf9,0x105));var _0x94cf=function(_0x31198f,_0x347caf){_0x31198f=_0x31198f-0x0;var _0x8402d6=_0x4cf9[_0x31198f];return _0x8402d6;};'use strict';var _=require('lodash');var md5=require(_0x94cf('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x94cf('0x1'));config[_0x94cf('0x2')]=_[_0x94cf('0x3')](config[_0x94cf('0x2')],{'host':_0x94cf('0x4'),'port':0x18eb});var io=require(_0x94cf('0x5'))(new Redis(config[_0x94cf('0x2')]));function MailQueue(_0x32da25){this['id']=_0x32da25['id']||0x0;this[_0x94cf('0x6')]=_0x32da25[_0x94cf('0x6')]||'';this[_0x94cf('0x7')]=_0x32da25[_0x94cf('0x7')]||0xa;this[_0x94cf('0x8')]=_0x32da25[_0x94cf('0x8')]||_0x94cf('0x9');this[_0x94cf('0xa')]=_0x32da25['Agents'];this['mapAgentsId']={};this[_0x94cf('0xb')]=0x0;this[_0x94cf('0x0')]='';this[_0x94cf('0xc')]();this[_0x94cf('0xd')]();}MailQueue[_0x94cf('0xe')][_0x94cf('0xc')]=function(){var _0x361d78=this[_0x94cf('0xf')]['_rr'];this['mapAgentsId']=_[_0x94cf('0x10')](this['Agents'],'id');this[_0x94cf('0xf')]['_rr']=_0x361d78;};MailQueue[_0x94cf('0xe')][_0x94cf('0xd')]=function(){this[_0x94cf('0x11')]=0x0;this['paused']=0x0;for(var _0x3f9cac=0x0;_0x3f9cac=0x0?this[_0x94cf('0x16')]:0x0;var _0x9e6e4b={'id':this['id'],'available':this[_0x94cf('0x16')],'loggedIn':this[_0x94cf('0x11')],'name':this[_0x94cf('0x6')],'paused':this[_0x94cf('0x15')],'waiting':this[_0x94cf('0xb')]};var _0x13934b=md5(JSON[_0x94cf('0x17')](_0x9e6e4b));if(this[_0x94cf('0x0')]!==_0x13934b){this[_0x94cf('0x0')]=_0x13934b;io['to'](util['format'](_0x94cf('0x18'),_0x9e6e4b[_0x94cf('0x6')]))[_0x94cf('0x19')](_0x94cf('0x1a'),_0x9e6e4b);}};module[_0x94cf('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 16f7086..0b3c7c4 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 _0xa1d7=['prototype','updateRealtime','loggedIn','length','online','paused','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','map','_rr'];(function(_0x44a406,_0x17c91f){var _0x506c5a=function(_0xdd1d60){while(--_0xdd1d60){_0x44a406['push'](_0x44a406['shift']());}};_0x506c5a(++_0x17c91f);}(_0xa1d7,0xfe));var _0x7a1d=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xa1d7[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x7a1d('0x0'));var md5=require(_0x7a1d('0x1'));var util=require(_0x7a1d('0x2'));var Redis=require(_0x7a1d('0x3'));var config=require(_0x7a1d('0x4'));config['redis']=_[_0x7a1d('0x5')](config[_0x7a1d('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0xcdfc16){this['id']=_0xcdfc16['id']||0x0;this[_0x7a1d('0x7')]=_0xcdfc16[_0x7a1d('0x7')]||'';this['timeout']=_0xcdfc16[_0x7a1d('0x8')]||0xa;this[_0x7a1d('0x9')]=_0xcdfc16[_0x7a1d('0x9')]||_0x7a1d('0xa');this[_0x7a1d('0xb')]=_0xcdfc16['Agents'];this[_0x7a1d('0xc')]={};this['waiting']=0x0;this[_0x7a1d('0x1')]='';this[_0x7a1d('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x7a1d('0xd')]=function(){var _0x249860=this[_0x7a1d('0xc')]['_rr'];this[_0x7a1d('0xc')]=_[_0x7a1d('0xe')](this[_0x7a1d('0xb')],'id');this[_0x7a1d('0xc')][_0x7a1d('0xf')]=_0x249860;};OpenchannelQueue[_0x7a1d('0x10')][_0x7a1d('0x11')]=function(){this[_0x7a1d('0x12')]=0x0;this['paused']=0x0;for(var _0x4ca029=0x0;_0x4ca029=0x0?this['available']:0x0;var _0x1fe8b1={'id':this['id'],'available':this[_0x7a1d('0x16')],'loggedIn':this[_0x7a1d('0x12')],'name':this[_0x7a1d('0x7')],'paused':this[_0x7a1d('0x15')],'waiting':this[_0x7a1d('0x17')]};var _0x4e4c51=md5(JSON[_0x7a1d('0x18')](_0x1fe8b1));if(this['md5']!==_0x4e4c51){this[_0x7a1d('0x1')]=_0x4e4c51;io['to'](util[_0x7a1d('0x19')](_0x7a1d('0x1a'),_0x1fe8b1[_0x7a1d('0x7')]))[_0x7a1d('0x1b')](_0x7a1d('0x1c'),_0x1fe8b1);}};module[_0x7a1d('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x7592=['loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','exports','lodash','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr'];(function(_0x307f29,_0x25f477){var _0x5768b2=function(_0x43c947){while(--_0x43c947){_0x307f29['push'](_0x307f29['shift']());}};_0x5768b2(++_0x25f477);}(_0x7592,0x8f));var _0x2759=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x7592[_0x54381d];return _0x5308a7;};'use strict';var _=require(_0x2759('0x0'));var md5=require(_0x2759('0x1'));var util=require(_0x2759('0x2'));var Redis=require(_0x2759('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x2759('0x4')](config[_0x2759('0x5')],{'host':_0x2759('0x6'),'port':0x18eb});var io=require(_0x2759('0x7'))(new Redis(config[_0x2759('0x5')]));function OpenchannelQueue(_0x10b88b){this['id']=_0x10b88b['id']||0x0;this[_0x2759('0x8')]=_0x10b88b[_0x2759('0x8')]||'';this[_0x2759('0x9')]=_0x10b88b[_0x2759('0x9')]||0xa;this[_0x2759('0xa')]=_0x10b88b[_0x2759('0xa')]||_0x2759('0xb');this[_0x2759('0xc')]=_0x10b88b[_0x2759('0xc')];this[_0x2759('0xd')]={};this['waiting']=0x0;this[_0x2759('0x1')]='';this[_0x2759('0xe')]();this[_0x2759('0xf')]();}OpenchannelQueue[_0x2759('0x10')][_0x2759('0xe')]=function(){var _0x18894b=this[_0x2759('0xd')]['_rr'];this['mapAgentsId']=_[_0x2759('0x11')](this[_0x2759('0xc')],'id');this['mapAgentsId'][_0x2759('0x12')]=_0x18894b;};OpenchannelQueue[_0x2759('0x10')][_0x2759('0xf')]=function(){this[_0x2759('0x13')]=0x0;this[_0x2759('0x14')]=0x0;for(var _0x1c2b5e=0x0;_0x1c2b5e=0x0?this[_0x2759('0x17')]:0x0;var _0xe670b5={'id':this['id'],'available':this[_0x2759('0x17')],'loggedIn':this[_0x2759('0x13')],'name':this[_0x2759('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x35f1d0=md5(JSON[_0x2759('0x18')](_0xe670b5));if(this['md5']!==_0x35f1d0){this['md5']=_0x35f1d0;io['to'](util['format'](_0x2759('0x19'),_0xe670b5[_0x2759('0x8')]))['emit']('openchannel_queue:save',_0xe670b5);}};module[_0x2759('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 9bd230b..2ff907a 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x42b658,_0x440700){var _0x10a203=function(_0x5986b9){while(--_0x5986b9){_0x42b658['push'](_0x42b658['shift']());}};_0x10a203(++_0x440700);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x290ae0,_0x47de94){var _0x900f9e=function(_0x209fd1){while(--_0x209fd1){_0x290ae0['push'](_0x290ae0['shift']());}};_0x900f9e(++_0x47de94);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb7e7[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index d56c1b3..7e6e9a4 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 _0x732e=['strategy','beepall','mapAgentsId','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','length','online','available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout'];(function(_0x66184b,_0x1987be){var _0xa0b01b=function(_0x2110d5){while(--_0x2110d5){_0x66184b['push'](_0x66184b['shift']());}};_0xa0b01b(++_0x1987be);}(_0x732e,0xa5));var _0xe732=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0x732e[_0x163691];return _0x543ae5;};'use strict';var _=require(_0xe732('0x0'));var md5=require(_0xe732('0x1'));var util=require('util');var Redis=require(_0xe732('0x2'));var config=require(_0xe732('0x3'));config[_0xe732('0x4')]=_[_0xe732('0x5')](config[_0xe732('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe732('0x6'))(new Redis(config[_0xe732('0x4')]));function WhatsappQueue(_0x14c29b){this['id']=_0x14c29b['id']||0x0;this[_0xe732('0x7')]=_0x14c29b[_0xe732('0x7')]||'';this[_0xe732('0x8')]=_0x14c29b['timeout']||0xa;this[_0xe732('0x9')]=_0x14c29b[_0xe732('0x9')]||_0xe732('0xa');this['Agents']=_0x14c29b['Agents'];this[_0xe732('0xb')]={};this['waiting']=0x0;this[_0xe732('0x1')]='';this['updateRouting']();this[_0xe732('0xc')]();}WhatsappQueue[_0xe732('0xd')]['updateRouting']=function(){var _0xf7e4c5=this[_0xe732('0xb')][_0xe732('0xe')];this['mapAgentsId']=_[_0xe732('0xf')](this[_0xe732('0x10')],'id');this['mapAgentsId'][_0xe732('0xe')]=_0xf7e4c5;};WhatsappQueue[_0xe732('0xd')][_0xe732('0xc')]=function(){this[_0xe732('0x11')]=0x0;this[_0xe732('0x12')]=0x0;for(var _0x2e654b=0x0;_0x2e654b=0x0?this['available']:0x0;var _0x339d5f={'id':this['id'],'available':this[_0xe732('0x15')],'loggedIn':this[_0xe732('0x11')],'name':this[_0xe732('0x7')],'paused':this[_0xe732('0x12')],'waiting':this[_0xe732('0x16')]};var _0x4643bb=md5(JSON[_0xe732('0x17')](_0x339d5f));if(this[_0xe732('0x1')]!==_0x4643bb){this[_0xe732('0x1')]=_0x4643bb;io['to'](util[_0xe732('0x18')](_0xe732('0x19'),_0x339d5f[_0xe732('0x7')]))[_0xe732('0x1a')](_0xe732('0x1b'),_0x339d5f);}};module[_0xe732('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x3563=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','whatsappPause','available','stringify'];(function(_0x179a0e,_0x775d0b){var _0x4f481d=function(_0x239c34){while(--_0x239c34){_0x179a0e['push'](_0x179a0e['shift']());}};_0x4f481d(++_0x775d0b);}(_0x3563,0x74));var _0x3356=function(_0x45487f,_0x1938d0){_0x45487f=_0x45487f-0x0;var _0x488771=_0x3563[_0x45487f];return _0x488771;};'use strict';var _=require(_0x3356('0x0'));var md5=require(_0x3356('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3356('0x2'));config[_0x3356('0x3')]=_[_0x3356('0x4')](config[_0x3356('0x3')],{'host':_0x3356('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3356('0x3')]));function WhatsappQueue(_0x43e6f9){this['id']=_0x43e6f9['id']||0x0;this[_0x3356('0x6')]=_0x43e6f9['name']||'';this[_0x3356('0x7')]=_0x43e6f9[_0x3356('0x7')]||0xa;this['strategy']=_0x43e6f9[_0x3356('0x8')]||_0x3356('0x9');this['Agents']=_0x43e6f9[_0x3356('0xa')];this[_0x3356('0xb')]={};this[_0x3356('0xc')]=0x0;this[_0x3356('0x1')]='';this[_0x3356('0xd')]();this[_0x3356('0xe')]();}WhatsappQueue[_0x3356('0xf')][_0x3356('0xd')]=function(){var _0x5dbadd=this[_0x3356('0xb')][_0x3356('0x10')];this[_0x3356('0xb')]=_[_0x3356('0x11')](this[_0x3356('0xa')],'id');this[_0x3356('0xb')][_0x3356('0x10')]=_0x5dbadd;};WhatsappQueue['prototype'][_0x3356('0xe')]=function(){this[_0x3356('0x12')]=0x0;this[_0x3356('0x13')]=0x0;for(var _0xbefe72=0x0;_0xbefe72=0x0?this[_0x3356('0x16')]:0x0;var _0x3ab2d9={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3356('0x12')],'name':this[_0x3356('0x6')],'paused':this['paused'],'waiting':this[_0x3356('0xc')]};var _0x4c759f=md5(JSON[_0x3356('0x17')](_0x3ab2d9));if(this[_0x3356('0x1')]!==_0x4c759f){this[_0x3356('0x1')]=_0x4c759f;io['to'](util['format'](_0x3356('0x18'),_0x3ab2d9[_0x3356('0x6')]))[_0x3356('0x19')](_0x3356('0x1a'),_0x3ab2d9);}};module[_0x3356('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 7223d21..644a869 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 _0x3e74=['initIntervals','mergeFromDatabase','initOpenchannelQueues','openchannelQueues','updateRealtime','updateRouting','initSmsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/chatQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','length','isUndefined'];(function(_0x413b89,_0x4dbd14){var _0x2f80c1=function(_0xb83b2c){while(--_0xb83b2c){_0x413b89['push'](_0x413b89['shift']());}};_0x2f80c1(++_0x4dbd14);}(_0x3e74,0x175));var _0x43e7=function(_0x120c77,_0x13235a){_0x120c77=_0x120c77-0x0;var _0xa15d52=_0x3e74[_0x120c77];return _0xa15d52;};'use strict';var BPromise=require(_0x43e7('0x0'));var util=require('util');var _=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Agent=require(_0x43e7('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x43e7('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x43e7('0x5'));var FaxQueue=require(_0x43e7('0x6'));var WhatsappQueue=require(_0x43e7('0x7'));var Realtime=function(){this[_0x43e7('0x8')]={};this[_0x43e7('0x9')]={};this['openchannelQueues']={};this[_0x43e7('0xa')]={};this[_0x43e7('0xb')]={};this[_0x43e7('0xc')]={};this[_0x43e7('0xd')]={};this[_0x43e7('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x43e7('0xf')]={};this['openchannelQueuesWaitingInteractions']={};this['smsQueuesWaitingInteractions']={};this[_0x43e7('0x10')]={};this[_0x43e7('0x11')]={};};function freeIsNotKey(_0x5c34f4,_0x2803d9,_0x513707){var _0xf7c520=_[_0x43e7('0x12')](_0x5c34f4,function(_0x4ebc8e,_0x3eb206){return _0x4ebc8e[_0x513707];});for(var _0xc960ea in _0x2803d9){if(_0x2803d9[_0x43e7('0x13')](_0xc960ea)){if(!_0xf7c520[_0xc960ea]){delete _0x2803d9[_0xc960ea];}}}}Realtime[_0x43e7('0x14')]['mergeFromDatabase']=function(_0x583d85,_0x2fcb36){for(var _0x21fdd3 in _0x2fcb36){if(_0x583d85[_0x43e7('0x13')](_0x21fdd3)){_0x583d85[_0x21fdd3]=_0x2fcb36[_0x21fdd3];}}};Realtime['prototype']['initAgents']=function(){var _0x16849c=this;return function(_0x14c146){if(_0x14c146){freeIsNotKey(_0x14c146,_0x16849c[_0x43e7('0x8')],'id');for(var _0x328445=0x0,_0x4de324={},_0x5c4eaa={};_0x328445<_0x14c146[_0x43e7('0x15')];_0x328445+=0x1){_0x4de324=_0x14c146[_0x328445];if(_[_0x43e7('0x16')](_0x16849c[_0x43e7('0x8')][_0x4de324['id']])){_0x16849c['agents'][_0x4de324['id']]=new Agent(_0x4de324);}else{_0x16849c['mergeFromDatabase'](_0x16849c[_0x43e7('0x8')][_0x4de324['id']],_0x4de324);}}}return _0x16849c[_0x43e7('0x8')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x17')]=function(){var _0x3776f5=this;return function(_0x1f24fb){if(_0x1f24fb){freeIsNotKey(_0x1f24fb,_0x3776f5[_0x43e7('0x9')],'id');for(var _0x1441ef=0x0,_0x2377a3={},_0xab63cf={};_0x1441ef<_0x1f24fb[_0x43e7('0x15')];_0x1441ef+=0x1){_0x2377a3=_0x1f24fb[_0x1441ef];if(_[_0x43e7('0x16')](_0x3776f5['intervals'][_0x2377a3['id']])){_0x3776f5[_0x43e7('0x9')][_0x2377a3['id']]=new Interval(_0x2377a3);}else{_0x3776f5[_0x43e7('0x18')](_0x3776f5['intervals'][_0x2377a3['id']],_0x2377a3);}}}return _0x3776f5[_0x43e7('0x9')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x19')]=function(){var _0x28aacc=this;return function(_0x4077fb){if(_0x4077fb){freeIsNotKey(_0x4077fb,_0x28aacc[_0x43e7('0x1a')],'id');for(var _0x54a9e7=0x0,_0x454359={},_0x4eea52={};_0x54a9e7<_0x4077fb['length'];_0x54a9e7+=0x1){_0x454359=_0x4077fb[_0x54a9e7];if(_[_0x43e7('0x16')](_0x28aacc[_0x43e7('0x1a')][_0x454359['id']])){_0x28aacc['openchannelQueues'][_0x454359['id']]=new OpenchannelQueue(_0x454359);}else{_0x28aacc[_0x43e7('0x18')](_0x28aacc['openchannelQueues'][_0x454359['id']],_0x454359);}_0x28aacc[_0x43e7('0x1a')][_0x454359['id']]['updateRouting']();_0x28aacc[_0x43e7('0x1a')][_0x454359['id']][_0x43e7('0x1b')]();}}return _0x28aacc[_0x43e7('0x1a')];};};Realtime[_0x43e7('0x14')]['initChatQueues']=function(){var _0x52b7b3=this;return function(_0x805b54){if(_0x805b54){freeIsNotKey(_0x805b54,_0x52b7b3['chatQueues'],'id');for(var _0x2dd5f=0x0,_0x40dc8f={},_0x3565cf={};_0x2dd5f<_0x805b54[_0x43e7('0x15')];_0x2dd5f+=0x1){_0x40dc8f=_0x805b54[_0x2dd5f];if(_['isUndefined'](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']])){_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']]=new ChatQueue(_0x40dc8f);}else{_0x52b7b3[_0x43e7('0x18')](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']],_0x40dc8f);}_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1c')]();_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1b')]();}}return _0x52b7b3[_0x43e7('0xa')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1d')]=function(){var _0x19725a=this;return function(_0x2bde44){if(_0x2bde44){freeIsNotKey(_0x2bde44,_0x19725a[_0x43e7('0xb')],'id');for(var _0x4bdb17=0x0,_0x238321={},_0x44f6b0={};_0x4bdb17<_0x2bde44[_0x43e7('0x15')];_0x4bdb17+=0x1){_0x238321=_0x2bde44[_0x4bdb17];if(_[_0x43e7('0x16')](_0x19725a[_0x43e7('0xb')][_0x238321['id']])){_0x19725a['smsQueues'][_0x238321['id']]=new SmsQueue(_0x238321);}else{_0x19725a[_0x43e7('0x18')](_0x19725a[_0x43e7('0xb')][_0x238321['id']],_0x238321);}_0x19725a[_0x43e7('0xb')][_0x238321['id']][_0x43e7('0x1c')]();_0x19725a['smsQueues'][_0x238321['id']]['updateRealtime']();}}return _0x19725a['smsQueues'];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1e')]=function(){var _0x117c07=this;return function(_0x234fe6){if(_0x234fe6){freeIsNotKey(_0x234fe6,_0x117c07[_0x43e7('0xc')],'id');for(var _0xde7ed=0x0,_0x485c6c={},_0x47baee={};_0xde7ed<_0x234fe6['length'];_0xde7ed+=0x1){_0x485c6c=_0x234fe6[_0xde7ed];if(_['isUndefined'](_0x117c07['mailQueues'][_0x485c6c['id']])){_0x117c07['mailQueues'][_0x485c6c['id']]=new MailQueue(_0x485c6c);}else{_0x117c07['mergeFromDatabase'](_0x117c07[_0x43e7('0xc')][_0x485c6c['id']],_0x485c6c);}_0x117c07['mailQueues'][_0x485c6c['id']][_0x43e7('0x1c')]();_0x117c07[_0x43e7('0xc')][_0x485c6c['id']][_0x43e7('0x1b')]();}}return _0x117c07[_0x43e7('0xc')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1f')]=function(){var _0x101d45=this;return function(_0x4f1a5f){if(_0x4f1a5f){freeIsNotKey(_0x4f1a5f,_0x101d45['faxQueues'],'id');for(var _0x5d84f4=0x0,_0xfa0474={},_0xfe70e9={};_0x5d84f4<_0x4f1a5f[_0x43e7('0x15')];_0x5d84f4+=0x1){_0xfa0474=_0x4f1a5f[_0x5d84f4];if(_[_0x43e7('0x16')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']])){_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]=new FaxQueue(_0xfa0474);}else{_0x101d45[_0x43e7('0x18')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']],_0xfa0474);}_0x101d45['faxQueues'][_0xfa0474['id']][_0x43e7('0x1c')]();_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]['updateRealtime']();}}return _0x101d45[_0x43e7('0xd')];};};Realtime['prototype'][_0x43e7('0x20')]=function(){var _0x2ad008=this;return function(_0x1c6f45){if(_0x1c6f45){freeIsNotKey(_0x1c6f45,_0x2ad008[_0x43e7('0xe')],'id');for(var _0x35ac85=0x0,_0x234d8f={},_0x5e731b={};_0x35ac85<_0x1c6f45['length'];_0x35ac85+=0x1){_0x234d8f=_0x1c6f45[_0x35ac85];if(_[_0x43e7('0x16')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']])){_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]=new WhatsappQueue(_0x234d8f);}else{_0x2ad008[_0x43e7('0x18')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']],_0x234d8f);}_0x2ad008['whatsappQueues'][_0x234d8f['id']][_0x43e7('0x1c')]();_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]['updateRealtime']();}}return _0x2ad008[_0x43e7('0xe')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9957=['../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue'];(function(_0x198899,_0x2b9510){var _0x10f17a=function(_0x1ab85a){while(--_0x1ab85a){_0x198899['push'](_0x198899['shift']());}};_0x10f17a(++_0x2b9510);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var moment=require(_0x7995('0x3'));var Agent=require('../model/agent');var Interval=require(_0x7995('0x4'));var OpenchannelQueue=require(_0x7995('0x5'));var ChatQueue=require(_0x7995('0x6'));var SmsQueue=require(_0x7995('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x7995('0x8'));var WhatsappQueue=require(_0x7995('0x9'));var Realtime=function(){this[_0x7995('0xa')]={};this[_0x7995('0xb')]={};this[_0x7995('0xc')]={};this[_0x7995('0xd')]={};this['smsQueues']={};this[_0x7995('0xe')]={};this[_0x7995('0xf')]={};this['whatsappQueues']={};this[_0x7995('0x10')]={};this[_0x7995('0x11')]={};this[_0x7995('0x12')]={};this[_0x7995('0x13')]={};this[_0x7995('0x14')]={};this[_0x7995('0x15')]={};};function freeIsNotKey(_0x341672,_0x524f7b,_0x245143){var _0x41c652=_['mapKeys'](_0x341672,function(_0xb0c872,_0x2cb37a){return _0xb0c872[_0x245143];});for(var _0x19a27e in _0x524f7b){if(_0x524f7b[_0x7995('0x16')](_0x19a27e)){if(!_0x41c652[_0x19a27e]){delete _0x524f7b[_0x19a27e];}}}}Realtime[_0x7995('0x17')][_0x7995('0x18')]=function(_0x2bbe7a,_0x4cc004){for(var _0x58f5ad in _0x4cc004){if(_0x2bbe7a[_0x7995('0x16')](_0x58f5ad)){_0x2bbe7a[_0x58f5ad]=_0x4cc004[_0x58f5ad];}}};Realtime[_0x7995('0x17')][_0x7995('0x19')]=function(){var _0x321ae8=this;return function(_0x3f1d3e){if(_0x3f1d3e){freeIsNotKey(_0x3f1d3e,_0x321ae8[_0x7995('0xa')],'id');for(var _0x2202ce=0x0,_0x41cbf0={},_0x5377e5={};_0x2202ce<_0x3f1d3e[_0x7995('0x1a')];_0x2202ce+=0x1){_0x41cbf0=_0x3f1d3e[_0x2202ce];if(_['isUndefined'](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']])){_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']]=new Agent(_0x41cbf0);}else{_0x321ae8[_0x7995('0x18')](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']],_0x41cbf0);}}}return _0x321ae8[_0x7995('0xa')];};};Realtime[_0x7995('0x17')]['initIntervals']=function(){var _0x54c9ae=this;return function(_0x2536c8){if(_0x2536c8){freeIsNotKey(_0x2536c8,_0x54c9ae['intervals'],'id');for(var _0x555f74=0x0,_0x3ec178={},_0x3d463e={};_0x555f74<_0x2536c8['length'];_0x555f74+=0x1){_0x3ec178=_0x2536c8[_0x555f74];if(_[_0x7995('0x1b')](_0x54c9ae['intervals'][_0x3ec178['id']])){_0x54c9ae['intervals'][_0x3ec178['id']]=new Interval(_0x3ec178);}else{_0x54c9ae[_0x7995('0x18')](_0x54c9ae[_0x7995('0xb')][_0x3ec178['id']],_0x3ec178);}}}return _0x54c9ae[_0x7995('0xb')];};};Realtime[_0x7995('0x17')][_0x7995('0x1c')]=function(){var _0x1c278a=this;return function(_0x5d40ae){if(_0x5d40ae){freeIsNotKey(_0x5d40ae,_0x1c278a[_0x7995('0xc')],'id');for(var _0x46ee4b=0x0,_0x204507={},_0x285437={};_0x46ee4b<_0x5d40ae[_0x7995('0x1a')];_0x46ee4b+=0x1){_0x204507=_0x5d40ae[_0x46ee4b];if(_[_0x7995('0x1b')](_0x1c278a[_0x7995('0xc')][_0x204507['id']])){_0x1c278a[_0x7995('0xc')][_0x204507['id']]=new OpenchannelQueue(_0x204507);}else{_0x1c278a['mergeFromDatabase'](_0x1c278a[_0x7995('0xc')][_0x204507['id']],_0x204507);}_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1d')]();_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1e')]();}}return _0x1c278a[_0x7995('0xc')];};};Realtime['prototype'][_0x7995('0x1f')]=function(){var _0x5911c3=this;return function(_0x229742){if(_0x229742){freeIsNotKey(_0x229742,_0x5911c3[_0x7995('0xd')],'id');for(var _0xf16cc2=0x0,_0x132a42={},_0x11c1eb={};_0xf16cc2<_0x229742['length'];_0xf16cc2+=0x1){_0x132a42=_0x229742[_0xf16cc2];if(_[_0x7995('0x1b')](_0x5911c3['chatQueues'][_0x132a42['id']])){_0x5911c3[_0x7995('0xd')][_0x132a42['id']]=new ChatQueue(_0x132a42);}else{_0x5911c3[_0x7995('0x18')](_0x5911c3[_0x7995('0xd')][_0x132a42['id']],_0x132a42);}_0x5911c3['chatQueues'][_0x132a42['id']]['updateRouting']();_0x5911c3['chatQueues'][_0x132a42['id']][_0x7995('0x1e')]();}}return _0x5911c3[_0x7995('0xd')];};};Realtime[_0x7995('0x17')][_0x7995('0x20')]=function(){var _0x2e3493=this;return function(_0x1ca460){if(_0x1ca460){freeIsNotKey(_0x1ca460,_0x2e3493['smsQueues'],'id');for(var _0x481c74=0x0,_0xfa8f15={},_0x5524af={};_0x481c74<_0x1ca460[_0x7995('0x1a')];_0x481c74+=0x1){_0xfa8f15=_0x1ca460[_0x481c74];if(_[_0x7995('0x1b')](_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']])){_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']]=new SmsQueue(_0xfa8f15);}else{_0x2e3493[_0x7995('0x18')](_0x2e3493['smsQueues'][_0xfa8f15['id']],_0xfa8f15);}_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']][_0x7995('0x1d')]();_0x2e3493['smsQueues'][_0xfa8f15['id']]['updateRealtime']();}}return _0x2e3493['smsQueues'];};};Realtime[_0x7995('0x17')][_0x7995('0x22')]=function(){var _0x4a176f=this;return function(_0x3e7020){if(_0x3e7020){freeIsNotKey(_0x3e7020,_0x4a176f['mailQueues'],'id');for(var _0x37917b=0x0,_0x1cb058={},_0x177cb4={};_0x37917b<_0x3e7020['length'];_0x37917b+=0x1){_0x1cb058=_0x3e7020[_0x37917b];if(_['isUndefined'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']])){_0x4a176f['mailQueues'][_0x1cb058['id']]=new MailQueue(_0x1cb058);}else{_0x4a176f['mergeFromDatabase'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']],_0x1cb058);}_0x4a176f[_0x7995('0xe')][_0x1cb058['id']]['updateRouting']();_0x4a176f[_0x7995('0xe')][_0x1cb058['id']][_0x7995('0x1e')]();}}return _0x4a176f[_0x7995('0xe')];};};Realtime[_0x7995('0x17')][_0x7995('0x23')]=function(){var _0x53002a=this;return function(_0x2d4285){if(_0x2d4285){freeIsNotKey(_0x2d4285,_0x53002a[_0x7995('0xf')],'id');for(var _0xf612e6=0x0,_0x1d60b8={},_0x4b1541={};_0xf612e6<_0x2d4285[_0x7995('0x1a')];_0xf612e6+=0x1){_0x1d60b8=_0x2d4285[_0xf612e6];if(_[_0x7995('0x1b')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']])){_0x53002a[_0x7995('0xf')][_0x1d60b8['id']]=new FaxQueue(_0x1d60b8);}else{_0x53002a[_0x7995('0x18')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']],_0x1d60b8);}_0x53002a['faxQueues'][_0x1d60b8['id']][_0x7995('0x1d')]();_0x53002a[_0x7995('0xf')][_0x1d60b8['id']][_0x7995('0x1e')]();}}return _0x53002a[_0x7995('0xf')];};};Realtime[_0x7995('0x17')][_0x7995('0x24')]=function(){var _0x14d638=this;return function(_0x270c0e){if(_0x270c0e){freeIsNotKey(_0x270c0e,_0x14d638[_0x7995('0x25')],'id');for(var _0x447981=0x0,_0x6fe77b={},_0x270d52={};_0x447981<_0x270c0e[_0x7995('0x1a')];_0x447981+=0x1){_0x6fe77b=_0x270c0e[_0x447981];if(_['isUndefined'](_0x14d638['whatsappQueues'][_0x6fe77b['id']])){_0x14d638[_0x7995('0x25')][_0x6fe77b['id']]=new WhatsappQueue(_0x6fe77b);}else{_0x14d638[_0x7995('0x18')](_0x14d638['whatsappQueues'][_0x6fe77b['id']],_0x6fe77b);}_0x14d638['whatsappQueues'][_0x6fe77b['id']][_0x7995('0x1d')]();_0x14d638['whatsappQueues'][_0x6fe77b['id']]['updateRealtime']();}}return _0x14d638[_0x7995('0x25')];};};module[_0x7995('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4d9427a..d0d0826 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 _0xd70e=['update','Request','addTags','addTagsToChatInteraction','../client'];(function(_0x1bdb2c,_0x2a139b){var _0x307233=function(_0x15da39){while(--_0x15da39){_0x1bdb2c['push'](_0x1bdb2c['shift']());}};_0x307233(++_0x2a139b);}(_0xd70e,0x15d));var _0xed70=function(_0x3ab5d0,_0x2b71e9){_0x3ab5d0=_0x3ab5d0-0x0;var _0x3a6fd5=_0xd70e[_0x3ab5d0];return _0x3a6fd5;};'use strict';var client=require(_0xed70('0x0'));exports[_0xed70('0x1')]=function(_0x164cd6,_0x1a3a30){return client[_0xed70('0x2')]('UpdateChatInteraction',{'body':_0x1a3a30,'options':{'where':{'id':_0x164cd6}},'log':'updateChatInteraction'});};exports[_0xed70('0x3')]=function(_0xe2f5ee,_0x55803d){return client[_0xed70('0x2')]('AddTagsToChatInteraction',{'body':_0x55803d,'options':{'where':{'id':_0xe2f5ee}},'log':_0xed70('0x4')});}; \ No newline at end of file +var _0x4dd2=['updateChatInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x6e2c26,_0x122e96){var _0x219671=function(_0x57b231){while(--_0x57b231){_0x6e2c26['push'](_0x6e2c26['shift']());}};_0x219671(++_0x122e96);}(_0x4dd2,0xc0));var _0x24dd=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x4dd2[_0x213518];return _0x1baf75;};'use strict';var client=require(_0x24dd('0x0'));exports[_0x24dd('0x1')]=function(_0x38f944,_0x1091a8){return client[_0x24dd('0x2')](_0x24dd('0x3'),{'body':_0x1091a8,'options':{'where':{'id':_0x38f944}},'log':_0x24dd('0x4')});};exports[_0x24dd('0x5')]=function(_0x3e9476,_0x5d722e){return client['Request']('AddTagsToChatInteraction',{'body':_0x5d722e,'options':{'where':{'id':_0x3e9476}},'log':_0x24dd('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c1213f4..b031743 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 _0x82cb=['CreateChatMessage','create','Request'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x82cb,0x100));var _0xb82c=function(_0x1e318d,_0x2ebdc1){_0x1e318d=_0x1e318d-0x0;var _0x310859=_0x82cb[_0x1e318d];return _0x310859;};'use strict';var client=require('../client');exports[_0xb82c('0x0')]=function(_0x2f3db2){return client[_0xb82c('0x1')](_0xb82c('0x2'),{'body':_0x2f3db2,'log':'createChatMessage'});}; \ No newline at end of file +var _0xe543=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x5b86ce,_0x30d324){var _0x210a05=function(_0x58dd3d){while(--_0x58dd3d){_0x5b86ce['push'](_0x5b86ce['shift']());}};_0x210a05(++_0x30d324);}(_0xe543,0x1c3));var _0x3e54=function(_0x1ae039,_0x40b51d){_0x1ae039=_0x1ae039-0x0;var _0x354ecf=_0xe543[_0x1ae039];return _0x354ecf;};'use strict';var client=require(_0x3e54('0x0'));exports[_0x3e54('0x1')]=function(_0x4a6e0d){return client[_0x3e54('0x2')](_0x3e54('0x3'),{'body':_0x4a6e0d,'log':_0x3e54('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index d652078..9792132 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 _0xbe39=['User','Agents','name','chatPause','getChatQueues','Request','GetChatQueue','timeout','strategy'];(function(_0x2b608e,_0x2b9d76){var _0x2aca67=function(_0x1a6ac5){while(--_0x1a6ac5){_0x2b608e['push'](_0x2b608e['shift']());}};_0x2aca67(++_0x2b9d76);}(_0xbe39,0xaf));var _0x9be3=function(_0x52fd51,_0x2a2e7c){_0x52fd51=_0x52fd51-0x0;var _0x43f99f=_0xbe39[_0x52fd51];return _0x43f99f;};'use strict';var client=require('../client');exports[_0x9be3('0x0')]=function(){return function(){return client[_0x9be3('0x1')](_0x9be3('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9be3('0x3'),_0x9be3('0x4')],'include':[{'model':_0x9be3('0x5'),'as':_0x9be3('0x6'),'attributes':['id',_0x9be3('0x7'),'online',_0x9be3('0x8')]}]},'log':_0x9be3('0x0')});};}; \ No newline at end of file +var _0x7ac1=['User','online','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x11a083,_0xe9b2a3){var _0x5e1ed4=function(_0x1c528a){while(--_0x1c528a){_0x11a083['push'](_0x11a083['shift']());}};_0x5e1ed4(++_0xe9b2a3);}(_0x7ac1,0x192));var _0x17ac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7ac1[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x17ac('0x0'));exports[_0x17ac('0x1')]=function(){return function(){return client[_0x17ac('0x2')](_0x17ac('0x3'),{'options':{'raw':![],'attributes':['id',_0x17ac('0x4'),_0x17ac('0x5'),'strategy'],'include':[{'model':_0x17ac('0x6'),'as':'Agents','attributes':['id','name',_0x17ac('0x7'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ef9c4d8..be154ef 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 _0x167e=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x49693f,_0x4d994f){var _0x1b0f6e=function(_0x4b2c16){while(--_0x4b2c16){_0x49693f['push'](_0x49693f['shift']());}};_0x1b0f6e(++_0x4d994f);}(_0x167e,0xa3));var _0xe167=function(_0x5d1fbe,_0x491dd1){_0x5d1fbe=_0x5d1fbe-0x0;var _0x4a26a9=_0x167e[_0x5d1fbe];return _0x4a26a9;};'use strict';var client=require(_0xe167('0x0'));exports[_0xe167('0x1')]=function(_0x2a44c5){return client[_0xe167('0x2')](_0xe167('0x3'),{'body':_0x2a44c5,'log':_0xe167('0x3')});};exports[_0xe167('0x4')]=function(_0x62d76c,_0x5e4863){return client[_0xe167('0x2')]('UpdateChatQueueReport',{'body':_0x5e4863,'options':{'where':{'uniqueid':_0x62d76c},'order':[['id',_0xe167('0x5')]],'limit':0x1},'log':_0xe167('0x6')});}; \ No newline at end of file +var _0x9f94=['update','Request','DESC','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x9f94,0x1e7));var _0x49f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9f94[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x49f9('0x0'));exports[_0x49f9('0x1')]=function(_0x2ca96a){return client['Request']('CreateChatQueueReport',{'body':_0x2ca96a,'log':_0x49f9('0x2')});};exports[_0x49f9('0x3')]=function(_0xb643ef,_0x375856){return client[_0x49f9('0x4')]('UpdateChatQueueReport',{'body':_0x375856,'options':{'where':{'uniqueid':_0xb643ef},'order':[['id',_0x49f9('0x5')]],'limit':0x1},'log':_0x49f9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2860b2d..dd57079 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 _0xe751=['addTags','Request','AddTagsToFaxInteraction','../client','update','UpdateFaxInteraction'];(function(_0x19148b,_0x3ab03c){var _0x51fbad=function(_0x3334ce){while(--_0x3334ce){_0x19148b['push'](_0x19148b['shift']());}};_0x51fbad(++_0x3ab03c);}(_0xe751,0xed));var _0x1e75=function(_0x3c3a6a,_0x53569a){_0x3c3a6a=_0x3c3a6a-0x0;var _0x2f7b5c=_0xe751[_0x3c3a6a];return _0x2f7b5c;};'use strict';var client=require(_0x1e75('0x0'));exports[_0x1e75('0x1')]=function(_0x3f68e3,_0x4c17a9){return client['Request'](_0x1e75('0x2'),{'body':_0x4c17a9,'options':{'where':{'id':_0x3f68e3}},'log':'updateFaxInteraction'});};exports[_0x1e75('0x3')]=function(_0xb4388d,_0x17ac90){return client[_0x1e75('0x4')](_0x1e75('0x5'),{'body':_0x17ac90,'options':{'where':{'id':_0xb4388d}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x1d14=['update','Request','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x405f48,_0x27cfb5){var _0x27f8c1=function(_0x1dd5c9){while(--_0x1dd5c9){_0x405f48['push'](_0x405f48['shift']());}};_0x27f8c1(++_0x27cfb5);}(_0x1d14,0x19d));var _0x41d1=function(_0x2c184b,_0x5dc0e1){_0x2c184b=_0x2c184b-0x0;var _0x56cd6d=_0x1d14[_0x2c184b];return _0x56cd6d;};'use strict';var client=require(_0x41d1('0x0'));exports[_0x41d1('0x1')]=function(_0x199051,_0x3bdc60){return client[_0x41d1('0x2')]('UpdateFaxInteraction',{'body':_0x3bdc60,'options':{'where':{'id':_0x199051}},'log':'updateFaxInteraction'});};exports[_0x41d1('0x3')]=function(_0x46898b,_0x32461a){return client['Request'](_0x41d1('0x4'),{'body':_0x32461a,'options':{'where':{'id':_0x46898b}},'log':_0x41d1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 03e86cb..c26c1b4 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 _0xf5c6=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x498af6,_0x3e0604){var _0x24a2b0=function(_0x5051ce){while(--_0x5051ce){_0x498af6['push'](_0x498af6['shift']());}};_0x24a2b0(++_0x3e0604);}(_0xf5c6,0x1ed));var _0x6f5c=function(_0x5e4bfd,_0x42e1dd){_0x5e4bfd=_0x5e4bfd-0x0;var _0x2386e2=_0xf5c6[_0x5e4bfd];return _0x2386e2;};'use strict';var client=require(_0x6f5c('0x0'));exports[_0x6f5c('0x1')]=function(_0x45390a){return client[_0x6f5c('0x2')](_0x6f5c('0x3'),{'body':_0x45390a,'log':_0x6f5c('0x4')});}; \ No newline at end of file +var _0xd914=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x22c95c,_0x32232c){var _0x573bf7=function(_0x2d648b){while(--_0x2d648b){_0x22c95c['push'](_0x22c95c['shift']());}};_0x573bf7(++_0x32232c);}(_0xd914,0x105));var _0x4d91=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xd914[_0x4c7fb5];return _0x2e10ac;};'use strict';var client=require(_0x4d91('0x0'));exports['create']=function(_0x505008){return client[_0x4d91('0x1')](_0x4d91('0x2'),{'body':_0x505008,'log':_0x4d91('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2b5c7c3..d71c691 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 _0x84e5=['getFaxQueues','Request','GetFaxQueue','name','timeout','online','faxPause','../client'];(function(_0x4c08bb,_0x456c0a){var _0x29e288=function(_0x9d91f5){while(--_0x9d91f5){_0x4c08bb['push'](_0x4c08bb['shift']());}};_0x29e288(++_0x456c0a);}(_0x84e5,0xe7));var _0x584e=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x84e5[_0x19b3f9];return _0x18c3f6;};'use strict';var client=require(_0x584e('0x0'));exports[_0x584e('0x1')]=function(){return function(){return client[_0x584e('0x2')](_0x584e('0x3'),{'options':{'raw':![],'attributes':['id',_0x584e('0x4'),_0x584e('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x584e('0x6'),_0x584e('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x2311=['strategy','User','Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x3e0dc4,_0x13971b){var _0x586111=function(_0x123c53){while(--_0x123c53){_0x3e0dc4['push'](_0x3e0dc4['shift']());}};_0x586111(++_0x13971b);}(_0x2311,0x159));var _0x1231=function(_0x5f1033,_0x4e3d7b){_0x5f1033=_0x5f1033-0x0;var _0x173c98=_0x2311[_0x5f1033];return _0x173c98;};'use strict';var client=require('../client');exports[_0x1231('0x0')]=function(){return function(){return client[_0x1231('0x1')](_0x1231('0x2'),{'options':{'raw':![],'attributes':['id',_0x1231('0x3'),_0x1231('0x4'),_0x1231('0x5')],'include':[{'model':_0x1231('0x6'),'as':_0x1231('0x7'),'attributes':['id',_0x1231('0x3'),_0x1231('0x8'),_0x1231('0x9')]}]},'log':_0x1231('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 51b4c2f..07542c7 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 _0x0488=['CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create','Request'];(function(_0x4146bf,_0x25c865){var _0x5d189a=function(_0x179884){while(--_0x179884){_0x4146bf['push'](_0x4146bf['shift']());}};_0x5d189a(++_0x25c865);}(_0x0488,0x17d));var _0x8048=function(_0x38b27f,_0x4b9a43){_0x38b27f=_0x38b27f-0x0;var _0x5b9c4d=_0x0488[_0x38b27f];return _0x5b9c4d;};'use strict';var client=require(_0x8048('0x0'));exports[_0x8048('0x1')]=function(_0x276a5a){return client[_0x8048('0x2')](_0x8048('0x3'),{'body':_0x276a5a,'log':_0x8048('0x3')});};exports[_0x8048('0x4')]=function(_0x2edbd2,_0xe1c552){return client[_0x8048('0x2')](_0x8048('0x5'),{'body':_0xe1c552,'options':{'where':{'uniqueid':_0x2edbd2},'order':[['id','DESC']],'limit':0x1},'log':_0x8048('0x5')});}; \ No newline at end of file +var _0x8fd3=['Request','DESC','UpdateFaxQueueReport','create'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8fd3,0x1d7));var _0x38fd=function(_0x2aee45,_0x3bd919){_0x2aee45=_0x2aee45-0x0;var _0xd48933=_0x8fd3[_0x2aee45];return _0xd48933;};'use strict';var client=require('../client');exports[_0x38fd('0x0')]=function(_0x2837e4){return client[_0x38fd('0x1')]('CreateFaxQueueReport',{'body':_0x2837e4,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x23c29a,_0x2e8fb4){return client['Request']('UpdateFaxQueueReport',{'body':_0x2e8fb4,'options':{'where':{'uniqueid':_0x23c29a},'order':[['id',_0x38fd('0x2')]],'limit':0x1},'log':_0x38fd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 3ca66ab..c1c8fe0 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 _0xa571=['getIntervals','Request','GetInterval','Interval','Intervals','../client'];(function(_0x4b0eab,_0x4862cb){var _0x373dd3=function(_0x4a81ed){while(--_0x4a81ed){_0x4b0eab['push'](_0x4b0eab['shift']());}};_0x373dd3(++_0x4862cb);}(_0xa571,0x107));var _0x1a57=function(_0x276a08,_0xf0f5a1){_0x276a08=_0x276a08-0x0;var _0x1941c2=_0xa571[_0x276a08];return _0x1941c2;};'use strict';var client=require(_0x1a57('0x0'));exports[_0x1a57('0x1')]=function(){return function(){return client[_0x1a57('0x2')](_0x1a57('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1a57('0x4'),'as':_0x1a57('0x5'),'attributes':['id','name','interval']}]},'log':_0x1a57('0x1')});};}; \ No newline at end of file +var _0xb9be=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x226fb8,_0x54270e){var _0x1be954=function(_0x83410d){while(--_0x83410d){_0x226fb8['push'](_0x226fb8['shift']());}};_0x1be954(++_0x54270e);}(_0xb9be,0xc5));var _0xeb9b=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xb9be[_0xa8883];return _0x479426;};'use strict';var client=require(_0xeb9b('0x0'));exports[_0xeb9b('0x1')]=function(){return function(){return client[_0xeb9b('0x2')](_0xeb9b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeb9b('0x4')],'include':[{'model':_0xeb9b('0x5'),'as':_0xeb9b('0x6'),'attributes':['id',_0xeb9b('0x4'),_0xeb9b('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8c4dec0..869d44d 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 _0xbda2=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbda2,0x111));var _0x2bda=function(_0x5b9a39,_0x3c501c){_0x5b9a39=_0x5b9a39-0x0;var _0x5b05ea=_0xbda2[_0x5b9a39];return _0x5b05ea;};'use strict';var client=require(_0x2bda('0x0'));exports[_0x2bda('0x1')]=function(_0x19785a,_0x3a4628){return client[_0x2bda('0x2')](_0x2bda('0x3'),{'body':_0x3a4628,'options':{'where':{'id':_0x19785a}},'log':_0x2bda('0x4')});};exports[_0x2bda('0x5')]=function(_0x73cf2b,_0xfdc31a){return client[_0x2bda('0x2')](_0x2bda('0x6'),{'body':_0xfdc31a,'options':{'where':{'id':_0x73cf2b}},'log':_0x2bda('0x7')});}; \ No newline at end of file +var _0xcfa7=['AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xcfa7,0x17b));var _0x7cfa=function(_0x13920d,_0x344120){_0x13920d=_0x13920d-0x0;var _0x22f1c9=_0xcfa7[_0x13920d];return _0x22f1c9;};'use strict';var client=require(_0x7cfa('0x0'));exports[_0x7cfa('0x1')]=function(_0x4782aa,_0x5bd79e){return client[_0x7cfa('0x2')](_0x7cfa('0x3'),{'body':_0x5bd79e,'options':{'where':{'id':_0x4782aa}},'log':_0x7cfa('0x4')});};exports[_0x7cfa('0x5')]=function(_0x4f0930,_0x4c7d4a){return client[_0x7cfa('0x2')](_0x7cfa('0x6'),{'body':_0x4c7d4a,'options':{'where':{'id':_0x4f0930}},'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 6ed7f70..f6f8381 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 _0x6bc9=['createMailMessage','create','Request'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0x6bc9,0x136));var _0x96bc=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x6bc9[_0x5cc3d4];return _0x17ca31;};'use strict';var client=require('../client');exports[_0x96bc('0x0')]=function(_0x3765d2){return client[_0x96bc('0x1')]('CreateMailMessage',{'body':_0x3765d2,'log':_0x96bc('0x2')});}; \ No newline at end of file +var _0xff6b=['createMailMessage','create','Request'];(function(_0x13e0e5,_0x139120){var _0x1e4ec1=function(_0x489e89){while(--_0x489e89){_0x13e0e5['push'](_0x13e0e5['shift']());}};_0x1e4ec1(++_0x139120);}(_0xff6b,0x1ab));var _0xbff6=function(_0x4e379a,_0x10b368){_0x4e379a=_0x4e379a-0x0;var _0x109c5a=_0xff6b[_0x4e379a];return _0x109c5a;};'use strict';var client=require('../client');exports[_0xbff6('0x0')]=function(_0x59ec58){return client[_0xbff6('0x1')]('CreateMailMessage',{'body':_0x59ec58,'log':_0xbff6('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 37242ef..0797873 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 _0xa81c=['../client','getMailQueues','GetMailQueue','strategy','Agents','name','mailPause'];(function(_0x404e15,_0x4ee833){var _0x199c97=function(_0x18a6ab){while(--_0x18a6ab){_0x404e15['push'](_0x404e15['shift']());}};_0x199c97(++_0x4ee833);}(_0xa81c,0x19d));var _0xca81=function(_0x5a79a5,_0x344a86){_0x5a79a5=_0x5a79a5-0x0;var _0x1e66d3=_0xa81c[_0x5a79a5];return _0x1e66d3;};'use strict';var client=require(_0xca81('0x0'));exports[_0xca81('0x1')]=function(){return function(){return client['Request'](_0xca81('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xca81('0x3')],'include':[{'model':'User','as':_0xca81('0x4'),'attributes':['id',_0xca81('0x5'),'online',_0xca81('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x4b45=['Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','User'];(function(_0x5decb7,_0x306ed7){var _0x3dcc19=function(_0x207f64){while(--_0x207f64){_0x5decb7['push'](_0x5decb7['shift']());}};_0x3dcc19(++_0x306ed7);}(_0x4b45,0xf6));var _0x54b4=function(_0x4bad08,_0x4abff2){_0x4bad08=_0x4bad08-0x0;var _0x4cc71e=_0x4b45[_0x4bad08];return _0x4cc71e;};'use strict';var client=require(_0x54b4('0x0'));exports[_0x54b4('0x1')]=function(){return function(){return client[_0x54b4('0x2')](_0x54b4('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x54b4('0x4'),'strategy'],'include':[{'model':_0x54b4('0x5'),'as':_0x54b4('0x6'),'attributes':['id','name',_0x54b4('0x7'),_0x54b4('0x8')]}]},'log':_0x54b4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 0c4016a..7a85fa7 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 _0x951e=['DESC','../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x4cf77b,_0x2b7491){var _0x1d1bee=function(_0x29779a){while(--_0x29779a){_0x4cf77b['push'](_0x4cf77b['shift']());}};_0x1d1bee(++_0x2b7491);}(_0x951e,0xa9));var _0xe951=function(_0x7f66,_0x16f2ae){_0x7f66=_0x7f66-0x0;var _0x478705=_0x951e[_0x7f66];return _0x478705;};'use strict';var client=require(_0xe951('0x0'));exports['create']=function(_0x5a634e){return client[_0xe951('0x1')](_0xe951('0x2'),{'body':_0x5a634e,'log':_0xe951('0x2')});};exports[_0xe951('0x3')]=function(_0x58ec22,_0x1c3831){return client[_0xe951('0x1')](_0xe951('0x4'),{'body':_0x1c3831,'options':{'where':{'uniqueid':_0x58ec22},'order':[['id',_0xe951('0x5')]],'limit':0x1},'log':_0xe951('0x4')});}; \ No newline at end of file +var _0x1b07=['update','DESC','UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0xbac196,_0x1c6862){var _0x8fbacf=function(_0x22ce6a){while(--_0x22ce6a){_0xbac196['push'](_0xbac196['shift']());}};_0x8fbacf(++_0x1c6862);}(_0x1b07,0x81));var _0x71b0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x1b07[_0x160c73];return _0xd9302;};'use strict';var client=require('../client');exports[_0x71b0('0x0')]=function(_0x4b7936){return client[_0x71b0('0x1')]('CreateMailQueueReport',{'body':_0x4b7936,'log':_0x71b0('0x2')});};exports[_0x71b0('0x3')]=function(_0x10ee34,_0x326e7c){return client[_0x71b0('0x1')]('UpdateMailQueueReport',{'body':_0x326e7c,'options':{'where':{'uniqueid':_0x10ee34},'order':[['id',_0x71b0('0x4')]],'limit':0x1},'log':_0x71b0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 0f7ab8c..9a3da04 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 _0xee6d=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee6d,0x186));var _0xdee6=function(_0x5474b4,_0x5027aa){_0x5474b4=_0x5474b4-0x0;var _0x33a0b5=_0xee6d[_0x5474b4];return _0x33a0b5;};'use strict';var client=require(_0xdee6('0x0'));exports[_0xdee6('0x1')]=function(_0x27a791,_0x344c75){return client[_0xdee6('0x2')](_0xdee6('0x3'),{'body':_0x344c75,'options':{'where':{'id':_0x27a791}},'log':_0xdee6('0x4')});};exports['addTags']=function(_0x2efbb7,_0x4b42f4){return client[_0xdee6('0x2')](_0xdee6('0x5'),{'body':_0x4b42f4,'options':{'where':{'id':_0x2efbb7}},'log':_0xdee6('0x6')});}; \ No newline at end of file +var _0x7e44=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x187dcb,_0x2f3d32){var _0x27f48b=function(_0x4451ad){while(--_0x4451ad){_0x187dcb['push'](_0x187dcb['shift']());}};_0x27f48b(++_0x2f3d32);}(_0x7e44,0x195));var _0x47e4=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x7e44[_0x1bd323];return _0x13097b;};'use strict';var client=require(_0x47e4('0x0'));exports[_0x47e4('0x1')]=function(_0x482ab1,_0x3f8ea0){return client['Request'](_0x47e4('0x2'),{'body':_0x3f8ea0,'options':{'where':{'id':_0x482ab1}},'log':_0x47e4('0x3')});};exports['addTags']=function(_0x5b3e17,_0x4ffdb7){return client[_0x47e4('0x4')](_0x47e4('0x5'),{'body':_0x4ffdb7,'options':{'where':{'id':_0x5b3e17}},'log':_0x47e4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2c0495d..e559e93 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 _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x3f2cc8,_0x1db3a4){var _0x4a16bb=function(_0x366d5a){while(--_0x366d5a){_0x3f2cc8['push'](_0x3f2cc8['shift']());}};_0x4a16bb(++_0x1db3a4);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xbdb7[_0x2601b4];return _0x3e3661;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'body':_0x44467d,'log':_0x7bdb('0x4')});}; \ No newline at end of file +var _0xcb91=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x1be8c8,_0x5073bc){var _0x4e3f7b=function(_0x231986){while(--_0x231986){_0x1be8c8['push'](_0x1be8c8['shift']());}};_0x4e3f7b(++_0x5073bc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xcb91[_0x34d275];return _0x1379cc;};'use strict';var client=require('../client');exports['create']=function(_0x26fe42){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'body':_0x26fe42,'log':_0x1cb9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 38cae51..745794b 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 _0x960d=['Agents','online','openchannelPause','../client','getOpenchannelQueues','name','strategy','User'];(function(_0x30b6cb,_0x832e62){var _0x4455a1=function(_0xd3aaab){while(--_0xd3aaab){_0x30b6cb['push'](_0x30b6cb['shift']());}};_0x4455a1(++_0x832e62);}(_0x960d,0xfb));var _0xd960=function(_0x449623,_0x3dd8a7){_0x449623=_0x449623-0x0;var _0x1ee95f=_0x960d[_0x449623];return _0x1ee95f;};'use strict';var client=require(_0xd960('0x0'));exports[_0xd960('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xd960('0x2'),'timeout',_0xd960('0x3')],'include':[{'model':_0xd960('0x4'),'as':_0xd960('0x5'),'attributes':['id',_0xd960('0x2'),_0xd960('0x6'),_0xd960('0x7')]}]},'log':_0xd960('0x1')});};}; \ No newline at end of file +var _0xeda5=['name','online','openchannelPause','../client','Request','GetOpenchannelQueue','User','Agents'];(function(_0x2c37e8,_0x171014){var _0x541c80=function(_0x5d7260){while(--_0x5d7260){_0x2c37e8['push'](_0x2c37e8['shift']());}};_0x541c80(++_0x171014);}(_0xeda5,0x123));var _0x5eda=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeda5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5eda('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x5eda('0x1')](_0x5eda('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x5eda('0x3'),'as':_0x5eda('0x4'),'attributes':['id',_0x5eda('0x5'),_0x5eda('0x6'),_0x5eda('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a732d74..ac59abe 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 _0x3ee8=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','../client','create'];(function(_0x3e837c,_0x5f4036){var _0x5b406f=function(_0xd76956){while(--_0xd76956){_0x3e837c['push'](_0x3e837c['shift']());}};_0x5b406f(++_0x5f4036);}(_0x3ee8,0x178));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x83ee('0x0'));exports[_0x83ee('0x1')]=function(_0x4ac038){return client['Request'](_0x83ee('0x2'),{'body':_0x4ac038,'log':_0x83ee('0x2')});};exports[_0x83ee('0x3')]=function(_0x5cd61f,_0x43ecc5){return client[_0x83ee('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x43ecc5,'options':{'where':{'uniqueid':_0x5cd61f},'order':[['id','DESC']],'limit':0x1},'log':_0x83ee('0x5')});}; \ No newline at end of file +var _0x677e=['../client','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x171ca9,_0x2bb32d){var _0x31668f=function(_0x437a37){while(--_0x437a37){_0x171ca9['push'](_0x171ca9['shift']());}};_0x31668f(++_0x2bb32d);}(_0x677e,0x1d4));var _0xe677=function(_0xbb6c6b,_0x38a86c){_0xbb6c6b=_0xbb6c6b-0x0;var _0x9ca7de=_0x677e[_0xbb6c6b];return _0x9ca7de;};'use strict';var client=require(_0xe677('0x0'));exports['create']=function(_0x2a8af4){return client[_0xe677('0x1')](_0xe677('0x2'),{'body':_0x2a8af4,'log':_0xe677('0x2')});};exports['update']=function(_0x197d55,_0xde9539){return client[_0xe677('0x1')](_0xe677('0x3'),{'body':_0xde9539,'options':{'where':{'uniqueid':_0x197d55},'order':[['id','DESC']],'limit':0x1},'log':_0xe677('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bf6fb9c..15e4733 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 _0x9ad7=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client'];(function(_0x233c64,_0x2da2c1){var _0x331f8d=function(_0x445ec1){while(--_0x445ec1){_0x233c64['push'](_0x233c64['shift']());}};_0x331f8d(++_0x2da2c1);}(_0x9ad7,0x84));var _0x79ad=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9ad7[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x79ad('0x0'));exports[_0x79ad('0x1')]=function(_0x2cf92d,_0x55cbbc){return client[_0x79ad('0x2')](_0x79ad('0x3'),{'body':_0x55cbbc,'options':{'where':{'id':_0x2cf92d}},'log':_0x79ad('0x4')});};exports[_0x79ad('0x5')]=function(_0x427730,_0x3b2692){return client[_0x79ad('0x2')](_0x79ad('0x6'),{'body':_0x3b2692,'options':{'where':{'id':_0x427730}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xb0df=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x2a2c7f,_0x50a1d3){var _0x488e8a=function(_0x28bae2){while(--_0x28bae2){_0x2a2c7f['push'](_0x2a2c7f['shift']());}};_0x488e8a(++_0x50a1d3);}(_0xb0df,0x85));var _0xfb0d=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xb0df[_0x413b4d];return _0x8b810a;};'use strict';var client=require('../client');exports[_0xfb0d('0x0')]=function(_0x24ab11,_0x392e80){return client[_0xfb0d('0x1')](_0xfb0d('0x2'),{'body':_0x392e80,'options':{'where':{'id':_0x24ab11}},'log':_0xfb0d('0x3')});};exports[_0xfb0d('0x4')]=function(_0x823ea6,_0x3348e0){return client['Request'](_0xfb0d('0x5'),{'body':_0x3348e0,'options':{'where':{'id':_0x823ea6}},'log':_0xfb0d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index daab829..223aec2 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 _0xc992=['createSmsMessage','../client','Request'];(function(_0x5cd1a4,_0xfc6df){var _0x8eba7f=function(_0x2e4061){while(--_0x2e4061){_0x5cd1a4['push'](_0x5cd1a4['shift']());}};_0x8eba7f(++_0xfc6df);}(_0xc992,0xbb));var _0x2c99=function(_0x576ebb,_0x142be8){_0x576ebb=_0x576ebb-0x0;var _0x87048=_0xc992[_0x576ebb];return _0x87048;};'use strict';var client=require(_0x2c99('0x0'));exports['create']=function(_0x37d606){return client[_0x2c99('0x1')]('CreateSmsMessage',{'body':_0x37d606,'log':_0x2c99('0x2')});}; \ No newline at end of file +var _0xcd13=['createSmsMessage','create','Request'];(function(_0x34fc26,_0x5db892){var _0x3e6117=function(_0x527e78){while(--_0x527e78){_0x34fc26['push'](_0x34fc26['shift']());}};_0x3e6117(++_0x5db892);}(_0xcd13,0xbe));var _0x3cd1=function(_0x6f7ef,_0x50eedb){_0x6f7ef=_0x6f7ef-0x0;var _0x5a3908=_0xcd13[_0x6f7ef];return _0x5a3908;};'use strict';var client=require('../client');exports[_0x3cd1('0x0')]=function(_0x5bb7a0){return client[_0x3cd1('0x1')]('CreateSmsMessage',{'body':_0x5bb7a0,'log':_0x3cd1('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 29d0cf9..5b06e29 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 _0x86c4=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User','Agents','online','../client'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x86c4,0x17b));var _0x486c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86c4[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x486c('0x0'));exports[_0x486c('0x1')]=function(){return function(){return client[_0x486c('0x2')](_0x486c('0x3'),{'options':{'raw':![],'attributes':['id',_0x486c('0x4'),_0x486c('0x5'),_0x486c('0x6')],'include':[{'model':_0x486c('0x7'),'as':_0x486c('0x8'),'attributes':['id',_0x486c('0x4'),_0x486c('0x9'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0e6a=['name','timeout','strategy','User','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue'];(function(_0x2c9c87,_0xe5500f){var _0x42088e=function(_0x415663){while(--_0x415663){_0x2c9c87['push'](_0x2c9c87['shift']());}};_0x42088e(++_0xe5500f);}(_0x0e6a,0xd8));var _0xa0e6=function(_0x32504a,_0x475539){_0x32504a=_0x32504a-0x0;var _0x536848=_0x0e6a[_0x32504a];return _0x536848;};'use strict';var client=require(_0xa0e6('0x0'));exports[_0xa0e6('0x1')]=function(){return function(){return client[_0xa0e6('0x2')](_0xa0e6('0x3'),{'options':{'raw':![],'attributes':['id',_0xa0e6('0x4'),_0xa0e6('0x5'),_0xa0e6('0x6')],'include':[{'model':_0xa0e6('0x7'),'as':'Agents','attributes':['id',_0xa0e6('0x4'),_0xa0e6('0x8'),_0xa0e6('0x9')]}]},'log':_0xa0e6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index febb9cd..a3c4eaa 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 _0x779d=['../client','Request','CreateSmsQueueReport','update','DESC','UpdateSmsQueueReport'];(function(_0x52a250,_0x219324){var _0x32290e=function(_0x42db4b){while(--_0x42db4b){_0x52a250['push'](_0x52a250['shift']());}};_0x32290e(++_0x219324);}(_0x779d,0x1c2));var _0xd779=function(_0x21c65e,_0xa19a77){_0x21c65e=_0x21c65e-0x0;var _0x5c4599=_0x779d[_0x21c65e];return _0x5c4599;};'use strict';var client=require(_0xd779('0x0'));exports['create']=function(_0x380dec){return client[_0xd779('0x1')](_0xd779('0x2'),{'body':_0x380dec,'log':_0xd779('0x2')});};exports[_0xd779('0x3')]=function(_0x32bec9,_0x318f81){return client['Request']('UpdateSmsQueueReport',{'body':_0x318f81,'options':{'where':{'uniqueid':_0x32bec9},'order':[['id',_0xd779('0x4')]],'limit':0x1},'log':_0xd779('0x5')});}; \ No newline at end of file +var _0x49f8=['../client','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x33eee8,_0x480447){var _0x118452=function(_0xa95e33){while(--_0xa95e33){_0x33eee8['push'](_0x33eee8['shift']());}};_0x118452(++_0x480447);}(_0x49f8,0xff));var _0x849f=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0x49f8[_0x2bc2a2];return _0x20de67;};'use strict';var client=require(_0x849f('0x0'));exports['create']=function(_0x4e6a9f){return client[_0x849f('0x1')](_0x849f('0x2'),{'body':_0x4e6a9f,'log':'CreateSmsQueueReport'});};exports[_0x849f('0x3')]=function(_0x5bd156,_0xdf19d3){return client['Request'](_0x849f('0x4'),{'body':_0xdf19d3,'options':{'where':{'uniqueid':_0x5bd156},'order':[['id','DESC']],'limit':0x1},'log':_0x849f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 037703b..c37240a 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 _0x75bf=['name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser'];(function(_0x332012,_0x16cfa1){var _0x169a9c=function(_0x840696){while(--_0x840696){_0x332012['push'](_0x332012['shift']());}};_0x169a9c(++_0x16cfa1);}(_0x75bf,0x119));var _0xf75b=function(_0xabae44,_0x3105e0){_0xabae44=_0xabae44-0x0;var _0x24cea2=_0x75bf[_0xabae44];return _0x24cea2;};'use strict';var client=require(_0xf75b('0x0'));exports[_0xf75b('0x1')]=function(){return function(){return client[_0xf75b('0x2')](_0xf75b('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xf75b('0x4'),_0xf75b('0x5'),_0xf75b('0x6'),_0xf75b('0x7'),_0xf75b('0x8'),_0xf75b('0x9'),_0xf75b('0xa'),'faxPause',_0xf75b('0xb'),_0xf75b('0xc'),_0xf75b('0xd'),'chatCapacity',_0xf75b('0xe'),_0xf75b('0xf'),_0xf75b('0x10'),_0xf75b('0x11'),_0xf75b('0x12')]},'log':_0xf75b('0x1')});};}; \ No newline at end of file +var _0xb4ee=['faxPause','openchannelPause','whatsappCapacity','openchannelCapacity','getAgents','../client','Request','GetUser','online','pauseType','lastPauseAt','chatPause','mailPause'];(function(_0x4d0740,_0x554ca0){var _0x1854cb=function(_0x1fcd27){while(--_0x1fcd27){_0x4d0740['push'](_0x4d0740['shift']());}};_0x1854cb(++_0x554ca0);}(_0xb4ee,0x87));var _0xeb4e=function(_0x460d3b,_0x299dca){_0x460d3b=_0x460d3b-0x0;var _0xc0970d=_0xb4ee[_0x460d3b];return _0xc0970d;};'use strict';var client=require(_0xeb4e('0x0'));exports['getAgents']=function(){return function(){return client[_0xeb4e('0x1')](_0xeb4e('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name',_0xeb4e('0x3'),_0xeb4e('0x4'),_0xeb4e('0x5'),'voicePause',_0xeb4e('0x6'),_0xeb4e('0x7'),_0xeb4e('0x8'),'smsPause','whatsappPause',_0xeb4e('0x9'),'chatCapacity','mailCapacity','faxCapacity','smsCapacity',_0xeb4e('0xa'),_0xeb4e('0xb')]},'log':_0xeb4e('0xc')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 07fb06d..359ff33 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 _0x279d=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x279d,0x1d8));var _0xd279=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x279d[_0x39096d];return _0x13da4f;};'use strict';var client=require(_0xd279('0x0'));exports[_0xd279('0x1')]=function(_0x17cebd,_0x368457){return client['Request']('UpdateWhatsappInteraction',{'body':_0x368457,'options':{'where':{'id':_0x17cebd}},'log':_0xd279('0x2')});};exports[_0xd279('0x3')]=function(_0x47cfee,_0x15d034){return client[_0xd279('0x4')](_0xd279('0x5'),{'body':_0x15d034,'options':{'where':{'id':_0x47cfee}},'log':_0xd279('0x6')});}; \ No newline at end of file +var _0x2285=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x1d60b3,_0x65a805){var _0x2c5d8c=function(_0x4a252f){while(--_0x4a252f){_0x1d60b3['push'](_0x1d60b3['shift']());}};_0x2c5d8c(++_0x65a805);}(_0x2285,0x177));var _0x5228=function(_0x8dc2f5,_0x4c2245){_0x8dc2f5=_0x8dc2f5-0x0;var _0x4ca261=_0x2285[_0x8dc2f5];return _0x4ca261;};'use strict';var client=require('../client');exports[_0x5228('0x0')]=function(_0x251c75,_0x725912){return client[_0x5228('0x1')](_0x5228('0x2'),{'body':_0x725912,'options':{'where':{'id':_0x251c75}},'log':'updateWhatsappInteraction'});};exports[_0x5228('0x3')]=function(_0x527cb3,_0x5bf024){return client[_0x5228('0x1')](_0x5228('0x4'),{'body':_0x5bf024,'options':{'where':{'id':_0x527cb3}},'log':_0x5228('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 9e62ec1..975b410 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 _0xa708=['Request','CreateWhatsappMessage','../client','create'];(function(_0x470a4a,_0x1b674d){var _0x38504c=function(_0x139e55){while(--_0x139e55){_0x470a4a['push'](_0x470a4a['shift']());}};_0x38504c(++_0x1b674d);}(_0xa708,0xba));var _0x8a70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa708[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8a70('0x0'));exports[_0x8a70('0x1')]=function(_0x5c780d){return client[_0x8a70('0x2')](_0x8a70('0x3'),{'body':_0x5c780d,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x7e84=['CreateWhatsappMessage','../client'];(function(_0x4846d9,_0x4cb5ca){var _0x1e2576=function(_0x257591){while(--_0x257591){_0x4846d9['push'](_0x4846d9['shift']());}};_0x1e2576(++_0x4cb5ca);}(_0x7e84,0xcb));var _0x47e8=function(_0x89695f,_0x35473b){_0x89695f=_0x89695f-0x0;var _0x554166=_0x7e84[_0x89695f];return _0x554166;};'use strict';var client=require(_0x47e8('0x0'));exports['create']=function(_0x3e2c27){return client['Request'](_0x47e8('0x1'),{'body':_0x3e2c27,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 22c0eda..f6b4db2 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 _0x6cb4=['timeout','strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cb4,0xff));var _0x46cb=function(_0x48e71f,_0x4f2493){_0x48e71f=_0x48e71f-0x0;var _0x483ca4=_0x6cb4[_0x48e71f];return _0x483ca4;};'use strict';var client=require(_0x46cb('0x0'));exports[_0x46cb('0x1')]=function(){return function(){return client[_0x46cb('0x2')](_0x46cb('0x3'),{'options':{'raw':![],'attributes':['id',_0x46cb('0x4'),_0x46cb('0x5'),_0x46cb('0x6')],'include':[{'model':_0x46cb('0x7'),'as':_0x46cb('0x8'),'attributes':['id','name',_0x46cb('0x9'),'whatsappPause']}]},'log':_0x46cb('0x1')});};}; \ No newline at end of file +var _0x44a3=['timeout','strategy','User','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x44a3,0x1a9));var _0x344a=function(_0x2f1d2f,_0x527d85){_0x2f1d2f=_0x2f1d2f-0x0;var _0x2874cf=_0x44a3[_0x2f1d2f];return _0x2874cf;};'use strict';var client=require(_0x344a('0x0'));exports[_0x344a('0x1')]=function(){return function(){return client[_0x344a('0x2')](_0x344a('0x3'),{'options':{'raw':![],'attributes':['id',_0x344a('0x4'),_0x344a('0x5'),_0x344a('0x6')],'include':[{'model':_0x344a('0x7'),'as':'Agents','attributes':['id',_0x344a('0x4'),_0x344a('0x8'),_0x344a('0x9')]}]},'log':_0x344a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 7eab72a..03adf21 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 _0x312f=['DESC','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x312f,0x85));var _0xf312=function(_0x3d616d,_0x15f9de){_0x3d616d=_0x3d616d-0x0;var _0x324082=_0x312f[_0x3d616d];return _0x324082;};'use strict';var client=require('../client');exports[_0xf312('0x0')]=function(_0x26f8bd){return client[_0xf312('0x1')](_0xf312('0x2'),{'body':_0x26f8bd,'log':'CreateWhatsappQueueReport'});};exports[_0xf312('0x3')]=function(_0x7a5ca2,_0xa26c49){return client['Request'](_0xf312('0x4'),{'body':_0xa26c49,'options':{'where':{'uniqueid':_0x7a5ca2},'order':[['id',_0xf312('0x5')]],'limit':0x1},'log':_0xf312('0x4')});}; \ No newline at end of file +var _0xa3d1=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa3d1,0x6c));var _0x1a3d=function(_0x46b5b6,_0x531dfd){_0x46b5b6=_0x46b5b6-0x0;var _0x2eed89=_0xa3d1[_0x46b5b6];return _0x2eed89;};'use strict';var client=require(_0x1a3d('0x0'));exports[_0x1a3d('0x1')]=function(_0x31266e){return client[_0x1a3d('0x2')](_0x1a3d('0x3'),{'body':_0x31266e,'log':'CreateWhatsappQueueReport'});};exports[_0x1a3d('0x4')]=function(_0x24cbe4,_0x5aa456){return client['Request'](_0x1a3d('0x5'),{'body':_0x5aa456,'options':{'where':{'uniqueid':_0x24cbe4},'order':[['id',_0x1a3d('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 1bcadf1..1ba7351 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 _0xbef9=['toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name'];(function(_0x41c4c8,_0x28de17){var _0x56c4e4=function(_0x17290e){while(--_0x17290e){_0x41c4c8['push'](_0x41c4c8['shift']());}};_0x56c4e4(++_0x28de17);}(_0xbef9,0xff));var _0x9bef=function(_0x1d4f79,_0x4d2aca){_0x1d4f79=_0x1d4f79-0x0;var _0x382ed5=_0xbef9[_0x1d4f79];return _0x382ed5;};'use strict';var schema=require('validate');var _=require(_0x9bef('0x0'));var util=require(_0x9bef('0x1'));var seqqueue=require(_0x9bef('0x2'));var logger=require(_0x9bef('0x3'))(_0x9bef('0x4'));var strategy=require(_0x9bef('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x9bef('0x6')},'timeout':{'type':'number','message':_0x9bef('0x7')}});function writeLog(_0x1a8173,_0x3a6b88,_0x36e5db){return logger[_0x9bef('0x8')](util[_0x9bef('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1a8173,_0x3a6b88[_0x9bef('0xa')],_0x36e5db));}function handleFindAgent(_0x37b41c){return function(_0x55c7ff){return _0x55c7ff[_0x9bef('0xa')][_0x9bef('0xb')]()===_0x37b41c['toLowerCase']();};}exports[_0x9bef('0xc')]=function(_0x49e467,_0x894b9,_0x3200ce,_0x55e082){return function(_0x20bc79){try{var _0x35c46c={'name':_0x894b9[0x0],'timeout':_0x894b9[0x1]};var _0x416640=queue[_0x9bef('0xd')](_0x35c46c,{'typecast':!![]});if(_0x416640[_0x9bef('0xe')]){logger[_0x9bef('0xf')](_0x9bef('0x10'),_0x49e467,_[_0x9bef('0x11')](_0x416640,_0x9bef('0x12'))[_0x9bef('0x13')](',\x20'));_0x20bc79[_0x9bef('0x14')]();}else{var _0x515d84=_['find'](_0x3200ce[_0x9bef('0x15')],handleFindAgent(_0x35c46c[_0x9bef('0xa')]));if(_0x515d84){var _0x150a52=(_0x35c46c[_0x9bef('0x16')]||0xa)*0x3e8;var _0x1c795d,_0x2dfda0;var _0x484a4a=seqqueue[_0x9bef('0x17')](_0x150a52);_0x484a4a['id']=_0x49e467;_0x484a4a[_0x9bef('0x18')]=_0x150a52;_0x484a4a[_0x9bef('0x19')]=_0x55e082[_0x9bef('0x19')];writeLog(_0x49e467,_0x515d84,util['format'](_0x9bef('0x1a'),_0x150a52));_0x3200ce[_0x9bef('0x1b')][_0x49e467]['on'](_0x9bef('0x1c'),function(){logger[_0x9bef('0x8')](_0x9bef('0x1d'),_0x49e467);clearTimeout(_0x2dfda0);_0x2dfda0=undefined;_0x484a4a['close']();if(_0x3200ce['rules'][_0x49e467]){delete _0x3200ce[_0x9bef('0x1b')][_0x49e467];}_0x20bc79['stop']();});_0x3200ce[_0x9bef('0x1b')][_0x49e467]['on'](_0x9bef('0x1e'),function(){if(_0x3200ce[_0x9bef('0x1b')][_0x49e467]){delete _0x3200ce['rules'][_0x49e467];}});_0x2dfda0=setTimeout(function(){logger['info'](_0x9bef('0x1f'),_0x49e467);clearTimeout(_0x2dfda0);_0x484a4a[_0x9bef('0x20')]();_0x20bc79[_0x9bef('0x21')]();},_0x150a52);strategy['agent'](_0x484a4a,_0x515d84,_0x3200ce,_0x55e082);}else{logger['error'](_0x9bef('0x22'),_0x49e467,_0x35c46c[_0x9bef('0xa')]);_0x20bc79[_0x9bef('0x14')]();}}}catch(_0x51db40){console[_0x9bef('0x23')](_0x51db40);logger[_0x9bef('0xf')](_0x9bef('0x24'),_0x49e467,_0x51db40[_0x9bef('0x25')]);_0x20bc79[_0x9bef('0x14')]();}};}; \ No newline at end of file +var _0x58e2=['rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','number','info','format','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','atimeout','channel','START:%s'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x58e2,0x111));var _0x258e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x58e2[_0xbd08b4];return _0x314f1e;};'use strict';var schema=require(_0x258e('0x0'));var _=require(_0x258e('0x1'));var util=require(_0x258e('0x2'));var seqqueue=require(_0x258e('0x3'));var logger=require(_0x258e('0x4'))('routing');var strategy=require(_0x258e('0x5'));var queue=schema({'name':{'type':_0x258e('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x258e('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x307970,_0x4bc5d4,_0x113dc8){return logger[_0x258e('0x8')](util[_0x258e('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x307970,_0x4bc5d4[_0x258e('0xa')],_0x113dc8));}function handleFindAgent(_0x3ab72b){return function(_0x4e9bbe){return _0x4e9bbe[_0x258e('0xa')][_0x258e('0xb')]()===_0x3ab72b['toLowerCase']();};}exports['consequence']=function(_0x340b4d,_0x1616ee,_0x4f99f5,_0x4b48f2){return function(_0xb545d3){try{var _0x1f737b={'name':_0x1616ee[0x0],'timeout':_0x1616ee[0x1]};var _0x126444=queue[_0x258e('0x0')](_0x1f737b,{'typecast':!![]});if(_0x126444[_0x258e('0xc')]){logger[_0x258e('0xd')](_0x258e('0xe'),_0x340b4d,_[_0x258e('0xf')](_0x126444,_0x258e('0x10'))[_0x258e('0x11')](',\x20'));_0xb545d3[_0x258e('0x12')]();}else{var _0x45c5a3=_['find'](_0x4f99f5[_0x258e('0x13')],handleFindAgent(_0x1f737b[_0x258e('0xa')]));if(_0x45c5a3){var _0x27da26=(_0x1f737b[_0x258e('0x14')]||0xa)*0x3e8;var _0x1b8de1,_0x1c5a2d;var _0x24bf75=seqqueue['createQueue'](_0x27da26);_0x24bf75['id']=_0x340b4d;_0x24bf75[_0x258e('0x15')]=_0x27da26;_0x24bf75['channel']=_0x4b48f2[_0x258e('0x16')];writeLog(_0x340b4d,_0x45c5a3,util[_0x258e('0x9')](_0x258e('0x17'),_0x27da26));_0x4f99f5[_0x258e('0x18')][_0x340b4d]['on'](_0x258e('0x19'),function(){logger[_0x258e('0x8')](_0x258e('0x1a'),_0x340b4d);clearTimeout(_0x1c5a2d);_0x1c5a2d=undefined;_0x24bf75[_0x258e('0x1b')]();if(_0x4f99f5[_0x258e('0x18')][_0x340b4d]){delete _0x4f99f5['rules'][_0x340b4d];}_0xb545d3[_0x258e('0x12')]();});_0x4f99f5[_0x258e('0x18')][_0x340b4d]['on'](_0x258e('0x1c'),function(){if(_0x4f99f5[_0x258e('0x18')][_0x340b4d]){delete _0x4f99f5[_0x258e('0x18')][_0x340b4d];}});_0x1c5a2d=setTimeout(function(){logger['info'](_0x258e('0x1d'),_0x340b4d);clearTimeout(_0x1c5a2d);_0x24bf75[_0x258e('0x1b')]();_0xb545d3[_0x258e('0x1e')]();},_0x27da26);strategy['agent'](_0x24bf75,_0x45c5a3,_0x4f99f5,_0x4b48f2);}else{logger['error'](_0x258e('0x1f'),_0x340b4d,_0x1f737b[_0x258e('0xa')]);_0xb545d3[_0x258e('0x12')]();}}}catch(_0x173e2c){console['log'](_0x173e2c);logger[_0x258e('0xd')]('[%s][QUEUE]\x20%s',_0x340b4d,_0x173e2c[_0x258e('0x20')]);_0xb545d3['stop']();}};}; \ 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 0c78f36..8492bf8 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 _0x4819=['created','isEmpty','getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s','body','catch','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','error','next','create','dialogState','Failed','stringify','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId'];(function(_0x2348bd,_0x4eba3f){var _0x2049ca=function(_0xb2a64c){while(--_0xb2a64c){_0x2348bd['push'](_0x2348bd['shift']());}};_0x2049ca(++_0x4eba3f);}(_0x4819,0xcd));var _0x9481=function(_0x860520,_0x20520a){_0x860520=_0x860520-0x0;var _0x22ce80=_0x4819[_0x860520];return _0x22ce80;};'use strict';var _=require('lodash');var moment=require(_0x9481('0x0'));var AWS=require(_0x9481('0x1'));var utils=require(_0x9481('0x2'));var logger=require(_0x9481('0x3'))(_0x9481('0x4'));var rpc={'chatMessage':require(_0x9481('0x5')),'openchannelMessage':require(_0x9481('0x6')),'mailMessage':require(_0x9481('0x7')),'smsMessage':require(_0x9481('0x8')),'faxMessage':require(_0x9481('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return function(_0x14e05a){try{if(!_[_0x9481('0xb')](this[_0x9481('0xc')][_0x9481('0xd')])){logger[_0x9481('0xe')]('[%s][AMAZONLEX]\x20%s',_0x5def07,_0x9481('0xf'));return _0x14e05a['next']();}var _0x2fabf1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9481('0x10')](_0x9481('0x11')),'direction':_0x9481('0x12')};var _0x3ffe85=this[_0x9481('0x13')];if(_0x3ffe85===_0x9481('0x14')){_0x2fabf1[_0x9481('0x15')]=this[_0x9481('0x16')]['id'];}else{_0x2fabf1[_[_0x9481('0x17')](_0x3ffe85)+'AccountId']=this['account']['id'];}_0x2fabf1[_[_0x9481('0x17')](_0x3ffe85)+_0x9481('0x18')]=this[_0x9481('0xc')]['id'];if(this[_0x9481('0xc')][_0x9481('0x19')]){var _0xc7a0b5=_0x54cc78[0x4];if(!_[_0x9481('0x1a')](_0xc7a0b5)){_0x2fabf1['body']=utils[_0x9481('0x1b')](_0xc7a0b5,this);return rpc[_0x3ffe85+_0x9481('0x1c')]['create'](_0x2fabf1)[_0x9481('0x1d')](function(_0x518150){logger[_0x9481('0xe')](_0x9481('0x1e'),_0x5def07,_0x2fabf1[_0x9481('0x1f')]);})[_0x9481('0x20')](function(_0x546fce){logger['error'](_0x9481('0x1e'),_0x5def07,JSON['stringify'](_0x546fce));})['finally'](function(){logger[_0x9481('0xe')](_0x9481('0x21'),_0x5def07);_0x14e05a[_0x9481('0x22')]();});}else{logger[_0x9481('0xe')](_0x9481('0x23'),_0x5def07);_0x14e05a[_0x9481('0x22')]();}}else{var _0x55a1bd=this;var _0x2cf1aa=new AWS[(_0x9481('0x24'))]({'accessKeyId':_0x54cc78[0x0],'secretAccessKey':_0x54cc78[0x1],'region':_0x54cc78[0x2]});var _0x45f9df={'botAlias':_0x9481('0x25'),'botName':_0x54cc78[0x3],'inputText':this[_0x9481('0x26')]['body'],'userId':this[_0x9481('0x13')]+':'+this[_0x9481('0xc')]['id']['toString']()};_0x2cf1aa[_0x9481('0x27')](_0x45f9df,function(_0xd1cd1a,_0x352b3a){if(_0xd1cd1a){logger[_0x9481('0x28')](_0x9481('0x1e'),_0x5def07,_0xd1cd1a['message']);_0x14e05a[_0x9481('0x29')]();}else if(_0x352b3a&&_0x352b3a[_0x9481('0x26')]){_0x55a1bd['body']['amazonlex']=_0x352b3a;_0x2fabf1[_0x9481('0x1f')]=_0x352b3a[_0x9481('0x26')];return rpc[_0x3ffe85+'Message'][_0x9481('0x2a')](_0x2fabf1)[_0x9481('0x1d')](function(_0xeff0a5){logger[_0x9481('0xe')]('[%s][AMAZONLEX]\x20%s',_0x5def07,_0x2fabf1[_0x9481('0x1f')]);if(_0x352b3a[_0x9481('0x2b')]==_0x9481('0x2c')){_0x14e05a['next']();}else{_0x14e05a[_0x9481('0x22')]();}})['catch'](function(_0x2e1eff){logger[_0x9481('0x28')](_0x9481('0x1e'),_0x5def07,JSON[_0x9481('0x2d')](_0x2e1eff));_0x14e05a[_0x9481('0x29')]();});}else{_0x14e05a['next']();}});}}catch(_0x2aa9ff){logger[_0x9481('0x28')](_0x9481('0x1e'),_0x5def07,JSON['stringify'](_0x2aa9ff));_0x14e05a['stop']();}};}; \ No newline at end of file +var _0x524e=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','body','getMustacheRender','create','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','Message','then','dialogState','Failed','stop','catch','aws-sdk','./utils'];(function(_0x1f24e7,_0x23c3e3){var _0x5ecd97=function(_0x3826ea){while(--_0x3826ea){_0x1f24e7['push'](_0x1f24e7['shift']());}};_0x5ecd97(++_0x23c3e3);}(_0x524e,0x15e));var _0xe524=function(_0x15ee68,_0x4404af){_0x15ee68=_0x15ee68-0x0;var _0x1e9b36=_0x524e[_0x15ee68];return _0x1e9b36;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0xe524('0x0'));var utils=require(_0xe524('0x1'));var logger=require(_0xe524('0x2'))(_0xe524('0x3'));var rpc={'chatMessage':require(_0xe524('0x4')),'openchannelMessage':require(_0xe524('0x5')),'mailMessage':require(_0xe524('0x6')),'smsMessage':require(_0xe524('0x7')),'faxMessage':require(_0xe524('0x8')),'whatsappMessage':require(_0xe524('0x9'))};exports['consequence']=function(_0xaaeaa9,_0x41e1a3){return function(_0x347bed){try{if(!_['isNil'](this[_0xe524('0xa')][_0xe524('0xb')])){logger[_0xe524('0xc')](_0xe524('0xd'),_0xaaeaa9,_0xe524('0xe'));return _0x347bed[_0xe524('0xf')]();}var _0x1a08e2={'ContactId':this[_0xe524('0x10')]['id'],'sentAt':moment()[_0xe524('0x11')](_0xe524('0x12')),'direction':_0xe524('0x13')};var _0x2b6cbd=this[_0xe524('0x14')];if(_0x2b6cbd===_0xe524('0x15')){_0x1a08e2[_0xe524('0x16')]=this[_0xe524('0x17')]['id'];}else{_0x1a08e2[_['upperFirst'](_0x2b6cbd)+'AccountId']=this[_0xe524('0x17')]['id'];}_0x1a08e2[_[_0xe524('0x18')](_0x2b6cbd)+_0xe524('0x19')]=this[_0xe524('0xa')]['id'];if(this[_0xe524('0xa')]['created']){var _0x12ff75=_0x41e1a3[0x4];if(!_['isEmpty'](_0x12ff75)){_0x1a08e2[_0xe524('0x1a')]=utils[_0xe524('0x1b')](_0x12ff75,this);return rpc[_0x2b6cbd+'Message'][_0xe524('0x1c')](_0x1a08e2)['then'](function(_0x109795){logger['info'](_0xe524('0xd'),_0xaaeaa9,_0x1a08e2['body']);})['catch'](function(_0x5a5c0d){logger[_0xe524('0x1d')]('[%s][AMAZONLEX]\x20%s',_0xaaeaa9,JSON[_0xe524('0x1e')](_0x5a5c0d));})[_0xe524('0x1f')](function(){logger[_0xe524('0xc')](_0xe524('0x20'),_0xaaeaa9);_0x347bed['stop']();});}else{logger[_0xe524('0xc')](_0xe524('0x21'),_0xaaeaa9);_0x347bed['stop']();}}else{var _0x467c2a=this;var _0x309f85=new AWS[(_0xe524('0x22'))]({'accessKeyId':_0x41e1a3[0x0],'secretAccessKey':_0x41e1a3[0x1],'region':_0x41e1a3[0x2]});var _0x1dcc0f={'botAlias':_0xe524('0x23'),'botName':_0x41e1a3[0x3],'inputText':this[_0xe524('0x24')][_0xe524('0x1a')],'userId':this[_0xe524('0x14')]+':'+this[_0xe524('0xa')]['id']['toString']()};_0x309f85[_0xe524('0x25')](_0x1dcc0f,function(_0x5bb00b,_0x577d1f){if(_0x5bb00b){logger[_0xe524('0x1d')](_0xe524('0xd'),_0xaaeaa9,_0x5bb00b[_0xe524('0x24')]);_0x347bed[_0xe524('0xf')]();}else if(_0x577d1f&&_0x577d1f['message']){_0x467c2a[_0xe524('0x1a')]['amazonlex']=_0x577d1f;_0x1a08e2[_0xe524('0x1a')]=_0x577d1f[_0xe524('0x24')];return rpc[_0x2b6cbd+_0xe524('0x26')][_0xe524('0x1c')](_0x1a08e2)[_0xe524('0x27')](function(_0xfd5965){logger[_0xe524('0xc')]('[%s][AMAZONLEX]\x20%s',_0xaaeaa9,_0x1a08e2['body']);if(_0x577d1f[_0xe524('0x28')]==_0xe524('0x29')){_0x347bed[_0xe524('0xf')]();}else{_0x347bed[_0xe524('0x2a')]();}})[_0xe524('0x2b')](function(_0x5405e4){logger['error'](_0xe524('0xd'),_0xaaeaa9,JSON[_0xe524('0x1e')](_0x5405e4));_0x347bed[_0xe524('0xf')]();});}else{_0x347bed[_0xe524('0xf')]();}});}}catch(_0x25c0a1){logger['error'](_0xe524('0xd'),_0xaaeaa9,JSON[_0xe524('0x1e')](_0x25c0a1));_0x347bed['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 57d9ce6..8ab2943 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 _0x6537=['create','[%s][AUTOREPLY]\x20%s','stringify','catch','error','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','format','out','message','from','subject','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','port','authentication','auth','pass','inReplyTo','messageId','html','','replace','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x266dfd,_0x415138){var _0x4d11f6=function(_0x138453){while(--_0x138453){_0x266dfd['push'](_0x266dfd['shift']());}};_0x4d11f6(++_0x415138);}(_0x6537,0x11a));var _0x7653=function(_0x3d78c7,_0x589804){_0x3d78c7=_0x3d78c7-0x0;var _0x18efae=_0x6537[_0x3d78c7];return _0x18efae;};'use strict';var _=require(_0x7653('0x0'));var moment=require(_0x7653('0x1'));var utils=require(_0x7653('0x2'));var logger=require(_0x7653('0x3'))(_0x7653('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7653('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7653('0x6')),'whatsappMessage':require(_0x7653('0x7'))};var mailRpc=require(_0x7653('0x8'));exports['consequence']=function(_0x2ed66a,_0xedd054){return function(_0x33ae60){try{if(_0xedd054[0x0]==='1'&&(_[_0x7653('0x9')](this[_0x7653('0xa')][_0x7653('0xb')])||!this['interaction']['created'])){logger[_0x7653('0xc')]('[%s][AUTOREPLY]\x20%s',_0x2ed66a,_0x7653('0xd'));return _0x33ae60[_0x7653('0xe')]();}var _0x4956f8=this[_0x7653('0xf')];var _0x46bf18={'body':utils[_0x7653('0x10')](_0xedd054[0x1],this),'ContactId':this[_0x7653('0x11')]['id'],'sentAt':moment()[_0x7653('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7653('0x13')};if(this[_0x7653('0x14')]){_0x46bf18['to']=this[_0x7653('0x14')][_0x7653('0x15')]||'';_0x46bf18['cc']=this[_0x7653('0x14')]['cc']||'';_0x46bf18['from']=this[_0x7653('0x14')]['to']||'';_0x46bf18['phone']=this['message']['phone']||'';_0x46bf18['read']=!![];if(this[_0x7653('0x14')]['subject']){_0x46bf18[_0x7653('0x16')]='';_0x46bf18['subject']+=_['startsWith'](this[_0x7653('0x14')][_0x7653('0x16')],'Re:')?'':'Re:\x20';_0x46bf18['subject']+=this[_0x7653('0x14')][_0x7653('0x16')];}}if(this[_0x7653('0xf')]===_0x7653('0x17')){_0x46bf18[_0x7653('0x18')]=this[_0x7653('0x19')]['id'];}else{_0x46bf18[_[_0x7653('0x1a')](this[_0x7653('0xf')])+_0x7653('0x1b')]=this['account']['id'];}_0x46bf18[_[_0x7653('0x1a')](this['channel'])+_0x7653('0x1c')]=this[_0x7653('0xa')]['id'];if(rpc[this['channel']+_0x7653('0x1d')]){if(this[_0x7653('0xf')]===_0x7653('0x1e')){var _0x2bfae4={'tls':{'rejectUnauthorized':![]}};if(this[_0x7653('0x19')][_0x7653('0x1f')][_0x7653('0x20')]){_0x2bfae4['service']=this['account'][_0x7653('0x1f')][_0x7653('0x20')];}else{_0x2bfae4['host']=this['account'][_0x7653('0x1f')]['host'];_0x2bfae4[_0x7653('0x21')]=this[_0x7653('0x19')][_0x7653('0x1f')]['port'];_0x2bfae4['secure']=this[_0x7653('0x19')][_0x7653('0x1f')]['secure'];}if(this[_0x7653('0x19')][_0x7653('0x1f')][_0x7653('0x22')]){_0x2bfae4[_0x7653('0x23')]={'user':this['account'][_0x7653('0x1f')]['user'],'pass':this[_0x7653('0x19')][_0x7653('0x1f')][_0x7653('0x24')]};}_0x46bf18[_0x7653('0x25')]=this['message'][_0x7653('0x26')];_0x46bf18[_0x7653('0x27')]=_0x7653('0x28')+_[_0x7653('0x29')](_0x46bf18[_0x7653('0x2a')],_0x7653('0x2b'),'','body','';return mailRpc[_0x7c11('0x30')](_0x676c10,_0x23effb)[_0x7c11('0x31')](function(_0x2f183b){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xc9bcac);_0x23effb[_0x7c11('0x2b')]=_0x2f183b[_0x7c11('0x14')]['messageId'];return rpc[_0x3b7fdc+_0x7c11('0x20')][_0x7c11('0x32')](_0x23effb);})[_0x7c11('0x31')](function(_0x1a509d){logger[_0x7c11('0xd')]('[%s][AUTOREPLY]\x20%s',_0xc9bcac,JSON[_0x7c11('0x33')](_0x1a509d));})['catch'](function(_0x1b0d2a){logger[_0x7c11('0x34')](_0x7c11('0x35'),_0xc9bcac,JSON[_0x7c11('0x33')](_0x1b0d2a));})[_0x7c11('0x36')](function(){_0x323423['next']();});}else{return rpc[this[_0x7c11('0xf')]+_0x7c11('0x20')]['create'](_0x23effb)[_0x7c11('0x31')](function(_0x14d7b0){logger[_0x7c11('0xd')](_0x7c11('0x37'),_0xc9bcac,_0x23effb[_0x7c11('0x2e')]);})[_0x7c11('0x38')](function(_0x609fdc){logger[_0x7c11('0x34')](_0x7c11('0x37'),_0xc9bcac,JSON['stringify'](_0x609fdc));})[_0x7c11('0x36')](function(){_0x323423[_0x7c11('0x39')]();});}}}catch(_0x1b9e71){logger[_0x7c11('0x34')]('[%s][AUTOREPLY]\x20%s',_0xc9bcac,JSON[_0x7c11('0x33')](_0x1b9e71));_0x323423[_0x7c11('0x3a')]();}};}; \ 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 b0cf773..9f0237e 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 _0x5a5a=['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','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update'];(function(_0x349076,_0x4a9454){var _0x45ddc9=function(_0x11665f){while(--_0x11665f){_0x349076['push'](_0x349076['shift']());}};_0x45ddc9(++_0x4a9454);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x1fdd70,_0x578685){_0x1fdd70=_0x1fdd70-0x0;var _0x951a7=_0x5a5a[_0x1fdd70];return _0x951a7;};'use strict';var moment=require('moment');var logger=require(_0xa5a5('0x0'))(_0xa5a5('0x1'));var rpc={'chatInteraction':require(_0xa5a5('0x2')),'openchannelInteraction':require(_0xa5a5('0x3')),'smsInteraction':require(_0xa5a5('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xa5a5('0x5')),'whatsappInteraction':require(_0xa5a5('0x6'))};exports[_0xa5a5('0x7')]=function(_0x4ad9b3,_0x4828f5,_0x43943d,_0x1fe96d){return function(_0x5691f1){try{logger[_0xa5a5('0x8')](_0xa5a5('0x9'),_0x4ad9b3,_0x4828f5[0x0]);var _0x1234c2={'closed':0x1,'closedAt':moment()[_0xa5a5('0xa')](_0xa5a5('0xb')),'closeReason':'system','disposition':_0x4828f5[0x0]};if(rpc[_0x1fe96d[_0xa5a5('0xc')]+_0xa5a5('0xd')]){rpc[_0x1fe96d[_0xa5a5('0xc')]+_0xa5a5('0xd')][_0xa5a5('0xe')](_0x1fe96d[_0xa5a5('0xf')]['id'],_0x1234c2)[_0xa5a5('0x10')](function(_0x27bd72){logger[_0xa5a5('0x8')](_0xa5a5('0x11'),_0x4ad9b3,_0x1fe96d[_0xa5a5('0xf')]['id']);})[_0xa5a5('0x12')](function(_0x567d9b){logger[_0xa5a5('0x13')](_0xa5a5('0x14'),_0x4ad9b3,JSON[_0xa5a5('0x15')](_0x567d9b));})[_0xa5a5('0x16')](function(){_0x5691f1[_0xa5a5('0x17')]();});}}catch(_0xa81eeb){logger['error'](_0xa5a5('0x14'),_0x4ad9b3,JSON[_0xa5a5('0x15')](_0xa81eeb));_0x5691f1[_0xa5a5('0x17')]();}};}; \ No newline at end of file +var _0x446c=['[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence'];(function(_0x215237,_0x217f29){var _0x46fc87=function(_0x15f9f8){while(--_0x15f9f8){_0x215237['push'](_0x215237['shift']());}};_0x46fc87(++_0x217f29);}(_0x446c,0x156));var _0xc446=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x446c[_0x5e6bec];return _0x5dc5cf;};'use strict';var moment=require(_0xc446('0x0'));var logger=require(_0xc446('0x1'))(_0xc446('0x2'));var rpc={'chatInteraction':require(_0xc446('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc446('0x4')),'mailInteraction':require(_0xc446('0x5')),'faxInteraction':require(_0xc446('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xc446('0x7')]=function(_0x5904ff,_0x4a1bce,_0x115a9e,_0x235050){return function(_0x578895){try{logger['info'](_0xc446('0x8'),_0x5904ff,_0x4a1bce[0x0]);var _0x3e9e70={'closed':0x1,'closedAt':moment()[_0xc446('0x9')](_0xc446('0xa')),'closeReason':_0xc446('0xb'),'disposition':_0x4a1bce[0x0]};if(rpc[_0x235050['channel']+_0xc446('0xc')]){rpc[_0x235050[_0xc446('0xd')]+_0xc446('0xc')][_0xc446('0xe')](_0x235050['interaction']['id'],_0x3e9e70)[_0xc446('0xf')](function(_0xbb2f6f){logger[_0xc446('0x10')](_0xc446('0x11'),_0x5904ff,_0x235050[_0xc446('0x12')]['id']);})[_0xc446('0x13')](function(_0x1a2099){logger[_0xc446('0x14')](_0xc446('0x15'),_0x5904ff,JSON[_0xc446('0x16')](_0x1a2099));})[_0xc446('0x17')](function(){_0x578895[_0xc446('0x18')]();});}}catch(_0x1cfc0a){logger[_0xc446('0x14')](_0xc446('0x15'),_0x5904ff,JSON[_0xc446('0x16')](_0x1cfc0a));_0x578895[_0xc446('0x18')]();}};}; \ 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 f96df86..774c6b4 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 _0xcd09=['next','error','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','body','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','then','fulfillment','speech','result','metadata'];(function(_0x4ba9d4,_0x54ba7e){var _0x335ae5=function(_0x5c33dc){while(--_0x5c33dc){_0x4ba9d4['push'](_0x4ba9d4['shift']());}};_0x335ae5(++_0x54ba7e);}(_0xcd09,0x89));var _0x9cd0=function(_0x1fc4b8,_0x56613e){_0x1fc4b8=_0x1fc4b8-0x0;var _0x160ab5=_0xcd09[_0x1fc4b8];return _0x160ab5;};'use strict';var _=require('lodash');var moment=require(_0x9cd0('0x0'));var apiai=require('apiai-promise');var md5=require(_0x9cd0('0x1'));var utils=require('./utils');var logger=require(_0x9cd0('0x2'))(_0x9cd0('0x3'));var rpc={'chatMessage':require(_0x9cd0('0x4')),'openchannelMessage':require(_0x9cd0('0x5')),'mailMessage':require(_0x9cd0('0x6')),'smsMessage':require(_0x9cd0('0x7')),'faxMessage':require(_0x9cd0('0x8')),'whatsappMessage':require(_0x9cd0('0x9'))};exports[_0x9cd0('0xa')]=function(_0x2e63e8,_0x37a37e){return function(_0x939375){try{if(!_[_0x9cd0('0xb')](this[_0x9cd0('0xc')]['UserId'])){logger[_0x9cd0('0xd')](_0x9cd0('0xe'),_0x2e63e8,_0x9cd0('0xf'));return _0x939375['next']();}var _0x5a3c75={'ContactId':this[_0x9cd0('0x10')]['id'],'sentAt':moment()[_0x9cd0('0x11')](_0x9cd0('0x12')),'direction':_0x9cd0('0x13')};var _0x225c5d=this[_0x9cd0('0x14')];if(_0x225c5d===_0x9cd0('0x15')){_0x5a3c75['ChatWebsiteId']=this[_0x9cd0('0x16')]['id'];}else{_0x5a3c75[_[_0x9cd0('0x17')](_0x225c5d)+'AccountId']=this[_0x9cd0('0x16')]['id'];}_0x5a3c75[_[_0x9cd0('0x17')](_0x225c5d)+_0x9cd0('0x18')]=this[_0x9cd0('0xc')]['id'];if(this[_0x9cd0('0xc')]['created']){var _0x415580=_0x37a37e[0x2];if(!_[_0x9cd0('0x19')](_0x415580)){_0x5a3c75['body']=utils[_0x9cd0('0x1a')](_0x415580,this);return rpc[_0x225c5d+_0x9cd0('0x1b')][_0x9cd0('0x1c')](_0x5a3c75)['then'](function(_0x3d3854){logger[_0x9cd0('0xd')](_0x9cd0('0xe'),_0x2e63e8,_0x5a3c75[_0x9cd0('0x1d')]);})[_0x9cd0('0x1e')](function(_0x12fce8){logger['error'](_0x9cd0('0xe'),_0x2e63e8,JSON[_0x9cd0('0x1f')](_0x12fce8));})[_0x9cd0('0x20')](function(){logger[_0x9cd0('0xd')](_0x9cd0('0x21'),_0x2e63e8);_0x939375['stop']();});}else{logger[_0x9cd0('0xd')](_0x9cd0('0x22'),_0x2e63e8);_0x939375[_0x9cd0('0x23')]();}}else{var _0x501eb3=this;var _0x332704=apiai(_0x37a37e[0x0],{'language':_0x37a37e[0x1]||'en'});return _0x332704[_0x9cd0('0x24')](this[_0x9cd0('0x25')][_0x9cd0('0x1d')],{'sessionId':md5(this[_0x9cd0('0xc')]['id'])})[_0x9cd0('0x26')](function(_0xe2a832){_0x501eb3[_0x9cd0('0x1d')]['dialogflow']=_0xe2a832;_0x5a3c75['body']=_0xe2a832['result'][_0x9cd0('0x27')][_0x9cd0('0x28')];return rpc[_0x225c5d+_0x9cd0('0x1b')][_0x9cd0('0x1c')](_0x5a3c75)[_0x9cd0('0x26')](function(_0x5d5047){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x2e63e8,_0x5a3c75['body']);if(_0xe2a832[_0x9cd0('0x29')][_0x9cd0('0x2a')]['endConversation']){_0x939375[_0x9cd0('0x2b')]();}else{_0x939375[_0x9cd0('0x23')]();}})[_0x9cd0('0x1e')](function(_0x23bf3b){logger[_0x9cd0('0x2c')](_0x9cd0('0xe'),_0x2e63e8,JSON[_0x9cd0('0x1f')](_0x23bf3b));_0x939375[_0x9cd0('0x2b')]();});})[_0x9cd0('0x1e')](function(_0x18485b){logger[_0x9cd0('0x2c')](_0x9cd0('0xe'),_0x2e63e8,_0x18485b['message']);_0x939375[_0x9cd0('0x2b')]();});}}catch(_0x565e0c){logger[_0x9cd0('0x2c')](_0x9cd0('0xe'),_0x2e63e8,JSON[_0x9cd0('0x1f')](_0x565e0c));_0x939375[_0x9cd0('0x23')]();}};}; \ No newline at end of file +var _0xeb33=['created','isEmpty','body','getMustacheRender','Message','create','then','error','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','endConversation','catch','stringify','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../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','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','InteractionId'];(function(_0x409013,_0x487562){var _0x60978b=function(_0x111828){while(--_0x111828){_0x409013['push'](_0x409013['shift']());}};_0x60978b(++_0x487562);}(_0xeb33,0x1b1));var _0x3eb3=function(_0x63cd22,_0x523870){_0x63cd22=_0x63cd22-0x0;var _0x2bef6f=_0xeb33[_0x63cd22];return _0x2bef6f;};'use strict';var _=require(_0x3eb3('0x0'));var moment=require(_0x3eb3('0x1'));var apiai=require(_0x3eb3('0x2'));var md5=require(_0x3eb3('0x3'));var utils=require(_0x3eb3('0x4'));var logger=require(_0x3eb3('0x5'))(_0x3eb3('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3eb3('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3eb3('0x8')),'whatsappMessage':require(_0x3eb3('0x9'))};exports[_0x3eb3('0xa')]=function(_0x348d76,_0x466493){return function(_0x154338){try{if(!_[_0x3eb3('0xb')](this[_0x3eb3('0xc')][_0x3eb3('0xd')])){logger[_0x3eb3('0xe')](_0x3eb3('0xf'),_0x348d76,_0x3eb3('0x10'));return _0x154338[_0x3eb3('0x11')]();}var _0x228d05={'ContactId':this[_0x3eb3('0x12')]['id'],'sentAt':moment()[_0x3eb3('0x13')](_0x3eb3('0x14')),'direction':_0x3eb3('0x15')};var _0x4702da=this[_0x3eb3('0x16')];if(_0x4702da===_0x3eb3('0x17')){_0x228d05[_0x3eb3('0x18')]=this[_0x3eb3('0x19')]['id'];}else{_0x228d05[_['upperFirst'](_0x4702da)+'AccountId']=this[_0x3eb3('0x19')]['id'];}_0x228d05[_['upperFirst'](_0x4702da)+_0x3eb3('0x1a')]=this[_0x3eb3('0xc')]['id'];if(this[_0x3eb3('0xc')][_0x3eb3('0x1b')]){var _0x2e635a=_0x466493[0x2];if(!_[_0x3eb3('0x1c')](_0x2e635a)){_0x228d05[_0x3eb3('0x1d')]=utils[_0x3eb3('0x1e')](_0x2e635a,this);return rpc[_0x4702da+_0x3eb3('0x1f')][_0x3eb3('0x20')](_0x228d05)[_0x3eb3('0x21')](function(_0x2a55b9){logger['info'](_0x3eb3('0xf'),_0x348d76,_0x228d05[_0x3eb3('0x1d')]);})['catch'](function(_0x42fea9){logger[_0x3eb3('0x22')](_0x3eb3('0xf'),_0x348d76,JSON['stringify'](_0x42fea9));})[_0x3eb3('0x23')](function(){logger[_0x3eb3('0xe')](_0x3eb3('0x24'),_0x348d76);_0x154338[_0x3eb3('0x25')]();});}else{logger[_0x3eb3('0xe')](_0x3eb3('0x26'),_0x348d76);_0x154338['stop']();}}else{var _0x10abb6=this;var _0x382a37=apiai(_0x466493[0x0],{'language':_0x466493[0x1]||'en'});return _0x382a37[_0x3eb3('0x27')](this[_0x3eb3('0x28')][_0x3eb3('0x1d')],{'sessionId':md5(this[_0x3eb3('0xc')]['id'])})[_0x3eb3('0x21')](function(_0x1f5c88){_0x10abb6[_0x3eb3('0x1d')]['dialogflow']=_0x1f5c88;_0x228d05[_0x3eb3('0x1d')]=_0x1f5c88[_0x3eb3('0x29')][_0x3eb3('0x2a')]['speech'];return rpc[_0x4702da+_0x3eb3('0x1f')][_0x3eb3('0x20')](_0x228d05)[_0x3eb3('0x21')](function(_0xe19c66){logger[_0x3eb3('0xe')](_0x3eb3('0xf'),_0x348d76,_0x228d05['body']);if(_0x1f5c88[_0x3eb3('0x29')]['metadata'][_0x3eb3('0x2b')]){_0x154338['next']();}else{_0x154338[_0x3eb3('0x25')]();}})[_0x3eb3('0x2c')](function(_0x27247f){logger[_0x3eb3('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x348d76,JSON['stringify'](_0x27247f));_0x154338['next']();});})[_0x3eb3('0x2c')](function(_0x21ef3c){logger[_0x3eb3('0x22')](_0x3eb3('0xf'),_0x348d76,_0x21ef3c[_0x3eb3('0x28')]);_0x154338['next']();});}}catch(_0x5583db){logger[_0x3eb3('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x348d76,JSON[_0x3eb3('0x2d')](_0x5583db));_0x154338[_0x3eb3('0x25')]();}};}; \ 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 befa87e..35a7a0e 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 _0x3b5d=['error','[%s][GOTOIF]\x20%s','join','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','validate','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length'];(function(_0x440064,_0x15230d){var _0x4f32c7=function(_0x21c549){while(--_0x21c549){_0x440064['push'](_0x440064['shift']());}};_0x4f32c7(++_0x15230d);}(_0x3b5d,0x1b7));var _0xd3b5=function(_0x2b2583,_0x2a154b){_0x2b2583=_0x2b2583-0x0;var _0x4cd668=_0x3b5d[_0x2b2583];return _0x4cd668;};'use strict';var schema=require(_0xd3b5('0x0'));var _=require('lodash');var htmlToText=require(_0xd3b5('0x1'));var utils=require(_0xd3b5('0x2'));var logger=require('../../../../config/logger')(_0xd3b5('0x3'));var gotoif=schema({'condition':{'type':_0xd3b5('0x4'),'required':!![],'message':_0xd3b5('0x5')},'priorityTrue':{'type':_0xd3b5('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xd3b5('0x6'),'message':_0xd3b5('0x7')}});exports[_0xd3b5('0x8')]=function(_0x59904e,_0x2bc7b3){return function(_0x31fc3b){try{var _0x54dbb9={'condition':htmlToText[_0xd3b5('0x9')](utils['getMustacheRender'](_0x2bc7b3[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2bc7b3[0x1],'priorityFalse':_0x2bc7b3[0x2]};var _0x43b190=gotoif[_0xd3b5('0x0')](_0x54dbb9,{'typecast':!![]});if(_0x43b190[_0xd3b5('0xa')]){logger[_0xd3b5('0xb')](_0xd3b5('0xc'),_0x59904e,_['map'](_0x43b190,'message')[_0xd3b5('0xd')](',\x20'));_0x31fc3b[_0xd3b5('0xe')]();}else{try{var _0x710f22=eval('('+_0x54dbb9[_0xd3b5('0xf')]+')');var _0x524602=_0x710f22?_0x54dbb9['priorityTrue']:_0x54dbb9[_0xd3b5('0x10')];logger['info'](_0xd3b5('0x11'),_0x59904e,_0x54dbb9[_0xd3b5('0xf')],_0x710f22,_0x524602||_0xd3b5('0x12'));if(_0x524602){var _0x44db0e=_[_0xd3b5('0x13')](_0x31fc3b[_0xd3b5('0x14')](),{'p':_0x524602});if(_0x44db0e>=0x0){logger['info'](_0xd3b5('0x15'),_0x59904e,_0x524602||_0xd3b5('0x12'),_0x44db0e);_0x31fc3b[_0xd3b5('0x12')](_0x44db0e);}else{logger[_0xd3b5('0x16')](_0xd3b5('0x17'),_0x59904e,_0x524602||_0xd3b5('0x12'));_0x31fc3b['stop']();}}else{_0x31fc3b[_0xd3b5('0x12')]();}}catch(_0x419512){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x59904e,_0x419512[_0xd3b5('0x18')]);_0x31fc3b[_0xd3b5('0xe')]();}}}catch(_0x3d4da5){logger[_0xd3b5('0xb')](_0xd3b5('0xc'),_0x59904e,JSON['stringify'](_0x3d4da5));_0x31fc3b['stop']();}};}; \ No newline at end of file +var _0x560a=['replace','length','error','map','message','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender'];(function(_0x2c38e7,_0x5745c9){var _0xfa8c66=function(_0x35f2f4){while(--_0x35f2f4){_0x2c38e7['push'](_0x2c38e7['shift']());}};_0xfa8c66(++_0x5745c9);}(_0x560a,0x12d));var _0xa560=function(_0x4a1e96,_0x143e6b){_0x4a1e96=_0x4a1e96-0x0;var _0x5acea9=_0x560a[_0x4a1e96];return _0x5acea9;};'use strict';var schema=require(_0xa560('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0xa560('0x1'));var logger=require(_0xa560('0x2'))(_0xa560('0x3'));var gotoif=schema({'condition':{'type':_0xa560('0x4'),'required':!![],'message':_0xa560('0x5')},'priorityTrue':{'type':'number','message':_0xa560('0x6')},'priorityFalse':{'type':'number','message':_0xa560('0x7')}});exports[_0xa560('0x8')]=function(_0x54051e,_0x42e4de){return function(_0x9226b){try{var _0x33da94={'condition':htmlToText[_0xa560('0x9')](utils[_0xa560('0xa')](_0x42e4de[0x0],this),{'wordwrap':![]})[_0xa560('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x42e4de[0x1],'priorityFalse':_0x42e4de[0x2]};var _0xd16c10=gotoif[_0xa560('0x0')](_0x33da94,{'typecast':!![]});if(_0xd16c10[_0xa560('0xc')]){logger[_0xa560('0xd')]('[%s][GOTOIF]\x20%s',_0x54051e,_[_0xa560('0xe')](_0xd16c10,_0xa560('0xf'))['join'](',\x20'));_0x9226b[_0xa560('0x10')]();}else{try{var _0x19934b=eval('('+_0x33da94[_0xa560('0x11')]+')');var _0x1f0666=_0x19934b?_0x33da94[_0xa560('0x12')]:_0x33da94[_0xa560('0x13')];logger['info'](_0xa560('0x14'),_0x54051e,_0x33da94['condition'],_0x19934b,_0x1f0666||_0xa560('0x15'));if(_0x1f0666){var _0x10aa3d=_[_0xa560('0x16')](_0x9226b['rules'](),{'p':_0x1f0666});if(_0x10aa3d>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x54051e,_0x1f0666||'next',_0x10aa3d);_0x9226b[_0xa560('0x15')](_0x10aa3d);}else{logger[_0xa560('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x54051e,_0x1f0666||_0xa560('0x15'));_0x9226b[_0xa560('0x10')]();}}else{_0x9226b['next']();}}catch(_0x3e3ee0){logger['error'](_0xa560('0x18'),_0x54051e,_0x3e3ee0['message']);_0x9226b[_0xa560('0x10')]();}}}catch(_0x670e2d){logger[_0xa560('0xd')](_0xa560('0x19'),_0x54051e,JSON['stringify'](_0x670e2d));_0x9226b[_0xa560('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 4606969..4557340 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 _0x19a6=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x19a6,0x88));var _0x619a=function(_0x140d62,_0x5a4caf){_0x140d62=_0x140d62-0x0;var _0x423476=_0x19a6[_0x140d62];return _0x423476;};'use strict';var schema=require(_0x619a('0x0'));var _=require(_0x619a('0x1'));var logger=require(_0x619a('0x2'))(_0x619a('0x3'));var gotop=schema({'priority':{'type':_0x619a('0x4'),'required':!![],'message':_0x619a('0x5')}});exports[_0x619a('0x6')]=function(_0x2ce94f,_0x41e8b8){return function(_0x5906e5){try{var _0x186a47={'priority':_0x41e8b8[0x0]};var _0x5945f9=gotop[_0x619a('0x0')](_0x186a47,{'typecast':!![]});if(_0x5945f9['length']){logger['error']('[%s][GOTOP]\x20%s',_0x2ce94f,_[_0x619a('0x7')](_0x5945f9,_0x619a('0x8'))[_0x619a('0x9')](',\x20'));_0x5906e5[_0x619a('0xa')]();}else{logger[_0x619a('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x2ce94f,_0x186a47[_0x619a('0xc')]);if(_0x186a47[_0x619a('0xc')]){var _0x27a0c0=_[_0x619a('0xd')](_0x5906e5['rules'](),{'p':_0x186a47[_0x619a('0xc')]});if(_0x27a0c0>=0x0){logger[_0x619a('0xb')](_0x619a('0xe'),_0x2ce94f,_0x186a47[_0x619a('0xc')]||'next',_0x27a0c0);_0x5906e5['next'](_0x27a0c0);}else{logger[_0x619a('0xb')](_0x619a('0xf'),_0x2ce94f,_0x186a47['priority']||'next');_0x5906e5[_0x619a('0xa')]();}}else{_0x5906e5[_0x619a('0x10')]();}}}catch(_0x54e05a){logger[_0x619a('0x11')](_0x619a('0x12'),_0x2ce94f,JSON[_0x619a('0x13')](_0x54e05a));_0x5906e5[_0x619a('0xa')]();}};}; \ No newline at end of file +var _0x4369=['lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','message','join','info','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate'];(function(_0x5ac9c1,_0x2df9a0){var _0x2c9bb2=function(_0xf30eec){while(--_0xf30eec){_0x5ac9c1['push'](_0x5ac9c1['shift']());}};_0x2c9bb2(++_0x2df9a0);}(_0x4369,0x167));var _0x9436=function(_0x5ec454,_0xfcd77e){_0x5ec454=_0x5ec454-0x0;var _0x5ebf50=_0x4369[_0x5ec454];return _0x5ebf50;};'use strict';var schema=require(_0x9436('0x0'));var _=require(_0x9436('0x1'));var logger=require(_0x9436('0x2'))(_0x9436('0x3'));var gotop=schema({'priority':{'type':_0x9436('0x4'),'required':!![],'message':_0x9436('0x5')}});exports[_0x9436('0x6')]=function(_0x1c82fe,_0x5d3ff7){return function(_0x43f1d6){try{var _0x2b7714={'priority':_0x5d3ff7[0x0]};var _0xf86fd7=gotop['validate'](_0x2b7714,{'typecast':!![]});if(_0xf86fd7['length']){logger[_0x9436('0x7')](_0x9436('0x8'),_0x1c82fe,_['map'](_0xf86fd7,_0x9436('0x9'))[_0x9436('0xa')](',\x20'));_0x43f1d6['stop']();}else{logger[_0x9436('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x1c82fe,_0x2b7714[_0x9436('0xc')]);if(_0x2b7714[_0x9436('0xc')]){var _0x27ff56=_[_0x9436('0xd')](_0x43f1d6['rules'](),{'p':_0x2b7714[_0x9436('0xc')]});if(_0x27ff56>=0x0){logger[_0x9436('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1c82fe,_0x2b7714[_0x9436('0xc')]||_0x9436('0xe'),_0x27ff56);_0x43f1d6[_0x9436('0xe')](_0x27ff56);}else{logger[_0x9436('0xb')](_0x9436('0xf'),_0x1c82fe,_0x2b7714[_0x9436('0xc')]||_0x9436('0xe'));_0x43f1d6[_0x9436('0x10')]();}}else{_0x43f1d6['next']();}}}catch(_0x69a222){logger[_0x9436('0x7')](_0x9436('0x8'),_0x1c82fe,JSON[_0x9436('0x11')](_0x69a222));_0x43f1d6[_0x9436('0x10')]();}};}; \ 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 c56d962..fc6d233 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 _0x6089=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat'];(function(_0x2758f8,_0x49a1ee){var _0x1ef670=function(_0x9f86d0){while(--_0x9f86d0){_0x2758f8['push'](_0x2758f8['shift']());}};_0x1ef670(++_0x49a1ee);}(_0x6089,0x189));var _0x9608=function(_0x3e4c67,_0xbeeeb9){_0x3e4c67=_0x3e4c67-0x0;var _0x8d7261=_0x6089[_0x3e4c67];return _0x8d7261;};'use strict';var _=require(_0x9608('0x0'));var utils=require('./utils');var logger=require(_0x9608('0x1'))(_0x9608('0x2'));var rpc={'chatMessage':require(_0x9608('0x3')),'openchannelMessage':require(_0x9608('0x4')),'mailMessage':require(_0x9608('0x5')),'smsMessage':require(_0x9608('0x6')),'faxMessage':require(_0x9608('0x7')),'whatsappMessage':require(_0x9608('0x8'))};exports[_0x9608('0x9')]=function(_0x2ea9b1,_0x518020){return function(_0x2567ac){try{var _0x25520e={'body':utils['getMustacheRender'](_0x518020[0x0],this),'ContactId':this[_0x9608('0xa')]['id']};if(this[_0x9608('0xb')]===_0x9608('0xc')){_0x25520e[_0x9608('0xd')]=this[_0x9608('0xe')]['id'];}else{_0x25520e[_[_0x9608('0xf')](this[_0x9608('0xb')])+_0x9608('0x10')]=this[_0x9608('0xe')]['id'];}_0x25520e[_[_0x9608('0xf')](this[_0x9608('0xb')])+_0x9608('0x11')]=this[_0x9608('0x12')]['id'];if(rpc[this['channel']+_0x9608('0x13')]){return rpc[this[_0x9608('0xb')]+_0x9608('0x13')][_0x9608('0x14')](_0x25520e)['then'](function(_0x29f277){logger[_0x9608('0x15')](_0x9608('0x16'),_0x2ea9b1,_0x25520e[_0x9608('0x17')]);_0x2567ac[_0x9608('0x18')]();})[_0x9608('0x19')](function(_0x360f27){logger['error'](_0x9608('0x16'),_0x2ea9b1,JSON[_0x9608('0x1a')](_0x360f27));_0x2567ac[_0x9608('0x1b')]();});}}catch(_0x5bd985){logger[_0x9608('0x1c')](_0x9608('0x16'),_0x2ea9b1,JSON[_0x9608('0x1a')](_0x5bd985));_0x2567ac[_0x9608('0x1b')]();}};}; \ No newline at end of file +var _0xa11c=['upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','contact','channel','chat','ChatWebsiteId','account'];(function(_0x1f884c,_0x31cd67){var _0x4085da=function(_0x440342){while(--_0x440342){_0x1f884c['push'](_0x1f884c['shift']());}};_0x4085da(++_0x31cd67);}(_0xa11c,0x142));var _0xca11=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa11c[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xca11('0x0'));var utils=require(_0xca11('0x1'));var logger=require(_0xca11('0x2'))(_0xca11('0x3'));var rpc={'chatMessage':require(_0xca11('0x4')),'openchannelMessage':require(_0xca11('0x5')),'mailMessage':require(_0xca11('0x6')),'smsMessage':require(_0xca11('0x7')),'faxMessage':require(_0xca11('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x5a98fa,_0x306f5d){return function(_0x5c5b87){try{var _0x174859={'body':utils['getMustacheRender'](_0x306f5d[0x0],this),'ContactId':this[_0xca11('0x9')]['id']};if(this[_0xca11('0xa')]===_0xca11('0xb')){_0x174859[_0xca11('0xc')]=this[_0xca11('0xd')]['id'];}else{_0x174859[_[_0xca11('0xe')](this['channel'])+_0xca11('0xf')]=this[_0xca11('0xd')]['id'];}_0x174859[_[_0xca11('0xe')](this[_0xca11('0xa')])+_0xca11('0x10')]=this[_0xca11('0x11')]['id'];if(rpc[this[_0xca11('0xa')]+_0xca11('0x12')]){return rpc[this[_0xca11('0xa')]+_0xca11('0x12')][_0xca11('0x13')](_0x174859)['then'](function(_0x377492){logger[_0xca11('0x14')](_0xca11('0x15'),_0x5a98fa,_0x174859[_0xca11('0x16')]);_0x5c5b87[_0xca11('0x17')]();})[_0xca11('0x18')](function(_0x313163){logger[_0xca11('0x19')]('[%s][MESSAGE]\x20%s',_0x5a98fa,JSON[_0xca11('0x1a')](_0x313163));_0x5c5b87[_0xca11('0x1b')]();});}}catch(_0x48cc2c){logger[_0xca11('0x19')]('[%s][MESSAGE]\x20%s',_0x5a98fa,JSON[_0xca11('0x1a')](_0x48cc2c));_0x5c5b87[_0xca11('0x1b')]();}};}; \ 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 caaa043..b39a53f 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 _0x990f=['routing','info','getMustacheRender','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger'];(function(_0x439b05,_0x552f4b){var _0x48f241=function(_0x22d57b){while(--_0x22d57b){_0x439b05['push'](_0x439b05['shift']());}};_0x48f241(++_0x552f4b);}(_0x990f,0x1bf));var _0xf990=function(_0x260165,_0x187de6){_0x260165=_0x260165-0x0;var _0x134e69=_0x990f[_0x260165];return _0x134e69;};'use strict';var utils=require('./utils');var logger=require(_0xf990('0x0'))(_0xf990('0x1'));exports['consequence']=function(_0x1f63a0,_0x1dec34){return function(_0x5f1afa){try{logger[_0xf990('0x2')]('[%s][NOOP]\x20%s',_0x1f63a0,utils[_0xf990('0x3')](_0x1dec34[0x0],this));_0x5f1afa['next']();}catch(_0x5f0769){logger['error'](_0xf990('0x4'),_0x1f63a0,JSON[_0xf990('0x5')](_0x5f0769));_0x5f1afa[_0xf990('0x6')]();}};}; \ No newline at end of file +var _0xd69d=['getMustacheRender','error','stop','../../../../config/logger','routing','[%s][NOOP]\x20%s'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xd69d,0x171));var _0xdd69=function(_0x30dd05,_0x33fef3){_0x30dd05=_0x30dd05-0x0;var _0x17c66b=_0xd69d[_0x30dd05];return _0x17c66b;};'use strict';var utils=require('./utils');var logger=require(_0xdd69('0x0'))(_0xdd69('0x1'));exports['consequence']=function(_0x33d476,_0x22236e){return function(_0x4e3bf0){try{logger['info'](_0xdd69('0x2'),_0x33d476,utils[_0xdd69('0x3')](_0x22236e[0x0],this));_0x4e3bf0['next']();}catch(_0x4c7089){logger[_0xdd69('0x4')](_0xdd69('0x2'),_0x33d476,JSON['stringify'](_0x4c7089));_0x4e3bf0[_0xdd69('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 fba612f..d5e012f 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 _0x9c44=['[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','atimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','QueueId','upperFirst','channel','InteractionId','message','AccountId','info','name','QueueReport','create','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x49c4('0x0'));var seqqueue=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var config=require(_0x49c4('0x4'));var logger=require(_0x49c4('0x5'))('routing');var strategy=require('./strategy');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));var attributes=['id',_0x49c4('0x9'),'account',_0x49c4('0xa'),_0x49c4('0xb'),_0x49c4('0xc')];function emit(_0x4487ca,_0x4c7d3a,_0x5ab4a3){io['to'](_0x4487ca)[_0x49c4('0xd')](_0x4c7d3a,_0x5ab4a3);}function emitChannelQueueInteraction(_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c,_0x536d42,_0x1d19bf,_0x6d1b08){var _0x5487cd=_[_0x49c4('0xe')](_0xb611a1);_0x5487cd[_0x49c4('0x9')]=_0x6d1b08;_0x5487cd['queue']=_0x58cad7;_0x5487cd[_0x49c4('0xf')]=_0x459d09;_0x5487cd['id']=_0x4adb3c;if(_0x536d42){_0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c]=_[_0x49c4('0x12')](_0x5487cd,attributes);}else{delete _0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c];}emit(util[_0x49c4('0x10')](_0x49c4('0x13'),_0x313e73,_0x58cad7),util['format'](_0x49c4('0x14'),_0x313e73,_0x536d42?_0x49c4('0x15'):_0x49c4('0x16')),_[_0x49c4('0x12')](_0x5487cd,attributes));}var rpc={'openchannelQueueReport':require(_0x49c4('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x49c4('0x18')),'smsQueueReport':require(_0x49c4('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x49c4('0x1a'),'required':!![],'message':_0x49c4('0x1b')},'timeout':{'type':_0x49c4('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24856d,_0x50b151,_0x2cbd50,_0x1806c2){if(_0x24856d&&_0x50b151&&_0x2cbd50){_0x50b151[_0x49c4('0x1d')]+=0x1;var _0x291526={'uniqueid':_0x24856d,'from':_0x2cbd50[_0x49c4('0x1e')]?_0x2cbd50[_0x49c4('0x1e')][_0x49c4('0xb')]:'','joinAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'ContactId':_0x2cbd50['contact']?_0x2cbd50['contact']['id']:null,'ListId':_0x2cbd50['list']?_0x2cbd50[_0x49c4('0x20')]['id']:null};_0x291526[_['upperFirst'](_0x2cbd50['channel'])+_0x49c4('0x21')]=_0x50b151['id']||null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+_0x49c4('0x24')]=_0x2cbd50['interaction']?_0x2cbd50['interaction']['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+'MessageId']=_0x2cbd50[_0x49c4('0x25')]?_0x2cbd50[_0x49c4('0x25')]['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+(_0x2cbd50['channel']!=='chat'?_0x49c4('0x26'):'WebsiteId')]=_0x2cbd50[_0x49c4('0xf')]?_0x2cbd50[_0x49c4('0xf')]['id']:null;logger[_0x49c4('0x27')](util[_0x49c4('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x24856d,_0x50b151[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2cbd50[_0x49c4('0x23')],_0x50b151[_0x49c4('0x28')],_0x291526,_0x2cbd50[_0x49c4('0xf')][_0x49c4('0x28')],_0x2cbd50[_0x49c4('0x25')]['id'],!![],_0x1806c2,_0x50b151['id']);if(rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2a')](_0x291526)['catch'](function(_0x4f4495){logger['error'](_0x49c4('0x2b'));});}}}function stopRouting(_0x7ee704,_0x1eb035,_0x27e467,_0x28eb47){if(_0x7ee704&&_0x1eb035){_0x1eb035['waiting']-=0x1;var _0x38ad77={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'acceptAt':moment()[_0x49c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x49c4('0x27')](util[_0x49c4('0x10')](_0x49c4('0x2c'),_0x7ee704,_0x1eb035[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x27e467[_0x49c4('0x23')],_0x1eb035['name'],_0x27e467[_0x49c4('0x1e')],_0x27e467[_0x49c4('0xf')][_0x49c4('0x28')],_0x27e467['message']['id'],![],_0x28eb47,_0x1eb035['id']);if(rpc[_0x27e467['channel']+_0x49c4('0x29')]){return rpc[_0x27e467[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2d')](_0x7ee704,_0x38ad77)[_0x49c4('0x2e')](function(_0x2cf897){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function endRouting(_0x3209cd,_0x4e0209,_0x2d34ca,_0x5b96df){if(_0x3209cd&&_0x4e0209){_0x4e0209[_0x49c4('0x1d')]-=0x1;var _0x349791={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'exitAt':moment()['format'](_0x49c4('0x1f')),'reason':_0x49c4('0x31')};logger[_0x49c4('0x27')](util['format'](_0x49c4('0x32'),_0x3209cd,_0x4e0209[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2d34ca[_0x49c4('0x23')],_0x4e0209[_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x1e')],_0x2d34ca[_0x49c4('0xf')][_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x25')]['id'],![],_0x5b96df);if(rpc[_0x2d34ca[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2d34ca[_0x49c4('0x23')]+'QueueReport'][_0x49c4('0x2d')](_0x3209cd,_0x349791)[_0x49c4('0x2e')](function(_0x32b172){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function handleFindQueue(_0x29dd5d){return function(_0x1be62d){return _0x1be62d[_0x49c4('0x28')][_0x49c4('0x33')]()===_0x29dd5d[_0x49c4('0x33')]();};}exports[_0x49c4('0x34')]=function(_0xa3d59e,_0x326142,_0x4e38bc,_0x212366){return function(_0x49829e){try{var _0x104efb={'name':_0x326142[0x0],'timeout':_0x326142[0x1]};var _0x4915bc=queue[_0x49c4('0x35')](_0x104efb,{'typecast':!![]});if(_0x4915bc[_0x49c4('0x36')]){logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_['map'](_0x4915bc,'message')[_0x49c4('0x38')](',\x20'));_0x49829e[_0x49c4('0x39')]();}else{var _0x38349b=_[_0x49c4('0x3a')](_0x4e38bc[_0x212366['channel']+_0x49c4('0x3b')],handleFindQueue(_0x104efb[_0x49c4('0x28')]));if(_0x38349b){startRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);var _0x2ccd47=(_0x38349b[_0x49c4('0x31')]||0xa)*0x3e8;var _0x81a674=(_0x104efb[_0x49c4('0x31')]||0x14)*0x3e8;var _0x1a9593,_0x3351c1;if(_0x2ccd47>_0x81a674){_0x81a674=_0x2ccd47;}var _0x3c4a1d=seqqueue['createQueue'](_0x2ccd47);_0x3c4a1d['id']=_0xa3d59e;_0x3c4a1d[_0x49c4('0x3c')]=_0x2ccd47;_0x3c4a1d['qtimeout']=_0x81a674;_0x3c4a1d[_0x49c4('0x23')]=_0x212366[_0x49c4('0x23')];_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x3e'),function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa3d59e);stopRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x1a9593=undefined;_0x3c4a1d[_0x49c4('0x3f')](!![]);if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc[_0x49c4('0x3d')][_0xa3d59e];}_0x49829e[_0x49c4('0x39')]();});_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x40'),function(){if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc['rules'][_0xa3d59e];}});_0x1a9593=setTimeout(function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa3d59e);endRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x3c4a1d[_0x49c4('0x3f')](!![]);_0x49829e[_0x49c4('0x41')]();},_0x81a674);switch(_0x38349b[_0x49c4('0x42')]){case _0x49c4('0x43'):strategy[_0x49c4('0x43')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);break;default:strategy[_0x49c4('0x44')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);}}else{logger[_0x49c4('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa3d59e,_0x104efb[_0x49c4('0x28')]);_0x49829e[_0x49c4('0x39')]();}}}catch(_0x4a5c34){console[_0x49c4('0x45')](_0x4a5c34);logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_0x4a5c34[_0x49c4('0x46')]);_0x49829e['stop']();}};}; \ No newline at end of file +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x3d1b66,_0x5da1ee){var _0x1dec46=function(_0x45e66f){while(--_0x45e66f){_0x3d1b66['push'](_0x3d1b66['shift']());}};_0x1dec46(++_0x5da1ee);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 6d8bab2..233d33d 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 _0xebf3=['notificationId','writeLog','RINGING','isNil','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification'];(function(_0x10ac54,_0x32120e){var _0x2723cc=function(_0x3edb4d){while(--_0x3edb4d){_0x10ac54['push'](_0x10ac54['shift']());}};_0x2723cc(++_0x32120e);}(_0xebf3,0x114));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ebf('0x0'));var uuid=require(_0x3ebf('0x1'));var util=require(_0x3ebf('0x2'));var logger=require(_0x3ebf('0x3'))(_0x3ebf('0x4'));var Agent=function(_0x5ef09b,_0x46b69c,_0x334be6,_0x219c40){this['notificationId']=uuid['v4']();this[_0x3ebf('0x5')]=_0x5ef09b;this[_0x3ebf('0x6')]=_0x46b69c;this[_0x3ebf('0x7')]=_0x334be6;this[_0x3ebf('0x4')]=_0x219c40;this[_0x3ebf('0x5')][_0x3ebf('0x8')](this[_0x3ebf('0x9')][_0x3ebf('0xa')](this),this[_0x3ebf('0xb')]['bind'](this));this[_0x3ebf('0x5')]['on'](_0x3ebf('0xc'),this[_0x3ebf('0xb')][_0x3ebf('0xa')](this));this[_0x3ebf('0x5')]['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x3ebf('0x8')]=function(){this[_0x3ebf('0x5')][_0x3ebf('0x8')](this['handleRun'][_0x3ebf('0xa')](this),this[_0x3ebf('0xb')][_0x3ebf('0xa')](this));};Agent[_0x3ebf('0xd')][_0x3ebf('0xe')]=function(){this[_0x3ebf('0xb')](!![]);};Agent[_0x3ebf('0xd')][_0x3ebf('0x9')]=function(_0x23150c){logger[_0x3ebf('0xf')](_0x3ebf('0x10'),this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x6')]['id']);if(_['isNil'](this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']])){logger[_0x3ebf('0xf')](_0x3ebf('0x12'),this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x6')]['id']);setTimeout(this[_0x3ebf('0x8')][_0x3ebf('0xa')](this),0x3e8);}else{if(this[_0x3ebf('0x4')][_0x3ebf('0x13')]||util['isAgentAvailable'](this[_0x3ebf('0x5')]['id'],this['realtime'][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']],this[_0x3ebf('0x5')][_0x3ebf('0x14')],![])){this['realtime'][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']][_0x3ebf('0x15')]=!![];this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']][_0x3ebf('0x16')]=undefined;util[_0x3ebf('0x17')](this[_0x3ebf('0x18')],this['squeue']['id'],this[_0x3ebf('0x7')]['agents'][this['agent']['id']],null,this[_0x3ebf('0x4')]);util[_0x3ebf('0x19')](this[_0x3ebf('0x5')]['id'],this['realtime']['agents'][this[_0x3ebf('0x6')]['id']],_0x3ebf('0x1a')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0x3ebf('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x3ebf('0x6')]['id']);setTimeout(this[_0x3ebf('0x8')][_0x3ebf('0xa')](this),0x3e8);}}};Agent['prototype'][_0x3ebf('0xb')]=function(_0x2c9926){if(_[_0x3ebf('0x1b')](this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x6')]['id']);}else{logger[_0x3ebf('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x6')]['id']);util['hideNotification'](this[_0x3ebf('0x18')],this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']],null,this['routing']);this[_0x3ebf('0x7')][_0x3ebf('0x11')][this['agent']['id']][_0x3ebf('0x15')]=![];this['realtime'][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']][_0x3ebf('0x16')]=undefined;util['writeLog'](this[_0x3ebf('0x5')]['id'],this[_0x3ebf('0x7')][_0x3ebf('0x11')][this[_0x3ebf('0x6')]['id']],_0x2c9926?_0x3ebf('0x1c'):_0x3ebf('0x1d'));}if(!_0x2c9926){setTimeout(this[_0x3ebf('0x8')][_0x3ebf('0xa')](this),0x3e8);}};function agent(_0xcfcc01,_0xd173bf,_0xce218b,_0x576445){return new Agent(_0xcfcc01,_0xd173bf,_0xce218b,_0x576445);}module['exports']=agent; \ No newline at end of file +var _0x590b=['[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x590b,0x1cc));var _0xb590=function(_0x3fefc7,_0x20a7dc){_0x3fefc7=_0x3fefc7-0x0;var _0x1fe591=_0x590b[_0x3fefc7];return _0x1fe591;};'use strict';var _=require(_0xb590('0x0'));var uuid=require(_0xb590('0x1'));var util=require(_0xb590('0x2'));var logger=require(_0xb590('0x3'))(_0xb590('0x4'));var Agent=function(_0xe5762,_0x34182e,_0x379c10,_0x479426){this['notificationId']=uuid['v4']();this[_0xb590('0x5')]=_0xe5762;this[_0xb590('0x6')]=_0x34182e;this[_0xb590('0x7')]=_0x379c10;this[_0xb590('0x4')]=_0x479426;this[_0xb590('0x5')][_0xb590('0x8')](this[_0xb590('0x9')][_0xb590('0xa')](this),this[_0xb590('0xb')]['bind'](this));this[_0xb590('0x5')]['on']('timeout',this[_0xb590('0xb')][_0xb590('0xa')](this));this[_0xb590('0x5')]['on'](_0xb590('0xc'),this[_0xb590('0xd')]['bind'](this));};Agent['prototype'][_0xb590('0x8')]=function(){this[_0xb590('0x5')][_0xb590('0x8')](this[_0xb590('0x9')][_0xb590('0xa')](this),this[_0xb590('0xb')]['bind'](this));};Agent[_0xb590('0xe')][_0xb590('0xd')]=function(){this['handleTimeout'](!![]);};Agent['prototype']['handleRun']=function(_0x16a60c){logger[_0xb590('0xf')](_0xb590('0x10'),this[_0xb590('0x5')]['id'],this[_0xb590('0x6')]['id']);if(_[_0xb590('0x11')](this[_0xb590('0x7')][_0xb590('0x12')][this[_0xb590('0x6')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xb590('0x5')]['id'],this[_0xb590('0x6')]['id']);setTimeout(this[_0xb590('0x8')][_0xb590('0xa')](this),0x3e8);}else{if(this[_0xb590('0x4')][_0xb590('0x13')]||util[_0xb590('0x14')](this['squeue']['id'],this[_0xb590('0x7')][_0xb590('0x12')][this['agent']['id']],this[_0xb590('0x5')][_0xb590('0x15')],![])){this[_0xb590('0x7')][_0xb590('0x12')][this[_0xb590('0x6')]['id']]['busy']=!![];this[_0xb590('0x7')][_0xb590('0x12')][this['agent']['id']][_0xb590('0x16')]=undefined;util[_0xb590('0x17')](this['notificationId'],this[_0xb590('0x5')]['id'],this['realtime']['agents'][this[_0xb590('0x6')]['id']],null,this['routing']);util[_0xb590('0x18')](this[_0xb590('0x5')]['id'],this[_0xb590('0x7')][_0xb590('0x12')][this[_0xb590('0x6')]['id']],_0xb590('0x19')+(this[_0xb590('0x4')][_0xb590('0x13')]?_0xb590('0x1a'):''));}else{logger[_0xb590('0xf')](_0xb590('0x1b'),this[_0xb590('0x5')]['id'],this['agent']['id']);setTimeout(this['push'][_0xb590('0xa')](this),0x3e8);}}};Agent['prototype'][_0xb590('0xb')]=function(_0x18a985){if(_[_0xb590('0x11')](this[_0xb590('0x7')][_0xb590('0x12')][this[_0xb590('0x6')]['id']])){return logger[_0xb590('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xb590('0x5')]['id'],this[_0xb590('0x6')]['id']);}else{logger[_0xb590('0xf')](_0xb590('0x1c'),this[_0xb590('0x5')]['id'],this[_0xb590('0x6')]['id']);util[_0xb590('0x1d')](this[_0xb590('0x1e')],this[_0xb590('0x5')]['id'],this[_0xb590('0x7')][_0xb590('0x12')][this['agent']['id']],null,this[_0xb590('0x4')]);this[_0xb590('0x7')][_0xb590('0x12')][this[_0xb590('0x6')]['id']]['busy']=![];this[_0xb590('0x7')][_0xb590('0x12')][this['agent']['id']][_0xb590('0x16')]=undefined;util[_0xb590('0x18')](this[_0xb590('0x5')]['id'],this[_0xb590('0x7')][_0xb590('0x12')][this[_0xb590('0x6')]['id']],_0x18a985?_0xb590('0x1f'):_0xb590('0x20'));}if(!_0x18a985){setTimeout(this[_0xb590('0x8')][_0xb590('0xa')](this),0x3e8);}};function agent(_0x4d4a56,_0x141b2c,_0x417ac4,_0x10d464){return new Agent(_0x4d4a56,_0x141b2c,_0x417ac4,_0x10d464);}module[_0xb590('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 68b13ee..3229bbd 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 _0x8f66=['handleRun','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','bind','exports','uuid','./util','routing','notificationId','squeue','queue','realtime','push'];(function(_0x49c31a,_0x420967){var _0x45d0cd=function(_0x175308){while(--_0x175308){_0x49c31a['push'](_0x49c31a['shift']());}};_0x45d0cd(++_0x420967);}(_0x8f66,0x158));var _0x68f6=function(_0x55e5b9,_0x1be20e){_0x55e5b9=_0x55e5b9-0x0;var _0x58d1e7=_0x8f66[_0x55e5b9];return _0x58d1e7;};'use strict';var _=require('lodash');var uuid=require(_0x68f6('0x0'));var util=require(_0x68f6('0x1'));var logger=require('../../../../../config/logger')(_0x68f6('0x2'));var Beepall=function(_0x32c67b,_0x1231b7,_0x5040b4,_0x1809d2){this[_0x68f6('0x3')]=uuid['v4']();this[_0x68f6('0x4')]=_0x32c67b;this[_0x68f6('0x5')]=_0x1231b7;this[_0x68f6('0x6')]=_0x5040b4;this['routing']=_0x1809d2;this['squeue'][_0x68f6('0x7')](this[_0x68f6('0x8')]['bind'](this),this[_0x68f6('0x9')]['bind'](this));this['squeue']['on'](_0x68f6('0xa'),this['handleTimeout']['bind'](this));this[_0x68f6('0x4')]['on'](_0x68f6('0xb'),this[_0x68f6('0xc')]['bind'](this));};Beepall[_0x68f6('0xd')]['push']=function(){this['squeue'][_0x68f6('0x7')](this[_0x68f6('0x8')]['bind'](this),this['handleTimeout']['bind'](this));};Beepall[_0x68f6('0xd')]['handleDrained']=function(_0xd88c00){this[_0x68f6('0x9')](!![]);};Beepall[_0x68f6('0xd')]['handleRun']=function(_0x28b1d2){var _0x369833=!![];if(!_[_0x68f6('0xe')](this[_0x68f6('0x5')])&&!_['isNil'](this['queue'][_0x68f6('0xf')])&&this[_0x68f6('0x5')][_0x68f6('0xf')][_0x68f6('0x10')]>0x0){for(var _0x345929=0x0,_0x4ac93e;_0x3459290x0){for(var _0x76031d=0x0,_0xc19423;_0x76031d0x0&&_0x18f0c6[_0x281ed3+_0xa5cf('0x1f')]>=_0x18f0c6[_0x281ed3+'Capacity']){writeLog(_0x537b9c,_0x18f0c6,_0x281ed3[_0xa5cf('0x21')]()+_0xa5cf('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x550241,_0x2688b5,_0x116f03,_0x24f3c8,_0x38420d){return sendNotification(!![],_0x550241,_0x2688b5,_0x116f03,_0x24f3c8,_0x38420d);};exports[_0xa5cf('0x23')]=function(_0x38b80b,_0x34ead8,_0xa4b703,_0x188de8,_0x279197){return sendNotification(![],_0x38b80b,_0x34ead8,_0xa4b703,_0x188de8,_0x279197);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x39aa=['user:save','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','info','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','socket.io-emitter','emit','name'];(function(_0x23e64b,_0xeb2bf9){var _0x423c84=function(_0x3a9ef4){while(--_0x3a9ef4){_0x23e64b['push'](_0x23e64b['shift']());}};_0x423c84(++_0xeb2bf9);}(_0x39aa,0x11b));var _0xa39a=function(_0x40e609,_0x4e4b74){_0x40e609=_0x40e609-0x0;var _0xf46928=_0x39aa[_0x40e609];return _0xf46928;};'use strict';var _=require(_0xa39a('0x0'));var util=require(_0xa39a('0x1'));var utils=require('../utils');var Mustache=require(_0xa39a('0x2'));var Redis=require(_0xa39a('0x3'));var config=require(_0xa39a('0x4'));var logger=require(_0xa39a('0x5'))(_0xa39a('0x6'));config[_0xa39a('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa39a('0x8'))(new Redis(config[_0xa39a('0x7')]));function emit(_0x2ab0fe,_0x229a62,_0xfd86fe){io['to'](_0x2ab0fe)[_0xa39a('0x9')](_0x229a62,_0xfd86fe);}function sendNotification(_0xfba40,_0x497161,_0x33e7a1,_0x50f3dc,_0x5858d4,_0x24ba17){io['to'](util['format']('user:%s',_0x50f3dc[_0xa39a('0xa')]))[_0xa39a('0x9')](_0xa39a('0xb'),_0x50f3dc);var _0x3d2fcb=_0x24ba17||{};var _0x28d4b3=_0x33e7a1[_0xa39a('0xc')]('.');var _0x2f7468={'uniqueid':_0x497161,'channel':_0x28d4b3[0x0],'id':_0x28d4b3[0x1],'title':_0x28d4b3[0x0]+_0xa39a('0xd'),'interactionId':_0x28d4b3[0x2],'queue':_0x5858d4?_0x5858d4[_0xa39a('0xa')]:null,'sound':_0x3d2fcb['account']['notificationSound'],'shake':_0x3d2fcb[_0xa39a('0xe')][_0xa39a('0xf')]};try{if(!_0x3d2fcb['body']){_0x3d2fcb[_0xa39a('0x10')]={};}if(_0x5858d4){_0x3d2fcb['body'][_0xa39a('0x11')]=_0x5858d4;}else if(_0x3d2fcb['body'][_0xa39a('0x11')]){delete _0x3d2fcb['body'][_0xa39a('0x11')];}_0x2f7468[_0xa39a('0x12')]=utils[_0xa39a('0x13')](_0x3d2fcb[_0xa39a('0xe')][_0xa39a('0x14')],_0x3d2fcb);}catch(_0x27df77){_0x2f7468['msg']=_0xa39a('0x15');logger[_0xa39a('0x16')](util[_0xa39a('0x17')](_0xa39a('0x18'),_0x497161,_0x27df77[_0xa39a('0x19')]));}io['to'](util[_0xa39a('0x17')](_0xa39a('0x1a'),_0x50f3dc[_0xa39a('0xa')]))[_0xa39a('0x9')](util[_0xa39a('0x17')](_0xa39a('0x1b'),_0xfba40?_0xa39a('0x1c'):'remove'),_0x2f7468);}function writeLog(_0x555dfa,_0x127353,_0x562316){return logger[_0xa39a('0x1d')](util[_0xa39a('0x17')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x555dfa,_0x127353['name'],_0x562316));}exports[_0xa39a('0x1e')]=function(_0x988b40,_0x386345,_0x58cf77,_0x373c5f){if(_0x386345['busy']){writeLog(_0x988b40,_0x386345,_0xa39a('0x1f'));return![];}if(!_0x386345[_0xa39a('0x20')]){writeLog(_0x988b40,_0x386345,_0xa39a('0x21'));return![];}if(_0x386345[_0x58cf77+_0xa39a('0x22')]){writeLog(_0x988b40,_0x386345,_0xa39a('0x23'));return![];}if(_0x373c5f&&_0x386345['hasOwnProperty'](_0x58cf77+_0xa39a('0x24'))&&_0x386345[_0xa39a('0x25')](_0x58cf77+_0xa39a('0x26'))){if(_0x386345[_0x58cf77+_0xa39a('0x24')]>0x0&&_0x386345[_0x58cf77+'CurrentCapacity']>=_0x386345[_0x58cf77+'Capacity']){writeLog(_0x988b40,_0x386345,_0x58cf77[_0xa39a('0x27')]()+_0xa39a('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x1a2d1b,_0x57e1e8,_0x2125ed,_0x33a9dd,_0x4ad695){return sendNotification(!![],_0x1a2d1b,_0x57e1e8,_0x2125ed,_0x33a9dd,_0x4ad695);};exports[_0xa39a('0x29')]=function(_0x1a9efb,_0x3d7733,_0x15189d,_0x521cf1,_0xba3ed0){return sendNotification(![],_0x1a9efb,_0x3d7733,_0x15189d,_0x521cf1,_0xba3ed0);};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 2546609..def5484 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 _0x232a=['body','error','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0xa2f9f6,_0x246de1){var _0x51fc05=function(_0x42be7c){while(--_0x42be7c){_0xa2f9f6['push'](_0xa2f9f6['shift']());}};_0x51fc05(++_0x246de1);}(_0x232a,0x1b5));var _0xa232=function(_0x40cb32,_0x4e63e5){_0x40cb32=_0x40cb32-0x0;var _0x199ef2=_0x232a[_0x40cb32];return _0x199ef2;};'use strict';var schema=require(_0xa232('0x0'));var sh=require(_0xa232('0x1'));var _=require('lodash');var utils=require(_0xa232('0x2'));var logger=require(_0xa232('0x3'))(_0xa232('0x4'));var system=schema({'command':{'type':_0xa232('0x5'),'required':!![],'message':_0xa232('0x6')}});exports[_0xa232('0x7')]=function(_0x2fd571,_0x22fbd0){return function(_0x455fcc){try{var _0x90bf78={'command':_0x22fbd0[0x0]};var _0x56268a=system[_0xa232('0x0')](_0x90bf78,{'typecast':!![]});if(_0x56268a[_0xa232('0x8')]){logger['error'](_0xa232('0x9'),_0x2fd571,_[_0xa232('0xa')](_0x56268a,_0xa232('0xb'))[_0xa232('0xc')](',\x20'));logger[_0xa232('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2fd571);_0x455fcc[_0xa232('0xe')]();}else{var _0x1ffb10=this;var _0x46e9a7=utils['getMustacheRender'](_0x22fbd0[0x0],this);logger[_0xa232('0xd')](_0xa232('0xf'),_0x2fd571,_0x46e9a7);sh[_0xa232('0x10')](_[_0xa232('0x11')](_0x46e9a7),function(_0x453e2e,_0x19f6dc){logger['info'](_0xa232('0x12'),_0x2fd571,_0x453e2e);if(_0x453e2e==0x0){var _0x588274=_0x19f6dc['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xa232('0x13')](_0x22fbd0[0x1])||_[_0xa232('0x14')](_0x22fbd0[0x1])){logger[_0xa232('0xd')](_0xa232('0x15'),_0x2fd571);_0x1ffb10[_0xa232('0x16')][_0x22fbd0[0x1]]=_0x588274;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2fd571,_0x22fbd0[0x1],_0x588274);_0x1ffb10['body'][_0x22fbd0[0x1]]=_0x588274;}}_0x455fcc[_0xa232('0xe')]();});}}catch(_0x556cb7){logger[_0xa232('0x17')](_0xa232('0x9'),_0x2fd571,_[_0xa232('0x18')](_0x556cb7)?JSON[_0xa232('0x19')](_0x556cb7):_0x556cb7);logger[_0xa232('0xd')](_0xa232('0x1a'),_0x2fd571);_0x455fcc[_0xa232('0xe')]();}};}; \ No newline at end of file +var _0x3622=['error','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','validate','./utils','../../../../config/logger','routing','string'];(function(_0x595a3f,_0x181942){var _0x4f500e=function(_0x10f7c1){while(--_0x10f7c1){_0x595a3f['push'](_0x595a3f['shift']());}};_0x4f500e(++_0x181942);}(_0x3622,0xeb));var _0x2362=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3622[_0x59ee6f];return _0x4c0979;};'use strict';var schema=require(_0x2362('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x2362('0x1'));var logger=require(_0x2362('0x2'))(_0x2362('0x3'));var system=schema({'command':{'type':_0x2362('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x187731,_0x122e6a){return function(_0x1f3a31){try{var _0x2e8a9e={'command':_0x122e6a[0x0]};var _0x48cf2b=system[_0x2362('0x0')](_0x2e8a9e,{'typecast':!![]});if(_0x48cf2b['length']){logger[_0x2362('0x5')]('[%s][SYSTEM]\x20%s',_0x187731,_[_0x2362('0x6')](_0x48cf2b,_0x2362('0x7'))[_0x2362('0x8')](',\x20'));logger['info'](_0x2362('0x9'),_0x187731);_0x1f3a31[_0x2362('0xa')]();}else{var _0x39b028=this;var _0x575054=utils[_0x2362('0xb')](_0x122e6a[0x0],this);logger[_0x2362('0xc')](_0x2362('0xd'),_0x187731,_0x575054);sh[_0x2362('0xe')](_['trim'](_0x575054),function(_0x4fec06,_0x3abaf2){logger[_0x2362('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x187731,_0x4fec06);if(_0x4fec06==0x0){var _0x4616d6=_0x3abaf2[_0x2362('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x2362('0x10')](_0x122e6a[0x1])||_[_0x2362('0x11')](_0x122e6a[0x1])){logger['info'](_0x2362('0x12'),_0x187731);_0x39b028[_0x2362('0x13')][_0x122e6a[0x1]]=_0x4616d6;}else{logger['info'](_0x2362('0x14'),_0x187731,_0x122e6a[0x1],_0x4616d6);_0x39b028[_0x2362('0x13')][_0x122e6a[0x1]]=_0x4616d6;}}_0x1f3a31['next']();});}}catch(_0x49f039){logger[_0x2362('0x5')](_0x2362('0x15'),_0x187731,_[_0x2362('0x16')](_0x49f039)?JSON[_0x2362('0x17')](_0x49f039):_0x49f039);logger['info'](_0x2362('0x9'),_0x187731);_0x1f3a31[_0x2362('0xa')]();}};}; \ 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 41f87cf..a4ab812 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 _0xe4ad=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','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','info','finally','next','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x571573,_0x2442e4){var _0x1b6bce=function(_0x2ed7c6){while(--_0x2ed7c6){_0x571573['push'](_0x571573['shift']());}};_0x1b6bce(++_0x2442e4);}(_0xe4ad,0x192));var _0xde4a=function(_0x4936a6,_0x201849){_0x4936a6=_0x4936a6-0x0;var _0x331100=_0xe4ad[_0x4936a6];return _0x331100;};'use strict';var schema=require(_0xde4a('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xde4a('0x1')),'openchannelInteraction':require(_0xde4a('0x2')),'smsInteraction':require(_0xde4a('0x3')),'mailInteraction':require(_0xde4a('0x4')),'faxInteraction':require(_0xde4a('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xde4a('0x6'))('routing');var tag=schema({'tag':{'type':_0xde4a('0x7'),'required':!![],'message':_0xde4a('0x8')}});exports[_0xde4a('0x9')]=function(_0x3dcefd,_0x4b067e,_0x55a28c,_0x1f2c3e){return function(_0x254053){try{var _0x164a3d={'tag':_0x4b067e[0x0]};var _0x53b521=tag[_0xde4a('0x0')](_0x164a3d,{'typecast':!![]});if(_0x53b521[_0xde4a('0xa')]){logger[_0xde4a('0xb')]('[%s][TAG]\x20%s',_0x3dcefd,_[_0xde4a('0xc')](_0x53b521,_0xde4a('0xd'))[_0xde4a('0xe')](',\x20'));logger['info'](_0xde4a('0xf'),_0x3dcefd);_0x254053['next']();}else{var _0x28ada7={'ids':[_0x4b067e[0x0]]};if(rpc[_0x1f2c3e[_0xde4a('0x10')]+_0xde4a('0x11')]){rpc[_0x1f2c3e[_0xde4a('0x10')]+'Interaction'][_0xde4a('0x12')](_0x1f2c3e[_0xde4a('0x13')]['id'],_0x28ada7)[_0xde4a('0x14')](function(_0x55d1dc){logger['info'](_0xde4a('0x15'),_0x3dcefd,_0x4b067e[0x1],_0x1f2c3e[_0xde4a('0x10')],_0x1f2c3e[_0xde4a('0x13')]['id']);})[_0xde4a('0x16')](function(_0x263a59){logger[_0xde4a('0xb')](_0xde4a('0x17'),_0x3dcefd,JSON[_0xde4a('0x18')](_0x263a59));logger[_0xde4a('0x19')](_0xde4a('0xf'),_0x3dcefd);})[_0xde4a('0x1a')](function(){_0x254053[_0xde4a('0x1b')]();});}}}catch(_0x45223f){logger[_0xde4a('0xb')]('[%s][TAG]\x20%s',_0x3dcefd,_[_0xde4a('0x1c')](_0x45223f)?JSON[_0xde4a('0x18')](_0x45223f):_0x45223f);logger[_0xde4a('0x19')](_0xde4a('0xf'),_0x3dcefd);_0x254053[_0xde4a('0x1b')]();}};}; \ No newline at end of file +var _0x3149=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','isObject','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3149,0x11f));var _0x9314=function(_0x561590,_0x82ec33){_0x561590=_0x561590-0x0;var _0x51be69=_0x3149[_0x561590];return _0x51be69;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x9314('0x0')),'mailInteraction':require(_0x9314('0x1')),'faxInteraction':require(_0x9314('0x2')),'whatsappInteraction':require(_0x9314('0x3'))};var logger=require(_0x9314('0x4'))(_0x9314('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x9314('0x6')}});exports[_0x9314('0x7')]=function(_0x4e632a,_0x5852a3,_0x3206ea,_0x597d8d){return function(_0x27599c){try{var _0x933250={'tag':_0x5852a3[0x0]};var _0x5a9f71=tag['validate'](_0x933250,{'typecast':!![]});if(_0x5a9f71[_0x9314('0x8')]){logger[_0x9314('0x9')](_0x9314('0xa'),_0x4e632a,_[_0x9314('0xb')](_0x5a9f71,'message')[_0x9314('0xc')](',\x20'));logger[_0x9314('0xd')](_0x9314('0xe'),_0x4e632a);_0x27599c['next']();}else{var _0x236354={'ids':[_0x5852a3[0x0]]};if(rpc[_0x597d8d[_0x9314('0xf')]+_0x9314('0x10')]){rpc[_0x597d8d[_0x9314('0xf')]+'Interaction'][_0x9314('0x11')](_0x597d8d[_0x9314('0x12')]['id'],_0x236354)['then'](function(_0x1e1a51){logger[_0x9314('0xd')](_0x9314('0x13'),_0x4e632a,_0x5852a3[0x1],_0x597d8d['channel'],_0x597d8d[_0x9314('0x12')]['id']);})[_0x9314('0x14')](function(_0x29a8e0){logger[_0x9314('0x9')](_0x9314('0xa'),_0x4e632a,JSON[_0x9314('0x15')](_0x29a8e0));logger['info'](_0x9314('0xe'),_0x4e632a);})[_0x9314('0x16')](function(){_0x27599c[_0x9314('0x17')]();});}}}catch(_0x5094bb){logger[_0x9314('0x9')](_0x9314('0xa'),_0x4e632a,_[_0x9314('0x18')](_0x5094bb)?JSON[_0x9314('0x15')](_0x5094bb):_0x5094bb);logger[_0x9314('0xd')](_0x9314('0xe'),_0x4e632a);_0x27599c[_0x9314('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 6db6862..d065dbe 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 _0xf822=['render','merge','body','message','account','interaction','mustache','exports'];(function(_0x41d1ce,_0x37f542){var _0x38d022=function(_0x57d3ff){while(--_0x57d3ff){_0x41d1ce['push'](_0x41d1ce['shift']());}};_0x38d022(++_0x37f542);}(_0xf822,0x19e));var _0x2f82=function(_0x4e6f48,_0x4d7b34){_0x4e6f48=_0x4e6f48-0x0;var _0x266a39=_0xf822[_0x4e6f48];return _0x266a39;};'use strict';var Mustache=require(_0x2f82('0x0'));var _=require('lodash');module[_0x2f82('0x1')]={'getMustacheRender':function(_0x2e79de,_0x45ab5e){return Mustache[_0x2f82('0x2')](_0x2e79de,_[_0x2f82('0x3')](_0x45ab5e[_0x2f82('0x4')],{'contact':_0x45ab5e['contact'],'message':_0x45ab5e[_0x2f82('0x5')],'account':_0x45ab5e[_0x2f82('0x6')],'interaction':_0x45ab5e[_0x2f82('0x7')],'list':_0x45ab5e['list']}))||'';}}; \ No newline at end of file +var _0x6f7f=['body','message','account','interaction','lodash','exports','render'];(function(_0x165f06,_0x3862b5){var _0x5981a0=function(_0x432a24){while(--_0x432a24){_0x165f06['push'](_0x165f06['shift']());}};_0x5981a0(++_0x3862b5);}(_0x6f7f,0x177));var _0xf6f7=function(_0x184001,_0x50abed){_0x184001=_0x184001-0x0;var _0xd230ad=_0x6f7f[_0x184001];return _0xd230ad;};'use strict';var Mustache=require('mustache');var _=require(_0xf6f7('0x0'));module[_0xf6f7('0x1')]={'getMustacheRender':function(_0x2b4ee7,_0x2e063e){return Mustache[_0xf6f7('0x2')](_0x2b4ee7,_['merge'](_0x2e063e[_0xf6f7('0x3')],{'contact':_0x2e063e['contact'],'message':_0x2e063e[_0xf6f7('0x4')],'account':_0x2e063e[_0xf6f7('0x5')],'interaction':_0x2e063e[_0xf6f7('0x6')],'list':_0x2e063e['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index bd67805..fdbf735 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 _0x98ba=['execute','info','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','IntervalId','isNil','map','Intervals','interval','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','autoreply','split','push','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under'];(function(_0x30a528,_0x1d04f2){var _0x3e029c=function(_0x4e4b97){while(--_0x4e4b97){_0x30a528['push'](_0x30a528['shift']());}};_0x3e029c(++_0x1d04f2);}(_0x98ba,0x19e));var _0xa98b=function(_0x1a0dfa,_0x1208b0){_0x1a0dfa=_0x1a0dfa-0x0;var _0x50499d=_0x98ba[_0x1a0dfa];return _0x50499d;};'use strict';var _=require(_0xa98b('0x0'));var util=require(_0xa98b('0x1'));var path=require(_0xa98b('0x2'));var fs=require('fs');var jayson=require(_0xa98b('0x3'));var BPromise=require(_0xa98b('0x4'));var uuid=require('uuid');var config=require(_0xa98b('0x5'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0xa98b('0x6')),'mailQueueReport':require(_0xa98b('0x7')),'chatQueueReport':require(_0xa98b('0x8')),'smsQueueReport':require(_0xa98b('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa98b('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x36b46f,_0x21b4b3,_0xccddbe){return util[_0xa98b('0xb')]('%s.%s.%s',_0x36b46f,_0x21b4b3||0x0,_0xccddbe||0x0);}function getIntervals(_0x5451ee,_0x199d1b){var _0x4ecf3e=[];if(!_['isNil'](_0x199d1b[_0xa98b('0xc')])&&!_[_0xa98b('0xd')](_0x5451ee[_0x199d1b['IntervalId']])&&!_[_0xa98b('0xd')](_0x5451ee[_0x199d1b['IntervalId']]['Intervals'])){_0x4ecf3e=_[_0xa98b('0xe')](_0x5451ee[_0x199d1b[_0xa98b('0xc')]][_0xa98b('0xf')],'interval');}else if(!_[_0xa98b('0xd')](_0x199d1b['interval'])){_0x4ecf3e=[_0x199d1b[_0xa98b('0x10')]];}return _0x4ecf3e;}exports['listen']=function(_0x2b1ca2){_0x2b1ca2[_0xa98b('0x11')]={};return new BPromise(function(_0x337d8d,_0x598106){var _0xa93b34={'Start':function(_0xccff88){var _0x320e62=this;return new Promise(function(_0x14bcef,_0x31ef50){if(_0xccff88){try{var _0x372369=[];var _0x7d5a2e=getId(_0xccff88[_0xa98b('0x12')],_0xccff88[_0xa98b('0x13')]?_0xccff88[_0xa98b('0x13')]['id']:0x0,_0xccff88[_0xa98b('0x14')]?_0xccff88[_0xa98b('0x14')]['id']:0x0);if(_0xccff88['applications']&&_[_0xa98b('0x15')](_0xccff88['applications'])&&_0xccff88[_0xa98b('0x16')][_0xa98b('0x17')]){for(var _0x47626c=0x0;_0x47626c<_0xccff88['applications']['length'];_0x47626c+=0x1){var _0x33eebb=_0xccff88[_0xa98b('0x16')][_0x47626c];if(fs[_0xa98b('0x18')](path[_0xa98b('0x19')](__dirname,_0xa98b('0x16'),_0x33eebb[_0xa98b('0x1a')]+_0xa98b('0x1b')))){var _0x490b01=[];switch(_0x33eebb['app']['toLowerCase']()){case _0xa98b('0x1c'):var _0x458182=_0x33eebb['appdata'][_0xa98b('0x1d')](',');_0x490b01['push'](_0x458182[0x0]);_0x490b01[_0xa98b('0x1e')](_0x458182['slice'](0x1,_0x458182[_0xa98b('0x17')])[_0xa98b('0x19')](','));break;case _0xa98b('0x1f'):var _0x40ee5a=_0x33eebb[_0xa98b('0x20')]['split'](',');_0x490b01[_0xa98b('0x1e')](_0x40ee5a[0x0]);_0x490b01[_0xa98b('0x1e')](_0x40ee5a[0x1]);_0x490b01[_0xa98b('0x1e')](_0x40ee5a['slice'](0x2,_0x40ee5a[_0xa98b('0x17')])[_0xa98b('0x19')](','));break;case _0xa98b('0x21'):var _0xb82456=_0x33eebb['appdata'][_0xa98b('0x1d')](',');_0x490b01[_0xa98b('0x1e')](_0xb82456[0x0]);_0x490b01[_0xa98b('0x1e')](_0xb82456[0x1]);_0x490b01[_0xa98b('0x1e')](_0xb82456[0x2]);_0x490b01[_0xa98b('0x1e')](_0xb82456[0x3]);_0x490b01[_0xa98b('0x1e')](_0xb82456['slice'](0x4,_0xb82456['length'])[_0xa98b('0x19')](','));break;case _0xa98b('0x13'):_0x490b01['push'](_0x33eebb[_0xa98b('0x20')]);break;case _0xa98b('0x22'):_0x490b01[_0xa98b('0x1e')](_0x33eebb[_0xa98b('0x23')]);_0x490b01[_0xa98b('0x1e')](_0x33eebb[_0xa98b('0x20')]);break;default:_0x490b01=_['isNil'](_0x33eebb[_0xa98b('0x20')])?[]:_0x33eebb['appdata'][_0xa98b('0x1d')](',');}var _0x3d690f={'id':util[_0xa98b('0xb')](_0xa98b('0x24'),_0x7d5a2e,_0x33eebb['id'],_0x33eebb[_0xa98b('0x1a')]),'condition':require(_0xa98b('0x25'))[_0xa98b('0x26')](_0x7d5a2e,getIntervals(_0x2b1ca2[_0xa98b('0x27')],_0x33eebb),_0x2b1ca2),'consequence':require(_0xa98b('0x28')+_0x33eebb[_0xa98b('0x1a')])['consequence'](_0x7d5a2e,_0x490b01,_0x2b1ca2,_0xccff88),'p':_0x33eebb[_0xa98b('0x29')]||0x0};logger['info'](_0xa98b('0x2a'),_0x3d690f['id'],_0xa98b('0x2b'),getIntervals(_0x2b1ca2[_0xa98b('0x27')],_0x33eebb)[_0xa98b('0x19')](_0xa98b('0x2c')));_0x372369['push'](_0x3d690f);}else{logger['error'](_0xa98b('0x2d'),path[_0xa98b('0x19')](__dirname,_0xa98b('0x16'),_0x33eebb['app']+_0xa98b('0x1b')));}}_0x2b1ca2[_0xa98b('0x11')][_0x7d5a2e]=new RuleEngine(_0x372369);_0x2b1ca2[_0xa98b('0x11')][_0x7d5a2e][_0xa98b('0x2e')](_0xccff88,function(_0x583a52){logger[_0xa98b('0x2f')]('Applications\x20executed',JSON['stringify'](_0x583a52['matchPath']));if(_0x2b1ca2[_0xa98b('0x11')][_0x7d5a2e]){_0x2b1ca2[_0xa98b('0x11')][_0x7d5a2e][_0xa98b('0x30')](_0xa98b('0x31'));}});return _0x14bcef({'code':0xc8,'message':_0xccff88});}else{logger[_0xa98b('0x2f')](_0xa98b('0x32'));return _0x14bcef({'code':0xc8,'message':_0xccff88});}}catch(_0x3ac1e9){logger[_0xa98b('0x33')](_0x3ac1e9[_0xa98b('0x34')]);return _0x31ef50(_0x320e62['error'](0x1f4,_0x3ac1e9));}}return _0x31ef50(_0xa98b('0x35'));});},'AcceptMessage':function(_0x28469d){var _0x4d032a=this;return new Promise(function(_0x35558f,_0x18751f){if(_0x28469d['message']&&_0x28469d[_0xa98b('0x13')]['id']){try{var _0x36888f=getId(_0x28469d[_0xa98b('0x12')],_0x28469d[_0xa98b('0x13')]?_0x28469d[_0xa98b('0x13')]['id']:0x0,_0x28469d['interaction']?_0x28469d[_0xa98b('0x14')]['id']:0x0);if(_0x2b1ca2[_0xa98b('0x11')][_0x36888f]){_0x2b1ca2['rules'][_0x36888f]['emit'](_0xa98b('0x36'));if(rpc[_0x28469d['channel']+_0xa98b('0x37')]){rpc[_0x28469d['channel']+_0xa98b('0x37')][_0xa98b('0x38')](_0x36888f,{'UserId':_0x28469d[_0xa98b('0x13')][_0xa98b('0x39')]})[_0xa98b('0x3a')](function(_0x40736f){logger['error'](_0xa98b('0x3b'));});}}return _0x35558f({'code':0xc8,'message':_0x28469d});}catch(_0x48e7e8){logger[_0xa98b('0x33')](_0x48e7e8[_0xa98b('0x34')]);return _0x18751f(_0x4d032a['error'](0x1f4,_0x48e7e8));}}logger[_0xa98b('0x33')](_0xa98b('0x3c'));return _0x18751f(_0x4d032a['error'](0x1f4,_0xa98b('0x3c')));});},'RejectMessage':function(_0x37d609){var _0x1323b4=this;return new Promise(function(_0x12104c,_0x12431a){if(_0x37d609[_0xa98b('0x3d')]&&_0x37d609[_0xa98b('0x3d')]['id']){try{if(_0x2b1ca2[_0xa98b('0x3e')][_0x37d609[_0xa98b('0x3d')]['id']]){_0x2b1ca2[_0xa98b('0x3e')][_0x37d609[_0xa98b('0x3d')]['id']][_0xa98b('0x3f')]=![];_0x2b1ca2[_0xa98b('0x3e')][_0x37d609[_0xa98b('0x3d')]['id']][_0xa98b('0x40')]=undefined;}return _0x12104c({'code':0xc8,'message':_0x37d609});}catch(_0x3d9324){logger[_0xa98b('0x33')](_0x3d9324[_0xa98b('0x34')]);return _0x12431a(_0x1323b4['error'](0x1f4,_0x3d9324));}}logger[_0xa98b('0x33')]('message\x20is\x20empty');return _0x12431a(_0x1323b4[_0xa98b('0x33')](0x1f4,_0xa98b('0x3c')));});},'AbandonInteraction':function(_0x1fb998){var _0x431d99=this;return new Promise(function(_0x4a23f6,_0x14e878){if(_0x1fb998[_0xa98b('0x12')]&&_0x1fb998[_0xa98b('0x14')]&&_0x1fb998[_0xa98b('0x14')]['id']){try{var _0x2553df=getId(_0x1fb998[_0xa98b('0x12')],_0x1fb998['message']?_0x1fb998[_0xa98b('0x13')]['id']:0x0,_0x1fb998[_0xa98b('0x14')]?_0x1fb998[_0xa98b('0x14')]['id']:0x0);if(_0x2b1ca2[_0xa98b('0x11')][_0x2553df]){_0x2b1ca2[_0xa98b('0x11')][_0x2553df][_0xa98b('0x30')](_0xa98b('0x36'));}return _0x4a23f6({'code':0xc8,'message':_0x1fb998});}catch(_0x3d9f63){logger['error'](_0x3d9f63['stack']);return _0x14e878(_0x431d99[_0xa98b('0x33')](0x1f4,_0x3d9f63));}}logger[_0xa98b('0x33')]('message\x20is\x20empty');return _0x14e878(_0x431d99['error'](0x1f4,_0xa98b('0x3c')));});},'AgentCapacity':function(_0xe85ee9){var _0x5159a6=this;return new Promise(function(_0x35a578,_0x2d5174){if(_0x2b1ca2['agents']['hasOwnProperty'](_0xe85ee9['id'])){for(var _0x3e0f71 in _0xe85ee9['capacity']){if(_0xe85ee9[_0xa98b('0x41')][_0xa98b('0x42')](_0x3e0f71)){if(_0x2b1ca2[_0xa98b('0x3e')][_0xe85ee9['id']]['hasOwnProperty'](_0x3e0f71+_0xa98b('0x43'))){_0x2b1ca2[_0xa98b('0x3e')][_0xe85ee9['id']][_0x3e0f71+_0xa98b('0x43')]=parseInt(_0xe85ee9[_0xa98b('0x41')][_0x3e0f71],0xa);}}}_0x2b1ca2['agents'][_0xe85ee9['id']][_0xa98b('0x44')]();return _0x35a578({'code':0xc8,'message':_0x2b1ca2[_0xa98b('0x3e')][_0xe85ee9['id']]});}else{return _0x2d5174(_0x5159a6[_0xa98b('0x33')](0x1f4,_0xa98b('0x45')));}});},'Agents':function(_0xf6e0e9){return new Promise(function(_0x5330f7,_0x1bebbb){var _0x159cc2=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x3e')]);_0x5330f7({'count':_0x159cc2[_0xa98b('0x17')],'rows':_0x159cc2});});},'ChatQueues':function(_0x22f7eb){return new Promise(function(_0x34b2d8,_0x3ca901){var _0x1e1b35=[];for(var _0x1b835d in _0x2b1ca2[_0xa98b('0x47')]){if(_0x2b1ca2[_0xa98b('0x47')]['hasOwnProperty'](_0x1b835d)){var _0x5267bc=_0x2b1ca2[_0xa98b('0x47')][_0x1b835d];var _0x1324c2={'id':_0x5267bc['id'],'available':_0x5267bc[_0xa98b('0x48')],'loggedIn':_0x5267bc[_0xa98b('0x49')],'name':_0x5267bc[_0xa98b('0x4a')],'paused':_0x5267bc[_0xa98b('0x4b')],'waiting':_0x5267bc['waiting']};_0x1e1b35[_0xa98b('0x1e')](_0x1324c2);}}_0x34b2d8({'count':_0x1e1b35[_0xa98b('0x17')],'rows':_0x1e1b35});});},'MailQueues':function(_0x1e6e61){return new Promise(function(_0x4b2f09,_0x29f8e5){var _0x2bc086=[];for(var _0x2b90aa in _0x2b1ca2['mailQueues']){if(_0x2b1ca2[_0xa98b('0x4c')][_0xa98b('0x42')](_0x2b90aa)){var _0x1e5b55=_0x2b1ca2[_0xa98b('0x4c')][_0x2b90aa];var _0x32d661={'id':_0x1e5b55['id'],'available':_0x1e5b55['available'],'loggedIn':_0x1e5b55[_0xa98b('0x49')],'name':_0x1e5b55[_0xa98b('0x4a')],'paused':_0x1e5b55[_0xa98b('0x4b')],'waiting':_0x1e5b55[_0xa98b('0x4d')]};_0x2bc086[_0xa98b('0x1e')](_0x32d661);}}_0x4b2f09({'count':_0x2bc086['length'],'rows':_0x2bc086});});},'OpenchannelQueues':function(_0x1024f6){return new Promise(function(_0x19e21b,_0x3f4bf6){var _0x464f6b=[];for(var _0x2cfbf0 in _0x2b1ca2[_0xa98b('0x4e')]){if(_0x2b1ca2[_0xa98b('0x4e')][_0xa98b('0x42')](_0x2cfbf0)){var _0x2343c1=_0x2b1ca2[_0xa98b('0x4e')][_0x2cfbf0];var _0xae243c={'id':_0x2343c1['id'],'available':_0x2343c1['available'],'loggedIn':_0x2343c1[_0xa98b('0x49')],'name':_0x2343c1[_0xa98b('0x4a')],'paused':_0x2343c1[_0xa98b('0x4b')],'waiting':_0x2343c1['waiting']};_0x464f6b[_0xa98b('0x1e')](_0xae243c);}}_0x19e21b({'count':_0x464f6b['length'],'rows':_0x464f6b});});},'SmsQueues':function(_0x48a3e2){return new Promise(function(_0x1e14c3,_0x2b5c68){var _0x23d549=[];for(var _0x336ad6 in _0x2b1ca2['smsQueues']){if(_0x2b1ca2[_0xa98b('0x4f')][_0xa98b('0x42')](_0x336ad6)){var _0x2bbd37=_0x2b1ca2[_0xa98b('0x4f')][_0x336ad6];var _0x550842={'id':_0x2bbd37['id'],'available':_0x2bbd37[_0xa98b('0x48')],'loggedIn':_0x2bbd37[_0xa98b('0x49')],'name':_0x2bbd37[_0xa98b('0x4a')],'paused':_0x2bbd37['paused'],'waiting':_0x2bbd37[_0xa98b('0x4d')]};_0x23d549['push'](_0x550842);}}_0x1e14c3({'count':_0x23d549[_0xa98b('0x17')],'rows':_0x23d549});});},'FaxQueues':function(_0x43bd55){return new Promise(function(_0x1f85a2,_0x7c553b){var _0x5df01b=[];for(var _0xfc3a12 in _0x2b1ca2[_0xa98b('0x50')]){if(_0x2b1ca2['faxQueues'][_0xa98b('0x42')](_0xfc3a12)){var _0x43059a=_0x2b1ca2[_0xa98b('0x50')][_0xfc3a12];var _0x2cad4d={'id':_0x43059a['id'],'available':_0x43059a[_0xa98b('0x48')],'loggedIn':_0x43059a['loggedIn'],'name':_0x43059a[_0xa98b('0x4a')],'paused':_0x43059a['paused'],'waiting':_0x43059a[_0xa98b('0x4d')]};_0x5df01b[_0xa98b('0x1e')](_0x2cad4d);}}_0x1f85a2({'count':_0x5df01b['length'],'rows':_0x5df01b});});},'WhatsappQueues':function(_0x54abf7){return new Promise(function(_0xe32bd4,_0x577cc3){var _0xf63b81=[];for(var _0x75ba2d in _0x2b1ca2[_0xa98b('0x51')]){if(_0x2b1ca2[_0xa98b('0x51')][_0xa98b('0x42')](_0x75ba2d)){var _0x4fd61a=_0x2b1ca2[_0xa98b('0x51')][_0x75ba2d];var _0x50f9a8={'id':_0x4fd61a['id'],'available':_0x4fd61a[_0xa98b('0x48')],'loggedIn':_0x4fd61a[_0xa98b('0x49')],'name':_0x4fd61a['name'],'paused':_0x4fd61a[_0xa98b('0x4b')],'waiting':_0x4fd61a[_0xa98b('0x4d')]};_0xf63b81[_0xa98b('0x1e')](_0x50f9a8);}}_0xe32bd4({'count':_0xf63b81['length'],'rows':_0xf63b81});});},'ChatQueuesWaitingInteractions':function(_0x149d2c){return new Promise(function(_0x5977f1,_0x11536a){var _0x588bf9=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x52')]);_0x5977f1({'count':_0x588bf9[_0xa98b('0x17')],'rows':_0x588bf9});});},'MailQueuesWaitingInteractions':function(_0x8406ea){return new Promise(function(_0x3927a2,_0x1465ab){var _0x823e2d=_['values'](_0x2b1ca2['mailQueuesWaitingInteractions']);_0x3927a2({'count':_0x823e2d[_0xa98b('0x17')],'rows':_0x823e2d});});},'OpenchannelQueuesWaitingInteractions':function(_0x5001d6){return new Promise(function(_0x324a24,_0x1a0288){var _0x22aaa6=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x53')]);_0x324a24({'count':_0x22aaa6[_0xa98b('0x17')],'rows':_0x22aaa6});});},'SmsQueuesWaitingInteractions':function(_0x427a7b){return new Promise(function(_0x25f97a,_0x225c90){var _0x4445b6=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x54')]);_0x25f97a({'count':_0x4445b6[_0xa98b('0x17')],'rows':_0x4445b6});});},'FaxQueuesWaitingInteractions':function(_0x287a49){return new Promise(function(_0x2d6629,_0x3ed0a7){var _0x1da291=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x55')]);_0x2d6629({'count':_0x1da291[_0xa98b('0x17')],'rows':_0x1da291});});},'WhatsappQueuesWaitingInteractions':function(_0x109c55){return new Promise(function(_0x558974,_0x51c6d5){var _0x5e5e4b=_[_0xa98b('0x46')](_0x2b1ca2[_0xa98b('0x56')]);_0x558974({'count':_0x5e5e4b[_0xa98b('0x17')],'rows':_0x5e5e4b});});}};var _0x265593=jayson[_0xa98b('0x57')](_0xa93b34)[_0xa98b('0x58')]();_0x265593['on'](_0xa98b('0x33'),function(_0x179a76){logger['error'](JSON['stringify'](_0x179a76));return _0x598106(_0x179a76);});_0x265593[_0xa98b('0x59')](0x232c,'127.0.0.1',function(){console[_0xa98b('0x5a')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x337d8d(_0xa98b('0x5b')+0x232c);});});}; \ No newline at end of file +var _0x0f6a=['isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','dialogflow','slice','amazonlex','TagId','./interval','condition','intervals','consequence','info','Push\x20new\x20rule','error','rules','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','jayson/promise','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','channel','message','interaction','applications'];(function(_0x909030,_0x175d21){var _0x238cdd=function(_0x1bf5be){while(--_0x1bf5be){_0x909030['push'](_0x909030['shift']());}};_0x238cdd(++_0x175d21);}(_0x0f6a,0x1ed));var _0xa0f6=function(_0x526ffb,_0x17b139){_0x526ffb=_0x526ffb-0x0;var _0x305b3d=_0x0f6a[_0x526ffb];return _0x305b3d;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0xa0f6('0x0'));var fs=require('fs');var jayson=require(_0xa0f6('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa0f6('0x2'));var config=require(_0xa0f6('0x3'));var logger=require('../../../config/logger')(_0xa0f6('0x4'));var rpc={'openchannelQueueReport':require(_0xa0f6('0x5')),'mailQueueReport':require(_0xa0f6('0x6')),'chatQueueReport':require(_0xa0f6('0x7')),'smsQueueReport':require(_0xa0f6('0x8')),'faxQueueReport':require(_0xa0f6('0x9')),'whatsappQueueReport':require(_0xa0f6('0xa'))};var RuleEngine=require(_0xa0f6('0xb'));function getId(_0x203989,_0x4a399f,_0x5451e4){return util[_0xa0f6('0xc')](_0xa0f6('0xd'),_0x203989,_0x4a399f||0x0,_0x5451e4||0x0);}function getIntervals(_0x19ff0a,_0x2a781c){var _0x5c5bec=[];if(!_[_0xa0f6('0xe')](_0x2a781c[_0xa0f6('0xf')])&&!_[_0xa0f6('0xe')](_0x19ff0a[_0x2a781c['IntervalId']])&&!_[_0xa0f6('0xe')](_0x19ff0a[_0x2a781c['IntervalId']]['Intervals'])){_0x5c5bec=_[_0xa0f6('0x10')](_0x19ff0a[_0x2a781c['IntervalId']][_0xa0f6('0x11')],'interval');}else if(!_['isNil'](_0x2a781c[_0xa0f6('0x12')])){_0x5c5bec=[_0x2a781c['interval']];}return _0x5c5bec;}exports['listen']=function(_0x33637e){_0x33637e['rules']={};return new BPromise(function(_0x58c3ce,_0x5b014a){var _0xfd4b45={'Start':function(_0x21fe04){var _0x5d3e4d=this;return new Promise(function(_0x36b3cb,_0x289b0d){if(_0x21fe04){try{var _0x354725=[];var _0x15e206=getId(_0x21fe04[_0xa0f6('0x13')],_0x21fe04[_0xa0f6('0x14')]?_0x21fe04[_0xa0f6('0x14')]['id']:0x0,_0x21fe04[_0xa0f6('0x15')]?_0x21fe04['interaction']['id']:0x0);if(_0x21fe04[_0xa0f6('0x16')]&&_[_0xa0f6('0x17')](_0x21fe04[_0xa0f6('0x16')])&&_0x21fe04[_0xa0f6('0x16')]['length']){for(var _0x11d43a=0x0;_0x11d43a<_0x21fe04['applications'][_0xa0f6('0x18')];_0x11d43a+=0x1){var _0x2020df=_0x21fe04[_0xa0f6('0x16')][_0x11d43a];if(fs[_0xa0f6('0x19')](path[_0xa0f6('0x1a')](__dirname,'applications',_0x2020df[_0xa0f6('0x1b')]+_0xa0f6('0x1c')))){var _0x2549b8=[];switch(_0x2020df[_0xa0f6('0x1b')][_0xa0f6('0x1d')]()){case _0xa0f6('0x1e'):var _0x5d8a2e=_0x2020df[_0xa0f6('0x1f')][_0xa0f6('0x20')](',');_0x2549b8[_0xa0f6('0x21')](_0x5d8a2e[0x0]);_0x2549b8[_0xa0f6('0x21')](_0x5d8a2e['slice'](0x1,_0x5d8a2e[_0xa0f6('0x18')])[_0xa0f6('0x1a')](','));break;case _0xa0f6('0x22'):var _0xcf6788=_0x2020df[_0xa0f6('0x1f')][_0xa0f6('0x20')](',');_0x2549b8['push'](_0xcf6788[0x0]);_0x2549b8['push'](_0xcf6788[0x1]);_0x2549b8[_0xa0f6('0x21')](_0xcf6788[_0xa0f6('0x23')](0x2,_0xcf6788[_0xa0f6('0x18')])[_0xa0f6('0x1a')](','));break;case _0xa0f6('0x24'):var _0xe4f679=_0x2020df[_0xa0f6('0x1f')]['split'](',');_0x2549b8[_0xa0f6('0x21')](_0xe4f679[0x0]);_0x2549b8[_0xa0f6('0x21')](_0xe4f679[0x1]);_0x2549b8[_0xa0f6('0x21')](_0xe4f679[0x2]);_0x2549b8[_0xa0f6('0x21')](_0xe4f679[0x3]);_0x2549b8['push'](_0xe4f679[_0xa0f6('0x23')](0x4,_0xe4f679[_0xa0f6('0x18')])['join'](','));break;case _0xa0f6('0x14'):_0x2549b8['push'](_0x2020df[_0xa0f6('0x1f')]);break;case'tag':_0x2549b8[_0xa0f6('0x21')](_0x2020df[_0xa0f6('0x25')]);_0x2549b8['push'](_0x2020df[_0xa0f6('0x1f')]);break;default:_0x2549b8=_['isNil'](_0x2020df[_0xa0f6('0x1f')])?[]:_0x2020df[_0xa0f6('0x1f')]['split'](',');}var _0x4f5535={'id':util[_0xa0f6('0xc')]('%s:%s:%s',_0x15e206,_0x2020df['id'],_0x2020df['app']),'condition':require(_0xa0f6('0x26'))[_0xa0f6('0x27')](_0x15e206,getIntervals(_0x33637e[_0xa0f6('0x28')],_0x2020df),_0x33637e),'consequence':require('./applications/'+_0x2020df['app'])[_0xa0f6('0x29')](_0x15e206,_0x2549b8,_0x33637e,_0x21fe04),'p':_0x2020df['priority']||0x0};logger[_0xa0f6('0x2a')](_0xa0f6('0x2b'),_0x4f5535['id'],'on\x20interval',getIntervals(_0x33637e[_0xa0f6('0x28')],_0x2020df)['join']('\x20|\x20'));_0x354725[_0xa0f6('0x21')](_0x4f5535);}else{logger[_0xa0f6('0x2c')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xa0f6('0x1a')](__dirname,_0xa0f6('0x16'),_0x2020df[_0xa0f6('0x1b')]+_0xa0f6('0x1c')));}}_0x33637e[_0xa0f6('0x2d')][_0x15e206]=new RuleEngine(_0x354725);_0x33637e[_0xa0f6('0x2d')][_0x15e206]['execute'](_0x21fe04,function(_0xc0c975){logger[_0xa0f6('0x2a')]('Applications\x20executed',JSON[_0xa0f6('0x2e')](_0xc0c975[_0xa0f6('0x2f')]));if(_0x33637e[_0xa0f6('0x2d')][_0x15e206]){_0x33637e['rules'][_0x15e206][_0xa0f6('0x30')]('complete');}});return _0x36b3cb({'code':0xc8,'message':_0x21fe04});}else{logger[_0xa0f6('0x2a')](_0xa0f6('0x31'));return _0x36b3cb({'code':0xc8,'message':_0x21fe04});}}catch(_0x4f9093){logger[_0xa0f6('0x2c')](_0x4f9093[_0xa0f6('0x32')]);return _0x289b0d(_0x5d3e4d[_0xa0f6('0x2c')](0x1f4,_0x4f9093));}}return _0x289b0d(_0xa0f6('0x33'));});},'AcceptMessage':function(_0x4d20ca){var _0x5e9b91=this;return new Promise(function(_0x2fa870,_0x47f1b9){if(_0x4d20ca['message']&&_0x4d20ca[_0xa0f6('0x14')]['id']){try{var _0x3b17f4=getId(_0x4d20ca[_0xa0f6('0x13')],_0x4d20ca['message']?_0x4d20ca[_0xa0f6('0x14')]['id']:0x0,_0x4d20ca[_0xa0f6('0x15')]?_0x4d20ca['interaction']['id']:0x0);if(_0x33637e[_0xa0f6('0x2d')][_0x3b17f4]){_0x33637e['rules'][_0x3b17f4][_0xa0f6('0x30')]('end');if(rpc[_0x4d20ca['channel']+'QueueReport']){rpc[_0x4d20ca['channel']+_0xa0f6('0x34')][_0xa0f6('0x35')](_0x3b17f4,{'UserId':_0x4d20ca[_0xa0f6('0x14')][_0xa0f6('0x36')]})[_0xa0f6('0x37')](function(_0x3a8645){logger['error']('error\x20update\x20queue\x20report');});}}return _0x2fa870({'code':0xc8,'message':_0x4d20ca});}catch(_0x1d355b){logger[_0xa0f6('0x2c')](_0x1d355b['stack']);return _0x47f1b9(_0x5e9b91[_0xa0f6('0x2c')](0x1f4,_0x1d355b));}}logger[_0xa0f6('0x2c')](_0xa0f6('0x38'));return _0x47f1b9(_0x5e9b91[_0xa0f6('0x2c')](0x1f4,_0xa0f6('0x38')));});},'RejectMessage':function(_0x42f223){var _0x5de471=this;return new Promise(function(_0x155e45,_0x2bb98c){if(_0x42f223[_0xa0f6('0x39')]&&_0x42f223[_0xa0f6('0x39')]['id']){try{if(_0x33637e['agents'][_0x42f223['agent']['id']]){_0x33637e['agents'][_0x42f223[_0xa0f6('0x39')]['id']]['busy']=![];_0x33637e[_0xa0f6('0x3a')][_0x42f223[_0xa0f6('0x39')]['id']][_0xa0f6('0x3b')]=undefined;}return _0x155e45({'code':0xc8,'message':_0x42f223});}catch(_0x8e11c6){logger[_0xa0f6('0x2c')](_0x8e11c6[_0xa0f6('0x32')]);return _0x2bb98c(_0x5de471[_0xa0f6('0x2c')](0x1f4,_0x8e11c6));}}logger[_0xa0f6('0x2c')](_0xa0f6('0x38'));return _0x2bb98c(_0x5de471[_0xa0f6('0x2c')](0x1f4,_0xa0f6('0x38')));});},'AbandonInteraction':function(_0x136d6c){var _0x5ed48d=this;return new Promise(function(_0x4d9e94,_0x58a66a){if(_0x136d6c[_0xa0f6('0x13')]&&_0x136d6c[_0xa0f6('0x15')]&&_0x136d6c['interaction']['id']){try{var _0xd29ac1=getId(_0x136d6c[_0xa0f6('0x13')],_0x136d6c['message']?_0x136d6c['message']['id']:0x0,_0x136d6c['interaction']?_0x136d6c['interaction']['id']:0x0);if(_0x33637e[_0xa0f6('0x2d')][_0xd29ac1]){_0x33637e['rules'][_0xd29ac1][_0xa0f6('0x30')]('end');}return _0x4d9e94({'code':0xc8,'message':_0x136d6c});}catch(_0x347642){logger[_0xa0f6('0x2c')](_0x347642['stack']);return _0x58a66a(_0x5ed48d[_0xa0f6('0x2c')](0x1f4,_0x347642));}}logger['error'](_0xa0f6('0x38'));return _0x58a66a(_0x5ed48d['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1b1914){var _0x19e71a=this;return new Promise(function(_0x2544a9,_0x1d96c8){if(_0x33637e[_0xa0f6('0x3a')][_0xa0f6('0x3c')](_0x1b1914['id'])){for(var _0x4c24f5 in _0x1b1914['capacity']){if(_0x1b1914[_0xa0f6('0x3d')][_0xa0f6('0x3c')](_0x4c24f5)){if(_0x33637e[_0xa0f6('0x3a')][_0x1b1914['id']]['hasOwnProperty'](_0x4c24f5+_0xa0f6('0x3e'))){_0x33637e[_0xa0f6('0x3a')][_0x1b1914['id']][_0x4c24f5+_0xa0f6('0x3e')]=parseInt(_0x1b1914[_0xa0f6('0x3d')][_0x4c24f5],0xa);}}}_0x33637e[_0xa0f6('0x3a')][_0x1b1914['id']][_0xa0f6('0x3f')]();return _0x2544a9({'code':0xc8,'message':_0x33637e[_0xa0f6('0x3a')][_0x1b1914['id']]});}else{return _0x1d96c8(_0x19e71a['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2a8c2d){return new Promise(function(_0x848e62,_0x33b4f0){var _0x3ee536=_['values'](_0x33637e[_0xa0f6('0x3a')]);_0x848e62({'count':_0x3ee536[_0xa0f6('0x18')],'rows':_0x3ee536});});},'ChatQueues':function(_0x20bad8){return new Promise(function(_0x416dfb,_0x5e10ce){var _0x3792ce=[];for(var _0x24b5e1 in _0x33637e[_0xa0f6('0x40')]){if(_0x33637e[_0xa0f6('0x40')][_0xa0f6('0x3c')](_0x24b5e1)){var _0x2859cd=_0x33637e[_0xa0f6('0x40')][_0x24b5e1];var _0x3f33d7={'id':_0x2859cd['id'],'available':_0x2859cd[_0xa0f6('0x41')],'loggedIn':_0x2859cd['loggedIn'],'name':_0x2859cd[_0xa0f6('0x42')],'paused':_0x2859cd[_0xa0f6('0x43')],'waiting':_0x2859cd[_0xa0f6('0x44')]};_0x3792ce[_0xa0f6('0x21')](_0x3f33d7);}}_0x416dfb({'count':_0x3792ce[_0xa0f6('0x18')],'rows':_0x3792ce});});},'MailQueues':function(_0x5c651a){return new Promise(function(_0x3e3d27,_0x3f7a08){var _0x5c67a4=[];for(var _0x3e3ffb in _0x33637e['mailQueues']){if(_0x33637e[_0xa0f6('0x45')][_0xa0f6('0x3c')](_0x3e3ffb)){var _0x43e219=_0x33637e[_0xa0f6('0x45')][_0x3e3ffb];var _0x34104d={'id':_0x43e219['id'],'available':_0x43e219['available'],'loggedIn':_0x43e219[_0xa0f6('0x46')],'name':_0x43e219[_0xa0f6('0x42')],'paused':_0x43e219[_0xa0f6('0x43')],'waiting':_0x43e219[_0xa0f6('0x44')]};_0x5c67a4['push'](_0x34104d);}}_0x3e3d27({'count':_0x5c67a4[_0xa0f6('0x18')],'rows':_0x5c67a4});});},'OpenchannelQueues':function(_0x180d4f){return new Promise(function(_0x3638f7,_0x2f2258){var _0x1f65f0=[];for(var _0x1b1896 in _0x33637e['openchannelQueues']){if(_0x33637e['openchannelQueues'][_0xa0f6('0x3c')](_0x1b1896)){var _0x3deaa9=_0x33637e[_0xa0f6('0x47')][_0x1b1896];var _0x49170e={'id':_0x3deaa9['id'],'available':_0x3deaa9[_0xa0f6('0x41')],'loggedIn':_0x3deaa9[_0xa0f6('0x46')],'name':_0x3deaa9['name'],'paused':_0x3deaa9[_0xa0f6('0x43')],'waiting':_0x3deaa9[_0xa0f6('0x44')]};_0x1f65f0[_0xa0f6('0x21')](_0x49170e);}}_0x3638f7({'count':_0x1f65f0['length'],'rows':_0x1f65f0});});},'SmsQueues':function(_0xaf1768){return new Promise(function(_0x3dc353,_0xa514fd){var _0x48834c=[];for(var _0x3a7607 in _0x33637e[_0xa0f6('0x48')]){if(_0x33637e[_0xa0f6('0x48')][_0xa0f6('0x3c')](_0x3a7607)){var _0x1bd45b=_0x33637e['smsQueues'][_0x3a7607];var _0x146b5b={'id':_0x1bd45b['id'],'available':_0x1bd45b[_0xa0f6('0x41')],'loggedIn':_0x1bd45b[_0xa0f6('0x46')],'name':_0x1bd45b[_0xa0f6('0x42')],'paused':_0x1bd45b[_0xa0f6('0x43')],'waiting':_0x1bd45b[_0xa0f6('0x44')]};_0x48834c[_0xa0f6('0x21')](_0x146b5b);}}_0x3dc353({'count':_0x48834c['length'],'rows':_0x48834c});});},'FaxQueues':function(_0x33e9db){return new Promise(function(_0x782caa,_0x357dd5){var _0xfae8c1=[];for(var _0x18facc in _0x33637e[_0xa0f6('0x49')]){if(_0x33637e[_0xa0f6('0x49')]['hasOwnProperty'](_0x18facc)){var _0x36b621=_0x33637e['faxQueues'][_0x18facc];var _0x5e8702={'id':_0x36b621['id'],'available':_0x36b621[_0xa0f6('0x41')],'loggedIn':_0x36b621[_0xa0f6('0x46')],'name':_0x36b621[_0xa0f6('0x42')],'paused':_0x36b621[_0xa0f6('0x43')],'waiting':_0x36b621[_0xa0f6('0x44')]};_0xfae8c1[_0xa0f6('0x21')](_0x5e8702);}}_0x782caa({'count':_0xfae8c1[_0xa0f6('0x18')],'rows':_0xfae8c1});});},'WhatsappQueues':function(_0x7ad47a){return new Promise(function(_0x21d697,_0x1659f0){var _0x5d80e5=[];for(var _0x39e926 in _0x33637e[_0xa0f6('0x4a')]){if(_0x33637e['whatsappQueues'][_0xa0f6('0x3c')](_0x39e926)){var _0x483ce=_0x33637e['whatsappQueues'][_0x39e926];var _0xdaa4f4={'id':_0x483ce['id'],'available':_0x483ce['available'],'loggedIn':_0x483ce[_0xa0f6('0x46')],'name':_0x483ce['name'],'paused':_0x483ce['paused'],'waiting':_0x483ce[_0xa0f6('0x44')]};_0x5d80e5[_0xa0f6('0x21')](_0xdaa4f4);}}_0x21d697({'count':_0x5d80e5[_0xa0f6('0x18')],'rows':_0x5d80e5});});},'ChatQueuesWaitingInteractions':function(_0x5687ad){return new Promise(function(_0x47e0ca,_0x2790cc){var _0x1c8484=_[_0xa0f6('0x4b')](_0x33637e['chatQueuesWaitingInteractions']);_0x47e0ca({'count':_0x1c8484['length'],'rows':_0x1c8484});});},'MailQueuesWaitingInteractions':function(_0x3d6507){return new Promise(function(_0x681ef1,_0x5b6f16){var _0x14acb0=_[_0xa0f6('0x4b')](_0x33637e[_0xa0f6('0x4c')]);_0x681ef1({'count':_0x14acb0[_0xa0f6('0x18')],'rows':_0x14acb0});});},'OpenchannelQueuesWaitingInteractions':function(_0x4f9ada){return new Promise(function(_0x675bb5,_0x4567c3){var _0x4b99fb=_[_0xa0f6('0x4b')](_0x33637e[_0xa0f6('0x4d')]);_0x675bb5({'count':_0x4b99fb[_0xa0f6('0x18')],'rows':_0x4b99fb});});},'SmsQueuesWaitingInteractions':function(_0x58e8e2){return new Promise(function(_0x397d97,_0x3fa8cb){var _0xf147d9=_[_0xa0f6('0x4b')](_0x33637e[_0xa0f6('0x4e')]);_0x397d97({'count':_0xf147d9[_0xa0f6('0x18')],'rows':_0xf147d9});});},'FaxQueuesWaitingInteractions':function(_0x404468){return new Promise(function(_0x542832,_0x35bf37){var _0x1dfc10=_[_0xa0f6('0x4b')](_0x33637e[_0xa0f6('0x4f')]);_0x542832({'count':_0x1dfc10[_0xa0f6('0x18')],'rows':_0x1dfc10});});},'WhatsappQueuesWaitingInteractions':function(_0x2f9554){return new Promise(function(_0x1d0634,_0x3f1fc8){var _0x5f2e57=_['values'](_0x33637e['whatsappQueuesWaitingInteractions']);_0x1d0634({'count':_0x5f2e57[_0xa0f6('0x18')],'rows':_0x5f2e57});});}};var _0x4f99f2=jayson[_0xa0f6('0x50')](_0xfd4b45)[_0xa0f6('0x51')]();_0x4f99f2['on'](_0xa0f6('0x2c'),function(_0x389096){logger['error'](JSON[_0xa0f6('0x2e')](_0x389096));return _0x5b014a(_0x389096);});_0x4f99f2[_0xa0f6('0x52')](0x232c,_0xa0f6('0x53'),function(){console['log'](_0xa0f6('0x54'),0x232c);return _0x58c3ce(_0xa0f6('0x55')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index cec7e48..77004bb 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 _0x5f8f=['stack','util','bluebird','routing','client','http','then','message','result','rules','info','stop','length','push','Command','iftime\x20%s','indexOf','true','catch','error','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','when','log','join','\x20|\x20'];(function(_0x16bd44,_0x3c91ba){var _0x368a61=function(_0x1c68ab){while(--_0x1c68ab){_0x16bd44['push'](_0x16bd44['shift']());}};_0x368a61(++_0x3c91ba);}(_0x5f8f,0x17b));var _0xf5f8=function(_0x5a4b51,_0x10bd62){_0x5a4b51=_0x5a4b51-0x0;var _0x4767fa=_0x5f8f[_0x5a4b51];return _0x4767fa;};'use strict';var util=require(_0xf5f8('0x0'));var BPromise=require(_0xf5f8('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0xf5f8('0x2'));var client=jayson[_0xf5f8('0x3')][_0xf5f8('0x4')]({'port':0x232a});function request(_0x29ecaa,_0x4a0ac2){return new BPromise(function(_0x1de02c,_0x4fc9cd){return client['request'](_0x29ecaa,_0x4a0ac2)[_0xf5f8('0x5')](function(_0x31c18e){if(_0x31c18e['error']){return _0x4fc9cd(_0x31c18e['error'][_0xf5f8('0x6')]);}else{return _0x1de02c(_0x31c18e[_0xf5f8('0x7')]);}})['catch'](function(_0xeff7b8){return _0x4fc9cd(_0xeff7b8);});});}exports['condition']=function(_0x2bd37e,_0x1fd9d9,_0x3e6213){return function(_0x2433ee){if(_0x3e6213['rules']&&!_0x3e6213[_0xf5f8('0x8')][_0x2bd37e]){logger[_0xf5f8('0x9')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2bd37e);return _0x2433ee[_0xf5f8('0xa')]();}var _0x557ce1=[];for(var _0x390059=0x0;_0x390059<_0x1fd9d9[_0xf5f8('0xb')];_0x390059+=0x1){_0x557ce1[_0xf5f8('0xc')](request(_0xf5f8('0xd'),{'command':util['format'](_0xf5f8('0xe'),_0x1fd9d9[_0x390059])})[_0xf5f8('0x5')](function(_0x2310c4){return _0x2310c4&&_0x2310c4['message']&&_0x2310c4['message'][_0xf5f8('0xf')](_0xf5f8('0x10'))>=0x0?!![]:![];})[_0xf5f8('0x11')](function(_0x27d8f1){logger[_0xf5f8('0x12')](_0xf5f8('0x13'),_0x2bd37e,_0x1fd9d9[_0x390059]);}));}BPromise[_0xf5f8('0x14')](_0x557ce1)[_0xf5f8('0x5')](function(_0x5270bb){var _0x2db773=_['some'](_0x5270bb);logger[_0xf5f8('0x9')](_0xf5f8('0x15'),_0x2bd37e,_0x1fd9d9['join']('\x20|\x20'),_0x2db773);_0x2433ee[_0xf5f8('0x16')](_0x2db773);})[_0xf5f8('0x11')](function(_0x377f32){console[_0xf5f8('0x17')](_0x377f32);logger[_0xf5f8('0x12')](_0xf5f8('0x15'),_0x2bd37e,_0x1fd9d9[_0xf5f8('0x18')](_0xf5f8('0x19')),_0x377f32[_0xf5f8('0x1a')]);_0x2433ee[_0xf5f8('0xa')]();});};}; \ No newline at end of file +var _0x1f90=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','request','then','error','result','rules'];(function(_0x193fcd,_0x26b8f9){var _0x28687a=function(_0x1342b2){while(--_0x1342b2){_0x193fcd['push'](_0x193fcd['shift']());}};_0x28687a(++_0x26b8f9);}(_0x1f90,0x1e3));var _0x01f9=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x1f90[_0x21ecc8];return _0x510c1d;};'use strict';var util=require(_0x01f9('0x0'));var BPromise=require(_0x01f9('0x1'));var jayson=require(_0x01f9('0x2'));var _=require(_0x01f9('0x3'));var logger=require(_0x01f9('0x4'))('routing');var client=jayson[_0x01f9('0x5')]['http']({'port':0x232a});function request(_0x3b2fde,_0xdbe0b0){return new BPromise(function(_0x833b10,_0x13e64f){return client[_0x01f9('0x6')](_0x3b2fde,_0xdbe0b0)[_0x01f9('0x7')](function(_0x383b7d){if(_0x383b7d[_0x01f9('0x8')]){return _0x13e64f(_0x383b7d[_0x01f9('0x8')]['message']);}else{return _0x833b10(_0x383b7d[_0x01f9('0x9')]);}})['catch'](function(_0x4706ea){return _0x13e64f(_0x4706ea);});});}exports['condition']=function(_0x24187f,_0x374e71,_0x43412a){return function(_0x3d29c7){if(_0x43412a[_0x01f9('0xa')]&&!_0x43412a[_0x01f9('0xa')][_0x24187f]){logger[_0x01f9('0xb')](_0x01f9('0xc'),_0x24187f);return _0x3d29c7['stop']();}var _0x1935cd=[];for(var _0x14c5dc=0x0;_0x14c5dc<_0x374e71[_0x01f9('0xd')];_0x14c5dc+=0x1){_0x1935cd[_0x01f9('0xe')](request(_0x01f9('0xf'),{'command':util['format'](_0x01f9('0x10'),_0x374e71[_0x14c5dc])})[_0x01f9('0x7')](function(_0x339041){return _0x339041&&_0x339041['message']&&_0x339041['message'][_0x01f9('0x11')](_0x01f9('0x12'))>=0x0?!![]:![];})['catch'](function(_0x4bd9c0){logger[_0x01f9('0x8')](_0x01f9('0x13'),_0x24187f,_0x374e71[_0x14c5dc]);}));}BPromise[_0x01f9('0x14')](_0x1935cd)['then'](function(_0x51ead6){var _0x32069c=_['some'](_0x51ead6);logger['info'](_0x01f9('0x15'),_0x24187f,_0x374e71[_0x01f9('0x16')](_0x01f9('0x17')),_0x32069c);_0x3d29c7[_0x01f9('0x18')](_0x32069c);})['catch'](function(_0x5e26e0){console['log'](_0x5e26e0);logger[_0x01f9('0x8')](_0x01f9('0x15'),_0x24187f,_0x374e71[_0x01f9('0x16')](_0x01f9('0x17')),_0x5e26e0[_0x01f9('0x19')]);_0x3d29c7['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a556f53..e98e1f7 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 _0x42b1=['connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','reason','timeout','ringtime','talktime','push','queuecallerabandon','uniqueid','abandoned','holdtime','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheremembername','membername','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','transfertype','ATTENDED','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','transferexten','secondtransfererexten','transfertargetuniqueid','clone','hangup','cause','rejected','indexOf','splice','agent','complete','lodash','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','queue','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','lastevent','called'];(function(_0x3ba963,_0x26436b){var _0x5d0bc4=function(_0x136c03){while(--_0x136c03){_0x3ba963['push'](_0x3ba963['shift']());}};_0x5d0bc4(++_0x26436b);}(_0x42b1,0xc2));var _0x142b=function(_0x5a35fa,_0x4f6a88){_0x5a35fa=_0x5a35fa-0x0;var _0x35f574=_0x42b1[_0x5a35fa];return _0x35f574;};'use strict';var _=require(_0x142b('0x0'));var util=require(_0x142b('0x1'));var utils=require(_0x142b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x268b33,_0x455db9){utils[_0x142b('0x3')](util['format'](_0x142b('0x4'),_0x268b33['uniqueid'],_0x268b33['channel'],_0x268b33[_0x142b('0x5')],_0x268b33['membername'],_0x268b33[_0x142b('0x6')],_0x268b33[_0x142b('0x7')],_0x268b33[_0x142b('0x8')],_0x268b33['lastevent']));if(_0x268b33[_0x142b('0x5')]){utils[_0x142b('0x9')](_0x268b33['queue'])[_0x142b('0xa')](function(_0x34e95c){if(_0x34e95c){_0x268b33['type']=_0x34e95c[_0x142b('0xb')];_0x268b33[_0x142b('0xc')]=_0x268b33[_0x142b('0xd')]?_0x34e95c[_0x142b('0xe')]:![];_0x268b33[_0x142b('0xf')]=_0x268b33['agentacw']?_0x34e95c[_0x142b('0x10')]:0x0;}utils[_0x142b('0x11')](_0x142b('0x12'),_0x268b33);});}else{utils['request']('CreateVoiceAgentReport',_0x268b33);}if(_0x455db9){delete transfers[_0x268b33['uniqueid']];}else{delete agents[_0x268b33['destuniqueid']];}}exports[_0x142b('0x13')]=function(_0x46d6a7){try{agents[_0x46d6a7[_0x142b('0x14')]]=_0x46d6a7;agents[_0x46d6a7[_0x142b('0x14')]][_0x142b('0x15')]=utils[_0x142b('0x16')]();agents[_0x46d6a7[_0x142b('0x14')]][_0x142b('0x17')]=_0x142b('0x18');agents[_0x46d6a7['destuniqueid']]['connectedlinenum']=null;agents[_0x46d6a7[_0x142b('0x14')]][_0x142b('0x19')]=null;}catch(_0x44df0a){utils[_0x142b('0x1a')](_0x44df0a[_0x142b('0x1b')]);}};exports[_0x142b('0x1c')]=function(_0x19eb91){try{if(!_[_0x142b('0x1d')](agents[_0x19eb91['destuniqueid']])){agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x1c')]=!![];agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x1e')]=utils[_0x142b('0x16')]();agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x17')]='timeout';agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x1f')]=_0x142b('0x20');agents[_0x19eb91[_0x142b('0x14')]]['holdtime']=_0x19eb91[_0x142b('0x21')]?parseInt(_0x19eb91[_0x142b('0x21')])/0x3e8:0x0;agents[_0x19eb91[_0x142b('0x14')]][_0x142b('0x22')]=0x0;unanswered[_0x142b('0x23')](_0x19eb91['destuniqueid']);}}catch(_0x2ec2d5){utils[_0x142b('0x1a')](_0x2ec2d5[_0x142b('0x1b')]);}};exports[_0x142b('0x24')]=function(_0xfa473f){try{_['forIn'](agents,function(_0x1feb0a,_0x4f24e0){if(_0x1feb0a['uniqueid']==_0xfa473f[_0x142b('0x25')]&&!_['includes'](unanswered,_0x1feb0a['destuniqueid'])){_0x1feb0a[_0x142b('0x1c')]=!![];_0x1feb0a[_0x142b('0x1e')]=utils[_0x142b('0x16')]();_0x1feb0a[_0x142b('0x17')]=_0x142b('0x26');_0x1feb0a[_0x142b('0x1f')]='abandoned';_0x1feb0a[_0x142b('0x27')]=_0xfa473f['holdtime'];_0x1feb0a[_0x142b('0x22')]=0x0;writeDB(_0x1feb0a);}});}catch(_0x304fb0){utils[_0x142b('0x1a')](_0x304fb0['stack']);}};exports['agentconnect']=function(_0x58fb2c){try{if(agents[_0x58fb2c[_0x142b('0x14')]]){agents[_0x58fb2c[_0x142b('0x14')]][_0x142b('0x28')]=utils['now']();agents[_0x58fb2c[_0x142b('0x14')]]['connectedlinenum']=_0x58fb2c[_0x142b('0x8')];agents[_0x58fb2c['destuniqueid']][_0x142b('0x19')]=_0x58fb2c[_0x142b('0x19')];agents[_0x58fb2c[_0x142b('0x14')]][_0x142b('0x27')]=_0x58fb2c[_0x142b('0x21')];agents[_0x58fb2c['destuniqueid']]['lastevent']=_0x142b('0x29');_[_0x142b('0x2a')](agents,function(_0x533158,_0x61334a){if(_0x533158[_0x142b('0x14')]!=_0x58fb2c[_0x142b('0x14')]&&_0x533158[_0x142b('0x25')]==_0x58fb2c[_0x142b('0x25')]){_0x533158['talktime']=0x0;_0x533158[_0x142b('0x27')]=_0x58fb2c[_0x142b('0x21')];_0x533158['agentringnoanswer']=!![];_0x533158[_0x142b('0x1e')]=utils['now']();_0x533158[_0x142b('0x17')]=_0x142b('0x2b');_0x533158[_0x142b('0x1f')]=_0x142b('0x2b');_0x533158['answeredelsewheredestinationuniqueid']=_0x58fb2c['destuniqueid'];_0x533158[_0x142b('0x2c')]=_0x58fb2c[_0x142b('0x2d')];writeDB(_0x533158);}});}}catch(_0x3a9428){utils[_0x142b('0x1a')](_0x3a9428[_0x142b('0x1b')]);}};exports[_0x142b('0xd')]=function(_0x4f8e04){try{if(!_[_0x142b('0x1d')](agents[_0x4f8e04[_0x142b('0x14')]])){agents[_0x4f8e04[_0x142b('0x14')]]['agentcomplete']=!![];agents[_0x4f8e04[_0x142b('0x14')]][_0x142b('0x2e')]=utils[_0x142b('0x16')]();agents[_0x4f8e04[_0x142b('0x14')]]['talktime']=utils[_0x142b('0x2f')](agents[_0x4f8e04[_0x142b('0x14')]][_0x142b('0x2e')],agents[_0x4f8e04['destuniqueid']]['agentconnectAt']);agents[_0x4f8e04[_0x142b('0x14')]][_0x142b('0x1f')]=_0x4f8e04['reason'];agents[_0x4f8e04[_0x142b('0x14')]][_0x142b('0x17')]='complete';writeDB(agents[_0x4f8e04[_0x142b('0x14')]]);}}catch(_0x10422c){utils[_0x142b('0x1a')](_0x10422c['stack']);}};exports[_0x142b('0x30')]=function(_0x5c6a8b){try{if(!_['isNil'](agents[_0x5c6a8b['transfereruniqueid']])){agents[_0x5c6a8b[_0x142b('0x31')]]['transfer']=!![];agents[_0x5c6a8b[_0x142b('0x31')]]['transfertype']='blind';agents[_0x5c6a8b[_0x142b('0x31')]]['transferexten']=_0x5c6a8b[_0x142b('0x32')];agents[_0x5c6a8b['transfereruniqueid']][_0x142b('0x33')]=agents[_0x5c6a8b['transfereruniqueid']]['uniqueid'];}}catch(_0x1ca5f8){utils[_0x142b('0x1a')](_0x1ca5f8[_0x142b('0x1b')]);}};exports['attendedtransfer']=function(_0x45104b){try{if(_0x45104b[_0x142b('0x34')]==_0x45104b[_0x142b('0x35')]){if(!_[_0x142b('0x1d')](agents[_0x45104b[_0x142b('0x36')]])){agents[_0x45104b[_0x142b('0x36')]][_0x142b('0x37')]=!![];agents[_0x45104b[_0x142b('0x36')]][_0x142b('0x38')]=_0x142b('0x39');agents[_0x45104b[_0x142b('0x36')]]['transferexten']=_0x45104b['origtransfererexten'];agents[_0x45104b['secondtransfereruniqueid']][_0x142b('0x33')]=_0x45104b[_0x142b('0x34')];}if(_0x45104b[_0x142b('0x3a')]&&agents[_0x45104b[_0x142b('0x3a')]]){agents[_0x45104b[_0x142b('0x3a')]][_0x142b('0x3b')]=0x1;transfers[_0x45104b[_0x142b('0x3a')]]=_['clone'](agents[_0x45104b[_0x142b('0x3a')]]);transfers[_0x45104b['transfereeuniqueid']][_0x142b('0x7')]=agents[_0x45104b['secondtransfereruniqueid']][_0x142b('0x7')];transfers[_0x45104b[_0x142b('0x3a')]][_0x142b('0x3c')]=agents[_0x45104b[_0x142b('0x36')]][_0x142b('0x3c')];transfers[_0x45104b[_0x142b('0x3a')]][_0x142b('0x15')]=utils[_0x142b('0x16')]();transfers[_0x45104b[_0x142b('0x3a')]][_0x142b('0x28')]=utils['now']();transfers[_0x45104b[_0x142b('0x3a')]][_0x142b('0x27')]=0x0;transfers[_0x45104b[_0x142b('0x3a')]]['agententerreason']=0x2;}}else if(_0x45104b[_0x142b('0x36')]==_0x45104b[_0x142b('0x3d')]){if(!_[_0x142b('0x1d')](agents[_0x45104b[_0x142b('0x34')]])){agents[_0x45104b[_0x142b('0x34')]]['transfer']=!![];agents[_0x45104b[_0x142b('0x34')]][_0x142b('0x38')]=_0x142b('0x39');agents[_0x45104b[_0x142b('0x34')]][_0x142b('0x3e')]=_0x45104b[_0x142b('0x3f')];agents[_0x45104b['origtransfereruniqueid']][_0x142b('0x33')]=_0x45104b['secondtransfereruniqueid'];}if(_0x45104b['transfertargetuniqueid']&&agents[_0x45104b[_0x142b('0x40')]]){agents[_0x45104b[_0x142b('0x40')]][_0x142b('0x3b')]=0x1;transfers[_0x45104b[_0x142b('0x40')]]=_[_0x142b('0x41')](agents[_0x45104b['transfertargetuniqueid']]);transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x7')]=agents[_0x45104b[_0x142b('0x34')]][_0x142b('0x7')];transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x3c')]=agents[_0x45104b['origtransfereruniqueid']][_0x142b('0x3c')];transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x15')]=utils[_0x142b('0x16')]();transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x28')]=utils[_0x142b('0x16')]();transfers[_0x45104b[_0x142b('0x40')]][_0x142b('0x27')]=0x0;transfers[_0x45104b[_0x142b('0x40')]]['agententerreason']=0x2;}}}catch(_0x4bc65f){utils[_0x142b('0x1a')](_0x4bc65f[_0x142b('0x1b')]);}};exports[_0x142b('0x42')]=function(_0x4b8f5b){try{if(agents[_0x4b8f5b['uniqueid']]&&agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x1f')]===_0x142b('0x20')){if(_0x4b8f5b[_0x142b('0x43')]==='21'){agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x1f')]=_0x142b('0x44');agents[_0x4b8f5b[_0x142b('0x25')]]['lastevent']=_0x142b('0x44');}writeDB(agents[_0x4b8f5b['uniqueid']]);var _0x3cf129=unanswered[_0x142b('0x45')](_0x4b8f5b[_0x142b('0x25')]);if(_0x3cf129>-0x1)unanswered[_0x142b('0x46')](_0x3cf129,0x1);}if(transfers[_0x4b8f5b[_0x142b('0x25')]]){transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0xd')]=!![];transfers[_0x4b8f5b['uniqueid']][_0x142b('0x2e')]=utils[_0x142b('0x16')]();transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x22')]=utils[_0x142b('0x2f')](transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x2e')],transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x28')]);transfers[_0x4b8f5b['uniqueid']][_0x142b('0x1f')]=_0x142b('0x47');transfers[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x17')]=_0x142b('0x48');writeDB(transfers[_0x4b8f5b[_0x142b('0x25')]],!![]);}if(agents[_0x4b8f5b[_0x142b('0x25')]]&&agents[_0x4b8f5b[_0x142b('0x25')]]['agentconnectAt']){agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0xd')]=!![];agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x2e')]=utils[_0x142b('0x16')]();agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x22')]=utils[_0x142b('0x2f')](agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x2e')],agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x28')]);agents[_0x4b8f5b['uniqueid']][_0x142b('0x1f')]=agents[_0x4b8f5b['uniqueid']][_0x142b('0x37')]?'transfer':_0x142b('0x47');agents[_0x4b8f5b[_0x142b('0x25')]][_0x142b('0x17')]='complete';writeDB(agents[_0x4b8f5b[_0x142b('0x25')]]);}}catch(_0x561049){utils[_0x142b('0x1a')](_0x561049['stack']);}}; \ No newline at end of file +var _0xe124=['indexOf','agent','complete','lodash','util','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','now','called','error','stack','isNil','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','forIn','includes','reason','abandoned','agentconnect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','transfertype','blind','transferexten','transferuniqueid','secondtransfereruniqueid','transfer','ATTENDED','origtransfereruniqueid','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','cause','rejected'];(function(_0x5eb226,_0x4bc701){var _0x37623f=function(_0x10bbad){while(--_0x10bbad){_0x5eb226['push'](_0x5eb226['shift']());}};_0x37623f(++_0x4bc701);}(_0xe124,0x15c));var _0x4e12=function(_0x93f26d,_0x1f6a77){_0x93f26d=_0x93f26d-0x0;var _0x201d30=_0xe124[_0x93f26d];return _0x201d30;};'use strict';var _=require(_0x4e12('0x0'));var util=require(_0x4e12('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x581265,_0x494be5){utils[_0x4e12('0x2')](util['format'](_0x4e12('0x3'),_0x581265[_0x4e12('0x4')],_0x581265[_0x4e12('0x5')],_0x581265[_0x4e12('0x6')],_0x581265[_0x4e12('0x7')],_0x581265[_0x4e12('0x8')],_0x581265[_0x4e12('0x9')],_0x581265[_0x4e12('0xa')],_0x581265[_0x4e12('0xb')]));if(_0x581265[_0x4e12('0x6')]){utils['getVoiceQueueByName'](_0x581265['queue'])[_0x4e12('0xc')](function(_0x1682d8){if(_0x1682d8){_0x581265[_0x4e12('0xd')]=_0x1682d8[_0x4e12('0xd')];_0x581265[_0x4e12('0xe')]=_0x581265[_0x4e12('0xf')]?_0x1682d8[_0x4e12('0x10')]:![];_0x581265[_0x4e12('0x11')]=_0x581265[_0x4e12('0xe')]?_0x1682d8[_0x4e12('0x12')]:0x0;}utils[_0x4e12('0x13')](_0x4e12('0x14'),_0x581265);});}else{utils[_0x4e12('0x13')](_0x4e12('0x14'),_0x581265);}if(_0x494be5){delete transfers[_0x581265[_0x4e12('0x4')]];}else{delete agents[_0x581265['destuniqueid']];}}exports['agentcalled']=function(_0x21b0d0){try{agents[_0x21b0d0[_0x4e12('0x15')]]=_0x21b0d0;agents[_0x21b0d0[_0x4e12('0x15')]]['agentcalledAt']=utils[_0x4e12('0x16')]();agents[_0x21b0d0[_0x4e12('0x15')]][_0x4e12('0xb')]=_0x4e12('0x17');agents[_0x21b0d0[_0x4e12('0x15')]][_0x4e12('0xa')]=null;agents[_0x21b0d0['destuniqueid']]['connectedlinename']=null;}catch(_0x2f16ed){utils[_0x4e12('0x18')](_0x2f16ed[_0x4e12('0x19')]);}};exports['agentringnoanswer']=function(_0xdbda5c){try{if(!_[_0x4e12('0x1a')](agents[_0xdbda5c[_0x4e12('0x15')]])){agents[_0xdbda5c[_0x4e12('0x15')]][_0x4e12('0x1b')]=!![];agents[_0xdbda5c['destuniqueid']][_0x4e12('0x1c')]=utils[_0x4e12('0x16')]();agents[_0xdbda5c[_0x4e12('0x15')]]['lastevent']=_0x4e12('0x1d');agents[_0xdbda5c[_0x4e12('0x15')]]['reason']=_0x4e12('0x1d');agents[_0xdbda5c[_0x4e12('0x15')]][_0x4e12('0x1e')]=_0xdbda5c[_0x4e12('0x1f')]?parseInt(_0xdbda5c[_0x4e12('0x1f')])/0x3e8:0x0;agents[_0xdbda5c[_0x4e12('0x15')]][_0x4e12('0x20')]=0x0;unanswered['push'](_0xdbda5c[_0x4e12('0x15')]);}}catch(_0x194c18){utils[_0x4e12('0x18')](_0x194c18[_0x4e12('0x19')]);}};exports['queuecallerabandon']=function(_0x9119b1){try{_[_0x4e12('0x21')](agents,function(_0x53884d,_0x56e23b){if(_0x53884d[_0x4e12('0x4')]==_0x9119b1[_0x4e12('0x4')]&&!_[_0x4e12('0x22')](unanswered,_0x53884d[_0x4e12('0x15')])){_0x53884d['agentringnoanswer']=!![];_0x53884d[_0x4e12('0x1c')]=utils['now']();_0x53884d[_0x4e12('0xb')]='abandoned';_0x53884d[_0x4e12('0x23')]=_0x4e12('0x24');_0x53884d[_0x4e12('0x1e')]=_0x9119b1[_0x4e12('0x1e')];_0x53884d[_0x4e12('0x20')]=0x0;writeDB(_0x53884d);}});}catch(_0xdb508b){utils[_0x4e12('0x18')](_0xdb508b[_0x4e12('0x19')]);}};exports[_0x4e12('0x25')]=function(_0x4028ff){try{if(agents[_0x4028ff['destuniqueid']]){agents[_0x4028ff[_0x4e12('0x15')]][_0x4e12('0x26')]=utils[_0x4e12('0x16')]();agents[_0x4028ff[_0x4e12('0x15')]][_0x4e12('0xa')]=_0x4028ff[_0x4e12('0xa')];agents[_0x4028ff[_0x4e12('0x15')]]['connectedlinename']=_0x4028ff[_0x4e12('0x27')];agents[_0x4028ff[_0x4e12('0x15')]][_0x4e12('0x1e')]=_0x4028ff[_0x4e12('0x1f')];agents[_0x4028ff[_0x4e12('0x15')]][_0x4e12('0xb')]='connect';_[_0x4e12('0x21')](agents,function(_0x51afbd,_0x34692a){if(_0x51afbd['destuniqueid']!=_0x4028ff[_0x4e12('0x15')]&&_0x51afbd[_0x4e12('0x4')]==_0x4028ff[_0x4e12('0x4')]){_0x51afbd[_0x4e12('0x20')]=0x0;_0x51afbd['holdtime']=_0x4028ff['ringtime'];_0x51afbd[_0x4e12('0x1b')]=!![];_0x51afbd['agentringnoanswerAt']=utils['now']();_0x51afbd[_0x4e12('0xb')]=_0x4e12('0x28');_0x51afbd[_0x4e12('0x23')]=_0x4e12('0x28');_0x51afbd[_0x4e12('0x29')]=_0x4028ff[_0x4e12('0x15')];_0x51afbd[_0x4e12('0x2a')]=_0x4028ff['membername'];writeDB(_0x51afbd);}});}}catch(_0xdbdd4e){utils['error'](_0xdbdd4e[_0x4e12('0x19')]);}};exports[_0x4e12('0xf')]=function(_0x3bf7c9){try{if(!_[_0x4e12('0x1a')](agents[_0x3bf7c9['destuniqueid']])){agents[_0x3bf7c9[_0x4e12('0x15')]]['agentcomplete']=!![];agents[_0x3bf7c9[_0x4e12('0x15')]]['agentcompleteAt']=utils[_0x4e12('0x16')]();agents[_0x3bf7c9[_0x4e12('0x15')]][_0x4e12('0x20')]=utils[_0x4e12('0x2b')](agents[_0x3bf7c9[_0x4e12('0x15')]][_0x4e12('0x2c')],agents[_0x3bf7c9[_0x4e12('0x15')]][_0x4e12('0x26')]);agents[_0x3bf7c9[_0x4e12('0x15')]][_0x4e12('0x23')]=_0x3bf7c9[_0x4e12('0x23')];agents[_0x3bf7c9[_0x4e12('0x15')]]['lastevent']='complete';writeDB(agents[_0x3bf7c9[_0x4e12('0x15')]]);}}catch(_0xaa1ac){utils[_0x4e12('0x18')](_0xaa1ac[_0x4e12('0x19')]);}};exports[_0x4e12('0x2d')]=function(_0x159099){try{if(!_[_0x4e12('0x1a')](agents[_0x159099[_0x4e12('0x2e')]])){agents[_0x159099[_0x4e12('0x2e')]]['transfer']=!![];agents[_0x159099[_0x4e12('0x2e')]][_0x4e12('0x2f')]=_0x4e12('0x30');agents[_0x159099[_0x4e12('0x2e')]][_0x4e12('0x31')]=_0x159099['extension'];agents[_0x159099['transfereruniqueid']][_0x4e12('0x32')]=agents[_0x159099['transfereruniqueid']][_0x4e12('0x4')];}}catch(_0x125997){utils['error'](_0x125997[_0x4e12('0x19')]);}};exports['attendedtransfer']=function(_0x5ba43b){try{if(_0x5ba43b['origtransfereruniqueid']==_0x5ba43b['origtransfererlinkedid']){if(!_['isNil'](agents[_0x5ba43b[_0x4e12('0x33')]])){agents[_0x5ba43b[_0x4e12('0x33')]][_0x4e12('0x34')]=!![];agents[_0x5ba43b['secondtransfereruniqueid']][_0x4e12('0x2f')]=_0x4e12('0x35');agents[_0x5ba43b[_0x4e12('0x33')]][_0x4e12('0x31')]=_0x5ba43b['origtransfererexten'];agents[_0x5ba43b['secondtransfereruniqueid']][_0x4e12('0x32')]=_0x5ba43b[_0x4e12('0x36')];}if(_0x5ba43b[_0x4e12('0x37')]&&agents[_0x5ba43b['transfereeuniqueid']]){agents[_0x5ba43b['transfereeuniqueid']][_0x4e12('0x38')]=0x1;transfers[_0x5ba43b[_0x4e12('0x37')]]=_['clone'](agents[_0x5ba43b[_0x4e12('0x37')]]);transfers[_0x5ba43b[_0x4e12('0x37')]][_0x4e12('0x9')]=agents[_0x5ba43b[_0x4e12('0x33')]][_0x4e12('0x9')];transfers[_0x5ba43b['transfereeuniqueid']][_0x4e12('0x39')]=agents[_0x5ba43b['secondtransfereruniqueid']][_0x4e12('0x39')];transfers[_0x5ba43b[_0x4e12('0x37')]][_0x4e12('0x3a')]=utils[_0x4e12('0x16')]();transfers[_0x5ba43b[_0x4e12('0x37')]][_0x4e12('0x26')]=utils[_0x4e12('0x16')]();transfers[_0x5ba43b[_0x4e12('0x37')]][_0x4e12('0x1e')]=0x0;transfers[_0x5ba43b[_0x4e12('0x37')]]['agententerreason']=0x2;}}else if(_0x5ba43b[_0x4e12('0x33')]==_0x5ba43b[_0x4e12('0x3b')]){if(!_['isNil'](agents[_0x5ba43b[_0x4e12('0x36')]])){agents[_0x5ba43b[_0x4e12('0x36')]][_0x4e12('0x34')]=!![];agents[_0x5ba43b[_0x4e12('0x36')]][_0x4e12('0x2f')]=_0x4e12('0x35');agents[_0x5ba43b[_0x4e12('0x36')]][_0x4e12('0x31')]=_0x5ba43b[_0x4e12('0x3c')];agents[_0x5ba43b['origtransfereruniqueid']][_0x4e12('0x32')]=_0x5ba43b[_0x4e12('0x33')];}if(_0x5ba43b[_0x4e12('0x3d')]&&agents[_0x5ba43b[_0x4e12('0x3d')]]){agents[_0x5ba43b[_0x4e12('0x3d')]][_0x4e12('0x38')]=0x1;transfers[_0x5ba43b['transfertargetuniqueid']]=_[_0x4e12('0x3e')](agents[_0x5ba43b[_0x4e12('0x3d')]]);transfers[_0x5ba43b[_0x4e12('0x3d')]][_0x4e12('0x9')]=agents[_0x5ba43b[_0x4e12('0x36')]][_0x4e12('0x9')];transfers[_0x5ba43b['transfertargetuniqueid']]['calleridname']=agents[_0x5ba43b[_0x4e12('0x36')]][_0x4e12('0x39')];transfers[_0x5ba43b['transfertargetuniqueid']][_0x4e12('0x3a')]=utils[_0x4e12('0x16')]();transfers[_0x5ba43b[_0x4e12('0x3d')]]['agentconnectAt']=utils['now']();transfers[_0x5ba43b[_0x4e12('0x3d')]][_0x4e12('0x1e')]=0x0;transfers[_0x5ba43b[_0x4e12('0x3d')]][_0x4e12('0x38')]=0x2;}}}catch(_0x5e7b6a){utils['error'](_0x5e7b6a[_0x4e12('0x19')]);}};exports[_0x4e12('0x3f')]=function(_0x1f983a){try{if(agents[_0x1f983a[_0x4e12('0x4')]]&&agents[_0x1f983a[_0x4e12('0x4')]][_0x4e12('0x23')]==='timeout'){if(_0x1f983a[_0x4e12('0x40')]==='21'){agents[_0x1f983a['uniqueid']][_0x4e12('0x23')]=_0x4e12('0x41');agents[_0x1f983a['uniqueid']][_0x4e12('0xb')]=_0x4e12('0x41');}writeDB(agents[_0x1f983a['uniqueid']]);var _0x2e5bae=unanswered[_0x4e12('0x42')](_0x1f983a[_0x4e12('0x4')]);if(_0x2e5bae>-0x1)unanswered['splice'](_0x2e5bae,0x1);}if(transfers[_0x1f983a['uniqueid']]){transfers[_0x1f983a[_0x4e12('0x4')]][_0x4e12('0xf')]=!![];transfers[_0x1f983a[_0x4e12('0x4')]][_0x4e12('0x2c')]=utils[_0x4e12('0x16')]();transfers[_0x1f983a[_0x4e12('0x4')]]['talktime']=utils[_0x4e12('0x2b')](transfers[_0x1f983a['uniqueid']]['agentcompleteAt'],transfers[_0x1f983a[_0x4e12('0x4')]]['agentconnectAt']);transfers[_0x1f983a['uniqueid']]['reason']=_0x4e12('0x43');transfers[_0x1f983a[_0x4e12('0x4')]][_0x4e12('0xb')]=_0x4e12('0x44');writeDB(transfers[_0x1f983a[_0x4e12('0x4')]],!![]);}if(agents[_0x1f983a['uniqueid']]&&agents[_0x1f983a[_0x4e12('0x4')]]['agentconnectAt']){agents[_0x1f983a['uniqueid']]['agentcomplete']=!![];agents[_0x1f983a['uniqueid']][_0x4e12('0x2c')]=utils[_0x4e12('0x16')]();agents[_0x1f983a['uniqueid']][_0x4e12('0x20')]=utils[_0x4e12('0x2b')](agents[_0x1f983a[_0x4e12('0x4')]][_0x4e12('0x2c')],agents[_0x1f983a[_0x4e12('0x4')]][_0x4e12('0x26')]);agents[_0x1f983a[_0x4e12('0x4')]][_0x4e12('0x23')]=agents[_0x1f983a[_0x4e12('0x4')]]['transfer']?_0x4e12('0x34'):_0x4e12('0x43');agents[_0x1f983a['uniqueid']]['lastevent']=_0x4e12('0x44');writeDB(agents[_0x1f983a[_0x4e12('0x4')]]);}}catch(_0x32cb23){utils[_0x4e12('0x18')](_0x32cb23['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 0a6cd5f..a79a489 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 _0x769c=['xmd-originatecalleridnum','source','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','Queue','lastdata','queue','xmd-contactid','outboundrouteid','routeid','sipcallid','toLowerCase','set','appdata','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','application','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','destination','callerid','disposition','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','DOCUMENTATION','error','stack','isNil','systemanswertime','now','context','transfer','destinationchannel','answertime','toNumber','hangup','calleridname','duration','endtime','starttime','diffTime','attendedtransfer','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstartAt','mohtime','varset','variable'];(function(_0x345409,_0x24cf70){var _0x2d0dda=function(_0x5d6027){while(--_0x5d6027){_0x345409['push'](_0x345409['shift']());}};_0x2d0dda(++_0x24cf70);}(_0x769c,0x156));var _0xc769=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x769c[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xc769('0x0'));var util=require(_0xc769('0x1'));var utils=require(_0xc769('0x2'));var dispositions=[_0xc769('0x3'),_0xc769('0x4'),'FAILED',_0xc769('0x3'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED',_0xc769('0x5'),_0xc769('0x4'),_0xc769('0x4'),_0xc769('0x4')];var channels={};function writeDB(_0x2763e9){utils[_0xc769('0x6')](util[_0xc769('0x7')](_0xc769('0x8'),_0x2763e9[_0xc769('0x9')],_0x2763e9[_0xc769('0xa')],_0x2763e9[_0xc769('0xb')],_0x2763e9[_0xc769('0xc')],_0x2763e9['source'],_0x2763e9[_0xc769('0xd')],_0x2763e9[_0xc769('0xe')],_0x2763e9[_0xc769('0xf')]));if(_0x2763e9[_0xc769('0xc')]){utils[_0xc769('0x10')](_0x2763e9[_0xc769('0xc')])['then'](function(_0xd4aea5){if(_0xd4aea5){_0x2763e9[_0xc769('0x11')]=_0xd4aea5['id'];}utils[_0xc769('0x12')]('CreateVoiceCallReport',_0x2763e9);});}else{utils[_0xc769('0x12')](_0xc769('0x13'),_0x2763e9);}if(channels[_0x2763e9[_0xc769('0x9')]]){delete channels[_0x2763e9[_0xc769('0x9')]];}}exports[_0xc769('0x14')]=function(_0x1d3c6a){try{if(_0x1d3c6a['uniqueid']==_0x1d3c6a[_0xc769('0x15')]&&_0x1d3c6a[_0xc769('0xa')]!=_0xc769('0x16')){channels[_0x1d3c6a['uniqueid']]={'uniqueid':_0x1d3c6a['uniqueid'],'accountcode':_0x1d3c6a[_0xc769('0xc')],'source':_0x1d3c6a[_0xc769('0x17')],'destination':_0x1d3c6a[_0xc769('0x18')],'destinationcontext':_0x1d3c6a['context'],'channel':_0x1d3c6a[_0xc769('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc769('0x3'),'amaflags':_0xc769('0x19')};}}catch(_0x2e634d){utils[_0xc769('0x1a')](_0x2e634d[_0xc769('0x1b')]);}};exports['newstate']=function(_0xe034d7){try{if(!_[_0xc769('0x1c')](channels[_0xe034d7[_0xc769('0x9')]])&&_0xe034d7['channelstate']==0x6){if(_[_0xc769('0x1c')](channels[_0xe034d7['uniqueid']][_0xc769('0x1d')])){channels[_0xe034d7['uniqueid']][_0xc769('0x1d')]=utils[_0xc769('0x1e')]();}}else if(!_[_0xc769('0x1c')](channels[_0xe034d7[_0xc769('0x15')]])&&_0xe034d7['channelstate']==0x6&&_0xe034d7[_0xc769('0x1f')]!=_0xc769('0x20')){channels[_0xe034d7['linkedid']][_0xc769('0xc')]=_0xe034d7[_0xc769('0xc')];channels[_0xe034d7[_0xc769('0x15')]][_0xc769('0x21')]=_0xe034d7['channel'];if(_['isNil'](channels[_0xe034d7['linkedid']][_0xc769('0x22')])){channels[_0xe034d7[_0xc769('0x15')]][_0xc769('0x22')]=utils[_0xc769('0x1e')]();}channels[_0xe034d7['linkedid']]['disposition']=dispositions[_[_0xc769('0x23')](_0xe034d7['channelstate'])]||'ANSWERED';}}catch(_0x4a19cc){utils[_0xc769('0x1a')](_0x4a19cc['stack']);}};exports[_0xc769('0x24')]=function(_0x16531f){try{if(!_['isNil'](channels[_0x16531f['uniqueid']])){if(_['isNil'](channels[_0x16531f[_0xc769('0x9')]][_0xc769('0xe')])){channels[_0x16531f[_0xc769('0x9')]][_0xc769('0xe')]=_0x16531f[_0xc769('0x25')]+'\x20<'+_0x16531f[_0xc769('0x17')]+'>';}channels[_0x16531f[_0xc769('0x9')]]['endtime']=utils[_0xc769('0x1e')]();channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x26')]=utils['diffTime'](channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x27')],channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x28')]);channels[_0x16531f[_0xc769('0x9')]]['billableseconds']=channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x22')]?utils[_0xc769('0x29')](channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x27')],channels[_0x16531f[_0xc769('0x9')]][_0xc769('0x22')]):0x0;writeDB(channels[_0x16531f[_0xc769('0x9')]]);}}catch(_0x10879e){utils[_0xc769('0x1a')](_0x10879e['stack']);}};exports[_0xc769('0x2a')]=function(_0x1c26e0){try{if(!_['isNil'](channels[_0x1c26e0['localtwolinkedid']])){if(channels[_0x1c26e0['localtwolinkedid']][_0xc769('0xa')]==_0x1c26e0['transfereechannel']){channels[_0x1c26e0[_0xc769('0x2b')]][_0xc769('0x21')]=_0x1c26e0[_0xc769('0x2c')];channels[_0x1c26e0[_0xc769('0x2b')]][_0xc769('0x2d')]=_0xc769('0x2e');}else if(channels[_0x1c26e0[_0xc769('0x2b')]]['channel']=_0x1c26e0[_0xc769('0x2f')]){channels[_0x1c26e0[_0xc769('0x2b')]][_0xc769('0x21')]=_0x1c26e0['origtransfererchannel'];channels[_0x1c26e0[_0xc769('0x2b')]]['userfield']=_0xc769('0x2e');}}}catch(_0xe940b9){utils['error'](_0xe940b9[_0xc769('0x1b')]);}};exports[_0xc769('0x30')]=function(_0x3db027){try{if(!_[_0xc769('0x1c')](channels[_0x3db027[_0xc769('0x9')]])){channels[_0x3db027[_0xc769('0x9')]][_0xc769('0x31')]=utils[_0xc769('0x1e')]();}}catch(_0x57b9f2){utils[_0xc769('0x1a')](_0x57b9f2[_0xc769('0x1b')]);}};exports['musiconholdstop']=function(_0x45d14a){try{if(!_[_0xc769('0x1c')](channels[_0x45d14a[_0xc769('0x9')]])){if(!_['isNil'](channels[_0x45d14a[_0xc769('0x9')]][_0xc769('0x31')])){channels[_0x45d14a['uniqueid']][_0xc769('0x32')]+=utils['diffTime'](utils[_0xc769('0x1e')](),channels[_0x45d14a[_0xc769('0x9')]][_0xc769('0x31')]);delete channels[_0x45d14a[_0xc769('0x9')]][_0xc769('0x31')];}}}catch(_0x31288d){utils[_0xc769('0x1a')](_0x31288d[_0xc769('0x1b')]);}};exports[_0xc769('0x33')]=function(_0x553adb){try{if(!_[_0xc769('0x1c')](channels[_0x553adb['uniqueid']])){if(!_['isNil'](_0x553adb[_0xc769('0x34')][_0xc769('0x35')])){channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x36')]=_0x553adb[_0xc769('0x37')];}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')]['xmd-phone'])){channels[_0x553adb['uniqueid']][_0xc769('0xd')]=_0x553adb['value'];channels[_0x553adb['uniqueid']]['callerid']='\x22'+_0x553adb[_0xc769('0x37')]+_0xc769('0x38')+_0x553adb['value']+'>';}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')][_0xc769('0x39')])||!_['isNil'](_0x553adb[_0xc769('0x34')][_0xc769('0x3a')])){channels[_0x553adb['uniqueid']][_0xc769('0xe')]=_0x553adb[_0xc769('0x37')];}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')]['xmd-queue'])||!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')][_0xc769('0x3b')])){channels[_0x553adb[_0xc769('0x9')]]['lastapplication']=_0xc769('0x3c');channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x3d')]=_0x553adb['value'];channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x3e')]=!![];}if(!_[_0xc769('0x1c')](_0x553adb['variable'][_0xc769('0x3f')])){channels[_0x553adb[_0xc769('0x9')]]['ContactId']=_0x553adb[_0xc769('0x37')];}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')]['xmd-cdrtype'])){channels[_0x553adb['uniqueid']][_0xc769('0xb')]=_0x553adb['value'];}if(!_[_0xc769('0x1c')](_0x553adb['variable'][_0xc769('0x40')])){channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x41')]=_0x553adb[_0xc769('0x37')];}if(!_[_0xc769('0x1c')](_0x553adb[_0xc769('0x34')][_0xc769('0x42')])){channels[_0x553adb[_0xc769('0x9')]][_0xc769('0x42')]=_0x553adb[_0xc769('0x37')];}}}catch(_0x7f6dcf){utils['error'](_0x7f6dcf[_0xc769('0x1b')]);}};exports['newexten']=function(_0xaf1c66){try{if(!_[_0xc769('0x1c')](channels[_0xaf1c66['uniqueid']])){if(_0xaf1c66['application'][_0xc769('0x43')]()==_0xc769('0x44')&&_['startsWith'](_0xaf1c66[_0xc769('0x45')][_0xc769('0x43')](),_0xc769('0x46'))){var _0xa13bff=_0xaf1c66[_0xc769('0x45')]['split']('=');var _0x3a443f=_0xa13bff[0x0][_0xc769('0x47')](_0xa13bff[0x0][_0xc769('0x48')]('(')+0x1,_0xa13bff[0x0][_0xc769('0x48')](')'));var _0x29ad8c=_0xa13bff[0x1];channels[_0xaf1c66['uniqueid']][_0x3a443f]=_0x29ad8c;}if(!_[_0xc769('0x49')](['hangup',_0xc769('0x4a'),_0xc769('0x4b'),_0xc769('0x44'),_0xc769('0x4c')],_0xaf1c66[_0xc769('0x4d')]['toLowerCase']())){channels[_0xaf1c66['uniqueid']][_0xc769('0x4e')]=_0xaf1c66[_0xc769('0x4d')];channels[_0xaf1c66[_0xc769('0x9')]][_0xc769('0x3d')]=_0xaf1c66[_0xc769('0x45')];}}}catch(_0x41c07e){utils[_0xc769('0x1a')](_0x41c07e[_0xc769('0x1b')]);}}; \ No newline at end of file +var _0x869e=['newchannel','OutgoingSpoolFailed','accountcode','exten','now','DOCUMENTATION','error','stack','newstate','isNil','channelstate','systemanswertime','context','transfer','linkedid','destinationchannel','answertime','toNumber','hangup','callerid','calleridname','duration','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','variable','value','\x22\x20<','xmd-callerid','Queue','lastdata','queue','ContactId','outboundrouteid','newexten','application','set','startsWith','appdata','toLowerCase','cdr','split','lastIndexOf','includes','gotoif','lastapplication','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','source','destination','disposition','then','UserId','CreateVoiceCallReport','uniqueid'];(function(_0x1ac453,_0x42e330){var _0x283989=function(_0x510627){while(--_0x510627){_0x1ac453['push'](_0x1ac453['shift']());}};_0x283989(++_0x42e330);}(_0x869e,0x1ea));var _0xe869=function(_0x507906,_0x199d52){_0x507906=_0x507906-0x0;var _0x3f077b=_0x869e[_0x507906];return _0x3f077b;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dispositions=[_0xe869('0x0'),_0xe869('0x1'),'FAILED','NO\x20ANSWER','NO\x20ANSWER',_0xe869('0x0'),_0xe869('0x2'),_0xe869('0x3'),'FAILED','FAILED',_0xe869('0x1')];var channels={};function writeDB(_0x750350){utils[_0xe869('0x4')](util['format'](_0xe869('0x5'),_0x750350['uniqueid'],_0x750350[_0xe869('0x6')],_0x750350['type'],_0x750350['accountcode'],_0x750350[_0xe869('0x7')],_0x750350[_0xe869('0x8')],_0x750350['callerid'],_0x750350[_0xe869('0x9')]));if(_0x750350['accountcode']){utils['getUserByInternal'](_0x750350['accountcode'])[_0xe869('0xa')](function(_0x33bc91){if(_0x33bc91){_0x750350[_0xe869('0xb')]=_0x33bc91['id'];}utils['request'](_0xe869('0xc'),_0x750350);});}else{utils['request'](_0xe869('0xc'),_0x750350);}if(channels[_0x750350[_0xe869('0xd')]]){delete channels[_0x750350[_0xe869('0xd')]];}}exports[_0xe869('0xe')]=function(_0x577971){try{if(_0x577971[_0xe869('0xd')]==_0x577971['linkedid']&&_0x577971[_0xe869('0x6')]!=_0xe869('0xf')){channels[_0x577971[_0xe869('0xd')]]={'uniqueid':_0x577971[_0xe869('0xd')],'accountcode':_0x577971[_0xe869('0x10')],'source':_0x577971['calleridnum'],'destination':_0x577971[_0xe869('0x11')],'destinationcontext':_0x577971['context'],'channel':_0x577971[_0xe869('0x6')],'starttime':utils[_0xe869('0x12')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe869('0x0'),'amaflags':_0xe869('0x13')};}}catch(_0x476cb0){utils[_0xe869('0x14')](_0x476cb0[_0xe869('0x15')]);}};exports[_0xe869('0x16')]=function(_0x144889){try{if(!_[_0xe869('0x17')](channels[_0x144889[_0xe869('0xd')]])&&_0x144889[_0xe869('0x18')]==0x6){if(_[_0xe869('0x17')](channels[_0x144889[_0xe869('0xd')]][_0xe869('0x19')])){channels[_0x144889[_0xe869('0xd')]][_0xe869('0x19')]=utils['now']();}}else if(!_[_0xe869('0x17')](channels[_0x144889['linkedid']])&&_0x144889['channelstate']==0x6&&_0x144889[_0xe869('0x1a')]!=_0xe869('0x1b')){channels[_0x144889[_0xe869('0x1c')]][_0xe869('0x10')]=_0x144889['accountcode'];channels[_0x144889[_0xe869('0x1c')]][_0xe869('0x1d')]=_0x144889[_0xe869('0x6')];if(_['isNil'](channels[_0x144889[_0xe869('0x1c')]]['answertime'])){channels[_0x144889[_0xe869('0x1c')]][_0xe869('0x1e')]=utils[_0xe869('0x12')]();}channels[_0x144889[_0xe869('0x1c')]][_0xe869('0x9')]=dispositions[_[_0xe869('0x1f')](_0x144889['channelstate'])]||'ANSWERED';}}catch(_0x56e3bb){utils[_0xe869('0x14')](_0x56e3bb[_0xe869('0x15')]);}};exports[_0xe869('0x20')]=function(_0x4111b3){try{if(!_['isNil'](channels[_0x4111b3[_0xe869('0xd')]])){if(_['isNil'](channels[_0x4111b3['uniqueid']][_0xe869('0x21')])){channels[_0x4111b3[_0xe869('0xd')]]['callerid']=_0x4111b3[_0xe869('0x22')]+'\x20<'+_0x4111b3['calleridnum']+'>';}channels[_0x4111b3[_0xe869('0xd')]]['endtime']=utils[_0xe869('0x12')]();channels[_0x4111b3[_0xe869('0xd')]][_0xe869('0x23')]=utils['diffTime'](channels[_0x4111b3[_0xe869('0xd')]][_0xe869('0x24')],channels[_0x4111b3[_0xe869('0xd')]][_0xe869('0x25')]);channels[_0x4111b3[_0xe869('0xd')]][_0xe869('0x26')]=channels[_0x4111b3[_0xe869('0xd')]][_0xe869('0x1e')]?utils[_0xe869('0x27')](channels[_0x4111b3[_0xe869('0xd')]][_0xe869('0x24')],channels[_0x4111b3[_0xe869('0xd')]][_0xe869('0x1e')]):0x0;writeDB(channels[_0x4111b3[_0xe869('0xd')]]);}}catch(_0xa48815){utils['error'](_0xa48815[_0xe869('0x15')]);}};exports[_0xe869('0x28')]=function(_0x16ad96){try{if(!_[_0xe869('0x17')](channels[_0x16ad96[_0xe869('0x29')]])){if(channels[_0x16ad96['localtwolinkedid']][_0xe869('0x6')]==_0x16ad96[_0xe869('0x2a')]){channels[_0x16ad96['localtwolinkedid']][_0xe869('0x1d')]=_0x16ad96[_0xe869('0x2b')];channels[_0x16ad96['localtwolinkedid']]['userfield']=_0xe869('0x2c');}else if(channels[_0x16ad96[_0xe869('0x29')]][_0xe869('0x6')]=_0x16ad96[_0xe869('0x2d')]){channels[_0x16ad96['localtwolinkedid']]['destinationchannel']=_0x16ad96[_0xe869('0x2e')];channels[_0x16ad96[_0xe869('0x29')]]['userfield']='_attended';}}}catch(_0x3b8c65){utils[_0xe869('0x14')](_0x3b8c65[_0xe869('0x15')]);}};exports[_0xe869('0x2f')]=function(_0x1bc5b7){try{if(!_[_0xe869('0x17')](channels[_0x1bc5b7['uniqueid']])){channels[_0x1bc5b7[_0xe869('0xd')]][_0xe869('0x30')]=utils[_0xe869('0x12')]();}}catch(_0x58732e){utils['error'](_0x58732e[_0xe869('0x15')]);}};exports[_0xe869('0x31')]=function(_0x2aff72){try{if(!_[_0xe869('0x17')](channels[_0x2aff72['uniqueid']])){if(!_[_0xe869('0x17')](channels[_0x2aff72[_0xe869('0xd')]][_0xe869('0x30')])){channels[_0x2aff72['uniqueid']][_0xe869('0x32')]+=utils[_0xe869('0x27')](utils[_0xe869('0x12')](),channels[_0x2aff72[_0xe869('0xd')]][_0xe869('0x30')]);delete channels[_0x2aff72[_0xe869('0xd')]]['musiconholdstartAt'];}}}catch(_0x334399){utils[_0xe869('0x14')](_0x334399[_0xe869('0x15')]);}};exports['varset']=function(_0x50409a){try{if(!_[_0xe869('0x17')](channels[_0x50409a[_0xe869('0xd')]])){if(!_['isNil'](_0x50409a[_0xe869('0x33')]['xmd-originatecalleridnum'])){channels[_0x50409a[_0xe869('0xd')]][_0xe869('0x7')]=_0x50409a['value'];}if(!_['isNil'](_0x50409a[_0xe869('0x33')]['xmd-phone'])){channels[_0x50409a[_0xe869('0xd')]][_0xe869('0x8')]=_0x50409a[_0xe869('0x34')];channels[_0x50409a[_0xe869('0xd')]][_0xe869('0x21')]='\x22'+_0x50409a[_0xe869('0x34')]+_0xe869('0x35')+_0x50409a[_0xe869('0x34')]+'>';}if(!_[_0xe869('0x17')](_0x50409a[_0xe869('0x33')]['xmd-callerid-preview'])||!_[_0xe869('0x17')](_0x50409a[_0xe869('0x33')][_0xe869('0x36')])){channels[_0x50409a[_0xe869('0xd')]][_0xe869('0x21')]=_0x50409a[_0xe869('0x34')];}if(!_[_0xe869('0x17')](_0x50409a[_0xe869('0x33')]['xmd-queue'])||!_[_0xe869('0x17')](_0x50409a['variable']['xmcs-queue'])){channels[_0x50409a['uniqueid']]['lastapplication']=_0xe869('0x37');channels[_0x50409a['uniqueid']][_0xe869('0x38')]=_0x50409a[_0xe869('0x34')];channels[_0x50409a[_0xe869('0xd')]][_0xe869('0x39')]=!![];}if(!_[_0xe869('0x17')](_0x50409a[_0xe869('0x33')]['xmd-contactid'])){channels[_0x50409a['uniqueid']][_0xe869('0x3a')]=_0x50409a['value'];}if(!_['isNil'](_0x50409a[_0xe869('0x33')]['xmd-cdrtype'])){channels[_0x50409a['uniqueid']]['type']=_0x50409a[_0xe869('0x34')];}if(!_[_0xe869('0x17')](_0x50409a['variable'][_0xe869('0x3b')])){channels[_0x50409a['uniqueid']]['routeid']=_0x50409a['value'];}if(!_[_0xe869('0x17')](_0x50409a[_0xe869('0x33')]['sipcallid'])){channels[_0x50409a[_0xe869('0xd')]]['sipcallid']=_0x50409a[_0xe869('0x34')];}}}catch(_0x1e5745){utils['error'](_0x1e5745['stack']);}};exports[_0xe869('0x3c')]=function(_0x42520a){try{if(!_[_0xe869('0x17')](channels[_0x42520a[_0xe869('0xd')]])){if(_0x42520a[_0xe869('0x3d')]['toLowerCase']()==_0xe869('0x3e')&&_[_0xe869('0x3f')](_0x42520a[_0xe869('0x40')][_0xe869('0x41')](),_0xe869('0x42'))){var _0x4697f0=_0x42520a[_0xe869('0x40')][_0xe869('0x43')]('=');var _0x5abbf8=_0x4697f0[0x0]['substring'](_0x4697f0[0x0][_0xe869('0x44')]('(')+0x1,_0x4697f0[0x0][_0xe869('0x44')](')'));var _0x516a87=_0x4697f0[0x1];channels[_0x42520a[_0xe869('0xd')]][_0x5abbf8]=_0x516a87;}if(!_[_0xe869('0x45')]([_0xe869('0x20'),'noop','execif',_0xe869('0x3e'),_0xe869('0x46')],_0x42520a[_0xe869('0x3d')][_0xe869('0x41')]())){channels[_0x42520a[_0xe869('0xd')]][_0xe869('0x47')]=_0x42520a[_0xe869('0x3d')];channels[_0x42520a['uniqueid']][_0xe869('0x38')]=_0x42520a[_0xe869('0x40')];}}}catch(_0x3e4b0b){utils[_0xe869('0x14')](_0x3e4b0b[_0xe869('0x15')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c2e454b..b600b41 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 _0x2d72=['FULLYBOOTED','error','CLOSE','./utils','lodash','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted'];(function(_0xb837f5,_0x3f80a9){var _0x357368=function(_0x432e64){while(--_0x432e64){_0xb837f5['push'](_0xb837f5['shift']());}};_0x357368(++_0x3f80a9);}(_0x2d72,0xa8));var _0x22d7=function(_0x2ae6e9,_0x3e0adf){_0x2ae6e9=_0x2ae6e9-0x0;var _0x2e7c47=_0x2d72[_0x2ae6e9];return _0x2e7c47;};'use strict';var utils=require(_0x22d7('0x0'));var _=require(_0x22d7('0x1'));exports[_0x22d7('0x2')]=function(){utils[_0x22d7('0x3')](_0x22d7('0x4'));};exports[_0x22d7('0x5')]=function(){utils[_0x22d7('0x3')](_0x22d7('0x6'));};exports[_0x22d7('0x7')]=function(){utils[_0x22d7('0x3')](_0x22d7('0x8'));};exports[_0x22d7('0x9')]=function(_0x208b5b){utils[_0x22d7('0x9')](_0x208b5b);};exports['close']=function(){utils[_0x22d7('0x3')](_0x22d7('0xa'));};exports['managerevent']=function(_0x3b12cd){}; \ No newline at end of file +var _0x9c5a=['managerevent','./utils','lodash','info','CONNECTED','shutdown','fullybooted','error','close'];(function(_0x5bd441,_0x28f46b){var _0x26f70b=function(_0x5edf8e){while(--_0x5edf8e){_0x5bd441['push'](_0x5bd441['shift']());}};_0x26f70b(++_0x28f46b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4a80ce,_0x4d6f84){_0x4a80ce=_0x4a80ce-0x0;var _0x6e6354=_0x9c5a[_0x4a80ce];return _0x6e6354;};'use strict';var utils=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));exports['connect']=function(){utils[_0xa9c5('0x2')](_0xa9c5('0x3'));};exports[_0xa9c5('0x4')]=function(){utils[_0xa9c5('0x2')]('SHUTDOWN');};exports[_0xa9c5('0x5')]=function(){utils[_0xa9c5('0x2')]('FULLYBOOTED');};exports[_0xa9c5('0x6')]=function(_0x4d9c7a){utils[_0xa9c5('0x6')](_0x4d9c7a);};exports[_0xa9c5('0x7')]=function(){utils['info']('CLOSE');};exports[_0xa9c5('0x8')]=function(_0x16f331){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3acceb1..06355b3 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 _0x2083=['CreateVoiceDialReport','newexten','application','toLowerCase','set','cdr(routeid)','appdata','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','called','dialend','dialstatus','ANSWER','answertime','connect','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','request'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x2083,0x137));var _0x3208=function(_0x2b2c4a,_0xe845d7){_0x2b2c4a=_0x2b2c4a-0x0;var _0x536e6e=_0x2083[_0x2b2c4a];return _0x536e6e;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x282228){utils[_0x3208('0x2')](util[_0x3208('0x3')](_0x3208('0x4'),_0x282228[_0x3208('0x5')],_0x282228[_0x3208('0x6')],_0x282228[_0x3208('0x7')],_0x282228['calleridnum'],_0x282228['connectedlinenum'],_0x282228['dialstatus']));utils[_0x3208('0x8')](_0x3208('0x9'),_0x282228);delete dials[_0x282228[_0x3208('0x5')]];}exports[_0x3208('0xa')]=function(_0x564ff6){try{if(_0x564ff6[_0x3208('0xb')][_0x3208('0xc')]()==_0x3208('0xd')&&_['startsWith'](_0x564ff6['appdata'][_0x3208('0xc')](),_0x3208('0xe'))){var _0x336c54=_0x564ff6[_0x3208('0xf')]['split']('=');dials[_0x564ff6['uniqueid']]={'routeId':_0x336c54[0x1]};}}catch(_0x418dbd){utils[_0x3208('0x10')](_0x418dbd[_0x3208('0x11')]);}};exports[_0x3208('0x12')]=function(_0x174620){try{if(!_[_0x3208('0x13')](_0x174620[_0x3208('0x14')][_0x3208('0x15')])){dials[_0x174620[_0x3208('0x5')]]={'routeId':_0x174620[_0x3208('0x16')]};}}catch(_0x3deca8){utils[_0x3208('0x10')](_0x3deca8[_0x3208('0x11')]);}};exports[_0x3208('0x17')]=function(_0x49785f){try{if(!_[_0x3208('0x13')](dials[_0x49785f[_0x3208('0x5')]])){dials[_0x49785f[_0x3208('0x5')]]=_[_0x3208('0x18')](dials[_0x49785f[_0x3208('0x5')]],_0x49785f);dials[_0x49785f['uniqueid']][_0x3208('0x19')]=utils[_0x3208('0x1a')]();dials[_0x49785f['uniqueid']][_0x3208('0x1b')]=_0x3208('0x1c');}}catch(_0x3b45bf){utils[_0x3208('0x10')](_0x3b45bf[_0x3208('0x11')]);}};exports[_0x3208('0x1d')]=function(_0x50d1ba){try{if(!_[_0x3208('0x13')](dials[_0x50d1ba[_0x3208('0x5')]])){dials[_0x50d1ba[_0x3208('0x5')]][_0x3208('0x1e')]=_0x50d1ba[_0x3208('0x1e')];if(_0x50d1ba[_0x3208('0x1e')]==_0x3208('0x1f')){dials[_0x50d1ba['uniqueid']]=_[_0x3208('0x18')](dials[_0x50d1ba[_0x3208('0x5')]],_0x50d1ba);dials[_0x50d1ba['uniqueid']][_0x3208('0x20')]=utils[_0x3208('0x1a')]();dials[_0x50d1ba[_0x3208('0x5')]][_0x3208('0x1b')]=_0x3208('0x21');}}}catch(_0x2ce30e){utils[_0x3208('0x10')](_0x2ce30e['stack']);}};exports['hangup']=function(_0xd9ad58){try{if(!_[_0x3208('0x13')](dials[_0xd9ad58[_0x3208('0x5')]])){dials[_0xd9ad58[_0x3208('0x5')]]=_[_0x3208('0x18')](dials[_0xd9ad58[_0x3208('0x5')]],{'endtime':utils['now'](),'lastevent':_0x3208('0x22')});dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x23')]=utils[_0x3208('0x24')](dials[_0xd9ad58['uniqueid']][_0x3208('0x25')],dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x19')]);dials[_0xd9ad58['uniqueid']][_0x3208('0x26')]=utils[_0x3208('0x24')](dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x20')]||dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x25')],dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x19')]);dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x27')]=dials[_0xd9ad58[_0x3208('0x5')]][_0x3208('0x20')]?utils[_0x3208('0x24')](dials[_0xd9ad58[_0x3208('0x5')]]['endtime'],dials[_0xd9ad58['uniqueid']][_0x3208('0x20')]):0x0;writeDB(dials[_0xd9ad58[_0x3208('0x5')]]);}}catch(_0x10e1ea){utils['error'](_0x10e1ea[_0x3208('0x11')]);}}; \ No newline at end of file +var _0xbf30=['dialend','ANSWER','answertime','connect','hangup','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','format','uniqueid','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','application','toLowerCase','appdata','error','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','called','stack'];(function(_0x48f637,_0x346cbd){var _0x213b61=function(_0x2c418e){while(--_0x2c418e){_0x48f637['push'](_0x48f637['shift']());}};_0x213b61(++_0x346cbd);}(_0xbf30,0x133));var _0x0bf3=function(_0x3858a6,_0x3030da){_0x3858a6=_0x3858a6-0x0;var _0x27dfb0=_0xbf30[_0x3858a6];return _0x27dfb0;};'use strict';var _=require('lodash');var util=require(_0x0bf3('0x0'));var utils=require(_0x0bf3('0x1'));var dials={};function writeDB(_0x5100a7){utils[_0x0bf3('0x2')](util[_0x0bf3('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x5100a7[_0x0bf3('0x4')],_0x5100a7['channel'],_0x5100a7[_0x0bf3('0x5')],_0x5100a7['calleridnum'],_0x5100a7[_0x0bf3('0x6')],_0x5100a7[_0x0bf3('0x7')]));utils[_0x0bf3('0x8')](_0x0bf3('0x9'),_0x5100a7);delete dials[_0x5100a7[_0x0bf3('0x4')]];}exports['newexten']=function(_0x1bd36d){try{if(_0x1bd36d[_0x0bf3('0xa')][_0x0bf3('0xb')]()=='set'&&_['startsWith'](_0x1bd36d[_0x0bf3('0xc')][_0x0bf3('0xb')](),'cdr(routeid)')){var _0x538d28=_0x1bd36d[_0x0bf3('0xc')]['split']('=');dials[_0x1bd36d['uniqueid']]={'routeId':_0x538d28[0x1]};}}catch(_0x33f1e9){utils[_0x0bf3('0xd')](_0x33f1e9['stack']);}};exports[_0x0bf3('0xe')]=function(_0x44c496){try{if(!_[_0x0bf3('0xf')](_0x44c496[_0x0bf3('0x10')][_0x0bf3('0x11')])){dials[_0x44c496['uniqueid']]={'routeId':_0x44c496[_0x0bf3('0x12')]};}}catch(_0x3acfd6){utils[_0x0bf3('0xd')](_0x3acfd6['stack']);}};exports[_0x0bf3('0x13')]=function(_0x3c2184){try{if(!_[_0x0bf3('0xf')](dials[_0x3c2184[_0x0bf3('0x4')]])){dials[_0x3c2184['uniqueid']]=_[_0x0bf3('0x14')](dials[_0x3c2184[_0x0bf3('0x4')]],_0x3c2184);dials[_0x3c2184[_0x0bf3('0x4')]][_0x0bf3('0x15')]=utils[_0x0bf3('0x16')]();dials[_0x3c2184['uniqueid']][_0x0bf3('0x17')]=_0x0bf3('0x18');}}catch(_0x1cd4bf){utils[_0x0bf3('0xd')](_0x1cd4bf[_0x0bf3('0x19')]);}};exports[_0x0bf3('0x1a')]=function(_0x5e57f7){try{if(!_[_0x0bf3('0xf')](dials[_0x5e57f7['uniqueid']])){dials[_0x5e57f7[_0x0bf3('0x4')]][_0x0bf3('0x7')]=_0x5e57f7['dialstatus'];if(_0x5e57f7[_0x0bf3('0x7')]==_0x0bf3('0x1b')){dials[_0x5e57f7['uniqueid']]=_['assign'](dials[_0x5e57f7[_0x0bf3('0x4')]],_0x5e57f7);dials[_0x5e57f7['uniqueid']][_0x0bf3('0x1c')]=utils[_0x0bf3('0x16')]();dials[_0x5e57f7[_0x0bf3('0x4')]][_0x0bf3('0x17')]=_0x0bf3('0x1d');}}}catch(_0xc0e3c){utils[_0x0bf3('0xd')](_0xc0e3c[_0x0bf3('0x19')]);}};exports[_0x0bf3('0x1e')]=function(_0x5bea41){try{if(!_[_0x0bf3('0xf')](dials[_0x5bea41[_0x0bf3('0x4')]])){dials[_0x5bea41[_0x0bf3('0x4')]]=_[_0x0bf3('0x14')](dials[_0x5bea41['uniqueid']],{'endtime':utils[_0x0bf3('0x16')](),'lastevent':_0x0bf3('0x1f')});dials[_0x5bea41[_0x0bf3('0x4')]][_0x0bf3('0x20')]=utils[_0x0bf3('0x21')](dials[_0x5bea41['uniqueid']][_0x0bf3('0x22')],dials[_0x5bea41[_0x0bf3('0x4')]]['starttime']);dials[_0x5bea41['uniqueid']][_0x0bf3('0x23')]=utils[_0x0bf3('0x21')](dials[_0x5bea41[_0x0bf3('0x4')]][_0x0bf3('0x1c')]||dials[_0x5bea41[_0x0bf3('0x4')]]['endtime'],dials[_0x5bea41[_0x0bf3('0x4')]][_0x0bf3('0x15')]);dials[_0x5bea41[_0x0bf3('0x4')]][_0x0bf3('0x24')]=dials[_0x5bea41[_0x0bf3('0x4')]][_0x0bf3('0x1c')]?utils['diffTime'](dials[_0x5bea41[_0x0bf3('0x4')]]['endtime'],dials[_0x5bea41[_0x0bf3('0x4')]][_0x0bf3('0x1c')]):0x0;writeDB(dials[_0x5bea41['uniqueid']]);}}catch(_0x12316e){utils[_0x0bf3('0xd')](_0x12316e[_0x0bf3('0x19')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 9f97ead..15477b1 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 _0xe5b9=['./utils','asterisk','port','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe5b9,0xa2));var _0x9e5b=function(_0x203ebe,_0x2c80c4){_0x203ebe=_0x203ebe-0x0;var _0x328b0=_0xe5b9[_0x203ebe];return _0x328b0;};var AsteriskManager=require(_0x9e5b('0x0'));var config=require(_0x9e5b('0x1'));var utils=require(_0x9e5b('0x2'));var ami=new AsteriskManager(config[_0x9e5b('0x3')][_0x9e5b('0x4')],config[_0x9e5b('0x3')]['ip'],config[_0x9e5b('0x3')]['username'],config['asterisk'][_0x9e5b('0x5')],!![]);ami[_0x9e5b('0x6')]();if(config[_0x9e5b('0x7')]&&config[_0x9e5b('0x7')][_0x9e5b('0x8')]){utils[_0x9e5b('0x9')](_0x9e5b('0xa'));}else{var agents=require(_0x9e5b('0xb'));var calls=require(_0x9e5b('0xc'));var queues=require(_0x9e5b('0xd'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x9e5b('0xe'));var transfers=require(_0x9e5b('0xf'));var core=require(_0x9e5b('0x10'));ami['on'](_0x9e5b('0x11'),core[_0x9e5b('0x11')]);ami['on'](_0x9e5b('0x12'),core[_0x9e5b('0x12')]);ami['on'](_0x9e5b('0x13'),core[_0x9e5b('0x13')]);ami['on']('error',core[_0x9e5b('0x14')]);ami['on']('close',core['close']);ami['on'](_0x9e5b('0x15'),core['managerevent']);ami['on']('devicestatechange',function(_0xfbfd6c){try{members['devicestatechange'](_0xfbfd6c);}catch(_0x12192d){utils[_0x9e5b('0x14')](_0x12192d);}});ami['on'](_0x9e5b('0x16'),function(_0xbf7fa9){try{agents[_0x9e5b('0x16')](_0xbf7fa9);}catch(_0x3df398){utils[_0x9e5b('0x14')](_0x3df398);}});ami['on'](_0x9e5b('0x17'),function(_0x5c3f2f){try{agents[_0x9e5b('0x17')](_0x5c3f2f);}catch(_0x11ecf1){utils[_0x9e5b('0x14')](_0x11ecf1);}});ami['on'](_0x9e5b('0x18'),function(_0x5a0be7){try{agents[_0x9e5b('0x18')](_0x5a0be7);queues[_0x9e5b('0x18')](_0x5a0be7);}catch(_0x3f5ec5){utils[_0x9e5b('0x14')](_0x3f5ec5);}});ami['on']('agentcomplete',function(_0x79656c){try{agents['agentcomplete'](_0x79656c);queues[_0x9e5b('0x19')](_0x79656c);members[_0x9e5b('0x19')](_0x79656c);}catch(_0x4daf4d){utils[_0x9e5b('0x14')](_0x4daf4d);}});ami['on'](_0x9e5b('0x1a'),function(_0x1f001f){try{agents[_0x9e5b('0x1a')](_0x1f001f);queues[_0x9e5b('0x1a')](_0x1f001f);}catch(_0xaa87a6){utils[_0x9e5b('0x14')](_0xaa87a6);}});ami['on'](_0x9e5b('0x1b'),function(_0x74c29d){try{queues[_0x9e5b('0x1b')](_0x74c29d);recordings[_0x9e5b('0x1b')](_0x74c29d);}catch(_0x3c998b){utils['error'](_0x3c998b);}});ami['on'](_0x9e5b('0x1c'),function(_0x2ffba5){try{queues['queuecallerleave'](_0x2ffba5);}catch(_0x2ca4a1){utils[_0x9e5b('0x14')](_0x2ca4a1);}});ami['on'](_0x9e5b('0x1d'),function(_0x1de18f){try{queues[_0x9e5b('0x1d')](_0x1de18f);calls[_0x9e5b('0x1d')](_0x1de18f);}catch(_0x11b65b){utils['error'](_0x11b65b);}});ami['on'](_0x9e5b('0x1e'),function(_0x4bc03a){try{queues[_0x9e5b('0x1e')](_0x4bc03a);calls[_0x9e5b('0x1e')](_0x4bc03a);}catch(_0x3ebf74){utils[_0x9e5b('0x14')](_0x3ebf74);}});ami['on'](_0x9e5b('0x1f'),function(_0x331271){try{calls['newstate'](_0x331271);recordings[_0x9e5b('0x1f')](_0x331271);}catch(_0x2e9472){utils[_0x9e5b('0x14')](_0x2e9472);}});ami['on'](_0x9e5b('0x20'),function(_0x561072){try{calls[_0x9e5b('0x20')](_0x561072);recordings[_0x9e5b('0x20')](_0x561072);dials[_0x9e5b('0x20')](_0x561072);agents['hangup'](_0x561072);queues[_0x9e5b('0x20')](_0x561072);}catch(_0x5a5915){utils[_0x9e5b('0x14')](_0x5a5915);}});ami['on'](_0x9e5b('0x21'),function(_0xb6c9b3){try{members[_0x9e5b('0x21')](_0xb6c9b3);}catch(_0x424ce4){utils[_0x9e5b('0x14')](_0x424ce4);}});ami['on'](_0x9e5b('0x22'),function(_0x5efc85){try{queues[_0x9e5b('0x22')](_0x5efc85);agents[_0x9e5b('0x22')](_0x5efc85);transfers[_0x9e5b('0x22')](_0x5efc85);}catch(_0x3dd4ab){utils['error'](_0x3dd4ab);}});ami['on']('attendedtransfer',function(_0x2d2309){try{queues[_0x9e5b('0x23')](_0x2d2309);transfers[_0x9e5b('0x23')](_0x2d2309);agents['attendedtransfer'](_0x2d2309);calls[_0x9e5b('0x23')](_0x2d2309);}catch(_0x5e37a3){utils[_0x9e5b('0x14')](_0x5e37a3);}});ami['on']('varset',function(_0x2b06fe){try{queues['varset'](_0x2b06fe);recordings[_0x9e5b('0x24')](_0x2b06fe);calls['varset'](_0x2b06fe);dials['varset'](_0x2b06fe);}catch(_0x19e9ff){utils['error'](_0x19e9ff);}});ami['on']('newexten',function(_0x4fb1ce){try{calls[_0x9e5b('0x25')](_0x4fb1ce);recordings[_0x9e5b('0x25')](_0x4fb1ce);dials[_0x9e5b('0x25')](_0x4fb1ce);}catch(_0x362aeb){utils[_0x9e5b('0x14')](_0x362aeb);}});ami['on'](_0x9e5b('0x26'),function(_0x394e2b){try{calls[_0x9e5b('0x26')](_0x394e2b);recordings[_0x9e5b('0x26')](_0x394e2b);}catch(_0x1c4472){utils[_0x9e5b('0x14')](_0x1c4472);}});ami['on'](_0x9e5b('0x27'),function(_0x165a84){try{dials[_0x9e5b('0x27')](_0x165a84);}catch(_0x5591ea){utils[_0x9e5b('0x14')](_0x5591ea);}});ami['on']('dialend',function(_0x4d72e0){try{dials[_0x9e5b('0x28')](_0x4d72e0);}catch(_0x217ee6){utils[_0x9e5b('0x14')](_0x217ee6);}});} \ No newline at end of file +var _0x106b=['agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','port','username','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','managerevent','devicestatechange','error'];(function(_0x48c846,_0x2f04a5){var _0x1782fa=function(_0x5f4e71){while(--_0x5f4e71){_0x48c846['push'](_0x48c846['shift']());}};_0x1782fa(++_0x2f04a5);}(_0x106b,0x1e1));var _0xb106=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x106b[_0x1562a2];return _0x39a636;};var AsteriskManager=require(_0xb106('0x0'));var config=require(_0xb106('0x1'));var utils=require(_0xb106('0x2'));var ami=new AsteriskManager(config[_0xb106('0x3')][_0xb106('0x4')],config[_0xb106('0x3')]['ip'],config['asterisk'][_0xb106('0x5')],config[_0xb106('0x3')]['password'],!![]);ami[_0xb106('0x6')]();if(config[_0xb106('0x7')]&&config[_0xb106('0x7')]['disabled']){utils[_0xb106('0x8')](_0xb106('0x9'));}else{var agents=require(_0xb106('0xa'));var calls=require(_0xb106('0xb'));var queues=require(_0xb106('0xc'));var recordings=require(_0xb106('0xd'));var members=require(_0xb106('0xe'));var dials=require(_0xb106('0xf'));var transfers=require(_0xb106('0x10'));var core=require(_0xb106('0x11'));ami['on']('connect',core[_0xb106('0x12')]);ami['on'](_0xb106('0x13'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on']('error',core['error']);ami['on']('close',core['close']);ami['on'](_0xb106('0x14'),core[_0xb106('0x14')]);ami['on'](_0xb106('0x15'),function(_0xbe3240){try{members[_0xb106('0x15')](_0xbe3240);}catch(_0x30ad29){utils[_0xb106('0x16')](_0x30ad29);}});ami['on'](_0xb106('0x17'),function(_0x6148ba){try{agents[_0xb106('0x17')](_0x6148ba);}catch(_0x27e024){utils[_0xb106('0x16')](_0x27e024);}});ami['on'](_0xb106('0x18'),function(_0x20b07f){try{agents[_0xb106('0x18')](_0x20b07f);}catch(_0x1d401e){utils[_0xb106('0x16')](_0x1d401e);}});ami['on'](_0xb106('0x19'),function(_0x51631b){try{agents['agentconnect'](_0x51631b);queues[_0xb106('0x19')](_0x51631b);}catch(_0x141967){utils[_0xb106('0x16')](_0x141967);}});ami['on']('agentcomplete',function(_0x53e54c){try{agents[_0xb106('0x1a')](_0x53e54c);queues['agentcomplete'](_0x53e54c);members['agentcomplete'](_0x53e54c);}catch(_0x454a6c){utils[_0xb106('0x16')](_0x454a6c);}});ami['on']('queuecallerabandon',function(_0x300728){try{agents[_0xb106('0x1b')](_0x300728);queues[_0xb106('0x1b')](_0x300728);}catch(_0x54c59c){utils['error'](_0x54c59c);}});ami['on'](_0xb106('0x1c'),function(_0x243f39){try{queues[_0xb106('0x1c')](_0x243f39);recordings[_0xb106('0x1c')](_0x243f39);}catch(_0x5d90f0){utils[_0xb106('0x16')](_0x5d90f0);}});ami['on'](_0xb106('0x1d'),function(_0x35dd01){try{queues[_0xb106('0x1d')](_0x35dd01);}catch(_0x3850e7){utils[_0xb106('0x16')](_0x3850e7);}});ami['on']('musiconholdstart',function(_0x79e106){try{queues[_0xb106('0x1e')](_0x79e106);calls['musiconholdstart'](_0x79e106);}catch(_0x3d46a4){utils['error'](_0x3d46a4);}});ami['on'](_0xb106('0x1f'),function(_0x19a755){try{queues[_0xb106('0x1f')](_0x19a755);calls[_0xb106('0x1f')](_0x19a755);}catch(_0x37e585){utils[_0xb106('0x16')](_0x37e585);}});ami['on'](_0xb106('0x20'),function(_0x58470b){try{calls[_0xb106('0x20')](_0x58470b);recordings[_0xb106('0x20')](_0x58470b);}catch(_0x30e63d){utils[_0xb106('0x16')](_0x30e63d);}});ami['on'](_0xb106('0x21'),function(_0x14e277){try{calls[_0xb106('0x21')](_0x14e277);recordings[_0xb106('0x21')](_0x14e277);dials['hangup'](_0x14e277);agents[_0xb106('0x21')](_0x14e277);queues[_0xb106('0x21')](_0x14e277);}catch(_0x37e959){utils['error'](_0x37e959);}});ami['on'](_0xb106('0x22'),function(_0x48ed08){try{members[_0xb106('0x22')](_0x48ed08);}catch(_0x1aeffb){utils[_0xb106('0x16')](_0x1aeffb);}});ami['on']('blindtransfer',function(_0xf6d467){try{queues[_0xb106('0x23')](_0xf6d467);agents[_0xb106('0x23')](_0xf6d467);transfers[_0xb106('0x23')](_0xf6d467);}catch(_0x182a16){utils['error'](_0x182a16);}});ami['on'](_0xb106('0x24'),function(_0x3d696a){try{queues[_0xb106('0x24')](_0x3d696a);transfers[_0xb106('0x24')](_0x3d696a);agents[_0xb106('0x24')](_0x3d696a);calls[_0xb106('0x24')](_0x3d696a);}catch(_0x299ddf){utils[_0xb106('0x16')](_0x299ddf);}});ami['on'](_0xb106('0x25'),function(_0x561dcf){try{queues[_0xb106('0x25')](_0x561dcf);recordings['varset'](_0x561dcf);calls['varset'](_0x561dcf);dials[_0xb106('0x25')](_0x561dcf);}catch(_0x45f656){utils[_0xb106('0x16')](_0x45f656);}});ami['on'](_0xb106('0x26'),function(_0x117652){try{calls[_0xb106('0x26')](_0x117652);recordings[_0xb106('0x26')](_0x117652);dials[_0xb106('0x26')](_0x117652);}catch(_0x5e3ab5){utils[_0xb106('0x16')](_0x5e3ab5);}});ami['on']('newchannel',function(_0x13e91e){try{calls[_0xb106('0x27')](_0x13e91e);recordings[_0xb106('0x27')](_0x13e91e);}catch(_0x3504e3){utils[_0xb106('0x16')](_0x3504e3);}});ami['on'](_0xb106('0x28'),function(_0x7ffde){try{dials['dialbegin'](_0x7ffde);}catch(_0x163246){utils['error'](_0x163246);}});ami['on']('dialend',function(_0x4a7fd2){try{dials[_0xb106('0x29')](_0x4a7fd2);}catch(_0x11d9f1){utils[_0xb106('0x16')](_0x11d9f1);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8c199cf..adc73bc 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 _0x3add=['membername','type','getUserByInterface','internal','CreateMemberReport','getUserByName','split','then','name','request','catch','error','some','devicestatechange','state','INUSE','device','voice','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','uniqueid','assign','queue','cdr','data1','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','data2'];(function(_0x3aab9e,_0x3c9d51){var _0x295a01=function(_0x25f7a6){while(--_0x25f7a6){_0x3aab9e['push'](_0x3aab9e['shift']());}};_0x295a01(++_0x3c9d51);}(_0x3add,0xce));var _0xd3ad=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x3add[_0x10dbf6];return _0x452147;};'use strict';var _=require(_0xd3ad('0x0'));var util=require(_0xd3ad('0x1'));var utils=require(_0xd3ad('0x2'));var members={};var exclude=[_0xd3ad('0x3'),'Queue:'];function writeDB(_0x4dddd1){utils['info'](util[_0xd3ad('0x4')](_0xd3ad('0x5'),_0x4dddd1['uniqueid'],_0x4dddd1[_0xd3ad('0x6')],_0x4dddd1[_0xd3ad('0x7')],_0x4dddd1[_0xd3ad('0x8')],_0x4dddd1[_0xd3ad('0x9')],_0x4dddd1[_0xd3ad('0xa')]));if(_0x4dddd1['interface']){utils[_0xd3ad('0xb')](_0x4dddd1[_0xd3ad('0x6')])['then'](function(_0xb0aec0){if(_0xb0aec0){_0x4dddd1[_0xd3ad('0x9')]=_0xb0aec0['name'];_0x4dddd1[_0xd3ad('0xc')]=_0xb0aec0[_0xd3ad('0xc')];utils['request'](_0xd3ad('0xd'),_0x4dddd1);}else{utils[_0xd3ad('0xe')](_0x4dddd1[_0xd3ad('0x6')][_0xd3ad('0xf')]('/')[0x1])[_0xd3ad('0x10')](function(_0x3e3d34){if(_0x3e3d34){_0x4dddd1[_0xd3ad('0x9')]=_0x3e3d34[_0xd3ad('0x11')];_0x4dddd1[_0xd3ad('0xc')]=_0x3e3d34[_0xd3ad('0xc')];utils[_0xd3ad('0x12')](_0xd3ad('0xd'),_0x4dddd1);}});}})[_0xd3ad('0x13')](function(_0x1e9a21){utils[_0xd3ad('0x14')](_0x1e9a21);});}delete members[_0x4dddd1[_0xd3ad('0x6')]];}function startsWith(_0x271250,_0x2ce702){return _[_0xd3ad('0x15')](_0x271250,function(_0x4e629e){return _['startsWith'](_0x2ce702,_0x4e629e);});}exports[_0xd3ad('0x16')]=function(_0x211727){switch(_0x211727[_0xd3ad('0x17')]){case _0xd3ad('0x18'):case'BUSY':if(!startsWith(exclude,_0x211727[_0xd3ad('0x19')])){members[_0x211727[_0xd3ad('0x19')]]={'channel':_0xd3ad('0x1a'),'interface':_0x211727['device'],'type':'TALKING','enterAt':utils[_0xd3ad('0x1b')](),'role':'agent'};}break;case _0xd3ad('0x1c'):if(!_[_0xd3ad('0x1d')](members[_0x211727[_0xd3ad('0x19')]])){members[_0x211727[_0xd3ad('0x19')]][_0xd3ad('0x1e')]=utils[_0xd3ad('0x1b')]();members[_0x211727[_0xd3ad('0x19')]][_0xd3ad('0x1f')]=utils[_0xd3ad('0x20')](members[_0x211727['device']][_0xd3ad('0x1e')],members[_0x211727[_0xd3ad('0x19')]][_0xd3ad('0x21')]);if(members[_0x211727[_0xd3ad('0x19')]][_0xd3ad('0x22')]){writeDB(members[_0x211727[_0xd3ad('0x19')]]);}}default:break;}};exports['agentcomplete']=function(_0x22db3f){if(!_['isNil'](members[_0x22db3f[_0xd3ad('0x6')]])){members[_0x22db3f[_0xd3ad('0x6')]]=_[_0xd3ad('0x23')](members[_0x22db3f[_0xd3ad('0x6')]],{'data4':_0x22db3f[_0xd3ad('0x24')],'uniqueid':_0x22db3f[_0xd3ad('0x22')]});}};exports[_0xd3ad('0x25')]=function(_0x36eee4){if(_0x36eee4[_0xd3ad('0x7')]){var _0x3fb6e9=_0x36eee4[_0xd3ad('0x7')][_0xd3ad('0xf')]('-')[0x0];if(!_['isNil'](members[_0x3fb6e9])){members[_0x3fb6e9]=_[_0xd3ad('0x23')](members[_0x3fb6e9],{'data1':members[_0x3fb6e9][_0xd3ad('0x26')]||_0x36eee4['type'],'data2':members[_0x3fb6e9][_0xd3ad('0x8')]||_0x36eee4[_0xd3ad('0x27')],'data3':members[_0x3fb6e9][_0xd3ad('0x28')]||_0x36eee4[_0xd3ad('0x29')],'uniqueid':members[_0x3fb6e9]['uniqueid']||_0x36eee4['uniqueid']});if(members[_0x3fb6e9][_0xd3ad('0x1e')]){writeDB(members[_0x3fb6e9]);}}}if(_0x36eee4[_0xd3ad('0x2a')]){var _0x487d18=_0x36eee4['destinationchannel'][_0xd3ad('0xf')]('-')[0x0];if(!_[_0xd3ad('0x1d')](members[_0x487d18])){members[_0x487d18]=_[_0xd3ad('0x23')](members[_0x487d18],{'data1':members[_0x487d18][_0xd3ad('0x26')]||_0x36eee4[_0xd3ad('0xa')],'data2':members[_0x487d18]['data2']||_0x36eee4[_0xd3ad('0x27')],'data3':members[_0x487d18]['data3']||_0x36eee4['destination'],'uniqueid':members[_0x487d18]['uniqueid']||_0x36eee4[_0xd3ad('0x22')]});if(members[_0x487d18][_0xd3ad('0x1e')]){writeDB(members[_0x487d18]);}}}}; \ No newline at end of file +var _0x2c85=['cdr','isNil','data1','data2','source','destinationchannel','data3','destination','lodash','./utils','Local/_attended@transfer','info','format','interface','channel','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','error','startsWith','INUSE','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','enterAt','uniqueid','agentcomplete','assign'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x2c85,0xd5));var _0x52c8=function(_0x2841d3,_0x216920){_0x2841d3=_0x2841d3-0x0;var _0x11c39c=_0x2c85[_0x2841d3];return _0x11c39c;};'use strict';var _=require(_0x52c8('0x0'));var util=require('util');var utils=require(_0x52c8('0x1'));var members={};var exclude=[_0x52c8('0x2'),'Queue:'];function writeDB(_0x521383){utils[_0x52c8('0x3')](util[_0x52c8('0x4')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x521383['uniqueid'],_0x521383[_0x52c8('0x5')],_0x521383[_0x52c8('0x6')],_0x521383['data2'],_0x521383[_0x52c8('0x7')],_0x521383[_0x52c8('0x8')]));if(_0x521383['interface']){utils[_0x52c8('0x9')](_0x521383[_0x52c8('0x5')])[_0x52c8('0xa')](function(_0x2c1bda){if(_0x2c1bda){_0x521383[_0x52c8('0x7')]=_0x2c1bda[_0x52c8('0xb')];_0x521383['internal']=_0x2c1bda[_0x52c8('0xc')];utils['request'](_0x52c8('0xd'),_0x521383);}else{utils[_0x52c8('0xe')](_0x521383[_0x52c8('0x5')][_0x52c8('0xf')]('/')[0x1])[_0x52c8('0xa')](function(_0x5c1256){if(_0x5c1256){_0x521383['membername']=_0x5c1256[_0x52c8('0xb')];_0x521383[_0x52c8('0xc')]=_0x5c1256[_0x52c8('0xc')];utils[_0x52c8('0x10')](_0x52c8('0xd'),_0x521383);}});}})['catch'](function(_0x477152){utils[_0x52c8('0x11')](_0x477152);});}delete members[_0x521383[_0x52c8('0x5')]];}function startsWith(_0x91109,_0x2badbc){return _['some'](_0x91109,function(_0x272d34){return _[_0x52c8('0x12')](_0x2badbc,_0x272d34);});}exports['devicestatechange']=function(_0x14ecf7){switch(_0x14ecf7['state']){case _0x52c8('0x13'):case _0x52c8('0x14'):if(!startsWith(exclude,_0x14ecf7[_0x52c8('0x15')])){members[_0x14ecf7[_0x52c8('0x15')]]={'channel':_0x52c8('0x16'),'interface':_0x14ecf7[_0x52c8('0x15')],'type':_0x52c8('0x17'),'enterAt':utils[_0x52c8('0x18')](),'role':_0x52c8('0x19')};}break;case _0x52c8('0x1a'):if(!_['isNil'](members[_0x14ecf7[_0x52c8('0x15')]])){members[_0x14ecf7[_0x52c8('0x15')]][_0x52c8('0x1b')]=utils[_0x52c8('0x18')]();members[_0x14ecf7[_0x52c8('0x15')]][_0x52c8('0x1c')]=utils['diffTime'](members[_0x14ecf7[_0x52c8('0x15')]]['exitAt'],members[_0x14ecf7[_0x52c8('0x15')]][_0x52c8('0x1d')]);if(members[_0x14ecf7[_0x52c8('0x15')]][_0x52c8('0x1e')]){writeDB(members[_0x14ecf7[_0x52c8('0x15')]]);}}default:break;}};exports[_0x52c8('0x1f')]=function(_0x21a853){if(!_['isNil'](members[_0x21a853[_0x52c8('0x5')]])){members[_0x21a853[_0x52c8('0x5')]]=_[_0x52c8('0x20')](members[_0x21a853[_0x52c8('0x5')]],{'data4':_0x21a853['queue'],'uniqueid':_0x21a853[_0x52c8('0x1e')]});}};exports[_0x52c8('0x21')]=function(_0x22dd12){if(_0x22dd12[_0x52c8('0x6')]){var _0x577977=_0x22dd12[_0x52c8('0x6')][_0x52c8('0xf')]('-')[0x0];if(!_[_0x52c8('0x22')](members[_0x577977])){members[_0x577977]=_['assign'](members[_0x577977],{'data1':members[_0x577977][_0x52c8('0x23')]||_0x22dd12[_0x52c8('0x8')],'data2':members[_0x577977][_0x52c8('0x24')]||_0x22dd12[_0x52c8('0x25')],'data3':members[_0x577977]['data3']||_0x22dd12['destination'],'uniqueid':members[_0x577977][_0x52c8('0x1e')]||_0x22dd12['uniqueid']});if(members[_0x577977][_0x52c8('0x1b')]){writeDB(members[_0x577977]);}}}if(_0x22dd12[_0x52c8('0x26')]){var _0xc5a053=_0x22dd12[_0x52c8('0x26')][_0x52c8('0xf')]('-')[0x0];if(!_[_0x52c8('0x22')](members[_0xc5a053])){members[_0xc5a053]=_[_0x52c8('0x20')](members[_0xc5a053],{'data1':members[_0xc5a053][_0x52c8('0x23')]||_0x22dd12[_0x52c8('0x8')],'data2':members[_0xc5a053][_0x52c8('0x24')]||_0x22dd12[_0x52c8('0x25')],'data3':members[_0xc5a053][_0x52c8('0x27')]||_0x22dd12[_0x52c8('0x28')],'uniqueid':members[_0xc5a053][_0x52c8('0x1e')]||_0x22dd12['uniqueid']});if(members[_0xc5a053]['exitAt']){writeDB(members[_0xc5a053]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index bc36840..fd5de92 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 _0xdadb=['type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','assign','position','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','assigned','accountcode','destaccountcode','lastAssignedTo','membername','transfer','TRANSFER','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','holdtime','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','calleridname','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','info','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queuecallerexitreason','getVoiceQueueByName','queue','then'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xdadb,0x12f));var _0xbdad=function(_0x2611c7,_0x33f9c8){_0x2611c7=_0x2611c7-0x0;var _0xfbe54d=_0xdadb[_0x2611c7];return _0xfbe54d;};'use strict';var _=require(_0xbdad('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x1cd2a1){utils[_0xbdad('0x1')](util['format'](_0xbdad('0x2'),_0x1cd2a1[_0xbdad('0x3')],_0x1cd2a1[_0xbdad('0x4')],_0x1cd2a1['queue'],_0x1cd2a1['lastAssignedTo'],_0x1cd2a1['calleridnum'],_0x1cd2a1['accountcode'],_0x1cd2a1[_0xbdad('0x5')]));if(_0x1cd2a1['queue']){utils[_0xbdad('0x6')](_0x1cd2a1[_0xbdad('0x7')])[_0xbdad('0x8')](function(_0x184846){if(_0x184846){_0x1cd2a1['type']=_0x184846[_0xbdad('0x9')];}utils['request'](_0xbdad('0xa'),_0x1cd2a1);});}else{utils[_0xbdad('0xb')]('CreateVoiceQueueReport',_0x1cd2a1);}if(_0x1cd2a1[_0xbdad('0xc')]){delete queues[_0x1cd2a1[_0xbdad('0xc')]];}else{delete queues[_0x1cd2a1[_0xbdad('0x3')]];}}exports[_0xbdad('0xd')]=function(_0x4aca59){queues[_0x4aca59['uniqueid']]=_[_0xbdad('0xe')](_0x4aca59,{'originalposition':_0x4aca59[_0xbdad('0xf')],'queuecallerjoinAt':utils[_0xbdad('0x10')](),'mohtime':0x0});};exports['hangup']=function(_0x3641df){if(!_[_0xbdad('0x11')](queues[_0x3641df['uniqueid']])){if(queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x12')]){if(!queues[_0x3641df['uniqueid']][_0xbdad('0x13')]&&!queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x14')]){queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x15')]=!![];queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x16')]=utils['now']();queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0x5')]=_0xbdad('0x17');}writeDB(queues[_0x3641df['uniqueid']]);}else{if(queues[_0x3641df[_0xbdad('0x3')]]['transfereduniqueid']){queues[queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0xc')]]=queues[_0x3641df[_0xbdad('0x3')]];queues[queues[_0x3641df[_0xbdad('0x3')]][_0xbdad('0xc')]][_0xbdad('0x18')]=0x2;delete queues[_0x3641df[_0xbdad('0x3')]];}}}};exports['varset']=function(_0x105a2c){if(!_[_0xbdad('0x11')](_0x105a2c[_0xbdad('0x19')][_0xbdad('0x1a')])&&_0x105a2c[_0xbdad('0x1b')][_0xbdad('0x1c')]()!==_0xbdad('0x1d')){if(!_[_0xbdad('0x11')](queues[_0x105a2c[_0xbdad('0x3')]])){queues[_0x105a2c['uniqueid']]['queuecallerabandon']=![];queues[_0x105a2c[_0xbdad('0x3')]]['queuecallerabandonAt']=null;queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x14')]=!![];queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x1e')]=utils[_0xbdad('0x10')]();queues[_0x105a2c[_0xbdad('0x3')]]['queuecallerexitreason']=_0x105a2c['value']['toUpperCase']();writeDB(queues[_0x105a2c[_0xbdad('0x3')]]);}}else if(!_[_0xbdad('0x11')](_0x105a2c['variable'][_0xbdad('0x1f')])){if(!_[_0xbdad('0x11')](queues[_0x105a2c[_0xbdad('0x3')]])&&!queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x13')]){queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x13')]=![];queues[_0x105a2c['uniqueid']][_0xbdad('0x20')]=null;queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x14')]=!![];queues[_0x105a2c[_0xbdad('0x3')]][_0xbdad('0x1e')]=utils['now']();queues[_0x105a2c[_0xbdad('0x3')]]['queuecallerexitreason']=_0xbdad('0x21');}}};exports[_0xbdad('0x13')]=function(_0x448ef7){if(!_[_0xbdad('0x11')](queues[_0x448ef7['uniqueid']])){queues[_0x448ef7[_0xbdad('0x3')]]['queuecallerexit']=![];queues[_0x448ef7[_0xbdad('0x3')]][_0xbdad('0x1e')]=null;queues[_0x448ef7['uniqueid']][_0xbdad('0x13')]=!![];queues[_0x448ef7[_0xbdad('0x3')]][_0xbdad('0x20')]=utils[_0xbdad('0x10')]();queues[_0x448ef7[_0xbdad('0x3')]][_0xbdad('0x5')]=_0xbdad('0x22');}};exports['queuecallerleave']=function(_0x4d4dd7){if(!_[_0xbdad('0x11')](queues[_0x4d4dd7[_0xbdad('0x3')]])){queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0x23')]=!![];queues[_0x4d4dd7['uniqueid']][_0xbdad('0x12')]=utils[_0xbdad('0x10')]();queues[_0x4d4dd7[_0xbdad('0x3')]]['holdtime']=utils[_0xbdad('0x24')](queues[_0x4d4dd7[_0xbdad('0x3')]]['queuecallerleaveAt'],queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0x25')]);queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0xf')]=_0x4d4dd7[_0xbdad('0xf')];queues[_0x4d4dd7['uniqueid']][_0xbdad('0x26')]=_0x4d4dd7['count'];queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0x27')]=_0x4d4dd7[_0xbdad('0x27')];queues[_0x4d4dd7[_0xbdad('0x3')]][_0xbdad('0x28')]=_0x4d4dd7[_0xbdad('0x28')];}};exports['agentconnect']=function(_0x4be480){if(!_['isNil'](queues[_0x4be480[_0xbdad('0x3')]])){queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x13')]=![];queues[_0x4be480[_0xbdad('0x3')]]['queuecallerabandon']=![];queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x20')]=null;queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x14')]=![];queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x5')]=null;queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x1e')]=null;queues[_0x4be480[_0xbdad('0x3')]][_0xbdad('0x29')]=!![];queues[_0x4be480['uniqueid']][_0xbdad('0x2a')]=_0x4be480[_0xbdad('0x2b')];queues[_0x4be480[_0xbdad('0x3')]]['lastAssignedTo']=_0x4be480['membername'];}};exports['agentcomplete']=function(_0x4e5f16){if(!_[_0xbdad('0x11')](queues[_0x4e5f16[_0xbdad('0x3')]])){if(queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x12')]){queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x13')]=![];queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x13')]=![];queues[_0x4e5f16[_0xbdad('0x3')]]['queuecallerabandonAt']=null;queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x14')]=![];queues[_0x4e5f16['uniqueid']][_0xbdad('0x1e')]=null;queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x29')]=!![];queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x2c')]=_0x4e5f16[_0xbdad('0x2d')];queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x15')]=!![];queues[_0x4e5f16['uniqueid']][_0xbdad('0x16')]=utils[_0xbdad('0x10')]();if(_0x4e5f16['reason']==_0xbdad('0x2e')){if(!queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x2e')]){queues[_0x4e5f16[_0xbdad('0x3')]][_0xbdad('0x5')]=_0xbdad('0x2f');}}else{queues[_0x4e5f16['uniqueid']][_0xbdad('0x5')]=_0xbdad('0x30')+_0x4e5f16[_0xbdad('0x31')][_0xbdad('0x1c')]();}writeDB(queues[_0x4e5f16[_0xbdad('0x3')]]);}}};exports[_0xbdad('0x32')]=function(_0x5b294b){if(!_[_0xbdad('0x11')](queues[_0x5b294b[_0xbdad('0x33')]])){queues[_0x5b294b[_0xbdad('0x33')]][_0xbdad('0x2e')]=!![];queues[_0x5b294b['transfereeuniqueid']][_0xbdad('0x34')]=_0xbdad('0x35');queues[_0x5b294b[_0xbdad('0x33')]][_0xbdad('0x36')]=_0x5b294b[_0xbdad('0x37')];queues[_0x5b294b[_0xbdad('0x33')]][_0xbdad('0x38')]=_0x5b294b[_0xbdad('0x33')];queues[_0x5b294b[_0xbdad('0x33')]][_0xbdad('0x5')]='BLINDTRANSFER';}};exports[_0xbdad('0x39')]=function(_0x576ca2){try{if(_0x576ca2['origtransfereruniqueid']==_0x576ca2[_0xbdad('0x3a')]){if(!_[_0xbdad('0x11')](queues[_0x576ca2[_0xbdad('0x3b')]])){queues[_0x576ca2[_0xbdad('0x3b')]]['transfer']=!![];queues[_0x576ca2['secondtransfererlinkedid']][_0xbdad('0x34')]='ATTENDED';queues[_0x576ca2[_0xbdad('0x3b')]][_0xbdad('0x36')]=_0x576ca2['origtransfererexten'];queues[_0x576ca2[_0xbdad('0x3b')]]['transferuniqueid']=_0x576ca2[_0xbdad('0x3c')];queues[_0x576ca2[_0xbdad('0x3b')]][_0xbdad('0x5')]=_0xbdad('0x3d');}if(!_['isNil'](queues[_0x576ca2[_0xbdad('0x3a')]])){if(_0x576ca2[_0xbdad('0x3e')]&&queues[_0x576ca2[_0xbdad('0x3e')]]){queues[_0x576ca2[_0xbdad('0x3e')]][_0xbdad('0x18')]=0x1;queues[_0x576ca2[_0xbdad('0x33')]]=_[_0xbdad('0x3f')](queues[_0x576ca2[_0xbdad('0x3e')]]);queues[_0x576ca2[_0xbdad('0x33')]][_0xbdad('0xc')]=_0x576ca2['transfertargetuniqueid'];queues[_0x576ca2['transfereeuniqueid']][_0xbdad('0x18')]=0x2;queues[_0x576ca2['transfereeuniqueid']][_0xbdad('0x40')]=queues[_0x576ca2[_0xbdad('0x3b')]]['calleridnum'];queues[_0x576ca2[_0xbdad('0x33')]]['calleridname']=queues[_0x576ca2['secondtransfererlinkedid']]['calleridname'];queues[_0x576ca2['transfereeuniqueid']][_0xbdad('0x25')]=utils[_0xbdad('0x10')]();queues[_0x576ca2[_0xbdad('0x33')]][_0xbdad('0x12')]=utils[_0xbdad('0x10')]();queues[_0x576ca2['transfereeuniqueid']][_0xbdad('0x41')]=0x0;queues[_0x576ca2[_0xbdad('0x33')]][_0xbdad('0x42')]=0x0;}else{queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0xc')]=_0x576ca2[_0xbdad('0x3b')];}}}else if(_0x576ca2[_0xbdad('0x43')]==_0x576ca2[_0xbdad('0x3b')]){if(!_['isNil'](queues[_0x576ca2[_0xbdad('0x3a')]])){queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0x2e')]=!![];queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0x34')]=_0xbdad('0x44');queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0x36')]=_0x576ca2[_0xbdad('0x45')];queues[_0x576ca2[_0xbdad('0x3a')]]['transferuniqueid']=_0x576ca2[_0xbdad('0x43')];queues[_0x576ca2[_0xbdad('0x3a')]][_0xbdad('0x5')]=_0xbdad('0x3d');}if(!_['isNil'](queues[_0x576ca2[_0xbdad('0x3b')]])){if(_0x576ca2[_0xbdad('0x46')]&&queues[_0x576ca2[_0xbdad('0x46')]]){queues[_0x576ca2[_0xbdad('0x46')]][_0xbdad('0x18')]=0x1;queues[_0x576ca2[_0xbdad('0x47')]]=_[_0xbdad('0x3f')](queues[_0x576ca2[_0xbdad('0x46')]]);queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0xc')]=_0x576ca2[_0xbdad('0x47')];queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x18')]=0x2;queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x40')]=queues[_0x576ca2[_0xbdad('0x3a')]]['calleridnum'];queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x48')]=queues[_0x576ca2['origtransfererlinkedid']][_0xbdad('0x48')];queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x25')]=utils['now']();queues[_0x576ca2[_0xbdad('0x47')]][_0xbdad('0x12')]=utils[_0xbdad('0x10')]();queues[_0x576ca2[_0xbdad('0x47')]]['holdtime']=0x0;queues[_0x576ca2['transfertargetuniqueid']][_0xbdad('0x42')]=0x0;}else{queues[_0x576ca2[_0xbdad('0x3b')]][_0xbdad('0xc')]=_0x576ca2[_0xbdad('0x3a')];}}}}catch(_0x16e23d){utils[_0xbdad('0x49')](_0x16e23d[_0xbdad('0x4a')]);}};exports[_0xbdad('0x4b')]=function(_0xd96f2a){if(!_['isNil'](queues[_0xd96f2a['uniqueid']])){queues[_0xd96f2a['uniqueid']][_0xbdad('0x4c')]=utils[_0xbdad('0x10')]();}};exports[_0xbdad('0x4d')]=function(_0x4015d1){if(!_[_0xbdad('0x11')](queues[_0x4015d1[_0xbdad('0x3')]])){if(!_['isNil'](queues[_0x4015d1[_0xbdad('0x3')]][_0xbdad('0x4c')])){queues[_0x4015d1['uniqueid']][_0xbdad('0x42')]+=utils[_0xbdad('0x24')](utils[_0xbdad('0x10')](),queues[_0x4015d1['uniqueid']]['musiconholdstartAt']);delete queues[_0x4015d1[_0xbdad('0x3')]][_0xbdad('0x4c')];}}}; \ No newline at end of file +var _0xed82=['secondtransfererlinkedid','ATTENDED','transferexten','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','transfertargetlinkedid','holdtime','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','assign','position','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','transfereduniqueid','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','queuecallerexitAt','toUpperCase','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','diffTime','queuecallerjoinAt','count','connectedlinenum','assigned','destaccountcode','membername','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','extension','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0xed82,0x19e));var _0x2ed8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xed82[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x2ed8('0x0'));var util=require(_0x2ed8('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x6f52f5){utils[_0x2ed8('0x2')](util[_0x2ed8('0x3')](_0x2ed8('0x4'),_0x6f52f5[_0x2ed8('0x5')],_0x6f52f5[_0x2ed8('0x6')],_0x6f52f5['queue'],_0x6f52f5[_0x2ed8('0x7')],_0x6f52f5[_0x2ed8('0x8')],_0x6f52f5[_0x2ed8('0x9')],_0x6f52f5[_0x2ed8('0xa')]));if(_0x6f52f5[_0x2ed8('0xb')]){utils[_0x2ed8('0xc')](_0x6f52f5[_0x2ed8('0xb')])[_0x2ed8('0xd')](function(_0x2b0d44){if(_0x2b0d44){_0x6f52f5[_0x2ed8('0xe')]=_0x2b0d44[_0x2ed8('0xe')];}utils[_0x2ed8('0xf')](_0x2ed8('0x10'),_0x6f52f5);});}else{utils['request'](_0x2ed8('0x10'),_0x6f52f5);}if(_0x6f52f5['transfereduniqueid']){delete queues[_0x6f52f5['transfereduniqueid']];}else{delete queues[_0x6f52f5[_0x2ed8('0x5')]];}}exports[_0x2ed8('0x11')]=function(_0x118276){queues[_0x118276['uniqueid']]=_[_0x2ed8('0x12')](_0x118276,{'originalposition':_0x118276[_0x2ed8('0x13')],'queuecallerjoinAt':utils[_0x2ed8('0x14')](),'mohtime':0x0});};exports['hangup']=function(_0x2ebefc){if(!_[_0x2ed8('0x15')](queues[_0x2ebefc['uniqueid']])){if(queues[_0x2ebefc[_0x2ed8('0x5')]][_0x2ed8('0x16')]){if(!queues[_0x2ebefc['uniqueid']][_0x2ed8('0x17')]&&!queues[_0x2ebefc['uniqueid']][_0x2ed8('0x18')]){queues[_0x2ebefc[_0x2ed8('0x5')]][_0x2ed8('0x19')]=!![];queues[_0x2ebefc[_0x2ed8('0x5')]]['queuecallercompleteAt']=utils[_0x2ed8('0x14')]();queues[_0x2ebefc[_0x2ed8('0x5')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x2ebefc['uniqueid']]);}else{if(queues[_0x2ebefc[_0x2ed8('0x5')]][_0x2ed8('0x1a')]){queues[queues[_0x2ebefc[_0x2ed8('0x5')]][_0x2ed8('0x1a')]]=queues[_0x2ebefc['uniqueid']];queues[queues[_0x2ebefc[_0x2ed8('0x5')]][_0x2ed8('0x1a')]][_0x2ed8('0x1b')]=0x2;delete queues[_0x2ebefc['uniqueid']];}}}};exports[_0x2ed8('0x1c')]=function(_0x2faf3b){if(!_[_0x2ed8('0x15')](_0x2faf3b[_0x2ed8('0x1d')][_0x2ed8('0x1e')])&&_0x2faf3b[_0x2ed8('0x1f')]['toUpperCase']()!==_0x2ed8('0x20')){if(!_['isNil'](queues[_0x2faf3b[_0x2ed8('0x5')]])){queues[_0x2faf3b['uniqueid']][_0x2ed8('0x17')]=![];queues[_0x2faf3b['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2faf3b['uniqueid']][_0x2ed8('0x18')]=!![];queues[_0x2faf3b[_0x2ed8('0x5')]][_0x2ed8('0x21')]=utils[_0x2ed8('0x14')]();queues[_0x2faf3b[_0x2ed8('0x5')]][_0x2ed8('0xa')]=_0x2faf3b[_0x2ed8('0x1f')][_0x2ed8('0x22')]();writeDB(queues[_0x2faf3b[_0x2ed8('0x5')]]);}}else if(!_[_0x2ed8('0x15')](_0x2faf3b[_0x2ed8('0x1d')][_0x2ed8('0x23')])){if(!_[_0x2ed8('0x15')](queues[_0x2faf3b[_0x2ed8('0x5')]])&&!queues[_0x2faf3b['uniqueid']][_0x2ed8('0x17')]){queues[_0x2faf3b[_0x2ed8('0x5')]][_0x2ed8('0x17')]=![];queues[_0x2faf3b['uniqueid']][_0x2ed8('0x24')]=null;queues[_0x2faf3b[_0x2ed8('0x5')]]['queuecallerexit']=!![];queues[_0x2faf3b[_0x2ed8('0x5')]][_0x2ed8('0x21')]=utils[_0x2ed8('0x14')]();queues[_0x2faf3b[_0x2ed8('0x5')]][_0x2ed8('0xa')]=_0x2ed8('0x25');}}};exports[_0x2ed8('0x17')]=function(_0x4261a3){if(!_['isNil'](queues[_0x4261a3[_0x2ed8('0x5')]])){queues[_0x4261a3[_0x2ed8('0x5')]][_0x2ed8('0x18')]=![];queues[_0x4261a3['uniqueid']][_0x2ed8('0x21')]=null;queues[_0x4261a3[_0x2ed8('0x5')]]['queuecallerabandon']=!![];queues[_0x4261a3[_0x2ed8('0x5')]][_0x2ed8('0x24')]=utils['now']();queues[_0x4261a3[_0x2ed8('0x5')]][_0x2ed8('0xa')]=_0x2ed8('0x26');}};exports[_0x2ed8('0x27')]=function(_0x5241a0){if(!_['isNil'](queues[_0x5241a0[_0x2ed8('0x5')]])){queues[_0x5241a0[_0x2ed8('0x5')]]['queuecallerleave']=!![];queues[_0x5241a0[_0x2ed8('0x5')]][_0x2ed8('0x16')]=utils[_0x2ed8('0x14')]();queues[_0x5241a0[_0x2ed8('0x5')]]['holdtime']=utils[_0x2ed8('0x28')](queues[_0x5241a0[_0x2ed8('0x5')]]['queuecallerleaveAt'],queues[_0x5241a0[_0x2ed8('0x5')]][_0x2ed8('0x29')]);queues[_0x5241a0[_0x2ed8('0x5')]][_0x2ed8('0x13')]=_0x5241a0[_0x2ed8('0x13')];queues[_0x5241a0['uniqueid']][_0x2ed8('0x2a')]=_0x5241a0[_0x2ed8('0x2a')];queues[_0x5241a0[_0x2ed8('0x5')]][_0x2ed8('0x2b')]=_0x5241a0[_0x2ed8('0x2b')];queues[_0x5241a0[_0x2ed8('0x5')]]['connectedlinename']=_0x5241a0['connectedlinename'];}};exports['agentconnect']=function(_0x4ebe22){if(!_[_0x2ed8('0x15')](queues[_0x4ebe22[_0x2ed8('0x5')]])){queues[_0x4ebe22['uniqueid']][_0x2ed8('0x17')]=![];queues[_0x4ebe22['uniqueid']][_0x2ed8('0x17')]=![];queues[_0x4ebe22[_0x2ed8('0x5')]]['queuecallerabandonAt']=null;queues[_0x4ebe22[_0x2ed8('0x5')]][_0x2ed8('0x18')]=![];queues[_0x4ebe22['uniqueid']][_0x2ed8('0xa')]=null;queues[_0x4ebe22[_0x2ed8('0x5')]][_0x2ed8('0x21')]=null;queues[_0x4ebe22[_0x2ed8('0x5')]][_0x2ed8('0x2c')]=!![];queues[_0x4ebe22[_0x2ed8('0x5')]][_0x2ed8('0x9')]=_0x4ebe22[_0x2ed8('0x2d')];queues[_0x4ebe22[_0x2ed8('0x5')]][_0x2ed8('0x7')]=_0x4ebe22['membername'];}};exports['agentcomplete']=function(_0x4e8241){if(!_['isNil'](queues[_0x4e8241[_0x2ed8('0x5')]])){if(queues[_0x4e8241['uniqueid']]['queuecallerleaveAt']){queues[_0x4e8241[_0x2ed8('0x5')]]['queuecallerabandon']=![];queues[_0x4e8241[_0x2ed8('0x5')]][_0x2ed8('0x17')]=![];queues[_0x4e8241[_0x2ed8('0x5')]][_0x2ed8('0x24')]=null;queues[_0x4e8241[_0x2ed8('0x5')]][_0x2ed8('0x18')]=![];queues[_0x4e8241[_0x2ed8('0x5')]][_0x2ed8('0x21')]=null;queues[_0x4e8241['uniqueid']][_0x2ed8('0x2c')]=!![];queues[_0x4e8241[_0x2ed8('0x5')]][_0x2ed8('0x7')]=_0x4e8241[_0x2ed8('0x2e')];queues[_0x4e8241['uniqueid']][_0x2ed8('0x19')]=!![];queues[_0x4e8241[_0x2ed8('0x5')]][_0x2ed8('0x2f')]=utils['now']();if(_0x4e8241[_0x2ed8('0x30')]==_0x2ed8('0x31')){if(!queues[_0x4e8241[_0x2ed8('0x5')]]['transfer']){queues[_0x4e8241[_0x2ed8('0x5')]]['queuecallerexitreason']=_0x2ed8('0x32');}}else{queues[_0x4e8241[_0x2ed8('0x5')]][_0x2ed8('0xa')]=_0x2ed8('0x33')+_0x4e8241['reason'][_0x2ed8('0x22')]();}writeDB(queues[_0x4e8241[_0x2ed8('0x5')]]);}}};exports[_0x2ed8('0x34')]=function(_0x5710ee){if(!_['isNil'](queues[_0x5710ee['transfereeuniqueid']])){queues[_0x5710ee['transfereeuniqueid']][_0x2ed8('0x31')]=!![];queues[_0x5710ee[_0x2ed8('0x35')]][_0x2ed8('0x36')]='BLIND';queues[_0x5710ee[_0x2ed8('0x35')]]['transferexten']=_0x5710ee[_0x2ed8('0x37')];queues[_0x5710ee[_0x2ed8('0x35')]]['transferuniqueid']=_0x5710ee['transfereeuniqueid'];queues[_0x5710ee[_0x2ed8('0x35')]][_0x2ed8('0xa')]=_0x2ed8('0x38');}};exports[_0x2ed8('0x39')]=function(_0x22bf67){try{if(_0x22bf67[_0x2ed8('0x3a')]==_0x22bf67[_0x2ed8('0x3b')]){if(!_[_0x2ed8('0x15')](queues[_0x22bf67[_0x2ed8('0x3c')]])){queues[_0x22bf67['secondtransfererlinkedid']][_0x2ed8('0x31')]=!![];queues[_0x22bf67[_0x2ed8('0x3c')]]['transfertype']=_0x2ed8('0x3d');queues[_0x22bf67['secondtransfererlinkedid']][_0x2ed8('0x3e')]=_0x22bf67[_0x2ed8('0x3f')];queues[_0x22bf67['secondtransfererlinkedid']][_0x2ed8('0x40')]=_0x22bf67['origtransfereruniqueid'];queues[_0x22bf67['secondtransfererlinkedid']][_0x2ed8('0xa')]=_0x2ed8('0x41');}if(!_['isNil'](queues[_0x22bf67[_0x2ed8('0x3b')]])){if(_0x22bf67['transfereelinkedid']&&queues[_0x22bf67['transfereelinkedid']]){queues[_0x22bf67[_0x2ed8('0x42')]][_0x2ed8('0x1b')]=0x1;queues[_0x22bf67['transfereeuniqueid']]=_[_0x2ed8('0x43')](queues[_0x22bf67[_0x2ed8('0x42')]]);queues[_0x22bf67[_0x2ed8('0x35')]][_0x2ed8('0x1a')]=_0x22bf67[_0x2ed8('0x44')];queues[_0x22bf67[_0x2ed8('0x35')]][_0x2ed8('0x1b')]=0x2;queues[_0x22bf67[_0x2ed8('0x35')]][_0x2ed8('0x8')]=queues[_0x22bf67[_0x2ed8('0x3c')]][_0x2ed8('0x8')];queues[_0x22bf67[_0x2ed8('0x35')]][_0x2ed8('0x45')]=queues[_0x22bf67[_0x2ed8('0x3c')]]['calleridname'];queues[_0x22bf67['transfereeuniqueid']][_0x2ed8('0x29')]=utils[_0x2ed8('0x14')]();queues[_0x22bf67[_0x2ed8('0x35')]][_0x2ed8('0x16')]=utils[_0x2ed8('0x14')]();queues[_0x22bf67[_0x2ed8('0x35')]]['holdtime']=0x0;queues[_0x22bf67[_0x2ed8('0x35')]][_0x2ed8('0x46')]=0x0;}else{queues[_0x22bf67['origtransfererlinkedid']][_0x2ed8('0x1a')]=_0x22bf67['secondtransfererlinkedid'];}}}else if(_0x22bf67[_0x2ed8('0x47')]==_0x22bf67[_0x2ed8('0x3c')]){if(!_[_0x2ed8('0x15')](queues[_0x22bf67[_0x2ed8('0x3b')]])){queues[_0x22bf67[_0x2ed8('0x3b')]][_0x2ed8('0x31')]=!![];queues[_0x22bf67['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x22bf67[_0x2ed8('0x3b')]]['transferexten']=_0x22bf67['secondtransfererexten'];queues[_0x22bf67[_0x2ed8('0x3b')]]['transferuniqueid']=_0x22bf67['secondtransfereruniqueid'];queues[_0x22bf67['origtransfererlinkedid']][_0x2ed8('0xa')]=_0x2ed8('0x41');}if(!_[_0x2ed8('0x15')](queues[_0x22bf67['secondtransfererlinkedid']])){if(_0x22bf67['transfertargetlinkedid']&&queues[_0x22bf67[_0x2ed8('0x48')]]){queues[_0x22bf67['transfertargetlinkedid']][_0x2ed8('0x1b')]=0x1;queues[_0x22bf67['transfertargetuniqueid']]=_['clone'](queues[_0x22bf67[_0x2ed8('0x48')]]);queues[_0x22bf67[_0x2ed8('0x44')]][_0x2ed8('0x1a')]=_0x22bf67[_0x2ed8('0x44')];queues[_0x22bf67[_0x2ed8('0x44')]][_0x2ed8('0x1b')]=0x2;queues[_0x22bf67['transfertargetuniqueid']][_0x2ed8('0x8')]=queues[_0x22bf67[_0x2ed8('0x3b')]][_0x2ed8('0x8')];queues[_0x22bf67[_0x2ed8('0x44')]]['calleridname']=queues[_0x22bf67[_0x2ed8('0x3b')]][_0x2ed8('0x45')];queues[_0x22bf67[_0x2ed8('0x44')]][_0x2ed8('0x29')]=utils[_0x2ed8('0x14')]();queues[_0x22bf67[_0x2ed8('0x44')]][_0x2ed8('0x16')]=utils['now']();queues[_0x22bf67['transfertargetuniqueid']][_0x2ed8('0x49')]=0x0;queues[_0x22bf67[_0x2ed8('0x44')]]['mohtime']=0x0;}else{queues[_0x22bf67[_0x2ed8('0x3c')]][_0x2ed8('0x1a')]=_0x22bf67['origtransfererlinkedid'];}}}}catch(_0x2a4d90){utils[_0x2ed8('0x4a')](_0x2a4d90[_0x2ed8('0x4b')]);}};exports[_0x2ed8('0x4c')]=function(_0x3acc5a){if(!_['isNil'](queues[_0x3acc5a['uniqueid']])){queues[_0x3acc5a[_0x2ed8('0x5')]][_0x2ed8('0x4d')]=utils[_0x2ed8('0x14')]();}};exports[_0x2ed8('0x4e')]=function(_0x311787){if(!_[_0x2ed8('0x15')](queues[_0x311787[_0x2ed8('0x5')]])){if(!_['isNil'](queues[_0x311787[_0x2ed8('0x5')]][_0x2ed8('0x4d')])){queues[_0x311787[_0x2ed8('0x5')]][_0x2ed8('0x46')]+=utils[_0x2ed8('0x28')](utils[_0x2ed8('0x14')](),queues[_0x311787[_0x2ed8('0x5')]][_0x2ed8('0x4d')]);delete queues[_0x311787[_0x2ed8('0x5')]][_0x2ed8('0x4d')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 453d28e..b8c007f 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 _0x70e0=['.WAV','find','monitors','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','set','appdata','toLowerCase','split','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','accountcode','then','name','request','newchannel','uniqueid','linkedid','channel','error','stack','newstate','isNil','channelstate','transfer','variable','endsWith','value','.wav49'];(function(_0x5ba1a9,_0x150164){var _0x57860f=function(_0x4b4ddd){while(--_0x4b4ddd){_0x5ba1a9['push'](_0x5ba1a9['shift']());}};_0x57860f(++_0x150164);}(_0x70e0,0x17b));var _0x070e=function(_0x367444,_0x1b1dd8){_0x367444=_0x367444-0x0;var _0x371d48=_0x70e0[_0x367444];return _0x371d48;};'use strict';var _=require(_0x070e('0x0'));var utils=require(_0x070e('0x1'));var recordings={};function writeDB(_0x198c2e){utils['debug'](_0x198c2e);if(_0x198c2e['accountcode']){utils[_0x070e('0x2')](_0x198c2e[_0x070e('0x3')])[_0x070e('0x4')](function(_0x2593e5){if(_0x2593e5){_0x198c2e['membername']=_0x2593e5[_0x070e('0x5')];_0x198c2e['UserId']=_0x2593e5['id'];}utils[_0x070e('0x6')]('CreateVoiceRecording',_0x198c2e);});}else{utils['request']('CreateVoiceRecording',_0x198c2e);}}exports[_0x070e('0x7')]=function(_0x1e11f0){try{if(_0x1e11f0[_0x070e('0x8')]==_0x1e11f0[_0x070e('0x9')]){recordings[_0x1e11f0[_0x070e('0x8')]]={'uniqueid':_0x1e11f0[_0x070e('0x8')],'accountcode':_0x1e11f0[_0x070e('0x3')],'exten':_0x1e11f0['exten'],'context':_0x1e11f0['context'],'channel':_0x1e11f0[_0x070e('0xa')],'monitors':[]};}}catch(_0x2e3e5e){utils[_0x070e('0xb')](_0x2e3e5e[_0x070e('0xc')]);}};exports[_0x070e('0xd')]=function(_0xffcdd6){try{if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x8')]])&&_0xffcdd6[_0x070e('0xf')]==0x6){}else if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x9')]])&&_0xffcdd6['channelstate']==0x6&&_0xffcdd6['context']!=_0x070e('0x10')){recordings[_0xffcdd6['linkedid']]['accountcode']=_0xffcdd6['accountcode'];}}catch(_0x11d2ce){utils[_0x070e('0xb')](_0x11d2ce['stack']);}};exports['varset']=function(_0x373d86){try{if(!_[_0x070e('0xe')](_0x373d86[_0x070e('0x11')])&&!_[_0x070e('0xe')](_0x373d86['variable']['mixmonitor_filename'])){if(_[_0x070e('0x12')](_0x373d86[_0x070e('0x13')],_0x070e('0x14'))){_0x373d86[_0x070e('0x13')]=_0x373d86[_0x070e('0x13')]['replace'](_0x070e('0x14'),_0x070e('0x15'));}if(recordings[_0x373d86[_0x070e('0x9')]]){var _0x3ea105=_[_0x070e('0x16')](recordings[_0x373d86['linkedid']]['monitors'],{'value':_0x373d86['value']});if(_[_0x070e('0xe')](_0x3ea105)){recordings[_0x373d86[_0x070e('0x9')]][_0x070e('0x17')]['push']({'value':_0x373d86[_0x070e('0x13')]});}}}}catch(_0x5dc5d2){utils[_0x070e('0xb')](_0x5dc5d2[_0x070e('0xc')]);}};exports[_0x070e('0x18')]=function(_0x33e8c6){try{if(!_[_0x070e('0xe')](recordings[_0x33e8c6[_0x070e('0x8')]])){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x19')]=_0x33e8c6['calleridnum'];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1a')]=_0x33e8c6[_0x070e('0x1a')];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1b')]=_0x33e8c6['connectedlinenum'];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1c')]=_0x33e8c6[_0x070e('0x1c')];if(recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1d')]==_0x070e('0x1e')&&recordings[_0x33e8c6['uniqueid']][_0x070e('0x3')]){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1b')]=recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x3')];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1c')]='';}recordings[_0x33e8c6[_0x070e('0x8')]]['monitors'][_0x070e('0x1f')](_0x351641=>{var _0x3a16d0=_['clone'](recordings[_0x33e8c6['uniqueid']]);_0x3a16d0[_0x070e('0x13')]=_0x351641[_0x070e('0x13')];writeDB(_0x3a16d0);});delete recordings[_0x33e8c6[_0x070e('0x8')]];}}catch(_0x51402c){utils[_0x070e('0xb')](_0x51402c[_0x070e('0xc')]);}};exports[_0x070e('0x20')]=function(_0x5f2bee){try{if(!_['isNil'](recordings[_0x5f2bee['uniqueid']])){if(_0x5f2bee['application']['toLowerCase']()==_0x070e('0x21')&&_['startsWith'](_0x5f2bee[_0x070e('0x22')][_0x070e('0x23')](),'cdr')){var _0x47a739=_0x5f2bee[_0x070e('0x22')][_0x070e('0x24')]('=');var _0x55288a=_0x47a739[0x0]['substring'](_0x47a739[0x0][_0x070e('0x25')]('(')+0x1,_0x47a739[0x0][_0x070e('0x25')](')'));var _0x444d02=_0x47a739[0x1];recordings[_0x5f2bee[_0x070e('0x8')]][_0x55288a]=_0x444d02;}}}catch(_0x18f0ad){utils['error'](_0x18f0ad['stack']);}};exports[_0x070e('0x26')]=function(_0x3011c4){try{if(!_[_0x070e('0xe')](recordings[_0x3011c4[_0x070e('0x8')]])){recordings[_0x3011c4[_0x070e('0x8')]]['queue']=_0x3011c4[_0x070e('0x27')];}}catch(_0x1927f4){utils['error'](_0x1927f4[_0x070e('0xc')]);}}; \ 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(_0x5c5457,_0x55aa08){var _0x56f0ee=function(_0x29017f){while(--_0x29017f){_0x5c5457['push'](_0x5c5457['shift']());}};_0x56f0ee(++_0x55aa08);}(_0xe706,0xa3));var _0x6e70=function(_0x449235,_0x567736){_0x449235=_0x449235-0x0;var _0x2446ad=_0xe706[_0x449235];return _0x2446ad;};'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 daa1b09..1a4671c 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 _0x5900=['origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','TRANSFER|%s','request','CreateVoiceTransferReport','type','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x5900,0xd2));var _0x0590=function(_0x2f0195,_0x185bbb){_0x2f0195=_0x2f0195-0x0;var _0x3a43ec=_0x5900[_0x2f0195];return _0x3a43ec;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var utils=require(_0x0590('0x1'));function writeDB(_0x5bee11){utils[_0x0590('0x2')](util[_0x0590('0x3')](_0x0590('0x4'),_0x5bee11['type']));utils[_0x0590('0x5')](_0x0590('0x6'),_0x5bee11);}exports['blindtransfer']=function(_0x154fe4){try{_0x154fe4[_0x0590('0x7')]='blind';writeDB(_0x154fe4);}catch(_0x469e15){utils[_0x0590('0x8')](_0x469e15[_0x0590('0x9')]);}};exports[_0x0590('0xa')]=function(_0x1eab42){try{_0x1eab42=_[_0x0590('0xb')](_0x1eab42,{'transfererchannel':_0x1eab42[_0x0590('0xc')],'transferercalleridnum':_0x1eab42[_0x0590('0xd')],'transferercalleridname':_0x1eab42[_0x0590('0xe')],'transfererconnectedlinenum':_0x1eab42['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1eab42[_0x0590('0xf')],'transfereraccountcode':_0x1eab42[_0x0590('0x10')],'transferercontext':_0x1eab42['secondtransferercontext'],'transfererexten':_0x1eab42[_0x0590('0x11')],'transfererlinkedid':_0x1eab42[_0x0590('0x12')],'context':_0x1eab42['origtransferercontext'],'extension':_0x1eab42['origtransfererexten'],'type':_0x0590('0x13')});if(_['isNil'](_0x1eab42[_0x0590('0x14')])){_0x1eab42=_[_0x0590('0xb')](_0x1eab42,{'transfereechannel':_0x1eab42[_0x0590('0x15')],'transfereecalleridnum':_0x1eab42[_0x0590('0x16')],'transfereecalleridname':_0x1eab42[_0x0590('0x17')],'transfereeconnectedlinenum':_0x1eab42['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1eab42[_0x0590('0x18')],'transfereeaccountcode':_0x1eab42[_0x0590('0x19')],'transfereecontext':_0x1eab42['transfertargetcontext'],'transfereeexten':_0x1eab42[_0x0590('0x1a')],'transfereelinkedid':_0x1eab42[_0x0590('0x1b')]});}writeDB(_0x1eab42);}catch(_0x9568fb){utils['error'](_0x9568fb[_0x0590('0x9')]);}}; \ No newline at end of file +var _0xc737=['format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blind','error','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','stack','lodash','util','info'];(function(_0x815847,_0x2ab45e){var _0x3d283f=function(_0x34169d){while(--_0x34169d){_0x815847['push'](_0x815847['shift']());}};_0x3d283f(++_0x2ab45e);}(_0xc737,0x8e));var _0x7c73=function(_0x2ac264,_0x3ee465){_0x2ac264=_0x2ac264-0x0;var _0x3f9a10=_0xc737[_0x2ac264];return _0x3f9a10;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var utils=require('./utils');function writeDB(_0xe40f91){utils[_0x7c73('0x2')](util[_0x7c73('0x3')](_0x7c73('0x4'),_0xe40f91[_0x7c73('0x5')]));utils[_0x7c73('0x6')](_0x7c73('0x7'),_0xe40f91);}exports['blindtransfer']=function(_0x506824){try{_0x506824[_0x7c73('0x5')]=_0x7c73('0x8');writeDB(_0x506824);}catch(_0xd61255){utils[_0x7c73('0x9')](_0xd61255['stack']);}};exports['attendedtransfer']=function(_0x4f9b28){try{_0x4f9b28=_['assign'](_0x4f9b28,{'transfererchannel':_0x4f9b28['origtransfererchannel'],'transferercalleridnum':_0x4f9b28[_0x7c73('0xa')],'transferercalleridname':_0x4f9b28[_0x7c73('0xb')],'transfererconnectedlinenum':_0x4f9b28[_0x7c73('0xc')],'transfererconnectedlinename':_0x4f9b28[_0x7c73('0xd')],'transfereraccountcode':_0x4f9b28['origtransfereraccountcode'],'transferercontext':_0x4f9b28[_0x7c73('0xe')],'transfererexten':_0x4f9b28['secondtransfererexten'],'transfererlinkedid':_0x4f9b28[_0x7c73('0xf')],'context':_0x4f9b28[_0x7c73('0x10')],'extension':_0x4f9b28[_0x7c73('0x11')],'type':'attended'});if(_[_0x7c73('0x12')](_0x4f9b28[_0x7c73('0x13')])){_0x4f9b28=_[_0x7c73('0x14')](_0x4f9b28,{'transfereechannel':_0x4f9b28[_0x7c73('0x15')],'transfereecalleridnum':_0x4f9b28[_0x7c73('0x16')],'transfereecalleridname':_0x4f9b28[_0x7c73('0x17')],'transfereeconnectedlinenum':_0x4f9b28[_0x7c73('0x18')],'transfereeconnectedlinename':_0x4f9b28[_0x7c73('0x19')],'transfereeaccountcode':_0x4f9b28['transfertargetaccountcode'],'transfereecontext':_0x4f9b28[_0x7c73('0x1a')],'transfereeexten':_0x4f9b28[_0x7c73('0x1b')],'transfereelinkedid':_0x4f9b28['transfertargetlinkedid']});}writeDB(_0x4f9b28);}catch(_0x5da2c1){utils[_0x7c73('0x9')](_0x5da2c1[_0x7c73('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index dc04d59..071118a 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 _0xb710=['internal','name','GETUSER|','result','length','NOTFOUND','getUserByInternal','getUserByInterface','getVoiceQueueByName','GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diff','now','isAfter','isBefore','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','then','catch','request','GetUser'];(function(_0x35ed2d,_0x87f170){var _0x54e182=function(_0x48fbe8){while(--_0x48fbe8){_0x35ed2d['push'](_0x35ed2d['shift']());}};_0x54e182(++_0x87f170);}(_0xb710,0x1b9));var _0x0b71=function(_0x417c18,_0x48b392){_0x417c18=_0x417c18-0x0;var _0xf2306=_0xb710[_0x417c18];return _0xf2306;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x0b71('0x0'));var BPromise=require(_0x0b71('0x1'));var client=jayson[_0x0b71('0x2')][_0x0b71('0x3')]({'port':0x2329});var logger=require(_0x0b71('0x4'))(_0x0b71('0x5'));exports[_0x0b71('0x6')]=function(_0x200128){logger[_0x0b71('0x6')](_0x200128);};exports['debug']=function(_0x21b18b){logger[_0x0b71('0x7')](JSON[_0x0b71('0x8')](_0x21b18b));};exports[_0x0b71('0x9')]=function(_0x5f3f1b){logger[_0x0b71('0x9')](_0x5f3f1b[_0x0b71('0xa')]);};exports['request']=function(_0x13fa00,_0x20db8e){return client['request'](_0x13fa00,{'body':_0x20db8e})[_0x0b71('0xb')](function(_0x325d6d){logger[_0x0b71('0x7')](JSON['stringify'](_0x325d6d));})[_0x0b71('0xc')](function(_0xc6cced){logger[_0x0b71('0x9')](_0xc6cced['stack']);});};function getUser(_0x19e9d7){return client[_0x0b71('0xd')](_0x0b71('0xe'),{'options':{'raw':!![],'attributes':['id',_0x0b71('0xf'),_0x0b71('0x10'),'interface'],'where':_0x19e9d7,'limit':0x1}})['then'](function(_0x2ac646){logger['info'](_0x0b71('0x11')+JSON[_0x0b71('0x8')](_0x19e9d7)+'|'+(_0x2ac646[_0x0b71('0x12')][_0x0b71('0x13')]?'FOUND':_0x0b71('0x14')));return _0x2ac646[_0x0b71('0x12')][_0x0b71('0x13')]?_0x2ac646[_0x0b71('0x12')][0x0]:null;});}exports[_0x0b71('0x15')]=function(_0x1c242f){return new BPromise(function(_0x4d405f,_0x4d5dfe){if(_0x1c242f){return getUser({'internal':_0x1c242f})[_0x0b71('0xb')](function(_0x287549){return _0x4d405f(_0x287549);})[_0x0b71('0xc')](function(_0x449c8e){logger[_0x0b71('0x9')](_0x449c8e[_0x0b71('0xa')]);return _0x4d405f(null);});}else{return _0x4d405f(null);}});};exports[_0x0b71('0x16')]=function(_0xaef9ad){return new BPromise(function(_0x4ae11f,_0x505879){if(_0xaef9ad){return getUser({'interface':_0xaef9ad})[_0x0b71('0xb')](function(_0x5aa971){return _0x4ae11f(_0x5aa971);})[_0x0b71('0xc')](function(_0x590586){logger['error'](_0x590586[_0x0b71('0xa')]);return _0x4ae11f(null);});}else{return _0x4ae11f(null);}});};exports['getUserByName']=function(_0xc92e3d){return new BPromise(function(_0x1d023d,_0x4b1ecc){if(_0xc92e3d){return getUser({'name':_0xc92e3d})[_0x0b71('0xb')](function(_0x283758){return _0x1d023d(_0x283758);})[_0x0b71('0xc')](function(_0x2c5439){logger[_0x0b71('0x9')](_0x2c5439[_0x0b71('0xa')]);return _0x1d023d(null);});}else{return _0x1d023d(null);}});};exports[_0x0b71('0x17')]=function(_0x25420a){return new BPromise(function(_0x5af4e6,_0x546d87){if(_0x25420a){return client[_0x0b71('0xd')](_0x0b71('0x18'),{'options':{'raw':!![],'attributes':['id',_0x0b71('0x10'),_0x0b71('0x19'),_0x0b71('0x1a'),'acwTimeout'],'where':{'name':_0x25420a},'limit':0x1}})['then'](function(_0xd98d27){logger[_0x0b71('0x6')](_0x0b71('0x1b')+_0x25420a+'|'+(_0xd98d27[_0x0b71('0x12')]['length']?'FOUND':_0x0b71('0x14')));return _0x5af4e6(_0xd98d27[_0x0b71('0x12')][_0x0b71('0x13')]?_0xd98d27[_0x0b71('0x12')][0x0]:null);})[_0x0b71('0xc')](function(_0x51973e){logger[_0x0b71('0x9')](_0x51973e[_0x0b71('0xa')]);return _0x5af4e6(null);});}else{return _0x5af4e6(null);}});};exports[_0x0b71('0x1c')]=function(_0x11ed02,_0x14eaf9){return moment(_0x11ed02)[_0x0b71('0x1d')](_0x14eaf9,_0x0b71('0x1e'))[_0x0b71('0x1f')](_0x0b71('0x20'));};exports[_0x0b71('0x21')]=function(_0xb7beab,_0x2f5e58){return moment(_0xb7beab)['subtract'](_0x2f5e58,'seconds')[_0x0b71('0x1f')](_0x0b71('0x20'));};exports['diffTime']=function(_0x3f8804,_0x48f664){return moment(_0x3f8804)[_0x0b71('0x22')](moment(_0x48f664),_0x0b71('0x1e'));};exports['sumTime']=function(_0x311305,_0x66f4a8){return parseInt(_0x311305,0xa)+parseInt(_0x66f4a8,0xa);};exports[_0x0b71('0x23')]=function(){return moment()[_0x0b71('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0b71('0x24')]=function(_0x3f1564,_0x3be4c2){if(_0x3be4c2){return moment(_0x3f1564)[_0x0b71('0x24')](_0x3be4c2);}else{return!![];}};exports[_0x0b71('0x25')]=function(_0x2aec79,_0xb19eb7){if(_0xb19eb7){return moment(_0x2aec79)[_0x0b71('0x25')](_0xb19eb7);}else if(_0x2aec79){return!![];}else{return![];}}; \ No newline at end of file +var _0xebe1=['internal','name','GETUSER|','length','NOTFOUND','result','getUserByInternal','catch','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','GetUser'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebe1,0x19f));var _0x1ebe=function(_0x441315,_0x55af18){_0x441315=_0x441315-0x0;var _0x3f360c=_0xebe1[_0x441315];return _0x3f360c;};'use strict';var jayson=require(_0x1ebe('0x0'));var moment=require(_0x1ebe('0x1'));var BPromise=require(_0x1ebe('0x2'));var client=jayson[_0x1ebe('0x3')][_0x1ebe('0x4')]({'port':0x2329});var logger=require(_0x1ebe('0x5'))(_0x1ebe('0x6'));exports[_0x1ebe('0x7')]=function(_0x17ec9e){logger[_0x1ebe('0x7')](_0x17ec9e);};exports[_0x1ebe('0x8')]=function(_0x26e21e){logger[_0x1ebe('0x8')](JSON[_0x1ebe('0x9')](_0x26e21e));};exports[_0x1ebe('0xa')]=function(_0x1bd724){logger[_0x1ebe('0xa')](_0x1bd724[_0x1ebe('0xb')]);};exports[_0x1ebe('0xc')]=function(_0x33baa3,_0xa17e53){return client[_0x1ebe('0xc')](_0x33baa3,{'body':_0xa17e53})[_0x1ebe('0xd')](function(_0x5be9f8){logger['debug'](JSON[_0x1ebe('0x9')](_0x5be9f8));})['catch'](function(_0xe38ee6){logger[_0x1ebe('0xa')](_0xe38ee6[_0x1ebe('0xb')]);});};function getUser(_0xc47380){return client[_0x1ebe('0xc')](_0x1ebe('0xe'),{'options':{'raw':!![],'attributes':['id',_0x1ebe('0xf'),_0x1ebe('0x10'),'interface'],'where':_0xc47380,'limit':0x1}})[_0x1ebe('0xd')](function(_0x52b4fd){logger[_0x1ebe('0x7')](_0x1ebe('0x11')+JSON[_0x1ebe('0x9')](_0xc47380)+'|'+(_0x52b4fd['result'][_0x1ebe('0x12')]?'FOUND':_0x1ebe('0x13')));return _0x52b4fd[_0x1ebe('0x14')][_0x1ebe('0x12')]?_0x52b4fd[_0x1ebe('0x14')][0x0]:null;});}exports[_0x1ebe('0x15')]=function(_0xcd035e){return new BPromise(function(_0x2d4f30,_0x2fc530){if(_0xcd035e){return getUser({'internal':_0xcd035e})[_0x1ebe('0xd')](function(_0x40793b){return _0x2d4f30(_0x40793b);})[_0x1ebe('0x16')](function(_0x2b7b38){logger['error'](_0x2b7b38[_0x1ebe('0xb')]);return _0x2d4f30(null);});}else{return _0x2d4f30(null);}});};exports[_0x1ebe('0x17')]=function(_0x3e611c){return new BPromise(function(_0x12fa98,_0x29aa04){if(_0x3e611c){return getUser({'interface':_0x3e611c})[_0x1ebe('0xd')](function(_0x5b6e25){return _0x12fa98(_0x5b6e25);})[_0x1ebe('0x16')](function(_0x45a561){logger[_0x1ebe('0xa')](_0x45a561[_0x1ebe('0xb')]);return _0x12fa98(null);});}else{return _0x12fa98(null);}});};exports[_0x1ebe('0x18')]=function(_0x559579){return new BPromise(function(_0x33d7b2,_0x4ea4e8){if(_0x559579){return getUser({'name':_0x559579})[_0x1ebe('0xd')](function(_0x533442){return _0x33d7b2(_0x533442);})['catch'](function(_0x80cd24){logger[_0x1ebe('0xa')](_0x80cd24[_0x1ebe('0xb')]);return _0x33d7b2(null);});}else{return _0x33d7b2(null);}});};exports[_0x1ebe('0x19')]=function(_0xb3e378){return new BPromise(function(_0x1ef0b3,_0x478dca){if(_0xb3e378){return client[_0x1ebe('0xc')](_0x1ebe('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x1ebe('0x10'),_0x1ebe('0x1b'),_0x1ebe('0x1c'),_0x1ebe('0x1d')],'where':{'name':_0xb3e378},'limit':0x1}})[_0x1ebe('0xd')](function(_0x5c739c){logger[_0x1ebe('0x7')](_0x1ebe('0x1e')+_0xb3e378+'|'+(_0x5c739c[_0x1ebe('0x14')][_0x1ebe('0x12')]?'FOUND':_0x1ebe('0x13')));return _0x1ef0b3(_0x5c739c[_0x1ebe('0x14')][_0x1ebe('0x12')]?_0x5c739c['result'][0x0]:null);})[_0x1ebe('0x16')](function(_0x316dce){logger['error'](_0x316dce['stack']);return _0x1ef0b3(null);});}else{return _0x1ef0b3(null);}});};exports[_0x1ebe('0x1f')]=function(_0x14e09c,_0x337f8e){return moment(_0x14e09c)[_0x1ebe('0x20')](_0x337f8e,_0x1ebe('0x21'))[_0x1ebe('0x22')](_0x1ebe('0x23'));};exports['subtractTime']=function(_0x54bccb,_0x20e350){return moment(_0x54bccb)[_0x1ebe('0x24')](_0x20e350,_0x1ebe('0x21'))[_0x1ebe('0x22')](_0x1ebe('0x23'));};exports[_0x1ebe('0x25')]=function(_0x4e4622,_0x181c3d){return moment(_0x4e4622)[_0x1ebe('0x26')](moment(_0x181c3d),_0x1ebe('0x21'));};exports[_0x1ebe('0x27')]=function(_0x2d5223,_0x22e643){return parseInt(_0x2d5223,0xa)+parseInt(_0x22e643,0xa);};exports[_0x1ebe('0x28')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1ebe('0x29')]=function(_0x35f5b8,_0x121d09){if(_0x121d09){return moment(_0x35f5b8)[_0x1ebe('0x29')](_0x121d09);}else{return!![];}};exports['isBefore']=function(_0x3f392f,_0x24596d){if(_0x24596d){return moment(_0x3f392f)[_0x1ebe('0x2a')](_0x24596d);}else if(_0x3f392f){return!![];}else{return![];}}; \ No newline at end of file